From 4d2441a7357e0a5275b48ae74961e7854ca05108 Mon Sep 17 00:00:00 2001 From: Jayachandran C Date: Tue, 19 Oct 2021 16:31:55 -0700 Subject: [PATCH 001/998] Add ImsMedia APIs for interworking with vendor RTP stacks Bug: 203240638 Test: Make Change-Id: Iac9ab17265e36cd15277098fb3dbab1bbf778982 --- .../compatibility_matrix.current.xml | 8 ++ radio/aidl/Android.bp | 22 ++++ .../hardware/radio/ims/media/AmrMode.aidl | 46 +++++++ .../hardware/radio/ims/media/AmrParams.aidl | 40 ++++++ .../hardware/radio/ims/media/CodecParams.aidl | 44 +++++++ .../radio/ims/media/CodecSpecificParams.aidl | 39 ++++++ .../hardware/radio/ims/media/CodecType.aidl | 42 +++++++ .../hardware/radio/ims/media/DtmfParams.aidl | 39 ++++++ .../radio/ims/media/EvsBandwidth.aidl | 42 +++++++ .../hardware/radio/ims/media/EvsMode.aidl | 58 +++++++++ .../hardware/radio/ims/media/EvsParams.aidl | 41 +++++++ .../hardware/radio/ims/media/IImsMedia.aidl | 42 +++++++ .../radio/ims/media/IImsMediaListener.aidl | 41 +++++++ .../radio/ims/media/IImsMediaSession.aidl | 46 +++++++ .../ims/media/IImsMediaSessionListener.aidl | 46 +++++++ .../radio/ims/media/LocalEndPoint.aidl | 39 ++++++ .../radio/ims/media/MediaDirection.aidl | 41 +++++++ .../radio/ims/media/MediaProtocolType.aidl | 39 ++++++ .../ims/media/MediaQualityThreshold.aidl | 43 +++++++ .../radio/ims/media/MediaStackState.aidl | 40 ++++++ .../hardware/radio/ims/media/RtcpConfig.aidl | 42 +++++++ .../ims/media/RtcpXrReportBlockType.aidl | 45 +++++++ .../hardware/radio/ims/media/RtpAddress.aidl | 39 ++++++ .../hardware/radio/ims/media/RtpConfig.aidl | 44 +++++++ .../hardware/radio/ims/media/RtpError.aidl | 44 +++++++ .../radio/ims/media/RtpHeaderExtension.aidl | 39 ++++++ .../hardware/radio/ims/media/RtpSession.aidl | 41 +++++++ .../radio/ims/media/RtpSessionParams.aidl | 43 +++++++ .../radio/ims/media/RtpSessionState.aidl | 41 +++++++ .../hardware/radio/ims/media/SpeechCodec.aidl | 39 ++++++ .../hardware/radio/ims/media/AmrMode.aidl | 41 +++++++ .../hardware/radio/ims/media/AmrParams.aidl | 39 ++++++ .../hardware/radio/ims/media/CodecParams.aidl | 50 ++++++++ .../radio/ims/media/CodecSpecificParams.aidl | 26 ++++ .../hardware/radio/ims/media/CodecType.aidl | 32 +++++ .../hardware/radio/ims/media/DtmfParams.aidl | 29 +++++ .../radio/ims/media/EvsBandwidth.aidl | 27 ++++ .../hardware/radio/ims/media/EvsMode.aidl | 65 ++++++++++ .../hardware/radio/ims/media/EvsParams.aidl | 47 +++++++ .../hardware/radio/ims/media/IImsMedia.aidl | 72 +++++++++++ .../radio/ims/media/IImsMediaListener.aidl | 65 ++++++++++ .../radio/ims/media/IImsMediaSession.aidl | 107 ++++++++++++++++ .../ims/media/IImsMediaSessionListener.aidl | 116 ++++++++++++++++++ .../radio/ims/media/LocalEndPoint.aidl | 27 ++++ .../radio/ims/media/MediaDirection.aidl | 30 +++++ .../radio/ims/media/MediaProtocolType.aidl | 26 ++++ .../ims/media/MediaQualityThreshold.aidl | 36 ++++++ .../radio/ims/media/MediaStackState.aidl | 28 +++++ .../hardware/radio/ims/media/RtcpConfig.aidl | 31 +++++ .../ims/media/RtcpXrReportBlockType.aidl | 40 ++++++ .../hardware/radio/ims/media/RtpAddress.aidl | 25 ++++ .../hardware/radio/ims/media/RtpConfig.aidl | 41 +++++++ .../hardware/radio/ims/media/RtpError.aidl | 36 ++++++ .../radio/ims/media/RtpHeaderExtension.aidl | 26 ++++ .../hardware/radio/ims/media/RtpSession.aidl | 33 +++++ .../radio/ims/media/RtpSessionParams.aidl | 42 +++++++ .../radio/ims/media/RtpSessionState.aidl | 30 +++++ .../hardware/radio/ims/media/SpeechCodec.aidl | 28 +++++ 58 files changed, 2410 insertions(+) create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrParams.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecSpecificParams.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/DtmfParams.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMedia.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaListener.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/LocalEndPoint.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaProtocolType.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityThreshold.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaStackState.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpConfig.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpAddress.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpError.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpHeaderExtension.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSession.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionParams.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionState.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/SpeechCodec.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/AmrMode.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/AmrParams.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/CodecSpecificParams.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/CodecType.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/DtmfParams.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/EvsBandwidth.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/EvsMode.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/IImsMedia.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/IImsMediaListener.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/LocalEndPoint.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/MediaProtocolType.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/MediaQualityThreshold.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/MediaStackState.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/RtcpConfig.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/RtpAddress.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/RtpError.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/RtpHeaderExtension.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/RtpSession.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/RtpSessionParams.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/RtpSessionState.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/SpeechCodec.aidl diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 5d92304b31..76c088a23d 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -571,6 +571,14 @@ default + + android.hardware.radio.ims.media + 1 + + IImsMedia + default + + android.hardware.renderscript 1.0 diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp index c5a3a8bb81..44b1fd9643 100644 --- a/radio/aidl/Android.bp +++ b/radio/aidl/Android.bp @@ -176,3 +176,25 @@ aidl_interface { }, }, } + +aidl_interface { + name: "android.hardware.radio.ims.media", + vendor_available: true, + srcs: ["android/hardware/radio/ims/media/*.aidl"], + stability: "vintf", + imports: ["android.hardware.radio.data"], + backend: { + cpp: { + enabled: false, + }, + java: { + sdk_version: "module_current", + }, + ndk: { + vndk: { + enabled: true, + }, + }, + }, +} + diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl new file mode 100644 index 0000000000..dad6d0a128 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@Backing(type="int") @VintfStability +enum AmrMode { + AMR_MODE_0 = 0, + AMR_MODE_1 = 1, + AMR_MODE_2 = 2, + AMR_MODE_3 = 3, + AMR_MODE_4 = 4, + AMR_MODE_5 = 5, + AMR_MODE_6 = 6, + AMR_MODE_7 = 7, + AMR_MODE_8 = 8, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrParams.aidl new file mode 100644 index 0000000000..36edb7f8c4 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrParams.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable AmrParams { + android.hardware.radio.ims.media.AmrMode amrMode; + boolean octetAligned; + int maxRedundancyMillis; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl new file mode 100644 index 0000000000..bd7ddae494 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable CodecParams { + android.hardware.radio.ims.media.SpeechCodec codec; + int rxPayloadTypeNumber; + int txPayloadTypeNumber; + byte samplingRateKHz; + byte txCodecModeRequest; + boolean dtxEnabled; + android.hardware.radio.ims.media.CodecSpecificParams codecSpecificParams; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecSpecificParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecSpecificParams.aidl new file mode 100644 index 0000000000..08e3f0f15e --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecSpecificParams.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +union CodecSpecificParams { + android.hardware.radio.ims.media.AmrParams amr; + android.hardware.radio.ims.media.EvsParams evs; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl new file mode 100644 index 0000000000..56d28009f9 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@Backing(type="int") @VintfStability +enum CodecType { + AMR = 1, + AMR_WB = 2, + EVS = 4, + PCMA = 8, + PCMU = 16, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/DtmfParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/DtmfParams.aidl new file mode 100644 index 0000000000..659fa0bfb3 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/DtmfParams.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable DtmfParams { + byte payloadTypeNumber; + byte samplingRateKHz; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl new file mode 100644 index 0000000000..eb31175f25 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@Backing(type="int") @VintfStability +enum EvsBandwidth { + NONE = 0, + NARROW_BAND = 1, + WIDE_BAND = 2, + SUPER_WIDE_BAND = 4, + FULL_BAND = 8, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl new file mode 100644 index 0000000000..6b56d5de25 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@Backing(type="int") @VintfStability +enum EvsMode { + EVS_MODE_0 = 0, + EVS_MODE_1 = 1, + EVS_MODE_2 = 2, + EVS_MODE_3 = 3, + EVS_MODE_4 = 4, + EVS_MODE_5 = 5, + EVS_MODE_6 = 6, + EVS_MODE_7 = 7, + EVS_MODE_8 = 8, + EVS_MODE_9 = 9, + EVS_MODE_10 = 10, + EVS_MODE_11 = 11, + EVS_MODE_12 = 12, + EVS_MODE_13 = 13, + EVS_MODE_14 = 14, + EVS_MODE_15 = 15, + EVS_MODE_16 = 16, + EVS_MODE_17 = 17, + EVS_MODE_18 = 18, + EVS_MODE_19 = 19, + EVS_MODE_20 = 20, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl new file mode 100644 index 0000000000..46817df7e1 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable EvsParams { + android.hardware.radio.ims.media.EvsMode evsMode; + byte channelAwareMode; + boolean useHeaderFullOnlyOnTx; + boolean useHeaderFullOnlyOnRx; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMedia.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMedia.aidl new file mode 100644 index 0000000000..c2eec0a96e --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMedia.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +interface IImsMedia { + oneway void setListener(in android.hardware.radio.ims.media.IImsMediaListener mediaListener); + oneway void bringUp(); + oneway void bringDown(); + oneway void openSession(int sessionId, in android.hardware.radio.ims.media.LocalEndPoint localEndPoint, in android.hardware.radio.ims.media.RtpConfig config); + oneway void closeSession(int sessionId); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaListener.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaListener.aidl new file mode 100644 index 0000000000..b15534cd01 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaListener.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +interface IImsMediaListener { + oneway void onBringupResponse(android.hardware.radio.ims.media.RtpError status, in android.hardware.radio.ims.media.SpeechCodec[] supportedCodecs); + oneway void onMediaStackStateChanged(android.hardware.radio.ims.media.MediaStackState state); + oneway void onOpenSessionSuccess(int sessionId, android.hardware.radio.ims.media.IImsMediaSession session); + oneway void onOpenSessionFailure(int sessionId, android.hardware.radio.ims.media.RtpError error); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl new file mode 100644 index 0000000000..48ffaa307d --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +interface IImsMediaSession { + oneway void setListener(in android.hardware.radio.ims.media.IImsMediaSessionListener sessionListener); + oneway void modifySession(in android.hardware.radio.ims.media.RtpConfig config); + oneway void addConfig(in android.hardware.radio.ims.media.RtpConfig config); + oneway void deleteConfig(in android.hardware.radio.ims.media.RtpConfig config); + oneway void confirmConfig(in android.hardware.radio.ims.media.RtpConfig config); + oneway void startDtmf(char dtmfDigit, int volume, int duration); + oneway void stopDtmf(); + oneway void sendHeaderExtension(in android.hardware.radio.ims.media.RtpHeaderExtension[] data); + oneway void setMediaQualityThreshold(in android.hardware.radio.ims.media.MediaQualityThreshold threshold); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl new file mode 100644 index 0000000000..761b1430b9 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +interface IImsMediaSessionListener { + oneway void onSessionChanged(in android.hardware.radio.ims.media.RtpSession session); + oneway void onModifySessionResponse(in android.hardware.radio.ims.media.RtpConfig config, android.hardware.radio.ims.media.RtpError error); + oneway void onAddConfigResponse(in android.hardware.radio.ims.media.RtpConfig config, android.hardware.radio.ims.media.RtpError error); + oneway void onConfirmConfigResponse(in android.hardware.radio.ims.media.RtpConfig config, android.hardware.radio.ims.media.RtpError error); + oneway void onFirstMediaPacketReceived(in android.hardware.radio.ims.media.RtpConfig config); + oneway void onHeaderExtensionReceived(in android.hardware.radio.ims.media.RtpHeaderExtension[] data); + oneway void notifyMediaInactivity(android.hardware.radio.ims.media.MediaProtocolType packetType, int duration); + oneway void notifyPacketLoss(int packetLossPercentage); + oneway void notifyJitter(int jitter); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/LocalEndPoint.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/LocalEndPoint.aidl new file mode 100644 index 0000000000..cb352d66a5 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/LocalEndPoint.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable LocalEndPoint { + android.hardware.radio.ims.media.RtpAddress localAddress; + int modemId; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl new file mode 100644 index 0000000000..4cf5fa2fa5 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@Backing(type="int") @VintfStability +enum MediaDirection { + NO_FLOW = 0, + TRANSMIT_ONLY = 1, + RECEIVE_ONLY = 2, + TRANSMIT_RECEIVE = 3, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaProtocolType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaProtocolType.aidl new file mode 100644 index 0000000000..1a290d439c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaProtocolType.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@Backing(type="int") @VintfStability +enum MediaProtocolType { + RTP = 0, + RTCP = 1, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityThreshold.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityThreshold.aidl new file mode 100644 index 0000000000..a448bac1e0 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityThreshold.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable MediaQualityThreshold { + int rtpInactivityTimerMillis; + int rtcpInactivityTimerMillis; + int rtpPacketLossDurationMillis; + int rtpPacketLossRate; + int jitterDurationMillis; + int rtpJitterMillis; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaStackState.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaStackState.aidl new file mode 100644 index 0000000000..a7bb32376e --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaStackState.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@Backing(type="int") @VintfStability +enum MediaStackState { + NOT_READY = 1, + READY = 2, + ERROR_FATAL = 3, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpConfig.aidl new file mode 100644 index 0000000000..b1f10f26ae --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpConfig.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable RtcpConfig { + String canonicalName; + int transmitPort; + int receivePort; + int transmitIntervalSec; + int rtcpXrBlocks; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl new file mode 100644 index 0000000000..2eefe6fee8 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@Backing(type="int") @VintfStability +enum RtcpXrReportBlockType { + RTCPXR_NONE = 0, + RTCPXR_LOSS_RLE_REPORT_BLOCK = 1, + RTCPXR_DUPLICATE_RLE_REPORT_BLOCK = 2, + RTCPXR_PACKET_RECEIPT_TIMES_REPORT_BLOCK = 4, + RTCPXR_RECEIVER_REFERENCE_TIME_REPORT_BLOCK = 8, + RTCPXR_DLRR_REPORT_BLOCK = 16, + RTCPXR_STATISTICS_SUMMARY_REPORT_BLOCK = 32, + RTCPXR_VOIP_METRICS_REPORT_BLOCK = 64, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpAddress.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpAddress.aidl new file mode 100644 index 0000000000..35357d179a --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpAddress.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable RtpAddress { + String ipAddress; + int portNumber; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl new file mode 100644 index 0000000000..d3af0f803e --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable RtpConfig { + int configId; + android.hardware.radio.ims.media.MediaDirection direction; + android.hardware.radio.ims.media.RtpAddress remoteAddress; + android.hardware.radio.ims.media.RtpSessionParams sessionParams; + android.hardware.radio.ims.media.RtcpConfig rtcpConfig; + android.hardware.radio.data.QosBandwidth downlink; + android.hardware.radio.data.QosBandwidth uplink; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpError.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpError.aidl new file mode 100644 index 0000000000..f5bc1903b1 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpError.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@Backing(type="int") @VintfStability +enum RtpError { + NONE = 0, + INVALID_PARAM = 1, + NOT_READY = 2, + NO_MEMORY = 3, + NO_RESOURCES = 4, + PORT_UNAVAILABLE = 5, + REQUEST_NOT_SUPPORTED = 6, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpHeaderExtension.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpHeaderExtension.aidl new file mode 100644 index 0000000000..83b8a314e3 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpHeaderExtension.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable RtpHeaderExtension { + int localId; + byte[] data; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSession.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSession.aidl new file mode 100644 index 0000000000..93c8b16181 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSession.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable RtpSession { + int sessionId; + android.hardware.radio.ims.media.LocalEndPoint localEndPoint; + android.hardware.radio.ims.media.RtpSessionState sessionState = android.hardware.radio.ims.media.RtpSessionState.CLOSED; + android.hardware.radio.ims.media.RtpConfig[] remoteConfigs; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionParams.aidl new file mode 100644 index 0000000000..8e1af236ae --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionParams.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable RtpSessionParams { + byte pTimeMillis; + byte maxPtimeMillis; + int maxMtuBytes; + int dscp; + android.hardware.radio.ims.media.DtmfParams dtmfParams; + android.hardware.radio.ims.media.CodecParams codecParams; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionState.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionState.aidl new file mode 100644 index 0000000000..02bf98ae46 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionState.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@Backing(type="int") @VintfStability +enum RtpSessionState { + OPEN = 0, + ACTIVE = 1, + SUSPENDED = 2, + CLOSED = 3, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/SpeechCodec.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/SpeechCodec.aidl new file mode 100644 index 0000000000..76a1070489 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/SpeechCodec.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable SpeechCodec { + android.hardware.radio.ims.media.CodecType codecType; + android.hardware.radio.ims.media.EvsBandwidth bandwidth; +} diff --git a/radio/aidl/android/hardware/radio/ims/media/AmrMode.aidl b/radio/aidl/android/hardware/radio/ims/media/AmrMode.aidl new file mode 100644 index 0000000000..e9065b3e58 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/AmrMode.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +/** AMR codec mode to represent the bit rate. See 3ggp Specs 26.976 & 26.071 */ +@VintfStability +@Backing(type="int") +enum AmrMode { + /** 4.75 kbps for AMR / 6.6 kbps for AMR-WB */ + AMR_MODE_0 = 0, + /** 5.15 kbps for AMR / 8.855 kbps for AMR-WB */ + AMR_MODE_1 = 1, + /** 5.9 kbps for AMR / 12.65 kbps for AMR-WB */ + AMR_MODE_2 = 2, + /** 6.7 kbps for AMR / 14.25 kbps for AMR-WB */ + AMR_MODE_3 = 3, + /** 7.4 kbps for AMR / 15.85 kbps for AMR-WB */ + AMR_MODE_4 = 4, + /** 7.95 kbps for AMR / 18.25 kbps for AMR-WB */ + AMR_MODE_5 = 5, + /** 10.2 kbps for AMR / 19.85 kbps for AMR-WB */ + AMR_MODE_6 = 6, + /** 12.2 kbps for AMR / 23.05 kbps for AMR-WB */ + AMR_MODE_7 = 7, + /** Silence frame for AMR / 23.85 kbps for AMR-WB */ + AMR_MODE_8 = 8, +} diff --git a/radio/aidl/android/hardware/radio/ims/media/AmrParams.aidl b/radio/aidl/android/hardware/radio/ims/media/AmrParams.aidl new file mode 100644 index 0000000000..4ed3a24d66 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/AmrParams.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +import android.hardware.radio.ims.media.AmrMode; + +@VintfStability +parcelable AmrParams { + /** mode-set: AMR codec mode to represent the bit rate */ + AmrMode amrMode; + /** + * octet-align: If it's set to true then all fields in the AMR/AMR-WB header + * shall be aligned to octet boundaries by adding padding bits. + */ + boolean octetAligned; + /** + * max-red: It’s the maximum duration in milliseconds that elapses between the + * primary (first) transmission of a frame and any redundant transmission that + * the sender will use. This parameter allows a receiver to have a bounded delay + * when redundancy is used. Allowed values are between 0 (no redundancy will be + * used) and 65535. If the parameter is omitted, no limitation on the use of + * redundancy is present. See RFC 4867 + */ + int maxRedundancyMillis; +} diff --git a/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl b/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl new file mode 100644 index 0000000000..6d38874c81 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +import android.hardware.radio.ims.media.CodecSpecificParams; +import android.hardware.radio.ims.media.SpeechCodec; + +@VintfStability +parcelable CodecParams { + /** Negotiated codec and bandwidth */ + SpeechCodec codec; + /** + * Static or dynamic payload type number negotiated through the SDP for + * the incoming RTP packets. This value shall be matched with the PT value + * of the incoming RTP header. Values 0 to 127, see RFC 3551 section 6 + */ + int rxPayloadTypeNumber; + /** + * Static or dynamic payload type number negotiated through the SDP for + * the outgoing RTP packets. This value shall be set to the PT value + * of the outgoing RTP header. Values 0 to 127, see RFC 3551 section 6 + */ + int txPayloadTypeNumber; + /** Sampling rate in kHz*/ + byte samplingRateKHz; + /** + * cmr: Codec mode request is used to request the speech codec encoder of the + * other party to set the frame type index of speech mode via RTP header, See RFC + * 4867 section 4.3.1. Allowed values are -1, 0 and 1. + */ + byte txCodecModeRequest; + /** dtx: Whether discontinuous transmission is enabled or not */ + boolean dtxEnabled; + /** Codec specific parameters */ + CodecSpecificParams codecSpecificParams; +} diff --git a/radio/aidl/android/hardware/radio/ims/media/CodecSpecificParams.aidl b/radio/aidl/android/hardware/radio/ims/media/CodecSpecificParams.aidl new file mode 100644 index 0000000000..4410c81bb7 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/CodecSpecificParams.aidl @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +import android.hardware.radio.ims.media.AmrParams; +import android.hardware.radio.ims.media.EvsParams; + +@VintfStability +union CodecSpecificParams { + AmrParams amr; + EvsParams evs; +} diff --git a/radio/aidl/android/hardware/radio/ims/media/CodecType.aidl b/radio/aidl/android/hardware/radio/ims/media/CodecType.aidl new file mode 100644 index 0000000000..31218e328e --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/CodecType.aidl @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +@VintfStability +@Backing(type="int") +enum CodecType { + /** Adaptive Multi-Rate */ + AMR = 1 << 0, + /** Adaptive Multi-Rate Wide Band */ + AMR_WB = 1 << 1, + /** Enhanced Voice Services */ + EVS = 1 << 2, + /** G.711 A-law i.e. Pulse Code Modulation using A-law */ + PCMA = 1 << 3, + /** G.711 μ-law i.e. Pulse Code Modulation using μ-law */ + PCMU = 1 << 4, +} diff --git a/radio/aidl/android/hardware/radio/ims/media/DtmfParams.aidl b/radio/aidl/android/hardware/radio/ims/media/DtmfParams.aidl new file mode 100644 index 0000000000..ad920f2f25 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/DtmfParams.aidl @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +@VintfStability +parcelable DtmfParams { + /** + * Dynamic payload type number to be used for DTMF RTP packets. The values is + * in the range from 96 to 127 chosen during the session establishment. The PT + * value of the RTP header of all DTMF packets shall be set with this value. + */ + byte payloadTypeNumber; + /** Sampling rate in kHz */ + byte samplingRateKHz; +} diff --git a/radio/aidl/android/hardware/radio/ims/media/EvsBandwidth.aidl b/radio/aidl/android/hardware/radio/ims/media/EvsBandwidth.aidl new file mode 100644 index 0000000000..8278514bf3 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/EvsBandwidth.aidl @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; +/** EVS Speech codec bandwidths, See 3gpp spec 26.441 Table 1 */ +@VintfStability +@Backing(type="int") +enum EvsBandwidth { + NONE = 0, + NARROW_BAND = 1 << 0, + WIDE_BAND = 1 << 1, + SUPER_WIDE_BAND = 1 << 2, + FULL_BAND = 1 << 3, +} diff --git a/radio/aidl/android/hardware/radio/ims/media/EvsMode.aidl b/radio/aidl/android/hardware/radio/ims/media/EvsMode.aidl new file mode 100644 index 0000000000..fabec5ec97 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/EvsMode.aidl @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +/** EVS codec mode to represent the bit rate. See 3ggp Spec 26.952 Table 5.1 */ +@VintfStability +@Backing(type="int") +enum EvsMode { + /** 6.6 kbps for EVS AMR-WB IO */ + EVS_MODE_0 = 0, + /** 8.855 kbps for AMR-WB IO */ + EVS_MODE_1 = 1, + /** 12.65 kbps for AMR-WB IO */ + EVS_MODE_2 = 2, + /** 14.25 kbps for AMR-WB IO */ + EVS_MODE_3 = 3, + /** 15.85 kbps for AMR-WB IO */ + EVS_MODE_4 = 4, + /** 18.25 kbps for AMR-WB IO */ + EVS_MODE_5 = 5, + /** 19.85 kbps for AMR-WB IO */ + EVS_MODE_6 = 6, + /** 23.05 kbps for AMR-WB IO */ + EVS_MODE_7 = 7, + /** 23.85 kbps for AMR-WB IO */ + EVS_MODE_8 = 8, + /** 5.9 kbps for EVS primary */ + EVS_MODE_9 = 9, + /** 7.2 kbps for EVS primary */ + EVS_MODE_10 = 10, + /** 8.0 kbps for EVS primary */ + EVS_MODE_11 = 11, + /** 9.6 kbps for EVS primary */ + EVS_MODE_12 = 12, + /** 13.2 kbps for EVS primary */ + EVS_MODE_13 = 13, + /** 16.4 kbps for EVS primary */ + EVS_MODE_14 = 14, + /** 24.4 kbps for EVS primary */ + EVS_MODE_15 = 15, + /** 32.0 kbps for EVS primary */ + EVS_MODE_16 = 16, + /** 48.0 kbps for EVS primary */ + EVS_MODE_17 = 17, + /** 64.0 kbps for EVS primary */ + EVS_MODE_18 = 18, + /** 96.0 kbps for EVS primary */ + EVS_MODE_19 = 19, + /** 128.0 kbps for EVS primary */ + EVS_MODE_20 = 20, +} diff --git a/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl b/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl new file mode 100644 index 0000000000..4bccf8ac9a --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +import android.hardware.radio.ims.media.EvsMode; + +@VintfStability +parcelable EvsParams { + /** mode-set: EVS codec mode to represent the bit rate */ + EvsMode evsMode; + /** + * ch-aw-recv: Channel aware mode for the receive direction. Permissible values + * are -1, 0, 2, 3, 5, and 7. If -1, channel-aware mode is disabled in the + * session for the receive direction. If 0 or not present, partial redundancy + * (channel-aware mode) is not used at the start of the session for the receive + * direction. If positive (2, 3, 5, or 7), partial redundancy (channel-aware + * mode) is used at the start of the session for the receive direction using the + * value as the offset, See 3GPP TS 26.445 section 4.4.5 + */ + byte channelAwareMode; + /** + * hf-only: Header full only is used for the outgoing packets. If it's true then + * the session shall support header full format only else the session could + * support both header full format and compact format. + */ + boolean useHeaderFullOnlyOnTx; + /** + * hf-only: Header full only used on the incoming packets. If it's true then the + * session shall support header full format only else the session could support + * both header full format and compact format. + */ + boolean useHeaderFullOnlyOnRx; +} diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMedia.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMedia.aidl new file mode 100644 index 0000000000..46c78e84c7 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMedia.aidl @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +import android.hardware.radio.ims.media.IImsMediaListener; +import android.hardware.radio.ims.media.LocalEndPoint; +import android.hardware.radio.ims.media.RtpConfig; +import android.hardware.radio.ims.media.RtpError; + +/** + * This interface is used by IMS media framework to talk to RTP stack located in another processor. + */ +@VintfStability +oneway interface IImsMedia { + + /** + * Set the listener functions for receiving notifications from the RTP stack. + * + * @param mediaListener Object containing listener methods + */ + void setListener(in IImsMediaListener mediaListener); + + /** + * Brings up and initializes the RTP stack in the offloaded processor. The bring up status + * notified via IImsMediaListener#onBringupResponse() API. The implementation shall notify + * the state of media stack using IImsMediaListener#onMediaStackStateChanged(). + */ + void bringUp(); + + /** + * Brings down the RTP stack in the offloaded processor. This shall release any reserved + * resources and shall notify the status via IImsMediaListener#onMediaStackStateChanged(). + */ + void bringDown(); + + /** + * Opens a RTP session for the local end point with the associated initial remote configuration + * if there is a valid RtpConfig passed. It starts the media flow if the media direction in the + * RtpConfig is set to any value other than NO_MEDIA_FLOW. If the open session is successful + * then the implementation shall return a new IImsMediaSession binder connection for this + * session using IImsMediaListener#onOpenSessionSuccess() API. If the open session is failed + * then the implementation shall return the error using IImsMediaListener#onOpenSessionFailure() + * + * @param sessionId unique identifier of the session + * @param localEndPoint provides IP address, port and logical modem id for local RTP endpoint + * @param config provides remote end point info and codec details. This could be null initially + * and the application may update this later using modifySession() API. + */ + void openSession(int sessionId, in LocalEndPoint localEndPoint, in RtpConfig config); + + /** + * Close the RTP session including cleanup of all the resources associated with the session. + * This shall also close the session specific binder connection opened as part of openSession(). + * + * @param sessionId identifier for the rtp session that needs to be closed + */ + void closeSession(int sessionId); +} diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaListener.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaListener.aidl new file mode 100644 index 0000000000..8f2585fe6d --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaListener.aidl @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +import android.hardware.radio.ims.media.IImsMediaSession; +import android.hardware.radio.ims.media.MediaStackState; +import android.hardware.radio.ims.media.RtpError; +import android.hardware.radio.ims.media.SpeechCodec; + +/** + * Interface declaring listener functions for unsolicited IMS media notifications. + */ +@VintfStability +oneway interface IImsMediaListener { + /** + * Notifies the media stack bring up status and capabilities. + * + * @param status bring up status + * @param supportedCodecs array of supported speech codecs by the implementation + */ + void onBringupResponse(RtpError status, in SpeechCodec[] supportedCodecs); + + /** + * Notifies the state of the media stack whenever there is a change. + * + * @param state current state of the media stack + */ + void onMediaStackStateChanged(MediaStackState state); + + /** + * Fired when a IImsMedia#openSession() API is successful. + * + * @param sessionId identifier of the session + * @param session new IImsMediaSession binder connection to be used for the session + * specific operations + */ + void onOpenSessionSuccess(int sessionId, IImsMediaSession session); + + /** + * Fired when IImsMedia#openSession() API failed to create a new session. + * + * @param sessionId identifier of the session + * @param error one of the following RTP error code + * RtpError :INVALID_PARAM + * RtpError :INTERNAL_ERR + * RtpError :NO_MEMORY + * RtpError :NO_RESOURCES + * RtpError :PORT_UNAVAILABLE + */ + void onOpenSessionFailure(int sessionId, RtpError error); +} diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl new file mode 100644 index 0000000000..98d7bda538 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +import android.hardware.radio.ims.media.IImsMediaSessionListener; +import android.hardware.radio.ims.media.MediaProtocolType; +import android.hardware.radio.ims.media.MediaQualityThreshold; +import android.hardware.radio.ims.media.RtpConfig; +import android.hardware.radio.ims.media.RtpError; +import android.hardware.radio.ims.media.RtpHeaderExtension; + +/** + * Session specific interface used by IMS media framework to talk to the vendor RTP stack. + */ +@VintfStability +oneway interface IImsMediaSession { + + /** + * Set the listener functions to receive IMS media session specific notifications. + * + * @param sessionListener Object containing notification methods + */ + void setListener(in IImsMediaSessionListener sessionListener); + + /** + * Modifies the configuration of the RTP session. It can be used to pause/resume + * the media stream by changing the value of the MediaDirection. + * + * @param config provides remote end point info and codec details + */ + void modifySession(in RtpConfig config); + + /** + * Adds a new remote configuration to a RTP session during early media + * scenarios where the IMS network could add more than one remote endpoint. + * + * @param config provides remote end point info and codec details + */ + void addConfig(in RtpConfig config); + + /** + * Deletes a remote configuration from a RTP session during early media + * scenarios. A session shall have at least one config so this API shall + * not delete the last config. + * + * @param config remote config to be deleted + */ + void deleteConfig(in RtpConfig config); + + /** + * Confirms a remote configuration for a Rtp session for early media scenarios + * when there are more than one remote configs. All other early remote configs + * (potentially including the config created as part of openSession) are auto + * deleted when one config is confirmed. + * Confirming a remote configuration is necessary only if additional + * configurations were created. + * New remote configurations cannot be added after a remote configuration is + * confirmed. + * + * @param config remote config to be confirmed + */ + void confirmConfig(in RtpConfig config); + + /** + * Start sending DTMF digit until the duration expires or a stopDtmf() API + * is received. If the implementation is currently playing a DTMF tone, that + * tone must be stopped first using stopDtmf(). + * + * @param dtmfDigit single char having one of 12 values: 0-9, *, # + * @param volume of the DTMF digit between 0 and -63 dBm dropping the sign. + * @param duration of the key press in milliseconds. -1 means no duration + * is passed and the caller will invoke stopDtmf(). + */ + void startDtmf(char dtmfDigit, int volume, int duration); + + /** Stop sending the last DTMF digit started by startDtmf. */ + void stopDtmf(); + + /** + * Send RTP header extension to the other party in the next RTP packet. + * + * @param data data to be transmitted via RTP header extension + */ + void sendHeaderExtension(in RtpHeaderExtension[] data); + + /** + * Sets the media quality threshold parameters of the session to get + * media quality notifications. + * + * @param threshold media quality thresholds for various quality parameters + */ + void setMediaQualityThreshold(in MediaQualityThreshold threshold); +} diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl new file mode 100644 index 0000000000..b542079f5f --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +import android.hardware.radio.ims.media.MediaProtocolType; +import android.hardware.radio.ims.media.RtpHeaderExtension; +import android.hardware.radio.ims.media.RtpConfig; +import android.hardware.radio.ims.media.RtpError; +import android.hardware.radio.ims.media.RtpSession; + +/** + * Interface declaring listener functions for unsolicited IMS media notifications per session. + */ +@VintfStability +oneway interface IImsMediaSessionListener { + /** + * Notifies whenever a change occurs to the RTP session. + * + * @param session Updated RTP session + */ + void onSessionChanged(in RtpSession session); + + /** + * Notifies the result of IImsMediaSession#modifySession() API. + * + * @param config The RTP config passed in IImsMediaSession#modifySession() API + * @param error RtpError.NONE in case of success else one of the following + * RtpError :INVALID_PARAM + * RtpError :INTERNAL_ERR + * RtpError :NO_MEMORY + * RtpError :NO_RESOURCES + */ + void onModifySessionResponse(in RtpConfig config, RtpError error); + + /** + * Notifies the result of IImsMediaSession#addConfig() API. + * + * @param config The RTP config passed in IImsMediaSession#addConfig() API + * @param error RtpError.NONE in case of success else one of the following + * RtpError :INVALID_PARAM + * RtpError :INTERNAL_ERR + * RtpError :NO_MEMORY + * RtpError :NO_RESOURCES + * RtpError :PORT_UNAVAILABLE + */ + void onAddConfigResponse(in RtpConfig config, RtpError error); + + /** + * Notifies the result of IImsMediaSession#confirmConfig() API. + * + * @param config The RtpConfig passed in IImsMediaSession#confirmConfig() API + * @param error RtpError.NONE in case of success else one of the following + * RtpError :INVALID_PARAM + * RtpError :INTERNAL_ERR + * RtpError :NO_RESOURCES + */ + void onConfirmConfigResponse(in RtpConfig config, RtpError error); + + /** + * Indicates when the first Rtp media packet is received by the UE during ring + * back, call hold or early media scenarios. This is sent only if the packet is + * received on the active remote configuration. + * + * In case of early media scenarios, the implementation shall play the RTP + * packets from the most recently added config. + * + * @param config The remote config where the media is received + */ + void onFirstMediaPacketReceived(in RtpConfig config); + + /** + * RTP header extension received from the other party + * + * @param data content of the received RTP header extension + */ + void onHeaderExtensionReceived(in RtpHeaderExtension[] data); + + /** + * Notifies media inactivity observed as per thresholds set by + * setMediaQualityThreshold() API + * + * @param packetType either RTP or RTCP + * @param duration Inactivity duration + */ + void notifyMediaInactivity(MediaProtocolType packetType, int duration); + + /** + * Notifies RTP packet loss observed as per thresholds set by + * setMediaQualityThreshold() API + * + * @param packetLossPercentage percentage of packet loss calculated over the duration + */ + void notifyPacketLoss(int packetLossPercentage); + + /** + * Notifies RTP jitter observed as per thresholds set by + * IImsMediaSession#setMediaQualityThreshold() API + * + * @param jitter jitter of the RTP packets in milliseconds calculated over the duration + */ + void notifyJitter(int jitter); +} diff --git a/radio/aidl/android/hardware/radio/ims/media/LocalEndPoint.aidl b/radio/aidl/android/hardware/radio/ims/media/LocalEndPoint.aidl new file mode 100644 index 0000000000..cd8894b869 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/LocalEndPoint.aidl @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +import android.hardware.radio.ims.media.RtpAddress; + +@VintfStability +parcelable LocalEndPoint { + /** IP address/port on the IMS network where the socket needs to be open */ + RtpAddress localAddress; + /** The logical modem ID, returned by IRadioConfig.getPhoneCapability() */ + int modemId; +} diff --git a/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl b/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl new file mode 100644 index 0000000000..196537b71c --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +@VintfStability +@Backing(type="int") +enum MediaDirection { + /** No media flow in either direction */ + NO_FLOW = 0, + /** Device sends outgoing media and drops incoming media */ + TRANSMIT_ONLY = 1, + /** Device receives the downlink media and does not transmit any uplink media */ + RECEIVE_ONLY = 2, + /** Device sends and receive media in both directions */ + TRANSMIT_RECEIVE = 3, +} diff --git a/radio/aidl/android/hardware/radio/ims/media/MediaProtocolType.aidl b/radio/aidl/android/hardware/radio/ims/media/MediaProtocolType.aidl new file mode 100644 index 0000000000..325c6fa69b --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/MediaProtocolType.aidl @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +@VintfStability +@Backing(type="int") +enum MediaProtocolType { + /** Real Time Protocol, see RFC 3550 */ + RTP = 0, + /** Real Time Control Protocol, see RFC 3550 */ + RTCP = 1, +} diff --git a/radio/aidl/android/hardware/radio/ims/media/MediaQualityThreshold.aidl b/radio/aidl/android/hardware/radio/ims/media/MediaQualityThreshold.aidl new file mode 100644 index 0000000000..946bd5cfbb --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/MediaQualityThreshold.aidl @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +@VintfStability +parcelable MediaQualityThreshold { + /** Timer in milliseconds for monitoring RTP inactivity */ + int rtpInactivityTimerMillis; + /** Timer in milliseconds for monitoring RTCP inactivity */ + int rtcpInactivityTimerMillis; + /** Duration in milliseconds for monitoring the RTP packet loss rate */ + int rtpPacketLossDurationMillis; + /** + * Packet loss rate in percentage of (total number of packets lost) / + * (total number of packets expected) during rtpPacketLossDurationMs + */ + int rtpPacketLossRate; + /** Duration in milliseconds for monitoring the jitter for RTP traffic */ + int jitterDurationMillis; + /** RTP jitter threshold in milliseconds */ + int rtpJitterMillis; +} diff --git a/radio/aidl/android/hardware/radio/ims/media/MediaStackState.aidl b/radio/aidl/android/hardware/radio/ims/media/MediaStackState.aidl new file mode 100644 index 0000000000..25b239e298 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/MediaStackState.aidl @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +@VintfStability +@Backing(type="int") +enum MediaStackState { + /** The media stack is not initialized */ + NOT_READY = 1, + /** The media stack is initialized and ready */ + READY = 2, + /** The media stack is in unrecoverable error condition */ + ERROR_FATAL = 3, +} diff --git a/radio/aidl/android/hardware/radio/ims/media/RtcpConfig.aidl b/radio/aidl/android/hardware/radio/ims/media/RtcpConfig.aidl new file mode 100644 index 0000000000..61f98d06db --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/RtcpConfig.aidl @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +@VintfStability +parcelable RtcpConfig { + /** Canonical name that will be sent to all session participants */ + String canonicalName; + /** Port for sending outgoing RTCP packets */ + int transmitPort; + /** Port where incoming RTCP packets are received */ + int receivePort; + /** Transmit interval in seconds. Value 0 indicates that RTCP reports should not be reported */ + int transmitIntervalSec; + /** Bitmask of RTCP-XR blocks to enable as in RtcpXrReportBlockType */ + int rtcpXrBlocks; +} diff --git a/radio/aidl/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl b/radio/aidl/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl new file mode 100644 index 0000000000..7f6839a6bc --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +/** RTP Control Protocol Extended Reports (RTCP XR) Blocks, See RFC 3611 section 4 */ + +@VintfStability +@Backing(type="int") +enum RtcpXrReportBlockType { + /** Disable RTCP XR */ + RTCPXR_NONE = 0, + /** Loss RLE Report Block */ + RTCPXR_LOSS_RLE_REPORT_BLOCK = 1 << 0, + /** Duplicate RLE Report Block */ + RTCPXR_DUPLICATE_RLE_REPORT_BLOCK = 1 << 1, + /** Packet Receipt Times Report Block */ + RTCPXR_PACKET_RECEIPT_TIMES_REPORT_BLOCK = 1 << 2, + /** Receiver Reference Time Report Block */ + RTCPXR_RECEIVER_REFERENCE_TIME_REPORT_BLOCK = 1 << 3, + /** DLRR Report Block */ + RTCPXR_DLRR_REPORT_BLOCK = 1 << 4, + /** Statistics Summary Report Block */ + RTCPXR_STATISTICS_SUMMARY_REPORT_BLOCK = 1 << 5, + /** VoIP Metrics Report Block */ + RTCPXR_VOIP_METRICS_REPORT_BLOCK = 1 << 6, +} diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpAddress.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpAddress.aidl new file mode 100644 index 0000000000..2db73a3fbd --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/RtpAddress.aidl @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +@VintfStability +parcelable RtpAddress { + /** Point to point IP address */ + String ipAddress; + /** UDP port number used for the RTP traffic */ + int portNumber; +} diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl new file mode 100644 index 0000000000..9f366f78a2 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +import android.hardware.radio.data.QosBandwidth; +import android.hardware.radio.ims.media.MediaDirection; +import android.hardware.radio.ims.media.RtcpConfig; +import android.hardware.radio.ims.media.RtpAddress; +import android.hardware.radio.ims.media.RtpSessionParams; + +@VintfStability +parcelable RtpConfig { + /** Unique identifier of the RTP config within a session */ + int configId; + /** Media flow direction */ + MediaDirection direction; + /** IP address and port number of the other party */ + RtpAddress remoteAddress; + /** Negotiated session parameters */ + RtpSessionParams sessionParams; + /** RTCP configuration */ + RtcpConfig rtcpConfig; + /** Downlink bandwidth allocated by network in the dedicated bearer */ + QosBandwidth downlink; + /** Uplink bandwidth allocated by network in the dedicated bearer */ + QosBandwidth uplink; +} diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpError.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpError.aidl new file mode 100644 index 0000000000..84f26aec66 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/RtpError.aidl @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +@VintfStability +@Backing(type="int") +enum RtpError { + /** Success */ + NONE = 0, + /** Invalid parameters passed in the request */ + INVALID_PARAM = 1, + /** The RTP stack is not ready to handle the request */ + NOT_READY = 2, + /** Unable to handle the request due to memory allocation failure */ + NO_MEMORY = 3, + /** Unable to handle the request due to no sufficient resources such as audio, codec */ + NO_RESOURCES = 4, + /** The requested port number is not available */ + PORT_UNAVAILABLE = 5, + /** The request is not supported by the implementation */ + REQUEST_NOT_SUPPORTED = 6, +} diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpHeaderExtension.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpHeaderExtension.aidl new file mode 100644 index 0000000000..76b13dc629 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/RtpHeaderExtension.aidl @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +/** RTP Header Extensions, see RFC 8285 */ +@VintfStability +parcelable RtpHeaderExtension { + /** Local identifier */ + int localId; + /** Extension data bytes */ + byte[] data; +} diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpSession.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpSession.aidl new file mode 100644 index 0000000000..70443b4139 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/RtpSession.aidl @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +import android.hardware.radio.ims.media.LocalEndPoint; +import android.hardware.radio.ims.media.RtpConfig; +import android.hardware.radio.ims.media.RtpSessionState; + +@VintfStability +parcelable RtpSession { + /** Unique identifier of the session */ + int sessionId; + /** Local RTP address and logical modem identity */ + LocalEndPoint localEndPoint; + /** RTP session state */ + RtpSessionState sessionState = RtpSessionState.CLOSED; + /** List of remote configurations associated with this session */ + RtpConfig[] remoteConfigs; +} diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpSessionParams.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpSessionParams.aidl new file mode 100644 index 0000000000..98aff1fd1e --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/RtpSessionParams.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +import android.hardware.radio.ims.media.CodecParams; +import android.hardware.radio.ims.media.DtmfParams; + +@VintfStability +parcelable RtpSessionParams { + /** + * ptime: Recommended length of time in milliseconds represented by the media + * in each packet, see RFC 4566 + */ + byte pTimeMillis; + /** + * maxptime: Maximum amount of media that can be encapsulated in each packet + * represented in milliseconds, see RFC 4566 + */ + byte maxPtimeMillis; + /** Maximum Rtp transfer unit in bytes */ + int maxMtuBytes; + /** dscp: Differentiated Services Field Code Point value, see RFC 2474 */ + int dscp; + /** DTMF payload and clock rate */ + DtmfParams dtmfParams; + /** Negotiated codec parameters */ + CodecParams codecParams; +} diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpSessionState.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpSessionState.aidl new file mode 100644 index 0000000000..57ba69aa13 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/RtpSessionState.aidl @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +@VintfStability +@Backing(type="int") +enum RtpSessionState { + /** The RTP session is opened and media flow is not started */ + OPEN = 0, + /** The RTP session has active media flow */ + ACTIVE = 1, + /** The RTP session is suspended */ + SUSPENDED = 2, + /** The RTP session is closed */ + CLOSED = 3, +} diff --git a/radio/aidl/android/hardware/radio/ims/media/SpeechCodec.aidl b/radio/aidl/android/hardware/radio/ims/media/SpeechCodec.aidl new file mode 100644 index 0000000000..5d5680f71a --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/SpeechCodec.aidl @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2021 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.hardware.radio.ims.media; + +import android.hardware.radio.ims.media.CodecType; +import android.hardware.radio.ims.media.EvsBandwidth; + +@VintfStability +parcelable SpeechCodec { + /** Codec type */ + CodecType codecType; + /** Codec bandwidth in case of EVS codec type */ + EvsBandwidth bandwidth; +} From 9312c7a6d424bd798151af09264682d43f860e15 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Thu, 16 Dec 2021 21:47:51 +0000 Subject: [PATCH 002/998] Add NrRegistrationInfo to IRadioNetwork Bug: 216387835 Test: build & flash Change-Id: I10c2128b3a2ba3beca1f9e9a91ecd981365756d0 --- .../network/AccessTechnologySpecificInfo.aidl | 1 + .../radio/network/EutranRegistrationInfo.aidl | 6 +++ .../radio/network/NrRegistrationInfo.aidl | 44 +++++++++++++++++++ .../network/AccessTechnologySpecificInfo.aidl | 3 ++ .../radio/network/EutranRegistrationInfo.aidl | 18 ++++++++ .../radio/network/NrRegistrationInfo.aidl | 40 +++++++++++++++++ 6 files changed, 112 insertions(+) create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrRegistrationInfo.aidl create mode 100644 radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl index 4a4a120965..1be1876abb 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl @@ -39,4 +39,5 @@ union AccessTechnologySpecificInfo { android.hardware.radio.network.EutranRegistrationInfo eutranInfo; android.hardware.radio.network.NrVopsInfo ngranNrVopsInfo; boolean geranDtmSupported; + @nullable android.hardware.radio.network.NrRegistrationInfo ngranInfo; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl index 098b57e9cd..2fb592b4c5 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl @@ -36,4 +36,10 @@ package android.hardware.radio.network; parcelable EutranRegistrationInfo { android.hardware.radio.network.LteVopsInfo lteVopsInfo; android.hardware.radio.network.NrIndicators nrIndicators; + byte lteAttachType; + boolean isEmergencyAttached; + const byte EPS_ONLY = 1; + const byte COMBINED_EPS_AND_IMSI = 2; + const byte COMBINED_CSFB_NOT_PREFERRED = 3; + const byte COMBINED_SMS_ONLY = 4; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrRegistrationInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrRegistrationInfo.aidl new file mode 100644 index 0000000000..04d900d01b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrRegistrationInfo.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.network; +@VintfStability +parcelable NrRegistrationInfo { + android.hardware.radio.network.NrVopsInfo ngranNrVopsInfo; + byte resultValue; + boolean isSmsOverNasAllowed; + boolean isEmergencyRegistered; + const byte REGISTERED_OVER_3GPP = 1; + const byte REGISTERED_OVER_NON_3GPP = 2; + const byte REGISTERED_OVER_3GPP_AND_NON_3GPP = 3; +} diff --git a/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl b/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl index dfd62a7b8e..1ec0c3a3f6 100644 --- a/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.network; import android.hardware.radio.network.Cdma2000RegistrationInfo; import android.hardware.radio.network.EutranRegistrationInfo; +import android.hardware.radio.network.NrRegistrationInfo; import android.hardware.radio.network.NrVopsInfo; @VintfStability @@ -35,4 +36,6 @@ union AccessTechnologySpecificInfo { * True if the dual transfer mode is supported. Refer to 3GPP TS 44.108 section 3.4.25.3 */ boolean geranDtmSupported; + + @nullable NrRegistrationInfo ngranInfo; } diff --git a/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl b/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl index 5e19c56690..408831f826 100644 --- a/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl @@ -21,6 +21,15 @@ import android.hardware.radio.network.NrIndicators; @VintfStability parcelable EutranRegistrationInfo { + /** LTE is attached with eps only. */ + const byte EPS_ONLY = 1; + /** LTE combined EPS and IMSI attach. */ + const byte COMBINED_EPS_AND_IMSI = 2; + /** LTE combined attach with CSFB not preferred */ + const byte COMBINED_CSFB_NOT_PREFERRED = 3; + /** LTE combined attach for SMS only */ + const byte COMBINED_SMS_ONLY = 4; + /** * Network capabilities for voice over PS services. This info is valid only on LTE network and * must be present when device is camped on LTE. VopsInfo must be empty when device is camped @@ -32,4 +41,13 @@ parcelable EutranRegistrationInfo { * be empty. */ NrIndicators nrIndicators; + + /** + * The type of network attachment. This info is valid only on LTE network and must be present + * when device has attached to the network. + */ + byte lteAttachType; + + /** True if emergency attached */ + boolean isEmergencyAttached; } diff --git a/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl b/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl new file mode 100644 index 0000000000..eb1e9dd299 --- /dev/null +++ b/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ + +package android.hardware.radio.network; + +import android.hardware.radio.network.NrVopsInfo; + +@VintfStability +parcelable NrRegistrationInfo { + /** 5GS registration result value - TS 24.501 9.11.3.6 */ + const byte REGISTERED_OVER_3GPP = 1; + const byte REGISTERED_OVER_NON_3GPP = 2; + const byte REGISTERED_OVER_3GPP_AND_NON_3GPP = 3; + + /** + * Network capabilities for voice over PS services. This info is valid only on NR network and + * must be present when the device is camped on NR. NrVopsInfo must be empty when the device is + * not camped on NR. + */ + NrVopsInfo ngranNrVopsInfo; + /** 5GS registration result value - TS 24.501 9.11.3.6 */ + byte resultValue; + /** 5GS registration result SMS over NAS - TS 24.501 9.11.3.6 */ + boolean isSmsOverNasAllowed; + /** True if emergency registered */ + boolean isEmergencyRegistered; +} From 9d4f38cabe8529109a221c5a15cfaf83b2c381d7 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Thu, 16 Dec 2021 21:50:04 +0000 Subject: [PATCH 003/998] Add IRadioIms AIDL Bug: 216387835 Test: build & flash Change-Id: I9f5d3117265187453b53ef9dd381bb3b600f3082 --- .../compatibility_matrix.current.xml | 10 + radio/aidl/Android.bp | 21 ++ .../radio/ims/ConnectionFailureInfo.aidl | 53 +++++ .../android/hardware/radio/ims/IRadioIms.aidl | 42 ++++ .../radio/ims/IRadioImsIndication.aidl | 39 ++++ .../hardware/radio/ims/IRadioImsResponse.aidl | 41 ++++ .../hardware/radio/ims/ImsRegistration.aidl | 67 +++++++ .../hardware/radio/ims/ImsTrafficType.aidl | 43 ++++ .../android/hardware/radio/ims/SrvccCall.aidl | 67 +++++++ .../radio/ims/ConnectionFailureInfo.aidl | 60 ++++++ .../android/hardware/radio/ims/IRadioIms.aidl | 108 +++++++++++ .../radio/ims/IRadioImsIndication.aidl | 46 +++++ .../hardware/radio/ims/IRadioImsResponse.aidl | 94 +++++++++ .../hardware/radio/ims/ImsRegistration.aidl | 105 ++++++++++ .../hardware/radio/ims/ImsTrafficType.aidl | 39 ++++ .../android/hardware/radio/ims/SrvccCall.aidl | 80 ++++++++ radio/aidl/vts/Android.bp | 4 + radio/aidl/vts/VtsHalRadioTargetTest.cpp | 7 + radio/aidl/vts/radio_aidl_hal_utils.h | 2 + radio/aidl/vts/radio_ims_indication.cpp | 29 +++ radio/aidl/vts/radio_ims_response.cpp | 44 +++++ radio/aidl/vts/radio_ims_test.cpp | 183 ++++++++++++++++++ radio/aidl/vts/radio_ims_utils.h | 79 ++++++++ 23 files changed, 1263 insertions(+) create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ConnectionFailureInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/ConnectionFailureInfo.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/IRadioIms.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/ImsTrafficType.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/SrvccCall.aidl create mode 100644 radio/aidl/vts/radio_ims_indication.cpp create mode 100644 radio/aidl/vts/radio_ims_response.cpp create mode 100644 radio/aidl/vts/radio_ims_test.cpp create mode 100644 radio/aidl/vts/radio_ims_utils.h diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 02601a8f80..e55efea58b 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -569,6 +569,16 @@ slot3 + + android.hardware.radio.ims + 1 + + IRadioIms + slot1 + slot2 + slot3 + + android.hardware.radio 1.6 diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp index 44b1fd9643..3eb6bf258c 100644 --- a/radio/aidl/Android.bp +++ b/radio/aidl/Android.bp @@ -198,3 +198,24 @@ aidl_interface { }, } +aidl_interface { + name: "android.hardware.radio.ims", + vendor_available: true, + srcs: ["android/hardware/radio/ims/*.aidl"], + stability: "vintf", + imports: ["android.hardware.radio"], + backend: { + cpp: { + enabled: false, + }, + java: { + sdk_version: "module_current", + }, + ndk: { + vndk: { + enabled: true, + }, + }, + }, +} + diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ConnectionFailureInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ConnectionFailureInfo.aidl new file mode 100644 index 0000000000..79daf6dcd8 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ConnectionFailureInfo.aidl @@ -0,0 +1,53 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@VintfStability +parcelable ConnectionFailureInfo { + android.hardware.radio.ims.ConnectionFailureInfo.ConnectionFailureReason failureReason; + int causeCode; + int waitTimeMillis; + @Backing(type="int") @VintfStability + enum ConnectionFailureReason { + REASON_ACCESS_DENIED = 1, + REASON_NAS_FAILURE = 2, + REASON_RACH_FAILURE = 3, + REASON_RLC_FAILURE = 4, + REASON_RRC_REJECT = 5, + REASON_RRC_TIMEOUT = 6, + REASON_NO_SERVICE = 7, + REASON_PDN_NOT_AVAILABLE = 8, + REASON_RF_BUSY = 9, + REASON_UNSPECIFIED = 65535, + } +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl new file mode 100644 index 0000000000..2930338953 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@VintfStability +interface IRadioIms { + oneway void setSrvccCallInfo(int serial, in android.hardware.radio.ims.SrvccCall[] srvccCalls); + oneway void updateImsRegistrationInfo(int serial, in android.hardware.radio.ims.ImsRegistration imsRegistration); + oneway void notifyImsTraffic(int serial, int token, android.hardware.radio.ims.ImsTrafficType imsTrafficType, boolean isStart); + oneway void performAcbCheck(int serial, int token, android.hardware.radio.ims.ImsTrafficType imsTrafficType); + oneway void setResponseFunctions(in android.hardware.radio.ims.IRadioImsResponse radioImsResponse, in android.hardware.radio.ims.IRadioImsIndication radioImsIndication); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl new file mode 100644 index 0000000000..0246af1177 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@VintfStability +interface IRadioImsIndication { + oneway void onConnectionSetupFailure(in android.hardware.radio.RadioIndicationType type, int token, in android.hardware.radio.ims.ConnectionFailureInfo info); + oneway void onAccessAllowed(in android.hardware.radio.RadioIndicationType type, int token); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl new file mode 100644 index 0000000000..58f7eb9de3 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@VintfStability +interface IRadioImsResponse { + oneway void setSrvccCallInfoResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void updateImsRegistrationInfoResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void notifyImsTrafficResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void performAcbCheckResponse(in android.hardware.radio.RadioResponseInfo info); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl new file mode 100644 index 0000000000..f843095d1b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl @@ -0,0 +1,67 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@VintfStability +parcelable ImsRegistration { + android.hardware.radio.ims.ImsRegistration.State state; + android.hardware.radio.ims.ImsRegistration.ImsAccessNetwork ipcan; + android.hardware.radio.ims.ImsRegistration.FailureReason reason; + int features; + const int FEATURE_NONE = 0; + const int FEATURE_VOICE = 1; + const int FEATURE_VIDEO = 2; + const int FEATURE_SMS = 4; + @Backing(type="int") @VintfStability + enum State { + NOT_REGISTERED = 0, + REGISTERING = 1, + REGISTERED = 2, + } + @Backing(type="int") @VintfStability + enum ImsAccessNetwork { + NONE = 0, + EUTRAN = 1, + NGRAN = 2, + UTRAN = 3, + IWLAN = 4, + CROSS_SIM = 5, + } + @Backing(type="int") @VintfStability + enum FailureReason { + NONE = 0, + FATAL_ERROR = 1, + REPEATED_ERROR = 2, + TEMPORARY_ERROR = 3, + } +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl new file mode 100644 index 0000000000..413faa7571 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@Backing(type="int") @VintfStability +enum ImsTrafficType { + EMERGENCY = 0, + EMERGENCY_SMS = 1, + VOICE = 2, + VIDEO = 3, + SMS = 4, + REGISTRATION = 5, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl new file mode 100644 index 0000000000..1fb44dc85b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl @@ -0,0 +1,67 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@VintfStability +parcelable SrvccCall { + int index; + android.hardware.radio.ims.SrvccCall.CallType callType; + int callState; + android.hardware.radio.ims.SrvccCall.CallSubState callSubstate; + android.hardware.radio.ims.SrvccCall.ToneType ringbackToneType; + boolean isMpty; + boolean isMT; + String number; + int numPresentation; + String name; + int namePresentation; + @Backing(type="int") @VintfStability + enum CallType { + NORMAL = 0, + EMERGENCY = 1, + } + @Backing(type="int") @VintfStability + enum CallSubState { + NONE = 0, + PREALERTING = 1, + ANSWERED = 2, + HOLD_REQUESTED = 3, + RESUME_REQUESTED = 4, + } + @Backing(type="int") @VintfStability + enum ToneType { + NONE = 0, + LOCAL = 1, + NETWORK = 2, + } +} diff --git a/radio/aidl/android/hardware/radio/ims/ConnectionFailureInfo.aidl b/radio/aidl/android/hardware/radio/ims/ConnectionFailureInfo.aidl new file mode 100644 index 0000000000..0b6415cdeb --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/ConnectionFailureInfo.aidl @@ -0,0 +1,60 @@ +/* + * 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. + */ + +package android.hardware.radio.ims; + +@VintfStability +parcelable ConnectionFailureInfo { + + @VintfStability + @Backing(type="int") + enum ConnectionFailureReason { + /** Access class check failed */ + REASON_ACCESS_DENIED = 1, + /** 3GPP Non-access stratum failure */ + REASON_NAS_FAILURE = 2, + /** Random access failure */ + REASON_RACH_FAILURE = 3, + /** Radio link failure */ + REASON_RLC_FAILURE = 4, + /** Radio connection establishment rejected by network */ + REASON_RRC_REJECT = 5, + /** Radio connection establishment timed out */ + REASON_RRC_TIMEOUT = 6, + /** Device currently not in service */ + REASON_NO_SERVICE = 7, + /** The PDN is no more active */ + REASON_PDN_NOT_AVAILABLE = 8, + /** Radio resource is busy with another subscription */ + REASON_RF_BUSY = 9, + REASON_UNSPECIFIED = 0xFFFF, + } + + /** + * Values are REASON_ + */ + ConnectionFailureReason failureReason; + + /** + * Failure cause code from network or modem specific to the failure + */ + int causeCode; + + /** + * Retry wait time provided by network in milliseconds + */ + int waitTimeMillis; +} diff --git a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl new file mode 100644 index 0000000000..1e5e2f7fc9 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl @@ -0,0 +1,108 @@ +/* + * 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. + */ + +package android.hardware.radio.ims; + +import android.hardware.radio.ims.ImsRegistration; +import android.hardware.radio.ims.ImsTrafficType; +import android.hardware.radio.ims.IRadioImsIndication; +import android.hardware.radio.ims.IRadioImsResponse; +import android.hardware.radio.ims.SrvccCall; + +/** + * This interface is used by IMS telephony layer to talk to cellular radio. + * All the functions have minimum one parameter: + * serial: which corresponds to serial no. of request. Serial numbers must only be memorized for the + * duration of a method call. If clients provide colliding serials (including passing the same + * serial to different methods), multiple responses (one for each method call) must still be served. + * setResponseFunctions must work with IRadioImsResponse and IRadioImsIndication. + */ +@VintfStability +oneway interface IRadioIms { + /** + * Provides a list of SRVCC call information to radio. + * + * @param srvccCalls the list of calls + * + * Response function is IRadioImsResponse.setSrvccCallInfoResponse() + */ + void setSrvccCallInfo(int serial, in SrvccCall[] srvccCalls); + + /** + * Update the IMS registration information to the radio. + * + * This information shall be used by radio to implement following carrier requirements: + * 1) Graceful IMS PDN disconnection on cellular when NAS is about to perform detach + * eg. SIM removal or SIM refresh + * 2) Block PLMN or RAT based on the IMS registration failure reason + * 3) Start IMS establishment timers when on IMS registration is started + * + * @param serial Serial number of request + * @param imsRegistration IMS registration information + * + * Response function is IRadioImsResponse.updateImsRegistrationInfoResponse() + */ + void updateImsRegistrationInfo(int serial, in ImsRegistration imsRegistration); + + /** + * IMS stack notifies the NAS and RRC layers of the radio that the upcoming IMS traffic is + * for the service mentioned in the ImsTrafficType. If this API is not + * explicitly invoked and IMS module sends traffic on IMS PDN then the radio + * shall treat type as background data traffic type. + * This API shall be used by modem + * 1. To set the appropriate establishment cause in RRC connection request. + * 2. To prioritize RF resources in case of DSDS. The service priority is + * EMERGENCY > EMERGENCY SMS > VOICE > VIDEO > SMS > REGISTRATION > BACKGROUND + * DATA. The RF shall be prioritized to the subscription which handles higher + * priority service. When both subscriptions are handling the same type of + * service then RF shall be prioritized to the voice preferred sub. + * + * @param token Token number of the request + * @param imsTrafficType IMS traffic type like registration, voice, and video + * @param isStart true when the traffic flow starts, false when traffic flow stops. + * false will not be notified for SMS as it's a short traffic. + * + * Response function is IRadioImsResponse.notifyImsTrafficResponse() + */ + void notifyImsTraffic(int serial, int token, + ImsTrafficType imsTrafficType, boolean isStart); + + /** + * This API shall check access class barring checks based on ImsTrafficType. + * In case of access class is allowed then + * IRadioImsIndication#onAccessAllowed(token) shall be invoked by radio + * so the IMS stack can transmit the data. + * In case of access is denied + * IRadioImsIndication#onConnectionSetupFailure(token, REASON_ACCESS_DENIED) + * shall be invoked. + * + * @param token Token number of the request + * @param imsTrafficType IMS traffic type like registration, voice + * video, SMS, emergency etc + * + * Response function is IRadioImsResponse.performAcbCheckResponse() + */ + void performAcbCheck(int serial, int token, ImsTrafficType imsTrafficType); + + /** + * Set response functions for IMS radio requests and indications. + * + * @param radioImsResponse Object containing response functions + * @param radioImsIndication Object containing radio indications + */ + void setResponseFunctions(in IRadioImsResponse radioImsResponse, + in IRadioImsIndication radioImsIndication); +} diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl new file mode 100644 index 0000000000..2731c80235 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ + +package android.hardware.radio.ims; + +import android.hardware.radio.RadioIndicationType; +import android.hardware.radio.ims.ConnectionFailureInfo; + +/** + * Interface declaring unsolicited radio indications for ims APIs. + */ +@VintfStability +oneway interface IRadioImsIndication { + /** + * Fired by radio when any IMS traffic is not sent to network due to any failure + * on cellular networks. + * + * @param token The token number of the notifyImsTraffic() or performACBcheck() APIs + * @param type Type of radio indication + * @param info Connection failure information + */ + void onConnectionSetupFailure(in RadioIndicationType type, int token, + in ConnectionFailureInfo info); + + /** + * Fired by radio in response to performAcbCheck(token, trafficType) + * if the access class check is allowed for the requested traffic type. + * + * @param token The token of the operation of performAcbCheck() API + * @param type Type of radio indication + */ + void onAccessAllowed(in RadioIndicationType type, int token); +} diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl new file mode 100644 index 0000000000..8a736fa84b --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl @@ -0,0 +1,94 @@ +/* + * 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. + */ + +package android.hardware.radio.ims; + +import android.hardware.radio.RadioResponseInfo; + +/** + * Interface declaring response functions to solicited radio requests for ims APIs. + */ +@VintfStability +oneway interface IRadioImsResponse { + + /** + * @param info Response info struct containing response type, serial no. and error + * + * Valid errors returned: + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:INVALID_STATE + * RadioError:NO_MEMORY + * RadioError:SYSTEM_ERR + * RadioError:MODEM_ERR + * RadioError:INTERNAL_ERR + * RadioError:INVALID_ARGUMENTS + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:NO_RESOURCES + */ + void setSrvccCallInfoResponse(in RadioResponseInfo info); + + /** + * @param info Response info struct containing response type, serial no. and error + * + * Valid errors returned: + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:INVALID_STATE + * RadioError:NO_MEMORY + * RadioError:SYSTEM_ERR + * RadioError:MODEM_ERR + * RadioError:INTERNAL_ERR + * RadioError:INVALID_ARGUMENTS + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:NO_RESOURCES + */ + void updateImsRegistrationInfoResponse(in RadioResponseInfo info); + + /** + * @param info Response info struct containing response type, serial no. and error + * + * Valid errors returned: + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:INVALID_STATE + * RadioError:NO_MEMORY + * RadioError:SYSTEM_ERR + * RadioError:MODEM_ERR + * RadioError:INTERNAL_ERR + * RadioError:INVALID_ARGUMENTS + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:NO_RESOURCES + */ + void notifyImsTrafficResponse(in RadioResponseInfo info); + + /** + * @param info Response info struct containing response type, serial no. and error + * + * Valid errors returned: + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:INVALID_STATE + * RadioError:NO_MEMORY + * RadioError:SYSTEM_ERR + * RadioError:MODEM_ERR + * RadioError:INTERNAL_ERR + * RadioError:INVALID_ARGUMENTS + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:NO_RESOURCES + */ + void performAcbCheckResponse(in RadioResponseInfo info); +} diff --git a/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl b/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl new file mode 100644 index 0000000000..a011b4002a --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl @@ -0,0 +1,105 @@ +/* + * 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. + */ + +package android.hardware.radio.ims; + +@VintfStability +parcelable ImsRegistration { + + @VintfStability + @Backing(type="int") + enum State { + /** IMS is not registered */ + NOT_REGISTERED, + /** + * IMS registration procedure just started. + * It could be used by radio to start IMS establishment timer based on carrier requirements. + */ + REGISTERING, + /** IMS is successfully registered */ + REGISTERED, + } + + @VintfStability + @Backing(type="int") + enum ImsAccessNetwork { + /** + * Indicates the access network where IMS is registered. If IMS is registered on + * cellular then the radio shall wait for IMS PDN disconnection for 4 seconds + * before performing NAS detach procedure. This requirement is not applicable for + * if access network IWLAN and CROSS_SIM. + */ + NONE, + EUTRAN, + NGRAN, + UTRAN, + /** The IMS registration is done over WiFi network. */ + IWLAN, + /** + * The radio shall not consider the registration information with this type + * while voice domain selection is performed. + * The IMS registration is done over internet of the default data subscription. + */ + CROSS_SIM, + } + + @VintfStability + @Backing(type="int") + enum FailureReason { + /** Default value */ + NONE, + /** + * Indicates that the IMS registration is failed with fatal error 403 or 404 + * on all P-CSCF addresses. The radio shall block the current PLMN or disable + * the RAT as per the carrier requirements. + */ + FATAL_ERROR, + /** + * Indicates that the IMS registration on current PLMN failed multiple times. + * The radio shall block the current PLMN or disable the RAT as per the + * carrier requirements. + */ + REPEATED_ERROR, + /* + * Indicates that IMS registration has failed temporarily. + */ + TEMPORARY_ERROR, + } + + /** Default value */ + const int FEATURE_NONE = 0; + /** IMS voice feature */ + const int FEATURE_VOICE = 1 << 0; + /** IMS video feature */ + const int FEATURE_VIDEO = 1 << 1; + /** IMS SMS feature */ + const int FEATURE_SMS = 1 << 2; + + /** Indicates the current IMS registration state. */ + State state; + + /** Indicates the IP connectivity access network where IMS features are registered. */ + ImsAccessNetwork ipcan; + + /** Indicates a failure reason for IMS registration. */ + FailureReason reason; + + /** + * Values are bitwise ORs of FEATURE_. + * IMS features such as VOICE, VIDEO and SMS. + */ + int features; +} diff --git a/radio/aidl/android/hardware/radio/ims/ImsTrafficType.aidl b/radio/aidl/android/hardware/radio/ims/ImsTrafficType.aidl new file mode 100644 index 0000000000..f6d16ca7e5 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/ImsTrafficType.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ + +package android.hardware.radio.ims; + +@VintfStability +@Backing(type="int") +enum ImsTrafficType { + /** Emergency call */ + EMERGENCY, + + /** Emergency SMS */ + EMERGENCY_SMS, + + /** Voice call */ + VOICE, + + /** Video call */ + VIDEO, + + /** SMS over IMS */ + SMS, + + /** IMS registration and subscription for reg event package (signaling) */ + REGISTRATION, +} diff --git a/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl b/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl new file mode 100644 index 0000000000..e7e76b12d9 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl @@ -0,0 +1,80 @@ +/* + * 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. + */ + +package android.hardware.radio.ims; + +@VintfStability +parcelable SrvccCall { + + @VintfStability + @Backing(type="int") + enum CallType { + NORMAL, + EMERGENCY, + } + + @VintfStability + @Backing(type="int") + enum CallSubState { + NONE, + /** Pre-alerting state. Applicable for MT calls only */ + PREALERTING, + ANSWERED, + HOLD_REQUESTED, + RESUME_REQUESTED, + } + + @VintfStability + @Backing(type="int") + enum ToneType { + NONE, + LOCAL, + NETWORK, + } + + /** Connection index */ + int index; + + /** The type of the call */ + CallType callType; + + /** Values are android.hardware.radio.voice.Call.STATE_ */ + int callState; + + /** The substate of the call */ + CallSubState callSubstate; + + /** The type of the ringback tone */ + ToneType ringbackToneType; + + /** true if is mpty call */ + boolean isMpty; + + /** true if call is mobile terminated */ + boolean isMT; + + /** Remote party nummber */ + String number; + + /** Values are android.hardware.radio.voice.Call.PRESENTATION_ */ + int numPresentation; + + /** Remote party name */ + String name; + + /** Values are android.hardware.radio.voice.Call.PRESENTATION_ */ + int namePresentation; +} diff --git a/radio/aidl/vts/Android.bp b/radio/aidl/vts/Android.bp index 8060e4bcc3..eaec28b5eb 100644 --- a/radio/aidl/vts/Android.bp +++ b/radio/aidl/vts/Android.bp @@ -35,6 +35,9 @@ cc_test { "radio_data_indication.cpp", "radio_data_response.cpp", "radio_data_test.cpp", + "radio_ims_indication.cpp", + "radio_ims_response.cpp", + "radio_ims_test.cpp", "radio_messaging_indication.cpp", "radio_messaging_response.cpp", "radio_messaging_test.cpp", @@ -60,6 +63,7 @@ cc_test { "android.hardware.radio-V1-ndk", "android.hardware.radio.config-V1-ndk", "android.hardware.radio.data-V1-ndk", + "android.hardware.radio.ims-V1-ndk", "android.hardware.radio.messaging-V1-ndk", "android.hardware.radio.modem-V1-ndk", "android.hardware.radio.network-V1-ndk", diff --git a/radio/aidl/vts/VtsHalRadioTargetTest.cpp b/radio/aidl/vts/VtsHalRadioTargetTest.cpp index 1ebc6afa8a..67a2672c9b 100644 --- a/radio/aidl/vts/VtsHalRadioTargetTest.cpp +++ b/radio/aidl/vts/VtsHalRadioTargetTest.cpp @@ -18,6 +18,7 @@ #include "radio_config_utils.h" #include "radio_data_utils.h" +#include "radio_ims_utils.h" #include "radio_messaging_utils.h" #include "radio_modem_utils.h" #include "radio_network_utils.h" @@ -65,6 +66,12 @@ INSTANTIATE_TEST_SUITE_P( testing::ValuesIn(android::getAidlHalInstanceNames(IRadioVoice::descriptor)), android::PrintInstanceNameToString); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioImsTest); +INSTANTIATE_TEST_SUITE_P( + PerInstance, RadioImsTest, + testing::ValuesIn(android::getAidlHalInstanceNames(IRadioIms::descriptor)), + android::PrintInstanceNameToString); + int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); ABinderProcess_setThreadPoolMaxThreadCount(1); diff --git a/radio/aidl/vts/radio_aidl_hal_utils.h b/radio/aidl/vts/radio_aidl_hal_utils.h index 414ffbc456..8bef3b1bbd 100644 --- a/radio/aidl/vts/radio_aidl_hal_utils.h +++ b/radio/aidl/vts/radio_aidl_hal_utils.h @@ -64,6 +64,8 @@ static constexpr const char* FEATURE_TELEPHONY_GSM = "android.hardware.telephony static constexpr const char* FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma"; +static constexpr const char* FEATURE_TELEPHONY_IMS = "android.hardware.telephony.ims"; + #define MODEM_EMERGENCY_CALL_ESTABLISH_TIME 3 #define MODEM_EMERGENCY_CALL_DISCONNECT_TIME 3 #define MODEM_SET_SIM_POWER_DELAY_IN_SECONDS 2 diff --git a/radio/aidl/vts/radio_ims_indication.cpp b/radio/aidl/vts/radio_ims_indication.cpp new file mode 100644 index 0000000000..8c4aa144fd --- /dev/null +++ b/radio/aidl/vts/radio_ims_indication.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2021 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. + */ + +#include "radio_ims_utils.h" + +RadioImsIndication::RadioImsIndication(RadioServiceTest& parent) : parent_ims(parent) {} + +ndk::ScopedAStatus RadioImsIndication::onConnectionSetupFailure(RadioIndicationType /*type*/, + int /*token*/, const ConnectionFailureInfo& /*info*/) { + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioImsIndication::onAccessAllowed(RadioIndicationType /*type*/, + int /*token*/) { + return ndk::ScopedAStatus::ok(); +} diff --git a/radio/aidl/vts/radio_ims_response.cpp b/radio/aidl/vts/radio_ims_response.cpp new file mode 100644 index 0000000000..f9f3401f6f --- /dev/null +++ b/radio/aidl/vts/radio_ims_response.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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. + */ + +#include "radio_ims_utils.h" + +RadioImsResponse::RadioImsResponse(RadioServiceTest& parent) : parent_ims(parent) {} + +ndk::ScopedAStatus RadioImsResponse::setSrvccCallInfoResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_ims.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioImsResponse::updateImsRegistrationInfoResponse( + const RadioResponseInfo& info) { + rspInfo = info; + parent_ims.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioImsResponse::notifyImsTrafficResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_ims.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioImsResponse::performAcbCheckResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_ims.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} diff --git a/radio/aidl/vts/radio_ims_test.cpp b/radio/aidl/vts/radio_ims_test.cpp new file mode 100644 index 0000000000..62a18f1fb7 --- /dev/null +++ b/radio/aidl/vts/radio_ims_test.cpp @@ -0,0 +1,183 @@ +/* + * Copyright (C) 2021 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. + */ + +#include +#include +#include + +#include "radio_ims_utils.h" + +#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk()) + +void RadioImsTest::SetUp() { + std::string serviceName = GetParam(); + + if (!isServiceValidForDeviceConfiguration(serviceName)) { + ALOGI("Skipped the test due to device configuration."); + GTEST_SKIP(); + } + + radio_ims = IRadioIms::fromBinder( + ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str()))); + ASSERT_NE(nullptr, radio_ims.get()); + + radioRsp_ims = ndk::SharedRefBase::make(*this); + ASSERT_NE(nullptr, radioRsp_ims.get()); + + count_ = 0; + + radioInd_ims = ndk::SharedRefBase::make(*this); + ASSERT_NE(nullptr, radioInd_ims.get()); + + radio_ims->setResponseFunctions(radioRsp_ims, radioInd_ims); + + // Assert IRadioConfig exists before testing + radio_config = config::IRadioConfig::fromBinder(ndk::SpAIBinder( + AServiceManager_waitForService("android.hardware.radio.config.IRadioConfig/default"))); + ASSERT_NE(nullptr, radio_config.get()); +} + +/* + * Test IRadioIms.setSrvccCallInfo() for the response returned. + */ +TEST_P(RadioImsTest, setSrvccCallInfo) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) { + ALOGI("Skipping setSrvccCallInfo because ims is not supported in device"); + return; + } else { + ALOGI("Running setSrvccCallInfo because ims is supported in device"); + } + + serial = GetRandomSerialNumber(); + + SrvccCall srvccCall; + + ndk::ScopedAStatus res = + radio_ims->setSrvccCallInfo(serial, { srvccCall }); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type); + EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial); + + ALOGI("setSrvccCallInfo, rspInfo.error = %s\n", + toString(radioRsp_ims->rspInfo.error).c_str()); + + verifyError(radioRsp_ims->rspInfo.error); +} + +/* + * Test IRadioIms.updateImsRegistrationInfo() for the response returned. + */ +TEST_P(RadioImsTest, updateImsRegistrationInfo) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) { + ALOGI("Skipping updateImsRegistrationInfo because ims is not supported in device"); + return; + } else { + ALOGI("Running updateImsRegistrationInfo because ims is supported in device"); + } + + serial = GetRandomSerialNumber(); + + ImsRegistration regInfo; + regInfo.state = ImsRegistration::State::NOT_REGISTERED; + regInfo.ipcan = ImsRegistration::ImsAccessNetwork::NONE; + regInfo.reason = ImsRegistration::FailureReason::NONE; + regInfo.features = ImsRegistration::FEATURE_NONE; + + ndk::ScopedAStatus res = + radio_ims->updateImsRegistrationInfo(serial, regInfo); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type); + EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial); + + ALOGI("updateImsRegistrationInfo, rspInfo.error = %s\n", + toString(radioRsp_ims->rspInfo.error).c_str()); + + verifyError(radioRsp_ims->rspInfo.error); +} + +/* + * Test IRadioIms.notifyImsTraffic() for the response returned. + */ +TEST_P(RadioImsTest, notifyImsTraffic) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) { + ALOGI("Skipping notifyImsTraffic because ims is not supported in device"); + return; + } else { + ALOGI("Running notifyImsTraffic because ims is supported in device"); + } + + serial = GetRandomSerialNumber(); + + ndk::ScopedAStatus res = + radio_ims->notifyImsTraffic(serial, 1, ImsTrafficType::REGISTRATION, false); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type); + EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial); + + ALOGI("notifyImsTraffic, rspInfo.error = %s\n", + toString(radioRsp_ims->rspInfo.error).c_str()); + + verifyError(radioRsp_ims->rspInfo.error); +} + +/* + * Test IRadioIms.performAcbCheck() for the response returned. + */ +TEST_P(RadioImsTest, performAcbCheck) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) { + ALOGI("Skipping performAcbCheck because ims is not supported in device"); + return; + } else { + ALOGI("Running performAcbCheck because ims is supported in device"); + } + + serial = GetRandomSerialNumber(); + + ndk::ScopedAStatus res = + radio_ims->performAcbCheck(serial, 1, ImsTrafficType::REGISTRATION); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type); + EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial); + + ALOGI("performAcbCheck, rspInfo.error = %s\n", + toString(radioRsp_ims->rspInfo.error).c_str()); + + verifyError(radioRsp_ims->rspInfo.error); +} + +void RadioImsTest::verifyError(RadioError resp) { + switch (resp) { + case RadioError::NONE: + case RadioError::RADIO_NOT_AVAILABLE: + case RadioError::INVALID_STATE: + case RadioError::NO_MEMORY: + case RadioError::SYSTEM_ERR: + case RadioError::MODEM_ERR: + case RadioError::INTERNAL_ERR: + case RadioError::INVALID_ARGUMENTS: + case RadioError::REQUEST_NOT_SUPPORTED: + case RadioError::NO_RESOURCES: + SUCCEED(); + break; + default: + FAIL(); + break; + } +} diff --git a/radio/aidl/vts/radio_ims_utils.h b/radio/aidl/vts/radio_ims_utils.h new file mode 100644 index 0000000000..c828e70fa2 --- /dev/null +++ b/radio/aidl/vts/radio_ims_utils.h @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2021 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. + */ + +#pragma once + +#include +#include +#include + +#include "radio_aidl_hal_utils.h" + +using namespace aidl::android::hardware::radio::ims; + +class RadioImsTest; + +/* Callback class for radio ims response */ +class RadioImsResponse : public BnRadioImsResponse { + protected: + RadioServiceTest& parent_ims; + + public: + RadioImsResponse(RadioServiceTest& parent_ims); + virtual ~RadioImsResponse() = default; + + RadioResponseInfo rspInfo; + + virtual ndk::ScopedAStatus setSrvccCallInfoResponse(const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus updateImsRegistrationInfoResponse( + const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus notifyImsTrafficResponse(const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus performAcbCheckResponse(const RadioResponseInfo& info) override; +}; + +/* Callback class for radio ims indication */ +class RadioImsIndication : public BnRadioImsIndication { + protected: + RadioServiceTest& parent_ims; + + public: + RadioImsIndication(RadioServiceTest& parent_ims); + virtual ~RadioImsIndication() = default; + + virtual ndk::ScopedAStatus onConnectionSetupFailure(RadioIndicationType type, int token, + const ConnectionFailureInfo& info) override; + + virtual ndk::ScopedAStatus onAccessAllowed(RadioIndicationType type, int token) override; +}; + +// The main test class for Radio AIDL Ims. +class RadioImsTest : public ::testing::TestWithParam, public RadioServiceTest { + protected: + virtual void verifyError(RadioError resp); + + public: + virtual void SetUp() override; + + /* radio ims service handle */ + std::shared_ptr radio_ims; + /* radio ims response handle */ + std::shared_ptr radioRsp_ims; + /* radio ims indication handle */ + std::shared_ptr radioInd_ims; +}; From 539e1f42548a38463faad9270759d5ac015dcfbb Mon Sep 17 00:00:00 2001 From: Hwayoung Date: Wed, 22 Dec 2021 08:23:46 +0000 Subject: [PATCH 004/998] Add APIs for ANBR Test: manual Change-Id: I5bd11679db7c923b3500f8c2db06abc9d15f8245 --- .../android/hardware/radio/ims/IRadioIms.aidl | 2 + .../radio/ims/IRadioImsIndication.aidl | 1 + .../hardware/radio/ims/IRadioImsResponse.aidl | 2 + .../radio/ims/ImsStreamDirection.aidl | 39 ++++++++++++++ .../android/hardware/radio/ims/IRadioIms.aidl | 31 +++++++++++ .../radio/ims/IRadioImsIndication.aidl | 14 +++++ .../hardware/radio/ims/IRadioImsResponse.aidl | 34 ++++++++++++ .../radio/ims/ImsStreamDirection.aidl | 26 ++++++++++ radio/aidl/vts/radio_ims_indication.cpp | 5 ++ radio/aidl/vts/radio_ims_response.cpp | 12 +++++ radio/aidl/vts/radio_ims_test.cpp | 52 +++++++++++++++++++ 11 files changed, 218 insertions(+) create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/ImsStreamDirection.aidl diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl index 2930338953..5ccf584d1b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl @@ -39,4 +39,6 @@ interface IRadioIms { oneway void notifyImsTraffic(int serial, int token, android.hardware.radio.ims.ImsTrafficType imsTrafficType, boolean isStart); oneway void performAcbCheck(int serial, int token, android.hardware.radio.ims.ImsTrafficType imsTrafficType); oneway void setResponseFunctions(in android.hardware.radio.ims.IRadioImsResponse radioImsResponse, in android.hardware.radio.ims.IRadioImsIndication radioImsIndication); + oneway void setAnbrEnabled(int serial, int qosSessionId, boolean isEnabled); + oneway void sendAnbrQuery(int serial, int qosSessionId, android.hardware.radio.ims.ImsStreamDirection direction, int bitsPerSecond); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl index 0246af1177..06f7fa0a72 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl @@ -36,4 +36,5 @@ package android.hardware.radio.ims; interface IRadioImsIndication { oneway void onConnectionSetupFailure(in android.hardware.radio.RadioIndicationType type, int token, in android.hardware.radio.ims.ConnectionFailureInfo info); oneway void onAccessAllowed(in android.hardware.radio.RadioIndicationType type, int token); + oneway void notifyAnbr(in android.hardware.radio.RadioIndicationType type, int qosSessionId, android.hardware.radio.ims.ImsStreamDirection direction, int bitsPerSecond); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl index 58f7eb9de3..60f396f3ae 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl @@ -38,4 +38,6 @@ interface IRadioImsResponse { oneway void updateImsRegistrationInfoResponse(in android.hardware.radio.RadioResponseInfo info); oneway void notifyImsTrafficResponse(in android.hardware.radio.RadioResponseInfo info); oneway void performAcbCheckResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setAnbrEnabledResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void sendAnbrQueryResponse(in android.hardware.radio.RadioResponseInfo info); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl new file mode 100644 index 0000000000..b5a33c736c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@Backing(type="int") @VintfStability +enum ImsStreamDirection { + UPLINK = 1, + DOWNLINK = 2, +} \ No newline at end of file diff --git a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl index 1e5e2f7fc9..cae6bd04b4 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl @@ -21,6 +21,7 @@ import android.hardware.radio.ims.ImsTrafficType; import android.hardware.radio.ims.IRadioImsIndication; import android.hardware.radio.ims.IRadioImsResponse; import android.hardware.radio.ims.SrvccCall; +import android.hardware.radio.ims.ImsStreamDirection; /** * This interface is used by IMS telephony layer to talk to cellular radio. @@ -105,4 +106,34 @@ oneway interface IRadioIms { */ void setResponseFunctions(in IRadioImsResponse radioImsResponse, in IRadioImsIndication radioImsIndication); + + /** + * Access Network Bitrate Recommendation (ANBR), see 3GPP TS 26.114. + * This API is used to enable or disable the ANBR feature + * for the bearer corresponding to the qosSessionId + * This will be invoked when both parties in a call support the ANBR feature + * In case of video call, the modem shall use qosSessionId to identify + * appropriate media stream + * + * @param serial Serial number of request + * @param qosSessionId QoS session ID is used to identify media stream such as audio or video + * @param isEnabled True if Anbr feature is enabled, false otherwise + * + * Response function is IRadioImsResponse.setAnbrEnabledResponse() + */ + void setAnbrEnabled(int serial, int qosSessionId, boolean isEnabled); + + /** + * Access Network Bitrate Recommendation Query (ANBRQ), see 3GPP TS 26.114. + * This API triggers radio to send ANBRQ message + * to the access network to query the desired bitrate. + * + * @param serial Serial number of request + * @param qosSessionId QoS session ID is used to identify media stream such as audio or video + * @param direction Direction of this packet stream (e.g. uplink or downlink) + * @param bitsPerSecond The bit rate requested by the opponent UE + * + * Response function is IRadioImsResponse.sendAnbrQueryResponse() + */ + void sendAnbrQuery(int serial, int qosSessionId, ImsStreamDirection direction, int bitsPerSecond); } diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl index 2731c80235..317158cd29 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.ims; import android.hardware.radio.RadioIndicationType; import android.hardware.radio.ims.ConnectionFailureInfo; +import android.hardware.radio.ims.ImsStreamDirection; /** * Interface declaring unsolicited radio indications for ims APIs. @@ -43,4 +44,17 @@ oneway interface IRadioImsIndication { * @param type Type of radio indication */ void onAccessAllowed(in RadioIndicationType type, int token); + + /** + * Access Network Bitrate Recommendation (ANBR), see 3GPP TS 26.114. + * Notifies the bit rate received from the network via ANBR message + * + * @param type Type of radio indication + * @param qosSessionId QoS session ID is used to identify media stream such as audio or video + * @param direction Direction of this packet stream (e.g. uplink or downlink) + * @param bitsPerSecond The recommended bit rate for the UE + * for a specific logical channel and a specific direction by NW + */ + void notifyAnbr(in RadioIndicationType type, int qosSessionId, ImsStreamDirection direction, + int bitsPerSecond); } diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl index 8a736fa84b..7cc58a6747 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl @@ -91,4 +91,38 @@ oneway interface IRadioImsResponse { * RadioError:NO_RESOURCES */ void performAcbCheckResponse(in RadioResponseInfo info); + + /** + * @param info Response info struct containing response type, serial no. and error + * + * Valid errors returned: + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:INVALID_STATE + * RadioError:NO_MEMORY + * RadioError:SYSTEM_ERR + * RadioError:MODEM_ERR + * RadioError:INTERNAL_ERR + * RadioError:INVALID_ARGUMENTS + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:NO_RESOURCES + */ + void setAnbrEnabledResponse(in RadioResponseInfo info); + + /** + * @param info Response info struct containing response type, serial no. and error + * + * Valid errors returned: + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:INVALID_STATE + * RadioError:NO_MEMORY + * RadioError:SYSTEM_ERR + * RadioError:MODEM_ERR + * RadioError:INTERNAL_ERR + * RadioError:INVALID_ARGUMENTS + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:NO_RESOURCES + */ + void sendAnbrQueryResponse(in RadioResponseInfo info); } diff --git a/radio/aidl/android/hardware/radio/ims/ImsStreamDirection.aidl b/radio/aidl/android/hardware/radio/ims/ImsStreamDirection.aidl new file mode 100644 index 0000000000..8336a74da7 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/ImsStreamDirection.aidl @@ -0,0 +1,26 @@ +/* + * 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. + */ + +package android.hardware.radio.ims; + +@VintfStability +@Backing(type="int") +enum ImsStreamDirection { + /** DIRECTION_UPLINK - From UE to Network **/ + UPLINK = 1, + /** DIRECTION_DOWNLINK - From Network to UE **/ + DOWNLINK = 2, +} diff --git a/radio/aidl/vts/radio_ims_indication.cpp b/radio/aidl/vts/radio_ims_indication.cpp index 8c4aa144fd..79b4c3bb73 100644 --- a/radio/aidl/vts/radio_ims_indication.cpp +++ b/radio/aidl/vts/radio_ims_indication.cpp @@ -27,3 +27,8 @@ ndk::ScopedAStatus RadioImsIndication::onAccessAllowed(RadioIndicationType /*typ int /*token*/) { return ndk::ScopedAStatus::ok(); } + +ndk::ScopedAStatus RadioImsIndication::notifyAnbr(RadioIndicationType /*type*/, + int /*qosSessionId*/, int /*bitsPerSecond*/) { + return ndk::ScopedAStatus::ok(); +} \ No newline at end of file diff --git a/radio/aidl/vts/radio_ims_response.cpp b/radio/aidl/vts/radio_ims_response.cpp index f9f3401f6f..dd629a5e5b 100644 --- a/radio/aidl/vts/radio_ims_response.cpp +++ b/radio/aidl/vts/radio_ims_response.cpp @@ -42,3 +42,15 @@ ndk::ScopedAStatus RadioImsResponse::performAcbCheckResponse(const RadioResponse parent_ims.notify(info.serial); return ndk::ScopedAStatus::ok(); } + +ndk::ScopedAStatus RadioImsResponse::setAnbrEnabledResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_ims.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioImsResponse::sendAnbrQueryResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_ims.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} \ No newline at end of file diff --git a/radio/aidl/vts/radio_ims_test.cpp b/radio/aidl/vts/radio_ims_test.cpp index 62a18f1fb7..8db8791b8c 100644 --- a/radio/aidl/vts/radio_ims_test.cpp +++ b/radio/aidl/vts/radio_ims_test.cpp @@ -162,6 +162,58 @@ TEST_P(RadioImsTest, performAcbCheck) { verifyError(radioRsp_ims->rspInfo.error); } +/* + * Test IRadioIms.setAnbrEnabled() for the response returned. + */ +TEST_P(RadioImsTest, setAnbrEnabled) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) { + ALOGI("Skipping setAnbrEnabled because ims is not supported in device"); + return; + } else { + ALOGI("Running setAnbrEnabled because ims is supported in device"); + } + + serial = GetRandomSerialNumber(); + + ndk::ScopedAStatus res = + radio_ims->setAnbrEnabled(serial, 1, true); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type); + EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial); + + ALOGI("setAnbrEnabled, rspInfo.error = %s\n", + toString(radioRsp_ims->rspInfo.error).c_str()); + + verifyError(radioRsp_ims->rspInfo.error); +} + +/* + * Test IRadioIms.sendAnbrQuery() for the response returned. + */ +TEST_P(RadioImsTest, sendAnbrQuery) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) { + ALOGI("Skipping sendAnbrQuery because ims is not supported in device"); + return; + } else { + ALOGI("Running sendAnbrQuery because ims is supported in device"); + } + + serial = GetRandomSerialNumber(); + + ndk::ScopedAStatus res = + radio_ims->sendAnbrQuery(serial, 1, 0, 13200); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type); + EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial); + + ALOGI("sendAnbrQuery, rspInfo.error = %s\n", + toString(radioRsp_ims->rspInfo.error).c_str()); + + verifyError(radioRsp_ims->rspInfo.error); +} + void RadioImsTest::verifyError(RadioError resp) { switch (resp) { case RadioError::NONE: From 625a8984e8cdcfc908101a3b94e76b3a2f023eb6 Mon Sep 17 00:00:00 2001 From: Francois Gaffie Date: Tue, 8 Feb 2022 17:40:14 +0100 Subject: [PATCH 005/998] Update Default AudioControl AIDL HAL for version 2 - Add Gain Callback to notify unexpected gain changed from HAL (as currently done for Audio Focus). - Add dumpsys commands Bug: 154906631 Test: build and run VTS tests Signed-off-by: Francois Gaffie Change-Id: I6be9620feb19d766d43be7199be2e9cd6d63c644 --- .../audiocontrol/aidl/default/Android.bp | 3 +- .../aidl/default/AudioControl.cpp | 254 +++++++++++++++++- .../audiocontrol/aidl/default/AudioControl.h | 30 +++ .../aidl/default/audiocontrol-default.xml | 2 +- 4 files changed, 284 insertions(+), 5 deletions(-) diff --git a/automotive/audiocontrol/aidl/default/Android.bp b/automotive/audiocontrol/aidl/default/Android.bp index 1439cce606..6bf4b9d860 100644 --- a/automotive/audiocontrol/aidl/default/Android.bp +++ b/automotive/audiocontrol/aidl/default/Android.bp @@ -29,8 +29,9 @@ cc_binary { vendor: true, shared_libs: [ "android.hardware.audio.common@7.0-enums", + "android.hardware.audio.common-V1-ndk", "android.frameworks.automotive.powerpolicy-V1-ndk", - "android.hardware.automotive.audiocontrol-V1-ndk", + "android.hardware.automotive.audiocontrol-V2-ndk", "libbase", "libbinder_ndk", "libcutils", diff --git a/automotive/audiocontrol/aidl/default/AudioControl.cpp b/automotive/audiocontrol/aidl/default/AudioControl.cpp index c0bc796cdf..a121f8be21 100644 --- a/automotive/audiocontrol/aidl/default/AudioControl.cpp +++ b/automotive/audiocontrol/aidl/default/AudioControl.cpp @@ -30,6 +30,8 @@ #include #include +#include + #include namespace aidl::android::hardware::automotive::audiocontrol { @@ -147,6 +149,47 @@ ndk::ScopedAStatus AudioControl::onDevicesToMuteChange( return ndk::ScopedAStatus::ok(); } +template +static inline std::string toString(const std::vector& in_values) { + return std::accumulate(std::begin(in_values), std::end(in_values), std::string{}, + [](std::string& ls, const aidl_type& rs) { + return ls += (ls.empty() ? "" : ",") + rs.toString(); + }); +} +template +static inline std::string toEnumString(const std::vector& in_values) { + return std::accumulate(std::begin(in_values), std::end(in_values), std::string{}, + [](std::string& ls, const aidl_enum_type& rs) { + return ls += (ls.empty() ? "" : ",") + toString(rs); + }); +} + +ndk::ScopedAStatus AudioControl::onAudioFocusChangeWithMetaData( + const audiohalcommon::PlaybackTrackMetadata& in_playbackMetaData, int32_t in_zoneId, + AudioFocusChange in_focusChange) { + LOG(INFO) << "Focus changed: " << toString(in_focusChange).c_str() << " for metadata " + << in_playbackMetaData.toString().c_str() << " in zone " << in_zoneId; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus AudioControl::setAudioDeviceGainsChanged( + const std::vector& in_reasons, const std::vector& in_gains) { + LOG(INFO) << "Audio Device Gains changed: resons:" << toEnumString(in_reasons).c_str() + << " for devices: " << toString(in_gains).c_str(); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus AudioControl::registerGainCallback( + const std::shared_ptr& in_callback) { + LOG(DEBUG) << ": " << __func__; + if (in_callback) { + std::atomic_store(&mAudioGainCallback, in_callback); + } else { + LOG(ERROR) << "Unexpected nullptr for audio gain callback resulting in no-op."; + } + return ndk::ScopedAStatus::ok(); +} + binder_status_t AudioControl::dump(int fd, const char** args, uint32_t numArgs) { if (numArgs == 0) { return dumpsys(fd); @@ -159,6 +202,12 @@ binder_status_t AudioControl::dump(int fd, const char** args, uint32_t numArgs) return cmdRequestFocus(fd, args, numArgs); } else if (EqualsIgnoreCase(option, "--abandon")) { return cmdAbandonFocus(fd, args, numArgs); + } else if (EqualsIgnoreCase(option, "--requestFocusWithMetaData")) { + return cmdRequestFocusWithMetaData(fd, args, numArgs); + } else if (EqualsIgnoreCase(option, "--abandonFocusWithMetaData")) { + return cmdAbandonFocusWithMetaData(fd, args, numArgs); + } else if (EqualsIgnoreCase(option, "--audioGainCallback")) { + return cmdOnAudioDeviceGainsChanged(fd, args, numArgs); } else { dprintf(fd, "Invalid option: %s\n", option.c_str()); return STATUS_BAD_VALUE; @@ -171,20 +220,49 @@ binder_status_t AudioControl::dumpsys(int fd) { } else { dprintf(fd, "Focus listener registered\n"); } + dprintf(fd, "AudioGainCallback %sregistered\n", (mAudioGainCallback == nullptr ? "NOT " : "")); return STATUS_OK; } binder_status_t AudioControl::cmdHelp(int fd) const { dprintf(fd, "Usage: \n\n"); - dprintf(fd, "[no args]: dumps focus listener status\n"); + dprintf(fd, "[no args]: dumps focus listener / gain callback registered status\n"); dprintf(fd, "--help: shows this help\n"); dprintf(fd, "--request : requests audio focus for specified " - "usage (string), audio zone ID (int), and focus gain type (int)\n"); + "usage (string), audio zone ID (int), and focus gain type (int)\n" + "Deprecated, use MetaData instead\n"); dprintf(fd, "--abandon : abandons audio focus for specified usage (string) and " - "audio zone ID (int)\n"); + "audio zone ID (int)\n" + "Deprecated, use MetaData instead\n"); dprintf(fd, "See audio_policy_configuration.xsd for valid AudioUsage values.\n"); + + dprintf(fd, + "--requestFocusWithMetaData : " + "requests audio focus for specified metadata, audio zone ID (int), " + "and focus gain type (int)\n"); + dprintf(fd, + "--abandonFocusWithMetaData : " + "abandons audio focus for specified metadata and audio zone ID (int)\n"); + dprintf(fd, + "--audioGainCallback [, ...]" + " [ ...]: fire audio " + "gain callback for audio zone ID (int), the given reasons (csv int) for given pairs " + "of device address (string) and gain index (int) \n"); + + dprintf(fd, + "Note on : specified as where (int)usage, " + "(int)content type and tags (string)string)\n"); + dprintf(fd, + "See android/media/audio/common/AudioUsageType.aidl for valid AudioUsage values.\n"); + dprintf(fd, + "See android/media/audio/common/AudioContentType.aidl for valid AudioContentType " + "values.\n"); + dprintf(fd, + "Tags are optional. If provided, it must follow the = pattern, where the " + "value is namespaced (for example com.google.strategy=VR).\n"); + return STATUS_OK; } @@ -266,4 +344,174 @@ binder_status_t AudioControl::cmdAbandonFocus(int fd, const char** args, uint32_ return STATUS_OK; } +binder_status_t AudioControl::parseMetaData(int fd, const std::string& metadataLiteral, + audiohalcommon::PlaybackTrackMetadata& trackMetadata) { + std::stringstream csvMetaData(metadataLiteral); + std::vector splitMetaData; + std::string attribute; + while (getline(csvMetaData, attribute, ',')) { + splitMetaData.push_back(attribute); + } + if (splitMetaData.size() != 2 && splitMetaData.size() != 3) { + dprintf(fd, + "Invalid metadata: %s, please provide as " + "where (int)usage, (int)content type and tags (string)string)\n", + metadataLiteral.c_str()); + return STATUS_BAD_VALUE; + } + int usage; + if (!safelyParseInt(splitMetaData[0], &usage)) { + dprintf(fd, "Non-integer usage provided with request: %s\n", splitMetaData[0].c_str()); + return STATUS_BAD_VALUE; + } + int contentType; + if (!safelyParseInt(splitMetaData[1], &contentType)) { + dprintf(fd, "Non-integer content type provided with request: %s\n", + splitMetaData[1].c_str()); + return STATUS_BAD_VALUE; + } + const std::string tags = (splitMetaData.size() == 3 ? splitMetaData[2] : ""); + + trackMetadata = {.usage = static_cast(usage), + .contentType = static_cast(contentType), + .tags = {tags}}; + return STATUS_OK; +} + +binder_status_t AudioControl::cmdRequestFocusWithMetaData(int fd, const char** args, + uint32_t numArgs) { + if (!checkCallerHasWritePermissions(fd)) { + return STATUS_PERMISSION_DENIED; + } + if (numArgs != 4) { + dprintf(fd, + "Invalid number of arguments: please provide:\n" + "--requestFocusWithMetaData : " + "requests audio focus for specified metadata, audio zone ID (int), " + "and focus gain type (int)\n"); + return STATUS_BAD_VALUE; + } + std::string metadataLiteral = std::string(args[1]); + audiohalcommon::PlaybackTrackMetadata trackMetadata{}; + auto status = parseMetaData(fd, metadataLiteral, trackMetadata); + if (status != STATUS_OK) { + return status; + } + + int zoneId; + if (!safelyParseInt(std::string(args[2]), &zoneId)) { + dprintf(fd, "Non-integer zoneId provided with request: %s\n", std::string(args[2]).c_str()); + return STATUS_BAD_VALUE; + } + + int focusGainValue; + if (!safelyParseInt(std::string(args[3]), &focusGainValue)) { + dprintf(fd, "Non-integer focusGain provided with request: %s\n", + std::string(args[3]).c_str()); + return STATUS_BAD_VALUE; + } + AudioFocusChange focusGain = AudioFocusChange(focusGainValue); + + if (mFocusListener == nullptr) { + dprintf(fd, "Unable to request focus - no focus listener registered\n"); + return STATUS_BAD_VALUE; + } + mFocusListener->requestAudioFocusWithMetaData(trackMetadata, zoneId, focusGain); + dprintf(fd, "Requested focus for metadata %s, zoneId %d, and focusGain %d\n", + trackMetadata.toString().c_str(), zoneId, focusGain); + return STATUS_OK; +} + +binder_status_t AudioControl::cmdAbandonFocusWithMetaData(int fd, const char** args, + uint32_t numArgs) { + if (!checkCallerHasWritePermissions(fd)) { + return STATUS_PERMISSION_DENIED; + } + if (numArgs != 3) { + dprintf(fd, + "Invalid number of arguments: please provide:\n" + "--abandonFocusWithMetaData : " + "abandons audio focus for specified metadata and audio zone ID (int)\n"); + return STATUS_BAD_VALUE; + } + std::string metadataLiteral = std::string(args[1]); + audiohalcommon::PlaybackTrackMetadata trackMetadata{}; + auto status = parseMetaData(fd, metadataLiteral, trackMetadata); + if (status != STATUS_OK) { + return status; + } + int zoneId; + if (!safelyParseInt(std::string(args[2]), &zoneId)) { + dprintf(fd, "Non-integer zoneId provided with request: %s\n", std::string(args[2]).c_str()); + return STATUS_BAD_VALUE; + } + if (mFocusListener == nullptr) { + dprintf(fd, "Unable to abandon focus - no focus listener registered\n"); + return STATUS_BAD_VALUE; + } + + mFocusListener->abandonAudioFocusWithMetaData(trackMetadata, zoneId); + dprintf(fd, "Abandoned focus for metadata %s and zoneId %d\n", trackMetadata.toString().c_str(), + zoneId); + return STATUS_OK; +} + +binder_status_t AudioControl::cmdOnAudioDeviceGainsChanged(int fd, const char** args, + uint32_t numArgs) { + if (!checkCallerHasWritePermissions(fd)) { + return STATUS_PERMISSION_DENIED; + } + if ((numArgs + 1) % 2 != 0) { + dprintf(fd, + "Invalid number of arguments: please provide\n" + "--audioGainCallback [, ...]" + " [ ...]: " + "fire audio gain callback for audio zone ID (int), " + "with the given reasons (csv int) for given pairs of device address (string) " + "and gain index (int) \n"); + return STATUS_BAD_VALUE; + } + int zoneId; + if (!safelyParseInt(string(args[1]), &zoneId)) { + dprintf(fd, "Non-integer zoneId provided with request: %s\n", std::string(args[1]).c_str()); + return STATUS_BAD_VALUE; + } + std::string reasonsLiteral = std::string(args[2]); + std::stringstream csvReasonsLiteral(reasonsLiteral); + std::vector reasons; + std::string reasonLiteral; + while (getline(csvReasonsLiteral, reasonLiteral, ',')) { + int reason; + if (!safelyParseInt(reasonLiteral, &reason)) { + dprintf(fd, "Invalid Reason(s) provided %s\n", reasonLiteral.c_str()); + return STATUS_BAD_VALUE; + } + reasons.push_back(static_cast(reason)); + } + + std::vector agcis{}; + for (uint32_t i = 3; i < numArgs; i += 2) { + std::string deviceAddress = std::string(args[i]); + int32_t index; + if (!safelyParseInt(std::string(args[i + 1]), &index)) { + dprintf(fd, "Non-integer index provided with request: %s\n", + std::string(args[i + 1]).c_str()); + return STATUS_BAD_VALUE; + } + AudioGainConfigInfo agci{zoneId, deviceAddress, index}; + agcis.push_back(agci); + } + if (mAudioGainCallback == nullptr) { + dprintf(fd, + "Unable to trig audio gain callback for reasons=%s and gains=%s\n" + " - no audio gain callback registered\n", + toEnumString(reasons).c_str(), toString(agcis).c_str()); + return STATUS_BAD_VALUE; + } + + mAudioGainCallback->onAudioDeviceGainsChanged(reasons, agcis); + dprintf(fd, "Fired audio gain callback for reasons=%s and gains=%s\n", + toEnumString(reasons).c_str(), toString(agcis).c_str()); + return STATUS_OK; +} } // namespace aidl::android::hardware::automotive::audiocontrol diff --git a/automotive/audiocontrol/aidl/default/AudioControl.h b/automotive/audiocontrol/aidl/default/AudioControl.h index cca9c44004..16b80e890c 100644 --- a/automotive/audiocontrol/aidl/default/AudioControl.h +++ b/automotive/audiocontrol/aidl/default/AudioControl.h @@ -17,12 +17,20 @@ #define ANDROID_HARDWARE_AUTOMOTIVE_AUDIOCONTROL_AUDIOCONTROL_H #include +#include #include #include +#include #include +#include + +#include namespace aidl::android::hardware::automotive::audiocontrol { +namespace audiohalcommon = ::aidl::android::hardware::audio::common; +namespace audiomediacommon = ::aidl::android::media::audio::common; + class AudioControl : public BnAudioControl { public: ndk::ScopedAStatus onAudioFocusChange(const std::string& in_usage, int32_t in_zoneId, @@ -35,6 +43,15 @@ class AudioControl : public BnAudioControl { const std::shared_ptr& in_listener) override; ndk::ScopedAStatus setBalanceTowardRight(float in_value) override; ndk::ScopedAStatus setFadeTowardFront(float in_value) override; + ndk::ScopedAStatus onAudioFocusChangeWithMetaData( + const audiohalcommon::PlaybackTrackMetadata& in_playbackMetaData, int32_t in_zoneId, + AudioFocusChange in_focusChange) override; + ndk::ScopedAStatus setAudioDeviceGainsChanged( + const std::vector& in_reasons, + const std::vector& in_gains) override; + ndk::ScopedAStatus registerGainCallback( + const std::shared_ptr& in_callback) override; + binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; private: @@ -44,9 +61,22 @@ class AudioControl : public BnAudioControl { // listener, then it should also include mutexes or make the listener atomic. std::shared_ptr mFocusListener; + /** + * @brief mAudioGainCallback will be used by this HAL instance to communicate e.g. with a single + * instance of CarAudioService to report unexpected gain changed. + */ + std::shared_ptr mAudioGainCallback = nullptr; + binder_status_t cmdHelp(int fd) const; binder_status_t cmdRequestFocus(int fd, const char** args, uint32_t numArgs); binder_status_t cmdAbandonFocus(int fd, const char** args, uint32_t numArgs); + binder_status_t cmdRequestFocusWithMetaData(int fd, const char** args, uint32_t numArgs); + binder_status_t cmdAbandonFocusWithMetaData(int fd, const char** args, uint32_t numArgs); + binder_status_t cmdOnAudioDeviceGainsChanged(int fd, const char** args, uint32_t numArgs); + + binder_status_t parseMetaData(int fd, const std::string& metadataLiteral, + audiohalcommon::PlaybackTrackMetadata& trackMetadata); + binder_status_t dumpsys(int fd); }; diff --git a/automotive/audiocontrol/aidl/default/audiocontrol-default.xml b/automotive/audiocontrol/aidl/default/audiocontrol-default.xml index f95d05fe77..e82f6fada9 100644 --- a/automotive/audiocontrol/aidl/default/audiocontrol-default.xml +++ b/automotive/audiocontrol/aidl/default/audiocontrol-default.xml @@ -1,4 +1,4 @@ - + android.hardware.automotive.audiocontrol IAudioControl/default From e5af282ccc36ac9a95a1a0a815c831aeb8ad23fd Mon Sep 17 00:00:00 2001 From: Francois Gaffie Date: Wed, 9 Feb 2022 11:36:55 +0100 Subject: [PATCH 006/998] Update VTS tests for AudioControl AIDL HAL version 2 Bug: 154906631 Test: atest VtsAidlHalAudioControlTest Signed-off-by: Francois Gaffie Change-Id: Iea05f7bfcc102ccd5d79b2f29c3fbf179044e537 --- automotive/audiocontrol/aidl/vts/Android.bp | 7 +- .../aidl/vts/VtsHalAudioControlTargetTest.cpp | 67 +++++++++++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/automotive/audiocontrol/aidl/vts/Android.bp b/automotive/audiocontrol/aidl/vts/Android.bp index 6856b91d2b..3d4be4828f 100644 --- a/automotive/audiocontrol/aidl/vts/Android.bp +++ b/automotive/audiocontrol/aidl/vts/Android.bp @@ -37,11 +37,16 @@ cc_test { "libxml2", ], static_libs: [ - "android.hardware.automotive.audiocontrol-V1-cpp", + "android.hardware.automotive.audiocontrol-V2-cpp", + "android.hardware.audio.common-V1-cpp", + "android.media.audio.common.types-V1-cpp", "libgmock", ], test_suites: [ "general-tests", "vts", ], + cflags: [ + "-Wno-deprecated-declarations", + ], } diff --git a/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp b/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp index ae53c68528..f4f5eef757 100644 --- a/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp +++ b/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -30,10 +31,13 @@ using android::sp; using android::String16; using android::binder::Status; using android::hardware::automotive::audiocontrol::AudioFocusChange; +using android::hardware::automotive::audiocontrol::AudioGainConfigInfo; +using android::hardware::automotive::audiocontrol::BnAudioGainCallback; using android::hardware::automotive::audiocontrol::BnFocusListener; using android::hardware::automotive::audiocontrol::DuckingInfo; using android::hardware::automotive::audiocontrol::IAudioControl; using android::hardware::automotive::audiocontrol::MutingInfo; +using android::hardware::automotive::audiocontrol::Reasons; #include "android_audio_policy_configuration_V7_0.h" @@ -41,6 +45,9 @@ namespace xsd { using namespace android::audio::policy::configuration::V7_0; } +namespace audiohalcommon = android::hardware::audio::common; +namespace audiomediacommon = android::media::audio::common; + class AudioControlAidl : public testing::TestWithParam { public: virtual void SetUp() override { @@ -103,6 +110,11 @@ struct FocusListenerMock : BnFocusListener { MOCK_METHOD(Status, requestAudioFocus, (const String16& usage, int32_t zoneId, AudioFocusChange focusGain)); MOCK_METHOD(Status, abandonAudioFocus, (const String16& usage, int32_t zoneId)); + MOCK_METHOD(Status, requestAudioFocusWithMetaData, + (const audiohalcommon::PlaybackTrackMetadata& metaData, int32_t zoneId, + AudioFocusChange focusGain)); + MOCK_METHOD(Status, abandonAudioFocusWithMetaData, + (const audiohalcommon::PlaybackTrackMetadata& metaData, int32_t zoneId)); }; /* @@ -159,6 +171,61 @@ TEST_P(AudioControlAidl, DuckChangeExercise) { ASSERT_TRUE(audioControl->onDevicesToDuckChange(duckingInfos).isOk()); } +TEST_P(AudioControlAidl, FocusChangeWithMetaDataExercise) { + ALOGI("Focus Change test"); + + audiohalcommon::PlaybackTrackMetadata metadata; + metadata.usage = audiomediacommon::AudioUsage::MEDIA; + metadata.contentType = audiomediacommon::AudioContentType::MUSIC; + metadata.tags = {"com.google.android=VR"}; + ASSERT_TRUE( + audioControl + ->onAudioFocusChangeWithMetaData(metadata, 0, AudioFocusChange::GAIN_TRANSIENT) + .isOk()); +}; + +TEST_P(AudioControlAidl, SetAudioDeviceGainsChangedExercise) { + ALOGI("Set Audio Gains Changed test"); + + const std::vector reasons{Reasons::FORCED_MASTER_MUTE, Reasons::NAV_DUCKING}; + AudioGainConfigInfo agci1; + agci1.zoneId = 0; + agci1.devicePortAddress = String16("address 1"); + agci1.volumeIndex = 8; + + AudioGainConfigInfo agci2; + agci1.zoneId = 0; + agci1.devicePortAddress = String16("address 2"); + agci1.volumeIndex = 1; + + std::vector gains{agci1, agci2}; + ASSERT_TRUE(audioControl->setAudioDeviceGainsChanged(reasons, gains).isOk()); +} + +/* + * Test Audio Gain Callback registration. + * + * Verifies that: + * - registerGainCallback succeeds; + * - registering a second callback succeeds in replacing the first; + * - closing handle does not crash; + */ +struct AudioGainCallbackMock : BnAudioGainCallback { + MOCK_METHOD(Status, onAudioDeviceGainsChanged, + (const std::vector& reasons, + const std::vector& gains)); +}; + +TEST_P(AudioControlAidl, AudioGainCallbackRegistration) { + ALOGI("Focus listener test"); + + sp gainCallback = new AudioGainCallbackMock(); + ASSERT_TRUE(audioControl->registerGainCallback(gainCallback).isOk()); + + sp gainCallback2 = new AudioGainCallbackMock(); + ASSERT_TRUE(audioControl->registerGainCallback(gainCallback2).isOk()); +} + GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioControlAidl); INSTANTIATE_TEST_SUITE_P( Audiocontrol, AudioControlAidl, From 1ec992a31bc886f277feae447a7f119ff43bec0e Mon Sep 17 00:00:00 2001 From: Hwayoung Date: Tue, 15 Feb 2022 09:48:07 +0000 Subject: [PATCH 007/998] Update test code for ANBR Test: build Change-Id: Ibaee9c170d5ece580ee7f47f4a141a02c8882268 --- radio/aidl/vts/radio_ims_indication.cpp | 2 +- radio/aidl/vts/radio_ims_test.cpp | 2 +- radio/aidl/vts/radio_ims_utils.h | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/radio/aidl/vts/radio_ims_indication.cpp b/radio/aidl/vts/radio_ims_indication.cpp index 79b4c3bb73..f9c872f9c3 100644 --- a/radio/aidl/vts/radio_ims_indication.cpp +++ b/radio/aidl/vts/radio_ims_indication.cpp @@ -29,6 +29,6 @@ ndk::ScopedAStatus RadioImsIndication::onAccessAllowed(RadioIndicationType /*typ } ndk::ScopedAStatus RadioImsIndication::notifyAnbr(RadioIndicationType /*type*/, - int /*qosSessionId*/, int /*bitsPerSecond*/) { + int /*qosSessionId*/, ImsStreamDirection /*direction*/, int /*bitsPerSecond*/) { return ndk::ScopedAStatus::ok(); } \ No newline at end of file diff --git a/radio/aidl/vts/radio_ims_test.cpp b/radio/aidl/vts/radio_ims_test.cpp index 8db8791b8c..52c5f02c22 100644 --- a/radio/aidl/vts/radio_ims_test.cpp +++ b/radio/aidl/vts/radio_ims_test.cpp @@ -202,7 +202,7 @@ TEST_P(RadioImsTest, sendAnbrQuery) { serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = - radio_ims->sendAnbrQuery(serial, 1, 0, 13200); + radio_ims->sendAnbrQuery(serial, 1, ImsStreamDirection::UPLINK, 13200); ASSERT_OK(res); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type); diff --git a/radio/aidl/vts/radio_ims_utils.h b/radio/aidl/vts/radio_ims_utils.h index c828e70fa2..61e42543d4 100644 --- a/radio/aidl/vts/radio_ims_utils.h +++ b/radio/aidl/vts/radio_ims_utils.h @@ -45,6 +45,10 @@ class RadioImsResponse : public BnRadioImsResponse { virtual ndk::ScopedAStatus notifyImsTrafficResponse(const RadioResponseInfo& info) override; virtual ndk::ScopedAStatus performAcbCheckResponse(const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus setAnbrEnabledResponse(const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus sendAnbrQueryResponse(const RadioResponseInfo& info) override; }; /* Callback class for radio ims indication */ @@ -60,6 +64,9 @@ class RadioImsIndication : public BnRadioImsIndication { const ConnectionFailureInfo& info) override; virtual ndk::ScopedAStatus onAccessAllowed(RadioIndicationType type, int token) override; + + virtual ndk::ScopedAStatus notifyAnbr(RadioIndicationType type, int qosSessionId, + ImsStreamDirection direction, int bitsPerSecond) override; }; // The main test class for Radio AIDL Ims. From a38ad3cc126a3fe9167cde099b98bda32812a79c Mon Sep 17 00:00:00 2001 From: Alec Mouri Date: Wed, 9 Feb 2022 11:19:48 -0800 Subject: [PATCH 008/998] Remove concept of nits from the client target properties An earlier patch replaced white point nits with a per-layer brightness. This patch does the same for providing the brightness space of the client target relative to the display brightness. Bug: 217961164 Test: builds, boots Change-Id: I1be65f7c511fefa239305e0735637126a1cd6622 --- ...aidl => ClientTargetPropertyWithBrightness.aidl} | 4 ++-- .../graphics/composer3/CommandResultPayload.aidl | 2 +- ...aidl => ClientTargetPropertyWithBrightness.aidl} | 6 +++--- .../graphics/composer3/CommandResultPayload.aidl | 7 ++++--- .../graphics/composer3/ComposerClientReader.h | 13 +++++++------ 5 files changed, 17 insertions(+), 15 deletions(-) rename graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/{ClientTargetPropertyWithNits.aidl => ClientTargetPropertyWithBrightness.aidl} (96%) rename graphics/composer/aidl/android/hardware/graphics/composer3/{ClientTargetPropertyWithNits.aidl => ClientTargetPropertyWithBrightness.aidl} (86%) diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClientTargetPropertyWithNits.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl similarity index 96% rename from graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClientTargetPropertyWithNits.aidl rename to graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl index f0fb22eb15..c445f30bcd 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClientTargetPropertyWithNits.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl @@ -33,8 +33,8 @@ package android.hardware.graphics.composer3; @VintfStability -parcelable ClientTargetPropertyWithNits { +parcelable ClientTargetPropertyWithBrightness { long display; android.hardware.graphics.composer3.ClientTargetProperty clientTargetProperty; - float whitePointNits; + float brightness; } diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/CommandResultPayload.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/CommandResultPayload.aidl index ebbb31e59f..6892f06180 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/CommandResultPayload.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/CommandResultPayload.aidl @@ -40,5 +40,5 @@ union CommandResultPayload { android.hardware.graphics.composer3.PresentFence presentFence; android.hardware.graphics.composer3.ReleaseFences releaseFences; android.hardware.graphics.composer3.PresentOrValidate presentOrValidateResult; - android.hardware.graphics.composer3.ClientTargetPropertyWithNits clientTargetProperty; + android.hardware.graphics.composer3.ClientTargetPropertyWithBrightness clientTargetProperty; } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTargetPropertyWithNits.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl similarity index 86% rename from graphics/composer/aidl/android/hardware/graphics/composer3/ClientTargetPropertyWithNits.aidl rename to graphics/composer/aidl/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl index 50376519d8..d9e4e16788 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTargetPropertyWithNits.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl @@ -19,7 +19,7 @@ package android.hardware.graphics.composer3; import android.hardware.graphics.composer3.ClientTargetProperty; @VintfStability -parcelable ClientTargetPropertyWithNits { +parcelable ClientTargetPropertyWithBrightness { /** * The display which this commands refers to. * @see IComposer.createDisplay @@ -32,7 +32,7 @@ parcelable ClientTargetPropertyWithNits { ClientTargetProperty clientTargetProperty; /** - * The white points nits as described in CommandResultPayload.clientTargetProperty + * The brightness as described in CommandResultPayload.clientTargetProperty */ - float whitePointNits; + float brightness; } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/CommandResultPayload.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/CommandResultPayload.aidl index f2de68e025..106fd87ebd 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/CommandResultPayload.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/CommandResultPayload.aidl @@ -17,7 +17,7 @@ package android.hardware.graphics.composer3; import android.hardware.graphics.composer3.ChangedCompositionTypes; -import android.hardware.graphics.composer3.ClientTargetPropertyWithNits; +import android.hardware.graphics.composer3.ClientTargetPropertyWithBrightness; import android.hardware.graphics.composer3.CommandError; import android.hardware.graphics.composer3.DisplayRequest; import android.hardware.graphics.composer3.PresentFence; @@ -83,12 +83,13 @@ union CommandResultPayload { PresentOrValidate presentOrValidateResult; /** - * The white point parameter describes the intended white point of the client target buffer. + * The brightness parameter describes the intended brightness space of the client target buffer. + * The brightness is in the range [0, 1], where 1 is the current brightness of the display. * When client composition blends both HDR and SDR content, the client must composite to the * brightness space as specified by the hardware composer. This is so that adjusting the real * display brightness may be applied atomically with compensating the client target output. For * instance, client-compositing a list of SDR layers requires dimming the brightness space of * the SDR buffers when an HDR layer is simultaneously device-composited. */ - ClientTargetPropertyWithNits clientTargetProperty; + ClientTargetPropertyWithBrightness clientTargetProperty; } diff --git a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientReader.h b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientReader.h index f9e35e94e0..27dce76377 100644 --- a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientReader.h +++ b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientReader.h @@ -153,14 +153,14 @@ class ComposerClientReader { } // Get the client target properties requested by hardware composer. - ClientTargetPropertyWithNits takeClientTargetProperty(int64_t display) { + ClientTargetPropertyWithBrightness takeClientTargetProperty(int64_t display) { auto found = mReturnData.find(display); // If not found, return the default values. if (found == mReturnData.end()) { - return ClientTargetPropertyWithNits{ + return ClientTargetPropertyWithBrightness{ .clientTargetProperty = {common::PixelFormat::RGBA_8888, Dataspace::UNKNOWN}, - .whitePointNits = -1.f, + .brightness = 1.f, }; } @@ -201,7 +201,8 @@ class ComposerClientReader { data.presentOrValidateState = std::move(presentOrValidate.result); } - void parseSetClientTargetProperty(const ClientTargetPropertyWithNits&& clientTargetProperty) { + void parseSetClientTargetProperty( + const ClientTargetPropertyWithBrightness&& clientTargetProperty) { auto& data = mReturnData[clientTargetProperty.display]; data.clientTargetProperty = std::move(clientTargetProperty); } @@ -213,9 +214,9 @@ class ComposerClientReader { std::vector releasedLayers; PresentOrValidate::Result presentOrValidateState; - ClientTargetPropertyWithNits clientTargetProperty = { + ClientTargetPropertyWithBrightness clientTargetProperty = { .clientTargetProperty = {common::PixelFormat::RGBA_8888, Dataspace::UNKNOWN}, - .whitePointNits = -1.f, + .brightness = 1.f, }; }; From 04deb64be1cb1fdc4242babf6eddb240d16bfd39 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Wed, 16 Feb 2022 20:43:52 +0000 Subject: [PATCH 009/998] Reorder the hostapd Generation enum to list the WiFi generations chronologically. Bug: 213475388 Test: Build the interface (mm -j) Change-Id: I9f501c021956a376c03884dadade473ab0953bd3 --- .../current/android/hardware/wifi/hostapd/Generation.aidl | 4 ++-- .../aidl/android/hardware/wifi/hostapd/Generation.aidl | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/Generation.aidl b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/Generation.aidl index af0e960df8..5bb0d32869 100644 --- a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/Generation.aidl +++ b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/Generation.aidl @@ -38,7 +38,7 @@ enum Generation { WIFI_STANDARD_LEGACY = 0, WIFI_STANDARD_11N = 1, WIFI_STANDARD_11AC = 2, - WIFI_STANDARD_11AX = 3, - WIFI_STANDARD_11AD = 4, + WIFI_STANDARD_11AD = 3, + WIFI_STANDARD_11AX = 4, WIFI_STANDARD_11BE = 5, } diff --git a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/Generation.aidl b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/Generation.aidl index f4e3eb0668..5b74732bda 100644 --- a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/Generation.aidl +++ b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/Generation.aidl @@ -25,8 +25,8 @@ package android.hardware.wifi.hostapd; * WIFI_STANDARD_11N = [hw_mode is HOSTAPD_MODE_IEEE80211G and (HT is 1 or HT40 is 1)] or * [hw_mode is HOSTAPD_MODE_IEEE80211A and VHT is 0]. * WIFI_STANDARD_11AC = hw_mode is HOSTAPD_MODE_IEEE80211A and VHT is 1. - * WIFI_STANDARD_11AX = hw_mode is HOSTAPD_MODE_IEEE80211A and High Efficiency supported. * WIFI_STANDARD_11AD = hw_mode is HOSTAPD_MODE_IEEE80211AD. + * WIFI_STANDARD_11AX = hw_mode is HOSTAPD_MODE_IEEE80211A and High Efficiency supported. * WIFI_STANDARD_11BE = hw_mode is HOSTAPD_MODE_IEEE80211A and Extreme High Throughput supported. */ @VintfStability @@ -36,7 +36,7 @@ enum Generation { WIFI_STANDARD_LEGACY = 0, WIFI_STANDARD_11N = 1, WIFI_STANDARD_11AC = 2, - WIFI_STANDARD_11AX = 3, - WIFI_STANDARD_11AD = 4, + WIFI_STANDARD_11AD = 3, + WIFI_STANDARD_11AX = 4, WIFI_STANDARD_11BE = 5, } From 4fed2b023af0bd3ffe3a4eebf52f7f78c8fd5dca Mon Sep 17 00:00:00 2001 From: Robert Shih Date: Mon, 14 Feb 2022 16:08:06 -0800 Subject: [PATCH 010/998] aidl drm: independent min/max SecurityLevel for each supported mime Bug: 219528925 Test: atest MediaDrmTest.testIsCryptoSchemeSupportedForSecurityLevels Change-Id: I9dcd786fe921c6ed4ac49bba5a6dddf887404df3 --- .../android/hardware/drm/CryptoSchemes.aidl | 4 +- .../hardware/drm/SupportedContentType.aidl | 40 +++++++++++++++++++ .../android/hardware/drm/CryptoSchemes.aidl | 16 ++------ .../hardware/drm/SupportedContentType.aidl | 31 ++++++++++++++ drm/aidl/vts/drm_hal_common.cpp | 25 +++++++----- drm/aidl/vts/drm_hal_test.cpp | 13 ++++++ drm/aidl/vts/include/drm_hal_common.h | 3 ++ 7 files changed, 106 insertions(+), 26 deletions(-) create mode 100644 drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SupportedContentType.aidl create mode 100644 drm/aidl/android/hardware/drm/SupportedContentType.aidl diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/CryptoSchemes.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/CryptoSchemes.aidl index ea736cf373..1d3c293eca 100644 --- a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/CryptoSchemes.aidl +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/CryptoSchemes.aidl @@ -35,7 +35,5 @@ package android.hardware.drm; @VintfStability parcelable CryptoSchemes { List uuids; - android.hardware.drm.SecurityLevel minLevel; - android.hardware.drm.SecurityLevel maxLevel; - List mimeTypes; + List mimeTypes; } diff --git a/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SupportedContentType.aidl b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SupportedContentType.aidl new file mode 100644 index 0000000000..6ef5db860a --- /dev/null +++ b/drm/aidl/aidl_api/android.hardware.drm/current/android/hardware/drm/SupportedContentType.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.drm; +@VintfStability +parcelable SupportedContentType { + String mime; + android.hardware.drm.SecurityLevel minLevel; + android.hardware.drm.SecurityLevel maxLevel; +} diff --git a/drm/aidl/android/hardware/drm/CryptoSchemes.aidl b/drm/aidl/android/hardware/drm/CryptoSchemes.aidl index b4b34ec17e..1f251d8a75 100644 --- a/drm/aidl/android/hardware/drm/CryptoSchemes.aidl +++ b/drm/aidl/android/hardware/drm/CryptoSchemes.aidl @@ -16,7 +16,7 @@ package android.hardware.drm; -import android.hardware.drm.SecurityLevel; +import android.hardware.drm.SupportedContentType; import android.hardware.drm.Uuid; @VintfStability @@ -28,18 +28,8 @@ parcelable CryptoSchemes { List uuids; /** - * Minimum supported security level (inclusive) + * Supported mime types, and supported SecurityLevels for each mime */ - SecurityLevel minLevel; - - /** - * Maximum supported security level (inclusive) - */ - SecurityLevel maxLevel; - - /** - * Supported mime types - */ - List mimeTypes; + List mimeTypes; } diff --git a/drm/aidl/android/hardware/drm/SupportedContentType.aidl b/drm/aidl/android/hardware/drm/SupportedContentType.aidl new file mode 100644 index 0000000000..f4fabad554 --- /dev/null +++ b/drm/aidl/android/hardware/drm/SupportedContentType.aidl @@ -0,0 +1,31 @@ +/* + * 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. + */ + +package android.hardware.drm; + +import android.hardware.drm.SecurityLevel; + +@VintfStability +parcelable SupportedContentType { + /** Supported mime type. E.g. cenc, video/mp4, etc */ + String mime; + + /** Minimum supported security level (inclusive) */ + SecurityLevel minLevel; + + /** Maximum supported security level (inclusive) */ + SecurityLevel maxLevel; +} diff --git a/drm/aidl/vts/drm_hal_common.cpp b/drm/aidl/vts/drm_hal_common.cpp index 9b315f4f55..de7dc288ec 100644 --- a/drm/aidl/vts/drm_hal_common.cpp +++ b/drm/aidl/vts/drm_hal_common.cpp @@ -256,7 +256,7 @@ std::vector DrmHalTest::getUUID() { std::vector DrmHalTest::getVendorUUID() { if (vendorModule == nullptr) { ALOGW("vendor module for %s not found", GetParamService().c_str()); - return {}; + return std::vector(16); } return vendorModule->getUUID(); } @@ -268,17 +268,22 @@ bool DrmHalTest::isCryptoSchemeSupported(Uuid uuid, SecurityLevel level, std::st if (!ret.isOk() || !std::count(schemes.uuids.begin(), schemes.uuids.end(), uuid)) { return false; } - if (level > schemes.maxLevel || level < schemes.minLevel) { - if (level != SecurityLevel::DEFAULT && level != SecurityLevel::UNKNOWN) { - return false; + if (mime.empty()) { + EXPECT_THAT(level, AnyOf(Eq(SecurityLevel::DEFAULT), Eq(SecurityLevel::UNKNOWN))); + return true; + } + for (auto ct : schemes.mimeTypes) { + if (ct.mime != mime) { + continue; + } + if (level == SecurityLevel::DEFAULT || level == SecurityLevel::UNKNOWN) { + return true; + } + if (level <= ct.maxLevel && level >= ct.minLevel) { + return true; } } - if (!mime.empty()) { - if (!std::count(schemes.mimeTypes.begin(), schemes.mimeTypes.end(), mime)) { - return false; - } - } - return true; + return false; } void DrmHalTest::provision() { diff --git a/drm/aidl/vts/drm_hal_test.cpp b/drm/aidl/vts/drm_hal_test.cpp index 266ea395e2..14b3acfc7f 100644 --- a/drm/aidl/vts/drm_hal_test.cpp +++ b/drm/aidl/vts/drm_hal_test.cpp @@ -99,6 +99,19 @@ TEST_P(DrmHalTest, BadMimeNotSupported) { EXPECT_FALSE(result); } +/** + * getSupportedCryptoSchemes confidence check + */ +TEST_P(DrmHalTest, SupportedCryptoSchemes) { + aidl::android::hardware::drm::CryptoSchemes schemes{}; + auto result = drmFactory->getSupportedCryptoSchemes(&schemes); + EXPECT_FALSE(schemes.uuids.empty()); + for(auto ct : schemes.mimeTypes) { + EXPECT_LE(ct.minLevel, ct.maxLevel); + } + EXPECT_OK(result); +} + /** * DrmPlugin tests */ diff --git a/drm/aidl/vts/include/drm_hal_common.h b/drm/aidl/vts/include/drm_hal_common.h index 2c7e514291..d493bed05a 100644 --- a/drm/aidl/vts/include/drm_hal_common.h +++ b/drm/aidl/vts/include/drm_hal_common.h @@ -59,6 +59,9 @@ namespace hardware { namespace drm { namespace vts { +using ::testing::AnyOf; +using ::testing::Eq; + ::aidl::android::hardware::drm::Status DrmErr(const ::ndk::ScopedAStatus& ret); std::string HalBaseName(const std::string& fullname); std::string HalFullName(const std::string& iface, const std::string& basename); From f20e55cf4654662b8ab730bca3ded1c3e26c55c1 Mon Sep 17 00:00:00 2001 From: Yu-Han Yang Date: Mon, 14 Feb 2022 14:20:14 -0800 Subject: [PATCH 011/998] Change TOC and TOE to long Change TOC and TOE definition to 1. long 2. time in seconds since GPS epoch, regardless of constellation 3. must not be encoded 4. rename to timeOfClockSeconds and timeOfEphemerisSeconds Bug: 219575003 Test: on device Change-Id: Icb75a3397d3bf41c91e2a19bbec8a95a97100a07 --- .../android/hardware/gnss/SatellitePvt.aidl | 8 +++---- .../android/hardware/gnss/SatellitePvt.aidl | 22 ++++++++++--------- gnss/aidl/vts/gnss_hal_test_cases.cpp | 9 ++++---- gnss/common/utils/default/Utils.cpp | 8 +++---- 4 files changed, 25 insertions(+), 22 deletions(-) diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl index 21a2520b4e..dc875fae8b 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/SatellitePvt.aidl @@ -40,10 +40,10 @@ parcelable SatellitePvt { android.hardware.gnss.SatelliteClockInfo satClockInfo; double ionoDelayMeters; double tropoDelayMeters; - int TOC; - int IODC; - int TOE; - int IODE; + long timeOfClockSeconds; + int issueOfDataClock; + long timeOfEphemerisSeconds; + int issueOfDataEphemeris; android.hardware.gnss.SatellitePvt.SatelliteEphemerisSource ephemerisSource = android.hardware.gnss.SatellitePvt.SatelliteEphemerisSource.OTHER; const int HAS_POSITION_VELOCITY_CLOCK_INFO = 1; const int HAS_IONO = 2; diff --git a/gnss/aidl/android/hardware/gnss/SatellitePvt.aidl b/gnss/aidl/android/hardware/gnss/SatellitePvt.aidl index e79249df63..d9f767ab05 100644 --- a/gnss/aidl/android/hardware/gnss/SatellitePvt.aidl +++ b/gnss/aidl/android/hardware/gnss/SatellitePvt.aidl @@ -76,12 +76,13 @@ parcelable SatellitePvt { double tropoDelayMeters; /** - * Time of Clock. + * Time of Clock in seconds. * - * This is defined in GPS ICD200 documentation - * (e.g., https://www.gps.gov/technical/icwg/IS-GPS-200H.pdf). + * This value is defined in seconds since GPS epoch, regardless of the constellation. + * + * The value must not be encoded as in GPS ICD200 documentation. */ - int TOC; + long timeOfClockSeconds; /** * Issue of Data, Clock. @@ -91,15 +92,16 @@ parcelable SatellitePvt { * * The field must be set to 0 if it is not supported. */ - int IODC; + int issueOfDataClock; /** - * Time of Ephemeris. + * Time of Ephemeris in seconds. * - * This is defined in GPS ICD200 documentation - * (e.g., https://www.gps.gov/technical/icwg/IS-GPS-200H.pdf). + * This value is defined in seconds since GPS epoch, regardless of the constellation. + * + * The value must not be encoded as in GPS ICD200 documentation. */ - int TOE; + long timeOfEphemerisSeconds; /** * Issue of Data, Ephemeris. @@ -109,7 +111,7 @@ parcelable SatellitePvt { * * The field must be set to 0 if it is not supported. */ - int IODE; + int issueOfDataEphemeris; /** Satellite's ephemeris source */ @VintfStability diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp index 365f9d355e..54946fb64f 100644 --- a/gnss/aidl/vts/gnss_hal_test_cases.cpp +++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp @@ -366,12 +366,13 @@ void CheckSatellitePvt(const SatellitePvt& satellitePvt, const int interfaceVers ASSERT_TRUE(satellitePvt.tropoDelayMeters > 0 && satellitePvt.tropoDelayMeters < 100); } if (interfaceVersion >= 2) { - ASSERT_TRUE(satellitePvt.TOC >= 0 && satellitePvt.TOC <= 604784); - ASSERT_TRUE(satellitePvt.TOE >= 0 && satellitePvt.TOE <= 604784); + ASSERT_TRUE(satellitePvt.timeOfClockSeconds >= 0); + ASSERT_TRUE(satellitePvt.timeOfEphemerisSeconds >= 0); // IODC has 10 bits - ASSERT_TRUE(satellitePvt.IODC >= 0 && satellitePvt.IODC <= 1023); + ASSERT_TRUE(satellitePvt.issueOfDataClock >= 0 && satellitePvt.issueOfDataClock <= 1023); // IODE has 8 bits - ASSERT_TRUE(satellitePvt.IODE >= 0 && satellitePvt.IODE <= 255); + ASSERT_TRUE(satellitePvt.issueOfDataEphemeris >= 0 && + satellitePvt.issueOfDataEphemeris <= 255); } } diff --git a/gnss/common/utils/default/Utils.cpp b/gnss/common/utils/default/Utils.cpp index a519d3acfb..4de49f376c 100644 --- a/gnss/common/utils/default/Utils.cpp +++ b/gnss/common/utils/default/Utils.cpp @@ -201,10 +201,10 @@ GnssData Utils::getMockMeasurement(const bool enableCorrVecOutputs) { .tropoDelayMeters = 3.882265204404031, .ephemerisSource = SatellitePvt::SatelliteEphemerisSource::SERVER_LONG_TERM, - .TOC = 12345, - .IODC = 143, - .TOE = 9876, - .IODE = 48, + .timeOfClockSeconds = 12345, + .issueOfDataClock = 143, + .timeOfEphemerisSeconds = 9876, + .issueOfDataEphemeris = 48, }, .correlationVectors = {}}; From 6ae468c1e39f72456416697ee7cf483dcf0c6f3b Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Fri, 18 Feb 2022 00:19:25 +0000 Subject: [PATCH 012/998] Improve test coverage for FakeValueGenerator. Bug: None Test: atest FakeVehicleHalValueGeneratorsTest Change-Id: I6df508e148ff0348fc28b467b4e5a70cf5727a27 --- .../fake_impl/GeneratorHub/test/Android.bp | 1 + .../FakeVehicleHalValueGeneratorsTest.cpp | 165 ++++++++++++------ .../test/prop_different_types.json | 58 ++++++ .../aidl/impl/utils/common/test/Android.bp | 2 +- 4 files changed, 174 insertions(+), 52 deletions(-) create mode 100644 automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/prop_different_types.json diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/Android.bp index ac8db44e59..2eef13c6e9 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/Android.bp +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/Android.bp @@ -41,6 +41,7 @@ filegroup { name: "FakeVehicleHalValueGeneratorsTestFiles", srcs: [ "prop.json", + "prop_different_types.json", "prop_invalid.json", ], } diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/FakeVehicleHalValueGeneratorsTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/FakeVehicleHalValueGeneratorsTest.cpp index 21aa680dda..674b07831b 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/FakeVehicleHalValueGeneratorsTest.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/FakeVehicleHalValueGeneratorsTest.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -38,6 +39,9 @@ namespace fake { using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; +using ::android::base::ScopedLockAssertion; + +using std::literals::chrono_literals::operator""s; class FakeVehicleHalValueGeneratorsTest : public ::testing::Test { protected: @@ -58,6 +62,16 @@ class FakeVehicleHalValueGeneratorsTest : public ::testing::Test { mEvents.clear(); } + void waitForEvents(size_t count) { + std::unique_lock uniqueLock(mEventsLock); + bool result = mCv.wait_for(uniqueLock, 10s, [this, count] { + ScopedLockAssertion lockAssertion(mEventsLock); + return mEvents.size() == count; + }); + + ASSERT_TRUE(result) << "didn't receive enough events"; + } + void TearDown() override { // Generator callback uses mEvents, must stop generator before destroying mEvents. mHub.reset(); @@ -71,12 +85,16 @@ class FakeVehicleHalValueGeneratorsTest : public ::testing::Test { private: void onHalEvent(const VehiclePropValue& event) { VehiclePropValue eventCopy = event; - std::scoped_lock lockGuard(mEventsLock); - mEvents.push_back(std::move(eventCopy)); + { + std::scoped_lock lockGuard(mEventsLock); + mEvents.push_back(std::move(eventCopy)); + } + mCv.notify_all(); } std::unique_ptr mHub; std::mutex mEventsLock; + std::condition_variable mCv; std::vector mEvents GUARDED_BY(mEventsLock); }; @@ -115,8 +133,7 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testRegisterTestFakeValueGenerator) { getHub()->registerGenerator(0, std::move(generator)); - // All the events require 500ms to generate, so waiting for 1000ms should be enough. - std::this_thread::sleep_for(std::chrono::milliseconds(1000)); + waitForEvents(events.size()); ASSERT_EQ(getEvents(), events); @@ -137,11 +154,12 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testUnregisterGeneratorStopGeneration) generator->setEvents(events); getHub()->registerGenerator(0, std::move(generator)); + + waitForEvents(1); + getHub()->unregisterGenerator(0); - std::this_thread::sleep_for(std::chrono::milliseconds(1000)); - - ASSERT_LT(getEvents().size(), static_cast(10)) + ASSERT_LE(getEvents().size(), 2u) << "Must stop generating event after generator is unregistered"; } @@ -155,13 +173,12 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testLinerFakeValueGeneratorFloat) { /*interval=*/10000000); getHub()->registerGenerator(0, std::move(generator)); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - + waitForEvents(10); auto events = getEvents(); - // We should get 10 events ideally, but let's be safe here. - ASSERT_LE((size_t)5, events.size()); + + ASSERT_EQ(events.size(), 10u); int value = 30; - for (size_t i = 0; i < 5; i++) { + for (size_t i = 0; i < 10; i++) { EXPECT_EQ(std::vector({static_cast(value)}), events[i].value.floatValues); value = (value + 20) % 100; } @@ -177,13 +194,11 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testLinerFakeValueGeneratorInt32) { /*interval=*/10000000); getHub()->registerGenerator(0, std::move(generator)); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - + waitForEvents(10); auto events = getEvents(); - // We should get 10 events ideally, but let's be safe here. - ASSERT_LE((size_t)5, events.size()); + ASSERT_EQ(events.size(), 10u); int value = 30; - for (size_t i = 0; i < 5; i++) { + for (size_t i = 0; i < 10; i++) { EXPECT_EQ(std::vector({value}), events[i].value.int32Values); value = (value + 20) % 100; } @@ -199,13 +214,12 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testLinerFakeValueGeneratorInt64) { /*interval=*/10000000); getHub()->registerGenerator(0, std::move(generator)); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - + waitForEvents(10); auto events = getEvents(); // We should get 10 events ideally, but let's be safe here. - ASSERT_LE((size_t)5, events.size()); + ASSERT_EQ(events.size(), 10u); int value = 30; - for (size_t i = 0; i < 5; i++) { + for (size_t i = 0; i < 10; i++) { EXPECT_EQ(std::vector({value}), events[i].value.int64Values); value = (value + 20) % 100; } @@ -221,13 +235,11 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testLinerFakeValueGeneratorUsingReques std::make_unique(request); getHub()->registerGenerator(0, std::move(generator)); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - + waitForEvents(10); auto events = getEvents(); - // We should get 10 events ideally, but let's be safe here. - ASSERT_LE((size_t)5, events.size()); + ASSERT_EQ(events.size(), 10u); int value = 50; - for (size_t i = 0; i < 5; i++) { + for (size_t i = 0; i < 10; i++) { EXPECT_EQ(std::vector({static_cast(value)}), events[i].value.floatValues); value = (value + 20) % 100; } @@ -244,15 +256,13 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testLinerFakeValueGeneratorInvalidInit /*interval=*/10000000); getHub()->registerGenerator(0, std::move(generator)); - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - + waitForEvents(10); auto events = getEvents(); - // We should get 10 events ideally, but let's be safe here. - ASSERT_LE((size_t)5, events.size()); + ASSERT_EQ(events.size(), 10u); // Init value would be set to middleValue if given initValue is not valid. int value = 50; - for (size_t i = 0; i < 5; i++) { + for (size_t i = 0; i < 10; i++) { EXPECT_EQ(std::vector({static_cast(value)}), events[i].value.floatValues); value = (value + 20) % 100; } @@ -265,9 +275,6 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testJsonFakeValueGenerator) { std::make_unique(getTestFilePath("prop.json"), 2); getHub()->registerGenerator(0, std::move(generator)); - // wait for some time. - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - std::vector expectedValues = { VehiclePropValue{ .areaId = 0, @@ -296,6 +303,7 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testJsonFakeValueGenerator) { expectedValues.push_back(expectedValues[i]); } + waitForEvents(expectedValues.size()); auto events = getEvents(); long lastEventTime = currentTime; @@ -313,14 +321,7 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testJsonFakeValueGeneratorIterateIndef std::make_unique(getTestFilePath("prop.json"), -1); getHub()->registerGenerator(0, std::move(generator)); - // wait for some time. - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - - auto events = getEvents(); - - // Send 1 iteration takes 4ms + 1ms interval between iteration, so for 100ms we should get about - // 20 iteration, which is 80 events. - EXPECT_GT(events.size(), static_cast(50)); + waitForEvents(40); } TEST_F(FakeVehicleHalValueGeneratorsTest, testJsonFakeValueGeneratorUsingRequest) { @@ -335,9 +336,6 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testJsonFakeValueGeneratorUsingRequest std::make_unique(request); getHub()->registerGenerator(0, std::move(generator)); - // wait for some time. - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - std::vector expectedValues = { VehiclePropValue{ .areaId = 0, @@ -366,6 +364,7 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testJsonFakeValueGeneratorUsingRequest expectedValues.push_back(expectedValues[i]); } + waitForEvents(expectedValues.size()); auto events = getEvents(); long lastEventTime = currentTime; @@ -388,9 +387,6 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testJsonFakeValueGeneratorInvalidFile) std::make_unique(request); getHub()->registerGenerator(0, std::move(generator)); - // wait for some time. - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - ASSERT_TRUE(getEvents().empty()); } @@ -404,12 +400,79 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testJsonFakeValueGeneratorNonExistingF std::make_unique(request); getHub()->registerGenerator(0, std::move(generator)); - // wait for some time. - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - ASSERT_TRUE(getEvents().empty()); } +TEST_F(FakeVehicleHalValueGeneratorsTest, testJsonFakeValueGeneratorDifferentTypes) { + std::unique_ptr generator = std::make_unique( + getTestFilePath("prop_different_types.json"), 1); + getHub()->registerGenerator(0, std::move(generator)); + + std::vector expectedValues = { + VehiclePropValue{ + .areaId = 0, + .value.int32Values = {1}, + .prop = 287310600, + }, + VehiclePropValue{ + .areaId = 0, + .value.int32Values = {2}, + .prop = 289408000, + }, + VehiclePropValue{ + .areaId = 0, + .value.floatValues = {3.3}, + .prop = 291504905, + }, + VehiclePropValue{ + .areaId = 0, + .value.int64Values = {4}, + .prop = 290457096, + }, + VehiclePropValue{ + .areaId = 0, + .value.stringValue = "test", + .prop = 286265094, + }, + VehiclePropValue{ + .areaId = 0, + .value.int32Values = {1, 2}, + .prop = 289476368, + }, + VehiclePropValue{ + .areaId = 0, + .value = + { + .int32Values = {1, 2}, + .int64Values = {3, 4}, + .floatValues = {5.5, 6.6}, + .stringValue = "test", + }, + .prop = 299896626, + }, + VehiclePropValue{ + .areaId = 0, + .value = + { + .int32Values = {1}, + .floatValues = {1.0}, + .byteValues = {0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00}, + }, + .prop = 299896064, + }, + }; + + waitForEvents(expectedValues.size()); + auto events = getEvents(); + + for (auto& event : events) { + event.timestamp = 0; + } + + EXPECT_EQ(events, expectedValues); +} + } // namespace fake } // namespace vehicle } // namespace automotive diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/prop_different_types.json b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/prop_different_types.json new file mode 100644 index 0000000000..0363ebd131 --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/prop_different_types.json @@ -0,0 +1,58 @@ +[ + { + "timestamp": 1000000, + "areaId": 0, + "value": 1, + "prop": 287310600 + }, + { + "timestamp": 1000000, + "areaId": 0, + "value": 2, + "prop": 289408000 + }, + { + "timestamp": 1000000, + "areaId": 0, + "value": 3.3, + "prop": 291504905 + }, + { + "timestamp": 1000000, + "areaId": 0, + "value": 4, + "prop": 290457096 + }, + { + "timestamp": 1000000, + "areaId": 0, + "value": "test", + "prop": 286265094 + }, + { + "timestamp": 1000000, + "areaId": 0, + "value": [1, 2], + "prop": 289476368 + }, + { + "timestamp": 1000000, + "areaId": 0, + "value": { + "int32Values": [1, 2], + "int64Values": [3, 4], + "floatValues": [5.5, 6.6], + "stringValue": "test" + }, + "prop": 299896626 + }, + { + "timestamp": 1000000, + "areaId": 0, + "value": { + "int32Values": [1], + "floatValues": [1] + }, + "prop": 299896064 + } +] \ No newline at end of file diff --git a/automotive/vehicle/aidl/impl/utils/common/test/Android.bp b/automotive/vehicle/aidl/impl/utils/common/test/Android.bp index 5b41ff4df0..250b33135b 100644 --- a/automotive/vehicle/aidl/impl/utils/common/test/Android.bp +++ b/automotive/vehicle/aidl/impl/utils/common/test/Android.bp @@ -19,7 +19,7 @@ package { } cc_test { - name: "VehicleHalVehicleUtilsVendorTest", + name: "VehicleHalVehicleUtilsTest", srcs: ["*.cpp"], vendor: true, static_libs: [ From 2a01674368cc1e3506627edad5a41f03ad3e0b13 Mon Sep 17 00:00:00 2001 From: sandeepjs Date: Tue, 15 Feb 2022 11:41:28 +0000 Subject: [PATCH 013/998] VTS testcases for HAL API setSimSlotMapping To accomodate MEP, we have updated the setSimSlotMapping API in the HAL, Writing the tescases to check functionality of the same. Test: atest VtsHalRadioTargetTest Bug: 217665559 Change-Id: Idbff19db2e536d3c2f7b80afbbf244575d8247d0 --- radio/aidl/vts/radio_aidl_hal_utils.cpp | 20 +++++++++ radio/aidl/vts/radio_aidl_hal_utils.h | 6 +++ radio/aidl/vts/radio_config_response.cpp | 3 +- radio/aidl/vts/radio_config_test.cpp | 56 ++++++++++++++++++++++++ radio/aidl/vts/radio_config_utils.h | 3 ++ radio/aidl/vts/radio_sim_test.cpp | 6 +++ 6 files changed, 93 insertions(+), 1 deletion(-) diff --git a/radio/aidl/vts/radio_aidl_hal_utils.cpp b/radio/aidl/vts/radio_aidl_hal_utils.cpp index dc61a3cfd3..1f739302b4 100644 --- a/radio/aidl/vts/radio_aidl_hal_utils.cpp +++ b/radio/aidl/vts/radio_aidl_hal_utils.cpp @@ -24,6 +24,7 @@ #define WAIT_TIMEOUT_PERIOD 75 sim::CardStatus cardStatus = {}; +config::SimSlotStatus slotStatus = {}; int serial = 0; int count_ = 0; @@ -204,3 +205,22 @@ void RadioServiceTest::updateSimCardStatus() { EXPECT_EQ(serial, radioSimRsp->rspInfo.serial); EXPECT_EQ(RadioError::NONE, radioSimRsp->rspInfo.error); } + +void RadioServiceTest::updateSimSlotStatus() { + // Update SimSlotStatus from RadioConfig + std::shared_ptr radioConfigRsp = + ndk::SharedRefBase::make(*this); + std::shared_ptr radioConfigInd = + ndk::SharedRefBase::make(*this); + radio_config->setResponseFunctions(radioConfigRsp, radioConfigInd); + serial = GetRandomSerialNumber(); + radio_config->getSimSlotsStatus(serial); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioConfigRsp->rspInfo.type); + EXPECT_EQ(serial, radioConfigRsp->rspInfo.serial); + EXPECT_EQ(RadioError::NONE, radioConfigRsp->rspInfo.error); + // assuming only 1 slot + for (const SimSlotStatus& slotStatusResponse : radioConfigRsp->simSlotStatus) { + slotStatus = slotStatusResponse; + } +} diff --git a/radio/aidl/vts/radio_aidl_hal_utils.h b/radio/aidl/vts/radio_aidl_hal_utils.h index 414ffbc456..d6f7bf75b6 100644 --- a/radio/aidl/vts/radio_aidl_hal_utils.h +++ b/radio/aidl/vts/radio_aidl_hal_utils.h @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -27,10 +28,12 @@ #include using namespace aidl::android::hardware::radio; +using aidl::android::hardware::radio::config::SimSlotStatus; using aidl::android::hardware::radio::network::RegState; using aidl::android::hardware::radio::sim::CardStatus; extern CardStatus cardStatus; +extern SimSlotStatus slotStatus; extern int serial; extern int count_; @@ -141,4 +144,7 @@ class RadioServiceTest { /* Update SIM card status */ void updateSimCardStatus(); + + /* Update SIM slot status */ + void updateSimSlotStatus(); }; diff --git a/radio/aidl/vts/radio_config_response.cpp b/radio/aidl/vts/radio_config_response.cpp index 8d8160519a..7384f87adc 100644 --- a/radio/aidl/vts/radio_config_response.cpp +++ b/radio/aidl/vts/radio_config_response.cpp @@ -19,8 +19,9 @@ RadioConfigResponse::RadioConfigResponse(RadioServiceTest& parent) : parent_config(parent) {} ndk::ScopedAStatus RadioConfigResponse::getSimSlotsStatusResponse( - const RadioResponseInfo& info, const std::vector& /* slotStatus */) { + const RadioResponseInfo& info, const std::vector& slotStatus) { rspInfo = info; + simSlotStatus = slotStatus; parent_config.notify(info.serial); return ndk::ScopedAStatus::ok(); } diff --git a/radio/aidl/vts/radio_config_test.cpp b/radio/aidl/vts/radio_config_test.cpp index a271b8af52..a124907ad0 100644 --- a/radio/aidl/vts/radio_config_test.cpp +++ b/radio/aidl/vts/radio_config_test.cpp @@ -44,6 +44,19 @@ void RadioConfigTest::SetUp() { radio_config->setResponseFunctions(radioRsp_config, radioInd_config); } +void RadioConfigTest::updateSimSlotStatus() { + serial = GetRandomSerialNumber(); + radio_config->getSimSlotsStatus(serial); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_config->rspInfo.type); + EXPECT_EQ(serial, radioRsp_config->rspInfo.serial); + EXPECT_EQ(RadioError::NONE, radioRsp_config->rspInfo.error); + // assuming only 1 slot + for (const SimSlotStatus& slotStatusResponse : radioRsp_config->simSlotStatus) { + slotStatus = slotStatusResponse; + } +} + /* * Test IRadioConfig.getHalDeviceCapabilities() for the response returned. */ @@ -153,3 +166,46 @@ TEST_P(RadioConfigTest, setPreferredDataModem_invalidArgument) { {RadioError::INVALID_ARGUMENTS, RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR})); } + +/* + * Test IRadioConfig.setSimSlotsMapping() for the response returned. + */ +TEST_P(RadioConfigTest, setSimSlotsMapping) { + serial = GetRandomSerialNumber(); + SlotPortMapping slotPortMapping; + slotPortMapping.physicalSlotId = 0; + slotPortMapping.portId = 0; + std::vector slotPortMappingList = {slotPortMapping}; + ndk::ScopedAStatus res = radio_config->setSimSlotsMapping(serial, slotPortMappingList); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_config->rspInfo.type); + EXPECT_EQ(serial, radioRsp_config->rspInfo.serial); + ALOGI("setSimSlotsMapping, rspInfo.error = %s\n", + toString(radioRsp_config->rspInfo.error).c_str()); + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_config->rspInfo.error, {RadioError::NONE})); +} + +/* + * Test IRadioConfig.getSimSlotStatus() for the response returned. + */ + +TEST_P(RadioConfigTest, checkPortInfoExistsAndPortActive) { + serial = GetRandomSerialNumber(); + ndk::ScopedAStatus res = radio_config->getSimSlotsStatus(serial); + ASSERT_OK(res); + ALOGI("getSimSlotsStatus, rspInfo.error = %s\n", + toString(radioRsp_config->rspInfo.error).c_str()); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_config->rspInfo.type); + EXPECT_EQ(serial, radioRsp_config->rspInfo.serial); + if (radioRsp_config->rspInfo.error == RadioError::NONE) { + // check if cardState is present, portInfo size should be more than 0 + for (const SimSlotStatus& slotStatusResponse : radioRsp_config->simSlotStatus) { + if (slotStatusResponse.cardState == CardStatus::STATE_PRESENT) { + ASSERT_TRUE(slotStatusResponse.portInfo.size() > 0); + ASSERT_TRUE(slotStatusResponse.portInfo[0].portActive); + } + } + } +} diff --git a/radio/aidl/vts/radio_config_utils.h b/radio/aidl/vts/radio_config_utils.h index 465c10653b..3db430db5f 100644 --- a/radio/aidl/vts/radio_config_utils.h +++ b/radio/aidl/vts/radio_config_utils.h @@ -38,6 +38,7 @@ class RadioConfigResponse : public BnRadioConfigResponse { RadioResponseInfo rspInfo; PhoneCapability phoneCap; bool modemReducedFeatureSet1; + std::vector simSlotStatus; virtual ndk::ScopedAStatus getSimSlotsStatusResponse( const RadioResponseInfo& info, const std::vector& slotStatus) override; @@ -77,6 +78,8 @@ class RadioConfigTest : public ::testing::TestWithParam, public Rad public: virtual void SetUp() override; ndk::ScopedAStatus updateSimCardStatus(); + /* Override updateSimSlotStatus in RadioServiceTest to not call setResponseFunctions */ + void updateSimSlotStatus(); /* radio config service handle in RadioServiceTest */ /* radio config response handle */ diff --git a/radio/aidl/vts/radio_sim_test.cpp b/radio/aidl/vts/radio_sim_test.cpp index 64474c95a8..dbddf91042 100644 --- a/radio/aidl/vts/radio_sim_test.cpp +++ b/radio/aidl/vts/radio_sim_test.cpp @@ -108,7 +108,13 @@ TEST_P(RadioSimTest, setSimCardPower) { // have CardStatus::STATE_PRESENT after turning the power back on if (radioRsp_sim->rspInfo.error == RadioError::NONE) { updateSimCardStatus(); + updateSimSlotStatus(); EXPECT_EQ(CardStatus::STATE_PRESENT, cardStatus.cardState); + EXPECT_EQ(CardStatus::STATE_PRESENT, slotStatus.cardState); + if (CardStatus::STATE_PRESENT == slotStatus.cardState) { + ASSERT_TRUE(slotStatus.portInfo[0].portActive); + EXPECT_EQ(0, cardStatus.slotMap.portId); + } } } From de551fb8dde53356b02fd209c051774438f47438 Mon Sep 17 00:00:00 2001 From: Shawn Willden Date: Fri, 11 Feb 2022 12:51:53 -0700 Subject: [PATCH 014/998] Provide alternate SE RoT provisioning path. On some devices it is infeasible to provision the KeyMint RoT bits in the Android Bootloader. This provides an alternate path to provision them from the TEE during early boot. Bug: 219076736 Test: VtsAidlKeyMintTargetTest Change-Id: If69f7e25e58edbf4d2190084e2c0a03a94bfa5d6 --- .../security/keymint/IKeyMintDevice.aidl | 3 + .../security/keymint/IKeyMintDevice.aidl | 78 ++++++ .../keymint/aidl/vts/functional/Android.bp | 1 + .../SecureElementProvisioningTest.cpp | 255 ++++++++++++++++++ 4 files changed, 337 insertions(+) create mode 100644 security/keymint/aidl/vts/functional/SecureElementProvisioningTest.cpp diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/IKeyMintDevice.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/IKeyMintDevice.aidl index fa643fc494..dcc22c4ba7 100644 --- a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/IKeyMintDevice.aidl +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/IKeyMintDevice.aidl @@ -49,5 +49,8 @@ interface IKeyMintDevice { void earlyBootEnded(); byte[] convertStorageKeyToEphemeral(in byte[] storageKeyBlob); android.hardware.security.keymint.KeyCharacteristics[] getKeyCharacteristics(in byte[] keyBlob, in byte[] appId, in byte[] appData); + byte[16] getRootOfTrustChallenge(); + byte[] getRootOfTrust(in byte[16] challenge); + void sendRootOfTrust(in byte[] rootOfTrust); const int AUTH_TOKEN_MAC_LENGTH = 32; } diff --git a/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl b/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl index 4b637993f1..da02d54662 100644 --- a/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl +++ b/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl @@ -851,4 +851,82 @@ interface IKeyMintDevice { */ KeyCharacteristics[] getKeyCharacteristics( in byte[] keyBlob, in byte[] appId, in byte[] appData); + + /** + * Returns a 16-byte random challenge nonce, used to prove freshness when exchanging root of + * trust data. + * + * This method may only be implemented by StrongBox KeyMint. TEE KeyMint implementations must + * return ErrorCode::UNIMPLEMENTED. StrongBox KeyMint implementations MAY return UNIMPLEMENTED, + * to indicate that they have an alternative mechanism for getting the data. If the StrongBox + * implementation returns UNIMPLEMENTED, the client should not call `getRootofTrust()` or + * `sendRootOfTrust()`. + */ + byte[16] getRootOfTrustChallenge(); + + /** + * Returns the TEE KeyMint Root of Trust data. + * + * This method is required for TEE KeyMint. StrongBox KeyMint implementations MUST return + * ErrorCode::UNIMPLEMENTED. + * + * The returned data is an encoded COSE_Mac0 structure, denoted MacedRootOfTrust in the + * following CDDL schema. Note that K_mac is the shared HMAC key used for auth tokens, etc.: + * + * MacedRootOfTrust = [ ; COSE_Mac0 (untagged) + * protected: bstr .cbor { + * 1 : 5, ; Algorithm : HMAC-256 + * }, + * unprotected : {}, + * payload : bstr .cbor RootOfTrust, + * tag : bstr HMAC-256(K_mac, MAC_structure) + * ] + * + * MAC_structure = [ + * context : "MAC0", + * protected : bstr .cbor { + * 1 : 5, ; Algorithm : HMAC-256 + * }, + * external_aad : bstr .size 16 ; Value of challenge argument + * payload : bstr .cbor RootOfTrust, + * ] + * + * RootOfTrust = [ + * verifiedBootKey : bstr .size 32, + * deviceLocked : bool, + * verifiedBootState : &VerifiedBootState, + * verifiedBootHash : bstr .size 32, + * bootPatchLevel : int, ; See Tag::BOOT_PATCHLEVEL + * ] + * + * VerifiedBootState = ( + * Verified : 0, + * SelfSigned : 1, + * Unverified : 2, + * Failed : 3 + * ) + */ + byte[] getRootOfTrust(in byte[16] challenge); + + /** + * Delivers the TEE KeyMint Root of Trust data to StrongBox KeyMint. See `getRootOfTrust()` + * above for specification of the data format and cryptographic security structure. + * + * The implementation must verify the MAC on the RootOfTrust data. If it is valid, and if this + * is the first time since reboot that StrongBox KeyMint has received this data, it must store + * the RoT data for use in key attestation requests, then return ErrorCode::ERROR_OK. + * + * If the MAC on the Root of Trust data and challenge is incorrect, the implementation must + * return ErrorCode::VERIFICATION_FAILED. + * + * If the RootOfTrust data has already been received since the last boot, the implementation + * must validate the data and return ErrorCode::VERIFICATION_FAILED or ErrorCode::ERROR_OK + * according to the result, but must not store the data for use in key attestation requests, + * even if verification succeeds. On success, the challenge is invalidated and a new challenge + * must be requested before the RootOfTrust data may be sent again. + * + * This method is optional for StrongBox KeyMint, which MUST return ErrorCode::UNIMPLEMENTED if + * not implemented. TEE KeyMint implementations must return ErrorCode::UNIMPLEMENTED. + */ + void sendRootOfTrust(in byte[] rootOfTrust); } diff --git a/security/keymint/aidl/vts/functional/Android.bp b/security/keymint/aidl/vts/functional/Android.bp index 91db3c8954..1616e652de 100644 --- a/security/keymint/aidl/vts/functional/Android.bp +++ b/security/keymint/aidl/vts/functional/Android.bp @@ -54,6 +54,7 @@ cc_test { "AttestKeyTest.cpp", "DeviceUniqueAttestationTest.cpp", "KeyMintTest.cpp", + "SecureElementProvisioningTest.cpp", ], static_libs: [ "libkeymint_vts_test_utils", diff --git a/security/keymint/aidl/vts/functional/SecureElementProvisioningTest.cpp b/security/keymint/aidl/vts/functional/SecureElementProvisioningTest.cpp new file mode 100644 index 0000000000..e16a47b0c1 --- /dev/null +++ b/security/keymint/aidl/vts/functional/SecureElementProvisioningTest.cpp @@ -0,0 +1,255 @@ +/* + * Copyright (C) 2021 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. + */ + +#define LOG_TAG "keymint_2_se_provisioning_test" + +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include "KeyMintAidlTestBase.h" + +namespace aidl::android::hardware::security::keymint::test { + +using std::array; +using std::map; +using std::shared_ptr; +using std::vector; + +class SecureElementProvisioningTest : public testing::Test { + protected: + static void SetupTestSuite() { + auto params = ::android::getAidlHalInstanceNames(IKeyMintDevice::descriptor); + for (auto& param : params) { + ASSERT_TRUE(AServiceManager_isDeclared(param.c_str())) + << "IKeyMintDevice instance " << param << " found but not declared."; + ::ndk::SpAIBinder binder(AServiceManager_waitForService(param.c_str())); + auto keymint = IKeyMintDevice::fromBinder(binder); + ASSERT_NE(keymint, nullptr) << "Failed to get IKeyMintDevice instance " << param; + + KeyMintHardwareInfo info; + ASSERT_TRUE(keymint->getHardwareInfo(&info).isOk()); + ASSERT_EQ(keymints_.count(info.securityLevel), 0) + << "There must be exactly one IKeyMintDevice with security level " + << info.securityLevel; + + keymints_[info.securityLevel] = std::move(keymint); + } + } + + static map> keymints_; +}; + +map> SecureElementProvisioningTest::keymints_; + +TEST_F(SecureElementProvisioningTest, ValidConfigurations) { + // TEE is required + ASSERT_EQ(keymints_.count(SecurityLevel::TRUSTED_ENVIRONMENT), 1); + // StrongBox is optional + ASSERT_LE(keymints_.count(SecurityLevel::STRONGBOX), 1); +} + +TEST_F(SecureElementProvisioningTest, TeeOnly) { + ASSERT_EQ(keymints_.count(SecurityLevel::TRUSTED_ENVIRONMENT), 1); + auto tee = keymints_.find(SecurityLevel::TRUSTED_ENVIRONMENT)->second; + ASSERT_NE(tee, nullptr); + + array challenge1 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + array challenge2 = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + + vector rootOfTrust1; + Status result = tee->getRootOfTrust(challenge1, &rootOfTrust1); + + // TODO: Remove the next line to require TEEs to succeed. + if (!result.isOk()) return; + + ASSERT_TRUE(result.isOk()); + + // TODO: Parse and validate rootOfTrust1 here + + vector rootOfTrust2; + result = tee->getRootOfTrust(challenge2, &rootOfTrust2); + ASSERT_TRUE(result.isOk()); + + // TODO: Parse and validate rootOfTrust2 here + + ASSERT_NE(rootOfTrust1, rootOfTrust2); + + vector rootOfTrust3; + result = tee->getRootOfTrust(challenge1, &rootOfTrust3); + ASSERT_TRUE(result.isOk()); + + ASSERT_EQ(rootOfTrust1, rootOfTrust3); + + // TODO: Parse and validate rootOfTrust3 here +} + +TEST_F(SecureElementProvisioningTest, TeeDoesNotImplementStrongBoxMethods) { + ASSERT_EQ(keymints_.count(SecurityLevel::TRUSTED_ENVIRONMENT), 1); + auto tee = keymints_.find(SecurityLevel::TRUSTED_ENVIRONMENT)->second; + ASSERT_NE(tee, nullptr); + + array challenge; + Status result = tee->getRootOfTrustChallenge(&challenge); + ASSERT_FALSE(result.isOk()); + ASSERT_EQ(result.getExceptionCode(), EX_SERVICE_SPECIFIC); + ASSERT_EQ(static_cast(result.getServiceSpecificError()), ErrorCode::UNIMPLEMENTED); + + result = tee->sendRootOfTrust({}); + ASSERT_FALSE(result.isOk()); + ASSERT_EQ(result.getExceptionCode(), EX_SERVICE_SPECIFIC); + ASSERT_EQ(static_cast(result.getServiceSpecificError()), ErrorCode::UNIMPLEMENTED); +} + +TEST_F(SecureElementProvisioningTest, StrongBoxDoesNotImplementTeeMethods) { + if (keymints_.count(SecurityLevel::STRONGBOX) == 0) return; + + auto sb = keymints_.find(SecurityLevel::STRONGBOX)->second; + ASSERT_NE(sb, nullptr); + + vector rootOfTrust; + Status result = sb->getRootOfTrust({}, &rootOfTrust); + ASSERT_FALSE(result.isOk()); + ASSERT_EQ(result.getExceptionCode(), EX_SERVICE_SPECIFIC); + ASSERT_EQ(static_cast(result.getServiceSpecificError()), ErrorCode::UNIMPLEMENTED); +} + +TEST_F(SecureElementProvisioningTest, UnimplementedTest) { + if (keymints_.count(SecurityLevel::STRONGBOX) == 0) return; // Need a StrongBox to provision. + + ASSERT_EQ(keymints_.count(SecurityLevel::TRUSTED_ENVIRONMENT), 1); + auto tee = keymints_.find(SecurityLevel::TRUSTED_ENVIRONMENT)->second; + ASSERT_NE(tee, nullptr); + + ASSERT_EQ(keymints_.count(SecurityLevel::STRONGBOX), 1); + auto sb = keymints_.find(SecurityLevel::STRONGBOX)->second; + ASSERT_NE(sb, nullptr); + + array challenge; + Status result = sb->getRootOfTrustChallenge(&challenge); + if (!result.isOk()) { + // Strongbox does not have to implement this feature if it has uses an alternative mechanism + // to provision the root of trust. In that case it MUST return UNIMPLEMENTED, both from + // getRootOfTrustChallenge() and from sendRootOfTrust(). + ASSERT_EQ(result.getExceptionCode(), EX_SERVICE_SPECIFIC); + ASSERT_EQ(static_cast(result.getServiceSpecificError()), + ErrorCode::UNIMPLEMENTED); + + result = sb->sendRootOfTrust({}); + ASSERT_EQ(result.getExceptionCode(), EX_SERVICE_SPECIFIC); + ASSERT_EQ(static_cast(result.getServiceSpecificError()), + ErrorCode::UNIMPLEMENTED); + + SUCCEED() << "This Strongbox implementation does not use late root of trust delivery."; + return; + } +} + +TEST_F(SecureElementProvisioningTest, ChallengeQualityTest) { + if (keymints_.count(SecurityLevel::STRONGBOX) == 0) return; // Need a StrongBox to provision. + + ASSERT_EQ(keymints_.count(SecurityLevel::STRONGBOX), 1); + auto sb = keymints_.find(SecurityLevel::STRONGBOX)->second; + ASSERT_NE(sb, nullptr); + + array challenge1; + Status result = sb->getRootOfTrustChallenge(&challenge1); + if (!result.isOk()) return; + + array challenge2; + result = sb->getRootOfTrustChallenge(&challenge2); + ASSERT_TRUE(result.isOk()); + ASSERT_NE(challenge1, challenge2); + + // TODO: When we add entropy testing in other relevant places in these tests, add it here, too, + // to verify that challenges appear to have adequate entropy. +} + +TEST_F(SecureElementProvisioningTest, ProvisioningTest) { + if (keymints_.count(SecurityLevel::STRONGBOX) == 0) return; // Need a StrongBox to provision. + + ASSERT_EQ(keymints_.count(SecurityLevel::TRUSTED_ENVIRONMENT), 1); + auto tee = keymints_.find(SecurityLevel::TRUSTED_ENVIRONMENT)->second; + ASSERT_NE(tee, nullptr); + + ASSERT_EQ(keymints_.count(SecurityLevel::STRONGBOX), 1); + auto sb = keymints_.find(SecurityLevel::STRONGBOX)->second; + ASSERT_NE(sb, nullptr); + + array challenge; + Status result = sb->getRootOfTrustChallenge(&challenge); + if (!result.isOk()) return; + + vector rootOfTrust; + result = tee->getRootOfTrust(challenge, &rootOfTrust); + ASSERT_TRUE(result.isOk()); + + // TODO: Verify COSE_Mac0 structure and content here. + + result = sb->sendRootOfTrust(rootOfTrust); + ASSERT_TRUE(result.isOk()); + + // Sending again must fail, because a new challenge is required. + result = sb->sendRootOfTrust(rootOfTrust); + ASSERT_FALSE(result.isOk()); +} + +TEST_F(SecureElementProvisioningTest, InvalidProvisioningTest) { + if (keymints_.count(SecurityLevel::STRONGBOX) == 0) return; // Need a StrongBox to provision. + + ASSERT_EQ(keymints_.count(SecurityLevel::TRUSTED_ENVIRONMENT), 1); + auto tee = keymints_.find(SecurityLevel::TRUSTED_ENVIRONMENT)->second; + ASSERT_NE(tee, nullptr); + + ASSERT_EQ(keymints_.count(SecurityLevel::STRONGBOX), 1); + auto sb = keymints_.find(SecurityLevel::STRONGBOX)->second; + ASSERT_NE(sb, nullptr); + + array challenge; + Status result = sb->getRootOfTrustChallenge(&challenge); + if (!result.isOk()) return; + + result = sb->sendRootOfTrust({}); + ASSERT_FALSE(result.isOk()); + ASSERT_EQ(result.getExceptionCode(), EX_SERVICE_SPECIFIC); + ASSERT_EQ(static_cast(result.getServiceSpecificError()), + ErrorCode::VERIFICATION_FAILED); + + vector rootOfTrust; + result = tee->getRootOfTrust(challenge, &rootOfTrust); + ASSERT_TRUE(result.isOk()); + + vector corruptedRootOfTrust = rootOfTrust; + corruptedRootOfTrust[corruptedRootOfTrust.size() / 2]++; + result = sb->sendRootOfTrust(corruptedRootOfTrust); + ASSERT_FALSE(result.isOk()); + ASSERT_EQ(result.getExceptionCode(), EX_SERVICE_SPECIFIC); + ASSERT_EQ(static_cast(result.getServiceSpecificError()), + ErrorCode::VERIFICATION_FAILED); + + // Now try the correct RoT + result = sb->sendRootOfTrust(rootOfTrust); + ASSERT_TRUE(result.isOk()); +} + +} // namespace aidl::android::hardware::security::keymint::test From aabb869223f2b3553f82cbcad00571488ac08b16 Mon Sep 17 00:00:00 2001 From: Super Liu Date: Wed, 23 Feb 2022 01:19:06 +0000 Subject: [PATCH 015/998] Revert "[automerge] Add bssid to onEapFailure callback method. 2..." Revert "Update framework callback implementation to accept the b..." Revert "[automerge] Update framework callback implementation to ..." Revert "[automerge] Update framework callback implementation to ..." Revert submission 16982405-eap-failure-bssid Reason for revert: Broken build on git_master Reverted Changes: I2d2a27255:Add bssid to onEapFailure callback method. I5eb812575:[automerge] Update framework callback implementati... I64474d678:[automerge] Update framework callback implementati... If08fc19f0:Update framework callback implementation to accept... I71a514dde:[automerge] Add bssid to onEapFailure callback met... I1490b9dcc:[automerge] Add bssid to onEapFailure callback met... I699052131:Update supplicant service to call onEapFailure wit... Change-Id: I2032df54d51853e96047f1c2fcf12f9a0eee5e2a --- .../hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl | 2 +- .../hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl | 3 +-- .../aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl index 25a09b435e..46c8000a64 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl @@ -46,7 +46,7 @@ interface ISupplicantStaIfaceCallback { oneway void onDppSuccess(in android.hardware.wifi.supplicant.DppEventType event); oneway void onDppSuccessConfigReceived(in byte[] ssid, in String password, in byte[] psk, in android.hardware.wifi.supplicant.DppAkm securityAkm, in android.hardware.wifi.supplicant.DppConnectionKeys dppConnectionKeys); oneway void onDppSuccessConfigSent(); - oneway void onEapFailure(in byte[] bssid, in int errorCode); + oneway void onEapFailure(in int errorCode); oneway void onExtRadioWorkStart(in int id); oneway void onExtRadioWorkTimeout(in int id); oneway void onHs20DeauthImminentNotice(in byte[] bssid, in int reasonCode, in int reAuthDelayInSec, in String url); diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl index 0730a8cf54..895bc50436 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl @@ -154,12 +154,11 @@ oneway interface ISupplicantStaIfaceCallback { /** * Indicates an EAP authentication failure. - * @param bssid BSSID of the access point. * @param errorCode Error code for EAP authentication failure. * Either standard error code (enum EapErrorCode) or * private error code defined by network provider. */ - void onEapFailure(in byte[] bssid, in int errorCode); + void onEapFailure(in int errorCode); /** * Used to indicate that the external radio work can start now. diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp index 2ed6a0e476..1c00ec7c46 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp +++ b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp @@ -130,8 +130,7 @@ class SupplicantStaIfaceCallback : public BnSupplicantStaIfaceCallback { ::ndk::ScopedAStatus onDppSuccessConfigSent() override { return ndk::ScopedAStatus::ok(); } - ::ndk::ScopedAStatus onEapFailure(const std::vector& /* bssid */, - int32_t /* errorCode */) override { + ::ndk::ScopedAStatus onEapFailure(int32_t /* errorCode */) override { return ndk::ScopedAStatus::ok(); } ::ndk::ScopedAStatus onExtRadioWorkStart(int32_t /* id */) override { From bcb600decc0f6c592bbd210f7784e6eb2d924877 Mon Sep 17 00:00:00 2001 From: Super Liu Date: Wed, 23 Feb 2022 01:19:06 +0000 Subject: [PATCH 016/998] Revert "[automerge] Add bssid to onEapFailure callback method. 2..." Revert "Update supplicant service to call onEapFailure with the ..." Revert "Add bssid to onEapFailure callback method." Revert "[automerge] Add bssid to onEapFailure callback method. 2..." Revert "Update framework callback implementation to accept the b..." Revert "[automerge] Update framework callback implementation to ..." Revert "[automerge] Update framework callback implementation to ..." Revert submission 16982405-eap-failure-bssid Reason for revert: Broken build on git_master Reverted Changes: I2d2a27255:Add bssid to onEapFailure callback method. I5eb812575:[automerge] Update framework callback implementati... I64474d678:[automerge] Update framework callback implementati... If08fc19f0:Update framework callback implementation to accept... I71a514dde:[automerge] Add bssid to onEapFailure callback met... I1490b9dcc:[automerge] Add bssid to onEapFailure callback met... I699052131:Update supplicant service to call onEapFailure wit... Change-Id: I588680b8ccefa89b67283cc648fedc0ef4178c72 --- .../hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl | 2 +- .../hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl | 3 +-- .../aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl index 25a09b435e..46c8000a64 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl @@ -46,7 +46,7 @@ interface ISupplicantStaIfaceCallback { oneway void onDppSuccess(in android.hardware.wifi.supplicant.DppEventType event); oneway void onDppSuccessConfigReceived(in byte[] ssid, in String password, in byte[] psk, in android.hardware.wifi.supplicant.DppAkm securityAkm, in android.hardware.wifi.supplicant.DppConnectionKeys dppConnectionKeys); oneway void onDppSuccessConfigSent(); - oneway void onEapFailure(in byte[] bssid, in int errorCode); + oneway void onEapFailure(in int errorCode); oneway void onExtRadioWorkStart(in int id); oneway void onExtRadioWorkTimeout(in int id); oneway void onHs20DeauthImminentNotice(in byte[] bssid, in int reasonCode, in int reAuthDelayInSec, in String url); diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl index 0730a8cf54..895bc50436 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl @@ -154,12 +154,11 @@ oneway interface ISupplicantStaIfaceCallback { /** * Indicates an EAP authentication failure. - * @param bssid BSSID of the access point. * @param errorCode Error code for EAP authentication failure. * Either standard error code (enum EapErrorCode) or * private error code defined by network provider. */ - void onEapFailure(in byte[] bssid, in int errorCode); + void onEapFailure(in int errorCode); /** * Used to indicate that the external radio work can start now. diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp index 2ed6a0e476..1c00ec7c46 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp +++ b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp @@ -130,8 +130,7 @@ class SupplicantStaIfaceCallback : public BnSupplicantStaIfaceCallback { ::ndk::ScopedAStatus onDppSuccessConfigSent() override { return ndk::ScopedAStatus::ok(); } - ::ndk::ScopedAStatus onEapFailure(const std::vector& /* bssid */, - int32_t /* errorCode */) override { + ::ndk::ScopedAStatus onEapFailure(int32_t /* errorCode */) override { return ndk::ScopedAStatus::ok(); } ::ndk::ScopedAStatus onExtRadioWorkStart(int32_t /* id */) override { From 5a9636cee9357a9a3348be560d92858d09be3380 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 23 Feb 2022 19:14:40 +0000 Subject: [PATCH 017/998] Fix a flaky test in FakeVehicleHalValueGeneratorsTest. Fix a flaky test which might be caused by when the lock is waked up, we might have more events than what we want. Furthermore, we have to clear existing events after unregistering event generator. Test: atest FakeVehicleHalValueGeneratorTest 10 times on cf_auto Bug: 221084327 Change-Id: I65e87fa62b8538164fcdd60a9df871a9817f4f8e --- .../include/JsonFakeValueGenerator.h | 2 +- .../src/JsonFakeValueGenerator.cpp | 2 +- .../FakeVehicleHalValueGeneratorsTest.cpp | 31 ++++++++++--------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/JsonFakeValueGenerator.h b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/JsonFakeValueGenerator.h index 947eb4f748..d421ac525d 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/JsonFakeValueGenerator.h +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/JsonFakeValueGenerator.h @@ -56,7 +56,7 @@ class JsonFakeValueGenerator : public FakeValueGenerator { private: size_t mEventIndex = 0; std::vector mEvents; - long mLastEventTimestamp = 0; + int64_t mLastEventTimestamp = 0; int32_t mNumOfIterations = 0; void setBit(std::vector& bytes, size_t idx); diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/JsonFakeValueGenerator.cpp b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/JsonFakeValueGenerator.cpp index ae92797a32..d4d52a5849 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/JsonFakeValueGenerator.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/JsonFakeValueGenerator.cpp @@ -213,7 +213,7 @@ std::optional JsonFakeValueGenerator::nextEvent() { if (mLastEventTimestamp == 0) { mLastEventTimestamp = elapsedRealtimeNano(); } else { - long nextEventTime = 0; + int64_t nextEventTime = 0; if (mEventIndex > 0) { // All events (start from 2nd one) are supposed to happen in the future with a delay // equals to the duration between previous and current event. diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/FakeVehicleHalValueGeneratorsTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/FakeVehicleHalValueGeneratorsTest.cpp index 674b07831b..cdfa8b2031 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/FakeVehicleHalValueGeneratorsTest.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/FakeVehicleHalValueGeneratorsTest.cpp @@ -66,7 +66,7 @@ class FakeVehicleHalValueGeneratorsTest : public ::testing::Test { std::unique_lock uniqueLock(mEventsLock); bool result = mCv.wait_for(uniqueLock, 10s, [this, count] { ScopedLockAssertion lockAssertion(mEventsLock); - return mEvents.size() == count; + return mEvents.size() >= count; }); ASSERT_TRUE(result) << "didn't receive enough events"; @@ -126,7 +126,8 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testRegisterTestFakeValueGenerator) { for (size_t i = 0; i < eventCount; i++) { events.push_back(VehiclePropValue{ .prop = static_cast(i), - .timestamp = timestamp + static_cast(50 * i), + // Generate 1 event every 1ms. + .timestamp = timestamp + static_cast(1000000 * i), }); } generator->setEvents(events); @@ -148,7 +149,8 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testUnregisterGeneratorStopGeneration) for (size_t i = 0; i < eventCount; i++) { events.push_back(VehiclePropValue{ .prop = static_cast(i), - .timestamp = timestamp + static_cast(50 * i), + // Generate 1 event every 1ms. + .timestamp = timestamp + static_cast(1000000 * i), }); } generator->setEvents(events); @@ -158,8 +160,12 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testUnregisterGeneratorStopGeneration) waitForEvents(1); getHub()->unregisterGenerator(0); + clearEvents(); - ASSERT_LE(getEvents().size(), 2u) + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + + // It is possible that one last event would be generated after unregistering. + ASSERT_LE(getEvents().size(), 1u) << "Must stop generating event after generator is unregistered"; } @@ -176,7 +182,6 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testLinerFakeValueGeneratorFloat) { waitForEvents(10); auto events = getEvents(); - ASSERT_EQ(events.size(), 10u); int value = 30; for (size_t i = 0; i < 10; i++) { EXPECT_EQ(std::vector({static_cast(value)}), events[i].value.floatValues); @@ -196,7 +201,7 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testLinerFakeValueGeneratorInt32) { waitForEvents(10); auto events = getEvents(); - ASSERT_EQ(events.size(), 10u); + int value = 30; for (size_t i = 0; i < 10; i++) { EXPECT_EQ(std::vector({value}), events[i].value.int32Values); @@ -216,8 +221,7 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testLinerFakeValueGeneratorInt64) { waitForEvents(10); auto events = getEvents(); - // We should get 10 events ideally, but let's be safe here. - ASSERT_EQ(events.size(), 10u); + int value = 30; for (size_t i = 0; i < 10; i++) { EXPECT_EQ(std::vector({value}), events[i].value.int64Values); @@ -237,7 +241,7 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testLinerFakeValueGeneratorUsingReques waitForEvents(10); auto events = getEvents(); - ASSERT_EQ(events.size(), 10u); + int value = 50; for (size_t i = 0; i < 10; i++) { EXPECT_EQ(std::vector({static_cast(value)}), events[i].value.floatValues); @@ -258,7 +262,6 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testLinerFakeValueGeneratorInvalidInit waitForEvents(10); auto events = getEvents(); - ASSERT_EQ(events.size(), 10u); // Init value would be set to middleValue if given initValue is not valid. int value = 50; @@ -269,7 +272,7 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testLinerFakeValueGeneratorInvalidInit } TEST_F(FakeVehicleHalValueGeneratorsTest, testJsonFakeValueGenerator) { - long currentTime = elapsedRealtimeNano(); + int64_t currentTime = elapsedRealtimeNano(); std::unique_ptr generator = std::make_unique(getTestFilePath("prop.json"), 2); @@ -306,7 +309,7 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testJsonFakeValueGenerator) { waitForEvents(expectedValues.size()); auto events = getEvents(); - long lastEventTime = currentTime; + int64_t lastEventTime = currentTime; for (auto& event : events) { EXPECT_GT(event.timestamp, lastEventTime); lastEventTime = event.timestamp; @@ -325,7 +328,7 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testJsonFakeValueGeneratorIterateIndef } TEST_F(FakeVehicleHalValueGeneratorsTest, testJsonFakeValueGeneratorUsingRequest) { - long currentTime = elapsedRealtimeNano(); + int64_t currentTime = elapsedRealtimeNano(); VehiclePropValue request = {.value = { .stringValue = getTestFilePath("prop.json"), @@ -367,7 +370,7 @@ TEST_F(FakeVehicleHalValueGeneratorsTest, testJsonFakeValueGeneratorUsingRequest waitForEvents(expectedValues.size()); auto events = getEvents(); - long lastEventTime = currentTime; + int64_t lastEventTime = currentTime; for (auto& event : events) { EXPECT_GT(event.timestamp, lastEventTime); lastEventTime = event.timestamp; From f8f7b96fc9a168553d90a8a21bc74228179fc7cc Mon Sep 17 00:00:00 2001 From: Avichal Rakesh Date: Thu, 24 Feb 2022 05:41:13 +0000 Subject: [PATCH 018/998] camera: Fix build errors due to CLs interleaving. ag/16982347 and ag/16988237 were submitted around the same time, but can cause build failure when put together. This CL fixes the compilation issues and a few other other warnings. Fix: 221154052 Test: Existing Change-Id: Ia865e3bfc6cd77e7eff1efa5729d6db0d58c279d --- camera/provider/aidl/vts/camera_aidl_test.cpp | 29 ++++++++++--------- camera/provider/aidl/vts/camera_aidl_test.h | 5 ++-- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp index d03b09763b..48bca244d9 100644 --- a/camera/provider/aidl/vts/camera_aidl_test.cpp +++ b/camera/provider/aidl/vts/camera_aidl_test.cpp @@ -16,6 +16,8 @@ #include "camera_aidl_test.h" +#include + #include #include #include @@ -39,14 +41,12 @@ using ::aidl::android::hardware::camera::common::CameraDeviceStatus; using ::aidl::android::hardware::camera::common::TorchModeStatus; using ::aidl::android::hardware::camera::device::CameraMetadata; using ::aidl::android::hardware::camera::device::ICameraDevice; -using ::aidl::android::hardware::camera::device::ICameraDeviceSessionDefault; using ::aidl::android::hardware::camera::metadata::CameraMetadataTag; using ::aidl::android::hardware::camera::metadata::SensorInfoColorFilterArrangement; using ::aidl::android::hardware::camera::metadata::SensorPixelMode; using ::aidl::android::hardware::camera::provider::BnCameraProviderCallback; using ::aidl::android::hardware::camera::provider::ConcurrentCameraIdCombination; using ::aidl::android::hardware::camera::provider::ICameraProvider; -using ::aidl::android::hardware::camera::provider::ICameraProviderCallback; using ::aidl::android::hardware::common::NativeHandle; using ::android::hardware::camera::common::V1_0::helper::Size; using ::ndk::ScopedAStatus; @@ -97,7 +97,7 @@ bool parseProviderName(const std::string& serviceDescriptor, std::string* type / char* endPtr; errno = 0; - long idVal = strtol(serviceDescriptor.c_str() + slashIdx2 + 1, &endPtr, 10); + int64_t idVal = strtol(serviceDescriptor.c_str() + slashIdx2 + 1, &endPtr, 10); if (errno != 0) { ADD_FAILURE() << "cannot parse provider id as an integer:" << serviceDescriptor.c_str() << strerror(errno) << errno; @@ -1538,7 +1538,7 @@ void CameraAidlTest::verifyRequestTemplate(const camera_metadata_t* metadata, } void CameraAidlTest::openEmptyDeviceSession(const std::string& name, - std::shared_ptr provider, + const std::shared_ptr& provider, std::shared_ptr* session, CameraMetadata* staticMeta, std::shared_ptr* device) { @@ -2572,7 +2572,7 @@ void CameraAidlTest::configurePreviewStreams( void CameraAidlTest::verifyBuffersReturned(const std::shared_ptr& session, const std::vector& streamIds, - std::shared_ptr cb, + const std::shared_ptr& cb, uint32_t streamConfigCounter) { ndk::ScopedAStatus ret = session->signalStreamFlush(streamIds, /*streamConfigCounter*/ streamConfigCounter); @@ -2712,20 +2712,20 @@ void CameraAidlTest::get10BitDynamicRangeProfiles( ASSERT_NE(nullptr, staticMeta); ASSERT_NE(nullptr, profiles); camera_metadata_ro_entry entry; - std::unordered_set entries; + std::unordered_set entries; int rc = find_camera_metadata_ro_entry( staticMeta, ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP, &entry); ASSERT_EQ(rc, 0); ASSERT_TRUE(entry.count > 0); - ASSERT_EQ(entry.count % 2, 0); + ASSERT_EQ(entry.count % 3, 0); - for (uint32_t i = 0; i < entry.count; i += 2) { - ASSERT_NE(entry.data.i32[i], ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD); - ASSERT_EQ(entries.find(entry.data.i32[i]), entries.end()); - entries.insert(static_cast(entry.data.i32[i])); + for (uint32_t i = 0; i < entry.count; i += 3) { + ASSERT_NE(entry.data.i64[i], ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD); + ASSERT_EQ(entries.find(entry.data.i64[i]), entries.end()); + entries.insert(static_cast(entry.data.i64[i])); profiles->emplace_back( static_cast(entry.data.i32[i])); + RequestAvailableDynamicRangeProfilesMap>(entry.data.i64[i])); } if (!entries.empty()) { @@ -2743,7 +2743,7 @@ void CameraAidlTest::verify10BitMetadata( bool smpte2094_10Present = importer.isSmpte2094_10Present(b.buffer.buffer); bool smpte2094_40Present = importer.isSmpte2094_40Present(b.buffer.buffer); - switch (static_cast(profile)) { + switch (static_cast(profile)) { case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HLG10: ASSERT_FALSE(smpte2086Present); ASSERT_FALSE(smpte2094_10Present); @@ -2772,7 +2772,8 @@ void CameraAidlTest::verify10BitMetadata( ASSERT_FALSE(smpte2094_40Present); break; default: - ALOGE("%s: Unexpected 10-bit dynamic range profile: %d", __FUNCTION__, profile); + ALOGE("%s: Unexpected 10-bit dynamic range profile: %" PRId64, __FUNCTION__, + profile); ADD_FAILURE(); } } diff --git a/camera/provider/aidl/vts/camera_aidl_test.h b/camera/provider/aidl/vts/camera_aidl_test.h index cc381696c7..8e284a27b6 100644 --- a/camera/provider/aidl/vts/camera_aidl_test.h +++ b/camera/provider/aidl/vts/camera_aidl_test.h @@ -149,7 +149,7 @@ class CameraAidlTest : public ::testing::TestWithParam { PixelFormat format, buffer_handle_t* buffer_handle /*out*/); static void openEmptyDeviceSession(const std::string& name, - std::shared_ptr provider, + const std::shared_ptr& provider, std::shared_ptr* session /*out*/, CameraMetadata* staticMeta /*out*/, std::shared_ptr* device /*out*/); @@ -240,7 +240,8 @@ class CameraAidlTest : public ::testing::TestWithParam { uint32_t streamConfigCounter = 0); void verifyBuffersReturned(const std::shared_ptr& session, - const std::vector& streamIds, std::shared_ptr cb, + const std::vector& streamIds, + const std::shared_ptr& cb, uint32_t streamConfigCounter = 0); static void verifySessionReconfigurationQuery( From 1c4e9829ec684f1c33447f522db516b14e011255 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Mon, 28 Feb 2022 20:00:08 +0900 Subject: [PATCH 019/998] Cast to int for union tag Union tag will be changed from `enum` to `enum class`. We need explicit casting with enum class. Bug: 218912230 Test: m Change-Id: I2401e66dc9d8bc511a601fcdce365e5f823576d4 --- sensors/aidl/default/multihal/ConvertUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sensors/aidl/default/multihal/ConvertUtils.cpp b/sensors/aidl/default/multihal/ConvertUtils.cpp index 7751fd2994..9b2d8fe309 100644 --- a/sensors/aidl/default/multihal/ConvertUtils.cpp +++ b/sensors/aidl/default/multihal/ConvertUtils.cpp @@ -173,7 +173,7 @@ void convertToHidlEvent(const AidlEvent& aidlEvent, V2_1Event* hidlEvent) { } default: ALOGE("Invalid sensor additioanl info tag: %d", - additionalInfo.payload.getTag()); + static_cast(additionalInfo.payload.getTag())); break; } break; From 35c91cee023fbfbdb7512d607c9bc83468923e51 Mon Sep 17 00:00:00 2001 From: Huihong Luo Date: Mon, 28 Feb 2022 16:07:58 -0800 Subject: [PATCH 020/998] Sync with FrameEvent.aidl change Enum FrameEvent in libgui is converted to aidl. Bug: 220935835 Test: manual Change-Id: Iaaecd11d17770354883fd86954ef629fb5b91a83 --- automotive/evs/1.1/default/Android.bp | 1 + 1 file changed, 1 insertion(+) diff --git a/automotive/evs/1.1/default/Android.bp b/automotive/evs/1.1/default/Android.bp index 4c08ef364e..4172e63123 100644 --- a/automotive/evs/1.1/default/Android.bp +++ b/automotive/evs/1.1/default/Android.bp @@ -13,6 +13,7 @@ cc_binary { proprietary: true, relative_install_path: "hw", srcs: [ + ":libgui_frame_event_aidl", "*.cpp", ], init_rc: ["android.hardware.automotive.evs@1.1-service.rc"], From 975ff6b2f2037f7c3e85af1e29254bb16c777c47 Mon Sep 17 00:00:00 2001 From: Chris Weir Date: Mon, 7 Mar 2022 15:34:06 -0800 Subject: [PATCH 021/998] Fix VtsHalNetlinkInterceptorV1_0Test Move library dependencies to static_libs to fix linker error when running with ABI=armeabi-v7a Bug: 222019884 Test: atest VtsHalNetlinkInterceptorV1_0Test -- --abi armeabi-v7a Change-Id: I3566f1898b3b3fe89fcb69563b1dbd93789135dd --- wifi/netlinkinterceptor/vts/functional/Android.bp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wifi/netlinkinterceptor/vts/functional/Android.bp b/wifi/netlinkinterceptor/vts/functional/Android.bp index 33284e8e89..80608a74a6 100644 --- a/wifi/netlinkinterceptor/vts/functional/Android.bp +++ b/wifi/netlinkinterceptor/vts/functional/Android.bp @@ -34,13 +34,13 @@ cc_test { "interceptor_aidl_test.cpp", ], shared_libs: [ - "android.hardware.net.nlinterceptor-V1-ndk", "libbase", "libbinder_ndk", ], static_libs: [ - "libgmock", + "android.hardware.net.nlinterceptor-V1-ndk", "android.hardware.automotive.can@libnetdevice", + "libgmock", "libnl++", ], test_suites: [ From de9336b13c8b6724b77d1a2ed4928cc8c24f37c5 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Tue, 15 Mar 2022 19:39:56 +0000 Subject: [PATCH 022/998] uwb(hal): Add link to official UCI specification Resolving a TODO. Bug: 196004116 Change-Id: I1b2e3caa6f67f2d04bd728ab682cfb31e8f3ee82 Test: Compiles --- uwb/aidl/android/hardware/uwb/IUwbChip.aidl | 4 ++-- uwb/aidl/android/hardware/uwb/IUwbClientCallback.aidl | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/uwb/aidl/android/hardware/uwb/IUwbChip.aidl b/uwb/aidl/android/hardware/uwb/IUwbChip.aidl index 00cb8e0772..6ee5799ffe 100644 --- a/uwb/aidl/android/hardware/uwb/IUwbChip.aidl +++ b/uwb/aidl/android/hardware/uwb/IUwbChip.aidl @@ -71,8 +71,8 @@ interface IUwbChip { * The UCI message format is as per UCI protocol and it is * defined in "FiRa Consortium - UCI Generic Specification_v1.0" specification at FiRa * consortium. - * WIP doc link: https://groups.firaconsortium.org/wg/Technical/document/folder/127. - * TODO(b/196004116): Link to the published specification. + * + * UCI 1.1 specification: https://groups.firaconsortium.org/wg/members/document/1949. * * This method may queue writes and return immediately, or it may block until data is written. * Implementation must guarantee that writes are executed in order. diff --git a/uwb/aidl/android/hardware/uwb/IUwbClientCallback.aidl b/uwb/aidl/android/hardware/uwb/IUwbClientCallback.aidl index 75853cd97c..f31aeba1a5 100755 --- a/uwb/aidl/android/hardware/uwb/IUwbClientCallback.aidl +++ b/uwb/aidl/android/hardware/uwb/IUwbClientCallback.aidl @@ -28,8 +28,7 @@ oneway interface IUwbClientCallback { * can use to pass incoming data to the stack. These include UCI * responses and notifications from the UWB subsystem. * - * WIP doc link: https://groups.firaconsortium.org/wg/Technical/document/folder/127. - * TODO(b/196004116): Link to the published specification. + * UCI 1.1 specification: https://groups.firaconsortium.org/wg/members/document/1949. * * @param data UCI packet sent. */ From 64e3ec21551e5521e3cade66d9f2297050b0fd03 Mon Sep 17 00:00:00 2001 From: Chris Weir Date: Tue, 11 Jan 2022 16:09:46 -0800 Subject: [PATCH 023/998] Add clearPollErr to Socket nlproxy gets stuck if a POLLERR is encountered, and I found a CL that suggests the only way to clear the error is to recv (which should return zero bytes in theory) on that socket. Bug: 224850481 Test: nlproxy works Change-Id: Ib1420ce542deeb35977223baf787bdee1b125110 --- automotive/can/1.0/default/libnl++/Socket.cpp | 19 +++++++++++++++ .../default/libnl++/include/libnl++/Socket.h | 6 +++++ .../protocols/generic/FamilyTracker.cpp | 1 + .../libnlinterceptor/libnlinterceptor.h | 11 ++++----- .../libnlinterceptor/libnlinterceptor.cpp | 23 +++++++------------ 5 files changed, 39 insertions(+), 21 deletions(-) diff --git a/automotive/can/1.0/default/libnl++/Socket.cpp b/automotive/can/1.0/default/libnl++/Socket.cpp index cc1d839434..32110fe3d8 100644 --- a/automotive/can/1.0/default/libnl++/Socket.cpp +++ b/automotive/can/1.0/default/libnl++/Socket.cpp @@ -47,6 +47,17 @@ Socket::Socket(int protocol, unsigned pid, uint32_t groups) : mProtocol(protocol } } +void Socket::clearPollErr() { + sockaddr_nl sa = {}; + socklen_t saLen = sizeof(sa); + const auto bytesReceived = recvfrom(mFd.get(), mReceiveBuffer.data(), mReceiveBuffer.size(), 0, + reinterpret_cast(&sa), &saLen); + if (errno != EINVAL) { + PLOG(WARNING) << "clearPollError() caught unexpected error: "; + } + CHECK_EQ(bytesReceived, 0) << "clearPollError() recvd " << bytesReceived << " instead of zero!"; +} + bool Socket::send(const Buffer& msg, const sockaddr_nl& sa) { if constexpr (kSuperVerbose) { LOG(VERBOSE) << (mFailed ? "(not) " : "") << "sending to " << sa.nl_pid << ": " @@ -110,6 +121,13 @@ std::pair>, sockaddr_nl> Socket::receiveFrom(size if constexpr (kSuperVerbose) { LOG(VERBOSE) << "received from " << sa.nl_pid << ": " << toString(msg, mProtocol); } + long headerByteTotal = 0; + for (const auto hdr : msg) { + headerByteTotal += hdr->nlmsg_len; + } + if (bytesReceived != headerByteTotal) { + LOG(ERROR) << "received " << bytesReceived << " bytes, header claims " << headerByteTotal; + } return {msg, sa}; } @@ -159,6 +177,7 @@ std::optional Socket::getPid() { } pollfd Socket::preparePoll(short events) { + CHECK(mFd.get() > 0) << "Netlink socket fd is invalid!"; return {mFd.get(), events, 0}; } diff --git a/automotive/can/1.0/default/libnl++/include/libnl++/Socket.h b/automotive/can/1.0/default/libnl++/include/libnl++/Socket.h index 7ec0f7bdf9..996a3500af 100644 --- a/automotive/can/1.0/default/libnl++/include/libnl++/Socket.h +++ b/automotive/can/1.0/default/libnl++/include/libnl++/Socket.h @@ -54,6 +54,12 @@ class Socket { */ Socket(int protocol, unsigned pid = 0, uint32_t groups = 0); + /** + * Attempt to clear POLLERR by recv-ing. + * TODO(224850481): determine if this is necessary, or if the socket is locked up anyway. + */ + void clearPollErr(); + /** * Send Netlink message with incremented sequence number to the Kernel. * diff --git a/automotive/can/1.0/default/libnl++/protocols/generic/FamilyTracker.cpp b/automotive/can/1.0/default/libnl++/protocols/generic/FamilyTracker.cpp index 900560e5b9..3ad101e19d 100644 --- a/automotive/can/1.0/default/libnl++/protocols/generic/FamilyTracker.cpp +++ b/automotive/can/1.0/default/libnl++/protocols/generic/FamilyTracker.cpp @@ -30,6 +30,7 @@ bool FamilyTracker::track(const Buffer& buffer) { const auto familyName = msg.attributes.get(CTRL_ATTR_FAMILY_NAME); const auto familyId = msg.attributes.get(CTRL_ATTR_FAMILY_ID); + // TODO(224845900): NETLINK_GENERIC == 16, and (erroneously?) sets off this warning if (familyId < GENL_START_ALLOC) { LOG(WARNING) << "Invalid family ID: " << familyId; return true; diff --git a/wifi/netlinkinterceptor/libnlinterceptor/include/libnlinterceptor/libnlinterceptor.h b/wifi/netlinkinterceptor/libnlinterceptor/include/libnlinterceptor/libnlinterceptor.h index ac8653ebe4..32e5a6e47c 100644 --- a/wifi/netlinkinterceptor/libnlinterceptor/include/libnlinterceptor/libnlinterceptor.h +++ b/wifi/netlinkinterceptor/libnlinterceptor/include/libnlinterceptor/libnlinterceptor.h @@ -117,14 +117,13 @@ bool android_nlinterceptor_createSocket( int clientSocketFd, const char* clientName, struct android_nlinterceptor_InterceptedSocket* interceptedSocket); -void android_nlinterceptor_closeSocket( - const struct android_nlinterceptor_InterceptedSocket* sock); +void android_nlinterceptor_closeSocket(struct android_nlinterceptor_InterceptedSocket sock); -bool android_nlinterceptor_subscribe( - const struct android_nlinterceptor_InterceptedSocket* sock, uint32_t group); +bool android_nlinterceptor_subscribe(struct android_nlinterceptor_InterceptedSocket sock, + uint32_t group); -bool android_nlinterceptor_unsubscribe( - const struct android_nlinterceptor_InterceptedSocket* sock, uint32_t group); +bool android_nlinterceptor_unsubscribe(struct android_nlinterceptor_InterceptedSocket sock, + uint32_t group); #ifdef __cplusplus } diff --git a/wifi/netlinkinterceptor/libnlinterceptor/libnlinterceptor.cpp b/wifi/netlinkinterceptor/libnlinterceptor/libnlinterceptor.cpp index 575f90031a..aae7a3a415 100644 --- a/wifi/netlinkinterceptor/libnlinterceptor/libnlinterceptor.cpp +++ b/wifi/netlinkinterceptor/libnlinterceptor/libnlinterceptor.cpp @@ -150,25 +150,18 @@ extern "C" bool android_nlinterceptor_createSocket( return true; } -extern "C" void android_nlinterceptor_closeSocket( - const android_nlinterceptor_InterceptedSocket* sock) { - if (!sock) { - LOG(ERROR) << "Can't close socket identified by a null pointer!"; - return; - } - closeSocket({sock->nlFamily, sock->portId}); +extern "C" void android_nlinterceptor_closeSocket(android_nlinterceptor_InterceptedSocket sock) { + closeSocket({sock.nlFamily, sock.portId}); } -extern "C" bool android_nlinterceptor_subscribe( - const android_nlinterceptor_InterceptedSocket* sock, uint32_t group) { - if (!sock) return false; - return subscribe({sock->nlFamily, sock->portId}, group); +extern "C" bool android_nlinterceptor_subscribe(android_nlinterceptor_InterceptedSocket sock, + uint32_t group) { + return subscribe({sock.nlFamily, sock.portId}, group); } -extern "C" bool android_nlinterceptor_unsubscribe( - const android_nlinterceptor_InterceptedSocket* sock, uint32_t group) { - if (!sock) return false; - return unsubscribe({sock->nlFamily, sock->portId}, group); +extern "C" bool android_nlinterceptor_unsubscribe(android_nlinterceptor_InterceptedSocket sock, + uint32_t group) { + return unsubscribe({sock.nlFamily, sock.portId}, group); } } // namespace android::nlinterceptor From 60d68f88d538056b0756703238b9b26bc352e2ef Mon Sep 17 00:00:00 2001 From: Jayachandran C Date: Fri, 11 Mar 2022 03:47:00 -0800 Subject: [PATCH 024/998] Media HAL cleanup based on vendor feedback Bug: 203240638 Test: Build Change-Id: I6bdf47929385a5ed65f1a2ca34500c67888f8b07 --- radio/aidl/Android.bp | 3 +- .../hardware/radio/ims/media/CodecParams.aidl | 6 +-- .../hardware/radio/ims/media/EvsParams.aidl | 1 + .../radio/ims/media/IImsMediaListener.aidl | 2 - .../radio/ims/media/IImsMediaSession.aidl | 2 +- .../ims/media/IImsMediaSessionListener.aidl | 4 +- .../radio/ims/media/LocalEndPoint.aidl | 3 +- .../radio/ims/media/MediaStackState.aidl | 40 ------------------ .../hardware/radio/ims/media/RtcpConfig.aidl | 1 - .../hardware/radio/ims/media/RtpConfig.aidl | 4 +- .../hardware/radio/ims/media/RtpError.aidl | 2 +- .../hardware/radio/ims/media/RtpSession.aidl | 41 ------------------- .../radio/ims/media/RtpSessionParams.aidl | 4 +- .../hardware/radio/ims/media/SpeechCodec.aidl | 39 ------------------ .../hardware/radio/ims/media/CodecParams.aidl | 10 ++--- .../hardware/radio/ims/media/EvsParams.aidl | 4 ++ .../radio/ims/media/IImsMediaListener.aidl | 16 -------- .../radio/ims/media/IImsMediaSession.aidl | 4 +- .../ims/media/IImsMediaSessionListener.aidl | 12 +++--- .../radio/ims/media/LocalEndPoint.aidl | 8 ++-- .../radio/ims/media/MediaStackState.aidl | 28 ------------- .../hardware/radio/ims/media/RtcpConfig.aidl | 2 - .../hardware/radio/ims/media/RtpConfig.aidl | 12 ++---- .../hardware/radio/ims/media/RtpError.aidl | 2 +- .../hardware/radio/ims/media/RtpSession.aidl | 33 --------------- .../radio/ims/media/RtpSessionParams.aidl | 4 +- .../hardware/radio/ims/media/SpeechCodec.aidl | 28 ------------- 27 files changed, 44 insertions(+), 271 deletions(-) delete mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaStackState.aidl delete mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSession.aidl delete mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/SpeechCodec.aidl delete mode 100644 radio/aidl/android/hardware/radio/ims/media/MediaStackState.aidl delete mode 100644 radio/aidl/android/hardware/radio/ims/media/RtpSession.aidl delete mode 100644 radio/aidl/android/hardware/radio/ims/media/SpeechCodec.aidl diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp index 3eb6bf258c..d68f3d4600 100644 --- a/radio/aidl/Android.bp +++ b/radio/aidl/Android.bp @@ -182,7 +182,8 @@ aidl_interface { vendor_available: true, srcs: ["android/hardware/radio/ims/media/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio.data"], + imports: ["android.hardware.radio", + "android.hardware.radio.data"], backend: { cpp: { enabled: false, diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl index bd7ddae494..3c4884383f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl @@ -34,9 +34,9 @@ package android.hardware.radio.ims.media; @VintfStability parcelable CodecParams { - android.hardware.radio.ims.media.SpeechCodec codec; - int rxPayloadTypeNumber; - int txPayloadTypeNumber; + android.hardware.radio.ims.media.CodecType codecType; + byte rxPayloadTypeNumber; + byte txPayloadTypeNumber; byte samplingRateKHz; byte txCodecModeRequest; boolean dtxEnabled; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl index 46817df7e1..8d5124b247 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl @@ -34,6 +34,7 @@ package android.hardware.radio.ims.media; @VintfStability parcelable EvsParams { + android.hardware.radio.ims.media.EvsBandwidth bandwidth; android.hardware.radio.ims.media.EvsMode evsMode; byte channelAwareMode; boolean useHeaderFullOnlyOnTx; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaListener.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaListener.aidl index b15534cd01..efd59c3495 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaListener.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaListener.aidl @@ -34,8 +34,6 @@ package android.hardware.radio.ims.media; @VintfStability interface IImsMediaListener { - oneway void onBringupResponse(android.hardware.radio.ims.media.RtpError status, in android.hardware.radio.ims.media.SpeechCodec[] supportedCodecs); - oneway void onMediaStackStateChanged(android.hardware.radio.ims.media.MediaStackState state); oneway void onOpenSessionSuccess(int sessionId, android.hardware.radio.ims.media.IImsMediaSession session); oneway void onOpenSessionFailure(int sessionId, android.hardware.radio.ims.media.RtpError error); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl index 48ffaa307d..03d0fcc1db 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl @@ -41,6 +41,6 @@ interface IImsMediaSession { oneway void confirmConfig(in android.hardware.radio.ims.media.RtpConfig config); oneway void startDtmf(char dtmfDigit, int volume, int duration); oneway void stopDtmf(); - oneway void sendHeaderExtension(in android.hardware.radio.ims.media.RtpHeaderExtension[] data); + oneway void sendHeaderExtension(in List extensions); oneway void setMediaQualityThreshold(in android.hardware.radio.ims.media.MediaQualityThreshold threshold); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl index 761b1430b9..ce551217ae 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl @@ -34,12 +34,12 @@ package android.hardware.radio.ims.media; @VintfStability interface IImsMediaSessionListener { - oneway void onSessionChanged(in android.hardware.radio.ims.media.RtpSession session); + oneway void onSessionChanged(android.hardware.radio.ims.media.RtpSessionState state); oneway void onModifySessionResponse(in android.hardware.radio.ims.media.RtpConfig config, android.hardware.radio.ims.media.RtpError error); oneway void onAddConfigResponse(in android.hardware.radio.ims.media.RtpConfig config, android.hardware.radio.ims.media.RtpError error); oneway void onConfirmConfigResponse(in android.hardware.radio.ims.media.RtpConfig config, android.hardware.radio.ims.media.RtpError error); oneway void onFirstMediaPacketReceived(in android.hardware.radio.ims.media.RtpConfig config); - oneway void onHeaderExtensionReceived(in android.hardware.radio.ims.media.RtpHeaderExtension[] data); + oneway void onHeaderExtensionReceived(in List extensions); oneway void notifyMediaInactivity(android.hardware.radio.ims.media.MediaProtocolType packetType, int duration); oneway void notifyPacketLoss(int packetLossPercentage); oneway void notifyJitter(int jitter); diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/LocalEndPoint.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/LocalEndPoint.aidl index cb352d66a5..6ec51569af 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/LocalEndPoint.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/LocalEndPoint.aidl @@ -34,6 +34,7 @@ package android.hardware.radio.ims.media; @VintfStability parcelable LocalEndPoint { - android.hardware.radio.ims.media.RtpAddress localAddress; + ParcelFileDescriptor rtpFd; + ParcelFileDescriptor rtcpFd; int modemId; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaStackState.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaStackState.aidl deleted file mode 100644 index a7bb32376e..0000000000 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaStackState.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2021 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 -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.hardware.radio.ims.media; -@Backing(type="int") @VintfStability -enum MediaStackState { - NOT_READY = 1, - READY = 2, - ERROR_FATAL = 3, -} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpConfig.aidl index b1f10f26ae..6a76d85cd8 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpConfig.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpConfig.aidl @@ -36,7 +36,6 @@ package android.hardware.radio.ims.media; parcelable RtcpConfig { String canonicalName; int transmitPort; - int receivePort; int transmitIntervalSec; int rtcpXrBlocks; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl index d3af0f803e..4b803788c2 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl @@ -34,11 +34,9 @@ package android.hardware.radio.ims.media; @VintfStability parcelable RtpConfig { - int configId; android.hardware.radio.ims.media.MediaDirection direction; + android.hardware.radio.AccessNetwork accessNetwork; android.hardware.radio.ims.media.RtpAddress remoteAddress; android.hardware.radio.ims.media.RtpSessionParams sessionParams; android.hardware.radio.ims.media.RtcpConfig rtcpConfig; - android.hardware.radio.data.QosBandwidth downlink; - android.hardware.radio.data.QosBandwidth uplink; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpError.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpError.aidl index f5bc1903b1..41b0aeb287 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpError.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpError.aidl @@ -40,5 +40,5 @@ enum RtpError { NO_MEMORY = 3, NO_RESOURCES = 4, PORT_UNAVAILABLE = 5, - REQUEST_NOT_SUPPORTED = 6, + NOT_SUPPORTED = 6, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSession.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSession.aidl deleted file mode 100644 index 93c8b16181..0000000000 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSession.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 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 -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.hardware.radio.ims.media; -@VintfStability -parcelable RtpSession { - int sessionId; - android.hardware.radio.ims.media.LocalEndPoint localEndPoint; - android.hardware.radio.ims.media.RtpSessionState sessionState = android.hardware.radio.ims.media.RtpSessionState.CLOSED; - android.hardware.radio.ims.media.RtpConfig[] remoteConfigs; -} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionParams.aidl index 8e1af236ae..97c55119bc 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionParams.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionParams.aidl @@ -35,9 +35,9 @@ package android.hardware.radio.ims.media; @VintfStability parcelable RtpSessionParams { byte pTimeMillis; - byte maxPtimeMillis; + int maxPtimeMillis; int maxMtuBytes; - int dscp; + byte dscp; android.hardware.radio.ims.media.DtmfParams dtmfParams; android.hardware.radio.ims.media.CodecParams codecParams; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/SpeechCodec.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/SpeechCodec.aidl deleted file mode 100644 index 76a1070489..0000000000 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/SpeechCodec.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2021 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 -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.hardware.radio.ims.media; -@VintfStability -parcelable SpeechCodec { - android.hardware.radio.ims.media.CodecType codecType; - android.hardware.radio.ims.media.EvsBandwidth bandwidth; -} diff --git a/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl b/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl index 6d38874c81..56f7936e3a 100644 --- a/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl @@ -17,24 +17,24 @@ package android.hardware.radio.ims.media; import android.hardware.radio.ims.media.CodecSpecificParams; -import android.hardware.radio.ims.media.SpeechCodec; +import android.hardware.radio.ims.media.CodecType; @VintfStability parcelable CodecParams { - /** Negotiated codec and bandwidth */ - SpeechCodec codec; + /** Negotiated codec type */ + CodecType codecType; /** * Static or dynamic payload type number negotiated through the SDP for * the incoming RTP packets. This value shall be matched with the PT value * of the incoming RTP header. Values 0 to 127, see RFC 3551 section 6 */ - int rxPayloadTypeNumber; + byte rxPayloadTypeNumber; /** * Static or dynamic payload type number negotiated through the SDP for * the outgoing RTP packets. This value shall be set to the PT value * of the outgoing RTP header. Values 0 to 127, see RFC 3551 section 6 */ - int txPayloadTypeNumber; + byte txPayloadTypeNumber; /** Sampling rate in kHz*/ byte samplingRateKHz; /** diff --git a/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl b/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl index 4bccf8ac9a..ecbb958285 100644 --- a/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl @@ -17,9 +17,13 @@ package android.hardware.radio.ims.media; import android.hardware.radio.ims.media.EvsMode; +import android.hardware.radio.ims.media.EvsBandwidth; @VintfStability parcelable EvsParams { + /** EVS codec bandwidth */ + EvsBandwidth bandwidth; + /** mode-set: EVS codec mode to represent the bit rate */ EvsMode evsMode; /** diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaListener.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaListener.aidl index 8f2585fe6d..4078ea2d1a 100644 --- a/radio/aidl/android/hardware/radio/ims/media/IImsMediaListener.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaListener.aidl @@ -17,29 +17,13 @@ package android.hardware.radio.ims.media; import android.hardware.radio.ims.media.IImsMediaSession; -import android.hardware.radio.ims.media.MediaStackState; import android.hardware.radio.ims.media.RtpError; -import android.hardware.radio.ims.media.SpeechCodec; /** * Interface declaring listener functions for unsolicited IMS media notifications. */ @VintfStability oneway interface IImsMediaListener { - /** - * Notifies the media stack bring up status and capabilities. - * - * @param status bring up status - * @param supportedCodecs array of supported speech codecs by the implementation - */ - void onBringupResponse(RtpError status, in SpeechCodec[] supportedCodecs); - - /** - * Notifies the state of the media stack whenever there is a change. - * - * @param state current state of the media stack - */ - void onMediaStackStateChanged(MediaStackState state); /** * Fired when a IImsMedia#openSession() API is successful. diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl index 98d7bda538..3e29356dbf 100644 --- a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl @@ -93,9 +93,9 @@ oneway interface IImsMediaSession { /** * Send RTP header extension to the other party in the next RTP packet. * - * @param data data to be transmitted via RTP header extension + * @param extensions data to be transmitted via RTP header extension */ - void sendHeaderExtension(in RtpHeaderExtension[] data); + void sendHeaderExtension(in List extensions); /** * Sets the media quality threshold parameters of the session to get diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl index b542079f5f..01a042f029 100644 --- a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl @@ -20,7 +20,7 @@ import android.hardware.radio.ims.media.MediaProtocolType; import android.hardware.radio.ims.media.RtpHeaderExtension; import android.hardware.radio.ims.media.RtpConfig; import android.hardware.radio.ims.media.RtpError; -import android.hardware.radio.ims.media.RtpSession; +import android.hardware.radio.ims.media.RtpSessionState; /** * Interface declaring listener functions for unsolicited IMS media notifications per session. @@ -28,11 +28,11 @@ import android.hardware.radio.ims.media.RtpSession; @VintfStability oneway interface IImsMediaSessionListener { /** - * Notifies whenever a change occurs to the RTP session. + * Notifies whenever the session state changed. * - * @param session Updated RTP session + * @param state RTP session state */ - void onSessionChanged(in RtpSession session); + void onSessionChanged(RtpSessionState state); /** * Notifies the result of IImsMediaSession#modifySession() API. @@ -85,9 +85,9 @@ oneway interface IImsMediaSessionListener { /** * RTP header extension received from the other party * - * @param data content of the received RTP header extension + * @param extensions content of the received RTP header extension */ - void onHeaderExtensionReceived(in RtpHeaderExtension[] data); + void onHeaderExtensionReceived(in List extensions); /** * Notifies media inactivity observed as per thresholds set by diff --git a/radio/aidl/android/hardware/radio/ims/media/LocalEndPoint.aidl b/radio/aidl/android/hardware/radio/ims/media/LocalEndPoint.aidl index cd8894b869..2bd48c6fd7 100644 --- a/radio/aidl/android/hardware/radio/ims/media/LocalEndPoint.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/LocalEndPoint.aidl @@ -16,12 +16,14 @@ package android.hardware.radio.ims.media; -import android.hardware.radio.ims.media.RtpAddress; +import android.os.ParcelFileDescriptor; @VintfStability parcelable LocalEndPoint { - /** IP address/port on the IMS network where the socket needs to be open */ - RtpAddress localAddress; + /** Socket file descriptor for RTP traffic */ + ParcelFileDescriptor rtpFd; + /** Socket file descriptor for RTCP traffic */ + ParcelFileDescriptor rtcpFd; /** The logical modem ID, returned by IRadioConfig.getPhoneCapability() */ int modemId; } diff --git a/radio/aidl/android/hardware/radio/ims/media/MediaStackState.aidl b/radio/aidl/android/hardware/radio/ims/media/MediaStackState.aidl deleted file mode 100644 index 25b239e298..0000000000 --- a/radio/aidl/android/hardware/radio/ims/media/MediaStackState.aidl +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2021 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.hardware.radio.ims.media; - -@VintfStability -@Backing(type="int") -enum MediaStackState { - /** The media stack is not initialized */ - NOT_READY = 1, - /** The media stack is initialized and ready */ - READY = 2, - /** The media stack is in unrecoverable error condition */ - ERROR_FATAL = 3, -} diff --git a/radio/aidl/android/hardware/radio/ims/media/RtcpConfig.aidl b/radio/aidl/android/hardware/radio/ims/media/RtcpConfig.aidl index 61f98d06db..98bbfc6aeb 100644 --- a/radio/aidl/android/hardware/radio/ims/media/RtcpConfig.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/RtcpConfig.aidl @@ -22,8 +22,6 @@ parcelable RtcpConfig { String canonicalName; /** Port for sending outgoing RTCP packets */ int transmitPort; - /** Port where incoming RTCP packets are received */ - int receivePort; /** Transmit interval in seconds. Value 0 indicates that RTCP reports should not be reported */ int transmitIntervalSec; /** Bitmask of RTCP-XR blocks to enable as in RtcpXrReportBlockType */ diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl index 9f366f78a2..52ca712125 100644 --- a/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl @@ -16,7 +16,7 @@ package android.hardware.radio.ims.media; -import android.hardware.radio.data.QosBandwidth; +import android.hardware.radio.AccessNetwork; import android.hardware.radio.ims.media.MediaDirection; import android.hardware.radio.ims.media.RtcpConfig; import android.hardware.radio.ims.media.RtpAddress; @@ -24,18 +24,14 @@ import android.hardware.radio.ims.media.RtpSessionParams; @VintfStability parcelable RtpConfig { - /** Unique identifier of the RTP config within a session */ - int configId; /** Media flow direction */ MediaDirection direction; - /** IP address and port number of the other party */ + /** Radio Access Network */ + AccessNetwork accessNetwork; + /** IP address and port number of the other party for RTP media */ RtpAddress remoteAddress; /** Negotiated session parameters */ RtpSessionParams sessionParams; /** RTCP configuration */ RtcpConfig rtcpConfig; - /** Downlink bandwidth allocated by network in the dedicated bearer */ - QosBandwidth downlink; - /** Uplink bandwidth allocated by network in the dedicated bearer */ - QosBandwidth uplink; } diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpError.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpError.aidl index 84f26aec66..11a3468da2 100644 --- a/radio/aidl/android/hardware/radio/ims/media/RtpError.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/RtpError.aidl @@ -32,5 +32,5 @@ enum RtpError { /** The requested port number is not available */ PORT_UNAVAILABLE = 5, /** The request is not supported by the implementation */ - REQUEST_NOT_SUPPORTED = 6, + NOT_SUPPORTED = 6, } diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpSession.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpSession.aidl deleted file mode 100644 index 70443b4139..0000000000 --- a/radio/aidl/android/hardware/radio/ims/media/RtpSession.aidl +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2021 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.hardware.radio.ims.media; - -import android.hardware.radio.ims.media.LocalEndPoint; -import android.hardware.radio.ims.media.RtpConfig; -import android.hardware.radio.ims.media.RtpSessionState; - -@VintfStability -parcelable RtpSession { - /** Unique identifier of the session */ - int sessionId; - /** Local RTP address and logical modem identity */ - LocalEndPoint localEndPoint; - /** RTP session state */ - RtpSessionState sessionState = RtpSessionState.CLOSED; - /** List of remote configurations associated with this session */ - RtpConfig[] remoteConfigs; -} diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpSessionParams.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpSessionParams.aidl index 98aff1fd1e..86a1d331b3 100644 --- a/radio/aidl/android/hardware/radio/ims/media/RtpSessionParams.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/RtpSessionParams.aidl @@ -30,11 +30,11 @@ parcelable RtpSessionParams { * maxptime: Maximum amount of media that can be encapsulated in each packet * represented in milliseconds, see RFC 4566 */ - byte maxPtimeMillis; + int maxPtimeMillis; /** Maximum Rtp transfer unit in bytes */ int maxMtuBytes; /** dscp: Differentiated Services Field Code Point value, see RFC 2474 */ - int dscp; + byte dscp; /** DTMF payload and clock rate */ DtmfParams dtmfParams; /** Negotiated codec parameters */ diff --git a/radio/aidl/android/hardware/radio/ims/media/SpeechCodec.aidl b/radio/aidl/android/hardware/radio/ims/media/SpeechCodec.aidl deleted file mode 100644 index 5d5680f71a..0000000000 --- a/radio/aidl/android/hardware/radio/ims/media/SpeechCodec.aidl +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2021 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.hardware.radio.ims.media; - -import android.hardware.radio.ims.media.CodecType; -import android.hardware.radio.ims.media.EvsBandwidth; - -@VintfStability -parcelable SpeechCodec { - /** Codec type */ - CodecType codecType; - /** Codec bandwidth in case of EVS codec type */ - EvsBandwidth bandwidth; -} From 8e4e25e04c391652e690b5b46e6f0104d666e33b Mon Sep 17 00:00:00 2001 From: Chris Weir Date: Fri, 18 Mar 2022 13:46:11 -0700 Subject: [PATCH 025/998] Don't crash on pollerr I should have checked for <=0, not == 0. Oops Bug: 224850481 Test: TCU and HU don't burst into flames when pollerr happens. Change-Id: I1b1d0855a588d065d29cad31b2ca40e4d981e086 --- automotive/can/1.0/default/libnl++/Socket.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automotive/can/1.0/default/libnl++/Socket.cpp b/automotive/can/1.0/default/libnl++/Socket.cpp index 32110fe3d8..221063d344 100644 --- a/automotive/can/1.0/default/libnl++/Socket.cpp +++ b/automotive/can/1.0/default/libnl++/Socket.cpp @@ -55,7 +55,7 @@ void Socket::clearPollErr() { if (errno != EINVAL) { PLOG(WARNING) << "clearPollError() caught unexpected error: "; } - CHECK_EQ(bytesReceived, 0) << "clearPollError() recvd " << bytesReceived << " instead of zero!"; + CHECK_LE(bytesReceived, 0) << "clearPollError() didn't find an error!"; } bool Socket::send(const Buffer& msg, const sockaddr_nl& sa) { From ba658c0e9871ec6e0b920ab1441a0a0d912df8d1 Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Tue, 22 Mar 2022 15:59:54 +0000 Subject: [PATCH 026/998] Replace writepid with task_profiles command for cgroup migration writepid command usage to join a cgroup has been deprecated in favor of a more flexible approach using task_profiles. This way cgroup path is not hardcoded and cgroup changes can be easily made. Replace writepid with task_profiles command to migrate between cgroups. Bug: 191283136 Test: build and boot Signed-off-by: Suren Baghdasaryan Change-Id: Icbf3e66e61e7ebb570ac3aba5f1cf9e10ef6720d --- .../1.1/default/android.hardware.tv.tuner@1.1-service-lazy.rc | 2 +- tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service.rc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service-lazy.rc b/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service-lazy.rc index abff430d3c..3fe6b52453 100644 --- a/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service-lazy.rc +++ b/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service-lazy.rc @@ -7,4 +7,4 @@ service vendor.tuner-hal-1-1 /vendor/bin/hw/android.hardware.tv.tuner@1.1-servic user media group mediadrm drmrpc ioprio rt 4 - writepid /dev/cpuset/foreground/tasks \ No newline at end of file + task_profiles ProcessCapacityHigh diff --git a/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service.rc b/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service.rc index 62ee52019a..4ee6fa9a27 100644 --- a/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service.rc +++ b/tv/tuner/1.1/default/android.hardware.tv.tuner@1.1-service.rc @@ -3,5 +3,5 @@ service vendor.tuner-hal-1-1 /vendor/bin/hw/android.hardware.tv.tuner@1.1-servic user media group mediadrm drmrpc ioprio rt 4 - writepid /dev/cpuset/foreground/tasks + task_profiles ProcessCapacityHigh onrestart restart media.tuner From 7abc70f9085e56aac85c97b30c8c4c1a3b97b63f Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Tue, 16 Nov 2021 01:31:03 +0000 Subject: [PATCH 027/998] audio HAL: initial VTS tests Tests basic functionality for enumerating capabilities of an audio module, audio patches creation, and opening of I/O streams. Bug: 205884982 Test: atest VtsHalAudioCoreTargetTest Change-Id: I7c7c3c7008f2fc43db1542455c74444a08e55534 --- audio/aidl/vts/Android.bp | 32 + audio/aidl/vts/ModuleConfig.cpp | 330 ++++++ audio/aidl/vts/ModuleConfig.h | 131 +++ audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp | 1027 ++++++++++++++++++ 4 files changed, 1520 insertions(+) create mode 100644 audio/aidl/vts/Android.bp create mode 100644 audio/aidl/vts/ModuleConfig.cpp create mode 100644 audio/aidl/vts/ModuleConfig.h create mode 100644 audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp diff --git a/audio/aidl/vts/Android.bp b/audio/aidl/vts/Android.bp new file mode 100644 index 0000000000..c160d1f5cc --- /dev/null +++ b/audio/aidl/vts/Android.bp @@ -0,0 +1,32 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_test { + name: "VtsHalAudioCoreTargetTest", + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + srcs: [ + "ModuleConfig.cpp", + "VtsHalAudioCoreTargetTest.cpp", + ], + shared_libs: [ + "libbinder", + ], + static_libs: [ + "android.hardware.audio.common-V1-cpp", + "android.hardware.audio.core-V1-cpp", + "android.media.audio.common.types-V1-cpp", + ], + test_suites: [ + "general-tests", + "vts", + ], +} diff --git a/audio/aidl/vts/ModuleConfig.cpp b/audio/aidl/vts/ModuleConfig.cpp new file mode 100644 index 0000000000..3faa39ab4f --- /dev/null +++ b/audio/aidl/vts/ModuleConfig.cpp @@ -0,0 +1,330 @@ +/* + * 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. + */ + +#include + +#include +#include + +#include "ModuleConfig.h" + +using namespace android; + +using android::hardware::audio::core::IModule; +using android::media::audio::common::AudioChannelLayout; +using android::media::audio::common::AudioFormatDescription; +using android::media::audio::common::AudioFormatType; +using android::media::audio::common::AudioIoFlags; +using android::media::audio::common::AudioOutputFlags; +using android::media::audio::common::AudioPort; +using android::media::audio::common::AudioPortConfig; +using android::media::audio::common::AudioPortExt; +using android::media::audio::common::AudioProfile; +using android::media::audio::common::Int; + +template +auto findById(const std::vector& v, int32_t id) { + return std::find_if(v.begin(), v.end(), [&](const auto& p) { return p.id == id; }); +} + +ModuleConfig::ModuleConfig(IModule* module) { + mStatus = module->getAudioPorts(&mPorts); + if (!mStatus.isOk()) return; + for (const auto& port : mPorts) { + if (port.ext.getTag() != AudioPortExt::Tag::device) continue; + const auto& devicePort = port.ext.get(); + const bool isInput = port.flags.getTag() == AudioIoFlags::Tag::input; + if (devicePort.device.type.connection.empty()) { + // Permanently attached device. + if (isInput) { + mAttachedSourceDevicePorts.insert(port.id); + } else { + mAttachedSinkDevicePorts.insert(port.id); + } + } + } + if (!mStatus.isOk()) return; + mStatus = module->getAudioRoutes(&mRoutes); + if (!mStatus.isOk()) return; + mStatus = module->getAudioPortConfigs(&mInitialConfigs); +} + +std::vector ModuleConfig::getInputMixPorts() const { + std::vector result; + std::copy_if(mPorts.begin(), mPorts.end(), std::back_inserter(result), [](const auto& port) { + return port.ext.getTag() == AudioPortExt::Tag::mix && + port.flags.getTag() == AudioIoFlags::Tag::input; + }); + return result; +} + +std::vector ModuleConfig::getOutputMixPorts() const { + std::vector result; + std::copy_if(mPorts.begin(), mPorts.end(), std::back_inserter(result), [](const auto& port) { + return port.ext.getTag() == AudioPortExt::Tag::mix && + port.flags.getTag() == AudioIoFlags::Tag::output; + }); + return result; +} + +std::vector ModuleConfig::getAttachedSinkDevicesPortsForMixPort( + const AudioPort& mixPort) const { + std::vector result; + for (const auto& route : mRoutes) { + if (mAttachedSinkDevicePorts.count(route.sinkPortId) != 0 && + std::find(route.sourcePortIds.begin(), route.sourcePortIds.end(), mixPort.id) != + route.sourcePortIds.end()) { + const auto devicePortIt = findById(mPorts, route.sinkPortId); + if (devicePortIt != mPorts.end()) result.push_back(*devicePortIt); + } + } + return result; +} + +std::vector ModuleConfig::getAttachedSourceDevicesPortsForMixPort( + const AudioPort& mixPort) const { + std::vector result; + for (const auto& route : mRoutes) { + if (route.sinkPortId == mixPort.id) { + for (const auto srcId : route.sourcePortIds) { + if (mAttachedSourceDevicePorts.count(srcId) != 0) { + const auto devicePortIt = findById(mPorts, srcId); + if (devicePortIt != mPorts.end()) result.push_back(*devicePortIt); + } + } + } + } + return result; +} + +std::optional ModuleConfig::getSourceMixPortForAttachedDevice() const { + for (const auto& route : mRoutes) { + if (mAttachedSinkDevicePorts.count(route.sinkPortId) != 0) { + const auto mixPortIt = findById(mPorts, route.sourcePortIds[0]); + if (mixPortIt != mPorts.end()) return *mixPortIt; + } + } + return {}; +} + +std::optional ModuleConfig::getNonRoutableSrcSinkPair( + bool isInput) const { + const auto mixPorts = getMixPorts(isInput); + std::set> allowedRoutes; + for (const auto& route : mRoutes) { + for (const auto srcPortId : route.sourcePortIds) { + allowedRoutes.emplace(std::make_pair(srcPortId, route.sinkPortId)); + } + } + auto make_pair = [isInput](auto& device, auto& mix) { + return isInput ? std::make_pair(device, mix) : std::make_pair(mix, device); + }; + for (const auto portId : isInput ? mAttachedSourceDevicePorts : mAttachedSinkDevicePorts) { + const auto devicePortIt = findById(mPorts, portId); + if (devicePortIt == mPorts.end()) continue; + auto devicePortConfig = getSingleConfigForDevicePort(*devicePortIt); + for (const auto& mixPort : mixPorts) { + if (std::find(allowedRoutes.begin(), allowedRoutes.end(), + make_pair(portId, mixPort.id)) == allowedRoutes.end()) { + auto mixPortConfig = getSingleConfigForMixPort(isInput, mixPort); + if (mixPortConfig.has_value()) { + return make_pair(devicePortConfig, mixPortConfig.value()); + } + } + } + } + return {}; +} + +std::optional ModuleConfig::getRoutableSrcSinkPair(bool isInput) const { + if (isInput) { + for (const auto& route : mRoutes) { + auto srcPortIdIt = std::find_if( + route.sourcePortIds.begin(), route.sourcePortIds.end(), + [&](const auto& portId) { return mAttachedSourceDevicePorts.count(portId); }); + if (srcPortIdIt == route.sourcePortIds.end()) continue; + const auto devicePortIt = findById(mPorts, *srcPortIdIt); + const auto mixPortIt = findById(mPorts, route.sinkPortId); + if (devicePortIt == mPorts.end() || mixPortIt == mPorts.end()) continue; + auto devicePortConfig = getSingleConfigForDevicePort(*devicePortIt); + auto mixPortConfig = getSingleConfigForMixPort(isInput, *mixPortIt); + if (!mixPortConfig.has_value()) continue; + return std::make_pair(devicePortConfig, mixPortConfig.value()); + } + } else { + for (const auto& route : mRoutes) { + if (mAttachedSinkDevicePorts.count(route.sinkPortId) == 0) continue; + const auto mixPortIt = findById(mPorts, route.sourcePortIds[0]); + const auto devicePortIt = findById(mPorts, route.sinkPortId); + if (devicePortIt == mPorts.end() || mixPortIt == mPorts.end()) continue; + auto mixPortConfig = getSingleConfigForMixPort(isInput, *mixPortIt); + auto devicePortConfig = getSingleConfigForDevicePort(*devicePortIt); + if (!mixPortConfig.has_value()) continue; + return std::make_pair(mixPortConfig.value(), devicePortConfig); + } + } + return {}; +} + +std::vector ModuleConfig::getRoutableSrcSinkGroups(bool isInput) const { + std::vector result; + if (isInput) { + for (const auto& route : mRoutes) { + std::vector srcPortIds; + std::copy_if(route.sourcePortIds.begin(), route.sourcePortIds.end(), + std::back_inserter(srcPortIds), [&](const auto& portId) { + return mAttachedSourceDevicePorts.count(portId); + }); + if (srcPortIds.empty()) continue; + const auto mixPortIt = findById(mPorts, route.sinkPortId); + if (mixPortIt == mPorts.end()) continue; + auto mixPortConfig = getSingleConfigForMixPort(isInput, *mixPortIt); + if (!mixPortConfig.has_value()) continue; + std::vector pairs; + for (const auto srcPortId : srcPortIds) { + const auto devicePortIt = findById(mPorts, srcPortId); + if (devicePortIt == mPorts.end()) continue; + // Using all configs for every source would be too much. + auto devicePortConfig = getSingleConfigForDevicePort(*devicePortIt); + pairs.emplace_back(devicePortConfig, mixPortConfig.value()); + } + if (!pairs.empty()) { + result.emplace_back(route, std::move(pairs)); + } + } + } else { + for (const auto& route : mRoutes) { + if (mAttachedSinkDevicePorts.count(route.sinkPortId) == 0) continue; + const auto devicePortIt = findById(mPorts, route.sinkPortId); + if (devicePortIt == mPorts.end()) continue; + auto devicePortConfig = getSingleConfigForDevicePort(*devicePortIt); + std::vector pairs; + for (const auto srcPortId : route.sourcePortIds) { + const auto mixPortIt = findById(mPorts, srcPortId); + if (mixPortIt == mPorts.end()) continue; + // Using all configs for every source would be too much. + auto mixPortConfig = getSingleConfigForMixPort(isInput, *mixPortIt); + if (mixPortConfig.has_value()) { + pairs.emplace_back(mixPortConfig.value(), devicePortConfig); + } + } + if (!pairs.empty()) { + result.emplace_back(route, std::move(pairs)); + } + } + } + return result; +} + +static std::vector combineAudioConfigs(const AudioPort& port, + const AudioProfile& profile) { + std::vector configs; + configs.reserve(profile.channelMasks.size() * profile.sampleRates.size()); + for (auto channelMask : profile.channelMasks) { + for (auto sampleRate : profile.sampleRates) { + AudioPortConfig config{}; + config.portId = port.id; + Int sr; + sr.value = sampleRate; + config.sampleRate = sr; + config.channelMask = channelMask; + config.format = profile.format; + config.ext = port.ext; + configs.push_back(config); + } + } + return configs; +} + +std::vector ModuleConfig::generateInputAudioMixPortConfigs( + const std::vector& ports, bool singleProfile) const { + std::vector result; + for (const auto& mixPort : ports) { + if (getAttachedSourceDevicesPortsForMixPort(mixPort).empty()) { + continue; // no attached devices + } + for (const auto& profile : mixPort.profiles) { + if (profile.format.type == AudioFormatType::DEFAULT || profile.sampleRates.empty() || + profile.channelMasks.empty()) { + continue; // dynamic profile + } + auto configs = combineAudioConfigs(mixPort, profile); + for (auto& config : configs) { + config.flags = mixPort.flags; + result.push_back(config); + if (singleProfile) return result; + } + } + } + return result; +} + +static std::tuple generateOutFlags(const AudioPort& mixPort) { + static const AudioIoFlags offloadFlags = AudioIoFlags::make( + (1 << static_cast(AudioOutputFlags::COMPRESS_OFFLOAD)) | + (1 << static_cast(AudioOutputFlags::DIRECT))); + const bool isOffload = (mixPort.flags.get() & + (1 << static_cast(AudioOutputFlags::COMPRESS_OFFLOAD))) != 0; + return {isOffload ? offloadFlags : mixPort.flags, isOffload}; +} + +std::vector ModuleConfig::generateOutputAudioMixPortConfigs( + const std::vector& ports, bool singleProfile) const { + std::vector result; + for (const auto& mixPort : ports) { + if (getAttachedSinkDevicesPortsForMixPort(mixPort).empty()) { + continue; // no attached devices + } + auto [flags, isOffload] = generateOutFlags(mixPort); + (void)isOffload; + for (const auto& profile : mixPort.profiles) { + if (profile.format.type == AudioFormatType::DEFAULT) continue; + auto configs = combineAudioConfigs(mixPort, profile); + for (auto& config : configs) { + // Some combinations of flags declared in the config file require special + // treatment. + // if (isOffload) { + // config.offloadInfo.info(generateOffloadInfo(config.base)); + // } + config.flags = flags; + result.push_back(config); + if (singleProfile) return result; + } + } + } + return result; +} + +std::vector ModuleConfig::generateAudioDevicePortConfigs( + const std::vector& ports, bool singleProfile) const { + std::vector result; + for (const auto& devicePort : ports) { + const size_t resultSizeBefore = result.size(); + for (const auto& profile : devicePort.profiles) { + auto configs = combineAudioConfigs(devicePort, profile); + result.insert(result.end(), configs.begin(), configs.end()); + if (singleProfile && !result.empty()) return result; + } + if (resultSizeBefore == result.size()) { + AudioPortConfig empty; + empty.portId = devicePort.id; + empty.ext = devicePort.ext; + result.push_back(empty); + } + if (singleProfile) return result; + } + return result; +} diff --git a/audio/aidl/vts/ModuleConfig.h b/audio/aidl/vts/ModuleConfig.h new file mode 100644 index 0000000000..2e86b97cf5 --- /dev/null +++ b/audio/aidl/vts/ModuleConfig.h @@ -0,0 +1,131 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include + +#include +#include +#include +#include + +class ModuleConfig { + public: + using SrcSinkPair = std::pair; + using SrcSinkGroup = + std::pair>; + + explicit ModuleConfig(android::hardware::audio::core::IModule* module); + android::binder::Status getStatus() const { return mStatus; } + std::string getError() const { return mStatus.toString8().c_str(); } + + std::vector getInputMixPorts() const; + std::vector getOutputMixPorts() const; + std::vector getMixPorts(bool isInput) const { + return isInput ? getInputMixPorts() : getOutputMixPorts(); + } + + std::vector getAttachedDevicesPortsForMixPort( + bool isInput, const android::media::audio::common::AudioPort& mixPort) const { + return isInput ? getAttachedSourceDevicesPortsForMixPort(mixPort) + : getAttachedSinkDevicesPortsForMixPort(mixPort); + } + std::vector getAttachedSinkDevicesPortsForMixPort( + const android::media::audio::common::AudioPort& mixPort) const; + std::vector getAttachedSourceDevicesPortsForMixPort( + const android::media::audio::common::AudioPort& mixPort) const; + std::optional getSourceMixPortForAttachedDevice() + const; + + std::optional getNonRoutableSrcSinkPair(bool isInput) const; + std::optional getRoutableSrcSinkPair(bool isInput) const; + std::vector getRoutableSrcSinkGroups(bool isInput) const; + + std::vector getPortConfigsForMixPorts() const { + auto inputs = generateInputAudioMixPortConfigs(getInputMixPorts(), false); + auto outputs = generateOutputAudioMixPortConfigs(getOutputMixPorts(), false); + inputs.insert(inputs.end(), outputs.begin(), outputs.end()); + return inputs; + } + std::vector getPortConfigsForMixPorts( + bool isInput) const { + return isInput ? generateInputAudioMixPortConfigs(getInputMixPorts(), false) + : generateOutputAudioMixPortConfigs(getOutputMixPorts(), false); + } + std::vector getPortConfigsForMixPorts( + bool isInput, const android::media::audio::common::AudioPort& port) const { + return isInput ? generateInputAudioMixPortConfigs({port}, false) + : generateOutputAudioMixPortConfigs({port}, false); + } + std::optional getSingleConfigForMixPort( + bool isInput) const { + const auto config = isInput ? generateInputAudioMixPortConfigs(getInputMixPorts(), true) + : generateOutputAudioMixPortConfigs(getOutputMixPorts(), true); + // TODO: Avoid returning configs for offload since they require an extra + // argument to openOutputStream. + if (!config.empty()) { + return *config.begin(); + } else { + return {}; + } + } + std::optional getSingleConfigForMixPort( + bool isInput, const android::media::audio::common::AudioPort& port) const { + const auto config = isInput ? generateInputAudioMixPortConfigs({port}, true) + : generateOutputAudioMixPortConfigs({port}, true); + if (!config.empty()) { + return *config.begin(); + } else { + return {}; + } + } + + android::media::audio::common::AudioPortConfig getSingleConfigForDevicePort( + const android::media::audio::common::AudioPort& port) const { + for (const auto& config : mInitialConfigs) { + if (config.portId == port.id) return config; + } + const auto config = generateAudioDevicePortConfigs({port}, true); + return *config.begin(); + } + + private: + std::vector generateInputAudioMixPortConfigs( + const std::vector& ports, + bool singleProfile) const; + std::vector generateOutputAudioMixPortConfigs( + const std::vector& ports, + bool singleProfile) const; + + // Unlike MixPorts, the generator for DevicePorts always returns a non-empty + // vector for a non-empty input port list. If there are no profiles in the + // port, a vector with an empty config is returned. + std::vector generateAudioDevicePortConfigs( + const std::vector& ports, + bool singleProfile) const; + + android::binder::Status mStatus = android::binder::Status::ok(); + std::vector mPorts; + std::vector mInitialConfigs; + std::set mAttachedSinkDevicePorts; + std::set mAttachedSourceDevicePorts; + std::vector mRoutes; +}; diff --git a/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp new file mode 100644 index 0000000000..cadeb0c50e --- /dev/null +++ b/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp @@ -0,0 +1,1027 @@ +/* + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ModuleConfig.h" + +using namespace android; +using android::binder::Status; +using android::hardware::audio::common::PlaybackTrackMetadata; +using android::hardware::audio::common::RecordTrackMetadata; +using android::hardware::audio::common::SinkMetadata; +using android::hardware::audio::common::SourceMetadata; +using android::hardware::audio::core::AudioPatch; +using android::hardware::audio::core::AudioRoute; +using android::hardware::audio::core::IModule; +using android::hardware::audio::core::IStreamIn; +using android::hardware::audio::core::IStreamOut; +using android::media::audio::common::AudioContentType; +using android::media::audio::common::AudioDevice; +using android::media::audio::common::AudioDeviceType; +using android::media::audio::common::AudioIoFlags; +using android::media::audio::common::AudioOutputFlags; +using android::media::audio::common::AudioPort; +using android::media::audio::common::AudioPortConfig; +using android::media::audio::common::AudioPortDeviceExt; +using android::media::audio::common::AudioPortExt; +using android::media::audio::common::AudioSource; +using android::media::audio::common::AudioUsage; + +template +auto findById(std::vector& v, int32_t id) { + return std::find_if(v.begin(), v.end(), [&](const auto& e) { return e.id == id; }); +} + +template +std::vector getNonExistentIds(const C& allIds) { + if (allIds.empty()) { + return std::vector{-1, 0, 1}; + } + std::vector nonExistentIds; + nonExistentIds.push_back(*std::min_element(allIds.begin(), allIds.end()) - 1); + nonExistentIds.push_back(*std::max_element(allIds.begin(), allIds.end()) + 1); + return nonExistentIds; +} + +struct AidlDeathRecipient : IBinder::DeathRecipient { + std::mutex mutex; + std::condition_variable condition; + bool fired = false; + wp who; + + void binderDied(const wp& who) override { + std::unique_lock lock(mutex); + fired = true; + this->who = who; + condition.notify_one(); + }; + + bool waitForFired(int timeoutMs) { + std::unique_lock lock(mutex); + condition.wait_for(lock, std::chrono::milliseconds(timeoutMs), [this]() { return fired; }); + return fired; + } +}; + +template +struct IsInput { + constexpr operator bool() const; +}; + +template <> +constexpr IsInput::operator bool() const { + return true; +} +template <> +constexpr IsInput::operator bool() const { + return false; +} + +class AudioCoreModule : public testing::TestWithParam { + public: + void SetUp() override { ASSERT_NO_FATAL_FAILURE(ConnectToService()); } + + void ConnectToService() { + module = android::waitForDeclaredService(String16(GetParam().c_str())); + ASSERT_NE(module, nullptr); + } + + void RestartService() { + ASSERT_NE(module, nullptr); + moduleConfig.reset(); + deathHandler = sp::make(); + ASSERT_EQ(NO_ERROR, IModule::asBinder(module)->linkToDeath(deathHandler)); + ASSERT_TRUE(base::SetProperty("sys.audio.restart.hal", "1")); + EXPECT_TRUE(deathHandler->waitForFired(3000)); + deathHandler = nullptr; + ASSERT_NO_FATAL_FAILURE(ConnectToService()); + } + + template + void GetAllEntityIds(std::set* entityIds, + Status (IModule::*getter)(std::vector*), + const std::string& errorMessage) { + std::vector entities; + { + Status status = (module.get()->*getter)(&entities); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + } + std::transform(entities.begin(), entities.end(), + std::inserter(*entityIds, entityIds->begin()), + [](const auto& entity) { return entity.id; }); + EXPECT_EQ(entities.size(), entityIds->size()) << errorMessage; + } + + void GetAllPatchIds(std::set* patchIds) { + return GetAllEntityIds( + patchIds, &IModule::getAudioPatches, + "IDs of audio patches returned by IModule.getAudioPatches are not unique"); + } + + void GetAllPortIds(std::set* portIds) { + return GetAllEntityIds( + portIds, &IModule::getAudioPorts, + "IDs of audio ports returned by IModule.getAudioPorts are not unique"); + } + + void GetAllPortConfigIds(std::set* portConfigIds) { + return GetAllEntityIds( + portConfigIds, &IModule::getAudioPortConfigs, + "IDs of audio port configs returned by IModule.getAudioPortConfigs are not unique"); + } + + void SetUpModuleConfig() { + if (moduleConfig == nullptr) { + moduleConfig = std::make_unique(module.get()); + ASSERT_EQ(Status::EX_NONE, moduleConfig->getStatus().exceptionCode()) + << "ModuleConfig init error: " << moduleConfig->getError(); + } + } + + sp module; + sp deathHandler; + std::unique_ptr moduleConfig; +}; + +// For consistency, WithAudioPortConfig can start both with a non-existent +// port config, and with an existing one. Existence is determined by the +// id of the provided config. If it's not 0, then WithAudioPortConfig is +// essentially a no-op wrapper. +class WithAudioPortConfig { + public: + WithAudioPortConfig() {} + explicit WithAudioPortConfig(const AudioPortConfig& config) : mInitialConfig(config) {} + ~WithAudioPortConfig() { + if (mModule != nullptr) { + Status status = mModule->resetAudioPortConfig(getId()); + EXPECT_EQ(Status::EX_NONE, status.exceptionCode()) + << status << "; port config id " << getId(); + } + } + void SetUp(IModule* module) { + ASSERT_NE(AudioPortExt::Tag::unspecified, mInitialConfig.ext.getTag()) + << "config: " << mInitialConfig.toString(); + // Negotiation is allowed for device ports because the HAL module is + // allowed to provide an empty profiles list for attached devices. + ASSERT_NO_FATAL_FAILURE( + SetUpImpl(module, mInitialConfig.ext.getTag() == AudioPortExt::Tag::device)); + } + int32_t getId() const { return mConfig.id; } + const AudioPortConfig& get() const { return mConfig; } + + private: + void SetUpImpl(IModule* module, bool negotiate) { + if (mInitialConfig.id == 0) { + AudioPortConfig suggested; + bool applied = false; + Status status = module->setAudioPortConfig(mInitialConfig, &suggested, &applied); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) + << status << "; Config: " << mInitialConfig.toString(); + if (!applied && negotiate) { + mInitialConfig = suggested; + ASSERT_NO_FATAL_FAILURE(SetUpImpl(module, false)) + << " while applying suggested config: " << suggested.toString(); + } else { + ASSERT_TRUE(applied) << "Suggested: " << suggested.toString(); + mConfig = suggested; + mModule = module; + } + } else { + mConfig = mInitialConfig; + } + } + + AudioPortConfig mInitialConfig; + IModule* mModule = nullptr; + AudioPortConfig mConfig; +}; + +template +class WithStream { + public: + WithStream() {} + explicit WithStream(const AudioPortConfig& portConfig) : mPortConfig(portConfig) {} + ~WithStream() { + if (mStream != nullptr) { + Status status = mStream->close(); + EXPECT_EQ(Status::EX_NONE, status.exceptionCode()) + << status << "; port config id " << getPortId(); + } + } + void SetUpPortConfig(IModule* module) { ASSERT_NO_FATAL_FAILURE(mPortConfig.SetUp(module)); } + Status SetUpNoChecks(IModule* module) { return SetUpNoChecks(module, mPortConfig.get()); } + Status SetUpNoChecks(IModule* module, const AudioPortConfig& portConfig); + void SetUp(IModule* module) { + ASSERT_NO_FATAL_FAILURE(SetUpPortConfig(module)); + Status status = SetUpNoChecks(module); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) + << status << "; port config id " << getPortId(); + ASSERT_NE(nullptr, mStream) << "; port config id " << getPortId(); + } + Stream* get() const { return mStream.get(); } + const AudioPortConfig& getPortConfig() const { return mPortConfig.get(); } + int32_t getPortId() const { return mPortConfig.getId(); } + + private: + WithAudioPortConfig mPortConfig; + sp mStream; +}; + +template <> +Status WithStream::SetUpNoChecks(IModule* module, const AudioPortConfig& portConfig) { + RecordTrackMetadata trackMeta; + trackMeta.source = AudioSource::MIC; + trackMeta.gain = 1.0; + trackMeta.channelMask = portConfig.channelMask.value(); + SinkMetadata metadata; + metadata.tracks.push_back(trackMeta); + return module->openInputStream(portConfig.id, metadata, &mStream); +} + +template <> +Status WithStream::SetUpNoChecks(IModule* module, const AudioPortConfig& portConfig) { + PlaybackTrackMetadata trackMeta; + trackMeta.usage = AudioUsage::MEDIA; + trackMeta.contentType = AudioContentType::MUSIC; + trackMeta.gain = 1.0; + trackMeta.channelMask = portConfig.channelMask.value(); + SourceMetadata metadata; + metadata.tracks.push_back(trackMeta); + return module->openOutputStream(portConfig.id, metadata, {}, &mStream); +} + +class WithAudioPatch { + public: + WithAudioPatch() {} + WithAudioPatch(const AudioPortConfig& srcPortConfig, const AudioPortConfig& sinkPortConfig) + : mSrcPortConfig(srcPortConfig), mSinkPortConfig(sinkPortConfig) {} + ~WithAudioPatch() { + if (mModule != nullptr && mPatch.id != 0) { + Status status = mModule->resetAudioPatch(mPatch.id); + EXPECT_EQ(Status::EX_NONE, status.exceptionCode()) + << status << "; patch id " << getId(); + } + } + void SetUpPortConfigs(IModule* module) { + ASSERT_NO_FATAL_FAILURE(mSrcPortConfig.SetUp(module)); + ASSERT_NO_FATAL_FAILURE(mSinkPortConfig.SetUp(module)); + } + Status SetUpNoChecks(IModule* module) { + mModule = module; + mPatch.sourcePortConfigIds = std::vector{mSrcPortConfig.getId()}; + mPatch.sinkPortConfigIds = std::vector{mSinkPortConfig.getId()}; + return mModule->setAudioPatch(mPatch, &mPatch); + } + void SetUp(IModule* module) { + ASSERT_NO_FATAL_FAILURE(SetUpPortConfigs(module)); + Status status = SetUpNoChecks(module); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) + << status << "; source port config id " << mSrcPortConfig.getId() + << "; sink port config id " << mSinkPortConfig.getId(); + } + int32_t getId() const { return mPatch.id; } + const AudioPatch& get() const { return mPatch; } + + private: + WithAudioPortConfig mSrcPortConfig; + WithAudioPortConfig mSinkPortConfig; + IModule* mModule = nullptr; + AudioPatch mPatch; +}; + +TEST_P(AudioCoreModule, Published) { + // SetUp must complete with no failures. +} + +TEST_P(AudioCoreModule, CanBeRestarted) { + ASSERT_NO_FATAL_FAILURE(RestartService()); +} + +TEST_P(AudioCoreModule, PortIdsAreUnique) { + std::set portIds; + ASSERT_NO_FATAL_FAILURE(GetAllPortIds(&portIds)); +} + +TEST_P(AudioCoreModule, GetAudioPortsIsStatic) { + std::vector ports1; + { + Status status = module->getAudioPorts(&ports1); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + } + std::vector ports2; + { + Status status = module->getAudioPorts(&ports2); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + } + ASSERT_EQ(ports1.size(), ports2.size()) + << "Sizes of audio port arrays do not match across calls to getAudioPorts"; + std::sort(ports1.begin(), ports1.end()); + std::sort(ports2.begin(), ports2.end()); + EXPECT_EQ(ports1, ports2); +} + +TEST_P(AudioCoreModule, GetAudioRoutesIsStatic) { + std::vector routes1; + { + Status status = module->getAudioRoutes(&routes1); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + } + std::vector routes2; + { + Status status = module->getAudioRoutes(&routes2); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + } + ASSERT_EQ(routes1.size(), routes2.size()) + << "Sizes of audio route arrays do not match across calls to getAudioRoutes"; + std::sort(routes1.begin(), routes1.end()); + std::sort(routes2.begin(), routes2.end()); + EXPECT_EQ(routes1, routes2); +} + +TEST_P(AudioCoreModule, GetAudioRoutesAreValid) { + std::vector routes; + { + Status status = module->getAudioRoutes(&routes); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + } + for (const auto& route : routes) { + std::set sources(route.sourcePortIds.begin(), route.sourcePortIds.end()); + EXPECT_NE(0, sources.size()) + << "empty audio port sinks in the audio route: " << route.toString(); + EXPECT_EQ(sources.size(), route.sourcePortIds.size()) + << "IDs of audio port sinks are not unique in the audio route: " + << route.toString(); + } +} + +TEST_P(AudioCoreModule, GetAudioRoutesPortIdsAreValid) { + std::set portIds; + ASSERT_NO_FATAL_FAILURE(GetAllPortIds(&portIds)); + std::vector routes; + { + Status status = module->getAudioRoutes(&routes); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + } + for (const auto& route : routes) { + EXPECT_EQ(1, portIds.count(route.sinkPortId)) + << route.sinkPortId << " sink port id is unknown"; + for (const auto& source : route.sourcePortIds) { + EXPECT_EQ(1, portIds.count(source)) << source << " source port id is unknown"; + } + } +} + +TEST_P(AudioCoreModule, CheckDevicePorts) { + std::vector ports; + { + Status status = module->getAudioPorts(&ports); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + } + std::optional defaultOutput, defaultInput; + std::set inputs, outputs; + const int defaultDeviceFlag = 1 << AudioPortDeviceExt::FLAG_INDEX_DEFAULT_DEVICE; + for (const auto& port : ports) { + if (port.ext.getTag() != AudioPortExt::Tag::device) continue; + const auto& devicePort = port.ext.get(); + EXPECT_NE(AudioDeviceType::NONE, devicePort.device.type.type); + EXPECT_NE(AudioDeviceType::IN_DEFAULT, devicePort.device.type.type); + EXPECT_NE(AudioDeviceType::OUT_DEFAULT, devicePort.device.type.type); + if (devicePort.device.type.type > AudioDeviceType::IN_DEFAULT && + devicePort.device.type.type < AudioDeviceType::OUT_DEFAULT) { + EXPECT_EQ(AudioIoFlags::Tag::input, port.flags.getTag()); + } else if (devicePort.device.type.type > AudioDeviceType::OUT_DEFAULT) { + EXPECT_EQ(AudioIoFlags::Tag::output, port.flags.getTag()); + } + EXPECT_FALSE((devicePort.flags & defaultDeviceFlag) != 0 && + !devicePort.device.type.connection.empty()) + << "Device port " << port.id + << " must be permanently attached to be set as default"; + if ((devicePort.flags & defaultDeviceFlag) != 0) { + if (port.flags.getTag() == AudioIoFlags::Tag::output) { + EXPECT_FALSE(defaultOutput.has_value()) + << "At least two output device ports are declared as default: " + << defaultOutput.value() << " and " << port.id; + defaultOutput = port.id; + EXPECT_EQ(0, outputs.count(devicePort.device)) + << "Non-unique output device: " << devicePort.device.toString(); + outputs.insert(devicePort.device); + } else if (port.flags.getTag() == AudioIoFlags::Tag::input) { + EXPECT_FALSE(defaultInput.has_value()) + << "At least two input device ports are declared as default: " + << defaultInput.value() << " and " << port.id; + defaultInput = port.id; + EXPECT_EQ(0, inputs.count(devicePort.device)) + << "Non-unique input device: " << devicePort.device.toString(); + inputs.insert(devicePort.device); + } else { + FAIL() << "Invalid AudioIoFlags Tag: " << toString(port.flags.getTag()); + } + } + } +} + +TEST_P(AudioCoreModule, CheckMixPorts) { + std::vector ports; + { + Status status = module->getAudioPorts(&ports); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + } + std::optional primaryMixPort; + constexpr int primaryOutputFlag = 1 << static_cast(AudioOutputFlags::PRIMARY); + for (const auto& port : ports) { + if (port.ext.getTag() != AudioPortExt::Tag::mix) continue; + const auto& mixPort = port.ext.get(); + if (port.flags.getTag() == AudioIoFlags::Tag::output && + ((port.flags.get() & primaryOutputFlag) != 0)) { + EXPECT_FALSE(primaryMixPort.has_value()) + << "At least two mix ports have PRIMARY flag set: " << primaryMixPort.value() + << " and " << port.id; + primaryMixPort = port.id; + EXPECT_EQ(1, mixPort.maxOpenStreamCount) + << "Primary mix port " << port.id << " can not have maxOpenStreamCount " + << mixPort.maxOpenStreamCount; + } + } +} + +TEST_P(AudioCoreModule, GetAudioPort) { + std::set portIds; + ASSERT_NO_FATAL_FAILURE(GetAllPortIds(&portIds)); + if (portIds.empty()) { + GTEST_SKIP() << "No ports in the module."; + } + for (const auto portId : portIds) { + AudioPort port; + Status status = module->getAudioPort(portId, &port); + EXPECT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + EXPECT_EQ(portId, port.id); + } + for (const auto portId : getNonExistentIds(portIds)) { + AudioPort port; + Status status = module->getAudioPort(portId, &port); + EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + << status << " returned for port ID " << portId; + } +} + +TEST_P(AudioCoreModule, OpenStreamInvalidPortConfigId) { + std::set portConfigIds; + ASSERT_NO_FATAL_FAILURE(GetAllPortConfigIds(&portConfigIds)); + for (const auto portConfigId : getNonExistentIds(portConfigIds)) { + { + sp stream; + Status status = module->openInputStream(portConfigId, {}, &stream); + EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + << status << " openInputStream returned for port config ID " << portConfigId; + EXPECT_EQ(nullptr, stream); + } + { + sp stream; + Status status = module->openOutputStream(portConfigId, {}, {}, &stream); + EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + << status << " openOutputStream returned for port config ID " << portConfigId; + EXPECT_EQ(nullptr, stream); + } + } +} + +TEST_P(AudioCoreModule, PortConfigIdsAreUnique) { + std::set portConfigIds; + ASSERT_NO_FATAL_FAILURE(GetAllPortConfigIds(&portConfigIds)); +} + +TEST_P(AudioCoreModule, PortConfigPortIdsAreValid) { + std::set portIds; + ASSERT_NO_FATAL_FAILURE(GetAllPortIds(&portIds)); + std::vector portConfigs; + { + Status status = module->getAudioPortConfigs(&portConfigs); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + } + for (const auto& config : portConfigs) { + EXPECT_EQ(1, portIds.count(config.portId)) + << config.portId << " port id is unknown, config id " << config.id; + } +} + +TEST_P(AudioCoreModule, ResetAudioPortConfigInvalidId) { + std::set portConfigIds; + ASSERT_NO_FATAL_FAILURE(GetAllPortConfigIds(&portConfigIds)); + for (const auto portConfigId : getNonExistentIds(portConfigIds)) { + Status status = module->resetAudioPortConfig(portConfigId); + EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + << status << " returned for port config ID " << portConfigId; + } +} + +// Verify that for the audio port configs provided by the HAL after init, resetting +// the config does not delete it, but brings it back to the initial config. +TEST_P(AudioCoreModule, ResetAudioPortConfigToInitialValue) { + std::vector portConfigsBefore; + { + Status status = module->getAudioPortConfigs(&portConfigsBefore); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + } + // TODO: Change port configs according to port profiles. + for (const auto& c : portConfigsBefore) { + Status status = module->resetAudioPortConfig(c.id); + EXPECT_EQ(Status::EX_NONE, status.exceptionCode()) + << status << " returned for port config ID " << c.id; + } + std::vector portConfigsAfter; + { + Status status = module->getAudioPortConfigs(&portConfigsAfter); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + } + for (const auto& c : portConfigsBefore) { + auto afterIt = findById(portConfigsAfter, c.id); + EXPECT_NE(portConfigsAfter.end(), afterIt) + << " port config ID " << c.id << " was removed by reset"; + if (afterIt != portConfigsAfter.end()) { + EXPECT_EQ(c, *afterIt); + } + } +} + +TEST_P(AudioCoreModule, SetAudioPortConfigSuggestedConfig) { + ASSERT_NO_FATAL_FAILURE(SetUpModuleConfig()); + auto srcMixPort = moduleConfig->getSourceMixPortForAttachedDevice(); + if (!srcMixPort.has_value()) { + GTEST_SKIP() << "No mix port for attached output devices"; + } + AudioPortConfig portConfig; + AudioPortConfig suggestedConfig; + portConfig.portId = srcMixPort.value().id; + { + bool applied = true; + Status status = module->setAudioPortConfig(portConfig, &suggestedConfig, &applied); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) + << status << "; Config: " << portConfig.toString(); + EXPECT_FALSE(applied); + } + EXPECT_EQ(0, suggestedConfig.id); + EXPECT_TRUE(suggestedConfig.sampleRate.has_value()); + EXPECT_TRUE(suggestedConfig.channelMask.has_value()); + EXPECT_TRUE(suggestedConfig.format.has_value()); + EXPECT_TRUE(suggestedConfig.flags.has_value()); + WithAudioPortConfig applied(suggestedConfig); + ASSERT_NO_FATAL_FAILURE(applied.SetUp(module.get())); + const AudioPortConfig& appliedConfig = applied.get(); + EXPECT_NE(0, appliedConfig.id); + EXPECT_TRUE(appliedConfig.sampleRate.has_value()); + EXPECT_EQ(suggestedConfig.sampleRate.value(), appliedConfig.sampleRate.value()); + EXPECT_TRUE(appliedConfig.channelMask.has_value()); + EXPECT_EQ(suggestedConfig.channelMask.value(), appliedConfig.channelMask.value()); + EXPECT_TRUE(appliedConfig.format.has_value()); + EXPECT_EQ(suggestedConfig.format.value(), appliedConfig.format.value()); + EXPECT_TRUE(appliedConfig.flags.has_value()); + EXPECT_EQ(suggestedConfig.flags.value(), appliedConfig.flags.value()); +} + +TEST_P(AudioCoreModule, SetAllStaticAudioPortConfigs) { + ASSERT_NO_FATAL_FAILURE(SetUpModuleConfig()); + const auto allPortConfigs = moduleConfig->getPortConfigsForMixPorts(); + for (const auto& config : allPortConfigs) { + ASSERT_NE(0, config.portId); + WithAudioPortConfig portConfig(config); + ASSERT_NO_FATAL_FAILURE(portConfig.SetUp(module.get())); + EXPECT_EQ(config.portId, portConfig.get().portId); + std::vector retrievedPortConfigs; + { + Status status = module->getAudioPortConfigs(&retrievedPortConfigs); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + } + const int32_t portConfigId = portConfig.getId(); + auto configIt = std::find_if( + retrievedPortConfigs.begin(), retrievedPortConfigs.end(), + [&portConfigId](const auto& retrConf) { return retrConf.id == portConfigId; }); + EXPECT_NE(configIt, retrievedPortConfigs.end()) + << "Port config id returned by setAudioPortConfig: " << portConfigId + << " is not found in the list returned by getPortConfigsForMixPorts"; + if (configIt != retrievedPortConfigs.end()) { + EXPECT_EQ(portConfig.get(), *configIt) + << "Port config returned by getPortConfigsForMixPorts: " << configIt->toString() + << " is not the same as returned by setAudioPortConfig: " + << portConfig.get().toString(); + } + } +} + +TEST_P(AudioCoreModule, SetAudioPortConfigInvalidPortId) { + std::set portIds; + ASSERT_NO_FATAL_FAILURE(GetAllPortIds(&portIds)); + for (const auto portId : getNonExistentIds(portIds)) { + AudioPortConfig portConfig, suggestedConfig; + bool applied; + portConfig.portId = portId; + Status status = module->setAudioPortConfig(portConfig, &suggestedConfig, &applied); + EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + << status << " returned for port ID " << portId; + EXPECT_FALSE(suggestedConfig.format.has_value()); + EXPECT_FALSE(suggestedConfig.channelMask.has_value()); + EXPECT_FALSE(suggestedConfig.sampleRate.has_value()); + } +} + +TEST_P(AudioCoreModule, SetAudioPortConfigInvalidPortConfigId) { + std::set portConfigIds; + ASSERT_NO_FATAL_FAILURE(GetAllPortConfigIds(&portConfigIds)); + for (const auto portConfigId : getNonExistentIds(portConfigIds)) { + AudioPortConfig portConfig, suggestedConfig; + bool applied; + portConfig.id = portConfigId; + Status status = module->setAudioPortConfig(portConfig, &suggestedConfig, &applied); + EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + << status << " returned for port config ID " << portConfigId; + EXPECT_FALSE(suggestedConfig.format.has_value()); + EXPECT_FALSE(suggestedConfig.channelMask.has_value()); + EXPECT_FALSE(suggestedConfig.sampleRate.has_value()); + } +} + +template +class AudioStream : public AudioCoreModule { + public: + static std::string direction(bool capitalize); + + void SetUp() override { + ASSERT_NO_FATAL_FAILURE(AudioCoreModule::SetUp()); + ASSERT_NO_FATAL_FAILURE(SetUpModuleConfig()); + } + + void CloseTwice() { + const auto portConfig = moduleConfig->getSingleConfigForMixPort(IsInput()); + if (!portConfig.has_value()) { + GTEST_SKIP() << "No mix port for attached devices"; + } + sp heldStream; + { + WithStream stream(portConfig.value()); + ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get())); + heldStream = stream.get(); + } + Status status = heldStream->close(); + EXPECT_EQ(Status::EX_ILLEGAL_STATE, status.exceptionCode()) + << status << " when closing the stream twice"; + } + + void OpenAllConfigs() { + const auto allPortConfigs = moduleConfig->getPortConfigsForMixPorts(IsInput()); + for (const auto& portConfig : allPortConfigs) { + WithStream stream(portConfig); + ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get())); + } + } + + void OpenOverMaxCount() { + constexpr bool isInput = IsInput(); + auto ports = moduleConfig->getMixPorts(isInput); + bool hasSingleRun = false; + for (const auto& port : ports) { + const size_t maxStreamCount = port.ext.get().maxOpenStreamCount; + if (maxStreamCount == 0 || + moduleConfig->getAttachedDevicesPortsForMixPort(isInput, port).empty()) { + // No restrictions or no permanently attached devices. + continue; + } + auto portConfigs = moduleConfig->getPortConfigsForMixPorts(isInput, port); + if (portConfigs.size() < maxStreamCount + 1) { + // Not able to open a sufficient number of streams for this port. + continue; + } + hasSingleRun = true; + std::optional> streamWraps[maxStreamCount + 1]; + for (size_t i = 0; i <= maxStreamCount; ++i) { + streamWraps[i].emplace(portConfigs[i]); + WithStream& stream = streamWraps[i].value(); + if (i < maxStreamCount) { + ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get())); + } else { + ASSERT_NO_FATAL_FAILURE(stream.SetUpPortConfig(module.get())); + Status status = stream.SetUpNoChecks(module.get()); + EXPECT_EQ(Status::EX_ILLEGAL_STATE, status.exceptionCode()) + << status << " open" << direction(true) + << "Stream" + " returned for port config ID " + << stream.getPortId() << ", maxOpenStreamCount is " << maxStreamCount; + } + } + } + if (!hasSingleRun) { + GTEST_SKIP() << "Not enough " << direction(false) + << " ports to test max open stream count"; + } + } + + void OpenInvalidDirection() { + // Important! The direction of the port config must be reversed. + const auto portConfig = moduleConfig->getSingleConfigForMixPort(!IsInput()); + if (!portConfig.has_value()) { + GTEST_SKIP() << "No mix port for attached devices"; + } + WithStream stream(portConfig.value()); + ASSERT_NO_FATAL_FAILURE(stream.SetUpPortConfig(module.get())); + Status status = stream.SetUpNoChecks(module.get()); + EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + << status << " open" << direction(true) << "Stream returned for port config ID " + << stream.getPortId(); + EXPECT_EQ(nullptr, stream.get()); + } + + void OpenTwiceSamePortConfig() { + const auto portConfig = moduleConfig->getSingleConfigForMixPort(IsInput()); + if (!portConfig.has_value()) { + GTEST_SKIP() << "No mix port for attached devices"; + } + EXPECT_NO_FATAL_FAILURE(OpenTwiceSamePortConfigImpl(portConfig.value())); + } + + void ResetPortConfigWithOpenStream() { + const auto portConfig = moduleConfig->getSingleConfigForMixPort(IsInput()); + if (!portConfig.has_value()) { + GTEST_SKIP() << "No mix port for attached devices"; + } + WithStream stream(portConfig.value()); + ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get())); + Status status = module->resetAudioPortConfig(stream.getPortId()); + EXPECT_EQ(Status::EX_ILLEGAL_STATE, status.exceptionCode()) + << status << " returned for port config ID " << stream.getPortId(); + } + + void OpenTwiceSamePortConfigImpl(const AudioPortConfig& portConfig) { + WithStream stream1(portConfig); + ASSERT_NO_FATAL_FAILURE(stream1.SetUp(module.get())); + WithStream stream2; + Status status = stream2.SetUpNoChecks(module.get(), stream1.getPortConfig()); + EXPECT_EQ(Status::EX_ILLEGAL_STATE, status.exceptionCode()) + << status << " when opening " << direction(false) + << " stream twice for the same port config ID " << stream1.getPortId(); + } +}; +using AudioStreamIn = AudioStream; +using AudioStreamOut = AudioStream; + +template <> +std::string AudioStreamIn::direction(bool capitalize) { + return capitalize ? "Input" : "input"; +} +template <> +std::string AudioStreamOut::direction(bool capitalize) { + return capitalize ? "Output" : "output"; +} + +#define TEST_IO_STREAM(method_name) \ + TEST_P(AudioStreamIn, method_name) { ASSERT_NO_FATAL_FAILURE(method_name()); } \ + TEST_P(AudioStreamOut, method_name) { ASSERT_NO_FATAL_FAILURE(method_name()); } + +TEST_IO_STREAM(CloseTwice); +TEST_IO_STREAM(OpenAllConfigs); +TEST_IO_STREAM(OpenInvalidDirection); +TEST_IO_STREAM(OpenOverMaxCount); +TEST_IO_STREAM(OpenTwiceSamePortConfig); +TEST_IO_STREAM(ResetPortConfigWithOpenStream); + +TEST_P(AudioStreamOut, OpenTwicePrimary) { + const auto mixPorts = moduleConfig->getMixPorts(false); + auto primaryPortIt = std::find_if(mixPorts.begin(), mixPorts.end(), [](const AudioPort& port) { + constexpr int primaryOutputFlag = 1 << static_cast(AudioOutputFlags::PRIMARY); + return port.flags.getTag() == AudioIoFlags::Tag::output && + ((port.flags.get() & primaryOutputFlag) != 0); + }); + if (primaryPortIt == mixPorts.end()) { + GTEST_SKIP() << "No primary mix port"; + } + if (moduleConfig->getAttachedSinkDevicesPortsForMixPort(*primaryPortIt).empty()) { + GTEST_SKIP() << "Primary mix port can not be routed to any of attached devices"; + } + const auto portConfig = moduleConfig->getSingleConfigForMixPort(false, *primaryPortIt); + ASSERT_TRUE(portConfig.has_value()) << "No profiles specified for the primary mix port"; + EXPECT_NO_FATAL_FAILURE(OpenTwiceSamePortConfigImpl(portConfig.value())); +} + +// Tests specific to audio patches. The fixure class is named 'AudioModulePatch' +// to avoid clashing with 'AudioPatch' class. +class AudioModulePatch : public AudioCoreModule { + public: + static std::string direction(bool isInput, bool capitalize) { + return isInput ? (capitalize ? "Input" : "input") : (capitalize ? "Output" : "output"); + } + + void SetUp() override { + ASSERT_NO_FATAL_FAILURE(AudioCoreModule::SetUp()); + ASSERT_NO_FATAL_FAILURE(SetUpModuleConfig()); + } + + void SetInvalidPatchHelper(int32_t expectedException, const std::vector& sources, + const std::vector& sinks) { + AudioPatch patch; + patch.sourcePortConfigIds = sources; + patch.sinkPortConfigIds = sinks; + Status status = module->setAudioPatch(patch, &patch); + ASSERT_EQ(expectedException, status.exceptionCode()) + << status << ": patch source ids: " << android::internal::ToString(sources) + << "; sink ids: " << android::internal::ToString(sinks); + } + + void ResetPortConfigUsedByPatch(bool isInput) { + auto srcSinkGroups = moduleConfig->getRoutableSrcSinkGroups(isInput); + if (srcSinkGroups.empty()) { + GTEST_SKIP() << "No routes to any attached " << direction(isInput, false) << " devices"; + } + auto srcSinkGroup = *srcSinkGroups.begin(); + auto srcSink = *srcSinkGroup.second.begin(); + WithAudioPatch patch(srcSink.first, srcSink.second); + ASSERT_NO_FATAL_FAILURE(patch.SetUp(module.get())); + std::vector sourceAndSinkPortConfigIds(patch.get().sourcePortConfigIds); + sourceAndSinkPortConfigIds.insert(sourceAndSinkPortConfigIds.end(), + patch.get().sinkPortConfigIds.begin(), + patch.get().sinkPortConfigIds.end()); + for (const auto portConfigId : sourceAndSinkPortConfigIds) { + Status status = module->resetAudioPortConfig(portConfigId); + EXPECT_EQ(Status::EX_ILLEGAL_STATE, status.exceptionCode()) + << status << " returned for port config ID " << portConfigId; + } + } + + void SetInvalidPatch(bool isInput) { + auto srcSinkPair = moduleConfig->getRoutableSrcSinkPair(isInput); + if (!srcSinkPair.has_value()) { + GTEST_SKIP() << "No routes to any attached " << direction(isInput, false) << " devices"; + } + WithAudioPortConfig srcPortConfig(srcSinkPair.value().first); + ASSERT_NO_FATAL_FAILURE(srcPortConfig.SetUp(module.get())); + WithAudioPortConfig sinkPortConfig(srcSinkPair.value().second); + ASSERT_NO_FATAL_FAILURE(sinkPortConfig.SetUp(module.get())); + { // Check that the pair can actually be used for setting up a patch. + WithAudioPatch patch(srcPortConfig.get(), sinkPortConfig.get()); + ASSERT_NO_FATAL_FAILURE(patch.SetUp(module.get())); + } + EXPECT_NO_FATAL_FAILURE( + SetInvalidPatchHelper(Status::EX_ILLEGAL_ARGUMENT, {}, {sinkPortConfig.getId()})); + EXPECT_NO_FATAL_FAILURE(SetInvalidPatchHelper( + Status::EX_ILLEGAL_ARGUMENT, {srcPortConfig.getId(), srcPortConfig.getId()}, + {sinkPortConfig.getId()})); + EXPECT_NO_FATAL_FAILURE( + SetInvalidPatchHelper(Status::EX_ILLEGAL_ARGUMENT, {srcPortConfig.getId()}, {})); + EXPECT_NO_FATAL_FAILURE( + SetInvalidPatchHelper(Status::EX_ILLEGAL_ARGUMENT, {srcPortConfig.getId()}, + {sinkPortConfig.getId(), sinkPortConfig.getId()})); + + std::set portConfigIds; + ASSERT_NO_FATAL_FAILURE(GetAllPortConfigIds(&portConfigIds)); + for (const auto portConfigId : getNonExistentIds(portConfigIds)) { + EXPECT_NO_FATAL_FAILURE(SetInvalidPatchHelper( + Status::EX_ILLEGAL_ARGUMENT, {portConfigId}, {sinkPortConfig.getId()})); + EXPECT_NO_FATAL_FAILURE(SetInvalidPatchHelper(Status::EX_ILLEGAL_ARGUMENT, + {srcPortConfig.getId()}, {portConfigId})); + } + } + + void SetNonRoutablePatch(bool isInput) { + auto srcSinkPair = moduleConfig->getNonRoutableSrcSinkPair(isInput); + if (!srcSinkPair.has_value()) { + GTEST_SKIP() << "All possible source/sink pairs are routable"; + } + WithAudioPatch patch(srcSinkPair.value().first, srcSinkPair.value().second); + ASSERT_NO_FATAL_FAILURE(patch.SetUpPortConfigs(module.get())); + Status status = patch.SetUpNoChecks(module.get()); + EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + << status << ": when setting up a patch from " + << srcSinkPair.value().first.toString() << " to " + << srcSinkPair.value().second.toString() << " that does not have a route"; + } + + void SetPatch(bool isInput) { + auto srcSinkGroups = moduleConfig->getRoutableSrcSinkGroups(isInput); + if (srcSinkGroups.empty()) { + GTEST_SKIP() << "No routes to any attached " << direction(isInput, false) << " devices"; + } + for (const auto& srcSinkGroup : srcSinkGroups) { + const auto& route = srcSinkGroup.first; + std::vector patches; + for (const auto& srcSink : srcSinkGroup.second) { + if (!route.isExclusive) { + patches.emplace_back(srcSink.first, srcSink.second); + EXPECT_NO_FATAL_FAILURE(patches[patches.size() - 1].SetUp(module.get())); + } else { + WithAudioPatch patch(srcSink.first, srcSink.second); + EXPECT_NO_FATAL_FAILURE(patch.SetUp(module.get())); + } + } + } + } + + void UpdatePatch(bool isInput) { + auto srcSinkGroups = moduleConfig->getRoutableSrcSinkGroups(isInput); + if (srcSinkGroups.empty()) { + GTEST_SKIP() << "No routes to any attached " << direction(isInput, false) << " devices"; + } + for (const auto& srcSinkGroup : srcSinkGroups) { + for (const auto& srcSink : srcSinkGroup.second) { + WithAudioPatch patch(srcSink.first, srcSink.second); + ASSERT_NO_FATAL_FAILURE(patch.SetUp(module.get())); + AudioPatch ignored; + EXPECT_NO_FATAL_FAILURE(module->setAudioPatch(patch.get(), &ignored)); + } + } + } + + void UpdateInvalidPatchId(bool isInput) { + auto srcSinkGroups = moduleConfig->getRoutableSrcSinkGroups(isInput); + if (srcSinkGroups.empty()) { + GTEST_SKIP() << "No routes to any attached " << direction(isInput, false) << " devices"; + } + // First, set up a patch to ensure that its settings are accepted. + auto srcSinkGroup = *srcSinkGroups.begin(); + auto srcSink = *srcSinkGroup.second.begin(); + WithAudioPatch patch(srcSink.first, srcSink.second); + ASSERT_NO_FATAL_FAILURE(patch.SetUp(module.get())); + // Then use the same patch setting, except for having an invalid ID. + std::set patchIds; + ASSERT_NO_FATAL_FAILURE(GetAllPatchIds(&patchIds)); + for (const auto patchId : getNonExistentIds(patchIds)) { + AudioPatch patchWithNonExistendId = patch.get(); + patchWithNonExistendId.id = patchId; + Status status = module->setAudioPatch(patchWithNonExistendId, &patchWithNonExistendId); + EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + << status << " returned for patch ID " << patchId; + } + } +}; + +// Not all tests require both directions, so parametrization would require +// more abstractions. +#define TEST_PATCH_BOTH_DIRECTIONS(method_name) \ + TEST_P(AudioModulePatch, method_name##Input) { ASSERT_NO_FATAL_FAILURE(method_name(true)); } \ + TEST_P(AudioModulePatch, method_name##Output) { ASSERT_NO_FATAL_FAILURE(method_name(false)); } + +TEST_PATCH_BOTH_DIRECTIONS(ResetPortConfigUsedByPatch); +TEST_PATCH_BOTH_DIRECTIONS(SetInvalidPatch); +TEST_PATCH_BOTH_DIRECTIONS(SetNonRoutablePatch); +TEST_PATCH_BOTH_DIRECTIONS(SetPatch); +TEST_PATCH_BOTH_DIRECTIONS(UpdateInvalidPatchId); +TEST_PATCH_BOTH_DIRECTIONS(UpdatePatch); + +TEST_P(AudioModulePatch, ResetInvalidPatchId) { + std::set patchIds; + ASSERT_NO_FATAL_FAILURE(GetAllPatchIds(&patchIds)); + for (const auto patchId : getNonExistentIds(patchIds)) { + Status status = module->resetAudioPatch(patchId); + EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + << status << " returned for patch ID " << patchId; + } +} + +INSTANTIATE_TEST_SUITE_P(AudioCoreModuleTest, AudioCoreModule, + testing::ValuesIn(android::getAidlHalInstanceNames(IModule::descriptor)), + android::PrintInstanceNameToString); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioCoreModule); +INSTANTIATE_TEST_SUITE_P(AudioStreamInTest, AudioStreamIn, + testing::ValuesIn(android::getAidlHalInstanceNames(IModule::descriptor)), + android::PrintInstanceNameToString); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioStreamIn); +INSTANTIATE_TEST_SUITE_P(AudioStreamOutTest, AudioStreamOut, + testing::ValuesIn(android::getAidlHalInstanceNames(IModule::descriptor)), + android::PrintInstanceNameToString); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioStreamOut); +INSTANTIATE_TEST_SUITE_P(AudioPatchTest, AudioModulePatch, + testing::ValuesIn(android::getAidlHalInstanceNames(IModule::descriptor)), + android::PrintInstanceNameToString); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioModulePatch); + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + ProcessState::self()->setThreadPoolMaxThreadCount(1); + ProcessState::self()->startThreadPool(); + return RUN_ALL_TESTS(); +} From ee2747826449824e29a464a7c94943cc181511af Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Thu, 11 Nov 2021 20:55:41 +0000 Subject: [PATCH 028/998] audio HAL: Initial AIDL interfaces This adds basic support for enumerating capabilities of an audio module, creation of patches, and opening of I/O streams. Bug: 205884982 Test: atest VtsHalAudioCoreTargetTest Change-Id: Ib1ef13c95d338b6ef1bde7d87dcd675fc1d35e85 --- audio/aidl/Android.bp | 30 ++ .../hardware/audio/core/AudioPatch.aidl | 40 +++ .../hardware/audio/core/AudioRoute.aidl | 40 +++ .../android/hardware/audio/core/IConfig.aidl | 37 +++ .../android/hardware/audio/core/IModule.aidl | 48 +++ .../hardware/audio/core/IStreamIn.aidl | 39 +++ .../hardware/audio/core/IStreamOut.aidl | 39 +++ .../hardware/audio/core/AudioPatch.aidl | 40 +++ .../hardware/audio/core/AudioRoute.aidl | 39 +++ .../android/hardware/audio/core/IConfig.aidl | 24 ++ .../android/hardware/audio/core/IModule.aidl | 281 ++++++++++++++++++ .../hardware/audio/core/IStreamIn.aidl | 46 +++ .../hardware/audio/core/IStreamOut.aidl | 46 +++ 13 files changed, 749 insertions(+) create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/AudioPatch.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/AudioRoute.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IConfig.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamIn.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamOut.aidl create mode 100644 audio/aidl/android/hardware/audio/core/AudioPatch.aidl create mode 100644 audio/aidl/android/hardware/audio/core/AudioRoute.aidl create mode 100644 audio/aidl/android/hardware/audio/core/IConfig.aidl create mode 100644 audio/aidl/android/hardware/audio/core/IModule.aidl create mode 100644 audio/aidl/android/hardware/audio/core/IStreamIn.aidl create mode 100644 audio/aidl/android/hardware/audio/core/IStreamOut.aidl diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index a8846b0ac5..7801914291 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -62,3 +62,33 @@ aidl_interface { versions: [ ], } + +aidl_interface { + name: "android.hardware.audio.core", + vendor_available: true, + srcs: [ + "android/hardware/audio/core/AudioPatch.aidl", + "android/hardware/audio/core/AudioRoute.aidl", + "android/hardware/audio/core/IConfig.aidl", + "android/hardware/audio/core/IModule.aidl", + "android/hardware/audio/core/IStreamIn.aidl", + "android/hardware/audio/core/IStreamOut.aidl", + ], + imports: [ + "android.hardware.audio.common", + "android.media.audio.common.types", + ], + stability: "vintf", + backend: { + java: { + platform_apis: true, + }, + ndk: { + vndk: { + enabled: true, + }, + }, + }, + versions: [ + ], +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/AudioPatch.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/AudioPatch.aidl new file mode 100644 index 0000000000..1cef4cd1ae --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/AudioPatch.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable AudioPatch { + int id; + int[] sourcePortConfigIds; + int[] sinkPortConfigIds; +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/AudioRoute.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/AudioRoute.aidl new file mode 100644 index 0000000000..deeef872d7 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/AudioRoute.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable AudioRoute { + int[] sourcePortIds; + int sinkPortId; + boolean isExclusive; +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IConfig.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IConfig.aidl new file mode 100644 index 0000000000..fd80715064 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IConfig.aidl @@ -0,0 +1,37 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@VintfStability +interface IConfig { +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl new file mode 100644 index 0000000000..33e8290608 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl @@ -0,0 +1,48 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@VintfStability +interface IModule { + android.hardware.audio.core.AudioPatch[] getAudioPatches(); + android.media.audio.common.AudioPort getAudioPort(int portId); + android.media.audio.common.AudioPortConfig[] getAudioPortConfigs(); + android.media.audio.common.AudioPort[] getAudioPorts(); + android.hardware.audio.core.AudioRoute[] getAudioRoutes(); + android.hardware.audio.core.IStreamIn openInputStream(int portConfigId, in android.hardware.audio.common.SinkMetadata sinkMetadata); + android.hardware.audio.core.IStreamOut openOutputStream(int portConfigId, in android.hardware.audio.common.SourceMetadata sourceMetadata, in @nullable android.media.audio.common.AudioOffloadInfo offloadInfo); + android.hardware.audio.core.AudioPatch setAudioPatch(in android.hardware.audio.core.AudioPatch requested); + boolean setAudioPortConfig(in android.media.audio.common.AudioPortConfig requested, out android.media.audio.common.AudioPortConfig suggested); + void resetAudioPatch(int patchId); + void resetAudioPortConfig(int portConfigId); +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamIn.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamIn.aidl new file mode 100644 index 0000000000..d5ab3e8b22 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamIn.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@VintfStability +interface IStreamIn { + void close(); + void updateMetadata(in android.hardware.audio.common.SinkMetadata sinkMetadata); +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamOut.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamOut.aidl new file mode 100644 index 0000000000..3021d94c59 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamOut.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@VintfStability +interface IStreamOut { + void close(); + void updateMetadata(in android.hardware.audio.common.SourceMetadata sourceMetadata); +} diff --git a/audio/aidl/android/hardware/audio/core/AudioPatch.aidl b/audio/aidl/android/hardware/audio/core/AudioPatch.aidl new file mode 100644 index 0000000000..48ca2142f8 --- /dev/null +++ b/audio/aidl/android/hardware/audio/core/AudioPatch.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ + +package android.hardware.audio.core; + +/** + * Audio patch specifies a connection between multiple audio port + * configurations. + */ +@JavaDerive(equals=true, toString=true) +@VintfStability +parcelable AudioPatch { + /** The ID of the patch, unique within the HAL module. */ + int id; + /** + * The list of IDs of source audio port configs ('AudioPortConfig.id'). + * There must be at least one source in a valid patch and all IDs must be + * unique. + */ + int[] sourcePortConfigIds; + /** + * The list of IDs of sink audio port configs ('AudioPortConfig.id'). + * There must be at least one sink in a valid patch and all IDs must be + * unique. + */ + int[] sinkPortConfigIds; +} diff --git a/audio/aidl/android/hardware/audio/core/AudioRoute.aidl b/audio/aidl/android/hardware/audio/core/AudioRoute.aidl new file mode 100644 index 0000000000..1e7b44141e --- /dev/null +++ b/audio/aidl/android/hardware/audio/core/AudioRoute.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ + +package android.hardware.audio.core; + +/** + * Audio route specifies a path from multiple audio source ports to one audio + * sink port. As an example, when emitting audio output, source ports typically + * are mix ports (audio data from the framework), the sink is a device + * port. When acquiring audio, source ports are device ports, the sink is a mix + * port. + */ +@JavaDerive(equals=true, toString=true) +@VintfStability +parcelable AudioRoute { + /** + * The list of IDs of source audio ports ('AudioPort.id'). + * There must be at least one source in a valid route and all IDs must be + * unique. + */ + int[] sourcePortIds; + /** The ID of the sink audio port ('AudioPort.id'). */ + int sinkPortId; + /** If set, only one source can be active, mixing is not supported. */ + boolean isExclusive; +} diff --git a/audio/aidl/android/hardware/audio/core/IConfig.aidl b/audio/aidl/android/hardware/audio/core/IConfig.aidl new file mode 100644 index 0000000000..c7bb414e86 --- /dev/null +++ b/audio/aidl/android/hardware/audio/core/IConfig.aidl @@ -0,0 +1,24 @@ +/* + * 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. + */ + +package android.hardware.audio.core; + +/** + * This interface provides system-wide configuration parameters for audio I/O + * (by "system" here we mean the device running Android). + */ +@VintfStability +interface IConfig {} diff --git a/audio/aidl/android/hardware/audio/core/IModule.aidl b/audio/aidl/android/hardware/audio/core/IModule.aidl new file mode 100644 index 0000000000..d47ea3cf4d --- /dev/null +++ b/audio/aidl/android/hardware/audio/core/IModule.aidl @@ -0,0 +1,281 @@ +/* + * 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. + */ + +package android.hardware.audio.core; + +import android.hardware.audio.common.SinkMetadata; +import android.hardware.audio.common.SourceMetadata; +import android.hardware.audio.core.AudioPatch; +import android.hardware.audio.core.AudioRoute; +import android.hardware.audio.core.IStreamIn; +import android.hardware.audio.core.IStreamOut; +import android.media.audio.common.AudioOffloadInfo; +import android.media.audio.common.AudioPort; +import android.media.audio.common.AudioPortConfig; + +/** + * Each instance of IModule corresponds to a separate audio module. The system + * (the term "system" as used here applies to the entire device running Android) + * may have multiple modules due to the physical architecture, for example, it + * can have multiple DSPs or other audio I/O units which are not interconnected + * in hardware directly. Usually there is at least one audio module which is + * responsible for the "main" (or "built-in") audio functionality of the + * system. Even if the system lacks any physical audio I/O capabilities, there + * will be a "null" audio module. + * + * On a typical mobile phone there is usually a main DSP module which handles + * most of the phone's audio I/O via the built-in speakers and microphones. USB + * audio can exist as a separate module. Some audio modules can be implemented + * purely in software, for example, the remote submix module. + */ +@VintfStability +interface IModule { + /** + * Return all audio patches of this module. + * + * Returns a list of audio patches, that is, established connections between + * audio port configurations. + * + * @return The list of audio patches. + */ + AudioPatch[] getAudioPatches(); + + /** + * Return the current state of the audio port. + * + * Using the port ID provided on input, returns the current state of the + * audio port. For device port representing a connection to some external + * device, e.g. over HDMI or USB, currently supported audio profiles and + * extra audio descriptors may change. + * + * For all other audio ports it must be the same configuration as returned + * for this port ID by 'getAudioPorts'. + * + * @return The current state of an audio port. + * @param portId The ID of the audio port. + * @throws EX_ILLEGAL_ARGUMENT If the port can not be found by the ID. + */ + AudioPort getAudioPort(int portId); + + /** + * Return all active audio port configurations of this module. + * + * Returns a list of active configurations that are currently set for mix + * ports and device ports. Each returned configuration must have an unique + * ID within this module ('AudioPortConfig.id' field), which can coincide + * with an ID of an audio port, if the port only supports a single active + * configuration. Each returned configuration must also have a reference to + * an existing port ('AudioPortConfig.portId' field). All optional + * (nullable) fields of the configurations must be initialized by the HAL + * module. + * + * @return The list of active audio port configurations. + */ + AudioPortConfig[] getAudioPortConfigs(); + + /** + * Return all audio ports provided by this module. + * + * Returns a list of all mix ports and device ports provided by this + * module. Each returned port must have a unique ID within this module + * ('AudioPort.id' field). The returned list must not change during + * the lifetime of the IModule instance. For audio ports with dynamic + * profiles (changing depending on external devices being connected + * to the system) an empty list of profiles must be returned. The list + * of currently supported audio profiles is obtained from 'getAudioPort' + * method. + * + * @return The list of audio ports. + */ + AudioPort[] getAudioPorts(); + + /** + * Return all audio routes of this module. + * + * Returns a list of audio routes, that is, allowed connections between + * audio ports. The returned list must not change during the lifetime of the + * IModule instance. + * + * @return The list of audio routes. + */ + AudioRoute[] getAudioRoutes(); + + /** + * Open an input stream using an existing audio mix port configuration. + * + * The audio port configuration ID must be obtained by calling + * 'setAudioPortConfig' method. Existence of an audio patch involving this + * port configuration is not required for successful opening of a stream. + * + * Only one stream is allowed per audio port configuration. HAL module can + * also set a limit on how many output streams can be opened for a particular + * mix port by using its 'AudioPortMixExt.maxOpenStreamCount' field. + * + * @return An opened input stream. + * @param portConfigId The ID of the audio mix port config. + * @param sinkMetadata Description of the audio that will be recorded. + * @throws EX_ILLEGAL_ARGUMENT In the following cases: + * - If the port config can not be found by the ID. + * - If the port config is not of an input mix port. + * @throws EX_ILLEGAL_STATE In the following cases: + * - If the port config already has a stream opened on it. + * - If the limit on the open stream count for the port has + * been reached. + */ + IStreamIn openInputStream(int portConfigId, in SinkMetadata sinkMetadata); + + /** + * Open an output stream using an existing audio mix port configuration. + * + * The audio port configuration ID must be obtained by calling + * 'setAudioPortConfig' method. Existence of an audio patch involving this + * port configuration is not required for successful opening of a stream. + * + * If the port configuration has 'COMPRESS_OFFLOAD' output flag set, + * the framework must provide additional information about the encoded + * audio stream in 'offloadInfo' argument. + * + * Only one stream is allowed per audio port configuration. HAL module can + * also set a limit on how many output streams can be opened for a particular + * mix port by using its 'AudioPortMixExt.maxOpenStreamCount' field. + * Only one stream can be opened on the audio port with 'PRIMARY' output + * flag. This rule can not be overridden with 'maxOpenStreamCount' field. + * + * @return An opened output stream. + * @param portConfigId The ID of the audio mix port config. + * @param sourceMetadata Description of the audio that will be played. + * @param offloadInfo Additional information for offloaded playback. + * @throws EX_ILLEGAL_ARGUMENT In the following cases: + * - If the port config can not be found by the ID. + * - If the port config is not of an output mix port. + * @throws EX_ILLEGAL_STATE In the following cases: + * - If the port config already has a stream opened on it. + * - If the limit on the open stream count for the port has + * been reached. + * - If another opened stream already exists for the 'PRIMARY' + * output port. + */ + IStreamOut openOutputStream(int portConfigId, in SourceMetadata sourceMetadata, + in @nullable AudioOffloadInfo offloadInfo); + + /** + * Set an audio patch. + * + * This method creates new or updates an existing audio patch. If the + * requested audio patch does not have a specified id, then a new patch is + * created and an ID is allocated for it by the HAL module. Otherwise an + * attempt to update an existing patch is made. It is recommended that + * updating of an existing audio patch should be performed by the HAL module + * in a way that does not interrupt active audio streams involving audio + * port configurations of the patch. If the HAL module is unable to avoid + * interruption when updating a certain patch, it is permitted to allocate a + * new patch ID for the result. The returned audio patch contains all the + * information about the new or updated audio patch. + * + * Audio port configurations specified in the patch must be obtained by + * calling 'setAudioPortConfig' method. There must be an audio route which + * allows connection between the audio ports whose configurations are used. + * An audio patch may be created before or after an audio steam is created + * for this configuration. + * + * @return Resulting audio patch. + * @param requested Requested audio patch. + * @throws EX_ILLEGAL_ARGUMENT In the following cases: + * - If the patch is invalid (see AudioPatch). + * - If a port config can not be found from the specified IDs. + * - If there are no routes satisfying the patch. + * - If an existing patch can not be found by the ID. + * @throws EX_ILLEGAL_STATE In the following cases: + * - If application of the patch can only use a route with an + * exclusive use the sink port, and it is already patched. + * @throws EX_UNSUPPORTED_OPERATION If the patch can not be established because + * the HAL module does not support this otherwise valid + * patch configuration. For example, if it's a patch + * between multiple sources and sinks, and the HAL module + * does not support this. + */ + AudioPatch setAudioPatch(in AudioPatch requested); + + /** + * Set the active configuration of an audio port. + * + * This method is used to create or update an active configuration for a mix + * port or a device port. The port is specified using the + * 'AudioPortConfig.portId' field. If the requested audio port + * configuration does not have a specified id in the 'AudioPortConfig.id' + * field, then a new configuration is created and an ID is allocated for it + * by the HAL module. Otherwise an attempt to update an existing port + * configuration is made. The HAL module returns the resulting audio port + * configuration. Depending on the port and on the capabilities of the HAL + * module, it can either update an existing port configuration (same port + * configuration ID remains), or create a new one. The resulting port + * configuration ID is returned in the 'id' field of the 'suggested' + * argument. + * + * If the specified port configuration can not be set, this method must + * return 'false' and provide its own suggestion in the output + * parameter. The framework can then set the suggested configuration on a + * subsequent retry call to this method. + * + * @return Whether the requested configuration has been applied. + * @param requested Requested audio port configuration. + * @param suggested Same as requested configuration, if it was applied. + * Suggested audio port configuration if the requested + * configuration can't be applied. + * @throws EX_ILLEGAL_ARGUMENT In the following cases: + * - If neither port config ID, nor port ID are specified. + * - If an existing port config can not be found by the ID. + * - If the port can not be found by the port ID. + * - If it is not possible to generate a suggested port + * configuration, for example, if the port only has dynamic + * profiles and they are currently empty. + */ + boolean setAudioPortConfig(in AudioPortConfig requested, out AudioPortConfig suggested); + + /** + * Reset the audio patch. + * + * Resets previously created audio patch using its ID ('AudioPatch.id'). It + * is allowed to reset a patch which uses audio port configurations having + * associated streams. In this case the mix port becomes disconnected from + * the hardware, but the stream does not close. + * + * @param patchId The ID of the audio patch. + * @throws EX_ILLEGAL_ARGUMENT If an existing patch can not be found by the ID. + */ + void resetAudioPatch(int patchId); + + /** + * Reset the audio port configuration. + * + * Resets the specified audio port configuration, discarding all changes + * previously done by the framework. That means, if a call to this method is + * a success, the effect of all previous calls to 'setAudioPortConfig' which + * used or initially have generated the provided 'portConfigId', since the + * module start, or since the last call to this method, has been canceled. + * + * Audio port configurations of mix ports with streams opened on them can + * not be reset. Also can not be reset port configurations currently used by + * any patches. + * + * @param portConfigId The ID of the audio port config. + * @throws EX_ILLEGAL_ARGUMENT If the port config can not be found by the ID. + * @throws EX_ILLEGAL_STATE In the following cases: + * - If the port config has a stream opened on it; + * - If the port config is used by a patch. + */ + void resetAudioPortConfig(int portConfigId); +} diff --git a/audio/aidl/android/hardware/audio/core/IStreamIn.aidl b/audio/aidl/android/hardware/audio/core/IStreamIn.aidl new file mode 100644 index 0000000000..b770449d52 --- /dev/null +++ b/audio/aidl/android/hardware/audio/core/IStreamIn.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ + +package android.hardware.audio.core; + +import android.hardware.audio.common.SinkMetadata; + +/** + * This interface provides means for receiving audio data from input devices. + */ +@VintfStability +interface IStreamIn { + /** + * Close the stream. + * + * Releases any resources allocated for this stream on the HAL module side. + * The stream can not be operated after it has been closed. Methods of this + * interface throw EX_ILLEGAL_STATE in for a closed stream. + * + * @throws EX_ILLEGAL_STATE If the stream has already been closed. + */ + void close(); + + /** + * Update stream metadata. + * + * Updates the metadata initially provided at the stream creation. + * + * @param sinkMetadata Updated metadata. + * @throws EX_ILLEGAL_STATE If the stream is closed. + */ + void updateMetadata(in SinkMetadata sinkMetadata); +} diff --git a/audio/aidl/android/hardware/audio/core/IStreamOut.aidl b/audio/aidl/android/hardware/audio/core/IStreamOut.aidl new file mode 100644 index 0000000000..60212fc891 --- /dev/null +++ b/audio/aidl/android/hardware/audio/core/IStreamOut.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ + +package android.hardware.audio.core; + +import android.hardware.audio.common.SourceMetadata; + +/** + * This interface provides means for sending audio data to output devices. + */ +@VintfStability +interface IStreamOut { + /** + * Close the stream. + * + * Releases any resources allocated for this stream on the HAL module side. + * The stream can not be operated after it has been closed. Methods of this + * interface throw EX_ILLEGAL_STATE in for a closed stream. + * + * @throws EX_ILLEGAL_STATE If the stream has already been closed. + */ + void close(); + + /** + * Update stream metadata. + * + * Updates the metadata initially provided at the stream creation. + * + * @param sourceMetadata Updated metadata. + * @throws EX_ILLEGAL_STATE If the stream is closed. + */ + void updateMetadata(in SourceMetadata sourceMetadata); +} From ecdc6ca8e872a0478fae7d76b1ad4d805b024eed Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Thu, 11 Nov 2021 22:09:22 +0000 Subject: [PATCH 029/998] audio HAL: Minimal example implementation Implements basic functionality for enumerating capabilities of an audio module, audio patches creation, and opening of I/O streams. Bug: 205884982 Test: atest VtsHalAudioCoreTargetTest Change-Id: Ie5d67e9192a598260e762ae9368f99592c8ad97e --- audio/aidl/default/Android.bp | 45 ++ audio/aidl/default/Config.cpp | 19 + audio/aidl/default/Configuration.cpp | 196 +++++++ audio/aidl/default/Module.cpp | 522 ++++++++++++++++++ audio/aidl/default/Stream.cpp | 76 +++ ...oid.hardware.audio.service-aidl.example.rc | 9 + .../android.hardware.audio.service-aidl.xml | 12 + audio/aidl/default/include/core-impl/Config.h | 25 + .../default/include/core-impl/Configuration.h | 40 ++ audio/aidl/default/include/core-impl/Module.h | 72 +++ audio/aidl/default/include/core-impl/Stream.h | 103 ++++ audio/aidl/default/include/core-impl/utils.h | 104 ++++ audio/aidl/default/main.cpp | 45 ++ .../compatibility_matrix.current.xml | 12 + 14 files changed, 1280 insertions(+) create mode 100644 audio/aidl/default/Android.bp create mode 100644 audio/aidl/default/Config.cpp create mode 100644 audio/aidl/default/Configuration.cpp create mode 100644 audio/aidl/default/Module.cpp create mode 100644 audio/aidl/default/Stream.cpp create mode 100644 audio/aidl/default/android.hardware.audio.service-aidl.example.rc create mode 100644 audio/aidl/default/android.hardware.audio.service-aidl.xml create mode 100644 audio/aidl/default/include/core-impl/Config.h create mode 100644 audio/aidl/default/include/core-impl/Configuration.h create mode 100644 audio/aidl/default/include/core-impl/Module.h create mode 100644 audio/aidl/default/include/core-impl/Stream.h create mode 100644 audio/aidl/default/include/core-impl/utils.h create mode 100644 audio/aidl/default/main.cpp diff --git a/audio/aidl/default/Android.bp b/audio/aidl/default/Android.bp new file mode 100644 index 0000000000..0a6fe60c39 --- /dev/null +++ b/audio/aidl/default/Android.bp @@ -0,0 +1,45 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_library_static { + name: "libaudioserviceexampleimpl", + vendor: true, + shared_libs: [ + "libbase", + "libbinder_ndk", + "android.hardware.audio.core-V1-ndk", + ], + export_include_dirs: ["include"], + srcs: [ + "Config.cpp", + "Configuration.cpp", + "Module.cpp", + "Stream.cpp", + ], + visibility: [ + ":__subpackages__", + ], +} + +cc_binary { + name: "android.hardware.audio.service-aidl.example", + relative_install_path: "hw", + init_rc: ["android.hardware.audio.service-aidl.example.rc"], + vintf_fragments: ["android.hardware.audio.service-aidl.xml"], + vendor: true, + shared_libs: [ + "libbase", + "libbinder_ndk", + "android.hardware.audio.core-V1-ndk", + ], + static_libs: [ + "libaudioserviceexampleimpl", + ], + srcs: ["main.cpp"], +} diff --git a/audio/aidl/default/Config.cpp b/audio/aidl/default/Config.cpp new file mode 100644 index 0000000000..3f7a3d3e6f --- /dev/null +++ b/audio/aidl/default/Config.cpp @@ -0,0 +1,19 @@ +/* + * 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. + */ + +#include "core-impl/Config.h" + +namespace aidl::android::hardware::audio::core {} // namespace aidl::android::hardware::audio::core diff --git a/audio/aidl/default/Configuration.cpp b/audio/aidl/default/Configuration.cpp new file mode 100644 index 0000000000..1104caadcf --- /dev/null +++ b/audio/aidl/default/Configuration.cpp @@ -0,0 +1,196 @@ +/* + * 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. + */ + +#include +#include +#include +#include +#include + +#include "aidl/android/media/audio/common/AudioFormatDescription.h" +#include "core-impl/Configuration.h" + +using aidl::android::media::audio::common::AudioChannelLayout; +using aidl::android::media::audio::common::AudioDeviceType; +using aidl::android::media::audio::common::AudioFormatDescription; +using aidl::android::media::audio::common::AudioFormatType; +using aidl::android::media::audio::common::AudioGainConfig; +using aidl::android::media::audio::common::AudioIoFlags; +using aidl::android::media::audio::common::AudioOutputFlags; +using aidl::android::media::audio::common::AudioPort; +using aidl::android::media::audio::common::AudioPortConfig; +using aidl::android::media::audio::common::AudioPortDeviceExt; +using aidl::android::media::audio::common::AudioPortExt; +using aidl::android::media::audio::common::AudioPortMixExt; +using aidl::android::media::audio::common::AudioProfile; +using aidl::android::media::audio::common::Int; +using aidl::android::media::audio::common::PcmType; + +namespace aidl::android::hardware::audio::core::internal { + +static AudioProfile createProfile(PcmType pcmType, const std::vector& channelLayouts, + const std::vector& sampleRates) { + AudioProfile profile; + profile.format.type = AudioFormatType::PCM; + profile.format.pcm = pcmType; + for (auto layout : channelLayouts) { + profile.channelMasks.push_back( + AudioChannelLayout::make(layout)); + } + profile.sampleRates.insert(profile.sampleRates.end(), sampleRates.begin(), sampleRates.end()); + return profile; +} + +static AudioPortExt createDeviceExt(AudioDeviceType devType, int32_t flags) { + AudioPortDeviceExt deviceExt; + deviceExt.device.type.type = devType; + deviceExt.flags = flags; + return AudioPortExt::make(deviceExt); +} + +static AudioPortExt createPortMixExt(int32_t maxOpenStreamCount, int32_t maxActiveStreamCount) { + AudioPortMixExt mixExt; + mixExt.maxOpenStreamCount = maxOpenStreamCount; + mixExt.maxActiveStreamCount = maxActiveStreamCount; + return AudioPortExt::make(mixExt); +} + +static AudioPort createPort(int32_t id, const std::string& name, int32_t flags, bool isInput, + const AudioPortExt& ext) { + AudioPort port; + port.id = id; + port.name = name; + port.flags = isInput ? AudioIoFlags::make(flags) + : AudioIoFlags::make(flags); + port.ext = ext; + return port; +} + +static AudioPortConfig createPortConfig(int32_t id, int32_t portId, PcmType pcmType, int32_t layout, + int32_t sampleRate, int32_t flags, bool isInput, + const AudioPortExt& ext) { + AudioPortConfig config; + config.id = id; + config.portId = portId; + config.sampleRate = Int{.value = sampleRate}; + config.channelMask = AudioChannelLayout::make(layout); + config.format = AudioFormatDescription{.type = AudioFormatType::PCM, .pcm = pcmType}; + config.gain = AudioGainConfig(); + config.flags = isInput ? AudioIoFlags::make(flags) + : AudioIoFlags::make(flags); + config.ext = ext; + return config; +} + +static AudioRoute createRoute(const std::vector& sources, int32_t sink) { + AudioRoute route; + route.sinkPortId = sink; + route.sourcePortIds.insert(route.sourcePortIds.end(), sources.begin(), sources.end()); + return route; +} + +Configuration& getNullPrimaryConfiguration() { + static Configuration configuration = []() { + Configuration c; + + AudioPort nullOutDevice = + createPort(c.nextPortId++, "Null", 0, false, + createDeviceExt(AudioDeviceType::OUT_SPEAKER, + 1 << AudioPortDeviceExt::FLAG_INDEX_DEFAULT_DEVICE)); + c.ports.push_back(nullOutDevice); + + AudioPort primaryOutMix = createPort(c.nextPortId++, "primary output", + 1 << static_cast(AudioOutputFlags::PRIMARY), + false, createPortMixExt(1, 1)); + primaryOutMix.profiles.push_back( + createProfile(PcmType::INT_16_BIT, + {AudioChannelLayout::LAYOUT_MONO, AudioChannelLayout::LAYOUT_STEREO}, + {44100, 48000})); + primaryOutMix.profiles.push_back( + createProfile(PcmType::INT_24_BIT, + {AudioChannelLayout::LAYOUT_MONO, AudioChannelLayout::LAYOUT_STEREO}, + {44100, 48000})); + c.ports.push_back(primaryOutMix); + + c.routes.push_back(createRoute({primaryOutMix.id}, nullOutDevice.id)); + + c.initialConfigs.push_back( + createPortConfig(nullOutDevice.id, nullOutDevice.id, PcmType::INT_24_BIT, + AudioChannelLayout::LAYOUT_STEREO, 48000, 0, false, + createDeviceExt(AudioDeviceType::OUT_SPEAKER, 0))); + + AudioPort loopOutDevice = createPort(c.nextPortId++, "Loopback Out", 0, false, + createDeviceExt(AudioDeviceType::OUT_SUBMIX, 0)); + loopOutDevice.profiles.push_back( + createProfile(PcmType::INT_24_BIT, {AudioChannelLayout::LAYOUT_STEREO}, {48000})); + c.ports.push_back(loopOutDevice); + + AudioPort loopOutMix = + createPort(c.nextPortId++, "loopback output", 0, false, createPortMixExt(0, 0)); + loopOutMix.profiles.push_back( + createProfile(PcmType::INT_24_BIT, {AudioChannelLayout::LAYOUT_STEREO}, {48000})); + c.ports.push_back(loopOutMix); + + c.routes.push_back(createRoute({loopOutMix.id}, loopOutDevice.id)); + + AudioPort zeroInDevice = + createPort(c.nextPortId++, "Zero", 0, true, + createDeviceExt(AudioDeviceType::IN_MICROPHONE, + 1 << AudioPortDeviceExt::FLAG_INDEX_DEFAULT_DEVICE)); + c.ports.push_back(zeroInDevice); + + AudioPort primaryInMix = + createPort(c.nextPortId++, "primary input", 0, true, createPortMixExt(2, 2)); + primaryInMix.profiles.push_back( + createProfile(PcmType::INT_16_BIT, + {AudioChannelLayout::LAYOUT_MONO, AudioChannelLayout::LAYOUT_STEREO, + AudioChannelLayout::LAYOUT_FRONT_BACK}, + {8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000})); + primaryInMix.profiles.push_back( + createProfile(PcmType::INT_24_BIT, + {AudioChannelLayout::LAYOUT_MONO, AudioChannelLayout::LAYOUT_STEREO, + AudioChannelLayout::LAYOUT_FRONT_BACK}, + {8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000})); + c.ports.push_back(primaryInMix); + + c.routes.push_back(createRoute({zeroInDevice.id}, primaryInMix.id)); + + c.initialConfigs.push_back( + createPortConfig(zeroInDevice.id, zeroInDevice.id, PcmType::INT_24_BIT, + AudioChannelLayout::LAYOUT_MONO, 48000, 0, true, + createDeviceExt(AudioDeviceType::IN_MICROPHONE, 0))); + + AudioPort loopInDevice = createPort(c.nextPortId++, "Loopback In", 0, true, + createDeviceExt(AudioDeviceType::IN_SUBMIX, 0)); + loopInDevice.profiles.push_back( + createProfile(PcmType::INT_24_BIT, {AudioChannelLayout::LAYOUT_STEREO}, {48000})); + c.ports.push_back(loopInDevice); + + AudioPort loopInMix = + createPort(c.nextPortId++, "loopback input", 0, true, createPortMixExt(0, 0)); + loopInMix.profiles.push_back( + createProfile(PcmType::INT_24_BIT, {AudioChannelLayout::LAYOUT_STEREO}, {48000})); + c.ports.push_back(loopInMix); + + c.routes.push_back(createRoute({loopInDevice.id}, loopInMix.id)); + + c.portConfigs.insert(c.portConfigs.end(), c.initialConfigs.begin(), c.initialConfigs.end()); + return c; + }(); + return configuration; +} + +} // namespace aidl::android::hardware::audio::core::internal diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp new file mode 100644 index 0000000000..e0a68a5fcd --- /dev/null +++ b/audio/aidl/default/Module.cpp @@ -0,0 +1,522 @@ +/* + * 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. + */ + +#include +#include + +#define LOG_TAG "AHAL_Module" +#define LOG_NDEBUG 0 +#include + +#include + +#include "core-impl/Module.h" +#include "core-impl/utils.h" + +using aidl::android::hardware::audio::common::SinkMetadata; +using aidl::android::hardware::audio::common::SourceMetadata; +using aidl::android::media::audio::common::AudioFormatDescription; +using aidl::android::media::audio::common::AudioIoFlags; +using aidl::android::media::audio::common::AudioOffloadInfo; +using aidl::android::media::audio::common::AudioOutputFlags; +using aidl::android::media::audio::common::AudioPort; +using aidl::android::media::audio::common::AudioPortConfig; +using aidl::android::media::audio::common::AudioPortExt; +using aidl::android::media::audio::common::AudioProfile; +using aidl::android::media::audio::common::Int; + +namespace aidl::android::hardware::audio::core { + +namespace { + +bool generateDefaultPortConfig(const AudioPort& port, AudioPortConfig* config) { + *config = {}; + config->portId = port.id; + if (port.profiles.empty()) { + LOG(ERROR) << __func__ << ": port " << port.id << " has no profiles"; + return false; + } + const auto& profile = port.profiles.begin(); + config->format = profile->format; + if (profile->channelMasks.empty()) { + LOG(ERROR) << __func__ << ": the first profile in port " << port.id + << " has no channel masks"; + return false; + } + config->channelMask = *profile->channelMasks.begin(); + if (profile->sampleRates.empty()) { + LOG(ERROR) << __func__ << ": the first profile in port " << port.id + << " has no sample rates"; + return false; + } + Int sampleRate; + sampleRate.value = *profile->sampleRates.begin(); + config->sampleRate = sampleRate; + config->flags = port.flags; + config->ext = port.ext; + return true; +} + +bool findAudioProfile(const AudioPort& port, const AudioFormatDescription& format, + AudioProfile* profile) { + if (auto profilesIt = + find_if(port.profiles.begin(), port.profiles.end(), + [&format](const auto& profile) { return profile.format == format; }); + profilesIt != port.profiles.end()) { + *profile = *profilesIt; + return true; + } + return false; +} +} // namespace + +void Module::cleanUpPatch(int32_t patchId) { + erase_all_values(mPatches, std::set{patchId}); +} + +void Module::cleanUpPatches(int32_t portConfigId) { + auto& patches = getConfig().patches; + if (patches.size() == 0) return; + auto range = mPatches.equal_range(portConfigId); + for (auto it = range.first; it != range.second; ++it) { + auto patchIt = findById(patches, it->second); + if (patchIt != patches.end()) { + erase_if(patchIt->sourcePortConfigIds, + [portConfigId](auto e) { return e == portConfigId; }); + erase_if(patchIt->sinkPortConfigIds, + [portConfigId](auto e) { return e == portConfigId; }); + } + } + std::set erasedPatches; + for (size_t i = patches.size() - 1; i != 0; --i) { + const auto& patch = patches[i]; + if (patch.sourcePortConfigIds.empty() || patch.sinkPortConfigIds.empty()) { + erasedPatches.insert(patch.id); + patches.erase(patches.begin() + i); + } + } + erase_all_values(mPatches, erasedPatches); +} + +internal::Configuration& Module::getConfig() { + if (!mConfig) { + mConfig.reset(new internal::Configuration(internal::getNullPrimaryConfiguration())); + } + return *mConfig; +} + +void Module::registerPatch(const AudioPatch& patch) { + auto& configs = getConfig().portConfigs; + auto do_insert = [&](const std::vector& portConfigIds) { + for (auto portConfigId : portConfigIds) { + auto configIt = findById(configs, portConfigId); + if (configIt != configs.end()) { + mPatches.insert(std::pair{portConfigId, patch.id}); + if (configIt->portId != portConfigId) { + mPatches.insert(std::pair{configIt->portId, patch.id}); + } + } + }; + }; + do_insert(patch.sourcePortConfigIds); + do_insert(patch.sinkPortConfigIds); +} + +ndk::ScopedAStatus Module::getAudioPatches(std::vector* _aidl_return) { + *_aidl_return = getConfig().patches; + LOG(DEBUG) << __func__ << ": returning " << _aidl_return->size() << " patches"; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Module::getAudioPort(int32_t in_portId, AudioPort* _aidl_return) { + auto& ports = getConfig().ports; + auto portIt = findById(ports, in_portId); + if (portIt != ports.end()) { + *_aidl_return = *portIt; + LOG(DEBUG) << __func__ << ": returning port by id " << in_portId; + return ndk::ScopedAStatus::ok(); + } + LOG(ERROR) << __func__ << ": port id " << in_portId << " not found"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); +} + +ndk::ScopedAStatus Module::getAudioPortConfigs(std::vector* _aidl_return) { + *_aidl_return = getConfig().portConfigs; + LOG(DEBUG) << __func__ << ": returning " << _aidl_return->size() << " port configs"; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Module::getAudioPorts(std::vector* _aidl_return) { + *_aidl_return = getConfig().ports; + LOG(DEBUG) << __func__ << ": returning " << _aidl_return->size() << " ports"; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Module::getAudioRoutes(std::vector* _aidl_return) { + *_aidl_return = getConfig().routes; + LOG(DEBUG) << __func__ << ": returning " << _aidl_return->size() << " routes"; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Module::openInputStream(int32_t in_portConfigId, + const SinkMetadata& in_sinkMetadata, + std::shared_ptr* _aidl_return) { + auto& configs = getConfig().portConfigs; + auto portConfigIt = findById(configs, in_portConfigId); + if (portConfigIt == configs.end()) { + LOG(ERROR) << __func__ << ": existing port config id " << in_portConfigId << " not found"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + const int32_t portId = portConfigIt->portId; + // In our implementation, configs of mix ports always have unique IDs. + CHECK(portId != in_portConfigId); + auto& ports = getConfig().ports; + auto portIt = findById(ports, portId); + if (portIt == ports.end()) { + LOG(ERROR) << __func__ << ": port id " << portId << " used by port config id " + << in_portConfigId << " not found"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (portIt->flags.getTag() != AudioIoFlags::Tag::input || + portIt->ext.getTag() != AudioPortExt::Tag::mix) { + LOG(ERROR) << __func__ << ": port config id " << in_portConfigId + << " does not correspond to an input mix port"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (mStreams.count(in_portConfigId) != 0) { + LOG(ERROR) << __func__ << ": port config id " << in_portConfigId + << " already has a stream opened on it"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } + const int32_t maxOpenStreamCount = portIt->ext.get().maxOpenStreamCount; + if (maxOpenStreamCount != 0 && mStreams.count(portId) >= maxOpenStreamCount) { + LOG(ERROR) << __func__ << ": port id " << portId + << " has already reached maximum allowed opened stream count: " + << maxOpenStreamCount; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } + auto stream = ndk::SharedRefBase::make(in_sinkMetadata); + mStreams.insert(portId, in_portConfigId, StreamWrapper(stream)); + *_aidl_return = std::move(stream); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Module::openOutputStream(int32_t in_portConfigId, + const SourceMetadata& in_sourceMetadata, + const std::optional& in_offloadInfo, + std::shared_ptr* _aidl_return) { + auto& configs = getConfig().portConfigs; + auto portConfigIt = findById(configs, in_portConfigId); + if (portConfigIt == configs.end()) { + LOG(ERROR) << __func__ << ": existing port config id " << in_portConfigId << " not found"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + const int32_t portId = portConfigIt->portId; + // In our implementation, configs of mix ports always have unique IDs. + CHECK(portId != in_portConfigId); + auto& ports = getConfig().ports; + auto portIt = findById(ports, portId); + if (portIt == ports.end()) { + LOG(ERROR) << __func__ << ": port id " << portId << " used by port config id " + << in_portConfigId << " not found"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (portIt->flags.getTag() != AudioIoFlags::Tag::output || + portIt->ext.getTag() != AudioPortExt::Tag::mix) { + LOG(ERROR) << __func__ << ": port config id " << in_portConfigId + << " does not correspond to an output mix port"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (mStreams.count(in_portConfigId) != 0) { + LOG(ERROR) << __func__ << ": port config id " << in_portConfigId + << " already has a stream opened on it"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } + const int32_t maxOpenStreamCount = portIt->ext.get().maxOpenStreamCount; + if (maxOpenStreamCount != 0 && mStreams.count(portId) >= maxOpenStreamCount) { + LOG(ERROR) << __func__ << ": port id " << portId + << " has already reached maximum allowed opened stream count: " + << maxOpenStreamCount; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } + auto stream = ndk::SharedRefBase::make(in_sourceMetadata, in_offloadInfo); + mStreams.insert(portId, in_portConfigId, StreamWrapper(stream)); + *_aidl_return = std::move(stream); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Module::setAudioPatch(const AudioPatch& in_requested, AudioPatch* _aidl_return) { + if (in_requested.sourcePortConfigIds.empty()) { + LOG(ERROR) << __func__ << ": requested patch has empty sources list"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (!all_unique(in_requested.sourcePortConfigIds)) { + LOG(ERROR) << __func__ << ": requested patch has duplicate ids in the sources list"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (in_requested.sinkPortConfigIds.empty()) { + LOG(ERROR) << __func__ << ": requested patch has empty sinks list"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (!all_unique(in_requested.sinkPortConfigIds)) { + LOG(ERROR) << __func__ << ": requested patch has duplicate ids in the sinks list"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + + auto& configs = getConfig().portConfigs; + std::vector missingIds; + auto sources = + selectByIds(configs, in_requested.sourcePortConfigIds, &missingIds); + if (!missingIds.empty()) { + LOG(ERROR) << __func__ << ": following source port config ids not found: " + << ::android::internal::ToString(missingIds); + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + auto sinks = selectByIds(configs, in_requested.sinkPortConfigIds, &missingIds); + if (!missingIds.empty()) { + LOG(ERROR) << __func__ << ": following sink port config ids not found: " + << ::android::internal::ToString(missingIds); + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + // bool indicates whether a non-exclusive route is available. + // If only an exclusive route is available, that means the patch can not be + // established if there is any other patch which currently uses the sink port. + std::map allowedSinkPorts; + auto& routes = getConfig().routes; + for (auto src : sources) { + for (const auto& r : routes) { + const auto& srcs = r.sourcePortIds; + if (std::find(srcs.begin(), srcs.end(), src->portId) != srcs.end()) { + if (!allowedSinkPorts[r.sinkPortId]) { // prefer non-exclusive + allowedSinkPorts[r.sinkPortId] = !r.isExclusive; + } + } + } + } + for (auto sink : sinks) { + if (allowedSinkPorts.count(sink->portId) == 0) { + LOG(ERROR) << __func__ << ": there is no route to the sink port id " << sink->portId; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + } + + auto& patches = getConfig().patches; + auto existing = patches.end(); + std::optional patchesBackup; + if (in_requested.id != 0) { + existing = findById(patches, in_requested.id); + if (existing != patches.end()) { + patchesBackup = mPatches; + cleanUpPatch(existing->id); + } else { + LOG(ERROR) << __func__ << ": not found existing patch id " << in_requested.id; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + } + // Validate the requested patch. + for (const auto& [sinkPortId, nonExclusive] : allowedSinkPorts) { + if (!nonExclusive && mPatches.count(sinkPortId) != 0) { + LOG(ERROR) << __func__ << ": sink port id " << sinkPortId + << "is exclusive and is already used by some other patch"; + if (patchesBackup.has_value()) { + mPatches = std::move(*patchesBackup); + } + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } + } + *_aidl_return = in_requested; + if (existing == patches.end()) { + _aidl_return->id = getConfig().nextPatchId++; + patches.push_back(*_aidl_return); + existing = patches.begin() + (patches.size() - 1); + } else { + *existing = *_aidl_return; + } + registerPatch(*existing); + LOG(DEBUG) << __func__ << ": created or updated patch id " << _aidl_return->id; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Module::setAudioPortConfig(const AudioPortConfig& in_requested, + AudioPortConfig* out_suggested, bool* _aidl_return) { + LOG(DEBUG) << __func__ << ": requested " << in_requested.toString(); + auto& configs = getConfig().portConfigs; + auto existing = configs.end(); + if (in_requested.id != 0) { + if (existing = findById(configs, in_requested.id); + existing == configs.end()) { + LOG(ERROR) << __func__ << ": existing port config id " << in_requested.id + << " not found"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + } + + const int portId = existing != configs.end() ? existing->portId : in_requested.portId; + if (portId == 0) { + LOG(ERROR) << __func__ << ": input port config does not specify portId"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + auto& ports = getConfig().ports; + auto portIt = findById(ports, portId); + if (portIt == ports.end()) { + LOG(ERROR) << __func__ << ": input port config points to non-existent portId " << portId; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (existing != configs.end()) { + *out_suggested = *existing; + } else { + AudioPortConfig newConfig; + if (generateDefaultPortConfig(*portIt, &newConfig)) { + *out_suggested = newConfig; + } else { + LOG(ERROR) << __func__ << ": unable generate a default config for port " << portId; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + } + // From this moment, 'out_suggested' is either an existing port config, + // or a new generated config. Now attempt to update it according to the specified + // fields of 'in_requested'. + + bool requestedIsValid = true, requestedIsFullySpecified = true; + + AudioIoFlags portFlags = portIt->flags; + if (in_requested.flags.has_value()) { + if (in_requested.flags.value() != portFlags) { + LOG(WARNING) << __func__ << ": requested flags " + << in_requested.flags.value().toString() << " do not match port's " + << portId << " flags " << portFlags.toString(); + requestedIsValid = false; + } + } else { + requestedIsFullySpecified = false; + } + + AudioProfile portProfile; + if (in_requested.format.has_value()) { + const auto& format = in_requested.format.value(); + if (findAudioProfile(*portIt, format, &portProfile)) { + out_suggested->format = format; + } else { + LOG(WARNING) << __func__ << ": requested format " << format.toString() + << " is not found in port's " << portId << " profiles"; + requestedIsValid = false; + } + } else { + requestedIsFullySpecified = false; + } + if (!findAudioProfile(*portIt, out_suggested->format.value(), &portProfile)) { + LOG(ERROR) << __func__ << ": port " << portId << " does not support format " + << out_suggested->format.value().toString() << " anymore"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + + if (in_requested.channelMask.has_value()) { + const auto& channelMask = in_requested.channelMask.value(); + if (find(portProfile.channelMasks.begin(), portProfile.channelMasks.end(), channelMask) != + portProfile.channelMasks.end()) { + out_suggested->channelMask = channelMask; + } else { + LOG(WARNING) << __func__ << ": requested channel mask " << channelMask.toString() + << " is not supported for the format " << portProfile.format.toString() + << " by the port " << portId; + requestedIsValid = false; + } + } else { + requestedIsFullySpecified = false; + } + + if (in_requested.sampleRate.has_value()) { + const auto& sampleRate = in_requested.sampleRate.value(); + if (find(portProfile.sampleRates.begin(), portProfile.sampleRates.end(), + sampleRate.value) != portProfile.sampleRates.end()) { + out_suggested->sampleRate = sampleRate; + } else { + LOG(WARNING) << __func__ << ": requested sample rate " << sampleRate.value + << " is not supported for the format " << portProfile.format.toString() + << " by the port " << portId; + requestedIsValid = false; + } + } else { + requestedIsFullySpecified = false; + } + + if (in_requested.gain.has_value()) { + // Let's pretend that gain can always be applied. + out_suggested->gain = in_requested.gain.value(); + } + + if (existing == configs.end() && requestedIsValid && requestedIsFullySpecified) { + out_suggested->id = getConfig().nextPortId++; + configs.push_back(*out_suggested); + *_aidl_return = true; + LOG(DEBUG) << __func__ << ": created new port config " << out_suggested->toString(); + } else if (existing != configs.end() && requestedIsValid) { + *existing = *out_suggested; + *_aidl_return = true; + LOG(DEBUG) << __func__ << ": updated port config " << out_suggested->toString(); + } else { + LOG(DEBUG) << __func__ << ": not applied; existing config ? " << (existing != configs.end()) + << "; requested is valid? " << requestedIsValid << ", fully specified? " + << requestedIsFullySpecified; + *_aidl_return = false; + } + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Module::resetAudioPatch(int32_t in_patchId) { + auto& patches = getConfig().patches; + auto patchIt = findById(patches, in_patchId); + if (patchIt != patches.end()) { + cleanUpPatch(patchIt->id); + patches.erase(patchIt); + LOG(DEBUG) << __func__ << ": erased patch " << in_patchId; + return ndk::ScopedAStatus::ok(); + } + LOG(ERROR) << __func__ << ": patch id " << in_patchId << " not found"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); +} + +ndk::ScopedAStatus Module::resetAudioPortConfig(int32_t in_portConfigId) { + auto& configs = getConfig().portConfigs; + auto configIt = findById(configs, in_portConfigId); + if (configIt != configs.end()) { + if (mStreams.count(in_portConfigId) != 0) { + LOG(ERROR) << __func__ << ": port config id " << in_portConfigId + << " has a stream opened on it"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } + auto patchIt = mPatches.find(in_portConfigId); + if (patchIt != mPatches.end()) { + LOG(ERROR) << __func__ << ": port config id " << in_portConfigId + << " is used by the patch with id " << patchIt->second; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } + auto& initials = getConfig().initialConfigs; + auto initialIt = findById(initials, in_portConfigId); + if (initialIt == initials.end()) { + configs.erase(configIt); + LOG(DEBUG) << __func__ << ": erased port config " << in_portConfigId; + } else if (*configIt != *initialIt) { + *configIt = *initialIt; + LOG(DEBUG) << __func__ << ": reset port config " << in_portConfigId; + } + return ndk::ScopedAStatus::ok(); + } + LOG(ERROR) << __func__ << ": port config id " << in_portConfigId << " not found"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); +} + +} // namespace aidl::android::hardware::audio::core diff --git a/audio/aidl/default/Stream.cpp b/audio/aidl/default/Stream.cpp new file mode 100644 index 0000000000..e16b2c62b9 --- /dev/null +++ b/audio/aidl/default/Stream.cpp @@ -0,0 +1,76 @@ +/* + * 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. + */ + +#define LOG_TAG "AHAL_Stream" +#define LOG_NDEBUG 0 +#include + +#include "core-impl/Stream.h" + +using aidl::android::hardware::audio::common::SinkMetadata; +using aidl::android::hardware::audio::common::SourceMetadata; +using aidl::android::media::audio::common::AudioOffloadInfo; + +namespace aidl::android::hardware::audio::core { + +StreamIn::StreamIn(const SinkMetadata& sinkMetadata) : mMetadata(sinkMetadata) {} + +ndk::ScopedAStatus StreamIn::close() { + LOG(DEBUG) << __func__; + if (!mIsClosed) { + mIsClosed = true; + return ndk::ScopedAStatus::ok(); + } else { + LOG(ERROR) << __func__ << ": stream was already closed"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } +} + +ndk::ScopedAStatus StreamIn::updateMetadata(const SinkMetadata& in_sinkMetadata) { + LOG(DEBUG) << __func__; + if (!mIsClosed) { + mMetadata = in_sinkMetadata; + return ndk::ScopedAStatus::ok(); + } + LOG(ERROR) << __func__ << ": stream was closed"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); +} + +StreamOut::StreamOut(const SourceMetadata& sourceMetadata, + const std::optional& offloadInfo) + : mMetadata(sourceMetadata), mOffloadInfo(offloadInfo) {} + +ndk::ScopedAStatus StreamOut::close() { + LOG(DEBUG) << __func__; + if (!mIsClosed) { + mIsClosed = true; + return ndk::ScopedAStatus::ok(); + } + LOG(ERROR) << __func__ << ": stream was already closed"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); +} + +ndk::ScopedAStatus StreamOut::updateMetadata(const SourceMetadata& in_sourceMetadata) { + LOG(DEBUG) << __func__; + if (!mIsClosed) { + mMetadata = in_sourceMetadata; + return ndk::ScopedAStatus::ok(); + } + LOG(ERROR) << __func__ << ": stream was closed"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); +} + +} // namespace aidl::android::hardware::audio::core diff --git a/audio/aidl/default/android.hardware.audio.service-aidl.example.rc b/audio/aidl/default/android.hardware.audio.service-aidl.example.rc new file mode 100644 index 0000000000..02a9c37d42 --- /dev/null +++ b/audio/aidl/default/android.hardware.audio.service-aidl.example.rc @@ -0,0 +1,9 @@ +service vendor.audio-hal-aidl /vendor/bin/hw/android.hardware.audio.service-aidl.example + class hal + user audioserver + # media gid needed for /dev/fm (radio) and for /data/misc/media (tee) + group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct wakelock context_hub + capabilities BLOCK_SUSPEND + ioprio rt 4 + task_profiles ProcessCapacityHigh HighPerformance + onrestart restart audioserver diff --git a/audio/aidl/default/android.hardware.audio.service-aidl.xml b/audio/aidl/default/android.hardware.audio.service-aidl.xml new file mode 100644 index 0000000000..bb4b01a737 --- /dev/null +++ b/audio/aidl/default/android.hardware.audio.service-aidl.xml @@ -0,0 +1,12 @@ + + + android.hardware.audio.core + 1 + IModule/default + + + android.hardware.audio.core + 1 + IConfig/default + + diff --git a/audio/aidl/default/include/core-impl/Config.h b/audio/aidl/default/include/core-impl/Config.h new file mode 100644 index 0000000000..b62a14be4d --- /dev/null +++ b/audio/aidl/default/include/core-impl/Config.h @@ -0,0 +1,25 @@ +/* + * 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. + */ + +#pragma once + +#include + +namespace aidl::android::hardware::audio::core { + +class Config : public BnConfig {}; + +} // namespace aidl::android::hardware::audio::core diff --git a/audio/aidl/default/include/core-impl/Configuration.h b/audio/aidl/default/include/core-impl/Configuration.h new file mode 100644 index 0000000000..17e342d80a --- /dev/null +++ b/audio/aidl/default/include/core-impl/Configuration.h @@ -0,0 +1,40 @@ +/* + * 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. + */ + +#pragma once + +#include + +#include +#include +#include +#include + +namespace aidl::android::hardware::audio::core::internal { + +struct Configuration { + std::vector<::aidl::android::media::audio::common::AudioPort> ports; + std::vector<::aidl::android::media::audio::common::AudioPortConfig> portConfigs; + std::vector<::aidl::android::media::audio::common::AudioPortConfig> initialConfigs; + std::vector routes; + std::vector patches; + int32_t nextPortId = 1; + int32_t nextPatchId = 1; +}; + +Configuration& getNullPrimaryConfiguration(); + +} // namespace aidl::android::hardware::audio::core::internal diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h new file mode 100644 index 0000000000..359626cc22 --- /dev/null +++ b/audio/aidl/default/include/core-impl/Module.h @@ -0,0 +1,72 @@ +/* + * 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. + */ + +#pragma once + +#include +#include + +#include + +#include "core-impl/Configuration.h" +#include "core-impl/Stream.h" + +namespace aidl::android::hardware::audio::core { + +class Module : public BnModule { + ndk::ScopedAStatus getAudioPatches(std::vector* _aidl_return) override; + ndk::ScopedAStatus getAudioPort( + int32_t in_portId, + ::aidl::android::media::audio::common::AudioPort* _aidl_return) override; + ndk::ScopedAStatus getAudioPortConfigs( + std::vector<::aidl::android::media::audio::common::AudioPortConfig>* _aidl_return) + override; + ndk::ScopedAStatus getAudioPorts( + std::vector<::aidl::android::media::audio::common::AudioPort>* _aidl_return) override; + ndk::ScopedAStatus getAudioRoutes(std::vector* _aidl_return) override; + ndk::ScopedAStatus openInputStream( + int32_t in_portConfigId, + const ::aidl::android::hardware::audio::common::SinkMetadata& in_sinkMetadata, + std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus openOutputStream( + int32_t in_portConfigId, + const ::aidl::android::hardware::audio::common::SourceMetadata& in_sourceMetadata, + const std::optional<::aidl::android::media::audio::common::AudioOffloadInfo>& + in_offloadInfo, + std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus setAudioPatch(const AudioPatch& in_requested, + AudioPatch* _aidl_return) override; + ndk::ScopedAStatus setAudioPortConfig( + const ::aidl::android::media::audio::common::AudioPortConfig& in_requested, + ::aidl::android::media::audio::common::AudioPortConfig* out_suggested, + bool* _aidl_return) override; + ndk::ScopedAStatus resetAudioPatch(int32_t in_patchId) override; + ndk::ScopedAStatus resetAudioPortConfig(int32_t in_portConfigId) override; + + private: + void cleanUpPatch(int32_t patchId); + void cleanUpPatches(int32_t portConfigId); + internal::Configuration& getConfig(); + void registerPatch(const AudioPatch& patch); + + std::unique_ptr mConfig; + Streams mStreams; + // Maps port ids and port config ids to patch ids. + // Multimap because both ports and configs can be used by multiple patches. + std::multimap mPatches; +}; + +} // namespace aidl::android::hardware::audio::core diff --git a/audio/aidl/default/include/core-impl/Stream.h b/audio/aidl/default/include/core-impl/Stream.h new file mode 100644 index 0000000000..87104dd1c1 --- /dev/null +++ b/audio/aidl/default/include/core-impl/Stream.h @@ -0,0 +1,103 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "core-impl/utils.h" + +namespace aidl::android::hardware::audio::core { + +class StreamIn : public BnStreamIn { + ndk::ScopedAStatus close() override; + ndk::ScopedAStatus updateMetadata( + const ::aidl::android::hardware::audio::common::SinkMetadata& in_sinkMetadata) override; + + public: + explicit StreamIn(const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata); + bool isClosed() const { return mIsClosed; } + + private: + ::aidl::android::hardware::audio::common::SinkMetadata mMetadata; + bool mIsClosed = false; +}; + +class StreamOut : public BnStreamOut { + ndk::ScopedAStatus close() override; + ndk::ScopedAStatus updateMetadata( + const ::aidl::android::hardware::audio::common::SourceMetadata& in_sourceMetadata) + override; + + public: + StreamOut(const ::aidl::android::hardware::audio::common::SourceMetadata& sourceMetadata, + const std::optional<::aidl::android::media::audio::common::AudioOffloadInfo>& + offloadInfo); + bool isClosed() const { return mIsClosed; } + + private: + ::aidl::android::hardware::audio::common::SourceMetadata mMetadata; + std::optional<::aidl::android::media::audio::common::AudioOffloadInfo> mOffloadInfo; + bool mIsClosed = false; +}; + +class StreamWrapper { + public: + explicit StreamWrapper(std::shared_ptr streamIn) : mStream(streamIn) {} + explicit StreamWrapper(std::shared_ptr streamOut) : mStream(streamOut) {} + bool isStreamOpen() const { + return std::visit( + [](auto&& ws) -> bool { + auto s = ws.lock(); + return s && !s->isClosed(); + }, + mStream); + } + + private: + std::variant, std::weak_ptr> mStream; +}; + +class Streams { + public: + Streams() = default; + Streams(const Streams&) = delete; + Streams& operator=(const Streams&) = delete; + size_t count(int32_t id) { + // Streams do not remove themselves from the collection on close. + erase_if(mStreams, [](const auto& pair) { return !pair.second.isStreamOpen(); }); + return mStreams.count(id); + } + void insert(int32_t portId, int32_t portConfigId, StreamWrapper sw) { + mStreams.insert(std::pair{portConfigId, sw}); + mStreams.insert(std::pair{portId, sw}); + } + + private: + // Maps port ids and port config ids to streams. Multimap because a port + // (not port config) can have multiple streams opened on it. + std::multimap mStreams; +}; + +} // namespace aidl::android::hardware::audio::core diff --git a/audio/aidl/default/include/core-impl/utils.h b/audio/aidl/default/include/core-impl/utils.h new file mode 100644 index 0000000000..7101012639 --- /dev/null +++ b/audio/aidl/default/include/core-impl/utils.h @@ -0,0 +1,104 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include + +namespace aidl::android::hardware::audio::core { + +// Return whether all the elements in the vector are unique. +template +bool all_unique(const std::vector& v) { + return std::set(v.begin(), v.end()).size() == v.size(); +} + +// Erase all the specified elements from a map. +template +auto erase_all(C& c, const V& keys) { + auto oldSize = c.size(); + for (auto& k : keys) { + c.erase(k); + } + return oldSize - c.size(); +} + +// Erase all the elements in the map that satisfy the provided predicate. +template +auto erase_if(C& c, P pred) { + auto oldSize = c.size(); + for (auto it = c.begin(), last = c.end(); it != last;) { + if (pred(*it)) { + it = c.erase(it); + } else { + ++it; + } + } + return oldSize - c.size(); +} + +// Erase all the elements in the map that have specified values. +template +auto erase_all_values(C& c, const V& values) { + return erase_if(c, [values](const auto& pair) { return values.count(pair.second) != 0; }); +} + +// Return non-zero count of elements for any of the provided keys. +template +size_t count_any(const M& m, const V& keys) { + for (auto& k : keys) { + if (size_t c = m.count(k); c != 0) return c; + } + return 0; +} + +// Assuming that M is a map whose values have an 'id' field, +// find an element with the specified id. +template +auto findById(M& m, int32_t id) { + return std::find_if(m.begin(), m.end(), [&](const auto& p) { return p.second.id == id; }); +} + +// Assuming that the vector contains elements with an 'id' field, +// find an element with the specified id. +template +auto findById(std::vector& v, int32_t id) { + return std::find_if(v.begin(), v.end(), [&](const auto& e) { return e.id == id; }); +} + +// Return elements from the vector that have specified ids, also +// optionally return which ids were not found. +template +std::vector selectByIds(std::vector& v, const std::vector& ids, + std::vector* missingIds = nullptr) { + std::vector result; + std::set idsSet(ids.begin(), ids.end()); + for (size_t i = 0; i < v.size(); ++i) { + T& e = v[i]; + if (idsSet.count(e.id) != 0) { + result.push_back(&v[i]); + idsSet.erase(e.id); + } + } + if (missingIds) { + *missingIds = std::vector(idsSet.begin(), idsSet.end()); + } + return result; +} + +} // namespace aidl::android::hardware::audio::core diff --git a/audio/aidl/default/main.cpp b/audio/aidl/default/main.cpp new file mode 100644 index 0000000000..0de6047f6e --- /dev/null +++ b/audio/aidl/default/main.cpp @@ -0,0 +1,45 @@ +/* + * 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. + */ + +#include "core-impl/Config.h" +#include "core-impl/Module.h" + +#include +#include +#include + +using aidl::android::hardware::audio::core::Config; +using aidl::android::hardware::audio::core::Module; + +int main() { + ABinderProcess_setThreadPoolMaxThreadCount(16); + + // make the default config service + auto config = ndk::SharedRefBase::make(); + const std::string configName = std::string() + Config::descriptor + "/default"; + binder_status_t status = + AServiceManager_addService(config->asBinder().get(), configName.c_str()); + CHECK(status == STATUS_OK); + + // make the default module + auto moduleDefault = ndk::SharedRefBase::make(); + const std::string moduleDefaultName = std::string() + Module::descriptor + "/default"; + status = AServiceManager_addService(moduleDefault->asBinder().get(), moduleDefaultName.c_str()); + CHECK(status == STATUS_OK); + + ABinderProcess_joinThreadPool(); + return EXIT_FAILURE; // should not reach +} diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 8b3830a373..ff84558a55 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -25,6 +25,18 @@ default + + android.hardware.audio.core + 1 + + IModule + default + + + IConfig + default + + android.hardware.authsecret 1 From 10afb4ad5ad46b03100d2d7bee42b0bbd6623177 Mon Sep 17 00:00:00 2001 From: Suren Baghdasaryan Date: Thu, 24 Mar 2022 17:09:16 +0000 Subject: [PATCH 030/998] Replace writepid with task_profiles command for cgroup migration writepid command usage to join a cgroup has been deprecated in favor of a more flexible approach using task_profiles. This way cgroup path is not hardcoded and cgroup changes can be easily made. Replace writepid with task_profiles command to migrate between cgroups. Bug: 191283136 Test: build and boot Signed-off-by: Suren Baghdasaryan Change-Id: I23dab5cbd92dd51b600b7c7879f94ad1f5707208 --- tv/tuner/aidl/default/tuner-default.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tv/tuner/aidl/default/tuner-default.rc b/tv/tuner/aidl/default/tuner-default.rc index d0248c2216..661c219ffa 100644 --- a/tv/tuner/aidl/default/tuner-default.rc +++ b/tv/tuner/aidl/default/tuner-default.rc @@ -3,5 +3,5 @@ service vendor.tuner-default /vendor/bin/hw/android.hardware.tv.tuner-service.ex user media group mediadrm drmrpc ioprio rt 4 - writepid /dev/cpuset/foreground/tasks + task_profiles ProcessCapacityHigh onrestart restart media.tuner From cc489264afe295ffe9e01cf97d9bf43e690f7d84 Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Mon, 28 Mar 2022 14:47:15 +0900 Subject: [PATCH 031/998] Explicitly depend on audio.common-V1 Background: android.hardware.audio.common was frozen in the upstream tm-dev. Previously, the interface had only V1 (as the in-development version) and it was in the VNDK. However, after the freeze, it will have V1 and V2, and only V1 will remain in the VNDK, because we can't have multiple versions of the same AIDL interface in VNDK (it's just waste of memory). android.hardware.audio.core is a new AIDL interface that doesn't exist in TM. It is also a member of VNDK and imports the audio.common interface. So far, the import has been done without an explicit version number (i.e. `imports: ["android.hardware.audio.common"]`). As a result, V1 was imported before the freeze, and V2 (the latest) will be imported after the freeze. Problem: audio.core depending on audio.common-V2 is NOT allowed since the former is a member of VNDK, but the latter isn't. VNDK should form a closure. We are actually hitting this: ``` > error: hardware/interfaces/audio/aidl/Android.bp:71:1: module "android.hardware.audio.core-V1-ndk" variant "android_vendor.Tiramisu_arm64_armv8-a_static" (created by module "android.hardware.audio.core-V1-ndk-generator" (created by module "android.hardware.audio.core_interface")): (native:vendor:vndk) should not link to "android.hardware.audio.common-V2-ndk" (native:vendor): VNDK-core must only depend on VNDK-core or VNDK-SP ``` To fix this, make the dependency to audio.common to be explicit about the version. This change can't be uploaded to tm-dev as audio.core doesn't exist there, and must be submitted before the AIDL APIs are frozen there. Bug: 225941299 Test: m Change-Id: Iadc96d558d5c7431b0a2b0cbd28b99319a24ee44 --- audio/aidl/Android.bp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index 7801914291..64a2c9d327 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -75,7 +75,7 @@ aidl_interface { "android/hardware/audio/core/IStreamOut.aidl", ], imports: [ - "android.hardware.audio.common", + "android.hardware.audio.common-V1", "android.media.audio.common.types", ], stability: "vintf", From 0accdbab729f57657a0ccfe993555266a65a7d63 Mon Sep 17 00:00:00 2001 From: Alec Mouri Date: Thu, 24 Mar 2022 20:05:25 +0000 Subject: [PATCH 032/998] Update renderengine dependency to VTS Bug: 218954037 Test: builds Change-Id: I31f8a8764fa66a9aec4762354c425ba1442ef351 --- graphics/composer/2.2/utils/vts/Android.bp | 1 + graphics/composer/2.2/vts/functional/Android.bp | 1 + 2 files changed, 2 insertions(+) diff --git a/graphics/composer/2.2/utils/vts/Android.bp b/graphics/composer/2.2/utils/vts/Android.bp index 4faf84bcdd..aa8e541edb 100644 --- a/graphics/composer/2.2/utils/vts/Android.bp +++ b/graphics/composer/2.2/utils/vts/Android.bp @@ -37,6 +37,7 @@ cc_library_static { static_libs: [ "android.hardware.graphics.composer@2.1-vts", "android.hardware.graphics.composer@2.2", + "android.hardware.graphics.composer3-V1-ndk", "android.hardware.graphics.mapper@2.1-vts", "libarect", "libgtest", diff --git a/graphics/composer/2.2/vts/functional/Android.bp b/graphics/composer/2.2/vts/functional/Android.bp index 7af0fb4724..dd519e7e6e 100644 --- a/graphics/composer/2.2/vts/functional/Android.bp +++ b/graphics/composer/2.2/vts/functional/Android.bp @@ -65,6 +65,7 @@ cc_test { "android.hardware.graphics.composer@2.1-vts", "android.hardware.graphics.composer@2.2", "android.hardware.graphics.composer@2.2-vts", + "android.hardware.graphics.composer3-V1-ndk", "android.hardware.graphics.mapper@2.0-vts", "android.hardware.graphics.mapper@2.1-vts", "android.hardware.graphics.mapper@3.0-vts", From fccd300be6370ebcf07bb6457e8f97161cc56096 Mon Sep 17 00:00:00 2001 From: Nishtha Ahuja Date: Thu, 24 Mar 2022 02:42:47 +0000 Subject: [PATCH 033/998] Add value for FUEL_VOLUME_DISPLAY_UNITS in default config. Fix: 221916124 Test: Tested manually in KitchenSink app Change-Id: I8c0bf768210037f655d76848d8b4aadf047838f3 --- .../aidl/impl/default_config/include/DefaultConfig.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index 6ecac704f4..f0387f8e01 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -386,6 +386,15 @@ const std::vector kVehicleProperties = { }, .initialValue = {.int32Values = {0}}}, + {.config = + { + .prop = toInt(VehicleProperty::FUEL_VOLUME_DISPLAY_UNITS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {(int)VehicleUnit::LITER, (int)VehicleUnit::US_GALLON}, + }, + .initialValue = {.int32Values = {(int)VehicleUnit::LITER}}}, + {.config = { .prop = toInt(VehicleProperty::HW_KEY_INPUT), From 63534553f5f51ca066b1e4f2bd7a93b3a04c6061 Mon Sep 17 00:00:00 2001 From: Nishtha Ahuja Date: Fri, 25 Mar 2022 18:14:29 +0000 Subject: [PATCH 034/998] Add value for FUEL_VOLUME_DISPLAY_UNITS in old default config for backward compatibility. Fix: 221916124 Test: Tested manually in KitchenSink app Change-Id: I656215c51e8b5ac897f247d462fbe57f31e954f4 --- .../vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h | 9 +++++++++ .../impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h index cfbbbd3224..9edd2bd491 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h @@ -372,6 +372,15 @@ const ConfigDeclaration kVehicleProperties[]{ }, .initialValue = {.int32Values = {0}}}, + {.config = + { + .prop = toInt(VehicleProperty::FUEL_VOLUME_DISPLAY_UNITS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .configArray = {(int)VehicleUnit::LITER, (int)VehicleUnit::US_GALLON}, + }, + .initialValue = {.int32Values = {(int)VehicleUnit::LITER}}}, + {.config = { .prop = toInt(VehicleProperty::HW_KEY_INPUT), diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp index e3c8dd6c79..d35792d4b2 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp @@ -141,7 +141,7 @@ class DefaultVhalImplTest : public ::testing::Test { TEST_F(DefaultVhalImplTest, testListProperties) { std::vector configs = mHal->listProperties(); - EXPECT_EQ((size_t)121, configs.size()); + EXPECT_EQ((size_t)122, configs.size()); } TEST_F(DefaultVhalImplTest, testGetDefaultPropertyFloat) { From 6696f54057cfc93680177771f27fc73eae71d808 Mon Sep 17 00:00:00 2001 From: dhavalc Date: Mon, 4 Apr 2022 05:08:43 +0000 Subject: [PATCH 035/998] Removed bringUp/bringDown ImsMedia HAL APIs based on feedback from Vendors Bug: 227665350 Test: Build(m) Change-Id: I76aa0e62fd24dec7ed544c193a8450c84c3f5ab5 --- .../hardware/radio/ims/media/IImsMedia.aidl | 2 -- .../hardware/radio/ims/media/IImsMedia.aidl | 15 +-------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMedia.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMedia.aidl index c2eec0a96e..30793e5eb2 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMedia.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMedia.aidl @@ -35,8 +35,6 @@ package android.hardware.radio.ims.media; @VintfStability interface IImsMedia { oneway void setListener(in android.hardware.radio.ims.media.IImsMediaListener mediaListener); - oneway void bringUp(); - oneway void bringDown(); oneway void openSession(int sessionId, in android.hardware.radio.ims.media.LocalEndPoint localEndPoint, in android.hardware.radio.ims.media.RtpConfig config); oneway void closeSession(int sessionId); } diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMedia.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMedia.aidl index 46c78e84c7..ecf137030a 100644 --- a/radio/aidl/android/hardware/radio/ims/media/IImsMedia.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMedia.aidl @@ -34,19 +34,6 @@ oneway interface IImsMedia { */ void setListener(in IImsMediaListener mediaListener); - /** - * Brings up and initializes the RTP stack in the offloaded processor. The bring up status - * notified via IImsMediaListener#onBringupResponse() API. The implementation shall notify - * the state of media stack using IImsMediaListener#onMediaStackStateChanged(). - */ - void bringUp(); - - /** - * Brings down the RTP stack in the offloaded processor. This shall release any reserved - * resources and shall notify the status via IImsMediaListener#onMediaStackStateChanged(). - */ - void bringDown(); - /** * Opens a RTP session for the local end point with the associated initial remote configuration * if there is a valid RtpConfig passed. It starts the media flow if the media direction in the @@ -68,5 +55,5 @@ oneway interface IImsMedia { * * @param sessionId identifier for the rtp session that needs to be closed */ - void closeSession(int sessionId); + void closeSession(int sessionId); } From 67e2eaa9a672c2a5436c665e9edebcfa5a768d9a Mon Sep 17 00:00:00 2001 From: Helen Date: Mon, 4 Apr 2022 05:25:26 +0000 Subject: [PATCH 036/998] Background: android.hardware.radio.data was frozen in the upstream tm-dev. Previously, the interface had only V1 (as the in-development version) and it was in the VNDK. However, after the freeze, it will have V1 and V2, and only V1 will remain in the VNDK, because we can't have multiple versions of the same AIDL interface in VNDK. Problem: ``` > error: hardware/interfaces/radio/aidl/Android.bp:225:1: module "android.hardware .radio.ims.media-V1-ndk" variant "android_vendor.Tiramisu_x86_64_silvermont_stat ic" (created by module "android.hardware.radio.ims.media-V1-ndk-generator" (crea ted by module "android.hardware.radio.ims.media_interface")): (native:vendor:vnd k) should not link to "android.hardware.radio.data-V2-ndk" (native:vendor): VNDK -core must only depend on VNDK-core or VNDK-SP ``` Bug: 227979452 Test: Build Change-Id: Ie3d964c09598ec6efd863c561c314bad7cc7731d --- radio/aidl/Android.bp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp index f9228351bf..bdd12488ed 100644 --- a/radio/aidl/Android.bp +++ b/radio/aidl/Android.bp @@ -228,7 +228,7 @@ aidl_interface { srcs: ["android/hardware/radio/ims/media/*.aidl"], stability: "vintf", imports: ["android.hardware.radio", - "android.hardware.radio.data"], + "android.hardware.radio.data-V1"], backend: { cpp: { enabled: false, From c8f8e2dc53cd2177bbc2cabc88626552ad1718ef Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Tue, 22 Mar 2022 09:49:30 +0000 Subject: [PATCH 037/998] Update IRadioNetwork for AOSP IMS Bug: 216387835 Test: build & flash Change-Id: Ieb5f974d98b4bffb3e7f0d43ffce7e72188a2aad --- .../network/AccessTechnologySpecificInfo.aidl | 2 +- .../radio/network/EutranRegistrationInfo.aidl | 16 ++++++----- .../radio/network/NrRegistrationInfo.aidl | 9 +++---- .../network/AccessTechnologySpecificInfo.aidl | 2 +- .../radio/network/EutranRegistrationInfo.aidl | 27 ++++++++++++------- .../radio/network/NrRegistrationInfo.aidl | 20 +++++++------- radio/aidl/vts/radio_network_test.cpp | 3 ++- 7 files changed, 45 insertions(+), 34 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl index 1557cbe674..cfa6d22d2c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl @@ -39,5 +39,5 @@ union AccessTechnologySpecificInfo { android.hardware.radio.network.EutranRegistrationInfo eutranInfo; android.hardware.radio.network.NrVopsInfo ngranNrVopsInfo; boolean geranDtmSupported; - @nullable android.hardware.radio.network.NrRegistrationInfo ngranInfo; + android.hardware.radio.network.NrRegistrationInfo ngranInfo; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl index d06a5ca5eb..9c8f692c0f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl @@ -36,10 +36,14 @@ package android.hardware.radio.network; parcelable EutranRegistrationInfo { android.hardware.radio.network.LteVopsInfo lteVopsInfo; android.hardware.radio.network.NrIndicators nrIndicators; - byte lteAttachType; - boolean isEmergencyAttached; - const byte EPS_ONLY = 1; - const byte COMBINED_EPS_AND_IMSI = 2; - const byte COMBINED_CSFB_NOT_PREFERRED = 3; - const byte COMBINED_SMS_ONLY = 4; + android.hardware.radio.network.EutranRegistrationInfo.AttachType lteAttachType; + int extraInfo; + const int EXTRA_CSFB_NOT_PREFERRED = 1; + const int EXTRA_SMS_ONLY = 2; + enum AttachType { + NONE = 0, + EPS_ONLY = 1, + COMBINED = 2, + EMERGENCY = 3, + } } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrRegistrationInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrRegistrationInfo.aidl index 04d900d01b..930ff542b6 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrRegistrationInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrRegistrationInfo.aidl @@ -35,10 +35,7 @@ package android.hardware.radio.network; @VintfStability parcelable NrRegistrationInfo { android.hardware.radio.network.NrVopsInfo ngranNrVopsInfo; - byte resultValue; - boolean isSmsOverNasAllowed; - boolean isEmergencyRegistered; - const byte REGISTERED_OVER_3GPP = 1; - const byte REGISTERED_OVER_NON_3GPP = 2; - const byte REGISTERED_OVER_3GPP_AND_NON_3GPP = 3; + int extraInfo; + const int EXTRA_SMS_OVER_NAS_ALLOWED = 1; + const int EXTRA_REGISTERED_FOR_EMERGENCY = 2; } diff --git a/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl b/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl index 5ca5280358..40bed76d60 100644 --- a/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl @@ -38,5 +38,5 @@ union AccessTechnologySpecificInfo { */ boolean geranDtmSupported; - @nullable NrRegistrationInfo ngranInfo; + NrRegistrationInfo ngranInfo; } diff --git a/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl b/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl index a3371c2843..12a8c64a57 100644 --- a/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl @@ -22,14 +22,23 @@ import android.hardware.radio.network.NrIndicators; @VintfStability @JavaDerive(toString=true) parcelable EutranRegistrationInfo { - /** LTE is attached with eps only. */ - const byte EPS_ONLY = 1; - /** LTE combined EPS and IMSI attach. */ - const byte COMBINED_EPS_AND_IMSI = 2; + + enum AttachType { + /** Default value. */ + NONE, + /** LTE is attached with eps only. */ + EPS_ONLY, + /** LTE combined EPS and IMSI attach. */ + COMBINED, + /** LTE is attached for emergency bearer service. */ + EMERGENCY, + } + /** LTE combined attach with CSFB not preferred */ - const byte COMBINED_CSFB_NOT_PREFERRED = 3; + const int EXTRA_CSFB_NOT_PREFERRED = 1 << 0; + /** LTE combined attach for SMS only */ - const byte COMBINED_SMS_ONLY = 4; + const int EXTRA_SMS_ONLY = 1 << 1; /** * Network capabilities for voice over PS services. This info is valid only on LTE network and @@ -47,8 +56,8 @@ parcelable EutranRegistrationInfo { * The type of network attachment. This info is valid only on LTE network and must be present * when device has attached to the network. */ - byte lteAttachType; + AttachType lteAttachType; - /** True if emergency attached */ - boolean isEmergencyAttached; + /** Values are bitwise ORs of EXTRA_ */ + int extraInfo; } diff --git a/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl b/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl index eb1e9dd299..3798286bfe 100644 --- a/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl @@ -16,14 +16,17 @@ package android.hardware.radio.network; +import android.hardware.radio.network.EutranRegistrationInfo; import android.hardware.radio.network.NrVopsInfo; @VintfStability parcelable NrRegistrationInfo { - /** 5GS registration result value - TS 24.501 9.11.3.6 */ - const byte REGISTERED_OVER_3GPP = 1; - const byte REGISTERED_OVER_NON_3GPP = 2; - const byte REGISTERED_OVER_3GPP_AND_NON_3GPP = 3; + + /** SMS over NAS is allowed - TS 24.501 9.11.3.6. */ + const int EXTRA_SMS_OVER_NAS_ALLOWED = 1 << 0; + + /** Registered for emergency services - TS 24.501 9.11.3.6. */ + const int EXTRA_REGISTERED_FOR_EMERGENCY = 1 << 1; /** * Network capabilities for voice over PS services. This info is valid only on NR network and @@ -31,10 +34,7 @@ parcelable NrRegistrationInfo { * not camped on NR. */ NrVopsInfo ngranNrVopsInfo; - /** 5GS registration result value - TS 24.501 9.11.3.6 */ - byte resultValue; - /** 5GS registration result SMS over NAS - TS 24.501 9.11.3.6 */ - boolean isSmsOverNasAllowed; - /** True if emergency registered */ - boolean isEmergencyRegistered; + + /** Values are bitwise ORs of EXTRA_ */ + int extraInfo; } diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index e1d508d1d3..d55763ac81 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -1404,7 +1404,8 @@ TEST_P(RadioNetworkTest, getDataRegistrationState) { if (rat == RadioTechnology::LTE || rat == RadioTechnology::LTE_CA) { ASSERT_EQ(info.getTag(), AccessTechnologySpecificInfo::eutranInfo); } else if (rat == RadioTechnology::NR) { - ASSERT_EQ(info.getTag(), AccessTechnologySpecificInfo::ngranNrVopsInfo); + ASSERT_TRUE(info.getTag() == AccessTechnologySpecificInfo::ngranNrVopsInfo + || info.getTag() == AccessTechnologySpecificInfo::ngranInfo); } } From 04f74588eca878f2d1fe4c54767a291817b48851 Mon Sep 17 00:00:00 2001 From: dhavalc Date: Mon, 4 Apr 2022 05:58:03 +0000 Subject: [PATCH 038/998] Removed duration from ImsMedia HAL API (notifyMediaInactivity) based on feedback from Vendors bug: 227665350 Test: build(mm) Change-Id: I2c6ddc5d13ae27d598f40b9645c393737d56941b --- .../hardware/radio/ims/media/IImsMediaSessionListener.aidl | 2 +- .../hardware/radio/ims/media/IImsMediaSessionListener.aidl | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl index ce551217ae..bb51ca4278 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl @@ -40,7 +40,7 @@ interface IImsMediaSessionListener { oneway void onConfirmConfigResponse(in android.hardware.radio.ims.media.RtpConfig config, android.hardware.radio.ims.media.RtpError error); oneway void onFirstMediaPacketReceived(in android.hardware.radio.ims.media.RtpConfig config); oneway void onHeaderExtensionReceived(in List extensions); - oneway void notifyMediaInactivity(android.hardware.radio.ims.media.MediaProtocolType packetType, int duration); + oneway void notifyMediaInactivity(android.hardware.radio.ims.media.MediaProtocolType packetType); oneway void notifyPacketLoss(int packetLossPercentage); oneway void notifyJitter(int jitter); } diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl index 01a042f029..c2d2a3b477 100644 --- a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl @@ -94,9 +94,8 @@ oneway interface IImsMediaSessionListener { * setMediaQualityThreshold() API * * @param packetType either RTP or RTCP - * @param duration Inactivity duration */ - void notifyMediaInactivity(MediaProtocolType packetType, int duration); + void notifyMediaInactivity(MediaProtocolType packetType); /** * Notifies RTP packet loss observed as per thresholds set by From a429c260085e47ac0a57ee34bcb13cd84c286e3f Mon Sep 17 00:00:00 2001 From: Serik Beketayev Date: Tue, 5 Apr 2022 16:08:17 -0700 Subject: [PATCH 039/998] [TCU Host] Enable telephony on Seahawk Enabling telephony on Seahawk. Creating rilproxy service that binds to radiocompat service and publishes its APIs over RPC. radiocompat service is a translator service from HIDL to AIDL. Bug: 186760449 Test: m -j tcu-host-rilproxy && aae flash Change-Id: I71bbafb15e8e7a2d3f68666a0564a4aa5fc3f0cb --- radio/aidl/Android.bp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp index 24764307f1..2c055d90ab 100644 --- a/radio/aidl/Android.bp +++ b/radio/aidl/Android.bp @@ -14,7 +14,7 @@ aidl_interface { stability: "vintf", backend: { cpp: { - enabled: false, + enabled: true, }, java: { sdk_version: "module_current", @@ -35,7 +35,7 @@ aidl_interface { imports: ["android.hardware.radio"], backend: { cpp: { - enabled: false, + enabled: true, }, java: { sdk_version: "module_current", @@ -63,7 +63,7 @@ aidl_interface { imports: ["android.hardware.radio"], backend: { cpp: { - enabled: false, + enabled: true, }, java: { sdk_version: "module_current", @@ -91,7 +91,7 @@ aidl_interface { imports: ["android.hardware.radio"], backend: { cpp: { - enabled: false, + enabled: true, }, java: { sdk_version: "module_current", @@ -112,7 +112,7 @@ aidl_interface { imports: ["android.hardware.radio"], backend: { cpp: { - enabled: false, + enabled: true, }, java: { sdk_version: "module_current", @@ -140,7 +140,7 @@ aidl_interface { imports: ["android.hardware.radio"], backend: { cpp: { - enabled: false, + enabled: true, }, java: { sdk_version: "module_current", @@ -171,7 +171,7 @@ aidl_interface { ], backend: { cpp: { - enabled: false, + enabled: true, }, java: { sdk_version: "module_current", @@ -202,7 +202,7 @@ aidl_interface { imports: ["android.hardware.radio"], backend: { cpp: { - enabled: false, + enabled: true, }, java: { sdk_version: "module_current", From 1a4b83d724edef1520c6f4e752c440fd77b3a1d5 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Thu, 7 Apr 2022 04:12:35 +0000 Subject: [PATCH 040/998] Revert "Update IRadioNetwork for AOSP IMS" This reverts commit c8f8e2dc53cd2177bbc2cabc88626552ad1718ef. Reason for revert: Change-Id: I08648b30858010a3689b0ca2e60f7c6960f46715 --- .../network/AccessTechnologySpecificInfo.aidl | 2 +- .../radio/network/EutranRegistrationInfo.aidl | 16 +++++------ .../radio/network/NrRegistrationInfo.aidl | 9 ++++--- .../network/AccessTechnologySpecificInfo.aidl | 2 +- .../radio/network/EutranRegistrationInfo.aidl | 27 +++++++------------ .../radio/network/NrRegistrationInfo.aidl | 20 +++++++------- radio/aidl/vts/radio_network_test.cpp | 3 +-- 7 files changed, 34 insertions(+), 45 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl index cfa6d22d2c..1557cbe674 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl @@ -39,5 +39,5 @@ union AccessTechnologySpecificInfo { android.hardware.radio.network.EutranRegistrationInfo eutranInfo; android.hardware.radio.network.NrVopsInfo ngranNrVopsInfo; boolean geranDtmSupported; - android.hardware.radio.network.NrRegistrationInfo ngranInfo; + @nullable android.hardware.radio.network.NrRegistrationInfo ngranInfo; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl index 9c8f692c0f..d06a5ca5eb 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl @@ -36,14 +36,10 @@ package android.hardware.radio.network; parcelable EutranRegistrationInfo { android.hardware.radio.network.LteVopsInfo lteVopsInfo; android.hardware.radio.network.NrIndicators nrIndicators; - android.hardware.radio.network.EutranRegistrationInfo.AttachType lteAttachType; - int extraInfo; - const int EXTRA_CSFB_NOT_PREFERRED = 1; - const int EXTRA_SMS_ONLY = 2; - enum AttachType { - NONE = 0, - EPS_ONLY = 1, - COMBINED = 2, - EMERGENCY = 3, - } + byte lteAttachType; + boolean isEmergencyAttached; + const byte EPS_ONLY = 1; + const byte COMBINED_EPS_AND_IMSI = 2; + const byte COMBINED_CSFB_NOT_PREFERRED = 3; + const byte COMBINED_SMS_ONLY = 4; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrRegistrationInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrRegistrationInfo.aidl index 930ff542b6..04d900d01b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrRegistrationInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrRegistrationInfo.aidl @@ -35,7 +35,10 @@ package android.hardware.radio.network; @VintfStability parcelable NrRegistrationInfo { android.hardware.radio.network.NrVopsInfo ngranNrVopsInfo; - int extraInfo; - const int EXTRA_SMS_OVER_NAS_ALLOWED = 1; - const int EXTRA_REGISTERED_FOR_EMERGENCY = 2; + byte resultValue; + boolean isSmsOverNasAllowed; + boolean isEmergencyRegistered; + const byte REGISTERED_OVER_3GPP = 1; + const byte REGISTERED_OVER_NON_3GPP = 2; + const byte REGISTERED_OVER_3GPP_AND_NON_3GPP = 3; } diff --git a/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl b/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl index 40bed76d60..5ca5280358 100644 --- a/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl @@ -38,5 +38,5 @@ union AccessTechnologySpecificInfo { */ boolean geranDtmSupported; - NrRegistrationInfo ngranInfo; + @nullable NrRegistrationInfo ngranInfo; } diff --git a/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl b/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl index 12a8c64a57..a3371c2843 100644 --- a/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl @@ -22,23 +22,14 @@ import android.hardware.radio.network.NrIndicators; @VintfStability @JavaDerive(toString=true) parcelable EutranRegistrationInfo { - - enum AttachType { - /** Default value. */ - NONE, - /** LTE is attached with eps only. */ - EPS_ONLY, - /** LTE combined EPS and IMSI attach. */ - COMBINED, - /** LTE is attached for emergency bearer service. */ - EMERGENCY, - } - + /** LTE is attached with eps only. */ + const byte EPS_ONLY = 1; + /** LTE combined EPS and IMSI attach. */ + const byte COMBINED_EPS_AND_IMSI = 2; /** LTE combined attach with CSFB not preferred */ - const int EXTRA_CSFB_NOT_PREFERRED = 1 << 0; - + const byte COMBINED_CSFB_NOT_PREFERRED = 3; /** LTE combined attach for SMS only */ - const int EXTRA_SMS_ONLY = 1 << 1; + const byte COMBINED_SMS_ONLY = 4; /** * Network capabilities for voice over PS services. This info is valid only on LTE network and @@ -56,8 +47,8 @@ parcelable EutranRegistrationInfo { * The type of network attachment. This info is valid only on LTE network and must be present * when device has attached to the network. */ - AttachType lteAttachType; + byte lteAttachType; - /** Values are bitwise ORs of EXTRA_ */ - int extraInfo; + /** True if emergency attached */ + boolean isEmergencyAttached; } diff --git a/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl b/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl index 3798286bfe..eb1e9dd299 100644 --- a/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl @@ -16,17 +16,14 @@ package android.hardware.radio.network; -import android.hardware.radio.network.EutranRegistrationInfo; import android.hardware.radio.network.NrVopsInfo; @VintfStability parcelable NrRegistrationInfo { - - /** SMS over NAS is allowed - TS 24.501 9.11.3.6. */ - const int EXTRA_SMS_OVER_NAS_ALLOWED = 1 << 0; - - /** Registered for emergency services - TS 24.501 9.11.3.6. */ - const int EXTRA_REGISTERED_FOR_EMERGENCY = 1 << 1; + /** 5GS registration result value - TS 24.501 9.11.3.6 */ + const byte REGISTERED_OVER_3GPP = 1; + const byte REGISTERED_OVER_NON_3GPP = 2; + const byte REGISTERED_OVER_3GPP_AND_NON_3GPP = 3; /** * Network capabilities for voice over PS services. This info is valid only on NR network and @@ -34,7 +31,10 @@ parcelable NrRegistrationInfo { * not camped on NR. */ NrVopsInfo ngranNrVopsInfo; - - /** Values are bitwise ORs of EXTRA_ */ - int extraInfo; + /** 5GS registration result value - TS 24.501 9.11.3.6 */ + byte resultValue; + /** 5GS registration result SMS over NAS - TS 24.501 9.11.3.6 */ + boolean isSmsOverNasAllowed; + /** True if emergency registered */ + boolean isEmergencyRegistered; } diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index d55763ac81..e1d508d1d3 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -1404,8 +1404,7 @@ TEST_P(RadioNetworkTest, getDataRegistrationState) { if (rat == RadioTechnology::LTE || rat == RadioTechnology::LTE_CA) { ASSERT_EQ(info.getTag(), AccessTechnologySpecificInfo::eutranInfo); } else if (rat == RadioTechnology::NR) { - ASSERT_TRUE(info.getTag() == AccessTechnologySpecificInfo::ngranNrVopsInfo - || info.getTag() == AccessTechnologySpecificInfo::ngranInfo); + ASSERT_EQ(info.getTag(), AccessTechnologySpecificInfo::ngranNrVopsInfo); } } From f60e76834cf33d8416eb4a9e5c8259fd22ec2f02 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Thu, 7 Apr 2022 05:30:59 +0000 Subject: [PATCH 041/998] Update IRadioNetwork for AOSP IMS Bug: 216387835 Test: build & flash Change-Id: Ia5209365daaab1bf68b1c1db5381553d266eaa12 --- .../network/AccessTechnologySpecificInfo.aidl | 3 +++ .../radio/network/EutranRegistrationInfo.aidl | 16 +++++++----- .../radio/network/NrRegistrationInfo.aidl | 9 +++---- .../network/AccessTechnologySpecificInfo.aidl | 6 +++++ .../radio/network/EutranRegistrationInfo.aidl | 26 ++++++++++++------- .../radio/network/NrRegistrationInfo.aidl | 19 +++++++------- radio/aidl/vts/radio_network_test.cpp | 3 ++- 7 files changed, 50 insertions(+), 32 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl index 1557cbe674..08d44f43b2 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl @@ -37,6 +37,9 @@ union AccessTechnologySpecificInfo { boolean noinit; android.hardware.radio.network.Cdma2000RegistrationInfo cdmaInfo; android.hardware.radio.network.EutranRegistrationInfo eutranInfo; + /** + * @deprecated use NrRegistrationInfo instead. + */ android.hardware.radio.network.NrVopsInfo ngranNrVopsInfo; boolean geranDtmSupported; @nullable android.hardware.radio.network.NrRegistrationInfo ngranInfo; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl index d06a5ca5eb..9c8f692c0f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl @@ -36,10 +36,14 @@ package android.hardware.radio.network; parcelable EutranRegistrationInfo { android.hardware.radio.network.LteVopsInfo lteVopsInfo; android.hardware.radio.network.NrIndicators nrIndicators; - byte lteAttachType; - boolean isEmergencyAttached; - const byte EPS_ONLY = 1; - const byte COMBINED_EPS_AND_IMSI = 2; - const byte COMBINED_CSFB_NOT_PREFERRED = 3; - const byte COMBINED_SMS_ONLY = 4; + android.hardware.radio.network.EutranRegistrationInfo.AttachType lteAttachType; + int extraInfo; + const int EXTRA_CSFB_NOT_PREFERRED = 1; + const int EXTRA_SMS_ONLY = 2; + enum AttachType { + NONE = 0, + EPS_ONLY = 1, + COMBINED = 2, + EMERGENCY = 3, + } } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrRegistrationInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrRegistrationInfo.aidl index 04d900d01b..930ff542b6 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrRegistrationInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrRegistrationInfo.aidl @@ -35,10 +35,7 @@ package android.hardware.radio.network; @VintfStability parcelable NrRegistrationInfo { android.hardware.radio.network.NrVopsInfo ngranNrVopsInfo; - byte resultValue; - boolean isSmsOverNasAllowed; - boolean isEmergencyRegistered; - const byte REGISTERED_OVER_3GPP = 1; - const byte REGISTERED_OVER_NON_3GPP = 2; - const byte REGISTERED_OVER_3GPP_AND_NON_3GPP = 3; + int extraInfo; + const int EXTRA_SMS_OVER_NAS_ALLOWED = 1; + const int EXTRA_REGISTERED_FOR_EMERGENCY = 2; } diff --git a/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl b/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl index 5ca5280358..b613cde8ce 100644 --- a/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl @@ -31,6 +31,7 @@ union AccessTechnologySpecificInfo { * Network capabilities for voice over PS services. This info is valid only on NR network and * must be present when the device is camped on NR. NrVopsInfo must be empty when the device is * not camped on NR. + * @deprecated use NrRegistrationInfo instead. */ NrVopsInfo ngranNrVopsInfo; /** @@ -38,5 +39,10 @@ union AccessTechnologySpecificInfo { */ boolean geranDtmSupported; + /** + * Network registration information and network capabilities for voice over PS services. + * This info is valid only on NR network and must be present when the device is camped on NR. + * NrRegistrationInfo must be empty when the device is not camped on NR. + */ @nullable NrRegistrationInfo ngranInfo; } diff --git a/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl b/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl index a3371c2843..3b4005061d 100644 --- a/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl @@ -22,14 +22,22 @@ import android.hardware.radio.network.NrIndicators; @VintfStability @JavaDerive(toString=true) parcelable EutranRegistrationInfo { - /** LTE is attached with eps only. */ - const byte EPS_ONLY = 1; - /** LTE combined EPS and IMSI attach. */ - const byte COMBINED_EPS_AND_IMSI = 2; + enum AttachType { + /** Default value. */ + NONE, + /** LTE is attached with eps only. */ + EPS_ONLY, + /** LTE combined EPS and IMSI attach. */ + COMBINED, + /** LTE is attached for emergency bearer service. */ + EMERGENCY, + } + /** LTE combined attach with CSFB not preferred */ - const byte COMBINED_CSFB_NOT_PREFERRED = 3; + const int EXTRA_CSFB_NOT_PREFERRED = 1 << 0; + /** LTE combined attach for SMS only */ - const byte COMBINED_SMS_ONLY = 4; + const int EXTRA_SMS_ONLY = 1 << 1; /** * Network capabilities for voice over PS services. This info is valid only on LTE network and @@ -47,8 +55,8 @@ parcelable EutranRegistrationInfo { * The type of network attachment. This info is valid only on LTE network and must be present * when device has attached to the network. */ - byte lteAttachType; + AttachType lteAttachType; - /** True if emergency attached */ - boolean isEmergencyAttached; + /** Values are bitwise ORs of EXTRA_* constants */ + int extraInfo; } diff --git a/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl b/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl index eb1e9dd299..7e6bed5472 100644 --- a/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl @@ -16,14 +16,16 @@ package android.hardware.radio.network; +import android.hardware.radio.network.EutranRegistrationInfo; import android.hardware.radio.network.NrVopsInfo; @VintfStability parcelable NrRegistrationInfo { - /** 5GS registration result value - TS 24.501 9.11.3.6 */ - const byte REGISTERED_OVER_3GPP = 1; - const byte REGISTERED_OVER_NON_3GPP = 2; - const byte REGISTERED_OVER_3GPP_AND_NON_3GPP = 3; + /** SMS over NAS is allowed - TS 24.501 9.11.3.6. */ + const int EXTRA_SMS_OVER_NAS_ALLOWED = 1 << 0; + + /** Registered for emergency services - TS 24.501 9.11.3.6. */ + const int EXTRA_REGISTERED_FOR_EMERGENCY = 1 << 1; /** * Network capabilities for voice over PS services. This info is valid only on NR network and @@ -31,10 +33,7 @@ parcelable NrRegistrationInfo { * not camped on NR. */ NrVopsInfo ngranNrVopsInfo; - /** 5GS registration result value - TS 24.501 9.11.3.6 */ - byte resultValue; - /** 5GS registration result SMS over NAS - TS 24.501 9.11.3.6 */ - boolean isSmsOverNasAllowed; - /** True if emergency registered */ - boolean isEmergencyRegistered; + + /** Values are bitwise ORs of EXTRA_ */ + int extraInfo; } diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index e1d508d1d3..d55763ac81 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -1404,7 +1404,8 @@ TEST_P(RadioNetworkTest, getDataRegistrationState) { if (rat == RadioTechnology::LTE || rat == RadioTechnology::LTE_CA) { ASSERT_EQ(info.getTag(), AccessTechnologySpecificInfo::eutranInfo); } else if (rat == RadioTechnology::NR) { - ASSERT_EQ(info.getTag(), AccessTechnologySpecificInfo::ngranNrVopsInfo); + ASSERT_TRUE(info.getTag() == AccessTechnologySpecificInfo::ngranNrVopsInfo + || info.getTag() == AccessTechnologySpecificInfo::ngranInfo); } } From 5da865657df1baef53d11dcedaed35efc0d9c1b3 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Thu, 7 Apr 2022 19:34:24 +0000 Subject: [PATCH 042/998] Remove @deprecated annotation temporarily AIDL generated code causes errors with @deprecated annotation while building NDK. See b/228499516. Bug: 216387835 Bug: 228511128 Test: build & flash Change-Id: Id833d0457aaf441324a1b42d0f72cdbb3c7eb608 --- .../radio/network/AccessTechnologySpecificInfo.aidl | 3 --- .../radio/network/AccessTechnologySpecificInfo.aidl | 2 +- .../android/hardware/radio/network/NrRegistrationInfo.aidl | 6 +----- radio/aidl/vts/Android.bp | 2 +- 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl index 08d44f43b2..1557cbe674 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl @@ -37,9 +37,6 @@ union AccessTechnologySpecificInfo { boolean noinit; android.hardware.radio.network.Cdma2000RegistrationInfo cdmaInfo; android.hardware.radio.network.EutranRegistrationInfo eutranInfo; - /** - * @deprecated use NrRegistrationInfo instead. - */ android.hardware.radio.network.NrVopsInfo ngranNrVopsInfo; boolean geranDtmSupported; @nullable android.hardware.radio.network.NrRegistrationInfo ngranInfo; diff --git a/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl b/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl index b613cde8ce..4ea994ef48 100644 --- a/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl @@ -31,7 +31,7 @@ union AccessTechnologySpecificInfo { * Network capabilities for voice over PS services. This info is valid only on NR network and * must be present when the device is camped on NR. NrVopsInfo must be empty when the device is * not camped on NR. - * @deprecated use NrRegistrationInfo instead. + * This field is deprecated. Use ngranInfo instead. */ NrVopsInfo ngranNrVopsInfo; /** diff --git a/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl b/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl index 7e6bed5472..8ca7697a5a 100644 --- a/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl @@ -27,11 +27,7 @@ parcelable NrRegistrationInfo { /** Registered for emergency services - TS 24.501 9.11.3.6. */ const int EXTRA_REGISTERED_FOR_EMERGENCY = 1 << 1; - /** - * Network capabilities for voice over PS services. This info is valid only on NR network and - * must be present when the device is camped on NR. NrVopsInfo must be empty when the device is - * not camped on NR. - */ + /** Network capabilities for voice over PS services. */ NrVopsInfo ngranNrVopsInfo; /** Values are bitwise ORs of EXTRA_ */ diff --git a/radio/aidl/vts/Android.bp b/radio/aidl/vts/Android.bp index 7d2cac06fe..bb992c9e76 100644 --- a/radio/aidl/vts/Android.bp +++ b/radio/aidl/vts/Android.bp @@ -72,7 +72,7 @@ cc_test { "android.hardware.radio.ims-V1-ndk", "android.hardware.radio.messaging-V1-ndk", "android.hardware.radio.modem-V1-ndk", - "android.hardware.radio.network-V1-ndk", + "android.hardware.radio.network-V2-ndk", "android.hardware.radio.sim-V1-ndk", "android.hardware.radio.voice-V1-ndk", ], From d1153a42d520877eba1f8f88b1e630b83b2f7c23 Mon Sep 17 00:00:00 2001 From: Rakesh Raghava Date: Mon, 11 Apr 2022 21:05:09 +0000 Subject: [PATCH 043/998] (ImsMedia) Changed Dtmf APIs - startDtmf(char dtmfDigit, int volume, int duration) updated to sendDtmf(char dtmfDigit, int duration) - stopDtmf() removed Bug: 228134488 Test: build (mm) Change-Id: I77224e71675b9d45f76bca36db64783a6ce4bf82 --- .../hardware/radio/ims/media/IImsMediaSession.aidl | 3 +-- .../hardware/radio/ims/media/IImsMediaSession.aidl | 14 +++----------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl index 03d0fcc1db..38d9d02bfe 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl @@ -39,8 +39,7 @@ interface IImsMediaSession { oneway void addConfig(in android.hardware.radio.ims.media.RtpConfig config); oneway void deleteConfig(in android.hardware.radio.ims.media.RtpConfig config); oneway void confirmConfig(in android.hardware.radio.ims.media.RtpConfig config); - oneway void startDtmf(char dtmfDigit, int volume, int duration); - oneway void stopDtmf(); + oneway void sendDtmf(char dtmfDigit, int duration); oneway void sendHeaderExtension(in List extensions); oneway void setMediaQualityThreshold(in android.hardware.radio.ims.media.MediaQualityThreshold threshold); } diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl index 3e29356dbf..8c73bbc3a5 100644 --- a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl @@ -28,7 +28,6 @@ import android.hardware.radio.ims.media.RtpHeaderExtension; */ @VintfStability oneway interface IImsMediaSession { - /** * Set the listener functions to receive IMS media session specific notifications. * @@ -76,19 +75,12 @@ oneway interface IImsMediaSession { void confirmConfig(in RtpConfig config); /** - * Start sending DTMF digit until the duration expires or a stopDtmf() API - * is received. If the implementation is currently playing a DTMF tone, that - * tone must be stopped first using stopDtmf(). + * Send DTMF digit until the duration expires. * * @param dtmfDigit single char having one of 12 values: 0-9, *, # - * @param volume of the DTMF digit between 0 and -63 dBm dropping the sign. - * @param duration of the key press in milliseconds. -1 means no duration - * is passed and the caller will invoke stopDtmf(). + * @param duration of the key press in milliseconds. */ - void startDtmf(char dtmfDigit, int volume, int duration); - - /** Stop sending the last DTMF digit started by startDtmf. */ - void stopDtmf(); + void sendDtmf(char dtmfDigit, int duration); /** * Send RTP header extension to the other party in the next RTP packet. From be8f185d31ead05483cc1e1e35618692e960eaf8 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Tue, 12 Apr 2022 14:43:29 +0000 Subject: [PATCH 044/998] Restore @deprecated annotation of ngranNrVopsInfo Bug: 228511128 Test: build Change-Id: I628d0d2c3295e6ff2a6105887abe2e3b879db1e0 --- .../hardware/radio/network/AccessTechnologySpecificInfo.aidl | 3 +++ .../hardware/radio/network/AccessTechnologySpecificInfo.aidl | 2 +- radio/aidl/vts/radio_network_test.cpp | 4 ++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl index 1557cbe674..3248b43f29 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl @@ -37,6 +37,9 @@ union AccessTechnologySpecificInfo { boolean noinit; android.hardware.radio.network.Cdma2000RegistrationInfo cdmaInfo; android.hardware.radio.network.EutranRegistrationInfo eutranInfo; + /** + * @deprecated Use ngranInfo instead. + */ android.hardware.radio.network.NrVopsInfo ngranNrVopsInfo; boolean geranDtmSupported; @nullable android.hardware.radio.network.NrRegistrationInfo ngranInfo; diff --git a/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl b/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl index 4ea994ef48..bc56e9ca33 100644 --- a/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl @@ -31,7 +31,7 @@ union AccessTechnologySpecificInfo { * Network capabilities for voice over PS services. This info is valid only on NR network and * must be present when the device is camped on NR. NrVopsInfo must be empty when the device is * not camped on NR. - * This field is deprecated. Use ngranInfo instead. + * @deprecated Use ngranInfo instead. */ NrVopsInfo ngranNrVopsInfo; /** diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index fe0af12f06..7ca26ab206 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -1483,6 +1483,9 @@ TEST_P(RadioNetworkTest, getDataRegistrationState) { // Check for access technology specific info AccessTechnologySpecificInfo info = radioRsp_network->dataRegResp.accessTechnologySpecificInfo; RadioTechnology rat = radioRsp_network->dataRegResp.rat; + + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdeprecated-declarations" // TODO: add logic for cdmaInfo if (rat == RadioTechnology::LTE || rat == RadioTechnology::LTE_CA) { ASSERT_EQ(info.getTag(), AccessTechnologySpecificInfo::eutranInfo); @@ -1490,6 +1493,7 @@ TEST_P(RadioNetworkTest, getDataRegistrationState) { ASSERT_TRUE(info.getTag() == AccessTechnologySpecificInfo::ngranNrVopsInfo || info.getTag() == AccessTechnologySpecificInfo::ngranInfo); } + #pragma clang diagnostic pop } /* From de94aa0354268e4a290eabf8fe1cf01a36bb7d9e Mon Sep 17 00:00:00 2001 From: Joe Bolinger Date: Thu, 9 Dec 2021 17:00:32 -0800 Subject: [PATCH 045/998] Add rear fps virtual HAL. Bug: 228638448 Test: atest FakeFingerprintEngineTest Test: manual (see README.md) Change-Id: Ifecf6b5667352eb2127f820bfde47c7d325ab1b2 --- .../fingerprint/aidl/default/Android.bp | 32 ++ .../aidl/default/FakeFingerprintEngine.cpp | 263 ++++++++++++++++ .../fingerprint/aidl/default/Fingerprint.cpp | 18 +- biometrics/fingerprint/aidl/default/README.md | 74 +++++ .../fingerprint/aidl/default/Session.cpp | 6 +- ...trics.fingerprint.VirtualProps-current.txt | 85 +++++ .../aidl/default/fingerprint.sysprop | 135 ++++++++ .../default/include/FakeFingerprintEngine.h | 76 ++--- .../tests/FakeFingerprintEngineTest.cpp | 297 ++++++++++++++++++ biometrics/fingerprint/aidl/vts/Android.bp | 4 +- 10 files changed, 926 insertions(+), 64 deletions(-) create mode 100644 biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp create mode 100644 biometrics/fingerprint/aidl/default/README.md create mode 100644 biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt create mode 100644 biometrics/fingerprint/aidl/default/fingerprint.sysprop create mode 100644 biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineTest.cpp diff --git a/biometrics/fingerprint/aidl/default/Android.bp b/biometrics/fingerprint/aidl/default/Android.bp index 430bf3cd82..e6628f29fc 100644 --- a/biometrics/fingerprint/aidl/default/Android.bp +++ b/biometrics/fingerprint/aidl/default/Android.bp @@ -16,6 +16,7 @@ cc_binary { local_include_dirs: ["include"], srcs: [ "CancellationSignal.cpp", + "FakeFingerprintEngine.cpp", "Fingerprint.cpp", "Session.cpp", "WorkerThread.cpp", @@ -27,6 +28,7 @@ cc_binary { "android.hardware.biometrics.fingerprint-V2-ndk", "android.hardware.biometrics.common-V2-ndk", ], + static_libs: ["android.hardware.biometrics.fingerprint.VirtualProps"], } cc_test_host { @@ -41,3 +43,33 @@ cc_test_host { ], test_suites: ["general-tests"], } + +cc_test { + name: "android.hardware.biometrics.fingerprint.FakeFingerprintEngineTest", + local_include_dirs: ["include"], + srcs: [ + "CancellationSignal.cpp", + "tests/FakeFingerprintEngineTest.cpp", + "FakeFingerprintEngine.cpp", + ], + shared_libs: [ + "libbase", + "libbinder_ndk", + ], + static_libs: [ + "android.hardware.biometrics.fingerprint.VirtualProps", + "android.hardware.biometrics.fingerprint-V2-ndk", + "android.hardware.biometrics.common-V2-ndk", + "android.hardware.keymaster-V3-ndk", + ], + vendor: true, + test_suites: ["general-tests"], + require_root: true, +} + +sysprop_library { + name: "android.hardware.biometrics.fingerprint.VirtualProps", + srcs: ["fingerprint.sysprop"], + property_owner: "Vendor", + vendor: true, +} diff --git a/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp b/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp new file mode 100644 index 0000000000..d1fe18350b --- /dev/null +++ b/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp @@ -0,0 +1,263 @@ +/* + * Copyright (C) 2021 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. + */ + +#include "FakeFingerprintEngine.h" + +#include +#include "CancellationSignal.h" + +#include +#include +#include +#include + +#define SLEEP_MS(x) \ + if (x > 0) std::this_thread::sleep_for(std::chrono::milliseconds(x)) +#define BEGIN_OP(x) \ + do { \ + LOG(INFO) << __func__; \ + SLEEP_MS(x); \ + } while (0) +#define IS_TRUE(x) ((x == "1") || (x == "true")) + +// This is for non-test situations, such as casual cuttlefish users, that don't +// set an explicit value. +// Some operations (i.e. enroll, authenticate) will be executed in tight loops +// by parts of the UI or fail if there is no latency. For example, the +// fingerprint settings page constantly runs auth and the enrollment UI uses a +// cancel/restart cycle that requires some latency while the activities change. +#define DEFAULT_LATENCY 2000 + +using namespace ::android::fingerprint::virt; +using namespace ::aidl::android::hardware::biometrics::fingerprint; + +int64_t getSystemNanoTime() { + timespec now; + clock_gettime(CLOCK_MONOTONIC, &now); + return now.tv_sec * 1000000000LL + now.tv_nsec; +} + +bool hasElapsed(int64_t start, int64_t durationMillis) { + auto now = getSystemNanoTime(); + if (now < start) return true; + if (durationMillis <= 0) return true; + return ((now - start) / 1000000LL) > durationMillis; +} + +std::vector split(const std::string& str, const std::string& sep) { + std::regex regex(sep); + std::vector parts(std::sregex_token_iterator(str.begin(), str.end(), regex, -1), + std::sregex_token_iterator()); + return parts; +} + +namespace aidl::android::hardware::biometrics::fingerprint { + +void FakeFingerprintEngine::generateChallengeImpl(ISessionCallback* cb) { + BEGIN_OP(0); + std::uniform_int_distribution dist; + auto challenge = dist(mRandom); + FingerprintHalProperties::challenge(challenge); + cb->onChallengeGenerated(challenge); +} + +void FakeFingerprintEngine::revokeChallengeImpl(ISessionCallback* cb, int64_t challenge) { + BEGIN_OP(0); + FingerprintHalProperties::challenge({}); + cb->onChallengeRevoked(challenge); +} + +void FakeFingerprintEngine::enrollImpl(ISessionCallback* cb, + const keymaster::HardwareAuthToken& hat, + const std::future& cancel) { + BEGIN_OP(FingerprintHalProperties::operation_enroll_latency().value_or(DEFAULT_LATENCY)); + + // Do proper HAT verification in the real implementation. + if (hat.mac.empty()) { + LOG(ERROR) << "Fail: hat"; + cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */); + return; + } + + if (FingerprintHalProperties::operation_enroll_fails().value_or(false)) { + LOG(ERROR) << "Fail: operation_enroll_fails"; + cb->onError(Error::VENDOR, 0 /* vendorError */); + return; + } + + // format is ":,,...: + auto nextEnroll = FingerprintHalProperties::next_enrollment().value_or(""); + auto parts = split(nextEnroll, ":"); + if (parts.size() != 3) { + LOG(ERROR) << "Fail: invalid next_enrollment"; + cb->onError(Error::VENDOR, 0 /* vendorError */); + return; + } + auto enrollmentId = std::stoi(parts[0]); + auto progress = split(parts[1], ","); + for (size_t i = 0; i < progress.size(); i++) { + auto left = progress.size() - i - 1; + SLEEP_MS(std::stoi(progress[i])); + + if (shouldCancel(cancel)) { + LOG(ERROR) << "Fail: cancel"; + cb->onError(Error::CANCELED, 0 /* vendorCode */); + return; + } + + cb->onAcquired(AcquiredInfo::GOOD, 0 /* vendorCode */); + if (left == 0 && !IS_TRUE(parts[2])) { // end and failed + LOG(ERROR) << "Fail: requested by caller: " << nextEnroll; + FingerprintHalProperties::next_enrollment({}); + cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorCode */); + } else { // progress and update props if last time + if (left == 0) { + auto enrollments = FingerprintHalProperties::enrollments(); + enrollments.emplace_back(enrollmentId); + FingerprintHalProperties::enrollments(enrollments); + FingerprintHalProperties::next_enrollment({}); + LOG(INFO) << "Enrolled: " << enrollmentId; + } + cb->onEnrollmentProgress(enrollmentId, left); + } + } +} + +void FakeFingerprintEngine::authenticateImpl(ISessionCallback* cb, int64_t /* operationId */, + const std::future& cancel) { + BEGIN_OP(FingerprintHalProperties::operation_authenticate_latency().value_or(DEFAULT_LATENCY)); + + auto now = getSystemNanoTime(); + int64_t duration = FingerprintHalProperties::operation_authenticate_duration().value_or(0); + do { + if (FingerprintHalProperties::operation_authenticate_fails().value_or(false)) { + LOG(ERROR) << "Fail: operation_authenticate_fails"; + cb->onError(Error::VENDOR, 0 /* vendorError */); + return; + } + + if (FingerprintHalProperties::lockout().value_or(false)) { + LOG(ERROR) << "Fail: lockout"; + cb->onLockoutPermanent(); + cb->onError(Error::HW_UNAVAILABLE, 0 /* vendorError */); + return; + } + + if (shouldCancel(cancel)) { + LOG(ERROR) << "Fail: cancel"; + cb->onError(Error::CANCELED, 0 /* vendorCode */); + return; + } + + auto id = FingerprintHalProperties::enrollment_hit().value_or(0); + auto enrolls = FingerprintHalProperties::enrollments(); + auto isEnrolled = std::find(enrolls.begin(), enrolls.end(), id) != enrolls.end(); + if (id > 0 && isEnrolled) { + cb->onAuthenticationSucceeded(id, {} /* hat */); + return; + } + + SLEEP_MS(100); + } while (!hasElapsed(now, duration)); + + LOG(ERROR) << "Fail: not enrolled"; + cb->onAuthenticationFailed(); + cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */); +} + +void FakeFingerprintEngine::detectInteractionImpl(ISessionCallback* cb, + const std::future& cancel) { + BEGIN_OP(FingerprintHalProperties::operation_detect_interaction_latency().value_or( + DEFAULT_LATENCY)); + + if (FingerprintHalProperties::operation_detect_interaction_fails().value_or(false)) { + LOG(ERROR) << "Fail: operation_detect_interaction_fails"; + cb->onError(Error::VENDOR, 0 /* vendorError */); + return; + } + + if (shouldCancel(cancel)) { + LOG(ERROR) << "Fail: cancel"; + cb->onError(Error::CANCELED, 0 /* vendorCode */); + return; + } + + auto id = FingerprintHalProperties::enrollment_hit().value_or(0); + auto enrolls = FingerprintHalProperties::enrollments(); + auto isEnrolled = std::find(enrolls.begin(), enrolls.end(), id) != enrolls.end(); + if (id <= 0 || !isEnrolled) { + LOG(ERROR) << "Fail: not enrolled"; + cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */); + return; + } + + cb->onInteractionDetected(); +} + +void FakeFingerprintEngine::enumerateEnrollmentsImpl(ISessionCallback* cb) { + BEGIN_OP(0); + + std::vector ids; + for (auto& enrollment : FingerprintHalProperties::enrollments()) { + auto id = enrollment.value_or(0); + if (id > 0) { + ids.push_back(id); + } + } + + cb->onEnrollmentsEnumerated(ids); +} + +void FakeFingerprintEngine::removeEnrollmentsImpl(ISessionCallback* cb, + const std::vector& enrollmentIds) { + BEGIN_OP(0); + + std::vector> newEnrollments; + std::vector removed; + for (auto& enrollment : FingerprintHalProperties::enrollments()) { + auto id = enrollment.value_or(0); + if (std::find(enrollmentIds.begin(), enrollmentIds.end(), id) != enrollmentIds.end()) { + removed.push_back(id); + } else if (id > 0) { + newEnrollments.emplace_back(id); + } + } + FingerprintHalProperties::enrollments(newEnrollments); + + cb->onEnrollmentsRemoved(enrollmentIds); +} + +void FakeFingerprintEngine::getAuthenticatorIdImpl(ISessionCallback* cb) { + BEGIN_OP(0); + cb->onAuthenticatorIdRetrieved(FingerprintHalProperties::authenticator_id().value_or(0)); +} + +void FakeFingerprintEngine::invalidateAuthenticatorIdImpl(ISessionCallback* cb) { + BEGIN_OP(0); + auto id = FingerprintHalProperties::authenticator_id().value_or(0); + auto newId = id + 1; + FingerprintHalProperties::authenticator_id(newId); + cb->onAuthenticatorIdInvalidated(newId); +} + +void FakeFingerprintEngine::resetLockoutImpl(ISessionCallback* cb, + const keymaster::HardwareAuthToken& /*hat*/) { + BEGIN_OP(0); + FingerprintHalProperties::lockout(false); + cb->onLockoutCleared(); +} + +} // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/Fingerprint.cpp b/biometrics/fingerprint/aidl/default/Fingerprint.cpp index 1f14de63ac..71dc6602c5 100644 --- a/biometrics/fingerprint/aidl/default/Fingerprint.cpp +++ b/biometrics/fingerprint/aidl/default/Fingerprint.cpp @@ -16,15 +16,19 @@ #include "Fingerprint.h" +#include #include "Session.h" +#include + +using namespace ::android::fingerprint::virt; + namespace aidl::android::hardware::biometrics::fingerprint { namespace { constexpr size_t MAX_WORKER_QUEUE_SIZE = 5; constexpr int SENSOR_ID = 1; constexpr common::SensorStrength SENSOR_STRENGTH = common::SensorStrength::STRONG; constexpr int MAX_ENROLLMENTS_PER_USER = 5; -constexpr FingerprintSensorType SENSOR_TYPE = FingerprintSensorType::REAR; constexpr bool SUPPORTS_NAVIGATION_GESTURES = true; constexpr char HW_COMPONENT_ID[] = "fingerprintSensor"; constexpr char HW_VERSION[] = "vendor/model/revision"; @@ -51,8 +55,18 @@ ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector* out) { 0 /* sensorLocationY */, 0 /* sensorRadius */, "" /* display */}; + FingerprintSensorType sensorType = FingerprintSensorType::UNKNOWN; + std::string sensorTypeProp = FingerprintHalProperties::type().value_or(""); + if (sensorTypeProp == "" || sensorTypeProp == "default" || sensorTypeProp == "rear") { + sensorType = FingerprintSensorType::REAR; + } + if (sensorType == FingerprintSensorType::UNKNOWN) { + UNIMPLEMENTED(FATAL) << "unrecognized or unimplemented fingerprint behavior: " + << sensorTypeProp; + } + *out = {{commonProps, - SENSOR_TYPE, + sensorType, {sensorLocation}, SUPPORTS_NAVIGATION_GESTURES, false /* supportsDetectInteraction */}}; diff --git a/biometrics/fingerprint/aidl/default/README.md b/biometrics/fingerprint/aidl/default/README.md new file mode 100644 index 0000000000..046602f00f --- /dev/null +++ b/biometrics/fingerprint/aidl/default/README.md @@ -0,0 +1,74 @@ +# Virtual Fingerprint HAL + +This is a virtual HAL implementation that is backed by system properties +instead of actual hardware. It's intended for testing and UI development +on debuggable builds to allow devices to masquerade as alternative device +types and for emulators. + +## Getting Started + +First, set the type of sensor the device should use, enable the virtual +extensions in the framework, and reboot. + +This doesn't work with HIDL and you typically need to have a PIN or password +set for things to work correctly, so this is a good time to set those too. + +```shell +$ adb root +$ adb shell settings put secure biometric_virtual_enabled 1 +$ adb shell setprop persist.vendor.fingerprint.virtual.type rear +$ adb shell locksettings set-pin 0000 +$ adb shell settings put secure com.android.server.biometrics.AuthService.hidlDisabled 1 +$ adb reboot +``` + +### Enrollments + +Next, setup enrollments on the device. This can either be done through +the UI, or via adb. + +#### UI Enrollment + + 1. Tee up the results of the enrollment before starting the process: + + ```shell + $ adb shell setprop vendor.fingerprint.virtual.next_enrollment 1:100,100,100:true + ``` + 2. Navigate to `Settings -> Security -> Fingerprint Unlock` and follow the prompts. + 3. Verify the enrollments in the UI: + + ```shell + $ adb shell getprop persist.vendor.fingerprint.virtual.enrollments + ``` + +#### Direct Enrollment + +To set enrollment directly without the UI: + +```shell +$ adb root +$ adb shell setprop persist.vendor.fingerprint.virtual.enrollments 1 +$ adb shell cmd fingerprint sync +``` + +Note: You may need to do this twice. The templates are checked +as part of some lazy operations, like user switching and startup, which can +cause the framework to delete the enrollments before the sync operation runs. +Until this is fixed, just run the commands twice as a workaround. + +### Authenticate + +To authenticate successfully set the enrolled id that should succeed. Unset it +or change the value to make authenticate operations fail: + +````shell +$ adb shell setprop vendor.fingerprint.virtual.enrollment_hit 1 +```` + +### View HAL State + +To view all the properties of the HAL (see `fingerprint.sysprop` for the API): + +```shell +$ adb shell getprop | grep vendor.fingerprint.virtual +``` diff --git a/biometrics/fingerprint/aidl/default/Session.cpp b/biometrics/fingerprint/aidl/default/Session.cpp index 452ed12b95..078d3d9dc7 100644 --- a/biometrics/fingerprint/aidl/default/Session.cpp +++ b/biometrics/fingerprint/aidl/default/Session.cpp @@ -101,7 +101,7 @@ ndk::ScopedAStatus Session::enroll(const keymaster::HardwareAuthToken& hat, if (shouldCancel(cancFuture)) { mCb->onError(Error::CANCELED, 0 /* vendorCode */); } else { - mEngine->enrollImpl(mCb.get(), hat); + mEngine->enrollImpl(mCb.get(), hat, cancFuture); } enterIdling(); })); @@ -123,7 +123,7 @@ ndk::ScopedAStatus Session::authenticate(int64_t operationId, if (shouldCancel(cancFuture)) { mCb->onError(Error::CANCELED, 0 /* vendorCode */); } else { - mEngine->authenticateImpl(mCb.get(), operationId); + mEngine->authenticateImpl(mCb.get(), operationId, cancFuture); } enterIdling(); })); @@ -144,7 +144,7 @@ ndk::ScopedAStatus Session::detectInteraction(std::shared_ptronError(Error::CANCELED, 0 /* vendorCode */); } else { - mEngine->detectInteractionImpl(mCb.get()); + mEngine->detectInteractionImpl(mCb.get(), cancFuture); } enterIdling(); })); diff --git a/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt b/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt new file mode 100644 index 0000000000..4724ff422f --- /dev/null +++ b/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt @@ -0,0 +1,85 @@ +props { + owner: Vendor + module: "android.fingerprint.virt.FingerprintHalProperties" + prop { + api_name: "authenticator_id" + type: Long + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.authenticator_id" + } + prop { + api_name: "challenge" + type: Long + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.challenge" + } + prop { + api_name: "enrollment_hit" + type: Integer + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.enrollment_hit" + } + prop { + api_name: "enrollments" + type: IntegerList + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.enrollments" + } + prop { + api_name: "lockout" + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.lockout" + } + prop { + api_name: "next_enrollment" + type: String + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.next_enrollment" + } + prop { + api_name: "operation_authenticate_duration" + type: Integer + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.operation_authenticate_duration" + } + prop { + api_name: "operation_authenticate_fails" + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.operation_authenticate_fails" + } + prop { + api_name: "operation_authenticate_latency" + type: Integer + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.operation_authenticate_latency" + } + prop { + api_name: "operation_detect_interaction_fails" + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_fails" + } + prop { + api_name: "operation_detect_interaction_latency" + type: Integer + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_latency" + } + prop { + api_name: "operation_enroll_fails" + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.operation_enroll_fails" + } + prop { + api_name: "operation_enroll_latency" + type: Integer + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.operation_enroll_latency" + } + prop { + api_name: "type" + type: String + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.type" + enum_values: "default|rear|udfps|side" + } +} diff --git a/biometrics/fingerprint/aidl/default/fingerprint.sysprop b/biometrics/fingerprint/aidl/default/fingerprint.sysprop new file mode 100644 index 0000000000..12c864890e --- /dev/null +++ b/biometrics/fingerprint/aidl/default/fingerprint.sysprop @@ -0,0 +1,135 @@ +# fingerprint.sysprop +# module becomes static class (Java) / namespace (C++) for serving API +module: "android.fingerprint.virt.FingerprintHalProperties" +owner: Vendor + +# type of fingerprint sensor +prop { + prop_name: "persist.vendor.fingerprint.virtual.type" + type: String + scope: Public + access: ReadWrite + enum_values: "default|rear|udfps|side" + api_name: "type" +} + +# ids of call current enrollments +prop { + prop_name: "persist.vendor.fingerprint.virtual.enrollments" + type: IntegerList + scope: Public + access: ReadWrite + api_name: "enrollments" +} + +# authenticate and detectInteraction will succeed with this +# enrollment id, when present, otherwise they will error +prop { + prop_name: "vendor.fingerprint.virtual.enrollment_hit" + type: Integer + scope: Public + access: ReadWrite + api_name: "enrollment_hit" +} + +# the next enrollment in the format: ":,,...:" +# for example: "2:0:true" +# this property is reset after enroll completes +prop { + prop_name: "vendor.fingerprint.virtual.next_enrollment" + type: String + scope: Public + access: ReadWrite + api_name: "next_enrollment" +} + +# value for getAuthenticatorId or 0 +prop { + prop_name: "vendor.fingerprint.virtual.authenticator_id" + type: Long + scope: Public + access: ReadWrite + api_name: "authenticator_id" +} + +# value for generateChallenge +prop { + prop_name: "vendor.fingerprint.virtual.challenge" + type: Long + scope: Public + access: ReadWrite + api_name: "challenge" +} + +# if locked out +prop { + prop_name: "vendor.fingerprint.virtual.lockout" + type: Boolean + scope: Public + access: ReadWrite + api_name: "lockout" +} + +# force all authenticate operations to fail +prop { + prop_name: "vendor.fingerprint.virtual.operation_authenticate_fails" + type: Boolean + scope: Public + access: ReadWrite + api_name: "operation_authenticate_fails" +} + +# force all detectInteraction operations to fail +prop { + prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_fails" + type: Boolean + scope: Public + access: ReadWrite + api_name: "operation_detect_interaction_fails" +} + +# force all enroll operations to fail +prop { + prop_name: "vendor.fingerprint.virtual.operation_enroll_fails" + type: Boolean + scope: Public + access: ReadWrite + api_name: "operation_enroll_fails" +} + +# add a latency to authentication operations +prop { + prop_name: "vendor.fingerprint.virtual.operation_authenticate_latency" + type: Integer + scope: Public + access: ReadWrite + api_name: "operation_authenticate_latency" +} + +# add a latency to detectInteraction operations +prop { + prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_latency" + type: Integer + scope: Public + access: ReadWrite + api_name: "operation_detect_interaction_latency" +} + +# add a latency to enroll operations +prop { + prop_name: "vendor.fingerprint.virtual.operation_enroll_latency" + type: Integer + scope: Public + access: ReadWrite + api_name: "operation_enroll_latency" +} + +# millisecond duration for authenticate operations +# (waits for changes to enrollment_hit) +prop { + prop_name: "vendor.fingerprint.virtual.operation_authenticate_duration" + type: Integer + scope: Public + access: ReadWrite + api_name: "operation_authenticate_duration" +} diff --git a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h index b92777068c..8659b79302 100644 --- a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h +++ b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h @@ -16,71 +16,33 @@ #pragma once -#include +#include + #include +#include "CancellationSignal.h" + +using namespace ::aidl::android::hardware::biometrics::common; + namespace aidl::android::hardware::biometrics::fingerprint { +// A fake engine that is backed by system properties instead of hardware. class FakeFingerprintEngine { public: FakeFingerprintEngine() : mRandom(std::mt19937::default_seed) {} - void generateChallengeImpl(ISessionCallback* cb) { - LOG(INFO) << "generateChallengeImpl"; - std::uniform_int_distribution dist; - auto challenge = dist(mRandom); - cb->onChallengeGenerated(challenge); - } - - void revokeChallengeImpl(ISessionCallback* cb, int64_t challenge) { - LOG(INFO) << "revokeChallengeImpl"; - cb->onChallengeRevoked(challenge); - } - - void enrollImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& hat) { - LOG(INFO) << "enrollImpl"; - // Do proper HAT verification in the real implementation. - if (hat.mac.empty()) { - cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */); - return; - } - cb->onEnrollmentProgress(0 /* enrollmentId */, 0 /* remaining */); - } - - void authenticateImpl(ISessionCallback* cb, int64_t /* operationId */) { - LOG(INFO) << "authenticateImpl"; - cb->onAuthenticationSucceeded(0 /* enrollmentId */, {} /* hat */); - } - - void detectInteractionImpl(ISessionCallback* cb) { - LOG(INFO) << "detectInteractionImpl"; - cb->onInteractionDetected(); - } - - void enumerateEnrollmentsImpl(ISessionCallback* cb) { - LOG(INFO) << "enumerateEnrollmentsImpl"; - cb->onEnrollmentsEnumerated({} /* enrollmentIds */); - } - - void removeEnrollmentsImpl(ISessionCallback* cb, const std::vector& enrollmentIds) { - LOG(INFO) << "removeEnrollmentsImpl"; - cb->onEnrollmentsRemoved(enrollmentIds); - } - - void getAuthenticatorIdImpl(ISessionCallback* cb) { - LOG(INFO) << "getAuthenticatorIdImpl"; - cb->onAuthenticatorIdRetrieved(0 /* authenticatorId */); - } - - void invalidateAuthenticatorIdImpl(ISessionCallback* cb) { - LOG(INFO) << "invalidateAuthenticatorIdImpl"; - cb->onAuthenticatorIdInvalidated(0 /* newAuthenticatorId */); - } - - void resetLockoutImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& /*hat*/) { - LOG(INFO) << "resetLockoutImpl"; - cb->onLockoutCleared(); - } + void generateChallengeImpl(ISessionCallback* cb); + void revokeChallengeImpl(ISessionCallback* cb, int64_t challenge); + void enrollImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& hat, + const std::future& cancel); + void authenticateImpl(ISessionCallback* cb, int64_t operationId, + const std::future& cancel); + void detectInteractionImpl(ISessionCallback* cb, const std::future& cancel); + void enumerateEnrollmentsImpl(ISessionCallback* cb); + void removeEnrollmentsImpl(ISessionCallback* cb, const std::vector& enrollmentIds); + void getAuthenticatorIdImpl(ISessionCallback* cb); + void invalidateAuthenticatorIdImpl(ISessionCallback* cb); + void resetLockoutImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& /*hat*/); std::mt19937 mRandom; }; diff --git a/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineTest.cpp b/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineTest.cpp new file mode 100644 index 0000000000..742d9335fd --- /dev/null +++ b/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineTest.cpp @@ -0,0 +1,297 @@ +/* + * Copyright (C) 2021 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. + */ + +#include +#include +#include + +#include + +#include "FakeFingerprintEngine.h" + +using namespace ::android::fingerprint::virt; +using namespace ::aidl::android::hardware::biometrics::fingerprint; +using namespace ::aidl::android::hardware::keymaster; + +namespace aidl::android::hardware::biometrics::fingerprint { + +class TestSessionCallback : public BnSessionCallback { + public: + ndk::ScopedAStatus onChallengeGenerated(int64_t challenge) override { + mLastChallenge = challenge; + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onChallengeRevoked(int64_t challenge) override { + mLastChallengeRevoked = challenge; + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onError(fingerprint::Error error, int32_t) override { + mError = error; + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onEnrollmentProgress(int32_t enrollmentId, int32_t remaining) override { + if (remaining == 0) mLastEnrolled = enrollmentId; + return ndk::ScopedAStatus::ok(); + }; + + ::ndk::ScopedAStatus onAuthenticationSucceeded(int32_t enrollmentId, + const keymaster::HardwareAuthToken&) override { + mLastAuthenticated = enrollmentId; + mAuthenticateFailed = false; + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onAuthenticationFailed() override { + mLastAuthenticated = 0; + mAuthenticateFailed = true; + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onInteractionDetected() override { + mInteractionDetectedCount++; + return ndk::ScopedAStatus::ok(); + }; + ndk::ScopedAStatus onAcquired(AcquiredInfo /*info*/, int32_t /*vendorCode*/) override { + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus onEnrollmentsEnumerated( + const std::vector& enrollmentIds) override { + mLastEnrollmentEnumerated = enrollmentIds; + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onEnrollmentsRemoved(const std::vector& enrollmentIds) override { + mLastEnrollmentRemoved = enrollmentIds; + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onAuthenticatorIdRetrieved(int64_t authenticatorId) override { + mLastAuthenticatorId = authenticatorId; + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onAuthenticatorIdInvalidated(int64_t authenticatorId) override { + mLastAuthenticatorId = authenticatorId; + mAuthenticatorIdInvalidated = true; + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onLockoutPermanent() override { + mLockoutPermanent = true; + return ndk::ScopedAStatus::ok(); + }; + ndk::ScopedAStatus onLockoutTimed(int64_t /* timeout */) override { + return ndk::ScopedAStatus::ok(); + } + ndk::ScopedAStatus onLockoutCleared() override { return ndk::ScopedAStatus::ok(); } + ndk::ScopedAStatus onSessionClosed() override { return ndk::ScopedAStatus::ok(); } + + Error mError = Error::UNKNOWN; + int64_t mLastChallenge = -1; + int64_t mLastChallengeRevoked = -1; + int32_t mLastEnrolled = -1; + int32_t mLastAuthenticated = -1; + int64_t mLastAuthenticatorId = -1; + std::vector mLastEnrollmentEnumerated; + std::vector mLastEnrollmentRemoved; + bool mAuthenticateFailed = false; + bool mAuthenticatorIdInvalidated = false; + bool mLockoutPermanent = false; + int mInteractionDetectedCount = 0; +}; + +class FakeFingerprintEngineTest : public ::testing::Test { + protected: + void SetUp() override { + FingerprintHalProperties::operation_enroll_latency(0); + FingerprintHalProperties::operation_authenticate_latency(0); + FingerprintHalProperties::operation_detect_interaction_latency(0); + mCallback = ndk::SharedRefBase::make(); + } + + FakeFingerprintEngine mEngine; + std::shared_ptr mCallback; + std::promise mCancel; +}; + +TEST_F(FakeFingerprintEngineTest, GenerateChallenge) { + mEngine.generateChallengeImpl(mCallback.get()); + ASSERT_EQ(FingerprintHalProperties::challenge().value(), mCallback->mLastChallenge); +} + +TEST_F(FakeFingerprintEngineTest, RevokeChallenge) { + auto challenge = FingerprintHalProperties::challenge().value_or(10); + mEngine.revokeChallengeImpl(mCallback.get(), challenge); + ASSERT_FALSE(FingerprintHalProperties::challenge().has_value()); + ASSERT_EQ(challenge, mCallback->mLastChallengeRevoked); +} + +TEST_F(FakeFingerprintEngineTest, ResetLockout) { + FingerprintHalProperties::lockout(true); + mEngine.resetLockoutImpl(mCallback.get(), {}); + ASSERT_FALSE(FingerprintHalProperties::lockout().value_or(true)); +} + +TEST_F(FakeFingerprintEngineTest, AuthenticatorId) { + FingerprintHalProperties::authenticator_id(50); + mEngine.getAuthenticatorIdImpl(mCallback.get()); + ASSERT_EQ(50, mCallback->mLastAuthenticatorId); + ASSERT_FALSE(mCallback->mAuthenticatorIdInvalidated); +} + +TEST_F(FakeFingerprintEngineTest, AuthenticatorIdInvalidate) { + FingerprintHalProperties::authenticator_id(500); + mEngine.invalidateAuthenticatorIdImpl(mCallback.get()); + ASSERT_NE(500, FingerprintHalProperties::authenticator_id().value()); + ASSERT_TRUE(mCallback->mAuthenticatorIdInvalidated); +} + +TEST_F(FakeFingerprintEngineTest, Enroll) { + FingerprintHalProperties::enrollments({}); + FingerprintHalProperties::next_enrollment("4:0,0:true"); + keymaster::HardwareAuthToken hat{.mac = {2, 4}}; + mEngine.enrollImpl(mCallback.get(), hat, mCancel.get_future()); + ASSERT_FALSE(FingerprintHalProperties::next_enrollment().has_value()); + ASSERT_EQ(1, FingerprintHalProperties::enrollments().size()); + ASSERT_EQ(4, FingerprintHalProperties::enrollments()[0].value()); + ASSERT_EQ(4, mCallback->mLastEnrolled); +} + +TEST_F(FakeFingerprintEngineTest, EnrollCancel) { + FingerprintHalProperties::enrollments({}); + auto next = "4:0,0:true"; + FingerprintHalProperties::next_enrollment(next); + keymaster::HardwareAuthToken hat{.mac = {2, 4}}; + mCancel.set_value(); + mEngine.enrollImpl(mCallback.get(), hat, mCancel.get_future()); + ASSERT_EQ(Error::CANCELED, mCallback->mError); + ASSERT_EQ(-1, mCallback->mLastEnrolled); + ASSERT_EQ(0, FingerprintHalProperties::enrollments().size()); + ASSERT_EQ(next, FingerprintHalProperties::next_enrollment().value_or("")); +} + +TEST_F(FakeFingerprintEngineTest, EnrollFail) { + FingerprintHalProperties::enrollments({}); + auto next = "2:0,0:false"; + FingerprintHalProperties::next_enrollment(next); + keymaster::HardwareAuthToken hat{.mac = {2, 4}}; + mEngine.enrollImpl(mCallback.get(), hat, mCancel.get_future()); + ASSERT_EQ(Error::UNABLE_TO_PROCESS, mCallback->mError); + ASSERT_EQ(-1, mCallback->mLastEnrolled); + ASSERT_EQ(0, FingerprintHalProperties::enrollments().size()); + ASSERT_FALSE(FingerprintHalProperties::next_enrollment().has_value()); +} + +TEST_F(FakeFingerprintEngineTest, Authenticate) { + FingerprintHalProperties::enrollments({1, 2}); + FingerprintHalProperties::enrollment_hit(2); + mEngine.authenticateImpl(mCallback.get(), 0, mCancel.get_future()); + ASSERT_FALSE(mCallback->mAuthenticateFailed); + ASSERT_EQ(2, mCallback->mLastAuthenticated); +} + +TEST_F(FakeFingerprintEngineTest, AuthenticateCancel) { + FingerprintHalProperties::enrollments({2}); + FingerprintHalProperties::enrollment_hit(2); + mCancel.set_value(); + mEngine.authenticateImpl(mCallback.get(), 0, mCancel.get_future()); + ASSERT_EQ(Error::CANCELED, mCallback->mError); + ASSERT_EQ(-1, mCallback->mLastAuthenticated); +} + +TEST_F(FakeFingerprintEngineTest, AuthenticateNotSet) { + FingerprintHalProperties::enrollments({1, 2}); + FingerprintHalProperties::enrollment_hit({}); + mEngine.authenticateImpl(mCallback.get(), 0, mCancel.get_future()); + ASSERT_TRUE(mCallback->mAuthenticateFailed); + ASSERT_EQ(mCallback->mError, Error::UNABLE_TO_PROCESS); +} + +TEST_F(FakeFingerprintEngineTest, AuthenticateNotEnrolled) { + FingerprintHalProperties::enrollments({1, 2}); + FingerprintHalProperties::enrollment_hit(3); + mEngine.authenticateImpl(mCallback.get(), 0, mCancel.get_future()); + ASSERT_TRUE(mCallback->mAuthenticateFailed); + ASSERT_EQ(mCallback->mError, Error::UNABLE_TO_PROCESS); +} + +TEST_F(FakeFingerprintEngineTest, AuthenticateLockout) { + FingerprintHalProperties::enrollments({22, 2}); + FingerprintHalProperties::enrollment_hit(2); + FingerprintHalProperties::lockout(true); + mEngine.authenticateImpl(mCallback.get(), 0, mCancel.get_future()); + ASSERT_TRUE(mCallback->mLockoutPermanent); + ASSERT_NE(mCallback->mError, Error::UNKNOWN); +} + +TEST_F(FakeFingerprintEngineTest, InteractionDetect) { + FingerprintHalProperties::enrollments({1, 2}); + FingerprintHalProperties::enrollment_hit(2); + mEngine.detectInteractionImpl(mCallback.get(), mCancel.get_future()); + ASSERT_EQ(1, mCallback->mInteractionDetectedCount); +} + +TEST_F(FakeFingerprintEngineTest, InteractionDetectCancel) { + FingerprintHalProperties::enrollments({1, 2}); + FingerprintHalProperties::enrollment_hit(2); + mCancel.set_value(); + mEngine.detectInteractionImpl(mCallback.get(), mCancel.get_future()); + ASSERT_EQ(Error::CANCELED, mCallback->mError); + ASSERT_EQ(0, mCallback->mInteractionDetectedCount); +} + +TEST_F(FakeFingerprintEngineTest, InteractionDetectNotSet) { + FingerprintHalProperties::enrollments({1, 2}); + FingerprintHalProperties::enrollment_hit({}); + mEngine.detectInteractionImpl(mCallback.get(), mCancel.get_future()); + ASSERT_EQ(0, mCallback->mInteractionDetectedCount); +} + +TEST_F(FakeFingerprintEngineTest, InteractionDetectNotEnrolled) { + FingerprintHalProperties::enrollments({1, 2}); + FingerprintHalProperties::enrollment_hit(25); + mEngine.detectInteractionImpl(mCallback.get(), mCancel.get_future()); + ASSERT_EQ(0, mCallback->mInteractionDetectedCount); +} + +TEST_F(FakeFingerprintEngineTest, EnumerateEnrolled) { + FingerprintHalProperties::enrollments({2, 4, 8}); + mEngine.enumerateEnrollmentsImpl(mCallback.get()); + ASSERT_EQ(3, mCallback->mLastEnrollmentEnumerated.size()); + for (auto id : FingerprintHalProperties::enrollments()) { + ASSERT_TRUE(std::find(mCallback->mLastEnrollmentEnumerated.begin(), + mCallback->mLastEnrollmentEnumerated.end(), + id) != mCallback->mLastEnrollmentEnumerated.end()); + } +} + +TEST_F(FakeFingerprintEngineTest, RemoveEnrolled) { + FingerprintHalProperties::enrollments({2, 4, 8, 1}); + mEngine.removeEnrollmentsImpl(mCallback.get(), {2, 8}); + auto enrolls = FingerprintHalProperties::enrollments(); + ASSERT_EQ(2, mCallback->mLastEnrollmentRemoved.size()); + for (auto id : {2, 8}) { + ASSERT_TRUE(std::find(mCallback->mLastEnrollmentRemoved.begin(), + mCallback->mLastEnrollmentRemoved.end(), + id) != mCallback->mLastEnrollmentRemoved.end()); + } + ASSERT_EQ(2, enrolls.size()); + for (auto id : {1, 4}) { + ASSERT_TRUE(std::find(enrolls.begin(), enrolls.end(), id) != enrolls.end()); + } +} + +} // namespace aidl::android::hardware::biometrics::fingerprint + +int main(int argc, char** argv) { + testing::InitGoogleTest(&argc, argv); + ABinderProcess_startThreadPool(); + return RUN_ALL_TESTS(); +} diff --git a/biometrics/fingerprint/aidl/vts/Android.bp b/biometrics/fingerprint/aidl/vts/Android.bp index 30d5624144..a474f661ad 100644 --- a/biometrics/fingerprint/aidl/vts/Android.bp +++ b/biometrics/fingerprint/aidl/vts/Android.bp @@ -15,8 +15,8 @@ cc_test { ], srcs: ["VtsHalBiometricsFingerprintTargetTest.cpp"], static_libs: [ - "android.hardware.biometrics.common-V1-ndk", - "android.hardware.biometrics.fingerprint-V1-ndk", + "android.hardware.biometrics.common-V2-ndk", + "android.hardware.biometrics.fingerprint-V2-ndk", "android.hardware.keymaster-V3-ndk", ], shared_libs: [ From db17f4f6e7b5db9b8cac25e1c3060cb34c78c1a0 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Tue, 12 Apr 2022 06:26:48 +0000 Subject: [PATCH 046/998] Add triggerImsDeregistration to IRadioImsIndication Bug: 216387835 Test: build & flash Change-Id: I1ef313c993816ee86233cdc5f17380ed157c38ee --- .../hardware/radio/ims/IRadioImsIndication.aidl | 1 + .../hardware/radio/ims/IRadioImsIndication.aidl | 12 ++++++++++++ radio/aidl/vts/radio_ims_indication.cpp | 4 ++++ radio/aidl/vts/radio_ims_utils.h | 2 ++ 4 files changed, 19 insertions(+) diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl index 06f7fa0a72..252da50b7e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl @@ -37,4 +37,5 @@ interface IRadioImsIndication { oneway void onConnectionSetupFailure(in android.hardware.radio.RadioIndicationType type, int token, in android.hardware.radio.ims.ConnectionFailureInfo info); oneway void onAccessAllowed(in android.hardware.radio.RadioIndicationType type, int token); oneway void notifyAnbr(in android.hardware.radio.RadioIndicationType type, int qosSessionId, android.hardware.radio.ims.ImsStreamDirection direction, int bitsPerSecond); + oneway void triggerImsDeregistration(in android.hardware.radio.RadioIndicationType type); } diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl index 317158cd29..ae35f2165a 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl @@ -57,4 +57,16 @@ oneway interface IRadioImsIndication { */ void notifyAnbr(in RadioIndicationType type, int qosSessionId, ImsStreamDirection direction, int bitsPerSecond); + + /** + * Fired by radio when a graceful IMS deregistration needs to be performed by telephony + * prior to radio performing network detach. Example scenarios are SIM refresh or user + * mode preference change which would cause network detach. The radio waits for the + * IMS deregistration, which will be notified by telephony via + * {@link IRadioIms#updateImsRegistrationInfo()}, or a certain timeout interval to start + * the network detach procedure. + * + * @param type Type of radio indication + */ + void triggerImsDeregistration(in RadioIndicationType type); } diff --git a/radio/aidl/vts/radio_ims_indication.cpp b/radio/aidl/vts/radio_ims_indication.cpp index f9c872f9c3..6f6d4f2931 100644 --- a/radio/aidl/vts/radio_ims_indication.cpp +++ b/radio/aidl/vts/radio_ims_indication.cpp @@ -31,4 +31,8 @@ ndk::ScopedAStatus RadioImsIndication::onAccessAllowed(RadioIndicationType /*typ ndk::ScopedAStatus RadioImsIndication::notifyAnbr(RadioIndicationType /*type*/, int /*qosSessionId*/, ImsStreamDirection /*direction*/, int /*bitsPerSecond*/) { return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioImsIndication::triggerImsDeregistration(RadioIndicationType /*type*/) { + return ndk::ScopedAStatus::ok(); } \ No newline at end of file diff --git a/radio/aidl/vts/radio_ims_utils.h b/radio/aidl/vts/radio_ims_utils.h index 61e42543d4..541077fca4 100644 --- a/radio/aidl/vts/radio_ims_utils.h +++ b/radio/aidl/vts/radio_ims_utils.h @@ -67,6 +67,8 @@ class RadioImsIndication : public BnRadioImsIndication { virtual ndk::ScopedAStatus notifyAnbr(RadioIndicationType type, int qosSessionId, ImsStreamDirection direction, int bitsPerSecond) override; + + virtual ndk::ScopedAStatus triggerImsDeregistration(RadioIndicationType type) override; }; // The main test class for Radio AIDL Ims. From c02436d8bcbcb51aa0d55582bd611bd15f5fbd70 Mon Sep 17 00:00:00 2001 From: Mahesh Telang Date: Mon, 4 Apr 2022 17:22:21 -0700 Subject: [PATCH 047/998] Emergency Call domain selection HAL API changes. Emergency Call domain selection HAL API changes. Test: Functional test on test device. Bug: 228118865 Change-Id: I01f5440f8a38dee4b79ecaa39bd9f04ce3bccfac --- .../hardware/radio/network/EmergencyMode.aidl | 40 +++++++++++++ .../network/EmergencyNetworkScanTrigger.aidl | 39 +++++++++++++ .../radio/network/EmergencyRegResult.aidl | 43 ++++++++++++++ .../radio/network/EmergencyScanType.aidl | 40 +++++++++++++ .../hardware/radio/network/IRadioNetwork.aidl | 4 ++ .../network/IRadioNetworkIndication.aidl | 1 + .../radio/network/IRadioNetworkResponse.aidl | 4 ++ .../hardware/radio/network/EmergencyMode.aidl | 40 +++++++++++++ .../network/EmergencyNetworkScanTrigger.aidl | 35 ++++++++++++ .../radio/network/EmergencyRegResult.aidl | 57 +++++++++++++++++++ .../radio/network/EmergencyScanType.aidl | 40 +++++++++++++ .../hardware/radio/network/IRadioNetwork.aidl | 42 ++++++++++++++ .../network/IRadioNetworkIndication.aidl | 9 +++ .../radio/network/IRadioNetworkResponse.aidl | 48 ++++++++++++++++ 14 files changed, 442 insertions(+) create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyMode.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyRegResult.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyScanType.aidl create mode 100644 radio/aidl/android/hardware/radio/network/EmergencyMode.aidl create mode 100644 radio/aidl/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl create mode 100644 radio/aidl/android/hardware/radio/network/EmergencyRegResult.aidl create mode 100644 radio/aidl/android/hardware/radio/network/EmergencyScanType.aidl diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyMode.aidl new file mode 100644 index 0000000000..071e6b5012 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyMode.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum EmergencyMode { + EMERGENCY_WWAN = 1, + EMERGENCY_WLAN = 2, + EMERGENCY_CALLBACK = 3, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl new file mode 100644 index 0000000000..2797affc01 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable EmergencyNetworkScanTrigger { + android.hardware.radio.AccessNetwork[] accessNetwork; + android.hardware.radio.network.EmergencyScanType scanType; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyRegResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyRegResult.aidl new file mode 100644 index 0000000000..cb598f3e5d --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyRegResult.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable EmergencyRegResult { + android.hardware.radio.AccessNetwork accessNetwork; + android.hardware.radio.network.RegState regState; + android.hardware.radio.network.Domain emcDomain; + boolean isEmcBearerSupported; + byte nwProvidedEmc; + byte nwProvidedEmf; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyScanType.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyScanType.aidl new file mode 100644 index 0000000000..5e86c76a43 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyScanType.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum EmergencyScanType { + NO_PREFERENCE = 0, + LIMITED_SERVICE = 1, + FULL_SERVICE = 2, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl index 2b70e45084..832738ffbf 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl @@ -70,4 +70,8 @@ interface IRadioNetwork { oneway void supplyNetworkDepersonalization(in int serial, in String netPin); oneway void setUsageSetting(in int serial, in android.hardware.radio.network.UsageSetting usageSetting); oneway void getUsageSetting(in int serial); + oneway void setEmergencyMode(int serial, in android.hardware.radio.network.EmergencyMode emcModeType); + oneway void triggerEmergencyNetworkScan(int serial, in android.hardware.radio.network.EmergencyNetworkScanTrigger request); + oneway void cancelEmergencyNetworkScan(in int serial); + oneway void exitEmergencyMode(in int serial); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl index bd03c51ec7..0f017ea8ba 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl @@ -48,4 +48,5 @@ interface IRadioNetworkIndication { oneway void restrictedStateChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.PhoneRestrictedState state); oneway void suppSvcNotify(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.SuppSvcNotification suppSvc); oneway void voiceRadioTechChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.RadioTechnology rat); + oneway void emergencyNetworkScanResult(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.EmergencyRegResult result); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl index 5f6c7369f4..24d587e655 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -69,4 +69,8 @@ interface IRadioNetworkResponse { oneway void supplyNetworkDepersonalizationResponse(in android.hardware.radio.RadioResponseInfo info, in int remainingRetries); oneway void setUsageSettingResponse(in android.hardware.radio.RadioResponseInfo info); oneway void getUsageSettingResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.UsageSetting usageSetting); + oneway void setEmergencyModeResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.EmergencyRegResult regState); + oneway void triggerEmergencyNetworkScanResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void exitEmergencyModeResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void cancelEmergencyNetworkScanResponse(in android.hardware.radio.RadioResponseInfo info); } diff --git a/radio/aidl/android/hardware/radio/network/EmergencyMode.aidl b/radio/aidl/android/hardware/radio/network/EmergencyMode.aidl new file mode 100644 index 0000000000..25031a9790 --- /dev/null +++ b/radio/aidl/android/hardware/radio/network/EmergencyMode.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ + +package android.hardware.radio.network; + +@VintfStability +@Backing(type="int") +@JavaDerive(toString=true) +enum EmergencyMode { + /** + * Mode Type Emergency WWAN, indicates that the current domain selected for the Emergency call + * is cellular. + */ + EMERGENCY_WWAN = 1, + + /** + * Mode Type Emergency WLAN, indicates that the current domain selected for the Emergency call + * is WLAN/WIFI. + */ + EMERGENCY_WLAN = 2, + + /** + * Mode Type Emergency Callback, indicates that the current mode set request is for Emergency + * callback. + */ + EMERGENCY_CALLBACK = 3, +} diff --git a/radio/aidl/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl b/radio/aidl/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl new file mode 100644 index 0000000000..0a22e4c93a --- /dev/null +++ b/radio/aidl/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl @@ -0,0 +1,35 @@ +/* + * 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. + */ + +package android.hardware.radio.network; +import android.hardware.radio.AccessNetwork; +import android.hardware.radio.network.EmergencyScanType; + +@VintfStability +@JavaDerive(toString=true) +parcelable EmergencyNetworkScanTrigger{ + /** + * Access network to be prioritized during emergency scan. The 1st entry has the highest + * priority. + */ + AccessNetwork[] accessNetwork; + + /** + * Scan type indicates the type of scans to be performed i.e. limited scan, full service scan or + * any scan. + */ + EmergencyScanType scanType; +} diff --git a/radio/aidl/android/hardware/radio/network/EmergencyRegResult.aidl b/radio/aidl/android/hardware/radio/network/EmergencyRegResult.aidl new file mode 100644 index 0000000000..cf5caa45b8 --- /dev/null +++ b/radio/aidl/android/hardware/radio/network/EmergencyRegResult.aidl @@ -0,0 +1,57 @@ +/* + * 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. + */ + +package android.hardware.radio.network; +import android.hardware.radio.AccessNetwork; +import android.hardware.radio.network.RegState; +import android.hardware.radio.network.Domain; + +@VintfStability +@JavaDerive(toString=true) +parcelable EmergencyRegResult { + /** + * Indicates the cellular access network of the current emergency capable system. + */ + AccessNetwork accessNetwork; + + /** + * Registration state of the current emergency capable system. + */ + RegState regState; + + /** + * EMC domain indicates the current domain of the acquired system. + */ + Domain emcDomain; + + /** + * This indicates if camped network support VoLTE emergency bearers. + * This should only be set if the UE is in LTE mode. + */ + boolean isEmcBearerSupported; + + /** + * The value of the network provided EMC 5G Registration ACCEPT. + * This should be set only if the UE is in 5G mode. + */ + byte nwProvidedEmc; + + /** + * The value of the network provided EMF ( EPS Fallback) in 5G Registration ACCEPT. + * This should not be set if UE is not in 5G mode. + */ + byte nwProvidedEmf; +} diff --git a/radio/aidl/android/hardware/radio/network/EmergencyScanType.aidl b/radio/aidl/android/hardware/radio/network/EmergencyScanType.aidl new file mode 100644 index 0000000000..72c54903c1 --- /dev/null +++ b/radio/aidl/android/hardware/radio/network/EmergencyScanType.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ + +package android.hardware.radio.network; + +@VintfStability +@Backing(type="int") +@JavaDerive(toString=true) +enum EmergencyScanType { + /** + * Scan Type No Preference, indicates that the modem can scan for emergency + * service as per modem’s implementation. + */ + NO_PREFERENCE = 0, + + /** + * Scan Type limited, indicates that the modem will scan for + * emergency service in limited service mode. + */ + LIMITED_SERVICE = 1, + + /** + * Scan Type Full Service, indicates that the modem will scan for + * emergency service in Full service mode. + */ + FULL_SERVICE = 2, +} diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl index cce52ffe52..0ac8b0e83e 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl @@ -27,6 +27,8 @@ import android.hardware.radio.network.RadioAccessSpecifier; import android.hardware.radio.network.RadioBandMode; import android.hardware.radio.network.SignalThresholdInfo; import android.hardware.radio.network.UsageSetting; +import android.hardware.radio.network.EmergencyNetworkScanTrigger; +import android.hardware.radio.network.EmergencyMode; /** * This interface is used by telephony and telecom to talk to cellular radio for network APIs. @@ -437,4 +439,44 @@ oneway interface IRadioNetwork { * @param serial Serial number of request. */ oneway void getUsageSetting(in int serial); + + /** + * Set the Emergency Mode + * + * @param serial Serial number of the request. + * @param emcModeType Defines the radio emergency mode type/radio network required/ + * type of service to be scanned. + * + * Response function is IRadioEmergencyResponse.setEmergencyModeResponse() + */ + void setEmergencyMode(int serial, in EmergencyMode emcModeType ); + + /** + * Triggers an Emergency network scan. + * + * @param serial Serial number of the request. + * @param request Defines the radio target networks/preferred network/ + * Max Scan Time and type of service to be scanned. + * + * Response function is IRadioEmergencyResponse.triggerEmergencyNetworkScanResponse() + */ + void triggerEmergencyNetworkScan( int serial, in EmergencyNetworkScanTrigger request); + + /** + * Cancels ongoing Emergency network scan + * + * @param serial Serial number of the request. + * + * Response function is IRadioEmergencyResponse.cancelEmergencyNetworkScan() + */ + void cancelEmergencyNetworkScan(in int serial); + + /** + * Exits ongoing Emergency Mode + * + * @param serial Serial number of the request. + * + * Response function is IRadioEmergencyResponse.exitEmergencyModeResponse() + */ + void exitEmergencyMode(in int serial); } diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl index f471433780..47d932d909 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl @@ -27,6 +27,7 @@ import android.hardware.radio.network.PhoneRestrictedState; import android.hardware.radio.network.PhysicalChannelConfig; import android.hardware.radio.network.SignalStrength; import android.hardware.radio.network.SuppSvcNotification; +import android.hardware.radio.network.EmergencyRegResult; /** * Interface declaring unsolicited radio indications for network APIs. @@ -190,4 +191,12 @@ oneway interface IRadioNetworkIndication { * @param rat Current new voice rat */ void voiceRadioTechChanged(in RadioIndicationType type, in RadioTechnology rat); + + /** + * Emergency Scan Results. + * + * @param type Type of radio indication + * @param result the result of the Emergency Network Scan + */ + void emergencyNetworkScanResult(in RadioIndicationType type, in EmergencyRegResult result); } diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl index dcf0004d6c..d98a31bfc8 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -29,6 +29,7 @@ import android.hardware.radio.network.RadioBandMode; import android.hardware.radio.network.RegStateResult; import android.hardware.radio.network.SignalStrength; import android.hardware.radio.network.UsageSetting; +import android.hardware.radio.network.EmergencyRegResult; /** * Interface declaring response functions to solicited radio requests for network APIs. @@ -572,4 +573,51 @@ oneway interface IRadioNetworkResponse { * RadioError:SIM_ABSENT */ oneway void getUsageSettingResponse(in RadioResponseInfo info, in UsageSetting usageSetting); + + /** + * @param info Response info struct containing response type, serial no. and error. + * @param regState the current registration state of the modem. + * + * Valid errors returned: + * RadioError:NONE + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:MODEM_ERR + * RadioError:INVALID_ARGUMENTS + */ + void setEmergencyModeResponse(in RadioResponseInfo info, in EmergencyRegResult regState); + + /** + * @param info Response info struct containing response type, serial no. and error + * + * Valid errors returned: + * RadioError:NONE + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:MODEM_ERR + * RadioError:INVALID_ARGUMENTS + */ + void triggerEmergencyNetworkScanResponse(in RadioResponseInfo info); + + /** + * @param info Response info struct containing response type, serial no. and error + * + * Valid errors returned: + * RadioError:NONE + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:MODEM_ERR + */ + void exitEmergencyModeResponse(in RadioResponseInfo info); + + /** + * @param info Response info struct containing response type, serial no. and error + * + * Valid errors returned: + * RadioError:NONE + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:MODEM_ERR + */ + void cancelEmergencyNetworkScanResponse(in RadioResponseInfo info); } From 446519a3707c71b71c4f3148779f76a7b97d01cb Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Sat, 16 Apr 2022 11:14:18 +0900 Subject: [PATCH 048/998] Explicitly depend on V1 of android.media.audio.common.types ... for the same reason as cc489264afe295ffe9e01cf97d9bf43e690f7d84 Bug: 225941299 Test: m Change-Id: I269d61c8c441b3db0832f5450f5e5a84a5989a99 --- audio/aidl/Android.bp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index 05e22bfdbd..c998858b09 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -81,7 +81,7 @@ aidl_interface { ], imports: [ "android.hardware.audio.common-V1", - "android.media.audio.common.types", + "android.media.audio.common.types-V1", ], stability: "vintf", backend: { From bde01c60fadb8da6a1a24bca3dd21e17229c4316 Mon Sep 17 00:00:00 2001 From: "deyaoren@google.com" Date: Tue, 5 Apr 2022 22:16:49 +0000 Subject: [PATCH 049/998] Cuttlefish sensors apex uses aidl implementation Bug: 210883464 Test: atest hal_implementation VtsAidlHalSensorsTargetTest Tests run on abtd: https://android-build.googleplex.com/builds/abtd/run/L63300000953949688 https://android-build.googleplex.com/builds/abtd/run/L18600000953935211 One test is failing on tip of tree Change-Id: Iec27e916c94e5a327fc6c4d87451e055b14d9660 --- sensors/2.1/default/apex/apex_manifest.json | 4 ---- sensors/aidl/default/Android.bp | 14 ++++++++++++-- sensors/{2.1 => aidl}/default/apex/Android.bp | 13 ++++++++++--- sensors/aidl/default/apex/apex_manifest.json | 4 ++++ .../apex/com.android.hardware.sensors.avbpubkey | Bin .../default/apex/com.android.hardware.sensors.pem | 0 .../default/apex/com.android.hardware.sensors.pk8 | Bin .../default/apex/com.android.hardware.sensors.rc | 0 .../apex/com.android.hardware.sensors.x509.pem | 0 sensors/{2.1 => aidl}/default/apex/file_contexts | 0 10 files changed, 26 insertions(+), 9 deletions(-) delete mode 100644 sensors/2.1/default/apex/apex_manifest.json rename sensors/{2.1 => aidl}/default/apex/Android.bp (78%) create mode 100644 sensors/aidl/default/apex/apex_manifest.json rename sensors/{2.1 => aidl}/default/apex/com.android.hardware.sensors.avbpubkey (100%) rename sensors/{2.1 => aidl}/default/apex/com.android.hardware.sensors.pem (100%) rename sensors/{2.1 => aidl}/default/apex/com.android.hardware.sensors.pk8 (100%) rename sensors/{2.1 => aidl}/default/apex/com.android.hardware.sensors.rc (100%) rename sensors/{2.1 => aidl}/default/apex/com.android.hardware.sensors.x509.pem (100%) rename sensors/{2.1 => aidl}/default/apex/file_contexts (100%) diff --git a/sensors/2.1/default/apex/apex_manifest.json b/sensors/2.1/default/apex/apex_manifest.json deleted file mode 100644 index 47e45ee63e..0000000000 --- a/sensors/2.1/default/apex/apex_manifest.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "com.android.hardware.sensors", - "version": 1 -} diff --git a/sensors/aidl/default/Android.bp b/sensors/aidl/default/Android.bp index 49841a456b..3c66744324 100644 --- a/sensors/aidl/default/Android.bp +++ b/sensors/aidl/default/Android.bp @@ -23,6 +23,16 @@ package { default_applicable_licenses: ["hardware_interfaces_license"], } +filegroup { + name: "sensors-default.rc", + srcs: ["sensors-default.rc"], +} + +filegroup { + name: "sensors-default.xml", + srcs: ["sensors-default.xml"], +} + cc_library_static { name: "libsensorsexampleimpl", vendor: true, @@ -47,8 +57,8 @@ cc_library_static { cc_binary { name: "android.hardware.sensors-service.example", relative_install_path: "hw", - init_rc: ["sensors-default.rc"], - vintf_fragments: ["sensors-default.xml"], + init_rc: [":sensors-default.rc"], + vintf_fragments: [":sensors-default.xml"], vendor: true, shared_libs: [ "libbase", diff --git a/sensors/2.1/default/apex/Android.bp b/sensors/aidl/default/apex/Android.bp similarity index 78% rename from sensors/2.1/default/apex/Android.bp rename to sensors/aidl/default/apex/Android.bp index 3345b92b90..ceb428b5da 100644 --- a/sensors/2.1/default/apex/Android.bp +++ b/sensors/aidl/default/apex/Android.bp @@ -13,9 +13,16 @@ android_app_certificate { certificate: "com.android.hardware.sensors", } +genrule { + name: "com.android.hardware.sensors.rc-gen", + srcs: [":sensors-default.rc"], + out: ["com.android.hardware.sensors.rc"], + cmd: "sed -E 's/\\/vendor/\\/apex\\/com.android.hardware.sensors/' $(in) > $(out)", +} + prebuilt_etc { name: "com.android.hardware.sensors.rc", - src: "com.android.hardware.sensors.rc", + src: ":com.android.hardware.sensors.rc-gen", installable: false, } @@ -31,7 +38,7 @@ apex { updatable: false, // Install the apex in /vendor/apex soc_specific: true, - binaries: ["android.hardware.sensors@2.1-service.mock"], + binaries: ["android.hardware.sensors-service.example"], prebuilts: [ "com.android.hardware.sensors.rc", "android.hardware.sensor.ambient_temperature.prebuilt.xml", @@ -42,5 +49,5 @@ apex { "android.hardware.sensor.proximity.prebuilt.xml", "android.hardware.sensor.relative_humidity.prebuilt.xml", ], - vintf_fragments: [":android.hardware.sensors@2.1.xml"], + vintf_fragments: [":sensors-default.xml"], } diff --git a/sensors/aidl/default/apex/apex_manifest.json b/sensors/aidl/default/apex/apex_manifest.json new file mode 100644 index 0000000000..659e739c66 --- /dev/null +++ b/sensors/aidl/default/apex/apex_manifest.json @@ -0,0 +1,4 @@ +{ + "name": "com.android.hardware.sensors", + "version": 1 +} diff --git a/sensors/2.1/default/apex/com.android.hardware.sensors.avbpubkey b/sensors/aidl/default/apex/com.android.hardware.sensors.avbpubkey similarity index 100% rename from sensors/2.1/default/apex/com.android.hardware.sensors.avbpubkey rename to sensors/aidl/default/apex/com.android.hardware.sensors.avbpubkey diff --git a/sensors/2.1/default/apex/com.android.hardware.sensors.pem b/sensors/aidl/default/apex/com.android.hardware.sensors.pem similarity index 100% rename from sensors/2.1/default/apex/com.android.hardware.sensors.pem rename to sensors/aidl/default/apex/com.android.hardware.sensors.pem diff --git a/sensors/2.1/default/apex/com.android.hardware.sensors.pk8 b/sensors/aidl/default/apex/com.android.hardware.sensors.pk8 similarity index 100% rename from sensors/2.1/default/apex/com.android.hardware.sensors.pk8 rename to sensors/aidl/default/apex/com.android.hardware.sensors.pk8 diff --git a/sensors/2.1/default/apex/com.android.hardware.sensors.rc b/sensors/aidl/default/apex/com.android.hardware.sensors.rc similarity index 100% rename from sensors/2.1/default/apex/com.android.hardware.sensors.rc rename to sensors/aidl/default/apex/com.android.hardware.sensors.rc diff --git a/sensors/2.1/default/apex/com.android.hardware.sensors.x509.pem b/sensors/aidl/default/apex/com.android.hardware.sensors.x509.pem similarity index 100% rename from sensors/2.1/default/apex/com.android.hardware.sensors.x509.pem rename to sensors/aidl/default/apex/com.android.hardware.sensors.x509.pem diff --git a/sensors/2.1/default/apex/file_contexts b/sensors/aidl/default/apex/file_contexts similarity index 100% rename from sensors/2.1/default/apex/file_contexts rename to sensors/aidl/default/apex/file_contexts From d349f1d5213dc14d90016efb5e4934a80888064c Mon Sep 17 00:00:00 2001 From: Chris Weir Date: Mon, 18 Apr 2022 15:12:39 -0700 Subject: [PATCH 050/998] Unregistering HIDL interfaces breaks VTS Based on some back and forth on the internal IDL discuss group, it sounds like we can't unregister interfaces anymore if they're defined in the manifest. The CAN interface behind the HIDL interface will still be taken down correctly, but this will get rid of the failing attempt to bring down the HIDL interface. Bug: 213841914 Bug: 213843613 Test: VtsHalCanBusV1_0TargetTest Test: VtsHalCanControllerV1_0TargetTest Test: VtsHalCanBusVirtualV1_0TargetTest Change-Id: Iae4d6a650c30adacdc7c51140e0295915b516833 --- automotive/can/1.0/default/CanController.cpp | 14 --- .../VtsHalCanControllerV1_0TargetTest.cpp | 111 +++++++++++++----- 2 files changed, 81 insertions(+), 44 deletions(-) diff --git a/automotive/can/1.0/default/CanController.cpp b/automotive/can/1.0/default/CanController.cpp index 9c0f2c57a2..1b5bf5b48b 100644 --- a/automotive/can/1.0/default/CanController.cpp +++ b/automotive/can/1.0/default/CanController.cpp @@ -292,14 +292,6 @@ Return CanController::upInterface(const ICanController:: return ICanController::Result::OK; } -static bool unregisterCanBusService(const hidl_string& name, sp busService) { - auto manager = hidl::manager::V1_2::IServiceManager::getService(); - if (!manager) return false; - const auto res = manager->tryUnregister(ICanBus::descriptor, name, busService); - if (!res.isOk()) return false; - return res; -} - Return CanController::downInterface(const hidl_string& name) { LOG(VERBOSE) << "Attempting to bring interface down: " << name; @@ -313,12 +305,6 @@ Return CanController::downInterface(const hidl_string& name) { auto success = true; - if (!unregisterCanBusService(name, busEntry.mapped())) { - LOG(ERROR) << "Couldn't unregister " << name; - // don't return yet, let's try to do best-effort cleanup - success = false; - } - if (!busEntry.mapped()->down()) { LOG(ERROR) << "Couldn't bring " << name << " down"; success = false; diff --git a/automotive/can/1.0/vts/functional/VtsHalCanControllerV1_0TargetTest.cpp b/automotive/can/1.0/vts/functional/VtsHalCanControllerV1_0TargetTest.cpp index 294cd17758..f8ae871b33 100644 --- a/automotive/can/1.0/vts/functional/VtsHalCanControllerV1_0TargetTest.cpp +++ b/automotive/can/1.0/vts/functional/VtsHalCanControllerV1_0TargetTest.cpp @@ -33,18 +33,45 @@ using hardware::hidl_vec; using InterfaceType = ICanController::InterfaceType; using IfId = ICanController::BusConfig::InterfaceId; +struct Bus { + DISALLOW_COPY_AND_ASSIGN(Bus); + + Bus(sp controller, const ICanController::BusConfig& config) + : mIfname(config.name), mController(controller) { + // Don't bring up the bus, we just need a wrapper for the ICanBus object + /* Not using ICanBus::getService here, since it ignores interfaces not in the manifest + * file -- this is a test, so we don't want to add fake services to a device manifest. */ + auto manager = hidl::manager::V1_2::IServiceManager::getService(); + auto service = manager->get(ICanBus::descriptor, config.name); + mBus = ICanBus::castFrom(service); + } + + ICanBus* operator->() const { return mBus.get(); } + sp get() { return mBus; } + + Return send(const CanMessage& msg) { return mBus->send(msg); } + + private: + const std::string mIfname; + sp mController; + sp mBus; +}; + class CanControllerHalTest : public ::testing::TestWithParam { protected: virtual void SetUp() override; virtual void TearDown() override; static void SetUpTestCase(); + Bus makeBus(const std::string ifaceName); + hidl_vec getSupportedInterfaceTypes(); bool isSupported(InterfaceType iftype); bool up(InterfaceType iftype, const std::string srvname, std::string ifname, ICanController::Result expected); - void assertRegistered(const std::string srvname, bool expectRegistered); + void assertRegistered(const std::string srvname, const std::string ifaceName, + bool expectRegistered); sp mCanController; static hidl_vec mBusNames; @@ -117,16 +144,33 @@ bool CanControllerHalTest::up(InterfaceType iftype, std::string srvname, std::st return true; } -void CanControllerHalTest::assertRegistered(std::string srvname, bool expectRegistered) { +void CanControllerHalTest::assertRegistered(const std::string srvname, const std::string ifaceName, + bool expectRegistered) { /* Not using ICanBus::tryGetService here, since it ignores interfaces not in the manifest * file -- this is a test, so we don't want to add fake services to a device manifest. */ auto manager = hidl::manager::V1_2::IServiceManager::getService(); auto busService = manager->get(ICanBus::descriptor, srvname); + if (!expectRegistered) { + /* We can't unregister a HIDL interface defined in the manifest, so we'll just check to make + * sure that the interface behind it is down */ + auto bus = makeBus(ifaceName); + const auto result = bus->send({}); + ASSERT_EQ(Result::INTERFACE_DOWN, result); + return; + } ASSERT_EQ(expectRegistered, busService.withDefault(nullptr) != nullptr) << "ICanBus/" << srvname << (expectRegistered ? " is not " : " is ") << "registered" << " (should be otherwise)"; } +Bus CanControllerHalTest::makeBus(const std::string ifaceName) { + ICanController::BusConfig config = {}; + config.name = mBusNames[0]; + config.interfaceId.virtualif({ifaceName}); + + return Bus(mCanController, config); +} + TEST_P(CanControllerHalTest, SupportsSomething) { const auto supported = getSupportedInterfaceTypes(); ASSERT_GT(supported.size(), 0u); @@ -134,15 +178,17 @@ TEST_P(CanControllerHalTest, SupportsSomething) { TEST_P(CanControllerHalTest, BringUpDown) { const std::string name = mBusNames[0]; + const std::string iface = "vcan57"; + mCanController->downInterface(name); - assertRegistered(name, false); - if (!up(InterfaceType::VIRTUAL, name, "vcan57", ICanController::Result::OK)) GTEST_SKIP(); - assertRegistered(name, true); + assertRegistered(name, iface, false); + + if (!up(InterfaceType::VIRTUAL, name, iface, ICanController::Result::OK)) GTEST_SKIP(); + assertRegistered(name, iface, true); const auto dnresult = mCanController->downInterface(name); ASSERT_TRUE(dnresult); - - assertRegistered(name, false); + assertRegistered(name, iface, false); } TEST_P(CanControllerHalTest, DownFake) { @@ -152,18 +198,19 @@ TEST_P(CanControllerHalTest, DownFake) { TEST_P(CanControllerHalTest, UpTwice) { const std::string name = mBusNames[0]; + const std::string iface = "vcan72"; - assertRegistered(name, false); - if (!up(InterfaceType::VIRTUAL, name, "vcan72", ICanController::Result::OK)) GTEST_SKIP(); - assertRegistered(name, true); + assertRegistered(name, iface, false); + if (!up(InterfaceType::VIRTUAL, name, iface, ICanController::Result::OK)) GTEST_SKIP(); + assertRegistered(name, iface, true); if (!up(InterfaceType::VIRTUAL, name, "vcan73", ICanController::Result::INVALID_STATE)) { GTEST_SKIP(); } - assertRegistered(name, true); + assertRegistered(name, iface, true); const auto result = mCanController->downInterface(name); ASSERT_TRUE(result); - assertRegistered(name, false); + assertRegistered(name, iface, false); } TEST_P(CanControllerHalTest, ConfigCompatibility) { @@ -230,63 +277,67 @@ TEST_P(CanControllerHalTest, ConfigCompatibility) { TEST_P(CanControllerHalTest, FailEmptyName) { const std::string name = ""; + const std::string iface = "vcan57"; - assertRegistered(name, false); - if (!up(InterfaceType::VIRTUAL, name, "vcan57", ICanController::Result::BAD_SERVICE_NAME)) { + assertRegistered(name, iface, false); + if (!up(InterfaceType::VIRTUAL, name, iface, ICanController::Result::BAD_SERVICE_NAME)) { GTEST_SKIP(); } - assertRegistered(name, false); + assertRegistered(name, iface, false); } TEST_P(CanControllerHalTest, FailBadName) { // 33 characters (name can be at most 32 characters long) const std::string name = "ab012345678901234567890123456789c"; + const std::string iface = "vcan57"; - assertRegistered(name, false); - if (!up(InterfaceType::VIRTUAL, name, "vcan57", ICanController::Result::BAD_SERVICE_NAME)) { + assertRegistered(name, iface, false); + if (!up(InterfaceType::VIRTUAL, name, iface, ICanController::Result::BAD_SERVICE_NAME)) { GTEST_SKIP(); } - assertRegistered(name, false); + assertRegistered(name, iface, false); } TEST_P(CanControllerHalTest, FailBadVirtualAddress) { const std::string name = mBusNames[0]; + const std::string iface = ""; - assertRegistered(name, false); - if (!up(InterfaceType::VIRTUAL, name, "", ICanController::Result::BAD_INTERFACE_ID)) { + assertRegistered(name, iface, false); + if (!up(InterfaceType::VIRTUAL, name, iface, ICanController::Result::BAD_INTERFACE_ID)) { GTEST_SKIP(); } - assertRegistered(name, false); + assertRegistered(name, iface, false); } TEST_P(CanControllerHalTest, FailBadSocketcanAddress) { const std::string name = mBusNames[0]; + const std::string iface = "can87"; - assertRegistered(name, false); - if (!up(InterfaceType::SOCKETCAN, name, "can87", ICanController::Result::BAD_INTERFACE_ID)) { + assertRegistered(name, iface, false); + if (!up(InterfaceType::SOCKETCAN, name, iface, ICanController::Result::BAD_INTERFACE_ID)) { GTEST_SKIP(); } - assertRegistered(name, false); + assertRegistered(name, iface, false); auto supported = up(InterfaceType::SOCKETCAN, name, "", ICanController::Result::BAD_INTERFACE_ID); ASSERT_TRUE(supported); - assertRegistered(name, false); + assertRegistered(name, iface, false); } TEST_P(CanControllerHalTest, FailBadSlcanAddress) { const std::string name = mBusNames[0]; + const std::string iface = "/dev/shouldnotexist123"; - assertRegistered(name, false); - if (!up(InterfaceType::SLCAN, name, "/dev/shouldnotexist123", - ICanController::Result::BAD_INTERFACE_ID)) { + assertRegistered(name, iface, false); + if (!up(InterfaceType::SLCAN, name, iface, ICanController::Result::BAD_INTERFACE_ID)) { GTEST_SKIP(); } - assertRegistered(name, false); + assertRegistered(name, iface, false); auto supported = up(InterfaceType::SLCAN, name, "", ICanController::Result::BAD_INTERFACE_ID); ASSERT_TRUE(supported); - assertRegistered(name, false); + assertRegistered(name, iface, false); } /** From 5cab46158f0a23060b667ee7a3f5cd79511774e6 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Wed, 20 Apr 2022 23:31:24 +0000 Subject: [PATCH 051/998] Specify the version of android.hardware.radio interface To fix the broken build: error: hardware/interfaces/radio/aidl/Android.bp:269:1: ... VNDK-core must only depend on VND-core or VNDK-SP Test: build Change-Id: I8a9ac3840d81c3627ad3ad54c6299d6c3ec914f4 --- radio/aidl/Android.bp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp index 99d7f18d43..ab4309ef81 100644 --- a/radio/aidl/Android.bp +++ b/radio/aidl/Android.bp @@ -157,7 +157,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/network/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio"], + imports: ["android.hardware.radio-V1"], backend: { cpp: { enabled: true, @@ -249,7 +249,7 @@ aidl_interface { vendor_available: true, srcs: ["android/hardware/radio/ims/media/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio", + imports: ["android.hardware.radio-V1", "android.hardware.radio.data-V1"], backend: { cpp: { @@ -271,7 +271,7 @@ aidl_interface { vendor_available: true, srcs: ["android/hardware/radio/ims/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio"], + imports: ["android.hardware.radio-V1"], backend: { cpp: { enabled: false, From 9069825c4d1bb22fe8108efed421baf9e19a241a Mon Sep 17 00:00:00 2001 From: Chris Weir Date: Fri, 22 Apr 2022 13:01:08 -0700 Subject: [PATCH 052/998] Fix VtsHalCanBusV1_0TargetTest VtsHalCanBusV1_0TargetTest needs buses brought up. On GSI images, canhalctrl doesn't exist, so we have to attempt it on our own. Bug: 213841914 Test: VtsHalCanBusV1_0TargetTest Change-Id: I5553a95d047aef8e9d8e1eb6092cddea98f6d81e --- .../functional/VtsHalCanBusV1_0TargetTest.cpp | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/automotive/can/1.0/vts/functional/VtsHalCanBusV1_0TargetTest.cpp b/automotive/can/1.0/vts/functional/VtsHalCanBusV1_0TargetTest.cpp index d91d9f5035..a6e7baddc9 100644 --- a/automotive/can/1.0/vts/functional/VtsHalCanBusV1_0TargetTest.cpp +++ b/automotive/can/1.0/vts/functional/VtsHalCanBusV1_0TargetTest.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -27,6 +28,8 @@ namespace android::hardware::automotive::can::V1_0::vts { using hardware::hidl_vec; +using InterfaceType = ICanController::InterfaceType; +using IfId = ICanController::BusConfig::InterfaceId; struct CanMessageListener : public can::V1_0::ICanMessageListener { virtual Return onReceive(const can::V1_0::CanMessage&) override { return {}; } @@ -41,22 +44,62 @@ class CanBusHalTest : public ::testing::TestWithParam { virtual void SetUp() override; virtual void TearDown() override; + bool up(InterfaceType iftype, const std::string& srvname, const std::string& ifname); + std::tuple> listen(const hidl_vec& filter, const sp& listener); sp listenForErrors(const sp& listener); sp mCanBus; + sp mCanController; }; void CanBusHalTest::SetUp() { mCanBus = ICanBus::getService(GetParam()); ASSERT_TRUE(mCanBus) << "Couldn't open CAN Bus: " << GetParam(); + const auto controllers = getAllHalInstanceNames(ICanController::descriptor); + ASSERT_GT(controllers.size(), 0u); + // just grab the first one + mCanController = ICanController::getService(controllers[0]); + ASSERT_TRUE(mCanController) << "Couldn't open CAN Controller: " << controllers[0]; + + // this will throw an error if the bus is already up, but we have to try. + up(InterfaceType::VIRTUAL, GetParam(), "vcan0"); } void CanBusHalTest::TearDown() { mCanBus.clear(); } +bool CanBusHalTest::up(InterfaceType iftype, const std::string& srvname, + const std::string& ifname) { + ICanController::BusConfig config = {}; + config.name = srvname; + + // TODO(b/146214370): move interfaceId constructors to a library + if (iftype == InterfaceType::SOCKETCAN) { + IfId::Socketcan socketcan = {}; + socketcan.ifname(ifname); + config.interfaceId.socketcan(socketcan); + } else if (iftype == InterfaceType::SLCAN) { + IfId::Slcan slcan = {}; + slcan.ttyname(ifname); + config.interfaceId.slcan(slcan); + } else if (iftype == InterfaceType::VIRTUAL) { + config.interfaceId.virtualif({ifname}); + } else { + ADD_FAILURE() << "Unexpected iftype: " << toString(iftype); + } + + const auto upresult = mCanController->upInterface(config); + if (upresult != ICanController::Result::OK) { + // upInterface returns INVALID_STATE if the interface is already up (which is fine). + EXPECT_EQ(ICanController::Result::INVALID_STATE, upresult) + << ifname << " can't be brought up!"; + } + return true; +} + std::tuple> CanBusHalTest::listen( const hidl_vec& filter, const sp& listener) { Result halResult; From f3ef4ffe8df1e005ca9bd58f3567ad4f17c9014d Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Tue, 29 Mar 2022 03:10:35 +0000 Subject: [PATCH 053/998] Update IRadioIms HAL - Replace notifyImsTraffic with startImsTraffic and stopImsTraffic. - Remove performAcbCheck and onAccessAllowed - Remove REGISTERING from ImsRegistration. - Replace FEATURE_ with IMS_MMTEL_CAPABILITY_ in ImsRegistration Bug: 216387835 Test: build & flash Change-Id: I19999ef54609c1027879201e792691ddaea48bd3 --- .../android/hardware/radio/ims/IRadioIms.aidl | 4 +- .../radio/ims/IRadioImsIndication.aidl | 3 +- .../hardware/radio/ims/IRadioImsResponse.aidl | 4 +- .../hardware/radio/ims/ImsFailureReason.aidl | 41 +++++++ .../hardware/radio/ims/ImsRegistration.aidl | 39 ++----- .../radio/ims/ImsRegistrationState.aidl | 39 +++++++ .../radio/ims/ImsStreamDirection.aidl | 6 +- .../hardware/radio/ims/ImsTrafficType.aidl | 1 + .../android/hardware/radio/ims/IRadioIms.aidl | 40 +++---- .../radio/ims/IRadioImsIndication.aidl | 16 +-- .../hardware/radio/ims/IRadioImsResponse.aidl | 7 +- .../hardware/radio/ims/ImsFailureReason.aidl | 43 ++++++++ .../hardware/radio/ims/ImsRegistration.aidl | 103 +++++------------- .../radio/ims/ImsRegistrationState.aidl | 27 +++++ .../hardware/radio/ims/ImsTrafficType.aidl | 5 +- radio/aidl/vts/radio_ims_indication.cpp | 7 +- radio/aidl/vts/radio_ims_response.cpp | 8 +- radio/aidl/vts/radio_ims_test.cpp | 33 +++--- radio/aidl/vts/radio_ims_utils.h | 12 +- 19 files changed, 252 insertions(+), 186 deletions(-) create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsFailureReason.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistrationState.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/ImsFailureReason.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/ImsRegistrationState.aidl diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl index 5ccf584d1b..8a0c2108ac 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl @@ -36,8 +36,8 @@ package android.hardware.radio.ims; interface IRadioIms { oneway void setSrvccCallInfo(int serial, in android.hardware.radio.ims.SrvccCall[] srvccCalls); oneway void updateImsRegistrationInfo(int serial, in android.hardware.radio.ims.ImsRegistration imsRegistration); - oneway void notifyImsTraffic(int serial, int token, android.hardware.radio.ims.ImsTrafficType imsTrafficType, boolean isStart); - oneway void performAcbCheck(int serial, int token, android.hardware.radio.ims.ImsTrafficType imsTrafficType); + oneway void startImsTraffic(int serial, in String token, android.hardware.radio.ims.ImsTrafficType imsTrafficType, android.hardware.radio.AccessNetwork accessNetworkType); + oneway void stopImsTraffic(int serial, in String token); oneway void setResponseFunctions(in android.hardware.radio.ims.IRadioImsResponse radioImsResponse, in android.hardware.radio.ims.IRadioImsIndication radioImsIndication); oneway void setAnbrEnabled(int serial, int qosSessionId, boolean isEnabled); oneway void sendAnbrQuery(int serial, int qosSessionId, android.hardware.radio.ims.ImsStreamDirection direction, int bitsPerSecond); diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl index 252da50b7e..d91fb0b153 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl @@ -34,8 +34,7 @@ package android.hardware.radio.ims; @VintfStability interface IRadioImsIndication { - oneway void onConnectionSetupFailure(in android.hardware.radio.RadioIndicationType type, int token, in android.hardware.radio.ims.ConnectionFailureInfo info); - oneway void onAccessAllowed(in android.hardware.radio.RadioIndicationType type, int token); + oneway void onConnectionSetupFailure(in android.hardware.radio.RadioIndicationType type, in String token, in android.hardware.radio.ims.ConnectionFailureInfo info); oneway void notifyAnbr(in android.hardware.radio.RadioIndicationType type, int qosSessionId, android.hardware.radio.ims.ImsStreamDirection direction, int bitsPerSecond); oneway void triggerImsDeregistration(in android.hardware.radio.RadioIndicationType type); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl index 60f396f3ae..c75c7eacae 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl @@ -36,8 +36,8 @@ package android.hardware.radio.ims; interface IRadioImsResponse { oneway void setSrvccCallInfoResponse(in android.hardware.radio.RadioResponseInfo info); oneway void updateImsRegistrationInfoResponse(in android.hardware.radio.RadioResponseInfo info); - oneway void notifyImsTrafficResponse(in android.hardware.radio.RadioResponseInfo info); - oneway void performAcbCheckResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void startImsTrafficResponse(in android.hardware.radio.RadioResponseInfo info, in @nullable android.hardware.radio.ims.ConnectionFailureInfo failureInfo); + oneway void stopImsTrafficResponse(in android.hardware.radio.RadioResponseInfo info); oneway void setAnbrEnabledResponse(in android.hardware.radio.RadioResponseInfo info); oneway void sendAnbrQueryResponse(in android.hardware.radio.RadioResponseInfo info); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsFailureReason.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsFailureReason.aidl new file mode 100644 index 0000000000..63a3674fb5 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsFailureReason.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@Backing(type="int") @VintfStability +enum ImsFailureReason { + NONE = 0, + FATAL_ERROR = 1, + REPEATED_ERROR = 2, + TEMPORARY_ERROR = 3, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl index f843095d1b..4ee106ddec 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl @@ -34,34 +34,13 @@ package android.hardware.radio.ims; @VintfStability parcelable ImsRegistration { - android.hardware.radio.ims.ImsRegistration.State state; - android.hardware.radio.ims.ImsRegistration.ImsAccessNetwork ipcan; - android.hardware.radio.ims.ImsRegistration.FailureReason reason; - int features; - const int FEATURE_NONE = 0; - const int FEATURE_VOICE = 1; - const int FEATURE_VIDEO = 2; - const int FEATURE_SMS = 4; - @Backing(type="int") @VintfStability - enum State { - NOT_REGISTERED = 0, - REGISTERING = 1, - REGISTERED = 2, - } - @Backing(type="int") @VintfStability - enum ImsAccessNetwork { - NONE = 0, - EUTRAN = 1, - NGRAN = 2, - UTRAN = 3, - IWLAN = 4, - CROSS_SIM = 5, - } - @Backing(type="int") @VintfStability - enum FailureReason { - NONE = 0, - FATAL_ERROR = 1, - REPEATED_ERROR = 2, - TEMPORARY_ERROR = 3, - } + android.hardware.radio.ims.ImsRegistrationState regState; + android.hardware.radio.AccessNetwork accessNetworkType; + android.hardware.radio.ims.ImsFailureReason reason; + int capabilities; + const int IMS_MMTEL_CAPABILITY_NONE = 0; + const int IMS_MMTEL_CAPABILITY_VOICE = 1; + const int IMS_MMTEL_CAPABILITY_VIDEO = 2; + const int IMS_MMTEL_CAPABILITY_SMS = 4; + const int IMS_RCS_CAPABILITIES = 8; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistrationState.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistrationState.aidl new file mode 100644 index 0000000000..58ffc6f7a2 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistrationState.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@Backing(type="int") @VintfStability +enum ImsRegistrationState { + NOT_REGISTERED = 0, + REGISTERED = 1, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl index b5a33c736c..2d41897267 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl @@ -34,6 +34,6 @@ package android.hardware.radio.ims; @Backing(type="int") @VintfStability enum ImsStreamDirection { - UPLINK = 1, - DOWNLINK = 2, -} \ No newline at end of file + UPLINK = 1, + DOWNLINK = 2, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl index 413faa7571..b0625c23b4 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl @@ -40,4 +40,5 @@ enum ImsTrafficType { VIDEO = 3, SMS = 4, REGISTRATION = 5, + UT_XCAP = 6, } diff --git a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl index cae6bd04b4..77b6c9afeb 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl @@ -16,12 +16,13 @@ package android.hardware.radio.ims; +import android.hardware.radio.AccessNetwork; import android.hardware.radio.ims.ImsRegistration; +import android.hardware.radio.ims.ImsStreamDirection; import android.hardware.radio.ims.ImsTrafficType; import android.hardware.radio.ims.IRadioImsIndication; import android.hardware.radio.ims.IRadioImsResponse; import android.hardware.radio.ims.SrvccCall; -import android.hardware.radio.ims.ImsStreamDirection; /** * This interface is used by IMS telephony layer to talk to cellular radio. @@ -66,37 +67,30 @@ oneway interface IRadioIms { * This API shall be used by modem * 1. To set the appropriate establishment cause in RRC connection request. * 2. To prioritize RF resources in case of DSDS. The service priority is - * EMERGENCY > EMERGENCY SMS > VOICE > VIDEO > SMS > REGISTRATION > BACKGROUND - * DATA. The RF shall be prioritized to the subscription which handles higher - * priority service. When both subscriptions are handling the same type of - * service then RF shall be prioritized to the voice preferred sub. + * EMERGENCY > EMERGENCY SMS > VOICE > VIDEO > SMS > REGISTRATION > Ut/XCAP. The RF + * shall be prioritized to the subscription which handles higher priority service. + * When both subscriptions are handling the same type of service then RF shall be + * prioritized to the voice preferred sub. * - * @param token Token number of the request + * @param token A nonce to identify the request * @param imsTrafficType IMS traffic type like registration, voice, and video - * @param isStart true when the traffic flow starts, false when traffic flow stops. - * false will not be notified for SMS as it's a short traffic. + * @param accessNetworkType The type of the radio access network used * - * Response function is IRadioImsResponse.notifyImsTrafficResponse() + * Response function is IRadioImsResponse.startImsTrafficResponse() */ - void notifyImsTraffic(int serial, int token, - ImsTrafficType imsTrafficType, boolean isStart); + void startImsTraffic(int serial, in String token, + ImsTrafficType imsTrafficType, AccessNetwork accessNetworkType); /** - * This API shall check access class barring checks based on ImsTrafficType. - * In case of access class is allowed then - * IRadioImsIndication#onAccessAllowed(token) shall be invoked by radio - * so the IMS stack can transmit the data. - * In case of access is denied - * IRadioImsIndication#onConnectionSetupFailure(token, REASON_ACCESS_DENIED) - * shall be invoked. + * Indicates IMS traffic has been stopped. + * For all IMS traffic, notified with startImsTraffic, IMS service shall notify + * stopImsTraffic when it completes the traffic specified by the token. * - * @param token Token number of the request - * @param imsTrafficType IMS traffic type like registration, voice - * video, SMS, emergency etc + * @param token The token assigned by startImsTraffic() * - * Response function is IRadioImsResponse.performAcbCheckResponse() + * Response function is IRadioImsResponse.stopImsTrafficResponse() */ - void performAcbCheck(int serial, int token, ImsTrafficType imsTrafficType); + void stopImsTraffic(int serial, in String token); /** * Set response functions for IMS radio requests and indications. diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl index ae35f2165a..74a21071ef 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl @@ -27,24 +27,16 @@ import android.hardware.radio.ims.ImsStreamDirection; oneway interface IRadioImsIndication { /** * Fired by radio when any IMS traffic is not sent to network due to any failure - * on cellular networks. + * on cellular networks. IMS service shall call stopImsTraffic when receiving + * this indication. * - * @param token The token number of the notifyImsTraffic() or performACBcheck() APIs + * @param token The token of startImsTraffic() associated with this indication * @param type Type of radio indication * @param info Connection failure information */ - void onConnectionSetupFailure(in RadioIndicationType type, int token, + void onConnectionSetupFailure(in RadioIndicationType type, in String token, in ConnectionFailureInfo info); - /** - * Fired by radio in response to performAcbCheck(token, trafficType) - * if the access class check is allowed for the requested traffic type. - * - * @param token The token of the operation of performAcbCheck() API - * @param type Type of radio indication - */ - void onAccessAllowed(in RadioIndicationType type, int token); - /** * Access Network Bitrate Recommendation (ANBR), see 3GPP TS 26.114. * Notifies the bit rate received from the network via ANBR message diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl index 7cc58a6747..e5a3a6c97f 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl @@ -17,6 +17,7 @@ package android.hardware.radio.ims; import android.hardware.radio.RadioResponseInfo; +import android.hardware.radio.ims.ConnectionFailureInfo; /** * Interface declaring response functions to solicited radio requests for ims APIs. @@ -60,6 +61,7 @@ oneway interface IRadioImsResponse { /** * @param info Response info struct containing response type, serial no. and error + * @param failureInfo Information about failure in detail * * Valid errors returned: * RadioError:NONE @@ -73,7 +75,8 @@ oneway interface IRadioImsResponse { * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES */ - void notifyImsTrafficResponse(in RadioResponseInfo info); + void startImsTrafficResponse(in RadioResponseInfo info, + in @nullable ConnectionFailureInfo failureInfo); /** * @param info Response info struct containing response type, serial no. and error @@ -90,7 +93,7 @@ oneway interface IRadioImsResponse { * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES */ - void performAcbCheckResponse(in RadioResponseInfo info); + void stopImsTrafficResponse(in RadioResponseInfo info); /** * @param info Response info struct containing response type, serial no. and error diff --git a/radio/aidl/android/hardware/radio/ims/ImsFailureReason.aidl b/radio/aidl/android/hardware/radio/ims/ImsFailureReason.aidl new file mode 100644 index 0000000000..a227dca18d --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/ImsFailureReason.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ + +package android.hardware.radio.ims; + +@VintfStability +@Backing(type="int") +enum ImsFailureReason { + /** Default value */ + NONE, + + /** + * Indicates that the IMS registration is failed with fatal error such as 403 or 404 + * on all P-CSCF addresses. The radio shall block the current PLMN or disable + * the RAT as per the carrier requirements. + */ + FATAL_ERROR, + + /** + * Indicates that the IMS registration on current PLMN failed multiple times. + * The radio shall block the current PLMN or disable the RAT as per the + * carrier requirements. + */ + REPEATED_ERROR, + + /** + * Indicates that IMS registration has failed temporarily. A retry will be done shortly. + */ + TEMPORARY_ERROR, +} diff --git a/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl b/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl index a011b4002a..3982ac87e8 100644 --- a/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl +++ b/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl @@ -16,90 +16,37 @@ package android.hardware.radio.ims; +import android.hardware.radio.AccessNetwork; +import android.hardware.radio.ims.ImsFailureReason; +import android.hardware.radio.ims.ImsRegistrationState; + @VintfStability parcelable ImsRegistration { - - @VintfStability - @Backing(type="int") - enum State { - /** IMS is not registered */ - NOT_REGISTERED, - /** - * IMS registration procedure just started. - * It could be used by radio to start IMS establishment timer based on carrier requirements. - */ - REGISTERING, - /** IMS is successfully registered */ - REGISTERED, - } - - @VintfStability - @Backing(type="int") - enum ImsAccessNetwork { - /** - * Indicates the access network where IMS is registered. If IMS is registered on - * cellular then the radio shall wait for IMS PDN disconnection for 4 seconds - * before performing NAS detach procedure. This requirement is not applicable for - * if access network IWLAN and CROSS_SIM. - */ - NONE, - EUTRAN, - NGRAN, - UTRAN, - /** The IMS registration is done over WiFi network. */ - IWLAN, - /** - * The radio shall not consider the registration information with this type - * while voice domain selection is performed. - * The IMS registration is done over internet of the default data subscription. - */ - CROSS_SIM, - } - - @VintfStability - @Backing(type="int") - enum FailureReason { - /** Default value */ - NONE, - /** - * Indicates that the IMS registration is failed with fatal error 403 or 404 - * on all P-CSCF addresses. The radio shall block the current PLMN or disable - * the RAT as per the carrier requirements. - */ - FATAL_ERROR, - /** - * Indicates that the IMS registration on current PLMN failed multiple times. - * The radio shall block the current PLMN or disable the RAT as per the - * carrier requirements. - */ - REPEATED_ERROR, - /* - * Indicates that IMS registration has failed temporarily. - */ - TEMPORARY_ERROR, - } - /** Default value */ - const int FEATURE_NONE = 0; - /** IMS voice feature */ - const int FEATURE_VOICE = 1 << 0; - /** IMS video feature */ - const int FEATURE_VIDEO = 1 << 1; - /** IMS SMS feature */ - const int FEATURE_SMS = 1 << 2; + const int IMS_MMTEL_CAPABILITY_NONE = 0; + /** IMS voice */ + const int IMS_MMTEL_CAPABILITY_VOICE = 1 << 0; + /** IMS video */ + const int IMS_MMTEL_CAPABILITY_VIDEO = 1 << 1; + /** IMS SMS */ + const int IMS_MMTEL_CAPABILITY_SMS = 1 << 2; + /** IMS RCS */ + const int IMS_RCS_CAPABILITIES = 1 << 3; /** Indicates the current IMS registration state. */ - State state; - - /** Indicates the IP connectivity access network where IMS features are registered. */ - ImsAccessNetwork ipcan; - - /** Indicates a failure reason for IMS registration. */ - FailureReason reason; + ImsRegistrationState regState; /** - * Values are bitwise ORs of FEATURE_. - * IMS features such as VOICE, VIDEO and SMS. + * Indicates the type of the radio access network where IMS is registered. */ - int features; + AccessNetwork accessNetworkType; + + /** Indicates a failure reason for IMS registration. */ + ImsFailureReason reason; + + /** + * Values are bitwise ORs of IMS_MMTEL_CAPABILITY_* constants and IMS_RCS_CAPABILITIES. + * IMS capability such as VOICE, VIDEO, SMS and RCS. + */ + int capabilities; } diff --git a/radio/aidl/android/hardware/radio/ims/ImsRegistrationState.aidl b/radio/aidl/android/hardware/radio/ims/ImsRegistrationState.aidl new file mode 100644 index 0000000000..21769d5442 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/ImsRegistrationState.aidl @@ -0,0 +1,27 @@ +/* + * 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. + */ + +package android.hardware.radio.ims; + +@VintfStability +@Backing(type="int") +enum ImsRegistrationState { + /** IMS is not registered */ + NOT_REGISTERED, + + /** IMS is successfully registered */ + REGISTERED, +} \ No newline at end of file diff --git a/radio/aidl/android/hardware/radio/ims/ImsTrafficType.aidl b/radio/aidl/android/hardware/radio/ims/ImsTrafficType.aidl index f6d16ca7e5..32baa044a1 100644 --- a/radio/aidl/android/hardware/radio/ims/ImsTrafficType.aidl +++ b/radio/aidl/android/hardware/radio/ims/ImsTrafficType.aidl @@ -36,4 +36,7 @@ enum ImsTrafficType { /** IMS registration and subscription for reg event package (signaling) */ REGISTRATION, -} + + /** Ut/XCAP (XML Configuration Access Protocol) */ + UT_XCAP +} \ No newline at end of file diff --git a/radio/aidl/vts/radio_ims_indication.cpp b/radio/aidl/vts/radio_ims_indication.cpp index 6f6d4f2931..9c821ffcdf 100644 --- a/radio/aidl/vts/radio_ims_indication.cpp +++ b/radio/aidl/vts/radio_ims_indication.cpp @@ -19,12 +19,7 @@ RadioImsIndication::RadioImsIndication(RadioServiceTest& parent) : parent_ims(parent) {} ndk::ScopedAStatus RadioImsIndication::onConnectionSetupFailure(RadioIndicationType /*type*/, - int /*token*/, const ConnectionFailureInfo& /*info*/) { - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus RadioImsIndication::onAccessAllowed(RadioIndicationType /*type*/, - int /*token*/) { + const std::string& /*token*/, const ConnectionFailureInfo& /*info*/) { return ndk::ScopedAStatus::ok(); } diff --git a/radio/aidl/vts/radio_ims_response.cpp b/radio/aidl/vts/radio_ims_response.cpp index dd629a5e5b..fa34dc17f9 100644 --- a/radio/aidl/vts/radio_ims_response.cpp +++ b/radio/aidl/vts/radio_ims_response.cpp @@ -31,13 +31,15 @@ ndk::ScopedAStatus RadioImsResponse::updateImsRegistrationInfoResponse( return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus RadioImsResponse::notifyImsTrafficResponse(const RadioResponseInfo& info) { +ndk::ScopedAStatus RadioImsResponse::startImsTrafficResponse(const RadioResponseInfo& info, + const std::optional& response) { rspInfo = info; + startImsTrafficResp = response; parent_ims.notify(info.serial); return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus RadioImsResponse::performAcbCheckResponse(const RadioResponseInfo& info) { +ndk::ScopedAStatus RadioImsResponse::stopImsTrafficResponse(const RadioResponseInfo& info) { rspInfo = info; parent_ims.notify(info.serial); return ndk::ScopedAStatus::ok(); @@ -53,4 +55,4 @@ ndk::ScopedAStatus RadioImsResponse::sendAnbrQueryResponse(const RadioResponseIn rspInfo = info; parent_ims.notify(info.serial); return ndk::ScopedAStatus::ok(); -} \ No newline at end of file +} diff --git a/radio/aidl/vts/radio_ims_test.cpp b/radio/aidl/vts/radio_ims_test.cpp index 52c5f02c22..84b7c6ae34 100644 --- a/radio/aidl/vts/radio_ims_test.cpp +++ b/radio/aidl/vts/radio_ims_test.cpp @@ -92,10 +92,10 @@ TEST_P(RadioImsTest, updateImsRegistrationInfo) { serial = GetRandomSerialNumber(); ImsRegistration regInfo; - regInfo.state = ImsRegistration::State::NOT_REGISTERED; - regInfo.ipcan = ImsRegistration::ImsAccessNetwork::NONE; - regInfo.reason = ImsRegistration::FailureReason::NONE; - regInfo.features = ImsRegistration::FEATURE_NONE; + regInfo.regState = ImsRegistrationState::NOT_REGISTERED; + regInfo.accessNetworkType = AccessNetwork::EUTRAN; + regInfo.reason = ImsFailureReason::NONE; + regInfo.capabilities = ImsRegistration::IMS_MMTEL_CAPABILITY_NONE; ndk::ScopedAStatus res = radio_ims->updateImsRegistrationInfo(serial, regInfo); @@ -111,52 +111,53 @@ TEST_P(RadioImsTest, updateImsRegistrationInfo) { } /* - * Test IRadioIms.notifyImsTraffic() for the response returned. + * Test IRadioIms.startImsTraffic() for the response returned. */ -TEST_P(RadioImsTest, notifyImsTraffic) { +TEST_P(RadioImsTest, startImsTraffic) { if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) { - ALOGI("Skipping notifyImsTraffic because ims is not supported in device"); + ALOGI("Skipping startImsTraffic because ims is not supported in device"); return; } else { - ALOGI("Running notifyImsTraffic because ims is supported in device"); + ALOGI("Running startImsTraffic because ims is supported in device"); } serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = - radio_ims->notifyImsTraffic(serial, 1, ImsTrafficType::REGISTRATION, false); + radio_ims->startImsTraffic(serial, std::string("1"), + ImsTrafficType::REGISTRATION, AccessNetwork::EUTRAN); ASSERT_OK(res); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type); EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial); - ALOGI("notifyImsTraffic, rspInfo.error = %s\n", + ALOGI("startImsTraffic, rspInfo.error = %s\n", toString(radioRsp_ims->rspInfo.error).c_str()); verifyError(radioRsp_ims->rspInfo.error); } /* - * Test IRadioIms.performAcbCheck() for the response returned. + * Test IRadioIms.stopImsTraffic() for the response returned. */ -TEST_P(RadioImsTest, performAcbCheck) { +TEST_P(RadioImsTest, stopImsTraffic) { if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) { - ALOGI("Skipping performAcbCheck because ims is not supported in device"); + ALOGI("Skipping stopImsTraffic because ims is not supported in device"); return; } else { - ALOGI("Running performAcbCheck because ims is supported in device"); + ALOGI("Running stopImsTraffic because ims is supported in device"); } serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = - radio_ims->performAcbCheck(serial, 1, ImsTrafficType::REGISTRATION); + radio_ims->stopImsTraffic(serial, std::string("2")); ASSERT_OK(res); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type); EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial); - ALOGI("performAcbCheck, rspInfo.error = %s\n", + ALOGI("stopImsTraffic, rspInfo.error = %s\n", toString(radioRsp_ims->rspInfo.error).c_str()); verifyError(radioRsp_ims->rspInfo.error); diff --git a/radio/aidl/vts/radio_ims_utils.h b/radio/aidl/vts/radio_ims_utils.h index 541077fca4..2967476295 100644 --- a/radio/aidl/vts/radio_ims_utils.h +++ b/radio/aidl/vts/radio_ims_utils.h @@ -36,15 +36,17 @@ class RadioImsResponse : public BnRadioImsResponse { virtual ~RadioImsResponse() = default; RadioResponseInfo rspInfo; + std::optional startImsTrafficResp; virtual ndk::ScopedAStatus setSrvccCallInfoResponse(const RadioResponseInfo& info) override; virtual ndk::ScopedAStatus updateImsRegistrationInfoResponse( const RadioResponseInfo& info) override; - virtual ndk::ScopedAStatus notifyImsTrafficResponse(const RadioResponseInfo& info) override; + virtual ndk::ScopedAStatus startImsTrafficResponse(const RadioResponseInfo& info, + const std::optional& response) override; - virtual ndk::ScopedAStatus performAcbCheckResponse(const RadioResponseInfo& info) override; + virtual ndk::ScopedAStatus stopImsTrafficResponse(const RadioResponseInfo& info) override; virtual ndk::ScopedAStatus setAnbrEnabledResponse(const RadioResponseInfo& info) override; @@ -60,10 +62,8 @@ class RadioImsIndication : public BnRadioImsIndication { RadioImsIndication(RadioServiceTest& parent_ims); virtual ~RadioImsIndication() = default; - virtual ndk::ScopedAStatus onConnectionSetupFailure(RadioIndicationType type, int token, - const ConnectionFailureInfo& info) override; - - virtual ndk::ScopedAStatus onAccessAllowed(RadioIndicationType type, int token) override; + virtual ndk::ScopedAStatus onConnectionSetupFailure(RadioIndicationType type, + const std::string& token, const ConnectionFailureInfo& info) override; virtual ndk::ScopedAStatus notifyAnbr(RadioIndicationType type, int qosSessionId, ImsStreamDirection direction, int bitsPerSecond) override; From bc352866fecfcb64f7c173d8c6e9c129bc1b159b Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Sat, 9 Apr 2022 00:29:29 +0000 Subject: [PATCH 054/998] Support fake data generator in FakeVehicleHardware. Support dump command 'genfakedata' in FakeVehicleHardware. Client could use this command to generate fake events. This is used in vehiclehal integration test. Test: atest FakeVehicleHardwareTest Bug: 199314530 Change-Id: Id7abcf289debe22f29f4299cc93417ac51bc1a3b --- .../GeneratorHub/include/GeneratorHub.h | 4 +- .../include/JsonFakeValueGenerator.h | 3 + .../GeneratorHub/src/GeneratorHub.cpp | 6 +- .../src/JsonFakeValueGenerator.cpp | 4 + .../hardware/include/FakeVehicleHardware.h | 12 + .../hardware/src/FakeVehicleHardware.cpp | 179 +++++++++++- .../impl/fake_impl/hardware/test/Android.bp | 6 + .../hardware/test/FakeVehicleHardwareTest.cpp | 254 +++++++++++++++++- .../impl/fake_impl/hardware/test/prop.json | 26 ++ 9 files changed, 485 insertions(+), 9 deletions(-) create mode 100644 automotive/vehicle/aidl/impl/fake_impl/hardware/test/prop.json diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/GeneratorHub.h b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/GeneratorHub.h index 9f112ae794..f96b6ecbd4 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/GeneratorHub.h +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/GeneratorHub.h @@ -54,8 +54,8 @@ class GeneratorHub { void registerGenerator(int32_t generatorId, std::unique_ptr generator); // Unregister a generator with the generatorId. If no registered generator is found, this - // function does nothing. - void unregisterGenerator(int32_t generatorId); + // function does nothing. Returns true if the generator is unregistered. + bool unregisterGenerator(int32_t generatorId); private: struct VhalEvent { diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/JsonFakeValueGenerator.h b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/JsonFakeValueGenerator.h index d421ac525d..ab6e2fefb1 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/JsonFakeValueGenerator.h +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/JsonFakeValueGenerator.h @@ -53,6 +53,9 @@ class JsonFakeValueGenerator : public FakeValueGenerator { const std::vector& getAllEvents(); + // Whether there are events left to replay for this generator. + bool hasNext(); + private: size_t mEventIndex = 0; std::vector mEvents; diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/GeneratorHub.cpp b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/GeneratorHub.cpp index 0c182d9c2b..1690c78ef9 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/GeneratorHub.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/GeneratorHub.cpp @@ -58,13 +58,15 @@ void GeneratorHub::registerGenerator(int32_t id, std::unique_ptr lockGuard(mGeneratorsLock); - mGenerators.erase(id); + removed = mGenerators.erase(id); } mCond.notify_one(); ALOGI("%s: Unregistered generator, id: %d", __func__, id); + return removed; } void GeneratorHub::run() { diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/JsonFakeValueGenerator.cpp b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/JsonFakeValueGenerator.cpp index d4d52a5849..2ba55337e0 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/JsonFakeValueGenerator.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/JsonFakeValueGenerator.cpp @@ -241,6 +241,10 @@ std::optional JsonFakeValueGenerator::nextEvent() { return generatedValue; } +bool JsonFakeValueGenerator::hasNext() { + return mNumOfIterations != 0 && mEvents.size() > 0; +} + } // namespace fake } // namespace vehicle } // namespace automotive diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h index 34b2b2454f..a4fc619817 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h @@ -21,10 +21,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -132,6 +134,8 @@ class FakeVehicleHardware : public IVehicleHardware { const std::unique_ptr mFakeUserHal; // RecurrentTimer is thread-safe. std::unique_ptr mRecurrentTimer; + // GeneratorHub is thread-safe. + std::unique_ptr mGeneratorHub; std::mutex mLock; std::unique_ptr mOnPropertyChangeCallback GUARDED_BY(mLock); std::unique_ptr mOnPropertySetErrorCallback GUARDED_BY(mLock); @@ -207,6 +211,14 @@ class FakeVehicleHardware : public IVehicleHardware { const aidl::android::hardware::automotive::vehicle::GetValueRequest& request); aidl::android::hardware::automotive::vehicle::SetValueResult handleSetValueRequest( const aidl::android::hardware::automotive::vehicle::SetValueRequest& request); + + std::string genFakeDataCommand(const std::vector& options); + + static aidl::android::hardware::automotive::vehicle::VehiclePropValue createHwInputKeyProp( + aidl::android::hardware::automotive::vehicle::VehicleHwKeyInputAction action, + int32_t keyCode, int32_t targetDisplay); + static std::string genFakeDataHelp(); + static std::string parseErrMsg(std::string fieldName, std::string value, std::string type); }; } // namespace fake diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index 7b3de586c8..1b1969af31 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -55,6 +56,7 @@ using ::aidl::android::hardware::automotive::vehicle::SetValueResult; using ::aidl::android::hardware::automotive::vehicle::StatusCode; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq; +using ::aidl::android::hardware::automotive::vehicle::VehicleHwKeyInputAction; using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup; @@ -140,6 +142,8 @@ FakeVehicleHardware::FakeVehicleHardware(std::unique_ptr v mFakeObd2Frame(new obd2frame::FakeObd2Frame(mServerSidePropStore)), mFakeUserHal(new FakeUserHal(mValuePool)), mRecurrentTimer(new RecurrentTimer()), + mGeneratorHub(new GeneratorHub( + [this](const VehiclePropValue& value) { onValueChangeCallback(value); })), mPendingGetValueRequests(this), mPendingSetValueRequests(this) { init(); @@ -148,6 +152,7 @@ FakeVehicleHardware::FakeVehicleHardware(std::unique_ptr v FakeVehicleHardware::~FakeVehicleHardware() { mPendingGetValueRequests.stop(); mPendingSetValueRequests.stop(); + mGeneratorHub.reset(); } void FakeVehicleHardware::init() { @@ -583,12 +588,181 @@ DumpResult FakeVehicleHardware::dump(const std::vector& options) { } else { result.buffer = mFakeUserHal->dump(options[1]); } + } else if (EqualsIgnoreCase(option, "--genfakedata")) { + result.buffer = genFakeDataCommand(options); } else { result.buffer = StringPrintf("Invalid option: %s\n", option.c_str()); } return result; } +std::string FakeVehicleHardware::genFakeDataHelp() { + return R"( +Generate Fake Data Usage: +--genfakedata --startlinear [propID] [mValue] [cValue] [dispersion] [increment] [interval]: " +Start a linear generator that generates event with floatValue within range: +[mValue - disperson, mValue + dispersion]. +propID(int32): ID for the property to generate event for. +mValue(float): The middle of the possible values for the property. +cValue(float): The start value for the property, must be within the range. +dispersion(float): The range the value can change. +increment(float): The step the value would increase by for each generated event, +if exceed the range, the value would loop back. +interval(int64): The interval in nanoseconds the event would generate by. + +--genfakedata --stoplinear [propID(int32)]: Stop a linear generator + +--genfakedata --startjson [jsonFilePath] [repetition]: +Start a json generator that would generate events according to a JSON file. +jsonFilePath(string): The path to a JSON file. The JSON content must be in the format of +[{ + "timestamp": 1000000, + "areaId": 0, + "value": 8, + "prop": 289408000 +}, {...}] +Each event in the JSON file would be generated by the same interval their timestamp is relative to +the first event's timestamp. +repetition(int32, optional): how many iterations the events would be generated. If it is not +provided, it would iterate indefinitely. + +--genfakedata --stopjson [jsonFilePath(string)]: Stop a json generator + +--genfakedata --keypress [keyCode(int32)] [display[int32]]: Generate key press + +)"; +} + +std::string FakeVehicleHardware::parseErrMsg(std::string fieldName, std::string value, + std::string type) { + return StringPrintf("failed to parse %s as %s: \"%s\"\n%s", fieldName.c_str(), type.c_str(), + value.c_str(), genFakeDataHelp().c_str()); +} + +std::string FakeVehicleHardware::genFakeDataCommand(const std::vector& options) { + if (options.size() < 2) { + return "No subcommand specified for genfakedata\n" + genFakeDataHelp(); + } + + std::string command = options[1]; + if (command == "--startlinear") { + // --genfakedata --startlinear [propID(int32)] [middleValue(float)] + // [currentValue(float)] [dispersion(float)] [increment(float)] [interval(int64)] + if (options.size() != 8) { + return "incorrect argument count, need 8 arguments for --genfakedata --startlinear\n" + + genFakeDataHelp(); + } + int32_t propId; + float middleValue; + float currentValue; + float dispersion; + float increment; + int64_t interval; + if (!android::base::ParseInt(options[2], &propId)) { + return parseErrMsg("propId", options[2], "int"); + } + if (!android::base::ParseFloat(options[3], &middleValue)) { + return parseErrMsg("middleValue", options[3], "float"); + } + if (!android::base::ParseFloat(options[4], ¤tValue)) { + return parseErrMsg("currentValue", options[4], "float"); + } + if (!android::base::ParseFloat(options[5], &dispersion)) { + return parseErrMsg("dispersion", options[5], "float"); + } + if (!android::base::ParseFloat(options[6], &increment)) { + return parseErrMsg("increment", options[6], "float"); + } + if (!android::base::ParseInt(options[7], &interval)) { + return parseErrMsg("interval", options[7], "int"); + } + auto generator = std::make_unique( + propId, middleValue, currentValue, dispersion, increment, interval); + mGeneratorHub->registerGenerator(propId, std::move(generator)); + return "Linear event generator started successfully"; + } else if (command == "--stoplinear") { + // --genfakedata --stoplinear [propID(int32)] + if (options.size() != 3) { + return "incorrect argument count, need 3 arguments for --genfakedata --stoplinear\n" + + genFakeDataHelp(); + } + int32_t propId; + if (!android::base::ParseInt(options[2], &propId)) { + return parseErrMsg("propId", options[2], "int"); + } + if (mGeneratorHub->unregisterGenerator(propId)) { + return "Linear event generator stopped successfully"; + } + return StringPrintf("No linear event generator found for property: %d", propId); + } else if (command == "--startjson") { + // --genfakedata --startjson [jsonFilePath(string)] [repetition(int32)(optional)] + if (options.size() != 3 && options.size() != 4) { + return "incorrect argument count, need 3 or 4 arguments for --genfakedata " + "--startjson\n"; + } + std::string fileName = options[2]; + int32_t cookie = std::hash()(fileName); + // Iterate infinitely if repetition number is not provided + int32_t repetition = -1; + if (options.size() == 4) { + if (!android::base::ParseInt(options[3], &repetition)) { + return parseErrMsg("repetition", options[3], "int"); + } + } + auto generator = std::make_unique(fileName, repetition); + if (!generator->hasNext()) { + return "invalid JSON file, no events"; + } + mGeneratorHub->registerGenerator(cookie, std::move(generator)); + return "JSON event generator started successfully"; + } else if (command == "--stopjson") { + // --genfakedata --stopjson [jsonFilePath(string)] + if (options.size() != 3) { + return "incorrect argument count, need 3 arguments for --genfakedata --stopjson\n"; + } + std::string fileName = options[2]; + int32_t cookie = std::hash()(fileName); + if (mGeneratorHub->unregisterGenerator(cookie)) { + return "JSON event generator stopped successfully"; + } else { + return StringPrintf("No JSON event generator found for file: %s", fileName.c_str()); + } + } else if (command == "--keypress") { + int32_t keyCode; + int32_t display; + // --genfakedata --keypress [keyCode(int32)] [display[int32]] + if (options.size() != 4) { + return "incorrect argument count, need 4 arguments for --genfakedata --keypress\n"; + } + if (!android::base::ParseInt(options[2], &keyCode)) { + return parseErrMsg("keyCode", options[2], "int"); + } + if (!android::base::ParseInt(options[3], &display)) { + return parseErrMsg("display", options[3], "int"); + } + // Send back to HAL + onValueChangeCallback( + createHwInputKeyProp(VehicleHwKeyInputAction::ACTION_DOWN, keyCode, display)); + onValueChangeCallback( + createHwInputKeyProp(VehicleHwKeyInputAction::ACTION_UP, keyCode, display)); + return "keypress event generated successfully"; + } + + return StringPrintf("Unknown command: \"%s\"\n%s", command.c_str(), genFakeDataHelp().c_str()); +} + +VehiclePropValue FakeVehicleHardware::createHwInputKeyProp(VehicleHwKeyInputAction action, + int32_t keyCode, int32_t targetDisplay) { + VehiclePropValue value = { + .prop = toInt(VehicleProperty::HW_KEY_INPUT), + .areaId = 0, + .timestamp = elapsedRealtimeNano(), + .status = VehiclePropertyStatus::AVAILABLE, + .value.int32Values = {toInt(action), keyCode, targetDisplay}, + }; + return value; +} + std::string FakeVehicleHardware::dumpHelp() { return "Usage: \n\n" "[no args]: dumps (id and value) all supported properties \n" @@ -600,9 +774,8 @@ std::string FakeVehicleHardware::dumpHelp() { "[-b BYTES_VALUE] [-a AREA_ID] : sets the value of property PROP. " "Notice that the string, bytes and area value can be set just once, while the other can" " have multiple values (so they're used in the respective array), " - "BYTES_VALUE is in the form of 0xXXXX, e.g. 0xdeadbeef.\n\n" - "Fake user HAL usage: \n" + - mFakeUserHal->showDumpHelp(); + "BYTES_VALUE is in the form of 0xXXXX, e.g. 0xdeadbeef.\n\n" + + genFakeDataHelp() + "Fake user HAL usage: \n" + mFakeUserHal->showDumpHelp(); } std::string FakeVehicleHardware::dumpAllProperties() { diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp index 90d1516a21..cfd65770dc 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp @@ -42,6 +42,7 @@ cc_test { ], data: [ ":FakeVehicleHardwareTestOverrideJson", + ":FakeVehicleHardwareTestPropJson", ], defaults: ["VehicleHalDefaults"], test_suites: ["device-tests"], @@ -51,3 +52,8 @@ filegroup { name: "FakeVehicleHardwareTestOverrideJson", srcs: ["override/*"], } + +filegroup { + name: "FakeVehicleHardwareTestPropJson", + srcs: ["prop.json"], +} diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp index 3e8f634ab7..f3feea6b46 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp @@ -53,6 +53,7 @@ using ::aidl::android::hardware::automotive::vehicle::SetValueResult; using ::aidl::android::hardware::automotive::vehicle::StatusCode; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq; +using ::aidl::android::hardware::automotive::vehicle::VehicleHwKeyInputAction; using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyStatus; @@ -64,6 +65,7 @@ using ::android::base::unexpected; using ::testing::ContainerEq; using ::testing::ContainsRegex; using ::testing::Eq; +using ::testing::HasSubstr; using ::testing::WhenSortedBy; using std::chrono::milliseconds; @@ -87,6 +89,7 @@ class FakeVehicleHardwareTestHelper { class FakeVehicleHardwareTest : public ::testing::Test { protected: void SetUp() override { + mHardware = std::make_unique(); auto callback = std::make_unique( [this](const std::vector& values) { onPropertyChangeEvent(values); @@ -98,7 +101,13 @@ class FakeVehicleHardwareTest : public ::testing::Test { [this](std::vector results) { onGetValues(results); }); } - FakeVehicleHardware* getHardware() { return &mHardware; } + void TearDown() override { + // mHardware uses callback which contains reference to 'this', so it has to be destroyed + // before 'this'. + mHardware.reset(); + } + + FakeVehicleHardware* getHardware() { return mHardware.get(); } StatusCode setValues(const std::vector& requests) { { @@ -251,6 +260,14 @@ class FakeVehicleHardwareTest : public ::testing::Test { return mChangedProperties; } + bool waitForChangedProperties(size_t count, milliseconds timeout) { + std::unique_lock lk(mLock); + return mCv.wait_for(lk, timeout, [this, count] { + ScopedLockAssertion lockAssertion(mLock); + return mChangedProperties.size() >= count; + }); + } + bool waitForChangedProperties(int32_t propId, int32_t areaId, size_t count, milliseconds timeout) { PropIdAreaId propIdAreaId{ @@ -270,6 +287,15 @@ class FakeVehicleHardwareTest : public ::testing::Test { mChangedProperties.clear(); } + size_t getEventCount(int32_t propId, int32_t areaId) { + PropIdAreaId propIdAreaId{ + .propId = propId, + .areaId = areaId, + }; + std::scoped_lock lockGuard(mLock); + return mEventCount[propIdAreaId]; + } + static void addSetValueRequest(std::vector& requests, std::vector& expectedResults, int64_t requestId, const VehiclePropValue& value, StatusCode expectedStatus) { @@ -332,7 +358,7 @@ class FakeVehicleHardwareTest : public ::testing::Test { } mPropValueCmp; private: - FakeVehicleHardware mHardware; + std::unique_ptr mHardware; std::shared_ptr mSetValuesCallback; std::shared_ptr mGetValuesCallback; std::condition_variable mCv; @@ -1606,6 +1632,230 @@ TEST_F(FakeVehicleHardwareTest, SetComplexPropTest) { ASSERT_EQ(3.402823466E+38f, value.value.floatValues[2]); } +struct OptionsTestCase { + std::string name; + std::vector options; + std::string expectMsg; +}; + +class FakeVehicleHardwareOptionsTest : public FakeVehicleHardwareTest, + public testing::WithParamInterface {}; + +std::vector GenInvalidOptions() { + return {{"unknown_command", {"--unknown"}, "Invalid option: --unknown"}, + {"help", {"--help"}, "Usage:"}, + {"genfakedata_no_subcommand", + {"--genfakedata"}, + "No subcommand specified for genfakedata"}, + {"genfakedata_unknown_subcommand", + {"--genfakedata", "--unknown"}, + "Unknown command: \"--unknown\""}, + {"genfakedata_start_linear_no_args", + {"--genfakedata", "--startlinear"}, + "incorrect argument count"}, + {"genfakedata_start_linear_invalid_propId", + {"--genfakedata", "--startlinear", "abcd", "0.1", "0.1", "0.1", "0.1", "100000000"}, + "failed to parse propId as int: \"abcd\""}, + {"genfakedata_start_linear_invalid_middleValue", + {"--genfakedata", "--startlinear", "1", "abcd", "0.1", "0.1", "0.1", "100000000"}, + "failed to parse middleValue as float: \"abcd\""}, + {"genfakedata_start_linear_invalid_currentValue", + {"--genfakedata", "--startlinear", "1", "0.1", "abcd", "0.1", "0.1", "100000000"}, + "failed to parse currentValue as float: \"abcd\""}, + {"genfakedata_start_linear_invalid_dispersion", + {"--genfakedata", "--startlinear", "1", "0.1", "0.1", "abcd", "0.1", "100000000"}, + "failed to parse dispersion as float: \"abcd\""}, + {"genfakedata_start_linear_invalid_increment", + {"--genfakedata", "--startlinear", "1", "0.1", "0.1", "0.1", "abcd", "100000000"}, + "failed to parse increment as float: \"abcd\""}, + {"genfakedata_start_linear_invalid_interval", + {"--genfakedata", "--startlinear", "1", "0.1", "0.1", "0.1", "0.1", "0.1"}, + "failed to parse interval as int: \"0.1\""}, + {"genfakedata_stop_linear_no_args", + {"--genfakedata", "--stoplinear"}, + "incorrect argument count"}, + {"genfakedata_stop_linear_invalid_propId", + {"--genfakedata", "--stoplinear", "abcd"}, + "failed to parse propId as int: \"abcd\""}, + {"genfakedata_startjson_no_args", + {"--genfakedata", "--startjson"}, + "incorrect argument count"}, + {"genfakedata_startjson_invalid_repetition", + {"--genfakedata", "--startjson", "file", "0.1"}, + "failed to parse repetition as int: \"0.1\""}, + {"genfakedata_startjson_invalid_json_file", + {"--genfakedata", "--startjson", "file", "1"}, + "invalid JSON file"}, + {"genfakedata_stopjson_no_args", + {"--genfakedata", "--stopjson"}, + "incorrect argument count"}, + {"genfakedata_keypress_no_args", + {"--genfakedata", "--keypress"}, + "incorrect argument count"}, + {"genfakedata_keypress_invalid_keyCode", + {"--genfakedata", "--keypress", "0.1", "1"}, + "failed to parse keyCode as int: \"0.1\""}, + {"genfakedata_keypress_invalid_display", + {"--genfakedata", "--keypress", "1", "0.1"}, + "failed to parse display as int: \"0.1\""}}; +} + +TEST_P(FakeVehicleHardwareOptionsTest, testInvalidOptions) { + auto tc = GetParam(); + + DumpResult result = getHardware()->dump(tc.options); + + EXPECT_FALSE(result.callerShouldDumpState); + EXPECT_THAT(result.buffer, HasSubstr(tc.expectMsg)); +} + +INSTANTIATE_TEST_SUITE_P( + FakeVehicleHardwareOptionsTests, FakeVehicleHardwareOptionsTest, + testing::ValuesIn(GenInvalidOptions()), + [](const testing::TestParamInfo& info) { + return info.param.name; + }); + +TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataLinear) { + // Start a fake linear data generator for vehicle speed at 0.1s interval. + // range: 0 - 100, current value: 30, step: 20. + std::string propIdString = StringPrintf("%d", toInt(VehicleProperty::PERF_VEHICLE_SPEED)); + std::vector options = {"--genfakedata", "--startlinear", propIdString, + /*middleValue=*/"50", + /*currentValue=*/"30", + /*dispersion=*/"50", + /*increment=*/"20", + /*interval=*/"100000000"}; + + DumpResult result = getHardware()->dump(options); + + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_THAT(result.buffer, HasSubstr("successfully")); + + ASSERT_TRUE(waitForChangedProperties(toInt(VehicleProperty::PERF_VEHICLE_SPEED), 0, /*count=*/5, + milliseconds(1000))) + << "not enough events generated for linear data generator"; + + int32_t value = 30; + auto events = getChangedProperties(); + for (size_t i = 0; i < 5; i++) { + ASSERT_EQ(1u, events[i].value.floatValues.size()); + EXPECT_EQ(static_cast(value), events[i].value.floatValues[0]); + value = (value + 20) % 100; + } + + // Stop the linear generator. + options = {"--genfakedata", "--stoplinear", propIdString}; + + result = getHardware()->dump(options); + + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_THAT(result.buffer, HasSubstr("successfully")); + + clearChangedProperties(); + std::this_thread::sleep_for(std::chrono::milliseconds(200)); + + // There should be no new events generated. + EXPECT_EQ(0u, getEventCount(toInt(VehicleProperty::PERF_VEHICLE_SPEED), 0)); +} + +std::string getTestFilePath(const char* filename) { + static std::string baseDir = android::base::GetExecutableDirectory(); + return baseDir + "/" + filename; +} + +TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJson) { + std::vector options = {"--genfakedata", "--startjson", + getTestFilePath("prop.json"), "2"}; + + DumpResult result = getHardware()->dump(options); + + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_THAT(result.buffer, HasSubstr("successfully")); + + ASSERT_TRUE(waitForChangedProperties(/*count=*/8, milliseconds(1000))) + << "not enough events generated for JSON data generator"; + + auto events = getChangedProperties(); + ASSERT_EQ(8u, events.size()); + // First set of events, we test 1st and the last. + EXPECT_EQ(1u, events[0].value.int32Values.size()); + EXPECT_EQ(8, events[0].value.int32Values[0]); + EXPECT_EQ(1u, events[3].value.int32Values.size()); + EXPECT_EQ(10, events[3].value.int32Values[0]); + // Second set of the same events. + EXPECT_EQ(1u, events[4].value.int32Values.size()); + EXPECT_EQ(8, events[4].value.int32Values[0]); + EXPECT_EQ(1u, events[7].value.int32Values.size()); + EXPECT_EQ(10, events[7].value.int32Values[0]); +} + +TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJsonInvalidFile) { + std::vector options = {"--genfakedata", "--startjson", + getTestFilePath("blahblah.json"), "2"}; + + DumpResult result = getHardware()->dump(options); + + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_THAT(result.buffer, HasSubstr("invalid JSON file")); +} + +TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJsonStop) { + // No iteration number provided, would loop indefinitely. + std::vector options = {"--genfakedata", "--startjson", + getTestFilePath("prop.json")}; + + DumpResult result = getHardware()->dump(options); + + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_THAT(result.buffer, HasSubstr("successfully")); + + result = getHardware()->dump({"--genfakedata", "--stopjson", getTestFilePath("prop.json")}); + + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_THAT(result.buffer, HasSubstr("successfully")); +} + +TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJsonStopInvalidFile) { + // No iteration number provided, would loop indefinitely. + std::vector options = {"--genfakedata", "--startjson", + getTestFilePath("prop.json")}; + + DumpResult result = getHardware()->dump(options); + + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_THAT(result.buffer, HasSubstr("successfully")); + + result = getHardware()->dump({"--genfakedata", "--stopjson", getTestFilePath("prop1.json")}); + + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_THAT(result.buffer, HasSubstr("No JSON event generator found")); + + // TearDown function should destroy the generator which stops the iteration. +} + +TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataKeyPress) { + std::vector options = {"--genfakedata", "--keypress", "1", "2"}; + + DumpResult result = getHardware()->dump(options); + + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_THAT(result.buffer, HasSubstr("successfully")); + + auto events = getChangedProperties(); + ASSERT_EQ(2u, events.size()); + EXPECT_EQ(toInt(VehicleProperty::HW_KEY_INPUT), events[0].prop); + EXPECT_EQ(toInt(VehicleProperty::HW_KEY_INPUT), events[1].prop); + ASSERT_EQ(3u, events[0].value.int32Values.size()); + ASSERT_EQ(3u, events[1].value.int32Values.size()); + EXPECT_EQ(toInt(VehicleHwKeyInputAction::ACTION_DOWN), events[0].value.int32Values[0]); + EXPECT_EQ(1, events[0].value.int32Values[1]); + EXPECT_EQ(2, events[0].value.int32Values[2]); + EXPECT_EQ(toInt(VehicleHwKeyInputAction::ACTION_UP), events[1].value.int32Values[0]); + EXPECT_EQ(1, events[1].value.int32Values[1]); + EXPECT_EQ(2, events[1].value.int32Values[2]); +} + TEST_F(FakeVehicleHardwareTest, testGetEchoReverseBytes) { ASSERT_EQ(setValue(VehiclePropValue{ .prop = ECHO_REVERSE_BYTES, diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/prop.json b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/prop.json new file mode 100644 index 0000000000..7123a002cc --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/prop.json @@ -0,0 +1,26 @@ +[ + { + "timestamp": 1000000, + "areaId": 0, + "value": 8, + "prop": 289408000 + }, + { + "timestamp": 2000000, + "areaId": 0, + "value": 4, + "prop": 289408000 + }, + { + "timestamp": 3000000, + "areaId": 0, + "value": 16, + "prop": 289408000 + }, + { + "timestamp": 4000000, + "areaId": 0, + "value": 10, + "prop": 289408000 + } +] From 86233e53b1a0ab2a73d0a929511c6f41ff827a1b Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Fri, 15 Apr 2022 15:27:45 -0700 Subject: [PATCH 055/998] Add more debug options to FakeVehicleHardware. Add more debug options to FakeVehicleHardware that includes save property values and restore property values. Get property with arguments. Provide JSON content to fake event generator. Test: atest FakeVehicleHardwareTest Bug: 199314530 Change-Id: I467b3aff1b7178f8716831e9c501d8199c35c359 --- .../include/JsonFakeValueGenerator.h | 6 +- .../src/JsonFakeValueGenerator.cpp | 24 +- .../hardware/include/FakeVehicleHardware.h | 12 +- .../hardware/src/FakeVehicleHardware.cpp | 301 ++++++++++++++---- .../hardware/test/FakeVehicleHardwareTest.cpp | 125 +++++++- 5 files changed, 385 insertions(+), 83 deletions(-) diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/JsonFakeValueGenerator.h b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/JsonFakeValueGenerator.h index ab6e2fefb1..42b1bd3c6c 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/JsonFakeValueGenerator.h +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/include/JsonFakeValueGenerator.h @@ -45,6 +45,9 @@ class JsonFakeValueGenerator : public FakeValueGenerator { // Create a new JSON fake value generator using the specified JSON file path. All the events // in the JSON file would be generated once. explicit JsonFakeValueGenerator(const std::string& path); + // Create a new JSON fake value generator using the JSON content. The first argument is just + // used to differentiate this function with the one that takes path as input. + explicit JsonFakeValueGenerator(bool unused, const std::string& content, int32_t iteration); ~JsonFakeValueGenerator() = default; @@ -63,7 +66,8 @@ class JsonFakeValueGenerator : public FakeValueGenerator { int32_t mNumOfIterations = 0; void setBit(std::vector& bytes, size_t idx); - void init(const std::string& path, int32_t iteration); + void initWithPath(const std::string& path, int32_t iteration); + void initWithStream(std::istream& is, int32_t iteration); }; } // namespace fake diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/JsonFakeValueGenerator.cpp b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/JsonFakeValueGenerator.cpp index 2ba55337e0..cb42317195 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/JsonFakeValueGenerator.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/JsonFakeValueGenerator.cpp @@ -173,12 +173,11 @@ std::vector parseFakeValueJson(std::istream& is) { } // namespace -JsonFakeValueGenerator::JsonFakeValueGenerator(const std::string& path) { - init(path, 1); -} +JsonFakeValueGenerator::JsonFakeValueGenerator(const std::string& path) + : JsonFakeValueGenerator(path, /*iteration=*/1) {} JsonFakeValueGenerator::JsonFakeValueGenerator(const std::string& path, int32_t iteration) { - init(path, iteration); + initWithPath(path, iteration); } JsonFakeValueGenerator::JsonFakeValueGenerator(const VehiclePropValue& request) { @@ -186,16 +185,26 @@ JsonFakeValueGenerator::JsonFakeValueGenerator(const VehiclePropValue& request) // Iterate infinitely if iteration number is not provided int32_t numOfIterations = v.int32Values.size() < 2 ? -1 : v.int32Values[1]; - init(v.stringValue, numOfIterations); + initWithPath(v.stringValue, numOfIterations); } -void JsonFakeValueGenerator::init(const std::string& path, int32_t iteration) { +JsonFakeValueGenerator::JsonFakeValueGenerator([[maybe_unused]] bool unused, + const std::string& content, int32_t iteration) { + std::istringstream iss(content); + initWithStream(iss, iteration); +} + +void JsonFakeValueGenerator::initWithPath(const std::string& path, int32_t iteration) { std::ifstream ifs(path); if (!ifs) { ALOGE("%s: couldn't open %s for parsing.", __func__, path.c_str()); return; } - mEvents = parseFakeValueJson(ifs); + initWithStream(ifs, iteration); +} + +void JsonFakeValueGenerator::initWithStream(std::istream& is, int32_t iteration) { + mEvents = parseFakeValueJson(is); mNumOfIterations = iteration; } @@ -235,7 +244,6 @@ std::optional JsonFakeValueGenerator::nextEvent() { mNumOfIterations--; } } - generatedValue.timestamp = mLastEventTimestamp; return generatedValue; diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h index a4fc619817..8cc19b12f8 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h @@ -141,6 +141,8 @@ class FakeVehicleHardware : public IVehicleHardware { std::unique_ptr mOnPropertySetErrorCallback GUARDED_BY(mLock); std::unordered_map, PropIdAreaIdHash> mRecurrentActions GUARDED_BY(mLock); + std::unordered_map + mSavedProps GUARDED_BY(mLock); // PendingRequestHandler is thread-safe. mutable PendingRequestHandler @@ -160,6 +162,10 @@ class FakeVehicleHardware : public IVehicleHardware { void maybeOverrideProperties(const char* overrideDir); // Override the properties using config files in 'overrideDir'. void overrideProperties(const char* overrideDir); + // Function to be called when a value change event comes from vehicle bus. In our fake + // implementation, this function is only called during "--inject-event" dump command. + void eventFromVehicleBus( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value); VhalResult maybeSetSpecialValue( const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value, @@ -188,6 +194,10 @@ class FakeVehicleHardware : public IVehicleHardware { std::string dumpListProperties(); std::string dumpSpecificProperty(const std::vector& options); std::string dumpSetProperties(const std::vector& options); + std::string dumpGetPropertyWithArg(const std::vector& options); + std::string dumpSaveProperty(const std::vector& options); + std::string dumpRestoreProperty(const std::vector& options); + std::string dumpInjectEvent(const std::vector& options); template android::base::Result safelyParseInt(int index, const std::string& s) { @@ -202,7 +212,7 @@ class FakeVehicleHardware : public IVehicleHardware { std::vector getOptionValues(const std::vector& options, size_t* index); android::base::Result - parseSetPropOptions(const std::vector& options); + parsePropOptions(const std::vector& options); android::base::Result> parseHexString(const std::string& s); android::base::Result checkArgumentsSize(const std::vector& options, diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index 1b1969af31..a7e986b9ca 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -88,7 +89,9 @@ const std::unordered_set SET_PROP_OPTIONS = { // bytes in hex format, e.g. 0xDEADBEEF. "-b", // Area id in integer. - "-a"}; + "-a", + // Timestamp in int64. + "-t"}; } // namespace @@ -143,7 +146,7 @@ FakeVehicleHardware::FakeVehicleHardware(std::unique_ptr v mFakeUserHal(new FakeUserHal(mValuePool)), mRecurrentTimer(new RecurrentTimer()), mGeneratorHub(new GeneratorHub( - [this](const VehiclePropValue& value) { onValueChangeCallback(value); })), + [this](const VehiclePropValue& value) { eventFromVehicleBus(value); })), mPendingGetValueRequests(this), mPendingSetValueRequests(this) { init(); @@ -580,8 +583,16 @@ DumpResult FakeVehicleHardware::dump(const std::vector& options) { result.buffer = dumpListProperties(); } else if (EqualsIgnoreCase(option, "--get")) { result.buffer = dumpSpecificProperty(options); + } else if (EqualsIgnoreCase(option, "--getWithArg")) { + result.buffer = dumpGetPropertyWithArg(options); } else if (EqualsIgnoreCase(option, "--set")) { result.buffer = dumpSetProperties(options); + } else if (EqualsIgnoreCase(option, "--save-prop")) { + result.buffer = dumpSaveProperty(options); + } else if (EqualsIgnoreCase(option, "--restore-prop")) { + result.buffer = dumpRestoreProperty(options); + } else if (EqualsIgnoreCase(option, "--inject-event")) { + result.buffer = dumpInjectEvent(options); } else if (EqualsIgnoreCase(option, kUserHalDumpOption)) { if (options.size() == 1) { result.buffer = mFakeUserHal->showDumpHelp(); @@ -612,8 +623,8 @@ interval(int64): The interval in nanoseconds the event would generate by. --genfakedata --stoplinear [propID(int32)]: Stop a linear generator ---genfakedata --startjson [jsonFilePath] [repetition]: -Start a json generator that would generate events according to a JSON file. +--genfakedata --startjson --path [jsonFilePath] [repetition]: +Start a JSON generator that would generate events according to a JSON file. jsonFilePath(string): The path to a JSON file. The JSON content must be in the format of [{ "timestamp": 1000000, @@ -626,9 +637,11 @@ the first event's timestamp. repetition(int32, optional): how many iterations the events would be generated. If it is not provided, it would iterate indefinitely. ---genfakedata --stopjson [jsonFilePath(string)]: Stop a json generator +--genfakedata --startjson --content [jsonContent]: Start a JSON generator using the content. ---genfakedata --keypress [keyCode(int32)] [display[int32]]: Generate key press +--genfakedata --stopjson [generatorID(string)]: Stop a JSON generator. + +--genfakedata --keypress [keyCode(int32)] [display[int32]]: Generate key press. )"; } @@ -695,37 +708,51 @@ std::string FakeVehicleHardware::genFakeDataCommand(const std::vector()(fileName); // Iterate infinitely if repetition number is not provided int32_t repetition = -1; - if (options.size() == 4) { - if (!android::base::ParseInt(options[3], &repetition)) { - return parseErrMsg("repetition", options[3], "int"); + if (options.size() == 5) { + if (!android::base::ParseInt(options[4], &repetition)) { + return parseErrMsg("repetition", options[4], "int"); } } - auto generator = std::make_unique(fileName, repetition); - if (!generator->hasNext()) { - return "invalid JSON file, no events"; + std::unique_ptr generator; + if (options[2] == "--path") { + const std::string& fileName = options[3]; + generator = std::make_unique(fileName, repetition); + if (!generator->hasNext()) { + return "invalid JSON file, no events"; + } + } else if (options[2] == "--content") { + const std::string& content = options[3]; + generator = + std::make_unique(/*unused=*/true, content, repetition); + if (!generator->hasNext()) { + return "invalid JSON content, no events"; + } } + int32_t cookie = std::hash()(options[3]); mGeneratorHub->registerGenerator(cookie, std::move(generator)); - return "JSON event generator started successfully"; + return StringPrintf("JSON event generator started successfully, ID: %" PRId32, cookie); } else if (command == "--stopjson") { - // --genfakedata --stopjson [jsonFilePath(string)] + // --genfakedata --stopjson [generatorID(string)] if (options.size() != 3) { return "incorrect argument count, need 3 arguments for --genfakedata --stopjson\n"; } - std::string fileName = options[2]; - int32_t cookie = std::hash()(fileName); + int32_t cookie; + if (!android::base::ParseInt(options[2], &cookie)) { + return parseErrMsg("cookie", options[2], "int"); + } if (mGeneratorHub->unregisterGenerator(cookie)) { return "JSON event generator stopped successfully"; } else { - return StringPrintf("No JSON event generator found for file: %s", fileName.c_str()); + return StringPrintf("No JSON event generator found for ID: %s", options[2].c_str()); } } else if (command == "--keypress") { int32_t keyCode; @@ -763,18 +790,29 @@ VehiclePropValue FakeVehicleHardware::createHwInputKeyProp(VehicleHwKeyInputActi return value; } +void FakeVehicleHardware::eventFromVehicleBus(const VehiclePropValue& value) { + mServerSidePropStore->writeValue(mValuePool->obtain(value)); +} + std::string FakeVehicleHardware::dumpHelp() { return "Usage: \n\n" "[no args]: dumps (id and value) all supported properties \n" "--help: shows this help\n" "--list: lists the ids of all supported properties\n" - "--get [PROP2] [PROPN]: dumps the value of specific properties \n" - "--set [-i INT_VALUE [INT_VALUE ...]] [-i64 INT64_VALUE [INT64_VALUE ...]] " - "[-f FLOAT_VALUE [FLOAT_VALUE ...]] [-s STR_VALUE] " - "[-b BYTES_VALUE] [-a AREA_ID] : sets the value of property PROP. " + "--get [PROP2] [PROPN]: dumps the value of specific properties. \n" + "--getWithArg [ValueArguments]: gets the value for a specific property with " + "arguments. \n" + "--set [ValueArguments]: sets the value of property PROP. \n" + "--save-prop [-a AREA_ID]: saves the current value for PROP, integration test" + " that modifies prop value must call this before test and restore-prop after test. \n" + "--restore-prop [-a AREA_ID]: restores a previously saved property value. \n" + "--inject-event [ValueArguments]: inject a property update event from car\n\n" + "ValueArguments are in the format of [-i INT_VALUE [INT_VALUE ...]] " + "[-i64 INT64_VALUE [INT64_VALUE ...]] [-f FLOAT_VALUE [FLOAT_VALUE ...]] [-s STR_VALUE] " + "[-b BYTES_VALUE] [-a AREA_ID].\n" "Notice that the string, bytes and area value can be set just once, while the other can" " have multiple values (so they're used in the respective array), " - "BYTES_VALUE is in the form of 0xXXXX, e.g. 0xdeadbeef.\n\n" + + "BYTES_VALUE is in the form of 0xXXXX, e.g. 0xdeadbeef.\n" + genFakeDataHelp() + "Fake user HAL usage: \n" + mFakeUserHal->showDumpHelp(); } @@ -893,10 +931,11 @@ std::vector FakeVehicleHardware::getOptionValues( return std::move(values); } -Result FakeVehicleHardware::parseSetPropOptions( +Result FakeVehicleHardware::parsePropOptions( const std::vector& options) { // Options format: - // --set PROP [-f f1 f2...] [-i i1 i2...] [-i64 i1 i2...] [-s s1 s2...] [-b b1 b2...] [-a a] + // --set/get/inject-event PROP [-f f1 f2...] [-i i1 i2...] [-i64 i1 i2...] [-s s1 s2...] + // [-b b1 b2...] [-a a] [-t timestamp] size_t optionIndex = 1; auto result = safelyParseInt(optionIndex, options[optionIndex]); if (!result.ok()) { @@ -910,83 +949,98 @@ Result FakeVehicleHardware::parseSetPropOptions( std::unordered_set parsedOptions; while (optionIndex < options.size()) { - std::string type = options[optionIndex]; + std::string argType = options[optionIndex]; optionIndex++; + size_t currentIndex = optionIndex; - std::vector values = getOptionValues(options, &optionIndex); - if (parsedOptions.find(type) != parsedOptions.end()) { - return Error() << StringPrintf("Duplicate \"%s\" options\n", type.c_str()); + std::vector argValues = getOptionValues(options, &optionIndex); + if (parsedOptions.find(argType) != parsedOptions.end()) { + return Error() << StringPrintf("Duplicate \"%s\" options\n", argType.c_str()); } - parsedOptions.insert(type); - if (EqualsIgnoreCase(type, "-i")) { - if (values.size() == 0) { + parsedOptions.insert(argType); + size_t argValuesSize = argValues.size(); + if (EqualsIgnoreCase(argType, "-i")) { + if (argValuesSize == 0) { return Error() << "No values specified when using \"-i\"\n"; } - prop.value.int32Values.resize(values.size()); - for (size_t i = 0; i < values.size(); i++) { - auto int32Result = safelyParseInt(currentIndex + i, values[i]); + prop.value.int32Values.resize(argValuesSize); + for (size_t i = 0; i < argValuesSize; i++) { + auto int32Result = safelyParseInt(currentIndex + i, argValues[i]); if (!int32Result.ok()) { return Error() << StringPrintf("Value: \"%s\" is not a valid int: %s\n", - values[i].c_str(), getErrorMsg(int32Result).c_str()); + argValues[i].c_str(), getErrorMsg(int32Result).c_str()); } prop.value.int32Values[i] = int32Result.value(); } - } else if (EqualsIgnoreCase(type, "-i64")) { - if (values.size() == 0) { + } else if (EqualsIgnoreCase(argType, "-i64")) { + if (argValuesSize == 0) { return Error() << "No values specified when using \"-i64\"\n"; } - prop.value.int64Values.resize(values.size()); - for (size_t i = 0; i < values.size(); i++) { - auto int64Result = safelyParseInt(currentIndex + i, values[i]); + prop.value.int64Values.resize(argValuesSize); + for (size_t i = 0; i < argValuesSize; i++) { + auto int64Result = safelyParseInt(currentIndex + i, argValues[i]); if (!int64Result.ok()) { return Error() << StringPrintf("Value: \"%s\" is not a valid int64: %s\n", - values[i].c_str(), getErrorMsg(int64Result).c_str()); + argValues[i].c_str(), getErrorMsg(int64Result).c_str()); } prop.value.int64Values[i] = int64Result.value(); } - } else if (EqualsIgnoreCase(type, "-f")) { - if (values.size() == 0) { + } else if (EqualsIgnoreCase(argType, "-f")) { + if (argValuesSize == 0) { return Error() << "No values specified when using \"-f\"\n"; } - prop.value.floatValues.resize(values.size()); - for (size_t i = 0; i < values.size(); i++) { - auto floatResult = safelyParseFloat(currentIndex + i, values[i]); + prop.value.floatValues.resize(argValuesSize); + for (size_t i = 0; i < argValuesSize; i++) { + auto floatResult = safelyParseFloat(currentIndex + i, argValues[i]); if (!floatResult.ok()) { return Error() << StringPrintf("Value: \"%s\" is not a valid float: %s\n", - values[i].c_str(), getErrorMsg(floatResult).c_str()); + argValues[i].c_str(), getErrorMsg(floatResult).c_str()); } prop.value.floatValues[i] = floatResult.value(); } - } else if (EqualsIgnoreCase(type, "-s")) { - if (values.size() != 1) { + } else if (EqualsIgnoreCase(argType, "-s")) { + if (argValuesSize != 1) { return Error() << "Expect exact one value when using \"-s\"\n"; } - prop.value.stringValue = values[0]; - } else if (EqualsIgnoreCase(type, "-b")) { - if (values.size() != 1) { + prop.value.stringValue = argValues[0]; + } else if (EqualsIgnoreCase(argType, "-b")) { + if (argValuesSize != 1) { return Error() << "Expect exact one value when using \"-b\"\n"; } - auto bytesResult = parseHexString(values[0]); + auto bytesResult = parseHexString(argValues[0]); if (!bytesResult.ok()) { return Error() << StringPrintf("value: \"%s\" is not a valid hex string: %s\n", - values[0].c_str(), getErrorMsg(bytesResult).c_str()); + argValues[0].c_str(), + getErrorMsg(bytesResult).c_str()); } prop.value.byteValues = std::move(bytesResult.value()); - } else if (EqualsIgnoreCase(type, "-a")) { - if (values.size() != 1) { + } else if (EqualsIgnoreCase(argType, "-a")) { + if (argValuesSize != 1) { return Error() << "Expect exact one value when using \"-a\"\n"; } - auto int32Result = safelyParseInt(currentIndex, values[0]); + auto int32Result = safelyParseInt(currentIndex, argValues[0]); if (!int32Result.ok()) { return Error() << StringPrintf("Area ID: \"%s\" is not a valid int: %s\n", - values[0].c_str(), getErrorMsg(int32Result).c_str()); + argValues[0].c_str(), + getErrorMsg(int32Result).c_str()); } prop.areaId = int32Result.value(); + } else if (EqualsIgnoreCase(argType, "-t")) { + if (argValuesSize != 1) { + return Error() << "Expect exact one value when using \"-t\"\n"; + } + auto int64Result = safelyParseInt(currentIndex, argValues[0]); + if (!int64Result.ok()) { + return Error() << StringPrintf("Timestamp: \"%s\" is not a valid int64: %s\n", + argValues[0].c_str(), + getErrorMsg(int64Result).c_str()); + } + prop.timestamp = int64Result.value(); } else { - return Error() << StringPrintf("Unknown option: %s\n", type.c_str()); + return Error() << StringPrintf("Unknown option: %s\n", argType.c_str()); } } @@ -998,7 +1052,7 @@ std::string FakeVehicleHardware::dumpSetProperties(const std::vector& options) { + if (auto result = checkArgumentsSize(options, 3); !result.ok()) { + return getErrorMsg(result); + } + + auto parseResult = parsePropOptions(options); + if (!parseResult.ok()) { + return getErrorMsg(parseResult); + } + VehiclePropValue prop = std::move(parseResult.value()); + ALOGD("Dump: Getting property: %s", prop.toString().c_str()); + + bool isSpecialValue = false; + auto result = maybeGetSpecialValue(prop, &isSpecialValue); + + if (!isSpecialValue) { + result = mServerSidePropStore->readValue(prop); + } + + if (!result.ok()) { + return StringPrintf("failed to read property value: %d, error: %s, code: %d\n", prop.prop, + getErrorMsg(result).c_str(), getIntErrorCode(result)); + } + return StringPrintf("Get property result: %s\n", result.value()->toString().c_str()); +} + +std::string FakeVehicleHardware::dumpSaveProperty(const std::vector& options) { + // Format: --save-prop PROP [-a areaID] + if (auto result = checkArgumentsSize(options, 2); !result.ok()) { + return getErrorMsg(result); + } + + auto parseResult = parsePropOptions(options); + if (!parseResult.ok()) { + return getErrorMsg(parseResult); + } + // We are only using the prop and areaId option. + VehiclePropValue value = std::move(parseResult.value()); + int32_t propId = value.prop; + int32_t areaId = value.areaId; + + auto readResult = mServerSidePropStore->readValue(value); + if (!readResult.ok()) { + return StringPrintf("Failed to save current property value, error: %s", + getErrorMsg(readResult).c_str()); + } + + std::scoped_lock lockGuard(mLock); + mSavedProps[PropIdAreaId{ + .propId = propId, + .areaId = areaId, + }] = std::move(readResult.value()); + + return StringPrintf("Property: %" PRId32 ", areaID: %" PRId32 " saved", propId, areaId); +} + +std::string FakeVehicleHardware::dumpRestoreProperty(const std::vector& options) { + // Format: --restore-prop PROP [-a areaID] + if (auto result = checkArgumentsSize(options, 2); !result.ok()) { + return getErrorMsg(result); + } + + auto parseResult = parsePropOptions(options); + if (!parseResult.ok()) { + return getErrorMsg(parseResult); + } + // We are only using the prop and areaId option. + VehiclePropValue value = std::move(parseResult.value()); + int32_t propId = value.prop; + int32_t areaId = value.areaId; + VehiclePropValuePool::RecyclableType savedValue; + + { + std::scoped_lock lockGuard(mLock); + auto it = mSavedProps.find(PropIdAreaId{ + .propId = propId, + .areaId = areaId, + }); + if (it == mSavedProps.end()) { + return StringPrintf("No saved property for property: %" PRId32 ", areaID: %" PRId32, + propId, areaId); + } + + savedValue = std::move(it->second); + // Remove the saved property after restoring it. + mSavedProps.erase(it); + } + + // Update timestamp. + savedValue->timestamp = elapsedRealtimeNano(); + + auto writeResult = mServerSidePropStore->writeValue(std::move(savedValue)); + if (!writeResult.ok()) { + return StringPrintf("Failed to restore property value, error: %s", + getErrorMsg(writeResult).c_str()); + } + + return StringPrintf("Property: %" PRId32 ", areaID: %" PRId32 " restored", propId, areaId); +} + +std::string FakeVehicleHardware::dumpInjectEvent(const std::vector& options) { + if (auto result = checkArgumentsSize(options, 3); !result.ok()) { + return getErrorMsg(result); + } + + auto parseResult = parsePropOptions(options); + if (!parseResult.ok()) { + return getErrorMsg(parseResult); + } + VehiclePropValue prop = std::move(parseResult.value()); + ALOGD("Dump: Injecting event from vehicle bus: %s", prop.toString().c_str()); + + eventFromVehicleBus(prop); + + return StringPrintf("Event for property: %d injected", prop.prop); +} + StatusCode FakeVehicleHardware::checkHealth() { // Always return OK for checkHealth. return StatusCode::OK; diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp index f3feea6b46..ab6bf51000 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp @@ -1421,6 +1421,85 @@ TEST_F(FakeVehicleHardwareTest, testDumpSpecificPropertiesNoArg) { ASSERT_THAT(result.buffer, ContainsRegex("Invalid number of arguments")); } +TEST_F(FakeVehicleHardwareTest, testDumpSpecificPropertyWithArg) { + auto getValueResult = getValue(VehiclePropValue{.prop = OBD2_FREEZE_FRAME_INFO}); + ASSERT_TRUE(getValueResult.ok()); + auto propValue = getValueResult.value(); + ASSERT_EQ(propValue.value.int64Values.size(), static_cast(3)) + << "expect 3 obd2 freeze frames stored"; + + std::string propIdStr = StringPrintf("%d", OBD2_FREEZE_FRAME); + DumpResult result; + for (int64_t timestamp : propValue.value.int64Values) { + result = getHardware()->dump( + {"--getWithArg", propIdStr, "-i64", StringPrintf("%" PRId64, timestamp)}); + + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_NE(result.buffer, ""); + ASSERT_THAT(result.buffer, ContainsRegex("Get property result:")); + } + + // Set the timestamp argument to 0. + result = getHardware()->dump({"--getWithArg", propIdStr, "-i64", "0"}); + + ASSERT_FALSE(result.callerShouldDumpState); + // There is no freeze obd2 frame at timestamp 0. + ASSERT_THAT(result.buffer, ContainsRegex("failed to read property value")); +} + +TEST_F(FakeVehicleHardwareTest, testSaveRestoreProp) { + int32_t prop = toInt(VehicleProperty::TIRE_PRESSURE); + std::string propIdStr = std::to_string(prop); + std::string areaIdStr = std::to_string(WHEEL_FRONT_LEFT); + + DumpResult result = getHardware()->dump({"--save-prop", propIdStr, "-a", areaIdStr}); + + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_THAT(result.buffer, ContainsRegex("saved")); + + ASSERT_EQ(setValue(VehiclePropValue{ + .prop = prop, + .areaId = WHEEL_FRONT_LEFT, + .value = + { + .floatValues = {210.0}, + }, + }), + StatusCode::OK); + + result = getHardware()->dump({"--restore-prop", propIdStr, "-a", areaIdStr}); + + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_THAT(result.buffer, ContainsRegex("restored")); + + auto getResult = getValue(VehiclePropValue{.prop = prop, .areaId = WHEEL_FRONT_LEFT}); + + ASSERT_TRUE(getResult.ok()); + // The default value is 200.0. + ASSERT_EQ(getResult.value().value.floatValues, std::vector{200.0}); +} + +TEST_F(FakeVehicleHardwareTest, testDumpInjectEvent) { + int32_t prop = toInt(VehicleProperty::PERF_VEHICLE_SPEED); + std::string propIdStr = std::to_string(prop); + + int64_t timestamp = elapsedRealtimeNano(); + // Inject an event with float value 123.4 and timestamp. + DumpResult result = getHardware()->dump( + {"--inject-event", propIdStr, "-f", "123.4", "-t", std::to_string(timestamp)}); + + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_THAT(result.buffer, + ContainsRegex(StringPrintf("Event for property: %d injected", prop))); + ASSERT_TRUE(waitForChangedProperties(prop, 0, /*count=*/1, milliseconds(1000))) + << "No changed event received for injected event from vehicle bus"; + auto events = getChangedProperties(); + ASSERT_EQ(events.size(), 1u); + auto event = events[0]; + ASSERT_EQ(event.timestamp, timestamp); + ASSERT_EQ(event.value.floatValues, std::vector({123.4})); +} + TEST_F(FakeVehicleHardwareTest, testDumpInvalidOptions) { std::vector options; options.push_back("--invalid"); @@ -1681,10 +1760,10 @@ std::vector GenInvalidOptions() { {"--genfakedata", "--startjson"}, "incorrect argument count"}, {"genfakedata_startjson_invalid_repetition", - {"--genfakedata", "--startjson", "file", "0.1"}, + {"--genfakedata", "--startjson", "--path", "file", "0.1"}, "failed to parse repetition as int: \"0.1\""}, {"genfakedata_startjson_invalid_json_file", - {"--genfakedata", "--startjson", "file", "1"}, + {"--genfakedata", "--startjson", "--path", "file", "1"}, "invalid JSON file"}, {"genfakedata_stopjson_no_args", {"--genfakedata", "--stopjson"}, @@ -1765,7 +1844,7 @@ std::string getTestFilePath(const char* filename) { } TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJson) { - std::vector options = {"--genfakedata", "--startjson", + std::vector options = {"--genfakedata", "--startjson", "--path", getTestFilePath("prop.json"), "2"}; DumpResult result = getHardware()->dump(options); @@ -1790,8 +1869,36 @@ TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJson) { EXPECT_EQ(10, events[7].value.int32Values[0]); } +TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJsonByContent) { + std::vector options = { + "--genfakedata", "--startjson", "--content", + "[{\"timestamp\":1000000,\"areaId\":0,\"value\":8,\"prop\":289408000}]", "1"}; + + DumpResult result = getHardware()->dump(options); + + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_THAT(result.buffer, HasSubstr("successfully")); + + ASSERT_TRUE(waitForChangedProperties(/*count=*/1, milliseconds(1000))) + << "not enough events generated for JSON data generator"; + + auto events = getChangedProperties(); + ASSERT_EQ(1u, events.size()); + EXPECT_EQ(1u, events[0].value.int32Values.size()); + EXPECT_EQ(8, events[0].value.int32Values[0]); +} + +TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJsonInvalidContent) { + std::vector options = {"--genfakedata", "--startjson", "--content", "[{", "2"}; + + DumpResult result = getHardware()->dump(options); + + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_THAT(result.buffer, HasSubstr("invalid JSON content")); +} + TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJsonInvalidFile) { - std::vector options = {"--genfakedata", "--startjson", + std::vector options = {"--genfakedata", "--startjson", "--path", getTestFilePath("blahblah.json"), "2"}; DumpResult result = getHardware()->dump(options); @@ -1802,7 +1909,7 @@ TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJsonInvalidFile) { TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJsonStop) { // No iteration number provided, would loop indefinitely. - std::vector options = {"--genfakedata", "--startjson", + std::vector options = {"--genfakedata", "--startjson", "--path", getTestFilePath("prop.json")}; DumpResult result = getHardware()->dump(options); @@ -1810,7 +1917,9 @@ TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJsonStop) { ASSERT_FALSE(result.callerShouldDumpState); ASSERT_THAT(result.buffer, HasSubstr("successfully")); - result = getHardware()->dump({"--genfakedata", "--stopjson", getTestFilePath("prop.json")}); + std::string id = result.buffer.substr(result.buffer.find("ID: ") + 4); + + result = getHardware()->dump({"--genfakedata", "--stopjson", id}); ASSERT_FALSE(result.callerShouldDumpState); ASSERT_THAT(result.buffer, HasSubstr("successfully")); @@ -1818,7 +1927,7 @@ TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJsonStop) { TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJsonStopInvalidFile) { // No iteration number provided, would loop indefinitely. - std::vector options = {"--genfakedata", "--startjson", + std::vector options = {"--genfakedata", "--startjson", "--path", getTestFilePath("prop.json")}; DumpResult result = getHardware()->dump(options); @@ -1826,7 +1935,7 @@ TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJsonStopInvalidFile) { ASSERT_FALSE(result.callerShouldDumpState); ASSERT_THAT(result.buffer, HasSubstr("successfully")); - result = getHardware()->dump({"--genfakedata", "--stopjson", getTestFilePath("prop1.json")}); + result = getHardware()->dump({"--genfakedata", "--stopjson", "1234"}); ASSERT_FALSE(result.callerShouldDumpState); ASSERT_THAT(result.buffer, HasSubstr("No JSON event generator found")); From c112be137e9ef17940a1c9538016a42ab813c457 Mon Sep 17 00:00:00 2001 From: Helen Date: Tue, 26 Apr 2022 01:02:40 +0000 Subject: [PATCH 056/998] Update ANBR Apis - remove setAnbrEnabled and setAnbrEnabledResponse - change qosSessionId to mediaType Bug: 224905346 Test: Build Change-Id: I2e944c8068b26727d4c437c1f5aa38d1fb79b034 --- .../android/hardware/radio/ims/IRadioIms.aidl | 3 +- .../radio/ims/IRadioImsIndication.aidl | 2 +- .../hardware/radio/ims/IRadioImsResponse.aidl | 1 - .../hardware/radio/ims/ImsStreamType.aidl | 39 +++++++++++++++++++ .../android/hardware/radio/ims/IRadioIms.aidl | 22 ++--------- .../radio/ims/IRadioImsIndication.aidl | 7 ++-- .../hardware/radio/ims/IRadioImsResponse.aidl | 17 -------- .../hardware/radio/ims/ImsStreamType.aidl | 26 +++++++++++++ radio/aidl/vts/radio_ims_indication.cpp | 2 +- radio/aidl/vts/radio_ims_response.cpp | 6 --- radio/aidl/vts/radio_ims_test.cpp | 28 +------------ radio/aidl/vts/radio_ims_utils.h | 4 +- 12 files changed, 78 insertions(+), 79 deletions(-) create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamType.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/ImsStreamType.aidl diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl index 8a0c2108ac..f774555d5d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl @@ -39,6 +39,5 @@ interface IRadioIms { oneway void startImsTraffic(int serial, in String token, android.hardware.radio.ims.ImsTrafficType imsTrafficType, android.hardware.radio.AccessNetwork accessNetworkType); oneway void stopImsTraffic(int serial, in String token); oneway void setResponseFunctions(in android.hardware.radio.ims.IRadioImsResponse radioImsResponse, in android.hardware.radio.ims.IRadioImsIndication radioImsIndication); - oneway void setAnbrEnabled(int serial, int qosSessionId, boolean isEnabled); - oneway void sendAnbrQuery(int serial, int qosSessionId, android.hardware.radio.ims.ImsStreamDirection direction, int bitsPerSecond); + oneway void sendAnbrQuery(int serial, android.hardware.radio.ims.ImsStreamType mediaType, android.hardware.radio.ims.ImsStreamDirection direction, int bitsPerSecond); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl index d91fb0b153..f6d5bc4039 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl @@ -35,6 +35,6 @@ package android.hardware.radio.ims; @VintfStability interface IRadioImsIndication { oneway void onConnectionSetupFailure(in android.hardware.radio.RadioIndicationType type, in String token, in android.hardware.radio.ims.ConnectionFailureInfo info); - oneway void notifyAnbr(in android.hardware.radio.RadioIndicationType type, int qosSessionId, android.hardware.radio.ims.ImsStreamDirection direction, int bitsPerSecond); + oneway void notifyAnbr(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.ims.ImsStreamType mediaType, in android.hardware.radio.ims.ImsStreamDirection direction, int bitsPerSecond); oneway void triggerImsDeregistration(in android.hardware.radio.RadioIndicationType type); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl index c75c7eacae..6f6b446f3c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl @@ -38,6 +38,5 @@ interface IRadioImsResponse { oneway void updateImsRegistrationInfoResponse(in android.hardware.radio.RadioResponseInfo info); oneway void startImsTrafficResponse(in android.hardware.radio.RadioResponseInfo info, in @nullable android.hardware.radio.ims.ConnectionFailureInfo failureInfo); oneway void stopImsTrafficResponse(in android.hardware.radio.RadioResponseInfo info); - oneway void setAnbrEnabledResponse(in android.hardware.radio.RadioResponseInfo info); oneway void sendAnbrQueryResponse(in android.hardware.radio.RadioResponseInfo info); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamType.aidl new file mode 100644 index 0000000000..10c477f938 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamType.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@Backing(type="int") @VintfStability +enum ImsStreamType { + AUDIO = 1, + VIDEO = 2, +} diff --git a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl index 77b6c9afeb..ea7bc046eb 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl @@ -23,6 +23,8 @@ import android.hardware.radio.ims.ImsTrafficType; import android.hardware.radio.ims.IRadioImsIndication; import android.hardware.radio.ims.IRadioImsResponse; import android.hardware.radio.ims.SrvccCall; +import android.hardware.radio.ims.ImsStreamDirection; +import android.hardware.radio.ims.ImsStreamType; /** * This interface is used by IMS telephony layer to talk to cellular radio. @@ -101,33 +103,17 @@ oneway interface IRadioIms { void setResponseFunctions(in IRadioImsResponse radioImsResponse, in IRadioImsIndication radioImsIndication); - /** - * Access Network Bitrate Recommendation (ANBR), see 3GPP TS 26.114. - * This API is used to enable or disable the ANBR feature - * for the bearer corresponding to the qosSessionId - * This will be invoked when both parties in a call support the ANBR feature - * In case of video call, the modem shall use qosSessionId to identify - * appropriate media stream - * - * @param serial Serial number of request - * @param qosSessionId QoS session ID is used to identify media stream such as audio or video - * @param isEnabled True if Anbr feature is enabled, false otherwise - * - * Response function is IRadioImsResponse.setAnbrEnabledResponse() - */ - void setAnbrEnabled(int serial, int qosSessionId, boolean isEnabled); - /** * Access Network Bitrate Recommendation Query (ANBRQ), see 3GPP TS 26.114. * This API triggers radio to send ANBRQ message * to the access network to query the desired bitrate. * * @param serial Serial number of request - * @param qosSessionId QoS session ID is used to identify media stream such as audio or video + * @param mediaType Media type is used to identify media stream such as audio or video * @param direction Direction of this packet stream (e.g. uplink or downlink) * @param bitsPerSecond The bit rate requested by the opponent UE * * Response function is IRadioImsResponse.sendAnbrQueryResponse() */ - void sendAnbrQuery(int serial, int qosSessionId, ImsStreamDirection direction, int bitsPerSecond); + void sendAnbrQuery(int serial, ImsStreamType mediaType, ImsStreamDirection direction, int bitsPerSecond); } diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl index 74a21071ef..7a8cc0e751 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl @@ -19,6 +19,7 @@ package android.hardware.radio.ims; import android.hardware.radio.RadioIndicationType; import android.hardware.radio.ims.ConnectionFailureInfo; import android.hardware.radio.ims.ImsStreamDirection; +import android.hardware.radio.ims.ImsStreamType; /** * Interface declaring unsolicited radio indications for ims APIs. @@ -42,13 +43,13 @@ oneway interface IRadioImsIndication { * Notifies the bit rate received from the network via ANBR message * * @param type Type of radio indication - * @param qosSessionId QoS session ID is used to identify media stream such as audio or video + * @param mediaType Media type is used to identify media stream such as audio or video * @param direction Direction of this packet stream (e.g. uplink or downlink) * @param bitsPerSecond The recommended bit rate for the UE * for a specific logical channel and a specific direction by NW */ - void notifyAnbr(in RadioIndicationType type, int qosSessionId, ImsStreamDirection direction, - int bitsPerSecond); + void notifyAnbr(in RadioIndicationType type, in ImsStreamType mediaType, + in ImsStreamDirection direction, int bitsPerSecond); /** * Fired by radio when a graceful IMS deregistration needs to be performed by telephony diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl index e5a3a6c97f..f15b422572 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl @@ -95,23 +95,6 @@ oneway interface IRadioImsResponse { */ void stopImsTrafficResponse(in RadioResponseInfo info); - /** - * @param info Response info struct containing response type, serial no. and error - * - * Valid errors returned: - * RadioError:NONE - * RadioError:RADIO_NOT_AVAILABLE - * RadioError:INVALID_STATE - * RadioError:NO_MEMORY - * RadioError:SYSTEM_ERR - * RadioError:MODEM_ERR - * RadioError:INTERNAL_ERR - * RadioError:INVALID_ARGUMENTS - * RadioError:REQUEST_NOT_SUPPORTED - * RadioError:NO_RESOURCES - */ - void setAnbrEnabledResponse(in RadioResponseInfo info); - /** * @param info Response info struct containing response type, serial no. and error * diff --git a/radio/aidl/android/hardware/radio/ims/ImsStreamType.aidl b/radio/aidl/android/hardware/radio/ims/ImsStreamType.aidl new file mode 100644 index 0000000000..c12a0c120f --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/ImsStreamType.aidl @@ -0,0 +1,26 @@ +/* + * 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. + */ + +package android.hardware.radio.ims; + +@VintfStability +@Backing(type="int") +enum ImsStreamType { + /** Media Stream Type - Audio **/ + AUDIO = 1, + /** Media Stream Type - Video **/ + VIDEO = 2, +} diff --git a/radio/aidl/vts/radio_ims_indication.cpp b/radio/aidl/vts/radio_ims_indication.cpp index 9c821ffcdf..063781381e 100644 --- a/radio/aidl/vts/radio_ims_indication.cpp +++ b/radio/aidl/vts/radio_ims_indication.cpp @@ -24,7 +24,7 @@ ndk::ScopedAStatus RadioImsIndication::onConnectionSetupFailure(RadioIndicationT } ndk::ScopedAStatus RadioImsIndication::notifyAnbr(RadioIndicationType /*type*/, - int /*qosSessionId*/, ImsStreamDirection /*direction*/, int /*bitsPerSecond*/) { + ImsStreamType /*mediaType*/, ImsStreamDirection /*direction*/, int /*bitsPerSecond*/) { return ndk::ScopedAStatus::ok(); } diff --git a/radio/aidl/vts/radio_ims_response.cpp b/radio/aidl/vts/radio_ims_response.cpp index fa34dc17f9..7a90ebd76d 100644 --- a/radio/aidl/vts/radio_ims_response.cpp +++ b/radio/aidl/vts/radio_ims_response.cpp @@ -45,12 +45,6 @@ ndk::ScopedAStatus RadioImsResponse::stopImsTrafficResponse(const RadioResponseI return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus RadioImsResponse::setAnbrEnabledResponse(const RadioResponseInfo& info) { - rspInfo = info; - parent_ims.notify(info.serial); - return ndk::ScopedAStatus::ok(); -} - ndk::ScopedAStatus RadioImsResponse::sendAnbrQueryResponse(const RadioResponseInfo& info) { rspInfo = info; parent_ims.notify(info.serial); diff --git a/radio/aidl/vts/radio_ims_test.cpp b/radio/aidl/vts/radio_ims_test.cpp index 84b7c6ae34..d3bdd4bbea 100644 --- a/radio/aidl/vts/radio_ims_test.cpp +++ b/radio/aidl/vts/radio_ims_test.cpp @@ -163,32 +163,6 @@ TEST_P(RadioImsTest, stopImsTraffic) { verifyError(radioRsp_ims->rspInfo.error); } -/* - * Test IRadioIms.setAnbrEnabled() for the response returned. - */ -TEST_P(RadioImsTest, setAnbrEnabled) { - if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) { - ALOGI("Skipping setAnbrEnabled because ims is not supported in device"); - return; - } else { - ALOGI("Running setAnbrEnabled because ims is supported in device"); - } - - serial = GetRandomSerialNumber(); - - ndk::ScopedAStatus res = - radio_ims->setAnbrEnabled(serial, 1, true); - ASSERT_OK(res); - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type); - EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial); - - ALOGI("setAnbrEnabled, rspInfo.error = %s\n", - toString(radioRsp_ims->rspInfo.error).c_str()); - - verifyError(radioRsp_ims->rspInfo.error); -} - /* * Test IRadioIms.sendAnbrQuery() for the response returned. */ @@ -203,7 +177,7 @@ TEST_P(RadioImsTest, sendAnbrQuery) { serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = - radio_ims->sendAnbrQuery(serial, 1, ImsStreamDirection::UPLINK, 13200); + radio_ims->sendAnbrQuery(serial, ImsStreamType::AUDIO, ImsStreamDirection::UPLINK, 13200); ASSERT_OK(res); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type); diff --git a/radio/aidl/vts/radio_ims_utils.h b/radio/aidl/vts/radio_ims_utils.h index 2967476295..c9ecf4a9cb 100644 --- a/radio/aidl/vts/radio_ims_utils.h +++ b/radio/aidl/vts/radio_ims_utils.h @@ -48,8 +48,6 @@ class RadioImsResponse : public BnRadioImsResponse { virtual ndk::ScopedAStatus stopImsTrafficResponse(const RadioResponseInfo& info) override; - virtual ndk::ScopedAStatus setAnbrEnabledResponse(const RadioResponseInfo& info) override; - virtual ndk::ScopedAStatus sendAnbrQueryResponse(const RadioResponseInfo& info) override; }; @@ -65,7 +63,7 @@ class RadioImsIndication : public BnRadioImsIndication { virtual ndk::ScopedAStatus onConnectionSetupFailure(RadioIndicationType type, const std::string& token, const ConnectionFailureInfo& info) override; - virtual ndk::ScopedAStatus notifyAnbr(RadioIndicationType type, int qosSessionId, + virtual ndk::ScopedAStatus notifyAnbr(RadioIndicationType type, ImsStreamType mediaType, ImsStreamDirection direction, int bitsPerSecond) override; virtual ndk::ScopedAStatus triggerImsDeregistration(RadioIndicationType type) override; From a8c914ae693e2f3bc1b86563a6a0e461b18319ff Mon Sep 17 00:00:00 2001 From: Guanwei Chen Date: Thu, 7 Apr 2022 14:34:36 +0800 Subject: [PATCH 057/998] fix first_api_level property fail in VF projects Should use "ro.board.first_api_level" for vendor freeze project Bug: 228778569 Test: run cts VtsHalMediaOmxV1_0TargetStoreTest pass Change-Id: Ib46206be6267a44aaa0a8235a4f017569bb4de94 --- .../functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp | 5 +++++ 1 file changed, 5 insertions(+) mode change 100644 => 100755 media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp diff --git a/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp b/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp old mode 100644 new mode 100755 index 5fa13e7c5a..2ae9c2b001 --- a/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp +++ b/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp @@ -375,6 +375,11 @@ TEST_P(StoreHidlTest, ListRoles) { } static int getFirstApiLevel() { + int boardApiLevel = android::base::GetIntProperty("ro.board.first_api_level", 0); + if (boardApiLevel != 0) { + return boardApiLevel; + } + return android::base::GetIntProperty("ro.product.first_api_level", __ANDROID_API_T__); } From 20528349e703b8c55dfb16714d91e1fee9980527 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Thu, 28 Apr 2022 03:50:21 +0000 Subject: [PATCH 058/998] Update comments of IRadioIms HAL Bug: 216387835 Test: build & flash Change-Id: I9093badd53fc7fc46e1e2fb369c41e2c1fbdee77 --- .../hardware/radio/ims/ConnectionFailureInfo.aidl | 2 +- radio/aidl/android/hardware/radio/ims/IRadioIms.aidl | 9 +++++++++ radio/aidl/android/hardware/radio/ims/SrvccCall.aidl | 6 +++--- .../hardware/radio/network/NrRegistrationInfo.aidl | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/radio/aidl/android/hardware/radio/ims/ConnectionFailureInfo.aidl b/radio/aidl/android/hardware/radio/ims/ConnectionFailureInfo.aidl index 0b6415cdeb..473e1124ee 100644 --- a/radio/aidl/android/hardware/radio/ims/ConnectionFailureInfo.aidl +++ b/radio/aidl/android/hardware/radio/ims/ConnectionFailureInfo.aidl @@ -44,7 +44,7 @@ parcelable ConnectionFailureInfo { } /** - * Values are REASON_ + * Values are REASON_* constants */ ConnectionFailureReason failureReason; diff --git a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl index 77b6c9afeb..07e8a243a3 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl @@ -37,6 +37,7 @@ oneway interface IRadioIms { /** * Provides a list of SRVCC call information to radio. * + * @param serial Serial number of request * @param srvccCalls the list of calls * * Response function is IRadioImsResponse.setSrvccCallInfoResponse() @@ -71,7 +72,14 @@ oneway interface IRadioIms { * shall be prioritized to the subscription which handles higher priority service. * When both subscriptions are handling the same type of service then RF shall be * prioritized to the voice preferred sub. + * 3. To evaluate the overall access barring in the case of ACB, ACB-Skp/SCM, + * SSAC and UAC. If the specific failure including network access, modem + * internal and RF resource prioritization from the modem happen, + * IRadioImsResponse.startImsTrafficResponse() or + * IRadioImsIndication#onConnectionSetupFailure shall be invoked with the + * failure reason. * + * @param serial Serial number of request * @param token A nonce to identify the request * @param imsTrafficType IMS traffic type like registration, voice, and video * @param accessNetworkType The type of the radio access network used @@ -86,6 +94,7 @@ oneway interface IRadioIms { * For all IMS traffic, notified with startImsTraffic, IMS service shall notify * stopImsTraffic when it completes the traffic specified by the token. * + * @param serial Serial number of request * @param token The token assigned by startImsTraffic() * * Response function is IRadioImsResponse.stopImsTrafficResponse() diff --git a/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl b/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl index e7e76b12d9..cf3468a41b 100644 --- a/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl +++ b/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl @@ -51,7 +51,7 @@ parcelable SrvccCall { /** The type of the call */ CallType callType; - /** Values are android.hardware.radio.voice.Call.STATE_ */ + /** Values are android.hardware.radio.voice.Call.STATE_* constants */ int callState; /** The substate of the call */ @@ -69,12 +69,12 @@ parcelable SrvccCall { /** Remote party nummber */ String number; - /** Values are android.hardware.radio.voice.Call.PRESENTATION_ */ + /** Values are android.hardware.radio.voice.Call.PRESENTATION_* constants */ int numPresentation; /** Remote party name */ String name; - /** Values are android.hardware.radio.voice.Call.PRESENTATION_ */ + /** Values are android.hardware.radio.voice.Call.PRESENTATION_* constants */ int namePresentation; } diff --git a/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl b/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl index 8ca7697a5a..cbf233a266 100644 --- a/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl @@ -30,6 +30,6 @@ parcelable NrRegistrationInfo { /** Network capabilities for voice over PS services. */ NrVopsInfo ngranNrVopsInfo; - /** Values are bitwise ORs of EXTRA_ */ + /** Values are bitwise ORs of EXTRA_* constants */ int extraInfo; } From 0b35462a26382bf75a81bd9f1ae80e0efc2bd99b Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Thu, 28 Apr 2022 11:33:58 +0000 Subject: [PATCH 059/998] Add JavaDerive toString to AIDL classes of IMS HAL Test: manually verify logcat Bug: 223230764 Bug: 216387835 Change-Id: I8de808a8c3d15d4b6f45e67c3297971f35feb8e5 --- .../android/hardware/radio/ims/ConnectionFailureInfo.aidl | 2 +- .../current/android/hardware/radio/ims/ImsFailureReason.aidl | 2 +- .../current/android/hardware/radio/ims/ImsRegistration.aidl | 2 +- .../android/hardware/radio/ims/ImsRegistrationState.aidl | 2 +- .../current/android/hardware/radio/ims/ImsStreamDirection.aidl | 2 +- .../current/android/hardware/radio/ims/ImsTrafficType.aidl | 2 +- .../current/android/hardware/radio/ims/SrvccCall.aidl | 2 +- .../aidl/android/hardware/radio/ims/ConnectionFailureInfo.aidl | 1 + radio/aidl/android/hardware/radio/ims/ImsFailureReason.aidl | 1 + radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl | 1 + radio/aidl/android/hardware/radio/ims/ImsRegistrationState.aidl | 1 + radio/aidl/android/hardware/radio/ims/ImsStreamDirection.aidl | 1 + radio/aidl/android/hardware/radio/ims/ImsTrafficType.aidl | 1 + radio/aidl/android/hardware/radio/ims/SrvccCall.aidl | 1 + 14 files changed, 14 insertions(+), 7 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ConnectionFailureInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ConnectionFailureInfo.aidl index 79daf6dcd8..030479f336 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ConnectionFailureInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ConnectionFailureInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable ConnectionFailureInfo { android.hardware.radio.ims.ConnectionFailureInfo.ConnectionFailureReason failureReason; int causeCode; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsFailureReason.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsFailureReason.aidl index 63a3674fb5..918ae3a94c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsFailureReason.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsFailureReason.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ImsFailureReason { NONE = 0, FATAL_ERROR = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl index 4ee106ddec..84ae2cb93e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable ImsRegistration { android.hardware.radio.ims.ImsRegistrationState regState; android.hardware.radio.AccessNetwork accessNetworkType; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistrationState.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistrationState.aidl index 58ffc6f7a2..664f56183d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistrationState.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistrationState.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ImsRegistrationState { NOT_REGISTERED = 0, REGISTERED = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl index 2d41897267..cf2e4f1d89 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsStreamDirection.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ImsStreamDirection { UPLINK = 1, DOWNLINK = 2, diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl index b0625c23b4..f7654b47fb 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ImsTrafficType { EMERGENCY = 0, EMERGENCY_SMS = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl index 1fb44dc85b..a09cca6e8d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable SrvccCall { int index; android.hardware.radio.ims.SrvccCall.CallType callType; diff --git a/radio/aidl/android/hardware/radio/ims/ConnectionFailureInfo.aidl b/radio/aidl/android/hardware/radio/ims/ConnectionFailureInfo.aidl index 0b6415cdeb..372ffcc494 100644 --- a/radio/aidl/android/hardware/radio/ims/ConnectionFailureInfo.aidl +++ b/radio/aidl/android/hardware/radio/ims/ConnectionFailureInfo.aidl @@ -17,6 +17,7 @@ package android.hardware.radio.ims; @VintfStability +@JavaDerive(toString=true) parcelable ConnectionFailureInfo { @VintfStability diff --git a/radio/aidl/android/hardware/radio/ims/ImsFailureReason.aidl b/radio/aidl/android/hardware/radio/ims/ImsFailureReason.aidl index a227dca18d..21da582930 100644 --- a/radio/aidl/android/hardware/radio/ims/ImsFailureReason.aidl +++ b/radio/aidl/android/hardware/radio/ims/ImsFailureReason.aidl @@ -17,6 +17,7 @@ package android.hardware.radio.ims; @VintfStability +@JavaDerive(toString=true) @Backing(type="int") enum ImsFailureReason { /** Default value */ diff --git a/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl b/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl index 3982ac87e8..b727af0414 100644 --- a/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl +++ b/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl @@ -21,6 +21,7 @@ import android.hardware.radio.ims.ImsFailureReason; import android.hardware.radio.ims.ImsRegistrationState; @VintfStability +@JavaDerive(toString=true) parcelable ImsRegistration { /** Default value */ const int IMS_MMTEL_CAPABILITY_NONE = 0; diff --git a/radio/aidl/android/hardware/radio/ims/ImsRegistrationState.aidl b/radio/aidl/android/hardware/radio/ims/ImsRegistrationState.aidl index 21769d5442..fd5c0fa930 100644 --- a/radio/aidl/android/hardware/radio/ims/ImsRegistrationState.aidl +++ b/radio/aidl/android/hardware/radio/ims/ImsRegistrationState.aidl @@ -17,6 +17,7 @@ package android.hardware.radio.ims; @VintfStability +@JavaDerive(toString=true) @Backing(type="int") enum ImsRegistrationState { /** IMS is not registered */ diff --git a/radio/aidl/android/hardware/radio/ims/ImsStreamDirection.aidl b/radio/aidl/android/hardware/radio/ims/ImsStreamDirection.aidl index 8336a74da7..c0cea32230 100644 --- a/radio/aidl/android/hardware/radio/ims/ImsStreamDirection.aidl +++ b/radio/aidl/android/hardware/radio/ims/ImsStreamDirection.aidl @@ -17,6 +17,7 @@ package android.hardware.radio.ims; @VintfStability +@JavaDerive(toString=true) @Backing(type="int") enum ImsStreamDirection { /** DIRECTION_UPLINK - From UE to Network **/ diff --git a/radio/aidl/android/hardware/radio/ims/ImsTrafficType.aidl b/radio/aidl/android/hardware/radio/ims/ImsTrafficType.aidl index 32baa044a1..5a824c0d54 100644 --- a/radio/aidl/android/hardware/radio/ims/ImsTrafficType.aidl +++ b/radio/aidl/android/hardware/radio/ims/ImsTrafficType.aidl @@ -17,6 +17,7 @@ package android.hardware.radio.ims; @VintfStability +@JavaDerive(toString=true) @Backing(type="int") enum ImsTrafficType { /** Emergency call */ diff --git a/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl b/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl index e7e76b12d9..90c333b986 100644 --- a/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl +++ b/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl @@ -17,6 +17,7 @@ package android.hardware.radio.ims; @VintfStability +@JavaDerive(toString=true) parcelable SrvccCall { @VintfStability From 3041e526de57e76f2861b04e3b62a10b1408d851 Mon Sep 17 00:00:00 2001 From: Joe Bolinger Date: Fri, 15 Apr 2022 17:50:08 -0700 Subject: [PATCH 060/998] Declare example HAL as virtual instance. Bug: 228638448 Test: manual (see README.md) Change-Id: I4c00b9e394eb7863416b61662528869f7e70c09d --- .../fingerprint/aidl/default/Android.bp | 4 +- biometrics/fingerprint/aidl/default/README.md | 56 ++++++++++++------- ...rint-default.rc => fingerprint-example.rc} | 3 +- ...nt-default.xml => fingerprint-example.xml} | 2 +- biometrics/fingerprint/aidl/default/main.cpp | 2 +- .../compatibility_matrix.current.xml | 1 + 6 files changed, 41 insertions(+), 27 deletions(-) rename biometrics/fingerprint/aidl/default/{fingerprint-default.rc => fingerprint-example.rc} (57%) rename biometrics/fingerprint/aidl/default/{fingerprint-default.xml => fingerprint-example.xml} (79%) diff --git a/biometrics/fingerprint/aidl/default/Android.bp b/biometrics/fingerprint/aidl/default/Android.bp index e6628f29fc..70fadfecc6 100644 --- a/biometrics/fingerprint/aidl/default/Android.bp +++ b/biometrics/fingerprint/aidl/default/Android.bp @@ -11,8 +11,8 @@ cc_binary { name: "android.hardware.biometrics.fingerprint-service.example", vendor: true, relative_install_path: "hw", - init_rc: ["fingerprint-default.rc"], - vintf_fragments: ["fingerprint-default.xml"], + init_rc: ["fingerprint-example.rc"], + vintf_fragments: ["fingerprint-example.xml"], local_include_dirs: ["include"], srcs: [ "CancellationSignal.cpp", diff --git a/biometrics/fingerprint/aidl/default/README.md b/biometrics/fingerprint/aidl/default/README.md index 046602f00f..a6e6b81926 100644 --- a/biometrics/fingerprint/aidl/default/README.md +++ b/biometrics/fingerprint/aidl/default/README.md @@ -1,17 +1,30 @@ # Virtual Fingerprint HAL -This is a virtual HAL implementation that is backed by system properties -instead of actual hardware. It's intended for testing and UI development -on debuggable builds to allow devices to masquerade as alternative device -types and for emulators. +This is a virtual HAL implementation that is backed by system properties instead +of actual hardware. It's intended for testing and UI development on debuggable +builds to allow devices to masquerade as alternative device types and for +emulators. + +## Supported Devices + +This HAL can be used on emulators, like cuttlefish, or on real devices. Add the +following to your device's `.mk` file to include it: + +``` +PRODUCT_PACKAGES_DEBUG += android.hardware.biometrics.fingerprint-service.example +``` + +The virtual HAL will be ignored if a real HAL is also installed on the target +device. Set the `biometric_virtual_enabled` settings and reboot the device to +switch to the virtual HAL. Unset it and reboot again to switch back. ## Getting Started First, set the type of sensor the device should use, enable the virtual extensions in the framework, and reboot. -This doesn't work with HIDL and you typically need to have a PIN or password -set for things to work correctly, so this is a good time to set those too. +This doesn't work with HIDL and you typically need to have a PIN or password set +for things to work correctly, so this is a good time to set those too. ```shell $ adb root @@ -24,22 +37,23 @@ $ adb reboot ### Enrollments -Next, setup enrollments on the device. This can either be done through -the UI, or via adb. +Next, setup enrollments on the device. This can either be done through the UI, +or via adb. #### UI Enrollment - 1. Tee up the results of the enrollment before starting the process: +1. Tee up the results of the enrollment before starting the process: - ```shell - $ adb shell setprop vendor.fingerprint.virtual.next_enrollment 1:100,100,100:true - ``` - 2. Navigate to `Settings -> Security -> Fingerprint Unlock` and follow the prompts. - 3. Verify the enrollments in the UI: + ```shell + $ adb shell setprop vendor.fingerprint.virtual.next_enrollment 1:100,100,100:true + ``` +2. Navigate to `Settings -> Security -> Fingerprint Unlock` and follow the + prompts. +3. Verify the enrollments in the UI: - ```shell - $ adb shell getprop persist.vendor.fingerprint.virtual.enrollments - ``` + ```shell + $ adb shell getprop persist.vendor.fingerprint.virtual.enrollments + ``` #### Direct Enrollment @@ -51,10 +65,10 @@ $ adb shell setprop persist.vendor.fingerprint.virtual.enrollments 1 $ adb shell cmd fingerprint sync ``` -Note: You may need to do this twice. The templates are checked -as part of some lazy operations, like user switching and startup, which can -cause the framework to delete the enrollments before the sync operation runs. -Until this is fixed, just run the commands twice as a workaround. +**Note: You may need to do this twice.** The templates are checked as part of +some lazy operations, like user switching and startup, which can cause the +framework to delete the enrollments before the sync operation runs. Until this +is fixed, just run the commands twice as a workaround. ### Authenticate diff --git a/biometrics/fingerprint/aidl/default/fingerprint-default.rc b/biometrics/fingerprint/aidl/default/fingerprint-example.rc similarity index 57% rename from biometrics/fingerprint/aidl/default/fingerprint-default.rc rename to biometrics/fingerprint/aidl/default/fingerprint-example.rc index eb62c567fd..574438edbb 100644 --- a/biometrics/fingerprint/aidl/default/fingerprint-default.rc +++ b/biometrics/fingerprint/aidl/default/fingerprint-example.rc @@ -1,5 +1,4 @@ -service vendor.fingerprint-default /vendor/bin/hw/android.hardware.biometrics.fingerprint-service.example +service vendor.fingerprint-example /vendor/bin/hw/android.hardware.biometrics.fingerprint-service.example class hal user nobody group nobody - diff --git a/biometrics/fingerprint/aidl/default/fingerprint-default.xml b/biometrics/fingerprint/aidl/default/fingerprint-example.xml similarity index 79% rename from biometrics/fingerprint/aidl/default/fingerprint-default.xml rename to biometrics/fingerprint/aidl/default/fingerprint-example.xml index d322eb65b3..05d1279e58 100644 --- a/biometrics/fingerprint/aidl/default/fingerprint-default.xml +++ b/biometrics/fingerprint/aidl/default/fingerprint-example.xml @@ -2,6 +2,6 @@ android.hardware.biometrics.fingerprint 2 - IFingerprint/default + IFingerprint/virtual diff --git a/biometrics/fingerprint/aidl/default/main.cpp b/biometrics/fingerprint/aidl/default/main.cpp index c985201d63..0e672b10ab 100644 --- a/biometrics/fingerprint/aidl/default/main.cpp +++ b/biometrics/fingerprint/aidl/default/main.cpp @@ -27,7 +27,7 @@ int main() { ABinderProcess_setThreadPoolMaxThreadCount(0); std::shared_ptr hal = ndk::SharedRefBase::make(); - const std::string instance = std::string(Fingerprint::descriptor) + "/default"; + const std::string instance = std::string(Fingerprint::descriptor) + "/virtual"; binder_status_t status = AServiceManager_addService(hal->asBinder().get(), instance.c_str()); CHECK_EQ(status, STATUS_OK); diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index e3b17f508f..c49aaab600 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -142,6 +142,7 @@ IFingerprint default + virtual From 80e55dabf3a0a052c929a27d5ab2bc628b96c62b Mon Sep 17 00:00:00 2001 From: Daniel Norman Date: Thu, 28 Apr 2022 19:54:31 +0000 Subject: [PATCH 061/998] Fixes sensors AIDL default impl APEX's binary name. commit bde01c60fadb8da6a1a24bca3dd21e17229c4316 moved this APEX from the HIDL to AIDL impl, but accidentally left out the rename of the binary in the file_contexts Also deletes unused .rc file here; the APEX already reuses the .rc file from outside the APEX dir. Bug: 222579208 Test: Build cf_x86_64_phone using sensors APEX: http://ab/P33964358 Boot the device, use accel sensor to rotate the screen. Change-Id: Ib107770312bb80b67364c855efd2df3a9bc52b9a --- sensors/aidl/default/apex/com.android.hardware.sensors.rc | 7 ------- sensors/aidl/default/apex/file_contexts | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) delete mode 100644 sensors/aidl/default/apex/com.android.hardware.sensors.rc diff --git a/sensors/aidl/default/apex/com.android.hardware.sensors.rc b/sensors/aidl/default/apex/com.android.hardware.sensors.rc deleted file mode 100644 index bd245b4ebd..0000000000 --- a/sensors/aidl/default/apex/com.android.hardware.sensors.rc +++ /dev/null @@ -1,7 +0,0 @@ -service vendor.sensors-hal-2-1-mock /apex/com.android.hardware.sensors/bin/hw/android.hardware.sensors@2.1-service.mock - interface android.hardware.sensors@2.0::ISensors default - interface android.hardware.sensors@2.1::ISensors default - class hal - user system - group system - rlimit rtprio 10 10 diff --git a/sensors/aidl/default/apex/file_contexts b/sensors/aidl/default/apex/file_contexts index d0095c03be..27be16b14e 100644 --- a/sensors/aidl/default/apex/file_contexts +++ b/sensors/aidl/default/apex/file_contexts @@ -2,4 +2,4 @@ # Permission XMLs /etc/permissions(/.*)? u:object_r:vendor_configs_file:s0 # Service binary -/bin/hw/android\.hardware\.sensors@2\.1-service\.mock u:object_r:hal_sensors_default_exec:s0 +/bin/hw/android\.hardware\.sensors-service\.example u:object_r:hal_sensors_default_exec:s0 \ No newline at end of file From aaf4e6df669306f29ded36b1fe0153003c1a03e6 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Sat, 30 Apr 2022 00:55:42 +0000 Subject: [PATCH 062/998] Update comments of IRadioIms HAL Bug: 216387835 Test: build & flash Change-Id: Id128e65cc6fe16c26542c5ce8216e5d47edb1aa7 --- radio/aidl/android/hardware/radio/ims/IRadioIms.aidl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl index 07e8a243a3..a1829d5e82 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl @@ -51,7 +51,6 @@ oneway interface IRadioIms { * 1) Graceful IMS PDN disconnection on cellular when NAS is about to perform detach * eg. SIM removal or SIM refresh * 2) Block PLMN or RAT based on the IMS registration failure reason - * 3) Start IMS establishment timers when on IMS registration is started * * @param serial Serial number of request * @param imsRegistration IMS registration information @@ -75,8 +74,8 @@ oneway interface IRadioIms { * 3. To evaluate the overall access barring in the case of ACB, ACB-Skp/SCM, * SSAC and UAC. If the specific failure including network access, modem * internal and RF resource prioritization from the modem happen, - * IRadioImsResponse.startImsTrafficResponse() or - * IRadioImsIndication#onConnectionSetupFailure shall be invoked with the + * {@link IRadioImsResponse#startImsTrafficResponse()} or + * {@link IRadioImsIndication#onConnectionSetupFailure()} shall be invoked with the * failure reason. * * @param serial Serial number of request From 379b0cc3b97b1446bb4cabb0de2d2027424e7532 Mon Sep 17 00:00:00 2001 From: Keith Mok Date: Tue, 3 May 2022 23:32:03 +0000 Subject: [PATCH 063/998] occupant_awareness: Add AIDL fuzzer Add a fuzzer for occupant_awareness Bug: 231367586 Test: android.hardware.automotive.occupant_awareness-service.fuzzer Change-Id: Ie857ab7d3f844bdaa34fc5aaeadc8a2906fbceff --- .../aidl/default/Android.bp | 25 ++++++++++++ .../aidl/default/fuzzer.cpp | 38 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 automotive/occupant_awareness/aidl/default/fuzzer.cpp diff --git a/automotive/occupant_awareness/aidl/default/Android.bp b/automotive/occupant_awareness/aidl/default/Android.bp index 66af9deed0..3dc7e0d9d1 100644 --- a/automotive/occupant_awareness/aidl/default/Android.bp +++ b/automotive/occupant_awareness/aidl/default/Android.bp @@ -39,3 +39,28 @@ cc_binary { "android.hardware.automotive.occupant_awareness-V1-ndk", ], } + +cc_fuzz { + name: "android.hardware.automotive.occupant_awareness-service.fuzzer", + static_libs: [ + "android.hardware.automotive.occupant_awareness-V1-ndk", + "libbase", + "libbinder_random_parcel", + "libcutils", + "liblog", + ], + shared_libs: [ + "libbinder_ndk", + "libbinder", + "libutils", + ], + srcs: [ + "fuzzer.cpp", + "OccupantAwareness.cpp", + ], + fuzz_config: { + cc: [ + "keithmok@google.com", + ], + }, +} diff --git a/automotive/occupant_awareness/aidl/default/fuzzer.cpp b/automotive/occupant_awareness/aidl/default/fuzzer.cpp new file mode 100644 index 0000000000..551b83a0e8 --- /dev/null +++ b/automotive/occupant_awareness/aidl/default/fuzzer.cpp @@ -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. + */ + +#include +#include + +#include +#include +#include + +#include "OccupantAwareness.h" + +using ::aidl::android::hardware::automotive::occupant_awareness::IOccupantAwareness; +using ::android::fuzzService; +using ::android::hardware::automotive::occupant_awareness::V1_0::implementation::OccupantAwareness; +using ::ndk::ScopedAStatus; +using ::ndk::SharedRefBase; + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + auto occupantAwareness = SharedRefBase::make(); + + fuzzService(occupantAwareness->asBinder().get(), FuzzedDataProvider(data, size)); + + return 0; +} From 23174fc156018d096071ee450be2609210578d52 Mon Sep 17 00:00:00 2001 From: Keith Mok Date: Wed, 4 May 2022 06:14:44 +0000 Subject: [PATCH 064/998] Fix fuzzer error for FormatConvertFuzzer FormatConvert have some restructions on the width and height. The logic to ensure width is even, and height is divisible by 16 is wrong. Fix it. Bug: 230733449 Test: FormatConvertFuzzer_copyNV21toRGB32 Change-Id: Ic52c1eea1ea89625db31538c97e49903af6958dc --- .../common/utils/default/test/fuzz/FormatConvertFuzzer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/automotive/evs/common/utils/default/test/fuzz/FormatConvertFuzzer.cpp b/automotive/evs/common/utils/default/test/fuzz/FormatConvertFuzzer.cpp index 58423c8187..7f90501ee5 100644 --- a/automotive/evs/common/utils/default/test/fuzz/FormatConvertFuzzer.cpp +++ b/automotive/evs/common/utils/default/test/fuzz/FormatConvertFuzzer.cpp @@ -32,9 +32,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, std::size_t size) { // API have a requirement that width must be divied by 16 except yuyvtorgb int min_height = 2; - int max_height = (image_pixel_size / 16) & ~(1); // must be even number + int max_height = (image_pixel_size / 16); int height = fdp.ConsumeIntegralInRange(min_height, max_height); - int width = (image_pixel_size / height) & ~(16); // must be divisible by 16 + height &= ~(1); // must be even number + int width = (image_pixel_size / height) & ~(0xF); // must be divisible by 16 uint8_t* src = (uint8_t*)(data + 4); uint32_t* tgt = (uint32_t*)malloc(sizeof(uint32_t) * image_pixel_size); From 1ce9d5488ab1ebb885d49f9b15eecedf67be5e09 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Wed, 4 May 2022 22:13:12 +0000 Subject: [PATCH 065/998] audio VTS: Fix handling of ULTRASOUND sources When opening a stream on an ultrasound input (AUDIO_INPUT_FLAG_ULTRASOUND), the source type AUDIO_SOURCE_ULTRASOUND must be used. Bug: 231275185 Test: atest VtsHalAudioV7_0TargetTest Test: atest VtsHalAudioV7_1TargetTest Change-Id: Ib1fb5b8218eb0c52edf31789fa937c0a8b6c5082 --- .../vts/functional/7.0/AudioPrimaryHidlHalTest.cpp | 2 +- .../vts/functional/AudioPrimaryHidlHalTest.h | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp index f25c391ba9..dfc238623c 100644 --- a/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp +++ b/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp @@ -715,7 +715,7 @@ class PcmOnlyConfigInputStreamTest : public InputStreamTest { sink.base.channelMask.value(getConfig().base.channelMask); sink.ext.mix({}); sink.ext.mix().ioHandle = helper.getIoHandle(); - sink.ext.mix().useCase.source(toString(xsd::AudioSource::AUDIO_SOURCE_MIC)); + sink.ext.mix().useCase.source(initMetadata.tracks[0].source); EXPECT_OK(getDevice()->createAudioPatch(hidl_vec{source}, hidl_vec{sink}, returnIn(res, mPatchHandle))); diff --git a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h index 38d6eff7d0..38e9e5f467 100644 --- a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h +++ b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h @@ -1239,23 +1239,30 @@ class InputStreamTest : public OpenStreamTest<::android::hardware::audio::CORE_TYPES_CPP_VERSION::IStreamIn> { void SetUp() override { ASSERT_NO_FATAL_FAILURE(OpenStreamTest::SetUp()); // setup base + auto flags = getInputFlags(); #if MAJOR_VERSION <= 6 address.device = AudioDevice::IN_DEFAULT; #elif MAJOR_VERSION >= 7 auto maybeSourceAddress = getCachedPolicyConfig().getSourceDeviceForMixPort( getDeviceName(), getMixPortName()); + auto& metadata = initMetadata.tracks[0]; if (maybeSourceAddress.has_value() && !xsd::isTelephonyDevice(maybeSourceAddress.value().deviceType)) { address = maybeSourceAddress.value(); - auto& metadata = initMetadata.tracks[0]; metadata.source = toString(xsd::AudioSource::AUDIO_SOURCE_UNPROCESSED); metadata.channelMask = getConfig().base.channelMask; } else { address.deviceType = toString(xsd::AudioDevice::AUDIO_DEVICE_IN_DEFAULT); } -#endif +#if MAJOR_VERSION == 7 && MINOR_VERSION >= 1 + auto flagsIt = std::find(flags.begin(), flags.end(), + toString(xsd::AudioInOutFlag::AUDIO_INPUT_FLAG_ULTRASOUND)); + if (flagsIt != flags.end()) { + metadata.source = toString(xsd::AudioSource::AUDIO_SOURCE_ULTRASOUND); + } +#endif // 7.1 +#endif // MAJOR_VERSION >= 7 const AudioConfig& config = getConfig(); - auto flags = getInputFlags(); testOpen( [&](AudioIoHandle handle, AudioConfig config, auto cb) { return getDevice()->openInputStream(handle, address, config, flags, From 4dc3b827472ce586e00246238e977ffddc097910 Mon Sep 17 00:00:00 2001 From: Keith Mok Date: Thu, 5 May 2022 21:32:33 +0000 Subject: [PATCH 066/998] Add a fuzzer for AIDL VHAL Test: android.hardware.automotive.vehicle@V1-default-service_fuzzer Bug: 231622881 Change-Id: Ib338393aab48f8001d4252b067cb788550e770bd --- automotive/vehicle/aidl/impl/vhal/Android.bp | 33 +++++++++++++++++ .../vehicle/aidl/impl/vhal/src/fuzzer.cpp | 35 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 automotive/vehicle/aidl/impl/vhal/src/fuzzer.cpp diff --git a/automotive/vehicle/aidl/impl/vhal/Android.bp b/automotive/vehicle/aidl/impl/vhal/Android.bp index 5abcaf6980..8b4f559348 100644 --- a/automotive/vehicle/aidl/impl/vhal/Android.bp +++ b/automotive/vehicle/aidl/impl/vhal/Android.bp @@ -66,3 +66,36 @@ cc_library { "libbinder_ndk", ], } + +cc_fuzz { + name: "android.hardware.automotive.vehicle@V1-default-service_fuzzer", + vendor: true, + defaults: [ + "FakeVehicleHardwareDefaults", + "VehicleHalDefaults", + "android-automotive-large-parcelable-defaults", + ], + header_libs: [ + "IVehicleHardware", + "VehicleHalDefaultConfig", + ], + static_libs: [ + "DefaultVehicleHal", + "FakeVehicleHardware", + "VehicleHalUtils", + "libbase", + "libbinder_random_parcel", + "libcutils", + ], + shared_libs: [ + "libbinder_ndk", + "libbinder", + "libutils", + ], + srcs: ["src/fuzzer.cpp"], + fuzz_config: { + cc: [ + "keithmok@google.com", + ], + }, +} diff --git a/automotive/vehicle/aidl/impl/vhal/src/fuzzer.cpp b/automotive/vehicle/aidl/impl/vhal/src/fuzzer.cpp new file mode 100644 index 0000000000..ac1e3b1a56 --- /dev/null +++ b/automotive/vehicle/aidl/impl/vhal/src/fuzzer.cpp @@ -0,0 +1,35 @@ +/* + * 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. + */ + +#include +#include +#include +#include + +using ::android::fuzzService; +using ::android::hardware::automotive::vehicle::DefaultVehicleHal; +using ::android::hardware::automotive::vehicle::fake::FakeVehicleHardware; +using ::ndk::SharedRefBase; + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + std::unique_ptr hardware = std::make_unique(); + std::shared_ptr vhal = + ::ndk::SharedRefBase::make(std::move(hardware)); + + fuzzService(vhal->asBinder().get(), FuzzedDataProvider(data, size)); + + return 0; +} From 2b975600dc9b8fddaf5be2228d9402738a118fbe Mon Sep 17 00:00:00 2001 From: Seth Moore Date: Thu, 5 May 2022 11:01:33 -0700 Subject: [PATCH 067/998] Clean up description of IRemotelyProvisionedComponent uniqueId The identifier is to be used in telemetry to identify problematic implementations. Thus, it needs to be globally consistent, at least within a given device type. Test: None -- doc only changes Bug: 231495834 Change-Id: Ia55db336fa099d8e1196f6bfe2bafb6fa5ead329 --- .../android/hardware/security/keymint/RpcHardwareInfo.aidl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/security/keymint/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl b/security/keymint/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl index 3a4c233cf5..0cb33ce91e 100644 --- a/security/keymint/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl +++ b/security/keymint/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl @@ -59,13 +59,17 @@ parcelable RpcHardwareInfo { * client should NOT interpret the content of the identifier in any way. The client can only * compare identifiers to determine if two IRemotelyProvisionedComponents share the same * implementation. Each IRemotelyProvisionedComponent implementation must have a distinct - * identifier from all other implementations on the same device. + * identifier from all other implementations, and it must be consistent across all devices. + * It's critical that this identifier not be usable to uniquely identify a specific device. * * This identifier must be consistent across reboots, as it is used to store and track * provisioned keys in a persistent, on-device database. * * uniqueId may not be empty, and must not be any longer than 32 characters. * + * A recommended construction for this value is "[Vendor] [Component Name] [Major Version]", + * e.g. "Google Trusty KeyMint 1". + * * This field was added in API version 2. * */ From 5e26ad3bf7c5923775fead0fd1018032fa9ed832 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Fri, 6 May 2022 01:27:53 +0000 Subject: [PATCH 068/998] Fix a bug that would access uninitialized data. Fix a bug where mThread is initialized before mRequests, causing the new thread to access uninitialized mRequests. Test: None. This is a race condition depending on when the thread is started and hard to reproduce. Bug: 231647009 Change-Id: I68037125bf4d14846585bd3a038844e4a7ced377 --- .../fake_impl/hardware/src/FakeVehicleHardware.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index a7e986b9ca..7f9b63aeb9 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -1339,11 +1339,15 @@ Result> FakeVehicleHardware::parseHexString(const std::stri template FakeVehicleHardware::PendingRequestHandler::PendingRequestHandler( FakeVehicleHardware* hardware) - : mHardware(hardware), mThread([this] { - while (mRequests.waitForItems()) { - handleRequestsOnce(); - } - }) {} + : mHardware(hardware) { + // Don't initialize mThread in initialization list because mThread depends on mRequests and we + // want mRequests to be initialized first. + mThread = std::thread([this] { + while (mRequests.waitForItems()) { + handleRequestsOnce(); + } + }); +} template void FakeVehicleHardware::PendingRequestHandler::addRequest( From b68fb170e330615d792c8bdab199c9eb281532a2 Mon Sep 17 00:00:00 2001 From: Keith Mok Date: Fri, 6 May 2022 04:32:59 +0000 Subject: [PATCH 069/998] DefaultVehicleHal: Add null callback checking AIDL allow nullptr as callback argument. Wihtout a nullptr callback variable checking, it will crash the VHAL, if callback pass in is nullptr. Test: android.hardware.automotive.vehicle@V1-default-service_fuzzer Bug: 231661617 Change-Id: I9387391c595b608b435daa6e66134fedfccbbf7c --- .../aidl/impl/vhal/src/DefaultVehicleHal.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp index b191aef9b3..138aad5848 100644 --- a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp +++ b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp @@ -355,6 +355,9 @@ ScopedAStatus DefaultVehicleHal::getValues(const CallbackType& callback, ALOGE("getValues: failed to parse getValues requests"); return std::move(deserializedResults.error()); } + if (callback == nullptr) { + return ScopedAStatus::fromExceptionCode(EX_NULL_POINTER); + } const std::vector& getValueRequests = deserializedResults.value().getObject()->payloads; @@ -438,6 +441,9 @@ ScopedAStatus DefaultVehicleHal::setValues(const CallbackType& callback, ALOGE("setValues: failed to parse setValues requests"); return std::move(deserializedResults.error()); } + if (callback == nullptr) { + return ScopedAStatus::fromExceptionCode(EX_NULL_POINTER); + } const std::vector& setValueRequests = deserializedResults.value().getObject()->payloads; @@ -629,7 +635,9 @@ ScopedAStatus DefaultVehicleHal::subscribe(const CallbackType& callback, ALOGE("subscribe: invalid subscribe options: %s", getErrorMsg(result).c_str()); return toScopedAStatus(result); } - + if (callback == nullptr) { + return ScopedAStatus::fromExceptionCode(EX_NULL_POINTER); + } std::vector onChangeSubscriptions; std::vector continuousSubscriptions; for (const auto& option : options) { @@ -685,6 +693,9 @@ ScopedAStatus DefaultVehicleHal::subscribe(const CallbackType& callback, ScopedAStatus DefaultVehicleHal::unsubscribe(const CallbackType& callback, const std::vector& propIds) { + if (callback == nullptr) { + return ScopedAStatus::fromExceptionCode(EX_NULL_POINTER); + } return toScopedAStatus(mSubscriptionManager->unsubscribe(callback->asBinder().get(), propIds)); } From 4efe8608f7f2105a09d9fd563dfd26130e7d0a30 Mon Sep 17 00:00:00 2001 From: Kriti Dang Date: Tue, 3 May 2022 16:55:59 +0200 Subject: [PATCH 070/998] Vts test for verifying that there are no duplicates in getDisplayconfigs Test: atest VtsHalGraphicsComposer3_TargetTest Test: atest VtsHalGraphicsComposerV2_4TargetTest Bug: 176086656 Change-Id: I51dd4774b3c990e6db2cb9ee71d14f74dc3effb0 --- .../VtsHalGraphicsComposerV2_4TargetTest.cpp | 33 +++++++++++++++++ .../VtsHalGraphicsComposer3_TargetTest.cpp | 35 +++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp b/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp index fa294ff259..35225d9a03 100644 --- a/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp +++ b/graphics/composer/2.4/vts/functional/VtsHalGraphicsComposerV2_4TargetTest.cpp @@ -737,6 +737,39 @@ TEST_P(GraphicsComposerHidlTest, getLayerGenericMetadataKeys) { } } +/* + * Test that no two display configs are exactly the same. + */ +TEST_P(GraphicsComposerHidlTest, GetDisplayConfigNoRepetitions) { + for (const auto& display : mDisplays) { + std::vector configs = mComposerClient->getDisplayConfigs(display.get()); + for (int i = 0; i < configs.size(); i++) { + for (int j = i + 1; j < configs.size(); j++) { + const int32_t width1 = mComposerClient->getDisplayAttribute_2_4( + display.get(), configs[i], IComposerClient::Attribute::WIDTH); + const int32_t height1 = mComposerClient->getDisplayAttribute_2_4( + display.get(), configs[i], IComposerClient::Attribute::HEIGHT); + const int32_t vsyncPeriod1 = mComposerClient->getDisplayAttribute_2_4( + display.get(), configs[i], IComposerClient::Attribute::VSYNC_PERIOD); + const int32_t group1 = mComposerClient->getDisplayAttribute_2_4( + display.get(), configs[i], IComposerClient::Attribute::CONFIG_GROUP); + + const int32_t width2 = mComposerClient->getDisplayAttribute_2_4( + display.get(), configs[j], IComposerClient::Attribute::WIDTH); + const int32_t height2 = mComposerClient->getDisplayAttribute_2_4( + display.get(), configs[j], IComposerClient::Attribute::HEIGHT); + const int32_t vsyncPeriod2 = mComposerClient->getDisplayAttribute_2_4( + display.get(), configs[j], IComposerClient::Attribute::VSYNC_PERIOD); + const int32_t group2 = mComposerClient->getDisplayAttribute_2_4( + display.get(), configs[j], IComposerClient::Attribute::CONFIG_GROUP); + + ASSERT_FALSE(width1 == width2 && height1 == height2 && + vsyncPeriod1 == vsyncPeriod2 && group1 == group2); + } + } + } +} + } // namespace } // namespace vts } // namespace V2_4 diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 759bfecca3..ece1fd3742 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -2122,6 +2122,41 @@ TEST_P(GraphicsComposerAidlCommandTest, SetIdleTimerEnabled_Timeout_2) { EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::OFF).isOk()); } +/* + * Test that no two display configs are exactly the same. + */ +TEST_P(GraphicsComposerAidlTest, GetDisplayConfigNoRepetitions) { + for (const auto& display : mDisplays) { + const auto& [status, configs] = mComposerClient->getDisplayConfigs(display.getDisplayId()); + for (std::vector::size_type i = 0; i < configs.size(); i++) { + for (std::vector::size_type j = i + 1; j < configs.size(); j++) { + const auto& [widthStatus1, width1] = mComposerClient->getDisplayAttribute( + display.getDisplayId(), configs[i], DisplayAttribute::WIDTH); + const auto& [heightStatus1, height1] = mComposerClient->getDisplayAttribute( + display.getDisplayId(), configs[i], DisplayAttribute::HEIGHT); + const auto& [vsyncPeriodStatus1, vsyncPeriod1] = + mComposerClient->getDisplayAttribute(display.getDisplayId(), configs[i], + DisplayAttribute::VSYNC_PERIOD); + const auto& [groupStatus1, group1] = mComposerClient->getDisplayAttribute( + display.getDisplayId(), configs[i], DisplayAttribute::CONFIG_GROUP); + + const auto& [widthStatus2, width2] = mComposerClient->getDisplayAttribute( + display.getDisplayId(), configs[j], DisplayAttribute::WIDTH); + const auto& [heightStatus2, height2] = mComposerClient->getDisplayAttribute( + display.getDisplayId(), configs[j], DisplayAttribute::HEIGHT); + const auto& [vsyncPeriodStatus2, vsyncPeriod2] = + mComposerClient->getDisplayAttribute(display.getDisplayId(), configs[j], + DisplayAttribute::VSYNC_PERIOD); + const auto& [groupStatus2, group2] = mComposerClient->getDisplayAttribute( + display.getDisplayId(), configs[j], DisplayAttribute::CONFIG_GROUP); + + ASSERT_FALSE(width1 == width2 && height1 == height2 && + vsyncPeriod1 == vsyncPeriod2 && group1 == group2); + } + } + } +} + GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsComposerAidlCommandTest); INSTANTIATE_TEST_SUITE_P( PerInstance, GraphicsComposerAidlCommandTest, From 731cc9e421c0a5fc37ad427c83e953ce5c0d1c6c Mon Sep 17 00:00:00 2001 From: Keith Mok Date: Fri, 6 May 2022 06:22:34 +0000 Subject: [PATCH 071/998] vehicle-aidl: Fix thread join would block There is race condition in RecurrentTimer.cpp for thread creation whcih created in initialization list instead of constructor which the class member variables are not init yet. Bug: 231668271 Test: android.hardware.automotive.vehicle@V1-default-service_fuzzer Change-Id: I7dfdff7aa3df4e4451522ad167863a41e27a349c --- .../vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp b/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp index 8521c4db7c..fbc79fa26a 100644 --- a/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp +++ b/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp @@ -29,7 +29,9 @@ namespace vehicle { using ::android::base::ScopedLockAssertion; -RecurrentTimer::RecurrentTimer() : mThread(&RecurrentTimer::loop, this) {} +RecurrentTimer::RecurrentTimer() { + mThread = std::thread(&RecurrentTimer::loop, this); +} RecurrentTimer::~RecurrentTimer() { { From 85aebe3ee2a34bd4940d603fefcd55c74de313f4 Mon Sep 17 00:00:00 2001 From: Keith Mok Date: Fri, 6 May 2022 19:44:39 +0000 Subject: [PATCH 072/998] Fix fingerprint aidl race condition then thread is join Even if the shared variable is atomic, it must be modified under the mutex in order to correctly publish the modification to the waiting thread. There is a chance that mThread will miss both mIsDestructing and notify event without a mutex. Bug: 231737939 Test: manual Change-Id: If83a94b766c816b9e4897acb1e89eacdce880c15 --- biometrics/fingerprint/aidl/default/WorkerThread.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/biometrics/fingerprint/aidl/default/WorkerThread.cpp b/biometrics/fingerprint/aidl/default/WorkerThread.cpp index d1a63d07ee..34ebb5ca94 100644 --- a/biometrics/fingerprint/aidl/default/WorkerThread.cpp +++ b/biometrics/fingerprint/aidl/default/WorkerThread.cpp @@ -31,7 +31,10 @@ WorkerThread::WorkerThread(size_t maxQueueSize) WorkerThread::~WorkerThread() { // This is a signal for threadFunc to terminate as soon as possible, and a hint for schedule // that it doesn't need to do any work. - mIsDestructing = true; + { + std::unique_lock lock(mQueueMutex); + mIsDestructing = true; + } mQueueCond.notify_all(); mThread.join(); } From b12109202a6df5cdf3bcb6c605c79965309994b2 Mon Sep 17 00:00:00 2001 From: Keith Mok Date: Fri, 6 May 2022 19:25:54 +0000 Subject: [PATCH 073/998] broadcast-hal: Fix mThread race condition Currently mThread is started in initializer list, but not in constructor, when the thread starts in initializer list, not all class members are init yet (depends on the order of class member declarations). And mThread will use class members. Putting mThread to starts in constructor ensures all class member variables are init before thread starts. Bug: 231737939 Test: build Change-Id: I4033efa9f13c2ece95c4b4f99f8c88b6d4816be1 --- broadcastradio/common/utils/WorkerThread.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/broadcastradio/common/utils/WorkerThread.cpp b/broadcastradio/common/utils/WorkerThread.cpp index 31f4d3f83e..dd87f538ea 100644 --- a/broadcastradio/common/utils/WorkerThread.cpp +++ b/broadcastradio/common/utils/WorkerThread.cpp @@ -31,7 +31,11 @@ bool operator<(const WorkerThread::Task& lhs, const WorkerThread::Task& rhs) { return lhs.when > rhs.when; } -WorkerThread::WorkerThread() : mIsTerminating(false), mThread(&WorkerThread::threadLoop, this) {} +WorkerThread::WorkerThread() : mIsTerminating(false) { + // putting mThread in constructor instead of initializer list + // to ensure all class members are init before mThread starts + mThread = std::thread(&WorkerThread::threadLoop, this); +} WorkerThread::~WorkerThread() { { From 22ebbf78220c39edf517a2c758079d6fc481ea7e Mon Sep 17 00:00:00 2001 From: Keith Mok Date: Fri, 6 May 2022 07:39:04 +0000 Subject: [PATCH 074/998] vehicle-aidl: Fix various race condition mThread should not be created in initization list, since class member variables are not ready yet, and the thread will access those variables. Even if the shared variable is atomic, it must be modified under the mutex in order to correctly publish the modification to the waiting thread. Bug: 231668271 Test: android.hardware.automotive.vehicle@V1-default-service_fuzzer Change-Id: Ibbf36ddf9edcaa8d016349631784f54f6fd6c877 --- .../default/impl/vhal_v2_0/GeneratorHub.cpp | 13 ++++++-- .../GeneratorHub/src/GeneratorHub.cpp | 13 ++++++-- .../utils/common/include/PendingRequestPool.h | 3 +- .../utils/common/src/PendingRequestPool.cpp | 31 ++++++++++++------- 4 files changed, 40 insertions(+), 20 deletions(-) diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/GeneratorHub.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/GeneratorHub.cpp index 9be9ea7c8e..503afd2eb2 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/GeneratorHub.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/GeneratorHub.cpp @@ -28,11 +28,18 @@ namespace V2_0 { namespace impl { -GeneratorHub::GeneratorHub(const OnHalEvent& onHalEvent) - : mOnHalEvent(onHalEvent), mThread(&GeneratorHub::run, this) {} +GeneratorHub::GeneratorHub(const OnHalEvent& onHalEvent) : mOnHalEvent(onHalEvent) { + mThread = std::thread(&GeneratorHub::run, this); +} GeneratorHub::~GeneratorHub() { - mShuttingDownFlag.store(true); + { + // Even if the shared variable is atomic, it must be modified under the + // mutex in order to correctly publish the modification to the waiting + // thread. + std::unique_lock g(mLock); + mShuttingDownFlag.store(true); + } mCond.notify_all(); if (mThread.joinable()) { mThread.join(); diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/GeneratorHub.cpp b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/GeneratorHub.cpp index 1690c78ef9..d815456a56 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/GeneratorHub.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/src/GeneratorHub.cpp @@ -29,11 +29,18 @@ namespace fake { using ::android::base::ScopedLockAssertion; -GeneratorHub::GeneratorHub(OnHalEvent&& onHalEvent) - : mOnHalEvent(onHalEvent), mThread(&GeneratorHub::run, this) {} +GeneratorHub::GeneratorHub(OnHalEvent&& onHalEvent) : mOnHalEvent(onHalEvent) { + mThread = std::thread(&GeneratorHub::run, this); +} GeneratorHub::~GeneratorHub() { - mShuttingDownFlag.store(true); + { + // Even if the shared variable is atomic, it must be modified under the + // mutex in order to correctly publish the modification to the waiting + // thread. + std::unique_lock lock(mGeneratorsLock); + mShuttingDownFlag.store(true); + } mCond.notify_all(); if (mThread.joinable()) { mThread.join(); diff --git a/automotive/vehicle/aidl/impl/utils/common/include/PendingRequestPool.h b/automotive/vehicle/aidl/impl/utils/common/include/PendingRequestPool.h index 3f8db93ba3..28cf08e93b 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/PendingRequestPool.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/PendingRequestPool.h @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -85,7 +84,7 @@ class PendingRequestPool final { std::unordered_map> mPendingRequestsByClient GUARDED_BY(mLock); std::thread mThread; - std::atomic mThreadStop = false; + bool mThreadStop = false; std::condition_variable mCv; std::mutex mCvLock; diff --git a/automotive/vehicle/aidl/impl/utils/common/src/PendingRequestPool.cpp b/automotive/vehicle/aidl/impl/utils/common/src/PendingRequestPool.cpp index 0196edd2ca..ab504992e4 100644 --- a/automotive/vehicle/aidl/impl/utils/common/src/PendingRequestPool.cpp +++ b/automotive/vehicle/aidl/impl/utils/common/src/PendingRequestPool.cpp @@ -39,20 +39,27 @@ constexpr int64_t CHECK_TIME_IN_NANO = 1'000'000'000; } // namespace -PendingRequestPool::PendingRequestPool(int64_t timeoutInNano) - : mTimeoutInNano(timeoutInNano), mThread([this] { - // [this] must be alive within this thread because destructor would wait for this thread - // to exit. - int64_t sleepTime = std::min(mTimeoutInNano, static_cast(CHECK_TIME_IN_NANO)); - std::unique_lock lk(mCvLock); - while (!mCv.wait_for(lk, std::chrono::nanoseconds(sleepTime), - [this] { return mThreadStop.load(); })) { - checkTimeout(); - } - }) {} +PendingRequestPool::PendingRequestPool(int64_t timeoutInNano) : mTimeoutInNano(timeoutInNano) { + mThread = std::thread([this] { + // [this] must be alive within this thread because destructor would wait for this thread + // to exit. + int64_t sleepTime = std::min(mTimeoutInNano, static_cast(CHECK_TIME_IN_NANO)); + std::unique_lock lk(mCvLock); + while (!mCv.wait_for(lk, std::chrono::nanoseconds(sleepTime), + [this] { return mThreadStop; })) { + checkTimeout(); + } + }); +} PendingRequestPool::~PendingRequestPool() { - mThreadStop = true; + { + // Even if the shared variable is atomic, it must be modified under the + // mutex in order to correctly publish the modification to the waiting + // thread. + std::unique_lock lk(mCvLock); + mThreadStop = true; + } mCv.notify_all(); if (mThread.joinable()) { mThread.join(); From 317f1117f833440f50dcc87d8e5997bc28e932d2 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Wed, 11 May 2022 17:44:47 +0000 Subject: [PATCH 075/998] Add changes to Radio V1 AIDL interfaces During the API freeze some of the sub-interfaces of radio were frozen without the latest change adding "@Javaderive(toString=true)". Instead of creating V2 with these changes, we are updating V1 to include these changes instead. The change will not break anyone downstream, and any devices built with the previous V1 will continue to work. The hashes of the original V1 interfaces are still included in the .hash files, so VTS will allow both. Steps taken: m android.hardware.radio.config-freeze-api rm aidl_api/android.hardware.radio.config/2/.hash cp -r aidl_api/android.hardware.radio.config/2/* aidl_api/android.hardware.radio.config/1/ rm -rf aidl_api/android.hardware.radio.config/2/ vim Android.bp # remove the newly created version 2 system/tools/aidl/build/hash_gen.sh aidl_api/android.hardware.radio.config/1/ latest-version aidl_api/android.hardware.radio.config/1/.hash Test: atest hal_implementation_test Bug: 225941299 Change-Id: Id14cfffd326bd664acb678f15f4129d85ce251b2 --- radio/aidl/aidl_api/android.hardware.radio.config/1/.hash | 1 + .../1/android/hardware/radio/config/PhoneCapability.aidl | 2 +- .../1/android/hardware/radio/config/SimPortInfo.aidl | 2 +- .../1/android/hardware/radio/config/SimSlotStatus.aidl | 2 +- .../1/android/hardware/radio/config/SlotPortMapping.aidl | 2 +- radio/aidl/aidl_api/android.hardware.radio.data/1/.hash | 1 + .../1/android/hardware/radio/data/ApnAuthType.aidl | 2 +- .../1/android/hardware/radio/data/ApnTypes.aidl | 2 +- .../1/android/hardware/radio/data/DataCallFailCause.aidl | 2 +- .../1/android/hardware/radio/data/DataProfileInfo.aidl | 2 +- .../1/android/hardware/radio/data/DataRequestReason.aidl | 2 +- .../1/android/hardware/radio/data/DataThrottlingAction.aidl | 2 +- .../1/android/hardware/radio/data/EpsQos.aidl | 2 +- .../1/android/hardware/radio/data/KeepaliveRequest.aidl | 2 +- .../1/android/hardware/radio/data/KeepaliveStatus.aidl | 2 +- .../1/android/hardware/radio/data/LinkAddress.aidl | 2 +- .../1/android/hardware/radio/data/NrQos.aidl | 2 +- .../1/android/hardware/radio/data/OsAppId.aidl | 2 +- .../1/android/hardware/radio/data/PcoDataInfo.aidl | 2 +- .../1/android/hardware/radio/data/PdpProtocolType.aidl | 2 +- .../1/android/hardware/radio/data/PortRange.aidl | 2 +- .../1/android/hardware/radio/data/Qos.aidl | 2 +- .../1/android/hardware/radio/data/QosBandwidth.aidl | 2 +- .../1/android/hardware/radio/data/QosFilter.aidl | 2 +- .../1/android/hardware/radio/data/QosFilterIpsecSpi.aidl | 2 +- .../1/android/hardware/radio/data/QosFilterIpv6FlowLabel.aidl | 2 +- .../1/android/hardware/radio/data/QosFilterTypeOfService.aidl | 2 +- .../1/android/hardware/radio/data/QosSession.aidl | 2 +- .../1/android/hardware/radio/data/RouteSelectionDescriptor.aidl | 2 +- .../1/android/hardware/radio/data/SetupDataCallResult.aidl | 2 +- .../1/android/hardware/radio/data/SliceInfo.aidl | 2 +- .../1/android/hardware/radio/data/SlicingConfig.aidl | 2 +- .../1/android/hardware/radio/data/TrafficDescriptor.aidl | 2 +- .../1/android/hardware/radio/data/UrspRule.aidl | 2 +- radio/aidl/aidl_api/android.hardware.radio.messaging/1/.hash | 1 + .../hardware/radio/messaging/CdmaBroadcastSmsConfigInfo.aidl | 2 +- .../1/android/hardware/radio/messaging/CdmaSmsAck.aidl | 2 +- .../1/android/hardware/radio/messaging/CdmaSmsAddress.aidl | 2 +- .../1/android/hardware/radio/messaging/CdmaSmsMessage.aidl | 2 +- .../1/android/hardware/radio/messaging/CdmaSmsSubaddress.aidl | 2 +- .../1/android/hardware/radio/messaging/CdmaSmsWriteArgs.aidl | 2 +- .../hardware/radio/messaging/GsmBroadcastSmsConfigInfo.aidl | 2 +- .../1/android/hardware/radio/messaging/GsmSmsMessage.aidl | 2 +- .../1/android/hardware/radio/messaging/ImsSmsMessage.aidl | 2 +- .../1/android/hardware/radio/messaging/SendSmsResult.aidl | 2 +- .../hardware/radio/messaging/SmsAcknowledgeFailCause.aidl | 2 +- .../1/android/hardware/radio/messaging/SmsWriteArgs.aidl | 2 +- radio/aidl/aidl_api/android.hardware.radio.modem/1/.hash | 1 + .../1/android/hardware/radio/modem/ActivityStatsInfo.aidl | 2 +- .../hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl | 2 +- .../1/android/hardware/radio/modem/DeviceStateType.aidl | 2 +- .../1/android/hardware/radio/modem/HardwareConfig.aidl | 2 +- .../1/android/hardware/radio/modem/HardwareConfigModem.aidl | 2 +- .../1/android/hardware/radio/modem/HardwareConfigSim.aidl | 2 +- .../1/android/hardware/radio/modem/NvItem.aidl | 2 +- .../1/android/hardware/radio/modem/NvWriteItem.aidl | 2 +- .../1/android/hardware/radio/modem/RadioCapability.aidl | 2 +- .../1/android/hardware/radio/modem/RadioState.aidl | 2 +- .../1/android/hardware/radio/modem/ResetNvType.aidl | 2 +- radio/aidl/aidl_api/android.hardware.radio.network/1/.hash | 1 + .../hardware/radio/network/AccessTechnologySpecificInfo.aidl | 2 +- .../1/android/hardware/radio/network/BarringInfo.aidl | 2 +- .../android/hardware/radio/network/BarringTypeSpecificInfo.aidl | 2 +- .../hardware/radio/network/Cdma2000RegistrationInfo.aidl | 2 +- .../1/android/hardware/radio/network/CdmaRoamingType.aidl | 2 +- .../1/android/hardware/radio/network/CdmaSignalStrength.aidl | 2 +- .../1/android/hardware/radio/network/CellConnectionStatus.aidl | 2 +- .../1/android/hardware/radio/network/CellIdentity.aidl | 2 +- .../1/android/hardware/radio/network/CellIdentityCdma.aidl | 2 +- .../1/android/hardware/radio/network/CellIdentityGsm.aidl | 2 +- .../1/android/hardware/radio/network/CellIdentityLte.aidl | 2 +- .../1/android/hardware/radio/network/CellIdentityNr.aidl | 2 +- .../1/android/hardware/radio/network/CellIdentityTdscdma.aidl | 2 +- .../1/android/hardware/radio/network/CellIdentityWcdma.aidl | 2 +- .../1/android/hardware/radio/network/CellInfo.aidl | 2 +- .../1/android/hardware/radio/network/CellInfoCdma.aidl | 2 +- .../1/android/hardware/radio/network/CellInfoGsm.aidl | 2 +- .../1/android/hardware/radio/network/CellInfoLte.aidl | 2 +- .../1/android/hardware/radio/network/CellInfoNr.aidl | 2 +- .../android/hardware/radio/network/CellInfoRatSpecificInfo.aidl | 2 +- .../1/android/hardware/radio/network/CellInfoTdscdma.aidl | 2 +- .../1/android/hardware/radio/network/CellInfoWcdma.aidl | 2 +- .../hardware/radio/network/ClosedSubscriberGroupInfo.aidl | 2 +- .../1/android/hardware/radio/network/Domain.aidl | 2 +- .../1/android/hardware/radio/network/EutranBands.aidl | 2 +- .../android/hardware/radio/network/EutranRegistrationInfo.aidl | 2 +- .../1/android/hardware/radio/network/EvdoSignalStrength.aidl | 2 +- .../1/android/hardware/radio/network/GeranBands.aidl | 2 +- .../1/android/hardware/radio/network/GsmSignalStrength.aidl | 2 +- .../1/android/hardware/radio/network/IndicationFilter.aidl | 2 +- .../1/android/hardware/radio/network/LceDataInfo.aidl | 2 +- .../1/android/hardware/radio/network/LinkCapacityEstimate.aidl | 2 +- .../1/android/hardware/radio/network/LteSignalStrength.aidl | 2 +- .../1/android/hardware/radio/network/LteVopsInfo.aidl | 2 +- .../1/android/hardware/radio/network/NetworkScanRequest.aidl | 2 +- .../1/android/hardware/radio/network/NetworkScanResult.aidl | 2 +- .../1/android/hardware/radio/network/NgranBands.aidl | 2 +- .../android/hardware/radio/network/NrDualConnectivityState.aidl | 2 +- .../1/android/hardware/radio/network/NrIndicators.aidl | 2 +- .../1/android/hardware/radio/network/NrSignalStrength.aidl | 2 +- .../1/android/hardware/radio/network/NrVopsInfo.aidl | 2 +- .../1/android/hardware/radio/network/OperatorInfo.aidl | 2 +- .../1/android/hardware/radio/network/PhoneRestrictedState.aidl | 2 +- .../1/android/hardware/radio/network/PhysicalChannelConfig.aidl | 2 +- .../hardware/radio/network/PhysicalChannelConfigBand.aidl | 2 +- .../1/android/hardware/radio/network/RadioAccessSpecifier.aidl | 2 +- .../hardware/radio/network/RadioAccessSpecifierBands.aidl | 2 +- .../1/android/hardware/radio/network/RadioBandMode.aidl | 2 +- .../1/android/hardware/radio/network/RegState.aidl | 2 +- .../1/android/hardware/radio/network/RegStateResult.aidl | 2 +- .../1/android/hardware/radio/network/RegistrationFailCause.aidl | 2 +- .../1/android/hardware/radio/network/SignalStrength.aidl | 2 +- .../1/android/hardware/radio/network/SignalThresholdInfo.aidl | 2 +- .../1/android/hardware/radio/network/SuppSvcNotification.aidl | 2 +- .../1/android/hardware/radio/network/TdscdmaSignalStrength.aidl | 2 +- .../1/android/hardware/radio/network/UsageSetting.aidl | 2 +- .../1/android/hardware/radio/network/UtranBands.aidl | 2 +- .../1/android/hardware/radio/network/WcdmaSignalStrength.aidl | 2 +- radio/aidl/aidl_api/android.hardware.radio.sim/1/.hash | 1 + .../1/android/hardware/radio/sim/AppStatus.aidl | 2 +- .../1/android/hardware/radio/sim/CardPowerState.aidl | 2 +- .../1/android/hardware/radio/sim/CardStatus.aidl | 2 +- .../1/android/hardware/radio/sim/Carrier.aidl | 2 +- .../1/android/hardware/radio/sim/CarrierRestrictions.aidl | 2 +- .../1/android/hardware/radio/sim/CdmaSubscriptionSource.aidl | 2 +- .../1/android/hardware/radio/sim/IccIo.aidl | 2 +- .../1/android/hardware/radio/sim/IccIoResult.aidl | 2 +- .../1/android/hardware/radio/sim/ImsiEncryptionInfo.aidl | 2 +- .../1/android/hardware/radio/sim/PbReceivedStatus.aidl | 2 +- .../1/android/hardware/radio/sim/PersoSubstate.aidl | 2 +- .../1/android/hardware/radio/sim/PhonebookCapacity.aidl | 2 +- .../1/android/hardware/radio/sim/PhonebookRecordInfo.aidl | 2 +- .../1/android/hardware/radio/sim/PinState.aidl | 2 +- .../1/android/hardware/radio/sim/SelectUiccSub.aidl | 2 +- .../1/android/hardware/radio/sim/SimApdu.aidl | 2 +- .../1/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl | 2 +- .../1/android/hardware/radio/sim/SimRefreshResult.aidl | 2 +- radio/aidl/aidl_api/android.hardware.radio.voice/1/.hash | 1 + .../1/android/hardware/radio/voice/AudioQuality.aidl | 2 +- .../1/android/hardware/radio/voice/Call.aidl | 2 +- .../1/android/hardware/radio/voice/CallForwardInfo.aidl | 2 +- .../1/android/hardware/radio/voice/CdmaCallWaiting.aidl | 2 +- .../1/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl | 2 +- .../1/android/hardware/radio/voice/CdmaInformationRecord.aidl | 2 +- .../android/hardware/radio/voice/CdmaLineControlInfoRecord.aidl | 2 +- .../1/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl | 2 +- .../1/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl | 2 +- .../hardware/radio/voice/CdmaRedirectingNumberInfoRecord.aidl | 2 +- .../1/android/hardware/radio/voice/CdmaSignalInfoRecord.aidl | 2 +- .../hardware/radio/voice/CdmaT53AudioControlInfoRecord.aidl | 2 +- .../1/android/hardware/radio/voice/CdmaT53ClirInfoRecord.aidl | 2 +- .../1/android/hardware/radio/voice/CfData.aidl | 2 +- .../1/android/hardware/radio/voice/ClipStatus.aidl | 2 +- .../1/android/hardware/radio/voice/Dial.aidl | 2 +- .../1/android/hardware/radio/voice/EmergencyCallRouting.aidl | 2 +- .../1/android/hardware/radio/voice/EmergencyNumber.aidl | 2 +- .../android/hardware/radio/voice/EmergencyServiceCategory.aidl | 2 +- .../1/android/hardware/radio/voice/LastCallFailCause.aidl | 2 +- .../1/android/hardware/radio/voice/LastCallFailCauseInfo.aidl | 2 +- .../1/android/hardware/radio/voice/SrvccState.aidl | 2 +- .../1/android/hardware/radio/voice/SsInfoData.aidl | 2 +- .../1/android/hardware/radio/voice/StkCcUnsolSsResult.aidl | 2 +- .../1/android/hardware/radio/voice/TtyMode.aidl | 2 +- .../1/android/hardware/radio/voice/UssdModeType.aidl | 2 +- .../1/android/hardware/radio/voice/UusInfo.aidl | 2 +- 165 files changed, 165 insertions(+), 158 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/1/.hash b/radio/aidl/aidl_api/android.hardware.radio.config/1/.hash index 4d5fc89ef3..960539da6a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.config/1/.hash +++ b/radio/aidl/aidl_api/android.hardware.radio.config/1/.hash @@ -1 +1,2 @@ 6e0b1fb58d66a76df8f46a1a6dae5c346ea17d7b +dd9c3f8e21930f9b4c46a4125bd5f5cec90318ec diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/PhoneCapability.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/PhoneCapability.aidl index c60200ce13..db3a4c65f3 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/PhoneCapability.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/PhoneCapability.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.config; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable PhoneCapability { byte maxActiveData; byte maxActiveInternetData; diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/SimPortInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/SimPortInfo.aidl index 5cc90176ac..b5d31ada35 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/SimPortInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/SimPortInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.config; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable SimPortInfo { String iccId; int logicalSlotId; diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/SimSlotStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/SimSlotStatus.aidl index bc7f63ca9a..be4c08064a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/SimSlotStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/SimSlotStatus.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.config; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable SimSlotStatus { int cardState; String atr; diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/SlotPortMapping.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/SlotPortMapping.aidl index f38c4213d0..31271eed8d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/SlotPortMapping.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.config/1/android/hardware/radio/config/SlotPortMapping.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.config; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable SlotPortMapping { int physicalSlotId; int portId; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/.hash b/radio/aidl/aidl_api/android.hardware.radio.data/1/.hash index 986768a0e1..0c0c93608d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/.hash +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/.hash @@ -1 +1,2 @@ 21e60e4149e36bed0fe2af962995f021e88a1da7 +6d7a86008ea4fe79ced2a86b526a92618eb4c84a diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/ApnAuthType.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/ApnAuthType.aidl index 929cfe3ccf..86272c22eb 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/ApnAuthType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/ApnAuthType.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ApnAuthType { NO_PAP_NO_CHAP = 0, PAP_NO_CHAP = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/ApnTypes.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/ApnTypes.aidl index 980b042cdf..1518a5749e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/ApnTypes.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/ApnTypes.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ApnTypes { NONE = 0, DEFAULT = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataCallFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataCallFailCause.aidl index 6130e71a1a..d7d6983236 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataCallFailCause.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataCallFailCause.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum DataCallFailCause { NONE = 0, OPERATOR_BARRED = 8, diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataProfileInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataProfileInfo.aidl index 02bbf21ef3..16fada1d76 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataProfileInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataProfileInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable DataProfileInfo { int profileId; String apn; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataRequestReason.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataRequestReason.aidl index c94fa6f604..0ddaff1662 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataRequestReason.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataRequestReason.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum DataRequestReason { NORMAL = 1, SHUTDOWN = 2, diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataThrottlingAction.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataThrottlingAction.aidl index c0ade454dd..4f976cd593 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataThrottlingAction.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/DataThrottlingAction.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@Backing(type="byte") @VintfStability +@Backing(type="byte") @JavaDerive(toString=true) @VintfStability enum DataThrottlingAction { NO_DATA_THROTTLING = 0, THROTTLE_SECONDARY_CARRIER = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/EpsQos.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/EpsQos.aidl index 36367315d6..5b9aaa0b1e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/EpsQos.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/EpsQos.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable EpsQos { int qci; android.hardware.radio.data.QosBandwidth downlink; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/KeepaliveRequest.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/KeepaliveRequest.aidl index 788adfbfde..592a54a90c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/KeepaliveRequest.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/KeepaliveRequest.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable KeepaliveRequest { int type; byte[] sourceAddress; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/KeepaliveStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/KeepaliveStatus.aidl index 4729b8e194..82b0fc8ec1 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/KeepaliveStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/KeepaliveStatus.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable KeepaliveStatus { int sessionHandle; int code; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/LinkAddress.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/LinkAddress.aidl index 9aee44c4fc..48e646ea22 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/LinkAddress.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/LinkAddress.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable LinkAddress { String address; int addressProperties; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/NrQos.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/NrQos.aidl index a8a169635e..62f6204038 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/NrQos.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/NrQos.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable NrQos { int fiveQi; android.hardware.radio.data.QosBandwidth downlink; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/OsAppId.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/OsAppId.aidl index 205b1e92bd..8595d5206d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/OsAppId.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/OsAppId.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable OsAppId { byte[] osAppId; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/PcoDataInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/PcoDataInfo.aidl index edfa7592df..033b12f4ee 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/PcoDataInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/PcoDataInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable PcoDataInfo { int cid; String bearerProto; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/PdpProtocolType.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/PdpProtocolType.aidl index 363cdf30b9..9771e5ccc1 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/PdpProtocolType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/PdpProtocolType.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum PdpProtocolType { UNKNOWN = -1, IP = 0, diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/PortRange.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/PortRange.aidl index f3749ed7ac..470a9c11b3 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/PortRange.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/PortRange.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable PortRange { int start; int end; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/Qos.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/Qos.aidl index 1981721b5b..ca06e4112b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/Qos.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/Qos.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@VintfStability +@JavaDerive(toString=true) @VintfStability union Qos { boolean noinit; android.hardware.radio.data.EpsQos eps; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosBandwidth.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosBandwidth.aidl index d7ebe100bd..6d4b7a9f49 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosBandwidth.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosBandwidth.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable QosBandwidth { int maxBitrateKbps; int guaranteedBitrateKbps; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilter.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilter.aidl index b9098f7f88..e22b359163 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilter.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilter.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable QosFilter { String[] localAddresses; String[] remoteAddresses; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilterIpsecSpi.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilterIpsecSpi.aidl index 565e49904e..4b75340276 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilterIpsecSpi.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilterIpsecSpi.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@VintfStability +@JavaDerive(toString=true) @VintfStability union QosFilterIpsecSpi { boolean noinit; int value; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilterIpv6FlowLabel.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilterIpv6FlowLabel.aidl index 16117b252b..3fb34ea375 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilterIpv6FlowLabel.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilterIpv6FlowLabel.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@VintfStability +@JavaDerive(toString=true) @VintfStability union QosFilterIpv6FlowLabel { boolean noinit; int value; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilterTypeOfService.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilterTypeOfService.aidl index 95fda167f5..fa85b5acc3 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilterTypeOfService.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosFilterTypeOfService.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@VintfStability +@JavaDerive(toString=true) @VintfStability union QosFilterTypeOfService { boolean noinit; byte value; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosSession.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosSession.aidl index 53dcef0131..bbfdd2d48c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosSession.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/QosSession.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable QosSession { int qosSessionId; android.hardware.radio.data.Qos qos; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/RouteSelectionDescriptor.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/RouteSelectionDescriptor.aidl index 02596a1f63..434ee7d102 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/RouteSelectionDescriptor.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/RouteSelectionDescriptor.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable RouteSelectionDescriptor { byte precedence; android.hardware.radio.data.PdpProtocolType sessionType; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/SetupDataCallResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/SetupDataCallResult.aidl index ff2459c0b2..83f9db61ac 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/SetupDataCallResult.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/SetupDataCallResult.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable SetupDataCallResult { android.hardware.radio.data.DataCallFailCause cause; long suggestedRetryTime; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/SliceInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/SliceInfo.aidl index 0dd8127e1d..efe48165ee 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/SliceInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/SliceInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable SliceInfo { byte sliceServiceType; int sliceDifferentiator; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/SlicingConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/SlicingConfig.aidl index 54e2f12171..b00febebaf 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/SlicingConfig.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/SlicingConfig.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable SlicingConfig { android.hardware.radio.data.UrspRule[] urspRules; android.hardware.radio.data.SliceInfo[] sliceInfo; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/TrafficDescriptor.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/TrafficDescriptor.aidl index d5079c1d76..d7b0654970 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/TrafficDescriptor.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/TrafficDescriptor.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable TrafficDescriptor { @nullable String dnn; @nullable android.hardware.radio.data.OsAppId osAppId; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/UrspRule.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/UrspRule.aidl index c0be05426c..7002fd118c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/UrspRule.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/1/android/hardware/radio/data/UrspRule.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.data; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable UrspRule { int precedence; android.hardware.radio.data.TrafficDescriptor[] trafficDescriptors; diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/.hash b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/.hash index c70c2c86c9..b972bab2e2 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/.hash +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/.hash @@ -1 +1,2 @@ 725d66fbe595788886858e33291c8a9048825f85 +5237ec5f500627b6b844b155e356e603157f9ba6 diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaBroadcastSmsConfigInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaBroadcastSmsConfigInfo.aidl index 54e8a7b051..39e2be2f63 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaBroadcastSmsConfigInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaBroadcastSmsConfigInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CdmaBroadcastSmsConfigInfo { int serviceCategory; int language; diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsAck.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsAck.aidl index 0de1688f98..befdbdefb6 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsAck.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsAck.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CdmaSmsAck { boolean errorClass; int smsCauseCode; diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsAddress.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsAddress.aidl index 4a55745724..ab29c775dd 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsAddress.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsAddress.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CdmaSmsAddress { int digitMode; boolean isNumberModeDataNetwork; diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsMessage.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsMessage.aidl index fdb74fb49b..867596c81b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsMessage.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsMessage.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CdmaSmsMessage { int teleserviceId; boolean isServicePresent; diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsSubaddress.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsSubaddress.aidl index deb1102f0d..d67fe8c577 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsSubaddress.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsSubaddress.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CdmaSmsSubaddress { int subaddressType; boolean odd; diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsWriteArgs.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsWriteArgs.aidl index 4969663834..b0a7f98dc6 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsWriteArgs.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/CdmaSmsWriteArgs.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CdmaSmsWriteArgs { int status; android.hardware.radio.messaging.CdmaSmsMessage message; diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/GsmBroadcastSmsConfigInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/GsmBroadcastSmsConfigInfo.aidl index 6cc7636f79..46604cabe6 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/GsmBroadcastSmsConfigInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/GsmBroadcastSmsConfigInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable GsmBroadcastSmsConfigInfo { int fromServiceId; int toServiceId; diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/GsmSmsMessage.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/GsmSmsMessage.aidl index 2937d5ca79..4df7fd2508 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/GsmSmsMessage.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/GsmSmsMessage.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable GsmSmsMessage { String smscPdu; String pdu; diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/ImsSmsMessage.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/ImsSmsMessage.aidl index 706bfddd49..85f62b781d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/ImsSmsMessage.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/ImsSmsMessage.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable ImsSmsMessage { android.hardware.radio.RadioTechnologyFamily tech; boolean retry; diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/SendSmsResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/SendSmsResult.aidl index 0fbec6fed1..32f7a5cb71 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/SendSmsResult.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/SendSmsResult.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable SendSmsResult { int messageRef; String ackPDU; diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/SmsAcknowledgeFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/SmsAcknowledgeFailCause.aidl index b1f8ff8583..019b18539f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/SmsAcknowledgeFailCause.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/SmsAcknowledgeFailCause.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum SmsAcknowledgeFailCause { MEMORY_CAPACITY_EXCEEDED = 211, UNSPECIFIED_ERROR = 255, diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/SmsWriteArgs.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/SmsWriteArgs.aidl index 1748b62cfc..489cc07068 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/SmsWriteArgs.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/1/android/hardware/radio/messaging/SmsWriteArgs.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.messaging; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable SmsWriteArgs { int status; String pdu; diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/.hash b/radio/aidl/aidl_api/android.hardware.radio.modem/1/.hash index 18996c56c6..a6d3c50263 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/1/.hash +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/.hash @@ -1 +1,2 @@ 8883a1066be2bbc8c65a2db115b02e3e92bbfc98 +9dee2319b599d654955c05268c1eed6ca4373b58 diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/ActivityStatsInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/ActivityStatsInfo.aidl index 93940fd295..7e22ee046e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/ActivityStatsInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/ActivityStatsInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable ActivityStatsInfo { int sleepModeTimeMs; int idleModeTimeMs; diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl index 798ec36ffb..08ed9a529e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable ActivityStatsTechSpecificInfo { android.hardware.radio.AccessNetwork rat; int frequencyRange; diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/DeviceStateType.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/DeviceStateType.aidl index 0f0006d3e4..4e8c6d7545 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/DeviceStateType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/DeviceStateType.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum DeviceStateType { POWER_SAVE_MODE = 0, CHARGING_STATE = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/HardwareConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/HardwareConfig.aidl index 7593ca7a03..3a0ec2514b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/HardwareConfig.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/HardwareConfig.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable HardwareConfig { int type; String uuid; diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/HardwareConfigModem.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/HardwareConfigModem.aidl index bf7099541c..62bb160fc4 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/HardwareConfigModem.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/HardwareConfigModem.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable HardwareConfigModem { int rilModel; android.hardware.radio.RadioTechnology rat; diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/HardwareConfigSim.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/HardwareConfigSim.aidl index 1b887c220e..5810982975 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/HardwareConfigSim.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/HardwareConfigSim.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable HardwareConfigSim { String modemUuid; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/NvItem.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/NvItem.aidl index bda4ab7884..3e276434ac 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/NvItem.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/NvItem.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum NvItem { CDMA_MEID = 1, CDMA_MIN = 2, diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/NvWriteItem.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/NvWriteItem.aidl index 58e84988e8..17b7de0a74 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/NvWriteItem.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/NvWriteItem.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable NvWriteItem { android.hardware.radio.modem.NvItem itemId; String value; diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/RadioCapability.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/RadioCapability.aidl index 5aaf5a7303..f2e2858590 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/RadioCapability.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/RadioCapability.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable RadioCapability { int session; int phase; diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/RadioState.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/RadioState.aidl index 4bde770e15..57f29410c5 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/RadioState.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/RadioState.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RadioState { OFF = 0, UNAVAILABLE = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/ResetNvType.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/ResetNvType.aidl index 81f225433f..e3b5796cfc 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/ResetNvType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/1/android/hardware/radio/modem/ResetNvType.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ResetNvType { RELOAD = 0, ERASE = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/.hash b/radio/aidl/aidl_api/android.hardware.radio.network/1/.hash index 747eca4afa..43dd434edc 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/.hash +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/.hash @@ -1 +1,2 @@ ffa236a8203511b871b2d141b0f7c6d37f746bb4 +57e8e923513d80a26102e450d335e89b4346be66 diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl index 4a4a120965..28d886256d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability union AccessTechnologySpecificInfo { boolean noinit; android.hardware.radio.network.Cdma2000RegistrationInfo cdmaInfo; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/BarringInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/BarringInfo.aidl index a96ef510c4..e105b39101 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/BarringInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/BarringInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable BarringInfo { int serviceType; int barringType; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/BarringTypeSpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/BarringTypeSpecificInfo.aidl index c04cdb54bc..a81363339e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/BarringTypeSpecificInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/BarringTypeSpecificInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable BarringTypeSpecificInfo { int factor; int timeSeconds; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/Cdma2000RegistrationInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/Cdma2000RegistrationInfo.aidl index 7d9292d9b3..74c4e29d2b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/Cdma2000RegistrationInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/Cdma2000RegistrationInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable Cdma2000RegistrationInfo { boolean cssSupported; int roamingIndicator; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CdmaRoamingType.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CdmaRoamingType.aidl index 54c431b015..24ec26b893 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CdmaRoamingType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CdmaRoamingType.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum CdmaRoamingType { HOME_NETWORK = 0, AFFILIATED_ROAM = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CdmaSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CdmaSignalStrength.aidl index b4aee1cdd2..e2f97bf98f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CdmaSignalStrength.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CdmaSignalStrength.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CdmaSignalStrength { int dbm; int ecio; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellConnectionStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellConnectionStatus.aidl index 066cb60594..8986d719c4 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellConnectionStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellConnectionStatus.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum CellConnectionStatus { NONE = 0, PRIMARY_SERVING = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentity.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentity.aidl index 1c68e8c817..2ee92dee29 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentity.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentity.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability union CellIdentity { boolean noinit; android.hardware.radio.network.CellIdentityGsm gsm; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityCdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityCdma.aidl index 8c1fdfa92a..d659a2891c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityCdma.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityCdma.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CellIdentityCdma { int networkId; int systemId; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityGsm.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityGsm.aidl index 2e384e96f5..d3193be072 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityGsm.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityGsm.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CellIdentityGsm { String mcc; String mnc; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityLte.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityLte.aidl index c83997e130..2ae7b43e2d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityLte.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityLte.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CellIdentityLte { String mcc; String mnc; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityNr.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityNr.aidl index 6bdfd99af8..b30af506d8 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityNr.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityNr.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CellIdentityNr { String mcc; String mnc; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityTdscdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityTdscdma.aidl index 4100805d8b..e99d14771c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityTdscdma.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityTdscdma.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CellIdentityTdscdma { String mcc; String mnc; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityWcdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityWcdma.aidl index 907f30d0ac..12001fcd67 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityWcdma.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellIdentityWcdma.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CellIdentityWcdma { String mcc; String mnc; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfo.aidl index 38e0a44e95..467c6b77cc 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CellInfo { boolean registered; android.hardware.radio.network.CellConnectionStatus connectionStatus; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoCdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoCdma.aidl index d171a4b7df..e3bf46b918 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoCdma.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoCdma.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CellInfoCdma { android.hardware.radio.network.CellIdentityCdma cellIdentityCdma; android.hardware.radio.network.CdmaSignalStrength signalStrengthCdma; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoGsm.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoGsm.aidl index 491b6868ec..84dcd07d72 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoGsm.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoGsm.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CellInfoGsm { android.hardware.radio.network.CellIdentityGsm cellIdentityGsm; android.hardware.radio.network.GsmSignalStrength signalStrengthGsm; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoLte.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoLte.aidl index 67c5a18b22..221340b06a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoLte.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoLte.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CellInfoLte { android.hardware.radio.network.CellIdentityLte cellIdentityLte; android.hardware.radio.network.LteSignalStrength signalStrengthLte; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoNr.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoNr.aidl index a094600b6b..b392c1d2c7 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoNr.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoNr.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CellInfoNr { android.hardware.radio.network.CellIdentityNr cellIdentityNr; android.hardware.radio.network.NrSignalStrength signalStrengthNr; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoRatSpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoRatSpecificInfo.aidl index 4e0719cd7f..4ab0640b29 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoRatSpecificInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoRatSpecificInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability union CellInfoRatSpecificInfo { android.hardware.radio.network.CellInfoGsm gsm; android.hardware.radio.network.CellInfoWcdma wcdma; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoTdscdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoTdscdma.aidl index d4e0874914..138b35ce62 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoTdscdma.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoTdscdma.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CellInfoTdscdma { android.hardware.radio.network.CellIdentityTdscdma cellIdentityTdscdma; android.hardware.radio.network.TdscdmaSignalStrength signalStrengthTdscdma; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoWcdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoWcdma.aidl index da19e37952..cf7b135c63 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoWcdma.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/CellInfoWcdma.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CellInfoWcdma { android.hardware.radio.network.CellIdentityWcdma cellIdentityWcdma; android.hardware.radio.network.WcdmaSignalStrength signalStrengthWcdma; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/ClosedSubscriberGroupInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/ClosedSubscriberGroupInfo.aidl index 5c45d93e68..fe734c8f78 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/ClosedSubscriberGroupInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/ClosedSubscriberGroupInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable ClosedSubscriberGroupInfo { boolean csgIndication; String homeNodebName; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/Domain.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/Domain.aidl index 712bbdb91e..209cf5e802 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/Domain.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/Domain.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum Domain { CS = 1, PS = 2, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/EutranBands.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/EutranBands.aidl index 6c94d156cc..57fac3f5d7 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/EutranBands.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/EutranBands.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum EutranBands { BAND_1 = 1, BAND_2 = 2, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/EutranRegistrationInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/EutranRegistrationInfo.aidl index 098b57e9cd..dfbf881353 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/EutranRegistrationInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/EutranRegistrationInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable EutranRegistrationInfo { android.hardware.radio.network.LteVopsInfo lteVopsInfo; android.hardware.radio.network.NrIndicators nrIndicators; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/EvdoSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/EvdoSignalStrength.aidl index 7ec1635c4d..7c567119f8 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/EvdoSignalStrength.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/EvdoSignalStrength.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable EvdoSignalStrength { int dbm; int ecio; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/GeranBands.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/GeranBands.aidl index 7cb0fd5bad..135935ff8f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/GeranBands.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/GeranBands.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum GeranBands { BAND_T380 = 1, BAND_T410 = 2, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/GsmSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/GsmSignalStrength.aidl index 4142ae7781..2b53b39317 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/GsmSignalStrength.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/GsmSignalStrength.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable GsmSignalStrength { int signalStrength; int bitErrorRate; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/IndicationFilter.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/IndicationFilter.aidl index f79ff2a8b7..d9ed68ed6d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/IndicationFilter.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/IndicationFilter.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum IndicationFilter { NONE = 0, ALL = -1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LceDataInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LceDataInfo.aidl index 1876465e41..27b16c11fb 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LceDataInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LceDataInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable LceDataInfo { int lastHopCapacityKbps; byte confidenceLevel; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LinkCapacityEstimate.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LinkCapacityEstimate.aidl index c34f177722..5707b8e990 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LinkCapacityEstimate.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LinkCapacityEstimate.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable LinkCapacityEstimate { int downlinkCapacityKbps; int uplinkCapacityKbps; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LteSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LteSignalStrength.aidl index c7b41f1173..b5b8579305 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LteSignalStrength.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LteSignalStrength.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable LteSignalStrength { int signalStrength; int rsrp; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LteVopsInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LteVopsInfo.aidl index 9f20b1026e..6d8dd4e83a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LteVopsInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/LteVopsInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable LteVopsInfo { boolean isVopsSupported; boolean isEmcBearerSupported; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NetworkScanRequest.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NetworkScanRequest.aidl index 1e657e571b..6039740167 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NetworkScanRequest.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NetworkScanRequest.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable NetworkScanRequest { int type; int interval; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NetworkScanResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NetworkScanResult.aidl index 3dc39406e7..4e392d0c5c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NetworkScanResult.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NetworkScanResult.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable NetworkScanResult { int status; android.hardware.radio.RadioError error; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NgranBands.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NgranBands.aidl index aa60cde74f..590469076a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NgranBands.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NgranBands.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum NgranBands { BAND_1 = 1, BAND_2 = 2, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrDualConnectivityState.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrDualConnectivityState.aidl index 6ee526ff2b..62c2a56c8d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrDualConnectivityState.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrDualConnectivityState.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@Backing(type="byte") @VintfStability +@Backing(type="byte") @JavaDerive(toString=true) @VintfStability enum NrDualConnectivityState { ENABLE = 1, DISABLE = 2, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrIndicators.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrIndicators.aidl index 54f9b8f75f..88429f6f38 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrIndicators.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrIndicators.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable NrIndicators { boolean isEndcAvailable; boolean isDcNrRestricted; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrSignalStrength.aidl index 14b60a622c..98bbe6bd94 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrSignalStrength.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrSignalStrength.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable NrSignalStrength { int ssRsrp; int ssRsrq; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrVopsInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrVopsInfo.aidl index 7f58ee17fa..e5a0a700ca 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrVopsInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/NrVopsInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable NrVopsInfo { byte vopsSupported; byte emcSupported; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/OperatorInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/OperatorInfo.aidl index c3658d9f91..034150e61f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/OperatorInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/OperatorInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable OperatorInfo { String alphaLong; String alphaShort; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/PhoneRestrictedState.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/PhoneRestrictedState.aidl index dff8be052e..41555f9e3d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/PhoneRestrictedState.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/PhoneRestrictedState.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum PhoneRestrictedState { NONE = 0, CS_EMERGENCY = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/PhysicalChannelConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/PhysicalChannelConfig.aidl index 8db6bc40da..928c6b728c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/PhysicalChannelConfig.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/PhysicalChannelConfig.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable PhysicalChannelConfig { android.hardware.radio.network.CellConnectionStatus status; android.hardware.radio.RadioTechnology rat; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/PhysicalChannelConfigBand.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/PhysicalChannelConfigBand.aidl index 50af816485..efc64a6930 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/PhysicalChannelConfigBand.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/PhysicalChannelConfigBand.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability union PhysicalChannelConfigBand { boolean noinit; android.hardware.radio.network.GeranBands geranBand; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RadioAccessSpecifier.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RadioAccessSpecifier.aidl index b412f63899..1566bb5224 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RadioAccessSpecifier.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RadioAccessSpecifier.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable RadioAccessSpecifier { android.hardware.radio.AccessNetwork accessNetwork; android.hardware.radio.network.RadioAccessSpecifierBands bands; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RadioAccessSpecifierBands.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RadioAccessSpecifierBands.aidl index d44a883671..a6ac12a28a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RadioAccessSpecifierBands.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RadioAccessSpecifierBands.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability union RadioAccessSpecifierBands { boolean noinit; android.hardware.radio.network.GeranBands[] geranBands; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RadioBandMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RadioBandMode.aidl index 7266fd5e06..e9a9f6034c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RadioBandMode.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RadioBandMode.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RadioBandMode { BAND_MODE_UNSPECIFIED = 0, BAND_MODE_EURO = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RegState.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RegState.aidl index d10f41313d..e6e7999f6d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RegState.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RegState.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RegState { NOT_REG_MT_NOT_SEARCHING_OP = 0, REG_HOME = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RegStateResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RegStateResult.aidl index eff22166b9..f0a03aea4f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RegStateResult.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RegStateResult.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable RegStateResult { android.hardware.radio.network.RegState regState; android.hardware.radio.RadioTechnology rat; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RegistrationFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RegistrationFailCause.aidl index 75fcdf453d..e2cd44ce0c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RegistrationFailCause.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/RegistrationFailCause.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RegistrationFailCause { NONE = 0, IMSI_UNKNOWN_IN_HLR = 2, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/SignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/SignalStrength.aidl index 7187116fce..1c50190947 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/SignalStrength.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/SignalStrength.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable SignalStrength { android.hardware.radio.network.GsmSignalStrength gsm; android.hardware.radio.network.CdmaSignalStrength cdma; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/SignalThresholdInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/SignalThresholdInfo.aidl index 159d9c1547..040932cf5b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/SignalThresholdInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/SignalThresholdInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable SignalThresholdInfo { int signalMeasurement; int hysteresisMs; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/SuppSvcNotification.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/SuppSvcNotification.aidl index 541754e3ad..b62c71bd37 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/SuppSvcNotification.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/SuppSvcNotification.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable SuppSvcNotification { boolean isMT; int code; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/TdscdmaSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/TdscdmaSignalStrength.aidl index a00345f16a..d74c950bde 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/TdscdmaSignalStrength.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/TdscdmaSignalStrength.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable TdscdmaSignalStrength { int signalStrength; int bitErrorRate; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/UsageSetting.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/UsageSetting.aidl index 7fdf8313d3..3ca16b5eaa 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/UsageSetting.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/UsageSetting.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum UsageSetting { VOICE_CENTRIC = 1, DATA_CENTRIC = 2, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/UtranBands.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/UtranBands.aidl index 87d5b8535d..8be3da28f3 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/UtranBands.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/UtranBands.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum UtranBands { BAND_1 = 1, BAND_2 = 2, diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/WcdmaSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/WcdmaSignalStrength.aidl index 678ace9735..91125271d2 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/WcdmaSignalStrength.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/1/android/hardware/radio/network/WcdmaSignalStrength.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.network; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable WcdmaSignalStrength { int signalStrength; int bitErrorRate; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/.hash b/radio/aidl/aidl_api/android.hardware.radio.sim/1/.hash index 8d5d79aa8b..77252d7e82 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/1/.hash +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/.hash @@ -1 +1,2 @@ 6c75ba42a812cccc0f73ada23e5b2581dfedcacb +01cea196fdf8f5e41fda8dc41125f1cc2b96f757 diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/AppStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/AppStatus.aidl index 89d8f9a6ee..8a41fb9d90 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/AppStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/AppStatus.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable AppStatus { int appType; int appState; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CardPowerState.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CardPowerState.aidl index c0026ba95c..05bc13ac45 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CardPowerState.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CardPowerState.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum CardPowerState { POWER_DOWN = 0, POWER_UP = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CardStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CardStatus.aidl index cf37a0d9e1..9000d43506 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CardStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CardStatus.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CardStatus { int cardState; android.hardware.radio.sim.PinState universalPinState; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/Carrier.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/Carrier.aidl index c7fced175f..cc56888f31 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/Carrier.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/Carrier.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable Carrier { String mcc; String mnc; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CarrierRestrictions.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CarrierRestrictions.aidl index 85cf86e41f..944f1ca981 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CarrierRestrictions.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CarrierRestrictions.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CarrierRestrictions { android.hardware.radio.sim.Carrier[] allowedCarriers; android.hardware.radio.sim.Carrier[] excludedCarriers; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CdmaSubscriptionSource.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CdmaSubscriptionSource.aidl index 50e768c10e..13469f3d6a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CdmaSubscriptionSource.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/CdmaSubscriptionSource.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum CdmaSubscriptionSource { RUIM_SIM = 0, NV = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/IccIo.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/IccIo.aidl index 3e4dcf6730..5a312dc4fd 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/IccIo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/IccIo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable IccIo { int command; int fileId; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/IccIoResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/IccIoResult.aidl index 58e43ebcca..6c6bde2012 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/IccIoResult.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/IccIoResult.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable IccIoResult { int sw1; int sw2; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/ImsiEncryptionInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/ImsiEncryptionInfo.aidl index 087f399ce7..05e71cd102 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/ImsiEncryptionInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/ImsiEncryptionInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable ImsiEncryptionInfo { String mcc; String mnc; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PbReceivedStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PbReceivedStatus.aidl index 61babacce2..5e96fc6f22 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PbReceivedStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PbReceivedStatus.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; -@Backing(type="byte") @VintfStability +@Backing(type="byte") @JavaDerive(toString=true) @VintfStability enum PbReceivedStatus { PB_RECEIVED_OK = 1, PB_RECEIVED_ERROR = 2, diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PersoSubstate.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PersoSubstate.aidl index a09d7816c9..e33769e812 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PersoSubstate.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PersoSubstate.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum PersoSubstate { UNKNOWN = 0, IN_PROGRESS = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PhonebookCapacity.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PhonebookCapacity.aidl index c1fa765de7..7531c9638a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PhonebookCapacity.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PhonebookCapacity.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable PhonebookCapacity { int maxAdnRecords; int usedAdnRecords; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PhonebookRecordInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PhonebookRecordInfo.aidl index 36bc9201e7..2e96a4bf54 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PhonebookRecordInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PhonebookRecordInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable PhonebookRecordInfo { int recordId; String name; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PinState.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PinState.aidl index c78b92c70b..5cdc6d17d4 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PinState.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/PinState.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum PinState { UNKNOWN = 0, ENABLED_NOT_VERIFIED = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SelectUiccSub.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SelectUiccSub.aidl index 4842fbe6df..02121e632c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SelectUiccSub.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SelectUiccSub.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable SelectUiccSub { int slot; int appIndex; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SimApdu.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SimApdu.aidl index d8e1dde370..2201345695 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SimApdu.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SimApdu.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable SimApdu { int sessionId; int cla; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl index 6fd89d50c6..4ded3e96ec 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum SimLockMultiSimPolicy { NO_MULTISIM_POLICY = 0, ONE_VALID_SIM_MUST_BE_PRESENT = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SimRefreshResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SimRefreshResult.aidl index dd3c1f2cf3..69bf4767d3 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SimRefreshResult.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/1/android/hardware/radio/sim/SimRefreshResult.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.sim; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable SimRefreshResult { int type; int efId; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/.hash b/radio/aidl/aidl_api/android.hardware.radio.voice/1/.hash index 5434224346..fd705aff5c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/.hash +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/.hash @@ -1 +1,2 @@ bc19c55b40e9ed285c21b6c1aaa66fe855bf031b +e9ffc70247a89e6c1e526c6334c37da46f33ebea diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/AudioQuality.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/AudioQuality.aidl index 89bd2dcf5b..15669ac483 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/AudioQuality.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/AudioQuality.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum AudioQuality { UNSPECIFIED = 0, AMR = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/Call.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/Call.aidl index 7f445314b6..10d2ee751b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/Call.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/Call.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable Call { int state; int index; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CallForwardInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CallForwardInfo.aidl index 7ef9e46387..8e7aaab565 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CallForwardInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CallForwardInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CallForwardInfo { int status; int reason; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaCallWaiting.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaCallWaiting.aidl index 9edf1e7e75..310f9a0fac 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaCallWaiting.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaCallWaiting.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CdmaCallWaiting { String number; int numberPresentation; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl index b373aa5dc0..b6b562c028 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CdmaDisplayInfoRecord { String alphaBuf; const int CDMA_ALPHA_INFO_BUFFER_LENGTH = 64; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaInformationRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaInformationRecord.aidl index cc4d3fa11e..24ae775479 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaInformationRecord.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaInformationRecord.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CdmaInformationRecord { int name; android.hardware.radio.voice.CdmaDisplayInfoRecord[] display; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaLineControlInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaLineControlInfoRecord.aidl index d7f6cd4e2c..e34b3937b4 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaLineControlInfoRecord.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaLineControlInfoRecord.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CdmaLineControlInfoRecord { byte lineCtrlPolarityIncluded; byte lineCtrlToggle; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl index 26a7df544d..aeb0347d67 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CdmaNumberInfoRecord { String number; byte numberType; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl index 5ea4e50546..7877fda730 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum CdmaOtaProvisionStatus { SPL_UNLOCKED = 0, SPC_RETRIES_EXCEEDED = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaRedirectingNumberInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaRedirectingNumberInfoRecord.aidl index f0f2b04c95..b61b91b34f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaRedirectingNumberInfoRecord.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaRedirectingNumberInfoRecord.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CdmaRedirectingNumberInfoRecord { android.hardware.radio.voice.CdmaNumberInfoRecord redirectingNumber; int redirectingReason; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaSignalInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaSignalInfoRecord.aidl index 2ebb3960ba..6c7b264476 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaSignalInfoRecord.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaSignalInfoRecord.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CdmaSignalInfoRecord { boolean isPresent; byte signalType; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaT53AudioControlInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaT53AudioControlInfoRecord.aidl index 33e2c2bd3f..438231cbad 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaT53AudioControlInfoRecord.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaT53AudioControlInfoRecord.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CdmaT53AudioControlInfoRecord { byte upLink; byte downLink; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaT53ClirInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaT53ClirInfoRecord.aidl index 457fd18f75..1b254f56a0 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaT53ClirInfoRecord.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CdmaT53ClirInfoRecord.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CdmaT53ClirInfoRecord { byte cause; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CfData.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CfData.aidl index 744e7ae7fa..7e799c7b03 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CfData.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/CfData.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable CfData { android.hardware.radio.voice.CallForwardInfo[] cfInfo; const int NUM_SERVICE_CLASSES = 7; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/ClipStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/ClipStatus.aidl index dafc2b9d36..3fbb0d8f7f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/ClipStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/ClipStatus.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ClipStatus { CLIP_PROVISIONED = 0, CLIP_UNPROVISIONED = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/Dial.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/Dial.aidl index c9a02a91c4..2b2e7590bc 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/Dial.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/Dial.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable Dial { String address; int clir; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/EmergencyCallRouting.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/EmergencyCallRouting.aidl index b31a661158..07f011d349 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/EmergencyCallRouting.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/EmergencyCallRouting.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum EmergencyCallRouting { UNKNOWN = 0, EMERGENCY = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/EmergencyNumber.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/EmergencyNumber.aidl index 39bcf1a20e..98df8cd625 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/EmergencyNumber.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/EmergencyNumber.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable EmergencyNumber { String number; String mcc; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/EmergencyServiceCategory.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/EmergencyServiceCategory.aidl index 34d3c40eb3..042dd6155e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/EmergencyServiceCategory.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/EmergencyServiceCategory.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum EmergencyServiceCategory { UNSPECIFIED = 0, POLICE = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/LastCallFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/LastCallFailCause.aidl index 3e178405df..1740134ef0 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/LastCallFailCause.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/LastCallFailCause.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum LastCallFailCause { UNOBTAINABLE_NUMBER = 1, NO_ROUTE_TO_DESTINATION = 3, diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/LastCallFailCauseInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/LastCallFailCauseInfo.aidl index af75a4063a..221acf7306 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/LastCallFailCauseInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/LastCallFailCauseInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable LastCallFailCauseInfo { android.hardware.radio.voice.LastCallFailCause causeCode; String vendorCause; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/SrvccState.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/SrvccState.aidl index 8e7e9fbdf7..864374b508 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/SrvccState.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/SrvccState.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum SrvccState { HANDOVER_STARTED = 0, HANDOVER_COMPLETED = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/SsInfoData.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/SsInfoData.aidl index 9517847ada..f18b404605 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/SsInfoData.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/SsInfoData.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable SsInfoData { int[] ssInfo; const int SS_INFO_MAX = 4; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/StkCcUnsolSsResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/StkCcUnsolSsResult.aidl index 71ef7a77fc..50bb1fd35b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/StkCcUnsolSsResult.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/StkCcUnsolSsResult.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable StkCcUnsolSsResult { int serviceType; int requestType; diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/TtyMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/TtyMode.aidl index bb0a9f1ac9..77417e8718 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/TtyMode.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/TtyMode.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum TtyMode { OFF = 0, FULL = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/UssdModeType.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/UssdModeType.aidl index 9a9d723ada..ad243d2de7 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/UssdModeType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/UssdModeType.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(toString=true) @VintfStability enum UssdModeType { NOTIFY = 0, REQUEST = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/UusInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/UusInfo.aidl index 0198de9bb0..931376014c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/UusInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/1/android/hardware/radio/voice/UusInfo.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.voice; -@VintfStability +@JavaDerive(toString=true) @VintfStability parcelable UusInfo { int uusType; int uusDcs; From 356bb458dc5b5e79a9aee89098a49e8865baa144 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Wed, 11 May 2022 22:12:00 +0000 Subject: [PATCH 076/998] Update VtsHalAudioPolicyV1_0TargetTest to match XML changes There was a proposal for a backward-compatible XML schema change (https://android-review.googlesource.com/q/I1bf31c6bf6c57c9b79f0d5751601aa77780f1f80) which had a mistake. Express the change correctly to match the implementation. Bug: 231929160 Test: atest VtsHalAudioPolicyV1_0TargetTest Change-Id: Id581e290740a3c00ba3719a339c9bc47d730f35c --- audio/policy/1.0/xml/api/current.txt | 8 ++++---- .../1.0/xml/audio_policy_engine_configuration.xsd | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/audio/policy/1.0/xml/api/current.txt b/audio/policy/1.0/xml/api/current.txt index 14783810a0..0b77d45539 100644 --- a/audio/policy/1.0/xml/api/current.txt +++ b/audio/policy/1.0/xml/api/current.txt @@ -232,12 +232,12 @@ package audio.policy.V1_0 { public class ValueType { ctor public ValueType(); - method public int getAndroid_type(); + method public String getAndroid_type(); method public String getLiteral(); - method public int getNumerical(); - method public void setAndroid_type(int); + method public long getNumerical(); + method public void setAndroid_type(String); method public void setLiteral(String); - method public void setNumerical(int); + method public void setNumerical(long); } public class ValuesType { diff --git a/audio/policy/1.0/xml/audio_policy_engine_configuration.xsd b/audio/policy/1.0/xml/audio_policy_engine_configuration.xsd index 852ea77dac..3ce12e709b 100644 --- a/audio/policy/1.0/xml/audio_policy_engine_configuration.xsd +++ b/audio/policy/1.0/xml/audio_policy_engine_configuration.xsd @@ -189,10 +189,20 @@ - - + + + + + + + + + + + + From c8c0bad8640415c3316a500deb47865013b5820c Mon Sep 17 00:00:00 2001 From: Joshua McCloskey Date: Tue, 10 May 2022 05:17:44 +0000 Subject: [PATCH 077/998] Refactored biometric libraries into common Test: atest Bug: 230514750 Change-Id: I47ad020004ffef9646281611a637e1a5208f5573 --- biometrics/common/thread/Android.bp | 26 +++++++++++++++++++ .../thread}/WorkerThread.cpp | 6 ++--- .../thread/include/thread}/Callable.h | 4 +-- .../thread/include/thread}/WorkerThread.h | 4 +-- .../thread}/tests/WorkerThreadTest.cpp | 5 ++-- biometrics/common/util/Android.bp | 18 +++++++++++++ .../util}/CancellationSignal.cpp | 6 ++--- .../util/include/util}/CancellationSignal.h | 7 ++--- .../fingerprint/aidl/default/Android.bp | 19 +++----------- .../aidl/default/FakeFingerprintEngine.cpp | 7 ++--- .../fingerprint/aidl/default/Session.cpp | 2 +- .../default/include/FakeFingerprintEngine.h | 5 ++-- .../aidl/default/include/Fingerprint.h | 2 +- .../aidl/default/include/Session.h | 2 +- 14 files changed, 71 insertions(+), 42 deletions(-) create mode 100644 biometrics/common/thread/Android.bp rename biometrics/{fingerprint/aidl/default => common/thread}/WorkerThread.cpp (93%) rename biometrics/{fingerprint/aidl/default/include => common/thread/include/thread}/Callable.h (92%) rename biometrics/{fingerprint/aidl/default/include => common/thread/include/thread}/WorkerThread.h (96%) rename biometrics/{fingerprint/aidl/default => common/thread}/tests/WorkerThreadTest.cpp (96%) create mode 100644 biometrics/common/util/Android.bp rename biometrics/{fingerprint/aidl/default => common/util}/CancellationSignal.cpp (87%) rename biometrics/{fingerprint/aidl/default/include => common/util/include/util}/CancellationSignal.h (84%) diff --git a/biometrics/common/thread/Android.bp b/biometrics/common/thread/Android.bp new file mode 100644 index 0000000000..a497d01524 --- /dev/null +++ b/biometrics/common/thread/Android.bp @@ -0,0 +1,26 @@ +cc_library { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + name: "android.hardware.biometrics.common.thread", + export_include_dirs: ["include"], + vendor: true, + srcs: [ + "WorkerThread.cpp", + ], +} + +cc_test_host { + name: "android.hardware.biometrics.common.WorkerThreadTest", + local_include_dirs: ["include"], + srcs: [ + "tests/WorkerThreadTest.cpp", + "WorkerThread.cpp", + ], + shared_libs: [ + "libcutils", + ], + test_suites: ["general-tests"], +} diff --git a/biometrics/fingerprint/aidl/default/WorkerThread.cpp b/biometrics/common/thread/WorkerThread.cpp similarity index 93% rename from biometrics/fingerprint/aidl/default/WorkerThread.cpp rename to biometrics/common/thread/WorkerThread.cpp index 34ebb5ca94..61d1a13422 100644 --- a/biometrics/fingerprint/aidl/default/WorkerThread.cpp +++ b/biometrics/common/thread/WorkerThread.cpp @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "WorkerThread.h" +#include "thread/WorkerThread.h" -namespace aidl::android::hardware::biometrics::fingerprint { +namespace aidl::android::hardware::biometrics { // It's important that mThread is initialized after everything else because it runs a member // function that may use any member of this class. @@ -68,4 +68,4 @@ void WorkerThread::threadFunc() { } } -} // namespace aidl::android::hardware::biometrics::fingerprint +} // namespace aidl::android::hardware::biometrics diff --git a/biometrics/fingerprint/aidl/default/include/Callable.h b/biometrics/common/thread/include/thread/Callable.h similarity index 92% rename from biometrics/fingerprint/aidl/default/include/Callable.h rename to biometrics/common/thread/include/thread/Callable.h index c6295117e5..6eeff76521 100644 --- a/biometrics/fingerprint/aidl/default/include/Callable.h +++ b/biometrics/common/thread/include/thread/Callable.h @@ -16,7 +16,7 @@ #pragma once -namespace aidl::android::hardware::biometrics::fingerprint { +namespace aidl::android::hardware::biometrics { // Interface for representing parameterless functions. Unlike std::function, this can also // represent move-only lambdas. @@ -51,4 +51,4 @@ std::unique_ptr Callable::from(T func) { return std::make_unique>(std::move(func)); } -} // namespace aidl::android::hardware::biometrics::fingerprint \ No newline at end of file +} // namespace aidl::android::hardware::biometrics \ No newline at end of file diff --git a/biometrics/fingerprint/aidl/default/include/WorkerThread.h b/biometrics/common/thread/include/thread/WorkerThread.h similarity index 96% rename from biometrics/fingerprint/aidl/default/include/WorkerThread.h rename to biometrics/common/thread/include/thread/WorkerThread.h index 6fff4f2cb7..5f89a7f1c4 100644 --- a/biometrics/fingerprint/aidl/default/include/WorkerThread.h +++ b/biometrics/common/thread/include/thread/WorkerThread.h @@ -23,7 +23,7 @@ #include "Callable.h" -namespace aidl::android::hardware::biometrics::fingerprint { +namespace aidl::android::hardware::biometrics { // A class that encapsulates a worker thread and a task queue, and provides a convenient interface // for a Session to schedule its tasks for asynchronous execution. @@ -76,4 +76,4 @@ class WorkerThread final { std::thread mThread; }; -} // namespace aidl::android::hardware::biometrics::fingerprint +} // namespace aidl::android::hardware::biometrics diff --git a/biometrics/fingerprint/aidl/default/tests/WorkerThreadTest.cpp b/biometrics/common/thread/tests/WorkerThreadTest.cpp similarity index 96% rename from biometrics/fingerprint/aidl/default/tests/WorkerThreadTest.cpp rename to biometrics/common/thread/tests/WorkerThreadTest.cpp index 902fb40c6b..5bb9e7e886 100644 --- a/biometrics/fingerprint/aidl/default/tests/WorkerThreadTest.cpp +++ b/biometrics/common/thread/tests/WorkerThreadTest.cpp @@ -21,12 +21,11 @@ #include -#include "WorkerThread.h" +#include "thread/WorkerThread.h" namespace { -using aidl::android::hardware::biometrics::fingerprint::Callable; -using aidl::android::hardware::biometrics::fingerprint::WorkerThread; +using namespace aidl::android::hardware::biometrics; using namespace std::chrono_literals; TEST(WorkerThreadTest, ScheduleReturnsTrueWhenQueueHasSpace) { diff --git a/biometrics/common/util/Android.bp b/biometrics/common/util/Android.bp new file mode 100644 index 0000000000..918ef72782 --- /dev/null +++ b/biometrics/common/util/Android.bp @@ -0,0 +1,18 @@ +cc_library { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + name: "android.hardware.biometrics.common.util", + export_include_dirs: ["include"], + vendor: true, + srcs: [ + "CancellationSignal.cpp", + ], + shared_libs: [ + "libbase", + "libbinder_ndk", + "android.hardware.biometrics.common-V2-ndk", + ], +} diff --git a/biometrics/fingerprint/aidl/default/CancellationSignal.cpp b/biometrics/common/util/CancellationSignal.cpp similarity index 87% rename from biometrics/fingerprint/aidl/default/CancellationSignal.cpp rename to biometrics/common/util/CancellationSignal.cpp index 659831616d..7888838b48 100644 --- a/biometrics/fingerprint/aidl/default/CancellationSignal.cpp +++ b/biometrics/common/util/CancellationSignal.cpp @@ -14,12 +14,12 @@ * limitations under the License. */ -#include "CancellationSignal.h" +#include "util/CancellationSignal.h" #include #include -namespace aidl::android::hardware::biometrics::fingerprint { +namespace aidl::android::hardware::biometrics { CancellationSignal::CancellationSignal(std::promise&& cancellationPromise) : mCancellationPromise(std::move(cancellationPromise)) {} @@ -34,4 +34,4 @@ bool shouldCancel(const std::future& f) { return f.wait_for(std::chrono::seconds(0)) == std::future_status::ready; } -} // namespace aidl::android::hardware::biometrics::fingerprint +} // namespace aidl::android::hardware::biometrics diff --git a/biometrics/fingerprint/aidl/default/include/CancellationSignal.h b/biometrics/common/util/include/util/CancellationSignal.h similarity index 84% rename from biometrics/fingerprint/aidl/default/include/CancellationSignal.h rename to biometrics/common/util/include/util/CancellationSignal.h index 99f2fbae97..be77e29fc0 100644 --- a/biometrics/fingerprint/aidl/default/include/CancellationSignal.h +++ b/biometrics/common/util/include/util/CancellationSignal.h @@ -17,13 +17,10 @@ #pragma once #include -#include #include #include -#include "WorkerThread.h" - -namespace aidl::android::hardware::biometrics::fingerprint { +namespace aidl::android::hardware::biometrics { class CancellationSignal : public common::BnCancellationSignal { public: @@ -39,4 +36,4 @@ class CancellationSignal : public common::BnCancellationSignal { // to this future should be cancelled. bool shouldCancel(const std::future& cancellationFuture); -} // namespace aidl::android::hardware::biometrics::fingerprint +} // namespace aidl::android::hardware::biometrics diff --git a/biometrics/fingerprint/aidl/default/Android.bp b/biometrics/fingerprint/aidl/default/Android.bp index 70fadfecc6..31fd96bee0 100644 --- a/biometrics/fingerprint/aidl/default/Android.bp +++ b/biometrics/fingerprint/aidl/default/Android.bp @@ -15,11 +15,9 @@ cc_binary { vintf_fragments: ["fingerprint-example.xml"], local_include_dirs: ["include"], srcs: [ - "CancellationSignal.cpp", "FakeFingerprintEngine.cpp", "Fingerprint.cpp", "Session.cpp", - "WorkerThread.cpp", "main.cpp", ], shared_libs: [ @@ -27,28 +25,16 @@ cc_binary { "libbinder_ndk", "android.hardware.biometrics.fingerprint-V2-ndk", "android.hardware.biometrics.common-V2-ndk", + "android.hardware.biometrics.common.thread", + "android.hardware.biometrics.common.util", ], static_libs: ["android.hardware.biometrics.fingerprint.VirtualProps"], } -cc_test_host { - name: "android.hardware.biometrics.fingerprint.WorkerThreadTest", - local_include_dirs: ["include"], - srcs: [ - "tests/WorkerThreadTest.cpp", - "WorkerThread.cpp", - ], - shared_libs: [ - "libcutils", - ], - test_suites: ["general-tests"], -} - cc_test { name: "android.hardware.biometrics.fingerprint.FakeFingerprintEngineTest", local_include_dirs: ["include"], srcs: [ - "CancellationSignal.cpp", "tests/FakeFingerprintEngineTest.cpp", "FakeFingerprintEngine.cpp", ], @@ -61,6 +47,7 @@ cc_test { "android.hardware.biometrics.fingerprint-V2-ndk", "android.hardware.biometrics.common-V2-ndk", "android.hardware.keymaster-V3-ndk", + "android.hardware.biometrics.common.util", ], vendor: true, test_suites: ["general-tests"], diff --git a/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp b/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp index d1fe18350b..d0250af3bf 100644 --- a/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp +++ b/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp @@ -16,14 +16,15 @@ #include "FakeFingerprintEngine.h" -#include -#include "CancellationSignal.h" - #include + +#include #include #include #include +#include "util/CancellationSignal.h" + #define SLEEP_MS(x) \ if (x > 0) std::this_thread::sleep_for(std::chrono::milliseconds(x)) #define BEGIN_OP(x) \ diff --git a/biometrics/fingerprint/aidl/default/Session.cpp b/biometrics/fingerprint/aidl/default/Session.cpp index 078d3d9dc7..ab91e9878c 100644 --- a/biometrics/fingerprint/aidl/default/Session.cpp +++ b/biometrics/fingerprint/aidl/default/Session.cpp @@ -18,7 +18,7 @@ #include -#include "CancellationSignal.h" +#include "util/CancellationSignal.h" namespace aidl::android::hardware::biometrics::fingerprint { diff --git a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h index 8659b79302..eb810da1e3 100644 --- a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h +++ b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h @@ -15,12 +15,13 @@ */ #pragma once - +#include #include #include -#include "CancellationSignal.h" +#include +#include using namespace ::aidl::android::hardware::biometrics::common; diff --git a/biometrics/fingerprint/aidl/default/include/Fingerprint.h b/biometrics/fingerprint/aidl/default/include/Fingerprint.h index 7bd3d6ddfd..20def0cecd 100644 --- a/biometrics/fingerprint/aidl/default/include/Fingerprint.h +++ b/biometrics/fingerprint/aidl/default/include/Fingerprint.h @@ -20,7 +20,7 @@ #include "FakeFingerprintEngine.h" #include "Session.h" -#include "WorkerThread.h" +#include "thread/WorkerThread.h" namespace aidl::android::hardware::biometrics::fingerprint { diff --git a/biometrics/fingerprint/aidl/default/include/Session.h b/biometrics/fingerprint/aidl/default/include/Session.h index acd5def832..104d819ff0 100644 --- a/biometrics/fingerprint/aidl/default/include/Session.h +++ b/biometrics/fingerprint/aidl/default/include/Session.h @@ -20,7 +20,7 @@ #include #include "FakeFingerprintEngine.h" -#include "WorkerThread.h" +#include "thread/WorkerThread.h" namespace aidl::android::hardware::biometrics::fingerprint { From db009a58cbc51d4d87e7cd4b6201554b8d046128 Mon Sep 17 00:00:00 2001 From: Joshua McCloskey Date: Tue, 10 May 2022 05:18:20 +0000 Subject: [PATCH 078/998] Add virtual Face HAL Fixes: 230514750 Test: atest VtsHalBiometricsFaceTargetTest Test: atest VtsHalBiometricsFingerprintTargetTest Test: atest android.hardware.biometrics.face.FakeFaceEngineTest Test: atest android.hardware.biometrics.face.FakeFingerprintEngineTest Test: See README.md Test: Verified that face and fingerprint get reset upon authenticating. Change-Id: I57c1a61bec960e3be28736e6050be662ef412d8c --- biometrics/common/util/include/util/Util.h | 69 ++++ biometrics/face/aidl/default/Android.bp | 33 ++ biometrics/face/aidl/default/Face.cpp | 8 +- .../face/aidl/default/FakeFaceEngine.cpp | 318 +++++++++++++++ biometrics/face/aidl/default/FakeFaceEngine.h | 65 +++ biometrics/face/aidl/default/README.md | 77 ++++ biometrics/face/aidl/default/Session.cpp | 126 +++--- biometrics/face/aidl/default/Session.h | 11 +- ...e.biometrics.face.VirtualProps-current.txt | 98 +++++ biometrics/face/aidl/default/face.sysprop | 159 ++++++++ .../aidl/default/tests/FakeFaceEngineTest.cpp | 383 ++++++++++++++++++ .../aidl/default/FakeFingerprintEngine.cpp | 50 +-- 12 files changed, 1282 insertions(+), 115 deletions(-) create mode 100644 biometrics/common/util/include/util/Util.h create mode 100644 biometrics/face/aidl/default/FakeFaceEngine.cpp create mode 100644 biometrics/face/aidl/default/FakeFaceEngine.h create mode 100644 biometrics/face/aidl/default/README.md create mode 100644 biometrics/face/aidl/default/api/android.hardware.biometrics.face.VirtualProps-current.txt create mode 100644 biometrics/face/aidl/default/face.sysprop create mode 100644 biometrics/face/aidl/default/tests/FakeFaceEngineTest.cpp diff --git a/biometrics/common/util/include/util/Util.h b/biometrics/common/util/include/util/Util.h new file mode 100644 index 0000000000..29ec0f865e --- /dev/null +++ b/biometrics/common/util/include/util/Util.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2021 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. + */ + +#pragma once + +#include + +#include +#include +#include +#include + +namespace aidl::android::hardware::biometrics { + +#define SLEEP_MS(x) \ + if (x > 0) std::this_thread::sleep_for(std::chrono::milliseconds(x)) +#define BEGIN_OP(x) \ + do { \ + LOG(INFO) << __func__; \ + SLEEP_MS(x); \ + } while (0) +#define IS_TRUE(x) ((x == "1") || (x == "true")) + +// This is for non-test situations, such as casual cuttlefish users, that don't +// set an explicit value. +// Some operations (i.e. enroll, authenticate) will be executed in tight loops +// by parts of the UI or fail if there is no latency. For example, the +// Face settings page constantly runs auth and the enrollment UI uses a +// cancel/restart cycle that requires some latency while the activities change. +#define DEFAULT_LATENCY 800 + +class Util { + public: + static int64_t getSystemNanoTime() { + timespec now; + clock_gettime(CLOCK_MONOTONIC, &now); + return now.tv_sec * 1000000000LL + now.tv_nsec; + } + + static bool hasElapsed(int64_t start, int64_t durationMillis) { + auto now = getSystemNanoTime(); + if (now < start) return true; + if (durationMillis <= 0) return true; + return ((now - start) / 1000000LL) > durationMillis; + } + + static std::vector split(const std::string& str, const std::string& sep) { + std::regex regex(sep); + std::vector parts( + std::sregex_token_iterator(str.begin(), str.end(), regex, -1), + std::sregex_token_iterator()); + return parts; + } +}; + +} // namespace aidl::android::hardware::biometrics \ No newline at end of file diff --git a/biometrics/face/aidl/default/Android.bp b/biometrics/face/aidl/default/Android.bp index 7f66ecaf83..48c929bc42 100644 --- a/biometrics/face/aidl/default/Android.bp +++ b/biometrics/face/aidl/default/Android.bp @@ -18,10 +18,43 @@ cc_binary { "libbinder_ndk", "android.hardware.biometrics.face-V2-ndk", "android.hardware.biometrics.common-V2-ndk", + "android.hardware.biometrics.common.thread", + "android.hardware.biometrics.common.util", ], srcs: [ "main.cpp", "Face.cpp", + "FakeFaceEngine.cpp", "Session.cpp", ], + static_libs: ["android.hardware.biometrics.face.VirtualProps"], +} + +sysprop_library { + name: "android.hardware.biometrics.face.VirtualProps", + srcs: ["face.sysprop"], + property_owner: "Vendor", + vendor: true, +} + +cc_test { + name: "android.hardware.biometrics.face.FakeFaceEngineTest", + srcs: [ + "tests/FakeFaceEngineTest.cpp", + "FakeFaceEngine.cpp", + ], + shared_libs: [ + "libbase", + "libbinder_ndk", + ], + static_libs: [ + "android.hardware.biometrics.face.VirtualProps", + "android.hardware.biometrics.face-V2-ndk", + "android.hardware.biometrics.common-V2-ndk", + "android.hardware.keymaster-V3-ndk", + "android.hardware.biometrics.common.util", + ], + vendor: true, + test_suites: ["general-tests"], + require_root: true, } diff --git a/biometrics/face/aidl/default/Face.cpp b/biometrics/face/aidl/default/Face.cpp index aca3e135f6..652a7e1f6c 100644 --- a/biometrics/face/aidl/default/Face.cpp +++ b/biometrics/face/aidl/default/Face.cpp @@ -17,12 +17,14 @@ #include "Face.h" #include "Session.h" +#include "FakeFaceEngine.h" + namespace aidl::android::hardware::biometrics::face { const int kSensorId = 4; -const common::SensorStrength kSensorStrength = common::SensorStrength::STRONG; +const common::SensorStrength kSensorStrength = FakeFaceEngine::GetSensorStrength(); const int kMaxEnrollmentsPerUser = 5; -const FaceSensorType kSensorType = FaceSensorType::RGB; +const FaceSensorType kSensorType = FakeFaceEngine::GetSensorType(); const bool kHalControlsPreview = true; const std::string kHwComponentId = "faceSensor"; const std::string kHardwareVersion = "vendor/model/revision"; @@ -69,7 +71,7 @@ ndk::ScopedAStatus Face::getSensorProps(std::vector* return_val) { ndk::ScopedAStatus Face::createSession(int32_t /*sensorId*/, int32_t /*userId*/, const std::shared_ptr& cb, std::shared_ptr* return_val) { - *return_val = SharedRefBase::make(cb); + *return_val = SharedRefBase::make(std::make_unique(), cb); return ndk::ScopedAStatus::ok(); } diff --git a/biometrics/face/aidl/default/FakeFaceEngine.cpp b/biometrics/face/aidl/default/FakeFaceEngine.cpp new file mode 100644 index 0000000000..0f088f4331 --- /dev/null +++ b/biometrics/face/aidl/default/FakeFaceEngine.cpp @@ -0,0 +1,318 @@ +#include "FakeFaceEngine.h" + +#include + +#include + +#include "util/CancellationSignal.h" +#include "util/Util.h" + +using namespace ::android::face::virt; + +namespace aidl::android::hardware::biometrics::face { + +FaceSensorType FakeFaceEngine::GetSensorType() { + std::string type = FaceHalProperties::type().value_or(""); + if (type == "IR") { + return FaceSensorType::IR; + } else { + FaceHalProperties::type("RGB"); + return FaceSensorType::RGB; + } +} + +common::SensorStrength FakeFaceEngine::GetSensorStrength() { + std::string strength = FaceHalProperties::strength().value_or(""); + if (strength == "convenience") { + return common::SensorStrength::CONVENIENCE; + } else if (strength == "weak") { + return common::SensorStrength::WEAK; + } else { + FaceHalProperties::strength("strong"); + return common::SensorStrength::STRONG; + } +} + +void FakeFaceEngine::generateChallengeImpl(ISessionCallback* cb) { + BEGIN_OP(0); + std::uniform_int_distribution dist; + auto challenge = dist(mRandom); + FaceHalProperties::challenge(challenge); + cb->onChallengeGenerated(challenge); +} + +void FakeFaceEngine::revokeChallengeImpl(ISessionCallback* cb, int64_t challenge) { + BEGIN_OP(0); + FaceHalProperties::challenge({}); + cb->onChallengeRevoked(challenge); +} +void FakeFaceEngine::getEnrollmentConfigImpl(ISessionCallback* /*cb*/, + std::vector* /*return_val*/) {} +void FakeFaceEngine::enrollImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& hat, + EnrollmentType /*enrollmentType*/, + const std::vector& /*features*/, + const std::future& cancel) { + BEGIN_OP(FaceHalProperties::operation_start_enroll_latency().value_or(0)); + // format is ",::,::... + auto nextEnroll = FaceHalProperties::next_enrollment().value_or(""); + // Erase the next enrollment + FaceHalProperties::next_enrollment({}); + + AuthenticationFrame frame; + frame.data.acquiredInfo = AcquiredInfo::START; + frame.data.vendorCode = 0; + cb->onAuthenticationFrame(frame); + + // Do proper HAT verification in the real implementation. + if (hat.mac.empty()) { + LOG(ERROR) << "Fail: hat"; + cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */); + return; + } + + if (FaceHalProperties::operation_enroll_fails().value_or(false)) { + LOG(ERROR) << "Fail: operation_enroll_fails"; + cb->onError(Error::VENDOR, 0 /* vendorError */); + return; + } + + auto parts = Util::split(nextEnroll, ","); + if (parts.size() < 2) { + LOG(ERROR) << "Fail: invalid next_enrollment for : " << nextEnroll; + cb->onError(Error::VENDOR, 0 /* vendorError */); + return; + } + + auto enrollmentId = std::stoi(parts[0]); + const int numBuckets = parts.size() - 1; + for (size_t i = 1; i < parts.size(); i++) { + auto enrollHit = Util::split(parts[i], ":"); + if (enrollHit.size() != 3) { + LOG(ERROR) << "Error when unpacking enrollment hit: " << parts[i]; + cb->onError(Error::VENDOR, 0 /* vendorError */); + } + std::string bucket = enrollHit[0]; + std::string delay = enrollHit[1]; + std::string succeeds = enrollHit[2]; + + SLEEP_MS(std::stoi(delay)); + + if (shouldCancel(cancel)) { + LOG(ERROR) << "Fail: cancel"; + cb->onError(Error::CANCELED, 0 /* vendorCode */); + return; + } + + if (!IS_TRUE(succeeds)) { // end and failed + LOG(ERROR) << "Fail: requested by caller: " << parts[i]; + cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorCode */); + return; + } + + EnrollmentFrame frame; + + frame.data.acquiredInfo = AcquiredInfo::GOOD; + frame.data.vendorCode = 0; + cb->onEnrollmentFrame(frame); + + frame.data.acquiredInfo = AcquiredInfo::VENDOR; + frame.data.vendorCode = std::stoi(bucket); + cb->onEnrollmentFrame(frame); + + int remainingBuckets = numBuckets - i; + if (remainingBuckets > 0) { + cb->onEnrollmentProgress(enrollmentId, remainingBuckets); + } + } + + auto enrollments = FaceHalProperties::enrollments(); + enrollments.push_back(enrollmentId); + FaceHalProperties::enrollments(enrollments); + LOG(INFO) << "enrolled : " << enrollmentId; + cb->onEnrollmentProgress(enrollmentId, 0); +} + +void FakeFaceEngine::authenticateImpl(ISessionCallback* cb, int64_t /*operationId*/, + const std::future& cancel) { + BEGIN_OP(FaceHalProperties::operation_authenticate_latency().value_or(0)); + + // Signal to the framework that we have begun authenticating. + AuthenticationFrame frame; + frame.data.acquiredInfo = AcquiredInfo::START; + frame.data.vendorCode = 0; + cb->onAuthenticationFrame(frame); + + // Also signal that we have opened the camera. + frame = {}; + frame.data.acquiredInfo = AcquiredInfo::FIRST_FRAME_RECEIVED; + frame.data.vendorCode = 0; + cb->onAuthenticationFrame(frame); + + auto now = Util::getSystemNanoTime(); + int64_t duration = FaceHalProperties::operation_authenticate_duration().value_or(0); + if (duration > 0) { + do { + SLEEP_MS(5); + } while (!Util::hasElapsed(now, duration)); + } + + if (FaceHalProperties::operation_authenticate_fails().value_or(false)) { + LOG(ERROR) << "Fail: operation_authenticate_fails"; + cb->onError(Error::VENDOR, 0 /* vendorError */); + return; + } + + if (FaceHalProperties::lockout().value_or(false)) { + LOG(ERROR) << "Fail: lockout"; + cb->onLockoutPermanent(); + cb->onError(Error::HW_UNAVAILABLE, 0 /* vendorError */); + return; + } + + if (shouldCancel(cancel)) { + LOG(ERROR) << "Fail: cancel"; + cb->onError(Error::CANCELED, 0 /* vendorCode */); + return; + } + + auto id = FaceHalProperties::enrollment_hit().value_or(0); + auto enrolls = FaceHalProperties::enrollments(); + auto isEnrolled = std::find(enrolls.begin(), enrolls.end(), id) != enrolls.end(); + if (id < 0 || !isEnrolled) { + LOG(ERROR) << (isEnrolled ? "invalid enrollment hit" : "Fail: not enrolled"); + cb->onAuthenticationFailed(); + cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */); + return; + } + + cb->onAuthenticationSucceeded(id, {} /* hat */); +} + +void FakeFaceEngine::detectInteractionImpl(ISessionCallback* cb, const std::future& cancel) { + BEGIN_OP(FaceHalProperties::operation_detect_interaction_latency().value_or(0)); + + if (FaceHalProperties::operation_detect_interaction_fails().value_or(false)) { + LOG(ERROR) << "Fail: operation_detect_interaction_fails"; + cb->onError(Error::VENDOR, 0 /* vendorError */); + return; + } + + if (shouldCancel(cancel)) { + LOG(ERROR) << "Fail: cancel"; + cb->onError(Error::CANCELED, 0 /* vendorCode */); + return; + } + + auto id = FaceHalProperties::enrollment_hit().value_or(0); + auto enrolls = FaceHalProperties::enrollments(); + auto isEnrolled = std::find(enrolls.begin(), enrolls.end(), id) != enrolls.end(); + if (id <= 0 || !isEnrolled) { + LOG(ERROR) << "Fail: not enrolled"; + cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */); + return; + } + + cb->onInteractionDetected(); +} + +void FakeFaceEngine::enumerateEnrollmentsImpl(ISessionCallback* cb) { + BEGIN_OP(0); + std::vector enrollments; + for (const auto& enrollmentId : FaceHalProperties::enrollments()) { + if (enrollmentId) { + enrollments.push_back(*enrollmentId); + } + } + cb->onEnrollmentsEnumerated(enrollments); +} + +void FakeFaceEngine::removeEnrollmentsImpl(ISessionCallback* cb, + const std::vector& enrollmentIds) { + BEGIN_OP(0); + + std::vector> newEnrollments; + for (const auto& enrollment : FaceHalProperties::enrollments()) { + auto id = enrollment.value_or(0); + if (std::find(enrollmentIds.begin(), enrollmentIds.end(), id) == enrollmentIds.end()) { + newEnrollments.emplace_back(id); + } + } + FaceHalProperties::enrollments(newEnrollments); + cb->onEnrollmentsRemoved(enrollmentIds); +} + +void FakeFaceEngine::getFeaturesImpl(ISessionCallback* cb) { + BEGIN_OP(0); + + if (FaceHalProperties::enrollments().empty()) { + cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorCode */); + return; + } + + std::vector featuresToReturn = {}; + for (const auto& feature : FaceHalProperties::features()) { + if (feature) { + featuresToReturn.push_back((Feature)(*feature)); + } + } + cb->onFeaturesRetrieved(featuresToReturn); +} + +void FakeFaceEngine::setFeatureImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& hat, + Feature feature, bool enabled) { + BEGIN_OP(0); + + if (FaceHalProperties::enrollments().empty()) { + LOG(ERROR) << "Unable to set feature, enrollments are empty"; + cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorCode */); + return; + } + + if (hat.mac.empty()) { + LOG(ERROR) << "Unable to set feature, invalid hat"; + cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorCode */); + return; + } + + auto features = FaceHalProperties::features(); + + auto itr = std::find_if(features.begin(), features.end(), [feature](const auto& theFeature) { + return *theFeature == (int)feature; + }); + + if (!enabled && (itr != features.end())) { + features.erase(itr); + } else if (enabled && (itr == features.end())) { + features.push_back((int)feature); + } + + FaceHalProperties::features(features); + cb->onFeatureSet(feature); +} + +void FakeFaceEngine::getAuthenticatorIdImpl(ISessionCallback* cb) { + BEGIN_OP(0); + // If this is a weak HAL return 0 per the spec. + if (GetSensorStrength() != common::SensorStrength::STRONG) { + cb->onAuthenticatorIdRetrieved(0); + } else { + cb->onAuthenticatorIdRetrieved(FaceHalProperties::authenticator_id().value_or(0)); + } +} + +void FakeFaceEngine::invalidateAuthenticatorIdImpl(ISessionCallback* cb) { + BEGIN_OP(0); + int64_t authenticatorId = FaceHalProperties::authenticator_id().value_or(0); + int64_t newId = authenticatorId + 1; + FaceHalProperties::authenticator_id(newId); + cb->onAuthenticatorIdInvalidated(newId); +} + +void FakeFaceEngine::resetLockoutImpl(ISessionCallback* cb, + const keymaster::HardwareAuthToken& /*hat*/) { + BEGIN_OP(0); + FaceHalProperties::lockout(false); + cb->onLockoutCleared(); +} + +} // namespace aidl::android::hardware::biometrics::face \ No newline at end of file diff --git a/biometrics/face/aidl/default/FakeFaceEngine.h b/biometrics/face/aidl/default/FakeFaceEngine.h new file mode 100644 index 0000000000..edb54ce0f8 --- /dev/null +++ b/biometrics/face/aidl/default/FakeFaceEngine.h @@ -0,0 +1,65 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include + +#include + +#include +#include + +namespace aidl::android::hardware::biometrics::face { + +namespace face = aidl::android::hardware::biometrics::face; +namespace common = aidl::android::hardware::biometrics::common; +namespace keymaster = aidl::android::hardware::keymaster; + +using aidl::android::hardware::common::NativeHandle; +// A fake engine that is backed by system properties instead of hardware. +class FakeFaceEngine { + public: + FakeFaceEngine() : mRandom(std::mt19937::default_seed) {} + + static face::FaceSensorType GetSensorType(); + static common::SensorStrength GetSensorStrength(); + void generateChallengeImpl(ISessionCallback* cb); + void revokeChallengeImpl(ISessionCallback* cb, int64_t challenge); + void getEnrollmentConfigImpl(ISessionCallback* cb, + std::vector* return_val); + void enrollImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& hat, + EnrollmentType enrollmentType, const std::vector& features, + const std::future& cancel); + void authenticateImpl(ISessionCallback* cb, int64_t operationId, + const std::future& cancel); + void detectInteractionImpl(ISessionCallback* cb, const std::future& cancel); + void enumerateEnrollmentsImpl(ISessionCallback* cb); + void removeEnrollmentsImpl(ISessionCallback* cb, const std::vector& enrollmentIds); + void getFeaturesImpl(ISessionCallback* cb); + void setFeatureImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& hat, + Feature feature, bool enabled); + void getAuthenticatorIdImpl(ISessionCallback* cb); + void invalidateAuthenticatorIdImpl(ISessionCallback* cb); + void resetLockoutImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& /*hat*/); + + std::mt19937 mRandom; +}; + +} // namespace aidl::android::hardware::biometrics::face \ No newline at end of file diff --git a/biometrics/face/aidl/default/README.md b/biometrics/face/aidl/default/README.md new file mode 100644 index 0000000000..16559733c0 --- /dev/null +++ b/biometrics/face/aidl/default/README.md @@ -0,0 +1,77 @@ +# Virtual Face HAL + +This is a virtual HAL implementation that is backed by system properties +instead of actual hardware. It's intended for testing and UI development +on debuggable builds to allow devices to masquerade as alternative device +types and for emulators. + +## Device Selection + +You can either run the FakeFaceEngine on a [real device](#actual-device) or a [virtual device/cuttlefish](#getting-started-on-a-virtual-device-cuttlefish). This document should +help you to get started on either one. + +After setting up a device, go ahead and try out [enrolling](#enrolling) & [authenticating](#authenticating) + +### Getting started on a Virtual Device (cuttlefish) + + +Note, I'm running this via a cloudtop virtual device. + +1. Setup cuttlefish on cloudtop, See [this](https://g3doc.corp.google.com/company/teams/android/teampages/acloud/getting_started.md?cl=head) for more details. +2. acloud create --local-image +3. Enter in the shell command to disable hidl + +```shell +$ adb root +$ adb shell settings put secure com.android.server.biometrics.AuthService.hidlDisabled 1 +$ adb reboot +``` +4. You should now be able to do fake enrollments and authentications (as seen down below) + +### Actual Device + +1. Modify your real devices make file (I.E. vendor/google/products/{YOUR_DEVICE}.mk) +2. Ensure that there is no other face HAL that is being included by the device +3. Add the following +``` +PRODUCT_COPY_FILES += \ + frameworks/native/data/etc/android.hardware.biometrics.face.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/permissions/android.hardware.biometrics.face.xml + +PRODUCT_PACKAGES += \ + android.hardware.biometrics.face-service.example \ + +``` +4. Now build and flash m -j120 && flash +5. Run the following commands + +```shell +# This is a temporary workaround +$ adb root +$ adb shell setprop persist.vendor.face.virtual.type RGB +$ adb shell setprop persist.vendor.face.virtual.strength strong +$ adb shell locksettings set-pin 0000 +$ adb reboot +``` + +## Enrolling + +```shell +# authenticar_id,bucket_id:duration:(true|false).... +$ adb shell setprop vendor.face.virtual.next_enrollment 1,0:500:true,5:250:true,10:150:true,15:500:true +$ adb shell am start -n com.android.settings/.biometrics.face.FaceEnrollIntroduction +# If you would like to get rid of the enrollment, run the follwoing command +$ adb shell setprop persist.vendor.face.virtual.enrollments \"\" +``` + +## Authenticating + +```shell +# If enrollment hasn't been setup +$ adb shell setprop persist.vendor.face.virtual.enrollments 1 +$ adb shell cmd face sync +# After enrollment has been setup +$ adb shell setprop vendor.face.virtual.operation_authenticate_duration 800 +$ adb shell setprop vendor.face.virtual.enrollment_hit 1 +# Power button press to simulate auth +$ adb shell input keyevent 26 +``` diff --git a/biometrics/face/aidl/default/Session.cpp b/biometrics/face/aidl/default/Session.cpp index 984a1a99dc..1188459f3f 100644 --- a/biometrics/face/aidl/default/Session.cpp +++ b/biometrics/face/aidl/default/Session.cpp @@ -14,139 +14,135 @@ * limitations under the License. */ -#include #include #include "Session.h" namespace aidl::android::hardware::biometrics::face { -class CancellationSignal : public common::BnCancellationSignal { - private: - std::shared_ptr cb_; +constexpr size_t MAX_WORKER_QUEUE_SIZE = 5; - public: - explicit CancellationSignal(std::shared_ptr cb) : cb_(std::move(cb)) {} - - ndk::ScopedAStatus cancel() override { - cb_->onError(Error::CANCELED, 0 /* vendorCode */); - return ndk::ScopedAStatus::ok(); - } -}; - -Session::Session(std::shared_ptr cb) - : cb_(std::move(cb)), mRandom(std::mt19937::default_seed) {} +Session::Session(std::unique_ptr engine, std::shared_ptr cb) + : mEngine(std::move(engine)), mCb(std::move(cb)), mRandom(std::mt19937::default_seed) { + mThread = std::make_unique(MAX_WORKER_QUEUE_SIZE); +} ndk::ScopedAStatus Session::generateChallenge() { LOG(INFO) << "generateChallenge"; - if (cb_) { - std::uniform_int_distribution dist; - auto challenge = dist(mRandom); - cb_->onChallengeGenerated(challenge); - } + mThread->schedule(Callable::from([this] { mEngine->generateChallengeImpl(mCb.get()); })); return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus Session::revokeChallenge(int64_t challenge) { LOG(INFO) << "revokeChallenge"; - if (cb_) { - cb_->onChallengeRevoked(challenge); - } + mThread->schedule(Callable::from( + [this, challenge] { mEngine->revokeChallengeImpl(mCb.get(), challenge); })); return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Session::getEnrollmentConfig(EnrollmentType /*enrollmentType*/, - std::vector* return_val) { - *return_val = {}; +ndk::ScopedAStatus Session::getEnrollmentConfig( + EnrollmentType /*enrollmentType*/, std::vector* cancellationSignal) { + *cancellationSignal = {}; return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus Session::enroll( - const keymaster::HardwareAuthToken& /*hat*/, EnrollmentType /*enrollmentType*/, - const std::vector& /*features*/, - const std::optional& /*previewSurface*/, - std::shared_ptr* /*return_val*/) { + const keymaster::HardwareAuthToken& hat, EnrollmentType enrollmentType, + const std::vector& features, const std::optional& /*previewSurface*/, + std::shared_ptr* cancellationSignal) { LOG(INFO) << "enroll"; - if (cb_) { - cb_->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */); - } + std::promise cancellationPromise; + auto cancFuture = cancellationPromise.get_future(); + + mThread->schedule(Callable::from( + [this, hat, enrollmentType, features, cancFuture = std::move(cancFuture)] { + mEngine->enrollImpl(mCb.get(), hat, enrollmentType, features, cancFuture); + })); + + *cancellationSignal = SharedRefBase::make(std::move(cancellationPromise)); return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Session::authenticate(int64_t /*keystoreOperationId*/, - std::shared_ptr* return_val) { +ndk::ScopedAStatus Session::authenticate( + int64_t keystoreOperationId, + std::shared_ptr* cancellationSignal) { LOG(INFO) << "authenticate"; - if (cb_) { - cb_->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorCode */); - } - *return_val = SharedRefBase::make(cb_); + std::promise cancellationPromise; + auto cancFuture = cancellationPromise.get_future(); + + mThread->schedule( + Callable::from([this, keystoreOperationId, cancFuture = std::move(cancFuture)] { + mEngine->authenticateImpl(mCb.get(), keystoreOperationId, cancFuture); + })); + + *cancellationSignal = SharedRefBase::make(std::move(cancellationPromise)); return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus Session::detectInteraction( - std::shared_ptr* /*return_val*/) { + std::shared_ptr* cancellationSignal) { LOG(INFO) << "detectInteraction"; + std::promise cancellationPromise; + auto cancFuture = cancellationPromise.get_future(); + + mThread->schedule(Callable::from([this, cancFuture = std::move(cancFuture)] { + mEngine->detectInteractionImpl(mCb.get(), cancFuture); + })); + + *cancellationSignal = SharedRefBase::make(std::move(cancellationPromise)); return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus Session::enumerateEnrollments() { LOG(INFO) << "enumerateEnrollments"; - if (cb_) { - cb_->onEnrollmentsEnumerated(std::vector()); - } + mThread->schedule(Callable::from([this] { mEngine->enumerateEnrollmentsImpl(mCb.get()); })); return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Session::removeEnrollments(const std::vector& /*enrollmentIds*/) { +ndk::ScopedAStatus Session::removeEnrollments(const std::vector& enrollmentIds) { LOG(INFO) << "removeEnrollments"; - if (cb_) { - cb_->onEnrollmentsRemoved(std::vector()); - } + mThread->schedule(Callable::from( + [this, enrollmentIds] { mEngine->removeEnrollmentsImpl(mCb.get(), enrollmentIds); })); return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus Session::getFeatures() { LOG(INFO) << "getFeatures"; - if (cb_) { - // Must error out with UNABLE_TO_PROCESS when no faces are enrolled. - cb_->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorCode */); - } + mThread->schedule(Callable::from([this] { mEngine->getFeaturesImpl(mCb.get()); })); return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Session::setFeature(const keymaster::HardwareAuthToken& /*hat*/, - Feature /*feature*/, bool /*enabled*/) { +ndk::ScopedAStatus Session::setFeature(const keymaster::HardwareAuthToken& hat, Feature feature, + bool enabled) { LOG(INFO) << "setFeature"; + mThread->schedule(Callable::from([this, hat, feature, enabled] { + mEngine->setFeatureImpl(mCb.get(), hat, feature, enabled); + })); return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus Session::getAuthenticatorId() { LOG(INFO) << "getAuthenticatorId"; - if (cb_) { - cb_->onAuthenticatorIdRetrieved(0 /* authenticatorId */); - } + mThread->schedule(Callable::from([this] { mEngine->getAuthenticatorIdImpl(mCb.get()); })); return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus Session::invalidateAuthenticatorId() { LOG(INFO) << "invalidateAuthenticatorId"; - if (cb_) { - cb_->onAuthenticatorIdInvalidated(0); - } + mThread->schedule( + Callable::from([this] { mEngine->invalidateAuthenticatorIdImpl(mCb.get()); })); return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Session::resetLockout(const keymaster::HardwareAuthToken& /*hat*/) { +ndk::ScopedAStatus Session::resetLockout(const keymaster::HardwareAuthToken& hat) { LOG(INFO) << "resetLockout"; - if (cb_) { - cb_->onLockoutCleared(); - } + mThread->schedule(Callable::from([this, hat] { mEngine->resetLockoutImpl(mCb.get(), hat); })); return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus Session::close() { - if (cb_) { - cb_->onSessionClosed(); + if (mCb) { + mCb->onSessionClosed(); } return ndk::ScopedAStatus::ok(); } diff --git a/biometrics/face/aidl/default/Session.h b/biometrics/face/aidl/default/Session.h index 9db17d2df9..7ca6a1f4ff 100644 --- a/biometrics/face/aidl/default/Session.h +++ b/biometrics/face/aidl/default/Session.h @@ -21,6 +21,10 @@ #include #include +#include "FakeFaceEngine.h" +#include "thread/WorkerThread.h" +#include "util/CancellationSignal.h" + namespace aidl::android::hardware::biometrics::face { namespace common = aidl::android::hardware::biometrics::common; @@ -30,7 +34,7 @@ using aidl::android::hardware::common::NativeHandle; class Session : public BnSession { public: - explicit Session(std::shared_ptr cb); + explicit Session(std::unique_ptr engine, std::shared_ptr cb); ndk::ScopedAStatus generateChallenge() override; @@ -85,8 +89,11 @@ class Session : public BnSession { ndk::ScopedAStatus onContextChanged(const common::OperationContext& context) override; private: - std::shared_ptr cb_; + std::unique_ptr mEngine; + std::shared_ptr mCb; std::mt19937 mRandom; + std::unique_ptr mThread; + std::shared_ptr mCancellationSignal; }; } // namespace aidl::android::hardware::biometrics::face diff --git a/biometrics/face/aidl/default/api/android.hardware.biometrics.face.VirtualProps-current.txt b/biometrics/face/aidl/default/api/android.hardware.biometrics.face.VirtualProps-current.txt new file mode 100644 index 0000000000..95489205f6 --- /dev/null +++ b/biometrics/face/aidl/default/api/android.hardware.biometrics.face.VirtualProps-current.txt @@ -0,0 +1,98 @@ +props { + owner: Vendor + module: "android.face.virt.FaceHalProperties" + prop { + api_name: "authenticator_id" + type: Long + access: ReadWrite + prop_name: "vendor.face.virtual.authenticator_id" + } + prop { + api_name: "challenge" + type: Long + access: ReadWrite + prop_name: "vendor.face.virtual.challenge" + } + prop { + api_name: "enrollment_hit" + type: Integer + access: ReadWrite + prop_name: "vendor.face.virtual.enrollment_hit" + } + prop { + api_name: "enrollments" + type: IntegerList + access: ReadWrite + prop_name: "persist.vendor.face.virtual.enrollments" + } + prop { + api_name: "features" + type: IntegerList + access: ReadWrite + prop_name: "persist.vendor.face.virtual.features" + } + prop { + api_name: "lockout" + access: ReadWrite + prop_name: "vendor.face.virtual.lockout" + } + prop { + api_name: "next_enrollment" + type: String + access: ReadWrite + prop_name: "vendor.face.virtual.next_enrollment" + } + prop { + api_name: "operation_authenticate_duration" + type: Integer + access: ReadWrite + prop_name: "vendor.face.virtual.operation_authenticate_duration" + } + prop { + api_name: "operation_authenticate_fails" + access: ReadWrite + prop_name: "vendor.face.virtual.operation_authenticate_fails" + } + prop { + api_name: "operation_authenticate_latency" + type: Integer + access: ReadWrite + prop_name: "vendor.face.virtual.operation_authenticate_latency" + } + prop { + api_name: "operation_detect_interaction_fails" + access: ReadWrite + prop_name: "vendor.face.virtual.operation_detect_interaction_fails" + } + prop { + api_name: "operation_detect_interaction_latency" + type: Integer + access: ReadWrite + prop_name: "vendor.face.virtual.operation_detect_interaction_latency" + } + prop { + api_name: "operation_enroll_fails" + access: ReadWrite + prop_name: "vendor.face.virtual.operation_enroll_fails" + } + prop { + api_name: "operation_start_enroll_latency" + type: Integer + access: ReadWrite + prop_name: "vendor.face.virtual.operation_start_enroll_latency" + } + prop { + api_name: "strength" + type: String + access: ReadWrite + prop_name: "persist.vendor.face.virtual.strength" + enum_values: "convenience|weak|strong" + } + prop { + api_name: "type" + type: String + access: ReadWrite + prop_name: "persist.vendor.face.virtual.type" + enum_values: "IR|RGB" + } +} diff --git a/biometrics/face/aidl/default/face.sysprop b/biometrics/face/aidl/default/face.sysprop new file mode 100644 index 0000000000..6b0f37fec5 --- /dev/null +++ b/biometrics/face/aidl/default/face.sysprop @@ -0,0 +1,159 @@ +# face.sysprop +# module becomes static class (Java) / namespace (C++) for serving API +module: "android.face.virt.FaceHalProperties" +owner: Vendor + +# type of face sensor +prop { + prop_name: "persist.vendor.face.virtual.type" + type: String + scope: Public + access: ReadWrite + enum_values: "IR|RGB" + api_name: "type" +} + +# the strength of the sensor +prop { + prop_name: "persist.vendor.face.virtual.strength" + type: String + scope: Public + access: ReadWrite + enum_values: "convenience|weak|strong" + api_name: "strength" +} + +# ids of current enrollments +prop { + prop_name: "persist.vendor.face.virtual.enrollments" + type: IntegerList + scope: Public + access: ReadWrite + api_name: "enrollments" +} + +# List of features +prop { + prop_name: "persist.vendor.face.virtual.features" + type: IntegerList + scope: Public + access: ReadWrite + api_name: "features" +} + +# authenticate and detectInteraction will succeed with this +# enrollment id, when present, otherwise they will error +prop { + prop_name: "vendor.face.virtual.enrollment_hit" + type: Integer + scope: Public + access: ReadWrite + api_name: "enrollment_hit" +} + +# The initial latency for enrollment +prop { + prop_name: "vendor.face.virtual.operation_start_enroll_latency" + type: Integer + scope: Public + access: ReadWrite + api_name: "operation_start_enroll_latency" +} + +# the next enrollment in the format: +# ",::,..." +# for example: "0:1,0:100:1,1:200:1" indicating that bucket 0 took +# 50 milliseconds, bucket 1 took 100 milliseconds, bucket 2 took 200 milliseconds. +# Note that it is up to the configuration to determine how many buckets are required +# to complete an enrollment +prop { + prop_name: "vendor.face.virtual.next_enrollment" + type: String + scope: Public + access: ReadWrite + api_name: "next_enrollment" +} + +# value for getAuthenticatorId or 0 +prop { + prop_name: "vendor.face.virtual.authenticator_id" + type: Long + scope: Public + access: ReadWrite + api_name: "authenticator_id" +} + +# value for generateChallenge +prop { + prop_name: "vendor.face.virtual.challenge" + type: Long + scope: Public + access: ReadWrite + api_name: "challenge" +} + +# if locked out +prop { + prop_name: "vendor.face.virtual.lockout" + type: Boolean + scope: Public + access: ReadWrite + api_name: "lockout" +} + +# force all authenticate operations to fail +prop { + prop_name: "vendor.face.virtual.operation_authenticate_fails" + type: Boolean + scope: Public + access: ReadWrite + api_name: "operation_authenticate_fails" +} + +# force all detectInteraction operations to fail +prop { + prop_name: "vendor.face.virtual.operation_detect_interaction_fails" + type: Boolean + scope: Public + access: ReadWrite + api_name: "operation_detect_interaction_fails" +} + +# force all enroll operations to fail +prop { + prop_name: "vendor.face.virtual.operation_enroll_fails" + type: Boolean + scope: Public + access: ReadWrite + api_name: "operation_enroll_fails" +} + +# add a latency to authentication operations +# Note that this latency is the initial authentication latency that occurs before +# the HAL will send AcquiredInfo::START and AcquiredInfo::FIRST_FRAME_RECEIVED +prop { + prop_name: "vendor.face.virtual.operation_authenticate_latency" + type: Integer + scope: Public + access: ReadWrite + api_name: "operation_authenticate_latency" +} + +# add a latency to detectInteraction operations +prop { + prop_name: "vendor.face.virtual.operation_detect_interaction_latency" + type: Integer + scope: Public + access: ReadWrite + api_name: "operation_detect_interaction_latency" +} + +# millisecond duration for authenticate operations +# (waits for changes to enrollment_hit) +prop { + prop_name: "vendor.face.virtual.operation_authenticate_duration" + type: Integer + scope: Public + access: ReadWrite + api_name: "operation_authenticate_duration" +} diff --git a/biometrics/face/aidl/default/tests/FakeFaceEngineTest.cpp b/biometrics/face/aidl/default/tests/FakeFaceEngineTest.cpp new file mode 100644 index 0000000000..c8ad6b7dc3 --- /dev/null +++ b/biometrics/face/aidl/default/tests/FakeFaceEngineTest.cpp @@ -0,0 +1,383 @@ +/* + * 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. + */ + +#include +#include +#include + +#include +#include + +#include "FakeFaceEngine.h" + +using namespace ::android::face::virt; +using namespace ::aidl::android::hardware::biometrics::face; +using namespace ::aidl::android::hardware::keymaster; + +namespace aidl::android::hardware::biometrics::face { + +class TestSessionCallback : public BnSessionCallback { + public: + ndk::ScopedAStatus onChallengeGenerated(int64_t challenge) override { + mLastChallenge = challenge; + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onChallengeRevoked(int64_t challenge) override { + mLastChallengeRevoked = challenge; + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onError(Error error, int32_t) override { + mError = error; + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onEnrollmentProgress(int32_t enrollmentId, int32_t remaining) override { + if (remaining == 0) mLastEnrolled = enrollmentId; + return ndk::ScopedAStatus::ok(); + }; + + ::ndk::ScopedAStatus onAuthenticationSucceeded(int32_t enrollmentId, + const HardwareAuthToken&) override { + mLastAuthenticated = enrollmentId; + mAuthenticateFailed = false; + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onAuthenticationFailed() override { + mLastAuthenticated = 0; + mAuthenticateFailed = true; + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onInteractionDetected() override { + mInteractionDetectedCount++; + return ndk::ScopedAStatus::ok(); + }; + + ::ndk::ScopedAStatus onEnrollmentFrame(const EnrollmentFrame& frame) override { + mEnrollmentFrames.push_back(frame.data.vendorCode); + return ndk::ScopedAStatus::ok(); + } + + ::ndk::ScopedAStatus onEnrollmentsEnumerated( + const std::vector& enrollmentIds) override { + mLastEnrollmentsEnumerated = enrollmentIds; + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onEnrollmentsRemoved(const std::vector& enrollmentIds) override { + mLastEnrollmentRemoved = enrollmentIds; + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onAuthenticatorIdRetrieved(int64_t authenticatorId) override { + mLastAuthenticatorId = authenticatorId; + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onAuthenticatorIdInvalidated(int64_t authenticatorId) override { + mLastAuthenticatorId = authenticatorId; + mAuthenticatorIdInvalidated = true; + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onAuthenticationFrame(const AuthenticationFrame& /*authFrame*/) override { + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus onLockoutPermanent() override { + mLockoutPermanent = true; + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onLockoutTimed(int64_t /* timeout */) override { + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus onLockoutCleared() override { + mLockoutPermanent = false; + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus onSessionClosed() override { return ndk::ScopedAStatus::ok(); } + + ::ndk::ScopedAStatus onFeaturesRetrieved(const std::vector& features) override { + mFeatures = features; + return ndk::ScopedAStatus::ok(); + } + + ::ndk::ScopedAStatus onFeatureSet(Feature feature) override { + mLastFeatureSet = feature; + return ndk::ScopedAStatus::ok(); + } + + Error mError = Error::UNKNOWN; + int64_t mLastChallenge = -1; + int64_t mLastChallengeRevoked = -1; + int32_t mLastEnrolled = -1; + int32_t mLastAuthenticated = -1; + int64_t mLastAuthenticatorId = -1; + std::vector mLastEnrollmentsEnumerated; + std::vector mLastEnrollmentRemoved; + std::vector mFeatures; + Feature mLastFeatureSet; + std::vector mEnrollmentFrames; + bool mAuthenticateFailed = false; + bool mAuthenticatorIdInvalidated = false; + bool mLockoutPermanent = false; + int mInteractionDetectedCount = 0; +}; + +class FakeFaceEngineTest : public ::testing::Test { + protected: + void SetUp() override { + LOG(ERROR) << "JRM SETUP"; + mCallback = ndk::SharedRefBase::make(); + FaceHalProperties::enrollments({}); + FaceHalProperties::challenge({}); + FaceHalProperties::features({}); + FaceHalProperties::authenticator_id({}); + FaceHalProperties::strength(""); + } + + FakeFaceEngine mEngine; + std::shared_ptr mCallback; + std::promise mCancel; +}; + +TEST_F(FakeFaceEngineTest, one_eq_one) { + ASSERT_EQ(1, 1); +} + +TEST_F(FakeFaceEngineTest, GenerateChallenge) { + mEngine.generateChallengeImpl(mCallback.get()); + ASSERT_EQ(FaceHalProperties::challenge().value(), mCallback->mLastChallenge); +} + +TEST_F(FakeFaceEngineTest, RevokeChallenge) { + auto challenge = FaceHalProperties::challenge().value_or(10); + mEngine.revokeChallengeImpl(mCallback.get(), challenge); + ASSERT_FALSE(FaceHalProperties::challenge().has_value()); + ASSERT_EQ(challenge, mCallback->mLastChallengeRevoked); +} + +TEST_F(FakeFaceEngineTest, ResetLockout) { + FaceHalProperties::lockout(true); + mEngine.resetLockoutImpl(mCallback.get(), {}); + ASSERT_FALSE(mCallback->mLockoutPermanent); + ASSERT_FALSE(FaceHalProperties::lockout().value_or(true)); +} + +TEST_F(FakeFaceEngineTest, AuthenticatorId) { + FaceHalProperties::authenticator_id(50); + mEngine.getAuthenticatorIdImpl(mCallback.get()); + ASSERT_EQ(50, mCallback->mLastAuthenticatorId); + ASSERT_FALSE(mCallback->mAuthenticatorIdInvalidated); +} + +TEST_F(FakeFaceEngineTest, GetAuthenticatorIdWeakReturnsZero) { + FaceHalProperties::strength("weak"); + FaceHalProperties::authenticator_id(500); + mEngine.getAuthenticatorIdImpl(mCallback.get()); + ASSERT_EQ(0, mCallback->mLastAuthenticatorId); + ASSERT_FALSE(mCallback->mAuthenticatorIdInvalidated); +} + +TEST_F(FakeFaceEngineTest, AuthenticatorIdInvalidate) { + FaceHalProperties::authenticator_id(500); + mEngine.invalidateAuthenticatorIdImpl(mCallback.get()); + ASSERT_NE(500, FaceHalProperties::authenticator_id().value()); + ASSERT_TRUE(mCallback->mAuthenticatorIdInvalidated); +} + +TEST_F(FakeFaceEngineTest, Enroll) { + FaceHalProperties::next_enrollment("1,0:30:true,1:0:true,2:0:true,3:0:true,4:0:true"); + keymaster::HardwareAuthToken hat{.mac = {2, 4}}; + mEngine.enrollImpl(mCallback.get(), hat, {} /*enrollmentType*/, {} /*features*/, + mCancel.get_future()); + ASSERT_FALSE(FaceHalProperties::next_enrollment().has_value()); + ASSERT_EQ(1, FaceHalProperties::enrollments().size()); + ASSERT_EQ(1, FaceHalProperties::enrollments()[0].value()); + ASSERT_EQ(1, mCallback->mLastEnrolled); +} + +TEST_F(FakeFaceEngineTest, EnrollFails) { + FaceHalProperties::next_enrollment("1,0:30:true,1:0:true,2:0:true,3:0:true,4:0:false"); + keymaster::HardwareAuthToken hat{.mac = {2, 4}}; + mEngine.enrollImpl(mCallback.get(), hat, {} /*enrollmentType*/, {} /*features*/, + mCancel.get_future()); + ASSERT_FALSE(FaceHalProperties::next_enrollment().has_value()); + ASSERT_EQ(0, FaceHalProperties::enrollments().size()); +} + +TEST_F(FakeFaceEngineTest, EnrollCancel) { + FaceHalProperties::next_enrollment("1,0:30:true,1:0:true,2:0:true,3:0:true,4:0:false"); + keymaster::HardwareAuthToken hat{.mac = {2, 4}}; + mCancel.set_value(); + mEngine.enrollImpl(mCallback.get(), hat, {} /*enrollmentType*/, {} /*features*/, + mCancel.get_future()); + ASSERT_EQ(Error::CANCELED, mCallback->mError); + ASSERT_EQ(-1, mCallback->mLastEnrolled); + ASSERT_EQ(0, FaceHalProperties::enrollments().size()); + ASSERT_FALSE(FaceHalProperties::next_enrollment().has_value()); +} + +TEST_F(FakeFaceEngineTest, Authenticate) { + FaceHalProperties::enrollments({100}); + FaceHalProperties::enrollment_hit(100); + mEngine.authenticateImpl(mCallback.get(), 0 /* operationId*/, mCancel.get_future()); + + ASSERT_EQ(100, mCallback->mLastAuthenticated); + ASSERT_FALSE(mCallback->mAuthenticateFailed); +} + +TEST_F(FakeFaceEngineTest, AuthenticateCancel) { + FaceHalProperties::enrollments({100}); + FaceHalProperties::enrollment_hit(100); + mCancel.set_value(); + mEngine.authenticateImpl(mCallback.get(), 0 /* operationId*/, mCancel.get_future()); + ASSERT_EQ(Error::CANCELED, mCallback->mError); +} + +TEST_F(FakeFaceEngineTest, AuthenticateFailedForUnEnrolled) { + FaceHalProperties::enrollments({3}); + FaceHalProperties::enrollment_hit(100); + mEngine.authenticateImpl(mCallback.get(), 0 /* operationId*/, mCancel.get_future()); + ASSERT_EQ(Error::UNABLE_TO_PROCESS, mCallback->mError); + ASSERT_TRUE(mCallback->mAuthenticateFailed); +} + +TEST_F(FakeFaceEngineTest, DetectInteraction) { + FaceHalProperties::enrollments({100}); + FaceHalProperties::enrollment_hit(100); + ASSERT_EQ(0, mCallback->mInteractionDetectedCount); + mEngine.detectInteractionImpl(mCallback.get(), mCancel.get_future()); + ASSERT_EQ(1, mCallback->mInteractionDetectedCount); +} + +TEST_F(FakeFaceEngineTest, DetectInteractionCancel) { + FaceHalProperties::enrollments({100}); + FaceHalProperties::enrollment_hit(100); + mCancel.set_value(); + mEngine.detectInteractionImpl(mCallback.get(), mCancel.get_future()); + ASSERT_EQ(Error::CANCELED, mCallback->mError); +} + +TEST_F(FakeFaceEngineTest, GetFeatureEmpty) { + mEngine.getFeaturesImpl(mCallback.get()); + ASSERT_TRUE(mCallback->mFeatures.empty()); +} + +TEST_F(FakeFaceEngineTest, SetFeature) { + FaceHalProperties::enrollments({1}); + keymaster::HardwareAuthToken hat{.mac = {2, 4}}; + mEngine.setFeatureImpl(mCallback.get(), hat, Feature::REQUIRE_ATTENTION, true); + auto features = mCallback->mFeatures; + ASSERT_TRUE(features.empty()); + ASSERT_EQ(Feature::REQUIRE_ATTENTION, mCallback->mLastFeatureSet); + + mEngine.getFeaturesImpl(mCallback.get()); + features = mCallback->mFeatures; + ASSERT_FALSE(features.empty()); + ASSERT_NE(features.end(), + std::find(features.begin(), features.end(), Feature::REQUIRE_ATTENTION)); +} + +TEST_F(FakeFaceEngineTest, ToggleFeature) { + FaceHalProperties::enrollments({1}); + keymaster::HardwareAuthToken hat{.mac = {2, 4}}; + mEngine.setFeatureImpl(mCallback.get(), hat, Feature::REQUIRE_ATTENTION, true); + mEngine.getFeaturesImpl(mCallback.get()); + auto features = mCallback->mFeatures; + ASSERT_FALSE(features.empty()); + ASSERT_NE(features.end(), + std::find(features.begin(), features.end(), Feature::REQUIRE_ATTENTION)); + + mEngine.setFeatureImpl(mCallback.get(), hat, Feature::REQUIRE_ATTENTION, false); + mEngine.getFeaturesImpl(mCallback.get()); + features = mCallback->mFeatures; + ASSERT_TRUE(features.empty()); +} + +TEST_F(FakeFaceEngineTest, TurningOffNonExistentFeatureDoesNothing) { + FaceHalProperties::enrollments({1}); + keymaster::HardwareAuthToken hat{.mac = {2, 4}}; + mEngine.setFeatureImpl(mCallback.get(), hat, Feature::REQUIRE_ATTENTION, false); + mEngine.getFeaturesImpl(mCallback.get()); + auto features = mCallback->mFeatures; + ASSERT_TRUE(features.empty()); +} + +TEST_F(FakeFaceEngineTest, SetMultipleFeatures) { + FaceHalProperties::enrollments({1}); + keymaster::HardwareAuthToken hat{.mac = {2, 4}}; + mEngine.setFeatureImpl(mCallback.get(), hat, Feature::REQUIRE_ATTENTION, true); + mEngine.setFeatureImpl(mCallback.get(), hat, Feature::REQUIRE_DIVERSE_POSES, true); + mEngine.setFeatureImpl(mCallback.get(), hat, Feature::DEBUG, true); + mEngine.getFeaturesImpl(mCallback.get()); + auto features = mCallback->mFeatures; + ASSERT_EQ(3, features.size()); + ASSERT_NE(features.end(), + std::find(features.begin(), features.end(), Feature::REQUIRE_ATTENTION)); + ASSERT_NE(features.end(), + std::find(features.begin(), features.end(), Feature::REQUIRE_DIVERSE_POSES)); + ASSERT_NE(features.end(), std::find(features.begin(), features.end(), Feature::DEBUG)); +} + +TEST_F(FakeFaceEngineTest, SetMultipleFeaturesAndTurnOffSome) { + FaceHalProperties::enrollments({1}); + keymaster::HardwareAuthToken hat{.mac = {2, 4}}; + mEngine.setFeatureImpl(mCallback.get(), hat, Feature::REQUIRE_ATTENTION, true); + mEngine.setFeatureImpl(mCallback.get(), hat, Feature::REQUIRE_DIVERSE_POSES, true); + mEngine.setFeatureImpl(mCallback.get(), hat, Feature::DEBUG, true); + mEngine.setFeatureImpl(mCallback.get(), hat, Feature::DEBUG, false); + mEngine.getFeaturesImpl(mCallback.get()); + auto features = mCallback->mFeatures; + ASSERT_EQ(2, features.size()); + ASSERT_NE(features.end(), + std::find(features.begin(), features.end(), Feature::REQUIRE_ATTENTION)); + ASSERT_NE(features.end(), + std::find(features.begin(), features.end(), Feature::REQUIRE_DIVERSE_POSES)); + ASSERT_EQ(features.end(), std::find(features.begin(), features.end(), Feature::DEBUG)); +} + +TEST_F(FakeFaceEngineTest, Enumerate) { + FaceHalProperties::enrollments({120, 3}); + mEngine.enumerateEnrollmentsImpl(mCallback.get()); + auto enrolls = mCallback->mLastEnrollmentsEnumerated; + ASSERT_FALSE(enrolls.empty()); + ASSERT_NE(enrolls.end(), std::find(enrolls.begin(), enrolls.end(), 120)); + ASSERT_NE(enrolls.end(), std::find(enrolls.begin(), enrolls.end(), 3)); +} + +TEST_F(FakeFaceEngineTest, RemoveEnrollments) { + FaceHalProperties::enrollments({120, 3, 100}); + mEngine.removeEnrollmentsImpl(mCallback.get(), {120, 100}); + mEngine.enumerateEnrollmentsImpl(mCallback.get()); + auto enrolls = mCallback->mLastEnrollmentsEnumerated; + ASSERT_FALSE(enrolls.empty()); + ASSERT_EQ(enrolls.end(), std::find(enrolls.begin(), enrolls.end(), 120)); + ASSERT_NE(enrolls.end(), std::find(enrolls.begin(), enrolls.end(), 3)); + ASSERT_EQ(enrolls.end(), std::find(enrolls.begin(), enrolls.end(), 100)); +} + +TEST_F(FakeFaceEngineTest, ResetLockoutWithAuth) { + FaceHalProperties::lockout(true); + FaceHalProperties::enrollments({33}); + FaceHalProperties::enrollment_hit(33); + auto cancelFuture = mCancel.get_future(); + mEngine.authenticateImpl(mCallback.get(), 0 /* operationId*/, cancelFuture); + + ASSERT_TRUE(mCallback->mLockoutPermanent); + + mEngine.resetLockoutImpl(mCallback.get(), {} /* hat */); + ASSERT_FALSE(mCallback->mLockoutPermanent); + FaceHalProperties::enrollment_hit(33); + mEngine.authenticateImpl(mCallback.get(), 0 /* operationId*/, cancelFuture); + ASSERT_EQ(33, mCallback->mLastAuthenticated); + ASSERT_FALSE(mCallback->mAuthenticateFailed); +} + +} // namespace aidl::android::hardware::biometrics::face \ No newline at end of file diff --git a/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp b/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp index d0250af3bf..138caa0fe2 100644 --- a/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp +++ b/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp @@ -19,51 +19,11 @@ #include #include -#include -#include -#include #include "util/CancellationSignal.h" - -#define SLEEP_MS(x) \ - if (x > 0) std::this_thread::sleep_for(std::chrono::milliseconds(x)) -#define BEGIN_OP(x) \ - do { \ - LOG(INFO) << __func__; \ - SLEEP_MS(x); \ - } while (0) -#define IS_TRUE(x) ((x == "1") || (x == "true")) - -// This is for non-test situations, such as casual cuttlefish users, that don't -// set an explicit value. -// Some operations (i.e. enroll, authenticate) will be executed in tight loops -// by parts of the UI or fail if there is no latency. For example, the -// fingerprint settings page constantly runs auth and the enrollment UI uses a -// cancel/restart cycle that requires some latency while the activities change. -#define DEFAULT_LATENCY 2000 +#include "util/Util.h" using namespace ::android::fingerprint::virt; -using namespace ::aidl::android::hardware::biometrics::fingerprint; - -int64_t getSystemNanoTime() { - timespec now; - clock_gettime(CLOCK_MONOTONIC, &now); - return now.tv_sec * 1000000000LL + now.tv_nsec; -} - -bool hasElapsed(int64_t start, int64_t durationMillis) { - auto now = getSystemNanoTime(); - if (now < start) return true; - if (durationMillis <= 0) return true; - return ((now - start) / 1000000LL) > durationMillis; -} - -std::vector split(const std::string& str, const std::string& sep) { - std::regex regex(sep); - std::vector parts(std::sregex_token_iterator(str.begin(), str.end(), regex, -1), - std::sregex_token_iterator()); - return parts; -} namespace aidl::android::hardware::biometrics::fingerprint { @@ -101,14 +61,14 @@ void FakeFingerprintEngine::enrollImpl(ISessionCallback* cb, // format is ":,,...: auto nextEnroll = FingerprintHalProperties::next_enrollment().value_or(""); - auto parts = split(nextEnroll, ":"); + auto parts = Util::split(nextEnroll, ":"); if (parts.size() != 3) { LOG(ERROR) << "Fail: invalid next_enrollment"; cb->onError(Error::VENDOR, 0 /* vendorError */); return; } auto enrollmentId = std::stoi(parts[0]); - auto progress = split(parts[1], ","); + auto progress = Util::split(parts[1], ","); for (size_t i = 0; i < progress.size(); i++) { auto left = progress.size() - i - 1; SLEEP_MS(std::stoi(progress[i])); @@ -141,7 +101,7 @@ void FakeFingerprintEngine::authenticateImpl(ISessionCallback* cb, int64_t /* op const std::future& cancel) { BEGIN_OP(FingerprintHalProperties::operation_authenticate_latency().value_or(DEFAULT_LATENCY)); - auto now = getSystemNanoTime(); + auto now = Util::getSystemNanoTime(); int64_t duration = FingerprintHalProperties::operation_authenticate_duration().value_or(0); do { if (FingerprintHalProperties::operation_authenticate_fails().value_or(false)) { @@ -172,7 +132,7 @@ void FakeFingerprintEngine::authenticateImpl(ISessionCallback* cb, int64_t /* op } SLEEP_MS(100); - } while (!hasElapsed(now, duration)); + } while (!Util::hasElapsed(now, duration)); LOG(ERROR) << "Fail: not enrolled"; cb->onAuthenticationFailed(); From bc62e71f6c89dd8f04ade945073c83901772b7bf Mon Sep 17 00:00:00 2001 From: Ramya Manoharan Date: Wed, 11 May 2022 11:17:27 +0000 Subject: [PATCH 079/998] Updated comment regarding the TP - Message Reference TP - Message Refenence value in pdu must not be modified by modem Test: refactoring CL. Existing unit tests still pass. Bug: 228299168 Change-Id: Ibf197f26eae610031dc06cd8336c2744dc1ae6c0 --- radio/aidl/android/hardware/radio/messaging/GsmSmsMessage.aidl | 1 + 1 file changed, 1 insertion(+) diff --git a/radio/aidl/android/hardware/radio/messaging/GsmSmsMessage.aidl b/radio/aidl/android/hardware/radio/messaging/GsmSmsMessage.aidl index ee62d957f4..b256c9a8bc 100644 --- a/radio/aidl/android/hardware/radio/messaging/GsmSmsMessage.aidl +++ b/radio/aidl/android/hardware/radio/messaging/GsmSmsMessage.aidl @@ -27,6 +27,7 @@ parcelable GsmSmsMessage { /** * SMS in PDU format as an ASCII hex string less the SMSC address. * TP-Layer-Length is be "strlen(pdu)/2 + * TP - MessageRef field of pdu must not be modified by modem */ String pdu; } From 1d782bd6a20eb8e0bd9836e92d264c9ae03096f2 Mon Sep 17 00:00:00 2001 From: Aaron Tsai Date: Thu, 21 Apr 2022 13:42:44 +0000 Subject: [PATCH 080/998] Support IRadioNetwork V2 Bug: 227110409 Bug: 232704878 Test: build pass Change-Id: I703715db367ac660ef8c326b5171275a08ae06aa --- compatibility_matrices/compatibility_matrix.current.xml | 2 +- radio/aidl/Android.bp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 1ff40b90b0..14b943b498 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -568,7 +568,7 @@ android.hardware.radio.network - 1 + 1-2 IRadioNetwork slot1 diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp index ab4309ef81..efbd8c84a7 100644 --- a/radio/aidl/Android.bp +++ b/radio/aidl/Android.bp @@ -155,6 +155,7 @@ aidl_interface { name: "android.hardware.radio.network", vendor_available: true, host_supported: true, + vndk_use_version: "2", srcs: ["android/hardware/radio/network/*.aidl"], stability: "vintf", imports: ["android.hardware.radio-V1"], From 18d7585ea3cc8d95318d3e6eed5e876cf79d4e8a Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Mon, 2 May 2022 22:52:13 +0000 Subject: [PATCH 081/998] audio HAL: Support for external device connections Add methods 'IModule.connect/disconnectExternalDevice' which inform audio HAL about connection / disconnection of an external non-attached device. Add method 'getAudioRoutesForPort' to retrieve only routes that include the specified port. Update the behavior of 'getAudioPorts' and 'getAudioRoutes' indicating that the result may change due to instantiation of new device ports for connected external devices. Clarify behavior of 'IModule.setAudioPortConfig' that it can not work with device ports with no profiles. Add debug flags structure 'ModuleDebug' and method 'IModule.setModuleDebug' to control the debugging aspects. VTS tests use these flags to test HAL behavior which would otherwise require human intervention. Update the default implementation and VTS for the AIDL changes. Bug: 205884982 Test: atest VtsHalAudioCoreTargetTest Change-Id: Iad5f7009e283729206f88b6278c8992f7f8a92a2 --- audio/aidl/Android.bp | 3 +- .../android/hardware/audio/core/IModule.aidl | 4 + .../hardware/audio/core/ModuleDebug.aidl | 38 ++ .../android/hardware/audio/core/IModule.aidl | 165 ++++- .../hardware/audio/core/ModuleDebug.aidl | 38 ++ audio/aidl/default/Android.bp | 2 + audio/aidl/default/Configuration.cpp | 115 +++- audio/aidl/default/Module.cpp | 167 ++++- .../default/include/core-impl/Configuration.h | 4 + audio/aidl/default/include/core-impl/Module.h | 13 + audio/aidl/default/include/core-impl/utils.h | 4 +- audio/aidl/vts/ModuleConfig.cpp | 49 +- audio/aidl/vts/ModuleConfig.h | 19 +- audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp | 575 +++++++++++++++--- 14 files changed, 1038 insertions(+), 158 deletions(-) create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ModuleDebug.aidl create mode 100644 audio/aidl/android/hardware/audio/core/ModuleDebug.aidl diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index 30e88b5ba2..dd2b4e02d4 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -78,6 +78,7 @@ aidl_interface { "android/hardware/audio/core/IModule.aidl", "android/hardware/audio/core/IStreamIn.aidl", "android/hardware/audio/core/IStreamOut.aidl", + "android/hardware/audio/core/ModuleDebug.aidl", ], imports: [ "android.hardware.audio.common-V1", @@ -94,6 +95,4 @@ aidl_interface { }, }, }, - versions: [ - ], } diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl index 33e8290608..f8bc2c79c6 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl @@ -34,11 +34,15 @@ package android.hardware.audio.core; @VintfStability interface IModule { + void setModuleDebug(in android.hardware.audio.core.ModuleDebug debug); + android.media.audio.common.AudioPort connectExternalDevice(in android.media.audio.common.AudioPort templateIdAndAdditionalData); + void disconnectExternalDevice(int portId); android.hardware.audio.core.AudioPatch[] getAudioPatches(); android.media.audio.common.AudioPort getAudioPort(int portId); android.media.audio.common.AudioPortConfig[] getAudioPortConfigs(); android.media.audio.common.AudioPort[] getAudioPorts(); android.hardware.audio.core.AudioRoute[] getAudioRoutes(); + android.hardware.audio.core.AudioRoute[] getAudioRoutesForAudioPort(int portId); android.hardware.audio.core.IStreamIn openInputStream(int portConfigId, in android.hardware.audio.common.SinkMetadata sinkMetadata); android.hardware.audio.core.IStreamOut openOutputStream(int portConfigId, in android.hardware.audio.common.SourceMetadata sourceMetadata, in @nullable android.media.audio.common.AudioOffloadInfo offloadInfo); android.hardware.audio.core.AudioPatch setAudioPatch(in android.hardware.audio.core.AudioPatch requested); diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ModuleDebug.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ModuleDebug.aidl new file mode 100644 index 0000000000..80ee185bc8 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ModuleDebug.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable ModuleDebug { + boolean simulateDeviceConnections; +} diff --git a/audio/aidl/android/hardware/audio/core/IModule.aidl b/audio/aidl/android/hardware/audio/core/IModule.aidl index d47ea3cf4d..f406cd8ee0 100644 --- a/audio/aidl/android/hardware/audio/core/IModule.aidl +++ b/audio/aidl/android/hardware/audio/core/IModule.aidl @@ -22,6 +22,7 @@ import android.hardware.audio.core.AudioPatch; import android.hardware.audio.core.AudioRoute; import android.hardware.audio.core.IStreamIn; import android.hardware.audio.core.IStreamOut; +import android.hardware.audio.core.ModuleDebug; import android.media.audio.common.AudioOffloadInfo; import android.media.audio.common.AudioPort; import android.media.audio.common.AudioPortConfig; @@ -43,6 +44,116 @@ import android.media.audio.common.AudioPortConfig; */ @VintfStability interface IModule { + /** + * Sets debugging configuration for the HAL module. This method is only + * called during xTS testing and is intended for validating the aspects of + * the HAL module behavior that would otherwise require human intervention. + * + * The HAL module must throw an error if there is an attempt to change + * the debug behavior for the aspect which is currently in use. + * + * @param debug The debug options. + * @throws EX_ILLEGAL_STATE If the flag(s) being changed affect functionality + * which is currently in use. + */ + void setModuleDebug(in ModuleDebug debug); + + /** + * Set a device port of an external device into connected state. + * + * This method is used to inform the HAL module that an external device has + * been connected to a device port selected using the 'id' field of the + * input AudioPort parameter. This device port must have dynamic profiles + * (an empty list of profiles). This port is further referenced to as "port + * template" because it acts as a template for creating a new instance of a + * "connected" device port which gets returned from this method. + * + * The input AudioPort parameter may contain any additional data obtained by + * the system side from other subsystems. The nature of data depends on the + * type of the connection. For example, for point-to-multipoint external + * device connections, the input parameter may contain the address of the + * connected external device. Another example is EDID information for HDMI + * connections (ExtraAudioDescriptor), which can be provided by the HDMI-CEC + * HAL module. + * + * It is the responsibility of the HAL module to query audio profiles + * supported by the connected device and return them as part of the returned + * AudioPort instance. In the case when the HAL is unable to query the + * external device, an error must be thrown. + * + * Thus, the returned audio port instance is the result of combining the + * following information: + * - a unique port ID generated by the HAL module; + * - static information from the port template; + * - list of audio profiles supported by the connected device; + * - additional data from the input AudioPort parameter. + * + * The HAL module must also update the list of audio routes to include the + * ID of the instantiated connected device port. Normally, the connected + * port allows the same routing as the port template. + * + * Also see notes on 'ModuleDebug.simulateDeviceConnections'. + * + * The following protocol is used by HAL module client for handling + * connection of an external device: + * 1. Obtain the list of device ports and their IDs via 'getAudioPorts' + * method. Select the appropriate port template using + * AudioDeviceDescription ('ext.device' field of AudioPort). + * 2. Combine the ID of the port template with any additional data and call + * 'connectExternalDevice'. The HAL module returns a new instance of + * AudioPort created using the rules explained above. Both + * 'getAudioPort' and 'getAudioPorts' methods will be returning the same + * information for this port until disconnection. + * 3. Configure the connected port with one of supported profiles using + * 'setAudioPortConfig'. + * 4. Query the list of AudioRoutes for the new AudioPort using + * 'getAudioRoutesForAudioPort' or 'getAudioRoutes' methods. + * + * External devices are distinguished by the connection type and device + * address. Calling this method multiple times to inform about connection of + * the same external device without disconnecting it first is an error. + * + * The HAL module must perform validation of the input parameter and throw + * an error if it is lacking required information, for example, when no + * device address is specified for a point-to-multipoint external device + * connection. + * + * Handling of a disconnect is done in a reverse order: + * 1. Reset port configuration using the 'resetAudioPortConfig' method. + * 2. Release the connected device port by calling the 'disconnectExternalDevice' + * method. This also removes the audio routes associated with this + * device port. + * + * @return New instance of an audio port for the connected external device. + * @param templateIdAndAdditionalData Specifies port template ID and any + * additional data. + * @throws EX_ILLEGAL_ARGUMENT In the following cases: + * - If the template port can not be found by the ID. + * - If the template is not a device port, or + * it does not have dynamic profiles. + * - If the input parameter is lacking required + * information. + * @throws EX_ILLEGAL_STATE In the following cases: + * - If the HAL module is unable to query audio profiles. + * - If the external device has already been connected. + */ + AudioPort connectExternalDevice(in AudioPort templateIdAndAdditionalData); + + /** + * Set a device port of a an external device into disconnected state. + * + * This method is used to inform the HAL module that an external device has + * been disconnected. The 'portId' must be of a connected device port + * instance previously instantiated using the 'connectExternalDevice' + * method. + * + * @throws EX_ILLEGAL_ARGUMENT In the following cases: + * - If the port can not be found by the ID. + * - If this is not a connected device port. + * @throws EX_ILLEGAL_STATE If the port has active configurations. + */ + void disconnectExternalDevice(int portId); + /** * Return all audio patches of this module. * @@ -57,12 +168,10 @@ interface IModule { * Return the current state of the audio port. * * Using the port ID provided on input, returns the current state of the - * audio port. For device port representing a connection to some external - * device, e.g. over HDMI or USB, currently supported audio profiles and - * extra audio descriptors may change. - * - * For all other audio ports it must be the same configuration as returned - * for this port ID by 'getAudioPorts'. + * audio port. The values of the AudioPort structure must be the same as + * currently returned by the 'getAudioPorts' method. The 'getAudioPort' + * method is provided to reduce overhead in the case when the client needs + * to check the state of one port only. * * @return The current state of an audio port. * @param portId The ID of the audio port. @@ -87,32 +196,44 @@ interface IModule { AudioPortConfig[] getAudioPortConfigs(); /** - * Return all audio ports provided by this module. + * Return the current state of all audio ports provided by this module. * - * Returns a list of all mix ports and device ports provided by this - * module. Each returned port must have a unique ID within this module - * ('AudioPort.id' field). The returned list must not change during - * the lifetime of the IModule instance. For audio ports with dynamic - * profiles (changing depending on external devices being connected - * to the system) an empty list of profiles must be returned. The list - * of currently supported audio profiles is obtained from 'getAudioPort' - * method. + * Returns a list of all mix ports and device ports provided by this HAL + * module, reflecting their current states. Each returned port must have a + * unique ID within this module ('AudioPort.id' field). The list also + * includes "connected" ports created using 'connectExternalDevice' method. * * @return The list of audio ports. */ AudioPort[] getAudioPorts(); /** - * Return all audio routes of this module. + * Return all current audio routes of this module. * - * Returns a list of audio routes, that is, allowed connections between - * audio ports. The returned list must not change during the lifetime of the - * IModule instance. + * Returns the current list of audio routes, that is, allowed connections + * between audio ports. The list can change when new device audio ports + * get created as a result of connecting or disconnecting of external + * devices. * * @return The list of audio routes. */ AudioRoute[] getAudioRoutes(); + /** + * Return audio routes related to the specified audio port. + * + * Returns the list of audio routes that include the specified port ID + * as a source or as a sink. The returned list is a subset of the result + * returned by the 'getAudioRoutes' method, filtered by the port ID. + * An empty list can be returned, indicating that the audio port can not + * be used for creating audio patches. + * + * @return The list of audio routes. + * @param portId The ID of the audio port. + * @throws EX_ILLEGAL_ARGUMENT If the port can not be found by the ID. + */ + AudioRoute[] getAudioRoutesForAudioPort(int portId); + /** * Open an input stream using an existing audio mix port configuration. * @@ -230,6 +351,10 @@ interface IModule { * parameter. The framework can then set the suggested configuration on a * subsequent retry call to this method. * + * Device ports with dynamic audio profiles (an empty list of profiles) + * can not be used with this method. The list of profiles must be filled in + * as a result of calling 'connectExternalDevice' method. + * * @return Whether the requested configuration has been applied. * @param requested Requested audio port configuration. * @param suggested Same as requested configuration, if it was applied. @@ -241,7 +366,7 @@ interface IModule { * - If the port can not be found by the port ID. * - If it is not possible to generate a suggested port * configuration, for example, if the port only has dynamic - * profiles and they are currently empty. + * profiles. */ boolean setAudioPortConfig(in AudioPortConfig requested, out AudioPortConfig suggested); diff --git a/audio/aidl/android/hardware/audio/core/ModuleDebug.aidl b/audio/aidl/android/hardware/audio/core/ModuleDebug.aidl new file mode 100644 index 0000000000..858a9bd841 --- /dev/null +++ b/audio/aidl/android/hardware/audio/core/ModuleDebug.aidl @@ -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. + */ + +package android.hardware.audio.core; + +/** + * This structure contains flags used for enabling various debugging aspects + * in a HAL module. By default, all debugging aspects are turned off. They + * can be enabled during xTS tests for functionality that, for example, would + * otherwise require human intervention (e.g. connection of external devices). + */ +@JavaDerive(equals=true, toString=true) +@VintfStability +parcelable ModuleDebug { + /** + * When set to 'true', HAL module must simulate connection of external + * devices. An external device becomes 'connected' after a call to + * IModule.connectExternalDevice, simulation of connection requires: + * - provision of at least one non-dynamic device port profile on + * connection (as if it was retrieved from a connected device); + * - simulating successful application of port configurations for reported + * profiles. + */ + boolean simulateDeviceConnections; +} diff --git a/audio/aidl/default/Android.bp b/audio/aidl/default/Android.bp index 0a6fe60c39..4728a89cdd 100644 --- a/audio/aidl/default/Android.bp +++ b/audio/aidl/default/Android.bp @@ -13,6 +13,7 @@ cc_library_static { shared_libs: [ "libbase", "libbinder_ndk", + "android.media.audio.common.types-V1-ndk", "android.hardware.audio.core-V1-ndk", ], export_include_dirs: ["include"], @@ -36,6 +37,7 @@ cc_binary { shared_libs: [ "libbase", "libbinder_ndk", + "android.media.audio.common.types-V1-ndk", "android.hardware.audio.core-V1-ndk", ], static_libs: [ diff --git a/audio/aidl/default/Configuration.cpp b/audio/aidl/default/Configuration.cpp index 1104caadcf..19d0b3c93f 100644 --- a/audio/aidl/default/Configuration.cpp +++ b/audio/aidl/default/Configuration.cpp @@ -16,14 +16,15 @@ #include #include +#include #include #include #include -#include "aidl/android/media/audio/common/AudioFormatDescription.h" #include "core-impl/Configuration.h" using aidl::android::media::audio::common::AudioChannelLayout; +using aidl::android::media::audio::common::AudioDeviceDescription; using aidl::android::media::audio::common::AudioDeviceType; using aidl::android::media::audio::common::AudioFormatDescription; using aidl::android::media::audio::common::AudioFormatType; @@ -54,9 +55,11 @@ static AudioProfile createProfile(PcmType pcmType, const std::vector& c return profile; } -static AudioPortExt createDeviceExt(AudioDeviceType devType, int32_t flags) { +static AudioPortExt createDeviceExt(AudioDeviceType devType, int32_t flags, + std::string connection = "") { AudioPortDeviceExt deviceExt; deviceExt.device.type.type = devType; + deviceExt.device.type.connection = std::move(connection); deviceExt.flags = flags; return AudioPortExt::make(deviceExt); } @@ -102,8 +105,64 @@ static AudioRoute createRoute(const std::vector& sources, int32_t sink) return route; } +// Configuration: +// +// Device ports: +// * "Null", OUT_SPEAKER, default +// - no profiles specified +// * "Loopback Out", OUT_SUBMIX +// - profile PCM 24-bit; STEREO; 48000 +// * "USB Out", OUT_DEVICE, CONNECTION_USB +// - no profiles specified +// * "Zero", IN_MICROPHONE, default +// - no profiles specified +// * "Loopback In", IN_SUBMIX +// - profile PCM 24-bit; STEREO; 48000 +// * "USB In", IN_DEVICE, CONNECTION_USB +// - no profiles specified +// +// Mix ports: +// * "primary output", PRIMARY, 1 max open, 1 max active stream +// - profile PCM 16-bit; MONO, STEREO; 44100, 48000 +// - profile PCM 24-bit; MONO, STEREO; 44100, 48000 +// * "loopback output", stream count unlimited +// - profile PCM 24-bit; STEREO; 48000 +// * "primary input", 2 max open, 2 max active streams +// - profile PCM 16-bit; MONO, STEREO, FRONT_BACK; +// 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 +// - profile PCM 24-bit; MONO, STEREO, FRONT_BACK; +// 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 +// * "loopback input", stream count unlimited +// - profile PCM 24-bit; STEREO; 48000 +// +// Routes: +// "primary out" -> "Null" +// "primary out" -> "USB Out" +// "loopback out" -> "Loopback Out" +// "Zero", "USB In" -> "primary input" +// "Loopback In" -> "loopback input" +// +// Initial port configs: +// * "Null" device port: PCM 24-bit; STEREO; 48000 +// * "Zero" device port: PCM 24-bit; MONO; 48000 +// +// Profiles for device port connected state: +// * USB Out": +// - profile PCM 16-bit; MONO, STEREO; 44100, 48000 +// - profile PCM 24-bit; MONO, STEREO; 44100, 48000 +// * USB In": +// - profile PCM 16-bit; MONO, STEREO; 44100, 48000 +// - profile PCM 24-bit; MONO, STEREO; 44100, 48000 +// Configuration& getNullPrimaryConfiguration() { static Configuration configuration = []() { + const std::vector standardPcmAudioProfiles = { + createProfile(PcmType::INT_16_BIT, + {AudioChannelLayout::LAYOUT_MONO, AudioChannelLayout::LAYOUT_STEREO}, + {44100, 48000}), + createProfile(PcmType::INT_24_BIT, + {AudioChannelLayout::LAYOUT_MONO, AudioChannelLayout::LAYOUT_STEREO}, + {44100, 48000})}; Configuration c; AudioPort nullOutDevice = @@ -111,27 +170,19 @@ Configuration& getNullPrimaryConfiguration() { createDeviceExt(AudioDeviceType::OUT_SPEAKER, 1 << AudioPortDeviceExt::FLAG_INDEX_DEFAULT_DEVICE)); c.ports.push_back(nullOutDevice); - - AudioPort primaryOutMix = createPort(c.nextPortId++, "primary output", - 1 << static_cast(AudioOutputFlags::PRIMARY), - false, createPortMixExt(1, 1)); - primaryOutMix.profiles.push_back( - createProfile(PcmType::INT_16_BIT, - {AudioChannelLayout::LAYOUT_MONO, AudioChannelLayout::LAYOUT_STEREO}, - {44100, 48000})); - primaryOutMix.profiles.push_back( - createProfile(PcmType::INT_24_BIT, - {AudioChannelLayout::LAYOUT_MONO, AudioChannelLayout::LAYOUT_STEREO}, - {44100, 48000})); - c.ports.push_back(primaryOutMix); - - c.routes.push_back(createRoute({primaryOutMix.id}, nullOutDevice.id)); - c.initialConfigs.push_back( createPortConfig(nullOutDevice.id, nullOutDevice.id, PcmType::INT_24_BIT, AudioChannelLayout::LAYOUT_STEREO, 48000, 0, false, createDeviceExt(AudioDeviceType::OUT_SPEAKER, 0))); + AudioPort primaryOutMix = createPort(c.nextPortId++, "primary output", + 1 << static_cast(AudioOutputFlags::PRIMARY), + false, createPortMixExt(1, 1)); + primaryOutMix.profiles.insert(primaryOutMix.profiles.begin(), + standardPcmAudioProfiles.begin(), + standardPcmAudioProfiles.end()); + c.ports.push_back(primaryOutMix); + AudioPort loopOutDevice = createPort(c.nextPortId++, "Loopback Out", 0, false, createDeviceExt(AudioDeviceType::OUT_SUBMIX, 0)); loopOutDevice.profiles.push_back( @@ -144,13 +195,22 @@ Configuration& getNullPrimaryConfiguration() { createProfile(PcmType::INT_24_BIT, {AudioChannelLayout::LAYOUT_STEREO}, {48000})); c.ports.push_back(loopOutMix); - c.routes.push_back(createRoute({loopOutMix.id}, loopOutDevice.id)); + AudioPort usbOutDevice = + createPort(c.nextPortId++, "USB Out", 0, false, + createDeviceExt(AudioDeviceType::OUT_DEVICE, 0, + AudioDeviceDescription::CONNECTION_USB)); + c.ports.push_back(usbOutDevice); + c.connectedProfiles[usbOutDevice.id] = standardPcmAudioProfiles; AudioPort zeroInDevice = createPort(c.nextPortId++, "Zero", 0, true, createDeviceExt(AudioDeviceType::IN_MICROPHONE, 1 << AudioPortDeviceExt::FLAG_INDEX_DEFAULT_DEVICE)); c.ports.push_back(zeroInDevice); + c.initialConfigs.push_back( + createPortConfig(zeroInDevice.id, zeroInDevice.id, PcmType::INT_24_BIT, + AudioChannelLayout::LAYOUT_MONO, 48000, 0, true, + createDeviceExt(AudioDeviceType::IN_MICROPHONE, 0))); AudioPort primaryInMix = createPort(c.nextPortId++, "primary input", 0, true, createPortMixExt(2, 2)); @@ -166,13 +226,6 @@ Configuration& getNullPrimaryConfiguration() { {8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000})); c.ports.push_back(primaryInMix); - c.routes.push_back(createRoute({zeroInDevice.id}, primaryInMix.id)); - - c.initialConfigs.push_back( - createPortConfig(zeroInDevice.id, zeroInDevice.id, PcmType::INT_24_BIT, - AudioChannelLayout::LAYOUT_MONO, 48000, 0, true, - createDeviceExt(AudioDeviceType::IN_MICROPHONE, 0))); - AudioPort loopInDevice = createPort(c.nextPortId++, "Loopback In", 0, true, createDeviceExt(AudioDeviceType::IN_SUBMIX, 0)); loopInDevice.profiles.push_back( @@ -185,6 +238,16 @@ Configuration& getNullPrimaryConfiguration() { createProfile(PcmType::INT_24_BIT, {AudioChannelLayout::LAYOUT_STEREO}, {48000})); c.ports.push_back(loopInMix); + AudioPort usbInDevice = createPort(c.nextPortId++, "USB In", 0, true, + createDeviceExt(AudioDeviceType::IN_DEVICE, 0, + AudioDeviceDescription::CONNECTION_USB)); + c.ports.push_back(usbInDevice); + c.connectedProfiles[usbInDevice.id] = standardPcmAudioProfiles; + + c.routes.push_back(createRoute({primaryOutMix.id}, nullOutDevice.id)); + c.routes.push_back(createRoute({primaryOutMix.id}, usbOutDevice.id)); + c.routes.push_back(createRoute({loopOutMix.id}, loopOutDevice.id)); + c.routes.push_back(createRoute({zeroInDevice.id, usbInDevice.id}, primaryInMix.id)); c.routes.push_back(createRoute({loopInDevice.id}, loopInMix.id)); c.portConfigs.insert(c.portConfigs.end(), c.initialConfigs.begin(), c.initialConfigs.end()); diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp index e0a68a5fcd..961ee84517 100644 --- a/audio/aidl/default/Module.cpp +++ b/audio/aidl/default/Module.cpp @@ -18,7 +18,6 @@ #include #define LOG_TAG "AHAL_Module" -#define LOG_NDEBUG 0 #include #include @@ -81,6 +80,7 @@ bool findAudioProfile(const AudioPort& port, const AudioFormatDescription& forma } return false; } + } // namespace void Module::cleanUpPatch(int32_t patchId) { @@ -135,6 +135,154 @@ void Module::registerPatch(const AudioPatch& patch) { do_insert(patch.sinkPortConfigIds); } +ndk::ScopedAStatus Module::setModuleDebug( + const ::aidl::android::hardware::audio::core::ModuleDebug& in_debug) { + LOG(DEBUG) << __func__ << ": old flags:" << mDebug.toString() + << ", new flags: " << in_debug.toString(); + if (mDebug.simulateDeviceConnections != in_debug.simulateDeviceConnections && + !mConnectedDevicePorts.empty()) { + LOG(ERROR) << __func__ << ": attempting to change device connections simulation " + << "while having external devices connected"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } + mDebug = in_debug; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Module::connectExternalDevice(const AudioPort& in_templateIdAndAdditionalData, + AudioPort* _aidl_return) { + const int32_t templateId = in_templateIdAndAdditionalData.id; + auto& ports = getConfig().ports; + AudioPort connectedPort; + { // Scope the template port so that we don't accidentally modify it. + auto templateIt = findById(ports, templateId); + if (templateIt == ports.end()) { + LOG(ERROR) << __func__ << ": port id " << templateId << " not found"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (templateIt->ext.getTag() != AudioPortExt::Tag::device) { + LOG(ERROR) << __func__ << ": port id " << templateId << " is not a device port"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (!templateIt->profiles.empty()) { + LOG(ERROR) << __func__ << ": port id " << templateId + << " does not have dynamic profiles"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + auto& templateDevicePort = templateIt->ext.get(); + if (templateDevicePort.device.type.connection.empty()) { + LOG(ERROR) << __func__ << ": port id " << templateId << " is permanently attached"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + // Postpone id allocation until we ensure that there are no client errors. + connectedPort = *templateIt; + connectedPort.extraAudioDescriptors = in_templateIdAndAdditionalData.extraAudioDescriptors; + const auto& inputDevicePort = + in_templateIdAndAdditionalData.ext.get(); + auto& connectedDevicePort = connectedPort.ext.get(); + connectedDevicePort.device.address = inputDevicePort.device.address; + LOG(DEBUG) << __func__ << ": device port " << connectedPort.id << " device set to " + << connectedDevicePort.device.toString(); + // Check if there is already a connected port with for the same external device. + for (auto connectedPortId : mConnectedDevicePorts) { + auto connectedPortIt = findById(ports, connectedPortId); + if (connectedPortIt->ext.get().device == + connectedDevicePort.device) { + LOG(ERROR) << __func__ << ": device " << connectedDevicePort.device.toString() + << " is already connected at the device port id " << connectedPortId; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } + } + } + + if (!mDebug.simulateDeviceConnections) { + // In a real HAL here we would attempt querying the profiles from the device. + LOG(ERROR) << __func__ << ": failed to query supported device profiles"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } + + connectedPort.id = ++getConfig().nextPortId; + mConnectedDevicePorts.insert(connectedPort.id); + LOG(DEBUG) << __func__ << ": template port " << templateId << " external device connected, " + << "connected port ID " << connectedPort.id; + auto& connectedProfiles = getConfig().connectedProfiles; + if (auto connectedProfilesIt = connectedProfiles.find(templateId); + connectedProfilesIt != connectedProfiles.end()) { + connectedPort.profiles = connectedProfilesIt->second; + } + ports.push_back(connectedPort); + *_aidl_return = std::move(connectedPort); + + std::vector newRoutes; + auto& routes = getConfig().routes; + for (auto& r : routes) { + if (r.sinkPortId == templateId) { + AudioRoute newRoute; + newRoute.sourcePortIds = r.sourcePortIds; + newRoute.sinkPortId = connectedPort.id; + newRoute.isExclusive = r.isExclusive; + newRoutes.push_back(std::move(newRoute)); + } else { + auto& srcs = r.sourcePortIds; + if (std::find(srcs.begin(), srcs.end(), templateId) != srcs.end()) { + srcs.push_back(connectedPort.id); + } + } + } + routes.insert(routes.end(), newRoutes.begin(), newRoutes.end()); + + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Module::disconnectExternalDevice(int32_t in_portId) { + auto& ports = getConfig().ports; + auto portIt = findById(ports, in_portId); + if (portIt == ports.end()) { + LOG(ERROR) << __func__ << ": port id " << in_portId << " not found"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (portIt->ext.getTag() != AudioPortExt::Tag::device) { + LOG(ERROR) << __func__ << ": port id " << in_portId << " is not a device port"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (mConnectedDevicePorts.count(in_portId) == 0) { + LOG(ERROR) << __func__ << ": port id " << in_portId << " is not a connected device port"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + auto& configs = getConfig().portConfigs; + auto& initials = getConfig().initialConfigs; + auto configIt = std::find_if(configs.begin(), configs.end(), [&](const auto& config) { + if (config.portId == in_portId) { + // Check if the configuration was provided by the client. + const auto& initialIt = findById(initials, config.id); + return initialIt == initials.end() || config != *initialIt; + } + return false; + }); + if (configIt != configs.end()) { + LOG(ERROR) << __func__ << ": port id " << in_portId << " has a non-default config with id " + << configIt->id; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } + ports.erase(portIt); + mConnectedDevicePorts.erase(in_portId); + LOG(DEBUG) << __func__ << ": connected device port " << in_portId << " released"; + + auto& routes = getConfig().routes; + for (auto routesIt = routes.begin(); routesIt != routes.end();) { + if (routesIt->sinkPortId == in_portId) { + routesIt = routes.erase(routesIt); + } else { + // Note: the list of sourcePortIds can't become empty because there must + // be the id of the template port in the route. + erase_if(routesIt->sourcePortIds, [in_portId](auto src) { return src == in_portId; }); + ++routesIt; + } + } + + return ndk::ScopedAStatus::ok(); +} + ndk::ScopedAStatus Module::getAudioPatches(std::vector* _aidl_return) { *_aidl_return = getConfig().patches; LOG(DEBUG) << __func__ << ": returning " << _aidl_return->size() << " patches"; @@ -171,6 +319,23 @@ ndk::ScopedAStatus Module::getAudioRoutes(std::vector* _aidl_return) return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus Module::getAudioRoutesForAudioPort(int32_t in_portId, + std::vector* _aidl_return) { + auto& ports = getConfig().ports; + if (auto portIt = findById(ports, in_portId); portIt == ports.end()) { + LOG(ERROR) << __func__ << ": port id " << in_portId << " not found"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + auto& routes = getConfig().routes; + std::copy_if(routes.begin(), routes.end(), std::back_inserter(*_aidl_return), + [&](const auto& r) { + const auto& srcs = r.sourcePortIds; + return r.sinkPortId == in_portId || + std::find(srcs.begin(), srcs.end(), in_portId) != srcs.end(); + }); + return ndk::ScopedAStatus::ok(); +} + ndk::ScopedAStatus Module::openInputStream(int32_t in_portConfigId, const SinkMetadata& in_sinkMetadata, std::shared_ptr* _aidl_return) { diff --git a/audio/aidl/default/include/core-impl/Configuration.h b/audio/aidl/default/include/core-impl/Configuration.h index 17e342d80a..d5cd30b248 100644 --- a/audio/aidl/default/include/core-impl/Configuration.h +++ b/audio/aidl/default/include/core-impl/Configuration.h @@ -16,6 +16,7 @@ #pragma once +#include #include #include @@ -29,6 +30,9 @@ struct Configuration { std::vector<::aidl::android::media::audio::common::AudioPort> ports; std::vector<::aidl::android::media::audio::common::AudioPortConfig> portConfigs; std::vector<::aidl::android::media::audio::common::AudioPortConfig> initialConfigs; + // Port id -> List of profiles to use when the device port state is set to 'connected'. + std::map> + connectedProfiles; std::vector routes; std::vector patches; int32_t nextPortId = 1; diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h index 359626cc22..81a02baabb 100644 --- a/audio/aidl/default/include/core-impl/Module.h +++ b/audio/aidl/default/include/core-impl/Module.h @@ -18,6 +18,7 @@ #include #include +#include #include @@ -27,6 +28,12 @@ namespace aidl::android::hardware::audio::core { class Module : public BnModule { + ndk::ScopedAStatus setModuleDebug( + const ::aidl::android::hardware::audio::core::ModuleDebug& in_debug) override; + ndk::ScopedAStatus connectExternalDevice( + const ::aidl::android::media::audio::common::AudioPort& in_templateIdAndAdditionalData, + ::aidl::android::media::audio::common::AudioPort* _aidl_return) override; + ndk::ScopedAStatus disconnectExternalDevice(int32_t in_portId) override; ndk::ScopedAStatus getAudioPatches(std::vector* _aidl_return) override; ndk::ScopedAStatus getAudioPort( int32_t in_portId, @@ -37,6 +44,9 @@ class Module : public BnModule { ndk::ScopedAStatus getAudioPorts( std::vector<::aidl::android::media::audio::common::AudioPort>* _aidl_return) override; ndk::ScopedAStatus getAudioRoutes(std::vector* _aidl_return) override; + ndk::ScopedAStatus getAudioRoutesForAudioPort( + int32_t in_portId, + std::vector<::aidl::android::hardware::audio::core::AudioRoute>* _aidl_return) override; ndk::ScopedAStatus openInputStream( int32_t in_portConfigId, const ::aidl::android::hardware::audio::common::SinkMetadata& in_sinkMetadata, @@ -63,6 +73,9 @@ class Module : public BnModule { void registerPatch(const AudioPatch& patch); std::unique_ptr mConfig; + ModuleDebug mDebug; + // ids of ports created at runtime via 'connectExternalDevice'. + std::set mConnectedDevicePorts; Streams mStreams; // Maps port ids and port config ids to patch ids. // Multimap because both ports and configs can be used by multiple patches. diff --git a/audio/aidl/default/include/core-impl/utils.h b/audio/aidl/default/include/core-impl/utils.h index 7101012639..9d06f08679 100644 --- a/audio/aidl/default/include/core-impl/utils.h +++ b/audio/aidl/default/include/core-impl/utils.h @@ -38,11 +38,11 @@ auto erase_all(C& c, const V& keys) { return oldSize - c.size(); } -// Erase all the elements in the map that satisfy the provided predicate. +// Erase all the elements in the container that satisfy the provided predicate. template auto erase_if(C& c, P pred) { auto oldSize = c.size(); - for (auto it = c.begin(), last = c.end(); it != last;) { + for (auto it = c.begin(); it != c.end();) { if (pred(*it)) { it = c.erase(it); } else { diff --git a/audio/aidl/vts/ModuleConfig.cpp b/audio/aidl/vts/ModuleConfig.cpp index 3faa39ab4f..3f8d0888aa 100644 --- a/audio/aidl/vts/ModuleConfig.cpp +++ b/audio/aidl/vts/ModuleConfig.cpp @@ -46,14 +46,16 @@ ModuleConfig::ModuleConfig(IModule* module) { for (const auto& port : mPorts) { if (port.ext.getTag() != AudioPortExt::Tag::device) continue; const auto& devicePort = port.ext.get(); - const bool isInput = port.flags.getTag() == AudioIoFlags::Tag::input; if (devicePort.device.type.connection.empty()) { + const bool isInput = port.flags.getTag() == AudioIoFlags::Tag::input; // Permanently attached device. if (isInput) { mAttachedSourceDevicePorts.insert(port.id); } else { mAttachedSinkDevicePorts.insert(port.id); } + } else if (port.profiles.empty()) { + mExternalDevicePorts.insert(port.id); } } if (!mStatus.isOk()) return; @@ -62,6 +64,22 @@ ModuleConfig::ModuleConfig(IModule* module) { mStatus = module->getAudioPortConfigs(&mInitialConfigs); } +std::vector ModuleConfig::getAttachedDevicePorts() const { + std::vector result; + std::copy_if(mPorts.begin(), mPorts.end(), std::back_inserter(result), [&](const auto& port) { + return mAttachedSinkDevicePorts.count(port.id) != 0 || + mAttachedSourceDevicePorts.count(port.id) != 0; + }); + return result; +} + +std::vector ModuleConfig::getExternalDevicePorts() const { + std::vector result; + std::copy_if(mPorts.begin(), mPorts.end(), std::back_inserter(result), + [&](const auto& port) { return mExternalDevicePorts.count(port.id) != 0; }); + return result; +} + std::vector ModuleConfig::getInputMixPorts() const { std::vector result; std::copy_if(mPorts.begin(), mPorts.end(), std::back_inserter(result), [](const auto& port) { @@ -229,6 +247,23 @@ std::vector ModuleConfig::getRoutableSrcSinkGroups(b return result; } +std::string ModuleConfig::toString() const { + std::string result; + result.append("Ports: "); + result.append(android::internal::ToString(mPorts)); + result.append("Initial configs: "); + result.append(android::internal::ToString(mInitialConfigs)); + result.append("Attached sink device ports: "); + result.append(android::internal::ToString(mAttachedSinkDevicePorts)); + result.append("Attached source device ports: "); + result.append(android::internal::ToString(mAttachedSourceDevicePorts)); + result.append("External device ports: "); + result.append(android::internal::ToString(mExternalDevicePorts)); + result.append("Routes: "); + result.append(android::internal::ToString(mRoutes)); + return result; +} + static std::vector combineAudioConfigs(const AudioPort& port, const AudioProfile& profile) { std::vector configs; @@ -319,10 +354,14 @@ std::vector ModuleConfig::generateAudioDevicePortConfigs( if (singleProfile && !result.empty()) return result; } if (resultSizeBefore == result.size()) { - AudioPortConfig empty; - empty.portId = devicePort.id; - empty.ext = devicePort.ext; - result.push_back(empty); + std::copy_if(mInitialConfigs.begin(), mInitialConfigs.end(), std::back_inserter(result), + [&](const auto& config) { return config.portId == devicePort.id; }); + if (resultSizeBefore == result.size()) { + AudioPortConfig empty; + empty.portId = devicePort.id; + empty.ext = devicePort.ext; + result.push_back(empty); + } } if (singleProfile) return result; } diff --git a/audio/aidl/vts/ModuleConfig.h b/audio/aidl/vts/ModuleConfig.h index 2e86b97cf5..0e2738b306 100644 --- a/audio/aidl/vts/ModuleConfig.h +++ b/audio/aidl/vts/ModuleConfig.h @@ -37,6 +37,8 @@ class ModuleConfig { android::binder::Status getStatus() const { return mStatus; } std::string getError() const { return mStatus.toString8().c_str(); } + std::vector getAttachedDevicePorts() const; + std::vector getExternalDevicePorts() const; std::vector getInputMixPorts() const; std::vector getOutputMixPorts() const; std::vector getMixPorts(bool isInput) const { @@ -59,6 +61,10 @@ class ModuleConfig { std::optional getRoutableSrcSinkPair(bool isInput) const; std::vector getRoutableSrcSinkGroups(bool isInput) const; + std::vector + getPortConfigsForAttachedDevicePorts() const { + return generateAudioDevicePortConfigs(getAttachedDevicePorts(), false); + } std::vector getPortConfigsForMixPorts() const { auto inputs = generateInputAudioMixPortConfigs(getInputMixPorts(), false); auto outputs = generateOutputAudioMixPortConfigs(getOutputMixPorts(), false); @@ -98,15 +104,18 @@ class ModuleConfig { } } + std::vector getPortConfigsForDevicePort( + const android::media::audio::common::AudioPort& port) const { + return generateAudioDevicePortConfigs({port}, false); + } android::media::audio::common::AudioPortConfig getSingleConfigForDevicePort( const android::media::audio::common::AudioPort& port) const { - for (const auto& config : mInitialConfigs) { - if (config.portId == port.id) return config; - } const auto config = generateAudioDevicePortConfigs({port}, true); return *config.begin(); } + std::string toString() const; + private: std::vector generateInputAudioMixPortConfigs( const std::vector& ports, @@ -117,7 +126,8 @@ class ModuleConfig { // Unlike MixPorts, the generator for DevicePorts always returns a non-empty // vector for a non-empty input port list. If there are no profiles in the - // port, a vector with an empty config is returned. + // port, its initial configs are looked up, if there are none, + // then an empty config is used, assuming further negotiation via setAudioPortConfig. std::vector generateAudioDevicePortConfigs( const std::vector& ports, bool singleProfile) const; @@ -127,5 +137,6 @@ class ModuleConfig { std::vector mInitialConfigs; std::set mAttachedSinkDevicePorts; std::set mAttachedSourceDevicePorts; + std::set mExternalDevicePorts; std::vector mRoutes; }; diff --git a/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp index cadeb0c50e..824ac8d3db 100644 --- a/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp @@ -22,6 +22,9 @@ #include #include +#define LOG_TAG "VtsHalAudioCore" +#include + #include #include #include @@ -45,9 +48,12 @@ using android::hardware::audio::core::AudioRoute; using android::hardware::audio::core::IModule; using android::hardware::audio::core::IStreamIn; using android::hardware::audio::core::IStreamOut; +using android::hardware::audio::core::ModuleDebug; using android::media::audio::common::AudioContentType; using android::media::audio::common::AudioDevice; +using android::media::audio::common::AudioDeviceAddress; using android::media::audio::common::AudioDeviceType; +using android::media::audio::common::AudioFormatType; using android::media::audio::common::AudioIoFlags; using android::media::audio::common::AudioOutputFlags; using android::media::audio::common::AudioPort; @@ -63,7 +69,7 @@ auto findById(std::vector& v, int32_t id) { } template -std::vector getNonExistentIds(const C& allIds) { +std::vector GetNonExistentIds(const C& allIds) { if (allIds.empty()) { return std::vector{-1, 0, 1}; } @@ -73,6 +79,12 @@ std::vector getNonExistentIds(const C& allIds) { return nonExistentIds; } +AudioDeviceAddress GenerateUniqueDeviceAddress() { + static int nextId = 1; + // TODO: Use connection-specific ID. + return AudioDeviceAddress::make(std::to_string(++nextId)); +} + struct AidlDeathRecipient : IBinder::DeathRecipient { std::mutex mutex; std::condition_variable condition; @@ -107,70 +119,28 @@ constexpr IsInput::operator bool() const { return false; } -class AudioCoreModule : public testing::TestWithParam { +class WithDebugFlags { public: - void SetUp() override { ASSERT_NO_FATAL_FAILURE(ConnectToService()); } - - void ConnectToService() { - module = android::waitForDeclaredService(String16(GetParam().c_str())); - ASSERT_NE(module, nullptr); - } - - void RestartService() { - ASSERT_NE(module, nullptr); - moduleConfig.reset(); - deathHandler = sp::make(); - ASSERT_EQ(NO_ERROR, IModule::asBinder(module)->linkToDeath(deathHandler)); - ASSERT_TRUE(base::SetProperty("sys.audio.restart.hal", "1")); - EXPECT_TRUE(deathHandler->waitForFired(3000)); - deathHandler = nullptr; - ASSERT_NO_FATAL_FAILURE(ConnectToService()); - } - - template - void GetAllEntityIds(std::set* entityIds, - Status (IModule::*getter)(std::vector*), - const std::string& errorMessage) { - std::vector entities; - { - Status status = (module.get()->*getter)(&entities); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; - } - std::transform(entities.begin(), entities.end(), - std::inserter(*entityIds, entityIds->begin()), - [](const auto& entity) { return entity.id; }); - EXPECT_EQ(entities.size(), entityIds->size()) << errorMessage; - } - - void GetAllPatchIds(std::set* patchIds) { - return GetAllEntityIds( - patchIds, &IModule::getAudioPatches, - "IDs of audio patches returned by IModule.getAudioPatches are not unique"); - } - - void GetAllPortIds(std::set* portIds) { - return GetAllEntityIds( - portIds, &IModule::getAudioPorts, - "IDs of audio ports returned by IModule.getAudioPorts are not unique"); - } - - void GetAllPortConfigIds(std::set* portConfigIds) { - return GetAllEntityIds( - portConfigIds, &IModule::getAudioPortConfigs, - "IDs of audio port configs returned by IModule.getAudioPortConfigs are not unique"); - } - - void SetUpModuleConfig() { - if (moduleConfig == nullptr) { - moduleConfig = std::make_unique(module.get()); - ASSERT_EQ(Status::EX_NONE, moduleConfig->getStatus().exceptionCode()) - << "ModuleConfig init error: " << moduleConfig->getError(); + WithDebugFlags() {} + explicit WithDebugFlags(const ModuleDebug& initial) : mInitial(initial), mFlags(initial) {} + explicit WithDebugFlags(const WithDebugFlags& initial) + : mInitial(initial.mFlags), mFlags(initial.mFlags) {} + ~WithDebugFlags() { + if (mModule != nullptr) { + Status status = mModule->setModuleDebug(mInitial); + EXPECT_EQ(Status::EX_NONE, status.exceptionCode()) << status; } } + void SetUp(IModule* module) { + Status status = module->setModuleDebug(mFlags); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + } + ModuleDebug& flags() { return mFlags; } - sp module; - sp deathHandler; - std::unique_ptr moduleConfig; + private: + ModuleDebug mInitial; + ModuleDebug mFlags; + IModule* mModule = nullptr; }; // For consistency, WithAudioPortConfig can start both with a non-existent @@ -226,6 +196,147 @@ class WithAudioPortConfig { AudioPortConfig mConfig; }; +class AudioCoreModule : public testing::TestWithParam { + public: + void SetUp() override { + ASSERT_NO_FATAL_FAILURE(ConnectToService()); + debug.flags().simulateDeviceConnections = true; + ASSERT_NO_FATAL_FAILURE(debug.SetUp(module.get())); + } + + void TearDown() override { + if (module != nullptr) { + Status status = module->setModuleDebug(ModuleDebug{}); + EXPECT_EQ(Status::EX_NONE, status.exceptionCode()) + << status << " returned when resetting debug flags"; + } + } + + void ConnectToService() { + module = android::waitForDeclaredService(String16(GetParam().c_str())); + ASSERT_NE(module, nullptr); + } + + void RestartService() { + ASSERT_NE(module, nullptr); + moduleConfig.reset(); + deathHandler = sp::make(); + ASSERT_EQ(NO_ERROR, IModule::asBinder(module)->linkToDeath(deathHandler)); + ASSERT_TRUE(base::SetProperty("sys.audio.restart.hal", "1")); + EXPECT_TRUE(deathHandler->waitForFired(3000)); + deathHandler = nullptr; + ASSERT_NO_FATAL_FAILURE(ConnectToService()); + } + + void ApplyEveryConfig(const std::vector& configs) { + for (const auto& config : configs) { + ASSERT_NE(0, config.portId); + WithAudioPortConfig portConfig(config); + ASSERT_NO_FATAL_FAILURE(portConfig.SetUp(module.get())); // calls setAudioPortConfig + EXPECT_EQ(config.portId, portConfig.get().portId); + std::vector retrievedPortConfigs; + Status status = module->getAudioPortConfigs(&retrievedPortConfigs); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + const int32_t portConfigId = portConfig.getId(); + auto configIt = std::find_if( + retrievedPortConfigs.begin(), retrievedPortConfigs.end(), + [&portConfigId](const auto& retrConf) { return retrConf.id == portConfigId; }); + EXPECT_NE(configIt, retrievedPortConfigs.end()) + << "Port config id returned by setAudioPortConfig: " << portConfigId + << " is not found in the list returned by getAudioPortConfigs"; + if (configIt != retrievedPortConfigs.end()) { + EXPECT_EQ(portConfig.get(), *configIt) + << "Applied port config returned by setAudioPortConfig: " + << portConfig.get().toString() + << " is not the same as retrieved via getAudioPortConfigs: " + << configIt->toString(); + } + } + } + + template + void GetAllEntityIds(std::set* entityIds, + Status (IModule::*getter)(std::vector*), + const std::string& errorMessage) { + std::vector entities; + { + Status status = (module.get()->*getter)(&entities); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + } + std::transform(entities.begin(), entities.end(), + std::inserter(*entityIds, entityIds->begin()), + [](const auto& entity) { return entity.id; }); + EXPECT_EQ(entities.size(), entityIds->size()) << errorMessage; + } + + void GetAllPatchIds(std::set* patchIds) { + return GetAllEntityIds( + patchIds, &IModule::getAudioPatches, + "IDs of audio patches returned by IModule.getAudioPatches are not unique"); + } + + void GetAllPortIds(std::set* portIds) { + return GetAllEntityIds( + portIds, &IModule::getAudioPorts, + "IDs of audio ports returned by IModule.getAudioPorts are not unique"); + } + + void GetAllPortConfigIds(std::set* portConfigIds) { + return GetAllEntityIds( + portConfigIds, &IModule::getAudioPortConfigs, + "IDs of audio port configs returned by IModule.getAudioPortConfigs are not unique"); + } + + void SetUpModuleConfig() { + if (moduleConfig == nullptr) { + moduleConfig = std::make_unique(module.get()); + ASSERT_EQ(Status::EX_NONE, moduleConfig->getStatus().exceptionCode()) + << "ModuleConfig init error: " << moduleConfig->getError(); + } + } + + sp module; + sp deathHandler; + std::unique_ptr moduleConfig; + WithDebugFlags debug; +}; + +class WithDevicePortConnectedState { + public: + explicit WithDevicePortConnectedState(const AudioPort& idAndData) : mIdAndData(idAndData) {} + WithDevicePortConnectedState(const AudioPort& id, const AudioDeviceAddress& address) + : mIdAndData(setAudioPortAddress(id, address)) {} + ~WithDevicePortConnectedState() { + if (mModule != nullptr) { + Status status = mModule->disconnectExternalDevice(getId()); + EXPECT_EQ(Status::EX_NONE, status.exceptionCode()) + << status << " returned when disconnecting device port ID " << getId(); + } + } + void SetUp(IModule* module) { + Status status = module->connectExternalDevice(mIdAndData, &mConnectedPort); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) + << status << " returned when connecting device port ID & data " + << mIdAndData.toString(); + ASSERT_NE(mIdAndData.id, getId()) + << "ID of the connected port must not be the same as the ID of the template port"; + mModule = module; + } + int32_t getId() const { return mConnectedPort.id; } + const AudioPort& get() { return mConnectedPort; } + + private: + static AudioPort setAudioPortAddress(const AudioPort& id, const AudioDeviceAddress& address) { + AudioPort result = id; + result.ext.get().device.address = address; + return result; + } + + const AudioPort mIdAndData; + IModule* mModule = nullptr; + AudioPort mConnectedPort; +}; + template class WithStream { public: @@ -332,7 +443,7 @@ TEST_P(AudioCoreModule, PortIdsAreUnique) { ASSERT_NO_FATAL_FAILURE(GetAllPortIds(&portIds)); } -TEST_P(AudioCoreModule, GetAudioPortsIsStatic) { +TEST_P(AudioCoreModule, GetAudioPortsIsStable) { std::vector ports1; { Status status = module->getAudioPorts(&ports1); @@ -344,13 +455,13 @@ TEST_P(AudioCoreModule, GetAudioPortsIsStatic) { ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; } ASSERT_EQ(ports1.size(), ports2.size()) - << "Sizes of audio port arrays do not match across calls to getAudioPorts"; + << "Sizes of audio port arrays do not match across consequent calls to getAudioPorts"; std::sort(ports1.begin(), ports1.end()); std::sort(ports2.begin(), ports2.end()); EXPECT_EQ(ports1, ports2); } -TEST_P(AudioCoreModule, GetAudioRoutesIsStatic) { +TEST_P(AudioCoreModule, GetAudioRoutesIsStable) { std::vector routes1; { Status status = module->getAudioRoutes(&routes1); @@ -362,7 +473,7 @@ TEST_P(AudioCoreModule, GetAudioRoutesIsStatic) { ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; } ASSERT_EQ(routes1.size(), routes2.size()) - << "Sizes of audio route arrays do not match across calls to getAudioRoutes"; + << "Sizes of audio route arrays do not match across consequent calls to getAudioRoutes"; std::sort(routes1.begin(), routes1.end()); std::sort(routes2.begin(), routes2.end()); EXPECT_EQ(routes1, routes2); @@ -401,6 +512,32 @@ TEST_P(AudioCoreModule, GetAudioRoutesPortIdsAreValid) { } } +TEST_P(AudioCoreModule, GetAudioRoutesForAudioPort) { + std::set portIds; + ASSERT_NO_FATAL_FAILURE(GetAllPortIds(&portIds)); + if (portIds.empty()) { + GTEST_SKIP() << "No ports in the module."; + } + for (const auto portId : portIds) { + std::vector routes; + Status status = module->getAudioRoutesForAudioPort(portId, &routes); + EXPECT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + for (const auto& r : routes) { + if (r.sinkPortId != portId) { + const auto& srcs = r.sourcePortIds; + EXPECT_TRUE(std::find(srcs.begin(), srcs.end(), portId) != srcs.end()) + << " port ID " << portId << " does not used by the route " << r.toString(); + } + } + } + for (const auto portId : GetNonExistentIds(portIds)) { + std::vector routes; + Status status = module->getAudioRoutesForAudioPort(portId, &routes); + EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + << status << " returned for port ID " << portId; + } +} + TEST_P(AudioCoreModule, CheckDevicePorts) { std::vector ports; { @@ -486,7 +623,7 @@ TEST_P(AudioCoreModule, GetAudioPort) { EXPECT_EQ(Status::EX_NONE, status.exceptionCode()) << status; EXPECT_EQ(portId, port.id); } - for (const auto portId : getNonExistentIds(portIds)) { + for (const auto portId : GetNonExistentIds(portIds)) { AudioPort port; Status status = module->getAudioPort(portId, &port); EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) @@ -494,10 +631,59 @@ TEST_P(AudioCoreModule, GetAudioPort) { } } +// Verify that HAL module reports for a connected device port at least one non-dynamic profile, +// that is, a profile with actual supported configuration. +// Note: This test relies on simulation of external device connections by the HAL module. +TEST_P(AudioCoreModule, GetAudioPortWithExternalDevices) { + ASSERT_NO_FATAL_FAILURE(SetUpModuleConfig()); + std::vector ports = moduleConfig->getExternalDevicePorts(); + if (ports.empty()) { + GTEST_SKIP() << "No external devices in the module."; + } + for (const auto& port : ports) { + AudioPort portWithData = port; + portWithData.ext.get().device.address = + GenerateUniqueDeviceAddress(); + WithDevicePortConnectedState portConnected(portWithData); + ASSERT_NO_FATAL_FAILURE(portConnected.SetUp(module.get())); + const int32_t connectedPortId = portConnected.getId(); + ASSERT_NE(portWithData.id, connectedPortId); + ASSERT_EQ(portWithData.ext.getTag(), portConnected.get().ext.getTag()); + EXPECT_EQ(portWithData.ext.get().device, + portConnected.get().ext.get().device); + // Verify that 'getAudioPort' and 'getAudioPorts' return the same connected port. + AudioPort connectedPort; + Status status = module->getAudioPort(connectedPortId, &connectedPort); + EXPECT_EQ(Status::EX_NONE, status.exceptionCode()) + << status << " returned for getAudioPort port ID " << connectedPortId; + EXPECT_EQ(portConnected.get(), connectedPort); + const auto& portProfiles = connectedPort.profiles; + EXPECT_NE(0, portProfiles.size()) + << "Connected port has no profiles: " << connectedPort.toString(); + const auto dynamicProfileIt = + std::find_if(portProfiles.begin(), portProfiles.end(), [](const auto& profile) { + return profile.format.type == AudioFormatType::DEFAULT; + }); + EXPECT_EQ(portProfiles.end(), dynamicProfileIt) << "Connected port contains dynamic " + << "profiles: " << connectedPort.toString(); + + std::vector allPorts; + { + Status status = module->getAudioPorts(&allPorts); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + } + const auto allPortsIt = findById(allPorts, connectedPortId); + EXPECT_NE(allPorts.end(), allPortsIt); + if (allPortsIt != allPorts.end()) { + EXPECT_EQ(portConnected.get(), *allPortsIt); + } + } +} + TEST_P(AudioCoreModule, OpenStreamInvalidPortConfigId) { std::set portConfigIds; ASSERT_NO_FATAL_FAILURE(GetAllPortConfigIds(&portConfigIds)); - for (const auto portConfigId : getNonExistentIds(portConfigIds)) { + for (const auto portConfigId : GetNonExistentIds(portConfigIds)) { { sp stream; Status status = module->openInputStream(portConfigId, {}, &stream); @@ -537,7 +723,7 @@ TEST_P(AudioCoreModule, PortConfigPortIdsAreValid) { TEST_P(AudioCoreModule, ResetAudioPortConfigInvalidId) { std::set portConfigIds; ASSERT_NO_FATAL_FAILURE(GetAllPortConfigIds(&portConfigIds)); - for (const auto portConfigId : getNonExistentIds(portConfigIds)) { + for (const auto portConfigId : GetNonExistentIds(portConfigIds)) { Status status = module->resetAudioPortConfig(portConfigId); EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) << status << " returned for port config ID " << portConfigId; @@ -608,39 +794,35 @@ TEST_P(AudioCoreModule, SetAudioPortConfigSuggestedConfig) { EXPECT_EQ(suggestedConfig.flags.value(), appliedConfig.flags.value()); } +TEST_P(AudioCoreModule, SetAllAttachedDevicePortConfigs) { + ASSERT_NO_FATAL_FAILURE(SetUpModuleConfig()); + ASSERT_NO_FATAL_FAILURE(ApplyEveryConfig(moduleConfig->getPortConfigsForAttachedDevicePorts())); +} + +// Note: This test relies on simulation of external device connections by the HAL module. +TEST_P(AudioCoreModule, SetAllExternalDevicePortConfigs) { + ASSERT_NO_FATAL_FAILURE(SetUpModuleConfig()); + std::vector ports = moduleConfig->getExternalDevicePorts(); + if (ports.empty()) { + GTEST_SKIP() << "No external devices in the module."; + } + for (const auto& port : ports) { + WithDevicePortConnectedState portConnected(port, GenerateUniqueDeviceAddress()); + ASSERT_NO_FATAL_FAILURE(portConnected.SetUp(module.get())); + ASSERT_NO_FATAL_FAILURE( + ApplyEveryConfig(moduleConfig->getPortConfigsForDevicePort(portConnected.get()))); + } +} + TEST_P(AudioCoreModule, SetAllStaticAudioPortConfigs) { ASSERT_NO_FATAL_FAILURE(SetUpModuleConfig()); - const auto allPortConfigs = moduleConfig->getPortConfigsForMixPorts(); - for (const auto& config : allPortConfigs) { - ASSERT_NE(0, config.portId); - WithAudioPortConfig portConfig(config); - ASSERT_NO_FATAL_FAILURE(portConfig.SetUp(module.get())); - EXPECT_EQ(config.portId, portConfig.get().portId); - std::vector retrievedPortConfigs; - { - Status status = module->getAudioPortConfigs(&retrievedPortConfigs); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; - } - const int32_t portConfigId = portConfig.getId(); - auto configIt = std::find_if( - retrievedPortConfigs.begin(), retrievedPortConfigs.end(), - [&portConfigId](const auto& retrConf) { return retrConf.id == portConfigId; }); - EXPECT_NE(configIt, retrievedPortConfigs.end()) - << "Port config id returned by setAudioPortConfig: " << portConfigId - << " is not found in the list returned by getPortConfigsForMixPorts"; - if (configIt != retrievedPortConfigs.end()) { - EXPECT_EQ(portConfig.get(), *configIt) - << "Port config returned by getPortConfigsForMixPorts: " << configIt->toString() - << " is not the same as returned by setAudioPortConfig: " - << portConfig.get().toString(); - } - } + ASSERT_NO_FATAL_FAILURE(ApplyEveryConfig(moduleConfig->getPortConfigsForMixPorts())); } TEST_P(AudioCoreModule, SetAudioPortConfigInvalidPortId) { std::set portIds; ASSERT_NO_FATAL_FAILURE(GetAllPortIds(&portIds)); - for (const auto portId : getNonExistentIds(portIds)) { + for (const auto portId : GetNonExistentIds(portIds)) { AudioPortConfig portConfig, suggestedConfig; bool applied; portConfig.portId = portId; @@ -656,7 +838,7 @@ TEST_P(AudioCoreModule, SetAudioPortConfigInvalidPortId) { TEST_P(AudioCoreModule, SetAudioPortConfigInvalidPortConfigId) { std::set portConfigIds; ASSERT_NO_FATAL_FAILURE(GetAllPortConfigIds(&portConfigIds)); - for (const auto portConfigId : getNonExistentIds(portConfigIds)) { + for (const auto portConfigId : GetNonExistentIds(portConfigIds)) { AudioPortConfig portConfig, suggestedConfig; bool applied; portConfig.id = portConfigId; @@ -669,6 +851,203 @@ TEST_P(AudioCoreModule, SetAudioPortConfigInvalidPortConfigId) { } } +TEST_P(AudioCoreModule, TryConnectMissingDevice) { + ASSERT_NO_FATAL_FAILURE(SetUpModuleConfig()); + std::vector ports = moduleConfig->getExternalDevicePorts(); + if (ports.empty()) { + GTEST_SKIP() << "No external devices in the module."; + } + AudioPort ignored; + WithDebugFlags doNotSimulateConnections(debug); + doNotSimulateConnections.flags().simulateDeviceConnections = false; + ASSERT_NO_FATAL_FAILURE(doNotSimulateConnections.SetUp(module.get())); + for (const auto& port : ports) { + AudioPort portWithData = port; + portWithData.ext.get().device.address = + GenerateUniqueDeviceAddress(); + Status status = module->connectExternalDevice(portWithData, &ignored); + EXPECT_EQ(Status::EX_ILLEGAL_STATE, status.exceptionCode()) + << status << " returned for static port " << portWithData.toString(); + } +} + +TEST_P(AudioCoreModule, TryChangingConnectionSimulationMidway) { + ASSERT_NO_FATAL_FAILURE(SetUpModuleConfig()); + std::vector ports = moduleConfig->getExternalDevicePorts(); + if (ports.empty()) { + GTEST_SKIP() << "No external devices in the module."; + } + WithDevicePortConnectedState portConnected(*ports.begin(), GenerateUniqueDeviceAddress()); + ASSERT_NO_FATAL_FAILURE(portConnected.SetUp(module.get())); + ModuleDebug midwayDebugChange = debug.flags(); + midwayDebugChange.simulateDeviceConnections = false; + Status status = module->setModuleDebug(midwayDebugChange); + EXPECT_EQ(Status::EX_ILLEGAL_STATE, status.exceptionCode()) + << status << " returned when trying to disable connections simulation " + << "while having a connected device"; +} + +TEST_P(AudioCoreModule, ConnectDisconnectExternalDeviceInvalidPorts) { + AudioPort ignored; + std::set portIds; + ASSERT_NO_FATAL_FAILURE(GetAllPortIds(&portIds)); + for (const auto portId : GetNonExistentIds(portIds)) { + AudioPort invalidPort; + invalidPort.id = portId; + Status status = module->connectExternalDevice(invalidPort, &ignored); + EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + << status << " returned for port ID " << portId << " when setting CONNECTED state"; + status = module->disconnectExternalDevice(portId); + EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + << status << " returned for port ID " << portId + << " when setting DISCONNECTED state"; + } + + std::vector ports; + { + Status status = module->getAudioPorts(&ports); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + } + for (const auto& port : ports) { + if (port.ext.getTag() != AudioPortExt::Tag::device) { + Status status = module->connectExternalDevice(port, &ignored); + EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + << status << " returned for non-device port ID " << port.id + << " when setting CONNECTED state"; + status = module->disconnectExternalDevice(port.id); + EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + << status << " returned for non-device port ID " << port.id + << " when setting DISCONNECTED state"; + } else { + const auto& devicePort = port.ext.get(); + if (devicePort.device.type.connection.empty()) { + Status status = module->connectExternalDevice(port, &ignored); + EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + << status << " returned for permanently attached device port ID " << port.id + << " when setting CONNECTED state"; + status = module->disconnectExternalDevice(port.id); + EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + << status << " returned for permanently attached device port ID " << port.id + << " when setting DISCONNECTED state"; + } + } + } +} + +// Note: This test relies on simulation of external device connections by the HAL module. +TEST_P(AudioCoreModule, ConnectDisconnectExternalDeviceTwice) { + ASSERT_NO_FATAL_FAILURE(SetUpModuleConfig()); + AudioPort ignored; + std::vector ports = moduleConfig->getExternalDevicePorts(); + if (ports.empty()) { + GTEST_SKIP() << "No external devices in the module."; + } + for (const auto& port : ports) { + Status status = module->disconnectExternalDevice(port.id); + EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + << status << " returned when disconnecting already disconnected device port ID " + << port.id; + AudioPort portWithData = port; + portWithData.ext.get().device.address = + GenerateUniqueDeviceAddress(); + WithDevicePortConnectedState portConnected(portWithData); + ASSERT_NO_FATAL_FAILURE(portConnected.SetUp(module.get())); + status = module->connectExternalDevice(portConnected.get(), &ignored); + EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + << status << " returned when trying to connect a connected device port " + << portConnected.get().toString(); + status = module->connectExternalDevice(portWithData, &ignored); + EXPECT_EQ(Status::EX_ILLEGAL_STATE, status.exceptionCode()) + << status << " returned when connecting again the external device " + << portWithData.ext.get().device.toString(); + if (status.exceptionCode() == Status::EX_NONE) { + ADD_FAILURE() << "Returned connected port " << ignored.toString() << " for template " + << portWithData.toString(); + } + } +} + +// Note: This test relies on simulation of external device connections by the HAL module. +TEST_P(AudioCoreModule, DisconnectExternalDeviceNonResetPortConfig) { + ASSERT_NO_FATAL_FAILURE(SetUpModuleConfig()); + std::vector ports = moduleConfig->getExternalDevicePorts(); + if (ports.empty()) { + GTEST_SKIP() << "No external devices in the module."; + } + for (const auto& port : ports) { + WithDevicePortConnectedState portConnected(port, GenerateUniqueDeviceAddress()); + ASSERT_NO_FATAL_FAILURE(portConnected.SetUp(module.get())); + const auto portConfig = moduleConfig->getSingleConfigForDevicePort(portConnected.get()); + { + WithAudioPortConfig config(portConfig); + // Note: if SetUp fails, check the status of 'GetAudioPortWithExternalDevices' test. + // Our test assumes that 'getAudioPort' returns at least one profile, and it + // is not a dynamic profile. + ASSERT_NO_FATAL_FAILURE(config.SetUp(module.get())); + Status status = module->disconnectExternalDevice(portConnected.getId()); + EXPECT_EQ(Status::EX_ILLEGAL_STATE, status.exceptionCode()) + << status << " returned when trying to disconnect device port ID " << port.id + << " with active configuration " << config.getId(); + } + } +} + +TEST_P(AudioCoreModule, ExternalDevicePortRoutes) { + ASSERT_NO_FATAL_FAILURE(SetUpModuleConfig()); + std::vector ports = moduleConfig->getExternalDevicePorts(); + if (ports.empty()) { + GTEST_SKIP() << "No external devices in the module."; + } + for (const auto& port : ports) { + std::vector routesBefore; + { + Status status = module->getAudioRoutes(&routesBefore); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + } + + int32_t connectedPortId; + { + WithDevicePortConnectedState portConnected(port, GenerateUniqueDeviceAddress()); + ASSERT_NO_FATAL_FAILURE(portConnected.SetUp(module.get())); + connectedPortId = portConnected.getId(); + std::vector connectedPortRoutes; + { + Status status = + module->getAudioRoutesForAudioPort(connectedPortId, &connectedPortRoutes); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) + << status << " returned when retrieving routes for connected port id " + << connectedPortId; + } + // There must be routes for the port to be useful. + if (connectedPortRoutes.empty()) { + std::vector allRoutes; + Status status = module->getAudioRoutes(&allRoutes); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + ADD_FAILURE() << " no routes returned for the connected port " + << portConnected.get().toString() + << "; all routes: " << android::internal::ToString(allRoutes); + } + } + std::vector ignored; + Status status = module->getAudioRoutesForAudioPort(connectedPortId, &ignored); + ASSERT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + << status << " returned when retrieving routes for released connected port id " + << connectedPortId; + + std::vector routesAfter; + { + Status status = module->getAudioRoutes(&routesAfter); + ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + } + ASSERT_EQ(routesBefore.size(), routesAfter.size()) + << "Sizes of audio route arrays do not match after creating and " + << "releasing a connected port"; + std::sort(routesBefore.begin(), routesBefore.end()); + std::sort(routesAfter.begin(), routesAfter.end()); + EXPECT_EQ(routesBefore, routesAfter); + } +} + template class AudioStream : public AudioCoreModule { public: @@ -899,7 +1278,7 @@ class AudioModulePatch : public AudioCoreModule { std::set portConfigIds; ASSERT_NO_FATAL_FAILURE(GetAllPortConfigIds(&portConfigIds)); - for (const auto portConfigId : getNonExistentIds(portConfigIds)) { + for (const auto portConfigId : GetNonExistentIds(portConfigIds)) { EXPECT_NO_FATAL_FAILURE(SetInvalidPatchHelper( Status::EX_ILLEGAL_ARGUMENT, {portConfigId}, {sinkPortConfig.getId()})); EXPECT_NO_FATAL_FAILURE(SetInvalidPatchHelper(Status::EX_ILLEGAL_ARGUMENT, @@ -969,7 +1348,7 @@ class AudioModulePatch : public AudioCoreModule { // Then use the same patch setting, except for having an invalid ID. std::set patchIds; ASSERT_NO_FATAL_FAILURE(GetAllPatchIds(&patchIds)); - for (const auto patchId : getNonExistentIds(patchIds)) { + for (const auto patchId : GetNonExistentIds(patchIds)) { AudioPatch patchWithNonExistendId = patch.get(); patchWithNonExistendId.id = patchId; Status status = module->setAudioPatch(patchWithNonExistendId, &patchWithNonExistendId); @@ -995,7 +1374,7 @@ TEST_PATCH_BOTH_DIRECTIONS(UpdatePatch); TEST_P(AudioModulePatch, ResetInvalidPatchId) { std::set patchIds; ASSERT_NO_FATAL_FAILURE(GetAllPatchIds(&patchIds)); - for (const auto patchId : getNonExistentIds(patchIds)) { + for (const auto patchId : GetNonExistentIds(patchIds)) { Status status = module->resetAudioPatch(patchId); EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) << status << " returned for patch ID " << patchId; From e4ffd01586b55fde78027b611c0184a0f738834d Mon Sep 17 00:00:00 2001 From: Florian Mayer Date: Mon, 23 May 2022 16:50:36 -0700 Subject: [PATCH 082/998] Fix out of bounds access in test. The test code constructed an `std::string` without a size from a non-terminated string, which causes a memory error. Test: atest 'DefaultVhalImplTest#testDump' on flame_hwasan Bug: 233677013 Change-Id: I7d27c009c2e3307895a4a741743332fd4eed0e24 --- .../2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp index d35792d4b2..f01444ee19 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp @@ -402,7 +402,7 @@ TEST_F(DefaultVhalImplTest, testDump) { gotValue->timestamp = 0; std::string infoMake = toString(*gotValue); - EXPECT_THAT(std::string(buf), HasSubstr(infoMake)); + EXPECT_THAT(std::string(buf, sizeof(buf)), HasSubstr(infoMake)); } TEST_F(DefaultVhalImplTest, testSetPropInvalidAreaId) { From 0fe3730e7b58370e3185b6e41938c2a2db7b2d4e Mon Sep 17 00:00:00 2001 From: Jeff Pu Date: Tue, 24 May 2022 23:35:18 +0000 Subject: [PATCH 083/998] Add team members to OWNER file Bug: N/A Test: N/A Change-Id: I3e16a978624672515699eb2c99942ab7ed78a6e8 --- biometrics/fingerprint/aidl/OWNERS | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/biometrics/fingerprint/aidl/OWNERS b/biometrics/fingerprint/aidl/OWNERS index 36d726136f..e162d2df47 100644 --- a/biometrics/fingerprint/aidl/OWNERS +++ b/biometrics/fingerprint/aidl/OWNERS @@ -1,2 +1,4 @@ ilyamaty@google.com -kchyn@google.com +jeffpu@google.com +jbolinger@google.com +joshmccloskey@google.com From f09587c7aaf8b3c4f2fc2fbce6ed6601a303223c Mon Sep 17 00:00:00 2001 From: Frankie Lizcano Date: Tue, 24 May 2022 23:06:43 +0000 Subject: [PATCH 084/998] verifyFrontendStatus Test Implemented some of the TODO's on the FrontendTests.cpp file. Fixed the code formatting issue of having a long line. Some comments were deleted. Reverted the TODO back to its original wording. Change-Id: I932e218498c5f61da4196b21312dfef41778fcfd --- .../aidl/vts/functional/FrontendTests.cpp | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tv/tuner/aidl/vts/functional/FrontendTests.cpp b/tv/tuner/aidl/vts/functional/FrontendTests.cpp index a1f51dfe1a..2ff0c3d350 100644 --- a/tv/tuner/aidl/vts/functional/FrontendTests.cpp +++ b/tv/tuner/aidl/vts/functional/FrontendTests.cpp @@ -14,10 +14,10 @@ * limitations under the License. */ -#include - #include "FrontendTests.h" +#include + ndk::ScopedAStatus FrontendCallback::onEvent(FrontendEventType frontendEventType) { android::Mutex::Autolock autoLock(mMsgLock); ALOGD("[vts] frontend event received. Type: %d", frontendEventType); @@ -323,7 +323,10 @@ void FrontendTests::verifyFrontendStatus(vector statusTypes, FrontendStatusType type = statusTypes[i]; switch (type) { case FrontendStatusType::MODULATIONS: { - // TODO: verify modulations + ASSERT_TRUE(std::equal( + realStatuses[i].get().begin(), + realStatuses[i].get().end(), + expectStatuses[i].get().begin())); break; } case FrontendStatusType::BERS: { @@ -340,11 +343,13 @@ void FrontendTests::verifyFrontendStatus(vector statusTypes, break; } case FrontendStatusType::GUARD_INTERVAL: { - // TODO: verify interval + ASSERT_TRUE(realStatuses[i].get() == + expectStatuses[i].get()); break; } case FrontendStatusType::TRANSMISSION_MODE: { - // TODO: verify tranmission mode + ASSERT_TRUE(realStatuses[i].get() == + expectStatuses[i].get()); break; } case FrontendStatusType::UEC: { @@ -379,7 +384,8 @@ void FrontendTests::verifyFrontendStatus(vector statusTypes, break; } case FrontendStatusType::ROLL_OFF: { - // TODO: verify roll off + ASSERT_TRUE(realStatuses[i].get() == + expectStatuses[i].get()); break; } case FrontendStatusType::IS_MISO: { @@ -599,9 +605,10 @@ void FrontendTests::statusReadinessTest(FrontendConfig frontendConf) { ASSERT_TRUE(tuneFrontend(frontendConf, false /*testWithDemux*/)); // TODO: find a better way to push all frontend status types - for (int32_t i = 0; i < static_cast(FrontendStatusType::ATSC3_ALL_PLP_INFO); i++) { + for (int32_t i = 0; i <= static_cast(FrontendStatusType::ATSC3_ALL_PLP_INFO); i++) { allTypes.push_back(static_cast(i)); } + ndk::ScopedAStatus status = mFrontend->getFrontendStatusReadiness(allTypes, &readiness); ASSERT_TRUE(status.isOk()); ASSERT_TRUE(readiness.size() == allTypes.size()); From 5527adfd7fcae91ea99c583432800e0b377a2f89 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Mon, 30 May 2022 16:14:23 +0900 Subject: [PATCH 085/998] Remove AIDL-libs from VNDK Some are still in VNDK because they are used in other VNDK libs. Ignore-AOSP-First: some libs are still in internal master only. Bug: 234181591 Test: m Change-Id: If999df9c78a20df931177da11742b1c5de19bc08 --- audio/aidl/Android.bp | 8 ---- authsecret/aidl/Android.bp | 5 --- automotive/occupant_awareness/aidl/Android.bp | 5 --- bluetooth/audio/aidl/Android.bp | 3 -- camera/common/aidl/Android.bp | 5 --- camera/device/aidl/Android.bp | 5 --- camera/metadata/aidl/Android.bp | 5 --- camera/provider/aidl/Android.bp | 5 --- drm/aidl/Android.bp | 3 -- dumpstate/aidl/Android.bp | 5 --- gnss/aidl/Android.bp | 5 --- health/aidl/Android.bp | 5 --- health/storage/aidl/Android.bp | 5 --- identity/aidl/Android.bp | 3 -- ir/aidl/Android.bp | 5 --- keymaster/aidl/Android.bp | 5 --- light/aidl/Android.bp | 5 --- nfc/aidl/Android.bp | 5 --- oemlock/aidl/Android.bp | 5 --- power/aidl/Android.bp | 5 --- power/stats/aidl/Android.bp | 5 --- radio/aidl/Android.bp | 40 ------------------- rebootescrow/aidl/Android.bp | 5 --- security/dice/aidl/Android.bp | 3 -- security/keymint/aidl/Android.bp | 3 -- security/secureclock/aidl/Android.bp | 5 --- security/sharedsecret/aidl/Android.bp | 5 --- sensors/aidl/Android.bp | 5 --- soundtrigger/aidl/Android.bp | 5 --- usb/aidl/Android.bp | 5 --- uwb/aidl/Android.bp | 3 -- vibrator/aidl/Android.bp | 5 --- weaver/aidl/Android.bp | 5 --- wifi/hostapd/aidl/Android.bp | 5 --- wifi/supplicant/aidl/Android.bp | 5 --- 35 files changed, 201 deletions(-) diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index dd2b4e02d4..052411005b 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -49,9 +49,6 @@ aidl_interface { ], }, ndk: { - vndk: { - enabled: true, - }, apex_available: [ "//apex_available:platform", "com.android.bluetooth", @@ -89,10 +86,5 @@ aidl_interface { java: { platform_apis: true, }, - ndk: { - vndk: { - enabled: true, - }, - }, }, } diff --git a/authsecret/aidl/Android.bp b/authsecret/aidl/Android.bp index 432c1b97c3..90e128d8b6 100644 --- a/authsecret/aidl/Android.bp +++ b/authsecret/aidl/Android.bp @@ -16,11 +16,6 @@ aidl_interface { java: { platform_apis: true, }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions: ["1"], } diff --git a/automotive/occupant_awareness/aidl/Android.bp b/automotive/occupant_awareness/aidl/Android.bp index 6ddc1270eb..1a8124c011 100644 --- a/automotive/occupant_awareness/aidl/Android.bp +++ b/automotive/occupant_awareness/aidl/Android.bp @@ -23,11 +23,6 @@ aidl_interface { "com.android.car.framework", ], }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions: ["1"], } diff --git a/bluetooth/audio/aidl/Android.bp b/bluetooth/audio/aidl/Android.bp index c581702ea9..a6871624d5 100644 --- a/bluetooth/audio/aidl/Android.bp +++ b/bluetooth/audio/aidl/Android.bp @@ -40,9 +40,6 @@ aidl_interface { enabled: false, }, ndk: { - vndk: { - enabled: true, - }, apex_available: [ "//apex_available:platform", "com.android.bluetooth", diff --git a/camera/common/aidl/Android.bp b/camera/common/aidl/Android.bp index 19de22d586..d21ae581fb 100644 --- a/camera/common/aidl/Android.bp +++ b/camera/common/aidl/Android.bp @@ -19,11 +19,6 @@ aidl_interface { java: { enabled: false, }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { diff --git a/camera/device/aidl/Android.bp b/camera/device/aidl/Android.bp index afc6b8d101..365a5ff07f 100644 --- a/camera/device/aidl/Android.bp +++ b/camera/device/aidl/Android.bp @@ -27,11 +27,6 @@ aidl_interface { sdk_version: "module_current", enabled: false, }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { diff --git a/camera/metadata/aidl/Android.bp b/camera/metadata/aidl/Android.bp index 31d4b4d62c..301a9435cf 100644 --- a/camera/metadata/aidl/Android.bp +++ b/camera/metadata/aidl/Android.bp @@ -19,11 +19,6 @@ aidl_interface { java: { enabled: false, }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { diff --git a/camera/provider/aidl/Android.bp b/camera/provider/aidl/Android.bp index f082bce8b5..87a94b2176 100644 --- a/camera/provider/aidl/Android.bp +++ b/camera/provider/aidl/Android.bp @@ -25,11 +25,6 @@ aidl_interface { cpp: { enabled: false, }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { diff --git a/drm/aidl/Android.bp b/drm/aidl/Android.bp index 0fdba31c84..6273a38a26 100644 --- a/drm/aidl/Android.bp +++ b/drm/aidl/Android.bp @@ -23,9 +23,6 @@ aidl_interface { sdk_version: "module_current", }, ndk: { - vndk: { - enabled: true, - }, min_sdk_version: "current", }, }, diff --git a/dumpstate/aidl/Android.bp b/dumpstate/aidl/Android.bp index d9acc7a59c..63670bb0ab 100644 --- a/dumpstate/aidl/Android.bp +++ b/dumpstate/aidl/Android.bp @@ -33,11 +33,6 @@ aidl_interface { java: { enabled: false, }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { diff --git a/gnss/aidl/Android.bp b/gnss/aidl/Android.bp index 9f9090c195..f45fe5d54b 100644 --- a/gnss/aidl/Android.bp +++ b/gnss/aidl/Android.bp @@ -36,11 +36,6 @@ aidl_interface { java: { platform_apis: true, }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { diff --git a/health/aidl/Android.bp b/health/aidl/Android.bp index f0cd33f868..a4d4acee65 100644 --- a/health/aidl/Android.bp +++ b/health/aidl/Android.bp @@ -36,11 +36,6 @@ aidl_interface { enabled: true, sdk_version: "module_current", }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { diff --git a/health/storage/aidl/Android.bp b/health/storage/aidl/Android.bp index 4cd9263b2b..c614efb991 100644 --- a/health/storage/aidl/Android.bp +++ b/health/storage/aidl/Android.bp @@ -33,11 +33,6 @@ aidl_interface { java: { enabled: false, }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions: ["1"], } diff --git a/identity/aidl/Android.bp b/identity/aidl/Android.bp index 920a4b9fff..f6855e86c1 100644 --- a/identity/aidl/Android.bp +++ b/identity/aidl/Android.bp @@ -23,9 +23,6 @@ aidl_interface { platform_apis: true, }, ndk: { - vndk: { - enabled: true, - }, apps_enabled: false, }, }, diff --git a/ir/aidl/Android.bp b/ir/aidl/Android.bp index 2485f5bf87..25f6c8f417 100644 --- a/ir/aidl/Android.bp +++ b/ir/aidl/Android.bp @@ -33,11 +33,6 @@ aidl_interface { java: { sdk_version: "module_current", }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { diff --git a/keymaster/aidl/Android.bp b/keymaster/aidl/Android.bp index c4b6740ed4..0fb6e4c903 100644 --- a/keymaster/aidl/Android.bp +++ b/keymaster/aidl/Android.bp @@ -18,11 +18,6 @@ aidl_interface { java: { platform_apis: true, }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions: [ "1", diff --git a/light/aidl/Android.bp b/light/aidl/Android.bp index 6f478d7f22..c11934f527 100644 --- a/light/aidl/Android.bp +++ b/light/aidl/Android.bp @@ -18,11 +18,6 @@ aidl_interface { java: { sdk_version: "module_current", }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { diff --git a/nfc/aidl/Android.bp b/nfc/aidl/Android.bp index b9578f4858..09a45d12de 100644 --- a/nfc/aidl/Android.bp +++ b/nfc/aidl/Android.bp @@ -34,11 +34,6 @@ aidl_interface { sdk_version: "module_current", enabled: false, }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { diff --git a/oemlock/aidl/Android.bp b/oemlock/aidl/Android.bp index d1930f982e..1c19bb109c 100644 --- a/oemlock/aidl/Android.bp +++ b/oemlock/aidl/Android.bp @@ -16,11 +16,6 @@ aidl_interface { java: { platform_apis: true, }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions: ["1"], } diff --git a/power/aidl/Android.bp b/power/aidl/Android.bp index e4708f8ec5..70b1203031 100644 --- a/power/aidl/Android.bp +++ b/power/aidl/Android.bp @@ -35,11 +35,6 @@ aidl_interface { java: { platform_apis: true, }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { diff --git a/power/stats/aidl/Android.bp b/power/stats/aidl/Android.bp index 48d3c51f1a..b1b2515035 100644 --- a/power/stats/aidl/Android.bp +++ b/power/stats/aidl/Android.bp @@ -32,11 +32,6 @@ aidl_interface { java: { platform_apis: true, }, - ndk: { - vndk: { - enabled: true, - }, - }, cpp: { enabled: true, }, diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp index 19f81f7039..c0609d839f 100644 --- a/radio/aidl/Android.bp +++ b/radio/aidl/Android.bp @@ -20,11 +20,6 @@ aidl_interface { java: { sdk_version: "module_current", }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { @@ -49,11 +44,6 @@ aidl_interface { java: { sdk_version: "module_current", }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { @@ -78,11 +68,6 @@ aidl_interface { java: { sdk_version: "module_current", }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { @@ -107,11 +92,6 @@ aidl_interface { java: { sdk_version: "module_current", }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { @@ -136,11 +116,6 @@ aidl_interface { java: { sdk_version: "module_current", }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { @@ -165,11 +140,6 @@ aidl_interface { java: { sdk_version: "module_current", }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { @@ -197,11 +167,6 @@ aidl_interface { java: { sdk_version: "module_current", }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { @@ -229,11 +194,6 @@ aidl_interface { java: { sdk_version: "module_current", }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { diff --git a/rebootescrow/aidl/Android.bp b/rebootescrow/aidl/Android.bp index c764f86e9f..39aaa07a4a 100644 --- a/rebootescrow/aidl/Android.bp +++ b/rebootescrow/aidl/Android.bp @@ -18,11 +18,6 @@ aidl_interface { java: { platform_apis: true, }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions: ["1"], } diff --git a/security/dice/aidl/Android.bp b/security/dice/aidl/Android.bp index 97781b325b..5625d70269 100644 --- a/security/dice/aidl/Android.bp +++ b/security/dice/aidl/Android.bp @@ -34,9 +34,6 @@ aidl_interface { platform_apis: false, }, ndk: { - vndk: { - enabled: true, - }, apps_enabled: false, apex_available: [ "//apex_available:platform", diff --git a/security/keymint/aidl/Android.bp b/security/keymint/aidl/Android.bp index a233087fab..96d44a7935 100644 --- a/security/keymint/aidl/Android.bp +++ b/security/keymint/aidl/Android.bp @@ -22,9 +22,6 @@ aidl_interface { platform_apis: true, }, ndk: { - vndk: { - enabled: true, - }, apps_enabled: false, }, rust: { diff --git a/security/secureclock/aidl/Android.bp b/security/secureclock/aidl/Android.bp index 00a6ba3019..853ad892a1 100644 --- a/security/secureclock/aidl/Android.bp +++ b/security/secureclock/aidl/Android.bp @@ -18,11 +18,6 @@ aidl_interface { java: { platform_apis: true, }, - ndk: { - vndk: { - enabled: true, - }, - }, rust: { enabled: true, apex_available: [ diff --git a/security/sharedsecret/aidl/Android.bp b/security/sharedsecret/aidl/Android.bp index f1fce7455b..fe77c10d97 100644 --- a/security/sharedsecret/aidl/Android.bp +++ b/security/sharedsecret/aidl/Android.bp @@ -18,11 +18,6 @@ aidl_interface { java: { sdk_version: "module_current", }, - ndk: { - vndk: { - enabled: true, - }, - }, rust: { enabled: true, }, diff --git a/sensors/aidl/Android.bp b/sensors/aidl/Android.bp index 1c2d83fee7..d04017ccd0 100644 --- a/sensors/aidl/Android.bp +++ b/sensors/aidl/Android.bp @@ -23,11 +23,6 @@ aidl_interface { java: { enabled: false, }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { diff --git a/soundtrigger/aidl/Android.bp b/soundtrigger/aidl/Android.bp index 448895c26c..0658519bd9 100644 --- a/soundtrigger/aidl/Android.bp +++ b/soundtrigger/aidl/Android.bp @@ -33,11 +33,6 @@ aidl_interface { java: { sdk_version: "module_current", }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { diff --git a/usb/aidl/Android.bp b/usb/aidl/Android.bp index 7eb60208f1..4f59f02024 100644 --- a/usb/aidl/Android.bp +++ b/usb/aidl/Android.bp @@ -33,11 +33,6 @@ aidl_interface { java: { sdk_version: "module_current", }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { diff --git a/uwb/aidl/Android.bp b/uwb/aidl/Android.bp index cc61046683..52f060575c 100755 --- a/uwb/aidl/Android.bp +++ b/uwb/aidl/Android.bp @@ -21,9 +21,6 @@ aidl_interface { enabled: false, }, ndk: { - vndk: { - enabled: true, - }, apex_available: [ "//apex_available:platform", "com.android.uwb", diff --git a/vibrator/aidl/Android.bp b/vibrator/aidl/Android.bp index d4d5857492..86ef027b92 100644 --- a/vibrator/aidl/Android.bp +++ b/vibrator/aidl/Android.bp @@ -19,11 +19,6 @@ aidl_interface { java: { sdk_version: "module_current", }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions: [ "1", diff --git a/weaver/aidl/Android.bp b/weaver/aidl/Android.bp index 8b4306f3f1..caa92aa9b4 100644 --- a/weaver/aidl/Android.bp +++ b/weaver/aidl/Android.bp @@ -16,11 +16,6 @@ aidl_interface { java: { platform_apis: true, }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions: ["1"], } diff --git a/wifi/hostapd/aidl/Android.bp b/wifi/hostapd/aidl/Android.bp index c97f8da833..624093365a 100644 --- a/wifi/hostapd/aidl/Android.bp +++ b/wifi/hostapd/aidl/Android.bp @@ -37,11 +37,6 @@ aidl_interface { ], min_sdk_version: "30", }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { diff --git a/wifi/supplicant/aidl/Android.bp b/wifi/supplicant/aidl/Android.bp index ca0785b6a6..35de751c0c 100644 --- a/wifi/supplicant/aidl/Android.bp +++ b/wifi/supplicant/aidl/Android.bp @@ -37,11 +37,6 @@ aidl_interface { ], min_sdk_version: "30", }, - ndk: { - vndk: { - enabled: true, - }, - }, }, versions_with_info: [ { From cf3d69a554687bc2cc8c59c140671dd65bbeb055 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Sat, 21 May 2022 02:19:20 +0000 Subject: [PATCH 086/998] Add README files to VHAL codebase. Test: None, no code change. Bug: 233409093 Change-Id: I3b93313526ba55e7bbf80a156d579f8684c800ac --- automotive/vehicle/README.md | 26 ++++++++ automotive/vehicle/aidl/README.md | 23 +++++++ automotive/vehicle/aidl/impl/README.md | 58 +++++++++++++++++ .../vehicle/aidl/impl/fake_impl/README.md | 28 +++++++++ automotive/vehicle/aidl/impl/utils/README.md | 62 +++++++++++++++++++ 5 files changed, 197 insertions(+) create mode 100644 automotive/vehicle/README.md create mode 100644 automotive/vehicle/aidl/README.md create mode 100644 automotive/vehicle/aidl/impl/README.md create mode 100644 automotive/vehicle/aidl/impl/fake_impl/README.md create mode 100644 automotive/vehicle/aidl/impl/utils/README.md diff --git a/automotive/vehicle/README.md b/automotive/vehicle/README.md new file mode 100644 index 0000000000..e0f03e224c --- /dev/null +++ b/automotive/vehicle/README.md @@ -0,0 +1,26 @@ +# Vehicle Hardware Abstraction Layer (VHAL) +--- + +This directory stores the VHAL interface definition and VHAL reference +implementation. + +## 2.0 (deprecated) + +HIDL based VHAL interface and reference implementation. + +## aidl + +AIDL based VHAL interfadce and reference implementation. + +## proto + +Protobuf used to pass message between emulator VHAL and emulator. + +## tools + +Dev tools related to VHAL. + +## vts + +VTS test for VHAL. The VTS test works for both AIDL and HIDL VHAL +implementation. Vendor implementation of VHAL must passes VTS. diff --git a/automotive/vehicle/aidl/README.md b/automotive/vehicle/aidl/README.md new file mode 100644 index 0000000000..09f03b434e --- /dev/null +++ b/automotive/vehicle/aidl/README.md @@ -0,0 +1,23 @@ +# AIDL Vehicle Hardware Abstraction Layer (VHAL) +--- + +This directory stores the AIDL VHAL interface and reference implementation. + +## aidl_api + +Auto-generated current and previous versions of AIDL VHAL api. + +## aidl_test + +Contains a test to test that all HIDL VHAL properties are supported in +AIDL VHAL. + +## android + +Contains AIDL VHAL interface definition. The main interface file is +`android/hardware/automotive/vehicle/IVehicle.aidl`. + +## impl + +Reference implementation for AIDL VHAL and useful libraries for implementing +vendor AIDL VHAL. diff --git a/automotive/vehicle/aidl/impl/README.md b/automotive/vehicle/aidl/impl/README.md new file mode 100644 index 0000000000..121ffd15e7 --- /dev/null +++ b/automotive/vehicle/aidl/impl/README.md @@ -0,0 +1,58 @@ +# AIDL VHAL libraries and reference implementation. +--- + +This directory stores the libraries useful for implementing vendor AIDL VHAL. +This directory also stores a reference fake implementation for AIDL VHAL. + +## default_config + +Stores the default vehicle property configurations for reference vehicle HAL. +Vendor implementation could copy this library but must update the configuration +to meet their own requirements, e.g. enable or disable certain properties or +update the initial value for certain properties. + +## fake_impl + +Contains libraries used specifically for the fake reference VHAL implementation. +These libraries are for test only and must not be directly used for vendor +VHAL implementation. + +These libraries contain test-spcific logic and must not run directly on a real +vehicle. + +## grpc + +Stores code for GRPC based VHAL implementation. + +## hardware + +Defines an interface `IVehicleHardware.h` which vendor must implement for +vehicle-specific logic if they want to follow our reference VHAL design. + +## proto + +Stores Some protobuf files translated from AIDL VHAL interface types. These +files are used in GRPC VHAL implementation. + +## utils + +Defines a library `VehicleHalUtils` which provides useful utility functions for +VHAL implementation. Vendor VHAL could use this library. + +## vhal + +Defines a library `DefaultVehicleHal` which provides generic logic for all VHAL +implementations (including reference VHAL). Vendor VHAL implementation could +use this library, along with their own implementation for `IVehicleHardware` +interface. + +Also defines a binary `android.hardware.automotive.vehicle@V1-default-service` +which is the reference VHAL implementation. It implements `IVehicle.aidl` +interface. It uses `DefaultVehicleHal`, along with `FakeVehicleHardware` +(in fake_impl). It simulates the vehicle bus interaction by using an +in-memory map. Meaning that all properties (except for some special ones) are +just written into a hash map and read from a hash map without relying on any +hardware. As a result, the reference implementation can run on emulator or +any host environment. + +Vendor must not directly use the reference implementation for a real vehicle. \ No newline at end of file diff --git a/automotive/vehicle/aidl/impl/fake_impl/README.md b/automotive/vehicle/aidl/impl/fake_impl/README.md new file mode 100644 index 0000000000..e86dceeb9a --- /dev/null +++ b/automotive/vehicle/aidl/impl/fake_impl/README.md @@ -0,0 +1,28 @@ +# Fake reference AIDL VHAL implementation libraries +--- + +This directory stores libraries for implementing a fake reference AIDL VHAL. + +WARNING: All the libraries here are for TEST ONLY. + +## GeneratorHub + +Defines a library `FakeVehicleHalValueGenerators` that could generate fake +vehicle property values for testing. + +## hardware + +Defines a fake implementation for device-specifc interface `IVehicleHardware`: +`FakeVehicleHardware`. This implementation uses a in-memory map for storing +property values and does not communicate with or depending on any specific +vehicle bus. + +## obd2frame + +Defines a library `FakeObd2Frame` that generates fake OBD2 frame for OBD2 +properties. + +## userhal + +Defines a library `FakeUserHal` that emulates a real User HAL behavior by +parsing debug commands. diff --git a/automotive/vehicle/aidl/impl/utils/README.md b/automotive/vehicle/aidl/impl/utils/README.md new file mode 100644 index 0000000000..87bb7e3034 --- /dev/null +++ b/automotive/vehicle/aidl/impl/utils/README.md @@ -0,0 +1,62 @@ +# Utility classes for VHAL implementation +--- + +This directory stores utility classes for VHAL implementation. Vendor +implementation could use utility classes from `common` folder in their +VHAL implementation. + +## common + +Defines common utility libraries. + +### ConcurrentQueue + +Provides a thread-safe concurrent queue object. Useful for adding object to +a queue in one thread (usually binder thread) and handle the objects in a +separate handler thread. + +### ParcelableUtils + +Provides functions to convert between a regular parcelable and a +`LargeParcelabe`. + +A `LargeParcelable` is a parcelable that marshals the payload +into a shared memory file if the payload is too large to pass across binder. +It is used to pass large data across binder. Before sending the data, VHAL +impl should convert a regular parcelabe to a `LargeParcelable`. After receving +data, VHAL impl should convert a `LargeParcelable` back to regular parcelabe. + +### PendingRequestPool + +Defines A class for managing pending requests and automatically call timeout +callback if the request timed-out. + +### PropertyUtils + +Defines some useful constants. + +### RecurrentTimer + +Defines a thread-safe recurrent timer that can call a function periodically. + +### VehicleHalTypes + +Provides a header file that includes many commonly used header files. Useful +when you are using multiple types defined in VHAL interface. + +### VehicleObjectPool + +Defines a reusable in-memory pool for `VehiclePropValue`. + +### VehiclePropertyStore + +Defines an in-memory map for storing vehicle properties. Allows easier insert, +delete and lookup. + +### VehicleUtils + +Defines many useful utility functions. + +## test + +Defines utility libraries for test only. From c7e26487feef6913f6630f7284dfe91bf4b478aa Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Sat, 4 Jun 2022 02:32:01 +0000 Subject: [PATCH 087/998] Define GSR Compliance Requirement property. Bug: 234066529 Test: None Change-Id: I4d08e54de5d6f7e0d7f23adcea6b844da911255b --- .../vehicle/GsrComplianceRequirementType.aidl | 39 +++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../vehicle/GsrComplianceRequirementType.aidl | 34 ++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 13 +++++++ 4 files changed, 87 insertions(+) create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl create mode 100644 automotive/vehicle/aidl/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl new file mode 100644 index 0000000000..0d3a061a56 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum GsrComplianceRequirementType { + GSR_COMPLIANCE_NOT_REQUIRED = 0, + GSR_COMPLIANCE_REQUIRED_THROUGH_SYSTEM_IMAGE = 1, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 04f8fa3b80..2d0cde5bb9 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -206,4 +206,5 @@ enum VehicleProperty { EV_REGENERATIVE_BRAKING_STATE = 289410884, TRAILER_PRESENT = 289410885, VEHICLE_CURB_WEIGHT = 289410886, + GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT = 289410887, } diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl new file mode 100644 index 0000000000..e0609d5427 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl @@ -0,0 +1,34 @@ +/* + * 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. + */ + +package android.hardware.automotive.vehicle; + +/** + * Used by GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT to indicate what + * kind of general safety regulation compliance requirement is enforced. + */ +@VintfStability +@Backing(type="int") +enum GsrComplianceRequirementType { + /** + * GSR compliance is not required. + */ + GSR_COMPLIANCE_NOT_REQUIRED = 0, + /** + * GSR compliance is required through system image. + */ + GSR_COMPLIANCE_REQUIRED_THROUGH_SYSTEM_IMAGE = 1, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 727b949a37..15d8e58fd1 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -2840,4 +2840,17 @@ enum VehicleProperty { VEHICLE_CURB_WEIGHT = 0x0F46 + 0x10000000 + 0x01000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * EU's General security regulation compliance requirement. + * + * Returns whether general security regulation compliance is required, if + * so, what type of requirement. + * + * @change_mode VehiclePropertyChangeMode:STATIC + * @access VehiclePropertyAccess:READ + * @data_enum GsrComplianceRequirementType + */ + GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT = 0x0F47 + 0x10000000 + 0x01000000 + + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + } From 79ddc756039a1f910a167a5394efffce44b9294e Mon Sep 17 00:00:00 2001 From: Eric Jeong Date: Tue, 7 Jun 2022 00:59:06 -0700 Subject: [PATCH 088/998] Allow dynamic config of AP_POWER_STATE_REQ - Default VHAL is used in many devices. - The devices have different suspend capability. So, we need a mechanism to have different config of AP_POWER_STATE_REQ. - The value of ro.vendor.fake_vhal.ap_power_state_req.config is set to AP_POWER_STATE_REQ's config. Bug: 229427592 Test: Set a ro.vendor.fake_vhal.ap_power_state_req.config to 0x5 and check if car_service HAL dump shows "isDeepSleepAllowed:true, isHibernationAllowed:true". Change-Id: I9eee87d139ab86066dcf7269f841921e20e9cbbc --- .../aidl/impl/default_config/include/DefaultConfig.h | 2 +- .../impl/fake_impl/hardware/src/FakeVehicleHardware.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index 5430f14c84..08ed483e47 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -835,7 +835,7 @@ const std::vector kVehicleProperties = { {.config = {.prop = toInt(VehicleProperty::AP_POWER_STATE_REQ), .access = VehiclePropertyAccess::READ, .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {3}}}, + .configArray = {0}}}, {.config = {.prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT), .access = VehiclePropertyAccess::READ_WRITE, diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index 7f9b63aeb9..a0fda79ab8 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -67,6 +67,7 @@ using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; using ::android::base::EqualsIgnoreCase; using ::android::base::Error; +using ::android::base::GetIntProperty; using ::android::base::ParseFloat; using ::android::base::Result; using ::android::base::ScopedLockAssertion; @@ -75,6 +76,7 @@ using ::android::base::StringPrintf; const char* VENDOR_OVERRIDE_DIR = "/vendor/etc/automotive/vhaloverride/"; const char* OVERRIDE_PROPERTY = "persist.vendor.vhal_init_value_override"; +const char* POWER_STATE_REQ_CONFIG_PROPERTY = "ro.vendor.fake_vhal.ap_power_state_req.config"; // A list of supported options for "--set" command. const std::unordered_set SET_PROP_OPTIONS = { @@ -163,7 +165,10 @@ void FakeVehicleHardware::init() { VehiclePropConfig cfg = it.config; VehiclePropertyStore::TokenFunction tokenFunction = nullptr; - if (cfg.prop == OBD2_FREEZE_FRAME) { + if (cfg.prop == toInt(VehicleProperty::AP_POWER_STATE_REQ)) { + int config = GetIntProperty(POWER_STATE_REQ_CONFIG_PROPERTY, /*default_value=*/0); + cfg.configArray[0] = config; + } else if (cfg.prop == OBD2_FREEZE_FRAME) { tokenFunction = [](const VehiclePropValue& propValue) { return propValue.timestamp; }; } From 8ab7fd8b21b59e736cea26badb56e992debf0d4e Mon Sep 17 00:00:00 2001 From: Silver Chen Date: Fri, 13 May 2022 10:03:45 +0800 Subject: [PATCH 089/998] Fix VTS PlaybackDataFlowWithTsVideoFilterTest sometimes failed. [Description] If filter is started after playback thread, sometimes filter cannot get data correctly because of timing issue. Start playback thread after filter is started so that filter will always get data correctly. Bug: 235185563 Test: 1. Testcase pass Change-Id: I97c38dab1ff81c31b4bb48c8015b626b3a6325ed --- tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp index 3e3a4d4732..59b7939833 100644 --- a/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp +++ b/tv/tuner/1.0/vts/functional/VtsHalTvTunerV1_0TargetTest.cpp @@ -144,9 +144,9 @@ void TunerPlaybackHidlTest::playbackSingleFilterTest(FilterConfig filterConf, Dv ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId(filterId)); ASSERT_TRUE(mFilterTests.configFilter(filterConf.settings, filterId)); ASSERT_TRUE(mFilterTests.getFilterMQDescriptor(filterId, filterConf.getMqDesc)); - mDvrTests.startPlaybackInputThread(dvrConf.playbackInputFile, dvrConf.settings.playback()); ASSERT_TRUE(mDvrTests.startDvrPlayback()); ASSERT_TRUE(mFilterTests.startFilter(filterId)); + mDvrTests.startPlaybackInputThread(dvrConf.playbackInputFile, dvrConf.settings.playback()); ASSERT_TRUE(filterDataOutputTest()); mDvrTests.stopPlaybackThread(); ASSERT_TRUE(mFilterTests.stopFilter(filterId)); From 3dd24d1e3590b674490b260edd3f436c045a2d64 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Tue, 7 Jun 2022 01:02:05 +0000 Subject: [PATCH 090/998] Define VehicleHalInterfaceDefaults to wrap VHAL backend. This allows prevents libraries from directly depending on a specific version of AIDL VHAL interface, which allows an easier update for VHAL interface version. Test: Local build. Bug: 235152525 Change-Id: I7a652f42d149acbcb52cdb98e1f73a0e600d97db --- automotive/vehicle/aidl/impl/Android.bp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl/impl/Android.bp b/automotive/vehicle/aidl/impl/Android.bp index d24a73902b..196f431fe1 100644 --- a/automotive/vehicle/aidl/impl/Android.bp +++ b/automotive/vehicle/aidl/impl/Android.bp @@ -18,11 +18,17 @@ package { default_applicable_licenses: ["Android-Apache-2.0"], } +cc_defaults { + name: "VehicleHalInterfaceDefaults", + static_libs: [ + "android.hardware.automotive.vehicle-V1-ndk", + ], +} + cc_defaults { name: "VehicleHalDefaults", static_libs: [ "android-automotive-large-parcelable-lib", - "android.hardware.automotive.vehicle-V1-ndk", "libmath", ], shared_libs: [ @@ -37,6 +43,7 @@ cc_defaults { "-Wthread-safety", ], defaults: [ + "VehicleHalInterfaceDefaults", "android-automotive-large-parcelable-defaults", ], } From d6a1025c62ba7eb4f2dfd94073695b713e4bf240 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Thu, 9 Jun 2022 21:09:14 +0000 Subject: [PATCH 091/998] uwb(hal): Add a new capability TLV for min ranging interval Bug: 235488259 Test: Compiles Change-Id: I7f0c6d9b68ea3a1ba31911a031f2e7ee24c9d331 --- uwb/aidl/Android.bp | 1 + .../uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl | 1 + .../uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl | 5 +++++ 3 files changed, 7 insertions(+) diff --git a/uwb/aidl/Android.bp b/uwb/aidl/Android.bp index cc61046683..398172470d 100755 --- a/uwb/aidl/Android.bp +++ b/uwb/aidl/Android.bp @@ -50,6 +50,7 @@ aidl_interface { aidl_interface { name: "android.hardware.uwb.fira_android", + owner: "google", vendor_available: true, srcs: ["android/hardware/uwb/fira_android/*.aidl"], stability: "vintf", diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl index cbe20688ad..17e438129e 100644 --- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl @@ -44,4 +44,5 @@ enum UwbVendorCapabilityTlvTypes { CCC_SUPPORTED_PULSE_SHAPE_COMBOS = 166, CCC_SUPPORTED_RAN_MULTIPLIER = 167, SUPPORTED_AOA_RESULT_REQ_ANTENNA_INTERLEAVING = 227, + SUPPORTED_MIN_RANGING_INTERVAL_MS = 228, } diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl index 0140fdd5ed..3961edaecb 100644 --- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl +++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl @@ -150,4 +150,9 @@ enum UwbVendorCapabilityTlvTypes { * 0 - Feature not supported. */ SUPPORTED_AOA_RESULT_REQ_ANTENNA_INTERLEAVING = 0xE3, + + /** + * 4 byte value to indicate supported min ranging interval in ms. + */ + SUPPORTED_MIN_RANGING_INTERVAL_MS = 0xE4, } From c088612eb239ed54a4028ee0eeb343f9920deb64 Mon Sep 17 00:00:00 2001 From: Trevor Radcliffe Date: Thu, 9 Jun 2022 19:19:30 +0000 Subject: [PATCH 092/998] Point directly to generated c sysprop_library Supports aosp/2119952 Bug: 226199990 Test: m Change-Id: Ifa5725abda911f2ea4d4951d41ac54fe703ae31b --- biometrics/face/aidl/default/Android.bp | 4 ++-- biometrics/fingerprint/aidl/default/Android.bp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/biometrics/face/aidl/default/Android.bp b/biometrics/face/aidl/default/Android.bp index 48c929bc42..63a3645c6d 100644 --- a/biometrics/face/aidl/default/Android.bp +++ b/biometrics/face/aidl/default/Android.bp @@ -27,7 +27,7 @@ cc_binary { "FakeFaceEngine.cpp", "Session.cpp", ], - static_libs: ["android.hardware.biometrics.face.VirtualProps"], + static_libs: ["libandroid.hardware.biometrics.face.VirtualProps"], } sysprop_library { @@ -48,7 +48,7 @@ cc_test { "libbinder_ndk", ], static_libs: [ - "android.hardware.biometrics.face.VirtualProps", + "libandroid.hardware.biometrics.face.VirtualProps", "android.hardware.biometrics.face-V2-ndk", "android.hardware.biometrics.common-V2-ndk", "android.hardware.keymaster-V3-ndk", diff --git a/biometrics/fingerprint/aidl/default/Android.bp b/biometrics/fingerprint/aidl/default/Android.bp index 31fd96bee0..2aa7bbd0b8 100644 --- a/biometrics/fingerprint/aidl/default/Android.bp +++ b/biometrics/fingerprint/aidl/default/Android.bp @@ -28,7 +28,7 @@ cc_binary { "android.hardware.biometrics.common.thread", "android.hardware.biometrics.common.util", ], - static_libs: ["android.hardware.biometrics.fingerprint.VirtualProps"], + static_libs: ["libandroid.hardware.biometrics.fingerprint.VirtualProps"], } cc_test { @@ -43,7 +43,7 @@ cc_test { "libbinder_ndk", ], static_libs: [ - "android.hardware.biometrics.fingerprint.VirtualProps", + "libandroid.hardware.biometrics.fingerprint.VirtualProps", "android.hardware.biometrics.fingerprint-V2-ndk", "android.hardware.biometrics.common-V2-ndk", "android.hardware.keymaster-V3-ndk", From 0ce90389dcb49be87a43f3a847299688355876fb Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Wed, 15 Jun 2022 02:59:32 +0000 Subject: [PATCH 093/998] Remove android.hardware.radio.ims* AIDL libs from VNDK A CL following ag/18869738. Test: m Change-Id: Ic9fae923285cbc7ebb73792fed0db219254483de --- radio/aidl/Android.bp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp index efbd8c84a7..a87f637f35 100644 --- a/radio/aidl/Android.bp +++ b/radio/aidl/Android.bp @@ -259,11 +259,6 @@ aidl_interface { java: { sdk_version: "module_current", }, - ndk: { - vndk: { - enabled: true, - }, - }, }, } @@ -280,11 +275,6 @@ aidl_interface { java: { sdk_version: "module_current", }, - ndk: { - vndk: { - enabled: true, - }, - }, }, } From 4558013c5a8dab2e5cea157cc31b5df75683b4b0 Mon Sep 17 00:00:00 2001 From: Chen Cheng Date: Wed, 15 Jun 2022 17:20:02 +0000 Subject: [PATCH 094/998] Change StatusCode to ErrorCode. ErrorCode is created in IVhalClient to better describe the error case in vhal cpp client interface. Test: atest VtsHalAutomotiveVehicle_TargetTest Bug: 224876310 Change-Id: I3ec73d0688c90d79e2819736df9fc00d6bc25662 --- .../vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index c431d85eef..5de206bee2 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -48,6 +48,7 @@ using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; using ::android::getAidlHalInstanceNames; using ::android::base::ScopedLockAssertion; using ::android::base::StringPrintf; +using ::android::frameworks::automotive::vhal::ErrorCode; using ::android::frameworks::automotive::vhal::HalPropError; using ::android::frameworks::automotive::vhal::IHalPropConfig; using ::android::frameworks::automotive::vhal::IHalPropValue; @@ -287,7 +288,7 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, setNotWritableProp) { auto setValueResult = mVhalClient->setValueSync(*getValueResult.value()); ASSERT_FALSE(setValueResult.ok()) << "Expect set a read-only value to fail"; - ASSERT_EQ(setValueResult.error().code(), StatusCode::ACCESS_DENIED); + ASSERT_EQ(setValueResult.error().code(), ErrorCode::ACCESS_DENIED_FROM_VHAL); } // Test subscribe() and unsubscribe(). From d7f9e2344e3262602a67719a3a6bbc9c849f3b6a Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Mon, 6 Jun 2022 22:09:57 +0000 Subject: [PATCH 095/998] Add GSR Comp Req property to default config. This CL also updates ref impl to V2 VHAL interface. Test: Local build. Bug: 234066529 Bug: 235152525 Change-Id: I41d28e2b2833a356b5e980c02e37c43d16fe6696 --- automotive/vehicle/aidl/impl/Android.bp | 2 +- .../impl/default_config/include/DefaultConfig.h | 14 ++++++++++++++ .../impl/utils/common/include/VehicleHalTypes.h | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl/impl/Android.bp b/automotive/vehicle/aidl/impl/Android.bp index 196f431fe1..73f7df0513 100644 --- a/automotive/vehicle/aidl/impl/Android.bp +++ b/automotive/vehicle/aidl/impl/Android.bp @@ -21,7 +21,7 @@ package { cc_defaults { name: "VehicleHalInterfaceDefaults", static_libs: [ - "android.hardware.automotive.vehicle-V1-ndk", + "android.hardware.automotive.vehicle-V2-ndk", ], } diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index f465dc0e3a..409b932280 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -36,6 +36,7 @@ using ::aidl::android::hardware::automotive::vehicle::EvConnectorType; using ::aidl::android::hardware::automotive::vehicle::EvsServiceState; using ::aidl::android::hardware::automotive::vehicle::EvsServiceType; using ::aidl::android::hardware::automotive::vehicle::FuelType; +using ::aidl::android::hardware::automotive::vehicle::GsrComplianceRequirementType; using ::aidl::android::hardware::automotive::vehicle::RawPropValues; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq; @@ -1255,6 +1256,19 @@ const std::vector kVehicleProperties = { .changeMode = VehiclePropertyChangeMode::ON_CHANGE, }, }, + { + .config = + { + .prop = toInt( + VehicleProperty:: + GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + }, + .initialValue = {.int32Values = {toInt( + GsrComplianceRequirementType:: + GSR_COMPLIANCE_REQUIRED_THROUGH_SYSTEM_IMAGE)}}, + }, #ifdef ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING // Vendor propetry for E2E ClusterHomeService testing. { diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index a7fcdcf99d..6af122331f 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include From 8fcc442416d30980aa4946b6d736c2f96a4e1bc0 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Thu, 16 Jun 2022 00:35:31 +0000 Subject: [PATCH 096/998] audio: Disable the C++ backend for android.hardware.audio.core android.hardware.audio.core will need to use FMQ, which does not support the C++ backend in the AIDL version. Migrate VTS tests from the C++ backend to the NDK backend. Bug: 205884982 Test: atest VtsHalAudioCoreTargetTest Change-Id: Ia5d29126afdb4bb97dd063a032b96ab83b9ce36e --- audio/aidl/Android.bp | 4 + audio/aidl/vts/Android.bp | 8 +- audio/aidl/vts/ModuleConfig.cpp | 26 +- audio/aidl/vts/ModuleConfig.h | 95 ++--- audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp | 401 ++++++++++--------- 5 files changed, 284 insertions(+), 250 deletions(-) diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index 052411005b..7db50d5ca5 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -83,6 +83,10 @@ aidl_interface { ], stability: "vintf", backend: { + // The C++ backend is disabled transitively due to use of FMQ. + cpp: { + enabled: false, + }, java: { platform_apis: true, }, diff --git a/audio/aidl/vts/Android.bp b/audio/aidl/vts/Android.bp index c160d1f5cc..cd5915bbe2 100644 --- a/audio/aidl/vts/Android.bp +++ b/audio/aidl/vts/Android.bp @@ -18,12 +18,12 @@ cc_test { "VtsHalAudioCoreTargetTest.cpp", ], shared_libs: [ - "libbinder", + "libbinder_ndk", ], static_libs: [ - "android.hardware.audio.common-V1-cpp", - "android.hardware.audio.core-V1-cpp", - "android.media.audio.common.types-V1-cpp", + "android.hardware.audio.common-V1-ndk", + "android.hardware.audio.core-V1-ndk", + "android.media.audio.common.types-V1-ndk", ], test_suites: [ "general-tests", diff --git a/audio/aidl/vts/ModuleConfig.cpp b/audio/aidl/vts/ModuleConfig.cpp index 3f8d0888aa..36b3b1b412 100644 --- a/audio/aidl/vts/ModuleConfig.cpp +++ b/audio/aidl/vts/ModuleConfig.cpp @@ -16,24 +16,24 @@ #include -#include -#include +#include +#include #include "ModuleConfig.h" using namespace android; -using android::hardware::audio::core::IModule; -using android::media::audio::common::AudioChannelLayout; -using android::media::audio::common::AudioFormatDescription; -using android::media::audio::common::AudioFormatType; -using android::media::audio::common::AudioIoFlags; -using android::media::audio::common::AudioOutputFlags; -using android::media::audio::common::AudioPort; -using android::media::audio::common::AudioPortConfig; -using android::media::audio::common::AudioPortExt; -using android::media::audio::common::AudioProfile; -using android::media::audio::common::Int; +using aidl::android::hardware::audio::core::IModule; +using aidl::android::media::audio::common::AudioChannelLayout; +using aidl::android::media::audio::common::AudioFormatDescription; +using aidl::android::media::audio::common::AudioFormatType; +using aidl::android::media::audio::common::AudioIoFlags; +using aidl::android::media::audio::common::AudioOutputFlags; +using aidl::android::media::audio::common::AudioPort; +using aidl::android::media::audio::common::AudioPortConfig; +using aidl::android::media::audio::common::AudioPortExt; +using aidl::android::media::audio::common::AudioProfile; +using aidl::android::media::audio::common::Int; template auto findById(const std::vector& v, int32_t id) { diff --git a/audio/aidl/vts/ModuleConfig.h b/audio/aidl/vts/ModuleConfig.h index 0e2738b306..504c0fdf96 100644 --- a/audio/aidl/vts/ModuleConfig.h +++ b/audio/aidl/vts/ModuleConfig.h @@ -21,67 +21,69 @@ #include #include -#include -#include -#include -#include +#include +#include +#include class ModuleConfig { public: - using SrcSinkPair = std::pair; + using SrcSinkPair = std::pair; using SrcSinkGroup = - std::pair>; + std::pair>; - explicit ModuleConfig(android::hardware::audio::core::IModule* module); - android::binder::Status getStatus() const { return mStatus; } - std::string getError() const { return mStatus.toString8().c_str(); } + explicit ModuleConfig(aidl::android::hardware::audio::core::IModule* module); + const ndk::ScopedAStatus& getStatus() const { return mStatus; } + std::string getError() const { return mStatus.getMessage(); } - std::vector getAttachedDevicePorts() const; - std::vector getExternalDevicePorts() const; - std::vector getInputMixPorts() const; - std::vector getOutputMixPorts() const; - std::vector getMixPorts(bool isInput) const { + std::vector getAttachedDevicePorts() const; + std::vector getExternalDevicePorts() const; + std::vector getInputMixPorts() const; + std::vector getOutputMixPorts() const; + std::vector getMixPorts(bool isInput) const { return isInput ? getInputMixPorts() : getOutputMixPorts(); } - std::vector getAttachedDevicesPortsForMixPort( - bool isInput, const android::media::audio::common::AudioPort& mixPort) const { + std::vector getAttachedDevicesPortsForMixPort( + bool isInput, const aidl::android::media::audio::common::AudioPort& mixPort) const { return isInput ? getAttachedSourceDevicesPortsForMixPort(mixPort) : getAttachedSinkDevicesPortsForMixPort(mixPort); } - std::vector getAttachedSinkDevicesPortsForMixPort( - const android::media::audio::common::AudioPort& mixPort) const; - std::vector getAttachedSourceDevicesPortsForMixPort( - const android::media::audio::common::AudioPort& mixPort) const; - std::optional getSourceMixPortForAttachedDevice() - const; + std::vector + getAttachedSinkDevicesPortsForMixPort( + const aidl::android::media::audio::common::AudioPort& mixPort) const; + std::vector + getAttachedSourceDevicesPortsForMixPort( + const aidl::android::media::audio::common::AudioPort& mixPort) const; + std::optional + getSourceMixPortForAttachedDevice() const; std::optional getNonRoutableSrcSinkPair(bool isInput) const; std::optional getRoutableSrcSinkPair(bool isInput) const; std::vector getRoutableSrcSinkGroups(bool isInput) const; - std::vector + std::vector getPortConfigsForAttachedDevicePorts() const { return generateAudioDevicePortConfigs(getAttachedDevicePorts(), false); } - std::vector getPortConfigsForMixPorts() const { + std::vector getPortConfigsForMixPorts() + const { auto inputs = generateInputAudioMixPortConfigs(getInputMixPorts(), false); auto outputs = generateOutputAudioMixPortConfigs(getOutputMixPorts(), false); inputs.insert(inputs.end(), outputs.begin(), outputs.end()); return inputs; } - std::vector getPortConfigsForMixPorts( + std::vector getPortConfigsForMixPorts( bool isInput) const { return isInput ? generateInputAudioMixPortConfigs(getInputMixPorts(), false) : generateOutputAudioMixPortConfigs(getOutputMixPorts(), false); } - std::vector getPortConfigsForMixPorts( - bool isInput, const android::media::audio::common::AudioPort& port) const { + std::vector getPortConfigsForMixPorts( + bool isInput, const aidl::android::media::audio::common::AudioPort& port) const { return isInput ? generateInputAudioMixPortConfigs({port}, false) : generateOutputAudioMixPortConfigs({port}, false); } - std::optional getSingleConfigForMixPort( + std::optional getSingleConfigForMixPort( bool isInput) const { const auto config = isInput ? generateInputAudioMixPortConfigs(getInputMixPorts(), true) : generateOutputAudioMixPortConfigs(getOutputMixPorts(), true); @@ -93,8 +95,8 @@ class ModuleConfig { return {}; } } - std::optional getSingleConfigForMixPort( - bool isInput, const android::media::audio::common::AudioPort& port) const { + std::optional getSingleConfigForMixPort( + bool isInput, const aidl::android::media::audio::common::AudioPort& port) const { const auto config = isInput ? generateInputAudioMixPortConfigs({port}, true) : generateOutputAudioMixPortConfigs({port}, true); if (!config.empty()) { @@ -104,12 +106,12 @@ class ModuleConfig { } } - std::vector getPortConfigsForDevicePort( - const android::media::audio::common::AudioPort& port) const { + std::vector getPortConfigsForDevicePort( + const aidl::android::media::audio::common::AudioPort& port) const { return generateAudioDevicePortConfigs({port}, false); } - android::media::audio::common::AudioPortConfig getSingleConfigForDevicePort( - const android::media::audio::common::AudioPort& port) const { + aidl::android::media::audio::common::AudioPortConfig getSingleConfigForDevicePort( + const aidl::android::media::audio::common::AudioPort& port) const { const auto config = generateAudioDevicePortConfigs({port}, true); return *config.begin(); } @@ -117,26 +119,29 @@ class ModuleConfig { std::string toString() const; private: - std::vector generateInputAudioMixPortConfigs( - const std::vector& ports, + std::vector + generateInputAudioMixPortConfigs( + const std::vector& ports, bool singleProfile) const; - std::vector generateOutputAudioMixPortConfigs( - const std::vector& ports, + std::vector + generateOutputAudioMixPortConfigs( + const std::vector& ports, bool singleProfile) const; // Unlike MixPorts, the generator for DevicePorts always returns a non-empty // vector for a non-empty input port list. If there are no profiles in the // port, its initial configs are looked up, if there are none, // then an empty config is used, assuming further negotiation via setAudioPortConfig. - std::vector generateAudioDevicePortConfigs( - const std::vector& ports, + std::vector + generateAudioDevicePortConfigs( + const std::vector& ports, bool singleProfile) const; - android::binder::Status mStatus = android::binder::Status::ok(); - std::vector mPorts; - std::vector mInitialConfigs; + ndk::ScopedAStatus mStatus = ndk::ScopedAStatus::ok(); + std::vector mPorts; + std::vector mInitialConfigs; std::set mAttachedSinkDevicePorts; std::set mAttachedSourceDevicePorts; std::set mExternalDevicePorts; - std::vector mRoutes; + std::vector mRoutes; }; diff --git a/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp index 824ac8d3db..6be4e2f97a 100644 --- a/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp @@ -27,41 +27,48 @@ #include #include +#include +#include +#include +#include #include -#include -#include -#include -#include -#include -#include +#include +#include #include "ModuleConfig.h" using namespace android; -using android::binder::Status; -using android::hardware::audio::common::PlaybackTrackMetadata; -using android::hardware::audio::common::RecordTrackMetadata; -using android::hardware::audio::common::SinkMetadata; -using android::hardware::audio::common::SourceMetadata; -using android::hardware::audio::core::AudioPatch; -using android::hardware::audio::core::AudioRoute; -using android::hardware::audio::core::IModule; -using android::hardware::audio::core::IStreamIn; -using android::hardware::audio::core::IStreamOut; -using android::hardware::audio::core::ModuleDebug; -using android::media::audio::common::AudioContentType; -using android::media::audio::common::AudioDevice; -using android::media::audio::common::AudioDeviceAddress; -using android::media::audio::common::AudioDeviceType; -using android::media::audio::common::AudioFormatType; -using android::media::audio::common::AudioIoFlags; -using android::media::audio::common::AudioOutputFlags; -using android::media::audio::common::AudioPort; -using android::media::audio::common::AudioPortConfig; -using android::media::audio::common::AudioPortDeviceExt; -using android::media::audio::common::AudioPortExt; -using android::media::audio::common::AudioSource; -using android::media::audio::common::AudioUsage; +using aidl::android::hardware::audio::common::PlaybackTrackMetadata; +using aidl::android::hardware::audio::common::RecordTrackMetadata; +using aidl::android::hardware::audio::common::SinkMetadata; +using aidl::android::hardware::audio::common::SourceMetadata; +using aidl::android::hardware::audio::core::AudioPatch; +using aidl::android::hardware::audio::core::AudioRoute; +using aidl::android::hardware::audio::core::IModule; +using aidl::android::hardware::audio::core::IStreamIn; +using aidl::android::hardware::audio::core::IStreamOut; +using aidl::android::hardware::audio::core::ModuleDebug; +using aidl::android::media::audio::common::AudioContentType; +using aidl::android::media::audio::common::AudioDevice; +using aidl::android::media::audio::common::AudioDeviceAddress; +using aidl::android::media::audio::common::AudioDeviceType; +using aidl::android::media::audio::common::AudioFormatType; +using aidl::android::media::audio::common::AudioIoFlags; +using aidl::android::media::audio::common::AudioOutputFlags; +using aidl::android::media::audio::common::AudioPort; +using aidl::android::media::audio::common::AudioPortConfig; +using aidl::android::media::audio::common::AudioPortDeviceExt; +using aidl::android::media::audio::common::AudioPortExt; +using aidl::android::media::audio::common::AudioSource; +using aidl::android::media::audio::common::AudioUsage; +using ndk::ScopedAStatus; + +namespace ndk { +std::ostream& operator<<(std::ostream& str, const ScopedAStatus& status) { + str << status.getDescription(); + return str; +} +} // namespace ndk template auto findById(std::vector& v, int32_t id) { @@ -85,16 +92,23 @@ AudioDeviceAddress GenerateUniqueDeviceAddress() { return AudioDeviceAddress::make(std::to_string(++nextId)); } -struct AidlDeathRecipient : IBinder::DeathRecipient { +struct AidlDeathRecipient { + const ndk::SpAIBinder binder; + const ndk::ScopedAIBinder_DeathRecipient recipient; std::mutex mutex; std::condition_variable condition; bool fired = false; - wp who; - void binderDied(const wp& who) override { + explicit AidlDeathRecipient(const ndk::SpAIBinder& binder) + : binder(binder), recipient(AIBinder_DeathRecipient_new(&binderDiedCallbackAidl)) {} + + binder_status_t linkToDeath() { + return AIBinder_linkToDeath(binder.get(), recipient.get(), this); + } + + void binderDied() { std::unique_lock lock(mutex); fired = true; - this->who = who; condition.notify_one(); }; @@ -103,6 +117,11 @@ struct AidlDeathRecipient : IBinder::DeathRecipient { condition.wait_for(lock, std::chrono::milliseconds(timeoutMs), [this]() { return fired; }); return fired; } + + static void binderDiedCallbackAidl(void* cookie) { + AidlDeathRecipient* self = static_cast(cookie); + self->binderDied(); + } }; template @@ -127,13 +146,13 @@ class WithDebugFlags { : mInitial(initial.mFlags), mFlags(initial.mFlags) {} ~WithDebugFlags() { if (mModule != nullptr) { - Status status = mModule->setModuleDebug(mInitial); - EXPECT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + ScopedAStatus status = mModule->setModuleDebug(mInitial); + EXPECT_EQ(EX_NONE, status.getExceptionCode()) << status; } } void SetUp(IModule* module) { - Status status = module->setModuleDebug(mFlags); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + ScopedAStatus status = module->setModuleDebug(mFlags); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status; } ModuleDebug& flags() { return mFlags; } @@ -153,8 +172,8 @@ class WithAudioPortConfig { explicit WithAudioPortConfig(const AudioPortConfig& config) : mInitialConfig(config) {} ~WithAudioPortConfig() { if (mModule != nullptr) { - Status status = mModule->resetAudioPortConfig(getId()); - EXPECT_EQ(Status::EX_NONE, status.exceptionCode()) + ScopedAStatus status = mModule->resetAudioPortConfig(getId()); + EXPECT_EQ(EX_NONE, status.getExceptionCode()) << status << "; port config id " << getId(); } } @@ -174,8 +193,8 @@ class WithAudioPortConfig { if (mInitialConfig.id == 0) { AudioPortConfig suggested; bool applied = false; - Status status = module->setAudioPortConfig(mInitialConfig, &suggested, &applied); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) + ScopedAStatus status = module->setAudioPortConfig(mInitialConfig, &suggested, &applied); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status << "; Config: " << mInitialConfig.toString(); if (!applied && negotiate) { mInitialConfig = suggested; @@ -206,25 +225,26 @@ class AudioCoreModule : public testing::TestWithParam { void TearDown() override { if (module != nullptr) { - Status status = module->setModuleDebug(ModuleDebug{}); - EXPECT_EQ(Status::EX_NONE, status.exceptionCode()) + ScopedAStatus status = module->setModuleDebug(ModuleDebug{}); + EXPECT_EQ(EX_NONE, status.getExceptionCode()) << status << " returned when resetting debug flags"; } } void ConnectToService() { - module = android::waitForDeclaredService(String16(GetParam().c_str())); + module = IModule::fromBinder( + ndk::SpAIBinder(AServiceManager_getService(GetParam().c_str()))); ASSERT_NE(module, nullptr); } void RestartService() { ASSERT_NE(module, nullptr); moduleConfig.reset(); - deathHandler = sp::make(); - ASSERT_EQ(NO_ERROR, IModule::asBinder(module)->linkToDeath(deathHandler)); + deathHandler.reset(new AidlDeathRecipient(module->asBinder())); + ASSERT_EQ(STATUS_OK, deathHandler->linkToDeath()); ASSERT_TRUE(base::SetProperty("sys.audio.restart.hal", "1")); EXPECT_TRUE(deathHandler->waitForFired(3000)); - deathHandler = nullptr; + deathHandler.reset(); ASSERT_NO_FATAL_FAILURE(ConnectToService()); } @@ -235,8 +255,8 @@ class AudioCoreModule : public testing::TestWithParam { ASSERT_NO_FATAL_FAILURE(portConfig.SetUp(module.get())); // calls setAudioPortConfig EXPECT_EQ(config.portId, portConfig.get().portId); std::vector retrievedPortConfigs; - Status status = module->getAudioPortConfigs(&retrievedPortConfigs); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + ScopedAStatus status = module->getAudioPortConfigs(&retrievedPortConfigs); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status; const int32_t portConfigId = portConfig.getId(); auto configIt = std::find_if( retrievedPortConfigs.begin(), retrievedPortConfigs.end(), @@ -256,12 +276,12 @@ class AudioCoreModule : public testing::TestWithParam { template void GetAllEntityIds(std::set* entityIds, - Status (IModule::*getter)(std::vector*), + ScopedAStatus (IModule::*getter)(std::vector*), const std::string& errorMessage) { std::vector entities; { - Status status = (module.get()->*getter)(&entities); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + ScopedAStatus status = (module.get()->*getter)(&entities); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status; } std::transform(entities.begin(), entities.end(), std::inserter(*entityIds, entityIds->begin()), @@ -290,13 +310,13 @@ class AudioCoreModule : public testing::TestWithParam { void SetUpModuleConfig() { if (moduleConfig == nullptr) { moduleConfig = std::make_unique(module.get()); - ASSERT_EQ(Status::EX_NONE, moduleConfig->getStatus().exceptionCode()) + ASSERT_EQ(EX_NONE, moduleConfig->getStatus().getExceptionCode()) << "ModuleConfig init error: " << moduleConfig->getError(); } } - sp module; - sp deathHandler; + std::shared_ptr module; + std::unique_ptr deathHandler; std::unique_ptr moduleConfig; WithDebugFlags debug; }; @@ -308,14 +328,14 @@ class WithDevicePortConnectedState { : mIdAndData(setAudioPortAddress(id, address)) {} ~WithDevicePortConnectedState() { if (mModule != nullptr) { - Status status = mModule->disconnectExternalDevice(getId()); - EXPECT_EQ(Status::EX_NONE, status.exceptionCode()) + ScopedAStatus status = mModule->disconnectExternalDevice(getId()); + EXPECT_EQ(EX_NONE, status.getExceptionCode()) << status << " returned when disconnecting device port ID " << getId(); } } void SetUp(IModule* module) { - Status status = module->connectExternalDevice(mIdAndData, &mConnectedPort); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) + ScopedAStatus status = module->connectExternalDevice(mIdAndData, &mConnectedPort); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status << " returned when connecting device port ID & data " << mIdAndData.toString(); ASSERT_NE(mIdAndData.id, getId()) @@ -344,32 +364,36 @@ class WithStream { explicit WithStream(const AudioPortConfig& portConfig) : mPortConfig(portConfig) {} ~WithStream() { if (mStream != nullptr) { - Status status = mStream->close(); - EXPECT_EQ(Status::EX_NONE, status.exceptionCode()) + ScopedAStatus status = mStream->close(); + EXPECT_EQ(EX_NONE, status.getExceptionCode()) << status << "; port config id " << getPortId(); } } void SetUpPortConfig(IModule* module) { ASSERT_NO_FATAL_FAILURE(mPortConfig.SetUp(module)); } - Status SetUpNoChecks(IModule* module) { return SetUpNoChecks(module, mPortConfig.get()); } - Status SetUpNoChecks(IModule* module, const AudioPortConfig& portConfig); + ScopedAStatus SetUpNoChecks(IModule* module) { + return SetUpNoChecks(module, mPortConfig.get()); + } + ScopedAStatus SetUpNoChecks(IModule* module, const AudioPortConfig& portConfig); void SetUp(IModule* module) { ASSERT_NO_FATAL_FAILURE(SetUpPortConfig(module)); - Status status = SetUpNoChecks(module); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) + ScopedAStatus status = SetUpNoChecks(module); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status << "; port config id " << getPortId(); ASSERT_NE(nullptr, mStream) << "; port config id " << getPortId(); } Stream* get() const { return mStream.get(); } + std::shared_ptr getSharedPointer() const { return mStream; } const AudioPortConfig& getPortConfig() const { return mPortConfig.get(); } int32_t getPortId() const { return mPortConfig.getId(); } private: WithAudioPortConfig mPortConfig; - sp mStream; + std::shared_ptr mStream; }; template <> -Status WithStream::SetUpNoChecks(IModule* module, const AudioPortConfig& portConfig) { +ScopedAStatus WithStream::SetUpNoChecks(IModule* module, + const AudioPortConfig& portConfig) { RecordTrackMetadata trackMeta; trackMeta.source = AudioSource::MIC; trackMeta.gain = 1.0; @@ -380,7 +404,8 @@ Status WithStream::SetUpNoChecks(IModule* module, const AudioPortConf } template <> -Status WithStream::SetUpNoChecks(IModule* module, const AudioPortConfig& portConfig) { +ScopedAStatus WithStream::SetUpNoChecks(IModule* module, + const AudioPortConfig& portConfig) { PlaybackTrackMetadata trackMeta; trackMeta.usage = AudioUsage::MEDIA; trackMeta.contentType = AudioContentType::MUSIC; @@ -398,16 +423,15 @@ class WithAudioPatch { : mSrcPortConfig(srcPortConfig), mSinkPortConfig(sinkPortConfig) {} ~WithAudioPatch() { if (mModule != nullptr && mPatch.id != 0) { - Status status = mModule->resetAudioPatch(mPatch.id); - EXPECT_EQ(Status::EX_NONE, status.exceptionCode()) - << status << "; patch id " << getId(); + ScopedAStatus status = mModule->resetAudioPatch(mPatch.id); + EXPECT_EQ(EX_NONE, status.getExceptionCode()) << status << "; patch id " << getId(); } } void SetUpPortConfigs(IModule* module) { ASSERT_NO_FATAL_FAILURE(mSrcPortConfig.SetUp(module)); ASSERT_NO_FATAL_FAILURE(mSinkPortConfig.SetUp(module)); } - Status SetUpNoChecks(IModule* module) { + ScopedAStatus SetUpNoChecks(IModule* module) { mModule = module; mPatch.sourcePortConfigIds = std::vector{mSrcPortConfig.getId()}; mPatch.sinkPortConfigIds = std::vector{mSinkPortConfig.getId()}; @@ -415,8 +439,8 @@ class WithAudioPatch { } void SetUp(IModule* module) { ASSERT_NO_FATAL_FAILURE(SetUpPortConfigs(module)); - Status status = SetUpNoChecks(module); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) + ScopedAStatus status = SetUpNoChecks(module); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status << "; source port config id " << mSrcPortConfig.getId() << "; sink port config id " << mSinkPortConfig.getId(); } @@ -446,13 +470,13 @@ TEST_P(AudioCoreModule, PortIdsAreUnique) { TEST_P(AudioCoreModule, GetAudioPortsIsStable) { std::vector ports1; { - Status status = module->getAudioPorts(&ports1); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + ScopedAStatus status = module->getAudioPorts(&ports1); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status; } std::vector ports2; { - Status status = module->getAudioPorts(&ports2); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + ScopedAStatus status = module->getAudioPorts(&ports2); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status; } ASSERT_EQ(ports1.size(), ports2.size()) << "Sizes of audio port arrays do not match across consequent calls to getAudioPorts"; @@ -464,13 +488,13 @@ TEST_P(AudioCoreModule, GetAudioPortsIsStable) { TEST_P(AudioCoreModule, GetAudioRoutesIsStable) { std::vector routes1; { - Status status = module->getAudioRoutes(&routes1); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + ScopedAStatus status = module->getAudioRoutes(&routes1); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status; } std::vector routes2; { - Status status = module->getAudioRoutes(&routes2); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + ScopedAStatus status = module->getAudioRoutes(&routes2); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status; } ASSERT_EQ(routes1.size(), routes2.size()) << "Sizes of audio route arrays do not match across consequent calls to getAudioRoutes"; @@ -482,8 +506,8 @@ TEST_P(AudioCoreModule, GetAudioRoutesIsStable) { TEST_P(AudioCoreModule, GetAudioRoutesAreValid) { std::vector routes; { - Status status = module->getAudioRoutes(&routes); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + ScopedAStatus status = module->getAudioRoutes(&routes); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status; } for (const auto& route : routes) { std::set sources(route.sourcePortIds.begin(), route.sourcePortIds.end()); @@ -500,8 +524,8 @@ TEST_P(AudioCoreModule, GetAudioRoutesPortIdsAreValid) { ASSERT_NO_FATAL_FAILURE(GetAllPortIds(&portIds)); std::vector routes; { - Status status = module->getAudioRoutes(&routes); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + ScopedAStatus status = module->getAudioRoutes(&routes); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status; } for (const auto& route : routes) { EXPECT_EQ(1, portIds.count(route.sinkPortId)) @@ -520,8 +544,8 @@ TEST_P(AudioCoreModule, GetAudioRoutesForAudioPort) { } for (const auto portId : portIds) { std::vector routes; - Status status = module->getAudioRoutesForAudioPort(portId, &routes); - EXPECT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + ScopedAStatus status = module->getAudioRoutesForAudioPort(portId, &routes); + EXPECT_EQ(EX_NONE, status.getExceptionCode()) << status; for (const auto& r : routes) { if (r.sinkPortId != portId) { const auto& srcs = r.sourcePortIds; @@ -532,8 +556,8 @@ TEST_P(AudioCoreModule, GetAudioRoutesForAudioPort) { } for (const auto portId : GetNonExistentIds(portIds)) { std::vector routes; - Status status = module->getAudioRoutesForAudioPort(portId, &routes); - EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + ScopedAStatus status = module->getAudioRoutesForAudioPort(portId, &routes); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << " returned for port ID " << portId; } } @@ -541,8 +565,8 @@ TEST_P(AudioCoreModule, GetAudioRoutesForAudioPort) { TEST_P(AudioCoreModule, CheckDevicePorts) { std::vector ports; { - Status status = module->getAudioPorts(&ports); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + ScopedAStatus status = module->getAudioPorts(&ports); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status; } std::optional defaultOutput, defaultInput; std::set inputs, outputs; @@ -590,8 +614,8 @@ TEST_P(AudioCoreModule, CheckDevicePorts) { TEST_P(AudioCoreModule, CheckMixPorts) { std::vector ports; { - Status status = module->getAudioPorts(&ports); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + ScopedAStatus status = module->getAudioPorts(&ports); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status; } std::optional primaryMixPort; constexpr int primaryOutputFlag = 1 << static_cast(AudioOutputFlags::PRIMARY); @@ -619,14 +643,14 @@ TEST_P(AudioCoreModule, GetAudioPort) { } for (const auto portId : portIds) { AudioPort port; - Status status = module->getAudioPort(portId, &port); - EXPECT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + ScopedAStatus status = module->getAudioPort(portId, &port); + EXPECT_EQ(EX_NONE, status.getExceptionCode()) << status; EXPECT_EQ(portId, port.id); } for (const auto portId : GetNonExistentIds(portIds)) { AudioPort port; - Status status = module->getAudioPort(portId, &port); - EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + ScopedAStatus status = module->getAudioPort(portId, &port); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << " returned for port ID " << portId; } } @@ -653,8 +677,8 @@ TEST_P(AudioCoreModule, GetAudioPortWithExternalDevices) { portConnected.get().ext.get().device); // Verify that 'getAudioPort' and 'getAudioPorts' return the same connected port. AudioPort connectedPort; - Status status = module->getAudioPort(connectedPortId, &connectedPort); - EXPECT_EQ(Status::EX_NONE, status.exceptionCode()) + ScopedAStatus status = module->getAudioPort(connectedPortId, &connectedPort); + EXPECT_EQ(EX_NONE, status.getExceptionCode()) << status << " returned for getAudioPort port ID " << connectedPortId; EXPECT_EQ(portConnected.get(), connectedPort); const auto& portProfiles = connectedPort.profiles; @@ -669,8 +693,8 @@ TEST_P(AudioCoreModule, GetAudioPortWithExternalDevices) { std::vector allPorts; { - Status status = module->getAudioPorts(&allPorts); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + ScopedAStatus status = module->getAudioPorts(&allPorts); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status; } const auto allPortsIt = findById(allPorts, connectedPortId); EXPECT_NE(allPorts.end(), allPortsIt); @@ -685,16 +709,16 @@ TEST_P(AudioCoreModule, OpenStreamInvalidPortConfigId) { ASSERT_NO_FATAL_FAILURE(GetAllPortConfigIds(&portConfigIds)); for (const auto portConfigId : GetNonExistentIds(portConfigIds)) { { - sp stream; - Status status = module->openInputStream(portConfigId, {}, &stream); - EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + std::shared_ptr stream; + ScopedAStatus status = module->openInputStream(portConfigId, {}, &stream); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << " openInputStream returned for port config ID " << portConfigId; EXPECT_EQ(nullptr, stream); } { - sp stream; - Status status = module->openOutputStream(portConfigId, {}, {}, &stream); - EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + std::shared_ptr stream; + ScopedAStatus status = module->openOutputStream(portConfigId, {}, {}, &stream); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << " openOutputStream returned for port config ID " << portConfigId; EXPECT_EQ(nullptr, stream); } @@ -711,8 +735,8 @@ TEST_P(AudioCoreModule, PortConfigPortIdsAreValid) { ASSERT_NO_FATAL_FAILURE(GetAllPortIds(&portIds)); std::vector portConfigs; { - Status status = module->getAudioPortConfigs(&portConfigs); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + ScopedAStatus status = module->getAudioPortConfigs(&portConfigs); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status; } for (const auto& config : portConfigs) { EXPECT_EQ(1, portIds.count(config.portId)) @@ -724,8 +748,8 @@ TEST_P(AudioCoreModule, ResetAudioPortConfigInvalidId) { std::set portConfigIds; ASSERT_NO_FATAL_FAILURE(GetAllPortConfigIds(&portConfigIds)); for (const auto portConfigId : GetNonExistentIds(portConfigIds)) { - Status status = module->resetAudioPortConfig(portConfigId); - EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + ScopedAStatus status = module->resetAudioPortConfig(portConfigId); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << " returned for port config ID " << portConfigId; } } @@ -735,19 +759,19 @@ TEST_P(AudioCoreModule, ResetAudioPortConfigInvalidId) { TEST_P(AudioCoreModule, ResetAudioPortConfigToInitialValue) { std::vector portConfigsBefore; { - Status status = module->getAudioPortConfigs(&portConfigsBefore); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + ScopedAStatus status = module->getAudioPortConfigs(&portConfigsBefore); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status; } // TODO: Change port configs according to port profiles. for (const auto& c : portConfigsBefore) { - Status status = module->resetAudioPortConfig(c.id); - EXPECT_EQ(Status::EX_NONE, status.exceptionCode()) + ScopedAStatus status = module->resetAudioPortConfig(c.id); + EXPECT_EQ(EX_NONE, status.getExceptionCode()) << status << " returned for port config ID " << c.id; } std::vector portConfigsAfter; { - Status status = module->getAudioPortConfigs(&portConfigsAfter); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + ScopedAStatus status = module->getAudioPortConfigs(&portConfigsAfter); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status; } for (const auto& c : portConfigsBefore) { auto afterIt = findById(portConfigsAfter, c.id); @@ -770,8 +794,8 @@ TEST_P(AudioCoreModule, SetAudioPortConfigSuggestedConfig) { portConfig.portId = srcMixPort.value().id; { bool applied = true; - Status status = module->setAudioPortConfig(portConfig, &suggestedConfig, &applied); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) + ScopedAStatus status = module->setAudioPortConfig(portConfig, &suggestedConfig, &applied); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status << "; Config: " << portConfig.toString(); EXPECT_FALSE(applied); } @@ -826,8 +850,8 @@ TEST_P(AudioCoreModule, SetAudioPortConfigInvalidPortId) { AudioPortConfig portConfig, suggestedConfig; bool applied; portConfig.portId = portId; - Status status = module->setAudioPortConfig(portConfig, &suggestedConfig, &applied); - EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + ScopedAStatus status = module->setAudioPortConfig(portConfig, &suggestedConfig, &applied); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << " returned for port ID " << portId; EXPECT_FALSE(suggestedConfig.format.has_value()); EXPECT_FALSE(suggestedConfig.channelMask.has_value()); @@ -842,8 +866,8 @@ TEST_P(AudioCoreModule, SetAudioPortConfigInvalidPortConfigId) { AudioPortConfig portConfig, suggestedConfig; bool applied; portConfig.id = portConfigId; - Status status = module->setAudioPortConfig(portConfig, &suggestedConfig, &applied); - EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + ScopedAStatus status = module->setAudioPortConfig(portConfig, &suggestedConfig, &applied); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << " returned for port config ID " << portConfigId; EXPECT_FALSE(suggestedConfig.format.has_value()); EXPECT_FALSE(suggestedConfig.channelMask.has_value()); @@ -865,8 +889,8 @@ TEST_P(AudioCoreModule, TryConnectMissingDevice) { AudioPort portWithData = port; portWithData.ext.get().device.address = GenerateUniqueDeviceAddress(); - Status status = module->connectExternalDevice(portWithData, &ignored); - EXPECT_EQ(Status::EX_ILLEGAL_STATE, status.exceptionCode()) + ScopedAStatus status = module->connectExternalDevice(portWithData, &ignored); + EXPECT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode()) << status << " returned for static port " << portWithData.toString(); } } @@ -881,8 +905,8 @@ TEST_P(AudioCoreModule, TryChangingConnectionSimulationMidway) { ASSERT_NO_FATAL_FAILURE(portConnected.SetUp(module.get())); ModuleDebug midwayDebugChange = debug.flags(); midwayDebugChange.simulateDeviceConnections = false; - Status status = module->setModuleDebug(midwayDebugChange); - EXPECT_EQ(Status::EX_ILLEGAL_STATE, status.exceptionCode()) + ScopedAStatus status = module->setModuleDebug(midwayDebugChange); + EXPECT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode()) << status << " returned when trying to disable connections simulation " << "while having a connected device"; } @@ -894,39 +918,39 @@ TEST_P(AudioCoreModule, ConnectDisconnectExternalDeviceInvalidPorts) { for (const auto portId : GetNonExistentIds(portIds)) { AudioPort invalidPort; invalidPort.id = portId; - Status status = module->connectExternalDevice(invalidPort, &ignored); - EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + ScopedAStatus status = module->connectExternalDevice(invalidPort, &ignored); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << " returned for port ID " << portId << " when setting CONNECTED state"; status = module->disconnectExternalDevice(portId); - EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << " returned for port ID " << portId << " when setting DISCONNECTED state"; } std::vector ports; { - Status status = module->getAudioPorts(&ports); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + ScopedAStatus status = module->getAudioPorts(&ports); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status; } for (const auto& port : ports) { if (port.ext.getTag() != AudioPortExt::Tag::device) { - Status status = module->connectExternalDevice(port, &ignored); - EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + ScopedAStatus status = module->connectExternalDevice(port, &ignored); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << " returned for non-device port ID " << port.id << " when setting CONNECTED state"; status = module->disconnectExternalDevice(port.id); - EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << " returned for non-device port ID " << port.id << " when setting DISCONNECTED state"; } else { const auto& devicePort = port.ext.get(); if (devicePort.device.type.connection.empty()) { - Status status = module->connectExternalDevice(port, &ignored); - EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + ScopedAStatus status = module->connectExternalDevice(port, &ignored); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << " returned for permanently attached device port ID " << port.id << " when setting CONNECTED state"; status = module->disconnectExternalDevice(port.id); - EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << " returned for permanently attached device port ID " << port.id << " when setting DISCONNECTED state"; } @@ -943,8 +967,8 @@ TEST_P(AudioCoreModule, ConnectDisconnectExternalDeviceTwice) { GTEST_SKIP() << "No external devices in the module."; } for (const auto& port : ports) { - Status status = module->disconnectExternalDevice(port.id); - EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + ScopedAStatus status = module->disconnectExternalDevice(port.id); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << " returned when disconnecting already disconnected device port ID " << port.id; AudioPort portWithData = port; @@ -953,14 +977,14 @@ TEST_P(AudioCoreModule, ConnectDisconnectExternalDeviceTwice) { WithDevicePortConnectedState portConnected(portWithData); ASSERT_NO_FATAL_FAILURE(portConnected.SetUp(module.get())); status = module->connectExternalDevice(portConnected.get(), &ignored); - EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << " returned when trying to connect a connected device port " << portConnected.get().toString(); status = module->connectExternalDevice(portWithData, &ignored); - EXPECT_EQ(Status::EX_ILLEGAL_STATE, status.exceptionCode()) + EXPECT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode()) << status << " returned when connecting again the external device " << portWithData.ext.get().device.toString(); - if (status.exceptionCode() == Status::EX_NONE) { + if (status.getExceptionCode() == EX_NONE) { ADD_FAILURE() << "Returned connected port " << ignored.toString() << " for template " << portWithData.toString(); } @@ -984,8 +1008,8 @@ TEST_P(AudioCoreModule, DisconnectExternalDeviceNonResetPortConfig) { // Our test assumes that 'getAudioPort' returns at least one profile, and it // is not a dynamic profile. ASSERT_NO_FATAL_FAILURE(config.SetUp(module.get())); - Status status = module->disconnectExternalDevice(portConnected.getId()); - EXPECT_EQ(Status::EX_ILLEGAL_STATE, status.exceptionCode()) + ScopedAStatus status = module->disconnectExternalDevice(portConnected.getId()); + EXPECT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode()) << status << " returned when trying to disconnect device port ID " << port.id << " with active configuration " << config.getId(); } @@ -1001,8 +1025,8 @@ TEST_P(AudioCoreModule, ExternalDevicePortRoutes) { for (const auto& port : ports) { std::vector routesBefore; { - Status status = module->getAudioRoutes(&routesBefore); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + ScopedAStatus status = module->getAudioRoutes(&routesBefore); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status; } int32_t connectedPortId; @@ -1012,32 +1036,32 @@ TEST_P(AudioCoreModule, ExternalDevicePortRoutes) { connectedPortId = portConnected.getId(); std::vector connectedPortRoutes; { - Status status = + ScopedAStatus status = module->getAudioRoutesForAudioPort(connectedPortId, &connectedPortRoutes); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status << " returned when retrieving routes for connected port id " << connectedPortId; } // There must be routes for the port to be useful. if (connectedPortRoutes.empty()) { std::vector allRoutes; - Status status = module->getAudioRoutes(&allRoutes); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + ScopedAStatus status = module->getAudioRoutes(&allRoutes); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status; ADD_FAILURE() << " no routes returned for the connected port " << portConnected.get().toString() << "; all routes: " << android::internal::ToString(allRoutes); } } std::vector ignored; - Status status = module->getAudioRoutesForAudioPort(connectedPortId, &ignored); - ASSERT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + ScopedAStatus status = module->getAudioRoutesForAudioPort(connectedPortId, &ignored); + ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << " returned when retrieving routes for released connected port id " << connectedPortId; std::vector routesAfter; { - Status status = module->getAudioRoutes(&routesAfter); - ASSERT_EQ(Status::EX_NONE, status.exceptionCode()) << status; + ScopedAStatus status = module->getAudioRoutes(&routesAfter); + ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status; } ASSERT_EQ(routesBefore.size(), routesAfter.size()) << "Sizes of audio route arrays do not match after creating and " @@ -1063,14 +1087,14 @@ class AudioStream : public AudioCoreModule { if (!portConfig.has_value()) { GTEST_SKIP() << "No mix port for attached devices"; } - sp heldStream; + std::shared_ptr heldStream; { WithStream stream(portConfig.value()); ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get())); - heldStream = stream.get(); + heldStream = stream.getSharedPointer(); } - Status status = heldStream->close(); - EXPECT_EQ(Status::EX_ILLEGAL_STATE, status.exceptionCode()) + ScopedAStatus status = heldStream->close(); + EXPECT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode()) << status << " when closing the stream twice"; } @@ -1107,8 +1131,8 @@ class AudioStream : public AudioCoreModule { ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get())); } else { ASSERT_NO_FATAL_FAILURE(stream.SetUpPortConfig(module.get())); - Status status = stream.SetUpNoChecks(module.get()); - EXPECT_EQ(Status::EX_ILLEGAL_STATE, status.exceptionCode()) + ScopedAStatus status = stream.SetUpNoChecks(module.get()); + EXPECT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode()) << status << " open" << direction(true) << "Stream" " returned for port config ID " @@ -1130,8 +1154,8 @@ class AudioStream : public AudioCoreModule { } WithStream stream(portConfig.value()); ASSERT_NO_FATAL_FAILURE(stream.SetUpPortConfig(module.get())); - Status status = stream.SetUpNoChecks(module.get()); - EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + ScopedAStatus status = stream.SetUpNoChecks(module.get()); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << " open" << direction(true) << "Stream returned for port config ID " << stream.getPortId(); EXPECT_EQ(nullptr, stream.get()); @@ -1152,8 +1176,8 @@ class AudioStream : public AudioCoreModule { } WithStream stream(portConfig.value()); ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get())); - Status status = module->resetAudioPortConfig(stream.getPortId()); - EXPECT_EQ(Status::EX_ILLEGAL_STATE, status.exceptionCode()) + ScopedAStatus status = module->resetAudioPortConfig(stream.getPortId()); + EXPECT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode()) << status << " returned for port config ID " << stream.getPortId(); } @@ -1161,8 +1185,8 @@ class AudioStream : public AudioCoreModule { WithStream stream1(portConfig); ASSERT_NO_FATAL_FAILURE(stream1.SetUp(module.get())); WithStream stream2; - Status status = stream2.SetUpNoChecks(module.get(), stream1.getPortConfig()); - EXPECT_EQ(Status::EX_ILLEGAL_STATE, status.exceptionCode()) + ScopedAStatus status = stream2.SetUpNoChecks(module.get(), stream1.getPortConfig()); + EXPECT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode()) << status << " when opening " << direction(false) << " stream twice for the same port config ID " << stream1.getPortId(); } @@ -1226,8 +1250,8 @@ class AudioModulePatch : public AudioCoreModule { AudioPatch patch; patch.sourcePortConfigIds = sources; patch.sinkPortConfigIds = sinks; - Status status = module->setAudioPatch(patch, &patch); - ASSERT_EQ(expectedException, status.exceptionCode()) + ScopedAStatus status = module->setAudioPatch(patch, &patch); + ASSERT_EQ(expectedException, status.getExceptionCode()) << status << ": patch source ids: " << android::internal::ToString(sources) << "; sink ids: " << android::internal::ToString(sinks); } @@ -1246,8 +1270,8 @@ class AudioModulePatch : public AudioCoreModule { patch.get().sinkPortConfigIds.begin(), patch.get().sinkPortConfigIds.end()); for (const auto portConfigId : sourceAndSinkPortConfigIds) { - Status status = module->resetAudioPortConfig(portConfigId); - EXPECT_EQ(Status::EX_ILLEGAL_STATE, status.exceptionCode()) + ScopedAStatus status = module->resetAudioPortConfig(portConfigId); + EXPECT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode()) << status << " returned for port config ID " << portConfigId; } } @@ -1266,22 +1290,22 @@ class AudioModulePatch : public AudioCoreModule { ASSERT_NO_FATAL_FAILURE(patch.SetUp(module.get())); } EXPECT_NO_FATAL_FAILURE( - SetInvalidPatchHelper(Status::EX_ILLEGAL_ARGUMENT, {}, {sinkPortConfig.getId()})); + SetInvalidPatchHelper(EX_ILLEGAL_ARGUMENT, {}, {sinkPortConfig.getId()})); EXPECT_NO_FATAL_FAILURE(SetInvalidPatchHelper( - Status::EX_ILLEGAL_ARGUMENT, {srcPortConfig.getId(), srcPortConfig.getId()}, + EX_ILLEGAL_ARGUMENT, {srcPortConfig.getId(), srcPortConfig.getId()}, {sinkPortConfig.getId()})); EXPECT_NO_FATAL_FAILURE( - SetInvalidPatchHelper(Status::EX_ILLEGAL_ARGUMENT, {srcPortConfig.getId()}, {})); + SetInvalidPatchHelper(EX_ILLEGAL_ARGUMENT, {srcPortConfig.getId()}, {})); EXPECT_NO_FATAL_FAILURE( - SetInvalidPatchHelper(Status::EX_ILLEGAL_ARGUMENT, {srcPortConfig.getId()}, + SetInvalidPatchHelper(EX_ILLEGAL_ARGUMENT, {srcPortConfig.getId()}, {sinkPortConfig.getId(), sinkPortConfig.getId()})); std::set portConfigIds; ASSERT_NO_FATAL_FAILURE(GetAllPortConfigIds(&portConfigIds)); for (const auto portConfigId : GetNonExistentIds(portConfigIds)) { - EXPECT_NO_FATAL_FAILURE(SetInvalidPatchHelper( - Status::EX_ILLEGAL_ARGUMENT, {portConfigId}, {sinkPortConfig.getId()})); - EXPECT_NO_FATAL_FAILURE(SetInvalidPatchHelper(Status::EX_ILLEGAL_ARGUMENT, + EXPECT_NO_FATAL_FAILURE(SetInvalidPatchHelper(EX_ILLEGAL_ARGUMENT, {portConfigId}, + {sinkPortConfig.getId()})); + EXPECT_NO_FATAL_FAILURE(SetInvalidPatchHelper(EX_ILLEGAL_ARGUMENT, {srcPortConfig.getId()}, {portConfigId})); } } @@ -1293,8 +1317,8 @@ class AudioModulePatch : public AudioCoreModule { } WithAudioPatch patch(srcSinkPair.value().first, srcSinkPair.value().second); ASSERT_NO_FATAL_FAILURE(patch.SetUpPortConfigs(module.get())); - Status status = patch.SetUpNoChecks(module.get()); - EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + ScopedAStatus status = patch.SetUpNoChecks(module.get()); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << ": when setting up a patch from " << srcSinkPair.value().first.toString() << " to " << srcSinkPair.value().second.toString() << " that does not have a route"; @@ -1351,8 +1375,9 @@ class AudioModulePatch : public AudioCoreModule { for (const auto patchId : GetNonExistentIds(patchIds)) { AudioPatch patchWithNonExistendId = patch.get(); patchWithNonExistendId.id = patchId; - Status status = module->setAudioPatch(patchWithNonExistendId, &patchWithNonExistendId); - EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + ScopedAStatus status = + module->setAudioPatch(patchWithNonExistendId, &patchWithNonExistendId); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << " returned for patch ID " << patchId; } } @@ -1375,8 +1400,8 @@ TEST_P(AudioModulePatch, ResetInvalidPatchId) { std::set patchIds; ASSERT_NO_FATAL_FAILURE(GetAllPatchIds(&patchIds)); for (const auto patchId : GetNonExistentIds(patchIds)) { - Status status = module->resetAudioPatch(patchId); - EXPECT_EQ(Status::EX_ILLEGAL_ARGUMENT, status.exceptionCode()) + ScopedAStatus status = module->resetAudioPatch(patchId); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << " returned for patch ID " << patchId; } } @@ -1400,7 +1425,7 @@ GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioModulePatch); int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); - ProcessState::self()->setThreadPoolMaxThreadCount(1); - ProcessState::self()->startThreadPool(); + ABinderProcess_setThreadPoolMaxThreadCount(1); + ABinderProcess_startThreadPool(); return RUN_ALL_TESTS(); } From 84ed3d032be38f68451810d071ff0941c18e7680 Mon Sep 17 00:00:00 2001 From: Aaron Tsai Date: Tue, 26 Apr 2022 12:24:05 +0000 Subject: [PATCH 097/998] Fix VTS build error for the new IRadioNetwork V2 APIs Bug: 227110409 Test: make vts Change-Id: I89a47a27c0bfc18799fd80e39bfd2376ad211eaf --- radio/aidl/vts/radio_network_indication.cpp | 5 +++++ radio/aidl/vts/radio_network_response.cpp | 24 +++++++++++++++++++++ radio/aidl/vts/radio_network_utils.h | 8 +++++++ 3 files changed, 37 insertions(+) diff --git a/radio/aidl/vts/radio_network_indication.cpp b/radio/aidl/vts/radio_network_indication.cpp index 7acbff4b2e..73c9ec8781 100644 --- a/radio/aidl/vts/radio_network_indication.cpp +++ b/radio/aidl/vts/radio_network_indication.cpp @@ -92,3 +92,8 @@ ndk::ScopedAStatus RadioNetworkIndication::voiceRadioTechChanged(RadioIndication RadioTechnology /*rat*/) { return ndk::ScopedAStatus::ok(); } + +ndk::ScopedAStatus RadioNetworkIndication::emergencyNetworkScanResult(RadioIndicationType /*type*/, + const EmergencyRegResult& /*result*/) { + return ndk::ScopedAStatus::ok(); +} diff --git a/radio/aidl/vts/radio_network_response.cpp b/radio/aidl/vts/radio_network_response.cpp index 2292c549ca..1baf31c275 100644 --- a/radio/aidl/vts/radio_network_response.cpp +++ b/radio/aidl/vts/radio_network_response.cpp @@ -266,3 +266,27 @@ ndk::ScopedAStatus RadioNetworkResponse::supplyNetworkDepersonalizationResponse( parent_network.notify(info.serial); return ndk::ScopedAStatus::ok(); } + +ndk::ScopedAStatus RadioNetworkResponse::setEmergencyModeResponse(const RadioResponseInfo& info, const EmergencyRegResult& /*regState*/) { + rspInfo = info; + parent_network.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioNetworkResponse::triggerEmergencyNetworkScanResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_network.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioNetworkResponse::exitEmergencyModeResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_network.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioNetworkResponse::cancelEmergencyNetworkScanResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_network.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} diff --git a/radio/aidl/vts/radio_network_utils.h b/radio/aidl/vts/radio_network_utils.h index 29f20e8dbd..3888a6e3bf 100644 --- a/radio/aidl/vts/radio_network_utils.h +++ b/radio/aidl/vts/radio_network_utils.h @@ -147,6 +147,11 @@ class RadioNetworkResponse : public BnRadioNetworkResponse { virtual ndk::ScopedAStatus supplyNetworkDepersonalizationResponse( const RadioResponseInfo& info, int32_t remainingRetries) override; + + virtual ndk::ScopedAStatus setEmergencyModeResponse(const RadioResponseInfo& info, const EmergencyRegResult& regState) override; + virtual ndk::ScopedAStatus triggerEmergencyNetworkScanResponse(const RadioResponseInfo& info) override; + virtual ndk::ScopedAStatus exitEmergencyModeResponse(const RadioResponseInfo& info) override; + virtual ndk::ScopedAStatus cancelEmergencyNetworkScanResponse(const RadioResponseInfo& info) override; }; /* Callback class for radio network indication */ @@ -201,6 +206,9 @@ class RadioNetworkIndication : public BnRadioNetworkIndication { virtual ndk::ScopedAStatus voiceRadioTechChanged(RadioIndicationType type, RadioTechnology rat) override; + + virtual ndk::ScopedAStatus emergencyNetworkScanResult(RadioIndicationType type, + const EmergencyRegResult& result) override; }; // The main test class for Radio AIDL Network. From 3d8f7ff5891e286b6c434f86c5dd9c5bdf4fb57f Mon Sep 17 00:00:00 2001 From: Helen Date: Wed, 20 Apr 2022 10:06:00 +0000 Subject: [PATCH 098/998] Add Evs-mode-switch, receivedDTMF and ANBRbitrate to ImsMedia APIs for interworking with vendor RTP stacks Bug: 224905346, 224901121, 230266546 Test: Build Change-Id: Ib183ec68d4c6344d8bed9c6c5ff51d76b5c983a2 --- .../hardware/radio/ims/media/AnbrBitrate.aidl | 40 +++++++++++++++++++ .../hardware/radio/ims/media/EvsParams.aidl | 1 + .../ims/media/IImsMediaSessionListener.aidl | 2 + .../hardware/radio/ims/media/RtpConfig.aidl | 1 + .../hardware/radio/ims/media/AnbrBitrate.aidl | 28 +++++++++++++ .../hardware/radio/ims/media/EvsParams.aidl | 7 +++- .../ims/media/IImsMediaSessionListener.aidl | 28 ++++++++++--- .../hardware/radio/ims/media/RtpConfig.aidl | 17 ++++++++ 8 files changed, 117 insertions(+), 7 deletions(-) create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl new file mode 100644 index 0000000000..598d99584c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable AnbrBitrate { + const int INVALID_ANBR_BITRATE = -1; + int uplinkBps; + int downlinkBps; +} \ No newline at end of file diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl index 8d5124b247..33631232eb 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl @@ -39,4 +39,5 @@ parcelable EvsParams { byte channelAwareMode; boolean useHeaderFullOnlyOnTx; boolean useHeaderFullOnlyOnRx; + boolean useEvsModeSwitch; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl index bb51ca4278..2266a6e53e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl @@ -43,4 +43,6 @@ interface IImsMediaSessionListener { oneway void notifyMediaInactivity(android.hardware.radio.ims.media.MediaProtocolType packetType); oneway void notifyPacketLoss(int packetLossPercentage); oneway void notifyJitter(int jitter); + oneway void triggerAnbrQuery(in android.hardware.radio.ims.media.RtpConfig config); + oneway void onDtmfReceived(char dtmfDigit); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl index 4b803788c2..ad8b86ccd5 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl @@ -39,4 +39,5 @@ parcelable RtpConfig { android.hardware.radio.ims.media.RtpAddress remoteAddress; android.hardware.radio.ims.media.RtpSessionParams sessionParams; android.hardware.radio.ims.media.RtcpConfig rtcpConfig; + android.hardware.radio.ims.media.AnbrBitrate anbrBitrateParams; } diff --git a/radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl b/radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl new file mode 100644 index 0000000000..61239d0b73 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl @@ -0,0 +1,28 @@ +/* + * 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. + */ + +package android.hardware.radio.ims.media; + +@VintfStability +parcelable AnbrBitrate { + /** default value to represent NOT_SET */ + const int INVALID_ANBR_BITRATE = -1; + + /** Received bitrate in seconds for Uplink from NW or peer UE for ANBR */ + int uplinkBps; + /** Received bitrate in secondsfor Downlink from NW or peer UE for ANBR */ + int downlinkBps; +} diff --git a/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl b/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl index ecbb958285..4a4d71b27d 100644 --- a/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl @@ -16,8 +16,8 @@ package android.hardware.radio.ims.media; -import android.hardware.radio.ims.media.EvsMode; import android.hardware.radio.ims.media.EvsBandwidth; +import android.hardware.radio.ims.media.EvsMode; @VintfStability parcelable EvsParams { @@ -48,4 +48,9 @@ parcelable EvsParams { * both header full format and compact format. */ boolean useHeaderFullOnlyOnRx; + /** + * evs-mode-switch: Used for switching between EVS Primary mode and EVS AMR-WB IO mode, + * If this value is true, the codec operates in AMR-WB IO mode + */ + boolean useEvsModeSwitch; } diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl index c2d2a3b477..850a874885 100644 --- a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl @@ -17,9 +17,9 @@ package android.hardware.radio.ims.media; import android.hardware.radio.ims.media.MediaProtocolType; -import android.hardware.radio.ims.media.RtpHeaderExtension; import android.hardware.radio.ims.media.RtpConfig; import android.hardware.radio.ims.media.RtpError; +import android.hardware.radio.ims.media.RtpHeaderExtension; import android.hardware.radio.ims.media.RtpSessionState; /** @@ -32,7 +32,7 @@ oneway interface IImsMediaSessionListener { * * @param state RTP session state */ - void onSessionChanged(RtpSessionState state); + void onSessionChanged(RtpSessionState state); /** * Notifies the result of IImsMediaSession#modifySession() API. @@ -87,7 +87,7 @@ oneway interface IImsMediaSessionListener { * * @param extensions content of the received RTP header extension */ - void onHeaderExtensionReceived(in List extensions); + void onHeaderExtensionReceived(in List extensions); /** * Notifies media inactivity observed as per thresholds set by @@ -95,7 +95,7 @@ oneway interface IImsMediaSessionListener { * * @param packetType either RTP or RTCP */ - void notifyMediaInactivity(MediaProtocolType packetType); + void notifyMediaInactivity(MediaProtocolType packetType); /** * Notifies RTP packet loss observed as per thresholds set by @@ -103,7 +103,7 @@ oneway interface IImsMediaSessionListener { * * @param packetLossPercentage percentage of packet loss calculated over the duration */ - void notifyPacketLoss(int packetLossPercentage); + void notifyPacketLoss(int packetLossPercentage); /** * Notifies RTP jitter observed as per thresholds set by @@ -111,5 +111,21 @@ oneway interface IImsMediaSessionListener { * * @param jitter jitter of the RTP packets in milliseconds calculated over the duration */ - void notifyJitter(int jitter); + void notifyJitter(int jitter); + + /** + * The modem RTP stack fires this API to query whether the desired bitrate mentioned + * in the RtpConfig is currently available on the NW or not using ANBRQ message. + * See 3GPP TS 26.114. + * + * @param config containing desired bitrate and direction + */ + void triggerAnbrQuery(in RtpConfig config); + + /** + * Notifies the received DTMF digit from the other party + * + * @param dtmfDigit single char having one of 12 values: 0-9, *, # + */ + void onDtmfReceived(char dtmfDigit); } diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl index 52ca712125..d0d849ed5a 100644 --- a/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl @@ -17,6 +17,7 @@ package android.hardware.radio.ims.media; import android.hardware.radio.AccessNetwork; +import android.hardware.radio.ims.media.AnbrBitrate; import android.hardware.radio.ims.media.MediaDirection; import android.hardware.radio.ims.media.RtcpConfig; import android.hardware.radio.ims.media.RtpAddress; @@ -34,4 +35,20 @@ parcelable RtpConfig { RtpSessionParams sessionParams; /** RTCP configuration */ RtcpConfig rtcpConfig; + /** + * ANBR Bitrate parameters. This is set to valid only when its triggered, + * otherwise it shall be set to NULL. + * + * This would be used in the following two cases + * - IImsMediaSession#modifySession(RtpConfig) - When RAN wants to change the bit + * rate via ANBR MAC layer signaling, ImsStack would set the values and direction + * and pass it in the modifySession(). The underlying RTP stack shall adapt to + * the changed bitrate. + * + * - IImsMediaSessionListener#triggerAnbrQuery(RtpConfig) - When the vendor RTP + * stack receives a request for bitrate increase from the peer terminal via CMR, + * RTCP-APP or TMMBR, it triggers ANBRQ by setting the desired bitrate and the + * direction of the stream. + */ + AnbrBitrate anbrBitrateParams; } From f82fc6476d8778e7a513056e1d7f7d4ab5aaadfd Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Fri, 17 Jun 2022 21:36:18 +0000 Subject: [PATCH 099/998] audio: Improve debug logging in the AIDL version, fix bugs - Make sure the AIDL default implementation has debug output enabled. - Log additional info in the AIDL VTS to facilitate debugging. - Make resource handler classes move-only types. Bug: 205884982 Test: atest VtsHalAudioCoreTargetTest Change-Id: I111b72aaf12962f00b4d31b8ac87186bca5eb853 --- audio/aidl/default/Module.cpp | 1 + audio/aidl/default/main.cpp | 10 ++-- audio/aidl/vts/ModuleConfig.cpp | 10 ++-- audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp | 55 ++++++++++++++++---- 4 files changed, 58 insertions(+), 18 deletions(-) diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp index 961ee84517..1bf7321f15 100644 --- a/audio/aidl/default/Module.cpp +++ b/audio/aidl/default/Module.cpp @@ -424,6 +424,7 @@ ndk::ScopedAStatus Module::openOutputStream(int32_t in_portConfigId, } ndk::ScopedAStatus Module::setAudioPatch(const AudioPatch& in_requested, AudioPatch* _aidl_return) { + LOG(DEBUG) << __func__ << ": requested patch " << in_requested.toString(); if (in_requested.sourcePortConfigIds.empty()) { LOG(ERROR) << __func__ << ": requested patch has empty sources list"; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); diff --git a/audio/aidl/default/main.cpp b/audio/aidl/default/main.cpp index 0de6047f6e..aeb9983b88 100644 --- a/audio/aidl/default/main.cpp +++ b/audio/aidl/default/main.cpp @@ -25,20 +25,22 @@ using aidl::android::hardware::audio::core::Config; using aidl::android::hardware::audio::core::Module; int main() { + // This is a debug implementation, always enable debug logging. + android::base::SetMinimumLogSeverity(::android::base::DEBUG); ABinderProcess_setThreadPoolMaxThreadCount(16); - // make the default config service + // Make the default config service auto config = ndk::SharedRefBase::make(); const std::string configName = std::string() + Config::descriptor + "/default"; binder_status_t status = AServiceManager_addService(config->asBinder().get(), configName.c_str()); - CHECK(status == STATUS_OK); + CHECK_EQ(STATUS_OK, status); - // make the default module + // Make the default module auto moduleDefault = ndk::SharedRefBase::make(); const std::string moduleDefaultName = std::string() + Module::descriptor + "/default"; status = AServiceManager_addService(moduleDefault->asBinder().get(), moduleDefaultName.c_str()); - CHECK(status == STATUS_OK); + CHECK_EQ(STATUS_OK, status); ABinderProcess_joinThreadPool(); return EXIT_FAILURE; // should not reach diff --git a/audio/aidl/vts/ModuleConfig.cpp b/audio/aidl/vts/ModuleConfig.cpp index 36b3b1b412..0e76d9a647 100644 --- a/audio/aidl/vts/ModuleConfig.cpp +++ b/audio/aidl/vts/ModuleConfig.cpp @@ -251,15 +251,15 @@ std::string ModuleConfig::toString() const { std::string result; result.append("Ports: "); result.append(android::internal::ToString(mPorts)); - result.append("Initial configs: "); + result.append("\nInitial configs: "); result.append(android::internal::ToString(mInitialConfigs)); - result.append("Attached sink device ports: "); + result.append("\nAttached sink device ports: "); result.append(android::internal::ToString(mAttachedSinkDevicePorts)); - result.append("Attached source device ports: "); + result.append("\nAttached source device ports: "); result.append(android::internal::ToString(mAttachedSourceDevicePorts)); - result.append("External device ports: "); + result.append("\nExternal device ports: "); result.append(android::internal::ToString(mExternalDevicePorts)); - result.append("Routes: "); + result.append("\nRoutes: "); result.append(android::internal::ToString(mRoutes)); return result; } diff --git a/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp index 6be4e2f97a..6c91d247e7 100644 --- a/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp @@ -138,12 +138,18 @@ constexpr IsInput::operator bool() const { return false; } +// All 'With*' classes are move-only because they are associated with some +// resource or state of a HAL module. class WithDebugFlags { public: + static WithDebugFlags createNested(const WithDebugFlags& parent) { + return WithDebugFlags(parent.mFlags); + } + WithDebugFlags() {} explicit WithDebugFlags(const ModuleDebug& initial) : mInitial(initial), mFlags(initial) {} - explicit WithDebugFlags(const WithDebugFlags& initial) - : mInitial(initial.mFlags), mFlags(initial.mFlags) {} + WithDebugFlags(const WithDebugFlags&) = delete; + WithDebugFlags& operator=(const WithDebugFlags&) = delete; ~WithDebugFlags() { if (mModule != nullptr) { ScopedAStatus status = mModule->setModuleDebug(mInitial); @@ -170,6 +176,8 @@ class WithAudioPortConfig { public: WithAudioPortConfig() {} explicit WithAudioPortConfig(const AudioPortConfig& config) : mInitialConfig(config) {} + WithAudioPortConfig(const WithAudioPortConfig&) = delete; + WithAudioPortConfig& operator=(const WithAudioPortConfig&) = delete; ~WithAudioPortConfig() { if (mModule != nullptr) { ScopedAStatus status = mModule->resetAudioPortConfig(getId()); @@ -326,6 +334,8 @@ class WithDevicePortConnectedState { explicit WithDevicePortConnectedState(const AudioPort& idAndData) : mIdAndData(idAndData) {} WithDevicePortConnectedState(const AudioPort& id, const AudioDeviceAddress& address) : mIdAndData(setAudioPortAddress(id, address)) {} + WithDevicePortConnectedState(const WithDevicePortConnectedState&) = delete; + WithDevicePortConnectedState& operator=(const WithDevicePortConnectedState&) = delete; ~WithDevicePortConnectedState() { if (mModule != nullptr) { ScopedAStatus status = mModule->disconnectExternalDevice(getId()); @@ -362,6 +372,8 @@ class WithStream { public: WithStream() {} explicit WithStream(const AudioPortConfig& portConfig) : mPortConfig(portConfig) {} + WithStream(const WithStream&) = delete; + WithStream& operator=(const WithStream&) = delete; ~WithStream() { if (mStream != nullptr) { ScopedAStatus status = mStream->close(); @@ -421,6 +433,8 @@ class WithAudioPatch { WithAudioPatch() {} WithAudioPatch(const AudioPortConfig& srcPortConfig, const AudioPortConfig& sinkPortConfig) : mSrcPortConfig(srcPortConfig), mSinkPortConfig(sinkPortConfig) {} + WithAudioPatch(const WithAudioPatch&) = delete; + WithAudioPatch& operator=(const WithAudioPatch&) = delete; ~WithAudioPatch() { if (mModule != nullptr && mPatch.id != 0) { ScopedAStatus status = mModule->resetAudioPatch(mPatch.id); @@ -655,6 +669,12 @@ TEST_P(AudioCoreModule, GetAudioPort) { } } +TEST_P(AudioCoreModule, SetUpModuleConfig) { + ASSERT_NO_FATAL_FAILURE(SetUpModuleConfig()); + // Send the module config to logcat to facilitate failures investigation. + LOG(INFO) << "SetUpModuleConfig: " << moduleConfig->toString(); +} + // Verify that HAL module reports for a connected device port at least one non-dynamic profile, // that is, a profile with actual supported configuration. // Note: This test relies on simulation of external device connections by the HAL module. @@ -882,7 +902,7 @@ TEST_P(AudioCoreModule, TryConnectMissingDevice) { GTEST_SKIP() << "No external devices in the module."; } AudioPort ignored; - WithDebugFlags doNotSimulateConnections(debug); + WithDebugFlags doNotSimulateConnections = WithDebugFlags::createNested(debug); doNotSimulateConnections.flags().simulateDeviceConnections = false; ASSERT_NO_FATAL_FAILURE(doNotSimulateConnections.SetUp(module.get())); for (const auto& port : ports) { @@ -1134,9 +1154,8 @@ class AudioStream : public AudioCoreModule { ScopedAStatus status = stream.SetUpNoChecks(module.get()); EXPECT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode()) << status << " open" << direction(true) - << "Stream" - " returned for port config ID " - << stream.getPortId() << ", maxOpenStreamCount is " << maxStreamCount; + << "Stream returned for port config ID " << stream.getPortId() + << ", maxOpenStreamCount is " << maxStreamCount; } } } @@ -1331,11 +1350,12 @@ class AudioModulePatch : public AudioCoreModule { } for (const auto& srcSinkGroup : srcSinkGroups) { const auto& route = srcSinkGroup.first; - std::vector patches; + std::vector> patches; for (const auto& srcSink : srcSinkGroup.second) { if (!route.isExclusive) { - patches.emplace_back(srcSink.first, srcSink.second); - EXPECT_NO_FATAL_FAILURE(patches[patches.size() - 1].SetUp(module.get())); + patches.push_back( + std::make_unique(srcSink.first, srcSink.second)); + EXPECT_NO_FATAL_FAILURE(patches[patches.size() - 1]->SetUp(module.get())); } else { WithAudioPatch patch(srcSink.first, srcSink.second); EXPECT_NO_FATAL_FAILURE(patch.SetUp(module.get())); @@ -1423,8 +1443,25 @@ INSTANTIATE_TEST_SUITE_P(AudioPatchTest, AudioModulePatch, android::PrintInstanceNameToString); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioModulePatch); +class TestExecutionTracer : public ::testing::EmptyTestEventListener { + public: + void OnTestStart(const ::testing::TestInfo& test_info) override { + TraceTestState("Started", test_info); + } + + void OnTestEnd(const ::testing::TestInfo& test_info) override { + TraceTestState("Completed", test_info); + } + + private: + static void TraceTestState(const std::string& state, const ::testing::TestInfo& test_info) { + LOG(INFO) << state << " " << test_info.test_suite_name() << "::" << test_info.name(); + } +}; + int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); + ::testing::UnitTest::GetInstance()->listeners().Append(new TestExecutionTracer()); ABinderProcess_setThreadPoolMaxThreadCount(1); ABinderProcess_startThreadPool(); return RUN_ALL_TESTS(); From 975ea3ae8959b1d9502290ebd5c71fba68645c64 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Fri, 17 Jun 2022 21:41:19 +0000 Subject: [PATCH 100/998] audio: Add support for compressed offload - Add compressed offload mix port into default implementation. - Require AudioOffloadInfo to be passed to IModule.openOutputStream for compressed offload port configs. - Update VTS to handle compressed offload. Bug: 205884982 Test: atest VtsHalAudioCoreTargetTest Change-Id: I118b2c04bff12b64a7cac4dc2c88217a6a270046 --- .../android/hardware/audio/core/IModule.aidl | 2 + audio/aidl/default/Android.bp | 2 + audio/aidl/default/Configuration.cpp | 49 ++++++-- audio/aidl/default/Module.cpp | 8 ++ audio/aidl/vts/ModuleConfig.cpp | 109 ++++++++---------- audio/aidl/vts/ModuleConfig.h | 38 +++--- audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp | 51 ++++++-- 7 files changed, 161 insertions(+), 98 deletions(-) diff --git a/audio/aidl/android/hardware/audio/core/IModule.aidl b/audio/aidl/android/hardware/audio/core/IModule.aidl index f406cd8ee0..802cb2f151 100644 --- a/audio/aidl/android/hardware/audio/core/IModule.aidl +++ b/audio/aidl/android/hardware/audio/core/IModule.aidl @@ -282,6 +282,8 @@ interface IModule { * @throws EX_ILLEGAL_ARGUMENT In the following cases: * - If the port config can not be found by the ID. * - If the port config is not of an output mix port. + * - If the offload info is not provided for an offload + * port configuration. * @throws EX_ILLEGAL_STATE In the following cases: * - If the port config already has a stream opened on it. * - If the limit on the open stream count for the port has diff --git a/audio/aidl/default/Android.bp b/audio/aidl/default/Android.bp index 4728a89cdd..ad1d9c761a 100644 --- a/audio/aidl/default/Android.bp +++ b/audio/aidl/default/Android.bp @@ -13,6 +13,7 @@ cc_library_static { shared_libs: [ "libbase", "libbinder_ndk", + "libstagefright_foundation", "android.media.audio.common.types-V1-ndk", "android.hardware.audio.core-V1-ndk", ], @@ -37,6 +38,7 @@ cc_binary { shared_libs: [ "libbase", "libbinder_ndk", + "libstagefright_foundation", "android.media.audio.common.types-V1-ndk", "android.hardware.audio.core-V1-ndk", ], diff --git a/audio/aidl/default/Configuration.cpp b/audio/aidl/default/Configuration.cpp index 19d0b3c93f..f5d679bd3e 100644 --- a/audio/aidl/default/Configuration.cpp +++ b/audio/aidl/default/Configuration.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include "core-impl/Configuration.h" @@ -42,16 +43,30 @@ using aidl::android::media::audio::common::PcmType; namespace aidl::android::hardware::audio::core::internal { +static void fillProfile(AudioProfile* profile, const std::vector& channelLayouts, + const std::vector& sampleRates) { + for (auto layout : channelLayouts) { + profile->channelMasks.push_back( + AudioChannelLayout::make(layout)); + } + profile->sampleRates.insert(profile->sampleRates.end(), sampleRates.begin(), sampleRates.end()); +} + static AudioProfile createProfile(PcmType pcmType, const std::vector& channelLayouts, const std::vector& sampleRates) { AudioProfile profile; profile.format.type = AudioFormatType::PCM; profile.format.pcm = pcmType; - for (auto layout : channelLayouts) { - profile.channelMasks.push_back( - AudioChannelLayout::make(layout)); - } - profile.sampleRates.insert(profile.sampleRates.end(), sampleRates.begin(), sampleRates.end()); + fillProfile(&profile, channelLayouts, sampleRates); + return profile; +} + +static AudioProfile createProfile(const std::string& encodingType, + const std::vector& channelLayouts, + const std::vector& sampleRates) { + AudioProfile profile; + profile.format.encoding = encodingType; + fillProfile(&profile, channelLayouts, sampleRates); return profile; } @@ -125,6 +140,8 @@ static AudioRoute createRoute(const std::vector& sources, int32_t sink) // * "primary output", PRIMARY, 1 max open, 1 max active stream // - profile PCM 16-bit; MONO, STEREO; 44100, 48000 // - profile PCM 24-bit; MONO, STEREO; 44100, 48000 +// * "compressed offload", DIRECT|COMPRESS_OFFLOAD|NON_BLOCKING, 1 max open, 1 max active stream +// - profile MP3; MONO, STEREO; 44100, 48000 // * "loopback output", stream count unlimited // - profile PCM 24-bit; STEREO; 48000 // * "primary input", 2 max open, 2 max active streams @@ -136,8 +153,8 @@ static AudioRoute createRoute(const std::vector& sources, int32_t sink) // - profile PCM 24-bit; STEREO; 48000 // // Routes: -// "primary out" -> "Null" -// "primary out" -> "USB Out" +// "primary out", "compressed offload" -> "Null" +// "primary out", "compressed offload" -> "USB Out" // "loopback out" -> "Loopback Out" // "Zero", "USB In" -> "primary input" // "Loopback In" -> "loopback input" @@ -183,6 +200,18 @@ Configuration& getNullPrimaryConfiguration() { standardPcmAudioProfiles.end()); c.ports.push_back(primaryOutMix); + AudioPort compressedOffloadOutMix = + createPort(c.nextPortId++, "compressed offload", + 1 << static_cast(AudioOutputFlags::DIRECT) | + 1 << static_cast(AudioOutputFlags::COMPRESS_OFFLOAD) | + 1 << static_cast(AudioOutputFlags::NON_BLOCKING), + false, createPortMixExt(1, 1)); + compressedOffloadOutMix.profiles.push_back( + createProfile(::android::MEDIA_MIMETYPE_AUDIO_MPEG, + {AudioChannelLayout::LAYOUT_MONO, AudioChannelLayout::LAYOUT_STEREO}, + {44100, 48000})); + c.ports.push_back(compressedOffloadOutMix); + AudioPort loopOutDevice = createPort(c.nextPortId++, "Loopback Out", 0, false, createDeviceExt(AudioDeviceType::OUT_SUBMIX, 0)); loopOutDevice.profiles.push_back( @@ -244,8 +273,10 @@ Configuration& getNullPrimaryConfiguration() { c.ports.push_back(usbInDevice); c.connectedProfiles[usbInDevice.id] = standardPcmAudioProfiles; - c.routes.push_back(createRoute({primaryOutMix.id}, nullOutDevice.id)); - c.routes.push_back(createRoute({primaryOutMix.id}, usbOutDevice.id)); + c.routes.push_back( + createRoute({primaryOutMix.id, compressedOffloadOutMix.id}, nullOutDevice.id)); + c.routes.push_back( + createRoute({primaryOutMix.id, compressedOffloadOutMix.id}, usbOutDevice.id)); c.routes.push_back(createRoute({loopOutMix.id}, loopOutDevice.id)); c.routes.push_back(createRoute({zeroInDevice.id, usbInDevice.id}, primaryInMix.id)); c.routes.push_back(createRoute({loopInDevice.id}, loopInMix.id)); diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp index 1bf7321f15..5b4d48a837 100644 --- a/audio/aidl/default/Module.cpp +++ b/audio/aidl/default/Module.cpp @@ -405,6 +405,14 @@ ndk::ScopedAStatus Module::openOutputStream(int32_t in_portConfigId, << " does not correspond to an output mix port"; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } + if (portConfigIt->flags.has_value() && + ((portConfigIt->flags.value().get() & + 1 << static_cast(AudioOutputFlags::COMPRESS_OFFLOAD)) != 0) && + !in_offloadInfo.has_value()) { + LOG(ERROR) << __func__ << ": port config id " << in_portConfigId + << " has COMPRESS_OFFLOAD flag set, requires offload info"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } if (mStreams.count(in_portConfigId) != 0) { LOG(ERROR) << __func__ << ": port config id " << in_portConfigId << " already has a stream opened on it"; diff --git a/audio/aidl/vts/ModuleConfig.cpp b/audio/aidl/vts/ModuleConfig.cpp index 0e76d9a647..969b0e9051 100644 --- a/audio/aidl/vts/ModuleConfig.cpp +++ b/audio/aidl/vts/ModuleConfig.cpp @@ -15,6 +15,7 @@ */ #include +#include #include #include @@ -22,19 +23,43 @@ #include "ModuleConfig.h" using namespace android; +using namespace std::chrono_literals; using aidl::android::hardware::audio::core::IModule; using aidl::android::media::audio::common::AudioChannelLayout; +using aidl::android::media::audio::common::AudioEncapsulationMode; using aidl::android::media::audio::common::AudioFormatDescription; using aidl::android::media::audio::common::AudioFormatType; using aidl::android::media::audio::common::AudioIoFlags; +using aidl::android::media::audio::common::AudioOffloadInfo; using aidl::android::media::audio::common::AudioOutputFlags; using aidl::android::media::audio::common::AudioPort; using aidl::android::media::audio::common::AudioPortConfig; using aidl::android::media::audio::common::AudioPortExt; using aidl::android::media::audio::common::AudioProfile; +using aidl::android::media::audio::common::AudioUsage; using aidl::android::media::audio::common::Int; +// static +std::optional ModuleConfig::generateOffloadInfoIfNeeded( + const AudioPortConfig& portConfig) { + if (portConfig.flags.has_value() && + portConfig.flags.value().getTag() == AudioIoFlags::Tag::output && + (portConfig.flags.value().get() & + 1 << static_cast(AudioOutputFlags::COMPRESS_OFFLOAD)) != 0) { + AudioOffloadInfo offloadInfo; + offloadInfo.base.sampleRate = portConfig.sampleRate.value().value; + offloadInfo.base.channelMask = portConfig.channelMask.value(); + offloadInfo.base.format = portConfig.format.value(); + offloadInfo.bitRatePerSecond = 256; // Arbitrary value. + offloadInfo.durationUs = std::chrono::microseconds(1min).count(); // Arbitrary value. + offloadInfo.usage = AudioUsage::MEDIA; + offloadInfo.encapsulationMode = AudioEncapsulationMode::NONE; + return offloadInfo; + } + return {}; +} + template auto findById(const std::vector& v, int32_t id) { return std::find_if(v.begin(), v.end(), [&](const auto& p) { return p.id == id; }); @@ -264,10 +289,10 @@ std::string ModuleConfig::toString() const { return result; } -static std::vector combineAudioConfigs(const AudioPort& port, - const AudioProfile& profile) { - std::vector configs; - configs.reserve(profile.channelMasks.size() * profile.sampleRates.size()); +static size_t combineAudioConfigs(const AudioPort& port, const AudioProfile& profile, + std::vector* result) { + const size_t newConfigCount = profile.channelMasks.size() * profile.sampleRates.size(); + result->reserve(result->capacity() + newConfigCount); for (auto channelMask : profile.channelMasks) { for (auto sampleRate : profile.sampleRates) { AudioPortConfig config{}; @@ -277,66 +302,32 @@ static std::vector combineAudioConfigs(const AudioPort& port, config.sampleRate = sr; config.channelMask = channelMask; config.format = profile.format; + config.flags = port.flags; config.ext = port.ext; - configs.push_back(config); + result->push_back(std::move(config)); } } - return configs; + return newConfigCount; } -std::vector ModuleConfig::generateInputAudioMixPortConfigs( - const std::vector& ports, bool singleProfile) const { +static bool isDynamicProfile(const AudioProfile& profile) { + return (profile.format.type == AudioFormatType::DEFAULT && profile.format.encoding.empty()) || + profile.sampleRates.empty() || profile.channelMasks.empty(); +} + +std::vector ModuleConfig::generateAudioMixPortConfigs( + const std::vector& ports, bool isInput, bool singleProfile) const { std::vector result; for (const auto& mixPort : ports) { - if (getAttachedSourceDevicesPortsForMixPort(mixPort).empty()) { - continue; // no attached devices + if (getAttachedDevicesPortsForMixPort(isInput, mixPort).empty()) { + continue; } for (const auto& profile : mixPort.profiles) { - if (profile.format.type == AudioFormatType::DEFAULT || profile.sampleRates.empty() || - profile.channelMasks.empty()) { - continue; // dynamic profile - } - auto configs = combineAudioConfigs(mixPort, profile); - for (auto& config : configs) { - config.flags = mixPort.flags; - result.push_back(config); - if (singleProfile) return result; - } - } - } - return result; -} - -static std::tuple generateOutFlags(const AudioPort& mixPort) { - static const AudioIoFlags offloadFlags = AudioIoFlags::make( - (1 << static_cast(AudioOutputFlags::COMPRESS_OFFLOAD)) | - (1 << static_cast(AudioOutputFlags::DIRECT))); - const bool isOffload = (mixPort.flags.get() & - (1 << static_cast(AudioOutputFlags::COMPRESS_OFFLOAD))) != 0; - return {isOffload ? offloadFlags : mixPort.flags, isOffload}; -} - -std::vector ModuleConfig::generateOutputAudioMixPortConfigs( - const std::vector& ports, bool singleProfile) const { - std::vector result; - for (const auto& mixPort : ports) { - if (getAttachedSinkDevicesPortsForMixPort(mixPort).empty()) { - continue; // no attached devices - } - auto [flags, isOffload] = generateOutFlags(mixPort); - (void)isOffload; - for (const auto& profile : mixPort.profiles) { - if (profile.format.type == AudioFormatType::DEFAULT) continue; - auto configs = combineAudioConfigs(mixPort, profile); - for (auto& config : configs) { - // Some combinations of flags declared in the config file require special - // treatment. - // if (isOffload) { - // config.offloadInfo.info(generateOffloadInfo(config.base)); - // } - config.flags = flags; - result.push_back(config); - if (singleProfile) return result; + if (isDynamicProfile(profile)) continue; + combineAudioConfigs(mixPort, profile, &result); + if (singleProfile && !result.empty()) { + result.resize(1); + return result; } } } @@ -349,9 +340,11 @@ std::vector ModuleConfig::generateAudioDevicePortConfigs( for (const auto& devicePort : ports) { const size_t resultSizeBefore = result.size(); for (const auto& profile : devicePort.profiles) { - auto configs = combineAudioConfigs(devicePort, profile); - result.insert(result.end(), configs.begin(), configs.end()); - if (singleProfile && !result.empty()) return result; + combineAudioConfigs(devicePort, profile, &result); + if (singleProfile && !result.empty()) { + result.resize(1); + return result; + } } if (resultSizeBefore == result.size()) { std::copy_if(mInitialConfigs.begin(), mInitialConfigs.end(), std::back_inserter(result), diff --git a/audio/aidl/vts/ModuleConfig.h b/audio/aidl/vts/ModuleConfig.h index 504c0fdf96..df13430955 100644 --- a/audio/aidl/vts/ModuleConfig.h +++ b/audio/aidl/vts/ModuleConfig.h @@ -23,6 +23,7 @@ #include #include +#include #include class ModuleConfig { @@ -32,6 +33,10 @@ class ModuleConfig { using SrcSinkGroup = std::pair>; + static std::optional + generateOffloadInfoIfNeeded( + const aidl::android::media::audio::common::AudioPortConfig& portConfig); + explicit ModuleConfig(aidl::android::hardware::audio::core::IModule* module); const ndk::ScopedAStatus& getStatus() const { return mStatus; } std::string getError() const { return mStatus.getMessage(); } @@ -68,42 +73,34 @@ class ModuleConfig { } std::vector getPortConfigsForMixPorts() const { - auto inputs = generateInputAudioMixPortConfigs(getInputMixPorts(), false); - auto outputs = generateOutputAudioMixPortConfigs(getOutputMixPorts(), false); + auto inputs = generateAudioMixPortConfigs(getInputMixPorts(), true, false); + auto outputs = generateAudioMixPortConfigs(getOutputMixPorts(), false, false); inputs.insert(inputs.end(), outputs.begin(), outputs.end()); return inputs; } std::vector getPortConfigsForMixPorts( bool isInput) const { - return isInput ? generateInputAudioMixPortConfigs(getInputMixPorts(), false) - : generateOutputAudioMixPortConfigs(getOutputMixPorts(), false); + return generateAudioMixPortConfigs(getMixPorts(isInput), isInput, false); } std::vector getPortConfigsForMixPorts( bool isInput, const aidl::android::media::audio::common::AudioPort& port) const { - return isInput ? generateInputAudioMixPortConfigs({port}, false) - : generateOutputAudioMixPortConfigs({port}, false); + return generateAudioMixPortConfigs({port}, isInput, false); } std::optional getSingleConfigForMixPort( bool isInput) const { - const auto config = isInput ? generateInputAudioMixPortConfigs(getInputMixPorts(), true) - : generateOutputAudioMixPortConfigs(getOutputMixPorts(), true); - // TODO: Avoid returning configs for offload since they require an extra - // argument to openOutputStream. + const auto config = generateAudioMixPortConfigs(getMixPorts(isInput), isInput, true); if (!config.empty()) { return *config.begin(); - } else { - return {}; } + return {}; } std::optional getSingleConfigForMixPort( bool isInput, const aidl::android::media::audio::common::AudioPort& port) const { - const auto config = isInput ? generateInputAudioMixPortConfigs({port}, true) - : generateOutputAudioMixPortConfigs({port}, true); + const auto config = generateAudioMixPortConfigs({port}, isInput, true); if (!config.empty()) { return *config.begin(); - } else { - return {}; } + return {}; } std::vector getPortConfigsForDevicePort( @@ -119,13 +116,8 @@ class ModuleConfig { std::string toString() const; private: - std::vector - generateInputAudioMixPortConfigs( - const std::vector& ports, - bool singleProfile) const; - std::vector - generateOutputAudioMixPortConfigs( - const std::vector& ports, + std::vector generateAudioMixPortConfigs( + const std::vector& ports, bool isInput, bool singleProfile) const; // Unlike MixPorts, the generator for DevicePorts always returns a non-empty diff --git a/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp index 6c91d247e7..bb24365741 100644 --- a/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp @@ -403,21 +403,23 @@ class WithStream { std::shared_ptr mStream; }; -template <> -ScopedAStatus WithStream::SetUpNoChecks(IModule* module, - const AudioPortConfig& portConfig) { +SinkMetadata GenerateSinkMetadata(const AudioPortConfig& portConfig) { RecordTrackMetadata trackMeta; trackMeta.source = AudioSource::MIC; trackMeta.gain = 1.0; trackMeta.channelMask = portConfig.channelMask.value(); SinkMetadata metadata; metadata.tracks.push_back(trackMeta); - return module->openInputStream(portConfig.id, metadata, &mStream); + return metadata; } template <> -ScopedAStatus WithStream::SetUpNoChecks(IModule* module, - const AudioPortConfig& portConfig) { +ScopedAStatus WithStream::SetUpNoChecks(IModule* module, + const AudioPortConfig& portConfig) { + return module->openInputStream(portConfig.id, GenerateSinkMetadata(portConfig), &mStream); +} + +SourceMetadata GenerateSourceMetadata(const AudioPortConfig& portConfig) { PlaybackTrackMetadata trackMeta; trackMeta.usage = AudioUsage::MEDIA; trackMeta.contentType = AudioContentType::MUSIC; @@ -425,7 +427,15 @@ ScopedAStatus WithStream::SetUpNoChecks(IModule* module, trackMeta.channelMask = portConfig.channelMask.value(); SourceMetadata metadata; metadata.tracks.push_back(trackMeta); - return module->openOutputStream(portConfig.id, metadata, {}, &mStream); + return metadata; +} + +template <> +ScopedAStatus WithStream::SetUpNoChecks(IModule* module, + const AudioPortConfig& portConfig) { + return module->openOutputStream(portConfig.id, GenerateSourceMetadata(portConfig), + ModuleConfig::generateOffloadInfoIfNeeded(portConfig), + &mStream); } class WithAudioPatch { @@ -1238,7 +1248,7 @@ TEST_P(AudioStreamOut, OpenTwicePrimary) { auto primaryPortIt = std::find_if(mixPorts.begin(), mixPorts.end(), [](const AudioPort& port) { constexpr int primaryOutputFlag = 1 << static_cast(AudioOutputFlags::PRIMARY); return port.flags.getTag() == AudioIoFlags::Tag::output && - ((port.flags.get() & primaryOutputFlag) != 0); + (port.flags.get() & primaryOutputFlag) != 0; }); if (primaryPortIt == mixPorts.end()) { GTEST_SKIP() << "No primary mix port"; @@ -1251,6 +1261,31 @@ TEST_P(AudioStreamOut, OpenTwicePrimary) { EXPECT_NO_FATAL_FAILURE(OpenTwiceSamePortConfigImpl(portConfig.value())); } +TEST_P(AudioStreamOut, RequireOffloadInfo) { + const auto mixPorts = moduleConfig->getMixPorts(false); + auto offloadPortIt = std::find_if(mixPorts.begin(), mixPorts.end(), [&](const AudioPort& port) { + constexpr int compressOffloadFlag = 1 + << static_cast(AudioOutputFlags::COMPRESS_OFFLOAD); + return port.flags.getTag() == AudioIoFlags::Tag::output && + (port.flags.get() & compressOffloadFlag) != 0 && + !moduleConfig->getAttachedSinkDevicesPortsForMixPort(port).empty(); + }); + if (offloadPortIt == mixPorts.end()) { + GTEST_SKIP() + << "No mix port for compressed offload that could be routed to attached devices"; + } + const auto portConfig = moduleConfig->getSingleConfigForMixPort(false, *offloadPortIt); + ASSERT_TRUE(portConfig.has_value()) + << "No profiles specified for the compressed offload mix port"; + std::shared_ptr ignored; + ScopedAStatus status = module->openOutputStream(portConfig.value().id, + GenerateSourceMetadata(portConfig.value()), + {} /* offloadInfo */, &ignored); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) + << status + << " returned when no offload info is provided for a compressed offload mix port"; +} + // Tests specific to audio patches. The fixure class is named 'AudioModulePatch' // to avoid clashing with 'AudioPatch' class. class AudioModulePatch : public AudioCoreModule { From 943b5501204b3ca61a059148a18ad16899224d58 Mon Sep 17 00:00:00 2001 From: Filip Date: Wed, 22 Jun 2022 05:04:34 +0000 Subject: [PATCH 101/998] Add automotive-tests package to the tests Bug: 235717579 Test: manual build Change-Id: I4a08e621d17f4758204842aabbcdfa0d9bffc4e0 --- automotive/vehicle/vts/Android.bp | 1 + 1 file changed, 1 insertion(+) diff --git a/automotive/vehicle/vts/Android.bp b/automotive/vehicle/vts/Android.bp index b78e0ff7c4..1cfd5420f5 100644 --- a/automotive/vehicle/vts/Android.bp +++ b/automotive/vehicle/vts/Android.bp @@ -44,6 +44,7 @@ cc_test { test_suites: [ "general-tests", "vts", + "automotive-tests", ], require_root: true, } From 7160ab741b377cbc7d8cb0805d09ca5142dc4339 Mon Sep 17 00:00:00 2001 From: Rakesh Raghava Date: Tue, 26 Apr 2022 11:56:34 +0000 Subject: [PATCH 102/998] (ImsMedia) added CallQuality APIs - updated aidl - handled in ImsMedia java layer Bug: 224901780 Test: build (mm) Change-Id: I54a900f25171902e9fb694ca8680b3503b7cf7d6 --- .../hardware/radio/ims/media/CallQuality.aidl | 58 +++++++++++++ .../ims/media/IImsMediaSessionListener.aidl | 1 + .../hardware/radio/ims/media/CallQuality.aidl | 84 +++++++++++++++++++ .../ims/media/IImsMediaSessionListener.aidl | 8 ++ 4 files changed, 151 insertions(+) create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CallQuality.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/CallQuality.aidl diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CallQuality.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CallQuality.aidl new file mode 100644 index 0000000000..fff6e1c3c2 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CallQuality.aidl @@ -0,0 +1,58 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable CallQuality { + int downlinkCallQualityLevel; + int uplinkCallQualityLevel; + int callDuration; + int numRtpPacketsTransmitted; + int numRtpPacketsReceived; + int numRtpPacketsTransmittedLost; + int numRtpPacketsNotReceived; + int averageRelativeJitter; + int maxRelativeJitter; + int averageRoundTripTime; + int codecType; + boolean rtpInactivityDetected; + boolean rxSilenceDetected; + boolean txSilenceDetected; + int numVoiceFrames; + int numNoDataFrames; + int numDroppedRtpPackets; + long minPlayoutDelayMillis; + long maxPlayoutDelayMillis; + int numRtpSidPacketsReceived; + int numRtpDuplicatePackets; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl index 2266a6e53e..615978089d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl @@ -45,4 +45,5 @@ interface IImsMediaSessionListener { oneway void notifyJitter(int jitter); oneway void triggerAnbrQuery(in android.hardware.radio.ims.media.RtpConfig config); oneway void onDtmfReceived(char dtmfDigit); + oneway void onCallQualityChanged(in android.hardware.radio.ims.media.CallQuality callQuality); } diff --git a/radio/aidl/android/hardware/radio/ims/media/CallQuality.aidl b/radio/aidl/android/hardware/radio/ims/media/CallQuality.aidl new file mode 100644 index 0000000000..a8f7b16181 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/CallQuality.aidl @@ -0,0 +1,84 @@ +/* + * 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. + */ + +package android.hardware.radio.ims.media; + +@VintfStability +parcelable CallQuality { + /** + * downlink CallQualityLevel for a given ongoing call + * this value corresponds to the CALL_QUALITY_* constants in {@link CallQuality} + */ + int downlinkCallQualityLevel; + /** + * uplink CallQualityLevel for a given ongoing call + * this value corresponds to the CALL_QUALITY_* constants in {@link CallQuality} + */ + int uplinkCallQualityLevel; + /** the call duration in milliseconds */ + int callDuration; + /** RTP packets sent to network */ + int numRtpPacketsTransmitted; + /** RTP packets received from network */ + int numRtpPacketsReceived; + /** RTP packets which were lost in network and never transmitted */ + int numRtpPacketsTransmittedLost; + /** RTP packets which were lost in network and never received */ + int numRtpPacketsNotReceived; + /** average relative jitter in milliseconds */ + int averageRelativeJitter; + /** maximum relative jitter in milliseconds */ + int maxRelativeJitter; + /** average round trip delay in milliseconds */ + int averageRoundTripTime; + /** + * the codec type. This value corresponds to the AUDIO_QUALITY_* constants in + * {@link ImsStreamMediaProfile} + */ + int codecType; + /** True if no incoming RTP is received for a continuous duration of 4 seconds */ + boolean rtpInactivityDetected; + /** + * True if only silence RTP packets are received for 20 seconds + * immediately after call is connected + */ + boolean rxSilenceDetected; + /** + * True if only silence RTP packets are sent for 20 seconds + * immediately after call is connected + */ + boolean txSilenceDetected; + /** the number of Voice frames sent by jitter buffer to audio */ + int numVoiceFrames; + /** the number of no-data frames sent by jitter buffer to audio */ + int numNoDataFrames; + /** the number of RTP voice packets dropped by jitter buffer */ + int numDroppedRtpPackets; + /** the minimum playout delay in the reporting interval in milliseconds */ + long minPlayoutDelayMillis; + /** the maximum playout delay in the reporting interval in milliseconds */ + long maxPlayoutDelayMillis; + /** + * the total number of RTP SID (Silence Insertion Descriptor) packets + * received by this device for an ongoing call + */ + int numRtpSidPacketsReceived; + /** + * the total number of RTP duplicate packets received by this device + * for an ongoing call + */ + int numRtpDuplicatePackets; +} diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl index 850a874885..317aeb798b 100644 --- a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.ims.media; +import android.hardware.radio.ims.media.CallQuality; import android.hardware.radio.ims.media.MediaProtocolType; import android.hardware.radio.ims.media.RtpConfig; import android.hardware.radio.ims.media.RtpError; @@ -128,4 +129,11 @@ oneway interface IImsMediaSessionListener { * @param dtmfDigit single char having one of 12 values: 0-9, *, # */ void onDtmfReceived(char dtmfDigit); + + /** + * Notifies when a change to call quality has occurred + * + * @param CallQuality The call quality statistics of ongoing call since last report + */ + void onCallQualityChanged(in CallQuality callQuality); } From 17d82331974b98b2b59eddce873140d46aa83cb3 Mon Sep 17 00:00:00 2001 From: Chen Cheng Date: Wed, 22 Jun 2022 18:36:50 +0000 Subject: [PATCH 103/998] Revert "Change StatusCode to ErrorCode." Revert submission 18878765-b/224876310 Reason for revert: Reverted Changes: I3ec73d068:Change StatusCode to ErrorCode. I98c2cbe07:Created ErrorCode in vhal cpp client. Change-Id: I809ec4718c4d730212d2d7cdf3fd6dd12eee835e --- .../vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 5de206bee2..c431d85eef 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -48,7 +48,6 @@ using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; using ::android::getAidlHalInstanceNames; using ::android::base::ScopedLockAssertion; using ::android::base::StringPrintf; -using ::android::frameworks::automotive::vhal::ErrorCode; using ::android::frameworks::automotive::vhal::HalPropError; using ::android::frameworks::automotive::vhal::IHalPropConfig; using ::android::frameworks::automotive::vhal::IHalPropValue; @@ -288,7 +287,7 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, setNotWritableProp) { auto setValueResult = mVhalClient->setValueSync(*getValueResult.value()); ASSERT_FALSE(setValueResult.ok()) << "Expect set a read-only value to fail"; - ASSERT_EQ(setValueResult.error().code(), ErrorCode::ACCESS_DENIED_FROM_VHAL); + ASSERT_EQ(setValueResult.error().code(), StatusCode::ACCESS_DENIED); } // Test subscribe() and unsubscribe(). From d32a5ed8427ab75accb617a2de1d7f43d02c778b Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Wed, 22 Jun 2022 09:56:11 -0700 Subject: [PATCH 104/998] uwb(hal): Add a new capability TLV for supported rng ntf thresholds Bug: 235355249 Test: Compiles Change-Id: I44dd28b0b3ff5cfe6bf227e4cad917edfce10262 --- .../uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl | 1 + .../uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl index 17e438129e..002e11a427 100644 --- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl @@ -45,4 +45,5 @@ enum UwbVendorCapabilityTlvTypes { CCC_SUPPORTED_RAN_MULTIPLIER = 167, SUPPORTED_AOA_RESULT_REQ_ANTENNA_INTERLEAVING = 227, SUPPORTED_MIN_RANGING_INTERVAL_MS = 228, + SUPPORTED_RANGE_DATA_NTF_CONFIG = 229, } diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl index 3961edaecb..e15edcb1c4 100644 --- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl +++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl @@ -155,4 +155,12 @@ enum UwbVendorCapabilityTlvTypes { * 4 byte value to indicate supported min ranging interval in ms. */ SUPPORTED_MIN_RANGING_INTERVAL_MS = 0xE4, + + /** + * 4 byte bitmask to indicate the supported RANGE_DATA_NTF_CONFIG values + * + * Bitmask where each bit corresponds to values used in + * RANGE_DATA_NTF_CONFIG in SET_APP_CFG_CMD + */ + SUPPORTED_RANGE_DATA_NTF_CONFIG = 0xE5, } From 5bd859e76596a53267749df5acce28c9f240456a Mon Sep 17 00:00:00 2001 From: Helen Date: Mon, 20 Jun 2022 03:06:36 +0000 Subject: [PATCH 105/998] Update useHeaderFullOnly and useEvsModeSwitch to EvsParams Bug: 236225057 Test: Build Change-Id: Iceb4260ab3ff69883aff530e8e93327943c189df --- .../hardware/radio/ims/media/EvsParams.aidl | 3 +-- .../hardware/radio/ims/media/EvsParams.aidl | 14 ++++---------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl index 33631232eb..bdd0a4b3d9 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl @@ -37,7 +37,6 @@ parcelable EvsParams { android.hardware.radio.ims.media.EvsBandwidth bandwidth; android.hardware.radio.ims.media.EvsMode evsMode; byte channelAwareMode; - boolean useHeaderFullOnlyOnTx; - boolean useHeaderFullOnlyOnRx; + boolean useHeaderFullOnly; boolean useEvsModeSwitch; } diff --git a/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl b/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl index 4a4d71b27d..7b420c8238 100644 --- a/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl @@ -37,17 +37,11 @@ parcelable EvsParams { */ byte channelAwareMode; /** - * hf-only: Header full only is used for the outgoing packets. If it's true then - * the session shall support header full format only else the session could - * support both header full format and compact format. + * hf-only: Header full only is used for the outgoing and incoming packets. + * If it's true then the session shall support header full format only else the + * session could support both header full format and compact format. */ - boolean useHeaderFullOnlyOnTx; - /** - * hf-only: Header full only used on the incoming packets. If it's true then the - * session shall support header full format only else the session could support - * both header full format and compact format. - */ - boolean useHeaderFullOnlyOnRx; + boolean useHeaderFullOnly; /** * evs-mode-switch: Used for switching between EVS Primary mode and EVS AMR-WB IO mode, * If this value is true, the codec operates in AMR-WB IO mode From d3cf8d6294630809c962d9a4c1f7c8e3a8ce597d Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 15 Jun 2022 20:54:17 +0000 Subject: [PATCH 106/998] Add support for GSR property in HIDL ref VHAL. Test: Presubmit Bug: 236135569 Change-Id: I3788b66aa409304927e8f5af371c049cb1bcd58e --- .../2.0/default/impl/vhal_v2_0/DefaultConfig.h | 13 +++++++++++++ .../impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h index 9edd2bd491..edc8949d5a 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h @@ -1118,6 +1118,19 @@ const ConfigDeclaration kVehicleProperties[]{ }, .initialValue = {.stringValue = {"Test"}}, }, + // This property is later defined in the AIDL VHAL interface. However, HIDL VHAL might + // require support for this property to meet EU regulation. + { + .config = + { + // GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT + .prop = 0x11400F47, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + }, + // GsrComplianceRequirementType::GSR_COMPLIANCE_REQUIRED_V1 + .initialValue = {.int32Values = {1}}, + }, #ifdef ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING // Vendor propetry for E2E ClusterHomeService testing. { diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp index f01444ee19..74f5a7a3c1 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp @@ -141,7 +141,7 @@ class DefaultVhalImplTest : public ::testing::Test { TEST_F(DefaultVhalImplTest, testListProperties) { std::vector configs = mHal->listProperties(); - EXPECT_EQ((size_t)122, configs.size()); + EXPECT_EQ((size_t)123, configs.size()); } TEST_F(DefaultVhalImplTest, testGetDefaultPropertyFloat) { From 1707ec47256ef10ca9e937d453cc7e25ceeaa91a Mon Sep 17 00:00:00 2001 From: Lucas Gates Date: Thu, 23 Jun 2022 21:55:30 +0000 Subject: [PATCH 107/998] Tuner Default HAL change dvr buffer size for CF The default HAL currently uses a single shared memory buffer to store the data within MediaEvents. This buffer would cause sudden crashes when running on cf_x86_tv-userdebug due to being de-allocated by the memory management system. This CL decreases the size of the buffer so our SampleTunerTIS can once again run successfully on Cuttlefish. Bug: 236847284 Test: Running sampletunertvinput manually on cuttlefish Change-Id: I8e6042da422a9ed93cd9dbd18fe954c71098534d --- tv/tuner/aidl/default/Filter.cpp | 8 ++++---- tv/tuner/aidl/default/Filter.h | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tv/tuner/aidl/default/Filter.cpp b/tv/tuner/aidl/default/Filter.cpp index 769ebe21ee..1d56303d2c 100644 --- a/tv/tuner/aidl/default/Filter.cpp +++ b/tv/tuner/aidl/default/Filter.cpp @@ -432,12 +432,12 @@ Filter::~Filter() { if (mSharedAvMemHandle != nullptr) { *out_avMemory = ::android::dupToAidl(mSharedAvMemHandle); - *_aidl_return = BUFFER_SIZE_16M; + *_aidl_return = BUFFER_SIZE; mUsingSharedAvMem = true; return ::ndk::ScopedAStatus::ok(); } - int av_fd = createAvIonFd(BUFFER_SIZE_16M); + int av_fd = createAvIonFd(BUFFER_SIZE); if (av_fd < 0) { return ::ndk::ScopedAStatus::fromServiceSpecificError( static_cast(Result::OUT_OF_MEMORY)); @@ -454,7 +454,7 @@ Filter::~Filter() { mUsingSharedAvMem = true; *out_avMemory = ::android::dupToAidl(mSharedAvMemHandle); - *_aidl_return = BUFFER_SIZE_16M; + *_aidl_return = BUFFER_SIZE; return ::ndk::ScopedAStatus::ok(); } @@ -1168,7 +1168,7 @@ void Filter::createMediaEvent(vector& events) { mediaEvent.isPesPrivateData = true; mediaEvent.extraMetaData.set(audio); - int av_fd = createAvIonFd(BUFFER_SIZE_16M); + int av_fd = createAvIonFd(BUFFER_SIZE); if (av_fd == -1) { return; } diff --git a/tv/tuner/aidl/default/Filter.h b/tv/tuner/aidl/default/Filter.h index e301249e81..c559862956 100644 --- a/tv/tuner/aidl/default/Filter.h +++ b/tv/tuner/aidl/default/Filter.h @@ -50,7 +50,9 @@ using ::android::AidlMessageQueue; using ::android::hardware::EventFlag; using FilterMQ = AidlMessageQueue; -const uint32_t BUFFER_SIZE_16M = 0x1000000; +// Large buffer size can lead to sudden crashes due to being de-allocated +// by the memory management system. Change the buffer size when needed. +const uint32_t BUFFER_SIZE = 0x800000; // 8 MB class Demux; class Dvr; From 9d7dc8d9c2ebf1fd216800a4accc5c1093187a90 Mon Sep 17 00:00:00 2001 From: dhavalc Date: Thu, 23 Jun 2022 08:30:56 +0000 Subject: [PATCH 108/998] Added changes in ImsMedia HAL APIs based on vendor's feedback. - MediaDirection updated. - codecModeRequest variable changed. - maxMtuBytes variable removed. Bug: 236785604, 236357306, 236104128 Test: build(mm) Change-Id: I88abb7d507224d2ef089c6308901e9e8ec2199a6 --- .../hardware/radio/ims/media/CodecParams.aidl | 2 +- .../radio/ims/media/MediaDirection.aidl | 5 +++-- .../radio/ims/media/RtpSessionParams.aidl | 1 - .../hardware/radio/ims/media/CodecParams.aidl | 6 +++--- .../radio/ims/media/MediaDirection.aidl | 17 +++++++++++------ .../radio/ims/media/RtpSessionParams.aidl | 2 -- 6 files changed, 18 insertions(+), 15 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl index 3c4884383f..b3106136e7 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl @@ -38,7 +38,7 @@ parcelable CodecParams { byte rxPayloadTypeNumber; byte txPayloadTypeNumber; byte samplingRateKHz; - byte txCodecModeRequest; + byte codecModeRequest; boolean dtxEnabled; android.hardware.radio.ims.media.CodecSpecificParams codecSpecificParams; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl index 4cf5fa2fa5..d90b2a48b8 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl @@ -35,7 +35,8 @@ package android.hardware.radio.ims.media; @Backing(type="int") @VintfStability enum MediaDirection { NO_FLOW = 0, - TRANSMIT_ONLY = 1, + SEND_ONLY = 1, RECEIVE_ONLY = 2, - TRANSMIT_RECEIVE = 3, + SEND_RECEIVE = 3, + INACTIVE = 4, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionParams.aidl index 97c55119bc..13a7487f73 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionParams.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionParams.aidl @@ -36,7 +36,6 @@ package android.hardware.radio.ims.media; parcelable RtpSessionParams { byte pTimeMillis; int maxPtimeMillis; - int maxMtuBytes; byte dscp; android.hardware.radio.ims.media.DtmfParams dtmfParams; android.hardware.radio.ims.media.CodecParams codecParams; diff --git a/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl b/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl index 56f7936e3a..e0c1f6f207 100644 --- a/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl @@ -39,10 +39,10 @@ parcelable CodecParams { byte samplingRateKHz; /** * cmr: Codec mode request is used to request the speech codec encoder of the - * other party to set the frame type index of speech mode via RTP header, See RFC - * 4867 section 4.3.1. Allowed values are -1, 0 and 1. + * other party to set the frame type index of speech mode via RTP header, See + * 3GPP TS 26.445 section A.3. Allowed values are -1, 0 and 1. */ - byte txCodecModeRequest; + byte codecModeRequest; /** dtx: Whether discontinuous transmission is enabled or not */ boolean dtxEnabled; /** Codec specific parameters */ diff --git a/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl b/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl index 196537b71c..9f04d8ecc7 100644 --- a/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl @@ -19,12 +19,17 @@ package android.hardware.radio.ims.media; @VintfStability @Backing(type="int") enum MediaDirection { - /** No media flow in either direction */ + /** + * No RTP/RTCP flow in either direction. The implementation + * may release the audio resource. Eg. SRVCC. + */ NO_FLOW = 0, - /** Device sends outgoing media and drops incoming media */ - TRANSMIT_ONLY = 1, - /** Device receives the downlink media and does not transmit any uplink media */ + /** Device sends outgoing RTP and drops incoming RTP */ + SEND_ONLY = 1, + /** Device receives the downlink RTP and does not transmit any uplink RTP */ RECEIVE_ONLY = 2, - /** Device sends and receive media in both directions */ - TRANSMIT_RECEIVE = 3, + /** Device sends and receive RTP in both directions */ + SEND_RECEIVE = 3, + /** No RTP flow however RTCP continues to flow. Eg. HOLD */ + INACTIVE = 4, } diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpSessionParams.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpSessionParams.aidl index 86a1d331b3..f93c52c088 100644 --- a/radio/aidl/android/hardware/radio/ims/media/RtpSessionParams.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/RtpSessionParams.aidl @@ -31,8 +31,6 @@ parcelable RtpSessionParams { * represented in milliseconds, see RFC 4566 */ int maxPtimeMillis; - /** Maximum Rtp transfer unit in bytes */ - int maxMtuBytes; /** dscp: Differentiated Services Field Code Point value, see RFC 2474 */ byte dscp; /** DTMF payload and clock rate */ From faf9adcc4e207c0e23f7d1c4899781c126fd9cd1 Mon Sep 17 00:00:00 2001 From: Chen Cheng Date: Wed, 22 Jun 2022 23:09:09 +0000 Subject: [PATCH 109/998] [Reland] Change StatusCode to ErrorCode. ErrorCode is created in IVhalClient to better describe the error case in vhal cpp client interface. Test: atest VtsHalAutomotiveVehicle_TargetTest Bug: 224876310 Bug: 236845761 Change-Id: I261f67b62ead4386bb58daed81d72276ab0eb88d --- .../vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index c431d85eef..5de206bee2 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -48,6 +48,7 @@ using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; using ::android::getAidlHalInstanceNames; using ::android::base::ScopedLockAssertion; using ::android::base::StringPrintf; +using ::android::frameworks::automotive::vhal::ErrorCode; using ::android::frameworks::automotive::vhal::HalPropError; using ::android::frameworks::automotive::vhal::IHalPropConfig; using ::android::frameworks::automotive::vhal::IHalPropValue; @@ -287,7 +288,7 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, setNotWritableProp) { auto setValueResult = mVhalClient->setValueSync(*getValueResult.value()); ASSERT_FALSE(setValueResult.ok()) << "Expect set a read-only value to fail"; - ASSERT_EQ(setValueResult.error().code(), StatusCode::ACCESS_DENIED); + ASSERT_EQ(setValueResult.error().code(), ErrorCode::ACCESS_DENIED_FROM_VHAL); } // Test subscribe() and unsubscribe(). From 2da346d0d535a9b914c07e146c2f7073caea7db0 Mon Sep 17 00:00:00 2001 From: ziyiw Date: Fri, 24 Jun 2022 22:12:53 +0000 Subject: [PATCH 110/998] Add new capability TLV for supported RSSI reporting Test: Compile Bug: 236720553 Change-Id: Iae490f193c7e613ef8c9ee03784563b3286182bb --- .../uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl | 1 + .../uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl index 002e11a427..cd08671931 100644 --- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl @@ -46,4 +46,5 @@ enum UwbVendorCapabilityTlvTypes { SUPPORTED_AOA_RESULT_REQ_ANTENNA_INTERLEAVING = 227, SUPPORTED_MIN_RANGING_INTERVAL_MS = 228, SUPPORTED_RANGE_DATA_NTF_CONFIG = 229, + SUPPORTED_RSSI_REPORTING = 230, } diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl index e15edcb1c4..556bd13d58 100644 --- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl +++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl @@ -163,4 +163,12 @@ enum UwbVendorCapabilityTlvTypes { * RANGE_DATA_NTF_CONFIG in SET_APP_CFG_CMD */ SUPPORTED_RANGE_DATA_NTF_CONFIG = 0xE5, + + /** + * 1 byte bitmask to indicate the supported RSSI_REPORTING values + * Values: + * 1 - Feature supported. + * 0 - Feature not supported. + */ + SUPPORTED_RSSI_REPORTING = 0xE6, } From 3ad735d32479e6dcd648e817a7f38416b54ef601 Mon Sep 17 00:00:00 2001 From: Frankie Lizcano Date: Fri, 24 Jun 2022 19:20:54 +0000 Subject: [PATCH 111/998] vts: Added support for ATSC Frontend types The latest version of the dynamic VTS for Tuner HALs did not support the configuration of ATSC Frontend types. Logic was added to allow this feature. Editing the tuner_testing_dynamic_configuration file directly changes the api outlined in api/current.txt to support reading the newly added features from the vendor's configuration file. Bug: b/237100858 Test: manual - Ran local tests that ensured the ATSC frontend was being configured correctly. Also ran the VTS module to ensure no failures were occuring. Change-Id: I6a3221bd69eab000a9ea3de9e7c084bbee0e1451 --- .../config/TunerTestingConfigAidlReaderV1_0.h | 23 +++++++++++++++++++ tv/tuner/config/api/current.txt | 10 ++++++++ .../tuner_testing_dynamic_configuration.xsd | 10 +++++--- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h index 189f5fdf77..caf631c68d 100644 --- a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h +++ b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h @@ -263,6 +263,9 @@ struct TunerTestingConfigAidlReader1_0 { break; case FrontendTypeEnum::ATSC: type = FrontendType::ATSC; + frontendMap[id].settings.set< + FrontendSettings::Tag::atsc>( + readAtscFrontendSettings(feConfig)); break; case FrontendTypeEnum::ATSC3: type = FrontendType::ATSC3; @@ -691,6 +694,26 @@ struct TunerTestingConfigAidlReader1_0 { return dvbsSettings; } + static FrontendAtscSettings readAtscFrontendSettings(Frontend& feConfig) { + ALOGW("[ConfigReader] fe type is atsc"); + FrontendAtscSettings atscSettings{ + .frequency = (int64_t)feConfig.getFrequency(), + }; + if (feConfig.hasEndFrequency()) { + atscSettings.endFrequency = (int64_t)feConfig.getEndFrequency(); + } + if (!feConfig.hasAtscFrontendSettings_optional()) { + ALOGW("[ConfigReader] no more atsc settings"); + return atscSettings; + } + auto atsc = feConfig.getFirstAtscFrontendSettings_optional(); + atscSettings.inversion = static_cast( + atsc->getInversion()); + atscSettings.modulation = static_cast( + atsc->getModulation()); + return atscSettings; + } + static bool readFilterTypeAndSettings(Filter filterConfig, DemuxFilterType& type, DemuxFilterSettings& settings) { auto mainType = filterConfig.getMainType(); diff --git a/tv/tuner/config/api/current.txt b/tv/tuner/config/api/current.txt index 383d49f452..88576bb46f 100644 --- a/tv/tuner/config/api/current.txt +++ b/tv/tuner/config/api/current.txt @@ -1,6 +1,14 @@ // Signature format: 2.0 package android.media.tuner.testing.configuration.V1_0 { + public class AtscFrontendSettings { + ctor public AtscFrontendSettings(); + method @Nullable public java.math.BigInteger getInversion(); + method @Nullable public java.math.BigInteger getModulation(); + method public void setInversion(@Nullable java.math.BigInteger); + method public void setModulation(@Nullable java.math.BigInteger); + } + public class AvFilterSettings { ctor public AvFilterSettings(); method @Nullable public short getAudioStreamType_optional(); @@ -310,6 +318,7 @@ package android.media.tuner.testing.configuration.V1_0 { public class Frontend { ctor public Frontend(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.AtscFrontendSettings getAtscFrontendSettings_optional(); method @Nullable public java.math.BigInteger getConnectToCicamId(); method @Nullable public android.media.tuner.testing.configuration.V1_0.DvbsFrontendSettings getDvbsFrontendSettings_optional(); method @Nullable public android.media.tuner.testing.configuration.V1_0.DvbtFrontendSettings getDvbtFrontendSettings_optional(); @@ -319,6 +328,7 @@ package android.media.tuner.testing.configuration.V1_0 { method @Nullable public boolean getIsSoftwareFrontend(); method @Nullable public java.math.BigInteger getRemoveOutputPid(); method @Nullable public android.media.tuner.testing.configuration.V1_0.FrontendTypeEnum getType(); + method public void setAtscFrontendSettings_optional(@Nullable android.media.tuner.testing.configuration.V1_0.AtscFrontendSettings); method public void setConnectToCicamId(@Nullable java.math.BigInteger); method public void setDvbsFrontendSettings_optional(@Nullable android.media.tuner.testing.configuration.V1_0.DvbsFrontendSettings); method public void setDvbtFrontendSettings_optional(@Nullable android.media.tuner.testing.configuration.V1_0.DvbtFrontendSettings); diff --git a/tv/tuner/config/tuner_testing_dynamic_configuration.xsd b/tv/tuner/config/tuner_testing_dynamic_configuration.xsd index 59abd9aa61..bbb514922b 100644 --- a/tv/tuner/config/tuner_testing_dynamic_configuration.xsd +++ b/tv/tuner/config/tuner_testing_dynamic_configuration.xsd @@ -80,6 +80,10 @@ + + + + @@ -109,9 +113,9 @@ - + + From 452b026fb51ce85b75781fa270423703ee640b79 Mon Sep 17 00:00:00 2001 From: Frankie Lizcano Date: Mon, 27 Jun 2022 22:00:33 +0000 Subject: [PATCH 112/998] vts: Added support for ISDBS Frontend types The latest version of the dynamic VTS for Tuner HALs did not support the configuration of ISDBS Frontend types. Logic was added to allow this feature. Bug: b/237319139 Test: manual - Ran local tests that ensured the ATSC frontend was being configured correctly. Also ran the VTS module to ensure no failures were occuring. Change-Id: I7d7fe5ce153a582a65fa9d1347e18f7689e0bcfb --- .../config/TunerTestingConfigAidlReaderV1_0.h | 61 ++++++++++++++----- tv/tuner/config/api/current.txt | 18 ++++++ .../tuner_testing_dynamic_configuration.xsd | 12 +++- 3 files changed, 73 insertions(+), 18 deletions(-) diff --git a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h index caf631c68d..e0118cd6fb 100644 --- a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h +++ b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h @@ -286,6 +286,9 @@ struct TunerTestingConfigAidlReader1_0 { } case FrontendTypeEnum::ISDBS: type = FrontendType::ISDBS; + frontendMap[id].settings.set< + FrontendSettings::Tag::isdbs>( + readIsdbsFrontendSettings(feConfig)); break; case FrontendTypeEnum::ISDBS3: type = FrontendType::ISDBS3; @@ -695,23 +698,49 @@ struct TunerTestingConfigAidlReader1_0 { } static FrontendAtscSettings readAtscFrontendSettings(Frontend& feConfig) { - ALOGW("[ConfigReader] fe type is atsc"); - FrontendAtscSettings atscSettings{ - .frequency = (int64_t)feConfig.getFrequency(), - }; - if (feConfig.hasEndFrequency()) { - atscSettings.endFrequency = (int64_t)feConfig.getEndFrequency(); - } - if (!feConfig.hasAtscFrontendSettings_optional()) { - ALOGW("[ConfigReader] no more atsc settings"); - return atscSettings; - } - auto atsc = feConfig.getFirstAtscFrontendSettings_optional(); - atscSettings.inversion = static_cast( - atsc->getInversion()); - atscSettings.modulation = static_cast( - atsc->getModulation()); + ALOGW("[ConfigReader] fe type is atsc"); + FrontendAtscSettings atscSettings{ + .frequency = (int64_t) feConfig.getFrequency(), + }; + if (feConfig.hasEndFrequency()) { + atscSettings.endFrequency = (int64_t) feConfig.getEndFrequency(); + } + if (!feConfig.hasAtscFrontendSettings_optional()) { + ALOGW("[ConfigReader] no more atsc settings"); return atscSettings; + } + auto atsc = feConfig.getFirstAtscFrontendSettings_optional(); + atscSettings.inversion = static_cast( + atsc->getInversion()); + atscSettings.modulation = static_cast( + atsc->getModulation()); + return atscSettings; + } + + static FrontendIsdbsSettings readIsdbsFrontendSettings(Frontend &feConfig) { + ALOGW("[ConfigReader] fe type is isdbs"); + FrontendIsdbsSettings isdbsSettings{ + .frequency = (int64_t)feConfig.getFrequency() + }; + if (feConfig.hasEndFrequency()) { + isdbsSettings.endFrequency = (int64_t)feConfig.getEndFrequency(); + } + if (!feConfig.hasIsdbsFrontendSettings_optional()) { + ALOGW("[ConfigReader] no more isdbs settings"); + return isdbsSettings; + } + auto isdbs = feConfig.getFirstIsdbsFrontendSettings_optional(); + isdbsSettings.streamId = (int32_t)isdbs->getStreamId(); + isdbsSettings.symbolRate = (int32_t)isdbs->getSymbolRate(); + isdbsSettings.modulation = static_cast( + isdbs->getModulation()); + isdbsSettings.coderate = static_cast( + isdbs->getCoderate()); + isdbsSettings.rolloff = static_cast( + isdbs->getRolloff()); + isdbsSettings.streamIdType = static_cast( + isdbs->getStreamIdType()); + return isdbsSettings; } static bool readFilterTypeAndSettings(Filter filterConfig, DemuxFilterType& type, diff --git a/tv/tuner/config/api/current.txt b/tv/tuner/config/api/current.txt index 88576bb46f..aa7b88c249 100644 --- a/tv/tuner/config/api/current.txt +++ b/tv/tuner/config/api/current.txt @@ -326,6 +326,7 @@ package android.media.tuner.testing.configuration.V1_0 { method @Nullable public java.math.BigInteger getFrequency(); method @Nullable public String getId(); method @Nullable public boolean getIsSoftwareFrontend(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.IsdbsFrontendSettings getIsdbsFrontendSettings_optional(); method @Nullable public java.math.BigInteger getRemoveOutputPid(); method @Nullable public android.media.tuner.testing.configuration.V1_0.FrontendTypeEnum getType(); method public void setAtscFrontendSettings_optional(@Nullable android.media.tuner.testing.configuration.V1_0.AtscFrontendSettings); @@ -336,6 +337,7 @@ package android.media.tuner.testing.configuration.V1_0 { method public void setFrequency(@Nullable java.math.BigInteger); method public void setId(@Nullable String); method public void setIsSoftwareFrontend(@Nullable boolean); + method public void setIsdbsFrontendSettings_optional(@Nullable android.media.tuner.testing.configuration.V1_0.IsdbsFrontendSettings); method public void setRemoveOutputPid(@Nullable java.math.BigInteger); method public void setType(@Nullable android.media.tuner.testing.configuration.V1_0.FrontendTypeEnum); } @@ -432,6 +434,22 @@ package android.media.tuner.testing.configuration.V1_0 { method public void setSrcPort(@Nullable long); } + public class IsdbsFrontendSettings { + ctor public IsdbsFrontendSettings(); + method @Nullable public java.math.BigInteger getCoderate(); + method @Nullable public java.math.BigInteger getModulation(); + method @Nullable public java.math.BigInteger getRolloff(); + method @Nullable public java.math.BigInteger getStreamId(); + method @Nullable public java.math.BigInteger getStreamIdType(); + method @Nullable public java.math.BigInteger getSymbolRate(); + method public void setCoderate(@Nullable java.math.BigInteger); + method public void setModulation(@Nullable java.math.BigInteger); + method public void setRolloff(@Nullable java.math.BigInteger); + method public void setStreamId(@Nullable java.math.BigInteger); + method public void setStreamIdType(@Nullable java.math.BigInteger); + method public void setSymbolRate(@Nullable java.math.BigInteger); + } + public class Lnb { ctor public Lnb(); method @Nullable public String getId(); diff --git a/tv/tuner/config/tuner_testing_dynamic_configuration.xsd b/tv/tuner/config/tuner_testing_dynamic_configuration.xsd index bbb514922b..282433e741 100644 --- a/tv/tuner/config/tuner_testing_dynamic_configuration.xsd +++ b/tv/tuner/config/tuner_testing_dynamic_configuration.xsd @@ -84,6 +84,14 @@ + + + + + + + + @@ -119,8 +127,8 @@ - From 713d2c55908aa6bd22481163509c4543a9c6d1bf Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Tue, 28 Jun 2022 01:46:21 +0000 Subject: [PATCH 113/998] audio VTS: Refactor test parameter generation for I/O streams Two changes that are necessary to test offloaded output: 1. Pass all mix port flags specified in the config to HAL when opening an output stream. Previously the generator was omitting the 'NON_BLOCKING' flag, however it is necessary for offloaded output to work. This also now passes the 'GAPLESS_OFFLOAD' flag to the stream opening call site. 2. Provide the DeviceAddress of the attached source/sink device to tests that use mix ports. Some tests were looking up the device address anyway. Also, HAL implementations seem to prefer to have the actual output device instead of 'DEFAULT' when opening offload streams. Bug: 219767875 Test: atest VtsHalAudioV7_0TargetTest Test: atest VtsHalAudioV7_1TargetTest Test: atest HalAudioV7_0GeneratorTest Change-Id: I0482376ecc7d6964f45f508a80716ffab18044b4 --- .../7.0/AudioPrimaryHidlHalTest.cpp | 50 ++----------- .../vts/functional/7.0/Generators.cpp | 71 ++++++++++--------- .../vts/functional/7.0/PolicyConfig.h | 14 +++- .../vts/functional/AudioPrimaryHidlHalTest.h | 17 +++-- .../vts/functional/AudioTestDefinitions.h | 3 +- 5 files changed, 68 insertions(+), 87 deletions(-) diff --git a/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp index dfc238623c..be90b2180c 100644 --- a/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp +++ b/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp @@ -517,20 +517,10 @@ class PcmOnlyConfigOutputStreamTest : public OutputStreamTest { } bool canQueryPresentationPosition() const { - auto maybeSinkAddress = - getCachedPolicyConfig().getSinkDeviceForMixPort(getDeviceName(), getMixPortName()); - // Returning 'true' when no sink is found so the test can fail later with a more clear - // problem description. - return !maybeSinkAddress.has_value() || - !xsd::isTelephonyDevice(maybeSinkAddress.value().deviceType); + return !xsd::isTelephonyDevice(address.deviceType); } void createPatchIfNeeded() { - auto maybeSinkAddress = - getCachedPolicyConfig().getSinkDeviceForMixPort(getDeviceName(), getMixPortName()); - ASSERT_TRUE(maybeSinkAddress.has_value()) - << "No sink device found for mix port " << getMixPortName() << " (module " - << getDeviceName() << ")"; if (areAudioPatchesSupported()) { AudioPortConfig source; source.base.format.value(getConfig().base.format); @@ -540,13 +530,13 @@ class PcmOnlyConfigOutputStreamTest : public OutputStreamTest { source.ext.mix().ioHandle = helper.getIoHandle(); source.ext.mix().useCase.stream({}); AudioPortConfig sink; - sink.ext.device(maybeSinkAddress.value()); + sink.ext.device(address); EXPECT_OK(getDevice()->createAudioPatch(hidl_vec{source}, hidl_vec{sink}, returnIn(res, mPatchHandle))); mHasPatch = res == Result::OK; } else { - EXPECT_OK(stream->setDevices({maybeSinkAddress.value()})); + EXPECT_OK(stream->setDevices({address})); } } @@ -556,10 +546,6 @@ class PcmOnlyConfigOutputStreamTest : public OutputStreamTest { EXPECT_OK(getDevice()->releaseAudioPatch(mPatchHandle)); mHasPatch = false; } - } else { - if (stream) { - EXPECT_OK(stream->setDevices({address})); - } } } @@ -691,24 +677,12 @@ class PcmOnlyConfigInputStreamTest : public InputStreamTest { InputStreamTest::TearDown(); } - bool canQueryCapturePosition() const { - auto maybeSourceAddress = getCachedPolicyConfig().getSourceDeviceForMixPort( - getDeviceName(), getMixPortName()); - // Returning 'true' when no source is found so the test can fail later with a more clear - // problem description. - return !maybeSourceAddress.has_value() || - !xsd::isTelephonyDevice(maybeSourceAddress.value().deviceType); - } + bool canQueryCapturePosition() const { return !xsd::isTelephonyDevice(address.deviceType); } void createPatchIfNeeded() { - auto maybeSourceAddress = getCachedPolicyConfig().getSourceDeviceForMixPort( - getDeviceName(), getMixPortName()); - ASSERT_TRUE(maybeSourceAddress.has_value()) - << "No source device found for mix port " << getMixPortName() << " (module " - << getDeviceName() << ")"; if (areAudioPatchesSupported()) { AudioPortConfig source; - source.ext.device(maybeSourceAddress.value()); + source.ext.device(address); AudioPortConfig sink; sink.base.format.value(getConfig().base.format); sink.base.sampleRateHz.value(getConfig().base.sampleRateHz); @@ -721,7 +695,7 @@ class PcmOnlyConfigInputStreamTest : public InputStreamTest { returnIn(res, mPatchHandle))); mHasPatch = res == Result::OK; } else { - EXPECT_OK(stream->setDevices({maybeSourceAddress.value()})); + EXPECT_OK(stream->setDevices({address})); } } @@ -731,10 +705,6 @@ class PcmOnlyConfigInputStreamTest : public InputStreamTest { EXPECT_OK(getDevice()->releaseAudioPatch(mPatchHandle)); mHasPatch = false; } - } else { - if (stream) { - EXPECT_OK(stream->setDevices({address})); - } } } @@ -864,14 +834,8 @@ TEST_P(MicrophoneInfoInputStreamTest, GetActiveMicrophones) { } ASSERT_OK(res); - auto maybeSourceAddress = - getCachedPolicyConfig().getSourceDeviceForMixPort(getDeviceName(), getMixPortName()); - ASSERT_TRUE(maybeSourceAddress.has_value()) - << "No source device found for mix port " << getMixPortName() << " (module " - << getDeviceName() << ")"; - for (auto microphone : microphones) { - if (microphone.deviceAddress == maybeSourceAddress.value()) { + if (microphone.deviceAddress == address) { StreamReader reader(stream.get(), stream->getBufferSize()); ASSERT_TRUE(reader.start()); reader.pause(); // This ensures that at least one read has happened. diff --git a/audio/core/all-versions/vts/functional/7.0/Generators.cpp b/audio/core/all-versions/vts/functional/7.0/Generators.cpp index f936d0afbf..cd84c41308 100644 --- a/audio/core/all-versions/vts/functional/7.0/Generators.cpp +++ b/audio/core/all-versions/vts/functional/7.0/Generators.cpp @@ -57,9 +57,6 @@ static std::vector combineAudioConfig(std::vector, bool> generateOutFlags( const xsd::MixPorts::MixPort& mixPort) { - static const std::vector offloadFlags = { - toString(xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD), - toString(xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_DIRECT)}; std::vector flags; bool isOffload = false; if (mixPort.hasFlags()) { @@ -67,14 +64,10 @@ static std::tuple, bool> generateOutFlags( isOffload = std::find(xsdFlags.begin(), xsdFlags.end(), xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) != xsdFlags.end(); - if (!isOffload) { - for (auto flag : xsdFlags) { - if (flag != xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_PRIMARY) { - flags.push_back(toString(flag)); - } + for (auto flag : xsdFlags) { + if (flag != xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_PRIMARY) { + flags.push_back(toString(flag)); } - } else { - flags = offloadFlags; } } return {flags, isOffload}; @@ -100,11 +93,10 @@ std::vector generateOutputDeviceConfigParameters(bool one if (!module || !module->getFirstMixPorts()) break; for (const auto& mixPort : module->getFirstMixPorts()->getMixPort()) { if (mixPort.getRole() != xsd::Role::source) continue; // not an output profile - if (getCachedPolicyConfig() - .getAttachedSinkDeviceForMixPort(moduleName, mixPort.getName()) - .empty()) { - continue; // no attached device - } + const auto attachedDeviceAddress = + getCachedPolicyConfig().getDeviceAddressOfSinkDeviceAttachedToMixPort( + moduleName, mixPort.getName()); + if (!attachedDeviceAddress.has_value()) continue; auto [flags, isOffload] = generateOutFlags(mixPort); for (const auto& profile : mixPort.getProfile()) { if (!profile.hasFormat() || !profile.hasSamplingRates() || @@ -118,7 +110,8 @@ std::vector generateOutputDeviceConfigParameters(bool one if (isOffload) { config.offloadInfo.info(generateOffloadInfo(config.base)); } - result.emplace_back(device, mixPort.getName(), config, flags); + result.emplace_back(device, mixPort.getName(), attachedDeviceAddress.value(), + config, flags); if (oneProfilePerDevice) break; } if (oneProfilePerDevice) break; @@ -162,13 +155,16 @@ const std::vector& getOutputDeviceInvalidConfigParameters profile.getFormat(), static_cast(profile.getSamplingRates()[0]), toString(profile.getChannelMasks()[0])}; + DeviceAddress defaultDevice = { + toString(xsd::AudioDevice::AUDIO_DEVICE_OUT_DEFAULT), {}}; { AudioConfig config{.base = validBase}; config.base.channelMask = "random_string"; if (isOffload) { config.offloadInfo.info(generateOffloadInfo(validBase)); } - result.emplace_back(device, mixPort.getName(), config, validFlags); + result.emplace_back(device, mixPort.getName(), defaultDevice, config, + validFlags); } { AudioConfig config{.base = validBase}; @@ -176,7 +172,8 @@ const std::vector& getOutputDeviceInvalidConfigParameters if (isOffload) { config.offloadInfo.info(generateOffloadInfo(validBase)); } - result.emplace_back(device, mixPort.getName(), config, validFlags); + result.emplace_back(device, mixPort.getName(), defaultDevice, config, + validFlags); } if (generateInvalidFlags) { AudioConfig config{.base = validBase}; @@ -184,32 +181,37 @@ const std::vector& getOutputDeviceInvalidConfigParameters config.offloadInfo.info(generateOffloadInfo(validBase)); } std::vector flags = {"random_string", ""}; - result.emplace_back(device, mixPort.getName(), config, flags); + result.emplace_back(device, mixPort.getName(), defaultDevice, config, + flags); } if (isOffload) { { AudioConfig config{.base = validBase}; config.offloadInfo.info(generateOffloadInfo(validBase)); config.offloadInfo.info().base.channelMask = "random_string"; - result.emplace_back(device, mixPort.getName(), config, validFlags); + result.emplace_back(device, mixPort.getName(), defaultDevice, config, + validFlags); } { AudioConfig config{.base = validBase}; config.offloadInfo.info(generateOffloadInfo(validBase)); config.offloadInfo.info().base.format = "random_string"; - result.emplace_back(device, mixPort.getName(), config, validFlags); + result.emplace_back(device, mixPort.getName(), defaultDevice, config, + validFlags); } { AudioConfig config{.base = validBase}; config.offloadInfo.info(generateOffloadInfo(validBase)); config.offloadInfo.info().streamType = "random_string"; - result.emplace_back(device, mixPort.getName(), config, validFlags); + result.emplace_back(device, mixPort.getName(), defaultDevice, config, + validFlags); } { AudioConfig config{.base = validBase}; config.offloadInfo.info(generateOffloadInfo(validBase)); config.offloadInfo.info().usage = "random_string"; - result.emplace_back(device, mixPort.getName(), config, validFlags); + result.emplace_back(device, mixPort.getName(), defaultDevice, config, + validFlags); } hasOffloadConfig = true; } else { @@ -233,11 +235,10 @@ std::vector generateInputDeviceConfigParameters(bool oneP if (!module || !module->getFirstMixPorts()) break; for (const auto& mixPort : module->getFirstMixPorts()->getMixPort()) { if (mixPort.getRole() != xsd::Role::sink) continue; // not an input profile - if (getCachedPolicyConfig() - .getAttachedSourceDeviceForMixPort(moduleName, mixPort.getName()) - .empty()) { - continue; // no attached device - } + const auto attachedDeviceAddress = + getCachedPolicyConfig().getDeviceAddressOfSourceDeviceAttachedToMixPort( + moduleName, mixPort.getName()); + if (!attachedDeviceAddress.has_value()) continue; std::vector flags; if (mixPort.hasFlags()) { std::transform(mixPort.getFlags().begin(), mixPort.getFlags().end(), @@ -250,7 +251,8 @@ std::vector generateInputDeviceConfigParameters(bool oneP auto configs = combineAudioConfig(profile.getChannelMasks(), profile.getSamplingRates(), profile.getFormat()); for (const auto& config : configs) { - result.emplace_back(device, mixPort.getName(), config, flags); + result.emplace_back(device, mixPort.getName(), attachedDeviceAddress.value(), + config, flags); if (oneProfilePerDevice) break; } if (oneProfilePerDevice) break; @@ -298,20 +300,25 @@ const std::vector& getInputDeviceInvalidConfigParameters( profile.getFormat(), static_cast(profile.getSamplingRates()[0]), toString(profile.getChannelMasks()[0])}; + DeviceAddress defaultDevice = { + toString(xsd::AudioDevice::AUDIO_DEVICE_IN_DEFAULT), {}}; { AudioConfig config{.base = validBase}; config.base.channelMask = "random_string"; - result.emplace_back(device, mixPort.getName(), config, validFlags); + result.emplace_back(device, mixPort.getName(), defaultDevice, config, + validFlags); } { AudioConfig config{.base = validBase}; config.base.format = "random_string"; - result.emplace_back(device, mixPort.getName(), config, validFlags); + result.emplace_back(device, mixPort.getName(), defaultDevice, config, + validFlags); } if (generateInvalidFlags) { AudioConfig config{.base = validBase}; std::vector flags = {"random_string", ""}; - result.emplace_back(device, mixPort.getName(), config, flags); + result.emplace_back(device, mixPort.getName(), defaultDevice, config, + flags); } hasConfig = true; break; diff --git a/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h b/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h index 4aea503938..c1d5669775 100644 --- a/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h +++ b/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h @@ -61,6 +61,18 @@ class PolicyConfig { const std::set& getModulesWithDevicesNames() const { return mModulesWithDevicesNames; } + std::optional getDeviceAddressOfSinkDeviceAttachedToMixPort( + const std::string& moduleName, const std::string& mixPortName) const { + const auto attachedDevicePort = getAttachedSinkDeviceForMixPort(moduleName, mixPortName); + if (attachedDevicePort.empty()) return {}; + return getDeviceAddressOfDevicePort(moduleName, attachedDevicePort); + } + std::optional getDeviceAddressOfSourceDeviceAttachedToMixPort( + const std::string& moduleName, const std::string& mixPortName) const { + const auto attachedDevicePort = getAttachedSourceDeviceForMixPort(moduleName, mixPortName); + if (attachedDevicePort.empty()) return {}; + return getDeviceAddressOfDevicePort(moduleName, attachedDevicePort); + } std::string getAttachedSinkDeviceForMixPort(const std::string& moduleName, const std::string& mixPortName) const { return findAttachedDevice(getAttachedDevices(moduleName), @@ -84,8 +96,6 @@ class PolicyConfig { const std::vector& getAttachedDevices(const std::string& moduleName) const; std::optional getDeviceAddressOfDevicePort( const std::string& moduleName, const std::string& devicePortName) const; - std::string getDevicePortTagNameFromType(const std::string& moduleName, - const AudioDevice& deviceType) const; std::set getSinkDevicesForMixPort(const std::string& moduleName, const std::string& mixPortName) const; std::set getSourceDevicesForMixPort(const std::string& moduleName, diff --git a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h index 38e9e5f467..afc25f0a1e 100644 --- a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h +++ b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h @@ -617,7 +617,8 @@ static std::string DeviceConfigParameterToString( std::get(info.param))); #elif MAJOR_VERSION >= 7 const auto configPart = - std::to_string(config.base.sampleRateHz) + "_" + + ::testing::PrintToString(std::get(info.param).deviceType) + + "_" + std::to_string(config.base.sampleRateHz) + "_" + // The channel masks and flags are vectors of strings, just need to sanitize them. SanitizeStringForGTestName(::testing::PrintToString(config.base.channelMask)) + "_" + SanitizeStringForGTestName(::testing::PrintToString(std::get(info.param))); @@ -658,6 +659,9 @@ class AudioHidlTestWithDeviceConfigParameter std::get(std::get(GetParam()))); } #elif MAJOR_VERSION >= 7 + DeviceAddress getAttachedDeviceAddress() const { + return std::get(GetParam()); + } hidl_vec getInputFlags() const { return std::get(GetParam()); } hidl_vec getOutputFlags() const { return std::get(GetParam()); } #endif @@ -1047,7 +1051,7 @@ class OutputStreamTest #if MAJOR_VERSION <= 6 address.device = AudioDevice::OUT_DEFAULT; #elif MAJOR_VERSION >= 7 - address.deviceType = toString(xsd::AudioDevice::AUDIO_DEVICE_OUT_DEFAULT); + address = getAttachedDeviceAddress(); #endif const AudioConfig& config = getConfig(); auto flags = getOutputFlags(); @@ -1243,16 +1247,11 @@ class InputStreamTest #if MAJOR_VERSION <= 6 address.device = AudioDevice::IN_DEFAULT; #elif MAJOR_VERSION >= 7 - auto maybeSourceAddress = getCachedPolicyConfig().getSourceDeviceForMixPort( - getDeviceName(), getMixPortName()); + address = getAttachedDeviceAddress(); auto& metadata = initMetadata.tracks[0]; - if (maybeSourceAddress.has_value() && - !xsd::isTelephonyDevice(maybeSourceAddress.value().deviceType)) { - address = maybeSourceAddress.value(); + if (!xsd::isTelephonyDevice(address.deviceType)) { metadata.source = toString(xsd::AudioSource::AUDIO_SOURCE_UNPROCESSED); metadata.channelMask = getConfig().base.channelMask; - } else { - address.deviceType = toString(xsd::AudioDevice::AUDIO_DEVICE_IN_DEFAULT); } #if MAJOR_VERSION == 7 && MINOR_VERSION >= 1 auto flagsIt = std::find(flags.begin(), flags.end(), diff --git a/audio/core/all-versions/vts/functional/AudioTestDefinitions.h b/audio/core/all-versions/vts/functional/AudioTestDefinitions.h index 802b87bc36..3de06c35ac 100644 --- a/audio/core/all-versions/vts/functional/AudioTestDefinitions.h +++ b/audio/core/all-versions/vts/functional/AudioTestDefinitions.h @@ -39,9 +39,10 @@ using DeviceConfigParameter = std::tuple< std::variant>; #elif MAJOR_VERSION >= 7 -enum { PARAM_DEVICE, PARAM_PORT_NAME, PARAM_CONFIG, PARAM_FLAGS }; +enum { PARAM_DEVICE, PARAM_PORT_NAME, PARAM_ATTACHED_DEV_ADDR, PARAM_CONFIG, PARAM_FLAGS }; using DeviceConfigParameter = std::tuple>; #endif From aee8c9e2f9d75e7eed2f9465fbf187f4e9b5f53d Mon Sep 17 00:00:00 2001 From: Frankie Lizcano Date: Fri, 24 Jun 2022 21:28:00 +0000 Subject: [PATCH 114/998] vts: Added support for ISDBT Frontend types The latest version of the dynamic VTS for Tuner HALs did not support the configuration of ISDBT Frontend types. Logic was added to allow this feature. Editing the tuner_testing_dynamic_configuration file directly changes the api outlined in api/current.txt to support reading the newly added features from the vendor's configuration file. Bug: b/237112300 Test: manual - Ran local tests that ensured the ATSC frontend was being configured correctly. Also ran the VTS module to ensure no failures were occuring. Change-Id: Ic18a116f15c79b30c7ecf827f5f7a1e453c20236 --- .../config/TunerTestingConfigAidlReaderV1_0.h | 39 +++++++++++++++++++ tv/tuner/config/api/current.txt | 32 +++++++++++++++ .../tuner_testing_dynamic_configuration.xsd | 21 ++++++++-- 3 files changed, 89 insertions(+), 3 deletions(-) diff --git a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h index e0118cd6fb..9e461b6115 100644 --- a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h +++ b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h @@ -295,6 +295,8 @@ struct TunerTestingConfigAidlReader1_0 { break; case FrontendTypeEnum::ISDBT: type = FrontendType::ISDBT; + frontendMap[id].settings.set( + readIsdbtFrontendSettings(feConfig)); break; case FrontendTypeEnum::DTMB: type = FrontendType::DTMB; @@ -743,6 +745,43 @@ struct TunerTestingConfigAidlReader1_0 { return isdbsSettings; } + static FrontendIsdbtSettings readIsdbtFrontendSettings(Frontend& feConfig) { + ALOGW("[ConfigReader] fe type is isdbt"); + FrontendIsdbtSettings isdbtSettings{ + .frequency = (int64_t)feConfig.getFrequency(), + }; + if (feConfig.hasEndFrequency()) { + isdbtSettings.endFrequency = (int64_t)feConfig.getEndFrequency(); + } + if (!feConfig.hasIsdbtFrontendSettings_optional()) { + ALOGW("[ConfigReader] no more isdbt settings"); + return isdbtSettings; + } + auto isdbt = feConfig.getFirstIsdbtFrontendSettings_optional(); + isdbtSettings.inversion = static_cast(isdbt->getInversion()); + isdbtSettings.bandwidth = static_cast(isdbt->getBandwidth()); + isdbtSettings.mode = static_cast(isdbt->getMode()); + isdbtSettings.guardInterval = + static_cast(isdbt->getGuardInterval()); + isdbtSettings.serviceAreaId = (int32_t)isdbt->getServiceAreaId(); + isdbtSettings.partialReceptionFlag = + static_cast(isdbt->getPartialReceptionFlag()); + if (!isdbt->hasFrontendIsdbtLayerSettings()) { + ALOGW("[ConfigReader] no isdbt layer settings"); + return isdbtSettings; + } + auto layerSettings = isdbt->getFirstFrontendIsdbtLayerSettings(); + ::aidl::android::hardware::tv::tuner::FrontendIsdbtLayerSettings mLayerSettings; + mLayerSettings.modulation = + static_cast(layerSettings->getModulation()); + mLayerSettings.coderate = static_cast(layerSettings->getCoderate()); + mLayerSettings.timeInterleave = + static_cast(layerSettings->getTimeInterleave()); + mLayerSettings.numOfSegment = (int32_t)layerSettings->getNumOfSegment(); + isdbtSettings.layerSettings.push_back(mLayerSettings); + return isdbtSettings; + } + static bool readFilterTypeAndSettings(Filter filterConfig, DemuxFilterType& type, DemuxFilterSettings& settings) { auto mainType = filterConfig.getMainType(); diff --git a/tv/tuner/config/api/current.txt b/tv/tuner/config/api/current.txt index aa7b88c249..acaf07af4d 100644 --- a/tv/tuner/config/api/current.txt +++ b/tv/tuner/config/api/current.txt @@ -327,6 +327,7 @@ package android.media.tuner.testing.configuration.V1_0 { method @Nullable public String getId(); method @Nullable public boolean getIsSoftwareFrontend(); method @Nullable public android.media.tuner.testing.configuration.V1_0.IsdbsFrontendSettings getIsdbsFrontendSettings_optional(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.IsdbtFrontendSettings getIsdbtFrontendSettings_optional(); method @Nullable public java.math.BigInteger getRemoveOutputPid(); method @Nullable public android.media.tuner.testing.configuration.V1_0.FrontendTypeEnum getType(); method public void setAtscFrontendSettings_optional(@Nullable android.media.tuner.testing.configuration.V1_0.AtscFrontendSettings); @@ -338,10 +339,23 @@ package android.media.tuner.testing.configuration.V1_0 { method public void setId(@Nullable String); method public void setIsSoftwareFrontend(@Nullable boolean); method public void setIsdbsFrontendSettings_optional(@Nullable android.media.tuner.testing.configuration.V1_0.IsdbsFrontendSettings); + method public void setIsdbtFrontendSettings_optional(@Nullable android.media.tuner.testing.configuration.V1_0.IsdbtFrontendSettings); method public void setRemoveOutputPid(@Nullable java.math.BigInteger); method public void setType(@Nullable android.media.tuner.testing.configuration.V1_0.FrontendTypeEnum); } + public class FrontendIsdbtLayerSettings { + ctor public FrontendIsdbtLayerSettings(); + method @Nullable public java.math.BigInteger getCoderate(); + method @Nullable public java.math.BigInteger getModulation(); + method @Nullable public java.math.BigInteger getNumOfSegment(); + method @Nullable public java.math.BigInteger getTimeInterleave(); + method public void setCoderate(@Nullable java.math.BigInteger); + method public void setModulation(@Nullable java.math.BigInteger); + method public void setNumOfSegment(@Nullable java.math.BigInteger); + method public void setTimeInterleave(@Nullable java.math.BigInteger); + } + public enum FrontendTypeEnum { method @NonNull public String getRawName(); enum_constant public static final android.media.tuner.testing.configuration.V1_0.FrontendTypeEnum ANALOG; @@ -450,6 +464,24 @@ package android.media.tuner.testing.configuration.V1_0 { method public void setSymbolRate(@Nullable java.math.BigInteger); } + public class IsdbtFrontendSettings { + ctor public IsdbtFrontendSettings(); + method @Nullable public java.math.BigInteger getBandwidth(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.FrontendIsdbtLayerSettings getFrontendIsdbtLayerSettings(); + method @Nullable public java.math.BigInteger getGuardInterval(); + method @Nullable public java.math.BigInteger getInversion(); + method @Nullable public java.math.BigInteger getMode(); + method @Nullable public java.math.BigInteger getPartialReceptionFlag(); + method @Nullable public java.math.BigInteger getServiceAreaId(); + method public void setBandwidth(@Nullable java.math.BigInteger); + method public void setFrontendIsdbtLayerSettings(@Nullable android.media.tuner.testing.configuration.V1_0.FrontendIsdbtLayerSettings); + method public void setGuardInterval(@Nullable java.math.BigInteger); + method public void setInversion(@Nullable java.math.BigInteger); + method public void setMode(@Nullable java.math.BigInteger); + method public void setPartialReceptionFlag(@Nullable java.math.BigInteger); + method public void setServiceAreaId(@Nullable java.math.BigInteger); + } + public class Lnb { ctor public Lnb(); method @Nullable public String getId(); diff --git a/tv/tuner/config/tuner_testing_dynamic_configuration.xsd b/tv/tuner/config/tuner_testing_dynamic_configuration.xsd index 282433e741..f4347f0d73 100644 --- a/tv/tuner/config/tuner_testing_dynamic_configuration.xsd +++ b/tv/tuner/config/tuner_testing_dynamic_configuration.xsd @@ -92,6 +92,21 @@ + + + + + + + + + + + + + + + @@ -128,9 +143,9 @@ - + + + From 158a2ddb2fafa01e2e52a4c9033b81c29d05dfdd Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Mon, 27 Jun 2022 21:34:09 +0000 Subject: [PATCH 115/998] audio VTS: add CompressedOffloadOutputStream test CompressedOffloadOutputStreamTest#Mp3FormatGaplessOffload verifies that gapless offload is supported by compressed offload mix ports. Bug: 219767875 Test: atest VtsHalAudioV7_0TargetTest Test: atest VtsHalAudioV7_1TargetTest Change-Id: I7d42f8a714da2923b8775445ba301938ca90b885 --- .../7.0/AudioPrimaryHidlHalTest.cpp | 134 ++++++++++++++++-- .../vts/functional/7.0/Generators.cpp | 4 +- .../all-versions/vts/functional/Android.bp | 2 + .../vts/functional/AudioPrimaryHidlHalTest.h | 17 ++- .../functional/VtsHalAudioV7_0TargetTest.xml | 1 + .../functional/VtsHalAudioV7_1TargetTest.xml | 2 + .../vts/functional/data/sine882hz3s.mp3 | Bin 0 -> 19117 bytes 7 files changed, 141 insertions(+), 19 deletions(-) create mode 100644 audio/core/all-versions/vts/functional/data/sine882hz3s.mp3 diff --git a/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp index be90b2180c..44d3cbd14a 100644 --- a/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp +++ b/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp @@ -14,6 +14,9 @@ * limitations under the License. */ +#include +#include + #include #include "Generators.h" @@ -561,16 +564,22 @@ class PcmOnlyConfigOutputStreamTest : public OutputStreamTest { // Sometimes HAL doesn't have enough information until the audio data actually gets // consumed by the hardware. bool timedOut = false; - res = Result::INVALID_STATE; - for (android::base::Timer elapsed; - res != Result::OK && !writer.hasError() && - !(timedOut = (elapsed.duration() >= kPositionChangeTimeout));) { - usleep(kWriteDurationUs); - ASSERT_OK(stream->getPresentationPosition(returnIn(res, framesInitial, ts))); - ASSERT_RESULT(okOrInvalidState, res); + if (!firstPosition || *firstPosition == std::numeric_limits::max()) { + res = Result::INVALID_STATE; + for (android::base::Timer elapsed; + res != Result::OK && !writer.hasError() && + !(timedOut = (elapsed.duration() >= kPositionChangeTimeout));) { + usleep(kWriteDurationUs); + ASSERT_OK(stream->getPresentationPosition(returnIn(res, framesInitial, ts))); + ASSERT_RESULT(okOrInvalidState, res); + } + ASSERT_FALSE(writer.hasError()); + ASSERT_FALSE(timedOut); + } else { + // Use `firstPosition` instead of querying it from the HAL. This is used when + // `waitForPresentationPositionAdvance` is called in a loop. + framesInitial = *firstPosition; } - ASSERT_FALSE(writer.hasError()); - ASSERT_FALSE(timedOut); uint64_t frames = framesInitial; for (android::base::Timer elapsed; @@ -632,7 +641,7 @@ TEST_P(PcmOnlyConfigOutputStreamTest, PresentationPositionPreservedOnStandby) { ASSERT_OK(stream->standby()); writer.resume(); - uint64_t frames; + uint64_t frames = std::numeric_limits::max(); ASSERT_NO_FATAL_FAILURE(waitForPresentationPositionAdvance(writer, &frames)); EXPECT_GT(frames, framesInitial); @@ -700,11 +709,9 @@ class PcmOnlyConfigInputStreamTest : public InputStreamTest { } void releasePatchIfNeeded() { - if (getDevice()) { - if (areAudioPatchesSupported() && mHasPatch) { - EXPECT_OK(getDevice()->releaseAudioPatch(mPatchHandle)); - mHasPatch = false; - } + if (getDevice() && areAudioPatchesSupported() && mHasPatch) { + EXPECT_OK(getDevice()->releaseAudioPatch(mPatchHandle)); + mHasPatch = false; } } @@ -853,3 +860,100 @@ INSTANTIATE_TEST_CASE_P(MicrophoneInfoInputStream, MicrophoneInfoInputStreamTest ::testing::ValuesIn(getBuiltinMicConfigParameters()), &DeviceConfigParameterToString); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(MicrophoneInfoInputStreamTest); + +static const std::vector& getOutputDeviceCompressedConfigParameters( + const AudioConfigBase& configToMatch) { + static const std::vector parameters = [&] { + auto allParams = getOutputDeviceConfigParameters(); + std::vector compressedParams; + std::copy_if(allParams.begin(), allParams.end(), std::back_inserter(compressedParams), + [&](auto cfg) { + if (std::get(cfg).base != configToMatch) return false; + const auto& flags = std::get(cfg); + return std::find_if(flags.begin(), flags.end(), [](const auto& flag) { + return flag == + toString(xsd::AudioInOutFlag:: + AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD); + }) != flags.end(); + }); + return compressedParams; + }(); + return parameters; +} + +class CompressedOffloadOutputStreamTest : public PcmOnlyConfigOutputStreamTest { + public: + void loadData(const std::string& fileName, std::vector* data) { + std::ifstream is(fileName, std::ios::in | std::ios::binary); + ASSERT_TRUE(is.good()) << "Failed to open file " << fileName; + is.seekg(0, is.end); + data->reserve(data->size() + is.tellg()); + is.seekg(0, is.beg); + data->insert(data->end(), std::istreambuf_iterator(is), + std::istreambuf_iterator()); + ASSERT_TRUE(!is.fail()) << "Failed to read from file " << fileName; + } +}; + +TEST_P(CompressedOffloadOutputStreamTest, Mp3FormatGaplessOffload) { + doc::test("Check that compressed offload mix ports for MP3 implement gapless offload"); + const auto& flags = getOutputFlags(); + if (std::find_if(flags.begin(), flags.end(), [](const auto& flag) { + return flag == toString(xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_GAPLESS_OFFLOAD); + }) == flags.end()) { + GTEST_SKIP() << "Compressed offload mix port does not support gapless offload"; + } + // FIXME: The presentation position is not updated if there is no zero padding in data. + std::vector offloadData(stream->getBufferSize()); + ASSERT_NO_FATAL_FAILURE(loadData("/data/local/tmp/sine882hz3s.mp3", &offloadData)); + ASSERT_FALSE(offloadData.empty()); + ASSERT_NO_FATAL_FAILURE(createPatchIfNeeded()); + const int presentationeEndPrecisionMs = 1000; + const int sampleRate = 44100; + const int significantSampleNumber = (presentationeEndPrecisionMs * sampleRate) / 1000; + const int delay = 576 + 1000; + const int padding = 756 + 1000; + const int durationMs = 3000 - 44; + // StreamWriter plays 'offloadData' in a loop, possibly using multiple calls to 'write', + // this depends on the relative sizes of 'offloadData' and the HAL buffer. Writer calls + // 'onDataWrap' callback each time it wraps around the buffer. + StreamWriter writer( + stream.get(), stream->getBufferSize(), std::move(offloadData), [&]() /* onDataWrap */ { + Parameters::set(stream, + {{AUDIO_OFFLOAD_CODEC_DELAY_SAMPLES, std::to_string(delay)}, + {AUDIO_OFFLOAD_CODEC_PADDING_SAMPLES, std::to_string(padding)}}); + stream->drain(AudioDrain::EARLY_NOTIFY); + }); + ASSERT_TRUE(writer.start()); + ASSERT_TRUE(writer.waitForAtLeastOneCycle()); + // Decrease the volume since the test plays a loud sine wave. + ASSERT_OK(stream->setVolume(0.1, 0.1)); + // How many times to loop the track so that the sum of gapless delay and padding from + // the first presentation end to the last is at least 'presentationeEndPrecisionMs'. + const int playbackNumber = (int)(significantSampleNumber / ((float)delay + padding) + 1); + std::vector presentationEndTimes; + uint64_t previousPosition = std::numeric_limits::max(); + for (int i = 0; i < playbackNumber; ++i) { + const auto start = std::chrono::steady_clock::now(); + ASSERT_NO_FATAL_FAILURE( + waitForPresentationPositionAdvance(writer, &previousPosition, &previousPosition)); + presentationEndTimes.push_back(std::chrono::duration_cast( + std::chrono::steady_clock::now() - start) + .count()); + } + const float avgDuration = + std::accumulate(presentationEndTimes.begin(), presentationEndTimes.end(), 0.0) / + presentationEndTimes.size(); + EXPECT_NEAR(durationMs, avgDuration, presentationeEndPrecisionMs * 0.1); + writer.stop(); + releasePatchIfNeeded(); +} + +INSTANTIATE_TEST_CASE_P( + CompressedOffloadOutputStream, CompressedOffloadOutputStreamTest, + ::testing::ValuesIn(getOutputDeviceCompressedConfigParameters(AudioConfigBase{ + .format = xsd::toString(xsd::AudioFormat::AUDIO_FORMAT_MP3), + .sampleRateHz = 44100, + .channelMask = xsd::toString(xsd::AudioChannelMask::AUDIO_CHANNEL_OUT_STEREO)})), + &DeviceConfigParameterToString); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(CompressedOffloadOutputStreamTest); diff --git a/audio/core/all-versions/vts/functional/7.0/Generators.cpp b/audio/core/all-versions/vts/functional/7.0/Generators.cpp index cd84c41308..8b955b6c84 100644 --- a/audio/core/all-versions/vts/functional/7.0/Generators.cpp +++ b/audio/core/all-versions/vts/functional/7.0/Generators.cpp @@ -78,10 +78,10 @@ static AudioOffloadInfo generateOffloadInfo(const AudioConfigBase& base) { .base = base, .streamType = toString(xsd::AudioStreamType::AUDIO_STREAM_MUSIC), .usage = toString(xsd::AudioUsage::AUDIO_USAGE_MEDIA), - .bitRatePerSecond = 320, + .bitRatePerSecond = 192, // as in sine882hz3s.mp3 .durationMicroseconds = -1, .bitWidth = 16, - .bufferSize = 256 // arbitrary value + .bufferSize = 72000 // 3 seconds at 192 kbps, as in sine882hz3s.mp3 }; } diff --git a/audio/core/all-versions/vts/functional/Android.bp b/audio/core/all-versions/vts/functional/Android.bp index c757032e0f..5b0a7f28f9 100644 --- a/audio/core/all-versions/vts/functional/Android.bp +++ b/audio/core/all-versions/vts/functional/Android.bp @@ -190,6 +190,7 @@ cc_test { ], data: [ ":audio_policy_configuration_V7_0", + "data/sine882hz3s.mp3", ], // Use test_config for vts suite. // TODO(b/146104851): Add auto-gen rules and remove it. @@ -223,6 +224,7 @@ cc_test { ], data: [ ":audio_policy_configuration_V7_1", + "data/sine882hz3s.mp3", ], // Use test_config for vts suite. // TODO(b/146104851): Add auto-gen rules and remove it. diff --git a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h index afc25f0a1e..6c5584d427 100644 --- a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h +++ b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h @@ -937,6 +937,14 @@ class StreamWriter : public StreamWorker { StreamWriter(IStreamOut* stream, size_t bufferSize) : mStream(stream), mBufferSize(bufferSize), mData(mBufferSize) {} + StreamWriter(IStreamOut* stream, size_t bufferSize, std::vector&& data, + std::function onDataWrap) + : mStream(stream), + mBufferSize(bufferSize), + mData(std::move(data)), + mOnDataWrap(onDataWrap) { + ALOGW("StreamWriter data size: %d", (int)mData.size()); + } ~StreamWriter() { stop(); if (mEfGroup) { @@ -1002,9 +1010,11 @@ class StreamWriter : public StreamWorker { ALOGE("command message queue write failed"); return false; } - const size_t dataSize = std::min(mData.size(), mDataMQ->availableToWrite()); - bool success = mDataMQ->write(mData.data(), dataSize); + const size_t dataSize = std::min(mData.size() - mDataPosition, mDataMQ->availableToWrite()); + bool success = mDataMQ->write(mData.data() + mDataPosition, dataSize); ALOGE_IF(!success, "data message queue write failed"); + mDataPosition += dataSize; + if (mDataPosition >= mData.size()) mDataPosition = 0; mEfGroup->wake(static_cast(MessageQueueFlagBits::NOT_EMPTY)); uint32_t efState = 0; @@ -1030,6 +1040,7 @@ class StreamWriter : public StreamWorker { ALOGE("bad wait status: %d", ret); success = false; } + if (success && mDataPosition == 0) mOnDataWrap(); return success; } @@ -1037,6 +1048,8 @@ class StreamWriter : public StreamWorker { IStreamOut* const mStream; const size_t mBufferSize; std::vector mData; + std::function mOnDataWrap = []() {}; + size_t mDataPosition = 0; std::unique_ptr mCommandMQ; std::unique_ptr mDataMQ; std::unique_ptr mStatusMQ; diff --git a/audio/core/all-versions/vts/functional/VtsHalAudioV7_0TargetTest.xml b/audio/core/all-versions/vts/functional/VtsHalAudioV7_0TargetTest.xml index f0e26958b9..8da5744089 100644 --- a/audio/core/all-versions/vts/functional/VtsHalAudioV7_0TargetTest.xml +++ b/audio/core/all-versions/vts/functional/VtsHalAudioV7_0TargetTest.xml @@ -29,6 +29,7 @@ @@ -698,6 +698,7 @@ + From 5046193cd321ddebc19bcab1d1b39590800c5838 Mon Sep 17 00:00:00 2001 From: Frankie Lizcano Date: Tue, 28 Jun 2022 21:36:26 +0000 Subject: [PATCH 122/998] Improve Tuner VTS Configuration This CL allows vendors to configure the DVR Playback data flow in their configuration files for the Tuner Hardware. Their connections were checked to ensure their validity. Additionally, vendors can now give an extra list of optional filters that can be utilized in the DVR Playback data flow. Bug: b/182519645 Test: vts-tradefed run vts --module VtsHalTvTunerTargetTest Change-Id: Ie77337508444672e327ac88a91e73c96bd80fb22 --- .../functional/VtsHalTvTunerTestConfigurations.h | 16 ++++++++++++++++ .../config/TunerTestingConfigAidlReaderV1_0.h | 10 +++++++++- tv/tuner/config/api/current.txt | 13 +++++++++++++ .../tuner_testing_dynamic_configuration.xsd | 12 +++++++++++- 4 files changed, 49 insertions(+), 2 deletions(-) diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h index a88b105ce3..f093b8eb93 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h @@ -191,6 +191,7 @@ inline void connectHardwaresToTestCases() { TunerTestingConfigAidlReader1_0::connectDescrambling(descrambling); TunerTestingConfigAidlReader1_0::connectLnbLive(lnbLive); TunerTestingConfigAidlReader1_0::connectLnbRecord(lnbRecord); + TunerTestingConfigAidlReader1_0::connectDvrPlayback(playback); }; inline bool validateConnections() { @@ -248,6 +249,8 @@ inline bool validateConnections() { dvrIsValid &= lnbRecord.support ? dvrMap.find(lnbRecord.dvrRecordId) != dvrMap.end() : true; + dvrIsValid &= playback.support ? dvrMap.find(playback.dvrId) != dvrMap.end() : true; + if (!dvrIsValid) { ALOGW("[vts config] dynamic config dvr connection is invalid."); return false; @@ -285,6 +288,19 @@ inline bool validateConnections() { filterIsValid &= filterMap.find(filterId) != filterMap.end(); } + filterIsValid &= playback.support + ? filterMap.find(playback.audioFilterId) != filterMap.end() && + filterMap.find(playback.videoFilterId) != filterMap.end() + : true; + filterIsValid &= playback.sectionFilterId.compare(emptyHardwareId) == 0 + ? true + : filterMap.find(playback.sectionFilterId) != filterMap.end(); + + for (auto& filterId : playback.extraFilters) { + filterIsValid &= + playback.hasExtraFilters ? filterMap.find(filterId) != filterMap.end() : true; + } + if (!filterIsValid) { ALOGW("[vts config] dynamic config filter connection is invalid."); return false; diff --git a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h index 12ccb80911..3991267eba 100644 --- a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h +++ b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h @@ -146,12 +146,13 @@ struct ScanHardwareConnections { struct DvrPlaybackHardwareConnections { bool support; + bool hasExtraFilters = false; string frontendId; string dvrId; string audioFilterId; string videoFilterId; string sectionFilterId; - /* list string of extra filters; */ + vector extraFilters; }; struct DvrRecordHardwareConnections { @@ -533,6 +534,13 @@ struct TunerTestingConfigAidlReader1_0 { } else { playback.sectionFilterId = emptyHardwareId; } + if (playbackConfig.hasOptionalFilters() && !playback.hasExtraFilters) { + auto optionalFilters = playbackConfig.getFirstOptionalFilters()->getOptionalFilter(); + for (size_t i = 0; i < optionalFilters.size(); ++i) { + playback.extraFilters.push_back(optionalFilters[i].getFilterId()); + } + playback.hasExtraFilters = true; + } } static void connectDvrRecord(DvrRecordHardwareConnections& record) { diff --git a/tv/tuner/config/api/current.txt b/tv/tuner/config/api/current.txt index 53720ac06d..36dd54ab9c 100644 --- a/tv/tuner/config/api/current.txt +++ b/tv/tuner/config/api/current.txt @@ -83,14 +83,21 @@ package android.media.tuner.testing.configuration.V1_0 { ctor public DataFlowConfiguration.DvrPlayback(); method @Nullable public String getAudioFilterConnection(); method @Nullable public String getDvrConnection(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.DvrPlayback.OptionalFilters getOptionalFilters(); method @Nullable public String getSectionFilterConnection(); method @Nullable public String getVideoFilterConnection(); method public void setAudioFilterConnection(@Nullable String); method public void setDvrConnection(@Nullable String); + method public void setOptionalFilters(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.DvrPlayback.OptionalFilters); method public void setSectionFilterConnection(@Nullable String); method public void setVideoFilterConnection(@Nullable String); } + public static class DataFlowConfiguration.DvrPlayback.OptionalFilters { + ctor public DataFlowConfiguration.DvrPlayback.OptionalFilters(); + method @Nullable public java.util.List getOptionalFilter(); + } + public static class DataFlowConfiguration.DvrRecord { ctor public DataFlowConfiguration.DvrRecord(); method @Nullable public String getDvrRecordConnection(); @@ -496,6 +503,12 @@ package android.media.tuner.testing.configuration.V1_0 { enum_constant public static final android.media.tuner.testing.configuration.V1_0.LnbVoltageEnum VOLTAGE_5V; } + public class OptionalFilter { + ctor public OptionalFilter(); + method @Nullable public String getFilterId(); + method public void setFilterId(@Nullable String); + } + public class RecordFilterSettings { ctor public RecordFilterSettings(); method @Nullable public android.media.tuner.testing.configuration.V1_0.ScIndexTypeEnum getScIndexType(); diff --git a/tv/tuner/config/tuner_testing_dynamic_configuration.xsd b/tv/tuner/config/tuner_testing_dynamic_configuration.xsd index f5a7eed871..8ac25e9662 100644 --- a/tv/tuner/config/tuner_testing_dynamic_configuration.xsd +++ b/tv/tuner/config/tuner_testing_dynamic_configuration.xsd @@ -664,7 +664,14 @@ - + + + + + + + + @@ -743,4 +750,7 @@ + + + From bb1d8bfc93cab1973d017012d06556321662d710 Mon Sep 17 00:00:00 2001 From: Arthur Ishiguro Date: Wed, 6 Jul 2022 15:29:13 +0000 Subject: [PATCH 123/998] Modify onHostEndpointDisconnected to always return OK Update the default HAL to reflect the API definition, which says that the HAL should silently ignore incorrect values. Bug: 233853737 Test: Compile only Change-Id: Iae541e29706dddc6c9acb0563a2b484b75b549b5 --- contexthub/aidl/default/ContextHub.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/contexthub/aidl/default/ContextHub.cpp b/contexthub/aidl/default/ContextHub.cpp index 4c23cbc8bf..35e4650ef2 100644 --- a/contexthub/aidl/default/ContextHub.cpp +++ b/contexthub/aidl/default/ContextHub.cpp @@ -107,10 +107,9 @@ ScopedAStatus ContextHub::onHostEndpointConnected(const HostEndpointInfo& in_inf ScopedAStatus ContextHub::onHostEndpointDisconnected(char16_t in_hostEndpointId) { if (mConnectedHostEndpoints.count(in_hostEndpointId) > 0) { mConnectedHostEndpoints.erase(in_hostEndpointId); - return ndk::ScopedAStatus::ok(); - } else { - return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_ILLEGAL_ARGUMENT)); } + + return ndk::ScopedAStatus::ok(); } } // namespace contexthub From 4a95c710b38f7f3e5955c31996082b453d422c41 Mon Sep 17 00:00:00 2001 From: Lucas Gates Date: Wed, 29 Jun 2022 21:22:37 +0000 Subject: [PATCH 124/998] SampleTunerTIS HAL Process TS for SectionEvents Currently, the HAL simply sends raw TS data when SectionEvents are created from a TS file. This CL will have the HAL process the TS packets and construct sections to be sent to the SectionFilter. A slight-modified TS protocol is used that mirrors the current implementation for PES filters. Bug: 237323181 Test: Manually using cuttlefish and the SampleTunerTvInput. SectionEvents should be received without the 4-byte TsHeader or any trailing data. Change-Id: Ief6b9beb8f48bda1b83a0bffb83698ca431b7b12 --- tv/tuner/aidl/default/Filter.cpp | 68 +++++++++++++++++++++++++------- tv/tuner/aidl/default/Filter.h | 4 ++ 2 files changed, 58 insertions(+), 14 deletions(-) diff --git a/tv/tuner/aidl/default/Filter.cpp b/tv/tuner/aidl/default/Filter.cpp index 1d56303d2c..82e11cf294 100644 --- a/tv/tuner/aidl/default/Filter.cpp +++ b/tv/tuner/aidl/default/Filter.cpp @@ -961,24 +961,64 @@ void Filter::updateRecordOutput(vector& data) { return ::ndk::ScopedAStatus::ok(); } +// Read PSI (Program Specific Information) Sections from TransportStreams +// as defined in ISO/IEC 13818-1 Section 2.4.4 bool Filter::writeSectionsAndCreateEvent(vector& data) { // TODO check how many sections has been read ALOGD("[Filter] section handler"); - if (!writeDataToFilterMQ(data)) { - return false; - } - DemuxFilterSectionEvent secEvent; - secEvent = { - // temp dump meta data - .tableId = 0, - .version = 1, - .sectionNum = 1, - .dataLength = static_cast(data.size()), - }; - { - std::lock_guard lock(mFilterEventsLock); - mFilterEvents.push_back(DemuxFilterEvent::make(secEvent)); + // Transport Stream Packets are 188 bytes long, as defined in the + // Introduction of ISO/IEC 13818-1 + for (int i = 0; i < data.size(); i += 188) { + if (mSectionSizeLeft == 0) { + // Location for sectionSize as defined by Section 2.4.4 + // Note that the first 4 bytes skipped are the TsHeader + mSectionSizeLeft = ((data[i + 5] & 0x0f) << 8) | (data[i + 6] & 0xff); + mSectionSizeLeft += 3; + if (DEBUG_FILTER) { + ALOGD("[Filter] section data length %d", mSectionSizeLeft); + } + } + + // 184 bytes per packet is derived by subtracting the 4 byte length of + // the TsHeader from its 188 byte packet size + uint32_t endPoint = min(184u, mSectionSizeLeft); + // append data and check size + vector::const_iterator first = data.begin() + i + 4; + vector::const_iterator last = data.begin() + i + 4 + endPoint; + mSectionOutput.insert(mSectionOutput.end(), first, last); + // size does not match then continue + mSectionSizeLeft -= endPoint; + if (DEBUG_FILTER) { + ALOGD("[Filter] section data left %d", mSectionSizeLeft); + } + if (mSectionSizeLeft > 0) { + continue; + } + + if (!writeDataToFilterMQ(mSectionOutput)) { + mSectionOutput.clear(); + return false; + } + + DemuxFilterSectionEvent secEvent; + secEvent = { + // temp dump meta data + .tableId = 0, + .version = 1, + .sectionNum = 1, + .dataLength = static_cast(mSectionOutput.size()), + }; + if (DEBUG_FILTER) { + ALOGD("[Filter] assembled section data length %lld", secEvent.dataLength); + } + + { + std::lock_guard lock(mFilterEventsLock); + mFilterEvents.push_back( + DemuxFilterEvent::make(secEvent)); + } + mSectionOutput.clear(); } return true; diff --git a/tv/tuner/aidl/default/Filter.h b/tv/tuner/aidl/default/Filter.h index c559862956..06c2c26e30 100644 --- a/tv/tuner/aidl/default/Filter.h +++ b/tv/tuner/aidl/default/Filter.h @@ -258,6 +258,10 @@ class Filter : public BnFilter { std::mutex mFilterOutputLock; std::mutex mRecordFilterOutputLock; + // handle single Section filter + uint32_t mSectionSizeLeft = 0; + vector mSectionOutput; + // temp handle single PES filter // TODO handle mulptiple Pes filters int mPesSizeLeft = 0; From 279d2aa794a52fa5c8eea773f4b18ab38780d738 Mon Sep 17 00:00:00 2001 From: Lucas Gates Date: Fri, 1 Jul 2022 20:35:19 +0000 Subject: [PATCH 125/998] Tuner Default HAL Fix bug in TS size calculation The variable mPesSizeLeft is sometimes being set to a negative value when it reads from TS data because of conversions from our int8_t vector. This is incorrect, as these sizes are defined to always be positive. Our vectors cannot easily be changed due to our AIDL interfaces, but the SizeLeft variable can be made unsigned to fix the issue. Bug: 237819905 Test: Manually with cuttlefish and TS input to the DVR with large values for size bytes. Can also manually test the result of similar C++ expression to show the behavior. Change-Id: Iae925cc3c505891b732434fb7c3ffadf7af95411 --- tv/tuner/aidl/default/Filter.cpp | 4 ++-- tv/tuner/aidl/default/Filter.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tv/tuner/aidl/default/Filter.cpp b/tv/tuner/aidl/default/Filter.cpp index 1d56303d2c..568ab0776f 100644 --- a/tv/tuner/aidl/default/Filter.cpp +++ b/tv/tuner/aidl/default/Filter.cpp @@ -803,7 +803,7 @@ void Filter::updateRecordOutput(vector& data) { } } - int endPoint = min(184, mPesSizeLeft); + uint32_t endPoint = min(184u, mPesSizeLeft); // append data and check size vector::const_iterator first = mFilterOutput.begin() + i + 4; vector::const_iterator last = mFilterOutput.begin() + i + 4 + endPoint; @@ -885,7 +885,7 @@ void Filter::updateRecordOutput(vector& data) { } } - int endPoint = min(184, mPesSizeLeft); + uint32_t endPoint = min(184u, mPesSizeLeft); // append data and check size vector::const_iterator first = mFilterOutput.begin() + i + 4; vector::const_iterator last = mFilterOutput.begin() + i + 4 + endPoint; diff --git a/tv/tuner/aidl/default/Filter.h b/tv/tuner/aidl/default/Filter.h index c559862956..80faee78b4 100644 --- a/tv/tuner/aidl/default/Filter.h +++ b/tv/tuner/aidl/default/Filter.h @@ -260,7 +260,7 @@ class Filter : public BnFilter { // temp handle single PES filter // TODO handle mulptiple Pes filters - int mPesSizeLeft = 0; + uint32_t mPesSizeLeft = 0; vector mPesOutput; // A map from data id to ion handle From 969c14ddd664e7c63cc004011b8af334de0f96b9 Mon Sep 17 00:00:00 2001 From: William Escande Date: Wed, 6 Jul 2022 20:41:19 +0000 Subject: [PATCH 126/998] Revert "SampleTunerTIS HAL Process TS for SectionEvents" This reverts commit 4a95c710b38f7f3e5955c31996082b453d422c41. Reason for revert: b/238230620 Change-Id: I6021b2e33d0cfa91706e2c382d92bca4032f0cb4 --- tv/tuner/aidl/default/Filter.cpp | 68 +++++++------------------------- tv/tuner/aidl/default/Filter.h | 4 -- 2 files changed, 14 insertions(+), 58 deletions(-) diff --git a/tv/tuner/aidl/default/Filter.cpp b/tv/tuner/aidl/default/Filter.cpp index 82e11cf294..1d56303d2c 100644 --- a/tv/tuner/aidl/default/Filter.cpp +++ b/tv/tuner/aidl/default/Filter.cpp @@ -961,64 +961,24 @@ void Filter::updateRecordOutput(vector& data) { return ::ndk::ScopedAStatus::ok(); } -// Read PSI (Program Specific Information) Sections from TransportStreams -// as defined in ISO/IEC 13818-1 Section 2.4.4 bool Filter::writeSectionsAndCreateEvent(vector& data) { // TODO check how many sections has been read ALOGD("[Filter] section handler"); + if (!writeDataToFilterMQ(data)) { + return false; + } + DemuxFilterSectionEvent secEvent; + secEvent = { + // temp dump meta data + .tableId = 0, + .version = 1, + .sectionNum = 1, + .dataLength = static_cast(data.size()), + }; - // Transport Stream Packets are 188 bytes long, as defined in the - // Introduction of ISO/IEC 13818-1 - for (int i = 0; i < data.size(); i += 188) { - if (mSectionSizeLeft == 0) { - // Location for sectionSize as defined by Section 2.4.4 - // Note that the first 4 bytes skipped are the TsHeader - mSectionSizeLeft = ((data[i + 5] & 0x0f) << 8) | (data[i + 6] & 0xff); - mSectionSizeLeft += 3; - if (DEBUG_FILTER) { - ALOGD("[Filter] section data length %d", mSectionSizeLeft); - } - } - - // 184 bytes per packet is derived by subtracting the 4 byte length of - // the TsHeader from its 188 byte packet size - uint32_t endPoint = min(184u, mSectionSizeLeft); - // append data and check size - vector::const_iterator first = data.begin() + i + 4; - vector::const_iterator last = data.begin() + i + 4 + endPoint; - mSectionOutput.insert(mSectionOutput.end(), first, last); - // size does not match then continue - mSectionSizeLeft -= endPoint; - if (DEBUG_FILTER) { - ALOGD("[Filter] section data left %d", mSectionSizeLeft); - } - if (mSectionSizeLeft > 0) { - continue; - } - - if (!writeDataToFilterMQ(mSectionOutput)) { - mSectionOutput.clear(); - return false; - } - - DemuxFilterSectionEvent secEvent; - secEvent = { - // temp dump meta data - .tableId = 0, - .version = 1, - .sectionNum = 1, - .dataLength = static_cast(mSectionOutput.size()), - }; - if (DEBUG_FILTER) { - ALOGD("[Filter] assembled section data length %lld", secEvent.dataLength); - } - - { - std::lock_guard lock(mFilterEventsLock); - mFilterEvents.push_back( - DemuxFilterEvent::make(secEvent)); - } - mSectionOutput.clear(); + { + std::lock_guard lock(mFilterEventsLock); + mFilterEvents.push_back(DemuxFilterEvent::make(secEvent)); } return true; diff --git a/tv/tuner/aidl/default/Filter.h b/tv/tuner/aidl/default/Filter.h index 06c2c26e30..c559862956 100644 --- a/tv/tuner/aidl/default/Filter.h +++ b/tv/tuner/aidl/default/Filter.h @@ -258,10 +258,6 @@ class Filter : public BnFilter { std::mutex mFilterOutputLock; std::mutex mRecordFilterOutputLock; - // handle single Section filter - uint32_t mSectionSizeLeft = 0; - vector mSectionOutput; - // temp handle single PES filter // TODO handle mulptiple Pes filters int mPesSizeLeft = 0; From 37e509716f3c5a52dff41dd07af83e2e5b8e7905 Mon Sep 17 00:00:00 2001 From: Lucas Gates Date: Wed, 29 Jun 2022 21:22:37 +0000 Subject: [PATCH 127/998] SampleTunerTIS HAL Process TS for SectionEvents Currently, the HAL simply sends raw TS data when SectionEvents are created from a TS file. This CL will have the HAL process the TS packets and construct sections to be sent to the SectionFilter. A slight-modified TS protocol is used that mirrors the current implementation for PES filters. This CL is a replication of reverted CL 19121691. Bug: 237323181 Test: Manually using cuttlefish and the SampleTunerTvInput. SectionEvents should be received without the 4-byte TsHeader or any trailing data. Change-Id: I48de90c9674fb69ecf877359f89f6b4f7f3eaca7 --- tv/tuner/aidl/default/Filter.cpp | 68 +++++++++++++++++++++++++------- tv/tuner/aidl/default/Filter.h | 4 ++ 2 files changed, 58 insertions(+), 14 deletions(-) diff --git a/tv/tuner/aidl/default/Filter.cpp b/tv/tuner/aidl/default/Filter.cpp index 1d56303d2c..803b5d8beb 100644 --- a/tv/tuner/aidl/default/Filter.cpp +++ b/tv/tuner/aidl/default/Filter.cpp @@ -961,24 +961,64 @@ void Filter::updateRecordOutput(vector& data) { return ::ndk::ScopedAStatus::ok(); } +// Read PSI (Program Specific Information) Sections from TransportStreams +// as defined in ISO/IEC 13818-1 Section 2.4.4 bool Filter::writeSectionsAndCreateEvent(vector& data) { // TODO check how many sections has been read ALOGD("[Filter] section handler"); - if (!writeDataToFilterMQ(data)) { - return false; - } - DemuxFilterSectionEvent secEvent; - secEvent = { - // temp dump meta data - .tableId = 0, - .version = 1, - .sectionNum = 1, - .dataLength = static_cast(data.size()), - }; - { - std::lock_guard lock(mFilterEventsLock); - mFilterEvents.push_back(DemuxFilterEvent::make(secEvent)); + // Transport Stream Packets are 188 bytes long, as defined in the + // Introduction of ISO/IEC 13818-1 + for (int i = 0; i < data.size(); i += 188) { + if (mSectionSizeLeft == 0) { + // Location for sectionSize as defined by Section 2.4.4 + // Note that the first 4 bytes skipped are the TsHeader + mSectionSizeLeft = ((data[i + 5] & 0x0f) << 8) | (data[i + 6] & 0xff); + mSectionSizeLeft += 3; + if (DEBUG_FILTER) { + ALOGD("[Filter] section data length %d", mSectionSizeLeft); + } + } + + // 184 bytes per packet is derived by subtracting the 4 byte length of + // the TsHeader from its 188 byte packet size + uint32_t endPoint = min(184u, mSectionSizeLeft); + // append data and check size + vector::const_iterator first = data.begin() + i + 4; + vector::const_iterator last = data.begin() + i + 4 + endPoint; + mSectionOutput.insert(mSectionOutput.end(), first, last); + // size does not match then continue + mSectionSizeLeft -= endPoint; + if (DEBUG_FILTER) { + ALOGD("[Filter] section data left %d", mSectionSizeLeft); + } + if (mSectionSizeLeft > 0) { + continue; + } + + if (!writeDataToFilterMQ(mSectionOutput)) { + mSectionOutput.clear(); + return false; + } + + DemuxFilterSectionEvent secEvent; + secEvent = { + // temp dump meta data + .tableId = 0, + .version = 1, + .sectionNum = 1, + .dataLength = static_cast(mSectionOutput.size()), + }; + if (DEBUG_FILTER) { + ALOGD("[Filter] assembled section data length %" PRIu64, secEvent.dataLength); + } + + { + std::lock_guard lock(mFilterEventsLock); + mFilterEvents.push_back( + DemuxFilterEvent::make(secEvent)); + } + mSectionOutput.clear(); } return true; diff --git a/tv/tuner/aidl/default/Filter.h b/tv/tuner/aidl/default/Filter.h index c559862956..06c2c26e30 100644 --- a/tv/tuner/aidl/default/Filter.h +++ b/tv/tuner/aidl/default/Filter.h @@ -258,6 +258,10 @@ class Filter : public BnFilter { std::mutex mFilterOutputLock; std::mutex mRecordFilterOutputLock; + // handle single Section filter + uint32_t mSectionSizeLeft = 0; + vector mSectionOutput; + // temp handle single PES filter // TODO handle mulptiple Pes filters int mPesSizeLeft = 0; From 31acf98d497cde35817815b97c1f351574d9b1da Mon Sep 17 00:00:00 2001 From: Arthur Ishiguro Date: Wed, 6 Jul 2022 21:41:15 +0000 Subject: [PATCH 128/998] Add group 'input' to AIDL sensors multi-HAL Fixes: 238211395 Change-Id: I046e4491348b10681a660d62c143a652df0f66b4 Test: Compile --- .../aidl/multihal/android.hardware.sensors-service-multihal.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sensors/aidl/multihal/android.hardware.sensors-service-multihal.rc b/sensors/aidl/multihal/android.hardware.sensors-service-multihal.rc index 3f91a0a04a..1edfbec640 100644 --- a/sensors/aidl/multihal/android.hardware.sensors-service-multihal.rc +++ b/sensors/aidl/multihal/android.hardware.sensors-service-multihal.rc @@ -1,7 +1,7 @@ service vendor.sensors-hal-multihal /vendor/bin/hw/android.hardware.sensors-service.multihal class hal user system - group system wakelock context_hub + group system wakelock context_hub input task_profiles ServiceCapacityLow capabilities BLOCK_SUSPEND rlimit rtprio 10 10 \ No newline at end of file From 63e24d7a6adfb3302199fab3fea2f8c4473bc6e1 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Fri, 24 Jun 2022 17:53:32 +0000 Subject: [PATCH 129/998] Generate enum for VehicleProperty annotations. Add a script to general Java and CPP files for annotations in VehicleProperty.aidl. By having the enums defined, both VHAL impl (CPP) and Car Service (Java) can more easily access these annotations. For example, AIDL impl can generate a default config based on these annotations so that it meets the requirements. Car service side can generate CTS checks automatically based on these enums to verify that the VHAL impl is providing the correct config. Test: Add VehiclePropertyAnnotationCppTest and VehiclePropertyAnnotationJavaTest that will fail if we update the VehicleProperty.aidl without running geenrate_annotation_enums. Bug: 236433737 Change-Id: Ib3e0dee7a28576bc9535d10c7c8f799f1506e592 --- automotive/vehicle/TEST_MAPPING | 6 + automotive/vehicle/aidl/aidl_test/Android.bp | 24 +- .../aidl/aidl_test/AndroidManifest.xml | 26 + .../VehiclePropertyAnnotationCppTest.cpp | 56 ++ .../VehiclePropertyAnnotationJavaTest.java | 60 ++ .../automotive/vehicle/VehicleProperty.aidl | 688 +++++++++--------- .../cpp/AccessForVehicleProperty.h | 218 ++++++ .../vehicle/aidl/generated_lib/cpp/Android.bp | 27 + .../cpp/ChangeModeForVehicleProperty.h | 218 ++++++ .../java/AccessForVehicleProperty.java | 204 ++++++ .../aidl/generated_lib/java/Android.bp | 26 + .../java/ChangeModeForVehicleProperty.java | 204 ++++++ .../tools/generate_annotation_enums.py | 243 +++++++ 13 files changed, 1655 insertions(+), 345 deletions(-) create mode 100644 automotive/vehicle/aidl/aidl_test/AndroidManifest.xml create mode 100644 automotive/vehicle/aidl/aidl_test/VehiclePropertyAnnotationCppTest.cpp create mode 100644 automotive/vehicle/aidl/aidl_test/VehiclePropertyAnnotationJavaTest.java create mode 100644 automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h create mode 100644 automotive/vehicle/aidl/generated_lib/cpp/Android.bp create mode 100644 automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h create mode 100644 automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java create mode 100644 automotive/vehicle/aidl/generated_lib/java/Android.bp create mode 100644 automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java create mode 100644 automotive/vehicle/tools/generate_annotation_enums.py diff --git a/automotive/vehicle/TEST_MAPPING b/automotive/vehicle/TEST_MAPPING index 7e425540f5..fa0b79110e 100644 --- a/automotive/vehicle/TEST_MAPPING +++ b/automotive/vehicle/TEST_MAPPING @@ -9,6 +9,12 @@ { "name": "VehicleHalVehicleUtilsTest" }, + { + "name": "VehiclePropertyAnnotationCppTest" + }, + { + "name": "VehiclePropertyAnnotationJavaTest" + }, { "name": "FakeVehicleHardwareTest" }, diff --git a/automotive/vehicle/aidl/aidl_test/Android.bp b/automotive/vehicle/aidl/aidl_test/Android.bp index 5284a0a8e1..cf7ef1e404 100644 --- a/automotive/vehicle/aidl/aidl_test/Android.bp +++ b/automotive/vehicle/aidl/aidl_test/Android.bp @@ -20,7 +20,7 @@ package { cc_test { name: "VehicleHalAidlHidlCompatibilityTest", - srcs: ["*.cpp"], + srcs: ["AidlHidlCompatibilityTest.cpp"], shared_libs: [ "libbinder_ndk", "libhidlbase", @@ -35,3 +35,25 @@ cc_test { test_suites: ["device-tests"], vendor: true, } + +cc_test { + name: "VehiclePropertyAnnotationCppTest", + srcs: ["VehiclePropertyAnnotationCppTest.cpp"], + header_libs: ["IVehicleGeneratedHeaders"], + defaults: ["VehicleHalInterfaceDefaults"], + test_suites: ["general-tests"], +} + +android_test { + name: "VehiclePropertyAnnotationJavaTest", + srcs: [ + "VehiclePropertyAnnotationJavaTest.java", + ":IVehicleGeneratedJavaFiles", + ], + static_libs: [ + "android.hardware.automotive.vehicle-V2-java", + "androidx.test.runner", + "truth-prebuilt", + ], + test_suites: ["general-tests"], +} diff --git a/automotive/vehicle/aidl/aidl_test/AndroidManifest.xml b/automotive/vehicle/aidl/aidl_test/AndroidManifest.xml new file mode 100644 index 0000000000..00fdf507ff --- /dev/null +++ b/automotive/vehicle/aidl/aidl_test/AndroidManifest.xml @@ -0,0 +1,26 @@ + + + + + + + + + + \ No newline at end of file diff --git a/automotive/vehicle/aidl/aidl_test/VehiclePropertyAnnotationCppTest.cpp b/automotive/vehicle/aidl/aidl_test/VehiclePropertyAnnotationCppTest.cpp new file mode 100644 index 0000000000..a4bbbe84e2 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_test/VehiclePropertyAnnotationCppTest.cpp @@ -0,0 +1,56 @@ +/* + * 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. + */ + +#include +#include + +#include +#include +#include + +namespace aidl_vehicle = ::aidl::android::hardware::automotive::vehicle; +using aidl_vehicle::AccessForVehicleProperty; +using aidl_vehicle::ChangeModeForVehicleProperty; +using aidl_vehicle::VehicleProperty; + +namespace { + template + bool doesAnnotationMapContainsAllProps(std::unordered_map annotationMap) { + for (const VehicleProperty& v : ::ndk::enum_range()) { + std::string name = aidl_vehicle::toString(v); + if (name == "INVALID") { + continue; + } + if (annotationMap.find(v) == annotationMap.end()) { + return false; + } + } + return true; + } + +} // namespace + +TEST(VehiclePropertyAnnotationCppTest, testChangeMode) { + ASSERT_TRUE(doesAnnotationMapContainsAllProps(ChangeModeForVehicleProperty)) + << "Outdated annotation-generated AIDL files. Please run " + << "generate_annotation_enums.py to update."; +} + +TEST(VehiclePropertyAnnotationCppTest, testAccess) { + ASSERT_TRUE(doesAnnotationMapContainsAllProps(AccessForVehicleProperty)) + << "Outdated annotation-generated AIDL files. Please run " + << "generate_annotation_enums.py to update."; +} diff --git a/automotive/vehicle/aidl/aidl_test/VehiclePropertyAnnotationJavaTest.java b/automotive/vehicle/aidl/aidl_test/VehiclePropertyAnnotationJavaTest.java new file mode 100644 index 0000000000..ef49299475 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_test/VehiclePropertyAnnotationJavaTest.java @@ -0,0 +1,60 @@ +package android.hardware.automotive.vehicle; + +import static com.google.common.truth.Truth.assertWithMessage; + +import static org.junit.Assert.fail; + +import androidx.test.filters.SmallTest; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.Map; + +@RunWith(JUnit4.class) +public class VehiclePropertyAnnotationJavaTest { + + private boolean doesAnnotationMapContainsAllProps(Map annotationMap) { + for (Field field : VehicleProperty.class.getDeclaredFields()) { + int modifiers = field.getModifiers(); + try { + if (Modifier.isStatic(modifiers) && Modifier.isFinal(modifiers) + && Modifier.isPublic(modifiers) && field.getType().equals(int.class)) { + int propId = field.getInt(/* obj= */ null); + if (propId == VehicleProperty.INVALID) { + // Skip INVALID_PROP. + continue; + } + if (annotationMap.get(propId) == null) { + return false; + } + } + } catch (IllegalAccessException e) { + throw new IllegalStateException( + "Cannot access a member for VehicleProperty.class", e); + } + } + return true; + } + + @Test + @SmallTest + public void testChangeMode() { + assertWithMessage("Outdated annotation-generated AIDL files. Please run " + + "generate_annotation_enums.py to update.") + .that(doesAnnotationMapContainsAllProps(ChangeModeForVehicleProperty.values)) + .isTrue(); + } + + @Test + @SmallTest + public void testAccess() { + assertWithMessage("Outdated annotation-generated AIDL files. Please run " + + "generate_annotation_enums.py to update.") + .that(doesAnnotationMapContainsAllProps(AccessForVehicleProperty.values)) + .isTrue(); + } +} \ No newline at end of file diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 15d8e58fd1..e8a6c8598f 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -46,32 +46,32 @@ enum VehicleProperty { /** * VIN of vehicle * - * @change_mode VehiclePropertyChangeMode:STATIC - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ */ INFO_VIN = 0x0100 + 0x10000000 + 0x01000000 + 0x00100000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:STRING /** * Manufacturer of vehicle * - * @change_mode VehiclePropertyChangeMode:STATIC - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ */ INFO_MAKE = 0x0101 + 0x10000000 + 0x01000000 + 0x00100000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:STRING /** * Model of vehicle * - * @change_mode VehiclePropertyChangeMode:STATIC - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ */ INFO_MODEL = 0x0102 + 0x10000000 + 0x01000000 + 0x00100000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:STRING /** * Model year of vehicle. * - * @change_mode VehiclePropertyChangeMode:STATIC - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:YEAR */ INFO_MODEL_YEAR = 0x0103 + 0x10000000 + 0x01000000 @@ -79,8 +79,8 @@ enum VehicleProperty { /** * Fuel capacity of the vehicle in milliliters * - * @change_mode VehiclePropertyChangeMode:STATIC - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:MILLILITER */ INFO_FUEL_CAPACITY = 0x0104 + 0x10000000 + 0x01000000 @@ -88,8 +88,8 @@ enum VehicleProperty { /** * List of fuels the vehicle may use * - * @change_mode VehiclePropertyChangeMode:STATIC - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ * @data_enum FuelType */ INFO_FUEL_TYPE = 0x0105 + 0x10000000 + 0x01000000 @@ -98,8 +98,8 @@ enum VehicleProperty { * Battery capacity of the vehicle, if EV or hybrid. This is the nominal * battery capacity when the vehicle is new. * - * @change_mode VehiclePropertyChangeMode:STATIC - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:WH */ INFO_EV_BATTERY_CAPACITY = 0x0106 + 0x10000000 + 0x01000000 @@ -107,26 +107,26 @@ enum VehicleProperty { /** * List of connectors this EV may use * - * @change_mode VehiclePropertyChangeMode:STATIC + * @change_mode VehiclePropertyChangeMode.STATIC * @data_enum EvConnectorType - * @access VehiclePropertyAccess:READ + * @access VehiclePropertyAccess.READ */ INFO_EV_CONNECTOR_TYPE = 0x0107 + 0x10000000 + 0x01000000 + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC /** * Fuel door location * - * @change_mode VehiclePropertyChangeMode:STATIC + * @change_mode VehiclePropertyChangeMode.STATIC * @data_enum PortLocationType - * @access VehiclePropertyAccess:READ + * @access VehiclePropertyAccess.READ */ INFO_FUEL_DOOR_LOCATION = 0x0108 + 0x10000000 + 0x01000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 /** * EV port location * - * @change_mode VehiclePropertyChangeMode:STATIC - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ * @data_enum PortLocationType */ INFO_EV_PORT_LOCATION = 0x0109 + 0x10000000 + 0x01000000 @@ -135,9 +135,9 @@ enum VehicleProperty { * Driver's seat location * VHAL implementations must ignore the areaId. Use VehicleArea:GLOBAL. * - * @change_mode VehiclePropertyChangeMode:STATIC + * @change_mode VehiclePropertyChangeMode.STATIC * @data_enum VehicleAreaSeat - * @access VehiclePropertyAccess:READ + * @access VehiclePropertyAccess.READ */ INFO_DRIVER_SEAT = 0x010A + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -153,8 +153,8 @@ enum VehicleProperty { * int32Values[6] = track width rear * int32Values[7] = curb to curb turning radius * - * @change_mode VehiclePropertyChangeMode:STATIC - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:MILLIMETER */ INFO_EXTERIOR_DIMENSIONS = 0x010B + 0x10000000 + 0x01000000 @@ -168,8 +168,8 @@ enum VehicleProperty { * int32Values[0] = PortLocationType::FRONT_LEFT * int32Values[0] = PortLocationType::REAR_LEFT * - * @change_mode VehiclePropertyChangeMode:STATIC - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ * @data_enum PortLocationType */ INFO_MULTI_EV_PORT_LOCATIONS = 0x010C + 0x10000000 + 0x01000000 @@ -177,8 +177,8 @@ enum VehicleProperty { /** * Current odometer value of the vehicle * - * @change_mode VehiclePropertyChangeMode:CONTINUOUS - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.CONTINUOUS + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:KILOMETER */ PERF_ODOMETER = 0x0204 + 0x10000000 + 0x01000000 @@ -192,8 +192,8 @@ enum VehicleProperty { * PERF_VEHICLE_SPEED is positive when the vehicle is moving forward, negative when moving * backward, and zero when not moving. * - * @change_mode VehiclePropertyChangeMode:CONTINUOUS - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.CONTINUOUS + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:METER_PER_SEC */ PERF_VEHICLE_SPEED = 0x0207 + 0x10000000 + 0x01000000 @@ -204,8 +204,8 @@ enum VehicleProperty { * Some cars display a slightly slower speed than the actual speed. This is * usually displayed on the speedometer. * - * @change_mode VehiclePropertyChangeMode:CONTINUOUS - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.CONTINUOUS + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:METER_PER_SEC */ PERF_VEHICLE_SPEED_DISPLAY = 0x0208 + 0x10000000 + 0x01000000 @@ -215,8 +215,8 @@ enum VehicleProperty { * * Angle is in degrees. Left is negative. * - * @change_mode VehiclePropertyChangeMode:CONTINUOUS - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.CONTINUOUS + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:DEGREES */ PERF_STEERING_ANGLE = 0x0209 + 0x10000000 + 0x01000000 @@ -226,8 +226,8 @@ enum VehicleProperty { * * Angle is in degrees. Left is negative. * - * @change_mode VehiclePropertyChangeMode:CONTINUOUS - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.CONTINUOUS + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:DEGREES */ PERF_REAR_STEERING_ANGLE = 0x0210 + 0x10000000 + 0x01000000 @@ -235,8 +235,8 @@ enum VehicleProperty { /** * Temperature of engine coolant * - * @change_mode VehiclePropertyChangeMode:CONTINUOUS - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.CONTINUOUS + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:CELSIUS */ ENGINE_COOLANT_TEMP = 0x0301 + 0x10000000 + 0x01000000 @@ -244,8 +244,8 @@ enum VehicleProperty { /** * Engine oil level * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ * @data_enum VehicleOilLevel */ ENGINE_OIL_LEVEL = 0x0303 + 0x10000000 + 0x01000000 @@ -253,8 +253,8 @@ enum VehicleProperty { /** * Temperature of engine oil * - * @change_mode VehiclePropertyChangeMode:CONTINUOUS - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.CONTINUOUS + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:CELSIUS */ ENGINE_OIL_TEMP = 0x0304 + 0x10000000 + 0x01000000 @@ -262,8 +262,8 @@ enum VehicleProperty { /** * Engine rpm * - * @change_mode VehiclePropertyChangeMode:CONTINUOUS - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.CONTINUOUS + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:RPM */ ENGINE_RPM = 0x0305 + 0x10000000 + 0x01000000 @@ -300,8 +300,8 @@ enum VehicleProperty { * * VehiclePropValue.timestamp must be correctly filled in. * - * @change_mode VehiclePropertyChangeMode:CONTINUOUS - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.CONTINUOUS + * @access VehiclePropertyAccess.READ */ WHEEL_TICK = 0x0306 + 0x10000000 + 0x01000000 + 0x00510000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT64_VEC @@ -310,8 +310,8 @@ enum VehicleProperty { * * Value may not exceed INFO_FUEL_CAPACITY * - * @change_mode VehiclePropertyChangeMode:CONTINUOUS - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.CONTINUOUS + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:MILLILITER */ FUEL_LEVEL = 0x0307 + 0x10000000 + 0x01000000 @@ -319,8 +319,8 @@ enum VehicleProperty { /** * Fuel door open * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ FUEL_DOOR_OPEN = 0x0308 + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN @@ -329,8 +329,8 @@ enum VehicleProperty { * * Value may not exceed INFO_EV_BATTERY_CAPACITY * - * @change_mode VehiclePropertyChangeMode:CONTINUOUS - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.CONTINUOUS + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:WH */ EV_BATTERY_LEVEL = 0x0309 + 0x10000000 + 0x01000000 @@ -338,16 +338,16 @@ enum VehicleProperty { /** * EV charge port open * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ EV_CHARGE_PORT_OPEN = 0x030A + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN /** * EV charge port connected * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ */ EV_CHARGE_PORT_CONNECTED = 0x030B + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN @@ -357,8 +357,8 @@ enum VehicleProperty { * Positive value indicates battery is being charged. * Negative value indicates battery being discharged. * - * @change_mode VehiclePropertyChangeMode:CONTINUOUS - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.CONTINUOUS + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:MW */ EV_BATTERY_INSTANTANEOUS_CHARGE_RATE = 0x030C + 0x10000000 + 0x01000000 @@ -370,8 +370,8 @@ enum VehicleProperty { * all energy sources in a vehicle. For example, a hybrid car's range will * be the sum of the ranges based on fuel and battery. * - * @change_mode VehiclePropertyChangeMode:CONTINUOUS - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.CONTINUOUS + * @access VehiclePropertyAccess.READ_WRITE * @unit VehicleUnit:METER */ RANGE_REMAINING = 0x0308 + 0x10000000 + 0x01000000 @@ -397,8 +397,8 @@ enum VehicleProperty { * } * }, * - * @change_mode VehiclePropertyChangeMode:CONTINUOUS - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.CONTINUOUS + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:KILOPASCAL */ TIRE_PRESSURE = 0x0309 + 0x10000000 + 0x07000000 @@ -412,8 +412,8 @@ enum VehicleProperty { * Minimum and maximum property values (that is, minFloatValue, maxFloatValue) * are not applicable to this property. * - * @change_mode VehiclePropertyChangeMode:STATIC - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:KILOPASCAL */ CRITICALLY_LOW_TIRE_PRESSURE = 0x030A + 0x10000000 + 0x07000000 @@ -429,8 +429,8 @@ enum VehicleProperty { * GEAR_1, GEAR_2,...} and for manual transmission the list must be * {GEAR_NEUTRAL, GEAR_REVERSE, GEAR_1, GEAR_2,...} * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ * @data_enum VehicleGear */ GEAR_SELECTION = 0x0400 + 0x10000000 + 0x01000000 @@ -448,8 +448,8 @@ enum VehicleProperty { * {GEAR_NEUTRAL, GEAR_REVERSE, GEAR_1, GEAR_2,...}. This list need not be the * same as that of the supported gears reported in GEAR_SELECTION. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ * @data_enum VehicleGear */ CURRENT_GEAR = 0x0401 + 0x10000000 + 0x01000000 @@ -457,16 +457,16 @@ enum VehicleProperty { /** * Parking brake state. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ */ PARKING_BRAKE_ON = 0x0402 + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN /** * Auto-apply parking brake. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ */ PARKING_BRAKE_AUTO_APPLY = 0x0403 + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN @@ -483,8 +483,8 @@ enum VehicleProperty { * For a hybrid vehicle, this property may be based on the combination of gas and battery * levels, at the OEM's discretion. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ */ FUEL_LEVEL_LOW = 0x0405 + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN @@ -495,16 +495,16 @@ enum VehicleProperty { * low light. The platform could use this, for example, to enable appropriate UI for * better viewing in dark or low light environments. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ */ NIGHT_MODE = 0x0407 + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN /** * State of the vehicles turn signals * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ * @data_enum VehicleTurnSignal */ TURN_SIGNAL_STATE = 0x0408 + 0x10000000 + 0x01000000 @@ -512,8 +512,8 @@ enum VehicleProperty { /** * Represents ignition state * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ * @data_enum VehicleIgnitionState */ IGNITION_STATE = 0x0409 + 0x10000000 + 0x01000000 @@ -525,8 +525,8 @@ enum VehicleProperty { * property may be intermittently set (pulsing) based on the real-time * state of the ABS system. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ */ ABS_ACTIVE = 0x040A + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN @@ -537,8 +537,8 @@ enum VehicleProperty { * TC is off. This property may be intermittently set (pulsing) based on * the real-time state of the TC system. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ */ TRACTION_CONTROL_ACTIVE = 0x040B + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN @@ -580,16 +580,16 @@ enum VehicleProperty { * * Fan speed setting * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ HVAC_FAN_SPEED = 0x0500 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 /** * Fan direction setting * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleHvacFanDirection */ HVAC_FAN_DIRECTION = 0x0501 + 0x10000000 + 0x05000000 @@ -597,8 +597,8 @@ enum VehicleProperty { /** * HVAC current temperature. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:CELSIUS */ HVAC_TEMPERATURE_CURRENT = 0x0502 + 0x10000000 + 0x05000000 @@ -624,8 +624,8 @@ enum VehicleProperty { * that property to get the suggested value before setting HVAC_TEMPERATURE_SET. Otherwise, * the application may choose the value in HVAC_TEMPERATURE_SET configArray by itself. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE * @unit VehicleUnit:CELSIUS */ HVAC_TEMPERATURE_SET = 0x0503 + 0x10000000 + 0x05000000 @@ -633,16 +633,16 @@ enum VehicleProperty { /** * Fan-based defrost for designated window. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ HVAC_DEFROSTER = 0x0504 + 0x10000000 + 0x03000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:BOOLEAN /** * On/off AC for designated areaId * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE * @config_flags Supported areaIds */ HVAC_AC_ON = 0x0505 + 0x10000000 + 0x05000000 @@ -655,8 +655,8 @@ enum VehicleProperty { * Any parameters modified as a side effect of turning on/off the MAX AC * parameter shall generate onPropertyEvent() callbacks to the VHAL. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ HVAC_MAX_AC_ON = 0x0506 + 0x10000000 + 0x05000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN @@ -674,8 +674,8 @@ enum VehicleProperty { * areaConfig.areaId = {ROW_1_LEFT | ROW_1_RIGHT} indicates HVAC_MAX_DEFROST_ON * only can be controlled for the front rows. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ HVAC_MAX_DEFROST_ON = 0x0507 + 0x10000000 + 0x05000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN @@ -687,8 +687,8 @@ enum VehicleProperty { * Recirc “off” means the majority of the airflow into the cabin is coming * from outside the car. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ HVAC_RECIRC_ON = 0x0508 + 0x10000000 + 0x05000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN @@ -722,16 +722,16 @@ enum VehicleProperty { * onPropertyEvent() callbacks (i.e. HVAC_DUAL_ON = false, * HVAC_TEMPERATURE_SET[AreaID] = xxx, etc). * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ HVAC_DUAL_ON = 0x0509 + 0x10000000 + 0x05000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN /** * On/off automatic mode * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ HVAC_AUTO_ON = 0x050A + 0x10000000 + 0x05000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN @@ -746,8 +746,8 @@ enum VehicleProperty { * min/max range defines the allowable range and number of steps in each * direction. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ HVAC_SEAT_TEMPERATURE = 0x050B + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -758,8 +758,8 @@ enum VehicleProperty { * The Max value in the config data represents the highest heating level. * The Min value in the config data MUST be zero and indicates no heating. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ HVAC_SIDE_MIRROR_HEAT = 0x050C + 0x10000000 + 0x04000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:MIRROR,VehiclePropertyType:INT32 @@ -772,8 +772,8 @@ enum VehicleProperty { * Negative value indicates cooling. * 0 indicates temperature control is off. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ HVAC_STEERING_WHEEL_HEAT = 0x050D + 0x10000000 + 0x01000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 @@ -790,8 +790,8 @@ enum VehicleProperty { * Values must be one of VehicleUnit::CELSIUS or VehicleUnit::FAHRENHEIT * Note that internally, all temperatures are represented in floating point Celsius. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleUnit */ HVAC_TEMPERATURE_DISPLAY_UNITS = 0x050E + 0x10000000 + 0x01000000 @@ -799,8 +799,8 @@ enum VehicleProperty { /** * Actual fan speed * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ */ HVAC_ACTUAL_FAN_SPEED_RPM = 0x050F + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -841,8 +841,8 @@ enum VehicleProperty { * - ROW_1_LEFT | ROW_1_RIGHT * - ROW_2_LEFT | ROW_2_CENTER | ROW_2_RIGHT | ROW_3_LEFT | ROW_3_CENTER | ROW_3_RIGHT * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ HVAC_POWER_ON = 0x0510 + 0x10000000 + 0x05000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN @@ -859,8 +859,8 @@ enum VehicleProperty { * - FAN_DIRECTION_DEFROST (0x4) * - FAN_DIRECTION_FLOOR | FAN_DIRECTION_DEFROST (0x6) * - * @change_mode VehiclePropertyChangeMode:STATIC - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ * @data_enum VehicleHvacFanDirection */ HVAC_FAN_DIRECTION_AVAILABLE = 0x0511 + 0x10000000 + 0x05000000 @@ -872,8 +872,8 @@ enum VehicleProperty { * switch to recirculation mode if the vehicle detects poor incoming air * quality. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ HVAC_AUTO_RECIRC_ON = 0x0512 + 0x10000000 + 0x05000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN @@ -887,16 +887,16 @@ enum VehicleProperty { * ventilation. This is different than seating cooling. It can be on at the * same time as cooling, or not. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ HVAC_SEAT_VENTILATION = 0x0513 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 /** * Electric defrosters' status * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ HVAC_ELECTRIC_DEFROSTER_ON = 0x0514 + 0x10000000 + 0x03000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:BOOLEAN @@ -935,8 +935,8 @@ enum VehicleProperty { * callback with property value [21, (float)VehicleUnit:CELSIUS, 21.0, 70.0]. * In this case, the application can know that the value is 70.0 Fahrenheit in the car’s UI. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ HVAC_TEMPERATURE_VALUE_SUGGESTION = 0x0515 + 0x10000000 + 0x01000000 + 0x00610000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT_VEC @@ -951,8 +951,8 @@ enum VehicleProperty { * For example: configArray[0] = METER * configArray[1] = KILOMETER * configArray[2] = MILE - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleUnit */ DISTANCE_DISPLAY_UNITS = 0x0600 + 0x10000000 + 0x01000000 @@ -967,8 +967,8 @@ enum VehicleProperty { * Volume units are defined in VehicleUnit. * For example: configArray[0] = LITER * configArray[1] = GALLON - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleUnit */ FUEL_VOLUME_DISPLAY_UNITS = 0x0601 + 0x10000000 + 0x01000000 @@ -984,8 +984,8 @@ enum VehicleProperty { * For example: configArray[0] = KILOPASCAL * configArray[1] = PSI * configArray[2] = BAR - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleUnit */ TIRE_PRESSURE_DISPLAY_UNITS = 0x0602 + 0x10000000 + 0x01000000 @@ -1001,8 +1001,8 @@ enum VehicleProperty { * For example: configArray[0] = WATT_HOUR * configArray[1] = AMPERE_HOURS * configArray[2] = KILOWATT_HOUR - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleUnit */ EV_BATTERY_DISPLAY_UNITS = 0x0603 + 0x10000000 + 0x01000000 @@ -1014,8 +1014,8 @@ enum VehicleProperty { * True indicates units are distance over volume such as MPG. * False indicates units are volume over distance such as L/100KM. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME = 0x0604 + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN @@ -1029,8 +1029,8 @@ enum VehicleProperty { * For example: configArray[0] = METER_PER_SEC * configArray[1] = MILES_PER_HOUR * configArray[2] = KILOMETERS_PER_HOUR - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ VEHICLE_SPEED_DISPLAY_UNITS = 0x0605 + 0x10000000 + 0x01000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 @@ -1072,8 +1072,8 @@ enum VehicleProperty { * WARNING: The value available through this property should not be dependent * on value written by Android to ANDROID_EPOCH_TIME property in any way. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_ONLY + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:MILLI_SECS */ EXTERNAL_CAR_TIME = 0x0608 + 0x10000000 // VehiclePropertyGroup:SYSTEM @@ -1101,8 +1101,8 @@ enum VehicleProperty { * drift = elapsedTime - PropValue.timestamp * effectiveTime = PropValue.value.int64Values[0] + drift * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:WRITE_ONLY + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.WRITE * @unit VehicleUnit:MILLI_SECS */ ANDROID_EPOCH_TIME = 0x0606 + 0x10000000 + 0x01000000 @@ -1116,16 +1116,16 @@ enum VehicleProperty { * AAOS will then read the property on subsequent boots. The binding seed is expected to be * reliably persisted. Any loss of the seed results in a factory reset of the IVI. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ STORAGE_ENCRYPTION_BINDING_SEED = 0x0607 + 0x10000000 + 0x01000000 + 0x00700000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BYTES /** * Outside temperature * - * @change_mode VehiclePropertyChangeMode:CONTINUOUS - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.CONTINUOUS + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:CELSIUS */ ENV_OUTSIDE_TEMPERATURE = 0x0703 + 0x10000000 + 0x01000000 @@ -1143,8 +1143,8 @@ enum VehicleProperty { * int32Values[1] : additional parameter relevant for each state, * 0 if not used. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ */ AP_POWER_STATE_REQ = 0x0A00 + 0x10000000 + 0x01000000 + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC @@ -1158,8 +1158,8 @@ enum VehicleProperty { * int32Values[1] : Time in ms to wake up, if necessary. Otherwise 0. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ AP_POWER_STATE_REPORT = 0x0A01 + 0x10000000 + 0x01000000 + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC @@ -1172,8 +1172,8 @@ enum VehicleProperty { * * int32Values[0] must be VehicleApPowerBootupReason. * - * @change_mode VehiclePropertyChangeMode:STATIC - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ */ AP_POWER_BOOTUP_REASON = 0x0A02 + 0x10000000 + 0x01000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 @@ -1187,8 +1187,8 @@ enum VehicleProperty { * change display brightness from Settings, but that must not be reflected * to other displays. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ DISPLAY_BRIGHTNESS = 0x0A03 + 0x10000000 + 0x01000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 @@ -1203,8 +1203,8 @@ enum VehicleProperty { * int32Values[3] : [optional] Number of ticks. The value must be equal or * greater than 1. When omitted, Android will default to 1. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ * @config_flags */ HW_KEY_INPUT = 0x0A10 + 0x10000000 + 0x01000000 @@ -1226,9 +1226,9 @@ enum VehicleProperty { * detents is > 1 or < -1, this is when the * first detent of rotation occurred. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @data_enum RotaryInputType - * @access VehiclePropertyAccess:READ + * @access VehiclePropertyAccess.READ */ HW_ROTARY_INPUT = 0x0A20 + 0x10000000 + 0x01000000 + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC @@ -1249,9 +1249,9 @@ enum VehicleProperty { * int32Values[2] : repeat counter, if 0 then event is not repeated. Values 1 or above means * how many times this event repeated. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @data_enum CustomInputType - * @access VehiclePropertyAccess:READ + * @access VehiclePropertyAccess.READ */ HW_CUSTOM_INPUT = 0X0A30 + 0x10000000 + 0x01000000 + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC @@ -1282,16 +1282,16 @@ enum VehicleProperty { * Some vehicles (minivans) can open the door electronically. Hence, the * ability to write this property. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ DOOR_POS = 0x0B00 + 0x10000000 + 0x06000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:DOOR,VehiclePropertyType:INT32 /** * Door move * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ DOOR_MOVE = 0x0B01 + 0x10000000 + 0x06000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:DOOR,VehiclePropertyType:INT32 @@ -1300,8 +1300,8 @@ enum VehicleProperty { * * 'true' indicates door is locked * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ DOOR_LOCK = 0x0B02 + 0x10000000 + 0x06000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:DOOR,VehiclePropertyType:BOOLEAN @@ -1310,8 +1310,8 @@ enum VehicleProperty { * * Positive value indicates tilt upwards, negative value is downwards * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ MIRROR_Z_POS = 0x0B40 + 0x10000000 + 0x04000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:MIRROR,VehiclePropertyType:INT32 @@ -1320,8 +1320,8 @@ enum VehicleProperty { * * Positive value indicates tilt upwards, negative value is downwards * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ MIRROR_Z_MOVE = 0x0B41 + 0x10000000 + 0x04000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:MIRROR,VehiclePropertyType:INT32 @@ -1330,8 +1330,8 @@ enum VehicleProperty { * * Positive value indicate tilt right, negative value is left * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ MIRROR_Y_POS = 0x0B42 + 0x10000000 + 0x04000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:MIRROR,VehiclePropertyType:INT32 @@ -1340,8 +1340,8 @@ enum VehicleProperty { * * Positive value indicate tilt right, negative value is left * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ MIRROR_Y_MOVE = 0x0B43 + 0x10000000 + 0x04000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:MIRROR,VehiclePropertyType:INT32 @@ -1350,8 +1350,8 @@ enum VehicleProperty { * * True indicates mirror positions are locked and not changeable * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ MIRROR_LOCK = 0x0B44 + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN @@ -1360,8 +1360,8 @@ enum VehicleProperty { * * True indicates mirrors are folded * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ MIRROR_FOLD = 0x0B45 + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN @@ -1376,8 +1376,8 @@ enum VehicleProperty { * will be 3. When the user wants to select a preset, the desired preset * number (1, 2, or 3) is set. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.WRITE */ SEAT_MEMORY_SELECT = 0x0B80 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1388,8 +1388,8 @@ enum VehicleProperty { * into the selected preset slot. The maxValue for each seat position * must match the maxValue for SEAT_MEMORY_SELECT. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.WRITE */ SEAT_MEMORY_SET = 0x0B81 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1401,8 +1401,8 @@ enum VehicleProperty { * Write access indicates automatic seat buckling capabilities. There are * no known cars at this time, but you never know... * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_BELT_BUCKLED = 0x0B82 + 0x10000000 + 0x05000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN @@ -1413,16 +1413,16 @@ enum VehicleProperty { * Max value indicates highest position * Min value indicates lowest position * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_BELT_HEIGHT_POS = 0x0B83 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 /** * Seatbelt height move * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_BELT_HEIGHT_MOVE = 0x0B84 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1433,8 +1433,8 @@ enum VehicleProperty { * Max value indicates closest to wheel, min value indicates most rearward * position. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_FORE_AFT_POS = 0x0B85 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1443,8 +1443,8 @@ enum VehicleProperty { * * Moves the seat position forward and aft. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_FORE_AFT_MOVE = 0x0B86 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1455,8 +1455,8 @@ enum VehicleProperty { * Max value indicates angling forward towards the steering wheel. * Min value indicates full recline. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_BACKREST_ANGLE_1_POS = 0x0B87 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1465,8 +1465,8 @@ enum VehicleProperty { * * Moves the backrest forward or recline. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_BACKREST_ANGLE_1_MOVE = 0x0B88 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1477,8 +1477,8 @@ enum VehicleProperty { * Max value indicates angling forward towards the steering wheel. * Min value indicates full recline. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_BACKREST_ANGLE_2_POS = 0x0B89 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1487,8 +1487,8 @@ enum VehicleProperty { * * Moves the backrest forward or recline. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_BACKREST_ANGLE_2_MOVE = 0x0B8A + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1499,8 +1499,8 @@ enum VehicleProperty { * Max value indicates highest position. * Min value indicates lowest position. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_HEIGHT_POS = 0x0B8B + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1509,8 +1509,8 @@ enum VehicleProperty { * * Moves the seat height. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_HEIGHT_MOVE = 0x0B8C + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1521,8 +1521,8 @@ enum VehicleProperty { * Max value indicates longest depth position. * Min value indicates shortest position. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_DEPTH_POS = 0x0B8D + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1531,8 +1531,8 @@ enum VehicleProperty { * * Adjusts the seat depth. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_DEPTH_MOVE = 0x0B8E + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1543,8 +1543,8 @@ enum VehicleProperty { * Max value indicates front edge of seat higher than back edge. * Min value indicates front edge of seat lower than back edge. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_TILT_POS = 0x0B8F + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1553,8 +1553,8 @@ enum VehicleProperty { * * Tilts the seat. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_TILT_MOVE = 0x0B90 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1565,8 +1565,8 @@ enum VehicleProperty { * Max value indicates most forward position. * Min value indicates most rearward position. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_LUMBAR_FORE_AFT_POS = 0x0B91 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1575,8 +1575,8 @@ enum VehicleProperty { * * Adjusts the lumbar support. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_LUMBAR_FORE_AFT_MOVE = 0x0B92 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1587,8 +1587,8 @@ enum VehicleProperty { * Max value indicates widest lumbar setting (i.e. least support) * Min value indicates thinnest lumbar setting. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_LUMBAR_SIDE_SUPPORT_POS = 0x0B93 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1597,8 +1597,8 @@ enum VehicleProperty { * * Adjusts the amount of lateral lumbar support. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_LUMBAR_SIDE_SUPPORT_MOVE = 0x0B94 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1609,8 +1609,8 @@ enum VehicleProperty { * Max value indicates tallest setting. * Min value indicates shortest setting. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_HEADREST_HEIGHT_POS = 0x0B95 + 0x10000000 + 0x01000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 @@ -1619,8 +1619,8 @@ enum VehicleProperty { * * Moves the headrest up and down. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_HEADREST_HEIGHT_MOVE = 0x0B96 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1631,8 +1631,8 @@ enum VehicleProperty { * Max value indicates most upright angle. * Min value indicates shallowest headrest angle. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_HEADREST_ANGLE_POS = 0x0B97 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1641,8 +1641,8 @@ enum VehicleProperty { * * Adjusts the angle of the headrest * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_HEADREST_ANGLE_MOVE = 0x0B98 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1653,16 +1653,16 @@ enum VehicleProperty { * Max value indicates position closest to front of car. * Min value indicates position closest to rear of car. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_HEADREST_FORE_AFT_POS = 0x0B99 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 /** * Headrest fore/aft move * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_HEADREST_FORE_AFT_MOVE = 0x0B9A + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 @@ -1672,8 +1672,8 @@ enum VehicleProperty { * Indicates whether a particular seat is occupied or not, to the best of the car's ability * to determine. Valid values are from the VehicleSeatOccupancyState enum. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ * @data_enum VehicleSeatOccupancyState */ SEAT_OCCUPANCY = 0x0BB0 + 0x10000000 + 0x05000000 @@ -1692,8 +1692,8 @@ enum VehicleProperty { * * Note that in this mode, 0 indicates the window is closed. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ WINDOW_POS = 0x0BC0 + 0x10000000 + 0x03000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:INT32 @@ -1720,8 +1720,8 @@ enum VehicleProperty { * Max = open the sunroof, automatically stop when sunroof is fully open. * Min = open the vent, automatically stop when vent is fully open. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ WINDOW_MOVE = 0x0BC1 + 0x10000000 + 0x03000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:INT32 @@ -1730,8 +1730,8 @@ enum VehicleProperty { * * True indicates windows are locked and can't be moved. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ WINDOW_LOCK = 0x0BC4 + 0x10000000 + 0x03000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:BOOLEAN @@ -1748,8 +1748,8 @@ enum VehicleProperty { * * IVehicle#get must always return StatusCode::NOT_AVAILABLE. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ VEHICLE_MAP_SERVICE = 0x0C00 + 0x10000000 + 0x01000000 + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED @@ -1791,8 +1791,8 @@ enum VehicleProperty { * floatValues[4 and 5] are valid sensor values * floatValues[6] is not a valid sensor value * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ */ OBD2_LIVE_FRAME = 0x0D00 + 0x10000000 + 0x01000000 + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED @@ -1817,8 +1817,8 @@ enum VehicleProperty { * freeze frames, it is possible for a frame request to respond with NOT_AVAILABLE even if * the associated timestamp has been recently obtained via OBD2_FREEZE_FRAME_INFO. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ */ OBD2_FREEZE_FRAME = 0x0D01 + 0x10000000 + 0x01000000 + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED @@ -1834,8 +1834,8 @@ enum VehicleProperty { * such element can be used as the key to OBD2_FREEZE_FRAME to retrieve * the corresponding freeze frame. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ */ OBD2_FREEZE_FRAME_INFO = 0x0D02 + 0x10000000 + 0x01000000 + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED @@ -1856,8 +1856,8 @@ enum VehicleProperty { * vehicle not support selective clearing of freeze frames, this latter mode must * return NOT_AVAILABLE. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.WRITE */ OBD2_FREEZE_FRAME_CLEAR = 0x0D03 + 0x10000000 + 0x01000000 + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED @@ -1866,8 +1866,8 @@ enum VehicleProperty { * * Return the current state of headlights. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ * @data_enum VehicleLightState */ HEADLIGHTS_STATE = 0x0E00 + 0x10000000 + 0x01000000 @@ -1877,8 +1877,8 @@ enum VehicleProperty { * * Return the current state of high beam lights. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ * @data_enum VehicleLightState */ HIGH_BEAM_LIGHTS_STATE = 0x0E01 + 0x10000000 + 0x01000000 @@ -1904,8 +1904,8 @@ enum VehicleProperty { * Only one of FOG_LIGHTS_STATE or REAR_FOG_LIGHTS_STATE must be implemented and not both. * FRONT_FOG_LIGHTS_STATE must not be implemented. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ * @data_enum VehicleLightState */ FOG_LIGHTS_STATE = 0x0E02 + 0x10000000 + 0x01000000 @@ -1915,8 +1915,8 @@ enum VehicleProperty { * * Return the current status of hazard lights. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ * @data_enum VehicleLightState */ HAZARD_LIGHTS_STATE = 0x0E03 + 0x10000000 + 0x01000000 @@ -1926,8 +1926,8 @@ enum VehicleProperty { * * The setting that the user wants. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleLightSwitch */ HEADLIGHTS_SWITCH = 0x0E10 + 0x10000000 + 0x01000000 @@ -1937,8 +1937,8 @@ enum VehicleProperty { * * The setting that the user wants. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleLightSwitch */ HIGH_BEAM_LIGHTS_SWITCH = 0x0E11 + 0x10000000 + 0x01000000 @@ -1964,8 +1964,8 @@ enum VehicleProperty { * Only one of FOG_LIGHTS_SWITCH or REAR_FOG_LIGHTS_SWITCH must be implemented and not both. * FRONT_FOG_LIGHTS_SWITCH must not be implemented. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleLightSwitch */ FOG_LIGHTS_SWITCH = 0x0E12 + 0x10000000 + 0x01000000 @@ -1975,8 +1975,8 @@ enum VehicleProperty { * * The setting that the user wants. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleLightSwitch */ HAZARD_LIGHTS_SWITCH = 0x0E13 + 0x10000000 + 0x01000000 @@ -1986,8 +1986,8 @@ enum VehicleProperty { * * Return current status of cabin lights. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ * @data_enum VehicleLightState */ CABIN_LIGHTS_STATE = 0x0F01 + 0x10000000 + 0x01000000 @@ -2000,8 +2000,8 @@ enum VehicleProperty { * is open or because of a voice command. * For example, while the switch is in the "off" or "automatic" position. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleLightSwitch */ CABIN_LIGHTS_SWITCH = 0x0F02 + 0x10000000 + 0x01000000 @@ -2011,8 +2011,8 @@ enum VehicleProperty { * * Return current status of reading lights. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ * @data_enum VehicleLightState */ READING_LIGHTS_STATE = 0x0F03 + 0x10000000 + 0x05000000 @@ -2025,8 +2025,8 @@ enum VehicleProperty { * is open or because of a voice command. * For example, while the switch is in the "off" or "automatic" position. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleLightSwitch */ READING_LIGHTS_SWITCH = 0x0F04 + 0x10000000 + 0x05000000 @@ -2054,8 +2054,8 @@ enum VehicleProperty { * If vendor chose PERMISSION_NOT_ACCESSIBLE, android will not have access to the property. In * the example, Android can not write value for vendor_prop_2. * - * @change_mode VehiclePropertyChangeMode:STATIC - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ */ SUPPORT_CUSTOMIZE_VENDOR_PERMISSION = 0x0F05 + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN @@ -2070,8 +2070,8 @@ enum VehicleProperty { * * Value read should include all features disabled with ',' separation. * ex) "com.android.car.user.CarUserNoticeService,storage_monitoring" - * @change_mode VehiclePropertyChangeMode:STATIC - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ */ DISABLED_OPTIONAL_FEATURES = 0x0F06 + 0x10000000 + 0x01000000 + 0x00100000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:STRING @@ -2120,8 +2120,8 @@ enum VehicleProperty { * by the Android System). But if it supports user management, then it must support all core * user-related properties (INITIAL_USER_INFO, SWITCH_USER, CREATE_USER, and REMOVE_USER). * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ INITIAL_USER_INFO = 0x0F07 + 0x10000000 + 0x01000000 + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED @@ -2286,8 +2286,8 @@ enum VehicleProperty { * * Example: see VEHICLE_REQUEST section above. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SWITCH_USER = 0x0F08 + 0x10000000 + 0x01000000 + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED @@ -2332,8 +2332,8 @@ enum VehicleProperty { * string: "D'OH!" // The meaning is a blackbox - it's passed to the caller (like Settings UI), * // which in turn can take the proper action. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ CREATE_USER = 0x0F09 + 0x10000000 + 0x01000000 + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED @@ -2363,8 +2363,8 @@ enum VehicleProperty { * int32[8]: 10 // 2nd user (user 10) * int32[9]: 0 // 2nd user flags (none) * - * @change_mode VehiclePropertyChangeMode:STATIC - * @access VehiclePropertyAccess:WRITE + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.WRITE */ REMOVE_USER = 0x0F0A + 0x10000000 + 0x01000000 + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED @@ -2438,8 +2438,8 @@ enum VehicleProperty { * int32[5]: 101 (2nd type: UserIdentificationAssociationType::CUSTOM_1) * int32[6]: 1 (2nd value: UserIdentificationAssociationValue::ASSOCIATE_CURRENT_USER) * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ USER_IDENTIFICATION_ASSOCIATION = 0x0F0B + 0x10000000 + 0x01000000 + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED @@ -2457,8 +2457,8 @@ enum VehicleProperty { * For example, to enable rear view EVS service, android side can set the property value as * [EvsServiceType::REAR_VIEW, EvsServiceState::ON]. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ */ EVS_SERVICE_REQUEST = 0x0F10 + 0x10000000 + 0x01000000 + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC @@ -2473,8 +2473,8 @@ enum VehicleProperty { * * string: "sample_policy_id" // power policy ID * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ */ POWER_POLICY_REQ = 0x0F21 + 0x10000000 + 0x01000000 + 0x00100000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:STRING @@ -2492,8 +2492,8 @@ enum VehicleProperty { * * string: "sample_policy_group_id" // power policy group ID * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ */ POWER_POLICY_GROUP_REQ = 0x0F22 + 0x10000000 + 0x01000000 + 0x00100000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:STRING @@ -2504,8 +2504,8 @@ enum VehicleProperty { * * string: "sample_policy_id" // power policy ID * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ CURRENT_POWER_POLICY = 0x0F23 + 0x10000000 + 0x01000000 + 0x00100000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:STRING @@ -2515,8 +2515,8 @@ enum VehicleProperty { * Car watchdog sets this property to system uptime in milliseconds at every 3 second. * During the boot, the update may take longer time. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.WRITE */ WATCHDOG_ALIVE = 0xF31 + 0x10000000 + 0x01000000 + 0x00500000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT64 @@ -2526,8 +2526,8 @@ enum VehicleProperty { * int32Values[0]: 1 // ProcessTerminationReason showing why a process is terminated. * string: "/system/bin/log" // Process execution command. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.WRITE */ WATCHDOG_TERMINATED_PROCESS = 0x0F32 + 0x10000000 + 0x01000000 + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED @@ -2541,8 +2541,8 @@ enum VehicleProperty { * VHAL unhealthy and terminates it. * If this property is not supported by VHAL, car watchdog doesn't check VHAL health status. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ */ VHAL_HEARTBEAT = 0x0F33 + 0x10000000 + 0x01000000 + 0x00500000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT64 @@ -2554,8 +2554,8 @@ enum VehicleProperty { * the default UI and a kind of launcher functionality for cluster display. * the other values are followed by OEM's definition. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ */ CLUSTER_SWITCH_UI = 0x0F34 + 0x10000000 + 0x01000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 @@ -2578,8 +2578,8 @@ enum VehicleProperty { * int32[7]: Inset - right: same format with 'left' * int32[8]: Inset - bottom: same format with 'left' * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ */ CLUSTER_DISPLAY_STATE = 0x0F35 + 0x10000000 + 0x01000000 + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC @@ -2613,8 +2613,8 @@ enum VehicleProperty { * and it only supports CALL UI only when the cellular network is available. Then, if the * nework is avaibale, it'll send [1 1 1], and if it's out of network, it'll send [1 1 0]. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.WRITE */ CLUSTER_REPORT_STATE = 0x0F36 + 0x10000000 + 0x01000000 + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED @@ -2627,8 +2627,8 @@ enum VehicleProperty { * * int32: the type of ClusterUI to show * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.WRITE */ CLUSTER_REQUEST_DISPLAY = 0x0F37 + 0x10000000 + 0x01000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 @@ -2637,8 +2637,8 @@ enum VehicleProperty { * * bytes: the serialized message of NavigationStateProto. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.WRITE */ CLUSTER_NAVIGATION_STATE = 0x0F38 + 0x10000000 + 0x01000000 + 0x00700000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BYTES @@ -2649,8 +2649,8 @@ enum VehicleProperty { * If the head unit is aware of an ETC card attached to the vehicle, this property should * return the type of card attached; otherwise, this property should be UNAVAILABLE. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ * @data_enum ElectronicTollCollectionCardType */ ELECTRONIC_TOLL_COLLECTION_CARD_TYPE = 0x0F39 + 0x10000000 + 0x01000000 @@ -2663,8 +2663,8 @@ enum VehicleProperty { * ELECTRONIC_TOLL_COLLECTION_CARD_TYPE gives that status of the card; otherwise, * this property should be UNAVAILABLE. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ * @data_enum ElectronicTollCollectionCardStatus */ ELECTRONIC_TOLL_COLLECTION_CARD_STATUS = 0x0F3A + 0x10000000 + 0x01000000 @@ -2676,8 +2676,8 @@ enum VehicleProperty { * Only one of FOG_LIGHTS_STATE or FRONT_FOG_LIGHTS_STATE must be implemented. Please refer to * the documentation on FOG_LIGHTS_STATE for more information. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ * @data_enum VehicleLightState */ FRONT_FOG_LIGHTS_STATE = 0x0F3B + 0x10000000 + 0x01000000 @@ -2690,8 +2690,8 @@ enum VehicleProperty { * Only one of FOG_LIGHTS_SWITCH or FRONT_FOG_LIGHTS_SWITCH must be implemented. Please refer to * the documentation on FOG_LIGHTS_SWITCH for more information. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleLightSwitch */ FRONT_FOG_LIGHTS_SWITCH = 0x0F3C + 0x10000000 + 0x01000000 @@ -2704,8 +2704,8 @@ enum VehicleProperty { * Only one of FOG_LIGHTS_STATE or REAR_FOG_LIGHTS_STATE must be implemented. Please refer to * the documentation on FOG_LIGHTS_STATE for more information. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ * @data_enum VehicleLightState */ REAR_FOG_LIGHTS_STATE = 0x0F3D + 0x10000000 + 0x01000000 @@ -2718,8 +2718,8 @@ enum VehicleProperty { * Only one of FOG_LIGHTS_SWITCH or REAR_FOG_LIGHTS_SWITCH must be implemented. Please refer to * the documentation on FOG_LIGHTS_SWITCH for more information. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleLightSwitch */ REAR_FOG_LIGHTS_SWITCH = 0x0F3E + 0x10000000 + 0x01000000 @@ -2731,8 +2731,8 @@ enum VehicleProperty { * configArray[0] is used to specify the max current draw allowed by * the vehicle in Amperes. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE * @unit VehicleUnit:AMPERE */ EV_CHARGE_CURRENT_DRAW_LIMIT = 0x0F3F + 0x10000000 + 0x01000000 @@ -2749,8 +2749,8 @@ enum VehicleProperty { * then the configArray should be {20, 40, 60, 80, 100} * If the configArray is empty then all values from 0 to 100 must be valid. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ EV_CHARGE_PERCENT_LIMIT = 0x0F40 + 0x10000000 + 0x01000000 + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT @@ -2760,8 +2760,8 @@ enum VehicleProperty { * * Returns the current charging state of the car. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ * @data_enum EvChargeState */ EV_CHARGE_STATE = 0x0F41 + 0x10000000 + 0x01000000 @@ -2773,8 +2773,8 @@ enum VehicleProperty { * The setting that the user wants. Setting this property to true starts the battery charging * and setting to false stops charging. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ_WRITE + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ EV_CHARGE_SWITCH = 0x0F42 + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN @@ -2784,8 +2784,8 @@ enum VehicleProperty { * * Returns 0 if the vehicle is not charging. * - * @change_mode VehiclePropertyChangeMode:CONTINUOUS - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.CONTINUOUS + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:SECS */ EV_CHARGE_TIME_REMAINING = 0x0F43 + 0x10000000 + 0x01000000 @@ -2797,8 +2797,8 @@ enum VehicleProperty { * Returns the current state associated with the regenerative braking * setting in the car * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ * @data_enum EvRegenerativeBrakingState */ EV_REGENERATIVE_BRAKING_STATE = 0x0F44 + 0x10000000 + 0x01000000 @@ -2809,8 +2809,8 @@ enum VehicleProperty { * * Returns the trailer state of the car. * - * @change_mode VehiclePropertyChangeMode:ON_CHANGE - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ * @data_enum TrailerState */ TRAILER_PRESENT = 0x0F45 + 0x10000000 + 0x01000000 @@ -2832,8 +2832,8 @@ enum VehicleProperty { * engine fluids, fuel, accessories, driver, passengers and cargo but excluding * that of any trailers. * - * @change_mode VehiclePropertyChangeMode:STATIC - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ * @unit VehicleUnit:KILOGRAM */ @@ -2846,8 +2846,8 @@ enum VehicleProperty { * Returns whether general security regulation compliance is required, if * so, what type of requirement. * - * @change_mode VehiclePropertyChangeMode:STATIC - * @access VehiclePropertyAccess:READ + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ * @data_enum GsrComplianceRequirementType */ GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT = 0x0F47 + 0x10000000 + 0x01000000 diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h new file mode 100644 index 0000000000..4d37cd3520 --- /dev/null +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -0,0 +1,218 @@ +/* + * 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. + */ + +/** + * DO NOT EDIT MANUALLY!!! + * + * Generated by tools/generate_annotation_enums.py. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_generated_lib_AccessForVehicleProperty_H_ +#define android_hardware_automotive_vehicle_aidl_generated_lib_AccessForVehicleProperty_H_ + +#include +#include + +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +std::unordered_map AccessForVehicleProperty = { + {VehicleProperty::INFO_VIN, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_MAKE, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_MODEL, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_MODEL_YEAR, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_FUEL_CAPACITY, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_FUEL_TYPE, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_EV_BATTERY_CAPACITY, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_EV_CONNECTOR_TYPE, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_FUEL_DOOR_LOCATION, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_EV_PORT_LOCATION, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_DRIVER_SEAT, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_EXTERIOR_DIMENSIONS, VehiclePropertyAccess::READ}, + {VehicleProperty::INFO_MULTI_EV_PORT_LOCATIONS, VehiclePropertyAccess::READ}, + {VehicleProperty::PERF_ODOMETER, VehiclePropertyAccess::READ}, + {VehicleProperty::PERF_VEHICLE_SPEED, VehiclePropertyAccess::READ}, + {VehicleProperty::PERF_VEHICLE_SPEED_DISPLAY, VehiclePropertyAccess::READ}, + {VehicleProperty::PERF_STEERING_ANGLE, VehiclePropertyAccess::READ}, + {VehicleProperty::PERF_REAR_STEERING_ANGLE, VehiclePropertyAccess::READ}, + {VehicleProperty::ENGINE_COOLANT_TEMP, VehiclePropertyAccess::READ}, + {VehicleProperty::ENGINE_OIL_LEVEL, VehiclePropertyAccess::READ}, + {VehicleProperty::ENGINE_OIL_TEMP, VehiclePropertyAccess::READ}, + {VehicleProperty::ENGINE_RPM, VehiclePropertyAccess::READ}, + {VehicleProperty::WHEEL_TICK, VehiclePropertyAccess::READ}, + {VehicleProperty::FUEL_LEVEL, VehiclePropertyAccess::READ}, + {VehicleProperty::FUEL_DOOR_OPEN, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::EV_BATTERY_LEVEL, VehiclePropertyAccess::READ}, + {VehicleProperty::EV_CHARGE_PORT_OPEN, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::EV_CHARGE_PORT_CONNECTED, VehiclePropertyAccess::READ}, + {VehicleProperty::EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, VehiclePropertyAccess::READ}, + {VehicleProperty::RANGE_REMAINING, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::TIRE_PRESSURE, VehiclePropertyAccess::READ}, + {VehicleProperty::CRITICALLY_LOW_TIRE_PRESSURE, VehiclePropertyAccess::READ}, + {VehicleProperty::GEAR_SELECTION, VehiclePropertyAccess::READ}, + {VehicleProperty::CURRENT_GEAR, VehiclePropertyAccess::READ}, + {VehicleProperty::PARKING_BRAKE_ON, VehiclePropertyAccess::READ}, + {VehicleProperty::PARKING_BRAKE_AUTO_APPLY, VehiclePropertyAccess::READ}, + {VehicleProperty::FUEL_LEVEL_LOW, VehiclePropertyAccess::READ}, + {VehicleProperty::NIGHT_MODE, VehiclePropertyAccess::READ}, + {VehicleProperty::TURN_SIGNAL_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::IGNITION_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::ABS_ACTIVE, VehiclePropertyAccess::READ}, + {VehicleProperty::TRACTION_CONTROL_ACTIVE, VehiclePropertyAccess::READ}, + {VehicleProperty::HVAC_FAN_SPEED, VehiclePropertyAccess::READ}, + {VehicleProperty::HVAC_FAN_DIRECTION, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_TEMPERATURE_CURRENT, VehiclePropertyAccess::READ}, + {VehicleProperty::HVAC_TEMPERATURE_SET, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_DEFROSTER, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_AC_ON, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_MAX_AC_ON, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_MAX_DEFROST_ON, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_RECIRC_ON, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_DUAL_ON, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_AUTO_ON, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_SEAT_TEMPERATURE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_SIDE_MIRROR_HEAT, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_STEERING_WHEEL_HEAT, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_TEMPERATURE_DISPLAY_UNITS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_ACTUAL_FAN_SPEED_RPM, VehiclePropertyAccess::READ}, + {VehicleProperty::HVAC_POWER_ON, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_FAN_DIRECTION_AVAILABLE, VehiclePropertyAccess::READ}, + {VehicleProperty::HVAC_AUTO_RECIRC_ON, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_SEAT_VENTILATION, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_ELECTRIC_DEFROSTER_ON, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::DISTANCE_DISPLAY_UNITS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::FUEL_VOLUME_DISPLAY_UNITS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::TIRE_PRESSURE_DISPLAY_UNITS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::EV_BATTERY_DISPLAY_UNITS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::VEHICLE_SPEED_DISPLAY_UNITS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::EXTERNAL_CAR_TIME, VehiclePropertyAccess::READ}, + {VehicleProperty::ANDROID_EPOCH_TIME, VehiclePropertyAccess::WRITE}, + {VehicleProperty::STORAGE_ENCRYPTION_BINDING_SEED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::ENV_OUTSIDE_TEMPERATURE, VehiclePropertyAccess::READ}, + {VehicleProperty::AP_POWER_STATE_REQ, VehiclePropertyAccess::READ}, + {VehicleProperty::AP_POWER_STATE_REPORT, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::AP_POWER_BOOTUP_REASON, VehiclePropertyAccess::READ}, + {VehicleProperty::DISPLAY_BRIGHTNESS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HW_KEY_INPUT, VehiclePropertyAccess::READ}, + {VehicleProperty::HW_ROTARY_INPUT, VehiclePropertyAccess::READ}, + {VehicleProperty::HW_CUSTOM_INPUT, VehiclePropertyAccess::READ}, + {VehicleProperty::DOOR_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::DOOR_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::DOOR_LOCK, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::MIRROR_Z_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::MIRROR_Z_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::MIRROR_Y_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::MIRROR_Y_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::MIRROR_LOCK, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::MIRROR_FOLD, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_MEMORY_SELECT, VehiclePropertyAccess::WRITE}, + {VehicleProperty::SEAT_MEMORY_SET, VehiclePropertyAccess::WRITE}, + {VehicleProperty::SEAT_BELT_BUCKLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_BELT_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_BELT_HEIGHT_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_FORE_AFT_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_FORE_AFT_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_BACKREST_ANGLE_1_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_BACKREST_ANGLE_1_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_BACKREST_ANGLE_2_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_BACKREST_ANGLE_2_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_HEIGHT_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_DEPTH_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_DEPTH_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_TILT_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_TILT_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_LUMBAR_FORE_AFT_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_LUMBAR_FORE_AFT_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_HEADREST_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_HEADREST_HEIGHT_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_HEADREST_ANGLE_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_OCCUPANCY, VehiclePropertyAccess::READ}, + {VehicleProperty::WINDOW_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::WINDOW_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::WINDOW_LOCK, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyAccess::READ}, + {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyAccess::READ}, + {VehicleProperty::OBD2_FREEZE_FRAME_INFO, VehiclePropertyAccess::READ}, + {VehicleProperty::OBD2_FREEZE_FRAME_CLEAR, VehiclePropertyAccess::WRITE}, + {VehicleProperty::HEADLIGHTS_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::HIGH_BEAM_LIGHTS_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::FOG_LIGHTS_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::HAZARD_LIGHTS_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::HEADLIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HIGH_BEAM_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::FOG_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HAZARD_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::CABIN_LIGHTS_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::CABIN_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::READING_LIGHTS_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::READING_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SUPPORT_CUSTOMIZE_VENDOR_PERMISSION, VehiclePropertyAccess::READ}, + {VehicleProperty::DISABLED_OPTIONAL_FEATURES, VehiclePropertyAccess::READ}, + {VehicleProperty::INITIAL_USER_INFO, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SWITCH_USER, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::CREATE_USER, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::REMOVE_USER, VehiclePropertyAccess::WRITE}, + {VehicleProperty::USER_IDENTIFICATION_ASSOCIATION, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::EVS_SERVICE_REQUEST, VehiclePropertyAccess::READ}, + {VehicleProperty::POWER_POLICY_REQ, VehiclePropertyAccess::READ}, + {VehicleProperty::POWER_POLICY_GROUP_REQ, VehiclePropertyAccess::READ}, + {VehicleProperty::CURRENT_POWER_POLICY, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::WATCHDOG_ALIVE, VehiclePropertyAccess::WRITE}, + {VehicleProperty::WATCHDOG_TERMINATED_PROCESS, VehiclePropertyAccess::WRITE}, + {VehicleProperty::VHAL_HEARTBEAT, VehiclePropertyAccess::READ}, + {VehicleProperty::CLUSTER_SWITCH_UI, VehiclePropertyAccess::READ}, + {VehicleProperty::CLUSTER_DISPLAY_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::CLUSTER_REPORT_STATE, VehiclePropertyAccess::WRITE}, + {VehicleProperty::CLUSTER_REQUEST_DISPLAY, VehiclePropertyAccess::WRITE}, + {VehicleProperty::CLUSTER_NAVIGATION_STATE, VehiclePropertyAccess::WRITE}, + {VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_TYPE, VehiclePropertyAccess::READ}, + {VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_STATUS, VehiclePropertyAccess::READ}, + {VehicleProperty::FRONT_FOG_LIGHTS_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::FRONT_FOG_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::REAR_FOG_LIGHTS_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::REAR_FOG_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::EV_CHARGE_CURRENT_DRAW_LIMIT, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::EV_CHARGE_PERCENT_LIMIT, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::EV_CHARGE_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::EV_CHARGE_SWITCH, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::EV_CHARGE_TIME_REMAINING, VehiclePropertyAccess::READ}, + {VehicleProperty::EV_REGENERATIVE_BRAKING_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::TRAILER_PRESENT, VehiclePropertyAccess::READ}, + {VehicleProperty::VEHICLE_CURB_WEIGHT, VehiclePropertyAccess::READ}, + {VehicleProperty::GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyAccess::READ}, +}; + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android +} // aidl + +#endif // android_hardware_automotive_vehicle_aidl_generated_lib_AccessForVehicleProperty_H_ diff --git a/automotive/vehicle/aidl/generated_lib/cpp/Android.bp b/automotive/vehicle/aidl/generated_lib/cpp/Android.bp new file mode 100644 index 0000000000..11d3693b50 --- /dev/null +++ b/automotive/vehicle/aidl/generated_lib/cpp/Android.bp @@ -0,0 +1,27 @@ +/* + * 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. + */ + +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_library_headers { + name: "IVehicleGeneratedHeaders", + vendor_available: true, + local_include_dirs: ["."], + export_include_dirs: ["."], + defaults: ["VehicleHalInterfaceDefaults"], +} diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h new file mode 100644 index 0000000000..c0416af1bc --- /dev/null +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -0,0 +1,218 @@ +/* + * 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. + */ + +/** + * DO NOT EDIT MANUALLY!!! + * + * Generated by tools/generate_annotation_enums.py. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_generated_lib_ChangeModeForVehicleProperty_H_ +#define android_hardware_automotive_vehicle_aidl_generated_lib_ChangeModeForVehicleProperty_H_ + +#include +#include + +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +std::unordered_map ChangeModeForVehicleProperty = { + {VehicleProperty::INFO_VIN, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_MAKE, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_MODEL, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_MODEL_YEAR, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_FUEL_CAPACITY, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_FUEL_TYPE, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_EV_BATTERY_CAPACITY, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_EV_CONNECTOR_TYPE, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_FUEL_DOOR_LOCATION, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_EV_PORT_LOCATION, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_DRIVER_SEAT, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_EXTERIOR_DIMENSIONS, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INFO_MULTI_EV_PORT_LOCATIONS, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::PERF_ODOMETER, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::PERF_VEHICLE_SPEED, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::PERF_VEHICLE_SPEED_DISPLAY, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::PERF_STEERING_ANGLE, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::PERF_REAR_STEERING_ANGLE, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::ENGINE_COOLANT_TEMP, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::ENGINE_OIL_LEVEL, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ENGINE_OIL_TEMP, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::ENGINE_RPM, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::WHEEL_TICK, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::FUEL_LEVEL, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::FUEL_DOOR_OPEN, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EV_BATTERY_LEVEL, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::EV_CHARGE_PORT_OPEN, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EV_CHARGE_PORT_CONNECTED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::RANGE_REMAINING, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::TIRE_PRESSURE, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::CRITICALLY_LOW_TIRE_PRESSURE, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::GEAR_SELECTION, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CURRENT_GEAR, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::PARKING_BRAKE_ON, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::PARKING_BRAKE_AUTO_APPLY, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::FUEL_LEVEL_LOW, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::NIGHT_MODE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::TURN_SIGNAL_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::IGNITION_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ABS_ACTIVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::TRACTION_CONTROL_ACTIVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_FAN_SPEED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_FAN_DIRECTION, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_TEMPERATURE_CURRENT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_TEMPERATURE_SET, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_DEFROSTER, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_AC_ON, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_MAX_AC_ON, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_MAX_DEFROST_ON, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_RECIRC_ON, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_DUAL_ON, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_AUTO_ON, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_SEAT_TEMPERATURE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_SIDE_MIRROR_HEAT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_STEERING_WHEEL_HEAT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_TEMPERATURE_DISPLAY_UNITS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_ACTUAL_FAN_SPEED_RPM, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_POWER_ON, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_FAN_DIRECTION_AVAILABLE, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::HVAC_AUTO_RECIRC_ON, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_SEAT_VENTILATION, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_ELECTRIC_DEFROSTER_ON, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DISTANCE_DISPLAY_UNITS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::FUEL_VOLUME_DISPLAY_UNITS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::TIRE_PRESSURE_DISPLAY_UNITS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EV_BATTERY_DISPLAY_UNITS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::VEHICLE_SPEED_DISPLAY_UNITS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EXTERNAL_CAR_TIME, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ANDROID_EPOCH_TIME, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::STORAGE_ENCRYPTION_BINDING_SEED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ENV_OUTSIDE_TEMPERATURE, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::AP_POWER_STATE_REQ, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::AP_POWER_STATE_REPORT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::AP_POWER_BOOTUP_REASON, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::DISPLAY_BRIGHTNESS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HW_KEY_INPUT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HW_ROTARY_INPUT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HW_CUSTOM_INPUT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DOOR_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DOOR_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DOOR_LOCK, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::MIRROR_Z_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::MIRROR_Z_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::MIRROR_Y_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::MIRROR_Y_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::MIRROR_LOCK, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::MIRROR_FOLD, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_MEMORY_SELECT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_MEMORY_SET, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_BELT_BUCKLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_BELT_HEIGHT_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_BELT_HEIGHT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_FORE_AFT_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_FORE_AFT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_BACKREST_ANGLE_1_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_BACKREST_ANGLE_1_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_BACKREST_ANGLE_2_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_BACKREST_ANGLE_2_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_HEIGHT_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_HEIGHT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_DEPTH_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_DEPTH_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_TILT_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_TILT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_LUMBAR_FORE_AFT_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_LUMBAR_FORE_AFT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_HEADREST_HEIGHT_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_HEADREST_HEIGHT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_HEADREST_ANGLE_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_OCCUPANCY, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::WINDOW_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::WINDOW_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::WINDOW_LOCK, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::OBD2_FREEZE_FRAME_INFO, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::OBD2_FREEZE_FRAME_CLEAR, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HEADLIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HIGH_BEAM_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::FOG_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HAZARD_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HEADLIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HIGH_BEAM_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::FOG_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HAZARD_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CABIN_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CABIN_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::READING_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::READING_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SUPPORT_CUSTOMIZE_VENDOR_PERMISSION, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::DISABLED_OPTIONAL_FEATURES, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::INITIAL_USER_INFO, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SWITCH_USER, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CREATE_USER, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::REMOVE_USER, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::USER_IDENTIFICATION_ASSOCIATION, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EVS_SERVICE_REQUEST, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::POWER_POLICY_REQ, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::POWER_POLICY_GROUP_REQ, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CURRENT_POWER_POLICY, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::WATCHDOG_ALIVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::WATCHDOG_TERMINATED_PROCESS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::VHAL_HEARTBEAT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CLUSTER_SWITCH_UI, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CLUSTER_DISPLAY_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CLUSTER_REPORT_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CLUSTER_REQUEST_DISPLAY, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CLUSTER_NAVIGATION_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_TYPE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_STATUS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::FRONT_FOG_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::FRONT_FOG_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::REAR_FOG_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::REAR_FOG_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EV_CHARGE_CURRENT_DRAW_LIMIT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EV_CHARGE_PERCENT_LIMIT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EV_CHARGE_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EV_CHARGE_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EV_CHARGE_TIME_REMAINING, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::EV_REGENERATIVE_BRAKING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::TRAILER_PRESENT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::VEHICLE_CURB_WEIGHT, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyChangeMode::STATIC}, +}; + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android +} // aidl + +#endif // android_hardware_automotive_vehicle_aidl_generated_lib_ChangeModeForVehicleProperty_H_ diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java new file mode 100644 index 0000000000..fdf6c64afe --- /dev/null +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -0,0 +1,204 @@ +/* + * 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. + */ + +/** + * DO NOT EDIT MANUALLY!!! + * + * Generated by tools/generate_annotation_enums.py. + */ + +package android.hardware.automotive.vehicle; + +import java.util.Map; + +public final class AccessForVehicleProperty { + + public static final Map values = Map.ofEntries( + Map.entry(VehicleProperty.INFO_VIN, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_MAKE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_MODEL, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_MODEL_YEAR, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_FUEL_CAPACITY, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_FUEL_TYPE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_EV_BATTERY_CAPACITY, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_EV_CONNECTOR_TYPE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_FUEL_DOOR_LOCATION, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_EV_PORT_LOCATION, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_DRIVER_SEAT, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_EXTERIOR_DIMENSIONS, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INFO_MULTI_EV_PORT_LOCATIONS, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.PERF_ODOMETER, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.PERF_VEHICLE_SPEED, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.PERF_VEHICLE_SPEED_DISPLAY, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.PERF_STEERING_ANGLE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.PERF_REAR_STEERING_ANGLE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ENGINE_COOLANT_TEMP, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ENGINE_OIL_LEVEL, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ENGINE_OIL_TEMP, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ENGINE_RPM, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.WHEEL_TICK, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.FUEL_LEVEL, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.FUEL_DOOR_OPEN, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.EV_BATTERY_LEVEL, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.EV_CHARGE_PORT_OPEN, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.EV_CHARGE_PORT_CONNECTED, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.RANGE_REMAINING, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.TIRE_PRESSURE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.CRITICALLY_LOW_TIRE_PRESSURE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.GEAR_SELECTION, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.CURRENT_GEAR, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.PARKING_BRAKE_ON, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.PARKING_BRAKE_AUTO_APPLY, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.FUEL_LEVEL_LOW, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.NIGHT_MODE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.TURN_SIGNAL_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.IGNITION_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ABS_ACTIVE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.TRACTION_CONTROL_ACTIVE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HVAC_FAN_SPEED, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HVAC_FAN_DIRECTION, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_TEMPERATURE_CURRENT, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HVAC_TEMPERATURE_SET, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_DEFROSTER, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_AC_ON, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_MAX_AC_ON, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_MAX_DEFROST_ON, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_RECIRC_ON, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_DUAL_ON, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_AUTO_ON, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_SEAT_TEMPERATURE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_SIDE_MIRROR_HEAT, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_STEERING_WHEEL_HEAT, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_TEMPERATURE_DISPLAY_UNITS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_ACTUAL_FAN_SPEED_RPM, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HVAC_POWER_ON, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_FAN_DIRECTION_AVAILABLE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HVAC_AUTO_RECIRC_ON, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_SEAT_VENTILATION, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_ELECTRIC_DEFROSTER_ON, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HVAC_TEMPERATURE_VALUE_SUGGESTION, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.DISTANCE_DISPLAY_UNITS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.FUEL_VOLUME_DISPLAY_UNITS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.TIRE_PRESSURE_DISPLAY_UNITS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.EV_BATTERY_DISPLAY_UNITS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.VEHICLE_SPEED_DISPLAY_UNITS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.EXTERNAL_CAR_TIME, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ANDROID_EPOCH_TIME, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.STORAGE_ENCRYPTION_BINDING_SEED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.ENV_OUTSIDE_TEMPERATURE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.AP_POWER_STATE_REQ, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.AP_POWER_STATE_REPORT, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.AP_POWER_BOOTUP_REASON, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.DISPLAY_BRIGHTNESS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HW_KEY_INPUT, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HW_ROTARY_INPUT, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HW_CUSTOM_INPUT, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.DOOR_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.DOOR_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.DOOR_LOCK, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.MIRROR_Z_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.MIRROR_Z_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.MIRROR_Y_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.MIRROR_Y_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.MIRROR_LOCK, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.MIRROR_FOLD, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_MEMORY_SELECT, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.SEAT_MEMORY_SET, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.SEAT_BELT_BUCKLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_BELT_HEIGHT_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_BELT_HEIGHT_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_FORE_AFT_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_FORE_AFT_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_1_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_1_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_2_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_2_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_HEIGHT_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_HEIGHT_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_DEPTH_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_DEPTH_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_TILT_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_TILT_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_LUMBAR_FORE_AFT_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_LUMBAR_FORE_AFT_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_LUMBAR_SIDE_SUPPORT_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_LUMBAR_SIDE_SUPPORT_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_HEADREST_HEIGHT_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_HEADREST_HEIGHT_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_HEADREST_ANGLE_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_OCCUPANCY, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.WINDOW_LOCK, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.OBD2_FREEZE_FRAME_INFO, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.OBD2_FREEZE_FRAME_CLEAR, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.HEADLIGHTS_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HIGH_BEAM_LIGHTS_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.FOG_LIGHTS_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HAZARD_LIGHTS_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HEADLIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HIGH_BEAM_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.FOG_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HAZARD_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.CABIN_LIGHTS_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.CABIN_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.READING_LIGHTS_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.READING_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SUPPORT_CUSTOMIZE_VENDOR_PERMISSION, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.DISABLED_OPTIONAL_FEATURES, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.INITIAL_USER_INFO, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SWITCH_USER, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.CREATE_USER, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.REMOVE_USER, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.USER_IDENTIFICATION_ASSOCIATION, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.EVS_SERVICE_REQUEST, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.POWER_POLICY_REQ, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.POWER_POLICY_GROUP_REQ, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.CURRENT_POWER_POLICY, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.WATCHDOG_ALIVE, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.WATCHDOG_TERMINATED_PROCESS, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.VHAL_HEARTBEAT, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.CLUSTER_SWITCH_UI, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.CLUSTER_DISPLAY_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.CLUSTER_REPORT_STATE, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.CLUSTER_REQUEST_DISPLAY, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.CLUSTER_NAVIGATION_STATE, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.ELECTRONIC_TOLL_COLLECTION_CARD_TYPE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ELECTRONIC_TOLL_COLLECTION_CARD_STATUS, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.FRONT_FOG_LIGHTS_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.FRONT_FOG_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.REAR_FOG_LIGHTS_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.REAR_FOG_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.EV_CHARGE_CURRENT_DRAW_LIMIT, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.EV_CHARGE_PERCENT_LIMIT, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.EV_CHARGE_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.EV_CHARGE_SWITCH, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.EV_CHARGE_TIME_REMAINING, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.EV_REGENERATIVE_BRAKING_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.TRAILER_PRESENT, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.VEHICLE_CURB_WEIGHT, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyAccess.READ) + ); + +} diff --git a/automotive/vehicle/aidl/generated_lib/java/Android.bp b/automotive/vehicle/aidl/generated_lib/java/Android.bp new file mode 100644 index 0000000000..1d612e8292 --- /dev/null +++ b/automotive/vehicle/aidl/generated_lib/java/Android.bp @@ -0,0 +1,26 @@ +/* + * 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. + */ + +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +filegroup { + name: "IVehicleGeneratedJavaFiles", + srcs: [ + "*.java", + ], +} diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java new file mode 100644 index 0000000000..5dfcd22d02 --- /dev/null +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -0,0 +1,204 @@ +/* + * 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. + */ + +/** + * DO NOT EDIT MANUALLY!!! + * + * Generated by tools/generate_annotation_enums.py. + */ + +package android.hardware.automotive.vehicle; + +import java.util.Map; + +public final class ChangeModeForVehicleProperty { + + public static final Map values = Map.ofEntries( + Map.entry(VehicleProperty.INFO_VIN, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_MAKE, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_MODEL, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_MODEL_YEAR, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_FUEL_CAPACITY, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_FUEL_TYPE, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_EV_BATTERY_CAPACITY, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_EV_CONNECTOR_TYPE, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_FUEL_DOOR_LOCATION, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_EV_PORT_LOCATION, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_DRIVER_SEAT, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_EXTERIOR_DIMENSIONS, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INFO_MULTI_EV_PORT_LOCATIONS, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.PERF_ODOMETER, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.PERF_VEHICLE_SPEED, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.PERF_VEHICLE_SPEED_DISPLAY, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.PERF_STEERING_ANGLE, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.PERF_REAR_STEERING_ANGLE, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.ENGINE_COOLANT_TEMP, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.ENGINE_OIL_LEVEL, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ENGINE_OIL_TEMP, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.ENGINE_RPM, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.WHEEL_TICK, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.FUEL_LEVEL, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.FUEL_DOOR_OPEN, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EV_BATTERY_LEVEL, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.EV_CHARGE_PORT_OPEN, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EV_CHARGE_PORT_CONNECTED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.RANGE_REMAINING, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.TIRE_PRESSURE, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.CRITICALLY_LOW_TIRE_PRESSURE, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.GEAR_SELECTION, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CURRENT_GEAR, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.PARKING_BRAKE_ON, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.PARKING_BRAKE_AUTO_APPLY, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.FUEL_LEVEL_LOW, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.NIGHT_MODE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.TURN_SIGNAL_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.IGNITION_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ABS_ACTIVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.TRACTION_CONTROL_ACTIVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_FAN_SPEED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_FAN_DIRECTION, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_TEMPERATURE_CURRENT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_TEMPERATURE_SET, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_DEFROSTER, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_AC_ON, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_MAX_AC_ON, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_MAX_DEFROST_ON, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_RECIRC_ON, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_DUAL_ON, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_AUTO_ON, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_SEAT_TEMPERATURE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_SIDE_MIRROR_HEAT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_STEERING_WHEEL_HEAT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_TEMPERATURE_DISPLAY_UNITS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_ACTUAL_FAN_SPEED_RPM, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_POWER_ON, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_FAN_DIRECTION_AVAILABLE, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.HVAC_AUTO_RECIRC_ON, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_SEAT_VENTILATION, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_ELECTRIC_DEFROSTER_ON, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HVAC_TEMPERATURE_VALUE_SUGGESTION, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DISTANCE_DISPLAY_UNITS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.FUEL_VOLUME_DISPLAY_UNITS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.TIRE_PRESSURE_DISPLAY_UNITS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EV_BATTERY_DISPLAY_UNITS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.VEHICLE_SPEED_DISPLAY_UNITS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EXTERNAL_CAR_TIME, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ANDROID_EPOCH_TIME, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.STORAGE_ENCRYPTION_BINDING_SEED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ENV_OUTSIDE_TEMPERATURE, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.AP_POWER_STATE_REQ, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.AP_POWER_STATE_REPORT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.AP_POWER_BOOTUP_REASON, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.DISPLAY_BRIGHTNESS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HW_KEY_INPUT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HW_ROTARY_INPUT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HW_CUSTOM_INPUT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DOOR_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DOOR_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DOOR_LOCK, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.MIRROR_Z_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.MIRROR_Z_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.MIRROR_Y_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.MIRROR_Y_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.MIRROR_LOCK, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.MIRROR_FOLD, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_MEMORY_SELECT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_MEMORY_SET, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_BELT_BUCKLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_BELT_HEIGHT_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_BELT_HEIGHT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_FORE_AFT_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_FORE_AFT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_1_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_1_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_2_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_BACKREST_ANGLE_2_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_HEIGHT_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_HEIGHT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_DEPTH_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_DEPTH_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_TILT_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_TILT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_LUMBAR_FORE_AFT_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_LUMBAR_FORE_AFT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_LUMBAR_SIDE_SUPPORT_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_LUMBAR_SIDE_SUPPORT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_HEADREST_HEIGHT_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_HEADREST_HEIGHT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_HEADREST_ANGLE_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_OCCUPANCY, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.WINDOW_LOCK, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.OBD2_FREEZE_FRAME_INFO, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.OBD2_FREEZE_FRAME_CLEAR, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HEADLIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HIGH_BEAM_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.FOG_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HAZARD_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HEADLIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HIGH_BEAM_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.FOG_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HAZARD_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CABIN_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CABIN_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.READING_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.READING_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SUPPORT_CUSTOMIZE_VENDOR_PERMISSION, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.DISABLED_OPTIONAL_FEATURES, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.INITIAL_USER_INFO, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SWITCH_USER, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CREATE_USER, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.REMOVE_USER, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.USER_IDENTIFICATION_ASSOCIATION, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EVS_SERVICE_REQUEST, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.POWER_POLICY_REQ, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.POWER_POLICY_GROUP_REQ, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CURRENT_POWER_POLICY, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.WATCHDOG_ALIVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.WATCHDOG_TERMINATED_PROCESS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.VHAL_HEARTBEAT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CLUSTER_SWITCH_UI, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CLUSTER_DISPLAY_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CLUSTER_REPORT_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CLUSTER_REQUEST_DISPLAY, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CLUSTER_NAVIGATION_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ELECTRONIC_TOLL_COLLECTION_CARD_TYPE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ELECTRONIC_TOLL_COLLECTION_CARD_STATUS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.FRONT_FOG_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.FRONT_FOG_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.REAR_FOG_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.REAR_FOG_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EV_CHARGE_CURRENT_DRAW_LIMIT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EV_CHARGE_PERCENT_LIMIT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EV_CHARGE_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EV_CHARGE_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EV_CHARGE_TIME_REMAINING, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.EV_REGENERATIVE_BRAKING_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.TRAILER_PRESENT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.VEHICLE_CURB_WEIGHT, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyChangeMode.STATIC) + ); + +} diff --git a/automotive/vehicle/tools/generate_annotation_enums.py b/automotive/vehicle/tools/generate_annotation_enums.py new file mode 100644 index 0000000000..154fe658db --- /dev/null +++ b/automotive/vehicle/tools/generate_annotation_enums.py @@ -0,0 +1,243 @@ +#!/usr/bin/python + +# 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. +# +"""A script to generate Java files and CPP header files based on annotations in VehicleProperty.aidl + + Need ANDROID_BUILD_TOP environmental variable to be set. This script will update + ChangeModeForVehicleProperty.h and AccessForVehicleProperty.h under generated_lib/cpp and + ChangeModeForVehicleProperty.java and AccessForVehicleProperty.java under generated_lib/java. + + Usage: + $ python generate_annotation_enums.py +""" +import os +import re +import sys + +PROP_AIDL_FILE_PATH = ("hardware/interfaces/automotive/vehicle/aidl/android/hardware/automotive/" + + "vehicle/VehicleProperty.aidl") +CHANGE_MODE_CPP_FILE_PATH = ("hardware/interfaces/automotive/vehicle/aidl/generated_lib/cpp/" + + "ChangeModeForVehicleProperty.h") +ACCESS_CPP_FILE_PATH = ("hardware/interfaces/automotive/vehicle/aidl/generated_lib/cpp/" + + "AccessForVehicleProperty.h") +CHANGE_MODE_JAVA_FILE_PATH = ("hardware/interfaces/automotive/vehicle/aidl/generated_lib/java/" + + "ChangeModeForVehicleProperty.java") +ACCESS_JAVA_FILE_PATH = ("hardware/interfaces/automotive/vehicle/aidl/generated_lib/java/" + + "AccessForVehicleProperty.java") + +TAB = " " +RE_ENUM_START = re.compile("\s*enum VehicleProperty \{") +RE_ENUM_END = re.compile("\s*\}\;") +RE_COMMENT_BEGIN = re.compile("\s*\/\*\*") +RE_COMMENT_END = re.compile("\s*\*\/") +RE_CHANGE_MODE = re.compile("\s*\* @change_mode (\S+)\s*") +RE_ACCESS = re.compile("\s*\* @access (\S+)\s*") +RE_VALUE = re.compile("\s*(\w+)\s*=(.*)") + +LICENSE = """/* + * 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. + */ + +/** + * DO NOT EDIT MANUALLY!!! + * + * Generated by tools/generate_annotation_enums.py. + */ + +""" + +CHANGE_MODE_CPP_HEADER = """#ifndef android_hardware_automotive_vehicle_aidl_generated_lib_ChangeModeForVehicleProperty_H_ +#define android_hardware_automotive_vehicle_aidl_generated_lib_ChangeModeForVehicleProperty_H_ + +#include +#include + +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +std::unordered_map ChangeModeForVehicleProperty = { +""" + +CHANGE_MODE_CPP_FOOTER = """ +}; + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android +} // aidl + +#endif // android_hardware_automotive_vehicle_aidl_generated_lib_ChangeModeForVehicleProperty_H_ +""" + +ACCESS_CPP_HEADER = """#ifndef android_hardware_automotive_vehicle_aidl_generated_lib_AccessForVehicleProperty_H_ +#define android_hardware_automotive_vehicle_aidl_generated_lib_AccessForVehicleProperty_H_ + +#include +#include + +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +std::unordered_map AccessForVehicleProperty = { +""" + +ACCESS_CPP_FOOTER = """ +}; + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android +} // aidl + +#endif // android_hardware_automotive_vehicle_aidl_generated_lib_AccessForVehicleProperty_H_ +""" + +CHANGE_MODE_JAVA_HEADER = """package android.hardware.automotive.vehicle; + +import java.util.Map; + +public final class ChangeModeForVehicleProperty { + + public static final Map values = Map.ofEntries( +""" + +CHANGE_MODE_JAVA_FOOTER = """ + ); + +} +""" + +ACCESS_JAVA_HEADER = """package android.hardware.automotive.vehicle; + +import java.util.Map; + +public final class AccessForVehicleProperty { + + public static final Map values = Map.ofEntries( +""" + +ACCESS_JAVA_FOOTER = """ + ); + +} +""" + + +class Converter: + + def __init__(self, name, annotation_re): + self.name = name + self.annotation_re = annotation_re + + def convert(self, input, output, header, footer, cpp): + processing = False + in_comment = False + content = LICENSE + header + annotation = None + id = 0 + with open(input, 'r') as f: + for line in f.readlines(): + if RE_ENUM_START.match(line): + processing = True + annotation = None + elif RE_ENUM_END.match(line): + processing = False + if not processing: + continue + if RE_COMMENT_BEGIN.match(line): + in_comment = True + if RE_COMMENT_END.match(line): + in_comment = False + if in_comment: + match = self.annotation_re.match(line) + if match: + annotation = match.group(1) + else: + match = RE_VALUE.match(line) + if match: + prop_name = match.group(1) + if prop_name == "INVALID": + continue + if not annotation: + print("No @" + self.name + " annotation for property: " + prop_name) + sys.exit(1) + if id != 0: + content += "\n" + if cpp: + annotation = annotation.replace(".", "::") + content += (TAB + TAB + "{VehicleProperty::" + prop_name + ", " + + annotation + "},") + else: + content += (TAB + TAB + "Map.entry(VehicleProperty." + prop_name + ", " + + annotation + "),") + id += 1 + + # Remove the additional "," at the end for the Java file. + if not cpp: + content = content[:-1] + + content += footer + + with open(output, 'w') as f: + f.write(content) + + +def main(): + android_top = os.environ['ANDROID_BUILD_TOP'] + if not android_top: + print("ANDROID_BUILD_TOP is not in envorinmental variable, please run source and lunch " + + "at the android root") + + aidl_file = os.path.join(android_top, PROP_AIDL_FILE_PATH) + change_mode_cpp_output = os.path.join(android_top, CHANGE_MODE_CPP_FILE_PATH); + access_cpp_output = os.path.join(android_top, ACCESS_CPP_FILE_PATH); + change_mode_java_output = os.path.join(android_top, CHANGE_MODE_JAVA_FILE_PATH); + access_java_output = os.path.join(android_top, ACCESS_JAVA_FILE_PATH); + + c = Converter("change_mode", RE_CHANGE_MODE); + c.convert(aidl_file, change_mode_cpp_output, CHANGE_MODE_CPP_HEADER, CHANGE_MODE_CPP_FOOTER, True) + c.convert(aidl_file, change_mode_java_output, CHANGE_MODE_JAVA_HEADER, CHANGE_MODE_JAVA_FOOTER, False) + c = Converter("access", RE_ACCESS) + c.convert(aidl_file, access_cpp_output, ACCESS_CPP_HEADER, ACCESS_CPP_FOOTER, True) + c.convert(aidl_file, access_java_output, ACCESS_JAVA_HEADER, ACCESS_JAVA_FOOTER, False) + + +if __name__ == "__main__": + main() \ No newline at end of file From 337406a5c226bc36f7180dd4d4ece77fdfd590f9 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Wed, 22 Jun 2022 17:30:24 +0000 Subject: [PATCH 130/998] Add logic to the EnableMacRandomization VTS test to check whether mac randomization is enabled. Bug: 235182238 Test: atest VtsHalWifiSupplicantP2pIfaceTargetTest Change-Id: I1b16da1ee07f98caf6b90ded1bae51b6b7cc8c1a --- .../vts/functional/supplicant_p2p_iface_aidl_test.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp index d95bd038ce..b7984fac42 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp +++ b/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -38,6 +39,7 @@ using aidl::android::hardware::wifi::supplicant::P2pFrameTypeMask; using aidl::android::hardware::wifi::supplicant::P2pGroupCapabilityMask; using aidl::android::hardware::wifi::supplicant::P2pProvDiscStatusCode; using aidl::android::hardware::wifi::supplicant::P2pStatusCode; +using aidl::android::hardware::wifi::supplicant::SupplicantStatusCode; using aidl::android::hardware::wifi::supplicant::WpsConfigMethods; using aidl::android::hardware::wifi::supplicant::WpsDevPasswordId; using aidl::android::hardware::wifi::supplicant::WpsProvisionMethod; @@ -413,7 +415,12 @@ TEST_P(SupplicantP2pIfaceAidlTest, SetListenChannel) { */ TEST_P(SupplicantP2pIfaceAidlTest, EnableMacRandomization) { // Enable twice - EXPECT_TRUE(p2p_iface_->setMacRandomization(true).isOk()); + auto status = p2p_iface_->setMacRandomization(true); + if (!status.isOk() && status.getServiceSpecificError() == + static_cast(SupplicantStatusCode::FAILURE_UNSUPPORTED)) { + GTEST_SKIP() << "Mac randomization is not supported."; + } + EXPECT_TRUE(status.isOk()); EXPECT_TRUE(p2p_iface_->setMacRandomization(true).isOk()); // Disable twice From 0ee75ca925f6334741d3e34c5e1d1b0efae5943b Mon Sep 17 00:00:00 2001 From: jiabin Date: Thu, 7 Jul 2022 18:13:45 +0000 Subject: [PATCH 131/998] Fix array out of bound in audioTransportToHal. The number of audio profile and extra audio descriptor must not be greater than the maximum value. Bug: 237288416 Bug: 237717857 Test: repo step in bug Test: atest android.hardware.audio.common@7.0-util_tests Change-Id: I1fcfa29d7841a1cb73bafb1ea92f3b1630992ae9 --- .../all-versions/default/7.0/HidlUtils.cpp | 5 ++- .../default/tests/hidlutils_tests.cpp | 42 +++++++++++++++---- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/audio/common/all-versions/default/7.0/HidlUtils.cpp b/audio/common/all-versions/default/7.0/HidlUtils.cpp index 0fd2947963..f89c898da8 100644 --- a/audio/common/all-versions/default/7.0/HidlUtils.cpp +++ b/audio/common/all-versions/default/7.0/HidlUtils.cpp @@ -898,7 +898,7 @@ status_t HidlUtils::audioTransportsToHal(const hidl_vec& transpo for (const auto& transport : transports) { switch (transport.audioCapability.getDiscriminator()) { case AudioTransport::AudioCapability::hidl_discriminator::profile: - if (halPort->num_audio_profiles > AUDIO_PORT_MAX_AUDIO_PROFILES) { + if (halPort->num_audio_profiles >= AUDIO_PORT_MAX_AUDIO_PROFILES) { ALOGE("%s, too many audio profiles", __func__); result = BAD_VALUE; break; @@ -914,7 +914,8 @@ status_t HidlUtils::audioTransportsToHal(const hidl_vec& transpo result); break; case AudioTransport::AudioCapability::hidl_discriminator::edid: - if (halPort->num_extra_audio_descriptors > AUDIO_PORT_MAX_EXTRA_AUDIO_DESCRIPTORS) { + if (halPort->num_extra_audio_descriptors >= + AUDIO_PORT_MAX_EXTRA_AUDIO_DESCRIPTORS) { ALOGE("%s, too many extra audio descriptors", __func__); result = BAD_VALUE; break; diff --git a/audio/common/all-versions/default/tests/hidlutils_tests.cpp b/audio/common/all-versions/default/tests/hidlutils_tests.cpp index e5ed8449d9..c295aaaef6 100644 --- a/audio/common/all-versions/default/tests/hidlutils_tests.cpp +++ b/audio/common/all-versions/default/tests/hidlutils_tests.cpp @@ -955,6 +955,18 @@ TEST(HidlUtils, ConvertAudioPortConfig) { EXPECT_TRUE(audio_port_configs_are_equal(&halConfig, &halConfigBack)); } +static AudioProfile generateValidAudioProfile() { + AudioProfile profile; + profile.format = toString(xsd::AudioFormat::AUDIO_FORMAT_PCM_16_BIT); + profile.sampleRates.resize(2); + profile.sampleRates[0] = 44100; + profile.sampleRates[1] = 48000; + profile.channelMasks.resize(2); + profile.channelMasks[0] = toString(xsd::AudioChannelMask::AUDIO_CHANNEL_OUT_MONO); + profile.channelMasks[1] = toString(xsd::AudioChannelMask::AUDIO_CHANNEL_OUT_STEREO); + return profile; +} + TEST(HidlUtils, ConvertInvalidAudioTransports) { hidl_vec invalid; struct audio_port_v7 halInvalid = {}; @@ -974,20 +986,32 @@ TEST(HidlUtils, ConvertInvalidAudioTransports) { invalid[0].audioCapability.edid(hidl_vec(EXTRA_AUDIO_DESCRIPTOR_SIZE + 1)); invalid[1].encapsulationType = "random string"; EXPECT_EQ(BAD_VALUE, HidlUtils::audioTransportsToHal(invalid, &halInvalid)); + + // The size of audio profile must not be greater than the maximum value. + invalid.resize(0); + invalid.resize(AUDIO_PORT_MAX_AUDIO_PROFILES + 1); + for (size_t i = 0; i < invalid.size(); ++i) { + invalid[i].audioCapability.profile(generateValidAudioProfile()); + invalid[i].encapsulationType = + toString(xsd::AudioEncapsulationType::AUDIO_ENCAPSULATION_TYPE_NONE); + } + EXPECT_EQ(BAD_VALUE, HidlUtils::audioTransportsToHal(invalid, &halInvalid)); + + // The size of extra audio descriptors must not be greater than the maximum value. + invalid.resize(0); + invalid.resize(AUDIO_PORT_MAX_EXTRA_AUDIO_DESCRIPTORS + 1); + for (size_t i = 0; i < invalid.size(); ++i) { + invalid[i].audioCapability.edid({0x11, 0x06, 0x01}); + invalid[i].encapsulationType = + toString(xsd::AudioEncapsulationType::AUDIO_ENCAPSULATION_TYPE_IEC61937); + } + EXPECT_EQ(BAD_VALUE, HidlUtils::audioTransportsToHal(invalid, &halInvalid)); } TEST(HidlUtils, ConvertAudioTransports) { hidl_vec transports; transports.resize(2); - AudioProfile profile; - profile.format = toString(xsd::AudioFormat::AUDIO_FORMAT_PCM_16_BIT); - profile.sampleRates.resize(2); - profile.sampleRates[0] = 44100; - profile.sampleRates[1] = 48000; - profile.channelMasks.resize(2); - profile.channelMasks[0] = toString(xsd::AudioChannelMask::AUDIO_CHANNEL_OUT_MONO); - profile.channelMasks[1] = toString(xsd::AudioChannelMask::AUDIO_CHANNEL_OUT_STEREO); - transports[0].audioCapability.profile(profile); + transports[0].audioCapability.profile(generateValidAudioProfile()); hidl_vec shortAudioDescriptor({0x11, 0x06, 0x01}); transports[0].encapsulationType = toString(xsd::AudioEncapsulationType::AUDIO_ENCAPSULATION_TYPE_NONE); From 6d25b825e8996a0f549dd930542380467da947ca Mon Sep 17 00:00:00 2001 From: ziyiw Date: Thu, 7 Jul 2022 23:03:46 +0000 Subject: [PATCH 132/998] Add new capability TLV and config TLV for supported diagnostics. Test: Compile Bug: 236969605 Change-Id: I9cd3e442857cf8691420f7d3f3386f1aa45a78a2 --- .../UwbVendorCapabilityTlvTypes.aidl | 1 + .../UwbVendorSessionAppConfigTlvTypes.aidl | 2 ++ .../UwbVendorCapabilityTlvTypes.aidl | 8 ++++++++ .../UwbVendorSessionAppConfigTlvTypes.aidl | 19 +++++++++++++++++++ 4 files changed, 30 insertions(+) diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl index cd08671931..39bb5d9662 100644 --- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl @@ -47,4 +47,5 @@ enum UwbVendorCapabilityTlvTypes { SUPPORTED_MIN_RANGING_INTERVAL_MS = 228, SUPPORTED_RANGE_DATA_NTF_CONFIG = 229, SUPPORTED_RSSI_REPORTING = 230, + SUPPORTED_DIAGNOSTICS = 231, } diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl index d35728fbef..8413f06d0f 100644 --- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl @@ -43,4 +43,6 @@ enum UwbVendorSessionAppConfigTlvTypes { NB_OF_RANGE_MEASUREMENTS = 227, NB_OF_AZIMUTH_MEASUREMENTS = 228, NB_OF_ELEVATION_MEASUREMENTS = 229, + ENABLE_DIAGNOSTICS = 232, + DIAGRAMS_FRAME_REPORTS_FIELDS = 233, } diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl index 556bd13d58..86479fb314 100644 --- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl +++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl @@ -171,4 +171,12 @@ enum UwbVendorCapabilityTlvTypes { * 0 - Feature not supported. */ SUPPORTED_RSSI_REPORTING = 0xE6, + + /** + * 1 byte value to indicate support for diagnostics feature. + * Values: + * 1 - Feature supported. + * 0 - Feature not supported. + */ + SUPPORTED_DIAGNOSTICS = 0xE7, } diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl index f43b249c8f..f303ed92d7 100644 --- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl +++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl @@ -66,4 +66,23 @@ enum UwbVendorSessionAppConfigTlvTypes { NB_OF_AZIMUTH_MEASUREMENTS = 0xE4, /** 1 byte data */ NB_OF_ELEVATION_MEASUREMENTS = 0xE5, + + /** + * Supported only if the UwbVendorCapabilityTlvTypes + * .SUPPORTED_DIAGNOSTICS set to 1. + */ + /** + * 1 byte data + * 1 - Enable, + * 0 - Disable + */ + ENABLE_DIAGNOSTICS = 0xE8, + /** + * 1 byte bitmask + * b0: Activate RSSIs field, + * b1: Activate AoAs field, + * b2: Activate CIRs field, + * b3 - b7: RFU + */ + DIAGRAMS_FRAME_REPORTS_FIELDS = 0xE9, } From 1bc0dc4cebf3a968934d0239a1b17e6cc8c9a7e8 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Fri, 8 Jul 2022 19:54:51 +0000 Subject: [PATCH 133/998] audio VTS: CompressedOffloadOutputStream to check the vendor API level Update CompressedOffloadOutputStream to fail the test if compressed offload mix port does not support gapless offload for a new device launching on T+. Bug: 219767875 Test: atest VtsHalAudioV7_0TargetTest Test: atest VtsHalAudioV7_1TargetTest Change-Id: Iaadf6e9b9bb7340ccaf5bc26c45fda9654190510 --- .../vts/functional/7.0/AudioPrimaryHidlHalTest.cpp | 9 ++++++++- audio/core/all-versions/vts/functional/Android.bp | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp index 44d3cbd14a..05d5c4eebf 100644 --- a/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp +++ b/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp @@ -18,6 +18,7 @@ #include #include +#include #include "Generators.h" @@ -898,10 +899,16 @@ class CompressedOffloadOutputStreamTest : public PcmOnlyConfigOutputStreamTest { TEST_P(CompressedOffloadOutputStreamTest, Mp3FormatGaplessOffload) { doc::test("Check that compressed offload mix ports for MP3 implement gapless offload"); const auto& flags = getOutputFlags(); + const bool isNewDeviceLaunchingOnTPlus = property_get_int32("ro.vendor.api_level", 0) >= 33; if (std::find_if(flags.begin(), flags.end(), [](const auto& flag) { return flag == toString(xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_GAPLESS_OFFLOAD); }) == flags.end()) { - GTEST_SKIP() << "Compressed offload mix port does not support gapless offload"; + if (isNewDeviceLaunchingOnTPlus) { + FAIL() << "New devices launching on Android T+ must support gapless offload, " + << "see VSR-4.3-001"; + } else { + GTEST_SKIP() << "Compressed offload mix port does not support gapless offload"; + } } // FIXME: The presentation position is not updated if there is no zero padding in data. std::vector offloadData(stream->getBufferSize()); diff --git a/audio/core/all-versions/vts/functional/Android.bp b/audio/core/all-versions/vts/functional/Android.bp index 5b0a7f28f9..daed7a8afd 100644 --- a/audio/core/all-versions/vts/functional/Android.bp +++ b/audio/core/all-versions/vts/functional/Android.bp @@ -34,6 +34,7 @@ cc_defaults { ], shared_libs: [ "libbinder", + "libcutils", "libfmq", "libxml2", ], From 6f54348889fe22ff9ffa7957863ef0da221a07fc Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Fri, 1 Jul 2022 18:18:13 -0700 Subject: [PATCH 134/998] Improve reference VHAL library. Fix multiple issues pointed out in code comments. Test: atest DefaultVehicleHalTest Bug: 238350087 Change-Id: I1865e24cc9ea992c9f13174e798b79843adeffb5 --- .../impl/vhal/include/DefaultVehicleHal.h | 18 +-- .../impl/vhal/include/SubscriptionManager.h | 33 +++-- .../aidl/impl/vhal/src/DefaultVehicleHal.cpp | 99 +++++++------- .../impl/vhal/src/SubscriptionManager.cpp | 124 ++++++++---------- .../impl/vhal/test/DefaultVehicleHalTest.cpp | 12 +- .../vhal/test/SubscriptionManagerTest.cpp | 12 +- 6 files changed, 144 insertions(+), 154 deletions(-) diff --git a/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h b/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h index 9c29816faf..0439ac6eac 100644 --- a/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h +++ b/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h @@ -123,10 +123,10 @@ class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehi std::shared_ptr mPendingRequestPool; }; - // A wrapper for binder operations to enable stubbing for test. - class IBinder { + // A wrapper for binder lifecycle operations to enable stubbing for test. + class BinderLifecycleInterface { public: - virtual ~IBinder() = default; + virtual ~BinderLifecycleInterface() = default; virtual binder_status_t linkToDeath(AIBinder* binder, AIBinder_DeathRecipient* recipient, void* cookie) = 0; @@ -134,8 +134,8 @@ class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehi virtual bool isAlive(const AIBinder* binder) = 0; }; - // A real implementation for IBinder. - class AIBinderImpl final : public IBinder { + // A real implementation for BinderLifecycleInterface. + class BinderLifecycleHandler final : public BinderLifecycleInterface { public: binder_status_t linkToDeath(AIBinder* binder, AIBinder_DeathRecipient* recipient, void* cookie) override; @@ -154,7 +154,7 @@ class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehi // BinderDiedUnlinkedEvent represents either an onBinderDied or an onBinderUnlinked event. struct BinderDiedUnlinkedEvent { // true for onBinderDied, false for onBinderUnlinked. - bool onBinderDied; + bool forOnBinderDied; const AIBinder* clientId; }; @@ -186,8 +186,8 @@ class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehi GUARDED_BY(mLock); // SubscriptionClients is thread-safe. std::shared_ptr mSubscriptionClients; - // mBinderImpl is only going to be changed in test. - std::unique_ptr mBinderImpl; + // mBinderLifecycleHandler is only going to be changed in test. + std::unique_ptr mBinderLifecycleHandler; // Only initialized once. std::shared_ptr> mRecurrentAction; @@ -263,7 +263,7 @@ class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehi void setTimeout(int64_t timeoutInNano); // Test-only - void setBinderImpl(std::unique_ptr impl); + void setBinderLifecycleHandler(std::unique_ptr impl); }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/impl/vhal/include/SubscriptionManager.h b/automotive/vehicle/aidl/impl/vhal/include/SubscriptionManager.h index 7c8f1b4672..14799d9f84 100644 --- a/automotive/vehicle/aidl/impl/vhal/include/SubscriptionManager.h +++ b/automotive/vehicle/aidl/impl/vhal/include/SubscriptionManager.h @@ -41,15 +41,15 @@ class ContSubConfigs final { public: using ClientIdType = const AIBinder*; - void addClient(const ClientIdType& clientId, float sampleRate); + void addClient(const ClientIdType& clientId, float sampleRateHz); void removeClient(const ClientIdType& clientId); - float getMaxSampleRate(); + float getMaxSampleRateHz() const; private: - float mMaxSampleRate = 0.; - std::unordered_map mSampleRates; + float mMaxSampleRateHz = 0.; + std::unordered_map mSampleRateHzByClient; - void refreshMaxSampleRate(); + void refreshMaxSampleRateHz(); }; // A thread-safe subscription manager that manages all VHAL subscriptions. @@ -59,7 +59,7 @@ class SubscriptionManager final { using CallbackType = std::shared_ptr; - explicit SubscriptionManager(IVehicleHardware* hardware); + explicit SubscriptionManager(IVehicleHardware* vehicleHardware); ~SubscriptionManager(); // Subscribes to properties according to {@code SubscribeOptions}. Note that all option must @@ -99,13 +99,8 @@ class SubscriptionManager final { const std::vector& updatedValues); - // Gets the sample rate for the continuous property. Returns {@code std::nullopt} if the - // property has not been subscribed before or is not a continuous property. - std::optional getSampleRate(const ClientIdType& clientId, int32_t propId, - int32_t areaId); - // Checks whether the sample rate is valid. - static bool checkSampleRate(float sampleRate); + static bool checkSampleRateHz(float sampleRateHz); private: // Friend class for testing. @@ -122,17 +117,21 @@ class SubscriptionManager final { std::unordered_map mContSubConfigsByPropIdArea GUARDED_BY(mLock); - VhalResult updateSampleRateLocked(const ClientIdType& clientId, - const PropIdAreaId& propIdAreaId, float sampleRate) + VhalResult addContinuousSubscriberLocked(const ClientIdType& clientId, + const PropIdAreaId& propIdAreaId, + float sampleRateHz) REQUIRES(mLock); + VhalResult removeContinuousSubscriberLocked(const ClientIdType& clientId, + const PropIdAreaId& propIdAreaId) REQUIRES(mLock); - VhalResult removeSampleRateLocked(const ClientIdType& clientId, - const PropIdAreaId& propIdAreaId) REQUIRES(mLock); + + VhalResult updateContSubConfigs(const PropIdAreaId& PropIdAreaId, + const ContSubConfigs& newConfig) REQUIRES(mLock); // Checks whether the manager is empty. For testing purpose. bool isEmpty(); // Get the interval in nanoseconds accroding to sample rate. - static android::base::Result getInterval(float sampleRate); + static android::base::Result getIntervalNanos(float sampleRateHz); }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp index 138aad5848..d447bf8cb9 100644 --- a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp +++ b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp @@ -78,14 +78,14 @@ std::string toString(const std::unordered_set& values) { return str; } -float getDefaultSampleRate(float sampleRate, float minSampleRate, float maxSampleRate) { - if (sampleRate < minSampleRate) { - return minSampleRate; +float getDefaultSampleRateHz(float sampleRateHz, float minSampleRateHz, float maxSampleRateHz) { + if (sampleRateHz < minSampleRateHz) { + return minSampleRateHz; } - if (sampleRate > maxSampleRate) { - return maxSampleRate; + if (sampleRateHz > maxSampleRateHz) { + return maxSampleRateHz; } - return sampleRate; + return sampleRateHz; } } // namespace @@ -123,8 +123,8 @@ size_t DefaultVehicleHal::SubscriptionClients::countClients() { return mClients.size(); } -DefaultVehicleHal::DefaultVehicleHal(std::unique_ptr hardware) - : mVehicleHardware(std::move(hardware)), +DefaultVehicleHal::DefaultVehicleHal(std::unique_ptr vehicleHardware) + : mVehicleHardware(std::move(vehicleHardware)), mPendingRequestPool(std::make_shared(TIMEOUT_IN_NANO)) { auto configs = mVehicleHardware->getAllPropertyConfigs(); for (auto& config : configs) { @@ -143,12 +143,11 @@ DefaultVehicleHal::DefaultVehicleHal(std::unique_ptr hardware) mConfigFile = std::move(result.value()); } - mSubscriptionClients = std::make_shared(mPendingRequestPool); mSubscriptionClients = std::make_shared(mPendingRequestPool); auto subscribeIdByClient = std::make_shared(); - IVehicleHardware* hardwarePtr = mVehicleHardware.get(); - mSubscriptionManager = std::make_shared(hardwarePtr); + IVehicleHardware* vehicleHardwarePtr = mVehicleHardware.get(); + mSubscriptionManager = std::make_shared(vehicleHardwarePtr); std::weak_ptr subscriptionManagerCopy = mSubscriptionManager; mVehicleHardware->registerOnPropertyChangeEvent( @@ -158,13 +157,13 @@ DefaultVehicleHal::DefaultVehicleHal(std::unique_ptr hardware) })); // Register heartbeat event. - mRecurrentAction = - std::make_shared>([hardwarePtr, subscriptionManagerCopy]() { - checkHealth(hardwarePtr, subscriptionManagerCopy); + mRecurrentAction = std::make_shared>( + [vehicleHardwarePtr, subscriptionManagerCopy]() { + checkHealth(vehicleHardwarePtr, subscriptionManagerCopy); }); mRecurrentTimer.registerTimerCallback(HEART_BEAT_INTERVAL_IN_NANO, mRecurrentAction); - mBinderImpl = std::make_unique(); + mBinderLifecycleHandler = std::make_unique(); mOnBinderDiedUnlinkedHandlerThread = std::thread([this] { onBinderDiedUnlinkedHandler(); }); mDeathRecipient = ScopedAIBinder_DeathRecipient( AIBinder_DeathRecipient_new(&DefaultVehicleHal::onBinderDied)); @@ -220,7 +219,7 @@ std::shared_ptr DefaultVehicleHal::getOrCreateClient( bool DefaultVehicleHal::monitorBinderLifeCycleLocked(const AIBinder* clientId) { OnBinderDiedContext* contextPtr = nullptr; if (mOnBinderDiedContexts.find(clientId) != mOnBinderDiedContexts.end()) { - return mBinderImpl->isAlive(clientId); + return mBinderLifecycleHandler->isAlive(clientId); } else { std::unique_ptr context = std::make_unique( OnBinderDiedContext{.vhal = this, .clientId = clientId}); @@ -232,7 +231,7 @@ bool DefaultVehicleHal::monitorBinderLifeCycleLocked(const AIBinder* clientId) { } // If this function fails, onBinderUnlinked would be called to remove the added context. - binder_status_t status = mBinderImpl->linkToDeath( + binder_status_t status = mBinderLifecycleHandler->linkToDeath( const_cast(clientId), mDeathRecipient.get(), static_cast(contextPtr)); if (status == STATUS_OK) { return true; @@ -246,7 +245,8 @@ void DefaultVehicleHal::onBinderDied(void* cookie) { OnBinderDiedContext* context = reinterpret_cast(cookie); // To be handled in mOnBinderDiedUnlinkedHandlerThread. We cannot handle the event in the same // thread because we might be holding the mLock the handler requires. - context->vhal->mBinderEvents.push(BinderDiedUnlinkedEvent{true, context->clientId}); + context->vhal->mBinderEvents.push( + BinderDiedUnlinkedEvent{/*forOnBinderDied=*/true, context->clientId}); } void DefaultVehicleHal::onBinderDiedWithContext(const AIBinder* clientId) { @@ -262,7 +262,8 @@ void DefaultVehicleHal::onBinderUnlinked(void* cookie) { OnBinderDiedContext* context = reinterpret_cast(cookie); // To be handled in mOnBinderDiedUnlinkedHandlerThread. We cannot handle the event in the same // thread because we might be holding the mLock the handler requires. - context->vhal->mBinderEvents.push(BinderDiedUnlinkedEvent{false, context->clientId}); + context->vhal->mBinderEvents.push( + BinderDiedUnlinkedEvent{/*forOnBinderDied=*/false, context->clientId}); } void DefaultVehicleHal::onBinderUnlinkedWithContext(const AIBinder* clientId) { @@ -275,7 +276,7 @@ void DefaultVehicleHal::onBinderUnlinkedWithContext(const AIBinder* clientId) { void DefaultVehicleHal::onBinderDiedUnlinkedHandler() { while (mBinderEvents.waitForItems()) { for (BinderDiedUnlinkedEvent& event : mBinderEvents.flush()) { - if (event.onBinderDied) { + if (event.forOnBinderDied) { onBinderDiedWithContext(event.clientId); } else { onBinderUnlinkedWithContext(event.clientId); @@ -349,15 +350,15 @@ Result DefaultVehicleHal::checkProperty(const VehiclePropValue& propValue) ScopedAStatus DefaultVehicleHal::getValues(const CallbackType& callback, const GetValueRequests& requests) { + if (callback == nullptr) { + return ScopedAStatus::fromExceptionCode(EX_NULL_POINTER); + } expected, ScopedAStatus> deserializedResults = fromStableLargeParcelable(requests); if (!deserializedResults.ok()) { ALOGE("getValues: failed to parse getValues requests"); return std::move(deserializedResults.error()); } - if (callback == nullptr) { - return ScopedAStatus::fromExceptionCode(EX_NULL_POINTER); - } const std::vector& getValueRequests = deserializedResults.value().getObject()->payloads; @@ -435,15 +436,15 @@ ScopedAStatus DefaultVehicleHal::getValues(const CallbackType& callback, ScopedAStatus DefaultVehicleHal::setValues(const CallbackType& callback, const SetValueRequests& requests) { + if (callback == nullptr) { + return ScopedAStatus::fromExceptionCode(EX_NULL_POINTER); + } expected, ScopedAStatus> deserializedResults = fromStableLargeParcelable(requests); if (!deserializedResults.ok()) { ALOGE("setValues: failed to parse setValues requests"); return std::move(deserializedResults.error()); } - if (callback == nullptr) { - return ScopedAStatus::fromExceptionCode(EX_NULL_POINTER); - } const std::vector& setValueRequests = deserializedResults.value().getObject()->payloads; @@ -595,18 +596,20 @@ VhalResult DefaultVehicleHal::checkSubscribeOptions( } if (config.changeMode == VehiclePropertyChangeMode::CONTINUOUS) { - float sampleRate = option.sampleRate; - float minSampleRate = config.minSampleRate; - float maxSampleRate = config.maxSampleRate; - if (sampleRate < minSampleRate || sampleRate > maxSampleRate) { - float defaultRate = getDefaultSampleRate(sampleRate, minSampleRate, maxSampleRate); - ALOGW("sample rate: %f out of range, must be within %f and %f, set to %f", - sampleRate, minSampleRate, maxSampleRate, defaultRate); - sampleRate = defaultRate; + float sampleRateHz = option.sampleRate; + float minSampleRateHz = config.minSampleRate; + float maxSampleRateHz = config.maxSampleRate; + float defaultRateHz = + getDefaultSampleRateHz(sampleRateHz, minSampleRateHz, maxSampleRateHz); + if (sampleRateHz != defaultRateHz) { + ALOGW("sample rate: %f HZ out of range, must be within %f HZ and %f HZ , set to %f " + "HZ", + sampleRateHz, minSampleRateHz, maxSampleRateHz, defaultRateHz); + sampleRateHz = defaultRateHz; } - if (!SubscriptionManager::checkSampleRate(sampleRate)) { + if (!SubscriptionManager::checkSampleRateHz(sampleRateHz)) { return StatusError(StatusCode::INVALID_ARG) - << "invalid sample rate: " << sampleRate; + << "invalid sample rate: " << sampleRateHz << " HZ"; } } @@ -631,13 +634,13 @@ ScopedAStatus DefaultVehicleHal::subscribe(const CallbackType& callback, const std::vector& options, [[maybe_unused]] int32_t maxSharedMemoryFileCount) { // TODO(b/205189110): Use shared memory file count. + if (callback == nullptr) { + return ScopedAStatus::fromExceptionCode(EX_NULL_POINTER); + } if (auto result = checkSubscribeOptions(options); !result.ok()) { ALOGE("subscribe: invalid subscribe options: %s", getErrorMsg(result).c_str()); return toScopedAStatus(result); } - if (callback == nullptr) { - return ScopedAStatus::fromExceptionCode(EX_NULL_POINTER); - } std::vector onChangeSubscriptions; std::vector continuousSubscriptions; for (const auto& option : options) { @@ -658,7 +661,7 @@ ScopedAStatus DefaultVehicleHal::subscribe(const CallbackType& callback, } if (config.changeMode == VehiclePropertyChangeMode::CONTINUOUS) { - optionCopy.sampleRate = getDefaultSampleRate( + optionCopy.sampleRate = getDefaultSampleRateHz( optionCopy.sampleRate, config.minSampleRate, config.maxSampleRate); continuousSubscriptions.push_back(std::move(optionCopy)); } else { @@ -740,9 +743,9 @@ VhalResult DefaultVehicleHal::checkReadPermission(const VehiclePropValue& return {}; } -void DefaultVehicleHal::checkHealth(IVehicleHardware* hardware, +void DefaultVehicleHal::checkHealth(IVehicleHardware* vehicleHardware, std::weak_ptr subscriptionManager) { - StatusCode status = hardware->checkHealth(); + StatusCode status = vehicleHardware->checkHealth(); if (status != StatusCode::OK) { ALOGE("VHAL check health returns non-okay status"); return; @@ -757,18 +760,18 @@ void DefaultVehicleHal::checkHealth(IVehicleHardware* hardware, return; } -binder_status_t DefaultVehicleHal::AIBinderImpl::linkToDeath(AIBinder* binder, - AIBinder_DeathRecipient* recipient, - void* cookie) { +binder_status_t DefaultVehicleHal::BinderLifecycleHandler::linkToDeath( + AIBinder* binder, AIBinder_DeathRecipient* recipient, void* cookie) { return AIBinder_linkToDeath(binder, recipient, cookie); } -bool DefaultVehicleHal::AIBinderImpl::isAlive(const AIBinder* binder) { +bool DefaultVehicleHal::BinderLifecycleHandler::isAlive(const AIBinder* binder) { return AIBinder_isAlive(binder); } -void DefaultVehicleHal::setBinderImpl(std::unique_ptr impl) { - mBinderImpl = std::move(impl); +void DefaultVehicleHal::setBinderLifecycleHandler( + std::unique_ptr handler) { + mBinderLifecycleHandler = std::move(handler); } bool DefaultVehicleHal::checkDumpPermission() { diff --git a/automotive/vehicle/aidl/impl/vhal/src/SubscriptionManager.cpp b/automotive/vehicle/aidl/impl/vhal/src/SubscriptionManager.cpp index 26944018df..bba730f6f4 100644 --- a/automotive/vehicle/aidl/impl/vhal/src/SubscriptionManager.cpp +++ b/automotive/vehicle/aidl/impl/vhal/src/SubscriptionManager.cpp @@ -42,7 +42,8 @@ using ::android::base::Result; using ::android::base::StringPrintf; using ::ndk::ScopedAStatus; -SubscriptionManager::SubscriptionManager(IVehicleHardware* hardware) : mVehicleHardware(hardware) {} +SubscriptionManager::SubscriptionManager(IVehicleHardware* vehicleHardware) + : mVehicleHardware(vehicleHardware) {} SubscriptionManager::~SubscriptionManager() { std::scoped_lock lockGuard(mLock); @@ -51,94 +52,82 @@ SubscriptionManager::~SubscriptionManager() { mSubscribedPropsByClient.clear(); } -bool SubscriptionManager::checkSampleRate(float sampleRate) { - return getInterval(sampleRate).ok(); +bool SubscriptionManager::checkSampleRateHz(float sampleRateHz) { + return getIntervalNanos(sampleRateHz).ok(); } -Result SubscriptionManager::getInterval(float sampleRate) { - int64_t interval = 0; - if (sampleRate <= 0) { +Result SubscriptionManager::getIntervalNanos(float sampleRateHz) { + int64_t intervalNanos = 0; + if (sampleRateHz <= 0) { return Error() << "invalid sample rate, must be a positive number"; } - if (sampleRate <= (ONE_SECOND_IN_NANO / static_cast(INT64_MAX))) { - return Error() << "invalid sample rate: " << sampleRate << ", too small"; + if (sampleRateHz <= (ONE_SECOND_IN_NANO / static_cast(INT64_MAX))) { + return Error() << "invalid sample rate: " << sampleRateHz << ", too small"; } - interval = static_cast(ONE_SECOND_IN_NANO / sampleRate); - return interval; + intervalNanos = static_cast(ONE_SECOND_IN_NANO / sampleRateHz); + return intervalNanos; } -void ContSubConfigs::refreshMaxSampleRate() { - float maxSampleRate = 0.; +void ContSubConfigs::refreshMaxSampleRateHz() { + float maxSampleRateHz = 0.; // This is not called frequently so a brute-focre is okay. More efficient way exists but this // is simpler. - for (const auto& [_, sampleRate] : mSampleRates) { - if (sampleRate > maxSampleRate) { - maxSampleRate = sampleRate; + for (const auto& [_, sampleRateHz] : mSampleRateHzByClient) { + if (sampleRateHz > maxSampleRateHz) { + maxSampleRateHz = sampleRateHz; } } - mMaxSampleRate = maxSampleRate; + mMaxSampleRateHz = maxSampleRateHz; } -void ContSubConfigs::addClient(const ClientIdType& clientId, float sampleRate) { - mSampleRates[clientId] = sampleRate; - refreshMaxSampleRate(); +void ContSubConfigs::addClient(const ClientIdType& clientId, float sampleRateHz) { + mSampleRateHzByClient[clientId] = sampleRateHz; + refreshMaxSampleRateHz(); } void ContSubConfigs::removeClient(const ClientIdType& clientId) { - mSampleRates.erase(clientId); - refreshMaxSampleRate(); + mSampleRateHzByClient.erase(clientId); + refreshMaxSampleRateHz(); } -float ContSubConfigs::getMaxSampleRate() { - return mMaxSampleRate; +float ContSubConfigs::getMaxSampleRateHz() const { + return mMaxSampleRateHz; } -VhalResult SubscriptionManager::updateSampleRateLocked(const ClientIdType& clientId, - const PropIdAreaId& propIdAreaId, - float sampleRate) { +VhalResult SubscriptionManager::addContinuousSubscriberLocked( + const ClientIdType& clientId, const PropIdAreaId& propIdAreaId, float sampleRateHz) { // Make a copy so that we don't modify 'mContSubConfigsByPropIdArea' on failure cases. - ContSubConfigs infoCopy = mContSubConfigsByPropIdArea[propIdAreaId]; - infoCopy.addClient(clientId, sampleRate); - if (infoCopy.getMaxSampleRate() == - mContSubConfigsByPropIdArea[propIdAreaId].getMaxSampleRate()) { - mContSubConfigsByPropIdArea[propIdAreaId] = infoCopy; + ContSubConfigs newConfig = mContSubConfigsByPropIdArea[propIdAreaId]; + newConfig.addClient(clientId, sampleRateHz); + return updateContSubConfigs(propIdAreaId, newConfig); +} + +VhalResult SubscriptionManager::removeContinuousSubscriberLocked( + const ClientIdType& clientId, const PropIdAreaId& propIdAreaId) { + // Make a copy so that we don't modify 'mContSubConfigsByPropIdArea' on failure cases. + ContSubConfigs newConfig = mContSubConfigsByPropIdArea[propIdAreaId]; + newConfig.removeClient(clientId); + return updateContSubConfigs(propIdAreaId, newConfig); +} + +VhalResult SubscriptionManager::updateContSubConfigs(const PropIdAreaId& propIdAreaId, + const ContSubConfigs& newConfig) { + if (newConfig.getMaxSampleRateHz() == + mContSubConfigsByPropIdArea[propIdAreaId].getMaxSampleRateHz()) { + mContSubConfigsByPropIdArea[propIdAreaId] = newConfig; return {}; } - float newRate = infoCopy.getMaxSampleRate(); + float newRateHz = newConfig.getMaxSampleRateHz(); int32_t propId = propIdAreaId.propId; int32_t areaId = propIdAreaId.areaId; - if (auto status = mVehicleHardware->updateSampleRate(propId, areaId, newRate); + if (auto status = mVehicleHardware->updateSampleRate(propId, areaId, newRateHz); status != StatusCode::OK) { return StatusError(status) << StringPrintf("failed to update sample rate for prop: %" PRId32 ", area" - ": %" PRId32 ", sample rate: %f", - propId, areaId, newRate); + ": %" PRId32 ", sample rate: %f HZ", + propId, areaId, newRateHz); } - mContSubConfigsByPropIdArea[propIdAreaId] = infoCopy; - return {}; -} - -VhalResult SubscriptionManager::removeSampleRateLocked(const ClientIdType& clientId, - const PropIdAreaId& propIdAreaId) { - // Make a copy so that we don't modify 'mContSubConfigsByPropIdArea' on failure cases. - ContSubConfigs infoCopy = mContSubConfigsByPropIdArea[propIdAreaId]; - infoCopy.removeClient(clientId); - if (infoCopy.getMaxSampleRate() == - mContSubConfigsByPropIdArea[propIdAreaId].getMaxSampleRate()) { - mContSubConfigsByPropIdArea[propIdAreaId] = infoCopy; - return {}; - } - float newRate = infoCopy.getMaxSampleRate(); - int32_t propId = propIdAreaId.propId; - int32_t areaId = propIdAreaId.areaId; - if (auto status = mVehicleHardware->updateSampleRate(propId, areaId, newRate); - status != StatusCode::OK) { - return StatusError(status) << StringPrintf("failed to update sample rate for prop: %" PRId32 - ", area" - ": %" PRId32 ", sample rate: %f", - propId, areaId, newRate); - } - mContSubConfigsByPropIdArea[propIdAreaId] = infoCopy; + mContSubConfigsByPropIdArea[propIdAreaId] = newConfig; return {}; } @@ -147,14 +136,12 @@ VhalResult SubscriptionManager::subscribe(const std::shared_ptr lockGuard(mLock); - std::vector intervals; for (const auto& option : options) { - float sampleRate = option.sampleRate; + float sampleRateHz = option.sampleRate; if (isContinuousProperty) { - auto intervalResult = getInterval(sampleRate); - if (!intervalResult.ok()) { - return StatusError(StatusCode::INVALID_ARG) << intervalResult.error().message(); + if (auto result = getIntervalNanos(sampleRateHz); !result.ok()) { + return StatusError(StatusCode::INVALID_ARG) << result.error().message(); } } @@ -176,7 +163,8 @@ VhalResult SubscriptionManager::subscribe(const std::shared_ptr SubscriptionManager::unsubscribe(SubscriptionManager::ClientIdT while (it != propIdAreaIds.end()) { int32_t propId = it->propId; if (std::find(propIds.begin(), propIds.end(), propId) != propIds.end()) { - if (auto result = removeSampleRateLocked(clientId, *it); !result.ok()) { + if (auto result = removeContinuousSubscriberLocked(clientId, *it); !result.ok()) { return result; } @@ -244,7 +232,7 @@ VhalResult SubscriptionManager::unsubscribe(SubscriptionManager::ClientIdT auto& subscriptions = mSubscribedPropsByClient[clientId]; for (auto const& propIdAreaId : subscriptions) { - if (auto result = removeSampleRateLocked(clientId, propIdAreaId); !result.ok()) { + if (auto result = removeContinuousSubscriberLocked(clientId, propIdAreaId); !result.ok()) { return result; } diff --git a/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp b/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp index f48b906503..36fa5e6349 100644 --- a/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp +++ b/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp @@ -324,9 +324,9 @@ class DefaultVehicleHalTest : public testing::Test { mCallbackClient = IVehicleCallback::fromBinder(mBinder); // Set the linkToDeath to a fake implementation that always returns OK. - auto binderImpl = std::make_unique(); - mBinderImpl = binderImpl.get(); - mVhal->setBinderImpl(std::move(binderImpl)); + auto handler = std::make_unique(); + mBinderLifecycleHandler = handler.get(); + mVhal->setBinderLifecycleHandler(std::move(handler)); } void TearDown() override { @@ -370,7 +370,7 @@ class DefaultVehicleHalTest : public testing::Test { bool hasNoSubscriptions() { return mVhal->mSubscriptionManager->isEmpty(); } - void setBinderAlive(bool isAlive) { mBinderImpl->setAlive(isAlive); }; + void setBinderAlive(bool isAlive) { mBinderLifecycleHandler->setAlive(isAlive); }; static Result getValuesTestCases(size_t size, GetValueRequests& requests, std::vector& expectedResults, @@ -444,7 +444,7 @@ class DefaultVehicleHalTest : public testing::Test { } private: - class TestBinderImpl final : public DefaultVehicleHal::IBinder { + class TestBinderLifecycleHandler final : public DefaultVehicleHal::BinderLifecycleInterface { public: binder_status_t linkToDeath(AIBinder*, AIBinder_DeathRecipient*, void*) override { if (mIsAlive) { @@ -468,7 +468,7 @@ class DefaultVehicleHalTest : public testing::Test { std::shared_ptr mCallback; std::shared_ptr mCallbackClient; SpAIBinder mBinder; - TestBinderImpl* mBinderImpl; + TestBinderLifecycleHandler* mBinderLifecycleHandler; }; TEST_F(DefaultVehicleHalTest, testGetAllPropConfigsSmall) { diff --git a/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp b/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp index 3f593633f9..eb3c663209 100644 --- a/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp +++ b/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp @@ -477,16 +477,16 @@ TEST_F(SubscriptionManagerTest, testUnsubscribeOnchange) { ASSERT_THAT(clients[getCallbackClient()], ElementsAre(&updatedValues[1])); } -TEST_F(SubscriptionManagerTest, testCheckSampleRateValid) { - ASSERT_TRUE(SubscriptionManager::checkSampleRate(1.0)); +TEST_F(SubscriptionManagerTest, testCheckSampleRateHzValid) { + ASSERT_TRUE(SubscriptionManager::checkSampleRateHz(1.0)); } -TEST_F(SubscriptionManagerTest, testCheckSampleRateInvalidTooSmall) { - ASSERT_FALSE(SubscriptionManager::checkSampleRate(FLT_MIN)); +TEST_F(SubscriptionManagerTest, testCheckSampleRateHzInvalidTooSmall) { + ASSERT_FALSE(SubscriptionManager::checkSampleRateHz(FLT_MIN)); } -TEST_F(SubscriptionManagerTest, testCheckSampleRateInvalidZero) { - ASSERT_FALSE(SubscriptionManager::checkSampleRate(0)); +TEST_F(SubscriptionManagerTest, testCheckSampleRateHzInvalidZero) { + ASSERT_FALSE(SubscriptionManager::checkSampleRateHz(0)); } } // namespace vehicle From 9e4ced71f3e21ec7fc5d4d4d3056379f3368ebbb Mon Sep 17 00:00:00 2001 From: Lucas Gates Date: Tue, 12 Jul 2022 21:32:56 +0000 Subject: [PATCH 135/998] Tuner HAL Fix bug allowing only one MediaEvent Currently, our startMediaFilterHandler returns on the first time it successfully creates a MediaEvent. This does not match the intended behavior, which is that all of its current output is read and turned into events, and then cleared. Bug: 238797398 Test: Manually with Cuttlefish and SampleTunerTvInput. Before change, any input type except ES will only create a single MediaEvent. After change, full input will be handled properly. Change-Id: I856385cdf8ebb3a7d3fb0f864085123ec6c172b9 --- tv/tuner/aidl/default/Filter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tv/tuner/aidl/default/Filter.cpp b/tv/tuner/aidl/default/Filter.cpp index 4d48c04c6e..d3c98f2b56 100644 --- a/tv/tuner/aidl/default/Filter.cpp +++ b/tv/tuner/aidl/default/Filter.cpp @@ -900,7 +900,8 @@ void Filter::updateRecordOutput(vector& data) { } result = createMediaFilterEventWithIon(mPesOutput); - if (result.isOk()) { + if (!result.isOk()) { + mFilterOutput.clear(); return result; } } From 9f8a9dd4b067858a7f7bab87c9ccdf50d3a0b55a Mon Sep 17 00:00:00 2001 From: Lucas Gates Date: Tue, 12 Jul 2022 21:53:34 +0000 Subject: [PATCH 136/998] TunerHAL Fix bug in TS Size Read Previously in CL 19152256 the size variables for Pes and Section event reading were made unsigned in order to prevent negative values. However, the conversion from int8_t directly to uint32_t still produces incorrect values. To solve this, the values which are read in are first converted from int8_t to uint8_t before their final conversion. Bug: 238797416 Test: Run on Cuttlefish with TS input, and view logging. Old version should not work with any TS that declares a size containing any byte with value > 0x80. Change-Id: I55bb552bc857fd8acf16729f8cfcb9e147e07e9c --- tv/tuner/aidl/default/Filter.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tv/tuner/aidl/default/Filter.cpp b/tv/tuner/aidl/default/Filter.cpp index 4d48c04c6e..20fe76c21b 100644 --- a/tv/tuner/aidl/default/Filter.cpp +++ b/tv/tuner/aidl/default/Filter.cpp @@ -793,7 +793,8 @@ void Filter::updateRecordOutput(vector& data) { } if (prefix == 0x000001) { // TODO handle mulptiple Pes filters - mPesSizeLeft = (mFilterOutput[i + 8] << 8) | mFilterOutput[i + 9]; + mPesSizeLeft = (static_cast(mFilterOutput[i + 8]) << 8) | + static_cast(mFilterOutput[i + 9]); mPesSizeLeft += 6; if (DEBUG_FILTER) { ALOGD("[Filter] pes data length %d", mPesSizeLeft); @@ -875,7 +876,8 @@ void Filter::updateRecordOutput(vector& data) { } if (prefix == 0x000001) { // TODO handle mulptiple Pes filters - mPesSizeLeft = (mFilterOutput[i + 8] << 8) | mFilterOutput[i + 9]; + mPesSizeLeft = (static_cast(mFilterOutput[i + 8]) << 8) | + static_cast(mFilterOutput[i + 9]); mPesSizeLeft += 6; if (DEBUG_FILTER) { ALOGD("[Filter] pes data length %d", mPesSizeLeft); @@ -973,7 +975,8 @@ bool Filter::writeSectionsAndCreateEvent(vector& data) { if (mSectionSizeLeft == 0) { // Location for sectionSize as defined by Section 2.4.4 // Note that the first 4 bytes skipped are the TsHeader - mSectionSizeLeft = ((data[i + 5] & 0x0f) << 8) | (data[i + 6] & 0xff); + mSectionSizeLeft = ((static_cast(data[i + 5]) & 0x0f) << 8) | + static_cast(data[i + 6]); mSectionSizeLeft += 3; if (DEBUG_FILTER) { ALOGD("[Filter] section data length %d", mSectionSizeLeft); From a0a5d4a9f6e68a1c6babd5c9e6307aa7322c2f89 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Tue, 12 Jul 2022 17:58:43 +0000 Subject: [PATCH 137/998] audio VTS: Update CompressedOffloadOutputStream implementation Do not rely on blocking behavior of 'IStreamOut.write', instead use stream callbacks. Measure the time between write start and drain complete. This makes the test working reliably across different chipsets. Bug: 219767875 Test: atest VtsHalAudioV7_0TargetTest:CompressedOffloadOutputStream/CompressedOffloadOutputStreamTest Test: atest VtsHalAudioV7_1TargetTest:CompressedOffloadOutputStream/CompressedOffloadOutputStreamTest Change-Id: I26fd4fd26914ed2a0b3273f4ae5512a87f9cca2c --- .../7.0/AudioPrimaryHidlHalTest.cpp | 114 ++++++++++++++---- .../vts/functional/AudioPrimaryHidlHalTest.h | 13 +- 2 files changed, 101 insertions(+), 26 deletions(-) diff --git a/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp index 05d5c4eebf..4b76a0b074 100644 --- a/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp +++ b/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp @@ -896,10 +896,49 @@ class CompressedOffloadOutputStreamTest : public PcmOnlyConfigOutputStreamTest { } }; +class OffloadCallbacks : public IStreamOutCallback { + public: + Return onDrainReady() override { + ALOGI("onDrainReady"); + { + std::lock_guard lg(mLock); + mOnDrainReady = true; + } + mCondVar.notify_one(); + return {}; + } + Return onWriteReady() override { return {}; } + Return onError() override { + ALOGW("onError"); + { + std::lock_guard lg(mLock); + mOnError = true; + } + mCondVar.notify_one(); + return {}; + } + bool waitForDrainReadyOrError() { + std::unique_lock l(mLock); + if (!mOnDrainReady && !mOnError) { + mCondVar.wait(l, [&]() { return mOnDrainReady || mOnError; }); + } + const bool success = !mOnError; + mOnDrainReady = mOnError = false; + return success; + } + + private: + std::mutex mLock; + bool mOnDrainReady = false; + bool mOnError = false; + std::condition_variable mCondVar; +}; + TEST_P(CompressedOffloadOutputStreamTest, Mp3FormatGaplessOffload) { doc::test("Check that compressed offload mix ports for MP3 implement gapless offload"); const auto& flags = getOutputFlags(); const bool isNewDeviceLaunchingOnTPlus = property_get_int32("ro.vendor.api_level", 0) >= 33; + // See test instantiation, only offload MP3 mix ports are used. if (std::find_if(flags.begin(), flags.end(), [](const auto& flag) { return flag == toString(xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_GAPLESS_OFFLOAD); }) == flags.end()) { @@ -910,8 +949,7 @@ TEST_P(CompressedOffloadOutputStreamTest, Mp3FormatGaplessOffload) { GTEST_SKIP() << "Compressed offload mix port does not support gapless offload"; } } - // FIXME: The presentation position is not updated if there is no zero padding in data. - std::vector offloadData(stream->getBufferSize()); + std::vector offloadData; ASSERT_NO_FATAL_FAILURE(loadData("/data/local/tmp/sine882hz3s.mp3", &offloadData)); ASSERT_FALSE(offloadData.empty()); ASSERT_NO_FATAL_FAILURE(createPatchIfNeeded()); @@ -921,38 +959,70 @@ TEST_P(CompressedOffloadOutputStreamTest, Mp3FormatGaplessOffload) { const int delay = 576 + 1000; const int padding = 756 + 1000; const int durationMs = 3000 - 44; - // StreamWriter plays 'offloadData' in a loop, possibly using multiple calls to 'write', - // this depends on the relative sizes of 'offloadData' and the HAL buffer. Writer calls - // 'onDataWrap' callback each time it wraps around the buffer. + auto start = std::chrono::steady_clock::now(); + auto callbacks = sp::make(); + std::mutex presentationEndLock; + std::vector presentationEndTimes; + // StreamWriter plays 'offloadData' in a loop, possibly using multiple calls to 'write', this + // depends on the relative sizes of 'offloadData' and the HAL buffer. Writer calls 'onDataStart' + // each time it starts writing the buffer from the beginning, and 'onDataWrap' callback each + // time it wraps around the buffer. StreamWriter writer( - stream.get(), stream->getBufferSize(), std::move(offloadData), [&]() /* onDataWrap */ { - Parameters::set(stream, - {{AUDIO_OFFLOAD_CODEC_DELAY_SAMPLES, std::to_string(delay)}, + stream.get(), stream->getBufferSize(), std::move(offloadData), + [&]() /* onDataStart */ { start = std::chrono::steady_clock::now(); }, + [&]() /* onDataWrap */ { + Return ret(Result::OK); + // Decrease the volume since the test plays a loud sine wave. + ret = stream->setVolume(0.1, 0.1); + if (!ret.isOk() || ret != Result::OK) { + ALOGE("%s: setVolume failed: %s", __func__, toString(ret).c_str()); + return false; + } + ret = Parameters::set( + stream, {{AUDIO_OFFLOAD_CODEC_DELAY_SAMPLES, std::to_string(delay)}, {AUDIO_OFFLOAD_CODEC_PADDING_SAMPLES, std::to_string(padding)}}); - stream->drain(AudioDrain::EARLY_NOTIFY); + if (!ret.isOk() || ret != Result::OK) { + ALOGE("%s: setParameters failed: %s", __func__, toString(ret).c_str()); + return false; + } + ret = stream->drain(AudioDrain::EARLY_NOTIFY); + if (!ret.isOk() || ret != Result::OK) { + ALOGE("%s: drain failed: %s", __func__, toString(ret).c_str()); + return false; + } + // FIXME: On some SoCs intermittent errors are possible, ignore them. + if (callbacks->waitForDrainReadyOrError()) { + const float duration = std::chrono::duration_cast( + std::chrono::steady_clock::now() - start) + .count(); + std::lock_guard lg(presentationEndLock); + presentationEndTimes.push_back(duration); + } + return true; }); + ASSERT_OK(stream->setCallback(callbacks)); ASSERT_TRUE(writer.start()); - ASSERT_TRUE(writer.waitForAtLeastOneCycle()); - // Decrease the volume since the test plays a loud sine wave. - ASSERT_OK(stream->setVolume(0.1, 0.1)); // How many times to loop the track so that the sum of gapless delay and padding from // the first presentation end to the last is at least 'presentationeEndPrecisionMs'. const int playbackNumber = (int)(significantSampleNumber / ((float)delay + padding) + 1); - std::vector presentationEndTimes; - uint64_t previousPosition = std::numeric_limits::max(); - for (int i = 0; i < playbackNumber; ++i) { - const auto start = std::chrono::steady_clock::now(); - ASSERT_NO_FATAL_FAILURE( - waitForPresentationPositionAdvance(writer, &previousPosition, &previousPosition)); - presentationEndTimes.push_back(std::chrono::duration_cast( - std::chrono::steady_clock::now() - start) - .count()); + for (bool done = false; !done;) { + usleep(presentationeEndPrecisionMs * 1000); + { + std::lock_guard lg(presentationEndLock); + done = presentationEndTimes.size() >= playbackNumber; + } + ASSERT_FALSE(writer.hasError()) << "Recent write or drain operation has failed"; } const float avgDuration = std::accumulate(presentationEndTimes.begin(), presentationEndTimes.end(), 0.0) / presentationEndTimes.size(); - EXPECT_NEAR(durationMs, avgDuration, presentationeEndPrecisionMs * 0.1); + std::stringstream observedEndTimes; + std::copy(presentationEndTimes.begin(), presentationEndTimes.end(), + std::ostream_iterator(observedEndTimes, ", ")); + EXPECT_NEAR(durationMs, avgDuration, presentationeEndPrecisionMs * 0.1) + << "Observed durations: " << observedEndTimes.str(); writer.stop(); + EXPECT_OK(stream->clearCallback()); releasePatchIfNeeded(); } diff --git a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h index 6c5584d427..e46e5b4f52 100644 --- a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h +++ b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h @@ -938,12 +938,13 @@ class StreamWriter : public StreamWorker { StreamWriter(IStreamOut* stream, size_t bufferSize) : mStream(stream), mBufferSize(bufferSize), mData(mBufferSize) {} StreamWriter(IStreamOut* stream, size_t bufferSize, std::vector&& data, - std::function onDataWrap) + std::function onDataStart, std::function onDataWrap) : mStream(stream), mBufferSize(bufferSize), mData(std::move(data)), + mOnDataStart(onDataStart), mOnDataWrap(onDataWrap) { - ALOGW("StreamWriter data size: %d", (int)mData.size()); + ALOGI("StreamWriter data size: %d", (int)mData.size()); } ~StreamWriter() { stop(); @@ -1010,6 +1011,7 @@ class StreamWriter : public StreamWorker { ALOGE("command message queue write failed"); return false; } + if (mDataPosition == 0) mOnDataStart(); const size_t dataSize = std::min(mData.size() - mDataPosition, mDataMQ->availableToWrite()); bool success = mDataMQ->write(mData.data() + mDataPosition, dataSize); ALOGE_IF(!success, "data message queue write failed"); @@ -1040,7 +1042,9 @@ class StreamWriter : public StreamWorker { ALOGE("bad wait status: %d", ret); success = false; } - if (success && mDataPosition == 0) mOnDataWrap(); + if (success && mDataPosition == 0) { + success = mOnDataWrap(); + } return success; } @@ -1048,7 +1052,8 @@ class StreamWriter : public StreamWorker { IStreamOut* const mStream; const size_t mBufferSize; std::vector mData; - std::function mOnDataWrap = []() {}; + std::function mOnDataStart = []() {}; + std::function mOnDataWrap = []() { return true; }; size_t mDataPosition = 0; std::unique_ptr mCommandMQ; std::unique_ptr mDataMQ; From acbc2ee4833c2bb2c73ea6b8f497d31829e42a1e Mon Sep 17 00:00:00 2001 From: Keith Mok Date: Tue, 12 Jul 2022 18:01:37 +0000 Subject: [PATCH 138/998] libnl++: Fix alignment problem The memory alignemnt calculation is incorrect when adding request with uint8_t data type. Bug: 238756438 Test: Build, manual test Change-Id: I4dae7ad337c6b8186e4ef0ae1fb5eb1e1463447d --- automotive/can/1.0/default/libnl++/MessageFactory.cpp | 4 ++-- .../can/1.0/default/libnl++/include/libnl++/bits.h | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/automotive/can/1.0/default/libnl++/MessageFactory.cpp b/automotive/can/1.0/default/libnl++/MessageFactory.cpp index 6f35897e32..eff068ebea 100644 --- a/automotive/can/1.0/default/libnl++/MessageFactory.cpp +++ b/automotive/can/1.0/default/libnl++/MessageFactory.cpp @@ -27,8 +27,8 @@ static nlattr* tail(nlmsghdr* msg) { nlattr* MessageFactoryBase::add(nlmsghdr* msg, size_t maxLen, nlattrtype_t type, const void* data, size_t dataLen) { - const auto totalAttrLen = impl::space(dataLen); - const auto newLen = impl::align(msg->nlmsg_len) + totalAttrLen; + const auto totalAttrLen = impl::length(dataLen); + const auto newLen = impl::align(msg->nlmsg_len) + impl::align(totalAttrLen); if (newLen > maxLen) { LOG(ERROR) << "Can't add attribute of size " << dataLen // << " - exceeded maxLen: " << newLen << " > " << maxLen; diff --git a/automotive/can/1.0/default/libnl++/include/libnl++/bits.h b/automotive/can/1.0/default/libnl++/include/libnl++/bits.h index 4c8f1aa9a1..b6573b3284 100644 --- a/automotive/can/1.0/default/libnl++/include/libnl++/bits.h +++ b/automotive/can/1.0/default/libnl++/include/libnl++/bits.h @@ -35,12 +35,20 @@ constexpr size_t align(size_t len) { return (len + alignto - 1) & ~(alignto - 1); } +/** + * Equivalent to NLMSG_LENGTH(len). + */ +template +constexpr size_t length(size_t len) { + return align(sizeof(H)) + len; +} + /** * Equivalent to NLMSG_SPACE(len). */ template constexpr size_t space(size_t len) { - return align(align(sizeof(H)) + len); + return align(length(len)); } /** From 6355aa9072997caad87b2e779e7fb055b0d96b1a Mon Sep 17 00:00:00 2001 From: Keith Mok Date: Tue, 12 Jul 2022 21:03:18 +0000 Subject: [PATCH 139/998] libnl++: add new func to send raw data with len Some netlink attrib does not ending with null char. Currently req.add string will always sending ending null character. Add a new func called addBuffer that does not send ending null character. Bug: 238794143 Test: build, manual test Change-Id: If51380cab95b2ae725673301b429b9e9889c5b0a --- automotive/can/1.0/default/libnetdevice/can.cpp | 2 +- .../1.0/default/libnetdevice/libnetdevice.cpp | 2 +- .../can/1.0/default/libnetdevice/vlan.cpp | 2 +- .../libnl++/include/libnl++/MessageFactory.h | 17 ++++++++++++----- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/automotive/can/1.0/default/libnetdevice/can.cpp b/automotive/can/1.0/default/libnetdevice/can.cpp index 083f4f0028..2a0545ac8f 100644 --- a/automotive/can/1.0/default/libnetdevice/can.cpp +++ b/automotive/can/1.0/default/libnetdevice/can.cpp @@ -80,7 +80,7 @@ bool setBitrate(std::string ifname, uint32_t bitrate) { { auto linkinfo = req.addNested(IFLA_LINKINFO); - req.add(IFLA_INFO_KIND, "can"); + req.addBuffer(IFLA_INFO_KIND, "can"); { auto infodata = req.addNested(IFLA_INFO_DATA); /* For CAN FD, it would require to add IFLA_CAN_DATA_BITTIMING diff --git a/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp b/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp index 4c5b30928f..2d3b41747f 100644 --- a/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp +++ b/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp @@ -60,7 +60,7 @@ bool add(std::string dev, std::string type) { { auto linkinfo = req.addNested(IFLA_LINKINFO); - req.add(IFLA_INFO_KIND, type); + req.addBuffer(IFLA_INFO_KIND, type); } nl::Socket sock(NETLINK_ROUTE); diff --git a/automotive/can/1.0/default/libnetdevice/vlan.cpp b/automotive/can/1.0/default/libnetdevice/vlan.cpp index ee02f7b58a..35b21b8346 100644 --- a/automotive/can/1.0/default/libnetdevice/vlan.cpp +++ b/automotive/can/1.0/default/libnetdevice/vlan.cpp @@ -40,7 +40,7 @@ bool add(const std::string& eth, const std::string& vlan, uint16_t id) { { auto linkinfo = req.addNested(IFLA_LINKINFO); - req.add(IFLA_INFO_KIND, "vlan"); + req.addBuffer(IFLA_INFO_KIND, "vlan"); { auto linkinfo = req.addNested(IFLA_INFO_DATA); diff --git a/automotive/can/1.0/default/libnl++/include/libnl++/MessageFactory.h b/automotive/can/1.0/default/libnl++/include/libnl++/MessageFactory.h index c3d72c54e2..a5a425e0b2 100644 --- a/automotive/can/1.0/default/libnl++/include/libnl++/MessageFactory.h +++ b/automotive/can/1.0/default/libnl++/include/libnl++/MessageFactory.h @@ -106,18 +106,25 @@ class MessageFactory : private MessageFactoryBase { */ template void add(nlattrtype_t type, const A& attr) { - add(type, &attr, sizeof(attr)); + addInternal(type, &attr, sizeof(attr)); } + // It will always send the last null character, otherwise use addBuffer + // variant instead template <> void add(nlattrtype_t type, const std::string& s) { - add(type, s.c_str(), s.size() + 1); + addInternal(type, s.c_str(), s.size() + 1); + } + + void addBuffer(nlattrtype_t type, const std::string_view& s) { + addInternal(type, s.data(), s.size()); } /** Guard class to frame nested attributes. \see addNested(nlattrtype_t). */ class [[nodiscard]] NestedGuard { public: - NestedGuard(MessageFactory & req, nlattrtype_t type) : mReq(req), mAttr(req.add(type)) {} + NestedGuard(MessageFactory& req, nlattrtype_t type) + : mReq(req), mAttr(req.addInternal(type)) {} ~NestedGuard() { closeNested(&mReq.mMessage.header, mAttr); } private: @@ -138,7 +145,7 @@ class MessageFactory : private MessageFactoryBase { * MessageFactory req(RTM_NEWLINK, NLM_F_REQUEST); * { * auto linkinfo = req.addNested(IFLA_LINKINFO); - * req.add(IFLA_INFO_KIND, "can"); + * req.addBuffer(IFLA_INFO_KIND, "can"); * { * auto infodata = req.addNested(IFLA_INFO_DATA); * req.add(IFLA_CAN_BITTIMING, bitTimingStruct); @@ -154,7 +161,7 @@ class MessageFactory : private MessageFactoryBase { Message mMessage = {}; bool mIsGood = true; - nlattr* add(nlattrtype_t type, const void* data = nullptr, size_t len = 0) { + nlattr* addInternal(nlattrtype_t type, const void* data = nullptr, size_t len = 0) { if (!mIsGood) return nullptr; auto attr = MessageFactoryBase::add(&mMessage.header, sizeof(mMessage), type, data, len); if (attr == nullptr) mIsGood = false; From de9709a03e68e2756ea5a8f2399044578311bd0a Mon Sep 17 00:00:00 2001 From: Lucas Gates Date: Wed, 13 Jul 2022 00:35:47 +0000 Subject: [PATCH 140/998] TunerHAL Handle PES Header in MediaFilterHandler As according to the ISO/IEC 13818-1 specification, media data in TransportStreams comes in PES packets which are made up of TS packets. Currently, the MediaFilterHandler strips out TS Headers, but leaves the PES headers in with the Media data. This CL has the MediaFilterHandler process and remove the PES Header from the Media data, while saving the Presentation Time Stamp if it exists. Bug: 238889790 Test: Manually using Cuttlefish and SampleTunerTIS to receive events. Also tested on the VTS. Change-Id: Idd4fe06f15f5420afd0c473128d8b30f5ca779c6 --- tv/tuner/aidl/default/Filter.cpp | 41 ++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/tv/tuner/aidl/default/Filter.cpp b/tv/tuner/aidl/default/Filter.cpp index 3b9ca43b12..ade265ca26 100644 --- a/tv/tuner/aidl/default/Filter.cpp +++ b/tv/tuner/aidl/default/Filter.cpp @@ -853,11 +853,17 @@ void Filter::updateRecordOutput(vector& data) { return ::ndk::ScopedAStatus::ok(); } +// Read PES (Packetized Elementary Stream) Packets from TransportStreams +// as defined in ISO/IEC 13818-1 Section 2.4.3.6. Create MediaEvents +// containing only their data without TS or PES headers. ::ndk::ScopedAStatus Filter::startMediaFilterHandler() { if (mFilterOutput.empty()) { return ::ndk::ScopedAStatus::ok(); } + // mPts being set before our MediaFilterHandler begins indicates that all + // metadata has already been handled. We can therefore create an event + // with the existing data. This method is used when processing ES files. ::ndk::ScopedAStatus result; if (mPts) { result = createMediaFilterEventWithIon(mFilterOutput); @@ -868,17 +874,38 @@ void Filter::updateRecordOutput(vector& data) { } for (int i = 0; i < mFilterOutput.size(); i += 188) { + // Every packet has a 4 Byte TS Header preceding it + uint32_t headerSize = 4; + if (mPesSizeLeft == 0) { - uint32_t prefix = (mFilterOutput[i + 4] << 16) | (mFilterOutput[i + 5] << 8) | - mFilterOutput[i + 6]; + // Packet Start Code Prefix is defined as the first 3 bytes of + // the PES Header and should always have the value 0x000001 + uint32_t prefix = (static_cast(mFilterOutput[i + 4]) << 16) | + (static_cast(mFilterOutput[i + 5]) << 8) | + static_cast(mFilterOutput[i + 6]); if (DEBUG_FILTER) { ALOGD("[Filter] prefix %d", prefix); } if (prefix == 0x000001) { - // TODO handle mulptiple Pes filters + // TODO handle multiple Pes filters + // Location of PES fields from ISO/IEC 13818-1 Section 2.4.3.6 mPesSizeLeft = (static_cast(mFilterOutput[i + 8]) << 8) | static_cast(mFilterOutput[i + 9]); - mPesSizeLeft += 6; + bool hasPts = static_cast(mFilterOutput[i + 11]) & 0x80; + uint8_t optionalFieldsLength = static_cast(mFilterOutput[i + 12]); + headerSize += 9 + optionalFieldsLength; + + if (hasPts) { + // Pts is a 33-bit field which is stored across 5 bytes, with + // bits in between as reserved fields which must be ignored + mPts = 0; + mPts |= (static_cast(mFilterOutput[i + 13]) & 0x0e) << 29; + mPts |= (static_cast(mFilterOutput[i + 14]) & 0xff) << 22; + mPts |= (static_cast(mFilterOutput[i + 15]) & 0xfe) << 14; + mPts |= (static_cast(mFilterOutput[i + 16]) & 0xff) << 7; + mPts |= (static_cast(mFilterOutput[i + 17]) & 0xfe) >> 1; + } + if (DEBUG_FILTER) { ALOGD("[Filter] pes data length %d", mPesSizeLeft); } @@ -887,10 +914,10 @@ void Filter::updateRecordOutput(vector& data) { } } - uint32_t endPoint = min(184u, mPesSizeLeft); + uint32_t endPoint = min(188u - headerSize, mPesSizeLeft); // append data and check size - vector::const_iterator first = mFilterOutput.begin() + i + 4; - vector::const_iterator last = mFilterOutput.begin() + i + 4 + endPoint; + vector::const_iterator first = mFilterOutput.begin() + i + headerSize; + vector::const_iterator last = mFilterOutput.begin() + i + headerSize + endPoint; mPesOutput.insert(mPesOutput.end(), first, last); // size does not match then continue mPesSizeLeft -= endPoint; From 7b7f6661b6048aa0833c5ce384b3758d51e458c4 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Thu, 14 Jul 2022 00:32:15 +0000 Subject: [PATCH 141/998] Fix a bug for generating enum script. We were previously checking "/**" as the start of a comment, however some properties was using "/*" which causes the script to generate wrong enums. This CL fixes this issue. Test: Local run. Bug: 238944990 Change-Id: I56c350663fdde15a405b11fd108df0c7b1f4eb3a --- .../vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h | 2 +- .../aidl/generated_lib/java/AccessForVehicleProperty.java | 2 +- automotive/vehicle/tools/generate_annotation_enums.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 4d37cd3520..14a694d565 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -77,7 +77,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::IGNITION_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::ABS_ACTIVE, VehiclePropertyAccess::READ}, {VehicleProperty::TRACTION_CONTROL_ACTIVE, VehiclePropertyAccess::READ}, - {VehicleProperty::HVAC_FAN_SPEED, VehiclePropertyAccess::READ}, + {VehicleProperty::HVAC_FAN_SPEED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HVAC_FAN_DIRECTION, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HVAC_TEMPERATURE_CURRENT, VehiclePropertyAccess::READ}, {VehicleProperty::HVAC_TEMPERATURE_SET, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index fdf6c64afe..0a17ba196d 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -69,7 +69,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.IGNITION_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.ABS_ACTIVE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.TRACTION_CONTROL_ACTIVE, VehiclePropertyAccess.READ), - Map.entry(VehicleProperty.HVAC_FAN_SPEED, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HVAC_FAN_SPEED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HVAC_FAN_DIRECTION, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HVAC_TEMPERATURE_CURRENT, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.HVAC_TEMPERATURE_SET, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/tools/generate_annotation_enums.py b/automotive/vehicle/tools/generate_annotation_enums.py index 154fe658db..fc6f157283 100644 --- a/automotive/vehicle/tools/generate_annotation_enums.py +++ b/automotive/vehicle/tools/generate_annotation_enums.py @@ -41,7 +41,7 @@ ACCESS_JAVA_FILE_PATH = ("hardware/interfaces/automotive/vehicle/aidl/generated_ TAB = " " RE_ENUM_START = re.compile("\s*enum VehicleProperty \{") RE_ENUM_END = re.compile("\s*\}\;") -RE_COMMENT_BEGIN = re.compile("\s*\/\*\*") +RE_COMMENT_BEGIN = re.compile("\s*\/\*\*?") RE_COMMENT_END = re.compile("\s*\*\/") RE_CHANGE_MODE = re.compile("\s*\* @change_mode (\S+)\s*") RE_ACCESS = re.compile("\s*\* @access (\S+)\s*") From 22ec893a66dcf415cf26b37c43f1d325612a876f Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 13 Jul 2022 01:21:31 +0000 Subject: [PATCH 142/998] Define JSON property config file for VHAL. Define JSON-style property config files for reference VHAL. The VHAL is converted from DefaultConfig.h using a one-off script and some manual tweaking. We will add tests to make sure the JSON file is consistent with DefaultConfig.h. Test: None, will add test once we complete the parser. Bug: 238685398 Change-Id: Ifdd41da591e8c352326a247f65a59cda36b76981 --- .../impl/default_config/config/Android.bp | 14 + .../config/DefaultProperties.json | 1345 +++++++++++++++++ .../default_config/config/TestProperties.json | 204 +++ .../config/VendorClusterTestProperties.json | 63 + 4 files changed, 1626 insertions(+) create mode 100644 automotive/vehicle/aidl/impl/default_config/config/Android.bp create mode 100644 automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json create mode 100644 automotive/vehicle/aidl/impl/default_config/config/TestProperties.json create mode 100644 automotive/vehicle/aidl/impl/default_config/config/VendorClusterTestProperties.json diff --git a/automotive/vehicle/aidl/impl/default_config/config/Android.bp b/automotive/vehicle/aidl/impl/default_config/config/Android.bp new file mode 100644 index 0000000000..3f9edca833 --- /dev/null +++ b/automotive/vehicle/aidl/impl/default_config/config/Android.bp @@ -0,0 +1,14 @@ +filegroup { + name: "VehicleHalDefaultProperties_JSON", + srcs: ["DefaultProperties.json"], +} + +filegroup { + name: "VehicleHalTestProperties_JSON", + srcs: ["TestProperties.json"], +} + +filegroup { + name: "VehicleHalVendorClusterTestProperties_JSON", + srcs: ["VendorClusterTestProperties.json"], +} diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json new file mode 100644 index 0000000000..491524f831 --- /dev/null +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -0,0 +1,1345 @@ +{ + "apiVersion": 1, + "properties": [ + { + "property": "VehicleProperty::INFO_FUEL_CAPACITY", + "defaultValue": { + "floatValues": [ + 15000.0 + ] + } + }, + { + "property": "VehicleProperty::INFO_FUEL_TYPE", + "defaultValue": { + "int32Values": [ + "FuelType::FUEL_TYPE_UNLEADED" + ] + } + }, + { + "property": "VehicleProperty::INFO_EV_BATTERY_CAPACITY", + "defaultValue": { + "floatValues": [ + 150000.0 + ] + } + }, + { + "property": "VehicleProperty::INFO_EV_CONNECTOR_TYPE", + "defaultValue": { + "int32Values": [ + "EvConnectorType::IEC_TYPE_1_AC" + ] + } + }, + { + "property": "VehicleProperty::INFO_FUEL_DOOR_LOCATION", + "defaultValue": { + "int32Values": [ + "Constants::FUEL_DOOR_REAR_LEFT" + ] + } + }, + { + "property": "VehicleProperty::INFO_EV_PORT_LOCATION", + "defaultValue": { + "int32Values": [ + "Constants::CHARGE_PORT_FRONT_LEFT" + ] + } + }, + { + "property": "VehicleProperty::INFO_MULTI_EV_PORT_LOCATIONS", + "defaultValue": { + "int32Values": [ + "Constants::CHARGE_PORT_FRONT_LEFT", + "Constants::CHARGE_PORT_REAR_LEFT" + ] + } + }, + { + "property": "VehicleProperty::INFO_MAKE", + "defaultValue": { + "stringValue": "Toy Vehicle" + } + }, + { + "property": "VehicleProperty::INFO_MODEL", + "defaultValue": { + "stringValue": "Speedy Model" + } + }, + { + "property": "VehicleProperty::INFO_MODEL_YEAR", + "defaultValue": { + "int32Values": [ + 2020 + ] + } + }, + { + "property": "VehicleProperty::INFO_EXTERIOR_DIMENSIONS", + "defaultValue": { + "int32Values": [ + 1776, + 4950, + 2008, + 2140, + 2984, + 1665, + 1667, + 11800 + ] + } + }, + { + "property": "VehicleProperty::PERF_VEHICLE_SPEED", + "defaultValue": { + "floatValues": [ + 0.0 + ] + }, + "maxSampleRate": 10.0, + "minSampleRate": 1.0 + }, + { + "property": "VehicleProperty::VEHICLE_SPEED_DISPLAY_UNITS", + "defaultValue": { + "int32Values": [ + "VehicleUnit::KILOMETERS_PER_HOUR" + ] + }, + "configArray": [ + "VehicleUnit::METER_PER_SEC", + "VehicleUnit::MILES_PER_HOUR", + "VehicleUnit::KILOMETERS_PER_HOUR" + ] + }, + { + "property": "VehicleProperty::EV_BATTERY_DISPLAY_UNITS", + "defaultValue": { + "int32Values": [ + "VehicleUnit::KILOWATT_HOUR" + ] + }, + "configArray": [ + "VehicleUnit::WATT_HOUR", + "VehicleUnit::AMPERE_HOURS", + "VehicleUnit::KILOWATT_HOUR" + ] + }, + { + "property": "VehicleProperty::SEAT_OCCUPANCY", + "areas": [ + { + "defaultValue": { + "int32Values": [ + "VehicleSeatOccupancyState::VACANT" + ] + }, + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "defaultValue": { + "int32Values": [ + "VehicleSeatOccupancyState::VACANT" + ] + }, + "areaId": "Constants::SEAT_1_RIGHT" + } + ] + }, + { + "property": "VehicleProperty::INFO_DRIVER_SEAT", + "defaultValue": { + "int32Values": [ + "Constants::SEAT_1_LEFT" + ] + }, + "areas": [ + { + "areaId": 0 + } + ] + }, + { + "property": "VehicleProperty::PERF_ODOMETER", + "defaultValue": { + "floatValues": [ + 0.0 + ] + }, + "maxSampleRate": 10.0, + "minSampleRate": 1.0 + }, + { + "property": "VehicleProperty::PERF_STEERING_ANGLE", + "defaultValue": { + "floatValues": [ + 0.0 + ] + }, + "maxSampleRate": 10.0, + "minSampleRate": 1.0 + }, + { + "property": "VehicleProperty::PERF_REAR_STEERING_ANGLE", + "defaultValue": { + "floatValues": [ + 0.0 + ] + }, + "maxSampleRate": 10.0, + "minSampleRate": 1.0 + }, + { + "property": "VehicleProperty::ENGINE_RPM", + "defaultValue": { + "floatValues": [ + 0.0 + ] + }, + "maxSampleRate": 10.0, + "minSampleRate": 1.0 + }, + { + "property": "VehicleProperty::FUEL_LEVEL", + "defaultValue": { + "floatValues": [ + 15000.0 + ] + }, + "maxSampleRate": 100.0, + "minSampleRate": 1.0 + }, + { + "property": "VehicleProperty::FUEL_DOOR_OPEN", + "defaultValue": { + "int32Values": [ + 0 + ] + } + }, + { + "property": "VehicleProperty::EV_BATTERY_LEVEL", + "defaultValue": { + "floatValues": [ + 150000.0 + ] + }, + "maxSampleRate": 100.0, + "minSampleRate": 1.0 + }, + { + "property": "VehicleProperty::EV_CHARGE_PORT_OPEN", + "defaultValue": { + "int32Values": [ + 0 + ] + } + }, + { + "property": "VehicleProperty::EV_CHARGE_PORT_CONNECTED", + "defaultValue": { + "int32Values": [ + 0 + ] + } + }, + { + "property": "VehicleProperty::EV_BATTERY_INSTANTANEOUS_CHARGE_RATE", + "defaultValue": { + "floatValues": [ + 0.0 + ] + }, + "maxSampleRate": 10.0, + "minSampleRate": 1.0 + }, + { + "property": "VehicleProperty::EV_CHARGE_CURRENT_DRAW_LIMIT", + "defaultValue": { + "floatValues": [ + 12.5 + ] + }, + "comment": "ConfigArray specifies Max current draw allowed by vehicle in amperes", + "configArray": [ + 20 + ] + }, + { + "property": "VehicleProperty::EV_CHARGE_PERCENT_LIMIT", + "defaultValue": { + "floatValues": [ + 40.0 + ] + }, + "configArray": [ + 20, + 40, + 60, + 80, + 100 + ] + }, + { + "property": "VehicleProperty::EV_CHARGE_STATE", + "defaultValue": { + "int32Values": [ + 2 + ] + } + }, + { + "property": "VehicleProperty::EV_CHARGE_SWITCH", + "defaultValue": { + "int32Values": [ + 0 + ] + } + }, + { + "property": "VehicleProperty::EV_CHARGE_TIME_REMAINING", + "defaultValue": { + "int32Values": [ + 20 + ] + }, + "maxSampleRate": 10.0, + "minSampleRate": 1.0 + }, + { + "property": "VehicleProperty::EV_REGENERATIVE_BRAKING_STATE", + "defaultValue": { + "int32Values": [ + 2 + ] + } + }, + { + "property": "VehicleProperty::TRAILER_PRESENT", + "defaultValue": { + "int32Values": [ + 2 + ] + } + }, + { + "property": "VehicleProperty::VEHICLE_CURB_WEIGHT", + "defaultValue": { + "int32Values": [ + 30 + ] + } + }, + { + "property": "VehicleProperty::RANGE_REMAINING", + "defaultValue": { + "floatValues": [ + 50000.0 + ] + }, + "comment": "units in meter", + "maxSampleRate": 2.0, + "minSampleRate": 1.0 + }, + { + "property": "VehicleProperty::TIRE_PRESSURE", + "defaultValue": { + "floatValues": [ + 200.0 + ] + }, + "areas": [ + { + "areaId": "Constants::WHEEL_FRONT_LEFT", + "minFloatValue": 193.0, + "maxFloatValue": 300.0 + }, + { + "areaId": "Constants::WHEEL_FRONT_RIGHT", + "minFloatValue": 193.0, + "maxFloatValue": 300.0 + }, + { + "areaId": "Constants::WHEEL_REAR_LEFT", + "minFloatValue": 193.0, + "maxFloatValue": 300.0 + }, + { + "areaId": "Constants::WHEEL_REAR_RIGHT", + "minFloatValue": 193.0, + "maxFloatValue": 300.0 + } + ], + "comment": "Units in kpa", + "maxSampleRate": 2.0, + "minSampleRate": 1.0 + }, + { + "property": "VehicleProperty::CRITICALLY_LOW_TIRE_PRESSURE", + "areas": [ + { + "defaultValue": { + "floatValues": [ + 137.0 + ] + }, + "areaId": "Constants::WHEEL_FRONT_LEFT" + }, + { + "defaultValue": { + "floatValues": [ + 137.0 + ] + }, + "areaId": "Constants::WHEEL_FRONT_RIGHT" + }, + { + "defaultValue": { + "floatValues": [ + 137.0 + ] + }, + "areaId": "Constants::WHEEL_REAR_RIGHT" + }, + { + "defaultValue": { + "floatValues": [ + 137.0 + ] + }, + "areaId": "Constants::WHEEL_REAR_LEFT" + } + ] + }, + { + "property": "VehicleProperty::TIRE_PRESSURE_DISPLAY_UNITS", + "defaultValue": { + "int32Values": [ + "VehicleUnit::PSI" + ] + }, + "configArray": [ + "VehicleUnit::KILOPASCAL", + "VehicleUnit::PSI", + "VehicleUnit::BAR" + ] + }, + { + "property": "VehicleProperty::CURRENT_GEAR", + "defaultValue": { + "int32Values": [ + "VehicleGear::GEAR_PARK" + ] + }, + "configArray": [ + "VehicleGear::GEAR_PARK", + "VehicleGear::GEAR_NEUTRAL", + "VehicleGear::GEAR_REVERSE", + "VehicleGear::GEAR_1", + "VehicleGear::GEAR_2", + "VehicleGear::GEAR_3", + "VehicleGear::GEAR_4", + "VehicleGear::GEAR_5" + ] + }, + { + "property": "VehicleProperty::PARKING_BRAKE_ON", + "defaultValue": { + "int32Values": [ + 1 + ] + } + }, + { + "property": "VehicleProperty::PARKING_BRAKE_AUTO_APPLY", + "defaultValue": { + "int32Values": [ + 1 + ] + } + }, + { + "property": "VehicleProperty::FUEL_LEVEL_LOW", + "defaultValue": { + "int32Values": [ + 0 + ] + } + }, + { + "property": "VehicleProperty::FUEL_VOLUME_DISPLAY_UNITS", + "defaultValue": { + "int32Values": [ + "VehicleUnit::LITER" + ] + }, + "configArray": [ + "VehicleUnit::LITER", + "VehicleUnit::US_GALLON" + ] + }, + { + "property": "VehicleProperty::HW_KEY_INPUT", + "defaultValue": { + "int32Values": [ + 0, + 0, + 0 + ] + } + }, + { + "property": "VehicleProperty::HW_ROTARY_INPUT", + "defaultValue": { + "int32Values": [ + 0, + 0, + 0 + ] + } + }, + { + "property": "VehicleProperty::HW_CUSTOM_INPUT", + "defaultValue": { + "int32Values": [ + 0, + 0, + 0 + ] + }, + "configArray": [ + 0, + 0, + 0, + 3, + 0, + 0, + 0, + 0, + 0 + ] + }, + { + "property": "VehicleProperty::HVAC_POWER_ON", + "defaultValue": { + "int32Values": [ + 1 + ] + }, + "areas": [ + { + "areaId": "Constants::HVAC_ALL" + } + ], + "configArray": [ + "VehicleProperty::HVAC_FAN_SPEED", + "VehicleProperty::HVAC_FAN_DIRECTION" + ] + }, + { + "property": "VehicleProperty::HVAC_DEFROSTER", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "VehicleAreaWindow::FRONT_WINDSHIELD" + }, + { + "areaId": "VehicleAreaWindow::REAR_WINDSHIELD" + } + ], + "comment": "0 means using for all areas" + }, + { + "property": "VehicleProperty::HVAC_ELECTRIC_DEFROSTER_ON", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "VehicleAreaWindow::FRONT_WINDSHIELD" + }, + { + "areaId": "VehicleAreaWindow::REAR_WINDSHIELD" + } + ], + "comment": "0 means using for all areas" + }, + { + "property": "VehicleProperty::HVAC_MAX_DEFROST_ON", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::HVAC_ALL" + } + ] + }, + { + "property": "VehicleProperty::HVAC_RECIRC_ON", + "defaultValue": { + "int32Values": [ + 1 + ] + }, + "areas": [ + { + "areaId": "Constants::HVAC_ALL" + } + ] + }, + { + "property": "VehicleProperty::HVAC_AUTO_RECIRC_ON", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::HVAC_ALL" + } + ] + }, + { + "property": "VehicleProperty::HVAC_AC_ON", + "defaultValue": { + "int32Values": [ + 1 + ] + }, + "areas": [ + { + "areaId": "Constants::HVAC_ALL" + } + ] + }, + { + "property": "VehicleProperty::HVAC_MAX_AC_ON", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::HVAC_ALL" + } + ] + }, + { + "property": "VehicleProperty::HVAC_AUTO_ON", + "defaultValue": { + "int32Values": [ + 1 + ] + }, + "areas": [ + { + "areaId": "Constants::HVAC_ALL" + } + ] + }, + { + "property": "VehicleProperty::HVAC_DUAL_ON", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::HVAC_ALL" + } + ] + }, + { + "property": "VehicleProperty::HVAC_FAN_SPEED", + "defaultValue": { + "int32Values": [ + 3 + ] + }, + "areas": [ + { + "areaId": "Constants::HVAC_ALL", + "minInt32Value": 1, + "maxInt32Value": 7 + } + ] + }, + { + "property": "VehicleProperty::HVAC_FAN_DIRECTION", + "defaultValue": { + "int32Values": [ + "VehicleHvacFanDirection::FACE" + ] + }, + "areas": [ + { + "areaId": "Constants::HVAC_ALL" + } + ] + }, + { + "property": "VehicleProperty::HVAC_FAN_DIRECTION_AVAILABLE", + "defaultValue": { + "int32Values": [ + "Constants::FAN_DIRECTION_FACE", + "Constants::FAN_DIRECTION_FLOOR", + "Constants::FAN_DIRECTION_FACE_FLOOR", + "Constants::FAN_DIRECTION_DEFROST", + "Constants::FAN_DIRECTION_FACE_DEFROST", + "Constants::FAN_DIRECTION_FLOOR_DEFROST", + "Constants::FAN_DIRECTION_FLOOR_DEFROST_FACE" + ] + }, + "areas": [ + { + "areaId": "Constants::HVAC_ALL" + } + ] + }, + { + "property": "VehicleProperty::HVAC_SEAT_VENTILATION", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": 0, + "maxInt32Value": 3 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": 0, + "maxInt32Value": 3 + } + ], + "comment": "0 is off and +ve values indicate ventilation level." + }, + { + "property": "VehicleProperty::HVAC_STEERING_WHEEL_HEAT", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": 0, + "minInt32Value": -2, + "maxInt32Value": 2 + } + ], + "comment": "+ve values for heating and -ve for cooling" + }, + { + "property": "VehicleProperty::HVAC_SEAT_TEMPERATURE", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -2, + "maxInt32Value": 2 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -2, + "maxInt32Value": 2 + } + ], + "comment": "+ve values for heating and -ve for cooling" + }, + { + "property": "VehicleProperty::HVAC_TEMPERATURE_SET", + "areas": [ + { + "defaultValue": { + "floatValues": [ + 16.0 + ] + }, + "areaId": 49, + "minFloatValue": 16.0, + "maxFloatValue": 32.0 + }, + { + "defaultValue": { + "floatValues": [ + 20.0 + ] + }, + "areaId": 68, + "minFloatValue": 16.0, + "maxFloatValue": 32.0 + } + ], + "configArray": [ + 160, + 280, + 5, + 605, + 825, + 10 + ] + }, + { + "property": "VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION", + "defaultValue": { + "floatValues": [ + 66.19999694824219, + 49.0, + 19.0, + 66.5 + ] + } + }, + { + "property": "VehicleProperty::ENV_OUTSIDE_TEMPERATURE", + "defaultValue": { + "floatValues": [ + 25.0 + ] + }, + "maxSampleRate": 2.0, + "minSampleRate": 1.0 + }, + { + "property": "VehicleProperty::HVAC_TEMPERATURE_DISPLAY_UNITS", + "defaultValue": { + "int32Values": [ + 49 + ] + }, + "configArray": [ + 49, + 48 + ] + }, + { + "property": "VehicleProperty::DISTANCE_DISPLAY_UNITS", + "defaultValue": { + "int32Values": [ + "VehicleUnit::MILE" + ] + }, + "areas": [ + { + "areaId": 0 + } + ], + "configArray": [ + "VehicleUnit::KILOMETER", + "VehicleUnit::MILE" + ] + }, + { + "property": "VehicleProperty::NIGHT_MODE", + "defaultValue": { + "int32Values": [ + 0 + ] + } + }, + { + "property": "VehicleProperty::GEAR_SELECTION", + "defaultValue": { + "int32Values": [ + "VehicleGear::GEAR_PARK" + ] + }, + "configArray": [ + "VehicleGear::GEAR_PARK", + "VehicleGear::GEAR_NEUTRAL", + "VehicleGear::GEAR_REVERSE", + "VehicleGear::GEAR_DRIVE", + "VehicleGear::GEAR_1", + "VehicleGear::GEAR_2", + "VehicleGear::GEAR_3", + "VehicleGear::GEAR_4", + "VehicleGear::GEAR_5" + ] + }, + { + "property": "VehicleProperty::TURN_SIGNAL_STATE", + "defaultValue": { + "int32Values": [ + "VehicleTurnSignal::NONE" + ] + } + }, + { + "property": "VehicleProperty::IGNITION_STATE", + "defaultValue": { + "int32Values": [ + "VehicleIgnitionState::ON" + ] + } + }, + { + "property": "VehicleProperty::ENGINE_COOLANT_TEMP", + "defaultValue": { + "floatValues": [ + 75.0 + ] + }, + "maxSampleRate": 10.0, + "minSampleRate": 1.0 + }, + { + "property": "VehicleProperty::ENGINE_OIL_LEVEL", + "defaultValue": { + "int32Values": [ + "VehicleOilLevel::NORMAL" + ] + } + }, + { + "property": "VehicleProperty::ENGINE_OIL_TEMP", + "defaultValue": { + "floatValues": [ + 101.0 + ] + }, + "maxSampleRate": 10.0, + "minSampleRate": 0.10000000149011612 + }, + { + "property": "VehicleProperty::DOOR_LOCK", + "areas": [ + { + "defaultValue": { + "int32Values": [ + 1 + ] + }, + "areaId": "Constants::DOOR_1_LEFT" + }, + { + "defaultValue": { + "int32Values": [ + 1 + ] + }, + "areaId": "Constants::DOOR_1_RIGHT" + }, + { + "defaultValue": { + "int32Values": [ + 1 + ] + }, + "areaId": "Constants::DOOR_2_LEFT" + }, + { + "defaultValue": { + "int32Values": [ + 1 + ] + }, + "areaId": "Constants::DOOR_2_RIGHT" + } + ] + }, + { + "property": "VehicleProperty::DOOR_POS", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::DOOR_1_LEFT", + "minInt32Value": 0, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::DOOR_1_RIGHT", + "minInt32Value": 0, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::DOOR_2_LEFT", + "minInt32Value": 0, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::DOOR_2_RIGHT", + "minInt32Value": 0, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::DOOR_REAR", + "minInt32Value": 0, + "maxInt32Value": 1 + } + ] + }, + { + "property": "VehicleProperty::WINDOW_LOCK", + "areas": [ + { + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areaId": "Constants::WINDOW_1_RIGHT_2_LEFT_2_RIGHT" + } + ] + }, + { + "property": "VehicleProperty::WINDOW_POS", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::WINDOW_1_LEFT", + "minInt32Value": 0, + "maxInt32Value": 10, + }, + { + "areaId": "Constants::WINDOW_1_RIGHT", + "minInt32Value": 0, + "maxInt32Value": 10, + }, + { + "areaId": "Constants::WINDOW_2_LEFT", + "minInt32Value": 0, + "maxInt32Value": 10, + }, + { + "areaId": "Constants::WINDOW_2_RIGHT", + "minInt32Value": 0, + "maxInt32Value": 10, + }, + { + "areaId": "Constants::WINDOW_ROOF_TOP_1", + "minInt32Value": -10, + "maxInt32Value": 10 + } + ] + }, + { + "property": "VehicleProperty::WHEEL_TICK", + "defaultValue": { + "int64Values": [ + 0, + 100000, + 200000, + 300000, + 400000 + ] + }, + "configArray": [ + 15, + 50000, + 50000, + 50000, + 50000 + ], + "maxSampleRate": 10.0, + "minSampleRate": 1.0 + }, + { + "property": "VehicleProperty::ABS_ACTIVE", + "defaultValue": { + "int32Values": [ + 0 + ] + } + }, + { + "property": "VehicleProperty::TRACTION_CONTROL_ACTIVE", + "defaultValue": { + "int32Values": [ + 0 + ] + } + }, + { + "property": "VehicleProperty::AP_POWER_STATE_REQ", + "configArray": [ + 0 + ] + }, + { + "property": "VehicleProperty::AP_POWER_STATE_REPORT", + "defaultValue": { + "int32Values": [ + "VehicleApPowerStateReport::WAIT_FOR_VHAL", + 0 + ] + } + }, + { + "property": "VehicleProperty::DISPLAY_BRIGHTNESS", + "defaultValue": { + "int32Values": [ + 100 + ] + }, + "areas": [ + { + "areaId": 0, + "minInt32Value": 0, + "maxInt32Value": 100 + } + ] + }, + { + "property": "VehicleProperty::OBD2_LIVE_FRAME", + "configArray": [ + 0, + 0 + ] + }, + { + "property": "VehicleProperty::OBD2_FREEZE_FRAME", + "configArray": [ + 0, + 0 + ] + }, + { + "property": "VehicleProperty::OBD2_FREEZE_FRAME_INFO" + }, + { + "property": "VehicleProperty::OBD2_FREEZE_FRAME_CLEAR", + "configArray": [ + 1 + ] + }, + { + "property": "VehicleProperty::HEADLIGHTS_STATE", + "defaultValue": { + "int32Values": [ + "Constants::LIGHT_STATE_ON" + ] + } + }, + { + "property": "VehicleProperty::HIGH_BEAM_LIGHTS_STATE", + "defaultValue": { + "int32Values": [ + "Constants::LIGHT_STATE_ON" + ] + } + }, + { + "property": "VehicleProperty::FRONT_FOG_LIGHTS_STATE", + "defaultValue": { + "int32Values": [ + "Constants::LIGHT_STATE_ON" + ] + } + }, + { + "property": "VehicleProperty::REAR_FOG_LIGHTS_STATE", + "defaultValue": { + "int32Values": [ + "Constants::LIGHT_STATE_ON" + ] + } + }, + { + "property": "VehicleProperty::HAZARD_LIGHTS_STATE", + "defaultValue": { + "int32Values": [ + "Constants::LIGHT_STATE_ON" + ] + } + }, + { + "property": "VehicleProperty::HEADLIGHTS_SWITCH", + "defaultValue": { + "int32Values": [ + "Constants::LIGHT_SWITCH_AUTO" + ] + } + }, + { + "property": "VehicleProperty::HIGH_BEAM_LIGHTS_SWITCH", + "defaultValue": { + "int32Values": [ + "Constants::LIGHT_SWITCH_AUTO" + ] + } + }, + { + "property": "VehicleProperty::FOG_LIGHTS_SWITCH", + "defaultValue": { + "int32Values": [ + "Constants::LIGHT_SWITCH_AUTO" + ] + } + }, + { + "property": "VehicleProperty::FRONT_FOG_LIGHTS_SWITCH", + "defaultValue": { + "int32Values": [ + "Constants::LIGHT_SWITCH_AUTO" + ] + } + }, + { + "property": "VehicleProperty::REAR_FOG_LIGHTS_SWITCH", + "defaultValue": { + "int32Values": [ + "Constants::LIGHT_SWITCH_AUTO" + ] + } + }, + { + "property": "VehicleProperty::HAZARD_LIGHTS_SWITCH", + "defaultValue": { + "int32Values": [ + "Constants::LIGHT_SWITCH_AUTO" + ] + } + }, + { + "property": "VehicleProperty::EVS_SERVICE_REQUEST", + "defaultValue": { + "int32Values": [ + "EvsServiceType::REARVIEW", + "EvsServiceState::OFF" + ] + } + }, + { + "property": "VehicleProperty::VEHICLE_MAP_SERVICE" + }, + { + "property": "VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_TYPE", + "defaultValue": { + "int32Values": [ + 0 + ] + } + }, + { + "property": "VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_STATUS", + "defaultValue": { + "int32Values": [ + 0 + ] + } + }, + { + "property": "VehicleProperty::INITIAL_USER_INFO" + }, + { + "property": "VehicleProperty::SWITCH_USER" + }, + { + "property": "VehicleProperty::CREATE_USER" + }, + { + "property": "VehicleProperty::REMOVE_USER" + }, + { + "property": "VehicleProperty::USER_IDENTIFICATION_ASSOCIATION" + }, + { + "property": "VehicleProperty::POWER_POLICY_REQ" + }, + { + "property": "VehicleProperty::POWER_POLICY_GROUP_REQ" + }, + { + "property": "VehicleProperty::CURRENT_POWER_POLICY" + }, + { + "property": "VehicleProperty::ANDROID_EPOCH_TIME", + }, + { + "property": "VehicleProperty::WATCHDOG_ALIVE", + }, + { + "property": "VehicleProperty::WATCHDOG_TERMINATED_PROCESS", + }, + { + "property": "VehicleProperty::VHAL_HEARTBEAT" + }, + { + "property": "VehicleProperty::CLUSTER_SWITCH_UI", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "comment": "0 means ClusterHome" + }, + { + "property": "VehicleProperty::CLUSTER_DISPLAY_STATE", + "defaultValue": { + "int32Values": [ + 0, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1 + ] + }, + "comment": + "Value means: 0 /* Off */, -1, -1, -1, -1 /* Bounds */, -1, -1, -1, -1 /* Insets */", + }, + { + "property": "VehicleProperty::CLUSTER_REPORT_STATE", + "configArray": [ + 0, + 0, + 0, + 11, + 0, + 0, + 0, + 0, + 16 + ] + }, + { + "property": "VehicleProperty::CLUSTER_REQUEST_DISPLAY", + }, + { + "property": "VehicleProperty::CLUSTER_NAVIGATION_STATE", + }, + { + "property": "VehicleProperty::GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT", + "defaultValue": { + "int32Values": [ + "GsrComplianceRequirementType::GSR_COMPLIANCE_REQUIRED_THROUGH_SYSTEM_IMAGE" + ] + } + } + ] +} \ No newline at end of file diff --git a/automotive/vehicle/aidl/impl/default_config/config/TestProperties.json b/automotive/vehicle/aidl/impl/default_config/config/TestProperties.json new file mode 100644 index 0000000000..33c6cc2397 --- /dev/null +++ b/automotive/vehicle/aidl/impl/default_config/config/TestProperties.json @@ -0,0 +1,204 @@ +{ + "properties": [ + { + "property": "Constants::kMixedTypePropertyForTest", + "defaultValue": { + "floatValues": [ + 4.5 + ], + "int32Values": [ + 1, + 2, + 3 + ], + "stringValue": "MIXED property" + }, + "configArray": [ + 1, + 1, + 0, + 2, + 0, + 0, + 1, + 0, + 0 + ], + "access": "VehiclePropertyAccess::READ_WRITE", + "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" + }, + { + "property": "Constants::VENDOR_EXTENSION_BOOLEAN_PROPERTY", + "areas": [ + { + "defaultValue": { + "int32Values": [ + 1 + ] + }, + "areaId": "Constants::DOOR_1_LEFT" + }, + { + "defaultValue": { + "int32Values": [ + 1 + ] + }, + "areaId": "Constants::DOOR_1_RIGHT" + }, + { + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areaId": "Constants::DOOR_2_LEFT" + }, + { + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areaId": "Constants::DOOR_2_RIGHT" + } + ], + "access": "VehiclePropertyAccess::READ_WRITE", + "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" + }, + { + "property": "Constants::VENDOR_EXTENSION_FLOAT_PROPERTY", + "areas": [ + { + "defaultValue": { + "floatValues": [ + 1.0 + ] + }, + "areaId": "Constants::HVAC_LEFT", + "minFloatValue": -10.0, + "maxFloatValue": 10.0 + }, + { + "defaultValue": { + "floatValues": [ + 2.0 + ] + }, + "areaId": "Constants::HVAC_RIGHT", + "minFloatValue": -10.0, + "maxFloatValue": 10.0 + } + ], + "access": "VehiclePropertyAccess::READ_WRITE", + "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" + }, + { + "property": "Constants::VENDOR_EXTENSION_INT_PROPERTY", + "areas": [ + { + "defaultValue": { + "int32Values": [ + 1 + ] + }, + "areaId": "VehicleAreaWindow::FRONT_WINDSHIELD", + "minInt32Value": -100, + "maxInt32Value": 100 + }, + { + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areaId": "VehicleAreaWindow::REAR_WINDSHIELD", + "minInt32Value": -100, + "maxInt32Value": 100 + }, + { + "defaultValue": { + "int32Values": [ + -1 + ] + }, + "areaId": "VehicleAreaWindow::ROOF_TOP_1", + "minInt32Value": -100, + "maxInt32Value": 100 + } + ], + "access": "VehiclePropertyAccess::READ_WRITE", + "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" + }, + { + "property": "Constants::VENDOR_EXTENSION_STRING_PROPERTY", + "defaultValue": { + "stringValue": "Vendor String Property" + }, + "access": "VehiclePropertyAccess::READ_WRITE", + "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" + }, + { + "property": "Constants::PLACEHOLDER_PROPERTY_INT", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "access": "VehiclePropertyAccess::READ_WRITE", + "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" + }, + { + "property": "Constants::PLACEHOLDER_PROPERTY_FLOAT", + "defaultValue": { + "floatValues": [ + 0.0 + ] + }, + "access": "VehiclePropertyAccess::READ_WRITE", + "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" + }, + { + "property": "Constants::PLACEHOLDER_PROPERTY_BOOLEAN", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "access": "VehiclePropertyAccess::READ_WRITE", + "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" + }, + { + "property": "Constants::PLACEHOLDER_PROPERTY_STRING", + "defaultValue": { + "stringValue": "Test" + }, + "access": "VehiclePropertyAccess::READ_WRITE", + "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" + }, + { + "property": "Constants::ECHO_REVERSE_BYTES", + "access": "VehiclePropertyAccess::READ_WRITE", + "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" + }, + { + "property": "VehicleProperty::SUPPORT_CUSTOMIZE_VENDOR_PERMISSION", + "defaultValue": { + "int32Values": [ + 1 + ] + }, + "configArray": [ + "Constants::kMixedTypePropertyForTest", + "VehicleVendorPermission::PERMISSION_GET_VENDOR_CATEGORY_INFO", + "VehicleVendorPermission::PERMISSION_SET_VENDOR_CATEGORY_INFO", + "Constants::VENDOR_EXTENSION_INT_PROPERTY", + "VehicleVendorPermission::PERMISSION_GET_VENDOR_CATEGORY_SEAT", + "VehicleVendorPermission::PERMISSION_NOT_ACCESSIBLE", + "Constants::VENDOR_EXTENSION_FLOAT_PROPERTY", + "VehicleVendorPermission::PERMISSION_DEFAULT", + "VehicleVendorPermission::PERMISSION_DEFAULT" + ] + } + ] +} \ No newline at end of file diff --git a/automotive/vehicle/aidl/impl/default_config/config/VendorClusterTestProperties.json b/automotive/vehicle/aidl/impl/default_config/config/VendorClusterTestProperties.json new file mode 100644 index 0000000000..3a1a783b84 --- /dev/null +++ b/automotive/vehicle/aidl/impl/default_config/config/VendorClusterTestProperties.json @@ -0,0 +1,63 @@ +{ + "properties": [ + { + "property": "Constants::VENDOR_CLUSTER_SWITCH_UI", + "access": "VehiclePropertyAccess::WRITE", + "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" + }, + { + "property": "Constants::VENDOR_CLUSTER_DISPLAY_STATE", + "access": "VehiclePropertyAccess::WRITE", + "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" + }, + { + "property": "Constants::VENDOR_CLUSTER_REPORT_STATE", + "defaultValue": { + "int32Values": [ + 0, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1, + 0, + -1 + ] + }, + "configArray": [ + 0, + 0, + 0, + 11, + 0, + 0, + 0, + 0, + 16 + ], + "access": "VehiclePropertyAccess::READ", + "changeMode": "VehiclePropertyChangeMode::ON_CHANGE", + "comment": + "Value means 0 /* Off */, -1, -1, -1, -1 /* Bounds */, -1, -1, -1, -1 /* Insets */, 0 /* ClusterHome */, -1 /* ClusterNone */" + }, + { + "property": "Constants::VENDOR_CLUSTER_REQUEST_DISPLAY", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "access": "VehiclePropertyAccess::READ", + "changeMode": "VehiclePropertyChangeMode::ON_CHANGE", + "comment": "0 means ClusterHome" + }, + { + "property": "Constants::VENDOR_CLUSTER_NAVIGATION_STATE", + "access": "VehiclePropertyAccess::READ", + "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" + } + ] +} \ No newline at end of file From 5b29f509449bbae335a445c39661aabd541d7fff Mon Sep 17 00:00:00 2001 From: Frankie Lizcano Date: Wed, 6 Jul 2022 22:09:42 +0000 Subject: [PATCH 143/998] Improve Tuner VTS Configuration: Dynamically determine possible dataflows This CL allows the VTS to read the contents of vendors' configuration files and determine which dataflows can be tested depending on the devices provided. This only implements the logic of determining which data flows are possible. Currently, the data flow section of the configuration file is still being read, and configurations are not being cycled yet. Additionally, TearDown() was overidden for each testing class. Bug: b/182519645 Test: vts-tradefed run vts --module VtsHalTvTunerTargetTest Change-Id: Ib3b3c4de62e6556ef44b42e855a369a5015d66ff --- .../vts/functional/VtsHalTvTunerTargetTest.h | 52 +++++++++++ .../VtsHalTvTunerTestConfigurations.h | 92 +++++++++++++++++++ .../config/TunerTestingConfigAidlReaderV1_0.h | 41 +++++++++ 3 files changed, 185 insertions(+) diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h index e8a7a79069..57c7592a8b 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h @@ -45,6 +45,8 @@ bool initConfiguration() { ALOGW("[vts] failed to validate connections."); return false; } + determineDataFlows(); + return true; } @@ -62,6 +64,14 @@ AssertionResult filterDataOutputTestBase(FilterTests& tests) { return success(); } +void clearIds() { + recordDvrIds.clear(); + audioFilterIds.clear(); + videoFilterIds.clear(); + playbackDvrIds.clear(); + recordFilterIds.clear(); +} + class TunerLnbAidlTest : public testing::TestWithParam { public: virtual void SetUp() override { @@ -77,6 +87,11 @@ class TunerLnbAidlTest : public testing::TestWithParam { mLnbTests.setService(mService); } + virtual void TearDown() override { + clearIds(); + mService = nullptr; + } + protected: static void description(const std::string& description) { RecordProperty("description", description); @@ -105,6 +120,11 @@ class TunerDemuxAidlTest : public testing::TestWithParam { mFilterTests.setService(mService); } + virtual void TearDown() override { + clearIds(); + mService = nullptr; + } + protected: static void description(const std::string& description) { RecordProperty("description", description); @@ -135,6 +155,11 @@ class TunerFilterAidlTest : public testing::TestWithParam { mFilterTests.setService(mService); } + virtual void TearDown() override { + clearIds(); + mService = nullptr; + } + protected: static void description(const std::string& description) { RecordProperty("description", description); @@ -201,6 +226,11 @@ class TunerPlaybackAidlTest : public testing::TestWithParam { mDvrTests.setService(mService); } + virtual void TearDown() override { + clearIds(); + mService = nullptr; + } + protected: static void description(const std::string& description) { RecordProperty("description", description); @@ -238,6 +268,12 @@ class TunerRecordAidlTest : public testing::TestWithParam { mLnbTests.setService(mService); } + virtual void TearDown() override { + clearIds(); + mService = nullptr; + mLnbId = nullptr; + } + protected: static void description(const std::string& description) { RecordProperty("description", description); @@ -278,6 +314,11 @@ class TunerFrontendAidlTest : public testing::TestWithParam { mFrontendTests.setService(mService); } + virtual void TearDown() override { + clearIds(); + mService = nullptr; + } + protected: static void description(const std::string& description) { RecordProperty("description", description); @@ -308,6 +349,12 @@ class TunerBroadcastAidlTest : public testing::TestWithParam { mDvrTests.setService(mService); } + virtual void TearDown() override { + clearIds(); + mService = nullptr; + mLnbId = nullptr; + } + protected: static void description(const std::string& description) { RecordProperty("description", description); @@ -354,6 +401,11 @@ class TunerDescramblerAidlTest : public testing::TestWithParam { mDescramblerTests.setCasService(mCasService); } + virtual void TearDown() override { + clearIds(); + mService = nullptr; + } + protected: static void description(const std::string& description) { RecordProperty("description", description); diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h index f093b8eb93..c4b09629bf 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h @@ -182,6 +182,87 @@ inline void initDiseqcMsgsConfig() { TunerTestingConfigAidlReader1_0::readDiseqcMessages(diseqcMsgMap); }; +inline void determineScan() { + if (!frontendMap.empty()) { + scan.hasFrontendConnection = true; + ALOGD("Can support scan"); + } +} + +inline void determineTimeFilter() { + if (!timeFilterMap.empty()) { + timeFilter.support = true; + ALOGD("Can support time filter"); + } +} + +inline void determineDvrPlayback() { + if (!playbackDvrIds.empty() && !audioFilterIds.empty() && !videoFilterIds.empty()) { + playback.support = true; + ALOGD("Can support dvr playback"); + } +} + +inline void determineLnbLive() { + if (!audioFilterIds.empty() && !videoFilterIds.empty() && !frontendMap.empty() && + !lnbMap.empty()) { + lnbLive.support = true; + ALOGD("Can support lnb live"); + } +} + +inline void determineLnbRecord() { + if (!frontendMap.empty() && !recordFilterIds.empty() && !recordDvrIds.empty() && + !lnbMap.empty()) { + lnbRecord.support = true; + ALOGD("Can support lnb record"); + } +} + +inline void determineLive() { + if (videoFilterIds.empty() || audioFilterIds.empty() || frontendMap.empty()) { + return; + } + if (hasSwFe && !hasHwFe && dvrMap.empty()) { + ALOGD("Cannot configure Live. Only software frontends and no dvr connections"); + return; + } + ALOGD("Can support live"); + live.hasFrontendConnection = true; +} + +inline void determineDescrambling() { + if (descramblerMap.empty() || audioFilterIds.empty() || videoFilterIds.empty()) { + return; + } + if (frontendMap.empty() && playbackDvrIds.empty()) { + ALOGD("Cannot configure descrambling. No frontends or playback dvr's"); + return; + } + if (hasSwFe && !hasHwFe && playbackDvrIds.empty()) { + ALOGD("cannot configure descrambling. Only SW frontends and no playback dvr's"); + return; + } + ALOGD("Can support descrambling"); + descrambling.support = true; +} + +inline void determineDvrRecord() { + if (recordDvrIds.empty() || recordFilterIds.empty()) { + return; + } + if (frontendMap.empty() && playbackDvrIds.empty()) { + ALOGD("Cannot support dvr record. No frontends and no playback dvr's"); + return; + } + if (hasSwFe && !hasHwFe && playbackDvrIds.empty()) { + ALOGD("Cannot support dvr record. Only SW frontends and no playback dvr's"); + return; + } + ALOGD("Can support dvr record."); + record.support = true; +} + /** Read the vendor configurations of which hardware to use for each test cases/data flows */ inline void connectHardwaresToTestCases() { TunerTestingConfigAidlReader1_0::connectLiveBroadcast(live); @@ -194,6 +275,17 @@ inline void connectHardwaresToTestCases() { TunerTestingConfigAidlReader1_0::connectDvrPlayback(playback); }; +inline void determineDataFlows() { + determineScan(); + determineTimeFilter(); + determineDvrPlayback(); + determineLnbLive(); + determineLnbRecord(); + determineLive(); + determineDescrambling(); + determineDvrRecord(); +} + inline bool validateConnections() { if (record.support && !record.hasFrontendConnection && record.dvrSourceId.compare(emptyHardwareId) == 0) { diff --git a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h index b6e1020b64..7c757b4ebb 100644 --- a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h +++ b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h @@ -62,10 +62,28 @@ using namespace std; using namespace aidl::android::hardware::tv::tuner; using namespace android::media::tuner::testing::configuration::V1_0; +static bool hasHwFe = false; +static bool hasSwFe = false; +static bool configFileRead = false; +static bool configuredLive = false; +static bool configuredScan = false; +static bool configuredRecord = false; +static bool configuredLnbLive = false; +static bool configuredPlayback = false; +static bool configuredLnbRecord = false; +static bool configuredTimeFilter = false; +static bool configuredDescrambling = false; + const string emptyHardwareId = ""; static string mConfigFilePath; +static vector playbackDvrIds; +static vector recordDvrIds; +static vector audioFilterIds; +static vector videoFilterIds; +static vector recordFilterIds; + #define PROVISION_STR \ "{ " \ " \"id\": 21140844, " \ @@ -310,6 +328,11 @@ struct TunerTestingConfigAidlReader1_0 { } frontendMap[id].type = type; frontendMap[id].isSoftwareFe = feConfig.getIsSoftwareFrontend(); + if (frontendMap[id].isSoftwareFe) { + hasSwFe = true; + } else { + hasHwFe = true; + } // TODO: b/182519645 complete the tune status config frontendMap[id].tuneStatusTypes = types; frontendMap[id].expectTuneStatuses = statuses; @@ -384,11 +407,13 @@ struct TunerTestingConfigAidlReader1_0 { DvrType type; switch (dvrConfig.getType()) { case DvrTypeEnum::PLAYBACK: + playbackDvrIds.push_back(id); type = DvrType::PLAYBACK; dvrMap[id].settings.set( readPlaybackSettings(dvrConfig)); break; case DvrTypeEnum::RECORD: + recordDvrIds.push_back(id); type = DvrType::RECORD; dvrMap[id].settings.set( readRecordSettings(dvrConfig)); @@ -477,6 +502,7 @@ struct TunerTestingConfigAidlReader1_0 { auto dataFlow = getDataFlowConfiguration(); if (dataFlow.hasClearLiveBroadcast()) { live.hasFrontendConnection = true; + configuredLive = true; } else { live.hasFrontendConnection = false; return; @@ -510,6 +536,7 @@ struct TunerTestingConfigAidlReader1_0 { auto dataFlow = getDataFlowConfiguration(); if (dataFlow.hasScan()) { scan.hasFrontendConnection = true; + configuredScan = true; } else { scan.hasFrontendConnection = false; return; @@ -522,6 +549,7 @@ struct TunerTestingConfigAidlReader1_0 { auto dataFlow = getDataFlowConfiguration(); if (dataFlow.hasDvrPlayback()) { playback.support = true; + configuredPlayback = true; } else { playback.support = false; return; @@ -548,6 +576,7 @@ struct TunerTestingConfigAidlReader1_0 { auto dataFlow = getDataFlowConfiguration(); if (dataFlow.hasDvrRecord()) { record.support = true; + configuredRecord = true; } else { record.support = false; return; @@ -572,6 +601,7 @@ struct TunerTestingConfigAidlReader1_0 { auto dataFlow = getDataFlowConfiguration(); if (dataFlow.hasDescrambling()) { descrambling.support = true; + configuredDescrambling = true; } else { descrambling.support = false; return; @@ -601,6 +631,7 @@ struct TunerTestingConfigAidlReader1_0 { auto dataFlow = getDataFlowConfiguration(); if (dataFlow.hasLnbLive()) { lnbLive.support = true; + configuredLnbLive = true; } else { lnbLive.support = false; return; @@ -625,6 +656,7 @@ struct TunerTestingConfigAidlReader1_0 { auto dataFlow = getDataFlowConfiguration(); if (dataFlow.hasLnbRecord()) { lnbRecord.support = true; + configuredLnbRecord = true; } else { lnbRecord.support = false; return; @@ -649,6 +681,7 @@ struct TunerTestingConfigAidlReader1_0 { auto dataFlow = getDataFlowConfiguration(); if (dataFlow.hasTimeFilter()) { timeFilter.support = true; + configuredTimeFilter = true; } else { timeFilter.support = false; return; @@ -799,6 +832,14 @@ struct TunerTestingConfigAidlReader1_0 { auto mainType = filterConfig.getMainType(); auto subType = filterConfig.getSubType(); + if (subType == FilterSubTypeEnum::AUDIO) { + audioFilterIds.push_back(filterConfig.getId()); + } else if (subType == FilterSubTypeEnum::VIDEO) { + videoFilterIds.push_back(filterConfig.getId()); + } else if (subType == FilterSubTypeEnum::RECORD) { + recordFilterIds.push_back(filterConfig.getId()); + } + switch (mainType) { case FilterMainTypeEnum::TS: { ALOGW("[ConfigReader] filter main type is ts"); From a53f554ca881333b3f4119a5cd0036f0ef9c4783 Mon Sep 17 00:00:00 2001 From: Frankie Lizcano Date: Thu, 7 Jul 2022 17:32:06 +0000 Subject: [PATCH 144/998] Improve Tuner VTS: Generate DVR Playback Combos This CL allows the VTS to read a vendor's configuration file, determine if the given devices could support the playback dataflow, and generate all combinations of units (dvr, audio filter, video filter, section filters) to run them on corresponding integration tests. Additionally, began storing section filter id's and eliminated the check to see if they were stored already by utilizing the TearDown() function between integration tests. Bug: b/182519645 Test: vts-tradefed run vts --module VtsHalTvTunerTargetTest. Manual tests with different input configuration files. Change-Id: I8e8be258dce9927e755f9c8bdb41441f367a196b --- .../functional/VtsHalTvTunerTargetTest.cpp | 22 ++++- .../vts/functional/VtsHalTvTunerTargetTest.h | 1 + .../VtsHalTvTunerTestConfigurations.h | 98 +++++++++++++++++++ .../config/TunerTestingConfigAidlReaderV1_0.h | 3 + 4 files changed, 120 insertions(+), 4 deletions(-) diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp index 07e3e3cbe2..f8e4d0b521 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp @@ -839,10 +839,16 @@ TEST_P(TunerFilterAidlTest, FilterDelayHintTest) { TEST_P(TunerPlaybackAidlTest, PlaybackDataFlowWithTsSectionFilterTest) { description("Feed ts data from playback and configure Ts section filter to get output"); - if (!playback.support || playback.sectionFilterId.compare(emptyHardwareId) == 0) { + if (!playback.support) { return; } - playbackSingleFilterTest(filterMap[playback.sectionFilterId], dvrMap[playback.dvrId]); + vector playback_configs = generatePlaybackConfigs(); + for (auto& configuration : playback_configs) { + if (configuration.sectionFilterId.compare(emptyHardwareId) != 0) { + playback = configuration; + playbackSingleFilterTest(filterMap[playback.sectionFilterId], dvrMap[playback.dvrId]); + } + } } TEST_P(TunerPlaybackAidlTest, PlaybackDataFlowWithTsAudioFilterTest) { @@ -850,7 +856,11 @@ TEST_P(TunerPlaybackAidlTest, PlaybackDataFlowWithTsAudioFilterTest) { if (!playback.support) { return; } - playbackSingleFilterTest(filterMap[playback.audioFilterId], dvrMap[playback.dvrId]); + vector playback_configs = generatePlaybackConfigs(); + for (auto& configuration : playback_configs) { + playback = configuration; + playbackSingleFilterTest(filterMap[playback.audioFilterId], dvrMap[playback.dvrId]); + } } TEST_P(TunerPlaybackAidlTest, PlaybackDataFlowWithTsVideoFilterTest) { @@ -858,7 +868,11 @@ TEST_P(TunerPlaybackAidlTest, PlaybackDataFlowWithTsVideoFilterTest) { if (!playback.support) { return; } - playbackSingleFilterTest(filterMap[playback.videoFilterId], dvrMap[playback.dvrId]); + vector playback_configs = generatePlaybackConfigs(); + for (auto& configuration : playback_configs) { + playback = configuration; + playbackSingleFilterTest(filterMap[playback.videoFilterId], dvrMap[playback.dvrId]); + } } TEST_P(TunerRecordAidlTest, RecordDataFlowWithTsRecordFilterTest) { diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h index 57c7592a8b..d4536aad1e 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h @@ -70,6 +70,7 @@ void clearIds() { videoFilterIds.clear(); playbackDvrIds.clear(); recordFilterIds.clear(); + sectionFilterIds.clear(); } class TunerLnbAidlTest : public testing::TestWithParam { diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h index c4b09629bf..f3928a35ae 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h @@ -75,6 +75,104 @@ static LnbLiveHardwareConnections lnbLive; static LnbRecordHardwareConnections lnbRecord; static TimeFilterHardwareConnections timeFilter; +/* + * This function takes in a 2d vector of device Id's + * The n vectors correlate to the ids for n different devices (eg frontends, filters) + * The resultant 2d vector is every combination of id's with 1 id from each vector + */ +inline vector> generateIdCombinations(vector>& ids) { + vector> combinations; + + // The index of each vector in ids that will be used in the next combination + // EG {0, 2} means combo {ids[0][0] ids[1][2]} will be next + const int size = static_cast(ids.size()); + vector indexes_used_in_combination(size, 0); + + // The vector number from ids whose elements we will cycle through to make combinations. + // First, start at the right most vector + int cycled_vector = size - 1; + + while (cycled_vector >= 0) { + // Make a combination (one at a time) + vector combo; + for (size_t i = 0; i < indexes_used_in_combination.size(); ++i) { + const int combo_index = indexes_used_in_combination[i]; + combo.push_back(ids[i][combo_index]); + } + combinations.push_back(combo); + + // Find the right most vector that still has space [elements left] to cycle through and + // create a combination + while (cycled_vector >= 0 && + indexes_used_in_combination[cycled_vector] == ids[cycled_vector].size() - 1) { + cycled_vector--; + } + + // Use this check to avoid segmentation faults + if (cycled_vector >= 0) { + // Once found, we have a vector we can cycle through, so increase to its next element + indexes_used_in_combination[cycled_vector]++; + + // Reset the other vectors to the right to their first element so we can cycle through + // them again with the new element from cycled vector + for (size_t i = cycled_vector + 1; i < indexes_used_in_combination.size(); ++i) { + indexes_used_in_combination[i] = 0; + } + + // all the vectors to the right were reset, so we can cycle through them again + // Start at the furthest right vector + cycled_vector = size - 1; + } + } + + return combinations; +} + +/* + * index 0 - playback dvr + * index 1 - audio filters + * index 2 - video filters + * index 3 - optional section filters + */ +static inline vector generatePlaybackCombinations() { + vector combinations; + vector sectionFilterIds_optional = sectionFilterIds; + sectionFilterIds_optional.push_back(emptyHardwareId); + vector> deviceIds{playbackDvrIds, audioFilterIds, videoFilterIds, + sectionFilterIds_optional}; + + const int dvrIndex = 0; + const int audioFilterIndex = 1; + const int videoFilterIndex = 2; + const int sectionFilterIndex = 3; + + auto idCombinations = generateIdCombinations(deviceIds); + for (auto& combo : idCombinations) { + DvrPlaybackHardwareConnections mPlayback; + mPlayback.dvrId = combo[dvrIndex]; + mPlayback.audioFilterId = combo[audioFilterIndex]; + mPlayback.videoFilterId = combo[videoFilterIndex]; + mPlayback.sectionFilterId = combo[sectionFilterIndex]; + combinations.push_back(mPlayback); + } + + return combinations; +} + +static inline vector generatePlaybackConfigs() { + vector playback_configs; + if (configuredPlayback) { + ALOGD("Using DVR playback configuration provided."); + playback_configs = {playback}; + } else { + ALOGD("Dvr playback not provided. Generating possible combinations. Consider adding it to " + "the configuration file."); + playback_configs = generatePlaybackCombinations(); + } + + return playback_configs; +} + /** Config all the frontends that would be used in the tests */ inline void initFrontendConfig() { // The test will use the internal default fe when default fe is connected to any data flow diff --git a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h index 7c757b4ebb..27b458fcb7 100644 --- a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h +++ b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h @@ -83,6 +83,7 @@ static vector recordDvrIds; static vector audioFilterIds; static vector videoFilterIds; static vector recordFilterIds; +static vector sectionFilterIds; #define PROVISION_STR \ "{ " \ @@ -838,6 +839,8 @@ struct TunerTestingConfigAidlReader1_0 { videoFilterIds.push_back(filterConfig.getId()); } else if (subType == FilterSubTypeEnum::RECORD) { recordFilterIds.push_back(filterConfig.getId()); + } else if (subType == FilterSubTypeEnum::SECTION) { + sectionFilterIds.push_back(filterConfig.getId()); } switch (mainType) { From 1e283b38646543b72853d1b39eabaa0d9a3ff5ea Mon Sep 17 00:00:00 2001 From: Frankie Lizcano Date: Fri, 8 Jul 2022 21:07:42 +0000 Subject: [PATCH 145/998] Improve Tuner VTS: Generate LnbLive Combos This CL allows the VTS to read a vendor's configuration file, determine if the given devices could support the Lnb Live dataflow, and generate all combinations of units to run them on corresponding integration tests. Bug: b/182519645 Test: vts-tradefed run vts --module VtsHalTvTunerTargetTest. Manual tests with different input configuration files. Change-Id: Iba5262375b3053e0093f91fd3b05a9ebd42ca7d0 --- .../functional/VtsHalTvTunerTargetTest.cpp | 51 ++++++++++++------- .../vts/functional/VtsHalTvTunerTargetTest.h | 3 ++ .../VtsHalTvTunerTestConfigurations.h | 51 ++++++++++++++++++- .../config/TunerTestingConfigAidlReaderV1_0.h | 6 +++ 4 files changed, 93 insertions(+), 18 deletions(-) diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp index f8e4d0b521..0285e0405e 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp @@ -494,23 +494,32 @@ TEST_P(TunerLnbAidlTest, SendDiseqcMessageToLnb) { if (!lnbLive.support) { return; } - if (lnbMap[lnbLive.lnbId].name.compare(emptyHardwareId) == 0) { - vector ids; - ASSERT_TRUE(mLnbTests.getLnbIds(ids)); - ASSERT_TRUE(ids.size() > 0); - ASSERT_TRUE(mLnbTests.openLnbById(ids[0])); - } else { - int32_t id; - ASSERT_TRUE(mLnbTests.openLnbByName(lnbMap[lnbLive.lnbId].name, id)); + vector lnbLive_configs = generateLnbLiveConfigurations(); + if (lnbLive_configs.empty()) { + ALOGD("No frontends that support satellites."); + return; } - ASSERT_TRUE(mLnbTests.setLnbCallback()); - ASSERT_TRUE(mLnbTests.setVoltage(lnbMap[lnbLive.lnbId].voltage)); - ASSERT_TRUE(mLnbTests.setTone(lnbMap[lnbLive.lnbId].tone)); - ASSERT_TRUE(mLnbTests.setSatellitePosition(lnbMap[lnbLive.lnbId].position)); - for (auto msgName : lnbLive.diseqcMsgs) { - ASSERT_TRUE(mLnbTests.sendDiseqcMessage(diseqcMsgMap[msgName])); + for (auto& combination : lnbLive_configs) { + lnbLive = combination; + + if (lnbMap[lnbLive.lnbId].name.compare(emptyHardwareId) == 0) { + vector ids; + ASSERT_TRUE(mLnbTests.getLnbIds(ids)); + ASSERT_TRUE(ids.size() > 0); + ASSERT_TRUE(mLnbTests.openLnbById(ids[0])); + } else { + int32_t id; + ASSERT_TRUE(mLnbTests.openLnbByName(lnbMap[lnbLive.lnbId].name, id)); + } + ASSERT_TRUE(mLnbTests.setLnbCallback()); + ASSERT_TRUE(mLnbTests.setVoltage(lnbMap[lnbLive.lnbId].voltage)); + ASSERT_TRUE(mLnbTests.setTone(lnbMap[lnbLive.lnbId].tone)); + ASSERT_TRUE(mLnbTests.setSatellitePosition(lnbMap[lnbLive.lnbId].position)); + for (auto msgName : lnbLive.diseqcMsgs) { + ASSERT_TRUE(mLnbTests.sendDiseqcMessage(diseqcMsgMap[msgName])); + } + ASSERT_TRUE(mLnbTests.closeLnb()); } - ASSERT_TRUE(mLnbTests.closeLnb()); } TEST_P(TunerDemuxAidlTest, openDemux) { @@ -1019,8 +1028,16 @@ TEST_P(TunerBroadcastAidlTest, LnbBroadcastDataFlowVideoFilterTest) { if (!lnbLive.support) { return; } - broadcastSingleFilterTestWithLnb(filterMap[lnbLive.videoFilterId], - frontendMap[lnbLive.frontendId], lnbMap[lnbLive.lnbId]); + vector lnbLive_configs = generateLnbLiveConfigurations(); + if (lnbLive_configs.empty()) { + ALOGD("No frontends that support satellites."); + return; + } + for (auto& combination : lnbLive_configs) { + lnbLive = combination; + broadcastSingleFilterTestWithLnb(filterMap[lnbLive.videoFilterId], + frontendMap[lnbLive.frontendId], lnbMap[lnbLive.lnbId]); + } } TEST_P(TunerBroadcastAidlTest, MediaFilterWithSharedMemoryHandle) { diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h index d4536aad1e..d6b852f62a 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h @@ -65,6 +65,9 @@ AssertionResult filterDataOutputTestBase(FilterTests& tests) { } void clearIds() { + lnbIds.clear(); + diseqcMsgs.clear(); + frontendIds.clear(); recordDvrIds.clear(); audioFilterIds.clear(); videoFilterIds.clear(); diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h index f3928a35ae..2ff19cd207 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h @@ -173,6 +173,55 @@ static inline vector generatePlaybackConfigs() { return playback_configs; } +/* + * index 0 - frontends + * index 1 - audio filters + * index 2 - video filters + * index 3 - lnbs + */ +static inline vector generateLnbLiveCombinations() { + vector combinations; + vector> deviceIds{frontendIds, audioFilterIds, videoFilterIds, lnbIds}; + + const int frontendIndex = 0; + const int audioFilterIndex = 1; + const int videoFilterIndex = 2; + const int lnbIndex = 3; + + // TODO: Find a better way to vary diseqcMsgs, if at all + auto idCombinations = generateIdCombinations(deviceIds); + for (auto& combo : idCombinations) { + const string feId = combo[frontendIndex]; + auto type = frontendMap[feId].type; + if (type == FrontendType::DVBS || type == FrontendType::ISDBS || + type == FrontendType::ISDBS3) { + LnbLiveHardwareConnections mLnbLive; + mLnbLive.frontendId = feId; + mLnbLive.audioFilterId = combo[audioFilterIndex]; + mLnbLive.videoFilterId = combo[videoFilterIndex]; + mLnbLive.lnbId = combo[lnbIndex]; + mLnbLive.diseqcMsgs = diseqcMsgs; + combinations.push_back(mLnbLive); + } + } + + return combinations; +} + +static inline vector generateLnbLiveConfigurations() { + vector lnbLive_configs; + if (configuredLnbLive) { + ALOGD("Using LnbLive configuration provided."); + lnbLive_configs = {lnbLive}; + } else { + ALOGD("LnbLive not provided. Generating possible combinations. Consider adding it to the " + "configuration file."); + lnbLive_configs = generateLnbLiveCombinations(); + } + + return lnbLive_configs; +} + /** Config all the frontends that would be used in the tests */ inline void initFrontendConfig() { // The test will use the internal default fe when default fe is connected to any data flow @@ -368,8 +417,8 @@ inline void connectHardwaresToTestCases() { TunerTestingConfigAidlReader1_0::connectDvrRecord(record); TunerTestingConfigAidlReader1_0::connectTimeFilter(timeFilter); TunerTestingConfigAidlReader1_0::connectDescrambling(descrambling); - TunerTestingConfigAidlReader1_0::connectLnbLive(lnbLive); TunerTestingConfigAidlReader1_0::connectLnbRecord(lnbRecord); + TunerTestingConfigAidlReader1_0::connectLnbLive(lnbLive); TunerTestingConfigAidlReader1_0::connectDvrPlayback(playback); }; diff --git a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h index 27b458fcb7..31f07553d1 100644 --- a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h +++ b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h @@ -84,6 +84,9 @@ static vector audioFilterIds; static vector videoFilterIds; static vector recordFilterIds; static vector sectionFilterIds; +static vector frontendIds; +static vector lnbIds; +static vector diseqcMsgs; #define PROVISION_STR \ "{ " \ @@ -268,6 +271,7 @@ struct TunerTestingConfigAidlReader1_0 { auto frontends = *hardwareConfig.getFirstFrontends(); for (auto feConfig : frontends.getFrontend()) { string id = feConfig.getId(); + frontendIds.push_back(id); if (id.compare(string("FE_DEFAULT")) == 0) { // overrid default frontendMap.erase(string("FE_DEFAULT")); @@ -438,6 +442,7 @@ struct TunerTestingConfigAidlReader1_0 { auto lnbs = *hardwareConfig.getFirstLnbs(); for (auto lnbConfig : lnbs.getLnb()) { string id = lnbConfig.getId(); + lnbIds.push_back(id); if (lnbConfig.hasName()) { lnbMap[id].name = lnbConfig.getName(); } else { @@ -481,6 +486,7 @@ struct TunerTestingConfigAidlReader1_0 { auto msgs = *hardwareConfig.getFirstDiseqcMessages(); for (auto msgConfig : msgs.getDiseqcMessage()) { string name = msgConfig.getMsgName(); + diseqcMsgs.push_back(name); for (uint8_t atom : msgConfig.getMsgBody()) { diseqcMsgMap[name].push_back(atom); } From 3138d6b7eafcec65473c13e9fde5c3b2d590b32c Mon Sep 17 00:00:00 2001 From: Frankie Lizcano Date: Mon, 11 Jul 2022 22:06:45 +0000 Subject: [PATCH 146/998] Improve Tuner VTS: Generate Scan Combos This CL allows the VTS to read a vendor's configuration file, determine if the given devices could support the Scan dataflow, and runs the integration tests with all valid frontends. Bug: b/182519645 Test: vts-tradefed run vts --module VtsHalTvTunerTargetTest. Manual tests with different input configuration files. Change-Id: Ic6756e284090fbd1961a9ed12c1a4b541fb834b8 --- .../functional/VtsHalTvTunerTargetTest.cpp | 18 ++++++++++-- .../VtsHalTvTunerTestConfigurations.h | 28 ++++++++++++++++++- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp index 0285e0405e..95061b583c 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp @@ -926,7 +926,11 @@ TEST_P(TunerFrontendAidlTest, AutoScanFrontend) { if (!scan.hasFrontendConnection) { return; } - mFrontendTests.scanTest(frontendMap[scan.frontendId], FrontendScanType::SCAN_AUTO); + vector scan_configs = generateScanConfigurations(); + for (auto& configuration : scan_configs) { + scan = configuration; + mFrontendTests.scanTest(frontendMap[scan.frontendId], FrontendScanType::SCAN_AUTO); + } } TEST_P(TunerFrontendAidlTest, BlindScanFrontend) { @@ -934,7 +938,11 @@ TEST_P(TunerFrontendAidlTest, BlindScanFrontend) { if (!scan.hasFrontendConnection) { return; } - mFrontendTests.scanTest(frontendMap[scan.frontendId], FrontendScanType::SCAN_BLIND); + vector scan_configs = generateScanConfigurations(); + for (auto& configuration : scan_configs) { + scan = configuration; + mFrontendTests.scanTest(frontendMap[scan.frontendId], FrontendScanType::SCAN_BLIND); + } } TEST_P(TunerFrontendAidlTest, TuneFrontendWithFrontendSettings) { @@ -950,7 +958,11 @@ TEST_P(TunerFrontendAidlTest, BlindScanFrontendWithEndFrequency) { if (!scan.hasFrontendConnection) { return; } - mFrontendTests.scanTest(frontendMap[scan.frontendId], FrontendScanType::SCAN_BLIND); + vector scan_configs = generateScanConfigurations(); + for (auto& configuration : scan_configs) { + scan = configuration; + mFrontendTests.scanTest(frontendMap[scan.frontendId], FrontendScanType::SCAN_BLIND); + } } TEST_P(TunerFrontendAidlTest, LinkToCiCam) { diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h index 2ff19cd207..aa38e4879b 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h @@ -222,6 +222,32 @@ static inline vector generateLnbLiveConfigurations() return lnbLive_configs; } +static inline vector generateScanCombinations() { + vector combinations; + + for (auto& id : frontendIds) { + ScanHardwareConnections mScan; + mScan.frontendId = id; + combinations.push_back(mScan); + } + + return combinations; +} + +static inline vector generateScanConfigurations() { + vector scan_configs; + if (configuredScan) { + ALOGD("Using scan configuration provided."); + scan_configs = {scan}; + } else { + ALOGD("Scan not provided. Generating possible combinations. Consider adding it to " + "the configuration file."); + scan_configs = generateScanCombinations(); + } + + return scan_configs; +} + /** Config all the frontends that would be used in the tests */ inline void initFrontendConfig() { // The test will use the internal default fe when default fe is connected to any data flow @@ -417,8 +443,8 @@ inline void connectHardwaresToTestCases() { TunerTestingConfigAidlReader1_0::connectDvrRecord(record); TunerTestingConfigAidlReader1_0::connectTimeFilter(timeFilter); TunerTestingConfigAidlReader1_0::connectDescrambling(descrambling); - TunerTestingConfigAidlReader1_0::connectLnbRecord(lnbRecord); TunerTestingConfigAidlReader1_0::connectLnbLive(lnbLive); + TunerTestingConfigAidlReader1_0::connectLnbRecord(lnbRecord); TunerTestingConfigAidlReader1_0::connectDvrPlayback(playback); }; From ecba02ae0e501d5ff98dff319cf704e1ce0d3124 Mon Sep 17 00:00:00 2001 From: Frankie Lizcano Date: Tue, 12 Jul 2022 17:56:54 +0000 Subject: [PATCH 147/998] Improve Tuner VTS: Generate LnbRecord Combos This CL allows the VTS to read a vendor's configuration file, determine if the given devices could support the LnbRecord dataflow, and generate all combinations of units (frontend, record filter, dvr, lnb) to run them on corresponding integration tests. Bug: b/182519645 Test: vts-tradefed run vts --module VtsHalTvTunerTargetTest. Manual tests with different input configuration files. Change-Id: I470d593195d3f6e81cea9758b5758ec47ad3d21c --- .../functional/VtsHalTvTunerTargetTest.cpp | 14 +++-- .../VtsHalTvTunerTestConfigurations.h | 51 ++++++++++++++++++- 2 files changed, 61 insertions(+), 4 deletions(-) diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp index 95061b583c..a6c523f3de 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp @@ -908,9 +908,17 @@ TEST_P(TunerRecordAidlTest, LnbRecordDataFlowWithTsRecordFilterTest) { if (!lnbRecord.support) { return; } - recordSingleFilterTestWithLnb(filterMap[lnbRecord.recordFilterId], - frontendMap[lnbRecord.frontendId], dvrMap[lnbRecord.dvrRecordId], - lnbMap[lnbRecord.lnbId]); + vector lnbRecord_configs = generateLnbRecordConfigurations(); + if (lnbRecord_configs.empty()) { + ALOGD("No frontends that support satellites."); + return; + } + for (auto& configuration : lnbRecord_configs) { + lnbRecord = configuration; + recordSingleFilterTestWithLnb(filterMap[lnbRecord.recordFilterId], + frontendMap[lnbRecord.frontendId], + dvrMap[lnbRecord.dvrRecordId], lnbMap[lnbRecord.lnbId]); + } } TEST_P(TunerFrontendAidlTest, TuneFrontend) { diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h index aa38e4879b..bcc8c61e0d 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h @@ -248,6 +248,55 @@ static inline vector generateScanConfigurations() { return scan_configs; } +/* + * index 0 - frontends + * index 1 - record filter + * index 2 - Record Dvr + * index 3 - Lnb + */ +static inline vector generateLnbRecordCombinations() { + vector combinations; + vector> deviceIds{frontendIds, recordFilterIds, recordDvrIds, lnbIds}; + + const int frontendIndex = 0; + const int recordFilterIndex = 1; + const int dvrIndex = 2; + const int lnbIndex = 3; + + auto idCombinations = generateIdCombinations(deviceIds); + // TODO : Find a better way to vary diseqcMsgs, if at all + for (auto& combo : idCombinations) { + const string feId = combo[frontendIndex]; + auto type = frontendMap[feId].type; + if (type == FrontendType::DVBS || type == FrontendType::ISDBS || + type == FrontendType::ISDBS3) { + LnbRecordHardwareConnections mLnbRecord; + mLnbRecord.frontendId = feId; + mLnbRecord.recordFilterId = combo[recordFilterIndex]; + mLnbRecord.dvrRecordId = combo[dvrIndex]; + mLnbRecord.lnbId = combo[lnbIndex]; + mLnbRecord.diseqcMsgs = diseqcMsgs; + combinations.push_back(mLnbRecord); + } + } + + return combinations; +} + +static inline vector generateLnbRecordConfigurations() { + vector lnbRecord_configs; + if (configuredLnbRecord) { + ALOGD("Using LnbRecord configuration provided."); + lnbRecord_configs = {lnbRecord}; + } else { + ALOGD("LnbRecord not provided. Generating possible combinations. Consider adding it to " + "the configuration file."); + lnbRecord_configs = generateLnbRecordCombinations(); + } + + return lnbRecord_configs; +} + /** Config all the frontends that would be used in the tests */ inline void initFrontendConfig() { // The test will use the internal default fe when default fe is connected to any data flow @@ -425,7 +474,7 @@ inline void determineDvrRecord() { return; } if (frontendMap.empty() && playbackDvrIds.empty()) { - ALOGD("Cannot support dvr record. No frontends and no playback dvr's"); + ALOGD("Cannot support dvr record. No frontends and no playback dvr's"); return; } if (hasSwFe && !hasHwFe && playbackDvrIds.empty()) { From f4e0796ef34e596d527239ce94274b61187a9cc9 Mon Sep 17 00:00:00 2001 From: Frankie Lizcano Date: Wed, 13 Jul 2022 20:54:34 +0000 Subject: [PATCH 148/998] Improve Tuner VTS: Generate Descrambling Combos This CL allows the VTS to read a vendor's configuration file, determine if the given devices could support the Descrambling dataflow, and generate all combinations of units to run them on corresponding integration tests. Each combination is error checked to ensure they meet the minumum requirements, and any invalid ones are discared, which may narrow the combination space immensely. Bug: b/182519645 Test: vts-tradefed run vts --module VtsHalTvTunerTargetTest. Manual tests with different input configuration files. Change-Id: Ic1b9dae6b43f8f01bc4e490ef9e910a933562bd2 --- .../functional/VtsHalTvTunerTargetTest.cpp | 60 +++++++++----- .../vts/functional/VtsHalTvTunerTargetTest.h | 1 + .../VtsHalTvTunerTestConfigurations.h | 81 +++++++++++++++++++ .../config/TunerTestingConfigAidlReaderV1_0.h | 2 + 4 files changed, 123 insertions(+), 21 deletions(-) diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp index a6c523f3de..e6c66911d8 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp @@ -1073,25 +1073,34 @@ TEST_P(TunerDescramblerAidlTest, CreateDescrambler) { if (!descrambling.support) { return; } - int32_t demuxId; - std::shared_ptr demux; - ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); - - if (descrambling.hasFrontendConnection) { - int32_t feId; - mFrontendTests.getFrontendIdByType(frontendMap[descrambling.frontendId].type, feId); - ASSERT_TRUE(feId != INVALID_ID); - ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); - ASSERT_TRUE(mFrontendTests.setFrontendCallback()); - ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); + vector descrambling_configs = + generateDescramblingConfigurations(); + if (descrambling_configs.empty()) { + ALOGD("No valid descrambling combinations in the configuration file."); + return; } + for (auto& combination : descrambling_configs) { + descrambling = combination; + int32_t demuxId; + std::shared_ptr demux; + ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); - ASSERT_TRUE(mDescramblerTests.openDescrambler(demuxId)); - ASSERT_TRUE(mDescramblerTests.closeDescrambler()); - ASSERT_TRUE(mDemuxTests.closeDemux()); + if (descrambling.hasFrontendConnection) { + int32_t feId; + mFrontendTests.getFrontendIdByType(frontendMap[descrambling.frontendId].type, feId); + ASSERT_TRUE(feId != INVALID_ID); + ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); + ASSERT_TRUE(mFrontendTests.setFrontendCallback()); + ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); + } - if (descrambling.hasFrontendConnection) { - ASSERT_TRUE(mFrontendTests.closeFrontend()); + ASSERT_TRUE(mDescramblerTests.openDescrambler(demuxId)); + ASSERT_TRUE(mDescramblerTests.closeDescrambler()); + ASSERT_TRUE(mDemuxTests.closeDemux()); + + if (descrambling.hasFrontendConnection) { + ASSERT_TRUE(mFrontendTests.closeFrontend()); + } } } @@ -1100,11 +1109,20 @@ TEST_P(TunerDescramblerAidlTest, ScrambledBroadcastDataFlowMediaFiltersTest) { if (!descrambling.support) { return; } - set filterConfs; - filterConfs.insert(static_cast(filterMap[descrambling.audioFilterId])); - filterConfs.insert(static_cast(filterMap[descrambling.videoFilterId])); - scrambledBroadcastTest(filterConfs, frontendMap[descrambling.frontendId], - descramblerMap[descrambling.descramblerId]); + vector descrambling_configs = + generateDescramblingConfigurations(); + if (descrambling_configs.empty()) { + ALOGD("No valid descrambling combinations in the configuration file."); + return; + } + for (auto& combination : descrambling_configs) { + descrambling = combination; + set filterConfs; + filterConfs.insert(static_cast(filterMap[descrambling.audioFilterId])); + filterConfs.insert(static_cast(filterMap[descrambling.videoFilterId])); + scrambledBroadcastTest(filterConfs, frontendMap[descrambling.frontendId], + descramblerMap[descrambling.descramblerId]); + } } INSTANTIATE_TEST_SUITE_P(PerInstance, TunerBroadcastAidlTest, diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h index d6b852f62a..6ffa18f5bd 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h @@ -69,6 +69,7 @@ void clearIds() { diseqcMsgs.clear(); frontendIds.clear(); recordDvrIds.clear(); + descramblerIds.clear(); audioFilterIds.clear(); videoFilterIds.clear(); playbackDvrIds.clear(); diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h index bcc8c61e0d..de12dc0efa 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h @@ -297,6 +297,87 @@ static inline vector generateLnbRecordConfiguratio return lnbRecord_configs; } +/* + * index 0 - decramblers + * index 1 - frontends + * index 2 - audio filters + * index 3 - video filters + * index 4 - Dvr SW Fe Connections + * index 5 - DVR Source Connections + */ +static inline vector generateDescramblingCombinations() { + vector combinations; + vector mfrontendIds = frontendIds; + vector mDvrFeConnectionIds = playbackDvrIds; + vector mDvrSourceConnectionIds = playbackDvrIds; + + // Add the empty hardware id to each vector to include combinations where these 3 fields might + // be optional + mfrontendIds.push_back(emptyHardwareId); + mDvrFeConnectionIds.push_back(emptyHardwareId); + mDvrSourceConnectionIds.push_back(emptyHardwareId); + + const int descramblerIndex = 0; + const int frontendIndex = 1; + const int audioFilterIndex = 2; + const int videoFilterIndex = 3; + const int dvrFeIdIndex = 4; + const int dvrSourceIdIndex = 5; + + vector> deviceIds{descramblerIds, mfrontendIds, audioFilterIds, + videoFilterIds, mDvrFeConnectionIds, mDvrSourceConnectionIds}; + auto idCombinations = generateIdCombinations(deviceIds); + for (auto& combo : idCombinations) { + DescramblingHardwareConnections mDescrambling; + const string feId = combo[frontendIndex]; + const string dvrSwFeId = combo[dvrFeIdIndex]; + const string dvrSourceId = combo[dvrSourceIdIndex]; + mDescrambling.hasFrontendConnection = feId.compare(emptyHardwareId) == 0 ? false : true; + if (!mDescrambling.hasFrontendConnection) { + if (dvrSourceId.compare(emptyHardwareId) == 0) { + // If combination does not have a frontend or dvr source connection, do not include + // it + continue; + } + } else { + if (frontendMap[feId].isSoftwareFe && dvrSwFeId.compare(emptyHardwareId) == 0) { + // If combination has a software frontend and no dvr->software frontend connection, + // do not include it + continue; + } + } + if (dvrSwFeId.compare(dvrSourceId) == 0) { + // If dvr->software frontend connection is the same as dvr source input to tuner, do not + // include it. + continue; + } + mDescrambling.frontendId = feId; + mDescrambling.audioFilterId = combo[audioFilterIndex]; + mDescrambling.videoFilterId = combo[videoFilterIndex]; + mDescrambling.dvrSoftwareFeId = dvrSwFeId; + mDescrambling.dvrSourceId = dvrSourceId; + mDescrambling.descramblerId = combo[descramblerIndex]; + combinations.push_back(mDescrambling); + } + + return combinations; +} + +static inline vector generateDescramblingConfigurations() { + vector descrambling_configs; + if (configuredDescrambling) { + ALOGD("Using Descrambling configuration provided."); + descrambling_configs = {descrambling}; + } else { + ALOGD("Descrambling not provided. Generating possible combinations. Consider adding it to " + "the " + "configuration file."); + descrambling_configs = generateDescramblingCombinations(); + } + + return descrambling_configs; +} + /** Config all the frontends that would be used in the tests */ inline void initFrontendConfig() { // The test will use the internal default fe when default fe is connected to any data flow diff --git a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h index 31f07553d1..53246d38d8 100644 --- a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h +++ b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h @@ -87,6 +87,7 @@ static vector sectionFilterIds; static vector frontendIds; static vector lnbIds; static vector diseqcMsgs; +static vector descramblerIds; #define PROVISION_STR \ "{ " \ @@ -461,6 +462,7 @@ struct TunerTestingConfigAidlReader1_0 { auto descramblers = *hardwareConfig.getFirstDescramblers(); for (auto descramblerConfig : descramblers.getDescrambler()) { string id = descramblerConfig.getId(); + descramblerIds.push_back(id); descramblerMap[id].casSystemId = static_cast(descramblerConfig.getCasSystemId()); if (descramblerConfig.hasProvisionStr()) { From 11afa26d34f354553eb1e0dd69d32a7faa780d93 Mon Sep 17 00:00:00 2001 From: Lucas Gates Date: Wed, 20 Jul 2022 21:10:51 +0000 Subject: [PATCH 149/998] TunerHAL Fix filterDispatcher returning false The Dvr::startFilterDispatcher method is intended to call the startFilterHandler method on every filter by using pass through methods in the Demux. However, the method currently returns early with a failure (false return value) whenever isVirtualFrontend and isRecording are both false. This causes the thread that the method is called from to immediately log and exit. This error occurs when the Dvr::startFilterDispatcher method is called from the Dvr threadloop, but not when it is called from the Demux threadloop due to their different parameters. As noted by current bug 239731089, this means that this error is only exhibited inconsistently due to a race condition. Bug: 237718541 Test: Manually using Cuttlefish, as well as VTS. Previous inconsistent Dvr filtering errors no longer occur. Change-Id: I677b66bdc0dacf1a7d57bcbd3085ffd6475547dd --- tv/tuner/aidl/default/Dvr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tv/tuner/aidl/default/Dvr.cpp b/tv/tuner/aidl/default/Dvr.cpp index c591d079a8..9928a5958e 100644 --- a/tv/tuner/aidl/default/Dvr.cpp +++ b/tv/tuner/aidl/default/Dvr.cpp @@ -427,7 +427,7 @@ bool Dvr::startFilterDispatcher(bool isVirtualFrontend, bool isRecording) { map>::iterator it; // Handle the output data per filter type for (it = mFilters.begin(); it != mFilters.end(); it++) { - if (mDemux->startFilterHandler(it->first).isOk()) { + if (!mDemux->startFilterHandler(it->first).isOk()) { return false; } } From d2c09c47034c1275c1ea97fd17fa239c23c7ae00 Mon Sep 17 00:00:00 2001 From: Frankie Lizcano Date: Thu, 21 Jul 2022 00:02:35 +0000 Subject: [PATCH 150/998] Improve VTS: Allow Extra Filters for Live and Playback This CL allows vendors to specify extra filters they would like to include in the Live dataflow. Note, however, that these filters are not included in any integration tests yet, as those will come later. Additionally, this CL cleans up the code originally used to configure extra filters for DVR playback. It converts the code and API strucutre to a uniform format consistent with that of other dataflows that allow extra filters. Bug: b/239751563 Test: vts-tradefed run vts --module VtsHalTvTunerTargetTest Change-Id: I662814666873254eff84791b5057da1f44f5e73e --- tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h | 14 ++++++++------ tv/tuner/config/api/current.txt | 11 ++++------- .../config/tuner_testing_dynamic_configuration.xsd | 12 ++---------- 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h index 7c757b4ebb..d964d60b82 100644 --- a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h +++ b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h @@ -155,6 +155,7 @@ struct LiveBroadcastHardwareConnections { string ipFilterId; string pcrFilterId; /* list string of extra filters; */ + vector extraFilters; }; struct ScanHardwareConnections { @@ -530,6 +531,10 @@ struct TunerTestingConfigAidlReader1_0 { } else { live.ipFilterId = emptyHardwareId; } + if (liveConfig.hasOptionalFilters()) { + auto optionalFilters = liveConfig.getOptionalFilters(); + live.extraFilters = optionalFilters; + } } static void connectScan(ScanHardwareConnections& scan) { @@ -563,12 +568,9 @@ struct TunerTestingConfigAidlReader1_0 { } else { playback.sectionFilterId = emptyHardwareId; } - if (playbackConfig.hasOptionalFilters() && !playback.hasExtraFilters) { - auto optionalFilters = playbackConfig.getFirstOptionalFilters()->getOptionalFilter(); - for (size_t i = 0; i < optionalFilters.size(); ++i) { - playback.extraFilters.push_back(optionalFilters[i].getFilterId()); - } - playback.hasExtraFilters = true; + if (playbackConfig.hasOptionalFilters()) { + auto optionalFilters = playbackConfig.getOptionalFilters(); + playback.extraFilters = optionalFilters; } } diff --git a/tv/tuner/config/api/current.txt b/tv/tuner/config/api/current.txt index 9b500c3cab..7ad7dcf5df 100644 --- a/tv/tuner/config/api/current.txt +++ b/tv/tuner/config/api/current.txt @@ -47,6 +47,7 @@ package android.media.tuner.testing.configuration.V1_0 { method @Nullable public String getDvrSoftwareFeConnection(); method @Nullable public String getFrontendConnection(); method @Nullable public String getIpFilterConnection(); + method @Nullable public java.util.List getOptionalFilters(); method @Nullable public String getPcrFilterConnection(); method @Nullable public String getSectionFilterConnection(); method @Nullable public String getVideoFilterConnection(); @@ -54,6 +55,7 @@ package android.media.tuner.testing.configuration.V1_0 { method public void setDvrSoftwareFeConnection(@Nullable String); method public void setFrontendConnection(@Nullable String); method public void setIpFilterConnection(@Nullable String); + method public void setOptionalFilters(@Nullable java.util.List); method public void setPcrFilterConnection(@Nullable String); method public void setSectionFilterConnection(@Nullable String); method public void setVideoFilterConnection(@Nullable String); @@ -83,21 +85,16 @@ package android.media.tuner.testing.configuration.V1_0 { ctor public DataFlowConfiguration.DvrPlayback(); method @Nullable public String getAudioFilterConnection(); method @Nullable public String getDvrConnection(); - method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.DvrPlayback.OptionalFilters getOptionalFilters(); + method @Nullable public java.util.List getOptionalFilters(); method @Nullable public String getSectionFilterConnection(); method @Nullable public String getVideoFilterConnection(); method public void setAudioFilterConnection(@Nullable String); method public void setDvrConnection(@Nullable String); - method public void setOptionalFilters(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.DvrPlayback.OptionalFilters); + method public void setOptionalFilters(@Nullable java.util.List); method public void setSectionFilterConnection(@Nullable String); method public void setVideoFilterConnection(@Nullable String); } - public static class DataFlowConfiguration.DvrPlayback.OptionalFilters { - ctor public DataFlowConfiguration.DvrPlayback.OptionalFilters(); - method @Nullable public java.util.List getOptionalFilter(); - } - public static class DataFlowConfiguration.DvrRecord { ctor public DataFlowConfiguration.DvrRecord(); method @Nullable public String getDvrRecordConnection(); diff --git a/tv/tuner/config/tuner_testing_dynamic_configuration.xsd b/tv/tuner/config/tuner_testing_dynamic_configuration.xsd index ee768ba92c..e67f623d59 100644 --- a/tv/tuner/config/tuner_testing_dynamic_configuration.xsd +++ b/tv/tuner/config/tuner_testing_dynamic_configuration.xsd @@ -644,7 +644,7 @@ - + @@ -665,7 +665,6 @@ - @@ -679,14 +678,7 @@ - - - - - - - - + From d989a4b66926a6d5fc089f70399f156cd5d3e5a3 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Thu, 21 Jul 2022 00:21:08 +0000 Subject: [PATCH 151/998] audio: Prevent priority inversions in aidl StreamWorker Avoid taking a lock in high priority worker threads without a real need. Bug: 205884982 Test: atest libaudioaidlcommon_test --iterations Change-Id: I8cc0f5cb58752b7b7d413a9f4e46093c39445892 --- audio/aidl/common/include/StreamWorker.h | 29 ++++++++++++++++++- .../aidl/common/tests/streamworker_tests.cpp | 12 ++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/audio/aidl/common/include/StreamWorker.h b/audio/aidl/common/include/StreamWorker.h index 8a273dc7f2..74e99df4cd 100644 --- a/audio/aidl/common/include/StreamWorker.h +++ b/audio/aidl/common/include/StreamWorker.h @@ -18,6 +18,7 @@ #include +#include #include #include #include @@ -39,6 +40,7 @@ class StreamWorker { android::base::ScopedLockAssertion lock_assertion(mWorkerLock); return mWorkerState != WorkerState::STOPPED; }); + mWorkerStateChangeRequest = false; return mWorkerState == WorkerState::RUNNING; } void pause() { switchWorkerStateSync(WorkerState::RUNNING, WorkerState::PAUSE_REQUESTED); } @@ -52,6 +54,7 @@ class StreamWorker { std::lock_guard lock(mWorkerLock); if (mWorkerState == WorkerState::STOPPED) return; mWorkerState = WorkerState::STOPPED; + mWorkerStateChangeRequest = true; } if (mWorker.joinable()) { mWorker.join(); @@ -64,6 +67,10 @@ class StreamWorker { switchWorkerStateSync(newState, WorkerState::RESUME_REQUESTED, &newState); return newState == WorkerState::RUNNING; } + // Only used by unit tests. + void testLockUnlockMutex(bool lock) NO_THREAD_SAFETY_ANALYSIS { + lock ? mWorkerLock.lock() : mWorkerLock.unlock(); + } // Methods that need to be provided by subclasses: // @@ -87,6 +94,7 @@ class StreamWorker { return; } mWorkerState = newState; + mWorkerStateChangeRequest = true; mWorkerCv.wait(lock, [&]() { android::base::ScopedLockAssertion lock_assertion(mWorkerLock); return mWorkerState != newState; @@ -106,6 +114,11 @@ class StreamWorker { bool needToNotify = false; if (state != WorkerState::PAUSED ? static_cast(this)->workerCycle() : (sched_yield(), true)) { + { + // See https://developer.android.com/training/articles/smp#nonracing + android::base::ScopedLockAssertion lock_assertion(mWorkerLock); + if (!mWorkerStateChangeRequest.load(std::memory_order_relaxed)) continue; + } // // Pause and resume are synchronous. One worker cycle must complete // before the worker indicates a state change. This is how 'mWorkerState' and @@ -123,10 +136,10 @@ class StreamWorker { // first workerCycle gets executed, the code below triggers a client notification // (or if workerCycle fails, worker enters 'error' state and also notifies) // state := mWorkerState (RUNNING) + std::lock_guard lock(mWorkerLock); if (state == WorkerState::RESUME_REQUESTED) { needToNotify = true; } - std::lock_guard lock(mWorkerLock); state = mWorkerState; if (mWorkerState == WorkerState::PAUSE_REQUESTED) { state = mWorkerState = WorkerState::PAUSED; @@ -144,6 +157,10 @@ class StreamWorker { state = WorkerState::STOPPED; } if (needToNotify) { + { + std::lock_guard lock(mWorkerLock); + mWorkerStateChangeRequest = false; + } mWorkerCv.notify_one(); } } @@ -153,4 +170,14 @@ class StreamWorker { std::mutex mWorkerLock; std::condition_variable mWorkerCv; WorkerState mWorkerState GUARDED_BY(mWorkerLock) = WorkerState::STOPPED; + // The atomic lock-free variable is used to prevent priority inversions + // that can occur when a high priority worker tries to acquire the lock + // which has been taken by a lower priority control thread which in its turn + // got preempted. To prevent a PI under normal operating conditions, that is, + // when there are no errors or state changes, the worker does not attempt + // taking `mWorkerLock` unless `mWorkerStateChangeRequest` is set. + // To make sure that updates to `mWorkerState` and `mWorkerStateChangeRequest` + // are serialized, they are always made under a lock. + static_assert(std::atomic::is_always_lock_free); + std::atomic mWorkerStateChangeRequest GUARDED_BY(mWorkerLock) = false; }; diff --git a/audio/aidl/common/tests/streamworker_tests.cpp b/audio/aidl/common/tests/streamworker_tests.cpp index bb354e58d4..c9d3dbd5ee 100644 --- a/audio/aidl/common/tests/streamworker_tests.cpp +++ b/audio/aidl/common/tests/streamworker_tests.cpp @@ -207,4 +207,16 @@ TEST_P(StreamWorkerTest, WaitForAtLeastOneCycleError) { EXPECT_FALSE(worker.waitForAtLeastOneCycle()); } +TEST_P(StreamWorkerTest, MutexDoesNotBlockWorker) { + ASSERT_TRUE(worker.start()); + const size_t workerCyclesBefore = worker.getWorkerCycles(); + worker.testLockUnlockMutex(true); + while (worker.getWorkerCycles() == workerCyclesBefore) { + usleep(kWorkerIdleCheckTime); + } + worker.testLockUnlockMutex(false); + worker.waitForAtLeastOneCycle(); + EXPECT_FALSE(worker.hasError()); +} + INSTANTIATE_TEST_SUITE_P(StreamWorker, StreamWorkerTest, testing::Bool()); From 4ae40f5b583cf0d9f96089ccc829fb722471c452 Mon Sep 17 00:00:00 2001 From: Bob Badour Date: Thu, 21 Jul 2022 11:22:54 -0700 Subject: [PATCH 152/998] [LSC] Add LOCAL_LICENSE_KINDS to hardware/interfaces Added SPDX-license-identifier-Apache-2.0 to: automotive/vehicle/aidl/impl/default_config/config/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Change-Id: I2aca43eea19ea7bf43b34133e0dda79a54cefa90 --- .../vehicle/aidl/impl/default_config/config/Android.bp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/config/Android.bp b/automotive/vehicle/aidl/impl/default_config/config/Android.bp index 3f9edca833..c5f86c201f 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/Android.bp +++ b/automotive/vehicle/aidl/impl/default_config/config/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + filegroup { name: "VehicleHalDefaultProperties_JSON", srcs: ["DefaultProperties.json"], From 394c3bf7168601ece6e1958626f568a61c277512 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Thu, 21 Jul 2022 20:35:06 +0000 Subject: [PATCH 153/998] Update prop config to reflect new prop changes. Bug: 239854883 Test: Presubmit Change-Id: Ib6f9246b4ad4adc9c7782e6156819e2fd866f4c0 --- .../config/DefaultProperties.json | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 491524f831..f2415aaaa7 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -330,9 +330,13 @@ "property": "VehicleProperty::VEHICLE_CURB_WEIGHT", "defaultValue": { "int32Values": [ - 30 + 2211 ] - } + }, + "configArray": [ + 2948 + ], + "comment": "unit is kg" }, { "property": "VehicleProperty::RANGE_REMAINING", @@ -482,6 +486,14 @@ "VehicleUnit::US_GALLON" ] }, + { + "property": "VehicleProperty::FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME", + "defaultValue": { + "int32Values": [ + 1 + ] + } + }, { "property": "VehicleProperty::HW_KEY_INPUT", "defaultValue": { @@ -1190,14 +1202,6 @@ ] } }, - { - "property": "VehicleProperty::FOG_LIGHTS_SWITCH", - "defaultValue": { - "int32Values": [ - "Constants::LIGHT_SWITCH_AUTO" - ] - } - }, { "property": "VehicleProperty::FRONT_FOG_LIGHTS_SWITCH", "defaultValue": { From 2b162da56a69a88936b258c1676cf3756f8b064f Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Thu, 21 Jul 2022 18:11:21 +0000 Subject: [PATCH 154/998] Implement waiting for IPv4 address for an interface Bug: 239577572 Test: build, flash, check Internet Change-Id: I339d6ae595fac13690a90d98ef82a6659819406c --- .../can/1.0/default/libnetdevice/ifreqs.cpp | 9 +- .../can/1.0/default/libnetdevice/ifreqs.h | 9 ++ .../include/libnetdevice/libnetdevice.h | 16 ++- .../1.0/default/libnetdevice/libnetdevice.cpp | 101 +++++++++++----- automotive/can/1.0/default/libnl++/Android.bp | 2 + .../libnl++/protocols/MessageDefinition.cpp | 2 +- .../libnl++/protocols/MessageDefinition.h | 4 +- .../can/1.0/default/libnl++/protocols/all.cpp | 10 +- .../default/libnl++/protocols/route/Addr.cpp | 58 ++++++++++ .../default/libnl++/protocols/route/Addr.h | 31 +++++ .../default/libnl++/protocols/route/Link.cpp | 84 +------------- .../default/libnl++/protocols/route/Route.cpp | 8 +- .../libnl++/protocols/route/attributes.cpp | 109 ++++++++++++++++++ .../libnl++/protocols/route/attributes.h | 25 ++++ .../libnl++/protocols/route/structs.cpp | 54 +++++++++ .../default/libnl++/protocols/route/structs.h | 3 + .../1.0/default/libnl++/protocols/structs.cpp | 33 +++--- .../1.0/default/libnl++/protocols/structs.h | 1 + 18 files changed, 423 insertions(+), 136 deletions(-) create mode 100644 automotive/can/1.0/default/libnl++/protocols/route/Addr.cpp create mode 100644 automotive/can/1.0/default/libnl++/protocols/route/Addr.h create mode 100644 automotive/can/1.0/default/libnl++/protocols/route/attributes.cpp create mode 100644 automotive/can/1.0/default/libnl++/protocols/route/attributes.h diff --git a/automotive/can/1.0/default/libnetdevice/ifreqs.cpp b/automotive/can/1.0/default/libnetdevice/ifreqs.cpp index 8df6434796..8471173d24 100644 --- a/automotive/can/1.0/default/libnetdevice/ifreqs.cpp +++ b/automotive/can/1.0/default/libnetdevice/ifreqs.cpp @@ -47,7 +47,7 @@ static SocketParams getSocketParams(int domain) { return params; } -bool send(unsigned long request, struct ifreq& ifr) { +int trySend(unsigned long request, struct ifreq& ifr) { const auto sp = getSocketParams(socketDomain); base::unique_fd sock(socket(sp.domain, sp.type, sp.protocol)); if (!sock.ok()) { @@ -55,7 +55,12 @@ bool send(unsigned long request, struct ifreq& ifr) { return false; } - if (ioctl(sock.get(), request, &ifr) < 0) { + if (ioctl(sock.get(), request, &ifr) < 0) return errno; + return 0; +} + +bool send(unsigned long request, struct ifreq& ifr) { + if (trySend(request, ifr) != 0) { PLOG(ERROR) << "ioctl(" << std::hex << request << std::dec << ") failed"; return false; } diff --git a/automotive/can/1.0/default/libnetdevice/ifreqs.h b/automotive/can/1.0/default/libnetdevice/ifreqs.h index 74e58775b6..d8d6fe0cd4 100644 --- a/automotive/can/1.0/default/libnetdevice/ifreqs.h +++ b/automotive/can/1.0/default/libnetdevice/ifreqs.h @@ -27,6 +27,15 @@ namespace android::netdevice::ifreqs { */ extern std::atomic_int socketDomain; +/** + * Tries to send ioctl interface request. + * + * \param request Request type (such as SIOCGIFFLAGS) + * \param ifr Request data (both input and output) + * \return error code of the call (0 for success) + */ +int trySend(unsigned long request, struct ifreq& ifr); + /** * Sends ioctl interface request. * diff --git a/automotive/can/1.0/default/libnetdevice/include/libnetdevice/libnetdevice.h b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/libnetdevice.h index 70cb688933..657f9b2cc6 100644 --- a/automotive/can/1.0/default/libnetdevice/include/libnetdevice/libnetdevice.h +++ b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/libnetdevice.h @@ -67,21 +67,33 @@ enum class WaitCondition { */ PRESENT_AND_UP, + /** + * Interface is up and with IPv4 address configured. + */ + PRESENT_AND_IPV4, + /** * Interface is down or not present (disconnected) at all. */ DOWN_OR_GONE, }; +enum class Quantifier { + ALL_OF, + ANY_OF, +}; + /** * Listens for interface changes until anticipated condition takes place. * * \param ifnames List of interfaces to watch for. * \param cnd Awaited condition. - * \param allOf true if all interfaces need to satisfy the condition, false if only one satistying + * \param quant Whether all interfaces need to satisfy the condition or just one satistying * interface should stop the wait. + * \return name of one interface that satisfied the condition */ -void waitFor(std::set ifnames, WaitCondition cnd, bool allOf = true); +std::optional waitFor(std::set ifnames, WaitCondition cnd, + Quantifier quant = Quantifier::ALL_OF); /** * Brings network interface up. diff --git a/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp b/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp index 4c5b30928f..17f1cbc8bc 100644 --- a/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp +++ b/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp @@ -100,23 +100,36 @@ std::optional isUp(std::string ifname) { return ifr.ifr_flags & IFF_UP; } +static bool hasIpv4(std::string ifname) { + auto ifr = ifreqs::fromName(ifname); + switch (const auto status = ifreqs::trySend(SIOCGIFADDR, ifr)) { + case 0: + return true; + case EADDRNOTAVAIL: + case ENODEV: + return false; + default: + PLOG(WARNING) << "Failed checking IPv4 address"; + return false; + } +} + struct WaitState { bool present; bool up; + bool hasIpv4Addr; bool satisfied(WaitCondition cnd) const { switch (cnd) { case WaitCondition::PRESENT: - if (present) return true; - break; + return present; case WaitCondition::PRESENT_AND_UP: - if (present && up) return true; - break; + return present && up; + case WaitCondition::PRESENT_AND_IPV4: + return present && up && hasIpv4Addr; case WaitCondition::DOWN_OR_GONE: - if (!present || !up) return true; - break; + return !present || !up; } - return false; } }; @@ -126,11 +139,22 @@ static std::string toString(WaitCondition cnd) { return "become present"; case WaitCondition::PRESENT_AND_UP: return "come up"; + case WaitCondition::PRESENT_AND_IPV4: + return "get IPv4 address"; case WaitCondition::DOWN_OR_GONE: return "go down"; } } +static std::string toString(Quantifier quant) { + switch (quant) { + case Quantifier::ALL_OF: + return "all of"; + case Quantifier::ANY_OF: + return "any of"; + } +} + static std::string toString(const std::set& ifnames) { std::stringstream ss; std::copy(ifnames.begin(), ifnames.end(), std::ostream_iterator(ss, ",")); @@ -139,50 +163,73 @@ static std::string toString(const std::set& ifnames) { return str; } -void waitFor(std::set ifnames, WaitCondition cnd, bool allOf) { - nl::Socket sock(NETLINK_ROUTE, 0, RTMGRP_LINK); +std::optional waitFor(std::set ifnames, WaitCondition cnd, + Quantifier quant) { + nl::Socket sock(NETLINK_ROUTE, 0, RTMGRP_LINK | RTMGRP_IPV4_IFADDR); using StatesMap = std::map; StatesMap states = {}; for (const auto ifname : ifnames) { const auto present = exists(ifname); const auto up = present && isUp(ifname).value_or(false); - states[ifname] = {present, up}; + const auto hasIpv4Addr = present && hasIpv4(ifname); + states[ifname] = {present, up, hasIpv4Addr}; } const auto mapConditionChecker = [cnd](const StatesMap::iterator::value_type& it) { return it.second.satisfied(cnd); }; - const auto isFullySatisfied = [&states, allOf, mapConditionChecker]() { - if (allOf) { - return std::all_of(states.begin(), states.end(), mapConditionChecker); - } else { - return std::any_of(states.begin(), states.end(), mapConditionChecker); + const auto isFullySatisfied = [&states, quant, + mapConditionChecker]() -> std::optional { + if (quant == Quantifier::ALL_OF) { + if (!std::all_of(states.begin(), states.end(), mapConditionChecker)) return {}; + return states.begin()->first; + } else { // Quantifier::ANY_OF + const auto it = std::find_if(states.begin(), states.end(), mapConditionChecker); + if (it == states.end()) return {}; + return it->first; } }; - if (isFullySatisfied()) return; + if (const auto iface = isFullySatisfied()) return iface; - LOG(DEBUG) << "Waiting for " << (allOf ? "" : "any of ") << toString(ifnames) << " to " + LOG(DEBUG) << "Waiting for " << toString(quant) << " " << toString(ifnames) << " to " << toString(cnd); for (const auto rawMsg : sock) { - const auto msg = nl::Message::parse(rawMsg, {RTM_NEWLINK, RTM_DELLINK}); - if (!msg.has_value()) continue; + if (const auto msg = nl::Message::parse(rawMsg, {RTM_NEWLINK, RTM_DELLINK}); + msg.has_value()) { + // Interface added / removed + const auto ifname = msg->attributes.get(IFLA_IFNAME); + if (ifnames.count(ifname) == 0) continue; - const auto ifname = msg->attributes.get(IFLA_IFNAME); - if (ifnames.count(ifname) == 0) continue; + auto& state = states[ifname]; + state.present = (msg->header.nlmsg_type != RTM_DELLINK); + state.up = state.present && (msg->data.ifi_flags & IFF_UP) != 0; + if (!state.present) state.hasIpv4Addr = false; - const bool present = (msg->header.nlmsg_type != RTM_DELLINK); - const bool up = present && (msg->data.ifi_flags & IFF_UP) != 0; - states[ifname] = {present, up}; + } else if (const auto msg = + nl::Message::parse(rawMsg, {RTM_NEWADDR, RTM_DELADDR}); + msg.has_value()) { + // Address added / removed + const auto ifname = msg->attributes.get(IFLA_IFNAME); + if (ifnames.count(ifname) == 0) continue; - if (isFullySatisfied()) { - LOG(DEBUG) << "Finished waiting for " << (allOf ? "" : "some of ") << toString(ifnames) + if (msg->header.nlmsg_type == RTM_NEWADDR) { + states[ifname].hasIpv4Addr = true; + } else { + // instead of tracking which one got deleted, let's just ask + states[ifname].hasIpv4Addr = hasIpv4(ifname); + } + } + + if (const auto iface = isFullySatisfied()) { + LOG(DEBUG) << "Finished waiting for " << toString(quant) << " " << toString(ifnames) << " to " << toString(cnd); - return; + return iface; } } LOG(FATAL) << "Can't read Netlink socket"; + return {}; } } // namespace android::netdevice diff --git a/automotive/can/1.0/default/libnl++/Android.bp b/automotive/can/1.0/default/libnl++/Android.bp index 2ebd1b4732..01c1e55ca9 100644 --- a/automotive/can/1.0/default/libnl++/Android.bp +++ b/automotive/can/1.0/default/libnl++/Android.bp @@ -37,8 +37,10 @@ cc_library_static { "protocols/generic/Unknown.cpp", "protocols/generic/families/Mac80211hwsim.cpp", "protocols/generic/families/Nl80211.cpp", + "protocols/route/Addr.cpp", "protocols/route/Link.cpp", "protocols/route/Route.cpp", + "protocols/route/attributes.cpp", "protocols/route/structs.cpp", "protocols/MessageDefinition.cpp", "protocols/NetlinkProtocol.cpp", diff --git a/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.cpp b/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.cpp index aaf24a53aa..158d2a1e95 100644 --- a/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.cpp +++ b/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.cpp @@ -34,7 +34,7 @@ const AttributeDefinition AttributeMap::operator[](nlattrtype_t nla_type) const MessageDescriptor::MessageDescriptor(const std::string& name, const MessageDetailsMap&& messageDetails, - const AttributeMap&& attrTypes, size_t contentsSize) + const AttributeMap& attrTypes, size_t contentsSize) : mName(name), mContentsSize(contentsSize), mMessageDetails(messageDetails), diff --git a/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.h b/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.h index 8bed5e7a7e..33ded9a44d 100644 --- a/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.h +++ b/automotive/can/1.0/default/libnl++/protocols/MessageDefinition.h @@ -163,7 +163,7 @@ class MessageDescriptor { protected: MessageDescriptor(const std::string& name, const MessageDetailsMap&& messageDetails, - const AttributeMap&& attrTypes, size_t contentsSize); + const AttributeMap& attrTypes, size_t contentsSize); private: const std::string mName; @@ -183,7 +183,7 @@ class MessageDefinition : public MessageDescriptor { MessageDefinition( // const std::string& name, const std::initializer_list msgDet, - const std::initializer_list attrTypes = {}) + const AttributeMap& attrTypes = {}) : MessageDescriptor(name, msgDet, attrTypes, sizeof(T)) {} void dataToStream(std::stringstream& ss, const Buffer hdr) const override { diff --git a/automotive/can/1.0/default/libnl++/protocols/all.cpp b/automotive/can/1.0/default/libnl++/protocols/all.cpp index a398dc8f1f..72c60f251f 100644 --- a/automotive/can/1.0/default/libnl++/protocols/all.cpp +++ b/automotive/can/1.0/default/libnl++/protocols/all.cpp @@ -33,12 +33,12 @@ static std::map> toMap( return map; } -static auto all = toMap({ - std::make_unique(), - std::make_unique(), -}); - std::optional> get(int protocol) { + static auto all = toMap({ + std::make_unique(), + std::make_unique(), + }); + if (all.count(protocol) == 0) return std::nullopt; return *all.find(protocol)->second.get(); } diff --git a/automotive/can/1.0/default/libnl++/protocols/route/Addr.cpp b/automotive/can/1.0/default/libnl++/protocols/route/Addr.cpp new file mode 100644 index 0000000000..024d3891b6 --- /dev/null +++ b/automotive/can/1.0/default/libnl++/protocols/route/Addr.cpp @@ -0,0 +1,58 @@ +/* + * 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. + */ + +#include "Addr.h" + +#include "../structs.h" +#include "attributes.h" +#include "structs.h" + +namespace android::nl::protocols::route { + +using DataType = AttributeDefinition::DataType; + +// clang-format off +Addr::Addr() : MessageDefinition("addr", { + {RTM_NEWADDR, {"NEWADDR", MessageGenre::New}}, + {RTM_DELADDR, {"DELADDR", MessageGenre::Delete}}, + {RTM_GETADDR, {"GETADDR", MessageGenre::Get}}, +}, gAttributes) {} + +static const FlagsMap ifaFlagsMap { + {IFA_F_SECONDARY, "SECONDARY"}, + {IFA_F_NODAD, "NODAD"}, + {IFA_F_OPTIMISTIC, "OPTIMISTIC"}, + {IFA_F_DADFAILED, "DADFAILED"}, + {IFA_F_HOMEADDRESS, "HOMEADDRESS"}, + {IFA_F_DEPRECATED, "DEPRECATED"}, + {IFA_F_TENTATIVE, "TENTATIVE"}, + {IFA_F_PERMANENT, "PERMANENT"}, + {IFA_F_MANAGETEMPADDR, "MANAGETEMPADDR"}, + {IFA_F_NOPREFIXROUTE, "NOPREFIXROUTE"}, + {IFA_F_MCAUTOJOIN, "MCAUTOJOIN"}, + {IFA_F_STABLE_PRIVACY, "STABLE_PRIVACY"}, +}; +// clang-format on + +void Addr::toStream(std::stringstream& ss, const ifaddrmsg& data) const { + ss << "ifaddrmsg{" + << "family=" << familyToString(data.ifa_family) + << ", prefixlen=" << unsigned(data.ifa_prefixlen) << ", flags="; + flagsToStream(ss, ifaFlagsMap, data.ifa_flags); + ss << ", scope=" << unsigned(data.ifa_scope) << ", index=" << data.ifa_index << "}"; +} + +} // namespace android::nl::protocols::route diff --git a/automotive/can/1.0/default/libnl++/protocols/route/Addr.h b/automotive/can/1.0/default/libnl++/protocols/route/Addr.h new file mode 100644 index 0000000000..b6b8bdca3f --- /dev/null +++ b/automotive/can/1.0/default/libnl++/protocols/route/Addr.h @@ -0,0 +1,31 @@ +/* + * 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. + */ + +#pragma once + +#include "../MessageDefinition.h" + +#include + +namespace android::nl::protocols::route { + +class Addr : public MessageDefinition { + public: + Addr(); + void toStream(std::stringstream& ss, const ifaddrmsg& data) const override; +}; + +} // namespace android::nl::protocols::route diff --git a/automotive/can/1.0/default/libnl++/protocols/route/Link.cpp b/automotive/can/1.0/default/libnl++/protocols/route/Link.cpp index 9cc05da027..3dd0066732 100644 --- a/automotive/can/1.0/default/libnl++/protocols/route/Link.cpp +++ b/automotive/can/1.0/default/libnl++/protocols/route/Link.cpp @@ -16,10 +16,7 @@ #include "Link.h" -#include "../structs.h" -#include "structs.h" - -#include +#include "attributes.h" namespace android::nl::protocols::route { @@ -30,83 +27,8 @@ Link::Link() : MessageDefinition("link", { {RTM_NEWLINK, {"NEWLINK", MessageGenre::New}}, {RTM_DELLINK, {"DELLINK", MessageGenre::Delete}}, {RTM_GETLINK, {"GETLINK", MessageGenre::Get}}, -}, { - {IFLA_ADDRESS, {"ADDRESS"}}, - {IFLA_BROADCAST, {"BROADCAST"}}, - {IFLA_IFNAME, {"IFNAME", DataType::String}}, - {IFLA_MTU, {"MTU", DataType::Uint}}, - {IFLA_LINK, {"LINK", DataType::Uint}}, - {IFLA_QDISC, {"QDISC", DataType::String}}, - {IFLA_STATS, {"STATS", DataType::Struct, statsToStream}}, - {IFLA_COST, {"COST"}}, - {IFLA_PRIORITY, {"PRIORITY"}}, - {IFLA_MASTER, {"MASTER", DataType::Uint}}, - {IFLA_WIRELESS, {"WIRELESS"}}, - {IFLA_PROTINFO, {"PROTINFO"}}, - {IFLA_TXQLEN, {"TXQLEN", DataType::Uint}}, - {IFLA_MAP, {"MAP", DataType::Struct, mapToStream}}, - {IFLA_WEIGHT, {"WEIGHT", DataType::Uint}}, - {IFLA_OPERSTATE, {"OPERSTATE", DataType::Uint}}, - {IFLA_LINKMODE, {"LINKMODE", DataType::Uint}}, - {IFLA_LINKINFO, {"LINKINFO", DataType::Nested, AttributeMap{ - {IFLA_INFO_KIND, {"INFO_KIND", DataType::String}}, - {IFLA_INFO_DATA, {"INFO_DATA", DataType::Nested}}, - {IFLA_INFO_XSTATS, {"INFO_XSTATS"}}, - {IFLA_INFO_SLAVE_KIND, {"INFO_SLAVE_KIND", DataType::String}}, - {IFLA_INFO_SLAVE_DATA, {"INFO_SLAVE_DATA"}}, - }}}, - {IFLA_NET_NS_PID, {"NET_NS_PID", DataType::Uint}}, - {IFLA_IFALIAS, {"IFALIAS", DataType::String}}, - {IFLA_NUM_VF, {"NUM_VF", DataType::Uint}}, - {IFLA_VFINFO_LIST, {"VFINFO_LIST"}}, - {IFLA_STATS64, {"STATS64", DataType::Struct, statsToStream}}, - {IFLA_VF_PORTS, {"VF_PORTS"}}, - {IFLA_PORT_SELF, {"PORT_SELF"}}, - {IFLA_AF_SPEC, {"AF_SPEC", DataType::Nested, AttributeMap{ - {AF_INET, {"AF_INET", DataType::Nested, AttributeMap{ - {IFLA_INET_CONF, {"INET_CONF", DataType::Struct, arrayToStream}}, - }}}, - {AF_INET6, {"AF_INET6", DataType::Nested, AttributeMap{ - {IFLA_INET6_FLAGS, {"INET6_FLAGS", DataType::Uint}}, - {IFLA_INET6_CONF, {"INET6_CONF", DataType::Struct, arrayToStream}}, - {IFLA_INET6_STATS, {"INET6_STATS", DataType::Struct, arrayToStream}}, - {IFLA_INET6_MCAST, {"INET6_MCAST"}}, - {IFLA_INET6_CACHEINFO, {"INET6_CACHEINFO", DataType::Struct, ifla_cacheinfoToStream}}, - {IFLA_INET6_ICMP6STATS, {"INET6_ICMP6STATS", DataType::Struct, arrayToStream}}, - {IFLA_INET6_TOKEN, {"INET6_TOKEN"}}, - {IFLA_INET6_ADDR_GEN_MODE, {"INET6_ADDR_GEN_MODE", DataType::Uint}}, - }}}, - }}}, - {IFLA_GROUP, {"GROUP", DataType::Uint}}, - {IFLA_NET_NS_FD, {"NET_NS_FD", DataType::Uint}}, - {IFLA_EXT_MASK, {"EXT_MASK", DataType::Uint}}, - {IFLA_PROMISCUITY, {"PROMISCUITY", DataType::Uint}}, - {IFLA_NUM_TX_QUEUES, {"NUM_TX_QUEUES", DataType::Uint}}, - {IFLA_NUM_RX_QUEUES, {"NUM_RX_QUEUES", DataType::Uint}}, - {IFLA_CARRIER, {"CARRIER", DataType::Uint}}, - {IFLA_PHYS_PORT_ID, {"PHYS_PORT_ID"}}, - {IFLA_CARRIER_CHANGES, {"CARRIER_CHANGES", DataType::Uint}}, - {IFLA_PHYS_SWITCH_ID, {"PHYS_SWITCH_ID"}}, - {IFLA_LINK_NETNSID, {"LINK_NETNSID"}}, // NLA_S32 - {IFLA_PHYS_PORT_NAME, {"PHYS_PORT_NAME", DataType::String}}, - {IFLA_PROTO_DOWN, {"PROTO_DOWN", DataType::Uint}}, - {IFLA_GSO_MAX_SEGS, {"GSO_MAX_SEGS", DataType::Uint}}, - {IFLA_GSO_MAX_SIZE, {"GSO_MAX_SIZE", DataType::Uint}}, - {IFLA_PAD, {"PAD"}}, - {IFLA_XDP, {"XDP"}}, - {IFLA_EVENT, {"EVENT", DataType::Uint}}, - {IFLA_NEW_NETNSID, {"NEW_NETNSID"}}, // NLA_S32 - {IFLA_TARGET_NETNSID, {"TARGET_NETNSID"}}, // NLA_S32 - {IFLA_CARRIER_UP_COUNT, {"CARRIER_UP_COUNT", DataType::Uint}}, - {IFLA_CARRIER_DOWN_COUNT, {"CARRIER_DOWN_COUNT", DataType::Uint}}, - {IFLA_NEW_IFINDEX, {"NEW_IFINDEX"}}, // NLA_S32 - {IFLA_MIN_MTU, {"MIN_MTU", DataType::Uint}}, - {IFLA_MAX_MTU, {"MAX_MTU", DataType::Uint}}, - {IFLA_PROP_LIST, {"PROP_LIST"}}, - {IFLA_ALT_IFNAME, {"ALT_IFNAME", DataType::String}}, - {IFLA_PERM_ADDRESS, {"PERM_ADDRESS"}}, -}) {} -// clang-format off +}, gAttributes) {} +// clang-format on void Link::toStream(std::stringstream& ss, const ifinfomsg& data) const { ss << "ifinfomsg{" diff --git a/automotive/can/1.0/default/libnl++/protocols/route/Route.cpp b/automotive/can/1.0/default/libnl++/protocols/route/Route.cpp index c134911525..51e5b11b74 100644 --- a/automotive/can/1.0/default/libnl++/protocols/route/Route.cpp +++ b/automotive/can/1.0/default/libnl++/protocols/route/Route.cpp @@ -16,10 +16,16 @@ #include "Route.h" +#include "Addr.h" #include "Link.h" namespace android::nl::protocols::route { -Route::Route() : NetlinkProtocol(NETLINK_ROUTE, "ROUTE", {std::make_shared()}) {} +// clang-format off +Route::Route() : NetlinkProtocol(NETLINK_ROUTE, "ROUTE", { + std::make_shared(), + std::make_shared(), +}) {} +// clang-format on } // namespace android::nl::protocols::route diff --git a/automotive/can/1.0/default/libnl++/protocols/route/attributes.cpp b/automotive/can/1.0/default/libnl++/protocols/route/attributes.cpp new file mode 100644 index 0000000000..69d9b811a9 --- /dev/null +++ b/automotive/can/1.0/default/libnl++/protocols/route/attributes.cpp @@ -0,0 +1,109 @@ +/* + * 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. + */ + +#include "attributes.h" + +#include "../structs.h" +#include "structs.h" + +#include +#include + +namespace android::nl::protocols::route { + +using DataType = AttributeDefinition::DataType; +using Flags = AttributeDefinition::Flags; + +// clang-format off +AttributeMap gAttributes = { + {IFLA_ADDRESS, {"ADDRESS"}}, + {IFLA_BROADCAST, {"BROADCAST"}}, + {IFLA_IFNAME, {"IFNAME", DataType::StringNul}}, + {IFLA_MTU, {"MTU", DataType::Uint}}, + {IFLA_LINK, {"LINK", DataType::Uint}}, + {IFLA_QDISC, {"QDISC", DataType::Raw, AttributeMap{}, Flags::Verbose}}, // should be DataType::String, but looks like binary blob + {IFLA_STATS, {"STATS", DataType::Struct, statsToStream}}, + {IFLA_COST, {"COST", DataType::Uint}}, + {IFLA_PRIORITY, {"PRIORITY"}}, + {IFLA_MASTER, {"MASTER", DataType::Uint}}, + {IFLA_WIRELESS, {"WIRELESS"}}, + {IFLA_PROTINFO, {"PROTINFO"}}, + {IFLA_TXQLEN, {"TXQLEN", DataType::Uint}}, + {IFLA_MAP, {"MAP", DataType::Struct, mapToStream}}, + {IFLA_WEIGHT, {"WEIGHT", DataType::Uint}}, + {IFLA_OPERSTATE, {"OPERSTATE", DataType::Uint}}, + {IFLA_LINKMODE, {"LINKMODE", DataType::Uint}}, + {IFLA_LINKINFO, {"LINKINFO", DataType::Nested, AttributeMap{ + {IFLA_INFO_KIND, {"INFO_KIND", DataType::String}}, + {IFLA_INFO_DATA, {"INFO_DATA", DataType::Nested}}, + {IFLA_INFO_XSTATS, {"INFO_XSTATS"}}, + {IFLA_INFO_SLAVE_KIND, {"INFO_SLAVE_KIND", DataType::String}}, + {IFLA_INFO_SLAVE_DATA, {"INFO_SLAVE_DATA"}}, + }}}, + {IFLA_NET_NS_PID, {"NET_NS_PID", DataType::Uint}}, + {IFLA_IFALIAS, {"IFALIAS", DataType::String}}, + {IFLA_NUM_VF, {"NUM_VF", DataType::Uint}}, + {IFLA_VFINFO_LIST, {"VFINFO_LIST"}}, + {IFLA_STATS64, {"STATS64", DataType::Struct, statsToStream}}, + {IFLA_VF_PORTS, {"VF_PORTS"}}, + {IFLA_PORT_SELF, {"PORT_SELF"}}, + {IFLA_AF_SPEC, {"AF_SPEC", DataType::Nested, AttributeMap{ + {AF_INET, {"AF_INET", DataType::Nested, AttributeMap{ + {IFLA_INET_CONF, {"INET_CONF", DataType::Struct, arrayToStream}}, + }}}, + {AF_INET6, {"AF_INET6", DataType::Nested, AttributeMap{ + {IFLA_INET6_FLAGS, {"INET6_FLAGS", DataType::Uint}}, + {IFLA_INET6_CONF, {"INET6_CONF", DataType::Struct, arrayToStream}}, + {IFLA_INET6_STATS, {"INET6_STATS", DataType::Struct, arrayToStream}}, + {IFLA_INET6_MCAST, {"INET6_MCAST"}}, + {IFLA_INET6_CACHEINFO, {"INET6_CACHEINFO", DataType::Struct, ifla_cacheinfoToStream}}, + {IFLA_INET6_ICMP6STATS, {"INET6_ICMP6STATS", DataType::Struct, arrayToStream}}, + {IFLA_INET6_TOKEN, {"INET6_TOKEN"}}, + {IFLA_INET6_ADDR_GEN_MODE, {"INET6_ADDR_GEN_MODE", DataType::Uint}}, + }}}, + }}}, + {IFLA_GROUP, {"GROUP", DataType::Uint}}, + {IFLA_NET_NS_FD, {"NET_NS_FD", DataType::Uint}}, + {IFLA_EXT_MASK, {"EXT_MASK", DataType::Uint}}, + {IFLA_PROMISCUITY, {"PROMISCUITY", DataType::Uint}}, + {IFLA_NUM_TX_QUEUES, {"NUM_TX_QUEUES", DataType::Uint}}, + {IFLA_NUM_RX_QUEUES, {"NUM_RX_QUEUES", DataType::Uint}}, + {IFLA_CARRIER, {"CARRIER", DataType::Uint}}, + {IFLA_PHYS_PORT_ID, {"PHYS_PORT_ID"}}, + {IFLA_CARRIER_CHANGES, {"CARRIER_CHANGES", DataType::Uint}}, + {IFLA_PHYS_SWITCH_ID, {"PHYS_SWITCH_ID"}}, + {IFLA_LINK_NETNSID, {"LINK_NETNSID"}}, // NLA_S32 + {IFLA_PHYS_PORT_NAME, {"PHYS_PORT_NAME", DataType::String}}, + {IFLA_PROTO_DOWN, {"PROTO_DOWN", DataType::Uint}}, + {IFLA_GSO_MAX_SEGS, {"GSO_MAX_SEGS", DataType::Uint}}, + {IFLA_GSO_MAX_SIZE, {"GSO_MAX_SIZE", DataType::Uint}}, + {IFLA_PAD, {"PAD"}}, + {IFLA_XDP, {"XDP"}}, + {IFLA_EVENT, {"EVENT", DataType::Uint}}, + {IFLA_NEW_NETNSID, {"NEW_NETNSID"}}, // NLA_S32 + {IFLA_TARGET_NETNSID, {"TARGET_NETNSID"}}, // NLA_S32 + {IFLA_CARRIER_UP_COUNT, {"CARRIER_UP_COUNT", DataType::Uint}}, + {IFLA_CARRIER_DOWN_COUNT, {"CARRIER_DOWN_COUNT", DataType::Uint}}, + {IFLA_NEW_IFINDEX, {"NEW_IFINDEX"}}, // NLA_S32 + {IFLA_MIN_MTU, {"MIN_MTU", DataType::Uint}}, + {IFLA_MAX_MTU, {"MAX_MTU", DataType::Uint}}, + {IFLA_PROP_LIST, {"PROP_LIST"}}, + {IFLA_ALT_IFNAME, {"ALT_IFNAME", DataType::String}}, + {IFLA_PERM_ADDRESS, {"PERM_ADDRESS"}}, +}; +// clang-format on + +} // namespace android::nl::protocols::route diff --git a/automotive/can/1.0/default/libnl++/protocols/route/attributes.h b/automotive/can/1.0/default/libnl++/protocols/route/attributes.h new file mode 100644 index 0000000000..ace9234f3b --- /dev/null +++ b/automotive/can/1.0/default/libnl++/protocols/route/attributes.h @@ -0,0 +1,25 @@ +/* + * 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. + */ + +#pragma once + +#include "../MessageDefinition.h" + +namespace android::nl::protocols::route { + +extern AttributeMap gAttributes; + +} // namespace android::nl::protocols::route diff --git a/automotive/can/1.0/default/libnl++/protocols/route/structs.cpp b/automotive/can/1.0/default/libnl++/protocols/route/structs.cpp index b62cec3c7e..269771c423 100644 --- a/automotive/can/1.0/default/libnl++/protocols/route/structs.cpp +++ b/automotive/can/1.0/default/libnl++/protocols/route/structs.cpp @@ -46,4 +46,58 @@ void ifla_cacheinfoToStream(std::stringstream& ss, const Buffer attr) { << data.retrans_time << '}'; } +// clang-format off +std::string familyToString(sa_family_t family) { + switch (family) { + case AF_UNSPEC: return "UNSPEC"; + case AF_UNIX: return "UNIX"; + case AF_INET: return "INET"; + case AF_AX25: return "AX25"; + case AF_IPX: return "IPX"; + case AF_APPLETALK: return "APPLETALK"; + case AF_NETROM: return "NETROM"; + case AF_BRIDGE: return "BRIDGE"; + case AF_ATMPVC: return "ATMPVC"; + case AF_X25: return "X25"; + case AF_INET6: return "INET6"; + case AF_ROSE: return "ROSE"; + case AF_DECnet: return "DECnet"; + case AF_NETBEUI: return "NETBEUI"; + case AF_SECURITY: return "SECURITY"; + case AF_KEY: return "KEY"; + case AF_NETLINK: return "NETLINK"; + case AF_PACKET: return "PACKET"; + case AF_ASH: return "ASH"; + case AF_ECONET: return "ECONET"; + case AF_ATMSVC: return "ATMSVC"; + case AF_RDS: return "RDS"; + case AF_SNA: return "SNA"; + case AF_IRDA: return "IRDA"; + case AF_PPPOX: return "PPPOX"; + case AF_WANPIPE: return "WANPIPE"; + case AF_LLC: return "LLC"; + case 27 /*AF_IB*/: return "IB"; + case 28 /*AF_MPLS*/: return "MPLS"; + case AF_CAN: return "CAN"; + case AF_TIPC: return "TIPC"; + case AF_BLUETOOTH: return "BLUETOOTH"; + case AF_IUCV: return "IUCV"; + case AF_RXRPC: return "RXRPC"; + case AF_ISDN: return "ISDN"; + case AF_PHONET: return "PHONET"; + case AF_IEEE802154: return "IEEE802154"; + case AF_CAIF: return "CAIF"; + case AF_ALG: return "ALG"; + case AF_NFC: return "NFC"; + case AF_VSOCK: return "VSOCK"; + case AF_KCM: return "KCM"; + case AF_QIPCRTR: return "QIPCRTR"; + case 43 /*AF_SMC*/: return "SMC"; + case 44 /*AF_XDP*/: return "XDP"; + default: + return std::to_string(family); + } +} +// clang-format on + } // namespace android::nl::protocols::route diff --git a/automotive/can/1.0/default/libnl++/protocols/route/structs.h b/automotive/can/1.0/default/libnl++/protocols/route/structs.h index fea2ce130c..c969a6c8cb 100644 --- a/automotive/can/1.0/default/libnl++/protocols/route/structs.h +++ b/automotive/can/1.0/default/libnl++/protocols/route/structs.h @@ -19,6 +19,7 @@ #include #include +#include #include @@ -30,6 +31,8 @@ void mapToStream(std::stringstream& ss, const Buffer attr); // ifla_cacheinfo void ifla_cacheinfoToStream(std::stringstream& ss, const Buffer attr); +std::string familyToString(sa_family_t family); + // rtnl_link_stats or rtnl_link_stats64 template void statsToStream(std::stringstream& ss, const Buffer attr) { diff --git a/automotive/can/1.0/default/libnl++/protocols/structs.cpp b/automotive/can/1.0/default/libnl++/protocols/structs.cpp index 8ff71f006a..3f896bffe2 100644 --- a/automotive/can/1.0/default/libnl++/protocols/structs.cpp +++ b/automotive/can/1.0/default/libnl++/protocols/structs.cpp @@ -22,24 +22,27 @@ namespace android::nl::protocols { AttributeDefinition::ToStream flagsToStream(FlagsMap flags) { return [flags](std::stringstream& ss, const Buffer attr) { - auto val = attr.data().copyFirst(); + auto value = attr.data().copyFirst(); + flagsToStream(ss, flags, value); + }; +} - bool first = true; - for (const auto& [flag, name] : flags) { - if ((val & flag) != flag) continue; - val &= ~flag; - - if (!first) ss << '|'; - first = false; - - ss << name; - } - - if (val == 0) return; +void flagsToStream(std::stringstream& ss, const FlagsMap& flags, uint64_t val) { + bool first = true; + for (const auto& [flag, name] : flags) { + if ((val & flag) != flag) continue; + val &= ~flag; if (!first) ss << '|'; - ss << std::hex << val << std::dec; - }; + first = false; + + ss << name; + } + + if (val == 0) return; + + if (!first) ss << '|'; + ss << std::hex << val << std::dec; } void hwaddrToStream(std::stringstream& ss, const Buffer attr) { diff --git a/automotive/can/1.0/default/libnl++/protocols/structs.h b/automotive/can/1.0/default/libnl++/protocols/structs.h index f3a8c44afe..9cf6f1ae57 100644 --- a/automotive/can/1.0/default/libnl++/protocols/structs.h +++ b/automotive/can/1.0/default/libnl++/protocols/structs.h @@ -34,6 +34,7 @@ void arrayToStream(std::stringstream& ss, const Buffer attr) { typedef std::map FlagsMap; AttributeDefinition::ToStream flagsToStream(FlagsMap flags); +void flagsToStream(std::stringstream& ss, const FlagsMap& flags, uint64_t value); void hwaddrToStream(std::stringstream& ss, const Buffer attr); From e9e0f7c0f54a013088f4235f182c6f07ab7a4d9f Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Fri, 22 Jul 2022 00:07:03 +0000 Subject: [PATCH 155/998] audio: Implement setting name and priority in StreamWorker Audio threads need to be able to set their priority. Also, traditionally these worker threads set a custom thread name. Implement this functionality in StreamWorker. Since initialization steps can fail, implement simple error reporting via a string field `mError`. The state of the string field replaces the dedicated `ERROR` worker state. Bug: 205884982 Test: atest libaudioaidlcommon_test --iterations Change-Id: Ie9ab94922d47f277a4993a90b478a2fa76657923 --- audio/aidl/common/Android.bp | 2 + audio/aidl/common/include/StreamWorker.h | 69 ++++++++++++++----- .../aidl/common/tests/streamworker_tests.cpp | 22 +++++- 3 files changed, 76 insertions(+), 17 deletions(-) diff --git a/audio/aidl/common/Android.bp b/audio/aidl/common/Android.bp index 6a1c4a4677..37da9d66ec 100644 --- a/audio/aidl/common/Android.bp +++ b/audio/aidl/common/Android.bp @@ -30,9 +30,11 @@ cc_library_headers { export_include_dirs: ["include"], header_libs: [ "libbase_headers", + "libsystem_headers", ], export_header_lib_headers: [ "libbase_headers", + "libsystem_headers", ], } diff --git a/audio/aidl/common/include/StreamWorker.h b/audio/aidl/common/include/StreamWorker.h index 74e99df4cd..776490493d 100644 --- a/audio/aidl/common/include/StreamWorker.h +++ b/audio/aidl/common/include/StreamWorker.h @@ -16,29 +16,39 @@ #pragma once +#include #include +#include #include #include #include +#include #include #include +#include template class StreamWorker { - enum class WorkerState { STOPPED, RUNNING, PAUSE_REQUESTED, PAUSED, RESUME_REQUESTED, ERROR }; + enum class WorkerState { STOPPED, RUNNING, PAUSE_REQUESTED, PAUSED, RESUME_REQUESTED }; public: StreamWorker() = default; ~StreamWorker() { stop(); } - bool start() { + // Note that 'priority' here is what is known as the 'nice number' in *nix systems. + // The nice number is used with the default scheduler. For threads that + // need to use a specialized scheduler (e.g. SCHED_FIFO) and set the priority within it, + // it is recommended to implement an appropriate configuration sequence within `workerInit`. + bool start(const std::string& name = "", int priority = ANDROID_PRIORITY_DEFAULT) { + mThreadName = name; + mThreadPriority = priority; mWorker = std::thread(&StreamWorker::workerThread, this); std::unique_lock lock(mWorkerLock); android::base::ScopedLockAssertion lock_assertion(mWorkerLock); mWorkerCv.wait(lock, [&]() { android::base::ScopedLockAssertion lock_assertion(mWorkerLock); - return mWorkerState != WorkerState::STOPPED; + return mWorkerState == WorkerState::RUNNING || !mError.empty(); }); mWorkerStateChangeRequest = false; return mWorkerState == WorkerState::RUNNING; @@ -47,14 +57,20 @@ class StreamWorker { void resume() { switchWorkerStateSync(WorkerState::PAUSED, WorkerState::RESUME_REQUESTED); } bool hasError() { std::lock_guard lock(mWorkerLock); - return mWorkerState == WorkerState::ERROR; + return !mError.empty(); + } + std::string getError() { + std::lock_guard lock(mWorkerLock); + return mError; } void stop() { { std::lock_guard lock(mWorkerLock); - if (mWorkerState == WorkerState::STOPPED) return; - mWorkerState = WorkerState::STOPPED; - mWorkerStateChangeRequest = true; + if (mError.empty()) { + if (mWorkerState == WorkerState::STOPPED) return; + mWorkerState = WorkerState::STOPPED; + mWorkerStateChangeRequest = true; + } } if (mWorker.joinable()) { mWorker.join(); @@ -71,17 +87,21 @@ class StreamWorker { void testLockUnlockMutex(bool lock) NO_THREAD_SAFETY_ANALYSIS { lock ? mWorkerLock.lock() : mWorkerLock.unlock(); } + std::thread::native_handle_type testGetThreadNativeHandle() { return mWorker.native_handle(); } // Methods that need to be provided by subclasses: // // Called once at the beginning of the thread loop. Must return - // 'true' to enter the thread loop, otherwise the thread loop - // exits and the worker switches into the 'error' state. - // bool workerInit(); + // an empty string to enter the thread loop, otherwise the thread loop + // exits and the worker switches into the 'error' state, setting + // the error to the returned value. + // std::string workerInit(); // // Called for each thread loop unless the thread is in 'paused' state. // Must return 'true' to continue running, otherwise the thread loop - // exits and the worker switches into the 'error' state. + // exits and the worker switches into the 'error' state with a generic + // error message. It is recommended that the subclass reports any + // problems via logging facilities. // bool workerCycle(); private: @@ -102,13 +122,27 @@ class StreamWorker { if (finalState) *finalState = mWorkerState; } void workerThread() { - bool success = static_cast(this)->workerInit(); + std::string error = static_cast(this)->workerInit(); + if (error.empty() && !mThreadName.empty()) { + std::string compliantName(mThreadName.substr(0, 15)); + if (int errCode = pthread_setname_np(pthread_self(), compliantName.c_str()); + errCode != 0) { + error.append("Failed to set thread name: ").append(strerror(errCode)); + } + } + if (error.empty() && mThreadPriority != ANDROID_PRIORITY_DEFAULT) { + if (int result = setpriority(PRIO_PROCESS, 0, mThreadPriority); result != 0) { + int errCode = errno; + error.append("Failed to set thread priority: ").append(strerror(errCode)); + } + } { std::lock_guard lock(mWorkerLock); - mWorkerState = success ? WorkerState::RUNNING : WorkerState::ERROR; + mWorkerState = error.empty() ? WorkerState::RUNNING : WorkerState::STOPPED; + mError = error; } mWorkerCv.notify_one(); - if (!success) return; + if (!error.empty()) return; for (WorkerState state = WorkerState::RUNNING; state != WorkerState::STOPPED;) { bool needToNotify = false; @@ -153,8 +187,8 @@ class StreamWorker { mWorkerState == WorkerState::PAUSE_REQUESTED) { needToNotify = true; } - mWorkerState = WorkerState::ERROR; - state = WorkerState::STOPPED; + state = mWorkerState = WorkerState::STOPPED; + mError = "workerCycle failed"; } if (needToNotify) { { @@ -166,10 +200,13 @@ class StreamWorker { } } + std::string mThreadName; + int mThreadPriority = ANDROID_PRIORITY_DEFAULT; std::thread mWorker; std::mutex mWorkerLock; std::condition_variable mWorkerCv; WorkerState mWorkerState GUARDED_BY(mWorkerLock) = WorkerState::STOPPED; + std::string mError GUARDED_BY(mWorkerLock); // The atomic lock-free variable is used to prevent priority inversions // that can occur when a high priority worker tries to acquire the lock // which has been taken by a lower priority control thread which in its turn diff --git a/audio/aidl/common/tests/streamworker_tests.cpp b/audio/aidl/common/tests/streamworker_tests.cpp index c9d3dbd5ee..9fb1a8ee3f 100644 --- a/audio/aidl/common/tests/streamworker_tests.cpp +++ b/audio/aidl/common/tests/streamworker_tests.cpp @@ -14,8 +14,10 @@ * limitations under the License. */ +#include #include #include + #include #include @@ -34,6 +36,7 @@ class TestWorker : public StreamWorker { explicit TestWorker(TestStream* stream) : mStream(stream) {} size_t getWorkerCycles() const { return mWorkerCycles; } + int getPriority() const { return mPriority; } bool hasWorkerCycleCalled() const { return mWorkerCycles != 0; } bool hasNoWorkerCycleCalled(useconds_t usec) { const size_t cyclesBefore = mWorkerCycles; @@ -41,8 +44,9 @@ class TestWorker : public StreamWorker { return mWorkerCycles == cyclesBefore; } - bool workerInit() { return mStream; } + std::string workerInit() { return mStream != nullptr ? "" : "Expected error"; } bool workerCycle() { + mPriority = getpriority(PRIO_PROCESS, 0); do { mWorkerCycles++; } while (mWorkerCycles == 0); @@ -52,6 +56,7 @@ class TestWorker : public StreamWorker { private: TestStream* const mStream; std::atomic mWorkerCycles = 0; + std::atomic mPriority = ANDROID_PRIORITY_DEFAULT; }; // The parameter specifies whether an extra call to 'stop' is made at the end. @@ -219,4 +224,19 @@ TEST_P(StreamWorkerTest, MutexDoesNotBlockWorker) { EXPECT_FALSE(worker.hasError()); } +TEST_P(StreamWorkerTest, ThreadName) { + const std::string workerName = "TestWorker"; + ASSERT_TRUE(worker.start(workerName)) << worker.getError(); + char nameBuf[128]; + ASSERT_EQ(0, pthread_getname_np(worker.testGetThreadNativeHandle(), nameBuf, sizeof(nameBuf))); + EXPECT_EQ(workerName, nameBuf); +} + +TEST_P(StreamWorkerTest, ThreadPriority) { + const int priority = ANDROID_PRIORITY_LOWEST; + ASSERT_TRUE(worker.start("", priority)) << worker.getError(); + worker.waitForAtLeastOneCycle(); + EXPECT_EQ(priority, worker.getPriority()); +} + INSTANTIATE_TEST_SUITE_P(StreamWorker, StreamWorkerTest, testing::Bool()); From 42caff499e908d4f043d69d48a2011f4ebbd54f4 Mon Sep 17 00:00:00 2001 From: Frankie Lizcano Date: Fri, 22 Jul 2022 20:30:46 +0000 Subject: [PATCH 156/998] Improve Tuner VTS: Add DVBS Settings This CL expands the settings and specs that can be added by vendors to DVBS frontend types. It also updates the value expectations to model the format present in the other types. Bug: b/239968750 Test: vts-tradefed run vts --module VtsHalTvTunerTargetTest Change-Id: Ifd4a97ce71cfea11e4f5c1293a6342e337cb5699 --- .../config/TunerTestingConfigAidlReaderV1_0.h | 20 +++++++++---------- tv/tuner/config/api/current.txt | 12 +++++++++++ .../sample_tuner_vts_config_aidl_V1.xml | 3 ++- .../tuner_testing_dynamic_configuration.xsd | 10 ++++++++-- 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h index 7c757b4ebb..d1e876233f 100644 --- a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h +++ b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h @@ -737,17 +737,17 @@ struct TunerTestingConfigAidlReader1_0 { ALOGW("[ConfigReader] no more dvbs settings"); return dvbsSettings; } - dvbsSettings.symbolRate = static_cast( - feConfig.getFirstDvbsFrontendSettings_optional()->getSymbolRate()); - dvbsSettings.inputStreamId = static_cast( - feConfig.getFirstDvbsFrontendSettings_optional()->getInputStreamId()); auto dvbs = feConfig.getFirstDvbsFrontendSettings_optional(); - if (dvbs->hasScanType()) { - dvbsSettings.scanType = static_cast(dvbs->getScanType()); - } - if (dvbs->hasIsDiseqcRxMessage()) { - dvbsSettings.isDiseqcRxMessage = dvbs->getIsDiseqcRxMessage(); - } + dvbsSettings.symbolRate = static_cast(dvbs->getSymbolRate()); + dvbsSettings.inputStreamId = static_cast(dvbs->getInputStreamId()); + dvbsSettings.scanType = static_cast(dvbs->getScanType()); + dvbsSettings.isDiseqcRxMessage = dvbs->getIsDiseqcRxMessage(); + dvbsSettings.inversion = static_cast(dvbs->getInversion()); + dvbsSettings.modulation = static_cast(dvbs->getModulation()); + dvbsSettings.rolloff = static_cast(dvbs->getRolloff()); + dvbsSettings.pilot = static_cast(dvbs->getPilot()); + dvbsSettings.standard = static_cast(dvbs->getStandard()); + dvbsSettings.vcmMode = static_cast(dvbs->getVcmMode()); return dvbsSettings; } diff --git a/tv/tuner/config/api/current.txt b/tv/tuner/config/api/current.txt index 9b500c3cab..8653c1c611 100644 --- a/tv/tuner/config/api/current.txt +++ b/tv/tuner/config/api/current.txt @@ -181,13 +181,25 @@ package android.media.tuner.testing.configuration.V1_0 { public class DvbsFrontendSettings { ctor public DvbsFrontendSettings(); method @Nullable public java.math.BigInteger getInputStreamId(); + method @Nullable public java.math.BigInteger getInversion(); method @Nullable public boolean getIsDiseqcRxMessage(); + method @Nullable public java.math.BigInteger getModulation(); + method @Nullable public java.math.BigInteger getPilot(); + method @Nullable public java.math.BigInteger getRolloff(); method @Nullable public android.media.tuner.testing.configuration.V1_0.DvbsScanType getScanType(); + method @Nullable public java.math.BigInteger getStandard(); method @Nullable public java.math.BigInteger getSymbolRate(); + method @Nullable public java.math.BigInteger getVcmMode(); method public void setInputStreamId(@Nullable java.math.BigInteger); + method public void setInversion(@Nullable java.math.BigInteger); method public void setIsDiseqcRxMessage(@Nullable boolean); + method public void setModulation(@Nullable java.math.BigInteger); + method public void setPilot(@Nullable java.math.BigInteger); + method public void setRolloff(@Nullable java.math.BigInteger); method public void setScanType(@Nullable android.media.tuner.testing.configuration.V1_0.DvbsScanType); + method public void setStandard(@Nullable java.math.BigInteger); method public void setSymbolRate(@Nullable java.math.BigInteger); + method public void setVcmMode(@Nullable java.math.BigInteger); } public enum DvbsScanType { diff --git a/tv/tuner/config/sample_tuner_vts_config_aidl_V1.xml b/tv/tuner/config/sample_tuner_vts_config_aidl_V1.xml index 90f3c9b501..1a148a4224 100644 --- a/tv/tuner/config/sample_tuner_vts_config_aidl_V1.xml +++ b/tv/tuner/config/sample_tuner_vts_config_aidl_V1.xml @@ -68,7 +68,8 @@ - + - - + + + + + + + + From c4ac3355a6b65cdeb39f3630a23076c1a5369995 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Fri, 22 Jul 2022 17:39:41 +0900 Subject: [PATCH 157/998] android.hardware.wifi@1.0-service in soong As libwifi-hal is migrated to soong, the service is migrated to soong as well. Bug: 240099735 Test: CtsWifiTestCases Change-Id: Ie5a4ec6658d5f6aa3d4902c9c3c4b3bef9ff1cde --- wifi/1.6/default/Android.bp | 197 ++++++++++++++++++++++++++++------- wifi/1.6/default/Android.mk | 202 ------------------------------------ 2 files changed, 158 insertions(+), 241 deletions(-) delete mode 100644 wifi/1.6/default/Android.mk diff --git a/wifi/1.6/default/Android.bp b/wifi/1.6/default/Android.bp index d48d18332f..0ac6412544 100644 --- a/wifi/1.6/default/Android.bp +++ b/wifi/1.6/default/Android.bp @@ -16,42 +16,60 @@ package { default_applicable_licenses: ["hardware_interfaces_license"], } -filegroup { - name: "android.hardware.wifi@1.0-service_srcs", - srcs: ["service.cpp"], +soong_config_module_type { + name: "wifi_hal_cc_defaults", + module_type: "cc_defaults", + config_namespace: "wifi", + bool_variables: [ + "hidl_feature_aware", // WIFI_HIDL_FEATURE_AWARE + "hidl_feature_dual_interface", // WIFI_HIDL_FEATURE_DUAL_INTERFACE + "hidl_feature_disable_ap", // WIFI_HIDL_FEATURE_DISABLE_AP + "hidl_feature_disable_ap_mac_randomization", // WIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION + "avoid_iface_reset_mac_change", // WIFI_AVOID_IFACE_RESET_MAC_CHANGE + ], + value_variables: [ + "hal_interface_combinations", // WIFI_HAL_INTERFACE_COMBINATIONS + ], + properties: [ + "cppflags", + ], } -cc_defaults { - name: "android.hardware.wifi@1.0-service_default", - srcs: [":android.hardware.wifi@1.0-service_srcs"], - relative_install_path: "hw", - soc_specific: true, - shared_libs: [ - "android.hardware.wifi@1.0", - "android.hardware.wifi@1.1", - "android.hardware.wifi@1.2", - "android.hardware.wifi@1.3", - "android.hardware.wifi@1.4", - "android.hardware.wifi@1.5", - "android.hardware.wifi@1.6", - "libbase", - "libcutils", - "libhidlbase", - "liblog", - "libnl", - "libutils", - "libwifi-system-iface", - "libxml2", - ], +wifi_hal_cc_defaults { + name: "android.hardware.wifi@1.0-service-cppflags-defaults", + soong_config_variables: { + hidl_feature_aware: { + cppflags: ["-DWIFI_HIDL_FEATURE_AWARE"], + }, + hidl_feature_dual_interface: { + cppflags: ["-DWIFI_HIDL_FEATURE_DUAL_INTERFACE"], + }, + hidl_feature_disable_ap: { + cppflags: ["-DWIFI_HIDL_FEATURE_DISABLE_AP"], + }, + hidl_feature_disable_ap_mac_randomization: { + cppflags: ["-DWIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION"], + }, + avoid_iface_reset_mac_change: { + cppflags: ["-DWIFI_AVOID_IFACE_RESET_MAC_CHANGE"], + }, + hal_interface_combinations: { + cppflags: ["-DWIFI_HAL_INTERFACE_COMBINATIONS=%s"], + }, + }, +} + +cc_library_static { + name: "android.hardware.wifi@1.0-service-lib", + defaults: ["android.hardware.wifi@1.0-service-cppflags-defaults"], + proprietary: true, cppflags: [ "-Wall", "-Werror", "-Wextra", ], -} - -filegroup { - name: "android.hardware.wifi@1.0-service-lib_srcs", + // Allow implicit fallthroughs in wifi_legacy_hal.cpp until they are fixed. + cflags: ["-Wno-error=implicit-fallthrough"], srcs: [ "hidl_struct_util.cpp", "hidl_sync_util.cpp", @@ -71,14 +89,17 @@ filegroup { "wifi_sta_iface.cpp", "wifi_status_util.cpp", ], -} -cc_defaults { - name: "android.hardware.wifi@1.0-service-lib_defaults", - srcs: [":android.hardware.wifi@1.0-service-lib_srcs"], - relative_install_path: "hw", - soc_specific: true, shared_libs: [ + "libbase", + "libcutils", + "libhidlbase", + "liblog", + "libnl", + "libutils", + "libwifi-hal", + "libwifi-system-iface", + "libxml2", "android.hardware.wifi@1.0", "android.hardware.wifi@1.1", "android.hardware.wifi@1.2", @@ -86,22 +107,120 @@ cc_defaults { "android.hardware.wifi@1.4", "android.hardware.wifi@1.5", "android.hardware.wifi@1.6", + ], + + export_include_dirs: ["."], +} + +cc_binary { + name: "android.hardware.wifi@1.0-service", + vintf_fragments: ["android.hardware.wifi@1.0-service.xml"], + relative_install_path: "hw", + proprietary: true, + cppflags: [ + "-Wall", + "-Werror", + "-Wextra", + ], + srcs: ["service.cpp"], + shared_libs: [ "libbase", "libcutils", "libhidlbase", "liblog", "libnl", "libutils", + "libwifi-hal", "libwifi-system-iface", "libxml2", + "android.hardware.wifi@1.0", + "android.hardware.wifi@1.1", + "android.hardware.wifi@1.2", + "android.hardware.wifi@1.3", + "android.hardware.wifi@1.4", + "android.hardware.wifi@1.5", + "android.hardware.wifi@1.6", ], - // Generated by building android.hardware.wifi@1.0-service-lib and printing LOCAL_CPPFLAGS. + static_libs: ["android.hardware.wifi@1.0-service-lib"], + init_rc: ["android.hardware.wifi@1.0-service.rc"], +} + +cc_binary { + name: "android.hardware.wifi@1.0-service-lazy", + vintf_fragments: ["android.hardware.wifi@1.0-service.xml"], + overrides: ["android.hardware.wifi@1.0-service"], + cflags: ["-DLAZY_SERVICE"], + relative_install_path: "hw", + proprietary: true, cppflags: [ "-Wall", "-Werror", "-Wextra", - "-DWIFI_HIDL_FEATURE_DUAL_INTERFACE", ], - export_include_dirs: ["."], - include_dirs: ["external/libxml2/include"], + srcs: ["service.cpp"], + shared_libs: [ + "libbase", + "libcutils", + "libhidlbase", + "liblog", + "libnl", + "libutils", + "libwifi-hal", + "libwifi-system-iface", + "libxml2", + "android.hardware.wifi@1.0", + "android.hardware.wifi@1.1", + "android.hardware.wifi@1.2", + "android.hardware.wifi@1.3", + "android.hardware.wifi@1.4", + "android.hardware.wifi@1.5", + "android.hardware.wifi@1.6", + ], + static_libs: ["android.hardware.wifi@1.0-service-lib"], + init_rc: ["android.hardware.wifi@1.0-service-lazy.rc"], +} + +cc_test { + name: "android.hardware.wifi@1.0-service-tests", + proprietary: true, + cppflags: [ + "-Wall", + "-Werror", + "-Wextra", + ], + srcs: [ + "tests/hidl_struct_util_unit_tests.cpp", + "tests/main.cpp", + "tests/mock_interface_tool.cpp", + "tests/mock_wifi_feature_flags.cpp", + "tests/mock_wifi_iface_util.cpp", + "tests/mock_wifi_legacy_hal.cpp", + "tests/mock_wifi_mode_controller.cpp", + "tests/ringbuffer_unit_tests.cpp", + "tests/wifi_nan_iface_unit_tests.cpp", + "tests/wifi_chip_unit_tests.cpp", + "tests/wifi_iface_util_unit_tests.cpp", + ], + static_libs: [ + "libgmock", + "libgtest", + "android.hardware.wifi@1.0", + "android.hardware.wifi@1.1", + "android.hardware.wifi@1.2", + "android.hardware.wifi@1.3", + "android.hardware.wifi@1.4", + "android.hardware.wifi@1.5", + "android.hardware.wifi@1.6", + "android.hardware.wifi@1.0-service-lib", + ], + shared_libs: [ + "libbase", + "libcutils", + "libhidlbase", + "liblog", + "libnl", + "libutils", + "libwifi-hal", + "libwifi-system-iface", + ], } diff --git a/wifi/1.6/default/Android.mk b/wifi/1.6/default/Android.mk deleted file mode 100644 index ca1c022db1..0000000000 --- a/wifi/1.6/default/Android.mk +++ /dev/null @@ -1,202 +0,0 @@ -# Copyright (C) 2016 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. -LOCAL_PATH := $(call my-dir) - -### -### android.hardware.wifi static library -### -include $(CLEAR_VARS) -LOCAL_MODULE := android.hardware.wifi@1.0-service-lib -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE -LOCAL_MODULE_RELATIVE_PATH := hw -LOCAL_PROPRIETARY_MODULE := true -LOCAL_CPPFLAGS := -Wall -Werror -Wextra -ifdef WIFI_HAL_INTERFACE_COMBINATIONS -LOCAL_CPPFLAGS += -DWIFI_HAL_INTERFACE_COMBINATIONS="$(WIFI_HAL_INTERFACE_COMBINATIONS)" -endif -ifdef WIFI_HIDL_FEATURE_AWARE -LOCAL_CPPFLAGS += -DWIFI_HIDL_FEATURE_AWARE -endif -ifdef WIFI_HIDL_FEATURE_DUAL_INTERFACE -LOCAL_CPPFLAGS += -DWIFI_HIDL_FEATURE_DUAL_INTERFACE -endif -ifdef WIFI_HIDL_FEATURE_DISABLE_AP -LOCAL_CPPFLAGS += -DWIFI_HIDL_FEATURE_DISABLE_AP -endif -ifdef WIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION -LOCAL_CPPFLAGS += -DWIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION -endif -ifdef WIFI_AVOID_IFACE_RESET_MAC_CHANGE -LOCAL_CPPFLAGS += -DWIFI_AVOID_IFACE_RESET_MAC_CHANGE -endif -# Allow implicit fallthroughs in wifi_legacy_hal.cpp until they are fixed. -LOCAL_CFLAGS += -Wno-error=implicit-fallthrough -LOCAL_SRC_FILES := \ - hidl_struct_util.cpp \ - hidl_sync_util.cpp \ - ringbuffer.cpp \ - wifi.cpp \ - wifi_ap_iface.cpp \ - wifi_chip.cpp \ - wifi_feature_flags.cpp \ - wifi_iface_util.cpp \ - wifi_legacy_hal.cpp \ - wifi_legacy_hal_factory.cpp \ - wifi_legacy_hal_stubs.cpp \ - wifi_mode_controller.cpp \ - wifi_nan_iface.cpp \ - wifi_p2p_iface.cpp \ - wifi_rtt_controller.cpp \ - wifi_sta_iface.cpp \ - wifi_status_util.cpp -LOCAL_SHARED_LIBRARIES := \ - libbase \ - libcutils \ - libhidlbase \ - liblog \ - libnl \ - libutils \ - libwifi-hal \ - libwifi-system-iface \ - libxml2 \ - android.hardware.wifi@1.0 \ - android.hardware.wifi@1.1 \ - android.hardware.wifi@1.2 \ - android.hardware.wifi@1.3 \ - android.hardware.wifi@1.4 \ - android.hardware.wifi@1.5 \ - android.hardware.wifi@1.6 -LOCAL_C_INCLUDES += $(TOP)/external/libxml2/include -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) -include $(BUILD_STATIC_LIBRARY) - -### -### android.hardware.wifi daemon -### -include $(CLEAR_VARS) -LOCAL_MODULE := android.hardware.wifi@1.0-service -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE -LOCAL_VINTF_FRAGMENTS := android.hardware.wifi@1.0-service.xml -LOCAL_MODULE_RELATIVE_PATH := hw -LOCAL_PROPRIETARY_MODULE := true -LOCAL_CPPFLAGS := -Wall -Werror -Wextra -LOCAL_SRC_FILES := \ - service.cpp -LOCAL_SHARED_LIBRARIES := \ - libbase \ - libcutils \ - libhidlbase \ - liblog \ - libnl \ - libutils \ - libwifi-hal \ - libwifi-system-iface \ - libxml2 \ - android.hardware.wifi@1.0 \ - android.hardware.wifi@1.1 \ - android.hardware.wifi@1.2 \ - android.hardware.wifi@1.3 \ - android.hardware.wifi@1.4 \ - android.hardware.wifi@1.5 \ - android.hardware.wifi@1.6 -LOCAL_STATIC_LIBRARIES := \ - android.hardware.wifi@1.0-service-lib -LOCAL_INIT_RC := android.hardware.wifi@1.0-service.rc -include $(BUILD_EXECUTABLE) - -### -### android.hardware.wifi daemon -### -include $(CLEAR_VARS) -LOCAL_MODULE := android.hardware.wifi@1.0-service-lazy -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE -LOCAL_VINTF_FRAGMENTS := android.hardware.wifi@1.0-service.xml -LOCAL_OVERRIDES_MODULES := android.hardware.wifi@1.0-service -LOCAL_CFLAGS := -DLAZY_SERVICE -LOCAL_MODULE_RELATIVE_PATH := hw -LOCAL_PROPRIETARY_MODULE := true -LOCAL_CPPFLAGS := -Wall -Werror -Wextra -LOCAL_SRC_FILES := \ - service.cpp -LOCAL_SHARED_LIBRARIES := \ - libbase \ - libcutils \ - libhidlbase \ - liblog \ - libnl \ - libutils \ - libwifi-hal \ - libwifi-system-iface \ - libxml2 \ - android.hardware.wifi@1.0 \ - android.hardware.wifi@1.1 \ - android.hardware.wifi@1.2 \ - android.hardware.wifi@1.3 \ - android.hardware.wifi@1.4 \ - android.hardware.wifi@1.5 \ - android.hardware.wifi@1.6 -LOCAL_STATIC_LIBRARIES := \ - android.hardware.wifi@1.0-service-lib -LOCAL_INIT_RC := android.hardware.wifi@1.0-service-lazy.rc -include $(BUILD_EXECUTABLE) - -### -### android.hardware.wifi unit tests. -### -include $(CLEAR_VARS) -LOCAL_MODULE := android.hardware.wifi@1.0-service-tests -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE -LOCAL_PROPRIETARY_MODULE := true -LOCAL_CPPFLAGS := -Wall -Werror -Wextra -LOCAL_SRC_FILES := \ - tests/hidl_struct_util_unit_tests.cpp \ - tests/main.cpp \ - tests/mock_interface_tool.cpp \ - tests/mock_wifi_feature_flags.cpp \ - tests/mock_wifi_iface_util.cpp \ - tests/mock_wifi_legacy_hal.cpp \ - tests/mock_wifi_mode_controller.cpp \ - tests/ringbuffer_unit_tests.cpp \ - tests/wifi_nan_iface_unit_tests.cpp \ - tests/wifi_chip_unit_tests.cpp \ - tests/wifi_iface_util_unit_tests.cpp -LOCAL_STATIC_LIBRARIES := \ - libgmock \ - libgtest \ - android.hardware.wifi@1.0 \ - android.hardware.wifi@1.1 \ - android.hardware.wifi@1.2 \ - android.hardware.wifi@1.3 \ - android.hardware.wifi@1.4 \ - android.hardware.wifi@1.5 \ - android.hardware.wifi@1.6 \ - android.hardware.wifi@1.0-service-lib -LOCAL_SHARED_LIBRARIES := \ - libbase \ - libcutils \ - libhidlbase \ - liblog \ - libnl \ - libutils \ - libwifi-hal \ - libwifi-system-iface -include $(BUILD_NATIVE_TEST) From b7e542cc6986370b69ee994987baf40c791461bb Mon Sep 17 00:00:00 2001 From: Yu-Han Yang Date: Mon, 25 Jul 2022 22:07:34 +0000 Subject: [PATCH 158/998] Increase VtsHalGnssTargetTest test timeout to 2min Test: atest VtsHalGnssTargetTest Bug: 240193422 Change-Id: Ia960a88ac0692c72ee7aa56ae33932f325dee356 --- gnss/aidl/vts/AndroidTest.xml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 gnss/aidl/vts/AndroidTest.xml diff --git a/gnss/aidl/vts/AndroidTest.xml b/gnss/aidl/vts/AndroidTest.xml new file mode 100644 index 0000000000..d203402053 --- /dev/null +++ b/gnss/aidl/vts/AndroidTest.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + From 55217072ecb7e9849ac577afa2960dcd67a68001 Mon Sep 17 00:00:00 2001 From: Changyeon Jo Date: Tue, 26 Jul 2022 21:17:26 -0700 Subject: [PATCH 159/998] Modifies EVS shader programs This CL modifies EVS shader programs of the default EVS HAL implementation, to make it compatible with OpenGL ES 2.0. Bug: 240306544 Test: Run EVS applications on cuttlefish Change-Id: I519a07251e2fd32380fe340739972514bd5bf65b --- automotive/evs/1.1/default/GlWrapper.cpp | 40 +++++++++++------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/automotive/evs/1.1/default/GlWrapper.cpp b/automotive/evs/1.1/default/GlWrapper.cpp index 357b67c48a..9ad5729af8 100644 --- a/automotive/evs/1.1/default/GlWrapper.cpp +++ b/automotive/evs/1.1/default/GlWrapper.cpp @@ -37,28 +37,23 @@ constexpr float kDefaultColorInRgba[] = {0.1f, 0.5f, 0.1f, 1.0f}; constexpr float kDisplayAreaRatio = 0.8f; constexpr const char vertexShaderSource[] = - "" - "#version 300 es \n" - "layout(location = 0) in vec4 pos; \n" - "layout(location = 1) in vec2 tex; \n" - "out vec2 uv; \n" - "void main() \n" - "{ \n" - " gl_Position = pos; \n" - " uv = tex; \n" - "} \n"; + "attribute vec4 pos; \n" + "attribute vec2 tex; \n" + "varying vec2 uv; \n" + "void main() \n" + "{ \n" + " gl_Position = pos; \n" + " uv = tex; \n" + "} \n"; constexpr const char pixelShaderSource[] = - "#version 300 es \n" - "precision mediump float; \n" - "uniform sampler2D tex; \n" - "in vec2 uv; \n" - "out vec4 color; \n" - "void main() \n" - "{ \n" - " vec4 texel = texture(tex, uv); \n" - " color = texel; \n" - "} \n"; + "precision mediump float; \n" + "uniform sampler2D tex; \n" + "varying vec2 uv; \n" + "void main() \n" + "{ \n" + " gl_FragColor = texture2D(tex, uv); \n" + "} \n"; const char* getEGLError(void) { switch (eglGetError()) { @@ -157,6 +152,9 @@ GLuint buildShaderProgram(const char* vtxSrc, const char* pxlSrc) { glAttachShader(program, vertexShader); glAttachShader(program, pixelShader); + glBindAttribLocation(program, 0, "pos"); + glBindAttribLocation(program, 1, "tex"); + // Link the program glLinkProgram(program); GLint linked = 0; @@ -235,7 +233,7 @@ bool GlWrapper::initialize(const sp& service, ui return false; } - EGLint major = 3; + EGLint major = 2; EGLint minor = 0; if (!eglInitialize(mDisplay, &major, &minor)) { LOG(ERROR) << "Failed to initialize EGL: " << getEGLError(); From d5796d6576e7c2e9b9280638f17731d4f9275678 Mon Sep 17 00:00:00 2001 From: ziyiw Date: Wed, 27 Jul 2022 18:58:30 +0000 Subject: [PATCH 160/998] Add Diagnostics Oid in HAL. Test: compile Bug: 236969605 Change-Id: Idc44d73f31dc23d4dfaf4f461d8c312338421234 --- .../hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl | 1 + .../hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl index cd2e122029..fbcfbff667 100644 --- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl @@ -36,4 +36,5 @@ package android.hardware.uwb.fira_android; enum UwbVendorGidAndroidOids { ANDROID_GET_POWER_STATS = 0, ANDROID_SET_COUNTRY_CODE = 1, + ANDROID_RANGE_DIAGNOSTICS = 2, } diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl index e389a2dd23..42d52f1d5a 100644 --- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl +++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl @@ -31,4 +31,8 @@ enum UwbVendorGidAndroidOids { // Used to set the current regulatory country code (determined usinag // SIM or hardcoded by OEM). ANDROID_SET_COUNTRY_CODE = 0x1, + // Used by the notification to get UWB ranging diagnostics stats. + // Supported only if the UwbVendorCapabilityTlvTypes.SUPPORTED_DIAGNOSTICS set + // to 1. + ANDROID_RANGE_DIAGNOSTICS = 0x2, } From 87421816887a2838ced8543d56e9579b0327aabc Mon Sep 17 00:00:00 2001 From: Frankie Lizcano Date: Thu, 28 Jul 2022 17:13:01 +0000 Subject: [PATCH 161/998] Tuner HAL VTS: Fix Memory Leak This CL fixes an issue on the Tuner HAL VTS that lead to a memory leak. Heap space was allocated to store Lnb Id's for dataflows without being cleaned using Free(). The fix includes switching to the use of an integer passed by reference. No heap memory is allocated. Bug: b/240572001 Test: Test: ts-tradefed run vts --module VtsHalTvTunerTargetTest Change-Id: I9fcad4c05f548ee4b64cfb34175f34834eec6c56 --- tv/tuner/aidl/vts/functional/LnbTests.h | 2 ++ .../vts/functional/VtsHalTvTunerTargetTest.cpp | 18 ++++++++---------- .../vts/functional/VtsHalTvTunerTargetTest.h | 6 ++---- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/tv/tuner/aidl/vts/functional/LnbTests.h b/tv/tuner/aidl/vts/functional/LnbTests.h index d6b5a259ca..a21e68daa0 100644 --- a/tv/tuner/aidl/vts/functional/LnbTests.h +++ b/tv/tuner/aidl/vts/functional/LnbTests.h @@ -25,6 +25,8 @@ #include #include +#define INVALID_LNB_ID -1 + using android::Condition; using android::Mutex; diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp index e6c66911d8..b8e2912527 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp @@ -129,8 +129,8 @@ void TunerBroadcastAidlTest::broadcastSingleFilterTest(FilterConfig filterConf, mFrontendTests.getFrontendIdByType(frontendConf.type, feId); ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); ASSERT_TRUE(mFrontendTests.setFrontendCallback()); - if (mLnbId) { - ASSERT_TRUE(mFrontendTests.setLnb(*mLnbId)); + if (mLnbId != INVALID_LNB_ID) { + ASSERT_TRUE(mFrontendTests.setLnb(mLnbId)); } if (frontendConf.isSoftwareFe) { mFrontendTests.setSoftwareFrontendDvrConfig(dvrMap[live.dvrSoftwareFeId]); @@ -162,10 +162,9 @@ void TunerBroadcastAidlTest::broadcastSingleFilterTestWithLnb(FilterConfig filte ASSERT_TRUE(mLnbTests.getLnbIds(ids)); ASSERT_TRUE(ids.size() > 0); ASSERT_TRUE(mLnbTests.openLnbById(ids[0])); - mLnbId = &ids[0]; + mLnbId = ids[0]; } else { - mLnbId = (int32_t*)malloc(sizeof(int32_t)); - ASSERT_TRUE(mLnbTests.openLnbByName(lnbConf.name, *mLnbId)); + ASSERT_TRUE(mLnbTests.openLnbByName(lnbConf.name, mLnbId)); } ASSERT_TRUE(mLnbTests.setLnbCallback()); ASSERT_TRUE(mLnbTests.setVoltage(lnbConf.voltage)); @@ -173,7 +172,7 @@ void TunerBroadcastAidlTest::broadcastSingleFilterTestWithLnb(FilterConfig filte ASSERT_TRUE(mLnbTests.setSatellitePosition(lnbConf.position)); broadcastSingleFilterTest(filterConf, frontendConf); ASSERT_TRUE(mLnbTests.closeLnb()); - mLnbId = nullptr; + mLnbId = INVALID_LNB_ID; } void TunerBroadcastAidlTest::mediaFilterUsingSharedMemoryTest(FilterConfig filterConf, @@ -248,10 +247,9 @@ void TunerRecordAidlTest::recordSingleFilterTestWithLnb(FilterConfig filterConf, ASSERT_TRUE(mLnbTests.getLnbIds(ids)); ASSERT_TRUE(ids.size() > 0); ASSERT_TRUE(mLnbTests.openLnbById(ids[0])); - mLnbId = &ids[0]; + mLnbId = ids[0]; } else { - mLnbId = (int32_t*)malloc(sizeof(int32_t)); - ASSERT_TRUE(mLnbTests.openLnbByName(lnbConf.name, *mLnbId)); + ASSERT_TRUE(mLnbTests.openLnbByName(lnbConf.name, mLnbId)); } ASSERT_TRUE(mLnbTests.setLnbCallback()); ASSERT_TRUE(mLnbTests.setVoltage(lnbConf.voltage)); @@ -262,7 +260,7 @@ void TunerRecordAidlTest::recordSingleFilterTestWithLnb(FilterConfig filterConf, } recordSingleFilterTest(filterConf, frontendConf, dvrConf); ASSERT_TRUE(mLnbTests.closeLnb()); - mLnbId = nullptr; + mLnbId = INVALID_LNB_ID; } void TunerRecordAidlTest::attachSingleFilterToRecordDvrTest(FilterConfig filterConf, diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h index 6ffa18f5bd..2e69821482 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h @@ -276,7 +276,6 @@ class TunerRecordAidlTest : public testing::TestWithParam { virtual void TearDown() override { clearIds(); mService = nullptr; - mLnbId = nullptr; } protected: @@ -299,7 +298,7 @@ class TunerRecordAidlTest : public testing::TestWithParam { LnbTests mLnbTests; private: - int32_t* mLnbId = nullptr; + int32_t mLnbId = INVALID_LNB_ID; }; GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TunerRecordAidlTest); @@ -357,7 +356,6 @@ class TunerBroadcastAidlTest : public testing::TestWithParam { virtual void TearDown() override { clearIds(); mService = nullptr; - mLnbId = nullptr; } protected: @@ -380,7 +378,7 @@ class TunerBroadcastAidlTest : public testing::TestWithParam { void mediaFilterUsingSharedMemoryTest(FilterConfig filterConf, FrontendConfig frontendConf); private: - int32_t* mLnbId = nullptr; + int32_t mLnbId = INVALID_LNB_ID; }; GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TunerBroadcastAidlTest); From bbf297804e52707357322a699000735a2863a86e Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Thu, 28 Jul 2022 23:21:17 +0000 Subject: [PATCH 162/998] audio: Update README.md to add info about the AIDL version Also add OWNERS for the README.md. Bug: 205884982 Test: N/A Change-Id: Ia627e3845a078e6a4c545b13a723a6c5a038c53b --- audio/OWNERS | 1 + audio/README.md | 25 ++++++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 audio/OWNERS diff --git a/audio/OWNERS b/audio/OWNERS new file mode 100644 index 0000000000..ede448c1cb --- /dev/null +++ b/audio/OWNERS @@ -0,0 +1 @@ +per-file README.md = elaurent@google.com,mnaganov@google.com diff --git a/audio/README.md b/audio/README.md index 1938ad4d11..3f40d72331 100644 --- a/audio/README.md +++ b/audio/README.md @@ -2,10 +2,29 @@ Directory structure of the audio HAL related code. -Run `common/all-versions/copyHAL.sh` to create a new version of the audio HAL -based on an existing one. +## Directory Structure for AIDL audio HAL -## Directory Structure +The AIDL version is located inside `aidl` directory. The tree below explains +the role of each subdirectory: + +* `aidl_api` — snapshots of the API created each Android release. Every + release, the current version of the API becomes "frozen" and gets assigned + the next version number. If the API needs further modifications, they are + made on the "current" version. After making modifications, run + `m -update-api` to update the snapshot of the "current" + version. +* `android/hardware/audio/common` — data structures and interfaces shared + between various HALs: BT HAL, core and effects audio HALs. +* `android/hardware/audio/core` — data structures and interfaces of the + core audio HAL. +* `default` — the default, reference implementation of the audio HAL service. +* `vts` — VTS tests for the AIDL HAL. + +## Directory Structure for HIDL audio HAL + +Run `common/all-versions/copyHAL.sh` to create a new version of the HIDL audio +HAL based on an existing one. Note that this isn't possible since Android T +release. Android U and above uses AIDL audio HAL. * `2.0` — version 2.0 of the core HIDL API. Note that `.hal` files can not be moved into the `core` directory because that would change From d1f520e595c3c32ae0acb43fca9c5033d9965f63 Mon Sep 17 00:00:00 2001 From: Frankie Lizcano Date: Tue, 26 Jul 2022 20:05:46 +0000 Subject: [PATCH 163/998] Tuner HAL VTS: LnbLive Test Fix This CL checks to see if the frontends given in the LnbLive dataflow are accompanied by a software frontend. If so, these tests are not ran, because this does not model a real world use case that would be intentionally configured by a vendor. Furthermore, the implemented code fixes a bug that would cause the VTS to crash if the LnbLive tests were ran using a software frontend without the vendor having configred the Live dataflow. Previously, the workaround for using a software frontend with an Lnb was to use the dvr source configured in the live dataflow to simulate input to the frontend. Now that vendors do not need to provide this in their configuration file (because it will be automatically generated for them), this access causes an error that makes the VTS crash. With this new fix, this logic will never be exectuted, and the VTS will not crash in this case. Bug: b/240305035 Test: Test: vts-tradefed run vts --module VtsHalTvTunerTargetTest. Change-Id: I68dc7ff4cfd103a51e3e8d7c6ff787d349a9e241 --- tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp index b8e2912527..8739668bf4 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp @@ -170,7 +170,9 @@ void TunerBroadcastAidlTest::broadcastSingleFilterTestWithLnb(FilterConfig filte ASSERT_TRUE(mLnbTests.setVoltage(lnbConf.voltage)); ASSERT_TRUE(mLnbTests.setTone(lnbConf.tone)); ASSERT_TRUE(mLnbTests.setSatellitePosition(lnbConf.position)); - broadcastSingleFilterTest(filterConf, frontendConf); + if (!frontendConf.isSoftwareFe) { + broadcastSingleFilterTest(filterConf, frontendConf); + } ASSERT_TRUE(mLnbTests.closeLnb()); mLnbId = INVALID_LNB_ID; } @@ -499,7 +501,6 @@ TEST_P(TunerLnbAidlTest, SendDiseqcMessageToLnb) { } for (auto& combination : lnbLive_configs) { lnbLive = combination; - if (lnbMap[lnbLive.lnbId].name.compare(emptyHardwareId) == 0) { vector ids; ASSERT_TRUE(mLnbTests.getLnbIds(ids)); From 7ba56cd3b419a691c0ef648c053aba987bee67fc Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 29 Jul 2022 22:20:54 +0000 Subject: [PATCH 164/998] Remove authsecret HIDL entry in compat matrix. This interface has been converted to AIDL. Change-Id: I091ff4acb38c42821e99f785404e922d7b71ffa2 Test: TH Bug: 218588089 --- compatibility_matrices/compatibility_matrix.current.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index d899c2ce76..a0e801f43c 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -45,14 +45,6 @@ default - - android.hardware.authsecret - 1.0 - - IAuthSecret - default - - android.hardware.automotive.audiocontrol From ab540a18ea29151f35ff86707d5160f8b18b16c5 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 29 Jul 2022 22:26:04 +0000 Subject: [PATCH 165/998] Remove biometrics HIDL entry in compat matrix. This interface has been converted to AIDL. Test: TH Bug: 218588089 Change-Id: Ia3736a7d2a3f6e22dff266b3ee38896de9e0f46e --- .../compatibility_matrix.current.xml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index d899c2ce76..bdf9b77dc7 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -112,14 +112,6 @@ .* - - android.hardware.biometrics.face - 1.0 - - IBiometricsFace - default - - android.hardware.biometrics.face 2 @@ -128,14 +120,6 @@ default - - android.hardware.biometrics.fingerprint - 2.1-3 - - IBiometricsFingerprint - default - - android.hardware.biometrics.fingerprint 2 From bab2c1d73b046550537c3cecc59521af27cea9bf Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 29 Jul 2022 22:29:33 +0000 Subject: [PATCH 166/998] Remove camera.provider HIDL entry in compat matrix. This interface has been converted to AIDL. Test: TH Bug: 218588089 Change-Id: I093cc96bbe0afd06afacdf15f1a095b1ebe4ed13 --- compatibility_matrices/compatibility_matrix.current.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index d899c2ce76..d7770d8148 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -192,14 +192,6 @@ .* - - android.hardware.camera.provider - 2.4-7 - - ICameraProvider - [^/]+/[0-9]+ - - android.hardware.camera.provider 1 From 5ac980095ab447279d6ba09cf35cb2185aff04e0 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 29 Jul 2022 22:32:55 +0000 Subject: [PATCH 167/998] Remove drm HIDL entry in compat matrix. This interface has been converted to AIDL. Test: TH Bug: 218588089 Change-Id: I5dc9aac2d2a289cb7dbe1903b3e74553dd234fac --- .../compatibility_matrix.current.xml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index d899c2ce76..ea7f9b9738 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -239,18 +239,6 @@ .* - - android.hardware.drm - 1.3-4 - - ICryptoFactory - .* - - - IDrmFactory - .* - - android.hardware.dumpstate From 463a21ef0d52bfd38ab1276cbf0ac0e8b60ca4a6 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 29 Jul 2022 22:33:58 +0000 Subject: [PATCH 168/998] Remove gnss HIDL entry in compat matrix. This interface has been converted to AIDL. Test: TH Bug: 218588089 Change-Id: Ie50d679d770e56162cd4835ccdd02eda6a4cf7df --- compatibility_matrices/compatibility_matrix.current.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index d899c2ce76..57396a63bd 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -266,14 +266,6 @@ default - - android.hardware.gnss - 2.0-1 - - IGnss - default - - android.hardware.gnss 2 From f6e7b0d2844c4a21d045907f8333db6a108e71a7 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 29 Jul 2022 22:42:03 +0000 Subject: [PATCH 169/998] Remove graphics.allocator and .composer HIDL entries in compat matrix. This interface has been converted to AIDL. Test: TH Bug: 218588089 Change-Id: I99931d95165af3ffd1bb144716327291267692b9 --- .../compatibility_matrix.current.xml | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index d899c2ce76..f47b49e02a 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -298,21 +298,6 @@ default - - - android.hardware.graphics.allocator - - 2.0 - 3.0 - 4.0 - - IAllocator - default - - android.hardware.graphics.allocator 1 @@ -321,17 +306,6 @@ default - - - android.hardware.graphics.composer - 2.1-4 - - IComposer - default - - android.hardware.graphics.composer3 1 From 98e5f9a3080cbf1501bcd593a366ba01fd0b6630 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 29 Jul 2022 22:45:13 +0000 Subject: [PATCH 170/998] Remove keymaster HIDL entry in compat matrix. This interface has been converted to AIDL. Test: TH Bug: 218588089 Change-Id: Ibd115673d6776c94150dd57afe3e20718bc2ed8f --- .../compatibility_matrix.current.xml | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index d899c2ce76..d6811fe31f 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -406,23 +406,6 @@ default - - android.hardware.keymaster - 3.0 - 4.0-1 - - IKeymasterDevice - default - - - - android.hardware.keymaster - 4.0-1 - - IKeymasterDevice - strongbox - - android.hardware.security.dice 1 From ed3424a05e37e2bca8e06ca01e8d354ea82bc9fc Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 29 Jul 2022 22:48:49 +0000 Subject: [PATCH 171/998] Remove neuralnetworks HIDL entry in compat matrix. This interface has been converted to AIDL. Test: TH Bug: 218588089 Change-Id: I8284fb3ae3e53af209497243b219957699eb8e09 --- compatibility_matrices/compatibility_matrix.current.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index d899c2ce76..ea90ec3344 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -486,14 +486,6 @@ default - - android.hardware.neuralnetworks - 1.0-3 - - IDevice - .* - - android.hardware.neuralnetworks 1-4 From 7b2d27a90d72e396fe26745a477162cdd72af788 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 29 Jul 2022 22:50:18 +0000 Subject: [PATCH 172/998] Remove nfc HIDL entry in compat matrix. This interface has been converted to AIDL. Test: TH Bug: 218588089 Change-Id: I17e1afaf834170a4dc8d0c9c2bca3557131a3123 --- compatibility_matrices/compatibility_matrix.current.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index d899c2ce76..41244386b9 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -502,14 +502,6 @@ .* - - android.hardware.nfc - 1.2 - - INfc - default - - android.hardware.nfc From f38eae91fc3f83b862cde7f515fc799c66464917 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 29 Jul 2022 22:54:27 +0000 Subject: [PATCH 173/998] Remove soundtrigger HIDL entry in compat matrix. This interface has been converted to AIDL. Test: TH Bug: 218588089 Change-Id: Ie4c0f6eaefec7b99cda4de519298dc7f8720ff3d --- compatibility_matrices/compatibility_matrix.current.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index d899c2ce76..8593ad3650 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -674,14 +674,6 @@ default - - android.hardware.soundtrigger - 2.3 - - ISoundTriggerHw - default - - android.hardware.soundtrigger3 1 From d73ea21fcb562b2fb93b408bca7c1785eb49d2e8 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 29 Jul 2022 22:55:26 +0000 Subject: [PATCH 174/998] Remove tv.tuner HIDL entry in compat matrix. This interface has been converted to AIDL. Test: TH Bug: 218588089 Change-Id: Ia133521c5612c2af165cc1926fd9263718252f96 --- compatibility_matrices/compatibility_matrix.current.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index d899c2ce76..d96c1316f2 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -730,14 +730,6 @@ default - - android.hardware.tv.tuner - 1.0-1 - - ITuner - default - - android.hardware.tv.tuner 1 From e3aaf55b87f202042d84d0e41c16cf3b45815dff Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 29 Jul 2022 22:56:25 +0000 Subject: [PATCH 175/998] Remove usb HIDL entry in compat matrix. This interface has been converted to AIDL. Test: TH Bug: 218588089 Change-Id: Ibe2139b352ebb6bda141f227c1329c3625cc060f --- compatibility_matrices/compatibility_matrix.current.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index d899c2ce76..b8ca8557d9 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -746,14 +746,6 @@ default - - android.hardware.usb - 1.0-3 - - IUsb - default - - android.hardware.usb From 03cd34e2465129829c239f0f4899ae0e908370d1 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Mon, 11 Jul 2022 17:49:30 +0000 Subject: [PATCH 176/998] Create JsonConfigLoader. This CL adds a JsonConfigLoader to parse the vehicle proeprty config file in JSON format. This CL also adds DefaultConfigTest to verify the JSON file is compatible with the existing header file. Test: atest JsonConfigLoaderUnitTest atest VehicleHalDefaultConfigTest Bug: 238685398 Change-Id: If679afd2245cb7e2a49fd964f343b660c9bcea25 --- automotive/vehicle/TEST_MAPPING | 9 + .../aidl/impl/default_config/Android.bp | 10 +- .../JsonConfigLoader/Android.bp | 62 +++ .../include/ConfigDeclaration.h | 61 +++ .../include/JsonConfigLoader.h | 132 +++++ .../JsonConfigLoader/src/JsonConfigLoader.cpp | 315 +++++++++++ .../JsonConfigLoader/test/Android.bp | 51 ++ .../test/JsonConfigLoaderUnitTest.cpp | 507 ++++++++++++++++++ .../default_config/include/DefaultConfig.h | 14 +- .../aidl/impl/default_config/test/Android.bp | 42 ++ .../default_config/test/DefaultConfigTest.cpp | 78 ++- .../hardware/include/FakeVehicleHardware.h | 2 +- .../hardware/src/FakeVehicleHardware.cpp | 2 +- .../utils/test/include/TestPropertyUtils.h | 2 - 14 files changed, 1262 insertions(+), 25 deletions(-) create mode 100644 automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/Android.bp create mode 100644 automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/ConfigDeclaration.h create mode 100644 automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/JsonConfigLoader.h create mode 100644 automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp create mode 100644 automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/Android.bp create mode 100644 automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/JsonConfigLoaderUnitTest.cpp diff --git a/automotive/vehicle/TEST_MAPPING b/automotive/vehicle/TEST_MAPPING index fa0b79110e..da8416cd73 100644 --- a/automotive/vehicle/TEST_MAPPING +++ b/automotive/vehicle/TEST_MAPPING @@ -6,6 +6,15 @@ { "name": "VehicleHalDefaultConfigTest" }, + { + "name": "VehicleHalDefaultConfigTestEnableTestProperties" + }, + { + "name": "JsonConfigLoaderUnitTest" + }, + { + "name": "JsonConfigLoaderUnitTestEnableTestProperties" + }, { "name": "VehicleHalVehicleUtilsTest" }, diff --git a/automotive/vehicle/aidl/impl/default_config/Android.bp b/automotive/vehicle/aidl/impl/default_config/Android.bp index 0feaf23a73..aa22d8740a 100644 --- a/automotive/vehicle/aidl/impl/default_config/Android.bp +++ b/automotive/vehicle/aidl/impl/default_config/Android.bp @@ -25,7 +25,13 @@ cc_library_headers { export_include_dirs: ["include"], defaults: ["VehicleHalDefaults"], static_libs: ["VehicleHalUtils"], - header_libs: ["VehicleHalTestUtilHeaders"], + header_libs: [ + "VehicleHalJsonConfigLoaderHeaders", + "VehicleHalTestUtilHeaders", + ], export_static_lib_headers: ["VehicleHalUtils"], - export_header_lib_headers: ["VehicleHalTestUtilHeaders"], + export_header_lib_headers: [ + "VehicleHalTestUtilHeaders", + "VehicleHalJsonConfigLoaderHeaders", + ], } diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/Android.bp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/Android.bp new file mode 100644 index 0000000000..6984d5e2d5 --- /dev/null +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/Android.bp @@ -0,0 +1,62 @@ +/* + * 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. + */ + +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_library { + name: "VehicleHalJsonConfigLoader", + vendor: true, + srcs: ["src/*.cpp"], + local_include_dirs: ["include"], + export_include_dirs: ["include"], + defaults: ["VehicleHalDefaults"], + static_libs: ["VehicleHalUtils"], + header_libs: [ + "IVehicleGeneratedHeaders", + ], + shared_libs: ["libjsoncpp"], +} + +cc_library { + name: "VehicleHalJsonConfigLoaderEnableTestProperties", + vendor: true, + srcs: ["src/*.cpp"], + local_include_dirs: ["include"], + export_include_dirs: ["include"], + defaults: ["VehicleHalDefaults"], + static_libs: ["VehicleHalUtils"], + header_libs: [ + "VehicleHalTestUtilHeaders", + "IVehicleGeneratedHeaders", + ], + cflags: ["-DENABLE_VEHICLE_HAL_TEST_PROPERTIES"], + shared_libs: ["libjsoncpp"], +} + +cc_library_headers { + name: "VehicleHalJsonConfigLoaderHeaders", + vendor: true, + local_include_dirs: ["include"], + export_include_dirs: ["include"], + defaults: ["VehicleHalDefaults"], + static_libs: ["VehicleHalUtils"], + header_libs: [ + "IVehicleGeneratedHeaders", + ], + shared_libs: ["libjsoncpp"], +} diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/ConfigDeclaration.h b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/ConfigDeclaration.h new file mode 100644 index 0000000000..40ac1293cd --- /dev/null +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/ConfigDeclaration.h @@ -0,0 +1,61 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_default_config_JsonConfigLoader_include_ConfigDeclaration_H_ +#define android_hardware_automotive_vehicle_aidl_impl_default_config_JsonConfigLoader_include_ConfigDeclaration_H_ + +#include + +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +// ConfigDeclaration represents one property config, its optional initial value and its optional +// area configs and initial values for each area. +struct ConfigDeclaration { + aidl::android::hardware::automotive::vehicle::VehiclePropConfig config; + + // This value will be used as an initial value for the property. If this field is specified for + // property that supports multiple areas then it will be used for all areas unless particular + // area is overridden in initialAreaValue field. + aidl::android::hardware::automotive::vehicle::RawPropValues initialValue; + // Use initialAreaValues if it is necessary to specify different values per each area. + std::unordered_map + initialAreaValues; + + inline bool operator==(const ConfigDeclaration& other) const { + return (config == other.config && initialValue == other.initialValue && + initialAreaValues == other.initialAreaValues); + } + + friend std::ostream& operator<<(std::ostream& os, const ConfigDeclaration& c) { + return os << "Config Declaration for property: " + << aidl::android::hardware::automotive::vehicle::toString( + static_cast< + aidl::android::hardware::automotive::vehicle::VehicleProperty>( + c.config.prop)); + } +}; + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_default_config_JsonConfigLoader_include_ConfigDeclaration_H_ diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/JsonConfigLoader.h b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/JsonConfigLoader.h new file mode 100644 index 0000000000..a6e59e6fb4 --- /dev/null +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/JsonConfigLoader.h @@ -0,0 +1,132 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_vehicle_aidl_impl_default_config_JsonConfigLoader_include_JsonConfigLoader_H_ +#define android_hardware_automotive_vehicle_aidl_impl_default_config_JsonConfigLoader_include_JsonConfigLoader_H_ + +#include +#include + +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +// private namespace +namespace jsonconfigloader_impl { + +// A class to parse a value field in JSON config file. +// If the field is a string and the field is in the format of "XX::XX", the value will be parsed +// as a constant value in the format of "TYPE::NAME". Otherwise, the field will be return as is +// converted to the expected type. +class JsonValueParser final { + public: + JsonValueParser(); + + android::base::Result parseStringValue(const std::string& fieldName, + const Json::Value& value) const; + + template + android::base::Result> parseArray(const std::string& fieldName, + const Json::Value& value) const; + + template + android::base::Result parseValue(const std::string& fieldName, + const Json::Value& value) const; + + private: + template + static android::base::Result convertValueToType(const std::string& fieldName, + const Json::Value& value); + + std::optional> maybeGetTypeAndValueName( + const std::string& jsonFieldValue) const; +}; + +// The main class to parse a VHAL config file in JSON format. +class JsonConfigParser { + public: + android::base::Result> parseJsonConfig(std::istream& is); + + private: + JsonValueParser mValueParser; + + // Parses configuration for each property. + std::optional parseEachProperty(const Json::Value& propJsonValue, + std::vector* errors); + // Tries to parse a JSON value to a specific type. + // + // If fieldIsOptional is True, then if the field specified by "fieldName" does not exist, + // this method will return true without doing anything, otherwise, it will return false. + // + // @param parentJsonNode The parent node of the field you are going to parse. + // @param fieldName The name for the field. + // @param fieldIsOptional Whether the field is optional. + // @param outPtr The pointer to output to if the field exists and parsing succeeded. + // @param errors The error array to append error to if errors are found. + // @return true if the field is optional and does not exist or parsed successfully. + template + bool tryParseJsonValueToVariable(const Json::Value& parentJsonNode, + const std::string& fieldName, bool fieldIsOptional, T* outPtr, + std::vector* errors); + // Tries to parse a JSON value to an array of specific type. + // + // If fieldIsOptional is True, then if the field specified by "fieldName" does not exist, + // this method will return true without doing anything, otherwise, it will return false. + // + // @param parentJsonNode The parent node of the field you are going to parse. + // @param fieldName The name for the field. + // @param fieldIsOptional Whether the field is optional. + // @param outPtr The pointer to output to if the field exists and parsing succeeded. + // @param errors The error array to append error to if errors are found. + // @return true if the field is optional and does not exist or parsed successfully. + template + bool tryParseJsonArrayToVariable(const Json::Value& parentJsonNode, + const std::string& fieldName, bool fieldIsOptional, + std::vector* outPtr, std::vector* errors); + + // Parses a JSON field to RawPropValues. + void parsePropValues(const Json::Value& parentJsonNode, const std::string& fieldName, + aidl::android::hardware::automotive::vehicle::RawPropValues* outPtr, + std::vector* errors); +}; + +} // namespace jsonconfigloader_impl + +// A class to load vehicle property configs and initial values in JSON format. +class JsonConfigLoader final { + public: + JsonConfigLoader(); + + // Loads a JSON file stream and parses it to a list of ConfigDeclarations. + android::base::Result> loadPropConfig(std::istream& is); + + private: + std::unique_ptr mParser; +}; + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android + +#endif // android_hardware_automotive_vehicle_aidl_impl_default_config_JsonConfigLoader_include_JsonConfigLoader_H_ diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp new file mode 100644 index 0000000000..c569b33a7a --- /dev/null +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -0,0 +1,315 @@ +/* + * 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. + */ + +#include + +#include +#include +#include + +#ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES +#include +#endif // ENABLE_VEHICLE_HAL_TEST_PROPERTIES + +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +namespace jsonconfigloader_impl { + +using ::aidl::android::hardware::automotive::vehicle::AccessForVehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::ChangeModeForVehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::EvConnectorType; +using ::aidl::android::hardware::automotive::vehicle::EvsServiceState; +using ::aidl::android::hardware::automotive::vehicle::EvsServiceType; +using ::aidl::android::hardware::automotive::vehicle::FuelType; +using ::aidl::android::hardware::automotive::vehicle::GsrComplianceRequirementType; +using ::aidl::android::hardware::automotive::vehicle::RawPropValues; +using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport; +using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq; +using ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig; +using ::aidl::android::hardware::automotive::vehicle::VehicleAreaWindow; +using ::aidl::android::hardware::automotive::vehicle::VehicleGear; +using ::aidl::android::hardware::automotive::vehicle::VehicleHvacFanDirection; +using ::aidl::android::hardware::automotive::vehicle::VehicleIgnitionState; +using ::aidl::android::hardware::automotive::vehicle::VehicleOilLevel; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; +using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyChangeMode; +using ::aidl::android::hardware::automotive::vehicle::VehicleSeatOccupancyState; +using ::aidl::android::hardware::automotive::vehicle::VehicleTurnSignal; +using ::aidl::android::hardware::automotive::vehicle::VehicleUnit; +using ::aidl::android::hardware::automotive::vehicle::VehicleVendorPermission; + +using ::android::base::Error; +using ::android::base::Result; + +template <> +Result JsonValueParser::convertValueToType(const std::string& fieldName, + const Json::Value& value) { + if (!value.isInt()) { + return Error() << "The value: " << value << " for field: " << fieldName + << " is not in correct type, expect int"; + } + return static_cast(value.asInt()); +} + +template <> +Result JsonValueParser::convertValueToType(const std::string& fieldName, + const Json::Value& value) { + // isFloat value does not exist, so we use isDouble here. + if (!value.isDouble()) { + return Error() << "The value: " << value << " for field: " << fieldName + << " is not in correct type, expect float"; + } + return value.asFloat(); +} + +template <> +Result JsonValueParser::convertValueToType(const std::string& fieldName, + const Json::Value& value) { + if (!value.isInt64()) { + return Error() << "The value: " << value << " for field: " << fieldName + << " is not in correct type, expect int64"; + } + return static_cast(value.asInt64()); +} + +template <> +Result JsonValueParser::convertValueToType(const std::string& fieldName, + const Json::Value& value) { + if (!value.isString()) { + return Error() << "The value: " << value << " for field: " << fieldName + << " is not in correct type, expect string"; + } + return value.asString(); +} + +Result JsonValueParser::parseStringValue(const std::string& fieldName, + const Json::Value& value) const { + return convertValueToType(fieldName, value); +} + +template +Result JsonValueParser::parseValue(const std::string& fieldName, + const Json::Value& value) const { + if (!value.isString()) { + return convertValueToType(fieldName, value); + } + auto maybeTypeAndValue = maybeGetTypeAndValueName(value.asString()); + if (!maybeTypeAndValue.has_value()) { + return Error() << "Invalid constant value: " << value << " for field: " << fieldName; + } + auto constantParseResult = parseConstantValue(maybeTypeAndValue.value()); + if (!constantParseResult.ok()) { + return constantParseResult.error(); + } + int constantValue = constantParseResult.value(); + return static_cast(constantValue); +} + +template <> +Result JsonValueParser::parseValue(const std::string& fieldName, + const Json::Value& value) const { + return parseStringValue(fieldName, value); +} + +template +Result> JsonValueParser::parseArray(const std::string& fieldName, + const Json::Value& value) const { + if (!value.isArray()) { + return Error() << "The value: " << value << " for field: " << fieldName + << " is not in correct type, expect array"; + } + std::vector parsedValues; + for (unsigned int i = 0; i < value.size(); i++) { + auto result = parseValue(fieldName, value[i]); + if (!result.ok()) { + return result.error(); + } + parsedValues.push_back(result.value()); + } + return std::move(parsedValues); +} + +std::optional> JsonValueParser::maybeGetTypeAndValueName( + const std::string& jsonFieldValue) const { + size_t pos = jsonFieldValue.find(DELIMITER); + if (pos == std::string::npos) { + return {}; + } + std::string type = jsonFieldValue.substr(0, pos); + std::string valueName = jsonFieldValue.substr(pos + DELIMITER.length(), std::string::npos); + return std::make_pair(type, valueName); +} + +Result JsonValueParser::parseConstantValue(const std::pair&) const { + // TODO(b/238685398): Implement this. +} + +template +bool JsonConfigParser::tryParseJsonValueToVariable(const Json::Value& parentJsonNode, + const std::string& fieldName, + bool fieldIsOptional, T* outPtr, + std::vector* errors) { + if (!parentJsonNode.isObject()) { + errors->push_back("Node: " + parentJsonNode.toStyledString() + " is not an object"); + return false; + } + if (!parentJsonNode.isMember(fieldName)) { + if (!fieldIsOptional) { + errors->push_back("Missing required field: " + fieldName + + " in node: " + parentJsonNode.toStyledString()); + return false; + } + return true; + } + auto result = mValueParser.parseValue(fieldName, parentJsonNode[fieldName]); + if (!result.ok()) { + errors->push_back(result.error().message()); + return false; + } + *outPtr = std::move(result.value()); + return true; +} + +template +bool JsonConfigParser::tryParseJsonArrayToVariable(const Json::Value& parentJsonNode, + const std::string& fieldName, + bool fieldIsOptional, std::vector* outPtr, + std::vector* errors) { + if (!parentJsonNode.isObject()) { + errors->push_back("Node: " + parentJsonNode.toStyledString() + " is not an object"); + return false; + } + if (!parentJsonNode.isMember(fieldName)) { + if (!fieldIsOptional) { + errors->push_back("Missing required field: " + fieldName + + " in node: " + parentJsonNode.toStyledString()); + return false; + } + return true; + } + auto result = mValueParser.parseArray(fieldName, parentJsonNode[fieldName]); + if (!result.ok()) { + errors->push_back(result.error().message()); + return false; + } + *outPtr = std::move(result.value()); + return true; +} + +void JsonConfigParser::parsePropValues(const Json::Value& parentJsonNode, + const std::string& fieldName, RawPropValues* outPtr, + std::vector* errors) { + if (!parentJsonNode.isObject()) { + errors->push_back("Node: " + parentJsonNode.toStyledString() + " is not an object"); + return; + } + if (!parentJsonNode.isMember(fieldName)) { + return; + } + const Json::Value& jsonValue = parentJsonNode[fieldName]; + tryParseJsonArrayToVariable(jsonValue, "int32Values", /*optional=*/true, &(outPtr->int32Values), + errors); + tryParseJsonArrayToVariable(jsonValue, "floatValues", /*optional=*/true, &(outPtr->floatValues), + errors); + tryParseJsonArrayToVariable(jsonValue, "int64Values", /*optional=*/true, &(outPtr->int64Values), + errors); + // We don't support "byteValues" yet. + tryParseJsonValueToVariable(jsonValue, "stringValue", /*optional=*/true, &(outPtr->stringValue), + errors); +} + +std::optional JsonConfigParser::parseEachProperty( + const Json::Value& propJsonValue, std::vector* errors) { + size_t initialErrorCount = errors->size(); + ConfigDeclaration configDecl = {}; + int32_t propId; + + if (!tryParseJsonValueToVariable(propJsonValue, "property", /*optional=*/false, &propId, + errors)) { + return std::nullopt; + } + + configDecl.config.prop = propId; + std::string propStr = propJsonValue["property"].toStyledString(); + + // TODO(b/238685398): Parse access and changeMode. + + tryParseJsonValueToVariable(propJsonValue, "configString", /*optional=*/true, + &configDecl.config.configString, errors); + + tryParseJsonArrayToVariable(propJsonValue, "configArray", /*optional=*/true, + &configDecl.config.configArray, errors); + + parsePropValues(propJsonValue, "defaultValue", /*optional=*/true, &configDecl.initialValue, + errors); + + tryParseJsonValueToVariable(propJsonValue, "minSampleRate", /*optional=*/true, + &configDecl.config.minSampleRate, errors); + + tryParseJsonValueToVariable(propJsonValue, "maxSampleRate", /*optional=*/true, + &configDecl.config.maxSampleRate, errors); + + // TODO(b/238685398): AreaConfigs + + if (errors->size() != initialErrorCount) { + return std::nullopt; + } + return configDecl; +} + +Result> JsonConfigParser::parseJsonConfig(std::istream& is) { + Json::CharReaderBuilder builder; + Json::Value root; + std::vector configs; + std::string errs; + if (!Json::parseFromStream(builder, is, &root, &errs)) { + return Error() << "Failed to parse property config file as JSON, error: " << errs; + } + Json::Value properties = root["properties"]; + std::vector errors; + for (unsigned int i = 0; i < properties.size(); i++) { + if (auto maybeConfig = parseEachProperty(properties[i], &errors); maybeConfig.has_value()) { + configs.push_back(std::move(maybeConfig.value())); + } + } + if (!errors.empty()) { + return Error() << android::base::Join(errors, '\n'); + } + return configs; +} + +} // namespace jsonconfigloader_impl + +JsonConfigLoader::JsonConfigLoader() { + mParser = std::make_unique(); +} + +android::base::Result> JsonConfigLoader::loadPropConfig( + std::istream& is) { + return mParser->parseJsonConfig(is); +} + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/Android.bp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/Android.bp new file mode 100644 index 0000000000..dae37b9ae0 --- /dev/null +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/Android.bp @@ -0,0 +1,51 @@ +/* + * 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. + */ + +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_test { + name: "JsonConfigLoaderUnitTest", + vendor: true, + srcs: ["*.cpp"], + static_libs: [ + "VehicleHalJsonConfigLoader", + "VehicleHalUtils", + "libgtest", + ], + shared_libs: [ + "libjsoncpp", + ], + defaults: ["VehicleHalDefaults"], + test_suites: ["device-tests"], +} + +cc_test { + name: "JsonConfigLoaderUnitTestEnableTestProperties", + vendor: true, + srcs: ["*.cpp"], + static_libs: [ + "VehicleHalJsonConfigLoaderEnableTestProperties", + "VehicleHalUtils", + "libgtest", + ], + shared_libs: [ + "libjsoncpp", + ], + defaults: ["VehicleHalDefaults"], + test_suites: ["device-tests"], +} diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/JsonConfigLoaderUnitTest.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/JsonConfigLoaderUnitTest.cpp new file mode 100644 index 0000000000..469e7d67b0 --- /dev/null +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/JsonConfigLoaderUnitTest.cpp @@ -0,0 +1,507 @@ +/* + * 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. + */ + +#include + +#include + +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +using ::aidl::android::hardware::automotive::vehicle::RawPropValues; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; +using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyChangeMode; + +class JsonConfigLoaderUnitTest : public ::testing::Test { + protected: + JsonConfigLoader mLoader; +}; + +TEST_F(JsonConfigLoaderUnitTest, TestBasic) { + std::istringstream iss(R"( + { + "properties": [{ + "property": 291504388 + }] + } + )"); + + auto result = mLoader.loadPropConfig(iss); + + ASSERT_TRUE(result.ok()) << result.error().message(); + + auto configs = result.value(); + ASSERT_EQ(configs.size(), 1u); + + ASSERT_EQ(configs[0].config.prop, 291504388); +} + +TEST_F(JsonConfigLoaderUnitTest, TestPropertyIsEnum) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::INFO_FUEL_CAPACITY" + }] + } + )"); + + auto result = mLoader.loadPropConfig(iss); + + ASSERT_TRUE(result.ok()) << result.error().message(); + + auto configs = result.value(); + ASSERT_EQ(configs.size(), 1u); + + ASSERT_EQ(configs[0].config.prop, toInt(VehicleProperty::INFO_FUEL_CAPACITY)); +} + +TEST_F(JsonConfigLoaderUnitTest, TestPropertyEnum_FailInvalidEnum) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::BLAH" + }] + } + )"); + + ASSERT_FALSE(mLoader.loadPropConfig(iss).ok()) + << "Invalid VehicleProperty enum must cause error"; +} + +TEST_F(JsonConfigLoaderUnitTest, TestPropertyEnum_FailInvalidType) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "test" + }] + } + )"); + + ASSERT_FALSE(mLoader.loadPropConfig(iss).ok()) + << "Invalid VehicleProperty type must cause error"; +} + +TEST_F(JsonConfigLoaderUnitTest, TestProperty_FailInvalidJson) { + std::istringstream iss(R"( + { + "properties": [{ + } + )"); + + ASSERT_FALSE(mLoader.loadPropConfig(iss);.ok()) << "Invalid JSON format must cause error"; +} + +TEST_F(JsonConfigLoaderUnitTest, TestConfigArray) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::INFO_FUEL_CAPACITY", + "configArray": [1, 2, 3] + }] + } + )"); + + auto result = mLoader.loadPropConfig(iss); + + ASSERT_TRUE(result.ok()) << result.error().message(); + + auto configs = result.value(); + ASSERT_EQ(configs.size(), 1u); + ASSERT_EQ(configs[0].config.configArray, std::vector({1, 2, 3})); +} + +TEST_F(JsonConfigLoaderUnitTest, TestConfigArrayConstants) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::INFO_FUEL_CAPACITY", + "configArray": [1, 2, "Constants::FUEL_DOOR_REAR_LEFT"] + }] + } + )"); + + auto result = mLoader.loadPropConfig(iss); + + ASSERT_TRUE(result.ok()) << result.error().message(); + + auto configs = result.value(); + ASSERT_EQ(configs.size(), 1u); + ASSERT_EQ(configs[0].config.configArray, std::vector({1, 2, FUEL_DOOR_REAR_LEFT})); +} + +// We have special logic to deal with GALLON and US_GALLON since they share the same value. +TEST_F(JsonConfigLoaderUnitTest, TestConfigArrayUnitGallon) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::INFO_FUEL_CAPACITY", + "configArray": [1, 2, "VehicleUnit::GALLON"] + }] + } + )"); + + auto result = mLoader.loadPropConfig(iss); + + ASSERT_TRUE(result.ok()) << result.error().message(); +} + +TEST_F(JsonConfigLoaderUnitTest, TestConfigArrayUnitUsGallon) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::INFO_FUEL_CAPACITY", + "configArray": [1, 2, "VehicleUnit::US_GALLON"] + }] + } + )"); + + auto result = mLoader.loadPropConfig(iss); + + ASSERT_TRUE(result.ok()) << result.error().message(); +} + +TEST_F(JsonConfigLoaderUnitTest, TestConfigArray_FailInvalidEnum) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::INFO_FUEL_CAPACITY", + "configArray": [1, 2, "VehicleUnits::BLAH"] + }] + } + )"); + + ASSERT_FALSE(mLoader.loadPropConfig(iss).ok()) + << "Invalid enum in ConfigArray must cause error"; +} + +TEST_F(JsonConfigLoaderUnitTest, TestConfigArray_FailNotArray) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::INFO_FUEL_CAPACITY", + "configArray": "123" + }] + } + )"); + + ASSERT_FALSE(mLoader.loadPropConfig(iss).ok()) + << "ConfigArray is not an array must cause error"; +} + +TEST_F(JsonConfigLoaderUnitTest, TestConfigString) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::INFO_FUEL_CAPACITY", + "configString": "test" + }] + } + )"); + + auto result = mLoader.loadPropConfig(iss); + + ASSERT_TRUE(result.ok()) << result.error().message(); + + auto configs = result.value(); + ASSERT_EQ(configs.size(), 1u); + ASSERT_EQ(configs[0].config.configString, "test"); +} + +TEST_F(JsonConfigLoaderUnitTest, TestConfigString_FailNotString) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::INFO_FUEL_CAPACITY", + "configString": 1234 + }] + } + )"); + + ASSERT_FALSE(mLoader.loadPropConfig(iss).ok()) + << "ConfigString is not a String must cause error"; +} + +TEST_F(JsonConfigLoaderUnitTest, TestCheckDefaultAccessChangeMode) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::INFO_FUEL_CAPACITY" + }] + } + )"); + + auto result = mLoader.loadPropConfig(iss); + + ASSERT_TRUE(result.ok()) << result.error().message(); + auto configs = result.value(); + ASSERT_EQ(configs.size(), 1u); + + const VehiclePropConfig& propConfig = configs[0].config; + ASSERT_EQ(propConfig.access, VehiclePropertyAccess::READ); + ASSERT_EQ(propConfig.changeMode, VehiclePropertyChangeMode::STATIC); +} + +TEST_F(JsonConfigLoaderUnitTest, TestAccessOverride) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::INFO_FUEL_CAPACITY", + "access": "VehiclePropertyAccess::WRITE" + }] + } + )"); + + auto result = mLoader.loadPropConfig(iss); + + ASSERT_TRUE(result.ok()) << result.error().message(); + auto configs = result.value(); + ASSERT_EQ(configs.size(), 1u); + + const VehiclePropConfig& propConfig = configs[0].config; + ASSERT_EQ(propConfig.access, VehiclePropertyAccess::WRITE); + ASSERT_EQ(propConfig.changeMode, VehiclePropertyChangeMode::STATIC); +} + +TEST_F(JsonConfigLoaderUnitTest, TestChangeModeOverride) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::INFO_FUEL_CAPACITY", + "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" + }] + } + )"); + + auto result = mLoader.loadPropConfig(iss); + + ASSERT_TRUE(result.ok()) << result.error().message(); + auto configs = result.value(); + ASSERT_EQ(configs.size(), 1u); + + const VehiclePropConfig& propConfig = configs[0].config; + ASSERT_EQ(propConfig.access, VehiclePropertyAccess::READ); + ASSERT_EQ(propConfig.changeMode, VehiclePropertyChangeMode::ON_CHANGE); +} + +TEST_F(JsonConfigLoaderUnitTest, TestCustomProp) { + std::istringstream iss(R"( + { + "properties": [{ + "property": 1234, + "access": "VehiclePropertyAccess::WRITE", + "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" + }] + } + )"); + + auto result = mLoader.loadPropConfig(iss); + + ASSERT_TRUE(result.ok()) << result.error().message(); + auto configs = result.value(); + ASSERT_EQ(configs.size(), 1u); + + const VehiclePropConfig& propConfig = configs[0].config; + ASSERT_EQ(propConfig.access, VehiclePropertyAccess::WRITE); + ASSERT_EQ(propConfig.changeMode, VehiclePropertyChangeMode::ON_CHANGE); +} + +TEST_F(JsonConfigLoaderUnitTest, TestCustomProp_FailMissingAccess) { + std::istringstream iss(R"( + { + "properties": [{ + "property": 1234, + "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" + }] + } + )"); + + ASSERT_FALSE(mLoader.loadPropConfig(iss).ok()) + << "Missing access for custom property must cause error"; +} + +TEST_F(JsonConfigLoaderUnitTest, TestCustomProp_FailMissingChangeMode) { + std::istringstream iss(R"( + { + "properties": [{ + "property": 1234, + "access": "VehiclePropertyAccess::WRITE" + }] + } + )"); + + ASSERT_FALSE(mLoader.loadPropConfig(iss).ok()) + << "Missing change mode for custom property must cause error"; +} + +TEST_F(JsonConfigLoaderUnitTest, TestMinSampleRate) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::INFO_FUEL_CAPACITY", + "minSampleRate": 1, + }] + } + )"); + + auto result = mLoader.loadPropConfig(iss); + + ASSERT_TRUE(result.ok()) << result.error().message(); + + auto configs = result.value(); + ASSERT_EQ(configs.size(), 1u); + ASSERT_EQ(configs[0].config.minSampleRate, 1); +} + +TEST_F(JsonConfigLoaderUnitTest, TestMinSampleRate_FailInvalidType) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::INFO_FUEL_CAPACITY", + "minSampleRate": "abcd", + }] + } + )"); + + ASSERT_FALSE(mLoader.loadPropConfig(iss).ok()) + << "Wrong type for MinSampleRate must cause error"; +} + +TEST_F(JsonConfigLoaderUnitTest, TestMaxSampleRate) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::INFO_FUEL_CAPACITY", + "maxSampleRate": 1, + }] + } + )"); + + auto result = mLoader.loadPropConfig(iss); + + ASSERT_TRUE(result.ok()) << result.error().message(); + + auto configs = result.value(); + ASSERT_EQ(configs.size(), 1u); + ASSERT_EQ(configs[0].config.maxSampleRate, 1); +} + +TEST_F(JsonConfigLoaderUnitTest, TestMaxSampleRate_FailInvalidType) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::INFO_FUEL_CAPACITY", + "maxSampleRate": "abcd", + }] + } + )"); + + ASSERT_FALSE(mLoader.loadPropConfig(iss).ok()) + << "Wrong type for MaxSampleRate must cause error"; +} + +TEST_F(JsonConfigLoaderUnitTest, TestDefaultValue_Simple) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::INFO_FUEL_CAPACITY", + "defaultValue": { + "int32Values": [1, 2] + } + }] + } + )"); + + auto result = mLoader.loadPropConfig(iss); + + ASSERT_TRUE(result.ok()) << result.error().message(); + + auto configs = result.value(); + ASSERT_EQ(configs.size(), 1u); + ASSERT_EQ(configs[0].initialValue.int32Values, std::vector({1, 2})); +} + +TEST_F(JsonConfigLoaderUnitTest, TestDefaultValue_Mixed) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::INFO_FUEL_CAPACITY", + "defaultValue": { + "int32Values": [1, "Constants::FUEL_DOOR_REAR_LEFT"], + "int64Values": [2, "Constants::FUEL_DOOR_REAR_LEFT"], + "floatValues": [3.0, "Constants::FUEL_DOOR_REAR_LEFT"], + "stringValue": "abcd" + } + }] + } + )"); + + auto result = mLoader.loadPropConfig(iss); + + ASSERT_TRUE(result.ok()) << result.error().message(); + + auto configs = result.value(); + ASSERT_EQ(configs.size(), 1u); + + const RawPropValues& initialValue = configs[0].initialValue; + ASSERT_EQ(initialValue.int32Values, std::vector({1, FUEL_DOOR_REAR_LEFT})); + ASSERT_EQ(initialValue.int64Values, + std::vector({2, static_cast(FUEL_DOOR_REAR_LEFT)})); + ASSERT_EQ(initialValue.floatValues, + std::vector({3.0, static_cast(FUEL_DOOR_REAR_LEFT)})); + ASSERT_EQ(initialValue.stringValue, "abcd"); +} + +TEST_F(JsonConfigLoaderUnitTest, TestDefaultValue_FailNotObject) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::INFO_FUEL_CAPACITY", + "defaultValue": [] + }] + } + )"); + + ASSERT_FALSE(mLoader.loadPropConfig(iss).ok()) + << "DefaultValue is not an object must cause error"; +} + +TEST_F(JsonConfigLoaderUnitTest, TestDefaultValue_FailInvalidType) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::INFO_FUEL_CAPACITY", + "defaultValue": [{ + "int32Values": [1.1] + }] + }] + } + )"); + + ASSERT_FALSE(mLoader.loadPropConfig(iss).ok()) + << "Wrong type for DefaultValue must cause error"; +} + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index 1ff3f3388e..b1ed0c01a9 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -17,6 +17,7 @@ #ifndef android_hardware_automotive_vehicle_aidl_impl_default_config_include_DefaultConfig_H_ #define android_hardware_automotive_vehicle_aidl_impl_default_config_include_DefaultConfig_H_ +#include #include #include #include @@ -56,17 +57,6 @@ using ::aidl::android::hardware::automotive::vehicle::VehicleTurnSignal; using ::aidl::android::hardware::automotive::vehicle::VehicleUnit; using ::aidl::android::hardware::automotive::vehicle::VehicleVendorPermission; -struct ConfigDeclaration { - VehiclePropConfig config; - - // This value will be used as an initial value for the property. If this field is specified for - // property that supports multiple areas then it will be used for all areas unless particular - // area is overridden in initialAreaValue field. - RawPropValues initialValue; - // Use initialAreaValues if it is necessary to specify different values per each area. - std::map initialAreaValues; -}; - const std::vector kVehicleProperties = { {.config = { @@ -1549,8 +1539,6 @@ const std::vector kVehicleProperties = { // public namespace namespace defaultconfig { -typedef defaultconfig_impl::ConfigDeclaration ConfigDeclaration; - inline constexpr const std::vector& getDefaultConfigs() { return defaultconfig_impl::kVehicleProperties; } diff --git a/automotive/vehicle/aidl/impl/default_config/test/Android.bp b/automotive/vehicle/aidl/impl/default_config/test/Android.bp index 771472c8c1..b05d47c6aa 100644 --- a/automotive/vehicle/aidl/impl/default_config/test/Android.bp +++ b/automotive/vehicle/aidl/impl/default_config/test/Android.bp @@ -24,11 +24,53 @@ cc_test { defaults: ["VehicleHalDefaults"], srcs: ["*.cpp"], static_libs: [ + "VehicleHalJsonConfigLoader", "VehicleHalUtils", + "libgmock", "libgtest", ], header_libs: [ + // TODO(b/238685398): Remove this once we deprecate DefaultConfig.h "VehicleHalDefaultConfig", + "IVehicleGeneratedHeaders", + ], + shared_libs: [ + "libjsoncpp", + ], + data: [ + ":VehicleHalDefaultProperties_JSON", + ], + test_suites: ["device-tests"], +} + +cc_test { + name: "VehicleHalDefaultConfigTestEnableTestProperties", + vendor: true, + defaults: ["VehicleHalDefaults"], + srcs: ["*.cpp"], + static_libs: [ + "VehicleHalJsonConfigLoaderEnableTestProperties", + "VehicleHalUtils", + "libgmock", + "libgtest", + ], + cflags: [ + // TODO(b/238685398): Remove this once we deprecate DefaultConfig.h + "-DENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING", + "-DENABLE_VEHICLE_HAL_TEST_PROPERTIES", + ], + header_libs: [ + // TODO(b/238685398): Remove this once we deprecate DefaultConfig.h + "VehicleHalDefaultConfig", + "IVehicleGeneratedHeaders", + ], + shared_libs: [ + "libjsoncpp", + ], + data: [ + ":VehicleHalDefaultProperties_JSON", + ":VehicleHalTestProperties_JSON", + ":VehicleHalVendorClusterTestProperties_JSON", ], test_suites: ["device-tests"], } diff --git a/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp b/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp index baaae75108..ba1100fecc 100644 --- a/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp +++ b/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp @@ -15,26 +15,92 @@ */ #include +#include #include +#include +#include #include +#include namespace android { namespace hardware { namespace automotive { namespace vehicle { -namespace defaultconfig { namespace test { -TEST(DefaultConfigTest, loadDefaultConfigs) { - for (ConfigDeclaration config : getDefaultConfigs()) { - ASSERT_NE(0, config.config.prop); - } +using ::android::base::Error; +using ::android::base::Result; +using ::testing::UnorderedElementsAreArray; + +constexpr char kDefaultPropertiesConfigFile[] = "DefaultProperties.json"; + +#ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES +constexpr char kTestPropertiesConfigFile[] = "TestProperties.json"; +constexpr char kVendorClusterTestPropertiesConfigFile[] = "VendorClusterTestProperties.json"; +#endif // ENABLE_VEHICLE_HAL_TEST_PROPERTIES + +std::string getTestFilePath(const char* filename) { + static std::string baseDir = android::base::GetExecutableDirectory(); + return baseDir + "/" + filename; } +Result> loadConfig(JsonConfigLoader& loader, const char* path) { + std::string configPath = getTestFilePath(path); + std::ifstream ifs(configPath.c_str()); + if (!ifs) { + return Error() << "couldn't open %s for parsing." << configPath; + } + + return loader.loadPropConfig(ifs); +} + +TEST(DefaultConfigTest, TestloadDefaultProperties) { + JsonConfigLoader loader; + auto result = loadConfig(loader, kDefaultPropertiesConfigFile); + + ASSERT_TRUE(result.ok()) << result.error().message(); +} + +#ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES + +TEST(DefaultConfigTest, TestloadTestProperties) { + JsonConfigLoader loader; + auto result = loadConfig(loader, kTestPropertiesConfigFile); + + ASSERT_TRUE(result.ok()) << result.error().message(); +} + +TEST(DefaultConfigTest, TestloadVendorClusterTestProperties) { + JsonConfigLoader loader; + auto result = loadConfig(loader, kVendorClusterTestPropertiesConfigFile); + + ASSERT_TRUE(result.ok()) << result.error().message(); +} + +// TODO(b/238685398): Remove this test after we deprecate DefaultConfig.h +TEST(DefaultConfigTest, TestCompatibleWithDefaultConfigHeader) { + auto configsFromHeaderFile = defaultconfig::getDefaultConfigs(); + + std::vector configsFromJson; + JsonConfigLoader loader; + for (const char* file : + std::vector({kDefaultPropertiesConfigFile, kTestPropertiesConfigFile, + kVendorClusterTestPropertiesConfigFile})) { + auto result = loadConfig(loader, file); + ASSERT_TRUE(result.ok()) << result.error().message(); + configsFromJson.insert(configsFromJson.end(), result.value().begin(), result.value().end()); + } + + ASSERT_EQ(configsFromHeaderFile.size(), configsFromJson.size()); + // TODO(b/238685398): Uncomment this once we finish the parser. + // ASSERT_THAT(configsFromHeaderFile, UnorderedElementsAreArray(configsFromJson)); +} + +#endif // ENABLE_VEHICLE_HAL_TEST_PROPERTIES + } // namespace test -} // namespace defaultconfig } // namespace vehicle } // namespace automotive } // namespace hardware diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h index 8cc19b12f8..9091feec00 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h @@ -153,7 +153,7 @@ class FakeVehicleHardware : public IVehicleHardware { void init(); // Stores the initial value to property store. - void storePropInitialValue(const defaultconfig::ConfigDeclaration& config); + void storePropInitialValue(const ConfigDeclaration& config); // The callback that would be called when a vehicle property value change happens. void onValueChangeCallback( const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value); diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index 7c451fed8b..c6ec85debd 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -97,7 +97,7 @@ const std::unordered_set SET_PROP_OPTIONS = { } // namespace -void FakeVehicleHardware::storePropInitialValue(const defaultconfig::ConfigDeclaration& config) { +void FakeVehicleHardware::storePropInitialValue(const ConfigDeclaration& config) { const VehiclePropConfig& vehiclePropConfig = config.config; int propId = vehiclePropConfig.prop; diff --git a/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h b/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h index d512713cc9..e6ea6fef2e 100644 --- a/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h +++ b/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h @@ -35,7 +35,6 @@ using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; } // namespace testpropertyutils_impl -#ifdef ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING // Converts the system property to the vendor property. // WARNING: This is only for the end-to-end testing, Should NOT include in the user build. inline constexpr int32_t toVendor( @@ -55,7 +54,6 @@ constexpr int32_t VENDOR_CLUSTER_REQUEST_DISPLAY = toVendor(testpropertyutils_impl::VehicleProperty::CLUSTER_REQUEST_DISPLAY); constexpr int32_t VENDOR_CLUSTER_NAVIGATION_STATE = toVendor(testpropertyutils_impl::VehicleProperty::CLUSTER_NAVIGATION_STATE); -#endif // ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING // These properties are placeholder properties for developers to test new features without // implementing a real property. From 6707175ba457091b4949eaaf4a825beb4937ce2e Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Thu, 21 Jul 2022 03:06:18 +0000 Subject: [PATCH 177/998] Add constant value parsers. To allow better readibility, we allow the property config file to use string value to represent constant values. For example, "VehicleProperty::INFO_VIN" represents the int VehicleProperty value for INFO_VIN. This CL adds the parsing logic for special constant format string values. Test: See the unit tests added in the ag/19240183 Bug: 238685398 Change-Id: I1617fdd47b4292180bd2bb37acddc181c212f4f5 --- .../include/JsonConfigLoader.h | 32 +++ .../JsonConfigLoader/src/JsonConfigLoader.cpp | 184 +++++++++++++++++- 2 files changed, 213 insertions(+), 3 deletions(-) diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/JsonConfigLoader.h b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/JsonConfigLoader.h index a6e59e6fb4..225fe3284e 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/JsonConfigLoader.h +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/JsonConfigLoader.h @@ -34,6 +34,14 @@ namespace vehicle { // private namespace namespace jsonconfigloader_impl { +// An abstract interface that represents a ValueParser for any constant value types. +class ConstantParserInterface { + public: + // Parses a constant variable name to its actual value. + virtual android::base::Result parseValue(const std::string& name) const = 0; + virtual ~ConstantParserInterface() = default; +}; + // A class to parse a value field in JSON config file. // If the field is a string and the field is in the format of "XX::XX", the value will be parsed // as a constant value in the format of "TYPE::NAME". Otherwise, the field will be return as is @@ -60,6 +68,22 @@ class JsonValueParser final { std::optional> maybeGetTypeAndValueName( const std::string& jsonFieldValue) const; + + android::base::Result parseConstantValue( + const std::pair& typeValueName) const; + + const ConstantParserInterface* getParser(const std::string& type) const { + auto it = mConstantParsersByType.find(type); + if (it == mConstantParsersByType.end()) { + return nullptr; + } + return it->second.get(); + } + + private: + inline static const std::string DELIMITER = "::"; + std::unordered_map> + mConstantParsersByType; }; // The main class to parse a VHAL config file in JSON format. @@ -103,6 +127,14 @@ class JsonConfigParser { bool tryParseJsonArrayToVariable(const Json::Value& parentJsonNode, const std::string& fieldName, bool fieldIsOptional, std::vector* outPtr, std::vector* errors); + // Parses a JSON field to VehiclePropertyAccess or VehiclePropertyChangeMode. + template + void parseAccessChangeMode( + const Json::Value& parentJsonNode, const std::string& fieldName, int propId, + const std::string& propStr, + const std::unordered_map& defaultMap, + T* outPtr, std::vector* errors); // Parses a JSON field to RawPropValues. void parsePropValues(const Json::Value& parentJsonNode, const std::string& fieldName, diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index c569b33a7a..04148cdd49 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -61,6 +61,139 @@ using ::aidl::android::hardware::automotive::vehicle::VehicleVendorPermission; using ::android::base::Error; using ::android::base::Result; +// Defines a map from constant names to constant values, the values defined here corresponds to +// the "Constants::XXXX" used in JSON config file. +const std::unordered_map CONSTANTS_BY_NAME = { + {"DOOR_1_RIGHT", DOOR_1_RIGHT}, + {"DOOR_1_LEFT", DOOR_1_LEFT}, + {"DOOR_2_RIGHT", DOOR_2_RIGHT}, + {"DOOR_2_LEFT", DOOR_2_LEFT}, + {"DOOR_REAR", DOOR_REAR}, + {"HVAC_ALL", HVAC_ALL}, + {"HVAC_LEFT", HVAC_LEFT}, + {"HVAC_RIGHT", HVAC_RIGHT}, + {"VENDOR_EXTENSION_INT_PROPERTY", VENDOR_EXTENSION_INT_PROPERTY}, + {"VENDOR_EXTENSION_BOOLEAN_PROPERTY", VENDOR_EXTENSION_BOOLEAN_PROPERTY}, + {"VENDOR_EXTENSION_STRING_PROPERTY", VENDOR_EXTENSION_STRING_PROPERTY}, + {"VENDOR_EXTENSION_FLOAT_PROPERTY", VENDOR_EXTENSION_FLOAT_PROPERTY}, + {"WINDOW_1_LEFT", WINDOW_1_LEFT}, + {"WINDOW_1_RIGHT", WINDOW_1_RIGHT}, + {"WINDOW_2_LEFT", WINDOW_2_LEFT}, + {"WINDOW_2_RIGHT", WINDOW_2_RIGHT}, + {"WINDOW_ROOF_TOP_1", WINDOW_ROOF_TOP_1}, + {"WINDOW_1_RIGHT_2_LEFT_2_RIGHT", WINDOW_1_RIGHT | WINDOW_2_LEFT | WINDOW_2_RIGHT}, + {"SEAT_1_RIGHT", SEAT_1_RIGHT}, + {"SEAT_1_LEFT", SEAT_1_LEFT}, + {"WHEEL_REAR_RIGHT", WHEEL_REAR_RIGHT}, + {"WHEEL_REAR_LEFT", WHEEL_REAR_LEFT}, + {"WHEEL_FRONT_RIGHT", WHEEL_FRONT_RIGHT}, + {"WHEEL_FRONT_LEFT", WHEEL_FRONT_LEFT}, + {"CHARGE_PORT_FRONT_LEFT", CHARGE_PORT_FRONT_LEFT}, + {"CHARGE_PORT_REAR_LEFT", CHARGE_PORT_REAR_LEFT}, + {"FAN_DIRECTION_FLOOR", FAN_DIRECTION_FLOOR}, + {"FAN_DIRECTION_FACE", FAN_DIRECTION_FACE}, + {"FAN_DIRECTION_DEFROST", FAN_DIRECTION_DEFROST}, + {"FAN_DIRECTION_FACE_FLOOR", FAN_DIRECTION_FACE | FAN_DIRECTION_FLOOR}, + {"FAN_DIRECTION_FACE_DEFROST", FAN_DIRECTION_FACE | FAN_DIRECTION_DEFROST}, + {"FAN_DIRECTION_FLOOR_DEFROST", FAN_DIRECTION_FLOOR | FAN_DIRECTION_DEFROST}, + {"FAN_DIRECTION_FLOOR_DEFROST_FACE", + FAN_DIRECTION_FLOOR | FAN_DIRECTION_DEFROST | FAN_DIRECTION_FACE}, + {"FUEL_DOOR_REAR_LEFT", FUEL_DOOR_REAR_LEFT}, + {"LIGHT_STATE_ON", LIGHT_STATE_ON}, + {"LIGHT_SWITCH_AUTO", LIGHT_SWITCH_AUTO}, +#ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES + // Following are test properties: + {"ECHO_REVERSE_BYTES", ECHO_REVERSE_BYTES}, + {"kMixedTypePropertyForTest", kMixedTypePropertyForTest}, + {"VENDOR_CLUSTER_NAVIGATION_STATE", VENDOR_CLUSTER_NAVIGATION_STATE}, + {"VENDOR_CLUSTER_REQUEST_DISPLAY", VENDOR_CLUSTER_REQUEST_DISPLAY}, + {"VENDOR_CLUSTER_SWITCH_UI", VENDOR_CLUSTER_SWITCH_UI}, + {"VENDOR_CLUSTER_DISPLAY_STATE", VENDOR_CLUSTER_DISPLAY_STATE}, + {"VENDOR_CLUSTER_REPORT_STATE", VENDOR_CLUSTER_REPORT_STATE}, + {"PLACEHOLDER_PROPERTY_INT", PLACEHOLDER_PROPERTY_INT}, + {"PLACEHOLDER_PROPERTY_FLOAT", PLACEHOLDER_PROPERTY_FLOAT}, + {"PLACEHOLDER_PROPERTY_BOOLEAN", PLACEHOLDER_PROPERTY_BOOLEAN}, + {"PLACEHOLDER_PROPERTY_STRING", PLACEHOLDER_PROPERTY_STRING} +#endif // ENABLE_VEHICLE_HAL_TEST_PROPERTIES +}; + +// A class to parse constant values for type T. +template +class ConstantParser final : public ConstantParserInterface { + public: + ConstantParser() { + for (const T& v : ndk::enum_range()) { + std::string name = aidl::android::hardware::automotive::vehicle::toString(v); + // We use the same constant for both VehicleUnit::GALLON and VehicleUnit::US_GALLON, + // which caused toString() not work properly for US_GALLON. So we explicitly add the + // map here. + if (name == "GALLON") { + mValueByName["US_GALLON"] = toInt(v); + } + mValueByName[name] = toInt(v); + } + } + + ~ConstantParser() = default; + + Result parseValue(const std::string& name) const override { + auto it = mValueByName.find(name); + if (it == mValueByName.end()) { + return Error() << "Constant name: " << name << " is not defined"; + } + return it->second; + } + + private: + std::unordered_map mValueByName; +}; + +// A class to parse constant values defined in CONSTANTS_BY_NAME map. +class LocalVariableParser final : public ConstantParserInterface { + public: + ~LocalVariableParser() = default; + + Result parseValue(const std::string& name) const override { + auto constantsIt = CONSTANTS_BY_NAME.find(name); + if (constantsIt == CONSTANTS_BY_NAME.end()) { + return Error() << "Constant variable name: " << name << " is not defined"; + } + return constantsIt->second; + } +}; + +JsonValueParser::JsonValueParser() { + mConstantParsersByType["VehiclePropertyAccess"] = + std::make_unique>(); + mConstantParsersByType["VehiclePropertyChangeMode"] = + std::make_unique>(); + mConstantParsersByType["VehicleGear"] = std::make_unique>(); + mConstantParsersByType["VehicleAreaWindow"] = + std::make_unique>(); + mConstantParsersByType["VehicleOilLevel"] = std::make_unique>(); + mConstantParsersByType["VehicleUnit"] = std::make_unique>(); + mConstantParsersByType["VehicleSeatOccupancyState"] = + std::make_unique>(); + mConstantParsersByType["VehicleHvacFanDirection"] = + std::make_unique>(); + mConstantParsersByType["VehicleApPowerStateReport"] = + std::make_unique>(); + mConstantParsersByType["VehicleTurnSignal"] = + std::make_unique>(); + mConstantParsersByType["VehicleVendorPermission"] = + std::make_unique>(); + mConstantParsersByType["EvsServiceType"] = std::make_unique>(); + mConstantParsersByType["EvsServiceState"] = std::make_unique>(); + mConstantParsersByType["EvConnectorType"] = std::make_unique>(); + mConstantParsersByType["VehicleProperty"] = std::make_unique>(); + mConstantParsersByType["GsrComplianceRequirementType"] = + std::make_unique>(); + mConstantParsersByType["VehicleIgnitionState"] = + std::make_unique>(); + mConstantParsersByType["FuelType"] = std::make_unique>(); + mConstantParsersByType["Constants"] = std::make_unique(); +} + template <> Result JsonValueParser::convertValueToType(const std::string& fieldName, const Json::Value& value) { @@ -157,11 +290,25 @@ std::optional> JsonValueParser::maybeGetType } std::string type = jsonFieldValue.substr(0, pos); std::string valueName = jsonFieldValue.substr(pos + DELIMITER.length(), std::string::npos); + if (type != "Constants" && mConstantParsersByType.find(type) == mConstantParsersByType.end()) { + return {}; + } return std::make_pair(type, valueName); } -Result JsonValueParser::parseConstantValue(const std::pair&) const { - // TODO(b/238685398): Implement this. +Result JsonValueParser::parseConstantValue( + const std::pair& typeValueName) const { + const std::string& type = typeValueName.first; + const std::string& valueName = typeValueName.second; + auto it = mConstantParsersByType.find(type); + if (it == mConstantParsersByType.end()) { + return Error() << "Unrecognized type: " << type; + } + auto result = it->second->parseValue(valueName); + if (!result.ok()) { + return Error() << type << "::" << valueName << " undefined"; + } + return result; } template @@ -216,6 +363,33 @@ bool JsonConfigParser::tryParseJsonArrayToVariable(const Json::Value& parentJson return true; } +template +void JsonConfigParser::parseAccessChangeMode( + const Json::Value& parentJsonNode, const std::string& fieldName, int propId, + const std::string& propStr, const std::unordered_map& defaultMap, + T* outPtr, std::vector* errors) { + if (!parentJsonNode.isObject()) { + errors->push_back("Node: " + parentJsonNode.toStyledString() + " is not an object"); + return; + } + if (parentJsonNode.isMember(fieldName)) { + auto result = mValueParser.parseValue(fieldName, parentJsonNode[fieldName]); + if (!result.ok()) { + errors->push_back(result.error().message()); + return; + } + *outPtr = static_cast(result.value()); + return; + } + auto it = defaultMap.find(static_cast(propId)); + if (it == defaultMap.end()) { + errors->push_back("No " + fieldName + " specified for property: " + propStr); + return; + } + *outPtr = it->second; + return; +} + void JsonConfigParser::parsePropValues(const Json::Value& parentJsonNode, const std::string& fieldName, RawPropValues* outPtr, std::vector* errors) { @@ -252,7 +426,11 @@ std::optional JsonConfigParser::parseEachProperty( configDecl.config.prop = propId; std::string propStr = propJsonValue["property"].toStyledString(); - // TODO(b/238685398): Parse access and changeMode. + parseAccessChangeMode(propJsonValue, "access", propId, propStr, AccessForVehicleProperty, + &configDecl.config.access, errors); + + parseAccessChangeMode(propJsonValue, "changeMode", propId, propStr, + ChangeModeForVehicleProperty, &configDecl.config.changeMode, errors); tryParseJsonValueToVariable(propJsonValue, "configString", /*optional=*/true, &configDecl.config.configString, errors); From 61dd7a76a3497d7c8fb9055c17fe3620c4b01dc4 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Mon, 1 Aug 2022 21:49:46 +0000 Subject: [PATCH 178/998] Add recently added properties and fix change mode. Add the recently added properties to DefaultProperties.json to sync with DefaultConfig.h. This CL also fixes change mode for SUPPORT_CUSTOMIZE_VENDOR_PERMISSION and REMOVE_USER to be consistent with the property change mode annotation. Test: atest DefaultConfigTest Bug: 239613431 Change-Id: I0389746f9e0498330ab38c6bc41bb3a92886b32e --- .../JsonConfigLoader/src/JsonConfigLoader.cpp | 10 +- .../config/DefaultProperties.json | 322 +++++++++++++++++- .../default_config/include/DefaultConfig.h | 60 +--- 3 files changed, 342 insertions(+), 50 deletions(-) diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index 04148cdd49..c8bbfae043 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -44,6 +44,7 @@ using ::aidl::android::hardware::automotive::vehicle::RawPropValues; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq; using ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig; +using ::aidl::android::hardware::automotive::vehicle::VehicleAreaMirror; using ::aidl::android::hardware::automotive::vehicle::VehicleAreaWindow; using ::aidl::android::hardware::automotive::vehicle::VehicleGear; using ::aidl::android::hardware::automotive::vehicle::VehicleHvacFanDirection; @@ -82,8 +83,11 @@ const std::unordered_map CONSTANTS_BY_NAME = { {"WINDOW_2_RIGHT", WINDOW_2_RIGHT}, {"WINDOW_ROOF_TOP_1", WINDOW_ROOF_TOP_1}, {"WINDOW_1_RIGHT_2_LEFT_2_RIGHT", WINDOW_1_RIGHT | WINDOW_2_LEFT | WINDOW_2_RIGHT}, - {"SEAT_1_RIGHT", SEAT_1_RIGHT}, {"SEAT_1_LEFT", SEAT_1_LEFT}, + {"SEAT_1_RIGHT", SEAT_1_RIGHT}, + {"SEAT_2_LEFT", SEAT_2_LEFT}, + {"SEAT_2_RIGHT", SEAT_2_RIGHT}, + {"SEAT_2_CENTER", SEAT_2_CENTER}, {"WHEEL_REAR_RIGHT", WHEEL_REAR_RIGHT}, {"WHEEL_REAR_LEFT", WHEEL_REAR_LEFT}, {"WHEEL_FRONT_RIGHT", WHEEL_FRONT_RIGHT}, @@ -101,6 +105,8 @@ const std::unordered_map CONSTANTS_BY_NAME = { {"FUEL_DOOR_REAR_LEFT", FUEL_DOOR_REAR_LEFT}, {"LIGHT_STATE_ON", LIGHT_STATE_ON}, {"LIGHT_SWITCH_AUTO", LIGHT_SWITCH_AUTO}, + {"MIRROR_DRIVER_LEFT_RIGHT", + toInt(VehicleAreaMirror::DRIVER_LEFT) | toInt(VehicleAreaMirror::DRIVER_RIGHT)}, #ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES // Following are test properties: {"ECHO_REVERSE_BYTES", ECHO_REVERSE_BYTES}, @@ -170,6 +176,8 @@ JsonValueParser::JsonValueParser() { mConstantParsersByType["VehicleGear"] = std::make_unique>(); mConstantParsersByType["VehicleAreaWindow"] = std::make_unique>(); + mConstantParsersByType["VehicleAreaMirror"] = + std::make_unique>(); mConstantParsersByType["VehicleOilLevel"] = std::make_unique>(); mConstantParsersByType["VehicleUnit"] = std::make_unique>(); mConstantParsersByType["VehicleSeatOccupancyState"] = diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index f2415aaaa7..f4ce402e28 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -129,6 +129,311 @@ "VehicleUnit::KILOWATT_HOUR" ] }, + { + "property": "VehicleProperty::SEAT_BELT_BUCKLED", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" + } + ] + }, + { + "property": "VehicleProperty::SEAT_BELT_HEIGHT_POS", + "defaultValue": { + "int32Values": [ + 10 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": 0, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": 0, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": 0, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": 0, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": 0, + "maxInt32Value": 10 + } + ] + }, + { + "property": "VehicleProperty::SEAT_BELT_HEIGHT_MOVE", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -1, + "maxInt32Value": 1 + } + ] + }, + { + "property": "VehicleProperty::SEAT_FORE_AFT_POS", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -10, + "maxInt32Value": 10 + } + ] + }, + { + "property": "VehicleProperty::SEAT_FORE_AFT_MOVE", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -1, + "maxInt32Value": 1 + } + ] + }, + { + "property": "VehicleProperty::SEAT_BACKREST_ANGLE_1_POS", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -10, + "maxInt32Value": 10 + } + ] + }, + { + "property": "VehicleProperty::SEAT_BACKREST_ANGLE_1_MOVE", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -1, + "maxInt32Value": 1 + } + ] + }, + { + "property": "VehicleProperty::SEAT_BACKREST_ANGLE_2_POS", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -10, + "maxInt32Value": 10 + } + ] + }, + { + "property": "VehicleProperty::SEAT_BACKREST_ANGLE_2_MOVE", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -1, + "maxInt32Value": 1 + } + ] + }, { "property": "VehicleProperty::SEAT_OCCUPANCY", "areas": [ @@ -782,6 +1087,21 @@ ], "comment": "+ve values for heating and -ve for cooling" }, + { + "property": "VehicleProperty::HVAC_SIDE_MIRROR_HEAT", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::MIRROR_DRIVER_LEFT_RIGHT", + "minInt32Value": 0, + "maxInt32Value": 2 + } + ] + }, { "property": "VehicleProperty::HVAC_TEMPERATURE_SET", "areas": [ @@ -1346,4 +1666,4 @@ } } ] -} \ No newline at end of file +} diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index b1ed0c01a9..8c6fa1b5b6 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -182,11 +182,7 @@ const std::vector kVehicleProperties = { VehicleAreaConfig{.areaId = SEAT_2_LEFT}, VehicleAreaConfig{.areaId = SEAT_2_RIGHT}, VehicleAreaConfig{.areaId = SEAT_2_CENTER}}}, - .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}}, - {SEAT_1_RIGHT, {.int32Values = {0}}}, - {SEAT_2_LEFT, {.int32Values = {0}}}, - {SEAT_2_RIGHT, {.int32Values = {0}}}, - {SEAT_2_CENTER, {.int32Values = {0}}}}}, + .initialValue = {.int32Values = {0}}}, {.config = {.prop = toInt(VehicleProperty::SEAT_BELT_HEIGHT_POS), .access = VehiclePropertyAccess::READ_WRITE, @@ -206,11 +202,7 @@ const std::vector kVehicleProperties = { VehicleAreaConfig{.areaId = SEAT_2_CENTER, .minInt32Value = 0, .maxInt32Value = 10}}}, - .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {10}}}, - {SEAT_1_RIGHT, {.int32Values = {10}}}, - {SEAT_2_LEFT, {.int32Values = {10}}}, - {SEAT_2_RIGHT, {.int32Values = {10}}}, - {SEAT_2_CENTER, {.int32Values = {10}}}}}, + .initialValue = {.int32Values = {10}}}, {.config = {.prop = toInt(VehicleProperty::SEAT_BELT_HEIGHT_MOVE), .access = VehiclePropertyAccess::READ_WRITE, @@ -230,11 +222,7 @@ const std::vector kVehicleProperties = { VehicleAreaConfig{.areaId = SEAT_2_CENTER, .minInt32Value = -1, .maxInt32Value = 1}}}, - .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}}, - {SEAT_1_RIGHT, {.int32Values = {0}}}, - {SEAT_2_LEFT, {.int32Values = {0}}}, - {SEAT_2_RIGHT, {.int32Values = {0}}}, - {SEAT_2_CENTER, {.int32Values = {0}}}}}, + .initialValue = {.int32Values = {0}}}, {.config = {.prop = toInt(VehicleProperty::SEAT_FORE_AFT_POS), .access = VehiclePropertyAccess::READ_WRITE, @@ -254,11 +242,7 @@ const std::vector kVehicleProperties = { VehicleAreaConfig{.areaId = SEAT_2_CENTER, .minInt32Value = -10, .maxInt32Value = 10}}}, - .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}}, - {SEAT_1_RIGHT, {.int32Values = {0}}}, - {SEAT_2_LEFT, {.int32Values = {0}}}, - {SEAT_2_RIGHT, {.int32Values = {0}}}, - {SEAT_2_CENTER, {.int32Values = {0}}}}}, + .initialValue = {.int32Values = {0}}}, {.config = {.prop = toInt(VehicleProperty::SEAT_FORE_AFT_MOVE), .access = VehiclePropertyAccess::READ_WRITE, @@ -278,11 +262,7 @@ const std::vector kVehicleProperties = { VehicleAreaConfig{.areaId = SEAT_2_CENTER, .minInt32Value = -1, .maxInt32Value = 1}}}, - .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}}, - {SEAT_1_RIGHT, {.int32Values = {0}}}, - {SEAT_2_LEFT, {.int32Values = {0}}}, - {SEAT_2_RIGHT, {.int32Values = {0}}}, - {SEAT_2_CENTER, {.int32Values = {0}}}}}, + .initialValue = {.int32Values = {0}}}, {.config = {.prop = toInt(VehicleProperty::SEAT_BACKREST_ANGLE_1_POS), .access = VehiclePropertyAccess::READ_WRITE, @@ -302,11 +282,7 @@ const std::vector kVehicleProperties = { VehicleAreaConfig{.areaId = SEAT_2_CENTER, .minInt32Value = -10, .maxInt32Value = 10}}}, - .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}}, - {SEAT_1_RIGHT, {.int32Values = {0}}}, - {SEAT_2_LEFT, {.int32Values = {0}}}, - {SEAT_2_RIGHT, {.int32Values = {0}}}, - {SEAT_2_CENTER, {.int32Values = {0}}}}}, + .initialValue = {.int32Values = {0}}}, {.config = {.prop = toInt(VehicleProperty::SEAT_BACKREST_ANGLE_1_MOVE), .access = VehiclePropertyAccess::READ_WRITE, @@ -326,11 +302,7 @@ const std::vector kVehicleProperties = { VehicleAreaConfig{.areaId = SEAT_2_CENTER, .minInt32Value = -1, .maxInt32Value = 1}}}, - .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}}, - {SEAT_1_RIGHT, {.int32Values = {0}}}, - {SEAT_2_LEFT, {.int32Values = {0}}}, - {SEAT_2_RIGHT, {.int32Values = {0}}}, - {SEAT_2_CENTER, {.int32Values = {0}}}}}, + .initialValue = {.int32Values = {0}}}, {.config = {.prop = toInt(VehicleProperty::SEAT_BACKREST_ANGLE_2_POS), .access = VehiclePropertyAccess::READ_WRITE, @@ -350,11 +322,7 @@ const std::vector kVehicleProperties = { VehicleAreaConfig{.areaId = SEAT_2_CENTER, .minInt32Value = -10, .maxInt32Value = 10}}}, - .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}}, - {SEAT_1_RIGHT, {.int32Values = {0}}}, - {SEAT_2_LEFT, {.int32Values = {0}}}, - {SEAT_2_RIGHT, {.int32Values = {0}}}, - {SEAT_2_CENTER, {.int32Values = {0}}}}}, + .initialValue = {.int32Values = {0}}}, {.config = {.prop = toInt(VehicleProperty::SEAT_BACKREST_ANGLE_2_MOVE), .access = VehiclePropertyAccess::READ_WRITE, @@ -374,11 +342,7 @@ const std::vector kVehicleProperties = { VehicleAreaConfig{.areaId = SEAT_2_CENTER, .minInt32Value = -1, .maxInt32Value = 1}}}, - .initialAreaValues = {{SEAT_1_LEFT, {.int32Values = {0}}}, - {SEAT_1_RIGHT, {.int32Values = {0}}}, - {SEAT_2_LEFT, {.int32Values = {0}}}, - {SEAT_2_RIGHT, {.int32Values = {0}}}, - {SEAT_2_CENTER, {.int32Values = {0}}}}}, + .initialValue = {.int32Values = {0}}}, {.config = { @@ -1271,7 +1235,7 @@ const std::vector kVehicleProperties = { { .prop = toInt(VehicleProperty::SUPPORT_CUSTOMIZE_VENDOR_PERMISSION), .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .changeMode = VehiclePropertyChangeMode::STATIC, .configArray = {kMixedTypePropertyForTest, toInt(VehicleVendorPermission:: PERMISSION_GET_VENDOR_CATEGORY_INFO), @@ -1315,8 +1279,8 @@ const std::vector kVehicleProperties = { .config = { .prop = toInt(VehicleProperty::REMOVE_USER), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .access = VehiclePropertyAccess::WRITE, + .changeMode = VehiclePropertyChangeMode::STATIC, }, }, { From 9b64b82fc1d3da19a3a9cd8f1026d36cfa74a4bd Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Thu, 14 Jul 2022 01:14:33 +0000 Subject: [PATCH 179/998] Add area config parsing. Add area config parsing to JsonConfigLoader. Test: atest JsonConfigLoaderUnitTestEnableTestProperties atest VehicleHalDefaultConfigTestEnableTestProperties Bug: 238685398 Change-Id: I22c1b54fb5463b6c747645293ed47c5799d5f262 --- .../automotive/vehicle/VehicleProperty.aidl | 2 +- .../include/JsonConfigLoader.h | 8 +- .../JsonConfigLoader/src/JsonConfigLoader.cpp | 72 ++++++++++++--- .../test/JsonConfigLoaderUnitTest.cpp | 91 ++++++++++++++++++- .../default_config/test/DefaultConfigTest.cpp | 3 +- 5 files changed, 156 insertions(+), 20 deletions(-) diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index e8a6c8598f..1cf8aff6a5 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -542,7 +542,7 @@ enum VehicleProperty { */ TRACTION_CONTROL_ACTIVE = 0x040B + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN - /* + /** * HVAC Properties * * Additional rules for mapping a zoned HVAC property (except diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/JsonConfigLoader.h b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/JsonConfigLoader.h index 225fe3284e..fd73a267db 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/JsonConfigLoader.h +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/JsonConfigLoader.h @@ -137,9 +137,15 @@ class JsonConfigParser { T* outPtr, std::vector* errors); // Parses a JSON field to RawPropValues. - void parsePropValues(const Json::Value& parentJsonNode, const std::string& fieldName, + // + // @return True if the field exist and can be parsed to a RawPropValues. + bool parsePropValues(const Json::Value& parentJsonNode, const std::string& fieldName, aidl::android::hardware::automotive::vehicle::RawPropValues* outPtr, std::vector* errors); + + // Prase a JSON field as an array of area configs. + void parseAreas(const Json::Value& parentJsonNode, const std::string& fieldName, + ConfigDeclaration* outPtr, std::vector* errors); }; } // namespace jsonconfigloader_impl diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index c8bbfae043..392d540d81 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -398,9 +398,32 @@ void JsonConfigParser::parseAccessChangeMode( return; } -void JsonConfigParser::parsePropValues(const Json::Value& parentJsonNode, +bool JsonConfigParser::parsePropValues(const Json::Value& parentJsonNode, const std::string& fieldName, RawPropValues* outPtr, std::vector* errors) { + if (!parentJsonNode.isObject()) { + errors->push_back("Node: " + parentJsonNode.toStyledString() + " is not an object"); + return false; + } + if (!parentJsonNode.isMember(fieldName)) { + return false; + } + const Json::Value& jsonValue = parentJsonNode[fieldName]; + bool success = true; + success &= tryParseJsonArrayToVariable(jsonValue, "int32Values", + /*optional=*/true, &(outPtr->int32Values), errors); + success &= tryParseJsonArrayToVariable(jsonValue, "floatValues", + /*optional=*/true, &(outPtr->floatValues), errors); + success &= tryParseJsonArrayToVariable(jsonValue, "int64Values", + /*optional=*/true, &(outPtr->int64Values), errors); + // We don't support "byteValues" yet. + success &= tryParseJsonValueToVariable(jsonValue, "stringValue", + /*optional=*/true, &(outPtr->stringValue), errors); + return success; +} + +void JsonConfigParser::parseAreas(const Json::Value& parentJsonNode, const std::string& fieldName, + ConfigDeclaration* config, std::vector* errors) { if (!parentJsonNode.isObject()) { errors->push_back("Node: " + parentJsonNode.toStyledString() + " is not an object"); return; @@ -409,15 +432,39 @@ void JsonConfigParser::parsePropValues(const Json::Value& parentJsonNode, return; } const Json::Value& jsonValue = parentJsonNode[fieldName]; - tryParseJsonArrayToVariable(jsonValue, "int32Values", /*optional=*/true, &(outPtr->int32Values), - errors); - tryParseJsonArrayToVariable(jsonValue, "floatValues", /*optional=*/true, &(outPtr->floatValues), - errors); - tryParseJsonArrayToVariable(jsonValue, "int64Values", /*optional=*/true, &(outPtr->int64Values), - errors); - // We don't support "byteValues" yet. - tryParseJsonValueToVariable(jsonValue, "stringValue", /*optional=*/true, &(outPtr->stringValue), - errors); + + if (!jsonValue.isArray()) { + errors->push_back("Field: " + fieldName + " is not an array"); + return; + } + for (unsigned int i = 0; i < jsonValue.size(); i++) { + int32_t areaId; + const Json::Value& jsonAreaConfig = jsonValue[i]; + if (!tryParseJsonValueToVariable(jsonAreaConfig, "areaId", + /*optional=*/false, &areaId, errors)) { + continue; + } + VehicleAreaConfig areaConfig = {}; + areaConfig.areaId = areaId; + tryParseJsonValueToVariable(jsonAreaConfig, "minInt32Value", /*optional=*/true, + &areaConfig.minInt32Value, errors); + tryParseJsonValueToVariable(jsonAreaConfig, "maxInt32Value", /*optional=*/true, + &areaConfig.maxInt32Value, errors); + tryParseJsonValueToVariable(jsonAreaConfig, "minInt64Value", /*optional=*/true, + &areaConfig.minInt64Value, errors); + tryParseJsonValueToVariable(jsonAreaConfig, "maxInt64Value", /*optional=*/true, + &areaConfig.maxInt64Value, errors); + tryParseJsonValueToVariable(jsonAreaConfig, "minFloatValue", /*optional=*/true, + &areaConfig.minFloatValue, errors); + tryParseJsonValueToVariable(jsonAreaConfig, "maxFloatValue", /*optional=*/true, + &areaConfig.maxFloatValue, errors); + config->config.areaConfigs.push_back(std::move(areaConfig)); + + RawPropValues areaValue = {}; + if (parsePropValues(jsonAreaConfig, "defaultValue", &areaValue, errors)) { + config->initialAreaValues[areaId] = std::move(areaValue); + } + } } std::optional JsonConfigParser::parseEachProperty( @@ -446,8 +493,7 @@ std::optional JsonConfigParser::parseEachProperty( tryParseJsonArrayToVariable(propJsonValue, "configArray", /*optional=*/true, &configDecl.config.configArray, errors); - parsePropValues(propJsonValue, "defaultValue", /*optional=*/true, &configDecl.initialValue, - errors); + parsePropValues(propJsonValue, "defaultValue", &configDecl.initialValue, errors); tryParseJsonValueToVariable(propJsonValue, "minSampleRate", /*optional=*/true, &configDecl.config.minSampleRate, errors); @@ -455,7 +501,7 @@ std::optional JsonConfigParser::parseEachProperty( tryParseJsonValueToVariable(propJsonValue, "maxSampleRate", /*optional=*/true, &configDecl.config.maxSampleRate, errors); - // TODO(b/238685398): AreaConfigs + parseAreas(propJsonValue, "areas", &configDecl, errors); if (errors->size() != initialErrorCount) { return std::nullopt; diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/JsonConfigLoaderUnitTest.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/JsonConfigLoaderUnitTest.cpp index 469e7d67b0..cff70d97ae 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/JsonConfigLoaderUnitTest.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/JsonConfigLoaderUnitTest.cpp @@ -27,6 +27,7 @@ namespace automotive { namespace vehicle { using ::aidl::android::hardware::automotive::vehicle::RawPropValues; +using ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig; using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess; @@ -108,7 +109,7 @@ TEST_F(JsonConfigLoaderUnitTest, TestProperty_FailInvalidJson) { } )"); - ASSERT_FALSE(mLoader.loadPropConfig(iss);.ok()) << "Invalid JSON format must cause error"; + ASSERT_FALSE(mLoader.loadPropConfig(iss).ok()) << "Invalid JSON format must cause error"; } TEST_F(JsonConfigLoaderUnitTest, TestConfigArray) { @@ -490,9 +491,9 @@ TEST_F(JsonConfigLoaderUnitTest, TestDefaultValue_FailInvalidType) { { "properties": [{ "property": "VehicleProperty::INFO_FUEL_CAPACITY", - "defaultValue": [{ + "defaultValue": { "int32Values": [1.1] - }] + } }] } )"); @@ -501,6 +502,90 @@ TEST_F(JsonConfigLoaderUnitTest, TestDefaultValue_FailInvalidType) { << "Wrong type for DefaultValue must cause error"; } +TEST_F(JsonConfigLoaderUnitTest, testAreas_Simple) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::INFO_FUEL_CAPACITY", + "areas": [{ + "areaId": "Constants::HVAC_ALL", + "minInt32Value": 1, + "maxInt32Value": 7 + }] + }] + } + )"); + + auto result = mLoader.loadPropConfig(iss); + + auto configs = result.value(); + ASSERT_EQ(configs.size(), 1u); + + const VehiclePropConfig& config = configs[0].config; + ASSERT_EQ(config.areaConfigs.size(), 1u); + const VehicleAreaConfig& areaConfig = config.areaConfigs[0]; + ASSERT_EQ(areaConfig.minInt32Value, 1); + ASSERT_EQ(areaConfig.maxInt32Value, 7); + ASSERT_EQ(areaConfig.areaId, HVAC_ALL); +} + +TEST_F(JsonConfigLoaderUnitTest, testAreas_DefaultValueForEachArea) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::INFO_FUEL_CAPACITY", + "areas": [{ + "areaId": "Constants::HVAC_LEFT", + "defaultValue": { + "int32Values": [1] + } + }, { + "areaId": "Constants::HVAC_RIGHT", + "defaultValue": { + "int32Values": [2] + } + }] + }] + } + )"); + + auto result = mLoader.loadPropConfig(iss); + + auto configs = result.value(); + ASSERT_EQ(configs.size(), 1u); + + const VehiclePropConfig& config = configs[0].config; + ASSERT_EQ(config.areaConfigs.size(), 2u); + ASSERT_EQ(config.areaConfigs[0].areaId, HVAC_LEFT); + ASSERT_EQ(config.areaConfigs[1].areaId, HVAC_RIGHT); + ASSERT_EQ(configs[0].initialAreaValues[HVAC_LEFT], RawPropValues{.int32Values = {1}}); + ASSERT_EQ(configs[0].initialAreaValues[HVAC_RIGHT], RawPropValues{.int32Values = {2}}); +} + +TEST_F(JsonConfigLoaderUnitTest, testAreas_FailInvalidTypeForOneAreaValue) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::INFO_FUEL_CAPACITY", + "areas": [{ + "areaId": "Constants::HVAC_LEFT", + "defaultValue": { + "int32Values": [1] + } + }, { + "areaId": "Constants::HVAC_RIGHT", + "defaultValue": { + "int32Values": [2.1] + } + }] + }] + } + )"); + + ASSERT_FALSE(mLoader.loadPropConfig(iss).ok()) + << "Wrong type for DefaultValue for one area must cause error"; +} + } // namespace vehicle } // namespace automotive } // namespace hardware diff --git a/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp b/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp index ba1100fecc..b16ea144e2 100644 --- a/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp +++ b/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp @@ -93,8 +93,7 @@ TEST(DefaultConfigTest, TestCompatibleWithDefaultConfigHeader) { } ASSERT_EQ(configsFromHeaderFile.size(), configsFromJson.size()); - // TODO(b/238685398): Uncomment this once we finish the parser. - // ASSERT_THAT(configsFromHeaderFile, UnorderedElementsAreArray(configsFromJson)); + ASSERT_THAT(configsFromHeaderFile, UnorderedElementsAreArray(configsFromJson)); } #endif // ENABLE_VEHICLE_HAL_TEST_PROPERTIES From bcf9bcbfcb51afe7e29024a3d05a1a2936a1bc92 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Thu, 14 Jul 2022 21:46:45 +0000 Subject: [PATCH 180/998] Add a README explaining JSON format. Add a README file explaining the JSON format for the vehicle property config JSON file. Test: None Bug: 238685398 Change-Id: I4aa1723aec4dd58579e9b20244bee0f2c109bec4 --- .../aidl/impl/default_config/config/README.md | 151 ++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 automotive/vehicle/aidl/impl/default_config/config/README.md diff --git a/automotive/vehicle/aidl/impl/default_config/config/README.md b/automotive/vehicle/aidl/impl/default_config/config/README.md new file mode 100644 index 0000000000..0e3fc5e4d4 --- /dev/null +++ b/automotive/vehicle/aidl/impl/default_config/config/README.md @@ -0,0 +1,151 @@ +# Property Configuration Files + +Each JSON file in this folder is a property configuration file for reference +Vehicle HAL. They contain VehiclePropConfig information along with initial +value information. + +## JSON schema + +Each JSON file must be in a schema like the following example: +(The comment starting with "//" is for documentation only and must be removed +from the actual JSON file. The "comment" field is used for comment in the +actual JSON file and will be ignored by the parser) + +``` +{ + // (number) The version for the JSON schema. + "apiVersion": 1, + // (non-empty array of objects) The property configuration list. + // + // Each object is a configuration for one property. + "properties": [ + { + // (number/string) The ID for the property. + // This value is defined in a string value + // which represents a constant value, see the "JSON Number-type + // Field Values" section for detail. + "property": "VehicleProperty::INFO_FUEL_CAPACITY", + // (optional, number/string) The access mode for the property. + // If specified, this overwrite the default access mode specified in + // VehicleProperty.aidl. Must be specified for vendor properties. + "access": "VehiclePropertyAccess::READ", + // (optional, number/string) The change mode for the property. + // If specified, this overwrite the default change mode specified in + // VehicleProperty.aidl. Must be specified for vendor properties. + "changeMode": "VehiclePropertyChangeMode::STATIC", + // (optional, string) The config string. + "configString": "blahblah", + // (optional, array of number/string) The config array. + "configArray": [1, 2, "Constants::HVAC_ALL"], + // (optional, object) The default value for the property. + // If not specified, the property will be shown as unavailable + // until its value is set. + "defaultValue": { + // (optional, array of int number/string) Int values. + "int32Values": [1, 2, "Constants::HVAC_ALL"], + // (optional, array of int number/string) Long values. + "int64Values": [1, 2], + // (optional, array of float number/string) Float values. + "floatValues": [1.1, 2.2], + // (optional, string) String value. + "stringValue": "test" + }, + // (optional, number/string) The minimum sample rate in HZ. + // Only work for VehiclePropertyChangeMode::CONTINUOUS property. + // Must be specified for continuous property. + "minSampleRate": 1, + // (optional, number/string) The maximum sample rate in HZ. + // Only work for VehiclePropertyChangeMode::CONTINUOUS property. + // Must be specified for continuous property. + "maxSampleRate": 10, + // (optional, array of objects) The area configs. + "areas:" [ + { + // (number/string) The area ID. + "areaId": "Constants::DOOR_1_LEFT", + // (optional number/string) The minimum int value. + "minInt32Value": 1, + // (optional number/string) The maximum int value. + "maxInt32Value": 10, + // (optional number/string) The minimum long value. + "minInt64Value": 1, + // (optional number/string) The maximum long value. + "maxInt64Value": 10, + // (optional number/string) The minimum float value. + "minFloatValue": 1, + // (optional number/string) The maximum float value. + "maxFloatValue": 10, + // (optional object) The default value for this area. + // Uses the same format as the "defaultValue" field for + // property object. If specified, this overwrite the global + // defaultValue. + "defaultValue": { + "int32Values": [1, 2, "Constants::HVAC_ALL"], + "int64Values": [1, 2], + "floatValues": [1.1, 2.2], + "stringValue": "test" + } + } + ] + } + ] +} +``` + +## JSON Number-type Field Values + +For number type field values, they can either be defined as a numeric number, +e.g., `{"minInt32Value": 1}` or be defined as a string which represents a +defined constant value, e.g., +`{"property": "VehicleProperty::INFO_FUEL_CAPACITY"}`. + +For constant values, they must be a string in the format of `XXX::XXX`, where +the field before `::` is the constant type, and the field after `::` is the +variable name. + +We support the following constant types: + +* VehiclePropertyAccess + +* VehiclePropertyChangeMode + +* VehicleGear + +* VehicleAreaWindow + +* VehicleOilLevel + +* VehicleUnit + +* VehicleSeatOccupancyState + +* VehicleHvacFanDirection + +* VehicleApPowerStateReport + +* VehicleTurnSignal + +* VehicleVendorPermission + +* EvsServiceType + +* EvsServiceState + +* EvConnectorType + +* VehicleProperty + +* GsrComplianceRequirementType + +* VehicleIgnitionState + +* FuelType + +* Constants + +Every constant type except "Constants" corresponds to a enum defined in Vehicle +HAL interfac. E.g. "VehicleProperty" corresponds to the enums defined in +"VehicleProperty.aidl". + +"Constants" type refers to the constant variables defined in the paresr. +Specifically, the "CONSTANTS_BY_NAME" map defined in "JsonConfigLoader.cpp". From 68bee7044249d2bb0dc2494c0ff768a8b89fa6ff Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Wed, 15 Jun 2022 21:39:04 +0000 Subject: [PATCH 181/998] audio: Implementation of audio I/O, part I This patch adds necessary structures and prepares for implementing data flow for audio I/O. Also in this patch we clarify the relationship between audio patches and buffer size for audio I/O, and between buffer size and latency. Bug: 205884982 Bug: 233816848 Test: atest VtsHalAudioCoreTargetTest Change-Id: I8522632607d4cf50a112225c19b5dd5ad8848591 --- audio/aidl/Android.bp | 4 + .../hardware/audio/core/AudioPatch.aidl | 2 + .../android/hardware/audio/core/IModule.aidl | 27 +- .../audio/core/MmapBufferDescriptor.aidl | 41 +++ .../hardware/audio/core/StreamDescriptor.aidl | 69 +++++ .../hardware/audio/core/AudioPatch.aidl | 14 ++ .../android/hardware/audio/core/IModule.aidl | 104 ++++++-- .../hardware/audio/core/IStreamIn.aidl | 4 +- .../hardware/audio/core/IStreamOut.aidl | 4 +- .../audio/core/MmapBufferDescriptor.aidl | 51 ++++ .../hardware/audio/core/StreamDescriptor.aidl | 201 +++++++++++++++ audio/aidl/default/Android.bp | 4 + audio/aidl/default/Module.cpp | 235 ++++++++++++------ audio/aidl/default/Stream.cpp | 9 +- audio/aidl/default/include/core-impl/Module.h | 28 ++- audio/aidl/vts/Android.bp | 2 + audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp | 146 +++++++---- 17 files changed, 793 insertions(+), 152 deletions(-) create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MmapBufferDescriptor.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl create mode 100644 audio/aidl/android/hardware/audio/core/MmapBufferDescriptor.aidl create mode 100644 audio/aidl/android/hardware/audio/core/StreamDescriptor.aidl diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index 7db50d5ca5..ba22d7bff4 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -75,10 +75,14 @@ aidl_interface { "android/hardware/audio/core/IModule.aidl", "android/hardware/audio/core/IStreamIn.aidl", "android/hardware/audio/core/IStreamOut.aidl", + "android/hardware/audio/core/MmapBufferDescriptor.aidl", "android/hardware/audio/core/ModuleDebug.aidl", + "android/hardware/audio/core/StreamDescriptor.aidl", ], imports: [ "android.hardware.audio.common-V1", + "android.hardware.common-V2", + "android.hardware.common.fmq-V1", "android.media.audio.common.types-V1", ], stability: "vintf", diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/AudioPatch.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/AudioPatch.aidl index 1cef4cd1ae..078b5ea329 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/AudioPatch.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/AudioPatch.aidl @@ -37,4 +37,6 @@ parcelable AudioPatch { int id; int[] sourcePortConfigIds; int[] sinkPortConfigIds; + int minimumStreamBufferSizeFrames; + int[] latenciesMs; } diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl index f8bc2c79c6..a8bbb152c7 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl @@ -43,10 +43,33 @@ interface IModule { android.media.audio.common.AudioPort[] getAudioPorts(); android.hardware.audio.core.AudioRoute[] getAudioRoutes(); android.hardware.audio.core.AudioRoute[] getAudioRoutesForAudioPort(int portId); - android.hardware.audio.core.IStreamIn openInputStream(int portConfigId, in android.hardware.audio.common.SinkMetadata sinkMetadata); - android.hardware.audio.core.IStreamOut openOutputStream(int portConfigId, in android.hardware.audio.common.SourceMetadata sourceMetadata, in @nullable android.media.audio.common.AudioOffloadInfo offloadInfo); + android.hardware.audio.core.IModule.OpenInputStreamReturn openInputStream(in android.hardware.audio.core.IModule.OpenInputStreamArguments args); + android.hardware.audio.core.IModule.OpenOutputStreamReturn openOutputStream(in android.hardware.audio.core.IModule.OpenOutputStreamArguments args); android.hardware.audio.core.AudioPatch setAudioPatch(in android.hardware.audio.core.AudioPatch requested); boolean setAudioPortConfig(in android.media.audio.common.AudioPortConfig requested, out android.media.audio.common.AudioPortConfig suggested); void resetAudioPatch(int patchId); void resetAudioPortConfig(int portConfigId); + @VintfStability + parcelable OpenInputStreamArguments { + int portConfigId; + android.hardware.audio.common.SinkMetadata sinkMetadata; + long bufferSizeFrames; + } + @VintfStability + parcelable OpenInputStreamReturn { + android.hardware.audio.core.IStreamIn stream; + android.hardware.audio.core.StreamDescriptor desc; + } + @VintfStability + parcelable OpenOutputStreamArguments { + int portConfigId; + android.hardware.audio.common.SourceMetadata sourceMetadata; + @nullable android.media.audio.common.AudioOffloadInfo offloadInfo; + long bufferSizeFrames; + } + @VintfStability + parcelable OpenOutputStreamReturn { + android.hardware.audio.core.IStreamOut stream; + android.hardware.audio.core.StreamDescriptor desc; + } } diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MmapBufferDescriptor.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MmapBufferDescriptor.aidl new file mode 100644 index 0000000000..6ea1c69526 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MmapBufferDescriptor.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable MmapBufferDescriptor { + android.hardware.common.Ashmem sharedMemory; + long burstSizeFrames; + int flags; + const int FLAG_INDEX_APPLICATION_SHAREABLE = 0; +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl new file mode 100644 index 0000000000..472a8a2f45 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl @@ -0,0 +1,69 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable StreamDescriptor { + android.hardware.common.fmq.MQDescriptor command; + android.hardware.common.fmq.MQDescriptor reply; + long bufferSizeFrames; + android.hardware.audio.core.StreamDescriptor.AudioBuffer audio; + const int COMMAND_EXIT = 0; + const int COMMAND_BURST = 1; + const int STATUS_OK = 0; + const int STATUS_ILLEGAL_ARGUMENT = 1; + const int STATUS_ILLEGAL_STATE = 2; + @FixedSize @VintfStability + parcelable Position { + long frames; + long timeNs; + } + @FixedSize @VintfStability + parcelable Command { + int code; + int fmqByteCount; + } + @FixedSize @VintfStability + parcelable Reply { + int status; + int fmqByteCount; + android.hardware.audio.core.StreamDescriptor.Position observable; + android.hardware.audio.core.StreamDescriptor.Position hardware; + int latencyMs; + } + @VintfStability + union AudioBuffer { + android.hardware.common.fmq.MQDescriptor fmq; + android.hardware.audio.core.MmapBufferDescriptor mmap; + } +} diff --git a/audio/aidl/android/hardware/audio/core/AudioPatch.aidl b/audio/aidl/android/hardware/audio/core/AudioPatch.aidl index 48ca2142f8..005d4c00ac 100644 --- a/audio/aidl/android/hardware/audio/core/AudioPatch.aidl +++ b/audio/aidl/android/hardware/audio/core/AudioPatch.aidl @@ -37,4 +37,18 @@ parcelable AudioPatch { * unique. */ int[] sinkPortConfigIds; + /** + * The minimum buffer size, in frames, which streams must use for + * this connection configuration. This field is filled out by the + * HAL module on creation of the patch and must be a positive number. + */ + int minimumStreamBufferSizeFrames; + /** + * Latencies, in milliseconds, associated with each sink port config from + * the 'sinkPortConfigIds' field. This field is filled out by the HAL module + * on creation or updating of the patch and must be a positive number. This + * is a nominal value. The current value of latency is provided via + * 'StreamDescriptor' command exchange on each audio I/O operation. + */ + int[] latenciesMs; } diff --git a/audio/aidl/android/hardware/audio/core/IModule.aidl b/audio/aidl/android/hardware/audio/core/IModule.aidl index 802cb2f151..363eb683f3 100644 --- a/audio/aidl/android/hardware/audio/core/IModule.aidl +++ b/audio/aidl/android/hardware/audio/core/IModule.aidl @@ -23,6 +23,7 @@ import android.hardware.audio.core.AudioRoute; import android.hardware.audio.core.IStreamIn; import android.hardware.audio.core.IStreamOut; import android.hardware.audio.core.ModuleDebug; +import android.hardware.audio.core.StreamDescriptor; import android.media.audio.common.AudioOffloadInfo; import android.media.audio.common.AudioPort; import android.media.audio.common.AudioPortConfig; @@ -241,22 +242,49 @@ interface IModule { * 'setAudioPortConfig' method. Existence of an audio patch involving this * port configuration is not required for successful opening of a stream. * + * The requested buffer size is expressed in frames, thus the actual size + * in bytes depends on the audio port configuration. Also, the HAL module + * may end up providing a larger buffer, thus the requested size is treated + * as the minimum size that the client needs. The minimum buffer size + * suggested by the HAL is in the 'AudioPatch.minimumStreamBufferSizeFrames' + * field, returned as a result of calling the 'setAudioPatch' method. + * * Only one stream is allowed per audio port configuration. HAL module can * also set a limit on how many output streams can be opened for a particular * mix port by using its 'AudioPortMixExt.maxOpenStreamCount' field. * - * @return An opened input stream. - * @param portConfigId The ID of the audio mix port config. - * @param sinkMetadata Description of the audio that will be recorded. + * Note that although it's not prohibited to open a stream on a mix port + * configuration which is not connected (using a patch) to any device port, + * and set up a patch afterwards, this is not the recommended sequence of + * calls, because setting up of a patch might fail due to an insufficient + * stream buffer size. + * + * @return An opened input stream and the associated descriptor. + * @param args Input arguments, see 'OpenInputStreamArguments' parcelable. * @throws EX_ILLEGAL_ARGUMENT In the following cases: * - If the port config can not be found by the ID. * - If the port config is not of an input mix port. + * - If a buffer of the requested size can not be provided. * @throws EX_ILLEGAL_STATE In the following cases: * - If the port config already has a stream opened on it. * - If the limit on the open stream count for the port has * been reached. */ - IStreamIn openInputStream(int portConfigId, in SinkMetadata sinkMetadata); + @VintfStability + parcelable OpenInputStreamArguments { + /** The ID of the audio mix port config. */ + int portConfigId; + /** Description of the audio that will be recorded. */ + SinkMetadata sinkMetadata; + /** Requested audio I/O buffer minimum size, in frames. */ + long bufferSizeFrames; + } + @VintfStability + parcelable OpenInputStreamReturn { + IStreamIn stream; + StreamDescriptor desc; + } + OpenInputStreamReturn openInputStream(in OpenInputStreamArguments args); /** * Open an output stream using an existing audio mix port configuration. @@ -269,21 +297,33 @@ interface IModule { * the framework must provide additional information about the encoded * audio stream in 'offloadInfo' argument. * + * The requested buffer size is expressed in frames, thus the actual size + * in bytes depends on the audio port configuration. Also, the HAL module + * may end up providing a larger buffer, thus the requested size is treated + * as the minimum size that the client needs. The minimum buffer size + * suggested by the HAL is in the 'AudioPatch.minimumStreamBufferSizeFrames' + * field, returned as a result of calling the 'setAudioPatch' method. + * * Only one stream is allowed per audio port configuration. HAL module can * also set a limit on how many output streams can be opened for a particular * mix port by using its 'AudioPortMixExt.maxOpenStreamCount' field. * Only one stream can be opened on the audio port with 'PRIMARY' output * flag. This rule can not be overridden with 'maxOpenStreamCount' field. * - * @return An opened output stream. - * @param portConfigId The ID of the audio mix port config. - * @param sourceMetadata Description of the audio that will be played. - * @param offloadInfo Additional information for offloaded playback. + * Note that although it's not prohibited to open a stream on a mix port + * configuration which is not connected (using a patch) to any device port, + * and set up a patch afterwards, this is not the recommended sequence of + * calls, because setting up of a patch might fail due to an insufficient + * stream buffer size. + * + * @return An opened output stream and the associated descriptor. + * @param args Input arguments, see 'OpenOutputStreamArguments' parcelable. * @throws EX_ILLEGAL_ARGUMENT In the following cases: * - If the port config can not be found by the ID. * - If the port config is not of an output mix port. * - If the offload info is not provided for an offload * port configuration. + * - If a buffer of the requested size can not be provided. * @throws EX_ILLEGAL_STATE In the following cases: * - If the port config already has a stream opened on it. * - If the limit on the open stream count for the port has @@ -291,8 +331,23 @@ interface IModule { * - If another opened stream already exists for the 'PRIMARY' * output port. */ - IStreamOut openOutputStream(int portConfigId, in SourceMetadata sourceMetadata, - in @nullable AudioOffloadInfo offloadInfo); + @VintfStability + parcelable OpenOutputStreamArguments { + /** The ID of the audio mix port config. */ + int portConfigId; + /** Description of the audio that will be played. */ + SourceMetadata sourceMetadata; + /** Additional information used for offloaded playback only. */ + @nullable AudioOffloadInfo offloadInfo; + /** Requested audio I/O buffer minimum size, in frames. */ + long bufferSizeFrames; + } + @VintfStability + parcelable OpenOutputStreamReturn { + IStreamOut stream; + StreamDescriptor desc; + } + OpenOutputStreamReturn openOutputStream(in OpenOutputStreamArguments args); /** * Set an audio patch. @@ -300,19 +355,27 @@ interface IModule { * This method creates new or updates an existing audio patch. If the * requested audio patch does not have a specified id, then a new patch is * created and an ID is allocated for it by the HAL module. Otherwise an - * attempt to update an existing patch is made. It is recommended that - * updating of an existing audio patch should be performed by the HAL module - * in a way that does not interrupt active audio streams involving audio - * port configurations of the patch. If the HAL module is unable to avoid - * interruption when updating a certain patch, it is permitted to allocate a - * new patch ID for the result. The returned audio patch contains all the - * information about the new or updated audio patch. + * attempt to update an existing patch is made. + * + * The operation of updating an existing audio patch must not change + * playback state of audio streams opened on the audio port configurations + * of the patch. That is, the HAL module must still be able to consume or + * to provide data from / to streams continuously during the patch + * switching. Natural intermittent audible loss of some audio frames due to + * switching between device ports which does not affect stream playback is + * allowed. If the HAL module is unable to avoid playback or recording + * state change when updating a certain patch, it must return an error. In + * that case, the client must take care of changing port configurations, + * patches, and recreating streams in a way which provides an acceptable + * user experience. * * Audio port configurations specified in the patch must be obtained by * calling 'setAudioPortConfig' method. There must be an audio route which * allows connection between the audio ports whose configurations are used. - * An audio patch may be created before or after an audio steam is created - * for this configuration. + * + * When updating an existing audio patch, nominal latency values may change + * and must be provided by the HAL module in the returned 'AudioPatch' + * structure. * * @return Resulting audio patch. * @param requested Requested audio patch. @@ -324,6 +387,9 @@ interface IModule { * @throws EX_ILLEGAL_STATE In the following cases: * - If application of the patch can only use a route with an * exclusive use the sink port, and it is already patched. + * - If updating an existing patch will cause interruption + * of audio, or requires re-opening of streams due to + * change of minimum audio I/O buffer size. * @throws EX_UNSUPPORTED_OPERATION If the patch can not be established because * the HAL module does not support this otherwise valid * patch configuration. For example, if it's a patch diff --git a/audio/aidl/android/hardware/audio/core/IStreamIn.aidl b/audio/aidl/android/hardware/audio/core/IStreamIn.aidl index b770449d52..7205bb8e18 100644 --- a/audio/aidl/android/hardware/audio/core/IStreamIn.aidl +++ b/audio/aidl/android/hardware/audio/core/IStreamIn.aidl @@ -28,7 +28,9 @@ interface IStreamIn { * * Releases any resources allocated for this stream on the HAL module side. * The stream can not be operated after it has been closed. Methods of this - * interface throw EX_ILLEGAL_STATE in for a closed stream. + * interface throw EX_ILLEGAL_STATE for a closed stream. + * + * The associated stream descriptor can be released once this method returns. * * @throws EX_ILLEGAL_STATE If the stream has already been closed. */ diff --git a/audio/aidl/android/hardware/audio/core/IStreamOut.aidl b/audio/aidl/android/hardware/audio/core/IStreamOut.aidl index 60212fc891..0a5aacdd7a 100644 --- a/audio/aidl/android/hardware/audio/core/IStreamOut.aidl +++ b/audio/aidl/android/hardware/audio/core/IStreamOut.aidl @@ -28,7 +28,9 @@ interface IStreamOut { * * Releases any resources allocated for this stream on the HAL module side. * The stream can not be operated after it has been closed. Methods of this - * interface throw EX_ILLEGAL_STATE in for a closed stream. + * interface throw EX_ILLEGAL_STATE for a closed stream. + * + * The associated stream descriptor can be released once this method returns. * * @throws EX_ILLEGAL_STATE If the stream has already been closed. */ diff --git a/audio/aidl/android/hardware/audio/core/MmapBufferDescriptor.aidl b/audio/aidl/android/hardware/audio/core/MmapBufferDescriptor.aidl new file mode 100644 index 0000000000..108bcbed40 --- /dev/null +++ b/audio/aidl/android/hardware/audio/core/MmapBufferDescriptor.aidl @@ -0,0 +1,51 @@ +/* + * 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. + */ + +package android.hardware.audio.core; + +import android.hardware.common.Ashmem; + +/** + * MMap buffer descriptor is used by streams opened in MMap No IRQ mode. + */ +@JavaDerive(equals=true, toString=true) +@VintfStability +parcelable MmapBufferDescriptor { + /** + * MMap memory buffer. + */ + Ashmem sharedMemory; + /** + * Transfer size granularity in frames. + */ + long burstSizeFrames; + /** + * Attributes describing the buffer. Bitmask indexed by FLAG_INDEX_* + * constants. + */ + int flags; + + /** + * Whether the buffer can be securely shared to untrusted applications + * through the AAudio exclusive mode. + * + * Only set this flag if applications are restricted from accessing the + * memory surrounding the audio data buffer by a kernel mechanism. + * See Linux kernel's dma-buf + * (https://www.kernel.org/doc/html/v4.16/driver-api/dma-buf.html). + */ + const int FLAG_INDEX_APPLICATION_SHAREABLE = 0; +} diff --git a/audio/aidl/android/hardware/audio/core/StreamDescriptor.aidl b/audio/aidl/android/hardware/audio/core/StreamDescriptor.aidl new file mode 100644 index 0000000000..f2338e0d2a --- /dev/null +++ b/audio/aidl/android/hardware/audio/core/StreamDescriptor.aidl @@ -0,0 +1,201 @@ +/* + * 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. + */ + +package android.hardware.audio.core; + +import android.hardware.audio.core.MmapBufferDescriptor; +import android.hardware.common.fmq.MQDescriptor; +import android.hardware.common.fmq.SynchronizedReadWrite; +import android.hardware.common.fmq.UnsynchronizedWrite; + +/** + * Stream descriptor contains fast message queues and buffers used for sending + * and receiving audio data. The descriptor complements IStream* interfaces by + * providing communication channels that serve as an alternative to Binder + * transactions. + * + * Handling of audio data and commands must be done by the HAL module on a + * dedicated thread with high priority, for all modes, including MMap No + * IRQ. The HAL module is responsible for creating this thread and setting its + * priority. The HAL module is also responsible for serializing access to the + * internal components of the stream while serving commands invoked via the + * stream's AIDL interface and commands invoked via the command queue of the + * descriptor. + */ +@JavaDerive(equals=true, toString=true) +@VintfStability +parcelable StreamDescriptor { + /** + * Position binds together a position within the stream and time. + * + * The timestamp must use "monotonic" clock. + * + * The frame count must advance between consecutive I/O operations, and stop + * advancing when the stream was put into the 'standby' mode. On exiting the + * 'standby' mode, the frame count must not reset, but continue counting. + */ + @VintfStability + @FixedSize + parcelable Position { + /** Frame count. */ + long frames; + /** Timestamp in nanoseconds. */ + long timeNs; + } + + /** + * The exit command is used to unblock the HAL thread and ask it to exit. + * This is the last command that the client sends via the StreamDescriptor. + * The HAL module must reply to this command in order to unblock the client, + * and cease waiting on the command queue. + */ + const int COMMAND_EXIT = 0; + /** + * The command used for audio I/O, see 'AudioBuffer'. For MMap No IRQ mode + * this command only provides updated positions and latency because actual + * audio I/O is done via the 'AudioBuffer.mmap' shared buffer. + */ + const int COMMAND_BURST = 1; + + /** + * Used for sending commands to the HAL module. The client writes into + * the queue, the HAL module reads. The queue can only contain a single + * command. + */ + @VintfStability + @FixedSize + parcelable Command { + /** + * One of COMMAND_* codes. + */ + int code; + /** + * For output streams: the amount of bytes provided by the client in the + * 'audio.fmq' queue. + * For input streams: the amount of bytes requested by the client to read + * from the hardware into the 'audio.fmq' queue. + */ + int fmqByteCount; + } + MQDescriptor command; + + /** + * No error, the command completed successfully. + */ + const int STATUS_OK = 0; + /** + * Invalid data provided in the command, e.g. unknown command code or + * negative 'fmqByteCount' value. + */ + const int STATUS_ILLEGAL_ARGUMENT = 1; + /** + * The HAL module is not in the state when it can complete the command. + */ + const int STATUS_ILLEGAL_STATE = 2; + + /** + * Used for providing replies to commands. The HAL module writes into + * the queue, the client reads. The queue can only contain a single reply, + * corresponding to the last command sent by the client. + */ + @VintfStability + @FixedSize + parcelable Reply { + /** + * One of STATUS_* statuses. + */ + int status; + /** + * For output streams: the amount of bytes actually consumed by the HAL + * module from the 'audio.fmq' queue. + * For input streams: the amount of bytes actually provided by the HAL + * in the 'audio.fmq' queue. + */ + int fmqByteCount; + /** + * For output streams: the moment when the specified stream position + * was presented to an external observer (i.e. presentation position). + * For input streams: the moment when data at the specified stream position + * was acquired (i.e. capture position). + */ + Position observable; + /** + * Used only for MMap streams to provide the hardware read / write + * position for audio data in the shared memory buffer 'audio.mmap'. + */ + Position hardware; + /** + * Current latency reported by the hardware. + */ + int latencyMs; + } + MQDescriptor reply; + + /** + * Total buffer size in frames. This applies both to the size of the 'audio.fmq' + * queue and to the size of the shared memory buffer for MMap No IRQ streams. + * Note that this size may end up being slightly larger than the size requested + * in a call to 'IModule.openInputStream' or 'openOutputStream' due to memory + * alignment requirements. + */ + long bufferSizeFrames; + + /** + * Used for sending or receiving audio data to/from the stream. In the case + * of MMap No IRQ streams this structure only contains the information about + * the shared memory buffer. Audio data is sent via the shared buffer + * directly. + */ + @VintfStability + union AudioBuffer { + /** + * The fast message queue used for all modes except MMap No IRQ. Access + * to this queue is synchronized via the 'command' and 'reply' queues + * as described below. + * + * For output streams the following sequence of operations is used: + * 1. The client puts audio data into the 'audio.fmq' queue. + * 2. The client writes the 'BURST' command into the 'command' queue, + * and hangs on waiting on a read from the 'reply' queue. + * 3. The high priority thread in the HAL module wakes up due to 2. + * 4. The HAL module reads the command and audio data. + * 5. The HAL module writes the command status and current positions + * into 'reply' queue, and hangs on waiting on a read from + * the 'command' queue. + * + * For input streams the following sequence of operations is used: + * 1. The client writes the 'BURST' command into the 'command' queue, + * and hangs on waiting on a read from the 'reply' queue. + * 2. The high priority thread in the HAL module wakes up due to 1. + * 3. The HAL module puts audio data into the 'audio.fmq' queue. + * 4. The HAL module writes the command status and current positions + * into 'reply' queue, and hangs on waiting on a read from + * the 'command' queue. + * 5. The client wakes up due to 4. + * 6. The client reads the reply and audio data. + */ + MQDescriptor fmq; + /** + * MMap buffers are shared directly with the DSP, which operates + * independently from the CPU. Writes and reads into these buffers + * are not synchronized with 'command' and 'reply' queues. However, + * the client still uses the 'BURST' command for obtaining current + * positions from the HAL module. + */ + MmapBufferDescriptor mmap; + } + AudioBuffer audio; +} diff --git a/audio/aidl/default/Android.bp b/audio/aidl/default/Android.bp index ad1d9c761a..027d92873f 100644 --- a/audio/aidl/default/Android.bp +++ b/audio/aidl/default/Android.bp @@ -16,6 +16,8 @@ cc_library_static { "libstagefright_foundation", "android.media.audio.common.types-V1-ndk", "android.hardware.audio.core-V1-ndk", + "android.hardware.common-V2-ndk", + "android.hardware.common.fmq-V1-ndk", ], export_include_dirs: ["include"], srcs: [ @@ -41,6 +43,8 @@ cc_binary { "libstagefright_foundation", "android.media.audio.common.types-V1-ndk", "android.hardware.audio.core-V1-ndk", + "android.hardware.common-V2-ndk", + "android.hardware.common.fmq-V1-ndk", ], static_libs: [ "libaudioserviceexampleimpl", diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp index 5b4d48a837..1c6f90a021 100644 --- a/audio/aidl/default/Module.cpp +++ b/audio/aidl/default/Module.cpp @@ -27,7 +27,9 @@ using aidl::android::hardware::audio::common::SinkMetadata; using aidl::android::hardware::audio::common::SourceMetadata; +using aidl::android::media::audio::common::AudioChannelLayout; using aidl::android::media::audio::common::AudioFormatDescription; +using aidl::android::media::audio::common::AudioFormatType; using aidl::android::media::audio::common::AudioIoFlags; using aidl::android::media::audio::common::AudioOffloadInfo; using aidl::android::media::audio::common::AudioOutputFlags; @@ -36,6 +38,7 @@ using aidl::android::media::audio::common::AudioPortConfig; using aidl::android::media::audio::common::AudioPortExt; using aidl::android::media::audio::common::AudioProfile; using aidl::android::media::audio::common::Int; +using aidl::android::media::audio::common::PcmType; namespace aidl::android::hardware::audio::core { @@ -69,6 +72,49 @@ bool generateDefaultPortConfig(const AudioPort& port, AudioPortConfig* config) { return true; } +constexpr size_t getPcmSampleSizeInBytes(PcmType pcm) { + switch (pcm) { + case PcmType::UINT_8_BIT: + return 1; + case PcmType::INT_16_BIT: + return 2; + case PcmType::INT_32_BIT: + return 4; + case PcmType::FIXED_Q_8_24: + return 4; + case PcmType::FLOAT_32_BIT: + return 4; + case PcmType::INT_24_BIT: + return 3; + } + return 0; +} + +constexpr size_t getChannelCount(const AudioChannelLayout& layout) { + using Tag = AudioChannelLayout::Tag; + switch (layout.getTag()) { + case Tag::none: + return 0; + case Tag::invalid: + return 0; + case Tag::indexMask: + return __builtin_popcount(layout.get()); + case Tag::layoutMask: + return __builtin_popcount(layout.get()); + case Tag::voiceMask: + return __builtin_popcount(layout.get()); + } + return 0; +} + +size_t getFrameSizeInBytes(const AudioFormatDescription& format, const AudioChannelLayout& layout) { + if (format.type == AudioFormatType::PCM) { + return getPcmSampleSizeInBytes(format.pcm) * getChannelCount(layout); + } + // For non-PCM formats always use frame size of 1. + return 1; +} + bool findAudioProfile(const AudioPort& port, const AudioFormatDescription& format, AudioProfile* profile) { if (auto profilesIt = @@ -111,6 +157,78 @@ void Module::cleanUpPatches(int32_t portConfigId) { erase_all_values(mPatches, erasedPatches); } +ndk::ScopedAStatus Module::createStreamDescriptor(int32_t in_portConfigId, + int64_t in_bufferSizeFrames, + StreamDescriptor* out_descriptor) { + if (in_bufferSizeFrames <= 0) { + LOG(ERROR) << __func__ << ": non-positive buffer size " << in_bufferSizeFrames; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (in_bufferSizeFrames < kMinimumStreamBufferSizeFrames) { + LOG(ERROR) << __func__ << ": insufficient buffer size " << in_bufferSizeFrames + << ", must be at least " << kMinimumStreamBufferSizeFrames; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + auto& configs = getConfig().portConfigs; + auto portConfigIt = findById(configs, in_portConfigId); + // Since 'createStreamDescriptor' is an internal method, it is assumed that + // validity of the portConfigId has already been checked. + const size_t frameSize = + getFrameSizeInBytes(portConfigIt->format.value(), portConfigIt->channelMask.value()); + if (frameSize == 0) { + LOG(ERROR) << __func__ << ": could not calculate frame size for port config " + << portConfigIt->toString(); + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + LOG(DEBUG) << __func__ << ": frame size " << frameSize << " bytes"; + if (frameSize > kMaximumStreamBufferSizeBytes / in_bufferSizeFrames) { + LOG(ERROR) << __func__ << ": buffer size " << in_bufferSizeFrames + << " frames is too large, maximum size is " + << kMaximumStreamBufferSizeBytes / frameSize; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + (void)out_descriptor; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Module::findPortIdForNewStream(int32_t in_portConfigId, AudioPort** port) { + auto& configs = getConfig().portConfigs; + auto portConfigIt = findById(configs, in_portConfigId); + if (portConfigIt == configs.end()) { + LOG(ERROR) << __func__ << ": existing port config id " << in_portConfigId << " not found"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + const int32_t portId = portConfigIt->portId; + // In our implementation, configs of mix ports always have unique IDs. + CHECK(portId != in_portConfigId); + auto& ports = getConfig().ports; + auto portIt = findById(ports, portId); + if (portIt == ports.end()) { + LOG(ERROR) << __func__ << ": port id " << portId << " used by port config id " + << in_portConfigId << " not found"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (mStreams.count(in_portConfigId) != 0) { + LOG(ERROR) << __func__ << ": port config id " << in_portConfigId + << " already has a stream opened on it"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } + if (portIt->ext.getTag() != AudioPortExt::Tag::mix) { + LOG(ERROR) << __func__ << ": port config id " << in_portConfigId + << " does not correspond to a mix port"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + const int32_t maxOpenStreamCount = portIt->ext.get().maxOpenStreamCount; + if (maxOpenStreamCount != 0 && mStreams.count(portId) >= maxOpenStreamCount) { + LOG(ERROR) << __func__ << ": port id " << portId + << " has already reached maximum allowed opened stream count: " + << maxOpenStreamCount; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } + *port = &(*portIt); + return ndk::ScopedAStatus::ok(); +} + internal::Configuration& Module::getConfig() { if (!mConfig) { mConfig.reset(new internal::Configuration(internal::getNullPrimaryConfiguration())); @@ -336,98 +454,59 @@ ndk::ScopedAStatus Module::getAudioRoutesForAudioPort(int32_t in_portId, return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Module::openInputStream(int32_t in_portConfigId, - const SinkMetadata& in_sinkMetadata, - std::shared_ptr* _aidl_return) { - auto& configs = getConfig().portConfigs; - auto portConfigIt = findById(configs, in_portConfigId); - if (portConfigIt == configs.end()) { - LOG(ERROR) << __func__ << ": existing port config id " << in_portConfigId << " not found"; - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); +ndk::ScopedAStatus Module::openInputStream(const OpenInputStreamArguments& in_args, + OpenInputStreamReturn* _aidl_return) { + LOG(DEBUG) << __func__ << ": port config id " << in_args.portConfigId << ", buffer size " + << in_args.bufferSizeFrames << " frames"; + AudioPort* port = nullptr; + if (auto status = findPortIdForNewStream(in_args.portConfigId, &port); !status.isOk()) { + return status; } - const int32_t portId = portConfigIt->portId; - // In our implementation, configs of mix ports always have unique IDs. - CHECK(portId != in_portConfigId); - auto& ports = getConfig().ports; - auto portIt = findById(ports, portId); - if (portIt == ports.end()) { - LOG(ERROR) << __func__ << ": port id " << portId << " used by port config id " - << in_portConfigId << " not found"; - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); - } - if (portIt->flags.getTag() != AudioIoFlags::Tag::input || - portIt->ext.getTag() != AudioPortExt::Tag::mix) { - LOG(ERROR) << __func__ << ": port config id " << in_portConfigId + if (port->flags.getTag() != AudioIoFlags::Tag::input) { + LOG(ERROR) << __func__ << ": port config id " << in_args.portConfigId << " does not correspond to an input mix port"; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } - if (mStreams.count(in_portConfigId) != 0) { - LOG(ERROR) << __func__ << ": port config id " << in_portConfigId - << " already has a stream opened on it"; - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + if (auto status = createStreamDescriptor(in_args.portConfigId, in_args.bufferSizeFrames, + &_aidl_return->desc); + !status.isOk()) { + return status; } - const int32_t maxOpenStreamCount = portIt->ext.get().maxOpenStreamCount; - if (maxOpenStreamCount != 0 && mStreams.count(portId) >= maxOpenStreamCount) { - LOG(ERROR) << __func__ << ": port id " << portId - << " has already reached maximum allowed opened stream count: " - << maxOpenStreamCount; - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); - } - auto stream = ndk::SharedRefBase::make(in_sinkMetadata); - mStreams.insert(portId, in_portConfigId, StreamWrapper(stream)); - *_aidl_return = std::move(stream); + auto stream = ndk::SharedRefBase::make(in_args.sinkMetadata); + mStreams.insert(port->id, in_args.portConfigId, StreamWrapper(stream)); + _aidl_return->stream = std::move(stream); return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Module::openOutputStream(int32_t in_portConfigId, - const SourceMetadata& in_sourceMetadata, - const std::optional& in_offloadInfo, - std::shared_ptr* _aidl_return) { - auto& configs = getConfig().portConfigs; - auto portConfigIt = findById(configs, in_portConfigId); - if (portConfigIt == configs.end()) { - LOG(ERROR) << __func__ << ": existing port config id " << in_portConfigId << " not found"; - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); +ndk::ScopedAStatus Module::openOutputStream(const OpenOutputStreamArguments& in_args, + OpenOutputStreamReturn* _aidl_return) { + LOG(DEBUG) << __func__ << ": port config id " << in_args.portConfigId << ", has offload info? " + << (in_args.offloadInfo.has_value()) << ", buffer size " << in_args.bufferSizeFrames + << " frames"; + AudioPort* port = nullptr; + if (auto status = findPortIdForNewStream(in_args.portConfigId, &port); !status.isOk()) { + return status; } - const int32_t portId = portConfigIt->portId; - // In our implementation, configs of mix ports always have unique IDs. - CHECK(portId != in_portConfigId); - auto& ports = getConfig().ports; - auto portIt = findById(ports, portId); - if (portIt == ports.end()) { - LOG(ERROR) << __func__ << ": port id " << portId << " used by port config id " - << in_portConfigId << " not found"; - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); - } - if (portIt->flags.getTag() != AudioIoFlags::Tag::output || - portIt->ext.getTag() != AudioPortExt::Tag::mix) { - LOG(ERROR) << __func__ << ": port config id " << in_portConfigId + if (port->flags.getTag() != AudioIoFlags::Tag::output) { + LOG(ERROR) << __func__ << ": port config id " << in_args.portConfigId << " does not correspond to an output mix port"; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } - if (portConfigIt->flags.has_value() && - ((portConfigIt->flags.value().get() & - 1 << static_cast(AudioOutputFlags::COMPRESS_OFFLOAD)) != 0) && - !in_offloadInfo.has_value()) { - LOG(ERROR) << __func__ << ": port config id " << in_portConfigId + if ((port->flags.get() & + 1 << static_cast(AudioOutputFlags::COMPRESS_OFFLOAD)) != 0 && + !in_args.offloadInfo.has_value()) { + LOG(ERROR) << __func__ << ": port id " << port->id << " has COMPRESS_OFFLOAD flag set, requires offload info"; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } - if (mStreams.count(in_portConfigId) != 0) { - LOG(ERROR) << __func__ << ": port config id " << in_portConfigId - << " already has a stream opened on it"; - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + if (auto status = createStreamDescriptor(in_args.portConfigId, in_args.bufferSizeFrames, + &_aidl_return->desc); + !status.isOk()) { + return status; } - const int32_t maxOpenStreamCount = portIt->ext.get().maxOpenStreamCount; - if (maxOpenStreamCount != 0 && mStreams.count(portId) >= maxOpenStreamCount) { - LOG(ERROR) << __func__ << ": port id " << portId - << " has already reached maximum allowed opened stream count: " - << maxOpenStreamCount; - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); - } - auto stream = ndk::SharedRefBase::make(in_sourceMetadata, in_offloadInfo); - mStreams.insert(portId, in_portConfigId, StreamWrapper(stream)); - *_aidl_return = std::move(stream); + auto stream = ndk::SharedRefBase::make(in_args.sourceMetadata, in_args.offloadInfo); + mStreams.insert(port->id, in_args.portConfigId, StreamWrapper(stream)); + _aidl_return->stream = std::move(stream); return ndk::ScopedAStatus::ok(); } @@ -512,6 +591,10 @@ ndk::ScopedAStatus Module::setAudioPatch(const AudioPatch& in_requested, AudioPa } } *_aidl_return = in_requested; + _aidl_return->minimumStreamBufferSizeFrames = kMinimumStreamBufferSizeFrames; + _aidl_return->latenciesMs.clear(); + _aidl_return->latenciesMs.insert(_aidl_return->latenciesMs.end(), + _aidl_return->sinkPortConfigIds.size(), kLatencyMs); if (existing == patches.end()) { _aidl_return->id = getConfig().nextPatchId++; patches.push_back(*_aidl_return); diff --git a/audio/aidl/default/Stream.cpp b/audio/aidl/default/Stream.cpp index e16b2c62b9..ab3e451364 100644 --- a/audio/aidl/default/Stream.cpp +++ b/audio/aidl/default/Stream.cpp @@ -15,7 +15,6 @@ */ #define LOG_TAG "AHAL_Stream" -#define LOG_NDEBUG 0 #include #include "core-impl/Stream.h" @@ -26,7 +25,9 @@ using aidl::android::media::audio::common::AudioOffloadInfo; namespace aidl::android::hardware::audio::core { -StreamIn::StreamIn(const SinkMetadata& sinkMetadata) : mMetadata(sinkMetadata) {} +StreamIn::StreamIn(const SinkMetadata& sinkMetadata) : mMetadata(sinkMetadata) { + LOG(DEBUG) << __func__; +} ndk::ScopedAStatus StreamIn::close() { LOG(DEBUG) << __func__; @@ -51,7 +52,9 @@ ndk::ScopedAStatus StreamIn::updateMetadata(const SinkMetadata& in_sinkMetadata) StreamOut::StreamOut(const SourceMetadata& sourceMetadata, const std::optional& offloadInfo) - : mMetadata(sourceMetadata), mOffloadInfo(offloadInfo) {} + : mMetadata(sourceMetadata), mOffloadInfo(offloadInfo) { + LOG(DEBUG) << __func__; +} ndk::ScopedAStatus StreamOut::close() { LOG(DEBUG) << __func__; diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h index 81a02baabb..f7e14affce 100644 --- a/audio/aidl/default/include/core-impl/Module.h +++ b/audio/aidl/default/include/core-impl/Module.h @@ -48,15 +48,15 @@ class Module : public BnModule { int32_t in_portId, std::vector<::aidl::android::hardware::audio::core::AudioRoute>* _aidl_return) override; ndk::ScopedAStatus openInputStream( - int32_t in_portConfigId, - const ::aidl::android::hardware::audio::common::SinkMetadata& in_sinkMetadata, - std::shared_ptr* _aidl_return) override; + const ::aidl::android::hardware::audio::core::IModule::OpenInputStreamArguments& + in_args, + ::aidl::android::hardware::audio::core::IModule::OpenInputStreamReturn* _aidl_return) + override; ndk::ScopedAStatus openOutputStream( - int32_t in_portConfigId, - const ::aidl::android::hardware::audio::common::SourceMetadata& in_sourceMetadata, - const std::optional<::aidl::android::media::audio::common::AudioOffloadInfo>& - in_offloadInfo, - std::shared_ptr* _aidl_return) override; + const ::aidl::android::hardware::audio::core::IModule::OpenOutputStreamArguments& + in_args, + ::aidl::android::hardware::audio::core::IModule::OpenOutputStreamReturn* _aidl_return) + override; ndk::ScopedAStatus setAudioPatch(const AudioPatch& in_requested, AudioPatch* _aidl_return) override; ndk::ScopedAStatus setAudioPortConfig( @@ -69,9 +69,21 @@ class Module : public BnModule { private: void cleanUpPatch(int32_t patchId); void cleanUpPatches(int32_t portConfigId); + ndk::ScopedAStatus createStreamDescriptor( + int32_t in_portConfigId, int64_t in_bufferSizeFrames, + ::aidl::android::hardware::audio::core::StreamDescriptor* out_descriptor); + ndk::ScopedAStatus findPortIdForNewStream( + int32_t in_portConfigId, ::aidl::android::media::audio::common::AudioPort** port); internal::Configuration& getConfig(); void registerPatch(const AudioPatch& patch); + // This value is used for all AudioPatches. + static constexpr int32_t kMinimumStreamBufferSizeFrames = 16; + // This value is used for all AudioPatches. + static constexpr int32_t kLatencyMs = 10; + // The maximum stream buffer size is 1 GiB = 2 ** 30 bytes; + static constexpr int32_t kMaximumStreamBufferSizeBytes = 1 << 30; + std::unique_ptr mConfig; ModuleDebug mDebug; // ids of ports created at runtime via 'connectExternalDevice'. diff --git a/audio/aidl/vts/Android.bp b/audio/aidl/vts/Android.bp index cd5915bbe2..75ff37f088 100644 --- a/audio/aidl/vts/Android.bp +++ b/audio/aidl/vts/Android.bp @@ -23,6 +23,8 @@ cc_test { static_libs: [ "android.hardware.audio.common-V1-ndk", "android.hardware.audio.core-V1-ndk", + "android.hardware.common-V2-ndk", + "android.hardware.common.fmq-V1-ndk", "android.media.audio.common.types-V1-ndk", ], test_suites: [ diff --git a/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp index bb24365741..0ecc057c35 100644 --- a/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -48,6 +49,7 @@ using aidl::android::hardware::audio::core::IModule; using aidl::android::hardware::audio::core::IStreamIn; using aidl::android::hardware::audio::core::IStreamOut; using aidl::android::hardware::audio::core::ModuleDebug; +using aidl::android::hardware::audio::core::StreamDescriptor; using aidl::android::media::audio::common::AudioContentType; using aidl::android::media::audio::common::AudioDevice; using aidl::android::media::audio::common::AudioDeviceAddress; @@ -225,6 +227,9 @@ class WithAudioPortConfig { class AudioCoreModule : public testing::TestWithParam { public: + // The default buffer size is used mostly for negative tests. + static constexpr int kDefaultBufferSize = 256; + void SetUp() override { ASSERT_NO_FATAL_FAILURE(ConnectToService()); debug.flags().simulateDeviceConnections = true; @@ -382,13 +387,14 @@ class WithStream { } } void SetUpPortConfig(IModule* module) { ASSERT_NO_FATAL_FAILURE(mPortConfig.SetUp(module)); } - ScopedAStatus SetUpNoChecks(IModule* module) { - return SetUpNoChecks(module, mPortConfig.get()); + ScopedAStatus SetUpNoChecks(IModule* module, long bufferSize) { + return SetUpNoChecks(module, mPortConfig.get(), bufferSize); } - ScopedAStatus SetUpNoChecks(IModule* module, const AudioPortConfig& portConfig); - void SetUp(IModule* module) { + ScopedAStatus SetUpNoChecks(IModule* module, const AudioPortConfig& portConfig, + long bufferSize); + void SetUp(IModule* module, long bufferSize) { ASSERT_NO_FATAL_FAILURE(SetUpPortConfig(module)); - ScopedAStatus status = SetUpNoChecks(module); + ScopedAStatus status = SetUpNoChecks(module, bufferSize); ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status << "; port config id " << getPortId(); ASSERT_NE(nullptr, mStream) << "; port config id " << getPortId(); @@ -401,6 +407,7 @@ class WithStream { private: WithAudioPortConfig mPortConfig; std::shared_ptr mStream; + StreamDescriptor mDescriptor; }; SinkMetadata GenerateSinkMetadata(const AudioPortConfig& portConfig) { @@ -415,8 +422,19 @@ SinkMetadata GenerateSinkMetadata(const AudioPortConfig& portConfig) { template <> ScopedAStatus WithStream::SetUpNoChecks(IModule* module, - const AudioPortConfig& portConfig) { - return module->openInputStream(portConfig.id, GenerateSinkMetadata(portConfig), &mStream); + const AudioPortConfig& portConfig, + long bufferSize) { + aidl::android::hardware::audio::core::IModule::OpenInputStreamArguments args; + args.portConfigId = portConfig.id; + args.sinkMetadata = GenerateSinkMetadata(portConfig); + args.bufferSizeFrames = bufferSize; + aidl::android::hardware::audio::core::IModule::OpenInputStreamReturn ret; + ScopedAStatus status = module->openInputStream(args, &ret); + if (status.isOk()) { + mStream = std::move(ret.stream); + mDescriptor = std::move(ret.desc); + } + return status; } SourceMetadata GenerateSourceMetadata(const AudioPortConfig& portConfig) { @@ -432,10 +450,20 @@ SourceMetadata GenerateSourceMetadata(const AudioPortConfig& portConfig) { template <> ScopedAStatus WithStream::SetUpNoChecks(IModule* module, - const AudioPortConfig& portConfig) { - return module->openOutputStream(portConfig.id, GenerateSourceMetadata(portConfig), - ModuleConfig::generateOffloadInfoIfNeeded(portConfig), - &mStream); + const AudioPortConfig& portConfig, + long bufferSize) { + aidl::android::hardware::audio::core::IModule::OpenOutputStreamArguments args; + args.portConfigId = portConfig.id; + args.sourceMetadata = GenerateSourceMetadata(portConfig); + args.offloadInfo = ModuleConfig::generateOffloadInfoIfNeeded(portConfig); + args.bufferSizeFrames = bufferSize; + aidl::android::hardware::audio::core::IModule::OpenOutputStreamReturn ret; + ScopedAStatus status = module->openOutputStream(args, &ret); + if (status.isOk()) { + mStream = std::move(ret.stream); + mDescriptor = std::move(ret.desc); + } + return status; } class WithAudioPatch { @@ -467,6 +495,10 @@ class WithAudioPatch { ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status << "; source port config id " << mSrcPortConfig.getId() << "; sink port config id " << mSinkPortConfig.getId(); + EXPECT_GT(mPatch.minimumStreamBufferSizeFrames, 0) << "patch id " << getId(); + for (auto latencyMs : mPatch.latenciesMs) { + EXPECT_GT(latencyMs, 0) << "patch id " << getId(); + } } int32_t getId() const { return mPatch.id; } const AudioPatch& get() const { return mPatch; } @@ -739,18 +771,24 @@ TEST_P(AudioCoreModule, OpenStreamInvalidPortConfigId) { ASSERT_NO_FATAL_FAILURE(GetAllPortConfigIds(&portConfigIds)); for (const auto portConfigId : GetNonExistentIds(portConfigIds)) { { - std::shared_ptr stream; - ScopedAStatus status = module->openInputStream(portConfigId, {}, &stream); + aidl::android::hardware::audio::core::IModule::OpenInputStreamArguments args; + args.portConfigId = portConfigId; + args.bufferSizeFrames = kDefaultBufferSize; + aidl::android::hardware::audio::core::IModule::OpenInputStreamReturn ret; + ScopedAStatus status = module->openInputStream(args, &ret); EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << " openInputStream returned for port config ID " << portConfigId; - EXPECT_EQ(nullptr, stream); + EXPECT_EQ(nullptr, ret.stream); } { - std::shared_ptr stream; - ScopedAStatus status = module->openOutputStream(portConfigId, {}, {}, &stream); + aidl::android::hardware::audio::core::IModule::OpenOutputStreamArguments args; + args.portConfigId = portConfigId; + args.bufferSizeFrames = kDefaultBufferSize; + aidl::android::hardware::audio::core::IModule::OpenOutputStreamReturn ret; + ScopedAStatus status = module->openOutputStream(args, &ret); EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << " openOutputStream returned for port config ID " << portConfigId; - EXPECT_EQ(nullptr, stream); + EXPECT_EQ(nullptr, ret.stream); } } } @@ -1120,7 +1158,7 @@ class AudioStream : public AudioCoreModule { std::shared_ptr heldStream; { WithStream stream(portConfig.value()); - ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get())); + ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultBufferSize)); heldStream = stream.getSharedPointer(); } ScopedAStatus status = heldStream->close(); @@ -1132,10 +1170,43 @@ class AudioStream : public AudioCoreModule { const auto allPortConfigs = moduleConfig->getPortConfigsForMixPorts(IsInput()); for (const auto& portConfig : allPortConfigs) { WithStream stream(portConfig); - ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get())); + ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultBufferSize)); } } + void OpenInvalidBufferSize() { + const auto portConfig = moduleConfig->getSingleConfigForMixPort(IsInput()); + if (!portConfig.has_value()) { + GTEST_SKIP() << "No mix port for attached devices"; + } + WithStream stream(portConfig.value()); + ASSERT_NO_FATAL_FAILURE(stream.SetUpPortConfig(module.get())); + // The buffer size of 1 frame should be impractically small, and thus + // less than any minimum buffer size suggested by any HAL. + for (long bufferSize : std::array{-1, 0, 1, std::numeric_limits::max()}) { + ScopedAStatus status = stream.SetUpNoChecks(module.get(), bufferSize); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) + << status << " open" << direction(true) << "Stream returned for " << bufferSize + << " buffer size"; + EXPECT_EQ(nullptr, stream.get()); + } + } + + void OpenInvalidDirection() { + // Important! The direction of the port config must be reversed. + const auto portConfig = moduleConfig->getSingleConfigForMixPort(!IsInput()); + if (!portConfig.has_value()) { + GTEST_SKIP() << "No mix port for attached devices"; + } + WithStream stream(portConfig.value()); + ASSERT_NO_FATAL_FAILURE(stream.SetUpPortConfig(module.get())); + ScopedAStatus status = stream.SetUpNoChecks(module.get(), kDefaultBufferSize); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) + << status << " open" << direction(true) << "Stream returned for port config ID " + << stream.getPortId(); + EXPECT_EQ(nullptr, stream.get()); + } + void OpenOverMaxCount() { constexpr bool isInput = IsInput(); auto ports = moduleConfig->getMixPorts(isInput); @@ -1158,10 +1229,10 @@ class AudioStream : public AudioCoreModule { streamWraps[i].emplace(portConfigs[i]); WithStream& stream = streamWraps[i].value(); if (i < maxStreamCount) { - ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get())); + ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultBufferSize)); } else { ASSERT_NO_FATAL_FAILURE(stream.SetUpPortConfig(module.get())); - ScopedAStatus status = stream.SetUpNoChecks(module.get()); + ScopedAStatus status = stream.SetUpNoChecks(module.get(), kDefaultBufferSize); EXPECT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode()) << status << " open" << direction(true) << "Stream returned for port config ID " << stream.getPortId() @@ -1175,21 +1246,6 @@ class AudioStream : public AudioCoreModule { } } - void OpenInvalidDirection() { - // Important! The direction of the port config must be reversed. - const auto portConfig = moduleConfig->getSingleConfigForMixPort(!IsInput()); - if (!portConfig.has_value()) { - GTEST_SKIP() << "No mix port for attached devices"; - } - WithStream stream(portConfig.value()); - ASSERT_NO_FATAL_FAILURE(stream.SetUpPortConfig(module.get())); - ScopedAStatus status = stream.SetUpNoChecks(module.get()); - EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) - << status << " open" << direction(true) << "Stream returned for port config ID " - << stream.getPortId(); - EXPECT_EQ(nullptr, stream.get()); - } - void OpenTwiceSamePortConfig() { const auto portConfig = moduleConfig->getSingleConfigForMixPort(IsInput()); if (!portConfig.has_value()) { @@ -1204,7 +1260,7 @@ class AudioStream : public AudioCoreModule { GTEST_SKIP() << "No mix port for attached devices"; } WithStream stream(portConfig.value()); - ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get())); + ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultBufferSize)); ScopedAStatus status = module->resetAudioPortConfig(stream.getPortId()); EXPECT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode()) << status << " returned for port config ID " << stream.getPortId(); @@ -1212,9 +1268,10 @@ class AudioStream : public AudioCoreModule { void OpenTwiceSamePortConfigImpl(const AudioPortConfig& portConfig) { WithStream stream1(portConfig); - ASSERT_NO_FATAL_FAILURE(stream1.SetUp(module.get())); + ASSERT_NO_FATAL_FAILURE(stream1.SetUp(module.get(), kDefaultBufferSize)); WithStream stream2; - ScopedAStatus status = stream2.SetUpNoChecks(module.get(), stream1.getPortConfig()); + ScopedAStatus status = + stream2.SetUpNoChecks(module.get(), stream1.getPortConfig(), kDefaultBufferSize); EXPECT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode()) << status << " when opening " << direction(false) << " stream twice for the same port config ID " << stream1.getPortId(); @@ -1238,6 +1295,7 @@ std::string AudioStreamOut::direction(bool capitalize) { TEST_IO_STREAM(CloseTwice); TEST_IO_STREAM(OpenAllConfigs); +TEST_IO_STREAM(OpenInvalidBufferSize); TEST_IO_STREAM(OpenInvalidDirection); TEST_IO_STREAM(OpenOverMaxCount); TEST_IO_STREAM(OpenTwiceSamePortConfig); @@ -1277,10 +1335,14 @@ TEST_P(AudioStreamOut, RequireOffloadInfo) { const auto portConfig = moduleConfig->getSingleConfigForMixPort(false, *offloadPortIt); ASSERT_TRUE(portConfig.has_value()) << "No profiles specified for the compressed offload mix port"; + StreamDescriptor descriptor; std::shared_ptr ignored; - ScopedAStatus status = module->openOutputStream(portConfig.value().id, - GenerateSourceMetadata(portConfig.value()), - {} /* offloadInfo */, &ignored); + aidl::android::hardware::audio::core::IModule::OpenOutputStreamArguments args; + args.portConfigId = portConfig.value().id; + args.sourceMetadata = GenerateSourceMetadata(portConfig.value()); + args.bufferSizeFrames = kDefaultBufferSize; + aidl::android::hardware::audio::core::IModule::OpenOutputStreamReturn ret; + ScopedAStatus status = module->openOutputStream(args, &ret); EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << " returned when no offload info is provided for a compressed offload mix port"; From 9f4ff57bc113348e5a9d464fd01198ff20423a9d Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Mon, 25 Jul 2022 22:32:19 +0000 Subject: [PATCH 182/998] Fix invalid DAB station in default radio HAL The SID and ensemble value of mock DAB station for default emulator implementation is changed to valid value. Bug: 240196218 Test: m -j Change-Id: Ifd34b86a00c29c15c5ef6d21d6d405eb0b1ff072 --- broadcastradio/2.0/default/VirtualRadio.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/broadcastradio/2.0/default/VirtualRadio.cpp b/broadcastradio/2.0/default/VirtualRadio.cpp index c59fd8ff4b..e6b1017808 100644 --- a/broadcastradio/2.0/default/VirtualRadio.cpp +++ b/broadcastradio/2.0/default/VirtualRadio.cpp @@ -46,9 +46,9 @@ VirtualRadio gAmFmRadio( VirtualRadio gDabRadio( "DAB radio mock", { - {make_selector_dab(12345, 225648), "BBC Radio 1", "Khalid", "Talk"}, // 12B - {make_selector_dab(22345, 222064), "Classic FM", "Jean Sibelius", "Andante Festivo"}, // 11D - {make_selector_dab(32345, 222064), "Absolute Radio", "Coldplay", "Clocks"}, // 11D + {make_selector_dab(0xA00001u, 0x0001u), "BBC Radio 1", "Khalid", "Talk"}, + {make_selector_dab(0xB00001u, 0x1001u), "Classic FM", "Jean Sibelius", "Andante Festivo"}, + {make_selector_dab(0xB00002u, 0x1001u), "Absolute Radio", "Coldplay", "Clocks"}, }); // clang-format on From ad0c3ab7a6bb0f807bc66b3e2306695c85af7c58 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Fri, 15 Jul 2022 00:02:13 +0000 Subject: [PATCH 183/998] Convert VehicleHalDefaultConfig to JsonConfigLoader. Test: Presubmit Bug: 238685398 Change-Id: I4a10b3b4484f593a6311b85f2143ef0ef12f5f81 --- .../include/JsonConfigLoader.h | 12 +- .../JsonConfigLoader/src/JsonConfigLoader.cpp | 30 ++++- .../test/JsonConfigLoaderUnitTest.cpp | 122 +++++++++++------- .../impl/default_config/config/Android.bp | 24 ++++ .../default_config/test/DefaultConfigTest.cpp | 8 +- .../aidl/impl/fake_impl/hardware/Android.bp | 10 +- .../hardware/include/FakeVehicleHardware.h | 26 ++-- .../hardware/src/FakeVehicleHardware.cpp | 98 ++++++++------ .../impl/fake_impl/hardware/test/Android.bp | 9 +- .../hardware/test/FakeVehicleHardwareTest.cpp | 60 +++++---- .../hardware/test/{ => fakedata}/prop.json | 0 .../test/override/gear_selection.json | 22 ++-- .../test/override/hvac_temperature_set.json | 30 +++-- .../utils/proto_message_converter/Android.bp | 9 +- .../test/proto_message_converter_test.cpp | 30 ++++- automotive/vehicle/aidl/impl/vhal/Android.bp | 4 - 16 files changed, 327 insertions(+), 167 deletions(-) rename automotive/vehicle/aidl/impl/fake_impl/hardware/test/{ => fakedata}/prop.json (100%) diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/JsonConfigLoader.h b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/JsonConfigLoader.h index fd73a267db..f3bdbd2343 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/JsonConfigLoader.h +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/include/JsonConfigLoader.h @@ -89,7 +89,8 @@ class JsonValueParser final { // The main class to parse a VHAL config file in JSON format. class JsonConfigParser { public: - android::base::Result> parseJsonConfig(std::istream& is); + android::base::Result> parseJsonConfig( + std::istream& is); private: JsonValueParser mValueParser; @@ -155,8 +156,13 @@ class JsonConfigLoader final { public: JsonConfigLoader(); - // Loads a JSON file stream and parses it to a list of ConfigDeclarations. - android::base::Result> loadPropConfig(std::istream& is); + // Loads a JSON file stream and parses it to a map from propId to ConfigDeclarations. + android::base::Result> loadPropConfig( + std::istream& is); + + // Loads a JSON config file and parses it to a map from propId to ConfigDeclarations. + android::base::Result> loadPropConfig( + const std::string& configPath); private: std::unique_ptr mParser; diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index 392d540d81..e6b7d14c2d 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -25,6 +25,7 @@ #endif // ENABLE_VEHICLE_HAL_TEST_PROPERTIES #include +#include namespace android { namespace hardware { @@ -509,25 +510,32 @@ std::optional JsonConfigParser::parseEachProperty( return configDecl; } -Result> JsonConfigParser::parseJsonConfig(std::istream& is) { +Result> JsonConfigParser::parseJsonConfig( + std::istream& is) { Json::CharReaderBuilder builder; Json::Value root; - std::vector configs; + std::unordered_map configsByPropId; std::string errs; if (!Json::parseFromStream(builder, is, &root, &errs)) { return Error() << "Failed to parse property config file as JSON, error: " << errs; } + if (!root.isObject()) { + return Error() << "root element must be an object"; + } + if (!root.isMember("properties") || !root["properties"].isArray()) { + return Error() << "Missing 'properties' field in root or the field is not an array"; + } Json::Value properties = root["properties"]; std::vector errors; for (unsigned int i = 0; i < properties.size(); i++) { if (auto maybeConfig = parseEachProperty(properties[i], &errors); maybeConfig.has_value()) { - configs.push_back(std::move(maybeConfig.value())); + configsByPropId[maybeConfig.value().config.prop] = std::move(maybeConfig.value()); } } if (!errors.empty()) { return Error() << android::base::Join(errors, '\n'); } - return configs; + return configsByPropId; } } // namespace jsonconfigloader_impl @@ -536,11 +544,21 @@ JsonConfigLoader::JsonConfigLoader() { mParser = std::make_unique(); } -android::base::Result> JsonConfigLoader::loadPropConfig( - std::istream& is) { +android::base::Result> +JsonConfigLoader::loadPropConfig(std::istream& is) { return mParser->parseJsonConfig(is); } +android::base::Result> +JsonConfigLoader::loadPropConfig(const std::string& configPath) { + std::ifstream ifs(configPath.c_str()); + if (!ifs) { + return android::base::Error() << "couldn't open " << configPath << " for parsing."; + } + + return loadPropConfig(ifs); +} + } // namespace vehicle } // namespace automotive } // namespace hardware diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/JsonConfigLoaderUnitTest.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/JsonConfigLoaderUnitTest.cpp index cff70d97ae..9ff8c1b250 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/JsonConfigLoaderUnitTest.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/JsonConfigLoaderUnitTest.cpp @@ -38,7 +38,7 @@ class JsonConfigLoaderUnitTest : public ::testing::Test { JsonConfigLoader mLoader; }; -TEST_F(JsonConfigLoaderUnitTest, TestBasic) { +TEST_F(JsonConfigLoaderUnitTest, testBasic) { std::istringstream iss(R"( { "properties": [{ @@ -53,11 +53,39 @@ TEST_F(JsonConfigLoaderUnitTest, TestBasic) { auto configs = result.value(); ASSERT_EQ(configs.size(), 1u); - - ASSERT_EQ(configs[0].config.prop, 291504388); + ASSERT_EQ(configs.begin()->second.config.prop, 291504388); } -TEST_F(JsonConfigLoaderUnitTest, TestPropertyIsEnum) { +TEST_F(JsonConfigLoaderUnitTest, testRootNotObject) { + std::istringstream iss(R"( + [] + )"); + + ASSERT_FALSE(mLoader.loadPropConfig(iss).ok()) << "root is not an object must cause error"; +} + +TEST_F(JsonConfigLoaderUnitTest, testMissingPropertiesField) { + std::istringstream iss(R"( + { + "abcd": 1234 + } + )"); + + ASSERT_FALSE(mLoader.loadPropConfig(iss).ok()) << "Missing 'properties' field must cause error"; +} + +TEST_F(JsonConfigLoaderUnitTest, testPropertiesFieldNotArray) { + std::istringstream iss(R"( + { + "properties': {'a': 'b'} + } + )"); + + ASSERT_FALSE(mLoader.loadPropConfig(iss).ok()) + << "'properties' field is not an array must cause error"; +} + +TEST_F(JsonConfigLoaderUnitTest, testPropertyIsEnum) { std::istringstream iss(R"( { "properties": [{ @@ -72,11 +100,10 @@ TEST_F(JsonConfigLoaderUnitTest, TestPropertyIsEnum) { auto configs = result.value(); ASSERT_EQ(configs.size(), 1u); - - ASSERT_EQ(configs[0].config.prop, toInt(VehicleProperty::INFO_FUEL_CAPACITY)); + ASSERT_EQ(configs.begin()->second.config.prop, toInt(VehicleProperty::INFO_FUEL_CAPACITY)); } -TEST_F(JsonConfigLoaderUnitTest, TestPropertyEnum_FailInvalidEnum) { +TEST_F(JsonConfigLoaderUnitTest, testPropertyEnum_FailInvalidEnum) { std::istringstream iss(R"( { "properties": [{ @@ -89,7 +116,7 @@ TEST_F(JsonConfigLoaderUnitTest, TestPropertyEnum_FailInvalidEnum) { << "Invalid VehicleProperty enum must cause error"; } -TEST_F(JsonConfigLoaderUnitTest, TestPropertyEnum_FailInvalidType) { +TEST_F(JsonConfigLoaderUnitTest, testPropertyEnum_FailInvalidType) { std::istringstream iss(R"( { "properties": [{ @@ -102,7 +129,7 @@ TEST_F(JsonConfigLoaderUnitTest, TestPropertyEnum_FailInvalidType) { << "Invalid VehicleProperty type must cause error"; } -TEST_F(JsonConfigLoaderUnitTest, TestProperty_FailInvalidJson) { +TEST_F(JsonConfigLoaderUnitTest, testProperty_FailInvalidJson) { std::istringstream iss(R"( { "properties": [{ @@ -112,7 +139,7 @@ TEST_F(JsonConfigLoaderUnitTest, TestProperty_FailInvalidJson) { ASSERT_FALSE(mLoader.loadPropConfig(iss).ok()) << "Invalid JSON format must cause error"; } -TEST_F(JsonConfigLoaderUnitTest, TestConfigArray) { +TEST_F(JsonConfigLoaderUnitTest, testConfigArray) { std::istringstream iss(R"( { "properties": [{ @@ -128,10 +155,10 @@ TEST_F(JsonConfigLoaderUnitTest, TestConfigArray) { auto configs = result.value(); ASSERT_EQ(configs.size(), 1u); - ASSERT_EQ(configs[0].config.configArray, std::vector({1, 2, 3})); + ASSERT_EQ(configs.begin()->second.config.configArray, std::vector({1, 2, 3})); } -TEST_F(JsonConfigLoaderUnitTest, TestConfigArrayConstants) { +TEST_F(JsonConfigLoaderUnitTest, testConfigArrayConstants) { std::istringstream iss(R"( { "properties": [{ @@ -147,11 +174,12 @@ TEST_F(JsonConfigLoaderUnitTest, TestConfigArrayConstants) { auto configs = result.value(); ASSERT_EQ(configs.size(), 1u); - ASSERT_EQ(configs[0].config.configArray, std::vector({1, 2, FUEL_DOOR_REAR_LEFT})); + ASSERT_EQ(configs.begin()->second.config.configArray, + std::vector({1, 2, FUEL_DOOR_REAR_LEFT})); } // We have special logic to deal with GALLON and US_GALLON since they share the same value. -TEST_F(JsonConfigLoaderUnitTest, TestConfigArrayUnitGallon) { +TEST_F(JsonConfigLoaderUnitTest, testConfigArrayUnitGallon) { std::istringstream iss(R"( { "properties": [{ @@ -166,7 +194,7 @@ TEST_F(JsonConfigLoaderUnitTest, TestConfigArrayUnitGallon) { ASSERT_TRUE(result.ok()) << result.error().message(); } -TEST_F(JsonConfigLoaderUnitTest, TestConfigArrayUnitUsGallon) { +TEST_F(JsonConfigLoaderUnitTest, testConfigArrayUnitUsGallon) { std::istringstream iss(R"( { "properties": [{ @@ -181,7 +209,7 @@ TEST_F(JsonConfigLoaderUnitTest, TestConfigArrayUnitUsGallon) { ASSERT_TRUE(result.ok()) << result.error().message(); } -TEST_F(JsonConfigLoaderUnitTest, TestConfigArray_FailInvalidEnum) { +TEST_F(JsonConfigLoaderUnitTest, testConfigArray_FailInvalidEnum) { std::istringstream iss(R"( { "properties": [{ @@ -195,7 +223,7 @@ TEST_F(JsonConfigLoaderUnitTest, TestConfigArray_FailInvalidEnum) { << "Invalid enum in ConfigArray must cause error"; } -TEST_F(JsonConfigLoaderUnitTest, TestConfigArray_FailNotArray) { +TEST_F(JsonConfigLoaderUnitTest, testConfigArray_FailNotArray) { std::istringstream iss(R"( { "properties": [{ @@ -209,7 +237,7 @@ TEST_F(JsonConfigLoaderUnitTest, TestConfigArray_FailNotArray) { << "ConfigArray is not an array must cause error"; } -TEST_F(JsonConfigLoaderUnitTest, TestConfigString) { +TEST_F(JsonConfigLoaderUnitTest, testConfigString) { std::istringstream iss(R"( { "properties": [{ @@ -225,10 +253,10 @@ TEST_F(JsonConfigLoaderUnitTest, TestConfigString) { auto configs = result.value(); ASSERT_EQ(configs.size(), 1u); - ASSERT_EQ(configs[0].config.configString, "test"); + ASSERT_EQ(configs.begin()->second.config.configString, "test"); } -TEST_F(JsonConfigLoaderUnitTest, TestConfigString_FailNotString) { +TEST_F(JsonConfigLoaderUnitTest, testConfigString_FailNotString) { std::istringstream iss(R"( { "properties": [{ @@ -242,7 +270,7 @@ TEST_F(JsonConfigLoaderUnitTest, TestConfigString_FailNotString) { << "ConfigString is not a String must cause error"; } -TEST_F(JsonConfigLoaderUnitTest, TestCheckDefaultAccessChangeMode) { +TEST_F(JsonConfigLoaderUnitTest, testCheckDefaultAccessChangeMode) { std::istringstream iss(R"( { "properties": [{ @@ -257,12 +285,12 @@ TEST_F(JsonConfigLoaderUnitTest, TestCheckDefaultAccessChangeMode) { auto configs = result.value(); ASSERT_EQ(configs.size(), 1u); - const VehiclePropConfig& propConfig = configs[0].config; + const VehiclePropConfig& propConfig = configs.begin()->second.config; ASSERT_EQ(propConfig.access, VehiclePropertyAccess::READ); ASSERT_EQ(propConfig.changeMode, VehiclePropertyChangeMode::STATIC); } -TEST_F(JsonConfigLoaderUnitTest, TestAccessOverride) { +TEST_F(JsonConfigLoaderUnitTest, testAccessOverride) { std::istringstream iss(R"( { "properties": [{ @@ -278,12 +306,12 @@ TEST_F(JsonConfigLoaderUnitTest, TestAccessOverride) { auto configs = result.value(); ASSERT_EQ(configs.size(), 1u); - const VehiclePropConfig& propConfig = configs[0].config; + const VehiclePropConfig& propConfig = configs.begin()->second.config; ASSERT_EQ(propConfig.access, VehiclePropertyAccess::WRITE); ASSERT_EQ(propConfig.changeMode, VehiclePropertyChangeMode::STATIC); } -TEST_F(JsonConfigLoaderUnitTest, TestChangeModeOverride) { +TEST_F(JsonConfigLoaderUnitTest, testChangeModeOverride) { std::istringstream iss(R"( { "properties": [{ @@ -299,12 +327,12 @@ TEST_F(JsonConfigLoaderUnitTest, TestChangeModeOverride) { auto configs = result.value(); ASSERT_EQ(configs.size(), 1u); - const VehiclePropConfig& propConfig = configs[0].config; + const VehiclePropConfig& propConfig = configs.begin()->second.config; ASSERT_EQ(propConfig.access, VehiclePropertyAccess::READ); ASSERT_EQ(propConfig.changeMode, VehiclePropertyChangeMode::ON_CHANGE); } -TEST_F(JsonConfigLoaderUnitTest, TestCustomProp) { +TEST_F(JsonConfigLoaderUnitTest, testCustomProp) { std::istringstream iss(R"( { "properties": [{ @@ -321,12 +349,12 @@ TEST_F(JsonConfigLoaderUnitTest, TestCustomProp) { auto configs = result.value(); ASSERT_EQ(configs.size(), 1u); - const VehiclePropConfig& propConfig = configs[0].config; + const VehiclePropConfig& propConfig = configs.begin()->second.config; ASSERT_EQ(propConfig.access, VehiclePropertyAccess::WRITE); ASSERT_EQ(propConfig.changeMode, VehiclePropertyChangeMode::ON_CHANGE); } -TEST_F(JsonConfigLoaderUnitTest, TestCustomProp_FailMissingAccess) { +TEST_F(JsonConfigLoaderUnitTest, testCustomProp_FailMissingAccess) { std::istringstream iss(R"( { "properties": [{ @@ -340,7 +368,7 @@ TEST_F(JsonConfigLoaderUnitTest, TestCustomProp_FailMissingAccess) { << "Missing access for custom property must cause error"; } -TEST_F(JsonConfigLoaderUnitTest, TestCustomProp_FailMissingChangeMode) { +TEST_F(JsonConfigLoaderUnitTest, testCustomProp_FailMissingChangeMode) { std::istringstream iss(R"( { "properties": [{ @@ -354,7 +382,7 @@ TEST_F(JsonConfigLoaderUnitTest, TestCustomProp_FailMissingChangeMode) { << "Missing change mode for custom property must cause error"; } -TEST_F(JsonConfigLoaderUnitTest, TestMinSampleRate) { +TEST_F(JsonConfigLoaderUnitTest, testMinSampleRate) { std::istringstream iss(R"( { "properties": [{ @@ -370,10 +398,10 @@ TEST_F(JsonConfigLoaderUnitTest, TestMinSampleRate) { auto configs = result.value(); ASSERT_EQ(configs.size(), 1u); - ASSERT_EQ(configs[0].config.minSampleRate, 1); + ASSERT_EQ(configs.begin()->second.config.minSampleRate, 1); } -TEST_F(JsonConfigLoaderUnitTest, TestMinSampleRate_FailInvalidType) { +TEST_F(JsonConfigLoaderUnitTest, testMinSampleRate_FailInvalidType) { std::istringstream iss(R"( { "properties": [{ @@ -387,7 +415,7 @@ TEST_F(JsonConfigLoaderUnitTest, TestMinSampleRate_FailInvalidType) { << "Wrong type for MinSampleRate must cause error"; } -TEST_F(JsonConfigLoaderUnitTest, TestMaxSampleRate) { +TEST_F(JsonConfigLoaderUnitTest, testMaxSampleRate) { std::istringstream iss(R"( { "properties": [{ @@ -403,10 +431,10 @@ TEST_F(JsonConfigLoaderUnitTest, TestMaxSampleRate) { auto configs = result.value(); ASSERT_EQ(configs.size(), 1u); - ASSERT_EQ(configs[0].config.maxSampleRate, 1); + ASSERT_EQ(configs.begin()->second.config.maxSampleRate, 1); } -TEST_F(JsonConfigLoaderUnitTest, TestMaxSampleRate_FailInvalidType) { +TEST_F(JsonConfigLoaderUnitTest, testMaxSampleRate_FailInvalidType) { std::istringstream iss(R"( { "properties": [{ @@ -420,7 +448,7 @@ TEST_F(JsonConfigLoaderUnitTest, TestMaxSampleRate_FailInvalidType) { << "Wrong type for MaxSampleRate must cause error"; } -TEST_F(JsonConfigLoaderUnitTest, TestDefaultValue_Simple) { +TEST_F(JsonConfigLoaderUnitTest, testDefaultValue_Simple) { std::istringstream iss(R"( { "properties": [{ @@ -438,10 +466,10 @@ TEST_F(JsonConfigLoaderUnitTest, TestDefaultValue_Simple) { auto configs = result.value(); ASSERT_EQ(configs.size(), 1u); - ASSERT_EQ(configs[0].initialValue.int32Values, std::vector({1, 2})); + ASSERT_EQ(configs.begin()->second.initialValue.int32Values, std::vector({1, 2})); } -TEST_F(JsonConfigLoaderUnitTest, TestDefaultValue_Mixed) { +TEST_F(JsonConfigLoaderUnitTest, testDefaultValue_Mixed) { std::istringstream iss(R"( { "properties": [{ @@ -463,7 +491,7 @@ TEST_F(JsonConfigLoaderUnitTest, TestDefaultValue_Mixed) { auto configs = result.value(); ASSERT_EQ(configs.size(), 1u); - const RawPropValues& initialValue = configs[0].initialValue; + const RawPropValues& initialValue = configs.begin()->second.initialValue; ASSERT_EQ(initialValue.int32Values, std::vector({1, FUEL_DOOR_REAR_LEFT})); ASSERT_EQ(initialValue.int64Values, std::vector({2, static_cast(FUEL_DOOR_REAR_LEFT)})); @@ -472,7 +500,7 @@ TEST_F(JsonConfigLoaderUnitTest, TestDefaultValue_Mixed) { ASSERT_EQ(initialValue.stringValue, "abcd"); } -TEST_F(JsonConfigLoaderUnitTest, TestDefaultValue_FailNotObject) { +TEST_F(JsonConfigLoaderUnitTest, testDefaultValue_FailNotObject) { std::istringstream iss(R"( { "properties": [{ @@ -486,7 +514,7 @@ TEST_F(JsonConfigLoaderUnitTest, TestDefaultValue_FailNotObject) { << "DefaultValue is not an object must cause error"; } -TEST_F(JsonConfigLoaderUnitTest, TestDefaultValue_FailInvalidType) { +TEST_F(JsonConfigLoaderUnitTest, testDefaultValue_FailInvalidType) { std::istringstream iss(R"( { "properties": [{ @@ -521,7 +549,7 @@ TEST_F(JsonConfigLoaderUnitTest, testAreas_Simple) { auto configs = result.value(); ASSERT_EQ(configs.size(), 1u); - const VehiclePropConfig& config = configs[0].config; + const VehiclePropConfig& config = configs.begin()->second.config; ASSERT_EQ(config.areaConfigs.size(), 1u); const VehicleAreaConfig& areaConfig = config.areaConfigs[0]; ASSERT_EQ(areaConfig.minInt32Value, 1); @@ -554,12 +582,14 @@ TEST_F(JsonConfigLoaderUnitTest, testAreas_DefaultValueForEachArea) { auto configs = result.value(); ASSERT_EQ(configs.size(), 1u); - const VehiclePropConfig& config = configs[0].config; + const VehiclePropConfig& config = configs.begin()->second.config; ASSERT_EQ(config.areaConfigs.size(), 2u); ASSERT_EQ(config.areaConfigs[0].areaId, HVAC_LEFT); ASSERT_EQ(config.areaConfigs[1].areaId, HVAC_RIGHT); - ASSERT_EQ(configs[0].initialAreaValues[HVAC_LEFT], RawPropValues{.int32Values = {1}}); - ASSERT_EQ(configs[0].initialAreaValues[HVAC_RIGHT], RawPropValues{.int32Values = {2}}); + ASSERT_EQ(configs.begin()->second.initialAreaValues[HVAC_LEFT], + RawPropValues{.int32Values = {1}}); + ASSERT_EQ(configs.begin()->second.initialAreaValues[HVAC_RIGHT], + RawPropValues{.int32Values = {2}}); } TEST_F(JsonConfigLoaderUnitTest, testAreas_FailInvalidTypeForOneAreaValue) { diff --git a/automotive/vehicle/aidl/impl/default_config/config/Android.bp b/automotive/vehicle/aidl/impl/default_config/config/Android.bp index c5f86c201f..8f1c7d1a8e 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/Android.bp +++ b/automotive/vehicle/aidl/impl/default_config/config/Android.bp @@ -21,3 +21,27 @@ filegroup { name: "VehicleHalVendorClusterTestProperties_JSON", srcs: ["VendorClusterTestProperties.json"], } + +prebuilt_etc { + name: "Prebuilt_VehicleHalDefaultProperties_JSON", + filename_from_src: true, + src: "DefaultProperties.json", + sub_dir: "automotive/vhalconfig/", + vendor: true, +} + +prebuilt_etc { + name: "Prebuilt_VehicleHalTestProperties_JSON", + filename_from_src: true, + src: "TestProperties.json", + sub_dir: "automotive/vhalconfig/", + vendor: true, +} + +prebuilt_etc { + name: "Prebuilt_VehicleHalVendorClusterTestProperties_JSON", + filename_from_src: true, + src: "VendorClusterTestProperties.json", + sub_dir: "automotive/vhalconfig/", + vendor: true, +} diff --git a/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp b/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp index b16ea144e2..f0ab80643c 100644 --- a/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp +++ b/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp @@ -21,6 +21,7 @@ #include #include #include +#include namespace android { namespace hardware { @@ -45,7 +46,8 @@ std::string getTestFilePath(const char* filename) { return baseDir + "/" + filename; } -Result> loadConfig(JsonConfigLoader& loader, const char* path) { +Result> loadConfig(JsonConfigLoader& loader, + const char* path) { std::string configPath = getTestFilePath(path); std::ifstream ifs(configPath.c_str()); if (!ifs) { @@ -89,7 +91,9 @@ TEST(DefaultConfigTest, TestCompatibleWithDefaultConfigHeader) { kVendorClusterTestPropertiesConfigFile})) { auto result = loadConfig(loader, file); ASSERT_TRUE(result.ok()) << result.error().message(); - configsFromJson.insert(configsFromJson.end(), result.value().begin(), result.value().end()); + for (auto& [propId, configDeclaration] : result.value()) { + configsFromJson.push_back(configDeclaration); + } } ASSERT_EQ(configsFromHeaderFile.size(), configsFromJson.size()); diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp index dcd9208cab..4c17cded42 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/Android.bp @@ -24,6 +24,7 @@ cc_library { srcs: ["src/*.cpp"], local_include_dirs: ["include"], export_include_dirs: ["include"], + cflags: ["-DENABLE_VEHICLE_HAL_TEST_PROPERTIES"], defaults: [ "VehicleHalDefaults", "FakeVehicleHardwareDefaults", @@ -32,18 +33,23 @@ cc_library { cc_defaults { name: "FakeVehicleHardwareDefaults", - cflags: ["-DENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING"], header_libs: [ "IVehicleHardware", - "VehicleHalDefaultConfig", + "VehicleHalTestUtilHeaders", ], export_header_lib_headers: ["IVehicleHardware"], static_libs: [ + "VehicleHalJsonConfigLoaderEnableTestProperties", "VehicleHalUtils", "FakeVehicleHalValueGenerators", "FakeObd2Frame", "FakeUserHal", ], + required: [ + "Prebuilt_VehicleHalDefaultProperties_JSON", + "Prebuilt_VehicleHalTestProperties_JSON", + "Prebuilt_VehicleHalVendorClusterTestProperties_JSON", + ], shared_libs: [ "libjsoncpp", ], diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h index 9091feec00..1636cb6cd0 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h @@ -18,11 +18,12 @@ #define android_hardware_automotive_vehicle_aidl_impl_fake_impl_hardware_include_FakeVehicleHardware_H_ #include -#include +#include #include #include #include #include +#include #include #include #include @@ -32,9 +33,9 @@ #include #include -#include #include #include +#include #include namespace android { @@ -49,7 +50,8 @@ class FakeVehicleHardware : public IVehicleHardware { FakeVehicleHardware(); - explicit FakeVehicleHardware(std::unique_ptr valuePool); + FakeVehicleHardware(std::string defaultConfigDir, std::string overrideConfigDir, + bool forceOverride); ~FakeVehicleHardware(); @@ -151,17 +153,23 @@ class FakeVehicleHardware : public IVehicleHardware { aidl::android::hardware::automotive::vehicle::SetValueRequest> mPendingSetValueRequests; + const std::string mDefaultConfigDir; + const std::string mOverrideConfigDir; + const bool mForceOverride; + + // Only used during initialization. + JsonConfigLoader mLoader; + void init(); // Stores the initial value to property store. void storePropInitialValue(const ConfigDeclaration& config); // The callback that would be called when a vehicle property value change happens. void onValueChangeCallback( const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value); - // If property "persist.vendor.vhal_init_value_override" is set to true, override the properties - // using config files in 'overrideDir'. - void maybeOverrideProperties(const char* overrideDir); - // Override the properties using config files in 'overrideDir'. - void overrideProperties(const char* overrideDir); + // Load the config files in format '*.json' from the directory and parse the config files + // into a map from property ID to ConfigDeclarations. + void loadPropConfigsFromDir(const std::string& dirPath, + std::unordered_map* configs); // Function to be called when a value change event comes from vehicle bus. In our fake // implementation, this function is only called during "--inject-event" dump command. void eventFromVehicleBus( @@ -185,6 +193,8 @@ class FakeVehicleHardware : public IVehicleHardware { const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const; bool isHvacPropAndHvacNotAvailable(int32_t propId); + std::unordered_map loadConfigDeclarations(); + std::string dumpAllProperties(); std::string dumpOnePropertyByConfig( int rowNumber, diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index c6ec85debd..d87e5aaaef 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -19,7 +19,6 @@ #include "FakeVehicleHardware.h" -#include #include #include #include @@ -27,6 +26,8 @@ #include #include #include + +#include #include #include #include @@ -74,9 +75,16 @@ using ::android::base::ScopedLockAssertion; using ::android::base::StartsWith; using ::android::base::StringPrintf; -const char* VENDOR_OVERRIDE_DIR = "/vendor/etc/automotive/vhaloverride/"; -const char* OVERRIDE_PROPERTY = "persist.vendor.vhal_init_value_override"; -const char* POWER_STATE_REQ_CONFIG_PROPERTY = "ro.vendor.fake_vhal.ap_power_state_req.config"; +// The directory for default property configuration file. +// For config file format, see impl/default_config/config/README.md. +constexpr char DEFAULT_CONFIG_DIR[] = "/vendor/etc/automotive/vhalconfig/"; +// The directory for property configuration file that overrides the default configuration file. +// For config file format, see impl/default_config/config/README.md. +constexpr char OVERRIDE_CONFIG_DIR[] = "/vendor/etc/automotive/vhaloverride/"; +// If OVERRIDE_PROPERTY is set, we will use the configuration files from OVERRIDE_CONFIG_DIR to +// overwrite the default configs. +constexpr char OVERRIDE_PROPERTY[] = "persist.vendor.vhal_init_value_override"; +constexpr char POWER_STATE_REQ_CONFIG_PROPERTY[] = "ro.vendor.fake_vhal.ap_power_state_req.config"; // A list of supported options for "--set" command. const std::unordered_set SET_PROP_OPTIONS = { @@ -139,10 +147,11 @@ void FakeVehicleHardware::storePropInitialValue(const ConfigDeclaration& config) } FakeVehicleHardware::FakeVehicleHardware() - : FakeVehicleHardware(std::make_unique()) {} + : FakeVehicleHardware(DEFAULT_CONFIG_DIR, OVERRIDE_CONFIG_DIR, false) {} -FakeVehicleHardware::FakeVehicleHardware(std::unique_ptr valuePool) - : mValuePool(std::move(valuePool)), +FakeVehicleHardware::FakeVehicleHardware(std::string defaultConfigDir, + std::string overrideConfigDir, bool forceOverride) + : mValuePool(std::make_unique()), mServerSidePropStore(new VehiclePropertyStore(mValuePool)), mFakeObd2Frame(new obd2frame::FakeObd2Frame(mServerSidePropStore)), mFakeUserHal(new FakeUserHal(mValuePool)), @@ -150,7 +159,10 @@ FakeVehicleHardware::FakeVehicleHardware(std::unique_ptr v mGeneratorHub(new GeneratorHub( [this](const VehiclePropValue& value) { eventFromVehicleBus(value); })), mPendingGetValueRequests(this), - mPendingSetValueRequests(this) { + mPendingSetValueRequests(this), + mDefaultConfigDir(defaultConfigDir), + mOverrideConfigDir(overrideConfigDir), + mForceOverride(forceOverride) { init(); } @@ -160,9 +172,19 @@ FakeVehicleHardware::~FakeVehicleHardware() { mGeneratorHub.reset(); } +std::unordered_map FakeVehicleHardware::loadConfigDeclarations() { + std::unordered_map configsByPropId; + loadPropConfigsFromDir(mDefaultConfigDir, &configsByPropId); + if (mForceOverride || + android::base::GetBoolProperty(OVERRIDE_PROPERTY, /*default_value=*/false)) { + loadPropConfigsFromDir(mOverrideConfigDir, &configsByPropId); + } + return configsByPropId; +} + void FakeVehicleHardware::init() { - for (auto& it : defaultconfig::getDefaultConfigs()) { - VehiclePropConfig cfg = it.config; + for (auto& [_, configDeclaration] : loadConfigDeclarations()) { + VehiclePropConfig cfg = configDeclaration.config; VehiclePropertyStore::TokenFunction tokenFunction = nullptr; if (cfg.prop == toInt(VehicleProperty::AP_POWER_STATE_REQ)) { @@ -178,15 +200,18 @@ void FakeVehicleHardware::init() { // logic. continue; } - storePropInitialValue(it); + storePropInitialValue(configDeclaration); } - maybeOverrideProperties(VENDOR_OVERRIDE_DIR); - // OBD2_LIVE_FRAME and OBD2_FREEZE_FRAME must be configured in default configs. - mFakeObd2Frame->initObd2LiveFrame(*mServerSidePropStore->getConfig(OBD2_LIVE_FRAME).value()); - mFakeObd2Frame->initObd2FreezeFrame( - *mServerSidePropStore->getConfig(OBD2_FREEZE_FRAME).value()); + auto maybeObd2LiveFrame = mServerSidePropStore->getConfig(OBD2_LIVE_FRAME); + if (maybeObd2LiveFrame.has_value()) { + mFakeObd2Frame->initObd2LiveFrame(*maybeObd2LiveFrame.value()); + } + auto maybeObd2FreezeFrame = mServerSidePropStore->getConfig(OBD2_FREEZE_FRAME); + if (maybeObd2FreezeFrame.has_value()) { + mFakeObd2Frame->initObd2FreezeFrame(*maybeObd2FreezeFrame.value()); + } mServerSidePropStore->setOnValueChangeCallback( [this](const VehiclePropValue& value) { return onValueChangeCallback(value); }); @@ -408,7 +433,7 @@ VhalResult FakeVehicleHardware::maybeSetSpecialValue(const VehiclePropValu *isSpecialValue = true; return mFakeObd2Frame->clearObd2FreezeFrames(value); -#ifdef ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING +#ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES case toInt(VehicleProperty::CLUSTER_REPORT_STATE): [[fallthrough]]; case toInt(VehicleProperty::CLUSTER_REQUEST_DISPLAY): @@ -436,7 +461,7 @@ VhalResult FakeVehicleHardware::maybeSetSpecialValue(const VehiclePropValu << getErrorMsg(writeResult); } return {}; -#endif // ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING +#endif // ENABLE_VEHICLE_HAL_TEST_PROPERTIES default: break; @@ -1264,33 +1289,26 @@ void FakeVehicleHardware::onValueChangeCallback(const VehiclePropValue& value) { (*mOnPropertyChangeCallback)(std::move(updatedValues)); } -void FakeVehicleHardware::maybeOverrideProperties(const char* overrideDir) { - if (android::base::GetBoolProperty(OVERRIDE_PROPERTY, false)) { - overrideProperties(overrideDir); - } -} - -void FakeVehicleHardware::overrideProperties(const char* overrideDir) { - ALOGI("loading vendor override properties from %s", overrideDir); - if (auto dir = opendir(overrideDir); dir != NULL) { +void FakeVehicleHardware::loadPropConfigsFromDir( + const std::string& dirPath, + std::unordered_map* configsByPropId) { + ALOGI("loading properties from %s", dirPath.c_str()); + if (auto dir = opendir(dirPath.c_str()); dir != NULL) { std::regex regJson(".*[.]json", std::regex::icase); while (auto f = readdir(dir)) { if (!std::regex_match(f->d_name, regJson)) { continue; } - std::string file = overrideDir + std::string(f->d_name); - JsonFakeValueGenerator tmpGenerator(file); - - std::vector propValues = tmpGenerator.getAllEvents(); - for (const VehiclePropValue& prop : propValues) { - auto propToStore = mValuePool->obtain(prop); - propToStore->timestamp = elapsedRealtimeNano(); - if (auto result = mServerSidePropStore->writeValue(std::move(propToStore), - /*updateStatus=*/true); - !result.ok()) { - ALOGW("failed to write vendor override properties: %d, error: %s, code: %d", - prop.prop, getErrorMsg(result).c_str(), getIntErrorCode(result)); - } + std::string filePath = dirPath + "/" + std::string(f->d_name); + ALOGI("loading properties from %s", filePath.c_str()); + auto result = mLoader.loadPropConfig(filePath); + if (!result.ok()) { + ALOGE("failed to load config file: %s, error: %s", filePath.c_str(), + result.error().message().c_str()); + continue; + } + for (auto& [propId, configDeclaration] : result.value()) { + (*configsByPropId)[propId] = std::move(configDeclaration); } } closedir(dir); diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp index cfd65770dc..8d8fcf5908 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp @@ -22,13 +22,13 @@ cc_test { name: "FakeVehicleHardwareTest", vendor: true, srcs: ["*.cpp"], - cflags: ["-DENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING"], + cflags: ["-DENABLE_VEHICLE_HAL_TEST_PROPERTIES"], header_libs: [ "IVehicleHardware", - "VehicleHalDefaultConfig", "VehicleHalTestUtilHeaders", ], static_libs: [ + "VehicleHalJsonConfigLoaderEnableTestProperties", "VehicleHalUtils", "FakeVehicleHardware", "FakeVehicleHalValueGenerators", @@ -41,6 +41,9 @@ cc_test { "libjsoncpp", ], data: [ + ":VehicleHalDefaultProperties_JSON", + ":VehicleHalTestProperties_JSON", + ":VehicleHalVendorClusterTestProperties_JSON", ":FakeVehicleHardwareTestOverrideJson", ":FakeVehicleHardwareTestPropJson", ], @@ -55,5 +58,5 @@ filegroup { filegroup { name: "FakeVehicleHardwareTestPropJson", - srcs: ["prop.json"], + srcs: ["fakedata/prop.json"], } diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp index ab6bf51000..c230c51cd0 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp @@ -16,7 +16,6 @@ #include -#include #include #include #include @@ -80,7 +79,9 @@ class FakeVehicleHardwareTestHelper { public: FakeVehicleHardwareTestHelper(FakeVehicleHardware* hardware) { mHardware = hardware; } - void overrideProperties(const char* overrideDir) { mHardware->overrideProperties(overrideDir); } + std::unordered_map loadConfigDeclarations() { + return mHardware->loadConfigDeclarations(); + } private: FakeVehicleHardware* mHardware; @@ -89,7 +90,9 @@ class FakeVehicleHardwareTestHelper { class FakeVehicleHardwareTest : public ::testing::Test { protected: void SetUp() override { - mHardware = std::make_unique(); + mHardware = std::make_unique(android::base::GetExecutableDirectory(), + /*overrideConfigDir=*/"", + /*forceOverride=*/false); auto callback = std::make_unique( [this](const std::vector& values) { onPropertyChangeEvent(values); @@ -109,6 +112,10 @@ class FakeVehicleHardwareTest : public ::testing::Test { FakeVehicleHardware* getHardware() { return mHardware.get(); } + void setHardware(std::unique_ptr hardware) { + mHardware = std::move(hardware); + } + StatusCode setValues(const std::vector& requests) { { std::scoped_lock lockGuard(mLock); @@ -374,7 +381,8 @@ class FakeVehicleHardwareTest : public ::testing::Test { TEST_F(FakeVehicleHardwareTest, testGetAllPropertyConfigs) { std::vector configs = getHardware()->getAllPropertyConfigs(); - ASSERT_EQ(configs.size(), defaultconfig::getDefaultConfigs().size()); + FakeVehicleHardwareTestHelper helper(getHardware()); + ASSERT_EQ(configs.size(), helper.loadConfigDeclarations().size()); } TEST_F(FakeVehicleHardwareTest, testGetDefaultValues) { @@ -382,7 +390,8 @@ TEST_F(FakeVehicleHardwareTest, testGetDefaultValues) { std::vector expectedGetValueResults; int64_t requestId = 1; - for (auto& config : defaultconfig::getDefaultConfigs()) { + FakeVehicleHardwareTestHelper helper(getHardware()); + for (auto& [propId, config] : helper.loadConfigDeclarations()) { if (obd2frame::FakeObd2Frame::isDiagnosticProperty(config.config)) { // Ignore storing default value for diagnostic property. They have special get/set // logic. @@ -394,12 +403,11 @@ TEST_F(FakeVehicleHardwareTest, testGetDefaultValues) { continue; } - if (config.config.prop == ECHO_REVERSE_BYTES) { + if (propId == ECHO_REVERSE_BYTES) { // Ignore ECHO_REVERSE_BYTES, it has special logic. continue; } - int propId = config.config.prop; if (isGlobalProp(propId)) { if (config.initialValue == RawPropValues{}) { addGetValueRequest(getValueRequests, expectedGetValueResults, requestId++, @@ -657,10 +665,12 @@ TEST_F(FakeVehicleHardwareTest, testSetStatusMustIgnore) { } TEST_F(FakeVehicleHardwareTest, testVendorOverrideProperties) { - std::string overrideDir = android::base::GetExecutableDirectory() + "/override/"; + std::string currentDir = android::base::GetExecutableDirectory(); + std::string overrideDir = currentDir + "/override/"; // Set vendor override directory. - FakeVehicleHardwareTestHelper helper(getHardware()); - helper.overrideProperties(overrideDir.c_str()); + std::unique_ptr hardware = + std::make_unique(currentDir, overrideDir, /*forceOverride=*/true); + setHardware(std::move(hardware)); // This is the same as the prop in 'gear_selection.json'. int gearProp = toInt(VehicleProperty::GEAR_SELECTION); @@ -695,10 +705,12 @@ TEST_F(FakeVehicleHardwareTest, testVendorOverrideProperties) { } TEST_F(FakeVehicleHardwareTest, testVendorOverridePropertiesMultipleAreas) { - std::string overrideDir = android::base::GetExecutableDirectory() + "/override/"; + std::string currentDir = android::base::GetExecutableDirectory(); + std::string overrideDir = currentDir + "/override/"; // Set vendor override directory. - FakeVehicleHardwareTestHelper helper(getHardware()); - helper.overrideProperties(overrideDir.c_str()); + std::unique_ptr hardware = + std::make_unique(currentDir, overrideDir, /*forceOverride=*/true); + setHardware(std::move(hardware)); // This is the same as the prop in 'hvac_temperature_set.json'. int hvacProp = toInt(VehicleProperty::HVAC_TEMPERATURE_SET); @@ -711,22 +723,16 @@ TEST_F(FakeVehicleHardwareTest, testVendorOverridePropertiesMultipleAreas) { ASSERT_TRUE(result.ok()) << "expect to get the overridden property ok: " << getStatus(result); ASSERT_EQ(static_cast(1), result.value().value.floatValues.size()); ASSERT_EQ(30.0f, result.value().value.floatValues[0]); - - // HVAC_RIGHT should not be affected and return the default value. - result = getValue(VehiclePropValue{ - .prop = hvacProp, - .areaId = HVAC_RIGHT, - }); - - ASSERT_TRUE(result.ok()) << "expect to get the default property ok: " << getStatus(result); - ASSERT_EQ(static_cast(1), result.value().value.floatValues.size()); - ASSERT_EQ(20.0f, result.value().value.floatValues[0]); } TEST_F(FakeVehicleHardwareTest, testVendorOverridePropertiesDirDoesNotExist) { - // Set vendor override directory to a non-existing dir - FakeVehicleHardwareTestHelper helper(getHardware()); - helper.overrideProperties("123"); + std::string currentDir = android::base::GetExecutableDirectory(); + std::string overrideDir = currentDir + "/override/"; + // Set vendor override directory to a non-existing dir. + std::unique_ptr hardware = + std::make_unique(currentDir, "1234", /*forceOverride=*/true); + setHardware(std::move(hardware)); + auto result = getValue(VehiclePropValue{ .prop = toInt(VehicleProperty::GEAR_SELECTION), }); @@ -1840,7 +1846,7 @@ TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataLinear) { std::string getTestFilePath(const char* filename) { static std::string baseDir = android::base::GetExecutableDirectory(); - return baseDir + "/" + filename; + return baseDir + "/fakedata/" + filename; } TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataJson) { diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/prop.json b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/fakedata/prop.json similarity index 100% rename from automotive/vehicle/aidl/impl/fake_impl/hardware/test/prop.json rename to automotive/vehicle/aidl/impl/fake_impl/hardware/test/fakedata/prop.json diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/override/gear_selection.json b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/override/gear_selection.json index 59666b8046..693f1e2ae5 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/override/gear_selection.json +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/override/gear_selection.json @@ -1,9 +1,13 @@ -[ - { - "timestamp": 1000000, - "areaId": 0, - "value": 8, - // GEAR_SELECTION - "prop": 289408000 - } -] +{ + "apiVersion": 1, + "properties": [ + { + "property": "VehicleProperty::GEAR_SELECTION", + "defaultValue": { + "int32Values": [ + 8 + ] + } + } + ] +} diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/override/hvac_temperature_set.json b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/override/hvac_temperature_set.json index 93a97ed095..07cfebba10 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/override/hvac_temperature_set.json +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/override/hvac_temperature_set.json @@ -1,10 +1,20 @@ -[ - { - "timestamp": 1000000, - // HVAC_LEFT - "areaId": 49, - "value": 30, - // HVAC_TEMPERATURE_SET - "prop": 358614275 - } -] +{ + "apiVersion": 1, + "properties": [ + { + "property": "VehicleProperty::HVAC_TEMPERATURE_SET", + "areas": [ + { + "defaultValue": { + "floatValues": [ + 30.0 + ] + }, + "areaId": 49, + "minFloatValue": 16.0, + "maxFloatValue": 32.0 + } + ] + } + ] +} diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp index 7670c25418..c36833455a 100644 --- a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp +++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp @@ -47,13 +47,20 @@ cc_test { ], vendor: true, defaults: ["VehicleHalDefaults"], - shared_libs: ["libprotobuf-cpp-full"], + shared_libs: [ + "libprotobuf-cpp-full", + "libjsoncpp", + ], static_libs: [ + "VehicleHalJsonConfigLoaderEnableTestProperties", "VehicleHalProtoMessageConverter", "VehicleHalProtos", "VehicleHalUtils", "libgtest", ], + data: [ + ":VehicleHalDefaultProperties_JSON", + ], header_libs: ["VehicleHalDefaultConfig"], test_suites: ["device-tests"], } diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/test/proto_message_converter_test.cpp b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/test/proto_message_converter_test.cpp index c742db51f5..308be4601a 100644 --- a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/test/proto_message_converter_test.cpp +++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/test/proto_message_converter_test.cpp @@ -16,9 +16,11 @@ #include -#include +#include #include #include + +#include #include #include #include @@ -35,23 +37,39 @@ namespace { namespace proto = ::android::hardware::automotive::vehicle::proto; namespace aidl_vehicle = ::aidl::android::hardware::automotive::vehicle; +constexpr char DEFAULT_PROPERTIES_CONFIG[] = "DefaultProperties.json"; + +inline std::string getConfigPath(const std::string& name) { + return android::base::GetExecutableDirectory() + "/" + name; +} + std::vector prepareTestConfigs() { + JsonConfigLoader loader; + auto result = loader.loadPropConfig(getConfigPath(DEFAULT_PROPERTIES_CONFIG)); + if (!result.ok()) { + return {}; + } std::vector configs; - for (auto& property : defaultconfig::getDefaultConfigs()) { - configs.push_back(property.config); + for (auto& [_, configDeclaration] : result.value()) { + configs.push_back(configDeclaration.config); } return configs; } std::vector prepareTestValues() { + JsonConfigLoader loader; + auto result = loader.loadPropConfig(getConfigPath(DEFAULT_PROPERTIES_CONFIG)); + if (!result.ok()) { + return {}; + } std::vector values; int64_t timestamp = 1; - for (auto& property : defaultconfig::getDefaultConfigs()) { + for (auto& [_, configDeclaration] : result.value()) { values.push_back({ .timestamp = timestamp, .areaId = 123, - .prop = property.config.prop, - .value = property.initialValue, + .prop = configDeclaration.config.prop, + .value = configDeclaration.initialValue, .status = aidl_vehicle::VehiclePropertyStatus::ERROR, }); } diff --git a/automotive/vehicle/aidl/impl/vhal/Android.bp b/automotive/vehicle/aidl/impl/vhal/Android.bp index 8b4f559348..6fec2c979c 100644 --- a/automotive/vehicle/aidl/impl/vhal/Android.bp +++ b/automotive/vehicle/aidl/impl/vhal/Android.bp @@ -75,10 +75,6 @@ cc_fuzz { "VehicleHalDefaults", "android-automotive-large-parcelable-defaults", ], - header_libs: [ - "IVehicleHardware", - "VehicleHalDefaultConfig", - ], static_libs: [ "DefaultVehicleHal", "FakeVehicleHardware", From edc438b3632b7d460891f169f68bc21ecac47811 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 29 Jul 2022 22:24:03 +0000 Subject: [PATCH 184/998] Remove automotive.vehicle HIDL entry in compat matrix. This interface has been converted to AIDL. Test: TH Bug: 218588089 Change-Id: I04af2db10ee4afbd5cd128a4bbb60ff603cd62d2 --- compatibility_matrices/compatibility_matrix.current.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index ba6453d3a2..c9cb4326bf 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -104,14 +104,6 @@ .* - - android.hardware.automotive.vehicle - 2.0 - - IVehicle - .* - - android.hardware.biometrics.face 2 From 8492dab99d59d4a4f171afe295149020759a10ca Mon Sep 17 00:00:00 2001 From: Arthur Ishiguro Date: Thu, 4 Aug 2022 15:25:51 +0000 Subject: [PATCH 185/998] Adds AndroidTest.xml for AIDL sensors VTS test Bug: 241174366 Test: run VtsAidlHalSensorsTargetTest, and verify Android app can receive sensor data after test runs Change-Id: Ie372f74f3a52decce592181c7d65624f8ec03ed1 --- sensors/aidl/vts/AndroidTest.xml | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 sensors/aidl/vts/AndroidTest.xml diff --git a/sensors/aidl/vts/AndroidTest.xml b/sensors/aidl/vts/AndroidTest.xml new file mode 100644 index 0000000000..99caf28422 --- /dev/null +++ b/sensors/aidl/vts/AndroidTest.xml @@ -0,0 +1,34 @@ + + + + From 714e959c8934fd6ce04f01cebc9e9b95d79c9f27 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Thu, 4 Aug 2022 17:20:27 +0000 Subject: [PATCH 186/998] audio: Use 'sdk_version' instead of 'platform_apis' Replace 'platform_apis: true' with 'sdk_version: module_current'. The former causes compiling against SDK source code, this is not needed for the audio HAL. Bug: 205884982 Test: m android.hardware.audio.service-aidl.example Change-Id: I9b9c32707ac7276f5cd077681bd1f8122bc20feb --- audio/aidl/Android.bp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index 7db50d5ca5..ebf59134b2 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -88,7 +88,7 @@ aidl_interface { enabled: false, }, java: { - platform_apis: true, + sdk_version: "module_current", }, }, } From 14aa8484b72a3e5ba5ae5e302264d2fb0ad17a2d Mon Sep 17 00:00:00 2001 From: Frankie Lizcano Date: Tue, 26 Jul 2022 16:50:35 +0000 Subject: [PATCH 187/998] Tuner VTS: Pair Audio and Video Filters This CL enforces the invariant that vendors provide audio and video filters in pairs to the Tuner Hal VTS. Thus, the number of each must be equal. If they do not, the tests are not ran, and the test suite exits. Additionally, this CL enforces the assupmtion that vendors will pair their audio and video filters in the order they are provided, and it treats the audioFilterIds and videoFilterIds vectors as 2 parallel structures, where members at the same indicies correspond to a pair. This is how media filter pairs are chosen when configuring them in the VTS testing combinations. Bug: b/182519645 Test: vts-tradefed run vts --module VtsHalTvTunerTargetTest. Manual tests with different input configuration files. Change-Id: I74cc059ed610bb08d0929f250f252a16c9f954a8 --- .../vts/functional/VtsHalTvTunerTargetTest.h | 8 +-- .../VtsHalTvTunerTestConfigurations.h | 51 +++++++++++-------- 2 files changed, 33 insertions(+), 26 deletions(-) diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h index 2e69821482..e40540d997 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h @@ -153,7 +153,7 @@ class TunerFilterAidlTest : public testing::TestWithParam { mService = nullptr; } ASSERT_NE(mService, nullptr); - initConfiguration(); + ASSERT_TRUE(initConfiguration()); mFrontendTests.setService(mService); mDemuxTests.setService(mService); @@ -264,7 +264,7 @@ class TunerRecordAidlTest : public testing::TestWithParam { mService = nullptr; } ASSERT_NE(mService, nullptr); - initConfiguration(); + ASSERT_TRUE(initConfiguration()); mFrontendTests.setService(mService); mDemuxTests.setService(mService); @@ -313,7 +313,7 @@ class TunerFrontendAidlTest : public testing::TestWithParam { mService = nullptr; } ASSERT_NE(mService, nullptr); - initConfiguration(); + ASSERT_TRUE(initConfiguration()); mFrontendTests.setService(mService); } @@ -344,7 +344,7 @@ class TunerBroadcastAidlTest : public testing::TestWithParam { mService = nullptr; } ASSERT_NE(mService, nullptr); - initConfiguration(); + ASSERT_TRUE(initConfiguration()); mFrontendTests.setService(mService); mDemuxTests.setService(mService); diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h index de12dc0efa..ddc36a8c40 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h @@ -131,28 +131,28 @@ inline vector> generateIdCombinations(vector>& ids /* * index 0 - playback dvr * index 1 - audio filters - * index 2 - video filters - * index 3 - optional section filters + * index 2 - optional section filters */ static inline vector generatePlaybackCombinations() { vector combinations; vector sectionFilterIds_optional = sectionFilterIds; sectionFilterIds_optional.push_back(emptyHardwareId); - vector> deviceIds{playbackDvrIds, audioFilterIds, videoFilterIds, - sectionFilterIds_optional}; + vector> deviceIds{playbackDvrIds, audioFilterIds, sectionFilterIds_optional}; const int dvrIndex = 0; const int audioFilterIndex = 1; - const int videoFilterIndex = 2; - const int sectionFilterIndex = 3; + const int sectionFilterIndex = 2; auto idCombinations = generateIdCombinations(deviceIds); for (auto& combo : idCombinations) { DvrPlaybackHardwareConnections mPlayback; mPlayback.dvrId = combo[dvrIndex]; mPlayback.audioFilterId = combo[audioFilterIndex]; - mPlayback.videoFilterId = combo[videoFilterIndex]; mPlayback.sectionFilterId = combo[sectionFilterIndex]; + const int videoFilterIndex = + find(audioFilterIds.begin(), audioFilterIds.end(), mPlayback.audioFilterId) - + audioFilterIds.begin(); + mPlayback.videoFilterId = videoFilterIds[videoFilterIndex]; combinations.push_back(mPlayback); } @@ -176,17 +176,15 @@ static inline vector generatePlaybackConfigs() { /* * index 0 - frontends * index 1 - audio filters - * index 2 - video filters - * index 3 - lnbs + * index 2 - lnbs */ static inline vector generateLnbLiveCombinations() { vector combinations; - vector> deviceIds{frontendIds, audioFilterIds, videoFilterIds, lnbIds}; + vector> deviceIds{frontendIds, audioFilterIds, lnbIds}; const int frontendIndex = 0; const int audioFilterIndex = 1; - const int videoFilterIndex = 2; - const int lnbIndex = 3; + const int lnbIndex = 2; // TODO: Find a better way to vary diseqcMsgs, if at all auto idCombinations = generateIdCombinations(deviceIds); @@ -198,7 +196,10 @@ static inline vector generateLnbLiveCombinations() { LnbLiveHardwareConnections mLnbLive; mLnbLive.frontendId = feId; mLnbLive.audioFilterId = combo[audioFilterIndex]; - mLnbLive.videoFilterId = combo[videoFilterIndex]; + const int videoFilterIndex = + find(audioFilterIds.begin(), audioFilterIds.end(), mLnbLive.audioFilterId) - + audioFilterIds.begin(); + mLnbLive.videoFilterId = videoFilterIds[videoFilterIndex]; mLnbLive.lnbId = combo[lnbIndex]; mLnbLive.diseqcMsgs = diseqcMsgs; combinations.push_back(mLnbLive); @@ -301,9 +302,8 @@ static inline vector generateLnbRecordConfiguratio * index 0 - decramblers * index 1 - frontends * index 2 - audio filters - * index 3 - video filters - * index 4 - Dvr SW Fe Connections - * index 5 - DVR Source Connections + * index 3 - Dvr SW Fe Connections + * index 4 - DVR Source Connections */ static inline vector generateDescramblingCombinations() { vector combinations; @@ -320,12 +320,11 @@ static inline vector generateDescramblingCombin const int descramblerIndex = 0; const int frontendIndex = 1; const int audioFilterIndex = 2; - const int videoFilterIndex = 3; - const int dvrFeIdIndex = 4; - const int dvrSourceIdIndex = 5; + const int dvrFeIdIndex = 3; + const int dvrSourceIdIndex = 4; - vector> deviceIds{descramblerIds, mfrontendIds, audioFilterIds, - videoFilterIds, mDvrFeConnectionIds, mDvrSourceConnectionIds}; + vector> deviceIds{descramblerIds, mfrontendIds, audioFilterIds, + mDvrFeConnectionIds, mDvrSourceConnectionIds}; auto idCombinations = generateIdCombinations(deviceIds); for (auto& combo : idCombinations) { DescramblingHardwareConnections mDescrambling; @@ -353,7 +352,10 @@ static inline vector generateDescramblingCombin } mDescrambling.frontendId = feId; mDescrambling.audioFilterId = combo[audioFilterIndex]; - mDescrambling.videoFilterId = combo[videoFilterIndex]; + const int videoFilterIndex = + find(audioFilterIds.begin(), audioFilterIds.end(), mDescrambling.audioFilterId) - + audioFilterIds.begin(); + mDescrambling.videoFilterId = videoFilterIds[videoFilterIndex]; mDescrambling.dvrSoftwareFeId = dvrSwFeId; mDescrambling.dvrSourceId = dvrSourceId; mDescrambling.descramblerId = combo[descramblerIndex]; @@ -701,6 +703,11 @@ inline bool validateConnections() { return false; } + if (audioFilterIds.size() != videoFilterIds.size()) { + ALOGW("[vts config] the number of audio and video filters should be equal"); + return false; + } + bool timeFilterIsValid = timeFilter.support ? timeFilterMap.find(timeFilter.timeFilterId) != timeFilterMap.end() : true; From 0c0695379dde1e611ea88756260787882fa22a83 Mon Sep 17 00:00:00 2001 From: Frankie Lizcano Date: Thu, 14 Jul 2022 20:20:46 +0000 Subject: [PATCH 188/998] Improve Tuner VTS: Generate TimeFilter Combinations This CL allows the VTS to read a vendor's configuration file, determine if the given devices could support the TimeFilter dataflow, and generate all combinations of units to run them on corresponding integration tests. Additionally, the configuration file is checked to see if the vendors provide the dataflow themselves. If not, the combinations are created. Bug: b/182519645 Test: vts-tradefed run vts --module VtsHalTvTunerTargetTest. Manual tests with different input configuration files. Change-Id: Icdbf8961e9dc06fd979be953027409a0a197cba4 --- .../functional/VtsHalTvTunerTargetTest.cpp | 6 ++++- .../vts/functional/VtsHalTvTunerTargetTest.h | 1 + .../VtsHalTvTunerTestConfigurations.h | 27 +++++++++++++++++++ .../config/TunerTestingConfigAidlReaderV1_0.h | 2 ++ 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp index 8739668bf4..90f9987ae3 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp @@ -645,7 +645,11 @@ TEST_P(TunerFilterAidlTest, testTimeFilter) { return; } // TODO use parameterized tests - testTimeFilter(timeFilterMap[timeFilter.timeFilterId]); + auto timeFilter_configs = generateTimeFilterConfigurations(); + for (auto& configuration : timeFilter_configs) { + timeFilter = configuration; + testTimeFilter(timeFilterMap[timeFilter.timeFilterId]); + } } static bool isEventProducingFilter(const FilterConfig& filterConfig) { diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h index e40540d997..f6b6815634 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h @@ -69,6 +69,7 @@ void clearIds() { diseqcMsgs.clear(); frontendIds.clear(); recordDvrIds.clear(); + timeFilterIds.clear(); descramblerIds.clear(); audioFilterIds.clear(); videoFilterIds.clear(); diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h index ddc36a8c40..ca74ab04ab 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h @@ -380,6 +380,33 @@ static inline vector generateDescramblingConfig return descrambling_configs; } +static inline vector generateTimeFilterCombinations() { + vector combinations; + + for (auto& id : timeFilterIds) { + TimeFilterHardwareConnections mTimeFilter; + mTimeFilter.timeFilterId = id; + combinations.push_back(mTimeFilter); + } + + return combinations; +} + +static inline vector generateTimeFilterConfigurations() { + vector timeFilter_configs; + if (configuredTimeFilter) { + ALOGD("Using TimeFilter configuration provided."); + timeFilter_configs = {timeFilter}; + } else { + ALOGD("TimeFilter not provided. Generating possible combinations. Consider adding it to " + "the " + "configuration file."); + timeFilter_configs = generateTimeFilterCombinations(); + } + + return timeFilter_configs; +} + /** Config all the frontends that would be used in the tests */ inline void initFrontendConfig() { // The test will use the internal default fe when default fe is connected to any data flow diff --git a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h index 6fafd59c41..7486dd92db 100644 --- a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h +++ b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h @@ -80,6 +80,7 @@ static string mConfigFilePath; static vector playbackDvrIds; static vector recordDvrIds; +static vector timeFilterIds; static vector audioFilterIds; static vector videoFilterIds; static vector recordFilterIds; @@ -503,6 +504,7 @@ struct TunerTestingConfigAidlReader1_0 { auto timeFilters = *hardwareConfig.getFirstTimeFilters(); for (auto timeFilterConfig : timeFilters.getTimeFilter()) { string id = timeFilterConfig.getId(); + timeFilterIds.push_back(id); timeFilterMap[id].timeStamp = static_cast(timeFilterConfig.getTimeStamp()); } } From 9cd9dbd948aff9d3911a3ecb49eff49d1bfcdc16 Mon Sep 17 00:00:00 2001 From: seanhong Date: Thu, 4 Aug 2022 21:38:00 +0000 Subject: [PATCH 189/998] Add seat height properties to DefaultProperties.json for CTS tests Test: atest CarPropertyManagerTest Bug: 239613431 Change-Id: Ic3f0714277966157fd569ca3be8e316f297417d1 --- .../config/DefaultProperties.json | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index f4ce402e28..596ac05ae9 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -434,6 +434,76 @@ } ] }, + { + "property": "VehicleProperty::SEAT_HEIGHT_POS", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -10, + "maxInt32Value": 10 + } + ] + }, + { + "property": "VehicleProperty::SEAT_HEIGHT_MOVE", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -1, + "maxInt32Value": 1 + } + ] + }, { "property": "VehicleProperty::SEAT_OCCUPANCY", "areas": [ From fb97396b409ce2f336c3843870a2bcaeb3fefdf4 Mon Sep 17 00:00:00 2001 From: seanhong Date: Wed, 27 Jul 2022 23:22:33 +0000 Subject: [PATCH 190/998] Add seat height properties to the emulator (DefaultConfig.h) for CTS tests Test: atest CarPropertyManagerTest Bug: 239613431 Change-Id: I48cd904dec83878570736cb8e99f0e169be753d7 --- .../default_config/include/DefaultConfig.h | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index 8c6fa1b5b6..2a401609bb 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -344,6 +344,46 @@ const std::vector kVehicleProperties = { .maxInt32Value = 1}}}, .initialValue = {.int32Values = {0}}}, + {.config = {.prop = toInt(VehicleProperty::SEAT_HEIGHT_POS), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = -10, + .maxInt32Value = 10}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = -10, + .maxInt32Value = 10}}}, + .initialValue = {.int32Values = {0}}}, + + {.config = {.prop = toInt(VehicleProperty::SEAT_HEIGHT_MOVE), + .access = VehiclePropertyAccess::READ_WRITE, + .changeMode = VehiclePropertyChangeMode::ON_CHANGE, + .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_1_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_LEFT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_RIGHT, + .minInt32Value = -1, + .maxInt32Value = 1}, + VehicleAreaConfig{.areaId = SEAT_2_CENTER, + .minInt32Value = -1, + .maxInt32Value = 1}}}, + .initialValue = {.int32Values = {0}}}, + {.config = { .prop = toInt(VehicleProperty::SEAT_OCCUPANCY), From 9ba443f0613ebc0143695bb10aa278372dbe2b98 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Fri, 15 Jul 2022 00:03:47 +0000 Subject: [PATCH 191/998] Deprecate DefaultConfig.h. We migrated DefaultConfig.h to config JSON files. Test: Presubmit Bug: 238685398 Change-Id: Ia3d2e5b34b0cdbfb5078129aabfe4b080e2e67a8 --- .../aidl/impl/default_config/Android.bp | 37 ------------------- .../aidl/impl/default_config/test/Android.bp | 6 --- .../default_config/test/DefaultConfigTest.cpp | 21 ----------- .../utils/proto_message_converter/Android.bp | 1 - 4 files changed, 65 deletions(-) delete mode 100644 automotive/vehicle/aidl/impl/default_config/Android.bp diff --git a/automotive/vehicle/aidl/impl/default_config/Android.bp b/automotive/vehicle/aidl/impl/default_config/Android.bp deleted file mode 100644 index aa22d8740a..0000000000 --- a/automotive/vehicle/aidl/impl/default_config/Android.bp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2021 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 { - default_applicable_licenses: ["Android-Apache-2.0"], -} - -cc_library_headers { - name: "VehicleHalDefaultConfig", - vendor: true, - local_include_dirs: ["include"], - export_include_dirs: ["include"], - defaults: ["VehicleHalDefaults"], - static_libs: ["VehicleHalUtils"], - header_libs: [ - "VehicleHalJsonConfigLoaderHeaders", - "VehicleHalTestUtilHeaders", - ], - export_static_lib_headers: ["VehicleHalUtils"], - export_header_lib_headers: [ - "VehicleHalTestUtilHeaders", - "VehicleHalJsonConfigLoaderHeaders", - ], -} diff --git a/automotive/vehicle/aidl/impl/default_config/test/Android.bp b/automotive/vehicle/aidl/impl/default_config/test/Android.bp index b05d47c6aa..8702eae053 100644 --- a/automotive/vehicle/aidl/impl/default_config/test/Android.bp +++ b/automotive/vehicle/aidl/impl/default_config/test/Android.bp @@ -30,8 +30,6 @@ cc_test { "libgtest", ], header_libs: [ - // TODO(b/238685398): Remove this once we deprecate DefaultConfig.h - "VehicleHalDefaultConfig", "IVehicleGeneratedHeaders", ], shared_libs: [ @@ -55,13 +53,9 @@ cc_test { "libgtest", ], cflags: [ - // TODO(b/238685398): Remove this once we deprecate DefaultConfig.h - "-DENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING", "-DENABLE_VEHICLE_HAL_TEST_PROPERTIES", ], header_libs: [ - // TODO(b/238685398): Remove this once we deprecate DefaultConfig.h - "VehicleHalDefaultConfig", "IVehicleGeneratedHeaders", ], shared_libs: [ diff --git a/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp b/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp index f0ab80643c..95fecfe2d9 100644 --- a/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp +++ b/automotive/vehicle/aidl/impl/default_config/test/DefaultConfigTest.cpp @@ -14,7 +14,6 @@ * limitations under the License. */ -#include #include #include #include @@ -80,26 +79,6 @@ TEST(DefaultConfigTest, TestloadVendorClusterTestProperties) { ASSERT_TRUE(result.ok()) << result.error().message(); } -// TODO(b/238685398): Remove this test after we deprecate DefaultConfig.h -TEST(DefaultConfigTest, TestCompatibleWithDefaultConfigHeader) { - auto configsFromHeaderFile = defaultconfig::getDefaultConfigs(); - - std::vector configsFromJson; - JsonConfigLoader loader; - for (const char* file : - std::vector({kDefaultPropertiesConfigFile, kTestPropertiesConfigFile, - kVendorClusterTestPropertiesConfigFile})) { - auto result = loadConfig(loader, file); - ASSERT_TRUE(result.ok()) << result.error().message(); - for (auto& [propId, configDeclaration] : result.value()) { - configsFromJson.push_back(configDeclaration); - } - } - - ASSERT_EQ(configsFromHeaderFile.size(), configsFromJson.size()); - ASSERT_THAT(configsFromHeaderFile, UnorderedElementsAreArray(configsFromJson)); -} - #endif // ENABLE_VEHICLE_HAL_TEST_PROPERTIES } // namespace test diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp index c36833455a..2b4059c912 100644 --- a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp +++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp @@ -61,6 +61,5 @@ cc_test { data: [ ":VehicleHalDefaultProperties_JSON", ], - header_libs: ["VehicleHalDefaultConfig"], test_suites: ["device-tests"], } From 9c464f7c5c1aa4cf83fc2ec0135076fde99a5661 Mon Sep 17 00:00:00 2001 From: Frankie Lizcano Date: Mon, 18 Jul 2022 17:56:52 +0000 Subject: [PATCH 192/998] Improve Tuner VTS: Generate DVR Record Combos This CL allows the VTS to read a vendor's configuration file, determine if the given devices could support the DVR Record dataflow, and runs the integration tests with all valid combinations. 2 functions were added to help drive the testing logic. generateRecordCombinations() generates all valid record dataflow configurations, and the integration tests call generateRecordCombinations() to analyze whether to generate these combinations or use the data flow provided by the vendor (if there is one). Additionally, when dynamically configuring DVR_Record, a bug was exposed in the VTS that came about from recycling the function recordSingleFilterTest(). When LnbRecord was initialized with a software frontend, the VTS was looking to the record dataflow's dvr source for input. If record is not hardcoded by the vendor, the VTS would crash. To fix this error, an enum class was added as a parameter to RecordSingleFilterTest() to take into consideration which dataflow (lnbRecord or record [no Lnb]) was calling the function. New behavior is defined to take into account both cases. Also, lnbRecord will not be tested if there are no hardware frontends, as this is not very likely to be configured by vendors. Bug: b/182519645 Test: vts-tradefed run vts --module VtsHalTvTunerTargetTest. Manual tests with different input configuration files. Change-Id: I76c05ca2e33767e4bdcd2072db5144d495d623b0 --- .../functional/VtsHalTvTunerTargetTest.cpp | 98 +++++++++++++------ .../vts/functional/VtsHalTvTunerTargetTest.h | 4 +- .../VtsHalTvTunerTestConfigurations.h | 50 ++++++++++ 3 files changed, 122 insertions(+), 30 deletions(-) diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp index 90f9987ae3..fa47536505 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp @@ -260,7 +260,9 @@ void TunerRecordAidlTest::recordSingleFilterTestWithLnb(FilterConfig filterConf, for (auto msgName : lnbRecord.diseqcMsgs) { ASSERT_TRUE(mLnbTests.sendDiseqcMessage(diseqcMsgMap[msgName])); } - recordSingleFilterTest(filterConf, frontendConf, dvrConf); + if (!frontendConf.isSoftwareFe) { + recordSingleFilterTest(filterConf, frontendConf, dvrConf, Dataflow_Context::LNBRECORD); + } ASSERT_TRUE(mLnbTests.closeLnb()); mLnbId = INVALID_LNB_ID; } @@ -318,29 +320,47 @@ void TunerRecordAidlTest::attachSingleFilterToRecordDvrTest(FilterConfig filterC } void TunerRecordAidlTest::recordSingleFilterTest(FilterConfig filterConf, - FrontendConfig frontendConf, DvrConfig dvrConf) { + FrontendConfig frontendConf, DvrConfig dvrConf, + Dataflow_Context context) { int32_t demuxId; std::shared_ptr demux; ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); mDvrTests.setDemux(demux); DvrConfig dvrSourceConfig; - if (record.hasFrontendConnection) { + if (context == Dataflow_Context::RECORD) { + if (record.hasFrontendConnection) { + int32_t feId; + mFrontendTests.getFrontendIdByType(frontendConf.type, feId); + ASSERT_TRUE(feId != INVALID_ID); + ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); + ASSERT_TRUE(mFrontendTests.setFrontendCallback()); + if (frontendConf.isSoftwareFe) { + mFrontendTests.setSoftwareFrontendDvrConfig(dvrMap[record.dvrSoftwareFeId]); + } + ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); + mFrontendTests.setDvrTests(&mDvrTests); + } else { + dvrSourceConfig = dvrMap[record.dvrSourceId]; + ASSERT_TRUE(mDvrTests.openDvrInDemux(dvrSourceConfig.type, dvrSourceConfig.bufferSize)); + ASSERT_TRUE(mDvrTests.configDvrPlayback(dvrSourceConfig.settings)); + ASSERT_TRUE(mDvrTests.getDvrPlaybackMQDescriptor()); + } + } else if (context == Dataflow_Context::LNBRECORD) { + // If function arrives here, frontend should not be software, so no need to configure a dvr + // source or dvr fe connection that might be used for recording without an Lnb int32_t feId; mFrontendTests.getFrontendIdByType(frontendConf.type, feId); ASSERT_TRUE(feId != INVALID_ID); ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); ASSERT_TRUE(mFrontendTests.setFrontendCallback()); - if (frontendConf.isSoftwareFe) { - mFrontendTests.setSoftwareFrontendDvrConfig(dvrMap[record.dvrSoftwareFeId]); + if (mLnbId != INVALID_LNB_ID) { + ASSERT_TRUE(mFrontendTests.setLnb(mLnbId)); + } else { + FAIL(); } ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); mFrontendTests.setDvrTests(&mDvrTests); - } else { - dvrSourceConfig = dvrMap[record.dvrSourceId]; - ASSERT_TRUE(mDvrTests.openDvrInDemux(dvrSourceConfig.type, dvrSourceConfig.bufferSize)); - ASSERT_TRUE(mDvrTests.configDvrPlayback(dvrSourceConfig.settings)); - ASSERT_TRUE(mDvrTests.getDvrPlaybackMQDescriptor()); } int64_t filterId; @@ -360,24 +380,31 @@ void TunerRecordAidlTest::recordSingleFilterTest(FilterConfig filterConf, ASSERT_TRUE(mDvrTests.startDvrRecord()); ASSERT_TRUE(mFilterTests.startFilter(filterId)); - if (record.hasFrontendConnection) { + if (context == Dataflow_Context::RECORD) { + if (record.hasFrontendConnection) { + ASSERT_TRUE(mFrontendTests.tuneFrontend(frontendConf, true /*testWithDemux*/)); + } else { + // Start DVR Source + mDvrTests.startPlaybackInputThread( + dvrSourceConfig.playbackInputFile, + dvrSourceConfig.settings.get()); + ASSERT_TRUE(mDvrTests.startDvrPlayback()); + } + } else if (context == Dataflow_Context::LNBRECORD) { ASSERT_TRUE(mFrontendTests.tuneFrontend(frontendConf, true /*testWithDemux*/)); - } else { - // Start DVR Source - mDvrTests.startPlaybackInputThread( - dvrSourceConfig.playbackInputFile, - dvrSourceConfig.settings.get()); - ASSERT_TRUE(mDvrTests.startDvrPlayback()); } - mDvrTests.testRecordOutput(); mDvrTests.stopRecordThread(); - if (record.hasFrontendConnection) { + if (context == Dataflow_Context::RECORD) { + if (record.hasFrontendConnection) { + ASSERT_TRUE(mFrontendTests.stopTuneFrontend(true /*testWithDemux*/)); + } else { + mDvrTests.stopPlaybackThread(); + ASSERT_TRUE(mDvrTests.stopDvrPlayback()); + } + } else if (context == Dataflow_Context::LNBRECORD) { ASSERT_TRUE(mFrontendTests.stopTuneFrontend(true /*testWithDemux*/)); - } else { - mDvrTests.stopPlaybackThread(); - ASSERT_TRUE(mDvrTests.stopDvrPlayback()); } ASSERT_TRUE(mFilterTests.stopFilter(filterId)); @@ -386,10 +413,14 @@ void TunerRecordAidlTest::recordSingleFilterTest(FilterConfig filterConf, ASSERT_TRUE(mFilterTests.closeFilter(filterId)); mDvrTests.closeDvrRecord(); - if (record.hasFrontendConnection) { + if (context == Dataflow_Context::RECORD) { + if (record.hasFrontendConnection) { + ASSERT_TRUE(mFrontendTests.closeFrontend()); + } else { + mDvrTests.closeDvrPlayback(); + } + } else if (context == Dataflow_Context::LNBRECORD) { ASSERT_TRUE(mFrontendTests.closeFrontend()); - } else { - mDvrTests.closeDvrPlayback(); } ASSERT_TRUE(mDemuxTests.closeDemux()); @@ -892,8 +923,12 @@ TEST_P(TunerRecordAidlTest, RecordDataFlowWithTsRecordFilterTest) { if (!record.support) { return; } - recordSingleFilterTest(filterMap[record.recordFilterId], frontendMap[record.frontendId], - dvrMap[record.dvrRecordId]); + auto record_configs = generateRecordConfigurations(); + for (auto& configuration : record_configs) { + record = configuration; + recordSingleFilterTest(filterMap[record.recordFilterId], frontendMap[record.frontendId], + dvrMap[record.dvrRecordId], Dataflow_Context::RECORD); + } } TEST_P(TunerRecordAidlTest, AttachFiltersToRecordTest) { @@ -902,8 +937,13 @@ TEST_P(TunerRecordAidlTest, AttachFiltersToRecordTest) { if (!record.support) { return; } - attachSingleFilterToRecordDvrTest(filterMap[record.recordFilterId], - frontendMap[record.frontendId], dvrMap[record.dvrRecordId]); + auto record_configs = generateRecordConfigurations(); + for (auto& configuration : record_configs) { + record = configuration; + attachSingleFilterToRecordDvrTest(filterMap[record.recordFilterId], + frontendMap[record.frontendId], + dvrMap[record.dvrRecordId]); + } } TEST_P(TunerRecordAidlTest, LnbRecordDataFlowWithTsRecordFilterTest) { diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h index f6b6815634..e5f331bde7 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h @@ -78,6 +78,8 @@ void clearIds() { sectionFilterIds.clear(); } +enum class Dataflow_Context { LNBRECORD, RECORD }; + class TunerLnbAidlTest : public testing::TestWithParam { public: virtual void SetUp() override { @@ -289,7 +291,7 @@ class TunerRecordAidlTest : public testing::TestWithParam { void recordSingleFilterTestWithLnb(FilterConfig filterConf, FrontendConfig frontendConf, DvrConfig dvrConf, LnbConfig lnbConf); void recordSingleFilterTest(FilterConfig filterConf, FrontendConfig frontendConf, - DvrConfig dvrConf); + DvrConfig dvrConf, Dataflow_Context context); std::shared_ptr mService; FrontendTests mFrontendTests; diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h index ca74ab04ab..875cf551ed 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h @@ -407,6 +407,56 @@ static inline vector generateTimeFilterConfigurat return timeFilter_configs; } +/* + * index 0 - frontends + * index 1 - record dvrs + * index 2 - record filters + */ +static inline vector generateRecordCombinations() { + vector combinations; + + const int frontendIdIndex = 0; + const int recordDvrIndex = 1; + const int recordFilterIndex = 2; + + vector> deviceIds{frontendIds, recordDvrIds, recordFilterIds}; + + auto idCombinations = generateIdCombinations(deviceIds); + for (auto& combo : idCombinations) { + DvrRecordHardwareConnections mRecord; + const string feId = combo[frontendIdIndex]; + mRecord.hasFrontendConnection = true; + if (frontendMap[feId].isSoftwareFe) { + // If we have a software frontend, do not include configuration for testing. + continue; + } + mRecord.frontendId = feId; + mRecord.support = true; + mRecord.dvrSourceId = emptyHardwareId; + mRecord.dvrSoftwareFeId = emptyHardwareId; + mRecord.recordFilterId = combo[recordFilterIndex]; + mRecord.dvrRecordId = combo[recordDvrIndex]; + combinations.push_back(mRecord); + } + + return combinations; +} + +static inline vector generateRecordConfigurations() { + vector record_configs; + if (configuredRecord) { + ALOGD("Using Record configuration provided."); + record_configs = {record}; + } else { + ALOGD("Record not provided. Generating possible combinations. Consider adding it to " + "the " + "configuration file."); + record_configs = generateRecordCombinations(); + } + + return record_configs; +} + /** Config all the frontends that would be used in the tests */ inline void initFrontendConfig() { // The test will use the internal default fe when default fe is connected to any data flow From 851a9626c3ba454950d73c0b072f000986f7f21e Mon Sep 17 00:00:00 2001 From: Tyler Trephan Date: Mon, 8 Aug 2022 21:27:18 +0000 Subject: [PATCH 193/998] Added missing HVAC properties to DefaultProperties.json Test: Built Bug: 237610879 Change-Id: I8a71d3ab47c2e60ed90a11cfeb4c10b44d93f1c9 --- .../config/DefaultProperties.json | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index f4ce402e28..7167a60422 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -840,6 +840,19 @@ 0 ] }, + { + "property": "VehicleProperty::HVAC_ACTUAL_FAN_SPEED_RPM", + "defaultValue": { + "int32Values": [ + 50 + ] + }, + "areas": [ + { + "areaId": "Constants::HVAC_ALL" + } + ] + }, { "property": "VehicleProperty::HVAC_POWER_ON", "defaultValue": { @@ -1102,6 +1115,27 @@ } ] }, + { + "property": "VehicleProperty::HVAC_TEMPERATURE_CURRENT", + "areas": [ + { + "defaultValue": { + "floatValues": [ + 17.3 + ] + }, + "areaId": 49 + }, + { + "defaultValue": { + "floatValues": [ + 19.1 + ] + }, + "areaId": 68 + } + ] + }, { "property": "VehicleProperty::HVAC_TEMPERATURE_SET", "areas": [ From 6932dd2c46408f3eb4a1c5b16171d68c17770a3b Mon Sep 17 00:00:00 2001 From: Chen Cheng Date: Tue, 9 Aug 2022 20:50:11 +0000 Subject: [PATCH 194/998] Remove extra commas in DefaultProperties.json. The JSON object in DefaultProperties.json is invalid because of extra commas. Removed these extra commas. And replace some number values with the original VehicleUnit constants format as in DefaulConfig.h file. Test: atest FakeVhalConfigParserUnitTest Bug: 241959871 Change-Id: Ic5193fa46217f31cfe96f73c6e153631891644bc --- .../config/DefaultProperties.json | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 596ac05ae9..1948b26178 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1210,7 +1210,7 @@ "defaultValue": { "floatValues": [ 66.19999694824219, - 49.0, + "VehicleUnit::FAHRENHEIT", 19.0, 66.5 ] @@ -1230,12 +1230,12 @@ "property": "VehicleProperty::HVAC_TEMPERATURE_DISPLAY_UNITS", "defaultValue": { "int32Values": [ - 49 + "VehicleUnit::FAHRENHEIT" ] }, "configArray": [ - 49, - 48 + "VehicleUnit::FAHRENHEIT", + "VehicleUnit::CELSIUS" ] }, { @@ -1422,22 +1422,22 @@ { "areaId": "Constants::WINDOW_1_LEFT", "minInt32Value": 0, - "maxInt32Value": 10, + "maxInt32Value": 10 }, { "areaId": "Constants::WINDOW_1_RIGHT", "minInt32Value": 0, - "maxInt32Value": 10, + "maxInt32Value": 10 }, { "areaId": "Constants::WINDOW_2_LEFT", "minInt32Value": 0, - "maxInt32Value": 10, + "maxInt32Value": 10 }, { "areaId": "Constants::WINDOW_2_RIGHT", "minInt32Value": 0, - "maxInt32Value": 10, + "maxInt32Value": 10 }, { "areaId": "Constants::WINDOW_ROOF_TOP_1", @@ -1669,13 +1669,13 @@ "property": "VehicleProperty::CURRENT_POWER_POLICY" }, { - "property": "VehicleProperty::ANDROID_EPOCH_TIME", + "property": "VehicleProperty::ANDROID_EPOCH_TIME" }, { - "property": "VehicleProperty::WATCHDOG_ALIVE", + "property": "VehicleProperty::WATCHDOG_ALIVE" }, { - "property": "VehicleProperty::WATCHDOG_TERMINATED_PROCESS", + "property": "VehicleProperty::WATCHDOG_TERMINATED_PROCESS" }, { "property": "VehicleProperty::VHAL_HEARTBEAT" @@ -1705,7 +1705,7 @@ ] }, "comment": - "Value means: 0 /* Off */, -1, -1, -1, -1 /* Bounds */, -1, -1, -1, -1 /* Insets */", + "Value means: 0 /* Off */, -1, -1, -1, -1 /* Bounds */, -1, -1, -1, -1 /* Insets */" }, { "property": "VehicleProperty::CLUSTER_REPORT_STATE", @@ -1722,10 +1722,10 @@ ] }, { - "property": "VehicleProperty::CLUSTER_REQUEST_DISPLAY", + "property": "VehicleProperty::CLUSTER_REQUEST_DISPLAY" }, { - "property": "VehicleProperty::CLUSTER_NAVIGATION_STATE", + "property": "VehicleProperty::CLUSTER_NAVIGATION_STATE" }, { "property": "VehicleProperty::GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT", From 8b87f25f99b0f271a96d04837449259da634ce53 Mon Sep 17 00:00:00 2001 From: Frankie Lizcano Date: Tue, 19 Jul 2022 21:51:54 +0000 Subject: [PATCH 195/998] Improve Tuner VTS: Generate Live Combos This CL allows the VTS to read a vendor's configuration file, determine if the given devices could support the Live dataflow, and generate all combinations of units to run them on corresponding integration tests. Each combination is error checked to ensure they meet the minumum requirements, and any invalid ones are discared, which may narrow the combination space immensely. This CL also adds logic to store IP and PCR filter IDs to include using them in any configuration combinations. We also pair PCR filters with audio and video filters if the vendor chooses to provide more than 1, enforcing the invariant that the number of pcr, audio, and video filters must be equal. If there is only 1 pcr filters, we default to use that one. Bug: b/182519645 Test: vts-tradefed run vts --module VtsHalTvTunerTargetTest. Manual tests with different input configuration files. Change-Id: Icb2d96b32ed7a14b845c752a79744c44fdaf04e3 --- .../functional/VtsHalTvTunerTargetTest.cpp | 191 ++++++++++++------ .../vts/functional/VtsHalTvTunerTargetTest.h | 2 + .../VtsHalTvTunerTestConfigurations.h | 82 ++++++++ .../config/TunerTestingConfigAidlReaderV1_0.h | 6 + 4 files changed, 217 insertions(+), 64 deletions(-) diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp index fa47536505..4d176ab86d 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp @@ -557,17 +557,21 @@ TEST_P(TunerDemuxAidlTest, openDemux) { if (!live.hasFrontendConnection) { return; } - int32_t feId; - int32_t demuxId; - std::shared_ptr demux; - mFrontendTests.getFrontendIdByType(frontendMap[live.frontendId].type, feId); - ASSERT_TRUE(feId != INVALID_ID); - ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); - ASSERT_TRUE(mFrontendTests.setFrontendCallback()); - ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); - ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); - ASSERT_TRUE(mDemuxTests.closeDemux()); - ASSERT_TRUE(mFrontendTests.closeFrontend()); + auto live_configs = generateLiveConfigurations(); + for (auto& configuration : live_configs) { + live = configuration; + int32_t feId; + int32_t demuxId; + std::shared_ptr demux; + mFrontendTests.getFrontendIdByType(frontendMap[live.frontendId].type, feId); + ASSERT_TRUE(feId != INVALID_ID); + ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); + ASSERT_TRUE(mFrontendTests.setFrontendCallback()); + ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); + ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); + ASSERT_TRUE(mDemuxTests.closeDemux()); + ASSERT_TRUE(mFrontendTests.closeFrontend()); + } } TEST_P(TunerDemuxAidlTest, getAvSyncTime) { @@ -575,40 +579,45 @@ TEST_P(TunerDemuxAidlTest, getAvSyncTime) { if (!live.hasFrontendConnection) { return; } - if (live.pcrFilterId.compare(emptyHardwareId) == 0) { - return; - } - int32_t feId; - int32_t demuxId; - std::shared_ptr demux; - int64_t mediaFilterId; - int64_t pcrFilterId; - int32_t avSyncHwId; - std::shared_ptr mediaFilter; + auto live_configs = generateLiveConfigurations(); + for (auto& configuration : live_configs) { + live = configuration; + if (live.pcrFilterId.compare(emptyHardwareId) == 0) { + continue; + } + int32_t feId; + int32_t demuxId; + std::shared_ptr demux; + int64_t mediaFilterId; + int64_t pcrFilterId; + int32_t avSyncHwId; + std::shared_ptr mediaFilter; - mFrontendTests.getFrontendIdByType(frontendMap[live.frontendId].type, feId); - ASSERT_TRUE(feId != INVALID_ID); - ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); - ASSERT_TRUE(mFrontendTests.setFrontendCallback()); - ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); - ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); - mFilterTests.setDemux(demux); - ASSERT_TRUE(mFilterTests.openFilterInDemux(filterMap[live.videoFilterId].type, - filterMap[live.videoFilterId].bufferSize)); - ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId_64bit(mediaFilterId)); - ASSERT_TRUE(mFilterTests.configFilter(filterMap[live.videoFilterId].settings, mediaFilterId)); - mediaFilter = mFilterTests.getFilterById(mediaFilterId); - ASSERT_TRUE(mFilterTests.openFilterInDemux(filterMap[live.pcrFilterId].type, - filterMap[live.pcrFilterId].bufferSize)); - ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId_64bit(pcrFilterId)); - ASSERT_TRUE(mFilterTests.configFilter(filterMap[live.pcrFilterId].settings, pcrFilterId)); - ASSERT_TRUE(mDemuxTests.getAvSyncId(mediaFilter, avSyncHwId)); - ASSERT_TRUE(pcrFilterId == avSyncHwId); - ASSERT_TRUE(mDemuxTests.getAvSyncTime(pcrFilterId)); - ASSERT_TRUE(mFilterTests.closeFilter(pcrFilterId)); - ASSERT_TRUE(mFilterTests.closeFilter(mediaFilterId)); - ASSERT_TRUE(mDemuxTests.closeDemux()); - ASSERT_TRUE(mFrontendTests.closeFrontend()); + mFrontendTests.getFrontendIdByType(frontendMap[live.frontendId].type, feId); + ASSERT_TRUE(feId != INVALID_ID); + ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); + ASSERT_TRUE(mFrontendTests.setFrontendCallback()); + ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); + ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); + mFilterTests.setDemux(demux); + ASSERT_TRUE(mFilterTests.openFilterInDemux(filterMap[live.videoFilterId].type, + filterMap[live.videoFilterId].bufferSize)); + ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId_64bit(mediaFilterId)); + ASSERT_TRUE( + mFilterTests.configFilter(filterMap[live.videoFilterId].settings, mediaFilterId)); + mediaFilter = mFilterTests.getFilterById(mediaFilterId); + ASSERT_TRUE(mFilterTests.openFilterInDemux(filterMap[live.pcrFilterId].type, + filterMap[live.pcrFilterId].bufferSize)); + ASSERT_TRUE(mFilterTests.getNewlyOpenedFilterId_64bit(pcrFilterId)); + ASSERT_TRUE(mFilterTests.configFilter(filterMap[live.pcrFilterId].settings, pcrFilterId)); + ASSERT_TRUE(mDemuxTests.getAvSyncId(mediaFilter, avSyncHwId)); + ASSERT_TRUE(pcrFilterId == avSyncHwId); + ASSERT_TRUE(mDemuxTests.getAvSyncTime(pcrFilterId)); + ASSERT_TRUE(mFilterTests.closeFilter(pcrFilterId)); + ASSERT_TRUE(mFilterTests.closeFilter(mediaFilterId)); + ASSERT_TRUE(mDemuxTests.closeDemux()); + ASSERT_TRUE(mFrontendTests.closeFrontend()); + } } TEST_P(TunerFilterAidlTest, StartFilterInDemux) { @@ -617,7 +626,11 @@ TEST_P(TunerFilterAidlTest, StartFilterInDemux) { return; } // TODO use parameterized tests - configSingleFilterInDemuxTest(filterMap[live.videoFilterId], frontendMap[live.frontendId]); + auto live_configs = generateLiveConfigurations(); + for (auto& configuration : live_configs) { + live = configuration; + configSingleFilterInDemuxTest(filterMap[live.videoFilterId], frontendMap[live.frontendId]); + } } TEST_P(TunerFilterAidlTest, ConfigIpFilterInDemuxWithCid) { @@ -626,10 +639,14 @@ TEST_P(TunerFilterAidlTest, ConfigIpFilterInDemuxWithCid) { if (!live.hasFrontendConnection) { return; } - if (live.ipFilterId.compare(emptyHardwareId) == 0) { - return; + auto live_configs = generateLiveConfigurations(); + for (auto& configuration : live_configs) { + live = configuration; + if (live.ipFilterId.compare(emptyHardwareId) == 0) { + continue; + } + configSingleFilterInDemuxTest(filterMap[live.ipFilterId], frontendMap[live.frontendId]); } - configSingleFilterInDemuxTest(filterMap[live.ipFilterId], frontendMap[live.frontendId]); } TEST_P(TunerFilterAidlTest, ReconfigFilterToReceiveStartId) { @@ -638,8 +655,13 @@ TEST_P(TunerFilterAidlTest, ReconfigFilterToReceiveStartId) { return; } // TODO use parameterized tests - reconfigSingleFilterInDemuxTest(filterMap[live.videoFilterId], filterMap[live.videoFilterId], - frontendMap[live.frontendId]); + auto live_configs = generateLiveConfigurations(); + for (auto& configuration : live_configs) { + live = configuration; + reconfigSingleFilterInDemuxTest(filterMap[live.videoFilterId], + filterMap[live.videoFilterId], + frontendMap[live.frontendId]); + } } TEST_P(TunerFilterAidlTest, SetFilterLinkage) { @@ -969,7 +991,11 @@ TEST_P(TunerFrontendAidlTest, TuneFrontend) { if (!live.hasFrontendConnection) { return; } - mFrontendTests.tuneTest(frontendMap[live.frontendId]); + auto live_configs = generateLiveConfigurations(); + for (auto& configuration : live_configs) { + live = configuration; + mFrontendTests.tuneTest(frontendMap[live.frontendId]); + } } TEST_P(TunerFrontendAidlTest, AutoScanFrontend) { @@ -1001,7 +1027,11 @@ TEST_P(TunerFrontendAidlTest, TuneFrontendWithFrontendSettings) { if (!live.hasFrontendConnection) { return; } - mFrontendTests.tuneTest(frontendMap[live.frontendId]); + auto live_configs = generateLiveConfigurations(); + for (auto& configuration : live_configs) { + live = configuration; + mFrontendTests.tuneTest(frontendMap[live.frontendId]); + } } TEST_P(TunerFrontendAidlTest, BlindScanFrontendWithEndFrequency) { @@ -1021,10 +1051,14 @@ TEST_P(TunerFrontendAidlTest, LinkToCiCam) { if (!live.hasFrontendConnection) { return; } - if (!frontendMap[live.frontendId].canConnectToCiCam) { - return; + auto live_configs = generateLiveConfigurations(); + for (auto& configuration : live_configs) { + live = configuration; + if (!frontendMap[live.frontendId].canConnectToCiCam) { + continue; + } + mFrontendTests.tuneTest(frontendMap[live.frontendId]); } - mFrontendTests.tuneTest(frontendMap[live.frontendId]); } TEST_P(TunerFrontendAidlTest, getHardwareInfo) { @@ -1032,7 +1066,11 @@ TEST_P(TunerFrontendAidlTest, getHardwareInfo) { if (!live.hasFrontendConnection) { return; } - mFrontendTests.debugInfoTest(frontendMap[live.frontendId]); + auto live_configs = generateLiveConfigurations(); + for (auto& configuration : live_configs) { + live = configuration; + mFrontendTests.debugInfoTest(frontendMap[live.frontendId]); + } } TEST_P(TunerFrontendAidlTest, maxNumberOfFrontends) { @@ -1048,7 +1086,11 @@ TEST_P(TunerFrontendAidlTest, statusReadinessTest) { if (!live.hasFrontendConnection) { return; } - mFrontendTests.statusReadinessTest(frontendMap[live.frontendId]); + auto live_configs = generateLiveConfigurations(); + for (auto& configuration : live_configs) { + live = configuration; + mFrontendTests.statusReadinessTest(frontendMap[live.frontendId]); + } } TEST_P(TunerBroadcastAidlTest, BroadcastDataFlowVideoFilterTest) { @@ -1056,7 +1098,11 @@ TEST_P(TunerBroadcastAidlTest, BroadcastDataFlowVideoFilterTest) { if (!live.hasFrontendConnection) { return; } - broadcastSingleFilterTest(filterMap[live.videoFilterId], frontendMap[live.frontendId]); + auto live_configs = generateLiveConfigurations(); + for (auto& configuration : live_configs) { + live = configuration; + broadcastSingleFilterTest(filterMap[live.videoFilterId], frontendMap[live.frontendId]); + } } TEST_P(TunerBroadcastAidlTest, BroadcastDataFlowAudioFilterTest) { @@ -1064,7 +1110,11 @@ TEST_P(TunerBroadcastAidlTest, BroadcastDataFlowAudioFilterTest) { if (!live.hasFrontendConnection) { return; } - broadcastSingleFilterTest(filterMap[live.audioFilterId], frontendMap[live.frontendId]); + auto live_configs = generateLiveConfigurations(); + for (auto& configuration : live_configs) { + live = configuration; + broadcastSingleFilterTest(filterMap[live.audioFilterId], frontendMap[live.frontendId]); + } } TEST_P(TunerBroadcastAidlTest, BroadcastDataFlowSectionFilterTest) { @@ -1072,10 +1122,14 @@ TEST_P(TunerBroadcastAidlTest, BroadcastDataFlowSectionFilterTest) { if (!live.hasFrontendConnection) { return; } - if (live.sectionFilterId.compare(emptyHardwareId) == 0) { - return; + auto live_configs = generateLiveConfigurations(); + for (auto& configuration : live_configs) { + live = configuration; + if (live.sectionFilterId.compare(emptyHardwareId) == 0) { + continue; + } + broadcastSingleFilterTest(filterMap[live.sectionFilterId], frontendMap[live.frontendId]); } - broadcastSingleFilterTest(filterMap[live.sectionFilterId], frontendMap[live.frontendId]); } TEST_P(TunerBroadcastAidlTest, IonBufferTest) { @@ -1083,7 +1137,11 @@ TEST_P(TunerBroadcastAidlTest, IonBufferTest) { if (!live.hasFrontendConnection) { return; } - broadcastSingleFilterTest(filterMap[live.videoFilterId], frontendMap[live.frontendId]); + auto live_configs = generateLiveConfigurations(); + for (auto& configuration : live_configs) { + live = configuration; + broadcastSingleFilterTest(filterMap[live.videoFilterId], frontendMap[live.frontendId]); + } } TEST_P(TunerBroadcastAidlTest, LnbBroadcastDataFlowVideoFilterTest) { @@ -1108,7 +1166,12 @@ TEST_P(TunerBroadcastAidlTest, MediaFilterWithSharedMemoryHandle) { if (!live.hasFrontendConnection) { return; } - mediaFilterUsingSharedMemoryTest(filterMap[live.videoFilterId], frontendMap[live.frontendId]); + auto live_configs = generateLiveConfigurations(); + for (auto& configuration : live_configs) { + live = configuration; + mediaFilterUsingSharedMemoryTest(filterMap[live.videoFilterId], + frontendMap[live.frontendId]); + } } TEST_P(TunerDescramblerAidlTest, CreateDescrambler) { diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h index e5f331bde7..fbb869375c 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h @@ -68,6 +68,8 @@ void clearIds() { lnbIds.clear(); diseqcMsgs.clear(); frontendIds.clear(); + ipFilterIds.clear(); + pcrFilterIds.clear(); recordDvrIds.clear(); timeFilterIds.clear(); descramblerIds.clear(); diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h index 875cf551ed..36b76467e8 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h @@ -457,6 +457,81 @@ static inline vector generateRecordConfigurations( return record_configs; } +/* + * index 0 - frontends + * index 1 - audio filters + * index 2 - playback dvrs + * index 3 - section Filters + */ +static inline vector generateLiveCombinations() { + vector combinations; + vector mSectionFilterIds = sectionFilterIds; + vector mDvrSwConnectionIds = playbackDvrIds; + + // Adding the empty hardware id to cover cases where fields are optional + mSectionFilterIds.push_back(emptyHardwareId); + mDvrSwConnectionIds.push_back(emptyHardwareId); + + const int frontendIdIndex = 0; + const int audioFilterIdIndex = 1; + const int dvrSwConnectionIdIndex = 2; + const int sectionFilterIdIndex = 3; + + vector> deviceIds{frontendIds, audioFilterIds, mDvrSwConnectionIds, + mSectionFilterIds}; + + auto idCombinations = generateIdCombinations(deviceIds); + for (auto& combo : idCombinations) { + LiveBroadcastHardwareConnections mLive; + const string feId = combo[frontendIdIndex]; + const string dvrSwConnectionId = combo[dvrSwConnectionIdIndex]; + mLive.hasFrontendConnection = true; + + if (frontendMap[feId].isSoftwareFe && dvrSwConnectionId.compare(emptyHardwareId) == 0) { + // If the frontend is a software frontend and there is no dvr playback connected, do not + // include configuration + continue; + } + mLive.frontendId = feId; + mLive.dvrSoftwareFeId = dvrSwConnectionId; + mLive.audioFilterId = combo[audioFilterIdIndex]; + const int videoFilterIdIndex = + find(audioFilterIds.begin(), audioFilterIds.end(), mLive.audioFilterId) - + audioFilterIds.begin(); + mLive.videoFilterId = videoFilterIds[videoFilterIdIndex]; + mLive.sectionFilterId = combo[sectionFilterIdIndex]; + + if (pcrFilterIds.empty()) { + // If pcr Filters have not been provided, set it to empty hardware id + mLive.pcrFilterId = emptyHardwareId; + } else { + // If pcr Filters have been provided, use the first index if there is only 1, or choose + // the filter that corresponds to the correct audio and video filter pair + const int pcrFilterIdIndex = pcrFilterIds.size() == 1 ? 0 : videoFilterIdIndex; + mLive.pcrFilterId = pcrFilterIds[pcrFilterIdIndex]; + } + + combinations.push_back(mLive); + } + + return combinations; +} + +static inline vector generateLiveConfigurations() { + vector live_configs; + if (configuredLive) { + ALOGD("Using Live configuration provided."); + live_configs = {live}; + } else { + ALOGD("Live not provided. Generating possible combinations. Consider adding it to " + "the " + "configuration file."); + live_configs = generateLiveCombinations(); + } + + return live_configs; +} + /** Config all the frontends that would be used in the tests */ inline void initFrontendConfig() { // The test will use the internal default fe when default fe is connected to any data flow @@ -785,6 +860,13 @@ inline bool validateConnections() { return false; } + if (!pcrFilterIds.empty() && pcrFilterIds.size() != 1 && + pcrFilterIds.size() != audioFilterIds.size()) { + ALOGW("[vts config] When more than 1 pcr filter is configured, the number of pcr filters " + "must equal the number of audio and video filters."); + return false; + } + bool timeFilterIsValid = timeFilter.support ? timeFilterMap.find(timeFilter.timeFilterId) != timeFilterMap.end() : true; diff --git a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h index 7486dd92db..bf3745c74e 100644 --- a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h +++ b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h @@ -79,7 +79,9 @@ const string emptyHardwareId = ""; static string mConfigFilePath; static vector playbackDvrIds; +static vector ipFilterIds; static vector recordDvrIds; +static vector pcrFilterIds; static vector timeFilterIds; static vector audioFilterIds; static vector videoFilterIds; @@ -853,6 +855,10 @@ struct TunerTestingConfigAidlReader1_0 { recordFilterIds.push_back(filterConfig.getId()); } else if (subType == FilterSubTypeEnum::SECTION) { sectionFilterIds.push_back(filterConfig.getId()); + } else if (subType == FilterSubTypeEnum::PCR) { + pcrFilterIds.push_back(filterConfig.getId()); + } else if (subType == FilterSubTypeEnum::IP) { + ipFilterIds.push_back(filterConfig.getId()); } switch (mainType) { From 848fcb49b447b01f362acddb565a2bb94a818f5b Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Tue, 9 Aug 2022 00:47:35 +0000 Subject: [PATCH 196/998] Remove DefaultConfig.h file. This file is replaced with DefaultProperties.json. Test: Presubmit Bug: 238685398 Change-Id: Ib159f781f61de8a7cd1498ad2a07e5dbd0eca734 --- .../default_config/include/DefaultConfig.h | 1557 ----------------- 1 file changed, 1557 deletions(-) delete mode 100644 automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h deleted file mode 100644 index 2a401609bb..0000000000 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ /dev/null @@ -1,1557 +0,0 @@ -/* - * Copyright (C) 2021 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. - */ - -#ifndef android_hardware_automotive_vehicle_aidl_impl_default_config_include_DefaultConfig_H_ -#define android_hardware_automotive_vehicle_aidl_impl_default_config_include_DefaultConfig_H_ - -#include -#include -#include -#include - -#include -#include - -namespace android { -namespace hardware { -namespace automotive { -namespace vehicle { - -// Types used in configs, not to be exposed as public API. -namespace defaultconfig_impl { - -using ::aidl::android::hardware::automotive::vehicle::EvConnectorType; -using ::aidl::android::hardware::automotive::vehicle::EvsServiceState; -using ::aidl::android::hardware::automotive::vehicle::EvsServiceType; -using ::aidl::android::hardware::automotive::vehicle::FuelType; -using ::aidl::android::hardware::automotive::vehicle::GsrComplianceRequirementType; -using ::aidl::android::hardware::automotive::vehicle::RawPropValues; -using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport; -using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq; -using ::aidl::android::hardware::automotive::vehicle::VehicleAreaConfig; -using ::aidl::android::hardware::automotive::vehicle::VehicleAreaMirror; -using ::aidl::android::hardware::automotive::vehicle::VehicleAreaWindow; -using ::aidl::android::hardware::automotive::vehicle::VehicleGear; -using ::aidl::android::hardware::automotive::vehicle::VehicleHvacFanDirection; -using ::aidl::android::hardware::automotive::vehicle::VehicleIgnitionState; -using ::aidl::android::hardware::automotive::vehicle::VehicleOilLevel; -using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; -using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; -using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess; -using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyChangeMode; -using ::aidl::android::hardware::automotive::vehicle::VehicleSeatOccupancyState; -using ::aidl::android::hardware::automotive::vehicle::VehicleTurnSignal; -using ::aidl::android::hardware::automotive::vehicle::VehicleUnit; -using ::aidl::android::hardware::automotive::vehicle::VehicleVendorPermission; - -const std::vector kVehicleProperties = { - {.config = - { - .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::STATIC, - }, - .initialValue = {.floatValues = {15000.0f}}}, - - {.config = - { - .prop = toInt(VehicleProperty::INFO_FUEL_TYPE), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::STATIC, - }, - .initialValue = {.int32Values = {toInt(FuelType::FUEL_TYPE_UNLEADED)}}}, - - {.config = - { - .prop = toInt(VehicleProperty::INFO_EV_BATTERY_CAPACITY), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::STATIC, - }, - .initialValue = {.floatValues = {150000.0f}}}, - - {.config = - { - .prop = toInt(VehicleProperty::INFO_EV_CONNECTOR_TYPE), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::STATIC, - }, - .initialValue = {.int32Values = {toInt(EvConnectorType::IEC_TYPE_1_AC)}}}, - - {.config = - { - .prop = toInt(VehicleProperty::INFO_FUEL_DOOR_LOCATION), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::STATIC, - }, - .initialValue = {.int32Values = {FUEL_DOOR_REAR_LEFT}}}, - - {.config = - { - .prop = toInt(VehicleProperty::INFO_EV_PORT_LOCATION), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::STATIC, - }, - .initialValue = {.int32Values = {CHARGE_PORT_FRONT_LEFT}}}, - - {.config = - { - .prop = toInt(VehicleProperty::INFO_MULTI_EV_PORT_LOCATIONS), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::STATIC, - }, - .initialValue = {.int32Values = {CHARGE_PORT_FRONT_LEFT, CHARGE_PORT_REAR_LEFT}}}, - - {.config = - { - .prop = toInt(VehicleProperty::INFO_MAKE), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::STATIC, - }, - .initialValue = {.stringValue = "Toy Vehicle"}}, - {.config = - { - .prop = toInt(VehicleProperty::INFO_MODEL), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::STATIC, - }, - .initialValue = {.stringValue = "Speedy Model"}}, - {.config = - { - .prop = toInt(VehicleProperty::INFO_MODEL_YEAR), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::STATIC, - }, - .initialValue = {.int32Values = {2020}}}, - {.config = - { - .prop = toInt(VehicleProperty::INFO_EXTERIOR_DIMENSIONS), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::STATIC, - }, - .initialValue = {.int32Values = {1776, 4950, 2008, 2140, 2984, 1665, 1667, 11800}}}, - {.config = - { - .prop = toInt(VehicleProperty::PERF_VEHICLE_SPEED), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::CONTINUOUS, - .minSampleRate = 1.0f, - .maxSampleRate = 10.0f, - }, - .initialValue = {.floatValues = {0.0f}}}, - - {.config = - { - .prop = toInt(VehicleProperty::VEHICLE_SPEED_DISPLAY_UNITS), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {toInt(VehicleUnit::METER_PER_SEC), - toInt(VehicleUnit::MILES_PER_HOUR), - toInt(VehicleUnit::KILOMETERS_PER_HOUR)}, - }, - .initialValue = {.int32Values = {toInt(VehicleUnit::KILOMETERS_PER_HOUR)}}}, - - {.config = - { - .prop = toInt(VehicleProperty::EV_BATTERY_DISPLAY_UNITS), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {toInt(VehicleUnit::WATT_HOUR), - toInt(VehicleUnit::AMPERE_HOURS), - toInt(VehicleUnit::KILOWATT_HOUR)}, - }, - .initialValue = {.int32Values = {toInt(VehicleUnit::KILOWATT_HOUR)}}}, - - {.config = {.prop = toInt(VehicleProperty::SEAT_BELT_BUCKLED), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT}, - VehicleAreaConfig{.areaId = SEAT_1_RIGHT}, - VehicleAreaConfig{.areaId = SEAT_2_LEFT}, - VehicleAreaConfig{.areaId = SEAT_2_RIGHT}, - VehicleAreaConfig{.areaId = SEAT_2_CENTER}}}, - .initialValue = {.int32Values = {0}}}, - - {.config = {.prop = toInt(VehicleProperty::SEAT_BELT_HEIGHT_POS), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, - .minInt32Value = 0, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = SEAT_1_RIGHT, - .minInt32Value = 0, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = SEAT_2_LEFT, - .minInt32Value = 0, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = SEAT_2_RIGHT, - .minInt32Value = 0, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = SEAT_2_CENTER, - .minInt32Value = 0, - .maxInt32Value = 10}}}, - .initialValue = {.int32Values = {10}}}, - - {.config = {.prop = toInt(VehicleProperty::SEAT_BELT_HEIGHT_MOVE), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, - .minInt32Value = -1, - .maxInt32Value = 1}, - VehicleAreaConfig{.areaId = SEAT_1_RIGHT, - .minInt32Value = -1, - .maxInt32Value = 1}, - VehicleAreaConfig{.areaId = SEAT_2_LEFT, - .minInt32Value = -1, - .maxInt32Value = 1}, - VehicleAreaConfig{.areaId = SEAT_2_RIGHT, - .minInt32Value = -1, - .maxInt32Value = 1}, - VehicleAreaConfig{.areaId = SEAT_2_CENTER, - .minInt32Value = -1, - .maxInt32Value = 1}}}, - .initialValue = {.int32Values = {0}}}, - - {.config = {.prop = toInt(VehicleProperty::SEAT_FORE_AFT_POS), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, - .minInt32Value = -10, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = SEAT_1_RIGHT, - .minInt32Value = -10, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = SEAT_2_LEFT, - .minInt32Value = -10, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = SEAT_2_RIGHT, - .minInt32Value = -10, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = SEAT_2_CENTER, - .minInt32Value = -10, - .maxInt32Value = 10}}}, - .initialValue = {.int32Values = {0}}}, - - {.config = {.prop = toInt(VehicleProperty::SEAT_FORE_AFT_MOVE), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, - .minInt32Value = -1, - .maxInt32Value = 1}, - VehicleAreaConfig{.areaId = SEAT_1_RIGHT, - .minInt32Value = -1, - .maxInt32Value = 1}, - VehicleAreaConfig{.areaId = SEAT_2_LEFT, - .minInt32Value = -1, - .maxInt32Value = 1}, - VehicleAreaConfig{.areaId = SEAT_2_RIGHT, - .minInt32Value = -1, - .maxInt32Value = 1}, - VehicleAreaConfig{.areaId = SEAT_2_CENTER, - .minInt32Value = -1, - .maxInt32Value = 1}}}, - .initialValue = {.int32Values = {0}}}, - - {.config = {.prop = toInt(VehicleProperty::SEAT_BACKREST_ANGLE_1_POS), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, - .minInt32Value = -10, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = SEAT_1_RIGHT, - .minInt32Value = -10, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = SEAT_2_LEFT, - .minInt32Value = -10, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = SEAT_2_RIGHT, - .minInt32Value = -10, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = SEAT_2_CENTER, - .minInt32Value = -10, - .maxInt32Value = 10}}}, - .initialValue = {.int32Values = {0}}}, - - {.config = {.prop = toInt(VehicleProperty::SEAT_BACKREST_ANGLE_1_MOVE), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, - .minInt32Value = -1, - .maxInt32Value = 1}, - VehicleAreaConfig{.areaId = SEAT_1_RIGHT, - .minInt32Value = -1, - .maxInt32Value = 1}, - VehicleAreaConfig{.areaId = SEAT_2_LEFT, - .minInt32Value = -1, - .maxInt32Value = 1}, - VehicleAreaConfig{.areaId = SEAT_2_RIGHT, - .minInt32Value = -1, - .maxInt32Value = 1}, - VehicleAreaConfig{.areaId = SEAT_2_CENTER, - .minInt32Value = -1, - .maxInt32Value = 1}}}, - .initialValue = {.int32Values = {0}}}, - - {.config = {.prop = toInt(VehicleProperty::SEAT_BACKREST_ANGLE_2_POS), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, - .minInt32Value = -10, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = SEAT_1_RIGHT, - .minInt32Value = -10, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = SEAT_2_LEFT, - .minInt32Value = -10, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = SEAT_2_RIGHT, - .minInt32Value = -10, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = SEAT_2_CENTER, - .minInt32Value = -10, - .maxInt32Value = 10}}}, - .initialValue = {.int32Values = {0}}}, - - {.config = {.prop = toInt(VehicleProperty::SEAT_BACKREST_ANGLE_2_MOVE), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, - .minInt32Value = -1, - .maxInt32Value = 1}, - VehicleAreaConfig{.areaId = SEAT_1_RIGHT, - .minInt32Value = -1, - .maxInt32Value = 1}, - VehicleAreaConfig{.areaId = SEAT_2_LEFT, - .minInt32Value = -1, - .maxInt32Value = 1}, - VehicleAreaConfig{.areaId = SEAT_2_RIGHT, - .minInt32Value = -1, - .maxInt32Value = 1}, - VehicleAreaConfig{.areaId = SEAT_2_CENTER, - .minInt32Value = -1, - .maxInt32Value = 1}}}, - .initialValue = {.int32Values = {0}}}, - - {.config = {.prop = toInt(VehicleProperty::SEAT_HEIGHT_POS), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, - .minInt32Value = -10, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = SEAT_1_RIGHT, - .minInt32Value = -10, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = SEAT_2_LEFT, - .minInt32Value = -10, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = SEAT_2_RIGHT, - .minInt32Value = -10, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = SEAT_2_CENTER, - .minInt32Value = -10, - .maxInt32Value = 10}}}, - .initialValue = {.int32Values = {0}}}, - - {.config = {.prop = toInt(VehicleProperty::SEAT_HEIGHT_MOVE), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = SEAT_1_LEFT, - .minInt32Value = -1, - .maxInt32Value = 1}, - VehicleAreaConfig{.areaId = SEAT_1_RIGHT, - .minInt32Value = -1, - .maxInt32Value = 1}, - VehicleAreaConfig{.areaId = SEAT_2_LEFT, - .minInt32Value = -1, - .maxInt32Value = 1}, - VehicleAreaConfig{.areaId = SEAT_2_RIGHT, - .minInt32Value = -1, - .maxInt32Value = 1}, - VehicleAreaConfig{.areaId = SEAT_2_CENTER, - .minInt32Value = -1, - .maxInt32Value = 1}}}, - .initialValue = {.int32Values = {0}}}, - - {.config = - { - .prop = toInt(VehicleProperty::SEAT_OCCUPANCY), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = (SEAT_1_LEFT)}, - VehicleAreaConfig{.areaId = (SEAT_1_RIGHT)}}, - }, - .initialAreaValues = {{SEAT_1_LEFT, - {.int32Values = {toInt(VehicleSeatOccupancyState::VACANT)}}}, - {SEAT_1_RIGHT, - {.int32Values = {toInt(VehicleSeatOccupancyState::VACANT)}}}}}, - - {.config = - { - .prop = toInt(VehicleProperty::INFO_DRIVER_SEAT), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::STATIC, - // this was a zoned property on an old vhal, but it is meant to be global - .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, - }, - .initialValue = {.int32Values = {SEAT_1_LEFT}}}, - - {.config = - { - .prop = toInt(VehicleProperty::PERF_ODOMETER), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::CONTINUOUS, - .minSampleRate = 1.0f, - .maxSampleRate = 10.0f, - }, - .initialValue = {.floatValues = {0.0f}}}, - {.config = - { - .prop = toInt(VehicleProperty::PERF_STEERING_ANGLE), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::CONTINUOUS, - .minSampleRate = 1.0f, - .maxSampleRate = 10.0f, - }, - .initialValue = {.floatValues = {0.0f}}}, - {.config = - { - .prop = toInt(VehicleProperty::PERF_REAR_STEERING_ANGLE), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::CONTINUOUS, - .minSampleRate = 1.0f, - .maxSampleRate = 10.0f, - }, - .initialValue = {.floatValues = {0.0f}}}, - { - .config = - { - .prop = toInt(VehicleProperty::ENGINE_RPM), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::CONTINUOUS, - .minSampleRate = 1.0f, - .maxSampleRate = 10.0f, - }, - .initialValue = {.floatValues = {0.0f}}, - }, - - {.config = - { - .prop = toInt(VehicleProperty::FUEL_LEVEL), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::CONTINUOUS, - .minSampleRate = 1.0f, - .maxSampleRate = 100.0f, - }, - .initialValue = {.floatValues = {15000.0f}}}, - - {.config = - { - .prop = toInt(VehicleProperty::FUEL_DOOR_OPEN), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {0}}}, - - {.config = - { - .prop = toInt(VehicleProperty::EV_BATTERY_LEVEL), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::CONTINUOUS, - .minSampleRate = 1.0f, - .maxSampleRate = 100.0f, - }, - .initialValue = {.floatValues = {150000.0f}}}, - - {.config = - { - .prop = toInt(VehicleProperty::EV_CHARGE_PORT_OPEN), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {0}}}, - - {.config = - { - .prop = toInt(VehicleProperty::EV_CHARGE_PORT_CONNECTED), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {0}}}, - - {.config = - { - .prop = toInt(VehicleProperty::EV_BATTERY_INSTANTANEOUS_CHARGE_RATE), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::CONTINUOUS, - .minSampleRate = 1.0f, - .maxSampleRate = 10.0f, - }, - .initialValue = {.floatValues = {0.0f}}}, - - {.config = - { - .prop = toInt(VehicleProperty::EV_CHARGE_CURRENT_DRAW_LIMIT), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {/*max current draw allowed by vehicle in amperes=*/20}, - }, - .initialValue = {.floatValues = {(float)12.5}}}, - - {.config = - { - .prop = toInt(VehicleProperty::EV_CHARGE_PERCENT_LIMIT), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {20, 40, 60, 80, 100}, - }, - .initialValue = {.floatValues = {40}}}, - - {.config = - { - .prop = toInt(VehicleProperty::EV_CHARGE_STATE), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {2}}}, - - {.config = - { - .prop = toInt(VehicleProperty::EV_CHARGE_SWITCH), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {0 /* false */}}}, - - {.config = - { - .prop = toInt(VehicleProperty::EV_CHARGE_TIME_REMAINING), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::CONTINUOUS, - .minSampleRate = 1.0f, - .maxSampleRate = 10.0f, - }, - .initialValue = {.int32Values = {20}}}, - - {.config = - { - .prop = toInt(VehicleProperty::EV_REGENERATIVE_BRAKING_STATE), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {2}}}, - - {.config = - { - .prop = toInt(VehicleProperty::TRAILER_PRESENT), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {2}}}, - - {.config = - { - .prop = toInt(VehicleProperty::VEHICLE_CURB_WEIGHT), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::STATIC, - .configArray = {/*gross weight kg=*/2948}, - }, - .initialValue = {.int32Values = {2211 /*kg*/}}}, - - {.config = - { - .prop = toInt(VehicleProperty::RANGE_REMAINING), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::CONTINUOUS, - .minSampleRate = 1.0f, - .maxSampleRate = 2.0f, - }, - .initialValue = {.floatValues = {50000.0f}}}, // units in meters - - {.config = - { - .prop = toInt(VehicleProperty::TIRE_PRESSURE), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::CONTINUOUS, - .areaConfigs = {VehicleAreaConfig{ - .areaId = WHEEL_FRONT_LEFT, - .minFloatValue = 193.0f, - .maxFloatValue = 300.0f, - }, - VehicleAreaConfig{ - .areaId = WHEEL_FRONT_RIGHT, - .minFloatValue = 193.0f, - .maxFloatValue = 300.0f, - }, - VehicleAreaConfig{ - .areaId = WHEEL_REAR_LEFT, - .minFloatValue = 193.0f, - .maxFloatValue = 300.0f, - }, - VehicleAreaConfig{ - .areaId = WHEEL_REAR_RIGHT, - .minFloatValue = 193.0f, - .maxFloatValue = 300.0f, - }}, - .minSampleRate = 1.0f, - .maxSampleRate = 2.0f, - }, - .initialValue = {.floatValues = {200.0f}}}, // units in kPa - - {.config = - { - .prop = toInt(VehicleProperty::CRITICALLY_LOW_TIRE_PRESSURE), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::STATIC, - .areaConfigs = {VehicleAreaConfig{.areaId = WHEEL_FRONT_LEFT}, - VehicleAreaConfig{.areaId = WHEEL_FRONT_RIGHT}, - VehicleAreaConfig{.areaId = WHEEL_REAR_RIGHT}, - VehicleAreaConfig{.areaId = WHEEL_REAR_LEFT}}, - }, - .initialAreaValues = {{WHEEL_FRONT_LEFT, {.floatValues = {137.0f}}}, - {WHEEL_FRONT_RIGHT, {.floatValues = {137.0f}}}, - {WHEEL_REAR_RIGHT, {.floatValues = {137.0f}}}, - {WHEEL_REAR_LEFT, {.floatValues = {137.0f}}}}}, - - {.config = - { - .prop = toInt(VehicleProperty::TIRE_PRESSURE_DISPLAY_UNITS), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {toInt(VehicleUnit::KILOPASCAL), toInt(VehicleUnit::PSI), - toInt(VehicleUnit::BAR)}, - }, - .initialValue = {.int32Values = {toInt(VehicleUnit::PSI)}}}, - - {.config = - { - .prop = toInt(VehicleProperty::CURRENT_GEAR), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {toInt(VehicleGear::GEAR_PARK), - toInt(VehicleGear::GEAR_NEUTRAL), - toInt(VehicleGear::GEAR_REVERSE), - toInt(VehicleGear::GEAR_1), toInt(VehicleGear::GEAR_2), - toInt(VehicleGear::GEAR_3), toInt(VehicleGear::GEAR_4), - toInt(VehicleGear::GEAR_5)}, - }, - .initialValue = {.int32Values = {toInt(VehicleGear::GEAR_PARK)}}}, - - {.config = - { - .prop = toInt(VehicleProperty::PARKING_BRAKE_ON), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {1}}}, - - {.config = - { - .prop = toInt(VehicleProperty::PARKING_BRAKE_AUTO_APPLY), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {1}}}, - - {.config = - { - .prop = toInt(VehicleProperty::FUEL_LEVEL_LOW), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {0}}}, - - {.config = - { - .prop = toInt(VehicleProperty::FUEL_VOLUME_DISPLAY_UNITS), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {(int)VehicleUnit::LITER, (int)VehicleUnit::US_GALLON}, - }, - .initialValue = {.int32Values = {(int)VehicleUnit::LITER}}}, - - {.config = - { - .prop = toInt( - VehicleProperty::FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {1}}}, - - {.config = - { - .prop = toInt(VehicleProperty::HW_KEY_INPUT), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {0, 0, 0}}}, - - {.config = - { - .prop = toInt(VehicleProperty::HW_ROTARY_INPUT), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {0, 0, 0}}}, - - {.config = - { - .prop = toInt(VehicleProperty::HW_CUSTOM_INPUT), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {0, 0, 0, 3, 0, 0, 0, 0, 0}, - }, - .initialValue = - { - .int32Values = {0, 0, 0}, - }}, - - {.config = {.prop = toInt(VehicleProperty::HVAC_POWER_ON), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}, - // TODO(bryaneyler): Ideally, this is generated dynamically from - // kHvacPowerProperties. - .configArray = {toInt(VehicleProperty::HVAC_FAN_SPEED), - toInt(VehicleProperty::HVAC_FAN_DIRECTION)}}, - .initialValue = {.int32Values = {1}}}, - - { - .config = {.prop = toInt(VehicleProperty::HVAC_DEFROSTER), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = - {VehicleAreaConfig{ - .areaId = toInt(VehicleAreaWindow::FRONT_WINDSHIELD)}, - VehicleAreaConfig{ - .areaId = toInt(VehicleAreaWindow::REAR_WINDSHIELD)}}}, - .initialValue = {.int32Values = {0}} // Will be used for all areas. - }, - { - .config = {.prop = toInt(VehicleProperty::HVAC_ELECTRIC_DEFROSTER_ON), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = - {VehicleAreaConfig{ - .areaId = toInt(VehicleAreaWindow::FRONT_WINDSHIELD)}, - VehicleAreaConfig{ - .areaId = toInt(VehicleAreaWindow::REAR_WINDSHIELD)}}}, - .initialValue = {.int32Values = {0}} // Will be used for all areas. - }, - - {.config = {.prop = toInt(VehicleProperty::HVAC_MAX_DEFROST_ON), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, - .initialValue = {.int32Values = {0}}}, - - {.config = {.prop = toInt(VehicleProperty::HVAC_RECIRC_ON), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, - .initialValue = {.int32Values = {1}}}, - - {.config = {.prop = toInt(VehicleProperty::HVAC_AUTO_RECIRC_ON), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, - .initialValue = {.int32Values = {0}}}, - - {.config = {.prop = toInt(VehicleProperty::HVAC_AC_ON), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, - .initialValue = {.int32Values = {1}}}, - - {.config = {.prop = toInt(VehicleProperty::HVAC_MAX_AC_ON), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, - .initialValue = {.int32Values = {0}}}, - - {.config = {.prop = toInt(VehicleProperty::HVAC_AUTO_ON), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, - .initialValue = {.int32Values = {1}}}, - - {.config = {.prop = toInt(VehicleProperty::HVAC_DUAL_ON), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, - .initialValue = {.int32Values = {0}}}, - - {.config = {.prop = toInt(VehicleProperty::HVAC_FAN_SPEED), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{ - .areaId = HVAC_ALL, .minInt32Value = 1, .maxInt32Value = 7}}}, - .initialValue = {.int32Values = {3}}}, - - {.config = {.prop = toInt(VehicleProperty::HVAC_FAN_DIRECTION), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, - .initialValue = {.int32Values = {toInt(VehicleHvacFanDirection::FACE)}}}, - - {.config = {.prop = toInt(VehicleProperty::HVAC_FAN_DIRECTION_AVAILABLE), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::STATIC, - .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_ALL}}}, - .initialValue = {.int32Values = {FAN_DIRECTION_FACE, FAN_DIRECTION_FLOOR, - FAN_DIRECTION_FACE | FAN_DIRECTION_FLOOR, - FAN_DIRECTION_DEFROST, - FAN_DIRECTION_FACE | FAN_DIRECTION_DEFROST, - FAN_DIRECTION_FLOOR | FAN_DIRECTION_DEFROST, - FAN_DIRECTION_FLOOR | FAN_DIRECTION_DEFROST | - FAN_DIRECTION_FACE}}}, - {.config = {.prop = toInt(VehicleProperty::HVAC_SEAT_VENTILATION), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{ - .areaId = SEAT_1_LEFT, - .minInt32Value = 0, - .maxInt32Value = 3, - }, - VehicleAreaConfig{ - .areaId = SEAT_1_RIGHT, - .minInt32Value = 0, - .maxInt32Value = 3, - }}}, - .initialValue = - {.int32Values = {0}}}, // 0 is off and +ve values indicate ventilation level. - - {.config = {.prop = toInt(VehicleProperty::HVAC_STEERING_WHEEL_HEAT), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{ - .areaId = (0), .minInt32Value = -2, .maxInt32Value = 2}}}, - .initialValue = {.int32Values = {0}}}, // +ve values for heating and -ve for cooling - - {.config = {.prop = toInt(VehicleProperty::HVAC_SEAT_TEMPERATURE), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{ - .areaId = SEAT_1_LEFT, - .minInt32Value = -2, - .maxInt32Value = 2, - }, - VehicleAreaConfig{ - .areaId = SEAT_1_RIGHT, - .minInt32Value = -2, - .maxInt32Value = 2, - }}}, - .initialValue = {.int32Values = {0}}}, // +ve values for heating and -ve for cooling - - {.config = {.prop = toInt(VehicleProperty::HVAC_SIDE_MIRROR_HEAT), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{ - .areaId = toInt(VehicleAreaMirror::DRIVER_LEFT) | - toInt(VehicleAreaMirror::DRIVER_RIGHT), - .minInt32Value = 0, - .maxInt32Value = 2, - }}}, - .initialValue = {.int32Values = {0}}}, - - {.config = {.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_SET), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {160, 280, 5, 605, 825, 10}, - .areaConfigs = {VehicleAreaConfig{ - .areaId = HVAC_LEFT, - .minFloatValue = 16, - .maxFloatValue = 32, - }, - VehicleAreaConfig{ - .areaId = HVAC_RIGHT, - .minFloatValue = 16, - .maxFloatValue = 32, - }}}, - .initialAreaValues = {{HVAC_LEFT, {.floatValues = {16}}}, - {HVAC_RIGHT, {.floatValues = {20}}}}}, - - {.config = - { - .prop = toInt(VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.floatValues = {66.2f, (float)VehicleUnit::FAHRENHEIT, 19.0f, 66.5f}}}, - - {.config = - { - .prop = toInt(VehicleProperty::ENV_OUTSIDE_TEMPERATURE), - .access = VehiclePropertyAccess::READ, - // TODO(bryaneyler): Support ON_CHANGE as well. - .changeMode = VehiclePropertyChangeMode::CONTINUOUS, - .minSampleRate = 1.0f, - .maxSampleRate = 2.0f, - }, - .initialValue = {.floatValues = {25.0f}}}, - - {.config = {.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_DISPLAY_UNITS), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {toInt(VehicleUnit::FAHRENHEIT), toInt(VehicleUnit::CELSIUS)}}, - .initialValue = {.int32Values = {toInt(VehicleUnit::FAHRENHEIT)}}}, - - {.config = - { - .prop = toInt(VehicleProperty::DISTANCE_DISPLAY_UNITS), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = (0)}}, - .configArray = {toInt(VehicleUnit::KILOMETER), toInt(VehicleUnit::MILE)}, - }, - .initialValue = {.int32Values = {toInt(VehicleUnit::MILE)}}}, - - {.config = - { - .prop = toInt(VehicleProperty::NIGHT_MODE), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {0}}}, - - {.config = - { - .prop = toInt(VehicleProperty::GEAR_SELECTION), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {toInt(VehicleGear::GEAR_PARK), - toInt(VehicleGear::GEAR_NEUTRAL), - toInt(VehicleGear::GEAR_REVERSE), - toInt(VehicleGear::GEAR_DRIVE), toInt(VehicleGear::GEAR_1), - toInt(VehicleGear::GEAR_2), toInt(VehicleGear::GEAR_3), - toInt(VehicleGear::GEAR_4), toInt(VehicleGear::GEAR_5)}, - }, - .initialValue = {.int32Values = {toInt(VehicleGear::GEAR_PARK)}}}, - - {.config = - { - .prop = toInt(VehicleProperty::TURN_SIGNAL_STATE), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {toInt(VehicleTurnSignal::NONE)}}}, - - {.config = - { - .prop = toInt(VehicleProperty::IGNITION_STATE), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {toInt(VehicleIgnitionState::ON)}}}, - - {.config = - { - .prop = toInt(VehicleProperty::ENGINE_COOLANT_TEMP), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::CONTINUOUS, - .minSampleRate = 1.0f, - .maxSampleRate = 10.0f, - }, - .initialValue = {.floatValues = {75.0f}}}, - - {.config = - { - .prop = toInt(VehicleProperty::ENGINE_OIL_LEVEL), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {toInt(VehicleOilLevel::NORMAL)}}}, - - {.config = - { - .prop = toInt(VehicleProperty::ENGINE_OIL_TEMP), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::CONTINUOUS, - .minSampleRate = 0.1, // 0.1 Hz, every 10 seconds - .maxSampleRate = 10, // 10 Hz, every 100 ms - }, - .initialValue = {.floatValues = {101.0f}}}, - - { - .config = {.prop = kMixedTypePropertyForTest, - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {1, 1, 0, 2, 0, 0, 1, 0, 0}}, - .initialValue = - { - .int32Values = {1 /* indicate TRUE boolean value */, 2, 3}, - .floatValues = {4.5f}, - .stringValue = "MIXED property", - }, - }, - - {.config = {.prop = toInt(VehicleProperty::DOOR_LOCK), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = DOOR_1_LEFT}, - VehicleAreaConfig{.areaId = DOOR_1_RIGHT}, - VehicleAreaConfig{.areaId = DOOR_2_LEFT}, - VehicleAreaConfig{.areaId = DOOR_2_RIGHT}}}, - .initialAreaValues = {{DOOR_1_LEFT, {.int32Values = {1}}}, - {DOOR_1_RIGHT, {.int32Values = {1}}}, - {DOOR_2_LEFT, {.int32Values = {1}}}, - {DOOR_2_RIGHT, {.int32Values = {1}}}}}, - - {.config = {.prop = toInt(VehicleProperty::DOOR_POS), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = - {VehicleAreaConfig{ - .areaId = DOOR_1_LEFT, .minInt32Value = 0, .maxInt32Value = 1}, - VehicleAreaConfig{.areaId = DOOR_1_RIGHT, - .minInt32Value = 0, - .maxInt32Value = 1}, - VehicleAreaConfig{ - .areaId = DOOR_2_LEFT, .minInt32Value = 0, .maxInt32Value = 1}, - VehicleAreaConfig{.areaId = DOOR_2_RIGHT, - .minInt32Value = 0, - .maxInt32Value = 1}, - VehicleAreaConfig{ - .areaId = DOOR_REAR, .minInt32Value = 0, .maxInt32Value = 1}}}, - .initialValue = {.int32Values = {0}}}, - - {.config = {.prop = toInt(VehicleProperty::WINDOW_LOCK), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = WINDOW_1_RIGHT | WINDOW_2_LEFT | - WINDOW_2_RIGHT}}}, - .initialAreaValues = {{WINDOW_1_RIGHT | WINDOW_2_LEFT | WINDOW_2_RIGHT, - {.int32Values = {0}}}}}, - - {.config = {.prop = toInt(VehicleProperty::WINDOW_POS), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = WINDOW_1_LEFT, - .minInt32Value = 0, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = WINDOW_1_RIGHT, - .minInt32Value = 0, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = WINDOW_2_LEFT, - .minInt32Value = 0, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = WINDOW_2_RIGHT, - .minInt32Value = 0, - .maxInt32Value = 10}, - VehicleAreaConfig{.areaId = WINDOW_ROOF_TOP_1, - .minInt32Value = -10, - .maxInt32Value = 10}}}, - .initialValue = {.int32Values = {0}}}, - - {.config = - { - .prop = WHEEL_TICK, - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::CONTINUOUS, - .configArray = {ALL_WHEELS, 50000, 50000, 50000, 50000}, - .minSampleRate = 1.0f, - .maxSampleRate = 10.0f, - }, - .initialValue = {.int64Values = {0, 100000, 200000, 300000, 400000}}}, - - {.config = {.prop = ABS_ACTIVE, - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, - .initialValue = {.int32Values = {0}}}, - - {.config = {.prop = TRACTION_CONTROL_ACTIVE, - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, - .initialValue = {.int32Values = {0}}}, - - {.config = {.prop = toInt(VehicleProperty::AP_POWER_STATE_REQ), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {0}}}, - - {.config = {.prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, - .initialValue = {.int32Values = {toInt(VehicleApPowerStateReport::WAIT_FOR_VHAL), 0}}}, - - {.config = {.prop = toInt(VehicleProperty::DISPLAY_BRIGHTNESS), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.minInt32Value = 0, .maxInt32Value = 100}}}, - .initialValue = {.int32Values = {100}}}, - - { - .config = {.prop = OBD2_LIVE_FRAME, - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {0, 0}}, - }, - - { - .config = {.prop = OBD2_FREEZE_FRAME, - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {0, 0}}, - }, - - { - .config = {.prop = OBD2_FREEZE_FRAME_INFO, - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, - }, - - { - .config = {.prop = OBD2_FREEZE_FRAME_CLEAR, - .access = VehiclePropertyAccess::WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {1}}, - }, - - {.config = - { - .prop = toInt(VehicleProperty::HEADLIGHTS_STATE), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, - - {.config = - { - .prop = toInt(VehicleProperty::HIGH_BEAM_LIGHTS_STATE), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, - - {.config = - { - .prop = toInt(VehicleProperty::FRONT_FOG_LIGHTS_STATE), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, - - {.config = - { - .prop = toInt(VehicleProperty::REAR_FOG_LIGHTS_STATE), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, - - {.config = - { - .prop = toInt(VehicleProperty::HAZARD_LIGHTS_STATE), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {LIGHT_STATE_ON}}}, - - {.config = - { - .prop = toInt(VehicleProperty::HEADLIGHTS_SWITCH), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, - - {.config = - { - .prop = toInt(VehicleProperty::HIGH_BEAM_LIGHTS_SWITCH), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, - - // FOG_LIGHTS_SWITCH must not be implemented when FRONT_FOG_LIGHTS_SWITCH is implemented - {.config = - { - .prop = toInt(VehicleProperty::FRONT_FOG_LIGHTS_SWITCH), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, - - // FOG_LIGHTS_SWITCH must not be implemented when REAR_FOG_LIGHTS_SWITCH is implemented - {.config = - { - .prop = toInt(VehicleProperty::REAR_FOG_LIGHTS_SWITCH), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, - - {.config = - { - .prop = toInt(VehicleProperty::HAZARD_LIGHTS_SWITCH), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {LIGHT_SWITCH_AUTO}}}, - - {.config = - { - .prop = toInt(VehicleProperty::EVS_SERVICE_REQUEST), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {toInt(EvsServiceType::REARVIEW), - toInt(EvsServiceState::OFF)}}}, - - {.config = {.prop = VEHICLE_MAP_SERVICE, - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE}}, - - // Example Vendor Extension properties for testing - {.config = {.prop = VENDOR_EXTENSION_BOOLEAN_PROPERTY, - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = DOOR_1_LEFT}, - VehicleAreaConfig{.areaId = DOOR_1_RIGHT}, - VehicleAreaConfig{.areaId = DOOR_2_LEFT}, - VehicleAreaConfig{.areaId = DOOR_2_RIGHT}}}, - .initialAreaValues = {{DOOR_1_LEFT, {.int32Values = {1}}}, - {DOOR_1_RIGHT, {.int32Values = {1}}}, - {DOOR_2_LEFT, {.int32Values = {0}}}, - {DOOR_2_RIGHT, {.int32Values = {0}}}}}, - - {.config = {.prop = VENDOR_EXTENSION_FLOAT_PROPERTY, - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = {VehicleAreaConfig{.areaId = HVAC_LEFT, - .minFloatValue = -10, - .maxFloatValue = 10}, - VehicleAreaConfig{.areaId = HVAC_RIGHT, - .minFloatValue = -10, - .maxFloatValue = 10}}}, - .initialAreaValues = {{HVAC_LEFT, {.floatValues = {1}}}, - {HVAC_RIGHT, {.floatValues = {2}}}}}, - - {.config = {.prop = VENDOR_EXTENSION_INT_PROPERTY, - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .areaConfigs = - {VehicleAreaConfig{.areaId = toInt(VehicleAreaWindow::FRONT_WINDSHIELD), - .minInt32Value = -100, - .maxInt32Value = 100}, - VehicleAreaConfig{.areaId = toInt(VehicleAreaWindow::REAR_WINDSHIELD), - .minInt32Value = -100, - .maxInt32Value = 100}, - VehicleAreaConfig{.areaId = toInt(VehicleAreaWindow::ROOF_TOP_1), - .minInt32Value = -100, - .maxInt32Value = 100}}}, - .initialAreaValues = {{toInt(VehicleAreaWindow::FRONT_WINDSHIELD), {.int32Values = {1}}}, - {toInt(VehicleAreaWindow::REAR_WINDSHIELD), {.int32Values = {0}}}, - {toInt(VehicleAreaWindow::ROOF_TOP_1), {.int32Values = {-1}}}}}, - - {.config = {.prop = VENDOR_EXTENSION_STRING_PROPERTY, - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, - .initialValue = {.stringValue = "Vendor String Property"}}, - - {.config = {.prop = toInt(VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_TYPE), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, - .initialValue = {.int32Values = {0}}}, - - {.config = {.prop = toInt(VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_STATUS), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE}, - .initialValue = {.int32Values = {0}}}, - - {.config = - { - .prop = toInt(VehicleProperty::SUPPORT_CUSTOMIZE_VENDOR_PERMISSION), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::STATIC, - .configArray = {kMixedTypePropertyForTest, - toInt(VehicleVendorPermission:: - PERMISSION_GET_VENDOR_CATEGORY_INFO), - toInt(VehicleVendorPermission:: - PERMISSION_SET_VENDOR_CATEGORY_INFO), - VENDOR_EXTENSION_INT_PROPERTY, - toInt(VehicleVendorPermission:: - PERMISSION_GET_VENDOR_CATEGORY_SEAT), - toInt(VehicleVendorPermission::PERMISSION_NOT_ACCESSIBLE), - VENDOR_EXTENSION_FLOAT_PROPERTY, - toInt(VehicleVendorPermission::PERMISSION_DEFAULT), - toInt(VehicleVendorPermission::PERMISSION_DEFAULT)}, - }, - .initialValue = {.int32Values = {1}}}, - - { - .config = - { - .prop = toInt(VehicleProperty::INITIAL_USER_INFO), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - }, - { - .config = - { - .prop = toInt(VehicleProperty::SWITCH_USER), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - }, - { - .config = - { - .prop = toInt(VehicleProperty::CREATE_USER), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - }, - { - .config = - { - .prop = toInt(VehicleProperty::REMOVE_USER), - .access = VehiclePropertyAccess::WRITE, - .changeMode = VehiclePropertyChangeMode::STATIC, - }, - }, - { - .config = - { - .prop = toInt(VehicleProperty::USER_IDENTIFICATION_ASSOCIATION), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - }, - { - .config = - { - .prop = toInt(VehicleProperty::POWER_POLICY_REQ), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - }, - { - .config = - { - .prop = toInt(VehicleProperty::POWER_POLICY_GROUP_REQ), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - }, - { - .config = - { - .prop = toInt(VehicleProperty::CURRENT_POWER_POLICY), - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - }, - { - .config = - { - .prop = toInt(VehicleProperty::ANDROID_EPOCH_TIME), - .access = VehiclePropertyAccess::WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - }, - { - .config = - { - .prop = toInt(VehicleProperty::WATCHDOG_ALIVE), - .access = VehiclePropertyAccess::WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - }, - { - .config = - { - .prop = toInt(VehicleProperty::WATCHDOG_TERMINATED_PROCESS), - .access = VehiclePropertyAccess::WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - }, - { - .config = - { - .prop = toInt(VehicleProperty::VHAL_HEARTBEAT), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - }, - { - .config = - { - .prop = toInt(VehicleProperty::CLUSTER_SWITCH_UI), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {0 /* ClusterHome */}}, - }, - { - .config = - { - .prop = toInt(VehicleProperty::CLUSTER_DISPLAY_STATE), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {0 /* Off */, -1, -1, -1, -1 /* Bounds */, -1, -1, - -1, -1 /* Insets */}}, - }, - { - .config = - { - .prop = toInt(VehicleProperty::CLUSTER_REPORT_STATE), - .access = VehiclePropertyAccess::WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {0, 0, 0, 11, 0, 0, 0, 0, 16}, - }, - }, - { - .config = - { - .prop = toInt(VehicleProperty::CLUSTER_REQUEST_DISPLAY), - .access = VehiclePropertyAccess::WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - }, - { - .config = - { - .prop = toInt(VehicleProperty::CLUSTER_NAVIGATION_STATE), - .access = VehiclePropertyAccess::WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - }, - { - .config = - { - .prop = PLACEHOLDER_PROPERTY_INT, - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {0}}, - }, - { - .config = - { - .prop = PLACEHOLDER_PROPERTY_FLOAT, - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.floatValues = {0.0f}}, - }, - { - .config = - { - .prop = PLACEHOLDER_PROPERTY_BOOLEAN, - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {0 /* false */}}, - }, - { - .config = - { - .prop = PLACEHOLDER_PROPERTY_STRING, - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.stringValue = {"Test"}}, - }, - { - .config = - { - .prop = ECHO_REVERSE_BYTES, - .access = VehiclePropertyAccess::READ_WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - }, - { - .config = - { - .prop = toInt( - VehicleProperty:: - GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT), - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::STATIC, - }, - .initialValue = {.int32Values = {toInt( - GsrComplianceRequirementType:: - GSR_COMPLIANCE_REQUIRED_THROUGH_SYSTEM_IMAGE)}}, - }, -#ifdef ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING - // Vendor propetry for E2E ClusterHomeService testing. - { - .config = - { - .prop = VENDOR_CLUSTER_SWITCH_UI, - .access = VehiclePropertyAccess::WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - }, - { - .config = - { - .prop = VENDOR_CLUSTER_DISPLAY_STATE, - .access = VehiclePropertyAccess::WRITE, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - }, - { - .config = - { - .prop = VENDOR_CLUSTER_REPORT_STATE, - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - .configArray = {0, 0, 0, 11, 0, 0, 0, 0, 16}, - }, - .initialValue = {.int32Values = {0 /* Off */, -1, -1, -1, -1 /* Bounds */, -1, -1, - -1, -1 /* Insets */, 0 /* ClusterHome */, - -1 /* ClusterNone */}}, - }, - { - .config = - { - .prop = VENDOR_CLUSTER_REQUEST_DISPLAY, - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - .initialValue = {.int32Values = {0 /* ClusterHome */}}, - }, - { - .config = - { - .prop = VENDOR_CLUSTER_NAVIGATION_STATE, - .access = VehiclePropertyAccess::READ, - .changeMode = VehiclePropertyChangeMode::ON_CHANGE, - }, - }, -#endif // ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING -}; - -} // namespace defaultconfig_impl - -// public namespace -namespace defaultconfig { - -inline constexpr const std::vector& getDefaultConfigs() { - return defaultconfig_impl::kVehicleProperties; -} - -} // namespace defaultconfig - -} // namespace vehicle -} // namespace automotive -} // namespace hardware -} // namespace android - -#endif // android_hardware_automotive_vehicle_aidl_impl_default_config_include_DefaultConfig_H_ From 547817a1b76faecc49af8b2b72f71e5fcad00ef6 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 29 Jul 2022 22:53:27 +0000 Subject: [PATCH 197/998] Remove sensors HIDL entry in compat matrix. This interface has been converted to AIDL. Test: TH Bug: 218588089 Change-Id: I68265bee97e1bf43f1cb28fcf66b7c8bedbeeffb --- compatibility_matrices/compatibility_matrix.current.xml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 35cd6f0e2c..ffc268ed1a 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -599,15 +599,6 @@ default - - android.hardware.sensors - 1.0 - 2.0-1 - - ISensors - default - - android.hardware.soundtrigger3 1 From 5e508737934feb595c841430f41b5edb1d1925d5 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 10 Aug 2022 21:20:08 +0000 Subject: [PATCH 198/998] Use a different timesource in recurrent timer. Previously we used elapsedRealtimeNanos in recurrent timer which will still go even if the system is in deep sleep. This causes all the events "happened" during suspension to be replayed immediately after the wake up, which causes a spam of messages. uptimeNanos meanwhile, does not go if the system is in sleep, so we use that instead. Test: atest VehicleHalVehicleUtilsTest Bug: 235262127 Change-Id: Ib67c2e2251af3231cefd875416d5bcb15953ba5e --- .../vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp b/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp index fbc79fa26a..43f5d69467 100644 --- a/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp +++ b/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp @@ -50,7 +50,7 @@ void RecurrentTimer::registerTimerCallback(int64_t intervalInNano, std::scoped_lock lockGuard(mLock); // Aligns the nextTime to multiply of interval. - int64_t nextTime = ceil(elapsedRealtimeNano() / intervalInNano) * intervalInNano; + int64_t nextTime = ceil(uptimeNanos() / intervalInNano) * intervalInNano; std::unique_ptr info = std::make_unique(); info->callback = callback; @@ -130,7 +130,7 @@ void RecurrentTimer::loop() { } // The first element is the nearest next event. int64_t nextTime = mCallbackQueue[0]->nextTime; - int64_t now = elapsedRealtimeNano(); + int64_t now = uptimeNanos(); if (nextTime > now) { interval = nextTime - now; } else { @@ -148,7 +148,7 @@ void RecurrentTimer::loop() { { ScopedLockAssertion lockAssertion(mLock); - int64_t now = elapsedRealtimeNano(); + int64_t now = uptimeNanos(); while (mCallbackQueue.size() > 0) { int64_t nextTime = mCallbackQueue[0]->nextTime; if (nextTime > now) { From 523e5455fd786658d179406dbc3e765310150dbe Mon Sep 17 00:00:00 2001 From: Frankie Lizcano Date: Wed, 27 Jul 2022 22:21:16 +0000 Subject: [PATCH 199/998] Tuner HAL VTS: Added LnbDescrambling This CL implements a new dataflow: LnbDescrambling, which aims to test descrambling a broadcast brought into the tuner with an Lnb attached. The struct for the configuration and a function to read this dataflow from the vendor's input file were added. Additionally, the api was updated to allow the automatic xml parser to read this new dataflow. Note, no tests were added for this object yet. Those come later in the chain. The vendor, at this moment, can only harcode this dataflow. It will be dynamically configurable later in the chain. Bug: b/240476983 Test: ts-tradefed run vts --module VtsHalTvTunerTargetTest Change-Id: I545be7d4b2bea0b80a67fd542a80bba7fa38c4ca --- .../VtsHalTvTunerTestConfigurations.h | 24 ++++++++++++++ .../config/TunerTestingConfigAidlReaderV1_0.h | 33 +++++++++++++++++++ tv/tuner/config/api/current.txt | 18 ++++++++++ .../tuner_testing_dynamic_configuration.xsd | 10 ++++++ 4 files changed, 85 insertions(+) diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h index 36b76467e8..2132994a38 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h @@ -74,6 +74,7 @@ static DescramblingHardwareConnections descrambling; static LnbLiveHardwareConnections lnbLive; static LnbRecordHardwareConnections lnbRecord; static TimeFilterHardwareConnections timeFilter; +static LnbDescramblingHardwareConnections lnbDescrambling; /* * This function takes in a 2d vector of device Id's @@ -730,6 +731,7 @@ inline void connectHardwaresToTestCases() { TunerTestingConfigAidlReader1_0::connectLnbLive(lnbLive); TunerTestingConfigAidlReader1_0::connectLnbRecord(lnbRecord); TunerTestingConfigAidlReader1_0::connectDvrPlayback(playback); + TunerTestingConfigAidlReader1_0::connectLnbDescrambling(lnbDescrambling); }; inline void determineDataFlows() { @@ -766,6 +768,10 @@ inline bool validateConnections() { feIsValid &= lnbRecord.support ? frontendMap.find(lnbRecord.frontendId) != frontendMap.end() : true; + feIsValid &= lnbDescrambling.support + ? frontendMap.find(lnbDescrambling.frontendId) != frontendMap.end() + : true; + if (!feIsValid) { ALOGW("[vts config] dynamic config fe connection is invalid."); return false; @@ -850,6 +856,12 @@ inline bool validateConnections() { playback.hasExtraFilters ? filterMap.find(filterId) != filterMap.end() : true; } + filterIsValid &= + lnbDescrambling.support + ? filterMap.find(lnbDescrambling.audioFilterId) != filterMap.end() && + filterMap.find(lnbDescrambling.videoFilterId) != filterMap.end() + : true; + if (!filterIsValid) { ALOGW("[vts config] dynamic config filter connection is invalid."); return false; @@ -880,6 +892,11 @@ inline bool validateConnections() { ? descramblerMap.find(descrambling.descramblerId) != descramblerMap.end() : true; + descramblerIsValid &= + lnbDescrambling.support + ? descramblerMap.find(lnbDescrambling.descramblerId) != descramblerMap.end() + : true; + if (!descramblerIsValid) { ALOGW("[vts config] dynamic config descrambler connection is invalid."); return false; @@ -889,6 +906,9 @@ inline bool validateConnections() { lnbIsValid &= lnbRecord.support ? lnbMap.find(lnbRecord.lnbId) != lnbMap.end() : true; + lnbIsValid &= + lnbDescrambling.support ? lnbMap.find(lnbDescrambling.lnbId) != lnbMap.end() : true; + if (!lnbIsValid) { ALOGW("[vts config] dynamic config lnb connection is invalid."); return false; @@ -904,6 +924,10 @@ inline bool validateConnections() { diseqcMsgsIsValid &= diseqcMsgMap.find(msg) != diseqcMsgMap.end(); } + for (auto& msg : lnbDescrambling.diseqcMsgs) { + diseqcMsgsIsValid &= diseqcMsgMap.find(msg) != diseqcMsgMap.end(); + } + if (!diseqcMsgsIsValid) { ALOGW("[vts config] dynamic config diseqcMsg is invalid."); return false; diff --git a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h index bf3745c74e..9517520c18 100644 --- a/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h +++ b/tv/tuner/config/TunerTestingConfigAidlReaderV1_0.h @@ -73,6 +73,7 @@ static bool configuredPlayback = false; static bool configuredLnbRecord = false; static bool configuredTimeFilter = false; static bool configuredDescrambling = false; +static bool configuredLnbDescrambling = false; const string emptyHardwareId = ""; @@ -229,6 +230,16 @@ struct TimeFilterHardwareConnections { string timeFilterId; }; +struct LnbDescramblingHardwareConnections { + bool support; + string frontendId; + string audioFilterId; + string videoFilterId; + string lnbId; + string descramblerId; + vector diseqcMsgs; +}; + struct TunerTestingConfigAidlReader1_0 { public: static void setConfigFilePath(string path) { mConfigFilePath = path; } @@ -705,6 +716,28 @@ struct TunerTestingConfigAidlReader1_0 { timeFilter.timeFilterId = timeFilterConfig.getTimeFilterConnection(); } + static void connectLnbDescrambling(LnbDescramblingHardwareConnections& lnbDescrambling) { + auto dataFlow = getDataFlowConfiguration(); + if (dataFlow.hasLnbDescrambling()) { + lnbDescrambling.support = true; + configuredLnbDescrambling = true; + } else { + lnbDescrambling.support = false; + return; + } + auto lnbDescramblingConfig = *dataFlow.getFirstLnbDescrambling(); + lnbDescrambling.frontendId = lnbDescramblingConfig.getFrontendConnection(); + lnbDescrambling.audioFilterId = lnbDescramblingConfig.getAudioFilterConnection(); + lnbDescrambling.videoFilterId = lnbDescramblingConfig.getVideoFilterConnection(); + lnbDescrambling.lnbId = lnbDescramblingConfig.getLnbConnection(); + lnbDescrambling.descramblerId = lnbDescramblingConfig.getDescramblerConnection(); + if (lnbDescramblingConfig.hasDiseqcMsgSender()) { + for (auto& msgName : lnbDescramblingConfig.getDiseqcMsgSender()) { + lnbDescrambling.diseqcMsgs.push_back(msgName); + } + } + } + private: static FrontendDvbtSettings readDvbtFrontendSettings(Frontend feConfig) { ALOGW("[ConfigReader] fe type is dvbt"); diff --git a/tv/tuner/config/api/current.txt b/tv/tuner/config/api/current.txt index 79efb1b021..dbd3486e67 100644 --- a/tv/tuner/config/api/current.txt +++ b/tv/tuner/config/api/current.txt @@ -27,6 +27,7 @@ package android.media.tuner.testing.configuration.V1_0 { method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.Descrambling getDescrambling(); method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.DvrPlayback getDvrPlayback(); method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.DvrRecord getDvrRecord(); + method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.LnbDescrambling getLnbDescrambling(); method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.LnbLive getLnbLive(); method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.LnbRecord getLnbRecord(); method @Nullable public android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.Scan getScan(); @@ -35,6 +36,7 @@ package android.media.tuner.testing.configuration.V1_0 { method public void setDescrambling(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.Descrambling); method public void setDvrPlayback(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.DvrPlayback); method public void setDvrRecord(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.DvrRecord); + method public void setLnbDescrambling(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.LnbDescrambling); method public void setLnbLive(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.LnbLive); method public void setLnbRecord(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.LnbRecord); method public void setScan(@Nullable android.media.tuner.testing.configuration.V1_0.DataFlowConfiguration.Scan); @@ -111,6 +113,22 @@ package android.media.tuner.testing.configuration.V1_0 { method public void setRecordFilterConnection(@Nullable String); } + public static class DataFlowConfiguration.LnbDescrambling { + ctor public DataFlowConfiguration.LnbDescrambling(); + method @Nullable public String getAudioFilterConnection(); + method @Nullable public String getDescramblerConnection(); + method @Nullable public java.util.List getDiseqcMsgSender(); + method @Nullable public String getFrontendConnection(); + method @Nullable public String getLnbConnection(); + method @Nullable public String getVideoFilterConnection(); + method public void setAudioFilterConnection(@Nullable String); + method public void setDescramblerConnection(@Nullable String); + method public void setDiseqcMsgSender(@Nullable java.util.List); + method public void setFrontendConnection(@Nullable String); + method public void setLnbConnection(@Nullable String); + method public void setVideoFilterConnection(@Nullable String); + } + public static class DataFlowConfiguration.LnbLive { ctor public DataFlowConfiguration.LnbLive(); method @Nullable public String getAudioFilterConnection(); diff --git a/tv/tuner/config/tuner_testing_dynamic_configuration.xsd b/tv/tuner/config/tuner_testing_dynamic_configuration.xsd index e0f2579135..c51ac5183c 100644 --- a/tv/tuner/config/tuner_testing_dynamic_configuration.xsd +++ b/tv/tuner/config/tuner_testing_dynamic_configuration.xsd @@ -726,6 +726,16 @@ + + + + + + + + + + From 82101d2d5b942321b62ce2d4b4ae997d6b5f8ff8 Mon Sep 17 00:00:00 2001 From: Frankie Lizcano Date: Thu, 28 Jul 2022 00:12:35 +0000 Subject: [PATCH 200/998] Tuner HAL VTS: Testing LnbDescrambling This CL implements integration tests for LnbDescrambling. The new testing function ScrambledBroadcastTestWithLnb tests the functionality of the Lnb and, if the frontend is not software, tests passing a signal through the tuner and descrambling a broadcast. Additionally, this CL adds a context variable to the ScrambledBroadcastTest function to determine which dataflow (LnbDescrambling or Descrambling) is being tested. It specializes behavior differently for each datflow to model real world use cases. Notably, a Descrambler could be tested with no frontend when playing back a descrambled recording, whereas testing an Lnb broadcast would require a hardware frontend. Bug: b/240476983 Test: ts-tradefed run vts --module VtsHalTvTunerTargetTest Change-Id: Ia35d2d45dca4411b0a15f0585d6ddaecd3f9321a --- .../functional/VtsHalTvTunerTargetTest.cpp | 126 ++++++++++++++---- .../vts/functional/VtsHalTvTunerTargetTest.h | 13 +- .../sample_tuner_vts_config_aidl_V1.xml | 7 +- 3 files changed, 117 insertions(+), 29 deletions(-) diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp index 4d176ab86d..f78e508d6e 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp @@ -428,28 +428,45 @@ void TunerRecordAidlTest::recordSingleFilterTest(FilterConfig filterConf, void TunerDescramblerAidlTest::scrambledBroadcastTest(set mediaFilterConfs, FrontendConfig frontendConf, - DescramblerConfig descConfig) { + DescramblerConfig descConfig, + Dataflow_Context context) { int32_t demuxId; std::shared_ptr demux; ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); DvrConfig dvrSourceConfig; - if (descrambling.hasFrontendConnection) { + if (context == Dataflow_Context::DESCRAMBLING) { + if (descrambling.hasFrontendConnection) { + int32_t feId; + mFrontendTests.getFrontendIdByType(frontendConf.type, feId); + ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); + ASSERT_TRUE(mFrontendTests.setFrontendCallback()); + if (frontendConf.isSoftwareFe) { + mFrontendTests.setSoftwareFrontendDvrConfig(dvrMap[descrambling.dvrSoftwareFeId]); + } + ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); + mFrontendTests.setDemux(demux); + } else { + dvrSourceConfig = dvrMap[descrambling.dvrSourceId]; + mDvrTests.setDemux(demux); + ASSERT_TRUE(mDvrTests.openDvrInDemux(dvrSourceConfig.type, dvrSourceConfig.bufferSize)); + ASSERT_TRUE(mDvrTests.configDvrPlayback(dvrSourceConfig.settings)); + ASSERT_TRUE(mDvrTests.getDvrPlaybackMQDescriptor()); + } + } else if (context == Dataflow_Context::LNBDESCRAMBLING) { int32_t feId; mFrontendTests.getFrontendIdByType(frontendConf.type, feId); ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); ASSERT_TRUE(mFrontendTests.setFrontendCallback()); - if (frontendConf.isSoftwareFe) { - mFrontendTests.setSoftwareFrontendDvrConfig(dvrMap[descrambling.dvrSoftwareFeId]); + if (mLnbId != INVALID_LNB_ID) { + ASSERT_TRUE(mFrontendTests.setLnb(mLnbId)); + } else { + // If, for some reason, the test got here without failing. We fail it here. + ALOGD("mLnbId is null. Something went wrong. Exiting ScrambledBroadcastWithLnbId."); + FAIL(); } ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); mFrontendTests.setDemux(demux); - } else { - dvrSourceConfig = dvrMap[descrambling.dvrSourceId]; - mDvrTests.setDemux(demux); - ASSERT_TRUE(mDvrTests.openDvrInDemux(dvrSourceConfig.type, dvrSourceConfig.bufferSize)); - ASSERT_TRUE(mDvrTests.configDvrPlayback(dvrSourceConfig.settings)); - ASSERT_TRUE(mDvrTests.getDvrPlaybackMQDescriptor()); } set filterIds; @@ -480,24 +497,32 @@ void TunerDescramblerAidlTest::scrambledBroadcastTest(set m ASSERT_TRUE(mFilterTests.startFilter(*id)); } - if (descrambling.hasFrontendConnection) { - // tune test + if (context == Dataflow_Context::DESCRAMBLING) { + if (descrambling.hasFrontendConnection) { + // tune test + ASSERT_TRUE(mFrontendTests.tuneFrontend(frontendConf, true /*testWithDemux*/)); + } else { + // Start DVR Source + mDvrTests.startPlaybackInputThread( + dvrSourceConfig.playbackInputFile, + dvrSourceConfig.settings.get()); + ASSERT_TRUE(mDvrTests.startDvrPlayback()); + } + } else if (context == Dataflow_Context::LNBDESCRAMBLING) { ASSERT_TRUE(mFrontendTests.tuneFrontend(frontendConf, true /*testWithDemux*/)); - } else { - // Start DVR Source - mDvrTests.startPlaybackInputThread( - dvrSourceConfig.playbackInputFile, - dvrSourceConfig.settings.get()); - ASSERT_TRUE(mDvrTests.startDvrPlayback()); } ASSERT_TRUE(filterDataOutputTest()); - if (descrambling.hasFrontendConnection) { + if (context == Dataflow_Context::DESCRAMBLING) { + if (descrambling.hasFrontendConnection) { + ASSERT_TRUE(mFrontendTests.stopTuneFrontend(true /*testWithDemux*/)); + } else { + mDvrTests.stopPlaybackThread(); + ASSERT_TRUE(mDvrTests.stopDvrPlayback()); + } + } else if (context == Dataflow_Context::LNBDESCRAMBLING) { ASSERT_TRUE(mFrontendTests.stopTuneFrontend(true /*testWithDemux*/)); - } else { - mDvrTests.stopPlaybackThread(); - ASSERT_TRUE(mDvrTests.stopDvrPlayback()); } for (id = filterIds.begin(); id != filterIds.end(); id++) { @@ -511,15 +536,50 @@ void TunerDescramblerAidlTest::scrambledBroadcastTest(set m ASSERT_TRUE(mFilterTests.closeFilter(*id)); } - if (descrambling.hasFrontendConnection) { + if (context == Dataflow_Context::DESCRAMBLING) { + if (descrambling.hasFrontendConnection) { + ASSERT_TRUE(mFrontendTests.closeFrontend()); + } else { + mDvrTests.closeDvrPlayback(); + } + } else if (context == Dataflow_Context::LNBDESCRAMBLING) { ASSERT_TRUE(mFrontendTests.closeFrontend()); - } else { - mDvrTests.closeDvrPlayback(); } ASSERT_TRUE(mDemuxTests.closeDemux()); } +void TunerDescramblerAidlTest::scrambledBroadcastTestWithLnb( + set& mediaFilterConfs, FrontendConfig& frontendConf, + DescramblerConfig& descConfig, LnbConfig& lnbConfig) { + // We can test the Lnb individually and make sure it functions properly. If the frontend is + // software, we cannot test the whole dataflow. If the frontend is hardware, we can + if (lnbConfig.name.compare(emptyHardwareId) == 0) { + vector ids; + ASSERT_TRUE(mLnbTests.getLnbIds(ids)); + ASSERT_TRUE(ids.size() > 0); + ASSERT_TRUE(mLnbTests.openLnbById(ids[0])); + mLnbId = ids[0]; + } else { + ASSERT_TRUE(mLnbTests.openLnbByName(lnbConfig.name, mLnbId)); + } + // Once Lnb is opened, test some of its basic functionality + ASSERT_TRUE(mLnbTests.setLnbCallback()); + ASSERT_TRUE(mLnbTests.setVoltage(lnbConfig.voltage)); + ASSERT_TRUE(mLnbTests.setTone(lnbConfig.tone)); + ASSERT_TRUE(mLnbTests.setSatellitePosition(lnbConfig.position)); + if (!frontendConf.isSoftwareFe) { + ALOGD("Frontend is not software, testing entire dataflow."); + scrambledBroadcastTest(mediaFilterConfs, frontendConf, descConfig, + Dataflow_Context::LNBDESCRAMBLING); + } else { + ALOGD("Frontend is software, did not test the entire dataflow, but tested the Lnb " + "individually."); + } + ASSERT_TRUE(mLnbTests.closeLnb()); + mLnbId = INVALID_LNB_ID; +} + TEST_P(TunerLnbAidlTest, SendDiseqcMessageToLnb) { description("Open and configure an Lnb with specific settings then send a diseqc msg to it."); if (!lnbLive.support) { @@ -1227,10 +1287,24 @@ TEST_P(TunerDescramblerAidlTest, ScrambledBroadcastDataFlowMediaFiltersTest) { filterConfs.insert(static_cast(filterMap[descrambling.audioFilterId])); filterConfs.insert(static_cast(filterMap[descrambling.videoFilterId])); scrambledBroadcastTest(filterConfs, frontendMap[descrambling.frontendId], - descramblerMap[descrambling.descramblerId]); + descramblerMap[descrambling.descramblerId], + Dataflow_Context::DESCRAMBLING); } } +TEST_P(TunerDescramblerAidlTest, ScrambledBroadcastDataFlowMediaFiltersTestWithLnb) { + description("Test media filters in scrambled broadcast use case with Lnb"); + if (!lnbDescrambling.support) { + return; + } + set filterConfs; + filterConfs.insert(static_cast(filterMap[lnbDescrambling.audioFilterId])); + filterConfs.insert(static_cast(filterMap[lnbDescrambling.videoFilterId])); + scrambledBroadcastTestWithLnb(filterConfs, frontendMap[lnbDescrambling.frontendId], + descramblerMap[lnbDescrambling.descramblerId], + lnbMap[lnbDescrambling.lnbId]); +} + INSTANTIATE_TEST_SUITE_P(PerInstance, TunerBroadcastAidlTest, testing::ValuesIn(android::getAidlHalInstanceNames(ITuner::descriptor)), android::PrintInstanceNameToString); diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h index fbb869375c..f68e1ecd42 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h @@ -80,7 +80,7 @@ void clearIds() { sectionFilterIds.clear(); } -enum class Dataflow_Context { LNBRECORD, RECORD }; +enum class Dataflow_Context { LNBRECORD, RECORD, DESCRAMBLING, LNBDESCRAMBLING }; class TunerLnbAidlTest : public testing::TestWithParam { public: @@ -407,6 +407,7 @@ class TunerDescramblerAidlTest : public testing::TestWithParam { mDvrTests.setService(mService); mDescramblerTests.setService(mService); mDescramblerTests.setCasService(mCasService); + mLnbTests.setService(mService); } virtual void TearDown() override { @@ -420,7 +421,11 @@ class TunerDescramblerAidlTest : public testing::TestWithParam { } void scrambledBroadcastTest(set mediaFilterConfs, - FrontendConfig frontendConf, DescramblerConfig descConfig); + FrontendConfig frontendConf, DescramblerConfig descConfig, + Dataflow_Context context); + void scrambledBroadcastTestWithLnb(set& mediaFilterConfs, + FrontendConfig& frontendConf, DescramblerConfig& descConfig, + LnbConfig& lnbConfig); AssertionResult filterDataOutputTest(); std::shared_ptr mService; @@ -430,6 +435,10 @@ class TunerDescramblerAidlTest : public testing::TestWithParam { FilterTests mFilterTests; DescramblerTests mDescramblerTests; DvrTests mDvrTests; + LnbTests mLnbTests; + + private: + int32_t mLnbId = INVALID_LNB_ID; }; GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TunerDescramblerAidlTest); diff --git a/tv/tuner/config/sample_tuner_vts_config_aidl_V1.xml b/tv/tuner/config/sample_tuner_vts_config_aidl_V1.xml index 1a148a4224..f74af7e099 100644 --- a/tv/tuner/config/sample_tuner_vts_config_aidl_V1.xml +++ b/tv/tuner/config/sample_tuner_vts_config_aidl_V1.xml @@ -196,7 +196,6 @@ videoFilterConnection="FILTER_VIDEO_DEFAULT" dvrSoftwareFeConnection="DVR_PLAYBACK_0" dvrSourceConnection="DVR_PLAYBACK_1"> - FILTER_TS_RECORD_0 FILTER_IP_IP_0 + + From bcf4ebbbc280bfb0cdcb034be017abea2c3c691b Mon Sep 17 00:00:00 2001 From: Frankie Lizcano Date: Mon, 1 Aug 2022 18:06:00 +0000 Subject: [PATCH 201/998] Tuner HAL VTS: Dynamically Configure LnbDescrambling This CL allows the vendor to ommit LnbDescrambling from the configuration file. The VTS will look at the devices configured by the vendors and automatically configure the dataflows and determine which tests to run for LnbDescrambling. Bug: b/240476983 Test: Test: ts-tradefed run vts --module VtsHalTvTunerTargetTest Change-Id: I003c6405e7fcc4e3494ef976dca83b9f7d6160a6 --- .../functional/VtsHalTvTunerTargetTest.cpp | 20 +++++-- .../VtsHalTvTunerTestConfigurations.h | 58 +++++++++++++++++++ 2 files changed, 72 insertions(+), 6 deletions(-) diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp index f78e508d6e..9a17d05a15 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp @@ -1297,12 +1297,20 @@ TEST_P(TunerDescramblerAidlTest, ScrambledBroadcastDataFlowMediaFiltersTestWithL if (!lnbDescrambling.support) { return; } - set filterConfs; - filterConfs.insert(static_cast(filterMap[lnbDescrambling.audioFilterId])); - filterConfs.insert(static_cast(filterMap[lnbDescrambling.videoFilterId])); - scrambledBroadcastTestWithLnb(filterConfs, frontendMap[lnbDescrambling.frontendId], - descramblerMap[lnbDescrambling.descramblerId], - lnbMap[lnbDescrambling.lnbId]); + auto lnbDescrambling_configs = generateLnbDescramblingConfigurations(); + if (lnbDescrambling_configs.empty()) { + ALOGD("No frontends that support satellites."); + return; + } + for (auto& configuration : lnbDescrambling_configs) { + lnbDescrambling = configuration; + set filterConfs; + filterConfs.insert(static_cast(filterMap[lnbDescrambling.audioFilterId])); + filterConfs.insert(static_cast(filterMap[lnbDescrambling.videoFilterId])); + scrambledBroadcastTestWithLnb(filterConfs, frontendMap[lnbDescrambling.frontendId], + descramblerMap[lnbDescrambling.descramblerId], + lnbMap[lnbDescrambling.lnbId]); + } } INSTANTIATE_TEST_SUITE_P(PerInstance, TunerBroadcastAidlTest, diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h index 2132994a38..fea5f83826 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h @@ -533,6 +533,54 @@ static inline vector generateLiveConfiguration return live_configs; } +static inline vector generateLnbDescramblingCombinations() { + vector combinations; + vector> deviceIds{frontendIds, audioFilterIds, lnbIds, descramblerIds}; + + const int frontendIdIndex = 0; + const int audioFilterIdIndex = 1; + const int lnbIdIndex = 2; + const int descramblerIdIndex = 3; + + auto idCombinations = generateIdCombinations(deviceIds); + // TODO : Find a better way to vary diseqcMsgs, if at all + for (auto& combo : idCombinations) { + const string feId = combo[frontendIdIndex]; + auto type = frontendMap[feId].type; + if (type == FrontendType::DVBS || type == FrontendType::ISDBS || + type == FrontendType::ISDBS3) { + LnbDescramblingHardwareConnections mLnbDescrambling; + mLnbDescrambling.support = true; + mLnbDescrambling.frontendId = feId; + mLnbDescrambling.audioFilterId = combo[audioFilterIdIndex]; + const int videoFilterIdIndex = find(audioFilterIds.begin(), audioFilterIds.end(), + mLnbDescrambling.audioFilterId) - + audioFilterIds.begin(); + mLnbDescrambling.videoFilterId = videoFilterIds[videoFilterIdIndex]; + mLnbDescrambling.lnbId = combo[lnbIdIndex]; + mLnbDescrambling.descramblerId = combo[descramblerIdIndex]; + mLnbDescrambling.diseqcMsgs = diseqcMsgs; + combinations.push_back(mLnbDescrambling); + } + } + + return combinations; +} + +static inline vector generateLnbDescramblingConfigurations() { + vector lnbDescrambling_configs; + if (configuredLnbDescrambling) { + ALOGD("Using LnbDescrambling configuration provided"); + lnbDescrambling_configs = {lnbDescrambling}; + } else { + ALOGD("LnbDescrambling not provided. Generating possible combinations. Consider adding it " + "to the configuration file."); + lnbDescrambling_configs = generateLnbDescramblingCombinations(); + } + + return lnbDescrambling_configs; +} + /** Config all the frontends that would be used in the tests */ inline void initFrontendConfig() { // The test will use the internal default fe when default fe is connected to any data flow @@ -721,6 +769,15 @@ inline void determineDvrRecord() { record.support = true; } +inline void determineLnbDescrambling() { + if (frontendIds.empty() || audioFilterIds.empty() || videoFilterIds.empty() || lnbIds.empty() || + descramblerIds.empty()) { + return; + } + ALOGD("Can support LnbDescrambling."); + lnbDescrambling.support = true; +} + /** Read the vendor configurations of which hardware to use for each test cases/data flows */ inline void connectHardwaresToTestCases() { TunerTestingConfigAidlReader1_0::connectLiveBroadcast(live); @@ -743,6 +800,7 @@ inline void determineDataFlows() { determineLive(); determineDescrambling(); determineDvrRecord(); + determineLnbDescrambling(); } inline bool validateConnections() { From 6413bce9c850ca0801f000284ce0899bdbbccfab Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Thu, 11 Aug 2022 14:15:10 -0400 Subject: [PATCH 202/998] Remove references to IComposer.createDisplay This method does not exist. Bug: NA Test: documentation-only change Change-Id: I3e5d138ec7cff46178212b82f982718836d479d6 --- .../hardware/graphics/composer3/ChangedCompositionTypes.aidl | 1 - .../graphics/composer3/ClientTargetPropertyWithBrightness.aidl | 1 - .../aidl/android/hardware/graphics/composer3/DisplayCommand.aidl | 1 - .../aidl/android/hardware/graphics/composer3/DisplayRequest.aidl | 1 - .../aidl/android/hardware/graphics/composer3/PresentFence.aidl | 1 - .../android/hardware/graphics/composer3/PresentOrValidate.aidl | 1 - .../aidl/android/hardware/graphics/composer3/ReleaseFences.aidl | 1 - 7 files changed, 7 deletions(-) diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ChangedCompositionTypes.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ChangedCompositionTypes.aidl index ddd45b7fdd..9e8c7682b4 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/ChangedCompositionTypes.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ChangedCompositionTypes.aidl @@ -23,7 +23,6 @@ import android.hardware.graphics.composer3.Composition; parcelable ChangedCompositionTypes { /** * The display which this commands refers to. - * @see IComposer.createDisplay */ long display; diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl index ba6fe97c3d..ea54a89a98 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl @@ -23,7 +23,6 @@ import android.hardware.graphics.composer3.DimmingStage; parcelable ClientTargetPropertyWithBrightness { /** * The display which this commands refers to. - * @see IComposer.createDisplay */ long display; diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl index b6df147df8..4f69aeeab7 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCommand.aidl @@ -26,7 +26,6 @@ import android.hardware.graphics.composer3.LayerCommand; parcelable DisplayCommand { /** * The display which this commands refers to. - * @see IComposer.createDisplay */ long display; diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayRequest.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayRequest.aidl index 27fe1e6ed7..3a50b6e3b2 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayRequest.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayRequest.aidl @@ -34,7 +34,6 @@ parcelable DisplayRequest { /** * The display which this commands refers to. - * @see IComposer.createDisplay */ long display; diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/PresentFence.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/PresentFence.aidl index 244b4e5af3..b757656e09 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/PresentFence.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/PresentFence.aidl @@ -20,7 +20,6 @@ package android.hardware.graphics.composer3; parcelable PresentFence { /** * The display which this commands refers to. - * @see IComposer.createDisplay */ long display; diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/PresentOrValidate.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/PresentOrValidate.aidl index 5ae8940be0..e15dbf21dd 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/PresentOrValidate.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/PresentOrValidate.aidl @@ -20,7 +20,6 @@ package android.hardware.graphics.composer3; parcelable PresentOrValidate { /** * The display which this commands refers to. - * @see IComposer.createDisplay */ long display; diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/ReleaseFences.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/ReleaseFences.aidl index 459a04265f..58649d5bc8 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/ReleaseFences.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/ReleaseFences.aidl @@ -20,7 +20,6 @@ package android.hardware.graphics.composer3; parcelable ReleaseFences { /** * The display which this commands refers to. - * @see IComposer.createDisplay */ long display; @VintfStability From 3ab5c9010431c557c22eee5470b8e0580722d2b6 Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Fri, 12 Aug 2022 13:40:26 +0900 Subject: [PATCH 203/998] Build libwifi-hal-* modules only for the first arch Previously, the build rules assumed that the target supports both 64 and 32 bit architectures, which isn't true for 32-bit-only targets. That caused build breakage on such targets. Fixing that by building the modules only for the first architecture (64 on 64-only or 64/32 target, and 32 on 32-only target). Bug: 241916304 Test: build the 32-bit-only target Change-Id: I5353ab1561622eae12e2dff87eb0f17b47c3773d --- wifi/1.6/default/Android.bp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wifi/1.6/default/Android.bp b/wifi/1.6/default/Android.bp index 0ac6412544..a132deed59 100644 --- a/wifi/1.6/default/Android.bp +++ b/wifi/1.6/default/Android.bp @@ -63,6 +63,7 @@ cc_library_static { name: "android.hardware.wifi@1.0-service-lib", defaults: ["android.hardware.wifi@1.0-service-cppflags-defaults"], proprietary: true, + compile_multilib: "first", cppflags: [ "-Wall", "-Werror", @@ -183,6 +184,7 @@ cc_binary { cc_test { name: "android.hardware.wifi@1.0-service-tests", proprietary: true, + compile_multilib: "first", cppflags: [ "-Wall", "-Werror", From a9efc52c15591b8e070705ce287bb96f765f06e5 Mon Sep 17 00:00:00 2001 From: seanhong Date: Mon, 15 Aug 2022 21:44:46 +0000 Subject: [PATCH 204/998] Add seat depth properties to the DefaultProperties.json for CTS tests Test: atest CarPropertyManagerTest Bug: 239613431 Change-Id: Ib6fa73306844a4b811d34a96e145dba9543ce048 --- .../config/DefaultProperties.json | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 5d355696ef..0615e38b3f 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -504,6 +504,76 @@ } ] }, + { + "property": "VehicleProperty::SEAT_DEPTH_POS", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -10, + "maxInt32Value": 10 + } + ] + }, + { + "property": "VehicleProperty::SEAT_DEPTH_MOVE", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -1, + "maxInt32Value": 1 + } + ] + }, { "property": "VehicleProperty::SEAT_OCCUPANCY", "areas": [ From af7cbb3bf5832a106bdad24dadf4bb8b2c03ef3d Mon Sep 17 00:00:00 2001 From: seanhong Date: Mon, 15 Aug 2022 22:21:07 +0000 Subject: [PATCH 205/998] Add seat tilt properties to DefaultProperties.json for CTS tests Test: atest CarPropertyManagerTest Bug: 239613431 Change-Id: I4bb282e81e2d847a060a259e6da7c09fed9d77de --- .../config/DefaultProperties.json | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 0615e38b3f..f21478f74a 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -574,6 +574,76 @@ } ] }, + { + "property": "VehicleProperty::SEAT_TILT_POS", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -10, + "maxInt32Value": 10 + } + ] + }, + { + "property": "VehicleProperty::SEAT_TILT_MOVE", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -1, + "maxInt32Value": 1 + } + ] + }, { "property": "VehicleProperty::SEAT_OCCUPANCY", "areas": [ From 6d8b09fda6adbccf7ba0ad1bbeb1c21621cbfc47 Mon Sep 17 00:00:00 2001 From: seanhong Date: Mon, 15 Aug 2022 22:25:33 +0000 Subject: [PATCH 206/998] Add seat lumbar properties to DefaultProperties.json for CTS tests Test: atest CarPropertyManagerTest Bug: 239613431 Change-Id: Ie26894e0723a610ebdc0ff0b81e57ab654c230db --- .../config/DefaultProperties.json | 140 ++++++++++++++++++ 1 file changed, 140 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index f21478f74a..51fac4bb6e 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -644,6 +644,146 @@ } ] }, + { + "property": "VehicleProperty::SEAT_LUMBAR_FORE_AFT_POS", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -10, + "maxInt32Value": 10 + } + ] + }, + { + "property": "VehicleProperty::SEAT_LUMBAR_FORE_AFT_MOVE", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -1, + "maxInt32Value": 1 + } + ] + }, + { + "property": "VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_POS", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -10, + "maxInt32Value": 10 + } + ] + }, + { + "property": "VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_MOVE", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -1, + "maxInt32Value": 1 + } + ] + }, { "property": "VehicleProperty::SEAT_OCCUPANCY", "areas": [ From 4ccf651c01a88415d35065e38cc101b3087d17f6 Mon Sep 17 00:00:00 2001 From: seanhong Date: Mon, 15 Aug 2022 23:38:49 +0000 Subject: [PATCH 207/998] Add seat headrest properties to DefaultProperties.json for CTS tests All the seat headrest properties have been added, but SEAT_HEADREST_HEIGHT_POS is excluded because of b/242587816. Test: atest CarPropertyManagerTest Bug: 239613431 Change-Id: I20b44558c262d47dc148e9b2d8857838f898ae9f --- .../config/DefaultProperties.json | 175 ++++++++++++++++++ 1 file changed, 175 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 51fac4bb6e..feebf89609 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -784,6 +784,181 @@ } ] }, + { + "property": "VehicleProperty::SEAT_HEADREST_HEIGHT_MOVE", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -1, + "maxInt32Value": 1 + } + ] + }, + { + "property": "VehicleProperty::SEAT_HEADREST_ANGLE_POS", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -10, + "maxInt32Value": 10 + } + ] + }, + { + "property": "VehicleProperty::SEAT_HEADREST_ANGLE_MOVE", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -1, + "maxInt32Value": 1 + } + ] + }, + { + "property": "VehicleProperty::SEAT_HEADREST_FORE_AFT_POS", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -10, + "maxInt32Value": 10 + } + ] + }, + { + "property": "VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -1, + "maxInt32Value": 1 + } + ] + }, { "property": "VehicleProperty::SEAT_OCCUPANCY", "areas": [ From a5698a3983d6ae2bcc4993fec8aa821a758b6c00 Mon Sep 17 00:00:00 2001 From: seanhong Date: Tue, 16 Aug 2022 00:10:21 +0000 Subject: [PATCH 208/998] Add missing mirror properties to DefaultProperties.json for CTS tests Test: atest CarPropertyManagerTest Bug: 241161716 Change-Id: Id647540ccd071134249a8122f537090c9e132dbf --- .../config/DefaultProperties.json | 116 ++++++++++++++++++ 1 file changed, 116 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 5d355696ef..0ab259b69d 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1432,6 +1432,122 @@ } ] }, + { + "property": "VehicleProperty::MIRROR_Z_POS", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "VehicleAreaMirror::DRIVER_LEFT", + "minInt32Value": -3, + "maxInt32Value": 3 + }, + { + "areaId": "VehicleAreaMirror::DRIVER_RIGHT", + "minInt32Value": -3, + "maxInt32Value": 3 + }, + { + "areaId": "VehicleAreaMirror::DRIVER_CENTER", + "minInt32Value": -3, + "maxInt32Value": 3 + } + ] + }, + { + "property": "VehicleProperty::MIRROR_Z_MOVE", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "VehicleAreaMirror::DRIVER_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "VehicleAreaMirror::DRIVER_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "VehicleAreaMirror::DRIVER_CENTER", + "minInt32Value": -1, + "maxInt32Value": 1 + } + ] + }, + { + "property": "VehicleProperty::MIRROR_Y_POS", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "VehicleAreaMirror::DRIVER_LEFT", + "minInt32Value": -3, + "maxInt32Value": 3 + }, + { + "areaId": "VehicleAreaMirror::DRIVER_RIGHT", + "minInt32Value": -3, + "maxInt32Value": 3 + }, + { + "areaId": "VehicleAreaMirror::DRIVER_CENTER", + "minInt32Value": -3, + "maxInt32Value": 3 + } + ] + }, + { + "property": "VehicleProperty::MIRROR_Y_MOVE", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "VehicleAreaMirror::DRIVER_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "VehicleAreaMirror::DRIVER_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "VehicleAreaMirror::DRIVER_CENTER", + "minInt32Value": -1, + "maxInt32Value": 1 + } + ] + }, + { + "property": "VehicleProperty::MIRROR_LOCK", + "defaultValue": { + "int32Values": [ + 1 + ] + } + }, + { + "property": "VehicleProperty::MIRROR_FOLD", + "defaultValue": { + "int32Values": [ + 1 + ] + } + }, { "property": "VehicleProperty::WINDOW_LOCK", "areas": [ From fddcb4a043b4bc86685c70a9d8428691918fe4bd Mon Sep 17 00:00:00 2001 From: seanhong Date: Tue, 16 Aug 2022 20:31:17 +0000 Subject: [PATCH 209/998] Add interior lights state properties to DefaultProperties.json for CTS tests Test: atest CarPropertyManagerTest Bug: 241161716 Change-Id: Id97df0340200b5b9900033c8703abacfb65a7f83 --- .../config/DefaultProperties.json | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 5d355696ef..4dd014cfe0 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1610,6 +1610,39 @@ ] } }, + { + "property": "VehicleProperty::CABIN_LIGHTS_STATE", + "defaultValue": { + "int32Values": [ + "Constants::LIGHT_STATE_ON" + ] + } + }, + { + "property": "VehicleProperty::READING_LIGHTS_STATE", + "defaultValue": { + "int32Values": [ + "Constants::LIGHT_STATE_ON" + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" + } + ] + }, { "property": "VehicleProperty::HEADLIGHTS_SWITCH", "defaultValue": { From 5021df71c713a01e619088f741ac88334fb0c25b Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Sat, 30 Jul 2022 00:10:52 +0000 Subject: [PATCH 210/998] audio: Allow stopping a StreamWorker from the looping thread Enhance the return type of the 'workerCycle' to allow it exiting without inducing an error on the controller side. Also, put StreamWorker into a namespace. Bug: 205884982 Test: atest libaudioaidlcommon_test --iterations Change-Id: I3b27028b10f80f27985040cae8f8b0e6ab63ddad --- audio/aidl/common/include/StreamWorker.h | 43 ++++++++---- .../aidl/common/tests/streamworker_tests.cpp | 69 ++++++++++++++----- 2 files changed, 78 insertions(+), 34 deletions(-) diff --git a/audio/aidl/common/include/StreamWorker.h b/audio/aidl/common/include/StreamWorker.h index 776490493d..03685fcf29 100644 --- a/audio/aidl/common/include/StreamWorker.h +++ b/audio/aidl/common/include/StreamWorker.h @@ -29,11 +29,15 @@ #include #include +namespace android::hardware::audio::common { + template class StreamWorker { enum class WorkerState { STOPPED, RUNNING, PAUSE_REQUESTED, PAUSED, RESUME_REQUESTED }; public: + enum class WorkerStatus { ABORT, CONTINUE, EXIT }; + StreamWorker() = default; ~StreamWorker() { stop(); } // Note that 'priority' here is what is known as the 'nice number' in *nix systems. @@ -66,8 +70,7 @@ class StreamWorker { void stop() { { std::lock_guard lock(mWorkerLock); - if (mError.empty()) { - if (mWorkerState == WorkerState::STOPPED) return; + if (mWorkerState != WorkerState::STOPPED) { mWorkerState = WorkerState::STOPPED; mWorkerStateChangeRequest = true; } @@ -91,18 +94,22 @@ class StreamWorker { // Methods that need to be provided by subclasses: // - // Called once at the beginning of the thread loop. Must return - // an empty string to enter the thread loop, otherwise the thread loop - // exits and the worker switches into the 'error' state, setting - // the error to the returned value. + // /* Called once at the beginning of the thread loop. Must return + // * an empty string to enter the thread loop, otherwise the thread loop + // * exits and the worker switches into the 'error' state, setting + // * the error to the returned value. + // */ // std::string workerInit(); // - // Called for each thread loop unless the thread is in 'paused' state. - // Must return 'true' to continue running, otherwise the thread loop - // exits and the worker switches into the 'error' state with a generic - // error message. It is recommended that the subclass reports any - // problems via logging facilities. - // bool workerCycle(); + // /* Called for each thread loop unless the thread is in 'paused' state. + // * Must return 'CONTINUE' to continue running, otherwise the thread loop + // * exits. If the result from worker cycle is 'ABORT' then the worker switches + // * into the 'error' state with a generic error message. It is recommended that + // * the subclass reports any problems via logging facilities. Returning the 'EXIT' + // * status is equivalent to calling 'stop()' method. This is just a way of + // * of stopping the worker by its own initiative. + // */ + // WorkerStatus workerCycle(); private: void switchWorkerStateSync(WorkerState oldState, WorkerState newState, @@ -146,8 +153,10 @@ class StreamWorker { for (WorkerState state = WorkerState::RUNNING; state != WorkerState::STOPPED;) { bool needToNotify = false; - if (state != WorkerState::PAUSED ? static_cast(this)->workerCycle() - : (sched_yield(), true)) { + if (WorkerStatus status = state != WorkerState::PAUSED + ? static_cast(this)->workerCycle() + : (sched_yield(), WorkerStatus::CONTINUE); + status == WorkerStatus::CONTINUE) { { // See https://developer.android.com/training/articles/smp#nonracing android::base::ScopedLockAssertion lock_assertion(mWorkerLock); @@ -188,7 +197,9 @@ class StreamWorker { needToNotify = true; } state = mWorkerState = WorkerState::STOPPED; - mError = "workerCycle failed"; + if (status == WorkerStatus::ABORT) { + mError = "workerCycle aborted"; + } } if (needToNotify) { { @@ -218,3 +229,5 @@ class StreamWorker { static_assert(std::atomic::is_always_lock_free); std::atomic mWorkerStateChangeRequest GUARDED_BY(mWorkerLock) = false; }; + +} // namespace android::hardware::audio::common diff --git a/audio/aidl/common/tests/streamworker_tests.cpp b/audio/aidl/common/tests/streamworker_tests.cpp index 9fb1a8ee3f..df81c69716 100644 --- a/audio/aidl/common/tests/streamworker_tests.cpp +++ b/audio/aidl/common/tests/streamworker_tests.cpp @@ -26,14 +26,18 @@ #define LOG_TAG "StreamWorker_Test" #include -struct TestStream { - std::atomic error = false; -}; +using android::hardware::audio::common::StreamWorker; class TestWorker : public StreamWorker { public: + struct Stream { + void setErrorStatus() { status = WorkerStatus::ABORT; } + void setStopStatus() { status = WorkerStatus::EXIT; } + std::atomic status = WorkerStatus::CONTINUE; + }; + // Use nullptr to test error reporting from the worker thread. - explicit TestWorker(TestStream* stream) : mStream(stream) {} + explicit TestWorker(Stream* stream) : mStream(stream) {} size_t getWorkerCycles() const { return mWorkerCycles; } int getPriority() const { return mPriority; } @@ -45,16 +49,16 @@ class TestWorker : public StreamWorker { } std::string workerInit() { return mStream != nullptr ? "" : "Expected error"; } - bool workerCycle() { + WorkerStatus workerCycle() { mPriority = getpriority(PRIO_PROCESS, 0); do { mWorkerCycles++; } while (mWorkerCycles == 0); - return !mStream->error; + return mStream->status; } private: - TestStream* const mStream; + Stream* const mStream; std::atomic mWorkerCycles = 0; std::atomic mPriority = ANDROID_PRIORITY_DEFAULT; }; @@ -70,7 +74,8 @@ class StreamWorkerInvalidTest : public testing::TestWithParam { } protected: - StreamWorkerInvalidTest(TestStream* stream) : testing::TestWithParam(), worker(stream) {} + StreamWorkerInvalidTest(TestWorker::Stream* stream) + : testing::TestWithParam(), worker(stream) {} TestWorker worker; }; @@ -118,7 +123,7 @@ class StreamWorkerTest : public StreamWorkerInvalidTest { StreamWorkerTest() : StreamWorkerInvalidTest(&stream) {} protected: - TestStream stream; + TestWorker::Stream stream; }; static constexpr unsigned kWorkerIdleCheckTime = 50 * 1000; @@ -130,21 +135,47 @@ TEST_P(StreamWorkerTest, Uninitialized) { TEST_P(StreamWorkerTest, Start) { ASSERT_TRUE(worker.start()); + EXPECT_TRUE(worker.waitForAtLeastOneCycle()); + EXPECT_FALSE(worker.hasError()); +} + +TEST_P(StreamWorkerTest, StartStop) { + ASSERT_TRUE(worker.start()); + EXPECT_TRUE(worker.waitForAtLeastOneCycle()); + EXPECT_FALSE(worker.hasError()); + worker.stop(); + EXPECT_FALSE(worker.hasError()); +} + +TEST_P(StreamWorkerTest, WorkerExit) { + ASSERT_TRUE(worker.start()); + stream.setStopStatus(); worker.waitForAtLeastOneCycle(); EXPECT_FALSE(worker.hasError()); + EXPECT_TRUE(worker.hasNoWorkerCycleCalled(kWorkerIdleCheckTime)); } TEST_P(StreamWorkerTest, WorkerError) { ASSERT_TRUE(worker.start()); - stream.error = true; + stream.setErrorStatus(); worker.waitForAtLeastOneCycle(); EXPECT_TRUE(worker.hasError()); EXPECT_TRUE(worker.hasNoWorkerCycleCalled(kWorkerIdleCheckTime)); } +TEST_P(StreamWorkerTest, StopAfterError) { + ASSERT_TRUE(worker.start()); + stream.setErrorStatus(); + worker.waitForAtLeastOneCycle(); + EXPECT_TRUE(worker.hasError()); + EXPECT_TRUE(worker.hasNoWorkerCycleCalled(kWorkerIdleCheckTime)); + worker.stop(); + EXPECT_TRUE(worker.hasError()); +} + TEST_P(StreamWorkerTest, PauseResume) { ASSERT_TRUE(worker.start()); - worker.waitForAtLeastOneCycle(); + EXPECT_TRUE(worker.waitForAtLeastOneCycle()); EXPECT_FALSE(worker.hasError()); worker.pause(); EXPECT_TRUE(worker.hasNoWorkerCycleCalled(kWorkerIdleCheckTime)); @@ -158,7 +189,7 @@ TEST_P(StreamWorkerTest, PauseResume) { TEST_P(StreamWorkerTest, StopPaused) { ASSERT_TRUE(worker.start()); - worker.waitForAtLeastOneCycle(); + EXPECT_TRUE(worker.waitForAtLeastOneCycle()); EXPECT_FALSE(worker.hasError()); worker.pause(); worker.stop(); @@ -167,7 +198,7 @@ TEST_P(StreamWorkerTest, StopPaused) { TEST_P(StreamWorkerTest, PauseAfterErrorIgnored) { ASSERT_TRUE(worker.start()); - stream.error = true; + stream.setErrorStatus(); worker.waitForAtLeastOneCycle(); EXPECT_TRUE(worker.hasError()); worker.pause(); @@ -177,7 +208,7 @@ TEST_P(StreamWorkerTest, PauseAfterErrorIgnored) { TEST_P(StreamWorkerTest, ResumeAfterErrorIgnored) { ASSERT_TRUE(worker.start()); - stream.error = true; + stream.setErrorStatus(); worker.waitForAtLeastOneCycle(); EXPECT_TRUE(worker.hasError()); worker.resume(); @@ -187,11 +218,11 @@ TEST_P(StreamWorkerTest, ResumeAfterErrorIgnored) { TEST_P(StreamWorkerTest, WorkerErrorOnResume) { ASSERT_TRUE(worker.start()); - worker.waitForAtLeastOneCycle(); + EXPECT_TRUE(worker.waitForAtLeastOneCycle()); EXPECT_FALSE(worker.hasError()); worker.pause(); EXPECT_FALSE(worker.hasError()); - stream.error = true; + stream.setErrorStatus(); EXPECT_FALSE(worker.hasError()); worker.resume(); worker.waitForAtLeastOneCycle(); @@ -208,7 +239,7 @@ TEST_P(StreamWorkerTest, WaitForAtLeastOneCycle) { TEST_P(StreamWorkerTest, WaitForAtLeastOneCycleError) { ASSERT_TRUE(worker.start()); - stream.error = true; + stream.setErrorStatus(); EXPECT_FALSE(worker.waitForAtLeastOneCycle()); } @@ -220,7 +251,7 @@ TEST_P(StreamWorkerTest, MutexDoesNotBlockWorker) { usleep(kWorkerIdleCheckTime); } worker.testLockUnlockMutex(false); - worker.waitForAtLeastOneCycle(); + EXPECT_TRUE(worker.waitForAtLeastOneCycle()); EXPECT_FALSE(worker.hasError()); } @@ -235,7 +266,7 @@ TEST_P(StreamWorkerTest, ThreadName) { TEST_P(StreamWorkerTest, ThreadPriority) { const int priority = ANDROID_PRIORITY_LOWEST; ASSERT_TRUE(worker.start("", priority)) << worker.getError(); - worker.waitForAtLeastOneCycle(); + EXPECT_TRUE(worker.waitForAtLeastOneCycle()); EXPECT_EQ(priority, worker.getPriority()); } From 84024eccee71607c13bf13d7de80947efca4de50 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Mon, 8 Aug 2022 18:28:36 +0000 Subject: [PATCH 211/998] audio: Fix the lifetime of the StreamWorker's logic part Fix the mistake of making StreamWorker to inherit from the part which provides actual thread logic (Impl). The lifetime of the logic object must be longer than the lifetime of the StreamWorker's thread. Otherwise, the thread could still have running while the logic has already been destroyed (consider the order of destructors in C++ class inheritance). With this fix, the StreamWorker class does not have to be a template anymore, thus reorganize the code to move big methods into a .cpp file. Bug: 205884982 Test: atest libaudioaidlcommon_test --iterations Change-Id: I5bc2c8fd9d78a0fbc9fddab67456cc5214584045 --- audio/aidl/common/Android.bp | 7 +- audio/aidl/common/StreamWorker.cpp | 160 ++++++++++++ audio/aidl/common/include/StreamWorker.h | 246 ++++++------------ .../aidl/common/tests/streamworker_tests.cpp | 19 +- audio/aidl/default/Android.bp | 1 + audio/aidl/vts/Android.bp | 1 + 6 files changed, 262 insertions(+), 172 deletions(-) create mode 100644 audio/aidl/common/StreamWorker.cpp diff --git a/audio/aidl/common/Android.bp b/audio/aidl/common/Android.bp index 37da9d66ec..f2d8fc2a53 100644 --- a/audio/aidl/common/Android.bp +++ b/audio/aidl/common/Android.bp @@ -23,7 +23,7 @@ package { default_applicable_licenses: ["hardware_interfaces_license"], } -cc_library_headers { +cc_library { name: "libaudioaidlcommon", host_supported: true, vendor_available: true, @@ -36,13 +36,16 @@ cc_library_headers { "libbase_headers", "libsystem_headers", ], + srcs: [ + "StreamWorker.cpp", + ], } cc_test { name: "libaudioaidlcommon_test", host_supported: true, vendor_available: true, - header_libs: [ + static_libs: [ "libaudioaidlcommon", ], shared_libs: [ diff --git a/audio/aidl/common/StreamWorker.cpp b/audio/aidl/common/StreamWorker.cpp new file mode 100644 index 0000000000..9bca7609fd --- /dev/null +++ b/audio/aidl/common/StreamWorker.cpp @@ -0,0 +1,160 @@ +/* + * 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. + */ + +#include +#include +#include + +#include "include/StreamWorker.h" + +namespace android::hardware::audio::common::internal { + +bool ThreadController::start(const std::string& name, int priority) { + mThreadName = name; + mThreadPriority = priority; + mWorker = std::thread(&ThreadController::workerThread, this); + std::unique_lock lock(mWorkerLock); + android::base::ScopedLockAssertion lock_assertion(mWorkerLock); + mWorkerCv.wait(lock, [&]() { + android::base::ScopedLockAssertion lock_assertion(mWorkerLock); + return mWorkerState == WorkerState::RUNNING || !mError.empty(); + }); + mWorkerStateChangeRequest = false; + return mWorkerState == WorkerState::RUNNING; +} + +void ThreadController::stop() { + { + std::lock_guard lock(mWorkerLock); + if (mWorkerState != WorkerState::STOPPED) { + mWorkerState = WorkerState::STOPPED; + mWorkerStateChangeRequest = true; + } + } + if (mWorker.joinable()) { + mWorker.join(); + } +} + +bool ThreadController::waitForAtLeastOneCycle() { + WorkerState newState; + switchWorkerStateSync(WorkerState::RUNNING, WorkerState::PAUSE_REQUESTED, &newState); + if (newState != WorkerState::PAUSED) return false; + switchWorkerStateSync(newState, WorkerState::RESUME_REQUESTED, &newState); + return newState == WorkerState::RUNNING; +} + +void ThreadController::switchWorkerStateSync(WorkerState oldState, WorkerState newState, + WorkerState* finalState) { + std::unique_lock lock(mWorkerLock); + android::base::ScopedLockAssertion lock_assertion(mWorkerLock); + if (mWorkerState != oldState) { + if (finalState) *finalState = mWorkerState; + return; + } + mWorkerState = newState; + mWorkerStateChangeRequest = true; + mWorkerCv.wait(lock, [&]() { + android::base::ScopedLockAssertion lock_assertion(mWorkerLock); + return mWorkerState != newState; + }); + if (finalState) *finalState = mWorkerState; +} + +void ThreadController::workerThread() { + using Status = StreamLogic::Status; + + std::string error = mLogic->init(); + if (error.empty() && !mThreadName.empty()) { + std::string compliantName(mThreadName.substr(0, 15)); + if (int errCode = pthread_setname_np(pthread_self(), compliantName.c_str()); errCode != 0) { + error.append("Failed to set thread name: ").append(strerror(errCode)); + } + } + if (error.empty() && mThreadPriority != ANDROID_PRIORITY_DEFAULT) { + if (int result = setpriority(PRIO_PROCESS, 0, mThreadPriority); result != 0) { + int errCode = errno; + error.append("Failed to set thread priority: ").append(strerror(errCode)); + } + } + { + std::lock_guard lock(mWorkerLock); + mWorkerState = error.empty() ? WorkerState::RUNNING : WorkerState::STOPPED; + mError = error; + } + mWorkerCv.notify_one(); + if (!error.empty()) return; + + for (WorkerState state = WorkerState::RUNNING; state != WorkerState::STOPPED;) { + bool needToNotify = false; + if (Status status = state != WorkerState::PAUSED ? mLogic->cycle() + : (sched_yield(), Status::CONTINUE); + status == Status::CONTINUE) { + { + // See https://developer.android.com/training/articles/smp#nonracing + android::base::ScopedLockAssertion lock_assertion(mWorkerLock); + if (!mWorkerStateChangeRequest.load(std::memory_order_relaxed)) continue; + } + // + // Pause and resume are synchronous. One worker cycle must complete + // before the worker indicates a state change. This is how 'mWorkerState' and + // 'state' interact: + // + // mWorkerState == RUNNING + // client sets mWorkerState := PAUSE_REQUESTED + // last workerCycle gets executed, state := mWorkerState := PAUSED by us + // (or the workers enters the 'error' state if workerCycle fails) + // client gets notified about state change in any case + // thread is doing a busy wait while 'state == PAUSED' + // client sets mWorkerState := RESUME_REQUESTED + // state := mWorkerState (RESUME_REQUESTED) + // mWorkerState := RUNNING, but we don't notify the client yet + // first workerCycle gets executed, the code below triggers a client notification + // (or if workerCycle fails, worker enters 'error' state and also notifies) + // state := mWorkerState (RUNNING) + std::lock_guard lock(mWorkerLock); + if (state == WorkerState::RESUME_REQUESTED) { + needToNotify = true; + } + state = mWorkerState; + if (mWorkerState == WorkerState::PAUSE_REQUESTED) { + state = mWorkerState = WorkerState::PAUSED; + needToNotify = true; + } else if (mWorkerState == WorkerState::RESUME_REQUESTED) { + mWorkerState = WorkerState::RUNNING; + } + } else { + std::lock_guard lock(mWorkerLock); + if (state == WorkerState::RESUME_REQUESTED || + mWorkerState == WorkerState::PAUSE_REQUESTED) { + needToNotify = true; + } + state = mWorkerState = WorkerState::STOPPED; + if (status == Status::ABORT) { + mError = "Received ABORT from the logic cycle"; + } + } + if (needToNotify) { + { + std::lock_guard lock(mWorkerLock); + mWorkerStateChangeRequest = false; + } + mWorkerCv.notify_one(); + } + } +} + +} // namespace android::hardware::audio::common::internal diff --git a/audio/aidl/common/include/StreamWorker.h b/audio/aidl/common/include/StreamWorker.h index 03685fcf29..6260eca49a 100644 --- a/audio/aidl/common/include/StreamWorker.h +++ b/audio/aidl/common/include/StreamWorker.h @@ -16,10 +16,6 @@ #pragma once -#include -#include -#include - #include #include #include @@ -31,32 +27,18 @@ namespace android::hardware::audio::common { -template -class StreamWorker { +class StreamLogic; + +namespace internal { + +class ThreadController { enum class WorkerState { STOPPED, RUNNING, PAUSE_REQUESTED, PAUSED, RESUME_REQUESTED }; public: - enum class WorkerStatus { ABORT, CONTINUE, EXIT }; + explicit ThreadController(StreamLogic* logic) : mLogic(logic) {} + ~ThreadController() { stop(); } - StreamWorker() = default; - ~StreamWorker() { stop(); } - // Note that 'priority' here is what is known as the 'nice number' in *nix systems. - // The nice number is used with the default scheduler. For threads that - // need to use a specialized scheduler (e.g. SCHED_FIFO) and set the priority within it, - // it is recommended to implement an appropriate configuration sequence within `workerInit`. - bool start(const std::string& name = "", int priority = ANDROID_PRIORITY_DEFAULT) { - mThreadName = name; - mThreadPriority = priority; - mWorker = std::thread(&StreamWorker::workerThread, this); - std::unique_lock lock(mWorkerLock); - android::base::ScopedLockAssertion lock_assertion(mWorkerLock); - mWorkerCv.wait(lock, [&]() { - android::base::ScopedLockAssertion lock_assertion(mWorkerLock); - return mWorkerState == WorkerState::RUNNING || !mError.empty(); - }); - mWorkerStateChangeRequest = false; - return mWorkerState == WorkerState::RUNNING; - } + bool start(const std::string& name, int priority); void pause() { switchWorkerStateSync(WorkerState::RUNNING, WorkerState::PAUSE_REQUESTED); } void resume() { switchWorkerStateSync(WorkerState::PAUSED, WorkerState::RESUME_REQUESTED); } bool hasError() { @@ -67,150 +49,21 @@ class StreamWorker { std::lock_guard lock(mWorkerLock); return mError; } - void stop() { - { - std::lock_guard lock(mWorkerLock); - if (mWorkerState != WorkerState::STOPPED) { - mWorkerState = WorkerState::STOPPED; - mWorkerStateChangeRequest = true; - } - } - if (mWorker.joinable()) { - mWorker.join(); - } - } - bool waitForAtLeastOneCycle() { - WorkerState newState; - switchWorkerStateSync(WorkerState::RUNNING, WorkerState::PAUSE_REQUESTED, &newState); - if (newState != WorkerState::PAUSED) return false; - switchWorkerStateSync(newState, WorkerState::RESUME_REQUESTED, &newState); - return newState == WorkerState::RUNNING; - } + void stop(); + bool waitForAtLeastOneCycle(); + // Only used by unit tests. - void testLockUnlockMutex(bool lock) NO_THREAD_SAFETY_ANALYSIS { + void lockUnlockMutex(bool lock) NO_THREAD_SAFETY_ANALYSIS { lock ? mWorkerLock.lock() : mWorkerLock.unlock(); } - std::thread::native_handle_type testGetThreadNativeHandle() { return mWorker.native_handle(); } - - // Methods that need to be provided by subclasses: - // - // /* Called once at the beginning of the thread loop. Must return - // * an empty string to enter the thread loop, otherwise the thread loop - // * exits and the worker switches into the 'error' state, setting - // * the error to the returned value. - // */ - // std::string workerInit(); - // - // /* Called for each thread loop unless the thread is in 'paused' state. - // * Must return 'CONTINUE' to continue running, otherwise the thread loop - // * exits. If the result from worker cycle is 'ABORT' then the worker switches - // * into the 'error' state with a generic error message. It is recommended that - // * the subclass reports any problems via logging facilities. Returning the 'EXIT' - // * status is equivalent to calling 'stop()' method. This is just a way of - // * of stopping the worker by its own initiative. - // */ - // WorkerStatus workerCycle(); + std::thread::native_handle_type getThreadNativeHandle() { return mWorker.native_handle(); } private: void switchWorkerStateSync(WorkerState oldState, WorkerState newState, - WorkerState* finalState = nullptr) { - std::unique_lock lock(mWorkerLock); - android::base::ScopedLockAssertion lock_assertion(mWorkerLock); - if (mWorkerState != oldState) { - if (finalState) *finalState = mWorkerState; - return; - } - mWorkerState = newState; - mWorkerStateChangeRequest = true; - mWorkerCv.wait(lock, [&]() { - android::base::ScopedLockAssertion lock_assertion(mWorkerLock); - return mWorkerState != newState; - }); - if (finalState) *finalState = mWorkerState; - } - void workerThread() { - std::string error = static_cast(this)->workerInit(); - if (error.empty() && !mThreadName.empty()) { - std::string compliantName(mThreadName.substr(0, 15)); - if (int errCode = pthread_setname_np(pthread_self(), compliantName.c_str()); - errCode != 0) { - error.append("Failed to set thread name: ").append(strerror(errCode)); - } - } - if (error.empty() && mThreadPriority != ANDROID_PRIORITY_DEFAULT) { - if (int result = setpriority(PRIO_PROCESS, 0, mThreadPriority); result != 0) { - int errCode = errno; - error.append("Failed to set thread priority: ").append(strerror(errCode)); - } - } - { - std::lock_guard lock(mWorkerLock); - mWorkerState = error.empty() ? WorkerState::RUNNING : WorkerState::STOPPED; - mError = error; - } - mWorkerCv.notify_one(); - if (!error.empty()) return; - - for (WorkerState state = WorkerState::RUNNING; state != WorkerState::STOPPED;) { - bool needToNotify = false; - if (WorkerStatus status = state != WorkerState::PAUSED - ? static_cast(this)->workerCycle() - : (sched_yield(), WorkerStatus::CONTINUE); - status == WorkerStatus::CONTINUE) { - { - // See https://developer.android.com/training/articles/smp#nonracing - android::base::ScopedLockAssertion lock_assertion(mWorkerLock); - if (!mWorkerStateChangeRequest.load(std::memory_order_relaxed)) continue; - } - // - // Pause and resume are synchronous. One worker cycle must complete - // before the worker indicates a state change. This is how 'mWorkerState' and - // 'state' interact: - // - // mWorkerState == RUNNING - // client sets mWorkerState := PAUSE_REQUESTED - // last workerCycle gets executed, state := mWorkerState := PAUSED by us - // (or the workers enters the 'error' state if workerCycle fails) - // client gets notified about state change in any case - // thread is doing a busy wait while 'state == PAUSED' - // client sets mWorkerState := RESUME_REQUESTED - // state := mWorkerState (RESUME_REQUESTED) - // mWorkerState := RUNNING, but we don't notify the client yet - // first workerCycle gets executed, the code below triggers a client notification - // (or if workerCycle fails, worker enters 'error' state and also notifies) - // state := mWorkerState (RUNNING) - std::lock_guard lock(mWorkerLock); - if (state == WorkerState::RESUME_REQUESTED) { - needToNotify = true; - } - state = mWorkerState; - if (mWorkerState == WorkerState::PAUSE_REQUESTED) { - state = mWorkerState = WorkerState::PAUSED; - needToNotify = true; - } else if (mWorkerState == WorkerState::RESUME_REQUESTED) { - mWorkerState = WorkerState::RUNNING; - } - } else { - std::lock_guard lock(mWorkerLock); - if (state == WorkerState::RESUME_REQUESTED || - mWorkerState == WorkerState::PAUSE_REQUESTED) { - needToNotify = true; - } - state = mWorkerState = WorkerState::STOPPED; - if (status == WorkerStatus::ABORT) { - mError = "workerCycle aborted"; - } - } - if (needToNotify) { - { - std::lock_guard lock(mWorkerLock); - mWorkerStateChangeRequest = false; - } - mWorkerCv.notify_one(); - } - } - } + WorkerState* finalState = nullptr); + void workerThread(); + StreamLogic* const mLogic; std::string mThreadName; int mThreadPriority = ANDROID_PRIORITY_DEFAULT; std::thread mWorker; @@ -230,4 +83,71 @@ class StreamWorker { std::atomic mWorkerStateChangeRequest GUARDED_BY(mWorkerLock) = false; }; +} // namespace internal + +class StreamLogic { + public: + friend class internal::ThreadController; + + virtual ~StreamLogic() = default; + + protected: + enum class Status { ABORT, CONTINUE, EXIT }; + + /* Called once at the beginning of the thread loop. Must return + * an empty string to enter the thread loop, otherwise the thread loop + * exits and the worker switches into the 'error' state, setting + * the error to the returned value. + */ + virtual std::string init() = 0; + + /* Called for each thread loop unless the thread is in 'paused' state. + * Must return 'CONTINUE' to continue running, otherwise the thread loop + * exits. If the result from worker cycle is 'ABORT' then the worker switches + * into the 'error' state with a generic error message. It is recommended that + * the subclass reports any problems via logging facilities. Returning the 'EXIT' + * status is equivalent to calling 'stop()' method. This is just a way of + * of stopping the worker by its own initiative. + */ + virtual Status cycle() = 0; +}; + +template +class StreamWorker : public LogicImpl { + public: + template + explicit StreamWorker(Args&&... args) : LogicImpl(std::forward(args)...), mThread(this) {} + + // Methods of LogicImpl are available via inheritance. + // Forwarded methods of ThreadController follow. + + // Note that 'priority' here is what is known as the 'nice number' in *nix systems. + // The nice number is used with the default scheduler. For threads that + // need to use a specialized scheduler (e.g. SCHED_FIFO) and set the priority within it, + // it is recommended to implement an appropriate configuration sequence within + // 'LogicImpl' or 'StreamLogic::init'. + bool start(const std::string& name = "", int priority = ANDROID_PRIORITY_DEFAULT) { + return mThread.start(name, priority); + } + void pause() { mThread.pause(); } + void resume() { mThread.resume(); } + bool hasError() { return mThread.hasError(); } + std::string getError() { return mThread.getError(); } + void stop() { return mThread.stop(); } + bool waitForAtLeastOneCycle() { return mThread.waitForAtLeastOneCycle(); } + + // Only used by unit tests. + void testLockUnlockMutex(bool lock) { mThread.lockUnlockMutex(lock); } + std::thread::native_handle_type testGetThreadNativeHandle() { + return mThread.getThreadNativeHandle(); + } + + private: + // The ThreadController gets destroyed before LogicImpl. + // After the controller has been destroyed, it is guaranteed that + // the thread was joined, thus the 'cycle' method of LogicImpl + // will not be called anymore, and it is safe to destroy LogicImpl. + internal::ThreadController mThread; +}; + } // namespace android::hardware::audio::common diff --git a/audio/aidl/common/tests/streamworker_tests.cpp b/audio/aidl/common/tests/streamworker_tests.cpp index df81c69716..e3e484d7e3 100644 --- a/audio/aidl/common/tests/streamworker_tests.cpp +++ b/audio/aidl/common/tests/streamworker_tests.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include @@ -26,18 +27,19 @@ #define LOG_TAG "StreamWorker_Test" #include +using android::hardware::audio::common::StreamLogic; using android::hardware::audio::common::StreamWorker; -class TestWorker : public StreamWorker { +class TestWorkerLogic : public StreamLogic { public: struct Stream { - void setErrorStatus() { status = WorkerStatus::ABORT; } - void setStopStatus() { status = WorkerStatus::EXIT; } - std::atomic status = WorkerStatus::CONTINUE; + void setErrorStatus() { status = Status::ABORT; } + void setStopStatus() { status = Status::EXIT; } + std::atomic status = Status::CONTINUE; }; // Use nullptr to test error reporting from the worker thread. - explicit TestWorker(Stream* stream) : mStream(stream) {} + explicit TestWorkerLogic(Stream* stream) : mStream(stream) {} size_t getWorkerCycles() const { return mWorkerCycles; } int getPriority() const { return mPriority; } @@ -48,8 +50,10 @@ class TestWorker : public StreamWorker { return mWorkerCycles == cyclesBefore; } - std::string workerInit() { return mStream != nullptr ? "" : "Expected error"; } - WorkerStatus workerCycle() { + protected: + // StreamLogic implementation + std::string init() override { return mStream != nullptr ? "" : "Expected error"; } + Status cycle() override { mPriority = getpriority(PRIO_PROCESS, 0); do { mWorkerCycles++; @@ -62,6 +66,7 @@ class TestWorker : public StreamWorker { std::atomic mWorkerCycles = 0; std::atomic mPriority = ANDROID_PRIORITY_DEFAULT; }; +using TestWorker = StreamWorker; // The parameter specifies whether an extra call to 'stop' is made at the end. class StreamWorkerInvalidTest : public testing::TestWithParam { diff --git a/audio/aidl/default/Android.bp b/audio/aidl/default/Android.bp index 027d92873f..07b10976f7 100644 --- a/audio/aidl/default/Android.bp +++ b/audio/aidl/default/Android.bp @@ -11,6 +11,7 @@ cc_library_static { name: "libaudioserviceexampleimpl", vendor: true, shared_libs: [ + "libaudioaidlcommon", "libbase", "libbinder_ndk", "libstagefright_foundation", diff --git a/audio/aidl/vts/Android.bp b/audio/aidl/vts/Android.bp index 75ff37f088..1d0ec7c3f6 100644 --- a/audio/aidl/vts/Android.bp +++ b/audio/aidl/vts/Android.bp @@ -26,6 +26,7 @@ cc_test { "android.hardware.common-V2-ndk", "android.hardware.common.fmq-V1-ndk", "android.media.audio.common.types-V1-ndk", + "libaudioaidlcommon", ], test_suites: [ "general-tests", From 01803d454ac192f4b6b732944f0be324b1b03a7f Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Fri, 22 Jul 2022 23:23:25 +0000 Subject: [PATCH 212/998] audio: Implementation of audio I/O, part II This patch implements audio I/O for the synchronous, non-MMAP case. Updated the StreamDescriptor structure to make it usable. Clarified comments on the expectations for the client and the HAL module. Bug: 205884982 Test: atest VtsHalAudioCoreTargetTest Change-Id: I09651c6e80a397c80870622ac19234b4d4a38cbb --- .../hardware/audio/core/StreamDescriptor.aidl | 6 +- .../android/hardware/audio/core/IModule.aidl | 26 +- .../hardware/audio/core/IStreamIn.aidl | 8 +- .../hardware/audio/core/IStreamOut.aidl | 8 +- .../hardware/audio/core/StreamDescriptor.aidl | 70 +-- audio/aidl/common/include/Utils.h | 73 +++ audio/aidl/default/Android.bp | 23 +- audio/aidl/default/Module.cpp | 164 +++---- audio/aidl/default/Stream.cpp | 245 ++++++++-- audio/aidl/default/include/core-impl/Module.h | 14 +- audio/aidl/default/include/core-impl/Stream.h | 197 +++++++- audio/aidl/default/main.cpp | 6 + audio/aidl/vts/Android.bp | 16 +- audio/aidl/vts/ModuleConfig.cpp | 9 + audio/aidl/vts/ModuleConfig.h | 3 + audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp | 445 ++++++++++++++++-- 16 files changed, 1066 insertions(+), 247 deletions(-) create mode 100644 audio/aidl/common/include/Utils.h diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl index 472a8a2f45..e7ed502bd2 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl @@ -38,11 +38,7 @@ parcelable StreamDescriptor { android.hardware.common.fmq.MQDescriptor reply; long bufferSizeFrames; android.hardware.audio.core.StreamDescriptor.AudioBuffer audio; - const int COMMAND_EXIT = 0; const int COMMAND_BURST = 1; - const int STATUS_OK = 0; - const int STATUS_ILLEGAL_ARGUMENT = 1; - const int STATUS_ILLEGAL_STATE = 2; @FixedSize @VintfStability parcelable Position { long frames; @@ -63,7 +59,7 @@ parcelable StreamDescriptor { } @VintfStability union AudioBuffer { - android.hardware.common.fmq.MQDescriptor fmq; + android.hardware.common.fmq.MQDescriptor fmq; android.hardware.audio.core.MmapBufferDescriptor mmap; } } diff --git a/audio/aidl/android/hardware/audio/core/IModule.aidl b/audio/aidl/android/hardware/audio/core/IModule.aidl index 363eb683f3..735f87ff17 100644 --- a/audio/aidl/android/hardware/audio/core/IModule.aidl +++ b/audio/aidl/android/hardware/audio/core/IModule.aidl @@ -255,12 +255,16 @@ interface IModule { * * Note that although it's not prohibited to open a stream on a mix port * configuration which is not connected (using a patch) to any device port, - * and set up a patch afterwards, this is not the recommended sequence of - * calls, because setting up of a patch might fail due to an insufficient - * stream buffer size. + * and set up a patch afterwards, this sequence of calls is not recommended, + * because setting up of a patch might fail due to an insufficient stream + * buffer size. Another consequence of having a stream on an unconnected mix + * port is that capture positions can not be determined because there is no + * "external observer," thus read operations done via StreamDescriptor will + * be completing with an error, although data (zero filled) will still be + * provided. * * @return An opened input stream and the associated descriptor. - * @param args Input arguments, see 'OpenInputStreamArguments' parcelable. + * @param args The pack of arguments, see 'OpenInputStreamArguments' parcelable. * @throws EX_ILLEGAL_ARGUMENT In the following cases: * - If the port config can not be found by the ID. * - If the port config is not of an input mix port. @@ -269,6 +273,7 @@ interface IModule { * - If the port config already has a stream opened on it. * - If the limit on the open stream count for the port has * been reached. + * - If the HAL module failed to initialize the stream. */ @VintfStability parcelable OpenInputStreamArguments { @@ -312,12 +317,16 @@ interface IModule { * * Note that although it's not prohibited to open a stream on a mix port * configuration which is not connected (using a patch) to any device port, - * and set up a patch afterwards, this is not the recommended sequence of - * calls, because setting up of a patch might fail due to an insufficient - * stream buffer size. + * and set up a patch afterwards, this sequence of calls is not recommended, + * because setting up of a patch might fail due to an insufficient stream + * buffer size. Another consequence of having a stream on an unconnected mix + * port is that presentation positions can not be determined because there + * is no "external observer," thus write operations done via + * StreamDescriptor will be completing with an error, although the data + * will still be accepted and immediately discarded. * * @return An opened output stream and the associated descriptor. - * @param args Input arguments, see 'OpenOutputStreamArguments' parcelable. + * @param args The pack of arguments, see 'OpenOutputStreamArguments' parcelable. * @throws EX_ILLEGAL_ARGUMENT In the following cases: * - If the port config can not be found by the ID. * - If the port config is not of an output mix port. @@ -330,6 +339,7 @@ interface IModule { * been reached. * - If another opened stream already exists for the 'PRIMARY' * output port. + * - If the HAL module failed to initialize the stream. */ @VintfStability parcelable OpenOutputStreamArguments { diff --git a/audio/aidl/android/hardware/audio/core/IStreamIn.aidl b/audio/aidl/android/hardware/audio/core/IStreamIn.aidl index 7205bb8e18..0c3e3d1bb6 100644 --- a/audio/aidl/android/hardware/audio/core/IStreamIn.aidl +++ b/audio/aidl/android/hardware/audio/core/IStreamIn.aidl @@ -27,10 +27,12 @@ interface IStreamIn { * Close the stream. * * Releases any resources allocated for this stream on the HAL module side. - * The stream can not be operated after it has been closed. Methods of this - * interface throw EX_ILLEGAL_STATE for a closed stream. + * This includes the fast message queues and shared memories returned via + * the StreamDescriptor. Thus, the stream can not be operated anymore after + * it has been closed. The client needs to release the audio data I/O + * objects after the call to this method returns. * - * The associated stream descriptor can be released once this method returns. + * Methods of this interface throw EX_ILLEGAL_STATE for a closed stream. * * @throws EX_ILLEGAL_STATE If the stream has already been closed. */ diff --git a/audio/aidl/android/hardware/audio/core/IStreamOut.aidl b/audio/aidl/android/hardware/audio/core/IStreamOut.aidl index 0a5aacdd7a..9fdb37d07a 100644 --- a/audio/aidl/android/hardware/audio/core/IStreamOut.aidl +++ b/audio/aidl/android/hardware/audio/core/IStreamOut.aidl @@ -27,10 +27,12 @@ interface IStreamOut { * Close the stream. * * Releases any resources allocated for this stream on the HAL module side. - * The stream can not be operated after it has been closed. Methods of this - * interface throw EX_ILLEGAL_STATE for a closed stream. + * This includes the fast message queues and shared memories returned via + * the StreamDescriptor. Thus, the stream can not be operated anymore after + * it has been closed. The client needs to release the audio data I/O + * objects after the call to this method returns. * - * The associated stream descriptor can be released once this method returns. + * Methods of this interface throw EX_ILLEGAL_STATE for a closed stream. * * @throws EX_ILLEGAL_STATE If the stream has already been closed. */ diff --git a/audio/aidl/android/hardware/audio/core/StreamDescriptor.aidl b/audio/aidl/android/hardware/audio/core/StreamDescriptor.aidl index f2338e0d2a..74090d7910 100644 --- a/audio/aidl/android/hardware/audio/core/StreamDescriptor.aidl +++ b/audio/aidl/android/hardware/audio/core/StreamDescriptor.aidl @@ -19,7 +19,6 @@ package android.hardware.audio.core; import android.hardware.audio.core.MmapBufferDescriptor; import android.hardware.common.fmq.MQDescriptor; import android.hardware.common.fmq.SynchronizedReadWrite; -import android.hardware.common.fmq.UnsynchronizedWrite; /** * Stream descriptor contains fast message queues and buffers used for sending @@ -56,13 +55,6 @@ parcelable StreamDescriptor { long timeNs; } - /** - * The exit command is used to unblock the HAL thread and ask it to exit. - * This is the last command that the client sends via the StreamDescriptor. - * The HAL module must reply to this command in order to unblock the client, - * and cease waiting on the command queue. - */ - const int COMMAND_EXIT = 0; /** * The command used for audio I/O, see 'AudioBuffer'. For MMap No IRQ mode * this command only provides updated positions and latency because actual @@ -83,29 +75,26 @@ parcelable StreamDescriptor { */ int code; /** - * For output streams: the amount of bytes provided by the client in the - * 'audio.fmq' queue. - * For input streams: the amount of bytes requested by the client to read - * from the hardware into the 'audio.fmq' queue. + * For output streams: the amount of bytes that the client requests the + * HAL module to read from the 'audio.fmq' queue. + * For input streams: the amount of bytes requested by the client to + * read from the hardware into the 'audio.fmq' queue. + * + * In both cases it is allowed for this field to contain any + * non-negative number. The value 0 can be used if the client only needs + * to retrieve current positions and latency. Any sufficiently big value + * which exceeds the size of the queue's area which is currently + * available for reading or writing by the HAL module must be trimmed by + * the HAL module to the available size. Note that the HAL module is + * allowed to consume or provide less data than requested, and it must + * return the amount of actually read or written data via the + * 'Reply.fmqByteCount' field. Thus, only attempts to pass a negative + * number must be constituted as a client's error. */ int fmqByteCount; } MQDescriptor command; - /** - * No error, the command completed successfully. - */ - const int STATUS_OK = 0; - /** - * Invalid data provided in the command, e.g. unknown command code or - * negative 'fmqByteCount' value. - */ - const int STATUS_ILLEGAL_ARGUMENT = 1; - /** - * The HAL module is not in the state when it can complete the command. - */ - const int STATUS_ILLEGAL_STATE = 2; - /** * Used for providing replies to commands. The HAL module writes into * the queue, the client reads. The queue can only contain a single reply, @@ -115,7 +104,15 @@ parcelable StreamDescriptor { @FixedSize parcelable Reply { /** - * One of STATUS_* statuses. + * One of Binder STATUS_* statuses: + * - STATUS_OK: the command has completed successfully; + * - STATUS_BAD_VALUE: invalid value in the 'Command' structure; + * - STATUS_INVALID_OPERATION: the mix port is not connected + * to any producer or consumer, thus + * positions can not be reported; + * - STATUS_NOT_ENOUGH_DATA: a read or write error has + * occurred for the 'audio.fmq' queue; + * */ int status; /** @@ -123,6 +120,9 @@ parcelable StreamDescriptor { * module from the 'audio.fmq' queue. * For input streams: the amount of bytes actually provided by the HAL * in the 'audio.fmq' queue. + * + * The returned value must not exceed the value passed in the + * 'fmqByteCount' field of the corresponding command or be negative. */ int fmqByteCount; /** @@ -162,12 +162,15 @@ parcelable StreamDescriptor { @VintfStability union AudioBuffer { /** - * The fast message queue used for all modes except MMap No IRQ. Access - * to this queue is synchronized via the 'command' and 'reply' queues - * as described below. + * The fast message queue used for all modes except MMap No IRQ. Both + * reads and writes into this queue are non-blocking because access to + * this queue is synchronized via the 'command' and 'reply' queues as + * described below. The queue nevertheless uses 'SynchronizedReadWrite' + * because there is only one reader, and the reading position must be + * shared. * * For output streams the following sequence of operations is used: - * 1. The client puts audio data into the 'audio.fmq' queue. + * 1. The client writes audio data into the 'audio.fmq' queue. * 2. The client writes the 'BURST' command into the 'command' queue, * and hangs on waiting on a read from the 'reply' queue. * 3. The high priority thread in the HAL module wakes up due to 2. @@ -175,19 +178,20 @@ parcelable StreamDescriptor { * 5. The HAL module writes the command status and current positions * into 'reply' queue, and hangs on waiting on a read from * the 'command' queue. + * 6. The client wakes up due to 5. and reads the reply. * * For input streams the following sequence of operations is used: * 1. The client writes the 'BURST' command into the 'command' queue, * and hangs on waiting on a read from the 'reply' queue. * 2. The high priority thread in the HAL module wakes up due to 1. - * 3. The HAL module puts audio data into the 'audio.fmq' queue. + * 3. The HAL module writes audio data into the 'audio.fmq' queue. * 4. The HAL module writes the command status and current positions * into 'reply' queue, and hangs on waiting on a read from * the 'command' queue. * 5. The client wakes up due to 4. * 6. The client reads the reply and audio data. */ - MQDescriptor fmq; + MQDescriptor fmq; /** * MMap buffers are shared directly with the DSP, which operates * independently from the CPU. Writes and reads into these buffers diff --git a/audio/aidl/common/include/Utils.h b/audio/aidl/common/include/Utils.h new file mode 100644 index 0000000000..1a87882c1a --- /dev/null +++ b/audio/aidl/common/include/Utils.h @@ -0,0 +1,73 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include + +namespace android::hardware::audio::common { + +constexpr size_t getPcmSampleSizeInBytes(::aidl::android::media::audio::common::PcmType pcm) { + using ::aidl::android::media::audio::common::PcmType; + switch (pcm) { + case PcmType::UINT_8_BIT: + return 1; + case PcmType::INT_16_BIT: + return 2; + case PcmType::INT_32_BIT: + return 4; + case PcmType::FIXED_Q_8_24: + return 4; + case PcmType::FLOAT_32_BIT: + return 4; + case PcmType::INT_24_BIT: + return 3; + } + return 0; +} + +constexpr size_t getChannelCount( + const ::aidl::android::media::audio::common::AudioChannelLayout& layout) { + using Tag = ::aidl::android::media::audio::common::AudioChannelLayout::Tag; + switch (layout.getTag()) { + case Tag::none: + return 0; + case Tag::invalid: + return 0; + case Tag::indexMask: + return __builtin_popcount(layout.get()); + case Tag::layoutMask: + return __builtin_popcount(layout.get()); + case Tag::voiceMask: + return __builtin_popcount(layout.get()); + } + return 0; +} + +constexpr size_t getFrameSizeInBytes( + const ::aidl::android::media::audio::common::AudioFormatDescription& format, + const ::aidl::android::media::audio::common::AudioChannelLayout& layout) { + using ::aidl::android::media::audio::common::AudioFormatType; + if (format.type == AudioFormatType::PCM) { + return getPcmSampleSizeInBytes(format.pcm) * getChannelCount(layout); + } + // For non-PCM formats always use frame size of 1. + return 1; +} + +} // namespace android::hardware::audio::common diff --git a/audio/aidl/default/Android.bp b/audio/aidl/default/Android.bp index 07b10976f7..03f8c64a6a 100644 --- a/audio/aidl/default/Android.bp +++ b/audio/aidl/default/Android.bp @@ -7,19 +7,27 @@ package { default_applicable_licenses: ["hardware_interfaces_license"], } -cc_library_static { - name: "libaudioserviceexampleimpl", +cc_defaults { + name: "aidlaudioservice_defaults", vendor: true, shared_libs: [ "libaudioaidlcommon", "libbase", "libbinder_ndk", + "libcutils", + "libfmq", "libstagefright_foundation", + "libutils", "android.media.audio.common.types-V1-ndk", "android.hardware.audio.core-V1-ndk", "android.hardware.common-V2-ndk", "android.hardware.common.fmq-V1-ndk", ], +} + +cc_library_static { + name: "libaudioserviceexampleimpl", + defaults: ["aidlaudioservice_defaults"], export_include_dirs: ["include"], srcs: [ "Config.cpp", @@ -37,16 +45,7 @@ cc_binary { relative_install_path: "hw", init_rc: ["android.hardware.audio.service-aidl.example.rc"], vintf_fragments: ["android.hardware.audio.service-aidl.xml"], - vendor: true, - shared_libs: [ - "libbase", - "libbinder_ndk", - "libstagefright_foundation", - "android.media.audio.common.types-V1-ndk", - "android.hardware.audio.core-V1-ndk", - "android.hardware.common-V2-ndk", - "android.hardware.common.fmq-V1-ndk", - ], + defaults: ["aidlaudioservice_defaults"], static_libs: [ "libaudioserviceexampleimpl", ], diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp index 1c6f90a021..af033d0e9b 100644 --- a/audio/aidl/default/Module.cpp +++ b/audio/aidl/default/Module.cpp @@ -20,6 +20,8 @@ #define LOG_TAG "AHAL_Module" #include +#include +#include #include #include "core-impl/Module.h" @@ -30,6 +32,7 @@ using aidl::android::hardware::audio::common::SourceMetadata; using aidl::android::media::audio::common::AudioChannelLayout; using aidl::android::media::audio::common::AudioFormatDescription; using aidl::android::media::audio::common::AudioFormatType; +using aidl::android::media::audio::common::AudioInputFlags; using aidl::android::media::audio::common::AudioIoFlags; using aidl::android::media::audio::common::AudioOffloadInfo; using aidl::android::media::audio::common::AudioOutputFlags; @@ -39,6 +42,7 @@ using aidl::android::media::audio::common::AudioPortExt; using aidl::android::media::audio::common::AudioProfile; using aidl::android::media::audio::common::Int; using aidl::android::media::audio::common::PcmType; +using android::hardware::audio::common::getFrameSizeInBytes; namespace aidl::android::hardware::audio::core { @@ -72,49 +76,6 @@ bool generateDefaultPortConfig(const AudioPort& port, AudioPortConfig* config) { return true; } -constexpr size_t getPcmSampleSizeInBytes(PcmType pcm) { - switch (pcm) { - case PcmType::UINT_8_BIT: - return 1; - case PcmType::INT_16_BIT: - return 2; - case PcmType::INT_32_BIT: - return 4; - case PcmType::FIXED_Q_8_24: - return 4; - case PcmType::FLOAT_32_BIT: - return 4; - case PcmType::INT_24_BIT: - return 3; - } - return 0; -} - -constexpr size_t getChannelCount(const AudioChannelLayout& layout) { - using Tag = AudioChannelLayout::Tag; - switch (layout.getTag()) { - case Tag::none: - return 0; - case Tag::invalid: - return 0; - case Tag::indexMask: - return __builtin_popcount(layout.get()); - case Tag::layoutMask: - return __builtin_popcount(layout.get()); - case Tag::voiceMask: - return __builtin_popcount(layout.get()); - } - return 0; -} - -size_t getFrameSizeInBytes(const AudioFormatDescription& format, const AudioChannelLayout& layout) { - if (format.type == AudioFormatType::PCM) { - return getPcmSampleSizeInBytes(format.pcm) * getChannelCount(layout); - } - // For non-PCM formats always use frame size of 1. - return 1; -} - bool findAudioProfile(const AudioPort& port, const AudioFormatDescription& format, AudioProfile* profile) { if (auto profilesIt = @@ -133,33 +94,8 @@ void Module::cleanUpPatch(int32_t patchId) { erase_all_values(mPatches, std::set{patchId}); } -void Module::cleanUpPatches(int32_t portConfigId) { - auto& patches = getConfig().patches; - if (patches.size() == 0) return; - auto range = mPatches.equal_range(portConfigId); - for (auto it = range.first; it != range.second; ++it) { - auto patchIt = findById(patches, it->second); - if (patchIt != patches.end()) { - erase_if(patchIt->sourcePortConfigIds, - [portConfigId](auto e) { return e == portConfigId; }); - erase_if(patchIt->sinkPortConfigIds, - [portConfigId](auto e) { return e == portConfigId; }); - } - } - std::set erasedPatches; - for (size_t i = patches.size() - 1; i != 0; --i) { - const auto& patch = patches[i]; - if (patch.sourcePortConfigIds.empty() || patch.sinkPortConfigIds.empty()) { - erasedPatches.insert(patch.id); - patches.erase(patches.begin() + i); - } - } - erase_all_values(mPatches, erasedPatches); -} - -ndk::ScopedAStatus Module::createStreamDescriptor(int32_t in_portConfigId, - int64_t in_bufferSizeFrames, - StreamDescriptor* out_descriptor) { +ndk::ScopedAStatus Module::createStreamContext(int32_t in_portConfigId, int64_t in_bufferSizeFrames, + StreamContext* out_context) { if (in_bufferSizeFrames <= 0) { LOG(ERROR) << __func__ << ": non-positive buffer size " << in_bufferSizeFrames; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); @@ -171,7 +107,7 @@ ndk::ScopedAStatus Module::createStreamDescriptor(int32_t in_portConfigId, } auto& configs = getConfig().portConfigs; auto portConfigIt = findById(configs, in_portConfigId); - // Since 'createStreamDescriptor' is an internal method, it is assumed that + // Since this is a private method, it is assumed that // validity of the portConfigId has already been checked. const size_t frameSize = getFrameSizeInBytes(portConfigIt->format.value(), portConfigIt->channelMask.value()); @@ -187,7 +123,26 @@ ndk::ScopedAStatus Module::createStreamDescriptor(int32_t in_portConfigId, << kMaximumStreamBufferSizeBytes / frameSize; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } - (void)out_descriptor; + const auto& flags = portConfigIt->flags.value(); + if ((flags.getTag() == AudioIoFlags::Tag::input && + (flags.get() & + 1 << static_cast(AudioInputFlags::MMAP_NOIRQ)) == 0) || + (flags.getTag() == AudioIoFlags::Tag::output && + (flags.get() & + 1 << static_cast(AudioOutputFlags::MMAP_NOIRQ)) == 0)) { + StreamContext temp( + std::make_unique(1, true /*configureEventFlagWord*/), + std::make_unique(1, true /*configureEventFlagWord*/), + frameSize, + std::make_unique(frameSize * in_bufferSizeFrames)); + if (temp.isValid()) { + *out_context = std::move(temp); + } else { + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } + } else { + // TODO: Implement simulation of MMAP buffer allocation + } return ndk::ScopedAStatus::ok(); } @@ -253,6 +208,28 @@ void Module::registerPatch(const AudioPatch& patch) { do_insert(patch.sinkPortConfigIds); } +void Module::updateStreamsConnectedState(const AudioPatch& oldPatch, const AudioPatch& newPatch) { + // Streams from the old patch need to be disconnected, streams from the new + // patch need to be connected. If the stream belongs to both patches, no need + // to update it. + std::set idsToDisconnect, idsToConnect; + idsToDisconnect.insert(oldPatch.sourcePortConfigIds.begin(), + oldPatch.sourcePortConfigIds.end()); + idsToDisconnect.insert(oldPatch.sinkPortConfigIds.begin(), oldPatch.sinkPortConfigIds.end()); + idsToConnect.insert(newPatch.sourcePortConfigIds.begin(), newPatch.sourcePortConfigIds.end()); + idsToConnect.insert(newPatch.sinkPortConfigIds.begin(), newPatch.sinkPortConfigIds.end()); + std::for_each(idsToDisconnect.begin(), idsToDisconnect.end(), [&](const auto& portConfigId) { + if (idsToConnect.count(portConfigId) == 0) { + mStreams.setStreamIsConnected(portConfigId, false); + } + }); + std::for_each(idsToConnect.begin(), idsToConnect.end(), [&](const auto& portConfigId) { + if (idsToDisconnect.count(portConfigId) == 0) { + mStreams.setStreamIsConnected(portConfigId, true); + } + }); +} + ndk::ScopedAStatus Module::setModuleDebug( const ::aidl::android::hardware::audio::core::ModuleDebug& in_debug) { LOG(DEBUG) << __func__ << ": old flags:" << mDebug.toString() @@ -467,13 +444,22 @@ ndk::ScopedAStatus Module::openInputStream(const OpenInputStreamArguments& in_ar << " does not correspond to an input mix port"; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } - if (auto status = createStreamDescriptor(in_args.portConfigId, in_args.bufferSizeFrames, - &_aidl_return->desc); + StreamContext context; + if (auto status = createStreamContext(in_args.portConfigId, in_args.bufferSizeFrames, &context); !status.isOk()) { return status; } - auto stream = ndk::SharedRefBase::make(in_args.sinkMetadata); - mStreams.insert(port->id, in_args.portConfigId, StreamWrapper(stream)); + context.fillDescriptor(&_aidl_return->desc); + auto stream = ndk::SharedRefBase::make(in_args.sinkMetadata, std::move(context)); + if (auto status = stream->init(); !status.isOk()) { + return status; + } + StreamWrapper streamWrapper(stream); + auto patchIt = mPatches.find(in_args.portConfigId); + if (patchIt != mPatches.end()) { + streamWrapper.setStreamIsConnected(true); + } + mStreams.insert(port->id, in_args.portConfigId, std::move(streamWrapper)); _aidl_return->stream = std::move(stream); return ndk::ScopedAStatus::ok(); } @@ -499,13 +485,23 @@ ndk::ScopedAStatus Module::openOutputStream(const OpenOutputStreamArguments& in_ << " has COMPRESS_OFFLOAD flag set, requires offload info"; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } - if (auto status = createStreamDescriptor(in_args.portConfigId, in_args.bufferSizeFrames, - &_aidl_return->desc); + StreamContext context; + if (auto status = createStreamContext(in_args.portConfigId, in_args.bufferSizeFrames, &context); !status.isOk()) { return status; } - auto stream = ndk::SharedRefBase::make(in_args.sourceMetadata, in_args.offloadInfo); - mStreams.insert(port->id, in_args.portConfigId, StreamWrapper(stream)); + context.fillDescriptor(&_aidl_return->desc); + auto stream = ndk::SharedRefBase::make(in_args.sourceMetadata, std::move(context), + in_args.offloadInfo); + if (auto status = stream->init(); !status.isOk()) { + return status; + } + StreamWrapper streamWrapper(stream); + auto patchIt = mPatches.find(in_args.portConfigId); + if (patchIt != mPatches.end()) { + streamWrapper.setStreamIsConnected(true); + } + mStreams.insert(port->id, in_args.portConfigId, std::move(streamWrapper)); _aidl_return->stream = std::move(stream); return ndk::ScopedAStatus::ok(); } @@ -595,15 +591,20 @@ ndk::ScopedAStatus Module::setAudioPatch(const AudioPatch& in_requested, AudioPa _aidl_return->latenciesMs.clear(); _aidl_return->latenciesMs.insert(_aidl_return->latenciesMs.end(), _aidl_return->sinkPortConfigIds.size(), kLatencyMs); + AudioPatch oldPatch{}; if (existing == patches.end()) { _aidl_return->id = getConfig().nextPatchId++; patches.push_back(*_aidl_return); existing = patches.begin() + (patches.size() - 1); } else { + oldPatch = *existing; *existing = *_aidl_return; } registerPatch(*existing); - LOG(DEBUG) << __func__ << ": created or updated patch id " << _aidl_return->id; + updateStreamsConnectedState(oldPatch, *_aidl_return); + + LOG(DEBUG) << __func__ << ": " << (oldPatch.id == 0 ? "created" : "updated") << " patch " + << _aidl_return->toString(); return ndk::ScopedAStatus::ok(); } @@ -738,6 +739,7 @@ ndk::ScopedAStatus Module::resetAudioPatch(int32_t in_patchId) { auto patchIt = findById(patches, in_patchId); if (patchIt != patches.end()) { cleanUpPatch(patchIt->id); + updateStreamsConnectedState(*patchIt, AudioPatch{}); patches.erase(patchIt); LOG(DEBUG) << __func__ << ": erased patch " << in_patchId; return ndk::ScopedAStatus::ok(); diff --git a/audio/aidl/default/Stream.cpp b/audio/aidl/default/Stream.cpp index ab3e451364..24e46db7b5 100644 --- a/audio/aidl/default/Stream.cpp +++ b/audio/aidl/default/Stream.cpp @@ -16,7 +16,9 @@ #define LOG_TAG "AHAL_Stream" #include +#include +#include "core-impl/Module.h" #include "core-impl/Stream.h" using aidl::android::hardware::audio::common::SinkMetadata; @@ -25,13 +27,198 @@ using aidl::android::media::audio::common::AudioOffloadInfo; namespace aidl::android::hardware::audio::core { -StreamIn::StreamIn(const SinkMetadata& sinkMetadata) : mMetadata(sinkMetadata) { - LOG(DEBUG) << __func__; +void StreamContext::fillDescriptor(StreamDescriptor* desc) { + if (mCommandMQ) { + desc->command = mCommandMQ->dupeDesc(); + } + if (mReplyMQ) { + desc->reply = mReplyMQ->dupeDesc(); + } + if (mDataMQ) { + desc->bufferSizeFrames = + mDataMQ->getQuantumCount() * mDataMQ->getQuantumSize() / mFrameSize; + desc->audio.set(mDataMQ->dupeDesc()); + } } -ndk::ScopedAStatus StreamIn::close() { +bool StreamContext::isValid() const { + if (mCommandMQ && !mCommandMQ->isValid()) { + LOG(ERROR) << "command FMQ is invalid"; + return false; + } + if (mReplyMQ && !mReplyMQ->isValid()) { + LOG(ERROR) << "reply FMQ is invalid"; + return false; + } + if (mFrameSize == 0) { + LOG(ERROR) << "frame size is not set"; + return false; + } + if (mDataMQ && !mDataMQ->isValid()) { + LOG(ERROR) << "data FMQ is invalid"; + return false; + } + return true; +} + +void StreamContext::reset() { + mCommandMQ.reset(); + mReplyMQ.reset(); + mDataMQ.reset(); +} + +std::string StreamWorkerCommonLogic::init() { + if (mCommandMQ == nullptr) return "Command MQ is null"; + if (mReplyMQ == nullptr) return "Reply MQ is null"; + if (mDataMQ == nullptr) return "Data MQ is null"; + if (sizeof(decltype(mDataBuffer)::element_type) != mDataMQ->getQuantumSize()) { + return "Unexpected Data MQ quantum size: " + std::to_string(mDataMQ->getQuantumSize()); + } + mDataBufferSize = mDataMQ->getQuantumCount() * mDataMQ->getQuantumSize(); + mDataBuffer.reset(new (std::nothrow) int8_t[mDataBufferSize]); + if (mDataBuffer == nullptr) { + return "Failed to allocate data buffer for element count " + + std::to_string(mDataMQ->getQuantumCount()) + + ", size in bytes: " + std::to_string(mDataBufferSize); + } + return ""; +} + +const std::string StreamInWorkerLogic::kThreadName = "reader"; + +StreamInWorkerLogic::Status StreamInWorkerLogic::cycle() { + StreamDescriptor::Command command{}; + if (!mCommandMQ->readBlocking(&command, 1)) { + LOG(ERROR) << __func__ << ": reading of command from MQ failed"; + return Status::ABORT; + } + StreamDescriptor::Reply reply{}; + if (command.code == StreamContext::COMMAND_EXIT && + command.fmqByteCount == mInternalCommandCookie) { + LOG(DEBUG) << __func__ << ": received EXIT command"; + // This is an internal command, no need to reply. + return Status::EXIT; + } else if (command.code == StreamDescriptor::COMMAND_BURST && command.fmqByteCount >= 0) { + LOG(DEBUG) << __func__ << ": received BURST read command for " << command.fmqByteCount + << " bytes"; + usleep(3000); // Simulate a blocking call into the driver. + const size_t byteCount = std::min({static_cast(command.fmqByteCount), + mDataMQ->availableToWrite(), mDataBufferSize}); + const bool isConnected = mIsConnected; + // Simulate reading of data, or provide zeroes if the stream is not connected. + for (size_t i = 0; i < byteCount; ++i) { + using buffer_type = decltype(mDataBuffer)::element_type; + constexpr int kBufferValueRange = std::numeric_limits::max() - + std::numeric_limits::min() + 1; + mDataBuffer[i] = isConnected ? (std::rand() % kBufferValueRange) + + std::numeric_limits::min() + : 0; + } + bool success = byteCount > 0 ? mDataMQ->write(&mDataBuffer[0], byteCount) : true; + if (success) { + LOG(DEBUG) << __func__ << ": writing of " << byteCount << " bytes into data MQ" + << " succeeded; connected? " << isConnected; + // Frames are provided and counted regardless of connection status. + reply.fmqByteCount = byteCount; + mFrameCount += byteCount / mFrameSize; + if (isConnected) { + reply.status = STATUS_OK; + reply.observable.frames = mFrameCount; + reply.observable.timeNs = ::android::elapsedRealtimeNano(); + } else { + reply.status = STATUS_INVALID_OPERATION; + } + } else { + LOG(WARNING) << __func__ << ": writing of " << byteCount + << " bytes of data to MQ failed"; + reply.status = STATUS_NOT_ENOUGH_DATA; + } + reply.latencyMs = Module::kLatencyMs; + } else { + LOG(WARNING) << __func__ << ": invalid command (" << command.toString() + << ") or count: " << command.fmqByteCount; + reply.status = STATUS_BAD_VALUE; + } + LOG(DEBUG) << __func__ << ": writing reply " << reply.toString(); + if (!mReplyMQ->writeBlocking(&reply, 1)) { + LOG(ERROR) << __func__ << ": writing of reply " << reply.toString() << " to MQ failed"; + return Status::ABORT; + } + return Status::CONTINUE; +} + +const std::string StreamOutWorkerLogic::kThreadName = "writer"; + +StreamOutWorkerLogic::Status StreamOutWorkerLogic::cycle() { + StreamDescriptor::Command command{}; + if (!mCommandMQ->readBlocking(&command, 1)) { + LOG(ERROR) << __func__ << ": reading of command from MQ failed"; + return Status::ABORT; + } + StreamDescriptor::Reply reply{}; + if (command.code == StreamContext::COMMAND_EXIT && + command.fmqByteCount == mInternalCommandCookie) { + LOG(DEBUG) << __func__ << ": received EXIT command"; + // This is an internal command, no need to reply. + return Status::EXIT; + } else if (command.code == StreamDescriptor::COMMAND_BURST && command.fmqByteCount >= 0) { + LOG(DEBUG) << __func__ << ": received BURST write command for " << command.fmqByteCount + << " bytes"; + const size_t byteCount = std::min({static_cast(command.fmqByteCount), + mDataMQ->availableToRead(), mDataBufferSize}); + bool success = byteCount > 0 ? mDataMQ->read(&mDataBuffer[0], byteCount) : true; + if (success) { + const bool isConnected = mIsConnected; + LOG(DEBUG) << __func__ << ": reading of " << byteCount << " bytes from data MQ" + << " succeeded; connected? " << isConnected; + // Frames are consumed and counted regardless of connection status. + reply.fmqByteCount = byteCount; + mFrameCount += byteCount / mFrameSize; + if (isConnected) { + reply.status = STATUS_OK; + reply.observable.frames = mFrameCount; + reply.observable.timeNs = ::android::elapsedRealtimeNano(); + } else { + reply.status = STATUS_INVALID_OPERATION; + } + usleep(3000); // Simulate a blocking call into the driver. + } else { + LOG(WARNING) << __func__ << ": reading of " << byteCount + << " bytes of data from MQ failed"; + reply.status = STATUS_NOT_ENOUGH_DATA; + } + reply.latencyMs = Module::kLatencyMs; + } else { + LOG(WARNING) << __func__ << ": invalid command (" << command.toString() + << ") or count: " << command.fmqByteCount; + reply.status = STATUS_BAD_VALUE; + } + LOG(DEBUG) << __func__ << ": writing reply " << reply.toString(); + if (!mReplyMQ->writeBlocking(&reply, 1)) { + LOG(ERROR) << __func__ << ": writing of reply " << reply.toString() << " to MQ failed"; + return Status::ABORT; + } + return Status::CONTINUE; +} + +template +StreamCommon::~StreamCommon() { + if (!mIsClosed) { + LOG(ERROR) << __func__ << ": stream was not closed prior to destruction, resource leak"; + stopWorker(); + // The worker and the context should clean up by themselves via destructors. + } +} + +template +ndk::ScopedAStatus StreamCommon::close() { LOG(DEBUG) << __func__; if (!mIsClosed) { + stopWorker(); + LOG(DEBUG) << __func__ << ": joining the worker thread..."; + mWorker.stop(); + LOG(DEBUG) << __func__ << ": worker thread joined"; + mContext.reset(); mIsClosed = true; return ndk::ScopedAStatus::ok(); } else { @@ -40,40 +227,44 @@ ndk::ScopedAStatus StreamIn::close() { } } -ndk::ScopedAStatus StreamIn::updateMetadata(const SinkMetadata& in_sinkMetadata) { +template +void StreamCommon::stopWorker() { + if (auto commandMQ = mContext.getCommandMQ(); commandMQ != nullptr) { + LOG(DEBUG) << __func__ << ": asking the worker to stop..."; + StreamDescriptor::Command cmd; + cmd.code = StreamContext::COMMAND_EXIT; + cmd.fmqByteCount = mContext.getInternalCommandCookie(); + // FIXME: This can block in the case when the client wrote a command + // while the stream worker's cycle is not running. Need to revisit + // when implementing standby and pause/resume. + if (!commandMQ->writeBlocking(&cmd, 1)) { + LOG(ERROR) << __func__ << ": failed to write exit command to the MQ"; + } + LOG(DEBUG) << __func__ << ": done"; + } +} + +template +ndk::ScopedAStatus StreamCommon::updateMetadata(const Metadata& metadata) { LOG(DEBUG) << __func__; if (!mIsClosed) { - mMetadata = in_sinkMetadata; + mMetadata = metadata; return ndk::ScopedAStatus::ok(); } LOG(ERROR) << __func__ << ": stream was closed"; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); } -StreamOut::StreamOut(const SourceMetadata& sourceMetadata, +StreamIn::StreamIn(const SinkMetadata& sinkMetadata, StreamContext context) + : StreamCommon(sinkMetadata, std::move(context)) { + LOG(DEBUG) << __func__; +} + +StreamOut::StreamOut(const SourceMetadata& sourceMetadata, StreamContext context, const std::optional& offloadInfo) - : mMetadata(sourceMetadata), mOffloadInfo(offloadInfo) { + : StreamCommon(sourceMetadata, std::move(context)), + mOffloadInfo(offloadInfo) { LOG(DEBUG) << __func__; } -ndk::ScopedAStatus StreamOut::close() { - LOG(DEBUG) << __func__; - if (!mIsClosed) { - mIsClosed = true; - return ndk::ScopedAStatus::ok(); - } - LOG(ERROR) << __func__ << ": stream was already closed"; - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); -} - -ndk::ScopedAStatus StreamOut::updateMetadata(const SourceMetadata& in_sourceMetadata) { - LOG(DEBUG) << __func__; - if (!mIsClosed) { - mMetadata = in_sourceMetadata; - return ndk::ScopedAStatus::ok(); - } - LOG(ERROR) << __func__ << ": stream was closed"; - return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); -} - } // namespace aidl::android::hardware::audio::core diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h index f7e14affce..61516b2cc7 100644 --- a/audio/aidl/default/include/core-impl/Module.h +++ b/audio/aidl/default/include/core-impl/Module.h @@ -28,6 +28,11 @@ namespace aidl::android::hardware::audio::core { class Module : public BnModule { + public: + // This value is used for all AudioPatches and reported by all streams. + static constexpr int32_t kLatencyMs = 10; + + private: ndk::ScopedAStatus setModuleDebug( const ::aidl::android::hardware::audio::core::ModuleDebug& in_debug) override; ndk::ScopedAStatus connectExternalDevice( @@ -66,21 +71,18 @@ class Module : public BnModule { ndk::ScopedAStatus resetAudioPatch(int32_t in_patchId) override; ndk::ScopedAStatus resetAudioPortConfig(int32_t in_portConfigId) override; - private: void cleanUpPatch(int32_t patchId); - void cleanUpPatches(int32_t portConfigId); - ndk::ScopedAStatus createStreamDescriptor( + ndk::ScopedAStatus createStreamContext( int32_t in_portConfigId, int64_t in_bufferSizeFrames, - ::aidl::android::hardware::audio::core::StreamDescriptor* out_descriptor); + ::aidl::android::hardware::audio::core::StreamContext* out_context); ndk::ScopedAStatus findPortIdForNewStream( int32_t in_portConfigId, ::aidl::android::media::audio::common::AudioPort** port); internal::Configuration& getConfig(); void registerPatch(const AudioPatch& patch); + void updateStreamsConnectedState(const AudioPatch& oldPatch, const AudioPatch& newPatch); // This value is used for all AudioPatches. static constexpr int32_t kMinimumStreamBufferSizeFrames = 16; - // This value is used for all AudioPatches. - static constexpr int32_t kLatencyMs = 10; // The maximum stream buffer size is 1 GiB = 2 ** 30 bytes; static constexpr int32_t kMaximumStreamBufferSizeBytes = 1 << 30; diff --git a/audio/aidl/default/include/core-impl/Stream.h b/audio/aidl/default/include/core-impl/Stream.h index 87104dd1c1..816cdb1f0d 100644 --- a/audio/aidl/default/include/core-impl/Stream.h +++ b/audio/aidl/default/include/core-impl/Stream.h @@ -16,50 +16,203 @@ #pragma once +#include +#include #include +#include #include #include +#include #include #include #include #include +#include #include +#include +#include #include "core-impl/utils.h" namespace aidl::android::hardware::audio::core { -class StreamIn : public BnStreamIn { - ndk::ScopedAStatus close() override; - ndk::ScopedAStatus updateMetadata( - const ::aidl::android::hardware::audio::common::SinkMetadata& in_sinkMetadata) override; - +// This class is similar to StreamDescriptor, but unlike +// the descriptor, it actually owns the objects implementing +// data exchange: FMQs etc, whereas StreamDescriptor only +// contains their descriptors. +class StreamContext { public: - explicit StreamIn(const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata); - bool isClosed() const { return mIsClosed; } + typedef ::android::AidlMessageQueue< + StreamDescriptor::Command, + ::aidl::android::hardware::common::fmq::SynchronizedReadWrite> + CommandMQ; + typedef ::android::AidlMessageQueue< + StreamDescriptor::Reply, ::aidl::android::hardware::common::fmq::SynchronizedReadWrite> + ReplyMQ; + typedef ::android::AidlMessageQueue< + int8_t, ::aidl::android::hardware::common::fmq::SynchronizedReadWrite> + DataMQ; + + // Ensure that this value is not used by any of StreamDescriptor.COMMAND_* + static constexpr int COMMAND_EXIT = -1; + + StreamContext() = default; + StreamContext(std::unique_ptr commandMQ, std::unique_ptr replyMQ, + size_t frameSize, std::unique_ptr dataMQ) + : mCommandMQ(std::move(commandMQ)), + mInternalCommandCookie(std::rand()), + mReplyMQ(std::move(replyMQ)), + mFrameSize(frameSize), + mDataMQ(std::move(dataMQ)) {} + StreamContext(StreamContext&& other) + : mCommandMQ(std::move(other.mCommandMQ)), + mInternalCommandCookie(other.mInternalCommandCookie), + mReplyMQ(std::move(other.mReplyMQ)), + mFrameSize(other.mFrameSize), + mDataMQ(std::move(other.mDataMQ)) {} + StreamContext& operator=(StreamContext&& other) { + mCommandMQ = std::move(other.mCommandMQ); + mInternalCommandCookie = other.mInternalCommandCookie; + mReplyMQ = std::move(other.mReplyMQ); + mFrameSize = other.mFrameSize; + mDataMQ = std::move(other.mDataMQ); + return *this; + } + + void fillDescriptor(StreamDescriptor* desc); + CommandMQ* getCommandMQ() const { return mCommandMQ.get(); } + DataMQ* getDataMQ() const { return mDataMQ.get(); } + size_t getFrameSize() const { return mFrameSize; } + int getInternalCommandCookie() const { return mInternalCommandCookie; } + ReplyMQ* getReplyMQ() const { return mReplyMQ.get(); } + bool isValid() const; + void reset(); private: - ::aidl::android::hardware::audio::common::SinkMetadata mMetadata; - bool mIsClosed = false; + std::unique_ptr mCommandMQ; + int mInternalCommandCookie; // The value used to confirm that the command was posted internally + std::unique_ptr mReplyMQ; + size_t mFrameSize; + std::unique_ptr mDataMQ; }; -class StreamOut : public BnStreamOut { - ndk::ScopedAStatus close() override; +class StreamWorkerCommonLogic : public ::android::hardware::audio::common::StreamLogic { + public: + void setIsConnected(bool connected) { mIsConnected = connected; } + + protected: + explicit StreamWorkerCommonLogic(const StreamContext& context) + : mInternalCommandCookie(context.getInternalCommandCookie()), + mFrameSize(context.getFrameSize()), + mCommandMQ(context.getCommandMQ()), + mReplyMQ(context.getReplyMQ()), + mDataMQ(context.getDataMQ()) {} + std::string init() override; + + // Used both by the main and worker threads. + std::atomic mIsConnected = false; + // All fields are used on the worker thread only. + const int mInternalCommandCookie; + const size_t mFrameSize; + StreamContext::CommandMQ* mCommandMQ; + StreamContext::ReplyMQ* mReplyMQ; + StreamContext::DataMQ* mDataMQ; + // We use an array and the "size" field instead of a vector to be able to detect + // memory allocation issues. + std::unique_ptr mDataBuffer; + size_t mDataBufferSize; + long mFrameCount = 0; +}; + +class StreamInWorkerLogic : public StreamWorkerCommonLogic { + public: + static const std::string kThreadName; + explicit StreamInWorkerLogic(const StreamContext& context) : StreamWorkerCommonLogic(context) {} + + protected: + Status cycle() override; +}; +using StreamInWorker = ::android::hardware::audio::common::StreamWorker; + +class StreamOutWorkerLogic : public StreamWorkerCommonLogic { + public: + static const std::string kThreadName; + explicit StreamOutWorkerLogic(const StreamContext& context) + : StreamWorkerCommonLogic(context) {} + + protected: + Status cycle() override; +}; +using StreamOutWorker = ::android::hardware::audio::common::StreamWorker; + +template +class StreamCommon { + public: + ndk::ScopedAStatus close(); + ndk::ScopedAStatus init() { + return mWorker.start(StreamWorker::kThreadName, ANDROID_PRIORITY_AUDIO) + ? ndk::ScopedAStatus::ok() + : ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } + bool isClosed() const { return mIsClosed; } + void setIsConnected(bool connected) { mWorker.setIsConnected(connected); } + ndk::ScopedAStatus updateMetadata(const Metadata& metadata); + + protected: + StreamCommon(const Metadata& metadata, StreamContext context) + : mMetadata(metadata), mContext(std::move(context)), mWorker(mContext) {} + ~StreamCommon(); + void stopWorker(); + + Metadata mMetadata; + StreamContext mContext; + StreamWorker mWorker; + // This variable is checked in the destructor which can be called on an arbitrary Binder thread, + // thus we need to ensure that any changes made by other threads are sequentially consistent. + std::atomic mIsClosed = false; +}; + +class StreamIn + : public StreamCommon<::aidl::android::hardware::audio::common::SinkMetadata, StreamInWorker>, + public BnStreamIn { + ndk::ScopedAStatus close() override { + return StreamCommon<::aidl::android::hardware::audio::common::SinkMetadata, + StreamInWorker>::close(); + } + ndk::ScopedAStatus updateMetadata(const ::aidl::android::hardware::audio::common::SinkMetadata& + in_sinkMetadata) override { + return StreamCommon<::aidl::android::hardware::audio::common::SinkMetadata, + StreamInWorker>::updateMetadata(in_sinkMetadata); + } + + public: + StreamIn(const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata, + StreamContext context); +}; + +class StreamOut : public StreamCommon<::aidl::android::hardware::audio::common::SourceMetadata, + StreamOutWorker>, + public BnStreamOut { + ndk::ScopedAStatus close() override { + return StreamCommon<::aidl::android::hardware::audio::common::SourceMetadata, + StreamOutWorker>::close(); + } ndk::ScopedAStatus updateMetadata( const ::aidl::android::hardware::audio::common::SourceMetadata& in_sourceMetadata) - override; + override { + return StreamCommon<::aidl::android::hardware::audio::common::SourceMetadata, + StreamOutWorker>::updateMetadata(in_sourceMetadata); + } public: StreamOut(const ::aidl::android::hardware::audio::common::SourceMetadata& sourceMetadata, + StreamContext context, const std::optional<::aidl::android::media::audio::common::AudioOffloadInfo>& offloadInfo); - bool isClosed() const { return mIsClosed; } private: - ::aidl::android::hardware::audio::common::SourceMetadata mMetadata; std::optional<::aidl::android::media::audio::common::AudioOffloadInfo> mOffloadInfo; - bool mIsClosed = false; }; class StreamWrapper { @@ -74,6 +227,15 @@ class StreamWrapper { }, mStream); } + void setStreamIsConnected(bool connected) { + std::visit( + [&](auto&& ws) -> bool { + auto s = ws.lock(); + if (s) s->setIsConnected(connected); + return !!s; + }, + mStream); + } private: std::variant, std::weak_ptr> mStream; @@ -93,6 +255,11 @@ class Streams { mStreams.insert(std::pair{portConfigId, sw}); mStreams.insert(std::pair{portId, sw}); } + void setStreamIsConnected(int32_t portConfigId, bool connected) { + if (auto it = mStreams.find(portConfigId); it != mStreams.end()) { + it->second.setStreamIsConnected(connected); + } + } private: // Maps port ids and port config ids to streams. Multimap because a port diff --git a/audio/aidl/default/main.cpp b/audio/aidl/default/main.cpp index aeb9983b88..15874a0489 100644 --- a/audio/aidl/default/main.cpp +++ b/audio/aidl/default/main.cpp @@ -14,6 +14,9 @@ * limitations under the License. */ +#include +#include + #include "core-impl/Config.h" #include "core-impl/Module.h" @@ -25,6 +28,9 @@ using aidl::android::hardware::audio::core::Config; using aidl::android::hardware::audio::core::Module; int main() { + // Random values are used in the implementation. + std::srand(std::time(nullptr)); + // This is a debug implementation, always enable debug logging. android::base::SetMinimumLogSeverity(::android::base::DEBUG); ABinderProcess_setThreadPoolMaxThreadCount(16); diff --git a/audio/aidl/vts/Android.bp b/audio/aidl/vts/Android.bp index 1d0ec7c3f6..7b35133cfe 100644 --- a/audio/aidl/vts/Android.bp +++ b/audio/aidl/vts/Android.bp @@ -13,12 +13,10 @@ cc_test { "VtsHalTargetTestDefaults", "use_libaidlvintf_gtest_helper_static", ], - srcs: [ - "ModuleConfig.cpp", - "VtsHalAudioCoreTargetTest.cpp", - ], shared_libs: [ "libbinder_ndk", + "libcutils", + "libfmq", ], static_libs: [ "android.hardware.audio.common-V1-ndk", @@ -28,6 +26,16 @@ cc_test { "android.media.audio.common.types-V1-ndk", "libaudioaidlcommon", ], + cflags: [ + "-Wall", + "-Wextra", + "-Werror", + "-Wthread-safety", + ], + srcs: [ + "ModuleConfig.cpp", + "VtsHalAudioCoreTargetTest.cpp", + ], test_suites: [ "general-tests", "vts", diff --git a/audio/aidl/vts/ModuleConfig.cpp b/audio/aidl/vts/ModuleConfig.cpp index 969b0e9051..e36ab4a9bd 100644 --- a/audio/aidl/vts/ModuleConfig.cpp +++ b/audio/aidl/vts/ModuleConfig.cpp @@ -123,6 +123,15 @@ std::vector ModuleConfig::getOutputMixPorts() const { return result; } +std::vector ModuleConfig::getAttachedDevicesPortsForMixPort( + bool isInput, const AudioPortConfig& mixPortConfig) const { + const auto mixPortIt = findById(mPorts, mixPortConfig.portId); + if (mixPortIt != mPorts.end()) { + return getAttachedDevicesPortsForMixPort(isInput, *mixPortIt); + } + return {}; +} + std::vector ModuleConfig::getAttachedSinkDevicesPortsForMixPort( const AudioPort& mixPort) const { std::vector result; diff --git a/audio/aidl/vts/ModuleConfig.h b/audio/aidl/vts/ModuleConfig.h index df13430955..552f971ab9 100644 --- a/audio/aidl/vts/ModuleConfig.h +++ b/audio/aidl/vts/ModuleConfig.h @@ -54,6 +54,9 @@ class ModuleConfig { return isInput ? getAttachedSourceDevicesPortsForMixPort(mixPort) : getAttachedSinkDevicesPortsForMixPort(mixPort); } + std::vector getAttachedDevicesPortsForMixPort( + bool isInput, + const aidl::android::media::audio::common::AudioPortConfig& mixPortConfig) const; std::vector getAttachedSinkDevicesPortsForMixPort( const aidl::android::media::audio::common::AudioPort& mixPort) const; diff --git a/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp index 0ecc057c35..ac41ac3a87 100644 --- a/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp @@ -22,19 +22,24 @@ #include #include #include +#include #define LOG_TAG "VtsHalAudioCore" #include +#include +#include #include #include #include #include #include #include +#include #include #include #include +#include #include "ModuleConfig.h" @@ -63,6 +68,9 @@ using aidl::android::media::audio::common::AudioPortDeviceExt; using aidl::android::media::audio::common::AudioPortExt; using aidl::android::media::audio::common::AudioSource; using aidl::android::media::audio::common::AudioUsage; +using android::hardware::audio::common::getFrameSizeInBytes; +using android::hardware::audio::common::StreamLogic; +using android::hardware::audio::common::StreamWorker; using ndk::ScopedAStatus; namespace ndk { @@ -126,20 +134,6 @@ struct AidlDeathRecipient { } }; -template -struct IsInput { - constexpr operator bool() const; -}; - -template <> -constexpr IsInput::operator bool() const { - return true; -} -template <> -constexpr IsInput::operator bool() const { - return false; -} - // All 'With*' classes are move-only because they are associated with some // resource or state of a HAL module. class WithDebugFlags { @@ -228,7 +222,7 @@ class WithAudioPortConfig { class AudioCoreModule : public testing::TestWithParam { public: // The default buffer size is used mostly for negative tests. - static constexpr int kDefaultBufferSize = 256; + static constexpr int kDefaultBufferSizeFrames = 256; void SetUp() override { ASSERT_NO_FATAL_FAILURE(ConnectToService()); @@ -372,6 +366,216 @@ class WithDevicePortConnectedState { AudioPort mConnectedPort; }; +class StreamContext { + public: + typedef AidlMessageQueue + CommandMQ; + typedef AidlMessageQueue + ReplyMQ; + typedef AidlMessageQueue + DataMQ; + + StreamContext(const AudioPortConfig& portConfig, const StreamDescriptor& descriptor) + : mFrameSizeBytes( + getFrameSizeInBytes(portConfig.format.value(), portConfig.channelMask.value())), + mCommandMQ(new CommandMQ(descriptor.command)), + mReplyMQ(new ReplyMQ(descriptor.reply)), + mBufferSizeFrames(descriptor.bufferSizeFrames), + mDataMQ(maybeCreateDataMQ(descriptor)) {} + void checkIsValid() const { + EXPECT_NE(0UL, mFrameSizeBytes); + ASSERT_NE(nullptr, mCommandMQ); + EXPECT_TRUE(mCommandMQ->isValid()); + ASSERT_NE(nullptr, mReplyMQ); + EXPECT_TRUE(mReplyMQ->isValid()); + if (mDataMQ != nullptr) { + EXPECT_TRUE(mDataMQ->isValid()); + } + } + size_t getBufferSizeBytes() const { return mFrameSizeBytes * mBufferSizeFrames; } + size_t getBufferSizeFrames() const { return mBufferSizeFrames; } + CommandMQ* getCommandMQ() const { return mCommandMQ.get(); } + DataMQ* getDataMQ() const { return mDataMQ.get(); } + ReplyMQ* getReplyMQ() const { return mReplyMQ.get(); } + + private: + static std::unique_ptr maybeCreateDataMQ(const StreamDescriptor& descriptor) { + using Tag = StreamDescriptor::AudioBuffer::Tag; + if (descriptor.audio.getTag() == Tag::fmq) { + return std::make_unique(descriptor.audio.get()); + } + return nullptr; + } + + const size_t mFrameSizeBytes; + std::unique_ptr mCommandMQ; + std::unique_ptr mReplyMQ; + const size_t mBufferSizeFrames; + std::unique_ptr mDataMQ; +}; + +class StreamCommonLogic : public StreamLogic { + public: + StreamDescriptor::Position getLastObservablePosition() { + std::lock_guard lock(mLock); + return mLastReply.observable; + } + + protected: + explicit StreamCommonLogic(const StreamContext& context) + : mCommandMQ(context.getCommandMQ()), + mReplyMQ(context.getReplyMQ()), + mDataMQ(context.getDataMQ()), + mData(context.getBufferSizeBytes()) {} + StreamContext::CommandMQ* getCommandMQ() const { return mCommandMQ; } + StreamContext::ReplyMQ* getReplyMQ() const { return mReplyMQ; } + + std::string init() override { return ""; } + + StreamContext::CommandMQ* mCommandMQ; + StreamContext::ReplyMQ* mReplyMQ; + StreamContext::DataMQ* mDataMQ; + std::vector mData; + std::mutex mLock; + StreamDescriptor::Reply mLastReply GUARDED_BY(mLock); +}; + +class StreamReaderLogic : public StreamCommonLogic { + public: + explicit StreamReaderLogic(const StreamContext& context) : StreamCommonLogic(context) {} + + protected: + Status cycle() override { + StreamDescriptor::Command command{}; + command.code = StreamDescriptor::COMMAND_BURST; + command.fmqByteCount = mData.size(); + if (!mCommandMQ->writeBlocking(&command, 1)) { + LOG(ERROR) << __func__ << ": writing of command into MQ failed"; + return Status::ABORT; + } + StreamDescriptor::Reply reply{}; + if (!mReplyMQ->readBlocking(&reply, 1)) { + LOG(ERROR) << __func__ << ": reading of reply from MQ failed"; + return Status::ABORT; + } + if (reply.status != STATUS_OK) { + LOG(ERROR) << __func__ << ": received error status: " << statusToString(reply.status); + return Status::ABORT; + } + if (reply.fmqByteCount < 0 || reply.fmqByteCount > command.fmqByteCount) { + LOG(ERROR) << __func__ + << ": received invalid byte count in the reply: " << reply.fmqByteCount; + return Status::ABORT; + } + { + std::lock_guard lock(mLock); + mLastReply = reply; + } + const size_t readCount = std::min({mDataMQ->availableToRead(), + static_cast(reply.fmqByteCount), mData.size()}); + if (readCount == 0 || mDataMQ->read(mData.data(), readCount)) { + return Status::CONTINUE; + } + LOG(ERROR) << __func__ << ": reading of " << readCount << " data bytes from MQ failed"; + return Status::ABORT; + } +}; +using StreamReader = StreamWorker; + +class StreamWriterLogic : public StreamCommonLogic { + public: + explicit StreamWriterLogic(const StreamContext& context) : StreamCommonLogic(context) {} + + protected: + Status cycle() override { + if (!mDataMQ->write(mData.data(), mData.size())) { + LOG(ERROR) << __func__ << ": writing of " << mData.size() << " bytes to MQ failed"; + return Status::ABORT; + } + StreamDescriptor::Command command{}; + command.code = StreamDescriptor::COMMAND_BURST; + command.fmqByteCount = mData.size(); + if (!mCommandMQ->writeBlocking(&command, 1)) { + LOG(ERROR) << __func__ << ": writing of command into MQ failed"; + return Status::ABORT; + } + StreamDescriptor::Reply reply{}; + if (!mReplyMQ->readBlocking(&reply, 1)) { + LOG(ERROR) << __func__ << ": reading of reply from MQ failed"; + return Status::ABORT; + } + if (reply.status != STATUS_OK) { + LOG(ERROR) << __func__ << ": received error status: " << statusToString(reply.status); + return Status::ABORT; + } + if (reply.fmqByteCount < 0 || reply.fmqByteCount > command.fmqByteCount) { + LOG(ERROR) << __func__ + << ": received invalid byte count in the reply: " << reply.fmqByteCount; + return Status::ABORT; + } + { + std::lock_guard lock(mLock); + mLastReply = reply; + } + return Status::CONTINUE; + } +}; +using StreamWriter = StreamWorker; + +template +struct IOTraits { + static constexpr bool is_input = std::is_same_v; + using Worker = std::conditional_t; +}; + +// A dedicated version to test replies to invalid commands. +class StreamInvalidCommandLogic : public StreamCommonLogic { + public: + StreamInvalidCommandLogic(const StreamContext& context, + const std::vector& commands) + : StreamCommonLogic(context), mCommands(commands) {} + + std::vector getUnexpectedStatuses() { + std::lock_guard lock(mLock); + return mUnexpectedStatuses; + } + + protected: + Status cycle() override { + // Send all commands in one cycle to simplify testing. + // Extra logging helps to sort out issues with unexpected HAL behavior. + for (const auto& command : mCommands) { + LOG(INFO) << __func__ << ": writing command " << command.toString() << " into MQ..."; + if (!getCommandMQ()->writeBlocking(&command, 1)) { + LOG(ERROR) << __func__ << ": writing of command into MQ failed"; + return Status::ABORT; + } + StreamDescriptor::Reply reply{}; + LOG(INFO) << __func__ << ": reading reply for command " << command.toString() << "..."; + if (!getReplyMQ()->readBlocking(&reply, 1)) { + LOG(ERROR) << __func__ << ": reading of reply from MQ failed"; + return Status::ABORT; + } + LOG(INFO) << __func__ << ": received status " << statusToString(reply.status) + << " for command " << command.toString(); + if (reply.status != STATUS_BAD_VALUE) { + std::string s = command.toString(); + s.append(", ").append(statusToString(reply.status)); + std::lock_guard lock(mLock); + mUnexpectedStatuses.push_back(std::move(s)); + } + }; + return Status::EXIT; + } + + private: + const std::vector mCommands; + std::mutex mLock; + std::vector mUnexpectedStatuses GUARDED_BY(mLock); +}; + template class WithStream { public: @@ -381,25 +585,31 @@ class WithStream { WithStream& operator=(const WithStream&) = delete; ~WithStream() { if (mStream != nullptr) { + mContext.reset(); ScopedAStatus status = mStream->close(); EXPECT_EQ(EX_NONE, status.getExceptionCode()) << status << "; port config id " << getPortId(); } } void SetUpPortConfig(IModule* module) { ASSERT_NO_FATAL_FAILURE(mPortConfig.SetUp(module)); } - ScopedAStatus SetUpNoChecks(IModule* module, long bufferSize) { - return SetUpNoChecks(module, mPortConfig.get(), bufferSize); + ScopedAStatus SetUpNoChecks(IModule* module, long bufferSizeFrames) { + return SetUpNoChecks(module, mPortConfig.get(), bufferSizeFrames); } ScopedAStatus SetUpNoChecks(IModule* module, const AudioPortConfig& portConfig, - long bufferSize); - void SetUp(IModule* module, long bufferSize) { + long bufferSizeFrames); + void SetUp(IModule* module, long bufferSizeFrames) { ASSERT_NO_FATAL_FAILURE(SetUpPortConfig(module)); - ScopedAStatus status = SetUpNoChecks(module, bufferSize); + ScopedAStatus status = SetUpNoChecks(module, bufferSizeFrames); ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status << "; port config id " << getPortId(); ASSERT_NE(nullptr, mStream) << "; port config id " << getPortId(); + EXPECT_GE(mDescriptor.bufferSizeFrames, bufferSizeFrames) + << "actual buffer size must be no less than requested"; + mContext.emplace(mPortConfig.get(), mDescriptor); + ASSERT_NO_FATAL_FAILURE(mContext.value().checkIsValid()); } Stream* get() const { return mStream.get(); } + const StreamContext* getContext() const { return mContext ? &(mContext.value()) : nullptr; } std::shared_ptr getSharedPointer() const { return mStream; } const AudioPortConfig& getPortConfig() const { return mPortConfig.get(); } int32_t getPortId() const { return mPortConfig.getId(); } @@ -408,6 +618,7 @@ class WithStream { WithAudioPortConfig mPortConfig; std::shared_ptr mStream; StreamDescriptor mDescriptor; + std::optional mContext; }; SinkMetadata GenerateSinkMetadata(const AudioPortConfig& portConfig) { @@ -423,11 +634,11 @@ SinkMetadata GenerateSinkMetadata(const AudioPortConfig& portConfig) { template <> ScopedAStatus WithStream::SetUpNoChecks(IModule* module, const AudioPortConfig& portConfig, - long bufferSize) { + long bufferSizeFrames) { aidl::android::hardware::audio::core::IModule::OpenInputStreamArguments args; args.portConfigId = portConfig.id; args.sinkMetadata = GenerateSinkMetadata(portConfig); - args.bufferSizeFrames = bufferSize; + args.bufferSizeFrames = bufferSizeFrames; aidl::android::hardware::audio::core::IModule::OpenInputStreamReturn ret; ScopedAStatus status = module->openInputStream(args, &ret); if (status.isOk()) { @@ -451,12 +662,12 @@ SourceMetadata GenerateSourceMetadata(const AudioPortConfig& portConfig) { template <> ScopedAStatus WithStream::SetUpNoChecks(IModule* module, const AudioPortConfig& portConfig, - long bufferSize) { + long bufferSizeFrames) { aidl::android::hardware::audio::core::IModule::OpenOutputStreamArguments args; args.portConfigId = portConfig.id; args.sourceMetadata = GenerateSourceMetadata(portConfig); args.offloadInfo = ModuleConfig::generateOffloadInfoIfNeeded(portConfig); - args.bufferSizeFrames = bufferSize; + args.bufferSizeFrames = bufferSizeFrames; aidl::android::hardware::audio::core::IModule::OpenOutputStreamReturn ret; ScopedAStatus status = module->openOutputStream(args, &ret); if (status.isOk()) { @@ -471,6 +682,10 @@ class WithAudioPatch { WithAudioPatch() {} WithAudioPatch(const AudioPortConfig& srcPortConfig, const AudioPortConfig& sinkPortConfig) : mSrcPortConfig(srcPortConfig), mSinkPortConfig(sinkPortConfig) {} + WithAudioPatch(bool sinkIsCfg1, const AudioPortConfig& portConfig1, + const AudioPortConfig& portConfig2) + : mSrcPortConfig(sinkIsCfg1 ? portConfig2 : portConfig1), + mSinkPortConfig(sinkIsCfg1 ? portConfig1 : portConfig2) {} WithAudioPatch(const WithAudioPatch&) = delete; WithAudioPatch& operator=(const WithAudioPatch&) = delete; ~WithAudioPatch() { @@ -502,6 +717,11 @@ class WithAudioPatch { } int32_t getId() const { return mPatch.id; } const AudioPatch& get() const { return mPatch; } + const AudioPortConfig& getSinkPortConfig() const { return mSinkPortConfig.get(); } + const AudioPortConfig& getSrcPortConfig() const { return mSrcPortConfig.get(); } + const AudioPortConfig& getPortConfig(bool getSink) const { + return getSink ? getSinkPortConfig() : getSrcPortConfig(); + } private: WithAudioPortConfig mSrcPortConfig; @@ -567,7 +787,7 @@ TEST_P(AudioCoreModule, GetAudioRoutesAreValid) { } for (const auto& route : routes) { std::set sources(route.sourcePortIds.begin(), route.sourcePortIds.end()); - EXPECT_NE(0, sources.size()) + EXPECT_NE(0UL, sources.size()) << "empty audio port sinks in the audio route: " << route.toString(); EXPECT_EQ(sources.size(), route.sourcePortIds.size()) << "IDs of audio port sinks are not unique in the audio route: " @@ -584,10 +804,10 @@ TEST_P(AudioCoreModule, GetAudioRoutesPortIdsAreValid) { ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status; } for (const auto& route : routes) { - EXPECT_EQ(1, portIds.count(route.sinkPortId)) + EXPECT_EQ(1UL, portIds.count(route.sinkPortId)) << route.sinkPortId << " sink port id is unknown"; for (const auto& source : route.sourcePortIds) { - EXPECT_EQ(1, portIds.count(source)) << source << " source port id is unknown"; + EXPECT_EQ(1UL, portIds.count(source)) << source << " source port id is unknown"; } } } @@ -649,7 +869,7 @@ TEST_P(AudioCoreModule, CheckDevicePorts) { << "At least two output device ports are declared as default: " << defaultOutput.value() << " and " << port.id; defaultOutput = port.id; - EXPECT_EQ(0, outputs.count(devicePort.device)) + EXPECT_EQ(0UL, outputs.count(devicePort.device)) << "Non-unique output device: " << devicePort.device.toString(); outputs.insert(devicePort.device); } else if (port.flags.getTag() == AudioIoFlags::Tag::input) { @@ -657,7 +877,7 @@ TEST_P(AudioCoreModule, CheckDevicePorts) { << "At least two input device ports are declared as default: " << defaultInput.value() << " and " << port.id; defaultInput = port.id; - EXPECT_EQ(0, inputs.count(devicePort.device)) + EXPECT_EQ(0UL, inputs.count(devicePort.device)) << "Non-unique input device: " << devicePort.device.toString(); inputs.insert(devicePort.device); } else { @@ -744,7 +964,7 @@ TEST_P(AudioCoreModule, GetAudioPortWithExternalDevices) { << status << " returned for getAudioPort port ID " << connectedPortId; EXPECT_EQ(portConnected.get(), connectedPort); const auto& portProfiles = connectedPort.profiles; - EXPECT_NE(0, portProfiles.size()) + EXPECT_NE(0UL, portProfiles.size()) << "Connected port has no profiles: " << connectedPort.toString(); const auto dynamicProfileIt = std::find_if(portProfiles.begin(), portProfiles.end(), [](const auto& profile) { @@ -773,7 +993,7 @@ TEST_P(AudioCoreModule, OpenStreamInvalidPortConfigId) { { aidl::android::hardware::audio::core::IModule::OpenInputStreamArguments args; args.portConfigId = portConfigId; - args.bufferSizeFrames = kDefaultBufferSize; + args.bufferSizeFrames = kDefaultBufferSizeFrames; aidl::android::hardware::audio::core::IModule::OpenInputStreamReturn ret; ScopedAStatus status = module->openInputStream(args, &ret); EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) @@ -783,7 +1003,7 @@ TEST_P(AudioCoreModule, OpenStreamInvalidPortConfigId) { { aidl::android::hardware::audio::core::IModule::OpenOutputStreamArguments args; args.portConfigId = portConfigId; - args.bufferSizeFrames = kDefaultBufferSize; + args.bufferSizeFrames = kDefaultBufferSizeFrames; aidl::android::hardware::audio::core::IModule::OpenOutputStreamReturn ret; ScopedAStatus status = module->openOutputStream(args, &ret); EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) @@ -807,7 +1027,7 @@ TEST_P(AudioCoreModule, PortConfigPortIdsAreValid) { ASSERT_EQ(EX_NONE, status.getExceptionCode()) << status; } for (const auto& config : portConfigs) { - EXPECT_EQ(1, portIds.count(config.portId)) + EXPECT_EQ(1UL, portIds.count(config.portId)) << config.portId << " port id is unknown, config id " << config.id; } } @@ -1151,14 +1371,14 @@ class AudioStream : public AudioCoreModule { } void CloseTwice() { - const auto portConfig = moduleConfig->getSingleConfigForMixPort(IsInput()); + const auto portConfig = moduleConfig->getSingleConfigForMixPort(IOTraits::is_input); if (!portConfig.has_value()) { GTEST_SKIP() << "No mix port for attached devices"; } std::shared_ptr heldStream; { WithStream stream(portConfig.value()); - ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultBufferSize)); + ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultBufferSizeFrames)); heldStream = stream.getSharedPointer(); } ScopedAStatus status = heldStream->close(); @@ -1167,15 +1387,16 @@ class AudioStream : public AudioCoreModule { } void OpenAllConfigs() { - const auto allPortConfigs = moduleConfig->getPortConfigsForMixPorts(IsInput()); + const auto allPortConfigs = + moduleConfig->getPortConfigsForMixPorts(IOTraits::is_input); for (const auto& portConfig : allPortConfigs) { WithStream stream(portConfig); - ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultBufferSize)); + ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultBufferSizeFrames)); } } void OpenInvalidBufferSize() { - const auto portConfig = moduleConfig->getSingleConfigForMixPort(IsInput()); + const auto portConfig = moduleConfig->getSingleConfigForMixPort(IOTraits::is_input); if (!portConfig.has_value()) { GTEST_SKIP() << "No mix port for attached devices"; } @@ -1194,13 +1415,14 @@ class AudioStream : public AudioCoreModule { void OpenInvalidDirection() { // Important! The direction of the port config must be reversed. - const auto portConfig = moduleConfig->getSingleConfigForMixPort(!IsInput()); + const auto portConfig = + moduleConfig->getSingleConfigForMixPort(!IOTraits::is_input); if (!portConfig.has_value()) { GTEST_SKIP() << "No mix port for attached devices"; } WithStream stream(portConfig.value()); ASSERT_NO_FATAL_FAILURE(stream.SetUpPortConfig(module.get())); - ScopedAStatus status = stream.SetUpNoChecks(module.get(), kDefaultBufferSize); + ScopedAStatus status = stream.SetUpNoChecks(module.get(), kDefaultBufferSizeFrames); EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) << status << " open" << direction(true) << "Stream returned for port config ID " << stream.getPortId(); @@ -1208,7 +1430,7 @@ class AudioStream : public AudioCoreModule { } void OpenOverMaxCount() { - constexpr bool isInput = IsInput(); + constexpr bool isInput = IOTraits::is_input; auto ports = moduleConfig->getMixPorts(isInput); bool hasSingleRun = false; for (const auto& port : ports) { @@ -1229,10 +1451,11 @@ class AudioStream : public AudioCoreModule { streamWraps[i].emplace(portConfigs[i]); WithStream& stream = streamWraps[i].value(); if (i < maxStreamCount) { - ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultBufferSize)); + ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultBufferSizeFrames)); } else { ASSERT_NO_FATAL_FAILURE(stream.SetUpPortConfig(module.get())); - ScopedAStatus status = stream.SetUpNoChecks(module.get(), kDefaultBufferSize); + ScopedAStatus status = + stream.SetUpNoChecks(module.get(), kDefaultBufferSizeFrames); EXPECT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode()) << status << " open" << direction(true) << "Stream returned for port config ID " << stream.getPortId() @@ -1247,35 +1470,145 @@ class AudioStream : public AudioCoreModule { } void OpenTwiceSamePortConfig() { - const auto portConfig = moduleConfig->getSingleConfigForMixPort(IsInput()); + const auto portConfig = moduleConfig->getSingleConfigForMixPort(IOTraits::is_input); if (!portConfig.has_value()) { GTEST_SKIP() << "No mix port for attached devices"; } EXPECT_NO_FATAL_FAILURE(OpenTwiceSamePortConfigImpl(portConfig.value())); } + void ReadOrWrite(bool useImpl2, bool testObservablePosition) { + const auto allPortConfigs = + moduleConfig->getPortConfigsForMixPorts(IOTraits::is_input); + if (allPortConfigs.empty()) { + GTEST_SKIP() << "No mix ports have attached devices"; + } + for (const auto& portConfig : allPortConfigs) { + EXPECT_NO_FATAL_FAILURE(ReadOrWriteImpl(portConfig, useImpl2, testObservablePosition)) + << portConfig.toString(); + } + } + void ResetPortConfigWithOpenStream() { - const auto portConfig = moduleConfig->getSingleConfigForMixPort(IsInput()); + const auto portConfig = moduleConfig->getSingleConfigForMixPort(IOTraits::is_input); if (!portConfig.has_value()) { GTEST_SKIP() << "No mix port for attached devices"; } WithStream stream(portConfig.value()); - ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultBufferSize)); + ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultBufferSizeFrames)); ScopedAStatus status = module->resetAudioPortConfig(stream.getPortId()); EXPECT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode()) << status << " returned for port config ID " << stream.getPortId(); } + void SendInvalidCommand() { + const auto portConfig = moduleConfig->getSingleConfigForMixPort(IOTraits::is_input); + if (!portConfig.has_value()) { + GTEST_SKIP() << "No mix port for attached devices"; + } + EXPECT_NO_FATAL_FAILURE(SendInvalidCommandImpl(portConfig.value())); + } + void OpenTwiceSamePortConfigImpl(const AudioPortConfig& portConfig) { WithStream stream1(portConfig); - ASSERT_NO_FATAL_FAILURE(stream1.SetUp(module.get(), kDefaultBufferSize)); + ASSERT_NO_FATAL_FAILURE(stream1.SetUp(module.get(), kDefaultBufferSizeFrames)); WithStream stream2; - ScopedAStatus status = - stream2.SetUpNoChecks(module.get(), stream1.getPortConfig(), kDefaultBufferSize); + ScopedAStatus status = stream2.SetUpNoChecks(module.get(), stream1.getPortConfig(), + kDefaultBufferSizeFrames); EXPECT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode()) << status << " when opening " << direction(false) << " stream twice for the same port config ID " << stream1.getPortId(); } + + template + void WaitForObservablePositionAdvance(Worker& worker) { + static constexpr int kWriteDurationUs = 50 * 1000; + static constexpr std::chrono::milliseconds kPositionChangeTimeout{10000}; + int64_t framesInitial; + framesInitial = worker.getLastObservablePosition().frames; + ASSERT_FALSE(worker.hasError()); + bool timedOut = false; + int64_t frames = framesInitial; + for (android::base::Timer elapsed; + frames <= framesInitial && !worker.hasError() && + !(timedOut = (elapsed.duration() >= kPositionChangeTimeout));) { + usleep(kWriteDurationUs); + frames = worker.getLastObservablePosition().frames; + } + EXPECT_FALSE(timedOut); + EXPECT_FALSE(worker.hasError()) << worker.getError(); + EXPECT_GT(frames, framesInitial); + } + + void ReadOrWriteImpl(const AudioPortConfig& portConfig, bool useImpl2, + bool testObservablePosition) { + if (!useImpl2) { + ASSERT_NO_FATAL_FAILURE(ReadOrWriteImpl1(portConfig, testObservablePosition)); + } else { + ASSERT_NO_FATAL_FAILURE(ReadOrWriteImpl2(portConfig, testObservablePosition)); + } + } + + // Set up a patch first, then open a stream. + void ReadOrWriteImpl1(const AudioPortConfig& portConfig, bool testObservablePosition) { + auto devicePorts = moduleConfig->getAttachedDevicesPortsForMixPort( + IOTraits::is_input, portConfig); + ASSERT_FALSE(devicePorts.empty()); + auto devicePortConfig = moduleConfig->getSingleConfigForDevicePort(devicePorts[0]); + WithAudioPatch patch(IOTraits::is_input, portConfig, devicePortConfig); + ASSERT_NO_FATAL_FAILURE(patch.SetUp(module.get())); + + WithStream stream(patch.getPortConfig(IOTraits::is_input)); + ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultBufferSizeFrames)); + typename IOTraits::Worker worker(*stream.getContext()); + + ASSERT_TRUE(worker.start()); + ASSERT_TRUE(worker.waitForAtLeastOneCycle()); + if (testObservablePosition) { + ASSERT_NO_FATAL_FAILURE(WaitForObservablePositionAdvance(worker)); + } + } + + // Open a stream, then set up a patch for it. + void ReadOrWriteImpl2(const AudioPortConfig& portConfig, bool testObservablePosition) { + WithStream stream(portConfig); + ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultBufferSizeFrames)); + typename IOTraits::Worker worker(*stream.getContext()); + + auto devicePorts = moduleConfig->getAttachedDevicesPortsForMixPort( + IOTraits::is_input, portConfig); + ASSERT_FALSE(devicePorts.empty()); + auto devicePortConfig = moduleConfig->getSingleConfigForDevicePort(devicePorts[0]); + WithAudioPatch patch(IOTraits::is_input, stream.getPortConfig(), devicePortConfig); + ASSERT_NO_FATAL_FAILURE(patch.SetUp(module.get())); + + ASSERT_TRUE(worker.start()); + ASSERT_TRUE(worker.waitForAtLeastOneCycle()); + if (testObservablePosition) { + ASSERT_NO_FATAL_FAILURE(WaitForObservablePositionAdvance(worker)); + } + } + + void SendInvalidCommandImpl(const AudioPortConfig& portConfig) { + std::vector commands(6); + commands[0].code = -1; + commands[1].code = StreamDescriptor::COMMAND_BURST - 1; + commands[2].code = std::numeric_limits::min(); + commands[3].code = std::numeric_limits::max(); + commands[4].code = StreamDescriptor::COMMAND_BURST; + commands[4].fmqByteCount = -1; + commands[5].code = StreamDescriptor::COMMAND_BURST; + commands[5].fmqByteCount = std::numeric_limits::min(); + WithStream stream(portConfig); + ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultBufferSizeFrames)); + StreamWorker writer(*stream.getContext(), commands); + ASSERT_TRUE(writer.start()); + writer.waitForAtLeastOneCycle(); + auto unexpectedStatuses = writer.getUnexpectedStatuses(); + EXPECT_EQ(0UL, unexpectedStatuses.size()) + << "Pairs of (command, actual status): " + << android::internal::ToString(unexpectedStatuses); + } }; using AudioStreamIn = AudioStream; using AudioStreamOut = AudioStream; @@ -1292,6 +1625,13 @@ std::string AudioStreamOut::direction(bool capitalize) { #define TEST_IO_STREAM(method_name) \ TEST_P(AudioStreamIn, method_name) { ASSERT_NO_FATAL_FAILURE(method_name()); } \ TEST_P(AudioStreamOut, method_name) { ASSERT_NO_FATAL_FAILURE(method_name()); } +#define TEST_IO_STREAM_2(method_name, arg1, arg2) \ + TEST_P(AudioStreamIn, method_name##_##arg1##_##arg2) { \ + ASSERT_NO_FATAL_FAILURE(method_name(arg1, arg2)); \ + } \ + TEST_P(AudioStreamOut, method_name##_##arg1##_##arg2) { \ + ASSERT_NO_FATAL_FAILURE(method_name(arg1, arg2)); \ + } TEST_IO_STREAM(CloseTwice); TEST_IO_STREAM(OpenAllConfigs); @@ -1299,7 +1639,12 @@ TEST_IO_STREAM(OpenInvalidBufferSize); TEST_IO_STREAM(OpenInvalidDirection); TEST_IO_STREAM(OpenOverMaxCount); TEST_IO_STREAM(OpenTwiceSamePortConfig); +TEST_IO_STREAM_2(ReadOrWrite, false, false); +TEST_IO_STREAM_2(ReadOrWrite, true, false); +TEST_IO_STREAM_2(ReadOrWrite, false, true); +TEST_IO_STREAM_2(ReadOrWrite, true, true); TEST_IO_STREAM(ResetPortConfigWithOpenStream); +TEST_IO_STREAM(SendInvalidCommand); TEST_P(AudioStreamOut, OpenTwicePrimary) { const auto mixPorts = moduleConfig->getMixPorts(false); @@ -1340,7 +1685,7 @@ TEST_P(AudioStreamOut, RequireOffloadInfo) { aidl::android::hardware::audio::core::IModule::OpenOutputStreamArguments args; args.portConfigId = portConfig.value().id; args.sourceMetadata = GenerateSourceMetadata(portConfig.value()); - args.bufferSizeFrames = kDefaultBufferSize; + args.bufferSizeFrames = kDefaultBufferSizeFrames; aidl::android::hardware::audio::core::IModule::OpenOutputStreamReturn ret; ScopedAStatus status = module->openOutputStream(args, &ret); EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()) From 63f33c79a204bee5167797ceda99300e63e8708f Mon Sep 17 00:00:00 2001 From: Jeff Pu Date: Thu, 28 Jul 2022 16:06:23 -0400 Subject: [PATCH 213/998] Fingerprint virtual HAL checkin (part 1) - udfps and side fingerprint sensor instance - sensor location configuration - misc. fixes/workarounds Bug: 230515082, 230515086 Test: atest FakeFingerprintEngineTesT atest FakeFingerprintEngineUdfpsTest atest --no-bazel-mode VtsHalBiometricsFingerprintTargetTest Change-Id: I9bec76496b35029cab4561d0d4ea85a78bec589a --- .../fingerprint/aidl/default/Android.bp | 29 ++++++ .../aidl/default/FakeFingerprintEngine.cpp | 67 +++++++++++++- .../default/FakeFingerprintEngineRear.cpp | 29 ++++++ .../default/FakeFingerprintEngineSide.cpp | 37 ++++++++ .../default/FakeFingerprintEngineUdfps.cpp | 58 ++++++++++++ .../fingerprint/aidl/default/Fingerprint.cpp | 41 +++++---- biometrics/fingerprint/aidl/default/README.md | 47 +++++----- .../fingerprint/aidl/default/Session.cpp | 20 +++- ...trics.fingerprint.VirtualProps-current.txt | 6 ++ .../aidl/default/fingerprint.sysprop | 10 ++ .../default/include/FakeFingerprintEngine.h | 14 +++ .../include/FakeFingerprintEngineRear.h | 31 +++++++ .../include/FakeFingerprintEngineSide.h | 37 ++++++++ .../include/FakeFingerprintEngineUdfps.h | 44 +++++++++ .../aidl/default/include/Fingerprint.h | 7 ++ .../tests/FakeFingerprintEngineTest.cpp | 4 +- .../tests/FakeFingerprintEngineUdfpsTest.cpp | 92 +++++++++++++++++++ 17 files changed, 525 insertions(+), 48 deletions(-) create mode 100644 biometrics/fingerprint/aidl/default/FakeFingerprintEngineRear.cpp create mode 100644 biometrics/fingerprint/aidl/default/FakeFingerprintEngineSide.cpp create mode 100644 biometrics/fingerprint/aidl/default/FakeFingerprintEngineUdfps.cpp create mode 100644 biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineRear.h create mode 100644 biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineSide.h create mode 100644 biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineUdfps.h create mode 100644 biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineUdfpsTest.cpp diff --git a/biometrics/fingerprint/aidl/default/Android.bp b/biometrics/fingerprint/aidl/default/Android.bp index 2aa7bbd0b8..dc0199c98a 100644 --- a/biometrics/fingerprint/aidl/default/Android.bp +++ b/biometrics/fingerprint/aidl/default/Android.bp @@ -16,6 +16,9 @@ cc_binary { local_include_dirs: ["include"], srcs: [ "FakeFingerprintEngine.cpp", + "FakeFingerprintEngineRear.cpp", + "FakeFingerprintEngineUdfps.cpp", + "FakeFingerprintEngineSide.cpp", "Fingerprint.cpp", "Session.cpp", "main.cpp", @@ -41,6 +44,32 @@ cc_test { shared_libs: [ "libbase", "libbinder_ndk", + "android.hardware.biometrics.common.thread", + ], + static_libs: [ + "libandroid.hardware.biometrics.fingerprint.VirtualProps", + "android.hardware.biometrics.fingerprint-V2-ndk", + "android.hardware.biometrics.common-V2-ndk", + "android.hardware.keymaster-V3-ndk", + "android.hardware.biometrics.common.util", + ], + vendor: true, + test_suites: ["general-tests"], + require_root: true, +} + +cc_test { + name: "android.hardware.biometrics.fingerprint.FakeFingerprintEngineUdfpsTest", + local_include_dirs: ["include"], + srcs: [ + "tests/FakeFingerprintEngineUdfpsTest.cpp", + "FakeFingerprintEngineUdfps.cpp", + "FakeFingerprintEngine.cpp", + ], + shared_libs: [ + "libbase", + "libbinder_ndk", + "android.hardware.biometrics.common.thread", ], static_libs: [ "libandroid.hardware.biometrics.fingerprint.VirtualProps", diff --git a/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp b/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp index 138caa0fe2..68a1f26a0b 100644 --- a/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp +++ b/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp @@ -15,8 +15,10 @@ */ #include "FakeFingerprintEngine.h" +#include "Fingerprint.h" #include +#include #include @@ -24,6 +26,7 @@ #include "util/Util.h" using namespace ::android::fingerprint::virt; +using ::android::base::ParseInt; namespace aidl::android::hardware::biometrics::fingerprint { @@ -172,6 +175,11 @@ void FakeFingerprintEngine::enumerateEnrollmentsImpl(ISessionCallback* cb) { BEGIN_OP(0); std::vector ids; + // There are some enrollment sync issue with framework, which results in + // a single template removal during the very firt sync command after reboot. + // This is a workaround for now. TODO(b/243129174) + ids.push_back(-1); + for (auto& enrollment : FingerprintHalProperties::enrollments()) { auto id = enrollment.value_or(0); if (id > 0) { @@ -203,7 +211,11 @@ void FakeFingerprintEngine::removeEnrollmentsImpl(ISessionCallback* cb, void FakeFingerprintEngine::getAuthenticatorIdImpl(ISessionCallback* cb) { BEGIN_OP(0); - cb->onAuthenticatorIdRetrieved(FingerprintHalProperties::authenticator_id().value_or(0)); + int64_t authenticatorId = FingerprintHalProperties::authenticator_id().value_or(0); + if (FingerprintHalProperties::enrollments().size() > 0 && authenticatorId == 0) { + authenticatorId = 99999999; // default authenticatorId, TODO(b/230515082) + } + cb->onAuthenticatorIdRetrieved(authenticatorId); } void FakeFingerprintEngine::invalidateAuthenticatorIdImpl(ISessionCallback* cb) { @@ -221,4 +233,57 @@ void FakeFingerprintEngine::resetLockoutImpl(ISessionCallback* cb, cb->onLockoutCleared(); } +ndk::ScopedAStatus FakeFingerprintEngine::onPointerDownImpl(int32_t /*pointerId*/, int32_t /*x*/, + int32_t /*y*/, float /*minor*/, + float /*major*/) { + BEGIN_OP(0); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus FakeFingerprintEngine::onPointerUpImpl(int32_t /*pointerId*/) { + BEGIN_OP(0); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus FakeFingerprintEngine::onUiReadyImpl() { + BEGIN_OP(0); + return ndk::ScopedAStatus::ok(); +} + +bool FakeFingerprintEngine::getSensorLocationConfig(SensorLocation& out) { + auto loc = FingerprintHalProperties::sensor_location().value_or(""); + auto isValidStr = false; + auto dim = Util::split(loc, ":"); + + if (dim.size() < 3 or dim.size() > 4) { + if (!loc.empty()) LOG(WARNING) << "Invalid sensor location input (x:y:radius):" + loc; + return false; + } else { + int32_t x, y, r; + std::string d = ""; + if (dim.size() >= 3) { + isValidStr = ParseInt(dim[0], &x) && ParseInt(dim[1], &y) && ParseInt(dim[2], &r); + } + if (dim.size() >= 4) { + d = dim[3]; + } + if (isValidStr) out = {0, x, y, r, d}; + + return isValidStr; + } +} +SensorLocation FakeFingerprintEngine::getSensorLocation() { + SensorLocation location; + + if (getSensorLocationConfig(location)) { + return location; + } else { + return defaultSensorLocation(); + } +} + +SensorLocation FakeFingerprintEngine::defaultSensorLocation() { + return {0 /* displayId (not used) */, 0 /* sensorLocationX */, 0 /* sensorLocationY */, + 0 /* sensorRadius */, "" /* display */}; +} } // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/FakeFingerprintEngineRear.cpp b/biometrics/fingerprint/aidl/default/FakeFingerprintEngineRear.cpp new file mode 100644 index 0000000000..eea80d5f99 --- /dev/null +++ b/biometrics/fingerprint/aidl/default/FakeFingerprintEngineRear.cpp @@ -0,0 +1,29 @@ +/* + * 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. + */ + +#include "FakeFingerprintEngineRear.h" + +#include +#include + +#include + +#include "util/CancellationSignal.h" +#include "util/Util.h" + +using namespace ::android::fingerprint::virt; + +namespace aidl::android::hardware::biometrics::fingerprint {} diff --git a/biometrics/fingerprint/aidl/default/FakeFingerprintEngineSide.cpp b/biometrics/fingerprint/aidl/default/FakeFingerprintEngineSide.cpp new file mode 100644 index 0000000000..9f736e7abf --- /dev/null +++ b/biometrics/fingerprint/aidl/default/FakeFingerprintEngineSide.cpp @@ -0,0 +1,37 @@ +/* + * 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. + */ + +#include "FakeFingerprintEngineSide.h" + +#include + +#include + +#include "util/CancellationSignal.h" +#include "util/Util.h" + +using namespace ::android::fingerprint::virt; + +namespace aidl::android::hardware::biometrics::fingerprint { + +SensorLocation FakeFingerprintEngineSide::defaultSensorLocation() { + SensorLocation location; + + return {0 /* displayId (not used) */, defaultSensorLocationX /* sensorLocationX */, + defaultSensorLocationY /* sensorLocationY */, defaultSensorRadius /* sensorRadius */, + "" /* display */}; +} +} // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/FakeFingerprintEngineUdfps.cpp b/biometrics/fingerprint/aidl/default/FakeFingerprintEngineUdfps.cpp new file mode 100644 index 0000000000..d8579a4517 --- /dev/null +++ b/biometrics/fingerprint/aidl/default/FakeFingerprintEngineUdfps.cpp @@ -0,0 +1,58 @@ +/* + * 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. + */ + +#include "FakeFingerprintEngineUdfps.h" + +#include + +#include + +#include "util/CancellationSignal.h" +#include "util/Util.h" + +using namespace ::android::fingerprint::virt; + +namespace aidl::android::hardware::biometrics::fingerprint { + +SensorLocation FakeFingerprintEngineUdfps::defaultSensorLocation() { + return {0 /* displayId (not used) */, defaultSensorLocationX /* sensorLocationX */, + defaultSensorLocationY /* sensorLocationY */, defaultSensorRadius /* sensorRadius */, + "" /* display */}; +} + +ndk::ScopedAStatus FakeFingerprintEngineUdfps::onPointerDownImpl(int32_t /*pointerId*/, + int32_t /*x*/, int32_t /*y*/, + float /*minor*/, float /*major*/) { + BEGIN_OP(0); + + // TODO(b/230515082): if need to handle display touch events + + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus FakeFingerprintEngineUdfps::onPointerUpImpl(int32_t /*pointerId*/) { + BEGIN_OP(0); + // TODO(b/230515082) + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus FakeFingerprintEngineUdfps::onUiReadyImpl() { + BEGIN_OP(0); + // TODO(b/230515082) + return ndk::ScopedAStatus::ok(); +} + +} // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/Fingerprint.cpp b/biometrics/fingerprint/aidl/default/Fingerprint.cpp index 71dc6602c5..922781ce65 100644 --- a/biometrics/fingerprint/aidl/default/Fingerprint.cpp +++ b/biometrics/fingerprint/aidl/default/Fingerprint.cpp @@ -26,7 +26,7 @@ using namespace ::android::fingerprint::virt; namespace aidl::android::hardware::biometrics::fingerprint { namespace { constexpr size_t MAX_WORKER_QUEUE_SIZE = 5; -constexpr int SENSOR_ID = 1; +constexpr int SENSOR_ID = 5; constexpr common::SensorStrength SENSOR_STRENGTH = common::SensorStrength::STRONG; constexpr int MAX_ENROLLMENTS_PER_USER = 5; constexpr bool SUPPORTS_NAVIGATION_GESTURES = true; @@ -39,8 +39,25 @@ constexpr char SW_VERSION[] = "vendor/version/revision"; } // namespace -Fingerprint::Fingerprint() - : mEngine(std::make_unique()), mWorker(MAX_WORKER_QUEUE_SIZE) {} +Fingerprint::Fingerprint() : mWorker(MAX_WORKER_QUEUE_SIZE) { + std::string sensorTypeProp = FingerprintHalProperties::type().value_or(""); + if (sensorTypeProp == "" || sensorTypeProp == "default" || sensorTypeProp == "rear") { + mSensorType = FingerprintSensorType::REAR; + mEngine = std::make_unique(); + } else if (sensorTypeProp == "udfps") { + mSensorType = FingerprintSensorType::UNDER_DISPLAY_OPTICAL; + mEngine = std::make_unique(); + } else if (sensorTypeProp == "side") { + mSensorType = FingerprintSensorType::POWER_BUTTON; + mEngine = std::make_unique(); + } else { + mSensorType = FingerprintSensorType::UNKNOWN; + mEngine = std::make_unique(); + UNIMPLEMENTED(FATAL) << "unrecognized or unimplemented fingerprint behavior: " + << sensorTypeProp; + } + LOG(INFO) << "sensorTypeProp:" << sensorTypeProp; +} ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector* out) { std::vector componentInfo = { @@ -51,22 +68,12 @@ ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector* out) { common::CommonProps commonProps = {SENSOR_ID, SENSOR_STRENGTH, MAX_ENROLLMENTS_PER_USER, componentInfo}; - SensorLocation sensorLocation = {0 /* displayId (not used) */, 0 /* sensorLocationX */, - 0 /* sensorLocationY */, 0 /* sensorRadius */, - "" /* display */}; + SensorLocation sensorLocation = mEngine->getSensorLocation(); - FingerprintSensorType sensorType = FingerprintSensorType::UNKNOWN; - std::string sensorTypeProp = FingerprintHalProperties::type().value_or(""); - if (sensorTypeProp == "" || sensorTypeProp == "default" || sensorTypeProp == "rear") { - sensorType = FingerprintSensorType::REAR; - } - if (sensorType == FingerprintSensorType::UNKNOWN) { - UNIMPLEMENTED(FATAL) << "unrecognized or unimplemented fingerprint behavior: " - << sensorTypeProp; - } + LOG(INFO) << "sensor type:" << (int)mSensorType << " location:" << sensorLocation.toString(); *out = {{commonProps, - sensorType, + mSensorType, {sensorLocation}, SUPPORTS_NAVIGATION_GESTURES, false /* supportsDetectInteraction */}}; @@ -80,6 +87,8 @@ ndk::ScopedAStatus Fingerprint::createSession(int32_t sensorId, int32_t userId, mSession = SharedRefBase::make(sensorId, userId, cb, mEngine.get(), &mWorker); *out = mSession; + + LOG(INFO) << "createSession: sensorId:" << sensorId << " userId:" << userId; return ndk::ScopedAStatus::ok(); } diff --git a/biometrics/fingerprint/aidl/default/README.md b/biometrics/fingerprint/aidl/default/README.md index a6e6b81926..bb6bb48dd0 100644 --- a/biometrics/fingerprint/aidl/default/README.md +++ b/biometrics/fingerprint/aidl/default/README.md @@ -23,37 +23,17 @@ switch to the virtual HAL. Unset it and reboot again to switch back. First, set the type of sensor the device should use, enable the virtual extensions in the framework, and reboot. -This doesn't work with HIDL and you typically need to have a PIN or password set -for things to work correctly, so this is a good time to set those too. - ```shell $ adb root $ adb shell settings put secure biometric_virtual_enabled 1 $ adb shell setprop persist.vendor.fingerprint.virtual.type rear -$ adb shell locksettings set-pin 0000 -$ adb shell settings put secure com.android.server.biometrics.AuthService.hidlDisabled 1 $ adb reboot ``` ### Enrollments Next, setup enrollments on the device. This can either be done through the UI, -or via adb. - -#### UI Enrollment - -1. Tee up the results of the enrollment before starting the process: - - ```shell - $ adb shell setprop vendor.fingerprint.virtual.next_enrollment 1:100,100,100:true - ``` -2. Navigate to `Settings -> Security -> Fingerprint Unlock` and follow the - prompts. -3. Verify the enrollments in the UI: - - ```shell - $ adb shell getprop persist.vendor.fingerprint.virtual.enrollments - ``` +or via adb directly. #### Direct Enrollment @@ -61,14 +41,29 @@ To set enrollment directly without the UI: ```shell $ adb root +$ adb shell locksettings set-pin 0000 $ adb shell setprop persist.vendor.fingerprint.virtual.enrollments 1 $ adb shell cmd fingerprint sync ``` -**Note: You may need to do this twice.** The templates are checked as part of -some lazy operations, like user switching and startup, which can cause the -framework to delete the enrollments before the sync operation runs. Until this -is fixed, just run the commands twice as a workaround. +#### UI Enrollment + +1. Set pin + ```shell + $ adb shell locksettings set-pin 0000 + ``` +2. Tee up the results of the enrollment before starting the process: + + ```shell + $ adb shell setprop vendor.fingerprint.virtual.next_enrollment 1:100,100,100:true + ``` +3. Navigate to `Settings -> Security -> Fingerprint Unlock` and follow the + prompts. +4. Verify the enrollments in the UI: + + ```shell + $ adb shell getprop persist.vendor.fingerprint.virtual.enrollments + ``` ### Authenticate @@ -81,7 +76,7 @@ $ adb shell setprop vendor.fingerprint.virtual.enrollment_hit 1 ### View HAL State -To view all the properties of the HAL (see `fingerprint.sysprop` for the API): +To view all the properties of the HAL (see `fingerprint.sysprop` file for the API): ```shell $ adb shell getprop | grep vendor.fingerprint.virtual diff --git a/biometrics/fingerprint/aidl/default/Session.cpp b/biometrics/fingerprint/aidl/default/Session.cpp index ab91e9878c..e51f677744 100644 --- a/biometrics/fingerprint/aidl/default/Session.cpp +++ b/biometrics/fingerprint/aidl/default/Session.cpp @@ -167,7 +167,7 @@ ndk::ScopedAStatus Session::enumerateEnrollments() { } ndk::ScopedAStatus Session::removeEnrollments(const std::vector& enrollmentIds) { - LOG(INFO) << "removeEnrollments"; + LOG(INFO) << "removeEnrollments, size:" << enrollmentIds.size(); scheduleStateOrCrash(SessionState::REMOVING_ENROLLMENTS); mWorker->schedule(Callable::from([this, enrollmentIds] { @@ -228,19 +228,31 @@ ndk::ScopedAStatus Session::close() { return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Session::onPointerDown(int32_t /*pointerId*/, int32_t /*x*/, int32_t /*y*/, - float /*minor*/, float /*major*/) { +ndk::ScopedAStatus Session::onPointerDown(int32_t pointerId, int32_t x, int32_t y, float minor, + float major) { LOG(INFO) << "onPointerDown"; + mWorker->schedule(Callable::from([this, pointerId, x, y, minor, major] { + mEngine->onPointerDownImpl(pointerId, x, y, minor, major); + enterIdling(); + })); return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Session::onPointerUp(int32_t /*pointerId*/) { +ndk::ScopedAStatus Session::onPointerUp(int32_t pointerId) { LOG(INFO) << "onPointerUp"; + mWorker->schedule(Callable::from([this, pointerId] { + mEngine->onPointerUpImpl(pointerId); + enterIdling(); + })); return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus Session::onUiReady() { LOG(INFO) << "onUiReady"; + mWorker->schedule(Callable::from([this] { + mEngine->onUiReadyImpl(); + enterIdling(); + })); return ndk::ScopedAStatus::ok(); } diff --git a/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt b/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt index 4724ff422f..9dfb74d0ef 100644 --- a/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt +++ b/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt @@ -75,6 +75,12 @@ props { access: ReadWrite prop_name: "vendor.fingerprint.virtual.operation_enroll_latency" } + prop { + api_name: "sensor_location" + type: String + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.sensor_location" + } prop { api_name: "type" type: String diff --git a/biometrics/fingerprint/aidl/default/fingerprint.sysprop b/biometrics/fingerprint/aidl/default/fingerprint.sysprop index 12c864890e..85e93b0aa8 100644 --- a/biometrics/fingerprint/aidl/default/fingerprint.sysprop +++ b/biometrics/fingerprint/aidl/default/fingerprint.sysprop @@ -133,3 +133,13 @@ prop { access: ReadWrite api_name: "operation_authenticate_duration" } + +# sensor location +# :: in pixel +prop { + prop_name: "persist.vendor.fingerprint.virtual.sensor_location" + type: String + scope: Public + access: ReadWrite + api_name: "sensor_location" +} diff --git a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h index eb810da1e3..d7df8182de 100644 --- a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h +++ b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h @@ -20,6 +20,7 @@ #include +#include #include #include @@ -31,6 +32,7 @@ namespace aidl::android::hardware::biometrics::fingerprint { class FakeFingerprintEngine { public: FakeFingerprintEngine() : mRandom(std::mt19937::default_seed) {} + virtual ~FakeFingerprintEngine() {} void generateChallengeImpl(ISessionCallback* cb); void revokeChallengeImpl(ISessionCallback* cb, int64_t challenge); @@ -44,6 +46,18 @@ class FakeFingerprintEngine { void getAuthenticatorIdImpl(ISessionCallback* cb); void invalidateAuthenticatorIdImpl(ISessionCallback* cb); void resetLockoutImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& /*hat*/); + bool getSensorLocationConfig(SensorLocation& out); + + virtual ndk::ScopedAStatus onPointerDownImpl(int32_t pointerId, int32_t x, int32_t y, + float minor, float major); + + virtual ndk::ScopedAStatus onPointerUpImpl(int32_t pointerId); + + virtual ndk::ScopedAStatus onUiReadyImpl(); + + virtual SensorLocation getSensorLocation(); + + virtual SensorLocation defaultSensorLocation(); std::mt19937 mRandom; }; diff --git a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineRear.h b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineRear.h new file mode 100644 index 0000000000..1600a4b560 --- /dev/null +++ b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineRear.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2021 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. + */ + +#pragma once +#include "FakeFingerprintEngine.h" + +using namespace ::aidl::android::hardware::biometrics::common; + +namespace aidl::android::hardware::biometrics::fingerprint { + +// A fake engine that is backed by system properties instead of hardware. +class FakeFingerprintEngineRear : public FakeFingerprintEngine { + public: + FakeFingerprintEngineRear() : FakeFingerprintEngine() {} + ~FakeFingerprintEngineRear() {} +}; + +} // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineSide.h b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineSide.h new file mode 100644 index 0000000000..4e44d16d1e --- /dev/null +++ b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineSide.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2021 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. + */ + +#pragma once +#include "FakeFingerprintEngine.h" + +using namespace ::aidl::android::hardware::biometrics::common; + +namespace aidl::android::hardware::biometrics::fingerprint { + +// A fake engine that is backed by system properties instead of hardware. +class FakeFingerprintEngineSide : public FakeFingerprintEngine { + public: + static constexpr int32_t defaultSensorLocationX = 0; + static constexpr int32_t defaultSensorLocationY = 600; + static constexpr int32_t defaultSensorRadius = 150; + + FakeFingerprintEngineSide() : FakeFingerprintEngine() {} + ~FakeFingerprintEngineSide() {} + + virtual SensorLocation defaultSensorLocation() override; +}; + +} // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineUdfps.h b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineUdfps.h new file mode 100644 index 0000000000..b86af736bb --- /dev/null +++ b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineUdfps.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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. + */ + +#pragma once +#include "FakeFingerprintEngine.h" + +using namespace ::aidl::android::hardware::biometrics::common; + +namespace aidl::android::hardware::biometrics::fingerprint { + +// A fake engine that is backed by system properties instead of hardware. +class FakeFingerprintEngineUdfps : public FakeFingerprintEngine { + public: + static constexpr int32_t defaultSensorLocationX = 400; + static constexpr int32_t defaultSensorLocationY = 1600; + static constexpr int32_t defaultSensorRadius = 150; + + FakeFingerprintEngineUdfps() : FakeFingerprintEngine() {} + ~FakeFingerprintEngineUdfps() {} + + virtual ndk::ScopedAStatus onPointerDownImpl(int32_t pointerId, int32_t x, int32_t y, + float minor, float major) override; + + virtual ndk::ScopedAStatus onPointerUpImpl(int32_t pointerId) override; + + virtual ndk::ScopedAStatus onUiReadyImpl() override; + + virtual SensorLocation defaultSensorLocation() override; +}; + +} // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/include/Fingerprint.h b/biometrics/fingerprint/aidl/default/include/Fingerprint.h index 20def0cecd..64aafa30fb 100644 --- a/biometrics/fingerprint/aidl/default/include/Fingerprint.h +++ b/biometrics/fingerprint/aidl/default/include/Fingerprint.h @@ -16,9 +16,15 @@ #pragma once +#define LOG_TAG "FingerprintVirtualHal" + #include #include "FakeFingerprintEngine.h" +#include "FakeFingerprintEngineRear.h" +#include "FakeFingerprintEngineSide.h" +#include "FakeFingerprintEngineUdfps.h" + #include "Session.h" #include "thread/WorkerThread.h" @@ -38,6 +44,7 @@ class Fingerprint : public BnFingerprint { std::unique_ptr mEngine; WorkerThread mWorker; std::shared_ptr mSession; + FingerprintSensorType mSensorType; }; } // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineTest.cpp b/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineTest.cpp index 742d9335fd..8696d2624a 100644 --- a/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineTest.cpp +++ b/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineTest.cpp @@ -264,7 +264,9 @@ TEST_F(FakeFingerprintEngineTest, InteractionDetectNotEnrolled) { TEST_F(FakeFingerprintEngineTest, EnumerateEnrolled) { FingerprintHalProperties::enrollments({2, 4, 8}); mEngine.enumerateEnrollmentsImpl(mCallback.get()); - ASSERT_EQ(3, mCallback->mLastEnrollmentEnumerated.size()); + ASSERT_EQ( + 4, + mCallback->mLastEnrollmentEnumerated.size()); // Due to workaround. TODO (b/243129174) for (auto id : FingerprintHalProperties::enrollments()) { ASSERT_TRUE(std::find(mCallback->mLastEnrollmentEnumerated.begin(), mCallback->mLastEnrollmentEnumerated.end(), diff --git a/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineUdfpsTest.cpp b/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineUdfpsTest.cpp new file mode 100644 index 0000000000..485f401504 --- /dev/null +++ b/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineUdfpsTest.cpp @@ -0,0 +1,92 @@ +/* + * 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. + */ + +#include +#include +#include + +#include + +#include "FakeFingerprintEngine.h" +#include "FakeFingerprintEngineUdfps.h" + +using namespace ::android::fingerprint::virt; +using namespace ::aidl::android::hardware::biometrics::fingerprint; +using namespace ::aidl::android::hardware::keymaster; + +namespace aidl::android::hardware::biometrics::fingerprint { + +class FakeFingerprintEngineUdfpsTest : public ::testing::Test { + protected: + void SetUp() override {} + + void TearDown() override { + // reset to default + FingerprintHalProperties::sensor_location(""); + } + + FakeFingerprintEngineUdfps mEngine; +}; + +bool isDefaultLocation(SensorLocation& sc) { + return (sc.sensorLocationX == FakeFingerprintEngineUdfps::defaultSensorLocationX && + sc.sensorLocationY == FakeFingerprintEngineUdfps::defaultSensorLocationY && + sc.sensorRadius == FakeFingerprintEngineUdfps::defaultSensorRadius && sc.display == ""); +} + +TEST_F(FakeFingerprintEngineUdfpsTest, getSensorLocation) { + FingerprintHalProperties::sensor_location(""); + SensorLocation sc = mEngine.getSensorLocation(); + ASSERT_TRUE(isDefaultLocation(sc)); + + auto loc = "100:200:30"; + FingerprintHalProperties::sensor_location(loc); + sc = mEngine.getSensorLocation(); + ASSERT_TRUE(sc.sensorLocationX == 100); + ASSERT_TRUE(sc.sensorLocationY == 200); + ASSERT_TRUE(sc.sensorRadius == 30); + + loc = "100:200:30:screen1"; + FingerprintHalProperties::sensor_location(loc); + sc = mEngine.getSensorLocation(); + ASSERT_TRUE(sc.sensorLocationX == 100); + ASSERT_TRUE(sc.sensorLocationY == 200); + ASSERT_TRUE(sc.sensorRadius == 30); + ASSERT_TRUE(sc.display == "screen1"); + + loc = "100"; + FingerprintHalProperties::sensor_location(loc); + sc = mEngine.getSensorLocation(); + ASSERT_TRUE(isDefaultLocation(sc)); + + loc = "10:20"; + FingerprintHalProperties::sensor_location(loc); + sc = mEngine.getSensorLocation(); + ASSERT_TRUE(isDefaultLocation(sc)); + + loc = "10,20,5"; + FingerprintHalProperties::sensor_location(loc); + sc = mEngine.getSensorLocation(); + ASSERT_TRUE(isDefaultLocation(sc)); + + loc = "a:b:c"; + FingerprintHalProperties::sensor_location(loc); + sc = mEngine.getSensorLocation(); + ASSERT_TRUE(isDefaultLocation(sc)); +} + +// More +} // namespace aidl::android::hardware::biometrics::fingerprint From 5862c1e3bca8d66b11ef7f0d041171bce79a3104 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Fri, 19 Aug 2022 21:37:35 +0000 Subject: [PATCH 214/998] audio: Add StreamDescriptor.frameSizeBytes This field indicates the frame size and is filled by the HAL module, so that the client does not have to calculate it. As a side effect, in the VTS code, a StreamContext can now be created solely from a StreamDescriptor. Added unit tests for the functions from Utils. Bug: 205884982 Test: atest libaudioaidlcommon_test Test: atest VtsHalAudioCoreTargetTest Change-Id: Ief836b8b2d35bacb1f9778e2462d540554149d7f --- .../hardware/audio/core/StreamDescriptor.aidl | 1 + .../hardware/audio/core/StreamDescriptor.aidl | 8 + audio/aidl/common/Android.bp | 2 + audio/aidl/common/include/Utils.h | 12 +- audio/aidl/common/tests/utils_tests.cpp | 190 ++++++++++++++++++ audio/aidl/default/Stream.cpp | 1 + audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp | 25 +-- 7 files changed, 223 insertions(+), 16 deletions(-) create mode 100644 audio/aidl/common/tests/utils_tests.cpp diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl index e7ed502bd2..db1ac22c52 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl @@ -36,6 +36,7 @@ package android.hardware.audio.core; parcelable StreamDescriptor { android.hardware.common.fmq.MQDescriptor command; android.hardware.common.fmq.MQDescriptor reply; + int frameSizeBytes; long bufferSizeFrames; android.hardware.audio.core.StreamDescriptor.AudioBuffer audio; const int COMMAND_BURST = 1; diff --git a/audio/aidl/android/hardware/audio/core/StreamDescriptor.aidl b/audio/aidl/android/hardware/audio/core/StreamDescriptor.aidl index 74090d7910..2b1ed8ceb1 100644 --- a/audio/aidl/android/hardware/audio/core/StreamDescriptor.aidl +++ b/audio/aidl/android/hardware/audio/core/StreamDescriptor.aidl @@ -144,6 +144,14 @@ parcelable StreamDescriptor { } MQDescriptor reply; + /** + * The size of one frame of audio data in bytes. For PCM formats this is + * usually equal to the size of a sample multiplied by the number of + * channels used. For encoded bitstreams encapsulated into PCM the sample + * size of the underlying PCM stream is used. For encoded bitstreams that + * are passed without encapsulation, the frame size is usually 1 byte. + */ + int frameSizeBytes; /** * Total buffer size in frames. This applies both to the size of the 'audio.fmq' * queue and to the size of the shared memory buffer for MMap No IRQ streams. diff --git a/audio/aidl/common/Android.bp b/audio/aidl/common/Android.bp index f2d8fc2a53..a3f7f0b578 100644 --- a/audio/aidl/common/Android.bp +++ b/audio/aidl/common/Android.bp @@ -46,6 +46,7 @@ cc_test { host_supported: true, vendor_available: true, static_libs: [ + "android.media.audio.common.types-V1-ndk", "libaudioaidlcommon", ], shared_libs: [ @@ -59,6 +60,7 @@ cc_test { ], srcs: [ "tests/streamworker_tests.cpp", + "tests/utils_tests.cpp", ], test_suites: [ "general-tests", diff --git a/audio/aidl/common/include/Utils.h b/audio/aidl/common/include/Utils.h index 1a87882c1a..74549d4d35 100644 --- a/audio/aidl/common/include/Utils.h +++ b/audio/aidl/common/include/Utils.h @@ -62,12 +62,20 @@ constexpr size_t getChannelCount( constexpr size_t getFrameSizeInBytes( const ::aidl::android::media::audio::common::AudioFormatDescription& format, const ::aidl::android::media::audio::common::AudioChannelLayout& layout) { + if (format == ::aidl::android::media::audio::common::AudioFormatDescription{}) { + // Unspecified format. + return 0; + } using ::aidl::android::media::audio::common::AudioFormatType; if (format.type == AudioFormatType::PCM) { return getPcmSampleSizeInBytes(format.pcm) * getChannelCount(layout); + } else if (format.type == AudioFormatType::NON_PCM) { + // For non-PCM formats always use the underlying PCM size. The default value for + // PCM is "UINT_8_BIT", thus non-encapsulated streams have the frame size of 1. + return getPcmSampleSizeInBytes(format.pcm); } - // For non-PCM formats always use frame size of 1. - return 1; + // Something unexpected. + return 0; } } // namespace android::hardware::audio::common diff --git a/audio/aidl/common/tests/utils_tests.cpp b/audio/aidl/common/tests/utils_tests.cpp new file mode 100644 index 0000000000..d7f1a5d356 --- /dev/null +++ b/audio/aidl/common/tests/utils_tests.cpp @@ -0,0 +1,190 @@ +/* + * 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. + */ + +#include +#include +#include +#include +#include + +#include + +#include +#define LOG_TAG "Utils_Test" +#include + +using aidl::android::media::audio::common::AudioChannelLayout; +using aidl::android::media::audio::common::AudioFormatDescription; +using aidl::android::media::audio::common::AudioFormatType; +using aidl::android::media::audio::common::PcmType; +using android::hardware::audio::common::getChannelCount; +using android::hardware::audio::common::getFrameSizeInBytes; +using android::hardware::audio::common::getPcmSampleSizeInBytes; + +TEST(UtilsTest, ChannelCountOddCases) { + using Tag = AudioChannelLayout::Tag; + EXPECT_EQ(0UL, getChannelCount(AudioChannelLayout{})); + EXPECT_EQ(0UL, getChannelCount(AudioChannelLayout::make(0))); + EXPECT_EQ(0UL, getChannelCount(AudioChannelLayout::make(-1))); +} + +TEST(UtilsTest, ChannelCountForIndexMask) { + using Tag = AudioChannelLayout::Tag; + EXPECT_EQ(0UL, getChannelCount(AudioChannelLayout::make(0))); +#define VERIFY_INDEX_MASK(N) \ + { \ + const auto l = \ + AudioChannelLayout::make(AudioChannelLayout::INDEX_MASK_##N); \ + EXPECT_EQ(N##UL, getChannelCount(l)) << l.toString(); \ + } + VERIFY_INDEX_MASK(1); + VERIFY_INDEX_MASK(2); + VERIFY_INDEX_MASK(3); + VERIFY_INDEX_MASK(4); + VERIFY_INDEX_MASK(5); + VERIFY_INDEX_MASK(6); + VERIFY_INDEX_MASK(7); + VERIFY_INDEX_MASK(8); + VERIFY_INDEX_MASK(9); + VERIFY_INDEX_MASK(10); + VERIFY_INDEX_MASK(11); + VERIFY_INDEX_MASK(12); + VERIFY_INDEX_MASK(13); + VERIFY_INDEX_MASK(14); + VERIFY_INDEX_MASK(15); + VERIFY_INDEX_MASK(16); + VERIFY_INDEX_MASK(17); + VERIFY_INDEX_MASK(18); + VERIFY_INDEX_MASK(19); + VERIFY_INDEX_MASK(20); + VERIFY_INDEX_MASK(21); + VERIFY_INDEX_MASK(22); + VERIFY_INDEX_MASK(23); + VERIFY_INDEX_MASK(24); +#undef VERIFY_INDEX_MASK +} + +TEST(UtilsTest, ChannelCountForLayoutMask) { + using Tag = AudioChannelLayout::Tag; + const std::vector> kTestLayouts = { + std::make_pair(0UL, 0), + std::make_pair(1UL, AudioChannelLayout::LAYOUT_MONO), + std::make_pair(2UL, AudioChannelLayout::LAYOUT_STEREO), + std::make_pair(6UL, AudioChannelLayout::LAYOUT_5POINT1), + std::make_pair(8UL, AudioChannelLayout::LAYOUT_7POINT1), + std::make_pair(16UL, AudioChannelLayout::LAYOUT_9POINT1POINT6), + std::make_pair(13UL, AudioChannelLayout::LAYOUT_13POINT_360RA), + std::make_pair(24UL, AudioChannelLayout::LAYOUT_22POINT2), + std::make_pair(3UL, AudioChannelLayout::LAYOUT_STEREO_HAPTIC_A), + std::make_pair(4UL, AudioChannelLayout::LAYOUT_STEREO_HAPTIC_AB)}; + for (const auto& [expected_count, layout] : kTestLayouts) { + const auto l = AudioChannelLayout::make(layout); + EXPECT_EQ(expected_count, getChannelCount(l)) << l.toString(); + } +} + +TEST(UtilsTest, ChannelCountForVoiceMask) { + using Tag = AudioChannelLayout::Tag; + // clang-format off + const std::vector> kTestLayouts = { + std::make_pair(0UL, 0), + std::make_pair(1UL, AudioChannelLayout::VOICE_UPLINK_MONO), + std::make_pair(1UL, AudioChannelLayout::VOICE_DNLINK_MONO), + std::make_pair(2UL, AudioChannelLayout::VOICE_CALL_MONO)}; + // clang-format on + for (const auto& [expected_count, layout] : kTestLayouts) { + const auto l = AudioChannelLayout::make(layout); + EXPECT_EQ(expected_count, getChannelCount(l)) << l.toString(); + } +} + +namespace { + +AudioChannelLayout make_AudioChannelLayout_Mono() { + return AudioChannelLayout::make( + AudioChannelLayout::LAYOUT_MONO); +} + +AudioChannelLayout make_AudioChannelLayout_Stereo() { + return AudioChannelLayout::make( + AudioChannelLayout::LAYOUT_STEREO); +} + +AudioFormatDescription make_AudioFormatDescription(AudioFormatType type) { + AudioFormatDescription result; + result.type = type; + return result; +} + +AudioFormatDescription make_AudioFormatDescription(PcmType pcm) { + auto result = make_AudioFormatDescription(AudioFormatType::PCM); + result.pcm = pcm; + return result; +} + +AudioFormatDescription make_AudioFormatDescription(const std::string& encoding) { + AudioFormatDescription result; + result.encoding = encoding; + return result; +} + +AudioFormatDescription make_AudioFormatDescription(PcmType transport, const std::string& encoding) { + auto result = make_AudioFormatDescription(encoding); + result.pcm = transport; + return result; +} + +} // namespace + +TEST(UtilsTest, FrameSize) { + EXPECT_EQ(0UL, getFrameSizeInBytes(AudioFormatDescription{}, AudioChannelLayout{})); + EXPECT_EQ(sizeof(int16_t), getFrameSizeInBytes(make_AudioFormatDescription(PcmType::INT_16_BIT), + make_AudioChannelLayout_Mono())); + EXPECT_EQ(2 * sizeof(int16_t), + getFrameSizeInBytes(make_AudioFormatDescription(PcmType::INT_16_BIT), + make_AudioChannelLayout_Stereo())); + EXPECT_EQ(sizeof(int32_t), getFrameSizeInBytes(make_AudioFormatDescription(PcmType::INT_32_BIT), + make_AudioChannelLayout_Mono())); + EXPECT_EQ(2 * sizeof(int32_t), + getFrameSizeInBytes(make_AudioFormatDescription(PcmType::INT_32_BIT), + make_AudioChannelLayout_Stereo())); + EXPECT_EQ(sizeof(float), getFrameSizeInBytes(make_AudioFormatDescription(PcmType::FLOAT_32_BIT), + make_AudioChannelLayout_Mono())); + EXPECT_EQ(2 * sizeof(float), + getFrameSizeInBytes(make_AudioFormatDescription(PcmType::FLOAT_32_BIT), + make_AudioChannelLayout_Stereo())); + EXPECT_EQ(sizeof(uint8_t), + getFrameSizeInBytes(make_AudioFormatDescription("bitstream"), AudioChannelLayout{})); + EXPECT_EQ(sizeof(int16_t), + getFrameSizeInBytes(make_AudioFormatDescription(PcmType::INT_16_BIT, "encapsulated"), + AudioChannelLayout{})); +} + +TEST(UtilsTest, PcmSampleSize) { + EXPECT_EQ(1UL, getPcmSampleSizeInBytes(PcmType{})); + EXPECT_EQ(sizeof(uint8_t), getPcmSampleSizeInBytes(PcmType::UINT_8_BIT)); + EXPECT_EQ(sizeof(int16_t), getPcmSampleSizeInBytes(PcmType::INT_16_BIT)); + EXPECT_EQ(sizeof(int32_t), getPcmSampleSizeInBytes(PcmType::INT_32_BIT)); + EXPECT_EQ(sizeof(int32_t), getPcmSampleSizeInBytes(PcmType::FIXED_Q_8_24)); + EXPECT_EQ(sizeof(float), getPcmSampleSizeInBytes(PcmType::FLOAT_32_BIT)); + EXPECT_EQ(3UL, getPcmSampleSizeInBytes(PcmType::INT_24_BIT)); + EXPECT_EQ(0UL, getPcmSampleSizeInBytes(PcmType(-1))); + using PcmTypeUnderlyingType = std::underlying_type_t; + EXPECT_EQ(0UL, + getPcmSampleSizeInBytes(PcmType(std::numeric_limits::min()))); + EXPECT_EQ(0UL, + getPcmSampleSizeInBytes(PcmType(std::numeric_limits::max()))); +} diff --git a/audio/aidl/default/Stream.cpp b/audio/aidl/default/Stream.cpp index 24e46db7b5..312df720eb 100644 --- a/audio/aidl/default/Stream.cpp +++ b/audio/aidl/default/Stream.cpp @@ -35,6 +35,7 @@ void StreamContext::fillDescriptor(StreamDescriptor* desc) { desc->reply = mReplyMQ->dupeDesc(); } if (mDataMQ) { + desc->frameSizeBytes = mFrameSize; desc->bufferSizeFrames = mDataMQ->getQuantumCount() * mDataMQ->getQuantumSize() / mFrameSize; desc->audio.set(mDataMQ->dupeDesc()); diff --git a/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp index ac41ac3a87..290f5f0494 100644 --- a/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp @@ -28,7 +28,6 @@ #include #include -#include #include #include #include @@ -55,6 +54,7 @@ using aidl::android::hardware::audio::core::IStreamIn; using aidl::android::hardware::audio::core::IStreamOut; using aidl::android::hardware::audio::core::ModuleDebug; using aidl::android::hardware::audio::core::StreamDescriptor; +using aidl::android::hardware::common::fmq::SynchronizedReadWrite; using aidl::android::media::audio::common::AudioContentType; using aidl::android::media::audio::common::AudioDevice; using aidl::android::media::audio::common::AudioDeviceAddress; @@ -68,7 +68,6 @@ using aidl::android::media::audio::common::AudioPortDeviceExt; using aidl::android::media::audio::common::AudioPortExt; using aidl::android::media::audio::common::AudioSource; using aidl::android::media::audio::common::AudioUsage; -using android::hardware::audio::common::getFrameSizeInBytes; using android::hardware::audio::common::StreamLogic; using android::hardware::audio::common::StreamWorker; using ndk::ScopedAStatus; @@ -368,18 +367,12 @@ class WithDevicePortConnectedState { class StreamContext { public: - typedef AidlMessageQueue - CommandMQ; - typedef AidlMessageQueue - ReplyMQ; - typedef AidlMessageQueue - DataMQ; + typedef AidlMessageQueue CommandMQ; + typedef AidlMessageQueue ReplyMQ; + typedef AidlMessageQueue DataMQ; - StreamContext(const AudioPortConfig& portConfig, const StreamDescriptor& descriptor) - : mFrameSizeBytes( - getFrameSizeInBytes(portConfig.format.value(), portConfig.channelMask.value())), + explicit StreamContext(const StreamDescriptor& descriptor) + : mFrameSizeBytes(descriptor.frameSizeBytes), mCommandMQ(new CommandMQ(descriptor.command)), mReplyMQ(new ReplyMQ(descriptor.reply)), mBufferSizeFrames(descriptor.bufferSizeFrames), @@ -392,6 +385,10 @@ class StreamContext { EXPECT_TRUE(mReplyMQ->isValid()); if (mDataMQ != nullptr) { EXPECT_TRUE(mDataMQ->isValid()); + EXPECT_GE(mDataMQ->getQuantumCount() * mDataMQ->getQuantumSize(), + mFrameSizeBytes * mBufferSizeFrames) + << "Data MQ actual buffer size is " + "less than the buffer size as specified by the descriptor"; } } size_t getBufferSizeBytes() const { return mFrameSizeBytes * mBufferSizeFrames; } @@ -605,7 +602,7 @@ class WithStream { ASSERT_NE(nullptr, mStream) << "; port config id " << getPortId(); EXPECT_GE(mDescriptor.bufferSizeFrames, bufferSizeFrames) << "actual buffer size must be no less than requested"; - mContext.emplace(mPortConfig.get(), mDescriptor); + mContext.emplace(mDescriptor); ASSERT_NO_FATAL_FAILURE(mContext.value().checkIsValid()); } Stream* get() const { return mStream.get(); } From a759ebf350b61df3e60cc82f3a3b367b951f07d2 Mon Sep 17 00:00:00 2001 From: Pawan Date: Fri, 19 Aug 2022 22:32:21 +0000 Subject: [PATCH 215/998] Updating cc_fuzz with default service fuzzer config Using service_fuzzer_defaults in - android.hardware.automotive.vehicle@V1-default-service_fuzzer - android.hardware.automotive.occupant_awareness-service.fuzzer Bug: 240318902 Test: m android.hardware.automotive.vehicle@V1-default-service_fuzzer Test: m android.hardware.automotive.occupant_awareness-service.fuzzer Change-Id: I22cbbec92a7281081c355bb78d2ae87aa90732fa --- automotive/occupant_awareness/aidl/default/Android.bp | 9 +-------- automotive/vehicle/aidl/impl/vhal/Android.bp | 9 +-------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/automotive/occupant_awareness/aidl/default/Android.bp b/automotive/occupant_awareness/aidl/default/Android.bp index 3dc7e0d9d1..1b760a5ac0 100644 --- a/automotive/occupant_awareness/aidl/default/Android.bp +++ b/automotive/occupant_awareness/aidl/default/Android.bp @@ -42,18 +42,11 @@ cc_binary { cc_fuzz { name: "android.hardware.automotive.occupant_awareness-service.fuzzer", + defaults: ["service_fuzzer_defaults"], static_libs: [ "android.hardware.automotive.occupant_awareness-V1-ndk", - "libbase", - "libbinder_random_parcel", - "libcutils", "liblog", ], - shared_libs: [ - "libbinder_ndk", - "libbinder", - "libutils", - ], srcs: [ "fuzzer.cpp", "OccupantAwareness.cpp", diff --git a/automotive/vehicle/aidl/impl/vhal/Android.bp b/automotive/vehicle/aidl/impl/vhal/Android.bp index 6fec2c979c..4feea79490 100644 --- a/automotive/vehicle/aidl/impl/vhal/Android.bp +++ b/automotive/vehicle/aidl/impl/vhal/Android.bp @@ -74,19 +74,12 @@ cc_fuzz { "FakeVehicleHardwareDefaults", "VehicleHalDefaults", "android-automotive-large-parcelable-defaults", + "service_fuzzer_defaults", ], static_libs: [ "DefaultVehicleHal", "FakeVehicleHardware", "VehicleHalUtils", - "libbase", - "libbinder_random_parcel", - "libcutils", - ], - shared_libs: [ - "libbinder_ndk", - "libbinder", - "libutils", ], srcs: ["src/fuzzer.cpp"], fuzz_config: { From d56bc22d1e1ecbf5caffa1dc89f37c88ab159c24 Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Thu, 30 Jun 2022 17:58:56 +0000 Subject: [PATCH 216/998] AIDL effect: Initial IFactory interface definition Bug: 238913361 Test: atest VtsHalAudioEffectTargetTest Change-Id: I9f5ef1284bb5d77a9d60cb8b901742fc8e467926 --- audio/aidl/Android.bp | 23 ++++++ .../hardware/audio/effect/Descriptor.aidl | 60 ++++++++++++++ .../hardware/audio/effect/IFactory.aidl | 38 +++++++++ .../hardware/audio/effect/Descriptor.aidl | 82 +++++++++++++++++++ .../hardware/audio/effect/IFactory.aidl | 45 ++++++++++ 5 files changed, 248 insertions(+) create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IFactory.aidl create mode 100644 audio/aidl/android/hardware/audio/effect/Descriptor.aidl create mode 100644 audio/aidl/android/hardware/audio/effect/IFactory.aidl diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index 440422ef26..e9a3b57dfe 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -96,3 +96,26 @@ aidl_interface { }, }, } + +aidl_interface { + name: "android.hardware.audio.effect", + vendor_available: true, + srcs: [ + "android/hardware/audio/effect/Descriptor.aidl", + "android/hardware/audio/effect/IFactory.aidl", + ], + imports: [ + "android.hardware.audio.common-V1", + "android.media.audio.common.types-V1", + ], + stability: "vintf", + backend: { + // The C++ backend is disabled transitively due to use of FMQ. + cpp: { + enabled: false, + }, + java: { + sdk_version: "module_current", + }, + }, +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl new file mode 100644 index 0000000000..94cacd9da6 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl @@ -0,0 +1,60 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +parcelable Descriptor { + android.hardware.audio.effect.Descriptor.Common common; + const String EFFECT_TYPE_UUID_ENV_REVERB = "c2e5d5f0-94bd-4763-9cac-4e234d06839e"; + const String EFFECT_TYPE_UUID_PRESET_REVERB = "47382d60-ddd8-11db-bf3a-0002a5d5c51b"; + const String EFFECT_TYPE_UUID_EQUALIZER = "0bed4300-ddd6-11db-8f34-0002a5d5c51b"; + const String EFFECT_TYPE_UUID_BASS_BOOST = "0634f220-ddd4-11db-a0fc-0002a5d5c51b"; + const String EFFECT_TYPE_UUID_VIRTUALIZER = "37cc2c00-dddd-11db-8577-0002a5d5c51b"; + const String EFFECT_TYPE_UUID_AGC = "0a8abfe0-654c-11e0-ba26-0002a5d5c51b"; + const String EFFECT_TYPE_UUID_AEC = "7b491460-8d4d-11e0-bd61-0002a5d5c51b"; + const String EFFECT_TYPE_UUID_NS = "58b4b260-8e06-11e0-aa8e-0002a5d5c51b"; + const String EFFECT_TYPE_UUID_LOUDNESS_ENHANCER = "fe3199be-aed0-413f-87bb-11260eb63cf1"; + const String EFFECT_TYPE_UUID_DYNAMICS_PROCESSING = "7261676f-6d75-7369-6364-28e2fd3ac39e"; + const String EFFECT_TYPE_UUID_HAPTIC_GENERATOR = "1411e6d6-aecd-4021-a1cf-a6aceb0d71e5"; + const String EFFECT_TYPE_UUID_SPATIALIZER = "ccd4cf09-a79d-46c2-9aae-06a1698d6c8f"; + const String EFFECT_TYPE_UUID_VOLUME = "09e8ede0-ddde-11db-b4f6-0002a5d5c51b"; + @VintfStability + parcelable Identity { + android.media.audio.common.AudioUuid type; + android.media.audio.common.AudioUuid uuid; + } + @VintfStability + parcelable Common { + android.hardware.audio.effect.Descriptor.Identity id; + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IFactory.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IFactory.aidl new file mode 100644 index 0000000000..b6c9aab75e --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IFactory.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +interface IFactory { + android.hardware.audio.effect.Descriptor.Identity[] queryEffects(in @nullable android.media.audio.common.AudioUuid type, in @nullable android.media.audio.common.AudioUuid implementation); +} diff --git a/audio/aidl/android/hardware/audio/effect/Descriptor.aidl b/audio/aidl/android/hardware/audio/effect/Descriptor.aidl new file mode 100644 index 0000000000..51b31c2371 --- /dev/null +++ b/audio/aidl/android/hardware/audio/effect/Descriptor.aidl @@ -0,0 +1,82 @@ +/* + * 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. + */ + +package android.hardware.audio.effect; + +import android.media.audio.common.AudioUuid; + +/** + * Effect descriptor contains all information (capabilities, attributes, and ownership) for an + * effect implemented in the Audio Effect HAL. Framework uses this information to decide when and + * how to apply the effect. + */ +@VintfStability +parcelable Descriptor { + /** + * UUID for effect types, these definitions are in sync with SDK, see @c AudioEffect.java. + */ + // UUID for environmental reverberation effect type. + const String EFFECT_TYPE_UUID_ENV_REVERB = "c2e5d5f0-94bd-4763-9cac-4e234d06839e"; + // UUID for preset reverberation effect type. + const String EFFECT_TYPE_UUID_PRESET_REVERB = "47382d60-ddd8-11db-bf3a-0002a5d5c51b"; + // UUID for equalizer effect type. + const String EFFECT_TYPE_UUID_EQUALIZER = "0bed4300-ddd6-11db-8f34-0002a5d5c51b"; + // UUID for bass boost effect type. + const String EFFECT_TYPE_UUID_BASS_BOOST = "0634f220-ddd4-11db-a0fc-0002a5d5c51b"; + // UUID for virtualizer effect type. + const String EFFECT_TYPE_UUID_VIRTUALIZER = "37cc2c00-dddd-11db-8577-0002a5d5c51b"; + // UUID for Automatic Gain Control (AGC) type. + const String EFFECT_TYPE_UUID_AGC = "0a8abfe0-654c-11e0-ba26-0002a5d5c51b"; + // UUID for Acoustic Echo Canceler (AEC) type. + const String EFFECT_TYPE_UUID_AEC = "7b491460-8d4d-11e0-bd61-0002a5d5c51b"; + // UUID for Noise Suppressor (NS) type. + const String EFFECT_TYPE_UUID_NS = "58b4b260-8e06-11e0-aa8e-0002a5d5c51b"; + // UUID for Loudness Enhancer type. + const String EFFECT_TYPE_UUID_LOUDNESS_ENHANCER = "fe3199be-aed0-413f-87bb-11260eb63cf1"; + // UUID for Dynamics Processing type. + const String EFFECT_TYPE_UUID_DYNAMICS_PROCESSING = "7261676f-6d75-7369-6364-28e2fd3ac39e"; + // UUID for Haptic Generator type. + const String EFFECT_TYPE_UUID_HAPTIC_GENERATOR = "1411e6d6-aecd-4021-a1cf-a6aceb0d71e5"; + // UUID for Spatializer type. + const String EFFECT_TYPE_UUID_SPATIALIZER = "ccd4cf09-a79d-46c2-9aae-06a1698d6c8f"; + // UUID for Volume type. The volume effect is used for automated tests only. + const String EFFECT_TYPE_UUID_VOLUME = "09e8ede0-ddde-11db-b4f6-0002a5d5c51b"; + + /** + * This structure completely identifies an effect implementation. + */ + @VintfStability + parcelable Identity { + /** + * UUID for the type of effect. + */ + AudioUuid type; + /** + * UUID for this particular implementation. + */ + AudioUuid uuid; + } + + // Common attributes of all effect implementation. + @VintfStability + parcelable Common { + /** + * Identity of effect implementation. + */ + Identity id; + } + Common common; +} diff --git a/audio/aidl/android/hardware/audio/effect/IFactory.aidl b/audio/aidl/android/hardware/audio/effect/IFactory.aidl new file mode 100644 index 0000000000..99c2e6a2f5 --- /dev/null +++ b/audio/aidl/android/hardware/audio/effect/IFactory.aidl @@ -0,0 +1,45 @@ +/* + * 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. + */ + +package android.hardware.audio.effect; + +import android.hardware.audio.effect.Descriptor; +import android.media.audio.common.AudioUuid; + +/** + * Provides system-wide effect factory interfaces. + * + * An android.hardware.audio.effect.IFactory platform service is registered with ServiceManager, and + * is always available on the device. + * + */ +@VintfStability +interface IFactory { + /** + * Return a list of effect identities supported by this device, with the optional + * filter by type and/or by instance UUID. + * + * @param type UUID identifying the effect type. + * This is an optional parameter, pass in null if this parameter is not necessary; if non + * null, used as a filter for effect type UUIDs. + * @param implementation Indicates the particular implementation of the effect in that type. + * This is an optional parameter, pass in null if this parameter is not necessary; if + * non null, used as a filter for effect type UUIDs. + * @return List of effect identities supported and filtered by type/implementation UUID. + */ + Descriptor.Identity[] queryEffects( + in @nullable AudioUuid type, in @nullable AudioUuid implementation); +} From 8a0ae5430f0886f11e96391d28e34606f9e815c5 Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Wed, 13 Jul 2022 04:59:37 +0000 Subject: [PATCH 217/998] AIDL effect: Minimal example implementation Add effect factory placeholder implementation. Update android.hardware.audio.service-aidl.example to include effects. Bug: 238913361 Test: atest VtsHalAudioEffectTargetTest Change-Id: I88266b509a03ee336e22be460580c5b22123659e --- audio/aidl/default/Android.bp | 42 +++++++++++++ audio/aidl/default/EffectFactory.cpp | 59 +++++++++++++++++++ audio/aidl/default/EffectMain.cpp | 38 ++++++++++++ ...dware.audio.effect.service-aidl.example.rc | 9 +++ ...oid.hardware.audio.effect.service-aidl.xml | 7 +++ .../effectFactory-impl/EffectFactory.h | 47 +++++++++++++++ .../include/equalizer-impl/Equalizer.h | 31 ++++++++++ .../include/visualizer-impl/Visualizer.h | 31 ++++++++++ .../compatibility_matrix.current.xml | 8 +++ 9 files changed, 272 insertions(+) create mode 100644 audio/aidl/default/EffectFactory.cpp create mode 100644 audio/aidl/default/EffectMain.cpp create mode 100644 audio/aidl/default/android.hardware.audio.effect.service-aidl.example.rc create mode 100644 audio/aidl/default/android.hardware.audio.effect.service-aidl.xml create mode 100644 audio/aidl/default/include/effectFactory-impl/EffectFactory.h create mode 100644 audio/aidl/default/include/equalizer-impl/Equalizer.h create mode 100644 audio/aidl/default/include/visualizer-impl/Visualizer.h diff --git a/audio/aidl/default/Android.bp b/audio/aidl/default/Android.bp index 03f8c64a6a..5354b8e329 100644 --- a/audio/aidl/default/Android.bp +++ b/audio/aidl/default/Android.bp @@ -51,3 +51,45 @@ cc_binary { ], srcs: ["main.cpp"], } + +cc_library_static { + name: "libaudioeffectserviceexampleimpl", + vendor: true, + shared_libs: [ + "libbase", + "libbinder_ndk", + "android.media.audio.common.types-V1-ndk", + "android.hardware.audio.effect-V1-ndk", + ], + export_include_dirs: ["include"], + srcs: [ + "EffectFactory.cpp", + ], + visibility: [ + ":__subpackages__", + ], +} + +cc_binary { + name: "android.hardware.audio.effect.service-aidl.example", + relative_install_path: "hw", + init_rc: ["android.hardware.audio.effect.service-aidl.example.rc"], + vintf_fragments: ["android.hardware.audio.effect.service-aidl.xml"], + vendor: true, + shared_libs: [ + "libbase", + "libbinder_ndk", + "android.media.audio.common.types-V1-ndk", + "android.hardware.audio.effect-V1-ndk", + ], + static_libs: [ + "libaudioeffectserviceexampleimpl", + ], + cflags: [ + "-Wall", + "-Wextra", + "-Werror", + "-Wthread-safety", + ], + srcs: ["EffectMain.cpp"], +} diff --git a/audio/aidl/default/EffectFactory.cpp b/audio/aidl/default/EffectFactory.cpp new file mode 100644 index 0000000000..a31e23f8db --- /dev/null +++ b/audio/aidl/default/EffectFactory.cpp @@ -0,0 +1,59 @@ +/* + * 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. + */ + +#define LOG_TAG "AHAL_EffectFactory" +#include + +#include "effectFactory-impl/EffectFactory.h" +#include "equalizer-impl/Equalizer.h" +#include "visualizer-impl/Visualizer.h" + +using aidl::android::media::audio::common::AudioUuid; + +namespace aidl::android::hardware::audio::effect { + +Factory::Factory() { + // TODO: implement this with xml parser on audio_effect.xml, and filter with optional + // parameters. + Descriptor::Identity id; + id.type = {static_cast(0x0bed4300), + 0xddd6, + 0x11db, + 0x8f34, + {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; + id.uuid = EqualizerUUID; + mIdentityList.push_back(id); + id.type = {static_cast(0xd3467faa), + 0xacc7, + 0x4d34, + 0xacaf, + {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; + id.uuid = VisualizerUUID; + mIdentityList.push_back(id); +} + +ndk::ScopedAStatus Factory::queryEffects(const std::optional& in_type, + const std::optional& in_instance, + std::vector* _aidl_return) { + std::copy_if(mIdentityList.begin(), mIdentityList.end(), std::back_inserter(*_aidl_return), + [&](auto& desc) { + return (!in_type.has_value() || in_type.value() == desc.type) && + (!in_instance.has_value() || in_instance.value() == desc.uuid); + }); + return ndk::ScopedAStatus::ok(); +} + +} // namespace aidl::android::hardware::audio::effect diff --git a/audio/aidl/default/EffectMain.cpp b/audio/aidl/default/EffectMain.cpp new file mode 100644 index 0000000000..3b3c39b7aa --- /dev/null +++ b/audio/aidl/default/EffectMain.cpp @@ -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. + */ + +#include "effectFactory-impl/EffectFactory.h" + +#include +#include +#include + +int main() { + // This is a debug implementation, always enable debug logging. + android::base::SetMinimumLogSeverity(::android::base::DEBUG); + ABinderProcess_setThreadPoolMaxThreadCount(16); + + auto effectFactory = + ndk::SharedRefBase::make(); + std::string serviceName = std::string() + effectFactory->descriptor + "/default"; + binder_status_t status = + AServiceManager_addService(effectFactory->asBinder().get(), serviceName.c_str()); + CHECK_EQ(STATUS_OK, status); + LOG(DEBUG) << __func__ << ": effectFactoryName:" << serviceName; + + ABinderProcess_joinThreadPool(); + return EXIT_FAILURE; // should not reach +} diff --git a/audio/aidl/default/android.hardware.audio.effect.service-aidl.example.rc b/audio/aidl/default/android.hardware.audio.effect.service-aidl.example.rc new file mode 100644 index 0000000000..01c0e6e6e6 --- /dev/null +++ b/audio/aidl/default/android.hardware.audio.effect.service-aidl.example.rc @@ -0,0 +1,9 @@ +service vendor.audio-effect-hal-aidl /vendor/bin/hw/android.hardware.audio.effect.service-aidl.example + class hal + user audioserver + # media gid needed for /dev/fm (radio) and for /data/misc/media (tee) + group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct wakelock context_hub + capabilities BLOCK_SUSPEND + ioprio rt 4 + task_profiles ProcessCapacityHigh HighPerformance + onrestart restart audioserver diff --git a/audio/aidl/default/android.hardware.audio.effect.service-aidl.xml b/audio/aidl/default/android.hardware.audio.effect.service-aidl.xml new file mode 100644 index 0000000000..fdc53a339c --- /dev/null +++ b/audio/aidl/default/android.hardware.audio.effect.service-aidl.xml @@ -0,0 +1,7 @@ + + + android.hardware.audio.effect + 1 + IFactory/default + + diff --git a/audio/aidl/default/include/effectFactory-impl/EffectFactory.h b/audio/aidl/default/include/effectFactory-impl/EffectFactory.h new file mode 100644 index 0000000000..7670250834 --- /dev/null +++ b/audio/aidl/default/include/effectFactory-impl/EffectFactory.h @@ -0,0 +1,47 @@ +/* + * 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. + */ + +#pragma once + +#include +#include + +#include + +namespace aidl::android::hardware::audio::effect { + +class Factory : public BnFactory { + public: + Factory(); + /** + * @brief Get identity of all effects supported by the device, with the optional filter by type + * and/or by instance UUID. + * + * @param in_type Type UUID. + * @param in_instance Instance UUID. + * @param out_descriptor List of identities . + * @return ndk::ScopedAStatus + */ + ndk::ScopedAStatus queryEffects( + const std::optional<::aidl::android::media::audio::common::AudioUuid>& in_type, + const std::optional<::aidl::android::media::audio::common::AudioUuid>& in_instance, + std::vector* out_descriptor) override; + + private: + // List of effect descriptors supported by the devices. + std::vector mIdentityList; +}; +} // namespace aidl::android::hardware::audio::effect diff --git a/audio/aidl/default/include/equalizer-impl/Equalizer.h b/audio/aidl/default/include/equalizer-impl/Equalizer.h new file mode 100644 index 0000000000..86f8c3ad2e --- /dev/null +++ b/audio/aidl/default/include/equalizer-impl/Equalizer.h @@ -0,0 +1,31 @@ +/* + * 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. + */ + +#pragma once + +#include + +namespace aidl::android::hardware::audio::effect { + +// Equalizer implementation UUID. +static const ::aidl::android::media::audio::common::AudioUuid EqualizerUUID = { + static_cast(0xce772f20), + 0x847d, + 0x11df, + 0xbb17, + {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; + +} // namespace aidl::android::hardware::audio::effect \ No newline at end of file diff --git a/audio/aidl/default/include/visualizer-impl/Visualizer.h b/audio/aidl/default/include/visualizer-impl/Visualizer.h new file mode 100644 index 0000000000..4b82dd0911 --- /dev/null +++ b/audio/aidl/default/include/visualizer-impl/Visualizer.h @@ -0,0 +1,31 @@ +/* + * 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. + */ + +#pragma once + +#include + +namespace aidl::android::hardware::audio::effect { + +// Visualizer implementation UUID. +static const ::aidl::android::media::audio::common::AudioUuid VisualizerUUID = { + static_cast(0x1d4033c0), + 0x8557, + 0x11df, + 0x9f2d, + {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; + +} // namespace aidl::android::hardware::audio::effect \ No newline at end of file diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index f4d819f621..11a083c7ad 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -37,6 +37,14 @@ default + + android.hardware.audio.effect + 1 + + IFactory + default + + android.hardware.authsecret 1 From 1f19c23ab69a79fb1438a84354a00ac8adcf91e6 Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Wed, 13 Jul 2022 05:01:42 +0000 Subject: [PATCH 218/998] AIDL effect: Add vts for the initial effect AIDL interface implementation Tests basic binder calls of IFactory. Bug: 238913361 Test: atest VtsHalAudioEffectTargetTest Change-Id: If5db3cae0447f41a149a60505d208070fbfedb7f --- audio/aidl/vts/Android.bp | 28 ++++ audio/aidl/vts/AudioHalBinderServiceUtil.h | 99 +++++++++++++ audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp | 61 +++----- .../aidl/vts/VtsHalAudioEffectTargetTest.cpp | 130 ++++++++++++++++++ 4 files changed, 274 insertions(+), 44 deletions(-) create mode 100644 audio/aidl/vts/AudioHalBinderServiceUtil.h create mode 100644 audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp diff --git a/audio/aidl/vts/Android.bp b/audio/aidl/vts/Android.bp index 7b35133cfe..48aa273f74 100644 --- a/audio/aidl/vts/Android.bp +++ b/audio/aidl/vts/Android.bp @@ -41,3 +41,31 @@ cc_test { "vts", ], } + +cc_test { + name: "VtsHalAudioEffectTargetTest", + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + srcs: [ + "VtsHalAudioEffectTargetTest.cpp", + ], + shared_libs: [ + "libbinder_ndk", + ], + static_libs: [ + "android.media.audio.common.types-V1-ndk", + "android.hardware.audio.effect-V1-ndk", + ], + cflags: [ + "-Wall", + "-Wextra", + "-Werror", + "-Wthread-safety", + ], + test_suites: [ + "general-tests", + "vts", + ], +} diff --git a/audio/aidl/vts/AudioHalBinderServiceUtil.h b/audio/aidl/vts/AudioHalBinderServiceUtil.h new file mode 100644 index 0000000000..e9282867dd --- /dev/null +++ b/audio/aidl/vts/AudioHalBinderServiceUtil.h @@ -0,0 +1,99 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include + +#include +#include +#include + +#include + +class AudioHalBinderServiceUtil { + public: + ndk::SpAIBinder connectToService(const std::string& serviceName) { + mServiceName = serviceName; + mBinder = ndk::SpAIBinder(AServiceManager_getService(serviceName.c_str())); + if (mBinder == nullptr) { + LOG(ERROR) << "Failed to get service " << serviceName; + } else { + LOG(DEBUG) << "succeed to get service " << serviceName; + } + return mBinder; + } + + ndk::SpAIBinder restartService( + std::chrono::milliseconds timeoutMs = std::chrono::milliseconds(3000)) { + mDeathHandler.reset(new AidlDeathRecipient(mBinder)); + if (STATUS_OK != mDeathHandler->linkToDeath()) { + LOG(ERROR) << "linkToDeath failed"; + return nullptr; + } + if (!android::base::SetProperty("sys.audio.restart.hal", "1")) { + LOG(ERROR) << "SetProperty failed"; + return nullptr; + } + if (!mDeathHandler->waitForFired(timeoutMs)) { + LOG(ERROR) << "Timeout wait for death"; + return nullptr; + } + mDeathHandler.reset(); + return connectToService(mServiceName); + } + + private: + class AidlDeathRecipient { + public: + explicit AidlDeathRecipient(const ndk::SpAIBinder& binder) + : binder(binder), recipient(AIBinder_DeathRecipient_new(&binderDiedCallbackAidl)) {} + + binder_status_t linkToDeath() { + return AIBinder_linkToDeath(binder.get(), recipient.get(), this); + } + + bool waitForFired(std::chrono::milliseconds timeoutMs) { + std::unique_lock lock(mutex); + condition.wait_for(lock, timeoutMs, [this]() { return fired; }); + return fired; + } + + private: + const ndk::SpAIBinder binder; + const ndk::ScopedAIBinder_DeathRecipient recipient; + std::mutex mutex; + std::condition_variable condition; + bool fired = false; + + void binderDied() { + std::unique_lock lock(mutex); + fired = true; + condition.notify_one(); + }; + + static void binderDiedCallbackAidl(void* cookie) { + AidlDeathRecipient* self = static_cast(cookie); + self->binderDied(); + } + }; + + std::string mServiceName; + ndk::SpAIBinder mBinder; + std::unique_ptr mDeathHandler; +}; diff --git a/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp index 290f5f0494..ab70ec4c29 100644 --- a/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreTargetTest.cpp @@ -15,10 +15,8 @@ */ #include -#include #include #include -#include #include #include #include @@ -35,11 +33,9 @@ #include #include #include -#include -#include -#include #include +#include "AudioHalBinderServiceUtil.h" #include "ModuleConfig.h" using namespace android; @@ -101,38 +97,20 @@ AudioDeviceAddress GenerateUniqueDeviceAddress() { return AudioDeviceAddress::make(std::to_string(++nextId)); } -struct AidlDeathRecipient { - const ndk::SpAIBinder binder; - const ndk::ScopedAIBinder_DeathRecipient recipient; - std::mutex mutex; - std::condition_variable condition; - bool fired = false; - - explicit AidlDeathRecipient(const ndk::SpAIBinder& binder) - : binder(binder), recipient(AIBinder_DeathRecipient_new(&binderDiedCallbackAidl)) {} - - binder_status_t linkToDeath() { - return AIBinder_linkToDeath(binder.get(), recipient.get(), this); - } - - void binderDied() { - std::unique_lock lock(mutex); - fired = true; - condition.notify_one(); - }; - - bool waitForFired(int timeoutMs) { - std::unique_lock lock(mutex); - condition.wait_for(lock, std::chrono::milliseconds(timeoutMs), [this]() { return fired; }); - return fired; - } - - static void binderDiedCallbackAidl(void* cookie) { - AidlDeathRecipient* self = static_cast(cookie); - self->binderDied(); - } +template +struct IsInput { + constexpr operator bool() const; }; +template <> +constexpr IsInput::operator bool() const { + return true; +} +template <> +constexpr IsInput::operator bool() const { + return false; +} + // All 'With*' classes are move-only because they are associated with some // resource or state of a HAL module. class WithDebugFlags { @@ -238,20 +216,15 @@ class AudioCoreModule : public testing::TestWithParam { } void ConnectToService() { - module = IModule::fromBinder( - ndk::SpAIBinder(AServiceManager_getService(GetParam().c_str()))); + module = IModule::fromBinder(binderUtil.connectToService(GetParam())); ASSERT_NE(module, nullptr); } void RestartService() { ASSERT_NE(module, nullptr); moduleConfig.reset(); - deathHandler.reset(new AidlDeathRecipient(module->asBinder())); - ASSERT_EQ(STATUS_OK, deathHandler->linkToDeath()); - ASSERT_TRUE(base::SetProperty("sys.audio.restart.hal", "1")); - EXPECT_TRUE(deathHandler->waitForFired(3000)); - deathHandler.reset(); - ASSERT_NO_FATAL_FAILURE(ConnectToService()); + module = IModule::fromBinder(binderUtil.restartService()); + ASSERT_NE(module, nullptr); } void ApplyEveryConfig(const std::vector& configs) { @@ -322,8 +295,8 @@ class AudioCoreModule : public testing::TestWithParam { } std::shared_ptr module; - std::unique_ptr deathHandler; std::unique_ptr moduleConfig; + AudioHalBinderServiceUtil binderUtil; WithDebugFlags debug; }; diff --git a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp new file mode 100644 index 0000000000..f70948c3be --- /dev/null +++ b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp @@ -0,0 +1,130 @@ +/* + * 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. + */ + +#include + +#define LOG_TAG "VtsHalAudioEffect" + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "AudioHalBinderServiceUtil.h" + +using namespace android; + +using ndk::ScopedAStatus; + +using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::IFactory; +using aidl::android::media::audio::common::AudioUuid; + +namespace ndk { +std::ostream& operator<<(std::ostream& str, const ScopedAStatus& status) { + str << status.getDescription(); + return str; +} +} // namespace ndk + +class EffectFactory : public testing::TestWithParam { + public: + void SetUp() override { ASSERT_NO_FATAL_FAILURE(ConnectToService()); } + + void TearDown() override {} + + void ConnectToService() { + serviceName = GetParam(); + factory = IFactory::fromBinder(binderUtil.connectToService(serviceName)); + ASSERT_NE(factory, nullptr); + } + + void RestartService() { + ASSERT_NE(factory, nullptr); + factory = IFactory::fromBinder(binderUtil.restartService()); + ASSERT_NE(factory, nullptr); + } + + std::shared_ptr factory; + std::string serviceName; + AudioHalBinderServiceUtil binderUtil; + // TODO: these UUID can get from config file + // ec7178ec-e5e1-4432-a3f4-4657e6795210 + const AudioUuid nullUuid = {static_cast(0xec7178ec), + 0xe5e1, + 0x4432, + 0xa3f4, + {0x46, 0x57, 0xe6, 0x79, 0x52, 0x10}}; + const AudioUuid zeroUuid = { + static_cast(0x0), 0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}; +}; + +TEST_P(EffectFactory, SetupAndTearDown) { + // Intentionally empty test body. +} + +TEST_P(EffectFactory, CanBeRestarted) { + ASSERT_NO_FATAL_FAILURE(RestartService()); +} + +TEST_P(EffectFactory, QueriedDescriptorList) { + std::vector descriptors; + ScopedAStatus status = factory->queryEffects(std::nullopt, std::nullopt, &descriptors); + EXPECT_EQ(EX_NONE, status.getExceptionCode()); + EXPECT_NE(static_cast(descriptors.size()), 0); +} + +TEST_P(EffectFactory, DescriptorUUIDNotNull) { + std::vector descriptors; + ScopedAStatus status = factory->queryEffects(std::nullopt, std::nullopt, &descriptors); + EXPECT_EQ(EX_NONE, status.getExceptionCode()); + // TODO: Factory eventually need to return the full list of MUST supported AOSP effects. + for (auto& desc : descriptors) { + EXPECT_NE(desc.type, zeroUuid); + EXPECT_NE(desc.uuid, zeroUuid); + } +} + +TEST_P(EffectFactory, QueriedDescriptorNotExistType) { + std::vector descriptors; + ScopedAStatus status = factory->queryEffects(nullUuid, std::nullopt, &descriptors); + EXPECT_EQ(EX_NONE, status.getExceptionCode()); + EXPECT_EQ(static_cast(descriptors.size()), 0); +} + +TEST_P(EffectFactory, QueriedDescriptorNotExistInstance) { + std::vector descriptors; + ScopedAStatus status = factory->queryEffects(std::nullopt, nullUuid, &descriptors); + EXPECT_EQ(EX_NONE, status.getExceptionCode()); + EXPECT_EQ(static_cast(descriptors.size()), 0); +} + +INSTANTIATE_TEST_SUITE_P(EffectFactoryTest, EffectFactory, + testing::ValuesIn(android::getAidlHalInstanceNames(IFactory::descriptor)), + android::PrintInstanceNameToString); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EffectFactory); + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + ABinderProcess_setThreadPoolMaxThreadCount(1); + ABinderProcess_startThreadPool(); + return RUN_ALL_TESTS(); +} From c8ed5c27a163ba922f403164db1ab8dc6214f9d0 Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Mon, 22 Aug 2022 16:32:46 +0000 Subject: [PATCH 219/998] AIDL effect: Extract common parts of effect service into cc_defaults Bug: b/238913361 Test: atest VtsHalAudioEffectTargetTest Change-Id: I58d925b3f4a3d41d4014f54f78d95c26cc5520ea --- audio/aidl/default/Android.bp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/audio/aidl/default/Android.bp b/audio/aidl/default/Android.bp index 5354b8e329..f536776c98 100644 --- a/audio/aidl/default/Android.bp +++ b/audio/aidl/default/Android.bp @@ -52,8 +52,8 @@ cc_binary { srcs: ["main.cpp"], } -cc_library_static { - name: "libaudioeffectserviceexampleimpl", +cc_defaults { + name: "aidlaudioeffectservice_defaults", vendor: true, shared_libs: [ "libbase", @@ -61,6 +61,17 @@ cc_library_static { "android.media.audio.common.types-V1-ndk", "android.hardware.audio.effect-V1-ndk", ], + cflags: [ + "-Wall", + "-Wextra", + "-Werror", + "-Wthread-safety", + ], +} + +cc_library_static { + name: "libaudioeffectserviceexampleimpl", + defaults: ["aidlaudioeffectservice_defaults"], export_include_dirs: ["include"], srcs: [ "EffectFactory.cpp", @@ -75,21 +86,9 @@ cc_binary { relative_install_path: "hw", init_rc: ["android.hardware.audio.effect.service-aidl.example.rc"], vintf_fragments: ["android.hardware.audio.effect.service-aidl.xml"], - vendor: true, - shared_libs: [ - "libbase", - "libbinder_ndk", - "android.media.audio.common.types-V1-ndk", - "android.hardware.audio.effect-V1-ndk", - ], + defaults: ["aidlaudioeffectservice_defaults"], static_libs: [ "libaudioeffectserviceexampleimpl", ], - cflags: [ - "-Wall", - "-Wextra", - "-Werror", - "-Wthread-safety", - ], srcs: ["EffectMain.cpp"], } From 778ddca75ac81c1fb31de3836e32b8661247bd7d Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Mon, 22 Aug 2022 21:02:24 +0000 Subject: [PATCH 220/998] uwb(hal): Doc update to clarify country code payload of 00 Bug: 243426975 Change-Id: I6ec56c68df5e1049d93c31e498934501f7d75ad1 Test: N/A --- .../hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl index 42d52f1d5a..4768f550b8 100644 --- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl +++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl @@ -30,6 +30,8 @@ enum UwbVendorGidAndroidOids { ANDROID_GET_POWER_STATS = 0x0, // Used to set the current regulatory country code (determined usinag // SIM or hardcoded by OEM). + // Country code is sent as a 2 byte value corresponding to ISO-3166 country code. + // Note: "00" is used to indicate that the country code is unknown. ANDROID_SET_COUNTRY_CODE = 0x1, // Used by the notification to get UWB ranging diagnostics stats. // Supported only if the UwbVendorCapabilityTlvTypes.SUPPORTED_DIAGNOSTICS set From 4a8ac29204309c0922be0c7b125285462ac36934 Mon Sep 17 00:00:00 2001 From: Hongguang Date: Tue, 9 Aug 2022 14:02:03 -0700 Subject: [PATCH 221/998] Make the default tuner HAL to be a dynamic AIDL Add lazy tuner service. Refine code to allow Tuner reference count to be 0 when no one uses it. Bug: 236002754 Test: atest VtsHalTvTunerTargetTest on both lazy and normal HALs Test: atest android.media.tv.tuner.cts on both lazy and normal HALs Change-Id: I0cc69fe8ffd79a66db00cb72d212c222130629b5 --- tv/tuner/aidl/default/Android.bp | 20 +++++++++++++++++--- tv/tuner/aidl/default/Demux.cpp | 6 +++++- tv/tuner/aidl/default/Frontend.cpp | 16 +++++++++++++--- tv/tuner/aidl/default/Frontend.h | 3 ++- tv/tuner/aidl/default/Tuner.cpp | 21 +++++++++++---------- tv/tuner/aidl/default/service.cpp | 9 ++++++++- tv/tuner/aidl/default/tuner-default-lazy.rc | 9 +++++++++ tv/tuner/aidl/default/tuner-default.rc | 1 + 8 files changed, 66 insertions(+), 19 deletions(-) create mode 100644 tv/tuner/aidl/default/tuner-default-lazy.rc diff --git a/tv/tuner/aidl/default/Android.bp b/tv/tuner/aidl/default/Android.bp index cb8f87b61e..c10ad22fea 100644 --- a/tv/tuner/aidl/default/Android.bp +++ b/tv/tuner/aidl/default/Android.bp @@ -7,10 +7,9 @@ package { default_applicable_licenses: ["hardware_interfaces_license"], } -cc_binary { - name: "android.hardware.tv.tuner-service.example", +cc_defaults { + name: "tuner_hal_example_defaults", relative_install_path: "hw", - init_rc: ["tuner-default.rc"], vintf_fragments: ["tuner-default.xml"], vendor: true, compile_multilib: "first", @@ -44,3 +43,18 @@ cc_binary { "media_plugin_headers", ], } + +cc_binary { + name: "android.hardware.tv.tuner-service.example", + defaults: ["tuner_hal_example_defaults"], + init_rc: ["tuner-default.rc"], +} + +cc_binary { + name: "android.hardware.tv.tuner-service.example-lazy", + defaults: ["tuner_hal_example_defaults"], + init_rc: ["tuner-default-lazy.rc"], + cflags: [ + "-DLAZY_HAL", + ], +} diff --git a/tv/tuner/aidl/default/Demux.cpp b/tv/tuner/aidl/default/Demux.cpp index a94b4ad38a..60fd89981b 100644 --- a/tv/tuner/aidl/default/Demux.cpp +++ b/tv/tuner/aidl/default/Demux.cpp @@ -37,6 +37,7 @@ Demux::Demux(int32_t demuxId, std::shared_ptr tuner) { } Demux::~Demux() { + ALOGV("%s", __FUNCTION__); close(); } @@ -180,7 +181,10 @@ Demux::~Demux() { mRecordFilterIds.clear(); mFilters.clear(); mLastUsedFilterId = -1; - mTuner->removeDemux(mDemuxId); + if (mTuner != nullptr) { + mTuner->removeDemux(mDemuxId); + mTuner = nullptr; + } return ::ndk::ScopedAStatus::ok(); } diff --git a/tv/tuner/aidl/default/Frontend.cpp b/tv/tuner/aidl/default/Frontend.cpp index 3f7797cead..0573d08301 100644 --- a/tv/tuner/aidl/default/Frontend.cpp +++ b/tv/tuner/aidl/default/Frontend.cpp @@ -28,10 +28,10 @@ namespace hardware { namespace tv { namespace tuner { -Frontend::Frontend(FrontendType type, int32_t id, std::shared_ptr tuner) { +Frontend::Frontend(FrontendType type, int32_t id) { mType = type; mId = id; - mTuner = tuner; + mTuner = nullptr; // Init callback to nullptr mCallback = nullptr; @@ -170,7 +170,12 @@ Frontend::Frontend(FrontendType type, int32_t id, std::shared_ptr tuner) } } -Frontend::~Frontend() {} +Frontend::~Frontend() { + ALOGV("%s", __FUNCTION__); + mCallback = nullptr; + mIsLocked = false; + mTuner = nullptr; +} ::ndk::ScopedAStatus Frontend::close() { ALOGV("%s", __FUNCTION__); @@ -178,6 +183,7 @@ Frontend::~Frontend() {} mCallback = nullptr; mIsLocked = false; mTuner->removeFrontend(mId); + mTuner = nullptr; return ::ndk::ScopedAStatus::ok(); } @@ -233,6 +239,10 @@ Frontend::~Frontend() {} return ::ndk::ScopedAStatus::ok(); } +void Frontend::setTunerService(std::shared_ptr tuner) { + mTuner = tuner; +} + void Frontend::scanThreadLoop() { if (mIsLocked) { FrontendScanMessage msg; diff --git a/tv/tuner/aidl/default/Frontend.h b/tv/tuner/aidl/default/Frontend.h index 1d9ab53a61..85bd636cc4 100644 --- a/tv/tuner/aidl/default/Frontend.h +++ b/tv/tuner/aidl/default/Frontend.h @@ -34,7 +34,7 @@ class Tuner; class Frontend : public BnFrontend { public: - Frontend(FrontendType type, int32_t id, std::shared_ptr tuner); + Frontend(FrontendType type, int32_t id); ::ndk::ScopedAStatus setCallback( const std::shared_ptr& in_callback) override; @@ -62,6 +62,7 @@ class Frontend : public BnFrontend { string getSourceFile(); bool isLocked(); void getFrontendInfo(FrontendInfo* _aidl_return); + void setTunerService(std::shared_ptr tuner); private: virtual ~Frontend(); diff --git a/tv/tuner/aidl/default/Tuner.cpp b/tv/tuner/aidl/default/Tuner.cpp index fa74288b09..591f936fbe 100644 --- a/tv/tuner/aidl/default/Tuner.cpp +++ b/tv/tuner/aidl/default/Tuner.cpp @@ -38,16 +38,16 @@ void Tuner::init() { // Static Frontends array to maintain local frontends information // Array index matches their FrontendId in the default impl mFrontendSize = 10; - mFrontends[0] = ndk::SharedRefBase::make(FrontendType::ISDBS, 0, this->ref()); - mFrontends[1] = ndk::SharedRefBase::make(FrontendType::ATSC3, 1, this->ref()); - mFrontends[2] = ndk::SharedRefBase::make(FrontendType::DVBC, 2, this->ref()); - mFrontends[3] = ndk::SharedRefBase::make(FrontendType::DVBS, 3, this->ref()); - mFrontends[4] = ndk::SharedRefBase::make(FrontendType::DVBT, 4, this->ref()); - mFrontends[5] = ndk::SharedRefBase::make(FrontendType::ISDBT, 5, this->ref()); - mFrontends[6] = ndk::SharedRefBase::make(FrontendType::ANALOG, 6, this->ref()); - mFrontends[7] = ndk::SharedRefBase::make(FrontendType::ATSC, 7, this->ref()); - mFrontends[8] = ndk::SharedRefBase::make(FrontendType::ISDBS3, 8, this->ref()); - mFrontends[9] = ndk::SharedRefBase::make(FrontendType::DTMB, 9, this->ref()); + mFrontends[0] = ndk::SharedRefBase::make(FrontendType::ISDBS, 0); + mFrontends[1] = ndk::SharedRefBase::make(FrontendType::ATSC3, 1); + mFrontends[2] = ndk::SharedRefBase::make(FrontendType::DVBC, 2); + mFrontends[3] = ndk::SharedRefBase::make(FrontendType::DVBS, 3); + mFrontends[4] = ndk::SharedRefBase::make(FrontendType::DVBT, 4); + mFrontends[5] = ndk::SharedRefBase::make(FrontendType::ISDBT, 5); + mFrontends[6] = ndk::SharedRefBase::make(FrontendType::ANALOG, 6); + mFrontends[7] = ndk::SharedRefBase::make(FrontendType::ATSC, 7); + mFrontends[8] = ndk::SharedRefBase::make(FrontendType::ISDBS3, 8); + mFrontends[9] = ndk::SharedRefBase::make(FrontendType::DTMB, 9); mMaxUsableFrontends[FrontendType::ISDBS] = 1; mMaxUsableFrontends[FrontendType::ATSC3] = 1; @@ -89,6 +89,7 @@ Tuner::~Tuner() {} static_cast(Result::INVALID_ARGUMENT)); } + mFrontends[in_frontendId]->setTunerService(this->ref()); *_aidl_return = mFrontends[in_frontendId]; return ::ndk::ScopedAStatus::ok(); } diff --git a/tv/tuner/aidl/default/service.cpp b/tv/tuner/aidl/default/service.cpp index ac8d779c28..f980f4aa29 100644 --- a/tv/tuner/aidl/default/service.cpp +++ b/tv/tuner/aidl/default/service.cpp @@ -30,8 +30,15 @@ int main() { std::shared_ptr tuner = ndk::SharedRefBase::make(); tuner->init(); + binder_status_t status; const std::string instance = std::string() + Tuner::descriptor + "/default"; - binder_status_t status = AServiceManager_addService(tuner->asBinder().get(), instance.c_str()); +#ifdef LAZY_HAL + ALOGD("Start as a lazy HAL"); + status = AServiceManager_registerLazyService(tuner->asBinder().get(), instance.c_str()); +#else + ALOGD("Start as a normal HAL"); + status = AServiceManager_addService(tuner->asBinder().get(), instance.c_str()); +#endif CHECK(status == STATUS_OK); ABinderProcess_joinThreadPool(); diff --git a/tv/tuner/aidl/default/tuner-default-lazy.rc b/tv/tuner/aidl/default/tuner-default-lazy.rc new file mode 100644 index 0000000000..6b3b183e3c --- /dev/null +++ b/tv/tuner/aidl/default/tuner-default-lazy.rc @@ -0,0 +1,9 @@ +service vendor.tuner-default-lazy /vendor/bin/hw/android.hardware.tv.tuner-service.example-lazy + class hal + user media + group mediadrm drmrpc + ioprio rt 4 + task_profiles ProcessCapacityHigh + interface aidl android.hardware.tv.tuner.ITuner/default + oneshot + disabled diff --git a/tv/tuner/aidl/default/tuner-default.rc b/tv/tuner/aidl/default/tuner-default.rc index 661c219ffa..f9315ae28f 100644 --- a/tv/tuner/aidl/default/tuner-default.rc +++ b/tv/tuner/aidl/default/tuner-default.rc @@ -5,3 +5,4 @@ service vendor.tuner-default /vendor/bin/hw/android.hardware.tv.tuner-service.ex ioprio rt 4 task_profiles ProcessCapacityHigh onrestart restart media.tuner + interface aidl android.hardware.tv.tuner.ITuner/default From 2b41ee5263876ec7fb8ffecbe6fb6e8e3aa25cec Mon Sep 17 00:00:00 2001 From: Yixiao Luo Date: Thu, 11 Aug 2022 18:13:42 -0700 Subject: [PATCH 222/998] TV Input HAL 2.0 AIDL interface Initial version, fixed tabs. Addressed comments. Bug: 227673740 Test: atest VtsHalTvInputTargetTest Change-Id: Id4bc501c4898239bd9325c8688687d95db74cf1d --- .../compatibility_matrix.current.xml | 8 ++ tv/input/aidl/Android.bp | 27 +++++++ .../tv/input/CableConnectionStatus.aidl | 40 ++++++++++ .../android/hardware/tv/input/ITvInput.aidl | 45 +++++++++++ .../hardware/tv/input/ITvInputCallback.aidl | 38 +++++++++ .../hardware/tv/input/TvInputDeviceInfo.aidl | 42 ++++++++++ .../hardware/tv/input/TvInputEvent.aidl | 39 ++++++++++ .../hardware/tv/input/TvInputEventType.aidl | 40 ++++++++++ .../hardware/tv/input/TvInputType.aidl | 47 +++++++++++ .../hardware/tv/input/TvStreamConfig.aidl | 40 ++++++++++ .../tv/input/CableConnectionStatus.aidl | 31 ++++++++ .../android/hardware/tv/input/ITvInput.aidl | 76 ++++++++++++++++++ .../hardware/tv/input/ITvInputCallback.aidl | 30 ++++++++ .../hardware/tv/input/TvInputDeviceInfo.aidl | 36 +++++++++ .../hardware/tv/input/TvInputEvent.aidl | 32 ++++++++ .../hardware/tv/input/TvInputEventType.aidl | 77 +++++++++++++++++++ .../hardware/tv/input/TvInputType.aidl | 35 +++++++++ .../hardware/tv/input/TvStreamConfig.aidl | 28 +++++++ 18 files changed, 711 insertions(+) create mode 100644 tv/input/aidl/Android.bp create mode 100644 tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/CableConnectionStatus.aidl create mode 100644 tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInput.aidl create mode 100644 tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInputCallback.aidl create mode 100644 tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputDeviceInfo.aidl create mode 100644 tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputEvent.aidl create mode 100644 tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputEventType.aidl create mode 100644 tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputType.aidl create mode 100644 tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvStreamConfig.aidl create mode 100644 tv/input/aidl/android/hardware/tv/input/CableConnectionStatus.aidl create mode 100644 tv/input/aidl/android/hardware/tv/input/ITvInput.aidl create mode 100644 tv/input/aidl/android/hardware/tv/input/ITvInputCallback.aidl create mode 100644 tv/input/aidl/android/hardware/tv/input/TvInputDeviceInfo.aidl create mode 100644 tv/input/aidl/android/hardware/tv/input/TvInputEvent.aidl create mode 100644 tv/input/aidl/android/hardware/tv/input/TvInputEventType.aidl create mode 100644 tv/input/aidl/android/hardware/tv/input/TvInputType.aidl create mode 100644 tv/input/aidl/android/hardware/tv/input/TvStreamConfig.aidl diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 16e29d1d82..32aed71824 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -630,6 +630,14 @@ default + + android.hardware.tv.input + 1 + + ITvInput + default + + android.hardware.usb diff --git a/tv/input/aidl/Android.bp b/tv/input/aidl/Android.bp new file mode 100644 index 0000000000..1987174990 --- /dev/null +++ b/tv/input/aidl/Android.bp @@ -0,0 +1,27 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +aidl_interface { + name: "android.hardware.tv.input", + vendor_available: true, + srcs: ["android/hardware/tv/input/*.aidl"], + imports: [ + "android.hardware.common-V2", + "android.media.audio.common.types-V1", + ], + stability: "vintf", + backend: { + java: { + sdk_version: "module_current", + }, + cpp: { + enabled: false, + }, + }, +} diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/CableConnectionStatus.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/CableConnectionStatus.aidl new file mode 100644 index 0000000000..a48bdb11c6 --- /dev/null +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/CableConnectionStatus.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.input; +@Backing(type="int") @VintfStability +enum CableConnectionStatus { + UNKNOWN = 0, + CONNECTED = 1, + DISCONNECTED = 2, +} diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInput.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInput.aidl new file mode 100644 index 0000000000..f8d5e058d4 --- /dev/null +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInput.aidl @@ -0,0 +1,45 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.input; +@VintfStability +interface ITvInput { + void closeStream(in int deviceId, in int streamId); + android.hardware.tv.input.TvStreamConfig[] getStreamConfigurations(in int deviceId); + android.hardware.common.NativeHandle openStream(in int deviceId, in int streamId); + void setCallback(in android.hardware.tv.input.ITvInputCallback callback); + const int STATUS_UNKNOWN = 1; + const int STATUS_NO_RESOURCE = 2; + const int STATUS_INVALID_ARGUMENTS = 3; + const int STATUS_INVALID_STATE = 4; +} diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInputCallback.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInputCallback.aidl new file mode 100644 index 0000000000..7f2aff6d78 --- /dev/null +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInputCallback.aidl @@ -0,0 +1,38 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.input; +@VintfStability +interface ITvInputCallback { + void notify(in android.hardware.tv.input.TvInputEvent event); +} diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputDeviceInfo.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputDeviceInfo.aidl new file mode 100644 index 0000000000..d0951467be --- /dev/null +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputDeviceInfo.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.input; +@VintfStability +parcelable TvInputDeviceInfo { + int deviceId; + android.hardware.tv.input.TvInputType type; + int portId; + android.hardware.tv.input.CableConnectionStatus cableConnectionStatus; + android.media.audio.common.AudioDevice audioDevice; +} diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputEvent.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputEvent.aidl new file mode 100644 index 0000000000..cfa8a34c9e --- /dev/null +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputEvent.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.input; +@VintfStability +parcelable TvInputEvent { + android.hardware.tv.input.TvInputEventType type; + android.hardware.tv.input.TvInputDeviceInfo deviceInfo; +} diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputEventType.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputEventType.aidl new file mode 100644 index 0000000000..a9f518ac85 --- /dev/null +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputEventType.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.input; +@Backing(type="int") @VintfStability +enum TvInputEventType { + DEVICE_AVAILABLE = 1, + DEVICE_UNAVAILABLE = 2, + STREAM_CONFIGURATIONS_CHANGED = 3, +} diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputType.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputType.aidl new file mode 100644 index 0000000000..7e44a7d653 --- /dev/null +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvInputType.aidl @@ -0,0 +1,47 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.input; +@Backing(type="int") @VintfStability +enum TvInputType { + OTHER = 1, + TUNER = 2, + COMPOSITE = 3, + SVIDEO = 4, + SCART = 5, + COMPONENT = 6, + VGA = 7, + DVI = 8, + HDMI = 9, + DISPLAY_PORT = 10, +} diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvStreamConfig.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvStreamConfig.aidl new file mode 100644 index 0000000000..8378ff3a87 --- /dev/null +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvStreamConfig.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.input; +@VintfStability +parcelable TvStreamConfig { + int streamId; + int maxVideoWidth; + int maxVideoHeight; +} diff --git a/tv/input/aidl/android/hardware/tv/input/CableConnectionStatus.aidl b/tv/input/aidl/android/hardware/tv/input/CableConnectionStatus.aidl new file mode 100644 index 0000000000..64b79ddb17 --- /dev/null +++ b/tv/input/aidl/android/hardware/tv/input/CableConnectionStatus.aidl @@ -0,0 +1,31 @@ +/* + * Copyright 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. + */ + +package android.hardware.tv.input; + +/** + * Status of cable connection. + * This status is for devices having availability to detect the cable in a mechanical way, + * regardless of whether the connected external device is electrically on or not. + * If the device does not have such capability, you must use UNKNOWN. + */ +@VintfStability +@Backing(type="int") +enum CableConnectionStatus { + UNKNOWN = 0, + CONNECTED = 1, + DISCONNECTED = 2, +} diff --git a/tv/input/aidl/android/hardware/tv/input/ITvInput.aidl b/tv/input/aidl/android/hardware/tv/input/ITvInput.aidl new file mode 100644 index 0000000000..31d6586135 --- /dev/null +++ b/tv/input/aidl/android/hardware/tv/input/ITvInput.aidl @@ -0,0 +1,76 @@ +/* + * Copyright 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. + */ + +package android.hardware.tv.input; + +import android.hardware.common.NativeHandle; +import android.hardware.tv.input.ITvInputCallback; +import android.hardware.tv.input.TvStreamConfig; + +@VintfStability +interface ITvInput { + /** + * ServiceSpecificException values for ITvInput requests + */ + const int STATUS_UNKNOWN = 1; + const int STATUS_NO_RESOURCE = 2; + const int STATUS_INVALID_ARGUMENTS = 3; + const int STATUS_INVALID_STATE = 4; + + /** + * Closes a specific stream in a device. + * + * @param deviceId Device ID for the stream to close. + * @param streamId Stream ID for the stream to close. + * @throws ServiceSpecificException with values from the ITvInput::STATUS_* constants + */ + void closeStream(in int deviceId, in int streamId); + + /** + * Gets stream configurations for a specific device. + * + * The configs object is valid only until the next + * STREAM_CONFIGURATIONS_CHANGED event. + * + * @param deviceId Device ID for the configurations. + * @return the array of available configurations. + * @throws ServiceSpecificException with values from the ITvInput::STATUS_* constants + */ + TvStreamConfig[] getStreamConfigurations(in int deviceId); + + /** + * Opens a specific stream in a device. + * + * @param deviceId Device ID for the stream to open. + * @param streamId Stream ID for the stream to open. Must be one of the + * stream IDs returned from getStreamConfigurations(). + * @return the handle for sideband stream. + * @throws ServiceSpecificException with values from the ITvInput::STATUS_* constants + */ + NativeHandle openStream(in int deviceId, in int streamId); + + /** + * Sets a callback for events. + * + * Note that initially no device is available in the client side, so the + * implementation must notify all the currently available devices including + * static devices via callback once callback is set. + * + * @param callback Callback object to pass events. + * @throws ServiceSpecificException with values from the ITvInput::STATUS_* constants + */ + void setCallback(in ITvInputCallback callback); +} diff --git a/tv/input/aidl/android/hardware/tv/input/ITvInputCallback.aidl b/tv/input/aidl/android/hardware/tv/input/ITvInputCallback.aidl new file mode 100644 index 0000000000..fc7492d7b4 --- /dev/null +++ b/tv/input/aidl/android/hardware/tv/input/ITvInputCallback.aidl @@ -0,0 +1,30 @@ +/* + * Copyright 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. + */ + +package android.hardware.tv.input; + +import android.hardware.tv.input.TvInputEvent; + +@VintfStability +interface ITvInputCallback { + /** + * Notifies the client that an event has occurred. For possible event types, + * check TvInputEventType. + * + * @param event Event passed to the client. + */ + void notify(in TvInputEvent event); +} diff --git a/tv/input/aidl/android/hardware/tv/input/TvInputDeviceInfo.aidl b/tv/input/aidl/android/hardware/tv/input/TvInputDeviceInfo.aidl new file mode 100644 index 0000000000..2782e90df7 --- /dev/null +++ b/tv/input/aidl/android/hardware/tv/input/TvInputDeviceInfo.aidl @@ -0,0 +1,36 @@ +/* + * Copyright 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. + */ + +package android.hardware.tv.input; + +import android.hardware.tv.input.CableConnectionStatus; +import android.hardware.tv.input.TvInputType; +import android.media.audio.common.AudioDevice; + +@VintfStability +parcelable TvInputDeviceInfo { + int deviceId; + TvInputType type; + + /* HDMI port ID number. e.g. 2 for HDMI 2. */ + int portId; + + /* Cable connection status. */ + CableConnectionStatus cableConnectionStatus; + + /* Audio device info. */ + AudioDevice audioDevice; +} diff --git a/tv/input/aidl/android/hardware/tv/input/TvInputEvent.aidl b/tv/input/aidl/android/hardware/tv/input/TvInputEvent.aidl new file mode 100644 index 0000000000..66ca7aa792 --- /dev/null +++ b/tv/input/aidl/android/hardware/tv/input/TvInputEvent.aidl @@ -0,0 +1,32 @@ +/* + * Copyright 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. + */ + +package android.hardware.tv.input; + +import android.hardware.tv.input.TvInputDeviceInfo; +import android.hardware.tv.input.TvInputEventType; + +@VintfStability +parcelable TvInputEvent { + TvInputEventType type; + + /** + * TvInputEventType::DEVICE_AVAILABLE: all fields are relevant. + * TvInputEventType::DEVICE_UNAVAILABLE: only deviceId is relevant. + * TvInputEventType::STREAM_CONFIGURATIONS_CHANGED: only deviceId is relevant. + */ + TvInputDeviceInfo deviceInfo; +} diff --git a/tv/input/aidl/android/hardware/tv/input/TvInputEventType.aidl b/tv/input/aidl/android/hardware/tv/input/TvInputEventType.aidl new file mode 100644 index 0000000000..fcbc3c223c --- /dev/null +++ b/tv/input/aidl/android/hardware/tv/input/TvInputEventType.aidl @@ -0,0 +1,77 @@ +/* + * Copyright 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. + */ + +package android.hardware.tv.input; + +@VintfStability +@Backing(type="int") +enum TvInputEventType { + /** + * Hardware notifies the framework that a device is available. + * + * Note that DEVICE_AVAILABLE and DEVICE_UNAVAILABLE events do not represent + * hotplug events (i.e. plugging cable into or out of the physical port). + * These events notify the framework whether the port is available or not. + * For a concrete example, when a user plugs in or pulls out the HDMI cable + * from a HDMI port, it does not generate DEVICE_AVAILABLE and/or + * DEVICE_UNAVAILABLE events. However, if a user inserts a pluggable USB + * tuner into the Android device, it must generate a DEVICE_AVAILABLE event + * and when the port is removed, it must generate a DEVICE_UNAVAILABLE + * event. + * + * For hotplug events, please see STREAM_CONFIGURATION_CHANGED for more + * details. + * + * HAL implementation must register devices by using this event when the + * device boots up. The framework must recognize device reported via this + * event only. + */ + DEVICE_AVAILABLE = 1, + + /** + * Hardware notifies the framework that a device is unavailable. + * + * HAL implementation must generate this event when a device registered + * by DEVICE_AVAILABLE is no longer available. For example, + * the event can indicate that a USB tuner is plugged out from the Android + * device. + * + * Note that this event is not for indicating cable plugged out of the port; + * for that purpose, the implementation must use + * STREAM_CONFIGURATION_CHANGED event. This event represents the port itself + * being no longer available. + */ + DEVICE_UNAVAILABLE = 2, + + /** + * Stream configurations are changed. Client must regard all open streams + * at the specific device are closed, and must call + * getStreamConfigurations() again, opening some of them if necessary. + * + * HAL implementation must generate this event when the available stream + * configurations change for any reason. A typical use case of this event + * is to notify the framework that the input signal has changed resolution, + * or that the cable is plugged out so that the number of available streams + * is 0. + * + * The implementation must use this event to indicate hotplug status of the + * port. the framework regards input devices with no available streams as + * disconnected, so the implementation can generate this event with no + * available streams to indicate that this device is disconnected, and vice + * versa. + */ + STREAM_CONFIGURATIONS_CHANGED = 3, +} diff --git a/tv/input/aidl/android/hardware/tv/input/TvInputType.aidl b/tv/input/aidl/android/hardware/tv/input/TvInputType.aidl new file mode 100644 index 0000000000..a0f8270b82 --- /dev/null +++ b/tv/input/aidl/android/hardware/tv/input/TvInputType.aidl @@ -0,0 +1,35 @@ +/* + * Copyright 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. + */ + +package android.hardware.tv.input; + +/** + * Type of physical TV input. + */ +@VintfStability +@Backing(type="int") +enum TvInputType { + OTHER = 1, + TUNER = 2, + COMPOSITE = 3, + SVIDEO = 4, + SCART = 5, + COMPONENT = 6, + VGA = 7, + DVI = 8, + HDMI = 9, + DISPLAY_PORT = 10, +} diff --git a/tv/input/aidl/android/hardware/tv/input/TvStreamConfig.aidl b/tv/input/aidl/android/hardware/tv/input/TvStreamConfig.aidl new file mode 100644 index 0000000000..af86953dce --- /dev/null +++ b/tv/input/aidl/android/hardware/tv/input/TvStreamConfig.aidl @@ -0,0 +1,28 @@ +/* + * Copyright 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. + */ + +package android.hardware.tv.input; + +@VintfStability +parcelable TvStreamConfig { + int streamId; + + /* Maximum video width in pixel. */ + int maxVideoWidth; + + /* Maximum video height in pixel. */ + int maxVideoHeight; +} From aaa523018faade8e56d3cebd86226c4342c6c3dc Mon Sep 17 00:00:00 2001 From: Yixiao Luo Date: Thu, 11 Aug 2022 18:44:50 -0700 Subject: [PATCH 223/998] TV Input HAL 2.0 default implementation Initial version, fixed tabs. Addressed comments. Updated based on new AIDL interface changes. Bug: 227673740 Test: atest VtsHalTvInputTargetTest Change-Id: I49af8baa30404700fc38662b813913fe8cf08c0f --- tv/input/aidl/default/Android.bp | 31 ++++ tv/input/aidl/default/TvInput.cpp | 143 ++++++++++++++++++ tv/input/aidl/default/TvInput.h | 62 ++++++++ .../aidl/default/TvInputDeviceInfoWrapper.h | 43 ++++++ tv/input/aidl/default/TvStreamConfigWrapper.h | 50 ++++++ tv/input/aidl/default/input-default.rc | 5 + tv/input/aidl/default/input-default.xml | 6 + tv/input/aidl/default/service.cpp | 40 +++++ 8 files changed, 380 insertions(+) create mode 100644 tv/input/aidl/default/Android.bp create mode 100644 tv/input/aidl/default/TvInput.cpp create mode 100644 tv/input/aidl/default/TvInput.h create mode 100644 tv/input/aidl/default/TvInputDeviceInfoWrapper.h create mode 100644 tv/input/aidl/default/TvStreamConfigWrapper.h create mode 100644 tv/input/aidl/default/input-default.rc create mode 100644 tv/input/aidl/default/input-default.xml create mode 100644 tv/input/aidl/default/service.cpp diff --git a/tv/input/aidl/default/Android.bp b/tv/input/aidl/default/Android.bp new file mode 100644 index 0000000000..66148c8aaa --- /dev/null +++ b/tv/input/aidl/default/Android.bp @@ -0,0 +1,31 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_binary { + name: "android.hardware.tv.input-service.example", + relative_install_path: "hw", + init_rc: ["input-default.rc"], + vintf_fragments: ["input-default.xml"], + vendor: true, + srcs: [ + "TvInput.cpp", + "service.cpp", + ], + static_libs: [ + "libaidlcommonsupport", + ], + shared_libs: [ + "libbase", + "liblog", + "libutils", + "libcutils", + "libbinder_ndk", + "android.hardware.tv.input-V1-ndk", + ], +} diff --git a/tv/input/aidl/default/TvInput.cpp b/tv/input/aidl/default/TvInput.cpp new file mode 100644 index 0000000000..6c3a138155 --- /dev/null +++ b/tv/input/aidl/default/TvInput.cpp @@ -0,0 +1,143 @@ +/* + * Copyright 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. + */ + +#define LOG_TAG "android.hardware.tv.input-service.example" + +#include + +#include "TvInput.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace tv { +namespace input { + +TvInput::TvInput() {} + +void TvInput::init() { + // Set up TvInputDeviceInfo and TvStreamConfig + mDeviceInfos[0] = shared_ptr( + new TvInputDeviceInfoWrapper(0, TvInputType::TUNER, true)); + mDeviceInfos[1] = shared_ptr( + new TvInputDeviceInfoWrapper(1, TvInputType::HDMI, true)); + mDeviceInfos[3] = shared_ptr( + new TvInputDeviceInfoWrapper(3, TvInputType::DISPLAY_PORT, true)); + + mStreamConfigs[0] = { + {1, shared_ptr(new TvStreamConfigWrapper(1, 720, 1080, false))}}; + mStreamConfigs[1] = {{11, shared_ptr( + new TvStreamConfigWrapper(11, 360, 480, false))}}; + mStreamConfigs[3] = {{5, shared_ptr( + new TvStreamConfigWrapper(5, 1080, 1920, false))}}; +} + +::ndk::ScopedAStatus TvInput::setCallback(const shared_ptr& in_callback) { + ALOGV("%s", __FUNCTION__); + + mCallback = in_callback; + + TvInputEvent event; + event.type = TvInputEventType::DEVICE_AVAILABLE; + + event.deviceInfo = mDeviceInfos[0]->deviceInfo; + mCallback->notify(event); + + event.deviceInfo = mDeviceInfos[1]->deviceInfo; + mCallback->notify(event); + + event.deviceInfo = mDeviceInfos[3]->deviceInfo; + mCallback->notify(event); + + return ::ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus TvInput::getStreamConfigurations(int32_t in_deviceId, + vector* _aidl_return) { + ALOGV("%s", __FUNCTION__); + + if (mStreamConfigs.count(in_deviceId) == 0) { + ALOGW("Device with id %d isn't available", in_deviceId); + return ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_ARGUMENTS); + } + + for (auto const& iconfig : mStreamConfigs[in_deviceId]) { + _aidl_return->push_back(iconfig.second->streamConfig); + } + + return ::ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus TvInput::openStream(int32_t in_deviceId, int32_t in_streamId, + NativeHandle* _aidl_return) { + ALOGV("%s", __FUNCTION__); + + if (mStreamConfigs.count(in_deviceId) == 0 || + mStreamConfigs[in_deviceId].count(in_streamId) == 0) { + ALOGW("Stream with device id %d, stream id %d isn't available", in_deviceId, in_streamId); + return ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_ARGUMENTS); + } + if (mStreamConfigs[in_deviceId][in_streamId]->isOpen) { + ALOGW("Stream with device id %d, stream id %d is already opened", in_deviceId, in_streamId); + return ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_STATE); + } + mStreamConfigs[in_deviceId][in_streamId]->handle = createNativeHandle(in_streamId); + mStreamConfigs[in_deviceId][in_streamId]->isOpen = true; + NativeHandle aidlHandle = makeToAidl(mStreamConfigs[in_deviceId][in_streamId]->handle); + _aidl_return = &aidlHandle; + return ::ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus TvInput::closeStream(int32_t in_deviceId, int32_t in_streamId) { + ALOGV("%s", __FUNCTION__); + + if (mStreamConfigs.count(in_deviceId) == 0 || + mStreamConfigs[in_deviceId].count(in_streamId) == 0) { + ALOGW("Stream with device id %d, stream id %d isn't available", in_deviceId, in_streamId); + return ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_ARGUMENTS); + } + if (!mStreamConfigs[in_deviceId][in_streamId]->isOpen) { + ALOGW("Stream with device id %d, stream id %d is already closed", in_deviceId, in_streamId); + return ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_STATE); + } + releaseNativeHandle(mStreamConfigs[in_deviceId][in_streamId]->handle); + mStreamConfigs[in_deviceId][in_streamId]->handle = nullptr; + mStreamConfigs[in_deviceId][in_streamId]->isOpen = false; + return ::ndk::ScopedAStatus::ok(); +} + +native_handle_t* TvInput::createNativeHandle(int fd) { + native_handle_t* nativeHandle = native_handle_create(1, 0); + if (nativeHandle == nullptr) { + ALOGE("[TVInput] Failed to create native_handle %d", errno); + return nullptr; + } + if (nativeHandle->numFds > 0) { + nativeHandle->data[0] = dup(fd); + } + return nativeHandle; +} + +void TvInput::releaseNativeHandle(native_handle_t* handle) { + native_handle_close(handle); + native_handle_delete(handle); +} + +} // namespace input +} // namespace tv +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/tv/input/aidl/default/TvInput.h b/tv/input/aidl/default/TvInput.h new file mode 100644 index 0000000000..a72bca3806 --- /dev/null +++ b/tv/input/aidl/default/TvInput.h @@ -0,0 +1,62 @@ +/* + * Copyright 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. + */ + +#pragma once + +#include +#include + +#include +#include "TvInputDeviceInfoWrapper.h" +#include "TvStreamConfigWrapper.h" + +using namespace android; +using namespace std; +using ::aidl::android::hardware::common::NativeHandle; + +namespace aidl { +namespace android { +namespace hardware { +namespace tv { +namespace input { + +class TvInput : public BnTvInput { + public: + TvInput(); + + ::ndk::ScopedAStatus setCallback(const shared_ptr& in_callback) override; + ::ndk::ScopedAStatus getStreamConfigurations(int32_t in_deviceId, + vector* _aidl_return) override; + ::ndk::ScopedAStatus openStream(int32_t in_deviceId, int32_t in_streamId, + NativeHandle* _aidl_return) override; + ::ndk::ScopedAStatus closeStream(int32_t in_deviceId, int32_t in_streamId) override; + + void init(); + + private: + native_handle_t* createNativeHandle(int fd); + void releaseNativeHandle(native_handle_t* handle); + + shared_ptr mCallback; + map> mDeviceInfos; + map>> mStreamConfigs; +}; + +} // namespace input +} // namespace tv +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/tv/input/aidl/default/TvInputDeviceInfoWrapper.h b/tv/input/aidl/default/TvInputDeviceInfoWrapper.h new file mode 100644 index 0000000000..d844cc88fb --- /dev/null +++ b/tv/input/aidl/default/TvInputDeviceInfoWrapper.h @@ -0,0 +1,43 @@ +/* + * Copyright 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. + */ + +#pragma once + +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace tv { +namespace input { + +class TvInputDeviceInfoWrapper { + public: + TvInputDeviceInfoWrapper() {} + TvInputDeviceInfoWrapper(int32_t deviceId_, TvInputType type_, bool isAvailable_) { + deviceInfo.deviceId = deviceId_; + deviceInfo.type = type_; + isAvailable = isAvailable_; + } + + TvInputDeviceInfo deviceInfo; + bool isAvailable; +}; +} // namespace input +} // namespace tv +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/tv/input/aidl/default/TvStreamConfigWrapper.h b/tv/input/aidl/default/TvStreamConfigWrapper.h new file mode 100644 index 0000000000..05c7ca35b2 --- /dev/null +++ b/tv/input/aidl/default/TvStreamConfigWrapper.h @@ -0,0 +1,50 @@ +/* + * Copyright 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. + */ + +#pragma once + +#include +#include + +using namespace std; + +namespace aidl { +namespace android { +namespace hardware { +namespace tv { +namespace input { + +class TvStreamConfigWrapper { + public: + TvStreamConfigWrapper() {} + TvStreamConfigWrapper(int32_t streamId_, int32_t maxVideoWidth_, int32_t maxVideoHeight_, + bool isOpen_) { + streamConfig.streamId = streamId_; + streamConfig.maxVideoWidth = maxVideoWidth_; + streamConfig.maxVideoHeight = maxVideoHeight_; + isOpen = isOpen_; + handle = nullptr; + } + + TvStreamConfig streamConfig; + bool isOpen; + native_handle_t* handle; +}; +} // namespace input +} // namespace tv +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/tv/input/aidl/default/input-default.rc b/tv/input/aidl/default/input-default.rc new file mode 100644 index 0000000000..1958b5c292 --- /dev/null +++ b/tv/input/aidl/default/input-default.rc @@ -0,0 +1,5 @@ +service vendor.input-default /vendor/bin/hw/android.hardware.tv.input-service.example + interface aidl android.hardware.tv.input.ITvInput/default + class hal + user system + group system diff --git a/tv/input/aidl/default/input-default.xml b/tv/input/aidl/default/input-default.xml new file mode 100644 index 0000000000..38ba1512ba --- /dev/null +++ b/tv/input/aidl/default/input-default.xml @@ -0,0 +1,6 @@ + + + android.hardware.tv.input + ITvInput/default + + \ No newline at end of file diff --git a/tv/input/aidl/default/service.cpp b/tv/input/aidl/default/service.cpp new file mode 100644 index 0000000000..1021206153 --- /dev/null +++ b/tv/input/aidl/default/service.cpp @@ -0,0 +1,40 @@ +/* + * Copyright 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. + */ + +#define LOG_TAG "android.hardware.tv.input-service.example" + +#include +#include +#include +#include + +#include "TvInput.h" + +using ::aidl::android::hardware::tv::input::TvInput; + +int main() { + ABinderProcess_setThreadPoolMaxThreadCount(8); + std::shared_ptr tvInput = ndk::SharedRefBase::make(); + tvInput->init(); + + const std::string instance = std::string() + TvInput::descriptor + "/default"; + binder_status_t status = + AServiceManager_addService(tvInput->asBinder().get(), instance.c_str()); + CHECK(status == STATUS_OK); + + ABinderProcess_joinThreadPool(); + return EXIT_FAILURE; // should not reached +} From ce501336b93cb1aa01af365002481c6e2a7bec0a Mon Sep 17 00:00:00 2001 From: Yixiao Luo Date: Fri, 12 Aug 2022 11:18:18 -0700 Subject: [PATCH 224/998] TV Input HAL 2.0 VTS Initial version, fixed tabs. Addressed comments. Updated based on new AIDL interface changes. Bug: 227673740 Test: VTS Change-Id: I0b5533ccff8c2c9ab9e0393cadce86b26cfc157b --- tv/input/aidl/vts/functional/Android.bp | 29 ++ .../functional/VtsHalTvInputTargetTest.cpp | 296 ++++++++++++++++++ .../vts/functional/VtsHalTvInputTargetTest.h | 90 ++++++ 3 files changed, 415 insertions(+) create mode 100644 tv/input/aidl/vts/functional/Android.bp create mode 100644 tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp create mode 100644 tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.h diff --git a/tv/input/aidl/vts/functional/Android.bp b/tv/input/aidl/vts/functional/Android.bp new file mode 100644 index 0000000000..9829b6d679 --- /dev/null +++ b/tv/input/aidl/vts/functional/Android.bp @@ -0,0 +1,29 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_test { + name: "VtsHalTvInputTargetTest", + defaults: ["VtsHalTargetTestDefaults","use_libaidlvintf_gtest_helper_static",], + srcs: ["VtsHalTvInputTargetTest.cpp"], + static_libs: [ + "android.hardware.tv.input-V1-ndk", + "android.media.audio.common.types-V1-ndk", + "android.hardware.common-V2-ndk", + "libaidlcommonsupport", + ], + test_suites: [ + "general-tests", + "vts", + ], + shared_libs: [ + "libbinder_ndk", + "libvndksupport", + ], + require_root: true, +} diff --git a/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp new file mode 100644 index 0000000000..ec83e29bfd --- /dev/null +++ b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp @@ -0,0 +1,296 @@ +/* + * Copyright 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. + */ + +#include "VtsHalTvInputTargetTest.h" + +#include +#include +#include +#include + +using namespace VtsHalTvInputTargetTest; + +TvInputAidlTest::TvInputCallback::TvInputCallback(shared_ptr parent) + : parent_(parent) {} + +::ndk::ScopedAStatus TvInputAidlTest::TvInputCallback::notify(const TvInputEvent& in_event) { + unique_lock lock(parent_->mutex_); + + switch (in_event.type) { + case TvInputEventType::DEVICE_AVAILABLE: + parent_->onDeviceAvailable(in_event.deviceInfo); + break; + case TvInputEventType::DEVICE_UNAVAILABLE: + parent_->onDeviceUnavailable(in_event.deviceInfo.deviceId); + break; + case TvInputEventType::STREAM_CONFIGURATIONS_CHANGED: + parent_->onStreamConfigurationsChanged(in_event.deviceInfo.deviceId); + break; + } + return ::ndk::ScopedAStatus::ok(); +} + +void TvInputAidlTest::SetUp() { + if (AServiceManager_isDeclared(GetParam().c_str())) { + ::ndk::SpAIBinder binder(AServiceManager_waitForService(GetParam().c_str())); + tv_input_ = ITvInput::fromBinder(binder); + } else { + tv_input_ = nullptr; + } + ASSERT_NE(tv_input_, nullptr); + + tv_input_callback_ = + ::ndk::SharedRefBase::make(shared_ptr(this)); + ASSERT_NE(tv_input_callback_, nullptr); + + tv_input_->setCallback(tv_input_callback_); + // All events received within the timeout should be handled. + sleep(WAIT_FOR_EVENT_TIMEOUT); +} + +void TvInputAidlTest::TearDown() { + tv_input_ = nullptr; +} + +void TvInputAidlTest::onDeviceAvailable(const TvInputDeviceInfo& deviceInfo) { + ALOGD("onDeviceAvailable for device id %d", deviceInfo.deviceId); + device_info_.add(deviceInfo.deviceId, deviceInfo); +} + +void TvInputAidlTest::onDeviceUnavailable(int32_t deviceId) { + ALOGD("onDeviceUnavailable for device id %d", deviceId); + device_info_.removeItem(deviceId); + stream_config_.removeItem(deviceId); +} + +::ndk::ScopedAStatus TvInputAidlTest::onStreamConfigurationsChanged(int32_t deviceId) { + ALOGD("onStreamConfigurationsChanged for device id %d", deviceId); + return updateStreamConfigurations(deviceId); +} + +::ndk::ScopedAStatus TvInputAidlTest::updateStreamConfigurations(int32_t deviceId) { + stream_config_.removeItem(deviceId); + vector list; + ::ndk::ScopedAStatus status = tv_input_->getStreamConfigurations(deviceId, &list); + if (status.isOk()) { + stream_config_.add(deviceId, list); + } + return status; +} + +void TvInputAidlTest::updateAllStreamConfigurations() { + for (size_t i = 0; i < device_info_.size(); i++) { + int32_t device_id = device_info_.keyAt(i); + updateStreamConfigurations(device_id); + } +} + +vector TvInputAidlTest::getConfigIndices() { + vector indices; + for (size_t i = 0; i < stream_config_.size(); i++) { + if (stream_config_.valueAt(i).size() != 0) { + indices.push_back(i); + } + } + return indices; +} + +int32_t TvInputAidlTest::getNumNotIn(vector& nums) { + int32_t result = DEFAULT_ID; + int32_t size = static_cast(nums.size()); + for (int32_t i = 0; i < size; i++) { + // Put every element to its target position, if possible. + int32_t target_pos = nums[i]; + while (target_pos >= 0 && target_pos < size && i != target_pos && + nums[i] != nums[target_pos]) { + swap(nums[i], nums[target_pos]); + target_pos = nums[i]; + } + } + + for (int32_t i = 0; i < size; i++) { + if (nums[i] != i) { + return i; + } + } + return result; +} + +/* + * GetStreamConfigTest: + * Calls updateStreamConfigurations() for each existing device + * Checks returned results + */ +TEST_P(TvInputAidlTest, GetStreamConfigTest) { + unique_lock lock(mutex_); + + for (size_t i = 0; i < device_info_.size(); i++) { + int32_t device_id = device_info_.keyAt(i); + ALOGD("GetStreamConfigTest: device_id=%d", device_id); + ASSERT_TRUE(updateStreamConfigurations(device_id).isOk()); + } +} + +/* + * OpenAndCloseStreamTest: + * Calls openStream() and then closeStream() for each existing stream + * Checks returned results + */ +TEST_P(TvInputAidlTest, OpenAndCloseStreamTest) { + unique_lock lock(mutex_); + + updateAllStreamConfigurations(); + + for (size_t j = 0; j < stream_config_.size(); j++) { + int32_t device_id = stream_config_.keyAt(j); + vector config = stream_config_.valueAt(j); + for (size_t i = 0; i < config.size(); i++) { + int32_t stream_id = config[i].streamId; + ALOGD("OpenAndCloseStreamTest: open stream, device_id=%d, stream_id=%d", device_id, + stream_id); + ASSERT_TRUE(tv_input_->openStream(device_id, stream_id, &handle_).isOk()); + ALOGD("OpenAndCloseStreamTest: close stream, device_id=%d, stream_id=%d", device_id, + stream_id); + ASSERT_TRUE(tv_input_->closeStream(device_id, stream_id).isOk()); + } + } +} + +/* + * InvalidDeviceIdTest: + * Calls updateStreamConfigurations(), openStream(), and closeStream() + * for a non-existing device + * Checks returned results + * The results should be ITvInput::STATUS_INVALID_ARGUMENTS + */ +TEST_P(TvInputAidlTest, InvalidDeviceIdTest) { + unique_lock lock(mutex_); + + vector device_ids; + for (size_t i = 0; i < device_info_.size(); i++) { + device_ids.push_back(device_info_.keyAt(i)); + } + // Get a non-existing device ID. + int32_t id = getNumNotIn(device_ids); + ALOGD("InvalidDeviceIdTest: update stream config, device_id=%d", id); + ASSERT_TRUE(updateStreamConfigurations(id).getServiceSpecificError() == + ITvInput::STATUS_INVALID_ARGUMENTS); + + int32_t stream_id = 0; + + ALOGD("InvalidDeviceIdTest: open stream, device_id=%d, stream_id=%d", id, stream_id); + ASSERT_TRUE(tv_input_->openStream(id, stream_id, &handle_).getServiceSpecificError() == + ITvInput::STATUS_INVALID_ARGUMENTS); + + ALOGD("InvalidDeviceIdTest: close stream, device_id=%d, stream_id=%d", id, stream_id); + ASSERT_TRUE(tv_input_->closeStream(id, stream_id).getServiceSpecificError() == + ITvInput::STATUS_INVALID_ARGUMENTS); +} + +/* + * InvalidStreamIdTest: + * Calls openStream(), and closeStream() for a non-existing stream + * Checks returned results + * The results should be ITvInput::STATUS_INVALID_ARGUMENTS + */ +TEST_P(TvInputAidlTest, InvalidStreamIdTest) { + unique_lock lock(mutex_); + + if (device_info_.isEmpty()) { + return; + } + updateAllStreamConfigurations(); + + int32_t device_id = device_info_.keyAt(0); + // Get a non-existing stream ID. + int32_t id = DEFAULT_ID; + if (stream_config_.indexOfKey(device_id) >= 0) { + vector stream_ids; + vector config = stream_config_.valueFor(device_id); + for (size_t i = 0; i < config.size(); i++) { + stream_ids.push_back(config[i].streamId); + } + id = getNumNotIn(stream_ids); + } + + ALOGD("InvalidStreamIdTest: open stream, device_id=%d, stream_id=%d", device_id, id); + ASSERT_TRUE(tv_input_->openStream(device_id, id, &handle_).getServiceSpecificError() == + ITvInput::STATUS_INVALID_ARGUMENTS); + + ALOGD("InvalidStreamIdTest: close stream, device_id=%d, stream_id=%d", device_id, id); + ASSERT_TRUE(tv_input_->closeStream(device_id, id).getServiceSpecificError() == + ITvInput::STATUS_INVALID_ARGUMENTS); +} + +/* + * OpenAnOpenedStreamsTest: + * Calls openStream() twice for a stream (if any) + * Checks returned results + * The result of the second call should be ITvInput::STATUS_INVALID_STATE + */ +TEST_P(TvInputAidlTest, OpenAnOpenedStreamsTest) { + unique_lock lock(mutex_); + + updateAllStreamConfigurations(); + vector indices = getConfigIndices(); + if (indices.empty()) { + return; + } + int32_t device_id = stream_config_.keyAt(indices[0]); + int32_t stream_id = stream_config_.valueAt(indices[0])[0].streamId; + + ALOGD("OpenAnOpenedStreamsTest: open stream, device_id=%d, stream_id=%d", device_id, stream_id); + ASSERT_TRUE(tv_input_->openStream(device_id, stream_id, &handle_).isOk()); + + ALOGD("OpenAnOpenedStreamsTest: open stream, device_id=%d, stream_id=%d", device_id, stream_id); + ASSERT_TRUE(tv_input_->openStream(device_id, stream_id, &handle_).getServiceSpecificError() == + ITvInput::STATUS_INVALID_STATE); + + // close stream as subsequent tests assume no open streams + ALOGD("OpenAnOpenedStreamsTest: close stream, device_id=%d, stream_id=%d", device_id, + stream_id); + ASSERT_TRUE(tv_input_->closeStream(device_id, stream_id).isOk()); +} + +/* + * CloseStreamBeforeOpenTest: + * Calls closeStream() without calling openStream() for a stream (if any) + * Checks the returned result + * The result should be ITvInput::STATUS_INVALID_STATE + */ +TEST_P(TvInputAidlTest, CloseStreamBeforeOpenTest) { + unique_lock lock(mutex_); + + updateAllStreamConfigurations(); + vector indices = getConfigIndices(); + if (indices.empty()) { + return; + } + int32_t device_id = stream_config_.keyAt(indices[0]); + int32_t stream_id = stream_config_.valueAt(indices[0])[0].streamId; + + ALOGD("CloseStreamBeforeOpenTest: close stream, device_id=%d, stream_id=%d", device_id, + stream_id); + ASSERT_TRUE(tv_input_->closeStream(device_id, stream_id).getServiceSpecificError() == + ITvInput::STATUS_INVALID_STATE); +} + +INSTANTIATE_TEST_SUITE_P(PerInstance, TvInputAidlTest, + testing::ValuesIn(android::getAidlHalInstanceNames(ITvInput::descriptor)), + android::PrintInstanceNameToString); + +// TODO remove from the allow list once the cf tv target is enabled for testing +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TvInputAidlTest); diff --git a/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.h b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.h new file mode 100644 index 0000000000..c76e5686fc --- /dev/null +++ b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.h @@ -0,0 +1,90 @@ +/* + * Copyright 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. + */ + +#pragma once + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +using namespace aidl::android::hardware::tv::input; +using namespace std; + +using ::aidl::android::hardware::common::NativeHandle; + +#define WAIT_FOR_EVENT_TIMEOUT 5 +#define DEFAULT_ID INT32_MIN + +namespace VtsHalTvInputTargetTest { + +class TvInputAidlTest : public testing::TestWithParam { + public: + class TvInputCallback : public BnTvInputCallback { + public: + TvInputCallback(shared_ptr parent); + ::ndk::ScopedAStatus notify(const TvInputEvent& in_event) override; + + private: + shared_ptr parent_; + }; + + virtual void SetUp() override; + virtual void TearDown() override; + + /* Called when a DEVICE_AVAILABLE event is received. */ + void onDeviceAvailable(const TvInputDeviceInfo& deviceInfo); + + /* Called when a DEVICE_UNAVAILABLE event is received. */ + void onDeviceUnavailable(int32_t deviceId); + + /* Called when a STREAM_CONFIGURATIONS_CHANGED event is received. */ + ::ndk::ScopedAStatus onStreamConfigurationsChanged(int32_t deviceId); + + /* Gets and updates the stream configurations for a device. */ + ::ndk::ScopedAStatus updateStreamConfigurations(int32_t deviceId); + + /* Gets and updates the stream configurations for all existing devices. */ + void updateAllStreamConfigurations(); + + /* Returns a list of indices of stream_config_ whose corresponding values are not empty. */ + vector getConfigIndices(); + + /* + * Returns DEFAULT_ID if there is no missing integer in the range [0, the size of nums). + * Otherwise, returns the smallest missing non-negative integer. + */ + int32_t getNumNotIn(vector& nums); + + protected: + shared_ptr tv_input_; + shared_ptr tv_input_callback_; + android::KeyedVector device_info_; + android::KeyedVector> stream_config_; + mutex mutex_; + NativeHandle handle_; +}; + +} // namespace VtsHalTvInputTargetTest From bf94fa32cb652cd8567f0edc037243c3ee1d413e Mon Sep 17 00:00:00 2001 From: Lorena Torres-Huerta Date: Fri, 12 Aug 2022 23:08:10 +0000 Subject: [PATCH 225/998] Add AudioAttributes and AudioFlag for use in HAL interface for engine configuration. This requires a version bump to android.media.audio.common.types. cc_defaults and java_defaults are used in order to avoid explicitly updating version references in several Android.bp files when we do future version bumps. Bug: 242678729 Test: m Change-Id: Id17820f210f625e370992db4f9f85e37887b088b --- audio/aidl/Android.bp | 45 +++++++++++++++++-- audio/aidl/default/Android.bp | 14 ++++-- audio/aidl/vts/Android.bp | 6 +-- .../all-versions/vts/functional/Android.bp | 30 ++++++++----- soundtrigger/aidl/Android.bp | 18 +++++++- 5 files changed, 91 insertions(+), 22 deletions(-) diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index 440422ef26..788a0b1b8e 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -33,7 +33,7 @@ aidl_interface { "android/hardware/audio/common/SourceMetadata.aidl", ], imports: [ - "android.media.audio.common.types-V1", + "android.media.audio.common.types", ], stability: "vintf", backend: { @@ -61,10 +61,25 @@ aidl_interface { version: "1", imports: ["android.media.audio.common.types-V1"], }, + // IMPORTANT: Update latest_android_hardware_audio_common every time you + // add the latest frozen version to versions_with_info ], } +// Note: This should always be one version ahead of the last frozen version +latest_android_hardware_audio_common = "android.hardware.audio.common-V2" + +// Modules that depend on android.hardware.audio.common directly can include +// the following cc_defaults to avoid explicitly managing dependency versions +// across many scattered files. +cc_defaults { + name: "latest_android_hardware_audio_common_ndk_static", + static_libs: [ + latest_android_hardware_audio_common + "-ndk", + ], +} + aidl_interface { name: "android.hardware.audio.core", vendor_available: true, @@ -80,10 +95,10 @@ aidl_interface { "android/hardware/audio/core/StreamDescriptor.aidl", ], imports: [ - "android.hardware.audio.common-V1", "android.hardware.common-V2", "android.hardware.common.fmq-V1", - "android.media.audio.common.types-V1", + "android.hardware.audio.common", + "android.media.audio.common.types", ], stability: "vintf", backend: { @@ -95,4 +110,28 @@ aidl_interface { sdk_version: "module_current", }, }, + versions_with_info: [ + // IMPORTANT: Update latest_android_hardware_audio_core every time you + // add the latest frozen version to versions_with_info + ], +} + +// Note: This should always be one version ahead of the last frozen version +latest_android_hardware_audio_core = "android.hardware.audio.core-V1" + +// Modules that depend on android.hardware.audio.core directly can include +// the following cc_defaults to avoid explicitly managing dependency versions +// across many scattered files. +cc_defaults { + name: "latest_android_hardware_audio_core_ndk_shared", + shared_libs: [ + latest_android_hardware_audio_core + "-ndk", + ], +} + +cc_defaults { + name: "latest_android_hardware_audio_core_ndk_static", + static_libs: [ + latest_android_hardware_audio_core + "-ndk", + ], } diff --git a/audio/aidl/default/Android.bp b/audio/aidl/default/Android.bp index 03f8c64a6a..ebbfbab1e5 100644 --- a/audio/aidl/default/Android.bp +++ b/audio/aidl/default/Android.bp @@ -18,8 +18,6 @@ cc_defaults { "libfmq", "libstagefright_foundation", "libutils", - "android.media.audio.common.types-V1-ndk", - "android.hardware.audio.core-V1-ndk", "android.hardware.common-V2-ndk", "android.hardware.common.fmq-V1-ndk", ], @@ -27,7 +25,11 @@ cc_defaults { cc_library_static { name: "libaudioserviceexampleimpl", - defaults: ["aidlaudioservice_defaults"], + defaults: [ + "aidlaudioservice_defaults", + "latest_android_media_audio_common_types_ndk_shared", + "latest_android_hardware_audio_core_ndk_shared", + ], export_include_dirs: ["include"], srcs: [ "Config.cpp", @@ -45,7 +47,11 @@ cc_binary { relative_install_path: "hw", init_rc: ["android.hardware.audio.service-aidl.example.rc"], vintf_fragments: ["android.hardware.audio.service-aidl.xml"], - defaults: ["aidlaudioservice_defaults"], + defaults: [ + "aidlaudioservice_defaults", + "latest_android_media_audio_common_types_ndk_shared", + "latest_android_hardware_audio_core_ndk_shared", + ], static_libs: [ "libaudioserviceexampleimpl", ], diff --git a/audio/aidl/vts/Android.bp b/audio/aidl/vts/Android.bp index 7b35133cfe..d3fafa0d16 100644 --- a/audio/aidl/vts/Android.bp +++ b/audio/aidl/vts/Android.bp @@ -12,6 +12,9 @@ cc_test { defaults: [ "VtsHalTargetTestDefaults", "use_libaidlvintf_gtest_helper_static", + "latest_android_hardware_audio_common_ndk_static", + "latest_android_hardware_audio_core_ndk_static", + "latest_android_media_audio_common_types_ndk_static", ], shared_libs: [ "libbinder_ndk", @@ -19,11 +22,8 @@ cc_test { "libfmq", ], static_libs: [ - "android.hardware.audio.common-V1-ndk", - "android.hardware.audio.core-V1-ndk", "android.hardware.common-V2-ndk", "android.hardware.common.fmq-V1-ndk", - "android.media.audio.common.types-V1-ndk", "libaudioaidlcommon", ], cflags: [ diff --git a/audio/core/all-versions/vts/functional/Android.bp b/audio/core/all-versions/vts/functional/Android.bp index daed7a8afd..f51a8d02af 100644 --- a/audio/core/all-versions/vts/functional/Android.bp +++ b/audio/core/all-versions/vts/functional/Android.bp @@ -49,7 +49,10 @@ cc_defaults { cc_test { name: "VtsHalAudioV2_0TargetTest", - defaults: ["VtsHalAudioTargetTest_defaults"], + defaults: [ + "VtsHalAudioTargetTest_defaults", + "latest_android_media_audio_common_types_cpp_static", + ], tidy_timeout_srcs: [ "2.0/AudioPrimaryHidlHalTest.cpp", ], @@ -62,7 +65,6 @@ cc_test { "libmedia_helper", "android.hardware.audio@2.0", "android.hardware.audio.common@2.0", - "android.media.audio.common.types-V1-cpp", ], cflags: [ "-DMAJOR_VERSION=2", @@ -79,7 +81,10 @@ cc_test { cc_test { name: "VtsHalAudioV4_0TargetTest", - defaults: ["VtsHalAudioTargetTest_defaults"], + defaults: [ + "VtsHalAudioTargetTest_defaults", + "latest_android_media_audio_common_types_cpp_static", + ], tidy_timeout_srcs: [ "4.0/AudioPrimaryHidlHalTest.cpp", ], @@ -92,7 +97,6 @@ cc_test { "libmedia_helper", "android.hardware.audio@4.0", "android.hardware.audio.common@4.0", - "android.media.audio.common.types-V1-cpp", ], cflags: [ "-DMAJOR_VERSION=4", @@ -109,7 +113,10 @@ cc_test { cc_test { name: "VtsHalAudioV5_0TargetTest", - defaults: ["VtsHalAudioTargetTest_defaults"], + defaults: [ + "VtsHalAudioTargetTest_defaults", + "latest_android_media_audio_common_types_cpp_static", + ], srcs: [ "5.0/AudioPrimaryHidlHalTest.cpp", ], @@ -119,7 +126,6 @@ cc_test { "libmedia_helper", "android.hardware.audio@5.0", "android.hardware.audio.common@5.0", - "android.media.audio.common.types-V1-cpp", ], cflags: [ "-DMAJOR_VERSION=5", @@ -136,7 +142,10 @@ cc_test { cc_test { name: "VtsHalAudioV6_0TargetTest", - defaults: ["VtsHalAudioTargetTest_defaults"], + defaults: [ + "VtsHalAudioTargetTest_defaults", + "latest_android_media_audio_common_types_cpp_static", + ], tidy_timeout_srcs: [ "6.0/AudioPrimaryHidlHalTest.cpp", ], @@ -150,7 +159,6 @@ cc_test { "libmedia_helper", "android.hardware.audio@6.0", "android.hardware.audio.common@6.0", - "android.media.audio.common.types-V1-cpp", ], cflags: [ "-DMAJOR_VERSION=6", @@ -244,7 +252,10 @@ cc_test { cc_test { name: "HalAudioV6_0GeneratorTest", - defaults: ["VtsHalAudioTargetTest_defaults"], + defaults: [ + "VtsHalAudioTargetTest_defaults", + "latest_android_media_audio_common_types_cpp_static", + ], srcs: [ "6.0/Generators.cpp", "tests/generators_tests.cpp", @@ -252,7 +263,6 @@ cc_test { static_libs: [ "android.hardware.audio@6.0", "android.hardware.audio.common@6.0", - "android.media.audio.common.types-V1-cpp", "libaudiofoundation", "libaudiopolicycomponents", "libmedia_helper", diff --git a/soundtrigger/aidl/Android.bp b/soundtrigger/aidl/Android.bp index 0658519bd9..426bf48e2f 100644 --- a/soundtrigger/aidl/Android.bp +++ b/soundtrigger/aidl/Android.bp @@ -23,7 +23,7 @@ aidl_interface { ], stability: "vintf", imports: [ - "android.media.soundtrigger.types-V1", + "android.media.soundtrigger.types", ], backend: { cpp: { @@ -39,6 +39,20 @@ aidl_interface { version: "1", imports: ["android.media.soundtrigger.types-V1"], }, + // IMPORTANT: Update latest_android_hardware_soundtrigger3 every time + // you add the latest frozen version to versions_with_info + ], +} + +// Note: This should always be one version ahead of the last frozen version +latest_android_hardware_soundtrigger3 = "android.hardware.soundtrigger3-V2" + +// Modules that depend on android.hardware.soundtrigger3 directly can include +// the following java_defaults to avoid explicitly managing dependency versions +// across many scattered files. +java_defaults { + name: "latest_android_hardware_soundtrigger3_java_static", + static_libs: [ + latest_android_hardware_soundtrigger3 + "-java", ], - } From af78e0ad80ae673aa802c51819aaf1f06e7940a7 Mon Sep 17 00:00:00 2001 From: Patrick Williams Date: Tue, 16 Aug 2022 22:20:43 +0000 Subject: [PATCH 226/998] Replace RenderEngineResult with FenceResult Bug: b/232535621 Test: refactor, existing tests pass Change-Id: I86fe498246e45d199a47008a3fb90af3030e83d6 --- .../composer/2.2/utils/vts/RenderEngineVts.cpp | 14 ++++++-------- graphics/composer/aidl/vts/RenderEngineVts.cpp | 14 ++++++-------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp b/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp index 4a33fb5b42..1700b2ade9 100644 --- a/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp +++ b/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp @@ -71,14 +71,12 @@ void TestRenderEngine::drawLayers() { }); auto texture = std::make_shared( mGraphicBuffer, *mRenderEngine, renderengine::impl::ExternalTexture::Usage::WRITEABLE); - auto [status, readyFence] = mRenderEngine - ->drawLayers(mDisplaySettings, compositionLayers, texture, - true, std::move(bufferFence)) - .get(); - int fd = readyFence.release(); - if (fd != -1) { - ASSERT_EQ(0, sync_wait(fd, -1)); - ASSERT_EQ(0, close(fd)); + auto result = mRenderEngine + ->drawLayers(mDisplaySettings, compositionLayers, texture, true, + std::move(bufferFence)) + .get(); + if (result.ok()) { + result.value()->waitForever(LOG_TAG); } } diff --git a/graphics/composer/aidl/vts/RenderEngineVts.cpp b/graphics/composer/aidl/vts/RenderEngineVts.cpp index 71b011cb12..66779c8cad 100644 --- a/graphics/composer/aidl/vts/RenderEngineVts.cpp +++ b/graphics/composer/aidl/vts/RenderEngineVts.cpp @@ -66,14 +66,12 @@ void TestRenderEngine::drawLayers() { auto texture = std::make_shared<::android::renderengine::impl::ExternalTexture>( mGraphicBuffer, *mRenderEngine, ::android::renderengine::impl::ExternalTexture::Usage::WRITEABLE); - auto [status, readyFence] = mRenderEngine - ->drawLayers(mDisplaySettings, compositionLayers, texture, - true, std::move(bufferFence)) - .get(); - int fd = readyFence.release(); - if (fd != -1) { - ASSERT_EQ(0, sync_wait(fd, -1)); - ASSERT_EQ(0, close(fd)); + auto result = mRenderEngine + ->drawLayers(mDisplaySettings, compositionLayers, texture, true, + std::move(bufferFence)) + .get(); + if (result.ok()) { + result.value()->waitForever(LOG_TAG); } } From c7763e42bf2d653d23922da924bed2712793cfb7 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Tue, 23 Aug 2022 18:01:59 -0700 Subject: [PATCH 227/998] Update GsrComplianceRequirementType. Update the name according to Car Service definition. Test: m android.hardware.automotive.vehicle-update-api Bug: 237005566 Change-Id: Idbc24b7b9e8b5d697d0921b79f5b903345f2cc7e --- .../automotive/vehicle/GsrComplianceRequirementType.aidl | 2 +- .../automotive/vehicle/GsrComplianceRequirementType.aidl | 5 +++-- .../aidl/impl/default_config/config/DefaultProperties.json | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl index 0d3a061a56..9c565ee818 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl @@ -35,5 +35,5 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum GsrComplianceRequirementType { GSR_COMPLIANCE_NOT_REQUIRED = 0, - GSR_COMPLIANCE_REQUIRED_THROUGH_SYSTEM_IMAGE = 1, + GSR_COMPLIANCE_REQUIRED_V1 = 1, } diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl index e0609d5427..fb3ca9fcd4 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl @@ -27,8 +27,9 @@ enum GsrComplianceRequirementType { * GSR compliance is not required. */ GSR_COMPLIANCE_NOT_REQUIRED = 0, + /** - * GSR compliance is required through system image. + * GSR compliance is required and the requirement solution version is 1. */ - GSR_COMPLIANCE_REQUIRED_THROUGH_SYSTEM_IMAGE = 1, + GSR_COMPLIANCE_REQUIRED_V1 = 1, } diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 137cb99a02..36b2200257 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2253,7 +2253,7 @@ "property": "VehicleProperty::GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT", "defaultValue": { "int32Values": [ - "GsrComplianceRequirementType::GSR_COMPLIANCE_REQUIRED_THROUGH_SYSTEM_IMAGE" + "GsrComplianceRequirementType::GSR_COMPLIANCE_REQUIRED_V1" ] } } From 47f2e5871d71b8c45f6eedc546caec5149cb1017 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Tue, 23 Aug 2022 18:13:49 -0700 Subject: [PATCH 228/998] Define SUPPORTED_PROPERTY_IDS. This property is only used for HIDL interface to workaround getAllPropConfigs result is too large and exceeds binder limitation. We cannot change HIDL interface so we add this property to AIDL interface and mark it as deprecated. Test: m android.hardware.automotive.vehicle-update-api python tools/generate_annotation_enums.py Bug: 243449202 Change-Id: Id6058b207a3b117013c2caf4cfd1744950222c41 --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 24 +++++++++++++++++++ .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 3 ++- .../java/ChangeModeForVehicleProperty.java | 3 ++- 6 files changed, 31 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 2d0cde5bb9..64c7ce7d0a 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -207,4 +207,5 @@ enum VehicleProperty { TRAILER_PRESENT = 289410885, VEHICLE_CURB_WEIGHT = 289410886, GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT = 289410887, + SUPPORTED_PROPERTY_IDS = 289476424, } diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 1cf8aff6a5..3e5e9e8ce4 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -2853,4 +2853,28 @@ enum VehicleProperty { GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT = 0x0F47 + 0x10000000 + 0x01000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * (Deprecated) List of all supported property IDs. + * + * A list of all supported property IDs (including this property). This property is required for + * HIDL VHAL to work with large amount of vehicle prop configs where the getAllPropConfigs + * payload exceeds the binder limitation. This issue is fixed in AIDL version using + * LargeParcelable in getAllPropConfigs, so this property is deprecated. + * + * In HIDL VHAL implementation, if the amount of data returned in getAllPropConfigs exceeds the + * binder limitation, vendor must support this property and return all the supported property + * IDs. Car service will divide this list into smaller sub lists and use getPropConfigs([ids]) + * to query the sub lists. The results will be merged together in Car Service. + * + * The config array for this property must contain one int element which is the number of + * configs per getPropConfigs request by Car Service. This number must be small enough so that + * each getPropConfigs payload will not exceed binder limitation, however, a smaller number will + * cause more requests, which increase overhead to fetch all the configs. + * + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ + */ + SUPPORTED_PROPERTY_IDS = 0x0F48 + 0x10000000 + 0x01000000 + + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC + } diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 14a694d565..c91afe2199 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -207,6 +207,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::TRAILER_PRESENT, VehiclePropertyAccess::READ}, {VehicleProperty::VEHICLE_CURB_WEIGHT, VehiclePropertyAccess::READ}, {VehicleProperty::GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyAccess::READ}, + {VehicleProperty::SUPPORTED_PROPERTY_IDS, VehiclePropertyAccess::READ}, }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index c0416af1bc..807be5dcb1 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -207,6 +207,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::TRAILER_PRESENT, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::VEHICLE_CURB_WEIGHT, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::SUPPORTED_PROPERTY_IDS, VehiclePropertyChangeMode::STATIC}, }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 0a17ba196d..e698f84265 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -198,7 +198,8 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.EV_REGENERATIVE_BRAKING_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.TRAILER_PRESENT, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.VEHICLE_CURB_WEIGHT, VehiclePropertyAccess.READ), - Map.entry(VehicleProperty.GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyAccess.READ) + Map.entry(VehicleProperty.GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.SUPPORTED_PROPERTY_IDS, VehiclePropertyAccess.READ) ); } diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 5dfcd22d02..fe69450cb4 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -198,7 +198,8 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.EV_REGENERATIVE_BRAKING_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.TRAILER_PRESENT, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.VEHICLE_CURB_WEIGHT, VehiclePropertyChangeMode.STATIC), - Map.entry(VehicleProperty.GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyChangeMode.STATIC) + Map.entry(VehicleProperty.GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.SUPPORTED_PROPERTY_IDS, VehiclePropertyChangeMode.STATIC) ); } From ee301e5d50db9220e0178f737b75741be06e0b0a Mon Sep 17 00:00:00 2001 From: Lucas Gates Date: Thu, 25 Aug 2022 01:43:05 +0000 Subject: [PATCH 229/998] Tuner HAL Remove Outdated Filter Buffer Comment The filter BUFFER_SIZE parameter currently contains a comment stating that changing its size may cause sudden crashes due to problems with memory management. This problem has since been found and solved. Since the buffer size is no longer a likely source of errors, this comment should be removed. Test: Comment only change Bug: 236847284 introduced this comment, 239741712 covered the real root cause Change-Id: I9344d136c7220f54d8c66dd4f4da68890b841886 --- tv/tuner/aidl/default/Filter.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tv/tuner/aidl/default/Filter.h b/tv/tuner/aidl/default/Filter.h index b638f0c3e7..f2d9248b68 100644 --- a/tv/tuner/aidl/default/Filter.h +++ b/tv/tuner/aidl/default/Filter.h @@ -50,8 +50,7 @@ using ::android::AidlMessageQueue; using ::android::hardware::EventFlag; using FilterMQ = AidlMessageQueue; -// Large buffer size can lead to sudden crashes due to being de-allocated -// by the memory management system. Change the buffer size when needed. + const uint32_t BUFFER_SIZE = 0x800000; // 8 MB class Demux; From 8ddf43678e14bf3e0915b990f4108c500882c500 Mon Sep 17 00:00:00 2001 From: seanhong Date: Tue, 23 Aug 2022 23:46:48 +0000 Subject: [PATCH 230/998] Add interior light switch properties to DefaultProperties.json for CTS tests Test: atest CarPropertyManagerTest Bug: 242740101 Change-Id: I0efa0622d6a24d2ef6873b04f65fe82a76326c11 --- .../JsonConfigLoader/src/JsonConfigLoader.cpp | 1 + .../config/DefaultProperties.json | 33 +++++++++++++++++++ .../impl/utils/common/include/PropertyUtils.h | 1 + 3 files changed, 35 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index e6b7d14c2d..e4f13e8dc3 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -105,6 +105,7 @@ const std::unordered_map CONSTANTS_BY_NAME = { FAN_DIRECTION_FLOOR | FAN_DIRECTION_DEFROST | FAN_DIRECTION_FACE}, {"FUEL_DOOR_REAR_LEFT", FUEL_DOOR_REAR_LEFT}, {"LIGHT_STATE_ON", LIGHT_STATE_ON}, + {"LIGHT_SWITCH_OFF", LIGHT_SWITCH_OFF}, {"LIGHT_SWITCH_AUTO", LIGHT_SWITCH_AUTO}, {"MIRROR_DRIVER_LEFT_RIGHT", toInt(VehicleAreaMirror::DRIVER_LEFT) | toInt(VehicleAreaMirror::DRIVER_RIGHT)}, diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 3faeb41666..d1a61f8fbd 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2254,6 +2254,39 @@ ] } }, + { + "property": "VehicleProperty::CABIN_LIGHTS_SWITCH", + "defaultValue": { + "int32Values": [ + "Constants::LIGHT_SWITCH_OFF" + ] + } + }, + { + "property": "VehicleProperty::READING_LIGHTS_SWITCH", + "defaultValue": { + "int32Values": [ + "Constants::LIGHT_SWITCH_OFF" + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" + } + ] + }, { "property": "VehicleProperty::EVS_SERVICE_REQUEST", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h b/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h index 2743578df1..caf17e8045 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h @@ -96,6 +96,7 @@ constexpr int FUEL_DOOR_REAR_LEFT = toInt(propertyutils_impl::PortLocationType:: constexpr int CHARGE_PORT_FRONT_LEFT = toInt(propertyutils_impl::PortLocationType::FRONT_LEFT); constexpr int CHARGE_PORT_REAR_LEFT = toInt(propertyutils_impl::PortLocationType::REAR_LEFT); constexpr int LIGHT_STATE_ON = toInt(propertyutils_impl::VehicleLightState::ON); +constexpr int LIGHT_SWITCH_OFF = toInt(propertyutils_impl::VehicleLightSwitch::OFF); constexpr int LIGHT_SWITCH_AUTO = toInt(propertyutils_impl::VehicleLightSwitch::AUTOMATIC); constexpr int WHEEL_FRONT_LEFT = toInt(propertyutils_impl::VehicleAreaWheel::LEFT_FRONT); constexpr int WHEEL_FRONT_RIGHT = toInt(propertyutils_impl::VehicleAreaWheel::RIGHT_FRONT); From 784c253a05ef77aefd5ddaa4885621e85da76ef4 Mon Sep 17 00:00:00 2001 From: Sally Qi Date: Mon, 22 Aug 2022 13:50:32 -0700 Subject: [PATCH 231/998] Add cc_defaults as wrapper for graphics composer/common AIDL interfaces. - Add new Android.bp in graphics folder and wrap composer and common AIDL in to separate cc_defaults. - remove composer3 dependency from allocator's VTS .bp file. Bug: 243429120 Test: builds Change-Id: Ia91e4ab87b7ac86248094317185b317d5604e654 --- automotive/evs/aidl/impl/Android.bp | 2 +- automotive/evs/aidl/vts/Android.bp | 2 +- camera/provider/aidl/vts/Android.bp | 2 +- graphics/Android.bp | 45 +++++++++++++++++++ graphics/allocator/aidl/vts/Android.bp | 1 - graphics/composer/2.2/utils/vts/Android.bp | 6 ++- .../composer/2.2/vts/functional/Android.bp | 2 +- graphics/composer/aidl/Android.bp | 4 +- graphics/composer/aidl/vts/Android.bp | 4 +- graphics/mapper/4.0/utils/vts/Android.bp | 6 ++- graphics/mapper/4.0/vts/functional/Android.bp | 2 +- neuralnetworks/aidl/utils/Android.bp | 8 ++-- sensors/common/vts/utils/Android.bp | 8 ++-- 13 files changed, 72 insertions(+), 20 deletions(-) create mode 100644 graphics/Android.bp diff --git a/automotive/evs/aidl/impl/Android.bp b/automotive/evs/aidl/impl/Android.bp index 7eb01166c3..0b51a0c1ff 100644 --- a/automotive/evs/aidl/impl/Android.bp +++ b/automotive/evs/aidl/impl/Android.bp @@ -20,10 +20,10 @@ package { cc_defaults { name: "EvsHalDefaults", + defaults: ["android.hardware.graphics.common-ndk_static"], static_libs: [ "android.hardware.automotive.evs-V1-ndk", "android.hardware.common-V2-ndk", - "android.hardware.graphics.common-V3-ndk", ], shared_libs: [ "libbase", diff --git a/automotive/evs/aidl/vts/Android.bp b/automotive/evs/aidl/vts/Android.bp index 980c6d5a5c..5aa9501883 100644 --- a/automotive/evs/aidl/vts/Android.bp +++ b/automotive/evs/aidl/vts/Android.bp @@ -31,6 +31,7 @@ name: ], defaults: [ "VtsHalTargetTestDefaults", + "android.hardware.graphics.common-ndk_static", "use_libaidlvintf_gtest_helper_static", ], shared_libs: [ @@ -43,7 +44,6 @@ name: "android.hardware.automotive.evs@common-default-lib", "android.hardware.automotive.evs-V1-ndk", "android.hardware.common-V2-ndk", - "android.hardware.graphics.common-V3-ndk", "libaidlcommonsupport", ], test_suites: [ diff --git a/camera/provider/aidl/vts/Android.bp b/camera/provider/aidl/vts/Android.bp index 727ef03e72..32da2feca6 100644 --- a/camera/provider/aidl/vts/Android.bp +++ b/camera/provider/aidl/vts/Android.bp @@ -27,6 +27,7 @@ cc_test { name: "VtsAidlHalCameraProvider_TargetTest", defaults: [ "VtsHalTargetTestDefaults", + "android.hardware.graphics.common-ndk_static", "use_libaidlvintf_gtest_helper_static", ], srcs: [ @@ -61,7 +62,6 @@ cc_test { "android.hardware.camera.device-V1-ndk", "android.hardware.camera.metadata-V1-ndk", "android.hardware.camera.provider-V1-ndk", - "android.hardware.graphics.common-V3-ndk", "android.hidl.allocator@1.0", "libgrallocusage", "libhidlmemory", diff --git a/graphics/Android.bp b/graphics/Android.bp new file mode 100644 index 0000000000..1338ee467c --- /dev/null +++ b/graphics/Android.bp @@ -0,0 +1,45 @@ +// 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. + +package { + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_defaults { + name: "android.hardware.graphics.common-ndk_static", + static_libs: [ + "android.hardware.graphics.common-V3-ndk", + ], +} + +cc_defaults { + name: "android.hardware.graphics.common-ndk_shared", + shared_libs: [ + "android.hardware.graphics.common-V3-ndk", + ], +} + +cc_defaults { + name: "android.hardware.graphics.composer3-ndk_static", + static_libs: [ + "android.hardware.graphics.composer3-V1-ndk", + ], +} + +cc_defaults { + name: "android.hardware.graphics.composer3-ndk_shared", + shared_libs: [ + "android.hardware.graphics.composer3-V1-ndk", + ], +} diff --git a/graphics/allocator/aidl/vts/Android.bp b/graphics/allocator/aidl/vts/Android.bp index 99ffb24079..974f3c8925 100644 --- a/graphics/allocator/aidl/vts/Android.bp +++ b/graphics/allocator/aidl/vts/Android.bp @@ -36,7 +36,6 @@ cc_test { shared_libs: [ "android.hardware.graphics.allocator-V1-ndk", - "android.hardware.graphics.common-V3-ndk", "android.hardware.graphics.mapper@4.0", "libEGL", "libGLESv2", diff --git a/graphics/composer/2.2/utils/vts/Android.bp b/graphics/composer/2.2/utils/vts/Android.bp index cca53230ae..bb8f2b19a4 100644 --- a/graphics/composer/2.2/utils/vts/Android.bp +++ b/graphics/composer/2.2/utils/vts/Android.bp @@ -25,7 +25,10 @@ package { cc_library_static { name: "android.hardware.graphics.composer@2.2-vts", - defaults: ["hidl_defaults"], + defaults: [ + "android.hardware.graphics.composer3-ndk_static", + "hidl_defaults", + ], srcs: [ "ComposerVts.cpp", "ReadbackVts.cpp", @@ -38,7 +41,6 @@ cc_library_static { "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.composer@2.1-vts", "android.hardware.graphics.composer@2.2", - "android.hardware.graphics.composer3-V1-ndk", "android.hardware.graphics.mapper@2.1-vts", "libarect", "libgtest", diff --git a/graphics/composer/2.2/vts/functional/Android.bp b/graphics/composer/2.2/vts/functional/Android.bp index 960b62da8a..41110e394d 100644 --- a/graphics/composer/2.2/vts/functional/Android.bp +++ b/graphics/composer/2.2/vts/functional/Android.bp @@ -27,6 +27,7 @@ cc_test { name: "VtsHalGraphicsComposerV2_2TargetTest", defaults: [ "VtsHalTargetTestDefaults", + "android.hardware.graphics.composer3-ndk_static", // Needed for librenderengine "skia_deps", ], @@ -68,7 +69,6 @@ cc_test { "android.hardware.graphics.composer@2.1-vts", "android.hardware.graphics.composer@2.2", "android.hardware.graphics.composer@2.2-vts", - "android.hardware.graphics.composer3-V1-ndk", "android.hardware.graphics.mapper@2.0-vts", "android.hardware.graphics.mapper@2.1-vts", "android.hardware.graphics.mapper@3.0-vts", diff --git a/graphics/composer/aidl/Android.bp b/graphics/composer/aidl/Android.bp index 9b88d98f9c..a5ca0a085f 100644 --- a/graphics/composer/aidl/Android.bp +++ b/graphics/composer/aidl/Android.bp @@ -67,9 +67,9 @@ aidl_interface { cc_library_headers { name: "android.hardware.graphics.composer3-command-buffer", + defaults: ["android.hardware.graphics.composer3-ndk_shared"], vendor_available: true, shared_libs: [ - "android.hardware.graphics.composer3-V1-ndk", "android.hardware.common-V2-ndk", "libbase", "libfmq", @@ -87,12 +87,12 @@ cc_library_headers { cc_test { name: "android.hardware.graphics.composer3-hidl2aidl-asserts", + defaults: ["android.hardware.graphics.composer3-ndk_shared"], vendor_available: true, srcs: ["android/hardware/graphics/composer3/Hidl2AidlAsserts.cpp"], shared_libs: [ "libbinder_ndk", "libhidlbase", - "android.hardware.graphics.composer3-V1-ndk", "android.hardware.graphics.composer@2.1", "android.hardware.graphics.composer@2.4", ], diff --git a/graphics/composer/aidl/vts/Android.bp b/graphics/composer/aidl/vts/Android.bp index 1e70a0ec45..cbd2da5fe0 100644 --- a/graphics/composer/aidl/vts/Android.bp +++ b/graphics/composer/aidl/vts/Android.bp @@ -30,6 +30,8 @@ cc_test { "use_libaidlvintf_gtest_helper_static", // Needed for librenderengine "skia_deps", + "android.hardware.graphics.common-ndk_static", + "android.hardware.graphics.composer3-ndk_static", ], srcs: [ "VtsHalGraphicsComposer3_TargetTest.cpp", @@ -67,8 +69,6 @@ cc_test { "android.hardware.graphics.composer3-command-buffer", ], static_libs: [ - "android.hardware.graphics.composer3-V1-ndk", - "android.hardware.graphics.common-V3-ndk", "android.hardware.graphics.common@1.2", "android.hardware.common-V2-ndk", "android.hardware.common.fmq-V1-ndk", diff --git a/graphics/mapper/4.0/utils/vts/Android.bp b/graphics/mapper/4.0/utils/vts/Android.bp index 7abf5dba24..fd538ae55c 100644 --- a/graphics/mapper/4.0/utils/vts/Android.bp +++ b/graphics/mapper/4.0/utils/vts/Android.bp @@ -25,7 +25,10 @@ package { cc_library_static { name: "android.hardware.graphics.mapper@4.0-vts", - defaults: ["VtsHalTargetTestDefaults"], + defaults: [ + "VtsHalTargetTestDefaults", + "android.hardware.graphics.common-ndk_static", + ], srcs: ["MapperVts.cpp"], cflags: [ "-O0", @@ -34,7 +37,6 @@ cc_library_static { static_libs: [ "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.allocator@4.0", - "android.hardware.graphics.common-V3-ndk", "android.hardware.graphics.mapper@4.0", "libaidlcommonsupport", ], diff --git a/graphics/mapper/4.0/vts/functional/Android.bp b/graphics/mapper/4.0/vts/functional/Android.bp index e83063367d..625a47961e 100644 --- a/graphics/mapper/4.0/vts/functional/Android.bp +++ b/graphics/mapper/4.0/vts/functional/Android.bp @@ -27,11 +27,11 @@ cc_test { name: "VtsHalGraphicsMapperV4_0TargetTest", defaults: [ "VtsHalTargetTestDefaults", + "android.hardware.graphics.common-ndk_static", "use_libaidlvintf_gtest_helper_static", ], srcs: ["VtsHalGraphicsMapperV4_0TargetTest.cpp"], static_libs: [ - "android.hardware.graphics.common-V3-ndk", "android.hardware.graphics.mapper@4.0-vts", "libaidlcommonsupport", "libgralloctypes", diff --git a/neuralnetworks/aidl/utils/Android.bp b/neuralnetworks/aidl/utils/Android.bp index 325809213c..f0b458a0f4 100644 --- a/neuralnetworks/aidl/utils/Android.bp +++ b/neuralnetworks/aidl/utils/Android.bp @@ -25,7 +25,10 @@ package { cc_defaults { name: "neuralnetworks_utils_hal_aidl_defaults", - defaults: ["neuralnetworks_utils_defaults"], + defaults: [ + "android.hardware.graphics.common-ndk_static", + "neuralnetworks_utils_defaults", + ], srcs: [ // AIDL utils that a driver may depend on. "src/BufferTracker.cpp", @@ -38,7 +41,6 @@ cc_defaults { export_include_dirs: ["include"], cflags: ["-Wthread-safety"], static_libs: [ - "android.hardware.graphics.common-V3-ndk", "libaidlcommonsupport", "libarect", "neuralnetworks_types", @@ -90,9 +92,9 @@ cc_library_static { // AIDL features can include this cc_defaults to avoid managing dependency versions explicitly. cc_defaults { name: "neuralnetworks_use_latest_utils_hal_aidl", + defaults: ["android.hardware.graphics.common-ndk_static"], static_libs: [ "android.hardware.common-V2-ndk", - "android.hardware.graphics.common-V3-ndk", "android.hardware.neuralnetworks-V4-ndk", "neuralnetworks_utils_hal_aidl", ], diff --git a/sensors/common/vts/utils/Android.bp b/sensors/common/vts/utils/Android.bp index 08b6afa202..ea90b0253e 100644 --- a/sensors/common/vts/utils/Android.bp +++ b/sensors/common/vts/utils/Android.bp @@ -27,9 +27,9 @@ package { // dependencies cc_defaults { name: "VtsHalSensorsDefaults", + defaults: ["android.hardware.graphics.common-ndk_shared"], shared_libs: [ "android.hardware.graphics.allocator-V1-ndk", - "android.hardware.graphics.common-V3-ndk", "libbinder_ndk", "libutils", "libvndksupport", @@ -42,7 +42,10 @@ cc_defaults { cc_library_static { name: "VtsHalSensorsTargetTestUtils", - defaults: ["VtsHalTargetTestDefaults"], + defaults: [ + "VtsHalTargetTestDefaults", + "android.hardware.graphics.common-ndk_shared", + ], cflags: ["-DLOG_TAG=\"sensors_hidl_hal_test\""], srcs: [ "GrallocWrapper.cpp", @@ -56,7 +59,6 @@ cc_library_static { // Targets that depend on us need to also include these shared_libs: [ "android.hardware.graphics.allocator-V1-ndk", - "android.hardware.graphics.common-V3-ndk", "libbinder_ndk", "libutils", "libvndksupport", From bd15745bf246fbc0a1b0a1f72ebee8b8849c51e2 Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Fri, 26 Aug 2022 23:54:26 +0000 Subject: [PATCH 232/998] Added new owner to broadcast AIDL HAL Bug: 170336130 Test: m -j Change-Id: I63d6c0f1a32b7f75a17b0c1a4e1d9b47bdc9a17f --- broadcastradio/aidl/OWNERS | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 broadcastradio/aidl/OWNERS diff --git a/broadcastradio/aidl/OWNERS b/broadcastradio/aidl/OWNERS new file mode 100644 index 0000000000..302fdd73cc --- /dev/null +++ b/broadcastradio/aidl/OWNERS @@ -0,0 +1,4 @@ +xuweilin@google.com +oscarazu@google.com +ericjeong@google.com +keunyoung@google.com From 3939060c2bcfac13e00731b947da2309b3d72991 Mon Sep 17 00:00:00 2001 From: Sewook Seo Date: Sat, 27 Aug 2022 22:27:39 +0000 Subject: [PATCH 233/998] Support Measurement type EC/NO in Radio HAL Adding a new measurement type(EC/NO) in Radio HAL. Bug: 243685647 Test: build Change-Id: I0b8cdb4416233389331f60dc278776b8074f05ab --- .../hardware/radio/network/SignalThresholdInfo.aidl | 1 + .../hardware/radio/network/SignalThresholdInfo.aidl | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SignalThresholdInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SignalThresholdInfo.aidl index 040932cf5b..744eed7ec5 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SignalThresholdInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SignalThresholdInfo.aidl @@ -48,4 +48,5 @@ parcelable SignalThresholdInfo { const int SIGNAL_MEASUREMENT_TYPE_SSRSRP = 6; const int SIGNAL_MEASUREMENT_TYPE_SSRSRQ = 7; const int SIGNAL_MEASUREMENT_TYPE_SSSINR = 8; + const int SIGNAL_MEASUREMENT_TYPE_ECNO = 9; } diff --git a/radio/aidl/android/hardware/radio/network/SignalThresholdInfo.aidl b/radio/aidl/android/hardware/radio/network/SignalThresholdInfo.aidl index 2f901807e8..0a8e9ceee7 100644 --- a/radio/aidl/android/hardware/radio/network/SignalThresholdInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/SignalThresholdInfo.aidl @@ -82,7 +82,13 @@ parcelable SignalThresholdInfo { * Reference: 3GPP TS 38.215 section 5.1.*, 3GPP TS 38.133 section 10.1.16.1. */ const int SIGNAL_MEASUREMENT_TYPE_SSSINR = 8; - + /** + * EcNo value + * Range: -24 dBm to 1 dBm. + * Used RAN: UTRAN + * Reference: 3GPP TS 25.215 5.1.5 + */ + const int SIGNAL_MEASUREMENT_TYPE_ECNO = 9; /** * Signal Measurement Type * Values are SIGNAL_MEASUREMENT_TYPE_ From 8296aa824b0bd5890866eb3bfa20f1836c48846e Mon Sep 17 00:00:00 2001 From: Lorena Torres-Huerta Date: Mon, 29 Aug 2022 21:48:01 +0000 Subject: [PATCH 234/998] Use explicit aidl versions for audio hal and soundtrigger dependencies. There are still issues with importing implicit versions. Switching to explicit versions while b/188871598 is worked out. Bug: 242678729 Test: m; AIDL_TRANSITIVE_FREEZE=true m aidl-freeze-api && AIDL_FROZEN_REL=true m Change-Id: Ide6a90716bf042fbb925357e110bc84ddb9e96fb --- audio/aidl/Android.bp | 19 +++++++++++++------ audio/aidl/default/Android.bp | 4 +++- audio/aidl/vts/Android.bp | 2 +- automotive/audiocontrol/aidl/Android.bp | 6 +++--- automotive/audiocontrol/aidl/vts/Android.bp | 4 ++-- soundtrigger/aidl/Android.bp | 4 ++-- 6 files changed, 24 insertions(+), 15 deletions(-) diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index 9c7a6a208a..d4c1e85e91 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -33,7 +33,7 @@ aidl_interface { "android/hardware/audio/common/SourceMetadata.aidl", ], imports: [ - "android.media.audio.common.types", + "android.media.audio.common.types-V2", ], stability: "vintf", backend: { @@ -59,7 +59,7 @@ aidl_interface { versions_with_info: [ { version: "1", - imports: ["android.media.audio.common.types-V1"], + imports: ["android.media.audio.common.types-V2"], }, // IMPORTANT: Update latest_android_hardware_audio_common every time you // add the latest frozen version to versions_with_info @@ -68,11 +68,18 @@ aidl_interface { } // Note: This should always be one version ahead of the last frozen version -latest_android_hardware_audio_common = "android.hardware.audio.common-V2" +latest_android_hardware_audio_common = "android.hardware.audio.common-V1" // Modules that depend on android.hardware.audio.common directly can include // the following cc_defaults to avoid explicitly managing dependency versions // across many scattered files. +cc_defaults { + name: "latest_android_hardware_audio_common_cpp_static", + static_libs: [ + latest_android_hardware_audio_common + "-cpp", + ], +} + cc_defaults { name: "latest_android_hardware_audio_common_ndk_static", static_libs: [ @@ -97,8 +104,8 @@ aidl_interface { imports: [ "android.hardware.common-V2", "android.hardware.common.fmq-V1", - "android.hardware.audio.common", - "android.media.audio.common.types", + "android.hardware.audio.common-V1", + "android.media.audio.common.types-V2", ], stability: "vintf", backend: { @@ -145,7 +152,7 @@ aidl_interface { ], imports: [ "android.hardware.audio.common-V1", - "android.media.audio.common.types-V1", + "android.media.audio.common.types-V2", ], stability: "vintf", backend: { diff --git a/audio/aidl/default/Android.bp b/audio/aidl/default/Android.bp index 6225fb3d66..5d63347569 100644 --- a/audio/aidl/default/Android.bp +++ b/audio/aidl/default/Android.bp @@ -60,11 +60,13 @@ cc_binary { cc_defaults { name: "aidlaudioeffectservice_defaults", + defaults: [ + "latest_android_media_audio_common_types_ndk_shared", + ], vendor: true, shared_libs: [ "libbase", "libbinder_ndk", - "android.media.audio.common.types-V1-ndk", "android.hardware.audio.effect-V1-ndk", ], cflags: [ diff --git a/audio/aidl/vts/Android.bp b/audio/aidl/vts/Android.bp index 2e12e7e334..6ea7cef0e2 100644 --- a/audio/aidl/vts/Android.bp +++ b/audio/aidl/vts/Android.bp @@ -45,6 +45,7 @@ cc_test { cc_test { name: "VtsHalAudioEffectTargetTest", defaults: [ + "latest_android_media_audio_common_types_ndk_static", "VtsHalTargetTestDefaults", "use_libaidlvintf_gtest_helper_static", ], @@ -55,7 +56,6 @@ cc_test { "libbinder_ndk", ], static_libs: [ - "android.media.audio.common.types-V1-ndk", "android.hardware.audio.effect-V1-ndk", ], cflags: [ diff --git a/automotive/audiocontrol/aidl/Android.bp b/automotive/audiocontrol/aidl/Android.bp index e5f7a4f8c1..03dab08f1f 100644 --- a/automotive/audiocontrol/aidl/Android.bp +++ b/automotive/audiocontrol/aidl/Android.bp @@ -15,7 +15,7 @@ aidl_interface { srcs: ["android/hardware/automotive/audiocontrol/*.aidl"], imports: [ "android.hardware.audio.common-V1", - "android.media.audio.common.types-V1", + "android.media.audio.common.types-V2", ], stability: "vintf", backend: { @@ -33,14 +33,14 @@ aidl_interface { version: "1", imports: [ "android.hardware.audio.common-V1", - "android.media.audio.common.types-V1", + "android.media.audio.common.types-V2", ], }, { version: "2", imports: [ "android.hardware.audio.common-V1", - "android.media.audio.common.types-V1", + "android.media.audio.common.types-V2", ], }, diff --git a/automotive/audiocontrol/aidl/vts/Android.bp b/automotive/audiocontrol/aidl/vts/Android.bp index 3d4be4828f..edac160e77 100644 --- a/automotive/audiocontrol/aidl/vts/Android.bp +++ b/automotive/audiocontrol/aidl/vts/Android.bp @@ -24,6 +24,8 @@ package { cc_test { name: "VtsAidlHalAudioControlTest", defaults: [ + "latest_android_media_audio_common_types_cpp_static", + "latest_android_hardware_audio_common_cpp_static", "VtsHalTargetTestDefaults", "use_libaidlvintf_gtest_helper_static", ], @@ -38,8 +40,6 @@ cc_test { ], static_libs: [ "android.hardware.automotive.audiocontrol-V2-cpp", - "android.hardware.audio.common-V1-cpp", - "android.media.audio.common.types-V1-cpp", "libgmock", ], test_suites: [ diff --git a/soundtrigger/aidl/Android.bp b/soundtrigger/aidl/Android.bp index 426bf48e2f..27d43d3fc3 100644 --- a/soundtrigger/aidl/Android.bp +++ b/soundtrigger/aidl/Android.bp @@ -23,7 +23,7 @@ aidl_interface { ], stability: "vintf", imports: [ - "android.media.soundtrigger.types", + "android.media.soundtrigger.types-V1", ], backend: { cpp: { @@ -45,7 +45,7 @@ aidl_interface { } // Note: This should always be one version ahead of the last frozen version -latest_android_hardware_soundtrigger3 = "android.hardware.soundtrigger3-V2" +latest_android_hardware_soundtrigger3 = "android.hardware.soundtrigger3-V1" // Modules that depend on android.hardware.soundtrigger3 directly can include // the following java_defaults to avoid explicitly managing dependency versions From 0435c6b4f3cdff32a5ea94e44cc1c80f77dd5554 Mon Sep 17 00:00:00 2001 From: Sally Qi Date: Tue, 30 Aug 2022 15:13:10 -0700 Subject: [PATCH 235/998] Add cc_defaults wrapper for android.hardware.graphics.allocator ndk package. - to avoid manually rev up if needed. Bug: 243429120 Test: builds Change-Id: I25bfcc203cda61af308c37c3766fa9efe6c6784c --- graphics/Android.bp | 14 ++++++++++++++ graphics/allocator/aidl/vts/Android.bp | 2 +- graphics/composer/2.1/utils/vts/Android.bp | 7 ++++--- graphics/composer/2.1/vts/functional/Android.bp | 6 ++++-- graphics/composer/2.2/utils/vts/Android.bp | 3 +-- graphics/composer/2.2/vts/functional/Android.bp | 2 +- graphics/composer/2.3/utils/vts/Android.bp | 5 ++++- graphics/composer/2.3/vts/functional/Android.bp | 6 ++++-- graphics/composer/2.4/utils/vts/Android.bp | 6 ++++-- graphics/composer/2.4/vts/functional/Android.bp | 6 ++++-- graphics/mapper/4.0/utils/vts/Android.bp | 3 +-- graphics/mapper/4.0/vts/functional/Android.bp | 2 +- sensors/common/vts/utils/Android.bp | 8 +++++--- 13 files changed, 48 insertions(+), 22 deletions(-) diff --git a/graphics/Android.bp b/graphics/Android.bp index 1338ee467c..b48844d475 100644 --- a/graphics/Android.bp +++ b/graphics/Android.bp @@ -16,6 +16,20 @@ package { default_applicable_licenses: ["hardware_interfaces_license"], } +cc_defaults { + name: "android.hardware.graphics.allocator-ndk_static", + static_libs: [ + "android.hardware.graphics.allocator-V1-ndk", + ], +} + +cc_defaults { + name: "android.hardware.graphics.allocator-ndk_shared", + shared_libs: [ + "android.hardware.graphics.allocator-V1-ndk", + ], +} + cc_defaults { name: "android.hardware.graphics.common-ndk_static", static_libs: [ diff --git a/graphics/allocator/aidl/vts/Android.bp b/graphics/allocator/aidl/vts/Android.bp index 974f3c8925..a38af14730 100644 --- a/graphics/allocator/aidl/vts/Android.bp +++ b/graphics/allocator/aidl/vts/Android.bp @@ -27,6 +27,7 @@ cc_test { name: "VtsHalGraphicsAllocatorAidl_TargetTest", defaults: [ "VtsHalTargetTestDefaults", + "android.hardware.graphics.allocator-ndk_shared", "use_libaidlvintf_gtest_helper_static", "hwui_defaults", ], @@ -35,7 +36,6 @@ cc_test { ], shared_libs: [ - "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.mapper@4.0", "libEGL", "libGLESv2", diff --git a/graphics/composer/2.1/utils/vts/Android.bp b/graphics/composer/2.1/utils/vts/Android.bp index c0a0c078b2..7b6a0e6367 100644 --- a/graphics/composer/2.1/utils/vts/Android.bp +++ b/graphics/composer/2.1/utils/vts/Android.bp @@ -25,14 +25,16 @@ package { cc_library_static { name: "android.hardware.graphics.composer@2.1-vts", - defaults: ["hidl_defaults"], + defaults: [ + "android.hardware.graphics.allocator-ndk_static", + "hidl_defaults", + ], srcs: [ "ComposerVts.cpp", "GraphicsComposerCallback.cpp", "TestCommandReader.cpp", ], static_libs: [ - "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.composer@2.1", "android.hardware.graphics.mapper@2.0-vts", "android.hardware.graphics.mapper@3.0-vts", @@ -40,7 +42,6 @@ cc_library_static { "libgtest", ], export_static_lib_headers: [ - "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.composer@2.1", "android.hardware.graphics.mapper@2.0-vts", "android.hardware.graphics.mapper@3.0-vts", diff --git a/graphics/composer/2.1/vts/functional/Android.bp b/graphics/composer/2.1/vts/functional/Android.bp index 502036edb4..0f6d7e8eba 100644 --- a/graphics/composer/2.1/vts/functional/Android.bp +++ b/graphics/composer/2.1/vts/functional/Android.bp @@ -25,7 +25,10 @@ package { cc_test { name: "VtsHalGraphicsComposerV2_1TargetTest", - defaults: ["VtsHalTargetTestDefaults"], + defaults: [ + "VtsHalTargetTestDefaults", + "android.hardware.graphics.allocator-ndk_static", + ], tidy_timeout_srcs: ["VtsHalGraphicsComposerV2_1TargetTest.cpp"], srcs: ["VtsHalGraphicsComposerV2_1TargetTest.cpp"], @@ -42,7 +45,6 @@ cc_test { "android.hardware.graphics.mapper@4.0", ], static_libs: [ - "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.allocator@2.0", "android.hardware.graphics.allocator@3.0", "android.hardware.graphics.allocator@4.0", diff --git a/graphics/composer/2.2/utils/vts/Android.bp b/graphics/composer/2.2/utils/vts/Android.bp index bb8f2b19a4..478e2b7a33 100644 --- a/graphics/composer/2.2/utils/vts/Android.bp +++ b/graphics/composer/2.2/utils/vts/Android.bp @@ -26,6 +26,7 @@ package { cc_library_static { name: "android.hardware.graphics.composer@2.2-vts", defaults: [ + "android.hardware.graphics.allocator-ndk_static", "android.hardware.graphics.composer3-ndk_static", "hidl_defaults", ], @@ -38,7 +39,6 @@ cc_library_static { "libui", ], static_libs: [ - "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.composer@2.1-vts", "android.hardware.graphics.composer@2.2", "android.hardware.graphics.mapper@2.1-vts", @@ -55,7 +55,6 @@ cc_library_static { "android.hardware.graphics.mapper@4.0-vts", ], export_static_lib_headers: [ - "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.composer@2.1-vts", "android.hardware.graphics.composer@2.2", "android.hardware.graphics.mapper@2.1-vts", diff --git a/graphics/composer/2.2/vts/functional/Android.bp b/graphics/composer/2.2/vts/functional/Android.bp index 41110e394d..c693d35b68 100644 --- a/graphics/composer/2.2/vts/functional/Android.bp +++ b/graphics/composer/2.2/vts/functional/Android.bp @@ -27,6 +27,7 @@ cc_test { name: "VtsHalGraphicsComposerV2_2TargetTest", defaults: [ "VtsHalTargetTestDefaults", + "android.hardware.graphics.allocator-ndk_static", "android.hardware.graphics.composer3-ndk_static", // Needed for librenderengine "skia_deps", @@ -60,7 +61,6 @@ cc_test { "android.hardware.graphics.mapper@4.0", ], static_libs: [ - "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.allocator@2.0", "android.hardware.graphics.allocator@3.0", "android.hardware.graphics.allocator@4.0", diff --git a/graphics/composer/2.3/utils/vts/Android.bp b/graphics/composer/2.3/utils/vts/Android.bp index 7bc07a4428..b372804341 100644 --- a/graphics/composer/2.3/utils/vts/Android.bp +++ b/graphics/composer/2.3/utils/vts/Android.bp @@ -25,7 +25,10 @@ package { cc_library_static { name: "android.hardware.graphics.composer@2.3-vts", - defaults: ["hidl_defaults"], + defaults: [ + "android.hardware.graphics.allocator-ndk_static", + "hidl_defaults", + ], srcs: [ "ComposerVts.cpp", ], diff --git a/graphics/composer/2.3/vts/functional/Android.bp b/graphics/composer/2.3/vts/functional/Android.bp index 40b77d5a15..13f2b113ab 100644 --- a/graphics/composer/2.3/vts/functional/Android.bp +++ b/graphics/composer/2.3/vts/functional/Android.bp @@ -25,7 +25,10 @@ package { cc_test { name: "VtsHalGraphicsComposerV2_3TargetTest", - defaults: ["VtsHalTargetTestDefaults"], + defaults: [ + "VtsHalTargetTestDefaults", + "android.hardware.graphics.allocator-ndk_static", + ], tidy_timeout_srcs: ["VtsHalGraphicsComposerV2_3TargetTest.cpp"], srcs: ["VtsHalGraphicsComposerV2_3TargetTest.cpp"], @@ -43,7 +46,6 @@ cc_test { "android.hardware.graphics.mapper@4.0", ], static_libs: [ - "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.allocator@2.0", "android.hardware.graphics.allocator@3.0", "android.hardware.graphics.allocator@4.0", diff --git a/graphics/composer/2.4/utils/vts/Android.bp b/graphics/composer/2.4/utils/vts/Android.bp index de3197573d..d2b2ffab9a 100644 --- a/graphics/composer/2.4/utils/vts/Android.bp +++ b/graphics/composer/2.4/utils/vts/Android.bp @@ -25,14 +25,16 @@ package { cc_library_static { name: "android.hardware.graphics.composer@2.4-vts", - defaults: ["hidl_defaults"], + defaults: [ + "android.hardware.graphics.allocator-ndk_static", + "hidl_defaults", + ], srcs: [ "ComposerVts.cpp", "GraphicsComposerCallback.cpp", "TestCommandReader.cpp", ], static_libs: [ - "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.composer@2.1", "android.hardware.graphics.composer@2.2", "android.hardware.graphics.composer@2.3-vts", diff --git a/graphics/composer/2.4/vts/functional/Android.bp b/graphics/composer/2.4/vts/functional/Android.bp index b73ea9403e..b4ab259dd6 100644 --- a/graphics/composer/2.4/vts/functional/Android.bp +++ b/graphics/composer/2.4/vts/functional/Android.bp @@ -25,7 +25,10 @@ package { cc_test { name: "VtsHalGraphicsComposerV2_4TargetTest", - defaults: ["VtsHalTargetTestDefaults"], + defaults: [ + "VtsHalTargetTestDefaults", + "android.hardware.graphics.allocator-ndk_static", + ], tidy_timeout_srcs: ["VtsHalGraphicsComposerV2_4TargetTest.cpp"], srcs: ["VtsHalGraphicsComposerV2_4TargetTest.cpp"], @@ -42,7 +45,6 @@ cc_test { "android.hardware.graphics.mapper@4.0", ], static_libs: [ - "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.allocator@2.0", "android.hardware.graphics.allocator@3.0", "android.hardware.graphics.allocator@4.0", diff --git a/graphics/mapper/4.0/utils/vts/Android.bp b/graphics/mapper/4.0/utils/vts/Android.bp index fd538ae55c..55e721e55e 100644 --- a/graphics/mapper/4.0/utils/vts/Android.bp +++ b/graphics/mapper/4.0/utils/vts/Android.bp @@ -27,6 +27,7 @@ cc_library_static { name: "android.hardware.graphics.mapper@4.0-vts", defaults: [ "VtsHalTargetTestDefaults", + "android.hardware.graphics.allocator-ndk_static", "android.hardware.graphics.common-ndk_static", ], srcs: ["MapperVts.cpp"], @@ -35,7 +36,6 @@ cc_library_static { "-g", ], static_libs: [ - "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.allocator@4.0", "android.hardware.graphics.mapper@4.0", "libaidlcommonsupport", @@ -46,7 +46,6 @@ cc_library_static { "libvndksupport", ], export_static_lib_headers: [ - "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.allocator@4.0", "android.hardware.graphics.common-V3-ndk", "android.hardware.graphics.mapper@4.0", diff --git a/graphics/mapper/4.0/vts/functional/Android.bp b/graphics/mapper/4.0/vts/functional/Android.bp index 625a47961e..6208ae9ab2 100644 --- a/graphics/mapper/4.0/vts/functional/Android.bp +++ b/graphics/mapper/4.0/vts/functional/Android.bp @@ -27,6 +27,7 @@ cc_test { name: "VtsHalGraphicsMapperV4_0TargetTest", defaults: [ "VtsHalTargetTestDefaults", + "android.hardware.graphics.allocator-ndk_shared", "android.hardware.graphics.common-ndk_static", "use_libaidlvintf_gtest_helper_static", ], @@ -38,7 +39,6 @@ cc_test { "libsync", ], shared_libs: [ - "android.hardware.graphics.allocator-V1-ndk", "android.hardware.graphics.allocator@4.0", "android.hardware.graphics.common@1.0", "android.hardware.graphics.common@1.1", diff --git a/sensors/common/vts/utils/Android.bp b/sensors/common/vts/utils/Android.bp index ea90b0253e..b35280a541 100644 --- a/sensors/common/vts/utils/Android.bp +++ b/sensors/common/vts/utils/Android.bp @@ -27,9 +27,11 @@ package { // dependencies cc_defaults { name: "VtsHalSensorsDefaults", - defaults: ["android.hardware.graphics.common-ndk_shared"], + defaults: [ + "android.hardware.graphics.allocator-ndk_shared", + "android.hardware.graphics.common-ndk_shared", + ], shared_libs: [ - "android.hardware.graphics.allocator-V1-ndk", "libbinder_ndk", "libutils", "libvndksupport", @@ -44,6 +46,7 @@ cc_library_static { name: "VtsHalSensorsTargetTestUtils", defaults: [ "VtsHalTargetTestDefaults", + "android.hardware.graphics.allocator-ndk_shared", "android.hardware.graphics.common-ndk_shared", ], cflags: ["-DLOG_TAG=\"sensors_hidl_hal_test\""], @@ -58,7 +61,6 @@ cc_library_static { ], // Targets that depend on us need to also include these shared_libs: [ - "android.hardware.graphics.allocator-V1-ndk", "libbinder_ndk", "libutils", "libvndksupport", From c56e91c84a42f9a5481c8d4695a626851b7c001a Mon Sep 17 00:00:00 2001 From: Maxim Pleshivenkov Date: Fri, 2 Sep 2022 17:11:49 +0000 Subject: [PATCH 236/998] Fixed typo in path for vendor power policy Bug: 244739595 Change-Id: I01b907dea960a4084eba60198deeb6001ef62c25 --- .../android/hardware/automotive/vehicle/VehicleProperty.aidl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 3e5e9e8ce4..11cda3dda2 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -2468,8 +2468,9 @@ enum VehicleProperty { * VHAL sets this property to change car power policy. Car power policy service subscribes to * this property and actually changes the power policy. * The request is made by setting the VehiclePropValue with the ID of a power policy which is - * defined at /vendor/etc/power_policy.xml. If the given ID is not defined, car power policy - * service ignores the request and the current power policy is maintained. + * defined at /vendor/etc/automotive/power_policy.xml. + * If the given ID is not defined, car power policy service ignores the request + * and the current power policy is maintained. * * string: "sample_policy_id" // power policy ID * From ca9a1f53f8b62168825b2c366b3175f54125ed68 Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Tue, 23 Aug 2022 17:46:10 +0000 Subject: [PATCH 237/998] AIDL effect: Initial IEffect interface definition Bug: 238913361 Test: atest VtsHalAudioEffectTargetTest Change-Id: I0d02fed5d40a108003e735d3619e2fc7c0ef6332 --- audio/aidl/Android.bp | 1 + .../hardware/audio/effect/IEffect.aidl | 40 ++++++++++++ .../hardware/audio/effect/IFactory.aidl | 2 + .../hardware/audio/effect/IEffect.aidl | 63 +++++++++++++++++++ .../hardware/audio/effect/IFactory.aidl | 27 ++++++++ 5 files changed, 133 insertions(+) create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IEffect.aidl create mode 100644 audio/aidl/android/hardware/audio/effect/IEffect.aidl diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index d4c1e85e91..ad933bc78b 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -148,6 +148,7 @@ aidl_interface { vendor_available: true, srcs: [ "android/hardware/audio/effect/Descriptor.aidl", + "android/hardware/audio/effect/IEffect.aidl", "android/hardware/audio/effect/IFactory.aidl", ], imports: [ diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IEffect.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IEffect.aidl new file mode 100644 index 0000000000..7f868ad36d --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IEffect.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +interface IEffect { + void open(); + void close(); + android.hardware.audio.effect.Descriptor getDescriptor(); +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IFactory.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IFactory.aidl index b6c9aab75e..db06475cde 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IFactory.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IFactory.aidl @@ -35,4 +35,6 @@ package android.hardware.audio.effect; @VintfStability interface IFactory { android.hardware.audio.effect.Descriptor.Identity[] queryEffects(in @nullable android.media.audio.common.AudioUuid type, in @nullable android.media.audio.common.AudioUuid implementation); + android.hardware.audio.effect.IEffect createEffect(in android.media.audio.common.AudioUuid implUuid); + void destroyEffect(in android.hardware.audio.effect.IEffect handle); } diff --git a/audio/aidl/android/hardware/audio/effect/IEffect.aidl b/audio/aidl/android/hardware/audio/effect/IEffect.aidl new file mode 100644 index 0000000000..44e916b7bf --- /dev/null +++ b/audio/aidl/android/hardware/audio/effect/IEffect.aidl @@ -0,0 +1,63 @@ +/* + * 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. + */ + +package android.hardware.audio.effect; + +import android.hardware.audio.effect.Descriptor; + +/** + * Effect interfaces definitions to configure and control the effect instance. + */ +@VintfStability +interface IEffect { + /** + * Open an effect instance, effect should not start processing data before receive START + * command. All necessary information should be allocated and instance should transfer to IDLE + * state after open() call has been handled successfully. + * After open, the effect instance should be able to handle all IEffect interface calls. + * + * @throws a EX_UNSUPPORTED_OPERATION if device capability/resource is not enough or system + * failure happens. + * @note Open an already-opened effect instance should do nothing and not result in throw error. + */ + void open(); + + /** + * Called by the client to close the effect instance, instance context will be kept after + * close, but processing thread should be destroyed and consume no CPU. It is recommended to + * close the effect on the client side as soon as it becomes unused, it's client responsibility + * to make sure all parameter/buffer is correct if client wants to reopen a closed instance. + * + * Effect instance close interface should always success unless: + * 1. The effect instance is not in a proper state to be closed, for example it's still in + * processing state. + * 2. There is system/hardware related failure when close. + * + * @throws EX_ILLEGAL_STATE if the effect instance is not in a proper state to be closed. + * @throws EX_UNSUPPORTED_OPERATION if the effect instance failed to close for any other reason. + * @note Close an already-closed effect should do nothing and not result in throw error. + */ + void close(); + + /** + * Return the @c Descriptor of this effect instance. + * + * Must be available for the effect instance at anytime and should always succeed. + * + * @return Descriptor The @c Descriptor of this effect instance. + */ + Descriptor getDescriptor(); +} diff --git a/audio/aidl/android/hardware/audio/effect/IFactory.aidl b/audio/aidl/android/hardware/audio/effect/IFactory.aidl index 99c2e6a2f5..4873d3a825 100644 --- a/audio/aidl/android/hardware/audio/effect/IFactory.aidl +++ b/audio/aidl/android/hardware/audio/effect/IFactory.aidl @@ -17,6 +17,7 @@ package android.hardware.audio.effect; import android.hardware.audio.effect.Descriptor; +import android.hardware.audio.effect.IEffect; import android.media.audio.common.AudioUuid; /** @@ -42,4 +43,30 @@ interface IFactory { */ Descriptor.Identity[] queryEffects( in @nullable AudioUuid type, in @nullable AudioUuid implementation); + + /** + * Called by the audio framework to create the effect (identified by the implementation UUID + * parameter). + * + * The effect instance should be able to maintain its own context and parameters after creation. + * + * @param implUuid UUID for the effect implementation which instance will be created based on. + * @return The effect instance handle created. + * @throws EX_ILLEGAL_ARGUMENT if the implUuid is not valid. + * @throws EX_TRANSACTION_FAILED if device capability/resource is not enough to create the + * effect instance. + */ + IEffect createEffect(in AudioUuid implUuid); + + /** + * Called by the framework to destroy the effect and free up all currently allocated resources. + * It is recommended to destroy the effect from the client side as soon as it is becomes unused. + * + * The client must ensure effect instance is closed before destroy. + * + * @param handle The handle of effect instance to be destroyed. + * @throws EX_ILLEGAL_ARGUMENT if the effect handle is not valid. + * @throws EX_ILLEGAL_STATE if the effect instance is not in a proper state to be destroyed. + */ + void destroyEffect(in IEffect handle); } From e4bab46e1435191aa70f5e86bc0a395145d24aa5 Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Wed, 24 Aug 2022 18:14:02 +0000 Subject: [PATCH 238/998] AIDL effect: Initial IEffect interface implementationi and vts test Bug: 238913361 Test: atest VtsHalAudioEffectTargetTest Change-Id: Id64d28af9122e82acd96e3349cf37c3d9728069a --- audio/aidl/Android.bp | 16 + audio/aidl/default/Android.bp | 6 +- audio/aidl/default/EffectFactory.cpp | 27 ++ audio/aidl/default/EffectMain.cpp | 3 +- ...dware.audio.effect.service-aidl.example.rc | 2 +- audio/aidl/default/equalizer/Android.bp | 45 +++ audio/aidl/default/equalizer/Equalizer.cpp | 49 +++ .../effectFactory-impl/EffectFactory.h | 22 ++ .../include/equalizer-impl/Equalizer.h | 22 +- .../aidl/vts/VtsHalAudioEffectTargetTest.cpp | 279 +++++++++++++++--- .../compatibility_matrix.current.xml | 4 +- 11 files changed, 426 insertions(+), 49 deletions(-) create mode 100644 audio/aidl/default/equalizer/Android.bp create mode 100644 audio/aidl/default/equalizer/Equalizer.cpp diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index ad933bc78b..d6e6f50ae9 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -166,3 +166,19 @@ aidl_interface { }, }, } + +latest_android_hardware_audio_effect = "android.hardware.audio.effect-V1" + +cc_defaults { + name: "latest_android_hardware_audio_effect_ndk_shared", + shared_libs: [ + latest_android_hardware_audio_effect + "-ndk", + ], +} + +cc_defaults { + name: "latest_android_hardware_audio_effect_ndk_static", + static_libs: [ + latest_android_hardware_audio_effect + "-ndk", + ], +} diff --git a/audio/aidl/default/Android.bp b/audio/aidl/default/Android.bp index 5d63347569..53ed908908 100644 --- a/audio/aidl/default/Android.bp +++ b/audio/aidl/default/Android.bp @@ -68,6 +68,7 @@ cc_defaults { "libbase", "libbinder_ndk", "android.hardware.audio.effect-V1-ndk", + "libequalizer", ], cflags: [ "-Wall", @@ -80,7 +81,10 @@ cc_defaults { cc_library_static { name: "libaudioeffectserviceexampleimpl", defaults: ["aidlaudioeffectservice_defaults"], - export_include_dirs: ["include"], + export_include_dirs: [ + "include", + "include/equalizer-impl/", + ], srcs: [ "EffectFactory.cpp", ], diff --git a/audio/aidl/default/EffectFactory.cpp b/audio/aidl/default/EffectFactory.cpp index a31e23f8db..ea9d470e9c 100644 --- a/audio/aidl/default/EffectFactory.cpp +++ b/audio/aidl/default/EffectFactory.cpp @@ -36,6 +36,8 @@ Factory::Factory() { {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; id.uuid = EqualizerUUID; mIdentityList.push_back(id); + // TODO: Add visualizer with default implementation later +#if 0 id.type = {static_cast(0xd3467faa), 0xacc7, 0x4d34, @@ -43,6 +45,7 @@ Factory::Factory() { {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; id.uuid = VisualizerUUID; mIdentityList.push_back(id); +#endif } ndk::ScopedAStatus Factory::queryEffects(const std::optional& in_type, @@ -56,4 +59,28 @@ ndk::ScopedAStatus Factory::queryEffects(const std::optional& in_type return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus Factory::createEffect( + const AudioUuid& in_impl_uuid, + std::shared_ptr<::aidl::android::hardware::audio::effect::IEffect>* _aidl_return) { + LOG(DEBUG) << __func__ << ": UUID " << in_impl_uuid.toString(); + if (in_impl_uuid == EqualizerUUID) { + *_aidl_return = ndk::SharedRefBase::make(); + } else { + LOG(ERROR) << __func__ << ": UUID " + << " not supported"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Factory::destroyEffect( + const std::shared_ptr<::aidl::android::hardware::audio::effect::IEffect>& in_handle) { + if (in_handle) { + // TODO: b/245393900 need check the instance state with IEffect.getState before destroy. + return ndk::ScopedAStatus::ok(); + } else { + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } +} + } // namespace aidl::android::hardware::audio::effect diff --git a/audio/aidl/default/EffectMain.cpp b/audio/aidl/default/EffectMain.cpp index 3b3c39b7aa..b30f2e7c12 100644 --- a/audio/aidl/default/EffectMain.cpp +++ b/audio/aidl/default/EffectMain.cpp @@ -23,10 +23,11 @@ int main() { // This is a debug implementation, always enable debug logging. android::base::SetMinimumLogSeverity(::android::base::DEBUG); - ABinderProcess_setThreadPoolMaxThreadCount(16); + ABinderProcess_setThreadPoolMaxThreadCount(1); auto effectFactory = ndk::SharedRefBase::make(); + std::string serviceName = std::string() + effectFactory->descriptor + "/default"; binder_status_t status = AServiceManager_addService(effectFactory->asBinder().get(), serviceName.c_str()); diff --git a/audio/aidl/default/android.hardware.audio.effect.service-aidl.example.rc b/audio/aidl/default/android.hardware.audio.effect.service-aidl.example.rc index 01c0e6e6e6..68bbf5b076 100644 --- a/audio/aidl/default/android.hardware.audio.effect.service-aidl.example.rc +++ b/audio/aidl/default/android.hardware.audio.effect.service-aidl.example.rc @@ -2,7 +2,7 @@ service vendor.audio-effect-hal-aidl /vendor/bin/hw/android.hardware.audio.effec class hal user audioserver # media gid needed for /dev/fm (radio) and for /data/misc/media (tee) - group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct wakelock context_hub + group audio media capabilities BLOCK_SUSPEND ioprio rt 4 task_profiles ProcessCapacityHigh HighPerformance diff --git a/audio/aidl/default/equalizer/Android.bp b/audio/aidl/default/equalizer/Android.bp new file mode 100644 index 0000000000..b842149241 --- /dev/null +++ b/audio/aidl/default/equalizer/Android.bp @@ -0,0 +1,45 @@ +/* + * 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. + */ + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_library_shared { + name: "libequalizer", + vendor: true, + shared_libs: [ + "libbase", + "libbinder_ndk", + "libstagefright_foundation", + ], + defaults: [ + "latest_android_media_audio_common_types_ndk_shared", + "latest_android_hardware_audio_effect_ndk_shared", + ], + include_dirs: ["hardware/interfaces/audio/aidl/default/include/equalizer-impl"], + srcs: [ + "Equalizer.cpp", + ], + visibility: [ + "//hardware/interfaces/audio/aidl/default", + ], +} diff --git a/audio/aidl/default/equalizer/Equalizer.cpp b/audio/aidl/default/equalizer/Equalizer.cpp new file mode 100644 index 0000000000..dae3ab7737 --- /dev/null +++ b/audio/aidl/default/equalizer/Equalizer.cpp @@ -0,0 +1,49 @@ +/* + * 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. + */ + +#define LOG_TAG "AHAL_Equalizer" +#include + +#include "Equalizer.h" + +namespace aidl::android::hardware::audio::effect { + +Equalizer::Equalizer() { + // Implementation UUID + mDesc.common.id.uuid = {static_cast(0xce772f20), + 0x847d, + 0x11df, + 0xbb17, + {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; +} + +ndk::ScopedAStatus Equalizer::open() { + LOG(DEBUG) << __func__; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Equalizer::close() { + LOG(DEBUG) << __func__; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Equalizer::getDescriptor(Descriptor* _aidl_return) { + LOG(DEBUG) << __func__ << "descriptor " << mDesc.toString(); + *_aidl_return = mDesc; + return ndk::ScopedAStatus::ok(); +} + +} // namespace aidl::android::hardware::audio::effect diff --git a/audio/aidl/default/include/effectFactory-impl/EffectFactory.h b/audio/aidl/default/include/effectFactory-impl/EffectFactory.h index 7670250834..8da55258cf 100644 --- a/audio/aidl/default/include/effectFactory-impl/EffectFactory.h +++ b/audio/aidl/default/include/effectFactory-impl/EffectFactory.h @@ -40,6 +40,28 @@ class Factory : public BnFactory { const std::optional<::aidl::android::media::audio::common::AudioUuid>& in_instance, std::vector* out_descriptor) override; + /** + * @brief Create an effect instance for a certain implementation (identified by UUID). + * + * @param in_impl_uuid Effect implementation UUID. + * @param _aidl_return A pointer to created effect instance. + * @return ndk::ScopedAStatus + */ + ndk::ScopedAStatus createEffect( + const ::aidl::android::media::audio::common::AudioUuid& in_impl_uuid, + std::shared_ptr<::aidl::android::hardware::audio::effect::IEffect>* _aidl_return) + override; + + /** + * @brief Destroy an effect instance. + * + * @param in_handle Effect instance handle. + * @return ndk::ScopedAStatus + */ + ndk::ScopedAStatus destroyEffect( + const std::shared_ptr<::aidl::android::hardware::audio::effect::IEffect>& in_handle) + override; + private: // List of effect descriptors supported by the devices. std::vector mIdentityList; diff --git a/audio/aidl/default/include/equalizer-impl/Equalizer.h b/audio/aidl/default/include/equalizer-impl/Equalizer.h index 86f8c3ad2e..44b1d6deff 100644 --- a/audio/aidl/default/include/equalizer-impl/Equalizer.h +++ b/audio/aidl/default/include/equalizer-impl/Equalizer.h @@ -16,16 +16,28 @@ #pragma once +#include #include namespace aidl::android::hardware::audio::effect { // Equalizer implementation UUID. static const ::aidl::android::media::audio::common::AudioUuid EqualizerUUID = { - static_cast(0xce772f20), - 0x847d, - 0x11df, - 0xbb17, + static_cast(0x0bed4300), + 0xddd6, + 0x11db, + 0x8f34, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -} // namespace aidl::android::hardware::audio::effect \ No newline at end of file +class Equalizer : public BnEffect { + public: + Equalizer(); + ndk::ScopedAStatus open() override; + ndk::ScopedAStatus close() override; + ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override; + + private: + // Effect descriptor. + Descriptor mDesc = {.common.id.type = EqualizerUUID}; +}; +} // namespace aidl::android::hardware::audio::effect diff --git a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp index f70948c3be..9b100b1959 100644 --- a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp @@ -14,7 +14,11 @@ * limitations under the License. */ +#include #include +#include +#include +#include #define LOG_TAG "VtsHalAudioEffect" @@ -35,37 +39,88 @@ using namespace android; using ndk::ScopedAStatus; using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::IEffect; using aidl::android::hardware::audio::effect::IFactory; using aidl::android::media::audio::common::AudioUuid; -namespace ndk { -std::ostream& operator<<(std::ostream& str, const ScopedAStatus& status) { - str << status.getDescription(); - return str; -} -} // namespace ndk - -class EffectFactory : public testing::TestWithParam { +class EffectFactoryHelper { public: - void SetUp() override { ASSERT_NO_FATAL_FAILURE(ConnectToService()); } + EffectFactoryHelper(const std::string& name) : mServiceName(name) {} - void TearDown() override {} - - void ConnectToService() { - serviceName = GetParam(); - factory = IFactory::fromBinder(binderUtil.connectToService(serviceName)); - ASSERT_NE(factory, nullptr); + void ConnectToFactoryService() { + mEffectFactory = IFactory::fromBinder(binderUtil.connectToService(mServiceName)); + ASSERT_NE(mEffectFactory, nullptr); } - void RestartService() { - ASSERT_NE(factory, nullptr); - factory = IFactory::fromBinder(binderUtil.restartService()); - ASSERT_NE(factory, nullptr); + void RestartFactoryService() { + ASSERT_NE(mEffectFactory, nullptr); + mEffectFactory = IFactory::fromBinder(binderUtil.restartService()); + ASSERT_NE(mEffectFactory, nullptr); } - std::shared_ptr factory; - std::string serviceName; + void QueryAllEffects() { + EXPECT_NE(mEffectFactory, nullptr); + ScopedAStatus status = + mEffectFactory->queryEffects(std::nullopt, std::nullopt, &mCompleteIds); + EXPECT_EQ(status.getExceptionCode(), EX_NONE); + } + + void QueryEffects(const std::optional& in_type, + const std::optional& in_instance, + std::vector* _aidl_return) { + EXPECT_NE(mEffectFactory, nullptr); + ScopedAStatus status = mEffectFactory->queryEffects(in_type, in_instance, _aidl_return); + EXPECT_EQ(status.getExceptionCode(), EX_NONE); + mIds = *_aidl_return; + } + + void CreateEffects() { + EXPECT_NE(mEffectFactory, nullptr); + ScopedAStatus status; + for (const auto& id : mIds) { + std::shared_ptr effect; + status = mEffectFactory->createEffect(id.uuid, &effect); + EXPECT_EQ(status.getExceptionCode(), EX_NONE) << id.toString(); + EXPECT_NE(effect, nullptr) << id.toString(); + mEffectIdMap[effect] = id; + } + } + + void DestroyEffects() { + EXPECT_NE(mEffectFactory, nullptr); + ScopedAStatus status; + for (const auto& it : mEffectIdMap) { + status = mEffectFactory->destroyEffect(it.first); + EXPECT_EQ(status.getExceptionCode(), EX_NONE) << it.second.toString(); + } + mEffectIdMap.clear(); + } + + std::shared_ptr GetFactory() { return mEffectFactory; } + const std::vector& GetEffectIds() { return mIds; } + const std::vector& GetCompleteEffectIdList() { return mCompleteIds; } + const std::unordered_map, Descriptor::Identity>& GetEffectMap() { + return mEffectIdMap; + } + + private: + std::shared_ptr mEffectFactory; + std::string mServiceName; AudioHalBinderServiceUtil binderUtil; + std::vector mIds; + std::vector mCompleteIds; + std::unordered_map, Descriptor::Identity> mEffectIdMap; +}; + +/// Effect factory testing. +class EffectFactoryTest : public testing::TestWithParam { + public: + void SetUp() override { ASSERT_NO_FATAL_FAILURE(mFactory.ConnectToFactoryService()); } + + void TearDown() override { mFactory.DestroyEffects(); } + + EffectFactoryHelper mFactory = EffectFactoryHelper(GetParam()); + // TODO: these UUID can get from config file // ec7178ec-e5e1-4432-a3f4-4657e6795210 const AudioUuid nullUuid = {static_cast(0xec7178ec), @@ -77,25 +132,23 @@ class EffectFactory : public testing::TestWithParam { static_cast(0x0), 0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}; }; -TEST_P(EffectFactory, SetupAndTearDown) { +TEST_P(EffectFactoryTest, SetupAndTearDown) { // Intentionally empty test body. } -TEST_P(EffectFactory, CanBeRestarted) { - ASSERT_NO_FATAL_FAILURE(RestartService()); +TEST_P(EffectFactoryTest, CanBeRestarted) { + ASSERT_NO_FATAL_FAILURE(mFactory.RestartFactoryService()); } -TEST_P(EffectFactory, QueriedDescriptorList) { +TEST_P(EffectFactoryTest, QueriedDescriptorList) { std::vector descriptors; - ScopedAStatus status = factory->queryEffects(std::nullopt, std::nullopt, &descriptors); - EXPECT_EQ(EX_NONE, status.getExceptionCode()); + mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors); EXPECT_NE(static_cast(descriptors.size()), 0); } -TEST_P(EffectFactory, DescriptorUUIDNotNull) { +TEST_P(EffectFactoryTest, DescriptorUUIDNotNull) { std::vector descriptors; - ScopedAStatus status = factory->queryEffects(std::nullopt, std::nullopt, &descriptors); - EXPECT_EQ(EX_NONE, status.getExceptionCode()); + mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors); // TODO: Factory eventually need to return the full list of MUST supported AOSP effects. for (auto& desc : descriptors) { EXPECT_NE(desc.type, zeroUuid); @@ -103,28 +156,176 @@ TEST_P(EffectFactory, DescriptorUUIDNotNull) { } } -TEST_P(EffectFactory, QueriedDescriptorNotExistType) { +TEST_P(EffectFactoryTest, QueriedDescriptorNotExistType) { std::vector descriptors; - ScopedAStatus status = factory->queryEffects(nullUuid, std::nullopt, &descriptors); - EXPECT_EQ(EX_NONE, status.getExceptionCode()); + mFactory.QueryEffects(nullUuid, std::nullopt, &descriptors); EXPECT_EQ(static_cast(descriptors.size()), 0); } -TEST_P(EffectFactory, QueriedDescriptorNotExistInstance) { +TEST_P(EffectFactoryTest, QueriedDescriptorNotExistInstance) { std::vector descriptors; - ScopedAStatus status = factory->queryEffects(std::nullopt, nullUuid, &descriptors); - EXPECT_EQ(EX_NONE, status.getExceptionCode()); + mFactory.QueryEffects(std::nullopt, nullUuid, &descriptors); EXPECT_EQ(static_cast(descriptors.size()), 0); } -INSTANTIATE_TEST_SUITE_P(EffectFactoryTest, EffectFactory, +TEST_P(EffectFactoryTest, CreateAndDestroyRepeat) { + std::vector descriptors; + mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors); + int numIds = static_cast(mFactory.GetEffectIds().size()); + EXPECT_NE(numIds, 0); + + EXPECT_EQ(static_cast(mFactory.GetEffectMap().size()), 0); + mFactory.CreateEffects(); + EXPECT_EQ(static_cast(mFactory.GetEffectMap().size()), numIds); + mFactory.DestroyEffects(); + EXPECT_EQ(static_cast(mFactory.GetEffectMap().size()), 0); + + // Create and destroy again + mFactory.CreateEffects(); + EXPECT_EQ(static_cast(mFactory.GetEffectMap().size()), numIds); + mFactory.DestroyEffects(); + EXPECT_EQ(static_cast(mFactory.GetEffectMap().size()), 0); +} + +TEST_P(EffectFactoryTest, CreateMultipleInstanceOfSameEffect) { + std::vector descriptors; + mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors); + int numIds = static_cast(mFactory.GetEffectIds().size()); + EXPECT_NE(numIds, 0); + + EXPECT_EQ(static_cast(mFactory.GetEffectMap().size()), 0); + mFactory.CreateEffects(); + EXPECT_EQ(static_cast(mFactory.GetEffectMap().size()), numIds); + // Create effect instances of same implementation + mFactory.CreateEffects(); + EXPECT_EQ(static_cast(mFactory.GetEffectMap().size()), 2 * numIds); + + mFactory.CreateEffects(); + EXPECT_EQ(static_cast(mFactory.GetEffectMap().size()), 3 * numIds); + + mFactory.DestroyEffects(); + EXPECT_EQ(static_cast(mFactory.GetEffectMap().size()), 0); +} + +INSTANTIATE_TEST_SUITE_P(EffectFactoryTest, EffectFactoryTest, testing::ValuesIn(android::getAidlHalInstanceNames(IFactory::descriptor)), android::PrintInstanceNameToString); -GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EffectFactory); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EffectFactoryTest); + +/// Effect testing. +class AudioEffect : public testing::TestWithParam { + public: + void SetUp() override { + ASSERT_NO_FATAL_FAILURE(mFactory.ConnectToFactoryService()); + ASSERT_NO_FATAL_FAILURE(mFactory.CreateEffects()); + } + + void TearDown() override { + CloseEffects(); + ASSERT_NO_FATAL_FAILURE(mFactory.DestroyEffects()); + } + + void OpenEffects() { + auto open = [](const std::shared_ptr& effect) { + ScopedAStatus status = effect->open(); + EXPECT_EQ(status.getExceptionCode(), EX_NONE); + }; + EXPECT_NO_FATAL_FAILURE(ForEachEffect(open)); + } + + void CloseEffects() { + auto close = [](const std::shared_ptr& effect) { + ScopedAStatus status = effect->close(); + EXPECT_EQ(status.getExceptionCode(), EX_NONE); + }; + EXPECT_NO_FATAL_FAILURE(ForEachEffect(close)); + } + + void GetEffectDescriptors() { + auto get = [](const std::shared_ptr& effect) { + Descriptor desc; + ScopedAStatus status = effect->getDescriptor(&desc); + EXPECT_EQ(status.getExceptionCode(), EX_NONE); + }; + EXPECT_NO_FATAL_FAILURE(ForEachEffect(get)); + } + + template + void ForEachEffect(Functor functor) { + auto effectMap = mFactory.GetEffectMap(); + ScopedAStatus status; + for (const auto& it : effectMap) { + SCOPED_TRACE(it.second.toString()); + functor(it.first); + } + } + + EffectFactoryHelper mFactory = EffectFactoryHelper(GetParam()); +}; + +TEST_P(AudioEffect, OpenEffectTest) { + EXPECT_NO_FATAL_FAILURE(OpenEffects()); +} + +TEST_P(AudioEffect, OpenAndCloseEffect) { + EXPECT_NO_FATAL_FAILURE(OpenEffects()); + EXPECT_NO_FATAL_FAILURE(CloseEffects()); +} + +TEST_P(AudioEffect, CloseUnopenedEffectTest) { + EXPECT_NO_FATAL_FAILURE(CloseEffects()); +} + +TEST_P(AudioEffect, DoubleOpenCloseEffects) { + EXPECT_NO_FATAL_FAILURE(OpenEffects()); + EXPECT_NO_FATAL_FAILURE(CloseEffects()); + EXPECT_NO_FATAL_FAILURE(OpenEffects()); + EXPECT_NO_FATAL_FAILURE(CloseEffects()); + + EXPECT_NO_FATAL_FAILURE(OpenEffects()); + EXPECT_NO_FATAL_FAILURE(OpenEffects()); + EXPECT_NO_FATAL_FAILURE(CloseEffects()); + + EXPECT_NO_FATAL_FAILURE(OpenEffects()); + EXPECT_NO_FATAL_FAILURE(CloseEffects()); + EXPECT_NO_FATAL_FAILURE(CloseEffects()); +} + +TEST_P(AudioEffect, GetDescriptors) { + EXPECT_NO_FATAL_FAILURE(GetEffectDescriptors()); +} + +TEST_P(AudioEffect, DescriptorIdExistAndUnique) { + auto checker = [&](const std::shared_ptr& effect) { + Descriptor desc; + std::vector idList; + ScopedAStatus status = effect->getDescriptor(&desc); + EXPECT_EQ(status.getExceptionCode(), EX_NONE); + mFactory.QueryEffects(desc.common.id.type, desc.common.id.uuid, &idList); + EXPECT_EQ(static_cast(idList.size()), 1); + }; + EXPECT_NO_FATAL_FAILURE(ForEachEffect(checker)); + + // Check unique with a set + auto stringHash = [](const Descriptor::Identity& id) { + return std::hash()(id.toString()); + }; + auto vec = mFactory.GetCompleteEffectIdList(); + std::unordered_set idSet(0, stringHash); + for (auto it : vec) { + EXPECT_EQ(static_cast(idSet.count(it)), 0); + idSet.insert(it); + } +} + +INSTANTIATE_TEST_SUITE_P(AudioEffectTest, AudioEffect, + testing::ValuesIn(android::getAidlHalInstanceNames(IFactory::descriptor)), + android::PrintInstanceNameToString); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioEffect); int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); ABinderProcess_setThreadPoolMaxThreadCount(1); ABinderProcess_startThreadPool(); return RUN_ALL_TESTS(); -} +} \ No newline at end of file diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index d59def7153..71243bf7dd 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -16,7 +16,7 @@ default - + android.hardware.audio.effect 6.0 7.0 @@ -37,7 +37,7 @@ default - + android.hardware.audio.effect 1 From 3ba02e052bb0ca49b3aa4c37469faf3aaa89bf94 Mon Sep 17 00:00:00 2001 From: Les Lee Date: Wed, 7 Sep 2022 13:44:06 +0800 Subject: [PATCH 239/998] wifi: Two AP instances use the same interface name When device supports two AP interfaces (i.e. {AP, 2}. not a bridged case), the AP interface name might be observed from the getPredefinedApIfaceNames. Check if the interface name is used or not when creating a new interface. Bug: 244387442 Test: Manual test by commands adb shell cmd wifi start-softap tetheredAp open -b 2 adb shell cmd wifi start-lohs lohs open -b 5 Change-Id: I59b3796895ee09452a9650c4dc138ad9e143282e --- wifi/1.6/default/wifi_chip.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wifi/1.6/default/wifi_chip.cpp b/wifi/1.6/default/wifi_chip.cpp index c7c00b17fd..920beb8778 100644 --- a/wifi/1.6/default/wifi_chip.cpp +++ b/wifi/1.6/default/wifi_chip.cpp @@ -1926,9 +1926,10 @@ uint32_t WifiChip::startIdxOfApIface() { // concurrent STA and not dual AP, else start with idx 0. std::string WifiChip::allocateApIfaceName() { // Check if we have a dedicated iface for AP. - std::vector ifnames = getPredefinedApIfaceNames(false); - if (!ifnames.empty()) { - return ifnames[0]; + std::vector ifnames = getPredefinedApIfaceNames(true); + for (auto const& ifname : ifnames) { + if (findUsingName(ap_ifaces_, ifname)) continue; + return ifname; } return allocateApOrStaIfaceName(IfaceType::AP, startIdxOfApIface()); } From 531809e22d6c9dd6e6fafb44c0f14f0860eeb7c9 Mon Sep 17 00:00:00 2001 From: Rambo Wang Date: Wed, 7 Sep 2022 15:48:29 +0000 Subject: [PATCH 240/998] Enable java backend for IDumpstateDevice HAL Java backend of IDumpstateDevice AIDL service is used in Settings app to enable verbose vendor logging. Bug: 242634531 Test: make && make RunSettingsRoboTests Change-Id: I2aa1a7ae81e5b05aa7088c16bbb201f3a5d88a8e --- dumpstate/aidl/Android.bp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dumpstate/aidl/Android.bp b/dumpstate/aidl/Android.bp index 63670bb0ab..1eb8b329b0 100644 --- a/dumpstate/aidl/Android.bp +++ b/dumpstate/aidl/Android.bp @@ -31,7 +31,8 @@ aidl_interface { enabled: false, }, java: { - enabled: false, + enabled: true, + sdk_version: "module_current", }, }, versions_with_info: [ From 0c2a38d33b0112e6436edfcb24c7f1e5a646b1dd Mon Sep 17 00:00:00 2001 From: seanhong Date: Thu, 8 Sep 2022 18:47:07 +0000 Subject: [PATCH 241/998] Add Window_MOVE property to DefaultProperties.json for CTS tests Test: atest CarPropertyManagerTest Bug: 239100623 Change-Id: I9a1975b4c9448a2fc33a6602cded3d128c7a32df --- .../config/DefaultProperties.json | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 5c2ddd4ebe..a12d34e863 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2051,6 +2051,41 @@ } ] }, + { + "property": "VehicleProperty::WINDOW_MOVE", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::WINDOW_1_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::WINDOW_1_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::WINDOW_2_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::WINDOW_2_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::WINDOW_ROOF_TOP_1", + "minInt32Value": -1, + "maxInt32Value": 1 + } + ] + }, { "property": "VehicleProperty::WHEEL_TICK", "defaultValue": { From ca5d6b70987bce34af22d45deeb09032a2690d8c Mon Sep 17 00:00:00 2001 From: seanhong Date: Thu, 8 Sep 2022 19:18:15 +0000 Subject: [PATCH 242/998] Add INFO_VIN to DefaultProperties.json for CTS tests Test: atest CarPropertyManagerTest Bug: 244335921 Change-Id: I682ab87ef1ff1839ecae92d05a4135810d92bee1 --- .../aidl/impl/default_config/config/DefaultProperties.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index a12d34e863..33a57d34a1 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -58,6 +58,12 @@ ] } }, + { + "property": "VehicleProperty::INFO_VIN", + "defaultValue": { + "stringValue": "1GCARVIN123456789" + } + }, { "property": "VehicleProperty::INFO_MAKE", "defaultValue": { From edd9d3b905e93335f3a2b5ab4a62bccc2b01665b Mon Sep 17 00:00:00 2001 From: Rakesh Raghava Date: Mon, 8 Aug 2022 02:42:14 +0000 Subject: [PATCH 243/998] (ImsMedia) Added startDtmf() and stopDtmf() APIs Bug: 236381818 Test: build (mm) Change-Id: I8cd5ade55155be4bdc23d30d005397e191c9b5a4 --- .../hardware/radio/ims/media/AnbrBitrate.aidl | 8 ++++---- .../radio/ims/media/IImsMediaSession.aidl | 2 ++ .../radio/ims/media/IImsMediaSession.aidl | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl index 598d99584c..711ac19ac4 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl @@ -34,7 +34,7 @@ package android.hardware.radio.ims.media; @VintfStability parcelable AnbrBitrate { - const int INVALID_ANBR_BITRATE = -1; - int uplinkBps; - int downlinkBps; -} \ No newline at end of file + int uplinkBps; + int downlinkBps; + const int INVALID_ANBR_BITRATE = -1; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl index 38d9d02bfe..7fab555606 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl @@ -40,6 +40,8 @@ interface IImsMediaSession { oneway void deleteConfig(in android.hardware.radio.ims.media.RtpConfig config); oneway void confirmConfig(in android.hardware.radio.ims.media.RtpConfig config); oneway void sendDtmf(char dtmfDigit, int duration); + oneway void startDtmf(char dtmfDigit); + oneway void stopDtmf(); oneway void sendHeaderExtension(in List extensions); oneway void setMediaQualityThreshold(in android.hardware.radio.ims.media.MediaQualityThreshold threshold); } diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl index 8c73bbc3a5..d291f4499c 100644 --- a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl @@ -82,6 +82,21 @@ oneway interface IImsMediaSession { */ void sendDtmf(char dtmfDigit, int duration); + /** + * Start sending DTMF digit until the stopDtmf() API is received. + * If the implementation is currently sending a DTMF tone for which + * stopDtmf() is not received yet, then that digit must be stopped first + * + * @param dtmfDigit single char having one of 12 values: 0-9, *, # + */ + void startDtmf(char dtmfDigit); + + /** + * Stop sending the last DTMF digit started by startDtmf(). + * stopDtmf() without preceding startDtmf() must be ignored. + */ + void stopDtmf(); + /** * Send RTP header extension to the other party in the next RTP packet. * From b88515aa50927917fe1d0e262ff6ef7dcb050d71 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 31 Aug 2022 18:08:10 -0700 Subject: [PATCH 244/998] Add VHAL_SUPPORTED_PROPERTY_IDS to ref VHAL. Add the special property VHAL_SUPPORTED_PROPERTY_IDS to ref VHAL to test getting all property configs through multiiple requests. Test: atest DefaultConfigSupportedPropertyIdsTest Run gcar emulator and check HVAC property. Bug: 243449202 Change-Id: I9e7e8e798044c363548b879db1c4f39841362bbd --- automotive/vehicle/2.0/default/Android.bp | 24 +++++++- .../default/impl/vhal_v2_0/DefaultConfig.h | 39 +++++++++++++ ...DefaultConfigSupportedPropertyIds_test.cpp | 56 +++++++++++++++++++ .../vhal_v2_0/tests/DefaultVhalImpl_test.cpp | 2 +- 4 files changed, 119 insertions(+), 2 deletions(-) create mode 100644 automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultConfigSupportedPropertyIds_test.cpp diff --git a/automotive/vehicle/2.0/default/Android.bp b/automotive/vehicle/2.0/default/Android.bp index 0d3253b9f8..33e211ca8c 100644 --- a/automotive/vehicle/2.0/default/Android.bp +++ b/automotive/vehicle/2.0/default/Android.bp @@ -84,7 +84,10 @@ cc_library_static { name: "android.hardware.automotive.vehicle@2.0-default-impl-lib", vendor: true, defaults: ["vhal_v2_0_target_defaults"], - cflags: ["-DENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING"], + cflags: [ + "-DENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING", + "-DENABLE_GET_PROP_CONFIGS_BY_MULTIPLE_REQUESTS", + ], srcs: [ "impl/vhal_v2_0/DefaultVehicleHal.cpp", "impl/vhal_v2_0/VehicleHalClient.cpp", @@ -225,6 +228,25 @@ cc_test { test_suites: ["general-tests"], } +cc_test { + name: "android.hardware.automotive.vehicle@2.0-default-config-test", + vendor: true, + defaults: ["vhal_v2_0_target_defaults"], + srcs: [ + "impl/vhal_v2_0/tests/DefaultConfigSupportedPropertyIds_test.cpp", + ], + cflags: [ + "-DENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING", + "-DENABLE_GET_PROP_CONFIGS_BY_MULTIPLE_REQUESTS", + ], + static_libs: [ + "android.hardware.automotive.vehicle@2.0-default-impl-lib", + "libgtest", + "libgmock", + ], + test_suites: ["general-tests"], +} + cc_binary { name: "android.hardware.automotive.vehicle@2.0-default-service", defaults: ["vhal_v2_0_target_defaults"], diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h index edc8949d5a..91d7846b43 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h @@ -1179,6 +1179,45 @@ const ConfigDeclaration kVehicleProperties[]{ }, }, #endif // ENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING +#ifdef ENABLE_GET_PROP_CONFIGS_BY_MULTIPLE_REQUESTS + { + .config = + { + // VHAL_SUPPORTED_PROPERTY_IDS + .prop = 289476424, + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::STATIC, + // Fetch 100 configs in one request. This number is just arbitrarily + // chosen. + .configArray = {100}, + }, + // All supported property IDs. This list is checked by + // DefaultConfigSupportedPropertyIds_test. + .initialValue = + {.int32Values = + {291504388, 289472773, 291504390, 289472775, 289407240, 289407241, + 289472780, 286261505, 286261506, 289407235, 289472779, 291504647, + 289408517, 356518832, 356516106, 291504644, 291504649, 291504656, + 291504901, 291504903, 287310600, 291504905, 287310602, 287310603, + 291504908, 291504904, 392168201, 392168202, 289408514, 289408001, + 287310850, 287310851, 287310853, 289408513, 289475088, 289475104, + 289475120, 354419984, 320865540, 320865556, 354419975, 354419976, + 354419986, 354419973, 354419974, 354419978, 354419977, 356517120, + 356517121, 356582673, 356517139, 289408269, 356517131, 358614275, + 291570965, 291505923, 289408270, 289408512, 287310855, 289408000, + 289408008, 289408009, 289407747, 291504900, 568332561, 371198722, + 373295872, 320867268, 322964416, 290521862, 287310858, 287310859, + 289475072, 289475073, 289409539, 299896064, 299896065, 299896066, + 299896067, 289410560, 289410561, 289410562, 289410563, 289410576, + 289410577, 289410578, 289410579, 289476368, 299895808, 639631617, + 627048706, 591397123, 554696964, 289410873, 289410874, 287313669, + 299896583, 299896584, 299896585, 299896586, 299896587, 286265121, + 286265122, 286265123, 290457094, 290459441, 299896626, 290459443, + 289410868, 289476405, 299896630, 289410871, 292556600, 557853201, + 559950353, 555756049, 554707473, 289410887, 557846324, 557911861, + 568332086, 557846327, 560992056, 289476424}}, + }, +#endif // ENABLE_GET_PROP_CONFIGS_BY_MULTIPLE_REQUESTS }; } // impl diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultConfigSupportedPropertyIds_test.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultConfigSupportedPropertyIds_test.cpp new file mode 100644 index 0000000000..aa05daafdc --- /dev/null +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultConfigSupportedPropertyIds_test.cpp @@ -0,0 +1,56 @@ +/* + * 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. + */ + +#include +#include +#include + +#include "vhal_v2_0/DefaultConfig.h" + +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { +namespace V2_0 { +namespace impl { + +using ::testing::ElementsAreArray; + +// Test that VHAL_SUPPORTED_PROPERTY_IDS contains all supported property IDs. +TEST(DefaultConfigSupportedPropertyIdsTest, testIncludeAllSupportedIds) { + const int32_t vhalSupportedPropertyIdsPropId = 289476424; + + std::vector allSupportedIds; + std::vector configuredSupportedIds; + + for (const auto& property : impl::kVehicleProperties) { + int propId = property.config.prop; + allSupportedIds.push_back(propId); + + if (propId == vhalSupportedPropertyIdsPropId) { + configuredSupportedIds = property.initialValue.int32Values; + } + } + + ASSERT_THAT(allSupportedIds, ElementsAreArray(configuredSupportedIds)); +} + +} // namespace impl +} // namespace V2_0 +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp index 74f5a7a3c1..df5ada6aa2 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp @@ -141,7 +141,7 @@ class DefaultVhalImplTest : public ::testing::Test { TEST_F(DefaultVhalImplTest, testListProperties) { std::vector configs = mHal->listProperties(); - EXPECT_EQ((size_t)123, configs.size()); + EXPECT_EQ((size_t)124, configs.size()); } TEST_F(DefaultVhalImplTest, testGetDefaultPropertyFloat) { From 539c99872c87a2d0ec495e4aaeff437971a1e650 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Mon, 1 Aug 2022 05:47:36 +0000 Subject: [PATCH 245/998] Add triggerEpsFallback to IRadioIms Bug: 234803835 Test: build & flash Change-Id: I85848facaa0b50cb99ef430d1e57b4c80941134b --- .../hardware/radio/ims/EpsFallbackReason.aidl | 39 +++++++++++++++++++ .../android/hardware/radio/ims/IRadioIms.aidl | 1 + .../hardware/radio/ims/IRadioImsResponse.aidl | 1 + .../hardware/radio/ims/EpsFallbackReason.aidl | 39 +++++++++++++++++++ .../android/hardware/radio/ims/IRadioIms.aidl | 12 ++++++ .../hardware/radio/ims/IRadioImsResponse.aidl | 17 ++++++++ radio/aidl/vts/radio_ims_response.cpp | 6 +++ radio/aidl/vts/radio_ims_test.cpp | 26 +++++++++++++ radio/aidl/vts/radio_ims_utils.h | 2 + 9 files changed, 143 insertions(+) create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/EpsFallbackReason.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/EpsFallbackReason.aidl diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/EpsFallbackReason.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/EpsFallbackReason.aidl new file mode 100644 index 0000000000..ebea9034ec --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/EpsFallbackReason.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum EpsFallbackReason { + NO_NETWORK_TRIGGER = 1, + NO_NETWORK_RESPONSE = 2, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl index f774555d5d..ee5c57292a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl @@ -38,6 +38,7 @@ interface IRadioIms { oneway void updateImsRegistrationInfo(int serial, in android.hardware.radio.ims.ImsRegistration imsRegistration); oneway void startImsTraffic(int serial, in String token, android.hardware.radio.ims.ImsTrafficType imsTrafficType, android.hardware.radio.AccessNetwork accessNetworkType); oneway void stopImsTraffic(int serial, in String token); + oneway void triggerEpsFallback(int serial, in android.hardware.radio.ims.EpsFallbackReason reason); oneway void setResponseFunctions(in android.hardware.radio.ims.IRadioImsResponse radioImsResponse, in android.hardware.radio.ims.IRadioImsIndication radioImsIndication); oneway void sendAnbrQuery(int serial, android.hardware.radio.ims.ImsStreamType mediaType, android.hardware.radio.ims.ImsStreamDirection direction, int bitsPerSecond); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl index 6f6b446f3c..d4fd23fcda 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl @@ -38,5 +38,6 @@ interface IRadioImsResponse { oneway void updateImsRegistrationInfoResponse(in android.hardware.radio.RadioResponseInfo info); oneway void startImsTrafficResponse(in android.hardware.radio.RadioResponseInfo info, in @nullable android.hardware.radio.ims.ConnectionFailureInfo failureInfo); oneway void stopImsTrafficResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void triggerEpsFallbackResponse(in android.hardware.radio.RadioResponseInfo info); oneway void sendAnbrQueryResponse(in android.hardware.radio.RadioResponseInfo info); } diff --git a/radio/aidl/android/hardware/radio/ims/EpsFallbackReason.aidl b/radio/aidl/android/hardware/radio/ims/EpsFallbackReason.aidl new file mode 100644 index 0000000000..670638b029 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/EpsFallbackReason.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ + +package android.hardware.radio.ims; + +@VintfStability +@JavaDerive(toString=true) +@Backing(type="int") +enum EpsFallbackReason { + /** + * If VoNR is not supported and EPS fallback is not triggered by network then UE initiated EPS + * fallback would be triggered by IMS stack with this reason. The modem shall locally release + * the 5G NR SA RRC connection and acquire the LTE network and perform a tracking area update + * procedure. After the EPS fallback procedure is completed, the call setup for voice will + * be established. + */ + NO_NETWORK_TRIGGER = 1, + + /** + * If the UE doesn't receive any response for SIP INVITE within a certain time in 5G NR SA, + * UE initiated EPS fallback will be triggered with this reason. The modem shall reset its data + * buffer of IMS PDUs to prevent the ghost call. After the EPS fallback procedure is completed, + * the VoLTE call will be established. + */ + NO_NETWORK_RESPONSE = 2, +} diff --git a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl index 26f0337eae..e9796f437c 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl @@ -17,6 +17,7 @@ package android.hardware.radio.ims; import android.hardware.radio.AccessNetwork; +import android.hardware.radio.ims.EpsFallbackReason; import android.hardware.radio.ims.ImsRegistration; import android.hardware.radio.ims.ImsStreamDirection; import android.hardware.radio.ims.ImsTrafficType; @@ -102,6 +103,17 @@ oneway interface IRadioIms { */ void stopImsTraffic(int serial, in String token); + /** + * Triggers the UE initiated EPS fallback when a MO voice call failed to establish on 5G NR + * network and network didn't initiate a fallback. + * + * @param serial Serial number of request + * @param reason Specifies the reason that causes EPS fallback + * + * Response function is IRadioImsResponse.triggerEpsFallbackResponse() + */ + void triggerEpsFallback(int serial, in EpsFallbackReason reason); + /** * Set response functions for IMS radio requests and indications. * diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl index f15b422572..351e748400 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl @@ -95,6 +95,23 @@ oneway interface IRadioImsResponse { */ void stopImsTrafficResponse(in RadioResponseInfo info); + /** + * @param info Response info struct containing response type, serial no. and error + * + * Valid errors returned: + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:INVALID_STATE + * RadioError:NO_MEMORY + * RadioError:SYSTEM_ERR + * RadioError:MODEM_ERR + * RadioError:INTERNAL_ERR + * RadioError:INVALID_ARGUMENTS + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:NO_RESOURCES + */ + void triggerEpsFallbackResponse(in RadioResponseInfo info); + /** * @param info Response info struct containing response type, serial no. and error * diff --git a/radio/aidl/vts/radio_ims_response.cpp b/radio/aidl/vts/radio_ims_response.cpp index 7a90ebd76d..62912ea149 100644 --- a/radio/aidl/vts/radio_ims_response.cpp +++ b/radio/aidl/vts/radio_ims_response.cpp @@ -45,6 +45,12 @@ ndk::ScopedAStatus RadioImsResponse::stopImsTrafficResponse(const RadioResponseI return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus RadioImsResponse::triggerEpsFallbackResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_ims.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + ndk::ScopedAStatus RadioImsResponse::sendAnbrQueryResponse(const RadioResponseInfo& info) { rspInfo = info; parent_ims.notify(info.serial); diff --git a/radio/aidl/vts/radio_ims_test.cpp b/radio/aidl/vts/radio_ims_test.cpp index d3bdd4bbea..52912c1703 100644 --- a/radio/aidl/vts/radio_ims_test.cpp +++ b/radio/aidl/vts/radio_ims_test.cpp @@ -163,6 +163,32 @@ TEST_P(RadioImsTest, stopImsTraffic) { verifyError(radioRsp_ims->rspInfo.error); } +/* + * Test IRadioIms.triggerEpsFallback() for the response returned. + */ +TEST_P(RadioImsTest, triggerEpsFallback) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) { + ALOGI("Skipping triggerEpsFallback because ims is not supported in device"); + return; + } else { + ALOGI("Running triggerEpsFallback because ims is supported in device"); + } + + serial = GetRandomSerialNumber(); + + ndk::ScopedAStatus res = + radio_ims->triggerEpsFallback(serial, EpsFallbackReason::NO_NETWORK_TRIGGER); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type); + EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial); + + ALOGI("triggerEpsFallback, rspInfo.error = %s\n", + toString(radioRsp_ims->rspInfo.error).c_str()); + + verifyError(radioRsp_ims->rspInfo.error); +} + /* * Test IRadioIms.sendAnbrQuery() for the response returned. */ diff --git a/radio/aidl/vts/radio_ims_utils.h b/radio/aidl/vts/radio_ims_utils.h index c9ecf4a9cb..bf5684d80f 100644 --- a/radio/aidl/vts/radio_ims_utils.h +++ b/radio/aidl/vts/radio_ims_utils.h @@ -48,6 +48,8 @@ class RadioImsResponse : public BnRadioImsResponse { virtual ndk::ScopedAStatus stopImsTrafficResponse(const RadioResponseInfo& info) override; + virtual ndk::ScopedAStatus triggerEpsFallbackResponse(const RadioResponseInfo& info) override; + virtual ndk::ScopedAStatus sendAnbrQueryResponse(const RadioResponseInfo& info) override; }; From 12a149c505aded5425e7b0345d2f363d1c48f402 Mon Sep 17 00:00:00 2001 From: Rakesh Raghava Date: Sat, 10 Sep 2022 04:45:25 +0000 Subject: [PATCH 246/998] (ImsMedia) Added onSessionClosed() API Bug: 246072449 Test: build (mm) Change-Id: I982f0cf75e27d8d1bb8c262f89c16faeff801deb --- .../hardware/radio/ims/media/IImsMediaListener.aidl | 1 + .../hardware/radio/ims/media/IImsMediaListener.aidl | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaListener.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaListener.aidl index efd59c3495..40f7107cdf 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaListener.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaListener.aidl @@ -36,4 +36,5 @@ package android.hardware.radio.ims.media; interface IImsMediaListener { oneway void onOpenSessionSuccess(int sessionId, android.hardware.radio.ims.media.IImsMediaSession session); oneway void onOpenSessionFailure(int sessionId, android.hardware.radio.ims.media.RtpError error); + oneway void onSessionClosed(int sessionId); } diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaListener.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaListener.aidl index 4078ea2d1a..228acb77d9 100644 --- a/radio/aidl/android/hardware/radio/ims/media/IImsMediaListener.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaListener.aidl @@ -24,7 +24,6 @@ import android.hardware.radio.ims.media.RtpError; */ @VintfStability oneway interface IImsMediaListener { - /** * Fired when a IImsMedia#openSession() API is successful. * @@ -45,5 +44,12 @@ oneway interface IImsMediaListener { * RtpError :NO_RESOURCES * RtpError :PORT_UNAVAILABLE */ - void onOpenSessionFailure(int sessionId, RtpError error); + void onOpenSessionFailure(int sessionId, RtpError error); + + /** + * Fired when IImsMedia#closeSession() API handled. + * + * @param sessionId identifier of the session + */ + void onSessionClosed(int sessionId); } From ede3c2aafb74d3d07b94c5f603faa67c0b295218 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Tue, 13 Sep 2022 16:43:03 -0700 Subject: [PATCH 247/998] Update comment for SUPPORTED_PROPERTY_IDS. Test: None Bug: 246606989 Change-Id: Ic8aa060bae2577229e96ce7b113bf1d452784dcd --- .../vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h index 91d7846b43..e803e81328 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h @@ -1183,12 +1183,14 @@ const ConfigDeclaration kVehicleProperties[]{ { .config = { - // VHAL_SUPPORTED_PROPERTY_IDS + // SUPPORTED_PROPERTY_IDS .prop = 289476424, .access = VehiclePropertyAccess::READ, .changeMode = VehiclePropertyChangeMode::STATIC, // Fetch 100 configs in one request. This number is just arbitrarily - // chosen. + // chosen here. But some HAL impl with bigger config data may need a + // smaller number to make sure the configs returned in one request + // fits the binder data size limitation. .configArray = {100}, }, // All supported property IDs. This list is checked by From 1c61f1cb6fe7124550a8452974e4a6a55e9c4168 Mon Sep 17 00:00:00 2001 From: seanhong Date: Wed, 14 Sep 2022 20:33:22 +0000 Subject: [PATCH 248/998] Add seat memory properties to DefaultProperties.json for CTS tests Test: atest CarPropertyManagerTest Bug: 239613431 Change-Id: I49b9dcf001ba1cf45f3be0d26d96f0da97bd314e --- .../config/DefaultProperties.json | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 33a57d34a1..0c949d665e 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -135,6 +135,66 @@ "VehicleUnit::KILOWATT_HOUR" ] }, + { + "property": "VehicleProperty::SEAT_MEMORY_SELECT", + "defaultValue": { + "int32Values": [ + 1 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": 0, + "maxInt32Value": 3 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": 0, + "maxInt32Value": 3 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": 0, + "maxInt32Value": 3 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": 0, + "maxInt32Value": 3 + } + ] + }, + { + "property": "VehicleProperty::SEAT_MEMORY_SET", + "defaultValue": { + "int32Values": [ + 1 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": 0, + "maxInt32Value": 3 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": 0, + "maxInt32Value": 3 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": 0, + "maxInt32Value": 3 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": 0, + "maxInt32Value": 3 + } + ] + }, { "property": "VehicleProperty::SEAT_BELT_BUCKLED", "defaultValue": { From f06c31da3c4e95e3020591f18f1a282f3c1b9901 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Wed, 14 Sep 2022 08:20:47 +0000 Subject: [PATCH 249/998] Replace ImsFailureReason with SuggestedAction Bug: 219242990 Bug: 246678554 Test: atest FrameworksTelephonyTests:ImsPhoneCallTrackerTest#testUpdateImsRegistrationInfo Change-Id: I013d9f4937a67178f9a396d3e701373dba2add00 --- .../hardware/radio/ims/ImsRegistration.aidl | 2 +- ...ailureReason.aidl => SuggestedAction.aidl} | 7 +++---- .../hardware/radio/ims/ImsRegistration.aidl | 6 +++--- ...ailureReason.aidl => SuggestedAction.aidl} | 19 ++++++------------- 4 files changed, 13 insertions(+), 21 deletions(-) rename radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/{ImsFailureReason.aidl => SuggestedAction.aidl} (95%) rename radio/aidl/android/hardware/radio/ims/{ImsFailureReason.aidl => SuggestedAction.aidl} (82%) diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl index 84ae2cb93e..1c4c12a029 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl @@ -36,7 +36,7 @@ package android.hardware.radio.ims; parcelable ImsRegistration { android.hardware.radio.ims.ImsRegistrationState regState; android.hardware.radio.AccessNetwork accessNetworkType; - android.hardware.radio.ims.ImsFailureReason reason; + android.hardware.radio.ims.SuggestedAction suggestedAction; int capabilities; const int IMS_MMTEL_CAPABILITY_NONE = 0; const int IMS_MMTEL_CAPABILITY_VOICE = 1; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsFailureReason.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SuggestedAction.aidl similarity index 95% rename from radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsFailureReason.aidl rename to radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SuggestedAction.aidl index 918ae3a94c..da19774ef8 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsFailureReason.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SuggestedAction.aidl @@ -33,9 +33,8 @@ package android.hardware.radio.ims; @Backing(type="int") @JavaDerive(toString=true) @VintfStability -enum ImsFailureReason { +enum SuggestedAction { NONE = 0, - FATAL_ERROR = 1, - REPEATED_ERROR = 2, - TEMPORARY_ERROR = 3, + TRIGGER_PLMN_BLOCK = 1, + TRIGGER_PLMN_BLOCK_WITH_TIMEOUT = 2, } diff --git a/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl b/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl index b727af0414..662f9e9a56 100644 --- a/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl +++ b/radio/aidl/android/hardware/radio/ims/ImsRegistration.aidl @@ -17,8 +17,8 @@ package android.hardware.radio.ims; import android.hardware.radio.AccessNetwork; -import android.hardware.radio.ims.ImsFailureReason; import android.hardware.radio.ims.ImsRegistrationState; +import android.hardware.radio.ims.SuggestedAction; @VintfStability @JavaDerive(toString=true) @@ -42,8 +42,8 @@ parcelable ImsRegistration { */ AccessNetwork accessNetworkType; - /** Indicates a failure reason for IMS registration. */ - ImsFailureReason reason; + /** Indicates the expected action for the radio to do. */ + SuggestedAction suggestedAction; /** * Values are bitwise ORs of IMS_MMTEL_CAPABILITY_* constants and IMS_RCS_CAPABILITIES. diff --git a/radio/aidl/android/hardware/radio/ims/ImsFailureReason.aidl b/radio/aidl/android/hardware/radio/ims/SuggestedAction.aidl similarity index 82% rename from radio/aidl/android/hardware/radio/ims/ImsFailureReason.aidl rename to radio/aidl/android/hardware/radio/ims/SuggestedAction.aidl index 21da582930..a17b8a4012 100644 --- a/radio/aidl/android/hardware/radio/ims/ImsFailureReason.aidl +++ b/radio/aidl/android/hardware/radio/ims/SuggestedAction.aidl @@ -19,26 +19,19 @@ package android.hardware.radio.ims; @VintfStability @JavaDerive(toString=true) @Backing(type="int") -enum ImsFailureReason { +enum SuggestedAction { /** Default value */ - NONE, - + NONE = 0, /** * Indicates that the IMS registration is failed with fatal error such as 403 or 404 * on all P-CSCF addresses. The radio shall block the current PLMN or disable * the RAT as per the carrier requirements. */ - FATAL_ERROR, - + TRIGGER_PLMN_BLOCK = 1 << 0, /** * Indicates that the IMS registration on current PLMN failed multiple times. - * The radio shall block the current PLMN or disable the RAT as per the - * carrier requirements. + * The radio shall block the current PLMN or disable the RAT during EPS or 5GS mobility + * management timer value as per the carrier requirements. */ - REPEATED_ERROR, - - /** - * Indicates that IMS registration has failed temporarily. A retry will be done shortly. - */ - TEMPORARY_ERROR, + TRIGGER_PLMN_BLOCK_WITH_TIMEOUT = 1 << 1, } From 60d28d2c24d610ec9938794d1fba9711c8cff0d6 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Tue, 6 Sep 2022 06:02:05 +0000 Subject: [PATCH 250/998] Upgrade the version of IRadioNetwork to V2 Bug: 243344927 Bug: 232285403 Test: build and flash Change-Id: I4cc204c9237f017126a52cb12da5891671f248d6 --- .../compatibility_matrix.current.xml | 2 +- radio/aidl/Android.bp | 2 +- radio/aidl/compat/libradiocompat/Android.bp | 2 +- .../include/libradiocompat/RadioNetwork.h | 10 +++++++ .../libradiocompat/network/RadioNetwork.cpp | 29 +++++++++++++++++++ radio/aidl/compat/service/Android.bp | 2 +- radio/aidl/vts/Android.bp | 2 +- radio/aidl/vts/radio_network_indication.cpp | 5 ++++ radio/aidl/vts/radio_network_response.cpp | 27 +++++++++++++++++ radio/aidl/vts/radio_network_utils.h | 14 +++++++++ 10 files changed, 90 insertions(+), 5 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index d59def7153..6dc86a6004 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -485,7 +485,7 @@ android.hardware.radio.network - 1 + 2 IRadioNetwork slot1 diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp index c0609d839f..fde98fca22 100644 --- a/radio/aidl/Android.bp +++ b/radio/aidl/Android.bp @@ -132,7 +132,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/network/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio"], + imports: ["android.hardware.radio-V1"], backend: { cpp: { enabled: true, diff --git a/radio/aidl/compat/libradiocompat/Android.bp b/radio/aidl/compat/libradiocompat/Android.bp index 487d91b6b9..f79e045f63 100644 --- a/radio/aidl/compat/libradiocompat/Android.bp +++ b/radio/aidl/compat/libradiocompat/Android.bp @@ -39,7 +39,7 @@ cc_library { "android.hardware.radio.data-V1-ndk", "android.hardware.radio.messaging-V1-ndk", "android.hardware.radio.modem-V1-ndk", - "android.hardware.radio.network-V1-ndk", + "android.hardware.radio.network-V2-ndk", "android.hardware.radio.sim-V1-ndk", "android.hardware.radio.voice-V1-ndk", "android.hardware.radio@1.0", diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h index 9784665ef7..c714190153 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h @@ -90,6 +90,16 @@ class RadioNetwork : public RadioCompatBase, ::aidl::android::hardware::radio::network::UsageSetting usageSetting) override; ::ndk::ScopedAStatus getUsageSetting(int32_t serial) override; + ::ndk::ScopedAStatus setEmergencyMode( + int32_t serial, + const ::aidl::android::hardware::radio::network::EmergencyMode emergencyMode) override; + ::ndk::ScopedAStatus triggerEmergencyNetworkScan( + int32_t serial, + const ::aidl::android::hardware::radio::network::EmergencyNetworkScanTrigger& + scanTrigger) override; + ::ndk::ScopedAStatus cancelEmergencyNetworkScan(int32_t serial) override; + ::ndk::ScopedAStatus exitEmergencyMode(int32_t serial) override; + protected: std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse> respond(); diff --git a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp index d5e2a8df99..ff30ac3633 100644 --- a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp +++ b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp @@ -311,4 +311,33 @@ ScopedAStatus RadioNetwork::getUsageSetting(int32_t serial) { return ok(); } +ScopedAStatus RadioNetwork::setEmergencyMode(int32_t serial, aidl::EmergencyMode) { + LOG_CALL << serial; + LOG(ERROR) << " setEmergencyMode is unsupported by HIDL HALs"; + respond()->setEmergencyModeResponse(notSupported(serial), {}); + return ok(); +} + +ScopedAStatus RadioNetwork::triggerEmergencyNetworkScan(int32_t serial, + const aidl::EmergencyNetworkScanTrigger&) { + LOG_CALL << serial; + LOG(ERROR) << " triggerEmergencyNetworkScan is unsupported by HIDL HALs"; + respond()->triggerEmergencyNetworkScanResponse(notSupported(serial)); + return ok(); +} + +ScopedAStatus RadioNetwork::cancelEmergencyNetworkScan(int32_t serial) { + LOG_CALL << serial; + LOG(ERROR) << " cancelEmergencyNetworkScan is unsupported by HIDL HALs"; + respond()->cancelEmergencyNetworkScanResponse(notSupported(serial)); + return ok(); +} + +ScopedAStatus RadioNetwork::exitEmergencyMode(int32_t serial) { + LOG_CALL << serial; + LOG(ERROR) << " exitEmergencyMode is unsupported by HIDL HALs"; + respond()->exitEmergencyModeResponse(notSupported(serial)); + return ok(); +} + } // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/service/Android.bp b/radio/aidl/compat/service/Android.bp index 52eb71ff14..4dbaef4e71 100644 --- a/radio/aidl/compat/service/Android.bp +++ b/radio/aidl/compat/service/Android.bp @@ -42,7 +42,7 @@ cc_binary { "android.hardware.radio.data-V1-ndk", "android.hardware.radio.messaging-V1-ndk", "android.hardware.radio.modem-V1-ndk", - "android.hardware.radio.network-V1-ndk", + "android.hardware.radio.network-V2-ndk", "android.hardware.radio.sim-V1-ndk", "android.hardware.radio.voice-V1-ndk", "android.hardware.radio@1.0", diff --git a/radio/aidl/vts/Android.bp b/radio/aidl/vts/Android.bp index 021ee89f6d..0d4bb3eddf 100644 --- a/radio/aidl/vts/Android.bp +++ b/radio/aidl/vts/Android.bp @@ -68,7 +68,7 @@ cc_test { "android.hardware.radio.data-V1-ndk", "android.hardware.radio.messaging-V1-ndk", "android.hardware.radio.modem-V1-ndk", - "android.hardware.radio.network-V1-ndk", + "android.hardware.radio.network-V2-ndk", "android.hardware.radio.sim-V1-ndk", "android.hardware.radio.voice-V1-ndk", ], diff --git a/radio/aidl/vts/radio_network_indication.cpp b/radio/aidl/vts/radio_network_indication.cpp index 7acbff4b2e..ae3bd4b01a 100644 --- a/radio/aidl/vts/radio_network_indication.cpp +++ b/radio/aidl/vts/radio_network_indication.cpp @@ -92,3 +92,8 @@ ndk::ScopedAStatus RadioNetworkIndication::voiceRadioTechChanged(RadioIndication RadioTechnology /*rat*/) { return ndk::ScopedAStatus::ok(); } + +ndk::ScopedAStatus RadioNetworkIndication::emergencyNetworkScanResult( + RadioIndicationType /*type*/, const EmergencyRegResult& /*result*/) { + return ndk::ScopedAStatus::ok(); +} diff --git a/radio/aidl/vts/radio_network_response.cpp b/radio/aidl/vts/radio_network_response.cpp index 2292c549ca..5599c0332f 100644 --- a/radio/aidl/vts/radio_network_response.cpp +++ b/radio/aidl/vts/radio_network_response.cpp @@ -266,3 +266,30 @@ ndk::ScopedAStatus RadioNetworkResponse::supplyNetworkDepersonalizationResponse( parent_network.notify(info.serial); return ndk::ScopedAStatus::ok(); } + +ndk::ScopedAStatus RadioNetworkResponse::setEmergencyModeResponse( + const RadioResponseInfo& info, const EmergencyRegResult& /*regState*/) { + rspInfo = info; + parent_network.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioNetworkResponse::triggerEmergencyNetworkScanResponse( + const RadioResponseInfo& info) { + rspInfo = info; + parent_network.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioNetworkResponse::exitEmergencyModeResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_network.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioNetworkResponse::cancelEmergencyNetworkScanResponse( + const RadioResponseInfo& info) { + rspInfo = info; + parent_network.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} diff --git a/radio/aidl/vts/radio_network_utils.h b/radio/aidl/vts/radio_network_utils.h index 29f20e8dbd..8480825421 100644 --- a/radio/aidl/vts/radio_network_utils.h +++ b/radio/aidl/vts/radio_network_utils.h @@ -147,6 +147,17 @@ class RadioNetworkResponse : public BnRadioNetworkResponse { virtual ndk::ScopedAStatus supplyNetworkDepersonalizationResponse( const RadioResponseInfo& info, int32_t remainingRetries) override; + + virtual ndk::ScopedAStatus setEmergencyModeResponse( + const RadioResponseInfo& info, const EmergencyRegResult& regState) override; + + virtual ndk::ScopedAStatus triggerEmergencyNetworkScanResponse( + const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus exitEmergencyModeResponse(const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus cancelEmergencyNetworkScanResponse( + const RadioResponseInfo& info) override; }; /* Callback class for radio network indication */ @@ -201,6 +212,9 @@ class RadioNetworkIndication : public BnRadioNetworkIndication { virtual ndk::ScopedAStatus voiceRadioTechChanged(RadioIndicationType type, RadioTechnology rat) override; + + virtual ndk::ScopedAStatus emergencyNetworkScanResult( + RadioIndicationType type, const EmergencyRegResult& result) override; }; // The main test class for Radio AIDL Network. From f415f561a8925aa5a317adbf8f6f62664bb867b9 Mon Sep 17 00:00:00 2001 From: Shuzhen Wang Date: Mon, 19 Sep 2022 18:28:09 -0700 Subject: [PATCH 251/998] Camera VTS: Improve test for torch callback Test below sequence: - ICameraProvider::setCallback - setTorchMode(on) - verify torch mode on callback is received - ICameraProvider::setCallback - verify torch mode on callback is received again This makes sure if torch is on, a new callback registration will trigger a flash-on callback. Test: atest VtsAidlHalCameraProvider_TargetTest Bug: 247038031 Change-Id: I6cea64fcd08fd68fda78b3c0efb7763b7de6edbc --- .../vts/VtsAidlHalCameraProvider_TargetTest.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp index 70ab7a02b3..3fef0899ba 100644 --- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp +++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp @@ -386,6 +386,22 @@ TEST_P(CameraAidlTest, setTorchMode) { mTorchStatus = TorchModeStatus::NOT_AVAILABLE; } + // register a new callback; make sure it receives the + // flash-on callback. + std::shared_ptr cb2 = ndk::SharedRefBase::make(this); + ret = mProvider->setCallback(cb2); + ASSERT_TRUE(ret.isOk()); + ASSERT_NE(cb2, nullptr); + { + std::unique_lock l(mTorchLock); + while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) { + auto timeout = std::chrono::system_clock::now() + + std::chrono::seconds(kTorchTimeoutSec); + ASSERT_NE(std::cv_status::timeout, mTorchCond.wait_until(l, timeout)); + } + ASSERT_EQ(TorchModeStatus::AVAILABLE_ON, mTorchStatus); + } + ret = device->setTorchMode(false); ASSERT_TRUE(ret.isOk()); { From 2456ad4a1060cdc083272f495d560ba99361b2ee Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Fri, 2 Sep 2022 03:52:53 +0000 Subject: [PATCH 252/998] Update triggerImsDeregistration to specify the reason Bug: 219242993 Test: build & flash Change-Id: I57231552b1e5620b50469fcbaeec1919c80d53d2 --- .../radio/ims/IRadioImsIndication.aidl | 2 +- .../radio/ims/ImsDeregistrationReason.aidl | 40 +++++++++++++++++++ .../radio/ims/IRadioImsIndication.aidl | 4 +- .../radio/ims/ImsDeregistrationReason.aidl | 38 ++++++++++++++++++ radio/aidl/vts/radio_ims_indication.cpp | 3 +- radio/aidl/vts/radio_ims_utils.h | 3 +- 6 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsDeregistrationReason.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/ImsDeregistrationReason.aidl diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl index f6d5bc4039..63f29f3f44 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl @@ -36,5 +36,5 @@ package android.hardware.radio.ims; interface IRadioImsIndication { oneway void onConnectionSetupFailure(in android.hardware.radio.RadioIndicationType type, in String token, in android.hardware.radio.ims.ConnectionFailureInfo info); oneway void notifyAnbr(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.ims.ImsStreamType mediaType, in android.hardware.radio.ims.ImsStreamDirection direction, int bitsPerSecond); - oneway void triggerImsDeregistration(in android.hardware.radio.RadioIndicationType type); + oneway void triggerImsDeregistration(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.ims.ImsDeregistrationReason reason); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsDeregistrationReason.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsDeregistrationReason.aidl new file mode 100644 index 0000000000..330374e710 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsDeregistrationReason.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum ImsDeregistrationReason { + REASON_SIM_REMOVED = 1, + REASON_SIM_REFRESH = 2, + REASON_NETWORK_MODE_CHANGED = 3, +} diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl index 7a8cc0e751..ea286c4e88 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.ims; import android.hardware.radio.RadioIndicationType; import android.hardware.radio.ims.ConnectionFailureInfo; +import android.hardware.radio.ims.ImsDeregistrationReason; import android.hardware.radio.ims.ImsStreamDirection; import android.hardware.radio.ims.ImsStreamType; @@ -60,6 +61,7 @@ oneway interface IRadioImsIndication { * the network detach procedure. * * @param type Type of radio indication + * @param reason the reason why the deregistration is triggered */ - void triggerImsDeregistration(in RadioIndicationType type); + void triggerImsDeregistration(in RadioIndicationType type, in ImsDeregistrationReason reason); } diff --git a/radio/aidl/android/hardware/radio/ims/ImsDeregistrationReason.aidl b/radio/aidl/android/hardware/radio/ims/ImsDeregistrationReason.aidl new file mode 100644 index 0000000000..83c032151d --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/ImsDeregistrationReason.aidl @@ -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. + */ + +package android.hardware.radio.ims; + +@VintfStability +@JavaDerive(toString=true) +@Backing(type="int") +enum ImsDeregistrationReason { + /** + * Radio shall send this reason to IMS stack to perform graceful de-registration + * due to SIM card is removed. + */ + REASON_SIM_REMOVED = 1, + /** + * Radio shall send this reason to IMS stack to perform graceful de-registration + * due to SIM refresh that needs a NAS detach and re-attach. + */ + REASON_SIM_REFRESH = 2, + /** + * Radio shall send this reason to IMS stack to perform graceful de-registration + * due to allowed network types bitmask changed that results in NAS detach. + */ + REASON_NETWORK_MODE_CHANGED = 3, +} diff --git a/radio/aidl/vts/radio_ims_indication.cpp b/radio/aidl/vts/radio_ims_indication.cpp index 063781381e..8e98d85cc0 100644 --- a/radio/aidl/vts/radio_ims_indication.cpp +++ b/radio/aidl/vts/radio_ims_indication.cpp @@ -28,6 +28,7 @@ ndk::ScopedAStatus RadioImsIndication::notifyAnbr(RadioIndicationType /*type*/, return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus RadioImsIndication::triggerImsDeregistration(RadioIndicationType /*type*/) { +ndk::ScopedAStatus RadioImsIndication::triggerImsDeregistration(RadioIndicationType /*type*/, + ImsDeregistrationReason /*reason*/) { return ndk::ScopedAStatus::ok(); } \ No newline at end of file diff --git a/radio/aidl/vts/radio_ims_utils.h b/radio/aidl/vts/radio_ims_utils.h index c9ecf4a9cb..e829e43f90 100644 --- a/radio/aidl/vts/radio_ims_utils.h +++ b/radio/aidl/vts/radio_ims_utils.h @@ -66,7 +66,8 @@ class RadioImsIndication : public BnRadioImsIndication { virtual ndk::ScopedAStatus notifyAnbr(RadioIndicationType type, ImsStreamType mediaType, ImsStreamDirection direction, int bitsPerSecond) override; - virtual ndk::ScopedAStatus triggerImsDeregistration(RadioIndicationType type) override; + virtual ndk::ScopedAStatus triggerImsDeregistration(RadioIndicationType type, + ImsDeregistrationReason reason) override; }; // The main test class for Radio AIDL Ims. From b0a6eeee6b7cd27928592eee6f7f83de141aad57 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Tue, 20 Sep 2022 06:11:39 +0000 Subject: [PATCH 253/998] Remove NrRegistrationInfo and add REG_EM to RegState Bug: 216387835 Test: build & flash Change-Id: I2ab352505fcb4458718fac985b12bcf08abb3612 --- .../network/AccessTechnologySpecificInfo.aidl | 4 -- .../radio/network/EutranRegistrationInfo.aidl | 5 +-- .../radio/network/NrRegistrationInfo.aidl | 41 ------------------- .../hardware/radio/network/RegState.aidl | 1 + .../network/AccessTechnologySpecificInfo.aidl | 9 ---- .../radio/network/EutranRegistrationInfo.aidl | 6 +-- .../radio/network/NrRegistrationInfo.aidl | 35 ---------------- .../hardware/radio/network/RegState.aidl | 6 +++ 8 files changed, 11 insertions(+), 96 deletions(-) delete mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrRegistrationInfo.aidl delete mode 100644 radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl index 3248b43f29..28d886256d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl @@ -37,10 +37,6 @@ union AccessTechnologySpecificInfo { boolean noinit; android.hardware.radio.network.Cdma2000RegistrationInfo cdmaInfo; android.hardware.radio.network.EutranRegistrationInfo eutranInfo; - /** - * @deprecated Use ngranInfo instead. - */ android.hardware.radio.network.NrVopsInfo ngranNrVopsInfo; boolean geranDtmSupported; - @nullable android.hardware.radio.network.NrRegistrationInfo ngranInfo; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl index 9c8f692c0f..93df3a4da9 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl @@ -36,14 +36,13 @@ package android.hardware.radio.network; parcelable EutranRegistrationInfo { android.hardware.radio.network.LteVopsInfo lteVopsInfo; android.hardware.radio.network.NrIndicators nrIndicators; - android.hardware.radio.network.EutranRegistrationInfo.AttachType lteAttachType; + android.hardware.radio.network.EutranRegistrationInfo.AttachResultType lteAttachResultType; int extraInfo; const int EXTRA_CSFB_NOT_PREFERRED = 1; const int EXTRA_SMS_ONLY = 2; - enum AttachType { + enum AttachResultType { NONE = 0, EPS_ONLY = 1, COMBINED = 2, - EMERGENCY = 3, } } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrRegistrationInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrRegistrationInfo.aidl deleted file mode 100644 index 930ff542b6..0000000000 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrRegistrationInfo.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.radio.network; -@VintfStability -parcelable NrRegistrationInfo { - android.hardware.radio.network.NrVopsInfo ngranNrVopsInfo; - int extraInfo; - const int EXTRA_SMS_OVER_NAS_ALLOWED = 1; - const int EXTRA_REGISTERED_FOR_EMERGENCY = 2; -} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegState.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegState.aidl index e6e7999f6d..711c9ac3a6 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegState.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegState.aidl @@ -44,4 +44,5 @@ enum RegState { NOT_REG_MT_SEARCHING_OP_EM = 12, REG_DENIED_EM = 13, UNKNOWN_EM = 14, + REG_EM = 20, } diff --git a/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl b/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl index bc56e9ca33..8b95ced7e8 100644 --- a/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl @@ -18,7 +18,6 @@ package android.hardware.radio.network; import android.hardware.radio.network.Cdma2000RegistrationInfo; import android.hardware.radio.network.EutranRegistrationInfo; -import android.hardware.radio.network.NrRegistrationInfo; import android.hardware.radio.network.NrVopsInfo; @VintfStability @@ -31,18 +30,10 @@ union AccessTechnologySpecificInfo { * Network capabilities for voice over PS services. This info is valid only on NR network and * must be present when the device is camped on NR. NrVopsInfo must be empty when the device is * not camped on NR. - * @deprecated Use ngranInfo instead. */ NrVopsInfo ngranNrVopsInfo; /** * True if the dual transfer mode is supported. Refer to 3GPP TS 44.108 section 3.4.25.3 */ boolean geranDtmSupported; - - /** - * Network registration information and network capabilities for voice over PS services. - * This info is valid only on NR network and must be present when the device is camped on NR. - * NrRegistrationInfo must be empty when the device is not camped on NR. - */ - @nullable NrRegistrationInfo ngranInfo; } diff --git a/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl b/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl index 3b4005061d..b986944214 100644 --- a/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/EutranRegistrationInfo.aidl @@ -22,15 +22,13 @@ import android.hardware.radio.network.NrIndicators; @VintfStability @JavaDerive(toString=true) parcelable EutranRegistrationInfo { - enum AttachType { + enum AttachResultType { /** Default value. */ NONE, /** LTE is attached with eps only. */ EPS_ONLY, /** LTE combined EPS and IMSI attach. */ COMBINED, - /** LTE is attached for emergency bearer service. */ - EMERGENCY, } /** LTE combined attach with CSFB not preferred */ @@ -55,7 +53,7 @@ parcelable EutranRegistrationInfo { * The type of network attachment. This info is valid only on LTE network and must be present * when device has attached to the network. */ - AttachType lteAttachType; + AttachResultType lteAttachResultType; /** Values are bitwise ORs of EXTRA_* constants */ int extraInfo; diff --git a/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl b/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl deleted file mode 100644 index cbf233a266..0000000000 --- a/radio/aidl/android/hardware/radio/network/NrRegistrationInfo.aidl +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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. - */ - -package android.hardware.radio.network; - -import android.hardware.radio.network.EutranRegistrationInfo; -import android.hardware.radio.network.NrVopsInfo; - -@VintfStability -parcelable NrRegistrationInfo { - /** SMS over NAS is allowed - TS 24.501 9.11.3.6. */ - const int EXTRA_SMS_OVER_NAS_ALLOWED = 1 << 0; - - /** Registered for emergency services - TS 24.501 9.11.3.6. */ - const int EXTRA_REGISTERED_FOR_EMERGENCY = 1 << 1; - - /** Network capabilities for voice over PS services. */ - NrVopsInfo ngranNrVopsInfo; - - /** Values are bitwise ORs of EXTRA_* constants */ - int extraInfo; -} diff --git a/radio/aidl/android/hardware/radio/network/RegState.aidl b/radio/aidl/android/hardware/radio/network/RegState.aidl index 3f1378321e..2827d1953e 100644 --- a/radio/aidl/android/hardware/radio/network/RegState.aidl +++ b/radio/aidl/android/hardware/radio/network/RegState.aidl @@ -65,4 +65,10 @@ enum RegState { * Same as UNKNOWN but indicates that emergency calls are enabled */ UNKNOWN_EM = 14, + /** + * Emergency attached in LTE or emergency registered in 5GS. + * Reference: 3GPP TS 24.301 9.9.3.11 EPS attach type. + * Reference: 3GPP TS 24.501 9.11.3.6 5GS registration result. + */ + REG_EM = 20, } From 96fa761d0682702b31b3413b1db70f6e08a903b8 Mon Sep 17 00:00:00 2001 From: bodamnam Date: Tue, 13 Sep 2022 00:39:25 +0000 Subject: [PATCH 254/998] (ImsMedia) Modify AmrMode/EvsMode to use bitmask This is needed to pass the negotiated bitrates to the vendor RTP stack Bug: 244517604 Test: build(mm) Change-Id: I9fe9249676dfde53600f9881faa5c0175a7724b5 --- .../hardware/radio/ims/media/AmrMode.aidl | 18 ++++---- .../hardware/radio/ims/media/EvsMode.aidl | 42 +++++++++---------- .../hardware/radio/ims/media/AmrMode.aidl | 18 ++++---- .../hardware/radio/ims/media/EvsMode.aidl | 42 +++++++++---------- 4 files changed, 60 insertions(+), 60 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl index dad6d0a128..5179169e12 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl @@ -34,13 +34,13 @@ package android.hardware.radio.ims.media; @Backing(type="int") @VintfStability enum AmrMode { - AMR_MODE_0 = 0, - AMR_MODE_1 = 1, - AMR_MODE_2 = 2, - AMR_MODE_3 = 3, - AMR_MODE_4 = 4, - AMR_MODE_5 = 5, - AMR_MODE_6 = 6, - AMR_MODE_7 = 7, - AMR_MODE_8 = 8, + AMR_MODE_0 = 1 << 0, + AMR_MODE_1 = 1 << 1, + AMR_MODE_2 = 1 << 2, + AMR_MODE_3 = 1 << 3, + AMR_MODE_4 = 1 << 4, + AMR_MODE_5 = 1 << 5, + AMR_MODE_6 = 1 << 6, + AMR_MODE_7 = 1 << 7, + AMR_MODE_8 = 1 << 8, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl index 6b56d5de25..a067357afa 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl @@ -34,25 +34,25 @@ package android.hardware.radio.ims.media; @Backing(type="int") @VintfStability enum EvsMode { - EVS_MODE_0 = 0, - EVS_MODE_1 = 1, - EVS_MODE_2 = 2, - EVS_MODE_3 = 3, - EVS_MODE_4 = 4, - EVS_MODE_5 = 5, - EVS_MODE_6 = 6, - EVS_MODE_7 = 7, - EVS_MODE_8 = 8, - EVS_MODE_9 = 9, - EVS_MODE_10 = 10, - EVS_MODE_11 = 11, - EVS_MODE_12 = 12, - EVS_MODE_13 = 13, - EVS_MODE_14 = 14, - EVS_MODE_15 = 15, - EVS_MODE_16 = 16, - EVS_MODE_17 = 17, - EVS_MODE_18 = 18, - EVS_MODE_19 = 19, - EVS_MODE_20 = 20, + EVS_MODE_0 = 1 << 0, + EVS_MODE_1 = 1 << 1, + EVS_MODE_2 = 1 << 2, + EVS_MODE_3 = 1 << 3, + EVS_MODE_4 = 1 << 4, + EVS_MODE_5 = 1 << 5, + EVS_MODE_6 = 1 << 6, + EVS_MODE_7 = 1 << 7, + EVS_MODE_8 = 1 << 8, + EVS_MODE_9 = 1 << 9, + EVS_MODE_10 = 1 << 10, + EVS_MODE_11 = 1 << 11, + EVS_MODE_12 = 1 << 12, + EVS_MODE_13 = 1 << 13, + EVS_MODE_14 = 1 << 14, + EVS_MODE_15 = 1 << 15, + EVS_MODE_16 = 1 << 16, + EVS_MODE_17 = 1 << 17, + EVS_MODE_18 = 1 << 18, + EVS_MODE_19 = 1 << 19, + EVS_MODE_20 = 1 << 20, } diff --git a/radio/aidl/android/hardware/radio/ims/media/AmrMode.aidl b/radio/aidl/android/hardware/radio/ims/media/AmrMode.aidl index e9065b3e58..66d8ef096b 100644 --- a/radio/aidl/android/hardware/radio/ims/media/AmrMode.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/AmrMode.aidl @@ -21,21 +21,21 @@ package android.hardware.radio.ims.media; @Backing(type="int") enum AmrMode { /** 4.75 kbps for AMR / 6.6 kbps for AMR-WB */ - AMR_MODE_0 = 0, + AMR_MODE_0 = 1 << 0, /** 5.15 kbps for AMR / 8.855 kbps for AMR-WB */ - AMR_MODE_1 = 1, + AMR_MODE_1 = 1 << 1, /** 5.9 kbps for AMR / 12.65 kbps for AMR-WB */ - AMR_MODE_2 = 2, + AMR_MODE_2 = 1 << 2, /** 6.7 kbps for AMR / 14.25 kbps for AMR-WB */ - AMR_MODE_3 = 3, + AMR_MODE_3 = 1 << 3, /** 7.4 kbps for AMR / 15.85 kbps for AMR-WB */ - AMR_MODE_4 = 4, + AMR_MODE_4 = 1 << 4, /** 7.95 kbps for AMR / 18.25 kbps for AMR-WB */ - AMR_MODE_5 = 5, + AMR_MODE_5 = 1 << 5, /** 10.2 kbps for AMR / 19.85 kbps for AMR-WB */ - AMR_MODE_6 = 6, + AMR_MODE_6 = 1 << 6, /** 12.2 kbps for AMR / 23.05 kbps for AMR-WB */ - AMR_MODE_7 = 7, + AMR_MODE_7 = 1 << 7, /** Silence frame for AMR / 23.85 kbps for AMR-WB */ - AMR_MODE_8 = 8, + AMR_MODE_8 = 1 << 8, } diff --git a/radio/aidl/android/hardware/radio/ims/media/EvsMode.aidl b/radio/aidl/android/hardware/radio/ims/media/EvsMode.aidl index fabec5ec97..95bd6c7117 100644 --- a/radio/aidl/android/hardware/radio/ims/media/EvsMode.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/EvsMode.aidl @@ -21,45 +21,45 @@ package android.hardware.radio.ims.media; @Backing(type="int") enum EvsMode { /** 6.6 kbps for EVS AMR-WB IO */ - EVS_MODE_0 = 0, + EVS_MODE_0 = 1 << 0, /** 8.855 kbps for AMR-WB IO */ - EVS_MODE_1 = 1, + EVS_MODE_1 = 1 << 1, /** 12.65 kbps for AMR-WB IO */ - EVS_MODE_2 = 2, + EVS_MODE_2 = 1 << 2, /** 14.25 kbps for AMR-WB IO */ - EVS_MODE_3 = 3, + EVS_MODE_3 = 1 << 3, /** 15.85 kbps for AMR-WB IO */ - EVS_MODE_4 = 4, + EVS_MODE_4 = 1 << 4, /** 18.25 kbps for AMR-WB IO */ - EVS_MODE_5 = 5, + EVS_MODE_5 = 1 << 5, /** 19.85 kbps for AMR-WB IO */ - EVS_MODE_6 = 6, + EVS_MODE_6 = 1 << 6, /** 23.05 kbps for AMR-WB IO */ - EVS_MODE_7 = 7, + EVS_MODE_7 = 1 << 7, /** 23.85 kbps for AMR-WB IO */ - EVS_MODE_8 = 8, + EVS_MODE_8 = 1 << 8, /** 5.9 kbps for EVS primary */ - EVS_MODE_9 = 9, + EVS_MODE_9 = 1 << 9, /** 7.2 kbps for EVS primary */ - EVS_MODE_10 = 10, + EVS_MODE_10 = 1 << 10, /** 8.0 kbps for EVS primary */ - EVS_MODE_11 = 11, + EVS_MODE_11 = 1 << 11, /** 9.6 kbps for EVS primary */ - EVS_MODE_12 = 12, + EVS_MODE_12 = 1 << 12, /** 13.2 kbps for EVS primary */ - EVS_MODE_13 = 13, + EVS_MODE_13 = 1 << 13, /** 16.4 kbps for EVS primary */ - EVS_MODE_14 = 14, + EVS_MODE_14 = 1 << 14, /** 24.4 kbps for EVS primary */ - EVS_MODE_15 = 15, + EVS_MODE_15 = 1 << 15, /** 32.0 kbps for EVS primary */ - EVS_MODE_16 = 16, + EVS_MODE_16 = 1 << 16, /** 48.0 kbps for EVS primary */ - EVS_MODE_17 = 17, + EVS_MODE_17 = 1 << 17, /** 64.0 kbps for EVS primary */ - EVS_MODE_18 = 18, + EVS_MODE_18 = 1 << 18, /** 96.0 kbps for EVS primary */ - EVS_MODE_19 = 19, + EVS_MODE_19 = 1 << 19, /** 128.0 kbps for EVS primary */ - EVS_MODE_20 = 20, + EVS_MODE_20 = 1 << 20, } From af494c65c19bcf5bff5cd25d68d9f46bfa96bfae Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Tue, 20 Sep 2022 17:05:18 -0400 Subject: [PATCH 255/998] Remove virtual from ~ComposerClientWriter This class has no other virtual methods, and it has no subclasses, so it's unclear why it had a virtual destructor. Bug: NA Test: make Change-Id: Ic87fe6596b6d796ca11822de53af2e4e521f127d --- .../hardware/graphics/composer3/ComposerClientWriter.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h index 1d81f7b602..775ae9fa88 100644 --- a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h +++ b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h @@ -59,13 +59,13 @@ using aidl::android::hardware::common::NativeHandle; namespace aidl::android::hardware::graphics::composer3 { -class ComposerClientWriter { +class ComposerClientWriter final { public: static constexpr std::optional kNoTimestamp = std::nullopt; ComposerClientWriter() { reset(); } - virtual ~ComposerClientWriter() { reset(); } + ~ComposerClientWriter() { reset(); } void reset() { mDisplayCommand.reset(); From a8cebd5c8f6efdcd466eccaf5054e243c8b6f9bd Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Mon, 2 May 2022 17:48:13 +0000 Subject: [PATCH 256/998] Migrate broadcast radio HAL from HIDL to AIDL Radio HAL is migrated to AIDL by hidl2aidl tool, and the following changes are applied: - Result type is returned as service-specific error than normal return value since AIDL only allows one return value of primitive types. - Integer data types were changed to int, long and byte. - Constant enum was removed and replaced by constants defined in IBroadcastRadio. - Rds and Deemphasis enums were removed and defined as const in AmFmRegionConfig - MetadataKey was removed, and Metadata was defined as union. - ITunerSession:scan() was renamed to ITunerSession:seek(). - ITunerSession was removed and its methods were added to IBroadcastRadio. - Callback for config flag setting was added to ITunerCallback. - Callback and timeout behaviors are clarified. Bug: 170336130 Test: m -j Change-Id: Id1cdc5651037429ca07a4d4dc4682709cfc4949b --- broadcastradio/aidl/Android.bp | 31 ++ .../broadcastradio/AmFmBandRange.aidl | 41 ++ .../broadcastradio/AmFmRegionConfig.aidl | 44 +++ .../hardware/broadcastradio/Announcement.aidl | 40 ++ .../broadcastradio/AnnouncementType.aidl | 46 +++ .../hardware/broadcastradio/ConfigFlag.aidl | 46 +++ .../broadcastradio/DabTableEntry.aidl | 39 ++ .../broadcastradio/IAnnouncementListener.aidl | 38 ++ .../broadcastradio/IBroadcastRadio.aidl | 58 +++ .../hardware/broadcastradio/ICloseHandle.aidl | 38 ++ .../broadcastradio/ITunerCallback.aidl | 43 +++ .../broadcastradio/IdentifierType.aidl | 52 +++ .../hardware/broadcastradio/Metadata.aidl | 53 +++ .../broadcastradio/ProgramFilter.aidl | 41 ++ .../broadcastradio/ProgramIdentifier.aidl | 39 ++ .../hardware/broadcastradio/ProgramInfo.aidl | 51 +++ .../broadcastradio/ProgramListChunk.aidl | 41 ++ .../broadcastradio/ProgramSelector.aidl | 39 ++ .../hardware/broadcastradio/Properties.aidl | 43 +++ .../hardware/broadcastradio/Result.aidl | 44 +++ .../broadcastradio/VendorKeyValue.aidl | 39 ++ .../broadcastradio/AmFmBandRange.aidl | 58 +++ .../broadcastradio/AmFmRegionConfig.aidl | 86 +++++ .../hardware/broadcastradio/Announcement.aidl | 46 +++ .../broadcastradio/AnnouncementType.aidl | 72 ++++ .../hardware/broadcastradio/ConfigFlag.aidl | 92 +++++ .../broadcastradio/DabTableEntry.aidl | 40 ++ .../broadcastradio/IAnnouncementListener.aidl | 34 ++ .../broadcastradio/IBroadcastRadio.aidl | 353 ++++++++++++++++++ .../hardware/broadcastradio/ICloseHandle.aidl | 35 ++ .../broadcastradio/ITunerCallback.aidl | 113 ++++++ .../broadcastradio/IdentifierType.aidl | 163 ++++++++ .../hardware/broadcastradio/Metadata.aidl | 115 ++++++ .../broadcastradio/ProgramFilter.aidl | 70 ++++ .../broadcastradio/ProgramIdentifier.aidl | 37 ++ .../hardware/broadcastradio/ProgramInfo.aidl | 173 +++++++++ .../broadcastradio/ProgramListChunk.aidl | 73 ++++ .../broadcastradio/ProgramSelector.aidl | 74 ++++ .../hardware/broadcastradio/Properties.aidl | 76 ++++ .../hardware/broadcastradio/Result.aidl | 61 +++ .../broadcastradio/VendorKeyValue.aidl | 37 ++ .../compatibility_matrix.current.xml | 11 +- 42 files changed, 2715 insertions(+), 10 deletions(-) create mode 100644 broadcastradio/aidl/Android.bp create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmBandRange.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmRegionConfig.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Announcement.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AnnouncementType.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ConfigFlag.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/DabTableEntry.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IAnnouncementListener.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IBroadcastRadio.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ICloseHandle.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ITunerCallback.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IdentifierType.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Metadata.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramFilter.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramIdentifier.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramInfo.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramListChunk.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramSelector.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Properties.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Result.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/VendorKeyValue.aidl create mode 100644 broadcastradio/aidl/android/hardware/broadcastradio/AmFmBandRange.aidl create mode 100644 broadcastradio/aidl/android/hardware/broadcastradio/AmFmRegionConfig.aidl create mode 100644 broadcastradio/aidl/android/hardware/broadcastradio/Announcement.aidl create mode 100644 broadcastradio/aidl/android/hardware/broadcastradio/AnnouncementType.aidl create mode 100644 broadcastradio/aidl/android/hardware/broadcastradio/ConfigFlag.aidl create mode 100644 broadcastradio/aidl/android/hardware/broadcastradio/DabTableEntry.aidl create mode 100644 broadcastradio/aidl/android/hardware/broadcastradio/IAnnouncementListener.aidl create mode 100644 broadcastradio/aidl/android/hardware/broadcastradio/IBroadcastRadio.aidl create mode 100644 broadcastradio/aidl/android/hardware/broadcastradio/ICloseHandle.aidl create mode 100644 broadcastradio/aidl/android/hardware/broadcastradio/ITunerCallback.aidl create mode 100644 broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl create mode 100644 broadcastradio/aidl/android/hardware/broadcastradio/Metadata.aidl create mode 100644 broadcastradio/aidl/android/hardware/broadcastradio/ProgramFilter.aidl create mode 100644 broadcastradio/aidl/android/hardware/broadcastradio/ProgramIdentifier.aidl create mode 100644 broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl create mode 100644 broadcastradio/aidl/android/hardware/broadcastradio/ProgramListChunk.aidl create mode 100644 broadcastradio/aidl/android/hardware/broadcastradio/ProgramSelector.aidl create mode 100644 broadcastradio/aidl/android/hardware/broadcastradio/Properties.aidl create mode 100644 broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl create mode 100644 broadcastradio/aidl/android/hardware/broadcastradio/VendorKeyValue.aidl diff --git a/broadcastradio/aidl/Android.bp b/broadcastradio/aidl/Android.bp new file mode 100644 index 0000000000..41d637c8d7 --- /dev/null +++ b/broadcastradio/aidl/Android.bp @@ -0,0 +1,31 @@ +// +// 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. +// + +aidl_interface { + name: "android.hardware.broadcastradio", + vendor_available: true, + srcs: ["android/hardware/broadcastradio/*.aidl"], + stability: "vintf", + backend: { + cpp: { + enabled: false, + }, + java: { + sdk_version: "module_current", + min_sdk_version: "Tiramisu", + }, + }, +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmBandRange.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmBandRange.aidl new file mode 100644 index 0000000000..ca511aa13a --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmBandRange.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable AmFmBandRange { + int lowerBound; + int upperBound; + int spacing; + int seekSpacing; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmRegionConfig.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmRegionConfig.aidl new file mode 100644 index 0000000000..f3aecdfe75 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmRegionConfig.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable AmFmRegionConfig { + android.hardware.broadcastradio.AmFmBandRange[] ranges; + int fmDeemphasis; + int fmRds; + const int DEEMPHASIS_D50 = 1; + const int DEEMPHASIS_D75 = 2; + const int RDS = 1; + const int RBDS = 2; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Announcement.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Announcement.aidl new file mode 100644 index 0000000000..bbdd86f7dc --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Announcement.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable Announcement { + android.hardware.broadcastradio.ProgramSelector selector; + android.hardware.broadcastradio.AnnouncementType type = android.hardware.broadcastradio.AnnouncementType.INVALID; + android.hardware.broadcastradio.VendorKeyValue[] vendorInfo; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AnnouncementType.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AnnouncementType.aidl new file mode 100644 index 0000000000..237b86880c --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AnnouncementType.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@Backing(type="byte") @JavaDerive(equals=true, toString=true) @VintfStability +enum AnnouncementType { + INVALID = 0, + EMERGENCY = 1, + WARNING = 2, + TRAFFIC = 3, + WEATHER = 4, + NEWS = 5, + EVENT = 6, + SPORT = 7, + MISC = 8, +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ConfigFlag.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ConfigFlag.aidl new file mode 100644 index 0000000000..6fb9a62213 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ConfigFlag.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@Backing(type="int") @JavaDerive(equals=true, toString=true) @VintfStability +enum ConfigFlag { + FORCE_MONO = 1, + FORCE_ANALOG = 2, + FORCE_DIGITAL = 3, + RDS_AF = 4, + RDS_REG = 5, + DAB_DAB_LINKING = 6, + DAB_FM_LINKING = 7, + DAB_DAB_SOFT_LINKING = 8, + DAB_FM_SOFT_LINKING = 9, +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/DabTableEntry.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/DabTableEntry.aidl new file mode 100644 index 0000000000..162f4abd62 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/DabTableEntry.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable DabTableEntry { + String label; + int frequencyKhz; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IAnnouncementListener.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IAnnouncementListener.aidl new file mode 100644 index 0000000000..346af5807d --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IAnnouncementListener.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@VintfStability +interface IAnnouncementListener { + oneway void onListUpdated(in android.hardware.broadcastradio.Announcement[] announcements); +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IBroadcastRadio.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IBroadcastRadio.aidl new file mode 100644 index 0000000000..39eb04c105 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IBroadcastRadio.aidl @@ -0,0 +1,58 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@VintfStability +interface IBroadcastRadio { + android.hardware.broadcastradio.Properties getProperties(); + android.hardware.broadcastradio.AmFmRegionConfig getAmFmRegionConfig(in boolean full); + android.hardware.broadcastradio.DabTableEntry[] getDabRegionConfig(); + void setTunerCallback(in android.hardware.broadcastradio.ITunerCallback callback); + void unsetTunerCallback(); + void tune(in android.hardware.broadcastradio.ProgramSelector program); + void seek(in boolean directionUp, in boolean skipSubChannel); + void step(in boolean directionUp); + void cancel(); + void startProgramListUpdates(in android.hardware.broadcastradio.ProgramFilter filter); + void stopProgramListUpdates(); + boolean isConfigFlagSet(in android.hardware.broadcastradio.ConfigFlag flag); + void setConfigFlag(in android.hardware.broadcastradio.ConfigFlag flag, in boolean value); + android.hardware.broadcastradio.VendorKeyValue[] setParameters(in android.hardware.broadcastradio.VendorKeyValue[] parameters); + android.hardware.broadcastradio.VendorKeyValue[] getParameters(in String[] keys); + byte[] getImage(in int id); + android.hardware.broadcastradio.ICloseHandle registerAnnouncementListener(in android.hardware.broadcastradio.IAnnouncementListener listener, in android.hardware.broadcastradio.AnnouncementType[] enabled); + const int INVALID_IMAGE = 0; + const int ANTENNA_STATE_CHANGE_TIMEOUT_MS = 100; + const int LIST_COMPLETE_TIMEOUT_MS = 300000; + const int TUNER_TIMEOUT_MS = 30000; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ICloseHandle.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ICloseHandle.aidl new file mode 100644 index 0000000000..75e7f2a4c0 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ICloseHandle.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@VintfStability +interface ICloseHandle { + void close(); +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ITunerCallback.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ITunerCallback.aidl new file mode 100644 index 0000000000..f5badade46 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ITunerCallback.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@VintfStability +interface ITunerCallback { + oneway void onTuneFailed(in android.hardware.broadcastradio.Result result, in android.hardware.broadcastradio.ProgramSelector selector); + oneway void onCurrentProgramInfoChanged(in android.hardware.broadcastradio.ProgramInfo info); + oneway void onProgramListUpdated(in android.hardware.broadcastradio.ProgramListChunk chunk); + oneway void onAntennaStateChange(in boolean connected); + oneway void onConfigFlagUpdated(in android.hardware.broadcastradio.ConfigFlag flag, in boolean value); + oneway void onParametersUpdated(in android.hardware.broadcastradio.VendorKeyValue[] parameters); +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IdentifierType.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IdentifierType.aidl new file mode 100644 index 0000000000..4e8296a88b --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IdentifierType.aidl @@ -0,0 +1,52 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@Backing(type="int") @JavaDerive(equals=true, toString=true) @VintfStability +enum IdentifierType { + VENDOR_START = 1000, + VENDOR_END = 1999, + INVALID = 0, + AMFM_FREQUENCY_KHZ = 1, + RDS_PI = 2, + HD_STATION_ID_EXT = 3, + HD_STATION_NAME = 4, + DAB_SID_EXT = 5, + DAB_ENSEMBLE = 6, + DAB_SCID = 7, + DAB_FREQUENCY_KHZ = 8, + DRMO_SERVICE_ID = 9, + DRMO_FREQUENCY_KHZ = 10, + SXM_SERVICE_ID = 12, + SXM_CHANNEL = 13, +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Metadata.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Metadata.aidl new file mode 100644 index 0000000000..e02b6b1bd0 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Metadata.aidl @@ -0,0 +1,53 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +union Metadata { + String rdsPs; + int rdsPty; + int rbdsPty; + String rdsRt; + String songTitle; + String songArtist; + String songAlbum; + int stationIcon; + int albumArt; + String programName; + String dabEnsembleName; + String dabEnsembleNameShort; + String dabServiceName; + String dabServiceNameShort; + String dabComponentName; + String dabComponentNameShort; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramFilter.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramFilter.aidl new file mode 100644 index 0000000000..9edeb8d5c6 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramFilter.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable ProgramFilter { + android.hardware.broadcastradio.IdentifierType[] identifierTypes; + android.hardware.broadcastradio.ProgramIdentifier[] identifiers; + boolean includeCategories; + boolean excludeModifications; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramIdentifier.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramIdentifier.aidl new file mode 100644 index 0000000000..66763508ad --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramIdentifier.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable ProgramIdentifier { + android.hardware.broadcastradio.IdentifierType type = android.hardware.broadcastradio.IdentifierType.INVALID; + long value; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramInfo.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramInfo.aidl new file mode 100644 index 0000000000..5e662d2450 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramInfo.aidl @@ -0,0 +1,51 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable ProgramInfo { + android.hardware.broadcastradio.ProgramSelector selector; + android.hardware.broadcastradio.ProgramIdentifier logicallyTunedTo; + android.hardware.broadcastradio.ProgramIdentifier physicallyTunedTo; + @nullable android.hardware.broadcastradio.ProgramIdentifier[] relatedContent; + int infoFlags; + int signalQuality; + android.hardware.broadcastradio.Metadata[] metadata; + android.hardware.broadcastradio.VendorKeyValue[] vendorInfo; + const int FLAG_LIVE = 1; + const int FLAG_MUTED = 2; + const int FLAG_TRAFFIC_PROGRAM = 4; + const int FLAG_TRAFFIC_ANNOUNCEMENT = 8; + const int FLAG_TUNABLE = 16; + const int FLAG_STEREO = 32; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramListChunk.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramListChunk.aidl new file mode 100644 index 0000000000..5d53b99302 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramListChunk.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable ProgramListChunk { + boolean purge; + boolean complete; + android.hardware.broadcastradio.ProgramInfo[] modified; + @nullable android.hardware.broadcastradio.ProgramIdentifier[] removed; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramSelector.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramSelector.aidl new file mode 100644 index 0000000000..9af1dc8880 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramSelector.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable ProgramSelector { + android.hardware.broadcastradio.ProgramIdentifier primaryId; + android.hardware.broadcastradio.ProgramIdentifier[] secondaryIds; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Properties.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Properties.aidl new file mode 100644 index 0000000000..643b819d8a --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Properties.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable Properties { + String maker; + String product; + String version; + String serial; + android.hardware.broadcastradio.IdentifierType[] supportedIdentifierTypes; + android.hardware.broadcastradio.VendorKeyValue[] vendorInfo; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Result.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Result.aidl new file mode 100644 index 0000000000..07edae80ae --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Result.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@Backing(type="int") @VintfStability +enum Result { + OK = 0, + INTERNAL_ERROR = 1, + INVALID_ARGUMENTS = 2, + INVALID_STATE = 3, + NOT_SUPPORTED = 4, + TIMEOUT = 5, + UNKNOWN_ERROR = 6, +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/VendorKeyValue.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/VendorKeyValue.aidl new file mode 100644 index 0000000000..3c6b19438f --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/VendorKeyValue.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VendorKeyValue { + String key; + String value; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/AmFmBandRange.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/AmFmBandRange.aidl new file mode 100644 index 0000000000..562631f0c7 --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/AmFmBandRange.aidl @@ -0,0 +1,58 @@ +/* + * 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. + */ + +package android.hardware.broadcastradio; + +/** + * Defines the AM/FM band range for configuring different regions. + * + *

Channel grid is defined as: each possible channel is set at + * lowerBound + channelNumber * spacing, up to upperBound. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable AmFmBandRange { + /** + * The frequency (in kHz) of the first channel within the range. + * + * Lower bound must be a tunable frequency. + */ + int lowerBound; + + /** + * The frequency (in kHz) of the last channel within the range. + */ + int upperBound; + + /** + * Channel grid resolution (in kHz), telling how far the channels are apart. + */ + int spacing; + + /** + * Channel spacing (in kHz) used to speed up seeking to the next station + * via the {@link IBroadcastRadio#seek} operation. + * + * It must be a multiple of channel grid resolution. + * + * Tuner may first quickly check every n-th channel and if it detects echo + * from a station, it fine-tunes to find the exact frequency. + * + * It's ignored for capabilities check (with full=true when calling + * getAmFmRegionConfig). + */ + int seekSpacing; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/AmFmRegionConfig.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/AmFmRegionConfig.aidl new file mode 100644 index 0000000000..a3086c60cc --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/AmFmRegionConfig.aidl @@ -0,0 +1,86 @@ +/* + * 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. + */ + +package android.hardware.broadcastradio; + +import android.hardware.broadcastradio.AmFmBandRange; + +/** + * Regional configuration for AM/FM. + * + *

For hardware capabilities check (with full=true when calling + * {@link IBroadcastRadio#getAmFmRegionConfig}), HAL implementation fills + * entire supported range of frequencies and features. + * + * When checking current configuration, at most one bit in each bitset + * can be set. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable AmFmRegionConfig { + /** + * Noth D50 and D75 are FM de-emphasis filter supported or configured. + * + * Both might be set for hardware capabilities check (with full={@code true} + * when calling getAmFmRegionConfig), but exactly one for specific region + * settings. + */ + const int DEEMPHASIS_D50 = 1 << 0; + + const int DEEMPHASIS_D75 = 1 << 1; + + /** + * Both RDS and RBDS are supported or configured RDS variants. + * + * Both might be set for hardware capabilities check (with full={@code true} + * when calling getAmFmRegionConfig), but only one (or none) for specific + * region settings. + * + * RDS is Standard variant, used everywhere except North America. + */ + const int RDS = 1 << 0; + + /** + * Variant used in North America (see RDS). + */ + const int RBDS = 1 << 1; + + /** + * All supported or configured AM/FM bands. + * + * AM/FM bands are identified by frequency value + * (see {@link IdentifierType#AMFM_FREQUENCY_KHZ}). + * + * With typical configuration, it's expected to have two frequency ranges + * for capabilities check (AM and FM) and four ranges for specific region + * configuration (AM LW, AM MW, AM SW, FM). + */ + AmFmBandRange[] ranges; + + /** + * De-emphasis filter supported/configured. + * + * It is a bitset of de-emphasis values (DEEMPHASIS_D50 and DEEMPHASIS_D75). + */ + int fmDeemphasis; + + /** + * RDS/RBDS variant supported/configured. + * + * It is a bitset of RDS values (RDS and RBDS). + */ + int fmRds; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/Announcement.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/Announcement.aidl new file mode 100644 index 0000000000..a972d4d49a --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/Announcement.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ + +package android.hardware.broadcastradio; + +import android.hardware.broadcastradio.AnnouncementType; +import android.hardware.broadcastradio.ProgramSelector; +import android.hardware.broadcastradio.VendorKeyValue; + +/** + * Station broadcasting active announcement. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable Announcement { + /** + * Program selector to tune to the announcement. + */ + ProgramSelector selector; + + /** + * Announcement type. + */ + AnnouncementType type = AnnouncementType.INVALID; + + /** + * Vendor-specific information. + * + * It may be used for extra features, not supported by the platform, + * for example: com.me.hdradio.urgency=100; com.me.hdradio.certainity=50. + */ + VendorKeyValue[] vendorInfo; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/AnnouncementType.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/AnnouncementType.aidl new file mode 100644 index 0000000000..8df80252e8 --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/AnnouncementType.aidl @@ -0,0 +1,72 @@ +/* + * 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. + */ + +package android.hardware.broadcastradio; + +/** + * Type of an announcement. + * + *

It maps to different announcement types for each radio technology. + */ +@VintfStability +@Backing(type="byte") +@JavaDerive(equals=true, toString=true) +enum AnnouncementType { + /** + * Undefined announcement type + */ + INVALID = 0, + + /** + * DAB alarm, RDS emergency program type (PTY 31). + */ + EMERGENCY = 1, + + /** + * DAB warning. + */ + WARNING, + + /** + * DAB road traffic, RDS TA, HD Radio transportation. + */ + TRAFFIC, + + /** + * Weather. + */ + WEATHER, + + /** + * News. + */ + NEWS, + + /** + * DAB event, special event. + */ + EVENT, + + /** + * DAB sport report, RDS sports. + */ + SPORT, + + /** + * All others. + */ + MISC, +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ConfigFlag.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ConfigFlag.aidl new file mode 100644 index 0000000000..11da39c02b --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/ConfigFlag.aidl @@ -0,0 +1,92 @@ +/* + * 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. + */ + +package android.hardware.broadcastradio; + +/** + * Configuration flags to be used with isConfigFlagSet and setConfigFlag methods + * of IBroadcastRadio. + */ +@VintfStability +@Backing(type="int") +@JavaDerive(equals=true, toString=true) +enum ConfigFlag { + /** + * Forces mono audio stream reception. + * + * Analog broadcasts can recover poor reception conditions by jointing + * stereo channels into one. Mainly for, but not limited to AM/FM. + */ + FORCE_MONO = 1, + + /** + * Forces the analog playback for the supporting radio technology. + * + * User may disable digital playback for FM HD Radio or hybrid FM/DAB with + * this option. This is purely user choice, ie. does not reflect digital- + * analog handover state managed from the HAL implementation side. + * + * Some radio technologies may not support this, ie. DAB. + */ + FORCE_ANALOG, + + /** + * Forces the digital playback for the supporting radio technology. + * + * User may disable digital-analog handover that happens with poor + * reception conditions. With digital forced, the radio will remain silent + * instead of switching to analog channel if it's available. This is purely + * user choice, it does not reflect the actual state of handover. + */ + FORCE_DIGITAL, + + /** + * RDS Alternative Frequencies. + * + * If set and the currently tuned RDS station broadcasts on multiple + * channels, radio tuner automatically switches to the best available + * alternative. + */ + RDS_AF, + + /** + * RDS region-specific program lock-down. + * + * Allows user to lock to the current region as they move into the + * other region. + */ + RDS_REG, + + /** + * Enables DAB-DAB hard- and implicit-linking (the same content). + */ + DAB_DAB_LINKING, + + /** + * Enables DAB-FM hard- and implicit-linking (the same content). + */ + DAB_FM_LINKING, + + /** + * Enables DAB-DAB soft-linking (related content). + */ + DAB_DAB_SOFT_LINKING, + + /** + * Enables DAB-FM soft-linking (related content). + */ + DAB_FM_SOFT_LINKING, +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/DabTableEntry.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/DabTableEntry.aidl new file mode 100644 index 0000000000..13c20b0619 --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/DabTableEntry.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ + +package android.hardware.broadcastradio; + +/** + * An entry in regional configuration for DAB. + * + *

This defines a frequency table row for ensembles. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable DabTableEntry { + /** + * Channel name, i.e. 5A, 7B. + * + * It must match the following regular expression: + * /^[A-Z0-9][A-Z0-9 ]{0,5}[A-Z0-9]$/ (2-7 uppercase alphanumeric characters + * without spaces allowed at the beginning nor end). + */ + String label; + + /** + * Frequency, in kHz. + */ + int frequencyKhz; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/IAnnouncementListener.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/IAnnouncementListener.aidl new file mode 100644 index 0000000000..f6021c130c --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/IAnnouncementListener.aidl @@ -0,0 +1,34 @@ +/* + * 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. + */ + +package android.hardware.broadcastradio; + +import android.hardware.broadcastradio.Announcement; + +/** + * Callback interface for announcement listener. + * + * For typical configuration, the listener is a broadcast radio service. + */ +@VintfStability +interface IAnnouncementListener { + /** + * Called whenever announcement list has changed. + * + * @param announcements The complete list of currently active announcements. + */ + oneway void onListUpdated(in Announcement[] announcements); +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/IBroadcastRadio.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/IBroadcastRadio.aidl new file mode 100644 index 0000000000..0f88fc0dde --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/IBroadcastRadio.aidl @@ -0,0 +1,353 @@ +/* + * 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. + */ + +package android.hardware.broadcastradio; + +import android.hardware.broadcastradio.AmFmRegionConfig; +import android.hardware.broadcastradio.AnnouncementType; +import android.hardware.broadcastradio.ConfigFlag; +import android.hardware.broadcastradio.DabTableEntry; +import android.hardware.broadcastradio.IAnnouncementListener; +import android.hardware.broadcastradio.ICloseHandle; +import android.hardware.broadcastradio.ITunerCallback; +import android.hardware.broadcastradio.ProgramFilter; +import android.hardware.broadcastradio.ProgramSelector; +import android.hardware.broadcastradio.Properties; +import android.hardware.broadcastradio.VendorKeyValue; + +/** + * Represents a hardware broadcast radio module. A single module may contain + * multiple hardware tuners (i.e. with an additional background tuner), but the + * layers above the HAL see them as a single logical unit. + */ +@VintfStability +interface IBroadcastRadio { + /** + * Invalid identifier for {@link IBroadcastRadio#getImage}. + */ + const int INVALID_IMAGE = 0; + + /** + * If the antenna is disconnected from the beginning, the + * {@link ITunerCallback#onAntennaStateChange} callback must be + * called within this time. + */ + const int ANTENNA_STATE_CHANGE_TIMEOUT_MS = 100; + + /** + * All chunks of a signal program list update must be transmitted + * within this time. + */ + const int LIST_COMPLETE_TIMEOUT_MS = 300000; + + /** + * All tune, seek and step operations must be completed within + * this time. + */ + const int TUNER_TIMEOUT_MS = 30000; + + /** + * Returns module properties: a description of a module and its + * capabilities. This method must not fail. + * + * @return Module description. + */ + Properties getProperties(); + + /** + * Fetches current or possible AM/FM region configuration. + * + * If the tuner doesn't support AM/FM, a service-specific error + * {@link Result#NOT_SUPPORTED} will be returned. + * + * @param full If {@code true}, returns full hardware capabilities. + * If {@code false}, returns current regional configuration. + * @return config Hardware capabilities (full={@code true}) or current configuration + * (full={@code false}). + */ + AmFmRegionConfig getAmFmRegionConfig(in boolean full); + + /** + * Fetches current DAB region configuration. + * + * If tuner doesn't support DAB, a service-specific error + * {@link Result#NOT_SUPPORTED} wiil be returned. + * + * @return config Current configuration. + */ + DabTableEntry[] getDabRegionConfig(); + + /** + * Sets callback interface. + * + * It is expected that there will only ever be a single callback set. + * If called when a callback is already set, the existing one should be + * replaced with the new callback. + * + * If the callback to be set is null, a service-specific error + * {@link Result#INVALID_ARGUMENTS} will be returned; if the callback + * is not set successfully, a service-specific error + * {@link Result#NOT_SUPPORTED} should be returned. + * + * @param callback The callback interface used for BroadcastRadio HAL. + */ + void setTunerCallback(in ITunerCallback callback); + + /** + * Unsets callback interface. + * + * The existing callback is set to null. + */ + void unsetTunerCallback(); + + /** + * Tunes to a specified program. + * + * Automatically cancels pending tune(), seek() or step(). + * The method should first check whether tune can be processed by the status + * of tuner and inputs, schedule tune task, and then return status + * immediately. If a non-null callback is not set, a service-specific + * error {@link Result#INVALID_STATE} will be returned; if the program + * selector doesn't contain any supported identifier, a service-specific error + * {@link Result#NOT_SUPPORTED} will be returned; if the program selector + * contains identifiers in invalid format (i.e. out of range), a + * service-specific error {@link Result#INVALID_ARGUMENTS} will be returned; + * otherwise, OK will be returned as status. Tune task should be processed + * asynchronously after the method returns status. If the method returns OK, + * {@link ITunerCallback#tuneFailed} or + * {@link ITunerCallback#currentProgramInfoChanged} callback must be called + * after the tune task completes. + * + * @param program Program to tune to. + */ + void tune(in ProgramSelector program); + + /** + * Seeks the next valid program on the "air". + * + * Advance to the next detected program and stay there. + * + * Automatically cancels pending tune(), seek() or step(). + * The method should first check whether seek can be processed by the status + * of tuner and inputs, schedule seek task, and then return status + * immediately. If a non-null callback is not set, a service-specific + * error {@link Result#INVALID_STATE} will be returned; otherwise, OK will + * be returned as status. Seek task should be processed asynchronously + * after the method returns status. If the method returns OK, + * {@link ITunerCallback#tuneFailed} or + * {@link ITunerCallback#currentProgramInfoChanged} callback must be called + * after the seek task completes. + * + * The skipSubChannel parameter is used to skip digital radio subchannels: + * - HD Radio SPS; + * - DAB secondary service. + * + * As an implementation detail, the HAL has the option to perform an actual + * seek or select the next program from the list retrieved in the + * background. + * + * @param directionUp {@code true} to change towards higher numeric values + * (frequency, channel number), {@code false} towards + * lower. + * @param skipSubChannel Don't tune to subchannels. + */ + void seek(in boolean directionUp, in boolean skipSubChannel); + + /** + * Steps to the adjacent channel, which may not be occupied by any program. + * + * Automatically cancels pending tune(), seek() or step(). + * The method should first check whether step can be processed by the status + * of tuner and inputs, schedule step task, and then return status + * immediately. If a non-null callback is not set, service-specific + * error {@link Result#INVALID_STATE} will be returned; if tuning to an + * unoccupied channel is not supported (i.e. for satellite radio), a + * service-specific error {@link Result#NOT_SUPPORTED} will be returned; + * otherwise, OK should be returned as status. Step task should be + * processed asynchronously after the method returns status. If the + * method returns OK, {@link ITunerCallback#tuneFailed} or + * {@link currentProgramInfoChanged} callback must be called after the + * step task completes. + * + * @param directionUp {@code true} to change towards higher numeric values + * (frequency, channel number), {@code false} towards lower. + */ + void step(in boolean directionUp); + + /** + * Cancels pending tune(), seek() or step(). + * + * If there is no such operation running, the call can be ignored. + * If cancel is called after the HAL completes an operation (tune, seek, and step) + * and before the callback completions, the cancel can be ignored and the callback + * should complete. + */ + void cancel(); + + /** + * Applies a filter to the program list and starts sending program list + * update over {@link ITunerCallback#onProgramListUpdated} callback. + * + * There may be only one updates stream active at the moment. Calling this + * method again must result in cancelling the pending update request. + * + * This call clears the program list on the client side, the HAL must send + * the whole list again. + * + * If the program list scanning hardware (i.e. background tuner) is + * unavailable at the moment, the call must succeed and start updates + * when it becomes available. + * + * If the program list scanning is not supported by the hardware, a + * service-specific error {@link Result#NOT_SUPPORTED} will be returned. + * + * @param filter Filter to apply on the fetched program list. + */ + void startProgramListUpdates(in ProgramFilter filter); + + /** + * Stops sending program list updates. + * + * If stopProgramListUpdates is called after the HAL completes a program list update + * and before the onCurrentProgramInfoChanged callback completions, + * stopProgramListUpdates can be ignored and the callback should complete. + */ + void stopProgramListUpdates(); + + /** + * Fetches the current setting of a given config flag. + * + * The success/failure result must be consistent with setConfigFlag. + * + * If the flag is not applicable, a service-specific error + * {@link Result#INVALID_STATE} will be returned. If the flag is not + * supported at all, a service-specific error {@link Result#NOT_SUPPORTED} + * will be returned. + * + * @return the current value of the flag, if succeed. + */ + boolean isConfigFlagSet(in ConfigFlag flag); + + /** + * Sets the config flag. + * + * The success/failure result must be consistent with isConfigFlagSet. + * + * If the flag is not applicable, a service-specific error + * {@link Result#INVALID_STATE} will be returned. If the flag is not + * supported at all, a service-specific error {@link Result#NOT_SUPPORTED} + * will be returned. + * + * @param flag Flag to set. + * @param value The new value of a given flag. + */ + void setConfigFlag(in ConfigFlag flag, in boolean value); + + /** + * Generic method for setting vendor-specific parameter values. + * The framework does not interpret the parameters, they are passed + * in an opaque manner between a vendor application and HAL. + * + * Framework does not make any assumptions on the keys or values, other than + * ones stated in VendorKeyValue documentation (a requirement of key + * prefixes). + * + * For each pair in the result array, the key must be one of the keys + * contained in the input (possibly with wildcards expanded), and the value + * must be a vendor-specific result status (i.e. the string "OK" or an error + * code). The implementation may choose to return an empty array, or only + * return a status for a subset of the provided inputs, at its discretion. + * + * Application and HAL must not use keys with unknown prefix. In particular, + * it must not place a key-value pair in results array for unknown key from + * parameters array - instead, an unknown key should simply be ignored. + * In other words, results array may contain a subset of parameter keys + * (however, the framework doesn't enforce a strict subset - the only + * formal requirement is vendor domain prefix for keys). + * + * @param parameters Vendor-specific key-value pairs. + * @return Operation completion status for parameters being set. + */ + VendorKeyValue[] setParameters(in VendorKeyValue[] parameters); + + /** + * Generic method for retrieving vendor-specific parameter values. + * The framework does not interpret the parameters, they are passed + * in an opaque manner between a vendor application and HAL. + * + * Framework does not cache set/get requests, so it's allowed for + * getParameter to return a different value than previous setParameter call. + * + * The syntax and semantics of keys are up to the vendor (as long as prefix + * rules are obeyed). For instance, vendors may include some form of + * wildcard support. In such case, result array may be of different size + * than requested keys array. However, wildcards are not recognized by + * framework and they are passed as-is to the HAL implementation. + * + * Unknown keys must be ignored and not placed into results array. + * + * @param keys Parameter keys to fetch. + * @return Vendor-specific key-value pairs. + */ + VendorKeyValue[] getParameters(in String[] keys); + + /** + * Fetches image from radio module cache. + * + * This is out-of-band transport mechanism for images carried with metadata. + * The metadata array only passes the identifier, so the client may cache + * images or even not fetch them. + * + * The identifier may be any arbitrary number (i.e. sha256 prefix) selected + * by the vendor. It must be stable so the application may cache it. + * + * The data must be a valid PNG, JPEG, GIF or BMP file, and must be less + * than 1MB, due to hard limit on binder transaction buffer. + * + * Image data with an invalid format must be handled gracefully in the same + * way as a missing image. + * + * The image identifier may become invalid after some time from passing it + * with metadata struct (due to resource cleanup at the HAL implementation). + * However, it must remain valid for a currently tuned program at least + * until onCurrentProgramInfoChanged is called. + * + * @param id Identifier of an image (value of {@link IBroadcastRadio#INVALID_IMAGE} + * is reserved and must be treated as invalid image). + * @return A binary blob with image data + * or a zero-length array if identifier doesn't exist. + */ + byte[] getImage(in int id); + + /** + * Registers announcement listener. + * + * If there is at least one observer registered, HAL implementation must + * notify about announcements. + * + * If the observer dies, the HAL implementation must unregister observer + * automatically. + * + * If the tuner doesn't support announcements, a service-specific error + * {@link Result#NOT_SUPPORTED} will be returned. + * + * @param listener The listener interface. + * @param enabled The list of announcement types to watch for. + * @return a handle to unregister observer. + */ + ICloseHandle registerAnnouncementListener( + in IAnnouncementListener listener, in AnnouncementType[] enabled); +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ICloseHandle.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ICloseHandle.aidl new file mode 100644 index 0000000000..4a3240b9e2 --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/ICloseHandle.aidl @@ -0,0 +1,35 @@ +/* + * 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. + */ + +package android.hardware.broadcastradio; + +/** + * Represents a generic close handle to remove a callback that doesn't need + * active interface. + */ +@VintfStability +interface ICloseHandle { + /** + * Closes the handle. + * + * The call must not fail and must only be issued once. + * + * After the close call is executed, no other calls to this interface + * are allowed. If the call is issued second time, a service-specific + * error {@link Result#INVALID_STATE} will be returned. + */ + void close(); +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ITunerCallback.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ITunerCallback.aidl new file mode 100644 index 0000000000..1f0221cbf9 --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/ITunerCallback.aidl @@ -0,0 +1,113 @@ +/* + * 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. + */ + +package android.hardware.broadcastradio; + +import android.hardware.broadcastradio.ConfigFlag; +import android.hardware.broadcastradio.ProgramInfo; +import android.hardware.broadcastradio.ProgramListChunk; +import android.hardware.broadcastradio.ProgramSelector; +import android.hardware.broadcastradio.Result; +import android.hardware.broadcastradio.VendorKeyValue; + +@VintfStability +oneway interface ITunerCallback { + /** + * Method called by the HAL when a tuning operation fails asynchronously + * following {@link IBroadcastRadio#tune}, {@link IBroadcastRadio#seek} + * or {@link IBroadcastRadio#step}. + * + * This callback is only called when the tune(), seek() or step() command + * succeeds without returning any error at first. + * + * @param result {@link Result#TIMEOUT} in case that tune(), seek() or + * step() is not completed within + * @link IBroadcastRadio#TUNER_TIMEOUT_MS} + * @param selector A ProgramSelector structure passed from tune() call; + * empty for step() and seek(). + */ + void onTuneFailed(in Result result, in ProgramSelector selector); + + /** + * Method called by the HAL when current program information (including + * metadata) is updated. It must be called when {@link IBroadcastRadio#tune} + * {@link IBroadcastRadio#seek} or {@link IBroadcastRadio#step} command + * succeeds. + * + * This is also called when the radio tuned to the static (not a valid + * station), see {@link ProgramInfo#FLAG_TUNABLE} flag. + * + * @param info Current program information. + */ + void onCurrentProgramInfoChanged(in ProgramInfo info); + + /** + * A delta update of the program list, called whenever there's a change in + * the list. + * + * If there are frequent changes, HAL implementation must throttle the rate + * of the updates. + * + * There is a hard limit on binder transaction buffer, and the list must + * not exceed it. For large lists, HAL implementation must split them to + * multiple chunks, no larger than 500kiB each, and call this program list + * update callback method separately. + * + * @param chunk A chunk of the program list update. + */ + void onProgramListUpdated(in ProgramListChunk chunk); + + /** + * Method called by the HAL when the antenna gets connected or disconnected. + * + * For broadcast radio service, client must assume the antenna is connected. + * If it's not, then antennaStateChange must be called within + * {@link IBroadcastRadio#ANTENNA_STATE_CHANGE_TIMEOUT_MS} to indicate that. + * + * @param connected {@code true} if the antenna is now connected, {@code false} + * otherwise. + */ + void onAntennaStateChange(in boolean connected); + + /** + * Generic callback for passing updates to config flags. + * + * It's up to the HAL implementation if and how to implement this callback, + * as long as it obeys the prefix rule. However, setConfigFlag must not + * trigger this callback, while an internal event can change config flag + * asynchronously at the HAL layer. + * + * @param flag Flag that has changed. + * @param value The new value of the given flag. + */ + void onConfigFlagUpdated(in ConfigFlag flag, in boolean value); + + /** + * Generic callback for passing updates to vendor-specific parameter values. + * The framework does not interpret the parameters, they are passed + * in an opaque manner between a vendor application and HAL. + * + * It's up to the HAL implementation if and how to implement this callback, + * as long as it obeys the prefix rule. In particular, only selected keys + * may be notified this way. However, setParameters must not trigger + * this callback, while an internal event can change parameters + * asynchronously at the HAL layer. + * + * @param parameters Vendor-specific key-value pairs, + * opaque to Android framework. + */ + void onParametersUpdated(in VendorKeyValue[] parameters); +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl new file mode 100644 index 0000000000..0484d02a9e --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl @@ -0,0 +1,163 @@ +/* + * 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. + */ + +package android.hardware.broadcastradio; + +/** + * Type of program identifier component. + * + * Each identifier type corresponds to exactly one radio technology, + * i.e. DAB_ENSEMBLE is specifically for DAB. + * + * VENDOR identifier types must be opaque to the framework. + * + * The value format for each (but VENDOR_*) identifier is strictly defined + * to maintain interoperability between devices made by different vendors. + * + * All other values are reserved for future use. + * Values not matching any enumerated constant must be ignored. + */ +@VintfStability +@Backing(type="int") +@JavaDerive(equals=true, toString=true) +enum IdentifierType { + /** + * Primary/secondary identifier for vendor-specific radio technology. + * The value format is determined by a vendor. + * + * The vendor identifiers have limited serialization capabilities - see + * ProgramSelector description. + */ + VENDOR_START = 1000, + + /** + * See VENDOR_START + */ + VENDOR_END = 1999, + + /** + * Undefined identifier type. + */ + INVALID = 0, + + /** + * Primary identifier for analogue (without RDS) AM/FM stations: + * frequency in kHz. + * + * This identifier also contains band information: + * - <500kHz: AM LW; + * - 500kHz - 1705kHz: AM MW; + * - 1.71MHz - 30MHz: AM SW; + * - >60MHz: FM. + */ + AMFM_FREQUENCY_KHZ, + + /** + * 16bit primary identifier for FM RDS station. + */ + RDS_PI, + + /** + * 64bit compound primary identifier for HD Radio. + * + * Consists of (from the LSB): + * - 32bit: Station ID number; + * - 4bit: HD Radio subchannel; + * - 18bit: AMFM_FREQUENCY_KHZ. + * + * While station ID number should be unique globally, it sometimes get + * abused by broadcasters (i.e. not being set at all). To ensure local + * uniqueness, AMFM_FREQUENCY_KHZ was added here. Global uniqueness is + * a best-effort - see HD_STATION_NAME. + * + * HD Radio subchannel is a value in range 0-7. + * This index is 0-based (where 0 is MPS and 1..7 are SPS), + * as opposed to HD Radio standard (where it's 1-based). + * + * The remaining bits should be set to zeros when writing on the chip side + * and ignored when read. + */ + + HD_STATION_ID_EXT, + + /** + * 64bit additional identifier for HD Radio. + * + * Due to Station ID abuse, some HD_STATION_ID_EXT identifiers may be not + * globally unique. To provide a best-effort solution, a short version of + * station name may be carried as additional identifier and may be used + * by the tuner hardware to double-check tuning. + * + * The name is limited to the first 8 A-Z0-9 characters (lowercase letters + * must be converted to uppercase). Encoded in little-endian ASCII: + * the first character of the name is the LSB. + * + * For example: "Abc" is encoded as 0x434241. + */ + HD_STATION_NAME, + + /** + * 28bit compound primary identifier for Digital Audio Broadcasting. + * + * Consists of (from the LSB): + * - 16bit: SId; + * - 8bit: ECC code; + * - 4bit: SCIdS. + * + * SCIdS (Service Component Identifier within the Service) value + * of 0 represents the main service, while 1 and above represents + * secondary services. + * + * The remaining bits should be set to zeros when writing on the chip side + * and ignored when read. + */ + DAB_SID_EXT, + + /** + * 16bit + */ + DAB_ENSEMBLE, + + /** + * 12bit + */ + DAB_SCID, + + /** + * kHz (see AMFM_FREQUENCY_KHZ) + */ + DAB_FREQUENCY_KHZ, + + /** + * 24bit primary identifier for Digital Radio Mondiale. + */ + DRMO_SERVICE_ID, + + /** + * kHz (see AMFM_FREQUENCY_KHZ) + */ + DRMO_FREQUENCY_KHZ, + + /** + * 32bit primary identifier for SiriusXM Satellite Radio. + */ + SXM_SERVICE_ID = DRMO_FREQUENCY_KHZ + 2, + + /** + * 0-999 range + */ + SXM_CHANNEL, +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/Metadata.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/Metadata.aidl new file mode 100644 index 0000000000..3298cac969 --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/Metadata.aidl @@ -0,0 +1,115 @@ +/* + * 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. + */ + +package android.hardware.broadcastradio; + +/** + * An element of metadata array. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +union Metadata { + /** + * RDS PS (string) + */ + String rdsPs; + + /** + * RDS PTY (uint8_t) + */ + int rdsPty; + + /** + * RBDS PTY (uint8_t) + */ + int rbdsPty; + + /** + * RDS RT (string) + */ + String rdsRt; + + /** + * Song title (string) + */ + String songTitle; + + /** + * Artist name (string) + */ + String songArtist; + + /** + * Album name (string) + */ + String songAlbum; + + /** + * Station icon (uint32_t, see {@link IBroadcastRadio#getImage}) + */ + int stationIcon; + + /** + * Album art (uint32_t, see {@link IBroadcastRadio#getImage}) + */ + int albumArt; + + /** + * Station name. + * + * This is a generic field to cover any radio technology. + * + * If the PROGRAM_NAME has the same content as DAB_*_NAME or RDS_PS, + * it may not be present, to preserve space - framework must repopulate + * it on the client side. + */ + String programName; + + /** + * DAB ensemble name (string) + */ + String dabEnsembleName; + + /** + * DAB ensemble name abbreviated (string). + * + * The string must be up to 8 characters long. + * + * If the short variant is present, the long (DAB_ENSEMBLE_NAME) one must be + * present as well. + */ + String dabEnsembleNameShort; + + /** + * DAB service name (string) + */ + String dabServiceName; + + /** + * DAB service name abbreviated (see DAB_ENSEMBLE_NAME_SHORT) (string) + */ + String dabServiceNameShort; + + /** + * DAB component name (string) + */ + String dabComponentName; + + /** + * DAB component name abbreviated (see DAB_ENSEMBLE_NAME_SHORT) (string) + */ + String dabComponentNameShort; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramFilter.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramFilter.aidl new file mode 100644 index 0000000000..3dd10eb81d --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramFilter.aidl @@ -0,0 +1,70 @@ +/* + * 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. + */ + +package android.hardware.broadcastradio; + +import android.hardware.broadcastradio.IdentifierType; +import android.hardware.broadcastradio.ProgramIdentifier; + +/** + * Large-grain filter to the program list. + * + * This is meant to reduce binder transaction bandwidth, not for fine-grained + * filtering user might expect. + * + * The filter is designed as conjunctive normal form: the entry that passes the + * filter must satisfy all the clauses (members of this struct). Vector clauses + * are disjunctions of literals. In other words, there is AND between each + * high-level group and OR inside it. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable ProgramFilter { + /** + * List of identifier types that are filtered by the filter. + * + * If the program list entry contains at least one identifier of the type + * listed, it satisfies this condition. + * + * Empty list means no filtering on identifier type. + */ + IdentifierType[] identifierTypes; + + /** + * List of identifiers that are filtered by the filter. + * + * If the program list entry contains at least one listed identifier, + * it satisfies this condition. + * + * Empty list means no filtering on identifier. + */ + ProgramIdentifier[] identifiers; + + /** + * Includes non-tunable entries that define tree structure on the + * program list (i.e. DAB ensembles). + */ + boolean includeCategories; + + /** + * Disables updates on entry modifications. + * + * If {@code true}, 'modified' vector of {@link ProgramListChunk} must contain + * list additions only. Once the program is added to the list, it's not + * updated anymore. + */ + boolean excludeModifications; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramIdentifier.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramIdentifier.aidl new file mode 100644 index 0000000000..2057d97eb0 --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramIdentifier.aidl @@ -0,0 +1,37 @@ +/* + * 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. + */ + +package android.hardware.broadcastradio; + +import android.hardware.broadcastradio.IdentifierType; + +/** + * A single program identifier component, i.e. frequency or channel ID. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable ProgramIdentifier { + /** + * Maps to IdentifierType enum. + */ + IdentifierType type = IdentifierType.INVALID; + + /** + * The uint64_t value field holds the value in format described in comments + * for IdentifierType enum. + */ + long value; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl new file mode 100644 index 0000000000..3e2c9cca7d --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl @@ -0,0 +1,173 @@ +/* + * 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. + */ + +package android.hardware.broadcastradio; + +import android.hardware.broadcastradio.Metadata; +import android.hardware.broadcastradio.ProgramIdentifier; +import android.hardware.broadcastradio.ProgramSelector; +import android.hardware.broadcastradio.VendorKeyValue; + +/** + * Program (channel, station) information. + * + * Carries both user-visible information (like station name) and technical + * details (tuning selector). + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable ProgramInfo { + /** + * Set when the program is currently playing live stream. + * This may result in a slightly altered reception parameters, + * usually targeted at reduced latency. + */ + const int FLAG_LIVE = 1 << 0; + + /** + * Radio stream is not playing, ie. due to bad reception conditions or + * buffering. In this state volume knob MAY be disabled to prevent user + * increasing volume too much. + */ + const int FLAG_MUTED = 1 << 1; + + /** + * Station broadcasts traffic information regularly, + * but not necessarily right now. + */ + const int FLAG_TRAFFIC_PROGRAM = 1 << 2; + + /** + * Station is broadcasting traffic information at the very moment. + */ + const int FLAG_TRAFFIC_ANNOUNCEMENT = 1 << 3; + + /** + * Station can be tuned to (not playing static). + * + * It's the same condition that would stop a seek operation + * (i.e. {@link IBroadcastRadio#seek}). + * + * By definition, this flag must be set for all items on the program list. + */ + const int FLAG_TUNABLE = 1 << 4; + + /** + * Audio stream is MONO if this bit is not set. + */ + const int FLAG_STEREO = 1 << 5; + + /** + * An identifier used to point at the program (primarily to tune to it). + * + * This field is required - its type field must not be set to + * {@link IdentifierType#INVALID}. + */ + ProgramSelector selector; + + /** + * Identifier currently used for program selection. + * + * It allows to determine which technology is currently used for reception. + * + * Some program selectors contain tuning information for different radio + * technologies (i.e. FM RDS and DAB). For example, user may tune using + * a ProgramSelector with RDS_PI primary identifier, but the tuner hardware + * may choose to use DAB technology to make actual tuning. This identifier + * must reflect that. + * + * This field is required for currently tuned program only. + * For all other items on the program list, its type field must be + * initialized to {@link IdentifierType#INVALID}. + * + * Only primary identifiers for a given radio technology are valid: + * - AMFM_FREQUENCY_KHZ for analog AM/FM; + * - RDS_PI for FM RDS; + * - HD_STATION_ID_EXT; + * - DAB_SID_EXT; + * - DRMO_SERVICE_ID; + * - SXM_SERVICE_ID; + * - VENDOR_*; + * - more might come in next minor versions of this HAL. + */ + ProgramIdentifier logicallyTunedTo; + + /** + * Identifier currently used by hardware to physically tune to a channel. + * + * Some radio technologies broadcast the same program on multiple channels, + * i.e. with RDS AF the same program may be broadcasted on multiple + * alternative frequencies; the same DAB program may be broadcast on + * multiple ensembles. This identifier points to the channel to which the + * radio hardware is physically tuned to. + * + * This field is required for currently tuned program only. + * For all other items on the program list, its type field must be + * initialized to {@link IdentifierType#INVALID}. + * + * Only physical identifiers are valid: + * - AMFM_FREQUENCY_KHZ; + * - DAB_ENSEMBLE; + * - DRMO_FREQUENCY_KHZ; + * - SXM_CHANNEL; + * - VENDOR_*; + * - more might come in next minor versions of this HAL. + */ + ProgramIdentifier physicallyTunedTo; + + /** + * Primary identifiers of related contents. + * + * Some radio technologies provide pointers to other programs that carry + * related content (i.e. DAB soft-links). This field is a list of pointers + * to other programs on the program list. + * + * This is not a list of programs that carry the same content (i.e. + * DAB hard-links, RDS AF). Switching to programs from this list usually + * require user action. + * + * Please note, that these identifiers do not have to exist on the program + * list - i.e. DAB tuner may provide information on FM RDS alternatives + * despite not supporting FM RDS. If the system has multiple tuners, another + * one may have it on its list. + * + * This field is optional. + */ + @nullable ProgramIdentifier[] relatedContent; + + /** + * Program flags. + */ + int infoFlags; + + /** + * Signal quality measured in 0% to 100% range to be shown in the UI. + */ + int signalQuality; + + /** + * Program metadata (station name, PTY, song title). + */ + Metadata[] metadata; + + /** + * Vendor-specific information. + * + * It may be used for extra features, not supported by the platform, + * for example: paid-service=true; bitrate=320kbps. + */ + VendorKeyValue[] vendorInfo; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramListChunk.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramListChunk.aidl new file mode 100644 index 0000000000..a62d461475 --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramListChunk.aidl @@ -0,0 +1,73 @@ +/* + * 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. + */ + +package android.hardware.broadcastradio; + +import android.hardware.broadcastradio.ProgramIdentifier; +import android.hardware.broadcastradio.ProgramInfo; + +/** + * An update packet of the program list. + * + * The order of entries in the arrays is unspecified. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable ProgramListChunk { + /** + * Treats all previously added entries as removed. + * + * This is meant to save binder transaction bandwidth on 'removed' array + * and provide a clear empty state. + * + * If set, 'removed' array must be null. + * + * The client may wait with taking action on this until it received the + * chunk with complete flag set (to avoid part of stations temporarily + * disappearing from the list). + */ + boolean purge; + + /** + * If false, it means there are still programs not transmitted, + * due for transmission in following updates. + * + * Used by UIs that wait for complete list instead of displaying + * programs while scanning. + * + * After the whole channel range was scanned and all discovered programs + * were transmitted, the last chunk must have set this flag to {@code true}. + * This must happen within {@link IBroadcastRadio#LIST_COMPLETE_TIMEOUT_MS} + * from the startProgramListUpdates call. If it doesn't, client may assume + * the tuner came into a bad state and display error message. + */ + boolean complete; + + /** + * Added or modified program list entries. + * + * Two entries with the same primaryId (ProgramSelector member) + * are considered the same. + */ + ProgramInfo[] modified; + + /** + * Removed program list entries. + * + * Contains primaryId (ProgramSelector member) of a program to remove. + */ + @nullable ProgramIdentifier[] removed; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramSelector.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramSelector.aidl new file mode 100644 index 0000000000..8bd3fd41e4 --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramSelector.aidl @@ -0,0 +1,74 @@ +/* + * 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. + */ + +package android.hardware.broadcastradio; + +import android.hardware.broadcastradio.ProgramIdentifier; + +/** + * A set of identifiers necessary to tune to a given station. + * + * This can hold a combination of various identifiers, like: + * - AM/FM frequency, + * - HD Radio subchannel, + * - DAB service ID. + * + * The type of radio technology is determined by the primary identifier - if the + * primary identifier is for DAB, the program is DAB. However, a program of a + * specific radio technology may have additional secondary identifiers for other + * technologies, i.e. a satellite program may have FM fallback frequency, + * if a station broadcasts both via satellite and FM. + * + * The identifiers from VENDOR_START..VENDOR_END range have limited + * serialization capabilities: they are serialized locally, but ignored by the + * cloud services. If a program has primary id from vendor range, it's not + * synchronized with other devices at all. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable ProgramSelector { + /** + * Primary program identifier. + * + * This identifier uniquely identifies a station and can be used for + * equality check. + * + * It can hold only a subset of identifier types, one per each + * radio technology: + * - analogue AM/FM: AMFM_FREQUENCY_KHZ; + * - FM RDS: RDS_PI; + * - HD Radio: HD_STATION_ID_EXT; + * - DAB: DAB_SID_EXT; + * - Digital Radio Mondiale: DRMO_SERVICE_ID; + * - SiriusXM: SXM_SERVICE_ID; + * - vendor-specific: VENDOR_START..VENDOR_END. + */ + ProgramIdentifier primaryId; + + /** + * Secondary program identifiers. + * + * These identifiers are supplementary and can speed up tuning process, + * but the primary ID must be sufficient (i.e. RDS PI is enough to select + * a station from the list after a full band scan). + * + * Two selectors with different secondary IDs, but the same primary ID are + * considered equal. In particular, secondary IDs array may get updated for + * an entry on the program list (ie. when a better frequency for a given + * station is found). + */ + ProgramIdentifier[] secondaryIds; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/Properties.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/Properties.aidl new file mode 100644 index 0000000000..36cbaffafb --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/Properties.aidl @@ -0,0 +1,76 @@ +/* + * 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. + */ + +package android.hardware.broadcastradio; + +import android.hardware.broadcastradio.IdentifierType; +import android.hardware.broadcastradio.VendorKeyValue; + +/** + * Properties of a given broadcast radio module. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable Properties { + /** + * A company name who made the radio module. Must be a valid, registered + * name of the company itself. + * + * It must be opaque to the Android framework. + */ + String maker; + + /** + * A product name. Must be unique within the company. + * + * It must be opaque to the Android framework. + */ + String product; + + /** + * Version of the hardware module. + * + * It must be opaque to the Android framework. + */ + String version; + + /** + * Hardware serial number (for subscription services). + * + * It must be opaque to the Android framework. + */ + String serial; + + /** + * A list of supported {@link IdentifierType} values. + * + * If an identifier is supported by radio module, it means it can use it for + * tuning to ProgramSelector with either primary or secondary Identifier of + * a given type. + * + * Support for VENDOR identifier type does not guarantee compatibility, as + * other module properties (implementor, product, version) must be checked. + */ + IdentifierType[] supportedIdentifierTypes; + + /** + * Vendor-specific information. + * + * It may be used for extra features, not supported by the platform, + * for example: com.me.preset-slots=6; com.me.ultra-hd-capable={@code false}. + */ + VendorKeyValue[] vendorInfo; +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl new file mode 100644 index 0000000000..9985ccbfd7 --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl @@ -0,0 +1,61 @@ +/* + * 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. + */ + +package android.hardware.broadcastradio; + +/** + * Result for methods of BroadcastRadio AIDL HAL interfaces. + */ +@VintfStability +@Backing(type="int") +enum Result { + /** + * Methods run without error. + */ + OK, + + /** + * Internal error in HAL. + */ + INTERNAL_ERROR, + + /** + * Error used when the input argument for the method is invalid. + */ + INVALID_ARGUMENTS, + + /** + * Error used when the service is of invalid state (i.e. callback + * is not registered for IBroadcastRadio). + */ + INVALID_STATE, + + /** + * Error used when an operation is not supported. + */ + NOT_SUPPORTED, + + /** + * Error used when a tune, seek, step or operation is not completed + * within {@link IBroadcastRadio#LIST_COMPLETE_TIMEOUT_MS}. + */ + TIMEOUT, + + /** + * Error that does not follow into the error categories above. + */ + UNKNOWN_ERROR, +} diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/VendorKeyValue.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/VendorKeyValue.aidl new file mode 100644 index 0000000000..c923e926f8 --- /dev/null +++ b/broadcastradio/aidl/android/hardware/broadcastradio/VendorKeyValue.aidl @@ -0,0 +1,37 @@ +/* + * 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. + */ + +package android.hardware.broadcastradio; + +/** + * A key-value pair for vendor-specific information to be passed as-is through + * Android framework to the front-end application. + */ +@VintfStability +@JavaDerive(equals=true, toString=true) +parcelable VendorKeyValue { + /** + * Key must start with unique vendor Java-style namespace, + * eg. 'com.somecompany.parameter1'. + */ + String key; + + /** + * Value must be passed through the framework without any changes. + * Format of this string can vary across vendors. + */ + String value; +} diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 4b4589d24f..9a939d1eeb 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -152,17 +152,8 @@ default - + android.hardware.broadcastradio - 1.0-1 - - IBroadcastRadioFactory - default - - - - android.hardware.broadcastradio - 2.0 IBroadcastRadio .* From b2a6ca682808b9faf0f287dde5c3d26620b41628 Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Sun, 8 May 2022 23:47:04 +0000 Subject: [PATCH 257/998] Default implementation for BroadcastRadio AIDL HAL Default implementation for BroadcastRadio AIDL HAL is based on default implementation for HIDL 2.0, with necessary data type conversion. The callback for IBroadcastRadio interface is initialized as nullptr. Bug: 170336130 Test: m -j Change-Id: Id521573116c565c42af16333cad73c5dd0583420 --- broadcastradio/aidl/default/Android.bp | 54 ++ .../aidl/default/BroadcastRadio.cpp | 473 +++++++++++++++++ broadcastradio/aidl/default/BroadcastRadio.h | 82 +++ .../aidl/default/VirtualProgram.cpp | 100 ++++ broadcastradio/aidl/default/VirtualProgram.h | 51 ++ broadcastradio/aidl/default/VirtualRadio.cpp | 84 +++ broadcastradio/aidl/default/VirtualRadio.h | 48 ++ .../aidl/default/broadcastradio-default.rc | 6 + .../aidl/default/broadcastradio-default.xml | 7 + broadcastradio/aidl/default/main.cpp | 51 ++ broadcastradio/aidl/default/resources.h | 36 ++ broadcastradio/common/utilsaidl/Android.bp | 50 ++ broadcastradio/common/utilsaidl/Utils.cpp | 477 ++++++++++++++++++ .../include/broadcastradio-utils-aidl/Utils.h | 174 +++++++ 14 files changed, 1693 insertions(+) create mode 100644 broadcastradio/aidl/default/Android.bp create mode 100644 broadcastradio/aidl/default/BroadcastRadio.cpp create mode 100644 broadcastradio/aidl/default/BroadcastRadio.h create mode 100644 broadcastradio/aidl/default/VirtualProgram.cpp create mode 100644 broadcastradio/aidl/default/VirtualProgram.h create mode 100644 broadcastradio/aidl/default/VirtualRadio.cpp create mode 100644 broadcastradio/aidl/default/VirtualRadio.h create mode 100644 broadcastradio/aidl/default/broadcastradio-default.rc create mode 100644 broadcastradio/aidl/default/broadcastradio-default.xml create mode 100644 broadcastradio/aidl/default/main.cpp create mode 100644 broadcastradio/aidl/default/resources.h create mode 100644 broadcastradio/common/utilsaidl/Android.bp create mode 100644 broadcastradio/common/utilsaidl/Utils.cpp create mode 100644 broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h diff --git a/broadcastradio/aidl/default/Android.bp b/broadcastradio/aidl/default/Android.bp new file mode 100644 index 0000000000..720aa8a6fd --- /dev/null +++ b/broadcastradio/aidl/default/Android.bp @@ -0,0 +1,54 @@ +// +// 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. +// + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_binary { + name: "android.hardware.broadcastradio-service.default", + relative_install_path: "hw", + init_rc: ["broadcastradio-default.rc"], + vintf_fragments: ["broadcastradio-default.xml"], + vendor: true, + cflags: [ + "-Wall", + "-Wextra", + "-Werror", + ], + srcs: [ + "BroadcastRadio.cpp", + "main.cpp", + "VirtualProgram.cpp", + "VirtualRadio.cpp", + ], + static_libs: [ + "android.hardware.broadcastradio@common-utils-aidl-lib", + "android.hardware.broadcastradio@common-utils-lib", + ], + shared_libs: [ + "android.hardware.broadcastradio-V1-ndk", + "libbase", + "libbinder_ndk", + "liblog", + "libcutils", + ], +} diff --git a/broadcastradio/aidl/default/BroadcastRadio.cpp b/broadcastradio/aidl/default/BroadcastRadio.cpp new file mode 100644 index 0000000000..57c5133bd1 --- /dev/null +++ b/broadcastradio/aidl/default/BroadcastRadio.cpp @@ -0,0 +1,473 @@ +/* + * 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. + */ + +#include "BroadcastRadio.h" +#include +#include "resources.h" + +#include +#include + +#include + +namespace aidl::android::hardware::broadcastradio { + +using ::aidl::android::hardware::broadcastradio::utils::resultToInt; +using ::aidl::android::hardware::broadcastradio::utils::tunesTo; +using ::ndk::ScopedAStatus; +using ::std::literals::chrono_literals::operator""ms; +using ::std::literals::chrono_literals::operator""s; +using ::std::lock_guard; +using ::std::mutex; +using ::std::string; +using ::std::vector; + +namespace { + +inline constexpr std::chrono::milliseconds kSeekDelayTimeMs = 200ms; +inline constexpr std::chrono::milliseconds kStepDelayTimeMs = 100ms; +inline constexpr std::chrono::milliseconds kTuneDelayTimeMs = 150ms; +inline constexpr std::chrono::seconds kListDelayTimeS = 1s; + +// clang-format off +const AmFmRegionConfig kDefaultAmFmConfig = { + { + {87500, 108000, 100, 100}, // FM + {153, 282, 3, 9}, // AM LW + {531, 1620, 9, 9}, // AM MW + {1600, 30000, 1, 5}, // AM SW + }, + AmFmRegionConfig::DEEMPHASIS_D50, + AmFmRegionConfig::RDS}; +// clang-format on + +Properties initProperties(const VirtualRadio& virtualRadio) { + Properties prop = {}; + + prop.maker = "Android"; + prop.product = virtualRadio.getName(); + prop.supportedIdentifierTypes = vector({ + IdentifierType::AMFM_FREQUENCY_KHZ, + IdentifierType::RDS_PI, + IdentifierType::HD_STATION_ID_EXT, + IdentifierType::DAB_SID_EXT, + }); + prop.vendorInfo = vector({ + {"com.android.sample", "sample"}, + }); + + return prop; +} + +// Makes ProgramInfo that does not point to any particular program +ProgramInfo makeSampleProgramInfo(const ProgramSelector& selector) { + ProgramInfo info = {}; + info.selector = selector; + info.logicallyTunedTo = + utils::makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, + utils::getId(selector, IdentifierType::AMFM_FREQUENCY_KHZ)); + info.physicallyTunedTo = info.logicallyTunedTo; + return info; +} + +} // namespace + +BroadcastRadio::BroadcastRadio(const VirtualRadio& virtualRadio) + : mVirtualRadio(virtualRadio), + mAmFmConfig(kDefaultAmFmConfig), + mProperties(initProperties(virtualRadio)) { + const auto& ranges = kDefaultAmFmConfig.ranges; + if (ranges.size() > 0) { + ProgramSelector sel = utils::makeSelectorAmfm(ranges[0].lowerBound); + VirtualProgram virtualProgram = {}; + if (mVirtualRadio.getProgram(sel, &virtualProgram)) { + mCurrentProgram = virtualProgram.selector; + } else { + mCurrentProgram = sel; + } + } +} + +BroadcastRadio::~BroadcastRadio() { + mThread.reset(); +} + +ScopedAStatus BroadcastRadio::getAmFmRegionConfig(bool full, AmFmRegionConfig* returnConfigs) { + if (full) { + *returnConfigs = {}; + returnConfigs->ranges = vector({ + {65000, 108000, 10, 0}, // FM + {150, 30000, 1, 0}, // AM + }); + returnConfigs->fmDeemphasis = + AmFmRegionConfig::DEEMPHASIS_D50 | AmFmRegionConfig::DEEMPHASIS_D75; + returnConfigs->fmRds = AmFmRegionConfig::RDS | AmFmRegionConfig::RBDS; + return ScopedAStatus::ok(); + } + lock_guard lk(mMutex); + *returnConfigs = mAmFmConfig; + return ScopedAStatus::ok(); +} + +ScopedAStatus BroadcastRadio::getDabRegionConfig(vector* returnConfigs) { + *returnConfigs = { + {"5A", 174928}, {"7D", 194064}, {"8A", 195936}, {"8B", 197648}, {"9A", 202928}, + {"9B", 204640}, {"9C", 206352}, {"10B", 211648}, {"10C", 213360}, {"10D", 215072}, + {"11A", 216928}, {"11B", 218640}, {"11C", 220352}, {"11D", 222064}, {"12A", 223936}, + {"12B", 225648}, {"12C", 227360}, {"12D", 229072}, + }; + return ScopedAStatus::ok(); +} + +ScopedAStatus BroadcastRadio::getImage(int32_t id, vector* returnImage) { + LOG(DEBUG) << __func__ << ": fetching image " << std::hex << id; + + if (id == resources::kDemoPngId) { + *returnImage = vector(resources::kDemoPng, std::end(resources::kDemoPng)); + return ScopedAStatus::ok(); + } + + LOG(WARNING) << __func__ << ": image of id " << std::hex << id << " doesn't exist"; + *returnImage = {}; + return ScopedAStatus::ok(); +} + +ScopedAStatus BroadcastRadio::getProperties(Properties* returnProperties) { + lock_guard lk(mMutex); + *returnProperties = mProperties; + return ScopedAStatus::ok(); +} + +ProgramInfo BroadcastRadio::tuneInternalLocked(const ProgramSelector& sel) { + LOG(DEBUG) << __func__ << ": tune (internal) to " << sel.toString(); + + VirtualProgram virtualProgram = {}; + ProgramInfo programInfo; + if (mVirtualRadio.getProgram(sel, &virtualProgram)) { + mCurrentProgram = virtualProgram.selector; + programInfo = virtualProgram; + } else { + mCurrentProgram = sel; + programInfo = makeSampleProgramInfo(sel); + } + mIsTuneCompleted = true; + + return programInfo; +} + +ScopedAStatus BroadcastRadio::setTunerCallback(const std::shared_ptr& callback) { + LOG(DEBUG) << __func__ << ": setTunerCallback"; + + if (callback == nullptr) { + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + resultToInt(Result::INVALID_ARGUMENTS), "cannot set tuner callback to null"); + } + + lock_guard lk(mMutex); + mCallback = callback; + + return ScopedAStatus::ok(); +} + +ScopedAStatus BroadcastRadio::unsetTunerCallback() { + LOG(DEBUG) << __func__ << ": unsetTunerCallback"; + + lock_guard lk(mMutex); + mCallback = nullptr; + + return ScopedAStatus::ok(); +} + +ScopedAStatus BroadcastRadio::tune(const ProgramSelector& program) { + LOG(DEBUG) << __func__ << ": tune to " << program.toString() << "..."; + + lock_guard lk(mMutex); + if (mCallback == nullptr) { + LOG(ERROR) << __func__ << ": callback is not registered."; + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + resultToInt(Result::INVALID_STATE), "callback is not registered"); + } + + if (!utils::isSupported(mProperties, program)) { + LOG(WARNING) << __func__ << ": selector not supported: " << program.toString(); + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + resultToInt(Result::NOT_SUPPORTED), "selector is not supported"); + } + + if (!utils::isValid(program)) { + LOG(ERROR) << __func__ << ": selector is not valid: " << program.toString(); + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + resultToInt(Result::INVALID_ARGUMENTS), "selector is not valid"); + } + + cancelLocked(); + + mIsTuneCompleted = false; + std::shared_ptr callback = mCallback; + auto task = [this, program, callback]() { + ProgramInfo programInfo = {}; + { + lock_guard lk(mMutex); + programInfo = tuneInternalLocked(program); + } + callback->onCurrentProgramInfoChanged(programInfo); + }; + mThread->schedule(task, kTuneDelayTimeMs); + + return ScopedAStatus::ok(); +} + +ScopedAStatus BroadcastRadio::seek(bool directionUp, bool skipSubChannel) { + LOG(DEBUG) << __func__ << ": seek " << (directionUp ? "up" : "down") << " with skipSubChannel? " + << (skipSubChannel ? "yes" : "no") << "..."; + + lock_guard lk(mMutex); + if (mCallback == nullptr) { + LOG(ERROR) << __func__ << ": callback is not registered."; + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + resultToInt(Result::INVALID_STATE), "callback is not registered"); + } + + cancelLocked(); + + const auto& list = mVirtualRadio.getProgramList(); + std::shared_ptr callback = mCallback; + if (list.empty()) { + mIsTuneCompleted = false; + auto task = [callback]() { + LOG(DEBUG) << "seek: program list is empty, seek couldn't stop"; + + callback->onTuneFailed(Result::TIMEOUT, {}); + }; + mThread->schedule(task, kSeekDelayTimeMs); + + return ScopedAStatus::ok(); + } + + // The list is not sorted here since it has already stored in VirtualRadio. + // If the list is not sorted in advance, it should be sorted here. + const auto& current = mCurrentProgram; + auto found = std::lower_bound(list.begin(), list.end(), VirtualProgram({current})); + if (directionUp) { + if (found < list.end() - 1) { + if (tunesTo(current, found->selector)) found++; + } else { + found = list.begin(); + } + } else { + if (found > list.begin() && found != list.end()) { + found--; + } else { + found = list.end() - 1; + } + } + const ProgramSelector tuneTo = found->selector; + + mIsTuneCompleted = false; + auto task = [this, tuneTo, callback]() { + ProgramInfo programInfo = {}; + { + lock_guard lk(mMutex); + programInfo = tuneInternalLocked(tuneTo); + } + callback->onCurrentProgramInfoChanged(programInfo); + }; + mThread->schedule(task, kSeekDelayTimeMs); + + return ScopedAStatus::ok(); +} + +ScopedAStatus BroadcastRadio::step(bool directionUp) { + LOG(DEBUG) << __func__ << ": step " << (directionUp ? "up" : "down") << "..."; + + lock_guard lk(mMutex); + if (mCallback == nullptr) { + LOG(ERROR) << __func__ << ": callback is not registered."; + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + resultToInt(Result::INVALID_STATE), "callback is not registered"); + } + + cancelLocked(); + + if (!utils::hasId(mCurrentProgram, IdentifierType::AMFM_FREQUENCY_KHZ)) { + LOG(WARNING) << __func__ << ": can't step in anything else than AM/FM"; + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + resultToInt(Result::NOT_SUPPORTED), "cannot step in anything else than AM/FM"); + } + + int64_t stepTo = utils::getId(mCurrentProgram, IdentifierType::AMFM_FREQUENCY_KHZ); + std::optional range = getAmFmRangeLocked(); + if (!range) { + LOG(ERROR) << __func__ << ": can't find current band or tune operation is in process"; + ScopedAStatus::fromServiceSpecificErrorWithMessage( + resultToInt(Result::INTERNAL_ERROR), + "can't find current band or tune operation is in process"); + } + + if (directionUp) { + stepTo += range->spacing; + } else { + stepTo -= range->spacing; + } + if (stepTo > range->upperBound) { + stepTo = range->lowerBound; + } + if (stepTo < range->lowerBound) { + stepTo = range->upperBound; + } + + mIsTuneCompleted = false; + std::shared_ptr callback = mCallback; + auto task = [this, stepTo, callback]() { + ProgramInfo programInfo; + { + lock_guard lk(mMutex); + programInfo = tuneInternalLocked(utils::makeSelectorAmfm(stepTo)); + } + callback->onCurrentProgramInfoChanged(programInfo); + }; + mThread->schedule(task, kStepDelayTimeMs); + + return ScopedAStatus::ok(); +} + +void BroadcastRadio::cancelLocked() { + LOG(DEBUG) << __func__ << ": cancelling current operations..."; + + mThread->cancelAll(); + if (mCurrentProgram.primaryId.type != IdentifierType::INVALID) { + mIsTuneCompleted = true; + } +} + +ScopedAStatus BroadcastRadio::cancel() { + LOG(DEBUG) << __func__ << ": cancel pending tune, seek and step..."; + + lock_guard lk(mMutex); + cancelLocked(); + + return ScopedAStatus::ok(); +} + +ScopedAStatus BroadcastRadio::startProgramListUpdates(const ProgramFilter& filter) { + LOG(DEBUG) << __func__ << ": requested program list updates, filter = " << filter.toString() + << "..."; + + auto filterCb = [&filter](const VirtualProgram& program) { + return utils::satisfies(filter, program.selector); + }; + + lock_guard lk(mMutex); + + const auto& list = mVirtualRadio.getProgramList(); + vector filteredList; + std::copy_if(list.begin(), list.end(), std::back_inserter(filteredList), filterCb); + + auto task = [this, filteredList]() { + std::shared_ptr callback; + { + lock_guard lk(mMutex); + if (mCallback == nullptr) { + LOG(WARNING) << "Callback is null when updating program List"; + return; + } + callback = mCallback; + } + + ProgramListChunk chunk = {}; + chunk.purge = true; + chunk.complete = true; + chunk.modified = vector(filteredList.begin(), filteredList.end()); + + callback->onProgramListUpdated(chunk); + }; + mThread->schedule(task, kListDelayTimeS); + + return ScopedAStatus::ok(); +} + +ScopedAStatus BroadcastRadio::stopProgramListUpdates() { + LOG(DEBUG) << __func__ << ": requested program list updates to stop..."; + // TODO(b/243681584) Implement stop program list updates method + return ScopedAStatus::ok(); +} + +ScopedAStatus BroadcastRadio::isConfigFlagSet(ConfigFlag flag, [[maybe_unused]] bool* returnIsSet) { + LOG(DEBUG) << __func__ << ": flag = " << toString(flag); + + LOG(INFO) << __func__ << ": getting ConfigFlag is not supported"; + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + resultToInt(Result::NOT_SUPPORTED), "getting ConfigFlag is not supported"); +} + +ScopedAStatus BroadcastRadio::setConfigFlag(ConfigFlag flag, bool value) { + LOG(DEBUG) << __func__ << ": flag = " << toString(flag) << ", value = " << value; + + LOG(INFO) << __func__ << ": setting ConfigFlag is not supported"; + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + resultToInt(Result::NOT_SUPPORTED), "setting ConfigFlag is not supported"); +} + +ScopedAStatus BroadcastRadio::setParameters( + [[maybe_unused]] const vector& parameters, + vector* returnParameters) { + // TODO(b/243682330) Support vendor parameter functionality + *returnParameters = {}; + return ScopedAStatus::ok(); +} + +ScopedAStatus BroadcastRadio::getParameters([[maybe_unused]] const vector& keys, + vector* returnParameters) { + // TODO(b/243682330) Support vendor parameter functionality + *returnParameters = {}; + return ScopedAStatus::ok(); +} + +std::optional BroadcastRadio::getAmFmRangeLocked() const { + if (!mIsTuneCompleted) { + LOG(WARNING) << __func__ << ": tune operation is in process"; + return {}; + } + if (!utils::hasId(mCurrentProgram, IdentifierType::AMFM_FREQUENCY_KHZ)) { + LOG(WARNING) << __func__ << ": current program does not has AMFM_FREQUENCY_KHZ identifier"; + return {}; + } + + int64_t freq = utils::getId(mCurrentProgram, IdentifierType::AMFM_FREQUENCY_KHZ); + for (const auto& range : mAmFmConfig.ranges) { + if (range.lowerBound <= freq && range.upperBound >= freq) { + return range; + } + } + + return {}; +} + +ScopedAStatus BroadcastRadio::registerAnnouncementListener( + [[maybe_unused]] const std::shared_ptr& listener, + const vector& enabled, std::shared_ptr* returnCloseHandle) { + LOG(DEBUG) << __func__ << ": registering announcement listener for " + << utils::vectorToString(enabled); + + // TODO(b/243683842) Support announcement listener + *returnCloseHandle = nullptr; + LOG(INFO) << __func__ << ": registering announcementListener is not supported"; + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + resultToInt(Result::NOT_SUPPORTED), + "registering announcementListener is not supported"); +} + +} // namespace aidl::android::hardware::broadcastradio diff --git a/broadcastradio/aidl/default/BroadcastRadio.h b/broadcastradio/aidl/default/BroadcastRadio.h new file mode 100644 index 0000000000..52d394e8e5 --- /dev/null +++ b/broadcastradio/aidl/default/BroadcastRadio.h @@ -0,0 +1,82 @@ +/* + * 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. + */ + +#pragma once + +#include "VirtualRadio.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +namespace aidl::android::hardware::broadcastradio { + +class BroadcastRadio final : public BnBroadcastRadio { + public: + explicit BroadcastRadio(const VirtualRadio& virtualRadio); + ~BroadcastRadio(); + ndk::ScopedAStatus getAmFmRegionConfig(bool full, AmFmRegionConfig* returnConfigs) override; + ndk::ScopedAStatus getDabRegionConfig(std::vector* returnConfigs) override; + ndk::ScopedAStatus getImage(int32_t id, std::vector* returnImage) override; + ndk::ScopedAStatus getProperties(Properties* returnProperties) override; + + ndk::ScopedAStatus setTunerCallback(const std::shared_ptr& callback) override; + ndk::ScopedAStatus unsetTunerCallback() override; + ndk::ScopedAStatus tune(const ProgramSelector& program) override; + ndk::ScopedAStatus seek(bool directionUp, bool skipSubChannel) override; + ndk::ScopedAStatus step(bool directionUp) override; + ndk::ScopedAStatus cancel() override; + ndk::ScopedAStatus startProgramListUpdates(const ProgramFilter& filter) override; + ndk::ScopedAStatus stopProgramListUpdates() override; + ndk::ScopedAStatus isConfigFlagSet(ConfigFlag flag, bool* returnIsSet) override; + ndk::ScopedAStatus setConfigFlag(ConfigFlag flag, bool in_value) override; + ndk::ScopedAStatus setParameters(const std::vector& parameters, + std::vector* returnParameters) override; + ndk::ScopedAStatus getParameters(const std::vector& keys, + std::vector* returnParameters) override; + ndk::ScopedAStatus registerAnnouncementListener( + const std::shared_ptr& listener, + const std::vector& enabled, + std::shared_ptr* returnCloseHandle) override; + + private: + const VirtualRadio& mVirtualRadio; + std::mutex mMutex; + AmFmRegionConfig mAmFmConfig GUARDED_BY(mMutex); + std::unique_ptr<::android::WorkerThread> mThread GUARDED_BY(mMutex) = + std::unique_ptr<::android::WorkerThread>(new ::android::WorkerThread()); + bool mIsTuneCompleted GUARDED_BY(mMutex) = true; + Properties mProperties GUARDED_BY(mMutex); + ProgramSelector mCurrentProgram GUARDED_BY(mMutex) = {}; + std::shared_ptr mCallback GUARDED_BY(mMutex); + + std::optional getAmFmRangeLocked() const; + void cancelLocked(); + ProgramInfo tuneInternalLocked(const ProgramSelector& sel); +}; + +} // namespace aidl::android::hardware::broadcastradio diff --git a/broadcastradio/aidl/default/VirtualProgram.cpp b/broadcastradio/aidl/default/VirtualProgram.cpp new file mode 100644 index 0000000000..0df0a82fa4 --- /dev/null +++ b/broadcastradio/aidl/default/VirtualProgram.cpp @@ -0,0 +1,100 @@ +/* + * 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. + */ + +#include "VirtualProgram.h" + +#include +#include "resources.h" + +#include + +namespace aidl::android::hardware::broadcastradio { + +using ::std::vector; + +VirtualProgram::operator ProgramInfo() const { + ProgramInfo info = {}; + + info.selector = selector; + + IdentifierType programType = selector.primaryId.type; + bool isDigital = (programType != IdentifierType::AMFM_FREQUENCY_KHZ && + programType != IdentifierType::RDS_PI); + + auto selectId = [&info](const IdentifierType& type) { + return utils::makeIdentifier(type, utils::getId(info.selector, type)); + }; + + switch (programType) { + case IdentifierType::AMFM_FREQUENCY_KHZ: + info.logicallyTunedTo = info.physicallyTunedTo = + selectId(IdentifierType::AMFM_FREQUENCY_KHZ); + break; + case IdentifierType::RDS_PI: + info.logicallyTunedTo = selectId(IdentifierType::RDS_PI); + info.physicallyTunedTo = selectId(IdentifierType::AMFM_FREQUENCY_KHZ); + break; + case IdentifierType::HD_STATION_ID_EXT: + info.logicallyTunedTo = selectId(IdentifierType::HD_STATION_ID_EXT); + info.physicallyTunedTo = selectId(IdentifierType::AMFM_FREQUENCY_KHZ); + break; + case IdentifierType::DAB_SID_EXT: + info.logicallyTunedTo = selectId(IdentifierType::DAB_SID_EXT); + info.physicallyTunedTo = selectId(IdentifierType::DAB_ENSEMBLE); + break; + case IdentifierType::DRMO_SERVICE_ID: + info.logicallyTunedTo = selectId(IdentifierType::DRMO_SERVICE_ID); + info.physicallyTunedTo = selectId(IdentifierType::DRMO_FREQUENCY_KHZ); + break; + case IdentifierType::SXM_SERVICE_ID: + info.logicallyTunedTo = selectId(IdentifierType::SXM_SERVICE_ID); + info.physicallyTunedTo = selectId(IdentifierType::SXM_CHANNEL); + break; + default: + LOG(FATAL) << "unsupported program type: " << toString(programType); + return {}; + } + + info.infoFlags |= (ProgramInfo::FLAG_TUNABLE | ProgramInfo::FLAG_STEREO); + info.signalQuality = isDigital ? kSignalQualityDigital : kSignalQualityNonDigital; + + info.metadata = vector({ + Metadata::make(programName), + Metadata::make(songTitle), + Metadata::make(songArtist), + Metadata::make(resources::kDemoPngId), + Metadata::make(resources::kDemoPngId), + }); + + info.vendorInfo = vector({ + {"com.android.sample", "sample"}, + {"com.android.sample.VirtualProgram", "VirtualProgram"}, + }); + + return info; +} + +bool operator<(const VirtualProgram& lhs, const VirtualProgram& rhs) { + auto& l = lhs.selector; + auto& r = rhs.selector; + + // Two programs with the same primaryId are considered the same. + if (l.primaryId.type != r.primaryId.type) return l.primaryId.type < r.primaryId.type; + + return l.primaryId.value < r.primaryId.value; +} + +} // namespace aidl::android::hardware::broadcastradio diff --git a/broadcastradio/aidl/default/VirtualProgram.h b/broadcastradio/aidl/default/VirtualProgram.h new file mode 100644 index 0000000000..0c20721bf2 --- /dev/null +++ b/broadcastradio/aidl/default/VirtualProgram.h @@ -0,0 +1,51 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include + +namespace aidl::android::hardware::broadcastradio { + +constexpr int kSignalQualityDigital = 100; +constexpr int kSignalQualityNonDigital = 80; +/** + * A radio program mock. + * + * This represents broadcast waves flying over the air, + * not an entry for a captured station in the radio tuner memory. + */ +struct VirtualProgram { + ProgramSelector selector; + + std::string programName = ""; + std::string songArtist = ""; + std::string songTitle = ""; + + operator ProgramInfo() const; + + /** + * Defines order in which virtual programs appear on the "air" with + * ITunerSession::scan(). + * + * It's for default implementation purposes, may not be complete or correct. + */ + friend bool operator<(const VirtualProgram& lhs, const VirtualProgram& rhs); +}; + +} // namespace aidl::android::hardware::broadcastradio diff --git a/broadcastradio/aidl/default/VirtualRadio.cpp b/broadcastradio/aidl/default/VirtualRadio.cpp new file mode 100644 index 0000000000..851543b0aa --- /dev/null +++ b/broadcastradio/aidl/default/VirtualRadio.cpp @@ -0,0 +1,84 @@ +/* + * 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. + */ + +#include "VirtualRadio.h" +#include + +namespace aidl::android::hardware::broadcastradio { + +using ::aidl::android::hardware::broadcastradio::utils::makeSelectorAmfm; +using ::aidl::android::hardware::broadcastradio::utils::makeSelectorDab; +using ::std::string; +using ::std::vector; + +VirtualRadio::VirtualRadio(const string& name, const vector& initialList) + : mName(name), mPrograms(initialList) { + sort(mPrograms.begin(), mPrograms.end()); +} + +string VirtualRadio::getName() const { + return mName; +} + +const vector& VirtualRadio::getProgramList() const { + return mPrograms; +} + +bool VirtualRadio::getProgram(const ProgramSelector& selector, VirtualProgram* programOut) const { + for (const auto& program : mPrograms) { + if (utils::tunesTo(selector, program.selector)) { + *programOut = program; + return true; + } + } + return false; +} + +// get singleton of AMFM Virtual Radio +const VirtualRadio& VirtualRadio::getAmFmRadio() { + // clang-format off + static VirtualRadio amFmRadioMock( + "AM/FM radio mock", + { + {makeSelectorAmfm(94900), "Wild 94.9", "Drake ft. Rihanna", "Too Good"}, + {makeSelectorAmfm(96500), "KOIT", "Celine Dion", "All By Myself"}, + {makeSelectorAmfm(97300), "Alice@97.3", "Drops of Jupiter", "Train"}, + {makeSelectorAmfm(99700), "99.7 Now!", "The Chainsmokers", "Closer"}, + {makeSelectorAmfm(101300), "101-3 KISS-FM", "Justin Timberlake", "Rock Your Body"}, + {makeSelectorAmfm(103700), "iHeart80s @ 103.7", "Michael Jackson", "Billie Jean"}, + {makeSelectorAmfm(106100), "106 KMEL", "Drake", "Marvins Room"}, + {makeSelectorAmfm(700), "700 AM", "Artist700", "Title700"}, + {makeSelectorAmfm(1700), "1700 AM", "Artist1700", "Title1700"}, + }); + // clang-format on + return amFmRadioMock; +} + +// get singleton of DAB Virtual Radio +const VirtualRadio& VirtualRadio::getDabRadio() { + // clang-format off + static VirtualRadio dabRadioMock( + "DAB radio mock", + { + {makeSelectorDab(0xA00001u, 0x0001u), "BBC Radio 1", "Khalid", "Talk"}, + {makeSelectorDab(0xB00001u, 0x1001u), "Classic FM", "Jean Sibelius", "Andante Festivo"}, + {makeSelectorDab(0xB00002u, 0x1001u), "Absolute Radio", "Coldplay", "Clocks"}, + }); + // clang-format on + return dabRadioMock; +} + +} // namespace aidl::android::hardware::broadcastradio diff --git a/broadcastradio/aidl/default/VirtualRadio.h b/broadcastradio/aidl/default/VirtualRadio.h new file mode 100644 index 0000000000..ae039c463c --- /dev/null +++ b/broadcastradio/aidl/default/VirtualRadio.h @@ -0,0 +1,48 @@ +/* + * 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. + */ + +#pragma once + +#include "VirtualProgram.h" + +#include + +namespace aidl::android::hardware::broadcastradio { + +/** + * A radio frequency space mock. + * + * This represents all broadcast waves in the air for a given radio technology, + * not a captured station list in the radio tuner memory. + * + * It's meant to abstract out radio content from default tuner implementation. + */ +class VirtualRadio final { + public: + VirtualRadio(const std::string& name, const std::vector& initialList); + std::string getName() const; + const std::vector& getProgramList() const; + bool getProgram(const ProgramSelector& selector, VirtualProgram* program) const; + + static const VirtualRadio& getAmFmRadio(); + static const VirtualRadio& getDabRadio(); + + private: + const std::string mName; + std::vector mPrograms; +}; + +} // namespace aidl::android::hardware::broadcastradio diff --git a/broadcastradio/aidl/default/broadcastradio-default.rc b/broadcastradio/aidl/default/broadcastradio-default.rc new file mode 100644 index 0000000000..49389e64c9 --- /dev/null +++ b/broadcastradio/aidl/default/broadcastradio-default.rc @@ -0,0 +1,6 @@ +service vendor.broadcastradio-default /vendor/bin/hw/android.hardware.broadcastradio-service.default + interface aidl android.hardware.broadcastradio.IBroadcastRadio/amfm + interface aidl android.hardware.broadcastradio.IBroadcastRadio/dab + class hal + user audioserver + group audio diff --git a/broadcastradio/aidl/default/broadcastradio-default.xml b/broadcastradio/aidl/default/broadcastradio-default.xml new file mode 100644 index 0000000000..1555822e07 --- /dev/null +++ b/broadcastradio/aidl/default/broadcastradio-default.xml @@ -0,0 +1,7 @@ + + + android.hardware.broadcastradio + IBroadcastRadio/amfm + IBroadcastRadio/dab + + diff --git a/broadcastradio/aidl/default/main.cpp b/broadcastradio/aidl/default/main.cpp new file mode 100644 index 0000000000..6bf20d5dbb --- /dev/null +++ b/broadcastradio/aidl/default/main.cpp @@ -0,0 +1,51 @@ +/* + * 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. + */ + +#include "BroadcastRadio.h" +#include "VirtualRadio.h" + +#include +#include +#include + +using ::aidl::android::hardware::broadcastradio::BroadcastRadio; +using ::aidl::android::hardware::broadcastradio::VirtualRadio; + +int main() { + android::base::SetDefaultTag("BcRadioAidlDef"); + ABinderProcess_setThreadPoolMaxThreadCount(4); + ABinderProcess_startThreadPool(); + + const VirtualRadio& amFmRadioMock = VirtualRadio::getAmFmRadio(); + std::shared_ptr broadcastRadio = + ::ndk::SharedRefBase::make(amFmRadioMock); + const std::string instanceAmFm = std::string() + BroadcastRadio::descriptor + "/amfm"; + binder_status_t statusAmFm = + AServiceManager_addService(broadcastRadio->asBinder().get(), instanceAmFm.c_str()); + CHECK_EQ(statusAmFm, STATUS_OK) + << "Failed to register Broadcast Radio AM/FM HAL implementation"; + + const VirtualRadio& dabRadioMock = VirtualRadio::getDabRadio(); + std::shared_ptr dabRadio = + ::ndk::SharedRefBase::make(dabRadioMock); + const std::string instanceDab = std::string() + BroadcastRadio::descriptor + "/dab"; + binder_status_t statusDab = + AServiceManager_addService(dabRadio->asBinder().get(), instanceDab.c_str()); + CHECK_EQ(statusDab, STATUS_OK) << "Failed to register Broadcast Radio DAB HAL implementation"; + + ABinderProcess_joinThreadPool(); + return EXIT_FAILURE; // should not reach +} diff --git a/broadcastradio/aidl/default/resources.h b/broadcastradio/aidl/default/resources.h new file mode 100644 index 0000000000..beffc76bb9 --- /dev/null +++ b/broadcastradio/aidl/default/resources.h @@ -0,0 +1,36 @@ +/* + * 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. + */ + +#pragma once + +#include + +namespace aidl::android::hardware::broadcastradio::resources { + +constexpr int32_t kDemoPngId = 123456; +constexpr uint8_t kDemoPng[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, + 0x52, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x08, 0x02, 0x00, 0x00, 0x00, 0x25, + 0x0b, 0xe6, 0x89, 0x00, 0x00, 0x00, 0x5d, 0x49, 0x44, 0x41, 0x54, 0x68, 0xde, 0xed, 0xd9, + 0xc1, 0x09, 0x00, 0x30, 0x08, 0x04, 0xc1, 0x33, 0xfd, 0xf7, 0x6c, 0x6a, 0xc8, 0x23, 0x04, + 0xc9, 0x6c, 0x01, 0xc2, 0x20, 0xbe, 0x4c, 0x86, 0x57, 0x49, 0xba, 0xfb, 0xd6, 0xf4, 0xba, + 0x3e, 0x7f, 0x4d, 0xdf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x8f, 0x00, 0xbd, 0xce, 0x7f, + 0xc0, 0x11, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0xb8, 0x0d, 0x32, 0xd4, 0x0c, 0x77, 0xbd, + 0xfb, 0xc1, 0xce, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82}; + +} // namespace aidl::android::hardware::broadcastradio::resources diff --git a/broadcastradio/common/utilsaidl/Android.bp b/broadcastradio/common/utilsaidl/Android.bp new file mode 100644 index 0000000000..fa6de19363 --- /dev/null +++ b/broadcastradio/common/utilsaidl/Android.bp @@ -0,0 +1,50 @@ +// +// 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. +// + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_library_static { + name: "android.hardware.broadcastradio@common-utils-aidl-lib", + vendor_available: true, + relative_install_path: "hw", + cflags: [ + "-Wall", + "-Wextra", + "-Werror", + "-Wno-error=implicit-fallthrough", + ], + cppflags: [ + "-std=c++1z", + ], + srcs: [ + "Utils.cpp", + ], + export_include_dirs: ["include"], + shared_libs: [ + "android.hardware.broadcastradio-V1-ndk", + "libbase", + ], + static_libs: [ + "libmath", + ], +} diff --git a/broadcastradio/common/utilsaidl/Utils.cpp b/broadcastradio/common/utilsaidl/Utils.cpp new file mode 100644 index 0000000000..a28465161c --- /dev/null +++ b/broadcastradio/common/utilsaidl/Utils.cpp @@ -0,0 +1,477 @@ +/* + * 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. + */ + +#define LOG_TAG "BcRadioAidlDef.utils" + +#include "broadcastradio-utils-aidl/Utils.h" + +#include + +#include + +namespace aidl::android::hardware::broadcastradio { + +namespace utils { + +namespace { + +using ::std::string; +using ::std::vector; + +const int64_t kValueForNotFoundIdentifier = 0; + +bool bothHaveId(const ProgramSelector& a, const ProgramSelector& b, const IdentifierType& type) { + return hasId(a, type) && hasId(b, type); +} + +bool haveEqualIds(const ProgramSelector& a, const ProgramSelector& b, const IdentifierType& type) { + if (!bothHaveId(a, b, type)) { + return false; + } + /* We should check all Ids of a given type (ie. other AF), + * but it doesn't matter for default implementation. + */ + return getId(a, type) == getId(b, type); +} + +int getHdSubchannel(const ProgramSelector& sel) { + int64_t hdSidExt = getId(sel, IdentifierType::HD_STATION_ID_EXT, /* defaultValue */ 0); + hdSidExt >>= 32; // Station ID number + return hdSidExt & 0xF; // HD Radio subchannel +} + +bool maybeGetId(const ProgramSelector& sel, const IdentifierType& type, int64_t* val) { + // iterate through primaryId and secondaryIds + for (auto it = begin(sel); it != end(sel); it++) { + if (it->type == type) { + if (val != nullptr) { + *val = it->value; + } + return true; + } + } + + return false; +} + +} // namespace + +IdentifierIterator::IdentifierIterator(const ProgramSelector& sel) : IdentifierIterator(sel, 0) {} + +IdentifierIterator::IdentifierIterator(const ProgramSelector& sel, size_t pos) + : mSel(sel), mPos(pos) {} + +const IdentifierIterator IdentifierIterator::operator++(int) { + IdentifierIterator i = *this; + mPos++; + return i; +} + +IdentifierIterator& IdentifierIterator::operator++() { + ++mPos; + return *this; +} + +IdentifierIterator::refType IdentifierIterator::operator*() const { + if (mPos == 0) { + return getSelector().primaryId; + } + + // mPos is 1-based for secondary identifiers + DCHECK(mPos <= getSelector().secondaryIds.size()); + return getSelector().secondaryIds[mPos - 1]; +} + +bool IdentifierIterator::operator==(const IdentifierIterator& rhs) const { + // Check, if both iterators points at the same selector. + if (reinterpret_cast(&getSelector()) != + reinterpret_cast(&rhs.getSelector())) { + return false; + } + + return mPos == rhs.mPos; +} + +int32_t resultToInt(Result result) { + return static_cast(result); +} + +FrequencyBand getBand(int64_t freq) { + // keep in sync with + // frameworks/base/services/core/java/com/android/server/broadcastradio/aidl/Utils.java + if (freq < 30) return FrequencyBand::UNKNOWN; + if (freq < 500) return FrequencyBand::AM_LW; + if (freq < 1705) return FrequencyBand::AM_MW; + if (freq < 30000) return FrequencyBand::AM_SW; + if (freq < 60000) return FrequencyBand::UNKNOWN; + if (freq < 110000) return FrequencyBand::FM; + return FrequencyBand::UNKNOWN; +} + +bool tunesTo(const ProgramSelector& a, const ProgramSelector& b) { + IdentifierType type = b.primaryId.type; + + switch (type) { + case IdentifierType::HD_STATION_ID_EXT: + case IdentifierType::RDS_PI: + case IdentifierType::AMFM_FREQUENCY_KHZ: + if (haveEqualIds(a, b, IdentifierType::HD_STATION_ID_EXT)) return true; + if (haveEqualIds(a, b, IdentifierType::RDS_PI)) return true; + return getHdSubchannel(b) == 0 && + haveEqualIds(a, b, IdentifierType::AMFM_FREQUENCY_KHZ); + case IdentifierType::DAB_SID_EXT: + return haveEqualIds(a, b, IdentifierType::DAB_SID_EXT); + case IdentifierType::DRMO_SERVICE_ID: + return haveEqualIds(a, b, IdentifierType::DRMO_SERVICE_ID); + case IdentifierType::SXM_SERVICE_ID: + return haveEqualIds(a, b, IdentifierType::SXM_SERVICE_ID); + default: // includes all vendor types + LOG(WARNING) << "unsupported program type: " << toString(type); + return false; + } +} + +bool hasId(const ProgramSelector& sel, const IdentifierType& type) { + return maybeGetId(sel, type, /* val */ nullptr); +} + +int64_t getId(const ProgramSelector& sel, const IdentifierType& type) { + int64_t val; + + if (maybeGetId(sel, type, &val)) { + return val; + } + + LOG(WARNING) << "identifier not found: " << toString(type); + return kValueForNotFoundIdentifier; +} + +int64_t getId(const ProgramSelector& sel, const IdentifierType& type, int64_t defaultValue) { + if (!hasId(sel, type)) { + return defaultValue; + } + return getId(sel, type); +} + +vector getAllIds(const ProgramSelector& sel, const IdentifierType& type) { + vector ret; + + // iterate through primaryId and secondaryIds + for (auto it = begin(sel); it != end(sel); it++) { + if (it->type == type) { + ret.push_back(it->value); + } + } + + return ret; +} + +bool isSupported(const Properties& prop, const ProgramSelector& sel) { + for (auto it = prop.supportedIdentifierTypes.begin(); it != prop.supportedIdentifierTypes.end(); + it++) { + if (hasId(sel, *it)) { + return true; + } + } + return false; +} + +bool isValid(const ProgramIdentifier& id) { + int64_t val = id.value; + bool valid = true; + + auto expect = [&valid](bool condition, const string& message) { + if (!condition) { + valid = false; + LOG(ERROR) << "identifier not valid, expected " << message; + } + }; + + switch (id.type) { + case IdentifierType::INVALID: + expect(false, "IdentifierType::INVALID"); + break; + case IdentifierType::DAB_FREQUENCY_KHZ: + expect(val > 100000u, "f > 100MHz"); + [[fallthrough]]; + case IdentifierType::AMFM_FREQUENCY_KHZ: + case IdentifierType::DRMO_FREQUENCY_KHZ: + expect(val > 100u, "f > 100kHz"); + expect(val < 10000000u, "f < 10GHz"); + break; + case IdentifierType::RDS_PI: + expect(val != 0u, "RDS PI != 0"); + expect(val <= 0xFFFFu, "16bit id"); + break; + case IdentifierType::HD_STATION_ID_EXT: { + int64_t stationId = val & 0xFFFFFFFF; // 32bit + val >>= 32; + int64_t subchannel = val & 0xF; // 4bit + val >>= 4; + int64_t freq = val & 0x3FFFF; // 18bit + expect(stationId != 0u, "HD station id != 0"); + expect(subchannel < 8u, "HD subch < 8"); + expect(freq > 100u, "f > 100kHz"); + expect(freq < 10000000u, "f < 10GHz"); + break; + } + case IdentifierType::HD_STATION_NAME: { + while (val > 0) { + char ch = static_cast(val & 0xFF); + val >>= 8; + expect((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z'), + "HD_STATION_NAME does not match [A-Z0-9]+"); + } + break; + } + case IdentifierType::DAB_SID_EXT: { + int64_t sid = val & 0xFFFF; // 16bit + val >>= 16; + int64_t ecc = val & 0xFF; // 8bit + expect(sid != 0u, "DAB SId != 0"); + expect(ecc >= 0xA0u && ecc <= 0xF6u, "Invalid ECC, see ETSI TS 101 756 V2.1.1"); + break; + } + case IdentifierType::DAB_ENSEMBLE: + expect(val != 0u, "DAB ensemble != 0"); + expect(val <= 0xFFFFu, "16bit id"); + break; + case IdentifierType::DAB_SCID: + expect(val > 0xFu, "12bit SCId (not 4bit SCIdS)"); + expect(val <= 0xFFFu, "12bit id"); + break; + case IdentifierType::DRMO_SERVICE_ID: + expect(val != 0u, "DRM SId != 0"); + expect(val <= 0xFFFFFFu, "24bit id"); + break; + case IdentifierType::SXM_SERVICE_ID: + expect(val != 0u, "SXM SId != 0"); + expect(val <= 0xFFFFFFFFu, "32bit id"); + break; + case IdentifierType::SXM_CHANNEL: + expect(val < 1000u, "SXM channel < 1000"); + break; + case IdentifierType::VENDOR_START: + case IdentifierType::VENDOR_END: + // skip + break; + } + + return valid; +} + +bool isValid(const ProgramSelector& sel) { + // iterate through primaryId and secondaryIds + for (auto it = begin(sel); it != end(sel); it++) { + if (!isValid(*it)) { + return false; + } + } + return true; +} + +ProgramIdentifier makeIdentifier(IdentifierType type, int64_t value) { + return {type, value}; +} + +ProgramSelector makeSelectorAmfm(int32_t frequency) { + ProgramSelector sel = {}; + sel.primaryId = makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, frequency); + return sel; +} + +ProgramSelector makeSelectorDab(int32_t sidExt, int32_t ensemble) { + ProgramSelector sel = {}; + // TODO(243686545): Have a helper function to create the sidExt instead of + // passing the whole identifier here. Something like makeDabSidExt. + sel.primaryId = makeIdentifier(IdentifierType::DAB_SID_EXT, sidExt); + vector secondaryIds = { + makeIdentifier(IdentifierType::DAB_ENSEMBLE, ensemble), + // TODO(243686545): Include frequency here when the helper method to + // translate between ensemble and frequency is implemented. + }; + sel.secondaryIds = std::move(secondaryIds); + return sel; +} + +bool satisfies(const ProgramFilter& filter, const ProgramSelector& sel) { + if (filter.identifierTypes.size() > 0) { + auto typeEquals = [](const ProgramIdentifier& id, IdentifierType type) { + return id.type == type; + }; + auto it = std::find_first_of(begin(sel), end(sel), filter.identifierTypes.begin(), + filter.identifierTypes.end(), typeEquals); + if (it == end(sel)) { + return false; + } + } + + if (filter.identifiers.size() > 0) { + auto it = std::find_first_of(begin(sel), end(sel), filter.identifiers.begin(), + filter.identifiers.end()); + if (it == end(sel)) { + return false; + } + } + + if (!filter.includeCategories && sel.primaryId.type == IdentifierType::DAB_ENSEMBLE) { + return false; + } + + return true; +} + +size_t ProgramInfoHasher::operator()(const ProgramInfo& info) const { + const ProgramIdentifier& id = info.selector.primaryId; + + // This is not the best hash implementation, but good enough for default HAL + // implementation and tests. + size_t h = 0; + ::android::hashCombineSingle(h, id.type); + ::android::hashCombineSingle(h, id.value); + return h; +} + +bool ProgramInfoKeyEqual::operator()(const ProgramInfo& info1, const ProgramInfo& info2) const { + const ProgramIdentifier& id1 = info1.selector.primaryId; + const ProgramIdentifier& id2 = info2.selector.primaryId; + return id1.type == id2.type && id1.value == id2.value; +} + +void updateProgramList(const ProgramListChunk& chunk, ProgramInfoSet* list) { + if (chunk.purge) { + list->clear(); + } + + list->insert(chunk.modified.begin(), chunk.modified.end()); + + if (!chunk.removed.has_value()) { + return; + } + + for (auto& id : chunk.removed.value()) { + if (id.has_value()) { + ProgramInfo info = {}; + info.selector.primaryId = id.value(); + list->erase(info); + } + } +} + +std::optional getMetadataString(const ProgramInfo& info, const Metadata::Tag& tag) { + auto isRdsPs = [tag](const Metadata& item) { return item.getTag() == tag; }; + + auto it = std::find_if(info.metadata.begin(), info.metadata.end(), isRdsPs); + if (it == info.metadata.end()) { + return std::nullopt; + } + + std::string metadataString; + switch (it->getTag()) { + case Metadata::rdsPs: + metadataString = it->get(); + break; + case Metadata::rdsPty: + metadataString = std::to_string(it->get()); + break; + case Metadata::rbdsPty: + metadataString = std::to_string(it->get()); + break; + case Metadata::rdsRt: + metadataString = it->get(); + break; + case Metadata::songTitle: + metadataString = it->get(); + break; + case Metadata::songArtist: + metadataString = it->get(); + break; + case Metadata::songAlbum: + metadataString = it->get(); + break; + case Metadata::stationIcon: + metadataString = std::to_string(it->get()); + break; + case Metadata::albumArt: + metadataString = std::to_string(it->get()); + break; + case Metadata::programName: + metadataString = it->get(); + break; + case Metadata::dabEnsembleName: + metadataString = it->get(); + break; + case Metadata::dabEnsembleNameShort: + metadataString = it->get(); + break; + case Metadata::dabServiceName: + metadataString = it->get(); + break; + case Metadata::dabServiceNameShort: + metadataString = it->get(); + break; + case Metadata::dabComponentName: + metadataString = it->get(); + break; + case Metadata::dabComponentNameShort: + metadataString = it->get(); + break; + default: + LOG(ERROR) << "Metadata " << it->toString() << " is not converted."; + return std::nullopt; + } + return metadataString; +} + +ProgramIdentifier makeHdRadioStationName(const string& name) { + constexpr size_t maxlen = 8; + + string shortName; + shortName.reserve(maxlen); + + const auto& loc = std::locale::classic(); + for (const char& ch : name) { + if (!std::isalnum(ch, loc)) { + continue; + } + shortName.push_back(std::toupper(ch, loc)); + if (shortName.length() >= maxlen) { + break; + } + } + + // Short name is converted to HD_STATION_NAME by encoding each char into its ASCII value in + // in little-endian order. For example, "Abc" is converted to 0x434241. + int64_t val = 0; + for (auto rit = shortName.rbegin(); rit != shortName.rend(); ++rit) { + val <<= 8; + val |= static_cast(*rit); + } + + return makeIdentifier(IdentifierType::HD_STATION_NAME, val); +} + +} // namespace utils + +utils::IdentifierIterator begin(const ProgramSelector& sel) { + return utils::IdentifierIterator(sel); +} + +utils::IdentifierIterator end(const ProgramSelector& sel) { + return utils::IdentifierIterator(sel) + 1 /* primary id */ + sel.secondaryIds.size(); +} + +} // namespace aidl::android::hardware::broadcastradio diff --git a/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h b/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h new file mode 100644 index 0000000000..c79c5c5533 --- /dev/null +++ b/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h @@ -0,0 +1,174 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace aidl::android::hardware::broadcastradio { + +namespace utils { + +enum class FrequencyBand { + UNKNOWN, + FM, + AM_LW, + AM_MW, + AM_SW, +}; + +class IdentifierIterator final + : public std::iterator { + using ptrType = typename std::iterator_traits::pointer; + using refType = typename std::iterator_traits::reference; + using diffType = typename std::iterator_traits::difference_type; + + public: + explicit IdentifierIterator(const ProgramSelector& sel); + + const IdentifierIterator operator++(int); + IdentifierIterator& operator++(); + refType operator*() const; + inline ptrType operator->() const { return &operator*(); } + IdentifierIterator operator+(diffType v) const { return IdentifierIterator(mSel, mPos + v); } + bool operator==(const IdentifierIterator& rhs) const; + inline bool operator!=(const IdentifierIterator& rhs) const { return !operator==(rhs); }; + + private: + explicit IdentifierIterator(const ProgramSelector& sel, size_t pos); + + std::reference_wrapper mSel; + + const ProgramSelector& getSelector() const { return mSel.get(); } + + /** 0 is the primary identifier, 1-n are secondary identifiers. */ + size_t mPos = 0; +}; + +/** + * Convert Result to int + */ +int32_t resultToInt(Result result); + +/** + * Guesses band from the frequency value. + * + * The band bounds are not exact to cover multiple regions. + * The function is biased towards success, i.e. it never returns + * FrequencyBand::UNKNOWN for correct frequency, but a result for + * incorrect one is undefined (it doesn't have to return UNKNOWN). + */ +FrequencyBand getBand(int64_t frequency); + +/** + * Checks, if {@code pointer} tunes to {@channel}. + * + * For example, having a channel {AMFM_FREQUENCY_KHZ = 103.3}: + * - selector {AMFM_FREQUENCY_KHZ = 103.3, HD_SUBCHANNEL = 0} can tune to this channel; + * - selector {AMFM_FREQUENCY_KHZ = 103.3, HD_SUBCHANNEL = 1} can't. + * + * @param pointer selector we're trying to match against channel. + * @param channel existing channel. + */ +bool tunesTo(const ProgramSelector& pointer, const ProgramSelector& channel); + +/** + * Checks whether a given program selector has the given ID (either primary or secondary). + */ +bool hasId(const ProgramSelector& sel, const IdentifierType& type); + +/** + * Returns ID (either primary or secondary) for a given program selector. + * + * If the selector does not contain given type, returns kValueForNotFoundIdentifier + * and emits a warning. + */ +int64_t getId(const ProgramSelector& sel, const IdentifierType& type); + +/** + * Returns ID (either primary or secondary) for a given program selector. + * + * If the selector does not contain given type, returns default value. + */ +int64_t getId(const ProgramSelector& sel, const IdentifierType& type, int64_t defaultValue); + +/** + * Returns all IDs of a given type. + */ +std::vector getAllIds(const ProgramSelector& sel, const IdentifierType& type); + +/** + * Checks, if a given selector is supported by the radio module. + * + * @param prop Module description. + * @param sel The selector to check. + * @return True, if the selector is supported, false otherwise. + */ +bool isSupported(const Properties& prop, const ProgramSelector& sel); + +bool isValid(const ProgramIdentifier& id); +bool isValid(const ProgramSelector& sel); + +ProgramIdentifier makeIdentifier(IdentifierType type, int64_t value); +ProgramSelector makeSelectorAmfm(int32_t frequency); +ProgramSelector makeSelectorDab(int32_t sidExt, int32_t ensemble); + +bool satisfies(const ProgramFilter& filter, const ProgramSelector& sel); + +struct ProgramInfoHasher { + size_t operator()(const ProgramInfo& info) const; +}; + +struct ProgramInfoKeyEqual { + bool operator()(const ProgramInfo& info1, const ProgramInfo& info2) const; +}; + +typedef std::unordered_set ProgramInfoSet; + +void updateProgramList(const ProgramListChunk& chunk, ProgramInfoSet* list); + +std::optional getMetadataString(const ProgramInfo& info, const Metadata::Tag& tag); + +ProgramIdentifier makeHdRadioStationName(const std::string& name); + +template +inline std::string vectorToString(const std::vector& in_values) { + return std::accumulate(std::begin(in_values), std::end(in_values), std::string{}, + [](const std::string& ls, const aidl_type& rs) { + return ls + (ls.empty() ? "" : ",") + toString(rs); + }); +} + +} // namespace utils + +utils::IdentifierIterator begin(const ProgramSelector& sel); +utils::IdentifierIterator end(const ProgramSelector& sel); + +} // namespace aidl::android::hardware::broadcastradio From 740ffa4097b33caa39cad17d025d35a53e6e4a80 Mon Sep 17 00:00:00 2001 From: Tyler Trephan Date: Wed, 21 Sep 2022 23:43:07 +0000 Subject: [PATCH 258/998] Added PERF_VEHICLE_SPEED_DISPLAY to Google VHAL Test: atest AtsCarPropertyHostTest Bug: 241518123 Change-Id: I9218f63a62ebf77cc3056e12d1acb5f0f3ecbbb0 --- .../impl/default_config/config/DefaultProperties.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 0c949d665e..b6811b67ef 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -109,6 +109,16 @@ "maxSampleRate": 10.0, "minSampleRate": 1.0 }, + { + "property": "VehicleProperty::PERF_VEHICLE_SPEED_DISPLAY", + "defaultValue": { + "floatValues": [ + 0.0 + ] + }, + "maxSampleRate": 10.0, + "minSampleRate": 1.0 + }, { "property": "VehicleProperty::VEHICLE_SPEED_DISPLAY_UNITS", "defaultValue": { From 255990f3b38282e8c16d61e6bfaa30831c2685ab Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Wed, 21 Sep 2022 02:47:09 +0000 Subject: [PATCH 259/998] Update VTS for IRadioNetwork V2 Bug: 243344927 Bug: 232285403 Test: atest Change-Id: Icd3f593c5f0547a8443df34c0dc3167e90c2f8c6 --- .../radio/network/IRadioNetworkResponse.aidl | 4 - radio/aidl/vts/radio_network_test.cpp | 78 +++++++++++++++++++ 2 files changed, 78 insertions(+), 4 deletions(-) diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl index d98a31bfc8..243e949b9e 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -580,7 +580,6 @@ oneway interface IRadioNetworkResponse { * * Valid errors returned: * RadioError:NONE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:RADIO_NOT_AVAILABLE * RadioError:MODEM_ERR * RadioError:INVALID_ARGUMENTS @@ -592,7 +591,6 @@ oneway interface IRadioNetworkResponse { * * Valid errors returned: * RadioError:NONE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:RADIO_NOT_AVAILABLE * RadioError:MODEM_ERR * RadioError:INVALID_ARGUMENTS @@ -604,7 +602,6 @@ oneway interface IRadioNetworkResponse { * * Valid errors returned: * RadioError:NONE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:RADIO_NOT_AVAILABLE * RadioError:MODEM_ERR */ @@ -615,7 +612,6 @@ oneway interface IRadioNetworkResponse { * * Valid errors returned: * RadioError:NONE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:RADIO_NOT_AVAILABLE * RadioError:MODEM_ERR */ diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index c83571ee0a..25c42d35b2 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -1833,3 +1833,81 @@ TEST_P(RadioNetworkTest, supplyNetworkDepersonalization) { } LOG(DEBUG) << "supplyNetworkDepersonalization finished"; } + +/* + * Test IRadioNetwork.setEmergencyMode() for the response returned. + */ +TEST_P(RadioNetworkTest, setEmergencyMode) { + LOG(DEBUG) << "setEmergencyMode"; + serial = GetRandomSerialNumber(); + + radio_network->setEmergencyMode(serial, EmergencyMode::EMERGENCY_WWAN); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); + + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, + RadioError::MODEM_ERR, RadioError::INVALID_ARGUMENTS})); + LOG(DEBUG) << "setEmergencyMode finished"; +} + +/* + * Test IRadioNetwork.triggerEmergencyNetworkScan() for the response returned. + */ +TEST_P(RadioNetworkTest, triggerEmergencyNetworkScan) { + LOG(DEBUG) << "triggerEmergencyNetworkScan"; + serial = GetRandomSerialNumber(); + + EmergencyNetworkScanTrigger scanRequest; + scanRequest.accessNetwork = {AccessNetwork::EUTRAN}; + scanRequest.scanType = EmergencyScanType::NO_PREFERENCE; + + radio_network->triggerEmergencyNetworkScan(serial, scanRequest); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); + + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, + RadioError::MODEM_ERR, RadioError::INVALID_ARGUMENTS})); + LOG(DEBUG) << "triggerEmergencyNetworkScan finished"; +} + +/* + * Test IRadioNetwork.cancelEmergencyNetworkScan() for the response returned. + */ +TEST_P(RadioNetworkTest, cancelEmergencyNetworkScan) { + LOG(DEBUG) << "cancelEmergencyNetworkScan"; + serial = GetRandomSerialNumber(); + + radio_network->cancelEmergencyNetworkScan(serial); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); + + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); + LOG(DEBUG) << "cancelEmergencyNetworkScan finished"; +} + +/* + * Test IRadioNetwork.exitEmergencyMode() for the response returned. + */ +TEST_P(RadioNetworkTest, exitEmergencyMode) { + LOG(DEBUG) << "exitEmergencyMode"; + serial = GetRandomSerialNumber(); + + radio_network->exitEmergencyMode(serial); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); + + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); + LOG(DEBUG) << "exitEmergencyMode finished"; +} From 2c47ce80332353b001e0d4e4036663064e90c572 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Thu, 22 Sep 2022 11:20:18 +0000 Subject: [PATCH 260/998] Fix VTS build error caused by IRadioIms Replace ImsFailureReason with SuggestedAction Bug: 219242990 Bug: 246678554 Test: build Change-Id: Idc3e76d27ead56626be6c3ce28704d31747f8209 --- radio/aidl/vts/radio_ims_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/aidl/vts/radio_ims_test.cpp b/radio/aidl/vts/radio_ims_test.cpp index 52912c1703..27cc8d9103 100644 --- a/radio/aidl/vts/radio_ims_test.cpp +++ b/radio/aidl/vts/radio_ims_test.cpp @@ -94,7 +94,7 @@ TEST_P(RadioImsTest, updateImsRegistrationInfo) { ImsRegistration regInfo; regInfo.regState = ImsRegistrationState::NOT_REGISTERED; regInfo.accessNetworkType = AccessNetwork::EUTRAN; - regInfo.reason = ImsFailureReason::NONE; + regInfo.suggestedAction = SuggestedAction::NONE; regInfo.capabilities = ImsRegistration::IMS_MMTEL_CAPABILITY_NONE; ndk::ScopedAStatus res = From fbd5421ab345e98f12be42bb74991bb47745b9a1 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Fri, 16 Sep 2022 07:53:50 +0000 Subject: [PATCH 261/998] Add mcc and mnc to EmergencyRegResult Indicating the identity of PLMN. Test: Functional test on test device. Bug: 243344927 Change-Id: I385d2099893d3b68c2520b8fb7a732c05dfdf366 --- .../android/hardware/radio/network/EmergencyRegResult.aidl | 2 ++ .../android/hardware/radio/network/EmergencyRegResult.aidl | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyRegResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyRegResult.aidl index cb598f3e5d..523d1aa52e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyRegResult.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyRegResult.aidl @@ -40,4 +40,6 @@ parcelable EmergencyRegResult { boolean isEmcBearerSupported; byte nwProvidedEmc; byte nwProvidedEmf; + String mcc; + String mnc; } diff --git a/radio/aidl/android/hardware/radio/network/EmergencyRegResult.aidl b/radio/aidl/android/hardware/radio/network/EmergencyRegResult.aidl index cf5caa45b8..c22317aced 100644 --- a/radio/aidl/android/hardware/radio/network/EmergencyRegResult.aidl +++ b/radio/aidl/android/hardware/radio/network/EmergencyRegResult.aidl @@ -54,4 +54,10 @@ parcelable EmergencyRegResult { * This should not be set if UE is not in 5G mode. */ byte nwProvidedEmf; + + /** 3-digit Mobile Country Code, 000..999, empty string if unknown. */ + String mcc; + + /** 2 or 3-digit Mobile Network Code, 00..999, empty string if unknown. */ + String mnc; } From 96617435b7ad401cd73b1a5078bfb723a7e4b8f0 Mon Sep 17 00:00:00 2001 From: Filip Date: Thu, 15 Sep 2022 06:00:24 +0000 Subject: [PATCH 262/998] Add automotive-general-tests tag to the test Test: manual Bug: 246471877 Change-Id: Idb97b33b8f3b2a18fa9b43199e069c03bf40b44d --- automotive/vehicle/vts/Android.bp | 1 + 1 file changed, 1 insertion(+) diff --git a/automotive/vehicle/vts/Android.bp b/automotive/vehicle/vts/Android.bp index 1cfd5420f5..736787b881 100644 --- a/automotive/vehicle/vts/Android.bp +++ b/automotive/vehicle/vts/Android.bp @@ -45,6 +45,7 @@ cc_test { "general-tests", "vts", "automotive-tests", + "automotive-general-tests", ], require_root: true, } From 97203b0f3e5a06f9604a337985b2df40fd30573b Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Thu, 23 Jun 2022 00:19:03 +0000 Subject: [PATCH 263/998] Add adb shell command to default AIDL Add adb shell commands to call methods of tune, seek, step, cancel, startProgramListUpdates and stopProgramListUpdates in BroadcastRadio HAL. Bug: 170336130 Test: m -j Test: manually test dump options listed in "adb shell dumpsys android.hardware.broadcastradio.IBroadcastRadio/amfm --help" Change-Id: I7aac96459f61c36dc9aae2d0a3866272f5bb9aed --- .../aidl/default/BroadcastRadio.cpp | 315 ++++++++++++++++++ broadcastradio/aidl/default/BroadcastRadio.h | 11 + broadcastradio/common/utilsaidl/Utils.cpp | 68 ++++ .../include/broadcastradio-utils-aidl/Utils.h | 14 + 4 files changed, 408 insertions(+) diff --git a/broadcastradio/aidl/default/BroadcastRadio.cpp b/broadcastradio/aidl/default/BroadcastRadio.cpp index 57c5133bd1..0209a0e6ef 100644 --- a/broadcastradio/aidl/default/BroadcastRadio.cpp +++ b/broadcastradio/aidl/default/BroadcastRadio.cpp @@ -22,11 +22,15 @@ #include #include +#include + +#include namespace aidl::android::hardware::broadcastradio { using ::aidl::android::hardware::broadcastradio::utils::resultToInt; using ::aidl::android::hardware::broadcastradio::utils::tunesTo; +using ::android::base::EqualsIgnoreCase; using ::ndk::ScopedAStatus; using ::std::literals::chrono_literals::operator""ms; using ::std::literals::chrono_literals::operator""s; @@ -83,6 +87,15 @@ ProgramInfo makeSampleProgramInfo(const ProgramSelector& selector) { return info; } +static bool checkDumpCallerHasWritePermissions(int fd) { + uid_t uid = AIBinder_getCallingUid(); + if (uid == AID_ROOT || uid == AID_SHELL || uid == AID_SYSTEM) { + return true; + } + dprintf(fd, "BroadcastRadio HAL dump must be root, shell or system\n"); + return false; +} + } // namespace BroadcastRadio::BroadcastRadio(const VirtualRadio& virtualRadio) @@ -470,4 +483,306 @@ ScopedAStatus BroadcastRadio::registerAnnouncementListener( "registering announcementListener is not supported"); } +binder_status_t BroadcastRadio::dump(int fd, const char** args, uint32_t numArgs) { + if (numArgs == 0) { + return dumpsys(fd); + } + + string option = string(args[0]); + if (EqualsIgnoreCase(option, "--help")) { + return cmdHelp(fd); + } else if (EqualsIgnoreCase(option, "--tune")) { + return cmdTune(fd, args, numArgs); + } else if (EqualsIgnoreCase(option, "--seek")) { + return cmdSeek(fd, args, numArgs); + } else if (EqualsIgnoreCase(option, "--step")) { + return cmdStep(fd, args, numArgs); + } else if (EqualsIgnoreCase(option, "--cancel")) { + return cmdCancel(fd, numArgs); + } else if (EqualsIgnoreCase(option, "--startProgramListUpdates")) { + return cmdStartProgramListUpdates(fd, args, numArgs); + } else if (EqualsIgnoreCase(option, "--stopProgramListUpdates")) { + return cmdStopProgramListUpdates(fd, numArgs); + } + dprintf(fd, "Invalid option: %s\n", option.c_str()); + return STATUS_BAD_VALUE; +} + +binder_status_t BroadcastRadio::dumpsys(int fd) { + if (!checkDumpCallerHasWritePermissions(fd)) { + return STATUS_PERMISSION_DENIED; + } + lock_guard lk(mMutex); + dprintf(fd, "AmFmRegionConfig: %s\n", mAmFmConfig.toString().c_str()); + dprintf(fd, "Properties: %s \n", mProperties.toString().c_str()); + if (mIsTuneCompleted) { + dprintf(fd, "Tune completed\n"); + } else { + dprintf(fd, "Tune not completed\n"); + } + if (mCallback == nullptr) { + dprintf(fd, "No ITunerCallback registered\n"); + } else { + dprintf(fd, "ITunerCallback registered\n"); + } + dprintf(fd, "CurrentProgram: %s \n", mCurrentProgram.toString().c_str()); + return STATUS_OK; +} + +binder_status_t BroadcastRadio::cmdHelp(int fd) const { + dprintf(fd, "Usage: \n\n"); + dprintf(fd, "[no args]: dumps focus listener / gain callback registered status\n"); + dprintf(fd, "--help: shows this help\n"); + dprintf(fd, + "--tune amfm : tunes amfm radio to frequency (in Hz) specified: " + "frequency (int) \n" + "--tune dab : tunes dab radio to sid and ensemble specified: " + "sidExt (int), ensemble (int) \n"); + dprintf(fd, + "--seek [up|down] : seek with direction (up or down) and " + "option whether skipping sub channel: " + "skipSubChannel (string, should be either \"true\" or \"false\")\n"); + dprintf(fd, "--step [up|down]: step in direction (up or down) specified\n"); + dprintf(fd, "--cancel: cancel current pending tune, step, and seek\n"); + dprintf(fd, + "--startProgramListUpdates " + ": start update program list with the filter specified: " + "identifier types (string, in format ,,..., or \"null\" (if empty), " + "where TYPE is int), " + "program identifiers (string, in format " + ":,:,...,: or \"null\" (if empty), " + "where TYPE is int and VALUE is long), " + "includeCategories (string, should be either \"true\" or \"false\"), " + "excludeModifications (string, should be either \"true\" or \"false\")\n"); + dprintf(fd, "--stopProgramListUpdates: stop current pending program list updates\n"); + dprintf(fd, + "Note on for --startProgramList command: it is int for identifier type. " + "Please see broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl " + "for its definition.\n"); + dprintf(fd, + "Note on for --startProgramList command: it is long type for identifier value. " + "Please see broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl " + "for its value.\n"); + + return STATUS_OK; +} + +binder_status_t BroadcastRadio::cmdTune(int fd, const char** args, uint32_t numArgs) { + if (!checkDumpCallerHasWritePermissions(fd)) { + return STATUS_PERMISSION_DENIED; + } + if (numArgs != 3 && numArgs != 4) { + dprintf(fd, + "Invalid number of arguments: please provide --tune amfm " + "or --tune dab \n"); + return STATUS_BAD_VALUE; + } + bool isDab = false; + if (EqualsIgnoreCase(string(args[1]), "dab")) { + isDab = true; + } else if (!EqualsIgnoreCase(string(args[1]), "amfm")) { + dprintf(fd, "Unknown radio type provided with tune: %s\n", args[1]); + return STATUS_BAD_VALUE; + } + ProgramSelector sel = {}; + if (isDab) { + if (numArgs != 4) { + dprintf(fd, + "Invalid number of arguments: please provide --tune dab \n"); + return STATUS_BAD_VALUE; + } + int sid; + if (!utils::parseArgInt(string(args[2]), &sid)) { + dprintf(fd, "Non-integer sid provided with tune: %s\n", string(args[2]).c_str()); + return STATUS_BAD_VALUE; + } + int ensemble; + if (!utils::parseArgInt(string(args[3]), &ensemble)) { + dprintf(fd, "Non-integer ensemble provided with tune: %s\n", string(args[3]).c_str()); + return STATUS_BAD_VALUE; + } + sel = utils::makeSelectorDab(sid, ensemble); + } else { + if (numArgs != 3) { + dprintf(fd, "Invalid number of arguments: please provide --tune amfm \n"); + return STATUS_BAD_VALUE; + } + int freq; + if (!utils::parseArgInt(string(args[2]), &freq)) { + dprintf(fd, "Non-integer frequency provided with tune: %s\n", string(args[2]).c_str()); + return STATUS_BAD_VALUE; + } + sel = utils::makeSelectorAmfm(freq); + } + + auto tuneResult = tune(sel); + if (!tuneResult.isOk()) { + dprintf(fd, "Unable to tune %s radio to %s\n", args[1], sel.toString().c_str()); + return STATUS_BAD_VALUE; + } + dprintf(fd, "Tune %s radio to %s \n", args[1], sel.toString().c_str()); + return STATUS_OK; +} + +binder_status_t BroadcastRadio::cmdSeek(int fd, const char** args, uint32_t numArgs) { + if (!checkDumpCallerHasWritePermissions(fd)) { + return STATUS_PERMISSION_DENIED; + } + if (numArgs != 3) { + dprintf(fd, + "Invalid number of arguments: please provide --seek " + "\n"); + return STATUS_BAD_VALUE; + } + string seekDirectionIn = string(args[1]); + bool seekDirectionUp; + if (!utils::parseArgDirection(seekDirectionIn, &seekDirectionUp)) { + dprintf(fd, "Invalid direction (\"up\" or \"down\") provided with seek: %s\n", + seekDirectionIn.c_str()); + return STATUS_BAD_VALUE; + } + string skipSubChannelIn = string(args[2]); + bool skipSubChannel; + if (!utils::parseArgBool(skipSubChannelIn, &skipSubChannel)) { + dprintf(fd, "Invalid skipSubChannel (\"true\" or \"false\") provided with seek: %s\n", + skipSubChannelIn.c_str()); + return STATUS_BAD_VALUE; + } + + auto seekResult = seek(seekDirectionUp, skipSubChannel); + if (!seekResult.isOk()) { + dprintf(fd, "Unable to seek in %s direction\n", seekDirectionIn.c_str()); + return STATUS_BAD_VALUE; + } + dprintf(fd, "Seek in %s direction\n", seekDirectionIn.c_str()); + return STATUS_OK; +} + +binder_status_t BroadcastRadio::cmdStep(int fd, const char** args, uint32_t numArgs) { + if (!checkDumpCallerHasWritePermissions(fd)) { + return STATUS_PERMISSION_DENIED; + } + if (numArgs != 2) { + dprintf(fd, "Invalid number of arguments: please provide --step \n"); + return STATUS_BAD_VALUE; + } + string stepDirectionIn = string(args[1]); + bool stepDirectionUp; + if (!utils::parseArgDirection(stepDirectionIn, &stepDirectionUp)) { + dprintf(fd, "Invalid direction (\"up\" or \"down\") provided with step: %s\n", + stepDirectionIn.c_str()); + return STATUS_BAD_VALUE; + } + + auto stepResult = step(stepDirectionUp); + if (!stepResult.isOk()) { + dprintf(fd, "Unable to step in %s direction\n", stepDirectionIn.c_str()); + return STATUS_BAD_VALUE; + } + dprintf(fd, "Step in %s direction\n", stepDirectionIn.c_str()); + return STATUS_OK; +} + +binder_status_t BroadcastRadio::cmdCancel(int fd, uint32_t numArgs) { + if (!checkDumpCallerHasWritePermissions(fd)) { + return STATUS_PERMISSION_DENIED; + } + if (numArgs != 1) { + dprintf(fd, + "Invalid number of arguments: please provide --cancel " + "only and no more arguments\n"); + return STATUS_BAD_VALUE; + } + + auto cancelResult = cancel(); + if (!cancelResult.isOk()) { + dprintf(fd, "Unable to cancel pending tune, seek, and step\n"); + return STATUS_BAD_VALUE; + } + dprintf(fd, "Canceled pending tune, seek, and step\n"); + return STATUS_OK; +} + +binder_status_t BroadcastRadio::cmdStartProgramListUpdates(int fd, const char** args, + uint32_t numArgs) { + if (!checkDumpCallerHasWritePermissions(fd)) { + return STATUS_PERMISSION_DENIED; + } + if (numArgs != 5) { + dprintf(fd, + "Invalid number of arguments: please provide --startProgramListUpdates " + " " + "\n"); + return STATUS_BAD_VALUE; + } + string filterTypesStr = string(args[1]); + std::vector filterTypeList; + if (!EqualsIgnoreCase(filterTypesStr, "null") && + !utils::parseArgIdentifierTypeArray(filterTypesStr, &filterTypeList)) { + dprintf(fd, + "Invalid identifier types provided with startProgramListUpdates: %s, " + "should be: ,,...,\n", + filterTypesStr.c_str()); + return STATUS_BAD_VALUE; + } + string filtersStr = string(args[2]); + std::vector filterList; + if (!EqualsIgnoreCase(filtersStr, "null") && + !utils::parseProgramIdentifierList(filtersStr, &filterList)) { + dprintf(fd, + "Invalid program identifiers provided with startProgramListUpdates: %s, " + "should be: :,:,...,:\n", + filtersStr.c_str()); + return STATUS_BAD_VALUE; + } + string includeCategoriesStr = string(args[3]); + bool includeCategories; + if (!utils::parseArgBool(includeCategoriesStr, &includeCategories)) { + dprintf(fd, + "Invalid includeCategories (\"true\" or \"false\") " + "provided with startProgramListUpdates : %s\n", + includeCategoriesStr.c_str()); + return STATUS_BAD_VALUE; + } + string excludeModificationsStr = string(args[4]); + bool excludeModifications; + if (!utils::parseArgBool(excludeModificationsStr, &excludeModifications)) { + dprintf(fd, + "Invalid excludeModifications(\"true\" or \"false\") " + "provided with startProgramListUpdates : %s\n", + excludeModificationsStr.c_str()); + return STATUS_BAD_VALUE; + } + ProgramFilter filter = {filterTypeList, filterList, includeCategories, excludeModifications}; + + auto updateResult = startProgramListUpdates(filter); + if (!updateResult.isOk()) { + dprintf(fd, "Unable to start program list update for filter %s \n", + filter.toString().c_str()); + return STATUS_BAD_VALUE; + } + dprintf(fd, "Start program list update for filter %s\n", filter.toString().c_str()); + return STATUS_OK; +} + +binder_status_t BroadcastRadio::cmdStopProgramListUpdates(int fd, uint32_t numArgs) { + if (!checkDumpCallerHasWritePermissions(fd)) { + return STATUS_PERMISSION_DENIED; + } + if (numArgs != 1) { + dprintf(fd, + "Invalid number of arguments: please provide --stopProgramListUpdates " + "only and no more arguments\n"); + return STATUS_BAD_VALUE; + } + + auto stopResult = stopProgramListUpdates(); + if (!stopResult.isOk()) { + dprintf(fd, "Unable to stop pending program list update\n"); + return STATUS_BAD_VALUE; + } + dprintf(fd, "Stop pending program list update\n"); + return STATUS_OK; +} + } // namespace aidl::android::hardware::broadcastradio diff --git a/broadcastradio/aidl/default/BroadcastRadio.h b/broadcastradio/aidl/default/BroadcastRadio.h index 52d394e8e5..1c85ddc51d 100644 --- a/broadcastradio/aidl/default/BroadcastRadio.h +++ b/broadcastradio/aidl/default/BroadcastRadio.h @@ -62,6 +62,7 @@ class BroadcastRadio final : public BnBroadcastRadio { const std::shared_ptr& listener, const std::vector& enabled, std::shared_ptr* returnCloseHandle) override; + binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; private: const VirtualRadio& mVirtualRadio; @@ -77,6 +78,16 @@ class BroadcastRadio final : public BnBroadcastRadio { std::optional getAmFmRangeLocked() const; void cancelLocked(); ProgramInfo tuneInternalLocked(const ProgramSelector& sel); + + binder_status_t cmdHelp(int fd) const; + binder_status_t cmdTune(int fd, const char** args, uint32_t numArgs); + binder_status_t cmdSeek(int fd, const char** args, uint32_t numArgs); + binder_status_t cmdStep(int fd, const char** args, uint32_t numArgs); + binder_status_t cmdCancel(int fd, uint32_t numArgs); + binder_status_t cmdStartProgramListUpdates(int fd, const char** args, uint32_t numArgs); + binder_status_t cmdStopProgramListUpdates(int fd, uint32_t numArgs); + + binder_status_t dumpsys(int fd); }; } // namespace aidl::android::hardware::broadcastradio diff --git a/broadcastradio/common/utilsaidl/Utils.cpp b/broadcastradio/common/utilsaidl/Utils.cpp index a28465161c..52c7b40c7a 100644 --- a/broadcastradio/common/utilsaidl/Utils.cpp +++ b/broadcastradio/common/utilsaidl/Utils.cpp @@ -19,6 +19,8 @@ #include "broadcastradio-utils-aidl/Utils.h" #include +#include +#include #include @@ -28,6 +30,7 @@ namespace utils { namespace { +using ::android::base::EqualsIgnoreCase; using ::std::string; using ::std::vector; @@ -464,6 +467,71 @@ ProgramIdentifier makeHdRadioStationName(const string& name) { return makeIdentifier(IdentifierType::HD_STATION_NAME, val); } +IdentifierType getType(int typeAsInt) { + return static_cast(typeAsInt); +} + +bool parseArgInt(const string& s, int* out) { + return ::android::base::ParseInt(s, out); +} + +bool parseArgLong(const std::string& s, long* out) { + return ::android::base::ParseInt(s, out); +} + +bool parseArgBool(const string& s, bool* out) { + if (EqualsIgnoreCase(s, "true")) { + *out = true; + } else if (EqualsIgnoreCase(s, "false")) { + *out = false; + } else { + return false; + } + return true; +} + +bool parseArgDirection(const string& s, bool* out) { + if (EqualsIgnoreCase(s, "up")) { + *out = true; + } else if (EqualsIgnoreCase(s, "down")) { + *out = false; + } else { + return false; + } + return true; +} + +bool parseArgIdentifierTypeArray(const string& s, vector* out) { + for (const string& val : ::android::base::Split(s, ",")) { + int outInt; + if (!parseArgInt(val, &outInt)) { + return false; + } + out->push_back(getType(outInt)); + } + return true; +} + +bool parseProgramIdentifierList(const std::string& s, vector* out) { + for (const string& idStr : ::android::base::Split(s, ",")) { + const vector idStrPair = ::android::base::Split(idStr, ":"); + if (idStrPair.size() != 2) { + return false; + } + int idType; + if (!parseArgInt(idStrPair[0], &idType)) { + return false; + } + long idVal; + if (!parseArgLong(idStrPair[1], &idVal)) { + return false; + } + ProgramIdentifier id = {getType(idType), idVal}; + out->push_back(id); + } + return true; +} + } // namespace utils utils::IdentifierIterator begin(const ProgramSelector& sel) { diff --git a/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h b/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h index c79c5c5533..8ea6319ce7 100644 --- a/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h +++ b/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h @@ -166,6 +166,20 @@ inline std::string vectorToString(const std::vector& in_values) { }); } +IdentifierType getType(int typeAsInt); + +bool parseArgInt(const std::string& s, int* out); + +bool parseArgLong(const std::string& s, long* out); + +bool parseArgBool(const std::string& s, bool* out); + +bool parseArgDirection(const std::string& s, bool* out); + +bool parseArgIdentifierTypeArray(const std::string& s, std::vector* out); + +bool parseProgramIdentifierList(const std::string& s, std::vector* out); + } // namespace utils utils::IdentifierIterator begin(const ProgramSelector& sel); From 5b1a1c787fc9ad6ea6d304d3270965e31ec1896a Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Tue, 2 Aug 2022 18:31:04 -0700 Subject: [PATCH 264/998] Define IRemoteAccess.aidl. Define the HAL interface for a wakeup client. This interface will be used by remote task client to receive remote tasks. Test: m android.hardware.automotive.remoteaccess-update-api Bug: 241170646 Change-Id: I332221b303274463dfa5b46d78cf0d81f6045e4b --- automotive/remoteaccess/Android.bp | 39 ++++++++ automotive/remoteaccess/OWNERS | 2 + .../automotive/remoteaccess/ApState.aidl | 39 ++++++++ .../remoteaccess/IRemoteAccess.aidl | 42 +++++++++ .../remoteaccess/IRemoteTaskCallback.aidl | 38 ++++++++ .../automotive/remoteaccess/ApState.aidl | 38 ++++++++ .../remoteaccess/IRemoteAccess.aidl | 88 +++++++++++++++++++ .../remoteaccess/IRemoteTaskCallback.aidl | 31 +++++++ .../compatibility_matrix.current.xml | 7 ++ 9 files changed, 324 insertions(+) create mode 100644 automotive/remoteaccess/Android.bp create mode 100644 automotive/remoteaccess/OWNERS create mode 100644 automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/current/android/hardware/automotive/remoteaccess/ApState.aidl create mode 100644 automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/current/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl create mode 100644 automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/current/android/hardware/automotive/remoteaccess/IRemoteTaskCallback.aidl create mode 100644 automotive/remoteaccess/android/hardware/automotive/remoteaccess/ApState.aidl create mode 100644 automotive/remoteaccess/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl create mode 100644 automotive/remoteaccess/android/hardware/automotive/remoteaccess/IRemoteTaskCallback.aidl diff --git a/automotive/remoteaccess/Android.bp b/automotive/remoteaccess/Android.bp new file mode 100644 index 0000000000..ac04354609 --- /dev/null +++ b/automotive/remoteaccess/Android.bp @@ -0,0 +1,39 @@ +// 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. + +package { + default_applicable_licenses: ["hardware_interfaces_license"], +} + +aidl_interface { + name: "android.hardware.automotive.remoteaccess", + vendor_available: true, + srcs: [ + "android/hardware/automotive/remoteaccess/**/*.aidl", + ], + stability: "vintf", + backend: { + cpp: { + enabled: false, + }, + java: { + sdk_version: "module_current", + min_sdk_version: "31", + apex_available: [ + "//apex_available:platform", + "com.android.car.framework", + ], + }, + }, +} diff --git a/automotive/remoteaccess/OWNERS b/automotive/remoteaccess/OWNERS new file mode 100644 index 0000000000..d6969e5eb5 --- /dev/null +++ b/automotive/remoteaccess/OWNERS @@ -0,0 +1,2 @@ +ericjeong@google.com +shanyu@google.com diff --git a/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/current/android/hardware/automotive/remoteaccess/ApState.aidl b/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/current/android/hardware/automotive/remoteaccess/ApState.aidl new file mode 100644 index 0000000000..da4f1d4304 --- /dev/null +++ b/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/current/android/hardware/automotive/remoteaccess/ApState.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.remoteaccess; +@VintfStability +parcelable ApState { + boolean isReadyForRemoteTask; + boolean isWakeupRequired; +} diff --git a/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/current/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl b/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/current/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl new file mode 100644 index 0000000000..9b6eb2f297 --- /dev/null +++ b/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/current/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.remoteaccess; +@VintfStability +interface IRemoteAccess { + String getDeviceId(); + String getWakeupServiceName(); + void setRemoteTaskCallback(android.hardware.automotive.remoteaccess.IRemoteTaskCallback callback); + void clearRemoteTaskCallback(); + void notifyApStateChange(in android.hardware.automotive.remoteaccess.ApState state); +} diff --git a/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/current/android/hardware/automotive/remoteaccess/IRemoteTaskCallback.aidl b/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/current/android/hardware/automotive/remoteaccess/IRemoteTaskCallback.aidl new file mode 100644 index 0000000000..295100ea51 --- /dev/null +++ b/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/current/android/hardware/automotive/remoteaccess/IRemoteTaskCallback.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.remoteaccess; +@VintfStability +interface IRemoteTaskCallback { + oneway void onRemoteTaskRequested(String clientId, in byte[] data); +} diff --git a/automotive/remoteaccess/android/hardware/automotive/remoteaccess/ApState.aidl b/automotive/remoteaccess/android/hardware/automotive/remoteaccess/ApState.aidl new file mode 100644 index 0000000000..c8eb3eff8d --- /dev/null +++ b/automotive/remoteaccess/android/hardware/automotive/remoteaccess/ApState.aidl @@ -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. + */ + +package android.hardware.automotive.remoteaccess; + +@VintfStability +parcelable ApState { + /** + * Whether AP (application processor) is ready to receive remote tasks. + * + * If this is true. AP is powered on and the car service is ready to handle + * remote tasks. + */ + boolean isReadyForRemoteTask; + /** + * Whether AP (application processor) needs to be woken up. + * + * While the AP is shutting down, this will be set to false to prevent the + * wakeup signal to interrupt the shutdown process. At the last step of the + * shutdown process, this will be set to true so that AP will be waken + * up when task arrives. After AP starts up, this will be set to false + * to prevent unnecessary wakeup signal. + */ + boolean isWakeupRequired; +} diff --git a/automotive/remoteaccess/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl b/automotive/remoteaccess/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl new file mode 100644 index 0000000000..a198b038a5 --- /dev/null +++ b/automotive/remoteaccess/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl @@ -0,0 +1,88 @@ +/* + * 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. + */ + +package android.hardware.automotive.remoteaccess; + +import android.hardware.automotive.remoteaccess.ApState; +import android.hardware.automotive.remoteaccess.IRemoteTaskCallback; + +/** + * Interface representing a remote wakeup client. + * + * A wakeup client is a binary outside Android framework that communicates with + * a wakeup server and receives wake up command. + */ +@VintfStability +interface IRemoteAccess { + /** + * Gets a unique device ID that could be recognized by wake up server. + * + * This device ID is provisioned during car production and is registered + * with the wake up server. + * + * @return a unique device ID. + */ + String getDeviceId(); + + /** + * Gets the name for the remote wakeup server. + * + * This name will be provided to remote task server during registration + * and used by remote task server to find the remote wakeup server to + * use for waking up the device. This name must be pre-negotiated between + * the remote wakeup server/client and the remote task server/client and + * must be unique. We recommend the format to be a human readable string + * with reverse domain name notation (reverse-DNS), e.g. + * "com.google.vehicle.wakeup". + */ + String getWakeupServiceName(); + + /** + * Sets a callback to be called when a remote task is requested. + * + * @param callback A callback to be called when a remote task is requested. + */ + void setRemoteTaskCallback(IRemoteTaskCallback callback); + + /** + * Clears a previously set remote task callback. + * + * If no callback was set, this operation is no-op. + */ + void clearRemoteTaskCallback(); + + /** + * Notifies whether AP is ready to receive remote tasks. + * + *

Wakeup client should store and use this state until a new call with a + * different state arrives. + * + *

If {@code isReadyForRemoteTask} is true, the wakeup client may send + * the task received from the server to AP immediately. + * + *

If {@code isReadyForRemoteTask} is false, it must store the received + * remote tasks and wait until AP is ready to receive tasks. If it takes too + * long for AP to become ready, the task must be reported to remote task + * server as failed. Implementation must make sure no duplicate tasks are + * delivered to AP. + * + *

If {@code isWakeupRequired} is true, it must try to wake up AP when a + * remote task arrives or when there are pending requests. + * + *

If {@code isWakeupRequired} is false, it must not try to wake up AP. + */ + void notifyApStateChange(in ApState state); +} diff --git a/automotive/remoteaccess/android/hardware/automotive/remoteaccess/IRemoteTaskCallback.aidl b/automotive/remoteaccess/android/hardware/automotive/remoteaccess/IRemoteTaskCallback.aidl new file mode 100644 index 0000000000..7a1616f107 --- /dev/null +++ b/automotive/remoteaccess/android/hardware/automotive/remoteaccess/IRemoteTaskCallback.aidl @@ -0,0 +1,31 @@ +/* + * 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. + */ + +package android.hardware.automotive.remoteaccess; + +/** + * The callback interface for car service to receive tasks from wakup client. + */ +@VintfStability +interface IRemoteTaskCallback { + /** + * A callback that is called when a remote task is requested. + * + * @param clientId An ID to uniquely identify a remote task client. + * @param data Opaque task data passed to the remote task client. + */ + oneway void onRemoteTaskRequested(String clientId, in byte[] data); +} diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 9b8e56017a..c5ca336692 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -111,6 +111,13 @@ IVehicle .* + + + android.hardware.automotive.remoteaccess + + IRemoteAccess + .* + android.hardware.biometrics.face From cb6afed51f528cc2f3e56b34a3ea7c53ad51e100 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Thu, 4 Aug 2022 16:58:28 -0700 Subject: [PATCH 265/998] Define grpc proto for remoteaccess. This proto defines the GRPC interface supported by vendor wakeup client. remoteaccess HAL will use this interface to communicate with vendor wakeup client on TCU. Test: Presubmit Bug: 241482331 Change-Id: Idc68ad6cdcecac0103245cf8a415bdf6205105cc --- automotive/remoteaccess/grpc/proto/Android.bp | 68 +++++++++++++++++++ .../grpc/proto/wakeup_client.proto | 66 ++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 automotive/remoteaccess/grpc/proto/Android.bp create mode 100644 automotive/remoteaccess/grpc/proto/wakeup_client.proto diff --git a/automotive/remoteaccess/grpc/proto/Android.bp b/automotive/remoteaccess/grpc/proto/Android.bp new file mode 100644 index 0000000000..c882f55446 --- /dev/null +++ b/automotive/remoteaccess/grpc/proto/Android.bp @@ -0,0 +1,68 @@ +// 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. + +genrule { + name: "wakeup_client_pb_h", + tools: [ + "aprotoc", + "protoc-gen-grpc-cpp-plugin", + ], + cmd: "$(location aprotoc) -I$$(dirname $(in)) -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)", + srcs: [ + "wakeup_client.proto", + ], + out: [ + "wakeup_client.pb.h", + ], +} + +genrule { + name: "wakeup_client_pb_cc", + tools: [ + "aprotoc", + "protoc-gen-grpc-cpp-plugin", + ], + cmd: "$(location aprotoc) -I$$(dirname $(in)) -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)", + srcs: [ + "wakeup_client.proto", + ], + out: [ + "wakeup_client.pb.cc", + ], +} + +cc_library_static { + name: "wakeup_client_protos", + vendor: true, + host_supported: true, + include_dirs: [ + "external/protobuf/src", + ], + generated_headers: [ + "wakeup_client_pb_h", + ], + export_generated_headers: [ + "wakeup_client_pb_h", + ], + generated_sources: [ + "wakeup_client_pb_cc", + ], + shared_libs: [ + "libgrpc++", + "libprotobuf-cpp-full", + ], + cflags: [ + "-Wno-unused-parameter", + ], +} diff --git a/automotive/remoteaccess/grpc/proto/wakeup_client.proto b/automotive/remoteaccess/grpc/proto/wakeup_client.proto new file mode 100644 index 0000000000..4fe0d0177b --- /dev/null +++ b/automotive/remoteaccess/grpc/proto/wakeup_client.proto @@ -0,0 +1,66 @@ +/* + * 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 = "proto3"; + +package android.hardware.automotive.remoteaccess; + +/** + * Service provided by a wakeup client running on TCU. + */ +service WakeupClient { + /** + * Establish a long-live connection to receive remote tasks. + * + *

For the server, whenever a remote task arrives, if the connection is + * alive, it will use the return stream to return a task's information. + * + *

If the connection is not alive, the server must stores the remote task + * until a new connection is established (which means AP is ready to + * receive remote task again) and send the stored tasks. + * + *

If the server closes the connection, the client will try to + * reestablish the connection. + */ + rpc GetRemoteTasks(GetRemoteTasksRequest) returns (stream GetRemoteTasksResponse) {} + + /** + * Notifies whether AP is required to be waken up when remote task arrives. + * + *

Wakeup client should store and use this state until a new call with a + * different state arrives. + * + *

If {@code isWakeupRequired} in the request is true, it must wake up AP + * when a remote task arrives. + * + *

If {@code isWakeupRequired} in the request is false, it must not try + * to wake up AP. + */ + rpc NotifyWakeupRequired(NotifyWakeupRequiredRequest) returns (NotifyWakeupRequiredResponse) {} +} + +message GetRemoteTasksRequest {} + +message GetRemoteTasksResponse { + string clientId = 1; + bytes data = 2; +} + +message NotifyWakeupRequiredRequest { + bool isWakeupRequired = 1; +} + +message NotifyWakeupRequiredResponse {} From b138c42a0d09516c05ef2bed60a5ed9a6ffc3466 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Tue, 6 Sep 2022 19:11:23 -0700 Subject: [PATCH 266/998] Implement receiving remote task. Test: atest RemoteAccessServiceUnitTest Bug: 241483300 Change-Id: I3d7f54f154beebba1bb1bdb7640dfe973ad012e4 --- .../client/include/RemoteAccessService.h | 32 ++- .../client/src/RemoteAccessService.cpp | 116 +++++++++- .../test/RemoteAccessServiceUnitTest.cpp | 202 +++++++++++++++++- 3 files changed, 336 insertions(+), 14 deletions(-) diff --git a/automotive/remoteaccess/impl/default/client/include/RemoteAccessService.h b/automotive/remoteaccess/impl/default/client/include/RemoteAccessService.h index f060b6ca98..806440a2df 100644 --- a/automotive/remoteaccess/impl/default/client/include/RemoteAccessService.h +++ b/automotive/remoteaccess/impl/default/client/include/RemoteAccessService.h @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -32,7 +33,9 @@ namespace remoteaccess { class RemoteAccessService : public aidl::android::hardware::automotive::remoteaccess::BnRemoteAccess { public: - RemoteAccessService(WakeupClient::StubInterface* grpcStub); + explicit RemoteAccessService(WakeupClient::StubInterface* grpcStub); + + ~RemoteAccessService(); ndk::ScopedAStatus getDeviceId(std::string* deviceId) override; @@ -49,12 +52,29 @@ class RemoteAccessService const aidl::android::hardware::automotive::remoteaccess::ApState& newState) override; private: - WakeupClient::StubInterface* mGrpcStub; - std::shared_ptr - mRemoteTaskCallback; - std::thread mThread; + // For testing. + friend class RemoteAccessServiceUnitTest; - void taskLoop(); + WakeupClient::StubInterface* mGrpcStub; + std::thread mThread; + std::mutex mLock; + std::condition_variable mCv; + std::shared_ptr + mRemoteTaskCallback GUARDED_BY(mLock); + std::unique_ptr mGetRemoteTasksContext GUARDED_BY(mLock); + // Associated with mCv to notify the task loop to stop waiting and exit. + bool mTaskWaitStopped GUARDED_BY(mLock); + // A mutex to make sure startTaskLoop does not overlap with stopTaskLoop. + std::mutex mStartStopTaskLoopLock; + bool mTaskLoopRunning GUARDED_BY(mStartStopTaskLoopLock); + // Default wait time before retry connecting to remote access client is 10s. + size_t mRetryWaitInMs = 10'000; + + void runTaskLoop(); + void maybeStartTaskLoop(); + void maybeStopTaskLoop(); + + void setRetryWaitInMs(size_t retryWaitInMs) { mRetryWaitInMs = retryWaitInMs; } }; } // namespace remoteaccess diff --git a/automotive/remoteaccess/impl/default/client/src/RemoteAccessService.cpp b/automotive/remoteaccess/impl/default/client/src/RemoteAccessService.cpp index f567113b0e..6b97840999 100644 --- a/automotive/remoteaccess/impl/default/client/src/RemoteAccessService.cpp +++ b/automotive/remoteaccess/impl/default/client/src/RemoteAccessService.cpp @@ -31,23 +31,111 @@ namespace { using ::aidl::android::hardware::automotive::remoteaccess::ApState; using ::aidl::android::hardware::automotive::remoteaccess::IRemoteTaskCallback; +using ::android::base::ScopedLockAssertion; using ::grpc::ClientContext; -using ::grpc::ClientReader; +using ::grpc::ClientReaderInterface; using ::grpc::Status; using ::grpc::StatusCode; using ::ndk::ScopedAStatus; const std::string WAKEUP_SERVICE_NAME = "com.google.vehicle.wakeup"; +std::vector stringToBytes(const std::string& s) { + const char* data = s.data(); + return std::vector(data, data + s.size()); +} + +ScopedAStatus rpcStatusToScopedAStatus(const Status& status, const std::string& errorMsg) { + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + status.error_code(), (errorMsg + ", error: " + status.error_message()).c_str()); +} + } // namespace RemoteAccessService::RemoteAccessService(WakeupClient::StubInterface* grpcStub) - : mGrpcStub(grpcStub) { - // mThread = std::thread([this]() { taskLoop(); }); + : mGrpcStub(grpcStub){}; + +RemoteAccessService::~RemoteAccessService() { + maybeStopTaskLoop(); } -void RemoteAccessService::taskLoop() { - // TODO(b/241483300): handle remote tasks. +void RemoteAccessService::maybeStartTaskLoop() { + std::lock_guard lockGuard(mStartStopTaskLoopLock); + if (mTaskLoopRunning) { + return; + } + + mThread = std::thread([this]() { runTaskLoop(); }); + + mTaskLoopRunning = true; +} + +void RemoteAccessService::maybeStopTaskLoop() { + std::lock_guard lockGuard(mStartStopTaskLoopLock); + if (!mTaskLoopRunning) { + return; + } + + { + std::lock_guard lockGuard(mLock); + // Try to stop the reading stream. + if (mGetRemoteTasksContext) { + mGetRemoteTasksContext->TryCancel(); + mGetRemoteTasksContext.reset(); + } + mTaskWaitStopped = true; + mCv.notify_all(); + } + if (mThread.joinable()) { + mThread.join(); + } + + mTaskLoopRunning = false; +} + +void RemoteAccessService::runTaskLoop() { + GetRemoteTasksRequest request = {}; + std::unique_ptr> reader; + while (true) { + { + std::lock_guard lockGuard(mLock); + mGetRemoteTasksContext.reset(new ClientContext()); + reader = mGrpcStub->GetRemoteTasks(mGetRemoteTasksContext.get(), request); + } + GetRemoteTasksResponse response; + while (reader->Read(&response)) { + std::shared_ptr callback; + { + std::lock_guard lockGuard(mLock); + callback = mRemoteTaskCallback; + } + if (callback == nullptr) { + continue; + } + ScopedAStatus callbackStatus = callback->onRemoteTaskRequested( + response.clientid(), stringToBytes(response.data())); + if (!callbackStatus.isOk()) { + ALOGE("Failed to call onRemoteTaskRequested callback, status: %d, message: %s", + callbackStatus.getStatus(), callbackStatus.getMessage()); + } + } + Status status = reader->Finish(); + + ALOGE("GetRemoteTasks stream breaks, code: %d, message: %s, sleeping for 10s and retry", + status.error_code(), status.error_message().c_str()); + // The long lasting connection should not return. But if the server returns, retry after + // 10s. + { + std::unique_lock lk(mLock); + if (mCv.wait_for(lk, std::chrono::milliseconds(mRetryWaitInMs), [this] { + ScopedLockAssertion lockAssertion(mLock); + return mTaskWaitStopped; + })) { + // If the stopped flag is set, we are quitting, exit the loop. + break; + } + } + } } ScopedAStatus RemoteAccessService::getDeviceId(std::string* deviceId) { @@ -62,16 +150,32 @@ ScopedAStatus RemoteAccessService::getWakeupServiceName(std::string* wakeupServi ScopedAStatus RemoteAccessService::setRemoteTaskCallback( [[maybe_unused]] const std::shared_ptr& callback) { + std::lock_guard lockGuard(mLock); mRemoteTaskCallback = callback; return ScopedAStatus::ok(); } ScopedAStatus RemoteAccessService::clearRemoteTaskCallback() { + std::lock_guard lockGuard(mLock); mRemoteTaskCallback.reset(); return ScopedAStatus::ok(); } -ScopedAStatus RemoteAccessService::notifyApStateChange([[maybe_unused]] const ApState& newState) { +ScopedAStatus RemoteAccessService::notifyApStateChange(const ApState& newState) { + ClientContext context; + NotifyWakeupRequiredRequest request = {}; + request.set_iswakeuprequired(newState.isWakeupRequired); + NotifyWakeupRequiredResponse response = {}; + Status status = mGrpcStub->NotifyWakeupRequired(&context, request, &response); + if (!status.ok()) { + return rpcStatusToScopedAStatus(status, "Failed to notify isWakeupRequired"); + } + + if (newState.isReadyForRemoteTask) { + maybeStartTaskLoop(); + } else { + maybeStopTaskLoop(); + } return ScopedAStatus::ok(); } diff --git a/automotive/remoteaccess/impl/default/test/RemoteAccessServiceUnitTest.cpp b/automotive/remoteaccess/impl/default/test/RemoteAccessServiceUnitTest.cpp index de259271b0..11523f69db 100644 --- a/automotive/remoteaccess/impl/default/test/RemoteAccessServiceUnitTest.cpp +++ b/automotive/remoteaccess/impl/default/test/RemoteAccessServiceUnitTest.cpp @@ -16,15 +16,25 @@ #include "RemoteAccessService.h" +#include +#include #include +#include #include #include +#include +#include namespace android { namespace hardware { namespace automotive { namespace remoteaccess { +using ::android::base::ScopedLockAssertion; + +using ::aidl::android::hardware::automotive::remoteaccess::ApState; +using ::aidl::android::hardware::automotive::remoteaccess::BnRemoteTaskCallback; + using ::grpc::ClientAsyncReaderInterface; using ::grpc::ClientAsyncResponseReaderInterface; using ::grpc::ClientContext; @@ -32,8 +42,12 @@ using ::grpc::ClientReader; using ::grpc::ClientReaderInterface; using ::grpc::CompletionQueue; using ::grpc::Status; - +using ::grpc::testing::MockClientReader; using ::ndk::ScopedAStatus; +using ::testing::_; +using ::testing::DoAll; +using ::testing::Return; +using ::testing::SetArgPointee; class MockGrpcClientStub : public WakeupClient::StubInterface { public: @@ -59,9 +73,37 @@ class MockGrpcClientStub : public WakeupClient::StubInterface { CompletionQueue* cq)); }; +class FakeRemoteTaskCallback : public BnRemoteTaskCallback { + public: + ScopedAStatus onRemoteTaskRequested(const std::string& clientId, + const std::vector& data) override { + std::lock_guard lockGuard(mLock); + mDataByClientId[clientId] = data; + mTaskCount++; + mCv.notify_all(); + return ScopedAStatus::ok(); + } + + std::vector getData(const std::string& clientId) { return mDataByClientId[clientId]; } + + bool wait(size_t taskCount, size_t timeoutInSec) { + std::unique_lock lock(mLock); + return mCv.wait_for(lock, std::chrono::seconds(timeoutInSec), [taskCount, this] { + ScopedLockAssertion lockAssertion(mLock); + return mTaskCount >= taskCount; + }); + } + + private: + std::mutex mLock; + std::unordered_map> mDataByClientId GUARDED_BY(mLock); + size_t mTaskCount GUARDED_BY(mLock) = 0; + std::condition_variable mCv; +}; + class RemoteAccessServiceUnitTest : public ::testing::Test { public: - RemoteAccessServiceUnitTest() { + virtual void SetUp() override { mGrpcWakeupClientStub = std::make_unique(); mService = ndk::SharedRefBase::make(mGrpcWakeupClientStub.get()); } @@ -70,9 +112,12 @@ class RemoteAccessServiceUnitTest : public ::testing::Test { RemoteAccessService* getService() { return mService.get(); } + void setRetryWaitInMs(size_t retryWaitInMs) { mService->setRetryWaitInMs(retryWaitInMs); } + private: std::unique_ptr mGrpcWakeupClientStub; std::shared_ptr mService; + MockClientReader* mMockTaskReader; }; TEST_F(RemoteAccessServiceUnitTest, TestGetWakeupServiceName) { @@ -84,6 +129,159 @@ TEST_F(RemoteAccessServiceUnitTest, TestGetWakeupServiceName) { EXPECT_EQ(serviceName, "com.google.vehicle.wakeup"); } +TEST_F(RemoteAccessServiceUnitTest, TestNotifyApStateChangeWakeupRequired) { + bool isWakeupRequired = false; + EXPECT_CALL(*getGrpcWakeupClientStub(), NotifyWakeupRequired) + .WillOnce([&isWakeupRequired]([[maybe_unused]] ClientContext* context, + const NotifyWakeupRequiredRequest& request, + [[maybe_unused]] NotifyWakeupRequiredResponse* response) { + isWakeupRequired = request.iswakeuprequired(); + return Status(); + }); + + ApState newState = { + .isWakeupRequired = true, + }; + ScopedAStatus status = getService()->notifyApStateChange(newState); + + EXPECT_TRUE(status.isOk()); + EXPECT_TRUE(isWakeupRequired); +} + +TEST_F(RemoteAccessServiceUnitTest, TestGetRemoteTasks) { + GetRemoteTasksResponse response1; + std::vector testData = {0xde, 0xad, 0xbe, 0xef}; + response1.set_clientid("1"); + response1.set_data(testData.data(), testData.size()); + GetRemoteTasksResponse response2; + response2.set_clientid("2"); + std::shared_ptr callback = + ndk::SharedRefBase::make(); + + ON_CALL(*getGrpcWakeupClientStub(), GetRemoteTasksRaw) + .WillByDefault( + [response1, response2]([[maybe_unused]] ClientContext* context, + [[maybe_unused]] const GetRemoteTasksRequest& request) { + // mockReader ownership will be transferred to the client so we don't own it + // here. + MockClientReader* mockClientReader = + new MockClientReader(); + EXPECT_CALL(*mockClientReader, Finish()).WillOnce(Return(Status::OK)); + EXPECT_CALL(*mockClientReader, Read(_)) + .WillOnce(DoAll(SetArgPointee<0>(response1), Return(true))) + .WillOnce(DoAll(SetArgPointee<0>(response2), Return(true))) + .WillRepeatedly(Return(false)); + return mockClientReader; + }); + + getService()->setRemoteTaskCallback(callback); + // Start the long live connection to receive tasks. + ApState newState = { + .isReadyForRemoteTask = true, + }; + ASSERT_TRUE(getService()->notifyApStateChange(newState).isOk()); + + ASSERT_TRUE(callback->wait(/*taskCount=*/2, /*timeoutInSec=*/10)) + << "Did not receive enough tasks"; + EXPECT_EQ(callback->getData("1"), testData); + EXPECT_EQ(callback->getData("2"), std::vector()); +} + +TEST_F(RemoteAccessServiceUnitTest, TestGetRemoteTasksRetryConnection) { + GetRemoteTasksResponse response; + std::shared_ptr callback = + ndk::SharedRefBase::make(); + + ON_CALL(*getGrpcWakeupClientStub(), GetRemoteTasksRaw) + .WillByDefault([response]([[maybe_unused]] ClientContext* context, + [[maybe_unused]] const GetRemoteTasksRequest& request) { + // mockReader ownership will be transferred to the client so we don't own it here. + MockClientReader* mockClientReader = + new MockClientReader(); + EXPECT_CALL(*mockClientReader, Finish()).WillOnce(Return(Status::OK)); + // Connection fails after receiving one task. Should retry after some time. + EXPECT_CALL(*mockClientReader, Read(_)) + .WillOnce(DoAll(SetArgPointee<0>(response), Return(true))) + .WillRepeatedly(Return(false)); + return mockClientReader; + }); + + getService()->setRemoteTaskCallback(callback); + setRetryWaitInMs(100); + // Start the long live connection to receive tasks. + ApState newState = { + .isReadyForRemoteTask = true, + }; + ASSERT_TRUE(getService()->notifyApStateChange(newState).isOk()); + + ASSERT_TRUE(callback->wait(/*taskCount=*/2, /*timeoutInSec=*/10)) + << "Did not receive enough tasks"; +} + +TEST_F(RemoteAccessServiceUnitTest, TestGetRemoteTasksDefaultNotReady) { + GetRemoteTasksResponse response1; + std::vector testData = {0xde, 0xad, 0xbe, 0xef}; + response1.set_clientid("1"); + response1.set_data(testData.data(), testData.size()); + GetRemoteTasksResponse response2; + response2.set_clientid("2"); + std::shared_ptr callback = + ndk::SharedRefBase::make(); + + EXPECT_CALL(*getGrpcWakeupClientStub(), GetRemoteTasksRaw).Times(0); + + // Default state is not ready for remote tasks, so no callback will be called. + getService()->setRemoteTaskCallback(callback); + + std::this_thread::sleep_for(std::chrono::milliseconds(100)); +} + +TEST_F(RemoteAccessServiceUnitTest, TestGetRemoteTasksNotReadyAfterReady) { + GetRemoteTasksResponse response1; + std::vector testData = {0xde, 0xad, 0xbe, 0xef}; + response1.set_clientid("1"); + response1.set_data(testData.data(), testData.size()); + GetRemoteTasksResponse response2; + response2.set_clientid("2"); + std::shared_ptr callback = + ndk::SharedRefBase::make(); + + ON_CALL(*getGrpcWakeupClientStub(), GetRemoteTasksRaw) + .WillByDefault( + [response1, response2]([[maybe_unused]] ClientContext* context, + [[maybe_unused]] const GetRemoteTasksRequest& request) { + // mockReader ownership will be transferred to the client so we don't own it + // here. + MockClientReader* mockClientReader = + new MockClientReader(); + EXPECT_CALL(*mockClientReader, Finish()).WillOnce(Return(Status::OK)); + EXPECT_CALL(*mockClientReader, Read(_)) + .WillOnce(DoAll(SetArgPointee<0>(response1), Return(true))) + .WillOnce(DoAll(SetArgPointee<0>(response2), Return(true))) + .WillRepeatedly(Return(false)); + return mockClientReader; + }); + // Should only be called once when is is ready for remote task. + EXPECT_CALL(*getGrpcWakeupClientStub(), GetRemoteTasksRaw).Times(1); + + getService()->setRemoteTaskCallback(callback); + setRetryWaitInMs(100); + // Start the long live connection to receive tasks. + ApState newState = { + .isReadyForRemoteTask = true, + }; + ASSERT_TRUE(getService()->notifyApStateChange(newState).isOk()); + ASSERT_TRUE(callback->wait(/*taskCount=*/2, /*timeoutInSec=*/10)) + << "Did not receive enough tasks"; + + // Stop the long live connection. + newState.isReadyForRemoteTask = false; + ASSERT_TRUE(getService()->notifyApStateChange(newState).isOk()); + + // Wait for the retry delay, but the loop should already exit. + std::this_thread::sleep_for(std::chrono::milliseconds(150)); +} + } // namespace remoteaccess } // namespace automotive } // namespace hardware From 562c0f803579a5f9814a0426db90e0b401b17196 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Thu, 4 Aug 2022 17:10:38 -0700 Subject: [PATCH 267/998] Define remoteaccess grpc HAL. Define a remote access HAL that talks with a wakeup client on TCU through grpc. Test: make android.hardware.automotive.remoteaccess Bug: 241483300 Change-Id: I3bc6c8b837c157744f1d2b5f2e9c287e44a33883 --- .../impl/default/client/Android.bp | 54 +++++++++++++++++++ .../client/include/RemoteAccessService.h | 51 ++++++++++++++++++ .../client/remoteaccess-default-service.rc | 4 ++ .../client/remoteaccess-default-service.xml | 7 +++ .../default/client/src/RemoteAccessImpl.cpp | 53 ++++++++++++++++++ .../client/src/RemoteAccessService.cpp | 53 ++++++++++++++++++ .../{grpc => impl/default}/proto/Android.bp | 0 .../default}/proto/wakeup_client.proto | 0 8 files changed, 222 insertions(+) create mode 100644 automotive/remoteaccess/impl/default/client/Android.bp create mode 100644 automotive/remoteaccess/impl/default/client/include/RemoteAccessService.h create mode 100644 automotive/remoteaccess/impl/default/client/remoteaccess-default-service.rc create mode 100644 automotive/remoteaccess/impl/default/client/remoteaccess-default-service.xml create mode 100644 automotive/remoteaccess/impl/default/client/src/RemoteAccessImpl.cpp create mode 100644 automotive/remoteaccess/impl/default/client/src/RemoteAccessService.cpp rename automotive/remoteaccess/{grpc => impl/default}/proto/Android.bp (100%) rename automotive/remoteaccess/{grpc => impl/default}/proto/wakeup_client.proto (100%) diff --git a/automotive/remoteaccess/impl/default/client/Android.bp b/automotive/remoteaccess/impl/default/client/Android.bp new file mode 100644 index 0000000000..38c79af686 --- /dev/null +++ b/automotive/remoteaccess/impl/default/client/Android.bp @@ -0,0 +1,54 @@ +/* + * 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. + */ + +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_binary { + name: "android.hardware.automotive.remoteaccess@V1-default-service", + vendor: true, + vintf_fragments: ["remoteaccess-default-service.xml"], + init_rc: ["remoteaccess-default-service.rc"], + relative_install_path: "hw", + srcs: ["src/RemoteAccessImpl.cpp"], + whole_static_libs: [ + "RemoteAccessService", + ], + shared_libs: [ + "libbinder_ndk", + "liblog", + "libutils", + ], +} + +cc_library { + name: "RemoteAccessService", + vendor: true, + local_include_dirs: ["include"], + export_include_dirs: ["include"], + srcs: [ + "src/RemoteAccessService.cpp", + ], + whole_static_libs: [ + "android.hardware.automotive.remoteaccess-V1-ndk", + ], + shared_libs: [ + "libbinder_ndk", + "liblog", + "libutils", + ], +} diff --git a/automotive/remoteaccess/impl/default/client/include/RemoteAccessService.h b/automotive/remoteaccess/impl/default/client/include/RemoteAccessService.h new file mode 100644 index 0000000000..c54aefe312 --- /dev/null +++ b/automotive/remoteaccess/impl/default/client/include/RemoteAccessService.h @@ -0,0 +1,51 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include + +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace remoteaccess { + +class RemoteAccessService + : public aidl::android::hardware::automotive::remoteaccess::BnRemoteAccess { + public: + ndk::ScopedAStatus getDeviceId(std::string* deviceId) override; + + ndk::ScopedAStatus getWakeupServiceName(std::string* wakeupServerName) override; + + ndk::ScopedAStatus setRemoteTaskCallback( + const std::shared_ptr< + aidl::android::hardware::automotive::remoteaccess::IRemoteTaskCallback>& + callback) override; + + ndk::ScopedAStatus clearRemoteTaskCallback() override; + + ndk::ScopedAStatus notifyApStateChange( + const aidl::android::hardware::automotive::remoteaccess::ApState& newState) override; +}; + +} // namespace remoteaccess +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/remoteaccess/impl/default/client/remoteaccess-default-service.rc b/automotive/remoteaccess/impl/default/client/remoteaccess-default-service.rc new file mode 100644 index 0000000000..b7a9cdc82a --- /dev/null +++ b/automotive/remoteaccess/impl/default/client/remoteaccess-default-service.rc @@ -0,0 +1,4 @@ +service vendor.remoteaccess-default /vendor/bin/hw/android.hardware.automotive.remoteaccess@V1-default-service + class hal + user vehicle_network + group system inet diff --git a/automotive/remoteaccess/impl/default/client/remoteaccess-default-service.xml b/automotive/remoteaccess/impl/default/client/remoteaccess-default-service.xml new file mode 100644 index 0000000000..d050a1b646 --- /dev/null +++ b/automotive/remoteaccess/impl/default/client/remoteaccess-default-service.xml @@ -0,0 +1,7 @@ + + + android.hardware.automotive.remoteaccess + 1 + IRemoteAccess/default + + diff --git a/automotive/remoteaccess/impl/default/client/src/RemoteAccessImpl.cpp b/automotive/remoteaccess/impl/default/client/src/RemoteAccessImpl.cpp new file mode 100644 index 0000000000..91a6419b02 --- /dev/null +++ b/automotive/remoteaccess/impl/default/client/src/RemoteAccessImpl.cpp @@ -0,0 +1,53 @@ +/* + * 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. + */ + +#define LOG_TAG "RemoteAccessImpl" + +#include "RemoteAccessService.h" + +#include +#include +#include + +int main(int /* argc */, char* /* argv */[]) { + ALOGI("Registering RemoteAccessService as service..."); + + auto service = ndk::SharedRefBase::make< + android::hardware::automotive::remoteaccess::RemoteAccessService>(); + + binder_exception_t err = AServiceManager_addService( + service->asBinder().get(), "android.hardware.automotive.remote.IRemoteAccess/default"); + if (err != EX_NONE) { + ALOGE("failed to register android.hardware.automotive.remote.IRemoteAccess service, " + "exception: %d", + err); + return 1; + } + + if (!ABinderProcess_setThreadPoolMaxThreadCount(1)) { + ALOGE("%s", "failed to set thread pool max thread count"); + return 1; + } + ABinderProcess_startThreadPool(); + + ALOGI("RemoteAccess service Ready"); + + ABinderProcess_joinThreadPool(); + + ALOGW("Should not reach here"); + + return 0; +} diff --git a/automotive/remoteaccess/impl/default/client/src/RemoteAccessService.cpp b/automotive/remoteaccess/impl/default/client/src/RemoteAccessService.cpp new file mode 100644 index 0000000000..e24293f846 --- /dev/null +++ b/automotive/remoteaccess/impl/default/client/src/RemoteAccessService.cpp @@ -0,0 +1,53 @@ +/* + * 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. + */ + +#include "RemoteAccessService.h" + +namespace android { +namespace hardware { +namespace automotive { +namespace remoteaccess { + +using ::aidl::android::hardware::automotive::remoteaccess::ApState; +using ::aidl::android::hardware::automotive::remoteaccess::IRemoteTaskCallback; +using ::ndk::ScopedAStatus; + +ScopedAStatus RemoteAccessService::getDeviceId([[maybe_unused]] std::string* deviceId) { + return ScopedAStatus::ok(); +} + +ScopedAStatus RemoteAccessService::getWakeupServiceName( + [[maybe_unused]] std::string* wakeupServiceName) { + return ScopedAStatus::ok(); +} + +ScopedAStatus RemoteAccessService::setRemoteTaskCallback( + [[maybe_unused]] const std::shared_ptr& callback) { + return ScopedAStatus::ok(); +} + +ScopedAStatus RemoteAccessService::clearRemoteTaskCallback() { + return ScopedAStatus::ok(); +} + +ScopedAStatus RemoteAccessService::notifyApStateChange([[maybe_unused]] const ApState& newState) { + return ScopedAStatus::ok(); +} + +} // namespace remoteaccess +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/remoteaccess/grpc/proto/Android.bp b/automotive/remoteaccess/impl/default/proto/Android.bp similarity index 100% rename from automotive/remoteaccess/grpc/proto/Android.bp rename to automotive/remoteaccess/impl/default/proto/Android.bp diff --git a/automotive/remoteaccess/grpc/proto/wakeup_client.proto b/automotive/remoteaccess/impl/default/proto/wakeup_client.proto similarity index 100% rename from automotive/remoteaccess/grpc/proto/wakeup_client.proto rename to automotive/remoteaccess/impl/default/proto/wakeup_client.proto From e29745606af6a5cd0cde77a6852466c33ac74e64 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 10 Aug 2022 18:37:03 -0700 Subject: [PATCH 268/998] Implement the GrpcWakeupClient. Implement a remoteaccess HAL implementation that talks with the wake up client using grpc. Test: local build. Bug: 241483300 Change-Id: I02a51f41427fa2854930d2076ca3a49791488fd9 --- .../impl/default/client/Android.bp | 12 +++ .../client/include/RemoteAccessService.h | 14 ++- .../default/client/src/RemoteAccessImpl.cpp | 3 +- .../client/src/RemoteAccessService.cpp | 34 ++++++- .../impl/default/proto/Android.bp | 4 + .../remoteaccess/impl/default/test/Android.bp | 43 +++++++++ .../test/RemoteAccessServiceUnitTest.cpp | 90 +++++++++++++++++++ 7 files changed, 195 insertions(+), 5 deletions(-) create mode 100644 automotive/remoteaccess/impl/default/test/Android.bp create mode 100644 automotive/remoteaccess/impl/default/test/RemoteAccessServiceUnitTest.cpp diff --git a/automotive/remoteaccess/impl/default/client/Android.bp b/automotive/remoteaccess/impl/default/client/Android.bp index 38c79af686..6327637941 100644 --- a/automotive/remoteaccess/impl/default/client/Android.bp +++ b/automotive/remoteaccess/impl/default/client/Android.bp @@ -32,6 +32,11 @@ cc_binary { "libbinder_ndk", "liblog", "libutils", + "libgrpc++", + "libprotobuf-cpp-full", + ], + cflags: [ + "-Wno-unused-parameter", ], } @@ -45,10 +50,17 @@ cc_library { ], whole_static_libs: [ "android.hardware.automotive.remoteaccess-V1-ndk", + "wakeup_client_protos", ], shared_libs: [ + "libbase", "libbinder_ndk", "liblog", "libutils", + "libgrpc++", + "libprotobuf-cpp-full", + ], + cflags: [ + "-Wno-unused-parameter", ], } diff --git a/automotive/remoteaccess/impl/default/client/include/RemoteAccessService.h b/automotive/remoteaccess/impl/default/client/include/RemoteAccessService.h index c54aefe312..f060b6ca98 100644 --- a/automotive/remoteaccess/impl/default/client/include/RemoteAccessService.h +++ b/automotive/remoteaccess/impl/default/client/include/RemoteAccessService.h @@ -19,8 +19,10 @@ #include #include #include +#include #include +#include namespace android { namespace hardware { @@ -30,9 +32,11 @@ namespace remoteaccess { class RemoteAccessService : public aidl::android::hardware::automotive::remoteaccess::BnRemoteAccess { public: + RemoteAccessService(WakeupClient::StubInterface* grpcStub); + ndk::ScopedAStatus getDeviceId(std::string* deviceId) override; - ndk::ScopedAStatus getWakeupServiceName(std::string* wakeupServerName) override; + ndk::ScopedAStatus getWakeupServiceName(std::string* wakeupServiceName) override; ndk::ScopedAStatus setRemoteTaskCallback( const std::shared_ptr< @@ -43,6 +47,14 @@ class RemoteAccessService ndk::ScopedAStatus notifyApStateChange( const aidl::android::hardware::automotive::remoteaccess::ApState& newState) override; + + private: + WakeupClient::StubInterface* mGrpcStub; + std::shared_ptr + mRemoteTaskCallback; + std::thread mThread; + + void taskLoop(); }; } // namespace remoteaccess diff --git a/automotive/remoteaccess/impl/default/client/src/RemoteAccessImpl.cpp b/automotive/remoteaccess/impl/default/client/src/RemoteAccessImpl.cpp index 91a6419b02..743189854b 100644 --- a/automotive/remoteaccess/impl/default/client/src/RemoteAccessImpl.cpp +++ b/automotive/remoteaccess/impl/default/client/src/RemoteAccessImpl.cpp @@ -25,8 +25,9 @@ int main(int /* argc */, char* /* argv */[]) { ALOGI("Registering RemoteAccessService as service..."); + // TODO(b/241483300): Create GrpcClientStub here. auto service = ndk::SharedRefBase::make< - android::hardware::automotive::remoteaccess::RemoteAccessService>(); + android::hardware::automotive::remoteaccess::RemoteAccessService>(nullptr); binder_exception_t err = AServiceManager_addService( service->asBinder().get(), "android.hardware.automotive.remote.IRemoteAccess/default"); diff --git a/automotive/remoteaccess/impl/default/client/src/RemoteAccessService.cpp b/automotive/remoteaccess/impl/default/client/src/RemoteAccessService.cpp index e24293f846..f567113b0e 100644 --- a/automotive/remoteaccess/impl/default/client/src/RemoteAccessService.cpp +++ b/automotive/remoteaccess/impl/default/client/src/RemoteAccessService.cpp @@ -16,30 +16,58 @@ #include "RemoteAccessService.h" +#include +#include +#include +#include +#include + namespace android { namespace hardware { namespace automotive { namespace remoteaccess { +namespace { + using ::aidl::android::hardware::automotive::remoteaccess::ApState; using ::aidl::android::hardware::automotive::remoteaccess::IRemoteTaskCallback; +using ::grpc::ClientContext; +using ::grpc::ClientReader; +using ::grpc::Status; +using ::grpc::StatusCode; using ::ndk::ScopedAStatus; -ScopedAStatus RemoteAccessService::getDeviceId([[maybe_unused]] std::string* deviceId) { +const std::string WAKEUP_SERVICE_NAME = "com.google.vehicle.wakeup"; + +} // namespace + +RemoteAccessService::RemoteAccessService(WakeupClient::StubInterface* grpcStub) + : mGrpcStub(grpcStub) { + // mThread = std::thread([this]() { taskLoop(); }); +} + +void RemoteAccessService::taskLoop() { + // TODO(b/241483300): handle remote tasks. +} + +ScopedAStatus RemoteAccessService::getDeviceId(std::string* deviceId) { + // TODO(b/241483300): Call VHAL to get VIN. return ScopedAStatus::ok(); } -ScopedAStatus RemoteAccessService::getWakeupServiceName( - [[maybe_unused]] std::string* wakeupServiceName) { +ScopedAStatus RemoteAccessService::getWakeupServiceName(std::string* wakeupServiceName) { + *wakeupServiceName = WAKEUP_SERVICE_NAME; return ScopedAStatus::ok(); } ScopedAStatus RemoteAccessService::setRemoteTaskCallback( [[maybe_unused]] const std::shared_ptr& callback) { + mRemoteTaskCallback = callback; return ScopedAStatus::ok(); } ScopedAStatus RemoteAccessService::clearRemoteTaskCallback() { + mRemoteTaskCallback.reset(); return ScopedAStatus::ok(); } diff --git a/automotive/remoteaccess/impl/default/proto/Android.bp b/automotive/remoteaccess/impl/default/proto/Android.bp index c882f55446..d3c75a65f2 100644 --- a/automotive/remoteaccess/impl/default/proto/Android.bp +++ b/automotive/remoteaccess/impl/default/proto/Android.bp @@ -24,7 +24,9 @@ genrule { ], out: [ "wakeup_client.pb.h", + "wakeup_client.grpc.pb.h", ], + vendor: true, } genrule { @@ -39,7 +41,9 @@ genrule { ], out: [ "wakeup_client.pb.cc", + "wakeup_client.grpc.pb.cc", ], + vendor: true, } cc_library_static { diff --git a/automotive/remoteaccess/impl/default/test/Android.bp b/automotive/remoteaccess/impl/default/test/Android.bp new file mode 100644 index 0000000000..e92440f55f --- /dev/null +++ b/automotive/remoteaccess/impl/default/test/Android.bp @@ -0,0 +1,43 @@ +// 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. + +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_test { + name: "RemoteAccessServiceUnitTest", + vendor: true, + srcs: ["*.cpp"], + whole_static_libs: [ + "RemoteAccessService", + ], + shared_libs: [ + "libbinder_ndk", + "liblog", + "libutils", + "libgrpc++", + "libprotobuf-cpp-full", + ], + // libgrpc++.so is installed as root, require root to access it. + require_root: true, + static_libs: [ + "libgtest", + "libgmock", + ], + cflags: [ + "-Wno-unused-parameter", + ], + test_suites: ["device-tests"], +} diff --git a/automotive/remoteaccess/impl/default/test/RemoteAccessServiceUnitTest.cpp b/automotive/remoteaccess/impl/default/test/RemoteAccessServiceUnitTest.cpp new file mode 100644 index 0000000000..de259271b0 --- /dev/null +++ b/automotive/remoteaccess/impl/default/test/RemoteAccessServiceUnitTest.cpp @@ -0,0 +1,90 @@ +/* + * 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. + */ + +#include "RemoteAccessService.h" + +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace remoteaccess { + +using ::grpc::ClientAsyncReaderInterface; +using ::grpc::ClientAsyncResponseReaderInterface; +using ::grpc::ClientContext; +using ::grpc::ClientReader; +using ::grpc::ClientReaderInterface; +using ::grpc::CompletionQueue; +using ::grpc::Status; + +using ::ndk::ScopedAStatus; + +class MockGrpcClientStub : public WakeupClient::StubInterface { + public: + MOCK_METHOD(ClientReaderInterface*, GetRemoteTasksRaw, + (ClientContext * context, const GetRemoteTasksRequest& request)); + MOCK_METHOD(Status, NotifyWakeupRequired, + (ClientContext * context, const NotifyWakeupRequiredRequest& request, + NotifyWakeupRequiredResponse* response)); + // Async methods which we do not care. + MOCK_METHOD(ClientAsyncReaderInterface*, AsyncGetRemoteTasksRaw, + (ClientContext * context, const GetRemoteTasksRequest& request, CompletionQueue* cq, + void* tag)); + MOCK_METHOD(ClientAsyncReaderInterface*, PrepareAsyncGetRemoteTasksRaw, + (ClientContext * context, const GetRemoteTasksRequest& request, + CompletionQueue* cq)); + MOCK_METHOD(ClientAsyncResponseReaderInterface*, + AsyncNotifyWakeupRequiredRaw, + (ClientContext * context, const NotifyWakeupRequiredRequest& request, + CompletionQueue* cq)); + MOCK_METHOD(ClientAsyncResponseReaderInterface*, + PrepareAsyncNotifyWakeupRequiredRaw, + (ClientContext * context, const NotifyWakeupRequiredRequest& request, + CompletionQueue* cq)); +}; + +class RemoteAccessServiceUnitTest : public ::testing::Test { + public: + RemoteAccessServiceUnitTest() { + mGrpcWakeupClientStub = std::make_unique(); + mService = ndk::SharedRefBase::make(mGrpcWakeupClientStub.get()); + } + + MockGrpcClientStub* getGrpcWakeupClientStub() { return mGrpcWakeupClientStub.get(); } + + RemoteAccessService* getService() { return mService.get(); } + + private: + std::unique_ptr mGrpcWakeupClientStub; + std::shared_ptr mService; +}; + +TEST_F(RemoteAccessServiceUnitTest, TestGetWakeupServiceName) { + std::string serviceName; + + ScopedAStatus status = getService()->getWakeupServiceName(&serviceName); + + EXPECT_TRUE(status.isOk()); + EXPECT_EQ(serviceName, "com.google.vehicle.wakeup"); +} + +} // namespace remoteaccess +} // namespace automotive +} // namespace hardware +} // namespace android From 62ab6c9506f1c3e25368f804fdf89e0180466ee5 Mon Sep 17 00:00:00 2001 From: Ray Chin Date: Thu, 15 Sep 2022 15:07:33 +0800 Subject: [PATCH 269/998] Add setStatusCheckIntervalHint method Bug: 232426514 Test: atest VtsHalTvTunerTargetTest Change-Id: Icba606f2cd36bb52a48e7fe5798fb8dcc8c2fb0a --- .../android/hardware/tv/tuner/IDvr.aidl | 1 + .../aidl/android/hardware/tv/tuner/IDvr.aidl | 9 +- tv/tuner/aidl/default/Android.bp | 2 +- tv/tuner/aidl/default/Dvr.cpp | 8 ++ tv/tuner/aidl/default/Dvr.h | 1 + tv/tuner/aidl/vts/functional/Android.bp | 2 +- tv/tuner/aidl/vts/functional/DvrTests.cpp | 38 ++++++++ tv/tuner/aidl/vts/functional/DvrTests.h | 4 + .../functional/VtsHalTvTunerTargetTest.cpp | 86 +++++++++++++++++++ .../vts/functional/VtsHalTvTunerTargetTest.h | 4 + .../VtsHalTvTunerTestConfigurations.h | 1 + 11 files changed, 153 insertions(+), 3 deletions(-) diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/IDvr.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/IDvr.aidl index 450cd79129..4648712393 100644 --- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/IDvr.aidl +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/IDvr.aidl @@ -43,4 +43,5 @@ interface IDvr { void stop(); void flush(); void close(); + void setStatusCheckIntervalHint(in long milliseconds); } diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/IDvr.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/IDvr.aidl index 0534f9d884..4cb5b15e26 100644 --- a/tv/tuner/aidl/android/hardware/tv/tuner/IDvr.aidl +++ b/tv/tuner/aidl/android/hardware/tv/tuner/IDvr.aidl @@ -18,7 +18,6 @@ package android.hardware.tv.tuner; import android.hardware.common.fmq.MQDescriptor; import android.hardware.common.fmq.SynchronizedReadWrite; - import android.hardware.tv.tuner.DvrSettings; import android.hardware.tv.tuner.IFilter; @@ -101,4 +100,12 @@ interface IDvr { * instance any more and all methods should return a failure. */ void close(); + + /** + * Set status check time interval. + * + * This time interval hint will be used by the Dvr to decide how often + * to evaluate data. + */ + void setStatusCheckIntervalHint(in long milliseconds); } diff --git a/tv/tuner/aidl/default/Android.bp b/tv/tuner/aidl/default/Android.bp index c10ad22fea..65fa82163a 100644 --- a/tv/tuner/aidl/default/Android.bp +++ b/tv/tuner/aidl/default/Android.bp @@ -29,7 +29,7 @@ cc_defaults { ], shared_libs: [ "android.hardware.common.fmq-V1-ndk", - "android.hardware.tv.tuner-V1-ndk", + "android.hardware.tv.tuner-V2-ndk", "libbase", "libbinder_ndk", "libcutils", diff --git a/tv/tuner/aidl/default/Dvr.cpp b/tv/tuner/aidl/default/Dvr.cpp index 9928a5958e..c9dd8eee9a 100644 --- a/tv/tuner/aidl/default/Dvr.cpp +++ b/tv/tuner/aidl/default/Dvr.cpp @@ -154,6 +154,14 @@ Dvr::~Dvr() { return ::ndk::ScopedAStatus::ok(); } +::ndk::ScopedAStatus Dvr::setStatusCheckIntervalHint(int64_t /* in_milliseconds */) { + ALOGV("%s", __FUNCTION__); + + // There is no active polling in this default implementation, + // so directly return ok here. + return ::ndk::ScopedAStatus::ok(); +} + bool Dvr::createDvrMQ() { ALOGV("%s", __FUNCTION__); diff --git a/tv/tuner/aidl/default/Dvr.h b/tv/tuner/aidl/default/Dvr.h index 6ff71cd13f..293c533cfc 100644 --- a/tv/tuner/aidl/default/Dvr.h +++ b/tv/tuner/aidl/default/Dvr.h @@ -70,6 +70,7 @@ class Dvr : public BnDvr { ::ndk::ScopedAStatus stop() override; ::ndk::ScopedAStatus flush() override; ::ndk::ScopedAStatus close() override; + ::ndk::ScopedAStatus setStatusCheckIntervalHint(int64_t in_milliseconds) override; binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; diff --git a/tv/tuner/aidl/vts/functional/Android.bp b/tv/tuner/aidl/vts/functional/Android.bp index e5fb1e6b22..6a71544967 100644 --- a/tv/tuner/aidl/vts/functional/Android.bp +++ b/tv/tuner/aidl/vts/functional/Android.bp @@ -53,7 +53,7 @@ cc_test { "android.hardware.cas@1.2", "android.hardware.common-V2-ndk", "android.hardware.common.fmq-V1-ndk", - "android.hardware.tv.tuner-V1-ndk", + "android.hardware.tv.tuner-V2-ndk", "libaidlcommonsupport", "libfmq", "libcutils", diff --git a/tv/tuner/aidl/vts/functional/DvrTests.cpp b/tv/tuner/aidl/vts/functional/DvrTests.cpp index a9c3b51063..50f4de297e 100644 --- a/tv/tuner/aidl/vts/functional/DvrTests.cpp +++ b/tv/tuner/aidl/vts/functional/DvrTests.cpp @@ -323,3 +323,41 @@ void DvrTests::closeDvrRecord() { ASSERT_TRUE(mDvrRecord); ASSERT_TRUE(mDvrRecord->close().isOk()); } + +AssertionResult DvrTests::setPlaybackStatusCheckIntervalHint(int64_t milliseconds) { + ndk::ScopedAStatus status; + EXPECT_TRUE(mDemux) << "Test with openDemux first."; + EXPECT_TRUE(mDvrPlayback) << "Test with openDvr first."; + + status = mDvrPlayback->setStatusCheckIntervalHint(milliseconds); + + if (getDvrPlaybackInterfaceVersion() < 2) { + return AssertionResult(status.getStatus() == STATUS_UNKNOWN_TRANSACTION); + } + return AssertionResult(status.isOk()); +} + +AssertionResult DvrTests::setRecordStatusCheckIntervalHint(int64_t milliseconds) { + ndk::ScopedAStatus status; + EXPECT_TRUE(mDemux) << "Test with openDemux first."; + EXPECT_TRUE(mDvrRecord) << "Test with openDvr first."; + + status = mDvrRecord->setStatusCheckIntervalHint(milliseconds); + + if (getDvrRecordInterfaceVersion() < 2) { + return AssertionResult(status.getStatus() == STATUS_UNKNOWN_TRANSACTION); + } + return AssertionResult(status.isOk()); +} + +int32_t DvrTests::getDvrPlaybackInterfaceVersion() { + int32_t version; + mDvrPlayback->getInterfaceVersion(&version); + return version; +} + +int32_t DvrTests::getDvrRecordInterfaceVersion() { + int32_t version; + mDvrRecord->getInterfaceVersion(&version); + return version; +} diff --git a/tv/tuner/aidl/vts/functional/DvrTests.h b/tv/tuner/aidl/vts/functional/DvrTests.h index 6662637d54..a88ba244e7 100644 --- a/tv/tuner/aidl/vts/functional/DvrTests.h +++ b/tv/tuner/aidl/vts/functional/DvrTests.h @@ -162,8 +162,12 @@ class DvrTests { AssertionResult startDvrPlayback(); AssertionResult stopDvrRecord(); AssertionResult startDvrRecord(); + AssertionResult setPlaybackStatusCheckIntervalHint(int64_t milliseconds); + AssertionResult setRecordStatusCheckIntervalHint(int64_t milliseconds); void closeDvrPlayback(); void closeDvrRecord(); + int32_t getDvrPlaybackInterfaceVersion(); + int32_t getDvrRecordInterfaceVersion(); protected: static AssertionResult failure() { return ::testing::AssertionFailure(); } diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp index 9a17d05a15..6aa1e162cf 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp @@ -241,6 +241,28 @@ void TunerPlaybackAidlTest::playbackSingleFilterTest(FilterConfig filterConf, Dv ASSERT_TRUE(mDemuxTests.closeDemux()); } +void TunerPlaybackAidlTest::setStatusCheckIntervalHintTest(int64_t statusCheckIntervalHint, + DvrConfig dvrConf) { + int32_t demuxId; + std::shared_ptr demux; + + ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); + mDvrTests.setDemux(demux); + ASSERT_TRUE(mDvrTests.openDvrInDemux(dvrConf.type, dvrConf.bufferSize)); + ASSERT_TRUE(mDvrTests.configDvrPlayback(dvrConf.settings)); + ASSERT_TRUE(mDvrTests.getDvrPlaybackMQDescriptor()); + + ASSERT_TRUE(mDvrTests.setPlaybackStatusCheckIntervalHint(statusCheckIntervalHint)); + + mDvrTests.startPlaybackInputThread(dvrConf.playbackInputFile, + dvrConf.settings.get()); + ASSERT_TRUE(mDvrTests.startDvrPlayback()); + mDvrTests.stopPlaybackThread(); + ASSERT_TRUE(mDvrTests.stopDvrPlayback()); + mDvrTests.closeDvrPlayback(); + ASSERT_TRUE(mDemuxTests.closeDemux()); +} + void TunerRecordAidlTest::recordSingleFilterTestWithLnb(FilterConfig filterConf, FrontendConfig frontendConf, DvrConfig dvrConf, LnbConfig lnbConf) { @@ -426,6 +448,45 @@ void TunerRecordAidlTest::recordSingleFilterTest(FilterConfig filterConf, ASSERT_TRUE(mDemuxTests.closeDemux()); } +void TunerRecordAidlTest::setStatusCheckIntervalHintTest(int64_t statusCheckIntervalHint, + FrontendConfig frontendConf, + DvrConfig dvrConf) { + int32_t demuxId; + std::shared_ptr demux; + ASSERT_TRUE(mDemuxTests.openDemux(demux, demuxId)); + mDvrTests.setDemux(demux); + + DvrConfig dvrSourceConfig; + if (record.hasFrontendConnection) { + int32_t feId; + mFrontendTests.getFrontendIdByType(frontendConf.type, feId); + ASSERT_TRUE(feId != INVALID_ID); + ASSERT_TRUE(mFrontendTests.openFrontendById(feId)); + ASSERT_TRUE(mFrontendTests.setFrontendCallback()); + ASSERT_TRUE(mDemuxTests.setDemuxFrontendDataSource(feId)); + } else { + dvrSourceConfig = dvrMap[record.dvrSourceId]; + ASSERT_TRUE(mDvrTests.openDvrInDemux(dvrSourceConfig.type, dvrSourceConfig.bufferSize)); + ASSERT_TRUE(mDvrTests.configDvrPlayback(dvrSourceConfig.settings)); + ASSERT_TRUE(mDvrTests.getDvrPlaybackMQDescriptor()); + } + + ASSERT_TRUE(mDvrTests.openDvrInDemux(dvrConf.type, dvrConf.bufferSize)); + ASSERT_TRUE(mDvrTests.configDvrRecord(dvrConf.settings)); + ASSERT_TRUE(mDvrTests.getDvrRecordMQDescriptor()); + + ASSERT_TRUE(mDvrTests.setRecordStatusCheckIntervalHint(statusCheckIntervalHint)); + + ASSERT_TRUE(mDvrTests.startDvrRecord()); + ASSERT_TRUE(mDvrTests.stopDvrRecord()); + mDvrTests.closeDvrRecord(); + ASSERT_TRUE(mDemuxTests.closeDemux()); + + if (record.hasFrontendConnection) { + ASSERT_TRUE(mFrontendTests.closeFrontend()); + } +} + void TunerDescramblerAidlTest::scrambledBroadcastTest(set mediaFilterConfs, FrontendConfig frontendConf, DescramblerConfig descConfig, @@ -1000,6 +1061,18 @@ TEST_P(TunerPlaybackAidlTest, PlaybackDataFlowWithTsVideoFilterTest) { } } +TEST_P(TunerPlaybackAidlTest, SetStatusCheckIntervalHintToPlaybackTest) { + description("Set status check interval hint to playback test."); + if (!playback.support) { + return; + } + vector playback_configs = generatePlaybackConfigs(); + for (auto& configuration : playback_configs) { + playback = configuration; + setStatusCheckIntervalHintTest(STATUS_CHECK_INTERVAL_MS, dvrMap[playback.dvrId]); + } +} + TEST_P(TunerRecordAidlTest, RecordDataFlowWithTsRecordFilterTest) { description("Feed ts data from frontend to recording and test with ts record filter"); if (!record.support) { @@ -1046,6 +1119,19 @@ TEST_P(TunerRecordAidlTest, LnbRecordDataFlowWithTsRecordFilterTest) { } } +TEST_P(TunerRecordAidlTest, SetStatusCheckIntervalHintToRecordTest) { + description("Set status check interval hint to record test."); + if (!record.support) { + return; + } + auto record_configs = generateRecordConfigurations(); + for (auto& configuration : record_configs) { + record = configuration; + setStatusCheckIntervalHintTest(STATUS_CHECK_INTERVAL_MS, frontendMap[record.frontendId], + dvrMap[record.dvrRecordId]); + } +} + TEST_P(TunerFrontendAidlTest, TuneFrontend) { description("Tune one Frontend with specific setting and check Lock event"); if (!live.hasFrontendConnection) { diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h index f68e1ecd42..3bfa78f192 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h @@ -255,6 +255,8 @@ class TunerPlaybackAidlTest : public testing::TestWithParam { AssertionResult filterDataOutputTest(); void playbackSingleFilterTest(FilterConfig filterConf, DvrConfig dvrConf); + + void setStatusCheckIntervalHintTest(int64_t milliseconds, DvrConfig dvrConf); }; GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TunerPlaybackAidlTest); @@ -294,6 +296,8 @@ class TunerRecordAidlTest : public testing::TestWithParam { DvrConfig dvrConf, LnbConfig lnbConf); void recordSingleFilterTest(FilterConfig filterConf, FrontendConfig frontendConf, DvrConfig dvrConf, Dataflow_Context context); + void setStatusCheckIntervalHintTest(int64_t milliseconds, FrontendConfig frontendConf, + DvrConfig dvrConf); std::shared_ptr mService; FrontendTests mFrontendTests; diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h index fea5f83826..516cb62f04 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTestConfigurations.h @@ -55,6 +55,7 @@ const int32_t FMQ_SIZE_16M = 0x1000000; const string configFilePath = "/vendor/etc/tuner_vts_config_aidl_V1.xml"; #define FILTER_MAIN_TYPE_BIT_COUNT 5 +#define STATUS_CHECK_INTERVAL_MS 100L // Hardware configs static map frontendMap; From 1384388fb2be65ce9bd3cbfe82cdde32fc34fe21 Mon Sep 17 00:00:00 2001 From: Matt Buckley Date: Thu, 15 Sep 2022 22:32:56 +0000 Subject: [PATCH 270/998] Add sendHint method to the PowerHintSession API for load changes Add a new sendHint(SessionHint hint) method to the PowerHintSession to allow clients to inform the session about upcoming changes in load ahead of time. Bug: b/243973548 Test: atest VtsHalPowerTargetTest Change-Id: I0a8af42d3b0ccd3bbb72287a9b91ffb13fccaf9c --- .../compatibility_matrix.current.xml | 2 +- .../hardware/power/IPowerHintSession.aidl | 1 + .../android/hardware/power/SessionHint.aidl | 41 +++++++++++++++++ .../hardware/power/IPowerHintSession.aidl | 9 ++++ .../android/hardware/power/SessionHint.aidl | 46 +++++++++++++++++++ power/aidl/default/Android.bp | 2 +- power/aidl/default/power-default.xml | 2 +- power/aidl/vts/Android.bp | 2 +- power/aidl/vts/VtsHalPowerTargetTest.cpp | 25 ++++++++++ 9 files changed, 126 insertions(+), 4 deletions(-) create mode 100644 power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SessionHint.aidl create mode 100644 power/aidl/android/hardware/power/SessionHint.aidl diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 71243bf7dd..25d1ae4be7 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -432,7 +432,7 @@ android.hardware.power - 2-3 + 2-4 IPower default diff --git a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/IPowerHintSession.aidl b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/IPowerHintSession.aidl index 1d3ecb7eee..928668cd08 100644 --- a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/IPowerHintSession.aidl +++ b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/IPowerHintSession.aidl @@ -39,4 +39,5 @@ interface IPowerHintSession { oneway void pause(); oneway void resume(); oneway void close(); + oneway void sendHint(android.hardware.power.SessionHint hint); } diff --git a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SessionHint.aidl b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SessionHint.aidl new file mode 100644 index 0000000000..b19c77b525 --- /dev/null +++ b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SessionHint.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.power; +@Backing(type="int") @VintfStability +enum SessionHint { + CPU_LOAD_UP = 0, + CPU_LOAD_DOWN = 1, + CPU_LOAD_RESET = 2, + CPU_LOAD_RESUME = 3, +} diff --git a/power/aidl/android/hardware/power/IPowerHintSession.aidl b/power/aidl/android/hardware/power/IPowerHintSession.aidl index c289448855..4ca9c54c7c 100644 --- a/power/aidl/android/hardware/power/IPowerHintSession.aidl +++ b/power/aidl/android/hardware/power/IPowerHintSession.aidl @@ -16,6 +16,7 @@ package android.hardware.power; +import android.hardware.power.SessionHint; import android.hardware.power.WorkDuration; @VintfStability @@ -56,4 +57,12 @@ oneway interface IPowerHintSession { * Close the session to release resources. */ void close(); + + /** + * Gives information to the PowerHintSession about upcoming or unexpected + * changes in load to supplement the normal updateTarget/reportActual cycle. + * + * @param hint The hint to provide to the PowerHintSession + */ + void sendHint(SessionHint hint); } diff --git a/power/aidl/android/hardware/power/SessionHint.aidl b/power/aidl/android/hardware/power/SessionHint.aidl new file mode 100644 index 0000000000..6a95035d35 --- /dev/null +++ b/power/aidl/android/hardware/power/SessionHint.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ + +package android.hardware.power; + +@VintfStability +@Backing(type="int") +enum SessionHint { + /** + * This hint indicates an increase in CPU workload intensity. It means that + * this hint session needs extra CPU resources to meet the target duration. + * This hint must be sent before reporting the actual duration to the session. + */ + CPU_LOAD_UP = 0, + /** + * This hint indicates a decrease in CPU workload intensity. It means that + * this hint session can reduce CPU resources and still meet the target duration. + */ + CPU_LOAD_DOWN = 1, + /* + * This hint indicates an upcoming CPU workload that is completely changed and + * unknown. It means that the hint session should reset CPU resources to a known + * baseline to prepare for an arbitrary load, and must wake up if inactive. + */ + CPU_LOAD_RESET = 2, + /* + * This hint indicates that the most recent CPU workload is resuming after a + * period of inactivity. It means that the hint session should allocate similar + * CPU resources to what was used previously, and must wake up if inactive. + */ + CPU_LOAD_RESUME = 3, + +} diff --git a/power/aidl/default/Android.bp b/power/aidl/default/Android.bp index 223b9d5e6b..d1257f336a 100644 --- a/power/aidl/default/Android.bp +++ b/power/aidl/default/Android.bp @@ -30,7 +30,7 @@ cc_binary { shared_libs: [ "libbase", "libbinder_ndk", - "android.hardware.power-V3-ndk", + "android.hardware.power-V4-ndk", ], srcs: [ "main.cpp", diff --git a/power/aidl/default/power-default.xml b/power/aidl/default/power-default.xml index 927ba22dbf..f5dd6b957c 100644 --- a/power/aidl/default/power-default.xml +++ b/power/aidl/default/power-default.xml @@ -1,7 +1,7 @@ android.hardware.power - 3 + 4 IPower/default diff --git a/power/aidl/vts/Android.bp b/power/aidl/vts/Android.bp index ea398ac6b2..d5cc2b64af 100644 --- a/power/aidl/vts/Android.bp +++ b/power/aidl/vts/Android.bp @@ -32,7 +32,7 @@ cc_test { "libbinder_ndk", ], static_libs: [ - "android.hardware.power-V3-ndk", + "android.hardware.power-V4-ndk", ], test_suites: [ "vts", diff --git a/power/aidl/vts/VtsHalPowerTargetTest.cpp b/power/aidl/vts/VtsHalPowerTargetTest.cpp index 2cfa04ada9..dcf075f82f 100644 --- a/power/aidl/vts/VtsHalPowerTargetTest.cpp +++ b/power/aidl/vts/VtsHalPowerTargetTest.cpp @@ -34,12 +34,16 @@ using android::hardware::power::Boost; using android::hardware::power::IPower; using android::hardware::power::IPowerHintSession; using android::hardware::power::Mode; +using android::hardware::power::SessionHint; using android::hardware::power::WorkDuration; const std::vector kBoosts{ndk::enum_range().begin(), ndk::enum_range().end()}; const std::vector kModes{ndk::enum_range().begin(), ndk::enum_range().end()}; +const std::vector kSessionHints{ndk::enum_range().begin(), + ndk::enum_range().end()}; + const std::vector kInvalidBoosts = { static_cast(static_cast(kBoosts.front()) - 1), static_cast(static_cast(kBoosts.back()) + 1), @@ -50,6 +54,11 @@ const std::vector kInvalidModes = { static_cast(static_cast(kModes.back()) + 1), }; +const std::vector kInvalidSessionHints = { + static_cast(static_cast(kSessionHints.front()) - 1), + static_cast(static_cast(kSessionHints.back()) + 1), +}; + class DurationWrapper : public WorkDuration { public: DurationWrapper(int64_t dur, int64_t time) { @@ -175,6 +184,7 @@ TEST_P(PowerAidl, createAndCloseHintSession) { ASSERT_TRUE(session->close().isOk()); session.reset(); } + TEST_P(PowerAidl, createHintSessionFailed) { std::shared_ptr session; auto status = power->createHintSession(getpid(), getuid(), kEmptyTids, 16666666L, &session); @@ -198,6 +208,21 @@ TEST_P(PowerAidl, updateAndReportDurations) { ASSERT_TRUE(session->reportActualWorkDuration(kDurations).isOk()); } +TEST_P(PowerAidl, sendSessionHint) { + std::shared_ptr session; + auto status = power->createHintSession(getpid(), getuid(), kSelfTids, 16666666L, &session); + if (!status.isOk()) { + EXPECT_TRUE(isUnknownOrUnsupported(status)); + return; + } + for (const auto& sessionHint : kSessionHints) { + ASSERT_TRUE(session->sendHint(sessionHint).isOk()); + } + for (const auto& sessionHint : kInvalidSessionHints) { + ASSERT_TRUE(session->sendHint(sessionHint).isOk()); + } +} + // FIXED_PERFORMANCE mode is required for all devices which ship on Android 11 // or later TEST_P(PowerAidl, hasFixedPerformance) { From b23d0ea0a938c33f4dd1fd97abcc084ceb6aaa7a Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Mon, 9 May 2022 18:26:23 +0000 Subject: [PATCH 271/998] Add VTS test for BroadcastRadio AIDL HAL Tested methods defined in IBroadcastRadio. Methods such as tune, seek, step and startProgramListUpdates are tested by the times of that the mock of ITunerCallback, which is registered to IBroadcastRadio, is called within timeout. Bug: 249150763 Test: m -j, atest VtsHalBroadcastradioAidlTargetTest Change-Id: I84cb0da741dbcaf24a6562813846e81c23bbb1f1 --- broadcastradio/aidl/vts/Android.bp | 47 ++ broadcastradio/aidl/vts/OWNERS | 4 + .../VtsHalBroadcastradioAidlTargetTest.cpp | 712 ++++++++++++++++++ 3 files changed, 763 insertions(+) create mode 100644 broadcastradio/aidl/vts/Android.bp create mode 100644 broadcastradio/aidl/vts/OWNERS create mode 100644 broadcastradio/aidl/vts/src/VtsHalBroadcastradioAidlTargetTest.cpp diff --git a/broadcastradio/aidl/vts/Android.bp b/broadcastradio/aidl/vts/Android.bp new file mode 100644 index 0000000000..b60387ef49 --- /dev/null +++ b/broadcastradio/aidl/vts/Android.bp @@ -0,0 +1,47 @@ +// 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. + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_test { + name: "VtsHalBroadcastradioAidlTargetTest", + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + tidy_timeout_srcs: ["src/*.cpp"], + srcs: ["src/*.cpp"], + shared_libs: [ + "libbinder_ndk", + "libbase", + "libxml2", + ], + static_libs: [ + "android.hardware.broadcastradio-V1-ndk", + "android.hardware.broadcastradio@common-utils-aidl-lib", + "android.hardware.broadcastradio@vts-utils-lib", + "libgmock", + ], + test_suites: [ + "general-tests", + "vts", + ], +} diff --git a/broadcastradio/aidl/vts/OWNERS b/broadcastradio/aidl/vts/OWNERS new file mode 100644 index 0000000000..302fdd73cc --- /dev/null +++ b/broadcastradio/aidl/vts/OWNERS @@ -0,0 +1,4 @@ +xuweilin@google.com +oscarazu@google.com +ericjeong@google.com +keunyoung@google.com diff --git a/broadcastradio/aidl/vts/src/VtsHalBroadcastradioAidlTargetTest.cpp b/broadcastradio/aidl/vts/src/VtsHalBroadcastradioAidlTargetTest.cpp new file mode 100644 index 0000000000..02c9356f0c --- /dev/null +++ b/broadcastradio/aidl/vts/src/VtsHalBroadcastradioAidlTargetTest.cpp @@ -0,0 +1,712 @@ +/* + * 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. + */ + +#define EGMOCK_VERBOSE 1 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace aidl::android::hardware::broadcastradio::vts { + +namespace { + +using ::aidl::android::hardware::broadcastradio::utils::makeIdentifier; +using ::aidl::android::hardware::broadcastradio::utils::makeSelectorAmfm; +using ::aidl::android::hardware::broadcastradio::utils::resultToInt; +using ::ndk::ScopedAStatus; +using ::ndk::SharedRefBase; +using ::std::string; +using ::std::vector; +using ::testing::_; +using ::testing::AnyNumber; +using ::testing::ByMove; +using ::testing::DoAll; +using ::testing::Invoke; +using ::testing::SaveArg; + +namespace bcutils = ::aidl::android::hardware::broadcastradio::utils; + +inline constexpr std::chrono::seconds kTuneTimeoutSec = + std::chrono::seconds(IBroadcastRadio::TUNER_TIMEOUT_MS * 1000); +inline constexpr std::chrono::seconds kProgramListScanTimeoutSec = + std::chrono::seconds(IBroadcastRadio::LIST_COMPLETE_TIMEOUT_MS * 1000); + +void printSkipped(const string& msg) { + const auto testInfo = testing::UnitTest::GetInstance()->current_test_info(); + LOG(INFO) << "[ SKIPPED ] " << testInfo->test_case_name() << "." << testInfo->name() + << " with message: " << msg; +} + +} // namespace + +class TunerCallbackMock : public BnTunerCallback { + public: + TunerCallbackMock(); + + MOCK_METHOD2(onTuneFailed, ScopedAStatus(Result, const ProgramSelector&)); + MOCK_TIMEOUT_METHOD1(onCurrentProgramInfoChangedMock, ScopedAStatus(const ProgramInfo&)); + ScopedAStatus onCurrentProgramInfoChanged(const ProgramInfo& info) override; + ScopedAStatus onProgramListUpdated(const ProgramListChunk& chunk) override; + MOCK_METHOD1(onAntennaStateChange, ScopedAStatus(bool connected)); + MOCK_METHOD1(onParametersUpdated, ScopedAStatus(const vector& parameters)); + MOCK_METHOD2(onConfigFlagUpdated, ScopedAStatus(ConfigFlag in_flag, bool in_value)); + MOCK_TIMEOUT_METHOD0(onProgramListReady, void()); + + std::mutex mLock; + bcutils::ProgramInfoSet mProgramList GUARDED_BY(mLock); +}; + +struct AnnouncementListenerMock : public BnAnnouncementListener { + MOCK_METHOD1(onListUpdated, ScopedAStatus(const vector&)); +}; + +class BroadcastRadioHalTest : public testing::TestWithParam { + protected: + void SetUp() override; + void TearDown() override; + + bool getAmFmRegionConfig(bool full, AmFmRegionConfig* config); + std::optional getProgramList(); + std::optional getProgramList(const ProgramFilter& filter); + + std::shared_ptr mModule; + Properties mProperties; + std::shared_ptr mCallback = SharedRefBase::make(); +}; + +MATCHER_P(InfoHasId, id, string(negation ? "does not contain" : "contains") + " " + id.toString()) { + vector ids = bcutils::getAllIds(arg.selector, id.type); + return ids.end() != find(ids.begin(), ids.end(), id.value); +} + +TunerCallbackMock::TunerCallbackMock() { + EXPECT_TIMEOUT_CALL(*this, onCurrentProgramInfoChangedMock, _).Times(AnyNumber()); + + // we expect the antenna is connected through the whole test + EXPECT_CALL(*this, onAntennaStateChange(false)).Times(0); +} + +ScopedAStatus TunerCallbackMock::onCurrentProgramInfoChanged(const ProgramInfo& info) { + for (const auto& id : info.selector) { + EXPECT_NE(id.type, IdentifierType::INVALID); + } + + IdentifierType logically = info.logicallyTunedTo.type; + // This field is required for currently tuned program and should be INVALID + // for entries from the program list. + EXPECT_TRUE(logically == IdentifierType::AMFM_FREQUENCY_KHZ || + logically == IdentifierType::RDS_PI || + logically == IdentifierType::HD_STATION_ID_EXT || + logically == IdentifierType::DAB_SID_EXT || + logically == IdentifierType::DRMO_SERVICE_ID || + logically == IdentifierType::SXM_SERVICE_ID || + (logically >= IdentifierType::VENDOR_START && + logically <= IdentifierType::VENDOR_END) || + logically > IdentifierType::SXM_CHANNEL); + + IdentifierType physically = info.physicallyTunedTo.type; + // ditto (see "logically" above) + EXPECT_TRUE(physically == IdentifierType::AMFM_FREQUENCY_KHZ || + physically == IdentifierType::DAB_ENSEMBLE || + physically == IdentifierType::DRMO_FREQUENCY_KHZ || + physically == IdentifierType::SXM_CHANNEL || + (physically >= IdentifierType::VENDOR_START && + physically <= IdentifierType::VENDOR_END) || + physically > IdentifierType::SXM_CHANNEL); + + if (logically == IdentifierType::AMFM_FREQUENCY_KHZ) { + std::optional ps = bcutils::getMetadataString(info, Metadata::rdsPs); + if (ps.has_value()) { + EXPECT_NE(::android::base::Trim(*ps), "") + << "Don't use empty RDS_PS as an indicator of missing RSD PS data."; + } + } + + return onCurrentProgramInfoChangedMock(info); +} + +ScopedAStatus TunerCallbackMock::onProgramListUpdated(const ProgramListChunk& chunk) { + std::lock_guard lk(mLock); + + updateProgramList(chunk, &mProgramList); + + if (chunk.complete) { + onProgramListReady(); + } + + return ndk::ScopedAStatus::ok(); +} + +void BroadcastRadioHalTest::SetUp() { + EXPECT_EQ(mModule.get(), nullptr) << "Module is already open"; + + // lookup AIDL service (radio module) + AIBinder* binder = AServiceManager_waitForService(GetParam().c_str()); + ASSERT_NE(binder, nullptr); + mModule = IBroadcastRadio::fromBinder(ndk::SpAIBinder(binder)); + ASSERT_NE(mModule, nullptr) << "Couldn't find broadcast radio HAL implementation"; + + // get module properties + auto propResult = mModule->getProperties(&mProperties); + + ASSERT_TRUE(propResult.isOk()); + EXPECT_FALSE(mProperties.maker.empty()); + EXPECT_FALSE(mProperties.product.empty()); + EXPECT_GT(mProperties.supportedIdentifierTypes.size(), 0u); + + // set callback + EXPECT_TRUE(mModule->setTunerCallback(mCallback).isOk()); +} + +void BroadcastRadioHalTest::TearDown() { + if (mModule) { + ASSERT_TRUE(mModule->unsetTunerCallback().isOk()); + } +} + +bool BroadcastRadioHalTest::getAmFmRegionConfig(bool full, AmFmRegionConfig* config) { + auto halResult = mModule->getAmFmRegionConfig(full, config); + + if (halResult.getServiceSpecificError() == resultToInt(Result::NOT_SUPPORTED)) { + return false; + } + + EXPECT_TRUE(halResult.isOk()); + return halResult.isOk(); +} + +std::optional BroadcastRadioHalTest::getProgramList() { + ProgramFilter emptyFilter = {}; + return getProgramList(emptyFilter); +} + +std::optional BroadcastRadioHalTest::getProgramList( + const ProgramFilter& filter) { + EXPECT_TIMEOUT_CALL(*mCallback, onProgramListReady).Times(AnyNumber()); + + auto startResult = mModule->startProgramListUpdates(filter); + + if (startResult.getServiceSpecificError() == resultToInt(Result::NOT_SUPPORTED)) { + printSkipped("Program list not supported"); + return std::nullopt; + } + EXPECT_TRUE(startResult.isOk()); + if (!startResult.isOk()) { + return std::nullopt; + } + EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onProgramListReady, kProgramListScanTimeoutSec); + + auto stopResult = mModule->stopProgramListUpdates(); + + EXPECT_TRUE(stopResult.isOk()); + + return mCallback->mProgramList; +} + +/** + * Test setting tuner callback to null. + * + * Verifies that: + * - Setting to a null tuner callback results with INVALID_ARGUMENTS. + */ +TEST_P(BroadcastRadioHalTest, TunerCallbackFailsWithNull) { + LOG(DEBUG) << "TunerCallbackFailsWithNull Test"; + + auto halResult = mModule->setTunerCallback(nullptr); + + EXPECT_EQ(halResult.getServiceSpecificError(), resultToInt(Result::INVALID_ARGUMENTS)); +} + +/** + * Test tuning without tuner callback set. + * + * Verifies that: + * - No tuner callback set results in INVALID_STATE, regardless of whether the selector is + * supported. + */ +TEST_P(BroadcastRadioHalTest, TuneFailsWithoutTunerCallback) { + LOG(DEBUG) << "TuneFailsWithoutTunerCallback Test"; + + mModule->unsetTunerCallback(); + int64_t freq = 90900; // 90.9 FM + ProgramSelector sel = makeSelectorAmfm(freq); + + auto result = mModule->tune(sel); + + EXPECT_EQ(result.getServiceSpecificError(), resultToInt(Result::INVALID_STATE)); +} + +/** + * Test tuning with selectors that can be not supported. + * + * Verifies that: + * - if the selector is not supported, an invalid value results with NOT_SUPPORTED, regardless of + * whether it is valid; + * - if it is supported, the test is ignored; + */ +TEST_P(BroadcastRadioHalTest, TuneFailsWithNotSupported) { + LOG(DEBUG) << "TuneFailsWithInvalid Test"; + + vector supportTestId = { + makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, 0), // invalid + makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, 94900), // valid + makeIdentifier(IdentifierType::RDS_PI, 0x10000), // invalid + makeIdentifier(IdentifierType::RDS_PI, 0x1001), // valid + makeIdentifier(IdentifierType::HD_STATION_ID_EXT, 0x100000000), // invalid + makeIdentifier(IdentifierType::HD_STATION_ID_EXT, 0x10000001), // valid + makeIdentifier(IdentifierType::DAB_SID_EXT, 0), // invalid + makeIdentifier(IdentifierType::DAB_SID_EXT, 0xA00001), // valid + makeIdentifier(IdentifierType::DRMO_SERVICE_ID, 0x100000000), // invalid + makeIdentifier(IdentifierType::DRMO_SERVICE_ID, 0x10000001), // valid + makeIdentifier(IdentifierType::SXM_SERVICE_ID, 0x100000000), // invalid + makeIdentifier(IdentifierType::SXM_SERVICE_ID, 0x10000001), // valid + }; + + auto notSupportedError = resultToInt(Result::NOT_SUPPORTED); + for (const auto& id : supportTestId) { + ProgramSelector sel{id, {}}; + + auto result = mModule->tune(sel); + + if (!bcutils::isSupported(mProperties, sel)) { + EXPECT_EQ(result.getServiceSpecificError(), notSupportedError); + } + } +} + +/** + * Test tuning with invalid selectors. + * + * Verifies that: + * - if the selector is not supported, it's ignored; + * - if it is supported, an invalid value results with INVALID_ARGUMENTS; + */ +TEST_P(BroadcastRadioHalTest, TuneFailsWithInvalid) { + LOG(DEBUG) << "TuneFailsWithInvalid Test"; + + vector invalidId = { + makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, 0), + makeIdentifier(IdentifierType::RDS_PI, 0x10000), + makeIdentifier(IdentifierType::HD_STATION_ID_EXT, 0x100000000), + makeIdentifier(IdentifierType::DAB_SID_EXT, 0), + makeIdentifier(IdentifierType::DRMO_SERVICE_ID, 0x100000000), + makeIdentifier(IdentifierType::SXM_SERVICE_ID, 0x100000000), + }; + + auto invalidArgumentsError = resultToInt(Result::INVALID_ARGUMENTS); + for (const auto& id : invalidId) { + ProgramSelector sel{id, {}}; + + auto result = mModule->tune(sel); + + if (bcutils::isSupported(mProperties, sel)) { + EXPECT_EQ(result.getServiceSpecificError(), invalidArgumentsError); + } + } +} + +/** + * Test tuning with empty program selector. + * + * Verifies that: + * - tune fails with NOT_SUPPORTED when program selector is not initialized. + */ +TEST_P(BroadcastRadioHalTest, TuneFailsWithEmpty) { + LOG(DEBUG) << "TuneFailsWithEmpty Test"; + + // Program type is 1-based, so 0 will always be invalid. + ProgramSelector sel = {}; + + auto result = mModule->tune(sel); + + ASSERT_EQ(result.getServiceSpecificError(), resultToInt(Result::NOT_SUPPORTED)); +} + +/** + * Test tuning with FM selector. + * + * Verifies that: + * - if AM/FM selector is not supported, the method returns NOT_SUPPORTED; + * - if it is supported, the method succeeds; + * - after a successful tune call, onCurrentProgramInfoChanged callback is + * invoked carrying a proper selector; + * - program changes exactly to what was requested. + */ +TEST_P(BroadcastRadioHalTest, FmTune) { + LOG(DEBUG) << "FmTune Test"; + + int64_t freq = 90900; // 90.9 FM + ProgramSelector sel = makeSelectorAmfm(freq); + // try tuning + ProgramInfo infoCb = {}; + EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChangedMock, + InfoHasId(makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, freq))) + .Times(AnyNumber()) + .WillOnce(DoAll(SaveArg<0>(&infoCb), testing::Return(ByMove(ndk::ScopedAStatus::ok())))) + .WillRepeatedly(testing::InvokeWithoutArgs([] { return ndk::ScopedAStatus::ok(); })); + + auto result = mModule->tune(sel); + + // expect a failure if it's not supported + if (!bcutils::isSupported(mProperties, sel)) { + EXPECT_EQ(result.getServiceSpecificError(), resultToInt(Result::NOT_SUPPORTED)); + return; + } + + // expect a callback if it succeeds + EXPECT_TRUE(result.isOk()); + EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChangedMock, kTuneTimeoutSec); + + LOG(DEBUG) << "Current program info: " << infoCb.toString(); + + // it should tune exactly to what was requested + vector freqs = bcutils::getAllIds(infoCb.selector, IdentifierType::AMFM_FREQUENCY_KHZ); + EXPECT_NE(freqs.end(), find(freqs.begin(), freqs.end(), freq)) + << "FM freq " << freq << " kHz is not sent back by callback."; +} + +/** + * Test tuning with DAB selector. + * + * Verifies that: + * - if DAB selector is not supported, the method returns NOT_SUPPORTED; + * - if it is supported, the method succeeds; + * - after a successful tune call, onCurrentProgramInfoChanged callback is + * invoked carrying a proper selector; + * - program changes exactly to what was requested. + */ +TEST_P(BroadcastRadioHalTest, DabTune) { + LOG(DEBUG) << "DabTune Test"; + vector config; + + auto halResult = mModule->getDabRegionConfig(&config); + + if (halResult.getServiceSpecificError() == resultToInt(Result::NOT_SUPPORTED)) { + printSkipped("DAB not supported"); + return; + } + ASSERT_TRUE(halResult.isOk()); + ASSERT_NE(config.size(), 0U); + + // TODO(245787803): use a DAB frequency that can actually be tuned to. + ProgramSelector sel = {}; + int64_t freq = config[config.size() / 2].frequencyKhz; + sel.primaryId = makeIdentifier(IdentifierType::DAB_FREQUENCY_KHZ, freq); + + // try tuning + ProgramInfo infoCb = {}; + EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChangedMock, + InfoHasId(makeIdentifier(IdentifierType::DAB_FREQUENCY_KHZ, freq))) + .Times(AnyNumber()) + .WillOnce( + DoAll(SaveArg<0>(&infoCb), testing::Return(ByMove(ndk::ScopedAStatus::ok())))); + + auto result = mModule->tune(sel); + + // expect a failure if it's not supported + if (!bcutils::isSupported(mProperties, sel)) { + EXPECT_EQ(result.getServiceSpecificError(), resultToInt(Result::NOT_SUPPORTED)); + return; + } + + // expect a callback if it succeeds + EXPECT_TRUE(result.isOk()); + EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChangedMock, kTuneTimeoutSec); + LOG(DEBUG) << "Current program info: " << infoCb.toString(); + + // it should tune exactly to what was requested + vector freqs = bcutils::getAllIds(infoCb.selector, IdentifierType::DAB_FREQUENCY_KHZ); + EXPECT_NE(freqs.end(), find(freqs.begin(), freqs.end(), freq)) + << "DAB freq " << freq << " kHz is not sent back by callback."; + ; +} + +/** + * Test seeking to next/prev station via IBroadcastRadio::seek(). + * + * Verifies that: + * - the method succeeds; + * - the program info is changed within kTuneTimeoutSec; + * - works both directions and with or without skipping sub-channel. + */ +TEST_P(BroadcastRadioHalTest, Seek) { + LOG(DEBUG) << "Seek Test"; + + EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChangedMock, _).Times(AnyNumber()); + + auto result = mModule->seek(/* in_directionUp= */ true, /* in_skipSubChannel= */ true); + + if (result.getServiceSpecificError() == resultToInt(Result::NOT_SUPPORTED)) { + printSkipped("Seek not supported"); + return; + } + + EXPECT_TRUE(result.isOk()); + EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChangedMock, kTuneTimeoutSec); + + EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChangedMock, _).Times(AnyNumber()); + + result = mModule->seek(/* in_directionUp= */ false, /* in_skipSubChannel= */ false); + + EXPECT_TRUE(result.isOk()); + EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChangedMock, kTuneTimeoutSec); +} + +/** + * Test seeking without tuner callback set. + * + * Verifies that: + * - No tuner callback set results in INVALID_STATE. + */ +TEST_P(BroadcastRadioHalTest, SeekFailsWithoutTunerCallback) { + LOG(DEBUG) << "SeekFailsWithoutTunerCallback Test"; + + mModule->unsetTunerCallback(); + + auto result = mModule->seek(/* in_directionUp= */ true, /* in_skipSubChannel= */ true); + + EXPECT_EQ(result.getServiceSpecificError(), resultToInt(Result::INVALID_STATE)); + + result = mModule->seek(/* in_directionUp= */ false, /* in_skipSubChannel= */ false); + + EXPECT_EQ(result.getServiceSpecificError(), resultToInt(Result::INVALID_STATE)); +} + +/** + * Test step operation. + * + * Verifies that: + * - the method succeeds or returns NOT_SUPPORTED; + * - the program info is changed within kTuneTimeoutSec if the method succeeded; + * - works both directions. + */ +TEST_P(BroadcastRadioHalTest, Step) { + LOG(DEBUG) << "Step Test"; + + EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChangedMock, _).Times(AnyNumber()); + + auto result = mModule->step(/* in_directionUp= */ true); + + if (result.getServiceSpecificError() == resultToInt(Result::NOT_SUPPORTED)) { + printSkipped("Step not supported"); + return; + } + EXPECT_TRUE(result.isOk()); + EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChangedMock, kTuneTimeoutSec); + + EXPECT_TIMEOUT_CALL(*mCallback, onCurrentProgramInfoChangedMock, _).Times(AnyNumber()); + + result = mModule->step(/* in_directionUp= */ false); + + EXPECT_TRUE(result.isOk()); + EXPECT_TIMEOUT_CALL_WAIT(*mCallback, onCurrentProgramInfoChangedMock, kTuneTimeoutSec); +} + +/** + * Test step operation without tuner callback set. + * + * Verifies that: + * - No tuner callback set results in INVALID_STATE. + */ +TEST_P(BroadcastRadioHalTest, StepFailsWithoutTunerCallback) { + LOG(DEBUG) << "StepFailsWithoutTunerCallback Test"; + + mModule->unsetTunerCallback(); + + auto result = mModule->step(/* in_directionUp= */ true); + + EXPECT_EQ(result.getServiceSpecificError(), resultToInt(Result::INVALID_STATE)); + + result = mModule->step(/* in_directionUp= */ false); + + EXPECT_EQ(result.getServiceSpecificError(), resultToInt(Result::INVALID_STATE)); +} + +/** + * Test tune cancellation. + * + * Verifies that: + * - the method does not crash after being invoked multiple times. + * + * Since cancel() might be called after the HAL completes an operation (tune, seek, and step) + * and before the callback completions, the operation might not be actually canceled and the + * effect of cancel() is not deterministic to be tested here. + */ +TEST_P(BroadcastRadioHalTest, Cancel) { + LOG(DEBUG) << "Cancel Test"; + + auto notSupportedError = resultToInt(Result::NOT_SUPPORTED); + for (int i = 0; i < 10; i++) { + auto result = mModule->seek(/* in_directionUp= */ true, /* in_skipSubChannel= */ true); + + if (result.getServiceSpecificError() == notSupportedError) { + printSkipped("Cancel is skipped because of seek not supported"); + return; + } + EXPECT_TRUE(result.isOk()); + + auto cancelResult = mModule->cancel(); + + ASSERT_TRUE(cancelResult.isOk()); + } +} + +/** + * Test getting program list using empty program filter. + * + * Verifies that: + * - startProgramListUpdates either succeeds or returns NOT_SUPPORTED; + * - the complete list is fetched within kProgramListScanTimeoutSec; + * - stopProgramListUpdates does not crash. + */ +TEST_P(BroadcastRadioHalTest, GetProgramListFromEmptyFilter) { + LOG(DEBUG) << "GetProgramListFromEmptyFilter Test"; + + getProgramList(); +} + +/** + * Test getting program list using AMFM frequency program filter. + * + * Verifies that: + * - startProgramListUpdates either succeeds or returns NOT_SUPPORTED; + * - the complete list is fetched within kProgramListScanTimeoutSec; + * - stopProgramListUpdates does not crash; + * - result for startProgramListUpdates using a filter with AMFM_FREQUENCY_KHZ value of the first + * AMFM program matches the expected result. + */ +TEST_P(BroadcastRadioHalTest, GetProgramListFromAmFmFilter) { + LOG(DEBUG) << "GetProgramListFromAmFmFilter Test"; + + std::optional completeList = getProgramList(); + if (!completeList) { + printSkipped("No program list available"); + return; + } + + ProgramFilter amfmFilter = {}; + int expectedResultSize = 0; + uint64_t expectedFreq = 0; + for (const auto& program : *completeList) { + vector amfmIds = + bcutils::getAllIds(program.selector, IdentifierType::AMFM_FREQUENCY_KHZ); + EXPECT_LE(amfmIds.size(), 1u); + if (amfmIds.size() == 0) { + continue; + } + + if (expectedResultSize == 0) { + expectedFreq = amfmIds[0]; + amfmFilter.identifiers = { + makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, expectedFreq)}; + expectedResultSize = 1; + } else if (amfmIds[0] == expectedFreq) { + expectedResultSize++; + } + } + + if (expectedResultSize == 0) { + printSkipped("No Am/FM programs available"); + return; + } + std::optional amfmList = getProgramList(amfmFilter); + ASSERT_EQ(amfmList->size(), expectedResultSize) << "amfm filter result size is wrong"; +} + +/** + * Test getting program list using DAB ensemble program filter. + * + * Verifies that: + * - startProgramListUpdates either succeeds or returns NOT_SUPPORTED; + * - the complete list is fetched within kProgramListScanTimeoutSec; + * - stopProgramListUpdates does not crash; + * - result for startProgramListUpdates using a filter with DAB_ENSEMBLE value of the first DAB + * program matches the expected result. + */ +TEST_P(BroadcastRadioHalTest, GetProgramListFromDabFilter) { + LOG(DEBUG) << "GetProgramListFromDabFilter Test"; + + std::optional completeList = getProgramList(); + if (!completeList) { + printSkipped("No program list available"); + return; + } + + ProgramFilter dabFilter = {}; + int expectedResultSize = 0; + uint64_t expectedEnsemble = 0; + for (const auto& program : *completeList) { + auto dabEnsembles = bcutils::getAllIds(program.selector, IdentifierType::DAB_ENSEMBLE); + EXPECT_LE(dabEnsembles.size(), 1u); + if (dabEnsembles.size() == 0) { + continue; + } + + if (expectedResultSize == 0) { + expectedEnsemble = dabEnsembles[0]; + dabFilter.identifiers = { + makeIdentifier(IdentifierType::DAB_ENSEMBLE, expectedEnsemble)}; + expectedResultSize = 1; + } else if (dabEnsembles[0] == expectedEnsemble) { + expectedResultSize++; + } + } + + if (expectedResultSize == 0) { + printSkipped("No DAB programs available"); + return; + } + std::optional dabList = getProgramList(dabFilter); + ASSERT_EQ(dabList->size(), expectedResultSize) << "dab filter result size is wrong"; +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(BroadcastRadioHalTest); +INSTANTIATE_TEST_SUITE_P( + PerInstance, BroadcastRadioHalTest, + testing::ValuesIn(::android::getAidlHalInstanceNames(IBroadcastRadio::descriptor)), + ::android::PrintInstanceNameToString); + +} // namespace aidl::android::hardware::broadcastradio::vts + +int main(int argc, char** argv) { + android::base::SetDefaultTag("BcRadio.vts"); + android::base::SetMinimumLogSeverity(android::base::VERBOSE); + ::testing::InitGoogleTest(&argc, argv); + ABinderProcess_setThreadPoolMaxThreadCount(4); + ABinderProcess_startThreadPool(); + return RUN_ALL_TESTS(); +} From 3277a210d870f63dcb5590e43ae3609d7af2badd Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Thu, 1 Sep 2022 19:08:17 +0000 Subject: [PATCH 272/998] Add VTS on config and parameter for AIDL radio HAL Invalid and valid configuration and parameter inputs are tested on broadcast radio AIDL HAL. Test: atest VtsHalBroadcastradioAidlTargetTest Bug: 249150763 Change-Id: If75d8318f493a8c5332064e5b09ecae102587266 --- .../VtsHalBroadcastradioAidlTargetTest.cpp | 391 ++++++++++++++++++ 1 file changed, 391 insertions(+) diff --git a/broadcastradio/aidl/vts/src/VtsHalBroadcastradioAidlTargetTest.cpp b/broadcastradio/aidl/vts/src/VtsHalBroadcastradioAidlTargetTest.cpp index 02c9356f0c..5a568464ec 100644 --- a/broadcastradio/aidl/vts/src/VtsHalBroadcastradioAidlTargetTest.cpp +++ b/broadcastradio/aidl/vts/src/VtsHalBroadcastradioAidlTargetTest.cpp @@ -65,12 +65,46 @@ inline constexpr std::chrono::seconds kTuneTimeoutSec = inline constexpr std::chrono::seconds kProgramListScanTimeoutSec = std::chrono::seconds(IBroadcastRadio::LIST_COMPLETE_TIMEOUT_MS * 1000); +const ConfigFlag kConfigFlagValues[] = { + ConfigFlag::FORCE_MONO, + ConfigFlag::FORCE_ANALOG, + ConfigFlag::FORCE_DIGITAL, + ConfigFlag::RDS_AF, + ConfigFlag::RDS_REG, + ConfigFlag::DAB_DAB_LINKING, + ConfigFlag::DAB_FM_LINKING, + ConfigFlag::DAB_DAB_SOFT_LINKING, + ConfigFlag::DAB_FM_SOFT_LINKING, +}; + void printSkipped(const string& msg) { const auto testInfo = testing::UnitTest::GetInstance()->current_test_info(); LOG(INFO) << "[ SKIPPED ] " << testInfo->test_case_name() << "." << testInfo->name() << " with message: " << msg; } +bool isValidAmFmFreq(int64_t freq) { + ProgramIdentifier id = bcutils::makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, freq); + return bcutils::isValid(id); +} + +void validateRange(const AmFmBandRange& range) { + EXPECT_TRUE(isValidAmFmFreq(range.lowerBound)); + EXPECT_TRUE(isValidAmFmFreq(range.upperBound)); + EXPECT_LT(range.lowerBound, range.upperBound); + EXPECT_GT(range.spacing, 0u); + EXPECT_EQ((range.upperBound - range.lowerBound) % range.spacing, 0u); +} + +bool supportsFM(const AmFmRegionConfig& config) { + for (const auto& range : config.ranges) { + if (bcutils::getBand(range.lowerBound) == bcutils::FrequencyBand::FM) { + return true; + } + } + return false; +} + } // namespace class TunerCallbackMock : public BnTunerCallback { @@ -251,6 +285,143 @@ TEST_P(BroadcastRadioHalTest, TunerCallbackFailsWithNull) { EXPECT_EQ(halResult.getServiceSpecificError(), resultToInt(Result::INVALID_ARGUMENTS)); } +/** + * Test fetching AM/FM regional configuration. + * + * Verifies that: + * - AM/FM regional configuration is either set at startup or not supported at all by the hardware; + * - FM Deemphasis and RDS are correctly configured for FM-capable radio; + */ +TEST_P(BroadcastRadioHalTest, GetAmFmRegionConfig) { + LOG(DEBUG) << "GetAmFmRegionConfig Test"; + + AmFmRegionConfig config; + + bool supported = getAmFmRegionConfig(/* full= */ false, &config); + + if (!supported) { + printSkipped("AM/FM not supported"); + return; + } + + EXPECT_LE(popcountll(static_cast(config.fmDeemphasis)), 1); + EXPECT_LE(popcountll(static_cast(config.fmRds)), 1); + + if (supportsFM(config)) { + EXPECT_EQ(popcountll(static_cast(config.fmDeemphasis)), 1); + } +} + +/** + * Test fetching ranges of AM/FM regional configuration. + * + * Verifies that: + * - AM/FM regional configuration is either set at startup or not supported at all by the hardware; + * - there is at least one AM/FM band configured; + * - all channel grids (frequency ranges and spacings) are valid; + * - seek spacing is a multiple of the manual spacing value. + */ +TEST_P(BroadcastRadioHalTest, GetAmFmRegionConfigRanges) { + LOG(DEBUG) << "GetAmFmRegionConfigRanges Test"; + + AmFmRegionConfig config; + + bool supported = getAmFmRegionConfig(/* full= */ false, &config); + + if (!supported) { + printSkipped("AM/FM not supported"); + return; + } + + EXPECT_GT(config.ranges.size(), 0u); + for (const auto& range : config.ranges) { + validateRange(range); + EXPECT_EQ(range.seekSpacing % range.spacing, 0u); + EXPECT_GE(range.seekSpacing, range.spacing); + } +} + +/** + * Test fetching FM regional capabilities. + * + * Verifies that: + * - AM/FM regional capabilities are either available or not supported at all by the hardware; + * - there is at least one de-emphasis filter mode supported for FM-capable radio; + */ +TEST_P(BroadcastRadioHalTest, GetAmFmRegionConfigCapabilitiesForFM) { + LOG(DEBUG) << "GetAmFmRegionConfigCapabilitiesForFM Test"; + + AmFmRegionConfig config; + + bool supported = getAmFmRegionConfig(/* full= */ true, &config); + + if (supported && supportsFM(config)) { + EXPECT_GE(popcountll(static_cast(config.fmDeemphasis)), 1); + } else { + printSkipped("FM not supported"); + } +} + +/** + * Test fetching the ranges of AM/FM regional capabilities. + * + * Verifies that: + * - AM/FM regional capabilities are either available or not supported at all by the hardware; + * - there is at least one AM/FM range supported; + * - all channel grids (frequency ranges and spacings) are valid; + * - seek spacing is not set. + */ +TEST_P(BroadcastRadioHalTest, GetAmFmRegionConfigCapabilitiesRanges) { + LOG(DEBUG) << "GetAmFmRegionConfigCapabilitiesRanges Test"; + + AmFmRegionConfig config; + + bool supported = getAmFmRegionConfig(/* full= */ true, &config); + + if (!supported) { + printSkipped("AM/FM not supported"); + return; + } + + EXPECT_GT(config.ranges.size(), 0u); + + for (const auto& range : config.ranges) { + validateRange(range); + EXPECT_EQ(range.seekSpacing, 0u); + } +} + +/** + * Test fetching DAB regional configuration. + * + * Verifies that: + * - DAB regional configuration is either set at startup or not supported at all by the hardware; + * - all channel labels match correct format; + * - all channel frequencies are in correct range. + */ +TEST_P(BroadcastRadioHalTest, GetDabRegionConfig) { + LOG(DEBUG) << "GetDabRegionConfig Test"; + vector config; + + auto halResult = mModule->getDabRegionConfig(&config); + + if (halResult.getServiceSpecificError() == resultToInt(Result::NOT_SUPPORTED)) { + printSkipped("DAB not supported"); + return; + } + ASSERT_TRUE(halResult.isOk()); + + std::regex re("^[A-Z0-9][A-Z0-9 ]{0,5}[A-Z0-9]$"); + + for (const auto& entry : config) { + EXPECT_TRUE(std::regex_match(string(entry.label), re)); + + ProgramIdentifier id = + bcutils::makeIdentifier(IdentifierType::DAB_FREQUENCY_KHZ, entry.frequencyKhz); + EXPECT_TRUE(bcutils::isValid(id)); + } +} + /** * Test tuning without tuner callback set. * @@ -585,6 +756,162 @@ TEST_P(BroadcastRadioHalTest, Cancel) { } } +/** + * Test IBroadcastRadio::get|setParameters() methods called with no parameters. + * + * Verifies that: + * - callback is called for empty parameters set. + */ +TEST_P(BroadcastRadioHalTest, NoParameters) { + LOG(DEBUG) << "NoParameters Test"; + + vector parametersResults = {}; + + auto halResult = mModule->setParameters({}, ¶metersResults); + + ASSERT_TRUE(halResult.isOk()); + ASSERT_EQ(parametersResults.size(), 0u); + + parametersResults.clear(); + + halResult = mModule->getParameters({}, ¶metersResults); + + ASSERT_TRUE(halResult.isOk()); + ASSERT_EQ(parametersResults.size(), 0u); +} + +/** + * Test IBroadcastRadio::get|setParameters() methods called with unknown parameters. + * + * Verifies that: + * - unknown parameters are ignored; + * - callback is called also for empty results set. + */ +TEST_P(BroadcastRadioHalTest, UnknownParameters) { + LOG(DEBUG) << "UnknownParameters Test"; + + vector parametersResults = {}; + + auto halResult = + mModule->setParameters({{"com.android.unknown", "sample"}}, ¶metersResults); + + ASSERT_TRUE(halResult.isOk()); + ASSERT_EQ(parametersResults.size(), 0u); + + parametersResults.clear(); + + halResult = mModule->getParameters({"com.android.unknown*", "sample"}, ¶metersResults); + + ASSERT_TRUE(halResult.isOk()); + ASSERT_EQ(parametersResults.size(), 0u); +} + +/** + * Test geting image of invalid ID. + * + * Verifies that: + * - getImage call handles argument 0 gracefully. + */ +TEST_P(BroadcastRadioHalTest, GetNoImage) { + LOG(DEBUG) << "GetNoImage Test"; + vector rawImage; + + auto result = mModule->getImage(IBroadcastRadio::INVALID_IMAGE, &rawImage); + + ASSERT_TRUE(result.isOk()); + ASSERT_EQ(rawImage.size(), 0u); +} + +/** + * Test getting config flags. + * + * Verifies that: + * - isConfigFlagSet either succeeds or ends with NOT_SUPPORTED or INVALID_STATE; + * - call success or failure is consistent with setConfigFlag. + */ +TEST_P(BroadcastRadioHalTest, FetchConfigFlags) { + LOG(DEBUG) << "FetchConfigFlags Test"; + + for (const auto& flag : kConfigFlagValues) { + bool gotValue = false; + + auto halResult = mModule->isConfigFlagSet(flag, &gotValue); + + if (halResult.getServiceSpecificError() != resultToInt(Result::NOT_SUPPORTED) && + halResult.getServiceSpecificError() != resultToInt(Result::INVALID_STATE)) { + ASSERT_TRUE(halResult.isOk()); + } + + // set must fail or succeed the same way as get + auto setResult = mModule->setConfigFlag(flag, /* value= */ false); + + EXPECT_TRUE((halResult.isOk() && setResult.isOk()) || + (halResult.getServiceSpecificError()) == setResult.getServiceSpecificError()); + + setResult = mModule->setConfigFlag(flag, /* value= */ true); + + EXPECT_TRUE((halResult.isOk() && setResult.isOk()) || + (halResult.getServiceSpecificError()) == setResult.getServiceSpecificError()); + } +} + +/** + * Test setting config flags. + * + * Verifies that: + * - setConfigFlag either succeeds or ends with NOT_SUPPORTED or INVALID_STATE; + * - isConfigFlagSet reflects the state requested immediately after the set call. + */ +TEST_P(BroadcastRadioHalTest, SetConfigFlags) { + LOG(DEBUG) << "SetConfigFlags Test"; + + auto get = [&](ConfigFlag flag) -> bool { + bool* gotValue = nullptr; + + auto halResult = mModule->isConfigFlagSet(flag, gotValue); + + EXPECT_FALSE(gotValue == nullptr); + EXPECT_TRUE(halResult.isOk()); + return *gotValue; + }; + + auto notSupportedError = resultToInt(Result::NOT_SUPPORTED); + auto invalidStateError = resultToInt(Result::INVALID_STATE); + for (const auto& flag : kConfigFlagValues) { + auto result = mModule->setConfigFlag(flag, /* value= */ false); + + if (result.getServiceSpecificError() == notSupportedError || + result.getServiceSpecificError() == invalidStateError) { + // setting to true must result in the same error as false + auto secondResult = mModule->setConfigFlag(flag, /* value= */ true); + + EXPECT_TRUE((result.isOk() && secondResult.isOk()) || + result.getServiceSpecificError() == secondResult.getServiceSpecificError()); + continue; + } else { + ASSERT_TRUE(result.isOk()); + } + + // verify false is set + bool value = get(flag); + EXPECT_FALSE(value); + + // try setting true this time + result = mModule->setConfigFlag(flag, /* value= */ true); + + ASSERT_TRUE(result.isOk()); + value = get(flag); + EXPECT_TRUE(value); + + // false again + result = mModule->setConfigFlag(flag, /* value= */ false); + + ASSERT_TRUE(result.isOk()); + value = get(flag); + EXPECT_FALSE(value); + } +} + /** * Test getting program list using empty program filter. * @@ -694,6 +1021,70 @@ TEST_P(BroadcastRadioHalTest, GetProgramListFromDabFilter) { ASSERT_EQ(dabList->size(), expectedResultSize) << "dab filter result size is wrong"; } +/** + * Test HD_STATION_NAME correctness. + * + * Verifies that if a program on the list contains HD_STATION_NAME identifier: + * - the program provides station name in its metadata; + * - the identifier matches the name; + * - there is only one identifier of that type. + */ +TEST_P(BroadcastRadioHalTest, HdRadioStationNameId) { + LOG(DEBUG) << "HdRadioStationNameId Test"; + + std::optional list = getProgramList(); + if (!list) { + printSkipped("No program list"); + return; + } + + for (const auto& program : *list) { + vector nameIds = bcutils::getAllIds(program.selector, IdentifierType::HD_STATION_NAME); + EXPECT_LE(nameIds.size(), 1u); + if (nameIds.size() == 0) { + continue; + } + + std::optional name = bcutils::getMetadataString(program, Metadata::programName); + if (!name) { + name = bcutils::getMetadataString(program, Metadata::rdsPs); + } + ASSERT_TRUE(name.has_value()); + + ProgramIdentifier expectedId = bcutils::makeHdRadioStationName(*name); + EXPECT_EQ(nameIds[0], expectedId.value); + } +} + +/** + * Test announcement listener registration. + * + * Verifies that: + * - registerAnnouncementListener either succeeds or returns NOT_SUPPORTED; + * - if it succeeds, it returns a valid close handle (which is a nullptr otherwise); + * - closing handle does not crash. + */ +TEST_P(BroadcastRadioHalTest, AnnouncementListenerRegistration) { + LOG(DEBUG) << "AnnouncementListenerRegistration Test"; + std::shared_ptr listener = + SharedRefBase::make(); + std::shared_ptr closeHandle = nullptr; + + auto halResult = mModule->registerAnnouncementListener(listener, {AnnouncementType::EMERGENCY}, + &closeHandle); + + if (halResult.getServiceSpecificError() == resultToInt(Result::NOT_SUPPORTED)) { + ASSERT_EQ(closeHandle.get(), nullptr); + printSkipped("Announcements not supported"); + return; + } + + ASSERT_TRUE(halResult.isOk()); + ASSERT_NE(closeHandle.get(), nullptr); + + closeHandle->close(); +} + GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(BroadcastRadioHalTest); INSTANTIATE_TEST_SUITE_P( PerInstance, BroadcastRadioHalTest, From 221eb8e0c0a849dcecf13e29da1bedcd20a5d493 Mon Sep 17 00:00:00 2001 From: Alex Buynytskyy Date: Wed, 28 Sep 2022 03:35:28 +0000 Subject: [PATCH 273/998] Make new fields backward compatible. ERROR: hardware/interfaces/radio/aidl/aidl_api/android.hardware.radio.network/3/android/hardware/radio/network/EmergencyRegResult.aidl:43.9-13: Field 'mcc' does not have a useful defau lt in some backends. Please either provide a default value for this field or mark the field as @nullable. This value or a null value will be used automatically when an old version of t his parcelable is sent to a process which understands a new version of this parcelable. In order to make sure your code continues to be backwards compatible, make sure the default or n ull value does not cause a semantic change to this parcelable. ERROR: hardware/interfaces/radio/aidl/aidl_api/android.hardware.radio.network/3/android/hardware/radio/network/EmergencyRegResult.aidl:44.9-13: Field 'mnc' does not have a useful defau lt in some backends. Please either provide a default value for this field or mark the field as @nullable. This value or a null value will be used automatically when an old version of t his parcelable is sent to a process which understands a new version of this parcelable. In order to make sure your code continues to be backwards compatible, make sure the default or n ull value does not cause a semantic change to this parcelable. Bug: 243966946 Test: time ./build/make/finalize-step-1.sh Change-Id: I1a10dbee525d34407d44f5fa6c1159bd8d308265 --- .../android/hardware/radio/network/EmergencyRegResult.aidl | 4 ++-- .../android/hardware/radio/network/EmergencyRegResult.aidl | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyRegResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyRegResult.aidl index 523d1aa52e..af17b436f9 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyRegResult.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyRegResult.aidl @@ -40,6 +40,6 @@ parcelable EmergencyRegResult { boolean isEmcBearerSupported; byte nwProvidedEmc; byte nwProvidedEmf; - String mcc; - String mnc; + String mcc = ""; + String mnc = ""; } diff --git a/radio/aidl/android/hardware/radio/network/EmergencyRegResult.aidl b/radio/aidl/android/hardware/radio/network/EmergencyRegResult.aidl index c22317aced..ec70e170ba 100644 --- a/radio/aidl/android/hardware/radio/network/EmergencyRegResult.aidl +++ b/radio/aidl/android/hardware/radio/network/EmergencyRegResult.aidl @@ -16,8 +16,8 @@ package android.hardware.radio.network; import android.hardware.radio.AccessNetwork; -import android.hardware.radio.network.RegState; import android.hardware.radio.network.Domain; +import android.hardware.radio.network.RegState; @VintfStability @JavaDerive(toString=true) @@ -56,8 +56,8 @@ parcelable EmergencyRegResult { byte nwProvidedEmf; /** 3-digit Mobile Country Code, 000..999, empty string if unknown. */ - String mcc; + String mcc = ""; /** 2 or 3-digit Mobile Network Code, 00..999, empty string if unknown. */ - String mnc; + String mnc = ""; } From 059583563d667c3953c9970bff99672b1c66e879 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Thu, 29 Sep 2022 06:46:26 +0000 Subject: [PATCH 274/998] Specify the version of imported android.hardware.radio To resolve the broken build due to the multiple versions of aidl_interface android.hardware.radio co-existed, including V1 an V2. Bug: 243344927 Bug: 248994335 Test: build Change-Id: I39a6af55e3573366d4cbeaf56467c567a9b48113 --- radio/aidl/Android.bp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp index fde98fca22..613f31b94a 100644 --- a/radio/aidl/Android.bp +++ b/radio/aidl/Android.bp @@ -36,7 +36,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/config/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio"], + imports: ["android.hardware.radio-V1"], backend: { cpp: { enabled: true, @@ -60,7 +60,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/data/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio"], + imports: ["android.hardware.radio-V1"], backend: { cpp: { enabled: true, @@ -84,7 +84,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/messaging/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio"], + imports: ["android.hardware.radio-V1"], backend: { cpp: { enabled: true, @@ -108,7 +108,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/modem/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio"], + imports: ["android.hardware.radio-V1"], backend: { cpp: { enabled: true, @@ -157,7 +157,7 @@ aidl_interface { srcs: ["android/hardware/radio/sim/*.aidl"], stability: "vintf", imports: [ - "android.hardware.radio", + "android.hardware.radio-V1", "android.hardware.radio.config", ], backend: { @@ -186,7 +186,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/voice/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio"], + imports: ["android.hardware.radio-V1"], backend: { cpp: { enabled: true, From 9fab4916b10f0097f99db67ac6ade81cccf7f1b7 Mon Sep 17 00:00:00 2001 From: Bob Badour Date: Thu, 29 Sep 2022 11:59:23 -0700 Subject: [PATCH 275/998] [LSC] Add LOCAL_LICENSE_KINDS to hardware/interfaces Added SPDX-license-identifier-Apache-2.0 to: automotive/remoteaccess/impl/default/proto/Android.bp broadcastradio/aidl/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Change-Id: Idb39e78e5e4181fef165afd5451ac79597c89bfb --- automotive/remoteaccess/impl/default/proto/Android.bp | 9 +++++++++ broadcastradio/aidl/Android.bp | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/automotive/remoteaccess/impl/default/proto/Android.bp b/automotive/remoteaccess/impl/default/proto/Android.bp index d3c75a65f2..31b9d0ebce 100644 --- a/automotive/remoteaccess/impl/default/proto/Android.bp +++ b/automotive/remoteaccess/impl/default/proto/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + genrule { name: "wakeup_client_pb_h", tools: [ diff --git a/broadcastradio/aidl/Android.bp b/broadcastradio/aidl/Android.bp index 41d637c8d7..2d8078b926 100644 --- a/broadcastradio/aidl/Android.bp +++ b/broadcastradio/aidl/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.broadcastradio", vendor_available: true, From cb6fee5502805a9b65bf5e905cc98f6989b389dd Mon Sep 17 00:00:00 2001 From: Peiyong Lin Date: Thu, 29 Sep 2022 21:15:15 +0000 Subject: [PATCH 276/998] Add power efficiency hint for power hint session. Background threads sometimes can be very CPU intensive but not critical from a user's perspective or senstive to a target deadline. Such workload often time consumes some extra power with no user benefit. This newly added power efficiency hint allows client to express threads within the power hint session should be applied with a power-effiecient-first scheduling strategy, and hence allows the power implementation to apply such strategy confidently. Bug: b/244216750 Test: atest VtsHalPowerTargetTest Change-Id: Iac10b090b208b37f0b7b18a34a45f2da8ecc419b --- .../current/android/hardware/power/SessionHint.aidl | 1 + power/aidl/android/hardware/power/SessionHint.aidl | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SessionHint.aidl b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SessionHint.aidl index b19c77b525..9c1f381543 100644 --- a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SessionHint.aidl +++ b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SessionHint.aidl @@ -38,4 +38,5 @@ enum SessionHint { CPU_LOAD_DOWN = 1, CPU_LOAD_RESET = 2, CPU_LOAD_RESUME = 3, + POWER_EFFICIENCY = 4, } diff --git a/power/aidl/android/hardware/power/SessionHint.aidl b/power/aidl/android/hardware/power/SessionHint.aidl index 6a95035d35..a172e12746 100644 --- a/power/aidl/android/hardware/power/SessionHint.aidl +++ b/power/aidl/android/hardware/power/SessionHint.aidl @@ -25,22 +25,31 @@ enum SessionHint { * This hint must be sent before reporting the actual duration to the session. */ CPU_LOAD_UP = 0, + /** * This hint indicates a decrease in CPU workload intensity. It means that * this hint session can reduce CPU resources and still meet the target duration. */ CPU_LOAD_DOWN = 1, - /* + + /** * This hint indicates an upcoming CPU workload that is completely changed and * unknown. It means that the hint session should reset CPU resources to a known * baseline to prepare for an arbitrary load, and must wake up if inactive. */ CPU_LOAD_RESET = 2, - /* + + /** * This hint indicates that the most recent CPU workload is resuming after a * period of inactivity. It means that the hint session should allocate similar * CPU resources to what was used previously, and must wake up if inactive. */ CPU_LOAD_RESUME = 3, + /** + * This hint indicates that this power hint session should be applied with a + * power-efficient-first scheduling strategy. This means the work of this + * power hint session is noncritical despite its CPU intensity. + */ + POWER_EFFICIENCY = 4, } From 8308c2140cbf6be97e80d9b769b2b18619533a78 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Fri, 30 Sep 2022 01:10:35 +0000 Subject: [PATCH 277/998] Remove reserved states from SrvccCall.CallSubState Bug: 216387835 Bug: 217654931 Test: build & flash Change-Id: I8c9ad9afe8c9581a6f34e13d9f71e229763207cd --- .../current/android/hardware/radio/ims/SrvccCall.aidl | 3 --- radio/aidl/android/hardware/radio/ims/SrvccCall.aidl | 3 --- 2 files changed, 6 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl index a09cca6e8d..a8b7cfc250 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl @@ -54,9 +54,6 @@ parcelable SrvccCall { enum CallSubState { NONE = 0, PREALERTING = 1, - ANSWERED = 2, - HOLD_REQUESTED = 3, - RESUME_REQUESTED = 4, } @Backing(type="int") @VintfStability enum ToneType { diff --git a/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl b/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl index f6a751e63b..38e6cdbd54 100644 --- a/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl +++ b/radio/aidl/android/hardware/radio/ims/SrvccCall.aidl @@ -33,9 +33,6 @@ parcelable SrvccCall { NONE, /** Pre-alerting state. Applicable for MT calls only */ PREALERTING, - ANSWERED, - HOLD_REQUESTED, - RESUME_REQUESTED, } @VintfStability From a725df46fcd1f4ecbe961cbbf712ae30bc2e7655 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Mon, 12 Sep 2022 14:56:32 -0700 Subject: [PATCH 278/998] Add a test wakeupclient service implementation. The test implementation will send out a remote task to remote access HAL every 5s. Test: Manually test on gcar_emu. adb root adb remount adb reboot adb root adb remount m -j TestWakeupClientServer cd out/target/product/emulator_car64_x86_64 adb push ./vendor/bin/TestWakeupClientServer /vendor/bin adb shell In the shell: su /vendor/bin/TestWakeupClientServer Check adb logcat, verify tasks are received. Bug: 246841306 Change-Id: Idaf198662f7004e3a9e77d75caeffc00cda49218 --- .../default/client => hal/default}/Android.bp | 1 + .../default}/include/RemoteAccessService.h | 0 .../{impl => hal}/default/proto/Android.bp | 0 .../default/proto/wakeup_client.proto | 0 .../default}/remoteaccess-default-service.rc | 0 .../default}/remoteaccess-default-service.xml | 0 .../default}/src/RemoteAccessImpl.cpp | 20 ++- .../default}/src/RemoteAccessService.cpp | 5 + .../{impl => hal}/default/test/Android.bp | 0 .../test/RemoteAccessServiceUnitTest.cpp | 0 .../remoteaccess/test_grpc_server/README.md | 7 + .../test_grpc_server/impl/Android.bp | 34 ++++ .../include/TestWakeupClientServiceImpl.h | 93 +++++++++++ .../impl/src/TestWakeupClientServiceImpl.cpp | 152 ++++++++++++++++++ .../test_grpc_server/impl/src/main.cpp | 48 ++++++ 15 files changed, 354 insertions(+), 6 deletions(-) rename automotive/remoteaccess/{impl/default/client => hal/default}/Android.bp (97%) rename automotive/remoteaccess/{impl/default/client => hal/default}/include/RemoteAccessService.h (100%) rename automotive/remoteaccess/{impl => hal}/default/proto/Android.bp (100%) rename automotive/remoteaccess/{impl => hal}/default/proto/wakeup_client.proto (100%) rename automotive/remoteaccess/{impl/default/client => hal/default}/remoteaccess-default-service.rc (100%) rename automotive/remoteaccess/{impl/default/client => hal/default}/remoteaccess-default-service.xml (100%) rename automotive/remoteaccess/{impl/default/client => hal/default}/src/RemoteAccessImpl.cpp (70%) rename automotive/remoteaccess/{impl/default/client => hal/default}/src/RemoteAccessService.cpp (95%) rename automotive/remoteaccess/{impl => hal}/default/test/Android.bp (100%) rename automotive/remoteaccess/{impl => hal}/default/test/RemoteAccessServiceUnitTest.cpp (100%) create mode 100644 automotive/remoteaccess/test_grpc_server/README.md create mode 100644 automotive/remoteaccess/test_grpc_server/impl/Android.bp create mode 100644 automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h create mode 100644 automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp create mode 100644 automotive/remoteaccess/test_grpc_server/impl/src/main.cpp diff --git a/automotive/remoteaccess/impl/default/client/Android.bp b/automotive/remoteaccess/hal/default/Android.bp similarity index 97% rename from automotive/remoteaccess/impl/default/client/Android.bp rename to automotive/remoteaccess/hal/default/Android.bp index 6327637941..25bda3e7a6 100644 --- a/automotive/remoteaccess/impl/default/client/Android.bp +++ b/automotive/remoteaccess/hal/default/Android.bp @@ -37,6 +37,7 @@ cc_binary { ], cflags: [ "-Wno-unused-parameter", + "-DGRPC_SERVICE_ADDRESS=\"localhost:50051\"", ], } diff --git a/automotive/remoteaccess/impl/default/client/include/RemoteAccessService.h b/automotive/remoteaccess/hal/default/include/RemoteAccessService.h similarity index 100% rename from automotive/remoteaccess/impl/default/client/include/RemoteAccessService.h rename to automotive/remoteaccess/hal/default/include/RemoteAccessService.h diff --git a/automotive/remoteaccess/impl/default/proto/Android.bp b/automotive/remoteaccess/hal/default/proto/Android.bp similarity index 100% rename from automotive/remoteaccess/impl/default/proto/Android.bp rename to automotive/remoteaccess/hal/default/proto/Android.bp diff --git a/automotive/remoteaccess/impl/default/proto/wakeup_client.proto b/automotive/remoteaccess/hal/default/proto/wakeup_client.proto similarity index 100% rename from automotive/remoteaccess/impl/default/proto/wakeup_client.proto rename to automotive/remoteaccess/hal/default/proto/wakeup_client.proto diff --git a/automotive/remoteaccess/impl/default/client/remoteaccess-default-service.rc b/automotive/remoteaccess/hal/default/remoteaccess-default-service.rc similarity index 100% rename from automotive/remoteaccess/impl/default/client/remoteaccess-default-service.rc rename to automotive/remoteaccess/hal/default/remoteaccess-default-service.rc diff --git a/automotive/remoteaccess/impl/default/client/remoteaccess-default-service.xml b/automotive/remoteaccess/hal/default/remoteaccess-default-service.xml similarity index 100% rename from automotive/remoteaccess/impl/default/client/remoteaccess-default-service.xml rename to automotive/remoteaccess/hal/default/remoteaccess-default-service.xml diff --git a/automotive/remoteaccess/impl/default/client/src/RemoteAccessImpl.cpp b/automotive/remoteaccess/hal/default/src/RemoteAccessImpl.cpp similarity index 70% rename from automotive/remoteaccess/impl/default/client/src/RemoteAccessImpl.cpp rename to automotive/remoteaccess/hal/default/src/RemoteAccessImpl.cpp index 743189854b..8720c2f5c6 100644 --- a/automotive/remoteaccess/impl/default/client/src/RemoteAccessImpl.cpp +++ b/automotive/remoteaccess/hal/default/src/RemoteAccessImpl.cpp @@ -20,27 +20,35 @@ #include #include +#include +#include #include +constexpr char SERVICE_NAME[] = "android.hardware.automotive.remoteaccess.IRemoteAccess/default"; + int main(int /* argc */, char* /* argv */[]) { ALOGI("Registering RemoteAccessService as service..."); - // TODO(b/241483300): Create GrpcClientStub here. +#ifndef GRPC_SERVICE_ADDRESS + ALOGE("GRPC_SERVICE_ADDRESS is not defined, exiting"); + exit(1); +#endif + auto channel = grpc::CreateChannel(GRPC_SERVICE_ADDRESS, grpc::InsecureChannelCredentials()); + auto clientStub = android::hardware::automotive::remoteaccess::WakeupClient::NewStub(channel); auto service = ndk::SharedRefBase::make< - android::hardware::automotive::remoteaccess::RemoteAccessService>(nullptr); + android::hardware::automotive::remoteaccess::RemoteAccessService>(clientStub.get()); - binder_exception_t err = AServiceManager_addService( - service->asBinder().get(), "android.hardware.automotive.remote.IRemoteAccess/default"); + binder_exception_t err = AServiceManager_addService(service->asBinder().get(), SERVICE_NAME); if (err != EX_NONE) { ALOGE("failed to register android.hardware.automotive.remote.IRemoteAccess service, " "exception: %d", err); - return 1; + exit(1); } if (!ABinderProcess_setThreadPoolMaxThreadCount(1)) { ALOGE("%s", "failed to set thread pool max thread count"); - return 1; + exit(1); } ABinderProcess_startThreadPool(); diff --git a/automotive/remoteaccess/impl/default/client/src/RemoteAccessService.cpp b/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp similarity index 95% rename from automotive/remoteaccess/impl/default/client/src/RemoteAccessService.cpp rename to automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp index 6b97840999..6c297e3cd3 100644 --- a/automotive/remoteaccess/impl/default/client/src/RemoteAccessService.cpp +++ b/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp @@ -104,14 +104,19 @@ void RemoteAccessService::runTaskLoop() { } GetRemoteTasksResponse response; while (reader->Read(&response)) { + ALOGI("Receiving one task from remote task client"); + std::shared_ptr callback; { std::lock_guard lockGuard(mLock); callback = mRemoteTaskCallback; } if (callback == nullptr) { + ALOGD("No callback registered, task ignored"); continue; } + ALOGD("Calling onRemoteTaskRequested callback for client ID: %s", + response.clientid().c_str()); ScopedAStatus callbackStatus = callback->onRemoteTaskRequested( response.clientid(), stringToBytes(response.data())); if (!callbackStatus.isOk()) { diff --git a/automotive/remoteaccess/impl/default/test/Android.bp b/automotive/remoteaccess/hal/default/test/Android.bp similarity index 100% rename from automotive/remoteaccess/impl/default/test/Android.bp rename to automotive/remoteaccess/hal/default/test/Android.bp diff --git a/automotive/remoteaccess/impl/default/test/RemoteAccessServiceUnitTest.cpp b/automotive/remoteaccess/hal/default/test/RemoteAccessServiceUnitTest.cpp similarity index 100% rename from automotive/remoteaccess/impl/default/test/RemoteAccessServiceUnitTest.cpp rename to automotive/remoteaccess/hal/default/test/RemoteAccessServiceUnitTest.cpp diff --git a/automotive/remoteaccess/test_grpc_server/README.md b/automotive/remoteaccess/test_grpc_server/README.md new file mode 100644 index 0000000000..deea764078 --- /dev/null +++ b/automotive/remoteaccess/test_grpc_server/README.md @@ -0,0 +1,7 @@ +# Test GRPC Server. + +A test GRPC server that implements wakeup_client.proto. This test server acts +as a reference implementation for a remote wakeup client running on TCU. This +reference server also implements wakeup_client_debug.proto which is the +debugging interface. It is recommended that the actual implementation also +implements this test interface for easier end-to-end testing. diff --git a/automotive/remoteaccess/test_grpc_server/impl/Android.bp b/automotive/remoteaccess/test_grpc_server/impl/Android.bp new file mode 100644 index 0000000000..5332c9241f --- /dev/null +++ b/automotive/remoteaccess/test_grpc_server/impl/Android.bp @@ -0,0 +1,34 @@ +// 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. + +cc_binary { + name: "TestWakeupClientServer", + vendor: true, + srcs: ["src/*.cpp"], + local_include_dirs: ["include"], + shared_libs: [ + "libbase", + "liblog", + "libutils", + "libgrpc++", + "libprotobuf-cpp-full", + ], + whole_static_libs: [ + "wakeup_client_protos", + ], + cflags: [ + "-Wno-unused-parameter", + "-DGRPC_SERVICE_ADDRESS=\"localhost:50051\"", + ], +} diff --git a/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h b/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h new file mode 100644 index 0000000000..4c440b8c00 --- /dev/null +++ b/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h @@ -0,0 +1,93 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace remoteaccess { + +// A class to generate fake task for testing. Not required for real implementation. In real +// implementation, the task should come from remote task server. This class is thread-safe. +class FakeTaskGenerator final { + public: + GetRemoteTasksResponse generateTask(); + + private: + // Simulates the client ID for each task. + std::atomic mCurrentClientId = 0; + constexpr static uint8_t DATA[] = {0xde, 0xad, 0xbe, 0xef}; +}; + +// TaskQueue is thread-safe. +class TaskQueue final { + public: + void add(const GetRemoteTasksResponse& response); + std::optional maybePopOne(); + void waitForTask(); + void stopWait(); + + private: + std::mutex mLock; + std::queue mTasks GUARDED_BY(mLock); + // A variable to notify mTasks is not empty. + std::condition_variable mTasksNotEmptyCv; + bool mStopped GUARDED_BY(mLock); +}; + +class TestWakeupClientServiceImpl final : public WakeupClient::Service { + public: + TestWakeupClientServiceImpl(); + + ~TestWakeupClientServiceImpl(); + + grpc::Status GetRemoteTasks(grpc::ServerContext* context, const GetRemoteTasksRequest* request, + grpc::ServerWriter* writer) override; + + grpc::Status NotifyWakeupRequired(grpc::ServerContext* context, + const NotifyWakeupRequiredRequest* request, + NotifyWakeupRequiredResponse* response) override; + + private: + // This is a thread for communicating with remote wakeup server (via network) and receive tasks + // from it. + std::thread mThread; + // A variable to notify server is stopping. + std::condition_variable mServerStoppedCv; + std::mutex mLock; + bool mServerStopped GUARDED_BY(mLock); + + // Thread-safe. For test impl only. + FakeTaskGenerator mFakeTaskGenerator; + // Thread-sfae. + TaskQueue mTaskQueue; + + void fakeTaskGenerateLoop(); +}; + +} // namespace remoteaccess +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp new file mode 100644 index 0000000000..1eb87e285e --- /dev/null +++ b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp @@ -0,0 +1,152 @@ +/* + * 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. + */ + +#include "TestWakeupClientServiceImpl.h" + +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace remoteaccess { + +namespace { + +using ::android::base::ScopedLockAssertion; +using ::android::base::StringPrintf; +using ::grpc::ServerContext; +using ::grpc::ServerWriter; +using ::grpc::Status; + +constexpr int kTaskIntervalInSec = 5; + +} // namespace + +GetRemoteTasksResponse FakeTaskGenerator::generateTask() { + int clientId = mCurrentClientId++; + GetRemoteTasksResponse response; + response.set_data(std::string(reinterpret_cast(DATA), sizeof(DATA))); + std::string clientIdStr = StringPrintf("%d", clientId); + response.set_clientid(clientIdStr); + return response; +} + +std::optional TaskQueue::maybePopOne() { + std::lock_guard lockGuard(mLock); + if (mTasks.size() == 0) { + return std::nullopt; + } + GetRemoteTasksResponse response = mTasks.front(); + mTasks.pop(); + return std::move(response); +} +void TaskQueue::add(const GetRemoteTasksResponse& task) { + // TODO (b/246841306): add timeout to tasks. + std::lock_guard lockGuard(mLock); + mTasks.push(task); + mTasksNotEmptyCv.notify_all(); +} + +void TaskQueue::waitForTask() { + std::unique_lock lock(mLock); + mTasksNotEmptyCv.wait(lock, [this] { + ScopedLockAssertion lockAssertion(mLock); + return mTasks.size() > 0 || mStopped; + }); +} + +void TaskQueue::stopWait() { + std::lock_guard lockGuard(mLock); + mStopped = true; + mTasksNotEmptyCv.notify_all(); +} + +TestWakeupClientServiceImpl::TestWakeupClientServiceImpl() { + mThread = std::thread([this] { fakeTaskGenerateLoop(); }); +} + +TestWakeupClientServiceImpl::~TestWakeupClientServiceImpl() { + { + std::lock_guard lockGuard(mLock); + mServerStopped = true; + mServerStoppedCv.notify_all(); + } + mTaskQueue.stopWait(); + if (mThread.joinable()) { + mThread.join(); + } +} + +void TestWakeupClientServiceImpl::fakeTaskGenerateLoop() { + // In actual implementation, this should communicate with the remote server and receives tasks + // from it. Here we simulate receiving one remote task every {kTaskIntervalInSec}s. + while (true) { + mTaskQueue.add(mFakeTaskGenerator.generateTask()); + ALOGI("Sleeping for %d seconds until next task", kTaskIntervalInSec); + + std::unique_lock lk(mLock); + if (mServerStoppedCv.wait_for(lk, std::chrono::seconds(kTaskIntervalInSec), [this] { + ScopedLockAssertion lockAssertion(mLock); + return mServerStopped; + })) { + // If the stopped flag is set, we are quitting, exit the loop. + return; + } + } +} + +Status TestWakeupClientServiceImpl::GetRemoteTasks(ServerContext* context, + const GetRemoteTasksRequest* request, + ServerWriter* writer) { + ALOGD("GetRemoteTasks called"); + while (true) { + mTaskQueue.waitForTask(); + + while (true) { + auto maybeTask = mTaskQueue.maybePopOne(); + if (!maybeTask.has_value()) { + // No task left, loop again and wait for another task(s). + break; + } + // Loop through all the task in the queue but obtain lock for each element so we don't + // hold lock while writing the response. + const GetRemoteTasksResponse& response = maybeTask.value(); + if (!writer->Write(response)) { + // Broken stream, maybe the client is shutting down. + ALOGW("Failed to deliver remote task to remote access HAL"); + // The task failed to be sent, add it back to the queue. The order might change, but + // it is okay. + mTaskQueue.add(response); + return Status::CANCELLED; + } + } + } + return Status::OK; +} + +Status TestWakeupClientServiceImpl::NotifyWakeupRequired(ServerContext* context, + const NotifyWakeupRequiredRequest* request, + NotifyWakeupRequiredResponse* response) { + return Status::OK; +} + +} // namespace remoteaccess +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/remoteaccess/test_grpc_server/impl/src/main.cpp b/automotive/remoteaccess/test_grpc_server/impl/src/main.cpp new file mode 100644 index 0000000000..bb03e703a6 --- /dev/null +++ b/automotive/remoteaccess/test_grpc_server/impl/src/main.cpp @@ -0,0 +1,48 @@ +/* + * 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. + */ + +#include + +#include "TestWakeupClientServiceImpl.h" + +#include +#include +#include +#include +#include + +using ::android::hardware::automotive::remoteaccess::TestWakeupClientServiceImpl; +using ::grpc::Server; +using ::grpc::ServerBuilder; +using ::grpc::ServerWriter; + +void RunServer() { + std::string serverAddress(GRPC_SERVICE_ADDRESS); + std::shared_ptr service = + std::make_unique(); + + ServerBuilder builder; + builder.AddListeningPort(serverAddress, grpc::InsecureServerCredentials()); + builder.RegisterService(service.get()); + std::unique_ptr server(builder.BuildAndStart()); + ALOGI("Test Remote Access GRPC Server listening on %s", serverAddress.c_str()); + server->Wait(); +} + +int main(int argc, char** argv) { + RunServer(); + return 0; +} From dc54b8c24edb192110d39e51569e8e60507f7c7c Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 14 Sep 2022 17:48:15 -0700 Subject: [PATCH 279/998] Add debug command to remote access HAL. Add debug command to test remote access HAL. Bug: 241483300 Test: Follow: change file sytem to read-write. m -j TestWakeupClientServer adb push out/target/product/emulator_car64_x86_64/vendor/bin/TestWakeupClientServer /vendor/bin In one adb shell: /vendor/bin/TestWakeupClientServer In another shell: dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --start-debug-callback dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --show-task [should show no tasks] dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --ready-for-remote-task 1 [wait for 5s] dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --show-task [should see all the tasks from client ID 1] dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --ready-for-remote-task 0 [wait for 5s] dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --show-task [should see no new tasks] dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --ready-for-remote-task 1 dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --show-task [should see new tasks] Change-Id: I551bf9ab5b55c4de9d8382d69bd5078ec62cad51 --- .../remoteaccess/hal/default/Android.bp | 2 + .../hal/default/include/RemoteAccessService.h | 30 +++++ .../hal/default/src/RemoteAccessService.cpp | 126 +++++++++++++++++- .../remoteaccess/hal/default/test/Android.bp | 1 + 4 files changed, 158 insertions(+), 1 deletion(-) diff --git a/automotive/remoteaccess/hal/default/Android.bp b/automotive/remoteaccess/hal/default/Android.bp index 25bda3e7a6..250207983a 100644 --- a/automotive/remoteaccess/hal/default/Android.bp +++ b/automotive/remoteaccess/hal/default/Android.bp @@ -29,6 +29,7 @@ cc_binary { "RemoteAccessService", ], shared_libs: [ + "libbase", "libbinder_ndk", "liblog", "libutils", @@ -56,6 +57,7 @@ cc_library { shared_libs: [ "libbase", "libbinder_ndk", + "libcutils", "liblog", "libutils", "libgrpc++", diff --git a/automotive/remoteaccess/hal/default/include/RemoteAccessService.h b/automotive/remoteaccess/hal/default/include/RemoteAccessService.h index 806440a2df..207c09369f 100644 --- a/automotive/remoteaccess/hal/default/include/RemoteAccessService.h +++ b/automotive/remoteaccess/hal/default/include/RemoteAccessService.h @@ -18,8 +18,11 @@ #include #include +#include #include #include +#include +#include #include #include @@ -30,6 +33,27 @@ namespace hardware { namespace automotive { namespace remoteaccess { +// A IRemoteTaskCallback implementation for debug purpose. +class DebugRemoteTaskCallback final + : public aidl::android::hardware::automotive::remoteaccess::BnRemoteTaskCallback { + public: + DebugRemoteTaskCallback() { mStartTimeMillis = android::uptimeMillis(); }; + + ndk::ScopedAStatus onRemoteTaskRequested(const std::string& clientId, + const std::vector& data) override; + std::string printTasks(); + + private: + struct TaskData { + std::string clientId; + std::vector data; + }; + + std::mutex mLock; + int64_t mStartTimeMillis; + std::vector mTasks; +}; + class RemoteAccessService : public aidl::android::hardware::automotive::remoteaccess::BnRemoteAccess { public: @@ -51,10 +75,14 @@ class RemoteAccessService ndk::ScopedAStatus notifyApStateChange( const aidl::android::hardware::automotive::remoteaccess::ApState& newState) override; + binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; + private: // For testing. friend class RemoteAccessServiceUnitTest; + static bool checkDumpPermission(); + WakeupClient::StubInterface* mGrpcStub; std::thread mThread; std::mutex mLock; @@ -69,12 +97,14 @@ class RemoteAccessService bool mTaskLoopRunning GUARDED_BY(mStartStopTaskLoopLock); // Default wait time before retry connecting to remote access client is 10s. size_t mRetryWaitInMs = 10'000; + std::shared_ptr mDebugCallback; void runTaskLoop(); void maybeStartTaskLoop(); void maybeStopTaskLoop(); void setRetryWaitInMs(size_t retryWaitInMs) { mRetryWaitInMs = retryWaitInMs; } + void dumpHelp(int fd); }; } // namespace remoteaccess diff --git a/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp b/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp index 6c297e3cd3..cc8b50cb67 100644 --- a/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp +++ b/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp @@ -16,8 +16,10 @@ #include "RemoteAccessService.h" +#include #include #include +#include #include #include #include @@ -32,6 +34,8 @@ namespace { using ::aidl::android::hardware::automotive::remoteaccess::ApState; using ::aidl::android::hardware::automotive::remoteaccess::IRemoteTaskCallback; using ::android::base::ScopedLockAssertion; +using ::android::base::StringAppendF; +using ::android::base::StringPrintf; using ::grpc::ClientContext; using ::grpc::ClientReaderInterface; using ::grpc::Status; @@ -39,6 +43,10 @@ using ::grpc::StatusCode; using ::ndk::ScopedAStatus; const std::string WAKEUP_SERVICE_NAME = "com.google.vehicle.wakeup"; +constexpr char COMMAND_SET_AP_STATE[] = "--set-ap-state"; +constexpr char COMMAND_START_DEBUG_CALLBACK[] = "--start-debug-callback"; +constexpr char COMMAND_STOP_DEBUG_CALLBACK[] = "--stop-debug-callback"; +constexpr char COMMAND_SHOW_TASK[] = "--show-task"; std::vector stringToBytes(const std::string& s) { const char* data = s.data(); @@ -50,6 +58,18 @@ ScopedAStatus rpcStatusToScopedAStatus(const Status& status, const std::string& status.error_code(), (errorMsg + ", error: " + status.error_message()).c_str()); } +std::string printBytes(const std::vector& bytes) { + std::string s; + for (size_t i = 0; i < bytes.size(); i++) { + StringAppendF(&s, "%02x", bytes[i]); + } + return s; +} + +bool checkBoolFlag(const char* flag) { + return !strcmp(flag, "1") || !strcmp(flag, "0"); +} + } // namespace RemoteAccessService::RemoteAccessService(WakeupClient::StubInterface* grpcStub) @@ -154,7 +174,7 @@ ScopedAStatus RemoteAccessService::getWakeupServiceName(std::string* wakeupServi } ScopedAStatus RemoteAccessService::setRemoteTaskCallback( - [[maybe_unused]] const std::shared_ptr& callback) { + const std::shared_ptr& callback) { std::lock_guard lockGuard(mLock); mRemoteTaskCallback = callback; return ScopedAStatus::ok(); @@ -184,6 +204,110 @@ ScopedAStatus RemoteAccessService::notifyApStateChange(const ApState& newState) return ScopedAStatus::ok(); } +bool RemoteAccessService::checkDumpPermission() { + uid_t uid = AIBinder_getCallingUid(); + return uid == AID_ROOT || uid == AID_SHELL || uid == AID_SYSTEM; +} + +void RemoteAccessService::dumpHelp(int fd) { + dprintf(fd, "%s", + (std::string("RemoteAccess HAL debug interface, Usage: \n") + COMMAND_SET_AP_STATE + + " [0/1](isReadyForRemoteTask) [0/1](isWakeupRequired) Set the new AP state\n" + + COMMAND_START_DEBUG_CALLBACK + + " Start a debug callback that will record the received tasks\n" + + COMMAND_STOP_DEBUG_CALLBACK + " Stop the debug callback\n" + COMMAND_SHOW_TASK + + " Show tasks received by debug callback\n") + .c_str()); +} + +binder_status_t RemoteAccessService::dump(int fd, const char** args, uint32_t numArgs) { + if (!checkDumpPermission()) { + dprintf(fd, "Caller must be root, system or shell\n"); + return STATUS_PERMISSION_DENIED; + } + + if (numArgs == 0) { + dumpHelp(fd); + return STATUS_OK; + } + + if (!strcmp(args[0], COMMAND_SET_AP_STATE)) { + if (numArgs < 3) { + dumpHelp(fd); + return STATUS_OK; + } + ApState apState = {}; + const char* remoteTaskFlag = args[1]; + if (!strcmp(remoteTaskFlag, "1") && !strcmp(remoteTaskFlag, "0")) { + dumpHelp(fd); + return STATUS_OK; + } + if (!checkBoolFlag(args[1])) { + dumpHelp(fd); + return STATUS_OK; + } + if (!strcmp(args[1], "1")) { + apState.isReadyForRemoteTask = true; + } + if (!checkBoolFlag(args[2])) { + dumpHelp(fd); + return STATUS_OK; + } + if (!strcmp(args[2], "1")) { + apState.isWakeupRequired = true; + } + auto status = notifyApStateChange(apState); + if (!status.isOk()) { + dprintf(fd, "Failed to set AP state, code: %d, error: %s\n", status.getStatus(), + status.getMessage()); + } else { + dprintf(fd, "successfully set the new AP state\n"); + } + } else if (!strcmp(args[0], COMMAND_START_DEBUG_CALLBACK)) { + mDebugCallback = ndk::SharedRefBase::make(); + setRemoteTaskCallback(mDebugCallback); + dprintf(fd, "Debug callback registered\n"); + } else if (!strcmp(args[0], COMMAND_STOP_DEBUG_CALLBACK)) { + if (mDebugCallback) { + mDebugCallback.reset(); + } + clearRemoteTaskCallback(); + dprintf(fd, "Debug callback unregistered\n"); + } else if (!strcmp(args[0], COMMAND_SHOW_TASK)) { + if (mDebugCallback) { + dprintf(fd, "%s", mDebugCallback->printTasks().c_str()); + } else { + dprintf(fd, "Debug callback is not currently used, use \"%s\" first.\n", + COMMAND_START_DEBUG_CALLBACK); + } + } else { + dumpHelp(fd); + } + + return STATUS_OK; +} + +ScopedAStatus DebugRemoteTaskCallback::onRemoteTaskRequested(const std::string& clientId, + const std::vector& data) { + std::lock_guard lockGuard(mLock); + mTasks.push_back({ + .clientId = clientId, + .data = data, + }); + return ScopedAStatus::ok(); +} + +std::string DebugRemoteTaskCallback::printTasks() { + std::lock_guard lockGuard(mLock); + std::string s = StringPrintf("Received %zu tasks in %f seconds", mTasks.size(), + (android::uptimeMillis() - mStartTimeMillis) / 1000.); + for (size_t i = 0; i < mTasks.size(); i++) { + StringAppendF(&s, "Client Id: %s, Data: %s\n", mTasks[i].clientId.c_str(), + printBytes(mTasks[i].data).c_str()); + } + return s; +} + } // namespace remoteaccess } // namespace automotive } // namespace hardware diff --git a/automotive/remoteaccess/hal/default/test/Android.bp b/automotive/remoteaccess/hal/default/test/Android.bp index e92440f55f..bf7d0b6b43 100644 --- a/automotive/remoteaccess/hal/default/test/Android.bp +++ b/automotive/remoteaccess/hal/default/test/Android.bp @@ -24,6 +24,7 @@ cc_test { "RemoteAccessService", ], shared_libs: [ + "libbase", "libbinder_ndk", "liblog", "libutils", From bc2ed2a3c78cabc78e53a080b17ea9c202bef61a Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Thu, 15 Sep 2022 19:01:52 -0700 Subject: [PATCH 280/998] Talk with VHAL to get device ID. Test: In adb root shell: dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default Bug: 241483300 Change-Id: I884cb75a493550afe4b1b412e6cc95ebe61b8cd3 --- .../remoteaccess/hal/default/Android.bp | 7 ++ .../hal/default/include/RemoteAccessService.h | 3 + .../hal/default/src/RemoteAccessService.cpp | 44 +++++++++- .../remoteaccess/hal/default/test/Android.bp | 3 + .../test/RemoteAccessServiceUnitTest.cpp | 87 ++++++++++++++++++- 5 files changed, 139 insertions(+), 5 deletions(-) diff --git a/automotive/remoteaccess/hal/default/Android.bp b/automotive/remoteaccess/hal/default/Android.bp index 250207983a..51be330331 100644 --- a/automotive/remoteaccess/hal/default/Android.bp +++ b/automotive/remoteaccess/hal/default/Android.bp @@ -36,6 +36,9 @@ cc_binary { "libgrpc++", "libprotobuf-cpp-full", ], + defaults: [ + "vhalclient_defaults", + ], cflags: [ "-Wno-unused-parameter", "-DGRPC_SERVICE_ADDRESS=\"localhost:50051\"", @@ -53,6 +56,10 @@ cc_library { whole_static_libs: [ "android.hardware.automotive.remoteaccess-V1-ndk", "wakeup_client_protos", + "libvhalclient", + ], + defaults: [ + "vhalclient_defaults", ], shared_libs: [ "libbase", diff --git a/automotive/remoteaccess/hal/default/include/RemoteAccessService.h b/automotive/remoteaccess/hal/default/include/RemoteAccessService.h index 207c09369f..74c2af4c9f 100644 --- a/automotive/remoteaccess/hal/default/include/RemoteAccessService.h +++ b/automotive/remoteaccess/hal/default/include/RemoteAccessService.h @@ -16,6 +16,7 @@ #pragma once +#include #include #include #include @@ -102,6 +103,8 @@ class RemoteAccessService void runTaskLoop(); void maybeStartTaskLoop(); void maybeStopTaskLoop(); + ndk::ScopedAStatus getDeviceIdWithClient( + android::frameworks::automotive::vhal::IVhalClient& client, std::string* deviceId); void setRetryWaitInMs(size_t retryWaitInMs) { mRetryWaitInMs = retryWaitInMs; } void dumpHelp(int fd); diff --git a/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp b/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp index cc8b50cb67..72f37d78b2 100644 --- a/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp +++ b/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp @@ -16,6 +16,8 @@ #include "RemoteAccessService.h" +#include +#include #include #include #include @@ -33,9 +35,12 @@ namespace { using ::aidl::android::hardware::automotive::remoteaccess::ApState; using ::aidl::android::hardware::automotive::remoteaccess::IRemoteTaskCallback; +using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; using ::android::base::ScopedLockAssertion; using ::android::base::StringAppendF; using ::android::base::StringPrintf; +using ::android::frameworks::automotive::vhal::IVhalClient; +using ::android::hardware::automotive::vehicle::toInt; using ::grpc::ClientContext; using ::grpc::ClientReaderInterface; using ::grpc::Status; @@ -47,6 +52,7 @@ constexpr char COMMAND_SET_AP_STATE[] = "--set-ap-state"; constexpr char COMMAND_START_DEBUG_CALLBACK[] = "--start-debug-callback"; constexpr char COMMAND_STOP_DEBUG_CALLBACK[] = "--stop-debug-callback"; constexpr char COMMAND_SHOW_TASK[] = "--show-task"; +constexpr char COMMAND_GET_DEVICE_ID[] = "--get-device-id"; std::vector stringToBytes(const std::string& s) { const char* data = s.data(); @@ -70,6 +76,10 @@ bool checkBoolFlag(const char* flag) { return !strcmp(flag, "1") || !strcmp(flag, "0"); } +void dprintErrorStatus(int fd, const char* detail, const ScopedAStatus& status) { + dprintf(fd, "%s, code: %d, error: %s\n", detail, status.getStatus(), status.getMessage()); +} + } // namespace RemoteAccessService::RemoteAccessService(WakeupClient::StubInterface* grpcStub) @@ -164,7 +174,25 @@ void RemoteAccessService::runTaskLoop() { } ScopedAStatus RemoteAccessService::getDeviceId(std::string* deviceId) { - // TODO(b/241483300): Call VHAL to get VIN. + auto vhalClient = IVhalClient::tryCreate(); + if (vhalClient == nullptr) { + ALOGE("Failed to connect to VHAL"); + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + /*errorCode=*/0, "Failed to connect to VHAL to get device ID"); + } + return getDeviceIdWithClient(*vhalClient.get(), deviceId); +} + +ScopedAStatus RemoteAccessService::getDeviceIdWithClient(IVhalClient& vhalClient, + std::string* deviceId) { + auto result = vhalClient.getValueSync( + *vhalClient.createHalPropValue(toInt(VehicleProperty::INFO_VIN))); + if (!result.ok()) { + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + /*errorCode=*/0, + ("failed to get INFO_VIN from VHAL: " + result.error().message()).c_str()); + } + *deviceId = (*result)->getStringValue(); return ScopedAStatus::ok(); } @@ -216,7 +244,8 @@ void RemoteAccessService::dumpHelp(int fd) { COMMAND_START_DEBUG_CALLBACK + " Start a debug callback that will record the received tasks\n" + COMMAND_STOP_DEBUG_CALLBACK + " Stop the debug callback\n" + COMMAND_SHOW_TASK + - " Show tasks received by debug callback\n") + " Show tasks received by debug callback\n" + COMMAND_GET_DEVICE_ID + + " Get device id\n") .c_str()); } @@ -258,8 +287,7 @@ binder_status_t RemoteAccessService::dump(int fd, const char** args, uint32_t nu } auto status = notifyApStateChange(apState); if (!status.isOk()) { - dprintf(fd, "Failed to set AP state, code: %d, error: %s\n", status.getStatus(), - status.getMessage()); + dprintErrorStatus(fd, "Failed to set AP state", status); } else { dprintf(fd, "successfully set the new AP state\n"); } @@ -280,6 +308,14 @@ binder_status_t RemoteAccessService::dump(int fd, const char** args, uint32_t nu dprintf(fd, "Debug callback is not currently used, use \"%s\" first.\n", COMMAND_START_DEBUG_CALLBACK); } + } else if (!strcmp(args[0], COMMAND_GET_DEVICE_ID)) { + std::string deviceId; + auto status = getDeviceId(&deviceId); + if (!status.isOk()) { + dprintErrorStatus(fd, "Failed to get device ID", status); + } else { + dprintf(fd, "Device Id: %s\n", deviceId.c_str()); + } } else { dumpHelp(fd); } diff --git a/automotive/remoteaccess/hal/default/test/Android.bp b/automotive/remoteaccess/hal/default/test/Android.bp index bf7d0b6b43..227175a611 100644 --- a/automotive/remoteaccess/hal/default/test/Android.bp +++ b/automotive/remoteaccess/hal/default/test/Android.bp @@ -37,6 +37,9 @@ cc_test { "libgtest", "libgmock", ], + defaults: [ + "vhalclient_defaults", + ], cflags: [ "-Wno-unused-parameter", ], diff --git a/automotive/remoteaccess/hal/default/test/RemoteAccessServiceUnitTest.cpp b/automotive/remoteaccess/hal/default/test/RemoteAccessServiceUnitTest.cpp index 11523f69db..8c4fa080eb 100644 --- a/automotive/remoteaccess/hal/default/test/RemoteAccessServiceUnitTest.cpp +++ b/automotive/remoteaccess/hal/default/test/RemoteAccessServiceUnitTest.cpp @@ -16,8 +16,11 @@ #include "RemoteAccessService.h" +#include +#include #include #include +#include #include #include #include @@ -30,10 +33,20 @@ namespace hardware { namespace automotive { namespace remoteaccess { +namespace { + using ::android::base::ScopedLockAssertion; +using ::android::frameworks::automotive::vhal::AidlHalPropValue; +using ::android::frameworks::automotive::vhal::IHalPropConfig; +using ::android::frameworks::automotive::vhal::IHalPropValue; +using ::android::frameworks::automotive::vhal::ISubscriptionCallback; +using ::android::frameworks::automotive::vhal::ISubscriptionClient; +using ::android::frameworks::automotive::vhal::IVhalClient; +using ::android::frameworks::automotive::vhal::VhalClientResult; using ::aidl::android::hardware::automotive::remoteaccess::ApState; using ::aidl::android::hardware::automotive::remoteaccess::BnRemoteTaskCallback; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; using ::grpc::ClientAsyncReaderInterface; using ::grpc::ClientAsyncResponseReaderInterface; @@ -49,6 +62,10 @@ using ::testing::DoAll; using ::testing::Return; using ::testing::SetArgPointee; +constexpr char kTestVin[] = "test_VIN"; + +} // namespace + class MockGrpcClientStub : public WakeupClient::StubInterface { public: MOCK_METHOD(ClientReaderInterface*, GetRemoteTasksRaw, @@ -73,6 +90,62 @@ class MockGrpcClientStub : public WakeupClient::StubInterface { CompletionQueue* cq)); }; +class FakeVhalClient final : public android::frameworks::automotive::vhal::IVhalClient { + public: + inline bool isAidlVhal() { return true; } + + VhalClientResult> getValueSync( + const IHalPropValue& requestValue) override { + auto propValue = std::make_unique(requestValue.getPropId()); + propValue->setStringValue(kTestVin); + return propValue; + } + + std::unique_ptr createHalPropValue(int32_t propId) override { + return std::make_unique(propId); + } + + // Functions we do not care. + std::unique_ptr createHalPropValue([[maybe_unused]] int32_t propId, + [[maybe_unused]] int32_t areaId) override { + return nullptr; + } + + void getValue([[maybe_unused]] const IHalPropValue& requestValue, + [[maybe_unused]] std::shared_ptr callback) override {} + + void setValue([[maybe_unused]] const IHalPropValue& requestValue, + [[maybe_unused]] std::shared_ptr callback) override {} + + VhalClientResult setValueSync([[maybe_unused]] const IHalPropValue& requestValue) { + return {}; + } + + VhalClientResult addOnBinderDiedCallback( + [[maybe_unused]] std::shared_ptr callback) override { + return {}; + } + + VhalClientResult removeOnBinderDiedCallback( + [[maybe_unused]] std::shared_ptr callback) override { + return {}; + } + + VhalClientResult>> getAllPropConfigs() override { + return std::vector>(); + } + + VhalClientResult>> getPropConfigs( + [[maybe_unused]] std::vector propIds) override { + return std::vector>(); + } + + std::unique_ptr getSubscriptionClient( + [[maybe_unused]] std::shared_ptr callback) override { + return nullptr; + } +}; + class FakeRemoteTaskCallback : public BnRemoteTaskCallback { public: ScopedAStatus onRemoteTaskRequested(const std::string& clientId, @@ -114,10 +187,13 @@ class RemoteAccessServiceUnitTest : public ::testing::Test { void setRetryWaitInMs(size_t retryWaitInMs) { mService->setRetryWaitInMs(retryWaitInMs); } + ScopedAStatus getDeviceIdWithClient(IVhalClient& vhalClient, std::string* deviceId) { + return mService->getDeviceIdWithClient(vhalClient, deviceId); + } + private: std::unique_ptr mGrpcWakeupClientStub; std::shared_ptr mService; - MockClientReader* mMockTaskReader; }; TEST_F(RemoteAccessServiceUnitTest, TestGetWakeupServiceName) { @@ -282,6 +358,15 @@ TEST_F(RemoteAccessServiceUnitTest, TestGetRemoteTasksNotReadyAfterReady) { std::this_thread::sleep_for(std::chrono::milliseconds(150)); } +TEST_F(RemoteAccessServiceUnitTest, testGetDeviceId) { + std::string deviceId; + + FakeVhalClient vhalClient; + + ASSERT_TRUE(getDeviceIdWithClient(vhalClient, &deviceId).isOk()); + ASSERT_EQ(deviceId, kTestVin); +} + } // namespace remoteaccess } // namespace automotive } // namespace hardware From 7ab434dc3657afb82789a7c9f940aaf2a2418e55 Mon Sep 17 00:00:00 2001 From: bodamnam Date: Tue, 4 Oct 2022 00:34:44 +0000 Subject: [PATCH 281/998] Remove onSessionChanged in ImsMedia HAL Bug: 250720912 Test: Build(mm) Change-Id: Iab5d7b74522efcb6483c8c8730971d6be9c77c54 --- .../ims/media/IImsMediaSessionListener.aidl | 1 - .../radio/ims/media/RtpSessionState.aidl | 41 ------------------- .../ims/media/IImsMediaSessionListener.aidl | 8 ---- .../radio/ims/media/RtpSessionState.aidl | 30 -------------- 4 files changed, 80 deletions(-) delete mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionState.aidl delete mode 100644 radio/aidl/android/hardware/radio/ims/media/RtpSessionState.aidl diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl index 615978089d..d515ac863f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl @@ -34,7 +34,6 @@ package android.hardware.radio.ims.media; @VintfStability interface IImsMediaSessionListener { - oneway void onSessionChanged(android.hardware.radio.ims.media.RtpSessionState state); oneway void onModifySessionResponse(in android.hardware.radio.ims.media.RtpConfig config, android.hardware.radio.ims.media.RtpError error); oneway void onAddConfigResponse(in android.hardware.radio.ims.media.RtpConfig config, android.hardware.radio.ims.media.RtpError error); oneway void onConfirmConfigResponse(in android.hardware.radio.ims.media.RtpConfig config, android.hardware.radio.ims.media.RtpError error); diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionState.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionState.aidl deleted file mode 100644 index 02bf98ae46..0000000000 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpSessionState.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2021 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 -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.hardware.radio.ims.media; -@Backing(type="int") @VintfStability -enum RtpSessionState { - OPEN = 0, - ACTIVE = 1, - SUSPENDED = 2, - CLOSED = 3, -} diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl index 317aeb798b..abf7fcd7ce 100644 --- a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl @@ -21,20 +21,12 @@ import android.hardware.radio.ims.media.MediaProtocolType; import android.hardware.radio.ims.media.RtpConfig; import android.hardware.radio.ims.media.RtpError; import android.hardware.radio.ims.media.RtpHeaderExtension; -import android.hardware.radio.ims.media.RtpSessionState; /** * Interface declaring listener functions for unsolicited IMS media notifications per session. */ @VintfStability oneway interface IImsMediaSessionListener { - /** - * Notifies whenever the session state changed. - * - * @param state RTP session state - */ - void onSessionChanged(RtpSessionState state); - /** * Notifies the result of IImsMediaSession#modifySession() API. * diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpSessionState.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpSessionState.aidl deleted file mode 100644 index 57ba69aa13..0000000000 --- a/radio/aidl/android/hardware/radio/ims/media/RtpSessionState.aidl +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2021 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.hardware.radio.ims.media; - -@VintfStability -@Backing(type="int") -enum RtpSessionState { - /** The RTP session is opened and media flow is not started */ - OPEN = 0, - /** The RTP session has active media flow */ - ACTIVE = 1, - /** The RTP session is suspended */ - SUSPENDED = 2, - /** The RTP session is closed */ - CLOSED = 3, -} From e2c6d26e25d9de7c43df05267eb16a82861d6f8c Mon Sep 17 00:00:00 2001 From: Rakesh Raghava Date: Tue, 4 Oct 2022 10:20:27 +0000 Subject: [PATCH 282/998] (ImsMedia) remove forking APIs based on vendor feedback Bug: 249806097 Test: Verified on device Change-Id: I2cf28241a64aa0ba15831ec8ffe652b4bdb85460 --- .../radio/ims/media/IImsMediaSession.aidl | 3 -- .../ims/media/IImsMediaSessionListener.aidl | 2 -- .../radio/ims/media/IImsMediaSession.aidl | 31 ------------------- .../ims/media/IImsMediaSessionListener.aidl | 24 -------------- 4 files changed, 60 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl index 7fab555606..ea9f3a4282 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSession.aidl @@ -36,9 +36,6 @@ package android.hardware.radio.ims.media; interface IImsMediaSession { oneway void setListener(in android.hardware.radio.ims.media.IImsMediaSessionListener sessionListener); oneway void modifySession(in android.hardware.radio.ims.media.RtpConfig config); - oneway void addConfig(in android.hardware.radio.ims.media.RtpConfig config); - oneway void deleteConfig(in android.hardware.radio.ims.media.RtpConfig config); - oneway void confirmConfig(in android.hardware.radio.ims.media.RtpConfig config); oneway void sendDtmf(char dtmfDigit, int duration); oneway void startDtmf(char dtmfDigit); oneway void stopDtmf(); diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl index 615978089d..f58f43de22 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl @@ -36,8 +36,6 @@ package android.hardware.radio.ims.media; interface IImsMediaSessionListener { oneway void onSessionChanged(android.hardware.radio.ims.media.RtpSessionState state); oneway void onModifySessionResponse(in android.hardware.radio.ims.media.RtpConfig config, android.hardware.radio.ims.media.RtpError error); - oneway void onAddConfigResponse(in android.hardware.radio.ims.media.RtpConfig config, android.hardware.radio.ims.media.RtpError error); - oneway void onConfirmConfigResponse(in android.hardware.radio.ims.media.RtpConfig config, android.hardware.radio.ims.media.RtpError error); oneway void onFirstMediaPacketReceived(in android.hardware.radio.ims.media.RtpConfig config); oneway void onHeaderExtensionReceived(in List extensions); oneway void notifyMediaInactivity(android.hardware.radio.ims.media.MediaProtocolType packetType); diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl index d291f4499c..a8d2161146 100644 --- a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl @@ -43,37 +43,6 @@ oneway interface IImsMediaSession { */ void modifySession(in RtpConfig config); - /** - * Adds a new remote configuration to a RTP session during early media - * scenarios where the IMS network could add more than one remote endpoint. - * - * @param config provides remote end point info and codec details - */ - void addConfig(in RtpConfig config); - - /** - * Deletes a remote configuration from a RTP session during early media - * scenarios. A session shall have at least one config so this API shall - * not delete the last config. - * - * @param config remote config to be deleted - */ - void deleteConfig(in RtpConfig config); - - /** - * Confirms a remote configuration for a Rtp session for early media scenarios - * when there are more than one remote configs. All other early remote configs - * (potentially including the config created as part of openSession) are auto - * deleted when one config is confirmed. - * Confirming a remote configuration is necessary only if additional - * configurations were created. - * New remote configurations cannot be added after a remote configuration is - * confirmed. - * - * @param config remote config to be confirmed - */ - void confirmConfig(in RtpConfig config); - /** * Send DTMF digit until the duration expires. * diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl index 317aeb798b..aa7b3c041a 100644 --- a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl @@ -47,30 +47,6 @@ oneway interface IImsMediaSessionListener { */ void onModifySessionResponse(in RtpConfig config, RtpError error); - /** - * Notifies the result of IImsMediaSession#addConfig() API. - * - * @param config The RTP config passed in IImsMediaSession#addConfig() API - * @param error RtpError.NONE in case of success else one of the following - * RtpError :INVALID_PARAM - * RtpError :INTERNAL_ERR - * RtpError :NO_MEMORY - * RtpError :NO_RESOURCES - * RtpError :PORT_UNAVAILABLE - */ - void onAddConfigResponse(in RtpConfig config, RtpError error); - - /** - * Notifies the result of IImsMediaSession#confirmConfig() API. - * - * @param config The RtpConfig passed in IImsMediaSession#confirmConfig() API - * @param error RtpError.NONE in case of success else one of the following - * RtpError :INVALID_PARAM - * RtpError :INTERNAL_ERR - * RtpError :NO_RESOURCES - */ - void onConfirmConfigResponse(in RtpConfig config, RtpError error); - /** * Indicates when the first Rtp media packet is received by the UE during ring * back, call hold or early media scenarios. This is sent only if the packet is From b4e18aa757c1cfd4ce6f1a25888c26f383cb7827 Mon Sep 17 00:00:00 2001 From: dhavalc Date: Thu, 25 Aug 2022 10:54:11 +0000 Subject: [PATCH 283/998] Added changes to use seperate payload for DTMF tx and rx Test: build (mma) Bug: 236085683 Change-Id: Ie8364d0606e06ab080ab9d0ef504b911f63cf26f --- .../hardware/radio/ims/media/DtmfParams.aidl | 3 ++- .../hardware/radio/ims/media/DtmfParams.aidl | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/DtmfParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/DtmfParams.aidl index 659fa0bfb3..5523fd87ca 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/DtmfParams.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/DtmfParams.aidl @@ -34,6 +34,7 @@ package android.hardware.radio.ims.media; @VintfStability parcelable DtmfParams { - byte payloadTypeNumber; + byte rxPayloadTypeNumber; + byte txPayloadTypeNumber; byte samplingRateKHz; } diff --git a/radio/aidl/android/hardware/radio/ims/media/DtmfParams.aidl b/radio/aidl/android/hardware/radio/ims/media/DtmfParams.aidl index ad920f2f25..a7dcb0dc94 100644 --- a/radio/aidl/android/hardware/radio/ims/media/DtmfParams.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/DtmfParams.aidl @@ -19,11 +19,21 @@ package android.hardware.radio.ims.media; @VintfStability parcelable DtmfParams { /** - * Dynamic payload type number to be used for DTMF RTP packets. The values is - * in the range from 96 to 127 chosen during the session establishment. The PT - * value of the RTP header of all DTMF packets shall be set with this value. + * Dynamic payload type number to be used for DTMF RTP packets received. + * The values is in the range from 96 to 127 chosen during the session + * establishment. The PT value of the RTP header of all DTMF packets shall be + * set with this value. */ - byte payloadTypeNumber; + byte rxPayloadTypeNumber; + + /** + * Dynamic payload type number to be used for DTMF RTP packets sent. + * The values is in the range from 96 to 127 chosen during the session + * establishment. The PT value of the RTP header of all DTMF packets shall be set + * with this value. + */ + byte txPayloadTypeNumber; + /** Sampling rate in kHz */ byte samplingRateKHz; } From 3b8da2825608efe1ca87437498eaeeb8fbf065af Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Wed, 28 Sep 2022 17:37:50 +0000 Subject: [PATCH 284/998] AIDL effect: Add effect AIDL definition Bug: 238913361 Test: atest VtsHalAudioEffectTargetTest; atest VtsHalAudioEffectFactoryTargetTest Change-Id: I8cc902df0a396d0703839b8933318a26aab2e38d --- audio/aidl/Android.bp | 8 ++ .../hardware/audio/effect/Capability.aidl | 43 +++++++ .../hardware/audio/effect/CommandId.aidl | 50 +++++++++ .../hardware/audio/effect/Descriptor.aidl | 2 + .../hardware/audio/effect/Equalizer.aidl | 46 ++++++++ .../android/hardware/audio/effect/Flags.aidl | 37 ++++++ .../hardware/audio/effect/IEffect.aidl | 18 ++- .../hardware/audio/effect/Parameter.aidl | 62 +++++++++++ .../android/hardware/audio/effect/State.aidl | 40 +++++++ .../hardware/audio/effect/Capability.aidl | 46 ++++++++ .../hardware/audio/effect/CommandId.aidl | 70 ++++++++++++ .../hardware/audio/effect/Descriptor.aidl | 16 ++- .../hardware/audio/effect/Equalizer.aidl | 47 ++++++++ .../android/hardware/audio/effect/Flags.aidl | 26 +++++ .../hardware/audio/effect/IEffect.aidl | 105 +++++++++++++++++- .../hardware/audio/effect/Parameter.aidl | 87 +++++++++++++++ .../android/hardware/audio/effect/State.aidl | 86 ++++++++++++++ .../android/hardware/audio/effect/state.gv | 36 ++++++ 18 files changed, 815 insertions(+), 10 deletions(-) create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Capability.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/CommandId.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Equalizer.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Flags.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Parameter.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/State.aidl create mode 100644 audio/aidl/android/hardware/audio/effect/Capability.aidl create mode 100644 audio/aidl/android/hardware/audio/effect/CommandId.aidl create mode 100644 audio/aidl/android/hardware/audio/effect/Equalizer.aidl create mode 100644 audio/aidl/android/hardware/audio/effect/Flags.aidl create mode 100644 audio/aidl/android/hardware/audio/effect/Parameter.aidl create mode 100644 audio/aidl/android/hardware/audio/effect/State.aidl create mode 100644 audio/aidl/android/hardware/audio/effect/state.gv diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index d6e6f50ae9..4f9af12779 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -147,11 +147,19 @@ aidl_interface { name: "android.hardware.audio.effect", vendor_available: true, srcs: [ + "android/hardware/audio/effect/Capability.aidl", + "android/hardware/audio/effect/CommandId.aidl", "android/hardware/audio/effect/Descriptor.aidl", + "android/hardware/audio/effect/Equalizer.aidl", + "android/hardware/audio/effect/Flags.aidl", "android/hardware/audio/effect/IEffect.aidl", "android/hardware/audio/effect/IFactory.aidl", + "android/hardware/audio/effect/Parameter.aidl", + "android/hardware/audio/effect/State.aidl", ], imports: [ + "android.hardware.common-V2", + "android.hardware.common.fmq-V1", "android.hardware.audio.common-V1", "android.media.audio.common.types-V2", ], diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Capability.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Capability.aidl new file mode 100644 index 0000000000..11acf5e9ed --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Capability.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +union Capability { + android.hardware.audio.effect.Capability.VendorEffectCapability vendor; + android.hardware.audio.effect.Equalizer.Capability equalizer; + @VintfStability + parcelable VendorEffectCapability { + ParcelableHolder extension; + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/CommandId.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/CommandId.aidl new file mode 100644 index 0000000000..79299eeef5 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/CommandId.aidl @@ -0,0 +1,50 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@Backing(type="int") @VintfStability +enum CommandId { + START = 0, + STOP = 1, + RESET = 2, + VENDOR_COMMAND_0 = 256, + VENDOR_COMMAND_1 = 257, + VENDOR_COMMAND_2 = 258, + VENDOR_COMMAND_3 = 259, + VENDOR_COMMAND_4 = 260, + VENDOR_COMMAND_5 = 261, + VENDOR_COMMAND_6 = 262, + VENDOR_COMMAND_7 = 263, + VENDOR_COMMAND_8 = 264, + VENDOR_COMMAND_9 = 265, +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl index 94cacd9da6..1c86cf3f3a 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl @@ -35,6 +35,7 @@ package android.hardware.audio.effect; @VintfStability parcelable Descriptor { android.hardware.audio.effect.Descriptor.Common common; + android.hardware.audio.effect.Capability capability; const String EFFECT_TYPE_UUID_ENV_REVERB = "c2e5d5f0-94bd-4763-9cac-4e234d06839e"; const String EFFECT_TYPE_UUID_PRESET_REVERB = "47382d60-ddd8-11db-bf3a-0002a5d5c51b"; const String EFFECT_TYPE_UUID_EQUALIZER = "0bed4300-ddd6-11db-8f34-0002a5d5c51b"; @@ -56,5 +57,6 @@ parcelable Descriptor { @VintfStability parcelable Common { android.hardware.audio.effect.Descriptor.Identity id; + android.hardware.audio.effect.Flags flags; } } diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Equalizer.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Equalizer.aidl new file mode 100644 index 0000000000..31732d3663 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Equalizer.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +union Equalizer { + android.hardware.audio.effect.Equalizer.VendorExtension vendor; + @VintfStability + parcelable Capability { + ParcelableHolder extension; + } + @VintfStability + parcelable VendorExtension { + ParcelableHolder extension; + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Flags.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Flags.aidl new file mode 100644 index 0000000000..af774e8d7d --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Flags.aidl @@ -0,0 +1,37 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +parcelable Flags { +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IEffect.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IEffect.aidl index 7f868ad36d..e5c96f5164 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IEffect.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IEffect.aidl @@ -34,7 +34,23 @@ package android.hardware.audio.effect; @VintfStability interface IEffect { - void open(); + android.hardware.audio.effect.IEffect.OpenEffectReturn open(in android.hardware.audio.effect.Parameter.Common common, in android.hardware.audio.effect.Parameter.Specific specific); void close(); android.hardware.audio.effect.Descriptor getDescriptor(); + void command(in android.hardware.audio.effect.CommandId commandId); + android.hardware.audio.effect.State getState(); + void setParameter(in android.hardware.audio.effect.Parameter param); + android.hardware.audio.effect.Parameter getParameter(in android.hardware.audio.effect.Parameter.Id paramId); + @FixedSize @VintfStability + parcelable Status { + int status; + int fmqByteConsumed; + int fmqByteProduced; + } + @VintfStability + parcelable OpenEffectReturn { + android.hardware.common.fmq.MQDescriptor statusMQ; + android.hardware.common.fmq.MQDescriptor inputDataMQ; + android.hardware.common.fmq.MQDescriptor outputDataMQ; + } } diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Parameter.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Parameter.aidl new file mode 100644 index 0000000000..16bd3bbd33 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Parameter.aidl @@ -0,0 +1,62 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +union Parameter { + android.hardware.audio.effect.Parameter.Common common; + android.hardware.audio.effect.Parameter.VendorEffectParameter vendorEffect; + android.hardware.audio.effect.Parameter.Specific specific; + @VintfStability + union Id { + int commonTag; + int vendorTag; + android.hardware.audio.effect.Parameter.Specific.Tag specificTag; + } + @VintfStability + parcelable Common { + int session; + int ioHandle; + android.media.audio.common.AudioDeviceDescription device; + android.media.audio.common.AudioConfig input; + android.media.audio.common.AudioConfig output; + } + @VintfStability + parcelable VendorEffectParameter { + ParcelableHolder extension; + } + @VintfStability + union Specific { + android.hardware.audio.effect.Equalizer equalizer; + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/State.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/State.aidl new file mode 100644 index 0000000000..3176b0103a --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/State.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@Backing(type="byte") @VintfStability +enum State { + INIT = 0, + IDLE = 1, + PROCESSING = 2, +} diff --git a/audio/aidl/android/hardware/audio/effect/Capability.aidl b/audio/aidl/android/hardware/audio/effect/Capability.aidl new file mode 100644 index 0000000000..e792f8652e --- /dev/null +++ b/audio/aidl/android/hardware/audio/effect/Capability.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ + +package android.hardware.audio.effect; + +import android.hardware.audio.effect.Equalizer; + +/** + * Effect capability definitions. + * This data structure is used as part of effect Descriptor to identify effect capabilities which + * not meant to change at runtime. + */ +@VintfStability +union Capability { + /** + * Vendor defined effect capability. + * This extension can be used when vendor have a new effect implementated and need + * capability definition for this new type of effect. + * If vendor want to extend existing effect capabilities, it is recommended to expose though + * the ParcelableHolder in each effect capability definition. For example: + * Equalizer.Capability.extension. + */ + @VintfStability + parcelable VendorEffectCapability { + ParcelableHolder extension; + } + VendorEffectCapability vendor; + + /** + * Equalizer capability definition. + */ + Equalizer.Capability equalizer; +} diff --git a/audio/aidl/android/hardware/audio/effect/CommandId.aidl b/audio/aidl/android/hardware/audio/effect/CommandId.aidl new file mode 100644 index 0000000000..208c1637b4 --- /dev/null +++ b/audio/aidl/android/hardware/audio/effect/CommandId.aidl @@ -0,0 +1,70 @@ +/* + * 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. + */ + +package android.hardware.audio.effect; + +/** + * Defines all commands supported by the effect instance. + * + * There are three groups of commands: + * 1. Common part which MUST be supported by all effects. + * 2. Commands MUST be supported by a specific type of effect. + * 3. Extension commands for vendor. + */ +@VintfStability +@Backing(type="int") +enum CommandId { + /// MUST be supported by all effects + /** + * Start effect engine processing. + * An effect instance must start processing data and transfer to PROCESSING state if it is in + * IDLE state and have all necessary information. Otherwise it must: + * 1. Throw a EX_ILLEGAL_STATE exception if effect is not in IDLE state, or + * 2. Throw a EX_TRANSACTION_FAILED for all other errors. + * + * Depending on parameters set to the effect instance, effect may do process or reverse + * process after START command. + */ + START = 0, + /** + * Stop effect engine processing with all resource kept. + * The currently processed audio data will be discarded if the effect engine is in PROCESSING + * state. + * Effect instance must do nothing and return ok when it receive STOP command in IDLE state. + */ + STOP = 1, + /** + * Keep all parameter settings but reset the buffer content, stop engine processing, and transit + * instance state to IDLE if its in PROCESSING state. + * Effect instance must be able to handle RESET command at IDLE and PROCESSING states. + */ + RESET = 2, + + /// MUST be supported by a specific type of effect. + // Commands must supported by Equalizer. + + /// Extension commands for vendor. + VENDOR_COMMAND_0 = 0x100, + VENDOR_COMMAND_1, + VENDOR_COMMAND_2, + VENDOR_COMMAND_3, + VENDOR_COMMAND_4, + VENDOR_COMMAND_5, + VENDOR_COMMAND_6, + VENDOR_COMMAND_7, + VENDOR_COMMAND_8, + VENDOR_COMMAND_9, +} diff --git a/audio/aidl/android/hardware/audio/effect/Descriptor.aidl b/audio/aidl/android/hardware/audio/effect/Descriptor.aidl index 51b31c2371..aca9bbe326 100644 --- a/audio/aidl/android/hardware/audio/effect/Descriptor.aidl +++ b/audio/aidl/android/hardware/audio/effect/Descriptor.aidl @@ -16,12 +16,13 @@ package android.hardware.audio.effect; +import android.hardware.audio.effect.Capability; +import android.hardware.audio.effect.Flags; import android.media.audio.common.AudioUuid; /** - * Effect descriptor contains all information (capabilities, attributes, and ownership) for an - * effect implemented in the Audio Effect HAL. Framework uses this information to decide when and - * how to apply the effect. + * Descriptor contains all information (capabilities, attributes, etc) for an effect implementation. + * The client uses this information to decide when and how to apply an effect implementation. */ @VintfStability parcelable Descriptor { @@ -77,6 +78,15 @@ parcelable Descriptor { * Identity of effect implementation. */ Identity id; + /** + * Effect engine defined capabilities/requirements flags. + */ + Flags flags; } Common common; + + /** + * Effect implementation capability. + */ + Capability capability; } diff --git a/audio/aidl/android/hardware/audio/effect/Equalizer.aidl b/audio/aidl/android/hardware/audio/effect/Equalizer.aidl new file mode 100644 index 0000000000..309874d183 --- /dev/null +++ b/audio/aidl/android/hardware/audio/effect/Equalizer.aidl @@ -0,0 +1,47 @@ +/* + * 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. + */ + +package android.hardware.audio.effect; + +import android.media.audio.common.AudioProfile; + +/** + * Equalizer specific definitions. + */ +@VintfStability +union Equalizer { + /** + * Defines Equalizer implementation capabilities, it MUST be supported by all equalizer + * implementations. + * + * Equalizer.Capability definition is used by android.hardware.audio.effect.Capability. + */ + @VintfStability + parcelable Capability { + /** + * Equalizer capability extension, vendor can use this extension in case existing capability + * definition not enough. + */ + ParcelableHolder extension; + } + + // Vendor Equalizer implementation definition for additional parameters. + @VintfStability + parcelable VendorExtension { + ParcelableHolder extension; + } + VendorExtension vendor; +} diff --git a/audio/aidl/android/hardware/audio/effect/Flags.aidl b/audio/aidl/android/hardware/audio/effect/Flags.aidl new file mode 100644 index 0000000000..8add975752 --- /dev/null +++ b/audio/aidl/android/hardware/audio/effect/Flags.aidl @@ -0,0 +1,26 @@ +/* + * 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. + */ + +package android.hardware.audio.effect; + +/** + * The common part of available capability/configuration for effects. For effect type specific + * capability, see @c android.hardware.audio.effect.Capability. + */ +@VintfStability +parcelable Flags { + // TODO: add Effect engine defined capabilities/requirements flags. +} diff --git a/audio/aidl/android/hardware/audio/effect/IEffect.aidl b/audio/aidl/android/hardware/audio/effect/IEffect.aidl index d7a9501569..9ab8b02249 100644 --- a/audio/aidl/android/hardware/audio/effect/IEffect.aidl +++ b/audio/aidl/android/hardware/audio/effect/IEffect.aidl @@ -16,24 +16,68 @@ package android.hardware.audio.effect; +import android.hardware.audio.effect.CommandId; import android.hardware.audio.effect.Descriptor; +import android.hardware.audio.effect.Parameter; +import android.hardware.audio.effect.State; +import android.hardware.common.fmq.MQDescriptor; +import android.hardware.common.fmq.SynchronizedReadWrite; /** * Effect interfaces definitions to configure and control the effect instance. */ @VintfStability interface IEffect { + @VintfStability + @FixedSize + parcelable Status { + /** + * One of Binder STATUS_* statuses: + * - STATUS_OK: the command has completed successfully; + * - STATUS_BAD_VALUE: invalid value in the 'Command' structure; + * - STATUS_INVALID_OPERATION: the mix port is not connected + * to any producer or consumer, thus + * positions can not be reported; + * - STATUS_NOT_ENOUGH_DATA: a read or write error has + * occurred for the 'audio.fmq' queue; + * + */ + int status; + /** + * The amount of bytes consumed by the effect instance. + */ + int fmqByteConsumed; + /** + * The amount of bytes produced by the effect instance. + */ + int fmqByteProduced; + } + + // Return data structure of IEffect.open() interface. + @VintfStability + parcelable OpenEffectReturn { + // Message queue for effect processing status. + MQDescriptor statusMQ; + // Message queue for input data buffer. + MQDescriptor inputDataMQ; + // Message queue for output data buffer. + MQDescriptor outputDataMQ; + } + /** - * Open an effect instance, effect should not start processing data before receive START - * command. All necessary information should be allocated and instance should transfer to IDLE - * state after open() call has been handled successfully. - * After open, the effect instance should be able to handle all IEffect interface calls. + * Open an effect instance, effect must not start processing data before receive + * CommandId::START command. All necessary information should be allocated and instance must + * transfer to State::IDLE state after open() call has been handled successfully. After open, + * the effect instance must be able to handle all IEffect interface calls. * + * @param common Parameters which MUST pass from client at open time. + * + * @throws EX_ILLEGAL_ARGUMENT if the effect instance receive unsupported command. * @throws a EX_UNSUPPORTED_OPERATION if device capability/resource is not enough or system * failure happens. * @note Open an already-opened effect instance should do nothing and should not throw an error. */ - void open(); + OpenEffectReturn open(in Parameter.Common common, in Parameter.Specific specific); /** * Called by the client to close the effect instance, processing thread should be destroyed and @@ -45,7 +89,7 @@ interface IEffect { * * Effect instance close interface should always succeed unless: * 1. The effect instance is not in a proper state to be closed, for example it's still in - * processing state. + * State::PROCESSING state. * 2. There is system/hardware related failure when close. * * @throws EX_ILLEGAL_STATE if the effect instance is not in a proper state to be closed. @@ -62,4 +106,53 @@ interface IEffect { * @return Descriptor The @c Descriptor of this effect instance. */ Descriptor getDescriptor(); + + /** + * Send a command (defined in enum CommandId) to the effect instance, instance state can be + * changed as result of command handling. + * + * Must be available for the effect instance after it has been open(). + * + * @param commandId ID of the command send to the effect instance. + * + * @throws EX_ILLEGAL_STATE if the effect instance is not in a proper state to handle the + * command. + * @throws EX_ILLEGAL_ARGUMENT if the effect instance receive unsupported command. + */ + void command(in CommandId commandId); + + /** + * Get current state of the effect instance. + * + * Must be available for the effect instance at anytime and should always succeed. + * + * @return Current effect instance state. + */ + State getState(); + + /** + * Set a parameter to the effect instance. + * + * Must be available for the effect instance after open(). + * + * @param param Parameter data to set to the effect instance. + * + * @throws EX_ILLEGAL_ARGUMENT if the effect instance receive unsupported parameter. + */ + void setParameter(in Parameter param); + + /** + * Get a parameter from the effect instance with parameter ID. + * + * This interface must return the current parameter of the effect instance, if no parameter + * has been set by client yet, the default value must be returned. + * + * Must be available for the effect instance after open(). + * + * @param paramId The tag enum of parameter to get. + * @return Parameter The parameter to get from the effect instance. + * + * @throws EX_ILLEGAL_ARGUMENT if the effect instance receive unsupported parameter tag. + */ + Parameter getParameter(in Parameter.Id paramId); } diff --git a/audio/aidl/android/hardware/audio/effect/Parameter.aidl b/audio/aidl/android/hardware/audio/effect/Parameter.aidl new file mode 100644 index 0000000000..2951660b6e --- /dev/null +++ b/audio/aidl/android/hardware/audio/effect/Parameter.aidl @@ -0,0 +1,87 @@ +/* + * 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. + */ + +package android.hardware.audio.effect; + +import android.hardware.audio.effect.Equalizer; +import android.media.audio.common.AudioConfig; +import android.media.audio.common.AudioDeviceDescription; +/** + * Defines all parameters supported by the effect instance. + * + * There are three groups of parameters: + * 1. Common parameters are essential parameters, MUST pass to effects at open() interface. + * 2. Parameters defined for a specific effect type. + * 3. Extension parameters for vendor. + * + * For all supported parameter, implementation MUST support both set and get. + */ +@VintfStability +union Parameter { + /** + * Client can pass in Parameter.Id with the corresponding tag value in IEffect.getParameter() + * call to get android.hardware.audio.effect.Parameter. + * + * As an example, if a client want to get audio.hardware.audio.effect.Specific.Equalizer, the + * value of Id should be audio.hardware.audio.effect.Parameter.Specific.equalizer. + */ + @VintfStability + union Id { + // Common parameter tag. + int commonTag; + // Vendor defined parameter tag. + int vendorTag; + // Specific effect parameter tag. + Specific.Tag specificTag; + } + + /** + * Common parameters MUST be supported by all effect implementations. + */ + @VintfStability + parcelable Common { + // Type of Audio device. + int session; + // I/O Handle. + int ioHandle; + // Type of Audio device. + AudioDeviceDescription device; + // Input config. + AudioConfig input; + // Output config. + AudioConfig output; + } + Common common; + + /** + * Parameters for vendor extension effect implementation usage. + */ + @VintfStability + parcelable VendorEffectParameter { + ParcelableHolder extension; + } + VendorEffectParameter vendorEffect; + + /** + * Parameters MUST be supported by a Specific type of effect. + */ + @VintfStability + union Specific { + Equalizer equalizer; + // TODO: add other effect definitions here + } + Specific specific; +} diff --git a/audio/aidl/android/hardware/audio/effect/State.aidl b/audio/aidl/android/hardware/audio/effect/State.aidl new file mode 100644 index 0000000000..85a4afc085 --- /dev/null +++ b/audio/aidl/android/hardware/audio/effect/State.aidl @@ -0,0 +1,86 @@ +/* + * 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. + */ + +package android.hardware.audio.effect; + +/** + * Possible states of an effect instance. + * A typical effect instance will be in INIT state when it is created with IFactory.createEffect() + * interface, transfer to IDLE after open(), and to PROCESSING after + * IEffect.command(Command.Id.START) command. When an effect instance receive STOP or RESET command, + * it should transfer to IDLE state after handle the command successfully. Effect instance should + * consume minimal resource and transfer to INIT state after it was close(). + * + * Refer to State.gv for detailed state diagram. + */ +@VintfStability +@Backing(type="byte") +enum State { + + /** + * An effect instance is in INIT state by default after it was created with + * IFactory.createEffect(). When an effect instance is in INIT state, it should have instance + * context initialized, and ready to handle IEffect.setParameter(), IEffect.open() as well as + * all getter interfaces. + * + * In INIT state, effect instance must: + * 1. Not handle any IEffect.command() and return EX_ILLEGAL_STATE with any Command.Id. + * 2. Be able to handle all parameter setting with IEffect.setParameter(). + * 3. Be able to handle all getter interface calls like IEffect.getParameter() and + * IEffect.getState(). + * 4. Be able to handle IEffect.open() successfully after configuration. + * + * Client is expected to do necessary configuration with IEffect.setParameter(), get all + * resource ready with IEffect.open(), and make sure effect instance transfer to IDLE state + * before sending commands with IEffect.command() interface. Effect instance must transfer + * from INIT to IDLE state after handle IEffect.open() call successfully. + */ + INIT, + /** + * An effect instance transfer to IDLE state after it was open successfully with IEffect.open() + * in INIT state, or after it was stop/reset with Command.Id.STOP/RESET in PROCESSING state. + * + * In IDLE state, effect instance must: + * 1. Be able to start effect processing engine with IEffect.command(Command.Id.START) call. + * 2. Be able to handle all parameter setting with IEffect.setParameter(). + * 3. Be able to handle all getter interface calls like IEffect.getParameter() and + * IEffect.getState(). + * + * The following state transfer can happen in IDLE state: + * 1. Transfer to PROCESSING if instance receive an START command and start processing data + * successfully. + * 2. Transfer to INIT if instance receive a close() call. + */ + IDLE, + /** + * An effect instance is in PROCESSING state after it receive an START command and start + * processing data successfully. Effect instance will transfer from PROCESSING to IDLE state if + * it receive an STOP or RESET command and handle the command successfully. + * + * When an instance is in PROCESSING state, client should try not to close() it directly, + * instead client should try to stop processing data first with STOP command before close(). In + * the case of a close() call received when instance in PROCESSING state, it should try to stop + * processing and transfer to IDLE first before close(). + * + * In PROCESSING state, effect instance must: + * 1. Return EX_ILLEGAL_STATE if it's not able to handle any parameter settings at runtime. + * 2. Be able to handle STOP and RESET for IEffect.command() interface, and return + * EX_ILLEGAL_STATE for all other commands. + * 3. Must be able to handle all get* interface calls like IEffect.getParameter() and + * IEffect.getState(). + */ + PROCESSING, +} diff --git a/audio/aidl/android/hardware/audio/effect/state.gv b/audio/aidl/android/hardware/audio/effect/state.gv new file mode 100644 index 0000000000..e19e6c7a1d --- /dev/null +++ b/audio/aidl/android/hardware/audio/effect/state.gv @@ -0,0 +1,36 @@ +/* + * 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. + */ + +// To render: "dot -Tpng state.gv -o state.png" +digraph effect_state_machine { + node [shape=point style=filled fillcolor=black width=0.5] I; + node [shape=doublecircle] F; + node [shape=oval width=1]; + node [fillcolor=lightgreen] INIT; + node [fillcolor=lightblue] IDLE; + node [fillcolor=lightyellow] PROCESSING; + + I -> INIT [label="IFactory.createEffect" labelfontcolor="navy"]; + INIT -> F [label="IFactory.destroyEffect"]; + INIT -> IDLE [label="open()" labelfontcolor="lime"]; + IDLE -> PROCESSING [label="command(START"]; + PROCESSING -> IDLE [label="command(STOP)\ncommand(RESET)"]; + IDLE -> INIT [label="close()"]; + + INIT -> INIT [label="getState\ngetDescriptor"]; + IDLE -> IDLE [label="getXXX\nsetParameter\ncommand(RESET)"]; + PROCESSING -> PROCESSING [label="getXXX\nsetParameter"]; +} \ No newline at end of file From bdb4be85126e7a09fcaa59471a233b968dbbf299 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Tue, 4 Oct 2022 11:02:38 +0000 Subject: [PATCH 285/998] Add isVopsSupported to EmergencyRegResult Test: build Bug: 243344927 Change-Id: Ie03f8f9924ce066fb107c8cce45c11a880908a19 --- .../android/hardware/radio/network/EmergencyRegResult.aidl | 1 + .../android/hardware/radio/network/EmergencyRegResult.aidl | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyRegResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyRegResult.aidl index af17b436f9..7d99a53c7b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyRegResult.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EmergencyRegResult.aidl @@ -37,6 +37,7 @@ parcelable EmergencyRegResult { android.hardware.radio.AccessNetwork accessNetwork; android.hardware.radio.network.RegState regState; android.hardware.radio.network.Domain emcDomain; + boolean isVopsSupported; boolean isEmcBearerSupported; byte nwProvidedEmc; byte nwProvidedEmf; diff --git a/radio/aidl/android/hardware/radio/network/EmergencyRegResult.aidl b/radio/aidl/android/hardware/radio/network/EmergencyRegResult.aidl index ec70e170ba..2215149995 100644 --- a/radio/aidl/android/hardware/radio/network/EmergencyRegResult.aidl +++ b/radio/aidl/android/hardware/radio/network/EmergencyRegResult.aidl @@ -37,6 +37,11 @@ parcelable EmergencyRegResult { */ Domain emcDomain; + /** + * This indicates whether the network supports voice over PS network. + */ + boolean isVopsSupported; + /** * This indicates if camped network support VoLTE emergency bearers. * This should only be set if the UE is in LTE mode. From d3cc1ffeaf842841a519eccb5080cb23afaf56a5 Mon Sep 17 00:00:00 2001 From: dhavalc Date: Thu, 6 Oct 2022 06:34:43 +0000 Subject: [PATCH 286/998] Added changes to move CMR from codec params to Evs Params as per vendor feedback Test: build(mm) Bug: 236357306 Change-Id: I2f162a423a1442d8af78f7ea007f45233e3241d6 --- .../android/hardware/radio/ims/media/CodecParams.aidl | 1 - .../current/android/hardware/radio/ims/media/EvsParams.aidl | 1 + .../aidl/android/hardware/radio/ims/media/CodecParams.aidl | 6 ------ radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl | 6 ++++++ 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl index b3106136e7..3da2dbd9ef 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecParams.aidl @@ -38,7 +38,6 @@ parcelable CodecParams { byte rxPayloadTypeNumber; byte txPayloadTypeNumber; byte samplingRateKHz; - byte codecModeRequest; boolean dtxEnabled; android.hardware.radio.ims.media.CodecSpecificParams codecSpecificParams; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl index bdd0a4b3d9..735eb082ab 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsParams.aidl @@ -39,4 +39,5 @@ parcelable EvsParams { byte channelAwareMode; boolean useHeaderFullOnly; boolean useEvsModeSwitch; + byte codecModeRequest; } diff --git a/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl b/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl index e0c1f6f207..0aa5505816 100644 --- a/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/CodecParams.aidl @@ -37,12 +37,6 @@ parcelable CodecParams { byte txPayloadTypeNumber; /** Sampling rate in kHz*/ byte samplingRateKHz; - /** - * cmr: Codec mode request is used to request the speech codec encoder of the - * other party to set the frame type index of speech mode via RTP header, See - * 3GPP TS 26.445 section A.3. Allowed values are -1, 0 and 1. - */ - byte codecModeRequest; /** dtx: Whether discontinuous transmission is enabled or not */ boolean dtxEnabled; /** Codec specific parameters */ diff --git a/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl b/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl index 7b420c8238..d138c8387a 100644 --- a/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/EvsParams.aidl @@ -47,4 +47,10 @@ parcelable EvsParams { * If this value is true, the codec operates in AMR-WB IO mode */ boolean useEvsModeSwitch; + /** + * cmr: Codec mode request is used to request the speech codec encoder of the + * other party to set the frame type index of speech mode via RTP header, See + * 3GPP TS 26.445 section A.3. Allowed values are -1, 0 and 1. + */ + byte codecModeRequest; } From 5b71976b68c68f7ec665c61175c090d27d34e103 Mon Sep 17 00:00:00 2001 From: Bob Badour Date: Thu, 6 Oct 2022 13:32:32 -0700 Subject: [PATCH 287/998] [LSC] Add LOCAL_LICENSE_KINDS to hardware/interfaces Added SPDX-license-identifier-Apache-2.0 to: automotive/remoteaccess/test_grpc_server/impl/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Change-Id: Ic50074db72b2c599360c77d8a93f6d6425938f83 --- automotive/remoteaccess/test_grpc_server/impl/Android.bp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/automotive/remoteaccess/test_grpc_server/impl/Android.bp b/automotive/remoteaccess/test_grpc_server/impl/Android.bp index 5332c9241f..8aab2e3dc8 100644 --- a/automotive/remoteaccess/test_grpc_server/impl/Android.bp +++ b/automotive/remoteaccess/test_grpc_server/impl/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_binary { name: "TestWakeupClientServer", vendor: true, From 4b2850f2c6102e38eebde6647d130893ce69a2c4 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Tue, 20 Sep 2022 18:52:07 -0700 Subject: [PATCH 288/998] Add fuzzer for remote access HAL. Test: m -j android.hardware.automotive.remoteaccess@V1-default-service.aidl_fuzzer cd [output_dir] adb push ./data/fuzz/x86_64 /data/fuzz/x86_64 adb shell /data/fuzz/x86_64/android.hardware.automotive.remoteaccess@V1-default-service.aidl_fuzzer/android.hardware.automotive.remoteaccess@V1-default-service.aidl_fuzzer Bug: 241483300 Change-Id: I150e4aaf33b3732586341f8c55076d4eda687876 --- .../remoteaccess/hal/default/Android.bp | 35 +++++- .../hal/default/fuzzer/fuzzer.cpp | 101 ++++++++++++++++++ .../remoteaccess/hal/default/proto/Android.bp | 4 +- .../hal/default/src/RemoteAccessService.cpp | 5 + 4 files changed, 141 insertions(+), 4 deletions(-) create mode 100644 automotive/remoteaccess/hal/default/fuzzer/fuzzer.cpp diff --git a/automotive/remoteaccess/hal/default/Android.bp b/automotive/remoteaccess/hal/default/Android.bp index 51be330331..a2bf86c9e5 100644 --- a/automotive/remoteaccess/hal/default/Android.bp +++ b/automotive/remoteaccess/hal/default/Android.bp @@ -47,7 +47,7 @@ cc_binary { cc_library { name: "RemoteAccessService", - vendor: true, + vendor_available: true, local_include_dirs: ["include"], export_include_dirs: ["include"], srcs: [ @@ -74,3 +74,36 @@ cc_library { "-Wno-unused-parameter", ], } + +cc_fuzz { + name: "android.hardware.automotive.remoteaccess@V1-default-service.aidl_fuzzer", + srcs: ["fuzzer/fuzzer.cpp"], + whole_static_libs: [ + "RemoteAccessService", + ], + static_libs: [ + "libgtest", + "libgmock", + ], + shared_libs: [ + "libbase", + "libbinder_ndk", + "liblog", + "libutils", + "libgrpc++", + "libprotobuf-cpp-full", + ], + defaults: [ + "vhalclient_defaults", + "service_fuzzer_defaults", + ], + cflags: [ + "-Wno-unused-parameter", + "-DGRPC_SERVICE_ADDRESS=\"localhost:50051\"", + ], + fuzz_config: { + cc: [ + "shanyu@google.com", + ], + }, +} diff --git a/automotive/remoteaccess/hal/default/fuzzer/fuzzer.cpp b/automotive/remoteaccess/hal/default/fuzzer/fuzzer.cpp new file mode 100644 index 0000000000..292c80e7b6 --- /dev/null +++ b/automotive/remoteaccess/hal/default/fuzzer/fuzzer.cpp @@ -0,0 +1,101 @@ +/* + * 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. + */ + +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace remoteaccess { + +using ::grpc::ClientAsyncReaderInterface; +using ::grpc::ClientAsyncResponseReaderInterface; +using ::grpc::ClientContext; +using ::grpc::ClientReader; +using ::grpc::ClientReaderInterface; +using ::grpc::CompletionQueue; +using ::grpc::Status; +using ::grpc::testing::MockClientReader; +using ::testing::_; +using ::testing::Return; + +class MockGrpcClientStub : public WakeupClient::StubInterface { + public: + ClientReaderInterface* GetRemoteTasksRaw( + [[maybe_unused]] ClientContext* context, + [[maybe_unused]] const GetRemoteTasksRequest& request) override { + MockClientReader* mockClientReader = + new MockClientReader(); + ON_CALL(*mockClientReader, Finish()).WillByDefault(Return(Status::OK)); + ON_CALL(*mockClientReader, Read(_)).WillByDefault(Return(false)); + return mockClientReader; + } + + Status NotifyWakeupRequired([[maybe_unused]] ClientContext* context, + [[maybe_unused]] const NotifyWakeupRequiredRequest& request, + [[maybe_unused]] NotifyWakeupRequiredResponse* response) { + return Status::OK; + } + + // Async methods which we do not care. + ClientAsyncReaderInterface* AsyncGetRemoteTasksRaw( + [[maybe_unused]] ClientContext* context, + [[maybe_unused]] const GetRemoteTasksRequest& request, + [[maybe_unused]] CompletionQueue* cq, [[maybe_unused]] void* tag) { + return nullptr; + } + + ClientAsyncReaderInterface* PrepareAsyncGetRemoteTasksRaw( + [[maybe_unused]] ClientContext* context, + [[maybe_unused]] const GetRemoteTasksRequest& request, + [[maybe_unused]] CompletionQueue* cq) { + return nullptr; + } + + ClientAsyncResponseReaderInterface* AsyncNotifyWakeupRequiredRaw( + [[maybe_unused]] ClientContext* context, + [[maybe_unused]] const NotifyWakeupRequiredRequest& request, + [[maybe_unused]] CompletionQueue* cq) { + return nullptr; + } + + ClientAsyncResponseReaderInterface* + PrepareAsyncNotifyWakeupRequiredRaw([[maybe_unused]] ClientContext* context, + [[maybe_unused]] const NotifyWakeupRequiredRequest& request, + [[maybe_unused]] CompletionQueue* c) { + return nullptr; + } +}; + +} // namespace remoteaccess +} // namespace automotive +} // namespace hardware +} // namespace android + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + android::hardware::automotive::remoteaccess::MockGrpcClientStub stub; + std::shared_ptr service = + ndk::SharedRefBase::make< + android::hardware::automotive::remoteaccess::RemoteAccessService>(&stub); + android::fuzzService(service->asBinder().get(), FuzzedDataProvider(data, size)); + + return 0; +} diff --git a/automotive/remoteaccess/hal/default/proto/Android.bp b/automotive/remoteaccess/hal/default/proto/Android.bp index 31b9d0ebce..3e0dba14e5 100644 --- a/automotive/remoteaccess/hal/default/proto/Android.bp +++ b/automotive/remoteaccess/hal/default/proto/Android.bp @@ -35,7 +35,6 @@ genrule { "wakeup_client.pb.h", "wakeup_client.grpc.pb.h", ], - vendor: true, } genrule { @@ -52,12 +51,11 @@ genrule { "wakeup_client.pb.cc", "wakeup_client.grpc.pb.cc", ], - vendor: true, } cc_library_static { name: "wakeup_client_protos", - vendor: true, + vendor_available: true, host_supported: true, include_dirs: [ "external/protobuf/src", diff --git a/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp b/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp index 72f37d78b2..5cd58d3bba 100644 --- a/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp +++ b/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp @@ -174,6 +174,7 @@ void RemoteAccessService::runTaskLoop() { } ScopedAStatus RemoteAccessService::getDeviceId(std::string* deviceId) { +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION auto vhalClient = IVhalClient::tryCreate(); if (vhalClient == nullptr) { ALOGE("Failed to connect to VHAL"); @@ -181,6 +182,10 @@ ScopedAStatus RemoteAccessService::getDeviceId(std::string* deviceId) { /*errorCode=*/0, "Failed to connect to VHAL to get device ID"); } return getDeviceIdWithClient(*vhalClient.get(), deviceId); +#else + // Don't use VHAL client in fuzzing since IPC is not allowed. + return ScopedAStatus::ok(); +#endif } ScopedAStatus RemoteAccessService::getDeviceIdWithClient(IVhalClient& vhalClient, From 0e966f3ef31b5bb188007795a33733ccc945efc1 Mon Sep 17 00:00:00 2001 From: Sewook Seo Date: Mon, 26 Sep 2022 19:00:35 +0000 Subject: [PATCH 289/998] Radio HAL : Support N3IWF Introduce a new RadioTechnologyFamily type (NON_3GPP) Include Radio tech family in RegStateResult to differentiate NR & N3IWF. Add getRegistrationState to differentiate response between NR & N3IWF. Add unthrottleDataProfile to differentiate unthrottle event between NR & N3IWF Bug: 249129495 Test: update-api, Android build, atest VtsHalRadioTargetTest Change-Id: I8b4b055be140afd26b453fa8d50c999ad4c19bec --- .../compatibility_matrix.current.xml | 2 +- radio/aidl/Android.bp | 28 +++--- .../radio/data/IRadioDataIndication.aidl | 4 + .../hardware/radio/network/IRadioNetwork.aidl | 7 ++ .../radio/network/IRadioNetworkResponse.aidl | 7 ++ .../hardware/radio/network/NrVopsInfo.aidl | 1 + .../radio/network/RegStateResult.aidl | 1 + .../android/hardware/radio/AccessNetwork.aidl | 5 ++ .../hardware/radio/RadioTechnologyFamily.aidl | 1 + .../android/hardware/radio/AccessNetwork.aidl | 25 ++++-- .../hardware/radio/RadioTechnologyFamily.aidl | 4 + .../radio/data/IRadioDataIndication.aidl | 17 ++++ .../hardware/radio/network/IRadioNetwork.aidl | 23 ++++- .../radio/network/IRadioNetworkResponse.aidl | 18 +++- .../hardware/radio/network/NrVopsInfo.aidl | 5 ++ .../radio/network/RegStateResult.aidl | 5 ++ radio/aidl/compat/libradiocompat/Android.bp | 3 +- .../include/libradiocompat/RadioNetwork.h | 3 + .../libradiocompat/network/RadioNetwork.cpp | 12 +++ radio/aidl/compat/service/Android.bp | 3 +- radio/aidl/vts/Android.bp | 4 +- radio/aidl/vts/radio_data_indication.cpp | 7 ++ radio/aidl/vts/radio_data_utils.h | 3 + radio/aidl/vts/radio_network_response.cpp | 8 ++ radio/aidl/vts/radio_network_test.cpp | 90 +++++++++++++++++++ radio/aidl/vts/radio_network_utils.h | 4 + 26 files changed, 258 insertions(+), 32 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index a20d15db3a..98b3fca815 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -461,7 +461,7 @@ android.hardware.radio.data - 1 + 2 IRadioData slot1 diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp index 613f31b94a..01d70cd032 100644 --- a/radio/aidl/Android.bp +++ b/radio/aidl/Android.bp @@ -36,7 +36,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/config/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V1"], + imports: ["android.hardware.radio-V2"], backend: { cpp: { enabled: true, @@ -48,7 +48,7 @@ aidl_interface { versions_with_info: [ { version: "1", - imports: ["android.hardware.radio-V1"], + imports: ["android.hardware.radio-V2"], }, ], @@ -60,7 +60,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/data/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V1"], + imports: ["android.hardware.radio-V2"], backend: { cpp: { enabled: true, @@ -72,7 +72,7 @@ aidl_interface { versions_with_info: [ { version: "1", - imports: ["android.hardware.radio-V1"], + imports: ["android.hardware.radio-V2"], }, ], @@ -84,7 +84,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/messaging/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V1"], + imports: ["android.hardware.radio-V2"], backend: { cpp: { enabled: true, @@ -96,7 +96,7 @@ aidl_interface { versions_with_info: [ { version: "1", - imports: ["android.hardware.radio-V1"], + imports: ["android.hardware.radio-V2"], }, ], @@ -108,7 +108,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/modem/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V1"], + imports: ["android.hardware.radio-V2"], backend: { cpp: { enabled: true, @@ -120,7 +120,7 @@ aidl_interface { versions_with_info: [ { version: "1", - imports: ["android.hardware.radio-V1"], + imports: ["android.hardware.radio-V2"], }, ], @@ -132,7 +132,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/network/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V1"], + imports: ["android.hardware.radio-V2"], backend: { cpp: { enabled: true, @@ -144,7 +144,7 @@ aidl_interface { versions_with_info: [ { version: "1", - imports: ["android.hardware.radio-V1"], + imports: ["android.hardware.radio-V2"], }, ], @@ -157,7 +157,7 @@ aidl_interface { srcs: ["android/hardware/radio/sim/*.aidl"], stability: "vintf", imports: [ - "android.hardware.radio-V1", + "android.hardware.radio-V2", "android.hardware.radio.config", ], backend: { @@ -172,7 +172,7 @@ aidl_interface { { version: "1", imports: [ - "android.hardware.radio-V1", + "android.hardware.radio-V2", "android.hardware.radio.config-V1", ], }, @@ -186,7 +186,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/voice/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V1"], + imports: ["android.hardware.radio-V2"], backend: { cpp: { enabled: true, @@ -198,7 +198,7 @@ aidl_interface { versions_with_info: [ { version: "1", - imports: ["android.hardware.radio-V1"], + imports: ["android.hardware.radio-V2"], }, ], diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioDataIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioDataIndication.aidl index 0ffa1f7ddf..5983afe6d6 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioDataIndication.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioDataIndication.aidl @@ -37,6 +37,10 @@ interface IRadioDataIndication { oneway void dataCallListChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.data.SetupDataCallResult[] dcList); oneway void keepaliveStatus(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.data.KeepaliveStatus status); oneway void pcoData(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.data.PcoDataInfo pco); + /** + * @deprecated use unthrottleDataProfile to clarify access network for this event. + */ oneway void unthrottleApn(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.data.DataProfileInfo dataProfileInfo); oneway void slicingConfigChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.data.SlicingConfig slicingConfig); + oneway void unthrottleDataProfile(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.AccessNetwork accessNetwork, in android.hardware.radio.data.DataProfileInfo dataProfileInfo); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl index 832738ffbf..3b0c5e0ab7 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl @@ -40,6 +40,9 @@ interface IRadioNetwork { oneway void getBarringInfo(in int serial); oneway void getCdmaRoamingPreference(in int serial); oneway void getCellInfoList(in int serial); + /** + * @deprecated use getRegistrationState() + */ oneway void getDataRegistrationState(in int serial); oneway void getImsRegistrationState(in int serial); oneway void getNetworkSelectionMode(in int serial); @@ -47,6 +50,9 @@ interface IRadioNetwork { oneway void getSignalStrength(in int serial); oneway void getSystemSelectionChannels(in int serial); oneway void getVoiceRadioTechnology(in int serial); + /** + * @deprecated use getRegistrationState() + */ oneway void getVoiceRegistrationState(in int serial); oneway void isNrDualConnectivityEnabled(in int serial); oneway void responseAcknowledgement(); @@ -74,4 +80,5 @@ interface IRadioNetwork { oneway void triggerEmergencyNetworkScan(int serial, in android.hardware.radio.network.EmergencyNetworkScanTrigger request); oneway void cancelEmergencyNetworkScan(in int serial); oneway void exitEmergencyMode(in int serial); + oneway void getRegistrationState(in int serial, in android.hardware.radio.RadioTechnologyFamily ratFamily, in android.hardware.radio.network.Domain domain); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl index 24d587e655..228451f388 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -41,6 +41,9 @@ interface IRadioNetworkResponse { oneway void getBarringInfoResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.CellIdentity cellIdentity, in android.hardware.radio.network.BarringInfo[] barringInfos); oneway void getCdmaRoamingPreferenceResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.CdmaRoamingType type); oneway void getCellInfoListResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.CellInfo[] cellInfo); + /** + * @deprecated use getRegistrationStateResponse() + */ oneway void getDataRegistrationStateResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.RegStateResult dataRegResponse); oneway void getImsRegistrationStateResponse(in android.hardware.radio.RadioResponseInfo info, in boolean isRegistered, in android.hardware.radio.RadioTechnologyFamily ratFamily); oneway void getNetworkSelectionModeResponse(in android.hardware.radio.RadioResponseInfo info, in boolean manual); @@ -48,6 +51,9 @@ interface IRadioNetworkResponse { oneway void getSignalStrengthResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.SignalStrength signalStrength); oneway void getSystemSelectionChannelsResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.RadioAccessSpecifier[] specifiers); oneway void getVoiceRadioTechnologyResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.RadioTechnology rat); + /** + * @deprecated use getRegistrationStateResponse() + */ oneway void getVoiceRegistrationStateResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.RegStateResult voiceRegResponse); oneway void isNrDualConnectivityEnabledResponse(in android.hardware.radio.RadioResponseInfo info, in boolean isEnabled); oneway void setAllowedNetworkTypesBitmapResponse(in android.hardware.radio.RadioResponseInfo info); @@ -73,4 +79,5 @@ interface IRadioNetworkResponse { oneway void triggerEmergencyNetworkScanResponse(in android.hardware.radio.RadioResponseInfo info); oneway void exitEmergencyModeResponse(in android.hardware.radio.RadioResponseInfo info); oneway void cancelEmergencyNetworkScanResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void getRegistrationStateResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.RegStateResult regResponse); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrVopsInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrVopsInfo.aidl index e5a0a700ca..0b2d73331b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrVopsInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrVopsInfo.aidl @@ -41,6 +41,7 @@ parcelable NrVopsInfo { const byte EMC_INDICATOR_NR_CONNECTED_TO_5GCN = 1; const byte EMC_INDICATOR_EUTRA_CONNECTED_TO_5GCN = 2; const byte EMC_INDICATOR_BOTH_NR_EUTRA_CONNECTED_TO_5GCN = 3; + const byte EMC_INDICATOR_EMC_OVER_NON_3GPP = 4; const byte EMF_INDICATOR_NOT_SUPPORTED = 0; const byte EMF_INDICATOR_NR_CONNECTED_TO_5GCN = 1; const byte EMF_INDICATOR_EUTRA_CONNECTED_TO_5GCN = 2; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegStateResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegStateResult.aidl index f0a03aea4f..c1e5c8d40b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegStateResult.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegStateResult.aidl @@ -40,4 +40,5 @@ parcelable RegStateResult { android.hardware.radio.network.CellIdentity cellIdentity; String registeredPlmn; android.hardware.radio.network.AccessTechnologySpecificInfo accessTechnologySpecificInfo; + android.hardware.radio.AccessNetwork accessNetwork = android.hardware.radio.AccessNetwork.UNKNOWN; } diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/AccessNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/AccessNetwork.aidl index 8ce689f501..4a53a6d2d8 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/AccessNetwork.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/AccessNetwork.aidl @@ -39,6 +39,11 @@ enum AccessNetwork { UTRAN = 2, EUTRAN = 3, CDMA2000 = 4, + /** + * @deprecated should use N3ANEPS or N3AN5GS based on N3AN selection. + */ IWLAN = 5, NGRAN = 6, + N3ANEPS = 5, + N3AN5GS = 7, } diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnologyFamily.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnologyFamily.aidl index e6fdce269d..5a8f4038e2 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnologyFamily.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnologyFamily.aidl @@ -36,4 +36,5 @@ package android.hardware.radio; enum RadioTechnologyFamily { THREE_GPP = 0, THREE_GPP2 = 1, + NON_3GPP = 2, } diff --git a/radio/aidl/android/hardware/radio/AccessNetwork.aidl b/radio/aidl/android/hardware/radio/AccessNetwork.aidl index 2885642e83..b85143d4f4 100644 --- a/radio/aidl/android/hardware/radio/AccessNetwork.aidl +++ b/radio/aidl/android/hardware/radio/AccessNetwork.aidl @@ -23,30 +23,39 @@ enum AccessNetwork { /** * Unknown access network */ - UNKNOWN, + UNKNOWN = 0, /** * GSM EDGE Radio Access Network */ - GERAN, + GERAN = 1, /** * Universal Terrestrial Radio Access Network */ - UTRAN, + UTRAN = 2, /** * Evolved Universal Terrestrial Radio Access Network */ - EUTRAN, + EUTRAN = 3, /** * CDMA 2000 network */ - CDMA2000, + CDMA2000 = 4, /** - * Interworking Wireless LAN + * Interworking Wireless LAN. + * @deprecated should use N3ANEPS or N3AN5GS based on N3AN selection. */ - IWLAN, + IWLAN = 5, /** * Next-Generation Radio Access Network (NGRAN). * Note NGRAN is only for standalone mode. Non-standalone mode uses AccessNetwork EUTRAN. */ - NGRAN, + NGRAN = 6, + /** + * Non-3GPP Access Network for EPS. + */ + N3ANEPS = 5, + /** + * Non-3GPP Access Network for 5GS. + */ + N3AN5GS = 7, } diff --git a/radio/aidl/android/hardware/radio/RadioTechnologyFamily.aidl b/radio/aidl/android/hardware/radio/RadioTechnologyFamily.aidl index a2b989d18d..4f4bbcb90d 100644 --- a/radio/aidl/android/hardware/radio/RadioTechnologyFamily.aidl +++ b/radio/aidl/android/hardware/radio/RadioTechnologyFamily.aidl @@ -28,4 +28,8 @@ enum RadioTechnologyFamily { * 3GPP2 Technologies - CDMA */ THREE_GPP2, + /** + * Non 3GPP Technologies - IWLAN, N3IWF + */ + NON_3GPP, } diff --git a/radio/aidl/android/hardware/radio/data/IRadioDataIndication.aidl b/radio/aidl/android/hardware/radio/data/IRadioDataIndication.aidl index 938c695fd4..b2e6ca420e 100644 --- a/radio/aidl/android/hardware/radio/data/IRadioDataIndication.aidl +++ b/radio/aidl/android/hardware/radio/data/IRadioDataIndication.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.data; +import android.hardware.radio.AccessNetwork; import android.hardware.radio.RadioIndicationType; import android.hardware.radio.data.DataProfileInfo; import android.hardware.radio.data.KeepaliveStatus; @@ -71,6 +72,7 @@ oneway interface IRadioDataIndication { * * @param type Type of radio indication * @param dataProfileInfo Data profile info. + * @deprecated use unthrottleDataProfile to clarify access network for this event. */ void unthrottleApn(in RadioIndicationType type, in DataProfileInfo dataProfileInfo); @@ -86,4 +88,19 @@ oneway interface IRadioDataIndication { * */ void slicingConfigChanged(in RadioIndicationType type, in SlicingConfig slicingConfig); + + /** + * The modem can explicitly set SetupDataCallResult::suggestedRetryTime after a failure in + * IRadioData.SetupDataCall. During that time, no new calls are allowed to + * IRadioData.SetupDataCall that use the same APN(or DNN) in DataProfile. + * When IRadioDataIndication.unthrottleDataProfile is sent, AOSP will no longer throttle calls + * to IRadioData.SetupDataCall for the given APN(or DNN) in DataProfile. + * + * @param type Type of radio indication + * @param accessNetwork Access network this throttling occurred, this must match the access + * network passed in setup data call request. + * @param dataProfileInfo Data profile info. + */ + void unthrottleDataProfile(in RadioIndicationType type, in AccessNetwork accessNetwork, + in DataProfileInfo dataProfileInfo); } diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl index 0ac8b0e83e..c82fde29ef 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl @@ -17,7 +17,11 @@ package android.hardware.radio.network; import android.hardware.radio.AccessNetwork; +import android.hardware.radio.RadioTechnologyFamily; import android.hardware.radio.network.CdmaRoamingType; +import android.hardware.radio.network.Domain; +import android.hardware.radio.network.EmergencyMode; +import android.hardware.radio.network.EmergencyNetworkScanTrigger; import android.hardware.radio.network.IRadioNetworkIndication; import android.hardware.radio.network.IRadioNetworkResponse; import android.hardware.radio.network.IndicationFilter; @@ -27,8 +31,6 @@ import android.hardware.radio.network.RadioAccessSpecifier; import android.hardware.radio.network.RadioBandMode; import android.hardware.radio.network.SignalThresholdInfo; import android.hardware.radio.network.UsageSetting; -import android.hardware.radio.network.EmergencyNetworkScanTrigger; -import android.hardware.radio.network.EmergencyMode; /** * This interface is used by telephony and telecom to talk to cellular radio for network APIs. @@ -103,6 +105,7 @@ oneway interface IRadioNetwork { * @param serial Serial number of request. * * Response function is IRadioNetworkResponse.getDataRegistrationStateResponse() + * @deprecated use getRegistrationState() */ void getDataRegistrationState(in int serial); @@ -167,6 +170,7 @@ oneway interface IRadioNetwork { * @param serial Serial number of request. * * Response function is IRadioNetworkResponse.getVoiceRegistrationStateResponse() + * @deprecated use getRegistrationState() */ void getVoiceRegistrationState(in int serial); @@ -449,7 +453,7 @@ oneway interface IRadioNetwork { * * Response function is IRadioEmergencyResponse.setEmergencyModeResponse() */ - void setEmergencyMode(int serial, in EmergencyMode emcModeType ); + void setEmergencyMode(int serial, in EmergencyMode emcModeType); /** * Triggers an Emergency network scan. @@ -460,7 +464,7 @@ oneway interface IRadioNetwork { * * Response function is IRadioEmergencyResponse.triggerEmergencyNetworkScanResponse() */ - void triggerEmergencyNetworkScan( int serial, in EmergencyNetworkScanTrigger request); + void triggerEmergencyNetworkScan(int serial, in EmergencyNetworkScanTrigger request); /** * Cancels ongoing Emergency network scan @@ -479,4 +483,15 @@ oneway interface IRadioNetwork { * Response function is IRadioEmergencyResponse.exitEmergencyModeResponse() */ void exitEmergencyMode(in int serial); + + /** + * Request current registration state. + * + * @param serial Serial number of request. + * @param ratFamily RadioTechnologyFamily of request. + * @param domain Domain PS or CS of request. + * + * Response function is IRadioNetworkResponse.getRegistrationStateResponse() + */ + void getRegistrationState(in int serial, in RadioTechnologyFamily ratFamily, in Domain domain); } diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl index 243e949b9e..69d53ee81a 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -23,13 +23,13 @@ import android.hardware.radio.network.BarringInfo; import android.hardware.radio.network.CdmaRoamingType; import android.hardware.radio.network.CellIdentity; import android.hardware.radio.network.CellInfo; +import android.hardware.radio.network.EmergencyRegResult; import android.hardware.radio.network.OperatorInfo; import android.hardware.radio.network.RadioAccessSpecifier; import android.hardware.radio.network.RadioBandMode; import android.hardware.radio.network.RegStateResult; import android.hardware.radio.network.SignalStrength; import android.hardware.radio.network.UsageSetting; -import android.hardware.radio.network.EmergencyRegResult; /** * Interface declaring response functions to solicited radio requests for network APIs. @@ -153,6 +153,8 @@ oneway interface IRadioNetworkResponse { * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR * RadioError:NOT_PROVISIONED + * + * @deprecated use getRegistrationStateResponse() */ void getDataRegistrationStateResponse( in RadioResponseInfo info, in RegStateResult dataRegResponse); @@ -259,6 +261,8 @@ oneway interface IRadioNetworkResponse { * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR + * + * @deprecated use getRegistrationStateResponse() */ void getVoiceRegistrationStateResponse( in RadioResponseInfo info, in RegStateResult voiceRegResponse); @@ -616,4 +620,16 @@ oneway interface IRadioNetworkResponse { * RadioError:MODEM_ERR */ void cancelEmergencyNetworkScanResponse(in RadioResponseInfo info); + + /** + * @param info Response info struct containing response type, serial no. and error + * @param regResponse Current registration response as defined by RegStateResult + * + * Valid errors returned: + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:INTERNAL_ERR + * RadioError:NOT_PROVISIONED + */ + void getRegistrationStateResponse(in RadioResponseInfo info, in RegStateResult regResponse); } diff --git a/radio/aidl/android/hardware/radio/network/NrVopsInfo.aidl b/radio/aidl/android/hardware/radio/network/NrVopsInfo.aidl index 197f401e7e..2b0b7c9478 100644 --- a/radio/aidl/android/hardware/radio/network/NrVopsInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/NrVopsInfo.aidl @@ -39,6 +39,10 @@ parcelable NrVopsInfo { * Emergency services supported in NR connected to 5GCN and E-UTRA connected to 5GCN */ const byte EMC_INDICATOR_BOTH_NR_EUTRA_CONNECTED_TO_5GCN = 3; + /** + * Emergency services supported over 5G N3GPP access. + */ + const byte EMC_INDICATOR_EMC_OVER_NON_3GPP = 4; /** * Emergency services fallback not supported @@ -96,6 +100,7 @@ parcelable NrVopsInfo { * NR REGISTRATION ACCEPT. * Refer 3GPP 24.501 EPS 5GS network feature support -> EMF * Values are EMF_INDICATOR_ from TS 24.501 sec 9.10.3.5. + * Not Applicable for the registration via non-3GPP access. */ byte emfSupported; } diff --git a/radio/aidl/android/hardware/radio/network/RegStateResult.aidl b/radio/aidl/android/hardware/radio/network/RegStateResult.aidl index 3d96b8cbf2..979b4b84b5 100644 --- a/radio/aidl/android/hardware/radio/network/RegStateResult.aidl +++ b/radio/aidl/android/hardware/radio/network/RegStateResult.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.network; +import android.hardware.radio.AccessNetwork; import android.hardware.radio.RadioTechnology; import android.hardware.radio.network.AccessTechnologySpecificInfo; import android.hardware.radio.network.CellIdentity; @@ -59,4 +60,8 @@ parcelable RegStateResult { * Access-technology-specific registration information, such as for CDMA2000. */ AccessTechnologySpecificInfo accessTechnologySpecificInfo; + /** + * Indicates the access network used for this registration. + */ + AccessNetwork accessNetwork = AccessNetwork.UNKNOWN; } diff --git a/radio/aidl/compat/libradiocompat/Android.bp b/radio/aidl/compat/libradiocompat/Android.bp index f79e045f63..2f7fc59c60 100644 --- a/radio/aidl/compat/libradiocompat/Android.bp +++ b/radio/aidl/compat/libradiocompat/Android.bp @@ -31,12 +31,13 @@ cc_library { "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION", ], shared_libs: [ + "android.hardware.radio-V2-ndk", "android.hardware.radio.config-V1-ndk", "android.hardware.radio.config@1.0", "android.hardware.radio.config@1.1", "android.hardware.radio.config@1.2", "android.hardware.radio.config@1.3", - "android.hardware.radio.data-V1-ndk", + "android.hardware.radio.data-V2-ndk", "android.hardware.radio.messaging-V1-ndk", "android.hardware.radio.modem-V1-ndk", "android.hardware.radio.network-V2-ndk", diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h index c714190153..c8862678f3 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h @@ -99,6 +99,9 @@ class RadioNetwork : public RadioCompatBase, scanTrigger) override; ::ndk::ScopedAStatus cancelEmergencyNetworkScan(int32_t serial) override; ::ndk::ScopedAStatus exitEmergencyMode(int32_t serial) override; + ::ndk::ScopedAStatus getRegistrationState( + int32_t serial, ::aidl::android::hardware::radio::RadioTechnologyFamily ratFamily, + ::aidl::android::hardware::radio::network::Domain domain) override; protected: std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse> respond(); diff --git a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp index ff30ac3633..638b34ebd6 100644 --- a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp +++ b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp @@ -340,4 +340,16 @@ ScopedAStatus RadioNetwork::exitEmergencyMode(int32_t serial) { return ok(); } +ScopedAStatus RadioNetwork::getRegistrationState( + int32_t serial, ::aidl::android::hardware::radio::RadioTechnologyFamily ratFamily, + aidl::Domain domain) { + LOG_CALL << serial; + if (ratFamily == ::aidl::android::hardware::radio::RadioTechnologyFamily::THREE_GPP && + domain == aidl::Domain::PS) { + LOG_CALL << " Radio Technology Family 3GPP and Domain PS"; + } + LOG(ERROR) << " geRegistrationState is unsupported by HIDL HALs"; + respond()->getRegistrationStateResponse(notSupported(serial), {}); + return ok(); +} } // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/service/Android.bp b/radio/aidl/compat/service/Android.bp index 4dbaef4e71..45a34976a8 100644 --- a/radio/aidl/compat/service/Android.bp +++ b/radio/aidl/compat/service/Android.bp @@ -34,12 +34,13 @@ cc_binary { ], shared_libs: [ "android.hardware.radio-library.compat", + "android.hardware.radio-V2-ndk", "android.hardware.radio.config-V1-ndk", "android.hardware.radio.config@1.0", "android.hardware.radio.config@1.1", "android.hardware.radio.config@1.2", "android.hardware.radio.config@1.3", - "android.hardware.radio.data-V1-ndk", + "android.hardware.radio.data-V2-ndk", "android.hardware.radio.messaging-V1-ndk", "android.hardware.radio.modem-V1-ndk", "android.hardware.radio.network-V2-ndk", diff --git a/radio/aidl/vts/Android.bp b/radio/aidl/vts/Android.bp index 0d4bb3eddf..ba68728768 100644 --- a/radio/aidl/vts/Android.bp +++ b/radio/aidl/vts/Android.bp @@ -63,9 +63,9 @@ cc_test { "libvintf", ], static_libs: [ - "android.hardware.radio-V1-ndk", + "android.hardware.radio-V2-ndk", "android.hardware.radio.config-V1-ndk", - "android.hardware.radio.data-V1-ndk", + "android.hardware.radio.data-V2-ndk", "android.hardware.radio.messaging-V1-ndk", "android.hardware.radio.modem-V1-ndk", "android.hardware.radio.network-V2-ndk", diff --git a/radio/aidl/vts/radio_data_indication.cpp b/radio/aidl/vts/radio_data_indication.cpp index 61e079e532..213505d4cb 100644 --- a/radio/aidl/vts/radio_data_indication.cpp +++ b/radio/aidl/vts/radio_data_indication.cpp @@ -42,3 +42,10 @@ ndk::ScopedAStatus RadioDataIndication::slicingConfigChanged( RadioIndicationType /*type*/, const SlicingConfig& /*slicingConfig*/) { return ndk::ScopedAStatus::ok(); } + +ndk::ScopedAStatus RadioDataIndication::unthrottleDataProfile( + RadioIndicationType /*type*/, + ::aidl::android::hardware::radio::AccessNetwork /*accessNetwork*/, + const DataProfileInfo& /*dataProfileInfo*/) { + return ndk::ScopedAStatus::ok(); +} diff --git a/radio/aidl/vts/radio_data_utils.h b/radio/aidl/vts/radio_data_utils.h index fb91ef61d5..cfb2ab2a4e 100644 --- a/radio/aidl/vts/radio_data_utils.h +++ b/radio/aidl/vts/radio_data_utils.h @@ -97,6 +97,9 @@ class RadioDataIndication : public BnRadioDataIndication { const DataProfileInfo& dataProfile) override; virtual ndk::ScopedAStatus slicingConfigChanged(RadioIndicationType type, const SlicingConfig& slicingConfig) override; + virtual ndk::ScopedAStatus unthrottleDataProfile( + RadioIndicationType type, ::aidl::android::hardware::radio::AccessNetwork accessNetwork, + const DataProfileInfo& dataProfile) override; }; // The main test class for Radio AIDL Data. diff --git a/radio/aidl/vts/radio_network_response.cpp b/radio/aidl/vts/radio_network_response.cpp index 5599c0332f..ff58ecd3cd 100644 --- a/radio/aidl/vts/radio_network_response.cpp +++ b/radio/aidl/vts/radio_network_response.cpp @@ -293,3 +293,11 @@ ndk::ScopedAStatus RadioNetworkResponse::cancelEmergencyNetworkScanResponse( parent_network.notify(info.serial); return ndk::ScopedAStatus::ok(); } + +ndk::ScopedAStatus RadioNetworkResponse::getRegistrationStateResponse( + const RadioResponseInfo& info, const RegStateResult& regResponse) { + rspInfo = info; + regResp = regResponse; + parent_network.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index 25c42d35b2..054b69ef1f 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -15,7 +15,9 @@ */ #include +#include #include +#include #include #include #include @@ -1911,3 +1913,91 @@ TEST_P(RadioNetworkTest, exitEmergencyMode) { {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); LOG(DEBUG) << "exitEmergencyMode finished"; } + +/* + * Test IRadioNetwork.getRegistrationState() for the response returned. + */ +TEST_P(RadioNetworkTest, getRegistrationState) { + serial = GetRandomSerialNumber(); + + ndk::ScopedAStatus res = radio_network->getRegistrationState( + serial, RadioTechnologyFamily::THREE_GPP, Domain::PS); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); + + ALOGI("getRegistrationStateResponse, rspInfo.error = %s\n", + toString(radioRsp_network->rspInfo.error).c_str()); + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::NOT_PROVISIONED})); + // Check the mcc [0, 999] and mnc [0, 999]. + std::string mcc; + std::string mnc; + bool checkMccMnc = true; + CellIdentity cellIdentity = radioRsp_network->regResp.cellIdentity; + switch (cellIdentity.getTag()) { + case CellIdentity::noinit: { + checkMccMnc = false; + break; + } + case CellIdentity::gsm: { + CellIdentityGsm cig = cellIdentity.get(); + mcc = cig.mcc; + mnc = cig.mnc; + break; + } + case CellIdentity::wcdma: { + CellIdentityWcdma ciw = cellIdentity.get(); + mcc = ciw.mcc; + mnc = ciw.mnc; + break; + } + case CellIdentity::tdscdma: { + CellIdentityTdscdma cit = cellIdentity.get(); + mcc = cit.mcc; + mnc = cit.mnc; + break; + } + case CellIdentity::cdma: { + // CellIdentityCdma has no mcc/mnc + CellIdentityCdma cic = cellIdentity.get(); + checkMccMnc = false; + break; + } + case CellIdentity::lte: { + CellIdentityLte cil = cellIdentity.get(); + mcc = cil.mcc; + mnc = cil.mnc; + break; + } + case CellIdentity::nr: { + CellIdentityNr cin = cellIdentity.get(); + mcc = cin.mcc; + mnc = cin.mnc; + break; + } + } + + // 32 bit system might return invalid mcc and mnc string "\xff\xff..." + if (checkMccMnc && mcc.size() < 4 && mnc.size() < 4) { + int mcc_int = stoi(mcc); + int mnc_int = stoi(mnc); + EXPECT_TRUE(mcc_int >= 0 && mcc_int <= 999); + EXPECT_TRUE(mnc_int >= 0 && mnc_int <= 999); + } + + // Check for access technology specific info + AccessTechnologySpecificInfo info = radioRsp_network->regResp.accessTechnologySpecificInfo; + RadioTechnology rat = radioRsp_network->regResp.rat; + // TODO: add logic for cdmaInfo + if (rat == RadioTechnology::LTE || rat == RadioTechnology::LTE_CA) { + ASSERT_EQ(info.getTag(), AccessTechnologySpecificInfo::eutranInfo); + } else if (rat == RadioTechnology::NR) { + ASSERT_EQ(info.getTag(), AccessTechnologySpecificInfo::ngranNrVopsInfo); + } + AccessNetwork an = radioRsp_network->regResp.accessNetwork; + ASSERT_NE(an, AccessNetwork::N3AN5GS); + ASSERT_NE(an, AccessNetwork::N3ANEPS); +} diff --git a/radio/aidl/vts/radio_network_utils.h b/radio/aidl/vts/radio_network_utils.h index 8480825421..f30b74220b 100644 --- a/radio/aidl/vts/radio_network_utils.h +++ b/radio/aidl/vts/radio_network_utils.h @@ -42,6 +42,7 @@ class RadioNetworkResponse : public BnRadioNetworkResponse { int networkTypeBitmapResponse; RegStateResult voiceRegResp; RegStateResult dataRegResp; + RegStateResult regResp; CellIdentity barringCellIdentity; std::vector barringInfoList; UsageSetting usageSetting; @@ -158,6 +159,9 @@ class RadioNetworkResponse : public BnRadioNetworkResponse { virtual ndk::ScopedAStatus cancelEmergencyNetworkScanResponse( const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus getRegistrationStateResponse( + const RadioResponseInfo& info, const RegStateResult& regResponse) override; }; /* Callback class for radio network indication */ From d12c2f0b4f1d41e32fc643e71e8ce535dfaf4c33 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Thu, 6 Oct 2022 01:00:53 +0000 Subject: [PATCH 290/998] Update comments and constants of IRadioIms HAL - Fix the clang style - Rename constas name and value - Update descriptions Bug: 216387835 Test: build & flash Change-Id: I5d6a52ac704b5828a76744f990261cd361b90075 --- .../radio/ims/ImsDeregistrationReason.aidl | 2 +- .../hardware/radio/ims/IRadioImsIndication.aidl | 17 ++++++++--------- .../radio/ims/ImsDeregistrationReason.aidl | 2 +- .../hardware/radio/ims/SuggestedAction.aidl | 6 +++--- radio/aidl/vts/radio_ims_indication.cpp | 2 +- radio/aidl/vts/radio_ims_response.cpp | 2 +- radio/aidl/vts/radio_ims_test.cpp | 2 +- radio/aidl/vts/radio_ims_utils.h | 5 +++-- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsDeregistrationReason.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsDeregistrationReason.aidl index 330374e710..b04e5598c7 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsDeregistrationReason.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsDeregistrationReason.aidl @@ -36,5 +36,5 @@ package android.hardware.radio.ims; enum ImsDeregistrationReason { REASON_SIM_REMOVED = 1, REASON_SIM_REFRESH = 2, - REASON_NETWORK_MODE_CHANGED = 3, + REASON_ALLOWED_NETWORK_TYPES_CHANGED = 3, } diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl index ea286c4e88..82773f23cf 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl @@ -32,12 +32,12 @@ oneway interface IRadioImsIndication { * on cellular networks. IMS service shall call stopImsTraffic when receiving * this indication. * - * @param token The token of startImsTraffic() associated with this indication * @param type Type of radio indication + * @param token The token of startImsTraffic() associated with this indication * @param info Connection failure information */ - void onConnectionSetupFailure(in RadioIndicationType type, in String token, - in ConnectionFailureInfo info); + void onConnectionSetupFailure( + in RadioIndicationType type, in String token, in ConnectionFailureInfo info); /** * Access Network Bitrate Recommendation (ANBR), see 3GPP TS 26.114. @@ -49,19 +49,18 @@ oneway interface IRadioImsIndication { * @param bitsPerSecond The recommended bit rate for the UE * for a specific logical channel and a specific direction by NW */ - void notifyAnbr(in RadioIndicationType type, in ImsStreamType mediaType, + void notifyAnbr(in RadioIndicationType type, in ImsStreamType mediaType, in ImsStreamDirection direction, int bitsPerSecond); /** - * Fired by radio when a graceful IMS deregistration needs to be performed by telephony - * prior to radio performing network detach. Example scenarios are SIM refresh or user - * mode preference change which would cause network detach. The radio waits for the - * IMS deregistration, which will be notified by telephony via + * Requests IMS stack to perform graceful IMS deregistration before radio performing + * network detach in the events of SIM remove, refresh or and so on. The radio waits for + * the IMS deregistration, which will be notified by telephony via * {@link IRadioIms#updateImsRegistrationInfo()}, or a certain timeout interval to start * the network detach procedure. * * @param type Type of radio indication * @param reason the reason why the deregistration is triggered */ - void triggerImsDeregistration(in RadioIndicationType type, in ImsDeregistrationReason reason); + void triggerImsDeregistration(in RadioIndicationType type, in ImsDeregistrationReason reason); } diff --git a/radio/aidl/android/hardware/radio/ims/ImsDeregistrationReason.aidl b/radio/aidl/android/hardware/radio/ims/ImsDeregistrationReason.aidl index 83c032151d..eac8db4437 100644 --- a/radio/aidl/android/hardware/radio/ims/ImsDeregistrationReason.aidl +++ b/radio/aidl/android/hardware/radio/ims/ImsDeregistrationReason.aidl @@ -34,5 +34,5 @@ enum ImsDeregistrationReason { * Radio shall send this reason to IMS stack to perform graceful de-registration * due to allowed network types bitmask changed that results in NAS detach. */ - REASON_NETWORK_MODE_CHANGED = 3, + REASON_ALLOWED_NETWORK_TYPES_CHANGED = 3, } diff --git a/radio/aidl/android/hardware/radio/ims/SuggestedAction.aidl b/radio/aidl/android/hardware/radio/ims/SuggestedAction.aidl index a17b8a4012..2d12ed628c 100644 --- a/radio/aidl/android/hardware/radio/ims/SuggestedAction.aidl +++ b/radio/aidl/android/hardware/radio/ims/SuggestedAction.aidl @@ -21,17 +21,17 @@ package android.hardware.radio.ims; @Backing(type="int") enum SuggestedAction { /** Default value */ - NONE = 0, + NONE, /** * Indicates that the IMS registration is failed with fatal error such as 403 or 404 * on all P-CSCF addresses. The radio shall block the current PLMN or disable * the RAT as per the carrier requirements. */ - TRIGGER_PLMN_BLOCK = 1 << 0, + TRIGGER_PLMN_BLOCK, /** * Indicates that the IMS registration on current PLMN failed multiple times. * The radio shall block the current PLMN or disable the RAT during EPS or 5GS mobility * management timer value as per the carrier requirements. */ - TRIGGER_PLMN_BLOCK_WITH_TIMEOUT = 1 << 1, + TRIGGER_PLMN_BLOCK_WITH_TIMEOUT, } diff --git a/radio/aidl/vts/radio_ims_indication.cpp b/radio/aidl/vts/radio_ims_indication.cpp index 8e98d85cc0..f382de05d4 100644 --- a/radio/aidl/vts/radio_ims_indication.cpp +++ b/radio/aidl/vts/radio_ims_indication.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 The Android Open Source Project + * 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. diff --git a/radio/aidl/vts/radio_ims_response.cpp b/radio/aidl/vts/radio_ims_response.cpp index 62912ea149..9d8db4a5d7 100644 --- a/radio/aidl/vts/radio_ims_response.cpp +++ b/radio/aidl/vts/radio_ims_response.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 The Android Open Source Project + * 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. diff --git a/radio/aidl/vts/radio_ims_test.cpp b/radio/aidl/vts/radio_ims_test.cpp index 27cc8d9103..e5cbeb46db 100644 --- a/radio/aidl/vts/radio_ims_test.cpp +++ b/radio/aidl/vts/radio_ims_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 The Android Open Source Project + * 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. diff --git a/radio/aidl/vts/radio_ims_utils.h b/radio/aidl/vts/radio_ims_utils.h index 98fd3cbe64..c981ebc8b0 100644 --- a/radio/aidl/vts/radio_ims_utils.h +++ b/radio/aidl/vts/radio_ims_utils.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 The Android Open Source Project + * 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. @@ -43,7 +43,8 @@ class RadioImsResponse : public BnRadioImsResponse { virtual ndk::ScopedAStatus updateImsRegistrationInfoResponse( const RadioResponseInfo& info) override; - virtual ndk::ScopedAStatus startImsTrafficResponse(const RadioResponseInfo& info, + virtual ndk::ScopedAStatus startImsTrafficResponse( + const RadioResponseInfo& info, const std::optional& response) override; virtual ndk::ScopedAStatus stopImsTrafficResponse(const RadioResponseInfo& info) override; From 343ca94b13602718e6751d3eeee646ce95bcb468 Mon Sep 17 00:00:00 2001 From: Jeff Pu Date: Wed, 14 Sep 2022 15:56:30 -0400 Subject: [PATCH 291/998] Fingerprint virtual HAL checkin (part 2) - acquiredInfo support for HAL operations - error insertions - FPS configurations Bug: 230515082 Bug: 230515086 Test: atest FakeFingerprintEngineTest atest FakeFingerprintEngineUdfpsTest atest --no-bazel-mode VtsHalBiometricsFingerprintTargetTest Change-Id: Iedd1056e516358c3c0a99bd4a720016cc0f880e4 --- .../aidl/default/FakeFingerprintEngine.cpp | 251 +++++++++++++++--- .../fingerprint/aidl/default/Fingerprint.cpp | 20 +- biometrics/fingerprint/aidl/default/README.md | 49 +++- ...trics.fingerprint.VirtualProps-current.txt | 76 +++++- .../aidl/default/fingerprint.sysprop | 137 +++++++++- .../default/include/FakeFingerprintEngine.h | 10 + .../tests/FakeFingerprintEngineTest.cpp | 161 ++++++++++- .../tests/FakeFingerprintEngineUdfpsTest.cpp | 16 +- 8 files changed, 643 insertions(+), 77 deletions(-) diff --git a/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp b/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp index 68a1f26a0b..651c9dc352 100644 --- a/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp +++ b/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp @@ -56,43 +56,58 @@ void FakeFingerprintEngine::enrollImpl(ISessionCallback* cb, return; } - if (FingerprintHalProperties::operation_enroll_fails().value_or(false)) { - LOG(ERROR) << "Fail: operation_enroll_fails"; - cb->onError(Error::VENDOR, 0 /* vendorError */); + // Force error-out + auto err = FingerprintHalProperties::operation_enroll_error().value_or(0); + if (err != 0) { + LOG(ERROR) << "Fail: operation_enroll_error"; + auto ec = convertError(err); + cb->onError(ec.first, ec.second); return; } - // format is ":,,...: + // Format is ":,...: auto nextEnroll = FingerprintHalProperties::next_enrollment().value_or(""); auto parts = Util::split(nextEnroll, ":"); if (parts.size() != 3) { - LOG(ERROR) << "Fail: invalid next_enrollment"; + LOG(ERROR) << "Fail: invalid next_enrollment:" << nextEnroll; cb->onError(Error::VENDOR, 0 /* vendorError */); return; } auto enrollmentId = std::stoi(parts[0]); - auto progress = Util::split(parts[1], ","); - for (size_t i = 0; i < progress.size(); i++) { - auto left = progress.size() - i - 1; - SLEEP_MS(std::stoi(progress[i])); + auto progress = parseEnrollmentCapture(parts[1]); + for (size_t i = 0; i < progress.size(); i += 2) { + auto left = (progress.size() - i) / 2 - 1; + auto duration = progress[i][0]; + auto acquired = progress[i + 1]; + auto N = acquired.size(); - if (shouldCancel(cancel)) { - LOG(ERROR) << "Fail: cancel"; - cb->onError(Error::CANCELED, 0 /* vendorCode */); - return; + for (int j = 0; j < N; j++) { + SLEEP_MS(duration / N); + + if (shouldCancel(cancel)) { + LOG(ERROR) << "Fail: cancel"; + cb->onError(Error::CANCELED, 0 /* vendorCode */); + return; + } + auto ac = convertAcquiredInfo(acquired[j]); + cb->onAcquired(ac.first, ac.second); } - cb->onAcquired(AcquiredInfo::GOOD, 0 /* vendorCode */); if (left == 0 && !IS_TRUE(parts[2])) { // end and failed LOG(ERROR) << "Fail: requested by caller: " << nextEnroll; FingerprintHalProperties::next_enrollment({}); cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorCode */); } else { // progress and update props if last time + LOG(INFO) << "onEnroll: " << enrollmentId << " left: " << left; if (left == 0) { auto enrollments = FingerprintHalProperties::enrollments(); enrollments.emplace_back(enrollmentId); FingerprintHalProperties::enrollments(enrollments); FingerprintHalProperties::next_enrollment({}); + // change authenticatorId after new enrollment + auto id = FingerprintHalProperties::authenticator_id().value_or(0); + auto newId = id + 1; + FingerprintHalProperties::authenticator_id(newId); LOG(INFO) << "Enrolled: " << enrollmentId; } cb->onEnrollmentProgress(enrollmentId, left); @@ -104,12 +119,31 @@ void FakeFingerprintEngine::authenticateImpl(ISessionCallback* cb, int64_t /* op const std::future& cancel) { BEGIN_OP(FingerprintHalProperties::operation_authenticate_latency().value_or(DEFAULT_LATENCY)); - auto now = Util::getSystemNanoTime(); - int64_t duration = FingerprintHalProperties::operation_authenticate_duration().value_or(0); + int64_t now = Util::getSystemNanoTime(); + int64_t duration = FingerprintHalProperties::operation_authenticate_duration().value_or(10); + auto acquired = FingerprintHalProperties::operation_authenticate_acquired().value_or("1"); + auto acquiredInfos = parseIntSequence(acquired); + int N = acquiredInfos.size(); + + if (N == 0) { + LOG(ERROR) << "Fail to parse authentiate acquired info: " + acquired; + cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */); + return; + } + + int i = 0; do { if (FingerprintHalProperties::operation_authenticate_fails().value_or(false)) { LOG(ERROR) << "Fail: operation_authenticate_fails"; - cb->onError(Error::VENDOR, 0 /* vendorError */); + cb->onAuthenticationFailed(); + return; + } + + auto err = FingerprintHalProperties::operation_authenticate_error().value_or(0); + if (err != 0) { + LOG(ERROR) << "Fail: operation_authenticate_error"; + auto ec = convertError(err); + cb->onError(ec.first, ec.second); return; } @@ -126,20 +160,25 @@ void FakeFingerprintEngine::authenticateImpl(ISessionCallback* cb, int64_t /* op return; } - auto id = FingerprintHalProperties::enrollment_hit().value_or(0); - auto enrolls = FingerprintHalProperties::enrollments(); - auto isEnrolled = std::find(enrolls.begin(), enrolls.end(), id) != enrolls.end(); - if (id > 0 && isEnrolled) { - cb->onAuthenticationSucceeded(id, {} /* hat */); - return; + if (i < N) { + auto ac = convertAcquiredInfo(acquiredInfos[i]); + cb->onAcquired(ac.first, ac.second); + i++; } - SLEEP_MS(100); + SLEEP_MS(duration / N); } while (!Util::hasElapsed(now, duration)); - LOG(ERROR) << "Fail: not enrolled"; - cb->onAuthenticationFailed(); - cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */); + auto id = FingerprintHalProperties::enrollment_hit().value_or(0); + auto enrolls = FingerprintHalProperties::enrollments(); + auto isEnrolled = std::find(enrolls.begin(), enrolls.end(), id) != enrolls.end(); + if (id > 0 && isEnrolled) { + cb->onAuthenticationSucceeded(id, {} /* hat */); + return; + } else { + LOG(ERROR) << "Fail: fingerprint not enrolled"; + cb->onAuthenticationFailed(); + } } void FakeFingerprintEngine::detectInteractionImpl(ISessionCallback* cb, @@ -147,17 +186,42 @@ void FakeFingerprintEngine::detectInteractionImpl(ISessionCallback* cb, BEGIN_OP(FingerprintHalProperties::operation_detect_interaction_latency().value_or( DEFAULT_LATENCY)); - if (FingerprintHalProperties::operation_detect_interaction_fails().value_or(false)) { - LOG(ERROR) << "Fail: operation_detect_interaction_fails"; - cb->onError(Error::VENDOR, 0 /* vendorError */); + int64_t duration = + FingerprintHalProperties::operation_detect_interaction_duration().value_or(10); + auto acquired = FingerprintHalProperties::operation_detect_interaction_acquired().value_or("1"); + auto acquiredInfos = parseIntSequence(acquired); + int N = acquiredInfos.size(); + int64_t now = Util::getSystemNanoTime(); + + if (N == 0) { + LOG(ERROR) << "Fail to parse detect interaction acquired info: " + acquired; + cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */); return; } - if (shouldCancel(cancel)) { - LOG(ERROR) << "Fail: cancel"; - cb->onError(Error::CANCELED, 0 /* vendorCode */); - return; - } + int i = 0; + do { + auto err = FingerprintHalProperties::operation_detect_interaction_error().value_or(0); + if (err != 0) { + LOG(ERROR) << "Fail: operation_detect_interaction_error"; + auto ec = convertError(err); + cb->onError(ec.first, ec.second); + return; + } + + if (shouldCancel(cancel)) { + LOG(ERROR) << "Fail: cancel"; + cb->onError(Error::CANCELED, 0 /* vendorCode */); + return; + } + + if (i < N) { + auto ac = convertAcquiredInfo(acquiredInfos[i]); + cb->onAcquired(ac.first, ac.second); + i++; + } + SLEEP_MS(duration / N); + } while (!Util::hasElapsed(now, duration)); auto id = FingerprintHalProperties::enrollment_hit().value_or(0); auto enrolls = FingerprintHalProperties::enrollments(); @@ -211,24 +275,37 @@ void FakeFingerprintEngine::removeEnrollmentsImpl(ISessionCallback* cb, void FakeFingerprintEngine::getAuthenticatorIdImpl(ISessionCallback* cb) { BEGIN_OP(0); - int64_t authenticatorId = FingerprintHalProperties::authenticator_id().value_or(0); - if (FingerprintHalProperties::enrollments().size() > 0 && authenticatorId == 0) { - authenticatorId = 99999999; // default authenticatorId, TODO(b/230515082) + int64_t authenticatorId; + if (FingerprintHalProperties::enrollments().size() == 0) { + authenticatorId = 0; + } else { + authenticatorId = FingerprintHalProperties::authenticator_id().value_or(0); + if (authenticatorId == 0) authenticatorId = 1; } cb->onAuthenticatorIdRetrieved(authenticatorId); } void FakeFingerprintEngine::invalidateAuthenticatorIdImpl(ISessionCallback* cb) { BEGIN_OP(0); - auto id = FingerprintHalProperties::authenticator_id().value_or(0); - auto newId = id + 1; + int64_t newId; + if (FingerprintHalProperties::enrollments().size() == 0) { + newId = 0; + } else { + auto id = FingerprintHalProperties::authenticator_id().value_or(0); + newId = id + 1; + } FingerprintHalProperties::authenticator_id(newId); cb->onAuthenticatorIdInvalidated(newId); } void FakeFingerprintEngine::resetLockoutImpl(ISessionCallback* cb, - const keymaster::HardwareAuthToken& /*hat*/) { + const keymaster::HardwareAuthToken& hat) { BEGIN_OP(0); + if (hat.mac.empty()) { + LOG(ERROR) << "Fail: hat in resetLockout()"; + cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */); + return; + } FingerprintHalProperties::lockout(false); cb->onLockoutCleared(); } @@ -286,4 +363,96 @@ SensorLocation FakeFingerprintEngine::defaultSensorLocation() { return {0 /* displayId (not used) */, 0 /* sensorLocationX */, 0 /* sensorLocationY */, 0 /* sensorRadius */, "" /* display */}; } + +std::vector FakeFingerprintEngine::parseIntSequence(const std::string& str, + const std::string& sep) { + std::vector seqs = Util::split(str, sep); + std::vector res; + + for (const auto& seq : seqs) { + int32_t val; + if (ParseInt(seq, &val)) { + res.push_back(val); + } else { + LOG(WARNING) << "Invalid int sequence:" + str; + res.clear(); + break; + } + } + + return res; +} + +std::vector> FakeFingerprintEngine::parseEnrollmentCapture( + const std::string& str) { + std::vector defaultAcquiredInfo = {(int32_t)AcquiredInfo::GOOD}; + std::vector> res; + int i = 0, N = str.length(); + std::size_t found = 0; + bool aborted = true; + + while (found != std::string::npos) { + std::string durationStr, acquiredStr; + found = str.find_first_of("-,", i); + if (found == std::string::npos) { + if (N - i < 1) break; + durationStr = str.substr(i, N - i); + } else { + durationStr = str.substr(i, found - i); + if (str[found] == '-') { + found = str.find_first_of('[', found + 1); + if (found == std::string::npos) break; + i = found + 1; + found = str.find_first_of(']', found + 1); + if (found == std::string::npos) break; + acquiredStr = str.substr(i, found - i); + found = str.find_first_of(',', found + 1); + } + } + std::vector duration{0}; + if (!ParseInt(durationStr, &duration[0])) break; + res.push_back(duration); + if (!acquiredStr.empty()) { + std::vector acquiredInfo = parseIntSequence(acquiredStr); + if (acquiredInfo.empty()) break; + res.push_back(acquiredInfo); + } else + res.push_back(defaultAcquiredInfo); + + i = found + 1; + if (found == std::string::npos || found == N - 1) aborted = false; + } + + if (aborted) { + LOG(ERROR) << "Failed to parse enrollment captures:" + str; + res.clear(); + } + + return res; +} + +std::pair FakeFingerprintEngine::convertAcquiredInfo(int32_t code) { + std::pair res; + if (code > FINGERPRINT_ACQUIRED_VENDOR_BASE) { + res.first = AcquiredInfo::VENDOR; + res.second = code - FINGERPRINT_ACQUIRED_VENDOR_BASE; + } else { + res.first = (AcquiredInfo)code; + res.second = 0; + } + return res; +} + +std::pair FakeFingerprintEngine::convertError(int32_t code) { + std::pair res; + if (code > FINGERPRINT_ERROR_VENDOR_BASE) { + res.first = Error::VENDOR; + res.second = code - FINGERPRINT_ERROR_VENDOR_BASE; + } else { + res.first = (Error)code; + res.second = 0; + } + return res; +} + } // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/Fingerprint.cpp b/biometrics/fingerprint/aidl/default/Fingerprint.cpp index 922781ce65..74e7caff3c 100644 --- a/biometrics/fingerprint/aidl/default/Fingerprint.cpp +++ b/biometrics/fingerprint/aidl/default/Fingerprint.cpp @@ -65,8 +65,18 @@ ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector* out) { {SW_COMPONENT_ID, "" /* hardwareVersion */, "" /* firmwareVersion */, "" /* serialNumber */, SW_VERSION}}; - common::CommonProps commonProps = {SENSOR_ID, SENSOR_STRENGTH, MAX_ENROLLMENTS_PER_USER, - componentInfo}; + auto sensorId = FingerprintHalProperties::sensor_id().value_or(SENSOR_ID); + auto sensorStrength = + FingerprintHalProperties::sensor_strength().value_or((int)SENSOR_STRENGTH); + auto maxEnrollments = + FingerprintHalProperties::max_enrollments().value_or(MAX_ENROLLMENTS_PER_USER); + auto navigationGuesture = FingerprintHalProperties::navigation_guesture().value_or(false); + auto detectInteraction = FingerprintHalProperties::detect_interaction().value_or(false); + auto displayTouch = FingerprintHalProperties::display_touch().value_or(true); + auto controlIllumination = FingerprintHalProperties::control_illumination().value_or(false); + + common::CommonProps commonProps = {sensorId, (common::SensorStrength)sensorStrength, + maxEnrollments, componentInfo}; SensorLocation sensorLocation = mEngine->getSensorLocation(); @@ -75,8 +85,10 @@ ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector* out) { *out = {{commonProps, mSensorType, {sensorLocation}, - SUPPORTS_NAVIGATION_GESTURES, - false /* supportsDetectInteraction */}}; + navigationGuesture, + detectInteraction, + displayTouch, + controlIllumination}}; return ndk::ScopedAStatus::ok(); } diff --git a/biometrics/fingerprint/aidl/default/README.md b/biometrics/fingerprint/aidl/default/README.md index bb6bb48dd0..ad471f747d 100644 --- a/biometrics/fingerprint/aidl/default/README.md +++ b/biometrics/fingerprint/aidl/default/README.md @@ -65,7 +65,7 @@ $ adb shell cmd fingerprint sync $ adb shell getprop persist.vendor.fingerprint.virtual.enrollments ``` -### Authenticate +## Authenticate To authenticate successfully set the enrolled id that should succeed. Unset it or change the value to make authenticate operations fail: @@ -74,7 +74,52 @@ or change the value to make authenticate operations fail: $ adb shell setprop vendor.fingerprint.virtual.enrollment_hit 1 ```` -### View HAL State +## Acquired Info Insertion + +Fingerprint image acquisition states at HAL are reported to framework via onAcquired() callback. The valid acquired state info for AIDL HAL include + +{UNKNOWN(0), GOOD(1), PARTIAL(2), INSUFFICIENT(3), SENSOR_DIRTY(4), TOO_SLOW(5), TOO_FAST(6), VENDOR(7), START(8), TOO_DARK(9), TOO_BRIGHT(10), IMMOBILE(11), RETRYING_CAPTURE(12)} + +Refer to [AcquiredInfo.aidl](../android/hardware/biometrics/fingerprint/AcquiredInfo.aidl) for details + + +The states can be specified in sequence for the HAL operations involving fingerprint image captures, namely authenticate, enrollment and detectInteraction + +```shell +$ adb shell setprop vendor.fingerprint.virtual.operation_authenticate_acquired 6,9,1 +$ adb shell setprop vendor.fingerprint.virtual.operation_detect_interaction_acquired 6,1 +$ adb shell setprop vendor.fingerprint.virtual.next_enrollment 2:1000-[5,1],500:true + +#next_enrollment format example: +.---------------------- enrollment id (2) +| .------------------ the image capture 1 duration (1000ms) +| | .-------------- acquired info first (TOO_SLOW) +| | | .------------ acquired info second (GOOD) +| | | | .-------- the image capture 2 duration (500ms) +| | | | | .---- enrollment end status (success) +| | | | | | +| | | | | | +| | | | | | +2:1000-[5,1],500:true +``` +For vendor specific acquired info, acquiredInfo = 1000 + vendorAcquiredInfo + +## Error Insertion +The valid error codes for AIDL HAL include + +{UNKNOWN(0), HW_UNAVAILABLE(1), UNABLE_TO_PROCESS(2), TIMEOUT(3), NO_SPACE(4), CANCELED(5), UNABLE_TO_REMOVE(6), VENDOR(7), BAD_CALIBRATION(8)} + +Refer to [Error.aidl](../android/hardware/biometrics/fingerprint/Error.aidl) for details + + +There are many HAL operations which can result in errors, refer to [here](fingerprint.sysprop) file for details. + +```shell +$ adb shell setprop vendor.fingerprint.virtual.operation_authenticate_error 8 +``` +For vendor specific error, errorCode = 1000 + vendorErrorCode + +## View HAL State To view all the properties of the HAL (see `fingerprint.sysprop` file for the API): diff --git a/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt b/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt index 9dfb74d0ef..fa21663a17 100644 --- a/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt +++ b/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt @@ -5,7 +5,7 @@ props { api_name: "authenticator_id" type: Long access: ReadWrite - prop_name: "vendor.fingerprint.virtual.authenticator_id" + prop_name: "persist.vendor.fingerprint.virtual.authenticator_id" } prop { api_name: "challenge" @@ -13,6 +13,21 @@ props { access: ReadWrite prop_name: "vendor.fingerprint.virtual.challenge" } + prop { + api_name: "control_illumination" + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.udfps.control_illumination" + } + prop { + api_name: "detect_interaction" + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.detect_interaction" + } + prop { + api_name: "display_touch" + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.udfps.display_touch" + } prop { api_name: "enrollment_hit" type: Integer @@ -28,7 +43,18 @@ props { prop { api_name: "lockout" access: ReadWrite - prop_name: "vendor.fingerprint.virtual.lockout" + prop_name: "persist.vendor.fingerprint.virtual.lockout" + } + prop { + api_name: "max_enrollments" + type: Integer + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.max_enrollments" + } + prop { + api_name: "navigation_guesture" + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.navigation_guesture" } prop { api_name: "next_enrollment" @@ -36,12 +62,24 @@ props { access: ReadWrite prop_name: "vendor.fingerprint.virtual.next_enrollment" } + prop { + api_name: "operation_authenticate_acquired" + type: String + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.operation_authenticate_acquired" + } prop { api_name: "operation_authenticate_duration" type: Integer access: ReadWrite prop_name: "vendor.fingerprint.virtual.operation_authenticate_duration" } + prop { + api_name: "operation_authenticate_error" + type: Integer + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.operation_authenticate_error" + } prop { api_name: "operation_authenticate_fails" access: ReadWrite @@ -54,9 +92,22 @@ props { prop_name: "vendor.fingerprint.virtual.operation_authenticate_latency" } prop { - api_name: "operation_detect_interaction_fails" + api_name: "operation_detect_interaction_acquired" + type: String access: ReadWrite - prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_fails" + prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_acquired" + } + prop { + api_name: "operation_detect_interaction_duration" + type: Integer + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_duration" + } + prop { + api_name: "operation_detect_interaction_error" + type: Integer + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_error" } prop { api_name: "operation_detect_interaction_latency" @@ -65,9 +116,10 @@ props { prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_latency" } prop { - api_name: "operation_enroll_fails" + api_name: "operation_enroll_error" + type: Integer access: ReadWrite - prop_name: "vendor.fingerprint.virtual.operation_enroll_fails" + prop_name: "vendor.fingerprint.virtual.operation_enroll_error" } prop { api_name: "operation_enroll_latency" @@ -75,12 +127,24 @@ props { access: ReadWrite prop_name: "vendor.fingerprint.virtual.operation_enroll_latency" } + prop { + api_name: "sensor_id" + type: Integer + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.sensor_id" + } prop { api_name: "sensor_location" type: String access: ReadWrite prop_name: "persist.vendor.fingerprint.virtual.sensor_location" } + prop { + api_name: "sensor_strength" + type: Integer + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.sensor_strength" + } prop { api_name: "type" type: String diff --git a/biometrics/fingerprint/aidl/default/fingerprint.sysprop b/biometrics/fingerprint/aidl/default/fingerprint.sysprop index 85e93b0aa8..9b8fada927 100644 --- a/biometrics/fingerprint/aidl/default/fingerprint.sysprop +++ b/biometrics/fingerprint/aidl/default/fingerprint.sysprop @@ -32,8 +32,12 @@ prop { api_name: "enrollment_hit" } -# the next enrollment in the format: ":,,...:" -# for example: "2:0:true" +# the next enrollment in the format of: +# ":,,...:" +# = +# [acquiredInfos] = [acquiredInfo1, acquiredInfo2, ...] +# (refer to README.md file for acquiredInfo values) +# e.g. "2:100,20:true", "2:100-[5,1],20:true" # this property is reset after enroll completes prop { prop_name: "vendor.fingerprint.virtual.next_enrollment" @@ -45,7 +49,7 @@ prop { # value for getAuthenticatorId or 0 prop { - prop_name: "vendor.fingerprint.virtual.authenticator_id" + prop_name: "persist.vendor.fingerprint.virtual.authenticator_id" type: Long scope: Public access: ReadWrite @@ -63,7 +67,7 @@ prop { # if locked out prop { - prop_name: "vendor.fingerprint.virtual.lockout" + prop_name: "persist.vendor.fingerprint.virtual.lockout" type: Boolean scope: Public access: ReadWrite @@ -79,22 +83,26 @@ prop { api_name: "operation_authenticate_fails" } -# force all detectInteraction operations to fail +# force all detectInteraction operations to error out +# error consists of errorCode and vendorErrorCode +# valid errorCodes are listed in README.md file +# vendorErrorCode = (error>1000) ? error-1000 : 0 +# e.g. error(1002) --> errorCode(7) and vendorErrorCode(2) prop { - prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_fails" - type: Boolean + prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_error" + type: Integer scope: Public access: ReadWrite - api_name: "operation_detect_interaction_fails" + api_name: "operation_detect_interaction_error" } -# force all enroll operations to fail +# force all enroll operations to result in error prop { - prop_name: "vendor.fingerprint.virtual.operation_enroll_fails" - type: Boolean + prop_name: "vendor.fingerprint.virtual.operation_enroll_error" + type: Integer scope: Public access: ReadWrite - api_name: "operation_enroll_fails" + api_name: "operation_enroll_error" } # add a latency to authentication operations @@ -134,6 +142,15 @@ prop { api_name: "operation_authenticate_duration" } +# insert error for authenticate operations +prop { + prop_name: "vendor.fingerprint.virtual.operation_authenticate_error" + type: Integer + scope: Public + access: ReadWrite + api_name: "operation_authenticate_error" +} + # sensor location # :: in pixel prop { @@ -143,3 +160,99 @@ prop { access: ReadWrite api_name: "sensor_location" } + +# acquired info during authentication in format of sequence +prop { + prop_name: "vendor.fingerprint.virtual.operation_authenticate_acquired" + type: String + scope: Public + access: ReadWrite + api_name: "operation_authenticate_acquired" +} + +# millisecond duration for detect interaction operations +# (waits for changes to enrollment_hit) +prop { + prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_duration" + type: Integer + scope: Public + access: ReadWrite + api_name: "operation_detect_interaction_duration" +} + +# acquired info during detect interaction operation in format of sequence +# e.g. 5,6,1 (TOO_SLOW, TOO_FAST, GOOD) +# onAcquired() callback will be invoked in sequence +# vendorAcquiredCode = (acquired>1000) ? acquired-1000 : 0 +prop { + prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_acquired" + type: String + scope: Public + access: ReadWrite + api_name: "operation_detect_interaction_acquired" +} + +# sensor id (default: 5) +prop { + prop_name: "persist.vendor.fingerprint.virtual.sensor_id" + type: Integer + scope: Public + access: ReadWrite + api_name: "sensor_id" +} + +# sensor strength (default: 2) +# [0=CONVENECE, 1=WEAK, 2=STRONG] +prop { + prop_name: "persist.vendor.fingerprint.virtual.sensor_strength" + type: Integer + scope: Public + access: ReadWrite + api_name: "sensor_strength" +} + +# max enrollments per user (default: 5) +# +prop { + prop_name: "persist.vendor.fingerprint.virtual.max_enrollments" + type: Integer + scope: Public + access: ReadWrite + api_name: "max_enrollments" +} + +# whether support navigation guestures (default: false) +prop { + prop_name: "persist.vendor.fingerprint.virtual.navigation_guesture" + type: Boolean + scope: Public + access: ReadWrite + api_name: "navigation_guesture" +} + +# whether support detect interaction (default: false) +prop { + prop_name: "persist.vendor.fingerprint.virtual.detect_interaction" + type: Boolean + scope: Public + access: ReadWrite + api_name: "detect_interaction" +} + +# whether support display touch by hal (default: true) +prop { + prop_name: "persist.vendor.fingerprint.virtual.udfps.display_touch" + type: Boolean + scope: Public + access: ReadWrite + api_name: "display_touch" +} + +# whether support illumination control by hal (default: false) +prop { + prop_name: "persist.vendor.fingerprint.virtual.udfps.control_illumination" + type: Boolean + scope: Public + access: ReadWrite + api_name: "control_illumination" +} diff --git a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h index d7df8182de..22b1744134 100644 --- a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h +++ b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h @@ -59,7 +59,17 @@ class FakeFingerprintEngine { virtual SensorLocation defaultSensorLocation(); + std::vector parseIntSequence(const std::string& str, const std::string& sep = ","); + + std::vector> parseEnrollmentCapture(const std::string& str); + std::mt19937 mRandom; + + private: + static constexpr int32_t FINGERPRINT_ACQUIRED_VENDOR_BASE = 1000; + static constexpr int32_t FINGERPRINT_ERROR_VENDOR_BASE = 1000; + std::pair convertAcquiredInfo(int32_t code); + std::pair convertError(int32_t code); }; } // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineTest.cpp b/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineTest.cpp index 8696d2624a..32d01f400f 100644 --- a/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineTest.cpp +++ b/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineTest.cpp @@ -38,8 +38,9 @@ class TestSessionCallback : public BnSessionCallback { mLastChallengeRevoked = challenge; return ndk::ScopedAStatus::ok(); }; - ::ndk::ScopedAStatus onError(fingerprint::Error error, int32_t) override { + ::ndk::ScopedAStatus onError(fingerprint::Error error, int32_t vendorCode) override { mError = error; + mErrorVendorCode = vendorCode; return ndk::ScopedAStatus::ok(); }; ::ndk::ScopedAStatus onEnrollmentProgress(int32_t enrollmentId, int32_t remaining) override { @@ -62,7 +63,10 @@ class TestSessionCallback : public BnSessionCallback { mInteractionDetectedCount++; return ndk::ScopedAStatus::ok(); }; - ndk::ScopedAStatus onAcquired(AcquiredInfo /*info*/, int32_t /*vendorCode*/) override { + ndk::ScopedAStatus onAcquired(AcquiredInfo info, int32_t vendorCode) override { + mLastAcquiredInfo = (int32_t)info; + mLastAcquiredVendorCode = vendorCode; + mLastAcquiredCount++; return ndk::ScopedAStatus::ok(); } ::ndk::ScopedAStatus onEnrollmentsEnumerated( @@ -94,6 +98,7 @@ class TestSessionCallback : public BnSessionCallback { ndk::ScopedAStatus onSessionClosed() override { return ndk::ScopedAStatus::ok(); } Error mError = Error::UNKNOWN; + int32_t mErrorVendorCode = 0; int64_t mLastChallenge = -1; int64_t mLastChallengeRevoked = -1; int32_t mLastEnrolled = -1; @@ -105,6 +110,9 @@ class TestSessionCallback : public BnSessionCallback { bool mAuthenticatorIdInvalidated = false; bool mLockoutPermanent = false; int mInteractionDetectedCount = 0; + int32_t mLastAcquiredInfo = -1; + int32_t mLastAcquiredVendorCode = -1; + int32_t mLastAcquiredCount = 0; }; class FakeFingerprintEngineTest : public ::testing::Test { @@ -116,6 +124,12 @@ class FakeFingerprintEngineTest : public ::testing::Test { mCallback = ndk::SharedRefBase::make(); } + void TearDown() override { + FingerprintHalProperties::operation_authenticate_error(0); + FingerprintHalProperties::operation_detect_interaction_error(0); + FingerprintHalProperties::operation_authenticate_acquired(""); + } + FakeFingerprintEngine mEngine; std::shared_ptr mCallback; std::promise mCancel; @@ -135,11 +149,13 @@ TEST_F(FakeFingerprintEngineTest, RevokeChallenge) { TEST_F(FakeFingerprintEngineTest, ResetLockout) { FingerprintHalProperties::lockout(true); - mEngine.resetLockoutImpl(mCallback.get(), {}); + keymaster::HardwareAuthToken hat{.mac = {2, 4}}; + mEngine.resetLockoutImpl(mCallback.get(), hat); ASSERT_FALSE(FingerprintHalProperties::lockout().value_or(true)); } TEST_F(FakeFingerprintEngineTest, AuthenticatorId) { + FingerprintHalProperties::enrollments({1}); FingerprintHalProperties::authenticator_id(50); mEngine.getAuthenticatorIdImpl(mCallback.get()); ASSERT_EQ(50, mCallback->mLastAuthenticatorId); @@ -162,6 +178,7 @@ TEST_F(FakeFingerprintEngineTest, Enroll) { ASSERT_EQ(1, FingerprintHalProperties::enrollments().size()); ASSERT_EQ(4, FingerprintHalProperties::enrollments()[0].value()); ASSERT_EQ(4, mCallback->mLastEnrolled); + ASSERT_EQ(1, mCallback->mLastAcquiredInfo); } TEST_F(FakeFingerprintEngineTest, EnrollCancel) { @@ -189,12 +206,28 @@ TEST_F(FakeFingerprintEngineTest, EnrollFail) { ASSERT_FALSE(FingerprintHalProperties::next_enrollment().has_value()); } +TEST_F(FakeFingerprintEngineTest, EnrollAcquired) { + FingerprintHalProperties::enrollments({}); + FingerprintHalProperties::next_enrollment("4:0,5-[12,1013]:true"); + keymaster::HardwareAuthToken hat{.mac = {2, 4}}; + int32_t prevCnt = mCallback->mLastAcquiredCount; + mEngine.enrollImpl(mCallback.get(), hat, mCancel.get_future()); + ASSERT_FALSE(FingerprintHalProperties::next_enrollment().has_value()); + ASSERT_EQ(1, FingerprintHalProperties::enrollments().size()); + ASSERT_EQ(4, FingerprintHalProperties::enrollments()[0].value()); + ASSERT_EQ(4, mCallback->mLastEnrolled); + ASSERT_EQ(prevCnt + 3, mCallback->mLastAcquiredCount); + ASSERT_EQ(7, mCallback->mLastAcquiredInfo); + ASSERT_EQ(13, mCallback->mLastAcquiredVendorCode); +} + TEST_F(FakeFingerprintEngineTest, Authenticate) { FingerprintHalProperties::enrollments({1, 2}); FingerprintHalProperties::enrollment_hit(2); mEngine.authenticateImpl(mCallback.get(), 0, mCancel.get_future()); ASSERT_FALSE(mCallback->mAuthenticateFailed); ASSERT_EQ(2, mCallback->mLastAuthenticated); + ASSERT_EQ(1, mCallback->mLastAcquiredInfo); } TEST_F(FakeFingerprintEngineTest, AuthenticateCancel) { @@ -211,7 +244,6 @@ TEST_F(FakeFingerprintEngineTest, AuthenticateNotSet) { FingerprintHalProperties::enrollment_hit({}); mEngine.authenticateImpl(mCallback.get(), 0, mCancel.get_future()); ASSERT_TRUE(mCallback->mAuthenticateFailed); - ASSERT_EQ(mCallback->mError, Error::UNABLE_TO_PROCESS); } TEST_F(FakeFingerprintEngineTest, AuthenticateNotEnrolled) { @@ -219,7 +251,6 @@ TEST_F(FakeFingerprintEngineTest, AuthenticateNotEnrolled) { FingerprintHalProperties::enrollment_hit(3); mEngine.authenticateImpl(mCallback.get(), 0, mCancel.get_future()); ASSERT_TRUE(mCallback->mAuthenticateFailed); - ASSERT_EQ(mCallback->mError, Error::UNABLE_TO_PROCESS); } TEST_F(FakeFingerprintEngineTest, AuthenticateLockout) { @@ -231,11 +262,41 @@ TEST_F(FakeFingerprintEngineTest, AuthenticateLockout) { ASSERT_NE(mCallback->mError, Error::UNKNOWN); } +TEST_F(FakeFingerprintEngineTest, AuthenticateError8) { + FingerprintHalProperties::operation_authenticate_error(8); + mEngine.authenticateImpl(mCallback.get(), 0, mCancel.get_future()); + ASSERT_EQ(mCallback->mError, (Error)8); + ASSERT_EQ(mCallback->mErrorVendorCode, 0); +} + +TEST_F(FakeFingerprintEngineTest, AuthenticateError9) { + FingerprintHalProperties::operation_authenticate_error(1009); + mEngine.authenticateImpl(mCallback.get(), 0, mCancel.get_future()); + ASSERT_EQ(mCallback->mError, (Error)7); + ASSERT_EQ(mCallback->mErrorVendorCode, 9); +} + +TEST_F(FakeFingerprintEngineTest, AuthenticateAcquired) { + FingerprintHalProperties::lockout(false); + FingerprintHalProperties::enrollments({1, 2}); + FingerprintHalProperties::enrollment_hit(2); + FingerprintHalProperties::operation_authenticate_acquired("4,1009"); + int32_t prevCount = mCallback->mLastAcquiredCount; + mEngine.authenticateImpl(mCallback.get(), 0, mCancel.get_future()); + ASSERT_FALSE(mCallback->mAuthenticateFailed); + ASSERT_EQ(2, mCallback->mLastAuthenticated); + ASSERT_EQ(prevCount + 2, mCallback->mLastAcquiredCount); + ASSERT_EQ(7, mCallback->mLastAcquiredInfo); + ASSERT_EQ(9, mCallback->mLastAcquiredVendorCode); +} + TEST_F(FakeFingerprintEngineTest, InteractionDetect) { FingerprintHalProperties::enrollments({1, 2}); FingerprintHalProperties::enrollment_hit(2); + FingerprintHalProperties::operation_detect_interaction_acquired(""); mEngine.detectInteractionImpl(mCallback.get(), mCancel.get_future()); ASSERT_EQ(1, mCallback->mInteractionDetectedCount); + ASSERT_EQ(1, mCallback->mLastAcquiredInfo); } TEST_F(FakeFingerprintEngineTest, InteractionDetectCancel) { @@ -261,6 +322,26 @@ TEST_F(FakeFingerprintEngineTest, InteractionDetectNotEnrolled) { ASSERT_EQ(0, mCallback->mInteractionDetectedCount); } +TEST_F(FakeFingerprintEngineTest, InteractionDetectError) { + FingerprintHalProperties::operation_detect_interaction_error(8); + mEngine.detectInteractionImpl(mCallback.get(), mCancel.get_future()); + ASSERT_EQ(0, mCallback->mInteractionDetectedCount); + ASSERT_EQ(mCallback->mError, (Error)8); + ASSERT_EQ(mCallback->mErrorVendorCode, 0); +} + +TEST_F(FakeFingerprintEngineTest, InteractionDetectAcquired) { + FingerprintHalProperties::enrollments({1, 2}); + FingerprintHalProperties::enrollment_hit(2); + FingerprintHalProperties::operation_detect_interaction_acquired("4,1013"); + int32_t prevCount = mCallback->mLastAcquiredCount; + mEngine.detectInteractionImpl(mCallback.get(), mCancel.get_future()); + ASSERT_EQ(1, mCallback->mInteractionDetectedCount); + ASSERT_EQ(prevCount + 2, mCallback->mLastAcquiredCount); + ASSERT_EQ(7, mCallback->mLastAcquiredInfo); + ASSERT_EQ(13, mCallback->mLastAcquiredVendorCode); +} + TEST_F(FakeFingerprintEngineTest, EnumerateEnrolled) { FingerprintHalProperties::enrollments({2, 4, 8}); mEngine.enumerateEnrollmentsImpl(mCallback.get()); @@ -290,6 +371,76 @@ TEST_F(FakeFingerprintEngineTest, RemoveEnrolled) { } } +TEST_F(FakeFingerprintEngineTest, parseIntSequence) { + std::vector seqV; + seqV = mEngine.parseIntSequence(""); + ASSERT_EQ(0, seqV.size()); + seqV = mEngine.parseIntSequence("2"); + ASSERT_EQ(1, seqV.size()); + ASSERT_EQ(2, seqV[0]); + seqV = mEngine.parseIntSequence("2,3,4"); + std::vector expV{2, 3, 4}; + ASSERT_EQ(expV, seqV); + seqV = mEngine.parseIntSequence("2,3,a"); + ASSERT_EQ(0, seqV.size()); + seqV = mEngine.parseIntSequence("2, 3, 4"); + ASSERT_EQ(expV, seqV); + seqV = mEngine.parseIntSequence("123,456"); + ASSERT_EQ(2, seqV.size()); + std::vector expV1{123, 456}; + ASSERT_EQ(expV1, seqV); + seqV = mEngine.parseIntSequence("12f3,456"); + ASSERT_EQ(0, seqV.size()); +} + +TEST_F(FakeFingerprintEngineTest, parseEnrollmentCaptureOk) { + std::vector> ecV; + ecV = mEngine.parseEnrollmentCapture("100,200,300"); + ASSERT_EQ(6, ecV.size()); + std::vector> expE{{100}, {200}, {300}}; + std::vector defC{1}; + for (int i = 0; i < ecV.size(); i += 2) { + ASSERT_EQ(expE[i / 2], ecV[i]); + ASSERT_EQ(defC, ecV[i + 1]); + } + ecV = mEngine.parseEnrollmentCapture("100"); + ASSERT_EQ(2, ecV.size()); + ASSERT_EQ(expE[0], ecV[0]); + ASSERT_EQ(defC, ecV[1]); + + ecV = mEngine.parseEnrollmentCapture("100-[5,6,7]"); + std::vector expC{5, 6, 7}; + ASSERT_EQ(2, ecV.size()); + for (int i = 0; i < ecV.size(); i += 2) { + ASSERT_EQ(expE[i / 2], ecV[i]); + ASSERT_EQ(expC, ecV[i + 1]); + } + ecV = mEngine.parseEnrollmentCapture("100-[5,6,7], 200, 300-[9,10]"); + std::vector> expC1{{5, 6, 7}, {1}, {9, 10}}; + ASSERT_EQ(6, ecV.size()); + for (int i = 0; i < ecV.size(); i += 2) { + ASSERT_EQ(expE[i / 2], ecV[i]); + ASSERT_EQ(expC1[i / 2], ecV[i + 1]); + } + ecV = mEngine.parseEnrollmentCapture("100-[5,6,7], 200-[2,1], 300-[9]"); + std::vector> expC2{{5, 6, 7}, {2, 1}, {9}}; + ASSERT_EQ(ecV.size(), 6); + for (int i = 0; i < ecV.size(); i += 2) { + ASSERT_EQ(expE[i / 2], ecV[i]); + ASSERT_EQ(expC2[i / 2], ecV[i + 1]); + } +} + +TEST_F(FakeFingerprintEngineTest, parseEnrollmentCaptureFail) { + std::vector badStr{"10c", "100-5", "100-[5,6,7", "100-5,6,7]", + "100,2x0,300", "200-[f]", "a,b"}; + std::vector> ecV; + for (const auto s : badStr) { + ecV = mEngine.parseEnrollmentCapture(s); + ASSERT_EQ(ecV.size(), 0); + } +} + } // namespace aidl::android::hardware::biometrics::fingerprint int main(int argc, char** argv) { diff --git a/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineUdfpsTest.cpp b/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineUdfpsTest.cpp index 485f401504..7c0021fb26 100644 --- a/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineUdfpsTest.cpp +++ b/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineUdfpsTest.cpp @@ -47,14 +47,10 @@ bool isDefaultLocation(SensorLocation& sc) { sc.sensorRadius == FakeFingerprintEngineUdfps::defaultSensorRadius && sc.display == ""); } -TEST_F(FakeFingerprintEngineUdfpsTest, getSensorLocation) { - FingerprintHalProperties::sensor_location(""); - SensorLocation sc = mEngine.getSensorLocation(); - ASSERT_TRUE(isDefaultLocation(sc)); - +TEST_F(FakeFingerprintEngineUdfpsTest, getSensorLocationOk) { auto loc = "100:200:30"; FingerprintHalProperties::sensor_location(loc); - sc = mEngine.getSensorLocation(); + SensorLocation sc = mEngine.getSensorLocation(); ASSERT_TRUE(sc.sensorLocationX == 100); ASSERT_TRUE(sc.sensorLocationY == 200); ASSERT_TRUE(sc.sensorRadius == 30); @@ -66,8 +62,14 @@ TEST_F(FakeFingerprintEngineUdfpsTest, getSensorLocation) { ASSERT_TRUE(sc.sensorLocationY == 200); ASSERT_TRUE(sc.sensorRadius == 30); ASSERT_TRUE(sc.display == "screen1"); +} - loc = "100"; +TEST_F(FakeFingerprintEngineUdfpsTest, getSensorLocationBad) { + FingerprintHalProperties::sensor_location(""); + SensorLocation sc = mEngine.getSensorLocation(); + ASSERT_TRUE(isDefaultLocation(sc)); + + auto loc = "100"; FingerprintHalProperties::sensor_location(loc); sc = mEngine.getSensorLocation(); ASSERT_TRUE(isDefaultLocation(sc)); From 62af8a9a66ddea4a67eaa50c97818d3572654856 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Fri, 7 Oct 2022 07:14:52 +0000 Subject: [PATCH 292/998] Update comments of RegState.REG_EM Bug: 216387835 Test: build & flash Change-Id: I73022af0d70904a8abce64d2fef4bfc589e891ab --- radio/aidl/android/hardware/radio/network/RegState.aidl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/aidl/android/hardware/radio/network/RegState.aidl b/radio/aidl/android/hardware/radio/network/RegState.aidl index 2827d1953e..bdba4c4a78 100644 --- a/radio/aidl/android/hardware/radio/network/RegState.aidl +++ b/radio/aidl/android/hardware/radio/network/RegState.aidl @@ -66,7 +66,7 @@ enum RegState { */ UNKNOWN_EM = 14, /** - * Emergency attached in LTE or emergency registered in 5GS. + * Emergency attached in EPS or in 5GS. * Reference: 3GPP TS 24.301 9.9.3.11 EPS attach type. * Reference: 3GPP TS 24.501 9.11.3.6 5GS registration result. */ From ab99006d6a8d7e4500498d01057a6f6371486476 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Wed, 12 Oct 2022 05:22:52 +0000 Subject: [PATCH 293/998] Fix broken build by android.hardware.radio.ims.media HAL A CL following ag/20057104, changing the version of android.hardware.radio HAL Bug: 249129495 Test: build & flash Change-Id: I6ea77b532b50d7cf71a05ac3bddfa55425b606cb --- radio/aidl/Android.bp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp index 5937a92058..2af0adc2df 100644 --- a/radio/aidl/Android.bp +++ b/radio/aidl/Android.bp @@ -210,7 +210,7 @@ aidl_interface { vendor_available: true, srcs: ["android/hardware/radio/ims/media/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V1", + imports: ["android.hardware.radio-V2", "android.hardware.radio.data-V1"], backend: { cpp: { @@ -227,7 +227,7 @@ aidl_interface { vendor_available: true, srcs: ["android/hardware/radio/ims/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V1"], + imports: ["android.hardware.radio-V2"], backend: { cpp: { enabled: false, From 2600d345edd8db75999b7a8610ce7c1532142809 Mon Sep 17 00:00:00 2001 From: Sally Qi Date: Tue, 16 Aug 2022 12:46:17 -0700 Subject: [PATCH 294/998] Add getOverlaySupport() AIDL interface. - add new VTS for new AIDL interface/API. Disable this new vts case for now due to no implementation on cuttlefish. - rev up android.hardware.graphics.composer3-V1-ndk to V2 version. Bug: 242588489 Test: build, atest VtsHalGraphicsComposer3_TargetTest Change-Id: I5a5c0d52d7b64d927d211abf77f534f37c4d65d0 --- graphics/Android.bp | 4 +- .../graphics/composer3/IComposerClient.aidl | 1 + .../graphics/composer3/OverlayProperties.aidl | 38 ++++++++++++++++++ .../SupportedBufferCombinations.aidl | 39 +++++++++++++++++++ .../graphics/composer3/IComposerClient.aidl | 11 ++++++ .../graphics/composer3/OverlayProperties.aidl | 29 ++++++++++++++ .../SupportedBufferCombinations.aidl | 25 ++++++++++++ .../composer/aidl/vts/VtsComposerClient.cpp | 5 +++ .../composer/aidl/vts/VtsComposerClient.h | 2 + .../VtsHalGraphicsComposer3_TargetTest.cpp | 13 +++++++ 10 files changed, 165 insertions(+), 2 deletions(-) create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl create mode 100644 graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl create mode 100644 graphics/composer/aidl/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl diff --git a/graphics/Android.bp b/graphics/Android.bp index b48844d475..b17643e5b5 100644 --- a/graphics/Android.bp +++ b/graphics/Android.bp @@ -47,13 +47,13 @@ cc_defaults { cc_defaults { name: "android.hardware.graphics.composer3-ndk_static", static_libs: [ - "android.hardware.graphics.composer3-V1-ndk", + "android.hardware.graphics.composer3-V2-ndk", ], } cc_defaults { name: "android.hardware.graphics.composer3-ndk_shared", shared_libs: [ - "android.hardware.graphics.composer3-V1-ndk", + "android.hardware.graphics.composer3-V2-ndk", ], } diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl index b49f239ed0..a7e65353e1 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl @@ -75,6 +75,7 @@ interface IComposerClient { void setReadbackBuffer(long display, in android.hardware.common.NativeHandle buffer, in @nullable ParcelFileDescriptor releaseFence); void setVsyncEnabled(long display, boolean enabled); void setIdleTimerEnabled(long display, int timeoutMs); + android.hardware.graphics.composer3.OverlayProperties getOverlaySupport(); const int EX_BAD_CONFIG = 1; const int EX_BAD_DISPLAY = 2; const int EX_BAD_LAYER = 3; diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl new file mode 100644 index 0000000000..4d8fcac63e --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable OverlayProperties { + android.hardware.graphics.composer3.SupportedBufferCombinations[] combinations; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl new file mode 100644 index 0000000000..1828be1078 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl @@ -0,0 +1,39 @@ +/** + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable SupportedBufferCombinations { + android.hardware.graphics.common.PixelFormat[] pixelFormats; + android.hardware.graphics.common.Dataspace[] dataspaces; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl index a4ea64f815..88bb3a47ff 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl @@ -32,6 +32,7 @@ import android.hardware.graphics.composer3.DisplayIdentification; import android.hardware.graphics.composer3.FormatColorComponent; import android.hardware.graphics.composer3.HdrCapabilities; import android.hardware.graphics.composer3.IComposerCallback; +import android.hardware.graphics.composer3.OverlayProperties; import android.hardware.graphics.composer3.PerFrameMetadataKey; import android.hardware.graphics.composer3.PowerMode; import android.hardware.graphics.composer3.ReadbackBufferAttributes; @@ -814,4 +815,14 @@ interface IComposerClient { * */ void setIdleTimerEnabled(long display, int timeoutMs); + + /** + * Hardware overlays is a technique to composite different buffers directly to the screen + * while bypassing GPU composition. + * + * This function returns what the device's overlays support. + * + * @return the overlay properties of the device. + */ + OverlayProperties getOverlaySupport(); } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl new file mode 100644 index 0000000000..d3bd7d3b41 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl @@ -0,0 +1,29 @@ +/** + * 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. + */ + +package android.hardware.graphics.composer3; + +import android.hardware.graphics.composer3.SupportedBufferCombinations; + +@VintfStability +parcelable OverlayProperties { + // Array of all valid pixelformat and dataspace combinations. + // If all supported formats work with all supported dataspaces, + // then this list may only have 1 entry. + // If some dataspaces, e.g. scRGB, only work with specific formats, + // then this list may contain more than 1 entry. + SupportedBufferCombinations[] combinations; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl new file mode 100644 index 0000000000..41f88172b4 --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl @@ -0,0 +1,25 @@ +/** + * 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. + */ + +package android.hardware.graphics.composer3; + +@VintfStability +parcelable SupportedBufferCombinations { + // List of pixelformats and dataspaces that can be used together. + // All pixelformats and dataspaces stored inside are valid combinations. + android.hardware.graphics.common.PixelFormat[] pixelFormats; + android.hardware.graphics.common.Dataspace[] dataspaces; +} diff --git a/graphics/composer/aidl/vts/VtsComposerClient.cpp b/graphics/composer/aidl/vts/VtsComposerClient.cpp index 5bc7296f21..34cc80241c 100644 --- a/graphics/composer/aidl/vts/VtsComposerClient.cpp +++ b/graphics/composer/aidl/vts/VtsComposerClient.cpp @@ -338,6 +338,11 @@ std::pair VtsComposerClient::getDisplayPhysica outDisplayOrientation}; } +std::pair VtsComposerClient::getOverlaySupport() { + OverlayProperties properties; + return {mComposerClient->getOverlaySupport(&properties), properties}; +} + ScopedAStatus VtsComposerClient::setIdleTimerEnabled(int64_t display, int32_t timeoutMs) { return mComposerClient->setIdleTimerEnabled(display, timeoutMs); } diff --git a/graphics/composer/aidl/vts/VtsComposerClient.h b/graphics/composer/aidl/vts/VtsComposerClient.h index 3625c8ccfe..6358b85e0c 100644 --- a/graphics/composer/aidl/vts/VtsComposerClient.h +++ b/graphics/composer/aidl/vts/VtsComposerClient.h @@ -172,6 +172,8 @@ class VtsComposerClient { std::pair> getDisplays(); + std::pair getOverlaySupport(); + private: ScopedAStatus updateDisplayProperties(VtsDisplay* vtsDisplay, int32_t config); diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 93b646f498..78dce63dc2 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include #include #include @@ -808,6 +809,18 @@ TEST_P(GraphicsComposerAidlTest, GetDisplayName) { EXPECT_TRUE(status.isOk()); } +// TODO(b/250036572): disable this due to no implementation and revup on cuttlefish +TEST_P(GraphicsComposerAidlTest, DISABLED_GetOverlaySupport) { + const auto& [status, _] = mComposerClient->getOverlaySupport(); + if (!status.isOk() && status.getExceptionCode() == EX_SERVICE_SPECIFIC && + status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) { + GTEST_SUCCEED() << "getOverlaySupport is not supported"; + return; + } + + ASSERT_TRUE(status.isOk()); +} + TEST_P(GraphicsComposerAidlTest, GetDisplayPhysicalOrientation_BadDisplay) { const auto& [status, _] = mComposerClient->getDisplayPhysicalOrientation(getInvalidDisplayId()); From 3c237d763906ae495c9949ae1138deab3aa647aa Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Wed, 28 Sep 2022 17:39:23 +0000 Subject: [PATCH 295/998] AIDL effect: Add effect AIDL implementationi and vts test Bug: 238913361 Test: atest VtsHalAudioEffectTargetTest; atest VtsHalAudioEffectFactoryTargetTest Change-Id: If8000b7396360996bdfb8eb269bc3de543871673 --- audio/aidl/default/Android.bp | 13 +- audio/aidl/default/EffectFactory.cpp | 135 ++++- audio/aidl/default/EffectThread.cpp | 131 +++++ audio/aidl/default/equalizer/Android.bp | 17 +- audio/aidl/default/equalizer/Equalizer.cpp | 236 +++++++- .../include/effect-impl/EffectThread.h | 59 ++ .../default/include/effect-impl/EffectUUID.h | 45 ++ .../effectFactory-impl/EffectFactory.h | 21 + .../include/equalizer-impl/Equalizer.h | 51 -- .../include/equalizer-impl/EqualizerSw.h | 86 +++ .../include/visualizer-impl/Visualizer.h | 31 -- audio/aidl/vts/Android.bp | 32 ++ audio/aidl/vts/EffectFactoryHelper.h | 132 +++++ .../VtsHalAudioEffectFactoryTargetTest.cpp | 235 ++++++++ .../aidl/vts/VtsHalAudioEffectTargetTest.cpp | 502 ++++++++++++------ 15 files changed, 1435 insertions(+), 291 deletions(-) create mode 100644 audio/aidl/default/EffectThread.cpp create mode 100644 audio/aidl/default/include/effect-impl/EffectThread.h create mode 100644 audio/aidl/default/include/effect-impl/EffectUUID.h delete mode 100644 audio/aidl/default/include/equalizer-impl/Equalizer.h create mode 100644 audio/aidl/default/include/equalizer-impl/EqualizerSw.h delete mode 100644 audio/aidl/default/include/visualizer-impl/Visualizer.h create mode 100644 audio/aidl/vts/EffectFactoryHelper.h create mode 100644 audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp diff --git a/audio/aidl/default/Android.bp b/audio/aidl/default/Android.bp index 53ed908908..c48777f810 100644 --- a/audio/aidl/default/Android.bp +++ b/audio/aidl/default/Android.bp @@ -81,18 +81,23 @@ cc_defaults { cc_library_static { name: "libaudioeffectserviceexampleimpl", defaults: ["aidlaudioeffectservice_defaults"], - export_include_dirs: [ - "include", - "include/equalizer-impl/", - ], + export_include_dirs: ["include"], srcs: [ "EffectFactory.cpp", ], + header_libs: [ + "libsystem_headers", + ], visibility: [ ":__subpackages__", ], } +filegroup { + name: "effectCommonFile", + srcs: ["EffectThread.cpp"], +} + cc_binary { name: "android.hardware.audio.effect.service-aidl.example", relative_install_path: "hw", diff --git a/audio/aidl/default/EffectFactory.cpp b/audio/aidl/default/EffectFactory.cpp index a9848fd018..4877956ef7 100644 --- a/audio/aidl/default/EffectFactory.cpp +++ b/audio/aidl/default/EffectFactory.cpp @@ -16,57 +16,156 @@ #define LOG_TAG "AHAL_EffectFactory" #include +#include +#include "effect-impl/EffectUUID.h" #include "effectFactory-impl/EffectFactory.h" -#include "equalizer-impl/Equalizer.h" -#include "visualizer-impl/Visualizer.h" using aidl::android::media::audio::common::AudioUuid; namespace aidl::android::hardware::audio::effect { Factory::Factory() { - // TODO: implement this with xml parser on audio_effect.xml, and filter with optional - // parameters. + std::function dlClose = [](void* handle) -> void { + if (handle && dlclose(handle)) { + LOG(ERROR) << "dlclose failed " << dlerror(); + } + }; + // TODO: implement this with audio_effect.xml. + auto libHandle = + std::unique_ptr{dlopen("libequalizer.so", RTLD_LAZY), dlClose}; + if (!libHandle) { + LOG(ERROR) << __func__ << ": dlopen failed, err: " << dlerror(); + return; + } + + LOG(DEBUG) << __func__ << " dlopen uuid: " << EqualizerSwImplUUID.toString() << " handle " + << libHandle; + mEffectLibMap.insert({EqualizerSwImplUUID, std::make_pair(std::move(libHandle), nullptr)}); + Descriptor::Identity id; id.type = EqualizerTypeUUID; id.uuid = EqualizerSwImplUUID; mIdentityList.push_back(id); } -ndk::ScopedAStatus Factory::queryEffects(const std::optional& in_type, - const std::optional& in_instance, +Factory::~Factory() { + if (auto count = mEffectUuidMap.size()) { + LOG(ERROR) << __func__ << " remaining " << count + << " effect instances not destroyed indicating resource leak!"; + for (const auto& it : mEffectUuidMap) { + if (auto spEffect = it.first.lock()) { + LOG(ERROR) << __func__ << " erase remaining instance UUID " << it.second.toString(); + destroyEffectImpl(spEffect); + } + } + } +} + +ndk::ScopedAStatus Factory::queryEffects(const std::optional& in_type_uuid, + const std::optional& in_impl_uuid, std::vector* _aidl_return) { std::copy_if(mIdentityList.begin(), mIdentityList.end(), std::back_inserter(*_aidl_return), [&](auto& desc) { - return (!in_type.has_value() || in_type.value() == desc.type) && - (!in_instance.has_value() || in_instance.value() == desc.uuid); + return (!in_type_uuid.has_value() || in_type_uuid.value() == desc.type) && + (!in_impl_uuid.has_value() || in_impl_uuid.value() == desc.uuid); }); return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Factory::createEffect( - const AudioUuid& in_impl_uuid, - std::shared_ptr<::aidl::android::hardware::audio::effect::IEffect>* _aidl_return) { +#define RETURN_IF_BINDER_EXCEPTION(functor) \ + { \ + binder_exception_t exception = functor; \ + if (EX_NONE != exception) { \ + LOG(ERROR) << #functor << ": failed with error " << exception; \ + return ndk::ScopedAStatus::fromExceptionCode(exception); \ + } \ + } + +ndk::ScopedAStatus Factory::createEffect(const AudioUuid& in_impl_uuid, + std::shared_ptr* _aidl_return) { LOG(DEBUG) << __func__ << ": UUID " << in_impl_uuid.toString(); if (in_impl_uuid == EqualizerSwImplUUID) { - *_aidl_return = ndk::SharedRefBase::make(); + if (mEffectLibMap.count(in_impl_uuid)) { + auto& lib = mEffectLibMap[in_impl_uuid]; + // didn't do dlsym yet + if (nullptr == lib.second) { + void* libHandle = lib.first.get(); + struct effect_interface_s intf = { + .createEffectFunc = (EffectCreateFunctor)dlsym(libHandle, "createEffect"), + .destroyEffectFunc = + (EffectDestroyFunctor)dlsym(libHandle, "destroyEffect")}; + auto dlInterface = std::make_unique(intf); + if (!dlInterface->createEffectFunc || !dlInterface->destroyEffectFunc) { + LOG(ERROR) << __func__ + << ": create or destroy symbol not exist in library: " << libHandle + << "!"; + return ndk::ScopedAStatus::fromExceptionCode(EX_TRANSACTION_FAILED); + } + lib.second = std::move(dlInterface); + } + + auto& libInterface = lib.second; + std::shared_ptr effectSp; + RETURN_IF_BINDER_EXCEPTION(libInterface->createEffectFunc(&effectSp)); + if (!effectSp) { + LOG(ERROR) << __func__ << ": library created null instance without return error!"; + return ndk::ScopedAStatus::fromExceptionCode(EX_TRANSACTION_FAILED); + } + *_aidl_return = effectSp; + mEffectUuidMap[std::weak_ptr(effectSp)] = in_impl_uuid; + LOG(DEBUG) << __func__ << ": instance " << effectSp.get() << " created successfully"; + return ndk::ScopedAStatus::ok(); + } else { + LOG(ERROR) << __func__ << ": library doesn't exist"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } } else { - LOG(ERROR) << __func__ << ": UUID " - << " not supported"; + LOG(ERROR) << __func__ << ": UUID not supported"; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Factory::destroyEffect( - const std::shared_ptr<::aidl::android::hardware::audio::effect::IEffect>& in_handle) { - if (in_handle) { - // TODO: b/245393900 need check the instance state with IEffect.getState before destroy. +ndk::ScopedAStatus Factory::destroyEffectImpl(const std::shared_ptr& in_handle) { + std::weak_ptr wpHandle(in_handle); + // find UUID with key (std::weak_ptr) + if (auto uuidIt = mEffectUuidMap.find(wpHandle); uuidIt != mEffectUuidMap.end()) { + auto& uuid = uuidIt->second; + // find implementation library with UUID + if (auto libIt = mEffectLibMap.find(uuid); libIt != mEffectLibMap.end()) { + if (libIt->second.second->destroyEffectFunc) { + RETURN_IF_BINDER_EXCEPTION(libIt->second.second->destroyEffectFunc(in_handle)); + } + } else { + LOG(ERROR) << __func__ << ": UUID " << uuid.toString() << " does not exist in libMap!"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + mEffectUuidMap.erase(uuidIt); return ndk::ScopedAStatus::ok(); } else { + LOG(ERROR) << __func__ << ": instance " << in_handle << " does not exist!"; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } } +// go over the map and cleanup all expired weak_ptrs. +void Factory::cleanupEffectMap() { + for (auto it = mEffectUuidMap.begin(); it != mEffectUuidMap.end();) { + if (nullptr == it->first.lock()) { + it = mEffectUuidMap.erase(it); + } else { + ++it; + } + } +} + +ndk::ScopedAStatus Factory::destroyEffect(const std::shared_ptr& in_handle) { + LOG(DEBUG) << __func__ << ": instance " << in_handle.get(); + ndk::ScopedAStatus status = destroyEffectImpl(in_handle); + // always do the cleanup + cleanupEffectMap(); + return status; +} + } // namespace aidl::android::hardware::audio::effect diff --git a/audio/aidl/default/EffectThread.cpp b/audio/aidl/default/EffectThread.cpp new file mode 100644 index 0000000000..0ad9a146c6 --- /dev/null +++ b/audio/aidl/default/EffectThread.cpp @@ -0,0 +1,131 @@ +/* + * 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. + */ + +#define LOG_TAG "AHAL_EffectThread" +#include +#include +#include + +#include "effect-impl/EffectThread.h" + +namespace aidl::android::hardware::audio::effect { + +EffectThread::EffectThread() { + LOG(DEBUG) << __func__; +} + +EffectThread::~EffectThread() { + destroy(); + LOG(DEBUG) << __func__ << " done"; +}; + +RetCode EffectThread::create(const std::string& name, const int priority) { + if (mThread.joinable()) { + LOG(WARNING) << __func__ << " thread already created, no-op"; + return RetCode::SUCCESS; + } + mName = name; + mPriority = priority; + mThread = std::thread(&EffectThread::threadLoop, this); + LOG(DEBUG) << __func__ << " " << name << " priority " << mPriority << " done"; + return RetCode::SUCCESS; +} + +RetCode EffectThread::destroy() { + { + std::lock_guard lg(mMutex); + mStop = mExit = true; + } + mCv.notify_one(); + + if (mThread.joinable()) { + mThread.join(); + } + LOG(DEBUG) << __func__ << " done"; + return RetCode::SUCCESS; +} + +RetCode EffectThread::start() { + if (!mThread.joinable()) { + LOG(ERROR) << __func__ << " thread already destroyed"; + return RetCode::ERROR; + } + + { + std::lock_guard lg(mMutex); + if (!mStop) { + LOG(WARNING) << __func__ << " already start"; + return RetCode::SUCCESS; + } + mStop = false; + } + + mCv.notify_one(); + LOG(DEBUG) << __func__ << " done"; + return RetCode::SUCCESS; +} + +RetCode EffectThread::stop() { + if (!mThread.joinable()) { + LOG(ERROR) << __func__ << " thread already destroyed"; + return RetCode::ERROR; + } + + { + std::lock_guard lg(mMutex); + if (mStop) { + LOG(WARNING) << __func__ << " already stop"; + return RetCode::SUCCESS; + } + mStop = true; + } + LOG(DEBUG) << __func__ << " done"; + return RetCode::SUCCESS; +} + +void EffectThread::threadLoop() { + pthread_setname_np(pthread_self(), mName.substr(0, MAX_TASK_COMM_LEN - 1).c_str()); + setpriority(PRIO_PROCESS, 0, mPriority); + while (true) { + bool needExit = false; + { + std::unique_lock l(mMutex); + mCv.wait(l, [&]() REQUIRES(mMutex) { + needExit = mExit; + return mExit || !mStop; + }); + } + if (needExit) { + LOG(WARNING) << __func__ << " EXIT!"; + return; + } + // process without lock + process(); + } +} + +std::string toString(RetCode& code) { + switch (code) { + case RetCode::SUCCESS: + return "SUCCESS"; + case RetCode::ERROR: + return "ERROR"; + default: + return "EnumError"; + } +} + +} // namespace aidl::android::hardware::audio::effect diff --git a/audio/aidl/default/equalizer/Android.bp b/audio/aidl/default/equalizer/Android.bp index b842149241..9c11347941 100644 --- a/audio/aidl/default/equalizer/Android.bp +++ b/audio/aidl/default/equalizer/Android.bp @@ -27,17 +27,28 @@ cc_library_shared { name: "libequalizer", vendor: true, shared_libs: [ + "libaudioaidlcommon", "libbase", - "libbinder_ndk", - "libstagefright_foundation", + "android.hardware.common-V2-ndk", ], defaults: [ + "aidlaudioservice_defaults", "latest_android_media_audio_common_types_ndk_shared", "latest_android_hardware_audio_effect_ndk_shared", ], - include_dirs: ["hardware/interfaces/audio/aidl/default/include/equalizer-impl"], + include_dirs: [ + "hardware/interfaces/audio/aidl/default/include", + "system/media/audio/include", + ], srcs: [ "Equalizer.cpp", + ":effectCommonFile", + ], + cflags: [ + "-Wall", + "-Wextra", + "-Werror", + "-Wthread-safety", ], visibility: [ "//hardware/interfaces/audio/aidl/default", diff --git a/audio/aidl/default/equalizer/Equalizer.cpp b/audio/aidl/default/equalizer/Equalizer.cpp index 8b157faf0f..2e4e538b63 100644 --- a/audio/aidl/default/equalizer/Equalizer.cpp +++ b/audio/aidl/default/equalizer/Equalizer.cpp @@ -14,27 +14,243 @@ * limitations under the License. */ -#define LOG_TAG "AHAL_Equalizer" +#define LOG_TAG "AHAL_EqualizerSw" +#include #include +#include -#include "Equalizer.h" +#include "effect-impl/EffectUUID.h" +#include "equalizer-impl/EqualizerSw.h" + +using android::hardware::audio::common::getFrameSizeInBytes; namespace aidl::android::hardware::audio::effect { -ndk::ScopedAStatus Equalizer::open() { +extern "C" binder_exception_t createEffect(std::shared_ptr* instanceSpp) { + if (instanceSpp) { + *instanceSpp = ndk::SharedRefBase::make(); + LOG(DEBUG) << __func__ << " instance " << instanceSpp->get() << " created"; + return EX_NONE; + } else { + LOG(ERROR) << __func__ << " invalid input parameter!"; + return EX_ILLEGAL_ARGUMENT; + } +} + +extern "C" binder_exception_t destroyEffect(const std::shared_ptr& instanceSp) { + State state; + ndk::ScopedAStatus status = instanceSp->getState(&state); + if (!status.isOk() || State::INIT != state) { + LOG(ERROR) << __func__ << " instance " << instanceSp.get() + << " in state: " << toString(state) << ", status: " << status.getDescription(); + return EX_ILLEGAL_STATE; + } + LOG(DEBUG) << __func__ << " instance " << instanceSp.get() << " destroyed"; + return EX_NONE; +} + +ndk::ScopedAStatus EqualizerSw::open(const Parameter::Common& common, + const Parameter::Specific& specific, + OpenEffectReturn* _aidl_return) { + LOG(DEBUG) << __func__; + if (mState != State::INIT) { + LOG(WARNING) << __func__ << " eq already open"; + return ndk::ScopedAStatus::ok(); + } + + // Set essential parameters before create worker thread. + setCommonParameter(common); + setSpecificParameter(specific); + + LOG(DEBUG) << " common: " << common.toString() << " specific " << specific.toString(); + + auto& input = common.input; + auto& output = common.output; + size_t inputFrameSize = getFrameSizeInBytes(input.base.format, input.base.channelMask); + size_t outputFrameSize = getFrameSizeInBytes(output.base.format, output.base.channelMask); + if (!createFmq(1, input.frameCount * inputFrameSize, output.frameCount * outputFrameSize, + _aidl_return)) { + return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_UNSUPPORTED_OPERATION, + "FailedToCreateFmq"); + } + + // create the worker thread + if (RetCode::SUCCESS != mWorker->create(LOG_TAG)) { + LOG(ERROR) << __func__ << " created worker thread failed"; + destroyFmq(); + return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_UNSUPPORTED_OPERATION, + "FailedToCreateFmq"); + } + + mState = State::IDLE; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus EqualizerSw::close() { + if (mState == State::INIT) { + LOG(WARNING) << __func__ << " instance already closed"; + return ndk::ScopedAStatus::ok(); + } else if (mState == State::PROCESSING) { + LOG(ERROR) << __func__ << " instance still processing"; + return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_STATE, + "EqInstanceProcessing"); + } + + // stop the worker thread + mState = State::INIT; + mWorker->destroy(); + destroyFmq(); LOG(DEBUG) << __func__; return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus Equalizer::close() { - LOG(DEBUG) << __func__; - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus Equalizer::getDescriptor(Descriptor* _aidl_return) { - LOG(DEBUG) << __func__ << "descriptor " << mDesc.toString(); +ndk::ScopedAStatus EqualizerSw::getDescriptor(Descriptor* _aidl_return) { + LOG(DEBUG) << __func__ << mDesc.toString(); *_aidl_return = mDesc; return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus EqualizerSw::command(CommandId in_commandId) { + LOG(DEBUG) << __func__ << ": receive command:" << toString(in_commandId); + if (mState == State::INIT) { + LOG(ERROR) << __func__ << ": instance not open yet"; + return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_STATE, + "CommandStateError"); + } + switch (in_commandId) { + case CommandId::START: + // start processing. + mState = State::PROCESSING; + mWorker->start(); + LOG(DEBUG) << __func__ << " state: " << toString(mState); + return ndk::ScopedAStatus::ok(); + case CommandId::STOP: + // stop processing. + mState = State::IDLE; + mWorker->stop(); + LOG(DEBUG) << __func__ << " state: " << toString(mState); + return ndk::ScopedAStatus::ok(); + case CommandId::RESET: + // TODO: reset buffer status. + mState = State::IDLE; + mWorker->stop(); + LOG(DEBUG) << __func__ << " state: " << toString(mState); + return ndk::ScopedAStatus::ok(); + default: + return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, + "CommandIdNotSupported"); + } + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus EqualizerSw::setParameter(const Parameter& in_param) { + if (mState == State::INIT) { + LOG(ERROR) << __func__ << ": instance not open yet"; + return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_STATE, "StateError"); + } + LOG(DEBUG) << __func__ << " with: " << in_param.toString(); + auto tag = in_param.getTag(); + switch (tag) { + case Parameter::common: { + return setCommonParameter(in_param.get()); + } + case Parameter::specific: { + return setSpecificParameter(in_param.get()); + } + default: + return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, + "ParameterNotSupported"); + } +} + +ndk::ScopedAStatus EqualizerSw::getParameter(const Parameter::Id& in_paramId, + Parameter* _aidl_return) { + LOG(DEBUG) << __func__ << in_paramId.toString(); + auto tag = in_paramId.getTag(); + switch (tag) { + case Parameter::Id::commonTag: { + _aidl_return->set(mCommonParam); + LOG(DEBUG) << __func__ << " get: " << _aidl_return->toString(); + return ndk::ScopedAStatus::ok(); + } + case Parameter::Id::specificTag: { + auto& id = in_paramId.get(); + if (id != Parameter::Specific::equalizer) { + LOG(ERROR) << " unsupported parameter Id: " << in_paramId.toString(); + return ndk::ScopedAStatus::fromExceptionCodeWithMessage( + EX_ILLEGAL_ARGUMENT, "Parameter::IdNotSupported"); + } + Parameter::Specific specific; + specific.set(mEqualizerParam); + _aidl_return->set(specific); + LOG(DEBUG) << __func__ << _aidl_return->toString(); + return ndk::ScopedAStatus::ok(); + } + default: + return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, + "Parameter::IdNotSupported"); + } +} + +ndk::ScopedAStatus EqualizerSw::getState(State* _aidl_return) { + *_aidl_return = mState; + return ndk::ScopedAStatus::ok(); +} + +/// Private methods. +bool EqualizerSw::createFmq(int statusDepth, int inBufferSize, int outBufferSize, + OpenEffectReturn* ret) { + mStatusMQ = std::make_unique(statusDepth, true /*configureEventFlagWord*/); + mInputMQ = std::make_unique(inBufferSize); + mOutputMQ = std::make_unique(outBufferSize); + + if (!mStatusMQ->isValid() || !mInputMQ->isValid() || !mOutputMQ->isValid()) { + LOG(ERROR) << __func__ << " created invalid FMQ"; + return false; + } + ret->statusMQ = mStatusMQ->dupeDesc(); + ret->inputDataMQ = mInputMQ->dupeDesc(); + ret->outputDataMQ = mOutputMQ->dupeDesc(); + return true; +} + +void EqualizerSw::destroyFmq() { + mStatusMQ.reset(nullptr); + mInputMQ.reset(nullptr); + mOutputMQ.reset(nullptr); +} + +ndk::ScopedAStatus EqualizerSw::setCommonParameter(const Parameter::Common& common) { + mCommonParam = common; + LOG(DEBUG) << __func__ << " set: " << mCommonParam.toString(); + return ndk::ScopedAStatus::ok(); +} + +// TODO: implementation need change to save all parameters. +ndk::ScopedAStatus EqualizerSw::setSpecificParameter(const Parameter::Specific& specific) { + if (Parameter::Specific::equalizer != specific.getTag()) { + LOG(ERROR) << " unsupported effect: " << specific.toString(); + return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, + "EffectNotSupported"); + } + + mEqualizerParam = specific.get(); + LOG(DEBUG) << __func__ << mEqualizerParam.toString(); + return ndk::ScopedAStatus::ok(); +} + +void EqualizerSw::cleanUp() { + if (State::PROCESSING == mState) { + command(CommandId::STOP); + } + if (State::INIT != mState) { + close(); + } +} + +// Processing method running in worker thread. +void EqualizerSwWorker::process() { + // TODO: add EQ processing with FMQ, should wait until data available before data processing. +} + } // namespace aidl::android::hardware::audio::effect diff --git a/audio/aidl/default/include/effect-impl/EffectThread.h b/audio/aidl/default/include/effect-impl/EffectThread.h new file mode 100644 index 0000000000..e831cea4b3 --- /dev/null +++ b/audio/aidl/default/include/effect-impl/EffectThread.h @@ -0,0 +1,59 @@ +/* + * 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. + */ + +#pragma once +#include +#include +#include + +#include +#include + +namespace aidl::android::hardware::audio::effect { + +enum class RetCode { SUCCESS, ERROR }; + +std::string toString(RetCode& code); + +class EffectThread { + public: + // default priority is same as HIDL: ANDROID_PRIORITY_URGENT_AUDIO + EffectThread(); + virtual ~EffectThread(); + + // called by effect implementation. + RetCode create(const std::string& name, const int priority = ANDROID_PRIORITY_URGENT_AUDIO); + RetCode destroy(); + RetCode start(); + RetCode stop(); + + // Will call process() in a loop if the thread is running. + void threadLoop(); + + // User of EffectThread must implement the effect processing logic in this method. + virtual void process() = 0; + const int MAX_TASK_COMM_LEN = 15; + + private: + std::mutex mMutex; + std::condition_variable mCv; + bool mExit GUARDED_BY(mMutex) = false; + bool mStop GUARDED_BY(mMutex) = true; + std::thread mThread; + int mPriority; + std::string mName; +}; +} // namespace aidl::android::hardware::audio::effect diff --git a/audio/aidl/default/include/effect-impl/EffectUUID.h b/audio/aidl/default/include/effect-impl/EffectUUID.h new file mode 100644 index 0000000000..99f6c24d83 --- /dev/null +++ b/audio/aidl/default/include/effect-impl/EffectUUID.h @@ -0,0 +1,45 @@ +/* + * 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. + */ + +#pragma once +#include + +namespace aidl::android::hardware::audio::effect { + +using ::aidl::android::media::audio::common::AudioUuid; + +// Equalizer type UUID. +static const AudioUuid EqualizerTypeUUID = {static_cast(0x0bed4300), + 0xddd6, + 0x11db, + 0x8f34, + {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; + +// Equalizer implementation UUID. +static const AudioUuid EqualizerSwImplUUID = {static_cast(0x0bed4300), + 0x847d, + 0x11df, + 0xbb17, + {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; + +// Visualizer type UUID. +static const AudioUuid VisualizerTypeUUID = {static_cast(0x1d4033c0), + 0x8557, + 0x11df, + 0x9f2d, + {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; + +} // namespace aidl::android::hardware::audio::effect diff --git a/audio/aidl/default/include/effectFactory-impl/EffectFactory.h b/audio/aidl/default/include/effectFactory-impl/EffectFactory.h index 8da55258cf..d3730489bb 100644 --- a/audio/aidl/default/include/effectFactory-impl/EffectFactory.h +++ b/audio/aidl/default/include/effectFactory-impl/EffectFactory.h @@ -16,6 +16,8 @@ #pragma once +#include +#include #include #include @@ -63,7 +65,26 @@ class Factory : public BnFactory { override; private: + ~Factory(); // List of effect descriptors supported by the devices. std::vector mIdentityList; + + typedef binder_exception_t (*EffectCreateFunctor)(std::shared_ptr*); + typedef binder_exception_t (*EffectDestroyFunctor)(const std::shared_ptr&); + struct effect_interface_s { + EffectCreateFunctor createEffectFunc; + EffectDestroyFunctor destroyEffectFunc; + }; + + std::map> /* dlHandle */, + std::unique_ptr>> + mEffectLibMap; + std::map, aidl::android::media::audio::common::AudioUuid, + std::owner_less<>> + mEffectUuidMap; + + ndk::ScopedAStatus destroyEffectImpl(const std::shared_ptr& in_handle); + void cleanupEffectMap(); }; } // namespace aidl::android::hardware::audio::effect diff --git a/audio/aidl/default/include/equalizer-impl/Equalizer.h b/audio/aidl/default/include/equalizer-impl/Equalizer.h deleted file mode 100644 index ea16cb9fac..0000000000 --- a/audio/aidl/default/include/equalizer-impl/Equalizer.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include -#include - -namespace aidl::android::hardware::audio::effect { - -// Equalizer type UUID. -static const ::aidl::android::media::audio::common::AudioUuid EqualizerTypeUUID = { - static_cast(0x0bed4300), - 0xddd6, - 0x11db, - 0x8f34, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; - -// Equalizer implementation UUID. -static const ::aidl::android::media::audio::common::AudioUuid EqualizerSwImplUUID = { - static_cast(0x0bed4300), - 0x847d, - 0x11df, - 0xbb17, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; - -class Equalizer : public BnEffect { - public: - Equalizer() = default; - ndk::ScopedAStatus open() override; - ndk::ScopedAStatus close() override; - ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override; - - private: - // Effect descriptor. - Descriptor mDesc = {.common = {.id = {.type = EqualizerTypeUUID, .uuid = EqualizerSwImplUUID}}}; -}; -} // namespace aidl::android::hardware::audio::effect diff --git a/audio/aidl/default/include/equalizer-impl/EqualizerSw.h b/audio/aidl/default/include/equalizer-impl/EqualizerSw.h new file mode 100644 index 0000000000..58ad1dee1d --- /dev/null +++ b/audio/aidl/default/include/equalizer-impl/EqualizerSw.h @@ -0,0 +1,86 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include + +#include "effect-impl/EffectThread.h" + +namespace aidl::android::hardware::audio::effect { + +class EqualizerSwWorker : public EffectThread { + // EqualizerSwWorker(const std::string name){EffectThread(name)}; + void process() override; +}; + +class EqualizerSw : public BnEffect { + public: + EqualizerSw() { + // create the worker + mWorker = std::make_unique(); + LOG(DEBUG) << __func__; + }; + ~EqualizerSw() { + cleanUp(); + LOG(DEBUG) << __func__; + }; + ndk::ScopedAStatus open(const Parameter::Common& common, const Parameter::Specific& specific, + OpenEffectReturn* _aidl_return) override; + ndk::ScopedAStatus close() override; + ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override; + + ndk::ScopedAStatus getState(State* _aidl_return) override; + ndk::ScopedAStatus command(CommandId in_commandId) override; + ndk::ScopedAStatus setParameter(const Parameter& in_param) override; + ndk::ScopedAStatus getParameter(const Parameter::Id& in_paramId, + Parameter* _aidl_return) override; + + private: + // effect processing thread. + std::unique_ptr mWorker; + // Effect descriptor. + const Descriptor mDesc = { + .common = {.id = {.type = EqualizerTypeUUID, .uuid = EqualizerSwImplUUID}}}; + + // Parameters. + Parameter::Common mCommonParam; + Equalizer mEqualizerParam; // TODO: the equalizer parameter needs to update + + // Instance state INIT by default. + State mState = State::INIT; + + typedef ::android::AidlMessageQueue< + Status, ::aidl::android::hardware::common::fmq::SynchronizedReadWrite> + StatusMQ; + typedef ::android::AidlMessageQueue< + int8_t, ::aidl::android::hardware::common::fmq::SynchronizedReadWrite> + DataMQ; + + std::unique_ptr mStatusMQ; + std::unique_ptr mInputMQ; + std::unique_ptr mOutputMQ; + + ndk::ScopedAStatus setCommonParameter(const Parameter::Common& common_param); + ndk::ScopedAStatus setSpecificParameter(const Parameter::Specific& specific); + bool createFmq(int statusDepth, int inBufferSize, int outBufferSize, OpenEffectReturn* ret); + void destroyFmq(); + void cleanUp(); +}; +} // namespace aidl::android::hardware::audio::effect diff --git a/audio/aidl/default/include/visualizer-impl/Visualizer.h b/audio/aidl/default/include/visualizer-impl/Visualizer.h deleted file mode 100644 index 4b82dd0911..0000000000 --- a/audio/aidl/default/include/visualizer-impl/Visualizer.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include - -namespace aidl::android::hardware::audio::effect { - -// Visualizer implementation UUID. -static const ::aidl::android::media::audio::common::AudioUuid VisualizerUUID = { - static_cast(0x1d4033c0), - 0x8557, - 0x11df, - 0x9f2d, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; - -} // namespace aidl::android::hardware::audio::effect \ No newline at end of file diff --git a/audio/aidl/vts/Android.bp b/audio/aidl/vts/Android.bp index 6ea7cef0e2..63fc4158b5 100644 --- a/audio/aidl/vts/Android.bp +++ b/audio/aidl/vts/Android.bp @@ -42,6 +42,36 @@ cc_test { ], } +cc_test { + name: "VtsHalAudioEffectFactoryTargetTest", + defaults: [ + "latest_android_media_audio_common_types_ndk_static", + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + srcs: [ + "VtsHalAudioEffectFactoryTargetTest.cpp", + ], + shared_libs: [ + "libbinder_ndk", + ], + static_libs: [ + "android.hardware.audio.effect-V1-ndk", + "android.hardware.common-V2-ndk", + "android.hardware.common.fmq-V1-ndk", + ], + cflags: [ + "-Wall", + "-Wextra", + "-Werror", + "-Wthread-safety", + ], + test_suites: [ + "general-tests", + "vts", + ], +} + cc_test { name: "VtsHalAudioEffectTargetTest", defaults: [ @@ -57,6 +87,8 @@ cc_test { ], static_libs: [ "android.hardware.audio.effect-V1-ndk", + "android.hardware.common-V2-ndk", + "android.hardware.common.fmq-V1-ndk", ], cflags: [ "-Wall", diff --git a/audio/aidl/vts/EffectFactoryHelper.h b/audio/aidl/vts/EffectFactoryHelper.h new file mode 100644 index 0000000000..3cbca45eb4 --- /dev/null +++ b/audio/aidl/vts/EffectFactoryHelper.h @@ -0,0 +1,132 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include + +#include + +#include "TestUtils.h" + +using namespace android; + +using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::IEffect; +using aidl::android::hardware::audio::effect::IFactory; +using aidl::android::hardware::audio::effect::Parameter; +using aidl::android::media::audio::common::AudioUuid; + +class EffectFactoryHelper { + public: + explicit EffectFactoryHelper(const std::string& name) : mServiceName(name) {} + + void ConnectToFactoryService() { + mEffectFactory = IFactory::fromBinder(binderUtil.connectToService(mServiceName)); + ASSERT_NE(mEffectFactory, nullptr); + } + + void RestartFactoryService() { + ASSERT_NE(mEffectFactory, nullptr); + mEffectFactory = IFactory::fromBinder(binderUtil.restartService()); + ASSERT_NE(mEffectFactory, nullptr); + ClearEffectMap(); + } + + void QueryEffects(const std::optional& in_type, + const std::optional& in_instance, + std::vector* _aidl_return) { + ASSERT_NE(mEffectFactory, nullptr); + EXPECT_IS_OK(mEffectFactory->queryEffects(in_type, in_instance, _aidl_return)); + mIds = *_aidl_return; + } + + void CreateEffects() { + ASSERT_NE(mEffectFactory, nullptr); + for (const auto& id : mIds) { + std::shared_ptr effect; + EXPECT_IS_OK(mEffectFactory->createEffect(id.uuid, &effect)); + EXPECT_NE(effect, nullptr) << id.toString(); + if (effect) { + mEffectIdMap[effect] = id; + } + } + } + + void CreateEffectsAndExpect( + const std::vector>& uuid_status) { + ASSERT_NE(mEffectFactory, nullptr); + for (const auto& it : uuid_status) { + std::shared_ptr effect; + auto status = mEffectFactory->createEffect(it.first.uuid, &effect); + EXPECT_STATUS(it.second, status); + if (effect) { + mEffectIdMap[effect] = it.first; + } + } + } + + void DestroyEffectAndExpect(std::shared_ptr& instance, binder_exception_t exception) { + ASSERT_NE(mEffectFactory, nullptr); + auto status = mEffectFactory->destroyEffect(instance); + EXPECT_STATUS(exception, status); + } + + void QueryAndCreateAllEffects() { + ASSERT_NE(mEffectFactory, nullptr); + EXPECT_IS_OK(mEffectFactory->queryEffects(std::nullopt, std::nullopt, &mCompleteIds)); + for (const auto& id : mCompleteIds) { + std::shared_ptr effect; + EXPECT_IS_OK(mEffectFactory->createEffect(id.uuid, &effect)); + EXPECT_NE(effect, nullptr) << id.toString(); + mEffectIdMap[effect] = id; + } + } + + void DestroyEffects(const binder_exception_t expected = EX_NONE, const int remaining = 0) { + ASSERT_NE(mEffectFactory, nullptr); + + for (auto it = mEffectIdMap.begin(); it != mEffectIdMap.end();) { + auto erased = it++; + auto status = mEffectFactory->destroyEffect(erased->first); + EXPECT_STATUS(expected, status); + if (status.isOk()) { + mEffectIdMap.erase(erased); + } + } + EXPECT_EQ((unsigned int)remaining, mEffectIdMap.size()); + } + + std::shared_ptr GetFactory() { return mEffectFactory; } + const std::vector& GetEffectIds() { return mIds; } + const std::vector& GetCompleteEffectIdList() { return mCompleteIds; } + const std::map, Descriptor::Identity>& GetEffectMap() { + return mEffectIdMap; + } + void ClearEffectMap() { mEffectIdMap.clear(); } + + private: + std::shared_ptr mEffectFactory; + std::string mServiceName; + AudioHalBinderServiceUtil binderUtil; + std::vector mIds; + std::vector mCompleteIds; + + std::map, Descriptor::Identity> mEffectIdMap; +}; diff --git a/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp new file mode 100644 index 0000000000..dd17a6fc0d --- /dev/null +++ b/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp @@ -0,0 +1,235 @@ +/* + * 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. + */ + +#include +#include +#include + +#define LOG_TAG "VtsHalAudioEffectFactory" + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "AudioHalBinderServiceUtil.h" +#include "EffectFactoryHelper.h" +#include "TestUtils.h" + +using namespace android; + +using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::IFactory; +using aidl::android::media::audio::common::AudioUuid; + +/// Effect factory testing. +class EffectFactoryTest : public testing::TestWithParam { + public: + void SetUp() override { ASSERT_NO_FATAL_FAILURE(mFactory.ConnectToFactoryService()); } + + void TearDown() override { mFactory.DestroyEffects(); } + + EffectFactoryHelper mFactory = EffectFactoryHelper(GetParam()); + + // TODO: these UUID can get from config file + // ec7178ec-e5e1-4432-a3f4-4657e6795210 + const AudioUuid nullUuid = {static_cast(0xec7178ec), + 0xe5e1, + 0x4432, + 0xa3f4, + {0x46, 0x57, 0xe6, 0x79, 0x52, 0x10}}; + const AudioUuid zeroUuid = { + static_cast(0x0), 0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}; + const Descriptor::Identity nullDesc = {.uuid = nullUuid}; + const Descriptor::Identity zeroDesc = {.uuid = zeroUuid}; +}; + +TEST_P(EffectFactoryTest, SetupAndTearDown) { + // Intentionally empty test body. +} + +TEST_P(EffectFactoryTest, CanBeRestarted) { + ASSERT_NO_FATAL_FAILURE(mFactory.RestartFactoryService()); +} + +TEST_P(EffectFactoryTest, QueriedDescriptorList) { + std::vector descriptors; + mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors); + EXPECT_NE(descriptors.size(), 0UL); +} + +TEST_P(EffectFactoryTest, DescriptorUUIDNotNull) { + std::vector descriptors; + mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors); + // TODO: Factory eventually need to return the full list of MUST supported AOSP effects. + for (auto& desc : descriptors) { + EXPECT_NE(desc.type, zeroUuid); + EXPECT_NE(desc.uuid, zeroUuid); + } +} + +TEST_P(EffectFactoryTest, QueriedDescriptorNotExistType) { + std::vector descriptors; + mFactory.QueryEffects(nullUuid, std::nullopt, &descriptors); + EXPECT_EQ(descriptors.size(), 0UL); +} + +TEST_P(EffectFactoryTest, QueriedDescriptorNotExistInstance) { + std::vector descriptors; + mFactory.QueryEffects(std::nullopt, nullUuid, &descriptors); + EXPECT_EQ(descriptors.size(), 0UL); +} + +TEST_P(EffectFactoryTest, CreateAndDestroyOnce) { + std::vector descriptors; + mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors); + auto numIds = mFactory.GetEffectIds().size(); + EXPECT_NE(numIds, 0UL); + + auto& effectMap = mFactory.GetEffectMap(); + EXPECT_EQ(effectMap.size(), 0UL); + mFactory.CreateEffects(); + EXPECT_EQ(effectMap.size(), numIds); + mFactory.DestroyEffects(); + EXPECT_EQ(effectMap.size(), 0UL); +} + +TEST_P(EffectFactoryTest, CreateAndDestroyRepeat) { + std::vector descriptors; + mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors); + auto numIds = mFactory.GetEffectIds().size(); + EXPECT_NE(numIds, 0UL); + + auto& effectMap = mFactory.GetEffectMap(); + EXPECT_EQ(effectMap.size(), 0UL); + mFactory.CreateEffects(); + EXPECT_EQ(effectMap.size(), numIds); + mFactory.DestroyEffects(); + EXPECT_EQ(effectMap.size(), 0UL); + + // Create and destroy again + mFactory.CreateEffects(); + EXPECT_EQ(effectMap.size(), numIds); + mFactory.DestroyEffects(); + EXPECT_EQ(effectMap.size(), 0UL); +} + +TEST_P(EffectFactoryTest, CreateMultipleInstanceOfSameEffect) { + std::vector descriptors; + mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors); + auto numIds = mFactory.GetEffectIds().size(); + EXPECT_NE(numIds, 0UL); + + auto& effectMap = mFactory.GetEffectMap(); + EXPECT_EQ(effectMap.size(), 0UL); + mFactory.CreateEffects(); + EXPECT_EQ(effectMap.size(), numIds); + // Create effect instances of same implementation + mFactory.CreateEffects(); + EXPECT_EQ(effectMap.size(), 2 * numIds); + + mFactory.CreateEffects(); + EXPECT_EQ(effectMap.size(), 3 * numIds); + + mFactory.DestroyEffects(); + EXPECT_EQ(effectMap.size(), 0UL); +} + +// Expect EX_ILLEGAL_ARGUMENT when create with invalid UUID. +TEST_P(EffectFactoryTest, CreateWithInvalidUuid) { + std::vector> descriptors; + descriptors.push_back(std::make_pair(nullDesc, EX_ILLEGAL_ARGUMENT)); + descriptors.push_back(std::make_pair(zeroDesc, EX_ILLEGAL_ARGUMENT)); + + auto& effectMap = mFactory.GetEffectMap(); + mFactory.CreateEffectsAndExpect(descriptors); + EXPECT_EQ(effectMap.size(), 0UL); +} + +// Expect EX_ILLEGAL_ARGUMENT when destroy null interface. +TEST_P(EffectFactoryTest, DestroyWithInvalidInterface) { + std::shared_ptr spDummyEffect(nullptr); + + mFactory.DestroyEffectAndExpect(spDummyEffect, EX_ILLEGAL_ARGUMENT); +} + +TEST_P(EffectFactoryTest, CreateAndRemoveReference) { + std::vector descriptors; + mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors); + auto numIds = mFactory.GetEffectIds().size(); + EXPECT_NE(numIds, 0UL); + + auto& effectMap = mFactory.GetEffectMap(); + EXPECT_EQ(effectMap.size(), 0UL); + mFactory.CreateEffects(); + EXPECT_EQ(effectMap.size(), numIds); + // remove all reference + mFactory.ClearEffectMap(); + EXPECT_EQ(effectMap.size(), 0UL); +} + +TEST_P(EffectFactoryTest, CreateRemoveReferenceAndCreateDestroy) { + std::vector descriptors; + mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors); + auto numIds = mFactory.GetEffectIds().size(); + EXPECT_NE(numIds, 0UL); + + auto& effectMap = mFactory.GetEffectMap(); + EXPECT_EQ(effectMap.size(), 0UL); + mFactory.CreateEffects(); + EXPECT_EQ(effectMap.size(), numIds); + // remove all reference + mFactory.ClearEffectMap(); + EXPECT_EQ(effectMap.size(), 0UL); + + // Create and destroy again + mFactory.CreateEffects(); + EXPECT_EQ(effectMap.size(), numIds); + mFactory.DestroyEffects(); + EXPECT_EQ(effectMap.size(), 0UL); +} + +TEST_P(EffectFactoryTest, CreateRestartAndCreateDestroy) { + std::vector descriptors; + mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors); + auto numIds = mFactory.GetEffectIds().size(); + auto& effectMap = mFactory.GetEffectMap(); + mFactory.CreateEffects(); + EXPECT_EQ(effectMap.size(), numIds); + ASSERT_NO_FATAL_FAILURE(mFactory.RestartFactoryService()); + + mFactory.CreateEffects(); + EXPECT_EQ(effectMap.size(), numIds); + mFactory.DestroyEffects(); + EXPECT_EQ(effectMap.size(), 0UL); +} + +INSTANTIATE_TEST_SUITE_P(EffectFactoryTest, EffectFactoryTest, + testing::ValuesIn(android::getAidlHalInstanceNames(IFactory::descriptor)), + android::PrintInstanceNameToString); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EffectFactoryTest); + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + ABinderProcess_setThreadPoolMaxThreadCount(1); + ABinderProcess_startThreadPool(); + return RUN_ALL_TESTS(); +} \ No newline at end of file diff --git a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp index 8b5eb13cdb..23b20bd1fb 100644 --- a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp @@ -30,205 +30,68 @@ #include #include +#include #include +#include +#include #include "AudioHalBinderServiceUtil.h" +#include "EffectFactoryHelper.h" #include "TestUtils.h" using namespace android; using ndk::ScopedAStatus; +using aidl::android::hardware::audio::effect::CommandId; using aidl::android::hardware::audio::effect::Descriptor; using aidl::android::hardware::audio::effect::IEffect; using aidl::android::hardware::audio::effect::IFactory; -using aidl::android::media::audio::common::AudioUuid; +using aidl::android::hardware::audio::effect::Parameter; +using aidl::android::hardware::audio::effect::State; +using aidl::android::media::audio::common::AudioChannelLayout; +using aidl::android::media::audio::common::AudioDeviceType; -class EffectFactoryHelper { - public: - explicit EffectFactoryHelper(const std::string& name) : mServiceName(name) {} - - void ConnectToFactoryService() { - mEffectFactory = IFactory::fromBinder(binderUtil.connectToService(mServiceName)); - ASSERT_NE(mEffectFactory, nullptr); - } - - void RestartFactoryService() { - ASSERT_NE(mEffectFactory, nullptr); - mEffectFactory = IFactory::fromBinder(binderUtil.restartService()); - ASSERT_NE(mEffectFactory, nullptr); - } - - void QueryAllEffects() { - EXPECT_NE(mEffectFactory, nullptr); - EXPECT_IS_OK(mEffectFactory->queryEffects(std::nullopt, std::nullopt, &mCompleteIds)); - } - - void QueryEffects(const std::optional& in_type, - const std::optional& in_instance, - std::vector* _aidl_return) { - EXPECT_NE(mEffectFactory, nullptr); - EXPECT_IS_OK(mEffectFactory->queryEffects(in_type, in_instance, _aidl_return)); - mIds = *_aidl_return; - } - - void CreateEffects() { - EXPECT_NE(mEffectFactory, nullptr); - for (const auto& id : mIds) { - std::shared_ptr effect; - EXPECT_IS_OK(mEffectFactory->createEffect(id.uuid, &effect)); - EXPECT_NE(effect, nullptr) << id.toString(); - mEffectIdMap[effect] = id; - } - } - - void DestroyEffects() { - EXPECT_NE(mEffectFactory, nullptr); - for (const auto& it : mEffectIdMap) { - EXPECT_IS_OK(mEffectFactory->destroyEffect(it.first)); - } - mEffectIdMap.clear(); - } - - std::shared_ptr GetFactory() { return mEffectFactory; } - const std::vector& GetEffectIds() { return mIds; } - const std::vector& GetCompleteEffectIdList() { return mCompleteIds; } - const std::unordered_map, Descriptor::Identity>& GetEffectMap() { - return mEffectIdMap; - } - - private: - std::shared_ptr mEffectFactory; - std::string mServiceName; - AudioHalBinderServiceUtil binderUtil; - std::vector mIds; - std::vector mCompleteIds; - std::unordered_map, Descriptor::Identity> mEffectIdMap; -}; - -/// Effect factory testing. -class EffectFactoryTest : public testing::TestWithParam { - public: - void SetUp() override { ASSERT_NO_FATAL_FAILURE(mFactory.ConnectToFactoryService()); } - - void TearDown() override { mFactory.DestroyEffects(); } - - EffectFactoryHelper mFactory = EffectFactoryHelper(GetParam()); - - // TODO: these UUID can get from config file - // ec7178ec-e5e1-4432-a3f4-4657e6795210 - const AudioUuid nullUuid = {static_cast(0xec7178ec), - 0xe5e1, - 0x4432, - 0xa3f4, - {0x46, 0x57, 0xe6, 0x79, 0x52, 0x10}}; - const AudioUuid zeroUuid = { - static_cast(0x0), 0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}; -}; - -TEST_P(EffectFactoryTest, SetupAndTearDown) { - // Intentionally empty test body. -} - -TEST_P(EffectFactoryTest, CanBeRestarted) { - ASSERT_NO_FATAL_FAILURE(mFactory.RestartFactoryService()); -} - -TEST_P(EffectFactoryTest, QueriedDescriptorList) { - std::vector descriptors; - mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors); - EXPECT_NE(descriptors.size(), 0UL); -} - -TEST_P(EffectFactoryTest, DescriptorUUIDNotNull) { - std::vector descriptors; - mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors); - // TODO: Factory eventually need to return the full list of MUST supported AOSP effects. - for (auto& desc : descriptors) { - EXPECT_NE(desc.type, zeroUuid); - EXPECT_NE(desc.uuid, zeroUuid); - } -} - -TEST_P(EffectFactoryTest, QueriedDescriptorNotExistType) { - std::vector descriptors; - mFactory.QueryEffects(nullUuid, std::nullopt, &descriptors); - EXPECT_EQ(descriptors.size(), 0UL); -} - -TEST_P(EffectFactoryTest, QueriedDescriptorNotExistInstance) { - std::vector descriptors; - mFactory.QueryEffects(std::nullopt, nullUuid, &descriptors); - EXPECT_EQ(descriptors.size(), 0UL); -} - -TEST_P(EffectFactoryTest, CreateAndDestroyRepeat) { - std::vector descriptors; - mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors); - auto numIds = mFactory.GetEffectIds().size(); - EXPECT_NE(numIds, 0UL); - - EXPECT_EQ(mFactory.GetEffectMap().size(), 0UL); - mFactory.CreateEffects(); - EXPECT_EQ(mFactory.GetEffectMap().size(), numIds); - mFactory.DestroyEffects(); - EXPECT_EQ(mFactory.GetEffectMap().size(), 0UL); - - // Create and destroy again - mFactory.CreateEffects(); - EXPECT_EQ(mFactory.GetEffectMap().size(), numIds); - mFactory.DestroyEffects(); - EXPECT_EQ(mFactory.GetEffectMap().size(), 0UL); -} - -TEST_P(EffectFactoryTest, CreateMultipleInstanceOfSameEffect) { - std::vector descriptors; - mFactory.QueryEffects(std::nullopt, std::nullopt, &descriptors); - auto numIds = mFactory.GetEffectIds().size(); - EXPECT_NE(numIds, 0UL); - - EXPECT_EQ(mFactory.GetEffectMap().size(), 0UL); - mFactory.CreateEffects(); - EXPECT_EQ(mFactory.GetEffectMap().size(), numIds); - // Create effect instances of same implementation - mFactory.CreateEffects(); - EXPECT_EQ(mFactory.GetEffectMap().size(), 2 * numIds); - - mFactory.CreateEffects(); - EXPECT_EQ(mFactory.GetEffectMap().size(), 3 * numIds); - - mFactory.DestroyEffects(); - EXPECT_EQ(mFactory.GetEffectMap().size(), 0UL); -} - -INSTANTIATE_TEST_SUITE_P(EffectFactoryTest, EffectFactoryTest, - testing::ValuesIn(android::getAidlHalInstanceNames(IFactory::descriptor)), - android::PrintInstanceNameToString); -GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EffectFactoryTest); - -/// Effect testing. class AudioEffect : public testing::TestWithParam { public: void SetUp() override { - ASSERT_NO_FATAL_FAILURE(mFactory.ConnectToFactoryService()); - ASSERT_NO_FATAL_FAILURE(mFactory.CreateEffects()); + ASSERT_NO_FATAL_FAILURE(mFactoryHelper.ConnectToFactoryService()); + CreateEffects(); + initParamCommon(); + initParamSpecific(); } void TearDown() override { CloseEffects(); - ASSERT_NO_FATAL_FAILURE(mFactory.DestroyEffects()); + DestroyEffects(); } void OpenEffects() { - auto open = [](const std::shared_ptr& effect) { EXPECT_IS_OK(effect->open()); }; + auto open = [&](const std::shared_ptr& effect) { + IEffect::OpenEffectReturn ret; + EXPECT_IS_OK(effect->open(mCommon, mSpecific, &ret)); + }; EXPECT_NO_FATAL_FAILURE(ForEachEffect(open)); } - void CloseEffects() { - auto close = [](const std::shared_ptr& effect) { EXPECT_IS_OK(effect->close()); }; + void CloseEffects(const binder_status_t status = EX_NONE) { + auto close = [&](const std::shared_ptr& effect) { + EXPECT_STATUS(status, effect->close()); + }; + EXPECT_NO_FATAL_FAILURE(ForEachEffect(close)); } + void CreateEffects(const int n = 1) { + for (int i = 0; i < n; i++) { + ASSERT_NO_FATAL_FAILURE(mFactoryHelper.QueryAndCreateAllEffects()); + } + } + + void DestroyEffects(const binder_status_t status = EX_NONE, const int remaining = 0) { + ASSERT_NO_FATAL_FAILURE(mFactoryHelper.DestroyEffects(status, remaining)); + } + void GetEffectDescriptors() { auto get = [](const std::shared_ptr& effect) { Descriptor desc; @@ -237,16 +100,101 @@ class AudioEffect : public testing::TestWithParam { EXPECT_NO_FATAL_FAILURE(ForEachEffect(get)); } + void CommandEffects(CommandId command) { + auto close = [&](const std::shared_ptr& effect) { + EXPECT_IS_OK(effect->command(command)); + }; + EXPECT_NO_FATAL_FAILURE(ForEachEffect(close)); + } + + void CommandEffectsExpectStatus(CommandId command, const binder_status_t status) { + auto func = [&](const std::shared_ptr& effect) { + EXPECT_STATUS(status, effect->command(command)); + }; + EXPECT_NO_FATAL_FAILURE(ForEachEffect(func)); + } + + void ExpectState(State expected) { + auto get = [&](const std::shared_ptr& effect) { + State state = State::INIT; + EXPECT_IS_OK(effect->getState(&state)); + EXPECT_EQ(expected, state); + }; + EXPECT_NO_FATAL_FAILURE(ForEachEffect(get)); + } + + void SetParameter() { + auto func = [&](const std::shared_ptr& effect) { + Parameter param; + param.set(mCommon); + EXPECT_IS_OK(effect->setParameter(param)); + }; + EXPECT_NO_FATAL_FAILURE(ForEachEffect(func)); + } + + void VerifyParameters() { + auto func = [&](const std::shared_ptr& effect) { + Parameter paramCommonGet = Parameter(), paramCommonExpect = Parameter(); + Parameter::Id id; + id.set(0); + paramCommonExpect.set(mCommon); + EXPECT_IS_OK(effect->getParameter(id, ¶mCommonGet)); + EXPECT_EQ(paramCommonExpect, paramCommonGet) + << paramCommonExpect.toString() << " vs " << paramCommonGet.toString(); + }; + EXPECT_NO_FATAL_FAILURE(ForEachEffect(func)); + } + template void ForEachEffect(Functor functor) { - auto effectMap = mFactory.GetEffectMap(); + auto effectMap = mFactoryHelper.GetEffectMap(); for (const auto& it : effectMap) { SCOPED_TRACE(it.second.toString()); functor(it.first); } } - EffectFactoryHelper mFactory = EffectFactoryHelper(GetParam()); + void initParamCommon(int session = -1, int ioHandle = -1, + AudioDeviceType deviceType = AudioDeviceType::NONE, + int iSampleRate = 48000, int oSampleRate = 48000, long iFrameCount = 0x100, + long oFrameCount = 0x100) { + mCommon.session = session; + mCommon.ioHandle = ioHandle; + mCommon.device.type = deviceType; + mCommon.input.base.sampleRate = iSampleRate; + mCommon.input.base.channelMask = mInputChannelLayout; + mCommon.input.frameCount = iFrameCount; + mCommon.output.base.sampleRate = oSampleRate; + mCommon.output.base.channelMask = mOutputChannelLayout; + mCommon.output.frameCount = oFrameCount; + } + + void initParamSpecific(Parameter::Specific::Tag tag = Parameter::Specific::equalizer) { + switch (tag) { + case Parameter::Specific::equalizer: + mSpecific.set(); + break; + default: + return; + } + } + + void setInputChannelLayout(AudioChannelLayout input) { mInputChannelLayout = input; } + void setOutputChannelLayout(AudioChannelLayout output) { mOutputChannelLayout = output; } + + EffectFactoryHelper mFactoryHelper = EffectFactoryHelper(GetParam()); + + private: + AudioChannelLayout mInputChannelLayout = + AudioChannelLayout::make( + AudioChannelLayout::LAYOUT_STEREO); + AudioChannelLayout mOutputChannelLayout = + AudioChannelLayout::make( + AudioChannelLayout::LAYOUT_STEREO); + + Parameter::Common mCommon; + Parameter::Specific mSpecific; + static IEffect::OpenEffectReturn mOpenReturn; }; TEST_P(AudioEffect, OpenEffectTest) { @@ -286,7 +234,7 @@ TEST_P(AudioEffect, DescriptorIdExistAndUnique) { Descriptor desc; std::vector idList; EXPECT_IS_OK(effect->getDescriptor(&desc)); - mFactory.QueryEffects(desc.common.id.type, desc.common.id.uuid, &idList); + mFactoryHelper.QueryEffects(desc.common.id.type, desc.common.id.uuid, &idList); EXPECT_EQ(idList.size(), 1UL); }; EXPECT_NO_FATAL_FAILURE(ForEachEffect(checker)); @@ -295,7 +243,7 @@ TEST_P(AudioEffect, DescriptorIdExistAndUnique) { auto stringHash = [](const Descriptor::Identity& id) { return std::hash()(id.toString()); }; - auto vec = mFactory.GetCompleteEffectIdList(); + auto vec = mFactoryHelper.GetCompleteEffectIdList(); std::unordered_set idSet(0, stringHash); for (auto it : vec) { EXPECT_EQ(idSet.count(it), 0UL); @@ -303,6 +251,212 @@ TEST_P(AudioEffect, DescriptorIdExistAndUnique) { } } +/// State testing. +// An effect instance is in INIT state by default after it was created. +TEST_P(AudioEffect, InitStateAfterCreation) { + ExpectState(State::INIT); +} + +// An effect instance transfer to INIT state after it was open successfully with IEffect.open(). +TEST_P(AudioEffect, IdleStateAfterOpen) { + EXPECT_NO_FATAL_FAILURE(OpenEffects()); + ExpectState(State::IDLE); + EXPECT_NO_FATAL_FAILURE(CloseEffects()); +} + +// An effect instance is in PROCESSING state after it receive an START command. +TEST_P(AudioEffect, ProcessingStateAfterStart) { + EXPECT_NO_FATAL_FAILURE(OpenEffects()); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::START)); + ExpectState(State::PROCESSING); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::STOP)); + EXPECT_NO_FATAL_FAILURE(CloseEffects()); +} + +// An effect instance transfer to IDLE state after Command.Id.STOP in PROCESSING state. +TEST_P(AudioEffect, IdleStateAfterStop) { + EXPECT_NO_FATAL_FAILURE(OpenEffects()); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::START)); + ExpectState(State::PROCESSING); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::STOP)); + ExpectState(State::IDLE); + EXPECT_NO_FATAL_FAILURE(CloseEffects()); +} + +// An effect instance transfer to IDLE state after Command.Id.RESET in PROCESSING state. +TEST_P(AudioEffect, IdleStateAfterReset) { + EXPECT_NO_FATAL_FAILURE(OpenEffects()); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::START)); + ExpectState(State::PROCESSING); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::RESET)); + ExpectState(State::IDLE); + EXPECT_NO_FATAL_FAILURE(CloseEffects()); +} + +// An effect instance transfer to INIT if instance receive a close() call. +TEST_P(AudioEffect, InitStateAfterClose) { + EXPECT_NO_FATAL_FAILURE(OpenEffects()); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::START)); + ExpectState(State::PROCESSING); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::STOP)); + ExpectState(State::IDLE); + EXPECT_NO_FATAL_FAILURE(CloseEffects()); + ExpectState(State::INIT); +} + +// An effect instance shouldn't accept any command before open. +TEST_P(AudioEffect, NoCommandAcceptedBeforeOpen) { + ExpectState(State::INIT); + EXPECT_NO_FATAL_FAILURE(CommandEffectsExpectStatus(CommandId::START, EX_ILLEGAL_STATE)); + EXPECT_NO_FATAL_FAILURE(CommandEffectsExpectStatus(CommandId::STOP, EX_ILLEGAL_STATE)); + EXPECT_NO_FATAL_FAILURE(CommandEffectsExpectStatus(CommandId::RESET, EX_ILLEGAL_STATE)); + ExpectState(State::INIT); +} + +// No-op when receive STOP command in IDLE state. +TEST_P(AudioEffect, StopCommandInIdleStateNoOp) { + ExpectState(State::INIT); + EXPECT_NO_FATAL_FAILURE(OpenEffects()); + ExpectState(State::IDLE); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::STOP)); + ExpectState(State::IDLE); + EXPECT_NO_FATAL_FAILURE(CloseEffects()); +} + +// No-op when receive STOP command in IDLE state. +TEST_P(AudioEffect, ResetCommandInIdleStateNoOp) { + ExpectState(State::INIT); + EXPECT_NO_FATAL_FAILURE(OpenEffects()); + ExpectState(State::IDLE); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::RESET)); + ExpectState(State::IDLE); + EXPECT_NO_FATAL_FAILURE(CloseEffects()); +} + +// Repeat START and STOP command. +TEST_P(AudioEffect, RepeatStartAndStop) { + EXPECT_NO_FATAL_FAILURE(OpenEffects()); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::START)); + ExpectState(State::PROCESSING); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::STOP)); + ExpectState(State::IDLE); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::START)); + ExpectState(State::PROCESSING); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::STOP)); + ExpectState(State::IDLE); + EXPECT_NO_FATAL_FAILURE(CloseEffects()); +} + +// Repeat START and RESET command. +TEST_P(AudioEffect, RepeatStartAndReset) { + EXPECT_NO_FATAL_FAILURE(OpenEffects()); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::START)); + ExpectState(State::PROCESSING); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::RESET)); + ExpectState(State::IDLE); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::START)); + ExpectState(State::PROCESSING); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::RESET)); + ExpectState(State::IDLE); + EXPECT_NO_FATAL_FAILURE(CloseEffects()); +} + +// Repeat START and STOP command, try to close at PROCESSING state. +TEST_P(AudioEffect, CloseProcessingStateEffects) { + EXPECT_NO_FATAL_FAILURE(OpenEffects()); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::START)); + ExpectState(State::PROCESSING); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::STOP)); + ExpectState(State::IDLE); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::START)); + ExpectState(State::PROCESSING); + EXPECT_NO_FATAL_FAILURE(CloseEffects(EX_ILLEGAL_STATE)); + // cleanup + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::STOP)); + ExpectState(State::IDLE); +} + +// Expect EX_ILLEGAL_STATE if the effect instance is not in a proper state to be destroyed. +TEST_P(AudioEffect, DestroyOpenEffects) { + // cleanup all effects. + EXPECT_NO_FATAL_FAILURE(CloseEffects()); + ASSERT_NO_FATAL_FAILURE(DestroyEffects()); + + // open effects, destroy without close, expect to get EX_ILLEGAL_STATE status. + EXPECT_NO_FATAL_FAILURE(CreateEffects()); + EXPECT_NO_FATAL_FAILURE(OpenEffects()); + EXPECT_NO_FATAL_FAILURE(DestroyEffects(EX_ILLEGAL_STATE, 1)); + EXPECT_NO_FATAL_FAILURE(CloseEffects()); +} + +/// Parameter testing. +// Verify parameters pass in open can be successfully get. +TEST_P(AudioEffect, VerifyParametersAfterOpen) { + EXPECT_NO_FATAL_FAILURE(OpenEffects()); + EXPECT_NO_FATAL_FAILURE(VerifyParameters()); + EXPECT_NO_FATAL_FAILURE(CloseEffects()); +} + +// Verify parameters pass in set can be successfully get. +TEST_P(AudioEffect, SetAndGetParameter) { + EXPECT_NO_FATAL_FAILURE(OpenEffects()); + EXPECT_NO_FATAL_FAILURE(VerifyParameters()); + initParamCommon(1 /* session */, 1 /* ioHandle */, AudioDeviceType::IN_DEFAULT /* deviceType */, + 44100 /* iSampleRate */, 44100 /* oSampleRate */); + EXPECT_NO_FATAL_FAILURE(SetParameter()); + EXPECT_NO_FATAL_FAILURE(VerifyParameters()); + EXPECT_NO_FATAL_FAILURE(CloseEffects()); +} + +// Verify parameters pass in set can be successfully get. +TEST_P(AudioEffect, SetAndGetParameterInProcessing) { + EXPECT_NO_FATAL_FAILURE(OpenEffects()); + EXPECT_NO_FATAL_FAILURE(VerifyParameters()); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::START)); + ExpectState(State::PROCESSING); + initParamCommon(1 /* session */, 1 /* ioHandle */, AudioDeviceType::IN_DEFAULT /* deviceType */, + 44100 /* iSampleRate */, 44100 /* oSampleRate */); + EXPECT_NO_FATAL_FAILURE(SetParameter()); + EXPECT_NO_FATAL_FAILURE(VerifyParameters()); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::STOP)); + ExpectState(State::IDLE); + EXPECT_NO_FATAL_FAILURE(CloseEffects()); +} + +// Parameters kept after reset. +TEST_P(AudioEffect, ResetAndVerifyParameter) { + EXPECT_NO_FATAL_FAILURE(OpenEffects()); + EXPECT_NO_FATAL_FAILURE(VerifyParameters()); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::START)); + ExpectState(State::PROCESSING); + initParamCommon(1 /* session */, 1 /* ioHandle */, AudioDeviceType::IN_DEFAULT /* deviceType */, + 44100 /* iSampleRate */, 44100 /* oSampleRate */); + EXPECT_NO_FATAL_FAILURE(SetParameter()); + EXPECT_NO_FATAL_FAILURE(VerifyParameters()); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::RESET)); + ExpectState(State::IDLE); + EXPECT_NO_FATAL_FAILURE(VerifyParameters()); + EXPECT_NO_FATAL_FAILURE(CloseEffects()); +} + +// Multiple instances of same implementation running. +TEST_P(AudioEffect, MultipleInstancesRunning) { + EXPECT_NO_FATAL_FAILURE(CreateEffects(3)); + ExpectState(State::INIT); + EXPECT_NO_FATAL_FAILURE(OpenEffects()); + ExpectState(State::IDLE); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::START)); + ExpectState(State::PROCESSING); + initParamCommon(1 /* session */, 1 /* ioHandle */, AudioDeviceType::IN_DEFAULT /* deviceType */, + 44100 /* iSampleRate */, 44100 /* oSampleRate */); + EXPECT_NO_FATAL_FAILURE(SetParameter()); + EXPECT_NO_FATAL_FAILURE(VerifyParameters()); + EXPECT_NO_FATAL_FAILURE(CommandEffects(CommandId::STOP)); + ExpectState(State::IDLE); + EXPECT_NO_FATAL_FAILURE(VerifyParameters()); + EXPECT_NO_FATAL_FAILURE(CloseEffects()); +} + INSTANTIATE_TEST_SUITE_P(AudioEffectTest, AudioEffect, testing::ValuesIn(android::getAidlHalInstanceNames(IFactory::descriptor)), android::PrintInstanceNameToString); From 49781e9cee593376ec718a4638af8ee1e88a1cd2 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Thu, 13 Oct 2022 19:22:50 +0000 Subject: [PATCH 296/998] Remove the HIDL version of oemlock HAL from compat matrix The AIDL HAL is replacing it. Test: m Bug: 182976659 Change-Id: I5a8a3597136bc579056dc11115d77c7d93d3f29f --- compatibility_matrices/compatibility_matrix.current.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 528a694e1e..d183f5f464 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -436,14 +436,6 @@ default - - android.hardware.oemlock - 1.0 - - IOemLock - default - - android.hardware.power 2-4 From 902a896e68f6207e484fccf1c5b15788bf538a2e Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Thu, 13 Oct 2022 19:37:33 +0000 Subject: [PATCH 297/998] Remove the HIDL version of weaver HAL from compat matrix The AIDL HAL is replacing it. Test: m Bug: 182976659 Change-Id: Iee4466cc17708d5813129d78945238c0e36c3627 --- compatibility_matrices/compatibility_matrix.current.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index d183f5f464..ea93765f0a 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -671,14 +671,6 @@ default - - android.hardware.weaver - 1.0 - - IWeaver - default - - android.hardware.weaver 1 From a90f9c4a43d23a635a6e79d1a452df5b613f5dc0 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 21 Sep 2022 18:15:50 -0700 Subject: [PATCH 298/998] Add timeout logic to TestWakeupClientServiceImpl. Add timeout logic for fake tasks. They will timeout after 20s and print an error message if not received by the remote access HAL. Test: Manually run TestWakeupClientServiceImpl and verify the log: Task for client ID: [ID] timed-out is printed. Bug: 246841306 Change-Id: I2173c931da9e0ea40c7b16f9e25a75592fa255c0 --- .../include/TestWakeupClientServiceImpl.h | 43 +++++++- .../impl/src/TestWakeupClientServiceImpl.cpp | 99 +++++++++++++++++-- 2 files changed, 133 insertions(+), 9 deletions(-) diff --git a/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h b/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h index 4c440b8c00..9d6ef0aced 100644 --- a/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h +++ b/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h @@ -17,6 +17,7 @@ #pragma once #include +#include #include #include #include @@ -41,20 +42,60 @@ class FakeTaskGenerator final { constexpr static uint8_t DATA[] = {0xde, 0xad, 0xbe, 0xef}; }; +struct TaskInfo { + // This is unique per-task. Note that a task might be popped and put back into the task queue, + // it will have a new task ID but the same clientId in the task data. + int taskId; + long timestampInMs; + GetRemoteTasksResponse taskData; +}; + +struct TaskInfoComparator { + // We want the smallest timestamp and smallest task ID on top. + bool operator()(const TaskInfo& l, const TaskInfo& r) { + return l.timestampInMs > r.timestampInMs || + (l.timestampInMs == r.timestampInMs && l.taskId > r.taskId); + } +}; + +// forward-declaration. +class TaskQueue; + +class TaskTimeoutMessageHandler final : public android::MessageHandler { + public: + TaskTimeoutMessageHandler(TaskQueue* taskQueue); + void handleMessage(const android::Message& message) override; + + private: + TaskQueue* mTaskQueue; +}; + // TaskQueue is thread-safe. class TaskQueue final { public: + TaskQueue(); + ~TaskQueue(); + void add(const GetRemoteTasksResponse& response); std::optional maybePopOne(); void waitForTask(); void stopWait(); + void handleTaskTimeout(); private: + std::thread mCheckTaskTimeoutThread; std::mutex mLock; - std::queue mTasks GUARDED_BY(mLock); + std::priority_queue, TaskInfoComparator> mTasks + GUARDED_BY(mLock); // A variable to notify mTasks is not empty. std::condition_variable mTasksNotEmptyCv; bool mStopped GUARDED_BY(mLock); + android::sp mLooper; + android::sp mTaskTimeoutMessageHandler; + std::atomic mTaskIdCounter = 0; + + void checkForTestTimeoutLoop(); + void waitForTaskWithLock(std::unique_lock& lock); }; class TestWakeupClientServiceImpl final : public WakeupClient::Service { diff --git a/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp index 1eb87e285e..8e6669f7cc 100644 --- a/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp +++ b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp @@ -18,6 +18,8 @@ #include #include +#include +#include #include #include @@ -28,13 +30,15 @@ namespace remoteaccess { namespace { +using ::android::uptimeMillis; using ::android::base::ScopedLockAssertion; using ::android::base::StringPrintf; using ::grpc::ServerContext; using ::grpc::ServerWriter; using ::grpc::Status; -constexpr int kTaskIntervalInSec = 5; +constexpr int kTaskIntervalInMs = 5'000; +constexpr int KTaskTimeoutInMs = 20'000; } // namespace @@ -47,24 +51,68 @@ GetRemoteTasksResponse FakeTaskGenerator::generateTask() { return response; } +TaskTimeoutMessageHandler::TaskTimeoutMessageHandler(TaskQueue* taskQueue) + : mTaskQueue(taskQueue) {} + +void TaskTimeoutMessageHandler::handleMessage(const android::Message& message) { + mTaskQueue->handleTaskTimeout(); +} + +TaskQueue::TaskQueue() { + mTaskTimeoutMessageHandler = android::sp::make(this); + mLooper = Looper::prepare(/*opts=*/0); + mCheckTaskTimeoutThread = std::thread([this] { checkForTestTimeoutLoop(); }); +} + +TaskQueue::~TaskQueue() { + { + std::lock_guard lockGuard(mLock); + mStopped = true; + } + while (true) { + // Remove all pending timeout handlers from queue. + if (!maybePopOne().has_value()) { + break; + } + } + if (mCheckTaskTimeoutThread.joinable()) { + mCheckTaskTimeoutThread.join(); + } +} + std::optional TaskQueue::maybePopOne() { std::lock_guard lockGuard(mLock); if (mTasks.size() == 0) { return std::nullopt; } - GetRemoteTasksResponse response = mTasks.front(); + TaskInfo response = std::move(mTasks.top()); mTasks.pop(); - return std::move(response); + mLooper->removeMessages(mTaskTimeoutMessageHandler, response.taskId); + return std::move(response.taskData); } + void TaskQueue::add(const GetRemoteTasksResponse& task) { - // TODO (b/246841306): add timeout to tasks. std::lock_guard lockGuard(mLock); - mTasks.push(task); + if (mStopped) { + return; + } + int taskId = mTaskIdCounter++; + mTasks.push(TaskInfo{ + .taskId = taskId, + .timestampInMs = uptimeMillis(), + .taskData = task, + }); + android::Message message(taskId); + mLooper->sendMessageDelayed(KTaskTimeoutInMs * 1000, mTaskTimeoutMessageHandler, message); mTasksNotEmptyCv.notify_all(); } void TaskQueue::waitForTask() { std::unique_lock lock(mLock); + waitForTaskWithLock(lock); +} + +void TaskQueue::waitForTaskWithLock(std::unique_lock& lock) { mTasksNotEmptyCv.wait(lock, [this] { ScopedLockAssertion lockAssertion(mLock); return mTasks.size() > 0 || mStopped; @@ -77,6 +125,41 @@ void TaskQueue::stopWait() { mTasksNotEmptyCv.notify_all(); } +void TaskQueue::checkForTestTimeoutLoop() { + Looper::setForThread(mLooper); + + while (true) { + { + std::unique_lock lock(mLock); + if (mStopped) { + ALOGW("The TestWakeupClientServiceImpl is stopping, " + "exiting checkForTestTimeoutLoop"); + return; + } + } + + mLooper->pollAll(/*timeoutMillis=*/-1); + } +} + +void TaskQueue::handleTaskTimeout() { + // We know which task timed-out from the taskId in the message. However, there is no easy way + // to remove a specific task with the task ID from the priority_queue, so we just check from + // the top of the queue (which have the oldest tasks). + std::lock_guard lockGuard(mLock); + long now = uptimeMillis(); + while (mTasks.size() > 0) { + const TaskInfo& taskInfo = mTasks.top(); + if (taskInfo.timestampInMs + KTaskTimeoutInMs > now) { + break; + } + // In real implementation, this should report task failure to remote wakeup server. + ALOGW("Task for client ID: %s timed-out, added at %ld ms, now %ld ms", + taskInfo.taskData.clientid().c_str(), taskInfo.timestampInMs, now); + mTasks.pop(); + } +} + TestWakeupClientServiceImpl::TestWakeupClientServiceImpl() { mThread = std::thread([this] { fakeTaskGenerateLoop(); }); } @@ -95,13 +178,13 @@ TestWakeupClientServiceImpl::~TestWakeupClientServiceImpl() { void TestWakeupClientServiceImpl::fakeTaskGenerateLoop() { // In actual implementation, this should communicate with the remote server and receives tasks - // from it. Here we simulate receiving one remote task every {kTaskIntervalInSec}s. + // from it. Here we simulate receiving one remote task every {kTaskIntervalInMs}ms. while (true) { mTaskQueue.add(mFakeTaskGenerator.generateTask()); - ALOGI("Sleeping for %d seconds until next task", kTaskIntervalInSec); + ALOGI("Sleeping for %d seconds until next task", kTaskIntervalInMs); std::unique_lock lk(mLock); - if (mServerStoppedCv.wait_for(lk, std::chrono::seconds(kTaskIntervalInSec), [this] { + if (mServerStoppedCv.wait_for(lk, std::chrono::milliseconds(kTaskIntervalInMs), [this] { ScopedLockAssertion lockAssertion(mLock); return mServerStopped; })) { From 229b4d64d862b30480feccfa88d4e74080595f84 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Sun, 16 Oct 2022 07:59:40 +0000 Subject: [PATCH 299/998] Remove ngranInfo from AccessTechnologySpecificInfo Bug: 216387835 Test: build & flash Change-Id: I39a9026c8a0ade7c9b659fe45a2d3d1bb9ea6eac --- radio/aidl/vts/radio_network_test.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index 69d1193cff..4cae96a76a 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -1502,16 +1502,12 @@ TEST_P(RadioNetworkTest, getDataRegistrationState) { AccessTechnologySpecificInfo info = radioRsp_network->dataRegResp.accessTechnologySpecificInfo; RadioTechnology rat = radioRsp_network->dataRegResp.rat; - #pragma clang diagnostic push - #pragma clang diagnostic ignored "-Wdeprecated-declarations" // TODO: add logic for cdmaInfo if (rat == RadioTechnology::LTE || rat == RadioTechnology::LTE_CA) { ASSERT_EQ(info.getTag(), AccessTechnologySpecificInfo::eutranInfo); } else if (rat == RadioTechnology::NR) { - ASSERT_TRUE(info.getTag() == AccessTechnologySpecificInfo::ngranNrVopsInfo - || info.getTag() == AccessTechnologySpecificInfo::ngranInfo); + ASSERT_TRUE(info.getTag() == AccessTechnologySpecificInfo::ngranNrVopsInfo); } - #pragma clang diagnostic pop } /* From af227755f06509d8fc8c538b45f7b63609b7eab8 Mon Sep 17 00:00:00 2001 From: shrikar Date: Tue, 18 Oct 2022 00:32:25 +0000 Subject: [PATCH 300/998] Improve docs for PARKING_BRAKE in vehicle properties AIDL file Bug: 254078947 Test: presubmit Change-Id: Id4963466f4210f52b6fe0ccb43dcac3a62a087d2 --- .../hardware/automotive/vehicle/VehicleProperty.aidl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 11cda3dda2..1852673cb7 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -457,6 +457,9 @@ enum VehicleProperty { /** * Parking brake state. * + * This property is true indicates that the car's parking brake is currently engaged. False + * implies that the car's parking brake is currently disengaged. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ */ @@ -465,6 +468,15 @@ enum VehicleProperty { /** * Auto-apply parking brake. * + * This property is true indicates that the car's automatic parking brake feature is currently + * enabled. False indicates that the car's automatic parking brake feature is currently + * disabled. + * + * This property is often confused with PARKING_BRAKE_ON. The difference is that + * PARKING_BRAKE_ON describes whether the actual parking brake is currently on/off, whereas + * PARKING_BRAKE_AUTO_APPLY describes whether the feature of automatic parking brake is enabled/ + * disabled, and does not describe the current state of the actual parking brake. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ */ From f29134c9c95bed1b57f606af0a497f3d1449f682 Mon Sep 17 00:00:00 2001 From: Peiyong Lin Date: Mon, 17 Oct 2022 20:36:43 +0000 Subject: [PATCH 301/998] Add TEST_MAPPING Add VtsHalPowerTargetTest into presubmit tests. Bug: b/253516147 Test: atest VtsHalPowerTargetTest Change-Id: Ie1fa80a5bdf9baa084dbfa4603414eb97afb15a6 --- power/TEST_MAPPING | 7 +++++++ power/aidl/vts/Android.bp | 1 + 2 files changed, 8 insertions(+) create mode 100644 power/TEST_MAPPING diff --git a/power/TEST_MAPPING b/power/TEST_MAPPING new file mode 100644 index 0000000000..c0963f9c5b --- /dev/null +++ b/power/TEST_MAPPING @@ -0,0 +1,7 @@ +{ + "presubmit": [ + { + "name": "VtsHalPowerTargetTest" + } + ] +} diff --git a/power/aidl/vts/Android.bp b/power/aidl/vts/Android.bp index d5cc2b64af..56c98bd2d8 100644 --- a/power/aidl/vts/Android.bp +++ b/power/aidl/vts/Android.bp @@ -35,6 +35,7 @@ cc_test { "android.hardware.power-V4-ndk", ], test_suites: [ + "general-tests", "vts", ], } From 5851c3aa252d8708bfc9e079c3b07fed7bc8b16d Mon Sep 17 00:00:00 2001 From: Peiyong Lin Date: Tue, 18 Oct 2022 20:47:56 +0000 Subject: [PATCH 302/998] Align default implementation with latest VSR. VSR requires to support power HAL V2 and beyond, this patch changes the default implementation to reflect that. Bug: b/253516147 Test: atest VtsHalPowerTargetTest Change-Id: I56f6f847f4c47775db6350b8a3fcd7ee9c9cdf17 --- power/aidl/default/Android.bp | 1 + power/aidl/default/Power.cpp | 42 ++++++++++++------- power/aidl/default/Power.h | 4 ++ power/aidl/default/PowerHintSession.cpp | 54 +++++++++++++++++++++++++ power/aidl/default/PowerHintSession.h | 37 +++++++++++++++++ 5 files changed, 123 insertions(+), 15 deletions(-) create mode 100644 power/aidl/default/PowerHintSession.cpp create mode 100644 power/aidl/default/PowerHintSession.h diff --git a/power/aidl/default/Android.bp b/power/aidl/default/Android.bp index d1257f336a..da91ee6690 100644 --- a/power/aidl/default/Android.bp +++ b/power/aidl/default/Android.bp @@ -35,6 +35,7 @@ cc_binary { srcs: [ "main.cpp", "Power.cpp", + "PowerHintSession.cpp", ], } diff --git a/power/aidl/default/Power.cpp b/power/aidl/default/Power.cpp index 7f08f44926..8fe370c3e4 100644 --- a/power/aidl/default/Power.cpp +++ b/power/aidl/default/Power.cpp @@ -15,6 +15,7 @@ */ #include "Power.h" +#include "PowerHintSession.h" #include @@ -25,42 +26,53 @@ namespace power { namespace impl { namespace example { +using namespace std::chrono_literals; + +using ndk::ScopedAStatus; + const std::vector BOOST_RANGE{ndk::enum_range().begin(), ndk::enum_range().end()}; const std::vector MODE_RANGE{ndk::enum_range().begin(), ndk::enum_range().end()}; -ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) { +ScopedAStatus Power::setMode(Mode type, bool enabled) { LOG(VERBOSE) << "Power setMode: " << static_cast(type) << " to: " << enabled; - return ndk::ScopedAStatus::ok(); + return ScopedAStatus::ok(); } -ndk::ScopedAStatus Power::isModeSupported(Mode type, bool* _aidl_return) { +ScopedAStatus Power::isModeSupported(Mode type, bool* _aidl_return) { LOG(INFO) << "Power isModeSupported: " << static_cast(type); *_aidl_return = type >= MODE_RANGE.front() && type <= MODE_RANGE.back(); - return ndk::ScopedAStatus::ok(); + return ScopedAStatus::ok(); } -ndk::ScopedAStatus Power::setBoost(Boost type, int32_t durationMs) { +ScopedAStatus Power::setBoost(Boost type, int32_t durationMs) { LOG(VERBOSE) << "Power setBoost: " << static_cast(type) << ", duration: " << durationMs; - return ndk::ScopedAStatus::ok(); + return ScopedAStatus::ok(); } -ndk::ScopedAStatus Power::isBoostSupported(Boost type, bool* _aidl_return) { +ScopedAStatus Power::isBoostSupported(Boost type, bool* _aidl_return) { LOG(INFO) << "Power isBoostSupported: " << static_cast(type); *_aidl_return = type >= BOOST_RANGE.front() && type <= BOOST_RANGE.back(); - return ndk::ScopedAStatus::ok(); + return ScopedAStatus::ok(); } -ndk::ScopedAStatus Power::createHintSession(int32_t, int32_t, const std::vector&, int64_t, - std::shared_ptr* _aidl_return) { - *_aidl_return = nullptr; - return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); +ScopedAStatus Power::createHintSession(int32_t, int32_t, const std::vector& tids, int64_t, + std::shared_ptr* _aidl_return) { + if (tids.size() == 0) { + *_aidl_return = nullptr; + return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + std::shared_ptr powerHintSession = + ndk::SharedRefBase::make(); + mPowerHintSessions.push_back(powerHintSession); + *_aidl_return = powerHintSession; + return ScopedAStatus::ok(); } -ndk::ScopedAStatus Power::getHintSessionPreferredRate(int64_t* outNanoseconds) { - *outNanoseconds = -1; - return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); +ScopedAStatus Power::getHintSessionPreferredRate(int64_t* outNanoseconds) { + *outNanoseconds = std::chrono::nanoseconds(1ms).count(); + return ScopedAStatus::ok(); } } // namespace example diff --git a/power/aidl/default/Power.h b/power/aidl/default/Power.h index ef6439dde6..7f8405eff3 100644 --- a/power/aidl/default/Power.h +++ b/power/aidl/default/Power.h @@ -26,6 +26,7 @@ namespace impl { namespace example { class Power : public BnPower { + public: ndk::ScopedAStatus setMode(Mode type, bool enabled) override; ndk::ScopedAStatus isModeSupported(Mode type, bool* _aidl_return) override; ndk::ScopedAStatus setBoost(Boost type, int32_t durationMs) override; @@ -35,6 +36,9 @@ class Power : public BnPower { int64_t durationNanos, std::shared_ptr* _aidl_return) override; ndk::ScopedAStatus getHintSessionPreferredRate(int64_t* outNanoseconds) override; + + private: + std::vector> mPowerHintSessions; }; } // namespace example diff --git a/power/aidl/default/PowerHintSession.cpp b/power/aidl/default/PowerHintSession.cpp new file mode 100644 index 0000000000..aa95be451b --- /dev/null +++ b/power/aidl/default/PowerHintSession.cpp @@ -0,0 +1,54 @@ +/* + * 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. + */ + +#include "PowerHintSession.h" + +#include + +namespace aidl::android::hardware::power::impl::example { + +using ndk::ScopedAStatus; + +PowerHintSession::PowerHintSession() {} + +ScopedAStatus PowerHintSession::updateTargetWorkDuration(int64_t targetDurationNanos) { + LOG(VERBOSE) << __func__ << "target duration in nanoseconds: " << targetDurationNanos; + return ScopedAStatus::ok(); +} + +ScopedAStatus PowerHintSession::reportActualWorkDuration( + const std::vector& /* durations */) { + LOG(VERBOSE) << __func__; + return ScopedAStatus::ok(); +} + +ScopedAStatus PowerHintSession::pause() { + return ScopedAStatus::ok(); +} + +ScopedAStatus PowerHintSession::resume() { + return ScopedAStatus::ok(); +} + +ScopedAStatus PowerHintSession::close() { + return ScopedAStatus::ok(); +} + +ScopedAStatus PowerHintSession::sendHint(SessionHint /* hint */) { + return ScopedAStatus::ok(); +} + +} // namespace aidl::android::hardware::power::impl::example diff --git a/power/aidl/default/PowerHintSession.h b/power/aidl/default/PowerHintSession.h new file mode 100644 index 0000000000..6a7627a730 --- /dev/null +++ b/power/aidl/default/PowerHintSession.h @@ -0,0 +1,37 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include + +namespace aidl::android::hardware::power::impl::example { + +class PowerHintSession : public BnPowerHintSession { + public: + explicit PowerHintSession(); + ndk::ScopedAStatus updateTargetWorkDuration(int64_t targetDurationNanos) override; + ndk::ScopedAStatus reportActualWorkDuration( + const std::vector& durations) override; + ndk::ScopedAStatus pause() override; + ndk::ScopedAStatus resume() override; + ndk::ScopedAStatus close() override; + ndk::ScopedAStatus sendHint(SessionHint hint) override; +}; + +} // namespace aidl::android::hardware::power::impl::example From e1a730577c6be187b28f43c0cfa1b8c67cee0ffa Mon Sep 17 00:00:00 2001 From: Yixiao Luo Date: Tue, 18 Oct 2022 16:40:14 -0700 Subject: [PATCH 303/998] Fix NativeHandle return in TV Input HAL 2.0 default implementation Bug: 227673740 Test: atest VtsHalTvInputTargetTest Change-Id: I0b18b77c5f3a0b99a1e705ef61d6691f8d33a561 --- tv/input/aidl/default/TvInput.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tv/input/aidl/default/TvInput.cpp b/tv/input/aidl/default/TvInput.cpp index 6c3a138155..ed12cbc92d 100644 --- a/tv/input/aidl/default/TvInput.cpp +++ b/tv/input/aidl/default/TvInput.cpp @@ -96,8 +96,7 @@ void TvInput::init() { } mStreamConfigs[in_deviceId][in_streamId]->handle = createNativeHandle(in_streamId); mStreamConfigs[in_deviceId][in_streamId]->isOpen = true; - NativeHandle aidlHandle = makeToAidl(mStreamConfigs[in_deviceId][in_streamId]->handle); - _aidl_return = &aidlHandle; + *_aidl_return = makeToAidl(mStreamConfigs[in_deviceId][in_streamId]->handle); return ::ndk::ScopedAStatus::ok(); } From c4ae4e4d24b21642029644025a6d898902aea5dc Mon Sep 17 00:00:00 2001 From: Tyler Trephan Date: Tue, 18 Oct 2022 01:23:04 +0000 Subject: [PATCH 304/998] Added DOOR_MOVE to the default configuration Test: atest CarPropertyManagerTest Bug: 239753202 Change-Id: Iefcf92a070261fe20160dbf211c5f6579fd23b4b --- .../config/DefaultProperties.json | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index b6811b67ef..7b471e1053 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1963,6 +1963,36 @@ } ] }, + { + "property": "VehicleProperty::DOOR_MOVE", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::DOOR_1_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::DOOR_1_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::DOOR_2_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::DOOR_2_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + } + ] + }, { "property": "VehicleProperty::MIRROR_Z_POS", "defaultValue": { From cd8b38611a6b63be666bd745ae455faa05a5855c Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Thu, 20 Oct 2022 06:06:39 +0000 Subject: [PATCH 305/998] Revert "Add timeout logic to TestWakeupClientServiceImpl." This reverts commit a90f9c4a43d23a635a6e79d1a452df5b613f5dc0. Reason for revert: b/254573754 Change-Id: Ia81ed99423f7c8aee21464c842ecabd1f23b9fd1 --- .../include/TestWakeupClientServiceImpl.h | 43 +------- .../impl/src/TestWakeupClientServiceImpl.cpp | 99 ++----------------- 2 files changed, 9 insertions(+), 133 deletions(-) diff --git a/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h b/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h index 9d6ef0aced..4c440b8c00 100644 --- a/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h +++ b/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h @@ -17,7 +17,6 @@ #pragma once #include -#include #include #include #include @@ -42,60 +41,20 @@ class FakeTaskGenerator final { constexpr static uint8_t DATA[] = {0xde, 0xad, 0xbe, 0xef}; }; -struct TaskInfo { - // This is unique per-task. Note that a task might be popped and put back into the task queue, - // it will have a new task ID but the same clientId in the task data. - int taskId; - long timestampInMs; - GetRemoteTasksResponse taskData; -}; - -struct TaskInfoComparator { - // We want the smallest timestamp and smallest task ID on top. - bool operator()(const TaskInfo& l, const TaskInfo& r) { - return l.timestampInMs > r.timestampInMs || - (l.timestampInMs == r.timestampInMs && l.taskId > r.taskId); - } -}; - -// forward-declaration. -class TaskQueue; - -class TaskTimeoutMessageHandler final : public android::MessageHandler { - public: - TaskTimeoutMessageHandler(TaskQueue* taskQueue); - void handleMessage(const android::Message& message) override; - - private: - TaskQueue* mTaskQueue; -}; - // TaskQueue is thread-safe. class TaskQueue final { public: - TaskQueue(); - ~TaskQueue(); - void add(const GetRemoteTasksResponse& response); std::optional maybePopOne(); void waitForTask(); void stopWait(); - void handleTaskTimeout(); private: - std::thread mCheckTaskTimeoutThread; std::mutex mLock; - std::priority_queue, TaskInfoComparator> mTasks - GUARDED_BY(mLock); + std::queue mTasks GUARDED_BY(mLock); // A variable to notify mTasks is not empty. std::condition_variable mTasksNotEmptyCv; bool mStopped GUARDED_BY(mLock); - android::sp mLooper; - android::sp mTaskTimeoutMessageHandler; - std::atomic mTaskIdCounter = 0; - - void checkForTestTimeoutLoop(); - void waitForTaskWithLock(std::unique_lock& lock); }; class TestWakeupClientServiceImpl final : public WakeupClient::Service { diff --git a/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp index 8e6669f7cc..1eb87e285e 100644 --- a/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp +++ b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp @@ -18,8 +18,6 @@ #include #include -#include -#include #include #include @@ -30,15 +28,13 @@ namespace remoteaccess { namespace { -using ::android::uptimeMillis; using ::android::base::ScopedLockAssertion; using ::android::base::StringPrintf; using ::grpc::ServerContext; using ::grpc::ServerWriter; using ::grpc::Status; -constexpr int kTaskIntervalInMs = 5'000; -constexpr int KTaskTimeoutInMs = 20'000; +constexpr int kTaskIntervalInSec = 5; } // namespace @@ -51,68 +47,24 @@ GetRemoteTasksResponse FakeTaskGenerator::generateTask() { return response; } -TaskTimeoutMessageHandler::TaskTimeoutMessageHandler(TaskQueue* taskQueue) - : mTaskQueue(taskQueue) {} - -void TaskTimeoutMessageHandler::handleMessage(const android::Message& message) { - mTaskQueue->handleTaskTimeout(); -} - -TaskQueue::TaskQueue() { - mTaskTimeoutMessageHandler = android::sp::make(this); - mLooper = Looper::prepare(/*opts=*/0); - mCheckTaskTimeoutThread = std::thread([this] { checkForTestTimeoutLoop(); }); -} - -TaskQueue::~TaskQueue() { - { - std::lock_guard lockGuard(mLock); - mStopped = true; - } - while (true) { - // Remove all pending timeout handlers from queue. - if (!maybePopOne().has_value()) { - break; - } - } - if (mCheckTaskTimeoutThread.joinable()) { - mCheckTaskTimeoutThread.join(); - } -} - std::optional TaskQueue::maybePopOne() { std::lock_guard lockGuard(mLock); if (mTasks.size() == 0) { return std::nullopt; } - TaskInfo response = std::move(mTasks.top()); + GetRemoteTasksResponse response = mTasks.front(); mTasks.pop(); - mLooper->removeMessages(mTaskTimeoutMessageHandler, response.taskId); - return std::move(response.taskData); + return std::move(response); } - void TaskQueue::add(const GetRemoteTasksResponse& task) { + // TODO (b/246841306): add timeout to tasks. std::lock_guard lockGuard(mLock); - if (mStopped) { - return; - } - int taskId = mTaskIdCounter++; - mTasks.push(TaskInfo{ - .taskId = taskId, - .timestampInMs = uptimeMillis(), - .taskData = task, - }); - android::Message message(taskId); - mLooper->sendMessageDelayed(KTaskTimeoutInMs * 1000, mTaskTimeoutMessageHandler, message); + mTasks.push(task); mTasksNotEmptyCv.notify_all(); } void TaskQueue::waitForTask() { std::unique_lock lock(mLock); - waitForTaskWithLock(lock); -} - -void TaskQueue::waitForTaskWithLock(std::unique_lock& lock) { mTasksNotEmptyCv.wait(lock, [this] { ScopedLockAssertion lockAssertion(mLock); return mTasks.size() > 0 || mStopped; @@ -125,41 +77,6 @@ void TaskQueue::stopWait() { mTasksNotEmptyCv.notify_all(); } -void TaskQueue::checkForTestTimeoutLoop() { - Looper::setForThread(mLooper); - - while (true) { - { - std::unique_lock lock(mLock); - if (mStopped) { - ALOGW("The TestWakeupClientServiceImpl is stopping, " - "exiting checkForTestTimeoutLoop"); - return; - } - } - - mLooper->pollAll(/*timeoutMillis=*/-1); - } -} - -void TaskQueue::handleTaskTimeout() { - // We know which task timed-out from the taskId in the message. However, there is no easy way - // to remove a specific task with the task ID from the priority_queue, so we just check from - // the top of the queue (which have the oldest tasks). - std::lock_guard lockGuard(mLock); - long now = uptimeMillis(); - while (mTasks.size() > 0) { - const TaskInfo& taskInfo = mTasks.top(); - if (taskInfo.timestampInMs + KTaskTimeoutInMs > now) { - break; - } - // In real implementation, this should report task failure to remote wakeup server. - ALOGW("Task for client ID: %s timed-out, added at %ld ms, now %ld ms", - taskInfo.taskData.clientid().c_str(), taskInfo.timestampInMs, now); - mTasks.pop(); - } -} - TestWakeupClientServiceImpl::TestWakeupClientServiceImpl() { mThread = std::thread([this] { fakeTaskGenerateLoop(); }); } @@ -178,13 +95,13 @@ TestWakeupClientServiceImpl::~TestWakeupClientServiceImpl() { void TestWakeupClientServiceImpl::fakeTaskGenerateLoop() { // In actual implementation, this should communicate with the remote server and receives tasks - // from it. Here we simulate receiving one remote task every {kTaskIntervalInMs}ms. + // from it. Here we simulate receiving one remote task every {kTaskIntervalInSec}s. while (true) { mTaskQueue.add(mFakeTaskGenerator.generateTask()); - ALOGI("Sleeping for %d seconds until next task", kTaskIntervalInMs); + ALOGI("Sleeping for %d seconds until next task", kTaskIntervalInSec); std::unique_lock lk(mLock); - if (mServerStoppedCv.wait_for(lk, std::chrono::milliseconds(kTaskIntervalInMs), [this] { + if (mServerStoppedCv.wait_for(lk, std::chrono::seconds(kTaskIntervalInSec), [this] { ScopedLockAssertion lockAssertion(mLock); return mServerStopped; })) { From 854785a4bd918d3356632f7e2fabd8bb187336fe Mon Sep 17 00:00:00 2001 From: Michal Olech Date: Thu, 20 Oct 2022 12:54:21 +0200 Subject: [PATCH 306/998] Add CEC AIDL tests to test mapping (presubmit) Bug: 250526670 Bug: 250526969 Test: acloud create --local-instance --local-image && atest . Change-Id: Ib63c617e8177c69852cb6ee55549e7fd5196de2e --- tv/hdmi/aidl/TEST_MAPPING | 7 +++++ tv/hdmi/aidl/vts/functional/AndroidTest.xml | 33 +++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 tv/hdmi/aidl/TEST_MAPPING create mode 100644 tv/hdmi/aidl/vts/functional/AndroidTest.xml diff --git a/tv/hdmi/aidl/TEST_MAPPING b/tv/hdmi/aidl/TEST_MAPPING new file mode 100644 index 0000000000..6bd3b571df --- /dev/null +++ b/tv/hdmi/aidl/TEST_MAPPING @@ -0,0 +1,7 @@ +{ + "presubmit": [ + { + "name": "VtsHalTvHdmiAidlTargetTest" + } + ] +} diff --git a/tv/hdmi/aidl/vts/functional/AndroidTest.xml b/tv/hdmi/aidl/vts/functional/AndroidTest.xml new file mode 100644 index 0000000000..0640b2db42 --- /dev/null +++ b/tv/hdmi/aidl/vts/functional/AndroidTest.xml @@ -0,0 +1,33 @@ + + + + From 14cacf2402b49459959dcdf069cfb72d03f18206 Mon Sep 17 00:00:00 2001 From: Michal Olech Date: Thu, 20 Oct 2022 14:59:01 +0200 Subject: [PATCH 307/998] Add CEC AIDL tests to test mapping (presubmit) Bug: 250526670 Bug: 250526969 Test: acloud create --local-instance --local-image && cd hardware/interfaces/tv && atest Change-Id: I8ecdabc0fcfd1d259153e0fd1fa579aca64d9be4 --- tv/cec/aidl/TEST_MAPPING | 7 +++++ tv/cec/aidl/vts/functional/AndroidTest.xml | 33 ++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 tv/cec/aidl/TEST_MAPPING create mode 100644 tv/cec/aidl/vts/functional/AndroidTest.xml diff --git a/tv/cec/aidl/TEST_MAPPING b/tv/cec/aidl/TEST_MAPPING new file mode 100644 index 0000000000..ef4bee1a89 --- /dev/null +++ b/tv/cec/aidl/TEST_MAPPING @@ -0,0 +1,7 @@ +{ + "presubmit": [ + { + "name": "VtsHalTvCecAidlTargetTest" + } + ] +} diff --git a/tv/cec/aidl/vts/functional/AndroidTest.xml b/tv/cec/aidl/vts/functional/AndroidTest.xml new file mode 100644 index 0000000000..86041473ad --- /dev/null +++ b/tv/cec/aidl/vts/functional/AndroidTest.xml @@ -0,0 +1,33 @@ + + + + From 9a938d597712030ea6955fda1e04fa3c6638ea77 Mon Sep 17 00:00:00 2001 From: Yu-Han Yang Date: Thu, 20 Oct 2022 22:17:47 +0000 Subject: [PATCH 308/998] Clarify setCallback() can be called without a previous close() call Add a VTS test case to enforce this. Bug: 253453668 Test: atest VtsHalGnssTargetTest Change-Id: I1d1f9587e590360198274ef5583893c35051ef8e --- .../gnss/IGnssMeasurementInterface.aidl | 6 ++++ gnss/aidl/vts/gnss_hal_test_cases.cpp | 29 +++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl b/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl index 8733754e96..43164074da 100644 --- a/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl +++ b/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl @@ -78,6 +78,9 @@ interface IGnssMeasurementInterface { * output rate of 1Hz (occasional intra-measurement time offsets in the range from 0-2000msec * can be tolerated.) * + * If setCallback() is invoked without a previous close(), the HAL must use the new callback + * and parameters to provide updates. + * * @param callback Handle to GnssMeasurement callback interface. * @param enableFullTracking If true, GNSS chipset must switch off duty cycling. In such mode * no clock discontinuities are expected and, when supported, carrier phase should be @@ -104,6 +107,9 @@ interface IGnssMeasurementInterface { /** * Initializes the interface and registers the callback routines with the HAL. * + * If setCallbackWithOptions() is invoked without a previous close(), the HAL must use the new + * callback and options to provide updates. + * * @param options See Options definition. */ void setCallbackWithOptions(in IGnssMeasurementCallback callback, in Options options); diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp index 3696233d3b..f1a9894c3e 100644 --- a/gnss/aidl/vts/gnss_hal_test_cases.cpp +++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp @@ -1494,3 +1494,32 @@ TEST_P(GnssHalTest, TestGnssMeasurementIntervals_LocationOnAfterMeasurement) { assertMeanAndStdev(locationIntervalMs, deltas); } } + +TEST_P(GnssHalTest, TestGnssMeasurementSetCallback) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 2) { + return; + } + + sp iGnssMeasurement; + auto status = aidl_gnss_hal_->getExtensionGnssMeasurement(&iGnssMeasurement); + ASSERT_TRUE(status.isOk()); + ASSERT_TRUE(iGnssMeasurement != nullptr); + + ALOGD("TestGnssMeasurementSetCallback"); + auto callback = sp::make(); + std::vector deltas; + + // setCallback at 20s interval and wait for 1 measurement + startMeasurementWithInterval(20000, iGnssMeasurement, callback); + collectMeasurementIntervals(callback, /* numEvents= */ 1, /* timeoutSeconds= */ 10, deltas); + + // setCallback at 1s interval and wait for 5 measurements + startMeasurementWithInterval(1000, iGnssMeasurement, callback); + collectMeasurementIntervals(callback, /* numEvents= */ 5, /* timeoutSeconds= */ 10, deltas); + + // verify the measurements were received at 1Hz + assertMeanAndStdev(1000, deltas); + + status = iGnssMeasurement->close(); + ASSERT_TRUE(status.isOk()); +} From d2377447d5a38a4c815ef0634713a556aaedec75 Mon Sep 17 00:00:00 2001 From: Yu-Han Yang Date: Wed, 12 Oct 2022 23:54:51 +0000 Subject: [PATCH 309/998] Add gnssSetSignalTypeCapabilitiesCb() Bug: 253319784 Test: atest VtsHalGnssTargetTest Change-Id: Ib1485a2002bb3af01954698f490060da46331a5d --- .../compatibility_matrix.current.xml | 2 +- gnss/1.1/default/Android.bp | 2 +- gnss/1.1/vts/functional/Android.bp | 2 +- gnss/2.0/default/Android.bp | 2 +- gnss/2.0/vts/functional/Android.bp | 2 +- gnss/2.1/default/Android.bp | 2 +- gnss/2.1/vts/functional/Android.bp | 2 +- .../android/hardware/gnss/IGnssCallback.aidl | 1 + .../android/hardware/gnss/IGnssCallback.aidl | 15 +++++++++++++++ gnss/aidl/default/Android.bp | 2 +- gnss/aidl/default/Gnss.cpp | 16 +++++++++++++++- gnss/aidl/default/gnss-default.xml | 2 +- gnss/aidl/vts/Android.bp | 2 +- gnss/aidl/vts/GnssCallbackAidl.cpp | 15 +++++++++++++++ gnss/aidl/vts/GnssCallbackAidl.h | 7 +++++++ gnss/aidl/vts/gnss_hal_test.cpp | 9 +++++++++ gnss/common/utils/default/Android.bp | 2 +- gnss/common/utils/vts/Android.bp | 2 +- 18 files changed, 74 insertions(+), 13 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 6fca4f3a9c..312db70f64 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -238,7 +238,7 @@ android.hardware.gnss - 2 + 3 IGnss default diff --git a/gnss/1.1/default/Android.bp b/gnss/1.1/default/Android.bp index a73182edb6..300e8de3af 100644 --- a/gnss/1.1/default/Android.bp +++ b/gnss/1.1/default/Android.bp @@ -27,7 +27,7 @@ cc_binary { "android.hardware.gnss@2.0", "android.hardware.gnss@1.1", "android.hardware.gnss@1.0", - "android.hardware.gnss-V2-ndk", + "android.hardware.gnss-V3-ndk", ], static_libs: [ "android.hardware.gnss@common-default-lib", diff --git a/gnss/1.1/vts/functional/Android.bp b/gnss/1.1/vts/functional/Android.bp index f8fad94a34..2414cbc4aa 100644 --- a/gnss/1.1/vts/functional/Android.bp +++ b/gnss/1.1/vts/functional/Android.bp @@ -36,7 +36,7 @@ cc_test { "android.hardware.gnss@1.1", "android.hardware.gnss@2.0", "android.hardware.gnss@common-vts-lib", - "android.hardware.gnss-V2-cpp", + "android.hardware.gnss-V3-cpp", ], shared_libs: [ "android.hardware.gnss.measurement_corrections@1.0", diff --git a/gnss/2.0/default/Android.bp b/gnss/2.0/default/Android.bp index 769e8ae167..83bc2cc903 100644 --- a/gnss/2.0/default/Android.bp +++ b/gnss/2.0/default/Android.bp @@ -50,7 +50,7 @@ cc_binary { "android.hardware.gnss@2.0", "android.hardware.gnss@1.1", "android.hardware.gnss@1.0", - "android.hardware.gnss-V2-ndk", + "android.hardware.gnss-V3-ndk", ], static_libs: [ "android.hardware.gnss@common-default-lib", diff --git a/gnss/2.0/vts/functional/Android.bp b/gnss/2.0/vts/functional/Android.bp index 2042dd9f17..e8db8862d2 100644 --- a/gnss/2.0/vts/functional/Android.bp +++ b/gnss/2.0/vts/functional/Android.bp @@ -39,7 +39,7 @@ cc_test { "android.hardware.gnss@2.0", "android.hardware.gnss@2.1", "android.hardware.gnss@common-vts-lib", - "android.hardware.gnss-V2-cpp", + "android.hardware.gnss-V3-cpp", ], test_suites: [ "general-tests", diff --git a/gnss/2.1/default/Android.bp b/gnss/2.1/default/Android.bp index 2979f5c9b7..4a4ce544ae 100644 --- a/gnss/2.1/default/Android.bp +++ b/gnss/2.1/default/Android.bp @@ -44,7 +44,7 @@ cc_binary { "android.hardware.gnss@1.0", "android.hardware.gnss@1.1", "android.hardware.gnss@2.0", - "android.hardware.gnss-V2-ndk", + "android.hardware.gnss-V3-ndk", ], static_libs: [ "android.hardware.gnss@common-default-lib", diff --git a/gnss/2.1/vts/functional/Android.bp b/gnss/2.1/vts/functional/Android.bp index d7b6eebbe9..76f9d07964 100644 --- a/gnss/2.1/vts/functional/Android.bp +++ b/gnss/2.1/vts/functional/Android.bp @@ -40,7 +40,7 @@ cc_test { "android.hardware.gnss@2.0", "android.hardware.gnss@2.1", "android.hardware.gnss@common-vts-lib", - "android.hardware.gnss-V2-cpp", + "android.hardware.gnss-V3-cpp", ], shared_libs: [ "libvintf", diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl index 48c88f5ffe..fd07a6e562 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl @@ -45,6 +45,7 @@ interface IGnssCallback { void gnssSetSystemInfoCb(in android.hardware.gnss.IGnssCallback.GnssSystemInfo info); void gnssRequestTimeCb(); void gnssRequestLocationCb(in boolean independentFromGnss, in boolean isUserEmergency); + void gnssSetSignalTypeCapabilitiesCb(in android.hardware.gnss.GnssSignalType[] gnssSignalTypes); const int CAPABILITY_SCHEDULING = 1; const int CAPABILITY_MSB = 2; const int CAPABILITY_MSA = 4; diff --git a/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl b/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl index 8633bea070..2b2592bf63 100644 --- a/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl +++ b/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl @@ -18,6 +18,7 @@ package android.hardware.gnss; import android.hardware.gnss.GnssConstellationType; import android.hardware.gnss.GnssLocation; +import android.hardware.gnss.GnssSignalType; import android.hardware.gnss.IGnssConfiguration; import android.hardware.gnss.IGnssPsds; @@ -308,4 +309,18 @@ interface IGnssCallback { * during-call to E911, or up to 5 minutes after end-of-call or text to E911). */ void gnssRequestLocationCb(in boolean independentFromGnss, in boolean isUserEmergency); + + /** + * Callback to inform the framework of the list of GnssSignalTypes the GNSS HAL implementation + * supports. + * + * These capabilities are static at runtime, i.e., they represent the signal types the + * GNSS implementation supports without considering the temporary disabled signal types such as + * the blocklisted satellites/constellations or the constellations disabled by regional + * restrictions. + * + * @param gnssSignalTypes a list of GnssSignalTypes specifying the constellations, carrier + * frequencies, and the code types the GNSS HAL implementation supports. + */ + void gnssSetSignalTypeCapabilitiesCb(in GnssSignalType[] gnssSignalTypes); } diff --git a/gnss/aidl/default/Android.bp b/gnss/aidl/default/Android.bp index c8ae6b263d..ca5a41f8e5 100644 --- a/gnss/aidl/default/Android.bp +++ b/gnss/aidl/default/Android.bp @@ -50,7 +50,7 @@ cc_binary { "android.hardware.gnss.measurement_corrections@1.1", "android.hardware.gnss.measurement_corrections@1.0", "android.hardware.gnss.visibility_control@1.0", - "android.hardware.gnss-V2-ndk", + "android.hardware.gnss-V3-ndk", ], srcs: [ "AGnssRil.cpp", diff --git a/gnss/aidl/default/Gnss.cpp b/gnss/aidl/default/Gnss.cpp index cf2c90d359..8a4d186131 100644 --- a/gnss/aidl/default/Gnss.cpp +++ b/gnss/aidl/default/Gnss.cpp @@ -74,7 +74,21 @@ ScopedAStatus Gnss::setCallback(const std::shared_ptr& callback) if (!status.isOk()) { ALOGE("%s: Unable to invoke callback.gnssSetSystemInfoCb", __func__); } - + GnssSignalType signalType1 = { + .constellation = GnssConstellationType::GPS, + .carrierFrequencyHz = 1.59975e+09, + .codeType = GnssSignalType::CODE_TYPE_C, + }; + GnssSignalType signalType2 = { + .constellation = GnssConstellationType::GLONASS, + .carrierFrequencyHz = 1.59975e+09, + .codeType = GnssSignalType::CODE_TYPE_C, + }; + status = sGnssCallback->gnssSetSignalTypeCapabilitiesCb( + std::vector({signalType1, signalType2})); + if (!status.isOk()) { + ALOGE("%s: Unable to invoke callback.gnssSetSignalTypeCapabilitiesCb", __func__); + } return ScopedAStatus::ok(); } diff --git a/gnss/aidl/default/gnss-default.xml b/gnss/aidl/default/gnss-default.xml index 7449310933..73b841e479 100644 --- a/gnss/aidl/default/gnss-default.xml +++ b/gnss/aidl/default/gnss-default.xml @@ -1,7 +1,7 @@ android.hardware.gnss - 2 + 3 IGnss default diff --git a/gnss/aidl/vts/Android.bp b/gnss/aidl/vts/Android.bp index f02a41e248..2a09a56866 100644 --- a/gnss/aidl/vts/Android.bp +++ b/gnss/aidl/vts/Android.bp @@ -51,7 +51,7 @@ cc_test { "libbinder", ], static_libs: [ - "android.hardware.gnss-V2-cpp", + "android.hardware.gnss-V3-cpp", "android.hardware.gnss@common-vts-lib", ], test_suites: [ diff --git a/gnss/aidl/vts/GnssCallbackAidl.cpp b/gnss/aidl/vts/GnssCallbackAidl.cpp index 2f6128b6d2..d3be41437a 100644 --- a/gnss/aidl/vts/GnssCallbackAidl.cpp +++ b/gnss/aidl/vts/GnssCallbackAidl.cpp @@ -23,6 +23,7 @@ using android::binder::Status; using android::hardware::gnss::GnssLocation; using GnssSvInfo = android::hardware::gnss::IGnssCallback::GnssSvInfo; using GnssSystemInfo = android::hardware::gnss::IGnssCallback::GnssSystemInfo; +using GnssSignalType = android::hardware::gnss::GnssSignalType; Status GnssCallbackAidl::gnssSetCapabilitiesCb(const int capabilities) { ALOGI("Capabilities received %#08x", capabilities); @@ -30,6 +31,20 @@ Status GnssCallbackAidl::gnssSetCapabilitiesCb(const int capabilities) { return Status::ok(); } +Status GnssCallbackAidl::gnssSetSignalTypeCapabilitiesCb( + const std::vector& signalTypes) { + ALOGI("SignalTypeCapabilities received"); + std::ostringstream ss; + for (auto& signalType : signalTypes) { + ss << "[constellation=" << (int)signalType.constellation + << ", carrierFrequencyHz=" << signalType.carrierFrequencyHz + << ", codeType=" << signalType.codeType << "], "; + } + ALOGI("%s", ss.str().c_str()); + signal_type_capabilities_cbq_.store(signalTypes); + return Status::ok(); +} + Status GnssCallbackAidl::gnssStatusCb(const GnssStatusValue /* status */) { ALOGI("gnssStatusCb"); return Status::ok(); diff --git a/gnss/aidl/vts/GnssCallbackAidl.h b/gnss/aidl/vts/GnssCallbackAidl.h index a9495ba3c2..06526d3d2d 100644 --- a/gnss/aidl/vts/GnssCallbackAidl.h +++ b/gnss/aidl/vts/GnssCallbackAidl.h @@ -25,6 +25,7 @@ class GnssCallbackAidl : public android::hardware::gnss::BnGnssCallback { public: GnssCallbackAidl() : capabilities_cbq_("capabilities"), + signal_type_capabilities_cbq_("signal_type_capabilities"), info_cbq_("system_info"), location_cbq_("location"), sv_info_list_cbq_("sv_info"), @@ -32,6 +33,8 @@ class GnssCallbackAidl : public android::hardware::gnss::BnGnssCallback { ~GnssCallbackAidl(){}; android::binder::Status gnssSetCapabilitiesCb(const int capabilities) override; + android::binder::Status gnssSetSignalTypeCapabilitiesCb( + const std::vector& signalTypes) override; android::binder::Status gnssStatusCb(const GnssStatusValue status) override; android::binder::Status gnssSvStatusCb(const std::vector& svInfoList) override; android::binder::Status gnssLocationCb( @@ -45,10 +48,14 @@ class GnssCallbackAidl : public android::hardware::gnss::BnGnssCallback { const bool isUserEmergency) override; int last_capabilities_; + std::vector last_signal_type_capabilities; android::hardware::gnss::IGnssCallback::GnssSystemInfo last_info_; android::hardware::gnss::GnssLocation last_location_; android::hardware::gnss::common::GnssCallbackEventQueue capabilities_cbq_; + android::hardware::gnss::common::GnssCallbackEventQueue< + std::vector> + signal_type_capabilities_cbq_; android::hardware::gnss::common::GnssCallbackEventQueue< android::hardware::gnss::IGnssCallback::GnssSystemInfo> info_cbq_; diff --git a/gnss/aidl/vts/gnss_hal_test.cpp b/gnss/aidl/vts/gnss_hal_test.cpp index 0e1218e40c..95e2a15f26 100644 --- a/gnss/aidl/vts/gnss_hal_test.cpp +++ b/gnss/aidl/vts/gnss_hal_test.cpp @@ -105,6 +105,15 @@ void GnssHalTest::SetUpGnssCallback() { EXPECT_TRUE(aidl_gnss_cb_->info_cbq_.retrieve(aidl_gnss_cb_->last_info_, TIMEOUT_SEC)); EXPECT_EQ(aidl_gnss_cb_->info_cbq_.calledCount(), 1); } + + /* + * SignalTypeCapabilities callback should trigger. + */ + if (aidl_gnss_hal_->getInterfaceVersion() >= 3) { + EXPECT_TRUE(aidl_gnss_cb_->signal_type_capabilities_cbq_.retrieve( + aidl_gnss_cb_->last_signal_type_capabilities, TIMEOUT_SEC)); + EXPECT_EQ(aidl_gnss_cb_->signal_type_capabilities_cbq_.calledCount(), 1); + } } void GnssHalTest::CheckLocation(const GnssLocation& location, bool check_speed) { diff --git a/gnss/common/utils/default/Android.bp b/gnss/common/utils/default/Android.bp index b896f04ddf..4cf17a66cd 100644 --- a/gnss/common/utils/default/Android.bp +++ b/gnss/common/utils/default/Android.bp @@ -57,6 +57,6 @@ cc_library_static { "android.hardware.gnss@2.1", "android.hardware.gnss.measurement_corrections@1.1", "android.hardware.gnss.measurement_corrections@1.0", - "android.hardware.gnss-V2-ndk", + "android.hardware.gnss-V3-ndk", ], } diff --git a/gnss/common/utils/vts/Android.bp b/gnss/common/utils/vts/Android.bp index f92e609f3c..b5325b2881 100644 --- a/gnss/common/utils/vts/Android.bp +++ b/gnss/common/utils/vts/Android.bp @@ -44,7 +44,7 @@ cc_library_static { "android.hardware.gnss@2.1", "android.hardware.gnss.measurement_corrections@1.0", "android.hardware.gnss.measurement_corrections@1.1", - "android.hardware.gnss-V2-cpp", + "android.hardware.gnss-V3-cpp", ], static_libs: [ "libgtest", From 9ed57888509961114aa4dae71afcc49c44edd342 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Thu, 20 Oct 2022 18:24:58 +0000 Subject: [PATCH 310/998] Reland "Add timeout logic to TestWakeupClientServiceImpl." Fixes a type issue where uptimeMillis returns in64_t not long type. This reverts commit cd8b38611a6b63be666bd745ae455faa05a5855c. Test: m -j TestWakeupClientServer forest run on aosp_x86-eng target which failed previously Change-Id: Ifc51cbe80787b0ecce2ffe42a2888962a8d9f941 --- .../include/TestWakeupClientServiceImpl.h | 43 +++++++- .../impl/src/TestWakeupClientServiceImpl.cpp | 100 ++++++++++++++++-- 2 files changed, 134 insertions(+), 9 deletions(-) diff --git a/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h b/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h index 4c440b8c00..61c1ad305e 100644 --- a/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h +++ b/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h @@ -17,6 +17,7 @@ #pragma once #include +#include #include #include #include @@ -41,20 +42,60 @@ class FakeTaskGenerator final { constexpr static uint8_t DATA[] = {0xde, 0xad, 0xbe, 0xef}; }; +struct TaskInfo { + // This is unique per-task. Note that a task might be popped and put back into the task queue, + // it will have a new task ID but the same clientId in the task data. + int taskId; + int64_t timestampInMs; + GetRemoteTasksResponse taskData; +}; + +struct TaskInfoComparator { + // We want the smallest timestamp and smallest task ID on top. + bool operator()(const TaskInfo& l, const TaskInfo& r) { + return l.timestampInMs > r.timestampInMs || + (l.timestampInMs == r.timestampInMs && l.taskId > r.taskId); + } +}; + +// forward-declaration. +class TaskQueue; + +class TaskTimeoutMessageHandler final : public android::MessageHandler { + public: + TaskTimeoutMessageHandler(TaskQueue* taskQueue); + void handleMessage(const android::Message& message) override; + + private: + TaskQueue* mTaskQueue; +}; + // TaskQueue is thread-safe. class TaskQueue final { public: + TaskQueue(); + ~TaskQueue(); + void add(const GetRemoteTasksResponse& response); std::optional maybePopOne(); void waitForTask(); void stopWait(); + void handleTaskTimeout(); private: + std::thread mCheckTaskTimeoutThread; std::mutex mLock; - std::queue mTasks GUARDED_BY(mLock); + std::priority_queue, TaskInfoComparator> mTasks + GUARDED_BY(mLock); // A variable to notify mTasks is not empty. std::condition_variable mTasksNotEmptyCv; bool mStopped GUARDED_BY(mLock); + android::sp mLooper; + android::sp mTaskTimeoutMessageHandler; + std::atomic mTaskIdCounter = 0; + + void checkForTestTimeoutLoop(); + void waitForTaskWithLock(std::unique_lock& lock); }; class TestWakeupClientServiceImpl final : public WakeupClient::Service { diff --git a/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp index 1eb87e285e..2cdf68b243 100644 --- a/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp +++ b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp @@ -17,7 +17,10 @@ #include "TestWakeupClientServiceImpl.h" #include +#include #include +#include +#include #include #include @@ -28,13 +31,15 @@ namespace remoteaccess { namespace { +using ::android::uptimeMillis; using ::android::base::ScopedLockAssertion; using ::android::base::StringPrintf; using ::grpc::ServerContext; using ::grpc::ServerWriter; using ::grpc::Status; -constexpr int kTaskIntervalInSec = 5; +constexpr int kTaskIntervalInMs = 5'000; +constexpr int64_t KTaskTimeoutInMs = 20'000; } // namespace @@ -47,24 +52,68 @@ GetRemoteTasksResponse FakeTaskGenerator::generateTask() { return response; } +TaskTimeoutMessageHandler::TaskTimeoutMessageHandler(TaskQueue* taskQueue) + : mTaskQueue(taskQueue) {} + +void TaskTimeoutMessageHandler::handleMessage(const android::Message& message) { + mTaskQueue->handleTaskTimeout(); +} + +TaskQueue::TaskQueue() { + mTaskTimeoutMessageHandler = android::sp::make(this); + mLooper = Looper::prepare(/*opts=*/0); + mCheckTaskTimeoutThread = std::thread([this] { checkForTestTimeoutLoop(); }); +} + +TaskQueue::~TaskQueue() { + { + std::lock_guard lockGuard(mLock); + mStopped = true; + } + while (true) { + // Remove all pending timeout handlers from queue. + if (!maybePopOne().has_value()) { + break; + } + } + if (mCheckTaskTimeoutThread.joinable()) { + mCheckTaskTimeoutThread.join(); + } +} + std::optional TaskQueue::maybePopOne() { std::lock_guard lockGuard(mLock); if (mTasks.size() == 0) { return std::nullopt; } - GetRemoteTasksResponse response = mTasks.front(); + TaskInfo response = std::move(mTasks.top()); mTasks.pop(); - return std::move(response); + mLooper->removeMessages(mTaskTimeoutMessageHandler, response.taskId); + return std::move(response.taskData); } + void TaskQueue::add(const GetRemoteTasksResponse& task) { - // TODO (b/246841306): add timeout to tasks. std::lock_guard lockGuard(mLock); - mTasks.push(task); + if (mStopped) { + return; + } + int taskId = mTaskIdCounter++; + mTasks.push(TaskInfo{ + .taskId = taskId, + .timestampInMs = uptimeMillis(), + .taskData = task, + }); + android::Message message(taskId); + mLooper->sendMessageDelayed(KTaskTimeoutInMs * 1000, mTaskTimeoutMessageHandler, message); mTasksNotEmptyCv.notify_all(); } void TaskQueue::waitForTask() { std::unique_lock lock(mLock); + waitForTaskWithLock(lock); +} + +void TaskQueue::waitForTaskWithLock(std::unique_lock& lock) { mTasksNotEmptyCv.wait(lock, [this] { ScopedLockAssertion lockAssertion(mLock); return mTasks.size() > 0 || mStopped; @@ -77,6 +126,41 @@ void TaskQueue::stopWait() { mTasksNotEmptyCv.notify_all(); } +void TaskQueue::checkForTestTimeoutLoop() { + Looper::setForThread(mLooper); + + while (true) { + { + std::unique_lock lock(mLock); + if (mStopped) { + ALOGW("The TestWakeupClientServiceImpl is stopping, " + "exiting checkForTestTimeoutLoop"); + return; + } + } + + mLooper->pollAll(/*timeoutMillis=*/-1); + } +} + +void TaskQueue::handleTaskTimeout() { + // We know which task timed-out from the taskId in the message. However, there is no easy way + // to remove a specific task with the task ID from the priority_queue, so we just check from + // the top of the queue (which have the oldest tasks). + std::lock_guard lockGuard(mLock); + int64_t now = uptimeMillis(); + while (mTasks.size() > 0) { + const TaskInfo& taskInfo = mTasks.top(); + if (taskInfo.timestampInMs + KTaskTimeoutInMs > now) { + break; + } + // In real implementation, this should report task failure to remote wakeup server. + ALOGW("Task for client ID: %s timed-out, added at %" PRId64 " ms, now %" PRId64 " ms", + taskInfo.taskData.clientid().c_str(), taskInfo.timestampInMs, now); + mTasks.pop(); + } +} + TestWakeupClientServiceImpl::TestWakeupClientServiceImpl() { mThread = std::thread([this] { fakeTaskGenerateLoop(); }); } @@ -95,13 +179,13 @@ TestWakeupClientServiceImpl::~TestWakeupClientServiceImpl() { void TestWakeupClientServiceImpl::fakeTaskGenerateLoop() { // In actual implementation, this should communicate with the remote server and receives tasks - // from it. Here we simulate receiving one remote task every {kTaskIntervalInSec}s. + // from it. Here we simulate receiving one remote task every {kTaskIntervalInMs}ms. while (true) { mTaskQueue.add(mFakeTaskGenerator.generateTask()); - ALOGI("Sleeping for %d seconds until next task", kTaskIntervalInSec); + ALOGI("Sleeping for %d seconds until next task", kTaskIntervalInMs); std::unique_lock lk(mLock); - if (mServerStoppedCv.wait_for(lk, std::chrono::seconds(kTaskIntervalInSec), [this] { + if (mServerStoppedCv.wait_for(lk, std::chrono::milliseconds(kTaskIntervalInMs), [this] { ScopedLockAssertion lockAssertion(mLock); return mServerStopped; })) { From f8b203106466797caa36c02b716221e78f45fe8a Mon Sep 17 00:00:00 2001 From: Sewook Seo Date: Fri, 21 Oct 2022 00:43:46 +0000 Subject: [PATCH 311/998] Revert "Radio HAL : Support N3IWF" Revert "Update IRadioNetworkImpl of MockModem" Revert "N3IWF HAL support: update NetworkResponse" Revert submission 20057104-hal_support_n3iwf Reason for revert: Reverted Changes: Ie7784ffa3:Update IRadioNetworkImpl of MockModem Iad6a6cc2e:N3IWF HAL support: update NetworkResponse I2b5506d84:Radio HAL : Support N3IWF cuttlefish work I8b4b055be:Radio HAL : Support N3IWF Change-Id: I767ed13a8cd63bcbb28d4804e72cf3f01cd3584b --- .../compatibility_matrix.current.xml | 2 +- radio/aidl/Android.bp | 28 +++--- .../radio/data/IRadioDataIndication.aidl | 4 - .../hardware/radio/network/IRadioNetwork.aidl | 7 -- .../radio/network/IRadioNetworkResponse.aidl | 7 -- .../hardware/radio/network/NrVopsInfo.aidl | 1 - .../radio/network/RegStateResult.aidl | 1 - .../android/hardware/radio/AccessNetwork.aidl | 5 -- .../hardware/radio/RadioTechnologyFamily.aidl | 1 - .../android/hardware/radio/AccessNetwork.aidl | 25 ++---- .../hardware/radio/RadioTechnologyFamily.aidl | 4 - .../radio/data/IRadioDataIndication.aidl | 17 ---- .../hardware/radio/network/IRadioNetwork.aidl | 23 +---- .../radio/network/IRadioNetworkResponse.aidl | 18 +--- .../hardware/radio/network/NrVopsInfo.aidl | 5 -- .../radio/network/RegStateResult.aidl | 5 -- radio/aidl/compat/libradiocompat/Android.bp | 3 +- .../include/libradiocompat/RadioNetwork.h | 3 - .../libradiocompat/network/RadioNetwork.cpp | 12 --- radio/aidl/compat/service/Android.bp | 3 +- radio/aidl/vts/Android.bp | 4 +- radio/aidl/vts/radio_data_indication.cpp | 7 -- radio/aidl/vts/radio_data_utils.h | 3 - radio/aidl/vts/radio_network_response.cpp | 8 -- radio/aidl/vts/radio_network_test.cpp | 90 ------------------- radio/aidl/vts/radio_network_utils.h | 4 - 26 files changed, 32 insertions(+), 258 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 98b3fca815..a20d15db3a 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -461,7 +461,7 @@ android.hardware.radio.data - 2 + 1 IRadioData slot1 diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp index 01d70cd032..613f31b94a 100644 --- a/radio/aidl/Android.bp +++ b/radio/aidl/Android.bp @@ -36,7 +36,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/config/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V1"], backend: { cpp: { enabled: true, @@ -48,7 +48,7 @@ aidl_interface { versions_with_info: [ { version: "1", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V1"], }, ], @@ -60,7 +60,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/data/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V1"], backend: { cpp: { enabled: true, @@ -72,7 +72,7 @@ aidl_interface { versions_with_info: [ { version: "1", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V1"], }, ], @@ -84,7 +84,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/messaging/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V1"], backend: { cpp: { enabled: true, @@ -96,7 +96,7 @@ aidl_interface { versions_with_info: [ { version: "1", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V1"], }, ], @@ -108,7 +108,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/modem/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V1"], backend: { cpp: { enabled: true, @@ -120,7 +120,7 @@ aidl_interface { versions_with_info: [ { version: "1", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V1"], }, ], @@ -132,7 +132,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/network/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V1"], backend: { cpp: { enabled: true, @@ -144,7 +144,7 @@ aidl_interface { versions_with_info: [ { version: "1", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V1"], }, ], @@ -157,7 +157,7 @@ aidl_interface { srcs: ["android/hardware/radio/sim/*.aidl"], stability: "vintf", imports: [ - "android.hardware.radio-V2", + "android.hardware.radio-V1", "android.hardware.radio.config", ], backend: { @@ -172,7 +172,7 @@ aidl_interface { { version: "1", imports: [ - "android.hardware.radio-V2", + "android.hardware.radio-V1", "android.hardware.radio.config-V1", ], }, @@ -186,7 +186,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/voice/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V1"], backend: { cpp: { enabled: true, @@ -198,7 +198,7 @@ aidl_interface { versions_with_info: [ { version: "1", - imports: ["android.hardware.radio-V2"], + imports: ["android.hardware.radio-V1"], }, ], diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioDataIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioDataIndication.aidl index 5983afe6d6..0ffa1f7ddf 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioDataIndication.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/IRadioDataIndication.aidl @@ -37,10 +37,6 @@ interface IRadioDataIndication { oneway void dataCallListChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.data.SetupDataCallResult[] dcList); oneway void keepaliveStatus(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.data.KeepaliveStatus status); oneway void pcoData(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.data.PcoDataInfo pco); - /** - * @deprecated use unthrottleDataProfile to clarify access network for this event. - */ oneway void unthrottleApn(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.data.DataProfileInfo dataProfileInfo); oneway void slicingConfigChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.data.SlicingConfig slicingConfig); - oneway void unthrottleDataProfile(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.AccessNetwork accessNetwork, in android.hardware.radio.data.DataProfileInfo dataProfileInfo); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl index 3b0c5e0ab7..832738ffbf 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl @@ -40,9 +40,6 @@ interface IRadioNetwork { oneway void getBarringInfo(in int serial); oneway void getCdmaRoamingPreference(in int serial); oneway void getCellInfoList(in int serial); - /** - * @deprecated use getRegistrationState() - */ oneway void getDataRegistrationState(in int serial); oneway void getImsRegistrationState(in int serial); oneway void getNetworkSelectionMode(in int serial); @@ -50,9 +47,6 @@ interface IRadioNetwork { oneway void getSignalStrength(in int serial); oneway void getSystemSelectionChannels(in int serial); oneway void getVoiceRadioTechnology(in int serial); - /** - * @deprecated use getRegistrationState() - */ oneway void getVoiceRegistrationState(in int serial); oneway void isNrDualConnectivityEnabled(in int serial); oneway void responseAcknowledgement(); @@ -80,5 +74,4 @@ interface IRadioNetwork { oneway void triggerEmergencyNetworkScan(int serial, in android.hardware.radio.network.EmergencyNetworkScanTrigger request); oneway void cancelEmergencyNetworkScan(in int serial); oneway void exitEmergencyMode(in int serial); - oneway void getRegistrationState(in int serial, in android.hardware.radio.RadioTechnologyFamily ratFamily, in android.hardware.radio.network.Domain domain); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl index 228451f388..24d587e655 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -41,9 +41,6 @@ interface IRadioNetworkResponse { oneway void getBarringInfoResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.CellIdentity cellIdentity, in android.hardware.radio.network.BarringInfo[] barringInfos); oneway void getCdmaRoamingPreferenceResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.CdmaRoamingType type); oneway void getCellInfoListResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.CellInfo[] cellInfo); - /** - * @deprecated use getRegistrationStateResponse() - */ oneway void getDataRegistrationStateResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.RegStateResult dataRegResponse); oneway void getImsRegistrationStateResponse(in android.hardware.radio.RadioResponseInfo info, in boolean isRegistered, in android.hardware.radio.RadioTechnologyFamily ratFamily); oneway void getNetworkSelectionModeResponse(in android.hardware.radio.RadioResponseInfo info, in boolean manual); @@ -51,9 +48,6 @@ interface IRadioNetworkResponse { oneway void getSignalStrengthResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.SignalStrength signalStrength); oneway void getSystemSelectionChannelsResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.RadioAccessSpecifier[] specifiers); oneway void getVoiceRadioTechnologyResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.RadioTechnology rat); - /** - * @deprecated use getRegistrationStateResponse() - */ oneway void getVoiceRegistrationStateResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.RegStateResult voiceRegResponse); oneway void isNrDualConnectivityEnabledResponse(in android.hardware.radio.RadioResponseInfo info, in boolean isEnabled); oneway void setAllowedNetworkTypesBitmapResponse(in android.hardware.radio.RadioResponseInfo info); @@ -79,5 +73,4 @@ interface IRadioNetworkResponse { oneway void triggerEmergencyNetworkScanResponse(in android.hardware.radio.RadioResponseInfo info); oneway void exitEmergencyModeResponse(in android.hardware.radio.RadioResponseInfo info); oneway void cancelEmergencyNetworkScanResponse(in android.hardware.radio.RadioResponseInfo info); - oneway void getRegistrationStateResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.RegStateResult regResponse); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrVopsInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrVopsInfo.aidl index 0b2d73331b..e5a0a700ca 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrVopsInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrVopsInfo.aidl @@ -41,7 +41,6 @@ parcelable NrVopsInfo { const byte EMC_INDICATOR_NR_CONNECTED_TO_5GCN = 1; const byte EMC_INDICATOR_EUTRA_CONNECTED_TO_5GCN = 2; const byte EMC_INDICATOR_BOTH_NR_EUTRA_CONNECTED_TO_5GCN = 3; - const byte EMC_INDICATOR_EMC_OVER_NON_3GPP = 4; const byte EMF_INDICATOR_NOT_SUPPORTED = 0; const byte EMF_INDICATOR_NR_CONNECTED_TO_5GCN = 1; const byte EMF_INDICATOR_EUTRA_CONNECTED_TO_5GCN = 2; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegStateResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegStateResult.aidl index c1e5c8d40b..f0a03aea4f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegStateResult.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegStateResult.aidl @@ -40,5 +40,4 @@ parcelable RegStateResult { android.hardware.radio.network.CellIdentity cellIdentity; String registeredPlmn; android.hardware.radio.network.AccessTechnologySpecificInfo accessTechnologySpecificInfo; - android.hardware.radio.AccessNetwork accessNetwork = android.hardware.radio.AccessNetwork.UNKNOWN; } diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/AccessNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/AccessNetwork.aidl index 4a53a6d2d8..8ce689f501 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/AccessNetwork.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/AccessNetwork.aidl @@ -39,11 +39,6 @@ enum AccessNetwork { UTRAN = 2, EUTRAN = 3, CDMA2000 = 4, - /** - * @deprecated should use N3ANEPS or N3AN5GS based on N3AN selection. - */ IWLAN = 5, NGRAN = 6, - N3ANEPS = 5, - N3AN5GS = 7, } diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnologyFamily.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnologyFamily.aidl index 5a8f4038e2..e6fdce269d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnologyFamily.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnologyFamily.aidl @@ -36,5 +36,4 @@ package android.hardware.radio; enum RadioTechnologyFamily { THREE_GPP = 0, THREE_GPP2 = 1, - NON_3GPP = 2, } diff --git a/radio/aidl/android/hardware/radio/AccessNetwork.aidl b/radio/aidl/android/hardware/radio/AccessNetwork.aidl index b85143d4f4..2885642e83 100644 --- a/radio/aidl/android/hardware/radio/AccessNetwork.aidl +++ b/radio/aidl/android/hardware/radio/AccessNetwork.aidl @@ -23,39 +23,30 @@ enum AccessNetwork { /** * Unknown access network */ - UNKNOWN = 0, + UNKNOWN, /** * GSM EDGE Radio Access Network */ - GERAN = 1, + GERAN, /** * Universal Terrestrial Radio Access Network */ - UTRAN = 2, + UTRAN, /** * Evolved Universal Terrestrial Radio Access Network */ - EUTRAN = 3, + EUTRAN, /** * CDMA 2000 network */ - CDMA2000 = 4, + CDMA2000, /** - * Interworking Wireless LAN. - * @deprecated should use N3ANEPS or N3AN5GS based on N3AN selection. + * Interworking Wireless LAN */ - IWLAN = 5, + IWLAN, /** * Next-Generation Radio Access Network (NGRAN). * Note NGRAN is only for standalone mode. Non-standalone mode uses AccessNetwork EUTRAN. */ - NGRAN = 6, - /** - * Non-3GPP Access Network for EPS. - */ - N3ANEPS = 5, - /** - * Non-3GPP Access Network for 5GS. - */ - N3AN5GS = 7, + NGRAN, } diff --git a/radio/aidl/android/hardware/radio/RadioTechnologyFamily.aidl b/radio/aidl/android/hardware/radio/RadioTechnologyFamily.aidl index 4f4bbcb90d..a2b989d18d 100644 --- a/radio/aidl/android/hardware/radio/RadioTechnologyFamily.aidl +++ b/radio/aidl/android/hardware/radio/RadioTechnologyFamily.aidl @@ -28,8 +28,4 @@ enum RadioTechnologyFamily { * 3GPP2 Technologies - CDMA */ THREE_GPP2, - /** - * Non 3GPP Technologies - IWLAN, N3IWF - */ - NON_3GPP, } diff --git a/radio/aidl/android/hardware/radio/data/IRadioDataIndication.aidl b/radio/aidl/android/hardware/radio/data/IRadioDataIndication.aidl index b2e6ca420e..938c695fd4 100644 --- a/radio/aidl/android/hardware/radio/data/IRadioDataIndication.aidl +++ b/radio/aidl/android/hardware/radio/data/IRadioDataIndication.aidl @@ -16,7 +16,6 @@ package android.hardware.radio.data; -import android.hardware.radio.AccessNetwork; import android.hardware.radio.RadioIndicationType; import android.hardware.radio.data.DataProfileInfo; import android.hardware.radio.data.KeepaliveStatus; @@ -72,7 +71,6 @@ oneway interface IRadioDataIndication { * * @param type Type of radio indication * @param dataProfileInfo Data profile info. - * @deprecated use unthrottleDataProfile to clarify access network for this event. */ void unthrottleApn(in RadioIndicationType type, in DataProfileInfo dataProfileInfo); @@ -88,19 +86,4 @@ oneway interface IRadioDataIndication { * */ void slicingConfigChanged(in RadioIndicationType type, in SlicingConfig slicingConfig); - - /** - * The modem can explicitly set SetupDataCallResult::suggestedRetryTime after a failure in - * IRadioData.SetupDataCall. During that time, no new calls are allowed to - * IRadioData.SetupDataCall that use the same APN(or DNN) in DataProfile. - * When IRadioDataIndication.unthrottleDataProfile is sent, AOSP will no longer throttle calls - * to IRadioData.SetupDataCall for the given APN(or DNN) in DataProfile. - * - * @param type Type of radio indication - * @param accessNetwork Access network this throttling occurred, this must match the access - * network passed in setup data call request. - * @param dataProfileInfo Data profile info. - */ - void unthrottleDataProfile(in RadioIndicationType type, in AccessNetwork accessNetwork, - in DataProfileInfo dataProfileInfo); } diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl index c82fde29ef..0ac8b0e83e 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl @@ -17,11 +17,7 @@ package android.hardware.radio.network; import android.hardware.radio.AccessNetwork; -import android.hardware.radio.RadioTechnologyFamily; import android.hardware.radio.network.CdmaRoamingType; -import android.hardware.radio.network.Domain; -import android.hardware.radio.network.EmergencyMode; -import android.hardware.radio.network.EmergencyNetworkScanTrigger; import android.hardware.radio.network.IRadioNetworkIndication; import android.hardware.radio.network.IRadioNetworkResponse; import android.hardware.radio.network.IndicationFilter; @@ -31,6 +27,8 @@ import android.hardware.radio.network.RadioAccessSpecifier; import android.hardware.radio.network.RadioBandMode; import android.hardware.radio.network.SignalThresholdInfo; import android.hardware.radio.network.UsageSetting; +import android.hardware.radio.network.EmergencyNetworkScanTrigger; +import android.hardware.radio.network.EmergencyMode; /** * This interface is used by telephony and telecom to talk to cellular radio for network APIs. @@ -105,7 +103,6 @@ oneway interface IRadioNetwork { * @param serial Serial number of request. * * Response function is IRadioNetworkResponse.getDataRegistrationStateResponse() - * @deprecated use getRegistrationState() */ void getDataRegistrationState(in int serial); @@ -170,7 +167,6 @@ oneway interface IRadioNetwork { * @param serial Serial number of request. * * Response function is IRadioNetworkResponse.getVoiceRegistrationStateResponse() - * @deprecated use getRegistrationState() */ void getVoiceRegistrationState(in int serial); @@ -453,7 +449,7 @@ oneway interface IRadioNetwork { * * Response function is IRadioEmergencyResponse.setEmergencyModeResponse() */ - void setEmergencyMode(int serial, in EmergencyMode emcModeType); + void setEmergencyMode(int serial, in EmergencyMode emcModeType ); /** * Triggers an Emergency network scan. @@ -464,7 +460,7 @@ oneway interface IRadioNetwork { * * Response function is IRadioEmergencyResponse.triggerEmergencyNetworkScanResponse() */ - void triggerEmergencyNetworkScan(int serial, in EmergencyNetworkScanTrigger request); + void triggerEmergencyNetworkScan( int serial, in EmergencyNetworkScanTrigger request); /** * Cancels ongoing Emergency network scan @@ -483,15 +479,4 @@ oneway interface IRadioNetwork { * Response function is IRadioEmergencyResponse.exitEmergencyModeResponse() */ void exitEmergencyMode(in int serial); - - /** - * Request current registration state. - * - * @param serial Serial number of request. - * @param ratFamily RadioTechnologyFamily of request. - * @param domain Domain PS or CS of request. - * - * Response function is IRadioNetworkResponse.getRegistrationStateResponse() - */ - void getRegistrationState(in int serial, in RadioTechnologyFamily ratFamily, in Domain domain); } diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl index 69d53ee81a..243e949b9e 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -23,13 +23,13 @@ import android.hardware.radio.network.BarringInfo; import android.hardware.radio.network.CdmaRoamingType; import android.hardware.radio.network.CellIdentity; import android.hardware.radio.network.CellInfo; -import android.hardware.radio.network.EmergencyRegResult; import android.hardware.radio.network.OperatorInfo; import android.hardware.radio.network.RadioAccessSpecifier; import android.hardware.radio.network.RadioBandMode; import android.hardware.radio.network.RegStateResult; import android.hardware.radio.network.SignalStrength; import android.hardware.radio.network.UsageSetting; +import android.hardware.radio.network.EmergencyRegResult; /** * Interface declaring response functions to solicited radio requests for network APIs. @@ -153,8 +153,6 @@ oneway interface IRadioNetworkResponse { * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR * RadioError:NOT_PROVISIONED - * - * @deprecated use getRegistrationStateResponse() */ void getDataRegistrationStateResponse( in RadioResponseInfo info, in RegStateResult dataRegResponse); @@ -261,8 +259,6 @@ oneway interface IRadioNetworkResponse { * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR - * - * @deprecated use getRegistrationStateResponse() */ void getVoiceRegistrationStateResponse( in RadioResponseInfo info, in RegStateResult voiceRegResponse); @@ -620,16 +616,4 @@ oneway interface IRadioNetworkResponse { * RadioError:MODEM_ERR */ void cancelEmergencyNetworkScanResponse(in RadioResponseInfo info); - - /** - * @param info Response info struct containing response type, serial no. and error - * @param regResponse Current registration response as defined by RegStateResult - * - * Valid errors returned: - * RadioError:NONE - * RadioError:RADIO_NOT_AVAILABLE - * RadioError:INTERNAL_ERR - * RadioError:NOT_PROVISIONED - */ - void getRegistrationStateResponse(in RadioResponseInfo info, in RegStateResult regResponse); } diff --git a/radio/aidl/android/hardware/radio/network/NrVopsInfo.aidl b/radio/aidl/android/hardware/radio/network/NrVopsInfo.aidl index 2b0b7c9478..197f401e7e 100644 --- a/radio/aidl/android/hardware/radio/network/NrVopsInfo.aidl +++ b/radio/aidl/android/hardware/radio/network/NrVopsInfo.aidl @@ -39,10 +39,6 @@ parcelable NrVopsInfo { * Emergency services supported in NR connected to 5GCN and E-UTRA connected to 5GCN */ const byte EMC_INDICATOR_BOTH_NR_EUTRA_CONNECTED_TO_5GCN = 3; - /** - * Emergency services supported over 5G N3GPP access. - */ - const byte EMC_INDICATOR_EMC_OVER_NON_3GPP = 4; /** * Emergency services fallback not supported @@ -100,7 +96,6 @@ parcelable NrVopsInfo { * NR REGISTRATION ACCEPT. * Refer 3GPP 24.501 EPS 5GS network feature support -> EMF * Values are EMF_INDICATOR_ from TS 24.501 sec 9.10.3.5. - * Not Applicable for the registration via non-3GPP access. */ byte emfSupported; } diff --git a/radio/aidl/android/hardware/radio/network/RegStateResult.aidl b/radio/aidl/android/hardware/radio/network/RegStateResult.aidl index 979b4b84b5..3d96b8cbf2 100644 --- a/radio/aidl/android/hardware/radio/network/RegStateResult.aidl +++ b/radio/aidl/android/hardware/radio/network/RegStateResult.aidl @@ -16,7 +16,6 @@ package android.hardware.radio.network; -import android.hardware.radio.AccessNetwork; import android.hardware.radio.RadioTechnology; import android.hardware.radio.network.AccessTechnologySpecificInfo; import android.hardware.radio.network.CellIdentity; @@ -60,8 +59,4 @@ parcelable RegStateResult { * Access-technology-specific registration information, such as for CDMA2000. */ AccessTechnologySpecificInfo accessTechnologySpecificInfo; - /** - * Indicates the access network used for this registration. - */ - AccessNetwork accessNetwork = AccessNetwork.UNKNOWN; } diff --git a/radio/aidl/compat/libradiocompat/Android.bp b/radio/aidl/compat/libradiocompat/Android.bp index 2f7fc59c60..f79e045f63 100644 --- a/radio/aidl/compat/libradiocompat/Android.bp +++ b/radio/aidl/compat/libradiocompat/Android.bp @@ -31,13 +31,12 @@ cc_library { "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION", ], shared_libs: [ - "android.hardware.radio-V2-ndk", "android.hardware.radio.config-V1-ndk", "android.hardware.radio.config@1.0", "android.hardware.radio.config@1.1", "android.hardware.radio.config@1.2", "android.hardware.radio.config@1.3", - "android.hardware.radio.data-V2-ndk", + "android.hardware.radio.data-V1-ndk", "android.hardware.radio.messaging-V1-ndk", "android.hardware.radio.modem-V1-ndk", "android.hardware.radio.network-V2-ndk", diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h index c8862678f3..c714190153 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h @@ -99,9 +99,6 @@ class RadioNetwork : public RadioCompatBase, scanTrigger) override; ::ndk::ScopedAStatus cancelEmergencyNetworkScan(int32_t serial) override; ::ndk::ScopedAStatus exitEmergencyMode(int32_t serial) override; - ::ndk::ScopedAStatus getRegistrationState( - int32_t serial, ::aidl::android::hardware::radio::RadioTechnologyFamily ratFamily, - ::aidl::android::hardware::radio::network::Domain domain) override; protected: std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse> respond(); diff --git a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp index 638b34ebd6..ff30ac3633 100644 --- a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp +++ b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp @@ -340,16 +340,4 @@ ScopedAStatus RadioNetwork::exitEmergencyMode(int32_t serial) { return ok(); } -ScopedAStatus RadioNetwork::getRegistrationState( - int32_t serial, ::aidl::android::hardware::radio::RadioTechnologyFamily ratFamily, - aidl::Domain domain) { - LOG_CALL << serial; - if (ratFamily == ::aidl::android::hardware::radio::RadioTechnologyFamily::THREE_GPP && - domain == aidl::Domain::PS) { - LOG_CALL << " Radio Technology Family 3GPP and Domain PS"; - } - LOG(ERROR) << " geRegistrationState is unsupported by HIDL HALs"; - respond()->getRegistrationStateResponse(notSupported(serial), {}); - return ok(); -} } // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/service/Android.bp b/radio/aidl/compat/service/Android.bp index 45a34976a8..4dbaef4e71 100644 --- a/radio/aidl/compat/service/Android.bp +++ b/radio/aidl/compat/service/Android.bp @@ -34,13 +34,12 @@ cc_binary { ], shared_libs: [ "android.hardware.radio-library.compat", - "android.hardware.radio-V2-ndk", "android.hardware.radio.config-V1-ndk", "android.hardware.radio.config@1.0", "android.hardware.radio.config@1.1", "android.hardware.radio.config@1.2", "android.hardware.radio.config@1.3", - "android.hardware.radio.data-V2-ndk", + "android.hardware.radio.data-V1-ndk", "android.hardware.radio.messaging-V1-ndk", "android.hardware.radio.modem-V1-ndk", "android.hardware.radio.network-V2-ndk", diff --git a/radio/aidl/vts/Android.bp b/radio/aidl/vts/Android.bp index ba68728768..0d4bb3eddf 100644 --- a/radio/aidl/vts/Android.bp +++ b/radio/aidl/vts/Android.bp @@ -63,9 +63,9 @@ cc_test { "libvintf", ], static_libs: [ - "android.hardware.radio-V2-ndk", + "android.hardware.radio-V1-ndk", "android.hardware.radio.config-V1-ndk", - "android.hardware.radio.data-V2-ndk", + "android.hardware.radio.data-V1-ndk", "android.hardware.radio.messaging-V1-ndk", "android.hardware.radio.modem-V1-ndk", "android.hardware.radio.network-V2-ndk", diff --git a/radio/aidl/vts/radio_data_indication.cpp b/radio/aidl/vts/radio_data_indication.cpp index 213505d4cb..61e079e532 100644 --- a/radio/aidl/vts/radio_data_indication.cpp +++ b/radio/aidl/vts/radio_data_indication.cpp @@ -42,10 +42,3 @@ ndk::ScopedAStatus RadioDataIndication::slicingConfigChanged( RadioIndicationType /*type*/, const SlicingConfig& /*slicingConfig*/) { return ndk::ScopedAStatus::ok(); } - -ndk::ScopedAStatus RadioDataIndication::unthrottleDataProfile( - RadioIndicationType /*type*/, - ::aidl::android::hardware::radio::AccessNetwork /*accessNetwork*/, - const DataProfileInfo& /*dataProfileInfo*/) { - return ndk::ScopedAStatus::ok(); -} diff --git a/radio/aidl/vts/radio_data_utils.h b/radio/aidl/vts/radio_data_utils.h index cfb2ab2a4e..fb91ef61d5 100644 --- a/radio/aidl/vts/radio_data_utils.h +++ b/radio/aidl/vts/radio_data_utils.h @@ -97,9 +97,6 @@ class RadioDataIndication : public BnRadioDataIndication { const DataProfileInfo& dataProfile) override; virtual ndk::ScopedAStatus slicingConfigChanged(RadioIndicationType type, const SlicingConfig& slicingConfig) override; - virtual ndk::ScopedAStatus unthrottleDataProfile( - RadioIndicationType type, ::aidl::android::hardware::radio::AccessNetwork accessNetwork, - const DataProfileInfo& dataProfile) override; }; // The main test class for Radio AIDL Data. diff --git a/radio/aidl/vts/radio_network_response.cpp b/radio/aidl/vts/radio_network_response.cpp index ff58ecd3cd..5599c0332f 100644 --- a/radio/aidl/vts/radio_network_response.cpp +++ b/radio/aidl/vts/radio_network_response.cpp @@ -293,11 +293,3 @@ ndk::ScopedAStatus RadioNetworkResponse::cancelEmergencyNetworkScanResponse( parent_network.notify(info.serial); return ndk::ScopedAStatus::ok(); } - -ndk::ScopedAStatus RadioNetworkResponse::getRegistrationStateResponse( - const RadioResponseInfo& info, const RegStateResult& regResponse) { - rspInfo = info; - regResp = regResponse; - parent_network.notify(info.serial); - return ndk::ScopedAStatus::ok(); -} diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index 054b69ef1f..25c42d35b2 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -15,9 +15,7 @@ */ #include -#include #include -#include #include #include #include @@ -1913,91 +1911,3 @@ TEST_P(RadioNetworkTest, exitEmergencyMode) { {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); LOG(DEBUG) << "exitEmergencyMode finished"; } - -/* - * Test IRadioNetwork.getRegistrationState() for the response returned. - */ -TEST_P(RadioNetworkTest, getRegistrationState) { - serial = GetRandomSerialNumber(); - - ndk::ScopedAStatus res = radio_network->getRegistrationState( - serial, RadioTechnologyFamily::THREE_GPP, Domain::PS); - ASSERT_OK(res); - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); - EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); - - ALOGI("getRegistrationStateResponse, rspInfo.error = %s\n", - toString(radioRsp_network->rspInfo.error).c_str()); - ASSERT_TRUE(CheckAnyOfErrors( - radioRsp_network->rspInfo.error, - {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::NOT_PROVISIONED})); - // Check the mcc [0, 999] and mnc [0, 999]. - std::string mcc; - std::string mnc; - bool checkMccMnc = true; - CellIdentity cellIdentity = radioRsp_network->regResp.cellIdentity; - switch (cellIdentity.getTag()) { - case CellIdentity::noinit: { - checkMccMnc = false; - break; - } - case CellIdentity::gsm: { - CellIdentityGsm cig = cellIdentity.get(); - mcc = cig.mcc; - mnc = cig.mnc; - break; - } - case CellIdentity::wcdma: { - CellIdentityWcdma ciw = cellIdentity.get(); - mcc = ciw.mcc; - mnc = ciw.mnc; - break; - } - case CellIdentity::tdscdma: { - CellIdentityTdscdma cit = cellIdentity.get(); - mcc = cit.mcc; - mnc = cit.mnc; - break; - } - case CellIdentity::cdma: { - // CellIdentityCdma has no mcc/mnc - CellIdentityCdma cic = cellIdentity.get(); - checkMccMnc = false; - break; - } - case CellIdentity::lte: { - CellIdentityLte cil = cellIdentity.get(); - mcc = cil.mcc; - mnc = cil.mnc; - break; - } - case CellIdentity::nr: { - CellIdentityNr cin = cellIdentity.get(); - mcc = cin.mcc; - mnc = cin.mnc; - break; - } - } - - // 32 bit system might return invalid mcc and mnc string "\xff\xff..." - if (checkMccMnc && mcc.size() < 4 && mnc.size() < 4) { - int mcc_int = stoi(mcc); - int mnc_int = stoi(mnc); - EXPECT_TRUE(mcc_int >= 0 && mcc_int <= 999); - EXPECT_TRUE(mnc_int >= 0 && mnc_int <= 999); - } - - // Check for access technology specific info - AccessTechnologySpecificInfo info = radioRsp_network->regResp.accessTechnologySpecificInfo; - RadioTechnology rat = radioRsp_network->regResp.rat; - // TODO: add logic for cdmaInfo - if (rat == RadioTechnology::LTE || rat == RadioTechnology::LTE_CA) { - ASSERT_EQ(info.getTag(), AccessTechnologySpecificInfo::eutranInfo); - } else if (rat == RadioTechnology::NR) { - ASSERT_EQ(info.getTag(), AccessTechnologySpecificInfo::ngranNrVopsInfo); - } - AccessNetwork an = radioRsp_network->regResp.accessNetwork; - ASSERT_NE(an, AccessNetwork::N3AN5GS); - ASSERT_NE(an, AccessNetwork::N3ANEPS); -} diff --git a/radio/aidl/vts/radio_network_utils.h b/radio/aidl/vts/radio_network_utils.h index f30b74220b..8480825421 100644 --- a/radio/aidl/vts/radio_network_utils.h +++ b/radio/aidl/vts/radio_network_utils.h @@ -42,7 +42,6 @@ class RadioNetworkResponse : public BnRadioNetworkResponse { int networkTypeBitmapResponse; RegStateResult voiceRegResp; RegStateResult dataRegResp; - RegStateResult regResp; CellIdentity barringCellIdentity; std::vector barringInfoList; UsageSetting usageSetting; @@ -159,9 +158,6 @@ class RadioNetworkResponse : public BnRadioNetworkResponse { virtual ndk::ScopedAStatus cancelEmergencyNetworkScanResponse( const RadioResponseInfo& info) override; - - virtual ndk::ScopedAStatus getRegistrationStateResponse( - const RadioResponseInfo& info, const RegStateResult& regResponse) override; }; /* Callback class for radio network indication */ From ca78b7a817651553f65ce23f6311a2d2eff577d9 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Fri, 21 Oct 2022 14:21:25 +0900 Subject: [PATCH 312/998] Mark android.hardware.drm as an updatable hal As widevine impl has been moved to an updatable APEX. Bug: 248142818 Bug: 243333942 Test: check-vintf-all Change-Id: I2e8ea011af8dbcc8d6eb55236c039795851ad9b7 --- compatibility_matrices/compatibility_matrix.current.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index e387f4a576..cb8519e226 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -197,7 +197,7 @@ default - + android.hardware.drm 1 From 4728fc48ccd29c2a441ecd1ffedd925a6234ecf7 Mon Sep 17 00:00:00 2001 From: Austin Borger Date: Fri, 15 Jul 2022 11:27:53 -0700 Subject: [PATCH 313/998] Create API for reporting color space support to Camera2 framework consumers. Test: Ran CtsCameraTestCases. Test: Ran VtsAidlHalCameraProvider_TargetTest. Test: Created app to test display P3 camera, switching between color spaces Bug: 238359088 Change-Id: I382dea5d13582817959001246240141e83d8172d --- camera/device/aidl/Android.bp | 6 +- .../hardware/camera/device/Stream.aidl | 1 + .../hardware/camera/device/Stream.aidl | 25 +- .../camera/metadata/CameraMetadataTag.aidl | 1 + .../RequestAvailableCapabilities.aidl | 1 + ...RequestAvailableColorSpaceProfilesMap.aidl | 58 +++ .../camera/metadata/CameraMetadataTag.aidl | 6 + .../RequestAvailableCapabilities.aidl | 1 + ...RequestAvailableColorSpaceProfilesMap.aidl | 49 +++ camera/provider/aidl/Android.bp | 4 +- .../camera/provider/ICameraProvider.aidl | 1 + .../camera/provider/ICameraProvider.aidl | 8 + camera/provider/aidl/vts/Android.bp | 6 +- .../VtsAidlHalCameraProvider_TargetTest.cpp | 44 ++ camera/provider/aidl/vts/camera_aidl_test.cpp | 384 ++++++++++++++++++ camera/provider/aidl/vts/camera_aidl_test.h | 51 +++ .../compatibility_matrix.current.xml | 2 +- 17 files changed, 636 insertions(+), 12 deletions(-) create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl create mode 100644 camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl diff --git a/camera/device/aidl/Android.bp b/camera/device/aidl/Android.bp index 365a5ff07f..80aef14b44 100644 --- a/camera/device/aidl/Android.bp +++ b/camera/device/aidl/Android.bp @@ -15,9 +15,9 @@ aidl_interface { imports: [ "android.hardware.common-V2", "android.hardware.common.fmq-V1", - "android.hardware.camera.common", - "android.hardware.camera.metadata", - "android.hardware.graphics.common", + "android.hardware.camera.common-V1", + "android.hardware.camera.metadata-V2", + "android.hardware.graphics.common-V3", ], backend: { cpp: { diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/Stream.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/Stream.aidl index d2f295a160..5057663e65 100644 --- a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/Stream.aidl +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/Stream.aidl @@ -48,4 +48,5 @@ parcelable Stream { android.hardware.camera.metadata.SensorPixelMode[] sensorPixelModesUsed; android.hardware.camera.metadata.RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile; android.hardware.camera.metadata.ScalerAvailableStreamUseCases useCase; + int colorSpace; } diff --git a/camera/device/aidl/android/hardware/camera/device/Stream.aidl b/camera/device/aidl/android/hardware/camera/device/Stream.aidl index e35e4ff6e6..457b1bc768 100644 --- a/camera/device/aidl/android/hardware/camera/device/Stream.aidl +++ b/camera/device/aidl/android/hardware/camera/device/Stream.aidl @@ -98,14 +98,18 @@ parcelable Stream { * * For most formats, dataSpace defines the color space of the image data. * In addition, for some formats, dataSpace indicates whether image- or - * depth-based data is requested. See - * android.hardware.graphics.common@1.0::types for details of formats and - * valid dataSpace values for each format. + * depth-based data is requested. For others, it merely describes an encoding + * scheme. See android.hardware.graphics.common@1.0::types for details of formats + * and valid dataSpace values for each format. * * The HAL must use this dataSpace to configure the stream to the correct * colorspace, or to select between color and depth outputs if * supported. The dataspace values are set using the V0 dataspace * definitions. + * + * The color space implied by dataSpace should be overridden by colorSpace if + * the device supports the REQUEST_AVAILABLE_CAPABILITIES_COLOR_SPACE_PROFILES + * capability. */ android.hardware.graphics.common.Dataspace dataSpace; @@ -222,4 +226,19 @@ parcelable Stream { * DEFAULT. */ android.hardware.camera.metadata.ScalerAvailableStreamUseCases useCase; + + /** + * The color space of the stream. + * + * A client may not specify a color space. In this case, the value will be + * ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED, and the color space + * implied by dataSpace should be used instead. + * + * When specified, this field is the ultimate authority over the color space of the stream, + * regardless of dataSpace. The purpose of this field is to support specifying wide gamut + * color spaces for dataSpace values such as JFIF and HEIF. + * + * Possible values are the ordinals of the ColorSpace.Named enum in the public-facing API. + */ + int colorSpace; } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl index 9bb55d27df..dbae01dc7e 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl @@ -171,6 +171,7 @@ enum CameraMetadataTag { ANDROID_REQUEST_CHARACTERISTIC_KEYS_NEEDING_PERMISSION = 786450, ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP = 786451, ANDROID_REQUEST_RECOMMENDED_TEN_BIT_DYNAMIC_RANGE_PROFILE = 786452, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP = 786453, ANDROID_SCALER_CROP_REGION = 851968, ANDROID_SCALER_AVAILABLE_FORMATS = 851969, ANDROID_SCALER_AVAILABLE_JPEG_MIN_DURATIONS = 851970, diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl index 8dc2aa2010..37b1decc18 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl @@ -58,4 +58,5 @@ enum RequestAvailableCapabilities { ANDROID_REQUEST_AVAILABLE_CAPABILITIES_REMOSAIC_REPROCESSING = 17, ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT = 18, ANDROID_REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE = 19, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_COLOR_SPACE_PROFILES = 20, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl new file mode 100644 index 0000000000..0d59ab0f6a --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl @@ -0,0 +1,58 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="long") @VintfStability +enum RequestAvailableColorSpaceProfilesMap { + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED = -1, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_SRGB = 0, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_LINEAR_SRGB = 1, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_EXTENDED_SRGB = 2, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_LINEAR_EXTENDED_SRGB = 3, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_BT709 = 4, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_BT2020 = 5, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_DCI_P3 = 6, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_DISPLAY_P3 = 7, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_NTSC_1953 = 8, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_SMPTE_C = 9, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ADOBE_RGB = 10, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_PRO_PHOTO_RGB = 11, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ACES = 12, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ACESCG = 13, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_CIE_XYZ = 14, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_CIE_LAB = 15, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl index 48b1ee4957..ad1d2e2a55 100644 --- a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl +++ b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl @@ -1029,6 +1029,12 @@ enum CameraMetadataTag { *

Recommended 10-bit dynamic range profile.

*/ ANDROID_REQUEST_RECOMMENDED_TEN_BIT_DYNAMIC_RANGE_PROFILE, + /** + * android.request.availableColorSpaceProfilesMap [static, enum[], ndk_public] + * + *

A list of all possible color space profiles supported by a camera device.

+ */ + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP, /** * android.scaler.cropRegion [dynamic, int32[], public] * diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl index f5c77eb28c..ebe0b4c4a3 100644 --- a/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl +++ b/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl @@ -49,4 +49,5 @@ enum RequestAvailableCapabilities { ANDROID_REQUEST_AVAILABLE_CAPABILITIES_REMOSAIC_REPROCESSING, ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT, ANDROID_REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_COLOR_SPACE_PROFILES, } diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl new file mode 100644 index 0000000000..14233051a2 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl @@ -0,0 +1,49 @@ +/* + * 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.request.availableColorSpaceProfilesMap enumeration values + * @see ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP + */ +@VintfStability +@Backing(type="long") +enum RequestAvailableColorSpaceProfilesMap { + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED = -1L, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_SRGB = 0L, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_LINEAR_SRGB = 1L, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_EXTENDED_SRGB = 2L, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_LINEAR_EXTENDED_SRGB = 3L, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_BT709 = 4L, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_BT2020 = 5L, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_DCI_P3 = 6L, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_DISPLAY_P3 = 7L, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_NTSC_1953 = 8L, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_SMPTE_C = 9L, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ADOBE_RGB = 10L, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_PRO_PHOTO_RGB = 11L, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ACES = 12L, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ACESCG = 13L, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_CIE_XYZ = 14L, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_CIE_LAB = 15L, +} diff --git a/camera/provider/aidl/Android.bp b/camera/provider/aidl/Android.bp index 87a94b2176..bb30e43174 100644 --- a/camera/provider/aidl/Android.bp +++ b/camera/provider/aidl/Android.bp @@ -14,8 +14,8 @@ aidl_interface { "android/hardware/camera/provider/*.aidl", ], imports: [ - "android.hardware.camera.device", - "android.hardware.camera.common", + "android.hardware.camera.device-V2", + "android.hardware.camera.common-V1", ], stability: "vintf", backend: { diff --git a/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/ICameraProvider.aidl b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/ICameraProvider.aidl index c15bdee62b..c6a3b9a103 100644 --- a/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/ICameraProvider.aidl +++ b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/ICameraProvider.aidl @@ -41,6 +41,7 @@ interface ICameraProvider { void notifyDeviceStateChange(long deviceState); android.hardware.camera.provider.ConcurrentCameraIdCombination[] getConcurrentCameraIds(); boolean isConcurrentStreamCombinationSupported(in android.hardware.camera.provider.CameraIdAndStreamCombination[] configs); + void placeholder(); const long DEVICE_STATE_NORMAL = 0; const long DEVICE_STATE_BACK_COVERED = 1; const long DEVICE_STATE_FRONT_COVERED = 2; diff --git a/camera/provider/aidl/android/hardware/camera/provider/ICameraProvider.aidl b/camera/provider/aidl/android/hardware/camera/provider/ICameraProvider.aidl index c4eba8d492..5442058d1c 100644 --- a/camera/provider/aidl/android/hardware/camera/provider/ICameraProvider.aidl +++ b/camera/provider/aidl/android/hardware/camera/provider/ICameraProvider.aidl @@ -304,4 +304,12 @@ interface ICameraProvider { * */ boolean isConcurrentStreamCombinationSupported(in CameraIdAndStreamCombination[] configs); + + /* + * Due to a bug in vintf regarding aidl changes that are contained to fields, + * we need a placeholder method that will be removed after this patch. + * + * TODO(b/237048744): Remove this once fixed. + */ + void placeholder(); } diff --git a/camera/provider/aidl/vts/Android.bp b/camera/provider/aidl/vts/Android.bp index 32da2feca6..8429b21fc4 100644 --- a/camera/provider/aidl/vts/Android.bp +++ b/camera/provider/aidl/vts/Android.bp @@ -59,9 +59,9 @@ cc_test { static_libs: [ "android.hardware.camera.common@1.0-helper", "android.hardware.camera.common-V1-ndk", - "android.hardware.camera.device-V1-ndk", - "android.hardware.camera.metadata-V1-ndk", - "android.hardware.camera.provider-V1-ndk", + "android.hardware.camera.device-V2-ndk", + "android.hardware.camera.metadata-V2-ndk", + "android.hardware.camera.provider-V2-ndk", "android.hidl.allocator@1.0", "libgrallocusage", "libhidlmemory", diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp index 3fef0899ba..557061ad50 100644 --- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp +++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp @@ -36,6 +36,7 @@ using ::aidl::android::hardware::camera::common::CameraResourceCost; using ::aidl::android::hardware::camera::common::TorchModeStatus; using ::aidl::android::hardware::camera::common::VendorTagSection; using ::aidl::android::hardware::camera::device::ICameraDevice; +using ::aidl::android::hardware::camera::metadata::RequestAvailableColorSpaceProfilesMap; using ::aidl::android::hardware::camera::metadata::RequestAvailableDynamicRangeProfilesMap; using ::aidl::android::hardware::camera::metadata::SensorPixelMode; using ::aidl::android::hardware::camera::provider::CameraIdAndStreamCombination; @@ -2037,6 +2038,49 @@ TEST_P(CameraAidlTest, process10BitDynamicRangeRequest) { } } +TEST_P(CameraAidlTest, process8BitColorSpaceRequests) { + static int profiles[] = { + ColorSpaceNamed::BT709, + ColorSpaceNamed::DCI_P3, + ColorSpaceNamed::DISPLAY_P3, + ColorSpaceNamed::EXTENDED_SRGB, + ColorSpaceNamed::LINEAR_EXTENDED_SRGB, + ColorSpaceNamed::NTSC_1953, + ColorSpaceNamed::SMPTE_C, + ColorSpaceNamed::SRGB + }; + + for (int32_t i = 0; i < sizeof(profiles) / sizeof(profiles[0]); i++) { + processColorSpaceRequest(static_cast(profiles[i]), + static_cast( + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD)); + } +} + +TEST_P(CameraAidlTest, process10BitColorSpaceRequests) { + static const camera_metadata_enum_android_request_available_dynamic_range_profiles_map + dynamicRangeProfiles[] = { + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HLG10, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10_PLUS, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF_PO, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM_PO, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF_PO, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM_PO + }; + + // Process all dynamic range profiles with BT2020 + for (int32_t i = 0; i < sizeof(dynamicRangeProfiles) / sizeof(dynamicRangeProfiles[0]); i++) { + processColorSpaceRequest( + static_cast(ColorSpaceNamed::BT2020), + static_cast(dynamicRangeProfiles[i])); + } +} + // Generate and verify a burst containing alternating sensor sensitivity values TEST_P(CameraAidlTest, processCaptureRequestBurstISO) { std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp index 20f32bfe21..c4a2dc9fd4 100644 --- a/camera/provider/aidl/vts/camera_aidl_test.cpp +++ b/camera/provider/aidl/vts/camera_aidl_test.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -43,6 +44,7 @@ using ::aidl::android::hardware::camera::common::TorchModeStatus; using ::aidl::android::hardware::camera::device::CameraMetadata; using ::aidl::android::hardware::camera::device::ICameraDevice; using ::aidl::android::hardware::camera::metadata::CameraMetadataTag; +using ::aidl::android::hardware::camera::metadata::RequestAvailableColorSpaceProfilesMap; using ::aidl::android::hardware::camera::metadata::RequestAvailableDynamicRangeProfilesMap; using ::aidl::android::hardware::camera::metadata::SensorInfoColorFilterArrangement; using ::aidl::android::hardware::camera::metadata::SensorPixelMode; @@ -2789,6 +2791,168 @@ void CameraAidlTest::verify10BitMetadata( } } +bool CameraAidlTest::reportsColorSpaces(const camera_metadata_t* staticMeta) { + camera_metadata_ro_entry capabilityEntry; + int rc = find_camera_metadata_ro_entry(staticMeta, ANDROID_REQUEST_AVAILABLE_CAPABILITIES, + &capabilityEntry); + if (rc == 0) { + for (uint32_t i = 0; i < capabilityEntry.count; i++) { + if (capabilityEntry.data.u8[i] == + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_COLOR_SPACE_PROFILES) { + return true; + } + } + } + return false; +} + +void CameraAidlTest::getColorSpaceProfiles( + const camera_metadata_t* staticMeta, + std::vector* profiles) { + ASSERT_NE(nullptr, staticMeta); + ASSERT_NE(nullptr, profiles); + camera_metadata_ro_entry entry; + int rc = find_camera_metadata_ro_entry( + staticMeta, ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP, &entry); + ASSERT_EQ(rc, 0); + ASSERT_TRUE(entry.count > 0); + ASSERT_EQ(entry.count % 3, 0); + + for (uint32_t i = 0; i < entry.count; i += 3) { + ASSERT_NE(entry.data.i64[i], + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED); + if (std::find(profiles->begin(), profiles->end(), + static_cast(entry.data.i64[i])) + == profiles->end()) { + profiles->emplace_back( + static_cast(entry.data.i64[i])); + } + } +} + +bool CameraAidlTest::isColorSpaceCompatibleWithDynamicRangeAndPixelFormat( + const camera_metadata_t* staticMeta, + RequestAvailableColorSpaceProfilesMap colorSpace, + RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile, + aidl::android::hardware::graphics::common::PixelFormat pixelFormat) { + camera_metadata_ro_entry entry; + int rc = find_camera_metadata_ro_entry( + staticMeta, ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP, &entry); + + if (rc == 0) { + for (uint32_t i = 0; i < entry.count; i += 3) { + RequestAvailableColorSpaceProfilesMap entryColorSpace = + static_cast(entry.data.i64[i]); + int64_t dynamicRangeProfileI64 = static_cast(dynamicRangeProfile); + int32_t entryImageFormat = static_cast(entry.data.i64[i + 1]); + int32_t expectedImageFormat = halFormatToPublicFormat(pixelFormat); + if (entryColorSpace == colorSpace + && (entry.data.i64[i + 2] & dynamicRangeProfileI64) != 0 + && entryImageFormat == expectedImageFormat) { + return true; + } + } + } + + return false; +} + +const char* CameraAidlTest::getColorSpaceProfileString( + RequestAvailableColorSpaceProfilesMap colorSpace) { + auto colorSpaceCast = static_cast(colorSpace); + switch (colorSpaceCast) { + case ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED: + return "UNSPECIFIED"; + case ColorSpaceNamed::SRGB: + return "SRGB"; + case ColorSpaceNamed::LINEAR_SRGB: + return "LINEAR_SRGB"; + case ColorSpaceNamed::EXTENDED_SRGB: + return "EXTENDED_SRGB"; + case ColorSpaceNamed::LINEAR_EXTENDED_SRGB: + return "LINEAR_EXTENDED_SRGB"; + case ColorSpaceNamed::BT709: + return "BT709"; + case ColorSpaceNamed::BT2020: + return "BT2020"; + case ColorSpaceNamed::DCI_P3: + return "DCI_P3"; + case ColorSpaceNamed::DISPLAY_P3: + return "DISPLAY_P3"; + case ColorSpaceNamed::NTSC_1953: + return "NTSC_1953"; + case ColorSpaceNamed::SMPTE_C: + return "SMPTE_C"; + case ColorSpaceNamed::ADOBE_RGB: + return "ADOBE_RGB"; + case ColorSpaceNamed::PRO_PHOTO_RGB: + return "PRO_PHOTO_RGB"; + case ColorSpaceNamed::ACES: + return "ACES"; + case ColorSpaceNamed::ACESCG: + return "ACESCG"; + case ColorSpaceNamed::CIE_XYZ: + return "CIE_XYZ"; + case ColorSpaceNamed::CIE_LAB: + return "CIE_LAB"; + default: + return "INVALID"; + } + + return "INVALID"; +} + +const char* CameraAidlTest::getDynamicRangeProfileString( + RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile) { + auto dynamicRangeProfileCast = + static_cast + (dynamicRangeProfile); + switch (dynamicRangeProfileCast) { + case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD: + return "STANDARD"; + case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HLG10: + return "HLG10"; + case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10: + return "HDR10"; + case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10_PLUS: + return "HDR10_PLUS"; + case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF: + return "DOLBY_VISION_10B_HDR_REF"; + case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF_PO: + return "DOLBY_VISION_10B_HDR_REF_P0"; + case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM: + return "DOLBY_VISION_10B_HDR_OEM"; + case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM_PO: + return "DOLBY_VISION_10B_HDR_OEM_P0"; + case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF: + return "DOLBY_VISION_8B_HDR_REF"; + case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF_PO: + return "DOLBY_VISION_8B_HDR_REF_P0"; + case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM: + return "DOLBY_VISION_8B_HDR_OEM"; + case ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM_PO: + return "DOLBY_VISION_8B_HDR_OEM_P0"; + default: + return "INVALID"; + } + + return "INVALID"; +} + +int32_t CameraAidlTest::halFormatToPublicFormat( + aidl::android::hardware::graphics::common::PixelFormat pixelFormat) { + // This is an incomplete mapping of pixel format to image format and assumes dataspaces + // (see getDataspace) + switch (pixelFormat) { + case PixelFormat::BLOB: + return 0x100; // ImageFormat.JPEG + case PixelFormat::Y16: + return 0x44363159; // ImageFormat.DEPTH16 + default: + return static_cast(pixelFormat); + } +} + void CameraAidlTest::configurePreviewStream( const std::string& name, const std::shared_ptr& provider, const AvailableStream* previewThreshold, std::shared_ptr* session, @@ -2934,4 +3098,224 @@ void CameraAidlTest::updateInflightResultQueue( for (auto& it : mInflightMap) { it.second->resultQueue = resultQueue; } +} + +void CameraAidlTest::processColorSpaceRequest( + RequestAvailableColorSpaceProfilesMap colorSpace, + RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + int64_t bufferId = 1; + CameraMetadata settings; + + for (const auto& name : cameraDeviceNames) { + std::string version, deviceId; + ASSERT_TRUE(matchDeviceName(name, mProviderType, &version, &deviceId)); + CameraMetadata meta; + std::shared_ptr device; + openEmptyDeviceSession(name, mProvider, &mSession, &meta, &device); + camera_metadata_t* staticMeta = reinterpret_cast(meta.metadata.data()); + + // Device does not report color spaces, skip. + if (!reportsColorSpaces(staticMeta)) { + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + ALOGV("Camera %s does not report color spaces", name.c_str()); + continue; + } + std::vector profileList; + getColorSpaceProfiles(staticMeta, &profileList); + ASSERT_FALSE(profileList.empty()); + + // Device does not support color space / dynamic range profile, skip + if (std::find(profileList.begin(), profileList.end(), colorSpace) + == profileList.end() || !isColorSpaceCompatibleWithDynamicRangeAndPixelFormat( + staticMeta, colorSpace, dynamicRangeProfile, + PixelFormat::IMPLEMENTATION_DEFINED)) { + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + ALOGV("Camera %s does not support color space %s with dynamic range profile %s and " + "pixel format %d", name.c_str(), getColorSpaceProfileString(colorSpace), + getDynamicRangeProfileString(dynamicRangeProfile), + PixelFormat::IMPLEMENTATION_DEFINED); + continue; + } + + ALOGV("Camera %s supports color space %s with dynamic range profile %s and pixel format %d", + name.c_str(), getColorSpaceProfileString(colorSpace), + getDynamicRangeProfileString(dynamicRangeProfile), + PixelFormat::IMPLEMENTATION_DEFINED); + + // If an HDR dynamic range profile is reported in the color space profile list, + // the device must also have the dynamic range profiles map capability and contain + // the dynamic range profile in the map. + if (dynamicRangeProfile != static_cast( + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD)) { + ASSERT_TRUE(is10BitDynamicRangeCapable(staticMeta)); + + std::vector dynamicRangeProfiles; + get10BitDynamicRangeProfiles(staticMeta, &dynamicRangeProfiles); + ASSERT_FALSE(dynamicRangeProfiles.empty()); + ASSERT_FALSE(std::find(dynamicRangeProfiles.begin(), dynamicRangeProfiles.end(), + dynamicRangeProfile) == dynamicRangeProfiles.end()); + } + + CameraMetadata req; + android::hardware::camera::common::V1_0::helper::CameraMetadata defaultSettings; + ndk::ScopedAStatus ret = + mSession->constructDefaultRequestSettings(RequestTemplate::PREVIEW, &req); + ASSERT_TRUE(ret.isOk()); + + const camera_metadata_t* metadata = + reinterpret_cast(req.metadata.data()); + size_t expectedSize = req.metadata.size(); + int result = validate_camera_metadata_structure(metadata, &expectedSize); + ASSERT_TRUE((result == 0) || (result == CAMERA_METADATA_VALIDATION_SHIFTED)); + + size_t entryCount = get_camera_metadata_entry_count(metadata); + ASSERT_GT(entryCount, 0u); + defaultSettings = metadata; + + const camera_metadata_t* settingsBuffer = defaultSettings.getAndLock(); + uint8_t* rawSettingsBuffer = (uint8_t*)settingsBuffer; + settings.metadata = std::vector( + rawSettingsBuffer, rawSettingsBuffer + get_camera_metadata_size(settingsBuffer)); + overrideRotateAndCrop(&settings); + + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + + std::vector halStreams; + bool supportsPartialResults = false; + bool useHalBufManager = false; + int32_t partialResultCount = 0; + Stream previewStream; + std::shared_ptr cb; + + previewStream.usage = + static_cast( + GRALLOC1_CONSUMER_USAGE_HWCOMPOSER); + previewStream.dataSpace = getDataspace(PixelFormat::IMPLEMENTATION_DEFINED); + previewStream.colorSpace = static_cast(colorSpace); + configureStreams(name, mProvider, PixelFormat::IMPLEMENTATION_DEFINED, &mSession, + &previewStream, &halStreams, &supportsPartialResults, + &partialResultCount, &useHalBufManager, &cb, 0, + /*maxResolution*/ false, dynamicRangeProfile); + ASSERT_NE(mSession, nullptr); + + ::aidl::android::hardware::common::fmq::MQDescriptor< + int8_t, aidl::android::hardware::common::fmq::SynchronizedReadWrite> + descriptor; + auto resultQueueRet = mSession->getCaptureResultMetadataQueue(&descriptor); + ASSERT_TRUE(resultQueueRet.isOk()); + + std::shared_ptr resultQueue = + std::make_shared(descriptor); + if (!resultQueue->isValid() || resultQueue->availableToWrite() <= 0) { + ALOGE("%s: HAL returns empty result metadata fmq, not use it", __func__); + resultQueue = nullptr; + // Don't use the queue onwards. + } + + mInflightMap.clear(); + // Stream as long as needed to fill the Hal inflight queue + std::vector requests(halStreams[0].maxBuffers); + + for (int32_t frameNumber = 0; frameNumber < requests.size(); frameNumber++) { + std::shared_ptr inflightReq = std::make_shared( + static_cast(halStreams.size()), false, supportsPartialResults, + partialResultCount, std::unordered_set(), resultQueue); + + CaptureRequest& request = requests[frameNumber]; + std::vector& outputBuffers = request.outputBuffers; + outputBuffers.resize(halStreams.size()); + + size_t k = 0; + inflightReq->mOutstandingBufferIds.resize(halStreams.size()); + std::vector graphicBuffers; + graphicBuffers.reserve(halStreams.size()); + + for (const auto& halStream : halStreams) { + buffer_handle_t buffer_handle; + if (useHalBufManager) { + outputBuffers[k] = {halStream.id, 0, + NativeHandle(), BufferStatus::OK, + NativeHandle(), NativeHandle()}; + } else { + auto usage = android_convertGralloc1To0Usage( + static_cast(halStream.producerUsage), + static_cast(halStream.consumerUsage)); + allocateGraphicBuffer(previewStream.width, previewStream.height, usage, + halStream.overrideFormat, &buffer_handle); + + inflightReq->mOutstandingBufferIds[halStream.id][bufferId] = buffer_handle; + graphicBuffers.push_back(buffer_handle); + outputBuffers[k] = {halStream.id, bufferId, + android::makeToAidl(buffer_handle), BufferStatus::OK, NativeHandle(), + NativeHandle()}; + bufferId++; + } + k++; + } + + request.inputBuffer = { + -1, 0, NativeHandle(), BufferStatus::ERROR, NativeHandle(), NativeHandle()}; + request.frameNumber = frameNumber; + request.fmqSettingsSize = 0; + request.settings = settings; + request.inputWidth = 0; + request.inputHeight = 0; + + { + std::unique_lock l(mLock); + mInflightMap[frameNumber] = inflightReq; + } + + } + + int32_t numRequestProcessed = 0; + std::vector cachesToRemove; + ndk::ScopedAStatus returnStatus = + mSession->processCaptureRequest(requests, cachesToRemove, &numRequestProcessed); + ASSERT_TRUE(returnStatus.isOk()); + ASSERT_EQ(numRequestProcessed, requests.size()); + + returnStatus = mSession->repeatingRequestEnd(requests.size() - 1, + std::vector {halStreams[0].id}); + ASSERT_TRUE(returnStatus.isOk()); + + for (int32_t frameNumber = 0; frameNumber < requests.size(); frameNumber++) { + const auto& inflightReq = mInflightMap[frameNumber]; + std::unique_lock l(mLock); + while (!inflightReq->errorCodeValid && + ((0 < inflightReq->numBuffersLeft) || (!inflightReq->haveResultMetadata))) { + auto timeout = std::chrono::system_clock::now() + + std::chrono::seconds(kStreamBufferTimeoutSec); + ASSERT_NE(std::cv_status::timeout, mResultCondition.wait_until(l, timeout)); + } + + ASSERT_FALSE(inflightReq->errorCodeValid); + ASSERT_NE(inflightReq->resultOutputBuffers.size(), 0u); + + if (dynamicRangeProfile != static_cast( + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD)) { + verify10BitMetadata(mHandleImporter, *inflightReq, dynamicRangeProfile); + } + } + + if (useHalBufManager) { + std::vector streamIds(halStreams.size()); + for (size_t i = 0; i < streamIds.size(); i++) { + streamIds[i] = halStreams[i].id; + } + mSession->signalStreamFlush(streamIds, /*streamConfigCounter*/ 0); + cb->waitForBuffersReturned(); + } + + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + } } \ No newline at end of file diff --git a/camera/provider/aidl/vts/camera_aidl_test.h b/camera/provider/aidl/vts/camera_aidl_test.h index d828cee4a8..e7f0fd892b 100644 --- a/camera/provider/aidl/vts/camera_aidl_test.h +++ b/camera/provider/aidl/vts/camera_aidl_test.h @@ -44,6 +44,8 @@ #include +#include + #include #include @@ -123,6 +125,26 @@ class CameraAidlTest : public ::testing::TestWithParam { YUV_REPROCESS, }; + // Copied from ColorSpace.java (see Named) + enum ColorSpaceNamed { + SRGB, + LINEAR_SRGB, + EXTENDED_SRGB, + LINEAR_EXTENDED_SRGB, + BT709, + BT2020, + DCI_P3, + DISPLAY_P3, + NTSC_1953, + SMPTE_C, + ADOBE_RGB, + PRO_PHOTO_RGB, + ACES, + ACESCG, + CIE_XYZ, + CIE_LAB + }; + struct AvailableZSLInputOutput { int32_t inputFormat; int32_t outputFormat; @@ -348,11 +370,40 @@ class CameraAidlTest : public ::testing::TestWithParam { std::vector* profiles); + static bool reportsColorSpaces(const camera_metadata_t* staticMeta); + + static void getColorSpaceProfiles( + const camera_metadata_t* staticMeta, + std::vector* profiles); + + static bool isColorSpaceCompatibleWithDynamicRangeAndPixelFormat( + const camera_metadata_t* staticMeta, + aidl::android::hardware::camera::metadata:: + RequestAvailableColorSpaceProfilesMap colorSpace, + aidl::android::hardware::camera::metadata:: + RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile, + aidl::android::hardware::graphics::common::PixelFormat pixelFormat); + + static const char* getColorSpaceProfileString(aidl::android::hardware::camera::metadata:: + RequestAvailableColorSpaceProfilesMap colorSpace); + + static const char* getDynamicRangeProfileString(aidl::android::hardware::camera::metadata:: + RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile); + + static int32_t halFormatToPublicFormat( + aidl::android::hardware::graphics::common::PixelFormat pixelFormat); + // Used by switchToOffline where a new result queue is created for offline reqs void updateInflightResultQueue(const std::shared_ptr& resultQueue); static Size getMinSize(Size a, Size b); + void processColorSpaceRequest(aidl::android::hardware::camera::metadata:: + RequestAvailableColorSpaceProfilesMap colorSpace, + aidl::android::hardware::camera::metadata:: + RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile); + protected: // In-flight queue for tracking completion of capture requests. struct InFlightRequest { diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 7e24085781..4cfe7e6609 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -178,7 +178,7 @@
android.hardware.camera.provider - 1 + 1-2 ICameraProvider [^/]+/[0-9]+ From 28277be7190ea63df571096ff4404c450760579d Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Wed, 19 Oct 2022 23:37:04 +0000 Subject: [PATCH 314/998] Remove tv.input from compat matrix for U This means that new launching devices will use the AIDL interface. Test: m Bug: 227673740 Change-Id: Id5aa3ceb2f1781973da95684b00dce5776edafba --- compatibility_matrices/compatibility_matrix.current.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 5217129a6a..f8068bf9d7 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -610,14 +610,6 @@ default - - android.hardware.tv.input - 1.0 - - ITvInput - default - - android.hardware.tv.tuner 1 From 8bba420d32921f743fcb8b6eee0a46b3c14e0eb5 Mon Sep 17 00:00:00 2001 From: Yu-Han Yang Date: Mon, 24 Oct 2022 22:49:38 +0000 Subject: [PATCH 315/998] Reset gnss_data_cbq_ before the 2nd request Bug: 254763910 Test: atest VtsHalGnssTargetTest Change-Id: I96db90bbb99e17b2134d9b901a9dfcd80c7a0269 --- gnss/aidl/vts/gnss_hal_test_cases.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp index f1a9894c3e..e2ad2780d8 100644 --- a/gnss/aidl/vts/gnss_hal_test_cases.cpp +++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp @@ -1514,6 +1514,7 @@ TEST_P(GnssHalTest, TestGnssMeasurementSetCallback) { collectMeasurementIntervals(callback, /* numEvents= */ 1, /* timeoutSeconds= */ 10, deltas); // setCallback at 1s interval and wait for 5 measurements + callback->gnss_data_cbq_.reset(); startMeasurementWithInterval(1000, iGnssMeasurement, callback); collectMeasurementIntervals(callback, /* numEvents= */ 5, /* timeoutSeconds= */ 10, deltas); From 8f590b9db757c371b2a77451a3d8966f15657124 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Fri, 14 Oct 2022 17:27:34 -0700 Subject: [PATCH 316/998] Create a README and change log to print. Add a README for documentation. Change log to printf so that it has less android dependency and easier for showing the message. Test: Local run following the document. Bug: 253627094 Change-Id: Ic7377ce763fdbd8599736a745942c1a0e27bc063 --- .../remoteaccess/test_grpc_server/README.md | 212 +++++++++++++++++- .../test_grpc_server/impl/Android.bp | 1 - .../impl/src/TestWakeupClientServiceImpl.cpp | 13 +- .../test_grpc_server/impl/src/main.cpp | 3 +- 4 files changed, 214 insertions(+), 15 deletions(-) diff --git a/automotive/remoteaccess/test_grpc_server/README.md b/automotive/remoteaccess/test_grpc_server/README.md index deea764078..41c8ee11f9 100644 --- a/automotive/remoteaccess/test_grpc_server/README.md +++ b/automotive/remoteaccess/test_grpc_server/README.md @@ -1,7 +1,211 @@ # Test GRPC Server. A test GRPC server that implements wakeup_client.proto. This test server acts -as a reference implementation for a remote wakeup client running on TCU. This -reference server also implements wakeup_client_debug.proto which is the -debugging interface. It is recommended that the actual implementation also -implements this test interface for easier end-to-end testing. +as a reference implementation for a remote wakeup client running on TCU. The +test server does not communicate with any actual network server. It has the +following behavior: + +* It starts a GRPC server on 'DGRPC_SERVICE_ADDRESS' compile flag which is + localhost:50051. The GRPC server provides the service according to + hardware/interfaces/automotive/remoteaccess/hal/default/proto/wakeup_client.proto. + + In real implementation, DGRPC_SERVICE_ADDRESS can be specified to any IP + address where the TCU can be exposed to Application Processor. The default + remote access HAL implementation + (hardware/interfaces/automotive/remoteaccess/hal/default/Android.bp) also + uses DGRPC_SERVICE_ADDRESS to find this GRPC server, so it must have the + same IP address. + +* It generates a fake task using FakeTaskGenerator every 'kTaskIntervalInMs' ms. + + In real implementation, it should receive task from the remote server. + +* Each fake task has an increasing unique client ID. The task data is always + what's defined for 'DATA' variable. + + In real implementation, the client ID and task data should come from the + remote server. + +* The generated tasks are put into a task queue which is a priority queue sorted + by task received time. + + In real implementation, if the server provides a task timestamp, then this + queue can be sorted by that task timestamp instead. + +* When the Application processor is started, the remote access HAL running on + Android will call 'GetRemoteTasks' to establish a long-live connection. This + connection is used to deliver all task data from remote wakeup client to + remote access HAL, which eventually to car service and applications. + + When the 'GetRemoteTasks' is called, the wakeup client must send all the + pending tasks through the 'ServerWriter'. If no task is pending, then it must + block and wait for a new task to arrive. + + If one task data is failed to be sent through the channel, it likely means + the other side (Application processor) is shutting down or has closed the + channel. The wakeup client must put the task back to the pending queue and + wait for a new 'GetRemoteTasks' request to retry sending the task. + +* When a new task arrives, if 'WakeupRequired' is true, then try to wakeup + the Application Processor by sending a specific CAN message. It is possible that + the waking up is already in progress. This is okay since Vehicle Processor + should ignore wakeup message if a wakeup is already in progress. + +* When 'WakeupRequired' is updated from false to true, if there are unexpired + pending tasks in the task queue, try to wakeup Application Processor. + + This is to handle the situation when a task arrives while the device is + shutting down. During the device shutdown, the channel to deliver the remote + tasks to Application Processor is shutdown so the new task will be added to the + task queue. 'WakeupRequired' will be set to false to prevent the wakeup + message preventing the shutdown. After the shutdown is complete, + 'WakeupRequired' will be set to true and this wakeup client must try to wake + up the device again to execute the pending tasks. + +* Every pending task has a timeout: 'KTaskTimeoutInMs'. If the pending task + is not delivered to remote access HAL before the timeout (through + GetRemoteTasks), the task timed out and a warning message is logged. + + In real implementation, this kTaskTimeoutInMs has to be set long enough to + allow an Android bootup to happen. 20s is a reasonable value. When a task + timed out, the wakeup client should also report to remote task server about + the task timeout failure. + +## How to build the test wakeup client + +* Under android root: `make -j TestWakeupClientServer` + +## How to push the test wakeup client to a TCU which runs Android. + +* Make the target device writable: + + `adb root` + + `adb remount` + + `adb reboot` + + `adb root` + + `adb remount` + +* Under android root: `cd out/target/product/[product_name]` + +* `adb push vendor/bin/TestWakeupClientServer /vendor/bin` + +* `adb shell` + +* `su` + +* `/vendor/bin/TestWakeupClientServer` + +## How to build and test the test wakeup client using one gcar emulator. + +In this test setup we will use one google car emulator +(gcar_emu_x86_64-userdebug). We assume both the TCU and the remote access HAL +runs on the same Android system, and they communicate through local loopback +interface. + +* Under android root, `source build/envsetup.sh` + +* 'lunch gcar_emu_x86_64-userdebug' + +* `m -j` + +* Run the emulator: + + `aae emulator run` + +* The android lunch target: gcar_emu_x86_64-userdebug and + cf_x86_64_auto-userdebug already contains the default remote access HAL. For + other lunch target, you can add the default remote access HAL by adding + 'android.hardware.automotive.remoteaccess@V1-default-service' to + 'PRODUCT_PACKAGES' variable in mk file, see `device/generic/car/common/car.mk` + as example. + + To verify whether remote access HAL is running, you can use the following + command to check: + + `dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default` + +* Make the target device writable: + + `adb root` + + `adb remount` + + `adb reboot` + + `adb root` + + `adb remount` + +* `make -j TestWakeupClientServer` + +* `cd out/target/product/emulator_car64_x86_64/` + +* `adb push vendor/bin/TestWakeupClientServer /vendor/bin` + +* `adb shell` + +* `su` + +* `/vendor/bin/TestWakeupClientServer` + +* Remote access HAL should start by default when the gcar emulator starts. Now + the test wake up client should also be running and generating fake tasks. + + Start a new adb shell session by + + `adb shell` + + `su` + +* Issue the command to start a simple debug callback that will capture all the + received tasks at the remote access HAL side: + + `dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --start-debug-callback` + +* Issue the following debug command to remote access HAL to establish the + communication channel between it and the test wakeup client. This command + also notifies that wakeup is not required: + + `dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --set-ap-state 1 0` + +* Wait for a while, issue the following command to show the received fake tasks: + + `dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --show-task` + + You should expect to see some received tasks printed out. + +* Simulate the Application Processor is shutting down by issuing the following + command: + + `dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --set-ap-state 0 0` + +* Wait for a while, issue the following command to show received tasks again: + + `dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --show-task` + + You should expect to see no new tasks received since remote access HAL already + closed the communication channel. + +* Simulate the Application Processor is already shutdown and wake up is required + now: + + `dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --set-ap-state 0 1` + + Now you should expect to see the test wakeup client printing out messages + that it is trying to wake up application processor. + +* Simulate the Application Processor is waken up: + + `dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --set-ap-state 1 0` + +* A new communication channel should have been established and all pending + non-expired tasks should be delivered to the remote access HAL. + + `dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --show-task` + +* Now you can issue `ctrl c` on the first adb shell to stop the test wakeup + client. diff --git a/automotive/remoteaccess/test_grpc_server/impl/Android.bp b/automotive/remoteaccess/test_grpc_server/impl/Android.bp index 8aab2e3dc8..e978c8caa4 100644 --- a/automotive/remoteaccess/test_grpc_server/impl/Android.bp +++ b/automotive/remoteaccess/test_grpc_server/impl/Android.bp @@ -28,7 +28,6 @@ cc_binary { local_include_dirs: ["include"], shared_libs: [ "libbase", - "liblog", "libutils", "libgrpc++", "libprotobuf-cpp-full", diff --git a/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp index 2cdf68b243..f64ac10b53 100644 --- a/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp +++ b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp @@ -18,7 +18,6 @@ #include #include -#include #include #include #include @@ -133,8 +132,6 @@ void TaskQueue::checkForTestTimeoutLoop() { { std::unique_lock lock(mLock); if (mStopped) { - ALOGW("The TestWakeupClientServiceImpl is stopping, " - "exiting checkForTestTimeoutLoop"); return; } } @@ -155,8 +152,8 @@ void TaskQueue::handleTaskTimeout() { break; } // In real implementation, this should report task failure to remote wakeup server. - ALOGW("Task for client ID: %s timed-out, added at %" PRId64 " ms, now %" PRId64 " ms", - taskInfo.taskData.clientid().c_str(), taskInfo.timestampInMs, now); + printf("Task for client ID: %s timed-out, added at %" PRId64 " ms, now %" PRId64 " ms", + taskInfo.taskData.clientid().c_str(), taskInfo.timestampInMs, now); mTasks.pop(); } } @@ -182,7 +179,7 @@ void TestWakeupClientServiceImpl::fakeTaskGenerateLoop() { // from it. Here we simulate receiving one remote task every {kTaskIntervalInMs}ms. while (true) { mTaskQueue.add(mFakeTaskGenerator.generateTask()); - ALOGI("Sleeping for %d seconds until next task", kTaskIntervalInMs); + printf("Sleeping for %d seconds until next task\n", kTaskIntervalInMs); std::unique_lock lk(mLock); if (mServerStoppedCv.wait_for(lk, std::chrono::milliseconds(kTaskIntervalInMs), [this] { @@ -198,7 +195,7 @@ void TestWakeupClientServiceImpl::fakeTaskGenerateLoop() { Status TestWakeupClientServiceImpl::GetRemoteTasks(ServerContext* context, const GetRemoteTasksRequest* request, ServerWriter* writer) { - ALOGD("GetRemoteTasks called"); + printf("GetRemoteTasks called\n"); while (true) { mTaskQueue.waitForTask(); @@ -213,7 +210,7 @@ Status TestWakeupClientServiceImpl::GetRemoteTasks(ServerContext* context, const GetRemoteTasksResponse& response = maybeTask.value(); if (!writer->Write(response)) { // Broken stream, maybe the client is shutting down. - ALOGW("Failed to deliver remote task to remote access HAL"); + printf("Failed to deliver remote task to remote access HAL\n"); // The task failed to be sent, add it back to the queue. The order might change, but // it is okay. mTaskQueue.add(response); diff --git a/automotive/remoteaccess/test_grpc_server/impl/src/main.cpp b/automotive/remoteaccess/test_grpc_server/impl/src/main.cpp index bb03e703a6..52698b5761 100644 --- a/automotive/remoteaccess/test_grpc_server/impl/src/main.cpp +++ b/automotive/remoteaccess/test_grpc_server/impl/src/main.cpp @@ -22,7 +22,6 @@ #include #include #include -#include using ::android::hardware::automotive::remoteaccess::TestWakeupClientServiceImpl; using ::grpc::Server; @@ -38,7 +37,7 @@ void RunServer() { builder.AddListeningPort(serverAddress, grpc::InsecureServerCredentials()); builder.RegisterService(service.get()); std::unique_ptr server(builder.BuildAndStart()); - ALOGI("Test Remote Access GRPC Server listening on %s", serverAddress.c_str()); + printf("Test Remote Access GRPC Server listening on %s\n", serverAddress.c_str()); server->Wait(); } From 096b1de781e142dc1410c24bd0ee5d7c5e81e2aa Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Fri, 14 Oct 2022 19:04:12 -0700 Subject: [PATCH 317/998] Add README for test using two emulators. Test: Locally follow the instructions. Bug: 253627094 Change-Id: I8080fc98a077b3e8951b809ff7ffbae1dc84ba92 --- .../remoteaccess/test_grpc_server/README.md | 81 ++++++++++++++++++- 1 file changed, 78 insertions(+), 3 deletions(-) diff --git a/automotive/remoteaccess/test_grpc_server/README.md b/automotive/remoteaccess/test_grpc_server/README.md index 41c8ee11f9..42e2c9450e 100644 --- a/automotive/remoteaccess/test_grpc_server/README.md +++ b/automotive/remoteaccess/test_grpc_server/README.md @@ -108,13 +108,13 @@ interface. * Under android root, `source build/envsetup.sh` -* 'lunch gcar_emu_x86_64-userdebug' +* `lunch gcar_emu_x86_64-userdebug` * `m -j` -* Run the emulator: +* Run the emulator, the '-read-only' flag is required to run multiple instances: - `aae emulator run` + `aae emulator run -read-only` * The android lunch target: gcar_emu_x86_64-userdebug and cf_x86_64_auto-userdebug already contains the default remote access HAL. For @@ -209,3 +209,78 @@ interface. * Now you can issue `ctrl c` on the first adb shell to stop the test wakeup client. + +## How to build and test the test wakeup client using two gcar emulators. + +In this test case, we are going to use two gcar emulators, one as the +Application Processor, one as the TCU. + +* Change the IP address to allow IP communication between different emulator + instances. For detail about why we change it this way, see [interconnecting + emulator instance](https://developer.android.com/studio/run/emulator-networking#connecting). + + Change 'DGRPC_SERVICE_ADDRESS' in `test_grpc_server/Android.bp` to + `10.0.2.15:50051`. + + Change `DGRPC_SERVICE_ADDRESS` in 'hal/defaut/Android.bp' to + `10.0.2.2:50051`. + +* Under android root: `source build/envsetup.sh` + +* `lunch gcar_emu_x86_64-userdebug` + +* `m -j` + +* Start one gcar emulator as TCU + + `aae emulator run -read-only` + +* Start a new shell session. Connect to the emulator's console, + see [Start and stop a console session](https://developer.android.com/studio/run/emulator-console#console-session) + for detail. + + `telnet localhost 5554` + +* `auth auth_token` where auth_token must match the contents of the + `.emulator_console_auth_token` file. + +* `redir add tcp:50051:50051` + +* Exit the telnet session + + Make the target device writable: + + `adb root` + + `adb remount` + + `adb reboot` + + `adb root` + + `adb remount` + +* `make -j TestWakeupClientServer` + +* `cd out/target/product/emulator_car64_x86_64/` + +* `adb push vendor/bin/TestWakeupClientServer /vendor/bin` + +* `adb shell` + +* `su` + +* `/vendor/bin/TestWakeupClientServer` + +* Start a new shell, start another gcar emulator as the Application Processor: + + `aae emulator run -read-only` + +* Connect to adb shell for the application processor: + + `adb -s emulator-5556 shell` + + `su` + +* Follow the test instructions for one gcar emulator using the 'dumpsys' + commands. From ab80f9f5a05f8c4d3249716a0bdf949a8fd2dd02 Mon Sep 17 00:00:00 2001 From: Bharatt Kukreja Date: Fri, 2 Sep 2022 22:44:21 +0000 Subject: [PATCH 318/998] Camera: Add settings override API The new API can be used to speed up certain controls (such as zoom) with capture request. Auto-generated file from changes in metadata_definitions.xml Bug: 239822823 Test: Successful build Change-Id: I73faf396e8e050b4fda19c013a1542cc03b9af08 --- .../camera/metadata/CameraMetadataTag.aidl | 2 + .../metadata/ControlSettingsOverride.aidl | 44 ++++++++++++ .../camera/metadata/CameraMetadataTag.aidl | 14 ++++ .../metadata/ControlSettingsOverride.aidl | 35 ++++++++++ camera/provider/aidl/vts/camera_aidl_test.cpp | 69 ++++++++++++++++++- camera/provider/aidl/vts/camera_aidl_test.h | 2 + 6 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlSettingsOverride.aidl create mode 100644 camera/metadata/aidl/android/hardware/camera/metadata/ControlSettingsOverride.aidl diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl index dbae01dc7e..af414b40bd 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl @@ -92,6 +92,8 @@ enum CameraMetadataTag { ANDROID_CONTROL_ZOOM_RATIO_RANGE = 65582, ANDROID_CONTROL_ZOOM_RATIO = 65583, ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS_MAXIMUM_RESOLUTION = 65584, + ANDROID_CONTROL_SETTINGS_OVERRIDE = 65588, + ANDROID_CONTROL_AVAILABLE_SETTINGS_OVERRIDES = 65589, ANDROID_DEMOSAIC_MODE = 131072, ANDROID_EDGE_MODE = 196608, ANDROID_EDGE_STRENGTH = 196609, diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlSettingsOverride.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlSettingsOverride.aidl new file mode 100644 index 0000000000..ed5d46f0f9 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlSettingsOverride.aidl @@ -0,0 +1,44 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlSettingsOverride { + ANDROID_CONTROL_SETTINGS_OVERRIDE_OFF = 0, + ANDROID_CONTROL_SETTINGS_OVERRIDE_ZOOM = 1, + ANDROID_CONTROL_SETTINGS_OVERRIDE_VENDOR_START = 16384, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl index ad1d2e2a55..cc98ff07c3 100644 --- a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl +++ b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl @@ -449,6 +449,20 @@ enum CameraMetadataTag { * @see ANDROID_SENSOR_PIXEL_MODE */ ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS_MAXIMUM_RESOLUTION, + /** + * android.control.settingsOverride [dynamic, enum, public] + * + *

The desired CaptureRequest settings override with which certain keys are + * applied earlier so that they can take effect sooner.

+ */ + ANDROID_CONTROL_SETTINGS_OVERRIDE = 65588, + /** + * android.control.availableSettingsOverrides [static, int32[], public] + * + *

List of available settings overrides supported by the camera device that can + * be used to speed up certain controls.

+ */ + ANDROID_CONTROL_AVAILABLE_SETTINGS_OVERRIDES, /** * android.demosaic.mode [controls, enum, system] * diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlSettingsOverride.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlSettingsOverride.aidl new file mode 100644 index 0000000000..d97f7c83ac --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlSettingsOverride.aidl @@ -0,0 +1,35 @@ +/* + * 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.settingsOverride enumeration values + * @see ANDROID_CONTROL_SETTINGS_OVERRIDE + */ +@VintfStability +@Backing(type="int") +enum ControlSettingsOverride { + ANDROID_CONTROL_SETTINGS_OVERRIDE_OFF, + ANDROID_CONTROL_SETTINGS_OVERRIDE_ZOOM, + ANDROID_CONTROL_SETTINGS_OVERRIDE_VENDOR_START = 0x4000, +} diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp index a5301596a4..ca316e5192 100644 --- a/camera/provider/aidl/vts/camera_aidl_test.cpp +++ b/camera/provider/aidl/vts/camera_aidl_test.cpp @@ -331,6 +331,63 @@ void CameraAidlTest::verifyStreamUseCaseCharacteristics(const camera_metadata_t* ASSERT_EQ(hasStreamUseCaseCap, supportMandatoryUseCases); } +void CameraAidlTest::verifySettingsOverrideCharacteristics(const camera_metadata_t* metadata) { + camera_metadata_ro_entry entry; + int retcode = find_camera_metadata_ro_entry(metadata, + ANDROID_CONTROL_AVAILABLE_SETTINGS_OVERRIDES, &entry); + bool supportSettingsOverride = false; + if ((0 == retcode) && (entry.count > 0)) { + supportSettingsOverride = true; + bool hasOff = false; + for (size_t i = 0; i < entry.count; i++) { + if (entry.data.u8[i] == ANDROID_CONTROL_SETTINGS_OVERRIDE_OFF) { + hasOff = true; + } + } + ASSERT_TRUE(hasOff); + } + + // Check availableRequestKeys + retcode = find_camera_metadata_ro_entry(metadata, + ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS, &entry); + bool hasSettingsOverrideRequestKey = false; + if ((0 == retcode) && (entry.count > 0)) { + hasSettingsOverrideRequestKey = + std::find(entry.data.i32, entry.data.i32 + entry.count, + ANDROID_CONTROL_SETTINGS_OVERRIDE) != entry.data.i32 + entry.count; + } else { + ADD_FAILURE() << "Get camera availableRequestKeys failed!"; + } + + // Check availableResultKeys + retcode = find_camera_metadata_ro_entry(metadata, + ANDROID_REQUEST_AVAILABLE_RESULT_KEYS, &entry); + bool hasSettingsOverrideResultKey = false; + if ((0 == retcode) && (entry.count > 0)) { + hasSettingsOverrideResultKey = + std::find(entry.data.i32, entry.data.i32 + entry.count, + ANDROID_CONTROL_SETTINGS_OVERRIDE) != entry.data.i32 + entry.count; + } else { + ADD_FAILURE() << "Get camera availableResultKeys failed!"; + } + + // Check availableCharacteristicKeys + retcode = find_camera_metadata_ro_entry(metadata, + ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS, &entry); + bool hasSettingsOverrideCharacteristicsKey= false; + if ((0 == retcode) && (entry.count > 0)) { + hasSettingsOverrideCharacteristicsKey = std::find(entry.data.i32, + entry.data.i32 + entry.count, ANDROID_CONTROL_AVAILABLE_SETTINGS_OVERRIDES) + != entry.data.i32 + entry.count; + } else { + ADD_FAILURE() << "Get camera availableCharacteristicsKeys failed!"; + } + + ASSERT_EQ(supportSettingsOverride, hasSettingsOverrideRequestKey); + ASSERT_EQ(supportSettingsOverride, hasSettingsOverrideResultKey); + ASSERT_EQ(supportSettingsOverride, hasSettingsOverrideCharacteristicsKey); +} + Status CameraAidlTest::isMonochromeCamera(const camera_metadata_t* staticMeta) { Status ret = Status::OPERATION_NOT_SUPPORTED; if (nullptr == staticMeta) { @@ -606,6 +663,7 @@ void CameraAidlTest::verifyCameraCharacteristics(const CameraMetadata& chars) { verifyExtendedSceneModeCharacteristics(metadata); verifyZoomCharacteristics(metadata); verifyStreamUseCaseCharacteristics(metadata); + verifySettingsOverrideCharacteristics(metadata); } void CameraAidlTest::verifyExtendedSceneModeCharacteristics(const camera_metadata_t* metadata) { @@ -1517,6 +1575,15 @@ void CameraAidlTest::verifyRequestTemplate(const camera_metadata_t* metadata, ASSERT_EQ(zoomRatioEntry.count, 1); ASSERT_EQ(zoomRatioEntry.data.f[0], 1.0f); } + + // Check settings override + camera_metadata_ro_entry settingsOverrideEntry; + int foundSettingsOverride = find_camera_metadata_ro_entry(metadata, + ANDROID_CONTROL_SETTINGS_OVERRIDE,&settingsOverrideEntry); + if (foundSettingsOverride == 0) { + ASSERT_EQ(settingsOverrideEntry.count, 1); + ASSERT_EQ(settingsOverrideEntry.data.u8[0], ANDROID_CONTROL_SETTINGS_OVERRIDE_OFF); + } } void CameraAidlTest::openEmptyDeviceSession(const std::string& name, @@ -3317,4 +3384,4 @@ void CameraAidlTest::processColorSpaceRequest( mSession = nullptr; ASSERT_TRUE(ret.isOk()); } -} \ No newline at end of file +} diff --git a/camera/provider/aidl/vts/camera_aidl_test.h b/camera/provider/aidl/vts/camera_aidl_test.h index e7f0fd892b..ff3617f93c 100644 --- a/camera/provider/aidl/vts/camera_aidl_test.h +++ b/camera/provider/aidl/vts/camera_aidl_test.h @@ -252,6 +252,8 @@ class CameraAidlTest : public ::testing::TestWithParam { static void verifyStreamUseCaseCharacteristics(const camera_metadata_t* metadata); + static void verifySettingsOverrideCharacteristics(const camera_metadata_t* metadata); + static void verifyStreamCombination(const std::shared_ptr& device, const StreamConfiguration& config, bool expectedStatus, bool expectStreamCombQuery); From 98d695ab0044d8a03e46feb37d199db649f67fa1 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Tue, 25 Oct 2022 23:13:23 +0000 Subject: [PATCH 319/998] Update IRadioNetwork and VTS for emergency domain selection 1. Add resetScan parameter to cancelEmergencyNetworkScan It indicates the way how the next triggerEmergencyNetworkScan shall work. If true, modem will start the new scan from the beginning. Otherwise, it will proceed as an existing search. 2. Allow RadioError:REQUEST_NOT_SUPPORTED to make requests optional Bug: 243344927 Test: atest VtsHalRadioTargetTest Change-Id: I0eaf905d73a7910b7bbd651add4b8a3bb6a23dc6 --- .../hardware/radio/network/IRadioNetwork.aidl | 2 +- .../hardware/radio/network/IRadioNetwork.aidl | 17 +++++++------ .../radio/network/IRadioNetworkResponse.aidl | 24 +++++++++++++++---- .../include/libradiocompat/RadioNetwork.h | 2 +- .../libradiocompat/network/RadioNetwork.cpp | 2 +- radio/aidl/vts/radio_network_test.cpp | 12 ++++++---- 6 files changed, 40 insertions(+), 19 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl index 832738ffbf..c115c86357 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl @@ -72,6 +72,6 @@ interface IRadioNetwork { oneway void getUsageSetting(in int serial); oneway void setEmergencyMode(int serial, in android.hardware.radio.network.EmergencyMode emcModeType); oneway void triggerEmergencyNetworkScan(int serial, in android.hardware.radio.network.EmergencyNetworkScanTrigger request); - oneway void cancelEmergencyNetworkScan(in int serial); + oneway void cancelEmergencyNetworkScan(int serial, boolean resetScan); oneway void exitEmergencyMode(in int serial); } diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl index 0ac8b0e83e..574798aa59 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl @@ -18,6 +18,8 @@ package android.hardware.radio.network; import android.hardware.radio.AccessNetwork; import android.hardware.radio.network.CdmaRoamingType; +import android.hardware.radio.network.EmergencyMode; +import android.hardware.radio.network.EmergencyNetworkScanTrigger; import android.hardware.radio.network.IRadioNetworkIndication; import android.hardware.radio.network.IRadioNetworkResponse; import android.hardware.radio.network.IndicationFilter; @@ -27,8 +29,6 @@ import android.hardware.radio.network.RadioAccessSpecifier; import android.hardware.radio.network.RadioBandMode; import android.hardware.radio.network.SignalThresholdInfo; import android.hardware.radio.network.UsageSetting; -import android.hardware.radio.network.EmergencyNetworkScanTrigger; -import android.hardware.radio.network.EmergencyMode; /** * This interface is used by telephony and telecom to talk to cellular radio for network APIs. @@ -449,27 +449,30 @@ oneway interface IRadioNetwork { * * Response function is IRadioEmergencyResponse.setEmergencyModeResponse() */ - void setEmergencyMode(int serial, in EmergencyMode emcModeType ); + void setEmergencyMode(int serial, in EmergencyMode emcModeType); /** * Triggers an Emergency network scan. * * @param serial Serial number of the request. - * @param request Defines the radio target networks/preferred network/ - * Max Scan Time and type of service to be scanned. + * @param request Contains the preferred networks and type of service to be scanned. + * See {@link EmergencyNetworkScanTrigger}. * * Response function is IRadioEmergencyResponse.triggerEmergencyNetworkScanResponse() */ - void triggerEmergencyNetworkScan( int serial, in EmergencyNetworkScanTrigger request); + void triggerEmergencyNetworkScan(int serial, in EmergencyNetworkScanTrigger request); /** * Cancels ongoing Emergency network scan * * @param serial Serial number of the request. + * @param resetScan Indicates how the next {@link #triggerEmergencyNetworkScan} should work. + * If {@code true}, then the modem shall start the new scan from the beginning, + * otherwise the modem shall resume from the last search. * * Response function is IRadioEmergencyResponse.cancelEmergencyNetworkScan() */ - void cancelEmergencyNetworkScan(in int serial); + void cancelEmergencyNetworkScan(int serial, boolean resetScan); /** * Exits ongoing Emergency Mode diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl index 243e949b9e..fc4db2ca36 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -23,13 +23,13 @@ import android.hardware.radio.network.BarringInfo; import android.hardware.radio.network.CdmaRoamingType; import android.hardware.radio.network.CellIdentity; import android.hardware.radio.network.CellInfo; +import android.hardware.radio.network.EmergencyRegResult; import android.hardware.radio.network.OperatorInfo; import android.hardware.radio.network.RadioAccessSpecifier; import android.hardware.radio.network.RadioBandMode; import android.hardware.radio.network.RegStateResult; import android.hardware.radio.network.SignalStrength; import android.hardware.radio.network.UsageSetting; -import android.hardware.radio.network.EmergencyRegResult; /** * Interface declaring response functions to solicited radio requests for network APIs. @@ -575,11 +575,15 @@ oneway interface IRadioNetworkResponse { oneway void getUsageSettingResponse(in RadioResponseInfo info, in UsageSetting usageSetting); /** + * Response of setEmergencyMode. + * This is an optional API. + * * @param info Response info struct containing response type, serial no. and error. * @param regState the current registration state of the modem. * * Valid errors returned: * RadioError:NONE + * RadioError:REQUEST_NOT_SUPPORTED * RadioError:RADIO_NOT_AVAILABLE * RadioError:MODEM_ERR * RadioError:INVALID_ARGUMENTS @@ -587,10 +591,14 @@ oneway interface IRadioNetworkResponse { void setEmergencyModeResponse(in RadioResponseInfo info, in EmergencyRegResult regState); /** - * @param info Response info struct containing response type, serial no. and error + * Response of triggerEmergencyNetworkScan. + * This is an optional API. + * + * @param info Response info struct containing response type, serial no. and error. * * Valid errors returned: * RadioError:NONE + * RadioError:REQUEST_NOT_SUPPORTED * RadioError:RADIO_NOT_AVAILABLE * RadioError:MODEM_ERR * RadioError:INVALID_ARGUMENTS @@ -598,20 +606,28 @@ oneway interface IRadioNetworkResponse { void triggerEmergencyNetworkScanResponse(in RadioResponseInfo info); /** - * @param info Response info struct containing response type, serial no. and error + * Response of exitEmergencyMode. + * This is an optional API. + * + * @param info Response info struct containing response type, serial no. and error. * * Valid errors returned: * RadioError:NONE + * RadioError:REQUEST_NOT_SUPPORTED * RadioError:RADIO_NOT_AVAILABLE * RadioError:MODEM_ERR */ void exitEmergencyModeResponse(in RadioResponseInfo info); /** - * @param info Response info struct containing response type, serial no. and error + * Response of cancelEmergencyNetworkScan. + * This is an optional API. + * + * @param info Response info struct containing response type, serial no. and error. * * Valid errors returned: * RadioError:NONE + * RadioError:REQUEST_NOT_SUPPORTED * RadioError:RADIO_NOT_AVAILABLE * RadioError:MODEM_ERR */ diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h index c714190153..5dd6f0ae8d 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h @@ -97,7 +97,7 @@ class RadioNetwork : public RadioCompatBase, int32_t serial, const ::aidl::android::hardware::radio::network::EmergencyNetworkScanTrigger& scanTrigger) override; - ::ndk::ScopedAStatus cancelEmergencyNetworkScan(int32_t serial) override; + ::ndk::ScopedAStatus cancelEmergencyNetworkScan(int32_t serial, bool resetScan) override; ::ndk::ScopedAStatus exitEmergencyMode(int32_t serial) override; protected: diff --git a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp index ff30ac3633..6bb6b75b2e 100644 --- a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp +++ b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp @@ -326,7 +326,7 @@ ScopedAStatus RadioNetwork::triggerEmergencyNetworkScan(int32_t serial, return ok(); } -ScopedAStatus RadioNetwork::cancelEmergencyNetworkScan(int32_t serial) { +ScopedAStatus RadioNetwork::cancelEmergencyNetworkScan(int32_t serial, bool) { LOG_CALL << serial; LOG(ERROR) << " cancelEmergencyNetworkScan is unsupported by HIDL HALs"; respond()->cancelEmergencyNetworkScanResponse(notSupported(serial)); diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index 25c42d35b2..7c98d4c13c 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -1848,7 +1848,7 @@ TEST_P(RadioNetworkTest, setEmergencyMode) { ASSERT_TRUE(CheckAnyOfErrors( radioRsp_network->rspInfo.error, - {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR, RadioError::INVALID_ARGUMENTS})); LOG(DEBUG) << "setEmergencyMode finished"; } @@ -1871,7 +1871,7 @@ TEST_P(RadioNetworkTest, triggerEmergencyNetworkScan) { ASSERT_TRUE(CheckAnyOfErrors( radioRsp_network->rspInfo.error, - {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR, RadioError::INVALID_ARGUMENTS})); LOG(DEBUG) << "triggerEmergencyNetworkScan finished"; } @@ -1883,14 +1883,15 @@ TEST_P(RadioNetworkTest, cancelEmergencyNetworkScan) { LOG(DEBUG) << "cancelEmergencyNetworkScan"; serial = GetRandomSerialNumber(); - radio_network->cancelEmergencyNetworkScan(serial); + radio_network->cancelEmergencyNetworkScan(serial, true); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); ASSERT_TRUE(CheckAnyOfErrors( radioRsp_network->rspInfo.error, - {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::RADIO_NOT_AVAILABLE, + RadioError::MODEM_ERR})); LOG(DEBUG) << "cancelEmergencyNetworkScan finished"; } @@ -1908,6 +1909,7 @@ TEST_P(RadioNetworkTest, exitEmergencyMode) { ASSERT_TRUE(CheckAnyOfErrors( radioRsp_network->rspInfo.error, - {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::RADIO_NOT_AVAILABLE, + RadioError::MODEM_ERR})); LOG(DEBUG) << "exitEmergencyMode finished"; } From 14f437614c19c659005308f10ea9ee4b16c6f725 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 19 Oct 2022 18:17:45 -0700 Subject: [PATCH 320/998] Add wakeupApplicationProcessor function. Add the logic to call wakeupAP when required. Also update target in README. Test: None, trivial logic. Bug: 254547153 Change-Id: I0ad59f9f004d0cb5c01d664090fab984ac5420db --- .../remoteaccess/test_grpc_server/README.md | 40 +++++++++---------- .../include/TestWakeupClientServiceImpl.h | 5 +++ .../impl/src/TestWakeupClientServiceImpl.cpp | 22 ++++++++++ 3 files changed, 45 insertions(+), 22 deletions(-) diff --git a/automotive/remoteaccess/test_grpc_server/README.md b/automotive/remoteaccess/test_grpc_server/README.md index 42e2c9450e..090a8fdfc1 100644 --- a/automotive/remoteaccess/test_grpc_server/README.md +++ b/automotive/remoteaccess/test_grpc_server/README.md @@ -41,7 +41,7 @@ following behavior: pending tasks through the 'ServerWriter'. If no task is pending, then it must block and wait for a new task to arrive. - If one task data is failed to be sent through the channel, it likely means + If one task data fails to be sent through the channel, it likely means the other side (Application processor) is shutting down or has closed the channel. The wakeup client must put the task back to the pending queue and wait for a new 'GetRemoteTasks' request to retry sending the task. @@ -89,7 +89,7 @@ following behavior: `adb remount` -* Under android root: `cd out/target/product/[product_name]` +* Under android root: `cd $ANDROID_PRODUCT_OUT` * `adb push vendor/bin/TestWakeupClientServer /vendor/bin` @@ -99,24 +99,24 @@ following behavior: * `/vendor/bin/TestWakeupClientServer` -## How to build and test the test wakeup client using one gcar emulator. +## How to build and test the test wakeup client using one car emulator. In this test setup we will use one google car emulator -(gcar_emu_x86_64-userdebug). We assume both the TCU and the remote access HAL +(sdk_car_x86_64-userdebug). We assume both the TCU and the remote access HAL runs on the same Android system, and they communicate through local loopback interface. * Under android root, `source build/envsetup.sh` -* `lunch gcar_emu_x86_64-userdebug` +* `lunch sdk_car_x86_64-userdebug` * `m -j` * Run the emulator, the '-read-only' flag is required to run multiple instances: - `aae emulator run -read-only` + `emulator -writable-system -read-only` -* The android lunch target: gcar_emu_x86_64-userdebug and +* The android lunch target: sdk_car_x86_64-userdebug and cf_x86_64_auto-userdebug already contains the default remote access HAL. For other lunch target, you can add the default remote access HAL by adding 'android.hardware.automotive.remoteaccess@V1-default-service' to @@ -142,9 +142,7 @@ interface. * `make -j TestWakeupClientServer` -* `cd out/target/product/emulator_car64_x86_64/` - -* `adb push vendor/bin/TestWakeupClientServer /vendor/bin` +* `adb push $ANDROID_PRODUCT_OUT/vendor/bin/TestWakeupClientServer /vendor/bin` * `adb shell` @@ -152,7 +150,7 @@ interface. * `/vendor/bin/TestWakeupClientServer` -* Remote access HAL should start by default when the gcar emulator starts. Now +* Remote access HAL should start by default when the car emulator starts. Now the test wake up client should also be running and generating fake tasks. Start a new adb shell session by @@ -210,9 +208,9 @@ interface. * Now you can issue `ctrl c` on the first adb shell to stop the test wakeup client. -## How to build and test the test wakeup client using two gcar emulators. +## How to build and test the test wakeup client using two car emulators. -In this test case, we are going to use two gcar emulators, one as the +In this test case, we are going to use two car emulators, one as the Application Processor, one as the TCU. * Change the IP address to allow IP communication between different emulator @@ -227,13 +225,13 @@ Application Processor, one as the TCU. * Under android root: `source build/envsetup.sh` -* `lunch gcar_emu_x86_64-userdebug` +* `lunch sdk_car_x86_64-userdebug` * `m -j` -* Start one gcar emulator as TCU +* Start one car emulator as TCU - `aae emulator run -read-only` + `emulator -writable-system -read-only` * Start a new shell session. Connect to the emulator's console, see [Start and stop a console session](https://developer.android.com/studio/run/emulator-console#console-session) @@ -262,9 +260,7 @@ Application Processor, one as the TCU. * `make -j TestWakeupClientServer` -* `cd out/target/product/emulator_car64_x86_64/` - -* `adb push vendor/bin/TestWakeupClientServer /vendor/bin` +* `adb push $ANDROID_PRODUCT_OUT/vendor/bin/TestWakeupClientServer /vendor/bin` * `adb shell` @@ -272,9 +268,9 @@ Application Processor, one as the TCU. * `/vendor/bin/TestWakeupClientServer` -* Start a new shell, start another gcar emulator as the Application Processor: +* Start a new shell, start another car emulator as the Application Processor: - `aae emulator run -read-only` + `emulator -writable-system -read-only` * Connect to adb shell for the application processor: @@ -282,5 +278,5 @@ Application Processor, one as the TCU. `su` -* Follow the test instructions for one gcar emulator using the 'dumpsys' +* Follow the test instructions for one car emulator using the 'dumpsys' commands. diff --git a/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h b/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h index 61c1ad305e..12bd93b34c 100644 --- a/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h +++ b/automotive/remoteaccess/test_grpc_server/impl/include/TestWakeupClientServiceImpl.h @@ -81,6 +81,7 @@ class TaskQueue final { void waitForTask(); void stopWait(); void handleTaskTimeout(); + bool isEmpty(); private: std::thread mCheckTaskTimeoutThread; @@ -117,6 +118,8 @@ class TestWakeupClientServiceImpl final : public WakeupClient::Service { std::thread mThread; // A variable to notify server is stopping. std::condition_variable mServerStoppedCv; + // Whether wakeup AP is required for executing tasks. + std::atomic mWakeupRequired = false; std::mutex mLock; bool mServerStopped GUARDED_BY(mLock); @@ -126,6 +129,8 @@ class TestWakeupClientServiceImpl final : public WakeupClient::Service { TaskQueue mTaskQueue; void fakeTaskGenerateLoop(); + + void wakeupApplicationProcessor(); }; } // namespace remoteaccess diff --git a/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp index f64ac10b53..795265fb64 100644 --- a/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp +++ b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp @@ -125,6 +125,11 @@ void TaskQueue::stopWait() { mTasksNotEmptyCv.notify_all(); } +bool TaskQueue::isEmpty() { + std::lock_guard lockGuard(mLock); + return mTasks.size() == 0 || mStopped; +} + void TaskQueue::checkForTestTimeoutLoop() { Looper::setForThread(mLooper); @@ -179,6 +184,11 @@ void TestWakeupClientServiceImpl::fakeTaskGenerateLoop() { // from it. Here we simulate receiving one remote task every {kTaskIntervalInMs}ms. while (true) { mTaskQueue.add(mFakeTaskGenerator.generateTask()); + printf("Received a new task\n"); + if (mWakeupRequired) { + wakeupApplicationProcessor(); + } + printf("Sleeping for %d seconds until next task\n", kTaskIntervalInMs); std::unique_lock lk(mLock); @@ -224,9 +234,21 @@ Status TestWakeupClientServiceImpl::GetRemoteTasks(ServerContext* context, Status TestWakeupClientServiceImpl::NotifyWakeupRequired(ServerContext* context, const NotifyWakeupRequiredRequest* request, NotifyWakeupRequiredResponse* response) { + if (request->iswakeuprequired() && !mWakeupRequired && !mTaskQueue.isEmpty()) { + // If wakeup is now required and previously not required, this means we have finished + // shutting down the device. If there are still pending tasks, try waking up AP again + // to finish executing those tasks. + wakeupApplicationProcessor(); + } + mWakeupRequired = request->iswakeuprequired(); return Status::OK; } +void TestWakeupClientServiceImpl::wakeupApplicationProcessor() { + printf("Waking up application processor...\n"); + // TODO(b/254547153): Send can bus message using socket CAN once we know what the message is. +} + } // namespace remoteaccess } // namespace automotive } // namespace hardware From 9ea1ce13a69d1385c018eabfce1d7b37f4c363fb Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Wed, 5 Oct 2022 04:44:38 +0000 Subject: [PATCH 321/998] Update libradiocompat for IRadioIms in CF Bug: 216387835 Bug: 250912118 Test: atest VtsHalRadioTargetTest Change-Id: I2376f08c4272ce1d882535be92150a3e33212e04 --- radio/aidl/compat/libradiocompat/Android.bp | 4 + .../compat/libradiocompat/ims/RadioIms.cpp | 81 +++++++++++++++++++ .../ims/RadioIndication-ims.cpp | 39 +++++++++ .../libradiocompat/ims/RadioResponse-ims.cpp | 38 +++++++++ .../include/libradiocompat/RadioIms.h | 57 +++++++++++++ .../include/libradiocompat/RadioIndication.h | 8 ++ .../include/libradiocompat/RadioResponse.h | 7 ++ radio/aidl/compat/service/Android.bp | 1 + 8 files changed, 235 insertions(+) create mode 100644 radio/aidl/compat/libradiocompat/ims/RadioIms.cpp create mode 100644 radio/aidl/compat/libradiocompat/ims/RadioIndication-ims.cpp create mode 100644 radio/aidl/compat/libradiocompat/ims/RadioResponse-ims.cpp create mode 100644 radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIms.h diff --git a/radio/aidl/compat/libradiocompat/Android.bp b/radio/aidl/compat/libradiocompat/Android.bp index f79e045f63..0ceaec49dd 100644 --- a/radio/aidl/compat/libradiocompat/Android.bp +++ b/radio/aidl/compat/libradiocompat/Android.bp @@ -37,6 +37,7 @@ cc_library { "android.hardware.radio.config@1.2", "android.hardware.radio.config@1.3", "android.hardware.radio.data-V1-ndk", + "android.hardware.radio.ims-V1-ndk", "android.hardware.radio.messaging-V1-ndk", "android.hardware.radio.modem-V1-ndk", "android.hardware.radio.network-V2-ndk", @@ -69,6 +70,9 @@ cc_library { "data/RadioResponse-data.cpp", "data/RadioData.cpp", "data/structs.cpp", + "ims/RadioIndication-ims.cpp", + "ims/RadioResponse-ims.cpp", + "ims/RadioIms.cpp", "messaging/RadioIndication-messaging.cpp", "messaging/RadioMessaging.cpp", "messaging/RadioResponse-messaging.cpp", diff --git a/radio/aidl/compat/libradiocompat/ims/RadioIms.cpp b/radio/aidl/compat/libradiocompat/ims/RadioIms.cpp new file mode 100644 index 0000000000..3a07f84f35 --- /dev/null +++ b/radio/aidl/compat/libradiocompat/ims/RadioIms.cpp @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#include + +#include "commonStructs.h" +#include "debug.h" + +#include "collections.h" + +#define RADIO_MODULE "Ims" + +namespace android::hardware::radio::compat { + +using ::ndk::ScopedAStatus; +namespace aidl = ::aidl::android::hardware::radio::ims; +constexpr auto ok = &ScopedAStatus::ok; + +std::shared_ptr RadioIms::respond() { + return mCallbackManager->response().imsCb(); +} + +ScopedAStatus RadioIms::setSrvccCallInfo( + int32_t serial, const std::vector& /*srvccCalls*/) { + LOG_CALL << serial; + LOG(ERROR) << " setSrvccCallInfo is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioIms::updateImsRegistrationInfo( + int32_t serial, const aidl::ImsRegistration& /*imsRegistration*/) { + LOG_CALL << serial; + LOG(ERROR) << " updateImsRegistrationInfo is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioIms::startImsTraffic( + int32_t serial, const std::string& /*token*/, aidl::ImsTrafficType /*imsTrafficType*/, + ::aidl::android::hardware::radio::AccessNetwork /*accessNetworkType*/) { + LOG_CALL << serial; + LOG(ERROR) << " startImsTraffic is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioIms::stopImsTraffic(int32_t serial, const std::string& /*token*/) { + LOG_CALL << serial; + LOG(ERROR) << " stopImsTraffic is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioIms::triggerEpsFallback(int32_t serial, aidl::EpsFallbackReason /*reason*/) { + LOG_CALL << serial; + LOG(ERROR) << " triggerEpsFallback is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioIms::sendAnbrQuery( + int32_t serial, aidl::ImsStreamType /*mediaType*/, aidl::ImsStreamDirection /*direction*/, + int32_t /*bitsPerSecond*/) { + LOG_CALL << serial; + LOG(ERROR) << " sendAnbrQuery is unsupported by HIDL HALs"; + return ok(); +} + +ScopedAStatus RadioIms::setResponseFunctions( + const std::shared_ptr& response, + const std::shared_ptr& indication) { + LOG_CALL << response << ' ' << indication; + mCallbackManager->setResponseFunctions(response, indication); + return ok(); +} + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/ims/RadioIndication-ims.cpp b/radio/aidl/compat/libradiocompat/ims/RadioIndication-ims.cpp new file mode 100644 index 0000000000..10109b8f9b --- /dev/null +++ b/radio/aidl/compat/libradiocompat/ims/RadioIndication-ims.cpp @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#include + +#include "commonStructs.h" +#include "debug.h" + +#include "collections.h" + +#define RADIO_MODULE "ImsIndication" + +namespace android::hardware::radio::compat { + +using ::aidl::android::hardware::radio::RadioTechnology; +namespace aidl = ::aidl::android::hardware::radio::ims; + +void RadioIndication::setResponseFunction(std::shared_ptr imsCb) { + mImsCb = imsCb; +} + +std::shared_ptr RadioIndication::imsCb() { + return mImsCb.get(); +} + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/ims/RadioResponse-ims.cpp b/radio/aidl/compat/libradiocompat/ims/RadioResponse-ims.cpp new file mode 100644 index 0000000000..831a0ae9c8 --- /dev/null +++ b/radio/aidl/compat/libradiocompat/ims/RadioResponse-ims.cpp @@ -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. + */ + +#include + +#include "commonStructs.h" +#include "debug.h" + +#include "collections.h" + +#define RADIO_MODULE "ImsResponse" + +namespace android::hardware::radio::compat { + +namespace aidl = ::aidl::android::hardware::radio::ims; + +void RadioResponse::setResponseFunction(std::shared_ptr imsCb) { + mImsCb = imsCb; +} + +std::shared_ptr RadioResponse::imsCb() { + return mImsCb.get(); +} + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIms.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIms.h new file mode 100644 index 0000000000..eaf6e0fe9d --- /dev/null +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIms.h @@ -0,0 +1,57 @@ +/* + * 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. + */ +#pragma once + +#include "RadioCompatBase.h" + +#include + +namespace android::hardware::radio::compat { + +class RadioIms : public RadioCompatBase, public aidl::android::hardware::radio::ims::BnRadioIms { + ::ndk::ScopedAStatus setSrvccCallInfo( + int32_t serial, + const std::vector<::aidl::android::hardware::radio::ims::SrvccCall>& srvccCalls) + override; + ::ndk::ScopedAStatus updateImsRegistrationInfo( + int32_t serial, + const ::aidl::android::hardware::radio::ims::ImsRegistration& imsRegistration) override; + ::ndk::ScopedAStatus startImsTraffic( + int32_t serial, const std::string& token, + ::aidl::android::hardware::radio::ims::ImsTrafficType imsTrafficType, + ::aidl::android::hardware::radio::AccessNetwork accessNetworkType) override; + ::ndk::ScopedAStatus stopImsTraffic(int32_t serial, const std::string& token) override; + ::ndk::ScopedAStatus triggerEpsFallback( + int32_t serial, + ::aidl::android::hardware::radio::ims::EpsFallbackReason reason) override; + ::ndk::ScopedAStatus sendAnbrQuery( + int32_t serial, ::aidl::android::hardware::radio::ims::ImsStreamType mediaType, + ::aidl::android::hardware::radio::ims::ImsStreamDirection direction, + int32_t bitsPerSecond) override; + ::ndk::ScopedAStatus setResponseFunctions( + const std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse>& + radioImsResponse, + const std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsIndication>& + radioImsIndication) override; + + protected: + std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse> respond(); + + public: + using RadioCompatBase::RadioCompatBase; +}; + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h index 6cfd59c6a3..f042456409 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h @@ -19,6 +19,7 @@ #include "GuaranteedCallback.h" #include +#include #include #include #include @@ -55,6 +56,10 @@ class RadioIndication : public V1_6::IRadioIndication { ::aidl::android::hardware::radio::voice::IRadioVoiceIndication, ::aidl::android::hardware::radio::voice::IRadioVoiceIndicationDefault, true> mVoiceCb; + GuaranteedCallback< // + ::aidl::android::hardware::radio::ims::IRadioImsIndication, + ::aidl::android::hardware::radio::ims::IRadioImsIndicationDefault, true> + mImsCb; // IRadioIndication @ 1.0 Return radioStateChanged(V1_0::RadioIndicationType type, @@ -220,6 +225,8 @@ class RadioIndication : public V1_6::IRadioIndication { std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimIndication> simCb); void setResponseFunction( std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceIndication> voicCb); + void setResponseFunction( + std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsIndication> imsCb); std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataIndication> dataCb(); std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingIndication> @@ -228,6 +235,7 @@ class RadioIndication : public V1_6::IRadioIndication { std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkIndication> networkCb(); std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimIndication> simCb(); std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceIndication> voiceCb(); + std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsIndication> imsCb(); }; } // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h index 1f82dd19ca..22451aec7e 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h @@ -19,6 +19,7 @@ #include "GuaranteedCallback.h" #include +#include #include #include #include @@ -49,6 +50,9 @@ class RadioResponse : public V1_6::IRadioResponse { GuaranteedCallback<::aidl::android::hardware::radio::voice::IRadioVoiceResponse, ::aidl::android::hardware::radio::voice::IRadioVoiceResponseDefault> mVoiceCb; + GuaranteedCallback<::aidl::android::hardware::radio::ims::IRadioImsResponse, + ::aidl::android::hardware::radio::ims::IRadioImsResponseDefault> + mImsCb; // IRadioResponse @ 1.0 Return getIccCardStatusResponse(const V1_0::RadioResponseInfo& info, @@ -440,6 +444,8 @@ class RadioResponse : public V1_6::IRadioResponse { std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimResponse> simCb); void setResponseFunction( std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse> voiceCb); + void setResponseFunction( + std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse> imsCb); std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataResponse> dataCb(); std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingResponse> @@ -448,6 +454,7 @@ class RadioResponse : public V1_6::IRadioResponse { std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse> networkCb(); std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimResponse> simCb(); std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse> voiceCb(); + std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse> imsCb(); }; } // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/service/Android.bp b/radio/aidl/compat/service/Android.bp index 4dbaef4e71..d16773e6a7 100644 --- a/radio/aidl/compat/service/Android.bp +++ b/radio/aidl/compat/service/Android.bp @@ -40,6 +40,7 @@ cc_binary { "android.hardware.radio.config@1.2", "android.hardware.radio.config@1.3", "android.hardware.radio.data-V1-ndk", + "android.hardware.radio.ims-V1-ndk", "android.hardware.radio.messaging-V1-ndk", "android.hardware.radio.modem-V1-ndk", "android.hardware.radio.network-V2-ndk", From b3e336edd112667ba174f268ad4cce53a484c545 Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Thu, 6 Oct 2022 12:32:16 -0400 Subject: [PATCH 322/998] Add a DisplayCapability for multi-threaded present Also update composer3 to the latest version. Begin writing a test. Bug: 241285491 Test: atest VtsHalGraphicsComposer3_TargetTest:GraphicsComposerAidlCommandTest.MultiThreadedPresent Change-Id: I5dbb01fc23abd5e0108c565f96d25e62c77fc16d --- .../graphics/composer3/DisplayCapability.aidl | 1 + .../graphics/composer3/DisplayCapability.aidl | 16 ++++++++++++++++ .../vts/VtsHalGraphicsComposer3_TargetTest.cpp | 14 ++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl index 6eba887aef..0e2d72bae0 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl @@ -42,4 +42,5 @@ enum DisplayCapability { AUTO_LOW_LATENCY_MODE = 5, SUSPEND = 6, DISPLAY_IDLE_TIMER = 7, + MULTI_THREADED_PRESENT = 8, } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl index f4b29843b8..7154d74499 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl @@ -80,4 +80,20 @@ enum DisplayCapability { * IComposerCallback.onVsyncIdle. */ DISPLAY_IDLE_TIMER = 7, + /** + * Indicates that both the composer HAL implementation and the given display + * support calling executeCommands concurrently from separate threads. + * executeCommands for a particular display will never run concurrently to + * any other executeCommands for the same display. In addition, the + * CommandResultPayload must only reference displays included in the + * DisplayCommands passed to executeCommands. Displays referenced from + * separate threads must have minimal interference with one another. If a + * HWC-managed display has this capability, SurfaceFlinger can run + * executeCommands for this display concurrently with other displays with the + * same capability. + * @see IComposerClient.executeCommands + * @see DisplayCommand.presentDisplay + * @see DisplayCommand.validateDisplay + */ + MULTI_THREADED_PRESENT = 8, } diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 78dce63dc2..ed8a06c188 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -2170,6 +2170,20 @@ TEST_P(GraphicsComposerAidlTest, GetDisplayConfigNoRepetitions) { } } +TEST_P(GraphicsComposerAidlCommandTest, MultiThreadedPresent) { + std::vector displays; + for (auto& display : mDisplays) { + if (hasDisplayCapability(display.getDisplayId(), + DisplayCapability::MULTI_THREADED_PRESENT)) { + displays.push_back(&display); + } + } + if (displays.size() <= 1u) { + return; + } + // TODO(b/251842321): Try to present on multiple threads. +} + GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsComposerAidlCommandTest); INSTANTIATE_TEST_SUITE_P( PerInstance, GraphicsComposerAidlCommandTest, From f05679810e83572adf1f29f0d488a938094e9417 Mon Sep 17 00:00:00 2001 From: Rachel Lee Date: Fri, 28 Oct 2022 10:53:00 -0700 Subject: [PATCH 323/998] Remove unused include Util.h. Util.h is not used in ComposerServiceWriter so it should not be included. Otherwise when using ComposerServiceWriter, Util.h is not found in the local directory. Bug:255623263 Test: m Test: flashall to device Change-Id: I4ce57b37d6a9a899d114e5ac64d443cfa51d826a --- .../hardware/graphics/composer3/ComposerServiceWriter.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerServiceWriter.h b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerServiceWriter.h index 34cda6a770..b50b84bce6 100644 --- a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerServiceWriter.h +++ b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerServiceWriter.h @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -26,8 +27,6 @@ #include #include -#include "Util.h" - namespace aidl::android::hardware::graphics::composer3::impl { class ComposerServiceWriter { From 2baa8cf1dd387a6a9a89ac5eb1674bd38da182ca Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Fri, 28 Oct 2022 23:14:29 +0000 Subject: [PATCH 324/998] android.hardware.graphics.common V4 += Hdr type Bug: 241349060 Test: m Change-Id: I2e1561f4ccb59a2a833af9a7afd07840ab2ebfa4 --- .../current/android/hardware/graphics/common/Hdr.aidl | 1 + .../common/aidl/android/hardware/graphics/common/Hdr.aidl | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Hdr.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Hdr.aidl index 7bae45e949..128ef4917f 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Hdr.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Hdr.aidl @@ -39,4 +39,5 @@ enum Hdr { HDR10 = 2, HLG = 3, HDR10_PLUS = 4, + DOLBY_VISION_4K30 = 5, } diff --git a/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl b/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl index f543780d65..407b54f524 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl @@ -39,4 +39,8 @@ enum Hdr { * Device supports HDR10+ */ HDR10_PLUS = 4, + /** + * If present, indicates that device supports Dolby Vision only up to 4k30hz graphics mode + */ + DOLBY_VISION_4K30 = 5, } From eb73b450f2d204559d990c6c95d005f56612b637 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Thu, 20 Oct 2022 04:41:04 +0000 Subject: [PATCH 325/998] Update the description of startImsTraffic Bug: 219242095 Test: build & flash Change-Id: Ic6679d7ad733d9e4b7c53c63790400b9cbd1a8f1 --- radio/aidl/android/hardware/radio/ims/IRadioIms.aidl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl index e9796f437c..76b1f037f6 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl @@ -74,12 +74,12 @@ oneway interface IRadioIms { * shall be prioritized to the subscription which handles higher priority service. * When both subscriptions are handling the same type of service then RF shall be * prioritized to the voice preferred sub. - * 3. To evaluate the overall access barring in the case of ACB, ACB-Skp/SCM, - * SSAC and UAC. If the specific failure including network access, modem - * internal and RF resource prioritization from the modem happen, - * {@link IRadioImsResponse#startImsTrafficResponse()} or - * {@link IRadioImsIndication#onConnectionSetupFailure()} shall be invoked with the - * failure reason. + * 3. To evaluate the overall access barring in the case of ACB, ACB-Skp/SCM and UAC. + * The response {@link IRadioImsResponse#startImsTrafficResponse()} with success shall + * be sent by modem upon access class is allowed and RF resource is allotted. Otherwise + * the same API shall be invoked with appropriate {@link ConnectionFailureInfo}. Further + * if RRC connection setup fails then {@link IRadioImsIndication#onConnectionSetupFailure()} + * shall be invoked by modem with appropriate {@link ConnectionFailureInfo}. * * @param serial Serial number of request * @param token A nonce to identify the request From ed27779d14745bc2db7840f0f2cafa72f64c93c5 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Sat, 29 Oct 2022 00:51:21 +0000 Subject: [PATCH 326/998] graphics.common V3 -> V4 Bug: 251177105 Test: builds Change-Id: I1cb84ec85f98789d0737207a1661b39a25538c96 --- automotive/evs/aidl/Android.bp | 4 ++-- camera/device/aidl/Android.bp | 4 ++-- graphics/Android.bp | 4 ++-- graphics/common/aidl/Android.bp | 2 +- graphics/composer/aidl/Android.bp | 4 ++-- graphics/mapper/4.0/utils/vts/Android.bp | 2 +- neuralnetworks/aidl/Android.bp | 10 +++++----- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/automotive/evs/aidl/Android.bp b/automotive/evs/aidl/Android.bp index 1c908aa60d..8aaa1ced54 100644 --- a/automotive/evs/aidl/Android.bp +++ b/automotive/evs/aidl/Android.bp @@ -30,7 +30,7 @@ aidl_interface { stability: "vintf", imports: [ "android.hardware.common-V2", - "android.hardware.graphics.common-V3", + "android.hardware.graphics.common-V4", ], backend: { java: { @@ -53,7 +53,7 @@ aidl_interface { version: "1", imports: [ "android.hardware.common-V2", - "android.hardware.graphics.common-V3", + "android.hardware.graphics.common-V4", ], }, ], diff --git a/camera/device/aidl/Android.bp b/camera/device/aidl/Android.bp index 80aef14b44..c184677408 100644 --- a/camera/device/aidl/Android.bp +++ b/camera/device/aidl/Android.bp @@ -17,7 +17,7 @@ aidl_interface { "android.hardware.common.fmq-V1", "android.hardware.camera.common-V1", "android.hardware.camera.metadata-V2", - "android.hardware.graphics.common-V3", + "android.hardware.graphics.common-V4", ], backend: { cpp: { @@ -36,7 +36,7 @@ aidl_interface { "android.hardware.common.fmq-V1", "android.hardware.camera.common-V1", "android.hardware.camera.metadata-V1", - "android.hardware.graphics.common-V3", + "android.hardware.graphics.common-V4", ], }, ], diff --git a/graphics/Android.bp b/graphics/Android.bp index b17643e5b5..1e9089f165 100644 --- a/graphics/Android.bp +++ b/graphics/Android.bp @@ -33,14 +33,14 @@ cc_defaults { cc_defaults { name: "android.hardware.graphics.common-ndk_static", static_libs: [ - "android.hardware.graphics.common-V3-ndk", + "android.hardware.graphics.common-V4-ndk", ], } cc_defaults { name: "android.hardware.graphics.common-ndk_shared", shared_libs: [ - "android.hardware.graphics.common-V3-ndk", + "android.hardware.graphics.common-V4-ndk", ], } diff --git a/graphics/common/aidl/Android.bp b/graphics/common/aidl/Android.bp index 40a575d555..cb96663b8d 100644 --- a/graphics/common/aidl/Android.bp +++ b/graphics/common/aidl/Android.bp @@ -15,7 +15,7 @@ aidl_interface { enabled: true, support_system_process: true, }, - vndk_use_version: "3", + vndk_use_version: "4", srcs: [ "android/hardware/graphics/common/*.aidl", ], diff --git a/graphics/composer/aidl/Android.bp b/graphics/composer/aidl/Android.bp index a5ca0a085f..0ba320d08c 100644 --- a/graphics/composer/aidl/Android.bp +++ b/graphics/composer/aidl/Android.bp @@ -36,7 +36,7 @@ aidl_interface { ], stability: "vintf", imports: [ - "android.hardware.graphics.common-V3", + "android.hardware.graphics.common-V4", "android.hardware.common-V2", ], backend: { @@ -57,7 +57,7 @@ aidl_interface { { version: "1", imports: [ - "android.hardware.graphics.common-V3", + "android.hardware.graphics.common-V4", "android.hardware.common-V2", ], }, diff --git a/graphics/mapper/4.0/utils/vts/Android.bp b/graphics/mapper/4.0/utils/vts/Android.bp index 55e721e55e..51e871b2d6 100644 --- a/graphics/mapper/4.0/utils/vts/Android.bp +++ b/graphics/mapper/4.0/utils/vts/Android.bp @@ -47,7 +47,7 @@ cc_library_static { ], export_static_lib_headers: [ "android.hardware.graphics.allocator@4.0", - "android.hardware.graphics.common-V3-ndk", + "android.hardware.graphics.common-V4-ndk", "android.hardware.graphics.mapper@4.0", ], export_include_dirs: ["include"], diff --git a/neuralnetworks/aidl/Android.bp b/neuralnetworks/aidl/Android.bp index db1188d814..be868797d1 100644 --- a/neuralnetworks/aidl/Android.bp +++ b/neuralnetworks/aidl/Android.bp @@ -17,7 +17,7 @@ aidl_interface { stability: "vintf", imports: [ "android.hardware.common-V2", - "android.hardware.graphics.common-V3", + "android.hardware.graphics.common-V4", ], backend: { java: { @@ -40,28 +40,28 @@ aidl_interface { version: "1", imports: [ "android.hardware.common-V2", - "android.hardware.graphics.common-V3", + "android.hardware.graphics.common-V4", ], }, { version: "2", imports: [ "android.hardware.common-V2", - "android.hardware.graphics.common-V3", + "android.hardware.graphics.common-V4", ], }, { version: "3", imports: [ "android.hardware.common-V2", - "android.hardware.graphics.common-V3", + "android.hardware.graphics.common-V4", ], }, { version: "4", imports: [ "android.hardware.common-V2", - "android.hardware.graphics.common-V3", + "android.hardware.graphics.common-V4", ], }, From 36518f8eef2d5324b7e0e37248abc514ca88523c Mon Sep 17 00:00:00 2001 From: Shuzhen Wang Date: Mon, 31 Oct 2022 20:40:31 +0000 Subject: [PATCH 327/998] Revert "Camera VTS: Improve test for torch callback" This reverts commit f415f561a8925aa5a317adbf8f6f62664bb867b9. Current HAL assumes that no new setCallback() is called after the start of camera provider. Having more than one callback listeners breaks that implicit assumption. It may not be trivial for HAL to add support for multiple callback listeners Test: CameraAidlTest#setTorchMode passes Bug: 251111588 Change-Id: Idd2a250dc325b1a1080c1fa6562507e563cf545c --- .../vts/VtsAidlHalCameraProvider_TargetTest.cpp | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp index 557061ad50..017f6efa65 100644 --- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp +++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp @@ -387,22 +387,6 @@ TEST_P(CameraAidlTest, setTorchMode) { mTorchStatus = TorchModeStatus::NOT_AVAILABLE; } - // register a new callback; make sure it receives the - // flash-on callback. - std::shared_ptr cb2 = ndk::SharedRefBase::make(this); - ret = mProvider->setCallback(cb2); - ASSERT_TRUE(ret.isOk()); - ASSERT_NE(cb2, nullptr); - { - std::unique_lock l(mTorchLock); - while (TorchModeStatus::NOT_AVAILABLE == mTorchStatus) { - auto timeout = std::chrono::system_clock::now() + - std::chrono::seconds(kTorchTimeoutSec); - ASSERT_NE(std::cv_status::timeout, mTorchCond.wait_until(l, timeout)); - } - ASSERT_EQ(TorchModeStatus::AVAILABLE_ON, mTorchStatus); - } - ret = device->setTorchMode(false); ASSERT_TRUE(ret.isOk()); { From 7df5c1c34538d1e051dc3df63fcba563e40713c8 Mon Sep 17 00:00:00 2001 From: Jaewan Kim Date: Fri, 28 Oct 2022 10:40:51 +0900 Subject: [PATCH 328/998] Disable verbose nlinterceptor log Test: No verbose log on Cloud Android with Wi-Fi is turned on Bug: 256518068 Change-Id: I062e698b64114f139997cd24b16f90dd52048247 --- wifi/netlinkinterceptor/aidl/default/InterceptorRelay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wifi/netlinkinterceptor/aidl/default/InterceptorRelay.cpp b/wifi/netlinkinterceptor/aidl/default/InterceptorRelay.cpp index ded9122a6f..e84a5cf817 100644 --- a/wifi/netlinkinterceptor/aidl/default/InterceptorRelay.cpp +++ b/wifi/netlinkinterceptor/aidl/default/InterceptorRelay.cpp @@ -28,7 +28,7 @@ namespace android::nlinterceptor { using namespace std::chrono_literals; static constexpr std::chrono::milliseconds kPollTimeout = 300ms; -static constexpr bool kSuperVerbose = true; +static constexpr bool kSuperVerbose = false; InterceptorRelay::InterceptorRelay(uint32_t nlFamily, uint32_t clientNlPid, const std::string& clientName) From 4cd52a97682c89498f74ea963ee99448b7829ba1 Mon Sep 17 00:00:00 2001 From: Yixiao Luo Date: Fri, 28 Oct 2022 15:51:48 -0700 Subject: [PATCH 329/998] Fix NativeHandle creation in TV Input HAL 2.0 default implementation Bug: 227673740 Test: atest VtsHalTvInputTargetTest Change-Id: Ic2958ab08c14848d46054c8422ce4298903bf206 --- tv/input/aidl/default/TvInput.cpp | 20 +++++++------------ tv/input/aidl/default/TvInput.h | 1 - .../functional/VtsHalTvInputTargetTest.cpp | 18 +++++++++++------ .../vts/functional/VtsHalTvInputTargetTest.h | 1 - 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/tv/input/aidl/default/TvInput.cpp b/tv/input/aidl/default/TvInput.cpp index ed12cbc92d..255bef70ee 100644 --- a/tv/input/aidl/default/TvInput.cpp +++ b/tv/input/aidl/default/TvInput.cpp @@ -95,8 +95,8 @@ void TvInput::init() { return ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_STATE); } mStreamConfigs[in_deviceId][in_streamId]->handle = createNativeHandle(in_streamId); - mStreamConfigs[in_deviceId][in_streamId]->isOpen = true; *_aidl_return = makeToAidl(mStreamConfigs[in_deviceId][in_streamId]->handle); + mStreamConfigs[in_deviceId][in_streamId]->isOpen = true; return ::ndk::ScopedAStatus::ok(); } @@ -112,27 +112,21 @@ void TvInput::init() { ALOGW("Stream with device id %d, stream id %d is already closed", in_deviceId, in_streamId); return ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_STATE); } - releaseNativeHandle(mStreamConfigs[in_deviceId][in_streamId]->handle); + native_handle_delete(mStreamConfigs[in_deviceId][in_streamId]->handle); mStreamConfigs[in_deviceId][in_streamId]->handle = nullptr; mStreamConfigs[in_deviceId][in_streamId]->isOpen = false; return ::ndk::ScopedAStatus::ok(); } native_handle_t* TvInput::createNativeHandle(int fd) { - native_handle_t* nativeHandle = native_handle_create(1, 0); - if (nativeHandle == nullptr) { + native_handle_t* handle = native_handle_create(1, 1); + if (handle == nullptr) { ALOGE("[TVInput] Failed to create native_handle %d", errno); return nullptr; } - if (nativeHandle->numFds > 0) { - nativeHandle->data[0] = dup(fd); - } - return nativeHandle; -} - -void TvInput::releaseNativeHandle(native_handle_t* handle) { - native_handle_close(handle); - native_handle_delete(handle); + handle->data[0] = dup(0); + handle->data[1] = fd; + return handle; } } // namespace input diff --git a/tv/input/aidl/default/TvInput.h b/tv/input/aidl/default/TvInput.h index a72bca3806..e5f2b1a729 100644 --- a/tv/input/aidl/default/TvInput.h +++ b/tv/input/aidl/default/TvInput.h @@ -48,7 +48,6 @@ class TvInput : public BnTvInput { private: native_handle_t* createNativeHandle(int fd); - void releaseNativeHandle(native_handle_t* handle); shared_ptr mCallback; map> mDeviceInfos; diff --git a/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp index ec83e29bfd..b072d8fbb7 100644 --- a/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp +++ b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp @@ -158,10 +158,11 @@ TEST_P(TvInputAidlTest, OpenAndCloseStreamTest) { int32_t device_id = stream_config_.keyAt(j); vector config = stream_config_.valueAt(j); for (size_t i = 0; i < config.size(); i++) { + NativeHandle handle; int32_t stream_id = config[i].streamId; ALOGD("OpenAndCloseStreamTest: open stream, device_id=%d, stream_id=%d", device_id, stream_id); - ASSERT_TRUE(tv_input_->openStream(device_id, stream_id, &handle_).isOk()); + ASSERT_TRUE(tv_input_->openStream(device_id, stream_id, &handle).isOk()); ALOGD("OpenAndCloseStreamTest: close stream, device_id=%d, stream_id=%d", device_id, stream_id); ASSERT_TRUE(tv_input_->closeStream(device_id, stream_id).isOk()); @@ -190,9 +191,10 @@ TEST_P(TvInputAidlTest, InvalidDeviceIdTest) { ITvInput::STATUS_INVALID_ARGUMENTS); int32_t stream_id = 0; + NativeHandle handle; ALOGD("InvalidDeviceIdTest: open stream, device_id=%d, stream_id=%d", id, stream_id); - ASSERT_TRUE(tv_input_->openStream(id, stream_id, &handle_).getServiceSpecificError() == + ASSERT_TRUE(tv_input_->openStream(id, stream_id, &handle).getServiceSpecificError() == ITvInput::STATUS_INVALID_ARGUMENTS); ALOGD("InvalidDeviceIdTest: close stream, device_id=%d, stream_id=%d", id, stream_id); @@ -226,8 +228,10 @@ TEST_P(TvInputAidlTest, InvalidStreamIdTest) { id = getNumNotIn(stream_ids); } + NativeHandle handle; + ALOGD("InvalidStreamIdTest: open stream, device_id=%d, stream_id=%d", device_id, id); - ASSERT_TRUE(tv_input_->openStream(device_id, id, &handle_).getServiceSpecificError() == + ASSERT_TRUE(tv_input_->openStream(device_id, id, &handle).getServiceSpecificError() == ITvInput::STATUS_INVALID_ARGUMENTS); ALOGD("InvalidStreamIdTest: close stream, device_id=%d, stream_id=%d", device_id, id); @@ -252,11 +256,13 @@ TEST_P(TvInputAidlTest, OpenAnOpenedStreamsTest) { int32_t device_id = stream_config_.keyAt(indices[0]); int32_t stream_id = stream_config_.valueAt(indices[0])[0].streamId; - ALOGD("OpenAnOpenedStreamsTest: open stream, device_id=%d, stream_id=%d", device_id, stream_id); - ASSERT_TRUE(tv_input_->openStream(device_id, stream_id, &handle_).isOk()); + NativeHandle handle; ALOGD("OpenAnOpenedStreamsTest: open stream, device_id=%d, stream_id=%d", device_id, stream_id); - ASSERT_TRUE(tv_input_->openStream(device_id, stream_id, &handle_).getServiceSpecificError() == + ASSERT_TRUE(tv_input_->openStream(device_id, stream_id, &handle).isOk()); + + ALOGD("OpenAnOpenedStreamsTest: open stream, device_id=%d, stream_id=%d", device_id, stream_id); + ASSERT_TRUE(tv_input_->openStream(device_id, stream_id, &handle).getServiceSpecificError() == ITvInput::STATUS_INVALID_STATE); // close stream as subsequent tests assume no open streams diff --git a/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.h b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.h index c76e5686fc..3441d7f1fd 100644 --- a/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.h +++ b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.h @@ -84,7 +84,6 @@ class TvInputAidlTest : public testing::TestWithParam { android::KeyedVector device_info_; android::KeyedVector> stream_config_; mutex mutex_; - NativeHandle handle_; }; } // namespace VtsHalTvInputTargetTest From c7854594a2b63cab3a5f961d550a83555c1f70bd Mon Sep 17 00:00:00 2001 From: Peiyong Lin Date: Thu, 13 Oct 2022 00:10:31 +0000 Subject: [PATCH 330/998] Add thread management API to PowerHintSession. Previously the list of threads of a PowerHintSession was only determined when the PowerHintSession was created. This means newly forked threads from existing threads of the PowerHintSession will not get the benefit and the clients have to create new PowerHintSession for that. This patch adds a new method to allow clients to update the threads of the PowerHintSession. Additionally, this patch also removes the oneway annotation at the interface level of IPowerHintSession, all existing methods are converted to oneway methods and setThreads is a bidirectional method. This also allows to do meaningful VTS validation. Bug: b/244216750 Test: atest VtsHalPowerTargetTest Change-Id: If499d6dad20c9d7f6fbda1b5dc9d528396f1f6c1 --- .../hardware/power/IPowerHintSession.aidl | 1 + .../hardware/power/IPowerHintSession.aidl | 30 ++++++++++++++----- power/aidl/default/PowerHintSession.cpp | 8 +++++ power/aidl/default/PowerHintSession.h | 1 + power/aidl/vts/VtsHalPowerTargetTest.cpp | 25 ++++++++++++++++ 5 files changed, 58 insertions(+), 7 deletions(-) diff --git a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/IPowerHintSession.aidl b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/IPowerHintSession.aidl index 928668cd08..e6809da92c 100644 --- a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/IPowerHintSession.aidl +++ b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/IPowerHintSession.aidl @@ -40,4 +40,5 @@ interface IPowerHintSession { oneway void resume(); oneway void close(); oneway void sendHint(android.hardware.power.SessionHint hint); + void setThreads(in int[] threadIds); } diff --git a/power/aidl/android/hardware/power/IPowerHintSession.aidl b/power/aidl/android/hardware/power/IPowerHintSession.aidl index 4ca9c54c7c..7db0ea1d54 100644 --- a/power/aidl/android/hardware/power/IPowerHintSession.aidl +++ b/power/aidl/android/hardware/power/IPowerHintSession.aidl @@ -20,7 +20,7 @@ import android.hardware.power.SessionHint; import android.hardware.power.WorkDuration; @VintfStability -oneway interface IPowerHintSession { +interface IPowerHintSession { /** * Updates the desired duration of a previously-created thread group. * @@ -29,7 +29,7 @@ oneway interface IPowerHintSession { * * @param targetDurationNanos the new desired duration in nanoseconds */ - void updateTargetWorkDuration(long targetDurationNanos); + oneway void updateTargetWorkDuration(long targetDurationNanos); /** * Reports the actual duration of a thread group. @@ -41,22 +41,22 @@ oneway interface IPowerHintSession { * @param actualDurationMicros how long the thread group took to complete its * last task in nanoseconds */ - void reportActualWorkDuration(in WorkDuration[] durations); + oneway void reportActualWorkDuration(in WorkDuration[] durations); /** * Pause the session when the application is not allowed to send hint in framework. */ - void pause(); + oneway void pause(); /** * Resume the session when the application is allowed to send hint in framework. */ - void resume(); + oneway void resume(); /** * Close the session to release resources. */ - void close(); + oneway void close(); /** * Gives information to the PowerHintSession about upcoming or unexpected @@ -64,5 +64,21 @@ oneway interface IPowerHintSession { * * @param hint The hint to provide to the PowerHintSession */ - void sendHint(SessionHint hint); + oneway void sendHint(SessionHint hint); + + /** + * Sets a list of threads to the power hint session. This operation will replace + * the current list of threads with the given list of threads. If there's already + * boost for the replaced threads, a reset must be performed for the replaced + * threads. Note that this is not an oneway method. + * + * @param threadIds The list of threads to be associated + * with this session. + * + * @throws ScopedAStatus Status of the operation. If status code is not + * STATUS_OK, getMessage() must be populated with the human-readable + * error message. If the list of thread ids is empty, EX_ILLEGAL_ARGUMENT + * must be thrown. + */ + void setThreads(in int[] threadIds); } diff --git a/power/aidl/default/PowerHintSession.cpp b/power/aidl/default/PowerHintSession.cpp index aa95be451b..f395800e8c 100644 --- a/power/aidl/default/PowerHintSession.cpp +++ b/power/aidl/default/PowerHintSession.cpp @@ -51,4 +51,12 @@ ScopedAStatus PowerHintSession::sendHint(SessionHint /* hint */) { return ScopedAStatus::ok(); } +ScopedAStatus PowerHintSession::setThreads(const std::vector& threadIds) { + if (threadIds.size() == 0) { + LOG(ERROR) << "Error: threadIds.size() shouldn't be " << threadIds.size(); + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + return ScopedAStatus::ok(); +} + } // namespace aidl::android::hardware::power::impl::example diff --git a/power/aidl/default/PowerHintSession.h b/power/aidl/default/PowerHintSession.h index 6a7627a730..1d74716461 100644 --- a/power/aidl/default/PowerHintSession.h +++ b/power/aidl/default/PowerHintSession.h @@ -32,6 +32,7 @@ class PowerHintSession : public BnPowerHintSession { ndk::ScopedAStatus resume() override; ndk::ScopedAStatus close() override; ndk::ScopedAStatus sendHint(SessionHint hint) override; + ndk::ScopedAStatus setThreads(const std::vector& threadIds) override; }; } // namespace aidl::android::hardware::power::impl::example diff --git a/power/aidl/vts/VtsHalPowerTargetTest.cpp b/power/aidl/vts/VtsHalPowerTargetTest.cpp index e51f756e60..5f5ce56c6f 100644 --- a/power/aidl/vts/VtsHalPowerTargetTest.cpp +++ b/power/aidl/vts/VtsHalPowerTargetTest.cpp @@ -100,6 +100,10 @@ const uint64_t kCompatibilityMatrix5ApiLevel = 30; // target-level=7 compatibility_matrix file. const uint64_t kCompatibilityMatrix7ApiLevel = 33; +// DEVICEs launching with Android 14 MUST meet the requirements for the +// target-level=8 compatibility_matrix file. +const uint64_t kCompatibilityMatrix8ApiLevel = 34; + inline bool isUnknownOrUnsupported(const ndk::ScopedAStatus& status) { return status.getStatus() == STATUS_UNKNOWN_TRANSACTION || status.getExceptionCode() == EX_UNSUPPORTED_OPERATION; @@ -242,6 +246,27 @@ TEST_P(PowerAidl, sendSessionHint) { } } +TEST_P(PowerAidl, setThreads) { + std::shared_ptr session; + auto status = power->createHintSession(getpid(), getuid(), kSelfTids, 16666666L, &session); + if (mApiLevel < kCompatibilityMatrix7ApiLevel && !status.isOk()) { + EXPECT_TRUE(isUnknownOrUnsupported(status)); + GTEST_SKIP() << "DEVICE not launching with Android 13 and beyond."; + } + ASSERT_TRUE(status.isOk()); + + if (mApiLevel < kCompatibilityMatrix8ApiLevel) { + GTEST_SKIP() << "DEVICE not launching with Android 14 and beyond."; + } + + status = session->setThreads(kEmptyTids); + ASSERT_FALSE(status.isOk()); + ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()); + + status = session->setThreads(kSelfTids); + ASSERT_TRUE(status.isOk()); +} + // FIXED_PERFORMANCE mode is required for all devices which ship on Android 11 // or later TEST_P(PowerAidl, hasFixedPerformance) { From b768d1b9dab8ddd9092dd7f111b6b7b079608dd2 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Wed, 2 Nov 2022 02:30:55 +0000 Subject: [PATCH 331/998] Revert "Update libradiocompat for IRadioIms in CF" Revert submission 20106610-ims-hal-cf Reason for revert: Test failure with v2/android-app-compat-engprod/g3compat/g3-app-compat-main Reverted Changes: I2376f08c4:Update libradiocompat for IRadioIms in CF Ib2cc006d5:Implement IRadioIms in CF Change-Id: Id1062e908e067dd3ec01f3ecf43021368d5dc91e --- radio/aidl/compat/libradiocompat/Android.bp | 4 - .../compat/libradiocompat/ims/RadioIms.cpp | 81 ------------------- .../ims/RadioIndication-ims.cpp | 39 --------- .../libradiocompat/ims/RadioResponse-ims.cpp | 38 --------- .../include/libradiocompat/RadioIms.h | 57 ------------- .../include/libradiocompat/RadioIndication.h | 8 -- .../include/libradiocompat/RadioResponse.h | 7 -- radio/aidl/compat/service/Android.bp | 1 - 8 files changed, 235 deletions(-) delete mode 100644 radio/aidl/compat/libradiocompat/ims/RadioIms.cpp delete mode 100644 radio/aidl/compat/libradiocompat/ims/RadioIndication-ims.cpp delete mode 100644 radio/aidl/compat/libradiocompat/ims/RadioResponse-ims.cpp delete mode 100644 radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIms.h diff --git a/radio/aidl/compat/libradiocompat/Android.bp b/radio/aidl/compat/libradiocompat/Android.bp index 0ceaec49dd..f79e045f63 100644 --- a/radio/aidl/compat/libradiocompat/Android.bp +++ b/radio/aidl/compat/libradiocompat/Android.bp @@ -37,7 +37,6 @@ cc_library { "android.hardware.radio.config@1.2", "android.hardware.radio.config@1.3", "android.hardware.radio.data-V1-ndk", - "android.hardware.radio.ims-V1-ndk", "android.hardware.radio.messaging-V1-ndk", "android.hardware.radio.modem-V1-ndk", "android.hardware.radio.network-V2-ndk", @@ -70,9 +69,6 @@ cc_library { "data/RadioResponse-data.cpp", "data/RadioData.cpp", "data/structs.cpp", - "ims/RadioIndication-ims.cpp", - "ims/RadioResponse-ims.cpp", - "ims/RadioIms.cpp", "messaging/RadioIndication-messaging.cpp", "messaging/RadioMessaging.cpp", "messaging/RadioResponse-messaging.cpp", diff --git a/radio/aidl/compat/libradiocompat/ims/RadioIms.cpp b/radio/aidl/compat/libradiocompat/ims/RadioIms.cpp deleted file mode 100644 index 3a07f84f35..0000000000 --- a/radio/aidl/compat/libradiocompat/ims/RadioIms.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - -#include - -#include "commonStructs.h" -#include "debug.h" - -#include "collections.h" - -#define RADIO_MODULE "Ims" - -namespace android::hardware::radio::compat { - -using ::ndk::ScopedAStatus; -namespace aidl = ::aidl::android::hardware::radio::ims; -constexpr auto ok = &ScopedAStatus::ok; - -std::shared_ptr RadioIms::respond() { - return mCallbackManager->response().imsCb(); -} - -ScopedAStatus RadioIms::setSrvccCallInfo( - int32_t serial, const std::vector& /*srvccCalls*/) { - LOG_CALL << serial; - LOG(ERROR) << " setSrvccCallInfo is unsupported by HIDL HALs"; - return ok(); -} -ScopedAStatus RadioIms::updateImsRegistrationInfo( - int32_t serial, const aidl::ImsRegistration& /*imsRegistration*/) { - LOG_CALL << serial; - LOG(ERROR) << " updateImsRegistrationInfo is unsupported by HIDL HALs"; - return ok(); -} -ScopedAStatus RadioIms::startImsTraffic( - int32_t serial, const std::string& /*token*/, aidl::ImsTrafficType /*imsTrafficType*/, - ::aidl::android::hardware::radio::AccessNetwork /*accessNetworkType*/) { - LOG_CALL << serial; - LOG(ERROR) << " startImsTraffic is unsupported by HIDL HALs"; - return ok(); -} -ScopedAStatus RadioIms::stopImsTraffic(int32_t serial, const std::string& /*token*/) { - LOG_CALL << serial; - LOG(ERROR) << " stopImsTraffic is unsupported by HIDL HALs"; - return ok(); -} -ScopedAStatus RadioIms::triggerEpsFallback(int32_t serial, aidl::EpsFallbackReason /*reason*/) { - LOG_CALL << serial; - LOG(ERROR) << " triggerEpsFallback is unsupported by HIDL HALs"; - return ok(); -} -ScopedAStatus RadioIms::sendAnbrQuery( - int32_t serial, aidl::ImsStreamType /*mediaType*/, aidl::ImsStreamDirection /*direction*/, - int32_t /*bitsPerSecond*/) { - LOG_CALL << serial; - LOG(ERROR) << " sendAnbrQuery is unsupported by HIDL HALs"; - return ok(); -} - -ScopedAStatus RadioIms::setResponseFunctions( - const std::shared_ptr& response, - const std::shared_ptr& indication) { - LOG_CALL << response << ' ' << indication; - mCallbackManager->setResponseFunctions(response, indication); - return ok(); -} - -} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/ims/RadioIndication-ims.cpp b/radio/aidl/compat/libradiocompat/ims/RadioIndication-ims.cpp deleted file mode 100644 index 10109b8f9b..0000000000 --- a/radio/aidl/compat/libradiocompat/ims/RadioIndication-ims.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ - -#include - -#include "commonStructs.h" -#include "debug.h" - -#include "collections.h" - -#define RADIO_MODULE "ImsIndication" - -namespace android::hardware::radio::compat { - -using ::aidl::android::hardware::radio::RadioTechnology; -namespace aidl = ::aidl::android::hardware::radio::ims; - -void RadioIndication::setResponseFunction(std::shared_ptr imsCb) { - mImsCb = imsCb; -} - -std::shared_ptr RadioIndication::imsCb() { - return mImsCb.get(); -} - -} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/ims/RadioResponse-ims.cpp b/radio/aidl/compat/libradiocompat/ims/RadioResponse-ims.cpp deleted file mode 100644 index 831a0ae9c8..0000000000 --- a/radio/aidl/compat/libradiocompat/ims/RadioResponse-ims.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ - -#include - -#include "commonStructs.h" -#include "debug.h" - -#include "collections.h" - -#define RADIO_MODULE "ImsResponse" - -namespace android::hardware::radio::compat { - -namespace aidl = ::aidl::android::hardware::radio::ims; - -void RadioResponse::setResponseFunction(std::shared_ptr imsCb) { - mImsCb = imsCb; -} - -std::shared_ptr RadioResponse::imsCb() { - return mImsCb.get(); -} - -} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIms.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIms.h deleted file mode 100644 index eaf6e0fe9d..0000000000 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIms.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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. - */ -#pragma once - -#include "RadioCompatBase.h" - -#include - -namespace android::hardware::radio::compat { - -class RadioIms : public RadioCompatBase, public aidl::android::hardware::radio::ims::BnRadioIms { - ::ndk::ScopedAStatus setSrvccCallInfo( - int32_t serial, - const std::vector<::aidl::android::hardware::radio::ims::SrvccCall>& srvccCalls) - override; - ::ndk::ScopedAStatus updateImsRegistrationInfo( - int32_t serial, - const ::aidl::android::hardware::radio::ims::ImsRegistration& imsRegistration) override; - ::ndk::ScopedAStatus startImsTraffic( - int32_t serial, const std::string& token, - ::aidl::android::hardware::radio::ims::ImsTrafficType imsTrafficType, - ::aidl::android::hardware::radio::AccessNetwork accessNetworkType) override; - ::ndk::ScopedAStatus stopImsTraffic(int32_t serial, const std::string& token) override; - ::ndk::ScopedAStatus triggerEpsFallback( - int32_t serial, - ::aidl::android::hardware::radio::ims::EpsFallbackReason reason) override; - ::ndk::ScopedAStatus sendAnbrQuery( - int32_t serial, ::aidl::android::hardware::radio::ims::ImsStreamType mediaType, - ::aidl::android::hardware::radio::ims::ImsStreamDirection direction, - int32_t bitsPerSecond) override; - ::ndk::ScopedAStatus setResponseFunctions( - const std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse>& - radioImsResponse, - const std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsIndication>& - radioImsIndication) override; - - protected: - std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse> respond(); - - public: - using RadioCompatBase::RadioCompatBase; -}; - -} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h index f042456409..6cfd59c6a3 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h @@ -19,7 +19,6 @@ #include "GuaranteedCallback.h" #include -#include #include #include #include @@ -56,10 +55,6 @@ class RadioIndication : public V1_6::IRadioIndication { ::aidl::android::hardware::radio::voice::IRadioVoiceIndication, ::aidl::android::hardware::radio::voice::IRadioVoiceIndicationDefault, true> mVoiceCb; - GuaranteedCallback< // - ::aidl::android::hardware::radio::ims::IRadioImsIndication, - ::aidl::android::hardware::radio::ims::IRadioImsIndicationDefault, true> - mImsCb; // IRadioIndication @ 1.0 Return radioStateChanged(V1_0::RadioIndicationType type, @@ -225,8 +220,6 @@ class RadioIndication : public V1_6::IRadioIndication { std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimIndication> simCb); void setResponseFunction( std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceIndication> voicCb); - void setResponseFunction( - std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsIndication> imsCb); std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataIndication> dataCb(); std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingIndication> @@ -235,7 +228,6 @@ class RadioIndication : public V1_6::IRadioIndication { std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkIndication> networkCb(); std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimIndication> simCb(); std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceIndication> voiceCb(); - std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsIndication> imsCb(); }; } // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h index 22451aec7e..1f82dd19ca 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h @@ -19,7 +19,6 @@ #include "GuaranteedCallback.h" #include -#include #include #include #include @@ -50,9 +49,6 @@ class RadioResponse : public V1_6::IRadioResponse { GuaranteedCallback<::aidl::android::hardware::radio::voice::IRadioVoiceResponse, ::aidl::android::hardware::radio::voice::IRadioVoiceResponseDefault> mVoiceCb; - GuaranteedCallback<::aidl::android::hardware::radio::ims::IRadioImsResponse, - ::aidl::android::hardware::radio::ims::IRadioImsResponseDefault> - mImsCb; // IRadioResponse @ 1.0 Return getIccCardStatusResponse(const V1_0::RadioResponseInfo& info, @@ -444,8 +440,6 @@ class RadioResponse : public V1_6::IRadioResponse { std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimResponse> simCb); void setResponseFunction( std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse> voiceCb); - void setResponseFunction( - std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse> imsCb); std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataResponse> dataCb(); std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingResponse> @@ -454,7 +448,6 @@ class RadioResponse : public V1_6::IRadioResponse { std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse> networkCb(); std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimResponse> simCb(); std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse> voiceCb(); - std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse> imsCb(); }; } // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/service/Android.bp b/radio/aidl/compat/service/Android.bp index d16773e6a7..4dbaef4e71 100644 --- a/radio/aidl/compat/service/Android.bp +++ b/radio/aidl/compat/service/Android.bp @@ -40,7 +40,6 @@ cc_binary { "android.hardware.radio.config@1.2", "android.hardware.radio.config@1.3", "android.hardware.radio.data-V1-ndk", - "android.hardware.radio.ims-V1-ndk", "android.hardware.radio.messaging-V1-ndk", "android.hardware.radio.modem-V1-ndk", "android.hardware.radio.network-V2-ndk", From 73b7652e001732cf01978800d00f6d604a7755e3 Mon Sep 17 00:00:00 2001 From: Ricky Niu Date: Thu, 10 Feb 2022 14:52:12 +0800 Subject: [PATCH 332/998] Migrate IUsbGadget to AIDL This change migrates android.hardware.usb.IUsbGadget to AIDL and adds the default implementation. Compared to the HIDL interface, AIDL based interface adds transactionId argument to each of the interface method which is used while invoking the corresponding callback. Bug: 218791946 Test: USB function switch success and AIDL service is running. Signed-off-by: Ricky Niu Change-Id: Ie05354660f13c8047e2c1712bf373e8699874d28 --- .../compatibility_matrix.current.xml | 7 + usb/gadget/aidl/Android.bp | 37 +++ .../hardware/usb/gadget/GadgetFunction.aidl | 46 +++ .../hardware/usb/gadget/IUsbGadget.aidl | 41 +++ .../usb/gadget/IUsbGadgetCallback.aidl | 40 +++ .../android/hardware/usb/gadget/Status.aidl | 42 +++ .../android/hardware/usb/gadget/UsbSpeed.aidl | 44 +++ .../hardware/usb/gadget/GadgetFunction.aidl | 57 ++++ .../hardware/usb/gadget/IUsbGadget.aidl | 66 ++++ .../usb/gadget/IUsbGadgetCallback.aidl | 63 ++++ .../android/hardware/usb/gadget/Status.aidl | 39 +++ .../android/hardware/usb/gadget/UsbSpeed.aidl | 50 +++ usb/gadget/aidl/default/Android.bp | 47 +++ usb/gadget/aidl/default/UsbGadget.cpp | 299 ++++++++++++++++++ usb/gadget/aidl/default/UsbGadget.h | 115 +++++++ ...oid.hardware.usb.gadget-service.example.rc | 4 + ...id.hardware.usb.gadget-service.example.xml | 10 + usb/gadget/aidl/default/service_gadget.cpp | 34 ++ 18 files changed, 1041 insertions(+) create mode 100644 usb/gadget/aidl/Android.bp create mode 100644 usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/GadgetFunction.aidl create mode 100644 usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadget.aidl create mode 100644 usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadgetCallback.aidl create mode 100644 usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/Status.aidl create mode 100644 usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/UsbSpeed.aidl create mode 100644 usb/gadget/aidl/android/hardware/usb/gadget/GadgetFunction.aidl create mode 100644 usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadget.aidl create mode 100644 usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadgetCallback.aidl create mode 100644 usb/gadget/aidl/android/hardware/usb/gadget/Status.aidl create mode 100644 usb/gadget/aidl/android/hardware/usb/gadget/UsbSpeed.aidl create mode 100644 usb/gadget/aidl/default/Android.bp create mode 100644 usb/gadget/aidl/default/UsbGadget.cpp create mode 100644 usb/gadget/aidl/default/UsbGadget.h create mode 100644 usb/gadget/aidl/default/android.hardware.usb.gadget-service.example.rc create mode 100644 usb/gadget/aidl/default/android.hardware.usb.gadget-service.example.xml create mode 100644 usb/gadget/aidl/default/service_gadget.cpp diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index a20d15db3a..6f0bd613dc 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -655,6 +655,13 @@ default
+ + android.hardware.usb.gadget + + IUsbGadget + default + + android.hardware.vibrator 1-2 diff --git a/usb/gadget/aidl/Android.bp b/usb/gadget/aidl/Android.bp new file mode 100644 index 0000000000..cb8560aebc --- /dev/null +++ b/usb/gadget/aidl/Android.bp @@ -0,0 +1,37 @@ +// 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. + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +aidl_interface { + name: "android.hardware.usb.gadget", + vendor_available: true, + srcs: ["android/hardware/usb/gadget/*.aidl"], + stability: "vintf", + backend: { + cpp: { + enabled: false, + }, + java: { + sdk_version: "module_current", + }, + }, +} diff --git a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/GadgetFunction.aidl b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/GadgetFunction.aidl new file mode 100644 index 0000000000..c3f26d5efd --- /dev/null +++ b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/GadgetFunction.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.usb.gadget; +@VintfStability +parcelable GadgetFunction { + const long NONE = 0; + const long ADB = 1; + const long ACCESSORY = 2; + const long MTP = 4; + const long MIDI = 8; + const long PTP = 16; + const long RNDIS = 32; + const long AUDIO_SOURCE = 64; + const long NCM = 1024; +} diff --git a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadget.aidl b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadget.aidl new file mode 100644 index 0000000000..ef45f8be3a --- /dev/null +++ b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadget.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.usb.gadget; +@VintfStability +interface IUsbGadget { + oneway void setCurrentUsbFunctions(in long functions, in android.hardware.usb.gadget.IUsbGadgetCallback callback, in long timeoutMs, long transactionId); + oneway void getCurrentUsbFunctions(in android.hardware.usb.gadget.IUsbGadgetCallback callback, long transactionId); + oneway void getUsbSpeed(in android.hardware.usb.gadget.IUsbGadgetCallback callback, long transactionId); + oneway void reset(); +} diff --git a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadgetCallback.aidl b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadgetCallback.aidl new file mode 100644 index 0000000000..8672a0c803 --- /dev/null +++ b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadgetCallback.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.usb.gadget; +@VintfStability +interface IUsbGadgetCallback { + oneway void getCurrentUsbFunctionsCb(in long functions, in android.hardware.usb.gadget.Status status, long transactionId); + oneway void getUsbSpeedCb(in android.hardware.usb.gadget.UsbSpeed speed, long transactionId); + oneway void setCurrentUsbFunctionsCb(in long functions, in android.hardware.usb.gadget.Status status, long transactionId); +} diff --git a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/Status.aidl b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/Status.aidl new file mode 100644 index 0000000000..bdcf6854fe --- /dev/null +++ b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/Status.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.usb.gadget; +@Backing(type="int") @VintfStability +enum Status { + SUCCESS = 0, + ERROR = 1, + FUNCTIONS_APPLIED = 2, + FUNCTIONS_NOT_APPLIED = 3, + CONFIGURATION_NOT_SUPPORTED = 4, +} diff --git a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/UsbSpeed.aidl b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/UsbSpeed.aidl new file mode 100644 index 0000000000..0f54ee5a6b --- /dev/null +++ b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/UsbSpeed.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.usb.gadget; +@Backing(type="int") @VintfStability +enum UsbSpeed { + UNKNOWN = 0, + LOWSPEED = 1, + FULLSPEED = 2, + HIGHSPEED = 3, + SUPERSPEED = 4, + SUPERSPEED_10Gb = 5, + SUPERSPEED_20Gb = 6, +} diff --git a/usb/gadget/aidl/android/hardware/usb/gadget/GadgetFunction.aidl b/usb/gadget/aidl/android/hardware/usb/gadget/GadgetFunction.aidl new file mode 100644 index 0000000000..18b31b8fe9 --- /dev/null +++ b/usb/gadget/aidl/android/hardware/usb/gadget/GadgetFunction.aidl @@ -0,0 +1,57 @@ +/* + * 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. + */ + +package android.hardware.usb.gadget; + +@VintfStability +parcelable GadgetFunction { + /** + * Removes all the functions and pulls down the gadget. + */ + const long NONE = 0; + /** + * Android Debug Bridge function. + */ + const long ADB = 1; + /** + * Android open accessory protocol function. + */ + const long ACCESSORY = 2; + /** + * Media Transfer protocol function. + */ + const long MTP = 4; + /** + * Peripheral mode USB Midi function. + */ + const long MIDI = 8; + /** + * Picture transfer protocol function. + */ + const long PTP = 16; + /** + * Tethering function. + */ + const long RNDIS = 32; + /** + * AOAv2.0 - Audio Source function. + */ + const long AUDIO_SOURCE = 64; + /** + * NCM - NCM function. + */ + const long NCM = 1024; +} diff --git a/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadget.aidl b/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadget.aidl new file mode 100644 index 0000000000..d187993a5d --- /dev/null +++ b/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadget.aidl @@ -0,0 +1,66 @@ +/* + * 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. + */ + +package android.hardware.usb.gadget; + +import android.hardware.usb.gadget.GadgetFunction; +import android.hardware.usb.gadget.IUsbGadgetCallback; + +@VintfStability +oneway interface IUsbGadget { + /** + * This function is used to set the current USB gadget configuration. + * Usb gadget needs to teared down if an USB configuration is already + * active. + * + * @param functions The GadgetFunction bitmap. See GadgetFunction for + * the value of each bit. + * @param callback IUsbGadgetCallback::setCurrentUsbFunctionsCb used to + * propagate back the status. + * @param timeoutMs The maximum time (in milliseconds) within which the + * IUsbGadgetCallback needs to be returned. + * @param transactionId ID to be used when invoking the callback. + * + */ + void setCurrentUsbFunctions(in long functions, in IUsbGadgetCallback callback, + in long timeoutMs, long transactionId); + + /** + * This function is used to query the USB functions included in the + * current USB configuration. + * + * @param callback IUsbGadgetCallback::getCurrentUsbFunctionsCb used to + * propagate the current functions list. + * @param transactionId ID to be used when invoking the callback. + */ + void getCurrentUsbFunctions(in IUsbGadgetCallback callback, long transactionId); + + /** + * The function is used to query current USB speed. + * + * @param callback IUsbGadgetCallback::getUsbSpeedCb used to propagate + * current USB speed. + * @param transactionId ID to be used when invoking the callback. + */ + void getUsbSpeed(in IUsbGadgetCallback callback, long transactionId); + + /** + * This function is used to reset USB gadget driver. + * Performs USB data connection reset. The connection will disconnect and + * reconnect. + */ + void reset(); +} diff --git a/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadgetCallback.aidl b/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadgetCallback.aidl new file mode 100644 index 0000000000..75ff02b4a8 --- /dev/null +++ b/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadgetCallback.aidl @@ -0,0 +1,63 @@ +/* + * 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. + */ + +package android.hardware.usb.gadget; + +import android.hardware.usb.gadget.GadgetFunction; +import android.hardware.usb.gadget.Status; +import android.hardware.usb.gadget.UsbSpeed; + +@VintfStability +oneway interface IUsbGadgetCallback { + /** + * Callback function used to propagate the current USB gadget + * configuration. + * @param functions The GadgetFunction bitmap. See GadgetFunction for + * the value of each bit. + * @param status FUNCTIONS_APPLIED when list of functions have been + * applied. + * FUNCTIONS_NOT_APPLIED when the functions have not + * been applied. + * ERROR otherwise. + * @param transactionId ID to be used when invoking the callback. + */ + void getCurrentUsbFunctionsCb(in long functions, in Status status, long transactionId); + + /** + * Used to convey the current USB speed to the caller. + * Must be called either when USB state changes due to USB enumeration or + * when caller requested for USB speed through getUsbSpeed. + * + * @param speed USB Speed defined by UsbSpeed showed current USB + * connection speed. + * @param transactionId ID to be used when invoking the callback. + */ + void getUsbSpeedCb(in UsbSpeed speed, long transactionId); + + /** + * Callback function used to propagate the status of configuration + * switch to the caller. + * + * @param functions list of functions defined by GadgetFunction + * included in the current USB gadget composition. + * @param status SUCCESS when the functions are applied. + * FUNCTIONS_NOT_SUPPORTED when the configuration is + * not supported. + * ERROR otherwise. + * @param transactionId ID to be used when invoking the callback. + */ + void setCurrentUsbFunctionsCb(in long functions, in Status status, long transactionId); +} diff --git a/usb/gadget/aidl/android/hardware/usb/gadget/Status.aidl b/usb/gadget/aidl/android/hardware/usb/gadget/Status.aidl new file mode 100644 index 0000000000..8d8c3e350f --- /dev/null +++ b/usb/gadget/aidl/android/hardware/usb/gadget/Status.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ + +package android.hardware.usb.gadget; + +@VintfStability +@Backing(type="int") +enum Status { + SUCCESS = 0, + /** + * Error value when the HAL operation fails for reasons not listed here. + */ + ERROR = 1, + /** + * USB configuration applied successfully. + */ + FUNCTIONS_APPLIED = 2, + /** + * USB confgiuration failed to apply. + */ + FUNCTIONS_NOT_APPLIED = 3, + /** + * USB configuration not supported. + */ + CONFIGURATION_NOT_SUPPORTED = 4, +} diff --git a/usb/gadget/aidl/android/hardware/usb/gadget/UsbSpeed.aidl b/usb/gadget/aidl/android/hardware/usb/gadget/UsbSpeed.aidl new file mode 100644 index 0000000000..0492757ab6 --- /dev/null +++ b/usb/gadget/aidl/android/hardware/usb/gadget/UsbSpeed.aidl @@ -0,0 +1,50 @@ +/* + * 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. + */ + +package android.hardware.usb.gadget; + +@VintfStability +@Backing(type="int") +enum UsbSpeed { + /** + * UNKNOWN - Not Connected or Unsupported Speed + */ + UNKNOWN = 0, + /** + * USB Low Speed + */ + LOWSPEED = 1, + /** + * USB Full Speed + */ + FULLSPEED = 2, + /** + * USB High Speed + */ + HIGHSPEED = 3, + /** + * USB Super Speed + */ + SUPERSPEED = 4, + /** + * USB Super Speed 10Gbps + */ + SUPERSPEED_10Gb = 5, + /** + * USB Super Speed 20Gbps + */ + SUPERSPEED_20Gb = 6, +} diff --git a/usb/gadget/aidl/default/Android.bp b/usb/gadget/aidl/default/Android.bp new file mode 100644 index 0000000000..2ea0e12a38 --- /dev/null +++ b/usb/gadget/aidl/default/Android.bp @@ -0,0 +1,47 @@ +// +// 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. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: [ + "hardware_interfaces_license", + ], +} +cc_binary { + name: "android.hardware.usb.gadget-service.example", + relative_install_path: "hw", + init_rc: ["android.hardware.usb.gadget-service.example.rc"], + vintf_fragments: [ + "android.hardware.usb.gadget-service.example.xml", + ], + vendor: true, + srcs: ["service_gadget.cpp", "UsbGadget.cpp"], + cflags: ["-Wall", "-Werror"], + shared_libs: [ + "libbase", + "libbinder", + "libhidlbase", + "liblog", + "libutils", + "libhardware", + "android.hardware.usb.gadget-V1-ndk", + "android.frameworks.stats-V1-ndk", + "libcutils", + "libbinder_ndk", + ], +} diff --git a/usb/gadget/aidl/default/UsbGadget.cpp b/usb/gadget/aidl/default/UsbGadget.cpp new file mode 100644 index 0000000000..1f1dc742b6 --- /dev/null +++ b/usb/gadget/aidl/default/UsbGadget.cpp @@ -0,0 +1,299 @@ +/* + * Copyright (C) 2020 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. + */ + +#define LOG_TAG "android.hardware.usb.gadget.aidl-service" + +#include "UsbGadget.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace usb { +namespace gadget { + +string enabledPath; +constexpr char kHsi2cPath[] = "/sys/devices/platform/10d50000.hsi2c"; +constexpr char kI2CPath[] = "/sys/devices/platform/10d50000.hsi2c/i2c-"; +constexpr char kAccessoryLimitCurrent[] = "i2c-max77759tcpc/usb_limit_accessory_current"; +constexpr char kAccessoryLimitCurrentEnable[] = "i2c-max77759tcpc/usb_limit_accessory_enable"; + +UsbGadget::UsbGadget() : mGadgetIrqPath("") { +} + +Status UsbGadget::getUsbGadgetIrqPath() { + std::string irqs; + size_t read_pos = 0; + size_t found_pos = 0; + + if (!ReadFileToString(kProcInterruptsPath, &irqs)) { + ALOGE("cannot read all interrupts"); + return Status::ERROR; + } + + while (true) { + found_pos = irqs.find_first_of("\n", read_pos); + if (found_pos == std::string::npos) { + ALOGI("the string of all interrupts is unexpected"); + return Status::ERROR; + } + + std::string single_irq = irqs.substr(read_pos, found_pos - read_pos); + + if (single_irq.find("dwc3", 0) != std::string::npos) { + unsigned int dwc3_irq_number; + size_t dwc3_pos = single_irq.find_first_of(":"); + if (!ParseUint(single_irq.substr(0, dwc3_pos), &dwc3_irq_number)) { + ALOGI("unknown IRQ strings"); + return Status::ERROR; + } + + mGadgetIrqPath = kProcIrqPath + single_irq.substr(0, dwc3_pos) + kSmpAffinityList; + break; + } + + if (found_pos == irqs.npos) { + ALOGI("USB gadget doesn't start"); + return Status::ERROR; + } + + read_pos = found_pos + 1; + } + + return Status::SUCCESS; +} + +void currentFunctionsAppliedCallback(bool functionsApplied, void *payload) { + UsbGadget *gadget = (UsbGadget *)payload; + gadget->mCurrentUsbFunctionsApplied = functionsApplied; +} + +ScopedAStatus UsbGadget::getCurrentUsbFunctions(const shared_ptr &callback, + int64_t in_transactionId) { + ScopedAStatus ret = callback->getCurrentUsbFunctionsCb( + mCurrentUsbFunctions, + mCurrentUsbFunctionsApplied ? Status::FUNCTIONS_APPLIED : Status::FUNCTIONS_NOT_APPLIED, + in_transactionId); + if (!ret.isOk()) + ALOGE("Call to getCurrentUsbFunctionsCb failed %s", ret.getDescription().c_str()); + + return ScopedAStatus::ok(); +} + +ScopedAStatus UsbGadget::getUsbSpeed(const shared_ptr &callback, + int64_t in_transactionId) { + std::string current_speed; + if (ReadFileToString(SPEED_PATH, ¤t_speed)) { + current_speed = Trim(current_speed); + ALOGI("current USB speed is %s", current_speed.c_str()); + if (current_speed == "low-speed") + mUsbSpeed = UsbSpeed::LOWSPEED; + else if (current_speed == "full-speed") + mUsbSpeed = UsbSpeed::FULLSPEED; + else if (current_speed == "high-speed") + mUsbSpeed = UsbSpeed::HIGHSPEED; + else if (current_speed == "super-speed") + mUsbSpeed = UsbSpeed::SUPERSPEED; + else if (current_speed == "super-speed-plus") + mUsbSpeed = UsbSpeed::SUPERSPEED_10Gb; + else if (current_speed == "UNKNOWN") + mUsbSpeed = UsbSpeed::UNKNOWN; + else + mUsbSpeed = UsbSpeed::UNKNOWN; + } else { + ALOGE("Fail to read current speed"); + mUsbSpeed = UsbSpeed::UNKNOWN; + } + + if (callback) { + ScopedAStatus ret = callback->getUsbSpeedCb(mUsbSpeed, in_transactionId); + + if (!ret.isOk()) + ALOGE("Call to getUsbSpeedCb failed %s", ret.getDescription().c_str()); + } + + return ScopedAStatus::ok(); +} + +Status UsbGadget::tearDownGadget() { + return Status::SUCCESS; +} + +ScopedAStatus UsbGadget::reset() { + return ScopedAStatus::ok(); +} + +Status UsbGadget::setupFunctions(long functions, + const shared_ptr &callback, uint64_t timeout, + int64_t in_transactionId) { + bool ffsEnabled = false; + ALOGI("functions: %ld, timeout: %ld", functions, timeout); + + if ((functions & GadgetFunction::ADB) != 0) { + ffsEnabled = true; + } + + if ((functions & GadgetFunction::NCM) != 0) { + ALOGI("setCurrentUsbFunctions ncm"); + } + + // Pull up the gadget right away when there are no ffs functions. + if (!ffsEnabled) { + mCurrentUsbFunctionsApplied = true; + if (callback) + callback->setCurrentUsbFunctionsCb(functions, Status::SUCCESS, in_transactionId); + return Status::SUCCESS; + } + + return Status::SUCCESS; +} + +Status getI2cBusHelper(string *name) { + DIR *dp; + + dp = opendir(kHsi2cPath); + if (dp != NULL) { + struct dirent *ep; + + while ((ep = readdir(dp))) { + if (ep->d_type == DT_DIR) { + if (string::npos != string(ep->d_name).find("i2c-")) { + std::strtok(ep->d_name, "-"); + *name = std::strtok(NULL, "-"); + } + } + } + closedir(dp); + return Status::SUCCESS; + } + + ALOGE("Failed to open %s", kHsi2cPath); + return Status::ERROR; +} + +ScopedAStatus UsbGadget::setCurrentUsbFunctions(long functions, + const shared_ptr &callback, + int64_t timeout, + int64_t in_transactionId) { + std::unique_lock lk(mLockSetCurrentFunction); + std::string current_usb_power_operation_mode, current_usb_type; + std::string usb_limit_sink_enable; + + string accessoryCurrentLimitEnablePath, accessoryCurrentLimitPath, path; + + ALOGI("enter setCurrentUsbFunctions, in_transactionId=%ld , %ld", in_transactionId , timeout); + mCurrentUsbFunctions = functions; + mCurrentUsbFunctionsApplied = false; + + getI2cBusHelper(&path); + accessoryCurrentLimitPath = kI2CPath + path + "/" + kAccessoryLimitCurrent; + accessoryCurrentLimitEnablePath = kI2CPath + path + "/" + kAccessoryLimitCurrentEnable; + + // Get the gadget IRQ number before tearDownGadget() + if (mGadgetIrqPath.empty()) + getUsbGadgetIrqPath(); + + // Unlink the gadget and stop the monitor if running. + Status status = tearDownGadget(); + if (status != Status::SUCCESS) { + goto error; + } + + ALOGI("Returned from tearDown gadget"); + + // Leave the gadget pulled down to give time for the host to sense disconnect. + //usleep(kDisconnectWaitUs); + + if (functions == GadgetFunction::NONE) { + if (callback == NULL) + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + -1, "callback == NULL"); + ScopedAStatus ret = callback->setCurrentUsbFunctionsCb(functions, Status::SUCCESS, in_transactionId); + if (!ret.isOk()) + ALOGE("Error while calling setCurrentUsbFunctionsCb %s", ret.getDescription().c_str()); + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + -1, "Error while calling setCurrentUsbFunctionsCb"); + } + + status = setupFunctions(functions, callback, timeout, in_transactionId); + if (status != Status::SUCCESS) { + goto error; + } + + if (functions & GadgetFunction::NCM) { + if (!mGadgetIrqPath.empty()) { + if (!WriteStringToFile(BIG_CORE, mGadgetIrqPath)) + ALOGI("Cannot move gadget IRQ to big core, path:%s", mGadgetIrqPath.c_str()); + } + } else { + if (!mGadgetIrqPath.empty()) { + if (!WriteStringToFile(MEDIUM_CORE, mGadgetIrqPath)) + ALOGI("Cannot move gadget IRQ to medium core, path:%s", mGadgetIrqPath.c_str()); + } + } + + if (ReadFileToString(CURRENT_USB_TYPE_PATH, ¤t_usb_type)) + current_usb_type = Trim(current_usb_type); + + if (ReadFileToString(CURRENT_USB_POWER_OPERATION_MODE_PATH, ¤t_usb_power_operation_mode)) + current_usb_power_operation_mode = Trim(current_usb_power_operation_mode); + + if (functions & GadgetFunction::ACCESSORY && + current_usb_type == "Unknown SDP [CDP] DCP" && + (current_usb_power_operation_mode == "default" || + current_usb_power_operation_mode == "1.5A")) { + if (!WriteStringToFile("1300000", accessoryCurrentLimitPath)) { + ALOGI("Write 1.3A to limit current fail"); + } else { + if (!WriteStringToFile("1", accessoryCurrentLimitEnablePath)) { + ALOGI("Enable limit current fail"); + } + } + } else { + if (!WriteStringToFile("0", accessoryCurrentLimitEnablePath)) + ALOGI("unvote accessory limit current failed"); + } + + ALOGI("Usb Gadget setcurrent functions called successfully"); + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + -1, "Usb Gadget setcurrent functions called successfully"); + + +error: + ALOGI("Usb Gadget setcurrent functions failed"); + if (callback == NULL) + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + -1, "Usb Gadget setcurrent functions failed"); + ScopedAStatus ret = callback->setCurrentUsbFunctionsCb(functions, status, in_transactionId); + if (!ret.isOk()) + ALOGE("Error while calling setCurrentUsbFunctionsCb %s", ret.getDescription().c_str()); + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + -1, "Error while calling setCurrentUsbFunctionsCb"); +} +} // namespace gadget +} // namespace usb +} // namespace hardware +} // namespace android +} // aidl diff --git a/usb/gadget/aidl/default/UsbGadget.h b/usb/gadget/aidl/default/UsbGadget.h new file mode 100644 index 0000000000..e1194198eb --- /dev/null +++ b/usb/gadget/aidl/default/UsbGadget.h @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2020 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. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace usb { +namespace gadget { + +using ::aidl::android::hardware::usb::gadget::GadgetFunction; +using ::aidl::android::hardware::usb::gadget::IUsbGadgetCallback; +using ::aidl::android::hardware::usb::gadget::IUsbGadget; +using ::aidl::android::hardware::usb::gadget::Status; +using ::aidl::android::hardware::usb::gadget::UsbSpeed; +using ::android::base::GetProperty; +using ::android::base::SetProperty; +using ::android::base::ParseUint; +using ::android::base::unique_fd; +using ::android::base::ReadFileToString; +using ::android::base::Trim; +using ::android::base::WriteStringToFile; +using ::ndk::ScopedAStatus; +using ::std::shared_ptr; +using ::std::string; + +constexpr char kGadgetName[] = "11110000.dwc3"; +constexpr char kProcInterruptsPath[] = "/proc/interrupts"; +constexpr char kProcIrqPath[] = "/proc/irq/"; +constexpr char kSmpAffinityList[] = "/smp_affinity_list"; +#ifndef UDC_PATH +#define UDC_PATH "/sys/class/udc/11110000.dwc3/" +#endif +//static MonitorFfs monitorFfs(kGadgetName); + +#define SPEED_PATH UDC_PATH "current_speed" + +#define BIG_CORE "6" +#define MEDIUM_CORE "4" + +#define POWER_SUPPLY_PATH "/sys/class/power_supply/usb/" +#define USB_PORT0_PATH "/sys/class/typec/port0/" + +#define CURRENT_MAX_PATH POWER_SUPPLY_PATH "current_max" +#define CURRENT_USB_TYPE_PATH POWER_SUPPLY_PATH "usb_type" +#define CURRENT_USB_POWER_OPERATION_MODE_PATH USB_PORT0_PATH "power_operation_mode" + +struct UsbGadget : public BnUsbGadget { + UsbGadget(); + + // Makes sure that only one request is processed at a time. + std::mutex mLockSetCurrentFunction; + std::string mGadgetIrqPath; + long mCurrentUsbFunctions; + bool mCurrentUsbFunctionsApplied; + UsbSpeed mUsbSpeed; + + ScopedAStatus setCurrentUsbFunctions(long functions, + const shared_ptr &callback, + int64_t timeout, int64_t in_transactionId) override; + + ScopedAStatus getCurrentUsbFunctions(const shared_ptr &callback, + int64_t in_transactionId) override; + + ScopedAStatus reset() override; + + ScopedAStatus getUsbSpeed(const shared_ptr &callback, + int64_t in_transactionId) override; + + private: + Status tearDownGadget(); + Status getUsbGadgetIrqPath(); + Status setupFunctions(long functions, const shared_ptr &callback, + uint64_t timeout, int64_t in_transactionId); +}; + +} // namespace gadget +} // namespace usb +} // namespace hardware +} // namespace android +} // aidl diff --git a/usb/gadget/aidl/default/android.hardware.usb.gadget-service.example.rc b/usb/gadget/aidl/default/android.hardware.usb.gadget-service.example.rc new file mode 100644 index 0000000000..b2a8cc0626 --- /dev/null +++ b/usb/gadget/aidl/default/android.hardware.usb.gadget-service.example.rc @@ -0,0 +1,4 @@ +service vendor.usb_gadget_default /vendor/bin/hw/android.hardware.usb.gadget-service.example + class hal + user system + group system diff --git a/usb/gadget/aidl/default/android.hardware.usb.gadget-service.example.xml b/usb/gadget/aidl/default/android.hardware.usb.gadget-service.example.xml new file mode 100644 index 0000000000..e7eebc35e2 --- /dev/null +++ b/usb/gadget/aidl/default/android.hardware.usb.gadget-service.example.xml @@ -0,0 +1,10 @@ + + + android.hardware.usb.gadget + 1 + + IUsbGadget + default + + + diff --git a/usb/gadget/aidl/default/service_gadget.cpp b/usb/gadget/aidl/default/service_gadget.cpp new file mode 100644 index 0000000000..3cc5718a8f --- /dev/null +++ b/usb/gadget/aidl/default/service_gadget.cpp @@ -0,0 +1,34 @@ +/* + * 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. + */ +#include +#include +#include +#include "UsbGadget.h" +/*using android::OK; +using android::hardware::configureRpcThreadpool; +using android::hardware::joinRpcThreadpool; +using android::sp; +using android::status_t;*/ +using ::aidl::android::hardware::usb::gadget::UsbGadget; +int main() { + ABinderProcess_setThreadPoolMaxThreadCount(0); + std::shared_ptr usbgadget = ndk::SharedRefBase::make(); + const std::string instance = std::string() + UsbGadget::descriptor + "/default"; + binder_status_t status = AServiceManager_addService(usbgadget->asBinder().get(), instance.c_str()); + CHECK(status == STATUS_OK); + ABinderProcess_joinThreadPool(); + return -1; +} From 90584d2caa4630bc4b34a5df7e3459fa88205258 Mon Sep 17 00:00:00 2001 From: Sungtak Lee Date: Tue, 6 Sep 2022 16:05:58 +0000 Subject: [PATCH 333/998] Add bufferpool AIDL definitions Bug: 254050250 Test: m Change-Id: I4b371ccd9a1e1ed59e642d585aa4119c775fbd2c --- .../exclude/fcm_exclude.cpp | 1 + media/bufferpool/aidl/Android.bp | 35 ++++++ .../hardware/media/bufferpool2/Buffer.aidl | 39 +++++++ .../BufferInvalidationMessage.aidl | 40 +++++++ .../media/bufferpool2/BufferStatus.aidl | 47 ++++++++ .../bufferpool2/BufferStatusMessage.aidl | 43 +++++++ .../hardware/media/bufferpool2/IAccessor.aidl | 46 ++++++++ .../media/bufferpool2/IClientManager.aidl | 38 +++++++ .../media/bufferpool2/IConnection.aidl | 46 ++++++++ .../hardware/media/bufferpool2/IObserver.aidl | 38 +++++++ .../media/bufferpool2/ResultStatus.aidl | 43 +++++++ .../hardware/media/bufferpool2/Buffer.aidl | 35 ++++++ .../BufferInvalidationMessage.aidl | 40 +++++++ .../media/bufferpool2/BufferStatus.aidl | 68 +++++++++++ .../bufferpool2/BufferStatusMessage.aidl | 50 +++++++++ .../hardware/media/bufferpool2/IAccessor.aidl | 106 ++++++++++++++++++ .../media/bufferpool2/IClientManager.aidl | 46 ++++++++ .../media/bufferpool2/IConnection.aidl | 73 ++++++++++++ .../hardware/media/bufferpool2/IObserver.aidl | 35 ++++++ .../media/bufferpool2/ResultStatus.aidl | 28 +++++ 20 files changed, 897 insertions(+) create mode 100644 media/bufferpool/aidl/Android.bp create mode 100644 media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/Buffer.aidl create mode 100644 media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/BufferInvalidationMessage.aidl create mode 100644 media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/BufferStatus.aidl create mode 100644 media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/BufferStatusMessage.aidl create mode 100644 media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IAccessor.aidl create mode 100644 media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IClientManager.aidl create mode 100644 media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IConnection.aidl create mode 100644 media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IObserver.aidl create mode 100644 media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/ResultStatus.aidl create mode 100644 media/bufferpool/aidl/android/hardware/media/bufferpool2/Buffer.aidl create mode 100644 media/bufferpool/aidl/android/hardware/media/bufferpool2/BufferInvalidationMessage.aidl create mode 100644 media/bufferpool/aidl/android/hardware/media/bufferpool2/BufferStatus.aidl create mode 100644 media/bufferpool/aidl/android/hardware/media/bufferpool2/BufferStatusMessage.aidl create mode 100644 media/bufferpool/aidl/android/hardware/media/bufferpool2/IAccessor.aidl create mode 100644 media/bufferpool/aidl/android/hardware/media/bufferpool2/IClientManager.aidl create mode 100644 media/bufferpool/aidl/android/hardware/media/bufferpool2/IConnection.aidl create mode 100644 media/bufferpool/aidl/android/hardware/media/bufferpool2/IObserver.aidl create mode 100644 media/bufferpool/aidl/android/hardware/media/bufferpool2/ResultStatus.aidl diff --git a/compatibility_matrices/exclude/fcm_exclude.cpp b/compatibility_matrices/exclude/fcm_exclude.cpp index cb77c7b0e0..cf1e138090 100644 --- a/compatibility_matrices/exclude/fcm_exclude.cpp +++ b/compatibility_matrices/exclude/fcm_exclude.cpp @@ -61,6 +61,7 @@ bool ShouldCheckMissingHalsInFcm(const std::string& package) { "android.hardware.graphics.common", "android.hardware.input.common", "android.hardware.keymaster", + "android.hardware.media.bufferpool2", "android.hardware.radio", "android.hardware.uwb.fira_android", diff --git a/media/bufferpool/aidl/Android.bp b/media/bufferpool/aidl/Android.bp new file mode 100644 index 0000000000..3b2ea3cd62 --- /dev/null +++ b/media/bufferpool/aidl/Android.bp @@ -0,0 +1,35 @@ +// 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. + +aidl_interface { + name: "android.hardware.media.bufferpool2", + vendor_available: true, + srcs: ["android/hardware/media/bufferpool2/*.aidl"], + imports: [ + "android.hardware.common-V2", + "android.hardware.common.fmq-V1", + ], + stability: "vintf", + backend: { + cpp: { + enabled: false, + }, + java: { + enabled: false, + }, + ndk: { + enabled: true, + }, + }, +} diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/Buffer.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/Buffer.aidl new file mode 100644 index 0000000000..4ea0bba7fc --- /dev/null +++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/Buffer.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.bufferpool2; +@VintfStability +parcelable Buffer { + int id; + android.hardware.common.NativeHandle buffer; +} diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/BufferInvalidationMessage.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/BufferInvalidationMessage.aidl new file mode 100644 index 0000000000..181286c197 --- /dev/null +++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/BufferInvalidationMessage.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.bufferpool2; +@FixedSize @VintfStability +parcelable BufferInvalidationMessage { + int messageId; + int fromBufferId; + int toBufferId; +} diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/BufferStatus.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/BufferStatus.aidl new file mode 100644 index 0000000000..13174ffe09 --- /dev/null +++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/BufferStatus.aidl @@ -0,0 +1,47 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.bufferpool2; +@Backing(type="int") @VintfStability +enum BufferStatus { + NOT_USED = 0, + USED = 1, + TRANSFER_TO = 2, + TRANSFER_FROM = 3, + TRANSFER_TIMEOUT = 4, + TRANSFER_LOST = 5, + TRANSFER_FETCH = 6, + TRANSFER_OK = 7, + TRANSFER_ERROR = 8, + INVALIDATION_ACK = 9, +} diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/BufferStatusMessage.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/BufferStatusMessage.aidl new file mode 100644 index 0000000000..7e79a368d1 --- /dev/null +++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/BufferStatusMessage.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.bufferpool2; +@FixedSize @VintfStability +parcelable BufferStatusMessage { + long transactionId; + int bufferId; + android.hardware.media.bufferpool2.BufferStatus status; + long connectionId; + long targetConnectionId; + long timestampUs; +} diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IAccessor.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IAccessor.aidl new file mode 100644 index 0000000000..4053797dcf --- /dev/null +++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IAccessor.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.bufferpool2; +@VintfStability +interface IAccessor { + android.hardware.media.bufferpool2.IAccessor.ConnectionInfo connect(in android.hardware.media.bufferpool2.IObserver observer); + @VintfStability + parcelable ConnectionInfo { + android.hardware.media.bufferpool2.IConnection connection; + long connectionId; + int msgId; + android.hardware.common.fmq.MQDescriptor toFmqDesc; + android.hardware.common.fmq.MQDescriptor fromFmqDesc; + } +} diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IClientManager.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IClientManager.aidl new file mode 100644 index 0000000000..54896d4fbf --- /dev/null +++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IClientManager.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.bufferpool2; +@VintfStability +interface IClientManager { + long registerSender(in android.hardware.media.bufferpool2.IAccessor bufferPool); +} diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IConnection.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IConnection.aidl new file mode 100644 index 0000000000..300fcbae9b --- /dev/null +++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IConnection.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.bufferpool2; +@VintfStability +interface IConnection { + android.hardware.media.bufferpool2.IConnection.FetchResult[] fetch(in android.hardware.media.bufferpool2.IConnection.FetchInfo[] fetchInfos); + parcelable FetchInfo { + long transactionId; + int bufferId; + } + union FetchResult { + android.hardware.media.bufferpool2.Buffer buffer; + android.hardware.media.bufferpool2.ResultStatus failure; + } +} diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IObserver.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IObserver.aidl new file mode 100644 index 0000000000..2d8cffe70c --- /dev/null +++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IObserver.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.bufferpool2; +@VintfStability +interface IObserver { + oneway void onMessage(in long connectionId, in int msgId); +} diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/ResultStatus.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/ResultStatus.aidl new file mode 100644 index 0000000000..73709985c4 --- /dev/null +++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/ResultStatus.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.bufferpool2; +@VintfStability +parcelable ResultStatus { + int resultStatus; + const int OK = 0; + const int NO_MEMORY = 1; + const int ALREADY_EXISTS = 2; + const int NOT_FOUND = 3; + const int CRITICAL_ERROR = 4; +} diff --git a/media/bufferpool/aidl/android/hardware/media/bufferpool2/Buffer.aidl b/media/bufferpool/aidl/android/hardware/media/bufferpool2/Buffer.aidl new file mode 100644 index 0000000000..976f674878 --- /dev/null +++ b/media/bufferpool/aidl/android/hardware/media/bufferpool2/Buffer.aidl @@ -0,0 +1,35 @@ +/* + * 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. + */ + +package android.hardware.media.bufferpool2; + +import android.hardware.common.NativeHandle; + +/** + * Generic buffer for fast recycling for media/stagefright. + * + * During media pipeline buffer references are created, shared and + * destroyed frequently. The underlying buffers are allocated on demand + * by a buffer pool, and are recycled to the buffer pool when they are + * no longer referenced by the clients. + * + * E.g. ion or gralloc buffer + */ +@VintfStability +parcelable Buffer { + int id; + NativeHandle buffer; +} diff --git a/media/bufferpool/aidl/android/hardware/media/bufferpool2/BufferInvalidationMessage.aidl b/media/bufferpool/aidl/android/hardware/media/bufferpool2/BufferInvalidationMessage.aidl new file mode 100644 index 0000000000..ad03cd54b8 --- /dev/null +++ b/media/bufferpool/aidl/android/hardware/media/bufferpool2/BufferInvalidationMessage.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ + +package android.hardware.media.bufferpool2; + +/* + * Buffer pool sends a buffer invalidation message to clients in order to + * ensure fast reclamation of the buffers. Buffer pool implementation on + * clients must release the invalidated buffers right away after finishing + * the use of buffers upon receiving a buffer invalidation message. + * Users cannot delay or control timing of the handling/reception of + * invalidation messages. Buffer pool implementation must guarantee timely + * handling of invalidation messages. + */ +@VintfStability +@FixedSize +parcelable BufferInvalidationMessage { + int messageId; + /** + * Buffers from fromBufferId to toBufferId must be invalidated. + * fromBufferId is inclusive, but toBufferId is not inclusive. + * If fromBufferId > toBufferID, wrap happens. In that case + * the wrap is based on UINT32_MAX. + */ + int fromBufferId; + int toBufferId; +} diff --git a/media/bufferpool/aidl/android/hardware/media/bufferpool2/BufferStatus.aidl b/media/bufferpool/aidl/android/hardware/media/bufferpool2/BufferStatus.aidl new file mode 100644 index 0000000000..b63aee2b55 --- /dev/null +++ b/media/bufferpool/aidl/android/hardware/media/bufferpool2/BufferStatus.aidl @@ -0,0 +1,68 @@ +/* + * 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. + */ + +package android.hardware.media.bufferpool2; + +/** + * Buffer ownership status for the specified client. + * Buffer transfer status for the specified buffer transafer transaction. + * BufferStatus is posted along with BufferStatusMessage from a client to + * the buffer pool for synchronization after status change. + */ +@VintfStability +@Backing(type="int") +enum BufferStatus { + /** + * No longer used by the specified client. + */ + NOT_USED = 0, + /** + * Buffer is acquired by the specified client. + */ + USED = 1, + /** + * Buffer is sent by the specified client. + */ + TRANSFER_TO = 2, + /** + * Buffer transfer is acked by the receiver client. + */ + TRANSFER_FROM = 3, + /** + * Buffer transfer is timed out by receiver client. + */ + TRANSFER_TIMEOUT = 4, + /** + * Buffer transfer is not acked by the receiver. + */ + TRANSFER_LOST = 5, + /** + * Buffer fetch request from the client. + */ + TRANSFER_FETCH = 6, + /** + * Buffer transaction succeeded. + */ + TRANSFER_OK = 7, + /** + * Buffer transaction failure. + */ + TRANSFER_ERROR = 8, + /** + * Buffer invalidation ack. + */ + INVALIDATION_ACK = 9, +} diff --git a/media/bufferpool/aidl/android/hardware/media/bufferpool2/BufferStatusMessage.aidl b/media/bufferpool/aidl/android/hardware/media/bufferpool2/BufferStatusMessage.aidl new file mode 100644 index 0000000000..e3fd8f0cce --- /dev/null +++ b/media/bufferpool/aidl/android/hardware/media/bufferpool2/BufferStatusMessage.aidl @@ -0,0 +1,50 @@ +/* + * 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. + */ + +package android.hardware.media.bufferpool2; + +import android.hardware.media.bufferpool2.BufferStatus; + +/** + * Buffer ownership status change message. This message is + * sent via fmq to the buffer pool from client processes. + */ +@VintfStability +@FixedSize +parcelable BufferStatusMessage { + /** + * Transaction Id = (SenderId : sender local transaction Id) + * Transaction Id is created from sender and posted via fmq within + * TRANSFER_TO message. + */ + long transactionId; + int bufferId; + BufferStatus status; + /** + * Used by the buffer pool, not by client. + */ + long connectionId; + /** + * Valid only when TRANSFER_TO is posted. + */ + long targetConnectionId; + /** + * Used by the buffer pool, not by client. + * Monotonic timestamp in Us since fixed point in time as decided + * by the sender of the message + */ + long timestampUs; +} diff --git a/media/bufferpool/aidl/android/hardware/media/bufferpool2/IAccessor.aidl b/media/bufferpool/aidl/android/hardware/media/bufferpool2/IAccessor.aidl new file mode 100644 index 0000000000..0fa5961929 --- /dev/null +++ b/media/bufferpool/aidl/android/hardware/media/bufferpool2/IAccessor.aidl @@ -0,0 +1,106 @@ +/* + * 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. + */ + +package android.hardware.media.bufferpool2; + +import android.hardware.common.fmq.MQDescriptor; +import android.hardware.common.fmq.SynchronizedReadWrite; +import android.hardware.common.fmq.UnsynchronizedWrite; + + +import android.hardware.media.bufferpool2.BufferInvalidationMessage; +import android.hardware.media.bufferpool2.BufferStatusMessage; +import android.hardware.media.bufferpool2.IConnection; +import android.hardware.media.bufferpool2.IObserver; + +/** + * IAccessor creates IConnection which is used from IClientManager in order to + * use functionality of the specified buffer pool. + */ +@VintfStability +interface IAccessor { + @VintfStability + /** + * Connection information between the bufferpool process and the receiver + * process. The information is used from the receiver process in order to + * receive buffers from the bufferpool process. + */ + parcelable ConnectionInfo { + /** + * The interface to get shared buffers from the bufferpool. + */ + IConnection connection; + /** + * The identifier for a (sender/receiver) pair during buffer transfer. + * This is system wide unique. + */ + long connectionId; + /** + * Id of the most recent message from bufferpool. This is monotonic. + */ + int msgId; + /** + * The FMQ descriptor for sending buffer status messages back to bufferpool + */ + MQDescriptor toFmqDesc; + /** + * The FMQ descriptor for receiving buffer invalidation messages from bufferpool + */ + MQDescriptor fromFmqDesc; + } + + /** + * Registers a new client and creates IConnection to the buffer pool for + * the client. IConnection and FMQ are used by IClientManager in order to + * communicate with the buffer pool. Via FMQ IClientManager sends + * BufferStatusMessage(s) to the buffer pool. + * + * FMQ is used to send buffer ownership status changes to a buffer pool + * from a buffer pool client. A buffer pool synchronizes FMQ messages when + * there is an aidl request from the clients. Every client has its own + * connection and FMQ to communicate with the buffer pool. So sending an + * FMQ message on behalf of other clients is not possible. + * + * FMQ messages are sent when a buffer is acquired or released. Also, FMQ + * messages are sent when a buffer is transferred from a client to another + * client. FMQ has its own ID from a buffer pool. A client is specified + * with the ID. + * + * To transfer a buffer, a sender must send an FMQ message. The message + * must include a receiver's ID and a transaction ID. A receiver must send + * the transaction ID to fetch a buffer from a buffer pool. Since the + * sender already registered the receiver via an FMQ message, The buffer + * pool must verify the receiver with the transaction ID. In order to + * prevent faking a receiver, a connection to a buffer pool from client is + * made and kept private. Also part of transaction ID is a sender ID in + * order to prevent fake transactions from other clients. This must be + * verified with an FMQ message from a buffer pool. + * + * @param observer The buffer pool event observer from the client. + * Observer is provided to ensure FMQ messages are processed even when + * client processes are idle. Buffer invalidation caused by + * reconfiguration does not call observer. Buffer invalidation caused + * by termination of pipeline call observer in order to ensure + * invalidation is done after pipeline completion. + * @return ConnectionInfo The information regarding the established + * connection + * @@throws ServiceSpecificException with one of the following values: + * ResultStatus::NO_MEMORY - Memory allocation failure occurred. + * ResultStatus::ALREADY_EXISTS - A connection was already made. + * ResultStatus::CRITICAL_ERROR - Other errors. + */ + ConnectionInfo connect(in IObserver observer); +} diff --git a/media/bufferpool/aidl/android/hardware/media/bufferpool2/IClientManager.aidl b/media/bufferpool/aidl/android/hardware/media/bufferpool2/IClientManager.aidl new file mode 100644 index 0000000000..bf36e25a55 --- /dev/null +++ b/media/bufferpool/aidl/android/hardware/media/bufferpool2/IClientManager.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ + +package android.hardware.media.bufferpool2; + +import android.hardware.media.bufferpool2.IAccessor; + +/** + * IClientManager manages IConnection(s) inside a process. A locally + * created IConnection represents a communication node(receiver) with the + * specified buffer pool(IAccessor). + * IConnection(s) are not exposed to other processes(IClientManager). + * IClientManager instance must be unique within a process. + */ +@VintfStability +interface IClientManager { + /** + * Sets up a buffer receiving communication node for the specified + * buffer pool. A manager must create a IConnection to the buffer + * pool if it does not already have a connection. + * + * @param bufferPool a buffer pool which is specified with the IAccessor. + * The specified buffer pool is the owner of received buffers. + * @return the Id of the communication node to the buffer pool. + * This id is used in FMQ to notify IAccessor that a buffer has been + * sent to that connection during transfers. + * @throws ServiceSpecificException with one of the following values: + * ResultStatus::NO_MEMORY - Memory allocation failure occurred. + * ResultStatus::ALREADY_EXISTS - A sender was registered already. + * ResultStatus::CRITICAL_ERROR - Other errors. + */ + long registerSender(in IAccessor bufferPool); +} diff --git a/media/bufferpool/aidl/android/hardware/media/bufferpool2/IConnection.aidl b/media/bufferpool/aidl/android/hardware/media/bufferpool2/IConnection.aidl new file mode 100644 index 0000000000..d869f47a64 --- /dev/null +++ b/media/bufferpool/aidl/android/hardware/media/bufferpool2/IConnection.aidl @@ -0,0 +1,73 @@ +/* + * 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. + */ + +package android.hardware.media.bufferpool2; + +import android.hardware.media.bufferpool2.Buffer; +import android.hardware.media.bufferpool2.ResultStatus; + +/** + * A connection to a buffer pool which handles requests from a buffer pool + * client. The connection must be made in order to receive buffers from + * other buffer pool clients. + */ +@VintfStability +interface IConnection { + + parcelable FetchInfo { + /** + * Unique transaction id for buffer transferring. + */ + long transactionId; + /** + * Id of the buffer to be fetched. + */ + int bufferId; + } + + union FetchResult { + /** + * The fetched buffer on successful fetch. + */ + Buffer buffer; + /** + * The reason of the request failure. Possible values are below. + * + * ResultStatus::NOT_FOUND - A buffer was not found due to invalidation. + * ResultStatus::CRITICAL_ERROR - Other errors. + */ + ResultStatus failure; + } + + /** + * Retrieves buffers using an array of FetchInfo. + * Each element of FetchInfo array contains a bufferId and a transactionId + * for each buffer to fetch. The method must be called from receiving side of buffers + * during transferring only when the specified buffer is neither cached nor used. + * + * The method could have partial failures, in the case other successfully fetched buffers + * will be in returned result along with the failures. The order of the returned result + * will be the same with the fetchInfos. + * + * @param fetchInfos information of buffers to fetch + * @return Requested buffers. + * If there are failures, reasons of failures are also included. + * @throws ServiceSpecificException with one of the following values: + * ResultStatus::NO_MEMORY - Memory allocation failure occurred. + * ResultStatus::CRITICAL_ERROR - Other errors. + */ + FetchResult[] fetch(in FetchInfo[] fetchInfos); +} diff --git a/media/bufferpool/aidl/android/hardware/media/bufferpool2/IObserver.aidl b/media/bufferpool/aidl/android/hardware/media/bufferpool2/IObserver.aidl new file mode 100644 index 0000000000..07d1c3e4a3 --- /dev/null +++ b/media/bufferpool/aidl/android/hardware/media/bufferpool2/IObserver.aidl @@ -0,0 +1,35 @@ +/* + * 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. + */ + +package android.hardware.media.bufferpool2; + +/** + * IObserver listens on notifications from the buffer pool. On receiving + * notifications, FMQ messages from the specific buffer pool which are already + * in the FMQ are processed. + */ +@VintfStability +interface IObserver { + /** + * The specific buffer pool sent a message to the client. Calling this + * method from the buffer pool enforces a buffer pool client process the + * message. + * + * @param connectionId the connection Id of the specific buffer pool client + * @param msgId Id of the most recent message + */ + oneway void onMessage(in long connectionId, in int msgId); +} diff --git a/media/bufferpool/aidl/android/hardware/media/bufferpool2/ResultStatus.aidl b/media/bufferpool/aidl/android/hardware/media/bufferpool2/ResultStatus.aidl new file mode 100644 index 0000000000..162f9a719a --- /dev/null +++ b/media/bufferpool/aidl/android/hardware/media/bufferpool2/ResultStatus.aidl @@ -0,0 +1,28 @@ +/* + * 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. + */ + +package android.hardware.media.bufferpool2; + +@VintfStability +parcelable ResultStatus { + const int OK = 0; + const int NO_MEMORY = 1; + const int ALREADY_EXISTS = 2; + const int NOT_FOUND = 3; + const int CRITICAL_ERROR = 4; + + int resultStatus; +} From 49b81dd647f94a7c7a7aa809d5c1464aae694f9e Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Tue, 1 Nov 2022 06:23:18 +0000 Subject: [PATCH 334/998] Change the type of token of startImsTraffic from String to int Bug: 219242095 Test: atest VtsHalRadioTargetTest Change-Id: Ie9584fb10111f480e89a0119d17407e76d39fd89 --- .../current/android/hardware/radio/ims/IRadioIms.aidl | 4 ++-- .../android/hardware/radio/ims/IRadioImsIndication.aidl | 2 +- radio/aidl/android/hardware/radio/ims/IRadioIms.aidl | 4 ++-- .../aidl/android/hardware/radio/ims/IRadioImsIndication.aidl | 2 +- radio/aidl/vts/radio_ims_indication.cpp | 4 ++-- radio/aidl/vts/radio_ims_test.cpp | 5 ++--- radio/aidl/vts/radio_ims_utils.h | 2 +- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl index ee5c57292a..e7403456a7 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl @@ -36,8 +36,8 @@ package android.hardware.radio.ims; interface IRadioIms { oneway void setSrvccCallInfo(int serial, in android.hardware.radio.ims.SrvccCall[] srvccCalls); oneway void updateImsRegistrationInfo(int serial, in android.hardware.radio.ims.ImsRegistration imsRegistration); - oneway void startImsTraffic(int serial, in String token, android.hardware.radio.ims.ImsTrafficType imsTrafficType, android.hardware.radio.AccessNetwork accessNetworkType); - oneway void stopImsTraffic(int serial, in String token); + oneway void startImsTraffic(int serial, int token, android.hardware.radio.ims.ImsTrafficType imsTrafficType, android.hardware.radio.AccessNetwork accessNetworkType); + oneway void stopImsTraffic(int serial, int token); oneway void triggerEpsFallback(int serial, in android.hardware.radio.ims.EpsFallbackReason reason); oneway void setResponseFunctions(in android.hardware.radio.ims.IRadioImsResponse radioImsResponse, in android.hardware.radio.ims.IRadioImsIndication radioImsIndication); oneway void sendAnbrQuery(int serial, android.hardware.radio.ims.ImsStreamType mediaType, android.hardware.radio.ims.ImsStreamDirection direction, int bitsPerSecond); diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl index 63f29f3f44..ef6b4cc9ca 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsIndication.aidl @@ -34,7 +34,7 @@ package android.hardware.radio.ims; @VintfStability interface IRadioImsIndication { - oneway void onConnectionSetupFailure(in android.hardware.radio.RadioIndicationType type, in String token, in android.hardware.radio.ims.ConnectionFailureInfo info); + oneway void onConnectionSetupFailure(in android.hardware.radio.RadioIndicationType type, int token, in android.hardware.radio.ims.ConnectionFailureInfo info); oneway void notifyAnbr(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.ims.ImsStreamType mediaType, in android.hardware.radio.ims.ImsStreamDirection direction, int bitsPerSecond); oneway void triggerImsDeregistration(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.ims.ImsDeregistrationReason reason); } diff --git a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl index 76b1f037f6..c5412e1688 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl @@ -88,7 +88,7 @@ oneway interface IRadioIms { * * Response function is IRadioImsResponse.startImsTrafficResponse() */ - void startImsTraffic(int serial, in String token, + void startImsTraffic(int serial, int token, ImsTrafficType imsTrafficType, AccessNetwork accessNetworkType); /** @@ -101,7 +101,7 @@ oneway interface IRadioIms { * * Response function is IRadioImsResponse.stopImsTrafficResponse() */ - void stopImsTraffic(int serial, in String token); + void stopImsTraffic(int serial, int token); /** * Triggers the UE initiated EPS fallback when a MO voice call failed to establish on 5G NR diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl index 82773f23cf..d123d07b90 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioImsIndication.aidl @@ -37,7 +37,7 @@ oneway interface IRadioImsIndication { * @param info Connection failure information */ void onConnectionSetupFailure( - in RadioIndicationType type, in String token, in ConnectionFailureInfo info); + in RadioIndicationType type, int token, in ConnectionFailureInfo info); /** * Access Network Bitrate Recommendation (ANBR), see 3GPP TS 26.114. diff --git a/radio/aidl/vts/radio_ims_indication.cpp b/radio/aidl/vts/radio_ims_indication.cpp index f382de05d4..988038bb92 100644 --- a/radio/aidl/vts/radio_ims_indication.cpp +++ b/radio/aidl/vts/radio_ims_indication.cpp @@ -19,7 +19,7 @@ RadioImsIndication::RadioImsIndication(RadioServiceTest& parent) : parent_ims(parent) {} ndk::ScopedAStatus RadioImsIndication::onConnectionSetupFailure(RadioIndicationType /*type*/, - const std::string& /*token*/, const ConnectionFailureInfo& /*info*/) { + int32_t /*token*/, const ConnectionFailureInfo& /*info*/) { return ndk::ScopedAStatus::ok(); } @@ -31,4 +31,4 @@ ndk::ScopedAStatus RadioImsIndication::notifyAnbr(RadioIndicationType /*type*/, ndk::ScopedAStatus RadioImsIndication::triggerImsDeregistration(RadioIndicationType /*type*/, ImsDeregistrationReason /*reason*/) { return ndk::ScopedAStatus::ok(); -} \ No newline at end of file +} diff --git a/radio/aidl/vts/radio_ims_test.cpp b/radio/aidl/vts/radio_ims_test.cpp index e5cbeb46db..fb81e0559e 100644 --- a/radio/aidl/vts/radio_ims_test.cpp +++ b/radio/aidl/vts/radio_ims_test.cpp @@ -124,7 +124,7 @@ TEST_P(RadioImsTest, startImsTraffic) { serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = - radio_ims->startImsTraffic(serial, std::string("1"), + radio_ims->startImsTraffic(serial, 1, ImsTrafficType::REGISTRATION, AccessNetwork::EUTRAN); ASSERT_OK(res); EXPECT_EQ(std::cv_status::no_timeout, wait()); @@ -150,8 +150,7 @@ TEST_P(RadioImsTest, stopImsTraffic) { serial = GetRandomSerialNumber(); - ndk::ScopedAStatus res = - radio_ims->stopImsTraffic(serial, std::string("2")); + ndk::ScopedAStatus res = radio_ims->stopImsTraffic(serial, 2); ASSERT_OK(res); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type); diff --git a/radio/aidl/vts/radio_ims_utils.h b/radio/aidl/vts/radio_ims_utils.h index c981ebc8b0..a435e44d99 100644 --- a/radio/aidl/vts/radio_ims_utils.h +++ b/radio/aidl/vts/radio_ims_utils.h @@ -64,7 +64,7 @@ class RadioImsIndication : public BnRadioImsIndication { virtual ~RadioImsIndication() = default; virtual ndk::ScopedAStatus onConnectionSetupFailure(RadioIndicationType type, - const std::string& token, const ConnectionFailureInfo& info) override; + int32_t token, const ConnectionFailureInfo& info) override; virtual ndk::ScopedAStatus notifyAnbr(RadioIndicationType type, ImsStreamType mediaType, ImsStreamDirection direction, int bitsPerSecond) override; From a977bcc18bf9ce5bfdf244dd5bb45daef0dd94ea Mon Sep 17 00:00:00 2001 From: Shinru Han Date: Fri, 7 Oct 2022 14:11:33 +0800 Subject: [PATCH 335/998] Add injectNiSuplMessageData() Test: atest VtsHalGnssTargetTest Bug: b/242105192 Change-Id: I32a87cbcad67fda032137ed5eb2181cd0266f171 --- .../current/android/hardware/gnss/IAGnssRil.aidl | 1 + gnss/aidl/android/hardware/gnss/IAGnssRil.aidl | 10 ++++++++++ gnss/aidl/default/AGnssRil.cpp | 12 ++++++++++++ gnss/aidl/default/AGnssRil.h | 2 ++ gnss/aidl/vts/gnss_hal_test_cases.cpp | 4 ++++ 5 files changed, 29 insertions(+) diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRil.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRil.aidl index 8930752f7f..c782b6f8ff 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRil.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IAGnssRil.aidl @@ -39,6 +39,7 @@ interface IAGnssRil { void setRefLocation(in android.hardware.gnss.IAGnssRil.AGnssRefLocation agnssReflocation); void setSetId(in android.hardware.gnss.IAGnssRil.SetIdType type, in @utf8InCpp String setid); void updateNetworkState(in android.hardware.gnss.IAGnssRil.NetworkAttributes attributes); + void injectNiSuplMessageData(in byte[] msgData, in int slotIndex); const int NETWORK_CAPABILITY_NOT_METERED = 1; const int NETWORK_CAPABILITY_NOT_ROAMING = 2; @Backing(type="int") @VintfStability diff --git a/gnss/aidl/android/hardware/gnss/IAGnssRil.aidl b/gnss/aidl/android/hardware/gnss/IAGnssRil.aidl index 44847f0ab1..5f2e261fad 100644 --- a/gnss/aidl/android/hardware/gnss/IAGnssRil.aidl +++ b/gnss/aidl/android/hardware/gnss/IAGnssRil.aidl @@ -164,4 +164,14 @@ interface IAGnssRil { * */ void updateNetworkState(in NetworkAttributes attributes); + + /** + * Injects an SMS/WAP initiated SUPL message. + * + * @param msgData ASN.1 encoded SUPL INIT message. This is defined in + * UserPlane Location Protocol (Version 2.0.4). + * @param slotIndex Specifies the slot index (See + * android.telephony.SubscriptionManager#getSlotIndex()) of the SUPL connection. + */ + void injectNiSuplMessageData(in byte[] msgData, in int slotIndex); } diff --git a/gnss/aidl/default/AGnssRil.cpp b/gnss/aidl/default/AGnssRil.cpp index 2aa1abcb98..81b4f2a26e 100644 --- a/gnss/aidl/default/AGnssRil.cpp +++ b/gnss/aidl/default/AGnssRil.cpp @@ -17,6 +17,7 @@ #define LOG_TAG "AGnssRilAidl" #include "AGnssRil.h" +#include #include #include @@ -55,4 +56,15 @@ ndk::ScopedAStatus AGnssRil::updateNetworkState(const NetworkAttributes& attribu return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus AGnssRil::injectNiSuplMessageData(const std::vector& msgData, + int slotIndex) { + ALOGD("AGnssRil::injectNiSuplMessageData: msgData:%d bytes slotIndex:%d", + static_cast(msgData.size()), slotIndex); + if (msgData.size() > 0) { + return ndk::ScopedAStatus::ok(); + } else { + return ndk::ScopedAStatus::fromServiceSpecificError(IGnss::ERROR_INVALID_ARGUMENT); + } +} + } // namespace aidl::android::hardware::gnss diff --git a/gnss/aidl/default/AGnssRil.h b/gnss/aidl/default/AGnssRil.h index e205b69763..76583ac38b 100644 --- a/gnss/aidl/default/AGnssRil.h +++ b/gnss/aidl/default/AGnssRil.h @@ -26,6 +26,8 @@ struct AGnssRil : public BnAGnssRil { ndk::ScopedAStatus setRefLocation(const AGnssRefLocation& agnssReflocation) override; ndk::ScopedAStatus setSetId(SetIdType type, const std::string& setid) override; ndk::ScopedAStatus updateNetworkState(const NetworkAttributes& attributes) override; + ndk::ScopedAStatus injectNiSuplMessageData(const std::vector& msgData, + int slotIndex) override; private: // Synchronization lock for sCallback diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp index e2ad2780d8..7c0a4df6d5 100644 --- a/gnss/aidl/vts/gnss_hal_test_cases.cpp +++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp @@ -1077,6 +1077,7 @@ TEST_P(GnssHalTest, TestAGnssExtension) { * 2. Sets AGnssRilCallback. * 3. Update network state to connected and then disconnected. * 4. Sets reference location. + * 5. Injects empty NI message data and verifies that it returns an error. */ TEST_P(GnssHalTest, TestAGnssRilExtension) { if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { @@ -1120,6 +1121,9 @@ TEST_P(GnssHalTest, TestAGnssRilExtension) { status = iAGnssRil->setRefLocation(agnssReflocation); ASSERT_TRUE(status.isOk()); + + status = iAGnssRil->injectNiSuplMessageData(std::vector(), 0); + ASSERT_FALSE(status.isOk()); } /* From c3d695db50f1a24adefa8c88d28f85a7e7abeb4c Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Fri, 16 Sep 2022 15:34:59 -0400 Subject: [PATCH 336/998] ComposerClient[Writer/Reader]: enforce a specific display Add a new parameter and member to ComposerClient[Writer/Reader] representing the only display it should apply to. The caller is responsible for ensuring that they only ever refer to that same display. The display is recorded here for error checking. This isn't strictly necessary, but crashing here verifies that we only use the proper display. This is helpful for use with DisplayCapability.MULTI_THREADED_PRESENT, although it is fine to use a single display per writer/reader without the capability. For the Reader, make the display optional, so that a single reader can continue to be used for multiple displays. This allows devices without the new DisplayCapability to continue to work without changes. Remove copy constructor and operator=. Add a move constructor. This ensures it will be properly moved when used in containers. Bug: 241285491 Test: make Change-Id: Ic7116e64138280747a32500c67dedeeabd7c669b --- .../graphics/composer3/ComposerClientReader.h | 23 +- .../graphics/composer3/ComposerClientWriter.h | 11 +- .../composer/aidl/vts/VtsComposerClient.h | 1 + .../VtsHalGraphicsComposer3_ReadbackTest.cpp | 129 ++++---- .../VtsHalGraphicsComposer3_TargetTest.cpp | 298 ++++++++++-------- 5 files changed, 269 insertions(+), 193 deletions(-) diff --git a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientReader.h b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientReader.h index 27dce76377..76ba24b0b2 100644 --- a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientReader.h +++ b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientReader.h @@ -19,8 +19,8 @@ #include #include #include +#include #include -#include #include #include @@ -41,8 +41,15 @@ namespace aidl::android::hardware::graphics::composer3 { class ComposerClientReader { public: + explicit ComposerClientReader(std::optional display = {}) : mDisplay(display) {} + ~ComposerClientReader() { resetData(); } + ComposerClientReader(ComposerClientReader&&) = default; + + ComposerClientReader(const ComposerClientReader&) = delete; + ComposerClientReader& operator=(const ComposerClientReader&) = delete; + // Parse and execute commands from the command queue. The commands are // actually return values from the server and will be saved in ReturnData. void parse(std::vector&& results) { @@ -85,6 +92,7 @@ class ComposerClientReader { void hasChanges(int64_t display, uint32_t* outNumChangedCompositionTypes, uint32_t* outNumLayerRequestMasks) const { + LOG_ALWAYS_FATAL_IF(mDisplay && display != *mDisplay); auto found = mReturnData.find(display); if (found == mReturnData.end()) { *outNumChangedCompositionTypes = 0; @@ -100,6 +108,7 @@ class ComposerClientReader { // Get and clear saved changed composition types. std::vector takeChangedCompositionTypes(int64_t display) { + LOG_ALWAYS_FATAL_IF(mDisplay && display != *mDisplay); auto found = mReturnData.find(display); if (found == mReturnData.end()) { return {}; @@ -111,6 +120,7 @@ class ComposerClientReader { // Get and clear saved display requests. DisplayRequest takeDisplayRequests(int64_t display) { + LOG_ALWAYS_FATAL_IF(mDisplay && display != *mDisplay); auto found = mReturnData.find(display); if (found == mReturnData.end()) { return {}; @@ -122,6 +132,7 @@ class ComposerClientReader { // Get and clear saved release fences. std::vector takeReleaseFences(int64_t display) { + LOG_ALWAYS_FATAL_IF(mDisplay && display != *mDisplay); auto found = mReturnData.find(display); if (found == mReturnData.end()) { return {}; @@ -133,6 +144,7 @@ class ComposerClientReader { // Get and clear saved present fence. ndk::ScopedFileDescriptor takePresentFence(int64_t display) { + LOG_ALWAYS_FATAL_IF(mDisplay && display != *mDisplay); auto found = mReturnData.find(display); if (found == mReturnData.end()) { return {}; @@ -144,6 +156,7 @@ class ComposerClientReader { // Get what stage succeeded during PresentOrValidate: Present or Validate std::optional takePresentOrValidateStage(int64_t display) { + LOG_ALWAYS_FATAL_IF(mDisplay && display != *mDisplay); auto found = mReturnData.find(display); if (found == mReturnData.end()) { return std::nullopt; @@ -154,6 +167,7 @@ class ComposerClientReader { // Get the client target properties requested by hardware composer. ClientTargetPropertyWithBrightness takeClientTargetProperty(int64_t display) { + LOG_ALWAYS_FATAL_IF(mDisplay && display != *mDisplay); auto found = mReturnData.find(display); // If not found, return the default values. @@ -177,32 +191,38 @@ class ComposerClientReader { void parseSetError(CommandError&& error) { mErrors.emplace_back(error); } void parseSetChangedCompositionTypes(ChangedCompositionTypes&& changedCompositionTypes) { + LOG_ALWAYS_FATAL_IF(mDisplay && changedCompositionTypes.display != *mDisplay); auto& data = mReturnData[changedCompositionTypes.display]; data.changedLayers = std::move(changedCompositionTypes.layers); } void parseSetDisplayRequests(DisplayRequest&& displayRequest) { + LOG_ALWAYS_FATAL_IF(mDisplay && displayRequest.display != *mDisplay); auto& data = mReturnData[displayRequest.display]; data.displayRequests = std::move(displayRequest); } void parseSetPresentFence(PresentFence&& presentFence) { + LOG_ALWAYS_FATAL_IF(mDisplay && presentFence.display != *mDisplay); auto& data = mReturnData[presentFence.display]; data.presentFence = std::move(presentFence.fence); } void parseSetReleaseFences(ReleaseFences&& releaseFences) { + LOG_ALWAYS_FATAL_IF(mDisplay && releaseFences.display != *mDisplay); auto& data = mReturnData[releaseFences.display]; data.releasedLayers = std::move(releaseFences.layers); } void parseSetPresentOrValidateDisplayResult(const PresentOrValidate&& presentOrValidate) { + LOG_ALWAYS_FATAL_IF(mDisplay && presentOrValidate.display != *mDisplay); auto& data = mReturnData[presentOrValidate.display]; data.presentOrValidateState = std::move(presentOrValidate.result); } void parseSetClientTargetProperty( const ClientTargetPropertyWithBrightness&& clientTargetProperty) { + LOG_ALWAYS_FATAL_IF(mDisplay && clientTargetProperty.display != *mDisplay); auto& data = mReturnData[clientTargetProperty.display]; data.clientTargetProperty = std::move(clientTargetProperty); } @@ -222,6 +242,7 @@ class ComposerClientReader { std::vector mErrors; std::unordered_map mReturnData; + const std::optional mDisplay; }; } // namespace aidl::android::hardware::graphics::composer3 diff --git a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h index 775ae9fa88..0c8742f887 100644 --- a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h +++ b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h @@ -19,8 +19,6 @@ #include #include #include -#include -#include #include #include @@ -63,10 +61,15 @@ class ComposerClientWriter final { public: static constexpr std::optional kNoTimestamp = std::nullopt; - ComposerClientWriter() { reset(); } + explicit ComposerClientWriter(int64_t display) : mDisplay(display) { reset(); } ~ComposerClientWriter() { reset(); } + ComposerClientWriter(ComposerClientWriter&&) = default; + + ComposerClientWriter(const ComposerClientWriter&) = delete; + ComposerClientWriter& operator=(const ComposerClientWriter&) = delete; + void reset() { mDisplayCommand.reset(); mLayerCommand.reset(); @@ -229,6 +232,7 @@ class ComposerClientWriter final { std::optional mDisplayCommand; std::optional mLayerCommand; std::vector mCommands; + const int64_t mDisplay; Buffer getBuffer(uint32_t slot, const native_handle_t* bufferHandle, int fence) { Buffer bufferCommand; @@ -254,6 +258,7 @@ class ComposerClientWriter final { DisplayCommand& getDisplayCommand(int64_t display) { if (!mDisplayCommand.has_value() || mDisplayCommand->display != display) { + LOG_ALWAYS_FATAL_IF(display != mDisplay); flushLayerCommand(); flushDisplayCommand(); mDisplayCommand.emplace(); diff --git a/graphics/composer/aidl/vts/VtsComposerClient.h b/graphics/composer/aidl/vts/VtsComposerClient.h index 6358b85e0c..18833365e0 100644 --- a/graphics/composer/aidl/vts/VtsComposerClient.h +++ b/graphics/composer/aidl/vts/VtsComposerClient.h @@ -35,6 +35,7 @@ #include #include #include +#include #include "GraphicsComposerCallback.h" using aidl::android::hardware::graphics::common::Dataspace; diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp index 46dde09dd4..6fa33927f0 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp @@ -53,6 +53,7 @@ class GraphicsCompositionTestBase : public ::testing::Test { const auto& [status, displays] = mComposerClient->getDisplays(); ASSERT_TRUE(status.isOk()); mDisplays = displays; + mWriter.reset(new ComposerClientWriter(getPrimaryDisplayId())); setTestColorModes(); @@ -200,15 +201,15 @@ class GraphicsCompositionTestBase : public ::testing::Test { void writeLayers(const std::vector>& layers) { for (const auto& layer : layers) { - layer->write(mWriter); + layer->write(*mWriter); } execute(); } void execute() { - const auto& commands = mWriter.getPendingCommands(); + const auto& commands = mWriter->getPendingCommands(); if (commands.empty()) { - mWriter.reset(); + mWriter->reset(); return; } @@ -216,7 +217,7 @@ class GraphicsCompositionTestBase : public ::testing::Test { ASSERT_TRUE(status.isOk()) << "executeCommands failed " << status.getDescription(); mReader.parse(std::move(results)); - mWriter.reset(); + mWriter->reset(); } bool getHasReadbackBuffer() { @@ -236,7 +237,7 @@ class GraphicsCompositionTestBase : public ::testing::Test { std::vector mDisplays; // use the slot count usually set by SF std::vector mTestColorModes; - ComposerClientWriter mWriter; + std::unique_ptr mWriter; ComposerClientReader mReader; std::unique_ptr mTestRenderEngine; common::PixelFormat mPixelFormat; @@ -297,7 +298,7 @@ TEST_P(GraphicsCompositionTest, SingleSolidColorLayer) { writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); // if hwc cannot handle and asks for composition change, // just succeed the test @@ -306,7 +307,7 @@ TEST_P(GraphicsCompositionTest, SingleSolidColorLayer) { return; } ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.presentDisplay(getPrimaryDisplayId()); + mWriter->presentDisplay(getPrimaryDisplayId()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -349,14 +350,14 @@ TEST_P(GraphicsCompositionTest, SetLayerBuffer) { getDisplayHeight(), common::PixelFormat::RGBA_8888); layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setZOrder(10); - layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter); + layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), *mWriter); ASSERT_NO_FATAL_FAILURE(layer->setBuffer(expectedColors)); std::vector> layers = {layer}; writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { @@ -365,7 +366,7 @@ TEST_P(GraphicsCompositionTest, SetLayerBuffer) { } ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.presentDisplay(getPrimaryDisplayId()); + mWriter->presentDisplay(getPrimaryDisplayId()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -395,7 +396,7 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { layer->setColor(BLUE); layer->setDisplayFrame(coloredSquare); layer->setZOrder(10); - layer->write(mWriter); + layer->write(*mWriter); // This following buffer call should have no effect const auto usage = static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | @@ -403,8 +404,8 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { const auto& [graphicBufferStatus, graphicBuffer] = allocateBuffer(usage); ASSERT_TRUE(graphicBufferStatus); const auto& buffer = graphicBuffer->handle; - mWriter.setLayerBuffer(getPrimaryDisplayId(), layer->getLayer(), /*slot*/ 0, buffer, - /*acquireFence*/ -1); + mWriter->setLayerBuffer(getPrimaryDisplayId(), layer->getLayer(), /*slot*/ 0, buffer, + /*acquireFence*/ -1); // expected color for each pixel std::vector expectedColors( @@ -415,7 +416,7 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { getDisplayHeight(), mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { @@ -423,7 +424,7 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { return; } ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.presentDisplay(getPrimaryDisplayId()); + mWriter->presentDisplay(getPrimaryDisplayId()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -533,7 +534,7 @@ TEST_P(GraphicsCompositionTest, ClientComposition) { getDisplayHeight(), PixelFormat::RGBA_FP16); layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setZOrder(10); - layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter); + layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), *mWriter); std::vector> layers = {layer}; @@ -542,7 +543,7 @@ TEST_P(GraphicsCompositionTest, ClientComposition) { ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); auto changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId()); @@ -572,17 +573,17 @@ TEST_P(GraphicsCompositionTest, ClientComposition) { int32_t clientFence; const auto unlockStatus = graphicBuffer->unlockAsync(&clientFence); ASSERT_EQ(::android::OK, unlockStatus); - mWriter.setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, buffer, clientFence, - clientDataspace, std::vector(1, damage)); - layer->setToClientComposition(mWriter); - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, buffer, clientFence, + clientDataspace, std::vector(1, damage)); + layer->setToClientComposition(*mWriter); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId()); ASSERT_TRUE(changedCompositionTypes.empty()); } ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.presentDisplay(getPrimaryDisplayId()); + mWriter->presentDisplay(getPrimaryDisplayId()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -631,9 +632,9 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { deviceLayer->setDisplayFrame({0, 0, static_cast(deviceLayer->getWidth()), static_cast(deviceLayer->getHeight())}); deviceLayer->setZOrder(10); - deviceLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter); + deviceLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), *mWriter); ASSERT_NO_FATAL_FAILURE(deviceLayer->setBuffer(deviceColors)); - deviceLayer->write(mWriter); + deviceLayer->write(*mWriter); PixelFormat clientFormat = PixelFormat::RGBA_8888; auto clientUsage = static_cast( @@ -651,8 +652,8 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { getDisplayHeight()}; clientLayer->setDisplayFrame(clientFrame); clientLayer->setZOrder(0); - clientLayer->write(mWriter); - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + clientLayer->write(*mWriter); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); auto changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId()); @@ -678,16 +679,16 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { int32_t clientFence; const auto unlockStatus = graphicBuffer->unlockAsync(&clientFence); ASSERT_EQ(::android::OK, unlockStatus); - mWriter.setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, buffer, clientFence, - clientDataspace, std::vector(1, clientFrame)); - clientLayer->setToClientComposition(mWriter); - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, buffer, clientFence, + clientDataspace, std::vector(1, clientFrame)); + clientLayer->setToClientComposition(*mWriter); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); changedCompositionTypes = mReader.takeChangedCompositionTypes(getPrimaryDisplayId()); ASSERT_TRUE(changedCompositionTypes.empty()); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.presentDisplay(getPrimaryDisplayId()); + mWriter->presentDisplay(getPrimaryDisplayId()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); @@ -718,7 +719,7 @@ TEST_P(GraphicsCompositionTest, SetLayerDamage) { getDisplayHeight(), PixelFormat::RGBA_8888); layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setZOrder(10); - layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter); + layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), *mWriter); ASSERT_NO_FATAL_FAILURE(layer->setBuffer(expectedColors)); std::vector> layers = {layer}; @@ -729,14 +730,14 @@ TEST_P(GraphicsCompositionTest, SetLayerDamage) { writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED(); return; } ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.presentDisplay(getPrimaryDisplayId()); + mWriter->presentDisplay(getPrimaryDisplayId()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -757,11 +758,11 @@ TEST_P(GraphicsCompositionTest, SetLayerDamage) { writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); ASSERT_TRUE(mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()); - mWriter.presentDisplay(getPrimaryDisplayId()); + mWriter->presentDisplay(getPrimaryDisplayId()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -798,7 +799,7 @@ TEST_P(GraphicsCompositionTest, SetLayerPlaneAlpha) { writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED(); @@ -806,7 +807,7 @@ TEST_P(GraphicsCompositionTest, SetLayerPlaneAlpha) { } ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.presentDisplay(getPrimaryDisplayId()); + mWriter->presentDisplay(getPrimaryDisplayId()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -846,7 +847,7 @@ TEST_P(GraphicsCompositionTest, SetLayerSourceCrop) { getDisplayHeight(), PixelFormat::RGBA_8888); layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setZOrder(10); - layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter); + layer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), *mWriter); layer->setSourceCrop({0, static_cast(getDisplayHeight() / 2), static_cast(getDisplayWidth()), static_cast(getDisplayHeight())}); @@ -862,14 +863,14 @@ TEST_P(GraphicsCompositionTest, SetLayerSourceCrop) { ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED(); return; } ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.presentDisplay(getPrimaryDisplayId()); + mWriter->presentDisplay(getPrimaryDisplayId()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); @@ -920,13 +921,13 @@ TEST_P(GraphicsCompositionTest, SetLayerZOrder) { writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED(); return; } - mWriter.presentDisplay(getPrimaryDisplayId()); + mWriter->presentDisplay(getPrimaryDisplayId()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -942,11 +943,11 @@ TEST_P(GraphicsCompositionTest, SetLayerZOrder) { writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); ASSERT_TRUE(mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.presentDisplay(getPrimaryDisplayId()); + mWriter->presentDisplay(getPrimaryDisplayId()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -980,7 +981,7 @@ TEST_P(GraphicsCompositionTest, SetLayerBrightnessDims) { // Preconditions to successfully run are knowing the max brightness and successfully applying // the max brightness ASSERT_GT(maxBrightnessNits, 0.f); - mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 1.f, maxBrightnessNits); + mWriter->setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 1.f, maxBrightnessNits); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -1030,7 +1031,7 @@ TEST_P(GraphicsCompositionTest, SetLayerBrightnessDims) { writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED() @@ -1038,7 +1039,7 @@ TEST_P(GraphicsCompositionTest, SetLayerBrightnessDims) { << toString(mode); continue; } - mWriter.presentDisplay(getPrimaryDisplayId()); + mWriter->presentDisplay(getPrimaryDisplayId()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -1088,7 +1089,7 @@ class GraphicsBlendModeCompositionTest getDisplayHeight(), PixelFormat::RGBA_8888); layer->setDisplayFrame({0, 0, getDisplayWidth(), getDisplayHeight()}); layer->setZOrder(10); - layer->setDataspace(Dataspace::UNKNOWN, mWriter); + layer->setDataspace(Dataspace::UNKNOWN, *mWriter); ASSERT_NO_FATAL_FAILURE(layer->setBuffer(topLayerPixelColors)); layer->setBlendMode(blendMode); @@ -1165,14 +1166,14 @@ TEST_P(GraphicsBlendModeCompositionTest, None) { ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(mLayers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED(); return; } ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.presentDisplay(getPrimaryDisplayId()); + mWriter->presentDisplay(getPrimaryDisplayId()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -1210,14 +1211,14 @@ TEST_P(GraphicsBlendModeCompositionTest, Coverage) { ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(mLayers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED(); return; } ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.presentDisplay(getPrimaryDisplayId()); + mWriter->presentDisplay(getPrimaryDisplayId()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); @@ -1250,14 +1251,14 @@ TEST_P(GraphicsBlendModeCompositionTest, Premultiplied) { ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(mLayers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED(); return; } ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.presentDisplay(getPrimaryDisplayId()); + mWriter->presentDisplay(getPrimaryDisplayId()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); @@ -1323,7 +1324,7 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_H) { getDisplayHeight(), mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); mLayer->setTransform(Transform::FLIP_H); - mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter); + mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), *mWriter); std::vector expectedColors( static_cast(getDisplayWidth() * getDisplayHeight())); @@ -1334,14 +1335,14 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_H) { writeLayers(mLayers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED(); return; } ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.presentDisplay(getPrimaryDisplayId()); + mWriter->presentDisplay(getPrimaryDisplayId()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -1369,7 +1370,7 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_V) { ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); mLayer->setTransform(Transform::FLIP_V); - mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter); + mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), *mWriter); std::vector expectedColors( static_cast(getDisplayWidth() * getDisplayHeight())); @@ -1380,14 +1381,14 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_V) { writeLayers(mLayers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED(); return; } ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.presentDisplay(getPrimaryDisplayId()); + mWriter->presentDisplay(getPrimaryDisplayId()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); @@ -1414,7 +1415,7 @@ TEST_P(GraphicsTransformCompositionTest, ROT_180) { ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); mLayer->setTransform(Transform::ROT_180); - mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter); + mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), *mWriter); std::vector expectedColors( static_cast(getDisplayWidth() * getDisplayHeight())); @@ -1426,14 +1427,14 @@ TEST_P(GraphicsTransformCompositionTest, ROT_180) { writeLayers(mLayers); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED(); return; } ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.presentDisplay(getPrimaryDisplayId()); + mWriter->presentDisplay(getPrimaryDisplayId()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); ASSERT_NO_FATAL_FAILURE(readbackBuffer.checkReadbackBuffer(expectedColors)); diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index ed8a06c188..fa66812d6e 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -33,9 +33,11 @@ #include #include #include +#include #include #include #include +#include #include "GraphicsComposerCallback.h" #include "VtsComposerClient.h" @@ -1078,17 +1080,23 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { } void execute() { - const auto& commands = mWriter.getPendingCommands(); - if (commands.empty()) { - mWriter.reset(); - return; + std::vector payloads; + for (auto& [_, writer] : mWriters) { + const auto& commands = writer.getPendingCommands(); + if (commands.empty()) { + writer.reset(); + continue; + } + + auto [status, results] = mComposerClient->executeCommands(commands); + ASSERT_TRUE(status.isOk()) << "executeCommands failed " << status.getDescription(); + writer.reset(); + + payloads.reserve(payloads.size() + results.size()); + payloads.insert(payloads.end(), std::make_move_iterator(results.begin()), + std::make_move_iterator(results.end())); } - - auto [status, results] = mComposerClient->executeCommands(commands); - ASSERT_TRUE(status.isOk()) << "executeCommands failed " << status.getDescription(); - - mReader.parse(std::move(results)); - mWriter.reset(); + mReader.parse(std::move(payloads)); } static inline auto toTimePoint(nsecs_t time) { @@ -1152,6 +1160,7 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { const auto& [status, layer] = mComposerClient->createLayer(display.getDisplayId(), kBufferSlotCount); EXPECT_TRUE(status.isOk()); + auto& writer = getWriter(display.getDisplayId()); { const auto buffer = allocate(::android::PIXEL_FORMAT_RGBA_8888); ASSERT_NE(nullptr, buffer); @@ -1160,15 +1169,15 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { configureLayer(display, layer, Composition::DEVICE, display.getFrameRect(), display.getCrop()); - mWriter.setLayerBuffer(display.getDisplayId(), layer, /*slot*/ 0, buffer->handle, - /*acquireFence*/ -1); - mWriter.setLayerDataspace(display.getDisplayId(), layer, common::Dataspace::UNKNOWN); + writer.setLayerBuffer(display.getDisplayId(), layer, /*slot*/ 0, buffer->handle, + /*acquireFence*/ -1); + writer.setLayerDataspace(display.getDisplayId(), layer, common::Dataspace::UNKNOWN); - mWriter.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp); + writer.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.presentDisplay(display.getDisplayId()); + writer.presentDisplay(display.getDisplayId()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); } @@ -1177,15 +1186,15 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { const auto buffer = allocate(::android::PIXEL_FORMAT_RGBA_8888); ASSERT_NE(nullptr, buffer->handle); - mWriter.setLayerBuffer(display.getDisplayId(), layer, /*slot*/ 0, buffer->handle, - /*acquireFence*/ -1); - mWriter.setLayerSurfaceDamage(display.getDisplayId(), layer, - std::vector(1, {0, 0, 10, 10})); - mWriter.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp); + writer.setLayerBuffer(display.getDisplayId(), layer, /*slot*/ 0, buffer->handle, + /*acquireFence*/ -1); + writer.setLayerSurfaceDamage(display.getDisplayId(), layer, + std::vector(1, {0, 0, 10, 10})); + writer.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.presentDisplay(display.getDisplayId()); + writer.presentDisplay(display.getDisplayId()); execute(); } @@ -1194,11 +1203,12 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { sp<::android::Fence> presentAndGetFence( std::optional expectedPresentTime) { - mWriter.validateDisplay(getPrimaryDisplayId(), expectedPresentTime); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.validateDisplay(getPrimaryDisplayId(), expectedPresentTime); execute(); EXPECT_TRUE(mReader.takeErrors().empty()); - mWriter.presentDisplay(getPrimaryDisplayId()); + writer.presentDisplay(getPrimaryDisplayId()); execute(); EXPECT_TRUE(mReader.takeErrors().empty()); @@ -1230,7 +1240,8 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { FRect cropRect{0, 0, (float)getPrimaryDisplay().getDisplayWidth(), (float)getPrimaryDisplay().getDisplayHeight()}; configureLayer(getPrimaryDisplay(), layer, Composition::DEVICE, displayFrame, cropRect); - mWriter.setLayerDataspace(getPrimaryDisplayId(), layer, common::Dataspace::UNKNOWN); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setLayerDataspace(getPrimaryDisplayId(), layer, common::Dataspace::UNKNOWN); return layer; } @@ -1330,8 +1341,9 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { ASSERT_NE(nullptr, buffer2); const auto layer = createOnScreenLayer(); - mWriter.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, buffer1->handle, - /*acquireFence*/ -1); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, buffer1->handle, + /*acquireFence*/ -1); const sp<::android::Fence> presentFence1 = presentAndGetFence(ComposerClientWriter::kNoTimestamp); presentFence1->waitForever(LOG_TAG); @@ -1341,8 +1353,8 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { expectedPresentTime += *framesDelay * vsyncPeriod; } - mWriter.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, buffer2->handle, - /*acquireFence*/ -1); + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, buffer2->handle, + /*acquireFence*/ -1); const auto setExpectedPresentTime = [&]() -> std::optional { if (!framesDelay.has_value()) { return ComposerClientWriter::kNoTimestamp; @@ -1363,17 +1375,18 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { void configureLayer(const VtsDisplay& display, int64_t layer, Composition composition, const Rect& displayFrame, const FRect& cropRect) { - mWriter.setLayerCompositionType(display.getDisplayId(), layer, composition); - mWriter.setLayerDisplayFrame(display.getDisplayId(), layer, displayFrame); - mWriter.setLayerPlaneAlpha(display.getDisplayId(), layer, /*alpha*/ 1); - mWriter.setLayerSourceCrop(display.getDisplayId(), layer, cropRect); - mWriter.setLayerTransform(display.getDisplayId(), layer, static_cast(0)); - mWriter.setLayerVisibleRegion(display.getDisplayId(), layer, - std::vector(1, displayFrame)); - mWriter.setLayerZOrder(display.getDisplayId(), layer, /*z*/ 10); - mWriter.setLayerBlendMode(display.getDisplayId(), layer, BlendMode::NONE); - mWriter.setLayerSurfaceDamage(display.getDisplayId(), layer, - std::vector(1, displayFrame)); + auto& writer = getWriter(display.getDisplayId()); + writer.setLayerCompositionType(display.getDisplayId(), layer, composition); + writer.setLayerDisplayFrame(display.getDisplayId(), layer, displayFrame); + writer.setLayerPlaneAlpha(display.getDisplayId(), layer, /*alpha*/ 1); + writer.setLayerSourceCrop(display.getDisplayId(), layer, cropRect); + writer.setLayerTransform(display.getDisplayId(), layer, static_cast(0)); + writer.setLayerVisibleRegion(display.getDisplayId(), layer, + std::vector(1, displayFrame)); + writer.setLayerZOrder(display.getDisplayId(), layer, /*z*/ 10); + writer.setLayerBlendMode(display.getDisplayId(), layer, BlendMode::NONE); + writer.setLayerSurfaceDamage(display.getDisplayId(), layer, + std::vector(1, displayFrame)); } // clang-format off const std::array kIdentity = {{ @@ -1384,12 +1397,20 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { }}; // clang-format on - ComposerClientWriter mWriter; + ComposerClientWriter& getWriter(int64_t display) { + auto [it, _] = mWriters.try_emplace(display, display); + return it->second; + } + ComposerClientReader mReader; + + private: + std::unordered_map mWriters; }; TEST_P(GraphicsComposerAidlCommandTest, SetColorTransform) { - mWriter.setColorTransform(getPrimaryDisplayId(), kIdentity.data()); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setColorTransform(getPrimaryDisplayId(), kIdentity.data()); execute(); } @@ -1397,7 +1418,8 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerColorTransform) { const auto& [status, layer] = mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); EXPECT_TRUE(status.isOk()); - mWriter.setLayerColorTransform(getPrimaryDisplayId(), layer, kIdentity.data()); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setLayerColorTransform(getPrimaryDisplayId(), layer, kIdentity.data()); execute(); const auto errors = mReader.takeErrors(); @@ -1413,8 +1435,9 @@ TEST_P(GraphicsComposerAidlCommandTest, SetDisplayBrightness) { ASSERT_TRUE(status.isOk()); bool brightnessSupport = std::find(capabilities.begin(), capabilities.end(), DisplayCapability::BRIGHTNESS) != capabilities.end(); + auto& writer = getWriter(getPrimaryDisplayId()); if (!brightnessSupport) { - mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 0.5f, -1.f); + writer.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 0.5f, -1.f); execute(); const auto errors = mReader.takeErrors(); EXPECT_EQ(1, errors.size()); @@ -1423,23 +1446,23 @@ TEST_P(GraphicsComposerAidlCommandTest, SetDisplayBrightness) { return; } - mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 0.0f, -1.f); + writer.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 0.0f, -1.f); execute(); EXPECT_TRUE(mReader.takeErrors().empty()); - mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 0.5f, -1.f); + writer.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 0.5f, -1.f); execute(); EXPECT_TRUE(mReader.takeErrors().empty()); - mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 1.0f, -1.f); + writer.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 1.0f, -1.f); execute(); EXPECT_TRUE(mReader.takeErrors().empty()); - mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ -1.0f, -1.f); + writer.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ -1.0f, -1.f); execute(); EXPECT_TRUE(mReader.takeErrors().empty()); - mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 2.0f, -1.f); + writer.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ 2.0f, -1.f); execute(); { const auto errors = mReader.takeErrors(); @@ -1447,7 +1470,7 @@ TEST_P(GraphicsComposerAidlCommandTest, SetDisplayBrightness) { EXPECT_EQ(IComposerClient::EX_BAD_PARAMETER, errors[0].errorCode); } - mWriter.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ -2.0f, -1.f); + writer.setDisplayBrightness(getPrimaryDisplayId(), /*brightness*/ -2.0f, -1.f); execute(); { const auto errors = mReader.takeErrors(); @@ -1460,8 +1483,9 @@ TEST_P(GraphicsComposerAidlCommandTest, SetClientTarget) { EXPECT_TRUE(mComposerClient->setClientTargetSlotCount(getPrimaryDisplayId(), kBufferSlotCount) .isOk()); - mWriter.setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, nullptr, /*acquireFence*/ -1, - Dataspace::UNKNOWN, std::vector()); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setClientTarget(getPrimaryDisplayId(), /*slot*/ 0, nullptr, /*acquireFence*/ -1, + Dataspace::UNKNOWN, std::vector()); execute(); } @@ -1481,24 +1505,28 @@ TEST_P(GraphicsComposerAidlCommandTest, SetOutputBuffer) { const auto buffer = allocate(::android::PIXEL_FORMAT_RGBA_8888); const auto handle = buffer->handle; - mWriter.setOutputBuffer(display.display, /*slot*/ 0, handle, /*releaseFence*/ -1); + auto& writer = getWriter(display.display); + writer.setOutputBuffer(display.display, /*slot*/ 0, handle, /*releaseFence*/ -1); execute(); } TEST_P(GraphicsComposerAidlCommandTest, ValidDisplay) { - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); } TEST_P(GraphicsComposerAidlCommandTest, AcceptDisplayChanges) { - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); - mWriter.acceptDisplayChanges(getPrimaryDisplayId()); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + writer.acceptDisplayChanges(getPrimaryDisplayId()); execute(); } TEST_P(GraphicsComposerAidlCommandTest, PresentDisplay) { - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); - mWriter.presentDisplay(getPrimaryDisplayId()); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + writer.presentDisplay(getPrimaryDisplayId()); execute(); } @@ -1519,6 +1547,7 @@ TEST_P(GraphicsComposerAidlCommandTest, PresentDisplayNoLayerStateChanges) { const auto& [renderIntentsStatus, renderIntents] = mComposerClient->getRenderIntents(getPrimaryDisplayId(), ColorMode::NATIVE); EXPECT_TRUE(renderIntentsStatus.isOk()); + auto& writer = getWriter(getPrimaryDisplayId()); for (auto intent : renderIntents) { EXPECT_TRUE(mComposerClient->setColorMode(getPrimaryDisplayId(), ColorMode::NATIVE, intent) .isOk()); @@ -1536,10 +1565,10 @@ TEST_P(GraphicsComposerAidlCommandTest, PresentDisplayNoLayerStateChanges) { FRect cropRect{0, 0, (float)getPrimaryDisplay().getDisplayWidth(), (float)getPrimaryDisplay().getDisplayHeight()}; configureLayer(getPrimaryDisplay(), layer, Composition::CURSOR, displayFrame, cropRect); - mWriter.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle, - /*acquireFence*/ -1); - mWriter.setLayerDataspace(getPrimaryDisplayId(), layer, Dataspace::UNKNOWN); - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle, + /*acquireFence*/ -1); + writer.setLayerDataspace(getPrimaryDisplayId(), layer, Dataspace::UNKNOWN); + writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); if (!mReader.takeChangedCompositionTypes(getPrimaryDisplayId()).empty()) { GTEST_SUCCEED() << "Composition change requested, skipping test"; @@ -1547,18 +1576,18 @@ TEST_P(GraphicsComposerAidlCommandTest, PresentDisplayNoLayerStateChanges) { } ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.presentDisplay(getPrimaryDisplayId()); + writer.presentDisplay(getPrimaryDisplayId()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); const auto buffer2 = allocate(::android::PIXEL_FORMAT_RGBA_8888); const auto handle2 = buffer2->handle; ASSERT_NE(nullptr, handle2); - mWriter.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle2, - /*acquireFence*/ -1); - mWriter.setLayerSurfaceDamage(getPrimaryDisplayId(), layer, - std::vector(1, {0, 0, 10, 10})); - mWriter.presentDisplay(getPrimaryDisplayId()); + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle2, + /*acquireFence*/ -1); + writer.setLayerSurfaceDamage(getPrimaryDisplayId(), layer, + std::vector(1, {0, 0, 10, 10})); + writer.presentDisplay(getPrimaryDisplayId()); execute(); } } @@ -1572,15 +1601,16 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerCursorPosition) { const auto handle = buffer->handle; ASSERT_NE(nullptr, handle); - mWriter.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle, /*acquireFence*/ -1); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle, /*acquireFence*/ -1); Rect displayFrame{0, 0, getPrimaryDisplay().getDisplayWidth(), getPrimaryDisplay().getDisplayHeight()}; FRect cropRect{0, 0, (float)getPrimaryDisplay().getDisplayWidth(), (float)getPrimaryDisplay().getDisplayHeight()}; configureLayer(getPrimaryDisplay(), layer, Composition::CURSOR, displayFrame, cropRect); - mWriter.setLayerDataspace(getPrimaryDisplayId(), layer, Dataspace::UNKNOWN); - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + writer.setLayerDataspace(getPrimaryDisplayId(), layer, Dataspace::UNKNOWN); + writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); @@ -1588,15 +1618,15 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerCursorPosition) { GTEST_SUCCEED() << "Composition change requested, skipping test"; return; } - mWriter.presentDisplay(getPrimaryDisplayId()); + writer.presentDisplay(getPrimaryDisplayId()); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerCursorPosition(getPrimaryDisplayId(), layer, /*x*/ 1, /*y*/ 1); + writer.setLayerCursorPosition(getPrimaryDisplayId(), layer, /*x*/ 1, /*y*/ 1); execute(); - mWriter.setLayerCursorPosition(getPrimaryDisplayId(), layer, /*x*/ 0, /*y*/ 0); - mWriter.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); - mWriter.presentDisplay(getPrimaryDisplayId()); + writer.setLayerCursorPosition(getPrimaryDisplayId(), layer, /*x*/ 0, /*y*/ 0); + writer.validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); + writer.presentDisplay(getPrimaryDisplayId()); execute(); } @@ -1608,7 +1638,8 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerBuffer) { const auto& [layerStatus, layer] = mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); EXPECT_TRUE(layerStatus.isOk()); - mWriter.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle, /*acquireFence*/ -1); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle, /*acquireFence*/ -1); execute(); } @@ -1620,15 +1651,16 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerSurfaceDamage) { Rect empty{0, 0, 0, 0}; Rect unit{0, 0, 1, 1}; - mWriter.setLayerSurfaceDamage(getPrimaryDisplayId(), layer, std::vector(1, empty)); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setLayerSurfaceDamage(getPrimaryDisplayId(), layer, std::vector(1, empty)); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerSurfaceDamage(getPrimaryDisplayId(), layer, std::vector(1, unit)); + writer.setLayerSurfaceDamage(getPrimaryDisplayId(), layer, std::vector(1, unit)); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerSurfaceDamage(getPrimaryDisplayId(), layer, std::vector()); + writer.setLayerSurfaceDamage(getPrimaryDisplayId(), layer, std::vector()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); } @@ -1641,15 +1673,16 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerBlockingRegion) { Rect empty{0, 0, 0, 0}; Rect unit{0, 0, 1, 1}; - mWriter.setLayerBlockingRegion(getPrimaryDisplayId(), layer, std::vector(1, empty)); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setLayerBlockingRegion(getPrimaryDisplayId(), layer, std::vector(1, empty)); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerBlockingRegion(getPrimaryDisplayId(), layer, std::vector(1, unit)); + writer.setLayerBlockingRegion(getPrimaryDisplayId(), layer, std::vector(1, unit)); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerBlockingRegion(getPrimaryDisplayId(), layer, std::vector()); + writer.setLayerBlockingRegion(getPrimaryDisplayId(), layer, std::vector()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); } @@ -1659,15 +1692,16 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerBlendMode) { mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); EXPECT_TRUE(layerStatus.isOk()); - mWriter.setLayerBlendMode(getPrimaryDisplayId(), layer, BlendMode::NONE); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setLayerBlendMode(getPrimaryDisplayId(), layer, BlendMode::NONE); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerBlendMode(getPrimaryDisplayId(), layer, BlendMode::PREMULTIPLIED); + writer.setLayerBlendMode(getPrimaryDisplayId(), layer, BlendMode::PREMULTIPLIED); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerBlendMode(getPrimaryDisplayId(), layer, BlendMode::COVERAGE); + writer.setLayerBlendMode(getPrimaryDisplayId(), layer, BlendMode::COVERAGE); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); } @@ -1677,11 +1711,12 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerColor) { mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); EXPECT_TRUE(layerStatus.isOk()); - mWriter.setLayerColor(getPrimaryDisplayId(), layer, Color{1.0f, 1.0f, 1.0f, 1.0f}); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setLayerColor(getPrimaryDisplayId(), layer, Color{1.0f, 1.0f, 1.0f, 1.0f}); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerColor(getPrimaryDisplayId(), layer, Color{0.0f, 0.0f, 0.0f, 0.0f}); + writer.setLayerColor(getPrimaryDisplayId(), layer, Color{0.0f, 0.0f, 0.0f, 0.0f}); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); } @@ -1691,19 +1726,20 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerCompositionType) { mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); EXPECT_TRUE(layerStatus.isOk()); - mWriter.setLayerCompositionType(getPrimaryDisplayId(), layer, Composition::CLIENT); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setLayerCompositionType(getPrimaryDisplayId(), layer, Composition::CLIENT); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerCompositionType(getPrimaryDisplayId(), layer, Composition::DEVICE); + writer.setLayerCompositionType(getPrimaryDisplayId(), layer, Composition::DEVICE); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerCompositionType(getPrimaryDisplayId(), layer, Composition::SOLID_COLOR); + writer.setLayerCompositionType(getPrimaryDisplayId(), layer, Composition::SOLID_COLOR); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerCompositionType(getPrimaryDisplayId(), layer, Composition::CURSOR); + writer.setLayerCompositionType(getPrimaryDisplayId(), layer, Composition::CURSOR); execute(); } @@ -1734,9 +1770,10 @@ TEST_P(GraphicsComposerAidlCommandTest, DisplayDecoration) { configureLayer(display, layer, Composition::DISPLAY_DECORATION, display.getFrameRect(), display.getCrop()); - mWriter.setLayerBuffer(display.getDisplayId(), layer, /*slot*/ 0, decorBuffer->handle, - /*acquireFence*/ -1); - mWriter.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp); + auto& writer = getWriter(display.getDisplayId()); + writer.setLayerBuffer(display.getDisplayId(), layer, /*slot*/ 0, decorBuffer->handle, + /*acquireFence*/ -1); + writer.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp); execute(); if (support) { ASSERT_TRUE(mReader.takeErrors().empty()); @@ -1753,7 +1790,8 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerDataspace) { mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); EXPECT_TRUE(layerStatus.isOk()); - mWriter.setLayerDataspace(getPrimaryDisplayId(), layer, Dataspace::UNKNOWN); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setLayerDataspace(getPrimaryDisplayId(), layer, Dataspace::UNKNOWN); execute(); } @@ -1762,7 +1800,8 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerDisplayFrame) { mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); EXPECT_TRUE(layerStatus.isOk()); - mWriter.setLayerDisplayFrame(getPrimaryDisplayId(), layer, Rect{0, 0, 1, 1}); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setLayerDisplayFrame(getPrimaryDisplayId(), layer, Rect{0, 0, 1, 1}); execute(); } @@ -1771,11 +1810,12 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerPlaneAlpha) { mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); EXPECT_TRUE(layerStatus.isOk()); - mWriter.setLayerPlaneAlpha(getPrimaryDisplayId(), layer, /*alpha*/ 0.0f); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setLayerPlaneAlpha(getPrimaryDisplayId(), layer, /*alpha*/ 0.0f); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerPlaneAlpha(getPrimaryDisplayId(), layer, /*alpha*/ 1.0f); + writer.setLayerPlaneAlpha(getPrimaryDisplayId(), layer, /*alpha*/ 1.0f); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); } @@ -1794,7 +1834,8 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerSidebandStream) { mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); EXPECT_TRUE(layerStatus.isOk()); - mWriter.setLayerSidebandStream(getPrimaryDisplayId(), layer, handle); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setLayerSidebandStream(getPrimaryDisplayId(), layer, handle); execute(); } @@ -1803,7 +1844,8 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerSourceCrop) { mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); EXPECT_TRUE(layerStatus.isOk()); - mWriter.setLayerSourceCrop(getPrimaryDisplayId(), layer, FRect{0.0f, 0.0f, 1.0f, 1.0f}); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setLayerSourceCrop(getPrimaryDisplayId(), layer, FRect{0.0f, 0.0f, 1.0f, 1.0f}); execute(); } @@ -1812,39 +1854,40 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerTransform) { mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); EXPECT_TRUE(layerStatus.isOk()); - mWriter.setLayerTransform(getPrimaryDisplayId(), layer, static_cast(0)); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setLayerTransform(getPrimaryDisplayId(), layer, static_cast(0)); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerTransform(getPrimaryDisplayId(), layer, Transform::FLIP_H); + writer.setLayerTransform(getPrimaryDisplayId(), layer, Transform::FLIP_H); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerTransform(getPrimaryDisplayId(), layer, Transform::FLIP_V); + writer.setLayerTransform(getPrimaryDisplayId(), layer, Transform::FLIP_V); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerTransform(getPrimaryDisplayId(), layer, Transform::ROT_90); + writer.setLayerTransform(getPrimaryDisplayId(), layer, Transform::ROT_90); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerTransform(getPrimaryDisplayId(), layer, Transform::ROT_180); + writer.setLayerTransform(getPrimaryDisplayId(), layer, Transform::ROT_180); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerTransform(getPrimaryDisplayId(), layer, Transform::ROT_270); + writer.setLayerTransform(getPrimaryDisplayId(), layer, Transform::ROT_270); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerTransform(getPrimaryDisplayId(), layer, - static_cast(static_cast(Transform::FLIP_H) | - static_cast(Transform::ROT_90))); + writer.setLayerTransform(getPrimaryDisplayId(), layer, + static_cast(static_cast(Transform::FLIP_H) | + static_cast(Transform::ROT_90))); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerTransform(getPrimaryDisplayId(), layer, - static_cast(static_cast(Transform::FLIP_V) | - static_cast(Transform::ROT_90))); + writer.setLayerTransform(getPrimaryDisplayId(), layer, + static_cast(static_cast(Transform::FLIP_V) | + static_cast(Transform::ROT_90))); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); } @@ -1857,15 +1900,16 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerVisibleRegion) { Rect empty{0, 0, 0, 0}; Rect unit{0, 0, 1, 1}; - mWriter.setLayerVisibleRegion(getPrimaryDisplayId(), layer, std::vector(1, empty)); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setLayerVisibleRegion(getPrimaryDisplayId(), layer, std::vector(1, empty)); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerVisibleRegion(getPrimaryDisplayId(), layer, std::vector(1, unit)); + writer.setLayerVisibleRegion(getPrimaryDisplayId(), layer, std::vector(1, unit)); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerVisibleRegion(getPrimaryDisplayId(), layer, std::vector()); + writer.setLayerVisibleRegion(getPrimaryDisplayId(), layer, std::vector()); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); } @@ -1875,11 +1919,12 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerZOrder) { mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); EXPECT_TRUE(layerStatus.isOk()); - mWriter.setLayerZOrder(getPrimaryDisplayId(), layer, /*z*/ 10); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setLayerZOrder(getPrimaryDisplayId(), layer, /*z*/ 10); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerZOrder(getPrimaryDisplayId(), layer, /*z*/ 0); + writer.setLayerZOrder(getPrimaryDisplayId(), layer, /*z*/ 0); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); } @@ -1901,6 +1946,7 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerPerFrameMetadata) { * white (D65) 0.3127 0.3290 */ + auto& writer = getWriter(getPrimaryDisplayId()); std::vector aidlMetadata; aidlMetadata.push_back({PerFrameMetadataKey::DISPLAY_RED_PRIMARY_X, 0.680f}); aidlMetadata.push_back({PerFrameMetadataKey::DISPLAY_RED_PRIMARY_Y, 0.320f}); @@ -1914,7 +1960,7 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerPerFrameMetadata) { aidlMetadata.push_back({PerFrameMetadataKey::MIN_LUMINANCE, 0.1f}); aidlMetadata.push_back({PerFrameMetadataKey::MAX_CONTENT_LIGHT_LEVEL, 78.0}); aidlMetadata.push_back({PerFrameMetadataKey::MAX_FRAME_AVERAGE_LIGHT_LEVEL, 62.0}); - mWriter.setLayerPerFrameMetadata(getPrimaryDisplayId(), layer, aidlMetadata); + writer.setLayerPerFrameMetadata(getPrimaryDisplayId(), layer, aidlMetadata); execute(); const auto errors = mReader.takeErrors(); @@ -1931,19 +1977,20 @@ TEST_P(GraphicsComposerAidlCommandTest, setLayerBrightness) { const auto& [layerStatus, layer] = mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); - mWriter.setLayerBrightness(getPrimaryDisplayId(), layer, 0.2f); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setLayerBrightness(getPrimaryDisplayId(), layer, 0.2f); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerBrightness(getPrimaryDisplayId(), layer, 1.f); + writer.setLayerBrightness(getPrimaryDisplayId(), layer, 1.f); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerBrightness(getPrimaryDisplayId(), layer, 0.f); + writer.setLayerBrightness(getPrimaryDisplayId(), layer, 0.f); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter.setLayerBrightness(getPrimaryDisplayId(), layer, -1.f); + writer.setLayerBrightness(getPrimaryDisplayId(), layer, -1.f); execute(); { const auto errors = mReader.takeErrors(); @@ -1951,7 +1998,7 @@ TEST_P(GraphicsComposerAidlCommandTest, setLayerBrightness) { EXPECT_EQ(IComposerClient::EX_BAD_PARAMETER, errors[0].errorCode); } - mWriter.setLayerBrightness(getPrimaryDisplayId(), layer, std::nanf("")); + writer.setLayerBrightness(getPrimaryDisplayId(), layer, std::nanf("")); execute(); { const auto errors = mReader.takeErrors(); @@ -2116,8 +2163,9 @@ TEST_P(GraphicsComposerAidlCommandTest, SetIdleTimerEnabled_Timeout_2) { ASSERT_NE(nullptr, buffer->handle); const auto layer = createOnScreenLayer(); - mWriter.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, buffer->handle, - /*acquireFence*/ -1); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, buffer->handle, + /*acquireFence*/ -1); int32_t vsyncIdleCount = mComposerClient->getVsyncIdleCount(); auto earlyVsyncIdleTime = systemTime() + std::chrono::nanoseconds(2s).count(); EXPECT_TRUE( From ca73d57c8379a82212a2fc91585c9f13b9b44a9b Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Tue, 1 Nov 2022 23:59:37 +0000 Subject: [PATCH 337/998] Split rkp from keymint. What this is missing is updating dependencies + splitting the VTS test. Bug: 254112961 Test: N/A Change-Id: I4b2498dd19206a5a24f46a1d5556e805e399fd82 --- .../android.hardware.security.keymint/1/.hash | 1 + .../android.hardware.security.keymint/2/.hash | 1 + security/rkp/aidl/Android.bp | 37 +++++++++++++++++++ .../android.hardware.security.rkp/1/.hash | 1 + .../hardware/security/keymint/DeviceInfo.aidl | 0 .../IRemotelyProvisionedComponent.aidl | 0 .../security/keymint/MacedPublicKey.aidl | 0 .../security/keymint/ProtectedData.aidl | 0 .../security/keymint/RpcHardwareInfo.aidl | 0 .../android.hardware.security.rkp/2/.hash | 1 + .../hardware/security/keymint/DeviceInfo.aidl | 0 .../IRemotelyProvisionedComponent.aidl | 0 .../security/keymint/MacedPublicKey.aidl | 0 .../security/keymint/ProtectedData.aidl | 0 .../security/keymint/RpcHardwareInfo.aidl | 0 .../hardware/security/keymint/DeviceInfo.aidl | 0 .../IRemotelyProvisionedComponent.aidl | 0 .../security/keymint/MacedPublicKey.aidl | 0 .../security/keymint/ProtectedData.aidl | 0 .../security/keymint/RpcHardwareInfo.aidl | 0 .../hardware/security/keymint/DeviceInfo.aidl | 0 .../IRemotelyProvisionedComponent.aidl | 0 .../security/keymint/MacedPublicKey.aidl | 0 .../security/keymint/ProtectedData.aidl | 0 .../security/keymint/RpcHardwareInfo.aidl | 0 25 files changed, 41 insertions(+) create mode 100644 security/rkp/aidl/Android.bp create mode 100644 security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/.hash rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/1/android/hardware/security/keymint/DeviceInfo.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/1/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/1/android/hardware/security/keymint/MacedPublicKey.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/1/android/hardware/security/keymint/ProtectedData.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/1/android/hardware/security/keymint/RpcHardwareInfo.aidl (100%) create mode 100644 security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/.hash rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/2/android/hardware/security/keymint/DeviceInfo.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/2/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/2/android/hardware/security/keymint/MacedPublicKey.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/2/android/hardware/security/keymint/ProtectedData.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/2/android/hardware/security/keymint/RpcHardwareInfo.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/current/android/hardware/security/keymint/DeviceInfo.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/current/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/current/android/hardware/security/keymint/MacedPublicKey.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/current/android/hardware/security/keymint/ProtectedData.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/current/android/hardware/security/keymint/RpcHardwareInfo.aidl (100%) rename security/{keymint => rkp}/aidl/android/hardware/security/keymint/DeviceInfo.aidl (100%) rename security/{keymint => rkp}/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl (100%) rename security/{keymint => rkp}/aidl/android/hardware/security/keymint/MacedPublicKey.aidl (100%) rename security/{keymint => rkp}/aidl/android/hardware/security/keymint/ProtectedData.aidl (100%) rename security/{keymint => rkp}/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl (100%) diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/.hash b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/.hash index b712a5231b..3a6d4157d1 100644 --- a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/.hash +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/.hash @@ -1 +1,2 @@ 976674616001f714f4a4df49ee45f548de828524 +cd862ae2e49b54fc965dc1b99c218eb729c93bb1 diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/.hash b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/.hash index 69ba9a6bc5..b4c2b78a70 100644 --- a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/.hash +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/.hash @@ -1 +1,2 @@ 207c9f218b9b9e4e74ff5232eb16511eca9d7d2e +70c734fbd5cac5b36676d66d8d9aa941967e1e7b diff --git a/security/rkp/aidl/Android.bp b/security/rkp/aidl/Android.bp new file mode 100644 index 0000000000..4c479f4642 --- /dev/null +++ b/security/rkp/aidl/Android.bp @@ -0,0 +1,37 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +aidl_interface { + name: "android.hardware.security.rkp", + vendor_available: true, + srcs: [ + // This HAL was originally part of keymint. + "android/hardware/security/keymint/*.aidl", + + // in the future + // "android/hardware/security/rkp/*.aidl", + ], + stability: "vintf", + backend: { + java: { + min_sdk_version: "33", + }, + rust: { + enabled: true, + }, + }, + versions_with_info: [ + { + version: "1", + }, + { + version: "2", + }, + ], +} diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/.hash b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/.hash new file mode 100644 index 0000000000..404553bf36 --- /dev/null +++ b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/.hash @@ -0,0 +1 @@ +d285480d2e0002adc0ace80edf34aa725679512e diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/DeviceInfo.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/DeviceInfo.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/DeviceInfo.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/DeviceInfo.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/MacedPublicKey.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/MacedPublicKey.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/MacedPublicKey.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/MacedPublicKey.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/ProtectedData.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/ProtectedData.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/ProtectedData.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/ProtectedData.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/RpcHardwareInfo.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/RpcHardwareInfo.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/RpcHardwareInfo.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/RpcHardwareInfo.aidl diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/.hash b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/.hash new file mode 100644 index 0000000000..8700d33656 --- /dev/null +++ b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/.hash @@ -0,0 +1 @@ +c8d34e56ae0807b61f028019622d8b60a37e0a8b diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/DeviceInfo.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/DeviceInfo.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/DeviceInfo.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/DeviceInfo.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/MacedPublicKey.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/MacedPublicKey.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/MacedPublicKey.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/MacedPublicKey.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/ProtectedData.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/ProtectedData.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/ProtectedData.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/ProtectedData.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/RpcHardwareInfo.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/RpcHardwareInfo.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/RpcHardwareInfo.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/RpcHardwareInfo.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/DeviceInfo.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/DeviceInfo.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/DeviceInfo.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/DeviceInfo.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/MacedPublicKey.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/MacedPublicKey.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/MacedPublicKey.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/MacedPublicKey.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/ProtectedData.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/ProtectedData.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/ProtectedData.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/ProtectedData.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/RpcHardwareInfo.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/RpcHardwareInfo.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/RpcHardwareInfo.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/RpcHardwareInfo.aidl diff --git a/security/keymint/aidl/android/hardware/security/keymint/DeviceInfo.aidl b/security/rkp/aidl/android/hardware/security/keymint/DeviceInfo.aidl similarity index 100% rename from security/keymint/aidl/android/hardware/security/keymint/DeviceInfo.aidl rename to security/rkp/aidl/android/hardware/security/keymint/DeviceInfo.aidl diff --git a/security/keymint/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl b/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl similarity index 100% rename from security/keymint/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl rename to security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl diff --git a/security/keymint/aidl/android/hardware/security/keymint/MacedPublicKey.aidl b/security/rkp/aidl/android/hardware/security/keymint/MacedPublicKey.aidl similarity index 100% rename from security/keymint/aidl/android/hardware/security/keymint/MacedPublicKey.aidl rename to security/rkp/aidl/android/hardware/security/keymint/MacedPublicKey.aidl diff --git a/security/keymint/aidl/android/hardware/security/keymint/ProtectedData.aidl b/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl similarity index 100% rename from security/keymint/aidl/android/hardware/security/keymint/ProtectedData.aidl rename to security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl diff --git a/security/keymint/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl b/security/rkp/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl similarity index 100% rename from security/keymint/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl rename to security/rkp/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl From 49e8287a4543e9c414af0aa2e91a11de3e6c6f65 Mon Sep 17 00:00:00 2001 From: Seth Moore Date: Wed, 2 Nov 2022 11:01:20 -0700 Subject: [PATCH 338/998] Update README and CHANGELOG for RKP Now that the HAL build has been split, move the markdown. Add some notes about the split in CHANGELOG Bug: 254112961 Test: N/A Change-Id: I5d24f47ce4ac1fcdeda28827bebe6d5f2ddfd249 --- security/keymint/README.md | 10 ++++++++++ .../RKP_CHANGELOG.md => rkp/CHANGELOG.md} | 6 ++++++ .../{keymint/RKP_README.md => rkp/README.md} | 16 ++++++++-------- 3 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 security/keymint/README.md rename security/{keymint/RKP_CHANGELOG.md => rkp/CHANGELOG.md} (79%) rename security/{keymint/RKP_README.md => rkp/README.md} (95%) diff --git a/security/keymint/README.md b/security/keymint/README.md new file mode 100644 index 0000000000..54647af659 --- /dev/null +++ b/security/keymint/README.md @@ -0,0 +1,10 @@ +# KeyMint HAL + +This directory contains the HAL definition for KeyMint. KeyMint provides +cryptographic services in a hardware-isolated environment. + +Note that the `IRemotelyProvisionedComponent` HAL, and it's associated types, +used to also be defined in this directory. As of Android U, this HAL has been +moved to a different directory (../rkp). This move is ABI compatible, as the +interfaces have been maintained. The build is split so that the generated +code may be built with different options. diff --git a/security/keymint/RKP_CHANGELOG.md b/security/rkp/CHANGELOG.md similarity index 79% rename from security/keymint/RKP_CHANGELOG.md rename to security/rkp/CHANGELOG.md index 243fc26525..eb2041d146 100644 --- a/security/keymint/RKP_CHANGELOG.md +++ b/security/rkp/CHANGELOG.md @@ -19,6 +19,12 @@ This document provides an exact description of which changes have occurred in th * `uniqueId` String added as a field in order to differentiate IRPC instances on device. ## IRemotelyProvisionedComponent 2 -> 3 +* The RKP HAL now builds separately from KeyMint. + * The HAL remains under the `android.hardware.security.keymint` package for + compatibility with previous releases. ABI compatibility requires this. + * Dependencies on the RKP HAL must add a dependency on + `"android.hardware.security.rkp"` generated code (instead of + `"android.hardward.security.keymint"`). * ProtectedData has been removed. * DeviceInfo * `version` has moved to a top-level field within the CSR generated by the HAL diff --git a/security/keymint/RKP_README.md b/security/rkp/README.md similarity index 95% rename from security/keymint/RKP_README.md rename to security/rkp/README.md index 89a2598f66..5fb49486ce 100644 --- a/security/keymint/RKP_README.md +++ b/security/rkp/README.md @@ -6,8 +6,8 @@ Design a HAL to support over-the-air provisioning of certificates for asymmetric keys. The HAL must interact effectively with Keystore (and other daemons) and protect device privacy and security. -Note that this API is designed for KeyMint, but with the intention that it -should be usable for other HALs that require certificate provisioning. +Note that this API was originally designed for KeyMint, with the intention that +it should be usable for other HALs that require certificate provisioning. Throughout this document we'll refer to the Keystore and KeyMint (formerly called Keymaster) components, but only for concreteness and convenience; those labels could be replaced with the names of any system and secure area @@ -312,7 +312,7 @@ the range \[-70000, -70999\] (these are reserved for future additions here). ``` Please see -[ProtectedData.aidl](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/keymint/aidl/android/hardware/security/keymint/ProtectedData.aidl) +[ProtectedData.aidl](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl) for a full CDDL definition of the BCC. ### `CertificateRequest` @@ -366,9 +366,9 @@ Please see the related HAL documentation directly in the source code at the following links: * [IRemotelyProvisionedComponent - HAL](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/keymint/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl) -* [ProtectedData](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/keymint/aidl/android/hardware/security/keymint/ProtectedData.aidl) -* [MacedPublicKey](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/keymint/aidl/android/hardware/security/keymint/MacedPublicKey.aidl) -* [RpcHardwareInfo](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/keymint/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl) -* [DeviceInfo](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/keymint/aidl/android/hardware/security/keymint/DeviceInfo.aidl) + HAL](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl) +* [ProtectedData](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl) +* [MacedPublicKey](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/rkp/aidl/android/hardware/security/keymint/MacedPublicKey.aidl) +* [RpcHardwareInfo](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/rkp/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl) +* [DeviceInfo](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/rkp/aidl/android/hardware/security/keymint/DeviceInfo.aidl) From 0f44f2644d386080524952f8ceeafc2e0b793cd3 Mon Sep 17 00:00:00 2001 From: Seth Moore Date: Wed, 2 Nov 2022 11:02:17 -0700 Subject: [PATCH 339/998] Update the RKP aidl dependency The RKP HAL is now in a new build-time dependency. The package has not changed, so identity AIDL changes are needed. We also need to fix up some VTS test dependencies. This change is fully backwards-compatible. Bug: 254112961 Test: N/A Change-Id: Ie0e17bb2cdf77e1cc96b3bb5bc4579c918b1f003 --- identity/aidl/Android.bp | 10 +++++----- identity/aidl/default/Android.bp | 2 ++ identity/aidl/vts/Android.bp | 2 ++ security/keymint/aidl/default/Android.bp | 1 + security/keymint/aidl/vts/functional/Android.bp | 1 + security/keymint/support/Android.bp | 3 +++ 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/identity/aidl/Android.bp b/identity/aidl/Android.bp index 9f2e498e1c..e2f9d0b310 100644 --- a/identity/aidl/Android.bp +++ b/identity/aidl/Android.bp @@ -15,7 +15,7 @@ aidl_interface { ], imports: [ "android.hardware.keymaster-V3", - "android.hardware.security.keymint-V3", + "android.hardware.security.rkp-V3", ], stability: "vintf", backend: { @@ -31,28 +31,28 @@ aidl_interface { version: "1", imports: [ "android.hardware.keymaster-V3", - "android.hardware.security.keymint-V1", + "android.hardware.security.rkp-V1", ], }, { version: "2", imports: [ "android.hardware.keymaster-V3", - "android.hardware.security.keymint-V1", + "android.hardware.security.rkp-V1", ], }, { version: "3", imports: [ "android.hardware.keymaster-V3", - "android.hardware.security.keymint-V1", + "android.hardware.security.rkp-V1", ], }, { version: "4", imports: [ "android.hardware.keymaster-V3", - "android.hardware.security.keymint-V2", + "android.hardware.security.rkp-V3", ], }, diff --git a/identity/aidl/default/Android.bp b/identity/aidl/default/Android.bp index a57875aee5..7bc3c8de8e 100644 --- a/identity/aidl/default/Android.bp +++ b/identity/aidl/default/Android.bp @@ -45,6 +45,7 @@ cc_library_static { "libpuresoftkeymasterdevice", "android.hardware.identity-support-lib", "android.hardware.keymaster-V3-ndk", + "android.hardware.security.rkp-V3-ndk", ], } @@ -112,6 +113,7 @@ cc_binary { "android.hardware.keymaster-V3-ndk", "android.hardware.identity-libeic-hal-common", "android.hardware.identity-libeic-library", + "android.hardware.security.rkp-V3-ndk", ], srcs: [ "service.cpp", diff --git a/identity/aidl/vts/Android.bp b/identity/aidl/vts/Android.bp index 54bf88739b..5e303bb7cf 100644 --- a/identity/aidl/vts/Android.bp +++ b/identity/aidl/vts/Android.bp @@ -39,6 +39,8 @@ cc_test { "libcrypto", ], static_libs: [ + "android.hardware.security.rkp-V3-cpp", + "android.hardware.security.rkp-V3-ndk", "android.hardware.security.secureclock-V1-ndk", "libcppbor_external", "libcppcose_rkp", diff --git a/security/keymint/aidl/default/Android.bp b/security/keymint/aidl/default/Android.bp index 1a17fd4f71..17520b73c7 100644 --- a/security/keymint/aidl/default/Android.bp +++ b/security/keymint/aidl/default/Android.bp @@ -25,6 +25,7 @@ cc_binary { "keymint_use_latest_hal_aidl_ndk_shared", ], shared_libs: [ + "android.hardware.security.rkp-V3-ndk", "android.hardware.security.sharedsecret-V1-ndk", "android.hardware.security.secureclock-V1-ndk", "libbase", diff --git a/security/keymint/aidl/vts/functional/Android.bp b/security/keymint/aidl/vts/functional/Android.bp index ef5b0bda73..13143bf620 100644 --- a/security/keymint/aidl/vts/functional/Android.bp +++ b/security/keymint/aidl/vts/functional/Android.bp @@ -35,6 +35,7 @@ cc_defaults { "libcrypto", ], static_libs: [ + "android.hardware.security.rkp-V3-ndk", "android.hardware.security.secureclock-V1-ndk", "libcppbor_external", "libcppcose_rkp", diff --git a/security/keymint/support/Android.bp b/security/keymint/support/Android.bp index 3f4832085c..891bb2cb46 100644 --- a/security/keymint/support/Android.bp +++ b/security/keymint/support/Android.bp @@ -63,6 +63,9 @@ cc_library { defaults: [ "keymint_use_latest_hal_aidl_ndk_shared", ], + static_libs: [ + "android.hardware.security.rkp-V3-ndk", + ], shared_libs: [ "libbase", "libbinder_ndk", From ff576455cab9da39cbf3b49803ce731de1d0aa6c Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Fri, 21 Oct 2022 13:15:23 +0000 Subject: [PATCH 340/998] Update IRadioIms for startImsTraffic and updateImsCallStatus Add trafficDirection paramter to startImsTraffic. Add updateImsCallStatus. Bug: 255450284 Test: atest VtsHalRadioTargetTest Change-Id: I1f6db4dc2daaab0015810bf775263b4095eaa7c6 --- .../android/hardware/radio/ims/IRadioIms.aidl | 3 +- .../hardware/radio/ims/IRadioImsResponse.aidl | 1 + .../android/hardware/radio/ims/ImsCall.aidl | 64 ++++++++++++++++++ .../android/hardware/radio/ims/IRadioIms.aidl | 23 +++++-- .../hardware/radio/ims/IRadioImsResponse.aidl | 17 +++++ .../android/hardware/radio/ims/ImsCall.aidl | 66 +++++++++++++++++++ radio/aidl/vts/radio_ims_response.cpp | 6 ++ radio/aidl/vts/radio_ims_test.cpp | 30 ++++++++- radio/aidl/vts/radio_ims_utils.h | 2 + 9 files changed, 205 insertions(+), 7 deletions(-) create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsCall.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/ImsCall.aidl diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl index e7403456a7..4df870969d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioIms.aidl @@ -36,9 +36,10 @@ package android.hardware.radio.ims; interface IRadioIms { oneway void setSrvccCallInfo(int serial, in android.hardware.radio.ims.SrvccCall[] srvccCalls); oneway void updateImsRegistrationInfo(int serial, in android.hardware.radio.ims.ImsRegistration imsRegistration); - oneway void startImsTraffic(int serial, int token, android.hardware.radio.ims.ImsTrafficType imsTrafficType, android.hardware.radio.AccessNetwork accessNetworkType); + oneway void startImsTraffic(int serial, int token, android.hardware.radio.ims.ImsTrafficType imsTrafficType, android.hardware.radio.AccessNetwork accessNetworkType, android.hardware.radio.ims.ImsCall.Direction trafficDirection); oneway void stopImsTraffic(int serial, int token); oneway void triggerEpsFallback(int serial, in android.hardware.radio.ims.EpsFallbackReason reason); oneway void setResponseFunctions(in android.hardware.radio.ims.IRadioImsResponse radioImsResponse, in android.hardware.radio.ims.IRadioImsIndication radioImsIndication); oneway void sendAnbrQuery(int serial, android.hardware.radio.ims.ImsStreamType mediaType, android.hardware.radio.ims.ImsStreamDirection direction, int bitsPerSecond); + oneway void updateImsCallStatus(int serial, in android.hardware.radio.ims.ImsCall[] imsCalls); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl index d4fd23fcda..053ba46864 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/IRadioImsResponse.aidl @@ -40,4 +40,5 @@ interface IRadioImsResponse { oneway void stopImsTrafficResponse(in android.hardware.radio.RadioResponseInfo info); oneway void triggerEpsFallbackResponse(in android.hardware.radio.RadioResponseInfo info); oneway void sendAnbrQueryResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void updateImsCallStatusResponse(in android.hardware.radio.RadioResponseInfo info); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsCall.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsCall.aidl new file mode 100644 index 0000000000..e48653bfd4 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsCall.aidl @@ -0,0 +1,64 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@JavaDerive(toString=true) @VintfStability +parcelable ImsCall { + int index; + android.hardware.radio.ims.ImsCall.CallType callType; + android.hardware.radio.AccessNetwork accessNetwork; + android.hardware.radio.ims.ImsCall.CallState callState; + android.hardware.radio.ims.ImsCall.Direction direction; + boolean isHeldByRemote; + @Backing(type="int") + enum CallType { + NORMAL = 0, + EMERGENCY = 1, + } + @Backing(type="int") + enum CallState { + ACTIVE = 0, + HOLDING = 1, + DIALING = 2, + ALERTING = 3, + INCOMING = 4, + WAITING = 5, + DISCONNECTING = 6, + DISCONNECTED = 7, + } + @Backing(type="int") + enum Direction { + INCOMING = 0, + OUTGOING = 1, + } +} diff --git a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl index c5412e1688..bd661a7224 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioIms.aidl @@ -18,14 +18,14 @@ package android.hardware.radio.ims; import android.hardware.radio.AccessNetwork; import android.hardware.radio.ims.EpsFallbackReason; -import android.hardware.radio.ims.ImsRegistration; -import android.hardware.radio.ims.ImsStreamDirection; -import android.hardware.radio.ims.ImsTrafficType; import android.hardware.radio.ims.IRadioImsIndication; import android.hardware.radio.ims.IRadioImsResponse; -import android.hardware.radio.ims.SrvccCall; +import android.hardware.radio.ims.ImsCall; +import android.hardware.radio.ims.ImsRegistration; import android.hardware.radio.ims.ImsStreamDirection; import android.hardware.radio.ims.ImsStreamType; +import android.hardware.radio.ims.ImsTrafficType; +import android.hardware.radio.ims.SrvccCall; /** * This interface is used by IMS telephony layer to talk to cellular radio. @@ -85,11 +85,14 @@ oneway interface IRadioIms { * @param token A nonce to identify the request * @param imsTrafficType IMS traffic type like registration, voice, and video * @param accessNetworkType The type of the radio access network used + * @param trafficDirection Indicates whether traffic is originated by mobile originated or + * mobile terminated use case eg. MO/MT call/SMS etc * * Response function is IRadioImsResponse.startImsTrafficResponse() */ void startImsTraffic(int serial, int token, - ImsTrafficType imsTrafficType, AccessNetwork accessNetworkType); + ImsTrafficType imsTrafficType, AccessNetwork accessNetworkType, + ImsCall.Direction trafficDirection); /** * Indicates IMS traffic has been stopped. @@ -136,4 +139,14 @@ oneway interface IRadioIms { * Response function is IRadioImsResponse.sendAnbrQueryResponse() */ void sendAnbrQuery(int serial, ImsStreamType mediaType, ImsStreamDirection direction, int bitsPerSecond); + + /** + * Provides a list of IMS call information to radio. + * + * @param serial Serial number of request + * @param imsCalls The list of IMS calls + * + * Response function is IRadioImsResponse.updateImsCallStatusResponse() + */ + void updateImsCallStatus(int serial, in ImsCall[] imsCalls); } diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl index 351e748400..b5e7680566 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl @@ -128,4 +128,21 @@ oneway interface IRadioImsResponse { * RadioError:NO_RESOURCES */ void sendAnbrQueryResponse(in RadioResponseInfo info); + + /** + * @param info Response info struct containing response type, serial no. and error + * + * Valid errors returned: + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:INVALID_STATE + * RadioError:NO_MEMORY + * RadioError:SYSTEM_ERR + * RadioError:MODEM_ERR + * RadioError:INTERNAL_ERR + * RadioError:INVALID_ARGUMENTS + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:NO_RESOURCES + */ + void updateImsCallStatusResponse(in RadioResponseInfo info); } diff --git a/radio/aidl/android/hardware/radio/ims/ImsCall.aidl b/radio/aidl/android/hardware/radio/ims/ImsCall.aidl new file mode 100644 index 0000000000..b71682fae3 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/ImsCall.aidl @@ -0,0 +1,66 @@ +/* + * 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. + */ + +package android.hardware.radio.ims; + +import android.hardware.radio.AccessNetwork; + +@VintfStability +@JavaDerive(toString=true) +parcelable ImsCall { + + @Backing(type="int") + enum CallType { + NORMAL, + EMERGENCY, + } + + @Backing(type="int") + enum CallState { + ACTIVE, + HOLDING, + DIALING, /* Outgoing only */ + ALERTING, /* Outgoing only */ + INCOMING, /* Incoming only */ + WAITING, /* Incoming only */ + DISCONNECTING, + DISCONNECTED, + } + + @Backing(type="int") + enum Direction { + INCOMING, + OUTGOING, + } + + /** Call index */ + int index; + + /** The type of the call */ + CallType callType; + + /** The access network where the call is in progress */ + AccessNetwork accessNetwork; + + /** The state of the call */ + CallState callState; + + /** The direction of the call */ + Direction direction; + + /** True if the call is put on HOLD by the other party */ + boolean isHeldByRemote; +} diff --git a/radio/aidl/vts/radio_ims_response.cpp b/radio/aidl/vts/radio_ims_response.cpp index 9d8db4a5d7..c6d62dce69 100644 --- a/radio/aidl/vts/radio_ims_response.cpp +++ b/radio/aidl/vts/radio_ims_response.cpp @@ -56,3 +56,9 @@ ndk::ScopedAStatus RadioImsResponse::sendAnbrQueryResponse(const RadioResponseIn parent_ims.notify(info.serial); return ndk::ScopedAStatus::ok(); } + +ndk::ScopedAStatus RadioImsResponse::updateImsCallStatusResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_ims.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} diff --git a/radio/aidl/vts/radio_ims_test.cpp b/radio/aidl/vts/radio_ims_test.cpp index fb81e0559e..5e3f057c61 100644 --- a/radio/aidl/vts/radio_ims_test.cpp +++ b/radio/aidl/vts/radio_ims_test.cpp @@ -125,7 +125,7 @@ TEST_P(RadioImsTest, startImsTraffic) { ndk::ScopedAStatus res = radio_ims->startImsTraffic(serial, 1, - ImsTrafficType::REGISTRATION, AccessNetwork::EUTRAN); + ImsTrafficType::REGISTRATION, AccessNetwork::EUTRAN, ImsCall::Direction::OUTGOING); ASSERT_OK(res); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type); @@ -214,6 +214,34 @@ TEST_P(RadioImsTest, sendAnbrQuery) { verifyError(radioRsp_ims->rspInfo.error); } +/* + * Test IRadioIms.updateImsCallStatus() for the response returned. + */ +TEST_P(RadioImsTest, updateImsCallStatus) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) { + ALOGI("Skipping updateImsCallStatus because ims is not supported in device"); + return; + } else { + ALOGI("Running updateImsCallStatus because ims is supported in device"); + } + + serial = GetRandomSerialNumber(); + + ImsCall imsCall; + + ndk::ScopedAStatus res = + radio_ims->updateImsCallStatus(serial, { imsCall }); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_ims->rspInfo.type); + EXPECT_EQ(serial, radioRsp_ims->rspInfo.serial); + + ALOGI("updateImsCallStatus, rspInfo.error = %s\n", + toString(radioRsp_ims->rspInfo.error).c_str()); + + verifyError(radioRsp_ims->rspInfo.error); +} + void RadioImsTest::verifyError(RadioError resp) { switch (resp) { case RadioError::NONE: diff --git a/radio/aidl/vts/radio_ims_utils.h b/radio/aidl/vts/radio_ims_utils.h index a435e44d99..2bf80dc987 100644 --- a/radio/aidl/vts/radio_ims_utils.h +++ b/radio/aidl/vts/radio_ims_utils.h @@ -52,6 +52,8 @@ class RadioImsResponse : public BnRadioImsResponse { virtual ndk::ScopedAStatus triggerEpsFallbackResponse(const RadioResponseInfo& info) override; virtual ndk::ScopedAStatus sendAnbrQueryResponse(const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus updateImsCallStatusResponse(const RadioResponseInfo& info) override; }; /* Callback class for radio ims indication */ From f001a413ce1bbfa7d2b5521a888614314631bf46 Mon Sep 17 00:00:00 2001 From: Seth Moore Date: Fri, 4 Nov 2022 16:40:46 +0000 Subject: [PATCH 341/998] Revert "Update the RKP aidl dependency" Revert "Add dependency on newly-split RKP HAL" Revert "Add dependencies on newly-split RKP HAL" Revert "Add dependency on split out RKP HAL" Revert submission 20364235-split-rkp-aidl Reason for revert: Build break in android.hardware.identity-api Reverted Changes: Ib86454bbb:Update dependencies on HAL types moved from keymin... I501c967e2:Add dependencies on newly-split RKP HAL I08560f9af:Add dependency on split out RKP HAL I87133e385:Add dependency on split out RKP HAL Ia13374cbc:Add dependency on split out RKP HAL I72bc1774c:Add dependency on newly-split RKP HAL I71ac265e3:Add dependency on newly-split RKP HAL Ie0e17bb2c:Update the RKP aidl dependency I5d24f47ce:Update README and CHANGELOG for RKP I4b2498dd1:Split rkp from keymint. I266009d75:Add dependency on newly-split rkp HAL Change-Id: I0c70c1086773b31ae2634bacba6e371aa2dc09bb --- identity/aidl/Android.bp | 10 +++++----- identity/aidl/default/Android.bp | 2 -- identity/aidl/vts/Android.bp | 2 -- security/keymint/aidl/default/Android.bp | 1 - security/keymint/aidl/vts/functional/Android.bp | 1 - security/keymint/support/Android.bp | 3 --- 6 files changed, 5 insertions(+), 14 deletions(-) diff --git a/identity/aidl/Android.bp b/identity/aidl/Android.bp index e2f9d0b310..9f2e498e1c 100644 --- a/identity/aidl/Android.bp +++ b/identity/aidl/Android.bp @@ -15,7 +15,7 @@ aidl_interface { ], imports: [ "android.hardware.keymaster-V3", - "android.hardware.security.rkp-V3", + "android.hardware.security.keymint-V3", ], stability: "vintf", backend: { @@ -31,28 +31,28 @@ aidl_interface { version: "1", imports: [ "android.hardware.keymaster-V3", - "android.hardware.security.rkp-V1", + "android.hardware.security.keymint-V1", ], }, { version: "2", imports: [ "android.hardware.keymaster-V3", - "android.hardware.security.rkp-V1", + "android.hardware.security.keymint-V1", ], }, { version: "3", imports: [ "android.hardware.keymaster-V3", - "android.hardware.security.rkp-V1", + "android.hardware.security.keymint-V1", ], }, { version: "4", imports: [ "android.hardware.keymaster-V3", - "android.hardware.security.rkp-V3", + "android.hardware.security.keymint-V2", ], }, diff --git a/identity/aidl/default/Android.bp b/identity/aidl/default/Android.bp index 7bc3c8de8e..a57875aee5 100644 --- a/identity/aidl/default/Android.bp +++ b/identity/aidl/default/Android.bp @@ -45,7 +45,6 @@ cc_library_static { "libpuresoftkeymasterdevice", "android.hardware.identity-support-lib", "android.hardware.keymaster-V3-ndk", - "android.hardware.security.rkp-V3-ndk", ], } @@ -113,7 +112,6 @@ cc_binary { "android.hardware.keymaster-V3-ndk", "android.hardware.identity-libeic-hal-common", "android.hardware.identity-libeic-library", - "android.hardware.security.rkp-V3-ndk", ], srcs: [ "service.cpp", diff --git a/identity/aidl/vts/Android.bp b/identity/aidl/vts/Android.bp index 5e303bb7cf..54bf88739b 100644 --- a/identity/aidl/vts/Android.bp +++ b/identity/aidl/vts/Android.bp @@ -39,8 +39,6 @@ cc_test { "libcrypto", ], static_libs: [ - "android.hardware.security.rkp-V3-cpp", - "android.hardware.security.rkp-V3-ndk", "android.hardware.security.secureclock-V1-ndk", "libcppbor_external", "libcppcose_rkp", diff --git a/security/keymint/aidl/default/Android.bp b/security/keymint/aidl/default/Android.bp index 17520b73c7..1a17fd4f71 100644 --- a/security/keymint/aidl/default/Android.bp +++ b/security/keymint/aidl/default/Android.bp @@ -25,7 +25,6 @@ cc_binary { "keymint_use_latest_hal_aidl_ndk_shared", ], shared_libs: [ - "android.hardware.security.rkp-V3-ndk", "android.hardware.security.sharedsecret-V1-ndk", "android.hardware.security.secureclock-V1-ndk", "libbase", diff --git a/security/keymint/aidl/vts/functional/Android.bp b/security/keymint/aidl/vts/functional/Android.bp index 13143bf620..ef5b0bda73 100644 --- a/security/keymint/aidl/vts/functional/Android.bp +++ b/security/keymint/aidl/vts/functional/Android.bp @@ -35,7 +35,6 @@ cc_defaults { "libcrypto", ], static_libs: [ - "android.hardware.security.rkp-V3-ndk", "android.hardware.security.secureclock-V1-ndk", "libcppbor_external", "libcppcose_rkp", diff --git a/security/keymint/support/Android.bp b/security/keymint/support/Android.bp index 891bb2cb46..3f4832085c 100644 --- a/security/keymint/support/Android.bp +++ b/security/keymint/support/Android.bp @@ -63,9 +63,6 @@ cc_library { defaults: [ "keymint_use_latest_hal_aidl_ndk_shared", ], - static_libs: [ - "android.hardware.security.rkp-V3-ndk", - ], shared_libs: [ "libbase", "libbinder_ndk", From 0a14f7cf32fc30b3ad74a6d2a88cbae0129e08dc Mon Sep 17 00:00:00 2001 From: Seth Moore Date: Fri, 4 Nov 2022 16:40:46 +0000 Subject: [PATCH 342/998] Revert "Update README and CHANGELOG for RKP" Revert "Add dependency on newly-split RKP HAL" Revert "Add dependencies on newly-split RKP HAL" Revert "Add dependency on split out RKP HAL" Revert submission 20364235-split-rkp-aidl Reason for revert: Build break in android.hardware.identity-api Reverted Changes: Ib86454bbb:Update dependencies on HAL types moved from keymin... I501c967e2:Add dependencies on newly-split RKP HAL I08560f9af:Add dependency on split out RKP HAL I87133e385:Add dependency on split out RKP HAL Ia13374cbc:Add dependency on split out RKP HAL I72bc1774c:Add dependency on newly-split RKP HAL I71ac265e3:Add dependency on newly-split RKP HAL Ie0e17bb2c:Update the RKP aidl dependency I5d24f47ce:Update README and CHANGELOG for RKP I4b2498dd1:Split rkp from keymint. I266009d75:Add dependency on newly-split rkp HAL Change-Id: I184a11f2efc1eb5ebf982dc1c07950f09b51c6e1 --- security/keymint/README.md | 10 ---------- .../CHANGELOG.md => keymint/RKP_CHANGELOG.md} | 6 ------ .../{rkp/README.md => keymint/RKP_README.md} | 16 ++++++++-------- 3 files changed, 8 insertions(+), 24 deletions(-) delete mode 100644 security/keymint/README.md rename security/{rkp/CHANGELOG.md => keymint/RKP_CHANGELOG.md} (79%) rename security/{rkp/README.md => keymint/RKP_README.md} (95%) diff --git a/security/keymint/README.md b/security/keymint/README.md deleted file mode 100644 index 54647af659..0000000000 --- a/security/keymint/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# KeyMint HAL - -This directory contains the HAL definition for KeyMint. KeyMint provides -cryptographic services in a hardware-isolated environment. - -Note that the `IRemotelyProvisionedComponent` HAL, and it's associated types, -used to also be defined in this directory. As of Android U, this HAL has been -moved to a different directory (../rkp). This move is ABI compatible, as the -interfaces have been maintained. The build is split so that the generated -code may be built with different options. diff --git a/security/rkp/CHANGELOG.md b/security/keymint/RKP_CHANGELOG.md similarity index 79% rename from security/rkp/CHANGELOG.md rename to security/keymint/RKP_CHANGELOG.md index eb2041d146..243fc26525 100644 --- a/security/rkp/CHANGELOG.md +++ b/security/keymint/RKP_CHANGELOG.md @@ -19,12 +19,6 @@ This document provides an exact description of which changes have occurred in th * `uniqueId` String added as a field in order to differentiate IRPC instances on device. ## IRemotelyProvisionedComponent 2 -> 3 -* The RKP HAL now builds separately from KeyMint. - * The HAL remains under the `android.hardware.security.keymint` package for - compatibility with previous releases. ABI compatibility requires this. - * Dependencies on the RKP HAL must add a dependency on - `"android.hardware.security.rkp"` generated code (instead of - `"android.hardward.security.keymint"`). * ProtectedData has been removed. * DeviceInfo * `version` has moved to a top-level field within the CSR generated by the HAL diff --git a/security/rkp/README.md b/security/keymint/RKP_README.md similarity index 95% rename from security/rkp/README.md rename to security/keymint/RKP_README.md index 5fb49486ce..89a2598f66 100644 --- a/security/rkp/README.md +++ b/security/keymint/RKP_README.md @@ -6,8 +6,8 @@ Design a HAL to support over-the-air provisioning of certificates for asymmetric keys. The HAL must interact effectively with Keystore (and other daemons) and protect device privacy and security. -Note that this API was originally designed for KeyMint, with the intention that -it should be usable for other HALs that require certificate provisioning. +Note that this API is designed for KeyMint, but with the intention that it +should be usable for other HALs that require certificate provisioning. Throughout this document we'll refer to the Keystore and KeyMint (formerly called Keymaster) components, but only for concreteness and convenience; those labels could be replaced with the names of any system and secure area @@ -312,7 +312,7 @@ the range \[-70000, -70999\] (these are reserved for future additions here). ``` Please see -[ProtectedData.aidl](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl) +[ProtectedData.aidl](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/keymint/aidl/android/hardware/security/keymint/ProtectedData.aidl) for a full CDDL definition of the BCC. ### `CertificateRequest` @@ -366,9 +366,9 @@ Please see the related HAL documentation directly in the source code at the following links: * [IRemotelyProvisionedComponent - HAL](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl) -* [ProtectedData](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl) -* [MacedPublicKey](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/rkp/aidl/android/hardware/security/keymint/MacedPublicKey.aidl) -* [RpcHardwareInfo](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/rkp/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl) -* [DeviceInfo](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/rkp/aidl/android/hardware/security/keymint/DeviceInfo.aidl) + HAL](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/keymint/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl) +* [ProtectedData](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/keymint/aidl/android/hardware/security/keymint/ProtectedData.aidl) +* [MacedPublicKey](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/keymint/aidl/android/hardware/security/keymint/MacedPublicKey.aidl) +* [RpcHardwareInfo](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/keymint/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl) +* [DeviceInfo](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/keymint/aidl/android/hardware/security/keymint/DeviceInfo.aidl) From ccbb5d8a61401567605e4bc297a7a2b46d90bb22 Mon Sep 17 00:00:00 2001 From: Seth Moore Date: Fri, 4 Nov 2022 16:40:46 +0000 Subject: [PATCH 343/998] Revert "Split rkp from keymint." Revert "Add dependency on newly-split RKP HAL" Revert "Add dependencies on newly-split RKP HAL" Revert "Add dependency on split out RKP HAL" Revert submission 20364235-split-rkp-aidl Reason for revert: Build break in android.hardware.identity-api Reverted Changes: Ib86454bbb:Update dependencies on HAL types moved from keymin... I501c967e2:Add dependencies on newly-split RKP HAL I08560f9af:Add dependency on split out RKP HAL I87133e385:Add dependency on split out RKP HAL Ia13374cbc:Add dependency on split out RKP HAL I72bc1774c:Add dependency on newly-split RKP HAL I71ac265e3:Add dependency on newly-split RKP HAL Ie0e17bb2c:Update the RKP aidl dependency I5d24f47ce:Update README and CHANGELOG for RKP I4b2498dd1:Split rkp from keymint. I266009d75:Add dependency on newly-split rkp HAL Change-Id: Ic0a1c38d36a24cc2206d078e1486d51baef0e4c3 --- .../android.hardware.security.keymint/1/.hash | 1 - .../hardware/security/keymint/DeviceInfo.aidl | 0 .../IRemotelyProvisionedComponent.aidl | 0 .../security/keymint/MacedPublicKey.aidl | 0 .../security/keymint/ProtectedData.aidl | 0 .../security/keymint/RpcHardwareInfo.aidl | 0 .../android.hardware.security.keymint/2/.hash | 1 - .../hardware/security/keymint/DeviceInfo.aidl | 0 .../IRemotelyProvisionedComponent.aidl | 0 .../security/keymint/MacedPublicKey.aidl | 0 .../security/keymint/ProtectedData.aidl | 0 .../security/keymint/RpcHardwareInfo.aidl | 0 .../hardware/security/keymint/DeviceInfo.aidl | 0 .../IRemotelyProvisionedComponent.aidl | 0 .../security/keymint/MacedPublicKey.aidl | 0 .../security/keymint/ProtectedData.aidl | 0 .../security/keymint/RpcHardwareInfo.aidl | 0 .../hardware/security/keymint/DeviceInfo.aidl | 0 .../IRemotelyProvisionedComponent.aidl | 0 .../security/keymint/MacedPublicKey.aidl | 0 .../security/keymint/ProtectedData.aidl | 0 .../security/keymint/RpcHardwareInfo.aidl | 0 security/rkp/aidl/Android.bp | 37 ------------------- .../android.hardware.security.rkp/1/.hash | 1 - .../android.hardware.security.rkp/2/.hash | 1 - 25 files changed, 41 deletions(-) rename security/{rkp/aidl/aidl_api/android.hardware.security.rkp => keymint/aidl/aidl_api/android.hardware.security.keymint}/1/android/hardware/security/keymint/DeviceInfo.aidl (100%) rename security/{rkp/aidl/aidl_api/android.hardware.security.rkp => keymint/aidl/aidl_api/android.hardware.security.keymint}/1/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl (100%) rename security/{rkp/aidl/aidl_api/android.hardware.security.rkp => keymint/aidl/aidl_api/android.hardware.security.keymint}/1/android/hardware/security/keymint/MacedPublicKey.aidl (100%) rename security/{rkp/aidl/aidl_api/android.hardware.security.rkp => keymint/aidl/aidl_api/android.hardware.security.keymint}/1/android/hardware/security/keymint/ProtectedData.aidl (100%) rename security/{rkp/aidl/aidl_api/android.hardware.security.rkp => keymint/aidl/aidl_api/android.hardware.security.keymint}/1/android/hardware/security/keymint/RpcHardwareInfo.aidl (100%) rename security/{rkp/aidl/aidl_api/android.hardware.security.rkp => keymint/aidl/aidl_api/android.hardware.security.keymint}/2/android/hardware/security/keymint/DeviceInfo.aidl (100%) rename security/{rkp/aidl/aidl_api/android.hardware.security.rkp => keymint/aidl/aidl_api/android.hardware.security.keymint}/2/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl (100%) rename security/{rkp/aidl/aidl_api/android.hardware.security.rkp => keymint/aidl/aidl_api/android.hardware.security.keymint}/2/android/hardware/security/keymint/MacedPublicKey.aidl (100%) rename security/{rkp/aidl/aidl_api/android.hardware.security.rkp => keymint/aidl/aidl_api/android.hardware.security.keymint}/2/android/hardware/security/keymint/ProtectedData.aidl (100%) rename security/{rkp/aidl/aidl_api/android.hardware.security.rkp => keymint/aidl/aidl_api/android.hardware.security.keymint}/2/android/hardware/security/keymint/RpcHardwareInfo.aidl (100%) rename security/{rkp/aidl/aidl_api/android.hardware.security.rkp => keymint/aidl/aidl_api/android.hardware.security.keymint}/current/android/hardware/security/keymint/DeviceInfo.aidl (100%) rename security/{rkp/aidl/aidl_api/android.hardware.security.rkp => keymint/aidl/aidl_api/android.hardware.security.keymint}/current/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl (100%) rename security/{rkp/aidl/aidl_api/android.hardware.security.rkp => keymint/aidl/aidl_api/android.hardware.security.keymint}/current/android/hardware/security/keymint/MacedPublicKey.aidl (100%) rename security/{rkp/aidl/aidl_api/android.hardware.security.rkp => keymint/aidl/aidl_api/android.hardware.security.keymint}/current/android/hardware/security/keymint/ProtectedData.aidl (100%) rename security/{rkp/aidl/aidl_api/android.hardware.security.rkp => keymint/aidl/aidl_api/android.hardware.security.keymint}/current/android/hardware/security/keymint/RpcHardwareInfo.aidl (100%) rename security/{rkp => keymint}/aidl/android/hardware/security/keymint/DeviceInfo.aidl (100%) rename security/{rkp => keymint}/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl (100%) rename security/{rkp => keymint}/aidl/android/hardware/security/keymint/MacedPublicKey.aidl (100%) rename security/{rkp => keymint}/aidl/android/hardware/security/keymint/ProtectedData.aidl (100%) rename security/{rkp => keymint}/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl (100%) delete mode 100644 security/rkp/aidl/Android.bp delete mode 100644 security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/.hash delete mode 100644 security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/.hash diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/.hash b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/.hash index 3a6d4157d1..b712a5231b 100644 --- a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/.hash +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/.hash @@ -1,2 +1 @@ 976674616001f714f4a4df49ee45f548de828524 -cd862ae2e49b54fc965dc1b99c218eb729c93bb1 diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/DeviceInfo.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/DeviceInfo.aidl similarity index 100% rename from security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/DeviceInfo.aidl rename to security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/DeviceInfo.aidl diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl similarity index 100% rename from security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl rename to security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/MacedPublicKey.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/MacedPublicKey.aidl similarity index 100% rename from security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/MacedPublicKey.aidl rename to security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/MacedPublicKey.aidl diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/ProtectedData.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/ProtectedData.aidl similarity index 100% rename from security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/ProtectedData.aidl rename to security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/ProtectedData.aidl diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/RpcHardwareInfo.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/RpcHardwareInfo.aidl similarity index 100% rename from security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/RpcHardwareInfo.aidl rename to security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/RpcHardwareInfo.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/.hash b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/.hash index b4c2b78a70..69ba9a6bc5 100644 --- a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/.hash +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/.hash @@ -1,2 +1 @@ 207c9f218b9b9e4e74ff5232eb16511eca9d7d2e -70c734fbd5cac5b36676d66d8d9aa941967e1e7b diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/DeviceInfo.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/DeviceInfo.aidl similarity index 100% rename from security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/DeviceInfo.aidl rename to security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/DeviceInfo.aidl diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl similarity index 100% rename from security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl rename to security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/MacedPublicKey.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/MacedPublicKey.aidl similarity index 100% rename from security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/MacedPublicKey.aidl rename to security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/MacedPublicKey.aidl diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/ProtectedData.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/ProtectedData.aidl similarity index 100% rename from security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/ProtectedData.aidl rename to security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/ProtectedData.aidl diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/RpcHardwareInfo.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/RpcHardwareInfo.aidl similarity index 100% rename from security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/RpcHardwareInfo.aidl rename to security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/RpcHardwareInfo.aidl diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/DeviceInfo.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/DeviceInfo.aidl similarity index 100% rename from security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/DeviceInfo.aidl rename to security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/DeviceInfo.aidl diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl similarity index 100% rename from security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl rename to security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/MacedPublicKey.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/MacedPublicKey.aidl similarity index 100% rename from security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/MacedPublicKey.aidl rename to security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/MacedPublicKey.aidl diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/ProtectedData.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/ProtectedData.aidl similarity index 100% rename from security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/ProtectedData.aidl rename to security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/ProtectedData.aidl diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/RpcHardwareInfo.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/RpcHardwareInfo.aidl similarity index 100% rename from security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/RpcHardwareInfo.aidl rename to security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/RpcHardwareInfo.aidl diff --git a/security/rkp/aidl/android/hardware/security/keymint/DeviceInfo.aidl b/security/keymint/aidl/android/hardware/security/keymint/DeviceInfo.aidl similarity index 100% rename from security/rkp/aidl/android/hardware/security/keymint/DeviceInfo.aidl rename to security/keymint/aidl/android/hardware/security/keymint/DeviceInfo.aidl diff --git a/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl b/security/keymint/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl similarity index 100% rename from security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl rename to security/keymint/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl diff --git a/security/rkp/aidl/android/hardware/security/keymint/MacedPublicKey.aidl b/security/keymint/aidl/android/hardware/security/keymint/MacedPublicKey.aidl similarity index 100% rename from security/rkp/aidl/android/hardware/security/keymint/MacedPublicKey.aidl rename to security/keymint/aidl/android/hardware/security/keymint/MacedPublicKey.aidl diff --git a/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl b/security/keymint/aidl/android/hardware/security/keymint/ProtectedData.aidl similarity index 100% rename from security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl rename to security/keymint/aidl/android/hardware/security/keymint/ProtectedData.aidl diff --git a/security/rkp/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl b/security/keymint/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl similarity index 100% rename from security/rkp/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl rename to security/keymint/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl diff --git a/security/rkp/aidl/Android.bp b/security/rkp/aidl/Android.bp deleted file mode 100644 index 4c479f4642..0000000000 --- a/security/rkp/aidl/Android.bp +++ /dev/null @@ -1,37 +0,0 @@ -package { - // See: http://go/android-license-faq - // A large-scale-change added 'default_applicable_licenses' to import - // all of the 'license_kinds' from "hardware_interfaces_license" - // to get the below license kinds: - // SPDX-license-identifier-Apache-2.0 - default_applicable_licenses: ["hardware_interfaces_license"], -} - -aidl_interface { - name: "android.hardware.security.rkp", - vendor_available: true, - srcs: [ - // This HAL was originally part of keymint. - "android/hardware/security/keymint/*.aidl", - - // in the future - // "android/hardware/security/rkp/*.aidl", - ], - stability: "vintf", - backend: { - java: { - min_sdk_version: "33", - }, - rust: { - enabled: true, - }, - }, - versions_with_info: [ - { - version: "1", - }, - { - version: "2", - }, - ], -} diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/.hash b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/.hash deleted file mode 100644 index 404553bf36..0000000000 --- a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/.hash +++ /dev/null @@ -1 +0,0 @@ -d285480d2e0002adc0ace80edf34aa725679512e diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/.hash b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/.hash deleted file mode 100644 index 8700d33656..0000000000 --- a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/.hash +++ /dev/null @@ -1 +0,0 @@ -c8d34e56ae0807b61f028019622d8b60a37e0a8b From bcc0307cfd06e4be5641d19c215860a808906b20 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Mon, 7 Nov 2022 08:50:47 +0000 Subject: [PATCH 344/998] Make all APIs in IRadioIms HAL mandatory Bug: 257343833 Test: atest VtsHalRadioTargetTest Change-Id: I83b01df1800bc850ba2206dad58def5a7dda85be --- .../aidl/android/hardware/radio/ims/IRadioImsResponse.aidl | 7 ------- radio/aidl/vts/radio_ims_test.cpp | 1 - 2 files changed, 8 deletions(-) diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl index b5e7680566..241c342384 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl @@ -37,7 +37,6 @@ oneway interface IRadioImsResponse { * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR * RadioError:INVALID_ARGUMENTS - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES */ void setSrvccCallInfoResponse(in RadioResponseInfo info); @@ -54,7 +53,6 @@ oneway interface IRadioImsResponse { * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR * RadioError:INVALID_ARGUMENTS - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES */ void updateImsRegistrationInfoResponse(in RadioResponseInfo info); @@ -72,7 +70,6 @@ oneway interface IRadioImsResponse { * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR * RadioError:INVALID_ARGUMENTS - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES */ void startImsTrafficResponse(in RadioResponseInfo info, @@ -90,7 +87,6 @@ oneway interface IRadioImsResponse { * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR * RadioError:INVALID_ARGUMENTS - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES */ void stopImsTrafficResponse(in RadioResponseInfo info); @@ -107,7 +103,6 @@ oneway interface IRadioImsResponse { * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR * RadioError:INVALID_ARGUMENTS - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES */ void triggerEpsFallbackResponse(in RadioResponseInfo info); @@ -124,7 +119,6 @@ oneway interface IRadioImsResponse { * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR * RadioError:INVALID_ARGUMENTS - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES */ void sendAnbrQueryResponse(in RadioResponseInfo info); @@ -141,7 +135,6 @@ oneway interface IRadioImsResponse { * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR * RadioError:INVALID_ARGUMENTS - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES */ void updateImsCallStatusResponse(in RadioResponseInfo info); diff --git a/radio/aidl/vts/radio_ims_test.cpp b/radio/aidl/vts/radio_ims_test.cpp index 5e3f057c61..289d3ed54d 100644 --- a/radio/aidl/vts/radio_ims_test.cpp +++ b/radio/aidl/vts/radio_ims_test.cpp @@ -252,7 +252,6 @@ void RadioImsTest::verifyError(RadioError resp) { case RadioError::MODEM_ERR: case RadioError::INTERNAL_ERR: case RadioError::INVALID_ARGUMENTS: - case RadioError::REQUEST_NOT_SUPPORTED: case RadioError::NO_RESOURCES: SUCCEED(); break; From 2048670d42874b2cb44bb48bda8c138ee1ba2233 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Thu, 27 Oct 2022 16:58:50 -0700 Subject: [PATCH 345/998] Add HAL changes for DOOR_CHILD_LOCK_ENABLED Bug: 255664772 Test: atest VtsHalAutomotiveVehicle_TargetTest atest CtsCarTestCases:CarPropertyManagerTest atest CtsCarTestCases:VehiclePropertyIdsTest Change-Id: I69ff243f81c135673bb202a9c95d8e75d894a8f8 --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 15 ++++- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../config/DefaultProperties.json | 16 +++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 67 +++++++++++++++++++ 8 files changed, 102 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 64c7ce7d0a..a7c706079b 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -119,6 +119,7 @@ enum VehicleProperty { DOOR_POS = 373295872, DOOR_MOVE = 373295873, DOOR_LOCK = 371198722, + DOOR_CHILD_LOCK_ENABLED = 371198723, MIRROR_Z_POS = 339741504, MIRROR_Z_MOVE = 339741505, MIRROR_Y_POS = 339741506, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 1852673cb7..4c7784b5df 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -16,6 +16,8 @@ package android.hardware.automotive.vehicle; +import android.hardware.automotive.vehicle.VehicleArea; +import android.hardware.automotive.vehicle.VehiclePropertyGroup; import android.hardware.automotive.vehicle.VehiclePropertyType; /** * Declares all vehicle properties. VehicleProperty has a bitwise structure. @@ -1317,6 +1319,18 @@ enum VehicleProperty { */ DOOR_LOCK = 0x0B02 + 0x10000000 + 0x06000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:DOOR,VehiclePropertyType:BOOLEAN + /** + * Door child lock feature enabled + * + * Returns true if the door child lock feature is enabled and false if it is disabled. + * + * If enabled, the door is unable to be opened from the inside. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + DOOR_CHILD_LOCK_ENABLED = + 0x0B03 + VehiclePropertyGroup.SYSTEM + VehicleArea.DOOR + VehiclePropertyType.BOOLEAN, /** * Mirror Z Position * @@ -2889,5 +2903,4 @@ enum VehicleProperty { */ SUPPORTED_PROPERTY_IDS = 0x0F48 + 0x10000000 + 0x01000000 + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC - } diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index c91afe2199..7f3279b5df 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -119,6 +119,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::DOOR_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::DOOR_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::DOOR_LOCK, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::DOOR_CHILD_LOCK_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::MIRROR_Z_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::MIRROR_Z_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::MIRROR_Y_POS, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 807be5dcb1..9f9d8287d0 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -119,6 +119,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::DOOR_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::DOOR_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::DOOR_LOCK, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DOOR_CHILD_LOCK_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::MIRROR_Z_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::MIRROR_Z_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::MIRROR_Y_POS, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index e698f84265..fa3ba642cf 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -111,6 +111,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.DOOR_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.DOOR_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.DOOR_LOCK, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.DOOR_CHILD_LOCK_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.MIRROR_Z_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.MIRROR_Z_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.MIRROR_Y_POS, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index fe69450cb4..9dd6f1d328 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -111,6 +111,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.DOOR_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.DOOR_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.DOOR_LOCK, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DOOR_CHILD_LOCK_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.MIRROR_Z_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.MIRROR_Z_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.MIRROR_Y_POS, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 7b471e1053..f25cab70c6 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1928,6 +1928,22 @@ } ] }, + { + "property": "VehicleProperty::DOOR_CHILD_LOCK_ENABLED", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::DOOR_2_LEFT" + }, + { + "areaId": "Constants::DOOR_2_RIGHT" + } + ] + }, { "property": "VehicleProperty::DOOR_POS", "defaultValue": { diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 5de206bee2..9dffbcc86a 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -44,6 +44,8 @@ using ::aidl::android::hardware::automotive::vehicle::SubscribeOptions; using ::aidl::android::hardware::automotive::vehicle::VehicleArea; using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyChangeMode; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup; using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; using ::android::getAidlHalInstanceNames; using ::android::base::ScopedLockAssertion; @@ -114,6 +116,9 @@ class VtsVehicleCallback final : public ISubscriptionCallback { class VtsHalAutomotiveVehicleTargetTest : public testing::TestWithParam { public: + void verifyProperty(VehicleProperty propId, VehiclePropertyAccess access, + VehiclePropertyChangeMode changeMode, VehiclePropertyGroup group, + VehicleArea area, VehiclePropertyType propertyType); virtual void SetUp() override { auto descriptor = GetParam(); if (descriptor.isAidlService) { @@ -420,6 +425,68 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, testGetValuesTimestampAIDL) { } } +// Helper function to compare actual vs expected property config +void VtsHalAutomotiveVehicleTargetTest::verifyProperty(VehicleProperty propId, + VehiclePropertyAccess access, + VehiclePropertyChangeMode changeMode, + VehiclePropertyGroup group, VehicleArea area, + VehiclePropertyType propertyType) { + int expectedPropId = toInt(propId); + int expectedAccess = toInt(access); + int expectedChangeMode = toInt(changeMode); + int expectedGroup = toInt(group); + int expectedArea = toInt(area); + int expectedPropertyType = toInt(propertyType); + + auto result = mVhalClient->getPropConfigs({expectedPropId}); + ASSERT_TRUE(result.ok()) << "Failed to get required property config, error: " + << result.error().message(); + + if (result.value().size() == 0) { + GTEST_SKIP() << "Property has not been implemented"; + } + ASSERT_EQ(result.value().size(), 1u) + << StringPrintf("Expect to get exactly 1 config, got %zu", result.value().size()); + + const auto& config = result.value().at(0); + int actualPropId = config->getPropId(); + int actualAccess = config->getAccess(); + int actualChangeMode = config->getChangeMode(); + int actualGroup = actualPropId & toInt(VehiclePropertyGroup::MASK); + int actualArea = actualPropId & toInt(VehicleArea::MASK); + int actualPropertyType = actualPropId & toInt(VehiclePropertyType::MASK); + + ASSERT_EQ(actualPropId, expectedPropId) + << StringPrintf("Expect to get property ID: %i, got %i", expectedPropId, actualPropId); + + if (expectedAccess == toInt(VehiclePropertyAccess::READ_WRITE)) { + ASSERT_TRUE(actualAccess == expectedAccess || + actualAccess == toInt(VehiclePropertyAccess::READ)) + << StringPrintf("Expect to get VehiclePropertyAccess: %i or %i, got %i", + expectedAccess, toInt(VehiclePropertyAccess::READ), actualAccess); + } else { + ASSERT_EQ(actualAccess, expectedAccess) << StringPrintf( + "Expect to get VehiclePropertyAccess: %i, got %i", expectedAccess, actualAccess); + } + + ASSERT_EQ(actualChangeMode, expectedChangeMode) + << StringPrintf("Expect to get VehiclePropertyChangeMode: %i, got %i", + expectedChangeMode, actualChangeMode); + ASSERT_EQ(actualGroup, expectedGroup) << StringPrintf( + "Expect to get VehiclePropertyGroup: %i, got %i", expectedGroup, actualGroup); + ASSERT_EQ(actualArea, expectedArea) + << StringPrintf("Expect to get VehicleArea: %i, got %i", expectedArea, actualArea); + ASSERT_EQ(actualPropertyType, expectedPropertyType) + << StringPrintf("Expect to get VehiclePropertyType: %i, got %i", expectedPropertyType, + actualPropertyType); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDoorChildLockEnabledConfig) { + verifyProperty(VehicleProperty::DOOR_CHILD_LOCK_ENABLED, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::DOOR, VehiclePropertyType::BOOLEAN); +} + std::vector getDescriptors() { std::vector descriptors; for (std::string name : getAidlHalInstanceNames(IVehicle::descriptor)) { From cbbc870ba85fa9dda5a31749e6d8afe36e00494c Mon Sep 17 00:00:00 2001 From: Bharatt Kukreja Date: Thu, 15 Sep 2022 20:24:36 +0000 Subject: [PATCH 346/998] Camera: Add autoframing API The new API can be used to keep objects in the frame's fov. Auto-generated file from changes in metadata_definitions.xml Bug: 234004829 Test: Successful build Change-Id: I68b1c38a67427aba3fa0ef9f21fb526199953682 --- .../camera/metadata/CameraMetadataTag.aidl | 3 ++ .../camera/metadata/ControlAutoframing.aidl | 44 +++++++++++++++++++ .../metadata/ControlAutoframingAvailable.aidl | 43 ++++++++++++++++++ .../metadata/ControlAutoframingState.aidl | 44 +++++++++++++++++++ .../camera/metadata/CameraMetadataTag.aidl | 20 +++++++++ .../camera/metadata/ControlAutoframing.aidl | 35 +++++++++++++++ .../metadata/ControlAutoframingAvailable.aidl | 34 ++++++++++++++ .../metadata/ControlAutoframingState.aidl | 35 +++++++++++++++ 8 files changed, 258 insertions(+) create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframing.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframingAvailable.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframingState.aidl create mode 100644 camera/metadata/aidl/android/hardware/camera/metadata/ControlAutoframing.aidl create mode 100644 camera/metadata/aidl/android/hardware/camera/metadata/ControlAutoframingAvailable.aidl create mode 100644 camera/metadata/aidl/android/hardware/camera/metadata/ControlAutoframingState.aidl diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl index af414b40bd..617979d957 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl @@ -94,6 +94,9 @@ enum CameraMetadataTag { ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS_MAXIMUM_RESOLUTION = 65584, ANDROID_CONTROL_SETTINGS_OVERRIDE = 65588, ANDROID_CONTROL_AVAILABLE_SETTINGS_OVERRIDES = 65589, + ANDROID_CONTROL_AUTOFRAMING = 65590, + ANDROID_CONTROL_AUTOFRAMING_AVAILABLE = 65591, + ANDROID_CONTROL_AUTOFRAMING_STATE = 65592, ANDROID_DEMOSAIC_MODE = 131072, ANDROID_EDGE_MODE = 196608, ANDROID_EDGE_STRENGTH = 196609, diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframing.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframing.aidl new file mode 100644 index 0000000000..eeb7bcd512 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframing.aidl @@ -0,0 +1,44 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAutoframing { + ANDROID_CONTROL_AUTOFRAMING_OFF = 0, + ANDROID_CONTROL_AUTOFRAMING_ON = 1, + ANDROID_CONTROL_AUTOFRAMING_AUTO = 2, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframingAvailable.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframingAvailable.aidl new file mode 100644 index 0000000000..b075c325f9 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframingAvailable.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAutoframingAvailable { + ANDROID_CONTROL_AUTOFRAMING_AVAILABLE_FALSE = 0, + ANDROID_CONTROL_AUTOFRAMING_AVAILABLE_TRUE = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframingState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframingState.aidl new file mode 100644 index 0000000000..60df0d4d44 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframingState.aidl @@ -0,0 +1,44 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAutoframingState { + ANDROID_CONTROL_AUTOFRAMING_STATE_INACTIVE = 0, + ANDROID_CONTROL_AUTOFRAMING_STATE_FRAMING = 1, + ANDROID_CONTROL_AUTOFRAMING_STATE_CONVERGED = 2, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl index cc98ff07c3..85e56bce77 100644 --- a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl +++ b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl @@ -463,6 +463,26 @@ enum CameraMetadataTag { * be used to speed up certain controls.

*/ ANDROID_CONTROL_AVAILABLE_SETTINGS_OVERRIDES, + /** + * android.control.autoframing [dynamic, enum, public] + * + *

Automatic crop, pan and zoom to keep objects in the center of the frame.

+ */ + ANDROID_CONTROL_AUTOFRAMING, + /** + * android.control.autoframingAvailable [static, enum, public] + * + *

Whether the camera device supports ANDROID_CONTROL_AUTOFRAMING.

+ * + * @see ANDROID_CONTROL_AUTOFRAMING + */ + ANDROID_CONTROL_AUTOFRAMING_AVAILABLE, + /** + * android.control.autoframingState [dynamic, enum, public] + * + *

Current state of auto-framing.

+ */ + ANDROID_CONTROL_AUTOFRAMING_STATE, /** * android.demosaic.mode [controls, enum, system] * diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlAutoframing.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAutoframing.aidl new file mode 100644 index 0000000000..0fef3735b1 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAutoframing.aidl @@ -0,0 +1,35 @@ +/* + * 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.autoframing enumeration values + * @see ANDROID_CONTROL_AUTOFRAMING + */ +@VintfStability +@Backing(type="int") +enum ControlAutoframing { + ANDROID_CONTROL_AUTOFRAMING_OFF, + ANDROID_CONTROL_AUTOFRAMING_ON, + ANDROID_CONTROL_AUTOFRAMING_AUTO, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlAutoframingAvailable.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAutoframingAvailable.aidl new file mode 100644 index 0000000000..da0d34894d --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAutoframingAvailable.aidl @@ -0,0 +1,34 @@ +/* + * 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.autoframingAvailable enumeration values + * @see ANDROID_CONTROL_AUTOFRAMING_AVAILABLE + */ +@VintfStability +@Backing(type="int") +enum ControlAutoframingAvailable { + ANDROID_CONTROL_AUTOFRAMING_AVAILABLE_FALSE, + ANDROID_CONTROL_AUTOFRAMING_AVAILABLE_TRUE, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ControlAutoframingState.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAutoframingState.aidl new file mode 100644 index 0000000000..13183a5314 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ControlAutoframingState.aidl @@ -0,0 +1,35 @@ +/* + * 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.control.autoframingState enumeration values + * @see ANDROID_CONTROL_AUTOFRAMING_STATE + */ +@VintfStability +@Backing(type="int") +enum ControlAutoframingState { + ANDROID_CONTROL_AUTOFRAMING_STATE_INACTIVE, + ANDROID_CONTROL_AUTOFRAMING_STATE_FRAMING, + ANDROID_CONTROL_AUTOFRAMING_STATE_CONVERGED, +} From fa09d071c784c032a002c3ef1e25adf55a675688 Mon Sep 17 00:00:00 2001 From: Eran Messeri Date: Mon, 31 Oct 2022 12:22:10 +0000 Subject: [PATCH 347/998] ID attestation: Define tag for a second IMEI Define a KeyMint tag for a second IMEI to be included in the attestation record. Also clarify that the IMEI tag is meant to include one, and only one, IMEI. Bug: 244732345 Test: android.keystore.cts.DeviceOwnerKeyManagementTest Change-Id: I70ecbb0245ba2e517e5d0db0cfdce4525846f3e5 --- .../hardware/security/keymint/Tag.aidl | 1 + .../hardware/security/keymint/Tag.aidl | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/Tag.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/Tag.aidl index e310b4448f..6ae2369fbf 100644 --- a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/Tag.aidl +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/Tag.aidl @@ -90,6 +90,7 @@ enum Tag { DEVICE_UNIQUE_ATTESTATION = 1879048912, IDENTITY_CREDENTIAL_KEY = 1879048913, STORAGE_KEY = 1879048914, + ATTESTATION_ID_SECOND_IMEI = -1879047469, ASSOCIATED_DATA = -1879047192, NONCE = -1879047191, MAC_LENGTH = 805307371, diff --git a/security/keymint/aidl/android/hardware/security/keymint/Tag.aidl b/security/keymint/aidl/android/hardware/security/keymint/Tag.aidl index 47361d5536..837fc814a9 100644 --- a/security/keymint/aidl/android/hardware/security/keymint/Tag.aidl +++ b/security/keymint/aidl/android/hardware/security/keymint/Tag.aidl @@ -726,9 +726,10 @@ enum Tag { ATTESTATION_ID_SERIAL = TagType.BYTES | 713, /** - * Tag::ATTESTATION_ID_IMEI provides the IMEIs for all radios on the device to attested key + * Tag::ATTESTATION_ID_IMEI provides the IMEI one of the radios on the device to attested key * generation/import operations. This field must be set only when requesting attestation of the - * device's identifiers. + * device's identifiers. If the device has more than one IMEI, a second IMEI may be included + * by using the Tag::ATTESTATION_ID_SECOND_IMEI tag. * * If the device does not support ID attestation (or destroyAttestationIds() was previously * called and the device can no longer attest its IDs), any key attestation request that @@ -882,6 +883,20 @@ enum Tag { */ STORAGE_KEY = TagType.BOOL | 722, + /** + * Tag::ATTESTATION_ID_SECOND_IMEI provides an additional IMEI of one of the radios on the + * device to attested key generation/import operations. This field MUST be accompanied by + * the Tag::ATTESTATION_ID_IMEI tag. It would only be used to convery a second IMEI the device + * has, after Tag::ATTESTATION_ID_SECOND_IMEI has been used to convery the first IMEI. + * + * If the device does not support ID attestation (or destroyAttestationIds() was previously + * called and the device can no longer attest its IDs), any key attestation request that + * includes this tag must fail with ErrorCode::CANNOT_ATTEST_IDS. + * + * Must never appear in KeyCharacteristics. + */ + ATTESTATION_ID_SECOND_IMEI = TagType.BYTES | 723, + /** * OBSOLETE: Do not use. * From 8a1d60edfabb1ecdcb3910b608a41e28757382c8 Mon Sep 17 00:00:00 2001 From: Seth Moore Date: Fri, 4 Nov 2022 17:39:05 +0000 Subject: [PATCH 348/998] Revert^2 "Split rkp from keymint." ccbb5d8a61401567605e4bc297a7a2b46d90bb22 Change-Id: I3734bd7647cbb7b33ef654ba2fb40fe8a648689e --- .../android.hardware.security.keymint/1/.hash | 1 + .../android.hardware.security.keymint/2/.hash | 1 + security/rkp/aidl/Android.bp | 37 +++++++++++++++++++ .../android.hardware.security.rkp/1/.hash | 1 + .../hardware/security/keymint/DeviceInfo.aidl | 0 .../IRemotelyProvisionedComponent.aidl | 0 .../security/keymint/MacedPublicKey.aidl | 0 .../security/keymint/ProtectedData.aidl | 0 .../security/keymint/RpcHardwareInfo.aidl | 0 .../android.hardware.security.rkp/2/.hash | 1 + .../hardware/security/keymint/DeviceInfo.aidl | 0 .../IRemotelyProvisionedComponent.aidl | 0 .../security/keymint/MacedPublicKey.aidl | 0 .../security/keymint/ProtectedData.aidl | 0 .../security/keymint/RpcHardwareInfo.aidl | 0 .../hardware/security/keymint/DeviceInfo.aidl | 0 .../IRemotelyProvisionedComponent.aidl | 0 .../security/keymint/MacedPublicKey.aidl | 0 .../security/keymint/ProtectedData.aidl | 0 .../security/keymint/RpcHardwareInfo.aidl | 0 .../hardware/security/keymint/DeviceInfo.aidl | 0 .../IRemotelyProvisionedComponent.aidl | 0 .../security/keymint/MacedPublicKey.aidl | 0 .../security/keymint/ProtectedData.aidl | 0 .../security/keymint/RpcHardwareInfo.aidl | 0 25 files changed, 41 insertions(+) create mode 100644 security/rkp/aidl/Android.bp create mode 100644 security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/.hash rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/1/android/hardware/security/keymint/DeviceInfo.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/1/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/1/android/hardware/security/keymint/MacedPublicKey.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/1/android/hardware/security/keymint/ProtectedData.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/1/android/hardware/security/keymint/RpcHardwareInfo.aidl (100%) create mode 100644 security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/.hash rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/2/android/hardware/security/keymint/DeviceInfo.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/2/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/2/android/hardware/security/keymint/MacedPublicKey.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/2/android/hardware/security/keymint/ProtectedData.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/2/android/hardware/security/keymint/RpcHardwareInfo.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/current/android/hardware/security/keymint/DeviceInfo.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/current/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/current/android/hardware/security/keymint/MacedPublicKey.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/current/android/hardware/security/keymint/ProtectedData.aidl (100%) rename security/{keymint/aidl/aidl_api/android.hardware.security.keymint => rkp/aidl/aidl_api/android.hardware.security.rkp}/current/android/hardware/security/keymint/RpcHardwareInfo.aidl (100%) rename security/{keymint => rkp}/aidl/android/hardware/security/keymint/DeviceInfo.aidl (100%) rename security/{keymint => rkp}/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl (100%) rename security/{keymint => rkp}/aidl/android/hardware/security/keymint/MacedPublicKey.aidl (100%) rename security/{keymint => rkp}/aidl/android/hardware/security/keymint/ProtectedData.aidl (100%) rename security/{keymint => rkp}/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl (100%) diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/.hash b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/.hash index b712a5231b..3a6d4157d1 100644 --- a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/.hash +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/.hash @@ -1 +1,2 @@ 976674616001f714f4a4df49ee45f548de828524 +cd862ae2e49b54fc965dc1b99c218eb729c93bb1 diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/.hash b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/.hash index 69ba9a6bc5..b4c2b78a70 100644 --- a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/.hash +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/.hash @@ -1 +1,2 @@ 207c9f218b9b9e4e74ff5232eb16511eca9d7d2e +70c734fbd5cac5b36676d66d8d9aa941967e1e7b diff --git a/security/rkp/aidl/Android.bp b/security/rkp/aidl/Android.bp new file mode 100644 index 0000000000..4c479f4642 --- /dev/null +++ b/security/rkp/aidl/Android.bp @@ -0,0 +1,37 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +aidl_interface { + name: "android.hardware.security.rkp", + vendor_available: true, + srcs: [ + // This HAL was originally part of keymint. + "android/hardware/security/keymint/*.aidl", + + // in the future + // "android/hardware/security/rkp/*.aidl", + ], + stability: "vintf", + backend: { + java: { + min_sdk_version: "33", + }, + rust: { + enabled: true, + }, + }, + versions_with_info: [ + { + version: "1", + }, + { + version: "2", + }, + ], +} diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/.hash b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/.hash new file mode 100644 index 0000000000..404553bf36 --- /dev/null +++ b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/.hash @@ -0,0 +1 @@ +d285480d2e0002adc0ace80edf34aa725679512e diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/DeviceInfo.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/DeviceInfo.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/DeviceInfo.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/DeviceInfo.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/MacedPublicKey.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/MacedPublicKey.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/MacedPublicKey.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/MacedPublicKey.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/ProtectedData.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/ProtectedData.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/ProtectedData.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/ProtectedData.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/RpcHardwareInfo.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/RpcHardwareInfo.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/1/android/hardware/security/keymint/RpcHardwareInfo.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/1/android/hardware/security/keymint/RpcHardwareInfo.aidl diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/.hash b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/.hash new file mode 100644 index 0000000000..8700d33656 --- /dev/null +++ b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/.hash @@ -0,0 +1 @@ +c8d34e56ae0807b61f028019622d8b60a37e0a8b diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/DeviceInfo.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/DeviceInfo.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/DeviceInfo.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/DeviceInfo.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/MacedPublicKey.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/MacedPublicKey.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/MacedPublicKey.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/MacedPublicKey.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/ProtectedData.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/ProtectedData.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/ProtectedData.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/ProtectedData.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/RpcHardwareInfo.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/RpcHardwareInfo.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/2/android/hardware/security/keymint/RpcHardwareInfo.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/2/android/hardware/security/keymint/RpcHardwareInfo.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/DeviceInfo.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/DeviceInfo.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/DeviceInfo.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/DeviceInfo.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/MacedPublicKey.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/MacedPublicKey.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/MacedPublicKey.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/MacedPublicKey.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/ProtectedData.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/ProtectedData.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/ProtectedData.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/ProtectedData.aidl diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/RpcHardwareInfo.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/RpcHardwareInfo.aidl similarity index 100% rename from security/keymint/aidl/aidl_api/android.hardware.security.keymint/current/android/hardware/security/keymint/RpcHardwareInfo.aidl rename to security/rkp/aidl/aidl_api/android.hardware.security.rkp/current/android/hardware/security/keymint/RpcHardwareInfo.aidl diff --git a/security/keymint/aidl/android/hardware/security/keymint/DeviceInfo.aidl b/security/rkp/aidl/android/hardware/security/keymint/DeviceInfo.aidl similarity index 100% rename from security/keymint/aidl/android/hardware/security/keymint/DeviceInfo.aidl rename to security/rkp/aidl/android/hardware/security/keymint/DeviceInfo.aidl diff --git a/security/keymint/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl b/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl similarity index 100% rename from security/keymint/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl rename to security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl diff --git a/security/keymint/aidl/android/hardware/security/keymint/MacedPublicKey.aidl b/security/rkp/aidl/android/hardware/security/keymint/MacedPublicKey.aidl similarity index 100% rename from security/keymint/aidl/android/hardware/security/keymint/MacedPublicKey.aidl rename to security/rkp/aidl/android/hardware/security/keymint/MacedPublicKey.aidl diff --git a/security/keymint/aidl/android/hardware/security/keymint/ProtectedData.aidl b/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl similarity index 100% rename from security/keymint/aidl/android/hardware/security/keymint/ProtectedData.aidl rename to security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl diff --git a/security/keymint/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl b/security/rkp/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl similarity index 100% rename from security/keymint/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl rename to security/rkp/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl From f6b3772360ea0e83a7c4d779e25a9b7502c15e64 Mon Sep 17 00:00:00 2001 From: Seth Moore Date: Fri, 4 Nov 2022 17:39:05 +0000 Subject: [PATCH 349/998] Revert^2 "Update README and CHANGELOG for RKP" 0a14f7cf32fc30b3ad74a6d2a88cbae0129e08dc Change-Id: Ib66fcbdbaadda3f32cd8423f61bd31d5f43dc44b --- security/keymint/README.md | 10 ++++++++++ .../RKP_CHANGELOG.md => rkp/CHANGELOG.md} | 6 ++++++ .../{keymint/RKP_README.md => rkp/README.md} | 16 ++++++++-------- 3 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 security/keymint/README.md rename security/{keymint/RKP_CHANGELOG.md => rkp/CHANGELOG.md} (79%) rename security/{keymint/RKP_README.md => rkp/README.md} (95%) diff --git a/security/keymint/README.md b/security/keymint/README.md new file mode 100644 index 0000000000..54647af659 --- /dev/null +++ b/security/keymint/README.md @@ -0,0 +1,10 @@ +# KeyMint HAL + +This directory contains the HAL definition for KeyMint. KeyMint provides +cryptographic services in a hardware-isolated environment. + +Note that the `IRemotelyProvisionedComponent` HAL, and it's associated types, +used to also be defined in this directory. As of Android U, this HAL has been +moved to a different directory (../rkp). This move is ABI compatible, as the +interfaces have been maintained. The build is split so that the generated +code may be built with different options. diff --git a/security/keymint/RKP_CHANGELOG.md b/security/rkp/CHANGELOG.md similarity index 79% rename from security/keymint/RKP_CHANGELOG.md rename to security/rkp/CHANGELOG.md index 243fc26525..eb2041d146 100644 --- a/security/keymint/RKP_CHANGELOG.md +++ b/security/rkp/CHANGELOG.md @@ -19,6 +19,12 @@ This document provides an exact description of which changes have occurred in th * `uniqueId` String added as a field in order to differentiate IRPC instances on device. ## IRemotelyProvisionedComponent 2 -> 3 +* The RKP HAL now builds separately from KeyMint. + * The HAL remains under the `android.hardware.security.keymint` package for + compatibility with previous releases. ABI compatibility requires this. + * Dependencies on the RKP HAL must add a dependency on + `"android.hardware.security.rkp"` generated code (instead of + `"android.hardward.security.keymint"`). * ProtectedData has been removed. * DeviceInfo * `version` has moved to a top-level field within the CSR generated by the HAL diff --git a/security/keymint/RKP_README.md b/security/rkp/README.md similarity index 95% rename from security/keymint/RKP_README.md rename to security/rkp/README.md index 89a2598f66..5fb49486ce 100644 --- a/security/keymint/RKP_README.md +++ b/security/rkp/README.md @@ -6,8 +6,8 @@ Design a HAL to support over-the-air provisioning of certificates for asymmetric keys. The HAL must interact effectively with Keystore (and other daemons) and protect device privacy and security. -Note that this API is designed for KeyMint, but with the intention that it -should be usable for other HALs that require certificate provisioning. +Note that this API was originally designed for KeyMint, with the intention that +it should be usable for other HALs that require certificate provisioning. Throughout this document we'll refer to the Keystore and KeyMint (formerly called Keymaster) components, but only for concreteness and convenience; those labels could be replaced with the names of any system and secure area @@ -312,7 +312,7 @@ the range \[-70000, -70999\] (these are reserved for future additions here). ``` Please see -[ProtectedData.aidl](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/keymint/aidl/android/hardware/security/keymint/ProtectedData.aidl) +[ProtectedData.aidl](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl) for a full CDDL definition of the BCC. ### `CertificateRequest` @@ -366,9 +366,9 @@ Please see the related HAL documentation directly in the source code at the following links: * [IRemotelyProvisionedComponent - HAL](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/keymint/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl) -* [ProtectedData](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/keymint/aidl/android/hardware/security/keymint/ProtectedData.aidl) -* [MacedPublicKey](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/keymint/aidl/android/hardware/security/keymint/MacedPublicKey.aidl) -* [RpcHardwareInfo](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/keymint/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl) -* [DeviceInfo](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/keymint/aidl/android/hardware/security/keymint/DeviceInfo.aidl) + HAL](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl) +* [ProtectedData](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl) +* [MacedPublicKey](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/rkp/aidl/android/hardware/security/keymint/MacedPublicKey.aidl) +* [RpcHardwareInfo](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/rkp/aidl/android/hardware/security/keymint/RpcHardwareInfo.aidl) +* [DeviceInfo](https://cs.android.com/android/platform/superproject/+/master:hardware/interfaces/security/rkp/aidl/android/hardware/security/keymint/DeviceInfo.aidl) From f8aea9b98f3c7c0fe1eb6765619d0b2d9c0667b0 Mon Sep 17 00:00:00 2001 From: Seth Moore Date: Fri, 4 Nov 2022 17:39:05 +0000 Subject: [PATCH 350/998] Revert^2 "Update the RKP aidl dependency" f001a413ce1bbfa7d2b5521a888614314631bf46 Change-Id: I86f864003e38224936375930891abb38f7d55d3d --- identity/aidl/Android.bp | 12 ++++++------ identity/aidl/default/Android.bp | 2 ++ identity/aidl/vts/Android.bp | 2 ++ security/keymint/aidl/default/Android.bp | 1 + security/keymint/aidl/vts/functional/Android.bp | 1 + security/keymint/support/Android.bp | 3 +++ 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/identity/aidl/Android.bp b/identity/aidl/Android.bp index f568f7ac54..c05dd33dc9 100644 --- a/identity/aidl/Android.bp +++ b/identity/aidl/Android.bp @@ -15,10 +15,10 @@ aidl_interface { ], imports: [ "android.hardware.keymaster-V3", - "android.hardware.security.keymint-V3", + "android.hardware.security.rkp-V3", ], stability: "vintf", - frozen: false, + frozen: true, backend: { java: { platform_apis: true, @@ -32,28 +32,28 @@ aidl_interface { version: "1", imports: [ "android.hardware.keymaster-V3", - "android.hardware.security.keymint-V1", + "android.hardware.security.rkp-V1", ], }, { version: "2", imports: [ "android.hardware.keymaster-V3", - "android.hardware.security.keymint-V1", + "android.hardware.security.rkp-V1", ], }, { version: "3", imports: [ "android.hardware.keymaster-V3", - "android.hardware.security.keymint-V1", + "android.hardware.security.rkp-V1", ], }, { version: "4", imports: [ "android.hardware.keymaster-V3", - "android.hardware.security.keymint-V2", + "android.hardware.security.rkp-V3", ], }, diff --git a/identity/aidl/default/Android.bp b/identity/aidl/default/Android.bp index a57875aee5..7bc3c8de8e 100644 --- a/identity/aidl/default/Android.bp +++ b/identity/aidl/default/Android.bp @@ -45,6 +45,7 @@ cc_library_static { "libpuresoftkeymasterdevice", "android.hardware.identity-support-lib", "android.hardware.keymaster-V3-ndk", + "android.hardware.security.rkp-V3-ndk", ], } @@ -112,6 +113,7 @@ cc_binary { "android.hardware.keymaster-V3-ndk", "android.hardware.identity-libeic-hal-common", "android.hardware.identity-libeic-library", + "android.hardware.security.rkp-V3-ndk", ], srcs: [ "service.cpp", diff --git a/identity/aidl/vts/Android.bp b/identity/aidl/vts/Android.bp index 54bf88739b..5e303bb7cf 100644 --- a/identity/aidl/vts/Android.bp +++ b/identity/aidl/vts/Android.bp @@ -39,6 +39,8 @@ cc_test { "libcrypto", ], static_libs: [ + "android.hardware.security.rkp-V3-cpp", + "android.hardware.security.rkp-V3-ndk", "android.hardware.security.secureclock-V1-ndk", "libcppbor_external", "libcppcose_rkp", diff --git a/security/keymint/aidl/default/Android.bp b/security/keymint/aidl/default/Android.bp index 1a17fd4f71..17520b73c7 100644 --- a/security/keymint/aidl/default/Android.bp +++ b/security/keymint/aidl/default/Android.bp @@ -25,6 +25,7 @@ cc_binary { "keymint_use_latest_hal_aidl_ndk_shared", ], shared_libs: [ + "android.hardware.security.rkp-V3-ndk", "android.hardware.security.sharedsecret-V1-ndk", "android.hardware.security.secureclock-V1-ndk", "libbase", diff --git a/security/keymint/aidl/vts/functional/Android.bp b/security/keymint/aidl/vts/functional/Android.bp index ef5b0bda73..13143bf620 100644 --- a/security/keymint/aidl/vts/functional/Android.bp +++ b/security/keymint/aidl/vts/functional/Android.bp @@ -35,6 +35,7 @@ cc_defaults { "libcrypto", ], static_libs: [ + "android.hardware.security.rkp-V3-ndk", "android.hardware.security.secureclock-V1-ndk", "libcppbor_external", "libcppcose_rkp", diff --git a/security/keymint/support/Android.bp b/security/keymint/support/Android.bp index 3f4832085c..891bb2cb46 100644 --- a/security/keymint/support/Android.bp +++ b/security/keymint/support/Android.bp @@ -63,6 +63,9 @@ cc_library { defaults: [ "keymint_use_latest_hal_aidl_ndk_shared", ], + static_libs: [ + "android.hardware.security.rkp-V3-ndk", + ], shared_libs: [ "libbase", "libbinder_ndk", From c5d4f36a4fc8dde2da310b6acdd86319e96a0b23 Mon Sep 17 00:00:00 2001 From: Yu-Han Yang Date: Fri, 4 Nov 2022 22:55:32 +0000 Subject: [PATCH 351/998] Add isFullTracking to GnssData Bug: 257549183 Test: atest VtsHalGnssTargetTest Change-Id: Icd2ad1e6905fcc76370216fafe34174475497b5f --- .../android/hardware/gnss/GnssData.aidl | 1 + gnss/aidl/android/hardware/gnss/GnssData.aidl | 11 ++++ gnss/aidl/default/Gnss.cpp | 4 +- .../aidl/default/GnssMeasurementInterface.cpp | 12 ++-- gnss/aidl/default/GnssMeasurementInterface.h | 2 +- gnss/aidl/vts/GnssMeasurementCallbackAidl.cpp | 6 +- gnss/aidl/vts/gnss_hal_test.cpp | 20 ++++++ gnss/aidl/vts/gnss_hal_test.h | 3 + gnss/aidl/vts/gnss_hal_test_cases.cpp | 61 +++++++++++++++++-- gnss/common/utils/default/Utils.cpp | 5 +- gnss/common/utils/default/include/Utils.h | 2 +- 11 files changed, 110 insertions(+), 17 deletions(-) diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssData.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssData.aidl index 31426f0507..54e3b2165e 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssData.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssData.aidl @@ -39,6 +39,7 @@ parcelable GnssData { android.hardware.gnss.GnssClock clock; android.hardware.gnss.ElapsedRealtime elapsedRealtime; android.hardware.gnss.GnssData.GnssAgc[] gnssAgcs = {}; + boolean isFullTracking; @VintfStability parcelable GnssAgc { double agcLevelDb; diff --git a/gnss/aidl/android/hardware/gnss/GnssData.aidl b/gnss/aidl/android/hardware/gnss/GnssData.aidl index 075a0391e2..492ba3113a 100644 --- a/gnss/aidl/android/hardware/gnss/GnssData.aidl +++ b/gnss/aidl/android/hardware/gnss/GnssData.aidl @@ -99,4 +99,15 @@ parcelable GnssData { * weak to be acquired, the AGC value must still be reported. */ GnssAgc[] gnssAgcs = {}; + + /** + * True indicates that the GNSS chipset switches off duty cycling. In such mode, no clock + * discontinuities are expected and, when supported, carrier phase should be continuous in good + * signal conditions. All non-blocklisted, healthy constellations, satellites and frequency + * bands must be tracked and reported in this mode. + * + * False indicates that the GNSS chipset optimizes power via duty cycling, constellations and + * frequency limits, etc. + */ + boolean isFullTracking; } diff --git a/gnss/aidl/default/Gnss.cpp b/gnss/aidl/default/Gnss.cpp index 8a4d186131..2690bb2a39 100644 --- a/gnss/aidl/default/Gnss.cpp +++ b/gnss/aidl/default/Gnss.cpp @@ -76,12 +76,12 @@ ScopedAStatus Gnss::setCallback(const std::shared_ptr& callback) } GnssSignalType signalType1 = { .constellation = GnssConstellationType::GPS, - .carrierFrequencyHz = 1.59975e+09, + .carrierFrequencyHz = 1.57542e+09, .codeType = GnssSignalType::CODE_TYPE_C, }; GnssSignalType signalType2 = { .constellation = GnssConstellationType::GLONASS, - .carrierFrequencyHz = 1.59975e+09, + .carrierFrequencyHz = 1.5980625e+09, .codeType = GnssSignalType::CODE_TYPE_C, }; status = sGnssCallback->gnssSetSignalTypeCapabilitiesCb( diff --git a/gnss/aidl/default/GnssMeasurementInterface.cpp b/gnss/aidl/default/GnssMeasurementInterface.cpp index 606de07367..90056ce617 100644 --- a/gnss/aidl/default/GnssMeasurementInterface.cpp +++ b/gnss/aidl/default/GnssMeasurementInterface.cpp @@ -54,7 +54,7 @@ ndk::ScopedAStatus GnssMeasurementInterface::setCallback( ALOGW("GnssMeasurement callback already set. Resetting the callback..."); stop(); } - start(enableCorrVecOutputs); + start(enableCorrVecOutputs, enableFullTracking); return ndk::ScopedAStatus::ok(); } @@ -73,7 +73,7 @@ ndk::ScopedAStatus GnssMeasurementInterface::setCallbackWithOptions( stop(); } mIntervalMs = std::max(options.intervalMs, 1000); - start(options.enableCorrVecOutputs); + start(options.enableCorrVecOutputs, options.enableFullTracking); return ndk::ScopedAStatus::ok(); } @@ -91,7 +91,8 @@ ndk::ScopedAStatus GnssMeasurementInterface::close() { return ndk::ScopedAStatus::ok(); } -void GnssMeasurementInterface::start(const bool enableCorrVecOutputs) { +void GnssMeasurementInterface::start(const bool enableCorrVecOutputs, + const bool enableFullTracking) { ALOGD("start"); if (mIsActive) { @@ -103,7 +104,7 @@ void GnssMeasurementInterface::start(const bool enableCorrVecOutputs) { mIsActive = true; mThreadBlocker.reset(); - mThread = std::thread([this, enableCorrVecOutputs]() { + mThread = std::thread([this, enableCorrVecOutputs, enableFullTracking]() { int intervalMs; do { if (!mIsActive) { @@ -122,7 +123,8 @@ void GnssMeasurementInterface::start(const bool enableCorrVecOutputs) { this->reportMeasurement(*measurement); } } else { - auto measurement = Utils::getMockMeasurement(enableCorrVecOutputs); + auto measurement = + Utils::getMockMeasurement(enableCorrVecOutputs, enableFullTracking); this->reportMeasurement(measurement); } intervalMs = diff --git a/gnss/aidl/default/GnssMeasurementInterface.h b/gnss/aidl/default/GnssMeasurementInterface.h index bb08027568..d2737e5206 100644 --- a/gnss/aidl/default/GnssMeasurementInterface.h +++ b/gnss/aidl/default/GnssMeasurementInterface.h @@ -41,7 +41,7 @@ struct GnssMeasurementInterface : public BnGnssMeasurementInterface { void setLocationEnabled(const bool enabled); private: - void start(const bool enableCorrVecOutputs); + void start(const bool enableCorrVecOutputs, const bool enableFullTracking); void stop(); void reportMeasurement(const GnssData&); void waitForStoppingThreads(); diff --git a/gnss/aidl/vts/GnssMeasurementCallbackAidl.cpp b/gnss/aidl/vts/GnssMeasurementCallbackAidl.cpp index a553954a97..0d15b2ad51 100644 --- a/gnss/aidl/vts/GnssMeasurementCallbackAidl.cpp +++ b/gnss/aidl/vts/GnssMeasurementCallbackAidl.cpp @@ -24,9 +24,11 @@ using android::hardware::gnss::GnssData; android::binder::Status GnssMeasurementCallbackAidl::gnssMeasurementCb(const GnssData& gnssData) { ALOGI("gnssMeasurementCb"); - ALOGV("elapsedRealtime: flags = 0x%X, timestampNs: %" PRId64 ", timeUncertaintyNs=%lf", + ALOGV("elapsedRealtime: flags = 0x%X, timestampNs: %" PRId64 + ", timeUncertaintyNs=%lf" + " isFullTracking=%s", gnssData.elapsedRealtime.flags, gnssData.elapsedRealtime.timestampNs, - gnssData.elapsedRealtime.timeUncertaintyNs); + gnssData.elapsedRealtime.timeUncertaintyNs, gnssData.isFullTracking ? "true" : "false"); gnss_data_cbq_.store(gnssData); return android::binder::Status::ok(); diff --git a/gnss/aidl/vts/gnss_hal_test.cpp b/gnss/aidl/vts/gnss_hal_test.cpp index 91cd9175bc..b4f2b773f3 100644 --- a/gnss/aidl/vts/gnss_hal_test.cpp +++ b/gnss/aidl/vts/gnss_hal_test.cpp @@ -477,6 +477,26 @@ void GnssHalTest::collectMeasurementIntervals(const sp& callback, + const int numMeasurementEvents, const int timeoutSeconds, + const bool isFullTracking) { + for (int i = 0; i < numMeasurementEvents; i++) { + GnssData lastGnssData; + ASSERT_TRUE(callback->gnss_data_cbq_.retrieve(lastGnssData, timeoutSeconds)); + EXPECT_EQ(callback->gnss_data_cbq_.calledCount(), i + 1); + ASSERT_TRUE(lastGnssData.measurements.size() > 0); + + // Validity check GnssData fields + checkGnssMeasurementClockFields(lastGnssData); + if (aidl_gnss_hal_->getInterfaceVersion() >= 3) { + EXPECT_EQ(lastGnssData.isFullTracking, isFullTracking); + } + for (const auto& measurement : lastGnssData.measurements) { + checkGnssMeasurementFields(measurement, lastGnssData); + } + } +} + void GnssHalTest::assertMeanAndStdev(int intervalMs, std::vector& deltasMs) { double mean = computeMean(deltasMs); double stdev = computeStdev(mean, deltasMs); diff --git a/gnss/aidl/vts/gnss_hal_test.h b/gnss/aidl/vts/gnss_hal_test.h index c49c1b9204..470294ca31 100644 --- a/gnss/aidl/vts/gnss_hal_test.h +++ b/gnss/aidl/vts/gnss_hal_test.h @@ -101,6 +101,9 @@ class GnssHalTest : public android::hardware::gnss::common::GnssHalTestTemplate< void collectMeasurementIntervals(const sp& callback, const int numMeasurementEvents, const int timeoutSeconds, std::vector& deltaMs); + void checkGnssDataFields(const sp& callback, + const int numMeasurementEvents, const int timeoutSeconds, + const bool isFullTracking); void assertMeanAndStdev(int intervalMillis, std::vector& deltasMillis); sp aidl_gnss_hal_; diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp index 7c0a4df6d5..31cef150e3 100644 --- a/gnss/aidl/vts/gnss_hal_test_cases.cpp +++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp @@ -173,6 +173,7 @@ TEST_P(GnssHalTest, InjectSeedLocation) { * GnssCapabilities: * 1. Verifies that GNSS hardware supports measurement capabilities. * 2. Verifies that GNSS hardware supports Scheduling capabilities. + * 3. Verifies that GNSS hardware supports non-empty signal type capabilities. */ TEST_P(GnssHalTest, GnssCapabilites) { if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { @@ -182,6 +183,10 @@ TEST_P(GnssHalTest, GnssCapabilites) { EXPECT_TRUE(aidl_gnss_cb_->last_capabilities_ & IGnssCallback::CAPABILITY_MEASUREMENTS); } EXPECT_TRUE(aidl_gnss_cb_->last_capabilities_ & IGnssCallback::CAPABILITY_SCHEDULING); + if (aidl_gnss_hal_->getInterfaceVersion() <= 2) { + return; + } + EXPECT_FALSE(aidl_gnss_cb_->last_signal_type_capabilities.empty()); } /* @@ -1466,7 +1471,7 @@ TEST_P(GnssHalTest, TestGnssMeasurementIntervals_LocationOnBeforeMeasurement) { /* * TestGnssMeasurementIntervals: * 1. start measurement with interval - * 2. verify that the received measurement intervals have expected mean and stdev + * 2. verify that the received measurement intervals have expected mean and stddev */ TEST_P(GnssHalTest, TestGnssMeasurementIntervals_LocationOnAfterMeasurement) { if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { @@ -1499,11 +1504,17 @@ TEST_P(GnssHalTest, TestGnssMeasurementIntervals_LocationOnAfterMeasurement) { } } +/* + * TestGnssMeasurementSetCallback + * 1. Start measurement with 20s interval. Expect the first measurement received in 10s. + * 2. Start measurement with 1s interval and wait for 5 measurements. + * 3. Verify the received measurement intervals have expected mean and stddev. + */ TEST_P(GnssHalTest, TestGnssMeasurementSetCallback) { if (aidl_gnss_hal_->getInterfaceVersion() <= 2) { return; } - + const int kFirstGnssMeasurementTimeoutSeconds = 10; sp iGnssMeasurement; auto status = aidl_gnss_hal_->getExtensionGnssMeasurement(&iGnssMeasurement); ASSERT_TRUE(status.isOk()); @@ -1515,12 +1526,14 @@ TEST_P(GnssHalTest, TestGnssMeasurementSetCallback) { // setCallback at 20s interval and wait for 1 measurement startMeasurementWithInterval(20000, iGnssMeasurement, callback); - collectMeasurementIntervals(callback, /* numEvents= */ 1, /* timeoutSeconds= */ 10, deltas); + collectMeasurementIntervals(callback, /* numEvents= */ 1, kFirstGnssMeasurementTimeoutSeconds, + deltas); // setCallback at 1s interval and wait for 5 measurements callback->gnss_data_cbq_.reset(); startMeasurementWithInterval(1000, iGnssMeasurement, callback); - collectMeasurementIntervals(callback, /* numEvents= */ 5, /* timeoutSeconds= */ 10, deltas); + collectMeasurementIntervals(callback, /* numEvents= */ 5, kFirstGnssMeasurementTimeoutSeconds, + deltas); // verify the measurements were received at 1Hz assertMeanAndStdev(1000, deltas); @@ -1528,3 +1541,43 @@ TEST_P(GnssHalTest, TestGnssMeasurementSetCallback) { status = iGnssMeasurement->close(); ASSERT_TRUE(status.isOk()); } + +/* + * TestGnssMeasurementIsFullTracking + * 1. Start measurement with enableFullTracking=true. Verify the received measurements have + * isFullTracking=true. + * 2. Start measurement with enableFullTracking = false. Verify the received measurements have + * isFullTracking=false. + * 3. Do step 1 again. + */ +TEST_P(GnssHalTest, TestGnssMeasurementIsFullTracking) { + // GnssData.isFullTracking is added in the interface version 3 + if (aidl_gnss_hal_->getInterfaceVersion() <= 2) { + return; + } + const int kFirstGnssMeasurementTimeoutSeconds = 10; + const int kNumMeasurementEvents = 5; + std::vector isFullTrackingList({true, false, true}); + + sp iGnssMeasurement; + auto status = aidl_gnss_hal_->getExtensionGnssMeasurement(&iGnssMeasurement); + ASSERT_TRUE(status.isOk()); + ASSERT_TRUE(iGnssMeasurement != nullptr); + + ALOGD("TestGnssMeasurementIsFullTracking"); + auto callback = sp::make(); + IGnssMeasurementInterface::Options options; + options.intervalMs = 1000; + + for (auto isFullTracking : isFullTrackingList) { + options.enableFullTracking = isFullTracking; + + callback->gnss_data_cbq_.reset(); + auto status = iGnssMeasurement->setCallbackWithOptions(callback, options); + checkGnssDataFields(callback, kNumMeasurementEvents, kFirstGnssMeasurementTimeoutSeconds, + isFullTracking); + } + + status = iGnssMeasurement->close(); + ASSERT_TRUE(status.isOk()); +} diff --git a/gnss/common/utils/default/Utils.cpp b/gnss/common/utils/default/Utils.cpp index 4de49f376c..ad351f82c9 100644 --- a/gnss/common/utils/default/Utils.cpp +++ b/gnss/common/utils/default/Utils.cpp @@ -147,7 +147,7 @@ GnssDataV2_0 Utils::getMockMeasurementV2_0() { return gnssData; } -GnssData Utils::getMockMeasurement(const bool enableCorrVecOutputs) { +GnssData Utils::getMockMeasurement(const bool enableCorrVecOutputs, const bool enableFullTracking) { aidl::android::hardware::gnss::GnssSignalType signalType = { .constellation = GnssConstellationType::GLONASS, .carrierFrequencyHz = 1.59975e+09, @@ -258,7 +258,8 @@ GnssData Utils::getMockMeasurement(const bool enableCorrVecOutputs) { GnssData gnssData = {.measurements = {measurement}, .clock = clock, .elapsedRealtime = timestamp, - .gnssAgcs = std::vector({gnssAgc1, gnssAgc2})}; + .gnssAgcs = std::vector({gnssAgc1, gnssAgc2}), + .isFullTracking = enableFullTracking}; return gnssData; } diff --git a/gnss/common/utils/default/include/Utils.h b/gnss/common/utils/default/include/Utils.h index ad8f539248..9be4a195d7 100644 --- a/gnss/common/utils/default/include/Utils.h +++ b/gnss/common/utils/default/include/Utils.h @@ -32,7 +32,7 @@ namespace common { struct Utils { static aidl::android::hardware::gnss::GnssData getMockMeasurement( - const bool enableCorrVecOutputs); + const bool enableCorrVecOutputs, const bool enableFullTracking); static V2_0::IGnssMeasurementCallback::GnssData getMockMeasurementV2_0(); static V2_1::IGnssMeasurementCallback::GnssData getMockMeasurementV2_1(); From 845aca61348bd6590e31a9d359652f4c17eb4dad Mon Sep 17 00:00:00 2001 From: Seth Moore Date: Tue, 8 Nov 2022 15:51:01 -0800 Subject: [PATCH 352/998] Add missing dependency on RKP HAL Bug: 258288484 Test: libkeymint_remote_prov_support_test Change-Id: I032d30e5f46aa3fc0dd7b95373180b9653ccbf23 --- security/keymint/support/Android.bp | 1 + 1 file changed, 1 insertion(+) diff --git a/security/keymint/support/Android.bp b/security/keymint/support/Android.bp index 891bb2cb46..efd6fc7800 100644 --- a/security/keymint/support/Android.bp +++ b/security/keymint/support/Android.bp @@ -81,6 +81,7 @@ cc_test { name: "libkeymint_remote_prov_support_test", srcs: ["remote_prov_utils_test.cpp"], static_libs: [ + "android.hardware.security.rkp-V3-ndk", "libgmock", "libgtest_main", ], From 1a5f1ccfce831694e16b05fa08604e1f37b2c30a Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Wed, 2 Nov 2022 06:28:35 +0000 Subject: [PATCH 353/998] Update libradiocompat for IRadioIms in CF Bug: 216387835 Bug: 250912118 Test: atest VtsHalRadioTargetTest Change-Id: I0761c7e3111a3f5a008a9b55ef3c068f3fe0702c --- radio/aidl/compat/libradiocompat/Android.bp | 4 + .../compat/libradiocompat/ims/RadioIms.cpp | 88 +++++++++++++++++++ .../ims/RadioIndication-ims.cpp | 39 ++++++++ .../libradiocompat/ims/RadioResponse-ims.cpp | 38 ++++++++ .../include/libradiocompat/RadioIms.h | 62 +++++++++++++ .../include/libradiocompat/RadioIndication.h | 8 ++ .../include/libradiocompat/RadioResponse.h | 7 ++ radio/aidl/compat/service/Android.bp | 1 + 8 files changed, 247 insertions(+) create mode 100644 radio/aidl/compat/libradiocompat/ims/RadioIms.cpp create mode 100644 radio/aidl/compat/libradiocompat/ims/RadioIndication-ims.cpp create mode 100644 radio/aidl/compat/libradiocompat/ims/RadioResponse-ims.cpp create mode 100644 radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIms.h diff --git a/radio/aidl/compat/libradiocompat/Android.bp b/radio/aidl/compat/libradiocompat/Android.bp index f79e045f63..0ceaec49dd 100644 --- a/radio/aidl/compat/libradiocompat/Android.bp +++ b/radio/aidl/compat/libradiocompat/Android.bp @@ -37,6 +37,7 @@ cc_library { "android.hardware.radio.config@1.2", "android.hardware.radio.config@1.3", "android.hardware.radio.data-V1-ndk", + "android.hardware.radio.ims-V1-ndk", "android.hardware.radio.messaging-V1-ndk", "android.hardware.radio.modem-V1-ndk", "android.hardware.radio.network-V2-ndk", @@ -69,6 +70,9 @@ cc_library { "data/RadioResponse-data.cpp", "data/RadioData.cpp", "data/structs.cpp", + "ims/RadioIndication-ims.cpp", + "ims/RadioResponse-ims.cpp", + "ims/RadioIms.cpp", "messaging/RadioIndication-messaging.cpp", "messaging/RadioMessaging.cpp", "messaging/RadioResponse-messaging.cpp", diff --git a/radio/aidl/compat/libradiocompat/ims/RadioIms.cpp b/radio/aidl/compat/libradiocompat/ims/RadioIms.cpp new file mode 100644 index 0000000000..d2bdfff954 --- /dev/null +++ b/radio/aidl/compat/libradiocompat/ims/RadioIms.cpp @@ -0,0 +1,88 @@ +/* + * 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. + */ + +#include + +#include "commonStructs.h" +#include "debug.h" + +#include "collections.h" + +#define RADIO_MODULE "Ims" + +namespace android::hardware::radio::compat { + +using ::ndk::ScopedAStatus; +namespace aidl = ::aidl::android::hardware::radio::ims; +constexpr auto ok = &ScopedAStatus::ok; + +std::shared_ptr RadioIms::respond() { + return mCallbackManager->response().imsCb(); +} + +ScopedAStatus RadioIms::setSrvccCallInfo( + int32_t serial, const std::vector& /*srvccCalls*/) { + LOG_CALL << serial; + LOG(ERROR) << " setSrvccCallInfo is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioIms::updateImsRegistrationInfo( + int32_t serial, const aidl::ImsRegistration& /*imsRegistration*/) { + LOG_CALL << serial; + LOG(ERROR) << " updateImsRegistrationInfo is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioIms::startImsTraffic( + int32_t serial, int32_t /*token*/, aidl::ImsTrafficType /*imsTrafficType*/, + ::aidl::android::hardware::radio::AccessNetwork /*accessNetworkType*/, + ::aidl::android::hardware::radio::ims::ImsCall::Direction /*trafficDirection*/) { + LOG_CALL << serial; + LOG(ERROR) << " startImsTraffic is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioIms::stopImsTraffic(int32_t serial, int32_t /*token*/) { + LOG_CALL << serial; + LOG(ERROR) << " stopImsTraffic is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioIms::triggerEpsFallback(int32_t serial, aidl::EpsFallbackReason /*reason*/) { + LOG_CALL << serial; + LOG(ERROR) << " triggerEpsFallback is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioIms::sendAnbrQuery( + int32_t serial, aidl::ImsStreamType /*mediaType*/, aidl::ImsStreamDirection /*direction*/, + int32_t /*bitsPerSecond*/) { + LOG_CALL << serial; + LOG(ERROR) << " sendAnbrQuery is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioIms::updateImsCallStatus( + int32_t serial, const std::vector& /*imsCalls*/) { + LOG_CALL << serial; + LOG(ERROR) << " updateImsCallStatus is unsupported by HIDL HALs"; + return ok(); +} + +ScopedAStatus RadioIms::setResponseFunctions( + const std::shared_ptr& response, + const std::shared_ptr& indication) { + LOG_CALL << response << ' ' << indication; + mCallbackManager->setResponseFunctions(response, indication); + return ok(); +} + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/ims/RadioIndication-ims.cpp b/radio/aidl/compat/libradiocompat/ims/RadioIndication-ims.cpp new file mode 100644 index 0000000000..10109b8f9b --- /dev/null +++ b/radio/aidl/compat/libradiocompat/ims/RadioIndication-ims.cpp @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#include + +#include "commonStructs.h" +#include "debug.h" + +#include "collections.h" + +#define RADIO_MODULE "ImsIndication" + +namespace android::hardware::radio::compat { + +using ::aidl::android::hardware::radio::RadioTechnology; +namespace aidl = ::aidl::android::hardware::radio::ims; + +void RadioIndication::setResponseFunction(std::shared_ptr imsCb) { + mImsCb = imsCb; +} + +std::shared_ptr RadioIndication::imsCb() { + return mImsCb.get(); +} + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/ims/RadioResponse-ims.cpp b/radio/aidl/compat/libradiocompat/ims/RadioResponse-ims.cpp new file mode 100644 index 0000000000..831a0ae9c8 --- /dev/null +++ b/radio/aidl/compat/libradiocompat/ims/RadioResponse-ims.cpp @@ -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. + */ + +#include + +#include "commonStructs.h" +#include "debug.h" + +#include "collections.h" + +#define RADIO_MODULE "ImsResponse" + +namespace android::hardware::radio::compat { + +namespace aidl = ::aidl::android::hardware::radio::ims; + +void RadioResponse::setResponseFunction(std::shared_ptr imsCb) { + mImsCb = imsCb; +} + +std::shared_ptr RadioResponse::imsCb() { + return mImsCb.get(); +} + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIms.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIms.h new file mode 100644 index 0000000000..0dbc565c0e --- /dev/null +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIms.h @@ -0,0 +1,62 @@ +/* + * 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. + */ +#pragma once + +#include "RadioCompatBase.h" + +#include + +namespace android::hardware::radio::compat { + +class RadioIms : public RadioCompatBase, public aidl::android::hardware::radio::ims::BnRadioIms { + ::ndk::ScopedAStatus setSrvccCallInfo( + int32_t serial, + const std::vector<::aidl::android::hardware::radio::ims::SrvccCall>& srvccCalls) + override; + ::ndk::ScopedAStatus updateImsRegistrationInfo( + int32_t serial, + const ::aidl::android::hardware::radio::ims::ImsRegistration& imsRegistration) override; + ::ndk::ScopedAStatus startImsTraffic( + int32_t serial, int32_t token, + ::aidl::android::hardware::radio::ims::ImsTrafficType imsTrafficType, + ::aidl::android::hardware::radio::AccessNetwork accessNetworkType, + ::aidl::android::hardware::radio::ims::ImsCall::Direction trafficDirection) override; + ::ndk::ScopedAStatus stopImsTraffic(int32_t serial, int32_t token) override; + ::ndk::ScopedAStatus triggerEpsFallback( + int32_t serial, + ::aidl::android::hardware::radio::ims::EpsFallbackReason reason) override; + ::ndk::ScopedAStatus sendAnbrQuery( + int32_t serial, ::aidl::android::hardware::radio::ims::ImsStreamType mediaType, + ::aidl::android::hardware::radio::ims::ImsStreamDirection direction, + int32_t bitsPerSecond) override; + ::ndk::ScopedAStatus updateImsCallStatus( + int32_t serial, + const std::vector<::aidl::android::hardware::radio::ims::ImsCall>& imsCalls) override; + + ::ndk::ScopedAStatus setResponseFunctions( + const std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse>& + radioImsResponse, + const std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsIndication>& + radioImsIndication) override; + + protected: + std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse> respond(); + + public: + using RadioCompatBase::RadioCompatBase; +}; + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h index 6cfd59c6a3..f042456409 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h @@ -19,6 +19,7 @@ #include "GuaranteedCallback.h" #include +#include #include #include #include @@ -55,6 +56,10 @@ class RadioIndication : public V1_6::IRadioIndication { ::aidl::android::hardware::radio::voice::IRadioVoiceIndication, ::aidl::android::hardware::radio::voice::IRadioVoiceIndicationDefault, true> mVoiceCb; + GuaranteedCallback< // + ::aidl::android::hardware::radio::ims::IRadioImsIndication, + ::aidl::android::hardware::radio::ims::IRadioImsIndicationDefault, true> + mImsCb; // IRadioIndication @ 1.0 Return radioStateChanged(V1_0::RadioIndicationType type, @@ -220,6 +225,8 @@ class RadioIndication : public V1_6::IRadioIndication { std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimIndication> simCb); void setResponseFunction( std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceIndication> voicCb); + void setResponseFunction( + std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsIndication> imsCb); std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataIndication> dataCb(); std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingIndication> @@ -228,6 +235,7 @@ class RadioIndication : public V1_6::IRadioIndication { std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkIndication> networkCb(); std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimIndication> simCb(); std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceIndication> voiceCb(); + std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsIndication> imsCb(); }; } // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h index 1f82dd19ca..22451aec7e 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h @@ -19,6 +19,7 @@ #include "GuaranteedCallback.h" #include +#include #include #include #include @@ -49,6 +50,9 @@ class RadioResponse : public V1_6::IRadioResponse { GuaranteedCallback<::aidl::android::hardware::radio::voice::IRadioVoiceResponse, ::aidl::android::hardware::radio::voice::IRadioVoiceResponseDefault> mVoiceCb; + GuaranteedCallback<::aidl::android::hardware::radio::ims::IRadioImsResponse, + ::aidl::android::hardware::radio::ims::IRadioImsResponseDefault> + mImsCb; // IRadioResponse @ 1.0 Return getIccCardStatusResponse(const V1_0::RadioResponseInfo& info, @@ -440,6 +444,8 @@ class RadioResponse : public V1_6::IRadioResponse { std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimResponse> simCb); void setResponseFunction( std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse> voiceCb); + void setResponseFunction( + std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse> imsCb); std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataResponse> dataCb(); std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingResponse> @@ -448,6 +454,7 @@ class RadioResponse : public V1_6::IRadioResponse { std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse> networkCb(); std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimResponse> simCb(); std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse> voiceCb(); + std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse> imsCb(); }; } // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/service/Android.bp b/radio/aidl/compat/service/Android.bp index 4dbaef4e71..d16773e6a7 100644 --- a/radio/aidl/compat/service/Android.bp +++ b/radio/aidl/compat/service/Android.bp @@ -40,6 +40,7 @@ cc_binary { "android.hardware.radio.config@1.2", "android.hardware.radio.config@1.3", "android.hardware.radio.data-V1-ndk", + "android.hardware.radio.ims-V1-ndk", "android.hardware.radio.messaging-V1-ndk", "android.hardware.radio.modem-V1-ndk", "android.hardware.radio.network-V2-ndk", From 7f941b4d2cd8d10d711225ea62e607cdf8272d60 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Fri, 4 Nov 2022 14:55:13 -0700 Subject: [PATCH 354/998] Add HAL changes for STEERING_WHEEL_DEPTH_POS Bug: 257267540 Test: atest VtsHalAutomotiveVehicle_TargetTest atest CtsCarTestCases:CarPropertyManagerTest atest CtsCarTestCases:VehiclePropertyIdsTest Change-Id: I0908e4262bc643a3fd39d351e4696b13ae3d0713 --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 19 +++++++++++++++++++ .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../config/DefaultProperties.json | 15 +++++++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 45 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index a7c706079b..0af4b33841 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -157,6 +157,7 @@ enum VehicleProperty { WINDOW_POS = 322964416, WINDOW_MOVE = 322964417, WINDOW_LOCK = 320867268, + STEERING_WHEEL_DEPTH_POS = 289410016, VEHICLE_MAP_SERVICE = 299895808, OBD2_LIVE_FRAME = 299896064, OBD2_FREEZE_FRAME = 299896065, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 4c7784b5df..b991db1f76 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1761,6 +1761,25 @@ enum VehicleProperty { */ WINDOW_LOCK = 0x0BC4 + 0x10000000 + 0x03000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:BOOLEAN + /** + * Steering wheel depth position + * + * All steering wheel properties' unique ids start from 0x0BE0. + * + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All values between + * minInt32Value and maxInt32Value must be supported. + * + * The maxInt32Value in default area's VehicleAreaConfig indicates the steering wheel position + * closest to the driver. The minInt32Value in default area's VehicleAreaConfig indicates the + * steering wheel position furthest to the driver. + * + * This value is not in any particular unit but in a specified range of steps. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + STEERING_WHEEL_DEPTH_POS = + 0x0BE0 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, /** * Vehicle Maps Service (VMS) message * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 7f3279b5df..40a7ca53d1 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -157,6 +157,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::WINDOW_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::WINDOW_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::WINDOW_LOCK, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyAccess::READ}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyAccess::READ}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 9f9d8287d0..a81d7488d9 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -157,6 +157,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::WINDOW_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDOW_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDOW_LOCK, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index fa3ba642cf..7c7e197427 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -149,6 +149,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.WINDOW_LOCK, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyAccess.READ), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 9dd6f1d328..f3c02442ee 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -149,6 +149,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDOW_LOCK, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index f25cab70c6..f47337086a 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2208,6 +2208,21 @@ } ] }, + { + "property": "VehicleProperty::STEERING_WHEEL_DEPTH_POS", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": 0, + "minInt32Value": 0, + "maxInt32Value": 10 + } + ] + }, { "property": "VehicleProperty::WHEEL_TICK", "defaultValue": { diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 9dffbcc86a..6ecde71158 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -487,6 +487,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDoorChildLockEnabledConfig) { VehicleArea::DOOR, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelDepthPosConfig) { + verifyProperty(VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + std::vector getDescriptors() { std::vector descriptors; for (std::string name : getAidlHalInstanceNames(IVehicle::descriptor)) { From 34fe92f6cb92c31ea6bca78e91a1128ff5732191 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Fri, 4 Nov 2022 21:41:23 -0700 Subject: [PATCH 355/998] Add HAL changes for STEERING_WHEEL_DEPTH_MOVE Bug: 257267543 Test: atest VtsHalAutomotiveVehicle_TargetTest atest CtsCarTestCases:CarPropertyManagerTest atest CtsCarTestCases:VehiclePropertyIdsTest Change-Id: I8aecb04b38a4ec985d1efe7fdd53f18a2bc80432 --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 19 +++++++++++++++++++ .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../config/DefaultProperties.json | 15 +++++++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 45 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 0af4b33841..a50cc80b91 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -158,6 +158,7 @@ enum VehicleProperty { WINDOW_MOVE = 322964417, WINDOW_LOCK = 320867268, STEERING_WHEEL_DEPTH_POS = 289410016, + STEERING_WHEEL_DEPTH_MOVE = 289410017, VEHICLE_MAP_SERVICE = 299895808, OBD2_LIVE_FRAME = 299896064, OBD2_FREEZE_FRAME = 299896065, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index b991db1f76..fb43d9a393 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1780,6 +1780,25 @@ enum VehicleProperty { */ STEERING_WHEEL_DEPTH_POS = 0x0BE0 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** + * Steering wheel depth movement + * + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All values between + * minInt32Value and maxInt32Value must be supported. + * + * The maxInt32Value in default area's VehicleAreaConfig indicates the steering wheel moving + * towards the driver. The minInt32Value in default area's VehicleAreaConfig indicates the + * steering wheel moving away from the driver. Larger integers, either positive or negative, + * indicate a faster movement speed. Once the steering wheel reaches the positional limit, the + * value resets to 0. + * + * This value is not in any particular unit but in a specified range of steps. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + STEERING_WHEEL_DEPTH_MOVE = + 0x0BE1 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, /** * Vehicle Maps Service (VMS) message * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 40a7ca53d1..e5ce8e1075 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -158,6 +158,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::WINDOW_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::WINDOW_LOCK, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyAccess::READ}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyAccess::READ}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index a81d7488d9..625ad199c6 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -158,6 +158,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::WINDOW_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDOW_LOCK, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 7c7e197427..22e941107a 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -150,6 +150,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.WINDOW_LOCK, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyAccess.READ), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index f3c02442ee..8d2efe988a 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -150,6 +150,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDOW_LOCK, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index f47337086a..7e55f9ca05 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2223,6 +2223,21 @@ } ] }, + { + "property": "VehicleProperty::STEERING_WHEEL_DEPTH_MOVE", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": 0, + "minInt32Value": -2, + "maxInt32Value": 2 + } + ] + }, { "property": "VehicleProperty::WHEEL_TICK", "defaultValue": { diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 6ecde71158..2b37d350dd 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -493,6 +493,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelDepthPosConfig) { VehicleArea::GLOBAL, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelDepthMoveConfig) { + verifyProperty(VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + std::vector getDescriptors() { std::vector descriptors; for (std::string name : getAidlHalInstanceNames(IVehicle::descriptor)) { From f5535531e7a1e88cb4a9f209abdfd737fb8b4a6e Mon Sep 17 00:00:00 2001 From: ziyiw Date: Wed, 9 Nov 2022 21:53:38 +0000 Subject: [PATCH 356/998] Add a new capability to indcate min slot duration. Test: compile Bug: 254655623 Change-Id: Icac53069ddc61bbd60049880119973f1b4b0286d --- .../uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl | 1 + .../uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl index 39bb5d9662..6ec8d57703 100644 --- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl @@ -48,4 +48,5 @@ enum UwbVendorCapabilityTlvTypes { SUPPORTED_RANGE_DATA_NTF_CONFIG = 229, SUPPORTED_RSSI_REPORTING = 230, SUPPORTED_DIAGNOSTICS = 231, + SUPPORTED_MIN_SLOT_DURATION = 232, } diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl index 86479fb314..b182f9d00c 100644 --- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl +++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl @@ -179,4 +179,9 @@ enum UwbVendorCapabilityTlvTypes { * 0 - Feature not supported. */ SUPPORTED_DIAGNOSTICS = 0xE7, + + /** + * 4 byte value to indicate supported min slot duration in ms. + */ + SUPPORTED_MIN_SLOT_DURATION = 0xE8, } From 3a8b5ee1439772230a0c67e594eb23f02ed66ca2 Mon Sep 17 00:00:00 2001 From: RD Babiera Date: Fri, 16 Sep 2022 20:53:14 +0000 Subject: [PATCH 357/998] Usb non-compliant port partner aidl extension Adds aidl api definitions for notifying if the plugged Type-C port partner (power source/accessory/cable) is non-compliant with type-c power delivery specification. PortStatus is extended to have a boolean that states whether or not this feature is supported as well as an array for a new enum ComplianceWarning. Test: atest VtsAidlUsbTargetTest new test nonCompliantChargerStatus expects expects array to be empty when the feature is not supported. new test nonCompliantChargerValues expects any values in array to be in range of ComplianceWarning enums if feature is supported. Bug: 236322506 Change-Id: Ie3c2365e7c713327b44421c4d132b321d0e03d5f --- .../compatibility_matrix.current.xml | 1 + .../hardware/usb/ComplianceWarning.aidl | 41 +++++++++++++ .../current/android/hardware/usb/IUsb.aidl | 2 +- .../android/hardware/usb/PortStatus.aidl | 2 + .../hardware/usb/ComplianceWarning.aidl | 59 +++++++++++++++++++ usb/aidl/android/hardware/usb/PortStatus.aidl | 12 ++++ usb/aidl/default/Android.bp | 4 +- usb/aidl/default/Usb.cpp | 10 ++++ .../android.hardware.usb-service.example.xml | 2 +- usb/aidl/vts/Android.bp | 2 +- usb/aidl/vts/VtsAidlUsbTargetTest.cpp | 48 +++++++++++++++ 11 files changed, 178 insertions(+), 5 deletions(-) create mode 100644 usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/ComplianceWarning.aidl create mode 100644 usb/aidl/android/hardware/usb/ComplianceWarning.aidl diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index e4fd65e912..c6e937f72e 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -652,6 +652,7 @@
android.hardware.usb + 1-2 IUsb default diff --git a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/ComplianceWarning.aidl b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/ComplianceWarning.aidl new file mode 100644 index 0000000000..8b67070bc6 --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/ComplianceWarning.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.usb; +@Backing(type="int") @VintfStability +enum ComplianceWarning { + OTHER = 1, + DEBUG_ACCESSORY = 2, + BC_1_2 = 3, + MISSING_RP = 4, +} diff --git a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/IUsb.aidl b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/IUsb.aidl index f866c1eb5b..859f52652b 100644 --- a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/IUsb.aidl +++ b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/IUsb.aidl @@ -41,5 +41,5 @@ interface IUsb { oneway void setCallback(in android.hardware.usb.IUsbCallback callback); oneway void switchRole(in String portName, in android.hardware.usb.PortRole role, long transactionId); oneway void limitPowerTransfer(in String portName, boolean limit, long transactionId); - oneway void resetUsbPort(in String portName,long transactionId); + oneway void resetUsbPort(in String portName, long transactionId); } diff --git a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/PortStatus.aidl b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/PortStatus.aidl index dfd99fb249..b0b7552769 100644 --- a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/PortStatus.aidl +++ b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/PortStatus.aidl @@ -50,4 +50,6 @@ parcelable PortStatus { android.hardware.usb.UsbDataStatus[] usbDataStatus; boolean powerTransferLimited; android.hardware.usb.PowerBrickStatus powerBrickStatus; + boolean supportsComplianceWarnings = false; + android.hardware.usb.ComplianceWarning[] complianceWarnings = {}; } diff --git a/usb/aidl/android/hardware/usb/ComplianceWarning.aidl b/usb/aidl/android/hardware/usb/ComplianceWarning.aidl new file mode 100644 index 0000000000..4c18a310a4 --- /dev/null +++ b/usb/aidl/android/hardware/usb/ComplianceWarning.aidl @@ -0,0 +1,59 @@ +/* + * 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. + */ + +package android.hardware.usb; + +@VintfStability +@Backing(type="int") +/** + * Indicates the potential non-compliance reasons for the + * connected USB Type-C port partner which could be a power + * source, accessory or cable. Applicable for USB-C receptacles + * in Android devices. + */ +enum ComplianceWarning { + /** + * Used to indicate Type-C sources/cables/accessories/ports + * whose issue is not listed below but do not meet + * specification requirements from including but not limited to + * USB Type-C Cable and Connector Specification, Universal Serial Bus + * Power Delivery Specification, and Universal Serial Bus + * 1.x/2.0/3.x/4.0. + */ + OTHER = 1, + /** + * Used to indicate Type-C port partner + * (cable/accessory/source) that identifies itself as debug + * accessory source as defined in USB Type-C Cable and + * Connector Specification. However, the specification + * states that this is meant for debug only and shall not + * be used for with commercial products. + */ + DEBUG_ACCESSORY = 2, + /** + * Used to indicate Type-C port partner that does not + * identify itself as one of the charging port types + * (SDP/CDP/DCP etc) as defined by Battery Charging v1.2 + * Specification. + */ + BC_1_2 = 3, + /** + * Used to indicate Type-C sources/cables that are missing + * pull up resistors on the CC pins as required by USB + * Type-C Cable and Connector Specification. + */ + MISSING_RP = 4, +} diff --git a/usb/aidl/android/hardware/usb/PortStatus.aidl b/usb/aidl/android/hardware/usb/PortStatus.aidl index 51bee71389..d7e61ecf94 100644 --- a/usb/aidl/android/hardware/usb/PortStatus.aidl +++ b/usb/aidl/android/hardware/usb/PortStatus.aidl @@ -19,6 +19,7 @@ package android.hardware.usb; import android.hardware.usb.ContaminantDetectionStatus; import android.hardware.usb.ContaminantProtectionMode; import android.hardware.usb.ContaminantProtectionStatus; +import android.hardware.usb.ComplianceWarning; import android.hardware.usb.PortDataRole; import android.hardware.usb.PortMode; import android.hardware.usb.PortPowerRole; @@ -115,4 +116,15 @@ parcelable PortStatus { * Denotes whether Power brick is connected. */ PowerBrickStatus powerBrickStatus; + /** + * True if the hal implementation can support identifying + * non compliant USB power source/cable/accessory. False other + * otherwise. + */ + boolean supportsComplianceWarnings = false; + /** + * List of reasons as to why the attached USB + * power source/cable/accessory is non compliant. + */ + ComplianceWarning[] complianceWarnings = {}; } diff --git a/usb/aidl/default/Android.bp b/usb/aidl/default/Android.bp index 7cb2822312..2e2c3d9362 100644 --- a/usb/aidl/default/Android.bp +++ b/usb/aidl/default/Android.bp @@ -34,10 +34,10 @@ cc_binary { "Usb.cpp", ], shared_libs: [ - "android.hardware.usb-V1-ndk", + "android.hardware.usb-V2-ndk", "libbase", "libbinder_ndk", - "libcutils", + "libcutils", "liblog", "libutils", ], diff --git a/usb/aidl/default/Usb.cpp b/usb/aidl/default/Usb.cpp index 7e738c477f..dd12da0363 100644 --- a/usb/aidl/default/Usb.cpp +++ b/usb/aidl/default/Usb.cpp @@ -123,6 +123,15 @@ Status queryMoistureDetectionStatus(std::vector *currentPortStatus) return Status::SUCCESS; } +Status queryNonCompliantChargerStatus(std::vector *currentPortStatus) { + string reasons, path; + + for (int i = 0; i < currentPortStatus->size(); i++) { + (*currentPortStatus)[i].supportsComplianceWarnings = false; + } + return Status::SUCCESS; +} + string appendRoleNodeHelper(const string &portName, PortRole::Tag tag) { string node(kTypecPath + portName); @@ -527,6 +536,7 @@ void queryVersionHelper(android::hardware::usb::Usb *usb, pthread_mutex_lock(&usb->mLock); status = getPortStatusHelper(currentPortStatus); queryMoistureDetectionStatus(currentPortStatus); + queryNonCompliantChargerStatus(currentPortStatus); if (usb->mCallback != NULL) { ScopedAStatus ret = usb->mCallback->notifyPortStatusChange(*currentPortStatus, status); diff --git a/usb/aidl/default/android.hardware.usb-service.example.xml b/usb/aidl/default/android.hardware.usb-service.example.xml index 6088194890..c3f07f5270 100644 --- a/usb/aidl/default/android.hardware.usb-service.example.xml +++ b/usb/aidl/default/android.hardware.usb-service.example.xml @@ -1,7 +1,7 @@ android.hardware.usb - 1 + 2 IUsb default diff --git a/usb/aidl/vts/Android.bp b/usb/aidl/vts/Android.bp index 00a7c93ec3..d0e0eecb3f 100644 --- a/usb/aidl/vts/Android.bp +++ b/usb/aidl/vts/Android.bp @@ -34,7 +34,7 @@ cc_test { "libbinder_ndk", ], static_libs: [ - "android.hardware.usb-V1-ndk", + "android.hardware.usb-V2-ndk", ], test_suites: [ "general-tests", diff --git a/usb/aidl/vts/VtsAidlUsbTargetTest.cpp b/usb/aidl/vts/VtsAidlUsbTargetTest.cpp index ea2f985766..c4ec8a4e83 100644 --- a/usb/aidl/vts/VtsAidlUsbTargetTest.cpp +++ b/usb/aidl/vts/VtsAidlUsbTargetTest.cpp @@ -43,6 +43,7 @@ #define TIMEOUT_PERIOD 10 using ::aidl::android::hardware::usb::BnUsbCallback; +using ::aidl::android::hardware::usb::ComplianceWarning; using ::aidl::android::hardware::usb::IUsb; using ::aidl::android::hardware::usb::IUsbCallback; using ::aidl::android::hardware::usb::PortDataRole; @@ -560,6 +561,53 @@ TEST_P(UsbAidlTest, DISABLED_resetUsbPort) { ALOGI("UsbAidlTest resetUsbPort end"); } +/* + * Test charger compliance warning + * The test asserts that complianceWarnings is + * empty when the feature is not supported. i.e. + * supportsComplianceWarning is false. + */ +TEST_P(UsbAidlTest, nonCompliantChargerStatus) { + ALOGI("UsbAidlTest nonCompliantChargerStatus start"); + int64_t transactionId = rand() % 10000; + const auto& ret = usb->queryPortStatus(transactionId); + ASSERT_TRUE(ret.isOk()); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(2, usb_last_cookie); + EXPECT_EQ(transactionId, last_transactionId); + + if (!usb_last_port_status.supportsComplianceWarnings) { + EXPECT_TRUE(usb_last_port_status.complianceWarnings.empty()); + } + + ALOGI("UsbAidlTest nonCompliantChargerStatus end"); +} + +/* + * Test charger compliance warning values + * The test asserts that complianceWarning values + * are valid. + */ +TEST_P(UsbAidlTest, nonCompliantChargerValues) { + ALOGI("UsbAidlTest nonCompliantChargerValues start"); + int64_t transactionId = rand() % 10000; + const auto& ret = usb->queryPortStatus(transactionId); + ASSERT_TRUE(ret.isOk()); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(2, usb_last_cookie); + EXPECT_EQ(transactionId, last_transactionId); + + // Current compliance values range from [1, 4] + if (usb_last_port_status.supportsComplianceWarnings) { + for (auto warning : usb_last_port_status.complianceWarnings) { + EXPECT_TRUE((int)warning >= (int)ComplianceWarning::OTHER); + EXPECT_TRUE((int)warning <= (int)ComplianceWarning::MISSING_RP); + } + } + + ALOGI("UsbAidlTest nonCompliantChargerValues end"); +} + GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(UsbAidlTest); INSTANTIATE_TEST_SUITE_P( PerInstance, UsbAidlTest, From a7e0a83c0ee8a905e7478de9eb6fc9263e4b15d4 Mon Sep 17 00:00:00 2001 From: kensun Date: Mon, 31 Oct 2022 13:46:17 +0000 Subject: [PATCH 358/998] Add HAL APIs to query cached scan results Add HAL API to retrieve the on-chip scan results. Bug: 232030878 Test: New API works fine Change-Id: I159aec819959e4ad020ee0d44c8110fe34d451b0 --- wifi/1.6/default/wifi_legacy_hal.cpp | 19 +++++++++++++++++++ wifi/1.6/default/wifi_legacy_hal.h | 9 +++++++++ wifi/1.6/default/wifi_legacy_hal_stubs.cpp | 1 + 3 files changed, 29 insertions(+) diff --git a/wifi/1.6/default/wifi_legacy_hal.cpp b/wifi/1.6/default/wifi_legacy_hal.cpp index c9bcdc5dd8..43cb7c42a1 100644 --- a/wifi/1.6/default/wifi_legacy_hal.cpp +++ b/wifi/1.6/default/wifi_legacy_hal.cpp @@ -366,6 +366,14 @@ void onAsyncChreNanRttState(chre_nan_rtt_state state) { } } +// Callback to report cached scan results +std::function on_cached_scan_results_internal_callback; +void onSyncCachedScanResults(wifi_cached_scan_report* cache_report) { + if (on_cached_scan_results_internal_callback) { + on_cached_scan_results_internal_callback(cache_report); + } +} + // End of the free-standing "C" style callbacks. WifiLegacyHal::WifiLegacyHal(const std::weak_ptr iface_tool, @@ -1589,6 +1597,17 @@ wifi_error WifiLegacyHal::enableWifiTxPowerLimits(const std::string& iface_name, return global_func_table_.wifi_enable_tx_power_limits(getIfaceHandle(iface_name), enable); } +wifi_error WifiLegacyHal::getWifiCachedScanResults( + const std::string& iface_name, const CachedScanResultsCallbackHandlers& handler) { + on_cached_scan_results_internal_callback = handler.on_cached_scan_results; + + wifi_error status = global_func_table_.wifi_get_cached_scan_results(getIfaceHandle(iface_name), + {onSyncCachedScanResults}); + + on_cached_scan_results_internal_callback = nullptr; + return status; +} + void WifiLegacyHal::invalidate() { global_handle_ = nullptr; iface_name_to_handle_.clear(); diff --git a/wifi/1.6/default/wifi_legacy_hal.h b/wifi/1.6/default/wifi_legacy_hal.h index 2b923b44a7..1fd784ad43 100644 --- a/wifi/1.6/default/wifi_legacy_hal.h +++ b/wifi/1.6/default/wifi_legacy_hal.h @@ -218,6 +218,7 @@ using ::WIFI_BAND_ABG; using ::WIFI_BAND_ABG_WITH_DFS; using ::WIFI_BAND_BG; using ::WIFI_BAND_UNSPECIFIED; +using ::wifi_cached_scan_report; using ::wifi_cached_scan_results; using ::WIFI_CHAN_WIDTH_10; using ::WIFI_CHAN_WIDTH_160; @@ -465,6 +466,12 @@ struct ChreCallbackHandlers { std::function on_wifi_chre_nan_rtt_state; }; +// Cached Scan Results response and event callbacks struct. +struct CachedScanResultsCallbackHandlers { + // Callback for Cached Scan Results + std::function on_cached_scan_results; +}; + /** * Class that encapsulates all legacy HAL interactions. * This class manages the lifetime of the event loop thread used by legacy HAL. @@ -684,6 +691,8 @@ class WifiLegacyHal { const ChreCallbackHandlers& handler); wifi_error enableWifiTxPowerLimits(const std::string& iface_name, bool enable); + wifi_error getWifiCachedScanResults(const std::string& iface_name, + const CachedScanResultsCallbackHandlers& handler); private: // Retrieve interface handles for all the available interfaces. diff --git a/wifi/1.6/default/wifi_legacy_hal_stubs.cpp b/wifi/1.6/default/wifi_legacy_hal_stubs.cpp index b3bd37389c..8f8527a4cc 100644 --- a/wifi/1.6/default/wifi_legacy_hal_stubs.cpp +++ b/wifi/1.6/default/wifi_legacy_hal_stubs.cpp @@ -167,6 +167,7 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { populateStubFor(&hal_fn->wifi_nan_rtt_chre_disable_request); populateStubFor(&hal_fn->wifi_chre_register_handler); populateStubFor(&hal_fn->wifi_enable_tx_power_limits); + populateStubFor(&hal_fn->wifi_get_cached_scan_results); return true; } } // namespace legacy_hal From 18c8b0edd0597aa7271114fe1770bf90cc20410b Mon Sep 17 00:00:00 2001 From: Bob Badour Date: Thu, 10 Nov 2022 11:40:27 -0800 Subject: [PATCH 359/998] [LSC] Add LOCAL_LICENSE_KINDS to hardware/interfaces Added SPDX-license-identifier-Apache-2.0 to: media/bufferpool/aidl/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Change-Id: I65c292fd4b24f7f2a3087c48152d300b249df5ba --- media/bufferpool/aidl/Android.bp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/media/bufferpool/aidl/Android.bp b/media/bufferpool/aidl/Android.bp index 3b2ea3cd62..68ac4896be 100644 --- a/media/bufferpool/aidl/Android.bp +++ b/media/bufferpool/aidl/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.media.bufferpool2", vendor_available: true, From 50081b287b5db18bf4e0c51893bf9ef103b37df2 Mon Sep 17 00:00:00 2001 From: Yomna Nasser Date: Wed, 12 Oct 2022 02:20:52 +0000 Subject: [PATCH 360/998] Add setNullCipherAndIntegrityEnabled to IRadioNetwork Expose control of allowing/disallowing null encryption & null integrity modes to Android. Bug: b/237529943 Test: m Change-Id: I5ea99cb0637e8d508d74846b3e99bf8a7f5d559a --- .../hardware/radio/network/IRadioNetwork.aidl | 1 + .../radio/network/IRadioNetworkResponse.aidl | 1 + .../hardware/radio/network/IRadioNetwork.aidl | 20 +++++++++++++++++++ .../radio/network/IRadioNetworkResponse.aidl | 10 ++++++++++ .../include/libradiocompat/RadioNetwork.h | 2 ++ .../libradiocompat/network/RadioNetwork.cpp | 7 +++++++ radio/aidl/vts/radio_network_response.cpp | 7 +++++++ radio/aidl/vts/radio_network_utils.h | 3 +++ 8 files changed, 51 insertions(+) diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl index c115c86357..35d3807ba4 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl @@ -74,4 +74,5 @@ interface IRadioNetwork { oneway void triggerEmergencyNetworkScan(int serial, in android.hardware.radio.network.EmergencyNetworkScanTrigger request); oneway void cancelEmergencyNetworkScan(int serial, boolean resetScan); oneway void exitEmergencyMode(in int serial); + oneway void setNullCipherAndIntegrityEnabled(in int serial, in boolean enabled); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl index 24d587e655..141250d598 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -73,4 +73,5 @@ interface IRadioNetworkResponse { oneway void triggerEmergencyNetworkScanResponse(in android.hardware.radio.RadioResponseInfo info); oneway void exitEmergencyModeResponse(in android.hardware.radio.RadioResponseInfo info); oneway void cancelEmergencyNetworkScanResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setNullCipherAndIntegrityEnabledResponse(in android.hardware.radio.RadioResponseInfo info); } diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl index 574798aa59..28a69ac097 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl @@ -482,4 +482,24 @@ oneway interface IRadioNetwork { * Response function is IRadioEmergencyResponse.exitEmergencyModeResponse() */ void exitEmergencyMode(in int serial); + + /** + * Set if null encryption and integrity modes are enabled. If the value of enabled is false + * the modem must not allow any network communications with null ciphering or null integrity + * modes. In case of an emergency call, the modem must bypass this setting. + * + * Null ciphering and integrity modes include (but are not limited to): + * 2G: A5/0 + * 3G: UEA0 and UIA0 + * 4G: EEA0 and EIA0 + * 5G: NEA0 and NIA0 + * + * + * @param serial Serial number of the request. + * @param enabled To allow null encryption/integrity, set to true. + * Otherwise, false. + * + * Response callback is IRadioResponse.setNullCipherAndIntegrityEnabledResponse() + */ + void setNullCipherAndIntegrityEnabled(in int serial, in boolean enabled); } diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl index fc4db2ca36..0cde5e6210 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -632,4 +632,14 @@ oneway interface IRadioNetworkResponse { * RadioError:MODEM_ERR */ void cancelEmergencyNetworkScanResponse(in RadioResponseInfo info); + + /** + * @param info Response info struct containing response type, serial no. and error + * + * Valid errors returned: + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:MODEM_ERR + */ + void setNullCipherAndIntegrityEnabledResponse(in RadioResponseInfo info); } diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h index 5dd6f0ae8d..2e0488d1c0 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h @@ -100,6 +100,8 @@ class RadioNetwork : public RadioCompatBase, ::ndk::ScopedAStatus cancelEmergencyNetworkScan(int32_t serial, bool resetScan) override; ::ndk::ScopedAStatus exitEmergencyMode(int32_t serial) override; + ::ndk::ScopedAStatus setNullCipherAndIntegrityEnabled(int32_t serial, bool enabled) override; + protected: std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse> respond(); diff --git a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp index 6bb6b75b2e..bbe7fd70de 100644 --- a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp +++ b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp @@ -340,4 +340,11 @@ ScopedAStatus RadioNetwork::exitEmergencyMode(int32_t serial) { return ok(); } +ScopedAStatus RadioNetwork::setNullCipherAndIntegrityEnabled(int32_t serial, bool) { + LOG_CALL << serial; + LOG(ERROR) << " setNullCipherAndIntegrityEnabled is unsupported by HIDL HALs"; + respond()->setNullCipherAndIntegrityEnabledResponse(notSupported(serial)); + return ok(); +} + } // namespace android::hardware::radio::compat diff --git a/radio/aidl/vts/radio_network_response.cpp b/radio/aidl/vts/radio_network_response.cpp index 5599c0332f..82aaa1b85d 100644 --- a/radio/aidl/vts/radio_network_response.cpp +++ b/radio/aidl/vts/radio_network_response.cpp @@ -293,3 +293,10 @@ ndk::ScopedAStatus RadioNetworkResponse::cancelEmergencyNetworkScanResponse( parent_network.notify(info.serial); return ndk::ScopedAStatus::ok(); } + +ndk::ScopedAStatus RadioNetworkResponse::setNullCipherAndIntegrityEnabledResponse( + const RadioResponseInfo& info) { + rspInfo = info; + parent_network.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} diff --git a/radio/aidl/vts/radio_network_utils.h b/radio/aidl/vts/radio_network_utils.h index 8480825421..67654b1494 100644 --- a/radio/aidl/vts/radio_network_utils.h +++ b/radio/aidl/vts/radio_network_utils.h @@ -158,6 +158,9 @@ class RadioNetworkResponse : public BnRadioNetworkResponse { virtual ndk::ScopedAStatus cancelEmergencyNetworkScanResponse( const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus setNullCipherAndIntegrityEnabledResponse( + const RadioResponseInfo& info) override; }; /* Callback class for radio network indication */ From 5265318938464e316bfe705cb41958bcc0f6de25 Mon Sep 17 00:00:00 2001 From: Jeff Pu Date: Wed, 12 Oct 2022 16:27:23 -0400 Subject: [PATCH 361/998] Fingerprint virtual HAL checkin (part 3) - support randomization - display touch events - lockout - cmd and dumpsys Bug: 230515082 Bug: 230515086 Test: atest FakeFingerprintEngineTest atest FakeFingerprintEngineUdfpsTest atest --no-bazel-mode VtsHalBiometricsFingerprintTargetTest Change-Id: Ia5399c86b7fec90b41d426c2f82cb257f4dc9a8a --- biometrics/common/util/include/util/Util.h | 4 +- .../fingerprint/aidl/default/Android.bp | 27 +++ .../aidl/default/FakeFingerprintEngine.cpp | 138 +++++++++++----- .../default/FakeFingerprintEngineUdfps.cpp | 89 +++++++++- .../aidl/default/FakeLockoutTracker.cpp | 77 +++++++++ .../fingerprint/aidl/default/Fingerprint.cpp | 102 +++++++++++- biometrics/fingerprint/aidl/default/README.md | 37 +++++ .../fingerprint/aidl/default/Session.cpp | 3 + ...trics.fingerprint.VirtualProps-current.txt | 155 ------------------ .../aidl/default/fingerprint.sysprop | 116 ++++++++----- .../default/include/FakeFingerprintEngine.h | 35 +++- .../include/FakeFingerprintEngineRear.h | 2 +- .../include/FakeFingerprintEngineSide.h | 2 +- .../include/FakeFingerprintEngineUdfps.h | 50 +++++- .../aidl/default/include/FakeLockoutTracker.h | 51 ++++++ .../aidl/default/include/Fingerprint.h | 7 +- .../tests/FakeFingerprintEngineTest.cpp | 36 +++- .../tests/FakeFingerprintEngineUdfpsTest.cpp | 136 ++++++++++++--- .../default/tests/FakeLockoutTrackerTest.cpp | 95 +++++++++++ 19 files changed, 875 insertions(+), 287 deletions(-) create mode 100644 biometrics/fingerprint/aidl/default/FakeLockoutTracker.cpp create mode 100644 biometrics/fingerprint/aidl/default/include/FakeLockoutTracker.h create mode 100644 biometrics/fingerprint/aidl/default/tests/FakeLockoutTrackerTest.cpp diff --git a/biometrics/common/util/include/util/Util.h b/biometrics/common/util/include/util/Util.h index 29ec0f865e..da19dc6afe 100644 --- a/biometrics/common/util/include/util/Util.h +++ b/biometrics/common/util/include/util/Util.h @@ -40,7 +40,7 @@ namespace aidl::android::hardware::biometrics { // by parts of the UI or fail if there is no latency. For example, the // Face settings page constantly runs auth and the enrollment UI uses a // cancel/restart cycle that requires some latency while the activities change. -#define DEFAULT_LATENCY 800 +#define DEFAULT_LATENCY 400 class Util { public: @@ -66,4 +66,4 @@ class Util { } }; -} // namespace aidl::android::hardware::biometrics \ No newline at end of file +} // namespace aidl::android::hardware::biometrics diff --git a/biometrics/fingerprint/aidl/default/Android.bp b/biometrics/fingerprint/aidl/default/Android.bp index dc0199c98a..77c74e1a77 100644 --- a/biometrics/fingerprint/aidl/default/Android.bp +++ b/biometrics/fingerprint/aidl/default/Android.bp @@ -15,6 +15,7 @@ cc_binary { vintf_fragments: ["fingerprint-example.xml"], local_include_dirs: ["include"], srcs: [ + "FakeLockoutTracker.cpp", "FakeFingerprintEngine.cpp", "FakeFingerprintEngineRear.cpp", "FakeFingerprintEngineUdfps.cpp", @@ -40,6 +41,7 @@ cc_test { srcs: [ "tests/FakeFingerprintEngineTest.cpp", "FakeFingerprintEngine.cpp", + "FakeLockoutTracker.cpp", ], shared_libs: [ "libbase", @@ -65,6 +67,31 @@ cc_test { "tests/FakeFingerprintEngineUdfpsTest.cpp", "FakeFingerprintEngineUdfps.cpp", "FakeFingerprintEngine.cpp", + "FakeLockoutTracker.cpp", + ], + shared_libs: [ + "libbase", + "libbinder_ndk", + "android.hardware.biometrics.common.thread", + ], + static_libs: [ + "libandroid.hardware.biometrics.fingerprint.VirtualProps", + "android.hardware.biometrics.fingerprint-V2-ndk", + "android.hardware.biometrics.common-V2-ndk", + "android.hardware.keymaster-V3-ndk", + "android.hardware.biometrics.common.util", + ], + vendor: true, + test_suites: ["general-tests"], + require_root: true, +} + +cc_test { + name: "android.hardware.biometrics.fingerprint.FakeLockoutTrackerTest", + local_include_dirs: ["include"], + srcs: [ + "tests/FakeLockoutTrackerTest.cpp", + "FakeLockoutTracker.cpp", ], shared_libs: [ "libbase", diff --git a/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp b/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp index 651c9dc352..90ec8f26ee 100644 --- a/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp +++ b/biometrics/fingerprint/aidl/default/FakeFingerprintEngine.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 The Android Open Source Project + * 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. @@ -15,6 +15,7 @@ */ #include "FakeFingerprintEngine.h" +#include #include "Fingerprint.h" #include @@ -47,7 +48,7 @@ void FakeFingerprintEngine::revokeChallengeImpl(ISessionCallback* cb, int64_t ch void FakeFingerprintEngine::enrollImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& hat, const std::future& cancel) { - BEGIN_OP(FingerprintHalProperties::operation_enroll_latency().value_or(DEFAULT_LATENCY)); + BEGIN_OP(getLatency(FingerprintHalProperties::operation_enroll_latency())); // Do proper HAT verification in the real implementation. if (hat.mac.empty()) { @@ -117,7 +118,7 @@ void FakeFingerprintEngine::enrollImpl(ISessionCallback* cb, void FakeFingerprintEngine::authenticateImpl(ISessionCallback* cb, int64_t /* operationId */, const std::future& cancel) { - BEGIN_OP(FingerprintHalProperties::operation_authenticate_latency().value_or(DEFAULT_LATENCY)); + BEGIN_OP(getLatency(FingerprintHalProperties::operation_authenticate_latency())); int64_t now = Util::getSystemNanoTime(); int64_t duration = FingerprintHalProperties::operation_authenticate_duration().value_or(10); @@ -131,10 +132,23 @@ void FakeFingerprintEngine::authenticateImpl(ISessionCallback* cb, int64_t /* op return; } + // got lockout? + FakeLockoutTracker::LockoutMode lockoutMode = mLockoutTracker.getMode(); + if (lockoutMode == FakeLockoutTracker::LockoutMode::kPermanent) { + LOG(ERROR) << "Fail: lockout permanent"; + cb->onLockoutPermanent(); + return; + } else if (lockoutMode == FakeLockoutTracker::LockoutMode::kTimed) { + int64_t timeLeft = mLockoutTracker.getLockoutTimeLeft(); + LOG(ERROR) << "Fail: lockout timed " << timeLeft; + cb->onLockoutTimed(timeLeft); + } + int i = 0; do { if (FingerprintHalProperties::operation_authenticate_fails().value_or(false)) { LOG(ERROR) << "Fail: operation_authenticate_fails"; + mLockoutTracker.addFailedAttempt(); cb->onAuthenticationFailed(); return; } @@ -174,20 +188,30 @@ void FakeFingerprintEngine::authenticateImpl(ISessionCallback* cb, int64_t /* op auto isEnrolled = std::find(enrolls.begin(), enrolls.end(), id) != enrolls.end(); if (id > 0 && isEnrolled) { cb->onAuthenticationSucceeded(id, {} /* hat */); + mLockoutTracker.reset(); return; } else { LOG(ERROR) << "Fail: fingerprint not enrolled"; cb->onAuthenticationFailed(); + mLockoutTracker.addFailedAttempt(); } } void FakeFingerprintEngine::detectInteractionImpl(ISessionCallback* cb, const std::future& cancel) { - BEGIN_OP(FingerprintHalProperties::operation_detect_interaction_latency().value_or( - DEFAULT_LATENCY)); + BEGIN_OP(getLatency(FingerprintHalProperties::operation_detect_interaction_latency())); int64_t duration = FingerprintHalProperties::operation_detect_interaction_duration().value_or(10); + + auto detectInteractionSupported = + FingerprintHalProperties::detect_interaction().value_or(false); + if (!detectInteractionSupported) { + LOG(ERROR) << "Detect interaction is not supported"; + cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorError */); + return; + } + auto acquired = FingerprintHalProperties::operation_detect_interaction_acquired().value_or("1"); auto acquiredInfos = parseIntSequence(acquired); int N = acquiredInfos.size(); @@ -308,6 +332,7 @@ void FakeFingerprintEngine::resetLockoutImpl(ISessionCallback* cb, } FingerprintHalProperties::lockout(false); cb->onLockoutCleared(); + mLockoutTracker.reset(); } ndk::ScopedAStatus FakeFingerprintEngine::onPointerDownImpl(int32_t /*pointerId*/, int32_t /*x*/, @@ -383,49 +408,52 @@ std::vector FakeFingerprintEngine::parseIntSequence(const std::string& return res; } -std::vector> FakeFingerprintEngine::parseEnrollmentCapture( - const std::string& str) { +bool FakeFingerprintEngine::parseEnrollmentCaptureSingle(const std::string& str, + std::vector>& res) { std::vector defaultAcquiredInfo = {(int32_t)AcquiredInfo::GOOD}; - std::vector> res; - int i = 0, N = str.length(); - std::size_t found = 0; bool aborted = true; - while (found != std::string::npos) { - std::string durationStr, acquiredStr; - found = str.find_first_of("-,", i); - if (found == std::string::npos) { - if (N - i < 1) break; - durationStr = str.substr(i, N - i); - } else { - durationStr = str.substr(i, found - i); - if (str[found] == '-') { - found = str.find_first_of('[', found + 1); - if (found == std::string::npos) break; - i = found + 1; - found = str.find_first_of(']', found + 1); - if (found == std::string::npos) break; - acquiredStr = str.substr(i, found - i); - found = str.find_first_of(',', found + 1); - } - } - std::vector duration{0}; - if (!ParseInt(durationStr, &duration[0])) break; - res.push_back(duration); - if (!acquiredStr.empty()) { - std::vector acquiredInfo = parseIntSequence(acquiredStr); - if (acquiredInfo.empty()) break; - res.push_back(acquiredInfo); + do { + std::smatch sms; + // Parses strings like "1000-[5,1]" or "500" + std::regex ex("((\\d+)(-\\[([\\d|,]+)\\])?)"); + if (!regex_match(str.cbegin(), str.cend(), sms, ex)) break; + int32_t duration; + if (!ParseInt(sms.str(2), &duration)) break; + res.push_back({duration}); + if (!sms.str(4).empty()) { + auto acqv = parseIntSequence(sms.str(4)); + if (acqv.empty()) break; + res.push_back(acqv); } else res.push_back(defaultAcquiredInfo); + aborted = false; + } while (0); - i = found + 1; - if (found == std::string::npos || found == N - 1) aborted = false; + return !aborted; +} + +std::vector> FakeFingerprintEngine::parseEnrollmentCapture( + const std::string& str) { + std::vector> res; + + std::string s(str); + s.erase(std::remove_if(s.begin(), s.end(), ::isspace), s.end()); + bool aborted = false; + std::smatch sms; + // Parses strings like "1000-[5,1],500,800-[6,5,1]" + // ---------- --- ----------- + // into parts: A B C + while (regex_search(s, sms, std::regex("^(,)?(\\d+(-\\[[\\d|,]+\\])?)"))) { + if (!parseEnrollmentCaptureSingle(sms.str(2), res)) { + aborted = true; + break; + } + s = sms.suffix(); } - - if (aborted) { - LOG(ERROR) << "Failed to parse enrollment captures:" + str; + if (aborted || s.length() != 0) { res.clear(); + LOG(ERROR) << "Failed to parse enrollment captures:" + str; } return res; @@ -455,4 +483,34 @@ std::pair FakeFingerprintEngine::convertError(int32_t code) { return res; } +int32_t FakeFingerprintEngine::getLatency( + const std::vector>& latencyIn) { + int32_t res = DEFAULT_LATENCY; + + std::vector latency; + for (auto x : latencyIn) + if (x.has_value()) latency.push_back(*x); + + switch (latency.size()) { + case 0: + break; + case 1: + res = latency[0]; + break; + case 2: + res = getRandomInRange(latency[0], latency[1]); + break; + default: + LOG(ERROR) << "ERROR: unexpected input of size " << latency.size(); + break; + } + + return res; +} + +int32_t FakeFingerprintEngine::getRandomInRange(int32_t bound1, int32_t bound2) { + std::uniform_int_distribution dist(std::min(bound1, bound2), std::max(bound1, bound2)); + return dist(mRandom); +} + } // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/FakeFingerprintEngineUdfps.cpp b/biometrics/fingerprint/aidl/default/FakeFingerprintEngineUdfps.cpp index d8579a4517..3cdfc70008 100644 --- a/biometrics/fingerprint/aidl/default/FakeFingerprintEngineUdfps.cpp +++ b/biometrics/fingerprint/aidl/default/FakeFingerprintEngineUdfps.cpp @@ -23,10 +23,16 @@ #include "util/CancellationSignal.h" #include "util/Util.h" +#undef LOG_TAG +#define LOG_TAG "FingerprintVirtualHalUdfps" + using namespace ::android::fingerprint::virt; namespace aidl::android::hardware::biometrics::fingerprint { +FakeFingerprintEngineUdfps::FakeFingerprintEngineUdfps() + : FakeFingerprintEngine(), mWorkMode(WorkMode::kIdle), mPointerDownTime(0), mUiReadyTime(0) {} + SensorLocation FakeFingerprintEngineUdfps::defaultSensorLocation() { return {0 /* displayId (not used) */, defaultSensorLocationX /* sensorLocationX */, defaultSensorLocationY /* sensorLocationY */, defaultSensorRadius /* sensorRadius */, @@ -37,22 +43,95 @@ ndk::ScopedAStatus FakeFingerprintEngineUdfps::onPointerDownImpl(int32_t /*point int32_t /*x*/, int32_t /*y*/, float /*minor*/, float /*major*/) { BEGIN_OP(0); - - // TODO(b/230515082): if need to handle display touch events - + // verify whetehr touch coordinates/area matching sensor location ? + mPointerDownTime = Util::getSystemNanoTime(); + if (FingerprintHalProperties::control_illumination().value_or(false)) { + fingerDownAction(); + } return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus FakeFingerprintEngineUdfps::onPointerUpImpl(int32_t /*pointerId*/) { BEGIN_OP(0); - // TODO(b/230515082) + mUiReadyTime = 0; + mPointerDownTime = 0; return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus FakeFingerprintEngineUdfps::onUiReadyImpl() { BEGIN_OP(0); - // TODO(b/230515082) + + if (Util::hasElapsed(mPointerDownTime, uiReadyTimeoutInMs * 100)) { + LOG(ERROR) << "onUiReady() arrives too late after onPointerDown()"; + } else { + fingerDownAction(); + } return ndk::ScopedAStatus::ok(); } +void FakeFingerprintEngineUdfps::fingerDownAction() { + switch (mWorkMode) { + case WorkMode::kAuthenticate: + onAuthenticateFingerDown(); + break; + case WorkMode::kEnroll: + onEnrollFingerDown(); + break; + case WorkMode::kDetectInteract: + onDetectInteractFingerDown(); + break; + default: + LOG(WARNING) << "unexpected call: onUiReady()"; + break; + } + + mUiReadyTime = 0; + mPointerDownTime = 0; +} + +void FakeFingerprintEngineUdfps::onAuthenticateFingerDown() { + FakeFingerprintEngine::authenticateImpl(mCb, mOperationId, mCancelVec[0]); +} + +void FakeFingerprintEngineUdfps::onEnrollFingerDown() { + // Any use case to emulate display touch for each capture during enrollment? + FakeFingerprintEngine::enrollImpl(mCb, mHat, mCancelVec[0]); +} + +void FakeFingerprintEngineUdfps::onDetectInteractFingerDown() { + FakeFingerprintEngine::detectInteractionImpl(mCb, mCancelVec[0]); +} + +void FakeFingerprintEngineUdfps::enrollImpl(ISessionCallback* cb, + const keymaster::HardwareAuthToken& hat, + const std::future& cancel) { + updateContext(WorkMode::kEnroll, cb, const_cast&>(cancel), 0, hat); +} + +void FakeFingerprintEngineUdfps::authenticateImpl(ISessionCallback* cb, int64_t operationId, + const std::future& cancel) { + updateContext(WorkMode::kAuthenticate, cb, const_cast&>(cancel), operationId, + keymaster::HardwareAuthToken()); +} + +void FakeFingerprintEngineUdfps::detectInteractionImpl(ISessionCallback* cb, + const std::future& cancel) { + updateContext(WorkMode::kDetectInteract, cb, const_cast&>(cancel), 0, + keymaster::HardwareAuthToken()); +} + +void FakeFingerprintEngineUdfps::updateContext(WorkMode mode, ISessionCallback* cb, + std::future& cancel, int64_t operationId, + const keymaster::HardwareAuthToken& hat) { + mPointerDownTime = 0; + mUiReadyTime = 0; + mCancelVec.clear(); + + mCancelVec.push_back(std::move(cancel)); + mWorkMode = mode; + mCb = cb; + mOperationId = operationId; + mHat = hat; +} + } // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/FakeLockoutTracker.cpp b/biometrics/fingerprint/aidl/default/FakeLockoutTracker.cpp new file mode 100644 index 0000000000..5996406fd0 --- /dev/null +++ b/biometrics/fingerprint/aidl/default/FakeLockoutTracker.cpp @@ -0,0 +1,77 @@ +/* + * 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. + */ + +#include "FakeLockoutTracker.h" +#include +#include "util/Util.h" + +using namespace ::android::fingerprint::virt; + +namespace aidl::android::hardware::biometrics::fingerprint { + +void FakeLockoutTracker::reset() { + mFailedCount = 0; + mLockoutTimedStart = 0; + mCurrentMode = LockoutMode::kNone; +} + +void FakeLockoutTracker::addFailedAttempt() { + bool enabled = FingerprintHalProperties::lockout_enable().value_or(false); + if (enabled) { + mFailedCount++; + int32_t lockoutTimedThreshold = + FingerprintHalProperties::lockout_timed_threshold().value_or(5); + int32_t lockoutPermanetThreshold = + FingerprintHalProperties::lockout_permanent_threshold().value_or(20); + if (mFailedCount >= lockoutPermanetThreshold) { + mCurrentMode = LockoutMode::kPermanent; + FingerprintHalProperties::lockout(true); + } else if (mFailedCount >= lockoutTimedThreshold) { + if (mCurrentMode == LockoutMode::kNone) { + mCurrentMode = LockoutMode::kTimed; + mLockoutTimedStart = Util::getSystemNanoTime(); + } + } + } else { + reset(); + } +} + +FakeLockoutTracker::LockoutMode FakeLockoutTracker::getMode() { + if (mCurrentMode == LockoutMode::kTimed) { + int32_t lockoutTimedDuration = + FingerprintHalProperties::lockout_timed_duration().value_or(10 * 100); + if (Util::hasElapsed(mLockoutTimedStart, lockoutTimedDuration)) { + mCurrentMode = LockoutMode::kNone; + mLockoutTimedStart = 0; + } + } + + return mCurrentMode; +} + +int64_t FakeLockoutTracker::getLockoutTimeLeft() { + int64_t res = 0; + + if (mLockoutTimedStart > 0) { + auto now = Util::getSystemNanoTime(); + auto left = now - mLockoutTimedStart; + res = (left > 0) ? (left / 1000000LL) : 0; + } + + return res; +} +} // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/Fingerprint.cpp b/biometrics/fingerprint/aidl/default/Fingerprint.cpp index 74e7caff3c..be932246bd 100644 --- a/biometrics/fingerprint/aidl/default/Fingerprint.cpp +++ b/biometrics/fingerprint/aidl/default/Fingerprint.cpp @@ -15,11 +15,13 @@ */ #include "Fingerprint.h" - -#include #include "Session.h" +#include + +#include #include +#include using namespace ::android::fingerprint::virt; @@ -64,7 +66,6 @@ ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector* out) { {HW_COMPONENT_ID, HW_VERSION, FW_VERSION, SERIAL_NUMBER, "" /* softwareVersion */}, {SW_COMPONENT_ID, "" /* hardwareVersion */, "" /* firmwareVersion */, "" /* serialNumber */, SW_VERSION}}; - auto sensorId = FingerprintHalProperties::sensor_id().value_or(SENSOR_ID); auto sensorStrength = FingerprintHalProperties::sensor_strength().value_or((int)SENSOR_STRENGTH); @@ -80,7 +81,8 @@ ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector* out) { SensorLocation sensorLocation = mEngine->getSensorLocation(); - LOG(INFO) << "sensor type:" << (int)mSensorType << " location:" << sensorLocation.toString(); + LOG(INFO) << "sensor type:" << ::android::internal::ToString(mSensorType) + << " location:" << sensorLocation.toString(); *out = {{commonProps, mSensorType, @@ -104,4 +106,96 @@ ndk::ScopedAStatus Fingerprint::createSession(int32_t sensorId, int32_t userId, return ndk::ScopedAStatus::ok(); } +binder_status_t Fingerprint::dump(int fd, const char** /*args*/, uint32_t numArgs) { + if (fd < 0) { + LOG(ERROR) << "Fingerprint::dump fd invalid: " << fd; + return STATUS_BAD_VALUE; + } else { + LOG(INFO) << "Fingerprint::dump fd:" << fd << "numArgs:" << numArgs; + } + + dprintf(fd, "----- FingerprintVirtualHal::dump -----\n"); + std::vector sps(1); + getSensorProps(&sps); + for (auto& sp : sps) { + ::android::base::WriteStringToFd(sp.toString(), fd); + } + ::android::base::WriteStringToFd(mEngine->toString(), fd); + + fsync(fd); + return STATUS_OK; +} + +binder_status_t Fingerprint::handleShellCommand(int in, int out, int err, const char** args, + uint32_t numArgs) { + LOG(INFO) << "Fingerprint::handleShellCommand in:" << in << " out:" << out << " err:" << err + << " numArgs:" << numArgs; + + if (numArgs == 0) { + LOG(INFO) << "Fingerprint::handleShellCommand: available commands"; + onHelp(out); + return STATUS_OK; + } + + for (auto&& str : std::vector(args, args + numArgs)) { + std::string option = str.data(); + if (option.find("clearconfig") != std::string::npos || + option.find("resetconfig") != std::string::npos) { + resetConfigToDefault(); + } + if (option.find("help") != std::string::npos) { + onHelp(out); + } + } + + return STATUS_OK; +} + +void Fingerprint::onHelp(int fd) { + dprintf(fd, "Virtual HAL commands:\n"); + dprintf(fd, " help: print this help\n"); + dprintf(fd, " resetconfig: reset all configuration to default\n"); + dprintf(fd, "\n"); + fsync(fd); +} + +void Fingerprint::resetConfigToDefault() { + LOG(INFO) << "reset virtual HAL configuration to default"; +#define RESET_CONFIG_O(__NAME__) \ + if (FingerprintHalProperties::__NAME__()) FingerprintHalProperties::__NAME__(std::nullopt) +#define RESET_CONFIG_V(__NAME__) \ + if (!FingerprintHalProperties::__NAME__().empty()) \ + FingerprintHalProperties::__NAME__({std::nullopt}) + + RESET_CONFIG_O(type); + RESET_CONFIG_V(enrollments); + RESET_CONFIG_O(enrollment_hit); + RESET_CONFIG_O(authenticator_id); + RESET_CONFIG_O(challenge); + RESET_CONFIG_O(lockout); + RESET_CONFIG_O(operation_authenticate_fails); + RESET_CONFIG_O(operation_detect_interaction_error); + RESET_CONFIG_O(operation_enroll_error); + RESET_CONFIG_V(operation_authenticate_latency); + RESET_CONFIG_V(operation_detect_interaction_latency); + RESET_CONFIG_V(operation_enroll_latency); + RESET_CONFIG_O(operation_authenticate_duration); + RESET_CONFIG_O(operation_authenticate_error); + RESET_CONFIG_O(sensor_location); + RESET_CONFIG_O(operation_authenticate_acquired); + RESET_CONFIG_O(operation_detect_interaction_duration); + RESET_CONFIG_O(operation_detect_interaction_acquired); + RESET_CONFIG_O(sensor_id); + RESET_CONFIG_O(sensor_strength); + RESET_CONFIG_O(max_enrollments); + RESET_CONFIG_O(navigation_guesture); + RESET_CONFIG_O(detect_interaction); + RESET_CONFIG_O(display_touch); + RESET_CONFIG_O(control_illumination); + RESET_CONFIG_O(lockout_enable); + RESET_CONFIG_O(lockout_timed_threshold); + RESET_CONFIG_O(lockout_timed_duration); + RESET_CONFIG_O(lockout_permanent_threshold); +} + } // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/README.md b/biometrics/fingerprint/aidl/default/README.md index ad471f747d..49b6c9dc0d 100644 --- a/biometrics/fingerprint/aidl/default/README.md +++ b/biometrics/fingerprint/aidl/default/README.md @@ -57,6 +57,7 @@ $ adb shell cmd fingerprint sync ```shell $ adb shell setprop vendor.fingerprint.virtual.next_enrollment 1:100,100,100:true ``` + 3. Navigate to `Settings -> Security -> Fingerprint Unlock` and follow the prompts. 4. Verify the enrollments in the UI: @@ -119,6 +120,38 @@ $ adb shell setprop vendor.fingerprint.virtual.operation_authenticate_error 8 ``` For vendor specific error, errorCode = 1000 + vendorErrorCode +## Latency Insertion +Three HAL operations (authenticate, enrollment and detect interaction) latency can be optionally specified in multiple ways +1. default latency is fixed at 400 ms if not specified via sysprop +2. specify authenticate operation latency to 900 ms + ```shell adb shell setprop vendor.fingerprint.virtual.operation_authenticate_latency 900``` +3. specify authenticate operation latency between 600 to 1200 ms in unifrom distribution + ```shelladb shell setprop vendor.fingerprint.virtual.operation_authenticate_latency 600,1200``` + +## Lockout +To force the device into lockout state +```shell +$ adb shell setprop persist.vendor.fingerprint.virtual.lockout true +``` +To test permanent lockout based on the failed authentication attempts (e.g. 7) +```shell +$ adb shell setprop persist.vendor.fingerprint.virtual.lockout_permanent_threshold 7 +$ adb shell setprop persist.vendor.fingerprint.virtual.lockout_enable true +``` +To test timed lockout based on the failed authentication attempts (e.g. 8 seconds on 5 attempts) +```shell +$ adb shell setprop persist.vendor.fingerprint.virtual.lockout_timed_duration 8000 +$ adb shell setprop persist.vendor.fingerprint.virtual.lockout_timed_threshold 5 +$ adb shell setprop persist.vendor.fingerprint.virtual.lockout_enable true +``` + +## Reset all configurations to default +The following command will reset virtual configurations (related system properties) to default value. +```shell +$ adb shell cmd android.hardware.biometrics.fingerprint.IFingerprint/virtual resetconfig +$ adb reboot +``` + ## View HAL State To view all the properties of the HAL (see `fingerprint.sysprop` file for the API): @@ -126,3 +159,7 @@ To view all the properties of the HAL (see `fingerprint.sysprop` file for the AP ```shell $ adb shell getprop | grep vendor.fingerprint.virtual ``` +To dump virtual HAL internal data +```shell +adb shell dumpsys android.hardware.biometrics.fingerprint.IFingerprint/virtual +``` diff --git a/biometrics/fingerprint/aidl/default/Session.cpp b/biometrics/fingerprint/aidl/default/Session.cpp index e51f677744..7ab5af3c4d 100644 --- a/biometrics/fingerprint/aidl/default/Session.cpp +++ b/biometrics/fingerprint/aidl/default/Session.cpp @@ -20,6 +20,9 @@ #include "util/CancellationSignal.h" +#undef LOG_TAG +#define LOG_TAG "FingerprintVirtualHalSession" + namespace aidl::android::hardware::biometrics::fingerprint { Session::Session(int sensorId, int userId, std::shared_ptr cb, diff --git a/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt b/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt index fa21663a17..e69de29bb2 100644 --- a/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt +++ b/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt @@ -1,155 +0,0 @@ -props { - owner: Vendor - module: "android.fingerprint.virt.FingerprintHalProperties" - prop { - api_name: "authenticator_id" - type: Long - access: ReadWrite - prop_name: "persist.vendor.fingerprint.virtual.authenticator_id" - } - prop { - api_name: "challenge" - type: Long - access: ReadWrite - prop_name: "vendor.fingerprint.virtual.challenge" - } - prop { - api_name: "control_illumination" - access: ReadWrite - prop_name: "persist.vendor.fingerprint.virtual.udfps.control_illumination" - } - prop { - api_name: "detect_interaction" - access: ReadWrite - prop_name: "persist.vendor.fingerprint.virtual.detect_interaction" - } - prop { - api_name: "display_touch" - access: ReadWrite - prop_name: "persist.vendor.fingerprint.virtual.udfps.display_touch" - } - prop { - api_name: "enrollment_hit" - type: Integer - access: ReadWrite - prop_name: "vendor.fingerprint.virtual.enrollment_hit" - } - prop { - api_name: "enrollments" - type: IntegerList - access: ReadWrite - prop_name: "persist.vendor.fingerprint.virtual.enrollments" - } - prop { - api_name: "lockout" - access: ReadWrite - prop_name: "persist.vendor.fingerprint.virtual.lockout" - } - prop { - api_name: "max_enrollments" - type: Integer - access: ReadWrite - prop_name: "persist.vendor.fingerprint.virtual.max_enrollments" - } - prop { - api_name: "navigation_guesture" - access: ReadWrite - prop_name: "persist.vendor.fingerprint.virtual.navigation_guesture" - } - prop { - api_name: "next_enrollment" - type: String - access: ReadWrite - prop_name: "vendor.fingerprint.virtual.next_enrollment" - } - prop { - api_name: "operation_authenticate_acquired" - type: String - access: ReadWrite - prop_name: "vendor.fingerprint.virtual.operation_authenticate_acquired" - } - prop { - api_name: "operation_authenticate_duration" - type: Integer - access: ReadWrite - prop_name: "vendor.fingerprint.virtual.operation_authenticate_duration" - } - prop { - api_name: "operation_authenticate_error" - type: Integer - access: ReadWrite - prop_name: "vendor.fingerprint.virtual.operation_authenticate_error" - } - prop { - api_name: "operation_authenticate_fails" - access: ReadWrite - prop_name: "vendor.fingerprint.virtual.operation_authenticate_fails" - } - prop { - api_name: "operation_authenticate_latency" - type: Integer - access: ReadWrite - prop_name: "vendor.fingerprint.virtual.operation_authenticate_latency" - } - prop { - api_name: "operation_detect_interaction_acquired" - type: String - access: ReadWrite - prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_acquired" - } - prop { - api_name: "operation_detect_interaction_duration" - type: Integer - access: ReadWrite - prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_duration" - } - prop { - api_name: "operation_detect_interaction_error" - type: Integer - access: ReadWrite - prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_error" - } - prop { - api_name: "operation_detect_interaction_latency" - type: Integer - access: ReadWrite - prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_latency" - } - prop { - api_name: "operation_enroll_error" - type: Integer - access: ReadWrite - prop_name: "vendor.fingerprint.virtual.operation_enroll_error" - } - prop { - api_name: "operation_enroll_latency" - type: Integer - access: ReadWrite - prop_name: "vendor.fingerprint.virtual.operation_enroll_latency" - } - prop { - api_name: "sensor_id" - type: Integer - access: ReadWrite - prop_name: "persist.vendor.fingerprint.virtual.sensor_id" - } - prop { - api_name: "sensor_location" - type: String - access: ReadWrite - prop_name: "persist.vendor.fingerprint.virtual.sensor_location" - } - prop { - api_name: "sensor_strength" - type: Integer - access: ReadWrite - prop_name: "persist.vendor.fingerprint.virtual.sensor_strength" - } - prop { - api_name: "type" - type: String - access: ReadWrite - prop_name: "persist.vendor.fingerprint.virtual.type" - enum_values: "default|rear|udfps|side" - } -} diff --git a/biometrics/fingerprint/aidl/default/fingerprint.sysprop b/biometrics/fingerprint/aidl/default/fingerprint.sysprop index 9b8fada927..6a6c29728b 100644 --- a/biometrics/fingerprint/aidl/default/fingerprint.sysprop +++ b/biometrics/fingerprint/aidl/default/fingerprint.sysprop @@ -7,7 +7,7 @@ owner: Vendor prop { prop_name: "persist.vendor.fingerprint.virtual.type" type: String - scope: Public + scope: Internal access: ReadWrite enum_values: "default|rear|udfps|side" api_name: "type" @@ -17,7 +17,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.enrollments" type: IntegerList - scope: Public + scope: Internal access: ReadWrite api_name: "enrollments" } @@ -27,7 +27,7 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.enrollment_hit" type: Integer - scope: Public + scope: Internal access: ReadWrite api_name: "enrollment_hit" } @@ -42,7 +42,7 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.next_enrollment" type: String - scope: Public + scope: Internal access: ReadWrite api_name: "next_enrollment" } @@ -51,7 +51,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.authenticator_id" type: Long - scope: Public + scope: Internal access: ReadWrite api_name: "authenticator_id" } @@ -60,25 +60,16 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.challenge" type: Long - scope: Public + scope: Internal access: ReadWrite api_name: "challenge" } -# if locked out -prop { - prop_name: "persist.vendor.fingerprint.virtual.lockout" - type: Boolean - scope: Public - access: ReadWrite - api_name: "lockout" -} - # force all authenticate operations to fail prop { prop_name: "vendor.fingerprint.virtual.operation_authenticate_fails" type: Boolean - scope: Public + scope: Internal access: ReadWrite api_name: "operation_authenticate_fails" } @@ -91,7 +82,7 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_error" type: Integer - scope: Public + scope: Internal access: ReadWrite api_name: "operation_detect_interaction_error" } @@ -100,34 +91,40 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.operation_enroll_error" type: Integer - scope: Public + scope: Internal access: ReadWrite api_name: "operation_enroll_error" } # add a latency to authentication operations +# default to 400ms +# [x] = x ms +# [x,y] = randomly between x and y ms +# others = invalid prop { prop_name: "vendor.fingerprint.virtual.operation_authenticate_latency" - type: Integer - scope: Public + type: IntegerList + scope: Internal access: ReadWrite api_name: "operation_authenticate_latency" } # add a latency to detectInteraction operations +# refer to `operation_authenticate_latency` above for usage prop { prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_latency" - type: Integer - scope: Public + type: IntegerList + scope: Internal access: ReadWrite api_name: "operation_detect_interaction_latency" } # add a latency to enroll operations +# refer to `operation_authenticate_latency` above for usage prop { prop_name: "vendor.fingerprint.virtual.operation_enroll_latency" - type: Integer - scope: Public + type: IntegerList + scope: Internal access: ReadWrite api_name: "operation_enroll_latency" } @@ -137,7 +134,7 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.operation_authenticate_duration" type: Integer - scope: Public + scope: Internal access: ReadWrite api_name: "operation_authenticate_duration" } @@ -146,7 +143,7 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.operation_authenticate_error" type: Integer - scope: Public + scope: Internal access: ReadWrite api_name: "operation_authenticate_error" } @@ -156,7 +153,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.sensor_location" type: String - scope: Public + scope: Internal access: ReadWrite api_name: "sensor_location" } @@ -165,7 +162,7 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.operation_authenticate_acquired" type: String - scope: Public + scope: Internal access: ReadWrite api_name: "operation_authenticate_acquired" } @@ -175,7 +172,7 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_duration" type: Integer - scope: Public + scope: Internal access: ReadWrite api_name: "operation_detect_interaction_duration" } @@ -187,7 +184,7 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_acquired" type: String - scope: Public + scope: Internal access: ReadWrite api_name: "operation_detect_interaction_acquired" } @@ -196,7 +193,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.sensor_id" type: Integer - scope: Public + scope: Internal access: ReadWrite api_name: "sensor_id" } @@ -206,7 +203,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.sensor_strength" type: Integer - scope: Public + scope: Internal access: ReadWrite api_name: "sensor_strength" } @@ -216,7 +213,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.max_enrollments" type: Integer - scope: Public + scope: Internal access: ReadWrite api_name: "max_enrollments" } @@ -225,7 +222,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.navigation_guesture" type: Boolean - scope: Public + scope: Internal access: ReadWrite api_name: "navigation_guesture" } @@ -234,7 +231,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.detect_interaction" type: Boolean - scope: Public + scope: Internal access: ReadWrite api_name: "detect_interaction" } @@ -243,7 +240,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.udfps.display_touch" type: Boolean - scope: Public + scope: Internal access: ReadWrite api_name: "display_touch" } @@ -252,7 +249,52 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.udfps.control_illumination" type: Boolean - scope: Public + scope: Internal access: ReadWrite api_name: "control_illumination" } + +# force to be locked out (default: false) +prop { + prop_name: "persist.vendor.fingerprint.virtual.lockout" + type: Boolean + scope: Internal + access: ReadWrite + api_name: "lockout" +} + +# whether support lockout based on the failed auth attempts (default: false) +prop { + prop_name: "persist.vendor.fingerprint.virtual.lockout_enable" + type: Boolean + scope: Internal + access: ReadWrite + api_name: "lockout_enable" +} + +# temporarily lockout threshold in number of consecutive failed auth attempts (default: 5) +prop { + prop_name: "persist.vendor.fingerprint.virtual.lockout_timed_threshold" + type: Integer + scope: Internal + access: ReadWrite + api_name: "lockout_timed_threshold" +} + +# temporary lockout duration in ms (default: 10000ms) +prop { + prop_name: "persist.vendor.fingerprint.virtual.lockout_timed_duration" + type: Integer + scope: Internal + access: ReadWrite + api_name: "lockout_timed_duration" +} + +# permanently lockout threshold in number of consecutive failed auth attempts (default: 20) +prop { + prop_name: "persist.vendor.fingerprint.virtual.lockout_permanent_threshold" + type: Integer + scope: Internal + access: ReadWrite + api_name: "lockout_permanent_threshold" +} diff --git a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h index 22b1744134..1279cd92a5 100644 --- a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h +++ b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngine.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 The Android Open Source Project + * 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. @@ -15,8 +15,13 @@ */ #pragma once + +#define LOG_TAG "FingerprintVirtualHal" + #include #include +#include +#include #include @@ -24,6 +29,8 @@ #include #include +#include "FakeLockoutTracker.h" + using namespace ::aidl::android::hardware::biometrics::common; namespace aidl::android::hardware::biometrics::fingerprint { @@ -36,11 +43,11 @@ class FakeFingerprintEngine { void generateChallengeImpl(ISessionCallback* cb); void revokeChallengeImpl(ISessionCallback* cb, int64_t challenge); - void enrollImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& hat, - const std::future& cancel); - void authenticateImpl(ISessionCallback* cb, int64_t operationId, - const std::future& cancel); - void detectInteractionImpl(ISessionCallback* cb, const std::future& cancel); + virtual void enrollImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& hat, + const std::future& cancel); + virtual void authenticateImpl(ISessionCallback* cb, int64_t operationId, + const std::future& cancel); + virtual void detectInteractionImpl(ISessionCallback* cb, const std::future& cancel); void enumerateEnrollmentsImpl(ISessionCallback* cb); void removeEnrollmentsImpl(ISessionCallback* cb, const std::vector& enrollmentIds); void getAuthenticatorIdImpl(ISessionCallback* cb); @@ -63,13 +70,29 @@ class FakeFingerprintEngine { std::vector> parseEnrollmentCapture(const std::string& str); + int32_t getLatency(const std::vector>& latencyVec); + std::mt19937 mRandom; + virtual std::string toString() const { + std::ostringstream os; + os << "----- FakeFingerprintEngine:: -----" << std::endl; + os << "acquiredVendorInfoBase:" << FINGERPRINT_ACQUIRED_VENDOR_BASE; + os << ", errorVendorBase:" << FINGERPRINT_ERROR_VENDOR_BASE << std::endl; + os << mLockoutTracker.toString(); + return os.str(); + } + private: static constexpr int32_t FINGERPRINT_ACQUIRED_VENDOR_BASE = 1000; static constexpr int32_t FINGERPRINT_ERROR_VENDOR_BASE = 1000; std::pair convertAcquiredInfo(int32_t code); std::pair convertError(int32_t code); + bool parseEnrollmentCaptureSingle(const std::string& str, + std::vector>& res); + int32_t getRandomInRange(int32_t bound1, int32_t bound2); + + FakeLockoutTracker mLockoutTracker; }; } // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineRear.h b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineRear.h index 1600a4b560..14d5399fa4 100644 --- a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineRear.h +++ b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineRear.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 The Android Open Source Project + * 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. diff --git a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineSide.h b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineSide.h index 4e44d16d1e..c2fc005ffc 100644 --- a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineSide.h +++ b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineSide.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 The Android Open Source Project + * 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. diff --git a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineUdfps.h b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineUdfps.h index b86af736bb..c5e93e72aa 100644 --- a/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineUdfps.h +++ b/biometrics/fingerprint/aidl/default/include/FakeFingerprintEngineUdfps.h @@ -28,17 +28,55 @@ class FakeFingerprintEngineUdfps : public FakeFingerprintEngine { static constexpr int32_t defaultSensorLocationY = 1600; static constexpr int32_t defaultSensorRadius = 150; - FakeFingerprintEngineUdfps() : FakeFingerprintEngine() {} + static constexpr int32_t uiReadyTimeoutInMs = 5000; + + FakeFingerprintEngineUdfps(); ~FakeFingerprintEngineUdfps() {} - virtual ndk::ScopedAStatus onPointerDownImpl(int32_t pointerId, int32_t x, int32_t y, - float minor, float major) override; + ndk::ScopedAStatus onPointerDownImpl(int32_t pointerId, int32_t x, int32_t y, float minor, + float major) override; - virtual ndk::ScopedAStatus onPointerUpImpl(int32_t pointerId) override; + ndk::ScopedAStatus onPointerUpImpl(int32_t pointerId) override; - virtual ndk::ScopedAStatus onUiReadyImpl() override; + ndk::ScopedAStatus onUiReadyImpl() override; - virtual SensorLocation defaultSensorLocation() override; + SensorLocation defaultSensorLocation() override; + + void enrollImpl(ISessionCallback* cb, const keymaster::HardwareAuthToken& hat, + const std::future& cancel); + void authenticateImpl(ISessionCallback* cb, int64_t operationId, + const std::future& cancel); + void detectInteractionImpl(ISessionCallback* cb, const std::future& cancel); + + enum class WorkMode : int8_t { kIdle = 0, kAuthenticate, kEnroll, kDetectInteract }; + + WorkMode getWorkMode() { return mWorkMode; } + + std::string toString() const { + std::ostringstream os; + os << FakeFingerprintEngine::toString(); + os << "----- FakeFingerprintEngineUdfps -----" << std::endl; + os << "mWorkMode:" << (int)mWorkMode; + os << ", mUiReadyTime:" << mUiReadyTime; + os << ", mPointerDownTime:" << mPointerDownTime << std::endl; + return os.str(); + } + + private: + void onAuthenticateFingerDown(); + void onEnrollFingerDown(); + void onDetectInteractFingerDown(); + void fingerDownAction(); + void updateContext(WorkMode mode, ISessionCallback* cb, std::future& cancel, + int64_t operationId, const keymaster::HardwareAuthToken& hat); + + WorkMode mWorkMode; + ISessionCallback* mCb; + keymaster::HardwareAuthToken mHat; + std::vector> mCancelVec; + int64_t mOperationId; + int64_t mPointerDownTime; + int64_t mUiReadyTime; }; } // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/include/FakeLockoutTracker.h b/biometrics/fingerprint/aidl/default/include/FakeLockoutTracker.h new file mode 100644 index 0000000000..a1b6128a9e --- /dev/null +++ b/biometrics/fingerprint/aidl/default/include/FakeLockoutTracker.h @@ -0,0 +1,51 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include + +namespace aidl::android::hardware::biometrics::fingerprint { + +class FakeLockoutTracker { + public: + FakeLockoutTracker() : mFailedCount(0) {} + ~FakeLockoutTracker() {} + + enum class LockoutMode : int8_t { kNone = 0, kTimed, kPermanent }; + + void reset(); + LockoutMode getMode(); + void addFailedAttempt(); + int64_t getLockoutTimeLeft(); + inline std::string toString() const { + std::ostringstream os; + os << "----- FakeLockoutTracker:: -----" << std::endl; + os << "FakeLockoutTracker::mFailedCount:" << mFailedCount; + os << ", FakeLockoutTracker::mCurrentMode:" << (int)mCurrentMode; + os << std::endl; + return os.str(); + } + + private: + int32_t mFailedCount; + int64_t mLockoutTimedStart; + LockoutMode mCurrentMode; +}; + +} // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/include/Fingerprint.h b/biometrics/fingerprint/aidl/default/include/Fingerprint.h index 64aafa30fb..fc4fb8dbff 100644 --- a/biometrics/fingerprint/aidl/default/include/Fingerprint.h +++ b/biometrics/fingerprint/aidl/default/include/Fingerprint.h @@ -16,8 +16,6 @@ #pragma once -#define LOG_TAG "FingerprintVirtualHal" - #include #include "FakeFingerprintEngine.h" @@ -39,8 +37,13 @@ class Fingerprint : public BnFingerprint { ndk::ScopedAStatus createSession(int32_t sensorId, int32_t userId, const std::shared_ptr& cb, std::shared_ptr* out) override; + binder_status_t dump(int fd, const char** args, uint32_t numArgs); + binder_status_t handleShellCommand(int in, int out, int err, const char** argv, uint32_t argc); private: + void resetConfigToDefault(); + void onHelp(int); + std::unique_ptr mEngine; WorkerThread mWorker; std::shared_ptr mSession; diff --git a/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineTest.cpp b/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineTest.cpp index 32d01f400f..a200b39739 100644 --- a/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineTest.cpp +++ b/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 The Android Open Source Project + * 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. @@ -21,6 +21,7 @@ #include #include "FakeFingerprintEngine.h" +#include "util/Util.h" using namespace ::android::fingerprint::virt; using namespace ::aidl::android::hardware::biometrics::fingerprint; @@ -118,9 +119,9 @@ class TestSessionCallback : public BnSessionCallback { class FakeFingerprintEngineTest : public ::testing::Test { protected: void SetUp() override { - FingerprintHalProperties::operation_enroll_latency(0); - FingerprintHalProperties::operation_authenticate_latency(0); - FingerprintHalProperties::operation_detect_interaction_latency(0); + FingerprintHalProperties::operation_enroll_latency({0}); + FingerprintHalProperties::operation_authenticate_latency({0}); + FingerprintHalProperties::operation_detect_interaction_latency({0}); mCallback = ndk::SharedRefBase::make(); } @@ -128,6 +129,9 @@ class FakeFingerprintEngineTest : public ::testing::Test { FingerprintHalProperties::operation_authenticate_error(0); FingerprintHalProperties::operation_detect_interaction_error(0); FingerprintHalProperties::operation_authenticate_acquired(""); + FingerprintHalProperties::operation_enroll_latency({}); + FingerprintHalProperties::operation_authenticate_latency({}); + FingerprintHalProperties::operation_detect_interaction_latency({}); } FakeFingerprintEngine mEngine; @@ -291,6 +295,7 @@ TEST_F(FakeFingerprintEngineTest, AuthenticateAcquired) { } TEST_F(FakeFingerprintEngineTest, InteractionDetect) { + FingerprintHalProperties::detect_interaction(true); FingerprintHalProperties::enrollments({1, 2}); FingerprintHalProperties::enrollment_hit(2); FingerprintHalProperties::operation_detect_interaction_acquired(""); @@ -300,6 +305,7 @@ TEST_F(FakeFingerprintEngineTest, InteractionDetect) { } TEST_F(FakeFingerprintEngineTest, InteractionDetectCancel) { + FingerprintHalProperties::detect_interaction(true); FingerprintHalProperties::enrollments({1, 2}); FingerprintHalProperties::enrollment_hit(2); mCancel.set_value(); @@ -309,6 +315,7 @@ TEST_F(FakeFingerprintEngineTest, InteractionDetectCancel) { } TEST_F(FakeFingerprintEngineTest, InteractionDetectNotSet) { + FingerprintHalProperties::detect_interaction(true); FingerprintHalProperties::enrollments({1, 2}); FingerprintHalProperties::enrollment_hit({}); mEngine.detectInteractionImpl(mCallback.get(), mCancel.get_future()); @@ -323,6 +330,7 @@ TEST_F(FakeFingerprintEngineTest, InteractionDetectNotEnrolled) { } TEST_F(FakeFingerprintEngineTest, InteractionDetectError) { + FingerprintHalProperties::detect_interaction(true); FingerprintHalProperties::operation_detect_interaction_error(8); mEngine.detectInteractionImpl(mCallback.get(), mCancel.get_future()); ASSERT_EQ(0, mCallback->mInteractionDetectedCount); @@ -331,6 +339,7 @@ TEST_F(FakeFingerprintEngineTest, InteractionDetectError) { } TEST_F(FakeFingerprintEngineTest, InteractionDetectAcquired) { + FingerprintHalProperties::detect_interaction(true); FingerprintHalProperties::enrollments({1, 2}); FingerprintHalProperties::enrollment_hit(2); FingerprintHalProperties::operation_detect_interaction_acquired("4,1013"); @@ -435,12 +444,29 @@ TEST_F(FakeFingerprintEngineTest, parseEnrollmentCaptureFail) { std::vector badStr{"10c", "100-5", "100-[5,6,7", "100-5,6,7]", "100,2x0,300", "200-[f]", "a,b"}; std::vector> ecV; - for (const auto s : badStr) { + for (const auto& s : badStr) { ecV = mEngine.parseEnrollmentCapture(s); ASSERT_EQ(ecV.size(), 0); } } +TEST_F(FakeFingerprintEngineTest, randomLatency) { + FingerprintHalProperties::operation_detect_interaction_latency({}); + ASSERT_EQ(DEFAULT_LATENCY, + mEngine.getLatency(FingerprintHalProperties::operation_detect_interaction_latency())); + FingerprintHalProperties::operation_detect_interaction_latency({10}); + ASSERT_EQ(10, + mEngine.getLatency(FingerprintHalProperties::operation_detect_interaction_latency())); + FingerprintHalProperties::operation_detect_interaction_latency({1, 1000}); + std::set latencySet; + for (int i = 0; i < 100; i++) { + latencySet.insert(mEngine.getLatency( + FingerprintHalProperties::operation_detect_interaction_latency())); + } + ASSERT_TRUE(latencySet.size() > 95); + FingerprintHalProperties::operation_detect_interaction_latency({}); +} + } // namespace aidl::android::hardware::biometrics::fingerprint int main(int argc, char** argv) { diff --git a/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineUdfpsTest.cpp b/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineUdfpsTest.cpp index 7c0021fb26..f551899260 100644 --- a/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineUdfpsTest.cpp +++ b/biometrics/fingerprint/aidl/default/tests/FakeFingerprintEngineUdfpsTest.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#include #include #include #include @@ -29,6 +30,69 @@ using namespace ::aidl::android::hardware::keymaster; namespace aidl::android::hardware::biometrics::fingerprint { +class TestSessionCallback : public BnSessionCallback { + public: + ndk::ScopedAStatus onChallengeGenerated(int64_t /*challenge*/) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onChallengeRevoked(int64_t /*challenge*/) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onError(fingerprint::Error /*error*/, int32_t /*vendorCode*/) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onEnrollmentProgress(int32_t /*enrollmentId*/, + int32_t /*remaining*/) override { + mEnrollmentProgress++; + return ndk::ScopedAStatus::ok(); + }; + + ::ndk::ScopedAStatus onAuthenticationSucceeded(int32_t /*enrollmentId*/, + const keymaster::HardwareAuthToken&) override { + mAuthenticationSuccess++; + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onAuthenticationFailed() override { + mAuthenticationFailure++; + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onInteractionDetected() override { + mDetectInteraction++; + return ndk::ScopedAStatus::ok(); + }; + ndk::ScopedAStatus onAcquired(AcquiredInfo /*info*/, int32_t /*vendorCode*/) override { + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus onEnrollmentsEnumerated( + const std::vector& /*enrollmentIds*/) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onEnrollmentsRemoved( + const std::vector& /*enrollmentIds*/) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onAuthenticatorIdRetrieved(int64_t /*authenticatorId*/) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onAuthenticatorIdInvalidated(int64_t /*authenticatorId*/) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onLockoutPermanent() override { return ndk::ScopedAStatus::ok(); }; + ndk::ScopedAStatus onLockoutTimed(int64_t /* timeout */) override { + return ndk::ScopedAStatus::ok(); + } + ndk::ScopedAStatus onLockoutCleared() override { return ndk::ScopedAStatus::ok(); } + ndk::ScopedAStatus onSessionClosed() override { return ndk::ScopedAStatus::ok(); } + + int32_t getAuthenticationCount() { return mAuthenticationSuccess + mAuthenticationFailure; } + int32_t getDetectInteractionCount() { return mDetectInteraction; } + + int32_t mAuthenticationSuccess = 0; + int32_t mAuthenticationFailure = 0; + int32_t mEnrollmentProgress = 0; + int32_t mDetectInteraction = 0; +}; + class FakeFingerprintEngineUdfpsTest : public ::testing::Test { protected: void SetUp() override {} @@ -65,30 +129,56 @@ TEST_F(FakeFingerprintEngineUdfpsTest, getSensorLocationOk) { } TEST_F(FakeFingerprintEngineUdfpsTest, getSensorLocationBad) { - FingerprintHalProperties::sensor_location(""); - SensorLocation sc = mEngine.getSensorLocation(); - ASSERT_TRUE(isDefaultLocation(sc)); - - auto loc = "100"; - FingerprintHalProperties::sensor_location(loc); - sc = mEngine.getSensorLocation(); - ASSERT_TRUE(isDefaultLocation(sc)); - - loc = "10:20"; - FingerprintHalProperties::sensor_location(loc); - sc = mEngine.getSensorLocation(); - ASSERT_TRUE(isDefaultLocation(sc)); - - loc = "10,20,5"; - FingerprintHalProperties::sensor_location(loc); - sc = mEngine.getSensorLocation(); - ASSERT_TRUE(isDefaultLocation(sc)); - - loc = "a:b:c"; - FingerprintHalProperties::sensor_location(loc); - sc = mEngine.getSensorLocation(); - ASSERT_TRUE(isDefaultLocation(sc)); + const std::vector badStr{"", "100", "10:20", "10,20,5", "a:b:c"}; + SensorLocation sc; + for (const auto& s : badStr) { + FingerprintHalProperties::sensor_location(s); + sc = mEngine.getSensorLocation(); + ASSERT_TRUE(isDefaultLocation(sc)); + } } +TEST_F(FakeFingerprintEngineUdfpsTest, initialization) { + ASSERT_TRUE(mEngine.getWorkMode() == FakeFingerprintEngineUdfps::WorkMode::kIdle); +} + +TEST_F(FakeFingerprintEngineUdfpsTest, authenticate) { + std::shared_ptr cb = ndk::SharedRefBase::make(); + std::promise cancel; + mEngine.authenticateImpl(cb.get(), 1, cancel.get_future()); + ASSERT_TRUE(mEngine.getWorkMode() == FakeFingerprintEngineUdfps::WorkMode::kAuthenticate); + mEngine.onPointerDownImpl(1, 2, 3, 4.0, 5.0); + ASSERT_EQ(cb->getAuthenticationCount(), 0); + mEngine.onUiReadyImpl(); + ASSERT_EQ(cb->getAuthenticationCount(), 1); +} + +TEST_F(FakeFingerprintEngineUdfpsTest, enroll) { + std::shared_ptr cb = ndk::SharedRefBase::make(); + std::promise cancel; + keymaster::HardwareAuthToken hat{.mac = {5, 6}}; + FingerprintHalProperties::next_enrollment("5:0,0:true"); + mEngine.enrollImpl(cb.get(), hat, cancel.get_future()); + ASSERT_TRUE(mEngine.getWorkMode() == FakeFingerprintEngineUdfps::WorkMode::kEnroll); + mEngine.onPointerDownImpl(1, 2, 3, 4.0, 5.0); + ASSERT_EQ(cb->mEnrollmentProgress, 0); + mEngine.onUiReadyImpl(); + ASSERT_TRUE(cb->mEnrollmentProgress > 0); +} + +TEST_F(FakeFingerprintEngineUdfpsTest, detectInteraction) { + FingerprintHalProperties::detect_interaction(true); + FingerprintHalProperties::enrollments({1, 2}); + FingerprintHalProperties::enrollment_hit(2); + FingerprintHalProperties::operation_detect_interaction_acquired(""); + std::shared_ptr cb = ndk::SharedRefBase::make(); + std::promise cancel; + mEngine.detectInteractionImpl(cb.get(), cancel.get_future()); + ASSERT_TRUE(mEngine.getWorkMode() == FakeFingerprintEngineUdfps::WorkMode::kDetectInteract); + mEngine.onPointerDownImpl(1, 2, 3, 4.0, 5.0); + ASSERT_EQ(cb->getDetectInteractionCount(), 0); + mEngine.onUiReadyImpl(); + ASSERT_EQ(cb->getDetectInteractionCount(), 1); +} // More } // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/tests/FakeLockoutTrackerTest.cpp b/biometrics/fingerprint/aidl/default/tests/FakeLockoutTrackerTest.cpp new file mode 100644 index 0000000000..1b071eecd2 --- /dev/null +++ b/biometrics/fingerprint/aidl/default/tests/FakeLockoutTrackerTest.cpp @@ -0,0 +1,95 @@ +/* + * 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. + */ + +#include +#include +#include + +#include + +#include "FakeLockoutTracker.h" +#include "util/Util.h" + +using namespace ::android::fingerprint::virt; +using namespace ::aidl::android::hardware::biometrics::fingerprint; + +namespace aidl::android::hardware::biometrics::fingerprint { + +class FakeLockoutTrackerTest : public ::testing::Test { + protected: + static constexpr int32_t LOCKOUT_TIMED_THRESHOLD = 3; + static constexpr int32_t LOCKOUT_PERMANENT_THRESHOLD = 5; + static constexpr int32_t LOCKOUT_TIMED_DURATION = 100; + + void SetUp() override { + FingerprintHalProperties::lockout_timed_threshold(LOCKOUT_TIMED_THRESHOLD); + FingerprintHalProperties::lockout_timed_duration(LOCKOUT_TIMED_DURATION); + FingerprintHalProperties::lockout_permanent_threshold(LOCKOUT_PERMANENT_THRESHOLD); + } + + void TearDown() override { + // reset to default + FingerprintHalProperties::lockout_timed_threshold(5); + FingerprintHalProperties::lockout_timed_duration(20); + FingerprintHalProperties::lockout_permanent_threshold(10000); + FingerprintHalProperties::lockout_enable(false); + FingerprintHalProperties::lockout(false); + } + + FakeLockoutTracker mLockoutTracker; +}; + +TEST_F(FakeLockoutTrackerTest, addFailedAttemptDisable) { + FingerprintHalProperties::lockout_enable(false); + for (int i = 0; i < LOCKOUT_TIMED_THRESHOLD + 1; i++) mLockoutTracker.addFailedAttempt(); + ASSERT_EQ(mLockoutTracker.getMode(), FakeLockoutTracker::LockoutMode::kNone); + mLockoutTracker.reset(); +} + +TEST_F(FakeLockoutTrackerTest, addFailedAttemptLockoutTimed) { + FingerprintHalProperties::lockout_enable(true); + for (int i = 0; i < LOCKOUT_TIMED_THRESHOLD; i++) mLockoutTracker.addFailedAttempt(); + ASSERT_EQ(mLockoutTracker.getMode(), FakeLockoutTracker::LockoutMode::kTimed); + // time left + int N = 5; + int64_t prevTimeLeft = INT_MIN; + for (int i = 0; i < N; i++) { + SLEEP_MS(LOCKOUT_TIMED_DURATION / N + 1); + int64_t currTimeLeft = mLockoutTracker.getLockoutTimeLeft(); + ASSERT_TRUE(currTimeLeft > prevTimeLeft); + prevTimeLeft = currTimeLeft; + } + ASSERT_EQ(mLockoutTracker.getMode(), FakeLockoutTracker::LockoutMode::kNone); + mLockoutTracker.reset(); +} + +TEST_F(FakeLockoutTrackerTest, addFailedAttemptPermanent) { + FingerprintHalProperties::lockout_enable(true); + for (int i = 0; i < LOCKOUT_PERMANENT_THRESHOLD - 1; i++) mLockoutTracker.addFailedAttempt(); + ASSERT_NE(mLockoutTracker.getMode(), FakeLockoutTracker::LockoutMode::kPermanent); + mLockoutTracker.addFailedAttempt(); + ASSERT_EQ(mLockoutTracker.getMode(), FakeLockoutTracker::LockoutMode::kPermanent); + ASSERT_TRUE(FingerprintHalProperties::lockout()); + mLockoutTracker.reset(); +} + +} // namespace aidl::android::hardware::biometrics::fingerprint + +int main(int argc, char** argv) { + testing::InitGoogleTest(&argc, argv); + ABinderProcess_startThreadPool(); + return RUN_ALL_TESTS(); +} From 8ec063ff4d5775cd279047f43a2297a9d9337626 Mon Sep 17 00:00:00 2001 From: Sally Qi Date: Sat, 12 Nov 2022 11:18:56 -0800 Subject: [PATCH 362/998] Revup android.hardware.graphics.composer3 v1 to v2 for cuttelfish. - Enable Vts getOverlaySupport case. Bug: 250036572 Test: this Change-Id: I8a4acb53d5ac317f5dd51fefeeb2bc0859ad1c40 --- compatibility_matrices/compatibility_matrix.current.xml | 2 +- .../composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index e4fd65e912..ab490dd842 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -276,7 +276,7 @@ android.hardware.graphics.composer3 - 1 + 2 IComposer default diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index ed8a06c188..9c8ffe6b0d 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -809,8 +809,7 @@ TEST_P(GraphicsComposerAidlTest, GetDisplayName) { EXPECT_TRUE(status.isOk()); } -// TODO(b/250036572): disable this due to no implementation and revup on cuttlefish -TEST_P(GraphicsComposerAidlTest, DISABLED_GetOverlaySupport) { +TEST_P(GraphicsComposerAidlTest, GetOverlaySupport) { const auto& [status, _] = mComposerClient->getOverlaySupport(); if (!status.isOk() && status.getExceptionCode() == EX_SERVICE_SPECIFIC && status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) { From 53b81c9035bcc7d90e44d234c0845f4227795060 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Mon, 7 Nov 2022 17:47:04 -0800 Subject: [PATCH 363/998] Add HAL changes for STEERING_WHEEL_HEIGHT_POS Bug: 257267718 Test: atest VtsHalAutomotiveVehicle_TargetTest atest CtsCarTestCases:CarPropertyManagerTest atest CtsCarTestCases:VehiclePropertyIdsTest Change-Id: I63ea5ac5d7d238799a2300a06b93fc40155d2801 --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 17 +++++++++++++++++ .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../config/DefaultProperties.json | 15 +++++++++++++++ .../src/VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 43 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index a50cc80b91..c8ecef85f7 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -159,6 +159,7 @@ enum VehicleProperty { WINDOW_LOCK = 320867268, STEERING_WHEEL_DEPTH_POS = 289410016, STEERING_WHEEL_DEPTH_MOVE = 289410017, + STEERING_WHEEL_HEIGHT_POS = 289410018, VEHICLE_MAP_SERVICE = 299895808, OBD2_LIVE_FRAME = 299896064, OBD2_FREEZE_FRAME = 299896065, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index fb43d9a393..dd27704d3a 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1799,6 +1799,23 @@ enum VehicleProperty { */ STEERING_WHEEL_DEPTH_MOVE = 0x0BE1 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** + * Steering wheel height position + * + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All values between + * minInt32Value and maxInt32Value must be supported. + * + * The maxInt32Value in default area's VehicleAreaConfig indicates the steering wheel being in + * the highest position. The minInt32Value in default area's VehicleAreaConfig indicates the + * steering wheel being in the lowest position. + * + * This value is not in any particular unit but in a specified range of steps. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + STEERING_WHEEL_HEIGHT_POS = + 0x0BE2 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, /** * Vehicle Maps Service (VMS) message * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index e5ce8e1075..309dfe7aae 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -159,6 +159,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::WINDOW_LOCK, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::STEERING_WHEEL_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyAccess::READ}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyAccess::READ}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 625ad199c6..a55970e05d 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -159,6 +159,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::WINDOW_LOCK, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::STEERING_WHEEL_HEIGHT_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 22e941107a..d4c7341bcf 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -151,6 +151,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.WINDOW_LOCK, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyAccess.READ), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 8d2efe988a..079936f9f5 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -151,6 +151,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.WINDOW_LOCK, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 7e55f9ca05..00ce40217b 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2238,6 +2238,21 @@ } ] }, + { + "property": "VehicleProperty::STEERING_WHEEL_HEIGHT_POS", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": 0, + "minInt32Value": 0, + "maxInt32Value": 10 + } + ] + }, { "property": "VehicleProperty::WHEEL_TICK", "defaultValue": { diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 2b37d350dd..0c22b67892 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -499,6 +499,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelDepthMoveConfig) { VehicleArea::GLOBAL, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelHeightPosConfig) { + verifyProperty(VehicleProperty::STEERING_WHEEL_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + std::vector getDescriptors() { std::vector descriptors; for (std::string name : getAidlHalInstanceNames(IVehicle::descriptor)) { From c10018a3300815716f35f05e1b641e33877f7df8 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Mon, 14 Nov 2022 16:01:09 +0900 Subject: [PATCH 364/998] Set android.hardware.camera.provider as updatable android.hardware.camera.provider has been updatable since Android S. In Android U, HALs updatable via APEX should declare the updatability. Bug: 248142818 Test: checkvintf with updated DM Change-Id: I51ddb9d141c71d22b7c7909b33ebfc8a0a703431 --- compatibility_matrices/compatibility_matrix.current.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index e4fd65e912..e9690c5d90 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -173,7 +173,7 @@ .* - + android.hardware.camera.provider 1-2 From eee413c6672c5a8bbe015c5df43e28391896fbdd Mon Sep 17 00:00:00 2001 From: Binyi Wu Date: Tue, 15 Nov 2022 02:18:48 +0000 Subject: [PATCH 365/998] Revert "Add setNullCipherAndIntegrityEnabled to IRadioNetwork" Revert "Add setNullCipherAndIntegrityEnabled CTS to IRadioNetwor..." Revert "Add constants for setNullCipherAndIntegrityEnabled" Revert "Add RIL interface for setNullCipherAndIntegrityEnabled" Revert submission 20283075-setNullCipherAndIntegrityEnabled Reason for revert: DroidMonitor: Potential culprit for Bug b/259163733 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted. Reverted Changes: Idad17af0a:Add setNullCipherAndIntegrityEnabled CTS to IRadio... Ia72f7bdd6:Add constants for setNullCipherAndIntegrityEnabled... I5ea99cb06:Add setNullCipherAndIntegrityEnabled to IRadioNetw... I53403d9f7:Add RIL interface for setNullCipherAndIntegrityEna... Change-Id: I67bcd9497a5885be59543de790af522a27b75380 --- .../hardware/radio/network/IRadioNetwork.aidl | 1 - .../radio/network/IRadioNetworkResponse.aidl | 1 - .../hardware/radio/network/IRadioNetwork.aidl | 20 ------------------- .../radio/network/IRadioNetworkResponse.aidl | 10 ---------- .../include/libradiocompat/RadioNetwork.h | 2 -- .../libradiocompat/network/RadioNetwork.cpp | 7 ------- radio/aidl/vts/radio_network_response.cpp | 7 ------- radio/aidl/vts/radio_network_utils.h | 3 --- 8 files changed, 51 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl index 35d3807ba4..c115c86357 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl @@ -74,5 +74,4 @@ interface IRadioNetwork { oneway void triggerEmergencyNetworkScan(int serial, in android.hardware.radio.network.EmergencyNetworkScanTrigger request); oneway void cancelEmergencyNetworkScan(int serial, boolean resetScan); oneway void exitEmergencyMode(in int serial); - oneway void setNullCipherAndIntegrityEnabled(in int serial, in boolean enabled); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl index 141250d598..24d587e655 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -73,5 +73,4 @@ interface IRadioNetworkResponse { oneway void triggerEmergencyNetworkScanResponse(in android.hardware.radio.RadioResponseInfo info); oneway void exitEmergencyModeResponse(in android.hardware.radio.RadioResponseInfo info); oneway void cancelEmergencyNetworkScanResponse(in android.hardware.radio.RadioResponseInfo info); - oneway void setNullCipherAndIntegrityEnabledResponse(in android.hardware.radio.RadioResponseInfo info); } diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl index 28a69ac097..574798aa59 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl @@ -482,24 +482,4 @@ oneway interface IRadioNetwork { * Response function is IRadioEmergencyResponse.exitEmergencyModeResponse() */ void exitEmergencyMode(in int serial); - - /** - * Set if null encryption and integrity modes are enabled. If the value of enabled is false - * the modem must not allow any network communications with null ciphering or null integrity - * modes. In case of an emergency call, the modem must bypass this setting. - * - * Null ciphering and integrity modes include (but are not limited to): - * 2G: A5/0 - * 3G: UEA0 and UIA0 - * 4G: EEA0 and EIA0 - * 5G: NEA0 and NIA0 - * - * - * @param serial Serial number of the request. - * @param enabled To allow null encryption/integrity, set to true. - * Otherwise, false. - * - * Response callback is IRadioResponse.setNullCipherAndIntegrityEnabledResponse() - */ - void setNullCipherAndIntegrityEnabled(in int serial, in boolean enabled); } diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl index 0cde5e6210..fc4db2ca36 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -632,14 +632,4 @@ oneway interface IRadioNetworkResponse { * RadioError:MODEM_ERR */ void cancelEmergencyNetworkScanResponse(in RadioResponseInfo info); - - /** - * @param info Response info struct containing response type, serial no. and error - * - * Valid errors returned: - * RadioError:NONE - * RadioError:RADIO_NOT_AVAILABLE - * RadioError:MODEM_ERR - */ - void setNullCipherAndIntegrityEnabledResponse(in RadioResponseInfo info); } diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h index 2e0488d1c0..5dd6f0ae8d 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h @@ -100,8 +100,6 @@ class RadioNetwork : public RadioCompatBase, ::ndk::ScopedAStatus cancelEmergencyNetworkScan(int32_t serial, bool resetScan) override; ::ndk::ScopedAStatus exitEmergencyMode(int32_t serial) override; - ::ndk::ScopedAStatus setNullCipherAndIntegrityEnabled(int32_t serial, bool enabled) override; - protected: std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse> respond(); diff --git a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp index bbe7fd70de..6bb6b75b2e 100644 --- a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp +++ b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp @@ -340,11 +340,4 @@ ScopedAStatus RadioNetwork::exitEmergencyMode(int32_t serial) { return ok(); } -ScopedAStatus RadioNetwork::setNullCipherAndIntegrityEnabled(int32_t serial, bool) { - LOG_CALL << serial; - LOG(ERROR) << " setNullCipherAndIntegrityEnabled is unsupported by HIDL HALs"; - respond()->setNullCipherAndIntegrityEnabledResponse(notSupported(serial)); - return ok(); -} - } // namespace android::hardware::radio::compat diff --git a/radio/aidl/vts/radio_network_response.cpp b/radio/aidl/vts/radio_network_response.cpp index 82aaa1b85d..5599c0332f 100644 --- a/radio/aidl/vts/radio_network_response.cpp +++ b/radio/aidl/vts/radio_network_response.cpp @@ -293,10 +293,3 @@ ndk::ScopedAStatus RadioNetworkResponse::cancelEmergencyNetworkScanResponse( parent_network.notify(info.serial); return ndk::ScopedAStatus::ok(); } - -ndk::ScopedAStatus RadioNetworkResponse::setNullCipherAndIntegrityEnabledResponse( - const RadioResponseInfo& info) { - rspInfo = info; - parent_network.notify(info.serial); - return ndk::ScopedAStatus::ok(); -} diff --git a/radio/aidl/vts/radio_network_utils.h b/radio/aidl/vts/radio_network_utils.h index 67654b1494..8480825421 100644 --- a/radio/aidl/vts/radio_network_utils.h +++ b/radio/aidl/vts/radio_network_utils.h @@ -158,9 +158,6 @@ class RadioNetworkResponse : public BnRadioNetworkResponse { virtual ndk::ScopedAStatus cancelEmergencyNetworkScanResponse( const RadioResponseInfo& info) override; - - virtual ndk::ScopedAStatus setNullCipherAndIntegrityEnabledResponse( - const RadioResponseInfo& info) override; }; /* Callback class for radio network indication */ From 0cd9b7e48d16da0d2cc4c71d6e0c8d0740fb4b47 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Tue, 1 Mar 2022 21:00:22 +0000 Subject: [PATCH 366/998] Add VehicleApPowerBootupReason enum. Test: m android.hardware.automotive.vehicle-update-api Bug: 222024090 Change-Id: If49f96aac26a4a4ce64ecafcb8590f68bf329b88 --- .../vehicle/VehicleApPowerBootupReason.aidl | 40 +++++++++++++++++++ .../vehicle/VehicleApPowerBootupReason.aidl | 40 +++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerBootupReason.aidl create mode 100644 automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerBootupReason.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerBootupReason.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerBootupReason.aidl new file mode 100644 index 0000000000..9720aca787 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerBootupReason.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleApPowerBootupReason { + USER_POWER_ON = 0, + SYSTEM_USER_DETECTION = 1, + SYSTEM_REMOTE_ACCESS = 2, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerBootupReason.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerBootupReason.aidl new file mode 100644 index 0000000000..e325b380b7 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerBootupReason.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ + +package android.hardware.automotive.vehicle; + +/** + * Vehicle AP power bootup reason. + */ +@VintfStability +@Backing(type="int") +enum VehicleApPowerBootupReason { + /** + * Power on due to user's pressing of power key or rotating of ignition + * switch. + */ + USER_POWER_ON = 0, + /** + * Automatic power on triggered by door unlock or any other kind of automatic + * user detection. + */ + SYSTEM_USER_DETECTION = 1, + /** + * Automatic power on to execute a remote task. This is triggered by + * receiving a wakeup message from TCU wakeup client. + */ + SYSTEM_REMOTE_ACCESS = 2, +} From df17bd36e6ed84346fa8f387fadff1ec2a077895 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Sat, 3 Sep 2022 00:25:22 +0000 Subject: [PATCH 367/998] Update Supplicant HAL compatibility matrix entry to V2. Bug: 243980093 Bug: 244597141 Test: Treehugger tests Change-Id: I5968ac57112e2f0492250562c0b3f9ddfad85584 --- compatibility_matrices/compatibility_matrix.current.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index e9690c5d90..b597dfa25f 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -731,6 +731,7 @@ android.hardware.wifi.supplicant + 2 ISupplicant default From 76514ebd34b5b0fe3a49edd07af8f410d3a85fea Mon Sep 17 00:00:00 2001 From: Biswarup Pal Date: Sat, 5 Nov 2022 14:13:09 +0000 Subject: [PATCH 368/998] Add HAL API to pass GO interface MAC address in GC from supplicant The GO interface MAC address would be used to calculate the link-local IPv6 address of the GO in the GC side. Test: m Bug: 233912758 Change-Id: I8cdae90a2703d446dafbdfba8f99c191b751f552 --- .../ISupplicantP2pIfaceCallback.aidl | 1 + .../P2pGroupStartedEventParams.aidl | 46 +++++++++++++++++ .../ISupplicantP2pIfaceCallback.aidl | 8 +++ .../P2pGroupStartedEventParams.aidl | 50 +++++++++++++++++++ .../supplicant/aidl/vts/functional/Android.bp | 6 +-- .../supplicant_p2p_iface_aidl_test.cpp | 5 ++ 6 files changed, 113 insertions(+), 3 deletions(-) create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl create mode 100644 wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl index 8d9f498abb..da3ca52897 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl @@ -52,4 +52,5 @@ interface ISupplicantP2pIfaceCallback { oneway void onStaDeauthorized(in byte[] srcAddress, in byte[] p2pDeviceAddress); oneway void onGroupFrequencyChanged(in String groupIfname, in int frequency); oneway void onDeviceFoundWithVendorElements(in byte[] srcAddress, in byte[] p2pDeviceAddress, in byte[] primaryDeviceType, in String deviceName, in android.hardware.wifi.supplicant.WpsConfigMethods configMethods, in byte deviceCapabilities, in android.hardware.wifi.supplicant.P2pGroupCapabilityMask groupCapabilities, in byte[] wfdDeviceInfo, in byte[] wfdR2DeviceInfo, in byte[] vendorElemBytes); + oneway void onGroupStartedWithParams(in android.hardware.wifi.supplicant.P2pGroupStartedEventParams groupStartedEventParams); } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl new file mode 100644 index 0000000000..19611a9788 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable P2pGroupStartedEventParams { + String groupInterfaceName; + boolean isGroupOwner; + byte[] ssid; + int frequencyMHz; + byte[] psk; + String passphrase; + boolean isPersistent; + byte[] goDeviceAddress; + byte[] goInterfaceAddress; +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl index 7c8c1f28ae..9d6fa678b8 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl @@ -17,6 +17,7 @@ package android.hardware.wifi.supplicant; import android.hardware.wifi.supplicant.P2pGroupCapabilityMask; +import android.hardware.wifi.supplicant.P2pGroupStartedEventParams; import android.hardware.wifi.supplicant.P2pProvDiscStatusCode; import android.hardware.wifi.supplicant.P2pStatusCode; import android.hardware.wifi.supplicant.WpsConfigMethods; @@ -243,4 +244,11 @@ oneway interface ISupplicantP2pIfaceCallback { in byte[] primaryDeviceType, in String deviceName, in WpsConfigMethods configMethods, in byte deviceCapabilities, in P2pGroupCapabilityMask groupCapabilities, in byte[] wfdDeviceInfo, in byte[] wfdR2DeviceInfo, in byte[] vendorElemBytes); + + /** + * Used to indicate the start of a P2P group, with some parameters describing the group. + * + * @param groupStartedEventParams Parameters describing the P2P group. + */ + void onGroupStartedWithParams(in P2pGroupStartedEventParams groupStartedEventParams); } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl new file mode 100644 index 0000000000..a04153a58c --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl @@ -0,0 +1,50 @@ +/* + * 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. + */ + +package android.hardware.wifi.supplicant; + +/** + * Parameters passed as part of Wifi P2P group start event. + */ +@VintfStability +parcelable P2pGroupStartedEventParams { + /** Interface name of the group (For ex: p2p-p2p0-1). */ + String groupInterfaceName; + + /** Whether this device is owner of the group. */ + boolean isGroupOwner; + + /** SSID of the group. */ + byte[] ssid; + + /** Frequency in MHz on which this group is created. */ + int frequencyMHz; + + /** PSK used to secure the group. */ + byte[] psk; + + /** PSK passphrase used to secure the group. */ + String passphrase; + + /** Whether this group is persisted or not. */ + boolean isPersistent; + + /** MAC Address of the owner of this group. */ + byte[/* 6 */] goDeviceAddress; + + /** MAC Address of the P2P interface of the owner of this group. */ + byte[/* 6 */] goInterfaceAddress; +} diff --git a/wifi/supplicant/aidl/vts/functional/Android.bp b/wifi/supplicant/aidl/vts/functional/Android.bp index 8e142ec2c0..b959c7504d 100644 --- a/wifi/supplicant/aidl/vts/functional/Android.bp +++ b/wifi/supplicant/aidl/vts/functional/Android.bp @@ -44,7 +44,7 @@ cc_test { "android.hardware.wifi@1.5", "android.hardware.wifi.supplicant@1.0", "android.hardware.wifi.supplicant@1.1", - "android.hardware.wifi.supplicant-V1-ndk", + "android.hardware.wifi.supplicant-V2-ndk", "libwifi-system", "libwifi-system-iface", "VtsHalWifiV1_0TargetTestUtil", @@ -78,7 +78,7 @@ cc_test { "android.hardware.wifi@1.5", "android.hardware.wifi.supplicant@1.0", "android.hardware.wifi.supplicant@1.1", - "android.hardware.wifi.supplicant-V1-ndk", + "android.hardware.wifi.supplicant-V2-ndk", "libwifi-system", "libwifi-system-iface", "VtsHalWifiV1_0TargetTestUtil", @@ -112,7 +112,7 @@ cc_test { "android.hardware.wifi@1.5", "android.hardware.wifi.supplicant@1.0", "android.hardware.wifi.supplicant@1.1", - "android.hardware.wifi.supplicant-V1-ndk", + "android.hardware.wifi.supplicant-V2-ndk", "libwifi-system", "libwifi-system-iface", "VtsHalWifiV1_0TargetTestUtil", diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp index b7984fac42..ee0eff50c5 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp +++ b/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp @@ -37,6 +37,7 @@ using aidl::android::hardware::wifi::supplicant::ISupplicantP2pIface; using aidl::android::hardware::wifi::supplicant::MiracastMode; using aidl::android::hardware::wifi::supplicant::P2pFrameTypeMask; using aidl::android::hardware::wifi::supplicant::P2pGroupCapabilityMask; +using aidl::android::hardware::wifi::supplicant::P2pGroupStartedEventParams; using aidl::android::hardware::wifi::supplicant::P2pProvDiscStatusCode; using aidl::android::hardware::wifi::supplicant::P2pStatusCode; using aidl::android::hardware::wifi::supplicant::SupplicantStatusCode; @@ -177,6 +178,10 @@ class SupplicantP2pIfaceCallback : public BnSupplicantP2pIfaceCallback { const std::vector& /* vendorElemBytes */) override { return ndk::ScopedAStatus::ok(); } + ::ndk::ScopedAStatus onGroupStartedWithParams( + const P2pGroupStartedEventParams& /* groupStartedEventParams */) override { + return ndk::ScopedAStatus::ok(); + } }; class SupplicantP2pIfaceAidlTest : public testing::TestWithParam { From 71c3d17fd823303f34fbc262ae2bc56fa1501822 Mon Sep 17 00:00:00 2001 From: Zhanghao Wen Date: Mon, 14 Nov 2022 21:29:46 -0800 Subject: [PATCH 369/998] Update Cuttlefish mock GNSS hardware model name Test: atest GnssHardwareInfoTest Bug: 258680584 Change-Id: I17c877848aee4b607cd0d798e7c91a1987fd6286 --- gnss/aidl/default/Gnss.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnss/aidl/default/Gnss.cpp b/gnss/aidl/default/Gnss.cpp index 8a4d186131..8d3fc39fff 100644 --- a/gnss/aidl/default/Gnss.cpp +++ b/gnss/aidl/default/Gnss.cpp @@ -68,7 +68,7 @@ ScopedAStatus Gnss::setCallback(const std::shared_ptr& callback) IGnssCallback::GnssSystemInfo systemInfo = { .yearOfHw = 2022, - .name = "Google Mock GNSS Implementation AIDL v2", + .name = "Google, Cuttlefish, AIDL v3", }; status = sGnssCallback->gnssSetSystemInfoCb(systemInfo); if (!status.isOk()) { From 73f935c43b9fcfdbdd68992e5cf38e54aad3c655 Mon Sep 17 00:00:00 2001 From: John Reck Date: Tue, 15 Nov 2022 16:18:42 -0500 Subject: [PATCH 370/998] Preemptive imports to avoid conflicts from AOSP This is just a minimal staging of go/oag/topic:"imapper5" to handle the difference between AOSP's graphics-common and internal's graphics-common Test: make Change-Id: I6fbc22272ba95b44aa09ff08f9d9a7adbb9ae8be --- graphics/allocator/aidl/Android.bp | 1 + 1 file changed, 1 insertion(+) diff --git a/graphics/allocator/aidl/Android.bp b/graphics/allocator/aidl/Android.bp index 272ab48809..cd4885b8ea 100644 --- a/graphics/allocator/aidl/Android.bp +++ b/graphics/allocator/aidl/Android.bp @@ -17,6 +17,7 @@ aidl_interface { srcs: ["android/hardware/graphics/allocator/*.aidl"], imports: [ "android.hardware.common-V2", + "android.hardware.graphics.common-V4", ], stability: "vintf", backend: { From 9140b2ca7cab405750cd04bed00be28587cb2f48 Mon Sep 17 00:00:00 2001 From: Yomna Nasser Date: Tue, 15 Nov 2022 23:30:07 +0000 Subject: [PATCH 371/998] Revert "Revert "Add setNullCipherAndIntegrityEnabled to IRadioNetwork"" This reverts commit eee413c6672c5a8bbe015c5df43e28391896fbdd. A fix was applied in frameworks/opt/Telephony. Bug: b/237529943 Test: m Change-Id: I40f1c4a92d492acc3ee6724090676fcd6b9f12e7 --- .../hardware/radio/network/IRadioNetwork.aidl | 1 + .../radio/network/IRadioNetworkResponse.aidl | 1 + .../hardware/radio/network/IRadioNetwork.aidl | 20 +++++++++++++++++++ .../radio/network/IRadioNetworkResponse.aidl | 10 ++++++++++ .../include/libradiocompat/RadioNetwork.h | 2 ++ .../libradiocompat/network/RadioNetwork.cpp | 7 +++++++ radio/aidl/vts/radio_network_response.cpp | 7 +++++++ radio/aidl/vts/radio_network_utils.h | 3 +++ 8 files changed, 51 insertions(+) diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl index c115c86357..35d3807ba4 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl @@ -74,4 +74,5 @@ interface IRadioNetwork { oneway void triggerEmergencyNetworkScan(int serial, in android.hardware.radio.network.EmergencyNetworkScanTrigger request); oneway void cancelEmergencyNetworkScan(int serial, boolean resetScan); oneway void exitEmergencyMode(in int serial); + oneway void setNullCipherAndIntegrityEnabled(in int serial, in boolean enabled); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl index 24d587e655..141250d598 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -73,4 +73,5 @@ interface IRadioNetworkResponse { oneway void triggerEmergencyNetworkScanResponse(in android.hardware.radio.RadioResponseInfo info); oneway void exitEmergencyModeResponse(in android.hardware.radio.RadioResponseInfo info); oneway void cancelEmergencyNetworkScanResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setNullCipherAndIntegrityEnabledResponse(in android.hardware.radio.RadioResponseInfo info); } diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl index 574798aa59..28a69ac097 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl @@ -482,4 +482,24 @@ oneway interface IRadioNetwork { * Response function is IRadioEmergencyResponse.exitEmergencyModeResponse() */ void exitEmergencyMode(in int serial); + + /** + * Set if null encryption and integrity modes are enabled. If the value of enabled is false + * the modem must not allow any network communications with null ciphering or null integrity + * modes. In case of an emergency call, the modem must bypass this setting. + * + * Null ciphering and integrity modes include (but are not limited to): + * 2G: A5/0 + * 3G: UEA0 and UIA0 + * 4G: EEA0 and EIA0 + * 5G: NEA0 and NIA0 + * + * + * @param serial Serial number of the request. + * @param enabled To allow null encryption/integrity, set to true. + * Otherwise, false. + * + * Response callback is IRadioResponse.setNullCipherAndIntegrityEnabledResponse() + */ + void setNullCipherAndIntegrityEnabled(in int serial, in boolean enabled); } diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl index fc4db2ca36..0cde5e6210 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -632,4 +632,14 @@ oneway interface IRadioNetworkResponse { * RadioError:MODEM_ERR */ void cancelEmergencyNetworkScanResponse(in RadioResponseInfo info); + + /** + * @param info Response info struct containing response type, serial no. and error + * + * Valid errors returned: + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:MODEM_ERR + */ + void setNullCipherAndIntegrityEnabledResponse(in RadioResponseInfo info); } diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h index 5dd6f0ae8d..2e0488d1c0 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h @@ -100,6 +100,8 @@ class RadioNetwork : public RadioCompatBase, ::ndk::ScopedAStatus cancelEmergencyNetworkScan(int32_t serial, bool resetScan) override; ::ndk::ScopedAStatus exitEmergencyMode(int32_t serial) override; + ::ndk::ScopedAStatus setNullCipherAndIntegrityEnabled(int32_t serial, bool enabled) override; + protected: std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse> respond(); diff --git a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp index 6bb6b75b2e..bbe7fd70de 100644 --- a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp +++ b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp @@ -340,4 +340,11 @@ ScopedAStatus RadioNetwork::exitEmergencyMode(int32_t serial) { return ok(); } +ScopedAStatus RadioNetwork::setNullCipherAndIntegrityEnabled(int32_t serial, bool) { + LOG_CALL << serial; + LOG(ERROR) << " setNullCipherAndIntegrityEnabled is unsupported by HIDL HALs"; + respond()->setNullCipherAndIntegrityEnabledResponse(notSupported(serial)); + return ok(); +} + } // namespace android::hardware::radio::compat diff --git a/radio/aidl/vts/radio_network_response.cpp b/radio/aidl/vts/radio_network_response.cpp index 5599c0332f..82aaa1b85d 100644 --- a/radio/aidl/vts/radio_network_response.cpp +++ b/radio/aidl/vts/radio_network_response.cpp @@ -293,3 +293,10 @@ ndk::ScopedAStatus RadioNetworkResponse::cancelEmergencyNetworkScanResponse( parent_network.notify(info.serial); return ndk::ScopedAStatus::ok(); } + +ndk::ScopedAStatus RadioNetworkResponse::setNullCipherAndIntegrityEnabledResponse( + const RadioResponseInfo& info) { + rspInfo = info; + parent_network.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} diff --git a/radio/aidl/vts/radio_network_utils.h b/radio/aidl/vts/radio_network_utils.h index 8480825421..67654b1494 100644 --- a/radio/aidl/vts/radio_network_utils.h +++ b/radio/aidl/vts/radio_network_utils.h @@ -158,6 +158,9 @@ class RadioNetworkResponse : public BnRadioNetworkResponse { virtual ndk::ScopedAStatus cancelEmergencyNetworkScanResponse( const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus setNullCipherAndIntegrityEnabledResponse( + const RadioResponseInfo& info) override; }; /* Callback class for radio network indication */ From 67ebabc6aee775d1ac2b7196d90f38e58e31651f Mon Sep 17 00:00:00 2001 From: Jimmy Chen Date: Thu, 6 Oct 2022 15:16:54 +0800 Subject: [PATCH 372/998] wifi: EAP minimum TLS version API Bug: 160819609 Test: atest VtsHalWifiSupplicantStaNetworkTargetTest Change-Id: I33e8d2f36e63560d6e084a5dcc78e89077486c0c --- .../supplicant/ISupplicantStaNetwork.aidl | 1 + .../hardware/wifi/supplicant/TlsVersion.aidl | 41 +++++++++++++++++++ .../supplicant/WpaDriverCapabilitiesMask.aidl | 2 + .../supplicant/ISupplicantStaNetwork.aidl | 13 ++++++ .../hardware/wifi/supplicant/TlsVersion.aidl | 29 +++++++++++++ .../supplicant/WpaDriverCapabilitiesMask.aidl | 8 ++++ .../supplicant_sta_network_aidl_test.cpp | 9 ++++ 7 files changed, 103 insertions(+) create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/TlsVersion.aidl create mode 100644 wifi/supplicant/aidl/android/hardware/wifi/supplicant/TlsVersion.aidl diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl index 0b3cb8156e..0bdec346b4 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl @@ -127,6 +127,7 @@ interface ISupplicantStaNetwork { void setWepKey(in int keyIdx, in byte[] wepKey); void setWepTxKeyIdx(in int keyIdx); void setRoamingConsortiumSelection(in byte[] selectedRcoi); + void setMinimumTlsVersionEapPhase1Param(android.hardware.wifi.supplicant.TlsVersion tlsVersion); const int SSID_MAX_LEN_IN_BYTES = 32; const int PSK_PASSPHRASE_MIN_LEN_IN_BYTES = 8; const int PSK_PASSPHRASE_MAX_LEN_IN_BYTES = 63; diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/TlsVersion.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/TlsVersion.aidl new file mode 100644 index 0000000000..22a374fece --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/TlsVersion.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum TlsVersion { + TLS_V1_0 = 0, + TLS_V1_1 = 1, + TLS_V1_2 = 2, + TLS_V1_3 = 3, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl index 9a0a924c66..32e1510487 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl @@ -39,4 +39,6 @@ enum WpaDriverCapabilitiesMask { SAE_PK = 4, WFD_R2 = 8, TRUST_ON_FIRST_USE = 16, + SET_TLS_MINIMUM_VERSION = 32, + TLS_V1_3 = 64, } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl index 267f1e876a..44512a96d3 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl @@ -31,6 +31,7 @@ import android.hardware.wifi.supplicant.OcspType; import android.hardware.wifi.supplicant.PairwiseCipherMask; import android.hardware.wifi.supplicant.ProtoMask; import android.hardware.wifi.supplicant.SaeH2eMode; +import android.hardware.wifi.supplicant.TlsVersion; /** * Interface exposed by the supplicant for each station mode network @@ -1118,4 +1119,16 @@ interface ISupplicantStaNetwork { * |SupplicantStatusCode.FAILURE_NETWORK_INVALID| */ void setRoamingConsortiumSelection(in byte[] selectedRcoi); + + /** + * Set the minimum TLS version for EAP phase1 param. + * + * @param tlsVersion the TLS version + * + * @throws ServiceSpecificException with one of the following values: + * |SupplicantStatusCode.FAILURE_ARGS_INVALID|, + * |SupplicantStatusCode.FAILURE_UNKNOWN|, + * |SupplicantStatusCode.FAILURE_NETWORK_INVALID| + */ + void setMinimumTlsVersionEapPhase1Param(TlsVersion tlsVersion); } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/TlsVersion.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/TlsVersion.aidl new file mode 100644 index 0000000000..316e881f08 --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/TlsVersion.aidl @@ -0,0 +1,29 @@ +/* + * 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. + */ + +package android.hardware.wifi.supplicant; + +/** + * TlsVersion: TLS version. + */ +@VintfStability +@Backing(type="int") +enum TlsVersion { + TLS_V1_0, + TLS_V1_1, + TLS_V1_2, + TLS_V1_3, +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl index 08006cffba..a9434c4f11 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl @@ -42,4 +42,12 @@ enum WpaDriverCapabilitiesMask { * Trust On First Use */ TRUST_ON_FIRST_USE = 1 << 4, + /** + * TLS minimum version + */ + SET_TLS_MINIMUM_VERSION = 1 << 5, + /** + * TLS V1.3 + */ + TLS_V1_3 = 1 << 6, } diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp index b3f70da5c4..e5d976c983 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp +++ b/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -51,6 +52,7 @@ using aidl::android::hardware::wifi::supplicant::OcspType; using aidl::android::hardware::wifi::supplicant::PairwiseCipherMask; using aidl::android::hardware::wifi::supplicant::ProtoMask; using aidl::android::hardware::wifi::supplicant::SaeH2eMode; +using aidl::android::hardware::wifi::supplicant::TlsVersion; using aidl::android::hardware::wifi::supplicant::TransitionDisableIndication; using aidl::android::hardware::wifi::supplicant::WpaDriverCapabilitiesMask; using android::ProcessState; @@ -791,6 +793,13 @@ TEST_P(SupplicantStaNetworkAidlTest, SetRoamingConsortiumSelection) { EXPECT_TRUE(sta_network_->setRoamingConsortiumSelection(testSelection).isOk()); } +/* + * SetMinimumTlsVersionEapPhase1Param + */ +TEST_P(SupplicantStaNetworkAidlTest, SetMinimumTlsVersionEapPhase1Param) { + EXPECT_TRUE(sta_network_->setMinimumTlsVersionEapPhase1Param(TlsVersion::TLS_V1_3).isOk()); +} + GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SupplicantStaNetworkAidlTest); INSTANTIATE_TEST_SUITE_P(Supplicant, SupplicantStaNetworkAidlTest, testing::ValuesIn(android::getAidlHalInstanceNames( From 6c4bf195bba6043953ceed81205b2e3824a622e8 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Tue, 8 Nov 2022 15:00:32 -0800 Subject: [PATCH 373/998] Add HAL changes for STEERING_WHEEL_HEIGHT_MOVE Bug: 257267721 Test: atest VtsHalAutomotiveVehicle_TargetTest atest CtsCarTestCases:CarPropertyManagerTest atest CtsCarTestCases:VehiclePropertyIdsTest Change-Id: I335f01415798bee322d15b551999e3a959356362 --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 18 ++++++++++++++++++ .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../config/DefaultProperties.json | 15 +++++++++++++++ .../src/VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 44 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index c8ecef85f7..954eb3411d 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -160,6 +160,7 @@ enum VehicleProperty { STEERING_WHEEL_DEPTH_POS = 289410016, STEERING_WHEEL_DEPTH_MOVE = 289410017, STEERING_WHEEL_HEIGHT_POS = 289410018, + STEERING_WHEEL_HEIGHT_MOVE = 289410019, VEHICLE_MAP_SERVICE = 299895808, OBD2_LIVE_FRAME = 299896064, OBD2_FREEZE_FRAME = 299896065, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index dd27704d3a..b37c4df63f 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1816,6 +1816,24 @@ enum VehicleProperty { */ STEERING_WHEEL_HEIGHT_POS = 0x0BE2 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** + * Steering wheel height movement + * + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All values between + * minInt32Value and maxInt32Value must be supported. + * + * The maxInt32Value in default area's VehicleAreaConfig indicates the steering wheel moving + * upwards. The minInt32Value in default area's VehicleAreaConfig indicates the steering wheel + * moving downwards. Larger integers, either positive or negative, indicate a faster movement + * speed. Once the steering wheel reaches the positional limit, the value resets to 0. + * + * This value is not in any particular unit but in a specified range of steps. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + STEERING_WHEEL_HEIGHT_MOVE = + 0x0BE3 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, /** * Vehicle Maps Service (VMS) message * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 309dfe7aae..3d7479d18c 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -160,6 +160,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::STEERING_WHEEL_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyAccess::READ}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyAccess::READ}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index a55970e05d..01d5b69ca0 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -160,6 +160,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_HEIGHT_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index d4c7341bcf..fb2f2d8ead 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -152,6 +152,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyAccess.READ), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 079936f9f5..bc7686c99c 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -152,6 +152,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 00ce40217b..1ac97d7f79 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2253,6 +2253,21 @@ } ] }, + { + "property": "VehicleProperty::STEERING_WHEEL_HEIGHT_MOVE", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": 0, + "minInt32Value": -2, + "maxInt32Value": 2 + } + ] + }, { "property": "VehicleProperty::WHEEL_TICK", "defaultValue": { diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 0c22b67892..b5546ecba3 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -505,6 +505,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelHeightPosConfig) { VehicleArea::GLOBAL, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelHeightMoveConfig) { + verifyProperty(VehicleProperty::STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + std::vector getDescriptors() { std::vector descriptors; for (std::string name : getAidlHalInstanceNames(IVehicle::descriptor)) { From d7ed5ae3f93004aeab12cc8a54e090d78df23dda Mon Sep 17 00:00:00 2001 From: Jimmy Chen Date: Thu, 6 Oct 2022 22:23:41 +0800 Subject: [PATCH 374/998] wifi: new state change HAL callback with current used key management mask Bug: 230766005 Test: atest vts Change-Id: I9a9d85df53fe615f89a448f8ece16c6cbfbf6dee --- .../ISupplicantStaIfaceCallback.aidl | 1 + .../ISupplicantStaIfaceCallback.aidl | 26 +++++++++++++++++++ .../supplicant_sta_iface_aidl_test.cpp | 7 +++++ 3 files changed, 34 insertions(+) diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl index 25a09b435e..c7dd5841bd 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl @@ -63,4 +63,5 @@ interface ISupplicantStaIfaceCallback { oneway void onWpsEventSuccess(); oneway void onQosPolicyReset(); oneway void onQosPolicyRequest(in int qosPolicyRequestId, in android.hardware.wifi.supplicant.QosPolicyData[] qosPolicyData); + oneway void onStateChangedWithAkm(in android.hardware.wifi.supplicant.StaIfaceCallbackState newState, in byte[] bssid, in int id, in byte[] ssid, in boolean filsHlpSent, in android.hardware.wifi.supplicant.KeyMgmtMask keyMgmtMask); } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl index 0730a8cf54..c7961fa24b 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl @@ -27,6 +27,7 @@ import android.hardware.wifi.supplicant.DppEventType; import android.hardware.wifi.supplicant.DppFailureCode; import android.hardware.wifi.supplicant.DppProgressCode; import android.hardware.wifi.supplicant.Hs20AnqpData; +import android.hardware.wifi.supplicant.KeyMgmtMask; import android.hardware.wifi.supplicant.OsuMethod; import android.hardware.wifi.supplicant.QosPolicyData; import android.hardware.wifi.supplicant.StaIfaceCallbackState; @@ -252,6 +253,8 @@ oneway interface ISupplicantStaIfaceCallback { * event is triggered by a particular network, the |SupplicantNetworkId|, * |ssid|, |bssid| parameters must indicate the parameters of the network/AP * which caused this state transition. + *

+ * This callback is deprecated from AIDL v2, newer HAL should call onStateChangedWithAkm(). * * @param newState New State of the interface. This must be one of the |State| * values above. @@ -303,4 +306,27 @@ oneway interface ISupplicantStaIfaceCallback { * @param qosPolicyData QoS policies info requested by the AP. */ void onQosPolicyRequest(in int qosPolicyRequestId, in QosPolicyData[] qosPolicyData); + + /** + * Used to indicate a state change event on this particular iface. If this + * event is triggered by a particular network, the |id|, + * |ssid|, |bssid| parameters must indicate the parameters of the network/AP + * which caused this state transition. + * + * @param newState New State of the interface. This must be one of the + * |StaIfaceCallbackState| values above. + * @param bssid BSSID of the corresponding AP which caused this state + * change event. This must be zero'ed if this event is not + * specific to a particular network. + * @param id ID of the corresponding network which caused this + * state change event. This must be invalid (-1) if this + * event is not specific to a particular network. + * @param ssid SSID of the corresponding network which caused this state + * change event. This must be empty if this event is not specific + * to a particular network. + * @param filsHlpSent Whether FILS HLP IEs were included in this association. + * @param keyMgmtMask current used key mgmt mask. + */ + void onStateChangedWithAkm(in StaIfaceCallbackState newState, in byte[] bssid, in int id, + in byte[] ssid, in boolean filsHlpSent, in KeyMgmtMask keyMgmtMask); } diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp index 272a427e77..d57f539a20 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp +++ b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp @@ -206,6 +206,13 @@ class SupplicantStaIfaceCallback : public BnSupplicantStaIfaceCallback { QosPolicyData /* qosPolicyData */>&) override { return ndk::ScopedAStatus::ok(); } + ::ndk::ScopedAStatus onStateChangedWithAkm( + ::aidl::android::hardware::wifi::supplicant::StaIfaceCallbackState /* newState */, + const std::vector& /* bssid */, int32_t /* id */, + const std::vector& /* ssid */, bool /* filsHlpSent */, + ::aidl::android::hardware::wifi::supplicant::KeyMgmtMask /* keyMgmtMask*/) override { + return ndk::ScopedAStatus::ok(); + } }; class SupplicantStaIfaceAidlTest : public testing::TestWithParam { From 8d05118d7900c244924163d20aee03f5085505e8 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Wed, 9 Nov 2022 13:28:48 -0800 Subject: [PATCH 375/998] Add HAL changes for STEERING_WHEEL_THEFT_LOCK_ENABLED Bug: 257267788 Test: atest VtsHalAutomotiveVehicle_TargetTest atest CtsCarTestCases:CarPropertyManagerTest atest CtsCarTestCases:VehiclePropertyIdsTest Change-Id: I1e75635f409c740b6517ca17a7c48ceabe8db475 --- .../hardware/automotive/vehicle/VehicleProperty.aidl | 1 + .../hardware/automotive/vehicle/VehicleProperty.aidl | 11 +++++++++++ .../aidl/generated_lib/cpp/AccessForVehicleProperty.h | 1 + .../generated_lib/cpp/ChangeModeForVehicleProperty.h | 1 + .../generated_lib/java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../impl/default_config/config/DefaultProperties.json | 8 ++++++++ .../vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 30 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 954eb3411d..851fba7404 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -161,6 +161,7 @@ enum VehicleProperty { STEERING_WHEEL_DEPTH_MOVE = 289410017, STEERING_WHEEL_HEIGHT_POS = 289410018, STEERING_WHEEL_HEIGHT_MOVE = 289410019, + STEERING_WHEEL_THEFT_LOCK_ENABLED = 287312868, VEHICLE_MAP_SERVICE = 299895808, OBD2_LIVE_FRAME = 299896064, OBD2_FREEZE_FRAME = 299896065, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index b37c4df63f..ccd765a48b 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1834,6 +1834,17 @@ enum VehicleProperty { */ STEERING_WHEEL_HEIGHT_MOVE = 0x0BE3 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** + * Steering wheel theft lock feature enabled + * + * If true, the steering wheel will lock automatically to prevent theft in certain + * situations. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + STEERING_WHEEL_THEFT_LOCK_ENABLED = + 0x0BE4 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, /** * Vehicle Maps Service (VMS) message * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 3d7479d18c..4c3479dd00 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -161,6 +161,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::STEERING_WHEEL_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::STEERING_WHEEL_THEFT_LOCK_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyAccess::READ}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyAccess::READ}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 01d5b69ca0..889522ef4a 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -161,6 +161,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_HEIGHT_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::STEERING_WHEEL_THEFT_LOCK_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index fb2f2d8ead..669b4fd148 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -153,6 +153,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.STEERING_WHEEL_THEFT_LOCK_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyAccess.READ), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index bc7686c99c..8984f07ae6 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -153,6 +153,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.STEERING_WHEEL_THEFT_LOCK_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 1ac97d7f79..b2b08f5a00 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2268,6 +2268,14 @@ } ] }, + { + "property": "VehicleProperty::STEERING_WHEEL_THEFT_LOCK_ENABLED", + "defaultValue": { + "int32Values": [ + 0 + ] + } + }, { "property": "VehicleProperty::WHEEL_TICK", "defaultValue": { diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index b5546ecba3..a63f66e212 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -511,6 +511,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelHeightMoveConfig) { VehicleArea::GLOBAL, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelTheftLockEnabledConfig) { + verifyProperty(VehicleProperty::STEERING_WHEEL_THEFT_LOCK_ENABLED, + VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); +} + std::vector getDescriptors() { std::vector descriptors; for (std::string name : getAidlHalInstanceNames(IVehicle::descriptor)) { From 10443083631d5c040bf04abbdc4d002727ac89ce Mon Sep 17 00:00:00 2001 From: Sarah Chin Date: Tue, 15 Nov 2022 13:27:10 -0800 Subject: [PATCH 376/998] Remove REQUEST_NOT_SUPPORTED from IRadio Existing APIs should not allow REQUEST_NOT_SUPPORTED as a valid error. VTS will be updated next to enforce this behavior. Deprecate unused APIs and remove REQUEST_NOT_SUPPORTED. Deprecated APIs will not be tested through VTS. Test: atest hal_implementation_test Bug: 254095902 Change-Id: I75861eaf632f624afd5fbee2acffb1dd5c5dde27 --- .../compatibility_matrix.current.xml | 2 +- .../hardware/radio/modem/IRadioModem.aidl | 9 ++++ .../radio/modem/IRadioModemResponse.aidl | 9 ++++ .../android/hardware/radio/modem/NvItem.aidl | 3 ++ .../hardware/radio/modem/NvWriteItem.aidl | 3 ++ .../hardware/radio/network/IRadioNetwork.aidl | 3 ++ .../radio/network/IRadioNetworkResponse.aidl | 3 ++ .../android/hardware/radio/RadioError.aidl | 3 ++ .../radio/config/IRadioConfigResponse.aidl | 2 - .../radio/data/IRadioDataResponse.aidl | 9 ---- .../messaging/IRadioMessagingResponse.aidl | 21 --------- .../hardware/radio/modem/IRadioModem.aidl | 8 ++++ .../radio/modem/IRadioModemResponse.aidl | 20 ++++----- .../android/hardware/radio/modem/NvItem.aidl | 1 + .../hardware/radio/modem/NvWriteItem.aidl | 1 + .../hardware/radio/modem/ResetNvType.aidl | 1 + .../hardware/radio/network/IRadioNetwork.aidl | 2 + .../radio/network/IRadioNetworkResponse.aidl | 22 +--------- .../hardware/radio/sim/IRadioSimResponse.aidl | 43 ++----------------- .../radio/voice/IRadioVoiceResponse.aidl | 36 ---------------- radio/aidl/compat/libradiocompat/Android.bp | 2 +- radio/aidl/compat/service/Android.bp | 2 +- radio/aidl/vts/Android.bp | 2 +- 23 files changed, 63 insertions(+), 144 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index e9690c5d90..aa8f03ffdd 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -475,7 +475,7 @@ android.hardware.radio.modem - 1 + 2 IRadioModem slot1 diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModem.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModem.aidl index 41eff51773..74dc39d99a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModem.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModem.aidl @@ -41,9 +41,18 @@ interface IRadioModem { oneway void getModemActivityInfo(in int serial); oneway void getModemStackStatus(in int serial); oneway void getRadioCapability(in int serial); + /** + * @deprecated NV APIs are deprecated starting from Android U. + */ oneway void nvReadItem(in int serial, in android.hardware.radio.modem.NvItem itemId); oneway void nvResetConfig(in int serial, in android.hardware.radio.modem.ResetNvType resetType); + /** + * @deprecated NV APIs are deprecated starting from Android U. + */ oneway void nvWriteCdmaPrl(in int serial, in byte[] prl); + /** + * @deprecated NV APIs are deprecated starting from Android U. + */ oneway void nvWriteItem(in int serial, in android.hardware.radio.modem.NvWriteItem item); oneway void requestShutdown(in int serial); oneway void responseAcknowledgement(); diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModemResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModemResponse.aidl index dcaff45017..af8bbe1282 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModemResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModemResponse.aidl @@ -42,9 +42,18 @@ interface IRadioModemResponse { oneway void getModemActivityInfoResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.modem.ActivityStatsInfo activityInfo); oneway void getModemStackStatusResponse(in android.hardware.radio.RadioResponseInfo info, in boolean isEnabled); oneway void getRadioCapabilityResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.modem.RadioCapability rc); + /** + * @deprecated NV APIs are deprecated starting from Android U. + */ oneway void nvReadItemResponse(in android.hardware.radio.RadioResponseInfo info, in String result); oneway void nvResetConfigResponse(in android.hardware.radio.RadioResponseInfo info); + /** + * @deprecated NV APIs are deprecated starting from Android U. + */ oneway void nvWriteCdmaPrlResponse(in android.hardware.radio.RadioResponseInfo info); + /** + * @deprecated NV APIs are deprecated starting from Android U. + */ oneway void nvWriteItemResponse(in android.hardware.radio.RadioResponseInfo info); oneway void requestShutdownResponse(in android.hardware.radio.RadioResponseInfo info); oneway void sendDeviceStateResponse(in android.hardware.radio.RadioResponseInfo info); diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/NvItem.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/NvItem.aidl index 3e276434ac..b80d7acde1 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/NvItem.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/NvItem.aidl @@ -32,6 +32,9 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; +/** + * @deprecated NV APIs are deprecated starting from Android U. + */ @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum NvItem { CDMA_MEID = 1, diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/NvWriteItem.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/NvWriteItem.aidl index 17b7de0a74..6a786bc419 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/NvWriteItem.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/NvWriteItem.aidl @@ -32,6 +32,9 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.modem; +/** + * @deprecated NV APIs are deprecated starting from Android U. + */ @JavaDerive(toString=true) @VintfStability parcelable NvWriteItem { android.hardware.radio.modem.NvItem itemId; diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl index c115c86357..dba74bed56 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl @@ -41,6 +41,9 @@ interface IRadioNetwork { oneway void getCdmaRoamingPreference(in int serial); oneway void getCellInfoList(in int serial); oneway void getDataRegistrationState(in int serial); + /** + * @deprecated Deprecated starting from Android U. + */ oneway void getImsRegistrationState(in int serial); oneway void getNetworkSelectionMode(in int serial); oneway void getOperator(in int serial); diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl index 24d587e655..05057a1a75 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -42,6 +42,9 @@ interface IRadioNetworkResponse { oneway void getCdmaRoamingPreferenceResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.CdmaRoamingType type); oneway void getCellInfoListResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.CellInfo[] cellInfo); oneway void getDataRegistrationStateResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.RegStateResult dataRegResponse); + /** + * @deprecated Deprecated starting from Android U. + */ oneway void getImsRegistrationStateResponse(in android.hardware.radio.RadioResponseInfo info, in boolean isRegistered, in android.hardware.radio.RadioTechnologyFamily ratFamily); oneway void getNetworkSelectionModeResponse(in android.hardware.radio.RadioResponseInfo info, in boolean manual); oneway void getOperatorResponse(in android.hardware.radio.RadioResponseInfo info, in String longName, in String shortName, in String numeric); diff --git a/radio/aidl/android/hardware/radio/RadioError.aidl b/radio/aidl/android/hardware/radio/RadioError.aidl index ae58a0eb6a..61d5a77ac0 100644 --- a/radio/aidl/android/hardware/radio/RadioError.aidl +++ b/radio/aidl/android/hardware/radio/RadioError.aidl @@ -41,6 +41,9 @@ enum RadioError { * Operation requires SIM PUK2 to be entered */ SIM_PUK2 = 5, + /** + * Optional API + */ REQUEST_NOT_SUPPORTED = 6, CANCELLED = 7, /** diff --git a/radio/aidl/android/hardware/radio/config/IRadioConfigResponse.aidl b/radio/aidl/android/hardware/radio/config/IRadioConfigResponse.aidl index 929f02df0f..0d36bbd016 100644 --- a/radio/aidl/android/hardware/radio/config/IRadioConfigResponse.aidl +++ b/radio/aidl/android/hardware/radio/config/IRadioConfigResponse.aidl @@ -54,7 +54,6 @@ oneway interface IRadioConfigResponse { * Valid errors returned: * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED */ void getNumOfLiveModemsResponse( in android.hardware.radio.RadioResponseInfo info, in byte numOfLiveModems); @@ -93,7 +92,6 @@ oneway interface IRadioConfigResponse { * Valid errors returned: * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_ARGUMENTS */ void setNumOfLiveModemsResponse(in android.hardware.radio.RadioResponseInfo info); diff --git a/radio/aidl/android/hardware/radio/data/IRadioDataResponse.aidl b/radio/aidl/android/hardware/radio/data/IRadioDataResponse.aidl index 88b6c1b720..06c83c1e92 100644 --- a/radio/aidl/android/hardware/radio/data/IRadioDataResponse.aidl +++ b/radio/aidl/android/hardware/radio/data/IRadioDataResponse.aidl @@ -44,7 +44,6 @@ oneway interface IRadioDataResponse { * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR * RadioError:NO_RESOURCES- Indicates that no pdu session ids are available - * RadioError:REQUEST_NOT_SUPPORTED */ void allocatePduSessionIdResponse(in RadioResponseInfo info, in int id); @@ -57,7 +56,6 @@ oneway interface IRadioDataResponse { * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR * RadioError:NO_RESOURCES - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_CALL_ID */ void cancelHandoverResponse(in RadioResponseInfo info); @@ -66,7 +64,6 @@ oneway interface IRadioDataResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: - * RadioError:REQUEST_NOT_SUPPORTED may be returned when HAL 1.2 or higher is supported. * RadioError:NONE indicates success. Any other error will remove the network from the list. * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_CALL_ID @@ -112,7 +109,6 @@ oneway interface IRadioDataResponse { * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR * RadioError:NO_RESOURCES - * RadioError:REQUEST_NOT_SUPPORTED */ void releasePduSessionIdResponse(in RadioResponseInfo info); @@ -131,7 +127,6 @@ oneway interface IRadioDataResponse { * RadioError:INVALID_MODEM_STATE * RadioError:NO_RESOURCES * RadioError:CANCELLED - * RadioError:REQUEST_NOT_SUPPORTED */ void setDataAllowedResponse(in RadioResponseInfo info); @@ -146,7 +141,6 @@ oneway interface IRadioDataResponse { * RadioError:NO_MEMORY * RadioError:NO_RESOURCES * RadioError:CANCELLED - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:SIM_ABSENT */ void setDataProfileResponse(in RadioResponseInfo info); @@ -159,7 +153,6 @@ oneway interface IRadioDataResponse { * RadioError:RADIO_NOT_AVAILABLE * RadioError:MODEM_ERR * RadioError:INVALID_ARGUMENTS - * RadioError:REQUEST_NOT_SUPPORTED */ void setDataThrottlingResponse(in RadioResponseInfo info); @@ -176,7 +169,6 @@ oneway interface IRadioDataResponse { * RadioError:MODEM_ERR * RadioError:INVALID_ARGUMENTS * RadioError:NOT_PROVISIONED - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ @@ -208,7 +200,6 @@ oneway interface IRadioDataResponse { * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR * RadioError:NO_RESOURCES - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_CALL_ID */ void startHandoverResponse(in RadioResponseInfo info); diff --git a/radio/aidl/android/hardware/radio/messaging/IRadioMessagingResponse.aidl b/radio/aidl/android/hardware/radio/messaging/IRadioMessagingResponse.aidl index 492755f6a1..8cbc869d33 100644 --- a/radio/aidl/android/hardware/radio/messaging/IRadioMessagingResponse.aidl +++ b/radio/aidl/android/hardware/radio/messaging/IRadioMessagingResponse.aidl @@ -36,7 +36,6 @@ oneway interface IRadioMessagingResponse { * RadioError:NO_MEMORY * RadioError:NO_RESOURCES * RadioError:CANCELLED - * RadioError:REQUEST_NOT_SUPPORTED */ void acknowledgeIncomingGsmSmsWithPduResponse(in RadioResponseInfo info); @@ -56,7 +55,6 @@ oneway interface IRadioMessagingResponse { * RadioError:NETWORK_NOT_READY * RadioError:INVALID_MODEM_STATE * RadioError:INTERNAL_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:OPERATION_NOT_ALLOWED * RadioError:NO_RESOURCES * RadioError:CANCELLED @@ -73,7 +71,6 @@ oneway interface IRadioMessagingResponse { * RadioError:NO_MEMORY * RadioError:NO_RESOURCES * RadioError:CANCELLED - * RadioError:REQUEST_NOT_SUPPORTED */ void acknowledgeLastIncomingGsmSmsResponse(in RadioResponseInfo info); @@ -98,7 +95,6 @@ oneway interface IRadioMessagingResponse { * RadioError:MODEM_ERR * RadioError:NO_SUCH_ENTRY * RadioError:INTERNAL_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:OPERATION_NOT_ALLOWED * RadioError:NO_RESOURCES * RadioError:CANCELLED @@ -122,7 +118,6 @@ oneway interface IRadioMessagingResponse { * RadioError:NO_SUCH_ENTRY * RadioError:INTERNAL_ERR * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED * RadioError:INVALID_MODEM_STATE @@ -145,7 +140,6 @@ oneway interface IRadioMessagingResponse { * RadioError:MODEM_ERR * RadioError:NO_RESOURCES * RadioError:INTERNAL_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED * RadioError:INVALID_MODEM_STATE @@ -168,7 +162,6 @@ oneway interface IRadioMessagingResponse { * RadioError:MODEM_ERR * RadioError:NO_RESOURCES * RadioError:INTERNAL_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED * RadioError:INVALID_MODEM_STATE @@ -191,7 +184,6 @@ oneway interface IRadioMessagingResponse { * RadioError:MODEM_ERR * RadioError:INVALID_MODEM_STATE * RadioError:NOT_PROVISIONED - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:OPERATION_NOT_ALLOWED * RadioError:NO_RESOURCES * RadioError:CANCELLED @@ -212,7 +204,6 @@ oneway interface IRadioMessagingResponse { * RadioError:MODEM_ERR * RadioError:INVALID_STATE * RadioError:INTERNAL_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED * RadioError:SIM_ABSENT @@ -240,7 +231,6 @@ oneway interface IRadioMessagingResponse { * RadioError:MODEM_ERR * RadioError:NETWORK_ERR * RadioError:INTERNAL_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_MODEM_STATE * RadioError:NETWORK_NOT_READY * RadioError:OPERATION_NOT_ALLOWED @@ -275,7 +265,6 @@ oneway interface IRadioMessagingResponse { * RadioError:INVALID_SMSC_ADDRESS * RadioError:INTERNAL_ERR * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:OPERATION_NOT_ALLOWED * RadioError:ENCODING_ERR * RadioError:NO_RESOURCES @@ -308,7 +297,6 @@ oneway interface IRadioMessagingResponse { * RadioError:ENCODING_ERR * RadioError:OPERATION_NOT_ALLOWED * RadioError:INTERNAL_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NETWORK_NOT_READY * RadioError:NO_RESOURCES * RadioError:CANCELLED @@ -336,7 +324,6 @@ oneway interface IRadioMessagingResponse { * RadioError:MODEM_ERR * RadioError:NETWORK_ERR * RadioError:INTERNAL_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_MODEM_STATE * RadioError:NETWORK_NOT_READY * RadioError:OPERATION_NOT_ALLOWED @@ -368,7 +355,6 @@ oneway interface IRadioMessagingResponse { * RadioError:MODEM_ERR * RadioError:NETWORK_ERR * RadioError:INTERNAL_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_MODEM_STATE * RadioError:NETWORK_NOT_READY * RadioError:OPERATION_NOT_ALLOWED @@ -393,7 +379,6 @@ oneway interface IRadioMessagingResponse { * RadioError:SYSTEM_ERR * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:OPERATION_NOT_ALLOWED * RadioError:NO_RESOURCES * RadioError:CANCELLED @@ -414,7 +399,6 @@ oneway interface IRadioMessagingResponse { * RadioError:SYSTEM_ERR * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED * RadioError:INVALID_MODEM_STATE @@ -434,7 +418,6 @@ oneway interface IRadioMessagingResponse { * RadioError:SYSTEM_ERR * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:OPERATION_NOT_ALLOWED * RadioError:NO_RESOURCES * RadioError:CANCELLED @@ -455,7 +438,6 @@ oneway interface IRadioMessagingResponse { * RadioError:SYSTEM_ERR * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED * RadioError:INVALID_MODEM_STATE @@ -476,7 +458,6 @@ oneway interface IRadioMessagingResponse { * RadioError:MODEM_ERR * RadioError:NO_RESOURCES * RadioError:INTERNAL_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:OPERATION_NOT_ALLOWED * RadioError:NO_RESOURCES * RadioError:CANCELLED @@ -502,7 +483,6 @@ oneway interface IRadioMessagingResponse { * RadioError:INVALID_MODEM_STATE * RadioError:INVALID_SMSC_ADDRESS * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:OPERATION_NOT_ALLOWED * RadioError:NO_RESOURCES * RadioError:CANCELLED @@ -531,7 +511,6 @@ oneway interface IRadioMessagingResponse { * RadioError:INVALID_SMSC_ADDRESS * RadioError:RADIO_NOT_AVAILABLE * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:CANCELLED * RadioError:INVALID_MODEM_STATE * RadioError:SIM_ABSENT diff --git a/radio/aidl/android/hardware/radio/modem/IRadioModem.aidl b/radio/aidl/android/hardware/radio/modem/IRadioModem.aidl index ba0ddb94b1..a5d98d3e25 100644 --- a/radio/aidl/android/hardware/radio/modem/IRadioModem.aidl +++ b/radio/aidl/android/hardware/radio/modem/IRadioModem.aidl @@ -117,6 +117,8 @@ oneway interface IRadioModem { * @param itemId NvItem * * Response function is IRadioModemResponse.nvReadItemResponse() + * + * @deprecated NV APIs are deprecated starting from Android U. */ void nvReadItem(in int serial, in NvItem itemId); @@ -128,6 +130,8 @@ oneway interface IRadioModem { * @param resetType ResetNvType * * Response function is IRadioModemResponse.nvResetConfigResponse() + * + * Note: This will be deprecated in favor of a rebootModem API in Android U. */ void nvResetConfig(in int serial, in ResetNvType resetType); @@ -139,6 +143,8 @@ oneway interface IRadioModem { * @param prl PRL as a byte array * * Response function is IRadioModemResponse.nvWriteCdmaPrlResponse() + * + * @deprecated NV APIs are deprecated starting from Android U. */ void nvWriteCdmaPrl(in int serial, in byte[] prl); @@ -150,6 +156,8 @@ oneway interface IRadioModem { * @param item NvWriteItem * * Response function is IRadioModemResponse.nvWriteItemResponse() + * + * @deprecated NV APIs are deprecated starting from Android U. */ void nvWriteItem(in int serial, in NvWriteItem item); diff --git a/radio/aidl/android/hardware/radio/modem/IRadioModemResponse.aidl b/radio/aidl/android/hardware/radio/modem/IRadioModemResponse.aidl index b17cac41c7..eca31924fb 100644 --- a/radio/aidl/android/hardware/radio/modem/IRadioModemResponse.aidl +++ b/radio/aidl/android/hardware/radio/modem/IRadioModemResponse.aidl @@ -61,7 +61,6 @@ oneway interface IRadioModemResponse { * RadioError:SYSTEM_ERR * RadioError:MODEM_ERR * RadioError:NOT_PROVISIONED - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ @@ -88,7 +87,6 @@ oneway interface IRadioModemResponse { * RadioError:NOT_PROVISIONED * RadioError:NO_RESOURCES * RadioError:CANCELLED - * RadioError:REQUEST_NOT_SUPPORTED */ void getDeviceIdentityResponse(in RadioResponseInfo info, in String imei, in String imeisv, in String esn, in String meid); @@ -100,7 +98,6 @@ oneway interface IRadioModemResponse { * Valid errors returned: * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED */ void getHardwareConfigResponse(in RadioResponseInfo info, in HardwareConfig[] config); @@ -118,7 +115,6 @@ oneway interface IRadioModemResponse { * RadioError:NOT_PROVISIONED * RadioError:NO_RESOURCES * RadioError:CANCELLED - * RadioError:REQUEST_NOT_SUPPORTED */ void getModemActivityInfoResponse(in RadioResponseInfo info, in ActivityStatsInfo activityInfo); @@ -141,7 +137,6 @@ oneway interface IRadioModemResponse { * RadioError:RADIO_NOT_AVAILABLE * RadioError:OPERATION_NOT_ALLOWED * RadioError:INVALID_STATE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INTERNAL_ERR * RadioError:NO_MEMORY * RadioError:NO_RESOURCES @@ -156,7 +151,8 @@ oneway interface IRadioModemResponse { * Valid errors returned: * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED + * + * @deprecated NV APIs are deprecated starting from Android U. */ void nvReadItemResponse(in RadioResponseInfo info, in String result); @@ -166,7 +162,8 @@ oneway interface IRadioModemResponse { * Valid errors returned: * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED + * + * Note: This will be deprecated in favor of a rebootModemResponse API in Android U. */ void nvResetConfigResponse(in RadioResponseInfo info); @@ -176,7 +173,8 @@ oneway interface IRadioModemResponse { * Valid errors returned: * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED + * + * @deprecated NV APIs are deprecated starting from Android U. */ void nvWriteCdmaPrlResponse(in RadioResponseInfo info); @@ -186,7 +184,8 @@ oneway interface IRadioModemResponse { * Valid errors returned: * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED + * + * @deprecated NV APIs are deprecated starting from Android U. */ void nvWriteItemResponse(in RadioResponseInfo info); @@ -200,7 +199,6 @@ oneway interface IRadioModemResponse { * RadioError:NO_MEMORY * RadioError:INTERNAL_ERR * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ @@ -216,7 +214,6 @@ oneway interface IRadioModemResponse { * RadioError:INTERNAL_ERR * RadioError:SYSTEM_ERR * RadioError:INVALID_ARGUMENTS - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ @@ -237,7 +234,6 @@ oneway interface IRadioModemResponse { * RadioError:INVALID_ARGUMENTS * RadioError:MODEM_ERR * RadioError:INVALID_STATE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ diff --git a/radio/aidl/android/hardware/radio/modem/NvItem.aidl b/radio/aidl/android/hardware/radio/modem/NvItem.aidl index 649b0d2db6..310b1ad601 100644 --- a/radio/aidl/android/hardware/radio/modem/NvItem.aidl +++ b/radio/aidl/android/hardware/radio/modem/NvItem.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.modem; +/** @deprecated NV APIs are deprecated starting from Android U. */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/modem/NvWriteItem.aidl b/radio/aidl/android/hardware/radio/modem/NvWriteItem.aidl index 47fb4904ef..6472f23d78 100644 --- a/radio/aidl/android/hardware/radio/modem/NvWriteItem.aidl +++ b/radio/aidl/android/hardware/radio/modem/NvWriteItem.aidl @@ -18,6 +18,7 @@ package android.hardware.radio.modem; import android.hardware.radio.modem.NvItem; +/** @deprecated NV APIs are deprecated starting from Android U. */ @VintfStability @JavaDerive(toString=true) parcelable NvWriteItem { diff --git a/radio/aidl/android/hardware/radio/modem/ResetNvType.aidl b/radio/aidl/android/hardware/radio/modem/ResetNvType.aidl index 16487f8391..6476fe8704 100644 --- a/radio/aidl/android/hardware/radio/modem/ResetNvType.aidl +++ b/radio/aidl/android/hardware/radio/modem/ResetNvType.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.modem; +/** Note: This will be deprecated along with nvResetConfig in Android U. */ @VintfStability @Backing(type="int") @JavaDerive(toString=true) diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl index 574798aa59..f9789360a0 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl @@ -112,6 +112,8 @@ oneway interface IRadioNetwork { * @param serial Serial number of request. * * Response function is IRadioNetworkResponse.getImsRegistrationStateResponse() + * + * @deprecated Deprecated starting from Android U. */ void getImsRegistrationState(in int serial); diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl index fc4db2ca36..9a02fc74f9 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -57,7 +57,6 @@ oneway interface IRadioNetworkResponse { * RadioError:INTERNAL_ERR * RadioError:INVALID_ARGUMENTS * RadioError:MODEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES */ void getAllowedNetworkTypesBitmapResponse(in RadioResponseInfo info, in int networkTypeBitmap); @@ -74,7 +73,6 @@ oneway interface IRadioNetworkResponse { * RadioError:INTERNAL_ERR * RadioError:SYSTEM_ERR * RadioError:MODEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ @@ -93,7 +91,6 @@ oneway interface IRadioNetworkResponse { * RadioError:INTERNAL_ERR * RadioError:NO_MEMORY * RadioError:MODEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:CANCELLED * RadioError:NO_RESOURCES * RadioError:INTERNAL_ERR @@ -126,7 +123,6 @@ oneway interface IRadioNetworkResponse { * RadioError:INTERNAL_ERR * RadioError:SYSTEM_ERR * RadioError:MODEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED * RadioError:SIM_ABSENT @@ -170,7 +166,8 @@ oneway interface IRadioNetworkResponse { * RadioError:NO_RESOURCES * RadioError:CANCELLED * RadioError:INVALID_MODEM_STATE - * RadioError:REQUEST_NOT_SUPPORTED + * + * @deprecated Deprecated starting from Android U. */ void getImsRegistrationStateResponse( in RadioResponseInfo info, in boolean isRegistered, in RadioTechnologyFamily ratFamily); @@ -187,7 +184,6 @@ oneway interface IRadioNetworkResponse { * RadioError:SYSTEM_ERR * RadioError:INVALID_ARGUMENTS * RadioError:MODEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ @@ -205,7 +201,6 @@ oneway interface IRadioNetworkResponse { * RadioError:NO_MEMORY * RadioError:INTERNAL_ERR * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ @@ -247,7 +242,6 @@ oneway interface IRadioNetworkResponse { * RadioError:NO_MEMORY * RadioError:NO_RESOURCES * RadioError:CANCELLED - * RadioError:REQUEST_NOT_SUPPORTED */ void getVoiceRadioTechnologyResponse(in RadioResponseInfo info, in RadioTechnology rat); @@ -272,7 +266,6 @@ oneway interface IRadioNetworkResponse { * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR - * RadioError:REQUEST_NOT_SUPPORTED */ void isNrDualConnectivityEnabledResponse(in RadioResponseInfo info, in boolean isEnabled); @@ -287,7 +280,6 @@ oneway interface IRadioNetworkResponse { * RadioError:INTERNAL_ERR * RadioError:INVALID_ARGUMENTS * RadioError:MODEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES */ void setAllowedNetworkTypesBitmapResponse(in RadioResponseInfo info); @@ -304,7 +296,6 @@ oneway interface IRadioNetworkResponse { * RadioError:SYSTEM_ERR * RadioError:INVALID_ARGUMENTS * RadioError:MODEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ @@ -325,7 +316,6 @@ oneway interface IRadioNetworkResponse { * RadioError:INTERNAL_ERR * RadioError:SYSTEM_ERR * RadioError:FDN_CHECK_FAILURE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ @@ -342,7 +332,6 @@ oneway interface IRadioNetworkResponse { * RadioError:SYSTEM_ERR * RadioError:INVALID_ARGUMENTS * RadioError:MODEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:OPERATION_NOT_ALLOWED * RadioError:NO_RESOURCES * RadioError:CANCELLED @@ -362,7 +351,6 @@ oneway interface IRadioNetworkResponse { * RadioError:INVALID_ARGUMENTS * RadioError:NO_RESOURCES * RadioError:CANCELLED - * RadioError:REQUEST_NOT_SUPPORTED */ void setCellInfoListRateResponse(in RadioResponseInfo info); @@ -400,7 +388,6 @@ oneway interface IRadioNetworkResponse { * RadioError:SYSTEM_ERR * RadioError:INVALID_ARGUMENTS * RadioError:MODEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED * RadioError:SIM_ABSENT @@ -420,7 +407,6 @@ oneway interface IRadioNetworkResponse { * RadioError:SYSTEM_ERR * RadioError:INVALID_ARGUMENTS * RadioError:MODEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED * @@ -443,7 +429,6 @@ oneway interface IRadioNetworkResponse { * RadioError:SYSTEM_ERR * RadioError:INVALID_ARGUMENTS * RadioError:MODEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED * @@ -459,7 +444,6 @@ oneway interface IRadioNetworkResponse { * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_STATE */ void setNrDualConnectivityStateResponse(in RadioResponseInfo info); @@ -486,7 +470,6 @@ oneway interface IRadioNetworkResponse { * RadioError:SYSTEM_ERR * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED * RadioError:SIM_ABSENT @@ -543,7 +526,6 @@ oneway interface IRadioNetworkResponse { * RadioError:INVALID_ARGUMENTS * RadioError:NO_RESOURCES * RadioError:CANCELLED - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:SIM_ABSENT */ void supplyNetworkDepersonalizationResponse(in RadioResponseInfo info, in int remainingRetries); diff --git a/radio/aidl/android/hardware/radio/sim/IRadioSimResponse.aidl b/radio/aidl/android/hardware/radio/sim/IRadioSimResponse.aidl index 750a29ad83..b3df504132 100644 --- a/radio/aidl/android/hardware/radio/sim/IRadioSimResponse.aidl +++ b/radio/aidl/android/hardware/radio/sim/IRadioSimResponse.aidl @@ -65,7 +65,6 @@ oneway interface IRadioSimResponse { * RadioError:CANCELLED * RadioError:INVALID_ARGUMENTS * RadioError:INVALID_SIM_STATE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:SIM_PUK2 */ void changeIccPin2ForAppResponse(in RadioResponseInfo info, in int remainingRetries); @@ -84,7 +83,6 @@ oneway interface IRadioSimResponse { * RadioError:CANCELLED * RadioError:INVALID_ARGUMENTS * RadioError:INVALID_SIM_STATE - * RadioError:REQUEST_NOT_SUPPORTED */ void changeIccPinForAppResponse(in RadioResponseInfo info, in int remainingRetries); @@ -108,7 +106,6 @@ oneway interface IRadioSimResponse { * Valid errors returned: * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED */ void getAllowedCarriersResponse(in RadioResponseInfo info, in CarrierRestrictions carriers, in SimLockMultiSimPolicy multiSimPolicy); @@ -133,7 +130,6 @@ oneway interface IRadioSimResponse { * RadioError:INVALID_ARGUMENTS * RadioError:MODEM_ERR * RadioError:NOT_PROVISIONED - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED * RadioError:SIM_ABSENT @@ -153,7 +149,6 @@ oneway interface IRadioSimResponse { * RadioError:NO_MEMORY * RadioError:NO_RESOURCES * RadioError:CANCELLED - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:SIM_ABSENT */ void getCdmaSubscriptionSourceResponse( @@ -176,7 +171,6 @@ oneway interface IRadioSimResponse { * RadioError:INTERNAL_ERR * RadioError:SYSTEM_ERR * RadioError:FDN_CHECK_FAILURE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ @@ -191,7 +185,6 @@ oneway interface IRadioSimResponse { * RadioError:RADIO_NOT_AVAILABLE * RadioError:INTERNAL_ERR * RadioError:NO_RESOURCES - * RadioError:REQUEST_NOT_SUPPORTED */ void getIccCardStatusResponse(in RadioResponseInfo info, in CardStatus cardStatus); @@ -208,7 +201,6 @@ oneway interface IRadioSimResponse { * RadioError:CANCELLED * RadioError:INVALID_SIM_STATE * RadioError:SIM_ERR - * RadioError:REQUEST_NOT_SUPPORTED */ void getImsiForAppResponse(in RadioResponseInfo info, in String imsi); @@ -219,13 +211,10 @@ oneway interface IRadioSimResponse { * Valid errors returned: * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_ARGUMENTS * RadioError:INVALID_SIM_STATE * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR - * REQUEST_NOT_SUPPORTED may only be returned on devices that don't support this API, - * indicated by the HAL capability CAPABILITY_SIM_PHONEBOOK_IN_MODEM. */ void getSimPhonebookCapacityResponse(in RadioResponseInfo info, in PhonebookCapacity capacity); @@ -235,13 +224,10 @@ oneway interface IRadioSimResponse { * Valid errors returned: * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_ARGUMENTS * RadioError:INVALID_SIM_STATE * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR - * REQUEST_NOT_SUPPORTED may only be returned on devices that don't support this API, - * indicated by the HAL capability CAPABILITY_SIM_PHONEBOOK_IN_MODEM. */ void getSimPhonebookRecordsResponse(in RadioResponseInfo info); @@ -255,7 +241,6 @@ oneway interface IRadioSimResponse { * RadioError:NO_MEMORY * RadioError:NO_RESOURCES * RadioError:CANCELLED - * RadioError:REQUEST_NOT_SUPPORTED */ void iccCloseLogicalChannelResponse(in RadioResponseInfo info); @@ -274,7 +259,6 @@ oneway interface IRadioSimResponse { * RadioError:CANCELLED * RadioError:INVALID_SIM_STATE * RadioError:SIM_ERR - * RadioError:REQUEST_NOT_SUPPORTED */ void iccIoForAppResponse(in RadioResponseInfo info, in IccIoResult iccIo); @@ -296,7 +280,6 @@ oneway interface IRadioSimResponse { * RadioError:SIM_ERR * RadioError:INVALID_SIM_STATE * RadioError:MISSING_RESOURCE - * RadioError:REQUEST_NOT_SUPPORTED */ void iccOpenLogicalChannelResponse( in RadioResponseInfo info, in int channelId, in byte[] selectResponse); @@ -312,7 +295,6 @@ oneway interface IRadioSimResponse { * RadioError:NO_MEMORY * RadioError:NO_RESOURCES * RadioError:CANCELLED - * RadioError:REQUEST_NOT_SUPPORTED */ void iccTransmitApduBasicChannelResponse(in RadioResponseInfo info, in IccIoResult result); @@ -327,7 +309,6 @@ oneway interface IRadioSimResponse { * RadioError:NO_MEMORY * RadioError:NO_RESOURCES * RadioError:CANCELLED - * RadioError:REQUEST_NOT_SUPPORTED */ void iccTransmitApduLogicalChannelResponse(in RadioResponseInfo info, in IccIoResult result); @@ -341,7 +322,6 @@ oneway interface IRadioSimResponse { * RadioError:NO_MEMORY * RadioError:NO_RESOURCES * RadioError:CANCELLED - * RadioError:REQUEST_NOT_SUPPORTED */ void reportStkServiceIsRunningResponse(in RadioResponseInfo info); @@ -359,7 +339,6 @@ oneway interface IRadioSimResponse { * RadioError:INVALID_MODEM_STATE * RadioError:SIM_ERR * RadioError:INVALID_ARGUMENTS - * RadioError:REQUEST_NOT_SUPPORTED */ void requestIccSimAuthenticationResponse(in RadioResponseInfo info, in IccIoResult result); @@ -379,7 +358,6 @@ oneway interface IRadioSimResponse { * RadioError:CANCELLED * RadioError:INVALID_ARGUMENTS * RadioError:MODEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:SIM_ABSENT */ void sendEnvelopeResponse(in RadioResponseInfo info, in String commandResponse); @@ -397,7 +375,6 @@ oneway interface IRadioSimResponse { * RadioError:NO_MEMORY * RadioError:NO_RESOURCES * RadioError:CANCELLED - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:SIM_ABSENT */ void sendEnvelopeWithStatusResponse(in RadioResponseInfo info, in IccIoResult iccIo); @@ -415,7 +392,6 @@ oneway interface IRadioSimResponse { * RadioError:NO_RESOURCES * RadioError:CANCELLED * RadioError:INVALID_MODEM_STATE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:SIM_ABSENT */ void sendTerminalResponseToSimResponse(in RadioResponseInfo info); @@ -427,7 +403,6 @@ oneway interface IRadioSimResponse { * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:INVALID_ARGUMENTS - * RadioError:REQUEST_NOT_SUPPORTED */ void setAllowedCarriersResponse(in RadioResponseInfo info); @@ -435,12 +410,11 @@ oneway interface IRadioSimResponse { * @param info Response info struct containing response type, serial no. and error * * Valid errors returned: - * RadioError:RIL_E_SUCCESS - * RadioError:RIL_E_RADIO_NOT_AVAILABLE + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE * RadioError:SIM_ABSENT - * RadioError:RIL_E_REQUEST_NOT_SUPPORTED * RadioError:INVALID_ARGUMENTS - * RadioError:MODEM_INTERNAL_FAILURE + * RadioError:INTERNAL_FAILURE */ void setCarrierInfoForImsiEncryptionResponse(in RadioResponseInfo info); @@ -456,7 +430,6 @@ oneway interface IRadioSimResponse { * RadioError:NO_MEMORY * RadioError:NO_RESOURCES * RadioError:CANCELLED - * RadioError:REQUEST_NOT_SUPPORTED */ void setCdmaSubscriptionSourceResponse(in RadioResponseInfo info); @@ -477,7 +450,6 @@ oneway interface IRadioSimResponse { * RadioError:SYSTEM_ERR * RadioError:INVALID_STATE * RadioError:FDN_CHECK_FAILURE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_MODEM_STATE * RadioError:NO_RESOURCES * RadioError:CANCELLED @@ -507,7 +479,6 @@ oneway interface IRadioSimResponse { * RadioError:SYSTEM_ERR * RadioError:MODEM_ERR * RadioError:INVALID_ARGUMENTS - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ @@ -527,7 +498,6 @@ oneway interface IRadioSimResponse { * RadioError:CANCELLED * RadioError:INVALID_ARGUMENTS * RadioError:INVALID_SIM_STATE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:SIM_PUK2 */ void supplyIccPin2ForAppResponse(in RadioResponseInfo info, in int remainingRetries); @@ -546,7 +516,6 @@ oneway interface IRadioSimResponse { * RadioError:CANCELLED * RadioError:INVALID_ARGUMENTS * RadioError:INVALID_SIM_STATE - * RadioError:REQUEST_NOT_SUPPORTED */ void supplyIccPinForAppResponse(in RadioResponseInfo info, in int remainingRetries); @@ -564,7 +533,6 @@ oneway interface IRadioSimResponse { * RadioError:CANCELLED * RadioError:INVALID_ARGUMENTS * RadioError:INVALID_SIM_STATE - * RadioError:REQUEST_NOT_SUPPORTED */ void supplyIccPuk2ForAppResponse(in RadioResponseInfo info, in int remainingRetries); @@ -582,7 +550,6 @@ oneway interface IRadioSimResponse { * RadioError:CANCELLED * RadioError:INVALID_ARGUMENTS * RadioError:INVALID_SIM_STATE - * RadioError:REQUEST_NOT_SUPPORTED */ void supplyIccPukForAppResponse(in RadioResponseInfo info, in int remainingRetries); @@ -603,7 +570,6 @@ oneway interface IRadioSimResponse { * RadioError:MODEM_ERR * RadioError:INVALID_ARGUMENTS * RadioError:NO_RESOURCES - * RadioError:REQUEST_NOT_SUPPORTED */ void supplySimDepersonalizationResponse( in RadioResponseInfo info, in PersoSubstate persoType, in int remainingRetries); @@ -616,7 +582,6 @@ oneway interface IRadioSimResponse { * Valid errors returned: * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_ARGUMENTS * RadioError:INVALID_SIM_STATE * RadioError:MODEM_ERR @@ -624,8 +589,6 @@ oneway interface IRadioSimResponse { * RadioError:SIM_ERR * RadioError:NO_SUCH_ENTRY * RadioError:NO_RESOURCES - * REQUEST_NOT_SUPPORTED may only be returned on devices that don't support this API, - * indicated by the HAL capability CAPABILITY_SIM_PHONEBOOK_IN_MODEM. */ void updateSimPhonebookRecordsResponse(in RadioResponseInfo info, in int updatedRecordIndex); } diff --git a/radio/aidl/android/hardware/radio/voice/IRadioVoiceResponse.aidl b/radio/aidl/android/hardware/radio/voice/IRadioVoiceResponse.aidl index cf1b953fc6..39e3aced92 100644 --- a/radio/aidl/android/hardware/radio/voice/IRadioVoiceResponse.aidl +++ b/radio/aidl/android/hardware/radio/voice/IRadioVoiceResponse.aidl @@ -42,7 +42,6 @@ oneway interface IRadioVoiceResponse { * RadioError:INVALID_CALL_ID * RadioError:INVALID_ARGUMENTS * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ @@ -71,7 +70,6 @@ oneway interface IRadioVoiceResponse { * RadioError:INVALID_STATE * RadioError:INVALID_ARGUMENTS * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_MODEM_STATE * RadioError:NO_RESOURCES * RadioError:CANCELLED @@ -92,7 +90,6 @@ oneway interface IRadioVoiceResponse { * RadioError:OPERATION_NOT_ALLOWED * RadioError:INVALID_ARGUMENTS * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_MODEM_STATE * RadioError:NO_RESOURCES * RadioError:CANCELLED @@ -122,7 +119,6 @@ oneway interface IRadioVoiceResponse { * RadioError:OPERATION_NOT_ALLOWED * RadioError:ABORTED * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_MODEM_STATE * RadioError:CANCELLED */ @@ -163,7 +159,6 @@ oneway interface IRadioVoiceResponse { * RadioError:SYSTEM_ERR * RadioError:INVALID_ARGUMENTS * RadioError:MODEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED * RadioError:SIM_ABSENT @@ -185,7 +180,6 @@ oneway interface IRadioVoiceResponse { * RadioError:INTERNAL_ERR * RadioError:INVALID_CALL_ID * RadioError:OPERATION_NOT_ALLOWED - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_MODEM_STATE * RadioError:NO_RESOURCES * RadioError:CANCELLED @@ -212,7 +206,6 @@ oneway interface IRadioVoiceResponse { * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR * RadioError:FDN_CHECK_FAILURE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:SYSTEM_ERR * RadioError:NO_RESOURCES * RadioError:CANCELLED @@ -241,7 +234,6 @@ oneway interface IRadioVoiceResponse { * RadioError:FDN_CHECK_FAILURE * RadioError:INTERNAL_ERR * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ @@ -260,7 +252,6 @@ oneway interface IRadioVoiceResponse { * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR * RadioError:FDN_CHECK_FAILURE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ @@ -282,7 +273,6 @@ oneway interface IRadioVoiceResponse { * RadioError:INTERNAL_ERR * RadioError:FDN_CHECK_FAILURE * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_ARGUMENTS * RadioError:NO_RESOURCES * RadioError:CANCELLED @@ -298,7 +288,6 @@ oneway interface IRadioVoiceResponse { * RadioError:INTERNAL_ERR * RadioError:SYSTEM_ERR * RadioError:INVALID_ARGUMENTS - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ @@ -344,7 +333,6 @@ oneway interface IRadioVoiceResponse { * RadioError:INVALID_ARGUMENTS * RadioError:INTERNAL_ERR * RadioError:MODEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_MEMORY * RadioError:NO_RESOURCES * RadioError:CANCELLED @@ -367,7 +355,6 @@ oneway interface IRadioVoiceResponse { * RadioError:INVALID_ARGUMENTS * RadioError:INTERNAL_ERR * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ @@ -386,7 +373,6 @@ oneway interface IRadioVoiceResponse { * RadioError:INTERNAL_ERR * RadioError:NO_MEMORY * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ @@ -404,7 +390,6 @@ oneway interface IRadioVoiceResponse { * RadioError:INTERNAL_ERR * RadioError:NO_MEMORY * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ @@ -423,7 +408,6 @@ oneway interface IRadioVoiceResponse { * RadioError:INVALID_ARGUMENTS * RadioError:NO_RESOURCES * RadioError:CANCELLED - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:SIM_ABSENT */ void handleStkCallSetupRequestFromSimResponse(in RadioResponseInfo info); @@ -442,7 +426,6 @@ oneway interface IRadioVoiceResponse { * RadioError:INVALID_CALL_ID * RadioError:NO_RESOURCES * RadioError:CANCELLED - * RadioError:REQUEST_NOT_SUPPORTED */ void hangupConnectionResponse(in RadioResponseInfo info); @@ -461,7 +444,6 @@ oneway interface IRadioVoiceResponse { * RadioError:OPERATION_NOT_ALLOWED * RadioError:INVALID_ARGUMENTS * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ @@ -482,7 +464,6 @@ oneway interface IRadioVoiceResponse { * RadioError:OPERATION_NOT_ALLOWED * RadioError:INVALID_ARGUMENTS * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:CANCELLED */ void hangupWaitingOrBackgroundResponse(in RadioResponseInfo info); @@ -497,7 +478,6 @@ oneway interface IRadioVoiceResponse { * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR * RadioError:NO_MEMORY - * RadioError:REQUEST_NOT_SUPPORTED */ void isVoNrEnabledResponse(in RadioResponseInfo info, in boolean enable); @@ -516,7 +496,6 @@ oneway interface IRadioVoiceResponse { * RadioError:OPERATION_NOT_ALLOWED * RadioError:INVALID_ARGUMENTS * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_MODEM_STATE * RadioError:NO_RESOURCES * RadioError:CANCELLED @@ -536,7 +515,6 @@ oneway interface IRadioVoiceResponse { * RadioError:MODEM_ERR * RadioError:INVALID_CALL_ID * RadioError:INVALID_STATE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED * RadioError:INVALID_MODEM_STATE @@ -557,7 +535,6 @@ oneway interface IRadioVoiceResponse { * RadioError:MODEM_ERR * RadioError:INVALID_CALL_ID * RadioError:INVALID_STATE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_MODEM_STATE * RadioError:NO_RESOURCES * RadioError:CANCELLED @@ -578,7 +555,6 @@ oneway interface IRadioVoiceResponse { * RadioError:INVALID_CALL_ID * RadioError:INTERNAL_ERR * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:CANCELLED * RadioError:INVALID_MODEM_STATE */ @@ -603,7 +579,6 @@ oneway interface IRadioVoiceResponse { * RadioError:ABORTED * RadioError:SYSTEM_ERR * RadioError:INVALID_STATE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_MODEM_STATE * RadioError:NO_RESOURCES * RadioError:CANCELLED @@ -625,7 +600,6 @@ oneway interface IRadioVoiceResponse { * RadioError:INTERNAL_ERR * RadioError:INVALID_CALL_ID * RadioError:OPERATION_NOT_ALLOWED - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_MODEM_STATE * RadioError:CANCELLED */ @@ -647,7 +621,6 @@ oneway interface IRadioVoiceResponse { * RadioError:INTERNAL_ERR * RadioError:INVALID_STATE * RadioError:FDN_CHECK_FAILURE - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_MODEM_STATE * RadioError:NO_RESOURCES * RadioError:CANCELLED @@ -670,7 +643,6 @@ oneway interface IRadioVoiceResponse { * RadioError:INVALID_STATE * RadioError:FDN_CHECK_FAILURE * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_MODEM_STATE * RadioError:NO_RESOURCES * RadioError:CANCELLED @@ -690,7 +662,6 @@ oneway interface IRadioVoiceResponse { * RadioError:NO_MEMORY * RadioError:INTERNAL_ERR * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ @@ -707,7 +678,6 @@ oneway interface IRadioVoiceResponse { * RadioError:REQUEST_RATE_LIMITED * RadioError:INTERNAL_ERR * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ @@ -724,7 +694,6 @@ oneway interface IRadioVoiceResponse { * RadioError:INTERNAL_ERR * RadioError:NO_MEMORY * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_CALL_ID * RadioError:NO_RESOURCES * RadioError:CANCELLED @@ -742,7 +711,6 @@ oneway interface IRadioVoiceResponse { * RadioError:INTERNAL_ERR * RadioError:NO_MEMORY * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:NO_RESOURCES * RadioError:CANCELLED */ @@ -758,7 +726,6 @@ oneway interface IRadioVoiceResponse { * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR * RadioError:NO_MEMORY - * RadioError:REQUEST_NOT_SUPPORTED */ void setVoNrEnabledResponse(in RadioResponseInfo info); @@ -776,7 +743,6 @@ oneway interface IRadioVoiceResponse { * RadioError:INTERNAL_ERR * RadioError:INVALID_CALL_ID * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:CANCELLED * RadioError:INVALID_MODEM_STATE */ @@ -796,7 +762,6 @@ oneway interface IRadioVoiceResponse { * RadioError:MODEM_ERR * RadioError:INTERNAL_ERR * RadioError:INVALID_CALL_ID - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:CANCELLED * RadioError:INVALID_MODEM_STATE */ @@ -817,7 +782,6 @@ oneway interface IRadioVoiceResponse { * RadioError:OPERATION_NOT_ALLOWED * RadioError:INVALID_ARGUMENTS * RadioError:SYSTEM_ERR - * RadioError:REQUEST_NOT_SUPPORTED * RadioError:INVALID_MODEM_STATE * RadioError:NO_RESOURCES * RadioError:CANCELLED diff --git a/radio/aidl/compat/libradiocompat/Android.bp b/radio/aidl/compat/libradiocompat/Android.bp index 0ceaec49dd..557e461cfe 100644 --- a/radio/aidl/compat/libradiocompat/Android.bp +++ b/radio/aidl/compat/libradiocompat/Android.bp @@ -39,7 +39,7 @@ cc_library { "android.hardware.radio.data-V1-ndk", "android.hardware.radio.ims-V1-ndk", "android.hardware.radio.messaging-V1-ndk", - "android.hardware.radio.modem-V1-ndk", + "android.hardware.radio.modem-V2-ndk", "android.hardware.radio.network-V2-ndk", "android.hardware.radio.sim-V1-ndk", "android.hardware.radio.voice-V1-ndk", diff --git a/radio/aidl/compat/service/Android.bp b/radio/aidl/compat/service/Android.bp index d16773e6a7..692f15a8af 100644 --- a/radio/aidl/compat/service/Android.bp +++ b/radio/aidl/compat/service/Android.bp @@ -42,7 +42,7 @@ cc_binary { "android.hardware.radio.data-V1-ndk", "android.hardware.radio.ims-V1-ndk", "android.hardware.radio.messaging-V1-ndk", - "android.hardware.radio.modem-V1-ndk", + "android.hardware.radio.modem-V2-ndk", "android.hardware.radio.network-V2-ndk", "android.hardware.radio.sim-V1-ndk", "android.hardware.radio.voice-V1-ndk", diff --git a/radio/aidl/vts/Android.bp b/radio/aidl/vts/Android.bp index bb992c9e76..4df54f768f 100644 --- a/radio/aidl/vts/Android.bp +++ b/radio/aidl/vts/Android.bp @@ -71,7 +71,7 @@ cc_test { "android.hardware.radio.data-V1-ndk", "android.hardware.radio.ims-V1-ndk", "android.hardware.radio.messaging-V1-ndk", - "android.hardware.radio.modem-V1-ndk", + "android.hardware.radio.modem-V2-ndk", "android.hardware.radio.network-V2-ndk", "android.hardware.radio.sim-V1-ndk", "android.hardware.radio.voice-V1-ndk", From 68d3f12869030d602be1053a961c01da282b4ffd Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Wed, 9 Nov 2022 14:43:32 -0800 Subject: [PATCH 377/998] Add HAL changes for STEERING_WHEEL_LOCKED Bug: 257267840 Test: atest VtsHalAutomotiveVehicle_TargetTest atest CtsCarTestCases:CarPropertyManagerTest atest CtsCarTestCases:VehiclePropertyIdsTest Change-Id: Ie493bc51f66d76effc7d9591c491d583ace1c2e3 --- .../hardware/automotive/vehicle/VehicleProperty.aidl | 1 + .../hardware/automotive/vehicle/VehicleProperty.aidl | 10 ++++++++++ .../aidl/generated_lib/cpp/AccessForVehicleProperty.h | 1 + .../generated_lib/cpp/ChangeModeForVehicleProperty.h | 1 + .../generated_lib/java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../impl/default_config/config/DefaultProperties.json | 8 ++++++++ .../vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 29 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 851fba7404..392c82ef94 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -162,6 +162,7 @@ enum VehicleProperty { STEERING_WHEEL_HEIGHT_POS = 289410018, STEERING_WHEEL_HEIGHT_MOVE = 289410019, STEERING_WHEEL_THEFT_LOCK_ENABLED = 287312868, + STEERING_WHEEL_LOCKED = 287312869, VEHICLE_MAP_SERVICE = 299895808, OBD2_LIVE_FRAME = 299896064, OBD2_FREEZE_FRAME = 299896065, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index ccd765a48b..e9df5bd4f0 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1845,6 +1845,16 @@ enum VehicleProperty { */ STEERING_WHEEL_THEFT_LOCK_ENABLED = 0x0BE4 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Steering wheel locked + * + * If true, the steering wheel's position is locked and not changeable. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + STEERING_WHEEL_LOCKED = + 0x0BE5 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, /** * Vehicle Maps Service (VMS) message * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 4c3479dd00..decf2502c0 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -162,6 +162,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::STEERING_WHEEL_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::STEERING_WHEEL_THEFT_LOCK_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::STEERING_WHEEL_LOCKED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyAccess::READ}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyAccess::READ}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 889522ef4a..7e507d7139 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -162,6 +162,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::STEERING_WHEEL_HEIGHT_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_THEFT_LOCK_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::STEERING_WHEEL_LOCKED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 669b4fd148..62b2b73927 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -154,6 +154,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.STEERING_WHEEL_THEFT_LOCK_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.STEERING_WHEEL_LOCKED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyAccess.READ), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 8984f07ae6..a1f01279ee 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -154,6 +154,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_THEFT_LOCK_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.STEERING_WHEEL_LOCKED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index b2b08f5a00..99e52e98ec 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2276,6 +2276,14 @@ ] } }, + { + "property": "VehicleProperty::STEERING_WHEEL_LOCKED", + "defaultValue": { + "int32Values": [ + 0 + ] + } + }, { "property": "VehicleProperty::WHEEL_TICK", "defaultValue": { diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index a63f66e212..13244ce001 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -517,6 +517,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelTheftLockEnabledCon VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelLockedConfig) { + verifyProperty(VehicleProperty::STEERING_WHEEL_LOCKED, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); +} + std::vector getDescriptors() { std::vector descriptors; for (std::string name : getAidlHalInstanceNames(IVehicle::descriptor)) { From 4dd6a516a6564f6cfef1c3c1fe67406566934891 Mon Sep 17 00:00:00 2001 From: Shuzhen Wang Date: Tue, 8 Nov 2022 20:47:20 +0000 Subject: [PATCH 378/998] Camera: Add new camera metadata for settings override frame number Add a frame number field in HAL capture result metadata to indicate the frame number of newer request overriding this capture. This is needed so that ZoomRatioMapper can look up the newer request's zoom ratio. Also add VTS test for transition between OFF and ZOOM. Test: Camera VTS on cuttlefish Bug: 239822823 Change-Id: I7439950cdb9f346bf36c4cc872fd7865eb9cf669 --- .../camera/metadata/CameraMetadataTag.aidl | 7 +- .../camera/metadata/CameraMetadataTag.aidl | 6 + .../VtsAidlHalCameraProvider_TargetTest.cpp | 22 +++ camera/provider/aidl/vts/camera_aidl_test.cpp | 187 +++++++++++++++++- camera/provider/aidl/vts/camera_aidl_test.h | 6 + 5 files changed, 224 insertions(+), 4 deletions(-) diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl index 617979d957..ecbfc9371f 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl @@ -94,9 +94,10 @@ enum CameraMetadataTag { ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS_MAXIMUM_RESOLUTION = 65584, ANDROID_CONTROL_SETTINGS_OVERRIDE = 65588, ANDROID_CONTROL_AVAILABLE_SETTINGS_OVERRIDES = 65589, - ANDROID_CONTROL_AUTOFRAMING = 65590, - ANDROID_CONTROL_AUTOFRAMING_AVAILABLE = 65591, - ANDROID_CONTROL_AUTOFRAMING_STATE = 65592, + ANDROID_CONTROL_SETTINGS_OVERRIDING_FRAME_NUMBER = 65590, + ANDROID_CONTROL_AUTOFRAMING = 65591, + ANDROID_CONTROL_AUTOFRAMING_AVAILABLE = 65592, + ANDROID_CONTROL_AUTOFRAMING_STATE = 65593, ANDROID_DEMOSAIC_MODE = 131072, ANDROID_EDGE_MODE = 196608, ANDROID_EDGE_STRENGTH = 196609, diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl index 85e56bce77..2e9bde95a3 100644 --- a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl +++ b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl @@ -463,6 +463,12 @@ enum CameraMetadataTag { * be used to speed up certain controls.

*/ ANDROID_CONTROL_AVAILABLE_SETTINGS_OVERRIDES, + /** + * android.control.settingsOverridingFrameNumber [dynamic, int32, system] + * + *

The frame number of the newer request overriding this capture.

+ */ + ANDROID_CONTROL_SETTINGS_OVERRIDING_FRAME_NUMBER, /** * android.control.autoframing [dynamic, enum, public] * diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp index 017f6efa65..747ea336e2 100644 --- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp +++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp @@ -2065,6 +2065,28 @@ TEST_P(CameraAidlTest, process10BitColorSpaceRequests) { } } +TEST_P(CameraAidlTest, processZoomSettingsOverrideRequests) { + const int32_t kFrameCount = 5; + const int32_t kTestCases = 2; + const bool kOverrideSequence[kTestCases][kFrameCount] = { + // ZOOM, ZOOM, ZOOM, ZOOM, ZOOM; + { true, true, true, true, true }, + // OFF, OFF, ZOOM, ZOOM, OFF; + { false, false, true, true, false } }; + const bool kExpectedOverrideResults[kTestCases][kFrameCount] = { + // All resuls should be overridden except the last one. The last result's + // zoom doesn't have speed-up. + { true, true, true, true, false }, + // Because we require at least 2 frames speed-up, request #1, #2 and #3 + // will be overridden. + { true, true, true, false, false } }; + + for (int i = 0; i < kTestCases; i++) { + processZoomSettingsOverrideRequests(kFrameCount, kOverrideSequence[i], + kExpectedOverrideResults[i]); + } +} + // Generate and verify a burst containing alternating sensor sensitivity values TEST_P(CameraAidlTest, processCaptureRequestBurstISO) { std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp index ca316e5192..b9e30ab891 100644 --- a/camera/provider/aidl/vts/camera_aidl_test.cpp +++ b/camera/provider/aidl/vts/camera_aidl_test.cpp @@ -363,10 +363,15 @@ void CameraAidlTest::verifySettingsOverrideCharacteristics(const camera_metadata retcode = find_camera_metadata_ro_entry(metadata, ANDROID_REQUEST_AVAILABLE_RESULT_KEYS, &entry); bool hasSettingsOverrideResultKey = false; + bool hasOverridingFrameNumberKey = false; if ((0 == retcode) && (entry.count > 0)) { hasSettingsOverrideResultKey = std::find(entry.data.i32, entry.data.i32 + entry.count, ANDROID_CONTROL_SETTINGS_OVERRIDE) != entry.data.i32 + entry.count; + hasOverridingFrameNumberKey = + std::find(entry.data.i32, entry.data.i32 + entry.count, + ANDROID_CONTROL_SETTINGS_OVERRIDING_FRAME_NUMBER) + != entry.data.i32 + entry.count; } else { ADD_FAILURE() << "Get camera availableResultKeys failed!"; } @@ -385,6 +390,7 @@ void CameraAidlTest::verifySettingsOverrideCharacteristics(const camera_metadata ASSERT_EQ(supportSettingsOverride, hasSettingsOverrideRequestKey); ASSERT_EQ(supportSettingsOverride, hasSettingsOverrideResultKey); + ASSERT_EQ(supportSettingsOverride, hasOverridingFrameNumberKey); ASSERT_EQ(supportSettingsOverride, hasSettingsOverrideCharacteristicsKey); } @@ -1579,7 +1585,7 @@ void CameraAidlTest::verifyRequestTemplate(const camera_metadata_t* metadata, // Check settings override camera_metadata_ro_entry settingsOverrideEntry; int foundSettingsOverride = find_camera_metadata_ro_entry(metadata, - ANDROID_CONTROL_SETTINGS_OVERRIDE,&settingsOverrideEntry); + ANDROID_CONTROL_SETTINGS_OVERRIDE, &settingsOverrideEntry); if (foundSettingsOverride == 0) { ASSERT_EQ(settingsOverrideEntry.count, 1); ASSERT_EQ(settingsOverrideEntry.data.u8[0], ANDROID_CONTROL_SETTINGS_OVERRIDE_OFF); @@ -3019,6 +3025,30 @@ int32_t CameraAidlTest::halFormatToPublicFormat( } } +bool CameraAidlTest::supportZoomSettingsOverride(const camera_metadata_t* staticMeta) { + camera_metadata_ro_entry availableOverridesEntry; + int rc = find_camera_metadata_ro_entry(staticMeta, ANDROID_CONTROL_AVAILABLE_SETTINGS_OVERRIDES, + &availableOverridesEntry); + if (rc == 0) { + for (size_t i = 0; i < availableOverridesEntry.count; i++) { + if (availableOverridesEntry.data.i32[i] == ANDROID_CONTROL_SETTINGS_OVERRIDE_ZOOM) { + return true; + } + } + } + return false; +} + +bool CameraAidlTest::isPerFrameControl(const camera_metadata_t* staticMeta) { + camera_metadata_ro_entry syncLatencyEntry; + int rc = find_camera_metadata_ro_entry(staticMeta, ANDROID_SYNC_MAX_LATENCY, + &syncLatencyEntry); + if (rc == 0 && syncLatencyEntry.data.i32[0] == ANDROID_SYNC_MAX_LATENCY_PER_FRAME_CONTROL) { + return true; + } + return false; +} + void CameraAidlTest::configurePreviewStream( const std::string& name, const std::shared_ptr& provider, const AvailableStream* previewThreshold, std::shared_ptr* session, @@ -3385,3 +3415,158 @@ void CameraAidlTest::processColorSpaceRequest( ASSERT_TRUE(ret.isOk()); } } + +void CameraAidlTest::processZoomSettingsOverrideRequests( + int32_t frameCount, const bool *overrideSequence, const bool *expectedResults) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight, + static_cast(PixelFormat::IMPLEMENTATION_DEFINED)}; + int64_t bufferId = 1; + int32_t frameNumber = 1; + CameraMetadata settings; + ndk::ScopedAStatus ret; + for (const auto& name : cameraDeviceNames) { + CameraMetadata meta; + std::shared_ptr device; + openEmptyDeviceSession(name, mProvider, &mSession /*out*/, &meta /*out*/, + &device /*out*/); + camera_metadata_t* staticMeta = + clone_camera_metadata(reinterpret_cast(meta.metadata.data())); + + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + + // Device does not support zoom settnigs override + if (!supportZoomSettingsOverride(staticMeta)) { + continue; + } + + if (!isPerFrameControl(staticMeta)) { + continue; + } + + bool supportsPartialResults = false; + bool useHalBufManager = false; + int32_t partialResultCount = 0; + Stream previewStream; + std::vector halStreams; + std::shared_ptr cb; + configurePreviewStream(name, mProvider, &previewThreshold, &mSession /*out*/, + &previewStream /*out*/, &halStreams /*out*/, + &supportsPartialResults /*out*/, &partialResultCount /*out*/, + &useHalBufManager /*out*/, &cb /*out*/); + ASSERT_NE(mSession, nullptr); + + ::aidl::android::hardware::common::fmq::MQDescriptor< + int8_t, aidl::android::hardware::common::fmq::SynchronizedReadWrite> + descriptor; + auto resultQueueRet = mSession->getCaptureResultMetadataQueue(&descriptor); + ASSERT_TRUE(resultQueueRet.isOk()); + + std::shared_ptr resultQueue = + std::make_shared(descriptor); + if (!resultQueue->isValid() || resultQueue->availableToWrite() <= 0) { + ALOGE("%s: HAL returns empty result metadata fmq, not use it", __func__); + resultQueue = nullptr; + // Don't use the queue onwards. + } + + ret = mSession->constructDefaultRequestSettings(RequestTemplate::PREVIEW, &settings); + ASSERT_TRUE(ret.isOk()); + + mInflightMap.clear(); + ::android::hardware::camera::common::V1_0::helper::CameraMetadata requestMeta; + std::vector requests(frameCount); + std::vector buffers(frameCount); + std::vector> inflightReqs(frameCount); + std::vector requestSettings(frameCount); + + for (int32_t i = 0; i < frameCount; i++) { + std::unique_lock l(mLock); + CaptureRequest& request = requests[i]; + std::vector& outputBuffers = request.outputBuffers; + outputBuffers.resize(1); + StreamBuffer& outputBuffer = outputBuffers[0]; + + if (useHalBufManager) { + outputBuffer = {halStreams[0].id, 0, + NativeHandle(), BufferStatus::OK, + NativeHandle(), NativeHandle()}; + } else { + allocateGraphicBuffer(previewStream.width, previewStream.height, + android_convertGralloc1To0Usage( + static_cast(halStreams[0].producerUsage), + static_cast(halStreams[0].consumerUsage)), + halStreams[0].overrideFormat, &buffers[i]); + outputBuffer = {halStreams[0].id, bufferId + i, ::android::makeToAidl(buffers[i]), + BufferStatus::OK, NativeHandle(), NativeHandle()}; + } + + // Set appropriate settings override tag + requestMeta.append(reinterpret_cast(settings.metadata.data())); + int32_t settingsOverride = overrideSequence[i] ? + ANDROID_CONTROL_SETTINGS_OVERRIDE_ZOOM : ANDROID_CONTROL_SETTINGS_OVERRIDE_OFF; + ASSERT_EQ(::android::OK, requestMeta.update(ANDROID_CONTROL_SETTINGS_OVERRIDE, + &settingsOverride, 1)); + camera_metadata_t* metaBuffer = requestMeta.release(); + uint8_t* rawMetaBuffer = reinterpret_cast(metaBuffer); + requestSettings[i].metadata = std::vector( + rawMetaBuffer, rawMetaBuffer + get_camera_metadata_size(metaBuffer)); + overrideRotateAndCrop(&(requestSettings[i])); + request.frameNumber = frameNumber + i; + request.fmqSettingsSize = 0; + request.settings = requestSettings[i]; + request.inputBuffer = { + -1, 0, NativeHandle(), BufferStatus::ERROR, NativeHandle(), NativeHandle()}; + + inflightReqs[i] = std::make_shared(1, false, supportsPartialResults, + partialResultCount, resultQueue); + mInflightMap[frameNumber + i] = inflightReqs[i]; + } + + int32_t numRequestProcessed = 0; + std::vector cachesToRemove; + + ndk::ScopedAStatus returnStatus = + mSession->processCaptureRequest(requests, cachesToRemove, &numRequestProcessed); + ASSERT_TRUE(returnStatus.isOk()); + ASSERT_EQ(numRequestProcessed, frameCount); + + for (size_t i = 0; i < frameCount; i++) { + std::unique_lock l(mLock); + while (!inflightReqs[i]->errorCodeValid && ((0 < inflightReqs[i]->numBuffersLeft) || + (!inflightReqs[i]->haveResultMetadata))) { + auto timeout = std::chrono::system_clock::now() + + std::chrono::seconds(kStreamBufferTimeoutSec); + ASSERT_NE(std::cv_status::timeout, mResultCondition.wait_until(l, timeout)); + } + + ASSERT_FALSE(inflightReqs[i]->errorCodeValid); + ASSERT_NE(inflightReqs[i]->resultOutputBuffers.size(), 0u); + ASSERT_EQ(previewStream.id, inflightReqs[i]->resultOutputBuffers[0].buffer.streamId); + ASSERT_FALSE(inflightReqs[i]->collectedResult.isEmpty()); + ASSERT_TRUE(inflightReqs[i]->collectedResult.exists(ANDROID_CONTROL_SETTINGS_OVERRIDE)); + camera_metadata_entry_t overrideResult = + inflightReqs[i]->collectedResult.find(ANDROID_CONTROL_SETTINGS_OVERRIDE); + ASSERT_EQ(overrideResult.data.i32[0] == ANDROID_CONTROL_SETTINGS_OVERRIDE_ZOOM, + expectedResults[i]); + ASSERT_TRUE(inflightReqs[i]->collectedResult.exists( + ANDROID_CONTROL_SETTINGS_OVERRIDING_FRAME_NUMBER)); + camera_metadata_entry_t frameNumberEntry = inflightReqs[i]->collectedResult.find( + ANDROID_CONTROL_SETTINGS_OVERRIDING_FRAME_NUMBER); + ALOGV("%s: i %zu, expcetedResults[i] %d, overrideResult is %d, frameNumber %d", + __FUNCTION__, i, expectedResults[i], overrideResult.data.i32[0], + frameNumberEntry.data.i32[0]); + if (expectedResults[i]) { + ASSERT_GT(frameNumberEntry.data.i32[0], inflightReqs[i]->frameNumber); + } else { + ASSERT_EQ(frameNumberEntry.data.i32[0], frameNumber + i); + } + } + + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + } +} diff --git a/camera/provider/aidl/vts/camera_aidl_test.h b/camera/provider/aidl/vts/camera_aidl_test.h index ff3617f93c..b6e398b435 100644 --- a/camera/provider/aidl/vts/camera_aidl_test.h +++ b/camera/provider/aidl/vts/camera_aidl_test.h @@ -406,6 +406,12 @@ class CameraAidlTest : public ::testing::TestWithParam { aidl::android::hardware::camera::metadata:: RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile); + void processZoomSettingsOverrideRequests( + int32_t frameCount, const bool *overrideSequence, const bool *expectedResults); + + bool supportZoomSettingsOverride(const camera_metadata_t* staticMeta); + bool isPerFrameControl(const camera_metadata_t* staticMeta); + protected: // In-flight queue for tracking completion of capture requests. struct InFlightRequest { From 474ad38f3344aa4c4403067833c6ac2baf7bc02f Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Fri, 21 Oct 2022 13:44:00 +0000 Subject: [PATCH 379/998] Add isN1ModeEnabled and setN1ModeEnabled to IRadioNetwork Bug: 255450196 Test: atest VtsHalRadioTargetTest Change-Id: If8a9e1e1d3dccfa4867c9c7d597c09936abeaa5e --- .../hardware/radio/network/IRadioNetwork.aidl | 2 + .../radio/network/IRadioNetworkResponse.aidl | 2 + .../hardware/radio/network/IRadioNetwork.aidl | 26 ++++++++++ .../radio/network/IRadioNetworkResponse.aidl | 30 ++++++++++++ .../include/libradiocompat/RadioNetwork.h | 2 + .../libradiocompat/network/RadioNetwork.cpp | 13 +++++ radio/aidl/vts/radio_network_response.cpp | 13 +++++ radio/aidl/vts/radio_network_test.cpp | 47 +++++++++++++++++++ radio/aidl/vts/radio_network_utils.h | 5 ++ 9 files changed, 140 insertions(+) diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl index 8e5d2be70a..9761900ba4 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl @@ -78,4 +78,6 @@ interface IRadioNetwork { oneway void cancelEmergencyNetworkScan(int serial, boolean resetScan); oneway void exitEmergencyMode(in int serial); oneway void setNullCipherAndIntegrityEnabled(in int serial, in boolean enabled); + oneway void isN1ModeEnabled(in int serial); + oneway void setN1ModeEnabled(in int serial, boolean enable); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl index 7151f220e4..c228bc17d8 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -77,4 +77,6 @@ interface IRadioNetworkResponse { oneway void exitEmergencyModeResponse(in android.hardware.radio.RadioResponseInfo info); oneway void cancelEmergencyNetworkScanResponse(in android.hardware.radio.RadioResponseInfo info); oneway void setNullCipherAndIntegrityEnabledResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void isN1ModeEnabledResponse(in android.hardware.radio.RadioResponseInfo info, boolean isEnabled); + oneway void setN1ModeEnabledResponse(in android.hardware.radio.RadioResponseInfo info); } diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl index 3c84a84cd3..4d35742aa8 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl @@ -504,4 +504,30 @@ oneway interface IRadioNetwork { * Response callback is IRadioResponse.setNullCipherAndIntegrityEnabledResponse() */ void setNullCipherAndIntegrityEnabled(in int serial, in boolean enabled); + + /** + * Checks whether N1 mode (access to 5G core network) is enabled or not. + * + * @param serial Serial number of request. + * + * Response function is IRadioNetworkResponse.isN1ModeEnabledResponse() + */ + void isN1ModeEnabled(in int serial); + + /** + * Enables or disables N1 mode (access to 5G core network) in accordance with + * 3GPP TS 24.501 4.9. + * + * Note: The default value of N1 mode shall be based on the modem's internal configuration + * as per device or carrier. This API may be invoked on demand first to disable N1 mode and + * later to re-enable for certain use case. This setting shall not be persisted by modem. + * This setting shall not interfere with the allowed network type bitmap set using + * {@link IRadioNetwork#setAllowedNetworkTypesBitmap()} API. + * + * @param serial Serial number of request. + * @param enable {@code true} to enable N1 mode, {@code false} to disable N1 mode. + * + * Response function is IRadioNetworkResponse.setN1ModeEnabledResponse() + */ + void setN1ModeEnabled(in int serial, boolean enable); } diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl index 956b82e90a..3802bd6c23 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -624,4 +624,34 @@ oneway interface IRadioNetworkResponse { * RadioError:MODEM_ERR */ void setNullCipherAndIntegrityEnabledResponse(in RadioResponseInfo info); + + /** + * Response of isN1ModeEnabled. + * This is an optional API. + * + * @param info Response info struct containing response type, serial no. and error. + * @param isEnabled Indicates whether N1 mode is enabled or not. + * + * Valid errors returned: + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:INTERNAL_ERR + * RadioError:REQUEST_NOT_SUPPORTED + */ + void isN1ModeEnabledResponse(in RadioResponseInfo info, boolean isEnabled); + + /** + * Response of setN1ModeEnabled. + * This is an optional API. + * + * @param info Response info struct containing response type, serial no. and error. + * + * Valid errors returned: + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:INTERNAL_ERR + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:INVALID_STATE + */ + void setN1ModeEnabledResponse(in RadioResponseInfo info); } diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h index 2e0488d1c0..f9f3c6cb33 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h @@ -99,6 +99,8 @@ class RadioNetwork : public RadioCompatBase, scanTrigger) override; ::ndk::ScopedAStatus cancelEmergencyNetworkScan(int32_t serial, bool resetScan) override; ::ndk::ScopedAStatus exitEmergencyMode(int32_t serial) override; + ::ndk::ScopedAStatus isN1ModeEnabled(int32_t serial) override; + ::ndk::ScopedAStatus setN1ModeEnabled(int32_t serial, bool enable) override; ::ndk::ScopedAStatus setNullCipherAndIntegrityEnabled(int32_t serial, bool enabled) override; diff --git a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp index bbe7fd70de..005deaed4d 100644 --- a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp +++ b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp @@ -347,4 +347,17 @@ ScopedAStatus RadioNetwork::setNullCipherAndIntegrityEnabled(int32_t serial, boo return ok(); } +ScopedAStatus RadioNetwork::isN1ModeEnabled(int32_t serial) { + LOG_CALL << serial; + LOG(ERROR) << " isN1ModeEnabled is unsupported by HIDL HALs"; + respond()->isN1ModeEnabledResponse(notSupported(serial), false); + return ok(); +} + +ScopedAStatus RadioNetwork::setN1ModeEnabled(int32_t serial, bool /*enable*/) { + LOG_CALL << serial; + LOG(ERROR) << " setN1ModeEnabled is unsupported by HIDL HALs"; + respond()->setN1ModeEnabledResponse(notSupported(serial)); + return ok(); +} } // namespace android::hardware::radio::compat diff --git a/radio/aidl/vts/radio_network_response.cpp b/radio/aidl/vts/radio_network_response.cpp index 82aaa1b85d..c890df08a6 100644 --- a/radio/aidl/vts/radio_network_response.cpp +++ b/radio/aidl/vts/radio_network_response.cpp @@ -300,3 +300,16 @@ ndk::ScopedAStatus RadioNetworkResponse::setNullCipherAndIntegrityEnabledRespons parent_network.notify(info.serial); return ndk::ScopedAStatus::ok(); } + +ndk::ScopedAStatus RadioNetworkResponse::isN1ModeEnabledResponse( + const RadioResponseInfo& info, bool /*isEnabled*/) { + rspInfo = info; + parent_network.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioNetworkResponse::setN1ModeEnabledResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_network.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index 31f4aca9bb..8b8eda6693 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -1914,3 +1914,50 @@ TEST_P(RadioNetworkTest, exitEmergencyMode) { RadioError::MODEM_ERR})); LOG(DEBUG) << "exitEmergencyMode finished"; } + +/* + * Test IRadioNetwork.setN1ModeEnabled() for the response returned. + */ +TEST_P(RadioNetworkTest, setN1ModeEnabled) { + serial = GetRandomSerialNumber(); + + ndk::ScopedAStatus res = + radio_network->setN1ModeEnabled(serial, false); + ASSERT_OK(res); + + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); + if (getRadioHalCapabilities()) { + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, + {RadioError::REQUEST_NOT_SUPPORTED})); + } else { + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp_network->rspInfo.error, + {RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR, + RadioError::INVALID_STATE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::NONE})); + } +} + +/* + * Test IRadioNetwork.isN1ModeEnabled() for the response returned. + */ +TEST_P(RadioNetworkTest, isN1ModeEnabled) { + serial = GetRandomSerialNumber(); + + ndk::ScopedAStatus res = radio_network->isN1ModeEnabled(serial); + ASSERT_OK(res); + + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); + if (getRadioHalCapabilities()) { + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, + {RadioError::REQUEST_NOT_SUPPORTED})); + } else { + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp_network->rspInfo.error, + {RadioError::RADIO_NOT_AVAILABLE, RadioError::INTERNAL_ERR, + RadioError::REQUEST_NOT_SUPPORTED, RadioError::NONE})); + } +} diff --git a/radio/aidl/vts/radio_network_utils.h b/radio/aidl/vts/radio_network_utils.h index 67654b1494..e6a320b572 100644 --- a/radio/aidl/vts/radio_network_utils.h +++ b/radio/aidl/vts/radio_network_utils.h @@ -161,6 +161,11 @@ class RadioNetworkResponse : public BnRadioNetworkResponse { virtual ndk::ScopedAStatus setNullCipherAndIntegrityEnabledResponse( const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus isN1ModeEnabledResponse( + const RadioResponseInfo& info, bool isEnabled) override; + + virtual ndk::ScopedAStatus setN1ModeEnabledResponse(const RadioResponseInfo& info) override; }; /* Callback class for radio network indication */ From a13672130f9c2dec5538223f2f7e074cfd506316 Mon Sep 17 00:00:00 2001 From: shrikar Date: Wed, 2 Nov 2022 16:07:35 +0000 Subject: [PATCH 380/998] Added new properties MIRROR_AUTO_FOLD_ENABLED, MIRROR_AUTO_TILT_ENABLED to hardware layer. Bug: 255665707, 255666465 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I0323cac908424a82cbe7c9c2c77480cdaab01cc5 --- .../automotive/vehicle/VehicleProperty.aidl | 2 ++ .../automotive/vehicle/VehicleProperty.aidl | 29 +++++++++++++++++++ .../cpp/AccessForVehicleProperty.h | 2 ++ .../cpp/ChangeModeForVehicleProperty.h | 2 ++ .../java/AccessForVehicleProperty.java | 2 ++ .../java/ChangeModeForVehicleProperty.java | 2 ++ .../config/DefaultProperties.json | 26 +++++++++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 12 ++++++++ 8 files changed, 77 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 392c82ef94..3bb8811448 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -126,6 +126,8 @@ enum VehicleProperty { MIRROR_Y_MOVE = 339741507, MIRROR_LOCK = 287312708, MIRROR_FOLD = 287312709, + MIRROR_AUTO_FOLD_ENABLED = 337644358, + MIRROR_AUTO_TILT_ENABLED = 337644359, SEAT_MEMORY_SELECT = 356518784, SEAT_MEMORY_SET = 356518785, SEAT_BELT_BUCKLED = 354421634, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index e9df5bd4f0..60191b241f 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1391,6 +1391,35 @@ enum VehicleProperty { */ MIRROR_FOLD = 0x0B45 + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN + + /** + * Represents property for Mirror Auto Fold feature. + * + * This property is true when the feature for automatically folding the vehicle's side mirrors + * (for example, when the mirrors fold inward automatically when one exits and locks the + * vehicle) is enabled. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + + MIRROR_AUTO_FOLD_ENABLED = + 0x0B46 + VehiclePropertyGroup.SYSTEM + VehicleArea.MIRROR + VehiclePropertyType.BOOLEAN, + + /** + * Represents property for Mirror Auto Tilt feature. + * + * This property is true when the feature for automatically tilting the vehicle's side mirrors + * (for example, when the mirrors tilt downward automatically when one reverses the vehicle) is + * enabled. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + + MIRROR_AUTO_TILT_ENABLED = + 0x0B47 + VehiclePropertyGroup.SYSTEM + VehicleArea.MIRROR + VehiclePropertyType.BOOLEAN, + /** * Seat memory select * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index decf2502c0..e93972e129 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -126,6 +126,8 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::MIRROR_Y_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::MIRROR_LOCK, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::MIRROR_FOLD, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::MIRROR_AUTO_FOLD_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::MIRROR_AUTO_TILT_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_MEMORY_SELECT, VehiclePropertyAccess::WRITE}, {VehicleProperty::SEAT_MEMORY_SET, VehiclePropertyAccess::WRITE}, {VehicleProperty::SEAT_BELT_BUCKLED, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 7e507d7139..f94e2c3dba 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -126,6 +126,8 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::MIRROR_Y_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::MIRROR_LOCK, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::MIRROR_FOLD, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::MIRROR_AUTO_FOLD_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::MIRROR_AUTO_TILT_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_MEMORY_SELECT, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_MEMORY_SET, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_BELT_BUCKLED, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 62b2b73927..66295147c7 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -118,6 +118,8 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.MIRROR_Y_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.MIRROR_LOCK, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.MIRROR_FOLD, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.MIRROR_AUTO_FOLD_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.MIRROR_AUTO_TILT_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_MEMORY_SELECT, VehiclePropertyAccess.WRITE), Map.entry(VehicleProperty.SEAT_MEMORY_SET, VehiclePropertyAccess.WRITE), Map.entry(VehicleProperty.SEAT_BELT_BUCKLED, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index a1f01279ee..7c00fbba81 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -118,6 +118,8 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.MIRROR_Y_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.MIRROR_LOCK, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.MIRROR_FOLD, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.MIRROR_AUTO_FOLD_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.MIRROR_AUTO_TILT_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_MEMORY_SELECT, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_MEMORY_SET, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_BELT_BUCKLED, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 99e52e98ec..b3dbe05ea3 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2125,6 +2125,32 @@ ] } }, + { + "property": "VehicleProperty::MIRROR_AUTO_FOLD_ENABLED", + "defaultValue": { + "int32Values": [ + 1 + ] + }, + "areas": [ + { + "areaId": "Constants::MIRROR_DRIVER_LEFT_RIGHT" + } + ] + }, + { + "property": "VehicleProperty::MIRROR_AUTO_TILT_ENABLED", + "defaultValue": { + "int32Values": [ + 1 + ] + }, + "areas": [ + { + "areaId": "Constants::MIRROR_DRIVER_LEFT_RIGHT" + } + ] + }, { "property": "VehicleProperty::WINDOW_LOCK", "areas": [ diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 13244ce001..f230be9dd9 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -523,6 +523,18 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelLockedConfig) { VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyMirrorAutoFoldEnabledConfig) { + verifyProperty(VehicleProperty::MIRROR_AUTO_FOLD_ENABLED, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::MIRROR, VehiclePropertyType::BOOLEAN); +} + +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyMirrorAutoTiltEnabledConfig) { + verifyProperty(VehicleProperty::MIRROR_AUTO_TILT_ENABLED, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::MIRROR, VehiclePropertyType::BOOLEAN); +} + std::vector getDescriptors() { std::vector descriptors; for (std::string name : getAidlHalInstanceNames(IVehicle::descriptor)) { From 7f125e974b2117e098efc8a0ce75743a7f573ce3 Mon Sep 17 00:00:00 2001 From: Sarah Chin Date: Thu, 17 Nov 2022 10:16:33 -0800 Subject: [PATCH 381/998] Add timingAdvance for NR signal strength Test: atest Bug: 141097448 Change-Id: I09bf752fd766570cdd8ee473c5f1acd53d856347 --- .../android/hardware/radio/network/NrSignalStrength.aidl | 1 + .../android/hardware/radio/network/NrSignalStrength.aidl | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrSignalStrength.aidl index 98bbe6bd94..20550249a1 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrSignalStrength.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrSignalStrength.aidl @@ -42,4 +42,5 @@ parcelable NrSignalStrength { int csiSinr; int csiCqiTableIndex; byte[] csiCqiReport; + int timingAdvance; } diff --git a/radio/aidl/android/hardware/radio/network/NrSignalStrength.aidl b/radio/aidl/android/hardware/radio/network/NrSignalStrength.aidl index 1bb569a91b..2314562a16 100644 --- a/radio/aidl/android/hardware/radio/network/NrSignalStrength.aidl +++ b/radio/aidl/android/hardware/radio/network/NrSignalStrength.aidl @@ -71,4 +71,11 @@ parcelable NrSignalStrength { * Range [0, 15], 0xFF means invalid/unreported. */ byte[] csiCqiReport; + /** + * Timing advance in micro seconds for a one way trip from cell to device. Approximate distance + * is calculated using 300m/us * timingAdvance. Range: 0 to 1282 inclusive. + * INT_MAX: 0x7FFFFFFF denotes invalid/unreported value. + * Reference: 3GPP 36.213 section 4.2.3 + */ + int timingAdvance; } From 45b06598bd31a96a170530a32c39e301b3ae2d3b Mon Sep 17 00:00:00 2001 From: Sungtak Lee Date: Wed, 19 Oct 2022 17:01:18 +0000 Subject: [PATCH 382/998] Add Codec2 AIDL interface Bug: 251850069 Test: m Change-Id: I1fc28084519281df68bca7ae5e2b814b03214577 --- .../compatibility_matrix.current.xml | 9 + media/c2/aidl/Android.bp | 29 ++ .../android/hardware/media/c2/BaseBlock.aidl | 39 +++ .../android/hardware/media/c2/Block.aidl | 40 +++ .../android/hardware/media/c2/Buffer.aidl | 39 +++ .../hardware/media/c2/FieldDescriptor.aidl | 62 ++++ .../android/hardware/media/c2/FieldId.aidl | 39 +++ .../media/c2/FieldSupportedValues.aidl | 41 +++ .../media/c2/FieldSupportedValuesQuery.aidl | 44 +++ .../c2/FieldSupportedValuesQueryResult.aidl | 39 +++ .../android/hardware/media/c2/FrameData.aidl | 47 +++ .../android/hardware/media/c2/IComponent.aidl | 53 +++ .../media/c2/IComponentInterface.aidl | 38 +++ .../hardware/media/c2/IComponentListener.aidl | 53 +++ .../hardware/media/c2/IComponentStore.aidl | 66 ++++ .../hardware/media/c2/IConfigurable.aidl | 48 +++ .../android/hardware/media/c2/InfoBuffer.aidl | 39 +++ .../hardware/media/c2/ParamDescriptor.aidl | 48 +++ .../android/hardware/media/c2/ParamField.aidl | 39 +++ .../hardware/media/c2/ParamFieldValues.aidl | 39 +++ .../android/hardware/media/c2/Params.aidl | 38 +++ .../hardware/media/c2/SettingResult.aidl | 53 +++ .../android/hardware/media/c2/Status.aidl | 52 +++ .../hardware/media/c2/StructDescriptor.aidl | 39 +++ .../hardware/media/c2/SurfaceSyncObj.aidl | 41 +++ .../android/hardware/media/c2/ValueRange.aidl | 42 +++ .../android/hardware/media/c2/Work.aidl | 42 +++ .../android/hardware/media/c2/WorkBundle.aidl | 39 +++ .../hardware/media/c2/WorkOrdinal.aidl | 40 +++ .../android/hardware/media/c2/Worklet.aidl | 41 +++ .../android/hardware/media/c2/BaseBlock.aidl | 38 +++ .../aidl/android/hardware/media/c2/Block.aidl | 44 +++ .../android/hardware/media/c2/Buffer.aidl | 37 +++ .../hardware/media/c2/FieldDescriptor.aidl | 103 ++++++ .../android/hardware/media/c2/FieldId.aidl | 35 ++ .../media/c2/FieldSupportedValues.aidl | 54 ++++ .../media/c2/FieldSupportedValuesQuery.aidl | 47 +++ .../c2/FieldSupportedValuesQueryResult.aidl | 44 +++ .../android/hardware/media/c2/FrameData.aidl | 97 ++++++ .../android/hardware/media/c2/IComponent.aidl | 304 ++++++++++++++++++ .../media/c2/IComponentInterface.aidl | 38 +++ .../hardware/media/c2/IComponentListener.aidl | 131 ++++++++ .../hardware/media/c2/IComponentStore.aidl | 185 +++++++++++ .../hardware/media/c2/IConfigurable.aidl | 213 ++++++++++++ .../android/hardware/media/c2/InfoBuffer.aidl | 36 +++ .../hardware/media/c2/ParamDescriptor.aidl | 73 +++++ .../android/hardware/media/c2/ParamField.aidl | 34 ++ .../hardware/media/c2/ParamFieldValues.aidl | 43 +++ .../android/hardware/media/c2/Params.aidl | 36 +++ .../hardware/media/c2/SettingResult.aidl | 99 ++++++ .../android/hardware/media/c2/Status.aidl | 82 +++++ .../hardware/media/c2/StructDescriptor.aidl | 48 +++ .../hardware/media/c2/SurfaceSyncObj.aidl | 55 ++++ .../android/hardware/media/c2/ValueRange.aidl | 63 ++++ .../aidl/android/hardware/media/c2/Work.aidl | 83 +++++ .../android/hardware/media/c2/WorkBundle.aidl | 48 +++ .../hardware/media/c2/WorkOrdinal.aidl | 48 +++ .../android/hardware/media/c2/Worklet.aidl | 54 ++++ 58 files changed, 3450 insertions(+) create mode 100644 media/c2/aidl/Android.bp create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/BaseBlock.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Block.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Buffer.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldDescriptor.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldId.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValues.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQuery.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FrameData.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentInterface.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentListener.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentStore.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IConfigurable.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/InfoBuffer.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamDescriptor.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamField.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamFieldValues.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Params.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SettingResult.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Status.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/StructDescriptor.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SurfaceSyncObj.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ValueRange.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Work.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkBundle.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkOrdinal.aidl create mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Worklet.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/BaseBlock.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/Block.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/Buffer.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/FieldDescriptor.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/FieldId.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/FieldSupportedValues.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQuery.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/FrameData.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/IComponent.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/IComponentInterface.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/IComponentListener.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/IComponentStore.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/IConfigurable.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/InfoBuffer.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/ParamDescriptor.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/ParamField.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/ParamFieldValues.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/Params.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/SettingResult.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/Status.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/StructDescriptor.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/SurfaceSyncObj.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/ValueRange.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/Work.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/WorkBundle.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/WorkOrdinal.aidl create mode 100644 media/c2/aidl/android/hardware/media/c2/Worklet.aidl diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index e4fd65e912..b3832c647c 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -391,6 +391,15 @@ vendor[0-9]*_software
+ + android.hardware.media.c2 + 1 + + IComponentStore + default[0-9]* + vendor[0-9]*_software + + android.hardware.memtrack 1 diff --git a/media/c2/aidl/Android.bp b/media/c2/aidl/Android.bp new file mode 100644 index 0000000000..10867c047e --- /dev/null +++ b/media/c2/aidl/Android.bp @@ -0,0 +1,29 @@ +// This is the expected build file, but it may not be right in all cases + +aidl_interface { + name: "android.hardware.media.c2", + vendor_available: true, + srcs: ["android/hardware/media/c2/*.aidl"], + include_dirs: [ + "frameworks/native/aidl/gui", + ], + imports: [ + "android.hardware.common-V2", + "android.hardware.media.bufferpool2-V1", + ], + stability: "vintf", + backend: { + cpp: { + enabled: false, + }, + java: { + enabled: false, + }, + ndk: { + enabled: true, + additional_shared_libraries: [ + "libnativewindow", + ], + }, + }, +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/BaseBlock.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/BaseBlock.aidl new file mode 100644 index 0000000000..460ff97522 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/BaseBlock.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +union BaseBlock { + android.hardware.common.NativeHandle nativeBlock; + android.hardware.media.bufferpool2.BufferStatusMessage pooledBlock; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Block.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Block.aidl new file mode 100644 index 0000000000..7b3005e22d --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Block.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +parcelable Block { + int index; + android.hardware.media.c2.Params meta; + android.hardware.common.NativeHandle fence; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Buffer.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Buffer.aidl new file mode 100644 index 0000000000..b632932cec --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Buffer.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +parcelable Buffer { + android.hardware.media.c2.Params info; + android.hardware.media.c2.Block[] blocks; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldDescriptor.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldDescriptor.aidl new file mode 100644 index 0000000000..d0e4cbf069 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldDescriptor.aidl @@ -0,0 +1,62 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +parcelable FieldDescriptor { + android.hardware.media.c2.FieldId fieldId; + android.hardware.media.c2.FieldDescriptor.Type type; + int structIndex; + int extent; + String name; + android.hardware.media.c2.FieldDescriptor.NamedValue[] namedValues; + @Backing(type="int") @VintfStability + enum Type { + NO_INIT = 0, + INT32 = 1, + UINT32 = 2, + CNTR32 = 3, + INT64 = 4, + UINT64 = 5, + CNTR64 = 6, + FLOAT = 7, + STRING = 256, + BLOB = 257, + STRUCT = 131072, + } + @VintfStability + parcelable NamedValue { + String name; + long value; + } +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldId.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldId.aidl new file mode 100644 index 0000000000..935b85dbbf --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldId.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +parcelable FieldId { + int offset; + int sizeBytes; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValues.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValues.aidl new file mode 100644 index 0000000000..69060bea1d --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValues.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +union FieldSupportedValues { + boolean empty; + android.hardware.media.c2.ValueRange range; + long[] values; + long[] flags; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQuery.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQuery.aidl new file mode 100644 index 0000000000..22f7c8491b --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQuery.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +parcelable FieldSupportedValuesQuery { + android.hardware.media.c2.ParamField field; + android.hardware.media.c2.FieldSupportedValuesQuery.Type type; + @Backing(type="int") @VintfStability + enum Type { + POSSIBLE = 0, + CURRENT = 1, + } +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl new file mode 100644 index 0000000000..187e3ebfeb --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +parcelable FieldSupportedValuesQueryResult { + android.hardware.media.c2.Status status; + android.hardware.media.c2.FieldSupportedValues values; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FrameData.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FrameData.aidl new file mode 100644 index 0000000000..e73b05e95e --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FrameData.aidl @@ -0,0 +1,47 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +parcelable FrameData { + int flags; + android.hardware.media.c2.WorkOrdinal ordinal; + android.hardware.media.c2.Buffer[] buffers; + android.hardware.media.c2.Params configUpdate; + android.hardware.media.c2.InfoBuffer[] infoBuffers; + const int DROP_FRAME = 1; + const int END_OF_STREAM = 2; + const int DISCARD_FRAME = 4; + const int FLAG_INCOMPLETE = 8; + const int CODEC_CONFIG = -2147483648; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl new file mode 100644 index 0000000000..7ed09afae7 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl @@ -0,0 +1,53 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +interface IComponent { + android.hardware.common.NativeHandle configureVideoTunnel(in int avSyncHwId); + android.hardware.media.c2.IComponent.BlockPool createBlockPool(in int allocatorId); + void destroyBlockPool(in long blockPoolId); + void drain(in boolean withEos); + android.hardware.media.c2.WorkBundle flush(); + android.hardware.media.c2.IComponentInterface getInterface(); + void queue(in android.hardware.media.c2.WorkBundle workBundle); + void release(); + void reset(); + void setOutputSurface(in long blockPoolId, in android.view.Surface surface, in android.hardware.media.c2.SurfaceSyncObj syncObject); + void start(); + void stop(); + parcelable BlockPool { + long blockPoolId; + android.hardware.media.c2.IConfigurable configurable; + } +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentInterface.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentInterface.aidl new file mode 100644 index 0000000000..2350daeec2 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentInterface.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +interface IComponentInterface { + android.hardware.media.c2.IConfigurable getConfigurable(); +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentListener.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentListener.aidl new file mode 100644 index 0000000000..f6f2a6391c --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentListener.aidl @@ -0,0 +1,53 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +interface IComponentListener { + oneway void onError(in android.hardware.media.c2.Status status, in int errorCode); + oneway void onFramesRendered(in android.hardware.media.c2.IComponentListener.RenderedFrame[] renderedFrames); + oneway void onInputBuffersReleased(in android.hardware.media.c2.IComponentListener.InputBuffer[] inputBuffers); + oneway void onTripped(in android.hardware.media.c2.SettingResult[] settingResults); + oneway void onWorkDone(in android.hardware.media.c2.WorkBundle workBundle); + @VintfStability + parcelable InputBuffer { + long frameIndex; + int arrayIndex; + } + @VintfStability + parcelable RenderedFrame { + long bufferQueueId; + int slotId; + long timestampNs; + } +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentStore.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentStore.aidl new file mode 100644 index 0000000000..35532be3a2 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentStore.aidl @@ -0,0 +1,66 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +interface IComponentStore { + void copyBuffer(in android.hardware.media.c2.Buffer src, in android.hardware.media.c2.Buffer dst); + android.hardware.media.c2.IComponent createComponent(in String name, in android.hardware.media.c2.IComponentListener listener, in android.hardware.media.bufferpool2.IClientManager pool); + android.hardware.media.c2.IComponentInterface createInterface(in String name); + android.hardware.media.c2.IConfigurable getConfigurable(); + android.hardware.media.bufferpool2.IClientManager getPoolClientManager(); + android.hardware.media.c2.StructDescriptor[] getStructDescriptors(in int[] indices); + android.hardware.media.c2.IComponentStore.ComponentTraits[] listComponents(); + @VintfStability + parcelable ComponentTraits { + String name; + android.hardware.media.c2.IComponentStore.ComponentTraits.Domain domain; + android.hardware.media.c2.IComponentStore.ComponentTraits.Kind kind; + int rank; + String mediaType; + String[] aliases; + @Backing(type="int") @VintfStability + enum Kind { + OTHER = 0, + DECODER = 1, + ENCODER = 2, + } + @Backing(type="int") @VintfStability + enum Domain { + OTHER = 0, + VIDEO = 1, + AUDIO = 2, + IMAGE = 3, + } + } +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IConfigurable.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IConfigurable.aidl new file mode 100644 index 0000000000..32f5abdb51 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IConfigurable.aidl @@ -0,0 +1,48 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +interface IConfigurable { + android.hardware.media.c2.IConfigurable.ConfigResult config(in android.hardware.media.c2.Params inParams, in boolean mayBlock); + int getId(); + String getName(); + android.hardware.media.c2.Params query(in int[] indices, in boolean mayBlock); + android.hardware.media.c2.ParamDescriptor[] querySupportedParams(in int start, in int count); + android.hardware.media.c2.FieldSupportedValuesQueryResult[] querySupportedValues(in android.hardware.media.c2.FieldSupportedValuesQuery[] inFields, in boolean mayBlock); + @VintfStability + parcelable ConfigResult { + android.hardware.media.c2.Params params; + android.hardware.media.c2.SettingResult[] failures; + } +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/InfoBuffer.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/InfoBuffer.aidl new file mode 100644 index 0000000000..94cd77d925 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/InfoBuffer.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +parcelable InfoBuffer { + int index; + android.hardware.media.c2.Buffer buffer; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamDescriptor.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamDescriptor.aidl new file mode 100644 index 0000000000..04c869c066 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamDescriptor.aidl @@ -0,0 +1,48 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +parcelable ParamDescriptor { + int index; + int attrib; + String name; + int[] dependencies; + const int ATTRIBUTE_REQUIRED = 1; + const int ATTRIBUTE_PERSISTENT = 2; + const int ATTRIBUTE_STRICT = 4; + const int ATTRIBUTE_READ_ONLY = 8; + const int ATTRIBUTE_HIDDEN = 16; + const int ATTRIBUTE_INTERNAL = 32; + const int ATTRIBUTE_CONST = 64; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamField.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamField.aidl new file mode 100644 index 0000000000..13d252257e --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamField.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +parcelable ParamField { + int index; + android.hardware.media.c2.FieldId fieldId; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamFieldValues.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamFieldValues.aidl new file mode 100644 index 0000000000..5a2821cdb2 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamFieldValues.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +parcelable ParamFieldValues { + android.hardware.media.c2.ParamField paramOrField; + android.hardware.media.c2.FieldSupportedValues[] values; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Params.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Params.aidl new file mode 100644 index 0000000000..7d363c06b3 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Params.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +parcelable Params { + byte[] params; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SettingResult.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SettingResult.aidl new file mode 100644 index 0000000000..f9e6a93b24 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SettingResult.aidl @@ -0,0 +1,53 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +parcelable SettingResult { + android.hardware.media.c2.SettingResult.Failure failure; + android.hardware.media.c2.ParamFieldValues field; + android.hardware.media.c2.ParamFieldValues[] conflicts; + @Backing(type="int") @VintfStability + enum Failure { + BAD_TYPE = 0, + BAD_PORT = 1, + BAD_INDEX = 2, + READ_ONLY = 3, + MISMATCH = 4, + BAD_VALUE = 5, + CONFLICT = 6, + UNSUPPORTED = 7, + INFO_BAD_VALUE = 8, + INFO_CONFLICT = 9, + } +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Status.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Status.aidl new file mode 100644 index 0000000000..ad07677aca --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Status.aidl @@ -0,0 +1,52 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +parcelable Status { + int status; + const int OK = 0; + const int BAD_VALUE = -22; + const int BAD_INDEX = -75; + const int CANNOT_DO = -2147483646; + const int DUPLICATE = -17; + const int NOT_FOUND = -2; + const int BAD_STATE = -38; + const int BLOCKING = -9930; + const int NO_MEMORY = -12; + const int REFUSED = -1; + const int TIMED_OUT = -110; + const int OMITTED = -74; + const int CORRUPTED = -2147483648; + const int NO_INIT = -19; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/StructDescriptor.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/StructDescriptor.aidl new file mode 100644 index 0000000000..58268e0b92 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/StructDescriptor.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +parcelable StructDescriptor { + int type; + android.hardware.media.c2.FieldDescriptor[] fields; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SurfaceSyncObj.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SurfaceSyncObj.aidl new file mode 100644 index 0000000000..1c9bf8d989 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SurfaceSyncObj.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +parcelable SurfaceSyncObj { + android.hardware.common.NativeHandle syncMemory; + long bqId; + int generationId; + long consumerUsage; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ValueRange.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ValueRange.aidl new file mode 100644 index 0000000000..db71ce044e --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ValueRange.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +parcelable ValueRange { + long min; + long max; + long step; + long num; + long denom; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Work.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Work.aidl new file mode 100644 index 0000000000..a5343488f5 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Work.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +parcelable Work { + byte[] chainInfo; + android.hardware.media.c2.FrameData input; + android.hardware.media.c2.Worklet[] worklets; + int workletsProcessed; + android.hardware.media.c2.Status result; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkBundle.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkBundle.aidl new file mode 100644 index 0000000000..84708a8556 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkBundle.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +parcelable WorkBundle { + android.hardware.media.c2.Work[] works; + android.hardware.media.c2.BaseBlock[] baseBlocks; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkOrdinal.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkOrdinal.aidl new file mode 100644 index 0000000000..2833df3a79 --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkOrdinal.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +parcelable WorkOrdinal { + long timestampUs; + long frameIndex; + long customOrdinal; +} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Worklet.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Worklet.aidl new file mode 100644 index 0000000000..a79abf202b --- /dev/null +++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Worklet.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.c2; +@VintfStability +parcelable Worklet { + int componentId; + byte[] tunings; + android.hardware.media.c2.SettingResult[] failures; + android.hardware.media.c2.FrameData output; +} diff --git a/media/c2/aidl/android/hardware/media/c2/BaseBlock.aidl b/media/c2/aidl/android/hardware/media/c2/BaseBlock.aidl new file mode 100644 index 0000000000..8b8b8e0e46 --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/BaseBlock.aidl @@ -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. + */ + +package android.hardware.media.c2; + +import android.hardware.common.NativeHandle; + +/** + * Storage type for `BaseBlock`. + * + * A `BaseBlock` is a representation of a codec memory block. Coded data, + * decoded data, codec-specific data, and other codec-related data are all sent + * in the form of BaseBlocks. + */ +@VintfStability +union BaseBlock { + /** + * #nativeBlock is the opaque representation of a buffer. + */ + NativeHandle nativeBlock; + /** + * #pooledBlock is a reference to a buffer handled by a BufferPool. + */ + android.hardware.media.bufferpool2.BufferStatusMessage pooledBlock; +} diff --git a/media/c2/aidl/android/hardware/media/c2/Block.aidl b/media/c2/aidl/android/hardware/media/c2/Block.aidl new file mode 100644 index 0000000000..34aa7b173f --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/Block.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +import android.hardware.common.NativeHandle; +import android.hardware.media.c2.Params; + +/** + * Reference to a @ref BaseBlock within a @ref WorkBundle. + * + * `Block` contains additional attributes that `BaseBlock` does not. These + * attributes may differ among `Block` objects that refer to the same + * `BaseBlock` in the same `WorkBundle`. + */ +@VintfStability +parcelable Block { + /** + * Identity of a `BaseBlock` within a `WorkBundle`. This is an index into + * #WorkBundle.baseBlocks. + */ + int index; + /** + * Metadata associated with this `Block`. + */ + Params meta; + /** + * Fence for synchronizing `Block` access. + */ + NativeHandle fence; +} diff --git a/media/c2/aidl/android/hardware/media/c2/Buffer.aidl b/media/c2/aidl/android/hardware/media/c2/Buffer.aidl new file mode 100644 index 0000000000..d2dcf2dfe0 --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/Buffer.aidl @@ -0,0 +1,37 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +import android.hardware.media.c2.Block; +import android.hardware.media.c2.Params; + +/** + * A codec buffer, which is a collection of @ref Block objects and metadata. + * + * This is a part of @ref FrameData. + */ +@VintfStability +parcelable Buffer { + /** + * Metadata associated with the buffer. + */ + Params info; + /** + * Blocks contained in the buffer. + */ + Block[] blocks; +} diff --git a/media/c2/aidl/android/hardware/media/c2/FieldDescriptor.aidl b/media/c2/aidl/android/hardware/media/c2/FieldDescriptor.aidl new file mode 100644 index 0000000000..a2774ec72e --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/FieldDescriptor.aidl @@ -0,0 +1,103 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +import android.hardware.media.c2.FieldId; + +/** + * Description of a field inside a C2Param structure. + */ +@VintfStability +parcelable FieldDescriptor { + /** + * Possible types of the field. + */ + @VintfStability + @Backing(type="int") + enum Type { + NO_INIT = 0, + INT32, + UINT32, + CNTR32, + INT64, + UINT64, + CNTR64, + FLOAT, + /** + * Fixed-size string (POD). + */ + STRING = 0x100, + /** + * A blob has no sub-elements and can be thought of as an array of + * bytes. However, bytes cannot be individually addressed by clients. + */ + BLOB, + /** + * The field is a structure that may contain other fields. + */ + STRUCT = 0x20000, + } + /** + * Named value type. This is used for defining an enum value for a numeric + * type. + */ + @VintfStability + parcelable NamedValue { + /** + * Name of the enum value. This must be unique for each enum value in + * the same field. + */ + String name; + /** + * Underlying value of the enum value. Multiple enum names may have the + * same underlying value. + */ + long value; + } + /** + * Location of the field in the C2Param structure + */ + FieldId fieldId; + /** + * Type of the field. + */ + Type type; + /** + * If #type is #Type.STRUCT, #structIndex is the C2Param structure index; + * otherwise, #structIndex is not used. + */ + int structIndex; + /** + * Extent of the field. + * - For a non-array field, #extent is 1. + * - For a fixed-length array field, #extent is the length. An array field + * of length 1 is indistinguishable from a non-array field. + * - For a variable-length array field, #extent is 0. This can only occur as + * the last member of a C2Param structure. + */ + int extent; + /** + * Name of the field. This must be unique for each field in the same + * structure. + */ + String name; + /** + * List of enum values. This is not used when #type is not one of the + * numeric types. + */ + NamedValue[] namedValues; +} diff --git a/media/c2/aidl/android/hardware/media/c2/FieldId.aidl b/media/c2/aidl/android/hardware/media/c2/FieldId.aidl new file mode 100644 index 0000000000..68bf058962 --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/FieldId.aidl @@ -0,0 +1,35 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +/** + * Identifying information of a field relative to a known C2Param structure. + * + * Within a given C2Param structure, each field is uniquely identified by @ref + * FieldId. + */ +@VintfStability +parcelable FieldId { + /** + * Offset of the field in bytes. + */ + int offset; + /** + * Size of the field in bytes. + */ + int sizeBytes; +} diff --git a/media/c2/aidl/android/hardware/media/c2/FieldSupportedValues.aidl b/media/c2/aidl/android/hardware/media/c2/FieldSupportedValues.aidl new file mode 100644 index 0000000000..6c2033b5d8 --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/FieldSupportedValues.aidl @@ -0,0 +1,54 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +import android.hardware.media.c2.ValueRange; + +/* + * Description of supported values for a field of C2Param. + * + * This can be a continuous range or a discrete set of values. + * + * The intended type of values must be made clear in the context where + * `FieldSupportedValues` is used. + */ +@VintfStability +union FieldSupportedValues { + /** + * No supported values + */ + boolean empty; + /** + * Numeric range, described in a #ValueRange structure + */ + ValueRange range; + /** + * List of values + */ + long[] values; + /** + * List of flags that can be OR-ed. + * + * The list contains { min-mask, flag1, flag2... }. Basically, the first + * value is the required set of flags to be set, and the rest of the values are flags that can + * be set independently. FLAGS is only supported for integral types. Supported flags should + * not overlap, as it can make validation non-deterministic. The standard validation method + * is that starting from the original value, if each flag is removed when fully present (the + * min-mask must be fully present), we shall arrive at 0. + */ + long[] flags; +} diff --git a/media/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQuery.aidl b/media/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQuery.aidl new file mode 100644 index 0000000000..bdaaef6b73 --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQuery.aidl @@ -0,0 +1,47 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +import android.hardware.media.c2.ParamField; + +/** + * Query information for supported values of a field. This is used as input to + * IConfigurable::querySupportedValues(). + */ +@VintfStability +parcelable FieldSupportedValuesQuery { + @VintfStability + @Backing(type="int") + enum Type { + /** + * Query all possible values regardless of other settings. + */ + POSSIBLE = 0, + /** + * Query currently possible values given dependent settings. + */ + CURRENT, + } + /** + * Identity of the field to query. + */ + ParamField field; + /** + * Type of the query. See #Type for more information. + */ + Type type; +} diff --git a/media/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl b/media/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl new file mode 100644 index 0000000000..b5c28c6d1c --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +import android.hardware.media.c2.FieldSupportedValues; +import android.hardware.media.c2.Status; + +/** + * This structure is used to hold the result from + * IConfigurable::querySupportedValues(). + */ +@VintfStability +parcelable FieldSupportedValuesQueryResult { + /** + * Result of the query. Possible values are + * - `Status::OK`: The query was successful. + * - `Status::BAD_STATE`: The query was requested when the `IConfigurable` instance + * was in a bad state. + * - `Status::BAD_INDEX`: The requested field was not recognized. + * - `Status::TIMED_OUT`: The query could not be completed in a timely manner. + * - `Status::BLOCKING`: The query must block, but the parameter `mayBlock` in the + * call to `querySupportedValues()` was `false`. + * - `Status::CORRUPTED`: Some unknown error occurred. + */ + Status status; + /** + * Supported values. This is meaningful only when #status is `OK`. + */ + FieldSupportedValues values; +} diff --git a/media/c2/aidl/android/hardware/media/c2/FrameData.aidl b/media/c2/aidl/android/hardware/media/c2/FrameData.aidl new file mode 100644 index 0000000000..15c1b6d434 --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/FrameData.aidl @@ -0,0 +1,97 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +import android.hardware.media.c2.Buffer; +import android.hardware.media.c2.InfoBuffer; +import android.hardware.media.c2.Params; +import android.hardware.media.c2.WorkOrdinal; + +/** + * Data for an input frame or an output frame. + * + * This structure represents a @e frame with its metadata. A @e frame consists + * of an ordered set of buffers, configuration changes, and info buffers along + * with some non-configuration metadata. + * + * @note `FrameData` is the HIDL counterpart of `C2FrameData` in the Codec 2.0 + * standard. + */ +@VintfStability +parcelable FrameData { + /** List of frame flags */ + /** + * For input frames: no output frame shall be generated when processing + * this frame, but metadata must still be processed. + * + * For output frames: this frame must be discarded but metadata is still + * valid. + */ + const int DROP_FRAME = (1 << 0); + /** + * This frame is the last frame of the current stream. Further frames + * are part of a new stream. + */ + const int END_OF_STREAM = (1 << 1); + /** + * This frame must be discarded with its metadata. + * + * This flag is only set by components, e.g. as a response to the flush + * command. + */ + const int DISCARD_FRAME = (1 << 2); + /** + * This frame is not the last frame produced for the input. + * + * This flag is normally set by the component - e.g. when an input frame + * results in multiple output frames, this flag is set on all but the + * last output frame. + * + * Also, when components are chained, this flag should be propagated + * down the work chain. That is, if set on an earlier frame of a + * work-chain, it should be propagated to all later frames in that + * chain. Additionally, components down the chain could set this flag + * even if not set earlier, e.g. if multiple output frames are generated + * at that component for the input frame. + */ + const int FLAG_INCOMPLETE = (1 << 3); + /** + * This frame contains only codec-specific configuration data, and no + * actual access unit. + */ + const int CODEC_CONFIG = (1 << 31); + /** + * Frame flags, as described above. + */ + int flags; + /** + * @ref WorkOrdinal of the frame. + */ + WorkOrdinal ordinal; + /** + * List of frame buffers. + */ + Buffer[] buffers; + /** + * List of configuration updates. + */ + Params configUpdate; + /** + * List of info buffers. + */ + InfoBuffer[] infoBuffers; +} diff --git a/media/c2/aidl/android/hardware/media/c2/IComponent.aidl b/media/c2/aidl/android/hardware/media/c2/IComponent.aidl new file mode 100644 index 0000000000..b3390c3f4d --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/IComponent.aidl @@ -0,0 +1,304 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +import android.hardware.common.NativeHandle; +import android.view.Surface; + +import android.hardware.media.c2.IComponentInterface; +import android.hardware.media.c2.IConfigurable; +import android.hardware.media.c2.WorkBundle; +import android.hardware.media.c2.SurfaceSyncObj; + +/** + * Interface for an AIDL Codec2 component. + * Components have two states: stopped and running. The running state has three + * sub-states: executing, tripped and error. + * + * All methods in `IComponent` must not block. If a method call cannot be + * completed in a timely manner, it must throw `Status::TIMED_OUT`. + */ +@VintfStability +interface IComponent { + /** + * The reference object from framwork to HAL C2BlockPool. + * + * The object will be returned when C2BlockPool is created by a framework + * request. The object also can be destroyed using blockPoolId. + * Using configurable framework can query/config the object in HAL(IComponent). + */ + parcelable BlockPool { + long blockPoolId; + IConfigurable configurable; + } + /** + * Configures a component for a tunneled playback mode. + * + * A successful call to this method puts the component in the *tunneled* + * mode. In this mode, the output `Worklet`s returned in + * IComponentListener::onWorkDone() may not contain any buffers. The output + * buffers are passed directly to the consumer end of a buffer queue whose + * producer side is configured with the returned @p sidebandStream passed + * to IGraphicBufferProducer::setSidebandStream(). + * + * The component is initially in the non-tunneled mode by default. The + * tunneled mode can be toggled on only before the component starts + * processing. Once the component is put into the tunneled mode, it shall + * stay in the tunneled mode until and only until reset() is called. + * + * @param avSyncHwId A resource ID for hardware sync. The generator of sync + * IDs must ensure that this number is unique among all services at any + * given time. For example, if both the audio HAL and the tuner HAL + * support this feature, sync IDs from the audio HAL must not clash + * with sync IDs from the tuner HAL. + * @return Codec-allocated sideband stream NativeHandle. This can + * be passed to IGraphicBufferProducer::setSidebandStream() to + * establish a direct channel to the consumer. + * @throws ServiceSpecificException with one of the following values: + * - `Status::OMITTED` - The component does not support video tunneling. + * - `Status::BAD_STATE` - The component is already running. + * - `Status::TIMED_OUT` - The operation cannot be finished in a timely manner. + * - `Status::CORRUPTED` - Some unknown error occurred. + */ + NativeHandle configureVideoTunnel(in int avSyncHwId); + + /** + * Creates a local `C2BlockPool` backed by the given allocator and returns + * its id. + * + * The returned @p blockPoolId is the only way the client can refer to a + * `C2BlockPool` object in the component. The id can be passed to + * setOutputSurface() or used in some C2Param objects later. + * + * The created `C2BlockPool` object can be destroyed by calling + * destroyBlockPool(), reset() or release(). reset() and release() must + * destroy all `C2BlockPool` objects that have been created. + * + * @param allocatorId Id of a `C2Allocator`. + * @param out configurable Configuration interface for the created pool. This + * must not be null. + * @return Created block pool information. This could be used to config/query and + * also be used in setOutputSurface() if the allocator + * @throws ServiceSpecificException with one of the following values: + * - `Status::NO_MEMORY` - Not enough memory to create the pool. + * - `Status::BAD_VALUE` - @p allocatorId is not recognized. + * - `Status::TIMED_OUT` - The operation cannot be finished in a timely manner. + * - `Status::CORRUPTED` - Some unknown error occurred. + */ + BlockPool createBlockPool(in int allocatorId); + + /** + * Destroys a local block pool previously created by createBlockPool(). + * + * @param blockPoolId Id of a `C2BlockPool` that was previously returned by + * createBlockPool(). + * @throws ServiceSpecificException with one of the following values: + * - `Status::NOT_FOUND` - The supplied blockPoolId is not valid. + * - `Status::TIMED_OUT` - The operation cannot be finished in a timely manner. + * - `Status::CORRUPTED` - Some unknown error occurred. + */ + void destroyBlockPool(in long blockPoolId); + + /** + * Drains the component, and optionally downstream components. This is a + * signalling method; as such it does not wait for any work completion. + * + * The last `Work` item is marked as "drain-till-here", so the component is + * notified not to wait for further `Work` before it processes what is + * already queued. This method can also be used to set the end-of-stream + * flag after `Work` has been queued. Client can continue to queue further + * `Work` immediately after this method returns. + * + * This method must be supported in running (including tripped) states. + * + * `Work` that is completed must be returned via + * IComponentListener::onWorkDone(). + * + * @param withEos Whether to drain the component with marking end-of-stream. + * @throws ServiceSpecificException with one of the following values: + * - `Status::TIMED_OUT` - The operation cannot be finished in a timely manner. + * - `Status::CORRUPTED` - Some unknown error occurred. + */ + void drain(in boolean withEos); + + /** + * Discards and abandons any pending `Work` items for the component. + * + * This method must be supported in running (including tripped) states. + * + * `Work` that could be immediately abandoned/discarded must be returned in + * @p flushedWorkBundle. The order in which queued `Work` items are + * discarded can be arbitrary. + * + * `Work` that could not be abandoned or discarded immediately must be + * marked to be discarded at the earliest opportunity, and must be returned + * via IComponentListener::onWorkDone(). This must be completed within + * 500ms. + * + * @return `WorkBundle` object containing flushed `Work` items. + * @throws ServiceSpecificException with one of the following values: + * - `Status::TIMED_OUT` - The operation cannot be finished in a timely manner. + * - `Status::CORRUPTED` - Some unknown error occurred. + */ + WorkBundle flush(); + + /** + * Returns the @ref IComponentInterface instance associated to this + * component. + * + * An @ref IConfigurable instance for the component can be obtained by calling + * IComponentInterface::getConfigurable() on the returned @p intf. + * + * @return `IComponentInterface` instance. This must not be null. + */ + IComponentInterface getInterface(); + + /** + * Queues up work for the component. + * + * This method must be supported in running (including tripped) states. + * + * It is acceptable for this method to return `OK` and return an error value + * using the IComponentListener::onWorkDone() callback. + * + * @param workBundle `WorkBundle` object containing a list of `Work` objects + * to queue to the component. + * @throws ServiceSpecificException with one of the following values: + * - `Status::BAD_INDEX` - Some component id in some `Worklet` is not valid. + * - `Status::CANNOT_DO` - The components are not tunneled but some `Work` object + * contains tunneling information. + * - `Status::NO_MEMORY` - Not enough memory to queue @p workBundle. + * - `Status::TIMED_OUT` - The operation cannot be finished in a timely manner. + * - `Status::CORRUPTED` - Some unknown error occurred. + */ + void queue(in WorkBundle workBundle); + + /** + * Releases the component. + * + * This method must be supported in stopped state. + * + * This method destroys the component. Upon return, if @p status is `OK` or + * `DUPLICATE`, all resources must have been released. + * + * @throws ServiceSpecificException with one of the following values: + * - `Status::BAD_STATE` - The component is running. + * - `Status::DUPLICATE` - The component is already released. + * - `Status::TIMED_OUT` - The operation cannot be finished in a timely manner. + * - `Status::CORRUPTED` - Some unknown error occurred. + */ + void release(); + + /** + * Resets the component. + * + * This method must be supported in all (including tripped) states other + * than released. + * + * This method must be supported during any other blocking call. + * + * This method must return within 500ms. + * + * When this call returns, if @p status is `OK`, all `Work` items must + * have been abandoned, and all resources (including `C2BlockPool` objects + * previously created by createBlockPool()) must have been released. + * + * If the return value is `BAD_STATE` or `DUPLICATE`, no state change is + * expected as a response to this call. For all other return values, the + * component must be in the stopped state. + * + * This brings settings back to their default, "guaranteeing" no tripped + * state. + * + * @throws ServiceSpecificException with one of the following values: + * - `Status::BAD_STATE` - Component is in released state. + * - `Status::DUPLICATE` - When called during another reset call from another + * thread. + * - `Status::TIMED_OUT` - The operation cannot be finished in a timely manner. + * - `Status::CORRUPTED` - Some unknown error occurred. + */ + void reset(); + + /** + * Starts using a surface for output with a synchronization object + * + * This method must not block. + * + * @param blockPoolId Id of the `C2BlockPool` to be associated with the + * output surface. + * @param surface Output surface. + * @param syncObject synchronization object for buffer allocation between + * Framework and Component. + * @throws ServiceSpecificException with one of the following values: + * - `Status::CANNOT_DO` - The component does not support an output surface. + * - `Status::REFUSED` - The output surface cannot be accessed. + * - `Status::TIMED_OUT` - The operation cannot be finished in a timely manner. + * - `Status::CORRUPTED` - Some unknown error occurred. + */ + void setOutputSurface(in long blockPoolId, in Surface surface, + in SurfaceSyncObj syncObject); + + /** + * Starts the component. + * + * This method must be supported in stopped state as well as tripped state. + * + * If the return value is `OK`, the component must be in the running state. + * If the return value is `BAD_STATE` or `DUPLICATE`, no state change is + * expected as a response to this call. Otherwise, the component must be in + * the stopped state. + * + * If a component is in the tripped state and start() is called while the + * component configuration still results in a trip, start() must succeed and + * a new onTripped() callback must be used to communicate the configuration + * conflict that results in the new trip. + * + * @throws ServiceSpecificException with one of the following values: + * - `Status::BAD_STATE` - Component is not in stopped or tripped state. + * - `Status::DUPLICATE` - When called during another start call from another + * thread. + * - `Status::NO_MEMORY` - Not enough memory to start the component. + * - `Status::TIMED_OUT` - The operation cannot be finished in a timely manner. + * - `Status::CORRUPTED` - Some unknown error occurred. + */ + void start(); + + /** + * Stops the component. + * + * This method must be supported in running (including tripped) state. + * + * This method must return within 500ms. + * + * Upon this call, all pending `Work` must be abandoned. + * + * If the return value is `BAD_STATE` or `DUPLICATE`, no state change is + * expected as a response to this call. For all other return values, the + * component must be in the stopped state. + * + * This does not alter any settings and tunings that may have resulted in a + * tripped state. + * + * @throws ServiceSpecificException with one of the following values: + * - `Status::BAD_STATE` - Component is not in running state. + * - `Status::DUPLICATE` - When called during another stop call from another + * thread. + * - `Status::TIMED_OUT` - The operation cannot be finished in a timely manner. + * - `Status::CORRUPTED` - Some unknown error occurred. + */ + void stop(); +} diff --git a/media/c2/aidl/android/hardware/media/c2/IComponentInterface.aidl b/media/c2/aidl/android/hardware/media/c2/IComponentInterface.aidl new file mode 100644 index 0000000000..9db81e6139 --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/IComponentInterface.aidl @@ -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. + */ + +package android.hardware.media.c2; + +import android.hardware.media.c2.IConfigurable; + +/** + * Component interface object. This object contains all of the configurations of + * a potential or actual component. It can be created and used independently of + * an actual Codec2 component to query supported parameters for various + * component settings, and configurations for a potential component. + * + * An actual component exposes this interface via IComponent::getInterface(). + */ +@VintfStability +interface IComponentInterface { + /** + * Returns the @ref IConfigurable instance associated to this component + * interface. + * + * @return `IConfigurable` instance. This must not be null. + */ + IConfigurable getConfigurable(); +} diff --git a/media/c2/aidl/android/hardware/media/c2/IComponentListener.aidl b/media/c2/aidl/android/hardware/media/c2/IComponentListener.aidl new file mode 100644 index 0000000000..75500b7271 --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/IComponentListener.aidl @@ -0,0 +1,131 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +import android.hardware.media.c2.SettingResult; +import android.hardware.media.c2.Status; +import android.hardware.media.c2.WorkBundle; + +/** + * Callback interface for handling notifications from @ref IComponent. + */ +@VintfStability +oneway interface IComponentListener { + /** + * Identifying information for an input buffer previously queued to the + * component via IComponent::queue(). + */ + @VintfStability + parcelable InputBuffer { + /** + * This value comes from `Work::input.ordinal.frameIndex` in a `Work` + * object that was previously queued. + */ + long frameIndex; + /** + * This value is an index into `Work::input.buffers` (which is an array) + * in a `Work` object that was previously queued. + */ + int arrayIndex; + } + /** + * Information about rendering of a frame to a `Surface`. + */ + @VintfStability + parcelable RenderedFrame { + /** + * Id of the `BufferQueue` containing the rendered buffer. + * + * This value must have been obtained by an earlier call to + * IGraphicBufferProducer::getUniqueId(). + */ + long bufferQueueId; + /** + * Id of the slot of the rendered buffer. + * + * This value must have been obtained by an earlier call to + * IGraphicBufferProducer::dequeueBuffer() or + * IGraphicBufferProducer::attachBuffer(). + */ + int slotId; + /** + * Timestamp the rendering happened. + * + * The reference point for the timestamp is determined by the + * `BufferQueue` that performed the rendering. + */ + long timestampNs; + } + /** + * Notify the listener of an error. + * + * @param status Error type. @p status may be `OK`, which means that an + * error has occurred, but the error type does not fit into the type + * `Status`. In this case, additional information is provided by + * @p errorCode. + * @param errorCode Additional error information. The framework may not + * recognize the meaning of this value. + */ + void onError(in Status status, in int errorCode); + + /** + * Notify the listener that frames have been rendered. + * + * @param renderedFrames List of @ref RenderedFrame objects. + */ + void onFramesRendered(in RenderedFrame[] renderedFrames); + + /** + * Notify the listener that some input buffers are no longer needed by the + * component, and hence can be released or reused by the client. + * + * Input buffers that are contained in a `Work` object returned by an + * earlier onWorkDone() call are assumed released, so they must not appear + * in any onInputBuffersReleased() calls. That means + * onInputBuffersReleased() must only report input buffers that are released + * before the output in the same `Work` item is produced. However, it is + * possible for an input buffer to be returned by onWorkDone() after it has + * been reported by onInputBuffersReleased(). + * + * @note onWorkDone() and onInputBuffersReleased() both notify the client + * that input buffers are no longer needed. However, in order to minimize + * IPC calls, onInputBuffersReleased() should be called only when + * onWorkDone() cannot be called, e.g., the component needs more input + * before an output can be produced. + * + * @param inputBuffers List of `InputBuffer` objects, identifying input + * buffers that are no longer needed by the component. + */ + void onInputBuffersReleased(in InputBuffer[] inputBuffers); + + /** + * Notify the listener that the component is tripped. + * + * @param settingResults List of failures. + */ + void onTripped(in SettingResult[] settingResults); + + /** + * Notify the listener that some `Work` items have been completed. + * + * All the input buffers in the returned `Work` objects must not be used by + * the component after onWorkDone() is called. + * + * @param workBundle List of completed `Work` objects. + */ + void onWorkDone(in WorkBundle workBundle); +} diff --git a/media/c2/aidl/android/hardware/media/c2/IComponentStore.aidl b/media/c2/aidl/android/hardware/media/c2/IComponentStore.aidl new file mode 100644 index 0000000000..1435a7e4bc --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/IComponentStore.aidl @@ -0,0 +1,185 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +import android.hardware.media.c2.Buffer; +import android.hardware.media.c2.IComponent; +import android.hardware.media.c2.IComponentInterface; +import android.hardware.media.c2.IComponentListener; +import android.hardware.media.c2.IConfigurable; +import android.hardware.media.c2.StructDescriptor; + +/** + * Entry point for Codec2 HAL. + * + * All methods in `IComponentStore` must not block. If a method call cannot be + * completed in a timely manner, it must throw `Status::TIMED_OUT`. The only + * exceptions are getPoolClientManager() and getConfigurable(), which must + * always return immediately. + * + * @note This is an extension of version 1.1 of `IComponentStore`. The purpose + * of the extension is to add support for blocking output buffer allocator. + */ +@VintfStability +interface IComponentStore { + /** + * Component traits. + */ + @VintfStability + parcelable ComponentTraits { + @VintfStability + @Backing(type="int") + enum Kind { + OTHER = 0, + DECODER, + ENCODER, + } + @VintfStability + @Backing(type="int") + enum Domain { + OTHER = 0, + VIDEO, + AUDIO, + IMAGE, + } + /** + * Name of the component. This must be unique for each component. + * + * This name is use to identify the component to create in + * createComponent() and createComponentInterface(). + */ + String name; + /** + * Component domain. + */ + Domain domain; + /** + * Component kind. + */ + Kind kind; + /** + * Rank used by `MediaCodecList` to determine component ordering. Lower + * value means higher priority. + */ + int rank; + /** + * MIME type. + */ + String mediaType; + /** + * Aliases for component name for backward compatibility. + * + * Multiple components can have the same alias (but not the same + * component name) as long as their media types differ. + */ + String[] aliases; + } + + /** + * Copies the contents of @p src into @p dst without changing the format of + * @p dst. + * + * @param src Source buffer. + * @param dst Destination buffer. + * @throws ServiceSpecificException with one of the following values: + * - `Status::CANNOT_DO` - @p src and @p dst are not compatible. + * - `Status::REFUSED` - No permission to copy. + * - `Status::TIMED_OUT` - The operation cannot be finished in a timely manner. + * - `Status::CORRUPTED` - Some unknown error occurred. + */ + void copyBuffer(in Buffer src, in Buffer dst); + + /** + * Creates a component by name. + * + * @param name Name of the component to create. This must match one of the + * names returned by listComponents(). + * @param listener Callback receiver. + * @param pool `IClientManager` object of the BufferPool in the client + * process. This may be null if the client does not own a BufferPool. + * @return The created component. + * @throws ServiceSpecificException with one of the following values: + * - `Status::NOT_FOUND` - There is no component with the given name. + * - `Status::NO_MEMORY` - Not enough memory to create the component. + * - `Status::TIMED_OUT` - The operation cannot be finished in a timely manner. + * - `Status::CORRUPTED` - Some unknown error occurred. + * + * @sa IComponentListener. + */ + IComponent createComponent(in String name, in IComponentListener listener, + in android.hardware.media.bufferpool2.IClientManager pool); + + /** + * Creates a component interface by name. + * + * @param name Name of the component interface to create. This should match + * one of the names returned by listComponents(). + * @return The created component interface. + * @throws ServiceSpecificException with one of the following values: + * - `Status::NOT_FOUND` - There is no component interface with the given name. + * - `Status::NO_MEMORY` - Not enough memory to create the component interface. + * - `Status::TIMED_OUT` - The operation cannot be finished in a timely manner. + * - `Status::CORRUPTED` - Some unknown error occurred. + */ + IComponentInterface createInterface(in String name); + + /** + * Returns the @ref IConfigurable instance associated to this component + * store. + * + * @return `IConfigurable` instance. This must not be null. + */ + IConfigurable getConfigurable(); + + /** + * Returns the `IClientManager` object for the component's BufferPool. + * + * @return If the component store supports receiving buffers via + * BufferPool API, @p pool must be a valid `IClientManager` instance. + * Otherwise, @p pool must be null. + */ + android.hardware.media.bufferpool2.IClientManager getPoolClientManager(); + + /** + * Returns a list of `StructDescriptor` objects for a set of requested + * C2Param structure indices that this store is aware of. + * + * This operation must be performed at best effort, e.g. the component + * store must simply ignore all struct indices that it is not aware of. + * + * @param indices Indices of C2Param structures to describe. + * @return List of `StructDescriptor` objects. + * @throws ServiceSpecificException with one of the following values: + * - `Status::NOT_FOUND` - Some indices were not known. + * - `Status::NO_MEMORY` - Not enough memory to complete this method. + * - `Status::TIMED_OUT` - The operation cannot be finished in a timely manner. + * - `Status::CORRUPTED` - Some unknown error occurred. + */ + StructDescriptor[] getStructDescriptors(in int[] indices); + + /** + * Returns the list of components supported by this component store. + * + * @return traits List of component traits for all components supported by + * this store (in no particular order). + * @throws ServiceSpecificException with one of the following values: + * - `Status::NO_MEMORY` - Not enough memory to complete this method. + * - `Status::TIMED_OUT` - The operation cannot be finished in a timely manner. + * - `Status::CORRUPTED` - Some unknown error occurred. + */ + ComponentTraits[] listComponents(); +} diff --git a/media/c2/aidl/android/hardware/media/c2/IConfigurable.aidl b/media/c2/aidl/android/hardware/media/c2/IConfigurable.aidl new file mode 100644 index 0000000000..7fdb8259b8 --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/IConfigurable.aidl @@ -0,0 +1,213 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +import android.hardware.media.c2.FieldSupportedValuesQuery; +import android.hardware.media.c2.FieldSupportedValuesQueryResult; +import android.hardware.media.c2.ParamDescriptor; +import android.hardware.media.c2.Params; +import android.hardware.media.c2.SettingResult; + +/** + * Generic configuration interface presented by all configurable Codec2 objects. + * + * This interface must be supported in all states of the owning object, and must + * not change the state of the owning object. + */ +@VintfStability +interface IConfigurable { + /** + * Return parcelable for config() interface. + * + * This includes the successful config settings along with the failure reasons of + * the specified setting. + */ + @VintfStability + parcelable ConfigResult { + Params params; + SettingResult[] failures; + } + + /** + * Sets a set of parameters for the object. + * + * Tuning is performed at best effort: the object must update all supported + * configurations at best effort and skip unsupported parameters. Any errors + * are communicated in the return value along with the failures. + * + * A non-strict parameter update with an unsupported value shall cause an + * update to the closest supported value. A strict parameter update with an + * unsupported value shall be skipped and a failure shall be returned. + * + * If @p mayBlock is false, this method must not block. An update that + * requires blocking shall be skipped and a failure shall be returned. + * + * If @p mayBlock is true, an update may block, but the whole method call + * has to complete in a timely manner, or `Status::TIMED_OUT` is thrown. + * + * The final values for all parameters set are propagated back to the caller + * in @p params. + * + * \par For IComponent + * + * When the object type is @ref IComponent, this method must be supported in + * any state except released. + * + * The blocking behavior of this method differs among states: + * - In the stopped state, this must be non-blocking. @p mayBlock is + * ignored. (The method operates as if @p mayBlock was false.) + * - In any of the running states, this method may block momentarily if + * @p mayBlock is true. However, if the call cannot be completed in a + * timely manner, `Status::TIMED_OUT` is thrown. + * + * @note Parameter tuning @e does depend on the order of the tuning + * parameters, e.g., some parameter update may enable some subsequent + * parameter update. + * + * @param inParams Requested parameter updates. + * @param mayBlock Whether this call may block or not. + * @return result of config. Params in the result should be in same order + * with @p inParams. + * @throws ServiceSpecificException with one of the following values: + * - `Status::NO_MEMORY` - Some supported parameters could not be updated + * successfully because they contained unsupported values. + * These are returned in @p failures. + * - `Status::BLOCKING` - Setting some parameters requires blocking, but + * @p mayBlock is false. + * - `Status::TIMED_OUT` - The operation cannot be finished in a timely manner. + * - `Status::CORRUPTED` - Some unknown error occurred. + */ + ConfigResult config(in Params inParams, in boolean mayBlock); + + /** + * Returns the id of the object. This must be unique among all objects of + * the same type hosted by the same store. + * + * @return Id of the object. + */ + int getId(); + + /** + * Returns the name of the object. + * + * This must match the name that was supplied during the creation of the + * object. + * + * @return Name of the object. + */ + String getName(); + + /** + * Queries a set of parameters from the object. + * + * Querying is performed at best effort: the object must query all supported + * parameters and skip unsupported ones (which may include parameters that + * could not be allocated). + * + * If @p mayBlock is true, a query may block, but the whole method call + * has to complete in a timely manner, or `Status::TIMED_OUT` is thrown. + * + * If @p mayBlock is false, this method must not block(All parameter queries + * that require blocking must be skipped). Otherwise, this + * method is allowed to block for a certain period of time before completing + * the operation. If the operation is not completed in a timely manner, + * `Status::TIMED_OUT` is thrown. + * + * @note Since unsupported parameters will be skipped, the returned results + * does not have every settings from @p indices, but the result will preserve + * the original order from @p indices though unsupported settings are skipped. + * + * \par For IComponent + * + * When the object type is @ref IComponent, this method must be supported in + * any state except released. This call must not change the state nor the + * internal configuration of the component. + * + * The blocking behavior of this method differs among states: + * - In the stopped state, this must be non-blocking. @p mayBlock is + * ignored. (The method operates as if @p mayBlock was false.) + * - In any of the running states, this method may block momentarily if + * @p mayBlock is true. However, if the call cannot be completed in a + * timely manner, `Status::status` is thrown. + * + * @param indices List of C2Param structure indices to query. + * @param mayBlock Whether this call may block or not. + * @return Flattened representation of std::vector object. + * Unsupported settings are skipped in the results. The order in @p indices + * still be preserved except skipped settings. + * @throws ServiceSpecificException with one of the following values: + * - `Status::NO_MEMORY` - Could not allocate memory for a supported parameter. + * - `Status::BLOCKING` - Querying some parameters requires blocking, but + * @p mayBlock is false. + * - `Status::TIMED_OUT` - The operation cannot be finished in a timely manner. + * - `Status::CORRUPTED` - Some unknown error occurred. + */ + Params query(in int[] indices, in boolean mayBlock); + + /** + * Returns a list of supported parameters within a selected range of C2Param + * structure indices. + * + * @param start The first index of the selected range. + * @param count The length of the selected range. + * @return List of supported parameters in the selected range. This + * list may have fewer than @p count elements if some indices in the + * range are not supported. + * @throws ServiceSpecificException with one of the following values: + * - `Status::NO_MEMORY` - Not enough memory to complete this method. + * + */ + ParamDescriptor[] querySupportedParams(in int start, in int count); + + /** + * Retrieves the supported values for the queried fields. + * + * The object must process all fields queried even if some queries fail. + * + * If @p mayBlock is false, this method must not block. Otherwise, this + * method is allowed to block for a certain period of time before completing + * the operation. If the operation cannot be completed in a timely manner, + * `Status::TIMED_OUT` is thrown. + * + * \par For IComponent + * + * When the object type is @ref IComponent, this method must be supported in + * any state except released. + * + * The blocking behavior of this method differs among states: + * - In the stopped state, this must be non-blocking. @p mayBlock is + * ignored. (The method operates as if @p mayBlock was false.) + * - In any of the running states, this method may block momentarily if + * @p mayBlock is true. However, if the call cannot be completed in a + * timely manner, `Status::TIMED_OUT` is thrown. + * + * @param inFields List of field queries. + * @param mayBlock Whether this call may block or not. + * @return List of supported values and results for the + * supplied queries. + * @throws ServiceSpecificException with one of the following values: + * - `Status::BLOCKING` - Querying some parameters requires blocking, but + * @p mayBlock is false. + * - `Status::NO_MEMORY` - Not enough memory to complete this method. + * - `Status::BLOCKING` - Querying some fields requires blocking, but @p mayblock + * is false. + * - `Status::TIMED_OUT` - The operation cannot be finished in a timely manner. + * - `Status::CORRUPTED` - Some unknown error occurred. + */ + FieldSupportedValuesQueryResult[] querySupportedValues( + in FieldSupportedValuesQuery[] inFields, in boolean mayBlock); +} diff --git a/media/c2/aidl/android/hardware/media/c2/InfoBuffer.aidl b/media/c2/aidl/android/hardware/media/c2/InfoBuffer.aidl new file mode 100644 index 0000000000..207c4d0c1a --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/InfoBuffer.aidl @@ -0,0 +1,36 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +import android.hardware.media.c2.Buffer; + +/** + * An extension of @ref Buffer that also contains a C2Param structure index. + * + * This is a part of @ref FrameData. + */ +@VintfStability +parcelable InfoBuffer { + /** + * A C2Param structure index. + */ + int index; + /** + * Associated @ref Buffer object. + */ + Buffer buffer; +} diff --git a/media/c2/aidl/android/hardware/media/c2/ParamDescriptor.aidl b/media/c2/aidl/android/hardware/media/c2/ParamDescriptor.aidl new file mode 100644 index 0000000000..84c6acc7e4 --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/ParamDescriptor.aidl @@ -0,0 +1,73 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +/** + * Usage description of a C2Param structure. + * + * @ref ParamDescriptor is returned by IConfigurable::querySupportedParams(). + */ +@VintfStability +parcelable ParamDescriptor { + /** The list of bit flags for attrib */ + /** + * The parameter is required to be specified. + */ + const int ATTRIBUTE_REQUIRED = 1 << 0; + /** + * The parameter retains its value. + */ + const int ATTRIBUTE_PERSISTENT = 1 << 1; + /** + * The parameter is strict. + */ + const int ATTRIBUTE_STRICT = 1 << 2; + /** + * The parameter is publicly read-only. + */ + const int ATTRIBUTE_READ_ONLY = 1 << 3; + /** + * The parameter must not be visible to clients. + */ + const int ATTRIBUTE_HIDDEN = 1 << 4; + /** + * The parameter must not be used by framework (other than testing). + */ + const int ATTRIBUTE_INTERNAL = 1 << 5; + /** + * The parameter is publicly constant (hence read-only). + */ + const int ATTRIBUTE_CONST = 1 << 6; + + /** + * Index of the C2Param structure being described. + */ + int index; + /** + * bit flag for attribute defined in the above. + */ + int attrib; + /** + * Name of the structure. This must be unique for each structure. + */ + String name; + /** + * Indices of other C2Param structures that this C2Param structure depends + * on. + */ + int[] dependencies; +} diff --git a/media/c2/aidl/android/hardware/media/c2/ParamField.aidl b/media/c2/aidl/android/hardware/media/c2/ParamField.aidl new file mode 100644 index 0000000000..64a46bbef5 --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/ParamField.aidl @@ -0,0 +1,34 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +import android.hardware.media.c2.FieldId; + +/** + * Reference to a field in a C2Param structure. + */ +@VintfStability +parcelable ParamField { + /** + * Index of the C2Param structure. + */ + int index; + /** + * Identifier of the field inside the C2Param structure. + */ + FieldId fieldId; +} diff --git a/media/c2/aidl/android/hardware/media/c2/ParamFieldValues.aidl b/media/c2/aidl/android/hardware/media/c2/ParamFieldValues.aidl new file mode 100644 index 0000000000..7b74c0ec34 --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/ParamFieldValues.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +import android.hardware.media.c2.FieldSupportedValues; +import android.hardware.media.c2.ParamField; + +/** + * Supported values for a field. + * + * This is a pair of the field specifier together with an optional supported + * values object. This structure is used when reporting parameter configuration + * failures and conflicts. + */ +@VintfStability +parcelable ParamFieldValues { + /** + * Reference to a field or a C2Param structure. + */ + ParamField paramOrField; + /** + * Optional supported values for the field if #paramOrField specifies an + * actual field that is numeric (non struct, blob or string). Supported + * values for arrays (including string and blobs) describe the supported + * values for each element (character for string, and bytes for blobs). It + * is optional for read-only strings and blobs. + */ + FieldSupportedValues[] values; +} diff --git a/media/c2/aidl/android/hardware/media/c2/Params.aidl b/media/c2/aidl/android/hardware/media/c2/Params.aidl new file mode 100644 index 0000000000..53b512cf91 --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/Params.aidl @@ -0,0 +1,36 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +/** + * Flattened representation of std::vector object. + * + * The `Params` type is an array of bytes made up by concatenating a list of + * C2Param objects. The start index (offset into @ref Params) of each C2Param + * object in the list is divisible by 8. Up to 7 padding bytes may be added + * after each C2Param object to achieve this 64-bit alignment. + * + * Each C2Param object has the following layout: + * - 4 bytes: C2Param structure index (of type @ref ParamIndex) identifying the + * type of the C2Param object. + * - 4 bytes: size of the C2Param object (unsigned 4-byte integer). + * - (size - 8) bytes: data of the C2Param object. + */ +@VintfStability +parcelable Params { + byte[] params; +} diff --git a/media/c2/aidl/android/hardware/media/c2/SettingResult.aidl b/media/c2/aidl/android/hardware/media/c2/SettingResult.aidl new file mode 100644 index 0000000000..c2b9574457 --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/SettingResult.aidl @@ -0,0 +1,99 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +import android.hardware.media.c2.ParamFieldValues; + +/** + * Information describing the reason the parameter settings may fail, or may be + * overridden. + */ +@VintfStability +parcelable SettingResult { + /** + * Failure code + */ + @VintfStability + @Backing(type="int") + enum Failure { + /** + * Parameter is not supported. + */ + BAD_TYPE, + /** + * Parameter is not supported on the specific port. + */ + BAD_PORT, + /** + * Parameter is not supported on the specific stream. + */ + BAD_INDEX, + /** + * Parameter is read-only and cannot be set. + */ + READ_ONLY, + /** + * Parameter mismatches input data. + */ + MISMATCH, + /** + * Strict parameter does not accept value for the field at all. + */ + BAD_VALUE, + /** + * Strict parameter field value is in conflict with an/other + * setting(s). + */ + CONFLICT, + /** + * Parameter field is out of range due to other settings. (This failure + * mode can only be used for strict calculated parameters.) + */ + UNSUPPORTED, + /** + * Field does not access the requested parameter value at all. It has + * been corrected to the closest supported value. This failure mode is + * provided to give guidance as to what are the currently supported + * values for this field (which may be a subset of the at-all-potential + * values). + */ + INFO_BAD_VALUE, + /** + * Requested parameter value is in conflict with an/other setting(s) + * and has been corrected to the closest supported value. This failure + * mode is given to provide guidance as to what are the currently + * supported values as well as to optionally provide suggestion to the + * client as to how to enable the requested parameter value. + */ + INFO_CONFLICT, + } + Failure failure; + /** + * Failing (or corrected) field or parameter and optionally, currently + * supported values for the field. Values must only be set for field + * failures other than `BAD_VALUE`, and only if they are different from the + * globally supported values (e.g. due to restrictions by another parameter + * or input data). + */ + ParamFieldValues field; + /** + * Conflicting parameters or fields with (optional) suggested values for any + * conflicting fields to avoid the conflict. Values must only be set for + * `CONFLICT`, `UNSUPPORTED` or `INFO_CONFLICT` failure code. + */ + ParamFieldValues[] conflicts; +} diff --git a/media/c2/aidl/android/hardware/media/c2/Status.aidl b/media/c2/aidl/android/hardware/media/c2/Status.aidl new file mode 100644 index 0000000000..58a24047e7 --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/Status.aidl @@ -0,0 +1,82 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +/** + * Common return values for Codec2 operations. + */ +@VintfStability +parcelable Status { + /** + * Operation completed successfully. + */ + const int OK = 0; + /** + * Argument has invalid value (user error). + */ + const int BAD_VALUE = -22; + /** + * Argument uses invalid index (user error). + */ + const int BAD_INDEX = -75; + /** + * Argument/Index is valid but not possible. + */ + const int CANNOT_DO = -2147483646; + /** + * Object already exists. + */ + const int DUPLICATE = -17; + /** + * Object not found. + */ + const int NOT_FOUND = -2; + /** + * Operation is not permitted in the current state. + */ + const int BAD_STATE = -38; + /** + * Operation would block but blocking is not permitted. + */ + const int BLOCKING = -9930; + /** + * Not enough memory to complete operation. + */ + const int NO_MEMORY = -12; + /** + * Missing permission to complete operation. + */ + const int REFUSED = -1; + /** + * Operation did not complete within timeout. + */ + const int TIMED_OUT = -110; + /** + * Operation is not implemented/supported (optional only). + */ + const int OMITTED = -74; + /** + * Some unexpected error prevented the operation. + */ + const int CORRUPTED = -2147483648; + /** + * Status has not been initialized. + */ + const int NO_INIT = -19; + + int status; +} diff --git a/media/c2/aidl/android/hardware/media/c2/StructDescriptor.aidl b/media/c2/aidl/android/hardware/media/c2/StructDescriptor.aidl new file mode 100644 index 0000000000..00359041f0 --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/StructDescriptor.aidl @@ -0,0 +1,48 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +import android.hardware.media.c2.FieldDescriptor; + +/** + * Description of a C2Param structure. It consists of an index and a list of + * `FieldDescriptor`s. + */ +@VintfStability +parcelable StructDescriptor { + /** + * Index of the structure. + * + * Actually C2Param::CoreIndex + * Core index is the underlying parameter type for a parameter. It is used to describe the + * layout of the parameter structure regardless of the component or parameter kind/scope. + * + * It is used to identify and distinguish global parameters, and also parameters on a given + * port or stream. They must be unique for the set of global parameters, as well as for the + * set of parameters on each port or each stream, but the same core index can be used for + * parameters on different streams or ports, as well as for global parameters and port/stream + * parameters. + */ + int type; + /** + * List of fields in the structure. + * + * Fields are ordered by their offsets. A field that is a structure is + * ordered before its members. + */ + FieldDescriptor[] fields; +} diff --git a/media/c2/aidl/android/hardware/media/c2/SurfaceSyncObj.aidl b/media/c2/aidl/android/hardware/media/c2/SurfaceSyncObj.aidl new file mode 100644 index 0000000000..d20e10273f --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/SurfaceSyncObj.aidl @@ -0,0 +1,55 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +import android.hardware.common.NativeHandle; +/** + * Surface(BufferQueue/IGBP) synchronization object regarding # of dequeued + * output buffers. This keeps # of dequeued buffers from Surface less than + * configured max # of dequeued buffers all the time. + */ +@VintfStability +parcelable SurfaceSyncObj { + /** + * ASharedMemory for synchronization data. Layout is below + * + * |lock(futex) 4bytes| + * |conditional_variable(futex) 4bytes| + * |# of max dequeable buffer 4bytes| + * |# of dequeued buffer 4bytes| + * |Status of the surface 4bytes| + * INIT = 0, Configuring surface is not finished. + * ACTIVE = 1, Surface is ready to allocate(dequeue). + * SWITCHING = 2, Switching to the new surface. It is blocked + * to allocate(dequeue) a buffer until switching + * completes. + */ + NativeHandle syncMemory; + /** + * BufferQueue id. + */ + long bqId; + /** + * Generation id. + */ + int generationId; + /** + * Consumer usage flags. See +ndk + * libnativewindow#AHardwareBuffer_UsageFlags for possible values. + */ + long consumerUsage; +} diff --git a/media/c2/aidl/android/hardware/media/c2/ValueRange.aidl b/media/c2/aidl/android/hardware/media/c2/ValueRange.aidl new file mode 100644 index 0000000000..9abcb7da2b --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/ValueRange.aidl @@ -0,0 +1,63 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +/** + * Description of a set of values. + * + * If the `step` member is 0, and `num` and `denom` are both 1, the `Range` + * structure represents a closed interval bounded by `min` and `max`. + * + * Otherwise, the #ValueRange structure represents a finite sequence of numbers + * produced from the following recurrence relation: + * + * @code + * v[0] = min + * v[i] = v[i - 1] * num / denom + step ; i >= 1 + * @endcode + * + * Both the ratio `num / denom` and the value `step` must be positive. The + * last number in the sequence described by this #Range structure is the + * largest number in the sequence that is smaller than or equal to `max`. + * + * @note + * The division in the formula may truncate the result if the data type of + * these values is an integral type. + */ +@VintfStability +parcelable ValueRange { + /** + * Lower end of the range (inclusive). + */ + long min; + /** + * Upper end of the range (inclusive). + */ + long max; + /** + * The non-homogeneous term in the recurrence relation. + */ + long step; + /** + * The numerator of the scale coefficient in the recurrence relation. + */ + long num; + /** + * The denominator of the scale coefficient in the recurrence relation. + */ + long denom; +} diff --git a/media/c2/aidl/android/hardware/media/c2/Work.aidl b/media/c2/aidl/android/hardware/media/c2/Work.aidl new file mode 100644 index 0000000000..4b8d696871 --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/Work.aidl @@ -0,0 +1,83 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +import android.hardware.media.c2.FrameData; +import android.hardware.media.c2.Status; +import android.hardware.media.c2.Worklet; + +/** + * A collection of input data to and output data from the component. + * + * A `Work` object holds information about a single work item. It is created by + * the client and passed to the component via IComponent::queue(). The component + * has two ways of returning a `Work` object to the client: + * 1. If the queued `Work` object has been successfully processed, + * IComponentListener::onWorkDone() shall be called to notify the listener, + * and the output shall be included in the returned `Work` object. + * 2. If the client calls IComponent::flush(), a `Work` object that has not + * been processed shall be returned. + * + * `Work` is a part of @ref WorkBundle. + */ +@VintfStability +parcelable Work { + /** + * Additional work chain info not part of this work. + */ + byte[] chainInfo; + /** + * @ref FrameData for the input. + */ + FrameData input; + /** + * The chain of `Worklet`s. + * + * The length of #worklets is 1 when tunneling is not enabled. + * + * If #worklets has more than a single element, the tunnels between + * successive components of the work chain must have been successfully + * pre-registered at the time that the `Work` is submitted. Allocating the + * output buffers in the `Worklet`s is the responsibility of each component + * in the chain. + * + * Upon `Work` submission, #worklets must be an appropriately sized vector + * containing `Worklet`s with @ref Worklet.hasOutput set to `false`. After a + * successful processing, all but the final `Worklet` in the returned + * #worklets must have @ref Worklet.hasOutput set to `false`. + */ + Worklet[] worklets; + /** + * The number of `Worklet`s successfully processed in this chain. + * + * This must be initialized to 0 by the client when the `Work` is submitted, + * and it must contain the number of `Worklet`s that were successfully + * processed when the `Work` is returned to the client. + * + * #workletsProcessed cannot exceed the length of #worklets. If + * #workletsProcessed is smaller than the length of #worklets, #result + * cannot be `OK`. + */ + int workletsProcessed; + /** + * The final outcome of the `Work` (corresponding to #workletsProcessed). + * + * The value of @ref Status.OK implies that all `Worklet`s have been + * successfully processed. + */ + Status result; +} diff --git a/media/c2/aidl/android/hardware/media/c2/WorkBundle.aidl b/media/c2/aidl/android/hardware/media/c2/WorkBundle.aidl new file mode 100644 index 0000000000..2125fdab6c --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/WorkBundle.aidl @@ -0,0 +1,48 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +import android.hardware.media.c2.BaseBlock; +import android.hardware.media.c2.Work; + +/** + * List of `Work` objects. + * + * `WorkBundle` is used in IComponent::queue(), IComponent::flush() and + * IComponentListener::onWorkDone(). A `WorkBundle` object consists of a list of + * `Work` objects and a list of `BaseBlock` objects. Bundling multiple `Work` + * objects together provides two benefits: + * 1. Batching of `Work` objects can reduce the number of IPC calls. + * 2. If multiple `Work` objects contain `Block`s that refer to the same + * `BaseBlock`, the number of `BaseBlock`s that is sent between processes + * is also reduced. + * + * @note `WorkBundle` is the AIDL counterpart of the vector of `C2Work` in the + * Codec 2.0 standard. The presence of #baseBlocks helps with minimizing the + * data transferred over an IPC. + */ +@VintfStability +parcelable WorkBundle { + /** + * A list of Work items. + */ + Work[] works; + /** + * A list of blocks indexed by elements of #works. + */ + BaseBlock[] baseBlocks; +} diff --git a/media/c2/aidl/android/hardware/media/c2/WorkOrdinal.aidl b/media/c2/aidl/android/hardware/media/c2/WorkOrdinal.aidl new file mode 100644 index 0000000000..5708a90bc8 --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/WorkOrdinal.aidl @@ -0,0 +1,48 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +/** + * Ordering information of @ref FrameData objects. Each member is used for + * comparing urgency: a smaller difference from a reference value indicates that + * the associated Work object is more urgent. The reference value for each + * member is initialized the first time it is communicated between the client + * and the codec, and it may be updated to later values that are communicated. + * + * Each member of `WorkOrdinal` is stored as an unsigned integer, but the actual + * order it represents is derived by subtracting the reference value, then + * interpreting the result as a signed number with the same storage size (using + * two's complement). + * + * @note `WorkOrdinal` is the HIDL counterpart of `C2WorkOrdinalStruct` in the + * Codec 2.0 standard. + */ +@VintfStability +parcelable WorkOrdinal { + /** + * Timestamp in microseconds. + */ + long timestampUs; + /** + * Frame index. + */ + long frameIndex; + /** + * Component specific frame ordinal. + */ + long customOrdinal; +} diff --git a/media/c2/aidl/android/hardware/media/c2/Worklet.aidl b/media/c2/aidl/android/hardware/media/c2/Worklet.aidl new file mode 100644 index 0000000000..6b3ceac5a0 --- /dev/null +++ b/media/c2/aidl/android/hardware/media/c2/Worklet.aidl @@ -0,0 +1,54 @@ +/* + * 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. + */ + +package android.hardware.media.c2; + +import android.hardware.media.c2.FrameData; +import android.hardware.media.c2.SettingResult; + +/** + * In/out structure containing some instructions for and results from output + * processing. + * + * This is a part of @ref Work. One `Worklet` corresponds to one output + * @ref FrameData. The client must construct an original `Worklet` object inside + * a @ref Work object for each expected output before calling + * IComponent::queue(). + */ +@VintfStability +parcelable Worklet { + /** + * Component id. (Input) + * + * This is used only when tunneling is enabled. + * + * When used, this must match the return value from IConfigurable::getId(). + */ + int componentId; + /** + * List of C2Param objects describing tunings to be applied before + * processing this `Worklet`. (Input) + */ + byte[] tunings; + /** + * List of failures. (Output) + */ + SettingResult[] failures; + /** + * Output frame data. (Output) + */ + FrameData output; +} From 8ae9bdd3b370bd464332f7af9465d8fd604aa25a Mon Sep 17 00:00:00 2001 From: Yomna Nasser Date: Sat, 12 Nov 2022 06:09:23 +0000 Subject: [PATCH 383/998] Add VTS for setNullCipherAndIntegrityEnabled Bug: b/237529943 Test: atest VtsHalRadioTargetTest Change-Id: I81ffa3b19131b558da0250e5431f12c332d8c830 --- radio/aidl/vts/radio_network_test.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index 8b8eda6693..c15899aa00 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -1961,3 +1961,21 @@ TEST_P(RadioNetworkTest, isN1ModeEnabled) { RadioError::REQUEST_NOT_SUPPORTED, RadioError::NONE})); } } + +/* + * Test IRadioNetwork.setNullCipherAndIntegrityEnabled() for the response returned. + */ +TEST_P(RadioNetworkTest, setNullCipherAndIntegrityEnabled) { + LOG(DEBUG) << "setNullCipherAndIntegrityEnabled"; + serial = GetRandomSerialNumber(); + + radio_network->setNullCipherAndIntegrityEnabled(serial, false); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); + + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); + LOG(DEBUG) << "setNullCipherAndIntegrityEnabled finished"; +} From 8453178f183cbb62b1a00a79db70aad64a08cfde Mon Sep 17 00:00:00 2001 From: Ilya Matyukhin Date: Mon, 31 Oct 2022 02:29:43 +0000 Subject: [PATCH 384/998] Add @hide to the biometric interfaces This change allows the framework to depend on biometric AIDL types, for example: `android.hardware.biometrics.fingerprint.PointerContext`. The dependency can be introduced with a `-java-source` target, for example: `:android.hardware.biometrics.common-V3-java-source`. The "@hide" annotation informs Metalava that these types are not a public API (not part of the SDK). Bug: 218388821 Test: m android.hardware.biometrics.common-update-api Test: m android.hardware.biometrics.face-update-api Test: m android.hardware.biometrics.fingerprint-update-api Change-Id: Ib3327594c64dbb800b9d1744869ceb490d63e553 --- biometrics/common/aidl/Android.bp | 2 -- .../biometrics/common/CommonProps.aidl | 1 + .../biometrics/common/ComponentInfo.aidl | 1 + .../common/ICancellationSignal.aidl | 1 + .../biometrics/common/OperationContext.aidl | 1 + .../biometrics/common/OperationReason.aidl | 1 + .../biometrics/common/SensorStrength.aidl | 1 + .../biometrics/common/CommonProps.aidl | 4 +++- .../biometrics/common/ComponentInfo.aidl | 4 +++- .../common/ICancellationSignal.aidl | 5 +++-- .../biometrics/common/OperationContext.aidl | 1 + .../biometrics/common/OperationReason.aidl | 4 +++- .../biometrics/common/SensorStrength.aidl | 6 +++-- biometrics/common/util/Android.bp | 2 +- biometrics/face/aidl/Android.bp | 4 ++-- biometrics/face/aidl/default/Android.bp | 10 ++++----- biometrics/face/aidl/default/face-default.xml | 2 +- biometrics/face/aidl/vts/Android.bp | 6 ++--- biometrics/fingerprint/aidl/Android.bp | 6 ++--- .../biometrics/fingerprint/AcquiredInfo.aidl | 1 + .../biometrics/fingerprint/Error.aidl | 1 + .../fingerprint/FingerprintSensorType.aidl | 1 + .../biometrics/fingerprint/IFingerprint.aidl | 1 + .../biometrics/fingerprint/ISession.aidl | 1 + .../fingerprint/ISessionCallback.aidl | 1 + .../fingerprint/PointerContext.aidl | 3 ++- .../fingerprint/SensorLocation.aidl | 1 + .../biometrics/fingerprint/SensorProps.aidl | 1 + .../biometrics/fingerprint/AcquiredInfo.aidl | 4 +++- .../biometrics/fingerprint/Error.aidl | 4 +++- .../fingerprint/FingerprintSensorType.aidl | 4 +++- .../biometrics/fingerprint/IFingerprint.aidl | 4 +++- .../biometrics/fingerprint/ISession.aidl | 1 + .../fingerprint/ISessionCallback.aidl | 4 +++- .../fingerprint/PointerContext.aidl | 10 +++++---- .../fingerprint/SensorLocation.aidl | 4 +++- .../biometrics/fingerprint/SensorProps.aidl | 4 +++- .../fingerprint/aidl/default/Android.bp | 22 +++++++++---------- .../aidl/default/fingerprint-example.xml | 2 +- biometrics/fingerprint/aidl/vts/Android.bp | 6 ++--- .../compatibility_matrix.current.xml | 4 ++-- 41 files changed, 92 insertions(+), 54 deletions(-) diff --git a/biometrics/common/aidl/Android.bp b/biometrics/common/aidl/Android.bp index 167e0c78da..3cd76fd262 100644 --- a/biometrics/common/aidl/Android.bp +++ b/biometrics/common/aidl/Android.bp @@ -31,7 +31,5 @@ aidl_interface { version: "2", imports: [], }, - ], - } diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/CommonProps.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/CommonProps.aidl index d4433c5bde..1eb8541352 100644 --- a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/CommonProps.aidl +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/CommonProps.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.common; +/* @hide */ @VintfStability parcelable CommonProps { int sensorId; diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/ComponentInfo.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/ComponentInfo.aidl index ad11ddaa6d..471ed2ba37 100644 --- a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/ComponentInfo.aidl +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/ComponentInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.common; +/* @hide */ @VintfStability parcelable ComponentInfo { String componentId; diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/ICancellationSignal.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/ICancellationSignal.aidl index 2bc6a6df05..670114f10a 100644 --- a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/ICancellationSignal.aidl +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/ICancellationSignal.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.common; +/* @hide */ @VintfStability interface ICancellationSignal { oneway void cancel(); diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationContext.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationContext.aidl index 9d1cb8ff86..5e184bce4b 100644 --- a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationContext.aidl +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationContext.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.common; +/* @hide */ @VintfStability parcelable OperationContext { int id = 0; diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationReason.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationReason.aidl index 3da3a6ab0b..a5b2990e57 100644 --- a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationReason.aidl +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationReason.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.common; +/* @hide */ @Backing(type="byte") @VintfStability enum OperationReason { UNKNOWN = 0, diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/SensorStrength.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/SensorStrength.aidl index 6675d091e5..aa773221a6 100644 --- a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/SensorStrength.aidl +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/SensorStrength.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.common; +/* @hide */ @Backing(type="byte") @VintfStability enum SensorStrength { CONVENIENCE = 0, diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/CommonProps.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/CommonProps.aidl index 2f5af5dbc9..cdedf4f18e 100644 --- a/biometrics/common/aidl/android/hardware/biometrics/common/CommonProps.aidl +++ b/biometrics/common/aidl/android/hardware/biometrics/common/CommonProps.aidl @@ -18,7 +18,9 @@ package android.hardware.biometrics.common; import android.hardware.biometrics.common.ComponentInfo; import android.hardware.biometrics.common.SensorStrength; - +/** + * @hide + */ @VintfStability parcelable CommonProps { /** diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/ComponentInfo.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/ComponentInfo.aidl index b268eef976..1da9cf6f04 100644 --- a/biometrics/common/aidl/android/hardware/biometrics/common/ComponentInfo.aidl +++ b/biometrics/common/aidl/android/hardware/biometrics/common/ComponentInfo.aidl @@ -15,7 +15,9 @@ */ package android.hardware.biometrics.common; - +/** + * @hide + */ @VintfStability parcelable ComponentInfo { /** diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/ICancellationSignal.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/ICancellationSignal.aidl index 10102561b5..b9b1f39e28 100644 --- a/biometrics/common/aidl/android/hardware/biometrics/common/ICancellationSignal.aidl +++ b/biometrics/common/aidl/android/hardware/biometrics/common/ICancellationSignal.aidl @@ -15,9 +15,10 @@ */ package android.hardware.biometrics.common; - +/** + * @hide + */ @VintfStability oneway interface ICancellationSignal { void cancel(); } - diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl index 72fe660126..a1c7a1f563 100644 --- a/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl +++ b/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl @@ -20,6 +20,7 @@ import android.hardware.biometrics.common.OperationReason; /** * Additional context associated with an operation. + * @hide */ @VintfStability parcelable OperationContext { diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/OperationReason.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/OperationReason.aidl index abc25ed663..a93cebc1f6 100644 --- a/biometrics/common/aidl/android/hardware/biometrics/common/OperationReason.aidl +++ b/biometrics/common/aidl/android/hardware/biometrics/common/OperationReason.aidl @@ -15,7 +15,9 @@ */ package android.hardware.biometrics.common; - +/** + * @hide + */ @VintfStability @Backing(type="byte") enum OperationReason { diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/SensorStrength.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/SensorStrength.aidl index 790691cbfc..b5c09996c1 100644 --- a/biometrics/common/aidl/android/hardware/biometrics/common/SensorStrength.aidl +++ b/biometrics/common/aidl/android/hardware/biometrics/common/SensorStrength.aidl @@ -15,7 +15,9 @@ */ package android.hardware.biometrics.common; - +/** + * @hide + */ @VintfStability @Backing(type="byte") enum SensorStrength { @@ -40,4 +42,4 @@ enum SensorStrength { * HardwareAuthToken(s). */ STRONG, -} \ No newline at end of file +} diff --git a/biometrics/common/util/Android.bp b/biometrics/common/util/Android.bp index 918ef72782..b990812856 100644 --- a/biometrics/common/util/Android.bp +++ b/biometrics/common/util/Android.bp @@ -13,6 +13,6 @@ cc_library { shared_libs: [ "libbase", "libbinder_ndk", - "android.hardware.biometrics.common-V2-ndk", + "android.hardware.biometrics.common-V3-ndk", ], } diff --git a/biometrics/face/aidl/Android.bp b/biometrics/face/aidl/Android.bp index 0bec0c54ca..7b11335bd1 100644 --- a/biometrics/face/aidl/Android.bp +++ b/biometrics/face/aidl/Android.bp @@ -14,9 +14,9 @@ aidl_interface { "android/hardware/biometrics/face/**/*.aidl", ], imports: [ - "android.hardware.biometrics.common", + "android.hardware.biometrics.common-V3", "android.hardware.common-V2", - "android.hardware.keymaster-V3", + "android.hardware.keymaster-V4", ], stability: "vintf", backend: { diff --git a/biometrics/face/aidl/default/Android.bp b/biometrics/face/aidl/default/Android.bp index 63a3645c6d..876a91faab 100644 --- a/biometrics/face/aidl/default/Android.bp +++ b/biometrics/face/aidl/default/Android.bp @@ -16,8 +16,8 @@ cc_binary { shared_libs: [ "libbase", "libbinder_ndk", - "android.hardware.biometrics.face-V2-ndk", - "android.hardware.biometrics.common-V2-ndk", + "android.hardware.biometrics.face-V3-ndk", + "android.hardware.biometrics.common-V3-ndk", "android.hardware.biometrics.common.thread", "android.hardware.biometrics.common.util", ], @@ -49,9 +49,9 @@ cc_test { ], static_libs: [ "libandroid.hardware.biometrics.face.VirtualProps", - "android.hardware.biometrics.face-V2-ndk", - "android.hardware.biometrics.common-V2-ndk", - "android.hardware.keymaster-V3-ndk", + "android.hardware.biometrics.face-V3-ndk", + "android.hardware.biometrics.common-V3-ndk", + "android.hardware.keymaster-V4-ndk", "android.hardware.biometrics.common.util", ], vendor: true, diff --git a/biometrics/face/aidl/default/face-default.xml b/biometrics/face/aidl/default/face-default.xml index e6ef842734..8f2fbb8def 100644 --- a/biometrics/face/aidl/default/face-default.xml +++ b/biometrics/face/aidl/default/face-default.xml @@ -1,7 +1,7 @@ android.hardware.biometrics.face - 2 + 3 IFace/default diff --git a/biometrics/face/aidl/vts/Android.bp b/biometrics/face/aidl/vts/Android.bp index 4171ac3364..f62c4e4b01 100644 --- a/biometrics/face/aidl/vts/Android.bp +++ b/biometrics/face/aidl/vts/Android.bp @@ -15,10 +15,10 @@ cc_test { ], srcs: ["VtsHalBiometricsFaceTargetTest.cpp"], static_libs: [ - "android.hardware.biometrics.common-V2-ndk", - "android.hardware.biometrics.face-V2-ndk", + "android.hardware.biometrics.common-V3-ndk", + "android.hardware.biometrics.face-V3-ndk", "android.hardware.common-V2-ndk", - "android.hardware.keymaster-V3-ndk", + "android.hardware.keymaster-V4-ndk", ], shared_libs: [ "libbinder_ndk", diff --git a/biometrics/fingerprint/aidl/Android.bp b/biometrics/fingerprint/aidl/Android.bp index 0bd642237c..f749822e52 100644 --- a/biometrics/fingerprint/aidl/Android.bp +++ b/biometrics/fingerprint/aidl/Android.bp @@ -14,8 +14,8 @@ aidl_interface { "android/hardware/biometrics/fingerprint/**/*.aidl", ], imports: [ - "android.hardware.biometrics.common", - "android.hardware.keymaster-V3", + "android.hardware.biometrics.common-V3", + "android.hardware.keymaster-V4", ], stability: "vintf", backend: { @@ -41,7 +41,5 @@ aidl_interface { "android.hardware.keymaster-V3", ], }, - ], - } diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl index c51aa033d4..0cc619f991 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.fingerprint; +/* @hide */ @Backing(type="byte") @VintfStability enum AcquiredInfo { UNKNOWN = 0, diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl index af7bc3c56b..45ce2eb3fe 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.fingerprint; +/* @hide */ @Backing(type="byte") @VintfStability enum Error { UNKNOWN = 0, diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl index 9c208c4e7c..67af20d872 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.fingerprint; +/* @hide */ @Backing(type="byte") @VintfStability enum FingerprintSensorType { UNKNOWN = 0, diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IFingerprint.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IFingerprint.aidl index 5d3df6fbaa..0b6f3008ac 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IFingerprint.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IFingerprint.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.fingerprint; +/* @hide */ @VintfStability interface IFingerprint { android.hardware.biometrics.fingerprint.SensorProps[] getSensorProps(); diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl index 30f299d1fc..f30585529d 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.fingerprint; +/* @hide */ @VintfStability interface ISession { void generateChallenge(); diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISessionCallback.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISessionCallback.aidl index 3c40ad63bf..be18ffed1a 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISessionCallback.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISessionCallback.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.fingerprint; +/* @hide */ @VintfStability interface ISessionCallback { void onChallengeGenerated(in long challenge); diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/PointerContext.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/PointerContext.aidl index 43db6cfb51..999b324abd 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/PointerContext.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/PointerContext.aidl @@ -32,7 +32,8 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.fingerprint; -@VintfStability +/* @hide */ +@JavaDerive(equals=true) @VintfStability parcelable PointerContext { int pointerId = -1; float x = 0.000000f; diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorLocation.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorLocation.aidl index 295fde9f5f..dc6a62de6b 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorLocation.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorLocation.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.fingerprint; +/* @hide */ @VintfStability parcelable SensorLocation { int displayId; diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorProps.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorProps.aidl index 782d2899d3..a77d5f2eee 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorProps.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorProps.aidl @@ -32,6 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.biometrics.fingerprint; +/* @hide */ @VintfStability parcelable SensorProps { android.hardware.biometrics.common.CommonProps commonProps; diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl index 8ec8574965..d3aa98a87d 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl @@ -15,7 +15,9 @@ */ package android.hardware.biometrics.fingerprint; - +/** + * @hide + */ @VintfStability @Backing(type="byte") enum AcquiredInfo { diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/Error.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/Error.aidl index e69859a442..d8d47fa8a0 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/Error.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/Error.aidl @@ -15,7 +15,9 @@ */ package android.hardware.biometrics.fingerprint; - +/** + * @hide + */ @VintfStability @Backing(type="byte") enum Error { diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl index dbe71377a2..7caa1548da 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl @@ -15,7 +15,9 @@ */ package android.hardware.biometrics.fingerprint; - +/** + * @hide + */ @VintfStability @Backing(type="byte") enum FingerprintSensorType { diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IFingerprint.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IFingerprint.aidl index 75f90a12ae..f4febad52e 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IFingerprint.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IFingerprint.aidl @@ -19,7 +19,9 @@ package android.hardware.biometrics.fingerprint; import android.hardware.biometrics.fingerprint.ISession; import android.hardware.biometrics.fingerprint.ISessionCallback; import android.hardware.biometrics.fingerprint.SensorProps; - +/** + * @hide + */ @VintfStability interface IFingerprint { /** diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl index db0114514e..f4f7804f52 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl @@ -45,6 +45,7 @@ import android.hardware.keymaster.HardwareAuthToken; * ISession only supports execution of one non-interrupting operation at a time, regardless of * whether it's cancellable. The framework must wait for a callback indicating the end of the * current non-interrupting operation before a new non-interrupting operation can be started. + * @hide */ @VintfStability interface ISession { diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISessionCallback.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISessionCallback.aidl index f699966f59..24b169e3cb 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISessionCallback.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISessionCallback.aidl @@ -19,7 +19,9 @@ package android.hardware.biometrics.fingerprint; import android.hardware.biometrics.fingerprint.AcquiredInfo; import android.hardware.biometrics.fingerprint.Error; import android.hardware.keymaster.HardwareAuthToken; - +/** + * @hide + */ @VintfStability interface ISessionCallback { /** diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/PointerContext.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/PointerContext.aidl index e025d3440d..582e6cfc06 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/PointerContext.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/PointerContext.aidl @@ -18,7 +18,9 @@ package android.hardware.biometrics.fingerprint; /** * Additional context associated with a pointer event. + * @hide */ +@JavaDerive(equals=true) @VintfStability parcelable PointerContext { /** @@ -64,7 +66,7 @@ parcelable PointerContext { boolean isAod = false; /** - * The time of the user interaction that produced this event, in milliseconds. + * The time when this event was created, in milliseconds. * * This is obtained from MotionEvent#getEventTime, which uses SystemClock.uptimeMillis() as * the clock. @@ -74,10 +76,10 @@ parcelable PointerContext { long time = 0; /** - * The time of the first user interaction in this gesture, in milliseconds. + * This event is part of some gesture. This is the time when MotionEvent#ACTION_DOWN was + * created for that gesture, in milliseconds. * - * If this event is MotionEvent#ACTION_DOWN, it means it's the first event in this gesture, - * and `gestureStart` will be equal to `time`. + * If this event is MotionEvent#ACTION_DOWN, then this value is equal to `time`. * * This is obtained from MotionEvent#getDownTime, which uses SystemClock.uptimeMillis() as * the clock. diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorLocation.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorLocation.aidl index d12605c521..a065a7ce7b 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorLocation.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorLocation.aidl @@ -15,7 +15,9 @@ */ package android.hardware.biometrics.fingerprint; - +/** + * @hide + */ @VintfStability parcelable SensorLocation { /** diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorProps.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorProps.aidl index fb516da51e..d4e9ec6f38 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorProps.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorProps.aidl @@ -19,7 +19,9 @@ package android.hardware.biometrics.fingerprint; import android.hardware.biometrics.common.CommonProps; import android.hardware.biometrics.fingerprint.FingerprintSensorType; import android.hardware.biometrics.fingerprint.SensorLocation; - +/** + * @hide + */ @VintfStability parcelable SensorProps { /** diff --git a/biometrics/fingerprint/aidl/default/Android.bp b/biometrics/fingerprint/aidl/default/Android.bp index 77c74e1a77..fe224c9885 100644 --- a/biometrics/fingerprint/aidl/default/Android.bp +++ b/biometrics/fingerprint/aidl/default/Android.bp @@ -27,8 +27,8 @@ cc_binary { shared_libs: [ "libbase", "libbinder_ndk", - "android.hardware.biometrics.fingerprint-V2-ndk", - "android.hardware.biometrics.common-V2-ndk", + "android.hardware.biometrics.fingerprint-V3-ndk", + "android.hardware.biometrics.common-V3-ndk", "android.hardware.biometrics.common.thread", "android.hardware.biometrics.common.util", ], @@ -50,9 +50,9 @@ cc_test { ], static_libs: [ "libandroid.hardware.biometrics.fingerprint.VirtualProps", - "android.hardware.biometrics.fingerprint-V2-ndk", - "android.hardware.biometrics.common-V2-ndk", - "android.hardware.keymaster-V3-ndk", + "android.hardware.biometrics.fingerprint-V3-ndk", + "android.hardware.biometrics.common-V3-ndk", + "android.hardware.keymaster-V4-ndk", "android.hardware.biometrics.common.util", ], vendor: true, @@ -76,9 +76,9 @@ cc_test { ], static_libs: [ "libandroid.hardware.biometrics.fingerprint.VirtualProps", - "android.hardware.biometrics.fingerprint-V2-ndk", - "android.hardware.biometrics.common-V2-ndk", - "android.hardware.keymaster-V3-ndk", + "android.hardware.biometrics.fingerprint-V3-ndk", + "android.hardware.biometrics.common-V3-ndk", + "android.hardware.keymaster-V4-ndk", "android.hardware.biometrics.common.util", ], vendor: true, @@ -100,9 +100,9 @@ cc_test { ], static_libs: [ "libandroid.hardware.biometrics.fingerprint.VirtualProps", - "android.hardware.biometrics.fingerprint-V2-ndk", - "android.hardware.biometrics.common-V2-ndk", - "android.hardware.keymaster-V3-ndk", + "android.hardware.biometrics.fingerprint-V3-ndk", + "android.hardware.biometrics.common-V3-ndk", + "android.hardware.keymaster-V4-ndk", "android.hardware.biometrics.common.util", ], vendor: true, diff --git a/biometrics/fingerprint/aidl/default/fingerprint-example.xml b/biometrics/fingerprint/aidl/default/fingerprint-example.xml index 05d1279e58..e977b98a64 100644 --- a/biometrics/fingerprint/aidl/default/fingerprint-example.xml +++ b/biometrics/fingerprint/aidl/default/fingerprint-example.xml @@ -1,7 +1,7 @@ android.hardware.biometrics.fingerprint - 2 + 3 IFingerprint/virtual diff --git a/biometrics/fingerprint/aidl/vts/Android.bp b/biometrics/fingerprint/aidl/vts/Android.bp index a474f661ad..1652905380 100644 --- a/biometrics/fingerprint/aidl/vts/Android.bp +++ b/biometrics/fingerprint/aidl/vts/Android.bp @@ -15,9 +15,9 @@ cc_test { ], srcs: ["VtsHalBiometricsFingerprintTargetTest.cpp"], static_libs: [ - "android.hardware.biometrics.common-V2-ndk", - "android.hardware.biometrics.fingerprint-V2-ndk", - "android.hardware.keymaster-V3-ndk", + "android.hardware.biometrics.common-V3-ndk", + "android.hardware.biometrics.fingerprint-V3-ndk", + "android.hardware.keymaster-V4-ndk", ], shared_libs: [ "libbinder_ndk", diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index ff481f984f..1778a19f36 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -121,7 +121,7 @@ android.hardware.biometrics.face - 2 + 3 IFace default @@ -129,7 +129,7 @@ android.hardware.biometrics.fingerprint - 2 + 3 IFingerprint default From ef437d900f0553f1512a049a59bcd104ffe1e56a Mon Sep 17 00:00:00 2001 From: Sarah Chin Date: Thu, 17 Nov 2022 09:41:48 -0800 Subject: [PATCH 385/998] Remove LTE_CA from HAL Update IRadio imports to use V2 Test: build Bug: 240997187 Change-Id: Ie84a98156d8d02a36c3faa654decba6c837c362a --- .../compatibility_matrix.current.xml | 10 ++++---- radio/aidl/Android.bp | 25 ++++++++++--------- .../hardware/radio/RadioAccessFamily.aidl | 3 +++ .../hardware/radio/RadioTechnology.aidl | 3 +++ .../hardware/radio/RadioAccessFamily.aidl | 1 + .../hardware/radio/RadioTechnology.aidl | 4 +++ .../radio/network/RegStateResult.aidl | 6 ++--- radio/aidl/compat/libradiocompat/Android.bp | 10 ++++---- radio/aidl/compat/service/Android.bp | 10 ++++---- radio/aidl/vts/Android.bp | 12 ++++----- radio/aidl/vts/radio_network_test.cpp | 2 +- 11 files changed, 49 insertions(+), 37 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index ff481f984f..998b2b0f9e 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -439,7 +439,7 @@ android.hardware.radio.config - 1 + 2 IRadioConfig default @@ -447,7 +447,7 @@ android.hardware.radio.data - 1 + 2 IRadioData slot1 @@ -457,7 +457,7 @@ android.hardware.radio.messaging - 1 + 2 IRadioMessaging slot1 @@ -487,7 +487,7 @@ android.hardware.radio.sim - 1 + 2 IRadioSim slot1 @@ -497,7 +497,7 @@ android.hardware.radio.voice - 1 + 2 IRadioVoice slot1 diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp index 8911aea4f7..9dbe09aef3 100644 --- a/radio/aidl/Android.bp +++ b/radio/aidl/Android.bp @@ -36,7 +36,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/config/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V1"], + imports: ["android.hardware.radio-V2"], backend: { cpp: { enabled: true, @@ -60,7 +60,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/data/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V1"], + imports: ["android.hardware.radio-V2"], backend: { cpp: { enabled: true, @@ -84,7 +84,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/messaging/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V1"], + imports: ["android.hardware.radio-V2"], backend: { cpp: { enabled: true, @@ -108,7 +108,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/modem/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V1"], + imports: ["android.hardware.radio-V2"], backend: { cpp: { enabled: true, @@ -132,7 +132,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/network/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V1"], + imports: ["android.hardware.radio-V2"], backend: { cpp: { enabled: true, @@ -157,8 +157,8 @@ aidl_interface { srcs: ["android/hardware/radio/sim/*.aidl"], stability: "vintf", imports: [ - "android.hardware.radio-V1", - "android.hardware.radio.config", + "android.hardware.radio-V2", + "android.hardware.radio.config-V2", ], backend: { cpp: { @@ -186,7 +186,7 @@ aidl_interface { host_supported: true, srcs: ["android/hardware/radio/voice/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V1"], + imports: ["android.hardware.radio-V2"], backend: { cpp: { enabled: true, @@ -209,8 +209,10 @@ aidl_interface { vendor_available: true, srcs: ["android/hardware/radio/ims/media/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V1", - "android.hardware.radio.data-V1"], + imports: [ + "android.hardware.radio-V2", + "android.hardware.radio.data-V2", + ], backend: { cpp: { enabled: false, @@ -226,7 +228,7 @@ aidl_interface { vendor_available: true, srcs: ["android/hardware/radio/ims/*.aidl"], stability: "vintf", - imports: ["android.hardware.radio-V1"], + imports: ["android.hardware.radio-V2"], backend: { cpp: { enabled: false, @@ -236,4 +238,3 @@ aidl_interface { }, }, } - diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl index ecc2a9be7c..afc4f4e833 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl @@ -53,6 +53,9 @@ enum RadioAccessFamily { GSM = 65536, TD_SCDMA = 131072, IWLAN = 262144, + /** + * @deprecated use LTE instead. + */ LTE_CA = 524288, NR = 1048576, } diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnology.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnology.aidl index 9dad0a4977..7060469886 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnology.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnology.aidl @@ -53,6 +53,9 @@ enum RadioTechnology { GSM = 16, TD_SCDMA = 17, IWLAN = 18, + /** + * @deprecated use LTE instead and indicate carrier aggregation through multiple physical channel configurations in IRadioNetwork::currentPhysicalChannelConfigs. + */ LTE_CA = 19, NR = 20, } diff --git a/radio/aidl/android/hardware/radio/RadioAccessFamily.aidl b/radio/aidl/android/hardware/radio/RadioAccessFamily.aidl index 6cd0a9530a..edf33ba7cc 100644 --- a/radio/aidl/android/hardware/radio/RadioAccessFamily.aidl +++ b/radio/aidl/android/hardware/radio/RadioAccessFamily.aidl @@ -41,6 +41,7 @@ enum RadioAccessFamily { GSM = 1 << RadioTechnology.GSM, TD_SCDMA = 1 << RadioTechnology.TD_SCDMA, IWLAN = 1 << RadioTechnology.IWLAN, + /** @deprecated use LTE instead. */ LTE_CA = 1 << RadioTechnology.LTE_CA, /** * 5G NR. This is only use in 5G Standalone mode. diff --git a/radio/aidl/android/hardware/radio/RadioTechnology.aidl b/radio/aidl/android/hardware/radio/RadioTechnology.aidl index 917cb16057..4b51152ac4 100644 --- a/radio/aidl/android/hardware/radio/RadioTechnology.aidl +++ b/radio/aidl/android/hardware/radio/RadioTechnology.aidl @@ -45,6 +45,10 @@ enum RadioTechnology { GSM, TD_SCDMA, IWLAN, + /** + * @deprecated use LTE instead and indicate carrier aggregation through multiple + * physical channel configurations in IRadioNetwork::currentPhysicalChannelConfigs. + */ LTE_CA, /** * 5G NR. This is only used in 5G Standalone mode. diff --git a/radio/aidl/android/hardware/radio/network/RegStateResult.aidl b/radio/aidl/android/hardware/radio/network/RegStateResult.aidl index 3d96b8cbf2..f1d2972fc9 100644 --- a/radio/aidl/android/hardware/radio/network/RegStateResult.aidl +++ b/radio/aidl/android/hardware/radio/network/RegStateResult.aidl @@ -33,9 +33,9 @@ parcelable RegStateResult { */ RegState regState; /** - * Indicates the radio technology (except LTE_CA, which is no longer a valid value), which - * must not be UNKNOWN if regState is REG_HOME, REG_ROAMING, NOT_REG_MT_NOT_SEARCHING_OP_EM, - * NOT_REG_MT_SEARCHING_OP_EM, REG_DENIED_EM, or UNKNOWN_EM. + * Indicates the radio technology, which must not be UNKNOWN if regState is REG_HOME, + * REG_ROAMING, NOT_REG_MT_NOT_SEARCHING_OP_EM, NOT_REG_MT_SEARCHING_OP_EM, REG_DENIED_EM, + * or UNKNOWN_EM. * When the device is on carrier aggregation, vendor RIL service must properly report multiple * PhysicalChannelConfig elements through IRadioNetwork::currentPhysicalChannelConfigs. */ diff --git a/radio/aidl/compat/libradiocompat/Android.bp b/radio/aidl/compat/libradiocompat/Android.bp index 557e461cfe..c40ca30832 100644 --- a/radio/aidl/compat/libradiocompat/Android.bp +++ b/radio/aidl/compat/libradiocompat/Android.bp @@ -31,18 +31,18 @@ cc_library { "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION", ], shared_libs: [ - "android.hardware.radio.config-V1-ndk", + "android.hardware.radio.config-V2-ndk", "android.hardware.radio.config@1.0", "android.hardware.radio.config@1.1", "android.hardware.radio.config@1.2", "android.hardware.radio.config@1.3", - "android.hardware.radio.data-V1-ndk", + "android.hardware.radio.data-V2-ndk", "android.hardware.radio.ims-V1-ndk", - "android.hardware.radio.messaging-V1-ndk", + "android.hardware.radio.messaging-V2-ndk", "android.hardware.radio.modem-V2-ndk", "android.hardware.radio.network-V2-ndk", - "android.hardware.radio.sim-V1-ndk", - "android.hardware.radio.voice-V1-ndk", + "android.hardware.radio.sim-V2-ndk", + "android.hardware.radio.voice-V2-ndk", "android.hardware.radio@1.0", "android.hardware.radio@1.1", "android.hardware.radio@1.2", diff --git a/radio/aidl/compat/service/Android.bp b/radio/aidl/compat/service/Android.bp index 692f15a8af..7a48da28a9 100644 --- a/radio/aidl/compat/service/Android.bp +++ b/radio/aidl/compat/service/Android.bp @@ -34,18 +34,18 @@ cc_binary { ], shared_libs: [ "android.hardware.radio-library.compat", - "android.hardware.radio.config-V1-ndk", + "android.hardware.radio.config-V2-ndk", "android.hardware.radio.config@1.0", "android.hardware.radio.config@1.1", "android.hardware.radio.config@1.2", "android.hardware.radio.config@1.3", - "android.hardware.radio.data-V1-ndk", + "android.hardware.radio.data-V2-ndk", "android.hardware.radio.ims-V1-ndk", - "android.hardware.radio.messaging-V1-ndk", + "android.hardware.radio.messaging-V2-ndk", "android.hardware.radio.modem-V2-ndk", "android.hardware.radio.network-V2-ndk", - "android.hardware.radio.sim-V1-ndk", - "android.hardware.radio.voice-V1-ndk", + "android.hardware.radio.sim-V2-ndk", + "android.hardware.radio.voice-V2-ndk", "android.hardware.radio@1.0", "android.hardware.radio@1.1", "android.hardware.radio@1.2", diff --git a/radio/aidl/vts/Android.bp b/radio/aidl/vts/Android.bp index 4df54f768f..5a0dbd06cd 100644 --- a/radio/aidl/vts/Android.bp +++ b/radio/aidl/vts/Android.bp @@ -66,15 +66,15 @@ cc_test { "libvintf", ], static_libs: [ - "android.hardware.radio-V1-ndk", - "android.hardware.radio.config-V1-ndk", - "android.hardware.radio.data-V1-ndk", + "android.hardware.radio-V2-ndk", + "android.hardware.radio.config-V2-ndk", + "android.hardware.radio.data-V2-ndk", "android.hardware.radio.ims-V1-ndk", - "android.hardware.radio.messaging-V1-ndk", + "android.hardware.radio.messaging-V2-ndk", "android.hardware.radio.modem-V2-ndk", "android.hardware.radio.network-V2-ndk", - "android.hardware.radio.sim-V1-ndk", - "android.hardware.radio.voice-V1-ndk", + "android.hardware.radio.sim-V2-ndk", + "android.hardware.radio.voice-V2-ndk", ], test_suites: [ "general-tests", diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index 31f4aca9bb..bd81b8afec 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -1501,7 +1501,7 @@ TEST_P(RadioNetworkTest, getDataRegistrationState) { RadioTechnology rat = radioRsp_network->dataRegResp.rat; // TODO: add logic for cdmaInfo - if (rat == RadioTechnology::LTE || rat == RadioTechnology::LTE_CA) { + if (rat == RadioTechnology::LTE) { ASSERT_EQ(info.getTag(), AccessTechnologySpecificInfo::eutranInfo); } else if (rat == RadioTechnology::NR) { ASSERT_TRUE(info.getTag() == AccessTechnologySpecificInfo::ngranNrVopsInfo); From 48c546c7e92b0bb3d8bb003a6518618877db9e44 Mon Sep 17 00:00:00 2001 From: John Reck Date: Tue, 15 Nov 2022 16:29:21 -0500 Subject: [PATCH 386/998] IMapper 5 - the Stable C approach Test: make VtsHalGraphicsMapperStableC_TargetTest VtsHalGraphicsAllocatorAidl_TargetTest Change-Id: I910b27f388e3fb7261425dd4b2133885c05edd37 --- .../compatibility_matrix.current.xml | 4 +- graphics/Android.bp | 4 +- graphics/allocator/aidl/Android.bp | 2 +- .../allocator/BufferDescriptorInfo.aidl | 44 + .../graphics/allocator/IAllocator.aidl | 6 + .../allocator/BufferDescriptorInfo.aidl | 65 + .../graphics/allocator/IAllocator.aidl | 38 + graphics/allocator/aidl/vts/Android.bp | 1 + ...VtsHalGraphicsAllocatorAidl_TargetTest.cpp | 235 ++- graphics/mapper/stable-c/Android.bp | 104 ++ .../mapper/stable-c/implutils/impltests.cpp | 314 ++++ .../mapper/utils/IMapperMetadataTypes.h | 576 ++++++ .../graphics/mapper/utils/IMapperProvider.h | 222 +++ .../hardware/graphics/mapper/IMapper.h | 689 ++++++++ ...VtsHalGraphicsMapperStableC_TargetTest.cpp | 1565 +++++++++++++++++ 15 files changed, 3769 insertions(+), 100 deletions(-) create mode 100644 graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/current/android/hardware/graphics/allocator/BufferDescriptorInfo.aidl create mode 100644 graphics/allocator/aidl/android/hardware/graphics/allocator/BufferDescriptorInfo.aidl create mode 100644 graphics/mapper/stable-c/Android.bp create mode 100644 graphics/mapper/stable-c/implutils/impltests.cpp create mode 100644 graphics/mapper/stable-c/implutils/include/android/hardware/graphics/mapper/utils/IMapperMetadataTypes.h create mode 100644 graphics/mapper/stable-c/implutils/include/android/hardware/graphics/mapper/utils/IMapperProvider.h create mode 100644 graphics/mapper/stable-c/include/android/hardware/graphics/mapper/IMapper.h create mode 100644 graphics/mapper/stable-c/vts/VtsHalGraphicsMapperStableC_TargetTest.cpp diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index ff481f984f..c13e471167 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -268,7 +268,7 @@ android.hardware.graphics.allocator - 1 + 1-2 IAllocator default @@ -282,7 +282,7 @@ default - + android.hardware.graphics.mapper 2.1 diff --git a/graphics/Android.bp b/graphics/Android.bp index 1e9089f165..4898dbecf2 100644 --- a/graphics/Android.bp +++ b/graphics/Android.bp @@ -19,14 +19,14 @@ package { cc_defaults { name: "android.hardware.graphics.allocator-ndk_static", static_libs: [ - "android.hardware.graphics.allocator-V1-ndk", + "android.hardware.graphics.allocator-V2-ndk", ], } cc_defaults { name: "android.hardware.graphics.allocator-ndk_shared", shared_libs: [ - "android.hardware.graphics.allocator-V1-ndk", + "android.hardware.graphics.allocator-V2-ndk", ], } diff --git a/graphics/allocator/aidl/Android.bp b/graphics/allocator/aidl/Android.bp index 9bdc7a681d..098ef172ce 100644 --- a/graphics/allocator/aidl/Android.bp +++ b/graphics/allocator/aidl/Android.bp @@ -14,7 +14,7 @@ aidl_interface { enabled: true, support_system_process: true, }, - vndk_use_version: "1", + vndk_use_version: "2", srcs: ["android/hardware/graphics/allocator/*.aidl"], imports: [ "android.hardware.common-V2", diff --git a/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/current/android/hardware/graphics/allocator/BufferDescriptorInfo.aidl b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/current/android/hardware/graphics/allocator/BufferDescriptorInfo.aidl new file mode 100644 index 0000000000..980e246bb8 --- /dev/null +++ b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/current/android/hardware/graphics/allocator/BufferDescriptorInfo.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.graphics.allocator; +@VintfStability +parcelable BufferDescriptorInfo { + byte[128] name; + int width; + int height; + int layerCount; + android.hardware.graphics.common.PixelFormat format = android.hardware.graphics.common.PixelFormat.UNSPECIFIED; + android.hardware.graphics.common.BufferUsage usage = android.hardware.graphics.common.BufferUsage.CPU_READ_NEVER; + long reservedSize; +} diff --git a/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/current/android/hardware/graphics/allocator/IAllocator.aidl b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/current/android/hardware/graphics/allocator/IAllocator.aidl index fe0b0a214b..48bef16fb5 100644 --- a/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/current/android/hardware/graphics/allocator/IAllocator.aidl +++ b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/current/android/hardware/graphics/allocator/IAllocator.aidl @@ -34,5 +34,11 @@ package android.hardware.graphics.allocator; @VintfStability interface IAllocator { + /** + * @deprecated As of android.hardware.graphics.allocator-V2, this is deprecated & replaced with allocate2 + */ android.hardware.graphics.allocator.AllocationResult allocate(in byte[] descriptor, in int count); + android.hardware.graphics.allocator.AllocationResult allocate2(in android.hardware.graphics.allocator.BufferDescriptorInfo descriptor, in int count); + boolean isSupported(in android.hardware.graphics.allocator.BufferDescriptorInfo descriptor); + String getIMapperLibrarySuffix(); } diff --git a/graphics/allocator/aidl/android/hardware/graphics/allocator/BufferDescriptorInfo.aidl b/graphics/allocator/aidl/android/hardware/graphics/allocator/BufferDescriptorInfo.aidl new file mode 100644 index 0000000000..ffc50b8541 --- /dev/null +++ b/graphics/allocator/aidl/android/hardware/graphics/allocator/BufferDescriptorInfo.aidl @@ -0,0 +1,65 @@ +/* + * Copyright 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. + */ + +package android.hardware.graphics.allocator; + +import android.hardware.graphics.common.BufferUsage; +import android.hardware.graphics.common.PixelFormat; + +@VintfStability +parcelable BufferDescriptorInfo { + /** + * The name of the buffer in ASCII. Useful for debugging/tracing. + */ + byte[128] name; + + /** + * The width specifies how many columns of pixels must be in the + * allocated buffer, but does not necessarily represent the offset in + * columns between the same column in adjacent rows. The rows may be + * padded. + */ + int width; + + /** + * The height specifies how many rows of pixels must be in the + * allocated buffer. + */ + int height; + + /** + * The number of image layers that must be in the allocated buffer. + */ + int layerCount; + + /** + * Buffer pixel format. See PixelFormat.aidl in graphics/common for + * valid values + */ + PixelFormat format = PixelFormat.UNSPECIFIED; + + /** + * Buffer usage mask; valid flags can be found in the definition of + * BufferUsage.aidl in graphics/common + */ + BufferUsage usage = BufferUsage.CPU_READ_NEVER; + + /** + * The size in bytes of the reserved region associated with the buffer. + * See getReservedRegion for more information. + */ + long reservedSize; +} diff --git a/graphics/allocator/aidl/android/hardware/graphics/allocator/IAllocator.aidl b/graphics/allocator/aidl/android/hardware/graphics/allocator/IAllocator.aidl index 92dfd4f8ab..71cebd6717 100644 --- a/graphics/allocator/aidl/android/hardware/graphics/allocator/IAllocator.aidl +++ b/graphics/allocator/aidl/android/hardware/graphics/allocator/IAllocator.aidl @@ -17,6 +17,7 @@ package android.hardware.graphics.allocator; import android.hardware.graphics.allocator.AllocationResult; +import android.hardware.graphics.allocator.BufferDescriptorInfo; @VintfStability interface IAllocator { @@ -31,6 +32,43 @@ interface IAllocator { * @param count The number of buffers to allocate. * @return An AllocationResult containing the result of the allocation * @throws AllocationError on failure + * @deprecated As of android.hardware.graphics.allocator-V2, this is deprecated & replaced with + * allocate2 */ AllocationResult allocate(in byte[] descriptor, in int count); + + /** + * Allocates buffers with the properties specified by the descriptor. + * + * Allocations should be optimized for usage bits provided in the + * descriptor. + * + * @param descriptor Properties of the buffers to allocate. This must be + * obtained from IMapper::createDescriptor(). + * @param count The number of buffers to allocate. + * @return An AllocationResult containing the result of the allocation + * @throws AllocationError on failure + */ + AllocationResult allocate2(in BufferDescriptorInfo descriptor, in int count); + + /** + * Test whether the given BufferDescriptorInfo is allocatable. + * + * If this function returns true, it means that a buffer with the given + * description can be allocated on this implementation, unless resource + * exhaustion occurs. If this function returns false, it means that the + * allocation of the given description will never succeed. + * + * @param description the description of the buffer + * @return supported whether the description is supported + */ + boolean isSupported(in BufferDescriptorInfo descriptor); + + /** + * Retrieve the library suffix to load for the IMapper SP-HAL. This library must implement the + * IMapper stable-C interface (android/hardware/graphics/mapper/IMapper.h). + * + * The library that will attempt to be loaded is "/vendor/lib[64]/hw/mapper..so" + */ + String getIMapperLibrarySuffix(); } diff --git a/graphics/allocator/aidl/vts/Android.bp b/graphics/allocator/aidl/vts/Android.bp index a38af14730..630ab2a2f0 100644 --- a/graphics/allocator/aidl/vts/Android.bp +++ b/graphics/allocator/aidl/vts/Android.bp @@ -55,6 +55,7 @@ cc_test { ], header_libs: [ "libhwui_internal_headers", + "libimapper_stablec", ], cflags: [ "-Wall", diff --git a/graphics/allocator/aidl/vts/VtsHalGraphicsAllocatorAidl_TargetTest.cpp b/graphics/allocator/aidl/vts/VtsHalGraphicsAllocatorAidl_TargetTest.cpp index 59af5cf375..09f1c1566b 100644 --- a/graphics/allocator/aidl/vts/VtsHalGraphicsAllocatorAidl_TargetTest.cpp +++ b/graphics/allocator/aidl/vts/VtsHalGraphicsAllocatorAidl_TargetTest.cpp @@ -25,7 +25,10 @@ #include #include #include +#include #include +#include +#include #include #include #include @@ -33,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -42,60 +46,70 @@ using namespace aidl::android::hardware::graphics::allocator; using namespace aidl::android::hardware::graphics::common; using namespace android; using namespace android::hardware; -using namespace android::hardware::graphics::mapper::V4_0; +using IMapper4 = android::hardware::graphics::mapper::V4_0::IMapper; +using Error = android::hardware::graphics::mapper::V4_0::Error; +using android::hardware::graphics::mapper::V4_0::BufferDescriptor; using android::uirenderer::AutoEglImage; using android::uirenderer::AutoGLFramebuffer; using android::uirenderer::AutoSkiaGlTexture; using android::uirenderer::renderthread::EglManager; -static constexpr uint64_t pack(const std::initializer_list& usages) { - uint64_t ret = 0; - for (const auto u : usages) { - ret |= static_cast(u); - } - return ret; +typedef AIMapper_Error (*AIMapper_loadIMapperFn)(AIMapper* _Nullable* _Nonnull outImplementation); + +inline BufferUsage operator|(BufferUsage lhs, BufferUsage rhs) { + using T = std::underlying_type_t; + return static_cast(static_cast(lhs) | static_cast(rhs)); } -static constexpr hardware::graphics::common::V1_2::PixelFormat cast(PixelFormat format) { - return static_cast(format); +inline BufferUsage& operator|=(BufferUsage& lhs, BufferUsage rhs) { + lhs = lhs | rhs; + return lhs; } +static IMapper4::BufferDescriptorInfo convert(const BufferDescriptorInfo& info) { + return IMapper4::BufferDescriptorInfo{ + .name{reinterpret_cast(info.name.data())}, + .width = static_cast(info.width), + .height = static_cast(info.height), + .layerCount = static_cast(info.layerCount), + .format = static_cast(info.format), + .usage = static_cast(info.usage), + .reservedSize = 0, + }; +} + +class GraphicsTestsBase; + class BufferHandle { - sp mMapper; + GraphicsTestsBase& mTestBase; native_handle_t* mRawHandle; bool mImported = false; uint32_t mStride; - const IMapper::BufferDescriptorInfo mInfo; + const BufferDescriptorInfo mInfo; BufferHandle(const BufferHandle&) = delete; void operator=(const BufferHandle&) = delete; public: - BufferHandle(const sp mapper, native_handle_t* handle, bool imported, uint32_t stride, - const IMapper::BufferDescriptorInfo& info) - : mMapper(mapper), mRawHandle(handle), mImported(imported), mStride(stride), mInfo(info) {} + BufferHandle(GraphicsTestsBase& testBase, native_handle_t* handle, bool imported, + uint32_t stride, const BufferDescriptorInfo& info) + : mTestBase(testBase), + mRawHandle(handle), + mImported(imported), + mStride(stride), + mInfo(info) {} - ~BufferHandle() { - if (mRawHandle == nullptr) return; - - if (mImported) { - Error error = mMapper->freeBuffer(mRawHandle); - EXPECT_EQ(Error::NONE, error) << "failed to free buffer " << mRawHandle; - } else { - native_handle_close(mRawHandle); - native_handle_delete(mRawHandle); - } - } + ~BufferHandle(); uint32_t stride() const { return mStride; } AHardwareBuffer_Desc describe() const { return { - .width = mInfo.width, - .height = mInfo.height, - .layers = mInfo.layerCount, + .width = static_cast(mInfo.width), + .height = static_cast(mInfo.height), + .layers = static_cast(mInfo.layerCount), .format = static_cast(mInfo.format), - .usage = mInfo.usage, + .usage = static_cast(mInfo.usage), .stride = stride(), .rfu0 = 0, .rfu1 = 0, @@ -114,25 +128,43 @@ class BufferHandle { class GraphicsTestsBase { private: + friend class BufferHandle; + int32_t mIAllocatorVersion = 1; std::shared_ptr mAllocator; - sp mMapper; + sp mMapper4; + AIMapper* mAIMapper = nullptr; protected: - void Initialize(std::string allocatorService, std::string mapperService) { + void Initialize(std::string allocatorService) { mAllocator = IAllocator::fromBinder( ndk::SpAIBinder(AServiceManager_checkService(allocatorService.c_str()))); - mMapper = IMapper::getService(mapperService); + ASSERT_TRUE(mAllocator->getInterfaceVersion(&mIAllocatorVersion).isOk()); + if (mIAllocatorVersion >= 2) { + std::string mapperSuffix; + auto status = mAllocator->getIMapperLibrarySuffix(&mapperSuffix); + ASSERT_TRUE(status.isOk()); + std::string lib_name = "mapper." + mapperSuffix + ".so"; + void* so = android_load_sphal_library(lib_name.c_str(), RTLD_LOCAL | RTLD_NOW); + ASSERT_NE(nullptr, so) << "Failed to load " << lib_name; + auto loadIMapper = (AIMapper_loadIMapperFn)dlsym(so, "AIMapper_loadIMapper"); + ASSERT_NE(nullptr, loadIMapper) << "AIMapper_locaIMapper missing from " << lib_name; + ASSERT_EQ(AIMAPPER_ERROR_NONE, loadIMapper(&mAIMapper)); + ASSERT_NE(mAIMapper, nullptr); + } else { + // Don't have IMapper 5, fall back to IMapper 4 + mMapper4 = IMapper4::getService(); + ASSERT_NE(nullptr, mMapper4.get()) << "failed to get mapper service"; + ASSERT_FALSE(mMapper4->isRemote()) << "mapper is not in passthrough mode"; + } ASSERT_NE(nullptr, mAllocator.get()) << "failed to get allocator service"; - ASSERT_NE(nullptr, mMapper.get()) << "failed to get mapper service"; - ASSERT_FALSE(mMapper->isRemote()) << "mapper is not in passthrough mode"; } - public: - BufferDescriptor createDescriptor(const IMapper::BufferDescriptorInfo& descriptorInfo) { + private: + BufferDescriptor createDescriptor(const BufferDescriptorInfo& descriptorInfo) { BufferDescriptor descriptor; - mMapper->createDescriptor( - descriptorInfo, [&](const auto& tmpError, const auto& tmpDescriptor) { + mMapper4->createDescriptor( + convert(descriptorInfo), [&](const auto& tmpError, const auto& tmpDescriptor) { ASSERT_EQ(Error::NONE, tmpError) << "failed to create descriptor"; descriptor = tmpDescriptor; }); @@ -140,14 +172,22 @@ class GraphicsTestsBase { return descriptor; } - std::unique_ptr allocate(const IMapper::BufferDescriptorInfo& descriptorInfo) { - auto descriptor = createDescriptor(descriptorInfo); - if (::testing::Test::HasFatalFailure()) { - return nullptr; - } - + public: + std::unique_ptr allocate(const BufferDescriptorInfo& descriptorInfo) { AllocationResult result; - auto status = mAllocator->allocate(descriptor, 1, &result); + ::ndk::ScopedAStatus status; + if (mIAllocatorVersion >= 2) { + status = mAllocator->allocate2(descriptorInfo, 1, &result); + } else { + auto descriptor = createDescriptor(descriptorInfo); + if (::testing::Test::HasFatalFailure()) { + return nullptr; + } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + status = mAllocator->allocate(descriptor, 1, &result); +#pragma clang diagnostic pop // deprecation + } if (!status.isOk()) { status_t error = status.getExceptionCode(); if (error == EX_SERVICE_SPECIFIC) { @@ -158,28 +198,48 @@ class GraphicsTestsBase { } return nullptr; } else { - return std::make_unique(mMapper, dupFromAidl(result.buffers[0]), false, + return std::make_unique(*this, dupFromAidl(result.buffers[0]), false, result.stride, descriptorInfo); } } - bool isSupported(const IMapper::BufferDescriptorInfo& descriptorInfo) { + bool isSupported(const BufferDescriptorInfo& descriptorInfo) { bool ret = false; - EXPECT_TRUE(mMapper->isSupported(descriptorInfo, - [&](auto error, bool supported) { - ASSERT_EQ(Error::NONE, error); - ret = supported; - }) - .isOk()); + if (mIAllocatorVersion >= 2) { + EXPECT_TRUE(mAllocator->isSupported(descriptorInfo, &ret).isOk()); + } else { + EXPECT_TRUE(mMapper4->isSupported(convert(descriptorInfo), + [&](auto error, bool supported) { + ASSERT_EQ(Error::NONE, error); + ret = supported; + }) + .isOk()); + } return ret; } }; -class GraphicsAllocatorAidlTests - : public GraphicsTestsBase, - public ::testing::TestWithParam> { +BufferHandle::~BufferHandle() { + if (mRawHandle == nullptr) return; + + if (mImported) { + if (mTestBase.mAIMapper) { + AIMapper_Error error = mTestBase.mAIMapper->v5.freeBuffer(mRawHandle); + EXPECT_EQ(AIMAPPER_ERROR_NONE, error); + } else { + Error error = mTestBase.mMapper4->freeBuffer(mRawHandle); + EXPECT_EQ(Error::NONE, error) << "failed to free buffer " << mRawHandle; + } + } else { + native_handle_close(mRawHandle); + native_handle_delete(mRawHandle); + } +} + +class GraphicsAllocatorAidlTests : public GraphicsTestsBase, + public ::testing::TestWithParam { public: - void SetUp() override { Initialize(std::get<0>(GetParam()), std::get<1>(GetParam())); } + void SetUp() override { Initialize(GetParam()); } void TearDown() override {} }; @@ -191,22 +251,22 @@ struct FlushMethod { class GraphicsFrontBufferTests : public GraphicsTestsBase, - public ::testing::TestWithParam> { + public ::testing::TestWithParam> { private: EglManager eglManager; std::function flush; public: void SetUp() override { - Initialize(std::get<0>(GetParam()), std::get<1>(GetParam())); - flush = std::get<2>(GetParam()).func; + Initialize(std::get<0>(GetParam())); + flush = std::get<1>(GetParam()).func; eglManager.initialize(); } void TearDown() override { eglManager.destroy(); } void fillWithGpu(AHardwareBuffer* buffer, float red, float green, float blue, float alpha) { - const EGLClientBuffer clientBuffer = eglGetNativeClientBufferANDROID(buffer); + EGLClientBuffer clientBuffer = eglGetNativeClientBufferANDROID(buffer); AutoEglImage eglImage(eglManager.eglDisplay(), clientBuffer); AutoSkiaGlTexture glTexture; AutoGLFramebuffer glFbo; @@ -235,26 +295,14 @@ class GraphicsFrontBufferTests } }; -TEST_P(GraphicsAllocatorAidlTests, CreateDescriptorBasic) { - ASSERT_NO_FATAL_FAILURE(createDescriptor({ - .name = "CPU_8888", - .width = 64, - .height = 64, - .layerCount = 1, - .format = cast(PixelFormat::RGBA_8888), - .usage = pack({BufferUsage::CPU_WRITE_OFTEN, BufferUsage::CPU_READ_OFTEN}), - .reservedSize = 0, - })); -} - TEST_P(GraphicsAllocatorAidlTests, CanAllocate) { auto buffer = allocate({ - .name = "CPU_8888", + .name = {"CPU_8888"}, .width = 64, .height = 64, .layerCount = 1, - .format = cast(PixelFormat::RGBA_8888), - .usage = pack({BufferUsage::CPU_WRITE_OFTEN, BufferUsage::CPU_READ_OFTEN}), + .format = PixelFormat::RGBA_8888, + .usage = BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN, .reservedSize = 0, }); ASSERT_NE(nullptr, buffer.get()); @@ -262,14 +310,14 @@ TEST_P(GraphicsAllocatorAidlTests, CanAllocate) { } TEST_P(GraphicsFrontBufferTests, FrontBufferGpuToCpu) { - IMapper::BufferDescriptorInfo info{ - .name = "CPU_8888", + BufferDescriptorInfo info{ + .name = {"CPU_8888"}, .width = 64, .height = 64, .layerCount = 1, - .format = cast(PixelFormat::RGBA_8888), - .usage = pack({BufferUsage::GPU_RENDER_TARGET, BufferUsage::CPU_READ_OFTEN, - BufferUsage::FRONT_BUFFER}), + .format = PixelFormat::RGBA_8888, + .usage = BufferUsage::GPU_RENDER_TARGET | BufferUsage::CPU_READ_OFTEN | + BufferUsage::FRONT_BUFFER, .reservedSize = 0, }; const bool supported = isSupported(info); @@ -304,14 +352,14 @@ TEST_P(GraphicsFrontBufferTests, FrontBufferGpuToCpu) { } TEST_P(GraphicsFrontBufferTests, FrontBufferGpuToGpu) { - IMapper::BufferDescriptorInfo info{ - .name = "CPU_8888", + BufferDescriptorInfo info{ + .name = {"CPU_8888"}, .width = 64, .height = 64, .layerCount = 1, - .format = cast(PixelFormat::RGBA_8888), - .usage = pack({BufferUsage::GPU_RENDER_TARGET, BufferUsage::GPU_TEXTURE, - BufferUsage::FRONT_BUFFER}), + .format = PixelFormat::RGBA_8888, + .usage = BufferUsage::GPU_RENDER_TARGET | BufferUsage::GPU_TEXTURE | + BufferUsage::FRONT_BUFFER, .reservedSize = 0, }; const bool supported = isSupported(info); @@ -344,11 +392,9 @@ TEST_P(GraphicsFrontBufferTests, FrontBufferGpuToGpu) { } GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsAllocatorAidlTests); -INSTANTIATE_TEST_CASE_P( - PerInstance, GraphicsAllocatorAidlTests, - testing::Combine(testing::ValuesIn(getAidlHalInstanceNames(IAllocator::descriptor)), - testing::ValuesIn(getAllHalInstanceNames(IMapper::descriptor))), - PrintInstanceTupleNameToString<>); +INSTANTIATE_TEST_CASE_P(PerInstance, GraphicsAllocatorAidlTests, + testing::ValuesIn(getAidlHalInstanceNames(IAllocator::descriptor)), + PrintInstanceNameToString); const auto FlushMethodsValues = testing::Values( FlushMethod{"glFinish", [](EglManager&) { glFinish(); }}, @@ -362,7 +408,7 @@ const auto FlushMethodsValues = testing::Values( }}, FlushMethod{"eglClientWaitSync", [](EglManager& eglManager) { EGLDisplay display = eglManager.eglDisplay(); - EGLSyncKHR fence = eglCreateSyncKHR(display, EGL_SYNC_FENCE_KHR, NULL); + EGLSyncKHR fence = eglCreateSyncKHR(display, EGL_SYNC_FENCE_KHR, nullptr); eglClientWaitSyncKHR(display, fence, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, EGL_FOREVER_KHR); eglDestroySyncKHR(display, fence); @@ -371,9 +417,8 @@ GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsFrontBufferTests); INSTANTIATE_TEST_CASE_P( PerInstance, GraphicsFrontBufferTests, testing::Combine(testing::ValuesIn(getAidlHalInstanceNames(IAllocator::descriptor)), - testing::ValuesIn(getAllHalInstanceNames(IMapper::descriptor)), FlushMethodsValues), [](auto info) -> std::string { - std::string name = std::to_string(info.index) + "/" + std::get<2>(info.param).name; + std::string name = std::to_string(info.index) + "/" + std::get<1>(info.param).name; return Sanitize(name); - }); + }); \ No newline at end of file diff --git a/graphics/mapper/stable-c/Android.bp b/graphics/mapper/stable-c/Android.bp new file mode 100644 index 0000000000..c03f67ea47 --- /dev/null +++ b/graphics/mapper/stable-c/Android.bp @@ -0,0 +1,104 @@ +/** + * 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. + */ + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_library_headers { + name: "libimapper_stablec", + export_include_dirs: ["include"], + vendor_available: true, + header_libs: [ + "libarect_headers", + ], + export_header_lib_headers: [ + "libarect_headers", + ], +} + +cc_library_headers { + name: "libimapper_providerutils", + vendor_available: true, + export_include_dirs: ["implutils/include"], + header_libs: [ + "libbase_headers", + "libimapper_stablec", + ], + export_header_lib_headers: [ + "libbase_headers", + "libimapper_stablec", + ], +} + +cc_test { + name: "libimapper_providerutils_tests", + defaults: [ + "android.hardware.graphics.allocator-ndk_shared", + "android.hardware.graphics.common-ndk_shared", + ], + header_libs: [ + "libimapper_providerutils", + ], + srcs: [ + "implutils/impltests.cpp", + ], + visibility: [":__subpackages__"], + cpp_std: "experimental", +} + +cc_test { + name: "VtsHalGraphicsMapperStableC_TargetTest", + cpp_std: "experimental", + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + "android.hardware.graphics.allocator-ndk_shared", + "android.hardware.graphics.common-ndk_shared", + ], + srcs: [ + "vts/VtsHalGraphicsMapperStableC_TargetTest.cpp", + ], + + shared_libs: [ + "libbinder_ndk", + "libbase", + "libsync", + "libvndksupport", + ], + static_libs: [ + "libaidlcommonsupport", + "libgralloctypes", + "libgtest", + ], + header_libs: [ + "libimapper_stablec", + "libimapper_providerutils", + ], + cflags: [ + "-Wall", + "-Werror", + ], + test_suites: [ + "general-tests", + "vts", + ], +} diff --git a/graphics/mapper/stable-c/implutils/impltests.cpp b/graphics/mapper/stable-c/implutils/impltests.cpp new file mode 100644 index 0000000000..9c5d70b498 --- /dev/null +++ b/graphics/mapper/stable-c/implutils/impltests.cpp @@ -0,0 +1,314 @@ +/* + * 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. + */ + +#include + +#include +#include +#include + +using namespace ::android::hardware::graphics::mapper; +using namespace ::aidl::android::hardware::graphics::common; + +// These tests are primarily interested in hitting all the different *types* that can be +// serialized/deserialized than in exhaustively testing all the StandardMetadataTypes. +// Exhaustive testing of the actual metadata types is relegated for IMapper's VTS suite +// where meaning & correctness of values are more narrowly defined (eg, read-only values) + +TEST(Metadata, setGetBufferId) { + using BufferId = StandardMetadata::value; + + std::vector buffer; + buffer.resize(12, 0); + *reinterpret_cast(buffer.data()) = 42; + + EXPECT_EQ(8, BufferId::encode(18, buffer.data(), 0)); + EXPECT_EQ(42, *reinterpret_cast(buffer.data())); + EXPECT_EQ(8, BufferId::encode(18, buffer.data(), buffer.size())); + EXPECT_EQ(18, *reinterpret_cast(buffer.data())); + EXPECT_FALSE(BufferId::decode(buffer.data(), 0)); + auto read = BufferId::decode(buffer.data(), buffer.size()); + EXPECT_TRUE(read.has_value()); + EXPECT_EQ(18, read.value_or(0)); +} + +TEST(Metadata, setGetDataspace) { + using DataspaceValue = StandardMetadata::value; + using intType = std::underlying_type_t; + std::vector buffer; + buffer.resize(12, 0); + + EXPECT_EQ(4, DataspaceValue::encode(Dataspace::BT2020, buffer.data(), 0)); + EXPECT_EQ(0, *reinterpret_cast(buffer.data())); + EXPECT_EQ(4, DataspaceValue::encode(Dataspace::BT2020, buffer.data(), buffer.size())); + EXPECT_EQ(static_cast(Dataspace::BT2020), *reinterpret_cast(buffer.data())); + EXPECT_FALSE(DataspaceValue::decode(buffer.data(), 0)); + auto read = DataspaceValue::decode(buffer.data(), buffer.size()); + ASSERT_TRUE(read.has_value()); + EXPECT_EQ(Dataspace::BT2020, *read); +} + +TEST(Metadata, setGetValidName) { + using NameValue = StandardMetadata::value; + + std::vector buffer; + buffer.resize(100, 'a'); + buffer[buffer.size() - 1] = '\0'; + + // len("Hello") + sizeof(int64) + constexpr int expectedSize = 5 + sizeof(int64_t); + EXPECT_EQ(expectedSize, NameValue::encode("Hello", buffer.data(), buffer.size())); + EXPECT_EQ(5, *reinterpret_cast(buffer.data())); + // Verify didn't write past the end of the desired size + EXPECT_EQ('a', buffer[expectedSize]); + + auto readValue = NameValue::decode(buffer.data(), buffer.size()); + ASSERT_TRUE(readValue.has_value()); + EXPECT_EQ(5, readValue->length()); + EXPECT_EQ("Hello", *readValue); +} + +TEST(Metadata, setGetInvalidName) { + using NameValue = StandardMetadata::value; + + std::vector buffer; + buffer.resize(12, 'a'); + buffer[buffer.size() - 1] = '\0'; + + // len("This is a long string") + sizeof(int64) + constexpr int expectedSize = 21 + sizeof(int64_t); + EXPECT_EQ(expectedSize, + NameValue::encode("This is a long string", buffer.data(), buffer.size())); + EXPECT_EQ(21, *reinterpret_cast(buffer.data())); + // Verify didn't write the too-long string + EXPECT_EQ('a', buffer[9]); + EXPECT_EQ('\0', buffer[buffer.size() - 1]); + + auto readValue = NameValue::decode(buffer.data(), buffer.size()); + EXPECT_FALSE(readValue.has_value()); + readValue = NameValue::decode(buffer.data(), 0); + ASSERT_FALSE(readValue.has_value()); +} + +TEST(Metadata, wouldOverflowName) { + using NameValue = StandardMetadata::value; + std::vector buffer(100, 0); + + // int_max + sizeof(int64) overflows int32 + std::string_view bad_string{"badbeef", std::numeric_limits::max()}; + EXPECT_EQ(-AIMAPPER_ERROR_BAD_VALUE, + NameValue::encode(bad_string, buffer.data(), buffer.size())); + + // check barely overflows + bad_string = std::string_view{"badbeef", std::numeric_limits::max() - 7}; + EXPECT_EQ(-AIMAPPER_ERROR_BAD_VALUE, + NameValue::encode(bad_string, buffer.data(), buffer.size())); +} + +TEST(Metadata, setGetCompression) { + using CompressionValue = StandardMetadata::value; + ExtendableType myCompression{"bestest_compression_ever", 42}; + std::vector buffer(100, '\0'); + const int expectedSize = myCompression.name.length() + sizeof(int64_t) + sizeof(int64_t); + EXPECT_EQ(expectedSize, CompressionValue::encode(myCompression, buffer.data(), 0)); + EXPECT_EQ(0, buffer[0]); + EXPECT_EQ(expectedSize, CompressionValue::encode(myCompression, buffer.data(), buffer.size())); + EXPECT_EQ(myCompression.name.length(), *reinterpret_cast(buffer.data())); + EXPECT_FALSE(CompressionValue::decode(buffer.data(), 0).has_value()); + auto read = CompressionValue::decode(buffer.data(), buffer.size()); + ASSERT_TRUE(read.has_value()); + EXPECT_EQ(myCompression, read.value()); +} + +TEST(Metadata, setGetPlaneLayout) { + using PlaneLayoutValue = StandardMetadata::value; + PlaneLayout myPlaneLayout; + myPlaneLayout.offsetInBytes = 10; + myPlaneLayout.sampleIncrementInBits = 11; + myPlaneLayout.strideInBytes = 12; + myPlaneLayout.widthInSamples = 13; + myPlaneLayout.heightInSamples = 14; + myPlaneLayout.totalSizeInBytes = 15; + myPlaneLayout.horizontalSubsampling = 16; + myPlaneLayout.verticalSubsampling = 17; + + myPlaneLayout.components.resize(3); + for (int i = 0; i < myPlaneLayout.components.size(); i++) { + auto& it = myPlaneLayout.components[i]; + it.type = ExtendableType{"Plane ID", 40 + i}; + it.offsetInBits = 20 + i; + it.sizeInBits = 30 + i; + } + + std::vector layouts{myPlaneLayout, PlaneLayout{}}; + + std::vector buffer(5000, '\0'); + constexpr int componentSize = 8 + (4 * sizeof(int64_t)); + constexpr int firstLayoutSize = (8 + 1) * sizeof(int64_t) + (3 * componentSize); + constexpr int secondLayoutSize = (8 + 1) * sizeof(int64_t); + constexpr int expectedSize = firstLayoutSize + secondLayoutSize + sizeof(int64_t); + EXPECT_EQ(expectedSize, PlaneLayoutValue::encode(layouts, buffer.data(), 0)); + EXPECT_EQ(0, buffer[0]); + EXPECT_EQ(expectedSize, PlaneLayoutValue::encode(layouts, buffer.data(), buffer.size())); + EXPECT_EQ(3, reinterpret_cast(buffer.data())[1]); + EXPECT_EQ(8, reinterpret_cast(buffer.data())[2]); + EXPECT_EQ(40, reinterpret_cast(buffer.data())[4]); + EXPECT_EQ(31, reinterpret_cast(buffer.data())[11]); + EXPECT_EQ(22, reinterpret_cast(buffer.data())[15]); + EXPECT_EQ(10, reinterpret_cast(buffer.data())[17]); + EXPECT_EQ(11, reinterpret_cast(buffer.data())[18]); + EXPECT_FALSE(PlaneLayoutValue::decode(buffer.data(), 0).has_value()); + auto read = PlaneLayoutValue::decode(buffer.data(), buffer.size()); + ASSERT_TRUE(read.has_value()); + EXPECT_EQ(layouts, *read); +} + +TEST(Metadata, setGetRects) { + using RectsValue = StandardMetadata::value; + std::vector buffer(500, 0); + std::vector cropRects{2}; + cropRects[0] = Rect{10, 11, 12, 13}; + cropRects[1] = Rect{20, 21, 22, 23}; + + constexpr int expectedSize = sizeof(int64_t) + (8 * sizeof(int32_t)); + EXPECT_EQ(expectedSize, RectsValue::encode(cropRects, buffer.data(), buffer.size())); + EXPECT_EQ(2, reinterpret_cast(buffer.data())[0]); + EXPECT_EQ(10, reinterpret_cast(buffer.data())[2]); + auto read = RectsValue::decode(buffer.data(), buffer.size()); + ASSERT_TRUE(read.has_value()); + EXPECT_EQ(cropRects.size(), read->size()); + EXPECT_EQ(cropRects, *read); +} + +TEST(Metadata, setGetSmpte2086) { + using Smpte2086Value = StandardMetadata::value; + Smpte2086 source; + source.minLuminance = 12.335f; + source.maxLuminance = 452.889f; + source.whitePoint = XyColor{-6.f, -9.f}; + source.primaryRed = XyColor{.1f, .2f}; + source.primaryGreen = XyColor{.3f, .4f}; + source.primaryBlue = XyColor{.5f, .6f}; + + constexpr int expectedSize = 10 * sizeof(float); + std::vector buffer(500, 0); + EXPECT_EQ(expectedSize, Smpte2086Value::encode(source, buffer.data(), buffer.size())); + auto read = Smpte2086Value::decode(buffer.data(), buffer.size()); + ASSERT_TRUE(read.has_value()); + ASSERT_TRUE(read->has_value()); + EXPECT_EQ(source, read->value()); + + // A valid encoding of a nullopt + read = Smpte2086Value::decode(nullptr, 0); + ASSERT_TRUE(read.has_value()); + EXPECT_FALSE(read->has_value()); +} + +TEST(Metadata, setGetCta861_3) { + using Cta861_3Value = StandardMetadata::value; + Cta861_3 source; + source.maxFrameAverageLightLevel = 244.55f; + source.maxContentLightLevel = 202.202f; + + constexpr int expectedSize = 2 * sizeof(float); + std::vector buffer(500, 0); + EXPECT_EQ(expectedSize, Cta861_3Value::encode(source, buffer.data(), buffer.size())); + auto read = Cta861_3Value::decode(buffer.data(), buffer.size()); + ASSERT_TRUE(read.has_value()); + ASSERT_TRUE(read->has_value()); + EXPECT_EQ(source, read->value()); + + // A valid encoding of a nullopt + read = Cta861_3Value::decode(nullptr, 0); + ASSERT_TRUE(read.has_value()); + EXPECT_FALSE(read->has_value()); +} + +TEST(Metadata, setGetSmpte2094_10) { + using SMPTE2094_10Value = StandardMetadata::value; + + std::vector buffer(500, 0); + EXPECT_EQ(0, SMPTE2094_10Value::encode(std::nullopt, buffer.data(), buffer.size())); + auto read = SMPTE2094_10Value::decode(buffer.data(), 0); + ASSERT_TRUE(read.has_value()); + EXPECT_FALSE(read->has_value()); + + const std::vector emptyBuffer; + EXPECT_EQ(sizeof(int64_t), + SMPTE2094_10Value::encode(emptyBuffer, buffer.data(), buffer.size())); + read = SMPTE2094_10Value::decode(buffer.data(), buffer.size()); + ASSERT_TRUE(read.has_value()); + ASSERT_TRUE(read->has_value()); + EXPECT_EQ(0, read->value().size()); + + const std::vector simpleBuffer{0, 1, 2, 3, 4, 5}; + EXPECT_EQ(sizeof(int64_t) + 6, + SMPTE2094_10Value::encode(simpleBuffer, buffer.data(), buffer.size())); + read = SMPTE2094_10Value::decode(buffer.data(), buffer.size()); + ASSERT_TRUE(read.has_value()); + ASSERT_TRUE(read->has_value()); + EXPECT_EQ(6, read->value().size()); + EXPECT_EQ(simpleBuffer, read->value()); +} + +TEST(MetadataProvider, bufferId) { + using BufferId = StandardMetadata::value; + std::vector buffer(500, 0); + int result = provideStandardMetadata(StandardMetadataType::BUFFER_ID, buffer.data(), + buffer.size(), [](auto&& provide) { + if constexpr (T == StandardMetadataType::BUFFER_ID) { + return provide(42); + } + return 0; + }); + + EXPECT_EQ(8, result); + auto read = BufferId::decode(buffer.data(), buffer.size()); + EXPECT_EQ(42, read.value_or(0)); +} + +TEST(MetadataProvider, allJumpsWork) { + const auto& values = ndk::internal::enum_values; + auto get = [](StandardMetadataType type) -> int { + return provideStandardMetadata(type, nullptr, 0, [](auto&&) { + return static_cast(T) + 100; + }); + }; + + for (auto& type : values) { + const int expected = type == StandardMetadataType::INVALID ? -AIMAPPER_ERROR_UNSUPPORTED + : static_cast(type) + 100; + EXPECT_EQ(expected, get(type)); + } +} + +TEST(MetadataProvider, invalid) { + int result = provideStandardMetadata(StandardMetadataType::INVALID, nullptr, 0, + [](auto&&) { return 10; }); + + EXPECT_EQ(-AIMAPPER_ERROR_UNSUPPORTED, result); +} + +TEST(MetadataProvider, outOfBounds) { + int result = provideStandardMetadata(static_cast(-1), nullptr, 0, + [](auto&&) { return 10; }); + EXPECT_EQ(-AIMAPPER_ERROR_UNSUPPORTED, result) << "-1 should have resulted in UNSUPPORTED"; + + result = provideStandardMetadata(static_cast(100), nullptr, 0, + [](auto&&) { return 10; }); + EXPECT_EQ(-AIMAPPER_ERROR_UNSUPPORTED, result) + << "100 (out of range) should have resulted in UNSUPPORTED"; +} diff --git a/graphics/mapper/stable-c/implutils/include/android/hardware/graphics/mapper/utils/IMapperMetadataTypes.h b/graphics/mapper/stable-c/implutils/include/android/hardware/graphics/mapper/utils/IMapperMetadataTypes.h new file mode 100644 index 0000000000..7861af87fc --- /dev/null +++ b/graphics/mapper/stable-c/implutils/include/android/hardware/graphics/mapper/utils/IMapperMetadataTypes.h @@ -0,0 +1,576 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace android::hardware::graphics::mapper { + +using ::aidl::android::hardware::graphics::common::BlendMode; +using ::aidl::android::hardware::graphics::common::BufferUsage; +using ::aidl::android::hardware::graphics::common::Cta861_3; +using ::aidl::android::hardware::graphics::common::Dataspace; +using ::aidl::android::hardware::graphics::common::ExtendableType; +using ::aidl::android::hardware::graphics::common::PixelFormat; +using ::aidl::android::hardware::graphics::common::PlaneLayout; +using ::aidl::android::hardware::graphics::common::PlaneLayoutComponent; +using ::aidl::android::hardware::graphics::common::Rect; +using ::aidl::android::hardware::graphics::common::Smpte2086; +using ::aidl::android::hardware::graphics::common::StandardMetadataType; +using ::aidl::android::hardware::graphics::common::XyColor; + +class MetadataWriter { + private: + uint8_t* _Nonnull mDest; + size_t mSizeRemaining = 0; + int32_t mDesiredSize = 0; + + void* _Nullable reserve(size_t sizeToWrite) { + if (mDesiredSize < 0) { + // Error state + return nullptr; + } + if (__builtin_add_overflow(mDesiredSize, sizeToWrite, &mDesiredSize)) { + // Overflowed, abort writing any further data + mDesiredSize = -AIMAPPER_ERROR_BAD_VALUE; + mSizeRemaining = 0; + return nullptr; + } + if (sizeToWrite > mSizeRemaining) { + mSizeRemaining = 0; + return nullptr; + } else { + mSizeRemaining -= sizeToWrite; + uint8_t* whereToWrite = mDest; + mDest += sizeToWrite; + return whereToWrite; + } + } + + public: + explicit MetadataWriter(void* _Nullable destBuffer, size_t destBufferSize) + : mDest(reinterpret_cast(destBuffer)), mSizeRemaining(destBufferSize) {} + + int32_t desiredSize() const { return mDesiredSize; } + + template >> + MetadataWriter& write(T value) { + auto sizeToWrite = sizeof(T); + if (void* dest = reserve(sizeToWrite)) { + memcpy(dest, &value, sizeToWrite); + } + return *this; + } + + MetadataWriter& write(float value) { + auto sizeToWrite = sizeof(float); + if (void* dest = reserve(sizeToWrite)) { + memcpy(dest, &value, sizeToWrite); + } + return *this; + } + + MetadataWriter& write(const std::string_view& value) { + auto sizeToWrite = value.length(); + write(sizeToWrite); + if (void* dest = reserve(sizeToWrite)) { + memcpy(dest, value.data(), sizeToWrite); + } + return *this; + } + + MetadataWriter& write(const std::vector& value) { + auto sizeToWrite = value.size(); + write(sizeToWrite); + if (void* dest = reserve(sizeToWrite)) { + memcpy(dest, value.data(), sizeToWrite); + } + return *this; + } + + MetadataWriter& write(const ExtendableType& value) { + return write(value.name).write(value.value); + } + + MetadataWriter& write(const XyColor& value) { return write(value.x).write(value.y); } +}; + +class MetadataReader { + private: + const uint8_t* _Nonnull mSrc; + size_t mSizeRemaining = 0; + bool mOk = true; + + const void* _Nullable advance(size_t size) { + if (mOk && mSizeRemaining >= size) { + const void* buf = mSrc; + mSrc += size; + mSizeRemaining -= size; + return buf; + } + mOk = false; + return nullptr; + } + + public: + explicit MetadataReader(const void* _Nonnull metadata, size_t metadataSize) + : mSrc(reinterpret_cast(metadata)), mSizeRemaining(metadataSize) {} + + [[nodiscard]] size_t remaining() const { return mSizeRemaining; } + [[nodiscard]] bool ok() const { return mOk; } + + template >> + MetadataReader& read(T& dest) { + if (const void* src = advance(sizeof(T))) { + memcpy(&dest, src, sizeof(T)); + } + return *this; + } + + MetadataReader& read(float& dest) { + if (const void* src = advance(sizeof(float))) { + memcpy(&dest, src, sizeof(float)); + } + return *this; + } + + MetadataReader& read(std::string& dest) { + dest = readString(); + return *this; + } + + MetadataReader& read(ExtendableType& dest) { + dest.name = readString(); + read(dest.value); + return *this; + } + + MetadataReader& read(XyColor& dest) { + read(dest.x); + read(dest.y); + return *this; + } + + template >> + [[nodiscard]] std::optional readInt() { + auto sizeToRead = sizeof(T); + if (const void* src = advance(sizeof(T))) { + T ret; + memcpy(&ret, src, sizeToRead); + return ret; + } + return std::nullopt; + } + + [[nodiscard]] std::string_view readString() { + auto lengthOpt = readInt(); + if (!lengthOpt) { + return std::string_view{}; + } + size_t length = lengthOpt.value(); + if (const void* src = advance(length)) { + return std::string_view{reinterpret_cast(src), length}; + } + return std::string_view{}; + } + + [[nodiscard]] std::optional readExtendable() { + ExtendableType ret; + ret.name = readString(); + auto value = readInt(); + if (value) { + ret.value = value.value(); + return ret; + } else { + return std::nullopt; + } + } + + [[nodiscard]] std::vector readBuffer() { + std::vector ret; + size_t length = readInt().value_or(0); + if (const void* src = advance(length)) { + ret.resize(length); + memcpy(ret.data(), src, length); + } + return ret; + } +}; + +template +struct MetadataValue {}; + +template +struct MetadataValue>> { + [[nodiscard]] static int32_t encode(T value, void* _Nullable destBuffer, + size_t destBufferSize) { + return MetadataWriter{destBuffer, destBufferSize}.write(value).desiredSize(); + } + + [[nodiscard]] static std::optional decode(const void* _Nonnull metadata, + size_t metadataSize) { + return MetadataReader{metadata, metadataSize}.readInt(); + } +}; + +template +struct MetadataValue>> { + [[nodiscard]] static int32_t encode(T value, void* _Nullable destBuffer, + size_t destBufferSize) { + return MetadataWriter{destBuffer, destBufferSize} + .write(static_cast>(value)) + .desiredSize(); + } + + [[nodiscard]] static std::optional decode(const void* _Nonnull metadata, + size_t metadataSize) { + std::underlying_type_t temp; + return MetadataReader{metadata, metadataSize}.read(temp).ok() + ? std::optional(static_cast(temp)) + : std::nullopt; + } +}; + +template <> +struct MetadataValue { + [[nodiscard]] static int32_t encode(const std::string_view& value, void* _Nullable destBuffer, + size_t destBufferSize) { + return MetadataWriter{destBuffer, destBufferSize}.write(value).desiredSize(); + } + + [[nodiscard]] static std::optional decode(const void* _Nonnull metadata, + size_t metadataSize) { + auto reader = MetadataReader{metadata, metadataSize}; + auto result = reader.readString(); + return reader.ok() ? std::optional{result} : std::nullopt; + } +}; + +template <> +struct MetadataValue { + static_assert(sizeof(int64_t) == sizeof(ExtendableType::value)); + + [[nodiscard]] static int32_t encode(const ExtendableType& value, void* _Nullable destBuffer, + size_t destBufferSize) { + return MetadataWriter{destBuffer, destBufferSize}.write(value).desiredSize(); + } + + [[nodiscard]] static std::optional decode(const void* _Nonnull metadata, + size_t metadataSize) { + return MetadataReader{metadata, metadataSize}.readExtendable(); + } +}; + +template <> +struct MetadataValue> { + [[nodiscard]] static int32_t encode(const std::vector& values, + void* _Nullable destBuffer, size_t destBufferSize) { + MetadataWriter writer{destBuffer, destBufferSize}; + writer.write(values.size()); + for (const auto& value : values) { + writer.write(value.components.size()); + for (const auto& component : value.components) { + writer.write(component.type) + .write(component.offsetInBits) + .write(component.sizeInBits); + } + writer.write(value.offsetInBytes) + .write(value.sampleIncrementInBits) + .write(value.strideInBytes) + .write(value.widthInSamples) + .write(value.heightInSamples) + .write(value.totalSizeInBytes) + .write(value.horizontalSubsampling) + .write(value.verticalSubsampling); + } + return writer.desiredSize(); + } + + using DecodeResult = std::optional>; + [[nodiscard]] static DecodeResult decode(const void* _Nonnull metadata, size_t metadataSize) { + std::vector values; + MetadataReader reader{metadata, metadataSize}; + auto numPlanes = reader.readInt().value_or(0); + values.reserve(numPlanes); + for (int i = 0; i < numPlanes && reader.ok(); i++) { + PlaneLayout& value = values.emplace_back(); + auto numPlaneComponents = reader.readInt().value_or(0); + value.components.reserve(numPlaneComponents); + for (int i = 0; i < numPlaneComponents && reader.ok(); i++) { + PlaneLayoutComponent& component = value.components.emplace_back(); + reader.read(component.type) + .read(component.offsetInBits) + .read(component.sizeInBits); + } + reader.read(value.offsetInBytes) + .read(value.sampleIncrementInBits) + .read(value.strideInBytes) + .read(value.widthInSamples) + .read(value.heightInSamples) + .read(value.totalSizeInBytes) + .read(value.horizontalSubsampling) + .read(value.verticalSubsampling); + } + return reader.ok() ? DecodeResult{std::move(values)} : std::nullopt; + } +}; + +template <> +struct MetadataValue> { + [[nodiscard]] static int32_t encode(const std::vector& value, void* _Nullable destBuffer, + size_t destBufferSize) { + MetadataWriter writer{destBuffer, destBufferSize}; + writer.write(value.size()); + for (auto& rect : value) { + writer.write(rect.left) + .write(rect.top) + .write(rect.right) + .write(rect.bottom); + } + return writer.desiredSize(); + } + + using DecodeResult = std::optional>; + [[nodiscard]] static DecodeResult decode(const void* _Nonnull metadata, size_t metadataSize) { + MetadataReader reader{metadata, metadataSize}; + std::vector value; + auto numRects = reader.readInt().value_or(0); + value.reserve(numRects); + for (int i = 0; i < numRects && reader.ok(); i++) { + Rect& rect = value.emplace_back(); + reader.read(rect.left) + .read(rect.top) + .read(rect.right) + .read(rect.bottom); + } + return reader.ok() ? DecodeResult{std::move(value)} : std::nullopt; + } +}; + +template <> +struct MetadataValue> { + [[nodiscard]] static int32_t encode(const std::optional& optValue, + void* _Nullable destBuffer, size_t destBufferSize) { + if (optValue.has_value()) { + const auto& value = *optValue; + return MetadataWriter{destBuffer, destBufferSize} + .write(value.primaryRed) + .write(value.primaryGreen) + .write(value.primaryBlue) + .write(value.whitePoint) + .write(value.maxLuminance) + .write(value.minLuminance) + .desiredSize(); + } else { + return 0; + } + } + + // Double optional because the value type itself is an optional<> + using DecodeResult = std::optional>; + [[nodiscard]] static DecodeResult decode(const void* _Nullable metadata, size_t metadataSize) { + std::optional optValue{std::nullopt}; + if (metadataSize > 0) { + Smpte2086 value; + MetadataReader reader{metadata, metadataSize}; + reader.read(value.primaryRed) + .read(value.primaryGreen) + .read(value.primaryBlue) + .read(value.whitePoint) + .read(value.maxLuminance) + .read(value.minLuminance); + if (reader.ok()) { + optValue = std::move(value); + } else { + return std::nullopt; + } + } + return DecodeResult{std::move(optValue)}; + } +}; + +template <> +struct MetadataValue> { + [[nodiscard]] static int32_t encode(const std::optional& optValue, + void* _Nullable destBuffer, size_t destBufferSize) { + if (optValue.has_value()) { + const auto& value = *optValue; + return MetadataWriter{destBuffer, destBufferSize} + .write(value.maxContentLightLevel) + .write(value.maxFrameAverageLightLevel) + .desiredSize(); + } else { + return 0; + } + } + + // Double optional because the value type itself is an optional<> + using DecodeResult = std::optional>; + [[nodiscard]] static DecodeResult decode(const void* _Nullable metadata, size_t metadataSize) { + std::optional optValue{std::nullopt}; + if (metadataSize > 0) { + MetadataReader reader{metadata, metadataSize}; + Cta861_3 value; + reader.read(value.maxContentLightLevel).read(value.maxFrameAverageLightLevel); + if (reader.ok()) { + optValue = std::move(value); + } else { + return std::nullopt; + } + } + return DecodeResult{std::move(optValue)}; + } +}; + +template <> +struct MetadataValue>> { + [[nodiscard]] static int32_t encode(const std::optional>& value, + void* _Nullable destBuffer, size_t destBufferSize) { + if (!value.has_value()) { + return 0; + } + return MetadataWriter{destBuffer, destBufferSize}.write(*value).desiredSize(); + } + + using DecodeResult = std::optional>>; + [[nodiscard]] static DecodeResult decode(const void* _Nonnull metadata, size_t metadataSize) { + std::optional> optValue; + if (metadataSize > 0) { + MetadataReader reader{metadata, metadataSize}; + auto value = reader.readBuffer(); + if (reader.ok()) { + optValue = std::move(value); + } else { + return std::nullopt; + } + } + return DecodeResult{std::move(optValue)}; + } +}; + +template +struct StandardMetadata {}; + +#define DEFINE_TYPE(name, typeArg) \ + template <> \ + struct StandardMetadata { \ + using value_type = typeArg; \ + using value = MetadataValue; \ + static_assert( \ + StandardMetadataType::name == \ + ndk::internal::enum_values[static_cast( \ + StandardMetadataType::name)], \ + "StandardMetadataType must have equivalent value to index"); \ + } + +DEFINE_TYPE(BUFFER_ID, uint64_t); +DEFINE_TYPE(NAME, std::string); +DEFINE_TYPE(WIDTH, uint64_t); +DEFINE_TYPE(HEIGHT, uint64_t); +DEFINE_TYPE(LAYER_COUNT, uint64_t); +DEFINE_TYPE(PIXEL_FORMAT_REQUESTED, PixelFormat); +DEFINE_TYPE(PIXEL_FORMAT_FOURCC, uint32_t); +DEFINE_TYPE(PIXEL_FORMAT_MODIFIER, uint64_t); +DEFINE_TYPE(USAGE, BufferUsage); +DEFINE_TYPE(ALLOCATION_SIZE, uint64_t); +DEFINE_TYPE(PROTECTED_CONTENT, uint64_t); +DEFINE_TYPE(COMPRESSION, ExtendableType); +DEFINE_TYPE(INTERLACED, ExtendableType); +DEFINE_TYPE(CHROMA_SITING, ExtendableType); +DEFINE_TYPE(PLANE_LAYOUTS, std::vector); +DEFINE_TYPE(CROP, std::vector); +DEFINE_TYPE(DATASPACE, Dataspace); +DEFINE_TYPE(BLEND_MODE, BlendMode); +DEFINE_TYPE(SMPTE2086, std::optional); +DEFINE_TYPE(CTA861_3, std::optional); +DEFINE_TYPE(SMPTE2094_10, std::optional>); +DEFINE_TYPE(SMPTE2094_40, std::optional>); + +#undef DEFINE_TYPE + +template +void invokeWithStandardMetadata(F&& f, StandardMetadataType type, std::index_sequence) { + // Setup the jump table, mapping from each type to a springboard that invokes the template + // function with the appropriate concrete type + using F_PTR = decltype(&f); + using THUNK = void (*)(F_PTR); + static constexpr auto jump = std::array{[](F_PTR fp) { + constexpr StandardMetadataType type = ndk::internal::enum_values[I]; + if constexpr (type != StandardMetadataType::INVALID) { + (*fp)(StandardMetadata{}); + } + }...}; + + auto index = static_cast(type); + if (index >= 0 && index < jump.size()) { + jump[index](&f); + } +} + +template .size()>> +int32_t provideStandardMetadata(StandardMetadataType type, void* _Nullable destBuffer, + size_t destBufferSize, F&& f) { + int32_t retVal = -AIMAPPER_ERROR_UNSUPPORTED; + invokeWithStandardMetadata( + [&](StandardMetadata) { + retVal = f.template operator()( + [&](const typename StandardMetadata::value_type& value) -> int32_t { + return StandardMetadata::value::encode(value, destBuffer, + destBufferSize); + }); + }, + type, StandardMetadataSequence{}); + return retVal; +} + +template .size()>> +AIMapper_Error applyStandardMetadata(StandardMetadataType type, const void* _Nonnull metadata, + size_t metadataSize, F&& f) { + AIMapper_Error retVal = AIMAPPER_ERROR_UNSUPPORTED; + invokeWithStandardMetadata( + [&](StandardMetadata) { + auto value = StandardMetadata::value::decode(metadata, metadataSize); + if (value.has_value()) { + retVal = f.template operator()(std::move(*value)); + } else { + retVal = AIMAPPER_ERROR_BAD_VALUE; + } + }, + type, StandardMetadataSequence{}); + return retVal; +} + +} // namespace android::hardware::graphics::mapper \ No newline at end of file diff --git a/graphics/mapper/stable-c/implutils/include/android/hardware/graphics/mapper/utils/IMapperProvider.h b/graphics/mapper/stable-c/implutils/include/android/hardware/graphics/mapper/utils/IMapperProvider.h new file mode 100644 index 0000000000..957fdc95ed --- /dev/null +++ b/graphics/mapper/stable-c/implutils/include/android/hardware/graphics/mapper/utils/IMapperProvider.h @@ -0,0 +1,222 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include + +#include +#include +#include + +/** + * Helper utilities for providing an IMapper-StableC implementation. + */ + +namespace vendor::mapper { + +/** + * Extend from this interface to provide Version 5 of the IMapper interface + */ +struct IMapperV5Impl { + static const auto version = AIMAPPER_VERSION_5; + virtual ~IMapperV5Impl() = default; + + virtual AIMapper_Error importBuffer(const native_handle_t* _Nonnull handle, + buffer_handle_t _Nullable* _Nonnull outBufferHandle) = 0; + + virtual AIMapper_Error freeBuffer(buffer_handle_t _Nonnull buffer) = 0; + + virtual AIMapper_Error getTransportSize(buffer_handle_t _Nonnull buffer, + uint32_t* _Nonnull outNumFds, + uint32_t* _Nonnull outNumInts) = 0; + + virtual AIMapper_Error lock(buffer_handle_t _Nonnull buffer, uint64_t cpuUsage, + ARect accessRegion, int acquireFence, + void* _Nullable* _Nonnull outData) = 0; + + virtual AIMapper_Error unlock(buffer_handle_t _Nonnull buffer, int* _Nonnull releaseFence) = 0; + + virtual AIMapper_Error flushLockedBuffer(buffer_handle_t _Nonnull buffer) = 0; + + virtual AIMapper_Error rereadLockedBuffer(buffer_handle_t _Nonnull buffer) = 0; + + virtual int32_t getMetadata(buffer_handle_t _Nonnull buffer, AIMapper_MetadataType metadataType, + void* _Nullable destBuffer, size_t destBufferSize) = 0; + + virtual int32_t getStandardMetadata(buffer_handle_t _Nonnull buffer, + int64_t standardMetadataType, void* _Nullable destBuffer, + size_t destBufferSize) = 0; + + virtual AIMapper_Error setMetadata(buffer_handle_t _Nonnull buffer, + AIMapper_MetadataType metadataType, + const void* _Nonnull metadata, size_t metadataSize) = 0; + + virtual AIMapper_Error setStandardMetadata(buffer_handle_t _Nonnull buffer, + int64_t standardMetadataType, + const void* _Nonnull metadata, + size_t metadataSize) = 0; + + virtual AIMapper_Error listSupportedMetadataTypes( + const AIMapper_MetadataTypeDescription* _Nullable* _Nonnull outDescriptionList, + size_t* _Nonnull outNumberOfDescriptions) = 0; + + virtual AIMapper_Error dumpBuffer(buffer_handle_t _Nonnull bufferHandle, + AIMapper_DumpBufferCallback _Nonnull dumpBufferCallback, + void* _Null_unspecified context) = 0; + + virtual AIMapper_Error dumpAllBuffers( + AIMapper_BeginDumpBufferCallback _Nonnull beginDumpBufferCallback, + AIMapper_DumpBufferCallback _Nonnull dumpBufferCallback, + void* _Null_unspecified context) = 0; + + virtual AIMapper_Error getReservedRegion(buffer_handle_t _Nonnull buffer, + void* _Nullable* _Nonnull outReservedRegion, + uint64_t* _Nonnull outReservedSize) = 0; +}; + +namespace provider { +#ifndef __cpp_inline_variables +#error "Only C++17 & newer is supported; inline variables is missing" +#endif + +inline void* _Nullable sIMapperInstance = nullptr; +} // namespace provider + +template +class IMapperProvider { + private: + static_assert(IMPL::version >= AIMAPPER_VERSION_5, "Must be at least AIMAPPER_VERSION_5"); + static_assert(std::is_final_v, "Implementation must be final"); + static_assert(std::is_constructible_v, "Implementation must have a no-args constructor"); + + std::once_flag mLoadOnceFlag; + std::optional mImpl; + AIMapper mMapper = {}; + + static IMPL& impl() { + return *reinterpret_cast*>(provider::sIMapperInstance)->mImpl; + } + + void bindV5() { + mMapper.v5 = { + .importBuffer = [](const native_handle_t* _Nonnull handle, + buffer_handle_t _Nullable* _Nonnull outBufferHandle) + -> AIMapper_Error { return impl().importBuffer(handle, outBufferHandle); }, + + .freeBuffer = [](buffer_handle_t _Nonnull buffer) -> AIMapper_Error { + return impl().freeBuffer(buffer); + }, + + .getTransportSize = [](buffer_handle_t _Nonnull buffer, + uint32_t* _Nonnull outNumFds, + uint32_t* _Nonnull outNumInts) -> AIMapper_Error { + return impl().getTransportSize(buffer, outNumFds, outNumInts); + }, + + .lock = [](buffer_handle_t _Nonnull buffer, uint64_t cpuUsage, ARect accessRegion, + int acquireFence, void* _Nullable* _Nonnull outData) -> AIMapper_Error { + return impl().lock(buffer, cpuUsage, accessRegion, acquireFence, outData); + }, + + .unlock = [](buffer_handle_t _Nonnull buffer, int* _Nonnull releaseFence) + -> AIMapper_Error { return impl().unlock(buffer, releaseFence); }, + + .flushLockedBuffer = [](buffer_handle_t _Nonnull buffer) -> AIMapper_Error { + return impl().flushLockedBuffer(buffer); + }, + + .rereadLockedBuffer = [](buffer_handle_t _Nonnull buffer) -> AIMapper_Error { + return impl().rereadLockedBuffer(buffer); + }, + + .getMetadata = [](buffer_handle_t _Nonnull buffer, + AIMapper_MetadataType metadataType, void* _Nullable destBuffer, + size_t destBufferSize) -> int32_t { + return impl().getMetadata(buffer, metadataType, destBuffer, destBufferSize); + }, + + .getStandardMetadata = [](buffer_handle_t _Nonnull buffer, + int64_t standardMetadataType, void* _Nullable destBuffer, + size_t destBufferSize) -> int32_t { + return impl().getStandardMetadata(buffer, standardMetadataType, destBuffer, + destBufferSize); + }, + + .setMetadata = [](buffer_handle_t _Nonnull buffer, + AIMapper_MetadataType metadataType, const void* _Nonnull metadata, + size_t metadataSize) -> AIMapper_Error { + return impl().setMetadata(buffer, metadataType, metadata, metadataSize); + }, + + .setStandardMetadata = + [](buffer_handle_t _Nonnull buffer, int64_t standardMetadataType, + const void* _Nonnull metadata, size_t metadataSize) -> AIMapper_Error { + return impl().setStandardMetadata(buffer, standardMetadataType, metadata, + metadataSize); + }, + + .listSupportedMetadataTypes = + [](const AIMapper_MetadataTypeDescription* _Nullable* _Nonnull outDescriptionList, + size_t* _Nonnull outNumberOfDescriptions) -> AIMapper_Error { + return impl().listSupportedMetadataTypes(outDescriptionList, + outNumberOfDescriptions); + }, + + .dumpBuffer = [](buffer_handle_t _Nonnull bufferHandle, + AIMapper_DumpBufferCallback _Nonnull dumpBufferCallback, + void* _Null_unspecified context) -> AIMapper_Error { + return impl().dumpBuffer(bufferHandle, dumpBufferCallback, context); + }, + + .dumpAllBuffers = + [](AIMapper_BeginDumpBufferCallback _Nonnull beginDumpBufferCallback, + AIMapper_DumpBufferCallback _Nonnull dumpBufferCallback, + void* _Null_unspecified context) { + return impl().dumpAllBuffers(beginDumpBufferCallback, + dumpBufferCallback, context); + }, + + .getReservedRegion = [](buffer_handle_t _Nonnull buffer, + void* _Nullable* _Nonnull outReservedRegion, + uint64_t* _Nonnull outReservedSize) -> AIMapper_Error { + return impl().getReservedRegion(buffer, outReservedRegion, outReservedSize); + }, + }; + } + + public: + explicit IMapperProvider() = default; + + AIMapper_Error load(AIMapper* _Nullable* _Nonnull outImplementation) { + std::call_once(mLoadOnceFlag, [this] { + LOG_ALWAYS_FATAL_IF(provider::sIMapperInstance != nullptr, + "AIMapper implementation already loaded!"); + provider::sIMapperInstance = this; + mImpl.emplace(); + mMapper.version = IMPL::version; + if (IMPL::version >= AIMAPPER_VERSION_5) { + bindV5(); + } + }); + *outImplementation = &mMapper; + return AIMAPPER_ERROR_NONE; + } +}; + +} // namespace vendor::mapper diff --git a/graphics/mapper/stable-c/include/android/hardware/graphics/mapper/IMapper.h b/graphics/mapper/stable-c/include/android/hardware/graphics/mapper/IMapper.h new file mode 100644 index 0000000000..f27b0f4ce7 --- /dev/null +++ b/graphics/mapper/stable-c/include/android/hardware/graphics/mapper/IMapper.h @@ -0,0 +1,689 @@ +/* + * 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. + */ + +/** + * IMapper Stable-C HAL interface + * + * This file represents the sphal interface between libui & the IMapper HAL implementation. + * A vendor implementation of this interface is retrieved by looking up the vendor imapper + * implementation library via the IAllocator AIDL interface. + * + * This interface is not intended for general use. + */ + +#pragma once + +#include +#include +#include +#include + +#include +#include + +__BEGIN_DECLS + +/** + * AIMapper versioning + * + * IMapper versions 0-1 are pre-treble + * IMapper versions 2-4 are HIDL + * C-style AIMapper API starts at 5 + */ +enum AIMapper_Version : uint32_t { + AIMAPPER_VERSION_5 = 5, +}; + +/** + * Possible AIMapper errors + * Values are the same as IMapper 4.0's Error type for simplicity + */ +enum AIMapper_Error : int32_t { + /** + * No error. + */ + AIMAPPER_ERROR_NONE = 0, + /** + * Invalid BufferDescriptor. + */ + AIMAPPER_ERROR_BAD_DESCRIPTOR = 1, + /** + * Invalid buffer handle. + */ + AIMAPPER_ERROR_BAD_BUFFER = 2, + /** + * Invalid HardwareBufferDescription. + */ + AIMAPPER_ERROR_BAD_VALUE = 3, + /** + * Resource unavailable. + */ + AIMAPPER_ERROR_NO_RESOURCES = 5, + /** + * Permanent failure. + */ + AIMAPPER_ERROR_UNSUPPORTED = 7, +}; + +/** + * MetadataType represents the different types of buffer metadata that could be + * associated with a buffer. It is used by IMapper to help get and set buffer metadata + * on the buffer's native handle. + * + * Standard buffer metadata will have the name field set to + * "android.hardware.graphics.common.StandardMetadataType" and will contain values + * from StandardMetadataType.aidl. + * + * Vendor-provided metadata should be prefixed with a "vendor.mycompanyname.*" namespace. It is + * recommended that the metadata follows the pattern of StandardMetadaType.aidl. That is, an + * aidl-defined enum with @VendorStability on it and the naming then matching that type such + * as "vendor.mycompanyname.graphics.common.MetadataType" with the value field then set to the + * aidl's enum value. + * + * Each company should create their own enum & namespace. The name + * field prevents values from different companies from colliding. + */ +typedef struct AIMapper_MetadataType { + const char* _Nonnull name; + int64_t value; +} AIMapper_MetadataType; + +typedef struct AIMapper_MetadataTypeDescription { + /** + * The `name` of the metadataType must be valid for the lifetime of the process + */ + AIMapper_MetadataType metadataType; + /** + * description should contain a string representation of the MetadataType. + * + * For example: "MyExampleMetadataType is a 64-bit timestamp in nanoseconds + * that indicates when a buffer is decoded. It is set by the media HAL after + * a buffer is decoded. It is used by the display HAL for hardware + * synchronization". + * + * This field is required for any non-StandardMetadataTypes. For StandardMetadataTypes this + * field may be null. The lifetime of this pointer must be valid for the duration of the + * process (that is, a static const char*). + */ + const char* _Nullable description; + /** + * isGettable represents if the MetadataType can be get. + */ + bool isGettable; + /** + * isSettable represents if the MetadataType can be set. + */ + bool isSettable; + + /** Reserved for future use; must be zero-initialized currently */ + uint8_t reserved[32]; +} AIMapper_MetadataTypeDescription; + +/** + * Callback that is passed to dumpBuffer. + * + * @param context The caller-provided void* that was passed to dumpBuffer. + * @param metadataType The type of the metadata passed to the callback + * @param value A pointer to the value of the metadata. The lifetime of this pointer is only + * valid for the duration of the call + * @param valueSize The size of the value buffer. + */ +typedef void (*AIMapper_DumpBufferCallback)(void* _Null_unspecified context, + AIMapper_MetadataType metadataType, + const void* _Nonnull value, size_t valueSize); + +/** + * Callback that is passed to dumpAllBuffers. + * + * Indicates that a buffer is about to be dumped. Will be followed by N calls to + * AIMapper_DumpBufferCallback for all the metadata for this buffer. + * + * @param context The caller-provided void* that was passed to dumpAllBuffers. + */ +typedef void (*AIMapper_BeginDumpBufferCallback)(void* _Null_unspecified context); + +/** + * Implementation of AIMAPPER_VERSION_5 + * All functions must not be null & must provide a valid implementation. + */ +typedef struct AIMapperV5 { + /** + * Imports a raw buffer handle to create an imported buffer handle for use + * with the rest of the mapper or with other in-process libraries. + * + * A buffer handle is considered raw when it is cloned (e.g., with + * `native_handle_clone()`) from another buffer handle locally, or when it + * is received from another HAL server/client or another process. A raw + * buffer handle must not be used to access the underlying graphic + * buffer. It must be imported to create an imported handle first. + * + * This function must at least validate the raw handle before creating the + * imported handle. It must also support importing the same raw handle + * multiple times to create multiple imported handles. The imported handle + * must be considered valid everywhere in the process, including in + * another instance of the mapper. + * + * Because of passthrough HALs, a raw buffer handle received from a HAL + * may actually have been imported in the process. importBuffer() must treat + * such a handle as if it is raw and must not return `BAD_BUFFER`. The + * returned handle is independent from the input handle as usual, and + * freeBuffer() must be called on it when it is no longer needed. + * + * @param handle Raw buffer handle to import. + * @param outBufferHandle The resulting imported buffer handle. + * @return Error status of the call, which may be + * - `NONE` upon success. + * - `BAD_BUFFER` if the raw handle is invalid. + * - `NO_RESOURCES` if the raw handle cannot be imported due to + * unavailability of resources. + */ + AIMapper_Error (*_Nonnull importBuffer)(const native_handle_t* _Nonnull handle, + buffer_handle_t _Nullable* _Nonnull outBufferHandle); + + /** + * Frees a buffer handle. Buffer handles returned by importBuffer() must be + * freed with this function when no longer needed. + * + * This function must free up all resources allocated by importBuffer() for + * the imported handle. For example, if the imported handle was created + * with `native_handle_create()`, this function must call + * `native_handle_close()` and `native_handle_delete()`. + * + * @param buffer Imported buffer handle. + * @return error Error status of the call, which may be + * - `NONE` upon success. + * - `BAD_BUFFER` if the buffer is invalid. + */ + AIMapper_Error (*_Nonnull freeBuffer)(buffer_handle_t _Nonnull buffer); + + /** + * Calculates the transport size of a buffer. An imported buffer handle is a + * raw buffer handle with the process-local runtime data appended. This + * function, for example, allows a caller to omit the process-local runtime + * data at the tail when serializing the imported buffer handle. + * + * Note that a client might or might not omit the process-local runtime data + * when sending an imported buffer handle. The mapper must support both + * cases on the receiving end. + * + * @param buffer Buffer to get the transport size from. + * @param outNumFds The number of file descriptors needed for transport. + * @param outNumInts The number of integers needed for transport. + * @return error Error status of the call, which may be + * - `NONE` upon success. + * - `BAD_BUFFER` if the buffer is invalid. + */ + AIMapper_Error (*_Nonnull getTransportSize)(buffer_handle_t _Nonnull buffer, + uint32_t* _Nonnull outNumFds, + uint32_t* _Nonnull outNumInts); + + /** + * Locks the given buffer for the specified CPU usage. + * + * Locking the same buffer simultaneously from multiple threads is + * permitted, but if any of the threads attempt to lock the buffer for + * writing, the behavior is undefined, except that it must not cause + * process termination or block the client indefinitely. Leaving the + * buffer content in an indeterminate state or returning an error are both + * acceptable. + * + * 1D buffers (width = size in bytes, height = 1, pixel_format = BLOB) must + * "lock in place". The buffers must be directly accessible via mapping. + * + * The client must not modify the content of the buffer outside of + * @p accessRegion, and the device need not guarantee that content outside + * of @p accessRegion is valid for reading. The result of reading or writing + * outside of @p accessRegion is undefined, except that it must not cause + * process termination. + * + * An accessRegion of all-zeros means the entire buffer. That is, it is + * equivalent to '(0,0)-(buffer width, buffer height)'. + * + * This function can lock both single-planar and multi-planar formats. The caller + * should use get() to get information about the buffer they are locking. + * get() can be used to get information about the planes, offsets, stride, + * etc. + * + * This function must also work on buffers with + * `AHARDWAREBUFFER_FORMAT_Y8Cb8Cr8_*` if supported by the device, as well + * as with any other formats requested by multimedia codecs when they are + * configured with a flexible-YUV-compatible color format. + * + * On success, @p data must be filled with a pointer to the locked buffer + * memory. This address will represent the top-left corner of the entire + * buffer, even if @p accessRegion does not begin at the top-left corner. + * + * The locked buffer must adhere to the format requested at allocation time + * in the BufferDescriptorInfo. + * + * @param buffer Buffer to lock. + * @param cpuUsage CPU usage flags to request. See BufferUsage.aidl for possible values. + * @param accessRegion Portion of the buffer that the client intends to + * access. + * @param acquireFence Handle containing a file descriptor referring to a + * sync fence object, which will be signaled when it is safe for the + * mapper to lock the buffer. @p acquireFence may be an empty fence (-1) if + * it is already safe to lock. Ownership is passed to the callee and it is the + * implementations responsibility to ensure it is closed even when an error + * occurs. + * @param outData CPU-accessible pointer to the buffer data. + * @return error Error status of the call, which may be + * - `NONE` upon success. + * - `BAD_BUFFER` if the buffer is invalid or is incompatible with this + * function. + * - `BAD_VALUE` if @p cpuUsage is 0, contains non-CPU usage flags, or + * is incompatible with the buffer. Also if the @p accessRegion is + * outside the bounds of the buffer or the accessRegion is invalid. + * - `NO_RESOURCES` if the buffer cannot be locked at this time. Note + * that locking may succeed at a later time. + * @return data CPU-accessible pointer to the buffer data. + */ + AIMapper_Error (*_Nonnull lock)(buffer_handle_t _Nonnull buffer, uint64_t cpuUsage, + ARect accessRegion, int acquireFence, + void* _Nullable* _Nonnull outData); + + /** + * Unlocks a buffer to indicate all CPU accesses to the buffer have + * completed. + * + * @param buffer Buffer to unlock. + * @param releaseFence Handle containing a file descriptor referring to a + * sync fence object. The sync fence object will be signaled when the + * mapper has completed any pending work. @p releaseFence may be an + * empty fence (-1). + * @return error Error status of the call, which may be + * - `NONE` upon success. + * - `BAD_BUFFER` if the buffer is invalid or not locked. + */ + AIMapper_Error (*_Nonnull unlock)(buffer_handle_t _Nonnull buffer, int* _Nonnull releaseFence); + + /** + * Flushes the contents of a locked buffer. + * + * This function flushes the CPUs caches for the range of all the buffer's + * planes and metadata. This should behave similarly to unlock() except the + * buffer should remain mapped to the CPU. + * + * The client is still responsible for calling unlock() when it is done + * with all CPU accesses to the buffer. + * + * If non-CPU blocks are simultaneously writing the buffer, the locked + * copy should still be flushed but what happens is undefined except that + * it should not cause any crashes. + * + * @param buffer Buffer to flush. + * @return error Error status of the call, which may be + * - `NONE` upon success. + * - `BAD_BUFFER` if the buffer is invalid or not locked. + */ + AIMapper_Error (*_Nonnull flushLockedBuffer)(buffer_handle_t _Nonnull buffer); + + /** + * Rereads the contents of a locked buffer. + * + * This should fetch the most recent copy of the locked buffer. + * + * It may reread locked copies of the buffer in other processes. + * + * The client is still responsible for calling unlock() when it is done + * with all CPU accesses to the buffer. + * + * @param buffer Buffer to reread. + * @return error Error status of the call, which may be + * - `NONE` upon success. + * - `BAD_BUFFER` if the buffer is invalid or not locked. + * - `NO_RESOURCES` if the buffer cannot be reread at this time. Note + * that rereading may succeed at a later time. + */ + AIMapper_Error (*_Nonnull rereadLockedBuffer)(buffer_handle_t _Nonnull buffer); + + /** + * Description for get(...), set(...) and getFromBufferDescriptorInfo(...) + * + * ------------ Overview ----------------------------------- + * Gralloc 4 adds support for getting and setting buffer metadata on a buffer. + * + * To get buffer metadata, the client passes in a buffer handle and a token that + * represents the type of buffer metadata they would like to get. IMapper returns + * a byte stream that contains the buffer metadata. To set the buffer metadata, the + * client passes in a buffer handle and a token that represents the type of buffer + * metadata they would like to set and a byte stream that contains the buffer metadata + * they are setting. + * + * Buffer metadata is global for a buffer. When the metadata is set on the buffer + * in a process, the updated metadata should be available to all other processes. + * Please see "Storing and Propagating Metadata" below for more details. + * + * The getter and setter functions have been optimized for easy vendor extension. + * They do not require a formal extension to add support for getting and setting + * vendor defined buffer metadata. See "Buffer Metadata Token" and + * "Buffer Metadata Stream" below for more details. + * + * ------------ Storing and Propagating Metadata ----------- + * Buffer metadata must be global. Any changes to the metadata must be propagated + * to all other processes immediately. Vendors may chose how they would like support + * this functionality. + * + * We recommend supporting this functionality by allocating an extra page of shared + * memory and storing it in the buffer's native_handle_t. The buffer metadata can + * be stored in the extra page of shared memory. Set operations are automatically + * propagated to all other processes. + * + * ------------ Buffer Metadata Synchronization ------------ + * There are no explicit buffer metadata synchronization primitives. Many devices + * before gralloc 4 already support getting and setting of global buffer metadata + * with no explicit synchronization primitives. Adding synchronization primitives + * would just add unnecessary complexity. + * + * The general rule is if a process has permission to write to a buffer, they + * have permission to write to the buffer's writable metadata. If a process has permission + * to read from a buffer, they have permission to read the buffer's metadata. + * + * There is one exception to this rule. Fences CANNOT be used to protect a buffer's + * metadata. A process should finish writing to a buffer's metadata before + * sending the buffer to another process that will read or write to the buffer. + * This exception is needed because sometimes userspace needs to read the + * buffer's metadata before the buffer's contents are ready. + * + * As a simple example: an app renders to a buffer and then displays the buffer. + * In this example when the app renders to the buffer, both the buffer and its + * metadata need to be updated. The app's process queues up its work on the GPU + * and gets back an acquire fence. The app's process must update the buffer's + * metadata before enqueuing the buffer to SurfaceFlinger. The app process CANNOT + * update the buffer's metadata after enqueuing the buffer. When HardwareComposer + * receives the buffer, it is immediately safe to read the buffer's metadata + * and use it to program the display driver. To read the buffer's contents, + * display driver must still wait on the acquire fence. + * + * ------------ Buffer Metadata Token ---------------------- + * In order to allow arbitrary vendor defined metadata, the token used to access + * metadata is defined defined as a struct that has a string representing + * the enum type and an int that represents the enum value. The string protects + * different enum values from colliding. + * + * The token struct (MetadataType) is defined as a C struct since it + * is passed into a C function. The standard buffer metadata types are NOT + * defined as a C enum but instead as an AIDL enum to allow for broader usage across + * other HALs and libraries. By putting the enum in the + * stable AIDL (hardware/interfaces/graphics/common/aidl/android/hardware/ + * graphics/common/StandardMetadataType.aidl), vendors will be able to optionally + * choose to support future standard buffer metadata types without upgrading + * IMapper versions. For more information see the description of "struct MetadataType". + * + * ------------ Buffer Metadata Stream --------------------- + * The buffer metadata is get and set as a void* buffer. By getting + * and setting buffer metadata as a generic buffer, vendors can use the standard + * getters and setter functions defined here. Vendors do NOT need to add their own + * getters and setter functions for each new type of buffer metadata. + * + * Converting buffer metadata into a byte stream can be non-trivial. For the standard + * buffer metadata types defined in StandardMetadataType.aidl, there are also + * support functions that will encode the buffer metadata into a byte stream + * and decode the buffer metadata from a byte stream. We STRONGLY recommend using + * these support functions. The framework will use them when getting and setting + * metadata. The support functions are defined in + * frameworks/native/libs/gralloc/types/include/gralloctypes/Gralloc4.h. + */ + + /** + * Gets the buffer metadata for a given MetadataType. + * + * Buffer metadata can be changed after allocation so clients should avoid "caching" + * the buffer metadata. For example, if the video resolution changes and the buffers + * are not reallocated, several buffer metadata values may change without warning. + * Clients should not expect the values to be constant. They should requery them every + * frame. The only exception is buffer metadata that is determined at allocation + * time. For StandardMetadataType values, only BUFFER_ID, NAME, WIDTH, + * HEIGHT, LAYER_COUNT, PIXEL_FORMAT_REQUESTED and USAGE are safe to cache because + * they are determined at allocation time. + * + * @param buffer Buffer containing desired metadata + * @param metadataType MetadataType for the metadata value being queried + * @param destBuffer Pointer to a buffer in which to store the result of the get() call; if + * null, the computed output size or error must still be returned. + * @param destBufferSize How large the destBuffer buffer is. If destBuffer is null this must be + * 0. + * @return The number of bytes written to `destBuffer` or which would have been written + * if `destBufferSize` was large enough. + * A negative value indicates an error, which may be + * - `BAD_BUFFER` if the raw handle is invalid. + * - `UNSUPPORTED` when metadataType is unknown/unsupported. + * IMapper must support getting all StandardMetadataType.aidl values defined + * at the time the device first launches. + */ + int32_t (*_Nonnull getMetadata)(buffer_handle_t _Nonnull buffer, + AIMapper_MetadataType metadataType, void* _Nullable destBuffer, + size_t destBufferSize); + + /** + * Gets the buffer metadata for a StandardMetadataType. + * + * This is equivalent to `getMetadata` when passed an AIMapper_MetadataType with name + * set to "android.hardware.graphics.common.StandardMetadataType" + * + * Buffer metadata can be changed after allocation so clients should avoid "caching" + * the buffer metadata. For example, if the video resolution changes and the buffers + * are not reallocated, several buffer metadata values may change without warning. + * Clients should not expect the values to be constant. They should requery them every + * frame. The only exception is buffer metadata that is determined at allocation + * time. For StandardMetadataType values, only BUFFER_ID, NAME, WIDTH, + * HEIGHT, LAYER_COUNT, PIXEL_FORMAT_REQUESTED and USAGE are safe to cache because + * they are determined at allocation time. + * + * @param buffer Buffer containing desired metadata + * @param standardMetadataType StandardMetadataType for the metadata value being queried + * @param destBuffer Pointer to a buffer in which to store the result of the get() call; if + * null, the computed output size or error must still be returned. + * @param destBufferSize How large the destBuffer buffer is. If destBuffer is null this must be + * 0. + * @return The number of bytes written to `destBuffer` or which would have been written + * if `destBufferSize` was large enough. + * A negative value indicates an error, which may be + * - `BAD_BUFFER` if the raw handle is invalid. + * - `UNSUPPORTED` when metadataType is unknown/unsupported. + * IMapper must support getting all StandardMetadataType.aidl values defined + * at the time the device first launches. + */ + int32_t (*_Nonnull getStandardMetadata)(buffer_handle_t _Nonnull buffer, + int64_t standardMetadataType, + void* _Nullable destBuffer, size_t destBufferSize); + + /** + * Sets the global value for a given MetadataType. + * + * Metadata fields are not required to be settable. This function can + * return Error::UNSUPPORTED whenever it doesn't support setting a + * particular Metadata field. + * + * The framework will attempt to set the following StandardMetadataType + * values: DATASPACE, SMPTE2086, CTA861_3, SMPTE2094_40 and BLEND_MODE. + * We require everyone to support setting those fields. If a device's Composer + * implementation supports a field, it should be supported here. Over time these + * metadata fields will be moved out of Composer/BufferQueue/etc. and into the + * buffer's Metadata fields. + * + * @param buffer Buffer receiving desired metadata + * @param metadataType MetadataType for the metadata value being set + * @param metadata Pointer to a buffer of bytes representing the value associated with + * @param metadataSize The size of the metadata buffer + * @return error Error status of the call, which may be + * - `NONE` upon success. + * - `BAD_BUFFER` if the raw handle is invalid. + * - `BAD_VALUE` when the field is constant and can never be set (such as + * BUFFER_ID, NAME, WIDTH, HEIGHT, LAYER_COUNT, PIXEL_FORMAT_REQUESTED and + * USAGE) + * - `NO_RESOURCES` if the set cannot be fulfilled due to unavailability of + * resources. + * - `UNSUPPORTED` when metadataType is unknown/unsupported or setting + * it is unsupported. Unsupported should also be returned if the metadata + * is malformed. + */ + AIMapper_Error (*_Nonnull setMetadata)(buffer_handle_t _Nonnull buffer, + AIMapper_MetadataType metadataType, + const void* _Nonnull metadata, size_t metadataSize); + + /** + * Sets the global value for a given MetadataType. + * + * This is equivalent to `setMetadata` when passed an AIMapper_MetadataType with name + * set to "android.hardware.graphics.common.StandardMetadataType" + * + * Metadata fields are not required to be settable. This function can + * return Error::UNSUPPORTED whenever it doesn't support setting a + * particular Metadata field. + * + * The framework will attempt to set the following StandardMetadataType + * values: DATASPACE, SMPTE2086, CTA861_3, SMPTE2094_40 and BLEND_MODE. + * We require everyone to support setting those fields. If a device's Composer + * implementation supports a field, it should be supported here. Over time these + * metadata fields will be moved out of Composer/BufferQueue/etc. and into the + * buffer's Metadata fields. + * + * @param buffer Buffer receiving desired metadata + * @param standardMetadataType StandardMetadataType for the metadata value being set + * @param metadata Pointer to a buffer of bytes representing the value associated with + * @param metadataSize The size of the metadata buffer + * @return error Error status of the call, which may be + * - `NONE` upon success. + * - `BAD_BUFFER` if the raw handle is invalid. + * - `BAD_VALUE` when the field is constant and can never be set (such as + * BUFFER_ID, NAME, WIDTH, HEIGHT, LAYER_COUNT, PIXEL_FORMAT_REQUESTED and + * USAGE) + * - `NO_RESOURCES` if the set cannot be fulfilled due to unavailability of + * resources. + * - `UNSUPPORTED` when metadataType is unknown/unsupported or setting + * it is unsupported. Unsupported should also be returned if the metadata + * is malformed. + */ + AIMapper_Error (*_Nonnull setStandardMetadata)(buffer_handle_t _Nonnull buffer, + int64_t standardMetadataType, + const void* _Nonnull metadata, + size_t metadataSize); + + /** + * Lists all the MetadataTypes supported by IMapper as well as a description + * of each supported MetadataType. For StandardMetadataTypes, the description + * string can be left empty. + * + * This list is expected to be static & thus the returned array must be valid for the + * lifetime of the process. + * + * @param outDescriptionList The list of descriptions + * @param outNumberOfDescriptions How many descriptions are in `outDescriptionList` + * @return error Error status of the call, which may be + * - `NONE` upon success. + * - `UNSUPPORTED` if there's any error + */ + AIMapper_Error (*_Nonnull listSupportedMetadataTypes)( + const AIMapper_MetadataTypeDescription* _Nullable* _Nonnull outDescriptionList, + size_t* _Nonnull outNumberOfDescriptions); + + /** + * Dumps a buffer's metadata. + * + * @param buffer The buffer to dump the metadata for + * @param dumpBufferCallback Callback that will be invoked for each of the metadata fields + * @param context A caller-provided context to be passed to the dumpBufferCallback + * @return error Error status of the call, which may be + * - `NONE` upon success. + * - `BAD_BUFFER` if the raw handle is invalid. + * - `NO_RESOURCES` if the get cannot be fulfilled due to unavailability of + * resources. + */ + AIMapper_Error (*_Nonnull dumpBuffer)(buffer_handle_t _Nonnull buffer, + AIMapper_DumpBufferCallback _Nonnull dumpBufferCallback, + void* _Null_unspecified context); + + /** + * Dump the metadata for all imported buffers in the current process + * + * The HAL implementation should invoke beginDumpCallback before dumping a buffer's metadata, + * followed by N calls to dumpBufferCallback for that buffer's metadata fields. The call + * sequence should follow this pseudocode: + * + * for (auto buffer : gListOfImportedBuffers) { + * beginDumpCallback(context); + * for (auto metadata : buffer->allMetadata()) { + * dumpBufferCallback(context, metadata...); + * } + * } + * + * @param beginDumpCallback Signals that a buffer is about to be dumped + * @param dumpBufferCallback Callback that will be invoked for each of the metadata fields + * @param context A caller-provided context to be passed to beginDumpCallback and + * dumpBufferCallback + * @return error Error status of the call, which may be + * - `NONE` upon success. + * - `BAD_BUFFER` if the raw handle is invalid. + * - `NO_RESOURCES` if the get cannot be fulfilled due to unavailability of + * resources. + */ + AIMapper_Error (*_Nonnull dumpAllBuffers)( + AIMapper_BeginDumpBufferCallback _Nonnull beginDumpCallback, + AIMapper_DumpBufferCallback _Nonnull dumpBufferCallback, + void* _Null_unspecified context); + + /** + * Returns the region of shared memory associated with the buffer that is + * reserved for client use. + * + * The shared memory may be allocated from any shared memory allocator. + * The shared memory must be CPU-accessible and virtually contiguous. The + * starting address must be word-aligned. + * + * This function may only be called after importBuffer() has been called by the + * client. The reserved region must remain accessible until freeBuffer() has + * been called. After freeBuffer() has been called, the client must not access + * the reserved region. + * + * This reserved memory may be used in future versions of Android to + * help clients implement backwards compatible features without requiring + * IAllocator/IMapper updates. + * + * @param buffer Imported buffer handle. + * @param outReservedRegion CPU-accessible pointer to the reserved region + * @param outReservedSize the size of the reservedRegion that was requested + * in the BufferDescriptorInfo. + * @return error Error status of the call, which may be + * - `NONE` upon success. + * - `BAD_BUFFER` if the buffer is invalid. + */ + AIMapper_Error (*_Nonnull getReservedRegion)(buffer_handle_t _Nonnull buffer, + void* _Nullable* _Nonnull outReservedRegion, + uint64_t* _Nonnull outReservedSize); + +} AIMapperV5; + +/** + * Return value for AIMapper_loadIMapper + * + * Note: This struct's size is not fixed and callers must never store it by-value as a result. + * Only fields up to those covered by `version` are allowed to be accessed. + */ +typedef struct AIMapper { + alignas(alignof(max_align_t)) AIMapper_Version version; + AIMapperV5 v5; +} AIMapper; + +/** + * Loads the vendor-provided implementation of AIMapper + * @return Error status of the call. + * - `NONE` upon success + * - `UNSUPPORTED` if no implementation is available + */ +AIMapper_Error AIMapper_loadIMapper(AIMapper* _Nullable* _Nonnull outImplementation); + +__END_DECLS \ No newline at end of file diff --git a/graphics/mapper/stable-c/vts/VtsHalGraphicsMapperStableC_TargetTest.cpp b/graphics/mapper/stable-c/vts/VtsHalGraphicsMapperStableC_TargetTest.cpp new file mode 100644 index 0000000000..6ab11a305d --- /dev/null +++ b/graphics/mapper/stable-c/vts/VtsHalGraphicsMapperStableC_TargetTest.cpp @@ -0,0 +1,1565 @@ +/* + * Copyright 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. + */ + +#undef LOG_TAG +#define LOG_TAG "VtsHalGraphicsMapperStableC_TargetTest" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace aidl::android::hardware::graphics::allocator; +using namespace aidl::android::hardware::graphics::common; +using namespace android; +using namespace android::hardware; +using namespace ::android::hardware::graphics::mapper; + +typedef AIMapper_Error (*AIMapper_loadIMapperFn)(AIMapper* _Nullable* _Nonnull outImplementation); + +inline constexpr BufferUsage operator|(BufferUsage lhs, BufferUsage rhs) { + using T = std::underlying_type_t; + return static_cast(static_cast(lhs) | static_cast(rhs)); +} + +inline BufferUsage& operator|=(BufferUsage& lhs, BufferUsage rhs) { + lhs = lhs | rhs; + return lhs; +} + +struct YCbCr { + android_ycbcr yCbCr; + int64_t horizontalSubSampling; + int64_t verticalSubSampling; +}; + +class BufferHandle { + AIMapper* mIMapper; + buffer_handle_t mHandle = nullptr; + + public: + explicit BufferHandle(AIMapper* mapper, native_handle_t* rawHandle) : mIMapper(mapper) { + EXPECT_EQ(AIMAPPER_ERROR_NONE, mIMapper->v5.importBuffer(rawHandle, &mHandle)); + } + + explicit BufferHandle(BufferHandle&& other) { *this = std::move(other); } + + BufferHandle& operator=(BufferHandle&& other) noexcept { + reset(); + mIMapper = other.mIMapper; + mHandle = other.mHandle; + other.mHandle = nullptr; + return *this; + } + + ~BufferHandle() { reset(); } + + constexpr explicit operator bool() const noexcept { return mHandle != nullptr; } + + buffer_handle_t operator*() const noexcept { return mHandle; } + + void reset() { + if (mHandle != nullptr) { + EXPECT_EQ(AIMAPPER_ERROR_NONE, mIMapper->v5.freeBuffer(mHandle)); + mHandle = nullptr; + } + } +}; + +class BufferAllocation { + AIMapper* mIMapper; + native_handle_t* mRawHandle; + uint32_t mStride; + const BufferDescriptorInfo mInfo; + + public: + BufferAllocation(const BufferAllocation&) = delete; + void operator=(const BufferAllocation&) = delete; + + BufferAllocation(AIMapper* mapper, native_handle_t* handle, uint32_t stride, + const BufferDescriptorInfo& info) + : mIMapper(mapper), mRawHandle(handle), mStride(stride), mInfo(info) {} + + ~BufferAllocation() { + if (mRawHandle == nullptr) return; + + native_handle_close(mRawHandle); + native_handle_delete(mRawHandle); + } + + uint32_t stride() const { return mStride; } + const BufferDescriptorInfo& info() const { return mInfo; } + + BufferHandle import() { return BufferHandle{mIMapper, mRawHandle}; } + + const native_handle_t* rawHandle() const { return mRawHandle; } +}; + +class GraphicsTestsBase { + private: + friend class BufferAllocation; + int32_t mIAllocatorVersion = 1; + std::shared_ptr mAllocator; + AIMapper* mIMapper = nullptr; + AIMapper_loadIMapperFn mIMapperLoader; + + protected: + void Initialize(std::shared_ptr allocator) { + mAllocator = allocator; + ASSERT_NE(nullptr, mAllocator.get()) << "failed to get allocator service"; + ASSERT_TRUE(mAllocator->getInterfaceVersion(&mIAllocatorVersion).isOk()); + ASSERT_GE(mIAllocatorVersion, 2); + std::string mapperSuffix; + auto status = mAllocator->getIMapperLibrarySuffix(&mapperSuffix); + ASSERT_TRUE(status.isOk()) << "Failed to get IMapper library suffix"; + std::string lib_name = "mapper." + mapperSuffix + ".so"; + void* so = android_load_sphal_library(lib_name.c_str(), RTLD_LOCAL | RTLD_NOW); + ASSERT_NE(nullptr, so) << "Failed to load " << lib_name; + mIMapperLoader = (AIMapper_loadIMapperFn)dlsym(so, "AIMapper_loadIMapper"); + ASSERT_NE(nullptr, mIMapperLoader) << "AIMapper_locaIMapper missing from " << lib_name; + ASSERT_EQ(AIMAPPER_ERROR_NONE, mIMapperLoader(&mIMapper)); + ASSERT_NE(mIMapper, nullptr); + } + + public: + AIMapper_loadIMapperFn getIMapperLoader() const { return mIMapperLoader; } + + std::unique_ptr allocate(const BufferDescriptorInfo& descriptorInfo) { + AllocationResult result; + ::ndk::ScopedAStatus status = mAllocator->allocate2(descriptorInfo, 1, &result); + if (!status.isOk()) { + status_t error = status.getExceptionCode(); + if (error == EX_SERVICE_SPECIFIC) { + error = status.getServiceSpecificError(); + EXPECT_NE(OK, error) << "Failed to set error properly"; + } else { + EXPECT_EQ(OK, error) << "Allocation transport failure"; + } + return nullptr; + } else { + return std::make_unique(mIMapper, dupFromAidl(result.buffers[0]), + result.stride, descriptorInfo); + } + } + + std::unique_ptr allocateGeneric() { + return allocate({ + .name = {"VTS_TEMP"}, + .width = 64, + .height = 64, + .layerCount = 1, + .format = PixelFormat::RGBA_8888, + .usage = BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN, + .reservedSize = 0, + }); + } + + bool isSupported(const BufferDescriptorInfo& descriptorInfo) { + bool ret = false; + EXPECT_TRUE(mAllocator->isSupported(descriptorInfo, &ret).isOk()); + return ret; + } + + AIMapper* mapper() const { return mIMapper; } + + template + auto getStandardMetadata(buffer_handle_t bufferHandle) + -> decltype(StandardMetadata::value::decode(nullptr, 0)) { + using Value = typename StandardMetadata::value; + std::vector buffer; + // Initial guess + buffer.resize(512); + int32_t sizeRequired = mapper()->v5.getStandardMetadata( + bufferHandle, static_cast(T), buffer.data(), buffer.size()); + if (sizeRequired < 0) { + EXPECT_EQ(-AIMAPPER_ERROR_UNSUPPORTED, sizeRequired) + << "Received something other than UNSUPPORTED from valid getStandardMetadata " + "call"; + return std::nullopt; + } + if (sizeRequired > buffer.size()) { + buffer.resize(sizeRequired); + sizeRequired = mapper()->v5.getStandardMetadata(bufferHandle, static_cast(T), + buffer.data(), buffer.size()); + } + if (sizeRequired < 0 || sizeRequired >= buffer.size()) { + ADD_FAILURE() << "getStandardMetadata failed, received " << sizeRequired + << " with buffer size " << buffer.size(); + // Generate a fail type + return std::nullopt; + } + return Value::decode(buffer.data(), sizeRequired); + } + + template + AIMapper_Error setStandardMetadata(buffer_handle_t bufferHandle, + const typename StandardMetadata::value_type& value) { + using Value = typename StandardMetadata::value; + int32_t sizeRequired = Value::encode(value, nullptr, 0); + if (sizeRequired < 0) { + EXPECT_GE(sizeRequired, 0) << "Failed to calculate required size"; + return static_cast(-sizeRequired); + } + std::vector buffer; + buffer.resize(sizeRequired); + sizeRequired = Value::encode(value, buffer.data(), buffer.size()); + if (sizeRequired < 0 || sizeRequired > buffer.size()) { + ADD_FAILURE() << "Failed to encode with calculated size " << sizeRequired + << "; buffer size" << buffer.size(); + return static_cast(-sizeRequired); + } + return mapper()->v5.setStandardMetadata(bufferHandle, static_cast(T), + buffer.data(), sizeRequired); + } + + void verifyRGBA8888PlaneLayouts(const std::vector& planeLayouts) { + ASSERT_EQ(1, planeLayouts.size()); + + const auto& planeLayout = planeLayouts.front(); + + ASSERT_EQ(4, planeLayout.components.size()); + + int64_t offsetInBitsR = -1; + int64_t offsetInBitsG = -1; + int64_t offsetInBitsB = -1; + int64_t offsetInBitsA = -1; + + for (const auto& component : planeLayout.components) { + if (!gralloc4::isStandardPlaneLayoutComponentType(component.type)) { + continue; + } + EXPECT_EQ(8, component.sizeInBits); + if (component.type.value == gralloc4::PlaneLayoutComponentType_R.value) { + offsetInBitsR = component.offsetInBits; + } + if (component.type.value == gralloc4::PlaneLayoutComponentType_G.value) { + offsetInBitsG = component.offsetInBits; + } + if (component.type.value == gralloc4::PlaneLayoutComponentType_B.value) { + offsetInBitsB = component.offsetInBits; + } + if (component.type.value == gralloc4::PlaneLayoutComponentType_A.value) { + offsetInBitsA = component.offsetInBits; + } + } + + EXPECT_EQ(0, offsetInBitsR); + EXPECT_EQ(8, offsetInBitsG); + EXPECT_EQ(16, offsetInBitsB); + EXPECT_EQ(24, offsetInBitsA); + + EXPECT_EQ(0, planeLayout.offsetInBytes); + EXPECT_EQ(32, planeLayout.sampleIncrementInBits); + // Skip testing stride because any stride is valid + EXPECT_LE(planeLayout.widthInSamples * planeLayout.heightInSamples * 4, + planeLayout.totalSizeInBytes); + EXPECT_EQ(1, planeLayout.horizontalSubsampling); + EXPECT_EQ(1, planeLayout.verticalSubsampling); + } + + void fillRGBA8888(uint8_t* data, uint32_t height, size_t strideInBytes, size_t widthInBytes) { + for (uint32_t y = 0; y < height; y++) { + memset(data, y, widthInBytes); + data += strideInBytes; + } + } + + void verifyRGBA8888(const buffer_handle_t bufferHandle, const uint8_t* data, uint32_t height, + size_t strideInBytes, size_t widthInBytes) { + auto decodeResult = getStandardMetadata(bufferHandle); + ASSERT_TRUE(decodeResult.has_value()); + const auto& planeLayouts = *decodeResult; + ASSERT_TRUE(planeLayouts.size() > 0); + + verifyRGBA8888PlaneLayouts(planeLayouts); + + for (uint32_t y = 0; y < height; y++) { + for (size_t i = 0; i < widthInBytes; i++) { + EXPECT_EQ(static_cast(y), data[i]); + } + data += strideInBytes; + } + } + + void traverseYCbCrData(const android_ycbcr& yCbCr, int32_t width, int32_t height, + int64_t hSubsampling, int64_t vSubsampling, + std::function traverseFuncion) { + auto yData = static_cast(yCbCr.y); + auto cbData = static_cast(yCbCr.cb); + auto crData = static_cast(yCbCr.cr); + auto yStride = yCbCr.ystride; + auto cStride = yCbCr.cstride; + auto chromaStep = yCbCr.chroma_step; + + for (uint32_t y = 0; y < height; y++) { + for (uint32_t x = 0; x < width; x++) { + auto val = static_cast(height * y + x); + + traverseFuncion(yData + yStride * y + x, val); + + if (y % vSubsampling == 0 && x % hSubsampling == 0) { + uint32_t subSampleX = x / hSubsampling; + uint32_t subSampleY = y / vSubsampling; + const auto subSampleOffset = cStride * subSampleY + chromaStep * subSampleX; + const auto subSampleVal = + static_cast(height * subSampleY + subSampleX); + + traverseFuncion(cbData + subSampleOffset, subSampleVal); + traverseFuncion(crData + subSampleOffset, subSampleVal + 1); + } + } + } + } + + void fillYCbCrData(const android_ycbcr& yCbCr, int32_t width, int32_t height, + int64_t hSubsampling, int64_t vSubsampling) { + traverseYCbCrData(yCbCr, width, height, hSubsampling, vSubsampling, + [](auto address, auto fillingData) { *address = fillingData; }); + } + + void verifyYCbCrData(const android_ycbcr& yCbCr, int32_t width, int32_t height, + int64_t hSubsampling, int64_t vSubsampling) { + traverseYCbCrData( + yCbCr, width, height, hSubsampling, vSubsampling, + [](auto address, auto expectedData) { EXPECT_EQ(*address, expectedData); }); + } + + constexpr uint64_t bitsToBytes(int64_t bits) { return bits / 8; } + constexpr uint64_t bytesToBits(int64_t bytes) { return bytes * 8; } + + void getAndroidYCbCr(buffer_handle_t bufferHandle, uint8_t* data, android_ycbcr* outYCbCr, + int64_t* hSubsampling, int64_t* vSubsampling) { + auto decodeResult = getStandardMetadata(bufferHandle); + ASSERT_TRUE(decodeResult.has_value()); + const auto& planeLayouts = *decodeResult; + ASSERT_TRUE(planeLayouts.size() > 0); + + outYCbCr->y = nullptr; + outYCbCr->cb = nullptr; + outYCbCr->cr = nullptr; + outYCbCr->ystride = 0; + outYCbCr->cstride = 0; + outYCbCr->chroma_step = 0; + + for (const auto& planeLayout : planeLayouts) { + for (const auto& planeLayoutComponent : planeLayout.components) { + if (!gralloc4::isStandardPlaneLayoutComponentType(planeLayoutComponent.type)) { + continue; + } + ASSERT_EQ(0, planeLayoutComponent.offsetInBits % 8); + + uint8_t* tmpData = data + planeLayout.offsetInBytes + + bitsToBytes(planeLayoutComponent.offsetInBits); + uint64_t sampleIncrementInBytes; + + auto type = static_cast(planeLayoutComponent.type.value); + switch (type) { + case PlaneLayoutComponentType::Y: + ASSERT_EQ(nullptr, outYCbCr->y); + ASSERT_EQ(8, planeLayoutComponent.sizeInBits); + ASSERT_EQ(8, planeLayout.sampleIncrementInBits); + outYCbCr->y = tmpData; + outYCbCr->ystride = planeLayout.strideInBytes; + break; + + case PlaneLayoutComponentType::CB: + case PlaneLayoutComponentType::CR: + ASSERT_EQ(0, planeLayout.sampleIncrementInBits % 8); + + sampleIncrementInBytes = planeLayout.sampleIncrementInBits / 8; + ASSERT_TRUE(sampleIncrementInBytes == 1 || sampleIncrementInBytes == 2); + + if (outYCbCr->cstride == 0 && outYCbCr->chroma_step == 0) { + outYCbCr->cstride = planeLayout.strideInBytes; + outYCbCr->chroma_step = sampleIncrementInBytes; + } else { + ASSERT_EQ(outYCbCr->cstride, planeLayout.strideInBytes); + ASSERT_EQ(outYCbCr->chroma_step, sampleIncrementInBytes); + } + + if (*hSubsampling == 0 && *vSubsampling == 0) { + *hSubsampling = planeLayout.horizontalSubsampling; + *vSubsampling = planeLayout.verticalSubsampling; + } else { + ASSERT_EQ(*hSubsampling, planeLayout.horizontalSubsampling); + ASSERT_EQ(*vSubsampling, planeLayout.verticalSubsampling); + } + + if (type == PlaneLayoutComponentType::CB) { + ASSERT_EQ(nullptr, outYCbCr->cb); + outYCbCr->cb = tmpData; + } else { + ASSERT_EQ(nullptr, outYCbCr->cr); + outYCbCr->cr = tmpData; + } + break; + default: + break; + }; + } + } + + ASSERT_NE(nullptr, outYCbCr->y); + ASSERT_NE(nullptr, outYCbCr->cb); + ASSERT_NE(nullptr, outYCbCr->cr); + } + + YCbCr getAndroidYCbCr_P010(const native_handle_t* bufferHandle, uint8_t* data) { + YCbCr yCbCr_P010; + auto decodeResult = getStandardMetadata(bufferHandle); + if (!decodeResult.has_value()) { + ADD_FAILURE() << "failed to get plane layout"; + return YCbCr{}; + } + const auto& planeLayouts = *decodeResult; + EXPECT_EQ(2, planeLayouts.size()); + EXPECT_EQ(1, planeLayouts[0].components.size()); + EXPECT_EQ(2, planeLayouts[1].components.size()); + + yCbCr_P010.yCbCr.y = nullptr; + yCbCr_P010.yCbCr.cb = nullptr; + yCbCr_P010.yCbCr.cr = nullptr; + yCbCr_P010.yCbCr.ystride = 0; + yCbCr_P010.yCbCr.cstride = 0; + yCbCr_P010.yCbCr.chroma_step = 0; + int64_t cb_offset = 0; + int64_t cr_offset = 0; + + for (const auto& planeLayout : planeLayouts) { + for (const auto& planeLayoutComponent : planeLayout.components) { + if (!gralloc4::isStandardPlaneLayoutComponentType(planeLayoutComponent.type)) { + continue; + } + + uint8_t* tmpData = data + planeLayout.offsetInBytes + + bitsToBytes(planeLayoutComponent.offsetInBits); + uint64_t sampleIncrementInBytes = 0; + auto type = static_cast(planeLayoutComponent.type.value); + switch (type) { + case PlaneLayoutComponentType::Y: + // For specs refer: + // https://docs.microsoft.com/en-us/windows/win32/medfound/10-bit-and-16-bit-yuv-video-formats + EXPECT_EQ(6, planeLayoutComponent.offsetInBits); + EXPECT_EQ(nullptr, yCbCr_P010.yCbCr.y); + EXPECT_EQ(10, planeLayoutComponent.sizeInBits); + EXPECT_EQ(16, planeLayout.sampleIncrementInBits); + + yCbCr_P010.yCbCr.y = tmpData; + yCbCr_P010.yCbCr.ystride = planeLayout.strideInBytes; + break; + + case PlaneLayoutComponentType::CB: + case PlaneLayoutComponentType::CR: + sampleIncrementInBytes = bitsToBytes(planeLayout.sampleIncrementInBits); + EXPECT_EQ(4, sampleIncrementInBytes); + + if (yCbCr_P010.yCbCr.cstride == 0 && yCbCr_P010.yCbCr.chroma_step == 0) { + yCbCr_P010.yCbCr.cstride = planeLayout.strideInBytes; + yCbCr_P010.yCbCr.chroma_step = sampleIncrementInBytes; + } else { + EXPECT_EQ(yCbCr_P010.yCbCr.cstride, planeLayout.strideInBytes); + EXPECT_EQ(yCbCr_P010.yCbCr.chroma_step, sampleIncrementInBytes); + } + + if (yCbCr_P010.horizontalSubSampling == 0 && + yCbCr_P010.verticalSubSampling == 0) { + yCbCr_P010.horizontalSubSampling = planeLayout.horizontalSubsampling; + yCbCr_P010.verticalSubSampling = planeLayout.verticalSubsampling; + } else { + EXPECT_EQ(yCbCr_P010.horizontalSubSampling, + planeLayout.horizontalSubsampling); + EXPECT_EQ(yCbCr_P010.verticalSubSampling, + planeLayout.verticalSubsampling); + } + + if (type == PlaneLayoutComponentType::CB) { + EXPECT_EQ(nullptr, yCbCr_P010.yCbCr.cb); + yCbCr_P010.yCbCr.cb = tmpData; + cb_offset = planeLayoutComponent.offsetInBits; + } else { + EXPECT_EQ(nullptr, yCbCr_P010.yCbCr.cr); + yCbCr_P010.yCbCr.cr = tmpData; + cr_offset = planeLayoutComponent.offsetInBits; + } + break; + default: + break; + }; + } + } + + EXPECT_EQ(cb_offset + bytesToBits(2), cr_offset); + EXPECT_NE(nullptr, yCbCr_P010.yCbCr.y); + EXPECT_NE(nullptr, yCbCr_P010.yCbCr.cb); + EXPECT_NE(nullptr, yCbCr_P010.yCbCr.cr); + return yCbCr_P010; + } +}; + +class GraphicsMapperStableCTests + : public GraphicsTestsBase, + public ::testing::TestWithParam>> { + public: + void SetUp() override { Initialize(std::get<1>(GetParam())); } + + void TearDown() override {} +}; + +TEST_P(GraphicsMapperStableCTests, AllV5CallbacksDefined) { + ASSERT_GE(mapper()->version, AIMAPPER_VERSION_5); + + EXPECT_TRUE(mapper()->v5.importBuffer); + EXPECT_TRUE(mapper()->v5.freeBuffer); + EXPECT_TRUE(mapper()->v5.getTransportSize); + EXPECT_TRUE(mapper()->v5.lock); + EXPECT_TRUE(mapper()->v5.unlock); + EXPECT_TRUE(mapper()->v5.flushLockedBuffer); + EXPECT_TRUE(mapper()->v5.rereadLockedBuffer); + EXPECT_TRUE(mapper()->v5.getMetadata); + EXPECT_TRUE(mapper()->v5.getStandardMetadata); + EXPECT_TRUE(mapper()->v5.setMetadata); + EXPECT_TRUE(mapper()->v5.setStandardMetadata); + EXPECT_TRUE(mapper()->v5.listSupportedMetadataTypes); + EXPECT_TRUE(mapper()->v5.dumpBuffer); + EXPECT_TRUE(mapper()->v5.getReservedRegion); +} + +TEST_P(GraphicsMapperStableCTests, DualLoadIsIdentical) { + ASSERT_GE(mapper()->version, AIMAPPER_VERSION_5); + AIMapper* secondMapper; + ASSERT_EQ(AIMAPPER_ERROR_NONE, getIMapperLoader()(&secondMapper)); + + EXPECT_EQ(secondMapper->v5.importBuffer, mapper()->v5.importBuffer); + EXPECT_EQ(secondMapper->v5.freeBuffer, mapper()->v5.freeBuffer); + EXPECT_EQ(secondMapper->v5.getTransportSize, mapper()->v5.getTransportSize); + EXPECT_EQ(secondMapper->v5.lock, mapper()->v5.lock); + EXPECT_EQ(secondMapper->v5.unlock, mapper()->v5.unlock); + EXPECT_EQ(secondMapper->v5.flushLockedBuffer, mapper()->v5.flushLockedBuffer); + EXPECT_EQ(secondMapper->v5.rereadLockedBuffer, mapper()->v5.rereadLockedBuffer); + EXPECT_EQ(secondMapper->v5.getMetadata, mapper()->v5.getMetadata); + EXPECT_EQ(secondMapper->v5.getStandardMetadata, mapper()->v5.getStandardMetadata); + EXPECT_EQ(secondMapper->v5.setMetadata, mapper()->v5.setMetadata); + EXPECT_EQ(secondMapper->v5.setStandardMetadata, mapper()->v5.setStandardMetadata); + EXPECT_EQ(secondMapper->v5.listSupportedMetadataTypes, mapper()->v5.listSupportedMetadataTypes); + EXPECT_EQ(secondMapper->v5.dumpBuffer, mapper()->v5.dumpBuffer); + EXPECT_EQ(secondMapper->v5.getReservedRegion, mapper()->v5.getReservedRegion); +} + +TEST_P(GraphicsMapperStableCTests, CanAllocate) { + auto buffer = allocate({ + .name = {"VTS_TEMP"}, + .width = 64, + .height = 64, + .layerCount = 1, + .format = PixelFormat::RGBA_8888, + .usage = BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN, + .reservedSize = 0, + }); + ASSERT_NE(nullptr, buffer.get()); + EXPECT_GE(buffer->stride(), 64); +} + +TEST_P(GraphicsMapperStableCTests, ImportFreeBuffer) { + auto buffer = allocate({ + .name = {"VTS_TEMP"}, + .width = 64, + .height = 64, + .layerCount = 1, + .format = PixelFormat::RGBA_8888, + .usage = BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN, + .reservedSize = 0, + }); + ASSERT_NE(nullptr, buffer.get()); + EXPECT_GE(buffer->stride(), 64); + + { + auto import1 = buffer->import(); + auto import2 = buffer->import(); + EXPECT_TRUE(import1); + EXPECT_TRUE(import2); + EXPECT_NE(*import1, *import2); + } +} + +/** + * Test IMapper::importBuffer and IMapper::freeBuffer cross mapper instances. + */ +TEST_P(GraphicsMapperStableCTests, ImportFreeBufferSingleton) { + auto buffer = allocate({ + .name = {"VTS_TEMP"}, + .width = 64, + .height = 64, + .layerCount = 1, + .format = PixelFormat::RGBA_8888, + .usage = BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN, + .reservedSize = 0, + }); + ASSERT_NE(nullptr, buffer.get()); + EXPECT_GE(buffer->stride(), 64); + + buffer_handle_t bufferHandle = nullptr; + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.importBuffer(buffer->rawHandle(), &bufferHandle)); + ASSERT_NE(nullptr, bufferHandle); + + AIMapper* secondMapper; + ASSERT_EQ(AIMAPPER_ERROR_NONE, getIMapperLoader()(&secondMapper)); + ASSERT_EQ(AIMAPPER_ERROR_NONE, secondMapper->v5.freeBuffer(bufferHandle)); +} + +/** + * Test IMapper::importBuffer with invalid buffers. + */ +TEST_P(GraphicsMapperStableCTests, ImportBufferNegative) { + native_handle_t* invalidHandle = nullptr; + buffer_handle_t bufferHandle = nullptr; + EXPECT_EQ(AIMAPPER_ERROR_BAD_BUFFER, mapper()->v5.importBuffer(invalidHandle, &bufferHandle)) + << "importBuffer with nullptr did not fail with BAD_BUFFER"; + + invalidHandle = native_handle_create(0, 0); + EXPECT_EQ(AIMAPPER_ERROR_BAD_BUFFER, mapper()->v5.importBuffer(invalidHandle, &bufferHandle)) + << "importBuffer with invalid handle did not fail with BAD_BUFFER"; + native_handle_delete(invalidHandle); +} + +/** + * Test IMapper::freeBuffer with invalid buffers. + */ +TEST_P(GraphicsMapperStableCTests, FreeBufferNegative) { + native_handle_t* bufferHandle = nullptr; + EXPECT_EQ(AIMAPPER_ERROR_BAD_BUFFER, mapper()->v5.freeBuffer(bufferHandle)) + << "freeBuffer with nullptr did not fail with BAD_BUFFER"; + + bufferHandle = native_handle_create(0, 0); + EXPECT_EQ(AIMAPPER_ERROR_BAD_BUFFER, mapper()->v5.freeBuffer(bufferHandle)) + << "freeBuffer with invalid handle did not fail with BAD_BUFFER"; + native_handle_delete(bufferHandle); + + auto buffer = allocateGeneric(); + EXPECT_EQ(AIMAPPER_ERROR_BAD_BUFFER, mapper()->v5.freeBuffer(buffer->rawHandle())) + << "freeBuffer with un-imported handle did not fail with BAD_BUFFER"; +} + +/** + * Test IMapper::lock and IMapper::unlock. + */ +TEST_P(GraphicsMapperStableCTests, LockUnlockBasic) { + constexpr auto usage = BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN; + auto buffer = allocate({ + .name = {"VTS_TEMP"}, + .width = 64, + .height = 64, + .layerCount = 1, + .format = PixelFormat::RGBA_8888, + .usage = usage, + .reservedSize = 0, + }); + ASSERT_NE(nullptr, buffer.get()); + + // lock buffer for writing + const auto& info = buffer->info(); + const auto stride = buffer->stride(); + const ARect region{0, 0, info.width, info.height}; + auto handle = buffer->import(); + uint8_t* data = nullptr; + ASSERT_EQ(AIMAPPER_ERROR_NONE, + mapper()->v5.lock(*handle, static_cast(usage), region, -1, (void**)&data)); + + // RGBA_8888 + fillRGBA8888(data, info.height, stride * 4, info.width * 4); + + int releaseFence = -1; + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.unlock(*handle, &releaseFence)); + + // lock again for reading + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.lock(*handle, static_cast(usage), region, + releaseFence, (void**)&data)); + releaseFence = -1; + + ASSERT_NO_FATAL_FAILURE(verifyRGBA8888(*handle, data, info.height, stride * 4, info.width * 4)); + + releaseFence = -1; + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.unlock(*handle, &releaseFence)); + if (releaseFence != -1) { + close(releaseFence); + } +} + +/** + * Test multiple operations associated with different color formats + */ +TEST_P(GraphicsMapperStableCTests, Lock_YCRCB_420_SP) { + BufferDescriptorInfo info{ + .name = {"VTS_TEMP"}, + .width = 64, + .height = 64, + .layerCount = 1, + .format = PixelFormat::YCRCB_420_SP, + .usage = BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN, + .reservedSize = 0, + }; + auto buffer = allocate(info); + if (!buffer) { + ASSERT_FALSE(isSupported(info)); + GTEST_SUCCEED() << "YCRCB_420_SP format is unsupported"; + return; + } + + // lock buffer for writing + const ARect region{0, 0, info.width, info.height}; + auto handle = buffer->import(); + uint8_t* data = nullptr; + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.lock(*handle, static_cast(info.usage), + region, -1, (void**)&data)); + + android_ycbcr yCbCr; + int64_t hSubsampling = 0; + int64_t vSubsampling = 0; + ASSERT_NO_FATAL_FAILURE(getAndroidYCbCr(*handle, data, &yCbCr, &hSubsampling, &vSubsampling)); + + constexpr uint32_t kCbCrSubSampleFactor = 2; + ASSERT_EQ(kCbCrSubSampleFactor, hSubsampling); + ASSERT_EQ(kCbCrSubSampleFactor, vSubsampling); + + auto cbData = static_cast(yCbCr.cb); + auto crData = static_cast(yCbCr.cr); + ASSERT_EQ(crData + 1, cbData); + ASSERT_EQ(2, yCbCr.chroma_step); + + fillYCbCrData(yCbCr, info.width, info.height, hSubsampling, vSubsampling); + + int releaseFence = -1; + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.unlock(*handle, &releaseFence)); + + // lock again for reading + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.lock(*handle, static_cast(info.usage), + region, releaseFence, (void**)&data)); + releaseFence = -1; + + ASSERT_NO_FATAL_FAILURE(getAndroidYCbCr(*handle, data, &yCbCr, &hSubsampling, &vSubsampling)); + + verifyYCbCrData(yCbCr, info.width, info.height, hSubsampling, vSubsampling); + + releaseFence = -1; + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.unlock(*handle, &releaseFence)); + if (releaseFence != -1) { + close(releaseFence); + } +} + +TEST_P(GraphicsMapperStableCTests, YV12SubsampleMetadata) { + BufferDescriptorInfo info{ + .name = {"VTS_TEMP"}, + .width = 64, + .height = 64, + .layerCount = 1, + .format = PixelFormat::YV12, + .usage = BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN, + .reservedSize = 0, + }; + auto buffer = allocate(info); + ASSERT_NE(nullptr, buffer.get()); + + // lock buffer for writing + const ARect region{0, 0, info.width, info.height}; + auto handle = buffer->import(); + uint8_t* data = nullptr; + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.lock(*handle, static_cast(info.usage), + region, -1, (void**)&data)); + + auto decodeResult = getStandardMetadata(*handle); + ASSERT_TRUE(decodeResult.has_value()); + const auto& planeLayouts = *decodeResult; + + ASSERT_EQ(3, planeLayouts.size()); + + auto yPlane = planeLayouts[0]; + auto crPlane = planeLayouts[1]; + auto cbPlane = planeLayouts[2]; + + constexpr uint32_t kCbCrSubSampleFactor = 2; + EXPECT_EQ(kCbCrSubSampleFactor, crPlane.horizontalSubsampling); + EXPECT_EQ(kCbCrSubSampleFactor, crPlane.verticalSubsampling); + + EXPECT_EQ(kCbCrSubSampleFactor, cbPlane.horizontalSubsampling); + EXPECT_EQ(kCbCrSubSampleFactor, cbPlane.verticalSubsampling); + + const long chromaSampleWidth = info.width / kCbCrSubSampleFactor; + const long chromaSampleHeight = info.height / kCbCrSubSampleFactor; + + EXPECT_EQ(info.width, yPlane.widthInSamples); + EXPECT_EQ(info.height, yPlane.heightInSamples); + + EXPECT_EQ(chromaSampleWidth, crPlane.widthInSamples); + EXPECT_EQ(chromaSampleHeight, crPlane.heightInSamples); + + EXPECT_EQ(chromaSampleWidth, cbPlane.widthInSamples); + EXPECT_EQ(chromaSampleHeight, cbPlane.heightInSamples); + + EXPECT_LE(crPlane.widthInSamples, crPlane.strideInBytes); + EXPECT_LE(cbPlane.widthInSamples, cbPlane.strideInBytes); + + int releaseFence = -1; + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.unlock(*handle, &releaseFence)); + if (releaseFence != -1) { + close(releaseFence); + } +} + +TEST_P(GraphicsMapperStableCTests, Lock_YV12) { + BufferDescriptorInfo info{ + .name = {"VTS_TEMP"}, + .width = 64, + .height = 64, + .layerCount = 1, + .format = PixelFormat::YV12, + .usage = BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN, + .reservedSize = 0, + }; + auto buffer = allocate(info); + ASSERT_NE(nullptr, buffer.get()); + + // lock buffer for writing + const ARect region{0, 0, info.width, info.height}; + auto handle = buffer->import(); + uint8_t* data = nullptr; + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.lock(*handle, static_cast(info.usage), + region, -1, (void**)&data)); + + android_ycbcr yCbCr; + int64_t hSubsampling = 0; + int64_t vSubsampling = 0; + ASSERT_NO_FATAL_FAILURE(getAndroidYCbCr(*handle, data, &yCbCr, &hSubsampling, &vSubsampling)); + + constexpr uint32_t kCbCrSubSampleFactor = 2; + ASSERT_EQ(kCbCrSubSampleFactor, hSubsampling); + ASSERT_EQ(kCbCrSubSampleFactor, vSubsampling); + + auto cbData = static_cast(yCbCr.cb); + auto crData = static_cast(yCbCr.cr); + ASSERT_EQ(crData + yCbCr.cstride * info.height / vSubsampling, cbData); + ASSERT_EQ(1, yCbCr.chroma_step); + + fillYCbCrData(yCbCr, info.width, info.height, hSubsampling, vSubsampling); + + int releaseFence = -1; + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.unlock(*handle, &releaseFence)); + + // lock again for reading + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.lock(*handle, static_cast(info.usage), + region, releaseFence, (void**)&data)); + releaseFence = -1; + + ASSERT_NO_FATAL_FAILURE(getAndroidYCbCr(*handle, data, &yCbCr, &hSubsampling, &vSubsampling)); + + verifyYCbCrData(yCbCr, info.width, info.height, hSubsampling, vSubsampling); + + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.unlock(*handle, &releaseFence)); + if (releaseFence != -1) { + close(releaseFence); + } +} + +TEST_P(GraphicsMapperStableCTests, Lock_YCBCR_420_888) { + BufferDescriptorInfo info{ + .name = {"VTS_TEMP"}, + .width = 64, + .height = 64, + .layerCount = 1, + .format = PixelFormat::YCBCR_420_888, + .usage = BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN, + .reservedSize = 0, + }; + auto buffer = allocate(info); + ASSERT_NE(nullptr, buffer.get()); + + // lock buffer for writing + const ARect region{0, 0, info.width, info.height}; + auto handle = buffer->import(); + uint8_t* data = nullptr; + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.lock(*handle, static_cast(info.usage), + region, -1, (void**)&data)); + + android_ycbcr yCbCr; + int64_t hSubsampling = 0; + int64_t vSubsampling = 0; + ASSERT_NO_FATAL_FAILURE(getAndroidYCbCr(*handle, data, &yCbCr, &hSubsampling, &vSubsampling)); + + constexpr uint32_t kCbCrSubSampleFactor = 2; + ASSERT_EQ(kCbCrSubSampleFactor, hSubsampling); + ASSERT_EQ(kCbCrSubSampleFactor, vSubsampling); + + fillYCbCrData(yCbCr, info.width, info.height, hSubsampling, vSubsampling); + + int releaseFence = -1; + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.unlock(*handle, &releaseFence)); + + // lock again for reading + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.lock(*handle, static_cast(info.usage), + region, releaseFence, (void**)&data)); + releaseFence = -1; + + ASSERT_NO_FATAL_FAILURE(getAndroidYCbCr(*handle, data, &yCbCr, &hSubsampling, &vSubsampling)); + + verifyYCbCrData(yCbCr, info.width, info.height, hSubsampling, vSubsampling); + + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.unlock(*handle, &releaseFence)); + if (releaseFence != -1) { + close(releaseFence); + } +} + +TEST_P(GraphicsMapperStableCTests, Lock_RAW10) { + BufferDescriptorInfo info{ + .name = {"VTS_TEMP"}, + .width = 64, + .height = 64, + .layerCount = 1, + .format = PixelFormat::RAW10, + .usage = BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN, + .reservedSize = 0, + }; + auto buffer = allocate(info); + if (!buffer) { + ASSERT_FALSE(isSupported(info)); + GTEST_SUCCEED() << "RAW10 format is unsupported"; + return; + } + + // lock buffer for writing + const ARect region{0, 0, info.width, info.height}; + auto handle = buffer->import(); + uint8_t* data = nullptr; + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.lock(*handle, static_cast(info.usage), + region, -1, (void**)&data)); + + auto decodeResult = getStandardMetadata(*handle); + ASSERT_TRUE(decodeResult.has_value()); + const auto& planeLayouts = *decodeResult; + + ASSERT_EQ(1, planeLayouts.size()); + auto planeLayout = planeLayouts[0]; + + EXPECT_EQ(0, planeLayout.sampleIncrementInBits); + EXPECT_EQ(1, planeLayout.horizontalSubsampling); + EXPECT_EQ(1, planeLayout.verticalSubsampling); + + ASSERT_EQ(1, planeLayout.components.size()); + auto planeLayoutComponent = planeLayout.components[0]; + + EXPECT_EQ(PlaneLayoutComponentType::RAW, + static_cast(planeLayoutComponent.type.value)); + EXPECT_EQ(0, planeLayoutComponent.offsetInBits % 8); + EXPECT_EQ(-1, planeLayoutComponent.sizeInBits); + + int releaseFence = -1; + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.unlock(*handle, &releaseFence)); + if (releaseFence != -1) { + close(releaseFence); + } +} + +TEST_P(GraphicsMapperStableCTests, Lock_RAW12) { + BufferDescriptorInfo info{ + .name = {"VTS_TEMP"}, + .width = 64, + .height = 64, + .layerCount = 1, + .format = PixelFormat::RAW12, + .usage = BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN, + .reservedSize = 0, + }; + auto buffer = allocate(info); + if (!buffer) { + ASSERT_FALSE(isSupported(info)); + GTEST_SUCCEED() << "RAW12 format is unsupported"; + return; + } + + // lock buffer for writing + const ARect region{0, 0, info.width, info.height}; + auto handle = buffer->import(); + uint8_t* data = nullptr; + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.lock(*handle, static_cast(info.usage), + region, -1, (void**)&data)); + + auto decodeResult = getStandardMetadata(*handle); + ASSERT_TRUE(decodeResult.has_value()); + const auto& planeLayouts = *decodeResult; + + ASSERT_EQ(1, planeLayouts.size()); + auto planeLayout = planeLayouts[0]; + + EXPECT_EQ(0, planeLayout.sampleIncrementInBits); + EXPECT_EQ(1, planeLayout.horizontalSubsampling); + EXPECT_EQ(1, planeLayout.verticalSubsampling); + + ASSERT_EQ(1, planeLayout.components.size()); + auto planeLayoutComponent = planeLayout.components[0]; + + EXPECT_EQ(PlaneLayoutComponentType::RAW, + static_cast(planeLayoutComponent.type.value)); + EXPECT_EQ(0, planeLayoutComponent.offsetInBits % 8); + EXPECT_EQ(-1, planeLayoutComponent.sizeInBits); + + int releaseFence = -1; + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.unlock(*handle, &releaseFence)); + if (releaseFence != -1) { + close(releaseFence); + } +} + +TEST_P(GraphicsMapperStableCTests, Lock_YCBCR_P010) { + BufferDescriptorInfo info{ + .name = {"VTS_TEMP"}, + .width = 64, + .height = 64, + .layerCount = 1, + .format = PixelFormat::YCBCR_P010, + .usage = BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN, + .reservedSize = 0, + }; + auto buffer = allocate(info); + if (!buffer) { + ASSERT_FALSE(isSupported(info)); + GTEST_SUCCEED() << "YCBCR_P010 format is unsupported"; + return; + } + + // lock buffer for writing + const ARect region{0, 0, info.width, info.height}; + auto handle = buffer->import(); + uint8_t* data = nullptr; + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.lock(*handle, static_cast(info.usage), + region, -1, (void**)&data)); + + YCbCr yCbCr; + ASSERT_NO_FATAL_FAILURE(yCbCr = getAndroidYCbCr_P010(*handle, data)); + + constexpr uint32_t kCbCrSubSampleFactor = 2; + ASSERT_EQ(kCbCrSubSampleFactor, yCbCr.horizontalSubSampling); + ASSERT_EQ(kCbCrSubSampleFactor, yCbCr.verticalSubSampling); + + ASSERT_EQ(0, info.height % 2); + + // fill the data + fillYCbCrData(yCbCr.yCbCr, info.width, info.height, yCbCr.horizontalSubSampling, + yCbCr.verticalSubSampling); + // verify the YCbCr data + verifyYCbCrData(yCbCr.yCbCr, info.width, info.height, yCbCr.horizontalSubSampling, + yCbCr.verticalSubSampling); + + int releaseFence = -1; + ASSERT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.unlock(*handle, &releaseFence)); + if (releaseFence != -1) { + close(releaseFence); + } +} + +TEST_P(GraphicsMapperStableCTests, LockBadAccessRegion) { + auto buffer = allocateGeneric(); + ASSERT_NE(nullptr, buffer); + const auto& info = buffer->info(); + + // lock buffer for writing + const ARect region{0, 0, info.width * 2, info.height * 2}; + auto handle = buffer->import(); + uint8_t* data = nullptr; + EXPECT_EQ(AIMAPPER_ERROR_BAD_VALUE, mapper()->v5.lock(*handle, static_cast(info.usage), + region, -1, (void**)&data)); +} + +TEST_P(GraphicsMapperStableCTests, UnlockNegative) { + native_handle_t* invalidHandle = nullptr; + int releaseFence = -1; + EXPECT_EQ(AIMAPPER_ERROR_BAD_BUFFER, mapper()->v5.unlock(invalidHandle, &releaseFence)) + << "unlock with nullptr did not fail with BAD_BUFFER"; + + invalidHandle = native_handle_create(0, 0); + EXPECT_EQ(AIMAPPER_ERROR_BAD_BUFFER, mapper()->v5.unlock(invalidHandle, &releaseFence)) + << "unlock with invalid handle did not fail with BAD_BUFFER"; + native_handle_delete(invalidHandle); + + auto buffer = allocateGeneric(); + EXPECT_EQ(AIMAPPER_ERROR_BAD_BUFFER, mapper()->v5.unlock(buffer->rawHandle(), &releaseFence)) + << "unlock with un-imported handle did not fail with BAD_BUFFER"; +} + +TEST_P(GraphicsMapperStableCTests, UnlockNotImported) { + int releaseFence = -1; + auto buffer = allocateGeneric(); + ASSERT_TRUE(buffer); + EXPECT_EQ(AIMAPPER_ERROR_BAD_BUFFER, mapper()->v5.unlock(buffer->rawHandle(), &releaseFence)) + << "unlock with un-imported handle did not fail with BAD_BUFFER"; +} + +TEST_P(GraphicsMapperStableCTests, UnlockNotLocked) { + int releaseFence = -1; + auto buffer = allocateGeneric(); + ASSERT_TRUE(buffer); + auto bufferHandle = buffer->import(); + ASSERT_TRUE(bufferHandle); + EXPECT_EQ(AIMAPPER_ERROR_BAD_BUFFER, mapper()->v5.unlock(*bufferHandle, &releaseFence)) + << "unlock with unlocked handle did not fail with BAD_BUFFER"; +} + +TEST_P(GraphicsMapperStableCTests, LockUnlockNested) { + auto buffer = allocateGeneric(); + ASSERT_TRUE(buffer); + auto bufferHandle = buffer->import(); + ASSERT_TRUE(bufferHandle); + const ARect region{0, 0, buffer->info().width, buffer->info().height}; + auto usage = static_cast(buffer->info().usage); + auto handle = buffer->import(); + uint8_t* data = nullptr; + EXPECT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.lock(*handle, usage, region, -1, (void**)&data)); + EXPECT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.lock(*handle, usage, region, -1, (void**)&data)) + << "Second lock failed"; + int releaseFence = -1; + EXPECT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.unlock(*handle, &releaseFence)); + if (releaseFence != -1) { + close(releaseFence); + releaseFence = -1; + } + EXPECT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.unlock(*handle, &releaseFence)) + << "Second unlock failed"; + if (releaseFence != -1) { + close(releaseFence); + releaseFence = -1; + } + EXPECT_EQ(AIMAPPER_ERROR_BAD_BUFFER, mapper()->v5.unlock(*handle, &releaseFence)) + << "Third, unmatched, unlock should have failed with BAD_BUFFER"; +} + +TEST_P(GraphicsMapperStableCTests, FlushRereadBasic) { + auto buffer = allocateGeneric(); + ASSERT_TRUE(buffer); + auto bufferHandle = buffer->import(); + ASSERT_TRUE(bufferHandle); + const auto& info = buffer->info(); + const auto stride = buffer->stride(); + const ARect region{0, 0, buffer->info().width, buffer->info().height}; + + auto writeHandle = buffer->import(); + auto readHandle = buffer->import(); + ASSERT_TRUE(writeHandle && readHandle); + + // lock buffer for writing + + uint8_t* writeData; + EXPECT_EQ(AIMAPPER_ERROR_NONE, + mapper()->v5.lock(*writeHandle, static_cast(BufferUsage::CPU_WRITE_OFTEN), + region, -1, (void**)&writeData)); + + uint8_t* readData; + EXPECT_EQ(AIMAPPER_ERROR_NONE, + mapper()->v5.lock(*readHandle, static_cast(BufferUsage::CPU_READ_OFTEN), + region, -1, (void**)&readData)); + + fillRGBA8888(writeData, info.height, stride * 4, info.width * 4); + + EXPECT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.flushLockedBuffer(*writeHandle)); + EXPECT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.rereadLockedBuffer(*readHandle)); + + ASSERT_NO_FATAL_FAILURE( + verifyRGBA8888(*readHandle, readData, info.height, stride * 4, info.width * 4)); + + int releaseFence = -1; + + EXPECT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.unlock(*readHandle, &releaseFence)); + if (releaseFence != -1) { + close(releaseFence); + releaseFence = -1; + } + + EXPECT_EQ(AIMAPPER_ERROR_NONE, mapper()->v5.unlock(*writeHandle, &releaseFence)); + if (releaseFence != -1) { + close(releaseFence); + releaseFence = -1; + } +} + +TEST_P(GraphicsMapperStableCTests, FlushLockedBufferBadBuffer) { + // Amazingly this is enough to make the compiler happy even though flushLockedBuffer + // is _Nonnull :shrug: + buffer_handle_t badBuffer = nullptr; + EXPECT_EQ(AIMAPPER_ERROR_BAD_BUFFER, mapper()->v5.flushLockedBuffer(badBuffer)); +} + +TEST_P(GraphicsMapperStableCTests, RereadLockedBufferBadBuffer) { + buffer_handle_t badBuffer = nullptr; + EXPECT_EQ(AIMAPPER_ERROR_BAD_BUFFER, mapper()->v5.rereadLockedBuffer(badBuffer)); +} + +TEST_P(GraphicsMapperStableCTests, GetBufferId) { + auto buffer = allocateGeneric(); + auto bufferHandle = buffer->import(); + auto bufferId = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(bufferId.has_value()); + + auto buffer2 = allocateGeneric(); + auto bufferHandle2 = buffer2->import(); + auto bufferId2 = getStandardMetadata(*bufferHandle2); + ASSERT_TRUE(bufferId2.has_value()); + + EXPECT_NE(*bufferId, *bufferId2); +} + +TEST_P(GraphicsMapperStableCTests, GetName) { + auto buffer = allocate({ + .name = {"Hello, World!"}, + .width = 64, + .height = 64, + .layerCount = 1, + .format = PixelFormat::RGBA_8888, + .usage = BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN, + .reservedSize = 0, + }); + auto bufferHandle = buffer->import(); + auto name = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(name.has_value()); + EXPECT_EQ(*name, "Hello, World!"); +} + +TEST_P(GraphicsMapperStableCTests, GetWidthHeight) { + auto buffer = allocate({ + .name = {"Hello, World!"}, + .width = 64, + .height = 128, + .layerCount = 1, + .format = PixelFormat::RGBA_8888, + .usage = BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN, + .reservedSize = 0, + }); + auto bufferHandle = buffer->import(); + auto value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + EXPECT_EQ(*value, 64); + value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + EXPECT_EQ(*value, 128); +} + +TEST_P(GraphicsMapperStableCTests, GetLayerCount) { + auto buffer = allocateGeneric(); + auto bufferHandle = buffer->import(); + auto value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + EXPECT_EQ(*value, buffer->info().layerCount); +} + +TEST_P(GraphicsMapperStableCTests, GetPixelFormatRequested) { + auto buffer = allocateGeneric(); + auto bufferHandle = buffer->import(); + auto value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + EXPECT_EQ(*value, buffer->info().format); +} + +TEST_P(GraphicsMapperStableCTests, GetPixelFormatFourCC) { + auto buffer = allocate({ + .name = {"Hello, World!"}, + .width = 64, + .height = 128, + .layerCount = 1, + .format = PixelFormat::RGBA_8888, + .usage = BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN, + .reservedSize = 0, + }); + { + auto bufferHandle = buffer->import(); + auto value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + EXPECT_EQ(*value, DRM_FORMAT_ABGR8888); + } + + buffer = allocate({ + .name = {"yv12"}, + .width = 64, + .height = 128, + .layerCount = 1, + .format = PixelFormat::YV12, + .usage = BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN, + .reservedSize = 0, + }); + { + auto bufferHandle = buffer->import(); + auto value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + EXPECT_EQ(*value, DRM_FORMAT_YVU420); + } +} + +TEST_P(GraphicsMapperStableCTests, GetPixelFormatModifier) { + auto buffer = allocateGeneric(); + auto bufferHandle = buffer->import(); + auto value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + // Only the upper 8-bits are defined and is just the vendor ID, the lower 56 bits are + // then vendor specific. So there's not anything useful to assert here beyond just that + // we successfully queried a value +} + +TEST_P(GraphicsMapperStableCTests, GetUsage) { + auto buffer = allocateGeneric(); + auto bufferHandle = buffer->import(); + auto value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + EXPECT_EQ(buffer->info().usage, *value); +} + +TEST_P(GraphicsMapperStableCTests, GetAllocationSize) { + auto buffer = allocateGeneric(); + auto bufferHandle = buffer->import(); + auto value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + const auto estimatedSize = buffer->stride() * buffer->info().height * 4; + // This buffer has CPU usage, so we expect at least stride * height * 4 since it should be + // generally linear uncompressed. + EXPECT_GE(*value, estimatedSize) + << "Expected allocation size to be at least stride * height * 4bpp"; + // Might need refining, but hopefully this a generous-enough upper-bound? + EXPECT_LT(*value, estimatedSize * 2) + << "Expected allocation size to less than double stride * height * 4bpp"; +} + +TEST_P(GraphicsMapperStableCTests, GetProtectedContent) { + const BufferDescriptorInfo info{ + .name = {"prot8888"}, + .width = 64, + .height = 64, + .layerCount = 1, + .format = PixelFormat::RGBA_8888, + .usage = BufferUsage::PROTECTED | BufferUsage::COMPOSER_OVERLAY, + .reservedSize = 0, + }; + auto buffer = allocate(info); + if (!buffer) { + ASSERT_FALSE(isSupported(info)) + << "Allocation of trivial sized buffer failed, so isSupported() must be false"; + GTEST_SUCCEED() << "PROTECTED RGBA_8888 is unsupported"; + return; + } + auto bufferHandle = buffer->import(); + auto value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + EXPECT_EQ(*value, 1); +} + +TEST_P(GraphicsMapperStableCTests, GetCompression) { + auto buffer = allocateGeneric(); + ASSERT_TRUE(buffer); + auto bufferHandle = buffer->import(); + ASSERT_TRUE(bufferHandle); + auto value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + EXPECT_EQ(gralloc4::Compression_None.name, value->name); + EXPECT_EQ(gralloc4::Compression_None.value, value->value); +} + +TEST_P(GraphicsMapperStableCTests, GetInterlaced) { + auto buffer = allocateGeneric(); + ASSERT_TRUE(buffer); + auto bufferHandle = buffer->import(); + ASSERT_TRUE(bufferHandle); + auto value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + EXPECT_EQ(gralloc4::Interlaced_None.name, value->name); + EXPECT_EQ(gralloc4::Interlaced_None.value, value->value); +} + +TEST_P(GraphicsMapperStableCTests, GetChromaSiting) { + auto buffer = allocateGeneric(); + ASSERT_TRUE(buffer); + auto bufferHandle = buffer->import(); + ASSERT_TRUE(bufferHandle); + auto value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + EXPECT_EQ(gralloc4::ChromaSiting_None.name, value->name); + EXPECT_EQ(gralloc4::ChromaSiting_None.value, value->value); +} + +TEST_P(GraphicsMapperStableCTests, GetPlaneLayouts) { + auto buffer = allocateGeneric(); + ASSERT_TRUE(buffer); + auto bufferHandle = buffer->import(); + ASSERT_TRUE(bufferHandle); + auto value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + ASSERT_NO_FATAL_FAILURE(verifyRGBA8888PlaneLayouts(*value)); +} + +TEST_P(GraphicsMapperStableCTests, GetCrop) { + auto buffer = allocateGeneric(); + ASSERT_TRUE(buffer); + auto bufferHandle = buffer->import(); + ASSERT_TRUE(bufferHandle); + auto value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + EXPECT_EQ(1, value->size()); + const Rect expected{0, 0, buffer->info().width, buffer->info().height}; + EXPECT_EQ(expected, value->at(0)); +} + +TEST_P(GraphicsMapperStableCTests, GetSetDataspace) { + auto buffer = allocateGeneric(); + ASSERT_TRUE(buffer); + auto bufferHandle = buffer->import(); + ASSERT_TRUE(bufferHandle); + auto value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + EXPECT_EQ(Dataspace::UNKNOWN, *value); + EXPECT_EQ(AIMAPPER_ERROR_NONE, setStandardMetadata( + *bufferHandle, Dataspace::DISPLAY_P3)); + value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + EXPECT_EQ(Dataspace::DISPLAY_P3, *value); +} + +TEST_P(GraphicsMapperStableCTests, GetSetBlendMode) { + auto buffer = allocateGeneric(); + ASSERT_TRUE(buffer); + auto bufferHandle = buffer->import(); + ASSERT_TRUE(bufferHandle); + auto value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + EXPECT_EQ(BlendMode::INVALID, *value); + EXPECT_EQ(AIMAPPER_ERROR_NONE, setStandardMetadata( + *bufferHandle, BlendMode::COVERAGE)); + value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + EXPECT_EQ(BlendMode::COVERAGE, *value); +} + +TEST_P(GraphicsMapperStableCTests, GetSetSmpte2086) { + auto buffer = allocateGeneric(); + ASSERT_TRUE(buffer); + auto bufferHandle = buffer->import(); + ASSERT_TRUE(bufferHandle); + auto value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + EXPECT_FALSE(value->has_value()); + + // TODO: Maybe use something resembling real values, but validation isn't supposed to happen + // here anyway so :shrug: + const Smpte2086 awesomeHdr{ + XyColor{1.f, 1.f}, XyColor{2.f, 2.f}, XyColor{3.f, 3.f}, + XyColor{400.f, 1000.f}, 100000.0f, 0.0001f, + }; + EXPECT_EQ(AIMAPPER_ERROR_NONE, + setStandardMetadata(*bufferHandle, awesomeHdr)); + value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + ASSERT_TRUE(value->has_value()); + EXPECT_EQ(awesomeHdr, *value); + + EXPECT_EQ(AIMAPPER_ERROR_NONE, + setStandardMetadata(*bufferHandle, std::nullopt)); + value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + EXPECT_FALSE(value->has_value()); +} + +TEST_P(GraphicsMapperStableCTests, GetCta861_3) { + auto buffer = allocateGeneric(); + ASSERT_TRUE(buffer); + auto bufferHandle = buffer->import(); + ASSERT_TRUE(bufferHandle); + auto value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + EXPECT_FALSE(value->has_value()); + + const Cta861_3 genericHlgish{1000.f, 140.f}; + EXPECT_EQ(AIMAPPER_ERROR_NONE, + setStandardMetadata(*bufferHandle, genericHlgish)); + value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + ASSERT_TRUE(value->has_value()); + EXPECT_EQ(genericHlgish, *value); + + EXPECT_EQ(AIMAPPER_ERROR_NONE, + setStandardMetadata(*bufferHandle, std::nullopt)); + value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + EXPECT_FALSE(value->has_value()); +} + +TEST_P(GraphicsMapperStableCTests, GetSmpte2094_10) { + auto buffer = allocateGeneric(); + ASSERT_TRUE(buffer); + auto bufferHandle = buffer->import(); + ASSERT_TRUE(bufferHandle); + auto value = getStandardMetadata(*bufferHandle); + if (value.has_value()) { + EXPECT_FALSE(value->has_value()); + } +} + +TEST_P(GraphicsMapperStableCTests, GetSmpte2094_40) { + auto buffer = allocateGeneric(); + ASSERT_TRUE(buffer); + auto bufferHandle = buffer->import(); + ASSERT_TRUE(bufferHandle); + auto value = getStandardMetadata(*bufferHandle); + ASSERT_TRUE(value.has_value()); + EXPECT_FALSE(value->has_value()); +} + +std::vector>> getIAllocatorsAtLeastVersion( + int32_t minVersion) { + auto instanceNames = getAidlHalInstanceNames(IAllocator::descriptor); + std::vector>> filteredInstances; + filteredInstances.reserve(instanceNames.size()); + for (const auto& name : instanceNames) { + auto allocator = + IAllocator::fromBinder(ndk::SpAIBinder(AServiceManager_checkService(name.c_str()))); + int32_t version = 0; + if (allocator->getInterfaceVersion(&version).isOk()) { + if (version >= minVersion) { + filteredInstances.emplace_back(name, std::move(allocator)); + } + } + } + return filteredInstances; +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsMapperStableCTests); +INSTANTIATE_TEST_CASE_P(PerInstance, GraphicsMapperStableCTests, + testing::ValuesIn(getIAllocatorsAtLeastVersion(2)), + [](auto info) -> std::string { + std::string name = + std::to_string(info.index) + "/" + std::get<0>(info.param); + return Sanitize(name); + }); \ No newline at end of file From 3326de0352d36ddbf2839f453934266c931bd230 Mon Sep 17 00:00:00 2001 From: shrikar Date: Mon, 7 Nov 2022 23:51:20 +0000 Subject: [PATCH 387/998] Added SEAT_EASY_ACCESS_ENABLED to hardware layer. Bug: 257268353 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I31c9712d628e4be1e667ee9e7abedbc38c25f725 --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 11 +++++++++++ .../generated_lib/cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../default_config/config/DefaultProperties.json | 16 ++++++++++++++++ .../src/VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 38 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 3bb8811448..3fe19ae6ef 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -155,6 +155,7 @@ enum VehicleProperty { SEAT_HEADREST_ANGLE_MOVE = 356518808, SEAT_HEADREST_FORE_AFT_POS = 356518809, SEAT_HEADREST_FORE_AFT_MOVE = 356518810, + SEAT_EASY_ACCESS_ENABLED = 354421661, SEAT_OCCUPANCY = 356518832, WINDOW_POS = 322964416, WINDOW_MOVE = 322964417, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 60191b241f..e0320bc62a 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1721,6 +1721,17 @@ enum VehicleProperty { */ SEAT_HEADREST_FORE_AFT_MOVE = 0x0B9A + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Represents property for Seat easy access feature. + * + * If true, the seat will automatically adjust to make it easier for the occupant to enter and + * exit the vehicle. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + SEAT_EASY_ACCESS_ENABLED = + 0x0B9D + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.BOOLEAN, /** * Seat Occupancy * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index e93972e129..dc92aa1568 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -155,6 +155,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_OCCUPANCY, VehiclePropertyAccess::READ}, {VehicleProperty::WINDOW_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::WINDOW_MOVE, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index f94e2c3dba..2780c342ba 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -155,6 +155,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_OCCUPANCY, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDOW_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDOW_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 66295147c7..cb77abc7cf 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -147,6 +147,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_OCCUPANCY, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 7c00fbba81..b6ddb285a3 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -147,6 +147,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_OCCUPANCY, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index b3dbe05ea3..70716866f2 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1035,6 +1035,22 @@ } ] }, + { + "property": "VehicleProperty::SEAT_EASY_ACCESS_ENABLED", + "defaultValue": { + "int32Values": [ + 1 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + } + ] + }, { "property": "VehicleProperty::SEAT_OCCUPANCY", "areas": [ diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index f230be9dd9..e8c816fa8c 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -535,6 +535,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyMirrorAutoTiltEnabledConfig) { VehicleArea::MIRROR, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatEasyAccessEnabledConfig) { + verifyProperty(VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::SEAT, VehiclePropertyType::BOOLEAN); +} + std::vector getDescriptors() { std::vector descriptors; for (std::string name : getAidlHalInstanceNames(IVehicle::descriptor)) { From 802ecb524ca7b25121ff565072360876ab1f916d Mon Sep 17 00:00:00 2001 From: shrikar Date: Wed, 9 Nov 2022 18:27:06 +0000 Subject: [PATCH 388/998] Added SEAT_CUSHION_SIDE_SUPPORT_POS to hardware layer. Bug: 257268342 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I2f8a64399f634a930e55d16700009652063adee6 --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 16 +++++++++ .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../config/DefaultProperties.json | 35 +++++++++++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++ 8 files changed, 62 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 3fe19ae6ef..f93d76f3b5 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -156,6 +156,7 @@ enum VehicleProperty { SEAT_HEADREST_FORE_AFT_POS = 356518809, SEAT_HEADREST_FORE_AFT_MOVE = 356518810, SEAT_EASY_ACCESS_ENABLED = 354421661, + SEAT_CUSHION_SIDE_SUPPORT_POS = 356518815, SEAT_OCCUPANCY = 356518832, WINDOW_POS = 322964416, WINDOW_MOVE = 322964417, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index e0320bc62a..245857b816 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1732,6 +1732,22 @@ enum VehicleProperty { */ SEAT_EASY_ACCESS_ENABLED = 0x0B9D + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.BOOLEAN, + /** + * Represents property for seat’s hipside (bottom cushion’s side) support position. + * + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers + * between minInt32Value and maxInt32Value are supported. + * + * maxInt32Value indicates the widest cushion side support setting (i.e. least support). + * minInt32Value indicates the thinnest cushion side support setting (i.e most support). + * + * This value is not in any particular unit but in a specified range of steps. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + SEAT_CUSHION_SIDE_SUPPORT_POS = + 0x0B9F + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, /** * Seat Occupancy * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index dc92aa1568..e3a3f0b16f 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -156,6 +156,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_OCCUPANCY, VehiclePropertyAccess::READ}, {VehicleProperty::WINDOW_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::WINDOW_MOVE, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 2780c342ba..51cb60a7ac 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -156,6 +156,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_OCCUPANCY, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDOW_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDOW_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index cb77abc7cf..4d10d50d29 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -148,6 +148,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_OCCUPANCY, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index b6ddb285a3..162b8d2216 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -148,6 +148,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_OCCUPANCY, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 70716866f2..5a0f4a30c0 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1051,6 +1051,41 @@ } ] }, + { + "property": "VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -10, + "maxInt32Value": 10 + } + ] + }, { "property": "VehicleProperty::SEAT_OCCUPANCY", "areas": [ diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index e8c816fa8c..d57ef64d0b 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -541,6 +541,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatEasyAccessEnabledConfig) { VehicleArea::SEAT, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatCushionSideSupportPosConfig) { + verifyProperty(VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, + VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::SEAT, VehiclePropertyType::INT32); +} + std::vector getDescriptors() { std::vector descriptors; for (std::string name : getAidlHalInstanceNames(IVehicle::descriptor)) { From 6f697c9ecf9e09c752d067c17cb80a5902016629 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Fri, 18 Nov 2022 19:39:27 +0000 Subject: [PATCH 389/998] a.h.graphics.common frozen false magic -> explicit Bug: 259465531 Change-Id: I080bee98df6d4ad8799dd60c5090c2e79244ce2f Test: N/A --- graphics/common/aidl/Android.bp | 1 + 1 file changed, 1 insertion(+) diff --git a/graphics/common/aidl/Android.bp b/graphics/common/aidl/Android.bp index cb96663b8d..84bc1afd1e 100644 --- a/graphics/common/aidl/Android.bp +++ b/graphics/common/aidl/Android.bp @@ -40,6 +40,7 @@ aidl_interface { min_sdk_version: "29", }, }, + frozen: false, versions_with_info: [ { version: "1", From b96e3766b974c7c78f5fb4f2e9559f7da8954589 Mon Sep 17 00:00:00 2001 From: shrikar Date: Tue, 8 Nov 2022 16:49:58 -0800 Subject: [PATCH 390/998] Added SEAT_AIRBAG_ENABLED to hardware layer. Bug: 257268798 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I60fbd303a5af6c25c9d242320865eb2cfd2ff61e --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 13 +++++++++++++ .../generated_lib/cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../default_config/config/DefaultProperties.json | 16 ++++++++++++++++ .../src/VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 40 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index f93d76f3b5..6913ff14ea 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -156,6 +156,7 @@ enum VehicleProperty { SEAT_HEADREST_FORE_AFT_POS = 356518809, SEAT_HEADREST_FORE_AFT_MOVE = 356518810, SEAT_EASY_ACCESS_ENABLED = 354421661, + SEAT_AIRBAG_ENABLED = 354421662, SEAT_CUSHION_SIDE_SUPPORT_POS = 356518815, SEAT_OCCUPANCY = 356518832, WINDOW_POS = 322964416, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 245857b816..f9ee52d497 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1732,6 +1732,19 @@ enum VehicleProperty { */ SEAT_EASY_ACCESS_ENABLED = 0x0B9D + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.BOOLEAN, + /** + * Represents feature to enable/disable a seat's ability to deploy airbag(s) when triggered + * (e.g. by a crash). + * + * If true, it means the seat's airbags are enabled, and if triggered (e.g. by a crash), they + * will deploy. If false, it means the seat's airbags are disabled, and they will not deploy + * under any circumstance. This property does not indicate if the airbags are deployed or not. + * + * This property can be set to VehiclePropertyAccess.READ read only for the sake of regulation + * or safety concerns. + */ + SEAT_AIRBAG_ENABLED = + 0x0B9E + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.BOOLEAN, /** * Represents property for seat’s hipside (bottom cushion’s side) support position. * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index e3a3f0b16f..9435a417ad 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -156,6 +156,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_AIRBAG_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_OCCUPANCY, VehiclePropertyAccess::READ}, {VehicleProperty::WINDOW_POS, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 51cb60a7ac..730d03ebdd 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -156,6 +156,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_AIRBAG_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_OCCUPANCY, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDOW_POS, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 4d10d50d29..f73d94a9b8 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -148,6 +148,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_AIRBAG_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_OCCUPANCY, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 162b8d2216..ee650b7fcf 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -148,6 +148,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_AIRBAG_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_OCCUPANCY, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 5a0f4a30c0..7cbf8f97b6 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1051,6 +1051,22 @@ } ] }, + { + "property": "VehicleProperty::SEAT_AIRBAG_ENABLED", + "defaultValue": { + "int32Values": [ + 1 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + } + ] + }, { "property": "VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS", "defaultValue": { diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index d57ef64d0b..2b2ef80f39 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -541,6 +541,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatEasyAccessEnabledConfig) { VehicleArea::SEAT, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatAirbagEnabledConfig) { + verifyProperty(VehicleProperty::SEAT_AIRBAG_ENABLED, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::SEAT, VehiclePropertyType::BOOLEAN); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatCushionSideSupportPosConfig) { verifyProperty(VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, From d4d6adf1ec15f97e59eac3523299a4b68a4c99f0 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Wed, 9 Nov 2022 16:59:47 -0800 Subject: [PATCH 391/998] Add HAL changes for STEERING_WHEEL_EASY_ACCESS_ENABLED Bug: 257267892 Test: atest VtsHalAutomotiveVehicle_TargetTest atest CtsCarTestCases:CarPropertyManagerTest atest CtsCarTestCases:VehiclePropertyIdsTest Change-Id: I729b46f2cc3f41777c2d45eb84898b80fb2b4680 --- .../hardware/automotive/vehicle/VehicleProperty.aidl | 1 + .../hardware/automotive/vehicle/VehicleProperty.aidl | 11 +++++++++++ .../aidl/generated_lib/cpp/AccessForVehicleProperty.h | 1 + .../generated_lib/cpp/ChangeModeForVehicleProperty.h | 1 + .../generated_lib/java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../impl/default_config/config/DefaultProperties.json | 8 ++++++++ .../vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 30 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index f93d76f3b5..0bf0ed4db8 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -167,6 +167,7 @@ enum VehicleProperty { STEERING_WHEEL_HEIGHT_MOVE = 289410019, STEERING_WHEEL_THEFT_LOCK_ENABLED = 287312868, STEERING_WHEEL_LOCKED = 287312869, + STEERING_WHEEL_EASY_ACCESS_ENABLED = 287312870, VEHICLE_MAP_SERVICE = 299895808, OBD2_LIVE_FRAME = 299896064, OBD2_FREEZE_FRAME = 299896065, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 245857b816..8f00dcaa5f 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1911,6 +1911,17 @@ enum VehicleProperty { */ STEERING_WHEEL_LOCKED = 0x0BE5 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Steering wheel easy access feature enabled + * + * If true, the driver’s steering wheel will automatically adjust to make it easier for the + * driver to enter and exit the vehicle. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + STEERING_WHEEL_EASY_ACCESS_ENABLED = + 0x0BE6 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, /** * Vehicle Maps Service (VMS) message * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index e3a3f0b16f..7f9551f866 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -167,6 +167,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::STEERING_WHEEL_THEFT_LOCK_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::STEERING_WHEEL_LOCKED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::STEERING_WHEEL_EASY_ACCESS_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyAccess::READ}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyAccess::READ}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 51cb60a7ac..a875864d85 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -167,6 +167,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_THEFT_LOCK_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_LOCKED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::STEERING_WHEEL_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 4d10d50d29..15868583da 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -159,6 +159,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.STEERING_WHEEL_THEFT_LOCK_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.STEERING_WHEEL_LOCKED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.STEERING_WHEEL_EASY_ACCESS_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyAccess.READ), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 162b8d2216..6f1ebe3a02 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -159,6 +159,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_THEFT_LOCK_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_LOCKED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.STEERING_WHEEL_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 5a0f4a30c0..7f2d8b29c2 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2361,6 +2361,14 @@ ] } }, + { + "property": "VehicleProperty::STEERING_WHEEL_EASY_ACCESS_ENABLED", + "defaultValue": { + "int32Values": [ + 0 + ] + } + }, { "property": "VehicleProperty::WHEEL_TICK", "defaultValue": { diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index d57ef64d0b..11db8e00d1 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -523,6 +523,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelLockedConfig) { VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelEasyAccessEnabledConfig) { + verifyProperty(VehicleProperty::STEERING_WHEEL_EASY_ACCESS_ENABLED, + VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyMirrorAutoFoldEnabledConfig) { verifyProperty(VehicleProperty::MIRROR_AUTO_FOLD_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From a2fbcab17ba52008f7aacca27f3315b07d728478 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Sat, 19 Nov 2022 00:03:50 +0000 Subject: [PATCH 392/998] composer3- frozen + VNDK version magic -> explicit Bug: 259465531 Change-Id: Iefdfe812fc9309a0a758eedb3da9d3676e956f02 Test: build --- graphics/composer/aidl/Android.bp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/graphics/composer/aidl/Android.bp b/graphics/composer/aidl/Android.bp index 0ba320d08c..1e08221301 100644 --- a/graphics/composer/aidl/Android.bp +++ b/graphics/composer/aidl/Android.bp @@ -31,6 +31,8 @@ aidl_interface { enabled: true, support_system_process: true, }, + frozen: false, + vndk_use_version: "1", srcs: [ "android/hardware/graphics/composer3/*.aidl", ], From a3cc4931d830351bdf457fe1e19170180f473216 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Mon, 21 Nov 2022 17:08:45 +0000 Subject: [PATCH 393/998] Remove placeholder API from camera.provider This API was added to work around an AIDL versioning issue that has now been fixed. The changed imports now count as a change to the interface, so this placeholder API is no longer needed. Test: m bug: 237048744 Change-Id: I6c3edb156435b5d66578fe8250716333e0f54d6e --- camera/provider/aidl/Android.bp | 1 + .../android/hardware/camera/provider/ICameraProvider.aidl | 1 - .../android/hardware/camera/provider/ICameraProvider.aidl | 8 -------- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/camera/provider/aidl/Android.bp b/camera/provider/aidl/Android.bp index bb30e43174..d7e613e657 100644 --- a/camera/provider/aidl/Android.bp +++ b/camera/provider/aidl/Android.bp @@ -17,6 +17,7 @@ aidl_interface { "android.hardware.camera.device-V2", "android.hardware.camera.common-V1", ], + frozen: false, stability: "vintf", backend: { java: { diff --git a/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/ICameraProvider.aidl b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/ICameraProvider.aidl index c6a3b9a103..c15bdee62b 100644 --- a/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/ICameraProvider.aidl +++ b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/current/android/hardware/camera/provider/ICameraProvider.aidl @@ -41,7 +41,6 @@ interface ICameraProvider { void notifyDeviceStateChange(long deviceState); android.hardware.camera.provider.ConcurrentCameraIdCombination[] getConcurrentCameraIds(); boolean isConcurrentStreamCombinationSupported(in android.hardware.camera.provider.CameraIdAndStreamCombination[] configs); - void placeholder(); const long DEVICE_STATE_NORMAL = 0; const long DEVICE_STATE_BACK_COVERED = 1; const long DEVICE_STATE_FRONT_COVERED = 2; diff --git a/camera/provider/aidl/android/hardware/camera/provider/ICameraProvider.aidl b/camera/provider/aidl/android/hardware/camera/provider/ICameraProvider.aidl index 5442058d1c..c4eba8d492 100644 --- a/camera/provider/aidl/android/hardware/camera/provider/ICameraProvider.aidl +++ b/camera/provider/aidl/android/hardware/camera/provider/ICameraProvider.aidl @@ -304,12 +304,4 @@ interface ICameraProvider { * */ boolean isConcurrentStreamCombinationSupported(in CameraIdAndStreamCombination[] configs); - - /* - * Due to a bug in vintf regarding aidl changes that are contained to fields, - * we need a placeholder method that will be removed after this patch. - * - * TODO(b/237048744): Remove this once fixed. - */ - void placeholder(); } From 72b987222dd36a60658e01f781cfa35e88669742 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Thu, 27 Oct 2022 00:48:40 +0000 Subject: [PATCH 394/998] Specify IRemoteAccess and IVehicle instance name to be default. Change-Id: I0176066125df2c75ec8c4985838aefc9ea79cf2a Bug: 255848419 Test: Presubmit --- compatibility_matrices/compatibility_matrix.current.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 15f20d2d3e..43e8ce3561 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -109,14 +109,14 @@ android.hardware.automotive.vehicle IVehicle - .* + default android.hardware.automotive.remoteaccess IRemoteAccess - .* + default From 28a8edfeb24cbb9daeabe0dc5618e902bcc3ed3b Mon Sep 17 00:00:00 2001 From: Zhanghao Wen Date: Thu, 17 Nov 2022 13:51:25 -0800 Subject: [PATCH 395/998] Add gnss capability - Accumulated Delta Range in AIDL HAL (hardware/interfaces) Test: on Cuttlefish Change-Id: I12307e21b1c574d76f3c0a834e8eb75f1b23e7a3 Bug: 260002331 --- .../android/hardware/gnss/IGnssCallback.aidl | 1 + .../android/hardware/gnss/IGnssCallback.aidl | 3 + gnss/aidl/default/Gnss.cpp | 3 +- gnss/aidl/vts/gnss_hal_test_cases.cpp | 61 ++++++++++++++++++- gnss/common/utils/default/Utils.cpp | 2 +- 5 files changed, 65 insertions(+), 5 deletions(-) diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl index fd07a6e562..0247182207 100644 --- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl +++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/IGnssCallback.aidl @@ -61,6 +61,7 @@ interface IGnssCallback { const int CAPABILITY_CORRELATION_VECTOR = 4096; const int CAPABILITY_SATELLITE_PVT = 8192; const int CAPABILITY_MEASUREMENT_CORRECTIONS_FOR_DRIVING = 16384; + const int CAPABILITY_ACCUMULATED_DELTA_RANGE = 32768; @Backing(type="int") @VintfStability enum GnssStatusValue { NONE = 0, diff --git a/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl b/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl index 2b2592bf63..ff9feeacbd 100644 --- a/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl +++ b/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl @@ -82,6 +82,9 @@ interface IGnssCallback { /** Capability bit mask indicating that GNSS supports measurement corrections for driving */ const int CAPABILITY_MEASUREMENT_CORRECTIONS_FOR_DRIVING = 1 << 14; + /** Capability bit mask indicating that GNSS supports accumulated delta range */ + const int CAPABILITY_ACCUMULATED_DELTA_RANGE = 1 << 15; + /** * Callback to inform framework of the GNSS HAL implementation's capabilities. * diff --git a/gnss/aidl/default/Gnss.cpp b/gnss/aidl/default/Gnss.cpp index 23d799919b..ec86d2ee01 100644 --- a/gnss/aidl/default/Gnss.cpp +++ b/gnss/aidl/default/Gnss.cpp @@ -60,7 +60,8 @@ ScopedAStatus Gnss::setCallback(const std::shared_ptr& callback) IGnssCallback::CAPABILITY_SATELLITE_BLOCKLIST | IGnssCallback::CAPABILITY_SATELLITE_PVT | IGnssCallback::CAPABILITY_CORRELATION_VECTOR | - IGnssCallback::CAPABILITY_ANTENNA_INFO); + IGnssCallback::CAPABILITY_ANTENNA_INFO | + IGnssCallback::CAPABILITY_ACCUMULATED_DELTA_RANGE); auto status = sGnssCallback->gnssSetCapabilitiesCb(capabilities); if (!status.isOk()) { ALOGE("%s: Unable to invoke callback.gnssSetCapabilitiesCb", __func__); diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp index 31cef150e3..c1a177a250 100644 --- a/gnss/aidl/vts/gnss_hal_test_cases.cpp +++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp @@ -1505,10 +1505,11 @@ TEST_P(GnssHalTest, TestGnssMeasurementIntervals_LocationOnAfterMeasurement) { } /* - * TestGnssMeasurementSetCallback - * 1. Start measurement with 20s interval. Expect the first measurement received in 10s. + * TestGnssMeasurementSetCallback: + * This test ensures setCallback() can be called consecutively without close(). + * 1. Start measurement with 20s interval and wait for 1 measurement. * 2. Start measurement with 1s interval and wait for 5 measurements. - * 3. Verify the received measurement intervals have expected mean and stddev. + * Verify the measurements were received at 1Hz. */ TEST_P(GnssHalTest, TestGnssMeasurementSetCallback) { if (aidl_gnss_hal_->getInterfaceVersion() <= 2) { @@ -1581,3 +1582,57 @@ TEST_P(GnssHalTest, TestGnssMeasurementIsFullTracking) { status = iGnssMeasurement->close(); ASSERT_TRUE(status.isOk()); } + +/* + * TestAccumulatedDeltaRange: + * 1. Gets the GnssMeasurementExtension and verifies that it returns a non-null extension. + * 2. Start measurement with 1s interval and wait for up to 15 measurements. + * 3. Verify at least one measurement has a valid AccumulatedDeltaRange state. + */ +TEST_P(GnssHalTest, TestAccumulatedDeltaRange) { + if (aidl_gnss_hal_->getInterfaceVersion() <= 2) { + return; + } + if ((aidl_gnss_cb_->last_capabilities_ & IGnssCallback::CAPABILITY_ACCUMULATED_DELTA_RANGE) == + 0) { + return; + } + + ALOGD("TestAccumulatedDeltaRange"); + + auto callback = sp::make(); + sp iGnssMeasurement; + auto status = aidl_gnss_hal_->getExtensionGnssMeasurement(&iGnssMeasurement); + + IGnssMeasurementInterface::Options options; + options.intervalMs = 1000; + options.enableFullTracking = true; + status = iGnssMeasurement->setCallbackWithOptions(callback, options); + + ASSERT_TRUE(status.isOk()); + ASSERT_TRUE(iGnssMeasurement != nullptr); + + bool accumulatedDeltaRangeFound = false; + const int kNumMeasurementEvents = 15; + + // setCallback at 1s interval and wait for 15 measurements + for (int i = 0; i < kNumMeasurementEvents; i++) { + GnssData lastGnssData; + ASSERT_TRUE(callback->gnss_data_cbq_.retrieve(lastGnssData, 10)); + EXPECT_EQ(callback->gnss_data_cbq_.calledCount(), i + 1); + ASSERT_TRUE(lastGnssData.measurements.size() > 0); + + // Validity check GnssData fields + checkGnssMeasurementClockFields(lastGnssData); + for (const auto& measurement : lastGnssData.measurements) { + if ((measurement.accumulatedDeltaRangeState & measurement.ADR_STATE_VALID) > 0) { + accumulatedDeltaRangeFound = true; + break; + } + } + if (accumulatedDeltaRangeFound) break; + } + ASSERT_TRUE(accumulatedDeltaRangeFound); + status = iGnssMeasurement->close(); + ASSERT_TRUE(status.isOk()); +} \ No newline at end of file diff --git a/gnss/common/utils/default/Utils.cpp b/gnss/common/utils/default/Utils.cpp index ad351f82c9..2aed29bb5a 100644 --- a/gnss/common/utils/default/Utils.cpp +++ b/gnss/common/utils/default/Utils.cpp @@ -170,7 +170,7 @@ GnssData Utils::getMockMeasurement(const bool enableCorrVecOutputs, const bool e .agcLevelDb = 2.3, .pseudorangeRateMps = -484.13739013671875, .pseudorangeRateUncertaintyMps = 1.0379999876022339, - .accumulatedDeltaRangeState = GnssMeasurement::ADR_STATE_UNKNOWN, + .accumulatedDeltaRangeState = GnssMeasurement::ADR_STATE_VALID, .accumulatedDeltaRangeM = 1.52, .accumulatedDeltaRangeUncertaintyM = 2.43, .multipathIndicator = aidl::android::hardware::gnss::GnssMultipathIndicator::UNKNOWN, From 584a4fcdd0c5ce2dc024c67dbac5e02d51e213eb Mon Sep 17 00:00:00 2001 From: Yu-Han Yang Date: Mon, 21 Nov 2022 23:21:50 +0000 Subject: [PATCH 396/998] Update TestGnssMeasurementIsFullTracking Bug: 257549183 Test: atest VtsHalGnssTargetTest Change-Id: I49d91e40515384480508ba88bcb052bd4ee81ccd --- gnss/aidl/vts/gnss_hal_test.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gnss/aidl/vts/gnss_hal_test.cpp b/gnss/aidl/vts/gnss_hal_test.cpp index b4f2b773f3..7578585aca 100644 --- a/gnss/aidl/vts/gnss_hal_test.cpp +++ b/gnss/aidl/vts/gnss_hal_test.cpp @@ -489,7 +489,9 @@ void GnssHalTest::checkGnssDataFields(const sp& cal // Validity check GnssData fields checkGnssMeasurementClockFields(lastGnssData); if (aidl_gnss_hal_->getInterfaceVersion() >= 3) { - EXPECT_EQ(lastGnssData.isFullTracking, isFullTracking); + if (isFullTracking) { + EXPECT_EQ(lastGnssData.isFullTracking, isFullTracking); + } } for (const auto& measurement : lastGnssData.measurements) { checkGnssMeasurementFields(measurement, lastGnssData); From f65553745b87f3716f8390ec7c37d1a634fa6d35 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Fri, 18 Nov 2022 19:42:01 +0000 Subject: [PATCH 397/998] allocator frozen false magic -> explicit Bug: 259465531 Test: N/A Change-Id: I56b04a0f682a0ba3dc58a42c0a14bb506591c594 --- graphics/allocator/aidl/Android.bp | 1 + 1 file changed, 1 insertion(+) diff --git a/graphics/allocator/aidl/Android.bp b/graphics/allocator/aidl/Android.bp index 098ef172ce..67c7fb5e29 100644 --- a/graphics/allocator/aidl/Android.bp +++ b/graphics/allocator/aidl/Android.bp @@ -39,6 +39,7 @@ aidl_interface { min_sdk_version: "29", }, }, + frozen: false, versions_with_info: [ { version: "1", From 0bfa40f9affcf77930803a22aff1ef0f5e3d8005 Mon Sep 17 00:00:00 2001 From: Ray Chin Date: Wed, 26 Oct 2022 11:35:44 +0800 Subject: [PATCH 398/998] Add VVC H266 support in hal layer Bug: 219981033 Test: atest VtsHalTvTunerTargetTest Change-Id: I526920099a786d9f12057b76c89562f6ecd483b6 --- .../tv/tuner/DemuxFilterScIndexMask.aidl | 1 + .../tv/tuner/DemuxRecordScIndexType.aidl | 1 + .../hardware/tv/tuner/DemuxScVvcIndex.aidl | 46 ++++++++++++++ .../hardware/tv/tuner/VideoStreamType.aidl | 1 + .../tv/tuner/DemuxFilterScIndexMask.aidl | 5 ++ .../tv/tuner/DemuxRecordScIndexType.aidl | 5 ++ .../hardware/tv/tuner/DemuxScVvcIndex.aidl | 62 +++++++++++++++++++ .../hardware/tv/tuner/VideoStreamType.aidl | 5 ++ 8 files changed, 126 insertions(+) create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxScVvcIndex.aidl create mode 100644 tv/tuner/aidl/android/hardware/tv/tuner/DemuxScVvcIndex.aidl diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterScIndexMask.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterScIndexMask.aidl index 371e075617..8dfc60eb54 100644 --- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterScIndexMask.aidl +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterScIndexMask.aidl @@ -38,4 +38,5 @@ union DemuxFilterScIndexMask { int scIndex; int scAvc; int scHevc; + int scVvc; } diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxRecordScIndexType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxRecordScIndexType.aidl index 30ec29a23b..fb4430bbee 100644 --- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxRecordScIndexType.aidl +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxRecordScIndexType.aidl @@ -39,4 +39,5 @@ enum DemuxRecordScIndexType { SC = 1, SC_HEVC = 2, SC_AVC = 3, + SC_VVC = 4, } diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxScVvcIndex.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxScVvcIndex.aidl new file mode 100644 index 0000000000..3e08d26b59 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxScVvcIndex.aidl @@ -0,0 +1,46 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum DemuxScVvcIndex { + UNDEFINED = 0, + SLICE_IDR_W_RADL = 1, + SLICE_IDR_N_LP = 2, + SLICE_CRA = 4, + SLICE_GDR = 8, + VPS = 16, + SPS = 32, + AUD = 64, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/VideoStreamType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/VideoStreamType.aidl index 9dfd686a69..dbb6033add 100644 --- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/VideoStreamType.aidl +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/VideoStreamType.aidl @@ -48,4 +48,5 @@ enum VideoStreamType { AV1 = 10, AVS = 11, AVS2 = 12, + VVC = 13, } diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterScIndexMask.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterScIndexMask.aidl index 4036b06c8f..d53bc5b941 100644 --- a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterScIndexMask.aidl +++ b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterScIndexMask.aidl @@ -39,4 +39,9 @@ union DemuxFilterScIndexMask { * Indexes defined by DemuxScHevcIndex. */ int scHevc; + + /** + * Indexes defined by DemuxScVvcIndex. + */ + int scVvc; } diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxRecordScIndexType.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxRecordScIndexType.aidl index 98427f774f..265b978702 100644 --- a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxRecordScIndexType.aidl +++ b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxRecordScIndexType.aidl @@ -42,4 +42,9 @@ enum DemuxRecordScIndexType { * Use Start Code index for AVC */ SC_AVC, + + /** + * Use Start Code index for VVC + */ + SC_VVC, } diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxScVvcIndex.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxScVvcIndex.aidl new file mode 100644 index 0000000000..8b47f627f5 --- /dev/null +++ b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxScVvcIndex.aidl @@ -0,0 +1,62 @@ +/* + * Copyright 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. + */ + +package android.hardware.tv.tuner; + +/** + * Indexes can be tagged by start point of slice groups according to ISO/IEC 23090-3. + * @hide + */ +@VintfStability +@Backing(type="int") +enum DemuxScVvcIndex { + UNDEFINED = 0, + + /** + * Coded slice of an IDR picture or subpicture with RADL pictures. + */ + SLICE_IDR_W_RADL = 1 << 0, + + /** + * Coded slice of an IDR picture or subpicture without leading pictures. + */ + SLICE_IDR_N_LP = 1 << 1, + + /** + * Coded slice of a CRA (clean random access) picture or subpicture. + */ + SLICE_CRA = 1 << 2, + + /** + * Coded slice of a GDR (gradual decoder refresh) picture or subpicture. + */ + SLICE_GDR = 1 << 3, + + /** + * Video parameter set (non-VCL NALU). + */ + VPS = 1 << 4, + + /** + * Sequence parameter set (non-VCL NALU). + */ + SPS = 1 << 5, + + /** + * Access unit delimiter (non-VCL NALU). + */ + AUD = 1 << 6, +} diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/VideoStreamType.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/VideoStreamType.aidl index 108d986bd8..bd000d2bae 100644 --- a/tv/tuner/aidl/android/hardware/tv/tuner/VideoStreamType.aidl +++ b/tv/tuner/aidl/android/hardware/tv/tuner/VideoStreamType.aidl @@ -84,4 +84,9 @@ enum VideoStreamType { * New Chinese Standard */ AVS2, + + /* + * ITU-T Rec. H.266 and ISO/IEC 23090-3 + */ + VVC, } From fb39edbd83ff4277270158f48e987f9ecfc840c5 Mon Sep 17 00:00:00 2001 From: Zhanghao Wen Date: Tue, 22 Nov 2022 12:26:38 -0800 Subject: [PATCH 399/998] Fix a bug that did not check the status after it is assigned Test: on Cuttlefish Bug: 260002331 Change-Id: I7db69b19c3f29824970a5ae04aeae26e8bfd8447 --- gnss/aidl/vts/gnss_hal_test_cases.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp index c1a177a250..48027b62e0 100644 --- a/gnss/aidl/vts/gnss_hal_test_cases.cpp +++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp @@ -1603,14 +1603,14 @@ TEST_P(GnssHalTest, TestAccumulatedDeltaRange) { auto callback = sp::make(); sp iGnssMeasurement; auto status = aidl_gnss_hal_->getExtensionGnssMeasurement(&iGnssMeasurement); + ASSERT_TRUE(status.isOk()); + ASSERT_TRUE(iGnssMeasurement != nullptr); IGnssMeasurementInterface::Options options; options.intervalMs = 1000; options.enableFullTracking = true; status = iGnssMeasurement->setCallbackWithOptions(callback, options); - ASSERT_TRUE(status.isOk()); - ASSERT_TRUE(iGnssMeasurement != nullptr); bool accumulatedDeltaRangeFound = false; const int kNumMeasurementEvents = 15; From fc21e8b3ef177657211c692068c34e2267fbb406 Mon Sep 17 00:00:00 2001 From: John Reck Date: Tue, 22 Nov 2022 14:58:57 -0500 Subject: [PATCH 400/998] Adjust IMapperMetadataTypes.h to match gralloc4 encoding Specifically include the header encoding. Initially omitted as it's a bit redundant, the value in having bit-for-bit identical encoding between gralloc4 & imapper5 seems worthwhile enough to keep it. Test: impltests + VtsHalGraphicsMapperStableC Change-Id: Iee37bb97acf40362c301a06f9118938b1a0c2cd9 --- graphics/mapper/stable-c/Android.bp | 4 + .../mapper/stable-c/implutils/impltests.cpp | 474 +++++++++++++----- .../mapper/utils/IMapperMetadataTypes.h | 125 +++-- ...VtsHalGraphicsMapperStableC_TargetTest.cpp | 2 +- 4 files changed, 438 insertions(+), 167 deletions(-) diff --git a/graphics/mapper/stable-c/Android.bp b/graphics/mapper/stable-c/Android.bp index c03f67ea47..d40e160207 100644 --- a/graphics/mapper/stable-c/Android.bp +++ b/graphics/mapper/stable-c/Android.bp @@ -61,6 +61,10 @@ cc_test { srcs: [ "implutils/impltests.cpp", ], + shared_libs: [ + "libgralloctypes", + "libhidlbase", + ], visibility: [":__subpackages__"], cpp_std: "experimental", } diff --git a/graphics/mapper/stable-c/implutils/impltests.cpp b/graphics/mapper/stable-c/implutils/impltests.cpp index 9c5d70b498..f12b069c3f 100644 --- a/graphics/mapper/stable-c/implutils/impltests.cpp +++ b/graphics/mapper/stable-c/implutils/impltests.cpp @@ -18,123 +18,29 @@ #include #include +#include +#include +#include #include +using namespace ::android; using namespace ::android::hardware::graphics::mapper; using namespace ::aidl::android::hardware::graphics::common; +namespace gralloc4 = ::android::gralloc4; +using ::android::hardware::hidl_vec; // These tests are primarily interested in hitting all the different *types* that can be // serialized/deserialized than in exhaustively testing all the StandardMetadataTypes. // Exhaustive testing of the actual metadata types is relegated for IMapper's VTS suite // where meaning & correctness of values are more narrowly defined (eg, read-only values) -TEST(Metadata, setGetBufferId) { - using BufferId = StandardMetadata::value; +static constexpr auto HeaderSize = 69; - std::vector buffer; - buffer.resize(12, 0); - *reinterpret_cast(buffer.data()) = 42; - - EXPECT_EQ(8, BufferId::encode(18, buffer.data(), 0)); - EXPECT_EQ(42, *reinterpret_cast(buffer.data())); - EXPECT_EQ(8, BufferId::encode(18, buffer.data(), buffer.size())); - EXPECT_EQ(18, *reinterpret_cast(buffer.data())); - EXPECT_FALSE(BufferId::decode(buffer.data(), 0)); - auto read = BufferId::decode(buffer.data(), buffer.size()); - EXPECT_TRUE(read.has_value()); - EXPECT_EQ(18, read.value_or(0)); +static std::span SkipHeader(std::vector& buffer) { + return std::span(buffer).subspan(HeaderSize); } -TEST(Metadata, setGetDataspace) { - using DataspaceValue = StandardMetadata::value; - using intType = std::underlying_type_t; - std::vector buffer; - buffer.resize(12, 0); - - EXPECT_EQ(4, DataspaceValue::encode(Dataspace::BT2020, buffer.data(), 0)); - EXPECT_EQ(0, *reinterpret_cast(buffer.data())); - EXPECT_EQ(4, DataspaceValue::encode(Dataspace::BT2020, buffer.data(), buffer.size())); - EXPECT_EQ(static_cast(Dataspace::BT2020), *reinterpret_cast(buffer.data())); - EXPECT_FALSE(DataspaceValue::decode(buffer.data(), 0)); - auto read = DataspaceValue::decode(buffer.data(), buffer.size()); - ASSERT_TRUE(read.has_value()); - EXPECT_EQ(Dataspace::BT2020, *read); -} - -TEST(Metadata, setGetValidName) { - using NameValue = StandardMetadata::value; - - std::vector buffer; - buffer.resize(100, 'a'); - buffer[buffer.size() - 1] = '\0'; - - // len("Hello") + sizeof(int64) - constexpr int expectedSize = 5 + sizeof(int64_t); - EXPECT_EQ(expectedSize, NameValue::encode("Hello", buffer.data(), buffer.size())); - EXPECT_EQ(5, *reinterpret_cast(buffer.data())); - // Verify didn't write past the end of the desired size - EXPECT_EQ('a', buffer[expectedSize]); - - auto readValue = NameValue::decode(buffer.data(), buffer.size()); - ASSERT_TRUE(readValue.has_value()); - EXPECT_EQ(5, readValue->length()); - EXPECT_EQ("Hello", *readValue); -} - -TEST(Metadata, setGetInvalidName) { - using NameValue = StandardMetadata::value; - - std::vector buffer; - buffer.resize(12, 'a'); - buffer[buffer.size() - 1] = '\0'; - - // len("This is a long string") + sizeof(int64) - constexpr int expectedSize = 21 + sizeof(int64_t); - EXPECT_EQ(expectedSize, - NameValue::encode("This is a long string", buffer.data(), buffer.size())); - EXPECT_EQ(21, *reinterpret_cast(buffer.data())); - // Verify didn't write the too-long string - EXPECT_EQ('a', buffer[9]); - EXPECT_EQ('\0', buffer[buffer.size() - 1]); - - auto readValue = NameValue::decode(buffer.data(), buffer.size()); - EXPECT_FALSE(readValue.has_value()); - readValue = NameValue::decode(buffer.data(), 0); - ASSERT_FALSE(readValue.has_value()); -} - -TEST(Metadata, wouldOverflowName) { - using NameValue = StandardMetadata::value; - std::vector buffer(100, 0); - - // int_max + sizeof(int64) overflows int32 - std::string_view bad_string{"badbeef", std::numeric_limits::max()}; - EXPECT_EQ(-AIMAPPER_ERROR_BAD_VALUE, - NameValue::encode(bad_string, buffer.data(), buffer.size())); - - // check barely overflows - bad_string = std::string_view{"badbeef", std::numeric_limits::max() - 7}; - EXPECT_EQ(-AIMAPPER_ERROR_BAD_VALUE, - NameValue::encode(bad_string, buffer.data(), buffer.size())); -} - -TEST(Metadata, setGetCompression) { - using CompressionValue = StandardMetadata::value; - ExtendableType myCompression{"bestest_compression_ever", 42}; - std::vector buffer(100, '\0'); - const int expectedSize = myCompression.name.length() + sizeof(int64_t) + sizeof(int64_t); - EXPECT_EQ(expectedSize, CompressionValue::encode(myCompression, buffer.data(), 0)); - EXPECT_EQ(0, buffer[0]); - EXPECT_EQ(expectedSize, CompressionValue::encode(myCompression, buffer.data(), buffer.size())); - EXPECT_EQ(myCompression.name.length(), *reinterpret_cast(buffer.data())); - EXPECT_FALSE(CompressionValue::decode(buffer.data(), 0).has_value()); - auto read = CompressionValue::decode(buffer.data(), buffer.size()); - ASSERT_TRUE(read.has_value()); - EXPECT_EQ(myCompression, read.value()); -} - -TEST(Metadata, setGetPlaneLayout) { - using PlaneLayoutValue = StandardMetadata::value; +static std::vector fakePlaneLayouts() { PlaneLayout myPlaneLayout; myPlaneLayout.offsetInBytes = 10; myPlaneLayout.sampleIncrementInBits = 11; @@ -153,23 +59,147 @@ TEST(Metadata, setGetPlaneLayout) { it.sizeInBits = 30 + i; } - std::vector layouts{myPlaneLayout, PlaneLayout{}}; + return std::vector{myPlaneLayout, PlaneLayout{}}; +} - std::vector buffer(5000, '\0'); +TEST(Metadata, setGetBufferId) { + using BufferId = StandardMetadata::value; + + std::vector buffer(10000, 0); + int64_t* payload = reinterpret_cast(SkipHeader(buffer).data()); + *payload = 42; + + EXPECT_EQ(8 + HeaderSize, BufferId::encode(18, buffer.data(), 0)); + EXPECT_EQ(42, *payload); + EXPECT_EQ(8 + HeaderSize, BufferId::encode(18, buffer.data(), buffer.size())); + EXPECT_EQ(18, *payload); + EXPECT_FALSE(BufferId::decode(buffer.data(), 0)); + auto read = BufferId::decode(buffer.data(), buffer.size()); + EXPECT_TRUE(read.has_value()); + EXPECT_EQ(18, read.value_or(0)); +} + +TEST(Metadata, setGetDataspace) { + using DataspaceValue = StandardMetadata::value; + using intType = std::underlying_type_t; + std::vector buffer(10000, 0); + auto data = SkipHeader(buffer); + + EXPECT_EQ(4 + HeaderSize, DataspaceValue::encode(Dataspace::BT2020, buffer.data(), 0)); + EXPECT_EQ(0, *reinterpret_cast(data.data())); + EXPECT_EQ(4 + HeaderSize, + DataspaceValue::encode(Dataspace::BT2020, buffer.data(), buffer.size())); + EXPECT_EQ(static_cast(Dataspace::BT2020), *reinterpret_cast(data.data())); + EXPECT_FALSE(DataspaceValue::decode(buffer.data(), 0)); + auto read = DataspaceValue::decode(buffer.data(), buffer.size()); + ASSERT_TRUE(read.has_value()); + EXPECT_EQ(Dataspace::BT2020, *read); +} + +TEST(Metadata, setGetValidName) { + using NameValue = StandardMetadata::value; + + std::vector buffer(10000, 'a'); + + // len("Hello") + sizeof(int64) + constexpr int expectedSize = 5 + sizeof(int64_t) + HeaderSize; + EXPECT_EQ(expectedSize, NameValue::encode("Hello", buffer.data(), buffer.size())); + EXPECT_EQ(5, *reinterpret_cast(SkipHeader(buffer).data())); + // Verify didn't write past the end of the desired size + EXPECT_EQ('a', buffer[expectedSize]); + + auto readValue = NameValue::decode(buffer.data(), buffer.size()); + ASSERT_TRUE(readValue.has_value()); + EXPECT_EQ(5, readValue->length()); + EXPECT_EQ("Hello", *readValue); +} + +TEST(Metadata, setGetInvalidName) { + using NameValue = StandardMetadata::value; + + std::vector buffer; + buffer.resize(12 + HeaderSize, 'a'); + buffer[buffer.size() - 1] = '\0'; + + // len("This is a long string") + sizeof(int64) + constexpr int expectedSize = 21 + sizeof(int64_t) + HeaderSize; + EXPECT_EQ(expectedSize, + NameValue::encode("This is a long string", buffer.data(), buffer.size())); + EXPECT_EQ(21, *reinterpret_cast(SkipHeader(buffer).data())); + + auto readValue = NameValue::decode(buffer.data(), buffer.size()); + EXPECT_FALSE(readValue.has_value()); + readValue = NameValue::decode(buffer.data(), 0); + ASSERT_FALSE(readValue.has_value()); +} + +TEST(Metadata, wouldOverflowName) { + using NameValue = StandardMetadata::value; + std::vector buffer(10000, 0); + + // int_max + sizeof(int64) overflows int32 + std::string_view bad_string{"badbeef", std::numeric_limits::max()}; + EXPECT_EQ(-AIMAPPER_ERROR_BAD_VALUE, + NameValue::encode(bad_string, buffer.data(), buffer.size())); + + // check barely overflows + bad_string = std::string_view{"badbeef", std::numeric_limits::max() - 7}; + EXPECT_EQ(-AIMAPPER_ERROR_BAD_VALUE, + NameValue::encode(bad_string, buffer.data(), buffer.size())); +} + +TEST(Metadata, setGetMismatchedWidthHight) { + // Validates that the header is properly validated on decode + using WidthValue = StandardMetadata::value; + using HeightValue = StandardMetadata::value; + std::vector buffer(10000, 0); + + EXPECT_EQ(8 + HeaderSize, WidthValue::encode(100, buffer.data(), buffer.size())); + EXPECT_EQ(100, *reinterpret_cast(SkipHeader(buffer).data())); + auto read = WidthValue::decode(buffer.data(), buffer.size()); + ASSERT_TRUE(read.has_value()); + EXPECT_EQ(100, *read); + read = HeightValue::decode(buffer.data(), buffer.size()); + EXPECT_FALSE(read.has_value()); +} + +TEST(Metadata, setGetCompression) { + using CompressionValue = StandardMetadata::value; + ExtendableType myCompression{"bestest_compression_ever", 42}; + std::vector buffer(10000, 0); + const int expectedSize = + myCompression.name.length() + sizeof(int64_t) + sizeof(int64_t) + HeaderSize; + EXPECT_EQ(expectedSize, CompressionValue::encode(myCompression, buffer.data(), 0)); + EXPECT_EQ(0, buffer[0]); + EXPECT_EQ(expectedSize, CompressionValue::encode(myCompression, buffer.data(), buffer.size())); + EXPECT_EQ(myCompression.name.length(), *reinterpret_cast(SkipHeader(buffer).data())); + EXPECT_FALSE(CompressionValue::decode(buffer.data(), 0).has_value()); + auto read = CompressionValue::decode(buffer.data(), buffer.size()); + ASSERT_TRUE(read.has_value()); + EXPECT_EQ(myCompression, read.value()); +} + +TEST(Metadata, setGetPlaneLayout) { + using PlaneLayoutValue = StandardMetadata::value; + + std::vector layouts = fakePlaneLayouts(); + + std::vector buffer(10000, 0); constexpr int componentSize = 8 + (4 * sizeof(int64_t)); constexpr int firstLayoutSize = (8 + 1) * sizeof(int64_t) + (3 * componentSize); constexpr int secondLayoutSize = (8 + 1) * sizeof(int64_t); - constexpr int expectedSize = firstLayoutSize + secondLayoutSize + sizeof(int64_t); + constexpr int expectedSize = firstLayoutSize + secondLayoutSize + sizeof(int64_t) + HeaderSize; EXPECT_EQ(expectedSize, PlaneLayoutValue::encode(layouts, buffer.data(), 0)); EXPECT_EQ(0, buffer[0]); EXPECT_EQ(expectedSize, PlaneLayoutValue::encode(layouts, buffer.data(), buffer.size())); - EXPECT_EQ(3, reinterpret_cast(buffer.data())[1]); - EXPECT_EQ(8, reinterpret_cast(buffer.data())[2]); - EXPECT_EQ(40, reinterpret_cast(buffer.data())[4]); - EXPECT_EQ(31, reinterpret_cast(buffer.data())[11]); - EXPECT_EQ(22, reinterpret_cast(buffer.data())[15]); - EXPECT_EQ(10, reinterpret_cast(buffer.data())[17]); - EXPECT_EQ(11, reinterpret_cast(buffer.data())[18]); + int64_t* payload = reinterpret_cast(SkipHeader(buffer).data()); + EXPECT_EQ(3, payload[1]); + EXPECT_EQ(8, payload[2]); + EXPECT_EQ(40, payload[4]); + EXPECT_EQ(31, payload[11]); + EXPECT_EQ(22, payload[15]); + EXPECT_EQ(10, payload[17]); + EXPECT_EQ(11, payload[18]); EXPECT_FALSE(PlaneLayoutValue::decode(buffer.data(), 0).has_value()); auto read = PlaneLayoutValue::decode(buffer.data(), buffer.size()); ASSERT_TRUE(read.has_value()); @@ -178,15 +208,15 @@ TEST(Metadata, setGetPlaneLayout) { TEST(Metadata, setGetRects) { using RectsValue = StandardMetadata::value; - std::vector buffer(500, 0); + std::vector buffer(10000, 0); std::vector cropRects{2}; cropRects[0] = Rect{10, 11, 12, 13}; cropRects[1] = Rect{20, 21, 22, 23}; - constexpr int expectedSize = sizeof(int64_t) + (8 * sizeof(int32_t)); + constexpr int expectedSize = sizeof(int64_t) + (8 * sizeof(int32_t)) + HeaderSize; EXPECT_EQ(expectedSize, RectsValue::encode(cropRects, buffer.data(), buffer.size())); - EXPECT_EQ(2, reinterpret_cast(buffer.data())[0]); - EXPECT_EQ(10, reinterpret_cast(buffer.data())[2]); + EXPECT_EQ(2, reinterpret_cast(SkipHeader(buffer).data())[0]); + EXPECT_EQ(10, reinterpret_cast(SkipHeader(buffer).data())[2]); auto read = RectsValue::decode(buffer.data(), buffer.size()); ASSERT_TRUE(read.has_value()); EXPECT_EQ(cropRects.size(), read->size()); @@ -203,8 +233,8 @@ TEST(Metadata, setGetSmpte2086) { source.primaryGreen = XyColor{.3f, .4f}; source.primaryBlue = XyColor{.5f, .6f}; - constexpr int expectedSize = 10 * sizeof(float); - std::vector buffer(500, 0); + constexpr int expectedSize = 10 * sizeof(float) + HeaderSize; + std::vector buffer(10000, 0); EXPECT_EQ(expectedSize, Smpte2086Value::encode(source, buffer.data(), buffer.size())); auto read = Smpte2086Value::decode(buffer.data(), buffer.size()); ASSERT_TRUE(read.has_value()); @@ -223,8 +253,8 @@ TEST(Metadata, setGetCta861_3) { source.maxFrameAverageLightLevel = 244.55f; source.maxContentLightLevel = 202.202f; - constexpr int expectedSize = 2 * sizeof(float); - std::vector buffer(500, 0); + constexpr int expectedSize = 2 * sizeof(float) + HeaderSize; + std::vector buffer(10000, 0); EXPECT_EQ(expectedSize, Cta861_3Value::encode(source, buffer.data(), buffer.size())); auto read = Cta861_3Value::decode(buffer.data(), buffer.size()); ASSERT_TRUE(read.has_value()); @@ -240,14 +270,14 @@ TEST(Metadata, setGetCta861_3) { TEST(Metadata, setGetSmpte2094_10) { using SMPTE2094_10Value = StandardMetadata::value; - std::vector buffer(500, 0); + std::vector buffer(10000, 0); EXPECT_EQ(0, SMPTE2094_10Value::encode(std::nullopt, buffer.data(), buffer.size())); auto read = SMPTE2094_10Value::decode(buffer.data(), 0); ASSERT_TRUE(read.has_value()); EXPECT_FALSE(read->has_value()); const std::vector emptyBuffer; - EXPECT_EQ(sizeof(int64_t), + EXPECT_EQ(sizeof(int64_t) + HeaderSize, SMPTE2094_10Value::encode(emptyBuffer, buffer.data(), buffer.size())); read = SMPTE2094_10Value::decode(buffer.data(), buffer.size()); ASSERT_TRUE(read.has_value()); @@ -255,7 +285,7 @@ TEST(Metadata, setGetSmpte2094_10) { EXPECT_EQ(0, read->value().size()); const std::vector simpleBuffer{0, 1, 2, 3, 4, 5}; - EXPECT_EQ(sizeof(int64_t) + 6, + EXPECT_EQ(sizeof(int64_t) + 6 + HeaderSize, SMPTE2094_10Value::encode(simpleBuffer, buffer.data(), buffer.size())); read = SMPTE2094_10Value::decode(buffer.data(), buffer.size()); ASSERT_TRUE(read.has_value()); @@ -266,7 +296,7 @@ TEST(Metadata, setGetSmpte2094_10) { TEST(MetadataProvider, bufferId) { using BufferId = StandardMetadata::value; - std::vector buffer(500, 0); + std::vector buffer(10000, 0); int result = provideStandardMetadata(StandardMetadataType::BUFFER_ID, buffer.data(), buffer.size(), [](auto&& provide) { if constexpr (T == StandardMetadataType::BUFFER_ID) { @@ -275,7 +305,7 @@ TEST(MetadataProvider, bufferId) { return 0; }); - EXPECT_EQ(8, result); + EXPECT_EQ(8 + HeaderSize, result); auto read = BufferId::decode(buffer.data(), buffer.size()); EXPECT_EQ(42, read.value_or(0)); } @@ -312,3 +342,193 @@ TEST(MetadataProvider, outOfBounds) { EXPECT_EQ(-AIMAPPER_ERROR_UNSUPPORTED, result) << "100 (out of range) should have resulted in UNSUPPORTED"; } + +template +std::vector encode(const typename StandardMetadata::value_type& value) { + using Value = typename StandardMetadata::value; + + int desiredSize = Value::encode(value, nullptr, 0); + EXPECT_GE(desiredSize, 0); + std::vector buffer; + buffer.resize(desiredSize); + EXPECT_EQ(desiredSize, Value::encode(value, buffer.data(), buffer.size())); + return buffer; +} + +TEST(MetadataGralloc4Interop, BufferId) { + auto mpbuf = encode(42); + hidl_vec g4buf; + ASSERT_EQ(NO_ERROR, gralloc4::encodeBufferId(42, &g4buf)); + EXPECT_EQ(mpbuf, g4buf); +} + +TEST(MetadataGralloc4Interop, Name) { + auto mpbuf = encode("Hello, Interop!"); + hidl_vec g4buf; + ASSERT_EQ(NO_ERROR, gralloc4::encodeName("Hello, Interop!", &g4buf)); + EXPECT_EQ(mpbuf, g4buf); +} + +TEST(MetadataGralloc4Interop, Width) { + auto mpbuf = encode(128); + hidl_vec g4buf; + ASSERT_EQ(NO_ERROR, gralloc4::encodeWidth(128, &g4buf)); + EXPECT_EQ(mpbuf, g4buf); +} + +TEST(MetadataGralloc4Interop, Height) { + auto mpbuf = encode(64); + hidl_vec g4buf; + ASSERT_EQ(NO_ERROR, gralloc4::encodeHeight(64, &g4buf)); + EXPECT_EQ(mpbuf, g4buf); +} + +TEST(MetadataGralloc4Interop, LayerCount) { + auto mpbuf = encode(3); + hidl_vec g4buf; + ASSERT_EQ(NO_ERROR, gralloc4::encodeLayerCount(3, &g4buf)); + EXPECT_EQ(mpbuf, g4buf); +} + +TEST(MetadataGralloc4Interop, PixelFormatRequested) { + auto mpbuf = encode(PixelFormat::RGBX_8888); + hidl_vec g4buf; + ASSERT_EQ(NO_ERROR, gralloc4::encodePixelFormatRequested( + hardware::graphics::common::V1_2::PixelFormat::RGBX_8888, &g4buf)); + EXPECT_EQ(mpbuf, g4buf); +} + +TEST(MetadataGralloc4Interop, PixelFormatFourcc) { + auto mpbuf = encode(DRM_FORMAT_ABGR8888); + hidl_vec g4buf; + ASSERT_EQ(NO_ERROR, gralloc4::encodePixelFormatFourCC(DRM_FORMAT_ABGR8888, &g4buf)); + EXPECT_EQ(mpbuf, g4buf); +} + +TEST(MetadataGralloc4Interop, PixelFormatModifier) { + auto mpbuf = encode(123456); + hidl_vec g4buf; + ASSERT_EQ(NO_ERROR, gralloc4::encodePixelFormatModifier(123456, &g4buf)); + EXPECT_EQ(mpbuf, g4buf); +} + +TEST(MetadataGralloc4Interop, Usage) { + auto mpbuf = encode(BufferUsage::COMPOSER_OVERLAY); + hidl_vec g4buf; + ASSERT_EQ(NO_ERROR, + gralloc4::encodeUsage( + static_cast( + hardware::graphics::common::V1_2::BufferUsage::COMPOSER_OVERLAY), + &g4buf)); + EXPECT_EQ(mpbuf, g4buf); +} + +TEST(MetadataGralloc4Interop, AllocationSize) { + auto mpbuf = encode(10200); + hidl_vec g4buf; + ASSERT_EQ(NO_ERROR, gralloc4::encodeAllocationSize(10200, &g4buf)); + EXPECT_EQ(mpbuf, g4buf); +} + +TEST(MetadataGralloc4Interop, ProtectedContent) { + auto mpbuf = encode(1); + hidl_vec g4buf; + ASSERT_EQ(NO_ERROR, gralloc4::encodeProtectedContent(1, &g4buf)); + EXPECT_EQ(mpbuf, g4buf); +} + +TEST(MetadataGralloc4Interop, Compression) { + auto mpbuf = encode( + gralloc4::Compression_DisplayStreamCompression); + hidl_vec g4buf; + ASSERT_EQ(NO_ERROR, + gralloc4::encodeCompression(gralloc4::Compression_DisplayStreamCompression, &g4buf)); + EXPECT_EQ(mpbuf, g4buf); +} + +TEST(MetadataGralloc4Interop, Interlaced) { + auto mpbuf = encode(gralloc4::Interlaced_TopBottom); + hidl_vec g4buf; + ASSERT_EQ(NO_ERROR, gralloc4::encodeInterlaced(gralloc4::Interlaced_TopBottom, &g4buf)); + EXPECT_EQ(mpbuf, g4buf); +} + +TEST(MetadataGralloc4Interop, ChromeSitting) { + auto mpbuf = + encode(gralloc4::ChromaSiting_SitedInterstitial); + hidl_vec g4buf; + ASSERT_EQ(NO_ERROR, + gralloc4::encodeChromaSiting(gralloc4::ChromaSiting_SitedInterstitial, &g4buf)); + EXPECT_EQ(mpbuf, g4buf); +} + +TEST(MetadataGralloc4Interop, PlaneLayouts) { + auto mpbuf = encode(fakePlaneLayouts()); + hidl_vec g4buf; + ASSERT_EQ(NO_ERROR, gralloc4::encodePlaneLayouts(fakePlaneLayouts(), &g4buf)); + EXPECT_EQ(mpbuf, g4buf); +} + +TEST(MetadataGralloc4Interop, Crop) { + std::vector cropRects{Rect{10, 11, 12, 13}, Rect{20, 21, 22, 23}}; + auto mpbuf = encode(cropRects); + hidl_vec g4buf; + ASSERT_EQ(NO_ERROR, gralloc4::encodeCrop(cropRects, &g4buf)); + EXPECT_EQ(mpbuf, g4buf); +} + +TEST(MetadataGralloc4Interop, Dataspace) { + auto mpbuf = encode(Dataspace::DISPLAY_P3); + hidl_vec g4buf; + ASSERT_EQ(NO_ERROR, gralloc4::encodeDataspace(Dataspace::DISPLAY_P3, &g4buf)); + EXPECT_EQ(mpbuf, g4buf); +} + +TEST(MetadataGralloc4Interop, BlendMode) { + auto mpbuf = encode(BlendMode::PREMULTIPLIED); + hidl_vec g4buf; + ASSERT_EQ(NO_ERROR, gralloc4::encodeBlendMode(BlendMode::PREMULTIPLIED, &g4buf)); + EXPECT_EQ(mpbuf, g4buf); +} + +TEST(MetadataGralloc4Interop, Smpte2086) { + Smpte2086 hdrdata{XyColor{.1f, .2f}, XyColor{.3f, .4f}, XyColor{.5f, .6f}, + XyColor{.7f, .8f}, 452.889f, 12.335f}; + + auto mpbuf = encode(hdrdata); + hidl_vec g4buf; + ASSERT_EQ(NO_ERROR, gralloc4::encodeSmpte2086(hdrdata, &g4buf)); + EXPECT_EQ(mpbuf, g4buf); +} + +TEST(MetadataGralloc4Interop, Cta861_3) { + Cta861_3 hdrdata{302.202f, 244.55f}; + auto mpbuf = encode(hdrdata); + hidl_vec g4buf; + ASSERT_EQ(NO_ERROR, gralloc4::encodeCta861_3(hdrdata, &g4buf)); + EXPECT_EQ(mpbuf, g4buf); +} + +TEST(MetadataGralloc4Interop, Smpte2094_10) { + auto mpbuf = encode(std::nullopt); + hidl_vec g4buf; + ASSERT_EQ(NO_ERROR, gralloc4::encodeSmpte2094_10(std::nullopt, &g4buf)); + EXPECT_EQ(mpbuf, g4buf); + + std::vector hdrdata{1, 2, 3, 4, 5, 6}; + mpbuf = encode(hdrdata); + ASSERT_EQ(NO_ERROR, gralloc4::encodeSmpte2094_10(hdrdata, &g4buf)); + EXPECT_EQ(mpbuf, g4buf); +} + +TEST(MetadataGralloc4Interop, Smpte2094_40) { + auto mpbuf = encode(std::nullopt); + hidl_vec g4buf; + ASSERT_EQ(NO_ERROR, gralloc4::encodeSmpte2094_40(std::nullopt, &g4buf)); + EXPECT_EQ(mpbuf, g4buf); + + std::vector hdrdata{1, 2, 3, 4, 5, 6}; + mpbuf = encode(hdrdata); + ASSERT_EQ(NO_ERROR, gralloc4::encodeSmpte2094_40(hdrdata, &g4buf)); + EXPECT_EQ(mpbuf, g4buf); +} diff --git a/graphics/mapper/stable-c/implutils/include/android/hardware/graphics/mapper/utils/IMapperMetadataTypes.h b/graphics/mapper/stable-c/implutils/include/android/hardware/graphics/mapper/utils/IMapperMetadataTypes.h index 7861af87fc..25af6d1158 100644 --- a/graphics/mapper/stable-c/implutils/include/android/hardware/graphics/mapper/utils/IMapperMetadataTypes.h +++ b/graphics/mapper/stable-c/implutils/include/android/hardware/graphics/mapper/utils/IMapperMetadataTypes.h @@ -82,7 +82,12 @@ class MetadataWriter { explicit MetadataWriter(void* _Nullable destBuffer, size_t destBufferSize) : mDest(reinterpret_cast(destBuffer)), mSizeRemaining(destBufferSize) {} - int32_t desiredSize() const { return mDesiredSize; } + [[nodiscard]] int32_t desiredSize() const { return mDesiredSize; } + + template + MetadataWriter& writeHeader() { + return write(HEADER::name).template write(HEADER::value); + } template >> MetadataWriter& write(T value) { @@ -150,6 +155,18 @@ class MetadataReader { [[nodiscard]] size_t remaining() const { return mSizeRemaining; } [[nodiscard]] bool ok() const { return mOk; } + template + MetadataReader& checkHeader() { + if (HEADER::name != readString()) { + mOk = false; + } + auto value = readInt(); + if (!value || *value != HEADER::value) { + mOk = false; + } + return *this; + } + template >> MetadataReader& read(T& dest) { if (const void* src = advance(sizeof(T))) { @@ -228,27 +245,33 @@ class MetadataReader { } }; -template +template struct MetadataValue {}; -template -struct MetadataValue>> { +template +struct MetadataValue>> { [[nodiscard]] static int32_t encode(T value, void* _Nullable destBuffer, size_t destBufferSize) { - return MetadataWriter{destBuffer, destBufferSize}.write(value).desiredSize(); + return MetadataWriter{destBuffer, destBufferSize} + .template writeHeader
() + .write(value) + .desiredSize(); } [[nodiscard]] static std::optional decode(const void* _Nonnull metadata, size_t metadataSize) { - return MetadataReader{metadata, metadataSize}.readInt(); + return MetadataReader{metadata, metadataSize} + .template checkHeader
() + .template readInt(); } }; -template -struct MetadataValue>> { +template +struct MetadataValue>> { [[nodiscard]] static int32_t encode(T value, void* _Nullable destBuffer, size_t destBufferSize) { return MetadataWriter{destBuffer, destBufferSize} + .template writeHeader
() .write(static_cast>(value)) .desiredSize(); } @@ -256,47 +279,56 @@ struct MetadataValue>> { [[nodiscard]] static std::optional decode(const void* _Nonnull metadata, size_t metadataSize) { std::underlying_type_t temp; - return MetadataReader{metadata, metadataSize}.read(temp).ok() + return MetadataReader{metadata, metadataSize}.template checkHeader
().read(temp).ok() ? std::optional(static_cast(temp)) : std::nullopt; } }; -template <> -struct MetadataValue { +template +struct MetadataValue { [[nodiscard]] static int32_t encode(const std::string_view& value, void* _Nullable destBuffer, size_t destBufferSize) { - return MetadataWriter{destBuffer, destBufferSize}.write(value).desiredSize(); + return MetadataWriter{destBuffer, destBufferSize} + .template writeHeader
() + .write(value) + .desiredSize(); } [[nodiscard]] static std::optional decode(const void* _Nonnull metadata, size_t metadataSize) { - auto reader = MetadataReader{metadata, metadataSize}; + auto reader = MetadataReader{metadata, metadataSize}.template checkHeader
(); auto result = reader.readString(); return reader.ok() ? std::optional{result} : std::nullopt; } }; -template <> -struct MetadataValue { +template +struct MetadataValue { static_assert(sizeof(int64_t) == sizeof(ExtendableType::value)); [[nodiscard]] static int32_t encode(const ExtendableType& value, void* _Nullable destBuffer, size_t destBufferSize) { - return MetadataWriter{destBuffer, destBufferSize}.write(value).desiredSize(); + return MetadataWriter{destBuffer, destBufferSize} + .template writeHeader
() + .write(value) + .desiredSize(); } [[nodiscard]] static std::optional decode(const void* _Nonnull metadata, size_t metadataSize) { - return MetadataReader{metadata, metadataSize}.readExtendable(); + return MetadataReader{metadata, metadataSize} + .template checkHeader
() + .readExtendable(); } }; -template <> -struct MetadataValue> { +template +struct MetadataValue> { [[nodiscard]] static int32_t encode(const std::vector& values, void* _Nullable destBuffer, size_t destBufferSize) { MetadataWriter writer{destBuffer, destBufferSize}; + writer.template writeHeader
(); writer.write(values.size()); for (const auto& value : values) { writer.write(value.components.size()); @@ -321,13 +353,14 @@ struct MetadataValue> { [[nodiscard]] static DecodeResult decode(const void* _Nonnull metadata, size_t metadataSize) { std::vector values; MetadataReader reader{metadata, metadataSize}; + reader.template checkHeader
(); auto numPlanes = reader.readInt().value_or(0); values.reserve(numPlanes); for (int i = 0; i < numPlanes && reader.ok(); i++) { PlaneLayout& value = values.emplace_back(); auto numPlaneComponents = reader.readInt().value_or(0); value.components.reserve(numPlaneComponents); - for (int i = 0; i < numPlaneComponents && reader.ok(); i++) { + for (int j = 0; j < numPlaneComponents && reader.ok(); j++) { PlaneLayoutComponent& component = value.components.emplace_back(); reader.read(component.type) .read(component.offsetInBits) @@ -346,11 +379,12 @@ struct MetadataValue> { } }; -template <> -struct MetadataValue> { +template +struct MetadataValue> { [[nodiscard]] static int32_t encode(const std::vector& value, void* _Nullable destBuffer, size_t destBufferSize) { MetadataWriter writer{destBuffer, destBufferSize}; + writer.template writeHeader
(); writer.write(value.size()); for (auto& rect : value) { writer.write(rect.left) @@ -364,6 +398,7 @@ struct MetadataValue> { using DecodeResult = std::optional>; [[nodiscard]] static DecodeResult decode(const void* _Nonnull metadata, size_t metadataSize) { MetadataReader reader{metadata, metadataSize}; + reader.template checkHeader
(); std::vector value; auto numRects = reader.readInt().value_or(0); value.reserve(numRects); @@ -378,13 +413,14 @@ struct MetadataValue> { } }; -template <> -struct MetadataValue> { +template +struct MetadataValue> { [[nodiscard]] static int32_t encode(const std::optional& optValue, void* _Nullable destBuffer, size_t destBufferSize) { if (optValue.has_value()) { const auto& value = *optValue; return MetadataWriter{destBuffer, destBufferSize} + .template writeHeader
() .write(value.primaryRed) .write(value.primaryGreen) .write(value.primaryBlue) @@ -404,6 +440,7 @@ struct MetadataValue> { if (metadataSize > 0) { Smpte2086 value; MetadataReader reader{metadata, metadataSize}; + reader.template checkHeader
(); reader.read(value.primaryRed) .read(value.primaryGreen) .read(value.primaryBlue) @@ -420,13 +457,14 @@ struct MetadataValue> { } }; -template <> -struct MetadataValue> { +template +struct MetadataValue> { [[nodiscard]] static int32_t encode(const std::optional& optValue, void* _Nullable destBuffer, size_t destBufferSize) { if (optValue.has_value()) { const auto& value = *optValue; return MetadataWriter{destBuffer, destBufferSize} + .template writeHeader
() .write(value.maxContentLightLevel) .write(value.maxFrameAverageLightLevel) .desiredSize(); @@ -441,6 +479,7 @@ struct MetadataValue> { std::optional optValue{std::nullopt}; if (metadataSize > 0) { MetadataReader reader{metadata, metadataSize}; + reader.template checkHeader
(); Cta861_3 value; reader.read(value.maxContentLightLevel).read(value.maxFrameAverageLightLevel); if (reader.ok()) { @@ -453,14 +492,17 @@ struct MetadataValue> { } }; -template <> -struct MetadataValue>> { +template +struct MetadataValue>> { [[nodiscard]] static int32_t encode(const std::optional>& value, void* _Nullable destBuffer, size_t destBufferSize) { if (!value.has_value()) { return 0; } - return MetadataWriter{destBuffer, destBufferSize}.write(*value).desiredSize(); + return MetadataWriter{destBuffer, destBufferSize} + .template writeHeader
() + .write(*value) + .desiredSize(); } using DecodeResult = std::optional>>; @@ -468,6 +510,7 @@ struct MetadataValue>> { std::optional> optValue; if (metadataSize > 0) { MetadataReader reader{metadata, metadataSize}; + reader.template checkHeader
(); auto value = reader.readBuffer(); if (reader.ok()) { optValue = std::move(value); @@ -482,16 +525,20 @@ struct MetadataValue>> { template struct StandardMetadata {}; -#define DEFINE_TYPE(name, typeArg) \ - template <> \ - struct StandardMetadata { \ - using value_type = typeArg; \ - using value = MetadataValue; \ - static_assert( \ - StandardMetadataType::name == \ - ndk::internal::enum_values[static_cast( \ - StandardMetadataType::name)], \ - "StandardMetadataType must have equivalent value to index"); \ +#define DEFINE_TYPE(typeName, typeArg) \ + template <> \ + struct StandardMetadata { \ + using value_type = typeArg; \ + struct Header { \ + static constexpr auto name = "android.hardware.graphics.common.StandardMetadataType"; \ + static constexpr auto value = static_cast(StandardMetadataType::typeName); \ + }; \ + using value = MetadataValue; \ + static_assert( \ + StandardMetadataType::typeName == \ + ndk::internal::enum_values[static_cast( \ + StandardMetadataType::typeName)], \ + "StandardMetadataType must have equivalent value to index"); \ } DEFINE_TYPE(BUFFER_ID, uint64_t); diff --git a/graphics/mapper/stable-c/vts/VtsHalGraphicsMapperStableC_TargetTest.cpp b/graphics/mapper/stable-c/vts/VtsHalGraphicsMapperStableC_TargetTest.cpp index 6ab11a305d..3ea5fe117a 100644 --- a/graphics/mapper/stable-c/vts/VtsHalGraphicsMapperStableC_TargetTest.cpp +++ b/graphics/mapper/stable-c/vts/VtsHalGraphicsMapperStableC_TargetTest.cpp @@ -215,7 +215,7 @@ class GraphicsTestsBase { sizeRequired = mapper()->v5.getStandardMetadata(bufferHandle, static_cast(T), buffer.data(), buffer.size()); } - if (sizeRequired < 0 || sizeRequired >= buffer.size()) { + if (sizeRequired < 0 || sizeRequired > buffer.size()) { ADD_FAILURE() << "getStandardMetadata failed, received " << sizeRequired << " with buffer size " << buffer.size(); // Generate a fail type From 5d0550c57247df7eb137efd13d899a25f29155fe Mon Sep 17 00:00:00 2001 From: Yu-Han Yang Date: Tue, 22 Nov 2022 21:30:28 +0000 Subject: [PATCH 401/998] Clarify HAL doc of full tracking Bug: 257549183 Test: doc update only Change-Id: I35a0736c0939033a588aa28e77f9186e3d59ce6d --- gnss/aidl/android/hardware/gnss/GnssData.aidl | 2 +- .../android/hardware/gnss/IGnssMeasurementInterface.aidl | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gnss/aidl/android/hardware/gnss/GnssData.aidl b/gnss/aidl/android/hardware/gnss/GnssData.aidl index 492ba3113a..1bd8d48093 100644 --- a/gnss/aidl/android/hardware/gnss/GnssData.aidl +++ b/gnss/aidl/android/hardware/gnss/GnssData.aidl @@ -104,7 +104,7 @@ parcelable GnssData { * True indicates that the GNSS chipset switches off duty cycling. In such mode, no clock * discontinuities are expected and, when supported, carrier phase should be continuous in good * signal conditions. All non-blocklisted, healthy constellations, satellites and frequency - * bands must be tracked and reported in this mode. + * bands that are meaningful to positioning accuracy must be tracked and reported in this mode. * * False indicates that the GNSS chipset optimizes power via duty cycling, constellations and * frequency limits, etc. diff --git a/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl b/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl index 43164074da..33e9008db1 100644 --- a/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl +++ b/gnss/aidl/android/hardware/gnss/IGnssMeasurementInterface.aidl @@ -36,9 +36,9 @@ interface IGnssMeasurementInterface { * If true, GNSS chipset must switch off duty cycling. In such mode no clock discontinuities * are expected and, when supported, carrier phase should be continuous in good signal * conditions. All non-blocklisted, healthy constellations, satellites and frequency bands - * that the chipset supports must be reported in this mode. The GNSS chipset is allowed to - * consume more power in this mode. If false, API must optimize power via duty cycling, - * constellations and frequency limits, etc. + * that are meaningful to positioning accuracy must be tracked and reported in this mode. + * The GNSS chipset is allowed to consume more power in this mode. If false, API must + * optimize power via duty cycling, constellations and frequency limits, etc. */ boolean enableFullTracking; From 5d404b4c52ae5928b633493a3c3e6c6a8170b902 Mon Sep 17 00:00:00 2001 From: Sarah Chin Date: Sun, 20 Nov 2022 23:46:38 -0800 Subject: [PATCH 402/998] Change NrQos qfi from byte to int Deprecate byte qfi and replace with int qosFlowIdentifier Test: build Bug: 247072632 Change-Id: I38cb276c7d0f0d4fd90d393351e44e4fcf162ae6 --- .../current/android/hardware/radio/data/NrQos.aidl | 4 ++++ radio/aidl/android/hardware/radio/data/NrQos.aidl | 8 ++++++-- radio/aidl/compat/libradiocompat/data/structs.cpp | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/NrQos.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/NrQos.aidl index 62f6204038..a0792c3f37 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/NrQos.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/NrQos.aidl @@ -37,8 +37,12 @@ parcelable NrQos { int fiveQi; android.hardware.radio.data.QosBandwidth downlink; android.hardware.radio.data.QosBandwidth uplink; + /** + * @deprecated use qosFlowIdentifier. + */ byte qfi; char averagingWindowMs; + int qosFlowIdentifier; const byte FLOW_ID_RANGE_MIN = 1; const byte FLOW_ID_RANGE_MAX = 63; } diff --git a/radio/aidl/android/hardware/radio/data/NrQos.aidl b/radio/aidl/android/hardware/radio/data/NrQos.aidl index af8ab833ff..28b4a7f20d 100644 --- a/radio/aidl/android/hardware/radio/data/NrQos.aidl +++ b/radio/aidl/android/hardware/radio/data/NrQos.aidl @@ -36,9 +36,13 @@ parcelable NrQos { QosBandwidth downlink; QosBandwidth uplink; /** - * QOS flow identifier of the QOS flow description in the range - * (FLOW_ID_RANGE_MIN, FLOW_ID_RANGE_MAX) + * @deprecated use qosFlowIdentifier. */ byte qfi; char averagingWindowMs; + /** + * QOS flow identifier of the QOS flow description in the range + * (FLOW_ID_RANGE_MIN, FLOW_ID_RANGE_MAX). + **/ + int qosFlowIdentifier; } diff --git a/radio/aidl/compat/libradiocompat/data/structs.cpp b/radio/aidl/compat/libradiocompat/data/structs.cpp index cc6dcbcdf5..22cde6b994 100644 --- a/radio/aidl/compat/libradiocompat/data/structs.cpp +++ b/radio/aidl/compat/libradiocompat/data/structs.cpp @@ -136,7 +136,7 @@ static aidl::NrQos toAidl(const V1_6::NrQos& qos) { .fiveQi = qos.fiveQi, .downlink = toAidl(qos.downlink), .uplink = toAidl(qos.uplink), - .qfi = static_cast(qos.qfi), + .qosFlowIdentifier = static_cast(qos.qfi), .averagingWindowMs = qos.averagingWindowMs, }; } From 2f2a0482ff4bfb179a9b8fede06c58a0290fce34 Mon Sep 17 00:00:00 2001 From: Terry Huang Date: Fri, 18 Nov 2022 10:25:05 +0800 Subject: [PATCH 403/998] [AIDL] Add Location Privacy HAL Bug: 244637957 Test: Build pass Change-Id: Id01ced95282dc0b1cd53a4a2e012a424ca688237 --- .../hardware/radio/network/IRadioNetwork.aidl | 2 + .../network/IRadioNetworkIndication.aidl | 1 + .../radio/network/IRadioNetworkResponse.aidl | 2 + .../radio/network/LocationResponseType.aidl | 40 +++++++++++++++++++ .../hardware/radio/network/IRadioNetwork.aidl | 26 ++++++++++++ .../network/IRadioNetworkIndication.aidl | 12 +++++- .../radio/network/IRadioNetworkResponse.aidl | 22 ++++++++++ .../radio/network/LocationResponseType.aidl | 38 ++++++++++++++++++ 8 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LocationResponseType.aidl create mode 100644 radio/aidl/android/hardware/radio/network/LocationResponseType.aidl diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl index 9761900ba4..5aed0244d9 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl @@ -80,4 +80,6 @@ interface IRadioNetwork { oneway void setNullCipherAndIntegrityEnabled(in int serial, in boolean enabled); oneway void isN1ModeEnabled(in int serial); oneway void setN1ModeEnabled(in int serial, boolean enable); + oneway void setLocationPrivacySetting(in int serial, in boolean shareLocation); + oneway void getLocationPrivacySetting(in int serial); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl index 0f017ea8ba..229f3e2173 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl @@ -49,4 +49,5 @@ interface IRadioNetworkIndication { oneway void suppSvcNotify(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.SuppSvcNotification suppSvc); oneway void voiceRadioTechChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.RadioTechnology rat); oneway void emergencyNetworkScanResult(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.EmergencyRegResult result); + oneway void onNetworkInitiatedLocationResult(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.LocationResponseType locationResponseType); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl index c228bc17d8..ccdfde69e1 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -79,4 +79,6 @@ interface IRadioNetworkResponse { oneway void setNullCipherAndIntegrityEnabledResponse(in android.hardware.radio.RadioResponseInfo info); oneway void isN1ModeEnabledResponse(in android.hardware.radio.RadioResponseInfo info, boolean isEnabled); oneway void setN1ModeEnabledResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setLocationPrivacySettingResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void getLocationPrivacySettingResponse(in android.hardware.radio.RadioResponseInfo info, boolean shareLocation); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LocationResponseType.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LocationResponseType.aidl new file mode 100644 index 0000000000..e89a40fe73 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LocationResponseType.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum LocationResponseType { + REJECTED = 0, + ACCEPTED_NO_LOCATION_PROVIDED = 1, + ACCEPTED_LOCATION_PROVIDED = 2, +} diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl index 4d35742aa8..6cd0339c05 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl @@ -530,4 +530,30 @@ oneway interface IRadioNetwork { * Response function is IRadioNetworkResponse.setN1ModeEnabledResponse() */ void setN1ModeEnabled(in int serial, boolean enable); + + /** + * This API updates the current user setting of sharing the location data. This value must be + * used by radio before honoring a network initiated location request for non emergency use + * cases. The radio shall ignore this setting during emergency call, emergency SMS or emergency + * call back modes and continue to provide the location information to the network initiated + * location requests. + * + * @param serial Serial number of request. + * @param shareLocation Whether to share location data to the network or not. true means the + * radio is allowed to provide location data for any network initiated locations + * request. false means the radio must not share location data for any network initiated + * location requests for non-emergency use cases. + * + * Response function is IRadioNetworkResponse.setLocationPrivacySettingResponse() + */ + void setLocationPrivacySetting(in int serial, in boolean shareLocation); + + /** + * Request the current setting of sharing the location data. + * + * @param serial Serial number of request. + * + * Response function is IRadioNetworkResponse.getLocationPrivacySettingResponse() + */ + void getLocationPrivacySetting(in int serial); } diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl index 47d932d909..2891496d63 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl @@ -21,13 +21,14 @@ import android.hardware.radio.RadioTechnology; import android.hardware.radio.network.BarringInfo; import android.hardware.radio.network.CellIdentity; import android.hardware.radio.network.CellInfo; +import android.hardware.radio.network.EmergencyRegResult; import android.hardware.radio.network.LinkCapacityEstimate; +import android.hardware.radio.network.LocationResponseType; import android.hardware.radio.network.NetworkScanResult; import android.hardware.radio.network.PhoneRestrictedState; import android.hardware.radio.network.PhysicalChannelConfig; import android.hardware.radio.network.SignalStrength; import android.hardware.radio.network.SuppSvcNotification; -import android.hardware.radio.network.EmergencyRegResult; /** * Interface declaring unsolicited radio indications for network APIs. @@ -199,4 +200,13 @@ oneway interface IRadioNetworkIndication { * @param result the result of the Emergency Network Scan */ void emergencyNetworkScanResult(in RadioIndicationType type, in EmergencyRegResult result); + + /** + * Reports the result of the network initiated location request. + * + * @param type Type of radio indication + * @param locationResponseType result of the network initiated location request. + */ + void onNetworkInitiatedLocationResult( + in RadioIndicationType type, in LocationResponseType locationResponseType); } diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl index 3802bd6c23..3fa6521e7e 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -654,4 +654,26 @@ oneway interface IRadioNetworkResponse { * RadioError:INVALID_STATE */ void setN1ModeEnabledResponse(in RadioResponseInfo info); + + /** + * @param info Response info struct containing response type, serial no. and error + * + * Valid errors returned: + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:INTERNAL_ERR + */ + void setLocationPrivacySettingResponse(in RadioResponseInfo info); + + /** + * @param info Response info struct containing response type, serial no. and error + * @param shareLocation Indicates whether the location sharing is allowed or not, True if + * allowed else false. + * + * Valid errors returned: + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:INTERNAL_ERR + */ + void getLocationPrivacySettingResponse(in RadioResponseInfo info, boolean shareLocation); } diff --git a/radio/aidl/android/hardware/radio/network/LocationResponseType.aidl b/radio/aidl/android/hardware/radio/network/LocationResponseType.aidl new file mode 100644 index 0000000000..0c502d08e4 --- /dev/null +++ b/radio/aidl/android/hardware/radio/network/LocationResponseType.aidl @@ -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. + */ + +package android.hardware.radio.network; + +@VintfStability +@Backing(type="int") +@JavaDerive(toString=true) +enum LocationResponseType { + /** + * Network initiated Location request rejected by modem because the user has not given + * permission for this use case + */ + REJECTED = 0, + /** + * Network initiated Location request is accepted by modem however no location information has + * been shared to network due to a failure + */ + ACCEPTED_NO_LOCATION_PROVIDED = 1, + /** + * Network initiated Location request is accepted and location information is provided to the + * network by modem + */ + ACCEPTED_LOCATION_PROVIDED = 2, +} From 1f79db1faa9b07263ede48157c7bebb00fcb4abf Mon Sep 17 00:00:00 2001 From: Terry Huang Date: Fri, 18 Nov 2022 14:51:51 +0800 Subject: [PATCH 404/998] [test_suite] Add Location Privacy HAL Bug: 244637957 Test: Build test_suite pass Change-Id: Id874a52d7ab62ae31b2d840cc236543be903191e --- .../include/libradiocompat/RadioNetwork.h | 3 +++ .../compat/libradiocompat/network/RadioNetwork.cpp | 14 ++++++++++++++ radio/aidl/vts/radio_network_indication.cpp | 5 +++++ radio/aidl/vts/radio_network_response.cpp | 14 ++++++++++++++ radio/aidl/vts/radio_network_utils.h | 9 +++++++++ 5 files changed, 45 insertions(+) diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h index f9f3c6cb33..b4461031be 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h @@ -104,6 +104,9 @@ class RadioNetwork : public RadioCompatBase, ::ndk::ScopedAStatus setNullCipherAndIntegrityEnabled(int32_t serial, bool enabled) override; + ::ndk::ScopedAStatus setLocationPrivacySetting(int32_t serial, bool shareLocation) override; + ::ndk::ScopedAStatus getLocationPrivacySetting(int32_t serial) override; + protected: std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse> respond(); diff --git a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp index 005deaed4d..730b5dd902 100644 --- a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp +++ b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp @@ -360,4 +360,18 @@ ScopedAStatus RadioNetwork::setN1ModeEnabled(int32_t serial, bool /*enable*/) { respond()->setN1ModeEnabledResponse(notSupported(serial)); return ok(); } + +ScopedAStatus RadioNetwork::setLocationPrivacySetting(int32_t serial, bool /*shareLocation*/) { + LOG_CALL << serial; + LOG(ERROR) << " setLocationPrivacySetting is unsupported by HIDL HALs"; + respond()->setLocationPrivacySettingResponse(notSupported(serial)); + return ok(); +} + +ScopedAStatus RadioNetwork::getLocationPrivacySetting(int32_t serial) { + LOG_CALL << serial; + LOG(ERROR) << " getLocationPrivacySetting is unsupported by HIDL HALs"; + respond()->getLocationPrivacySettingResponse(notSupported(serial), false); + return ok(); +} } // namespace android::hardware::radio::compat diff --git a/radio/aidl/vts/radio_network_indication.cpp b/radio/aidl/vts/radio_network_indication.cpp index ae3bd4b01a..71789827a4 100644 --- a/radio/aidl/vts/radio_network_indication.cpp +++ b/radio/aidl/vts/radio_network_indication.cpp @@ -97,3 +97,8 @@ ndk::ScopedAStatus RadioNetworkIndication::emergencyNetworkScanResult( RadioIndicationType /*type*/, const EmergencyRegResult& /*result*/) { return ndk::ScopedAStatus::ok(); } + +ndk::ScopedAStatus RadioNetworkIndication::onNetworkInitiatedLocationResult( + RadioIndicationType /*type*/, LocationResponseType /*locationResponseType*/) { + return ndk::ScopedAStatus::ok(); +} diff --git a/radio/aidl/vts/radio_network_response.cpp b/radio/aidl/vts/radio_network_response.cpp index c890df08a6..4f0e4f3274 100644 --- a/radio/aidl/vts/radio_network_response.cpp +++ b/radio/aidl/vts/radio_network_response.cpp @@ -313,3 +313,17 @@ ndk::ScopedAStatus RadioNetworkResponse::setN1ModeEnabledResponse(const RadioRes parent_network.notify(info.serial); return ndk::ScopedAStatus::ok(); } + +ndk::ScopedAStatus RadioNetworkResponse::setLocationPrivacySettingResponse( + const RadioResponseInfo& info) { + rspInfo = info; + parent_network.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioNetworkResponse::getLocationPrivacySettingResponse( + const RadioResponseInfo& info, bool /*shareLocation*/) { + rspInfo = info; + parent_network.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} diff --git a/radio/aidl/vts/radio_network_utils.h b/radio/aidl/vts/radio_network_utils.h index e6a320b572..92dcb1f70f 100644 --- a/radio/aidl/vts/radio_network_utils.h +++ b/radio/aidl/vts/radio_network_utils.h @@ -166,6 +166,12 @@ class RadioNetworkResponse : public BnRadioNetworkResponse { const RadioResponseInfo& info, bool isEnabled) override; virtual ndk::ScopedAStatus setN1ModeEnabledResponse(const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus setLocationPrivacySettingResponse( + const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus getLocationPrivacySettingResponse(const RadioResponseInfo& info, + bool shareLocation) override; }; /* Callback class for radio network indication */ @@ -223,6 +229,9 @@ class RadioNetworkIndication : public BnRadioNetworkIndication { virtual ndk::ScopedAStatus emergencyNetworkScanResult( RadioIndicationType type, const EmergencyRegResult& result) override; + + virtual ndk::ScopedAStatus onNetworkInitiatedLocationResult( + RadioIndicationType type, LocationResponseType locationResponseType) override; }; // The main test class for Radio AIDL Network. From 1f0ce0d2d35fa552d874b2019351bf9de5f5f6c0 Mon Sep 17 00:00:00 2001 From: shrikar Date: Fri, 11 Nov 2022 17:46:06 +0000 Subject: [PATCH 405/998] Added SEAT_CUSHION_SIDE_SUPPORT_MOVE to hardware layer. Bug: 257268273 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I18d418556ed763fc12e875b74044ca9e292dcb67 --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 19 ++++++++++ .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../config/DefaultProperties.json | 35 +++++++++++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++ 8 files changed, 65 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 0bf0ed4db8..05c7c631f9 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -157,6 +157,7 @@ enum VehicleProperty { SEAT_HEADREST_FORE_AFT_MOVE = 356518810, SEAT_EASY_ACCESS_ENABLED = 354421661, SEAT_CUSHION_SIDE_SUPPORT_POS = 356518815, + SEAT_CUSHION_SIDE_SUPPORT_MOVE = 356518816, SEAT_OCCUPANCY = 356518832, WINDOW_POS = 322964416, WINDOW_MOVE = 322964417, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 8f00dcaa5f..6adff006bd 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1748,6 +1748,25 @@ enum VehicleProperty { */ SEAT_CUSHION_SIDE_SUPPORT_POS = 0x0B9F + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, + /** + * Represents property for movement direction and speed of seat cushion side support. + * + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers + * between minInt32Value and maxInt32Value must be supported. + * + * maxInt32Value in default area's VehicleAreaConfig represents the maximum movement speed of + * the seat cushion side support in the growing wider direction (i.e. less support). + * minInt32Value in default area's VehicleAreaConfig represents the maximum movement speed of + * the seat cushion side support in the growing thinner direction (i.e. more support). + * + * Larger absolute values, either positive or negative, indicate a faster movement speed. Once + * the seat cushion side support reaches the positional limit, the value resets to 0. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + SEAT_CUSHION_SIDE_SUPPORT_MOVE = + 0x0BA0 + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, /** * Seat Occupancy * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 7f9551f866..9ee7619d23 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -157,6 +157,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_OCCUPANCY, VehiclePropertyAccess::READ}, {VehicleProperty::WINDOW_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::WINDOW_MOVE, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index a875864d85..4577df4804 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -157,6 +157,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_OCCUPANCY, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDOW_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDOW_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 15868583da..1f3c3c63c2 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -149,6 +149,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_OCCUPANCY, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 6f1ebe3a02..9ec7225b81 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -149,6 +149,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_OCCUPANCY, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 7f2d8b29c2..e59f09fa48 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1086,6 +1086,41 @@ } ] }, + { + "property": "VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_MOVE", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -1, + "maxInt32Value": 1 + } + ] + }, { "property": "VehicleProperty::SEAT_OCCUPANCY", "areas": [ diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 11db8e00d1..2ea5c98861 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -553,6 +553,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatCushionSideSupportPosConfig) VehiclePropertyGroup::SYSTEM, VehicleArea::SEAT, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatCushionSideSupportMoveConfig) { + verifyProperty(VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_MOVE, + VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::SEAT, VehiclePropertyType::INT32); +} + std::vector getDescriptors() { std::vector descriptors; for (std::string name : getAidlHalInstanceNames(IVehicle::descriptor)) { From eff71b2f834adda702eee24f34d2349acf5f55d2 Mon Sep 17 00:00:00 2001 From: shrikar Date: Fri, 11 Nov 2022 11:02:43 -0800 Subject: [PATCH 406/998] Added SEAT_LUMBAR_VERTICAL_POS to hardware layer. Bug: 257268339 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I698ff091e20a9a2c141687b0180d470c6652b12c --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 16 +++++++++ .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../config/DefaultProperties.json | 35 +++++++++++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++ 8 files changed, 62 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 05c7c631f9..514363dffb 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -158,6 +158,7 @@ enum VehicleProperty { SEAT_EASY_ACCESS_ENABLED = 354421661, SEAT_CUSHION_SIDE_SUPPORT_POS = 356518815, SEAT_CUSHION_SIDE_SUPPORT_MOVE = 356518816, + SEAT_LUMBAR_VERTICAL_POS = 356518817, SEAT_OCCUPANCY = 356518832, WINDOW_POS = 322964416, WINDOW_MOVE = 322964417, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 6adff006bd..7c19dad6ec 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1767,6 +1767,22 @@ enum VehicleProperty { */ SEAT_CUSHION_SIDE_SUPPORT_MOVE = 0x0BA0 + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, + /** + * Represents property for seat’s lumbar support vertical position. + * + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers + * between minInt32Value and maxInt32Value are supported. + * + * maxInt32Value indicates the highest position. + * minInt32Value indicates the lowest position. + * + * This value is not in any particular unit but in a specified range of steps. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + SEAT_LUMBAR_VERTICAL_POS = + 0x0BA1 + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, /** * Seat Occupancy * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 9ee7619d23..b0ea23e27c 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -158,6 +158,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_OCCUPANCY, VehiclePropertyAccess::READ}, {VehicleProperty::WINDOW_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::WINDOW_MOVE, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 4577df4804..1608320b94 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -158,6 +158,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_OCCUPANCY, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDOW_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDOW_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 1f3c3c63c2..83ab83abe3 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -150,6 +150,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_OCCUPANCY, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 9ec7225b81..acf1522c87 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -150,6 +150,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.SEAT_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_OCCUPANCY, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index e59f09fa48..c39b5eb54f 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1121,6 +1121,41 @@ } ] }, + { + "property": "VehicleProperty::SEAT_LUMBAR_VERTICAL_POS", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -10, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -10, + "maxInt32Value": 10 + } + ] + }, { "property": "VehicleProperty::SEAT_OCCUPANCY", "areas": [ diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 2ea5c98861..13e4a9f038 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -559,6 +559,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatCushionSideSupportMoveConfig VehiclePropertyGroup::SYSTEM, VehicleArea::SEAT, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatLumbarVerticalPosConfig) { + verifyProperty(VehicleProperty::SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::SEAT, VehiclePropertyType::INT32); +} + std::vector getDescriptors() { std::vector descriptors; for (std::string name : getAidlHalInstanceNames(IVehicle::descriptor)) { From 2a081c52692e6c46c05b8e87b93db4415aceb589 Mon Sep 17 00:00:00 2001 From: shrikar Date: Fri, 11 Nov 2022 16:49:58 -0800 Subject: [PATCH 407/998] Added SEAT_LUMBAR_VERTICAL_MOVE to hardware layer Bug: 257268500 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I437270c9bbc0ba37eecde1845a1f3a69b8b4007a --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 21 +++++++++++ .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../config/DefaultProperties.json | 35 +++++++++++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++ 8 files changed, 67 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 514363dffb..79352c7d7a 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -159,6 +159,7 @@ enum VehicleProperty { SEAT_CUSHION_SIDE_SUPPORT_POS = 356518815, SEAT_CUSHION_SIDE_SUPPORT_MOVE = 356518816, SEAT_LUMBAR_VERTICAL_POS = 356518817, + SEAT_LUMBAR_VERTICAL_MOVE = 356518818, SEAT_OCCUPANCY = 356518832, WINDOW_POS = 322964416, WINDOW_MOVE = 322964417, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 7c19dad6ec..8d21485691 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1783,6 +1783,27 @@ enum VehicleProperty { */ SEAT_LUMBAR_VERTICAL_POS = 0x0BA1 + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, + /** + * Represents property for vertical movement direction and speed of seat lumbar support. + * + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers + * between minInt32Value and maxInt32Value must be supported. + * + * maxInt32Value in default area's VehicleAreaConfig indicates the lumbar support is moving at + * the fastest upward speed. + * minInt32Value in default area's VehicleAreaConfig indicates the lumbar support is moving at + * the fastest downward speed. + * + * Larger absolute values, either positive or negative, indicate a faster movement speed. Once + * the seat cushion side support reaches the positional limit, the value resets to 0. + * + * This value is not in any particular unit but in a specified range of steps. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + SEAT_LUMBAR_VERTICAL_MOVE = + 0x0BA2 + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, /** * Seat Occupancy * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index b0ea23e27c..aece6320c0 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -159,6 +159,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_LUMBAR_VERTICAL_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_OCCUPANCY, VehiclePropertyAccess::READ}, {VehicleProperty::WINDOW_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::WINDOW_MOVE, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 1608320b94..d514558d82 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -159,6 +159,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_LUMBAR_VERTICAL_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_OCCUPANCY, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDOW_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDOW_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 83ab83abe3..8ae95b9bfc 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -151,6 +151,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_LUMBAR_VERTICAL_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_OCCUPANCY, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index acf1522c87..0afbeaada4 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -151,6 +151,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_LUMBAR_VERTICAL_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_OCCUPANCY, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index c39b5eb54f..f61eead965 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1156,6 +1156,41 @@ } ] }, + { + "property": "VehicleProperty::SEAT_LUMBAR_VERTICAL_MOVE", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -1, + "maxInt32Value": 1 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -1, + "maxInt32Value": 1 + } + ] + }, { "property": "VehicleProperty::SEAT_OCCUPANCY", "areas": [ diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 13e4a9f038..fb5eb8e263 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -565,6 +565,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatLumbarVerticalPosConfig) { VehicleArea::SEAT, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatLumbarVerticalMoveConfig) { + verifyProperty(VehicleProperty::SEAT_LUMBAR_VERTICAL_MOVE, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::SEAT, VehiclePropertyType::INT32); +} + std::vector getDescriptors() { std::vector descriptors; for (std::string name : getAidlHalInstanceNames(IVehicle::descriptor)) { From 3e22bef7378fe67157da591616ff897ff3177ab9 Mon Sep 17 00:00:00 2001 From: Muralidhar Reddy Date: Mon, 21 Nov 2022 09:51:11 +0000 Subject: [PATCH 408/998] Add HAL changes to support MEP-A1 mode Test: build Bug: 254866604 Change-Id: Ie5c1485553b14e6000671a325d806afed0c6b1c7 --- .../config/MultipleEnabledProfilesMode.aidl | 41 ++++++++++++++++ .../hardware/radio/config/SimSlotStatus.aidl | 1 + .../android/hardware/radio/sim/SimApdu.aidl | 1 + .../config/MultipleEnabledProfilesMode.aidl | 47 +++++++++++++++++++ .../hardware/radio/config/SimSlotStatus.aidl | 5 ++ .../android/hardware/radio/sim/SimApdu.aidl | 5 ++ 6 files changed, 100 insertions(+) create mode 100644 radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl create mode 100644 radio/aidl/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl new file mode 100644 index 0000000000..fad767c87a --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.config; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum MultipleEnabledProfilesMode { + NONE = 0, + MEP_A1 = 1, + MEP_A2 = 2, + MEP_B = 3, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimSlotStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimSlotStatus.aidl index be4c08064a..da894cdbd7 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimSlotStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimSlotStatus.aidl @@ -38,4 +38,5 @@ parcelable SimSlotStatus { String atr; String eid; android.hardware.radio.config.SimPortInfo[] portInfo; + android.hardware.radio.config.MultipleEnabledProfilesMode supportedMepMode; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimApdu.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimApdu.aidl index 2201345695..2f2e07b999 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimApdu.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimApdu.aidl @@ -41,4 +41,5 @@ parcelable SimApdu { int p2; int p3; String data; + boolean isEs10; } diff --git a/radio/aidl/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl b/radio/aidl/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl new file mode 100644 index 0000000000..b18ea0e710 --- /dev/null +++ b/radio/aidl/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl @@ -0,0 +1,47 @@ +/* + * 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. + */ + +package android.hardware.radio.config; + +/** + * Multiple Enabled Profiles(MEP) mode is the jointly supported MEP mode. As per section 3.4.1.1 of + * GSMA spec SGP.22 v3.0,there are 3 supported MEP modes: MEP-A1, MEP-A2 and MEP-B. + * If there is no jointly supported MEP mode, supported MEP mode is set to NONE. + */ +@VintfStability +@Backing(type="int") +@JavaDerive(toString=true) +enum MultipleEnabledProfilesMode { + /** + * If there is no jointly supported MEP mode, set supported MEP mode to NONE. + */ + NONE, + /** + * In case of MEP-A1, the ISD-R is selected on eSIM port 0 only and profiles are selected on + * eSIM ports 1 and higher, with the eSIM port being assigned by the LPA or platform. + */ + MEP_A1, + /** + * In case of MEP-A2, the ISD-R is selected on eSIM port 0 only and profiles are selected on + * eSIM ports 1 and higher, with the eSIM port being assigned by the eUICC. + */ + MEP_A2, + /** + * In case of MEP-B, profiles are selected on eSIM ports 0 and higher, with the ISD-R being + * selectable on any of these eSIM ports. + */ + MEP_B, +} diff --git a/radio/aidl/android/hardware/radio/config/SimSlotStatus.aidl b/radio/aidl/android/hardware/radio/config/SimSlotStatus.aidl index 748660fecc..73f2954899 100644 --- a/radio/aidl/android/hardware/radio/config/SimSlotStatus.aidl +++ b/radio/aidl/android/hardware/radio/config/SimSlotStatus.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.config; +import android.hardware.radio.config.MultipleEnabledProfilesMode; import android.hardware.radio.config.SimPortInfo; @VintfStability @@ -52,4 +53,8 @@ parcelable SimSlotStatus { * active port in the slot mapping. */ SimPortInfo[] portInfo; + /** + * Jointly supported Multiple Enabled Profiles(MEP) mode as per SGP.22 V3.0 + */ + MultipleEnabledProfilesMode supportedMepMode; } diff --git a/radio/aidl/android/hardware/radio/sim/SimApdu.aidl b/radio/aidl/android/hardware/radio/sim/SimApdu.aidl index 43adbbcd5e..4759e2e9ab 100644 --- a/radio/aidl/android/hardware/radio/sim/SimApdu.aidl +++ b/radio/aidl/android/hardware/radio/sim/SimApdu.aidl @@ -49,4 +49,9 @@ parcelable SimApdu { * In hex string format ([a-fA-F0-9]*) */ String data; + /** + * isEs10 indicates that the current streaming APDU contains an ES10 command or it is a regular + * APDU. (As per spec SGP.22 V3.0, ES10 commands needs to be sent over command port of MEP-A1) + */ + boolean isEs10; } From 60741ed7a2cd1f8d54bc62d3cabe9d56b6443df1 Mon Sep 17 00:00:00 2001 From: Vadim Caen Date: Mon, 17 Oct 2022 14:11:41 +0000 Subject: [PATCH 409/998] Enable Rust backend for Camera HAL Change-Id: I70ee4b41d887a9e9b1345020df9d591abdba5c65 --- camera/common/aidl/Android.bp | 3 +++ camera/device/aidl/Android.bp | 3 +++ camera/metadata/aidl/Android.bp | 3 +++ camera/provider/aidl/Android.bp | 3 +++ common/aidl/Android.bp | 3 +++ common/fmq/aidl/Android.bp | 3 +++ graphics/common/aidl/Android.bp | 3 +++ 7 files changed, 21 insertions(+) diff --git a/camera/common/aidl/Android.bp b/camera/common/aidl/Android.bp index d21ae581fb..e1c9cc5e89 100644 --- a/camera/common/aidl/Android.bp +++ b/camera/common/aidl/Android.bp @@ -19,6 +19,9 @@ aidl_interface { java: { enabled: false, }, + rust: { + enabled: true, + } }, versions_with_info: [ { diff --git a/camera/device/aidl/Android.bp b/camera/device/aidl/Android.bp index c184677408..2e5b6673cf 100644 --- a/camera/device/aidl/Android.bp +++ b/camera/device/aidl/Android.bp @@ -27,6 +27,9 @@ aidl_interface { sdk_version: "module_current", enabled: false, }, + rust: { + enabled: true, + } }, versions_with_info: [ { diff --git a/camera/metadata/aidl/Android.bp b/camera/metadata/aidl/Android.bp index 301a9435cf..0113a4b2f8 100644 --- a/camera/metadata/aidl/Android.bp +++ b/camera/metadata/aidl/Android.bp @@ -19,6 +19,9 @@ aidl_interface { java: { enabled: false, }, + rust: { + enabled: true, + } }, versions_with_info: [ { diff --git a/camera/provider/aidl/Android.bp b/camera/provider/aidl/Android.bp index d7e613e657..19dede0a90 100644 --- a/camera/provider/aidl/Android.bp +++ b/camera/provider/aidl/Android.bp @@ -26,6 +26,9 @@ aidl_interface { cpp: { enabled: false, }, + rust: { + enabled: true, + }, }, versions_with_info: [ { diff --git a/common/aidl/Android.bp b/common/aidl/Android.bp index 7f6890c92f..f3ea8e80bb 100644 --- a/common/aidl/Android.bp +++ b/common/aidl/Android.bp @@ -36,6 +36,9 @@ aidl_interface { ], min_sdk_version: "29", }, + rust: { + enabled: true, + } }, frozen: true, versions: [ diff --git a/common/fmq/aidl/Android.bp b/common/fmq/aidl/Android.bp index 95fcc41f8d..0715575c33 100644 --- a/common/fmq/aidl/Android.bp +++ b/common/fmq/aidl/Android.bp @@ -36,6 +36,9 @@ aidl_interface { ], min_sdk_version: "29", }, + rust: { + enabled: true, + } }, frozen: true, versions: ["1"], diff --git a/graphics/common/aidl/Android.bp b/graphics/common/aidl/Android.bp index 84bc1afd1e..6c8ff4bf92 100644 --- a/graphics/common/aidl/Android.bp +++ b/graphics/common/aidl/Android.bp @@ -39,6 +39,9 @@ aidl_interface { ], min_sdk_version: "29", }, + rust: { + enabled: true, + } }, frozen: false, versions_with_info: [ From 9ff9db463507a22e2ea93adbcb9b63d4ad3598f1 Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Wed, 23 Nov 2022 22:18:46 +0000 Subject: [PATCH 410/998] Add HAL API to support conservative mode for EAP-SIM/AKA/AKA' Bug: 239710602 Test: atest vts Change-Id: Ic2d0d8453cff79c4242c1d701b36c482146a701f --- .../wifi/supplicant/ISupplicantStaNetwork.aidl | 1 + .../wifi/supplicant/ISupplicantStaNetwork.aidl | 10 ++++++++++ .../functional/supplicant_sta_network_aidl_test.cpp | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl index 0bdec346b4..bfc05a4ad8 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl @@ -128,6 +128,7 @@ interface ISupplicantStaNetwork { void setWepTxKeyIdx(in int keyIdx); void setRoamingConsortiumSelection(in byte[] selectedRcoi); void setMinimumTlsVersionEapPhase1Param(android.hardware.wifi.supplicant.TlsVersion tlsVersion); + void setStrictConservativePeerMode(in boolean enable); const int SSID_MAX_LEN_IN_BYTES = 32; const int PSK_PASSPHRASE_MIN_LEN_IN_BYTES = 8; const int PSK_PASSPHRASE_MAX_LEN_IN_BYTES = 63; diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl index 44512a96d3..750cf721e4 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl @@ -1131,4 +1131,14 @@ interface ISupplicantStaNetwork { * |SupplicantStatusCode.FAILURE_NETWORK_INVALID| */ void setMinimumTlsVersionEapPhase1Param(TlsVersion tlsVersion); + + /** + * Enable the strict conservative peer mode for EAP-SIM/AKA/AKA' + * + * @param enable true to enable, false to disable. + * @throws ServiceSpecificException with one of the following values: + * |SupplicantStatusCode.FAILURE_UNKNOWN|, + * |SupplicantStatusCode.FAILURE_NETWORK_INVALID| + */ + void setStrictConservativePeerMode(in boolean enable); } diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp index e5d976c983..6ff64a5ecc 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp +++ b/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp @@ -649,6 +649,14 @@ TEST_P(SupplicantStaNetworkAidlTest, SetEapEncryptedImsiIdentity) { .isOk()); } +/* + * SetStrictConservativePeerMode + */ +TEST_P(SupplicantStaNetworkAidlTest, SetStrictConversativePeerMode) { + EXPECT_TRUE(sta_network_->setStrictConservativePeerMode(true).isOk()); + EXPECT_TRUE(sta_network_->setStrictConservativePeerMode(false).isOk()); +} + /* * SendNetworkEapIdentityResponse */ From b27153df09b5ad47dd081fc62acd2181bab1c31a Mon Sep 17 00:00:00 2001 From: Jeff Pu Date: Mon, 28 Nov 2022 14:12:28 +0000 Subject: [PATCH 411/998] Streamline OWNERS file under hardware/interfaces/biometrics Bug: 259997419 Test: N/A Change-Id: Ie435c70566267f9ff4a4b9474d41c5b625fc6b74 --- biometrics/{fingerprint/aidl => }/OWNERS | 0 biometrics/common/aidl/OWNERS | 2 -- biometrics/face/1.0/vts/functional/OWNERS | 2 -- biometrics/face/aidl/OWNERS | 2 -- biometrics/fingerprint/2.1/vts/functional/OWNERS | 2 -- biometrics/fingerprint/2.2/vts/functional/OWNERS | 2 -- 6 files changed, 10 deletions(-) rename biometrics/{fingerprint/aidl => }/OWNERS (100%) delete mode 100644 biometrics/common/aidl/OWNERS delete mode 100644 biometrics/face/1.0/vts/functional/OWNERS delete mode 100644 biometrics/face/aidl/OWNERS delete mode 100644 biometrics/fingerprint/2.1/vts/functional/OWNERS delete mode 100644 biometrics/fingerprint/2.2/vts/functional/OWNERS diff --git a/biometrics/fingerprint/aidl/OWNERS b/biometrics/OWNERS similarity index 100% rename from biometrics/fingerprint/aidl/OWNERS rename to biometrics/OWNERS diff --git a/biometrics/common/aidl/OWNERS b/biometrics/common/aidl/OWNERS deleted file mode 100644 index 36d726136f..0000000000 --- a/biometrics/common/aidl/OWNERS +++ /dev/null @@ -1,2 +0,0 @@ -ilyamaty@google.com -kchyn@google.com diff --git a/biometrics/face/1.0/vts/functional/OWNERS b/biometrics/face/1.0/vts/functional/OWNERS deleted file mode 100644 index 7651b694f4..0000000000 --- a/biometrics/face/1.0/vts/functional/OWNERS +++ /dev/null @@ -1,2 +0,0 @@ -# Bug component: 432605 -ilyamaty@google.com diff --git a/biometrics/face/aidl/OWNERS b/biometrics/face/aidl/OWNERS deleted file mode 100644 index 36d726136f..0000000000 --- a/biometrics/face/aidl/OWNERS +++ /dev/null @@ -1,2 +0,0 @@ -ilyamaty@google.com -kchyn@google.com diff --git a/biometrics/fingerprint/2.1/vts/functional/OWNERS b/biometrics/fingerprint/2.1/vts/functional/OWNERS deleted file mode 100644 index 0014ce917a..0000000000 --- a/biometrics/fingerprint/2.1/vts/functional/OWNERS +++ /dev/null @@ -1,2 +0,0 @@ -# Bug component: 114777 -ilyamaty@google.com diff --git a/biometrics/fingerprint/2.2/vts/functional/OWNERS b/biometrics/fingerprint/2.2/vts/functional/OWNERS deleted file mode 100644 index 0014ce917a..0000000000 --- a/biometrics/fingerprint/2.2/vts/functional/OWNERS +++ /dev/null @@ -1,2 +0,0 @@ -# Bug component: 114777 -ilyamaty@google.com From e58e263bce07e33bcf928388d21c9f544eb537e7 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Fri, 15 Jul 2022 23:25:39 +0000 Subject: [PATCH 412/998] Convert vendor HAL service to use new AIDL interface. Bug: 205044134 Test: Pass AIDL VTS tests and regression tests. Change-Id: I286ffbf67efddc6c34d34ebd9e9bd9f36139c962 --- .../android.hardware.wifi@1.0-service-lazy.rc | 14 - .../android.hardware.wifi@1.0-service.rc | 12 - .../android.hardware.wifi@1.0-service.xml | 11 - wifi/1.6/default/hidl_callback_util.h | 122 - wifi/1.6/default/hidl_return_util.h | 118 - wifi/1.6/default/hidl_struct_util.cpp | 3007 ----------------- wifi/1.6/default/hidl_struct_util.h | 204 -- wifi/1.6/default/service.cpp | 71 - .../tests/wifi_nan_iface_unit_tests.cpp | 138 - wifi/1.6/default/wifi.h | 105 - wifi/1.6/default/wifi_ap_iface.h | 89 - wifi/1.6/default/wifi_chip.h | 317 -- wifi/1.6/default/wifi_nan_iface.cpp | 1016 ------ wifi/1.6/default/wifi_nan_iface.h | 208 -- wifi/1.6/default/wifi_rtt_controller.cpp | 377 --- wifi/1.6/default/wifi_rtt_controller.h | 138 - wifi/1.6/default/wifi_sta_iface.cpp | 592 ---- wifi/1.6/default/wifi_sta_iface.h | 157 - wifi/{1.6 => aidl}/default/Android.bp | 84 +- wifi/{1.6 => aidl}/default/THREADING.README | 12 +- wifi/aidl/default/aidl_callback_util.h | 140 + wifi/aidl/default/aidl_return_util.h | 85 + wifi/aidl/default/aidl_struct_util.cpp | 2775 +++++++++++++++ wifi/aidl/default/aidl_struct_util.h | 180 + .../default/aidl_sync_util.cpp} | 14 +- .../default/aidl_sync_util.h} | 20 +- .../android.hardware.wifi-service-lazy.rc | 8 + .../default/android.hardware.wifi-service.rc | 6 + .../default/android.hardware.wifi-service.xml | 6 + wifi/{1.6 => aidl}/default/ringbuffer.cpp | 12 +- wifi/{1.6 => aidl}/default/ringbuffer.h | 8 +- wifi/aidl/default/service.cpp | 73 + .../tests/aidl_struct_util_unit_tests.cpp} | 245 +- wifi/{1.6 => aidl}/default/tests/main.cpp | 2 +- .../default/tests/mock_interface_tool.cpp | 3 +- .../default/tests/mock_interface_tool.h | 2 +- .../default/tests/mock_wifi_feature_flags.cpp | 8 +- .../default/tests/mock_wifi_feature_flags.h | 11 +- .../default/tests/mock_wifi_iface_util.cpp | 15 +- .../default/tests/mock_wifi_iface_util.h | 16 +- .../default/tests/mock_wifi_legacy_hal.cpp | 14 +- .../default/tests/mock_wifi_legacy_hal.h | 10 +- .../tests/mock_wifi_mode_controller.cpp | 9 +- .../default/tests/mock_wifi_mode_controller.h | 8 +- .../default/tests/ringbuffer_unit_tests.cpp | 9 +- wifi/{1.6 => aidl}/default/tests/runtests.sh | 6 +- .../default/tests/wifi_chip_unit_tests.cpp | 429 ++- .../tests/wifi_iface_util_unit_tests.cpp | 14 +- .../tests/wifi_nan_iface_unit_tests.cpp | 168 + wifi/{1.6 => aidl}/default/wifi.cpp | 166 +- wifi/aidl/default/wifi.h | 96 + wifi/{1.6 => aidl}/default/wifi_ap_iface.cpp | 118 +- wifi/aidl/default/wifi_ap_iface.h | 81 + wifi/{1.6 => aidl}/default/wifi_chip.cpp | 1046 +++--- wifi/aidl/default/wifi_chip.h | 287 ++ .../default/wifi_feature_flags.cpp | 135 +- .../default/wifi_feature_flags.h | 24 +- .../{1.6 => aidl}/default/wifi_iface_util.cpp | 20 +- wifi/{1.6 => aidl}/default/wifi_iface_util.h | 15 +- .../{1.6 => aidl}/default/wifi_legacy_hal.cpp | 154 +- wifi/{1.6 => aidl}/default/wifi_legacy_hal.h | 45 +- .../default/wifi_legacy_hal_factory.cpp | 18 +- .../default/wifi_legacy_hal_factory.h | 14 +- .../default/wifi_legacy_hal_stubs.cpp | 9 +- .../default/wifi_legacy_hal_stubs.h | 8 +- .../default/wifi_mode_controller.cpp | 19 +- .../default/wifi_mode_controller.h | 14 +- wifi/aidl/default/wifi_nan_iface.cpp | 751 ++++ wifi/aidl/default/wifi_nan_iface.h | 134 + wifi/{1.6 => aidl}/default/wifi_p2p_iface.cpp | 32 +- wifi/{1.6 => aidl}/default/wifi_p2p_iface.h | 25 +- wifi/aidl/default/wifi_rtt_controller.cpp | 255 ++ wifi/aidl/default/wifi_rtt_controller.h | 102 + wifi/aidl/default/wifi_sta_iface.cpp | 558 +++ wifi/aidl/default/wifi_sta_iface.h | 154 + .../default/wifi_status_util.cpp | 28 +- wifi/{1.6 => aidl}/default/wifi_status_util.h | 22 +- wifi/aidl/vts/functional/Android.bp | 169 + .../vts/functional/wifi_aidl_test_utils.cpp | 216 ++ .../vts/functional/wifi_aidl_test_utils.h | 48 + .../functional/wifi_ap_iface_aidl_test.cpp | 154 + .../vts/functional/wifi_chip_aidl_test.cpp | 889 +++++ .../functional/wifi_nan_iface_aidl_test.cpp | 627 ++++ .../wifi_rtt_controller_aidl_test.cpp | 234 ++ .../functional/wifi_sta_iface_aidl_test.cpp | 282 ++ wifi/apex/Android.bp | 8 +- wifi/apex/file_contexts | 2 +- 87 files changed, 9769 insertions(+), 8278 deletions(-) delete mode 100644 wifi/1.6/default/android.hardware.wifi@1.0-service-lazy.rc delete mode 100644 wifi/1.6/default/android.hardware.wifi@1.0-service.rc delete mode 100644 wifi/1.6/default/android.hardware.wifi@1.0-service.xml delete mode 100644 wifi/1.6/default/hidl_callback_util.h delete mode 100644 wifi/1.6/default/hidl_return_util.h delete mode 100644 wifi/1.6/default/hidl_struct_util.cpp delete mode 100644 wifi/1.6/default/hidl_struct_util.h delete mode 100644 wifi/1.6/default/service.cpp delete mode 100644 wifi/1.6/default/tests/wifi_nan_iface_unit_tests.cpp delete mode 100644 wifi/1.6/default/wifi.h delete mode 100644 wifi/1.6/default/wifi_ap_iface.h delete mode 100644 wifi/1.6/default/wifi_chip.h delete mode 100644 wifi/1.6/default/wifi_nan_iface.cpp delete mode 100644 wifi/1.6/default/wifi_nan_iface.h delete mode 100644 wifi/1.6/default/wifi_rtt_controller.cpp delete mode 100644 wifi/1.6/default/wifi_rtt_controller.h delete mode 100644 wifi/1.6/default/wifi_sta_iface.cpp delete mode 100644 wifi/1.6/default/wifi_sta_iface.h rename wifi/{1.6 => aidl}/default/Android.bp (67%) rename wifi/{1.6 => aidl}/default/THREADING.README (82%) create mode 100644 wifi/aidl/default/aidl_callback_util.h create mode 100644 wifi/aidl/default/aidl_return_util.h create mode 100644 wifi/aidl/default/aidl_struct_util.cpp create mode 100644 wifi/aidl/default/aidl_struct_util.h rename wifi/{1.6/default/hidl_sync_util.cpp => aidl/default/aidl_sync_util.cpp} (78%) rename wifi/{1.6/default/hidl_sync_util.h => aidl/default/aidl_sync_util.h} (71%) create mode 100644 wifi/aidl/default/android.hardware.wifi-service-lazy.rc create mode 100644 wifi/aidl/default/android.hardware.wifi-service.rc create mode 100644 wifi/aidl/default/android.hardware.wifi-service.xml rename wifi/{1.6 => aidl}/default/ringbuffer.cpp (92%) rename wifi/{1.6 => aidl}/default/ringbuffer.h (90%) create mode 100644 wifi/aidl/default/service.cpp rename wifi/{1.6/default/tests/hidl_struct_util_unit_tests.cpp => aidl/default/tests/aidl_struct_util_unit_tests.cpp} (69%) rename wifi/{1.6 => aidl}/default/tests/main.cpp (94%) rename wifi/{1.6 => aidl}/default/tests/mock_interface_tool.cpp (86%) rename wifi/{1.6 => aidl}/default/tests/mock_interface_tool.h (96%) rename wifi/{1.6 => aidl}/default/tests/mock_wifi_feature_flags.cpp (85%) rename wifi/{1.6 => aidl}/default/tests/mock_wifi_feature_flags.h (77%) rename wifi/{1.6 => aidl}/default/tests/mock_wifi_iface_util.cpp (68%) rename wifi/{1.6 => aidl}/default/tests/mock_wifi_iface_util.h (79%) rename wifi/{1.6 => aidl}/default/tests/mock_wifi_legacy_hal.cpp (69%) rename wifi/{1.6 => aidl}/default/tests/mock_wifi_legacy_hal.h (92%) rename wifi/{1.6 => aidl}/default/tests/mock_wifi_mode_controller.cpp (87%) rename wifi/{1.6 => aidl}/default/tests/mock_wifi_mode_controller.h (89%) rename wifi/{1.6 => aidl}/default/tests/ringbuffer_unit_tests.cpp (95%) rename wifi/{1.6 => aidl}/default/tests/runtests.sh (79%) rename wifi/{1.6 => aidl}/default/tests/wifi_chip_unit_tests.cpp (66%) rename wifi/{1.6 => aidl}/default/tests/wifi_iface_util_unit_tests.cpp (92%) create mode 100644 wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp rename wifi/{1.6 => aidl}/default/wifi.cpp (60%) create mode 100644 wifi/aidl/default/wifi.h rename wifi/{1.6 => aidl}/default/wifi_ap_iface.cpp (59%) create mode 100644 wifi/aidl/default/wifi_ap_iface.h rename wifi/{1.6 => aidl}/default/wifi_chip.cpp (64%) create mode 100644 wifi/aidl/default/wifi_chip.h rename wifi/{1.6 => aidl}/default/wifi_feature_flags.cpp (59%) rename wifi/{1.6 => aidl}/default/wifi_feature_flags.h (67%) rename wifi/{1.6 => aidl}/default/wifi_iface_util.cpp (95%) rename wifi/{1.6 => aidl}/default/wifi_iface_util.h (89%) rename wifi/{1.6 => aidl}/default/wifi_legacy_hal.cpp (94%) rename wifi/{1.6 => aidl}/default/wifi_legacy_hal.h (97%) rename wifi/{1.6 => aidl}/default/wifi_legacy_hal_factory.cpp (97%) rename wifi/{1.6 => aidl}/default/wifi_legacy_hal_factory.h (82%) rename wifi/{1.6 => aidl}/default/wifi_legacy_hal_stubs.cpp (98%) rename wifi/{1.6 => aidl}/default/wifi_legacy_hal_stubs.h (86%) rename wifi/{1.6 => aidl}/default/wifi_mode_controller.cpp (91%) rename wifi/{1.6 => aidl}/default/wifi_mode_controller.h (84%) create mode 100644 wifi/aidl/default/wifi_nan_iface.cpp create mode 100644 wifi/aidl/default/wifi_nan_iface.h rename wifi/{1.6 => aidl}/default/wifi_p2p_iface.cpp (60%) rename wifi/{1.6 => aidl}/default/wifi_p2p_iface.h (64%) create mode 100644 wifi/aidl/default/wifi_rtt_controller.cpp create mode 100644 wifi/aidl/default/wifi_rtt_controller.h create mode 100644 wifi/aidl/default/wifi_sta_iface.cpp create mode 100644 wifi/aidl/default/wifi_sta_iface.h rename wifi/{1.6 => aidl}/default/wifi_status_util.cpp (80%) rename wifi/{1.6 => aidl}/default/wifi_status_util.h (59%) create mode 100644 wifi/aidl/vts/functional/Android.bp create mode 100644 wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp create mode 100644 wifi/aidl/vts/functional/wifi_aidl_test_utils.h create mode 100644 wifi/aidl/vts/functional/wifi_ap_iface_aidl_test.cpp create mode 100644 wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp create mode 100644 wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp create mode 100644 wifi/aidl/vts/functional/wifi_rtt_controller_aidl_test.cpp create mode 100644 wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp diff --git a/wifi/1.6/default/android.hardware.wifi@1.0-service-lazy.rc b/wifi/1.6/default/android.hardware.wifi@1.0-service-lazy.rc deleted file mode 100644 index ee8c818d90..0000000000 --- a/wifi/1.6/default/android.hardware.wifi@1.0-service-lazy.rc +++ /dev/null @@ -1,14 +0,0 @@ -service vendor.wifi_hal_legacy /vendor/bin/hw/android.hardware.wifi@1.0-service-lazy - interface android.hardware.wifi@1.0::IWifi default - interface android.hardware.wifi@1.1::IWifi default - interface android.hardware.wifi@1.2::IWifi default - interface android.hardware.wifi@1.3::IWifi default - interface android.hardware.wifi@1.4::IWifi default - interface android.hardware.wifi@1.5::IWifi default - interface android.hardware.wifi@1.6::IWifi default - oneshot - disabled - class hal - capabilities NET_ADMIN NET_RAW SYS_MODULE - user wifi - group wifi gps diff --git a/wifi/1.6/default/android.hardware.wifi@1.0-service.rc b/wifi/1.6/default/android.hardware.wifi@1.0-service.rc deleted file mode 100644 index 18f40d0bb5..0000000000 --- a/wifi/1.6/default/android.hardware.wifi@1.0-service.rc +++ /dev/null @@ -1,12 +0,0 @@ -service vendor.wifi_hal_legacy /vendor/bin/hw/android.hardware.wifi@1.0-service - interface android.hardware.wifi@1.0::IWifi default - interface android.hardware.wifi@1.1::IWifi default - interface android.hardware.wifi@1.2::IWifi default - interface android.hardware.wifi@1.3::IWifi default - interface android.hardware.wifi@1.4::IWifi default - interface android.hardware.wifi@1.5::IWifi default - interface android.hardware.wifi@1.6::IWifi default - class hal - capabilities NET_ADMIN NET_RAW SYS_MODULE - user wifi - group wifi gps diff --git a/wifi/1.6/default/android.hardware.wifi@1.0-service.xml b/wifi/1.6/default/android.hardware.wifi@1.0-service.xml deleted file mode 100644 index 771fbaaf42..0000000000 --- a/wifi/1.6/default/android.hardware.wifi@1.0-service.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - android.hardware.wifi - hwbinder - 1.6 - - IWifi - default - - - diff --git a/wifi/1.6/default/hidl_callback_util.h b/wifi/1.6/default/hidl_callback_util.h deleted file mode 100644 index aab0ae5393..0000000000 --- a/wifi/1.6/default/hidl_callback_util.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (C) 2017 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. - */ - -#ifndef HIDL_CALLBACK_UTIL_H_ -#define HIDL_CALLBACK_UTIL_H_ - -#include - -#include -#include - -namespace { -// Type of callback invoked by the death handler. -using on_death_cb_function = std::function; - -// Private class used to keep track of death of individual -// callbacks stored in HidlCallbackHandler. -template -class HidlDeathHandler : public android::hardware::hidl_death_recipient { - public: - HidlDeathHandler(const on_death_cb_function& user_cb_function) - : cb_function_(user_cb_function) {} - ~HidlDeathHandler() = default; - - // Death notification for callbacks. - void serviceDied(uint64_t cookie, - const android::wp& /* who */) override { - cb_function_(cookie); - } - - private: - on_death_cb_function cb_function_; - - DISALLOW_COPY_AND_ASSIGN(HidlDeathHandler); -}; -} // namespace - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace hidl_callback_util { -template -// Provides a class to manage callbacks for the various HIDL interfaces and -// handle the death of the process hosting each callback. -class HidlCallbackHandler { - public: - HidlCallbackHandler() - : death_handler_(new HidlDeathHandler( - std::bind(&HidlCallbackHandler::onObjectDeath, this, std::placeholders::_1))) {} - ~HidlCallbackHandler() = default; - - bool addCallback(const sp& cb) { - // TODO(b/33818800): Can't compare proxies yet. So, use the cookie - // (callback proxy's raw pointer) to track the death of individual - // clients. - uint64_t cookie = reinterpret_cast(cb.get()); - for (const auto& s : cb_set_) { - if (interfacesEqual(cb, s)) { - LOG(ERROR) << "Duplicate death notification registration"; - return true; - } - } - if (!cb->linkToDeath(death_handler_, cookie)) { - LOG(ERROR) << "Failed to register death notification"; - return false; - } - cb_set_.insert(cb); - return true; - } - - const std::set>& getCallbacks() { return cb_set_; } - - // Death notification for callbacks. - void onObjectDeath(uint64_t cookie) { - CallbackType* cb = reinterpret_cast(cookie); - const auto& iter = cb_set_.find(cb); - if (iter == cb_set_.end()) { - LOG(ERROR) << "Unknown callback death notification received"; - return; - } - cb_set_.erase(iter); - LOG(DEBUG) << "Dead callback removed from list"; - } - - void invalidate() { - for (const sp& cb : cb_set_) { - if (!cb->unlinkToDeath(death_handler_)) { - LOG(ERROR) << "Failed to deregister death notification"; - } - } - cb_set_.clear(); - } - - private: - std::set> cb_set_; - sp> death_handler_; - - DISALLOW_COPY_AND_ASSIGN(HidlCallbackHandler); -}; - -} // namespace hidl_callback_util -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android -#endif // HIDL_CALLBACK_UTIL_H_ diff --git a/wifi/1.6/default/hidl_return_util.h b/wifi/1.6/default/hidl_return_util.h deleted file mode 100644 index a0efac2c57..0000000000 --- a/wifi/1.6/default/hidl_return_util.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef HIDL_RETURN_UTIL_H_ -#define HIDL_RETURN_UTIL_H_ - -#include "hidl_sync_util.h" -#include "wifi_status_util.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace hidl_return_util { -using namespace android::hardware::wifi::V1_0; - -/** - * These utility functions are used to invoke a method on the provided - * HIDL interface object. - * These functions checks if the provided HIDL interface object is valid. - * a) if valid, Invokes the corresponding internal implementation function of - * the HIDL method. It then invokes the HIDL continuation callback with - * the status and any returned values. - * b) if invalid, invokes the HIDL continuation callback with the - * provided error status and default values. - */ -// Use for HIDL methods which return only an instance of WifiStatus. -template -Return validateAndCall(ObjT* obj, WifiStatusCode status_code_if_invalid, WorkFuncT&& work, - const std::function& hidl_cb, - Args&&... args) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (obj->isValid()) { - hidl_cb((obj->*work)(std::forward(args)...)); - } else { - hidl_cb(createWifiStatus(status_code_if_invalid)); - } - return Void(); -} - -// Use for HIDL methods which return only an instance of WifiStatus. -// This version passes the global lock acquired to the body of the method. -// Note: Only used by IWifi::stop() currently. -template -Return validateAndCallWithLock(ObjT* obj, WifiStatusCode status_code_if_invalid, - WorkFuncT&& work, - const std::function& hidl_cb, - Args&&... args) { - auto lock = hidl_sync_util::acquireGlobalLock(); - if (obj->isValid()) { - hidl_cb((obj->*work)(&lock, std::forward(args)...)); - } else { - hidl_cb(createWifiStatus(status_code_if_invalid)); - } - return Void(); -} - -// Use for HIDL methods which return instance of WifiStatus and a single return -// value. -template -Return validateAndCall(ObjT* obj, WifiStatusCode status_code_if_invalid, WorkFuncT&& work, - const std::function& hidl_cb, - Args&&... args) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (obj->isValid()) { - const auto& ret_pair = (obj->*work)(std::forward(args)...); - const WifiStatus& status = std::get<0>(ret_pair); - const auto& ret_value = std::get<1>(ret_pair); - hidl_cb(status, ret_value); - } else { - hidl_cb(createWifiStatus(status_code_if_invalid), - typename std::remove_reference::type()); - } - return Void(); -} - -// Use for HIDL methods which return instance of WifiStatus and 2 return -// values. -template -Return validateAndCall( - ObjT* obj, WifiStatusCode status_code_if_invalid, WorkFuncT&& work, - const std::function& hidl_cb, Args&&... args) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (obj->isValid()) { - const auto& ret_tuple = (obj->*work)(std::forward(args)...); - const WifiStatus& status = std::get<0>(ret_tuple); - const auto& ret_value1 = std::get<1>(ret_tuple); - const auto& ret_value2 = std::get<2>(ret_tuple); - hidl_cb(status, ret_value1, ret_value2); - } else { - hidl_cb(createWifiStatus(status_code_if_invalid), - typename std::remove_reference::type(), - typename std::remove_reference::type()); - } - return Void(); -} - -} // namespace hidl_return_util -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android -#endif // HIDL_RETURN_UTIL_H_ diff --git a/wifi/1.6/default/hidl_struct_util.cpp b/wifi/1.6/default/hidl_struct_util.cpp deleted file mode 100644 index 2112b260f3..0000000000 --- a/wifi/1.6/default/hidl_struct_util.cpp +++ /dev/null @@ -1,3007 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#include -#include - -#include "hidl_struct_util.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace hidl_struct_util { - -using V1_6::NanConfigRequestSupplemental; - -WifiChannelWidthInMhz convertLegacyWifiChannelWidthToHidl(legacy_hal::wifi_channel_width type); - -hidl_string safeConvertChar(const char* str, size_t max_len) { - const char* c = str; - size_t size = 0; - while (*c && (unsigned char)*c < 128 && size < max_len) { - ++size; - ++c; - } - return hidl_string(str, size); -} - -IWifiChip::ChipCapabilityMask convertLegacyLoggerFeatureToHidlChipCapability(uint32_t feature) { - using HidlChipCaps = IWifiChip::ChipCapabilityMask; - switch (feature) { - case legacy_hal::WIFI_LOGGER_MEMORY_DUMP_SUPPORTED: - return HidlChipCaps::DEBUG_MEMORY_FIRMWARE_DUMP; - case legacy_hal::WIFI_LOGGER_DRIVER_DUMP_SUPPORTED: - return HidlChipCaps::DEBUG_MEMORY_DRIVER_DUMP; - case legacy_hal::WIFI_LOGGER_CONNECT_EVENT_SUPPORTED: - return HidlChipCaps::DEBUG_RING_BUFFER_CONNECT_EVENT; - case legacy_hal::WIFI_LOGGER_POWER_EVENT_SUPPORTED: - return HidlChipCaps::DEBUG_RING_BUFFER_POWER_EVENT; - case legacy_hal::WIFI_LOGGER_WAKE_LOCK_SUPPORTED: - return HidlChipCaps::DEBUG_RING_BUFFER_WAKELOCK_EVENT; - }; - CHECK(false) << "Unknown legacy feature: " << feature; - return {}; -} - -IWifiStaIface::StaIfaceCapabilityMask convertLegacyLoggerFeatureToHidlStaIfaceCapability( - uint32_t feature) { - using HidlStaIfaceCaps = IWifiStaIface::StaIfaceCapabilityMask; - switch (feature) { - case legacy_hal::WIFI_LOGGER_PACKET_FATE_SUPPORTED: - return HidlStaIfaceCaps::DEBUG_PACKET_FATE; - }; - CHECK(false) << "Unknown legacy feature: " << feature; - return {}; -} - -V1_5::IWifiChip::ChipCapabilityMask convertLegacyFeatureToHidlChipCapability(uint64_t feature) { - using HidlChipCaps = V1_5::IWifiChip::ChipCapabilityMask; - switch (feature) { - case WIFI_FEATURE_SET_TX_POWER_LIMIT: - return HidlChipCaps::SET_TX_POWER_LIMIT; - case WIFI_FEATURE_USE_BODY_HEAD_SAR: - return HidlChipCaps::USE_BODY_HEAD_SAR; - case WIFI_FEATURE_D2D_RTT: - return HidlChipCaps::D2D_RTT; - case WIFI_FEATURE_D2AP_RTT: - return HidlChipCaps::D2AP_RTT; - case WIFI_FEATURE_INFRA_60G: - return HidlChipCaps::WIGIG; - case WIFI_FEATURE_SET_LATENCY_MODE: - return HidlChipCaps::SET_LATENCY_MODE; - case WIFI_FEATURE_P2P_RAND_MAC: - return HidlChipCaps::P2P_RAND_MAC; - }; - CHECK(false) << "Unknown legacy feature: " << feature; - return {}; -} - -IWifiStaIface::StaIfaceCapabilityMask convertLegacyFeatureToHidlStaIfaceCapability( - uint64_t feature) { - using HidlStaIfaceCaps = IWifiStaIface::StaIfaceCapabilityMask; - switch (feature) { - case WIFI_FEATURE_GSCAN: - return HidlStaIfaceCaps::BACKGROUND_SCAN; - case WIFI_FEATURE_LINK_LAYER_STATS: - return HidlStaIfaceCaps::LINK_LAYER_STATS; - case WIFI_FEATURE_RSSI_MONITOR: - return HidlStaIfaceCaps::RSSI_MONITOR; - case WIFI_FEATURE_CONTROL_ROAMING: - return HidlStaIfaceCaps::CONTROL_ROAMING; - case WIFI_FEATURE_IE_WHITELIST: - return HidlStaIfaceCaps::PROBE_IE_WHITELIST; - case WIFI_FEATURE_SCAN_RAND: - return HidlStaIfaceCaps::SCAN_RAND; - case WIFI_FEATURE_INFRA_5G: - return HidlStaIfaceCaps::STA_5G; - case WIFI_FEATURE_HOTSPOT: - return HidlStaIfaceCaps::HOTSPOT; - case WIFI_FEATURE_PNO: - return HidlStaIfaceCaps::PNO; - case WIFI_FEATURE_TDLS: - return HidlStaIfaceCaps::TDLS; - case WIFI_FEATURE_TDLS_OFFCHANNEL: - return HidlStaIfaceCaps::TDLS_OFFCHANNEL; - case WIFI_FEATURE_CONFIG_NDO: - return HidlStaIfaceCaps::ND_OFFLOAD; - case WIFI_FEATURE_MKEEP_ALIVE: - return HidlStaIfaceCaps::KEEP_ALIVE; - }; - CHECK(false) << "Unknown legacy feature: " << feature; - return {}; -} - -bool convertLegacyFeaturesToHidlChipCapabilities(uint64_t legacy_feature_set, - uint32_t legacy_logger_feature_set, - uint32_t* hidl_caps) { - if (!hidl_caps) { - return false; - } - *hidl_caps = {}; - using HidlChipCaps = IWifiChip::ChipCapabilityMask; - for (const auto feature : {legacy_hal::WIFI_LOGGER_MEMORY_DUMP_SUPPORTED, - legacy_hal::WIFI_LOGGER_DRIVER_DUMP_SUPPORTED, - legacy_hal::WIFI_LOGGER_CONNECT_EVENT_SUPPORTED, - legacy_hal::WIFI_LOGGER_POWER_EVENT_SUPPORTED, - legacy_hal::WIFI_LOGGER_WAKE_LOCK_SUPPORTED}) { - if (feature & legacy_logger_feature_set) { - *hidl_caps |= convertLegacyLoggerFeatureToHidlChipCapability(feature); - } - } - std::vector features = {WIFI_FEATURE_SET_TX_POWER_LIMIT, - WIFI_FEATURE_USE_BODY_HEAD_SAR, - WIFI_FEATURE_D2D_RTT, - WIFI_FEATURE_D2AP_RTT, - WIFI_FEATURE_INFRA_60G, - WIFI_FEATURE_SET_LATENCY_MODE, - WIFI_FEATURE_P2P_RAND_MAC}; - for (const auto feature : features) { - if (feature & legacy_feature_set) { - *hidl_caps |= convertLegacyFeatureToHidlChipCapability(feature); - } - } - - // There are no flags for these 3 in the legacy feature set. Adding them to - // the set because all the current devices support it. - *hidl_caps |= HidlChipCaps::DEBUG_RING_BUFFER_VENDOR_DATA; - *hidl_caps |= HidlChipCaps::DEBUG_HOST_WAKE_REASON_STATS; - *hidl_caps |= HidlChipCaps::DEBUG_ERROR_ALERTS; - return true; -} - -WifiDebugRingBufferFlags convertLegacyDebugRingBufferFlagsToHidl(uint32_t flag) { - switch (flag) { - case WIFI_RING_BUFFER_FLAG_HAS_BINARY_ENTRIES: - return WifiDebugRingBufferFlags::HAS_BINARY_ENTRIES; - case WIFI_RING_BUFFER_FLAG_HAS_ASCII_ENTRIES: - return WifiDebugRingBufferFlags::HAS_ASCII_ENTRIES; - }; - CHECK(false) << "Unknown legacy flag: " << flag; - return {}; -} - -bool convertLegacyDebugRingBufferStatusToHidl( - const legacy_hal::wifi_ring_buffer_status& legacy_status, - WifiDebugRingBufferStatus* hidl_status) { - if (!hidl_status) { - return false; - } - *hidl_status = {}; - hidl_status->ringName = safeConvertChar(reinterpret_cast(legacy_status.name), - sizeof(legacy_status.name)); - hidl_status->flags = 0; - for (const auto flag : - {WIFI_RING_BUFFER_FLAG_HAS_BINARY_ENTRIES, WIFI_RING_BUFFER_FLAG_HAS_ASCII_ENTRIES}) { - if (flag & legacy_status.flags) { - hidl_status->flags |= static_cast::type>( - convertLegacyDebugRingBufferFlagsToHidl(flag)); - } - } - hidl_status->ringId = legacy_status.ring_id; - hidl_status->sizeInBytes = legacy_status.ring_buffer_byte_size; - // Calculate free size of the ring the buffer. We don't need to send the - // exact read/write pointers that were there in the legacy HAL interface. - if (legacy_status.written_bytes >= legacy_status.read_bytes) { - hidl_status->freeSizeInBytes = legacy_status.ring_buffer_byte_size - - (legacy_status.written_bytes - legacy_status.read_bytes); - } else { - hidl_status->freeSizeInBytes = legacy_status.read_bytes - legacy_status.written_bytes; - } - hidl_status->verboseLevel = legacy_status.verbose_level; - return true; -} - -bool convertLegacyVectorOfDebugRingBufferStatusToHidl( - const std::vector& legacy_status_vec, - std::vector* hidl_status_vec) { - if (!hidl_status_vec) { - return false; - } - *hidl_status_vec = {}; - for (const auto& legacy_status : legacy_status_vec) { - WifiDebugRingBufferStatus hidl_status; - if (!convertLegacyDebugRingBufferStatusToHidl(legacy_status, &hidl_status)) { - return false; - } - hidl_status_vec->push_back(hidl_status); - } - return true; -} - -bool convertLegacyWakeReasonStatsToHidl(const legacy_hal::WakeReasonStats& legacy_stats, - WifiDebugHostWakeReasonStats* hidl_stats) { - if (!hidl_stats) { - return false; - } - *hidl_stats = {}; - hidl_stats->totalCmdEventWakeCnt = legacy_stats.wake_reason_cnt.total_cmd_event_wake; - hidl_stats->cmdEventWakeCntPerType = legacy_stats.cmd_event_wake_cnt; - hidl_stats->totalDriverFwLocalWakeCnt = legacy_stats.wake_reason_cnt.total_driver_fw_local_wake; - hidl_stats->driverFwLocalWakeCntPerType = legacy_stats.driver_fw_local_wake_cnt; - hidl_stats->totalRxPacketWakeCnt = legacy_stats.wake_reason_cnt.total_rx_data_wake; - hidl_stats->rxPktWakeDetails.rxUnicastCnt = - legacy_stats.wake_reason_cnt.rx_wake_details.rx_unicast_cnt; - hidl_stats->rxPktWakeDetails.rxMulticastCnt = - legacy_stats.wake_reason_cnt.rx_wake_details.rx_multicast_cnt; - hidl_stats->rxPktWakeDetails.rxBroadcastCnt = - legacy_stats.wake_reason_cnt.rx_wake_details.rx_broadcast_cnt; - hidl_stats->rxMulticastPkWakeDetails.ipv4RxMulticastAddrCnt = - legacy_stats.wake_reason_cnt.rx_multicast_wake_pkt_info.ipv4_rx_multicast_addr_cnt; - hidl_stats->rxMulticastPkWakeDetails.ipv6RxMulticastAddrCnt = - legacy_stats.wake_reason_cnt.rx_multicast_wake_pkt_info.ipv6_rx_multicast_addr_cnt; - hidl_stats->rxMulticastPkWakeDetails.otherRxMulticastAddrCnt = - legacy_stats.wake_reason_cnt.rx_multicast_wake_pkt_info.other_rx_multicast_addr_cnt; - hidl_stats->rxIcmpPkWakeDetails.icmpPkt = - legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp_pkt; - hidl_stats->rxIcmpPkWakeDetails.icmp6Pkt = - legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_pkt; - hidl_stats->rxIcmpPkWakeDetails.icmp6Ra = - legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_ra; - hidl_stats->rxIcmpPkWakeDetails.icmp6Na = - legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_na; - hidl_stats->rxIcmpPkWakeDetails.icmp6Ns = - legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_ns; - return true; -} - -legacy_hal::wifi_power_scenario convertHidlTxPowerScenarioToLegacy( - V1_1::IWifiChip::TxPowerScenario hidl_scenario) { - switch (hidl_scenario) { - // This is the only supported scenario for V1_1 - case V1_1::IWifiChip::TxPowerScenario::VOICE_CALL: - return legacy_hal::WIFI_POWER_SCENARIO_VOICE_CALL; - }; - CHECK(false); -} - -legacy_hal::wifi_power_scenario convertHidlTxPowerScenarioToLegacy_1_2( - V1_2::IWifiChip::TxPowerScenario hidl_scenario) { - switch (hidl_scenario) { - // This is the only supported scenario for V1_1 - case V1_2::IWifiChip::TxPowerScenario::VOICE_CALL: - return legacy_hal::WIFI_POWER_SCENARIO_VOICE_CALL; - // Those are the supported scenarios for V1_2 - case V1_2::IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF: - return legacy_hal::WIFI_POWER_SCENARIO_ON_HEAD_CELL_OFF; - case V1_2::IWifiChip::TxPowerScenario::ON_HEAD_CELL_ON: - return legacy_hal::WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON; - case V1_2::IWifiChip::TxPowerScenario::ON_BODY_CELL_OFF: - return legacy_hal::WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF; - case V1_2::IWifiChip::TxPowerScenario::ON_BODY_CELL_ON: - return legacy_hal::WIFI_POWER_SCENARIO_ON_BODY_CELL_ON; - }; - CHECK(false); -} - -legacy_hal::wifi_latency_mode convertHidlLatencyModeToLegacy( - V1_3::IWifiChip::LatencyMode hidl_latency_mode) { - switch (hidl_latency_mode) { - case V1_3::IWifiChip::LatencyMode::NORMAL: - return legacy_hal::WIFI_LATENCY_MODE_NORMAL; - case V1_3::IWifiChip::LatencyMode::LOW: - return legacy_hal::WIFI_LATENCY_MODE_LOW; - } - CHECK(false); -} - -bool convertLegacyWifiMacInfoToHidl( - const legacy_hal::WifiMacInfo& legacy_mac_info, - V1_4::IWifiChipEventCallback::RadioModeInfo* hidl_radio_mode_info) { - if (!hidl_radio_mode_info) { - return false; - } - *hidl_radio_mode_info = {}; - - hidl_radio_mode_info->radioId = legacy_mac_info.wlan_mac_id; - // Convert from bitmask of bands in the legacy HAL to enum value in - // the HIDL interface. - if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND && - legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND && - legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND) { - hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_24GHZ_5GHZ_6GHZ; - } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND && - legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND) { - hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_5GHZ_6GHZ; - } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND) { - hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_6GHZ; - } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND && - legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND) { - hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_24GHZ_5GHZ; - } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND) { - hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_24GHZ; - } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND) { - hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_5GHZ; - } else { - hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_UNSPECIFIED; - } - std::vector iface_info_vec; - for (const auto& legacy_iface_info : legacy_mac_info.iface_infos) { - V1_2::IWifiChipEventCallback::IfaceInfo iface_info; - iface_info.name = legacy_iface_info.name; - iface_info.channel = legacy_iface_info.channel; - iface_info_vec.push_back(iface_info); - } - hidl_radio_mode_info->ifaceInfos = iface_info_vec; - return true; -} - -uint32_t convertHidlWifiBandToLegacyMacBand(V1_5::WifiBand hidl_band) { - switch (hidl_band) { - case V1_5::WifiBand::BAND_24GHZ: - return legacy_hal::WLAN_MAC_2_4_BAND; - case V1_5::WifiBand::BAND_5GHZ: - case V1_5::WifiBand::BAND_5GHZ_DFS: - case V1_5::WifiBand::BAND_5GHZ_WITH_DFS: - return legacy_hal::WLAN_MAC_5_0_BAND; - case V1_5::WifiBand::BAND_24GHZ_5GHZ: - case V1_5::WifiBand::BAND_24GHZ_5GHZ_WITH_DFS: - return (legacy_hal::WLAN_MAC_2_4_BAND | legacy_hal::WLAN_MAC_5_0_BAND); - case V1_5::WifiBand::BAND_6GHZ: - return legacy_hal::WLAN_MAC_6_0_BAND; - case V1_5::WifiBand::BAND_5GHZ_6GHZ: - return (legacy_hal::WLAN_MAC_5_0_BAND | legacy_hal::WLAN_MAC_6_0_BAND); - case V1_5::WifiBand::BAND_24GHZ_5GHZ_6GHZ: - case V1_5::WifiBand::BAND_24GHZ_5GHZ_WITH_DFS_6GHZ: - return (legacy_hal::WLAN_MAC_2_4_BAND | legacy_hal::WLAN_MAC_5_0_BAND | - legacy_hal::WLAN_MAC_6_0_BAND); - case V1_5::WifiBand::BAND_60GHZ: - return legacy_hal::WLAN_MAC_60_0_BAND; - default: - return (legacy_hal::WLAN_MAC_2_4_BAND | legacy_hal::WLAN_MAC_5_0_BAND | - legacy_hal::WLAN_MAC_6_0_BAND | legacy_hal::WLAN_MAC_60_0_BAND); - } -} - -V1_5::WifiBand convertLegacyMacBandToHidlWifiBand(uint32_t band) { - switch (band) { - case legacy_hal::WLAN_MAC_2_4_BAND: - return V1_5::WifiBand::BAND_24GHZ; - case legacy_hal::WLAN_MAC_5_0_BAND: - return V1_5::WifiBand::BAND_5GHZ; - case legacy_hal::WLAN_MAC_6_0_BAND: - return V1_5::WifiBand::BAND_6GHZ; - case legacy_hal::WLAN_MAC_60_0_BAND: - return V1_5::WifiBand::BAND_60GHZ; - default: - return V1_5::WifiBand::BAND_UNSPECIFIED; - } -} - -uint32_t convertHidlWifiIfaceModeToLegacy(uint32_t hidl_iface_mask) { - uint32_t legacy_iface_mask = 0; - if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_STA) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_STA); - } - if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_SOFTAP) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_SOFTAP); - } - if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_P2P_CLIENT) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_P2P_CLIENT); - } - if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_P2P_GO) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_P2P_GO); - } - if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_NAN) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_NAN); - } - if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_TDLS) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_TDLS); - } - if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_MESH) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_MESH); - } - if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_IBSS) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_IBSS); - } - return legacy_iface_mask; -} - -uint32_t convertLegacyWifiInterfaceModeToHidl(uint32_t legacy_iface_mask) { - uint32_t hidl_iface_mask = 0; - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_STA)) { - hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_STA; - } - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_SOFTAP)) { - hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_SOFTAP; - } - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_P2P_CLIENT)) { - hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_P2P_CLIENT; - } - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_P2P_GO)) { - hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_P2P_GO; - } - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_NAN)) { - hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_NAN; - } - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_TDLS)) { - hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_TDLS; - } - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_MESH)) { - hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_MESH; - } - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_IBSS)) { - hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_IBSS; - } - return hidl_iface_mask; -} - -uint32_t convertHidlUsableChannelFilterToLegacy(uint32_t hidl_filter_mask) { - uint32_t legacy_filter_mask = 0; - if (hidl_filter_mask & V1_5::IWifiChip::UsableChannelFilter::CELLULAR_COEXISTENCE) { - legacy_filter_mask |= legacy_hal::WIFI_USABLE_CHANNEL_FILTER_CELLULAR_COEXISTENCE; - } - if (hidl_filter_mask & V1_5::IWifiChip::UsableChannelFilter::CONCURRENCY) { - legacy_filter_mask |= legacy_hal::WIFI_USABLE_CHANNEL_FILTER_CONCURRENCY; - } - if (hidl_filter_mask & V1_6::IWifiChip::UsableChannelFilter::NAN_INSTANT_MODE) { - legacy_filter_mask |= WIFI_USABLE_CHANNEL_FILTER_NAN_INSTANT_MODE; - } - return legacy_filter_mask; -} - -bool convertLegacyWifiUsableChannelToHidl( - const legacy_hal::wifi_usable_channel& legacy_usable_channel, - V1_6::WifiUsableChannel* hidl_usable_channel) { - if (!hidl_usable_channel) { - return false; - } - *hidl_usable_channel = {}; - hidl_usable_channel->channel = legacy_usable_channel.freq; - hidl_usable_channel->channelBandwidth = - convertLegacyWifiChannelWidthToHidl(legacy_usable_channel.width); - hidl_usable_channel->ifaceModeMask = - convertLegacyWifiInterfaceModeToHidl(legacy_usable_channel.iface_mode_mask); - - return true; -} - -bool convertLegacyWifiUsableChannelsToHidl( - const std::vector& legacy_usable_channels, - std::vector* hidl_usable_channels) { - if (!hidl_usable_channels) { - return false; - } - *hidl_usable_channels = {}; - for (const auto& legacy_usable_channel : legacy_usable_channels) { - V1_6::WifiUsableChannel hidl_usable_channel; - if (!convertLegacyWifiUsableChannelToHidl(legacy_usable_channel, &hidl_usable_channel)) { - return false; - } - hidl_usable_channels->push_back(hidl_usable_channel); - } - return true; -} - -bool convertLegacyWifiMacInfosToHidl( - const std::vector& legacy_mac_infos, - std::vector* hidl_radio_mode_infos) { - if (!hidl_radio_mode_infos) { - return false; - } - *hidl_radio_mode_infos = {}; - - for (const auto& legacy_mac_info : legacy_mac_infos) { - V1_4::IWifiChipEventCallback::RadioModeInfo hidl_radio_mode_info; - if (!convertLegacyWifiMacInfoToHidl(legacy_mac_info, &hidl_radio_mode_info)) { - return false; - } - hidl_radio_mode_infos->push_back(hidl_radio_mode_info); - } - return true; -} - -bool convertLegacyFeaturesToHidlStaCapabilities(uint64_t legacy_feature_set, - uint32_t legacy_logger_feature_set, - uint32_t* hidl_caps) { - if (!hidl_caps) { - return false; - } - *hidl_caps = {}; - using HidlStaIfaceCaps = IWifiStaIface::StaIfaceCapabilityMask; - for (const auto feature : {legacy_hal::WIFI_LOGGER_PACKET_FATE_SUPPORTED}) { - if (feature & legacy_logger_feature_set) { - *hidl_caps |= convertLegacyLoggerFeatureToHidlStaIfaceCapability(feature); - } - } - for (const auto feature : - {WIFI_FEATURE_GSCAN, WIFI_FEATURE_LINK_LAYER_STATS, WIFI_FEATURE_RSSI_MONITOR, - WIFI_FEATURE_CONTROL_ROAMING, WIFI_FEATURE_IE_WHITELIST, WIFI_FEATURE_SCAN_RAND, - WIFI_FEATURE_INFRA_5G, WIFI_FEATURE_HOTSPOT, WIFI_FEATURE_PNO, WIFI_FEATURE_TDLS, - WIFI_FEATURE_TDLS_OFFCHANNEL, WIFI_FEATURE_CONFIG_NDO, WIFI_FEATURE_MKEEP_ALIVE}) { - if (feature & legacy_feature_set) { - *hidl_caps |= convertLegacyFeatureToHidlStaIfaceCapability(feature); - } - } - // There is no flag for this one in the legacy feature set. Adding it to the - // set because all the current devices support it. - *hidl_caps |= HidlStaIfaceCaps::APF; - return true; -} - -bool convertLegacyApfCapabilitiesToHidl(const legacy_hal::PacketFilterCapabilities& legacy_caps, - StaApfPacketFilterCapabilities* hidl_caps) { - if (!hidl_caps) { - return false; - } - *hidl_caps = {}; - hidl_caps->version = legacy_caps.version; - hidl_caps->maxLength = legacy_caps.max_len; - return true; -} - -uint8_t convertHidlGscanReportEventFlagToLegacy( - StaBackgroundScanBucketEventReportSchemeMask hidl_flag) { - using HidlFlag = StaBackgroundScanBucketEventReportSchemeMask; - switch (hidl_flag) { - case HidlFlag::EACH_SCAN: - return REPORT_EVENTS_EACH_SCAN; - case HidlFlag::FULL_RESULTS: - return REPORT_EVENTS_FULL_RESULTS; - case HidlFlag::NO_BATCH: - return REPORT_EVENTS_NO_BATCH; - }; - CHECK(false); -} - -StaScanDataFlagMask convertLegacyGscanDataFlagToHidl(uint8_t legacy_flag) { - switch (legacy_flag) { - case legacy_hal::WIFI_SCAN_FLAG_INTERRUPTED: - return StaScanDataFlagMask::INTERRUPTED; - }; - CHECK(false) << "Unknown legacy flag: " << legacy_flag; - // To silence the compiler warning about reaching the end of non-void - // function. - return {}; -} - -bool convertLegacyGscanCapabilitiesToHidl(const legacy_hal::wifi_gscan_capabilities& legacy_caps, - StaBackgroundScanCapabilities* hidl_caps) { - if (!hidl_caps) { - return false; - } - *hidl_caps = {}; - hidl_caps->maxCacheSize = legacy_caps.max_scan_cache_size; - hidl_caps->maxBuckets = legacy_caps.max_scan_buckets; - hidl_caps->maxApCachePerScan = legacy_caps.max_ap_cache_per_scan; - hidl_caps->maxReportingThreshold = legacy_caps.max_scan_reporting_threshold; - return true; -} - -legacy_hal::wifi_band convertHidlWifiBandToLegacy(V1_0::WifiBand band) { - switch (band) { - case V1_0::WifiBand::BAND_UNSPECIFIED: - return legacy_hal::WIFI_BAND_UNSPECIFIED; - case V1_0::WifiBand::BAND_24GHZ: - return legacy_hal::WIFI_BAND_BG; - case V1_0::WifiBand::BAND_5GHZ: - return legacy_hal::WIFI_BAND_A; - case V1_0::WifiBand::BAND_5GHZ_DFS: - return legacy_hal::WIFI_BAND_A_DFS; - case V1_0::WifiBand::BAND_5GHZ_WITH_DFS: - return legacy_hal::WIFI_BAND_A_WITH_DFS; - case V1_0::WifiBand::BAND_24GHZ_5GHZ: - return legacy_hal::WIFI_BAND_ABG; - case V1_0::WifiBand::BAND_24GHZ_5GHZ_WITH_DFS: - return legacy_hal::WIFI_BAND_ABG_WITH_DFS; - }; - CHECK(false); -} - -bool convertHidlGscanParamsToLegacy(const StaBackgroundScanParameters& hidl_scan_params, - legacy_hal::wifi_scan_cmd_params* legacy_scan_params) { - if (!legacy_scan_params) { - return false; - } - *legacy_scan_params = {}; - legacy_scan_params->base_period = hidl_scan_params.basePeriodInMs; - legacy_scan_params->max_ap_per_scan = hidl_scan_params.maxApPerScan; - legacy_scan_params->report_threshold_percent = hidl_scan_params.reportThresholdPercent; - legacy_scan_params->report_threshold_num_scans = hidl_scan_params.reportThresholdNumScans; - if (hidl_scan_params.buckets.size() > MAX_BUCKETS) { - return false; - } - legacy_scan_params->num_buckets = hidl_scan_params.buckets.size(); - for (uint32_t bucket_idx = 0; bucket_idx < hidl_scan_params.buckets.size(); bucket_idx++) { - const StaBackgroundScanBucketParameters& hidl_bucket_spec = - hidl_scan_params.buckets[bucket_idx]; - legacy_hal::wifi_scan_bucket_spec& legacy_bucket_spec = - legacy_scan_params->buckets[bucket_idx]; - if (hidl_bucket_spec.bucketIdx >= MAX_BUCKETS) { - return false; - } - legacy_bucket_spec.bucket = hidl_bucket_spec.bucketIdx; - legacy_bucket_spec.band = convertHidlWifiBandToLegacy(hidl_bucket_spec.band); - legacy_bucket_spec.period = hidl_bucket_spec.periodInMs; - legacy_bucket_spec.max_period = hidl_bucket_spec.exponentialMaxPeriodInMs; - legacy_bucket_spec.base = hidl_bucket_spec.exponentialBase; - legacy_bucket_spec.step_count = hidl_bucket_spec.exponentialStepCount; - legacy_bucket_spec.report_events = 0; - using HidlFlag = StaBackgroundScanBucketEventReportSchemeMask; - for (const auto flag : {HidlFlag::EACH_SCAN, HidlFlag::FULL_RESULTS, HidlFlag::NO_BATCH}) { - if (hidl_bucket_spec.eventReportScheme & - static_cast::type>(flag)) { - legacy_bucket_spec.report_events |= convertHidlGscanReportEventFlagToLegacy(flag); - } - } - if (hidl_bucket_spec.frequencies.size() > MAX_CHANNELS) { - return false; - } - legacy_bucket_spec.num_channels = hidl_bucket_spec.frequencies.size(); - for (uint32_t freq_idx = 0; freq_idx < hidl_bucket_spec.frequencies.size(); freq_idx++) { - legacy_bucket_spec.channels[freq_idx].channel = hidl_bucket_spec.frequencies[freq_idx]; - } - } - return true; -} - -bool convertLegacyIeToHidl(const legacy_hal::wifi_information_element& legacy_ie, - WifiInformationElement* hidl_ie) { - if (!hidl_ie) { - return false; - } - *hidl_ie = {}; - hidl_ie->id = legacy_ie.id; - hidl_ie->data = std::vector(legacy_ie.data, legacy_ie.data + legacy_ie.len); - return true; -} - -bool convertLegacyIeBlobToHidl(const uint8_t* ie_blob, uint32_t ie_blob_len, - std::vector* hidl_ies) { - if (!ie_blob || !hidl_ies) { - return false; - } - *hidl_ies = {}; - const uint8_t* ies_begin = ie_blob; - const uint8_t* ies_end = ie_blob + ie_blob_len; - const uint8_t* next_ie = ies_begin; - using wifi_ie = legacy_hal::wifi_information_element; - constexpr size_t kIeHeaderLen = sizeof(wifi_ie); - // Each IE should atleast have the header (i.e |id| & |len| fields). - while (next_ie + kIeHeaderLen <= ies_end) { - const wifi_ie& legacy_ie = (*reinterpret_cast(next_ie)); - uint32_t curr_ie_len = kIeHeaderLen + legacy_ie.len; - if (next_ie + curr_ie_len > ies_end) { - LOG(ERROR) << "Error parsing IE blob. Next IE: " << (void*)next_ie - << ", Curr IE len: " << curr_ie_len << ", IEs End: " << (void*)ies_end; - break; - } - WifiInformationElement hidl_ie; - if (!convertLegacyIeToHidl(legacy_ie, &hidl_ie)) { - LOG(ERROR) << "Error converting IE. Id: " << legacy_ie.id << ", len: " << legacy_ie.len; - break; - } - hidl_ies->push_back(std::move(hidl_ie)); - next_ie += curr_ie_len; - } - // Check if the blob has been fully consumed. - if (next_ie != ies_end) { - LOG(ERROR) << "Failed to fully parse IE blob. Next IE: " << (void*)next_ie - << ", IEs End: " << (void*)ies_end; - } - return true; -} - -bool convertLegacyGscanResultToHidl(const legacy_hal::wifi_scan_result& legacy_scan_result, - bool has_ie_data, StaScanResult* hidl_scan_result) { - if (!hidl_scan_result) { - return false; - } - *hidl_scan_result = {}; - hidl_scan_result->timeStampInUs = legacy_scan_result.ts; - hidl_scan_result->ssid = std::vector( - legacy_scan_result.ssid, - legacy_scan_result.ssid + - strnlen(legacy_scan_result.ssid, sizeof(legacy_scan_result.ssid) - 1)); - memcpy(hidl_scan_result->bssid.data(), legacy_scan_result.bssid, - hidl_scan_result->bssid.size()); - hidl_scan_result->frequency = legacy_scan_result.channel; - hidl_scan_result->rssi = legacy_scan_result.rssi; - hidl_scan_result->beaconPeriodInMs = legacy_scan_result.beacon_period; - hidl_scan_result->capability = legacy_scan_result.capability; - if (has_ie_data) { - std::vector ies; - if (!convertLegacyIeBlobToHidl(reinterpret_cast(legacy_scan_result.ie_data), - legacy_scan_result.ie_length, &ies)) { - return false; - } - hidl_scan_result->informationElements = std::move(ies); - } - return true; -} - -bool convertLegacyCachedGscanResultsToHidl( - const legacy_hal::wifi_cached_scan_results& legacy_cached_scan_result, - StaScanData* hidl_scan_data) { - if (!hidl_scan_data) { - return false; - } - *hidl_scan_data = {}; - hidl_scan_data->flags = 0; - for (const auto flag : {legacy_hal::WIFI_SCAN_FLAG_INTERRUPTED}) { - if (legacy_cached_scan_result.flags & flag) { - hidl_scan_data->flags |= static_cast::type>( - convertLegacyGscanDataFlagToHidl(flag)); - } - } - hidl_scan_data->bucketsScanned = legacy_cached_scan_result.buckets_scanned; - - CHECK(legacy_cached_scan_result.num_results >= 0 && - legacy_cached_scan_result.num_results <= MAX_AP_CACHE_PER_SCAN); - std::vector hidl_scan_results; - for (int32_t result_idx = 0; result_idx < legacy_cached_scan_result.num_results; result_idx++) { - StaScanResult hidl_scan_result; - if (!convertLegacyGscanResultToHidl(legacy_cached_scan_result.results[result_idx], false, - &hidl_scan_result)) { - return false; - } - hidl_scan_results.push_back(hidl_scan_result); - } - hidl_scan_data->results = std::move(hidl_scan_results); - return true; -} - -bool convertLegacyVectorOfCachedGscanResultsToHidl( - const std::vector& legacy_cached_scan_results, - std::vector* hidl_scan_datas) { - if (!hidl_scan_datas) { - return false; - } - *hidl_scan_datas = {}; - for (const auto& legacy_cached_scan_result : legacy_cached_scan_results) { - StaScanData hidl_scan_data; - if (!convertLegacyCachedGscanResultsToHidl(legacy_cached_scan_result, &hidl_scan_data)) { - return false; - } - hidl_scan_datas->push_back(hidl_scan_data); - } - return true; -} - -WifiDebugTxPacketFate convertLegacyDebugTxPacketFateToHidl(legacy_hal::wifi_tx_packet_fate fate) { - switch (fate) { - case legacy_hal::TX_PKT_FATE_ACKED: - return WifiDebugTxPacketFate::ACKED; - case legacy_hal::TX_PKT_FATE_SENT: - return WifiDebugTxPacketFate::SENT; - case legacy_hal::TX_PKT_FATE_FW_QUEUED: - return WifiDebugTxPacketFate::FW_QUEUED; - case legacy_hal::TX_PKT_FATE_FW_DROP_INVALID: - return WifiDebugTxPacketFate::FW_DROP_INVALID; - case legacy_hal::TX_PKT_FATE_FW_DROP_NOBUFS: - return WifiDebugTxPacketFate::FW_DROP_NOBUFS; - case legacy_hal::TX_PKT_FATE_FW_DROP_OTHER: - return WifiDebugTxPacketFate::FW_DROP_OTHER; - case legacy_hal::TX_PKT_FATE_DRV_QUEUED: - return WifiDebugTxPacketFate::DRV_QUEUED; - case legacy_hal::TX_PKT_FATE_DRV_DROP_INVALID: - return WifiDebugTxPacketFate::DRV_DROP_INVALID; - case legacy_hal::TX_PKT_FATE_DRV_DROP_NOBUFS: - return WifiDebugTxPacketFate::DRV_DROP_NOBUFS; - case legacy_hal::TX_PKT_FATE_DRV_DROP_OTHER: - return WifiDebugTxPacketFate::DRV_DROP_OTHER; - }; - CHECK(false) << "Unknown legacy fate type: " << fate; -} - -WifiDebugRxPacketFate convertLegacyDebugRxPacketFateToHidl(legacy_hal::wifi_rx_packet_fate fate) { - switch (fate) { - case legacy_hal::RX_PKT_FATE_SUCCESS: - return WifiDebugRxPacketFate::SUCCESS; - case legacy_hal::RX_PKT_FATE_FW_QUEUED: - return WifiDebugRxPacketFate::FW_QUEUED; - case legacy_hal::RX_PKT_FATE_FW_DROP_FILTER: - return WifiDebugRxPacketFate::FW_DROP_FILTER; - case legacy_hal::RX_PKT_FATE_FW_DROP_INVALID: - return WifiDebugRxPacketFate::FW_DROP_INVALID; - case legacy_hal::RX_PKT_FATE_FW_DROP_NOBUFS: - return WifiDebugRxPacketFate::FW_DROP_NOBUFS; - case legacy_hal::RX_PKT_FATE_FW_DROP_OTHER: - return WifiDebugRxPacketFate::FW_DROP_OTHER; - case legacy_hal::RX_PKT_FATE_DRV_QUEUED: - return WifiDebugRxPacketFate::DRV_QUEUED; - case legacy_hal::RX_PKT_FATE_DRV_DROP_FILTER: - return WifiDebugRxPacketFate::DRV_DROP_FILTER; - case legacy_hal::RX_PKT_FATE_DRV_DROP_INVALID: - return WifiDebugRxPacketFate::DRV_DROP_INVALID; - case legacy_hal::RX_PKT_FATE_DRV_DROP_NOBUFS: - return WifiDebugRxPacketFate::DRV_DROP_NOBUFS; - case legacy_hal::RX_PKT_FATE_DRV_DROP_OTHER: - return WifiDebugRxPacketFate::DRV_DROP_OTHER; - }; - CHECK(false) << "Unknown legacy fate type: " << fate; -} - -WifiDebugPacketFateFrameType convertLegacyDebugPacketFateFrameTypeToHidl( - legacy_hal::frame_type type) { - switch (type) { - case legacy_hal::FRAME_TYPE_UNKNOWN: - return WifiDebugPacketFateFrameType::UNKNOWN; - case legacy_hal::FRAME_TYPE_ETHERNET_II: - return WifiDebugPacketFateFrameType::ETHERNET_II; - case legacy_hal::FRAME_TYPE_80211_MGMT: - return WifiDebugPacketFateFrameType::MGMT_80211; - }; - CHECK(false) << "Unknown legacy frame type: " << type; -} - -bool convertLegacyDebugPacketFateFrameToHidl(const legacy_hal::frame_info& legacy_frame, - WifiDebugPacketFateFrameInfo* hidl_frame) { - if (!hidl_frame) { - return false; - } - *hidl_frame = {}; - hidl_frame->frameType = convertLegacyDebugPacketFateFrameTypeToHidl(legacy_frame.payload_type); - hidl_frame->frameLen = legacy_frame.frame_len; - hidl_frame->driverTimestampUsec = legacy_frame.driver_timestamp_usec; - hidl_frame->firmwareTimestampUsec = legacy_frame.firmware_timestamp_usec; - const uint8_t* frame_begin = - reinterpret_cast(legacy_frame.frame_content.ethernet_ii_bytes); - hidl_frame->frameContent = - std::vector(frame_begin, frame_begin + legacy_frame.frame_len); - return true; -} - -bool convertLegacyDebugTxPacketFateToHidl(const legacy_hal::wifi_tx_report& legacy_fate, - WifiDebugTxPacketFateReport* hidl_fate) { - if (!hidl_fate) { - return false; - } - *hidl_fate = {}; - hidl_fate->fate = convertLegacyDebugTxPacketFateToHidl(legacy_fate.fate); - return convertLegacyDebugPacketFateFrameToHidl(legacy_fate.frame_inf, &hidl_fate->frameInfo); -} - -bool convertLegacyVectorOfDebugTxPacketFateToHidl( - const std::vector& legacy_fates, - std::vector* hidl_fates) { - if (!hidl_fates) { - return false; - } - *hidl_fates = {}; - for (const auto& legacy_fate : legacy_fates) { - WifiDebugTxPacketFateReport hidl_fate; - if (!convertLegacyDebugTxPacketFateToHidl(legacy_fate, &hidl_fate)) { - return false; - } - hidl_fates->push_back(hidl_fate); - } - return true; -} - -bool convertLegacyDebugRxPacketFateToHidl(const legacy_hal::wifi_rx_report& legacy_fate, - WifiDebugRxPacketFateReport* hidl_fate) { - if (!hidl_fate) { - return false; - } - *hidl_fate = {}; - hidl_fate->fate = convertLegacyDebugRxPacketFateToHidl(legacy_fate.fate); - return convertLegacyDebugPacketFateFrameToHidl(legacy_fate.frame_inf, &hidl_fate->frameInfo); -} - -bool convertLegacyVectorOfDebugRxPacketFateToHidl( - const std::vector& legacy_fates, - std::vector* hidl_fates) { - if (!hidl_fates) { - return false; - } - *hidl_fates = {}; - for (const auto& legacy_fate : legacy_fates) { - WifiDebugRxPacketFateReport hidl_fate; - if (!convertLegacyDebugRxPacketFateToHidl(legacy_fate, &hidl_fate)) { - return false; - } - hidl_fates->push_back(hidl_fate); - } - return true; -} - -bool convertLegacyLinkLayerRadioStatsToHidl( - const legacy_hal::LinkLayerRadioStats& legacy_radio_stat, - V1_6::StaLinkLayerRadioStats* hidl_radio_stat) { - if (!hidl_radio_stat) { - return false; - } - *hidl_radio_stat = {}; - - hidl_radio_stat->radioId = legacy_radio_stat.stats.radio; - hidl_radio_stat->V1_0.onTimeInMs = legacy_radio_stat.stats.on_time; - hidl_radio_stat->V1_0.txTimeInMs = legacy_radio_stat.stats.tx_time; - hidl_radio_stat->V1_0.rxTimeInMs = legacy_radio_stat.stats.rx_time; - hidl_radio_stat->V1_0.onTimeInMsForScan = legacy_radio_stat.stats.on_time_scan; - hidl_radio_stat->V1_0.txTimeInMsPerLevel = legacy_radio_stat.tx_time_per_levels; - hidl_radio_stat->onTimeInMsForNanScan = legacy_radio_stat.stats.on_time_nbd; - hidl_radio_stat->onTimeInMsForBgScan = legacy_radio_stat.stats.on_time_gscan; - hidl_radio_stat->onTimeInMsForRoamScan = legacy_radio_stat.stats.on_time_roam_scan; - hidl_radio_stat->onTimeInMsForPnoScan = legacy_radio_stat.stats.on_time_pno_scan; - hidl_radio_stat->onTimeInMsForHs20Scan = legacy_radio_stat.stats.on_time_hs20; - - std::vector hidl_channel_stats; - - for (const auto& channel_stat : legacy_radio_stat.channel_stats) { - V1_6::WifiChannelStats hidl_channel_stat; - hidl_channel_stat.onTimeInMs = channel_stat.on_time; - hidl_channel_stat.ccaBusyTimeInMs = channel_stat.cca_busy_time; - /* - * TODO once b/119142899 is fixed, - * replace below code with convertLegacyWifiChannelInfoToHidl() - */ - hidl_channel_stat.channel.width = WifiChannelWidthInMhz::WIDTH_20; - hidl_channel_stat.channel.centerFreq = channel_stat.channel.center_freq; - hidl_channel_stat.channel.centerFreq0 = channel_stat.channel.center_freq0; - hidl_channel_stat.channel.centerFreq1 = channel_stat.channel.center_freq1; - hidl_channel_stats.push_back(hidl_channel_stat); - } - - hidl_radio_stat->channelStats = hidl_channel_stats; - - return true; -} - -bool convertLegacyLinkLayerStatsToHidl(const legacy_hal::LinkLayerStats& legacy_stats, - V1_6::StaLinkLayerStats* hidl_stats) { - if (!hidl_stats) { - return false; - } - *hidl_stats = {}; - // iface legacy_stats conversion. - hidl_stats->iface.V1_0.beaconRx = legacy_stats.iface.beacon_rx; - hidl_stats->iface.V1_0.avgRssiMgmt = legacy_stats.iface.rssi_mgmt; - hidl_stats->iface.V1_0.wmeBePktStats.rxMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].rx_mpdu; - hidl_stats->iface.V1_0.wmeBePktStats.txMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].tx_mpdu; - hidl_stats->iface.V1_0.wmeBePktStats.lostMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].mpdu_lost; - hidl_stats->iface.V1_0.wmeBePktStats.retries = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].retries; - hidl_stats->iface.wmeBeContentionTimeStats.contentionTimeMinInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_min; - hidl_stats->iface.wmeBeContentionTimeStats.contentionTimeMaxInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_max; - hidl_stats->iface.wmeBeContentionTimeStats.contentionTimeAvgInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_avg; - hidl_stats->iface.wmeBeContentionTimeStats.contentionNumSamples = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_num_samples; - hidl_stats->iface.V1_0.wmeBkPktStats.rxMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].rx_mpdu; - hidl_stats->iface.V1_0.wmeBkPktStats.txMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].tx_mpdu; - hidl_stats->iface.V1_0.wmeBkPktStats.lostMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].mpdu_lost; - hidl_stats->iface.V1_0.wmeBkPktStats.retries = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].retries; - hidl_stats->iface.wmeBkContentionTimeStats.contentionTimeMinInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_min; - hidl_stats->iface.wmeBkContentionTimeStats.contentionTimeMaxInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_max; - hidl_stats->iface.wmeBkContentionTimeStats.contentionTimeAvgInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_avg; - hidl_stats->iface.wmeBkContentionTimeStats.contentionNumSamples = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_num_samples; - hidl_stats->iface.V1_0.wmeViPktStats.rxMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].rx_mpdu; - hidl_stats->iface.V1_0.wmeViPktStats.txMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].tx_mpdu; - hidl_stats->iface.V1_0.wmeViPktStats.lostMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].mpdu_lost; - hidl_stats->iface.V1_0.wmeViPktStats.retries = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].retries; - hidl_stats->iface.wmeViContentionTimeStats.contentionTimeMinInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_min; - hidl_stats->iface.wmeViContentionTimeStats.contentionTimeMaxInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_max; - hidl_stats->iface.wmeViContentionTimeStats.contentionTimeAvgInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_avg; - hidl_stats->iface.wmeViContentionTimeStats.contentionNumSamples = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_num_samples; - hidl_stats->iface.V1_0.wmeVoPktStats.rxMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].rx_mpdu; - hidl_stats->iface.V1_0.wmeVoPktStats.txMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].tx_mpdu; - hidl_stats->iface.V1_0.wmeVoPktStats.lostMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].mpdu_lost; - hidl_stats->iface.V1_0.wmeVoPktStats.retries = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].retries; - hidl_stats->iface.wmeVoContentionTimeStats.contentionTimeMinInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_min; - hidl_stats->iface.wmeVoContentionTimeStats.contentionTimeMaxInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_max; - hidl_stats->iface.wmeVoContentionTimeStats.contentionTimeAvgInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_avg; - hidl_stats->iface.wmeVoContentionTimeStats.contentionNumSamples = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_num_samples; - hidl_stats->iface.timeSliceDutyCycleInPercent = - legacy_stats.iface.info.time_slicing_duty_cycle_percent; - // peer info legacy_stats conversion. - std::vector hidl_peers_info_stats; - for (const auto& legacy_peer_info_stats : legacy_stats.peers) { - V1_6::StaPeerInfo hidl_peer_info_stats; - if (!convertLegacyPeerInfoStatsToHidl(legacy_peer_info_stats, &hidl_peer_info_stats)) { - return false; - } - hidl_peers_info_stats.push_back(hidl_peer_info_stats); - } - hidl_stats->iface.peers = hidl_peers_info_stats; - // radio legacy_stats conversion. - std::vector hidl_radios_stats; - for (const auto& legacy_radio_stats : legacy_stats.radios) { - V1_6::StaLinkLayerRadioStats hidl_radio_stats; - if (!convertLegacyLinkLayerRadioStatsToHidl(legacy_radio_stats, &hidl_radio_stats)) { - return false; - } - hidl_radios_stats.push_back(hidl_radio_stats); - } - hidl_stats->radios = hidl_radios_stats; - // Timestamp in the HAL wrapper here since it's not provided in the legacy - // HAL API. - hidl_stats->timeStampInMs = uptimeMillis(); - return true; -} - -bool convertLegacyPeerInfoStatsToHidl(const legacy_hal::WifiPeerInfo& legacy_peer_info_stats, - V1_6::StaPeerInfo* hidl_peer_info_stats) { - if (!hidl_peer_info_stats) { - return false; - } - *hidl_peer_info_stats = {}; - hidl_peer_info_stats->staCount = legacy_peer_info_stats.peer_info.bssload.sta_count; - hidl_peer_info_stats->chanUtil = legacy_peer_info_stats.peer_info.bssload.chan_util; - - std::vector hidlRateStats; - for (const auto& legacy_rate_stats : legacy_peer_info_stats.rate_stats) { - V1_6::StaRateStat rateStat; - if (!convertLegacyWifiRateInfoToHidl(legacy_rate_stats.rate, &rateStat.rateInfo)) { - return false; - } - rateStat.txMpdu = legacy_rate_stats.tx_mpdu; - rateStat.rxMpdu = legacy_rate_stats.rx_mpdu; - rateStat.mpduLost = legacy_rate_stats.mpdu_lost; - rateStat.retries = legacy_rate_stats.retries; - hidlRateStats.push_back(rateStat); - } - hidl_peer_info_stats->rateStats = hidlRateStats; - return true; -} - -bool convertLegacyRoamingCapabilitiesToHidl( - const legacy_hal::wifi_roaming_capabilities& legacy_caps, - StaRoamingCapabilities* hidl_caps) { - if (!hidl_caps) { - return false; - } - *hidl_caps = {}; - hidl_caps->maxBlacklistSize = legacy_caps.max_blacklist_size; - hidl_caps->maxWhitelistSize = legacy_caps.max_whitelist_size; - return true; -} - -bool convertHidlRoamingConfigToLegacy(const StaRoamingConfig& hidl_config, - legacy_hal::wifi_roaming_config* legacy_config) { - if (!legacy_config) { - return false; - } - *legacy_config = {}; - if (hidl_config.bssidBlacklist.size() > MAX_BLACKLIST_BSSID || - hidl_config.ssidWhitelist.size() > MAX_WHITELIST_SSID) { - return false; - } - legacy_config->num_blacklist_bssid = hidl_config.bssidBlacklist.size(); - uint32_t i = 0; - for (const auto& bssid : hidl_config.bssidBlacklist) { - CHECK(bssid.size() == sizeof(legacy_hal::mac_addr)); - memcpy(legacy_config->blacklist_bssid[i++], bssid.data(), bssid.size()); - } - legacy_config->num_whitelist_ssid = hidl_config.ssidWhitelist.size(); - i = 0; - for (const auto& ssid : hidl_config.ssidWhitelist) { - CHECK(ssid.size() <= sizeof(legacy_hal::ssid_t::ssid_str)); - legacy_config->whitelist_ssid[i].length = ssid.size(); - memcpy(legacy_config->whitelist_ssid[i].ssid_str, ssid.data(), ssid.size()); - i++; - } - return true; -} - -legacy_hal::fw_roaming_state_t convertHidlRoamingStateToLegacy(StaRoamingState state) { - switch (state) { - case StaRoamingState::ENABLED: - return legacy_hal::ROAMING_ENABLE; - case StaRoamingState::DISABLED: - return legacy_hal::ROAMING_DISABLE; - }; - CHECK(false); -} - -legacy_hal::NanMatchAlg convertHidlNanMatchAlgToLegacy(NanMatchAlg type) { - switch (type) { - case NanMatchAlg::MATCH_ONCE: - return legacy_hal::NAN_MATCH_ALG_MATCH_ONCE; - case NanMatchAlg::MATCH_CONTINUOUS: - return legacy_hal::NAN_MATCH_ALG_MATCH_CONTINUOUS; - case NanMatchAlg::MATCH_NEVER: - return legacy_hal::NAN_MATCH_ALG_MATCH_NEVER; - } - CHECK(false); -} - -legacy_hal::NanPublishType convertHidlNanPublishTypeToLegacy(NanPublishType type) { - switch (type) { - case NanPublishType::UNSOLICITED: - return legacy_hal::NAN_PUBLISH_TYPE_UNSOLICITED; - case NanPublishType::SOLICITED: - return legacy_hal::NAN_PUBLISH_TYPE_SOLICITED; - case NanPublishType::UNSOLICITED_SOLICITED: - return legacy_hal::NAN_PUBLISH_TYPE_UNSOLICITED_SOLICITED; - } - CHECK(false); -} - -legacy_hal::NanTxType convertHidlNanTxTypeToLegacy(NanTxType type) { - switch (type) { - case NanTxType::BROADCAST: - return legacy_hal::NAN_TX_TYPE_BROADCAST; - case NanTxType::UNICAST: - return legacy_hal::NAN_TX_TYPE_UNICAST; - } - CHECK(false); -} - -legacy_hal::NanSubscribeType convertHidlNanSubscribeTypeToLegacy(NanSubscribeType type) { - switch (type) { - case NanSubscribeType::PASSIVE: - return legacy_hal::NAN_SUBSCRIBE_TYPE_PASSIVE; - case NanSubscribeType::ACTIVE: - return legacy_hal::NAN_SUBSCRIBE_TYPE_ACTIVE; - } - CHECK(false); -} - -legacy_hal::NanSRFType convertHidlNanSrfTypeToLegacy(NanSrfType type) { - switch (type) { - case NanSrfType::BLOOM_FILTER: - return legacy_hal::NAN_SRF_ATTR_BLOOM_FILTER; - case NanSrfType::PARTIAL_MAC_ADDR: - return legacy_hal::NAN_SRF_ATTR_PARTIAL_MAC_ADDR; - } - CHECK(false); -} - -legacy_hal::NanDataPathChannelCfg convertHidlNanDataPathChannelCfgToLegacy( - NanDataPathChannelCfg type) { - switch (type) { - case NanDataPathChannelCfg::CHANNEL_NOT_REQUESTED: - return legacy_hal::NAN_DP_CHANNEL_NOT_REQUESTED; - case NanDataPathChannelCfg::REQUEST_CHANNEL_SETUP: - return legacy_hal::NAN_DP_REQUEST_CHANNEL_SETUP; - case NanDataPathChannelCfg::FORCE_CHANNEL_SETUP: - return legacy_hal::NAN_DP_FORCE_CHANNEL_SETUP; - } - CHECK(false); -} - -NanStatusType convertLegacyNanStatusTypeToHidl(legacy_hal::NanStatusType type) { - switch (type) { - case legacy_hal::NAN_STATUS_SUCCESS: - return NanStatusType::SUCCESS; - case legacy_hal::NAN_STATUS_INTERNAL_FAILURE: - return NanStatusType::INTERNAL_FAILURE; - case legacy_hal::NAN_STATUS_PROTOCOL_FAILURE: - return NanStatusType::PROTOCOL_FAILURE; - case legacy_hal::NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID: - return NanStatusType::INVALID_SESSION_ID; - case legacy_hal::NAN_STATUS_NO_RESOURCE_AVAILABLE: - return NanStatusType::NO_RESOURCES_AVAILABLE; - case legacy_hal::NAN_STATUS_INVALID_PARAM: - return NanStatusType::INVALID_ARGS; - case legacy_hal::NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID: - return NanStatusType::INVALID_PEER_ID; - case legacy_hal::NAN_STATUS_INVALID_NDP_ID: - return NanStatusType::INVALID_NDP_ID; - case legacy_hal::NAN_STATUS_NAN_NOT_ALLOWED: - return NanStatusType::NAN_NOT_ALLOWED; - case legacy_hal::NAN_STATUS_NO_OTA_ACK: - return NanStatusType::NO_OTA_ACK; - case legacy_hal::NAN_STATUS_ALREADY_ENABLED: - return NanStatusType::ALREADY_ENABLED; - case legacy_hal::NAN_STATUS_FOLLOWUP_QUEUE_FULL: - return NanStatusType::FOLLOWUP_TX_QUEUE_FULL; - case legacy_hal::NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED: - return NanStatusType::UNSUPPORTED_CONCURRENCY_NAN_DISABLED; - } - CHECK(false); -} - -void convertToWifiNanStatus(legacy_hal::NanStatusType type, const char* str, size_t max_len, - WifiNanStatus* wifiNanStatus) { - wifiNanStatus->status = convertLegacyNanStatusTypeToHidl(type); - wifiNanStatus->description = safeConvertChar(str, max_len); -} - -bool convertHidlNanEnableRequestToLegacy(const V1_4::NanEnableRequest& hidl_request, - legacy_hal::NanEnableRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertHidlNanEnableRequestToLegacy: null legacy_request"; - return false; - } - *legacy_request = {}; - - legacy_request->config_2dot4g_support = 1; - legacy_request->support_2dot4g_val = - hidl_request.operateInBand[(size_t)NanBandIndex::NAN_BAND_24GHZ]; - legacy_request->config_support_5g = 1; - legacy_request->support_5g_val = - hidl_request.operateInBand[(size_t)NanBandIndex::NAN_BAND_5GHZ]; - legacy_request->config_hop_count_limit = 1; - legacy_request->hop_count_limit_val = hidl_request.hopCountMax; - legacy_request->master_pref = hidl_request.configParams.masterPref; - legacy_request->discovery_indication_cfg = 0; - legacy_request->discovery_indication_cfg |= - hidl_request.configParams.disableDiscoveryAddressChangeIndication ? 0x1 : 0x0; - legacy_request->discovery_indication_cfg |= - hidl_request.configParams.disableStartedClusterIndication ? 0x2 : 0x0; - legacy_request->discovery_indication_cfg |= - hidl_request.configParams.disableJoinedClusterIndication ? 0x4 : 0x0; - legacy_request->config_sid_beacon = 1; - if (hidl_request.configParams.numberOfPublishServiceIdsInBeacon > 127) { - LOG(ERROR) << "convertHidlNanEnableRequestToLegacy: " - "numberOfPublishServiceIdsInBeacon > 127"; - return false; - } - legacy_request->sid_beacon_val = - (hidl_request.configParams.includePublishServiceIdsInBeacon ? 0x1 : 0x0) | - (hidl_request.configParams.numberOfPublishServiceIdsInBeacon << 1); - legacy_request->config_subscribe_sid_beacon = 1; - if (hidl_request.configParams.numberOfSubscribeServiceIdsInBeacon > 127) { - LOG(ERROR) << "convertHidlNanEnableRequestToLegacy: " - "numberOfSubscribeServiceIdsInBeacon > 127"; - return false; - } - legacy_request->subscribe_sid_beacon_val = - (hidl_request.configParams.includeSubscribeServiceIdsInBeacon ? 0x1 : 0x0) | - (hidl_request.configParams.numberOfSubscribeServiceIdsInBeacon << 1); - legacy_request->config_rssi_window_size = 1; - legacy_request->rssi_window_size_val = hidl_request.configParams.rssiWindowSize; - legacy_request->config_disc_mac_addr_randomization = 1; - legacy_request->disc_mac_addr_rand_interval_sec = - hidl_request.configParams.macAddressRandomizationIntervalSec; - legacy_request->config_2dot4g_rssi_close = 1; - if (hidl_request.configParams.bandSpecificConfig.size() != 3) { - LOG(ERROR) << "convertHidlNanEnableRequestToLegacy: " - "bandSpecificConfig.size() != 3"; - return false; - } - legacy_request->rssi_close_2dot4g_val = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .rssiClose; - legacy_request->config_2dot4g_rssi_middle = 1; - legacy_request->rssi_middle_2dot4g_val = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .rssiMiddle; - legacy_request->config_2dot4g_rssi_proximity = 1; - legacy_request->rssi_proximity_2dot4g_val = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .rssiCloseProximity; - legacy_request->config_scan_params = 1; - legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_24G_BAND] = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .dwellTimeMs; - legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_24G_BAND] = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .scanPeriodSec; - legacy_request->config_dw.config_2dot4g_dw_band = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .validDiscoveryWindowIntervalVal; - legacy_request->config_dw.dw_2dot4g_interval_val = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .discoveryWindowIntervalVal; - legacy_request->config_5g_rssi_close = 1; - legacy_request->rssi_close_5g_val = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .rssiClose; - legacy_request->config_5g_rssi_middle = 1; - legacy_request->rssi_middle_5g_val = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .rssiMiddle; - legacy_request->config_5g_rssi_close_proximity = 1; - legacy_request->rssi_close_proximity_5g_val = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .rssiCloseProximity; - legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .dwellTimeMs; - legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .scanPeriodSec; - legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .dwellTimeMs; - legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .scanPeriodSec; - legacy_request->config_dw.config_5g_dw_band = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .validDiscoveryWindowIntervalVal; - legacy_request->config_dw.dw_5g_interval_val = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .discoveryWindowIntervalVal; - if (hidl_request.debugConfigs.validClusterIdVals) { - legacy_request->cluster_low = hidl_request.debugConfigs.clusterIdBottomRangeVal; - legacy_request->cluster_high = hidl_request.debugConfigs.clusterIdTopRangeVal; - } else { // need 'else' since not configurable in legacy HAL - legacy_request->cluster_low = 0x0000; - legacy_request->cluster_high = 0xFFFF; - } - legacy_request->config_intf_addr = hidl_request.debugConfigs.validIntfAddrVal; - memcpy(legacy_request->intf_addr_val, hidl_request.debugConfigs.intfAddrVal.data(), 6); - legacy_request->config_oui = hidl_request.debugConfigs.validOuiVal; - legacy_request->oui_val = hidl_request.debugConfigs.ouiVal; - legacy_request->config_random_factor_force = - hidl_request.debugConfigs.validRandomFactorForceVal; - legacy_request->random_factor_force_val = hidl_request.debugConfigs.randomFactorForceVal; - legacy_request->config_hop_count_force = hidl_request.debugConfigs.validHopCountForceVal; - legacy_request->hop_count_force_val = hidl_request.debugConfigs.hopCountForceVal; - legacy_request->config_24g_channel = hidl_request.debugConfigs.validDiscoveryChannelVal; - legacy_request->channel_24g_val = - hidl_request.debugConfigs.discoveryChannelMhzVal[(size_t)NanBandIndex::NAN_BAND_24GHZ]; - legacy_request->config_5g_channel = hidl_request.debugConfigs.validDiscoveryChannelVal; - legacy_request->channel_5g_val = - hidl_request.debugConfigs.discoveryChannelMhzVal[(size_t)NanBandIndex::NAN_BAND_5GHZ]; - legacy_request->config_2dot4g_beacons = hidl_request.debugConfigs.validUseBeaconsInBandVal; - legacy_request->beacon_2dot4g_val = - hidl_request.debugConfigs.useBeaconsInBandVal[(size_t)NanBandIndex::NAN_BAND_24GHZ]; - legacy_request->config_5g_beacons = hidl_request.debugConfigs.validUseBeaconsInBandVal; - legacy_request->beacon_5g_val = - hidl_request.debugConfigs.useBeaconsInBandVal[(size_t)NanBandIndex::NAN_BAND_5GHZ]; - legacy_request->config_2dot4g_sdf = hidl_request.debugConfigs.validUseSdfInBandVal; - legacy_request->sdf_2dot4g_val = - hidl_request.debugConfigs.useSdfInBandVal[(size_t)NanBandIndex::NAN_BAND_24GHZ]; - legacy_request->config_5g_sdf = hidl_request.debugConfigs.validUseSdfInBandVal; - legacy_request->sdf_5g_val = - hidl_request.debugConfigs.useSdfInBandVal[(size_t)NanBandIndex::NAN_BAND_5GHZ]; - - /* TODO: b/145609058 - * Missing updates needed to legacy_hal::NanEnableRequest and conversion to - * it for 6GHz band */ - - return true; -} - -bool convertHidlNanEnableRequest_1_6ToLegacy(const V1_4::NanEnableRequest& hidl_request1, - const NanConfigRequestSupplemental& hidl_request2, - legacy_hal::NanEnableRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertHidlNanEnableRequest_1_6ToLegacy: null legacy_request"; - return false; - } - - *legacy_request = {}; - if (!convertHidlNanEnableRequestToLegacy(hidl_request1, legacy_request)) { - return false; - } - - legacy_request->config_discovery_beacon_int = 1; - legacy_request->discovery_beacon_interval = hidl_request2.V1_5.V1_2.discoveryBeaconIntervalMs; - legacy_request->config_nss = 1; - legacy_request->nss = hidl_request2.V1_5.V1_2.numberOfSpatialStreamsInDiscovery; - legacy_request->config_dw_early_termination = 1; - legacy_request->enable_dw_termination = - hidl_request2.V1_5.V1_2.enableDiscoveryWindowEarlyTermination; - legacy_request->config_enable_ranging = 1; - legacy_request->enable_ranging = hidl_request2.V1_5.V1_2.enableRanging; - - legacy_request->config_enable_instant_mode = 1; - legacy_request->enable_instant_mode = hidl_request2.V1_5.enableInstantCommunicationMode; - legacy_request->config_instant_mode_channel = 1; - legacy_request->instant_mode_channel = hidl_request2.instantModeChannel; - - return true; -} - -bool convertHidlNanConfigRequest_1_6ToLegacy(const V1_4::NanConfigRequest& hidl_request1, - const NanConfigRequestSupplemental& hidl_request2, - legacy_hal::NanConfigRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertHidlNanConfigRequest_1_6ToLegacy: null legacy_request"; - return false; - } - - *legacy_request = {}; - if (!convertHidlNanConfigRequestToLegacy(hidl_request1, legacy_request)) { - return false; - } - - legacy_request->config_discovery_beacon_int = 1; - legacy_request->discovery_beacon_interval = hidl_request2.V1_5.V1_2.discoveryBeaconIntervalMs; - legacy_request->config_nss = 1; - legacy_request->nss = hidl_request2.V1_5.V1_2.numberOfSpatialStreamsInDiscovery; - legacy_request->config_dw_early_termination = 1; - legacy_request->enable_dw_termination = - hidl_request2.V1_5.V1_2.enableDiscoveryWindowEarlyTermination; - legacy_request->config_enable_ranging = 1; - legacy_request->enable_ranging = hidl_request2.V1_5.V1_2.enableRanging; - - legacy_request->config_enable_instant_mode = 1; - legacy_request->enable_instant_mode = hidl_request2.V1_5.enableInstantCommunicationMode; - legacy_request->config_instant_mode_channel = 1; - legacy_request->instant_mode_channel = hidl_request2.instantModeChannel; - - return true; -} - -bool convertHidlNanPublishRequestToLegacy(const V1_6::NanPublishRequest& hidl_request, - legacy_hal::NanPublishRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: null legacy_request"; - return false; - } - *legacy_request = {}; - - legacy_request->publish_id = hidl_request.baseConfigs.sessionId; - legacy_request->ttl = hidl_request.baseConfigs.ttlSec; - legacy_request->period = hidl_request.baseConfigs.discoveryWindowPeriod; - legacy_request->publish_count = hidl_request.baseConfigs.discoveryCount; - legacy_request->service_name_len = hidl_request.baseConfigs.serviceName.size(); - if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { - LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: service_name_len " - "too large"; - return false; - } - memcpy(legacy_request->service_name, hidl_request.baseConfigs.serviceName.data(), - legacy_request->service_name_len); - legacy_request->publish_match_indicator = - convertHidlNanMatchAlgToLegacy(hidl_request.baseConfigs.discoveryMatchIndicator); - legacy_request->service_specific_info_len = hidl_request.baseConfigs.serviceSpecificInfo.size(); - if (legacy_request->service_specific_info_len > NAN_MAX_SERVICE_SPECIFIC_INFO_LEN) { - LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: " - "service_specific_info_len too large"; - return false; - } - memcpy(legacy_request->service_specific_info, - hidl_request.baseConfigs.serviceSpecificInfo.data(), - legacy_request->service_specific_info_len); - legacy_request->sdea_service_specific_info_len = - hidl_request.baseConfigs.extendedServiceSpecificInfo.size(); - if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) { - LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: " - "sdea_service_specific_info_len too large"; - return false; - } - memcpy(legacy_request->sdea_service_specific_info, - hidl_request.baseConfigs.extendedServiceSpecificInfo.data(), - legacy_request->sdea_service_specific_info_len); - legacy_request->rx_match_filter_len = hidl_request.baseConfigs.rxMatchFilter.size(); - if (legacy_request->rx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { - LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: " - "rx_match_filter_len too large"; - return false; - } - memcpy(legacy_request->rx_match_filter, hidl_request.baseConfigs.rxMatchFilter.data(), - legacy_request->rx_match_filter_len); - legacy_request->tx_match_filter_len = hidl_request.baseConfigs.txMatchFilter.size(); - if (legacy_request->tx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { - LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: " - "tx_match_filter_len too large"; - return false; - } - memcpy(legacy_request->tx_match_filter, hidl_request.baseConfigs.txMatchFilter.data(), - legacy_request->tx_match_filter_len); - legacy_request->rssi_threshold_flag = hidl_request.baseConfigs.useRssiThreshold; - legacy_request->recv_indication_cfg = 0; - legacy_request->recv_indication_cfg |= - hidl_request.baseConfigs.disableDiscoveryTerminationIndication ? 0x1 : 0x0; - legacy_request->recv_indication_cfg |= - hidl_request.baseConfigs.disableMatchExpirationIndication ? 0x2 : 0x0; - legacy_request->recv_indication_cfg |= - hidl_request.baseConfigs.disableFollowupReceivedIndication ? 0x4 : 0x0; - legacy_request->recv_indication_cfg |= 0x8; - legacy_request->cipher_type = (unsigned int)hidl_request.baseConfigs.securityConfig.cipherType; - - legacy_request->scid_len = hidl_request.baseConfigs.securityConfig.scid.size(); - if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) { - LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: scid_len too large"; - return false; - } - memcpy(legacy_request->scid, hidl_request.baseConfigs.securityConfig.scid.data(), - legacy_request->scid_len); - - if (hidl_request.baseConfigs.securityConfig.securityType == NanDataPathSecurityType::PMK) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; - legacy_request->key_info.body.pmk_info.pmk_len = - hidl_request.baseConfigs.securityConfig.pmk.size(); - if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { - LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: invalid pmk_len"; - return false; - } - memcpy(legacy_request->key_info.body.pmk_info.pmk, - hidl_request.baseConfigs.securityConfig.pmk.data(), - legacy_request->key_info.body.pmk_info.pmk_len); - } - if (hidl_request.baseConfigs.securityConfig.securityType == - NanDataPathSecurityType::PASSPHRASE) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; - legacy_request->key_info.body.passphrase_info.passphrase_len = - hidl_request.baseConfigs.securityConfig.passphrase.size(); - if (legacy_request->key_info.body.passphrase_info.passphrase_len < - NAN_SECURITY_MIN_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: " - "passphrase_len too small"; - return false; - } - if (legacy_request->key_info.body.passphrase_info.passphrase_len > - NAN_SECURITY_MAX_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: " - "passphrase_len too large"; - return false; - } - memcpy(legacy_request->key_info.body.passphrase_info.passphrase, - hidl_request.baseConfigs.securityConfig.passphrase.data(), - legacy_request->key_info.body.passphrase_info.passphrase_len); - } - legacy_request->sdea_params.security_cfg = - (hidl_request.baseConfigs.securityConfig.securityType != NanDataPathSecurityType::OPEN) - ? legacy_hal::NAN_DP_CONFIG_SECURITY - : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; - - legacy_request->sdea_params.ranging_state = hidl_request.baseConfigs.rangingRequired - ? legacy_hal::NAN_RANGING_ENABLE - : legacy_hal::NAN_RANGING_DISABLE; - legacy_request->ranging_cfg.ranging_interval_msec = - hidl_request.baseConfigs.rangingIntervalMsec; - legacy_request->ranging_cfg.config_ranging_indications = - hidl_request.baseConfigs.configRangingIndications; - legacy_request->ranging_cfg.distance_ingress_mm = - hidl_request.baseConfigs.distanceIngressCm * 10; - legacy_request->ranging_cfg.distance_egress_mm = hidl_request.baseConfigs.distanceEgressCm * 10; - legacy_request->ranging_auto_response = hidl_request.baseConfigs.rangingRequired - ? legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE - : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE; - legacy_request->sdea_params.range_report = legacy_hal::NAN_DISABLE_RANGE_REPORT; - legacy_request->publish_type = convertHidlNanPublishTypeToLegacy(hidl_request.publishType); - legacy_request->tx_type = convertHidlNanTxTypeToLegacy(hidl_request.txType); - legacy_request->service_responder_policy = hidl_request.autoAcceptDataPathRequests - ? legacy_hal::NAN_SERVICE_ACCEPT_POLICY_ALL - : legacy_hal::NAN_SERVICE_ACCEPT_POLICY_NONE; - - return true; -} - -bool convertHidlNanSubscribeRequestToLegacy(const V1_0::NanSubscribeRequest& hidl_request, - legacy_hal::NanSubscribeRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: legacy_request is null"; - return false; - } - *legacy_request = {}; - - legacy_request->subscribe_id = hidl_request.baseConfigs.sessionId; - legacy_request->ttl = hidl_request.baseConfigs.ttlSec; - legacy_request->period = hidl_request.baseConfigs.discoveryWindowPeriod; - legacy_request->subscribe_count = hidl_request.baseConfigs.discoveryCount; - legacy_request->service_name_len = hidl_request.baseConfigs.serviceName.size(); - if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { - LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " - "service_name_len too large"; - return false; - } - memcpy(legacy_request->service_name, hidl_request.baseConfigs.serviceName.data(), - legacy_request->service_name_len); - legacy_request->subscribe_match_indicator = - convertHidlNanMatchAlgToLegacy(hidl_request.baseConfigs.discoveryMatchIndicator); - legacy_request->service_specific_info_len = hidl_request.baseConfigs.serviceSpecificInfo.size(); - if (legacy_request->service_specific_info_len > NAN_MAX_SERVICE_SPECIFIC_INFO_LEN) { - LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " - "service_specific_info_len too large"; - return false; - } - memcpy(legacy_request->service_specific_info, - hidl_request.baseConfigs.serviceSpecificInfo.data(), - legacy_request->service_specific_info_len); - legacy_request->sdea_service_specific_info_len = - hidl_request.baseConfigs.extendedServiceSpecificInfo.size(); - if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) { - LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " - "sdea_service_specific_info_len too large"; - return false; - } - memcpy(legacy_request->sdea_service_specific_info, - hidl_request.baseConfigs.extendedServiceSpecificInfo.data(), - legacy_request->sdea_service_specific_info_len); - legacy_request->rx_match_filter_len = hidl_request.baseConfigs.rxMatchFilter.size(); - if (legacy_request->rx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { - LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " - "rx_match_filter_len too large"; - return false; - } - memcpy(legacy_request->rx_match_filter, hidl_request.baseConfigs.rxMatchFilter.data(), - legacy_request->rx_match_filter_len); - legacy_request->tx_match_filter_len = hidl_request.baseConfigs.txMatchFilter.size(); - if (legacy_request->tx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { - LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " - "tx_match_filter_len too large"; - return false; - } - memcpy(legacy_request->tx_match_filter, hidl_request.baseConfigs.txMatchFilter.data(), - legacy_request->tx_match_filter_len); - legacy_request->rssi_threshold_flag = hidl_request.baseConfigs.useRssiThreshold; - legacy_request->recv_indication_cfg = 0; - legacy_request->recv_indication_cfg |= - hidl_request.baseConfigs.disableDiscoveryTerminationIndication ? 0x1 : 0x0; - legacy_request->recv_indication_cfg |= - hidl_request.baseConfigs.disableMatchExpirationIndication ? 0x2 : 0x0; - legacy_request->recv_indication_cfg |= - hidl_request.baseConfigs.disableFollowupReceivedIndication ? 0x4 : 0x0; - legacy_request->cipher_type = (unsigned int)hidl_request.baseConfigs.securityConfig.cipherType; - if (hidl_request.baseConfigs.securityConfig.securityType == NanDataPathSecurityType::PMK) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; - legacy_request->key_info.body.pmk_info.pmk_len = - hidl_request.baseConfigs.securityConfig.pmk.size(); - if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { - LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: invalid pmk_len"; - return false; - } - memcpy(legacy_request->key_info.body.pmk_info.pmk, - hidl_request.baseConfigs.securityConfig.pmk.data(), - legacy_request->key_info.body.pmk_info.pmk_len); - } - if (hidl_request.baseConfigs.securityConfig.securityType == - NanDataPathSecurityType::PASSPHRASE) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; - legacy_request->key_info.body.passphrase_info.passphrase_len = - hidl_request.baseConfigs.securityConfig.passphrase.size(); - if (legacy_request->key_info.body.passphrase_info.passphrase_len < - NAN_SECURITY_MIN_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " - "passphrase_len too small"; - return false; - } - if (legacy_request->key_info.body.passphrase_info.passphrase_len > - NAN_SECURITY_MAX_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " - "passphrase_len too large"; - return false; - } - memcpy(legacy_request->key_info.body.passphrase_info.passphrase, - hidl_request.baseConfigs.securityConfig.passphrase.data(), - legacy_request->key_info.body.passphrase_info.passphrase_len); - } - legacy_request->sdea_params.security_cfg = - (hidl_request.baseConfigs.securityConfig.securityType != NanDataPathSecurityType::OPEN) - ? legacy_hal::NAN_DP_CONFIG_SECURITY - : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; - legacy_request->sdea_params.ranging_state = hidl_request.baseConfigs.rangingRequired - ? legacy_hal::NAN_RANGING_ENABLE - : legacy_hal::NAN_RANGING_DISABLE; - legacy_request->ranging_cfg.ranging_interval_msec = - hidl_request.baseConfigs.rangingIntervalMsec; - legacy_request->ranging_cfg.config_ranging_indications = - hidl_request.baseConfigs.configRangingIndications; - legacy_request->ranging_cfg.distance_ingress_mm = - hidl_request.baseConfigs.distanceIngressCm * 10; - legacy_request->ranging_cfg.distance_egress_mm = hidl_request.baseConfigs.distanceEgressCm * 10; - legacy_request->ranging_auto_response = hidl_request.baseConfigs.rangingRequired - ? legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE - : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE; - legacy_request->sdea_params.range_report = legacy_hal::NAN_DISABLE_RANGE_REPORT; - legacy_request->subscribe_type = - convertHidlNanSubscribeTypeToLegacy(hidl_request.subscribeType); - legacy_request->serviceResponseFilter = convertHidlNanSrfTypeToLegacy(hidl_request.srfType); - legacy_request->serviceResponseInclude = hidl_request.srfRespondIfInAddressSet - ? legacy_hal::NAN_SRF_INCLUDE_RESPOND - : legacy_hal::NAN_SRF_INCLUDE_DO_NOT_RESPOND; - legacy_request->useServiceResponseFilter = - hidl_request.shouldUseSrf ? legacy_hal::NAN_USE_SRF : legacy_hal::NAN_DO_NOT_USE_SRF; - legacy_request->ssiRequiredForMatchIndication = - hidl_request.isSsiRequiredForMatch ? legacy_hal::NAN_SSI_REQUIRED_IN_MATCH_IND - : legacy_hal::NAN_SSI_NOT_REQUIRED_IN_MATCH_IND; - legacy_request->num_intf_addr_present = hidl_request.intfAddr.size(); - if (legacy_request->num_intf_addr_present > NAN_MAX_SUBSCRIBE_MAX_ADDRESS) { - LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " - "num_intf_addr_present - too many"; - return false; - } - for (int i = 0; i < legacy_request->num_intf_addr_present; i++) { - memcpy(legacy_request->intf_addr[i], hidl_request.intfAddr[i].data(), 6); - } - - return true; -} - -bool convertHidlNanTransmitFollowupRequestToLegacy( - const NanTransmitFollowupRequest& hidl_request, - legacy_hal::NanTransmitFollowupRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertHidlNanTransmitFollowupRequestToLegacy: " - "legacy_request is null"; - return false; - } - *legacy_request = {}; - - legacy_request->publish_subscribe_id = hidl_request.discoverySessionId; - legacy_request->requestor_instance_id = hidl_request.peerId; - memcpy(legacy_request->addr, hidl_request.addr.data(), 6); - legacy_request->priority = hidl_request.isHighPriority ? legacy_hal::NAN_TX_PRIORITY_HIGH - : legacy_hal::NAN_TX_PRIORITY_NORMAL; - legacy_request->dw_or_faw = hidl_request.shouldUseDiscoveryWindow - ? legacy_hal::NAN_TRANSMIT_IN_DW - : legacy_hal::NAN_TRANSMIT_IN_FAW; - legacy_request->service_specific_info_len = hidl_request.serviceSpecificInfo.size(); - if (legacy_request->service_specific_info_len > NAN_MAX_SERVICE_SPECIFIC_INFO_LEN) { - LOG(ERROR) << "convertHidlNanTransmitFollowupRequestToLegacy: " - "service_specific_info_len too large"; - return false; - } - memcpy(legacy_request->service_specific_info, hidl_request.serviceSpecificInfo.data(), - legacy_request->service_specific_info_len); - legacy_request->sdea_service_specific_info_len = - hidl_request.extendedServiceSpecificInfo.size(); - if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) { - LOG(ERROR) << "convertHidlNanTransmitFollowupRequestToLegacy: " - "sdea_service_specific_info_len too large"; - return false; - } - memcpy(legacy_request->sdea_service_specific_info, - hidl_request.extendedServiceSpecificInfo.data(), - legacy_request->sdea_service_specific_info_len); - legacy_request->recv_indication_cfg = hidl_request.disableFollowupResultIndication ? 0x1 : 0x0; - - return true; -} - -bool convertHidlNanConfigRequestToLegacy(const V1_4::NanConfigRequest& hidl_request, - legacy_hal::NanConfigRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertHidlNanConfigRequestToLegacy: legacy_request is null"; - return false; - } - *legacy_request = {}; - - // TODO: b/34059183 tracks missing configurations in legacy HAL or uknown - // defaults - legacy_request->master_pref = hidl_request.masterPref; - legacy_request->discovery_indication_cfg = 0; - legacy_request->discovery_indication_cfg |= - hidl_request.disableDiscoveryAddressChangeIndication ? 0x1 : 0x0; - legacy_request->discovery_indication_cfg |= - hidl_request.disableStartedClusterIndication ? 0x2 : 0x0; - legacy_request->discovery_indication_cfg |= - hidl_request.disableJoinedClusterIndication ? 0x4 : 0x0; - legacy_request->config_sid_beacon = 1; - if (hidl_request.numberOfPublishServiceIdsInBeacon > 127) { - LOG(ERROR) << "convertHidlNanConfigRequestToLegacy: " - "numberOfPublishServiceIdsInBeacon > 127"; - return false; - } - legacy_request->sid_beacon = (hidl_request.includePublishServiceIdsInBeacon ? 0x1 : 0x0) | - (hidl_request.numberOfPublishServiceIdsInBeacon << 1); - legacy_request->config_subscribe_sid_beacon = 1; - if (hidl_request.numberOfSubscribeServiceIdsInBeacon > 127) { - LOG(ERROR) << "convertHidlNanConfigRequestToLegacy: " - "numberOfSubscribeServiceIdsInBeacon > 127"; - return false; - } - legacy_request->subscribe_sid_beacon_val = - (hidl_request.includeSubscribeServiceIdsInBeacon ? 0x1 : 0x0) | - (hidl_request.numberOfSubscribeServiceIdsInBeacon << 1); - legacy_request->config_rssi_window_size = 1; - legacy_request->rssi_window_size_val = hidl_request.rssiWindowSize; - legacy_request->config_disc_mac_addr_randomization = 1; - legacy_request->disc_mac_addr_rand_interval_sec = - hidl_request.macAddressRandomizationIntervalSec; - /* TODO : missing - legacy_request->config_2dot4g_rssi_close = 1; - legacy_request->rssi_close_2dot4g_val = - hidl_request.bandSpecificConfig[ - (size_t) NanBandIndex::NAN_BAND_24GHZ].rssiClose; - legacy_request->config_2dot4g_rssi_middle = 1; - legacy_request->rssi_middle_2dot4g_val = - hidl_request.bandSpecificConfig[ - (size_t) NanBandIndex::NAN_BAND_24GHZ].rssiMiddle; - legacy_request->config_2dot4g_rssi_proximity = 1; - legacy_request->rssi_proximity_2dot4g_val = - hidl_request.bandSpecificConfig[ - (size_t) NanBandIndex::NAN_BAND_24GHZ].rssiCloseProximity; - */ - legacy_request->config_scan_params = 1; - legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_24G_BAND] = - hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ].dwellTimeMs; - legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_24G_BAND] = - hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ].scanPeriodSec; - legacy_request->config_dw.config_2dot4g_dw_band = - hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .validDiscoveryWindowIntervalVal; - legacy_request->config_dw.dw_2dot4g_interval_val = - hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .discoveryWindowIntervalVal; - /* TODO: missing - legacy_request->config_5g_rssi_close = 1; - legacy_request->rssi_close_5g_val = - hidl_request.bandSpecificConfig[ - (size_t) NanBandIndex::NAN_BAND_5GHZ].rssiClose; - legacy_request->config_5g_rssi_middle = 1; - legacy_request->rssi_middle_5g_val = - hidl_request.bandSpecificConfig[ - (size_t) NanBandIndex::NAN_BAND_5GHZ].rssiMiddle; - */ - legacy_request->config_5g_rssi_close_proximity = 1; - legacy_request->rssi_close_proximity_5g_val = - hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].rssiCloseProximity; - legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = - hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].dwellTimeMs; - legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = - hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].scanPeriodSec; - legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = - hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].dwellTimeMs; - legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = - hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].scanPeriodSec; - legacy_request->config_dw.config_5g_dw_band = - hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .validDiscoveryWindowIntervalVal; - legacy_request->config_dw.dw_5g_interval_val = - hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .discoveryWindowIntervalVal; - /* TODO: b/145609058 - * Missing updates needed to legacy_hal::NanConfigRequest and conversion to - * it for 6GHz band */ - - return true; -} - -bool convertHidlNanDataPathInitiatorRequestToLegacy( - const V1_0::NanInitiateDataPathRequest& hidl_request, - legacy_hal::NanDataPathInitiatorRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " - "legacy_request is null"; - return false; - } - *legacy_request = {}; - - legacy_request->requestor_instance_id = hidl_request.peerId; - memcpy(legacy_request->peer_disc_mac_addr, hidl_request.peerDiscMacAddr.data(), 6); - legacy_request->channel_request_type = - convertHidlNanDataPathChannelCfgToLegacy(hidl_request.channelRequestType); - legacy_request->channel = hidl_request.channel; - if (strnlen(hidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " - "ifaceName too long"; - return false; - } - strlcpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1); - legacy_request->ndp_cfg.security_cfg = - (hidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN) - ? legacy_hal::NAN_DP_CONFIG_SECURITY - : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; - legacy_request->app_info.ndp_app_info_len = hidl_request.appInfo.size(); - if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " - "ndp_app_info_len too large"; - return false; - } - memcpy(legacy_request->app_info.ndp_app_info, hidl_request.appInfo.data(), - legacy_request->app_info.ndp_app_info_len); - legacy_request->cipher_type = (unsigned int)hidl_request.securityConfig.cipherType; - if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; - legacy_request->key_info.body.pmk_info.pmk_len = hidl_request.securityConfig.pmk.size(); - if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " - "invalid pmk_len"; - return false; - } - memcpy(legacy_request->key_info.body.pmk_info.pmk, hidl_request.securityConfig.pmk.data(), - legacy_request->key_info.body.pmk_info.pmk_len); - } - if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; - legacy_request->key_info.body.passphrase_info.passphrase_len = - hidl_request.securityConfig.passphrase.size(); - if (legacy_request->key_info.body.passphrase_info.passphrase_len < - NAN_SECURITY_MIN_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " - "passphrase_len too small"; - return false; - } - if (legacy_request->key_info.body.passphrase_info.passphrase_len > - NAN_SECURITY_MAX_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " - "passphrase_len too large"; - return false; - } - memcpy(legacy_request->key_info.body.passphrase_info.passphrase, - hidl_request.securityConfig.passphrase.data(), - legacy_request->key_info.body.passphrase_info.passphrase_len); - } - legacy_request->service_name_len = hidl_request.serviceNameOutOfBand.size(); - if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " - "service_name_len too large"; - return false; - } - memcpy(legacy_request->service_name, hidl_request.serviceNameOutOfBand.data(), - legacy_request->service_name_len); - - return true; -} - -bool convertHidlNanDataPathInitiatorRequest_1_6ToLegacy( - const V1_6::NanInitiateDataPathRequest& hidl_request, - legacy_hal::NanDataPathInitiatorRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " - "legacy_request is null"; - return false; - } - *legacy_request = {}; - - legacy_request->requestor_instance_id = hidl_request.peerId; - memcpy(legacy_request->peer_disc_mac_addr, hidl_request.peerDiscMacAddr.data(), 6); - legacy_request->channel_request_type = - convertHidlNanDataPathChannelCfgToLegacy(hidl_request.channelRequestType); - legacy_request->channel = hidl_request.channel; - if (strnlen(hidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " - "ifaceName too long"; - return false; - } - strlcpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1); - legacy_request->ndp_cfg.security_cfg = - (hidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN) - ? legacy_hal::NAN_DP_CONFIG_SECURITY - : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; - legacy_request->app_info.ndp_app_info_len = hidl_request.appInfo.size(); - if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " - "ndp_app_info_len too large"; - return false; - } - memcpy(legacy_request->app_info.ndp_app_info, hidl_request.appInfo.data(), - legacy_request->app_info.ndp_app_info_len); - legacy_request->cipher_type = (unsigned int)hidl_request.securityConfig.cipherType; - if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; - legacy_request->key_info.body.pmk_info.pmk_len = hidl_request.securityConfig.pmk.size(); - if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " - "invalid pmk_len"; - return false; - } - memcpy(legacy_request->key_info.body.pmk_info.pmk, hidl_request.securityConfig.pmk.data(), - legacy_request->key_info.body.pmk_info.pmk_len); - } - if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; - legacy_request->key_info.body.passphrase_info.passphrase_len = - hidl_request.securityConfig.passphrase.size(); - if (legacy_request->key_info.body.passphrase_info.passphrase_len < - NAN_SECURITY_MIN_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " - "passphrase_len too small"; - return false; - } - if (legacy_request->key_info.body.passphrase_info.passphrase_len > - NAN_SECURITY_MAX_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " - "passphrase_len too large"; - return false; - } - memcpy(legacy_request->key_info.body.passphrase_info.passphrase, - hidl_request.securityConfig.passphrase.data(), - legacy_request->key_info.body.passphrase_info.passphrase_len); - } - legacy_request->service_name_len = hidl_request.serviceNameOutOfBand.size(); - if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " - "service_name_len too large"; - return false; - } - memcpy(legacy_request->service_name, hidl_request.serviceNameOutOfBand.data(), - legacy_request->service_name_len); - legacy_request->scid_len = hidl_request.securityConfig.scid.size(); - if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: scid_len too large"; - return false; - } - memcpy(legacy_request->scid, hidl_request.securityConfig.scid.data(), legacy_request->scid_len); - - return true; -} - -bool convertHidlNanDataPathIndicationResponseToLegacy( - const V1_0::NanRespondToDataPathIndicationRequest& hidl_request, - legacy_hal::NanDataPathIndicationResponse* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: " - "legacy_request is null"; - return false; - } - *legacy_request = {}; - - legacy_request->rsp_code = hidl_request.acceptRequest ? legacy_hal::NAN_DP_REQUEST_ACCEPT - : legacy_hal::NAN_DP_REQUEST_REJECT; - legacy_request->ndp_instance_id = hidl_request.ndpInstanceId; - if (strnlen(hidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: " - "ifaceName too long"; - return false; - } - strlcpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1); - legacy_request->ndp_cfg.security_cfg = - (hidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN) - ? legacy_hal::NAN_DP_CONFIG_SECURITY - : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; - legacy_request->app_info.ndp_app_info_len = hidl_request.appInfo.size(); - if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: " - "ndp_app_info_len too large"; - return false; - } - memcpy(legacy_request->app_info.ndp_app_info, hidl_request.appInfo.data(), - legacy_request->app_info.ndp_app_info_len); - legacy_request->cipher_type = (unsigned int)hidl_request.securityConfig.cipherType; - if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; - legacy_request->key_info.body.pmk_info.pmk_len = hidl_request.securityConfig.pmk.size(); - if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: " - "invalid pmk_len"; - return false; - } - memcpy(legacy_request->key_info.body.pmk_info.pmk, hidl_request.securityConfig.pmk.data(), - legacy_request->key_info.body.pmk_info.pmk_len); - } - if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; - legacy_request->key_info.body.passphrase_info.passphrase_len = - hidl_request.securityConfig.passphrase.size(); - if (legacy_request->key_info.body.passphrase_info.passphrase_len < - NAN_SECURITY_MIN_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: " - "passphrase_len too small"; - return false; - } - if (legacy_request->key_info.body.passphrase_info.passphrase_len > - NAN_SECURITY_MAX_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: " - "passphrase_len too large"; - return false; - } - memcpy(legacy_request->key_info.body.passphrase_info.passphrase, - hidl_request.securityConfig.passphrase.data(), - legacy_request->key_info.body.passphrase_info.passphrase_len); - } - legacy_request->service_name_len = hidl_request.serviceNameOutOfBand.size(); - if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: " - "service_name_len too large"; - return false; - } - memcpy(legacy_request->service_name, hidl_request.serviceNameOutOfBand.data(), - legacy_request->service_name_len); - - return true; -} - -bool convertHidlNanDataPathIndicationResponse_1_6ToLegacy( - const V1_6::NanRespondToDataPathIndicationRequest& hidl_request, - legacy_hal::NanDataPathIndicationResponse* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " - "legacy_request is null"; - return false; - } - *legacy_request = {}; - - legacy_request->rsp_code = hidl_request.acceptRequest ? legacy_hal::NAN_DP_REQUEST_ACCEPT - : legacy_hal::NAN_DP_REQUEST_REJECT; - legacy_request->ndp_instance_id = hidl_request.ndpInstanceId; - if (strnlen(hidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " - "ifaceName too long"; - return false; - } - strlcpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1); - legacy_request->ndp_cfg.security_cfg = - (hidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN) - ? legacy_hal::NAN_DP_CONFIG_SECURITY - : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; - legacy_request->app_info.ndp_app_info_len = hidl_request.appInfo.size(); - if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " - "ndp_app_info_len too large"; - return false; - } - memcpy(legacy_request->app_info.ndp_app_info, hidl_request.appInfo.data(), - legacy_request->app_info.ndp_app_info_len); - legacy_request->cipher_type = (unsigned int)hidl_request.securityConfig.cipherType; - if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; - legacy_request->key_info.body.pmk_info.pmk_len = hidl_request.securityConfig.pmk.size(); - if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " - "invalid pmk_len"; - return false; - } - memcpy(legacy_request->key_info.body.pmk_info.pmk, hidl_request.securityConfig.pmk.data(), - legacy_request->key_info.body.pmk_info.pmk_len); - } - if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; - legacy_request->key_info.body.passphrase_info.passphrase_len = - hidl_request.securityConfig.passphrase.size(); - if (legacy_request->key_info.body.passphrase_info.passphrase_len < - NAN_SECURITY_MIN_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " - "passphrase_len too small"; - return false; - } - if (legacy_request->key_info.body.passphrase_info.passphrase_len > - NAN_SECURITY_MAX_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " - "passphrase_len too large"; - return false; - } - memcpy(legacy_request->key_info.body.passphrase_info.passphrase, - hidl_request.securityConfig.passphrase.data(), - legacy_request->key_info.body.passphrase_info.passphrase_len); - } - legacy_request->service_name_len = hidl_request.serviceNameOutOfBand.size(); - if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " - "service_name_len too large"; - return false; - } - memcpy(legacy_request->service_name, hidl_request.serviceNameOutOfBand.data(), - legacy_request->service_name_len); - legacy_request->scid_len = hidl_request.securityConfig.scid.size(); - if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: scid_len too large"; - return false; - } - memcpy(legacy_request->scid, hidl_request.securityConfig.scid.data(), legacy_request->scid_len); - - return true; -} - -bool convertLegacyNanResponseHeaderToHidl(const legacy_hal::NanResponseMsg& legacy_response, - WifiNanStatus* wifiNanStatus) { - if (!wifiNanStatus) { - LOG(ERROR) << "convertLegacyNanResponseHeaderToHidl: wifiNanStatus is null"; - return false; - } - *wifiNanStatus = {}; - - convertToWifiNanStatus(legacy_response.status, legacy_response.nan_error, - sizeof(legacy_response.nan_error), wifiNanStatus); - return true; -} - -bool convertLegacyNanCapabilitiesResponseToHidl(const legacy_hal::NanCapabilities& legacy_response, - V1_6::NanCapabilities* hidl_response) { - if (!hidl_response) { - LOG(ERROR) << "convertLegacyNanCapabilitiesResponseToHidl: " - "hidl_response is null"; - return false; - } - *hidl_response = {}; - - hidl_response->maxConcurrentClusters = legacy_response.max_concurrent_nan_clusters; - hidl_response->maxPublishes = legacy_response.max_publishes; - hidl_response->maxSubscribes = legacy_response.max_subscribes; - hidl_response->maxServiceNameLen = legacy_response.max_service_name_len; - hidl_response->maxMatchFilterLen = legacy_response.max_match_filter_len; - hidl_response->maxTotalMatchFilterLen = legacy_response.max_total_match_filter_len; - hidl_response->maxServiceSpecificInfoLen = legacy_response.max_service_specific_info_len; - hidl_response->maxExtendedServiceSpecificInfoLen = - legacy_response.max_sdea_service_specific_info_len; - hidl_response->maxNdiInterfaces = legacy_response.max_ndi_interfaces; - hidl_response->maxNdpSessions = legacy_response.max_ndp_sessions; - hidl_response->maxAppInfoLen = legacy_response.max_app_info_len; - hidl_response->maxQueuedTransmitFollowupMsgs = - legacy_response.max_queued_transmit_followup_msgs; - hidl_response->maxSubscribeInterfaceAddresses = legacy_response.max_subscribe_address; - hidl_response->supportedCipherSuites = legacy_response.cipher_suites_supported; - hidl_response->instantCommunicationModeSupportFlag = legacy_response.is_instant_mode_supported; - - return true; -} - -bool convertLegacyNanMatchIndToHidl(const legacy_hal::NanMatchInd& legacy_ind, - V1_6::NanMatchInd* hidl_ind) { - if (!hidl_ind) { - LOG(ERROR) << "convertLegacyNanMatchIndToHidl: hidl_ind is null"; - return false; - } - *hidl_ind = {}; - - hidl_ind->discoverySessionId = legacy_ind.publish_subscribe_id; - hidl_ind->peerId = legacy_ind.requestor_instance_id; - hidl_ind->addr = hidl_array(legacy_ind.addr); - hidl_ind->serviceSpecificInfo = std::vector( - legacy_ind.service_specific_info, - legacy_ind.service_specific_info + legacy_ind.service_specific_info_len); - hidl_ind->extendedServiceSpecificInfo = std::vector( - legacy_ind.sdea_service_specific_info, - legacy_ind.sdea_service_specific_info + legacy_ind.sdea_service_specific_info_len); - hidl_ind->matchFilter = - std::vector(legacy_ind.sdf_match_filter, - legacy_ind.sdf_match_filter + legacy_ind.sdf_match_filter_len); - hidl_ind->matchOccuredInBeaconFlag = legacy_ind.match_occured_flag == 1; - hidl_ind->outOfResourceFlag = legacy_ind.out_of_resource_flag == 1; - hidl_ind->rssiValue = legacy_ind.rssi_value; - hidl_ind->peerCipherType = (V1_6::NanCipherSuiteType)legacy_ind.peer_cipher_type; - hidl_ind->peerRequiresSecurityEnabledInNdp = - legacy_ind.peer_sdea_params.security_cfg == legacy_hal::NAN_DP_CONFIG_SECURITY; - hidl_ind->peerRequiresRanging = - legacy_ind.peer_sdea_params.ranging_state == legacy_hal::NAN_RANGING_ENABLE; - hidl_ind->rangingMeasurementInMm = legacy_ind.range_info.range_measurement_mm; - hidl_ind->rangingIndicationType = legacy_ind.range_info.ranging_event_type; - hidl_ind->scid = std::vector(legacy_ind.scid, legacy_ind.scid + legacy_ind.scid_len); - return true; -} - -bool convertLegacyNanFollowupIndToHidl(const legacy_hal::NanFollowupInd& legacy_ind, - NanFollowupReceivedInd* hidl_ind) { - if (!hidl_ind) { - LOG(ERROR) << "convertLegacyNanFollowupIndToHidl: hidl_ind is null"; - return false; - } - *hidl_ind = {}; - - hidl_ind->discoverySessionId = legacy_ind.publish_subscribe_id; - hidl_ind->peerId = legacy_ind.requestor_instance_id; - hidl_ind->addr = hidl_array(legacy_ind.addr); - hidl_ind->receivedInFaw = legacy_ind.dw_or_faw == 1; - hidl_ind->serviceSpecificInfo = std::vector( - legacy_ind.service_specific_info, - legacy_ind.service_specific_info + legacy_ind.service_specific_info_len); - hidl_ind->extendedServiceSpecificInfo = std::vector( - legacy_ind.sdea_service_specific_info, - legacy_ind.sdea_service_specific_info + legacy_ind.sdea_service_specific_info_len); - - return true; -} - -bool convertLegacyNanDataPathRequestIndToHidl(const legacy_hal::NanDataPathRequestInd& legacy_ind, - NanDataPathRequestInd* hidl_ind) { - if (!hidl_ind) { - LOG(ERROR) << "convertLegacyNanDataPathRequestIndToHidl: hidl_ind is null"; - return false; - } - *hidl_ind = {}; - - hidl_ind->discoverySessionId = legacy_ind.service_instance_id; - hidl_ind->peerDiscMacAddr = hidl_array(legacy_ind.peer_disc_mac_addr); - hidl_ind->ndpInstanceId = legacy_ind.ndp_instance_id; - hidl_ind->securityRequired = - legacy_ind.ndp_cfg.security_cfg == legacy_hal::NAN_DP_CONFIG_SECURITY; - hidl_ind->appInfo = std::vector( - legacy_ind.app_info.ndp_app_info, - legacy_ind.app_info.ndp_app_info + legacy_ind.app_info.ndp_app_info_len); - - return true; -} - -bool convertLegacyNdpChannelInfoToHidl(const legacy_hal::NanChannelInfo& legacy_struct, - V1_6::NanDataPathChannelInfo* hidl_struct) { - if (!hidl_struct) { - LOG(ERROR) << "convertLegacyNdpChannelInfoToHidl: hidl_struct is null"; - return false; - } - *hidl_struct = {}; - - hidl_struct->channelFreq = legacy_struct.channel; - hidl_struct->channelBandwidth = convertLegacyWifiChannelWidthToHidl( - (legacy_hal::wifi_channel_width)legacy_struct.bandwidth); - hidl_struct->numSpatialStreams = legacy_struct.nss; - - return true; -} - -bool convertLegacyNanDataPathConfirmIndToHidl(const legacy_hal::NanDataPathConfirmInd& legacy_ind, - V1_6::NanDataPathConfirmInd* hidl_ind) { - if (!hidl_ind) { - LOG(ERROR) << "convertLegacyNanDataPathConfirmIndToHidl: hidl_ind is null"; - return false; - } - *hidl_ind = {}; - - hidl_ind->V1_0.ndpInstanceId = legacy_ind.ndp_instance_id; - hidl_ind->V1_0.dataPathSetupSuccess = legacy_ind.rsp_code == legacy_hal::NAN_DP_REQUEST_ACCEPT; - hidl_ind->V1_0.peerNdiMacAddr = hidl_array(legacy_ind.peer_ndi_mac_addr); - hidl_ind->V1_0.appInfo = std::vector( - legacy_ind.app_info.ndp_app_info, - legacy_ind.app_info.ndp_app_info + legacy_ind.app_info.ndp_app_info_len); - hidl_ind->V1_0.status.status = convertLegacyNanStatusTypeToHidl(legacy_ind.reason_code); - hidl_ind->V1_0.status.description = ""; // TODO: b/34059183 - - std::vector channelInfo; - for (unsigned int i = 0; i < legacy_ind.num_channels; ++i) { - V1_6::NanDataPathChannelInfo hidl_struct; - if (!convertLegacyNdpChannelInfoToHidl(legacy_ind.channel_info[i], &hidl_struct)) { - return false; - } - channelInfo.push_back(hidl_struct); - } - hidl_ind->channelInfo = channelInfo; - - return true; -} - -bool convertLegacyNanDataPathScheduleUpdateIndToHidl( - const legacy_hal::NanDataPathScheduleUpdateInd& legacy_ind, - V1_6::NanDataPathScheduleUpdateInd* hidl_ind) { - if (!hidl_ind) { - LOG(ERROR) << "convertLegacyNanDataPathScheduleUpdateIndToHidl: " - "hidl_ind is null"; - return false; - } - *hidl_ind = {}; - - hidl_ind->peerDiscoveryAddress = hidl_array(legacy_ind.peer_mac_addr); - std::vector channelInfo; - for (unsigned int i = 0; i < legacy_ind.num_channels; ++i) { - V1_6::NanDataPathChannelInfo hidl_struct; - if (!convertLegacyNdpChannelInfoToHidl(legacy_ind.channel_info[i], &hidl_struct)) { - return false; - } - channelInfo.push_back(hidl_struct); - } - hidl_ind->channelInfo = channelInfo; - std::vector ndpInstanceIds; - for (unsigned int i = 0; i < legacy_ind.num_ndp_instances; ++i) { - ndpInstanceIds.push_back(legacy_ind.ndp_instance_id[i]); - } - hidl_ind->ndpInstanceIds = ndpInstanceIds; - - return true; -} - -legacy_hal::wifi_rtt_type convertHidlRttTypeToLegacy(RttType type) { - switch (type) { - case RttType::ONE_SIDED: - return legacy_hal::RTT_TYPE_1_SIDED; - case RttType::TWO_SIDED: - return legacy_hal::RTT_TYPE_2_SIDED; - }; - CHECK(false); -} - -RttType convertLegacyRttTypeToHidl(legacy_hal::wifi_rtt_type type) { - switch (type) { - case legacy_hal::RTT_TYPE_1_SIDED: - return RttType::ONE_SIDED; - case legacy_hal::RTT_TYPE_2_SIDED: - return RttType::TWO_SIDED; - }; - CHECK(false) << "Unknown legacy type: " << type; -} - -legacy_hal::rtt_peer_type convertHidlRttPeerTypeToLegacy(RttPeerType type) { - switch (type) { - case RttPeerType::AP: - return legacy_hal::RTT_PEER_AP; - case RttPeerType::STA: - return legacy_hal::RTT_PEER_STA; - case RttPeerType::P2P_GO: - return legacy_hal::RTT_PEER_P2P_GO; - case RttPeerType::P2P_CLIENT: - return legacy_hal::RTT_PEER_P2P_CLIENT; - case RttPeerType::NAN: - return legacy_hal::RTT_PEER_NAN; - }; - CHECK(false); -} - -legacy_hal::wifi_channel_width convertHidlWifiChannelWidthToLegacy(WifiChannelWidthInMhz type) { - switch (type) { - case WifiChannelWidthInMhz::WIDTH_20: - return legacy_hal::WIFI_CHAN_WIDTH_20; - case WifiChannelWidthInMhz::WIDTH_40: - return legacy_hal::WIFI_CHAN_WIDTH_40; - case WifiChannelWidthInMhz::WIDTH_80: - return legacy_hal::WIFI_CHAN_WIDTH_80; - case WifiChannelWidthInMhz::WIDTH_160: - return legacy_hal::WIFI_CHAN_WIDTH_160; - case WifiChannelWidthInMhz::WIDTH_80P80: - return legacy_hal::WIFI_CHAN_WIDTH_80P80; - case WifiChannelWidthInMhz::WIDTH_5: - return legacy_hal::WIFI_CHAN_WIDTH_5; - case WifiChannelWidthInMhz::WIDTH_10: - return legacy_hal::WIFI_CHAN_WIDTH_10; - case V1_6::WifiChannelWidthInMhz::WIDTH_320: - return legacy_hal::WIFI_CHAN_WIDTH_320; - case WifiChannelWidthInMhz::WIDTH_INVALID: - return legacy_hal::WIFI_CHAN_WIDTH_INVALID; - }; - CHECK(false); -} - -V1_6::WifiChannelWidthInMhz convertLegacyWifiChannelWidthToHidl( - legacy_hal::wifi_channel_width type) { - switch (type) { - case legacy_hal::WIFI_CHAN_WIDTH_20: - return WifiChannelWidthInMhz::WIDTH_20; - case legacy_hal::WIFI_CHAN_WIDTH_40: - return WifiChannelWidthInMhz::WIDTH_40; - case legacy_hal::WIFI_CHAN_WIDTH_80: - return WifiChannelWidthInMhz::WIDTH_80; - case legacy_hal::WIFI_CHAN_WIDTH_160: - return WifiChannelWidthInMhz::WIDTH_160; - case legacy_hal::WIFI_CHAN_WIDTH_80P80: - return WifiChannelWidthInMhz::WIDTH_80P80; - case legacy_hal::WIFI_CHAN_WIDTH_5: - return WifiChannelWidthInMhz::WIDTH_5; - case legacy_hal::WIFI_CHAN_WIDTH_10: - return WifiChannelWidthInMhz::WIDTH_10; - case legacy_hal::WIFI_CHAN_WIDTH_320: - return V1_6::WifiChannelWidthInMhz::WIDTH_320; - default: - return WifiChannelWidthInMhz::WIDTH_INVALID; - }; -} - -legacy_hal::wifi_rtt_preamble convertHidlRttPreambleToLegacy(V1_6::RttPreamble type) { - switch (type) { - case V1_6::RttPreamble::LEGACY: - return legacy_hal::WIFI_RTT_PREAMBLE_LEGACY; - case V1_6::RttPreamble::HT: - return legacy_hal::WIFI_RTT_PREAMBLE_HT; - case V1_6::RttPreamble::VHT: - return legacy_hal::WIFI_RTT_PREAMBLE_VHT; - case V1_6::RttPreamble::HE: - return legacy_hal::WIFI_RTT_PREAMBLE_HE; - case V1_6::RttPreamble::EHT: - return legacy_hal::WIFI_RTT_PREAMBLE_EHT; - }; - CHECK(false); -} - -V1_6::RttPreamble convertLegacyRttPreambleToHidl(legacy_hal::wifi_rtt_preamble type) { - switch (type) { - case legacy_hal::WIFI_RTT_PREAMBLE_LEGACY: - return V1_6::RttPreamble::LEGACY; - case legacy_hal::WIFI_RTT_PREAMBLE_HT: - return V1_6::RttPreamble::HT; - case legacy_hal::WIFI_RTT_PREAMBLE_VHT: - return V1_6::RttPreamble::VHT; - case legacy_hal::WIFI_RTT_PREAMBLE_HE: - return V1_6::RttPreamble::HE; - case legacy_hal::WIFI_RTT_PREAMBLE_EHT: - return V1_6::RttPreamble::EHT; - }; - CHECK(false) << "Unknown legacy type: " << type; -} - -legacy_hal::wifi_rtt_bw convertHidlRttBwToLegacy(RttBw type) { - switch (type) { - case RttBw::BW_5MHZ: - return legacy_hal::WIFI_RTT_BW_5; - case RttBw::BW_10MHZ: - return legacy_hal::WIFI_RTT_BW_10; - case RttBw::BW_20MHZ: - return legacy_hal::WIFI_RTT_BW_20; - case RttBw::BW_40MHZ: - return legacy_hal::WIFI_RTT_BW_40; - case RttBw::BW_80MHZ: - return legacy_hal::WIFI_RTT_BW_80; - case RttBw::BW_160MHZ: - return legacy_hal::WIFI_RTT_BW_160; - case RttBw::BW_320MHZ: - return legacy_hal::WIFI_RTT_BW_320; - }; - CHECK(false); -} - -RttBw convertLegacyRttBwToHidl(legacy_hal::wifi_rtt_bw type) { - switch (type) { - case legacy_hal::WIFI_RTT_BW_5: - return RttBw::BW_5MHZ; - case legacy_hal::WIFI_RTT_BW_10: - return RttBw::BW_10MHZ; - case legacy_hal::WIFI_RTT_BW_20: - return RttBw::BW_20MHZ; - case legacy_hal::WIFI_RTT_BW_40: - return RttBw::BW_40MHZ; - case legacy_hal::WIFI_RTT_BW_80: - return RttBw::BW_80MHZ; - case legacy_hal::WIFI_RTT_BW_160: - return RttBw::BW_160MHZ; - case legacy_hal::WIFI_RTT_BW_320: - return RttBw::BW_320MHZ; - }; - CHECK(false) << "Unknown legacy type: " << type; -} - -legacy_hal::wifi_motion_pattern convertHidlRttMotionPatternToLegacy(RttMotionPattern type) { - switch (type) { - case RttMotionPattern::NOT_EXPECTED: - return legacy_hal::WIFI_MOTION_NOT_EXPECTED; - case RttMotionPattern::EXPECTED: - return legacy_hal::WIFI_MOTION_EXPECTED; - case RttMotionPattern::UNKNOWN: - return legacy_hal::WIFI_MOTION_UNKNOWN; - }; - CHECK(false); -} - -V1_6::WifiRatePreamble convertLegacyWifiRatePreambleToHidl(uint8_t preamble) { - switch (preamble) { - case 0: - return V1_6::WifiRatePreamble::OFDM; - case 1: - return V1_6::WifiRatePreamble::CCK; - case 2: - return V1_6::WifiRatePreamble::HT; - case 3: - return V1_6::WifiRatePreamble::VHT; - case 4: - return V1_6::WifiRatePreamble::HE; - case 5: - return V1_6::WifiRatePreamble::EHT; - default: - return V1_6::WifiRatePreamble::RESERVED; - }; - CHECK(false) << "Unknown legacy preamble: " << preamble; -} - -WifiRateNss convertLegacyWifiRateNssToHidl(uint8_t nss) { - switch (nss) { - case 0: - return WifiRateNss::NSS_1x1; - case 1: - return WifiRateNss::NSS_2x2; - case 2: - return WifiRateNss::NSS_3x3; - case 3: - return WifiRateNss::NSS_4x4; - }; - CHECK(false) << "Unknown legacy nss: " << nss; - return {}; -} - -RttStatus convertLegacyRttStatusToHidl(legacy_hal::wifi_rtt_status status) { - switch (status) { - case legacy_hal::RTT_STATUS_SUCCESS: - return RttStatus::SUCCESS; - case legacy_hal::RTT_STATUS_FAILURE: - return RttStatus::FAILURE; - case legacy_hal::RTT_STATUS_FAIL_NO_RSP: - return RttStatus::FAIL_NO_RSP; - case legacy_hal::RTT_STATUS_FAIL_REJECTED: - return RttStatus::FAIL_REJECTED; - case legacy_hal::RTT_STATUS_FAIL_NOT_SCHEDULED_YET: - return RttStatus::FAIL_NOT_SCHEDULED_YET; - case legacy_hal::RTT_STATUS_FAIL_TM_TIMEOUT: - return RttStatus::FAIL_TM_TIMEOUT; - case legacy_hal::RTT_STATUS_FAIL_AP_ON_DIFF_CHANNEL: - return RttStatus::FAIL_AP_ON_DIFF_CHANNEL; - case legacy_hal::RTT_STATUS_FAIL_NO_CAPABILITY: - return RttStatus::FAIL_NO_CAPABILITY; - case legacy_hal::RTT_STATUS_ABORTED: - return RttStatus::ABORTED; - case legacy_hal::RTT_STATUS_FAIL_INVALID_TS: - return RttStatus::FAIL_INVALID_TS; - case legacy_hal::RTT_STATUS_FAIL_PROTOCOL: - return RttStatus::FAIL_PROTOCOL; - case legacy_hal::RTT_STATUS_FAIL_SCHEDULE: - return RttStatus::FAIL_SCHEDULE; - case legacy_hal::RTT_STATUS_FAIL_BUSY_TRY_LATER: - return RttStatus::FAIL_BUSY_TRY_LATER; - case legacy_hal::RTT_STATUS_INVALID_REQ: - return RttStatus::INVALID_REQ; - case legacy_hal::RTT_STATUS_NO_WIFI: - return RttStatus::NO_WIFI; - case legacy_hal::RTT_STATUS_FAIL_FTM_PARAM_OVERRIDE: - return RttStatus::FAIL_FTM_PARAM_OVERRIDE; - case legacy_hal::RTT_STATUS_NAN_RANGING_PROTOCOL_FAILURE: - return RttStatus::FAILURE; // TODO: add HIDL enumeration - case legacy_hal::RTT_STATUS_NAN_RANGING_CONCURRENCY_NOT_SUPPORTED: - return RttStatus::FAILURE; // TODO: add HIDL enumeration - }; - CHECK(false) << "Unknown legacy status: " << status; -} - -bool convertHidlWifiChannelInfoToLegacy(const WifiChannelInfo& hidl_info, - legacy_hal::wifi_channel_info* legacy_info) { - if (!legacy_info) { - return false; - } - *legacy_info = {}; - legacy_info->width = convertHidlWifiChannelWidthToLegacy(hidl_info.width); - legacy_info->center_freq = hidl_info.centerFreq; - legacy_info->center_freq0 = hidl_info.centerFreq0; - legacy_info->center_freq1 = hidl_info.centerFreq1; - return true; -} - -bool convertLegacyWifiChannelInfoToHidl(const legacy_hal::wifi_channel_info& legacy_info, - WifiChannelInfo* hidl_info) { - if (!hidl_info) { - return false; - } - *hidl_info = {}; - hidl_info->width = convertLegacyWifiChannelWidthToHidl(legacy_info.width); - hidl_info->centerFreq = legacy_info.center_freq; - hidl_info->centerFreq0 = legacy_info.center_freq0; - hidl_info->centerFreq1 = legacy_info.center_freq1; - return true; -} - -bool convertHidlRttConfigToLegacy(const V1_6::RttConfig& hidl_config, - legacy_hal::wifi_rtt_config* legacy_config) { - if (!legacy_config) { - return false; - } - *legacy_config = {}; - CHECK(hidl_config.addr.size() == sizeof(legacy_config->addr)); - memcpy(legacy_config->addr, hidl_config.addr.data(), hidl_config.addr.size()); - legacy_config->type = convertHidlRttTypeToLegacy(hidl_config.type); - legacy_config->peer = convertHidlRttPeerTypeToLegacy(hidl_config.peer); - if (!convertHidlWifiChannelInfoToLegacy(hidl_config.channel, &legacy_config->channel)) { - return false; - } - legacy_config->burst_period = hidl_config.burstPeriod; - legacy_config->num_burst = hidl_config.numBurst; - legacy_config->num_frames_per_burst = hidl_config.numFramesPerBurst; - legacy_config->num_retries_per_rtt_frame = hidl_config.numRetriesPerRttFrame; - legacy_config->num_retries_per_ftmr = hidl_config.numRetriesPerFtmr; - legacy_config->LCI_request = hidl_config.mustRequestLci; - legacy_config->LCR_request = hidl_config.mustRequestLcr; - legacy_config->burst_duration = hidl_config.burstDuration; - legacy_config->preamble = convertHidlRttPreambleToLegacy(hidl_config.preamble); - legacy_config->bw = convertHidlRttBwToLegacy(hidl_config.bw); - return true; -} - -bool convertHidlVectorOfRttConfigToLegacy( - const std::vector& hidl_configs, - std::vector* legacy_configs) { - if (!legacy_configs) { - return false; - } - *legacy_configs = {}; - for (const auto& hidl_config : hidl_configs) { - legacy_hal::wifi_rtt_config legacy_config; - if (!convertHidlRttConfigToLegacy(hidl_config, &legacy_config)) { - return false; - } - legacy_configs->push_back(legacy_config); - } - return true; -} - -bool convertHidlRttLciInformationToLegacy(const RttLciInformation& hidl_info, - legacy_hal::wifi_lci_information* legacy_info) { - if (!legacy_info) { - return false; - } - *legacy_info = {}; - legacy_info->latitude = hidl_info.latitude; - legacy_info->longitude = hidl_info.longitude; - legacy_info->altitude = hidl_info.altitude; - legacy_info->latitude_unc = hidl_info.latitudeUnc; - legacy_info->longitude_unc = hidl_info.longitudeUnc; - legacy_info->altitude_unc = hidl_info.altitudeUnc; - legacy_info->motion_pattern = convertHidlRttMotionPatternToLegacy(hidl_info.motionPattern); - legacy_info->floor = hidl_info.floor; - legacy_info->height_above_floor = hidl_info.heightAboveFloor; - legacy_info->height_unc = hidl_info.heightUnc; - return true; -} - -bool convertHidlRttLcrInformationToLegacy(const RttLcrInformation& hidl_info, - legacy_hal::wifi_lcr_information* legacy_info) { - if (!legacy_info) { - return false; - } - *legacy_info = {}; - CHECK(hidl_info.countryCode.size() == sizeof(legacy_info->country_code)); - memcpy(legacy_info->country_code, hidl_info.countryCode.data(), hidl_info.countryCode.size()); - if (hidl_info.civicInfo.size() > sizeof(legacy_info->civic_info)) { - return false; - } - legacy_info->length = hidl_info.civicInfo.size(); - memcpy(legacy_info->civic_info, hidl_info.civicInfo.c_str(), hidl_info.civicInfo.size()); - return true; -} - -bool convertHidlRttResponderToLegacy(const V1_6::RttResponder& hidl_responder, - legacy_hal::wifi_rtt_responder* legacy_responder) { - if (!legacy_responder) { - return false; - } - *legacy_responder = {}; - if (!convertHidlWifiChannelInfoToLegacy(hidl_responder.channel, &legacy_responder->channel)) { - return false; - } - legacy_responder->preamble = convertHidlRttPreambleToLegacy(hidl_responder.preamble); - return true; -} - -bool convertLegacyRttResponderToHidl(const legacy_hal::wifi_rtt_responder& legacy_responder, - V1_6::RttResponder* hidl_responder) { - if (!hidl_responder) { - return false; - } - *hidl_responder = {}; - if (!convertLegacyWifiChannelInfoToHidl(legacy_responder.channel, &hidl_responder->channel)) { - return false; - } - hidl_responder->preamble = convertLegacyRttPreambleToHidl(legacy_responder.preamble); - return true; -} - -bool convertLegacyRttCapabilitiesToHidl( - const legacy_hal::wifi_rtt_capabilities& legacy_capabilities, - V1_6::RttCapabilities* hidl_capabilities) { - if (!hidl_capabilities) { - return false; - } - *hidl_capabilities = {}; - hidl_capabilities->rttOneSidedSupported = legacy_capabilities.rtt_one_sided_supported; - hidl_capabilities->rttFtmSupported = legacy_capabilities.rtt_ftm_supported; - hidl_capabilities->lciSupported = legacy_capabilities.lci_support; - hidl_capabilities->lcrSupported = legacy_capabilities.lcr_support; - hidl_capabilities->responderSupported = legacy_capabilities.responder_supported; - hidl_capabilities->preambleSupport = 0; - for (const auto flag : {legacy_hal::WIFI_RTT_PREAMBLE_LEGACY, legacy_hal::WIFI_RTT_PREAMBLE_HT, - legacy_hal::WIFI_RTT_PREAMBLE_VHT, legacy_hal::WIFI_RTT_PREAMBLE_HE, - legacy_hal::WIFI_RTT_PREAMBLE_EHT}) { - if (legacy_capabilities.preamble_support & flag) { - hidl_capabilities->preambleSupport |= - static_cast::type>( - convertLegacyRttPreambleToHidl(flag)); - } - } - hidl_capabilities->bwSupport = 0; - for (const auto flag : - {legacy_hal::WIFI_RTT_BW_5, legacy_hal::WIFI_RTT_BW_10, legacy_hal::WIFI_RTT_BW_20, - legacy_hal::WIFI_RTT_BW_40, legacy_hal::WIFI_RTT_BW_80, legacy_hal::WIFI_RTT_BW_160, - legacy_hal::WIFI_RTT_BW_320}) { - if (legacy_capabilities.bw_support & flag) { - hidl_capabilities->bwSupport |= - static_cast::type>(convertLegacyRttBwToHidl(flag)); - } - } - hidl_capabilities->mcVersion = legacy_capabilities.mc_version; - return true; -} - -bool convertLegacyWifiRateInfoToHidl(const legacy_hal::wifi_rate& legacy_rate, - V1_6::WifiRateInfo* hidl_rate) { - if (!hidl_rate) { - return false; - } - *hidl_rate = {}; - hidl_rate->preamble = convertLegacyWifiRatePreambleToHidl(legacy_rate.preamble); - hidl_rate->nss = convertLegacyWifiRateNssToHidl(legacy_rate.nss); - hidl_rate->bw = convertLegacyWifiChannelWidthToHidl( - static_cast(legacy_rate.bw)); - hidl_rate->rateMcsIdx = legacy_rate.rateMcsIdx; - hidl_rate->bitRateInKbps = legacy_rate.bitrate; - return true; -} - -bool convertLegacyRttResultToHidl(const legacy_hal::wifi_rtt_result& legacy_result, - V1_6::RttResult* hidl_result) { - if (!hidl_result) { - return false; - } - *hidl_result = {}; - CHECK(sizeof(legacy_result.addr) == hidl_result->addr.size()); - memcpy(hidl_result->addr.data(), legacy_result.addr, sizeof(legacy_result.addr)); - hidl_result->burstNum = legacy_result.burst_num; - hidl_result->measurementNumber = legacy_result.measurement_number; - hidl_result->successNumber = legacy_result.success_number; - hidl_result->numberPerBurstPeer = legacy_result.number_per_burst_peer; - hidl_result->status = convertLegacyRttStatusToHidl(legacy_result.status); - hidl_result->retryAfterDuration = legacy_result.retry_after_duration; - hidl_result->type = convertLegacyRttTypeToHidl(legacy_result.type); - hidl_result->rssi = legacy_result.rssi; - hidl_result->rssiSpread = legacy_result.rssi_spread; - if (!convertLegacyWifiRateInfoToHidl(legacy_result.tx_rate, &hidl_result->txRate)) { - return false; - } - if (!convertLegacyWifiRateInfoToHidl(legacy_result.rx_rate, &hidl_result->rxRate)) { - return false; - } - hidl_result->rtt = legacy_result.rtt; - hidl_result->rttSd = legacy_result.rtt_sd; - hidl_result->rttSpread = legacy_result.rtt_spread; - hidl_result->distanceInMm = legacy_result.distance_mm; - hidl_result->distanceSdInMm = legacy_result.distance_sd_mm; - hidl_result->distanceSpreadInMm = legacy_result.distance_spread_mm; - hidl_result->timeStampInUs = legacy_result.ts; - hidl_result->burstDurationInMs = legacy_result.burst_duration; - hidl_result->negotiatedBurstNum = legacy_result.negotiated_burst_num; - if (legacy_result.LCI && !convertLegacyIeToHidl(*legacy_result.LCI, &hidl_result->lci)) { - return false; - } - if (legacy_result.LCR && !convertLegacyIeToHidl(*legacy_result.LCR, &hidl_result->lcr)) { - return false; - } - return true; -} - -bool convertLegacyVectorOfRttResultToHidl( - const std::vector& legacy_results, - std::vector* hidl_results) { - if (!hidl_results) { - return false; - } - *hidl_results = {}; - for (const auto legacy_result : legacy_results) { - V1_6::RttResult hidl_result; - if (!convertLegacyRttResultToHidl(*legacy_result, &hidl_result)) { - return false; - } - hidl_results->push_back(hidl_result); - } - return true; -} - -legacy_hal::wifi_interface_type convertHidlIfaceTypeToLegacy(IfaceType hidl_interface_type) { - switch (hidl_interface_type) { - case IfaceType::STA: - return legacy_hal::WIFI_INTERFACE_TYPE_STA; - case IfaceType::AP: - return legacy_hal::WIFI_INTERFACE_TYPE_AP; - case IfaceType::P2P: - return legacy_hal::WIFI_INTERFACE_TYPE_P2P; - case IfaceType::NAN: - return legacy_hal::WIFI_INTERFACE_TYPE_NAN; - } - CHECK(false); -} - -legacy_hal::wifi_multi_sta_use_case convertHidlMultiStaUseCaseToLegacy( - V1_5::IWifiChip::MultiStaUseCase use_case) { - switch (use_case) { - case V1_5::IWifiChip::MultiStaUseCase::DUAL_STA_TRANSIENT_PREFER_PRIMARY: - return legacy_hal::WIFI_DUAL_STA_TRANSIENT_PREFER_PRIMARY; - case V1_5::IWifiChip::MultiStaUseCase::DUAL_STA_NON_TRANSIENT_UNBIASED: - return legacy_hal::WIFI_DUAL_STA_NON_TRANSIENT_UNBIASED; - } - CHECK(false); -} - -bool convertHidlCoexUnsafeChannelToLegacy( - const V1_5::IWifiChip::CoexUnsafeChannel& hidl_unsafe_channel, - legacy_hal::wifi_coex_unsafe_channel* legacy_unsafe_channel) { - if (!legacy_unsafe_channel) { - return false; - } - *legacy_unsafe_channel = {}; - switch (hidl_unsafe_channel.band) { - case V1_5::WifiBand::BAND_24GHZ: - legacy_unsafe_channel->band = legacy_hal::WLAN_MAC_2_4_BAND; - break; - case V1_5::WifiBand::BAND_5GHZ: - legacy_unsafe_channel->band = legacy_hal::WLAN_MAC_5_0_BAND; - break; - default: - return false; - }; - legacy_unsafe_channel->channel = hidl_unsafe_channel.channel; - legacy_unsafe_channel->power_cap_dbm = hidl_unsafe_channel.powerCapDbm; - return true; -} - -bool convertHidlVectorOfCoexUnsafeChannelToLegacy( - const std::vector& hidl_unsafe_channels, - std::vector* legacy_unsafe_channels) { - if (!legacy_unsafe_channels) { - return false; - } - *legacy_unsafe_channels = {}; - for (const auto& hidl_unsafe_channel : hidl_unsafe_channels) { - legacy_hal::wifi_coex_unsafe_channel legacy_unsafe_channel; - if (!hidl_struct_util::convertHidlCoexUnsafeChannelToLegacy(hidl_unsafe_channel, - &legacy_unsafe_channel)) { - return false; - } - legacy_unsafe_channels->push_back(legacy_unsafe_channel); - } - return true; -} - -V1_6::WifiAntennaMode convertLegacyAntennaConfigurationToHidl(uint32_t antenna_cfg) { - switch (antenna_cfg) { - case legacy_hal::WIFI_ANTENNA_1X1: - return V1_6::WifiAntennaMode::WIFI_ANTENNA_MODE_1X1; - case legacy_hal::WIFI_ANTENNA_2X2: - return V1_6::WifiAntennaMode::WIFI_ANTENNA_MODE_2X2; - case legacy_hal::WIFI_ANTENNA_3X3: - return V1_6::WifiAntennaMode::WIFI_ANTENNA_MODE_3X3; - case legacy_hal::WIFI_ANTENNA_4X4: - return V1_6::WifiAntennaMode::WIFI_ANTENNA_MODE_4X4; - default: - return V1_6::WifiAntennaMode::WIFI_ANTENNA_MODE_UNSPECIFIED; - } -} - -bool convertLegacyWifiRadioConfigurationToHidl( - legacy_hal::wifi_radio_configuration* radio_configuration, - V1_6::WifiRadioConfiguration* hidl_radio_configuration) { - if (!hidl_radio_configuration) { - return false; - } - *hidl_radio_configuration = {}; - hidl_radio_configuration->bandInfo = - hidl_struct_util::convertLegacyMacBandToHidlWifiBand(radio_configuration->band); - if (hidl_radio_configuration->bandInfo == V1_5::WifiBand::BAND_UNSPECIFIED) { - LOG(ERROR) << "Unspecified band"; - return false; - } - hidl_radio_configuration->antennaMode = - hidl_struct_util::convertLegacyAntennaConfigurationToHidl( - radio_configuration->antenna_cfg); - return true; -} - -bool convertLegacyRadioCombinationsMatrixToHidl( - legacy_hal::wifi_radio_combination_matrix* legacy_matrix, - WifiRadioCombinationMatrix* hidl_matrix) { - if (!hidl_matrix || !legacy_matrix) { - return false; - } - *hidl_matrix = {}; - - int num_combinations = legacy_matrix->num_radio_combinations; - std::vector radio_combinations_vec; - if (!num_combinations) { - LOG(ERROR) << "zero radio combinations"; - return false; - } - wifi_radio_combination* l_radio_combinations_ptr = legacy_matrix->radio_combinations; - for (int i = 0; i < num_combinations; i++) { - int num_configurations = l_radio_combinations_ptr->num_radio_configurations; - WifiRadioCombination radioCombination; - std::vector radio_configurations_vec; - if (!num_configurations) { - LOG(ERROR) << "zero radio configurations"; - return false; - } - for (int j = 0; j < num_configurations; j++) { - WifiRadioConfiguration radioConfiguration; - wifi_radio_configuration* l_radio_configurations_ptr = - &l_radio_combinations_ptr->radio_configurations[j]; - if (!hidl_struct_util::convertLegacyWifiRadioConfigurationToHidl( - l_radio_configurations_ptr, &radioConfiguration)) { - LOG(ERROR) << "Error converting wifi radio configuration"; - return false; - } - radio_configurations_vec.push_back(radioConfiguration); - } - radioCombination.radioConfigurations = radio_configurations_vec; - radio_combinations_vec.push_back(radioCombination); - l_radio_combinations_ptr = - (wifi_radio_combination*)((u8*)l_radio_combinations_ptr + - sizeof(wifi_radio_combination) + - (sizeof(wifi_radio_configuration) * num_configurations)); - } - hidl_matrix->radioCombinations = radio_combinations_vec; - return true; -} - -} // namespace hidl_struct_util -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/hidl_struct_util.h b/wifi/1.6/default/hidl_struct_util.h deleted file mode 100644 index 2d4a5f13f4..0000000000 --- a/wifi/1.6/default/hidl_struct_util.h +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef HIDL_STRUCT_UTIL_H_ -#define HIDL_STRUCT_UTIL_H_ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "wifi_legacy_hal.h" - -/** - * This file contains a bunch of functions to convert structs from the legacy - * HAL to HIDL and vice versa. - * TODO(b/32093047): Add unit tests for these conversion methods in the VTS test - * suite. - */ -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace hidl_struct_util { -using namespace android::hardware::wifi::V1_0; - -// Chip conversion methods. -bool convertLegacyFeaturesToHidlChipCapabilities(uint64_t legacy_feature_set, - uint32_t legacy_logger_feature_set, - uint32_t* hidl_caps); -bool convertLegacyDebugRingBufferStatusToHidl( - const legacy_hal::wifi_ring_buffer_status& legacy_status, - WifiDebugRingBufferStatus* hidl_status); -bool convertLegacyVectorOfDebugRingBufferStatusToHidl( - const std::vector& legacy_status_vec, - std::vector* hidl_status_vec); -bool convertLegacyWakeReasonStatsToHidl(const legacy_hal::WakeReasonStats& legacy_stats, - WifiDebugHostWakeReasonStats* hidl_stats); -legacy_hal::wifi_power_scenario convertHidlTxPowerScenarioToLegacy( - V1_1::IWifiChip::TxPowerScenario hidl_scenario); -legacy_hal::wifi_latency_mode convertHidlLatencyModeToLegacy( - V1_3::IWifiChip::LatencyMode hidl_latency_mode); -legacy_hal::wifi_power_scenario convertHidlTxPowerScenarioToLegacy_1_2( - V1_2::IWifiChip::TxPowerScenario hidl_scenario); -bool convertLegacyWifiMacInfosToHidl( - const std::vector& legacy_mac_infos, - std::vector* hidl_radio_mode_infos); -legacy_hal::wifi_interface_type convertHidlIfaceTypeToLegacy(IfaceType hidl_interface_type); -legacy_hal::wifi_multi_sta_use_case convertHidlMultiStaUseCaseToLegacy( - V1_5::IWifiChip::MultiStaUseCase use_case); -bool convertHidlCoexUnsafeChannelToLegacy( - const V1_5::IWifiChip::CoexUnsafeChannel& hidl_unsafe_channel, - legacy_hal::wifi_coex_unsafe_channel* legacy_unsafe_channel); -bool convertHidlVectorOfCoexUnsafeChannelToLegacy( - const std::vector& hidl_unsafe_channels, - std::vector* legacy_unsafe_channels); -bool convertLegacyRadioCombinationsMatrixToHidl( - legacy_hal::wifi_radio_combination_matrix* legacy_matrix, - V1_6::WifiRadioCombinationMatrix* hidl_matrix); -V1_5::WifiBand convertLegacyMacBandToHidlWifiBand(uint32_t band); -V1_6::WifiAntennaMode convertLegacyAntennaConfigurationToHidl(uint32_t antenna_cfg); - -// STA iface conversion methods. -bool convertLegacyFeaturesToHidlStaCapabilities(uint64_t legacy_feature_set, - uint32_t legacy_logger_feature_set, - uint32_t* hidl_caps); -bool convertLegacyApfCapabilitiesToHidl(const legacy_hal::PacketFilterCapabilities& legacy_caps, - StaApfPacketFilterCapabilities* hidl_caps); -bool convertLegacyGscanCapabilitiesToHidl(const legacy_hal::wifi_gscan_capabilities& legacy_caps, - StaBackgroundScanCapabilities* hidl_caps); -legacy_hal::wifi_band convertHidlWifiBandToLegacy(V1_0::WifiBand band); -bool convertHidlGscanParamsToLegacy(const StaBackgroundScanParameters& hidl_scan_params, - legacy_hal::wifi_scan_cmd_params* legacy_scan_params); -// |has_ie_data| indicates whether or not the wifi_scan_result includes 802.11 -// Information Elements (IEs) -bool convertLegacyGscanResultToHidl(const legacy_hal::wifi_scan_result& legacy_scan_result, - bool has_ie_data, StaScanResult* hidl_scan_result); -// |cached_results| is assumed to not include IEs. -bool convertLegacyVectorOfCachedGscanResultsToHidl( - const std::vector& legacy_cached_scan_results, - std::vector* hidl_scan_datas); -bool convertLegacyLinkLayerStatsToHidl(const legacy_hal::LinkLayerStats& legacy_stats, - V1_6::StaLinkLayerStats* hidl_stats); -bool convertLegacyRoamingCapabilitiesToHidl( - const legacy_hal::wifi_roaming_capabilities& legacy_caps, - StaRoamingCapabilities* hidl_caps); -bool convertHidlRoamingConfigToLegacy(const StaRoamingConfig& hidl_config, - legacy_hal::wifi_roaming_config* legacy_config); -legacy_hal::fw_roaming_state_t convertHidlRoamingStateToLegacy(StaRoamingState state); -bool convertLegacyVectorOfDebugTxPacketFateToHidl( - const std::vector& legacy_fates, - std::vector* hidl_fates); -bool convertLegacyVectorOfDebugRxPacketFateToHidl( - const std::vector& legacy_fates, - std::vector* hidl_fates); - -// NAN iface conversion methods. -void convertToWifiNanStatus(legacy_hal::NanStatusType type, const char* str, size_t max_len, - WifiNanStatus* wifiNanStatus); -bool convertHidlNanEnableRequestToLegacy(const V1_4::NanEnableRequest& hidl_request, - legacy_hal::NanEnableRequest* legacy_request); -bool convertHidlNanConfigRequestToLegacy(const V1_4::NanConfigRequest& hidl_request, - legacy_hal::NanConfigRequest* legacy_request); -bool convertHidlNanEnableRequest_1_6ToLegacy( - const V1_4::NanEnableRequest& hidl_request1, - const V1_6::NanConfigRequestSupplemental& hidl_request2, - legacy_hal::NanEnableRequest* legacy_request); -bool convertHidlNanConfigRequest_1_6ToLegacy( - const V1_4::NanConfigRequest& hidl_request1, - const V1_6::NanConfigRequestSupplemental& hidl_request2, - legacy_hal::NanConfigRequest* legacy_request); -bool convertHidlNanPublishRequestToLegacy(const V1_6::NanPublishRequest& hidl_request, - legacy_hal::NanPublishRequest* legacy_request); -bool convertHidlNanSubscribeRequestToLegacy(const V1_0::NanSubscribeRequest& hidl_request, - legacy_hal::NanSubscribeRequest* legacy_request); -bool convertHidlNanTransmitFollowupRequestToLegacy( - const NanTransmitFollowupRequest& hidl_request, - legacy_hal::NanTransmitFollowupRequest* legacy_request); -bool convertHidlNanDataPathInitiatorRequestToLegacy( - const V1_0::NanInitiateDataPathRequest& hidl_request, - legacy_hal::NanDataPathInitiatorRequest* legacy_request); -bool convertHidlNanDataPathIndicationResponseToLegacy( - const V1_0::NanRespondToDataPathIndicationRequest& hidl_response, - legacy_hal::NanDataPathIndicationResponse* legacy_response); -bool convertHidlNanDataPathInitiatorRequest_1_6ToLegacy( - const V1_6::NanInitiateDataPathRequest& hidl_request, - legacy_hal::NanDataPathInitiatorRequest* legacy_request); -bool convertHidlNanDataPathIndicationResponse_1_6ToLegacy( - const V1_6::NanRespondToDataPathIndicationRequest& hidl_response, - legacy_hal::NanDataPathIndicationResponse* legacy_response); - -bool convertLegacyNanResponseHeaderToHidl(const legacy_hal::NanResponseMsg& legacy_response, - WifiNanStatus* wifiNanStatus); -bool convertLegacyNanCapabilitiesResponseToHidl(const legacy_hal::NanCapabilities& legacy_response, - V1_6::NanCapabilities* hidl_response); -bool convertLegacyNanMatchIndToHidl(const legacy_hal::NanMatchInd& legacy_ind, - V1_6::NanMatchInd* hidl_ind); -bool convertLegacyNanFollowupIndToHidl(const legacy_hal::NanFollowupInd& legacy_ind, - NanFollowupReceivedInd* hidl_ind); -bool convertLegacyNanDataPathRequestIndToHidl(const legacy_hal::NanDataPathRequestInd& legacy_ind, - NanDataPathRequestInd* hidl_ind); -bool convertLegacyNanDataPathConfirmIndToHidl(const legacy_hal::NanDataPathConfirmInd& legacy_ind, - V1_6::NanDataPathConfirmInd* hidl_ind); -bool convertLegacyNanDataPathScheduleUpdateIndToHidl( - const legacy_hal::NanDataPathScheduleUpdateInd& legacy_ind, - V1_6::NanDataPathScheduleUpdateInd* hidl_ind); - -// RTT controller conversion methods. -bool convertHidlVectorOfRttConfigToLegacy(const std::vector& hidl_configs, - std::vector* legacy_configs); -bool convertHidlRttLciInformationToLegacy(const RttLciInformation& hidl_info, - legacy_hal::wifi_lci_information* legacy_info); -bool convertHidlRttLcrInformationToLegacy(const RttLcrInformation& hidl_info, - legacy_hal::wifi_lcr_information* legacy_info); -bool convertHidlRttResponderToLegacy(const V1_6::RttResponder& hidl_responder, - legacy_hal::wifi_rtt_responder* legacy_responder); -bool convertHidlWifiChannelInfoToLegacy(const V1_6::WifiChannelInfo& hidl_info, - legacy_hal::wifi_channel_info* legacy_info); -bool convertLegacyRttResponderToHidl(const legacy_hal::wifi_rtt_responder& legacy_responder, - V1_6::RttResponder* hidl_responder); -bool convertLegacyRttCapabilitiesToHidl( - const legacy_hal::wifi_rtt_capabilities& legacy_capabilities, - V1_6::RttCapabilities* hidl_capabilities); -bool convertLegacyVectorOfRttResultToHidl( - const std::vector& legacy_results, - std::vector* hidl_results); -uint32_t convertHidlWifiBandToLegacyMacBand(V1_5::WifiBand band); -uint32_t convertHidlWifiIfaceModeToLegacy(uint32_t hidl_iface_mask); -uint32_t convertHidlUsableChannelFilterToLegacy(uint32_t hidl_filter_mask); -bool convertLegacyWifiUsableChannelsToHidl( - const std::vector& legacy_usable_channels, - std::vector* hidl_usable_channels); -bool convertLegacyPeerInfoStatsToHidl(const legacy_hal::WifiPeerInfo& legacy_peer_info_stats, - V1_6::StaPeerInfo* hidl_peer_info_stats); -bool convertLegacyWifiRateInfoToHidl(const legacy_hal::wifi_rate& legacy_rate, - V1_6::WifiRateInfo* hidl_rate); -} // namespace hidl_struct_util -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // HIDL_STRUCT_UTIL_H_ diff --git a/wifi/1.6/default/service.cpp b/wifi/1.6/default/service.cpp deleted file mode 100644 index c874d8b199..0000000000 --- a/wifi/1.6/default/service.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#include -#include -#include -#include -#include -#include - -#include "wifi.h" -#include "wifi_feature_flags.h" -#include "wifi_legacy_hal.h" -#include "wifi_legacy_hal_factory.h" -#include "wifi_mode_controller.h" - -using android::hardware::configureRpcThreadpool; -using android::hardware::joinRpcThreadpool; -using android::hardware::LazyServiceRegistrar; -using android::hardware::wifi::V1_6::implementation::feature_flags::WifiFeatureFlags; -using android::hardware::wifi::V1_6::implementation::legacy_hal::WifiLegacyHal; -using android::hardware::wifi::V1_6::implementation::legacy_hal::WifiLegacyHalFactory; -using android::hardware::wifi::V1_6::implementation::mode_controller::WifiModeController; - -#ifdef LAZY_SERVICE -const bool kLazyService = true; -#else -const bool kLazyService = false; -#endif - -int main(int /*argc*/, char** argv) { - signal(SIGPIPE, SIG_IGN); - android::base::InitLogging(argv, android::base::LogdLogger(android::base::SYSTEM)); - LOG(INFO) << "Wifi Hal is booting up..."; - - configureRpcThreadpool(1, true /* callerWillJoin */); - - const auto iface_tool = std::make_shared(); - const auto legacy_hal_factory = std::make_shared(iface_tool); - - // Setup hwbinder service - android::sp service = - new android::hardware::wifi::V1_6::implementation::Wifi( - iface_tool, legacy_hal_factory, std::make_shared(), - std::make_shared()); - if (kLazyService) { - auto registrar = LazyServiceRegistrar::getInstance(); - CHECK_EQ(registrar.registerService(service), android::NO_ERROR) - << "Failed to register wifi HAL"; - } else { - CHECK_EQ(service->registerAsService(), android::NO_ERROR) << "Failed to register wifi HAL"; - } - - joinRpcThreadpool(); - - LOG(INFO) << "Wifi Hal is terminating..."; - return 0; -} diff --git a/wifi/1.6/default/tests/wifi_nan_iface_unit_tests.cpp b/wifi/1.6/default/tests/wifi_nan_iface_unit_tests.cpp deleted file mode 100644 index 8a5ddcd998..0000000000 --- a/wifi/1.6/default/tests/wifi_nan_iface_unit_tests.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (C) 2019, 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. - */ - -#include -#include -#include -#include - -#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 -#include "wifi_nan_iface.h" - -#include "mock_interface_tool.h" -#include "mock_wifi_feature_flags.h" -#include "mock_wifi_iface_util.h" -#include "mock_wifi_legacy_hal.h" - -using testing::NiceMock; -using testing::Return; -using testing::Test; - -namespace { -constexpr char kIfaceName[] = "mockWlan0"; -} // namespace - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { - -using android::hardware::wifi::V1_2::NanDataPathConfirmInd; - -bool CaptureIfaceEventHandlers(const std::string& /* iface_name*/, - iface_util::IfaceEventHandlers in_iface_event_handlers, - iface_util::IfaceEventHandlers* out_iface_event_handlers) { - *out_iface_event_handlers = in_iface_event_handlers; - return true; -} - -class MockNanIfaceEventCallback : public V1_5::IWifiNanIfaceEventCallback { - public: - MockNanIfaceEventCallback() = default; - - MOCK_METHOD3(notifyCapabilitiesResponse, - Return(uint16_t, const WifiNanStatus&, - const android::hardware::wifi::V1_0::NanCapabilities&)); - MOCK_METHOD2(notifyEnableResponse, Return(uint16_t, const WifiNanStatus&)); - MOCK_METHOD2(notifyConfigResponse, Return(uint16_t, const WifiNanStatus&)); - MOCK_METHOD2(notifyDisableResponse, Return(uint16_t, const WifiNanStatus&)); - MOCK_METHOD3(notifyStartPublishResponse, Return(uint16_t, const WifiNanStatus&, uint8_t)); - MOCK_METHOD2(notifyStopPublishResponse, Return(uint16_t, const WifiNanStatus&)); - MOCK_METHOD3(notifyStartSubscribeResponse, - Return(uint16_t, const WifiNanStatus&, uint8_t)); - MOCK_METHOD2(notifyStopSubscribeResponse, Return(uint16_t, const WifiNanStatus&)); - MOCK_METHOD2(notifyTransmitFollowupResponse, Return(uint16_t, const WifiNanStatus&)); - MOCK_METHOD2(notifyCreateDataInterfaceResponse, Return(uint16_t, const WifiNanStatus&)); - MOCK_METHOD2(notifyDeleteDataInterfaceResponse, Return(uint16_t, const WifiNanStatus&)); - MOCK_METHOD3(notifyInitiateDataPathResponse, - Return(uint16_t, const WifiNanStatus&, uint32_t)); - MOCK_METHOD2(notifyRespondToDataPathIndicationResponse, - Return(uint16_t, const WifiNanStatus&)); - MOCK_METHOD2(notifyTerminateDataPathResponse, Return(uint16_t, const WifiNanStatus&)); - MOCK_METHOD1(eventClusterEvent, Return(const NanClusterEventInd&)); - MOCK_METHOD1(eventDisabled, Return(const WifiNanStatus&)); - MOCK_METHOD2(eventPublishTerminated, Return(uint8_t, const WifiNanStatus&)); - MOCK_METHOD2(eventSubscribeTerminated, Return(uint8_t, const WifiNanStatus&)); - MOCK_METHOD1(eventMatch, Return(const V1_0::NanMatchInd&)); - MOCK_METHOD1(eventMatch_1_6, Return(const NanMatchInd&)); - MOCK_METHOD2(eventMatchExpired, Return(uint8_t, uint32_t)); - MOCK_METHOD1(eventFollowupReceived, Return(const NanFollowupReceivedInd&)); - MOCK_METHOD2(eventTransmitFollowup, Return(uint16_t, const WifiNanStatus&)); - MOCK_METHOD1(eventDataPathRequest, Return(const NanDataPathRequestInd&)); - MOCK_METHOD1(eventDataPathConfirm, - Return(const android::hardware::wifi::V1_0::NanDataPathConfirmInd&)); - MOCK_METHOD1(eventDataPathTerminated, Return(uint32_t)); - MOCK_METHOD1(eventDataPathConfirm_1_2, - Return(const android::hardware::wifi::V1_2::NanDataPathConfirmInd&)); - MOCK_METHOD1(eventDataPathConfirm_1_6, Return(const NanDataPathConfirmInd&)); - MOCK_METHOD1(eventDataPathScheduleUpdate, - Return(const android::hardware::wifi::V1_2::NanDataPathScheduleUpdateInd&)); - MOCK_METHOD1(eventDataPathScheduleUpdate_1_6, - Return(const NanDataPathScheduleUpdateInd&)); - MOCK_METHOD3(notifyCapabilitiesResponse_1_5, - Return(uint16_t, const WifiNanStatus&, const V1_5::NanCapabilities&)); -}; - -class WifiNanIfaceTest : public Test { - protected: - legacy_hal::wifi_hal_fn fake_func_table_; - std::shared_ptr> iface_tool_{ - new NiceMock}; - std::shared_ptr> legacy_hal_{ - new NiceMock(iface_tool_, fake_func_table_, true)}; - std::shared_ptr> iface_util_{ - new NiceMock(iface_tool_, legacy_hal_)}; -}; - -TEST_F(WifiNanIfaceTest, IfacEventHandlers_OnStateToggleOffOn) { - iface_util::IfaceEventHandlers captured_iface_event_handlers = {}; - EXPECT_CALL(*legacy_hal_, nanRegisterCallbackHandlers(testing::_, testing::_)) - .WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS)); - EXPECT_CALL(*iface_util_, registerIfaceEventHandlers(testing::_, testing::_)) - .WillOnce(testing::Invoke(bind(CaptureIfaceEventHandlers, std::placeholders::_1, - std::placeholders::_2, &captured_iface_event_handlers))); - sp nan_iface = new WifiNanIface(kIfaceName, false, legacy_hal_, iface_util_); - - // Register a mock nan event callback. - sp> mock_event_callback{ - new NiceMock}; - nan_iface->registerEventCallback(mock_event_callback, [](const WifiStatus& status) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - }); - // Ensure that the eventDisabled() function in mock callback will be - // invoked. - WifiNanStatus expected_nan_status = {NanStatusType::UNSUPPORTED_CONCURRENCY_NAN_DISABLED, ""}; - EXPECT_CALL(*mock_event_callback, eventDisabled(expected_nan_status)).Times(1); - - // Trigger the iface state toggle callback. - captured_iface_event_handlers.on_state_toggle_off_on(kIfaceName); -} -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/wifi.h b/wifi/1.6/default/wifi.h deleted file mode 100644 index 435358e797..0000000000 --- a/wifi/1.6/default/wifi.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef WIFI_H_ -#define WIFI_H_ - -// HACK: NAN is a macro defined in math.h, which can be included in various -// headers. This wifi HAL uses an enum called NAN, which does not compile when -// the macro is defined. Undefine NAN to work around it. -#undef NAN -#include - -#include -#include -#include - -#include "hidl_callback_util.h" -#include "wifi_chip.h" -#include "wifi_feature_flags.h" -#include "wifi_legacy_hal.h" -#include "wifi_legacy_hal_factory.h" -#include "wifi_mode_controller.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { - -/** - * Root HIDL interface object used to control the Wifi HAL. - */ -class Wifi : public V1_6::IWifi { - public: - Wifi(const std::shared_ptr iface_tool, - const std::shared_ptr legacy_hal_factory, - const std::shared_ptr mode_controller, - const std::shared_ptr feature_flags); - - bool isValid(); - - // HIDL methods exposed. - Return registerEventCallback(const sp& event_callback, - registerEventCallback_cb hidl_status_cb) override; - Return registerEventCallback_1_5(const sp& event_callback, - registerEventCallback_1_5_cb hidl_status_cb) override; - Return isStarted() override; - Return start(start_cb hidl_status_cb) override; - Return stop(stop_cb hidl_status_cb) override; - Return getChipIds(getChipIds_cb hidl_status_cb) override; - Return getChip(ChipId chip_id, getChip_cb hidl_status_cb) override; - Return debug(const hidl_handle& handle, const hidl_vec& options) override; - - private: - enum class RunState { STOPPED, STARTED, STOPPING }; - - // Corresponding worker functions for the HIDL methods. - WifiStatus registerEventCallbackInternal( - const sp& event_callback __unused); - WifiStatus registerEventCallbackInternal_1_5( - const sp& event_callback); - WifiStatus startInternal(); - WifiStatus stopInternal(std::unique_lock* lock); - std::pair> getChipIdsInternal(); - std::pair> getChipInternal(ChipId chip_id); - - WifiStatus initializeModeControllerAndLegacyHal(); - WifiStatus stopLegacyHalAndDeinitializeModeController( - std::unique_lock* lock); - ChipId getChipIdFromWifiChip(sp& chip); - - // Instance is created in this root level |IWifi| HIDL interface object - // and shared with all the child HIDL interface objects. - std::shared_ptr iface_tool_; - std::shared_ptr legacy_hal_factory_; - std::shared_ptr mode_controller_; - std::vector> legacy_hals_; - std::shared_ptr feature_flags_; - RunState run_state_; - std::vector> chips_; - hidl_callback_util::HidlCallbackHandler event_cb_handler_; - - DISALLOW_COPY_AND_ASSIGN(Wifi); -}; - -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // WIFI_H_ diff --git a/wifi/1.6/default/wifi_ap_iface.h b/wifi/1.6/default/wifi_ap_iface.h deleted file mode 100644 index d1c06424df..0000000000 --- a/wifi/1.6/default/wifi_ap_iface.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef WIFI_AP_IFACE_H_ -#define WIFI_AP_IFACE_H_ - -#include -#include - -#include "wifi_iface_util.h" -#include "wifi_legacy_hal.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -using namespace android::hardware::wifi::V1_0; - -/** - * HIDL interface object used to control a AP Iface instance. - */ -class WifiApIface : public V1_5::IWifiApIface { - public: - WifiApIface(const std::string& ifname, const std::vector& instances, - const std::weak_ptr legacy_hal, - const std::weak_ptr iface_util); - // Refer to |WifiChip::invalidate()|. - void invalidate(); - bool isValid(); - std::string getName(); - void removeInstance(std::string instance); - - // HIDL methods exposed. - Return getName(getName_cb hidl_status_cb) override; - Return getType(getType_cb hidl_status_cb) override; - Return setCountryCode(const hidl_array& code, - setCountryCode_cb hidl_status_cb) override; - Return getValidFrequenciesForBand(V1_0::WifiBand band, - getValidFrequenciesForBand_cb hidl_status_cb) override; - Return setMacAddress(const hidl_array& mac, - setMacAddress_cb hidl_status_cb) override; - Return getFactoryMacAddress(getFactoryMacAddress_cb hidl_status_cb) override; - Return resetToFactoryMacAddress(resetToFactoryMacAddress_cb hidl_status_cb) override; - - Return getBridgedInstances(getBridgedInstances_cb hidl_status_cb) override; - - private: - // Corresponding worker functions for the HIDL methods. - std::pair getNameInternal(); - std::pair getTypeInternal(); - WifiStatus setCountryCodeInternal(const std::array& code); - std::pair> getValidFrequenciesForBandInternal( - V1_0::WifiBand band); - WifiStatus setMacAddressInternal(const std::array& mac); - std::pair> getFactoryMacAddressInternal( - const std::string& ifaceName); - WifiStatus resetToFactoryMacAddressInternal(); - std::pair> getBridgedInstancesInternal(); - - std::string ifname_; - std::vector instances_; - std::weak_ptr legacy_hal_; - std::weak_ptr iface_util_; - bool is_valid_; - - DISALLOW_COPY_AND_ASSIGN(WifiApIface); -}; - -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // WIFI_AP_IFACE_H_ diff --git a/wifi/1.6/default/wifi_chip.h b/wifi/1.6/default/wifi_chip.h deleted file mode 100644 index e8ddaa6f9e..0000000000 --- a/wifi/1.6/default/wifi_chip.h +++ /dev/null @@ -1,317 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef WIFI_CHIP_H_ -#define WIFI_CHIP_H_ - -// HACK: NAN is a macro defined in math.h, which can be included in various -// headers. This wifi HAL uses an enum called NAN, which does not compile when -// the macro is defined. Undefine NAN to work around it. -#undef NAN - -#include -#include -#include - -#include -#include -#include -#include - -#include "hidl_callback_util.h" -#include "ringbuffer.h" -#include "wifi_ap_iface.h" -#include "wifi_feature_flags.h" -#include "wifi_legacy_hal.h" -#include "wifi_mode_controller.h" -#include "wifi_nan_iface.h" -#include "wifi_p2p_iface.h" -#include "wifi_rtt_controller.h" -#include "wifi_sta_iface.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -using namespace android::hardware::wifi::V1_0; -using V1_5::WifiBand; - -/** - * HIDL interface object used to control a Wifi HAL chip instance. - * Since there is only a single chip instance used today, there is no - * identifying handle information stored here. - */ -class WifiChip : public V1_6::IWifiChip { - public: - WifiChip(ChipId chip_id, bool is_primary, - const std::weak_ptr legacy_hal, - const std::weak_ptr mode_controller, - const std::shared_ptr iface_util, - const std::weak_ptr feature_flags, - const std::function& subsystemCallbackHandler); - // HIDL does not provide a built-in mechanism to let the server invalidate - // a HIDL interface object after creation. If any client process holds onto - // a reference to the object in their context, any method calls on that - // reference will continue to be directed to the server. - // - // However Wifi HAL needs to control the lifetime of these objects. So, add - // a public |invalidate| method to |WifiChip| and it's child objects. This - // will be used to mark an object invalid when either: - // a) Wifi HAL is stopped, or - // b) Wifi Chip is reconfigured. - // - // All HIDL method implementations should check if the object is still - // marked valid before processing them. - void invalidate(); - bool isValid(); - std::set> getEventCallbacks(); - - // HIDL methods exposed. - Return getId(getId_cb hidl_status_cb) override; - // Deprecated support for this callback - Return registerEventCallback(const sp& event_callback, - registerEventCallback_cb hidl_status_cb) override; - Return getCapabilities(getCapabilities_cb hidl_status_cb) override; - Return getAvailableModes(getAvailableModes_cb hidl_status_cb) override; - Return configureChip(ChipModeId mode_id, configureChip_cb hidl_status_cb) override; - Return getMode(getMode_cb hidl_status_cb) override; - Return requestChipDebugInfo(requestChipDebugInfo_cb hidl_status_cb) override; - Return requestDriverDebugDump(requestDriverDebugDump_cb hidl_status_cb) override; - Return requestFirmwareDebugDump(requestFirmwareDebugDump_cb hidl_status_cb) override; - Return createApIface(createApIface_cb hidl_status_cb) override; - Return createBridgedApIface(createBridgedApIface_cb hidl_status_cb) override; - Return getApIfaceNames(getApIfaceNames_cb hidl_status_cb) override; - Return getApIface(const hidl_string& ifname, getApIface_cb hidl_status_cb) override; - Return removeApIface(const hidl_string& ifname, removeApIface_cb hidl_status_cb) override; - Return removeIfaceInstanceFromBridgedApIface( - const hidl_string& brIfaceName, const hidl_string& ifaceInstanceName, - removeIfaceInstanceFromBridgedApIface_cb hidl_status_cb) override; - Return createNanIface(createNanIface_cb hidl_status_cb) override; - Return getNanIfaceNames(getNanIfaceNames_cb hidl_status_cb) override; - Return getNanIface(const hidl_string& ifname, getNanIface_cb hidl_status_cb) override; - Return removeNanIface(const hidl_string& ifname, - removeNanIface_cb hidl_status_cb) override; - Return createP2pIface(createP2pIface_cb hidl_status_cb) override; - Return getP2pIfaceNames(getP2pIfaceNames_cb hidl_status_cb) override; - Return getP2pIface(const hidl_string& ifname, getP2pIface_cb hidl_status_cb) override; - Return removeP2pIface(const hidl_string& ifname, - removeP2pIface_cb hidl_status_cb) override; - Return createStaIface(createStaIface_cb hidl_status_cb) override; - Return getStaIfaceNames(getStaIfaceNames_cb hidl_status_cb) override; - Return getStaIface(const hidl_string& ifname, getStaIface_cb hidl_status_cb) override; - Return removeStaIface(const hidl_string& ifname, - removeStaIface_cb hidl_status_cb) override; - Return createRttController(const sp& bound_iface, - createRttController_cb hidl_status_cb) override; - Return getDebugRingBuffersStatus(getDebugRingBuffersStatus_cb hidl_status_cb) override; - Return startLoggingToDebugRingBuffer( - const hidl_string& ring_name, WifiDebugRingBufferVerboseLevel verbose_level, - uint32_t max_interval_in_sec, uint32_t min_data_size_in_bytes, - startLoggingToDebugRingBuffer_cb hidl_status_cb) override; - Return forceDumpToDebugRingBuffer(const hidl_string& ring_name, - forceDumpToDebugRingBuffer_cb hidl_status_cb) override; - Return flushRingBufferToFile(flushRingBufferToFile_cb hidl_status_cb) override; - Return stopLoggingToDebugRingBuffer( - stopLoggingToDebugRingBuffer_cb hidl_status_cb) override; - Return getDebugHostWakeReasonStats( - getDebugHostWakeReasonStats_cb hidl_status_cb) override; - Return enableDebugErrorAlerts(bool enable, - enableDebugErrorAlerts_cb hidl_status_cb) override; - Return selectTxPowerScenario(V1_1::IWifiChip::TxPowerScenario scenario, - selectTxPowerScenario_cb hidl_status_cb) override; - Return resetTxPowerScenario(resetTxPowerScenario_cb hidl_status_cb) override; - Return setLatencyMode(LatencyMode mode, setLatencyMode_cb hidl_status_cb) override; - Return registerEventCallback_1_2(const sp& event_callback, - registerEventCallback_1_2_cb hidl_status_cb) override; - Return selectTxPowerScenario_1_2(TxPowerScenario scenario, - selectTxPowerScenario_cb hidl_status_cb) override; - Return getCapabilities_1_3(getCapabilities_cb hidl_status_cb) override; - Return getCapabilities_1_5(getCapabilities_1_5_cb hidl_status_cb) override; - Return debug(const hidl_handle& handle, const hidl_vec& options) override; - Return createRttController_1_4(const sp& bound_iface, - createRttController_1_4_cb hidl_status_cb) override; - Return registerEventCallback_1_4(const sp& event_callback, - registerEventCallback_1_4_cb hidl_status_cb) override; - Return setMultiStaPrimaryConnection( - const hidl_string& ifname, setMultiStaPrimaryConnection_cb hidl_status_cb) override; - Return setMultiStaUseCase(MultiStaUseCase use_case, - setMultiStaUseCase_cb hidl_status_cb) override; - Return setCoexUnsafeChannels(const hidl_vec& unsafe_channels, - hidl_bitfield restrictions, - setCoexUnsafeChannels_cb hidl_status_cb) override; - Return setCountryCode(const hidl_array& code, - setCountryCode_cb _hidl_cb) override; - Return getUsableChannels(WifiBand band, hidl_bitfield ifaceModeMask, - hidl_bitfield filterMask, - getUsableChannels_cb _hidl_cb) override; - Return triggerSubsystemRestart(triggerSubsystemRestart_cb hidl_status_cb) override; - Return createRttController_1_6(const sp& bound_iface, - createRttController_1_6_cb hidl_status_cb) override; - Return getUsableChannels_1_6(WifiBand band, - hidl_bitfield ifaceModeMask, - hidl_bitfield filterMask, - getUsableChannels_1_6_cb _hidl_cb) override; - Return getSupportedRadioCombinationsMatrix( - getSupportedRadioCombinationsMatrix_cb hidl_status_cb) override; - Return getAvailableModes_1_6(getAvailableModes_1_6_cb hidl_status_cb) override; - - private: - void invalidateAndRemoveAllIfaces(); - // When a STA iface is removed any dependent NAN-ifaces/RTT-controllers are - // invalidated & removed. - void invalidateAndRemoveDependencies(const std::string& removed_iface_name); - - // Corresponding worker functions for the HIDL methods. - std::pair getIdInternal(); - // Deprecated support for this callback - WifiStatus registerEventCallbackInternal( - const sp& event_callback); - std::pair getCapabilitiesInternal(); - std::pair> getAvailableModesInternal(); - WifiStatus configureChipInternal(std::unique_lock* lock, - ChipModeId mode_id); - std::pair getModeInternal(); - std::pair requestChipDebugInfoInternal(); - std::pair> requestDriverDebugDumpInternal(); - std::pair> requestFirmwareDebugDumpInternal(); - sp newWifiApIface(std::string& ifname); - WifiStatus createVirtualApInterface(const std::string& apVirtIf); - std::pair> createApIfaceInternal(); - std::pair> createBridgedApIfaceInternal(); - std::pair> getApIfaceNamesInternal(); - std::pair> getApIfaceInternal(const std::string& ifname); - WifiStatus removeApIfaceInternal(const std::string& ifname); - WifiStatus removeIfaceInstanceFromBridgedApIfaceInternal(const std::string& brIfaceName, - const std::string& ifInstanceName); - std::pair> createNanIfaceInternal(); - std::pair> getNanIfaceNamesInternal(); - std::pair> getNanIfaceInternal(const std::string& ifname); - WifiStatus removeNanIfaceInternal(const std::string& ifname); - std::pair> createP2pIfaceInternal(); - std::pair> getP2pIfaceNamesInternal(); - std::pair> getP2pIfaceInternal(const std::string& ifname); - WifiStatus removeP2pIfaceInternal(const std::string& ifname); - std::pair> createStaIfaceInternal(); - std::pair> getStaIfaceNamesInternal(); - std::pair> getStaIfaceInternal(const std::string& ifname); - WifiStatus removeStaIfaceInternal(const std::string& ifname); - std::pair> createRttControllerInternal( - const sp& bound_iface); - std::pair> - getDebugRingBuffersStatusInternal(); - WifiStatus startLoggingToDebugRingBufferInternal(const hidl_string& ring_name, - WifiDebugRingBufferVerboseLevel verbose_level, - uint32_t max_interval_in_sec, - uint32_t min_data_size_in_bytes); - WifiStatus forceDumpToDebugRingBufferInternal(const hidl_string& ring_name); - WifiStatus flushRingBufferToFileInternal(); - WifiStatus stopLoggingToDebugRingBufferInternal(); - std::pair getDebugHostWakeReasonStatsInternal(); - WifiStatus enableDebugErrorAlertsInternal(bool enable); - WifiStatus selectTxPowerScenarioInternal(V1_1::IWifiChip::TxPowerScenario scenario); - WifiStatus resetTxPowerScenarioInternal(); - WifiStatus setLatencyModeInternal(LatencyMode mode); - WifiStatus registerEventCallbackInternal_1_2( - const sp& event_callback); - WifiStatus selectTxPowerScenarioInternal_1_2(TxPowerScenario scenario); - std::pair getCapabilitiesInternal_1_3(); - std::pair getCapabilitiesInternal_1_5(); - std::pair> createRttControllerInternal_1_4( - const sp& bound_iface); - WifiStatus registerEventCallbackInternal_1_4( - const sp& event_callback); - WifiStatus setMultiStaPrimaryConnectionInternal(const std::string& ifname); - WifiStatus setMultiStaUseCaseInternal(MultiStaUseCase use_case); - WifiStatus setCoexUnsafeChannelsInternal(std::vector unsafe_channels, - uint32_t restrictions); - WifiStatus setCountryCodeInternal(const std::array& code); - std::pair> getUsableChannelsInternal( - WifiBand band, uint32_t ifaceModeMask, uint32_t filterMask); - WifiStatus handleChipConfiguration(std::unique_lock* lock, - ChipModeId mode_id); - WifiStatus registerDebugRingBufferCallback(); - WifiStatus registerRadioModeChangeCallback(); - std::vector - getCurrentModeConcurrencyCombinations(); - std::map getCurrentConcurrencyCombination(); - std::vector> expandConcurrencyCombinations( - const V1_6::IWifiChip::ChipConcurrencyCombination& combination); - bool canExpandedConcurrencyComboSupportConcurrencyTypeWithCurrentTypes( - const std::map& expanded_combo, - IfaceConcurrencyType requested_type); - bool canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType requested_type); - bool canExpandedConcurrencyComboSupportConcurrencyCombo( - const std::map& expanded_combo, - const std::map& req_combo); - bool canCurrentModeSupportConcurrencyCombo( - const std::map& req_combo); - bool canCurrentModeSupportConcurrencyType(IfaceConcurrencyType requested_type); - bool isValidModeId(ChipModeId mode_id); - bool isStaApConcurrencyAllowedInCurrentMode(); - bool isDualStaConcurrencyAllowedInCurrentMode(); - uint32_t startIdxOfApIface(); - std::string getFirstActiveWlanIfaceName(); - std::string allocateApOrStaIfaceName(IfaceType type, uint32_t start_idx); - std::string allocateApIfaceName(); - std::vector allocateBridgedApInstanceNames(); - std::string allocateStaIfaceName(); - bool writeRingbufferFilesInternal(); - std::string getWlanIfaceNameWithType(IfaceType type, unsigned idx); - void invalidateAndClearBridgedApAll(); - void deleteApIface(const std::string& if_name); - bool findUsingNameFromBridgedApInstances(const std::string& name); - WifiStatus triggerSubsystemRestartInternal(); - std::pair> createRttControllerInternal_1_6( - const sp& bound_iface); - std::pair> getUsableChannelsInternal_1_6( - WifiBand band, uint32_t ifaceModeMask, uint32_t filterMask); - std::pair getSupportedRadioCombinationsMatrixInternal(); - std::pair> getAvailableModesInternal_1_6(); - - ChipId chip_id_; - std::weak_ptr legacy_hal_; - std::weak_ptr mode_controller_; - std::shared_ptr iface_util_; - std::vector> ap_ifaces_; - std::vector> nan_ifaces_; - std::vector> p2p_ifaces_; - std::vector> sta_ifaces_; - std::vector> rtt_controllers_; - std::map ringbuffer_map_; - bool is_valid_; - // Members pertaining to chip configuration. - uint32_t current_mode_id_; - std::mutex lock_t; - std::vector modes_; - // The legacy ring buffer callback API has only a global callback - // registration mechanism. Use this to check if we have already - // registered a callback. - bool debug_ring_buffer_cb_registered_; - hidl_callback_util::HidlCallbackHandler event_cb_handler_; - - const std::function subsystemCallbackHandler_; - std::map> br_ifaces_ap_instances_; - DISALLOW_COPY_AND_ASSIGN(WifiChip); -}; - -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // WIFI_CHIP_H_ diff --git a/wifi/1.6/default/wifi_nan_iface.cpp b/wifi/1.6/default/wifi_nan_iface.cpp deleted file mode 100644 index ac2ebc940e..0000000000 --- a/wifi/1.6/default/wifi_nan_iface.cpp +++ /dev/null @@ -1,1016 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#include - -#include "hidl_return_util.h" -#include "hidl_struct_util.h" -#include "wifi_nan_iface.h" -#include "wifi_status_util.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -using hidl_return_util::validateAndCall; - -WifiNanIface::WifiNanIface(const std::string& ifname, bool is_dedicated_iface, - const std::weak_ptr legacy_hal, - const std::weak_ptr iface_util) - : ifname_(ifname), - is_dedicated_iface_(is_dedicated_iface), - legacy_hal_(legacy_hal), - iface_util_(iface_util), - is_valid_(true) { - if (is_dedicated_iface_) { - // If using a dedicated iface, set the iface up first. - if (!iface_util_.lock()->setUpState(ifname_, true)) { - // Fatal failure, invalidate the iface object. - invalidate(); - return; - } - } - // Register all the callbacks here. these should be valid for the lifetime - // of the object. Whenever the mode changes legacy HAL will remove - // all of these callbacks. - legacy_hal::NanCallbackHandlers callback_handlers; - android::wp weak_ptr_this(this); - - // Callback for response. - callback_handlers.on_notify_response = [weak_ptr_this](legacy_hal::transaction_id id, - const legacy_hal::NanResponseMsg& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - WifiNanStatus wifiNanStatus; - if (!hidl_struct_util::convertLegacyNanResponseHeaderToHidl(msg, &wifiNanStatus)) { - LOG(ERROR) << "Failed to convert nan response header"; - return; - } - - switch (msg.response_type) { - case legacy_hal::NAN_RESPONSE_ENABLED: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyEnableResponse(id, wifiNanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_DISABLED: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyDisableResponse(id, wifiNanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_PUBLISH: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyStartPublishResponse(id, wifiNanStatus, - msg.body.publish_response.publish_id) - .isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_PUBLISH_CANCEL: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyStopPublishResponse(id, wifiNanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_TRANSMIT_FOLLOWUP: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyTransmitFollowupResponse(id, wifiNanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_SUBSCRIBE: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyStartSubscribeResponse( - id, wifiNanStatus, - msg.body.subscribe_response.subscribe_id) - .isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_SUBSCRIBE_CANCEL: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyStopSubscribeResponse(id, wifiNanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_CONFIG: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyConfigResponse(id, wifiNanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_GET_CAPABILITIES: { - V1_6::NanCapabilities hidl_struct; - if (!hidl_struct_util::convertLegacyNanCapabilitiesResponseToHidl( - msg.body.nan_capabilities, &hidl_struct)) { - LOG(ERROR) << "Failed to convert nan capabilities response"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks_1_6()) { - if (!callback->notifyCapabilitiesResponse_1_6(id, wifiNanStatus, hidl_struct) - .isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_DP_INTERFACE_CREATE: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyCreateDataInterfaceResponse(id, wifiNanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_DP_INTERFACE_DELETE: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyDeleteDataInterfaceResponse(id, wifiNanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_DP_INITIATOR_RESPONSE: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyInitiateDataPathResponse( - id, wifiNanStatus, - msg.body.data_request_response.ndp_instance_id) - .isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_DP_RESPONDER_RESPONSE: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyRespondToDataPathIndicationResponse(id, wifiNanStatus) - .isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_DP_END: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyTerminateDataPathResponse(id, wifiNanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_BEACON_SDF_PAYLOAD: - /* fall through */ - case legacy_hal::NAN_RESPONSE_TCA: - /* fall through */ - case legacy_hal::NAN_RESPONSE_STATS: - /* fall through */ - case legacy_hal::NAN_RESPONSE_ERROR: - /* fall through */ - default: - LOG(ERROR) << "Unknown or unhandled response type: " << msg.response_type; - return; - } - }; - - callback_handlers.on_event_disc_eng_event = - [weak_ptr_this](const legacy_hal::NanDiscEngEventInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - NanClusterEventInd hidl_struct; - // event types defined identically - hence can be cast - hidl_struct.eventType = (NanClusterEventType)msg.event_type; - hidl_struct.addr = msg.data.mac_addr.addr; - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventClusterEvent(hidl_struct).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_disabled = [weak_ptr_this](const legacy_hal::NanDisabledInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - WifiNanStatus status; - hidl_struct_util::convertToWifiNanStatus(msg.reason, msg.nan_reason, sizeof(msg.nan_reason), - &status); - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventDisabled(status).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_publish_terminated = - [weak_ptr_this](const legacy_hal::NanPublishTerminatedInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - WifiNanStatus status; - hidl_struct_util::convertToWifiNanStatus(msg.reason, msg.nan_reason, - sizeof(msg.nan_reason), &status); - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventPublishTerminated(msg.publish_id, status).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_subscribe_terminated = - [weak_ptr_this](const legacy_hal::NanSubscribeTerminatedInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - WifiNanStatus status; - hidl_struct_util::convertToWifiNanStatus(msg.reason, msg.nan_reason, - sizeof(msg.nan_reason), &status); - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventSubscribeTerminated(msg.subscribe_id, status).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_match = [weak_ptr_this](const legacy_hal::NanMatchInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - V1_6::NanMatchInd hidl_struct; - if (!hidl_struct_util::convertLegacyNanMatchIndToHidl(msg, &hidl_struct)) { - LOG(ERROR) << "Failed to convert nan capabilities response"; - return; - } - - for (const auto& callback : shared_ptr_this->getEventCallbacks_1_6()) { - if (!callback->eventMatch_1_6(hidl_struct).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_match_expired = [weak_ptr_this]( - const legacy_hal::NanMatchExpiredInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventMatchExpired(msg.publish_subscribe_id, msg.requestor_instance_id) - .isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_followup = [weak_ptr_this](const legacy_hal::NanFollowupInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - NanFollowupReceivedInd hidl_struct; - if (!hidl_struct_util::convertLegacyNanFollowupIndToHidl(msg, &hidl_struct)) { - LOG(ERROR) << "Failed to convert nan capabilities response"; - return; - } - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventFollowupReceived(hidl_struct).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_transmit_follow_up = - [weak_ptr_this](const legacy_hal::NanTransmitFollowupInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - WifiNanStatus status; - hidl_struct_util::convertToWifiNanStatus(msg.reason, msg.nan_reason, - sizeof(msg.nan_reason), &status); - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventTransmitFollowup(msg.id, status).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_data_path_request = - [weak_ptr_this](const legacy_hal::NanDataPathRequestInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - NanDataPathRequestInd hidl_struct; - if (!hidl_struct_util::convertLegacyNanDataPathRequestIndToHidl(msg, - &hidl_struct)) { - LOG(ERROR) << "Failed to convert nan capabilities response"; - return; - } - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventDataPathRequest(hidl_struct).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_data_path_confirm = - [weak_ptr_this](const legacy_hal::NanDataPathConfirmInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - V1_6::NanDataPathConfirmInd hidl_struct; - if (!hidl_struct_util::convertLegacyNanDataPathConfirmIndToHidl(msg, - &hidl_struct)) { - LOG(ERROR) << "Failed to convert nan capabilities response"; - return; - } - - for (const auto& callback : shared_ptr_this->getEventCallbacks_1_6()) { - if (!callback->eventDataPathConfirm_1_6(hidl_struct).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_data_path_end = - [weak_ptr_this](const legacy_hal::NanDataPathEndInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - for (int i = 0; i < msg.num_ndp_instances; ++i) { - if (!callback->eventDataPathTerminated(msg.ndp_instance_id[i]).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - } - }; - - callback_handlers.on_event_beacon_sdf_payload = - [weak_ptr_this](const legacy_hal::NanBeaconSdfPayloadInd& /* msg */) { - LOG(ERROR) << "on_event_beacon_sdf_payload - should not be called"; - }; - - callback_handlers.on_event_range_request = - [weak_ptr_this](const legacy_hal::NanRangeRequestInd& /* msg */) { - LOG(ERROR) << "on_event_range_request - should not be called"; - }; - - callback_handlers.on_event_range_report = - [weak_ptr_this](const legacy_hal::NanRangeReportInd& /* msg */) { - LOG(ERROR) << "on_event_range_report - should not be called"; - }; - - callback_handlers.on_event_schedule_update = - [weak_ptr_this](const legacy_hal::NanDataPathScheduleUpdateInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - V1_6::NanDataPathScheduleUpdateInd hidl_struct; - if (!hidl_struct_util::convertLegacyNanDataPathScheduleUpdateIndToHidl( - msg, &hidl_struct)) { - LOG(ERROR) << "Failed to convert nan capabilities response"; - return; - } - - for (const auto& callback : shared_ptr_this->getEventCallbacks_1_6()) { - if (!callback->eventDataPathScheduleUpdate_1_6(hidl_struct).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanRegisterCallbackHandlers(ifname_, callback_handlers); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - LOG(ERROR) << "Failed to register nan callbacks. Invalidating object"; - invalidate(); - } - - // Register for iface state toggle events. - iface_util::IfaceEventHandlers event_handlers = {}; - event_handlers.on_state_toggle_off_on = [weak_ptr_this](const std::string& /* iface_name */) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - // Tell framework that NAN has been disabled. - WifiNanStatus status = {NanStatusType::UNSUPPORTED_CONCURRENCY_NAN_DISABLED, ""}; - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventDisabled(status).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - iface_util_.lock()->registerIfaceEventHandlers(ifname_, event_handlers); -} - -void WifiNanIface::invalidate() { - if (!isValid()) { - return; - } - // send commands to HAL to actually disable and destroy interfaces - legacy_hal_.lock()->nanDisableRequest(ifname_, 0xFFFF); - legacy_hal_.lock()->nanDataInterfaceDelete(ifname_, 0xFFFE, "aware_data0"); - legacy_hal_.lock()->nanDataInterfaceDelete(ifname_, 0xFFFD, "aware_data1"); - iface_util_.lock()->unregisterIfaceEventHandlers(ifname_); - legacy_hal_.reset(); - event_cb_handler_.invalidate(); - event_cb_handler_1_2_.invalidate(); - event_cb_handler_1_5_.invalidate(); - is_valid_ = false; - if (is_dedicated_iface_) { - // If using a dedicated iface, set the iface down. - iface_util_.lock()->setUpState(ifname_, false); - } -} - -bool WifiNanIface::isValid() { - return is_valid_; -} - -std::string WifiNanIface::getName() { - return ifname_; -} - -std::set> WifiNanIface::getEventCallbacks() { - return event_cb_handler_.getCallbacks(); -} - -std::set> WifiNanIface::getEventCallbacks_1_2() { - return event_cb_handler_1_2_.getCallbacks(); -} - -std::set> WifiNanIface::getEventCallbacks_1_5() { - return event_cb_handler_1_5_.getCallbacks(); -} - -std::set> WifiNanIface::getEventCallbacks_1_6() { - return event_cb_handler_1_6_.getCallbacks(); -} - -Return WifiNanIface::getName(getName_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::getNameInternal, hidl_status_cb); -} - -Return WifiNanIface::getType(getType_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::getTypeInternal, hidl_status_cb); -} - -Return WifiNanIface::registerEventCallback( - const sp& callback, - registerEventCallback_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::registerEventCallbackInternal, hidl_status_cb, callback); -} - -Return WifiNanIface::getCapabilitiesRequest(uint16_t cmd_id, - getCapabilitiesRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::getCapabilitiesRequestInternal, hidl_status_cb, cmd_id); -} - -Return WifiNanIface::enableRequest(uint16_t cmd_id, const V1_0::NanEnableRequest& msg, - enableRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::enableRequestInternal, hidl_status_cb, cmd_id, msg); -} - -Return WifiNanIface::configRequest(uint16_t cmd_id, const V1_0::NanConfigRequest& msg, - configRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::configRequestInternal, hidl_status_cb, cmd_id, msg); -} - -Return WifiNanIface::disableRequest(uint16_t cmd_id, disableRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::disableRequestInternal, hidl_status_cb, cmd_id); -} - -Return WifiNanIface::startPublishRequest(uint16_t cmd_id, const V1_0::NanPublishRequest& msg, - startPublishRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::startPublishRequestInternal, hidl_status_cb, cmd_id, msg); -} - -Return WifiNanIface::stopPublishRequest(uint16_t cmd_id, uint8_t sessionId, - stopPublishRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::stopPublishRequestInternal, hidl_status_cb, cmd_id, - sessionId); -} - -Return WifiNanIface::startSubscribeRequest(uint16_t cmd_id, - const V1_0::NanSubscribeRequest& msg, - startSubscribeRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::startSubscribeRequestInternal, hidl_status_cb, cmd_id, - msg); -} - -Return WifiNanIface::stopSubscribeRequest(uint16_t cmd_id, uint8_t sessionId, - stopSubscribeRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::stopSubscribeRequestInternal, hidl_status_cb, cmd_id, - sessionId); -} - -Return WifiNanIface::transmitFollowupRequest(uint16_t cmd_id, - const NanTransmitFollowupRequest& msg, - transmitFollowupRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::transmitFollowupRequestInternal, hidl_status_cb, cmd_id, - msg); -} - -Return WifiNanIface::createDataInterfaceRequest( - uint16_t cmd_id, const hidl_string& iface_name, - createDataInterfaceRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::createDataInterfaceRequestInternal, hidl_status_cb, - cmd_id, iface_name); -} - -Return WifiNanIface::deleteDataInterfaceRequest( - uint16_t cmd_id, const hidl_string& iface_name, - deleteDataInterfaceRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::deleteDataInterfaceRequestInternal, hidl_status_cb, - cmd_id, iface_name); -} - -Return WifiNanIface::initiateDataPathRequest(uint16_t cmd_id, - const V1_0::NanInitiateDataPathRequest& msg, - initiateDataPathRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::initiateDataPathRequestInternal, hidl_status_cb, cmd_id, - msg); -} - -Return WifiNanIface::respondToDataPathIndicationRequest( - uint16_t cmd_id, const V1_0::NanRespondToDataPathIndicationRequest& msg, - respondToDataPathIndicationRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::respondToDataPathIndicationRequestInternal, - hidl_status_cb, cmd_id, msg); -} - -Return WifiNanIface::terminateDataPathRequest(uint16_t cmd_id, uint32_t ndpInstanceId, - terminateDataPathRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::terminateDataPathRequestInternal, hidl_status_cb, cmd_id, - ndpInstanceId); -} - -Return WifiNanIface::registerEventCallback_1_2( - const sp& callback, - registerEventCallback_1_2_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::registerEventCallback_1_2Internal, hidl_status_cb, - callback); -} - -Return WifiNanIface::enableRequest_1_2(uint16_t cmd_id, const V1_0::NanEnableRequest& msg1, - const V1_2::NanConfigRequestSupplemental& msg2, - enableRequest_1_2_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::enableRequest_1_2Internal, hidl_status_cb, cmd_id, msg1, - msg2); -} - -Return WifiNanIface::configRequest_1_2(uint16_t cmd_id, const V1_0::NanConfigRequest& msg1, - const V1_2::NanConfigRequestSupplemental& msg2, - configRequest_1_2_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::configRequest_1_2Internal, hidl_status_cb, cmd_id, msg1, - msg2); -} - -Return WifiNanIface::enableRequest_1_4(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, - const V1_2::NanConfigRequestSupplemental& msg2, - enableRequest_1_4_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::enableRequest_1_4Internal, hidl_status_cb, cmd_id, msg1, - msg2); -} - -Return WifiNanIface::configRequest_1_4(uint16_t cmd_id, const V1_4::NanConfigRequest& msg1, - const V1_2::NanConfigRequestSupplemental& msg2, - configRequest_1_4_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::configRequest_1_4Internal, hidl_status_cb, cmd_id, msg1, - msg2); -} - -Return WifiNanIface::registerEventCallback_1_5( - const sp& callback, - registerEventCallback_1_5_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::registerEventCallback_1_5Internal, hidl_status_cb, - callback); -} - -Return WifiNanIface::enableRequest_1_5(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, - const V1_5::NanConfigRequestSupplemental& msg2, - enableRequest_1_5_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::enableRequest_1_5Internal, hidl_status_cb, cmd_id, msg1, - msg2); -} - -Return WifiNanIface::configRequest_1_5(uint16_t cmd_id, const V1_4::NanConfigRequest& msg1, - const V1_5::NanConfigRequestSupplemental& msg2, - configRequest_1_5_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::configRequest_1_5Internal, hidl_status_cb, cmd_id, msg1, - msg2); -} - -Return WifiNanIface::getCapabilitiesRequest_1_5( - uint16_t cmd_id, getCapabilitiesRequest_1_5_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::getCapabilitiesRequest_1_5Internal, hidl_status_cb, - cmd_id); -} - -Return WifiNanIface::enableRequest_1_6(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, - const V1_6::NanConfigRequestSupplemental& msg2, - enableRequest_1_5_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::enableRequest_1_6Internal, hidl_status_cb, cmd_id, msg1, - msg2); -} - -Return WifiNanIface::configRequest_1_6(uint16_t cmd_id, const V1_4::NanConfigRequest& msg1, - const V1_6::NanConfigRequestSupplemental& msg2, - configRequest_1_5_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::configRequest_1_6Internal, hidl_status_cb, cmd_id, msg1, - msg2); -} - -Return WifiNanIface::initiateDataPathRequest_1_6(uint16_t cmd_id, - const V1_6::NanInitiateDataPathRequest& msg, - initiateDataPathRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::initiateDataPathRequest_1_6Internal, hidl_status_cb, - cmd_id, msg); -} - -Return WifiNanIface::respondToDataPathIndicationRequest_1_6( - uint16_t cmd_id, const V1_6::NanRespondToDataPathIndicationRequest& msg, - respondToDataPathIndicationRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::respondToDataPathIndicationRequest_1_6Internal, - hidl_status_cb, cmd_id, msg); -} - -Return WifiNanIface::startPublishRequest_1_6(uint16_t cmd_id, - const V1_6::NanPublishRequest& msg, - startPublishRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::startPublishRequest_1_6Internal, hidl_status_cb, cmd_id, - msg); -} - -std::pair WifiNanIface::getNameInternal() { - return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_}; -} - -std::pair WifiNanIface::getTypeInternal() { - return {createWifiStatus(WifiStatusCode::SUCCESS), IfaceType::NAN}; -} - -Return WifiNanIface::registerEventCallback_1_6( - const sp& callback, - registerEventCallback_1_6_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::registerEventCallback_1_6Internal, hidl_status_cb, - callback); -} - -WifiStatus WifiNanIface::registerEventCallbackInternal( - const sp& callback) { - if (!event_cb_handler_.addCallback(callback)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -WifiStatus WifiNanIface::getCapabilitiesRequestInternal(uint16_t /* cmd_id */) { - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiNanIface::enableRequestInternal(uint16_t /* cmd_id */, - const V1_0::NanEnableRequest& /* msg */) { - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiNanIface::configRequestInternal(uint16_t /* cmd_id */, - const V1_0::NanConfigRequest& /* msg */) { - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiNanIface::disableRequestInternal(uint16_t cmd_id) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->nanDisableRequest(ifname_, cmd_id); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::startPublishRequestInternal(uint16_t /* cmd_id */, - const V1_0::NanPublishRequest& /* msg */) { - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiNanIface::stopPublishRequestInternal(uint16_t cmd_id, uint8_t sessionId) { - legacy_hal::NanPublishCancelRequest legacy_msg; - legacy_msg.publish_id = sessionId; - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanPublishCancelRequest(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::startSubscribeRequestInternal(uint16_t cmd_id, - const V1_0::NanSubscribeRequest& msg) { - legacy_hal::NanSubscribeRequest legacy_msg; - if (!hidl_struct_util::convertHidlNanSubscribeRequestToLegacy(msg, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanSubscribeRequest(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::stopSubscribeRequestInternal(uint16_t cmd_id, uint8_t sessionId) { - legacy_hal::NanSubscribeCancelRequest legacy_msg; - legacy_msg.subscribe_id = sessionId; - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanSubscribeCancelRequest(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::transmitFollowupRequestInternal(uint16_t cmd_id, - const NanTransmitFollowupRequest& msg) { - legacy_hal::NanTransmitFollowupRequest legacy_msg; - if (!hidl_struct_util::convertHidlNanTransmitFollowupRequestToLegacy(msg, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanTransmitFollowupRequest(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::createDataInterfaceRequestInternal(uint16_t cmd_id, - const std::string& iface_name) { - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanDataInterfaceCreate(ifname_, cmd_id, iface_name); - return createWifiStatusFromLegacyError(legacy_status); -} -WifiStatus WifiNanIface::deleteDataInterfaceRequestInternal(uint16_t cmd_id, - const std::string& iface_name) { - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanDataInterfaceDelete(ifname_, cmd_id, iface_name); - return createWifiStatusFromLegacyError(legacy_status); -} -WifiStatus WifiNanIface::initiateDataPathRequestInternal( - uint16_t cmd_id, const V1_0::NanInitiateDataPathRequest& msg) { - legacy_hal::NanDataPathInitiatorRequest legacy_msg; - if (!hidl_struct_util::convertHidlNanDataPathInitiatorRequestToLegacy(msg, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanDataRequestInitiator(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} -WifiStatus WifiNanIface::respondToDataPathIndicationRequestInternal( - uint16_t cmd_id, const V1_0::NanRespondToDataPathIndicationRequest& msg) { - legacy_hal::NanDataPathIndicationResponse legacy_msg; - if (!hidl_struct_util::convertHidlNanDataPathIndicationResponseToLegacy(msg, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanDataIndicationResponse(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} -WifiStatus WifiNanIface::terminateDataPathRequestInternal(uint16_t cmd_id, uint32_t ndpInstanceId) { - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanDataEnd(ifname_, cmd_id, ndpInstanceId); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::registerEventCallback_1_2Internal( - const sp& callback) { - sp callback_1_0 = callback; - if (!event_cb_handler_.addCallback(callback_1_0)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - if (!event_cb_handler_1_2_.addCallback(callback)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -WifiStatus WifiNanIface::enableRequest_1_2Internal( - uint16_t /* cmd_id */, const V1_0::NanEnableRequest& /* msg1 */, - const V1_2::NanConfigRequestSupplemental& /* msg2 */) { - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiNanIface::configRequest_1_2Internal( - uint16_t /* cmd_id */, const V1_0::NanConfigRequest& /* msg1 */, - const V1_2::NanConfigRequestSupplemental& /* msg2 */) { - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiNanIface::enableRequest_1_4Internal( - uint16_t /* cmd_id */, const V1_4::NanEnableRequest& /* msg1 */, - const V1_2::NanConfigRequestSupplemental& /* msg2 */) { - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiNanIface::configRequest_1_4Internal( - uint16_t /* cmd_id */, const V1_4::NanConfigRequest& /* msg1 */, - const V1_2::NanConfigRequestSupplemental& /* msg2 */) { - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiNanIface::registerEventCallback_1_5Internal( - const sp& callback) { - sp callback_1_0 = callback; - if (!event_cb_handler_.addCallback(callback_1_0)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - sp callback_1_2 = callback; - if (!event_cb_handler_1_2_.addCallback(callback_1_2)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - if (!event_cb_handler_1_5_.addCallback(callback)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -WifiStatus WifiNanIface::getCapabilitiesRequest_1_5Internal(uint16_t cmd_id) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->nanGetCapabilities(ifname_, cmd_id); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::enableRequest_1_5Internal( - uint16_t /* cmd_id */, const V1_4::NanEnableRequest& /* msg1 */, - const V1_5::NanConfigRequestSupplemental& /* msg2 */) { - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiNanIface::configRequest_1_5Internal( - uint16_t /* cmd_id */, const V1_4::NanConfigRequest& /* msg1 */, - const V1_5::NanConfigRequestSupplemental& /* msg2 */) { - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiNanIface::enableRequest_1_6Internal(uint16_t cmd_id, - const V1_4::NanEnableRequest& msg1, - const V1_6::NanConfigRequestSupplemental& msg2) { - legacy_hal::NanEnableRequest legacy_msg; - if (!hidl_struct_util::convertHidlNanEnableRequest_1_6ToLegacy(msg1, msg2, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanEnableRequest(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::configRequest_1_6Internal(uint16_t cmd_id, - const V1_4::NanConfigRequest& msg1, - const V1_6::NanConfigRequestSupplemental& msg2) { - legacy_hal::NanConfigRequest legacy_msg; - if (!hidl_struct_util::convertHidlNanConfigRequest_1_6ToLegacy(msg1, msg2, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanConfigRequest(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::initiateDataPathRequest_1_6Internal( - uint16_t cmd_id, const V1_6::NanInitiateDataPathRequest& msg) { - legacy_hal::NanDataPathInitiatorRequest legacy_msg; - if (!hidl_struct_util::convertHidlNanDataPathInitiatorRequest_1_6ToLegacy(msg, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanDataRequestInitiator(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::respondToDataPathIndicationRequest_1_6Internal( - uint16_t cmd_id, const V1_6::NanRespondToDataPathIndicationRequest& msg) { - legacy_hal::NanDataPathIndicationResponse legacy_msg; - if (!hidl_struct_util::convertHidlNanDataPathIndicationResponse_1_6ToLegacy(msg, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanDataIndicationResponse(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::startPublishRequest_1_6Internal(uint16_t cmd_id, - const V1_6::NanPublishRequest& msg) { - legacy_hal::NanPublishRequest legacy_msg; - if (!hidl_struct_util::convertHidlNanPublishRequestToLegacy(msg, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanPublishRequest(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::registerEventCallback_1_6Internal( - const sp& callback) { - sp callback_1_0 = callback; - if (!event_cb_handler_.addCallback(callback_1_0)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - sp callback_1_2 = callback; - if (!event_cb_handler_1_2_.addCallback(callback_1_2)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - sp callback_1_5 = callback; - if (!event_cb_handler_1_5_.addCallback(callback_1_5)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - if (!event_cb_handler_1_6_.addCallback(callback)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - return createWifiStatus(WifiStatusCode::SUCCESS); -} -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/wifi_nan_iface.h b/wifi/1.6/default/wifi_nan_iface.h deleted file mode 100644 index 15bf57298c..0000000000 --- a/wifi/1.6/default/wifi_nan_iface.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef WIFI_NAN_IFACE_H_ -#define WIFI_NAN_IFACE_H_ - -#include -#include -#include - -#include "hidl_callback_util.h" -#include "wifi_iface_util.h" -#include "wifi_legacy_hal.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -using namespace android::hardware::wifi::V1_0; -using namespace android::hardware::wifi::V1_2; -using namespace android::hardware::wifi::V1_4; -using namespace android::hardware::wifi::V1_6; - -/** - * HIDL interface object used to control a NAN Iface instance. - */ -class WifiNanIface : public V1_6::IWifiNanIface { - public: - WifiNanIface(const std::string& ifname, bool is_dedicated_iface, - const std::weak_ptr legacy_hal, - const std::weak_ptr iface_util); - // Refer to |WifiChip::invalidate()|. - void invalidate(); - bool isValid(); - std::string getName(); - - // HIDL methods exposed. - Return getName(getName_cb hidl_status_cb) override; - Return getType(getType_cb hidl_status_cb) override; - Return registerEventCallback(const sp& callback, - registerEventCallback_cb hidl_status_cb) override; - Return getCapabilitiesRequest(uint16_t cmd_id, - getCapabilitiesRequest_cb hidl_status_cb) override; - Return enableRequest(uint16_t cmd_id, const V1_0::NanEnableRequest& msg, - enableRequest_cb hidl_status_cb) override; - Return configRequest(uint16_t cmd_id, const V1_0::NanConfigRequest& msg, - configRequest_cb hidl_status_cb) override; - Return disableRequest(uint16_t cmd_id, disableRequest_cb hidl_status_cb) override; - Return startPublishRequest(uint16_t cmd_id, const V1_0::NanPublishRequest& msg, - startPublishRequest_cb hidl_status_cb) override; - Return stopPublishRequest(uint16_t cmd_id, uint8_t sessionId, - stopPublishRequest_cb hidl_status_cb) override; - Return startSubscribeRequest(uint16_t cmd_id, const V1_0::NanSubscribeRequest& msg, - startSubscribeRequest_cb hidl_status_cb) override; - Return stopSubscribeRequest(uint16_t cmd_id, uint8_t sessionId, - stopSubscribeRequest_cb hidl_status_cb) override; - Return transmitFollowupRequest(uint16_t cmd_id, const NanTransmitFollowupRequest& msg, - transmitFollowupRequest_cb hidl_status_cb) override; - Return createDataInterfaceRequest(uint16_t cmd_id, const hidl_string& iface_name, - createDataInterfaceRequest_cb hidl_status_cb) override; - Return deleteDataInterfaceRequest(uint16_t cmd_id, const hidl_string& iface_name, - deleteDataInterfaceRequest_cb hidl_status_cb) override; - Return initiateDataPathRequest(uint16_t cmd_id, - const V1_0::NanInitiateDataPathRequest& msg, - initiateDataPathRequest_cb hidl_status_cb) override; - Return respondToDataPathIndicationRequest( - uint16_t cmd_id, const V1_0::NanRespondToDataPathIndicationRequest& msg, - respondToDataPathIndicationRequest_cb hidl_status_cb) override; - Return terminateDataPathRequest(uint16_t cmd_id, uint32_t ndpInstanceId, - terminateDataPathRequest_cb hidl_status_cb) override; - - Return registerEventCallback_1_2(const sp& callback, - registerEventCallback_1_2_cb hidl_status_cb) override; - Return enableRequest_1_2(uint16_t cmd_id, const V1_0::NanEnableRequest& msg1, - const V1_2::NanConfigRequestSupplemental& msg2, - enableRequest_1_2_cb hidl_status_cb) override; - Return configRequest_1_2(uint16_t cmd_id, const V1_0::NanConfigRequest& msg1, - const V1_2::NanConfigRequestSupplemental& msg2, - configRequest_1_2_cb hidl_status_cb) override; - Return enableRequest_1_4(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, - const V1_2::NanConfigRequestSupplemental& msg2, - enableRequest_1_4_cb hidl_status_cb) override; - Return configRequest_1_4(uint16_t cmd_id, const V1_4::NanConfigRequest& msg1, - const V1_2::NanConfigRequestSupplemental& msg2, - configRequest_1_4_cb hidl_status_cb) override; - Return registerEventCallback_1_5(const sp& callback, - registerEventCallback_1_5_cb hidl_status_cb) override; - Return enableRequest_1_5(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, - const V1_5::NanConfigRequestSupplemental& msg2, - enableRequest_1_5_cb hidl_status_cb) override; - Return configRequest_1_5(uint16_t cmd_id, const V1_4::NanConfigRequest& msg1, - const V1_5::NanConfigRequestSupplemental& msg2, - configRequest_1_5_cb hidl_status_cb) override; - Return getCapabilitiesRequest_1_5(uint16_t cmd_id, - getCapabilitiesRequest_cb hidl_status_cb) override; - Return registerEventCallback_1_6(const sp& callback, - registerEventCallback_1_6_cb hidl_status_cb) override; - Return initiateDataPathRequest_1_6( - uint16_t cmd_id, const V1_6::NanInitiateDataPathRequest& msg, - initiateDataPathRequest_1_6_cb hidl_status_cb) override; - Return respondToDataPathIndicationRequest_1_6( - uint16_t cmd_id, const V1_6::NanRespondToDataPathIndicationRequest& msg, - respondToDataPathIndicationRequest_1_6_cb hidl_status_cb) override; - Return enableRequest_1_6(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, - const V1_6::NanConfigRequestSupplemental& msg2, - enableRequest_1_6_cb hidl_status_cb) override; - Return configRequest_1_6(uint16_t cmd_id, const V1_4::NanConfigRequest& msg1, - const V1_6::NanConfigRequestSupplemental& msg2, - configRequest_1_6_cb hidl_status_cb) override; - Return startPublishRequest_1_6(uint16_t cmd_id, const V1_6::NanPublishRequest& msg, - startPublishRequest_cb hidl_status_cb) override; - - private: - // Corresponding worker functions for the HIDL methods. - std::pair getNameInternal(); - std::pair getTypeInternal(); - WifiStatus registerEventCallbackInternal(const sp& callback); - WifiStatus getCapabilitiesRequestInternal(uint16_t cmd_id); - WifiStatus enableRequestInternal(uint16_t cmd_id, const V1_0::NanEnableRequest& msg); - WifiStatus configRequestInternal(uint16_t cmd_id, const V1_0::NanConfigRequest& msg); - WifiStatus disableRequestInternal(uint16_t cmd_id); - WifiStatus startPublishRequestInternal(uint16_t cmd_id, const V1_0::NanPublishRequest& msg); - WifiStatus stopPublishRequestInternal(uint16_t cmd_id, uint8_t sessionId); - WifiStatus startSubscribeRequestInternal(uint16_t cmd_id, const V1_0::NanSubscribeRequest& msg); - WifiStatus stopSubscribeRequestInternal(uint16_t cmd_id, uint8_t sessionId); - WifiStatus transmitFollowupRequestInternal(uint16_t cmd_id, - const NanTransmitFollowupRequest& msg); - WifiStatus createDataInterfaceRequestInternal(uint16_t cmd_id, const std::string& iface_name); - WifiStatus deleteDataInterfaceRequestInternal(uint16_t cmd_id, const std::string& iface_name); - WifiStatus initiateDataPathRequestInternal(uint16_t cmd_id, - const V1_0::NanInitiateDataPathRequest& msg); - WifiStatus respondToDataPathIndicationRequestInternal( - uint16_t cmd_id, const V1_0::NanRespondToDataPathIndicationRequest& msg); - WifiStatus terminateDataPathRequestInternal(uint16_t cmd_id, uint32_t ndpInstanceId); - - WifiStatus registerEventCallback_1_2Internal( - const sp& callback); - WifiStatus enableRequest_1_2Internal(uint16_t cmd_id, const V1_0::NanEnableRequest& msg1, - const V1_2::NanConfigRequestSupplemental& msg2); - WifiStatus configRequest_1_2Internal(uint16_t cmd_id, const V1_0::NanConfigRequest& msg, - const V1_2::NanConfigRequestSupplemental& msg2); - WifiStatus enableRequest_1_4Internal(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, - const V1_2::NanConfigRequestSupplemental& msg2); - WifiStatus configRequest_1_4Internal(uint16_t cmd_id, const V1_4::NanConfigRequest& msg, - const V1_2::NanConfigRequestSupplemental& msg2); - WifiStatus registerEventCallback_1_5Internal( - const sp& callback); - WifiStatus enableRequest_1_5Internal(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, - const V1_5::NanConfigRequestSupplemental& msg2); - WifiStatus configRequest_1_5Internal(uint16_t cmd_id, const V1_4::NanConfigRequest& msg, - const V1_5::NanConfigRequestSupplemental& msg2); - WifiStatus getCapabilitiesRequest_1_5Internal(uint16_t cmd_id); - WifiStatus registerEventCallback_1_6Internal( - const sp& callback); - - WifiStatus enableRequest_1_6Internal(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, - const V1_6::NanConfigRequestSupplemental& msg2); - WifiStatus configRequest_1_6Internal(uint16_t cmd_id, const V1_4::NanConfigRequest& msg, - const V1_6::NanConfigRequestSupplemental& msg2); - WifiStatus startPublishRequest_1_6Internal(uint16_t cmd_id, const V1_6::NanPublishRequest& msg); - WifiStatus initiateDataPathRequest_1_6Internal(uint16_t cmd_id, - const V1_6::NanInitiateDataPathRequest& msg); - WifiStatus respondToDataPathIndicationRequest_1_6Internal( - uint16_t cmd_id, const V1_6::NanRespondToDataPathIndicationRequest& msg); - - // all 1_0 and descendant callbacks - std::set> getEventCallbacks(); - // all 1_2 and descendant callbacks - std::set> getEventCallbacks_1_2(); - // all 1_5 and descendant callbacks - std::set> getEventCallbacks_1_5(); - // all 1_6 and descendant callbacks - std::set> getEventCallbacks_1_6(); - - std::string ifname_; - bool is_dedicated_iface_; - std::weak_ptr legacy_hal_; - std::weak_ptr iface_util_; - bool is_valid_; - hidl_callback_util::HidlCallbackHandler event_cb_handler_; - hidl_callback_util::HidlCallbackHandler event_cb_handler_1_2_; - hidl_callback_util::HidlCallbackHandler event_cb_handler_1_5_; - hidl_callback_util::HidlCallbackHandler event_cb_handler_1_6_; - - DISALLOW_COPY_AND_ASSIGN(WifiNanIface); -}; - -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // WIFI_NAN_IFACE_H_ diff --git a/wifi/1.6/default/wifi_rtt_controller.cpp b/wifi/1.6/default/wifi_rtt_controller.cpp deleted file mode 100644 index aa9ee2f520..0000000000 --- a/wifi/1.6/default/wifi_rtt_controller.cpp +++ /dev/null @@ -1,377 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#include - -#include "hidl_return_util.h" -#include "hidl_struct_util.h" -#include "wifi_rtt_controller.h" -#include "wifi_status_util.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -using hidl_return_util::validateAndCall; - -WifiRttController::WifiRttController(const std::string& iface_name, - const sp& bound_iface, - const std::weak_ptr legacy_hal) - : ifname_(iface_name), bound_iface_(bound_iface), legacy_hal_(legacy_hal), is_valid_(true) {} - -void WifiRttController::invalidate() { - legacy_hal_.reset(); - event_callbacks_.clear(); - is_valid_ = false; -} - -bool WifiRttController::isValid() { - return is_valid_; -} - -std::vector> WifiRttController::getEventCallbacks() { - return event_callbacks_; -} - -std::string WifiRttController::getIfaceName() { - return ifname_; -} - -Return WifiRttController::getBoundIface(getBoundIface_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::getBoundIfaceInternal, hidl_status_cb); -} - -Return WifiRttController::registerEventCallback( - const sp& callback, - registerEventCallback_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::registerEventCallbackInternal, hidl_status_cb, - callback); -} - -Return WifiRttController::rangeRequest(uint32_t cmd_id, - const hidl_vec& rtt_configs, - rangeRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::rangeRequestInternal, hidl_status_cb, cmd_id, - rtt_configs); -} - -Return WifiRttController::rangeCancel(uint32_t cmd_id, - const hidl_vec>& addrs, - rangeCancel_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::rangeCancelInternal, hidl_status_cb, cmd_id, addrs); -} - -Return WifiRttController::getCapabilities(getCapabilities_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::getCapabilitiesInternal, hidl_status_cb); -} - -Return WifiRttController::setLci(uint32_t cmd_id, const RttLciInformation& lci, - setLci_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::setLciInternal, hidl_status_cb, cmd_id, lci); -} - -Return WifiRttController::setLcr(uint32_t cmd_id, const RttLcrInformation& lcr, - setLcr_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::setLcrInternal, hidl_status_cb, cmd_id, lcr); -} - -Return WifiRttController::getResponderInfo(getResponderInfo_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::getResponderInfoInternal, hidl_status_cb); -} - -Return WifiRttController::enableResponder(uint32_t cmd_id, - const V1_0::WifiChannelInfo& channel_hint, - uint32_t max_duration_seconds, - const V1_0::RttResponder& info, - enableResponder_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::enableResponderInternal, hidl_status_cb, cmd_id, - channel_hint, max_duration_seconds, info); -} - -Return WifiRttController::disableResponder(uint32_t cmd_id, - disableResponder_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::disableResponderInternal, hidl_status_cb, cmd_id); -} - -Return WifiRttController::registerEventCallback_1_4( - const sp& callback, - registerEventCallback_1_4_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::registerEventCallbackInternal_1_4, hidl_status_cb, - callback); -} - -Return WifiRttController::rangeRequest_1_4(uint32_t cmd_id, - const hidl_vec& rtt_configs, - rangeRequest_1_4_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::rangeRequestInternal_1_4, hidl_status_cb, cmd_id, - rtt_configs); -} - -Return WifiRttController::getCapabilities_1_4(getCapabilities_1_4_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::getCapabilitiesInternal_1_4, hidl_status_cb); -} - -Return WifiRttController::getResponderInfo_1_4(getResponderInfo_1_4_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::getResponderInfoInternal_1_4, hidl_status_cb); -} - -Return WifiRttController::enableResponder_1_4(uint32_t cmd_id, - const V1_0::WifiChannelInfo& channel_hint, - uint32_t max_duration_seconds, - const V1_4::RttResponder& info, - enableResponder_1_4_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::enableResponderInternal_1_4, hidl_status_cb, cmd_id, - channel_hint, max_duration_seconds, info); -} - -Return WifiRttController::registerEventCallback_1_6( - const sp& callback, - registerEventCallback_1_6_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::registerEventCallbackInternal_1_6, hidl_status_cb, - callback); -} - -Return WifiRttController::rangeRequest_1_6(uint32_t cmd_id, - const hidl_vec& rtt_configs, - rangeRequest_1_6_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::rangeRequestInternal_1_6, hidl_status_cb, cmd_id, - rtt_configs); -} - -Return WifiRttController::getCapabilities_1_6(getCapabilities_1_6_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::getCapabilitiesInternal_1_6, hidl_status_cb); -} - -Return WifiRttController::getResponderInfo_1_6(getResponderInfo_1_6_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::getResponderInfoInternal_1_6, hidl_status_cb); -} - -Return WifiRttController::enableResponder_1_6(uint32_t cmd_id, - const V1_6::WifiChannelInfo& channel_hint, - uint32_t max_duration_seconds, - const V1_6::RttResponder& info, - enableResponder_1_6_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::enableResponderInternal_1_6, hidl_status_cb, cmd_id, - channel_hint, max_duration_seconds, info); -} - -std::pair> WifiRttController::getBoundIfaceInternal() { - return {createWifiStatus(WifiStatusCode::SUCCESS), bound_iface_}; -} - -WifiStatus WifiRttController::registerEventCallbackInternal( - const sp& /* callback */) { - // Deprecated support for this api - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiRttController::rangeRequestInternal( - uint32_t /* cmd_id */, const std::vector& /* rtt_configs */) { - // Deprecated support for this api - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiRttController::rangeCancelInternal( - uint32_t cmd_id, const std::vector>& addrs) { - std::vector> legacy_addrs; - for (const auto& addr : addrs) { - legacy_addrs.push_back(addr); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->cancelRttRangeRequest(ifname_, cmd_id, legacy_addrs); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair WifiRttController::getCapabilitiesInternal() { - // Deprecated support for this api - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; -} - -WifiStatus WifiRttController::setLciInternal(uint32_t cmd_id, const RttLciInformation& lci) { - legacy_hal::wifi_lci_information legacy_lci; - if (!hidl_struct_util::convertHidlRttLciInformationToLegacy(lci, &legacy_lci)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->setRttLci(ifname_, cmd_id, legacy_lci); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiRttController::setLcrInternal(uint32_t cmd_id, const RttLcrInformation& lcr) { - legacy_hal::wifi_lcr_information legacy_lcr; - if (!hidl_struct_util::convertHidlRttLcrInformationToLegacy(lcr, &legacy_lcr)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->setRttLcr(ifname_, cmd_id, legacy_lcr); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair WifiRttController::getResponderInfoInternal() { - // Deprecated support for this api - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; -} - -WifiStatus WifiRttController::enableResponderInternal( - uint32_t /* cmd_id */, const V1_0::WifiChannelInfo& /* channel_hint */, - uint32_t /* max_duration_seconds */, const V1_0::RttResponder& /* info */) { - // Deprecated support for this api - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED)}; -} - -WifiStatus WifiRttController::disableResponderInternal(uint32_t cmd_id) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->disableRttResponder(ifname_, cmd_id); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiRttController::registerEventCallbackInternal_1_4( - const sp& /* callback */) { - // Deprecated support for this api - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiRttController::rangeRequestInternal_1_4( - uint32_t /* cmd_id */, const std::vector& /* rtt_configs */) { - // Deprecated support for this api - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -std::pair WifiRttController::getCapabilitiesInternal_1_4() { - // Deprecated support for this api - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; -} - -std::pair WifiRttController::getResponderInfoInternal_1_4() { - // Deprecated support for this api - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; -} - -WifiStatus WifiRttController::enableResponderInternal_1_4( - uint32_t /* cmd_id */, const V1_0::WifiChannelInfo& /* channel_hint */, - uint32_t /* max_duration_seconds */, const V1_4::RttResponder& /* info */) { - // Deprecated support for this api - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED)}; -} - -WifiStatus WifiRttController::registerEventCallbackInternal_1_6( - const sp& callback) { - // TODO(b/31632518): remove the callback when the client is destroyed - event_callbacks_.emplace_back(callback); - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -WifiStatus WifiRttController::rangeRequestInternal_1_6( - uint32_t cmd_id, const std::vector& rtt_configs) { - std::vector legacy_configs; - if (!hidl_struct_util::convertHidlVectorOfRttConfigToLegacy(rtt_configs, &legacy_configs)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - android::wp weak_ptr_this(this); - const auto& on_results_callback = - [weak_ptr_this](legacy_hal::wifi_request_id id, - const std::vector& results) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - std::vector hidl_results; - if (!hidl_struct_util::convertLegacyVectorOfRttResultToHidl(results, - &hidl_results)) { - LOG(ERROR) << "Failed to convert rtt results to HIDL structs"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onResults_1_6(id, hidl_results).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startRttRangeRequest( - ifname_, cmd_id, legacy_configs, on_results_callback); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair WifiRttController::getCapabilitiesInternal_1_6() { - legacy_hal::wifi_error legacy_status; - legacy_hal::wifi_rtt_capabilities legacy_caps; - std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getRttCapabilities(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), {}}; - } - V1_6::RttCapabilities hidl_caps; - if (!hidl_struct_util::convertLegacyRttCapabilitiesToHidl(legacy_caps, &hidl_caps)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps}; -} - -std::pair WifiRttController::getResponderInfoInternal_1_6() { - legacy_hal::wifi_error legacy_status; - legacy_hal::wifi_rtt_responder legacy_responder; - std::tie(legacy_status, legacy_responder) = legacy_hal_.lock()->getRttResponderInfo(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), {}}; - } - V1_6::RttResponder hidl_responder; - if (!hidl_struct_util::convertLegacyRttResponderToHidl(legacy_responder, &hidl_responder)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_responder}; -} - -WifiStatus WifiRttController::enableResponderInternal_1_6(uint32_t cmd_id, - const V1_6::WifiChannelInfo& channel_hint, - uint32_t max_duration_seconds, - const V1_6::RttResponder& info) { - legacy_hal::wifi_channel_info legacy_channel_info; - if (!hidl_struct_util::convertHidlWifiChannelInfoToLegacy(channel_hint, &legacy_channel_info)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_rtt_responder legacy_responder; - if (!hidl_struct_util::convertHidlRttResponderToLegacy(info, &legacy_responder)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->enableRttResponder( - ifname_, cmd_id, legacy_channel_info, max_duration_seconds, legacy_responder); - return createWifiStatusFromLegacyError(legacy_status); -} -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/wifi_rtt_controller.h b/wifi/1.6/default/wifi_rtt_controller.h deleted file mode 100644 index fd5f68b6a8..0000000000 --- a/wifi/1.6/default/wifi_rtt_controller.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef WIFI_RTT_CONTROLLER_H_ -#define WIFI_RTT_CONTROLLER_H_ - -#include -#include -#include -#include - -#include "wifi_legacy_hal.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { - -/** - * HIDL interface object used to control all RTT operations. - */ -class WifiRttController : public V1_6::IWifiRttController { - public: - WifiRttController(const std::string& iface_name, const sp& bound_iface, - const std::weak_ptr legacy_hal); - // Refer to |WifiChip::invalidate()|. - void invalidate(); - bool isValid(); - std::vector> getEventCallbacks(); - std::string getIfaceName(); - - // HIDL methods exposed. - Return getBoundIface(getBoundIface_cb hidl_status_cb) override; - Return registerEventCallback(const sp& callback, - registerEventCallback_cb hidl_status_cb) override; - Return rangeRequest(uint32_t cmd_id, const hidl_vec& rtt_configs, - rangeRequest_cb hidl_status_cb) override; - Return rangeCancel(uint32_t cmd_id, const hidl_vec>& addrs, - rangeCancel_cb hidl_status_cb) override; - Return getCapabilities(getCapabilities_cb hidl_status_cb) override; - Return setLci(uint32_t cmd_id, const RttLciInformation& lci, - setLci_cb hidl_status_cb) override; - Return setLcr(uint32_t cmd_id, const RttLcrInformation& lcr, - setLcr_cb hidl_status_cb) override; - Return getResponderInfo(getResponderInfo_cb hidl_status_cb) override; - Return enableResponder(uint32_t cmd_id, const V1_0::WifiChannelInfo& channel_hint, - uint32_t max_duration_seconds, const V1_0::RttResponder& info, - enableResponder_cb hidl_status_cb) override; - Return disableResponder(uint32_t cmd_id, disableResponder_cb hidl_status_cb) override; - Return registerEventCallback_1_4( - const sp& callback, - registerEventCallback_1_4_cb hidl_status_cb) override; - Return rangeRequest_1_4(uint32_t cmd_id, const hidl_vec& rtt_configs, - rangeRequest_1_4_cb hidl_status_cb) override; - Return getCapabilities_1_4(getCapabilities_1_4_cb hidl_status_cb) override; - Return getResponderInfo_1_4(getResponderInfo_1_4_cb hidl_status_cb) override; - Return enableResponder_1_4(uint32_t cmd_id, const V1_0::WifiChannelInfo& channel_hint, - uint32_t max_duration_seconds, const V1_4::RttResponder& info, - enableResponder_1_4_cb hidl_status_cb) override; - Return registerEventCallback_1_6( - const sp& callback, - registerEventCallback_1_6_cb hidl_status_cb) override; - Return rangeRequest_1_6(uint32_t cmd_id, const hidl_vec& rtt_configs, - rangeRequest_1_6_cb hidl_status_cb) override; - Return getCapabilities_1_6(getCapabilities_1_6_cb hidl_status_cb) override; - Return getResponderInfo_1_6(getResponderInfo_1_6_cb hidl_status_cb) override; - Return enableResponder_1_6(uint32_t cmd_id, const V1_6::WifiChannelInfo& channel_hint, - uint32_t max_duration_seconds, const V1_6::RttResponder& info, - enableResponder_1_6_cb hidl_status_cb) override; - - private: - // Corresponding worker functions for the HIDL methods. - std::pair> getBoundIfaceInternal(); - WifiStatus registerEventCallbackInternal( - const sp& callback); - WifiStatus rangeRequestInternal(uint32_t cmd_id, - const std::vector& rtt_configs); - WifiStatus rangeCancelInternal(uint32_t cmd_id, - const std::vector>& addrs); - std::pair getCapabilitiesInternal(); - WifiStatus setLciInternal(uint32_t cmd_id, const RttLciInformation& lci); - WifiStatus setLcrInternal(uint32_t cmd_id, const RttLcrInformation& lcr); - std::pair getResponderInfoInternal(); - WifiStatus enableResponderInternal(uint32_t cmd_id, const V1_0::WifiChannelInfo& channel_hint, - uint32_t max_duration_seconds, - const V1_0::RttResponder& info); - WifiStatus disableResponderInternal(uint32_t cmd_id); - WifiStatus registerEventCallbackInternal_1_4( - const sp& callback); - WifiStatus rangeRequestInternal_1_4(uint32_t cmd_id, - const std::vector& rtt_configs); - std::pair getCapabilitiesInternal_1_4(); - std::pair getResponderInfoInternal_1_4(); - WifiStatus enableResponderInternal_1_4(uint32_t cmd_id, - const V1_0::WifiChannelInfo& channel_hint, - uint32_t max_duration_seconds, - const V1_4::RttResponder& info); - WifiStatus registerEventCallbackInternal_1_6( - const sp& callback); - WifiStatus rangeRequestInternal_1_6(uint32_t cmd_id, - const std::vector& rtt_configs); - std::pair getCapabilitiesInternal_1_6(); - std::pair getResponderInfoInternal_1_6(); - WifiStatus enableResponderInternal_1_6(uint32_t cmd_id, - const V1_6::WifiChannelInfo& channel_hint, - uint32_t max_duration_seconds, - const V1_6::RttResponder& info); - - std::string ifname_; - sp bound_iface_; - std::weak_ptr legacy_hal_; - std::vector> event_callbacks_; - bool is_valid_; - - DISALLOW_COPY_AND_ASSIGN(WifiRttController); -}; - -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // WIFI_RTT_CONTROLLER_H_ diff --git a/wifi/1.6/default/wifi_sta_iface.cpp b/wifi/1.6/default/wifi_sta_iface.cpp deleted file mode 100644 index dd11839c97..0000000000 --- a/wifi/1.6/default/wifi_sta_iface.cpp +++ /dev/null @@ -1,592 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#include - -#include "hidl_return_util.h" -#include "hidl_struct_util.h" -#include "wifi_sta_iface.h" -#include "wifi_status_util.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -using hidl_return_util::validateAndCall; - -WifiStaIface::WifiStaIface(const std::string& ifname, - const std::weak_ptr legacy_hal, - const std::weak_ptr iface_util) - : ifname_(ifname), legacy_hal_(legacy_hal), iface_util_(iface_util), is_valid_(true) { - // Turn on DFS channel usage for STA iface. - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->setDfsFlag(ifname_, true); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - LOG(ERROR) << "Failed to set DFS flag; DFS channels may be unavailable."; - } -} - -void WifiStaIface::invalidate() { - legacy_hal_.reset(); - event_cb_handler_.invalidate(); - is_valid_ = false; -} - -bool WifiStaIface::isValid() { - return is_valid_; -} - -std::string WifiStaIface::getName() { - return ifname_; -} - -std::set> WifiStaIface::getEventCallbacks() { - return event_cb_handler_.getCallbacks(); -} - -Return WifiStaIface::getName(getName_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getNameInternal, hidl_status_cb); -} - -Return WifiStaIface::getType(getType_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getTypeInternal, hidl_status_cb); -} - -Return WifiStaIface::registerEventCallback(const sp& callback, - registerEventCallback_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::registerEventCallbackInternal, hidl_status_cb, callback); -} - -Return WifiStaIface::getCapabilities(getCapabilities_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getCapabilitiesInternal, hidl_status_cb); -} - -Return WifiStaIface::getApfPacketFilterCapabilities( - getApfPacketFilterCapabilities_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getApfPacketFilterCapabilitiesInternal, hidl_status_cb); -} - -Return WifiStaIface::installApfPacketFilter(uint32_t cmd_id, const hidl_vec& program, - installApfPacketFilter_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::installApfPacketFilterInternal, hidl_status_cb, cmd_id, - program); -} - -Return WifiStaIface::readApfPacketFilterData(readApfPacketFilterData_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::readApfPacketFilterDataInternal, hidl_status_cb); -} - -Return WifiStaIface::getBackgroundScanCapabilities( - getBackgroundScanCapabilities_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getBackgroundScanCapabilitiesInternal, hidl_status_cb); -} - -Return WifiStaIface::getValidFrequenciesForBand( - V1_0::WifiBand band, getValidFrequenciesForBand_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getValidFrequenciesForBandInternal, hidl_status_cb, band); -} - -Return WifiStaIface::startBackgroundScan(uint32_t cmd_id, - const StaBackgroundScanParameters& params, - startBackgroundScan_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::startBackgroundScanInternal, hidl_status_cb, cmd_id, - params); -} - -Return WifiStaIface::stopBackgroundScan(uint32_t cmd_id, - stopBackgroundScan_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::stopBackgroundScanInternal, hidl_status_cb, cmd_id); -} - -Return WifiStaIface::enableLinkLayerStatsCollection( - bool debug, enableLinkLayerStatsCollection_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::enableLinkLayerStatsCollectionInternal, hidl_status_cb, - debug); -} - -Return WifiStaIface::disableLinkLayerStatsCollection( - disableLinkLayerStatsCollection_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::disableLinkLayerStatsCollectionInternal, hidl_status_cb); -} - -Return WifiStaIface::getLinkLayerStats(getLinkLayerStats_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getLinkLayerStatsInternal, hidl_status_cb); -} - -Return WifiStaIface::getLinkLayerStats_1_3(getLinkLayerStats_1_3_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getLinkLayerStatsInternal_1_3, hidl_status_cb); -} - -Return WifiStaIface::getLinkLayerStats_1_5(getLinkLayerStats_1_5_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getLinkLayerStatsInternal_1_5, hidl_status_cb); -} - -Return WifiStaIface::getLinkLayerStats_1_6(getLinkLayerStats_1_6_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getLinkLayerStatsInternal_1_6, hidl_status_cb); -} - -Return WifiStaIface::startRssiMonitoring(uint32_t cmd_id, int32_t max_rssi, int32_t min_rssi, - startRssiMonitoring_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::startRssiMonitoringInternal, hidl_status_cb, cmd_id, - max_rssi, min_rssi); -} - -Return WifiStaIface::stopRssiMonitoring(uint32_t cmd_id, - stopRssiMonitoring_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::stopRssiMonitoringInternal, hidl_status_cb, cmd_id); -} - -Return WifiStaIface::getRoamingCapabilities(getRoamingCapabilities_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getRoamingCapabilitiesInternal, hidl_status_cb); -} - -Return WifiStaIface::configureRoaming(const StaRoamingConfig& config, - configureRoaming_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::configureRoamingInternal, hidl_status_cb, config); -} - -Return WifiStaIface::setRoamingState(StaRoamingState state, - setRoamingState_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::setRoamingStateInternal, hidl_status_cb, state); -} - -Return WifiStaIface::enableNdOffload(bool enable, enableNdOffload_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::enableNdOffloadInternal, hidl_status_cb, enable); -} - -Return WifiStaIface::startSendingKeepAlivePackets( - uint32_t cmd_id, const hidl_vec& ip_packet_data, uint16_t ether_type, - const hidl_array& src_address, const hidl_array& dst_address, - uint32_t period_in_ms, startSendingKeepAlivePackets_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::startSendingKeepAlivePacketsInternal, hidl_status_cb, - cmd_id, ip_packet_data, ether_type, src_address, dst_address, - period_in_ms); -} - -Return WifiStaIface::stopSendingKeepAlivePackets( - uint32_t cmd_id, stopSendingKeepAlivePackets_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::stopSendingKeepAlivePacketsInternal, hidl_status_cb, - cmd_id); -} - -Return WifiStaIface::setScanningMacOui(const hidl_array& oui, - setScanningMacOui_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::setScanningMacOuiInternal, hidl_status_cb, oui); -} - -Return WifiStaIface::startDebugPacketFateMonitoring( - startDebugPacketFateMonitoring_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::startDebugPacketFateMonitoringInternal, hidl_status_cb); -} - -Return WifiStaIface::getDebugTxPacketFates(getDebugTxPacketFates_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getDebugTxPacketFatesInternal, hidl_status_cb); -} - -Return WifiStaIface::getDebugRxPacketFates(getDebugRxPacketFates_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getDebugRxPacketFatesInternal, hidl_status_cb); -} - -Return WifiStaIface::setMacAddress(const hidl_array& mac, - setMacAddress_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::setMacAddressInternal, hidl_status_cb, mac); -} - -Return WifiStaIface::getFactoryMacAddress(getFactoryMacAddress_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getFactoryMacAddressInternal, hidl_status_cb); -} - -Return WifiStaIface::setScanMode(bool enable, setScanMode_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::setScanModeInternal, hidl_status_cb, enable); -} - -std::pair WifiStaIface::getNameInternal() { - return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_}; -} - -std::pair WifiStaIface::getTypeInternal() { - return {createWifiStatus(WifiStatusCode::SUCCESS), IfaceType::STA}; -} - -WifiStatus WifiStaIface::registerEventCallbackInternal( - const sp& callback) { - if (!event_cb_handler_.addCallback(callback)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -std::pair WifiStaIface::getCapabilitiesInternal() { - legacy_hal::wifi_error legacy_status; - uint64_t legacy_feature_set; - std::tie(legacy_status, legacy_feature_set) = - legacy_hal_.lock()->getSupportedFeatureSet(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), 0}; - } - uint32_t legacy_logger_feature_set; - std::tie(legacy_status, legacy_logger_feature_set) = - legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - // some devices don't support querying logger feature set - legacy_logger_feature_set = 0; - } - uint32_t hidl_caps; - if (!hidl_struct_util::convertLegacyFeaturesToHidlStaCapabilities( - legacy_feature_set, legacy_logger_feature_set, &hidl_caps)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), 0}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps}; -} - -std::pair -WifiStaIface::getApfPacketFilterCapabilitiesInternal() { - legacy_hal::wifi_error legacy_status; - legacy_hal::PacketFilterCapabilities legacy_caps; - std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getPacketFilterCapabilities(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), {}}; - } - StaApfPacketFilterCapabilities hidl_caps; - if (!hidl_struct_util::convertLegacyApfCapabilitiesToHidl(legacy_caps, &hidl_caps)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps}; -} - -WifiStatus WifiStaIface::installApfPacketFilterInternal(uint32_t /* cmd_id */, - const std::vector& program) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->setPacketFilter(ifname_, program); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair> WifiStaIface::readApfPacketFilterDataInternal() { - const std::pair> legacy_status_and_data = - legacy_hal_.lock()->readApfPacketFilterData(ifname_); - return {createWifiStatusFromLegacyError(legacy_status_and_data.first), - std::move(legacy_status_and_data.second)}; -} - -std::pair -WifiStaIface::getBackgroundScanCapabilitiesInternal() { - legacy_hal::wifi_error legacy_status; - legacy_hal::wifi_gscan_capabilities legacy_caps; - std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getGscanCapabilities(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), {}}; - } - StaBackgroundScanCapabilities hidl_caps; - if (!hidl_struct_util::convertLegacyGscanCapabilitiesToHidl(legacy_caps, &hidl_caps)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps}; -} - -std::pair> -WifiStaIface::getValidFrequenciesForBandInternal(V1_0::WifiBand band) { - static_assert(sizeof(WifiChannelInMhz) == sizeof(uint32_t), "Size mismatch"); - legacy_hal::wifi_error legacy_status; - std::vector valid_frequencies; - std::tie(legacy_status, valid_frequencies) = legacy_hal_.lock()->getValidFrequenciesForBand( - ifname_, hidl_struct_util::convertHidlWifiBandToLegacy(band)); - return {createWifiStatusFromLegacyError(legacy_status), valid_frequencies}; -} - -WifiStatus WifiStaIface::startBackgroundScanInternal(uint32_t cmd_id, - const StaBackgroundScanParameters& params) { - legacy_hal::wifi_scan_cmd_params legacy_params; - if (!hidl_struct_util::convertHidlGscanParamsToLegacy(params, &legacy_params)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - android::wp weak_ptr_this(this); - const auto& on_failure_callback = [weak_ptr_this](legacy_hal::wifi_request_id id) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onBackgroundScanFailure(id).isOk()) { - LOG(ERROR) << "Failed to invoke onBackgroundScanFailure callback"; - } - } - }; - const auto& on_results_callback = - [weak_ptr_this](legacy_hal::wifi_request_id id, - const std::vector& results) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - std::vector hidl_scan_datas; - if (!hidl_struct_util::convertLegacyVectorOfCachedGscanResultsToHidl( - results, &hidl_scan_datas)) { - LOG(ERROR) << "Failed to convert scan results to HIDL structs"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onBackgroundScanResults(id, hidl_scan_datas).isOk()) { - LOG(ERROR) << "Failed to invoke onBackgroundScanResults callback"; - } - } - }; - const auto& on_full_result_callback = [weak_ptr_this]( - legacy_hal::wifi_request_id id, - const legacy_hal::wifi_scan_result* result, - uint32_t buckets_scanned) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - StaScanResult hidl_scan_result; - if (!hidl_struct_util::convertLegacyGscanResultToHidl(*result, true, &hidl_scan_result)) { - LOG(ERROR) << "Failed to convert full scan results to HIDL structs"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onBackgroundFullScanResult(id, buckets_scanned, hidl_scan_result) - .isOk()) { - LOG(ERROR) << "Failed to invoke onBackgroundFullScanResult callback"; - } - } - }; - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->startGscan(ifname_, cmd_id, legacy_params, on_failure_callback, - on_results_callback, on_full_result_callback); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiStaIface::stopBackgroundScanInternal(uint32_t cmd_id) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->stopGscan(ifname_, cmd_id); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiStaIface::enableLinkLayerStatsCollectionInternal(bool debug) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->enableLinkLayerStats(ifname_, debug); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiStaIface::disableLinkLayerStatsCollectionInternal() { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->disableLinkLayerStats(ifname_); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair WifiStaIface::getLinkLayerStatsInternal() { - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; -} - -std::pair WifiStaIface::getLinkLayerStatsInternal_1_3() { - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; -} - -std::pair WifiStaIface::getLinkLayerStatsInternal_1_5() { - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; -} - -std::pair WifiStaIface::getLinkLayerStatsInternal_1_6() { - legacy_hal::wifi_error legacy_status; - legacy_hal::LinkLayerStats legacy_stats; - std::tie(legacy_status, legacy_stats) = legacy_hal_.lock()->getLinkLayerStats(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), {}}; - } - V1_6::StaLinkLayerStats hidl_stats; - if (!hidl_struct_util::convertLegacyLinkLayerStatsToHidl(legacy_stats, &hidl_stats)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_stats}; -} - -WifiStatus WifiStaIface::startRssiMonitoringInternal(uint32_t cmd_id, int32_t max_rssi, - int32_t min_rssi) { - android::wp weak_ptr_this(this); - const auto& on_threshold_breached_callback = [weak_ptr_this](legacy_hal::wifi_request_id id, - std::array bssid, - int8_t rssi) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onRssiThresholdBreached(id, bssid, rssi).isOk()) { - LOG(ERROR) << "Failed to invoke onRssiThresholdBreached callback"; - } - } - }; - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startRssiMonitoring( - ifname_, cmd_id, max_rssi, min_rssi, on_threshold_breached_callback); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiStaIface::stopRssiMonitoringInternal(uint32_t cmd_id) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->stopRssiMonitoring(ifname_, cmd_id); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair WifiStaIface::getRoamingCapabilitiesInternal() { - legacy_hal::wifi_error legacy_status; - legacy_hal::wifi_roaming_capabilities legacy_caps; - std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getRoamingCapabilities(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), {}}; - } - StaRoamingCapabilities hidl_caps; - if (!hidl_struct_util::convertLegacyRoamingCapabilitiesToHidl(legacy_caps, &hidl_caps)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps}; -} - -WifiStatus WifiStaIface::configureRoamingInternal(const StaRoamingConfig& config) { - legacy_hal::wifi_roaming_config legacy_config; - if (!hidl_struct_util::convertHidlRoamingConfigToLegacy(config, &legacy_config)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->configureRoaming(ifname_, legacy_config); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiStaIface::setRoamingStateInternal(StaRoamingState state) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->enableFirmwareRoaming( - ifname_, hidl_struct_util::convertHidlRoamingStateToLegacy(state)); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiStaIface::enableNdOffloadInternal(bool enable) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->configureNdOffload(ifname_, enable); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiStaIface::startSendingKeepAlivePacketsInternal( - uint32_t cmd_id, const std::vector& ip_packet_data, uint16_t ether_type, - const std::array& src_address, const std::array& dst_address, - uint32_t period_in_ms) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startSendingOffloadedPacket( - ifname_, cmd_id, ether_type, ip_packet_data, src_address, dst_address, period_in_ms); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiStaIface::stopSendingKeepAlivePacketsInternal(uint32_t cmd_id) { - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->stopSendingOffloadedPacket(ifname_, cmd_id); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiStaIface::setScanningMacOuiInternal(const std::array& /* oui */) { - // deprecated. - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiStaIface::startDebugPacketFateMonitoringInternal() { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startPktFateMonitoring(ifname_); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair> -WifiStaIface::getDebugTxPacketFatesInternal() { - legacy_hal::wifi_error legacy_status; - std::vector legacy_fates; - std::tie(legacy_status, legacy_fates) = legacy_hal_.lock()->getTxPktFates(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), {}}; - } - std::vector hidl_fates; - if (!hidl_struct_util::convertLegacyVectorOfDebugTxPacketFateToHidl(legacy_fates, - &hidl_fates)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_fates}; -} - -std::pair> -WifiStaIface::getDebugRxPacketFatesInternal() { - legacy_hal::wifi_error legacy_status; - std::vector legacy_fates; - std::tie(legacy_status, legacy_fates) = legacy_hal_.lock()->getRxPktFates(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), {}}; - } - std::vector hidl_fates; - if (!hidl_struct_util::convertLegacyVectorOfDebugRxPacketFateToHidl(legacy_fates, - &hidl_fates)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_fates}; -} - -WifiStatus WifiStaIface::setMacAddressInternal(const std::array& mac) { - bool status = iface_util_.lock()->setMacAddress(ifname_, mac); - if (!status) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -std::pair> WifiStaIface::getFactoryMacAddressInternal() { - std::array mac = iface_util_.lock()->getFactoryMacAddress(ifname_); - if (mac[0] == 0 && mac[1] == 0 && mac[2] == 0 && mac[3] == 0 && mac[4] == 0 && mac[5] == 0) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), mac}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), mac}; -} - -WifiStatus WifiStaIface::setScanModeInternal(bool enable) { - // OEM's need to implement this on their devices if needed. - LOG(WARNING) << "setScanModeInternal(" << enable << ") not supported"; - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/wifi_sta_iface.h b/wifi/1.6/default/wifi_sta_iface.h deleted file mode 100644 index c01c50b612..0000000000 --- a/wifi/1.6/default/wifi_sta_iface.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef WIFI_STA_IFACE_H_ -#define WIFI_STA_IFACE_H_ - -#include -#include -#include - -#include "hidl_callback_util.h" -#include "wifi_iface_util.h" -#include "wifi_legacy_hal.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -using namespace android::hardware::wifi::V1_0; - -/** - * HIDL interface object used to control a STA Iface instance. - */ -class WifiStaIface : public V1_6::IWifiStaIface { - public: - WifiStaIface(const std::string& ifname, - const std::weak_ptr legacy_hal, - const std::weak_ptr iface_util); - // Refer to |WifiChip::invalidate()|. - void invalidate(); - bool isValid(); - std::set> getEventCallbacks(); - std::string getName(); - - // HIDL methods exposed. - Return getName(getName_cb hidl_status_cb) override; - Return getType(getType_cb hidl_status_cb) override; - Return registerEventCallback(const sp& callback, - registerEventCallback_cb hidl_status_cb) override; - Return getCapabilities(getCapabilities_cb hidl_status_cb) override; - Return getApfPacketFilterCapabilities( - getApfPacketFilterCapabilities_cb hidl_status_cb) override; - Return installApfPacketFilter(uint32_t cmd_id, const hidl_vec& program, - installApfPacketFilter_cb hidl_status_cb) override; - Return readApfPacketFilterData(readApfPacketFilterData_cb hidl_status_cb) override; - Return getBackgroundScanCapabilities( - getBackgroundScanCapabilities_cb hidl_status_cb) override; - Return getValidFrequenciesForBand(V1_0::WifiBand band, - getValidFrequenciesForBand_cb hidl_status_cb) override; - Return startBackgroundScan(uint32_t cmd_id, const StaBackgroundScanParameters& params, - startBackgroundScan_cb hidl_status_cb) override; - Return stopBackgroundScan(uint32_t cmd_id, stopBackgroundScan_cb hidl_status_cb) override; - Return enableLinkLayerStatsCollection( - bool debug, enableLinkLayerStatsCollection_cb hidl_status_cb) override; - Return disableLinkLayerStatsCollection( - disableLinkLayerStatsCollection_cb hidl_status_cb) override; - Return getLinkLayerStats(getLinkLayerStats_cb hidl_status_cb) override; - Return getLinkLayerStats_1_3(getLinkLayerStats_1_3_cb hidl_status_cb) override; - Return getLinkLayerStats_1_5(getLinkLayerStats_1_5_cb hidl_status_cb) override; - Return getLinkLayerStats_1_6(getLinkLayerStats_1_6_cb hidl_status_cb) override; - Return startRssiMonitoring(uint32_t cmd_id, int32_t max_rssi, int32_t min_rssi, - startRssiMonitoring_cb hidl_status_cb) override; - Return stopRssiMonitoring(uint32_t cmd_id, stopRssiMonitoring_cb hidl_status_cb) override; - Return getRoamingCapabilities(getRoamingCapabilities_cb hidl_status_cb) override; - Return configureRoaming(const StaRoamingConfig& config, - configureRoaming_cb hidl_status_cb) override; - Return setRoamingState(StaRoamingState state, setRoamingState_cb hidl_status_cb) override; - Return enableNdOffload(bool enable, enableNdOffload_cb hidl_status_cb) override; - Return startSendingKeepAlivePackets( - uint32_t cmd_id, const hidl_vec& ip_packet_data, uint16_t ether_type, - const hidl_array& src_address, const hidl_array& dst_address, - uint32_t period_in_ms, startSendingKeepAlivePackets_cb hidl_status_cb) override; - Return stopSendingKeepAlivePackets( - uint32_t cmd_id, stopSendingKeepAlivePackets_cb hidl_status_cb) override; - Return setScanningMacOui(const hidl_array& oui, - setScanningMacOui_cb hidl_status_cb) override; - Return startDebugPacketFateMonitoring( - startDebugPacketFateMonitoring_cb hidl_status_cb) override; - Return getDebugTxPacketFates(getDebugTxPacketFates_cb hidl_status_cb) override; - Return getDebugRxPacketFates(getDebugRxPacketFates_cb hidl_status_cb) override; - Return setMacAddress(const hidl_array& mac, - setMacAddress_cb hidl_status_cb) override; - Return getFactoryMacAddress(getFactoryMacAddress_cb hidl_status_cb) override; - Return setScanMode(bool enable, setScanMode_cb hidl_status_cb) override; - - private: - // Corresponding worker functions for the HIDL methods. - std::pair getNameInternal(); - std::pair getTypeInternal(); - WifiStatus registerEventCallbackInternal(const sp& callback); - std::pair getCapabilitiesInternal(); - std::pair getApfPacketFilterCapabilitiesInternal(); - WifiStatus installApfPacketFilterInternal(uint32_t cmd_id, const std::vector& program); - std::pair> readApfPacketFilterDataInternal(); - std::pair getBackgroundScanCapabilitiesInternal(); - std::pair> getValidFrequenciesForBandInternal( - V1_0::WifiBand band); - WifiStatus startBackgroundScanInternal(uint32_t cmd_id, - const StaBackgroundScanParameters& params); - WifiStatus stopBackgroundScanInternal(uint32_t cmd_id); - WifiStatus enableLinkLayerStatsCollectionInternal(bool debug); - WifiStatus disableLinkLayerStatsCollectionInternal(); - std::pair getLinkLayerStatsInternal(); - std::pair getLinkLayerStatsInternal_1_3(); - std::pair getLinkLayerStatsInternal_1_5(); - std::pair getLinkLayerStatsInternal_1_6(); - WifiStatus startRssiMonitoringInternal(uint32_t cmd_id, int32_t max_rssi, int32_t min_rssi); - WifiStatus stopRssiMonitoringInternal(uint32_t cmd_id); - std::pair getRoamingCapabilitiesInternal(); - WifiStatus configureRoamingInternal(const StaRoamingConfig& config); - WifiStatus setRoamingStateInternal(StaRoamingState state); - WifiStatus enableNdOffloadInternal(bool enable); - WifiStatus startSendingKeepAlivePacketsInternal(uint32_t cmd_id, - const std::vector& ip_packet_data, - uint16_t ether_type, - const std::array& src_address, - const std::array& dst_address, - uint32_t period_in_ms); - WifiStatus stopSendingKeepAlivePacketsInternal(uint32_t cmd_id); - WifiStatus setScanningMacOuiInternal(const std::array& oui); - WifiStatus startDebugPacketFateMonitoringInternal(); - std::pair> getDebugTxPacketFatesInternal(); - std::pair> getDebugRxPacketFatesInternal(); - WifiStatus setMacAddressInternal(const std::array& mac); - std::pair> getFactoryMacAddressInternal(); - WifiStatus setScanModeInternal(bool enable); - - std::string ifname_; - std::weak_ptr legacy_hal_; - std::weak_ptr iface_util_; - bool is_valid_; - hidl_callback_util::HidlCallbackHandler event_cb_handler_; - - DISALLOW_COPY_AND_ASSIGN(WifiStaIface); -}; - -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // WIFI_STA_IFACE_H_ diff --git a/wifi/1.6/default/Android.bp b/wifi/aidl/default/Android.bp similarity index 67% rename from wifi/1.6/default/Android.bp rename to wifi/aidl/default/Android.bp index 0f98e71445..441d461b78 100644 --- a/wifi/1.6/default/Android.bp +++ b/wifi/aidl/default/Android.bp @@ -1,4 +1,4 @@ -// Copyright (C) 2021 The Android Open Source Project +// 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. @@ -36,7 +36,7 @@ soong_config_module_type { } wifi_hal_cc_defaults { - name: "android.hardware.wifi@1.0-service-cppflags-defaults", + name: "android.hardware.wifi-service-cppflags-defaults", soong_config_variables: { hidl_feature_aware: { cppflags: ["-DWIFI_HIDL_FEATURE_AWARE"], @@ -60,8 +60,8 @@ wifi_hal_cc_defaults { } cc_library_static { - name: "android.hardware.wifi@1.0-service-lib", - defaults: ["android.hardware.wifi@1.0-service-cppflags-defaults"], + name: "android.hardware.wifi-service-lib", + defaults: ["android.hardware.wifi-service-cppflags-defaults"], proprietary: true, compile_multilib: "first", cppflags: [ @@ -72,8 +72,8 @@ cc_library_static { // Allow implicit fallthroughs in wifi_legacy_hal.cpp until they are fixed. cflags: ["-Wno-error=implicit-fallthrough"], srcs: [ - "hidl_struct_util.cpp", - "hidl_sync_util.cpp", + "aidl_struct_util.cpp", + "aidl_sync_util.cpp", "ringbuffer.cpp", "wifi.cpp", "wifi_ap_iface.cpp", @@ -93,29 +93,23 @@ cc_library_static { shared_libs: [ "libbase", + "libbinder_ndk", "libcutils", - "libhidlbase", "liblog", "libnl", "libutils", "libwifi-hal", "libwifi-system-iface", "libxml2", - "android.hardware.wifi@1.0", - "android.hardware.wifi@1.1", - "android.hardware.wifi@1.2", - "android.hardware.wifi@1.3", - "android.hardware.wifi@1.4", - "android.hardware.wifi@1.5", - "android.hardware.wifi@1.6", + "android.hardware.wifi-V1-ndk", ], export_include_dirs: ["."], } cc_binary { - name: "android.hardware.wifi@1.0-service", - vintf_fragments: ["android.hardware.wifi@1.0-service.xml"], + name: "android.hardware.wifi-service", + vintf_fragments: ["android.hardware.wifi-service.xml"], relative_install_path: "hw", proprietary: true, cppflags: [ @@ -126,30 +120,24 @@ cc_binary { srcs: ["service.cpp"], shared_libs: [ "libbase", + "libbinder_ndk", "libcutils", - "libhidlbase", "liblog", "libnl", "libutils", "libwifi-hal", "libwifi-system-iface", "libxml2", - "android.hardware.wifi@1.0", - "android.hardware.wifi@1.1", - "android.hardware.wifi@1.2", - "android.hardware.wifi@1.3", - "android.hardware.wifi@1.4", - "android.hardware.wifi@1.5", - "android.hardware.wifi@1.6", + "android.hardware.wifi-V1-ndk", ], - static_libs: ["android.hardware.wifi@1.0-service-lib"], - init_rc: ["android.hardware.wifi@1.0-service.rc"], + static_libs: ["android.hardware.wifi-service-lib"], + init_rc: ["android.hardware.wifi-service.rc"], } cc_binary { - name: "android.hardware.wifi@1.0-service-lazy", - vintf_fragments: ["android.hardware.wifi@1.0-service.xml"], - overrides: ["android.hardware.wifi@1.0-service"], + name: "android.hardware.wifi-service-lazy", + vintf_fragments: ["android.hardware.wifi-service.xml"], + overrides: ["android.hardware.wifi-service"], cflags: ["-DLAZY_SERVICE"], relative_install_path: "hw", proprietary: true, @@ -161,28 +149,22 @@ cc_binary { srcs: ["service.cpp"], shared_libs: [ "libbase", + "libbinder_ndk", "libcutils", - "libhidlbase", "liblog", "libnl", "libutils", "libwifi-hal", "libwifi-system-iface", "libxml2", - "android.hardware.wifi@1.0", - "android.hardware.wifi@1.1", - "android.hardware.wifi@1.2", - "android.hardware.wifi@1.3", - "android.hardware.wifi@1.4", - "android.hardware.wifi@1.5", - "android.hardware.wifi@1.6", + "android.hardware.wifi-V1-ndk", ], - static_libs: ["android.hardware.wifi@1.0-service-lib"], - init_rc: ["android.hardware.wifi@1.0-service-lazy.rc"], + static_libs: ["android.hardware.wifi-service-lib"], + init_rc: ["android.hardware.wifi-service-lazy.rc"], } cc_test { - name: "android.hardware.wifi@1.0-service-tests", + name: "android.hardware.wifi-service-tests", proprietary: true, compile_multilib: "first", cppflags: [ @@ -191,7 +173,7 @@ cc_test { "-Wextra", ], srcs: [ - "tests/hidl_struct_util_unit_tests.cpp", + "tests/aidl_struct_util_unit_tests.cpp", "tests/main.cpp", "tests/mock_interface_tool.cpp", "tests/mock_wifi_feature_flags.cpp", @@ -206,19 +188,13 @@ cc_test { static_libs: [ "libgmock", "libgtest", - "android.hardware.wifi@1.0", - "android.hardware.wifi@1.1", - "android.hardware.wifi@1.2", - "android.hardware.wifi@1.3", - "android.hardware.wifi@1.4", - "android.hardware.wifi@1.5", - "android.hardware.wifi@1.6", - "android.hardware.wifi@1.0-service-lib", + "android.hardware.wifi-V1-ndk", + "android.hardware.wifi-service-lib", ], shared_libs: [ "libbase", + "libbinder_ndk", "libcutils", - "libhidlbase", "liblog", "libnl", "libutils", @@ -228,11 +204,11 @@ cc_test { } filegroup { - name: "default-android.hardware.wifi@1.0-service.rc", - srcs: ["android.hardware.wifi@1.0-service.rc"], + name: "default-android.hardware.wifi-service.rc", + srcs: ["android.hardware.wifi-service.rc"], } filegroup { - name: "default-android.hardware.wifi@1.0-service.xml", - srcs: ["android.hardware.wifi@1.0-service.xml"], + name: "default-android.hardware.wifi-service.xml", + srcs: ["android.hardware.wifi-service.xml"], } diff --git a/wifi/1.6/default/THREADING.README b/wifi/aidl/default/THREADING.README similarity index 82% rename from wifi/1.6/default/THREADING.README rename to wifi/aidl/default/THREADING.README index 8366ca0201..45679da069 100644 --- a/wifi/1.6/default/THREADING.README +++ b/wifi/aidl/default/THREADING.README @@ -1,7 +1,7 @@ Vendor HAL Threading Model ========================== The vendor HAL service has two threads: -1. HIDL thread: This is the main thread which processes all the incoming HIDL +1. AIDL thread: This is the main thread which processes all the incoming AIDL RPC's. 2. Legacy HAL event loop thread: This is the thread forked off for processing the legacy HAL event loop (wifi_event_loop()). This thread is used to process @@ -11,9 +11,9 @@ callbacks passed to the legacy HAL API's are invoked on this thread. Synchronization Concerns ======================== wifi_legacy_hal.cpp has a bunch of global "C" style functions to handle the -legacy callbacks. Each of these "C" style function invokes a corresponding +legacy callbacks. Each of these "C" style functions invokes a corresponding "std::function" version of the callback which does the actual processing. -The variables holding these "std::function" callbacks are reset from the HIDL +The variables holding these "std::function" callbacks are reset from the AIDL thread when they are no longer used. For example: stopGscan() will reset the corresponding "on_gscan_*" callback variables which were set when startGscan() was invoked. This is not thread safe since these callback variables are @@ -24,12 +24,12 @@ Synchronization Solution Adding a global lock seems to be the most trivial solution to the problem. a) All of the asynchronous "C" style callbacks will acquire the global lock before invoking the corresponding "std::function" callback variables. -b) All of the HIDL methods will also acquire the global lock before processing -(in hidl_return_util::validateAndCall()). +b) All of the AIDL methods will also acquire the global lock before processing +(in aidl_return_util::validateAndCall()). Note: It's important that we only acquire the global lock for asynchronous callbacks, because there is no guarantee (or documentation to clarify) that the synchronous callbacks are invoked on the same invocation thread. If that is not the case in some implementation, we will end up deadlocking the system since the -HIDL thread would have acquired the global lock which is needed by the +AIDL thread would have acquired the global lock which is needed by the synchronous callback executed on the legacy hal event loop thread. diff --git a/wifi/aidl/default/aidl_callback_util.h b/wifi/aidl/default/aidl_callback_util.h new file mode 100644 index 0000000000..41d70a53aa --- /dev/null +++ b/wifi/aidl/default/aidl_callback_util.h @@ -0,0 +1,140 @@ +/* + * 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. + */ + +#ifndef AIDL_CALLBACK_UTIL_H_ +#define AIDL_CALLBACK_UTIL_H_ + +#include + +#include +#include + +namespace { +std::unordered_map callback_handler_map_; +} + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace aidl_callback_util { + +// Provides a class to manage callbacks for the various AIDL interfaces and +// handle the death of the process hosting each callback. +template +class AidlCallbackHandler { + public: + AidlCallbackHandler() { + death_handler_ = AIBinder_DeathRecipient_new(AidlCallbackHandler::onCallbackDeath); + } + ~AidlCallbackHandler() { invalidate(); } + + bool addCallback(const std::shared_ptr& cb) { + void* cbPtr = reinterpret_cast(cb->asBinder().get()); + const auto& cbPosition = findCbInSet(cbPtr); + if (cbPosition != cb_set_.end()) { + LOG(WARNING) << "Duplicate death notification registration"; + return true; + } + + if (AIBinder_linkToDeath(cb->asBinder().get(), death_handler_, cbPtr /* cookie */) != + STATUS_OK) { + LOG(ERROR) << "Failed to register death notification"; + return false; + } + + callback_handler_map_[cbPtr] = reinterpret_cast(this); + cb_set_.insert(cb); + return true; + } + + const std::set>& getCallbacks() { return cb_set_; } + + void invalidate() { + for (auto cb : cb_set_) { + void* cookie = reinterpret_cast(cb->asBinder().get()); + if (AIBinder_unlinkToDeath(cb->asBinder().get(), death_handler_, cookie) != STATUS_OK) { + LOG(ERROR) << "Failed to deregister death notification"; + } + if (!removeCbFromHandlerMap(cookie)) { + LOG(ERROR) << "Failed to remove callback from handler map"; + } + } + cb_set_.clear(); + } + + // Entry point for the death handling logic. AIBinder_DeathRecipient + // can only call a static function, so use the cookie to find the + // proper handler and route the request there. + static void onCallbackDeath(void* cookie) { + auto cbQuery = callback_handler_map_.find(cookie); + if (cbQuery == callback_handler_map_.end()) { + LOG(ERROR) << "Invalid death cookie received"; + return; + } + + AidlCallbackHandler* cbHandler = reinterpret_cast(cbQuery->second); + if (cbHandler == nullptr) { + LOG(ERROR) << "Handler mapping contained an invalid handler"; + return; + } + cbHandler->handleCallbackDeath(cbQuery->first); + } + + private: + std::set> cb_set_; + AIBinder_DeathRecipient* death_handler_; + + typename std::set>::iterator findCbInSet(void* cbPtr) { + const auto& cbPosition = std::find_if( + cb_set_.begin(), cb_set_.end(), [cbPtr](const std::shared_ptr& p) { + return cbPtr == reinterpret_cast(p->asBinder().get()); + }); + return cbPosition; + } + + bool removeCbFromHandlerMap(void* cbPtr) { + auto cbQuery = callback_handler_map_.find(cbPtr); + if (cbQuery != callback_handler_map_.end()) { + callback_handler_map_.erase(cbQuery); + return true; + } + return false; + } + + void handleCallbackDeath(void* cbPtr) { + const auto& cbPosition = findCbInSet(cbPtr); + if (cbPosition == cb_set_.end()) { + LOG(ERROR) << "Unknown callback death notification received"; + return; + } + cb_set_.erase(cbPosition); + + if (!removeCbFromHandlerMap(cbPtr)) { + LOG(ERROR) << "Callback was not in callback handler map"; + } + } + + DISALLOW_COPY_AND_ASSIGN(AidlCallbackHandler); +}; + +} // namespace aidl_callback_util +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // AIDL_CALLBACK_UTIL_H_ diff --git a/wifi/aidl/default/aidl_return_util.h b/wifi/aidl/default/aidl_return_util.h new file mode 100644 index 0000000000..9a49a22e2a --- /dev/null +++ b/wifi/aidl/default/aidl_return_util.h @@ -0,0 +1,85 @@ +/* + * 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. + */ + +#ifndef AIDL_RETURN_UTIL_H_ +#define AIDL_RETURN_UTIL_H_ + +#include "aidl_sync_util.h" +#include "wifi_status_util.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace aidl_return_util { +using aidl::android::hardware::wifi::WifiStatusCode; +using aidl::android::hardware::wifi::aidl_sync_util::acquireGlobalLock; + +/** + * These utility functions are used to invoke a method on the provided + * AIDL interface object. + * These functions checks if the provided AIDL interface object is valid. + * a) If valid, Invokes the corresponding internal implementation function of + * the AIDL method. + * b) If invalid, return without calling the internal implementation function. + */ + +// Use for AIDL methods which return only an AIDL status. +template +::ndk::ScopedAStatus validateAndCall(ObjT* obj, WifiStatusCode status_code_if_invalid, + WorkFuncT&& work, Args&&... args) { + const auto lock = acquireGlobalLock(); + if (obj->isValid()) { + return (obj->*work)(std::forward(args)...); + } else { + return createWifiStatus(status_code_if_invalid); + } +} + +// Use for AIDL methods which return only an AIDL status. +// This version passes the global lock acquired to the body of the method. +template +::ndk::ScopedAStatus validateAndCallWithLock(ObjT* obj, WifiStatusCode status_code_if_invalid, + WorkFuncT&& work, Args&&... args) { + auto lock = acquireGlobalLock(); + if (obj->isValid()) { + return (obj->*work)(&lock, std::forward(args)...); + } else { + return createWifiStatus(status_code_if_invalid); + } +} + +// Use for AIDL methods which have a return value along with the AIDL status +template +::ndk::ScopedAStatus validateAndCall(ObjT* obj, WifiStatusCode status_code_if_invalid, + WorkFuncT&& work, ReturnT* ret_val, Args&&... args) { + const auto lock = acquireGlobalLock(); + if (obj->isValid()) { + auto call_pair = (obj->*work)(std::forward(args)...); + *ret_val = call_pair.first; + return std::forward<::ndk::ScopedAStatus>(call_pair.second); + } else { + return ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(status_code_if_invalid)); + } +} + +} // namespace aidl_return_util +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl +#endif // AIDL_RETURN_UTIL_H_ diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp new file mode 100644 index 0000000000..07612b65c5 --- /dev/null +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -0,0 +1,2775 @@ +/* + * 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. + */ + +#include +#include + +#include "aidl_struct_util.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace aidl_struct_util { + +WifiChannelWidthInMhz convertLegacyWifiChannelWidthToAidl(legacy_hal::wifi_channel_width type); + +std::string safeConvertChar(const char* str, size_t max_len) { + const char* c = str; + size_t size = 0; + while (*c && (unsigned char)*c < 128 && size < max_len) { + ++size; + ++c; + } + return std::string(str, size); +} + +inline std::vector uintToIntVec(const std::vector& in) { + return std::vector(in.begin(), in.end()); +} + +IWifiChip::ChipCapabilityMask convertLegacyLoggerFeatureToAidlChipCapability(uint32_t feature) { + switch (feature) { + case legacy_hal::WIFI_LOGGER_MEMORY_DUMP_SUPPORTED: + return IWifiChip::ChipCapabilityMask::DEBUG_MEMORY_FIRMWARE_DUMP; + case legacy_hal::WIFI_LOGGER_DRIVER_DUMP_SUPPORTED: + return IWifiChip::ChipCapabilityMask::DEBUG_MEMORY_DRIVER_DUMP; + case legacy_hal::WIFI_LOGGER_CONNECT_EVENT_SUPPORTED: + return IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_CONNECT_EVENT; + case legacy_hal::WIFI_LOGGER_POWER_EVENT_SUPPORTED: + return IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_POWER_EVENT; + case legacy_hal::WIFI_LOGGER_WAKE_LOCK_SUPPORTED: + return IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_WAKELOCK_EVENT; + }; + CHECK(false) << "Unknown legacy feature: " << feature; + return {}; +} + +IWifiStaIface::StaIfaceCapabilityMask convertLegacyLoggerFeatureToAidlStaIfaceCapability( + uint32_t feature) { + switch (feature) { + case legacy_hal::WIFI_LOGGER_PACKET_FATE_SUPPORTED: + return IWifiStaIface::StaIfaceCapabilityMask::DEBUG_PACKET_FATE; + }; + CHECK(false) << "Unknown legacy feature: " << feature; + return {}; +} + +IWifiChip::ChipCapabilityMask convertLegacyFeatureToAidlChipCapability(uint64_t feature) { + switch (feature) { + case WIFI_FEATURE_SET_TX_POWER_LIMIT: + return IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT; + case WIFI_FEATURE_USE_BODY_HEAD_SAR: + return IWifiChip::ChipCapabilityMask::USE_BODY_HEAD_SAR; + case WIFI_FEATURE_D2D_RTT: + return IWifiChip::ChipCapabilityMask::D2D_RTT; + case WIFI_FEATURE_D2AP_RTT: + return IWifiChip::ChipCapabilityMask::D2AP_RTT; + case WIFI_FEATURE_INFRA_60G: + return IWifiChip::ChipCapabilityMask::WIGIG; + case WIFI_FEATURE_SET_LATENCY_MODE: + return IWifiChip::ChipCapabilityMask::SET_LATENCY_MODE; + case WIFI_FEATURE_P2P_RAND_MAC: + return IWifiChip::ChipCapabilityMask::P2P_RAND_MAC; + }; + CHECK(false) << "Unknown legacy feature: " << feature; + return {}; +} + +IWifiStaIface::StaIfaceCapabilityMask convertLegacyFeatureToAidlStaIfaceCapability( + uint64_t feature) { + switch (feature) { + case WIFI_FEATURE_GSCAN: + return IWifiStaIface::StaIfaceCapabilityMask::BACKGROUND_SCAN; + case WIFI_FEATURE_LINK_LAYER_STATS: + return IWifiStaIface::StaIfaceCapabilityMask::LINK_LAYER_STATS; + case WIFI_FEATURE_RSSI_MONITOR: + return IWifiStaIface::StaIfaceCapabilityMask::RSSI_MONITOR; + case WIFI_FEATURE_CONTROL_ROAMING: + return IWifiStaIface::StaIfaceCapabilityMask::CONTROL_ROAMING; + case WIFI_FEATURE_IE_WHITELIST: + return IWifiStaIface::StaIfaceCapabilityMask::PROBE_IE_ALLOWLIST; + case WIFI_FEATURE_SCAN_RAND: + return IWifiStaIface::StaIfaceCapabilityMask::SCAN_RAND; + case WIFI_FEATURE_INFRA_5G: + return IWifiStaIface::StaIfaceCapabilityMask::STA_5G; + case WIFI_FEATURE_HOTSPOT: + return IWifiStaIface::StaIfaceCapabilityMask::HOTSPOT; + case WIFI_FEATURE_PNO: + return IWifiStaIface::StaIfaceCapabilityMask::PNO; + case WIFI_FEATURE_TDLS: + return IWifiStaIface::StaIfaceCapabilityMask::TDLS; + case WIFI_FEATURE_TDLS_OFFCHANNEL: + return IWifiStaIface::StaIfaceCapabilityMask::TDLS_OFFCHANNEL; + case WIFI_FEATURE_CONFIG_NDO: + return IWifiStaIface::StaIfaceCapabilityMask::ND_OFFLOAD; + case WIFI_FEATURE_MKEEP_ALIVE: + return IWifiStaIface::StaIfaceCapabilityMask::KEEP_ALIVE; + }; + CHECK(false) << "Unknown legacy feature: " << feature; + return {}; +} + +bool convertLegacyFeaturesToAidlChipCapabilities(uint64_t legacy_feature_set, + uint32_t legacy_logger_feature_set, + uint32_t* aidl_caps) { + if (!aidl_caps) { + return false; + } + *aidl_caps = {}; + for (const auto feature : {legacy_hal::WIFI_LOGGER_MEMORY_DUMP_SUPPORTED, + legacy_hal::WIFI_LOGGER_DRIVER_DUMP_SUPPORTED, + legacy_hal::WIFI_LOGGER_CONNECT_EVENT_SUPPORTED, + legacy_hal::WIFI_LOGGER_POWER_EVENT_SUPPORTED, + legacy_hal::WIFI_LOGGER_WAKE_LOCK_SUPPORTED}) { + if (feature & legacy_logger_feature_set) { + *aidl_caps |= + static_cast(convertLegacyLoggerFeatureToAidlChipCapability(feature)); + } + } + std::vector features = {WIFI_FEATURE_SET_TX_POWER_LIMIT, + WIFI_FEATURE_USE_BODY_HEAD_SAR, + WIFI_FEATURE_D2D_RTT, + WIFI_FEATURE_D2AP_RTT, + WIFI_FEATURE_INFRA_60G, + WIFI_FEATURE_SET_LATENCY_MODE, + WIFI_FEATURE_P2P_RAND_MAC}; + for (const auto feature : features) { + if (feature & legacy_feature_set) { + *aidl_caps |= static_cast(convertLegacyFeatureToAidlChipCapability(feature)); + } + } + + // There are no flags for these 3 in the legacy feature set. Adding them to + // the set because all the current devices support it. + *aidl_caps |= + static_cast(IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_VENDOR_DATA); + *aidl_caps |= + static_cast(IWifiChip::ChipCapabilityMask::DEBUG_HOST_WAKE_REASON_STATS); + *aidl_caps |= static_cast(IWifiChip::ChipCapabilityMask::DEBUG_ERROR_ALERTS); + return true; +} + +WifiDebugRingBufferFlags convertLegacyDebugRingBufferFlagsToAidl(uint32_t flag) { + switch (flag) { + case WIFI_RING_BUFFER_FLAG_HAS_BINARY_ENTRIES: + return WifiDebugRingBufferFlags::HAS_BINARY_ENTRIES; + case WIFI_RING_BUFFER_FLAG_HAS_ASCII_ENTRIES: + return WifiDebugRingBufferFlags::HAS_ASCII_ENTRIES; + }; + CHECK(false) << "Unknown legacy flag: " << flag; + return {}; +} + +bool convertLegacyDebugRingBufferStatusToAidl( + const legacy_hal::wifi_ring_buffer_status& legacy_status, + WifiDebugRingBufferStatus* aidl_status) { + if (!aidl_status) { + return false; + } + *aidl_status = {}; + aidl_status->ringName = safeConvertChar(reinterpret_cast(legacy_status.name), + sizeof(legacy_status.name)); + aidl_status->flags = 0; + for (const auto flag : + {WIFI_RING_BUFFER_FLAG_HAS_BINARY_ENTRIES, WIFI_RING_BUFFER_FLAG_HAS_ASCII_ENTRIES}) { + if (flag & legacy_status.flags) { + aidl_status->flags |= static_cast::type>( + convertLegacyDebugRingBufferFlagsToAidl(flag)); + } + } + aidl_status->ringId = legacy_status.ring_id; + aidl_status->sizeInBytes = legacy_status.ring_buffer_byte_size; + // Calculate free size of the ring the buffer. We don't need to send the + // exact read/write pointers that were there in the legacy HAL interface. + if (legacy_status.written_bytes >= legacy_status.read_bytes) { + aidl_status->freeSizeInBytes = legacy_status.ring_buffer_byte_size - + (legacy_status.written_bytes - legacy_status.read_bytes); + } else { + aidl_status->freeSizeInBytes = legacy_status.read_bytes - legacy_status.written_bytes; + } + aidl_status->verboseLevel = legacy_status.verbose_level; + return true; +} + +bool convertLegacyVectorOfDebugRingBufferStatusToAidl( + const std::vector& legacy_status_vec, + std::vector* aidl_status_vec) { + if (!aidl_status_vec) { + return false; + } + *aidl_status_vec = {}; + for (const auto& legacy_status : legacy_status_vec) { + WifiDebugRingBufferStatus aidl_status; + if (!convertLegacyDebugRingBufferStatusToAidl(legacy_status, &aidl_status)) { + return false; + } + aidl_status_vec->push_back(aidl_status); + } + return true; +} + +bool convertLegacyWakeReasonStatsToAidl(const legacy_hal::WakeReasonStats& legacy_stats, + WifiDebugHostWakeReasonStats* aidl_stats) { + if (!aidl_stats) { + return false; + } + *aidl_stats = {}; + aidl_stats->totalCmdEventWakeCnt = legacy_stats.wake_reason_cnt.total_cmd_event_wake; + aidl_stats->cmdEventWakeCntPerType = uintToIntVec(legacy_stats.cmd_event_wake_cnt); + aidl_stats->totalDriverFwLocalWakeCnt = legacy_stats.wake_reason_cnt.total_driver_fw_local_wake; + aidl_stats->driverFwLocalWakeCntPerType = uintToIntVec(legacy_stats.driver_fw_local_wake_cnt); + aidl_stats->totalRxPacketWakeCnt = legacy_stats.wake_reason_cnt.total_rx_data_wake; + aidl_stats->rxPktWakeDetails.rxUnicastCnt = + legacy_stats.wake_reason_cnt.rx_wake_details.rx_unicast_cnt; + aidl_stats->rxPktWakeDetails.rxMulticastCnt = + legacy_stats.wake_reason_cnt.rx_wake_details.rx_multicast_cnt; + aidl_stats->rxPktWakeDetails.rxBroadcastCnt = + legacy_stats.wake_reason_cnt.rx_wake_details.rx_broadcast_cnt; + aidl_stats->rxMulticastPkWakeDetails.ipv4RxMulticastAddrCnt = + legacy_stats.wake_reason_cnt.rx_multicast_wake_pkt_info.ipv4_rx_multicast_addr_cnt; + aidl_stats->rxMulticastPkWakeDetails.ipv6RxMulticastAddrCnt = + legacy_stats.wake_reason_cnt.rx_multicast_wake_pkt_info.ipv6_rx_multicast_addr_cnt; + aidl_stats->rxMulticastPkWakeDetails.otherRxMulticastAddrCnt = + legacy_stats.wake_reason_cnt.rx_multicast_wake_pkt_info.other_rx_multicast_addr_cnt; + aidl_stats->rxIcmpPkWakeDetails.icmpPkt = + legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp_pkt; + aidl_stats->rxIcmpPkWakeDetails.icmp6Pkt = + legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_pkt; + aidl_stats->rxIcmpPkWakeDetails.icmp6Ra = + legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_ra; + aidl_stats->rxIcmpPkWakeDetails.icmp6Na = + legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_na; + aidl_stats->rxIcmpPkWakeDetails.icmp6Ns = + legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_ns; + return true; +} + +legacy_hal::wifi_power_scenario convertAidlTxPowerScenarioToLegacy( + IWifiChip::TxPowerScenario aidl_scenario) { + switch (aidl_scenario) { + case IWifiChip::TxPowerScenario::VOICE_CALL: + return legacy_hal::WIFI_POWER_SCENARIO_VOICE_CALL; + case IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF: + return legacy_hal::WIFI_POWER_SCENARIO_ON_HEAD_CELL_OFF; + case IWifiChip::TxPowerScenario::ON_HEAD_CELL_ON: + return legacy_hal::WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON; + case IWifiChip::TxPowerScenario::ON_BODY_CELL_OFF: + return legacy_hal::WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF; + case IWifiChip::TxPowerScenario::ON_BODY_CELL_ON: + return legacy_hal::WIFI_POWER_SCENARIO_ON_BODY_CELL_ON; + }; + CHECK(false); +} + +legacy_hal::wifi_latency_mode convertAidlLatencyModeToLegacy( + IWifiChip::LatencyMode aidl_latency_mode) { + switch (aidl_latency_mode) { + case IWifiChip::LatencyMode::NORMAL: + return legacy_hal::WIFI_LATENCY_MODE_NORMAL; + case IWifiChip::LatencyMode::LOW: + return legacy_hal::WIFI_LATENCY_MODE_LOW; + } + CHECK(false); +} + +bool convertLegacyWifiMacInfoToAidl(const legacy_hal::WifiMacInfo& legacy_mac_info, + IWifiChipEventCallback::RadioModeInfo* aidl_radio_mode_info) { + if (!aidl_radio_mode_info) { + return false; + } + *aidl_radio_mode_info = {}; + + aidl_radio_mode_info->radioId = legacy_mac_info.wlan_mac_id; + // Convert from bitmask of bands in the legacy HAL to enum value in + // the AIDL interface. + if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND && + legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND && + legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND) { + aidl_radio_mode_info->bandInfo = WifiBand::BAND_24GHZ_5GHZ_6GHZ; + } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND && + legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND) { + aidl_radio_mode_info->bandInfo = WifiBand::BAND_5GHZ_6GHZ; + } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND) { + aidl_radio_mode_info->bandInfo = WifiBand::BAND_6GHZ; + } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND && + legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND) { + aidl_radio_mode_info->bandInfo = WifiBand::BAND_24GHZ_5GHZ; + } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND) { + aidl_radio_mode_info->bandInfo = WifiBand::BAND_24GHZ; + } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND) { + aidl_radio_mode_info->bandInfo = WifiBand::BAND_5GHZ; + } else { + aidl_radio_mode_info->bandInfo = WifiBand::BAND_UNSPECIFIED; + } + std::vector iface_info_vec; + for (const auto& legacy_iface_info : legacy_mac_info.iface_infos) { + IWifiChipEventCallback::IfaceInfo iface_info; + iface_info.name = legacy_iface_info.name; + iface_info.channel = legacy_iface_info.channel; + iface_info_vec.push_back(iface_info); + } + aidl_radio_mode_info->ifaceInfos = iface_info_vec; + return true; +} + +uint32_t convertAidlWifiBandToLegacyMacBand(WifiBand aidl_band) { + switch (aidl_band) { + case WifiBand::BAND_24GHZ: + return legacy_hal::WLAN_MAC_2_4_BAND; + case WifiBand::BAND_5GHZ: + case WifiBand::BAND_5GHZ_DFS: + case WifiBand::BAND_5GHZ_WITH_DFS: + return legacy_hal::WLAN_MAC_5_0_BAND; + case WifiBand::BAND_24GHZ_5GHZ: + case WifiBand::BAND_24GHZ_5GHZ_WITH_DFS: + return (legacy_hal::WLAN_MAC_2_4_BAND | legacy_hal::WLAN_MAC_5_0_BAND); + case WifiBand::BAND_6GHZ: + return legacy_hal::WLAN_MAC_6_0_BAND; + case WifiBand::BAND_5GHZ_6GHZ: + return (legacy_hal::WLAN_MAC_5_0_BAND | legacy_hal::WLAN_MAC_6_0_BAND); + case WifiBand::BAND_24GHZ_5GHZ_6GHZ: + case WifiBand::BAND_24GHZ_5GHZ_WITH_DFS_6GHZ: + return (legacy_hal::WLAN_MAC_2_4_BAND | legacy_hal::WLAN_MAC_5_0_BAND | + legacy_hal::WLAN_MAC_6_0_BAND); + case WifiBand::BAND_60GHZ: + return legacy_hal::WLAN_MAC_60_0_BAND; + default: + return (legacy_hal::WLAN_MAC_2_4_BAND | legacy_hal::WLAN_MAC_5_0_BAND | + legacy_hal::WLAN_MAC_6_0_BAND | legacy_hal::WLAN_MAC_60_0_BAND); + } +} + +WifiBand convertLegacyMacBandToAidlWifiBand(uint32_t band) { + switch (band) { + case legacy_hal::WLAN_MAC_2_4_BAND: + return WifiBand::BAND_24GHZ; + case legacy_hal::WLAN_MAC_5_0_BAND: + return WifiBand::BAND_5GHZ; + case legacy_hal::WLAN_MAC_6_0_BAND: + return WifiBand::BAND_6GHZ; + case legacy_hal::WLAN_MAC_60_0_BAND: + return WifiBand::BAND_60GHZ; + default: + return WifiBand::BAND_UNSPECIFIED; + } +} + +uint32_t convertAidlWifiIfaceModeToLegacy(uint32_t aidl_iface_mask) { + uint32_t legacy_iface_mask = 0; + if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_STA)) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_STA); + } + if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_SOFTAP)) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_SOFTAP); + } + if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_P2P_CLIENT)) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_P2P_CLIENT); + } + if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_P2P_GO)) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_P2P_GO); + } + if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_NAN)) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_NAN); + } + if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_TDLS)) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_TDLS); + } + if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_MESH)) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_MESH); + } + if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_IBSS)) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_IBSS); + } + return legacy_iface_mask; +} + +uint32_t convertLegacyWifiInterfaceModeToAidl(uint32_t legacy_iface_mask) { + uint32_t aidl_iface_mask = 0; + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_STA)) { + aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_STA); + } + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_SOFTAP)) { + aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_SOFTAP); + } + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_P2P_CLIENT)) { + aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_P2P_CLIENT); + } + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_P2P_GO)) { + aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_P2P_GO); + } + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_NAN)) { + aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_NAN); + } + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_TDLS)) { + aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_TDLS); + } + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_MESH)) { + aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_MESH); + } + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_IBSS)) { + aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_IBSS); + } + return aidl_iface_mask; +} + +uint32_t convertAidlUsableChannelFilterToLegacy(uint32_t aidl_filter_mask) { + uint32_t legacy_filter_mask = 0; + if (aidl_filter_mask & + static_cast(IWifiChip::UsableChannelFilter::CELLULAR_COEXISTENCE)) { + legacy_filter_mask |= legacy_hal::WIFI_USABLE_CHANNEL_FILTER_CELLULAR_COEXISTENCE; + } + if (aidl_filter_mask & static_cast(IWifiChip::UsableChannelFilter::CONCURRENCY)) { + legacy_filter_mask |= legacy_hal::WIFI_USABLE_CHANNEL_FILTER_CONCURRENCY; + } + if (aidl_filter_mask & static_cast(IWifiChip::UsableChannelFilter::NAN_INSTANT_MODE)) { + legacy_filter_mask |= WIFI_USABLE_CHANNEL_FILTER_NAN_INSTANT_MODE; + } + return legacy_filter_mask; +} + +bool convertLegacyWifiUsableChannelToAidl( + const legacy_hal::wifi_usable_channel& legacy_usable_channel, + WifiUsableChannel* aidl_usable_channel) { + if (!aidl_usable_channel) { + return false; + } + *aidl_usable_channel = {}; + aidl_usable_channel->channel = legacy_usable_channel.freq; + aidl_usable_channel->channelBandwidth = + convertLegacyWifiChannelWidthToAidl(legacy_usable_channel.width); + aidl_usable_channel->ifaceModeMask = static_cast( + convertLegacyWifiInterfaceModeToAidl(legacy_usable_channel.iface_mode_mask)); + + return true; +} + +bool convertLegacyWifiUsableChannelsToAidl( + const std::vector& legacy_usable_channels, + std::vector* aidl_usable_channels) { + if (!aidl_usable_channels) { + return false; + } + *aidl_usable_channels = {}; + for (const auto& legacy_usable_channel : legacy_usable_channels) { + WifiUsableChannel aidl_usable_channel; + if (!convertLegacyWifiUsableChannelToAidl(legacy_usable_channel, &aidl_usable_channel)) { + return false; + } + aidl_usable_channels->push_back(aidl_usable_channel); + } + return true; +} + +bool convertLegacyWifiMacInfosToAidl( + const std::vector& legacy_mac_infos, + std::vector* aidl_radio_mode_infos) { + if (!aidl_radio_mode_infos) { + return false; + } + *aidl_radio_mode_infos = {}; + + for (const auto& legacy_mac_info : legacy_mac_infos) { + IWifiChipEventCallback::RadioModeInfo aidl_radio_mode_info; + if (!convertLegacyWifiMacInfoToAidl(legacy_mac_info, &aidl_radio_mode_info)) { + return false; + } + aidl_radio_mode_infos->push_back(aidl_radio_mode_info); + } + return true; +} + +bool convertLegacyFeaturesToAidlStaCapabilities(uint64_t legacy_feature_set, + uint32_t legacy_logger_feature_set, + uint32_t* aidl_caps) { + if (!aidl_caps) { + return false; + } + *aidl_caps = {}; + for (const auto feature : {legacy_hal::WIFI_LOGGER_PACKET_FATE_SUPPORTED}) { + if (feature & legacy_logger_feature_set) { + *aidl_caps |= static_cast( + convertLegacyLoggerFeatureToAidlStaIfaceCapability(feature)); + } + } + for (const auto feature : + {WIFI_FEATURE_GSCAN, WIFI_FEATURE_LINK_LAYER_STATS, WIFI_FEATURE_RSSI_MONITOR, + WIFI_FEATURE_CONTROL_ROAMING, WIFI_FEATURE_IE_WHITELIST, WIFI_FEATURE_SCAN_RAND, + WIFI_FEATURE_INFRA_5G, WIFI_FEATURE_HOTSPOT, WIFI_FEATURE_PNO, WIFI_FEATURE_TDLS, + WIFI_FEATURE_TDLS_OFFCHANNEL, WIFI_FEATURE_CONFIG_NDO, WIFI_FEATURE_MKEEP_ALIVE}) { + if (feature & legacy_feature_set) { + *aidl_caps |= + static_cast(convertLegacyFeatureToAidlStaIfaceCapability(feature)); + } + } + // There is no flag for this one in the legacy feature set. Adding it to the + // set because all the current devices support it. + *aidl_caps |= static_cast(IWifiStaIface::StaIfaceCapabilityMask::APF); + return true; +} + +bool convertLegacyApfCapabilitiesToAidl(const legacy_hal::PacketFilterCapabilities& legacy_caps, + StaApfPacketFilterCapabilities* aidl_caps) { + if (!aidl_caps) { + return false; + } + *aidl_caps = {}; + aidl_caps->version = legacy_caps.version; + aidl_caps->maxLength = legacy_caps.max_len; + return true; +} + +uint8_t convertAidlGscanReportEventFlagToLegacy( + StaBackgroundScanBucketEventReportSchemeMask aidl_flag) { + using AidlFlag = StaBackgroundScanBucketEventReportSchemeMask; + switch (aidl_flag) { + case AidlFlag::EACH_SCAN: + return REPORT_EVENTS_EACH_SCAN; + case AidlFlag::FULL_RESULTS: + return REPORT_EVENTS_FULL_RESULTS; + case AidlFlag::NO_BATCH: + return REPORT_EVENTS_NO_BATCH; + }; + CHECK(false); +} + +StaScanDataFlagMask convertLegacyGscanDataFlagToAidl(uint8_t legacy_flag) { + switch (legacy_flag) { + case legacy_hal::WIFI_SCAN_FLAG_INTERRUPTED: + return StaScanDataFlagMask::INTERRUPTED; + }; + CHECK(false) << "Unknown legacy flag: " << legacy_flag; + // To silence the compiler warning about reaching the end of non-void + // function. + return {}; +} + +bool convertLegacyGscanCapabilitiesToAidl(const legacy_hal::wifi_gscan_capabilities& legacy_caps, + StaBackgroundScanCapabilities* aidl_caps) { + if (!aidl_caps) { + return false; + } + *aidl_caps = {}; + aidl_caps->maxCacheSize = legacy_caps.max_scan_cache_size; + aidl_caps->maxBuckets = legacy_caps.max_scan_buckets; + aidl_caps->maxApCachePerScan = legacy_caps.max_ap_cache_per_scan; + aidl_caps->maxReportingThreshold = legacy_caps.max_scan_reporting_threshold; + return true; +} + +legacy_hal::wifi_band convertAidlWifiBandToLegacy(WifiBand band) { + switch (band) { + case WifiBand::BAND_UNSPECIFIED: + return legacy_hal::WIFI_BAND_UNSPECIFIED; + case WifiBand::BAND_24GHZ: + return legacy_hal::WIFI_BAND_BG; + case WifiBand::BAND_5GHZ: + return legacy_hal::WIFI_BAND_A; + case WifiBand::BAND_5GHZ_DFS: + return legacy_hal::WIFI_BAND_A_DFS; + case WifiBand::BAND_5GHZ_WITH_DFS: + return legacy_hal::WIFI_BAND_A_WITH_DFS; + case WifiBand::BAND_24GHZ_5GHZ: + return legacy_hal::WIFI_BAND_ABG; + case WifiBand::BAND_24GHZ_5GHZ_WITH_DFS: + return legacy_hal::WIFI_BAND_ABG_WITH_DFS; + default: + CHECK(false); + return {}; + }; +} + +bool convertAidlGscanParamsToLegacy(const StaBackgroundScanParameters& aidl_scan_params, + legacy_hal::wifi_scan_cmd_params* legacy_scan_params) { + if (!legacy_scan_params) { + return false; + } + *legacy_scan_params = {}; + legacy_scan_params->base_period = aidl_scan_params.basePeriodInMs; + legacy_scan_params->max_ap_per_scan = aidl_scan_params.maxApPerScan; + legacy_scan_params->report_threshold_percent = aidl_scan_params.reportThresholdPercent; + legacy_scan_params->report_threshold_num_scans = aidl_scan_params.reportThresholdNumScans; + if (aidl_scan_params.buckets.size() > MAX_BUCKETS) { + return false; + } + legacy_scan_params->num_buckets = aidl_scan_params.buckets.size(); + for (uint32_t bucket_idx = 0; bucket_idx < aidl_scan_params.buckets.size(); bucket_idx++) { + const StaBackgroundScanBucketParameters& aidl_bucket_spec = + aidl_scan_params.buckets[bucket_idx]; + legacy_hal::wifi_scan_bucket_spec& legacy_bucket_spec = + legacy_scan_params->buckets[bucket_idx]; + if (aidl_bucket_spec.bucketIdx >= MAX_BUCKETS) { + return false; + } + legacy_bucket_spec.bucket = aidl_bucket_spec.bucketIdx; + legacy_bucket_spec.band = convertAidlWifiBandToLegacy(aidl_bucket_spec.band); + legacy_bucket_spec.period = aidl_bucket_spec.periodInMs; + legacy_bucket_spec.max_period = aidl_bucket_spec.exponentialMaxPeriodInMs; + legacy_bucket_spec.base = aidl_bucket_spec.exponentialBase; + legacy_bucket_spec.step_count = aidl_bucket_spec.exponentialStepCount; + legacy_bucket_spec.report_events = 0; + using AidlFlag = StaBackgroundScanBucketEventReportSchemeMask; + for (const auto flag : {AidlFlag::EACH_SCAN, AidlFlag::FULL_RESULTS, AidlFlag::NO_BATCH}) { + if (static_cast(aidl_bucket_spec.eventReportScheme) & + static_cast::type>(flag)) { + legacy_bucket_spec.report_events |= convertAidlGscanReportEventFlagToLegacy(flag); + } + } + if (aidl_bucket_spec.frequencies.size() > MAX_CHANNELS) { + return false; + } + legacy_bucket_spec.num_channels = aidl_bucket_spec.frequencies.size(); + for (uint32_t freq_idx = 0; freq_idx < aidl_bucket_spec.frequencies.size(); freq_idx++) { + legacy_bucket_spec.channels[freq_idx].channel = aidl_bucket_spec.frequencies[freq_idx]; + } + } + return true; +} + +bool convertLegacyIeToAidl(const legacy_hal::wifi_information_element& legacy_ie, + WifiInformationElement* aidl_ie) { + if (!aidl_ie) { + return false; + } + *aidl_ie = {}; + aidl_ie->id = legacy_ie.id; + aidl_ie->data = std::vector(legacy_ie.data, legacy_ie.data + legacy_ie.len); + return true; +} + +bool convertLegacyIeBlobToAidl(const uint8_t* ie_blob, uint32_t ie_blob_len, + std::vector* aidl_ies) { + if (!ie_blob || !aidl_ies) { + return false; + } + *aidl_ies = {}; + const uint8_t* ies_begin = ie_blob; + const uint8_t* ies_end = ie_blob + ie_blob_len; + const uint8_t* next_ie = ies_begin; + using wifi_ie = legacy_hal::wifi_information_element; + constexpr size_t kIeHeaderLen = sizeof(wifi_ie); + // Each IE should at least have the header (i.e |id| & |len| fields). + while (next_ie + kIeHeaderLen <= ies_end) { + const wifi_ie& legacy_ie = (*reinterpret_cast(next_ie)); + uint32_t curr_ie_len = kIeHeaderLen + legacy_ie.len; + if (next_ie + curr_ie_len > ies_end) { + LOG(ERROR) << "Error parsing IE blob. Next IE: " << (void*)next_ie + << ", Curr IE len: " << curr_ie_len << ", IEs End: " << (void*)ies_end; + break; + } + WifiInformationElement aidl_ie; + if (!convertLegacyIeToAidl(legacy_ie, &aidl_ie)) { + LOG(ERROR) << "Error converting IE. Id: " << legacy_ie.id << ", len: " << legacy_ie.len; + break; + } + aidl_ies->push_back(std::move(aidl_ie)); + next_ie += curr_ie_len; + } + // Check if the blob has been fully consumed. + if (next_ie != ies_end) { + LOG(ERROR) << "Failed to fully parse IE blob. Next IE: " << (void*)next_ie + << ", IEs End: " << (void*)ies_end; + } + return true; +} + +bool convertLegacyGscanResultToAidl(const legacy_hal::wifi_scan_result& legacy_scan_result, + bool has_ie_data, StaScanResult* aidl_scan_result) { + if (!aidl_scan_result) { + return false; + } + *aidl_scan_result = {}; + aidl_scan_result->timeStampInUs = legacy_scan_result.ts; + aidl_scan_result->ssid = std::vector( + legacy_scan_result.ssid, + legacy_scan_result.ssid + + strnlen(legacy_scan_result.ssid, sizeof(legacy_scan_result.ssid) - 1)); + aidl_scan_result->bssid = std::array(); + std::copy(legacy_scan_result.bssid, legacy_scan_result.bssid + 6, + std::begin(aidl_scan_result->bssid)); + aidl_scan_result->frequency = legacy_scan_result.channel; + aidl_scan_result->rssi = legacy_scan_result.rssi; + aidl_scan_result->beaconPeriodInMs = legacy_scan_result.beacon_period; + aidl_scan_result->capability = legacy_scan_result.capability; + if (has_ie_data) { + std::vector ies; + if (!convertLegacyIeBlobToAidl(reinterpret_cast(legacy_scan_result.ie_data), + legacy_scan_result.ie_length, &ies)) { + return false; + } + aidl_scan_result->informationElements = std::move(ies); + } + return true; +} + +bool convertLegacyCachedGscanResultsToAidl( + const legacy_hal::wifi_cached_scan_results& legacy_cached_scan_result, + StaScanData* aidl_scan_data) { + if (!aidl_scan_data) { + return false; + } + *aidl_scan_data = {}; + int32_t flags = 0; + for (const auto flag : {legacy_hal::WIFI_SCAN_FLAG_INTERRUPTED}) { + if (legacy_cached_scan_result.flags & flag) { + flags |= static_cast::type>( + convertLegacyGscanDataFlagToAidl(flag)); + } + } + aidl_scan_data->flags = static_cast(flags); + aidl_scan_data->bucketsScanned = legacy_cached_scan_result.buckets_scanned; + + CHECK(legacy_cached_scan_result.num_results >= 0 && + legacy_cached_scan_result.num_results <= MAX_AP_CACHE_PER_SCAN); + std::vector aidl_scan_results; + for (int32_t result_idx = 0; result_idx < legacy_cached_scan_result.num_results; result_idx++) { + StaScanResult aidl_scan_result; + if (!convertLegacyGscanResultToAidl(legacy_cached_scan_result.results[result_idx], false, + &aidl_scan_result)) { + return false; + } + aidl_scan_results.push_back(aidl_scan_result); + } + aidl_scan_data->results = std::move(aidl_scan_results); + return true; +} + +bool convertLegacyVectorOfCachedGscanResultsToAidl( + const std::vector& legacy_cached_scan_results, + std::vector* aidl_scan_datas) { + if (!aidl_scan_datas) { + return false; + } + *aidl_scan_datas = {}; + for (const auto& legacy_cached_scan_result : legacy_cached_scan_results) { + StaScanData aidl_scan_data; + if (!convertLegacyCachedGscanResultsToAidl(legacy_cached_scan_result, &aidl_scan_data)) { + return false; + } + aidl_scan_datas->push_back(aidl_scan_data); + } + return true; +} + +WifiDebugTxPacketFate convertLegacyDebugTxPacketFateToAidl(legacy_hal::wifi_tx_packet_fate fate) { + switch (fate) { + case legacy_hal::TX_PKT_FATE_ACKED: + return WifiDebugTxPacketFate::ACKED; + case legacy_hal::TX_PKT_FATE_SENT: + return WifiDebugTxPacketFate::SENT; + case legacy_hal::TX_PKT_FATE_FW_QUEUED: + return WifiDebugTxPacketFate::FW_QUEUED; + case legacy_hal::TX_PKT_FATE_FW_DROP_INVALID: + return WifiDebugTxPacketFate::FW_DROP_INVALID; + case legacy_hal::TX_PKT_FATE_FW_DROP_NOBUFS: + return WifiDebugTxPacketFate::FW_DROP_NOBUFS; + case legacy_hal::TX_PKT_FATE_FW_DROP_OTHER: + return WifiDebugTxPacketFate::FW_DROP_OTHER; + case legacy_hal::TX_PKT_FATE_DRV_QUEUED: + return WifiDebugTxPacketFate::DRV_QUEUED; + case legacy_hal::TX_PKT_FATE_DRV_DROP_INVALID: + return WifiDebugTxPacketFate::DRV_DROP_INVALID; + case legacy_hal::TX_PKT_FATE_DRV_DROP_NOBUFS: + return WifiDebugTxPacketFate::DRV_DROP_NOBUFS; + case legacy_hal::TX_PKT_FATE_DRV_DROP_OTHER: + return WifiDebugTxPacketFate::DRV_DROP_OTHER; + }; + CHECK(false) << "Unknown legacy fate type: " << fate; +} + +WifiDebugRxPacketFate convertLegacyDebugRxPacketFateToAidl(legacy_hal::wifi_rx_packet_fate fate) { + switch (fate) { + case legacy_hal::RX_PKT_FATE_SUCCESS: + return WifiDebugRxPacketFate::SUCCESS; + case legacy_hal::RX_PKT_FATE_FW_QUEUED: + return WifiDebugRxPacketFate::FW_QUEUED; + case legacy_hal::RX_PKT_FATE_FW_DROP_FILTER: + return WifiDebugRxPacketFate::FW_DROP_FILTER; + case legacy_hal::RX_PKT_FATE_FW_DROP_INVALID: + return WifiDebugRxPacketFate::FW_DROP_INVALID; + case legacy_hal::RX_PKT_FATE_FW_DROP_NOBUFS: + return WifiDebugRxPacketFate::FW_DROP_NOBUFS; + case legacy_hal::RX_PKT_FATE_FW_DROP_OTHER: + return WifiDebugRxPacketFate::FW_DROP_OTHER; + case legacy_hal::RX_PKT_FATE_DRV_QUEUED: + return WifiDebugRxPacketFate::DRV_QUEUED; + case legacy_hal::RX_PKT_FATE_DRV_DROP_FILTER: + return WifiDebugRxPacketFate::DRV_DROP_FILTER; + case legacy_hal::RX_PKT_FATE_DRV_DROP_INVALID: + return WifiDebugRxPacketFate::DRV_DROP_INVALID; + case legacy_hal::RX_PKT_FATE_DRV_DROP_NOBUFS: + return WifiDebugRxPacketFate::DRV_DROP_NOBUFS; + case legacy_hal::RX_PKT_FATE_DRV_DROP_OTHER: + return WifiDebugRxPacketFate::DRV_DROP_OTHER; + }; + CHECK(false) << "Unknown legacy fate type: " << fate; +} + +WifiDebugPacketFateFrameType convertLegacyDebugPacketFateFrameTypeToAidl( + legacy_hal::frame_type type) { + switch (type) { + case legacy_hal::FRAME_TYPE_UNKNOWN: + return WifiDebugPacketFateFrameType::UNKNOWN; + case legacy_hal::FRAME_TYPE_ETHERNET_II: + return WifiDebugPacketFateFrameType::ETHERNET_II; + case legacy_hal::FRAME_TYPE_80211_MGMT: + return WifiDebugPacketFateFrameType::MGMT_80211; + }; + CHECK(false) << "Unknown legacy frame type: " << type; +} + +bool convertLegacyDebugPacketFateFrameToAidl(const legacy_hal::frame_info& legacy_frame, + WifiDebugPacketFateFrameInfo* aidl_frame) { + if (!aidl_frame) { + return false; + } + *aidl_frame = {}; + aidl_frame->frameType = convertLegacyDebugPacketFateFrameTypeToAidl(legacy_frame.payload_type); + aidl_frame->frameLen = legacy_frame.frame_len; + aidl_frame->driverTimestampUsec = legacy_frame.driver_timestamp_usec; + aidl_frame->firmwareTimestampUsec = legacy_frame.firmware_timestamp_usec; + const uint8_t* frame_begin = + reinterpret_cast(legacy_frame.frame_content.ethernet_ii_bytes); + aidl_frame->frameContent = + std::vector(frame_begin, frame_begin + legacy_frame.frame_len); + return true; +} + +bool convertLegacyDebugTxPacketFateToAidl(const legacy_hal::wifi_tx_report& legacy_fate, + WifiDebugTxPacketFateReport* aidl_fate) { + if (!aidl_fate) { + return false; + } + *aidl_fate = {}; + aidl_fate->fate = convertLegacyDebugTxPacketFateToAidl(legacy_fate.fate); + return convertLegacyDebugPacketFateFrameToAidl(legacy_fate.frame_inf, &aidl_fate->frameInfo); +} + +bool convertLegacyVectorOfDebugTxPacketFateToAidl( + const std::vector& legacy_fates, + std::vector* aidl_fates) { + if (!aidl_fates) { + return false; + } + *aidl_fates = {}; + for (const auto& legacy_fate : legacy_fates) { + WifiDebugTxPacketFateReport aidl_fate; + if (!convertLegacyDebugTxPacketFateToAidl(legacy_fate, &aidl_fate)) { + return false; + } + aidl_fates->push_back(aidl_fate); + } + return true; +} + +bool convertLegacyDebugRxPacketFateToAidl(const legacy_hal::wifi_rx_report& legacy_fate, + WifiDebugRxPacketFateReport* aidl_fate) { + if (!aidl_fate) { + return false; + } + *aidl_fate = {}; + aidl_fate->fate = convertLegacyDebugRxPacketFateToAidl(legacy_fate.fate); + return convertLegacyDebugPacketFateFrameToAidl(legacy_fate.frame_inf, &aidl_fate->frameInfo); +} + +bool convertLegacyVectorOfDebugRxPacketFateToAidl( + const std::vector& legacy_fates, + std::vector* aidl_fates) { + if (!aidl_fates) { + return false; + } + *aidl_fates = {}; + for (const auto& legacy_fate : legacy_fates) { + WifiDebugRxPacketFateReport aidl_fate; + if (!convertLegacyDebugRxPacketFateToAidl(legacy_fate, &aidl_fate)) { + return false; + } + aidl_fates->push_back(aidl_fate); + } + return true; +} + +bool convertLegacyLinkLayerRadioStatsToAidl( + const legacy_hal::LinkLayerRadioStats& legacy_radio_stat, + StaLinkLayerRadioStats* aidl_radio_stat) { + if (!aidl_radio_stat) { + return false; + } + *aidl_radio_stat = {}; + + aidl_radio_stat->radioId = legacy_radio_stat.stats.radio; + aidl_radio_stat->onTimeInMs = legacy_radio_stat.stats.on_time; + aidl_radio_stat->txTimeInMs = legacy_radio_stat.stats.tx_time; + aidl_radio_stat->rxTimeInMs = legacy_radio_stat.stats.rx_time; + aidl_radio_stat->onTimeInMsForScan = legacy_radio_stat.stats.on_time_scan; + aidl_radio_stat->txTimeInMsPerLevel = uintToIntVec(legacy_radio_stat.tx_time_per_levels); + aidl_radio_stat->onTimeInMsForNanScan = legacy_radio_stat.stats.on_time_nbd; + aidl_radio_stat->onTimeInMsForBgScan = legacy_radio_stat.stats.on_time_gscan; + aidl_radio_stat->onTimeInMsForRoamScan = legacy_radio_stat.stats.on_time_roam_scan; + aidl_radio_stat->onTimeInMsForPnoScan = legacy_radio_stat.stats.on_time_pno_scan; + aidl_radio_stat->onTimeInMsForHs20Scan = legacy_radio_stat.stats.on_time_hs20; + + std::vector aidl_channel_stats; + + for (const auto& channel_stat : legacy_radio_stat.channel_stats) { + WifiChannelStats aidl_channel_stat; + aidl_channel_stat.onTimeInMs = channel_stat.on_time; + aidl_channel_stat.ccaBusyTimeInMs = channel_stat.cca_busy_time; + aidl_channel_stat.channel.width = WifiChannelWidthInMhz::WIDTH_20; + aidl_channel_stat.channel.centerFreq = channel_stat.channel.center_freq; + aidl_channel_stat.channel.centerFreq0 = channel_stat.channel.center_freq0; + aidl_channel_stat.channel.centerFreq1 = channel_stat.channel.center_freq1; + aidl_channel_stats.push_back(aidl_channel_stat); + } + + aidl_radio_stat->channelStats = aidl_channel_stats; + + return true; +} + +bool convertLegacyLinkLayerStatsToAidl(const legacy_hal::LinkLayerStats& legacy_stats, + StaLinkLayerStats* aidl_stats) { + if (!aidl_stats) { + return false; + } + *aidl_stats = {}; + // iface legacy_stats conversion. + aidl_stats->iface.beaconRx = legacy_stats.iface.beacon_rx; + aidl_stats->iface.avgRssiMgmt = legacy_stats.iface.rssi_mgmt; + aidl_stats->iface.wmeBePktStats.rxMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].rx_mpdu; + aidl_stats->iface.wmeBePktStats.txMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].tx_mpdu; + aidl_stats->iface.wmeBePktStats.lostMpdu = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].mpdu_lost; + aidl_stats->iface.wmeBePktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].retries; + aidl_stats->iface.wmeBeContentionTimeStats.contentionTimeMinInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_min; + aidl_stats->iface.wmeBeContentionTimeStats.contentionTimeMaxInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_max; + aidl_stats->iface.wmeBeContentionTimeStats.contentionTimeAvgInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_avg; + aidl_stats->iface.wmeBeContentionTimeStats.contentionNumSamples = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_num_samples; + aidl_stats->iface.wmeBkPktStats.rxMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].rx_mpdu; + aidl_stats->iface.wmeBkPktStats.txMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].tx_mpdu; + aidl_stats->iface.wmeBkPktStats.lostMpdu = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].mpdu_lost; + aidl_stats->iface.wmeBkPktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].retries; + aidl_stats->iface.wmeBkContentionTimeStats.contentionTimeMinInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_min; + aidl_stats->iface.wmeBkContentionTimeStats.contentionTimeMaxInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_max; + aidl_stats->iface.wmeBkContentionTimeStats.contentionTimeAvgInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_avg; + aidl_stats->iface.wmeBkContentionTimeStats.contentionNumSamples = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_num_samples; + aidl_stats->iface.wmeViPktStats.rxMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].rx_mpdu; + aidl_stats->iface.wmeViPktStats.txMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].tx_mpdu; + aidl_stats->iface.wmeViPktStats.lostMpdu = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].mpdu_lost; + aidl_stats->iface.wmeViPktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].retries; + aidl_stats->iface.wmeViContentionTimeStats.contentionTimeMinInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_min; + aidl_stats->iface.wmeViContentionTimeStats.contentionTimeMaxInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_max; + aidl_stats->iface.wmeViContentionTimeStats.contentionTimeAvgInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_avg; + aidl_stats->iface.wmeViContentionTimeStats.contentionNumSamples = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_num_samples; + aidl_stats->iface.wmeVoPktStats.rxMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].rx_mpdu; + aidl_stats->iface.wmeVoPktStats.txMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].tx_mpdu; + aidl_stats->iface.wmeVoPktStats.lostMpdu = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].mpdu_lost; + aidl_stats->iface.wmeVoPktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].retries; + aidl_stats->iface.wmeVoContentionTimeStats.contentionTimeMinInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_min; + aidl_stats->iface.wmeVoContentionTimeStats.contentionTimeMaxInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_max; + aidl_stats->iface.wmeVoContentionTimeStats.contentionTimeAvgInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_avg; + aidl_stats->iface.wmeVoContentionTimeStats.contentionNumSamples = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_num_samples; + aidl_stats->iface.timeSliceDutyCycleInPercent = + legacy_stats.iface.info.time_slicing_duty_cycle_percent; + // peer info legacy_stats conversion. + std::vector aidl_peers_info_stats; + for (const auto& legacy_peer_info_stats : legacy_stats.peers) { + StaPeerInfo aidl_peer_info_stats; + if (!convertLegacyPeerInfoStatsToAidl(legacy_peer_info_stats, &aidl_peer_info_stats)) { + return false; + } + aidl_peers_info_stats.push_back(aidl_peer_info_stats); + } + aidl_stats->iface.peers = aidl_peers_info_stats; + // radio legacy_stats conversion. + std::vector aidl_radios_stats; + for (const auto& legacy_radio_stats : legacy_stats.radios) { + StaLinkLayerRadioStats aidl_radio_stats; + if (!convertLegacyLinkLayerRadioStatsToAidl(legacy_radio_stats, &aidl_radio_stats)) { + return false; + } + aidl_radios_stats.push_back(aidl_radio_stats); + } + aidl_stats->radios = aidl_radios_stats; + aidl_stats->timeStampInMs = ::android::uptimeMillis(); + return true; +} + +bool convertLegacyPeerInfoStatsToAidl(const legacy_hal::WifiPeerInfo& legacy_peer_info_stats, + StaPeerInfo* aidl_peer_info_stats) { + if (!aidl_peer_info_stats) { + return false; + } + *aidl_peer_info_stats = {}; + aidl_peer_info_stats->staCount = legacy_peer_info_stats.peer_info.bssload.sta_count; + aidl_peer_info_stats->chanUtil = legacy_peer_info_stats.peer_info.bssload.chan_util; + + std::vector aidlRateStats; + for (const auto& legacy_rate_stats : legacy_peer_info_stats.rate_stats) { + StaRateStat rateStat; + if (!convertLegacyWifiRateInfoToAidl(legacy_rate_stats.rate, &rateStat.rateInfo)) { + return false; + } + rateStat.txMpdu = legacy_rate_stats.tx_mpdu; + rateStat.rxMpdu = legacy_rate_stats.rx_mpdu; + rateStat.mpduLost = legacy_rate_stats.mpdu_lost; + rateStat.retries = legacy_rate_stats.retries; + aidlRateStats.push_back(rateStat); + } + aidl_peer_info_stats->rateStats = aidlRateStats; + return true; +} + +bool convertLegacyRoamingCapabilitiesToAidl( + const legacy_hal::wifi_roaming_capabilities& legacy_caps, + StaRoamingCapabilities* aidl_caps) { + if (!aidl_caps) { + return false; + } + *aidl_caps = {}; + aidl_caps->maxBlocklistSize = legacy_caps.max_blacklist_size; + aidl_caps->maxAllowlistSize = legacy_caps.max_whitelist_size; + return true; +} + +bool convertAidlRoamingConfigToLegacy(const StaRoamingConfig& aidl_config, + legacy_hal::wifi_roaming_config* legacy_config) { + if (!legacy_config) { + return false; + } + *legacy_config = {}; + if (aidl_config.bssidBlocklist.size() > MAX_BLACKLIST_BSSID || + aidl_config.ssidAllowlist.size() > MAX_WHITELIST_SSID) { + return false; + } + legacy_config->num_blacklist_bssid = aidl_config.bssidBlocklist.size(); + uint32_t i = 0; + for (const auto& bssid : aidl_config.bssidBlocklist) { + CHECK(bssid.data.size() == sizeof(legacy_hal::mac_addr)); + memcpy(legacy_config->blacklist_bssid[i++], bssid.data.data(), bssid.data.size()); + } + legacy_config->num_whitelist_ssid = aidl_config.ssidAllowlist.size(); + i = 0; + for (const auto& ssid : aidl_config.ssidAllowlist) { + CHECK(ssid.data.size() <= sizeof(legacy_hal::ssid_t::ssid_str)); + legacy_config->whitelist_ssid[i].length = ssid.data.size(); + memcpy(legacy_config->whitelist_ssid[i].ssid_str, ssid.data.data(), ssid.data.size()); + i++; + } + return true; +} + +legacy_hal::fw_roaming_state_t convertAidlRoamingStateToLegacy(StaRoamingState state) { + switch (state) { + case StaRoamingState::ENABLED: + return legacy_hal::ROAMING_ENABLE; + case StaRoamingState::DISABLED: + return legacy_hal::ROAMING_DISABLE; + }; + CHECK(false); +} + +legacy_hal::NanMatchAlg convertAidlNanMatchAlgToLegacy(NanMatchAlg type) { + switch (type) { + case NanMatchAlg::MATCH_ONCE: + return legacy_hal::NAN_MATCH_ALG_MATCH_ONCE; + case NanMatchAlg::MATCH_CONTINUOUS: + return legacy_hal::NAN_MATCH_ALG_MATCH_CONTINUOUS; + case NanMatchAlg::MATCH_NEVER: + return legacy_hal::NAN_MATCH_ALG_MATCH_NEVER; + } + CHECK(false); +} + +legacy_hal::NanPublishType convertAidlNanPublishTypeToLegacy(NanPublishType type) { + switch (type) { + case NanPublishType::UNSOLICITED: + return legacy_hal::NAN_PUBLISH_TYPE_UNSOLICITED; + case NanPublishType::SOLICITED: + return legacy_hal::NAN_PUBLISH_TYPE_SOLICITED; + case NanPublishType::UNSOLICITED_SOLICITED: + return legacy_hal::NAN_PUBLISH_TYPE_UNSOLICITED_SOLICITED; + } + CHECK(false); +} + +legacy_hal::NanTxType convertAidlNanTxTypeToLegacy(NanTxType type) { + switch (type) { + case NanTxType::BROADCAST: + return legacy_hal::NAN_TX_TYPE_BROADCAST; + case NanTxType::UNICAST: + return legacy_hal::NAN_TX_TYPE_UNICAST; + } + CHECK(false); +} + +legacy_hal::NanSubscribeType convertAidlNanSubscribeTypeToLegacy(NanSubscribeType type) { + switch (type) { + case NanSubscribeType::PASSIVE: + return legacy_hal::NAN_SUBSCRIBE_TYPE_PASSIVE; + case NanSubscribeType::ACTIVE: + return legacy_hal::NAN_SUBSCRIBE_TYPE_ACTIVE; + } + CHECK(false); +} + +legacy_hal::NanSRFType convertAidlNanSrfTypeToLegacy(NanSrfType type) { + switch (type) { + case NanSrfType::BLOOM_FILTER: + return legacy_hal::NAN_SRF_ATTR_BLOOM_FILTER; + case NanSrfType::PARTIAL_MAC_ADDR: + return legacy_hal::NAN_SRF_ATTR_PARTIAL_MAC_ADDR; + } + CHECK(false); +} + +legacy_hal::NanDataPathChannelCfg convertAidlNanDataPathChannelCfgToLegacy( + NanDataPathChannelCfg type) { + switch (type) { + case NanDataPathChannelCfg::CHANNEL_NOT_REQUESTED: + return legacy_hal::NAN_DP_CHANNEL_NOT_REQUESTED; + case NanDataPathChannelCfg::REQUEST_CHANNEL_SETUP: + return legacy_hal::NAN_DP_REQUEST_CHANNEL_SETUP; + case NanDataPathChannelCfg::FORCE_CHANNEL_SETUP: + return legacy_hal::NAN_DP_FORCE_CHANNEL_SETUP; + } + CHECK(false); +} + +NanStatusCode convertLegacyNanStatusTypeToAidl(legacy_hal::NanStatusType type) { + switch (type) { + case legacy_hal::NAN_STATUS_SUCCESS: + return NanStatusCode::SUCCESS; + case legacy_hal::NAN_STATUS_INTERNAL_FAILURE: + return NanStatusCode::INTERNAL_FAILURE; + case legacy_hal::NAN_STATUS_PROTOCOL_FAILURE: + return NanStatusCode::PROTOCOL_FAILURE; + case legacy_hal::NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID: + return NanStatusCode::INVALID_SESSION_ID; + case legacy_hal::NAN_STATUS_NO_RESOURCE_AVAILABLE: + return NanStatusCode::NO_RESOURCES_AVAILABLE; + case legacy_hal::NAN_STATUS_INVALID_PARAM: + return NanStatusCode::INVALID_ARGS; + case legacy_hal::NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID: + return NanStatusCode::INVALID_PEER_ID; + case legacy_hal::NAN_STATUS_INVALID_NDP_ID: + return NanStatusCode::INVALID_NDP_ID; + case legacy_hal::NAN_STATUS_NAN_NOT_ALLOWED: + return NanStatusCode::NAN_NOT_ALLOWED; + case legacy_hal::NAN_STATUS_NO_OTA_ACK: + return NanStatusCode::NO_OTA_ACK; + case legacy_hal::NAN_STATUS_ALREADY_ENABLED: + return NanStatusCode::ALREADY_ENABLED; + case legacy_hal::NAN_STATUS_FOLLOWUP_QUEUE_FULL: + return NanStatusCode::FOLLOWUP_TX_QUEUE_FULL; + case legacy_hal::NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED: + return NanStatusCode::UNSUPPORTED_CONCURRENCY_NAN_DISABLED; + } + CHECK(false); +} + +void convertToNanStatus(legacy_hal::NanStatusType type, const char* str, size_t max_len, + NanStatus* nanStatus) { + nanStatus->status = convertLegacyNanStatusTypeToAidl(type); + nanStatus->description = safeConvertChar(str, max_len); +} + +bool convertAidlNanEnableRequestToLegacy(const NanEnableRequest& aidl_request1, + const NanConfigRequestSupplemental& aidl_request2, + legacy_hal::NanEnableRequest* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertAidlNanEnableRequestToLegacy: null legacy_request"; + return false; + } + *legacy_request = {}; + + legacy_request->config_2dot4g_support = 1; + legacy_request->support_2dot4g_val = + aidl_request1.operateInBand[(size_t)NanBandIndex::NAN_BAND_24GHZ]; + legacy_request->config_support_5g = 1; + legacy_request->support_5g_val = + aidl_request1.operateInBand[(size_t)NanBandIndex::NAN_BAND_5GHZ]; + legacy_request->config_hop_count_limit = 1; + legacy_request->hop_count_limit_val = aidl_request1.hopCountMax; + legacy_request->master_pref = aidl_request1.configParams.masterPref; + legacy_request->discovery_indication_cfg = 0; + legacy_request->discovery_indication_cfg |= + aidl_request1.configParams.disableDiscoveryAddressChangeIndication ? 0x1 : 0x0; + legacy_request->discovery_indication_cfg |= + aidl_request1.configParams.disableStartedClusterIndication ? 0x2 : 0x0; + legacy_request->discovery_indication_cfg |= + aidl_request1.configParams.disableJoinedClusterIndication ? 0x4 : 0x0; + legacy_request->config_sid_beacon = 1; + if (aidl_request1.configParams.numberOfPublishServiceIdsInBeacon < 0) { + LOG(ERROR) << "convertAidlNanEnableRequestToLegacy: " + "numberOfPublishServiceIdsInBeacon < 0"; + return false; + } + legacy_request->sid_beacon_val = + (aidl_request1.configParams.includePublishServiceIdsInBeacon ? 0x1 : 0x0) | + (aidl_request1.configParams.numberOfPublishServiceIdsInBeacon << 1); + legacy_request->config_subscribe_sid_beacon = 1; + if (aidl_request1.configParams.numberOfSubscribeServiceIdsInBeacon < 0) { + LOG(ERROR) << "convertAidlNanEnableRequestToLegacy: " + "numberOfSubscribeServiceIdsInBeacon < 0"; + return false; + } + legacy_request->subscribe_sid_beacon_val = + (aidl_request1.configParams.includeSubscribeServiceIdsInBeacon ? 0x1 : 0x0) | + (aidl_request1.configParams.numberOfSubscribeServiceIdsInBeacon << 1); + legacy_request->config_rssi_window_size = 1; + legacy_request->rssi_window_size_val = aidl_request1.configParams.rssiWindowSize; + legacy_request->config_disc_mac_addr_randomization = 1; + legacy_request->disc_mac_addr_rand_interval_sec = + aidl_request1.configParams.macAddressRandomizationIntervalSec; + legacy_request->config_2dot4g_rssi_close = 1; + if (aidl_request1.configParams.bandSpecificConfig.size() != 3) { + LOG(ERROR) << "convertAidlNanEnableRequestToLegacy: " + "bandSpecificConfig.size() != 3"; + return false; + } + legacy_request->rssi_close_2dot4g_val = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .rssiClose; + legacy_request->config_2dot4g_rssi_middle = 1; + legacy_request->rssi_middle_2dot4g_val = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .rssiMiddle; + legacy_request->config_2dot4g_rssi_proximity = 1; + legacy_request->rssi_proximity_2dot4g_val = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .rssiCloseProximity; + legacy_request->config_scan_params = 1; + legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_24G_BAND] = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .dwellTimeMs; + legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_24G_BAND] = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .scanPeriodSec; + legacy_request->config_dw.config_2dot4g_dw_band = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .validDiscoveryWindowIntervalVal; + legacy_request->config_dw.dw_2dot4g_interval_val = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .discoveryWindowIntervalVal; + legacy_request->config_5g_rssi_close = 1; + legacy_request->rssi_close_5g_val = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .rssiClose; + legacy_request->config_5g_rssi_middle = 1; + legacy_request->rssi_middle_5g_val = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .rssiMiddle; + legacy_request->config_5g_rssi_close_proximity = 1; + legacy_request->rssi_close_proximity_5g_val = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .rssiCloseProximity; + legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .dwellTimeMs; + legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .scanPeriodSec; + legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .dwellTimeMs; + legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .scanPeriodSec; + legacy_request->config_dw.config_5g_dw_band = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .validDiscoveryWindowIntervalVal; + legacy_request->config_dw.dw_5g_interval_val = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .discoveryWindowIntervalVal; + if (aidl_request1.debugConfigs.validClusterIdVals) { + legacy_request->cluster_low = aidl_request1.debugConfigs.clusterIdBottomRangeVal; + legacy_request->cluster_high = aidl_request1.debugConfigs.clusterIdTopRangeVal; + } else { // need 'else' since not configurable in legacy HAL + legacy_request->cluster_low = 0x0000; + legacy_request->cluster_high = 0xFFFF; + } + legacy_request->config_intf_addr = aidl_request1.debugConfigs.validIntfAddrVal; + memcpy(legacy_request->intf_addr_val, aidl_request1.debugConfigs.intfAddrVal.data(), 6); + legacy_request->config_oui = aidl_request1.debugConfigs.validOuiVal; + legacy_request->oui_val = aidl_request1.debugConfigs.ouiVal; + legacy_request->config_random_factor_force = + aidl_request1.debugConfigs.validRandomFactorForceVal; + legacy_request->random_factor_force_val = aidl_request1.debugConfigs.randomFactorForceVal; + legacy_request->config_hop_count_force = aidl_request1.debugConfigs.validHopCountForceVal; + legacy_request->hop_count_force_val = aidl_request1.debugConfigs.hopCountForceVal; + legacy_request->config_24g_channel = aidl_request1.debugConfigs.validDiscoveryChannelVal; + legacy_request->channel_24g_val = + aidl_request1.debugConfigs.discoveryChannelMhzVal[(size_t)NanBandIndex::NAN_BAND_24GHZ]; + legacy_request->config_5g_channel = aidl_request1.debugConfigs.validDiscoveryChannelVal; + legacy_request->channel_5g_val = + aidl_request1.debugConfigs.discoveryChannelMhzVal[(size_t)NanBandIndex::NAN_BAND_5GHZ]; + legacy_request->config_2dot4g_beacons = aidl_request1.debugConfigs.validUseBeaconsInBandVal; + legacy_request->beacon_2dot4g_val = + aidl_request1.debugConfigs.useBeaconsInBandVal[(size_t)NanBandIndex::NAN_BAND_24GHZ]; + legacy_request->config_5g_beacons = aidl_request1.debugConfigs.validUseBeaconsInBandVal; + legacy_request->beacon_5g_val = + aidl_request1.debugConfigs.useBeaconsInBandVal[(size_t)NanBandIndex::NAN_BAND_5GHZ]; + legacy_request->config_2dot4g_sdf = aidl_request1.debugConfigs.validUseSdfInBandVal; + legacy_request->sdf_2dot4g_val = + aidl_request1.debugConfigs.useSdfInBandVal[(size_t)NanBandIndex::NAN_BAND_24GHZ]; + legacy_request->config_5g_sdf = aidl_request1.debugConfigs.validUseSdfInBandVal; + legacy_request->sdf_5g_val = + aidl_request1.debugConfigs.useSdfInBandVal[(size_t)NanBandIndex::NAN_BAND_5GHZ]; + + legacy_request->config_discovery_beacon_int = 1; + legacy_request->discovery_beacon_interval = aidl_request2.discoveryBeaconIntervalMs; + legacy_request->config_nss = 1; + legacy_request->nss = aidl_request2.numberOfSpatialStreamsInDiscovery; + legacy_request->config_dw_early_termination = 1; + legacy_request->enable_dw_termination = aidl_request2.enableDiscoveryWindowEarlyTermination; + legacy_request->config_enable_ranging = 1; + legacy_request->enable_ranging = aidl_request2.enableRanging; + + legacy_request->config_enable_instant_mode = 1; + legacy_request->enable_instant_mode = aidl_request2.enableInstantCommunicationMode; + legacy_request->config_instant_mode_channel = 1; + legacy_request->instant_mode_channel = aidl_request2.instantModeChannel; + + return true; +} + +bool convertAidlNanConfigRequestToLegacy(const NanConfigRequest& aidl_request1, + const NanConfigRequestSupplemental& aidl_request2, + legacy_hal::NanConfigRequest* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertAidlNanConfigRequestToLegacy: null legacy_request"; + return false; + } + *legacy_request = {}; + + legacy_request->master_pref = aidl_request1.masterPref; + legacy_request->discovery_indication_cfg = 0; + legacy_request->discovery_indication_cfg |= + aidl_request1.disableDiscoveryAddressChangeIndication ? 0x1 : 0x0; + legacy_request->discovery_indication_cfg |= + aidl_request1.disableStartedClusterIndication ? 0x2 : 0x0; + legacy_request->discovery_indication_cfg |= + aidl_request1.disableJoinedClusterIndication ? 0x4 : 0x0; + legacy_request->config_sid_beacon = 1; + if (aidl_request1.numberOfPublishServiceIdsInBeacon < 0) { + LOG(ERROR) << "convertAidlNanConfigRequestToLegacy: " + "numberOfPublishServiceIdsInBeacon < 0"; + return false; + } + legacy_request->sid_beacon = (aidl_request1.includePublishServiceIdsInBeacon ? 0x1 : 0x0) | + (aidl_request1.numberOfPublishServiceIdsInBeacon << 1); + legacy_request->config_subscribe_sid_beacon = 1; + if (aidl_request1.numberOfSubscribeServiceIdsInBeacon < 0) { + LOG(ERROR) << "convertAidlNanConfigRequestToLegacy: " + "numberOfSubscribeServiceIdsInBeacon < 0"; + return false; + } + legacy_request->subscribe_sid_beacon_val = + (aidl_request1.includeSubscribeServiceIdsInBeacon ? 0x1 : 0x0) | + (aidl_request1.numberOfSubscribeServiceIdsInBeacon << 1); + legacy_request->config_rssi_window_size = 1; + legacy_request->rssi_window_size_val = aidl_request1.rssiWindowSize; + legacy_request->config_disc_mac_addr_randomization = 1; + legacy_request->disc_mac_addr_rand_interval_sec = + aidl_request1.macAddressRandomizationIntervalSec; + + legacy_request->config_scan_params = 1; + legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_24G_BAND] = + aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ].dwellTimeMs; + legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_24G_BAND] = + aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ].scanPeriodSec; + legacy_request->config_dw.config_2dot4g_dw_band = + aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .validDiscoveryWindowIntervalVal; + legacy_request->config_dw.dw_2dot4g_interval_val = + aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .discoveryWindowIntervalVal; + + legacy_request->config_5g_rssi_close_proximity = 1; + legacy_request->rssi_close_proximity_5g_val = + aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .rssiCloseProximity; + legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = + aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].dwellTimeMs; + legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = + aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].scanPeriodSec; + legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = + aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].dwellTimeMs; + legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = + aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].scanPeriodSec; + legacy_request->config_dw.config_5g_dw_band = + aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .validDiscoveryWindowIntervalVal; + legacy_request->config_dw.dw_5g_interval_val = + aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .discoveryWindowIntervalVal; + + legacy_request->config_discovery_beacon_int = 1; + legacy_request->discovery_beacon_interval = aidl_request2.discoveryBeaconIntervalMs; + legacy_request->config_nss = 1; + legacy_request->nss = aidl_request2.numberOfSpatialStreamsInDiscovery; + legacy_request->config_dw_early_termination = 1; + legacy_request->enable_dw_termination = aidl_request2.enableDiscoveryWindowEarlyTermination; + legacy_request->config_enable_ranging = 1; + legacy_request->enable_ranging = aidl_request2.enableRanging; + + legacy_request->config_enable_instant_mode = 1; + legacy_request->enable_instant_mode = aidl_request2.enableInstantCommunicationMode; + legacy_request->config_instant_mode_channel = 1; + legacy_request->instant_mode_channel = aidl_request2.instantModeChannel; + + return true; +} + +bool convertAidlNanPublishRequestToLegacy(const NanPublishRequest& aidl_request, + legacy_hal::NanPublishRequest* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: null legacy_request"; + return false; + } + *legacy_request = {}; + + legacy_request->publish_id = aidl_request.baseConfigs.sessionId; + legacy_request->ttl = aidl_request.baseConfigs.ttlSec; + legacy_request->period = aidl_request.baseConfigs.discoveryWindowPeriod; + legacy_request->publish_count = aidl_request.baseConfigs.discoveryCount; + legacy_request->service_name_len = aidl_request.baseConfigs.serviceName.size(); + if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { + LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: service_name_len " + "too large"; + return false; + } + memcpy(legacy_request->service_name, aidl_request.baseConfigs.serviceName.data(), + legacy_request->service_name_len); + legacy_request->publish_match_indicator = + convertAidlNanMatchAlgToLegacy(aidl_request.baseConfigs.discoveryMatchIndicator); + legacy_request->service_specific_info_len = aidl_request.baseConfigs.serviceSpecificInfo.size(); + if (legacy_request->service_specific_info_len > NAN_MAX_SERVICE_SPECIFIC_INFO_LEN) { + LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: " + "service_specific_info_len too large"; + return false; + } + memcpy(legacy_request->service_specific_info, + aidl_request.baseConfigs.serviceSpecificInfo.data(), + legacy_request->service_specific_info_len); + legacy_request->sdea_service_specific_info_len = + aidl_request.baseConfigs.extendedServiceSpecificInfo.size(); + if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) { + LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: " + "sdea_service_specific_info_len too large"; + return false; + } + memcpy(legacy_request->sdea_service_specific_info, + aidl_request.baseConfigs.extendedServiceSpecificInfo.data(), + legacy_request->sdea_service_specific_info_len); + legacy_request->rx_match_filter_len = aidl_request.baseConfigs.rxMatchFilter.size(); + if (legacy_request->rx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { + LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: " + "rx_match_filter_len too large"; + return false; + } + memcpy(legacy_request->rx_match_filter, aidl_request.baseConfigs.rxMatchFilter.data(), + legacy_request->rx_match_filter_len); + legacy_request->tx_match_filter_len = aidl_request.baseConfigs.txMatchFilter.size(); + if (legacy_request->tx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { + LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: " + "tx_match_filter_len too large"; + return false; + } + memcpy(legacy_request->tx_match_filter, aidl_request.baseConfigs.txMatchFilter.data(), + legacy_request->tx_match_filter_len); + legacy_request->rssi_threshold_flag = aidl_request.baseConfigs.useRssiThreshold; + legacy_request->recv_indication_cfg = 0; + legacy_request->recv_indication_cfg |= + aidl_request.baseConfigs.disableDiscoveryTerminationIndication ? 0x1 : 0x0; + legacy_request->recv_indication_cfg |= + aidl_request.baseConfigs.disableMatchExpirationIndication ? 0x2 : 0x0; + legacy_request->recv_indication_cfg |= + aidl_request.baseConfigs.disableFollowupReceivedIndication ? 0x4 : 0x0; + legacy_request->recv_indication_cfg |= 0x8; + legacy_request->cipher_type = (unsigned int)aidl_request.baseConfigs.securityConfig.cipherType; + + legacy_request->scid_len = aidl_request.baseConfigs.securityConfig.scid.size(); + if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) { + LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: scid_len too large"; + return false; + } + memcpy(legacy_request->scid, aidl_request.baseConfigs.securityConfig.scid.data(), + legacy_request->scid_len); + + if (aidl_request.baseConfigs.securityConfig.securityType == NanDataPathSecurityType::PMK) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; + legacy_request->key_info.body.pmk_info.pmk_len = + aidl_request.baseConfigs.securityConfig.pmk.size(); + if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { + LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: invalid pmk_len"; + return false; + } + memcpy(legacy_request->key_info.body.pmk_info.pmk, + aidl_request.baseConfigs.securityConfig.pmk.data(), + legacy_request->key_info.body.pmk_info.pmk_len); + } + if (aidl_request.baseConfigs.securityConfig.securityType == + NanDataPathSecurityType::PASSPHRASE) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; + legacy_request->key_info.body.passphrase_info.passphrase_len = + aidl_request.baseConfigs.securityConfig.passphrase.size(); + if (legacy_request->key_info.body.passphrase_info.passphrase_len < + NAN_SECURITY_MIN_PASSPHRASE_LEN) { + LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: " + "passphrase_len too small"; + return false; + } + if (legacy_request->key_info.body.passphrase_info.passphrase_len > + NAN_SECURITY_MAX_PASSPHRASE_LEN) { + LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: " + "passphrase_len too large"; + return false; + } + memcpy(legacy_request->key_info.body.passphrase_info.passphrase, + aidl_request.baseConfigs.securityConfig.passphrase.data(), + legacy_request->key_info.body.passphrase_info.passphrase_len); + } + legacy_request->sdea_params.security_cfg = + (aidl_request.baseConfigs.securityConfig.securityType != NanDataPathSecurityType::OPEN) + ? legacy_hal::NAN_DP_CONFIG_SECURITY + : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; + + legacy_request->sdea_params.ranging_state = aidl_request.baseConfigs.rangingRequired + ? legacy_hal::NAN_RANGING_ENABLE + : legacy_hal::NAN_RANGING_DISABLE; + legacy_request->ranging_cfg.ranging_interval_msec = aidl_request.baseConfigs.rangingIntervalMs; + legacy_request->ranging_cfg.config_ranging_indications = + static_cast(aidl_request.baseConfigs.configRangingIndications); + legacy_request->ranging_cfg.distance_ingress_mm = + aidl_request.baseConfigs.distanceIngressCm * 10; + legacy_request->ranging_cfg.distance_egress_mm = aidl_request.baseConfigs.distanceEgressCm * 10; + legacy_request->ranging_auto_response = aidl_request.baseConfigs.rangingRequired + ? legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE + : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE; + legacy_request->sdea_params.range_report = legacy_hal::NAN_DISABLE_RANGE_REPORT; + legacy_request->publish_type = convertAidlNanPublishTypeToLegacy(aidl_request.publishType); + legacy_request->tx_type = convertAidlNanTxTypeToLegacy(aidl_request.txType); + legacy_request->service_responder_policy = aidl_request.autoAcceptDataPathRequests + ? legacy_hal::NAN_SERVICE_ACCEPT_POLICY_ALL + : legacy_hal::NAN_SERVICE_ACCEPT_POLICY_NONE; + + return true; +} + +bool convertAidlNanSubscribeRequestToLegacy(const NanSubscribeRequest& aidl_request, + legacy_hal::NanSubscribeRequest* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: legacy_request is null"; + return false; + } + *legacy_request = {}; + + legacy_request->subscribe_id = aidl_request.baseConfigs.sessionId; + legacy_request->ttl = aidl_request.baseConfigs.ttlSec; + legacy_request->period = aidl_request.baseConfigs.discoveryWindowPeriod; + legacy_request->subscribe_count = aidl_request.baseConfigs.discoveryCount; + legacy_request->service_name_len = aidl_request.baseConfigs.serviceName.size(); + if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { + LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " + "service_name_len too large"; + return false; + } + memcpy(legacy_request->service_name, aidl_request.baseConfigs.serviceName.data(), + legacy_request->service_name_len); + legacy_request->subscribe_match_indicator = + convertAidlNanMatchAlgToLegacy(aidl_request.baseConfigs.discoveryMatchIndicator); + legacy_request->service_specific_info_len = aidl_request.baseConfigs.serviceSpecificInfo.size(); + if (legacy_request->service_specific_info_len > NAN_MAX_SERVICE_SPECIFIC_INFO_LEN) { + LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " + "service_specific_info_len too large"; + return false; + } + memcpy(legacy_request->service_specific_info, + aidl_request.baseConfigs.serviceSpecificInfo.data(), + legacy_request->service_specific_info_len); + legacy_request->sdea_service_specific_info_len = + aidl_request.baseConfigs.extendedServiceSpecificInfo.size(); + if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) { + LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " + "sdea_service_specific_info_len too large"; + return false; + } + memcpy(legacy_request->sdea_service_specific_info, + aidl_request.baseConfigs.extendedServiceSpecificInfo.data(), + legacy_request->sdea_service_specific_info_len); + legacy_request->rx_match_filter_len = aidl_request.baseConfigs.rxMatchFilter.size(); + if (legacy_request->rx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { + LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " + "rx_match_filter_len too large"; + return false; + } + memcpy(legacy_request->rx_match_filter, aidl_request.baseConfigs.rxMatchFilter.data(), + legacy_request->rx_match_filter_len); + legacy_request->tx_match_filter_len = aidl_request.baseConfigs.txMatchFilter.size(); + if (legacy_request->tx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { + LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " + "tx_match_filter_len too large"; + return false; + } + memcpy(legacy_request->tx_match_filter, aidl_request.baseConfigs.txMatchFilter.data(), + legacy_request->tx_match_filter_len); + legacy_request->rssi_threshold_flag = aidl_request.baseConfigs.useRssiThreshold; + legacy_request->recv_indication_cfg = 0; + legacy_request->recv_indication_cfg |= + aidl_request.baseConfigs.disableDiscoveryTerminationIndication ? 0x1 : 0x0; + legacy_request->recv_indication_cfg |= + aidl_request.baseConfigs.disableMatchExpirationIndication ? 0x2 : 0x0; + legacy_request->recv_indication_cfg |= + aidl_request.baseConfigs.disableFollowupReceivedIndication ? 0x4 : 0x0; + legacy_request->cipher_type = (unsigned int)aidl_request.baseConfigs.securityConfig.cipherType; + if (aidl_request.baseConfigs.securityConfig.securityType == NanDataPathSecurityType::PMK) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; + legacy_request->key_info.body.pmk_info.pmk_len = + aidl_request.baseConfigs.securityConfig.pmk.size(); + if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { + LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: invalid pmk_len"; + return false; + } + memcpy(legacy_request->key_info.body.pmk_info.pmk, + aidl_request.baseConfigs.securityConfig.pmk.data(), + legacy_request->key_info.body.pmk_info.pmk_len); + } + if (aidl_request.baseConfigs.securityConfig.securityType == + NanDataPathSecurityType::PASSPHRASE) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; + legacy_request->key_info.body.passphrase_info.passphrase_len = + aidl_request.baseConfigs.securityConfig.passphrase.size(); + if (legacy_request->key_info.body.passphrase_info.passphrase_len < + NAN_SECURITY_MIN_PASSPHRASE_LEN) { + LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " + "passphrase_len too small"; + return false; + } + if (legacy_request->key_info.body.passphrase_info.passphrase_len > + NAN_SECURITY_MAX_PASSPHRASE_LEN) { + LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " + "passphrase_len too large"; + return false; + } + memcpy(legacy_request->key_info.body.passphrase_info.passphrase, + aidl_request.baseConfigs.securityConfig.passphrase.data(), + legacy_request->key_info.body.passphrase_info.passphrase_len); + } + legacy_request->sdea_params.security_cfg = + (aidl_request.baseConfigs.securityConfig.securityType != NanDataPathSecurityType::OPEN) + ? legacy_hal::NAN_DP_CONFIG_SECURITY + : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; + legacy_request->sdea_params.ranging_state = aidl_request.baseConfigs.rangingRequired + ? legacy_hal::NAN_RANGING_ENABLE + : legacy_hal::NAN_RANGING_DISABLE; + legacy_request->ranging_cfg.ranging_interval_msec = aidl_request.baseConfigs.rangingIntervalMs; + legacy_request->ranging_cfg.config_ranging_indications = + static_cast(aidl_request.baseConfigs.configRangingIndications); + legacy_request->ranging_cfg.distance_ingress_mm = + aidl_request.baseConfigs.distanceIngressCm * 10; + legacy_request->ranging_cfg.distance_egress_mm = aidl_request.baseConfigs.distanceEgressCm * 10; + legacy_request->ranging_auto_response = aidl_request.baseConfigs.rangingRequired + ? legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE + : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE; + legacy_request->sdea_params.range_report = legacy_hal::NAN_DISABLE_RANGE_REPORT; + legacy_request->subscribe_type = + convertAidlNanSubscribeTypeToLegacy(aidl_request.subscribeType); + legacy_request->serviceResponseFilter = convertAidlNanSrfTypeToLegacy(aidl_request.srfType); + legacy_request->serviceResponseInclude = aidl_request.srfRespondIfInAddressSet + ? legacy_hal::NAN_SRF_INCLUDE_RESPOND + : legacy_hal::NAN_SRF_INCLUDE_DO_NOT_RESPOND; + legacy_request->useServiceResponseFilter = + aidl_request.shouldUseSrf ? legacy_hal::NAN_USE_SRF : legacy_hal::NAN_DO_NOT_USE_SRF; + legacy_request->ssiRequiredForMatchIndication = + aidl_request.isSsiRequiredForMatch ? legacy_hal::NAN_SSI_REQUIRED_IN_MATCH_IND + : legacy_hal::NAN_SSI_NOT_REQUIRED_IN_MATCH_IND; + legacy_request->num_intf_addr_present = aidl_request.intfAddr.size(); + if (legacy_request->num_intf_addr_present > NAN_MAX_SUBSCRIBE_MAX_ADDRESS) { + LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " + "num_intf_addr_present - too many"; + return false; + } + for (int i = 0; i < legacy_request->num_intf_addr_present; i++) { + memcpy(legacy_request->intf_addr[i], aidl_request.intfAddr[i].data.data(), 6); + } + + return true; +} + +bool convertAidlNanTransmitFollowupRequestToLegacy( + const NanTransmitFollowupRequest& aidl_request, + legacy_hal::NanTransmitFollowupRequest* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertAidlNanTransmitFollowupRequestToLegacy: " + "legacy_request is null"; + return false; + } + *legacy_request = {}; + + legacy_request->publish_subscribe_id = aidl_request.discoverySessionId; + legacy_request->requestor_instance_id = aidl_request.peerId; + memcpy(legacy_request->addr, aidl_request.addr.data(), 6); + legacy_request->priority = aidl_request.isHighPriority ? legacy_hal::NAN_TX_PRIORITY_HIGH + : legacy_hal::NAN_TX_PRIORITY_NORMAL; + legacy_request->dw_or_faw = aidl_request.shouldUseDiscoveryWindow + ? legacy_hal::NAN_TRANSMIT_IN_DW + : legacy_hal::NAN_TRANSMIT_IN_FAW; + legacy_request->service_specific_info_len = aidl_request.serviceSpecificInfo.size(); + if (legacy_request->service_specific_info_len > NAN_MAX_SERVICE_SPECIFIC_INFO_LEN) { + LOG(ERROR) << "convertAidlNanTransmitFollowupRequestToLegacy: " + "service_specific_info_len too large"; + return false; + } + memcpy(legacy_request->service_specific_info, aidl_request.serviceSpecificInfo.data(), + legacy_request->service_specific_info_len); + legacy_request->sdea_service_specific_info_len = + aidl_request.extendedServiceSpecificInfo.size(); + if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) { + LOG(ERROR) << "convertAidlNanTransmitFollowupRequestToLegacy: " + "sdea_service_specific_info_len too large"; + return false; + } + memcpy(legacy_request->sdea_service_specific_info, + aidl_request.extendedServiceSpecificInfo.data(), + legacy_request->sdea_service_specific_info_len); + legacy_request->recv_indication_cfg = aidl_request.disableFollowupResultIndication ? 0x1 : 0x0; + + return true; +} + +bool convertAidlNanDataPathInitiatorRequestToLegacy( + const NanInitiateDataPathRequest& aidl_request, + legacy_hal::NanDataPathInitiatorRequest* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: " + "legacy_request is null"; + return false; + } + *legacy_request = {}; + + legacy_request->requestor_instance_id = aidl_request.peerId; + memcpy(legacy_request->peer_disc_mac_addr, aidl_request.peerDiscMacAddr.data(), 6); + legacy_request->channel_request_type = + convertAidlNanDataPathChannelCfgToLegacy(aidl_request.channelRequestType); + legacy_request->channel = aidl_request.channel; + if (strnlen(aidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) { + LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: " + "ifaceName too long"; + return false; + } + strlcpy(legacy_request->ndp_iface, aidl_request.ifaceName.c_str(), IFNAMSIZ + 1); + legacy_request->ndp_cfg.security_cfg = + (aidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN) + ? legacy_hal::NAN_DP_CONFIG_SECURITY + : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; + legacy_request->app_info.ndp_app_info_len = aidl_request.appInfo.size(); + if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) { + LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: " + "ndp_app_info_len too large"; + return false; + } + memcpy(legacy_request->app_info.ndp_app_info, aidl_request.appInfo.data(), + legacy_request->app_info.ndp_app_info_len); + legacy_request->cipher_type = (unsigned int)aidl_request.securityConfig.cipherType; + if (aidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; + legacy_request->key_info.body.pmk_info.pmk_len = aidl_request.securityConfig.pmk.size(); + if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { + LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: " + "invalid pmk_len"; + return false; + } + memcpy(legacy_request->key_info.body.pmk_info.pmk, aidl_request.securityConfig.pmk.data(), + legacy_request->key_info.body.pmk_info.pmk_len); + } + if (aidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; + legacy_request->key_info.body.passphrase_info.passphrase_len = + aidl_request.securityConfig.passphrase.size(); + if (legacy_request->key_info.body.passphrase_info.passphrase_len < + NAN_SECURITY_MIN_PASSPHRASE_LEN) { + LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: " + "passphrase_len too small"; + return false; + } + if (legacy_request->key_info.body.passphrase_info.passphrase_len > + NAN_SECURITY_MAX_PASSPHRASE_LEN) { + LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: " + "passphrase_len too large"; + return false; + } + memcpy(legacy_request->key_info.body.passphrase_info.passphrase, + aidl_request.securityConfig.passphrase.data(), + legacy_request->key_info.body.passphrase_info.passphrase_len); + } + legacy_request->service_name_len = aidl_request.serviceNameOutOfBand.size(); + if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { + LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: " + "service_name_len too large"; + return false; + } + memcpy(legacy_request->service_name, aidl_request.serviceNameOutOfBand.data(), + legacy_request->service_name_len); + legacy_request->scid_len = aidl_request.securityConfig.scid.size(); + if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) { + LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: scid_len too large"; + return false; + } + memcpy(legacy_request->scid, aidl_request.securityConfig.scid.data(), legacy_request->scid_len); + + return true; +} + +bool convertAidlNanDataPathIndicationResponseToLegacy( + const NanRespondToDataPathIndicationRequest& aidl_request, + legacy_hal::NanDataPathIndicationResponse* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: " + "legacy_request is null"; + return false; + } + *legacy_request = {}; + + legacy_request->rsp_code = aidl_request.acceptRequest ? legacy_hal::NAN_DP_REQUEST_ACCEPT + : legacy_hal::NAN_DP_REQUEST_REJECT; + legacy_request->ndp_instance_id = aidl_request.ndpInstanceId; + if (strnlen(aidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) { + LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: " + "ifaceName too long"; + return false; + } + strlcpy(legacy_request->ndp_iface, aidl_request.ifaceName.c_str(), IFNAMSIZ + 1); + legacy_request->ndp_cfg.security_cfg = + (aidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN) + ? legacy_hal::NAN_DP_CONFIG_SECURITY + : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; + legacy_request->app_info.ndp_app_info_len = aidl_request.appInfo.size(); + if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) { + LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: " + "ndp_app_info_len too large"; + return false; + } + memcpy(legacy_request->app_info.ndp_app_info, aidl_request.appInfo.data(), + legacy_request->app_info.ndp_app_info_len); + legacy_request->cipher_type = (unsigned int)aidl_request.securityConfig.cipherType; + if (aidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; + legacy_request->key_info.body.pmk_info.pmk_len = aidl_request.securityConfig.pmk.size(); + if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { + LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: " + "invalid pmk_len"; + return false; + } + memcpy(legacy_request->key_info.body.pmk_info.pmk, aidl_request.securityConfig.pmk.data(), + legacy_request->key_info.body.pmk_info.pmk_len); + } + if (aidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; + legacy_request->key_info.body.passphrase_info.passphrase_len = + aidl_request.securityConfig.passphrase.size(); + if (legacy_request->key_info.body.passphrase_info.passphrase_len < + NAN_SECURITY_MIN_PASSPHRASE_LEN) { + LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: " + "passphrase_len too small"; + return false; + } + if (legacy_request->key_info.body.passphrase_info.passphrase_len > + NAN_SECURITY_MAX_PASSPHRASE_LEN) { + LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: " + "passphrase_len too large"; + return false; + } + memcpy(legacy_request->key_info.body.passphrase_info.passphrase, + aidl_request.securityConfig.passphrase.data(), + legacy_request->key_info.body.passphrase_info.passphrase_len); + } + legacy_request->service_name_len = aidl_request.serviceNameOutOfBand.size(); + if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { + LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: " + "service_name_len too large"; + return false; + } + memcpy(legacy_request->service_name, aidl_request.serviceNameOutOfBand.data(), + legacy_request->service_name_len); + legacy_request->scid_len = aidl_request.securityConfig.scid.size(); + if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) { + LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: scid_len too large"; + return false; + } + memcpy(legacy_request->scid, aidl_request.securityConfig.scid.data(), legacy_request->scid_len); + + return true; +} + +bool convertLegacyNanResponseHeaderToAidl(const legacy_hal::NanResponseMsg& legacy_response, + NanStatus* nanStatus) { + if (!nanStatus) { + LOG(ERROR) << "convertLegacyNanResponseHeaderToAidl: nanStatus is null"; + return false; + } + *nanStatus = {}; + + convertToNanStatus(legacy_response.status, legacy_response.nan_error, + sizeof(legacy_response.nan_error), nanStatus); + return true; +} + +bool convertLegacyNanCapabilitiesResponseToAidl(const legacy_hal::NanCapabilities& legacy_response, + NanCapabilities* aidl_response) { + if (!aidl_response) { + LOG(ERROR) << "convertLegacyNanCapabilitiesResponseToAidl: " + "aidl_response is null"; + return false; + } + *aidl_response = {}; + + aidl_response->maxConcurrentClusters = legacy_response.max_concurrent_nan_clusters; + aidl_response->maxPublishes = legacy_response.max_publishes; + aidl_response->maxSubscribes = legacy_response.max_subscribes; + aidl_response->maxServiceNameLen = legacy_response.max_service_name_len; + aidl_response->maxMatchFilterLen = legacy_response.max_match_filter_len; + aidl_response->maxTotalMatchFilterLen = legacy_response.max_total_match_filter_len; + aidl_response->maxServiceSpecificInfoLen = legacy_response.max_service_specific_info_len; + aidl_response->maxExtendedServiceSpecificInfoLen = + legacy_response.max_sdea_service_specific_info_len; + aidl_response->maxNdiInterfaces = legacy_response.max_ndi_interfaces; + aidl_response->maxNdpSessions = legacy_response.max_ndp_sessions; + aidl_response->maxAppInfoLen = legacy_response.max_app_info_len; + aidl_response->maxQueuedTransmitFollowupMsgs = + legacy_response.max_queued_transmit_followup_msgs; + aidl_response->maxSubscribeInterfaceAddresses = legacy_response.max_subscribe_address; + aidl_response->supportedCipherSuites = + static_cast(legacy_response.cipher_suites_supported); + aidl_response->instantCommunicationModeSupportFlag = legacy_response.is_instant_mode_supported; + + return true; +} + +bool convertLegacyNanMatchIndToAidl(const legacy_hal::NanMatchInd& legacy_ind, + NanMatchInd* aidl_ind) { + if (!aidl_ind) { + LOG(ERROR) << "convertLegacyNanMatchIndToAidl: aidl_ind is null"; + return false; + } + *aidl_ind = {}; + + aidl_ind->discoverySessionId = legacy_ind.publish_subscribe_id; + aidl_ind->peerId = legacy_ind.requestor_instance_id; + aidl_ind->addr = std::array(); + std::copy(legacy_ind.addr, legacy_ind.addr + 6, std::begin(aidl_ind->addr)); + aidl_ind->serviceSpecificInfo = std::vector( + legacy_ind.service_specific_info, + legacy_ind.service_specific_info + legacy_ind.service_specific_info_len); + aidl_ind->extendedServiceSpecificInfo = std::vector( + legacy_ind.sdea_service_specific_info, + legacy_ind.sdea_service_specific_info + legacy_ind.sdea_service_specific_info_len); + aidl_ind->matchFilter = + std::vector(legacy_ind.sdf_match_filter, + legacy_ind.sdf_match_filter + legacy_ind.sdf_match_filter_len); + aidl_ind->matchOccurredInBeaconFlag = legacy_ind.match_occured_flag == 1; // NOTYPO + aidl_ind->outOfResourceFlag = legacy_ind.out_of_resource_flag == 1; + aidl_ind->rssiValue = legacy_ind.rssi_value; + aidl_ind->peerCipherType = (NanCipherSuiteType)legacy_ind.peer_cipher_type; + aidl_ind->peerRequiresSecurityEnabledInNdp = + legacy_ind.peer_sdea_params.security_cfg == legacy_hal::NAN_DP_CONFIG_SECURITY; + aidl_ind->peerRequiresRanging = + legacy_ind.peer_sdea_params.ranging_state == legacy_hal::NAN_RANGING_ENABLE; + aidl_ind->rangingMeasurementInMm = legacy_ind.range_info.range_measurement_mm; + aidl_ind->rangingIndicationType = + static_cast(legacy_ind.range_info.ranging_event_type); + aidl_ind->scid = std::vector(legacy_ind.scid, legacy_ind.scid + legacy_ind.scid_len); + return true; +} + +bool convertLegacyNanFollowupIndToAidl(const legacy_hal::NanFollowupInd& legacy_ind, + NanFollowupReceivedInd* aidl_ind) { + if (!aidl_ind) { + LOG(ERROR) << "convertLegacyNanFollowupIndToAidl: aidl_ind is null"; + return false; + } + *aidl_ind = {}; + + aidl_ind->discoverySessionId = legacy_ind.publish_subscribe_id; + aidl_ind->peerId = legacy_ind.requestor_instance_id; + aidl_ind->addr = std::array(); + std::copy(legacy_ind.addr, legacy_ind.addr + 6, std::begin(aidl_ind->addr)); + aidl_ind->receivedInFaw = legacy_ind.dw_or_faw == 1; + aidl_ind->serviceSpecificInfo = std::vector( + legacy_ind.service_specific_info, + legacy_ind.service_specific_info + legacy_ind.service_specific_info_len); + aidl_ind->extendedServiceSpecificInfo = std::vector( + legacy_ind.sdea_service_specific_info, + legacy_ind.sdea_service_specific_info + legacy_ind.sdea_service_specific_info_len); + + return true; +} + +bool convertLegacyNanDataPathRequestIndToAidl(const legacy_hal::NanDataPathRequestInd& legacy_ind, + NanDataPathRequestInd* aidl_ind) { + if (!aidl_ind) { + LOG(ERROR) << "convertLegacyNanDataPathRequestIndToAidl: aidl_ind is null"; + return false; + } + *aidl_ind = {}; + + aidl_ind->discoverySessionId = legacy_ind.service_instance_id; + aidl_ind->peerDiscMacAddr = std::array(); + std::copy(legacy_ind.peer_disc_mac_addr, legacy_ind.peer_disc_mac_addr + 6, + std::begin(aidl_ind->peerDiscMacAddr)); + aidl_ind->ndpInstanceId = legacy_ind.ndp_instance_id; + aidl_ind->securityRequired = + legacy_ind.ndp_cfg.security_cfg == legacy_hal::NAN_DP_CONFIG_SECURITY; + aidl_ind->appInfo = std::vector( + legacy_ind.app_info.ndp_app_info, + legacy_ind.app_info.ndp_app_info + legacy_ind.app_info.ndp_app_info_len); + + return true; +} + +bool convertLegacyNdpChannelInfoToAidl(const legacy_hal::NanChannelInfo& legacy_struct, + NanDataPathChannelInfo* aidl_struct) { + if (!aidl_struct) { + LOG(ERROR) << "convertLegacyNdpChannelInfoToAidl: aidl_struct is null"; + return false; + } + *aidl_struct = {}; + + aidl_struct->channelFreq = legacy_struct.channel; + aidl_struct->channelBandwidth = convertLegacyWifiChannelWidthToAidl( + (legacy_hal::wifi_channel_width)legacy_struct.bandwidth); + aidl_struct->numSpatialStreams = legacy_struct.nss; + + return true; +} + +bool convertLegacyNanDataPathConfirmIndToAidl(const legacy_hal::NanDataPathConfirmInd& legacy_ind, + NanDataPathConfirmInd* aidl_ind) { + if (!aidl_ind) { + LOG(ERROR) << "convertLegacyNanDataPathConfirmIndToAidl: aidl_ind is null"; + return false; + } + *aidl_ind = {}; + + aidl_ind->ndpInstanceId = legacy_ind.ndp_instance_id; + aidl_ind->dataPathSetupSuccess = legacy_ind.rsp_code == legacy_hal::NAN_DP_REQUEST_ACCEPT; + aidl_ind->peerNdiMacAddr = std::array(); + std::copy(legacy_ind.peer_ndi_mac_addr, legacy_ind.peer_ndi_mac_addr + 6, + std::begin(aidl_ind->peerNdiMacAddr)); + aidl_ind->appInfo = std::vector( + legacy_ind.app_info.ndp_app_info, + legacy_ind.app_info.ndp_app_info + legacy_ind.app_info.ndp_app_info_len); + aidl_ind->status.status = convertLegacyNanStatusTypeToAidl(legacy_ind.reason_code); + aidl_ind->status.description = ""; + + std::vector channelInfo; + for (unsigned int i = 0; i < legacy_ind.num_channels; ++i) { + NanDataPathChannelInfo aidl_struct; + if (!convertLegacyNdpChannelInfoToAidl(legacy_ind.channel_info[i], &aidl_struct)) { + return false; + } + channelInfo.push_back(aidl_struct); + } + aidl_ind->channelInfo = channelInfo; + + return true; +} + +bool convertLegacyNanDataPathScheduleUpdateIndToAidl( + const legacy_hal::NanDataPathScheduleUpdateInd& legacy_ind, + NanDataPathScheduleUpdateInd* aidl_ind) { + if (!aidl_ind) { + LOG(ERROR) << "convertLegacyNanDataPathScheduleUpdateIndToAidl: " + "aidl_ind is null"; + return false; + } + *aidl_ind = {}; + + aidl_ind->peerDiscoveryAddress = std::array(); + std::copy(legacy_ind.peer_mac_addr, legacy_ind.peer_mac_addr + 6, + std::begin(aidl_ind->peerDiscoveryAddress)); + std::vector channelInfo; + for (unsigned int i = 0; i < legacy_ind.num_channels; ++i) { + NanDataPathChannelInfo aidl_struct; + if (!convertLegacyNdpChannelInfoToAidl(legacy_ind.channel_info[i], &aidl_struct)) { + return false; + } + channelInfo.push_back(aidl_struct); + } + aidl_ind->channelInfo = channelInfo; + std::vector ndpInstanceIds; + for (unsigned int i = 0; i < legacy_ind.num_ndp_instances; ++i) { + ndpInstanceIds.push_back(legacy_ind.ndp_instance_id[i]); + } + aidl_ind->ndpInstanceIds = uintToIntVec(ndpInstanceIds); + + return true; +} + +legacy_hal::wifi_rtt_type convertAidlRttTypeToLegacy(RttType type) { + switch (type) { + case RttType::ONE_SIDED: + return legacy_hal::RTT_TYPE_1_SIDED; + case RttType::TWO_SIDED: + return legacy_hal::RTT_TYPE_2_SIDED; + }; + CHECK(false); +} + +RttType convertLegacyRttTypeToAidl(legacy_hal::wifi_rtt_type type) { + switch (type) { + case legacy_hal::RTT_TYPE_1_SIDED: + return RttType::ONE_SIDED; + case legacy_hal::RTT_TYPE_2_SIDED: + return RttType::TWO_SIDED; + }; + CHECK(false) << "Unknown legacy type: " << type; +} + +legacy_hal::rtt_peer_type convertAidlRttPeerTypeToLegacy(RttPeerType type) { + switch (type) { + case RttPeerType::AP: + return legacy_hal::RTT_PEER_AP; + case RttPeerType::STA: + return legacy_hal::RTT_PEER_STA; + case RttPeerType::P2P_GO: + return legacy_hal::RTT_PEER_P2P_GO; + case RttPeerType::P2P_CLIENT: + return legacy_hal::RTT_PEER_P2P_CLIENT; + case RttPeerType::NAN_TYPE: + return legacy_hal::RTT_PEER_NAN; + }; + CHECK(false); +} + +legacy_hal::wifi_channel_width convertAidlWifiChannelWidthToLegacy(WifiChannelWidthInMhz type) { + switch (type) { + case WifiChannelWidthInMhz::WIDTH_20: + return legacy_hal::WIFI_CHAN_WIDTH_20; + case WifiChannelWidthInMhz::WIDTH_40: + return legacy_hal::WIFI_CHAN_WIDTH_40; + case WifiChannelWidthInMhz::WIDTH_80: + return legacy_hal::WIFI_CHAN_WIDTH_80; + case WifiChannelWidthInMhz::WIDTH_160: + return legacy_hal::WIFI_CHAN_WIDTH_160; + case WifiChannelWidthInMhz::WIDTH_80P80: + return legacy_hal::WIFI_CHAN_WIDTH_80P80; + case WifiChannelWidthInMhz::WIDTH_5: + return legacy_hal::WIFI_CHAN_WIDTH_5; + case WifiChannelWidthInMhz::WIDTH_10: + return legacy_hal::WIFI_CHAN_WIDTH_10; + case WifiChannelWidthInMhz::WIDTH_320: + return legacy_hal::WIFI_CHAN_WIDTH_320; + case WifiChannelWidthInMhz::WIDTH_INVALID: + return legacy_hal::WIFI_CHAN_WIDTH_INVALID; + }; + CHECK(false); +} + +WifiChannelWidthInMhz convertLegacyWifiChannelWidthToAidl(legacy_hal::wifi_channel_width type) { + switch (type) { + case legacy_hal::WIFI_CHAN_WIDTH_20: + return WifiChannelWidthInMhz::WIDTH_20; + case legacy_hal::WIFI_CHAN_WIDTH_40: + return WifiChannelWidthInMhz::WIDTH_40; + case legacy_hal::WIFI_CHAN_WIDTH_80: + return WifiChannelWidthInMhz::WIDTH_80; + case legacy_hal::WIFI_CHAN_WIDTH_160: + return WifiChannelWidthInMhz::WIDTH_160; + case legacy_hal::WIFI_CHAN_WIDTH_80P80: + return WifiChannelWidthInMhz::WIDTH_80P80; + case legacy_hal::WIFI_CHAN_WIDTH_5: + return WifiChannelWidthInMhz::WIDTH_5; + case legacy_hal::WIFI_CHAN_WIDTH_10: + return WifiChannelWidthInMhz::WIDTH_10; + case legacy_hal::WIFI_CHAN_WIDTH_320: + return WifiChannelWidthInMhz::WIDTH_320; + default: + return WifiChannelWidthInMhz::WIDTH_INVALID; + }; +} + +legacy_hal::wifi_rtt_preamble convertAidlRttPreambleToLegacy(RttPreamble type) { + switch (type) { + case RttPreamble::LEGACY: + return legacy_hal::WIFI_RTT_PREAMBLE_LEGACY; + case RttPreamble::HT: + return legacy_hal::WIFI_RTT_PREAMBLE_HT; + case RttPreamble::VHT: + return legacy_hal::WIFI_RTT_PREAMBLE_VHT; + case RttPreamble::HE: + return legacy_hal::WIFI_RTT_PREAMBLE_HE; + case RttPreamble::EHT: + return legacy_hal::WIFI_RTT_PREAMBLE_EHT; + }; + CHECK(false); +} + +RttPreamble convertLegacyRttPreambleToAidl(legacy_hal::wifi_rtt_preamble type) { + switch (type) { + case legacy_hal::WIFI_RTT_PREAMBLE_LEGACY: + return RttPreamble::LEGACY; + case legacy_hal::WIFI_RTT_PREAMBLE_HT: + return RttPreamble::HT; + case legacy_hal::WIFI_RTT_PREAMBLE_VHT: + return RttPreamble::VHT; + case legacy_hal::WIFI_RTT_PREAMBLE_HE: + return RttPreamble::HE; + case legacy_hal::WIFI_RTT_PREAMBLE_EHT: + return RttPreamble::EHT; + }; + CHECK(false) << "Unknown legacy type: " << type; +} + +legacy_hal::wifi_rtt_bw convertAidlRttBwToLegacy(RttBw type) { + switch (type) { + case RttBw::BW_5MHZ: + return legacy_hal::WIFI_RTT_BW_5; + case RttBw::BW_10MHZ: + return legacy_hal::WIFI_RTT_BW_10; + case RttBw::BW_20MHZ: + return legacy_hal::WIFI_RTT_BW_20; + case RttBw::BW_40MHZ: + return legacy_hal::WIFI_RTT_BW_40; + case RttBw::BW_80MHZ: + return legacy_hal::WIFI_RTT_BW_80; + case RttBw::BW_160MHZ: + return legacy_hal::WIFI_RTT_BW_160; + case RttBw::BW_320MHZ: + return legacy_hal::WIFI_RTT_BW_320; + }; + CHECK(false); +} + +RttBw convertLegacyRttBwToAidl(legacy_hal::wifi_rtt_bw type) { + switch (type) { + case legacy_hal::WIFI_RTT_BW_5: + return RttBw::BW_5MHZ; + case legacy_hal::WIFI_RTT_BW_10: + return RttBw::BW_10MHZ; + case legacy_hal::WIFI_RTT_BW_20: + return RttBw::BW_20MHZ; + case legacy_hal::WIFI_RTT_BW_40: + return RttBw::BW_40MHZ; + case legacy_hal::WIFI_RTT_BW_80: + return RttBw::BW_80MHZ; + case legacy_hal::WIFI_RTT_BW_160: + return RttBw::BW_160MHZ; + case legacy_hal::WIFI_RTT_BW_320: + return RttBw::BW_320MHZ; + }; + CHECK(false) << "Unknown legacy type: " << type; +} + +legacy_hal::wifi_motion_pattern convertAidlRttMotionPatternToLegacy(RttMotionPattern type) { + switch (type) { + case RttMotionPattern::NOT_EXPECTED: + return legacy_hal::WIFI_MOTION_NOT_EXPECTED; + case RttMotionPattern::EXPECTED: + return legacy_hal::WIFI_MOTION_EXPECTED; + case RttMotionPattern::UNKNOWN: + return legacy_hal::WIFI_MOTION_UNKNOWN; + }; + CHECK(false); +} + +WifiRatePreamble convertLegacyWifiRatePreambleToAidl(uint8_t preamble) { + switch (preamble) { + case 0: + return WifiRatePreamble::OFDM; + case 1: + return WifiRatePreamble::CCK; + case 2: + return WifiRatePreamble::HT; + case 3: + return WifiRatePreamble::VHT; + case 4: + return WifiRatePreamble::HE; + case 5: + return WifiRatePreamble::EHT; + default: + return WifiRatePreamble::RESERVED; + }; + CHECK(false) << "Unknown legacy preamble: " << preamble; +} + +WifiRateNss convertLegacyWifiRateNssToAidl(uint8_t nss) { + switch (nss) { + case 0: + return WifiRateNss::NSS_1x1; + case 1: + return WifiRateNss::NSS_2x2; + case 2: + return WifiRateNss::NSS_3x3; + case 3: + return WifiRateNss::NSS_4x4; + }; + CHECK(false) << "Unknown legacy nss: " << nss; + return {}; +} + +RttStatus convertLegacyRttStatusToAidl(legacy_hal::wifi_rtt_status status) { + switch (status) { + case legacy_hal::RTT_STATUS_SUCCESS: + return RttStatus::SUCCESS; + case legacy_hal::RTT_STATUS_FAILURE: + return RttStatus::FAILURE; + case legacy_hal::RTT_STATUS_FAIL_NO_RSP: + return RttStatus::FAIL_NO_RSP; + case legacy_hal::RTT_STATUS_FAIL_REJECTED: + return RttStatus::FAIL_REJECTED; + case legacy_hal::RTT_STATUS_FAIL_NOT_SCHEDULED_YET: + return RttStatus::FAIL_NOT_SCHEDULED_YET; + case legacy_hal::RTT_STATUS_FAIL_TM_TIMEOUT: + return RttStatus::FAIL_TM_TIMEOUT; + case legacy_hal::RTT_STATUS_FAIL_AP_ON_DIFF_CHANNEL: + return RttStatus::FAIL_AP_ON_DIFF_CHANNEL; + case legacy_hal::RTT_STATUS_FAIL_NO_CAPABILITY: + return RttStatus::FAIL_NO_CAPABILITY; + case legacy_hal::RTT_STATUS_ABORTED: + return RttStatus::ABORTED; + case legacy_hal::RTT_STATUS_FAIL_INVALID_TS: + return RttStatus::FAIL_INVALID_TS; + case legacy_hal::RTT_STATUS_FAIL_PROTOCOL: + return RttStatus::FAIL_PROTOCOL; + case legacy_hal::RTT_STATUS_FAIL_SCHEDULE: + return RttStatus::FAIL_SCHEDULE; + case legacy_hal::RTT_STATUS_FAIL_BUSY_TRY_LATER: + return RttStatus::FAIL_BUSY_TRY_LATER; + case legacy_hal::RTT_STATUS_INVALID_REQ: + return RttStatus::INVALID_REQ; + case legacy_hal::RTT_STATUS_NO_WIFI: + return RttStatus::NO_WIFI; + case legacy_hal::RTT_STATUS_FAIL_FTM_PARAM_OVERRIDE: + return RttStatus::FAIL_FTM_PARAM_OVERRIDE; + case legacy_hal::RTT_STATUS_NAN_RANGING_PROTOCOL_FAILURE: + return RttStatus::NAN_RANGING_PROTOCOL_FAILURE; + case legacy_hal::RTT_STATUS_NAN_RANGING_CONCURRENCY_NOT_SUPPORTED: + return RttStatus::NAN_RANGING_CONCURRENCY_NOT_SUPPORTED; + }; + CHECK(false) << "Unknown legacy status: " << status; +} + +bool convertAidlWifiChannelInfoToLegacy(const WifiChannelInfo& aidl_info, + legacy_hal::wifi_channel_info* legacy_info) { + if (!legacy_info) { + return false; + } + *legacy_info = {}; + legacy_info->width = convertAidlWifiChannelWidthToLegacy(aidl_info.width); + legacy_info->center_freq = aidl_info.centerFreq; + legacy_info->center_freq0 = aidl_info.centerFreq0; + legacy_info->center_freq1 = aidl_info.centerFreq1; + return true; +} + +bool convertLegacyWifiChannelInfoToAidl(const legacy_hal::wifi_channel_info& legacy_info, + WifiChannelInfo* aidl_info) { + if (!aidl_info) { + return false; + } + *aidl_info = {}; + aidl_info->width = convertLegacyWifiChannelWidthToAidl(legacy_info.width); + aidl_info->centerFreq = legacy_info.center_freq; + aidl_info->centerFreq0 = legacy_info.center_freq0; + aidl_info->centerFreq1 = legacy_info.center_freq1; + return true; +} + +bool convertAidlRttConfigToLegacy(const RttConfig& aidl_config, + legacy_hal::wifi_rtt_config* legacy_config) { + if (!legacy_config) { + return false; + } + *legacy_config = {}; + CHECK(aidl_config.addr.size() == sizeof(legacy_config->addr)); + memcpy(legacy_config->addr, aidl_config.addr.data(), aidl_config.addr.size()); + legacy_config->type = convertAidlRttTypeToLegacy(aidl_config.type); + legacy_config->peer = convertAidlRttPeerTypeToLegacy(aidl_config.peer); + if (!convertAidlWifiChannelInfoToLegacy(aidl_config.channel, &legacy_config->channel)) { + return false; + } + legacy_config->burst_period = aidl_config.burstPeriod; + legacy_config->num_burst = aidl_config.numBurst; + legacy_config->num_frames_per_burst = aidl_config.numFramesPerBurst; + legacy_config->num_retries_per_rtt_frame = aidl_config.numRetriesPerRttFrame; + legacy_config->num_retries_per_ftmr = aidl_config.numRetriesPerFtmr; + legacy_config->LCI_request = aidl_config.mustRequestLci; + legacy_config->LCR_request = aidl_config.mustRequestLcr; + legacy_config->burst_duration = aidl_config.burstDuration; + legacy_config->preamble = convertAidlRttPreambleToLegacy(aidl_config.preamble); + legacy_config->bw = convertAidlRttBwToLegacy(aidl_config.bw); + return true; +} + +bool convertAidlVectorOfRttConfigToLegacy( + const std::vector& aidl_configs, + std::vector* legacy_configs) { + if (!legacy_configs) { + return false; + } + *legacy_configs = {}; + for (const auto& aidl_config : aidl_configs) { + legacy_hal::wifi_rtt_config legacy_config; + if (!convertAidlRttConfigToLegacy(aidl_config, &legacy_config)) { + return false; + } + legacy_configs->push_back(legacy_config); + } + return true; +} + +bool convertAidlRttLciInformationToLegacy(const RttLciInformation& aidl_info, + legacy_hal::wifi_lci_information* legacy_info) { + if (!legacy_info) { + return false; + } + *legacy_info = {}; + legacy_info->latitude = aidl_info.latitude; + legacy_info->longitude = aidl_info.longitude; + legacy_info->altitude = aidl_info.altitude; + legacy_info->latitude_unc = aidl_info.latitudeUnc; + legacy_info->longitude_unc = aidl_info.longitudeUnc; + legacy_info->altitude_unc = aidl_info.altitudeUnc; + legacy_info->motion_pattern = convertAidlRttMotionPatternToLegacy(aidl_info.motionPattern); + legacy_info->floor = aidl_info.floor; + legacy_info->height_above_floor = aidl_info.heightAboveFloor; + legacy_info->height_unc = aidl_info.heightUnc; + return true; +} + +bool convertAidlRttLcrInformationToLegacy(const RttLcrInformation& aidl_info, + legacy_hal::wifi_lcr_information* legacy_info) { + if (!legacy_info) { + return false; + } + *legacy_info = {}; + CHECK(aidl_info.countryCode.size() == sizeof(legacy_info->country_code)); + memcpy(legacy_info->country_code, aidl_info.countryCode.data(), aidl_info.countryCode.size()); + if (aidl_info.civicInfo.size() > sizeof(legacy_info->civic_info)) { + return false; + } + legacy_info->length = aidl_info.civicInfo.size(); + memcpy(legacy_info->civic_info, aidl_info.civicInfo.c_str(), aidl_info.civicInfo.size()); + return true; +} + +bool convertAidlRttResponderToLegacy(const RttResponder& aidl_responder, + legacy_hal::wifi_rtt_responder* legacy_responder) { + if (!legacy_responder) { + return false; + } + *legacy_responder = {}; + if (!convertAidlWifiChannelInfoToLegacy(aidl_responder.channel, &legacy_responder->channel)) { + return false; + } + legacy_responder->preamble = convertAidlRttPreambleToLegacy(aidl_responder.preamble); + return true; +} + +bool convertLegacyRttResponderToAidl(const legacy_hal::wifi_rtt_responder& legacy_responder, + RttResponder* aidl_responder) { + if (!aidl_responder) { + return false; + } + *aidl_responder = {}; + if (!convertLegacyWifiChannelInfoToAidl(legacy_responder.channel, &aidl_responder->channel)) { + return false; + } + aidl_responder->preamble = convertLegacyRttPreambleToAidl(legacy_responder.preamble); + return true; +} + +bool convertLegacyRttCapabilitiesToAidl( + const legacy_hal::wifi_rtt_capabilities& legacy_capabilities, + RttCapabilities* aidl_capabilities) { + if (!aidl_capabilities) { + return false; + } + *aidl_capabilities = {}; + aidl_capabilities->rttOneSidedSupported = legacy_capabilities.rtt_one_sided_supported; + aidl_capabilities->rttFtmSupported = legacy_capabilities.rtt_ftm_supported; + aidl_capabilities->lciSupported = legacy_capabilities.lci_support; + aidl_capabilities->lcrSupported = legacy_capabilities.lcr_support; + aidl_capabilities->responderSupported = legacy_capabilities.responder_supported; + int32_t preambleSupport = 0; + for (const auto flag : {legacy_hal::WIFI_RTT_PREAMBLE_LEGACY, legacy_hal::WIFI_RTT_PREAMBLE_HT, + legacy_hal::WIFI_RTT_PREAMBLE_VHT, legacy_hal::WIFI_RTT_PREAMBLE_HE, + legacy_hal::WIFI_RTT_PREAMBLE_EHT}) { + if (legacy_capabilities.preamble_support & flag) { + preambleSupport |= static_cast::type>( + convertLegacyRttPreambleToAidl(flag)); + } + } + aidl_capabilities->preambleSupport = static_cast(preambleSupport); + int32_t bwSupport = 0; + for (const auto flag : + {legacy_hal::WIFI_RTT_BW_5, legacy_hal::WIFI_RTT_BW_10, legacy_hal::WIFI_RTT_BW_20, + legacy_hal::WIFI_RTT_BW_40, legacy_hal::WIFI_RTT_BW_80, legacy_hal::WIFI_RTT_BW_160, + legacy_hal::WIFI_RTT_BW_320}) { + if (legacy_capabilities.bw_support & flag) { + bwSupport |= + static_cast::type>(convertLegacyRttBwToAidl(flag)); + } + } + aidl_capabilities->bwSupport = static_cast(bwSupport); + aidl_capabilities->mcVersion = legacy_capabilities.mc_version; + return true; +} + +bool convertLegacyWifiRateInfoToAidl(const legacy_hal::wifi_rate& legacy_rate, + WifiRateInfo* aidl_rate) { + if (!aidl_rate) { + return false; + } + *aidl_rate = {}; + aidl_rate->preamble = convertLegacyWifiRatePreambleToAidl(legacy_rate.preamble); + aidl_rate->nss = convertLegacyWifiRateNssToAidl(legacy_rate.nss); + aidl_rate->bw = convertLegacyWifiChannelWidthToAidl( + static_cast(legacy_rate.bw)); + aidl_rate->rateMcsIdx = legacy_rate.rateMcsIdx; + aidl_rate->bitRateInKbps = legacy_rate.bitrate; + return true; +} + +bool convertLegacyRttResultToAidl(const legacy_hal::wifi_rtt_result& legacy_result, + RttResult* aidl_result) { + if (!aidl_result) { + return false; + } + *aidl_result = {}; + aidl_result->addr = std::array(); + CHECK(sizeof(legacy_result.addr) == aidl_result->addr.size()); + std::copy(legacy_result.addr, legacy_result.addr + 6, std::begin(aidl_result->addr)); + aidl_result->burstNum = legacy_result.burst_num; + aidl_result->measurementNumber = legacy_result.measurement_number; + aidl_result->successNumber = legacy_result.success_number; + aidl_result->numberPerBurstPeer = legacy_result.number_per_burst_peer; + aidl_result->status = convertLegacyRttStatusToAidl(legacy_result.status); + aidl_result->retryAfterDuration = legacy_result.retry_after_duration; + aidl_result->type = convertLegacyRttTypeToAidl(legacy_result.type); + aidl_result->rssi = legacy_result.rssi; + aidl_result->rssiSpread = legacy_result.rssi_spread; + if (!convertLegacyWifiRateInfoToAidl(legacy_result.tx_rate, &aidl_result->txRate)) { + return false; + } + if (!convertLegacyWifiRateInfoToAidl(legacy_result.rx_rate, &aidl_result->rxRate)) { + return false; + } + aidl_result->rtt = legacy_result.rtt; + aidl_result->rttSd = legacy_result.rtt_sd; + aidl_result->rttSpread = legacy_result.rtt_spread; + aidl_result->distanceInMm = legacy_result.distance_mm; + aidl_result->distanceSdInMm = legacy_result.distance_sd_mm; + aidl_result->distanceSpreadInMm = legacy_result.distance_spread_mm; + aidl_result->timeStampInUs = legacy_result.ts; + aidl_result->burstDurationInMs = legacy_result.burst_duration; + aidl_result->negotiatedBurstNum = legacy_result.negotiated_burst_num; + if (legacy_result.LCI && !convertLegacyIeToAidl(*legacy_result.LCI, &aidl_result->lci)) { + return false; + } + if (legacy_result.LCR && !convertLegacyIeToAidl(*legacy_result.LCR, &aidl_result->lcr)) { + return false; + } + return true; +} + +bool convertLegacyVectorOfRttResultToAidl( + const std::vector& legacy_results, + std::vector* aidl_results) { + if (!aidl_results) { + return false; + } + *aidl_results = {}; + for (const auto legacy_result : legacy_results) { + RttResult aidl_result; + if (!convertLegacyRttResultToAidl(*legacy_result, &aidl_result)) { + return false; + } + aidl_results->push_back(aidl_result); + } + return true; +} + +legacy_hal::wifi_interface_type convertAidlIfaceTypeToLegacy(IfaceType aidl_interface_type) { + switch (aidl_interface_type) { + case IfaceType::STA: + return legacy_hal::WIFI_INTERFACE_TYPE_STA; + case IfaceType::AP: + return legacy_hal::WIFI_INTERFACE_TYPE_AP; + case IfaceType::P2P: + return legacy_hal::WIFI_INTERFACE_TYPE_P2P; + case IfaceType::NAN_IFACE: + return legacy_hal::WIFI_INTERFACE_TYPE_NAN; + } + CHECK(false); +} + +legacy_hal::wifi_multi_sta_use_case convertAidlMultiStaUseCaseToLegacy( + IWifiChip::MultiStaUseCase use_case) { + switch (use_case) { + case IWifiChip::MultiStaUseCase::DUAL_STA_TRANSIENT_PREFER_PRIMARY: + return legacy_hal::WIFI_DUAL_STA_TRANSIENT_PREFER_PRIMARY; + case IWifiChip::MultiStaUseCase::DUAL_STA_NON_TRANSIENT_UNBIASED: + return legacy_hal::WIFI_DUAL_STA_NON_TRANSIENT_UNBIASED; + } + CHECK(false); +} + +bool convertAidlCoexUnsafeChannelToLegacy( + const IWifiChip::CoexUnsafeChannel& aidl_unsafe_channel, + legacy_hal::wifi_coex_unsafe_channel* legacy_unsafe_channel) { + if (!legacy_unsafe_channel) { + return false; + } + *legacy_unsafe_channel = {}; + switch (aidl_unsafe_channel.band) { + case WifiBand::BAND_24GHZ: + legacy_unsafe_channel->band = legacy_hal::WLAN_MAC_2_4_BAND; + break; + case WifiBand::BAND_5GHZ: + legacy_unsafe_channel->band = legacy_hal::WLAN_MAC_5_0_BAND; + break; + default: + return false; + }; + legacy_unsafe_channel->channel = aidl_unsafe_channel.channel; + legacy_unsafe_channel->power_cap_dbm = aidl_unsafe_channel.powerCapDbm; + return true; +} + +bool convertAidlVectorOfCoexUnsafeChannelToLegacy( + const std::vector& aidl_unsafe_channels, + std::vector* legacy_unsafe_channels) { + if (!legacy_unsafe_channels) { + return false; + } + *legacy_unsafe_channels = {}; + for (const auto& aidl_unsafe_channel : aidl_unsafe_channels) { + legacy_hal::wifi_coex_unsafe_channel legacy_unsafe_channel; + if (!aidl_struct_util::convertAidlCoexUnsafeChannelToLegacy(aidl_unsafe_channel, + &legacy_unsafe_channel)) { + return false; + } + legacy_unsafe_channels->push_back(legacy_unsafe_channel); + } + return true; +} + +WifiAntennaMode convertLegacyAntennaConfigurationToAidl(uint32_t antenna_cfg) { + switch (antenna_cfg) { + case legacy_hal::WIFI_ANTENNA_1X1: + return WifiAntennaMode::WIFI_ANTENNA_MODE_1X1; + case legacy_hal::WIFI_ANTENNA_2X2: + return WifiAntennaMode::WIFI_ANTENNA_MODE_2X2; + case legacy_hal::WIFI_ANTENNA_3X3: + return WifiAntennaMode::WIFI_ANTENNA_MODE_3X3; + case legacy_hal::WIFI_ANTENNA_4X4: + return WifiAntennaMode::WIFI_ANTENNA_MODE_4X4; + default: + return WifiAntennaMode::WIFI_ANTENNA_MODE_UNSPECIFIED; + } +} + +bool convertLegacyWifiRadioConfigurationToAidl( + legacy_hal::wifi_radio_configuration* radio_configuration, + WifiRadioConfiguration* aidl_radio_configuration) { + if (!aidl_radio_configuration) { + return false; + } + *aidl_radio_configuration = {}; + aidl_radio_configuration->bandInfo = + aidl_struct_util::convertLegacyMacBandToAidlWifiBand(radio_configuration->band); + if (aidl_radio_configuration->bandInfo == WifiBand::BAND_UNSPECIFIED) { + LOG(ERROR) << "Unspecified band"; + return false; + } + aidl_radio_configuration->antennaMode = + aidl_struct_util::convertLegacyAntennaConfigurationToAidl( + radio_configuration->antenna_cfg); + return true; +} + +bool convertLegacyRadioCombinationsMatrixToAidl( + legacy_hal::wifi_radio_combination_matrix* legacy_matrix, + WifiRadioCombinationMatrix* aidl_matrix) { + if (!aidl_matrix || !legacy_matrix) { + return false; + } + *aidl_matrix = {}; + + int num_combinations = legacy_matrix->num_radio_combinations; + std::vector radio_combinations_vec; + if (!num_combinations) { + LOG(ERROR) << "zero radio combinations"; + return false; + } + wifi_radio_combination* l_radio_combinations_ptr = legacy_matrix->radio_combinations; + for (int i = 0; i < num_combinations; i++) { + int num_configurations = l_radio_combinations_ptr->num_radio_configurations; + WifiRadioCombination radioCombination; + std::vector radio_configurations_vec; + if (!num_configurations) { + LOG(ERROR) << "zero radio configurations"; + return false; + } + for (int j = 0; j < num_configurations; j++) { + WifiRadioConfiguration radioConfiguration; + wifi_radio_configuration* l_radio_configurations_ptr = + &l_radio_combinations_ptr->radio_configurations[j]; + if (!aidl_struct_util::convertLegacyWifiRadioConfigurationToAidl( + l_radio_configurations_ptr, &radioConfiguration)) { + LOG(ERROR) << "Error converting wifi radio configuration"; + return false; + } + radio_configurations_vec.push_back(radioConfiguration); + } + radioCombination.radioConfigurations = radio_configurations_vec; + radio_combinations_vec.push_back(radioCombination); + l_radio_combinations_ptr = + (wifi_radio_combination*)((u8*)l_radio_combinations_ptr + + sizeof(wifi_radio_combination) + + (sizeof(wifi_radio_configuration) * num_configurations)); + } + aidl_matrix->radioCombinations = radio_combinations_vec; + return true; +} + +} // namespace aidl_struct_util +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/aidl_struct_util.h b/wifi/aidl/default/aidl_struct_util.h new file mode 100644 index 0000000000..4ebfc10787 --- /dev/null +++ b/wifi/aidl/default/aidl_struct_util.h @@ -0,0 +1,180 @@ +/* + * 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. + */ + +#ifndef AIDL_STRUCT_UTIL_H_ +#define AIDL_STRUCT_UTIL_H_ + +#include +#include +#include +#include + +#include + +#include "wifi_legacy_hal.h" + +/** + * This file contains a bunch of functions to convert structs from the legacy + * HAL to AIDL and vice versa. + */ +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace aidl_struct_util { + +// Chip conversion methods. +bool convertLegacyFeaturesToAidlChipCapabilities(uint64_t legacy_feature_set, + uint32_t legacy_logger_feature_set, + uint32_t* aidl_caps); +bool convertLegacyDebugRingBufferStatusToAidl( + const legacy_hal::wifi_ring_buffer_status& legacy_status, + WifiDebugRingBufferStatus* aidl_status); +bool convertLegacyVectorOfDebugRingBufferStatusToAidl( + const std::vector& legacy_status_vec, + std::vector* aidl_status_vec); +bool convertLegacyWakeReasonStatsToAidl(const legacy_hal::WakeReasonStats& legacy_stats, + WifiDebugHostWakeReasonStats* aidl_stats); +legacy_hal::wifi_power_scenario convertAidlTxPowerScenarioToLegacy( + IWifiChip::TxPowerScenario aidl_scenario); +legacy_hal::wifi_latency_mode convertAidlLatencyModeToLegacy( + IWifiChip::LatencyMode aidl_latency_mode); +bool convertLegacyWifiMacInfosToAidl( + const std::vector& legacy_mac_infos, + std::vector* aidl_radio_mode_infos); +legacy_hal::wifi_interface_type convertAidlIfaceTypeToLegacy(IfaceType aidl_interface_type); +legacy_hal::wifi_multi_sta_use_case convertAidlMultiStaUseCaseToLegacy( + IWifiChip::MultiStaUseCase use_case); +bool convertAidlCoexUnsafeChannelToLegacy( + const IWifiChip::CoexUnsafeChannel& aidl_unsafe_channel, + legacy_hal::wifi_coex_unsafe_channel* legacy_unsafe_channel); +bool convertAidlVectorOfCoexUnsafeChannelToLegacy( + const std::vector& aidl_unsafe_channels, + std::vector* legacy_unsafe_channels); +bool convertLegacyRadioCombinationsMatrixToAidl( + legacy_hal::wifi_radio_combination_matrix* legacy_matrix, + WifiRadioCombinationMatrix* aidl_matrix); +WifiBand convertLegacyMacBandToAidlWifiBand(uint32_t band); +WifiAntennaMode convertLegacyAntennaConfigurationToAidl(uint32_t antenna_cfg); + +// STA iface conversion methods. +bool convertLegacyFeaturesToAidlStaCapabilities(uint64_t legacy_feature_set, + uint32_t legacy_logger_feature_set, + uint32_t* aidl_caps); +bool convertLegacyApfCapabilitiesToAidl(const legacy_hal::PacketFilterCapabilities& legacy_caps, + StaApfPacketFilterCapabilities* aidl_caps); +bool convertLegacyGscanCapabilitiesToAidl(const legacy_hal::wifi_gscan_capabilities& legacy_caps, + StaBackgroundScanCapabilities* aidl_caps); +legacy_hal::wifi_band convertAidlWifiBandToLegacy(WifiBand band); +bool convertAidlGscanParamsToLegacy(const StaBackgroundScanParameters& aidl_scan_params, + legacy_hal::wifi_scan_cmd_params* legacy_scan_params); +// |has_ie_data| indicates whether or not the wifi_scan_result includes 802.11 +// Information Elements (IEs) +bool convertLegacyGscanResultToAidl(const legacy_hal::wifi_scan_result& legacy_scan_result, + bool has_ie_data, StaScanResult* aidl_scan_result); +// |cached_results| is assumed to not include IEs. +bool convertLegacyVectorOfCachedGscanResultsToAidl( + const std::vector& legacy_cached_scan_results, + std::vector* aidl_scan_datas); +bool convertLegacyLinkLayerStatsToAidl(const legacy_hal::LinkLayerStats& legacy_stats, + StaLinkLayerStats* aidl_stats); +bool convertLegacyRoamingCapabilitiesToAidl( + const legacy_hal::wifi_roaming_capabilities& legacy_caps, + StaRoamingCapabilities* aidl_caps); +bool convertAidlRoamingConfigToLegacy(const StaRoamingConfig& aidl_config, + legacy_hal::wifi_roaming_config* legacy_config); +legacy_hal::fw_roaming_state_t convertAidlRoamingStateToLegacy(StaRoamingState state); +bool convertLegacyVectorOfDebugTxPacketFateToAidl( + const std::vector& legacy_fates, + std::vector* aidl_fates); +bool convertLegacyVectorOfDebugRxPacketFateToAidl( + const std::vector& legacy_fates, + std::vector* aidl_fates); + +// NAN iface conversion methods. +void convertToNanStatus(legacy_hal::NanStatusType type, const char* str, size_t max_len, + NanStatus* nanStatus); +bool convertAidlNanEnableRequestToLegacy(const NanEnableRequest& aidl_request1, + const NanConfigRequestSupplemental& aidl_request2, + legacy_hal::NanEnableRequest* legacy_request); +bool convertAidlNanConfigRequestToLegacy(const NanConfigRequest& aidl_request1, + const NanConfigRequestSupplemental& aidl_request2, + legacy_hal::NanConfigRequest* legacy_request); +bool convertAidlNanPublishRequestToLegacy(const NanPublishRequest& aidl_request, + legacy_hal::NanPublishRequest* legacy_request); +bool convertAidlNanSubscribeRequestToLegacy(const NanSubscribeRequest& aidl_request, + legacy_hal::NanSubscribeRequest* legacy_request); +bool convertAidlNanTransmitFollowupRequestToLegacy( + const NanTransmitFollowupRequest& aidl_request, + legacy_hal::NanTransmitFollowupRequest* legacy_request); +bool convertAidlNanDataPathInitiatorRequestToLegacy( + const NanInitiateDataPathRequest& aidl_request, + legacy_hal::NanDataPathInitiatorRequest* legacy_request); +bool convertAidlNanDataPathIndicationResponseToLegacy( + const NanRespondToDataPathIndicationRequest& aidl_response, + legacy_hal::NanDataPathIndicationResponse* legacy_response); +bool convertLegacyNanResponseHeaderToAidl(const legacy_hal::NanResponseMsg& legacy_response, + NanStatus* nanStatus); +bool convertLegacyNanCapabilitiesResponseToAidl(const legacy_hal::NanCapabilities& legacy_response, + NanCapabilities* aidl_response); +bool convertLegacyNanMatchIndToAidl(const legacy_hal::NanMatchInd& legacy_ind, + NanMatchInd* aidl_ind); +bool convertLegacyNanFollowupIndToAidl(const legacy_hal::NanFollowupInd& legacy_ind, + NanFollowupReceivedInd* aidl_ind); +bool convertLegacyNanDataPathRequestIndToAidl(const legacy_hal::NanDataPathRequestInd& legacy_ind, + NanDataPathRequestInd* aidl_ind); +bool convertLegacyNanDataPathConfirmIndToAidl(const legacy_hal::NanDataPathConfirmInd& legacy_ind, + NanDataPathConfirmInd* aidl_ind); +bool convertLegacyNanDataPathScheduleUpdateIndToAidl( + const legacy_hal::NanDataPathScheduleUpdateInd& legacy_ind, + NanDataPathScheduleUpdateInd* aidl_ind); + +// RTT controller conversion methods. +bool convertAidlVectorOfRttConfigToLegacy(const std::vector& aidl_configs, + std::vector* legacy_configs); +bool convertAidlRttLciInformationToLegacy(const RttLciInformation& aidl_info, + legacy_hal::wifi_lci_information* legacy_info); +bool convertAidlRttLcrInformationToLegacy(const RttLcrInformation& aidl_info, + legacy_hal::wifi_lcr_information* legacy_info); +bool convertAidlRttResponderToLegacy(const RttResponder& aidl_responder, + legacy_hal::wifi_rtt_responder* legacy_responder); +bool convertAidlWifiChannelInfoToLegacy(const WifiChannelInfo& aidl_info, + legacy_hal::wifi_channel_info* legacy_info); +bool convertLegacyRttResponderToAidl(const legacy_hal::wifi_rtt_responder& legacy_responder, + RttResponder* aidl_responder); +bool convertLegacyRttCapabilitiesToAidl( + const legacy_hal::wifi_rtt_capabilities& legacy_capabilities, + RttCapabilities* aidl_capabilities); +bool convertLegacyVectorOfRttResultToAidl( + const std::vector& legacy_results, + std::vector* aidl_results); +uint32_t convertAidlWifiBandToLegacyMacBand(WifiBand band); +uint32_t convertAidlWifiIfaceModeToLegacy(uint32_t aidl_iface_mask); +uint32_t convertAidlUsableChannelFilterToLegacy(uint32_t aidl_filter_mask); +bool convertLegacyWifiUsableChannelsToAidl( + const std::vector& legacy_usable_channels, + std::vector* aidl_usable_channels); +bool convertLegacyPeerInfoStatsToAidl(const legacy_hal::WifiPeerInfo& legacy_peer_info_stats, + StaPeerInfo* aidl_peer_info_stats); +bool convertLegacyWifiRateInfoToAidl(const legacy_hal::wifi_rate& legacy_rate, + WifiRateInfo* aidl_rate); +} // namespace aidl_struct_util +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // AIDL_STRUCT_UTIL_H_ diff --git a/wifi/1.6/default/hidl_sync_util.cpp b/wifi/aidl/default/aidl_sync_util.cpp similarity index 78% rename from wifi/1.6/default/hidl_sync_util.cpp rename to wifi/aidl/default/aidl_sync_util.cpp index 358d95e668..d81eb81182 100644 --- a/wifi/1.6/default/hidl_sync_util.cpp +++ b/wifi/aidl/default/aidl_sync_util.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * 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. @@ -14,26 +14,24 @@ * limitations under the License. */ -#include "hidl_sync_util.h" +#include "aidl_sync_util.h" namespace { std::recursive_mutex g_mutex; } // namespace +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { -namespace hidl_sync_util { +namespace aidl_sync_util { std::unique_lock acquireGlobalLock() { return std::unique_lock{g_mutex}; } -} // namespace hidl_sync_util -} // namespace implementation -} // namespace V1_6 +} // namespace aidl_sync_util } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl diff --git a/wifi/1.6/default/hidl_sync_util.h b/wifi/aidl/default/aidl_sync_util.h similarity index 71% rename from wifi/1.6/default/hidl_sync_util.h rename to wifi/aidl/default/aidl_sync_util.h index 2c1c37b0ad..a61cd3f57c 100644 --- a/wifi/1.6/default/hidl_sync_util.h +++ b/wifi/aidl/default/aidl_sync_util.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * 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. @@ -14,24 +14,22 @@ * limitations under the License. */ -#ifndef HIDL_SYNC_UTIL_H_ -#define HIDL_SYNC_UTIL_H_ +#ifndef AIDL_SYNC_UTIL_H_ +#define AIDL_SYNC_UTIL_H_ #include // Utility that provides a global lock to synchronize access between -// the HIDL thread and the legacy HAL's event loop. +// the AIDL thread and the legacy HAL's event loop. +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { -namespace hidl_sync_util { +namespace aidl_sync_util { std::unique_lock acquireGlobalLock(); -} // namespace hidl_sync_util -} // namespace implementation -} // namespace V1_6 +} // namespace aidl_sync_util } // namespace wifi } // namespace hardware } // namespace android -#endif // HIDL_SYNC_UTIL_H_ +} // namespace aidl +#endif // AIDL_SYNC_UTIL_H_ diff --git a/wifi/aidl/default/android.hardware.wifi-service-lazy.rc b/wifi/aidl/default/android.hardware.wifi-service-lazy.rc new file mode 100644 index 0000000000..12d3ff7bde --- /dev/null +++ b/wifi/aidl/default/android.hardware.wifi-service-lazy.rc @@ -0,0 +1,8 @@ +service vendor.wifi_hal_legacy /vendor/bin/hw/android.hardware.wifi-service-lazy + interface aidl android.hardware.wifi.IWifi/default + oneshot + disabled + class hal + capabilities NET_ADMIN NET_RAW SYS_MODULE + user wifi + group wifi gps diff --git a/wifi/aidl/default/android.hardware.wifi-service.rc b/wifi/aidl/default/android.hardware.wifi-service.rc new file mode 100644 index 0000000000..ec8acf5767 --- /dev/null +++ b/wifi/aidl/default/android.hardware.wifi-service.rc @@ -0,0 +1,6 @@ +service vendor.wifi_hal_legacy /vendor/bin/hw/android.hardware.wifi-service + interface aidl android.hardware.wifi.IWifi/default + class hal + capabilities NET_ADMIN NET_RAW SYS_MODULE + user wifi + group wifi gps diff --git a/wifi/aidl/default/android.hardware.wifi-service.xml b/wifi/aidl/default/android.hardware.wifi-service.xml new file mode 100644 index 0000000000..5398ee77b5 --- /dev/null +++ b/wifi/aidl/default/android.hardware.wifi-service.xml @@ -0,0 +1,6 @@ + + + android.hardware.wifi + IWifi/default + + diff --git a/wifi/1.6/default/ringbuffer.cpp b/wifi/aidl/default/ringbuffer.cpp similarity index 92% rename from wifi/1.6/default/ringbuffer.cpp rename to wifi/aidl/default/ringbuffer.cpp index 981bf7bce7..9d08a7368e 100644 --- a/wifi/1.6/default/ringbuffer.cpp +++ b/wifi/aidl/default/ringbuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -14,15 +14,14 @@ * limitations under the License. */ -#include - #include "ringbuffer.h" +#include + +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { Ringbuffer::Ringbuffer(size_t maxSize) : size_(0), maxSize_(maxSize) {} @@ -57,8 +56,7 @@ void Ringbuffer::clear() { size_ = 0; } -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl diff --git a/wifi/1.6/default/ringbuffer.h b/wifi/aidl/default/ringbuffer.h similarity index 90% rename from wifi/1.6/default/ringbuffer.h rename to wifi/aidl/default/ringbuffer.h index c6a1e4c52d..80c0c11045 100644 --- a/wifi/1.6/default/ringbuffer.h +++ b/wifi/aidl/default/ringbuffer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -20,11 +20,10 @@ #include #include +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { /** * Ringbuffer object used to store debug data. @@ -53,10 +52,9 @@ class Ringbuffer { size_t maxSize_; }; -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl #endif // RINGBUFFER_H_ diff --git a/wifi/aidl/default/service.cpp b/wifi/aidl/default/service.cpp new file mode 100644 index 0000000000..789a7a5868 --- /dev/null +++ b/wifi/aidl/default/service.cpp @@ -0,0 +1,73 @@ +/* + * 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. + */ + +#include +#include +#include +#include + +#include "wifi.h" +#include "wifi_feature_flags.h" +#include "wifi_legacy_hal.h" +#include "wifi_legacy_hal_factory.h" +#include "wifi_mode_controller.h" + +using aidl::android::hardware::wifi::feature_flags::WifiFeatureFlags; +using aidl::android::hardware::wifi::legacy_hal::WifiLegacyHal; +using aidl::android::hardware::wifi::legacy_hal::WifiLegacyHalFactory; +using aidl::android::hardware::wifi::mode_controller::WifiModeController; + +#ifdef LAZY_SERVICE +const bool kLazyService = true; +#else +const bool kLazyService = false; +#endif + +int main(int /*argc*/, char** argv) { + signal(SIGPIPE, SIG_IGN); + android::base::InitLogging(argv, android::base::LogdLogger(android::base::SYSTEM)); + LOG(INFO) << "Wifi Hal is booting up..."; + + // Prepare the RPC-serving thread pool. Allocate 1 thread in the pool, + // which our main thread will join below. + ABinderProcess_setThreadPoolMaxThreadCount(1); + + const auto iface_tool = std::make_shared<::android::wifi_system::InterfaceTool>(); + const auto legacy_hal_factory = std::make_shared(iface_tool); + + // Setup binder service + std::shared_ptr service = + ndk::SharedRefBase::make( + iface_tool, legacy_hal_factory, std::make_shared(), + std::make_shared()); + std::string instance = + std::string() + aidl::android::hardware::wifi::Wifi::descriptor + "/default"; + if (kLazyService) { + auto result = + AServiceManager_registerLazyService(service->asBinder().get(), instance.c_str()); + CHECK_EQ(result, STATUS_OK) << "Failed to register lazy wifi HAL"; + } else { + auto result = AServiceManager_addService(service->asBinder().get(), instance.c_str()); + CHECK_EQ(result, STATUS_OK) << "Failed to register wifi HAL"; + } + + ABinderProcess_startThreadPool(); + LOG(INFO) << "Joining RPC thread pool"; + ABinderProcess_joinThreadPool(); + + LOG(INFO) << "Wifi Hal is terminating..."; + return 0; +} diff --git a/wifi/1.6/default/tests/hidl_struct_util_unit_tests.cpp b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp similarity index 69% rename from wifi/1.6/default/tests/hidl_struct_util_unit_tests.cpp rename to wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp index 0dd0aa15bb..4a69c2426b 100644 --- a/wifi/1.6/default/tests/hidl_struct_util_unit_tests.cpp +++ b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017, The Android Open Source Project + * 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. @@ -18,8 +18,7 @@ #include #include -#undef NAN -#include "hidl_struct_util.h" +#include "aidl_struct_util.h" using testing::Test; @@ -31,17 +30,15 @@ constexpr uint32_t kIfaceChannel2 = 5; constexpr char kIfaceName1[] = "wlan0"; constexpr char kIfaceName2[] = "wlan1"; } // namespace + +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { -using namespace android::hardware::wifi::V1_0; -using ::android::hardware::wifi::V1_6::WifiChannelWidthInMhz; -class HidlStructUtilTest : public Test {}; +class AidlStructUtilTest : public Test {}; -TEST_F(HidlStructUtilTest, CanConvertLegacyWifiMacInfosToHidlWithOneMac) { +TEST_F(AidlStructUtilTest, CanConvertLegacyWifiMacInfosToAidlWithOneMac) { std::vector legacy_mac_infos; legacy_hal::WifiMacInfo legacy_mac_info1 = { .wlan_mac_id = kMacId1, @@ -52,24 +49,24 @@ TEST_F(HidlStructUtilTest, CanConvertLegacyWifiMacInfosToHidlWithOneMac) { legacy_mac_info1.iface_infos.push_back(legacy_iface_info2); legacy_mac_infos.push_back(legacy_mac_info1); - std::vector hidl_radio_mode_infos; - ASSERT_TRUE(hidl_struct_util::convertLegacyWifiMacInfosToHidl(legacy_mac_infos, - &hidl_radio_mode_infos)); + std::vector aidl_radio_mode_infos; + ASSERT_TRUE(aidl_struct_util::convertLegacyWifiMacInfosToAidl(legacy_mac_infos, + &aidl_radio_mode_infos)); - ASSERT_EQ(1u, hidl_radio_mode_infos.size()); - auto hidl_radio_mode_info1 = hidl_radio_mode_infos[0]; - EXPECT_EQ(legacy_mac_info1.wlan_mac_id, hidl_radio_mode_info1.radioId); - EXPECT_EQ(V1_4::WifiBand::BAND_24GHZ_5GHZ, hidl_radio_mode_info1.bandInfo); - ASSERT_EQ(2u, hidl_radio_mode_info1.ifaceInfos.size()); - auto hidl_iface_info1 = hidl_radio_mode_info1.ifaceInfos[0]; - EXPECT_EQ(legacy_iface_info1.name, hidl_iface_info1.name); - EXPECT_EQ(static_cast(legacy_iface_info1.channel), hidl_iface_info1.channel); - auto hidl_iface_info2 = hidl_radio_mode_info1.ifaceInfos[1]; - EXPECT_EQ(legacy_iface_info2.name, hidl_iface_info2.name); - EXPECT_EQ(static_cast(legacy_iface_info2.channel), hidl_iface_info2.channel); + ASSERT_EQ(1u, aidl_radio_mode_infos.size()); + auto aidl_radio_mode_info1 = aidl_radio_mode_infos[0]; + EXPECT_EQ(legacy_mac_info1.wlan_mac_id, (uint32_t)aidl_radio_mode_info1.radioId); + EXPECT_EQ(WifiBand::BAND_24GHZ_5GHZ, aidl_radio_mode_info1.bandInfo); + ASSERT_EQ(2u, aidl_radio_mode_info1.ifaceInfos.size()); + auto aidl_iface_info1 = aidl_radio_mode_info1.ifaceInfos[0]; + EXPECT_EQ(legacy_iface_info1.name, aidl_iface_info1.name); + EXPECT_EQ(static_cast(legacy_iface_info1.channel), aidl_iface_info1.channel); + auto aidl_iface_info2 = aidl_radio_mode_info1.ifaceInfos[1]; + EXPECT_EQ(legacy_iface_info2.name, aidl_iface_info2.name); + EXPECT_EQ(static_cast(legacy_iface_info2.channel), aidl_iface_info2.channel); } -TEST_F(HidlStructUtilTest, CanConvertLegacyWifiMacInfosToHidlWithTwoMac) { +TEST_F(AidlStructUtilTest, CanConvertLegacyWifiMacInfosToAidlWithTwoMac) { std::vector legacy_mac_infos; legacy_hal::WifiMacInfo legacy_mac_info1 = {.wlan_mac_id = kMacId1, .mac_band = legacy_hal::WLAN_MAC_5_0_BAND}; @@ -82,40 +79,40 @@ TEST_F(HidlStructUtilTest, CanConvertLegacyWifiMacInfosToHidlWithTwoMac) { legacy_mac_info2.iface_infos.push_back(legacy_iface_info2); legacy_mac_infos.push_back(legacy_mac_info2); - std::vector hidl_radio_mode_infos; - ASSERT_TRUE(hidl_struct_util::convertLegacyWifiMacInfosToHidl(legacy_mac_infos, - &hidl_radio_mode_infos)); + std::vector aidl_radio_mode_infos; + ASSERT_TRUE(aidl_struct_util::convertLegacyWifiMacInfosToAidl(legacy_mac_infos, + &aidl_radio_mode_infos)); - ASSERT_EQ(2u, hidl_radio_mode_infos.size()); + ASSERT_EQ(2u, aidl_radio_mode_infos.size()); // Find mac info 1. - const auto hidl_radio_mode_info1 = - std::find_if(hidl_radio_mode_infos.begin(), hidl_radio_mode_infos.end(), - [&legacy_mac_info1](const V1_4::IWifiChipEventCallback::RadioModeInfo& x) { - return x.radioId == legacy_mac_info1.wlan_mac_id; + const auto aidl_radio_mode_info1 = + std::find_if(aidl_radio_mode_infos.begin(), aidl_radio_mode_infos.end(), + [&legacy_mac_info1](const IWifiChipEventCallback::RadioModeInfo& x) { + return (uint32_t)x.radioId == legacy_mac_info1.wlan_mac_id; }); - ASSERT_NE(hidl_radio_mode_infos.end(), hidl_radio_mode_info1); - EXPECT_EQ(V1_4::WifiBand::BAND_5GHZ, hidl_radio_mode_info1->bandInfo); - ASSERT_EQ(1u, hidl_radio_mode_info1->ifaceInfos.size()); - auto hidl_iface_info1 = hidl_radio_mode_info1->ifaceInfos[0]; - EXPECT_EQ(legacy_iface_info1.name, hidl_iface_info1.name); - EXPECT_EQ(static_cast(legacy_iface_info1.channel), hidl_iface_info1.channel); + ASSERT_NE(aidl_radio_mode_infos.end(), aidl_radio_mode_info1); + EXPECT_EQ(WifiBand::BAND_5GHZ, aidl_radio_mode_info1->bandInfo); + ASSERT_EQ(1u, aidl_radio_mode_info1->ifaceInfos.size()); + auto aidl_iface_info1 = aidl_radio_mode_info1->ifaceInfos[0]; + EXPECT_EQ(legacy_iface_info1.name, aidl_iface_info1.name); + EXPECT_EQ(static_cast(legacy_iface_info1.channel), aidl_iface_info1.channel); // Find mac info 2. - const auto hidl_radio_mode_info2 = - std::find_if(hidl_radio_mode_infos.begin(), hidl_radio_mode_infos.end(), - [&legacy_mac_info2](const V1_4::IWifiChipEventCallback::RadioModeInfo& x) { - return x.radioId == legacy_mac_info2.wlan_mac_id; + const auto aidl_radio_mode_info2 = + std::find_if(aidl_radio_mode_infos.begin(), aidl_radio_mode_infos.end(), + [&legacy_mac_info2](const IWifiChipEventCallback::RadioModeInfo& x) { + return (uint32_t)x.radioId == legacy_mac_info2.wlan_mac_id; }); - ASSERT_NE(hidl_radio_mode_infos.end(), hidl_radio_mode_info2); - EXPECT_EQ(V1_4::WifiBand::BAND_24GHZ, hidl_radio_mode_info2->bandInfo); - ASSERT_EQ(1u, hidl_radio_mode_info2->ifaceInfos.size()); - auto hidl_iface_info2 = hidl_radio_mode_info2->ifaceInfos[0]; - EXPECT_EQ(legacy_iface_info2.name, hidl_iface_info2.name); - EXPECT_EQ(static_cast(legacy_iface_info2.channel), hidl_iface_info2.channel); + ASSERT_NE(aidl_radio_mode_infos.end(), aidl_radio_mode_info2); + EXPECT_EQ(WifiBand::BAND_24GHZ, aidl_radio_mode_info2->bandInfo); + ASSERT_EQ(1u, aidl_radio_mode_info2->ifaceInfos.size()); + auto aidl_iface_info2 = aidl_radio_mode_info2->ifaceInfos[0]; + EXPECT_EQ(legacy_iface_info2.name, aidl_iface_info2.name); + EXPECT_EQ(static_cast(legacy_iface_info2.channel), aidl_iface_info2.channel); } -TEST_F(HidlStructUtilTest, canConvertLegacyLinkLayerStatsToHidl) { +TEST_F(AidlStructUtilTest, canConvertLegacyLinkLayerStatsToAidl) { legacy_hal::LinkLayerStats legacy_stats{}; legacy_stats.radios.push_back(legacy_hal::LinkLayerRadioStats{}); legacy_stats.radios.push_back(legacy_hal::LinkLayerRadioStats{}); @@ -216,77 +213,77 @@ TEST_F(HidlStructUtilTest, canConvertLegacyLinkLayerStatsToHidl) { peer.rate_stats.push_back(rate_stat2); } - V1_6::StaLinkLayerStats converted{}; - hidl_struct_util::convertLegacyLinkLayerStatsToHidl(legacy_stats, &converted); - EXPECT_EQ(legacy_stats.iface.beacon_rx, converted.iface.V1_0.beaconRx); - EXPECT_EQ(legacy_stats.iface.rssi_mgmt, converted.iface.V1_0.avgRssiMgmt); + StaLinkLayerStats converted{}; + aidl_struct_util::convertLegacyLinkLayerStatsToAidl(legacy_stats, &converted); + EXPECT_EQ(legacy_stats.iface.beacon_rx, (uint32_t)converted.iface.beaconRx); + EXPECT_EQ(legacy_stats.iface.rssi_mgmt, converted.iface.avgRssiMgmt); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].rx_mpdu, - converted.iface.V1_0.wmeBePktStats.rxMpdu); + converted.iface.wmeBePktStats.rxMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].tx_mpdu, - converted.iface.V1_0.wmeBePktStats.txMpdu); + converted.iface.wmeBePktStats.txMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].mpdu_lost, - converted.iface.V1_0.wmeBePktStats.lostMpdu); + converted.iface.wmeBePktStats.lostMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].retries, - converted.iface.V1_0.wmeBePktStats.retries); + converted.iface.wmeBePktStats.retries); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_min, - converted.iface.wmeBeContentionTimeStats.contentionTimeMinInUsec); + (uint32_t)converted.iface.wmeBeContentionTimeStats.contentionTimeMinInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_max, - converted.iface.wmeBeContentionTimeStats.contentionTimeMaxInUsec); + (uint32_t)converted.iface.wmeBeContentionTimeStats.contentionTimeMaxInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_avg, - converted.iface.wmeBeContentionTimeStats.contentionTimeAvgInUsec); + (uint32_t)converted.iface.wmeBeContentionTimeStats.contentionTimeAvgInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_num_samples, - converted.iface.wmeBeContentionTimeStats.contentionNumSamples); + (uint32_t)converted.iface.wmeBeContentionTimeStats.contentionNumSamples); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].rx_mpdu, - converted.iface.V1_0.wmeBkPktStats.rxMpdu); + converted.iface.wmeBkPktStats.rxMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].tx_mpdu, - converted.iface.V1_0.wmeBkPktStats.txMpdu); + converted.iface.wmeBkPktStats.txMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].mpdu_lost, - converted.iface.V1_0.wmeBkPktStats.lostMpdu); + converted.iface.wmeBkPktStats.lostMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].retries, - converted.iface.V1_0.wmeBkPktStats.retries); + converted.iface.wmeBkPktStats.retries); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_min, - converted.iface.wmeBkContentionTimeStats.contentionTimeMinInUsec); + (uint32_t)converted.iface.wmeBkContentionTimeStats.contentionTimeMinInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_max, - converted.iface.wmeBkContentionTimeStats.contentionTimeMaxInUsec); + (uint32_t)converted.iface.wmeBkContentionTimeStats.contentionTimeMaxInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_avg, - converted.iface.wmeBkContentionTimeStats.contentionTimeAvgInUsec); + (uint32_t)converted.iface.wmeBkContentionTimeStats.contentionTimeAvgInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_num_samples, - converted.iface.wmeBkContentionTimeStats.contentionNumSamples); + (uint32_t)converted.iface.wmeBkContentionTimeStats.contentionNumSamples); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].rx_mpdu, - converted.iface.V1_0.wmeViPktStats.rxMpdu); + converted.iface.wmeViPktStats.rxMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].tx_mpdu, - converted.iface.V1_0.wmeViPktStats.txMpdu); + converted.iface.wmeViPktStats.txMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].mpdu_lost, - converted.iface.V1_0.wmeViPktStats.lostMpdu); + converted.iface.wmeViPktStats.lostMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].retries, - converted.iface.V1_0.wmeViPktStats.retries); + converted.iface.wmeViPktStats.retries); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_min, - converted.iface.wmeViContentionTimeStats.contentionTimeMinInUsec); + (uint32_t)converted.iface.wmeViContentionTimeStats.contentionTimeMinInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_max, - converted.iface.wmeViContentionTimeStats.contentionTimeMaxInUsec); + (uint32_t)converted.iface.wmeViContentionTimeStats.contentionTimeMaxInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_avg, - converted.iface.wmeViContentionTimeStats.contentionTimeAvgInUsec); + (uint32_t)converted.iface.wmeViContentionTimeStats.contentionTimeAvgInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_num_samples, - converted.iface.wmeViContentionTimeStats.contentionNumSamples); + (uint32_t)converted.iface.wmeViContentionTimeStats.contentionNumSamples); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].rx_mpdu, - converted.iface.V1_0.wmeVoPktStats.rxMpdu); + converted.iface.wmeVoPktStats.rxMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].tx_mpdu, - converted.iface.V1_0.wmeVoPktStats.txMpdu); + converted.iface.wmeVoPktStats.txMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].mpdu_lost, - converted.iface.V1_0.wmeVoPktStats.lostMpdu); + converted.iface.wmeVoPktStats.lostMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].retries, - converted.iface.V1_0.wmeVoPktStats.retries); + converted.iface.wmeVoPktStats.retries); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_min, - converted.iface.wmeVoContentionTimeStats.contentionTimeMinInUsec); + (uint32_t)converted.iface.wmeVoContentionTimeStats.contentionTimeMinInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_max, - converted.iface.wmeVoContentionTimeStats.contentionTimeMaxInUsec); + (uint32_t)converted.iface.wmeVoContentionTimeStats.contentionTimeMaxInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_avg, - converted.iface.wmeVoContentionTimeStats.contentionTimeAvgInUsec); + (uint32_t)converted.iface.wmeVoContentionTimeStats.contentionTimeAvgInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_num_samples, - converted.iface.wmeVoContentionTimeStats.contentionNumSamples); + (uint32_t)converted.iface.wmeVoContentionTimeStats.contentionNumSamples); EXPECT_EQ(legacy_stats.iface.info.time_slicing_duty_cycle_percent, converted.iface.timeSliceDutyCycleInPercent); @@ -294,42 +291,43 @@ TEST_F(HidlStructUtilTest, canConvertLegacyLinkLayerStatsToHidl) { EXPECT_EQ(legacy_stats.radios.size(), converted.radios.size()); for (size_t i = 0; i < legacy_stats.radios.size(); i++) { EXPECT_EQ(legacy_stats.radios[i].stats.radio, converted.radios[i].radioId); - EXPECT_EQ(legacy_stats.radios[i].stats.on_time, converted.radios[i].V1_0.onTimeInMs); - EXPECT_EQ(legacy_stats.radios[i].stats.tx_time, converted.radios[i].V1_0.txTimeInMs); - EXPECT_EQ(legacy_stats.radios[i].stats.rx_time, converted.radios[i].V1_0.rxTimeInMs); + EXPECT_EQ(legacy_stats.radios[i].stats.on_time, (uint32_t)converted.radios[i].onTimeInMs); + EXPECT_EQ(legacy_stats.radios[i].stats.tx_time, (uint32_t)converted.radios[i].txTimeInMs); + EXPECT_EQ(legacy_stats.radios[i].stats.rx_time, (uint32_t)converted.radios[i].rxTimeInMs); EXPECT_EQ(legacy_stats.radios[i].stats.on_time_scan, - converted.radios[i].V1_0.onTimeInMsForScan); + (uint32_t)converted.radios[i].onTimeInMsForScan); EXPECT_EQ(legacy_stats.radios[i].tx_time_per_levels.size(), - converted.radios[i].V1_0.txTimeInMsPerLevel.size()); + converted.radios[i].txTimeInMsPerLevel.size()); for (size_t j = 0; j < legacy_stats.radios[i].tx_time_per_levels.size(); j++) { EXPECT_EQ(legacy_stats.radios[i].tx_time_per_levels[j], - converted.radios[i].V1_0.txTimeInMsPerLevel[j]); + (uint32_t)converted.radios[i].txTimeInMsPerLevel[j]); } EXPECT_EQ(legacy_stats.radios[i].stats.on_time_nbd, - converted.radios[i].onTimeInMsForNanScan); + (uint32_t)converted.radios[i].onTimeInMsForNanScan); EXPECT_EQ(legacy_stats.radios[i].stats.on_time_gscan, - converted.radios[i].onTimeInMsForBgScan); + (uint32_t)converted.radios[i].onTimeInMsForBgScan); EXPECT_EQ(legacy_stats.radios[i].stats.on_time_roam_scan, - converted.radios[i].onTimeInMsForRoamScan); + (uint32_t)converted.radios[i].onTimeInMsForRoamScan); EXPECT_EQ(legacy_stats.radios[i].stats.on_time_pno_scan, - converted.radios[i].onTimeInMsForPnoScan); + (uint32_t)converted.radios[i].onTimeInMsForPnoScan); EXPECT_EQ(legacy_stats.radios[i].stats.on_time_hs20, - converted.radios[i].onTimeInMsForHs20Scan); + (uint32_t)converted.radios[i].onTimeInMsForHs20Scan); EXPECT_EQ(legacy_stats.radios[i].channel_stats.size(), converted.radios[i].channelStats.size()); for (size_t k = 0; k < legacy_stats.radios[i].channel_stats.size(); k++) { auto& legacy_channel_st = legacy_stats.radios[i].channel_stats[k]; EXPECT_EQ(WifiChannelWidthInMhz::WIDTH_20, converted.radios[i].channelStats[k].channel.width); - EXPECT_EQ(WifiChannelInMhz(legacy_channel_st.channel.center_freq), + EXPECT_EQ(legacy_channel_st.channel.center_freq, converted.radios[i].channelStats[k].channel.centerFreq); - EXPECT_EQ(WifiChannelInMhz(legacy_channel_st.channel.center_freq0), + EXPECT_EQ(legacy_channel_st.channel.center_freq0, converted.radios[i].channelStats[k].channel.centerFreq0); - EXPECT_EQ(WifiChannelInMhz(legacy_channel_st.channel.center_freq1), + EXPECT_EQ(legacy_channel_st.channel.center_freq1, converted.radios[i].channelStats[k].channel.centerFreq1); EXPECT_EQ(legacy_channel_st.cca_busy_time, - converted.radios[i].channelStats[k].ccaBusyTimeInMs); - EXPECT_EQ(legacy_channel_st.on_time, converted.radios[i].channelStats[k].onTimeInMs); + (uint32_t)converted.radios[i].channelStats[k].ccaBusyTimeInMs); + EXPECT_EQ(legacy_channel_st.on_time, + (uint32_t)converted.radios[i].channelStats[k].onTimeInMs); } } @@ -347,35 +345,36 @@ TEST_F(HidlStructUtilTest, canConvertLegacyLinkLayerStatsToHidl) { EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].rate.bw, (uint32_t)converted.iface.peers[i].rateStats[j].rateInfo.bw); EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].rate.rateMcsIdx, - converted.iface.peers[i].rateStats[j].rateInfo.rateMcsIdx); + (uint32_t)converted.iface.peers[i].rateStats[j].rateInfo.rateMcsIdx); EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].tx_mpdu, - converted.iface.peers[i].rateStats[j].txMpdu); + (uint32_t)converted.iface.peers[i].rateStats[j].txMpdu); EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].rx_mpdu, - converted.iface.peers[i].rateStats[j].rxMpdu); + (uint32_t)converted.iface.peers[i].rateStats[j].rxMpdu); EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].mpdu_lost, - converted.iface.peers[i].rateStats[j].mpduLost); + (uint32_t)converted.iface.peers[i].rateStats[j].mpduLost); EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].retries, - converted.iface.peers[i].rateStats[j].retries); + (uint32_t)converted.iface.peers[i].rateStats[j].retries); } } } -TEST_F(HidlStructUtilTest, CanConvertLegacyFeaturesToHidl) { - using HidlChipCaps = V1_3::IWifiChip::ChipCapabilityMask; +TEST_F(AidlStructUtilTest, CanConvertLegacyFeaturesToAidl) { + using AidlChipCaps = IWifiChip::ChipCapabilityMask; - uint32_t hidle_caps; + uint32_t aidl_caps; uint32_t legacy_feature_set = WIFI_FEATURE_D2D_RTT | WIFI_FEATURE_SET_LATENCY_MODE; uint32_t legacy_logger_feature_set = legacy_hal::WIFI_LOGGER_DRIVER_DUMP_SUPPORTED; - ASSERT_TRUE(hidl_struct_util::convertLegacyFeaturesToHidlChipCapabilities( - legacy_feature_set, legacy_logger_feature_set, &hidle_caps)); + ASSERT_TRUE(aidl_struct_util::convertLegacyFeaturesToAidlChipCapabilities( + legacy_feature_set, legacy_logger_feature_set, &aidl_caps)); - EXPECT_EQ(HidlChipCaps::DEBUG_RING_BUFFER_VENDOR_DATA | - HidlChipCaps::DEBUG_HOST_WAKE_REASON_STATS | - HidlChipCaps::DEBUG_ERROR_ALERTS | HidlChipCaps::D2D_RTT | - HidlChipCaps::SET_LATENCY_MODE | HidlChipCaps::DEBUG_MEMORY_DRIVER_DUMP, - hidle_caps); + EXPECT_EQ((uint32_t)AidlChipCaps::DEBUG_RING_BUFFER_VENDOR_DATA | + (uint32_t)AidlChipCaps::DEBUG_HOST_WAKE_REASON_STATS | + (uint32_t)AidlChipCaps::DEBUG_ERROR_ALERTS | (uint32_t)AidlChipCaps::D2D_RTT | + (uint32_t)AidlChipCaps::SET_LATENCY_MODE | + (uint32_t)AidlChipCaps::DEBUG_MEMORY_DRIVER_DUMP, + aidl_caps); } void insertRadioCombination(legacy_hal::wifi_radio_combination* dst_radio_combination_ptr, @@ -390,16 +389,16 @@ void verifyRadioCombination(WifiRadioCombination* radioCombination, size_t num_r legacy_hal::wifi_radio_configuration* radio_configuration) { EXPECT_EQ(num_radio_configurations, radioCombination->radioConfigurations.size()); for (size_t i = 0; i < num_radio_configurations; i++) { - EXPECT_EQ(hidl_struct_util::convertLegacyMacBandToHidlWifiBand(radio_configuration->band), + EXPECT_EQ(aidl_struct_util::convertLegacyMacBandToAidlWifiBand(radio_configuration->band), radioCombination->radioConfigurations[i].bandInfo); - EXPECT_EQ(hidl_struct_util::convertLegacyAntennaConfigurationToHidl( + EXPECT_EQ(aidl_struct_util::convertLegacyAntennaConfigurationToAidl( radio_configuration->antenna_cfg), radioCombination->radioConfigurations[i].antennaMode); radio_configuration++; } } -TEST_F(HidlStructUtilTest, canConvertLegacyRadioCombinationsMatrixToHidl) { +TEST_F(AidlStructUtilTest, canConvertLegacyRadioCombinationsMatrixToAidl) { legacy_hal::wifi_radio_configuration radio_configurations_array1[] = { {.band = legacy_hal::WLAN_MAC_2_4_BAND, .antenna_cfg = legacy_hal::WIFI_ANTENNA_1X1}, }; @@ -461,8 +460,8 @@ TEST_F(HidlStructUtilTest, canConvertLegacyRadioCombinationsMatrixToHidl) { sizeof(radio_configurations_array3) / sizeof(radio_configurations_array3[0]), radio_configurations_array3); - V1_6::WifiRadioCombinationMatrix converted_matrix{}; - hidl_struct_util::convertLegacyRadioCombinationsMatrixToHidl(legacy_matrix, &converted_matrix); + WifiRadioCombinationMatrix converted_matrix{}; + aidl_struct_util::convertLegacyRadioCombinationsMatrixToAidl(legacy_matrix, &converted_matrix); // Verify the conversion EXPECT_EQ(legacy_matrix->num_radio_combinations, converted_matrix.radioCombinations.size()); @@ -479,8 +478,8 @@ TEST_F(HidlStructUtilTest, canConvertLegacyRadioCombinationsMatrixToHidl) { sizeof(radio_configurations_array3) / sizeof(radio_configurations_array3[0]), radio_configurations_array3); } -} // namespace implementation -} // namespace V1_6 + } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl diff --git a/wifi/1.6/default/tests/main.cpp b/wifi/aidl/default/tests/main.cpp similarity index 94% rename from wifi/1.6/default/tests/main.cpp rename to wifi/aidl/default/tests/main.cpp index 9aac837242..767422c408 100644 --- a/wifi/1.6/default/tests/main.cpp +++ b/wifi/aidl/default/tests/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * 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. diff --git a/wifi/1.6/default/tests/mock_interface_tool.cpp b/wifi/aidl/default/tests/mock_interface_tool.cpp similarity index 86% rename from wifi/1.6/default/tests/mock_interface_tool.cpp rename to wifi/aidl/default/tests/mock_interface_tool.cpp index b99a16446c..79f3d1e638 100644 --- a/wifi/1.6/default/tests/mock_interface_tool.cpp +++ b/wifi/aidl/default/tests/mock_interface_tool.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 The Android Open Source Project + * 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. @@ -17,7 +17,6 @@ #include #include -#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 #include "mock_interface_tool.h" namespace android { diff --git a/wifi/1.6/default/tests/mock_interface_tool.h b/wifi/aidl/default/tests/mock_interface_tool.h similarity index 96% rename from wifi/1.6/default/tests/mock_interface_tool.h rename to wifi/aidl/default/tests/mock_interface_tool.h index 7ce3992c7e..9795de8014 100644 --- a/wifi/1.6/default/tests/mock_interface_tool.h +++ b/wifi/aidl/default/tests/mock_interface_tool.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 The Android Open Source Project + * 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. diff --git a/wifi/1.6/default/tests/mock_wifi_feature_flags.cpp b/wifi/aidl/default/tests/mock_wifi_feature_flags.cpp similarity index 85% rename from wifi/1.6/default/tests/mock_wifi_feature_flags.cpp rename to wifi/aidl/default/tests/mock_wifi_feature_flags.cpp index d10b74c3a0..0c4e59deb3 100644 --- a/wifi/1.6/default/tests/mock_wifi_feature_flags.cpp +++ b/wifi/aidl/default/tests/mock_wifi_feature_flags.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * 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. @@ -18,18 +18,16 @@ #include "mock_wifi_feature_flags.h" +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { namespace feature_flags { MockWifiFeatureFlags::MockWifiFeatureFlags() {} } // namespace feature_flags -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl diff --git a/wifi/1.6/default/tests/mock_wifi_feature_flags.h b/wifi/aidl/default/tests/mock_wifi_feature_flags.h similarity index 77% rename from wifi/1.6/default/tests/mock_wifi_feature_flags.h rename to wifi/aidl/default/tests/mock_wifi_feature_flags.h index fbe1f7a5ac..9143d15d61 100644 --- a/wifi/1.6/default/tests/mock_wifi_feature_flags.h +++ b/wifi/aidl/default/tests/mock_wifi_feature_flags.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * 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. @@ -18,30 +18,27 @@ #define MOCK_WIFI_FEATURE_FLAGS_H_ #include -#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 #include "wifi_feature_flags.h" +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { namespace feature_flags { class MockWifiFeatureFlags : public WifiFeatureFlags { public: MockWifiFeatureFlags(); - MOCK_METHOD1(getChipModes, std::vector(bool is_primary)); + MOCK_METHOD1(getChipModes, std::vector(bool is_primary)); MOCK_METHOD0(isApMacRandomizationDisabled, bool()); }; } // namespace feature_flags -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl #endif // MOCK_WIFI_FEATURE_FLAGS_H_ diff --git a/wifi/1.6/default/tests/mock_wifi_iface_util.cpp b/wifi/aidl/default/tests/mock_wifi_iface_util.cpp similarity index 68% rename from wifi/1.6/default/tests/mock_wifi_iface_util.cpp rename to wifi/aidl/default/tests/mock_wifi_iface_util.cpp index 24b16cb469..0f787f22b2 100644 --- a/wifi/1.6/default/tests/mock_wifi_iface_util.cpp +++ b/wifi/aidl/default/tests/mock_wifi_iface_util.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 The Android Open Source Project + * 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. @@ -18,22 +18,21 @@ #include #include -#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 #include "mock_wifi_iface_util.h" +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { namespace iface_util { -MockWifiIfaceUtil::MockWifiIfaceUtil(const std::weak_ptr iface_tool, - const std::weak_ptr legacy_hal) +MockWifiIfaceUtil::MockWifiIfaceUtil( + const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, + const std::weak_ptr legacy_hal) : WifiIfaceUtil(iface_tool, legacy_hal) {} + } // namespace iface_util -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl diff --git a/wifi/1.6/default/tests/mock_wifi_iface_util.h b/wifi/aidl/default/tests/mock_wifi_iface_util.h similarity index 79% rename from wifi/1.6/default/tests/mock_wifi_iface_util.h rename to wifi/aidl/default/tests/mock_wifi_iface_util.h index 2701c36d76..49a8636345 100644 --- a/wifi/1.6/default/tests/mock_wifi_iface_util.h +++ b/wifi/aidl/default/tests/mock_wifi_iface_util.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 The Android Open Source Project + * 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. @@ -21,30 +21,30 @@ #include "wifi_iface_util.h" +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { namespace iface_util { -class MockWifiIfaceUtil : public WifiIfaceUtil { +class MockWifiIfaceUtil : public iface_util::WifiIfaceUtil { public: - MockWifiIfaceUtil(const std::weak_ptr iface_tool, + MockWifiIfaceUtil(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, const std::weak_ptr legacy_hal); MOCK_METHOD1(getFactoryMacAddress, std::array(const std::string&)); MOCK_METHOD2(setMacAddress, bool(const std::string&, const std::array&)); MOCK_METHOD0(getOrCreateRandomMacAddress, std::array()); - MOCK_METHOD2(registerIfaceEventHandlers, void(const std::string&, IfaceEventHandlers)); + MOCK_METHOD2(registerIfaceEventHandlers, + void(const std::string&, iface_util::IfaceEventHandlers)); MOCK_METHOD1(unregisterIfaceEventHandlers, void(const std::string&)); MOCK_METHOD2(setUpState, bool(const std::string&, bool)); MOCK_METHOD1(ifNameToIndex, unsigned(const std::string&)); }; + } // namespace iface_util -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl #endif // MOCK_WIFI_IFACE_UTIL_H_ diff --git a/wifi/1.6/default/tests/mock_wifi_legacy_hal.cpp b/wifi/aidl/default/tests/mock_wifi_legacy_hal.cpp similarity index 69% rename from wifi/1.6/default/tests/mock_wifi_legacy_hal.cpp rename to wifi/aidl/default/tests/mock_wifi_legacy_hal.cpp index 2c558612e3..33b2b1ce36 100644 --- a/wifi/1.6/default/tests/mock_wifi_legacy_hal.cpp +++ b/wifi/aidl/default/tests/mock_wifi_legacy_hal.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * 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. @@ -18,22 +18,20 @@ #include #include -#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 #include "mock_wifi_legacy_hal.h" +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { namespace legacy_hal { -MockWifiLegacyHal::MockWifiLegacyHal(const std::weak_ptr iface_tool, - const wifi_hal_fn& fn, bool is_primary) +MockWifiLegacyHal::MockWifiLegacyHal( + const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, + const wifi_hal_fn& fn, bool is_primary) : WifiLegacyHal(iface_tool, fn, is_primary) {} } // namespace legacy_hal -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl diff --git a/wifi/1.6/default/tests/mock_wifi_legacy_hal.h b/wifi/aidl/default/tests/mock_wifi_legacy_hal.h similarity index 92% rename from wifi/1.6/default/tests/mock_wifi_legacy_hal.h rename to wifi/aidl/default/tests/mock_wifi_legacy_hal.h index 85dbf0fe49..28129a9947 100644 --- a/wifi/1.6/default/tests/mock_wifi_legacy_hal.h +++ b/wifi/aidl/default/tests/mock_wifi_legacy_hal.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * 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. @@ -21,16 +21,15 @@ #include "wifi_legacy_hal.h" +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { namespace legacy_hal { class MockWifiLegacyHal : public WifiLegacyHal { public: - MockWifiLegacyHal(const std::weak_ptr iface_tool, + MockWifiLegacyHal(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, const wifi_hal_fn& fn, bool is_primary); MOCK_METHOD0(initialize, wifi_error()); MOCK_METHOD0(start, wifi_error()); @@ -62,10 +61,9 @@ class MockWifiLegacyHal : public WifiLegacyHal { MOCK_METHOD1(getSupportedFeatureSet, std::pair(const std::string&)); }; } // namespace legacy_hal -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl #endif // MOCK_WIFI_LEGACY_HAL_H_ diff --git a/wifi/1.6/default/tests/mock_wifi_mode_controller.cpp b/wifi/aidl/default/tests/mock_wifi_mode_controller.cpp similarity index 87% rename from wifi/1.6/default/tests/mock_wifi_mode_controller.cpp rename to wifi/aidl/default/tests/mock_wifi_mode_controller.cpp index 446f8296f8..f4cc4c4108 100644 --- a/wifi/1.6/default/tests/mock_wifi_mode_controller.cpp +++ b/wifi/aidl/default/tests/mock_wifi_mode_controller.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * 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. @@ -21,17 +21,16 @@ #undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 #include "mock_wifi_mode_controller.h" +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { namespace mode_controller { MockWifiModeController::MockWifiModeController() : WifiModeController() {} + } // namespace mode_controller -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl diff --git a/wifi/1.6/default/tests/mock_wifi_mode_controller.h b/wifi/aidl/default/tests/mock_wifi_mode_controller.h similarity index 89% rename from wifi/1.6/default/tests/mock_wifi_mode_controller.h rename to wifi/aidl/default/tests/mock_wifi_mode_controller.h index addcc81591..f77f7d0f96 100644 --- a/wifi/1.6/default/tests/mock_wifi_mode_controller.h +++ b/wifi/aidl/default/tests/mock_wifi_mode_controller.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * 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. @@ -21,11 +21,10 @@ #include "wifi_mode_controller.h" +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { namespace mode_controller { class MockWifiModeController : public WifiModeController { @@ -37,10 +36,9 @@ class MockWifiModeController : public WifiModeController { MOCK_METHOD0(deinitialize, bool()); }; } // namespace mode_controller -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl #endif // MOCK_WIFI_MODE_CONTROLLER_H_ diff --git a/wifi/1.6/default/tests/ringbuffer_unit_tests.cpp b/wifi/aidl/default/tests/ringbuffer_unit_tests.cpp similarity index 95% rename from wifi/1.6/default/tests/ringbuffer_unit_tests.cpp rename to wifi/aidl/default/tests/ringbuffer_unit_tests.cpp index eb86194ff0..c257100be9 100644 --- a/wifi/1.6/default/tests/ringbuffer_unit_tests.cpp +++ b/wifi/aidl/default/tests/ringbuffer_unit_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018, The Android Open Source Project + * 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. @@ -21,11 +21,10 @@ using testing::Return; using testing::Test; +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { class RingbufferTest : public Test { public: @@ -90,8 +89,8 @@ TEST_F(RingbufferTest, OversizedAppendDoesNotDropExistingData) { ASSERT_EQ(1u, buffer_.getData().size()); EXPECT_EQ(input, buffer_.getData().front()); } -} // namespace implementation -} // namespace V1_6 + } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl diff --git a/wifi/1.6/default/tests/runtests.sh b/wifi/aidl/default/tests/runtests.sh similarity index 79% rename from wifi/1.6/default/tests/runtests.sh rename to wifi/aidl/default/tests/runtests.sh index 6bce3ef8c4..1f53ab8e05 100755 --- a/wifi/1.6/default/tests/runtests.sh +++ b/wifi/aidl/default/tests/runtests.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright(C) 2017 The Android Open Source Project +# 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. @@ -20,7 +20,7 @@ if [ -z $ANDROID_BUILD_TOP ]; then fi set -e -$ANDROID_BUILD_TOP/build/soong/soong_ui.bash --make-mode android.hardware.wifi@1.0-service-tests +$ANDROID_BUILD_TOP/build/soong/soong_ui.bash --make-mode android.hardware.wifi-service-tests adb root adb sync data -adb shell /data/nativetest64/vendor/android.hardware.wifi@1.0-service-tests/android.hardware.wifi@1.0-service-tests +adb shell /data/nativetest64/vendor/android.hardware.wifi-service-tests/android.hardware.wifi-service-tests diff --git a/wifi/1.6/default/tests/wifi_chip_unit_tests.cpp b/wifi/aidl/default/tests/wifi_chip_unit_tests.cpp similarity index 66% rename from wifi/1.6/default/tests/wifi_chip_unit_tests.cpp rename to wifi/aidl/default/tests/wifi_chip_unit_tests.cpp index 81117c5e06..e66b650ded 100644 --- a/wifi/1.6/default/tests/wifi_chip_unit_tests.cpp +++ b/wifi/aidl/default/tests/wifi_chip_unit_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017, The Android Open Source Project + * 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. @@ -19,7 +19,6 @@ #include #include -#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 #include "wifi_chip.h" #include "mock_interface_tool.h" @@ -33,28 +32,38 @@ using testing::Return; using testing::Test; namespace { -using android::hardware::wifi::V1_0::ChipId; - -constexpr ChipId kFakeChipId = 5; +constexpr int kFakeChipId = 5; } // namespace +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { class WifiChipTest : public Test { protected: void setupV1IfaceCombination() { // clang-format off - const hidl_vec combinationsSta = { - {{{{IfaceConcurrencyType::STA}, 1}, {{IfaceConcurrencyType::P2P}, 1}}} + // 1 STA + 1 P2P + const std::vector combinationsSta = + { + { + { + {{IfaceConcurrencyType::STA}, 1}, + {{IfaceConcurrencyType::P2P}, 1} + } + } + }; + // 1 AP + const std::vector combinationsAp = + { + { + { + {{IfaceConcurrencyType::AP}, 1} + } + } }; - const hidl_vec combinationsAp = { - {{{{IfaceConcurrencyType::AP}, 1}}} - }; - const std::vector modes = { + const std::vector modes = { {feature_flags::chip_mode_ids::kV1Sta, combinationsSta}, {feature_flags::chip_mode_ids::kV1Ap, combinationsAp} }; @@ -64,14 +73,26 @@ class WifiChipTest : public Test { void setupV1_AwareIfaceCombination() { // clang-format off - const hidl_vec combinationsSta = { - {{{{IfaceConcurrencyType::STA}, 1}, - {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN}, 1}}} + // 1 STA + 1 of (P2P or NAN) + const std::vector combinationsSta = + { + { + { + {{IfaceConcurrencyType::STA}, 1}, + {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN_IFACE}, 1} + } + } }; - const hidl_vec combinationsAp = { - {{{{IfaceConcurrencyType::AP}, 1}}} + // 1 AP + const std::vector combinationsAp = + { + { + { + {{IfaceConcurrencyType::AP}, 1} + } + } }; - const std::vector modes = { + const std::vector modes = { {feature_flags::chip_mode_ids::kV1Sta, combinationsSta}, {feature_flags::chip_mode_ids::kV1Ap, combinationsAp} }; @@ -81,11 +102,17 @@ class WifiChipTest : public Test { void setupV1_AwareDisabledApIfaceCombination() { // clang-format off - const hidl_vec combinationsSta = { - {{{{IfaceConcurrencyType::STA}, 1}, - {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN}, 1}}} + // 1 STA + 1 of (P2P or NAN) + const std::vector combinationsSta = + { + { + { + {{IfaceConcurrencyType::STA}, 1}, + {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN_IFACE}, 1} + } + } }; - const std::vector modes = { + const std::vector modes = { {feature_flags::chip_mode_ids::kV1Sta, combinationsSta} }; // clang-format on @@ -94,12 +121,23 @@ class WifiChipTest : public Test { void setupV2_AwareIfaceCombination() { // clang-format off - const hidl_vec combinations = { - {{{{IfaceConcurrencyType::STA}, 1}, {{IfaceConcurrencyType::AP}, 1}}}, - {{{{IfaceConcurrencyType::STA}, 1}, - {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN}, 1}}} + // (1 STA + 1 AP) or (1 STA + 1 of (P2P or NAN)) + const std::vector combinations = + { + { + { + {{IfaceConcurrencyType::STA}, 1}, + {{IfaceConcurrencyType::AP}, 1} + } + }, + { + { + {{IfaceConcurrencyType::STA}, 1}, + {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN_IFACE}, 1} + } + } }; - const std::vector modes = { + const std::vector modes = { {feature_flags::chip_mode_ids::kV3, combinations} }; // clang-format on @@ -108,11 +146,17 @@ class WifiChipTest : public Test { void setupV2_AwareDisabledApIfaceCombination() { // clang-format off - const hidl_vec combinations = { - {{{{IfaceConcurrencyType::STA}, 1}, - {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN}, 1}}} + // 1 STA + 1 of (P2P or NAN) + const std::vector combinations = + { + { + { + {{IfaceConcurrencyType::STA}, 1}, + {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN_IFACE}, 1} + } + } }; - const std::vector modes = { + const std::vector modes = { {feature_flags::chip_mode_ids::kV3, combinations} }; // clang-format on @@ -121,10 +165,17 @@ class WifiChipTest : public Test { void setup_MultiIfaceCombination() { // clang-format off - const hidl_vec combinations = { - {{{{IfaceConcurrencyType::STA}, 3}, {{IfaceConcurrencyType::AP}, 1}}} + // 3 STA + 1 AP + const std::vector combinations = + { + { + { + {{IfaceConcurrencyType::STA}, 3}, + {{IfaceConcurrencyType::AP}, 1} + } + } }; - const std::vector modes = { + const std::vector modes = { {feature_flags::chip_mode_ids::kV3, combinations} }; // clang-format on @@ -132,134 +183,93 @@ class WifiChipTest : public Test { } void assertNumberOfModes(uint32_t num_modes) { - chip_->getAvailableModes_1_6([num_modes](const WifiStatus& status, - const std::vector& modes) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - // V2_Aware has 1 mode of operation. - ASSERT_EQ(num_modes, modes.size()); - }); + std::vector modes; + ASSERT_TRUE(chip_->getAvailableModes(&modes).isOk()); + // V2_Aware has 1 mode of operation. + ASSERT_EQ(num_modes, modes.size()); } void findModeAndConfigureForIfaceType(const IfaceConcurrencyType& type) { - // This should be aligned with kInvalidModeId in wifi_chip.cpp. - ChipModeId mode_id = UINT32_MAX; - chip_->getAvailableModes_1_6([&mode_id, &type]( - const WifiStatus& status, - const std::vector& modes) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - for (const auto& mode : modes) { - for (const auto& combination : mode.availableCombinations) { - for (const auto& limit : combination.limits) { - if (limit.types.end() != - std::find(limit.types.begin(), limit.types.end(), type)) { - mode_id = mode.id; - } + // This should be aligned with kInvalidModeId in wifi_chip.cpp + int32_t mode_id = INT32_MAX; + std::vector modes; + ASSERT_TRUE(chip_->getAvailableModes(&modes).isOk()); + + for (const auto& mode : modes) { + for (const auto& combination : mode.availableCombinations) { + for (const auto& limit : combination.limits) { + if (limit.types.end() != + std::find(limit.types.begin(), limit.types.end(), type)) { + mode_id = mode.id; } } } - }); - ASSERT_NE(UINT32_MAX, mode_id); + } - chip_->configureChip(mode_id, [](const WifiStatus& status) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - }); + ASSERT_NE(INT32_MAX, mode_id); + ASSERT_TRUE(chip_->configureChip(mode_id).isOk()); } // Returns an empty string on error. std::string createIface(const IfaceType& type) { std::string iface_name; if (type == IfaceType::AP) { - chip_->createApIface( - [&iface_name](const WifiStatus& status, const sp& iface) { - if (WifiStatusCode::SUCCESS == status.code) { - ASSERT_NE(iface.get(), nullptr); - iface->getName([&iface_name](const WifiStatus& status, - const hidl_string& name) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - iface_name = name.c_str(); - }); - } - }); - } else if (type == IfaceType::NAN) { - chip_->createNanIface( - [&iface_name](const WifiStatus& status, - const sp& iface) { - if (WifiStatusCode::SUCCESS == status.code) { - ASSERT_NE(iface.get(), nullptr); - iface->getName([&iface_name](const WifiStatus& status, - const hidl_string& name) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - iface_name = name.c_str(); - }); - } - }); + std::shared_ptr iface; + if (!chip_->createApIface(&iface).isOk()) { + return ""; + } + EXPECT_NE(iface.get(), nullptr); + EXPECT_TRUE(iface->getName(&iface_name).isOk()); + } else if (type == IfaceType::NAN_IFACE) { + std::shared_ptr iface; + if (!chip_->createNanIface(&iface).isOk()) { + return ""; + } + EXPECT_NE(iface.get(), nullptr); + EXPECT_TRUE(iface->getName(&iface_name).isOk()); } else if (type == IfaceType::P2P) { - chip_->createP2pIface( - [&iface_name](const WifiStatus& status, const sp& iface) { - if (WifiStatusCode::SUCCESS == status.code) { - ASSERT_NE(iface.get(), nullptr); - iface->getName([&iface_name](const WifiStatus& status, - const hidl_string& name) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - iface_name = name.c_str(); - }); - } - }); + std::shared_ptr iface; + if (!chip_->createP2pIface(&iface).isOk()) { + return ""; + } + EXPECT_NE(iface.get(), nullptr); + EXPECT_TRUE(iface->getName(&iface_name).isOk()); } else if (type == IfaceType::STA) { - chip_->createStaIface( - [&iface_name](const WifiStatus& status, const sp& iface) { - if (WifiStatusCode::SUCCESS == status.code) { - ASSERT_NE(iface.get(), nullptr); - iface->getName([&iface_name](const WifiStatus& status, - const hidl_string& name) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - iface_name = name.c_str(); - }); - } - }); + std::shared_ptr iface; + if (!chip_->createStaIface(&iface).isOk()) { + return ""; + } + EXPECT_NE(iface.get(), nullptr); + EXPECT_TRUE(iface->getName(&iface_name).isOk()); } return iface_name; } void removeIface(const IfaceType& type, const std::string& iface_name) { if (type == IfaceType::AP) { - chip_->removeApIface(iface_name, [](const WifiStatus& status) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - }); - } else if (type == IfaceType::NAN) { - chip_->removeNanIface(iface_name, [](const WifiStatus& status) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - }); + ASSERT_TRUE(chip_->removeApIface(iface_name).isOk()); + } else if (type == IfaceType::NAN_IFACE) { + ASSERT_TRUE(chip_->removeNanIface(iface_name).isOk()); } else if (type == IfaceType::P2P) { - chip_->removeP2pIface(iface_name, [](const WifiStatus& status) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - }); + ASSERT_TRUE(chip_->removeP2pIface(iface_name).isOk()); } else if (type == IfaceType::STA) { - chip_->removeStaIface(iface_name, [](const WifiStatus& status) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - }); + ASSERT_TRUE(chip_->removeStaIface(iface_name).isOk()); } } bool createRttController() { - bool success = false; - chip_->createRttController_1_6( - NULL, [&success](const WifiStatus& status, const sp& rtt) { - if (WifiStatusCode::SUCCESS == status.code) { - ASSERT_NE(rtt.get(), nullptr); - success = true; - } - }); - return success; + std::shared_ptr rtt_controller; + auto status = chip_->createRttController(nullptr, &rtt_controller); + return status.isOk(); } static void subsystemRestartHandler(const std::string& /*error*/) {} - sp chip_; - ChipId chip_id_ = kFakeChipId; + std::shared_ptr chip_; + int chip_id_ = kFakeChipId; legacy_hal::wifi_hal_fn fake_func_table_; - std::shared_ptr> iface_tool_{ - new NiceMock}; + std::shared_ptr> iface_tool_{ + new NiceMock<::android::wifi_system::MockInterfaceTool>}; std::shared_ptr> legacy_hal_{ new NiceMock(iface_tool_, fake_func_table_, true)}; std::shared_ptr> mode_controller_{ @@ -271,8 +281,8 @@ class WifiChipTest : public Test { public: void SetUp() override { - chip_ = new WifiChip(chip_id_, true, legacy_hal_, mode_controller_, iface_util_, - feature_flags_, subsystemRestartHandler); + chip_ = WifiChip::create(chip_id_, true, legacy_hal_, mode_controller_, iface_util_, + feature_flags_, subsystemRestartHandler); EXPECT_CALL(*mode_controller_, changeFirmwareMode(testing::_)) .WillRepeatedly(testing::Return(true)); @@ -301,7 +311,7 @@ class WifiChipV1IfaceCombinationTest : public WifiChipTest { setupV1IfaceCombination(); WifiChipTest::SetUp(); // V1 has 2 modes of operation. - assertNumberOfModes(2u); + assertNumberOfModes(2); } }; @@ -317,7 +327,7 @@ TEST_F(WifiChipV1IfaceCombinationTest, StaMode_CreateP2p_ShouldSucceed) { TEST_F(WifiChipV1IfaceCombinationTest, StaMode_CreateNan_ShouldFail) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_TRUE(createIface(IfaceType::NAN).empty()); + ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); } TEST_F(WifiChipV1IfaceCombinationTest, StaMode_CreateAp_ShouldFail) { @@ -348,7 +358,7 @@ TEST_F(WifiChipV1IfaceCombinationTest, ApMode_CreateP2p_ShouldFail) { TEST_F(WifiChipV1IfaceCombinationTest, ApMode_CreateNan_ShouldFail) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - ASSERT_TRUE(createIface(IfaceType::NAN).empty()); + ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); } ////////// V1 + Aware Iface Combinations //////////// @@ -376,7 +386,7 @@ TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateP2p_ShouldSucceed) { TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateNan_ShouldSucceed) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::NAN).empty()); + ASSERT_FALSE(createIface(IfaceType::NAN_IFACE).empty()); } TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateAp_ShouldFail) { @@ -393,37 +403,37 @@ TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaP2p_ShouldSucceed) TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaNan_ShouldSucceed) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); ASSERT_FALSE(createIface(IfaceType::STA).empty()); - ASSERT_FALSE(createIface(IfaceType::NAN).empty()); + ASSERT_FALSE(createIface(IfaceType::NAN_IFACE).empty()); } TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaP2PNan_ShouldFail) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); ASSERT_FALSE(createIface(IfaceType::STA).empty()); ASSERT_FALSE(createIface(IfaceType::P2P).empty()); - ASSERT_TRUE(createIface(IfaceType::NAN).empty()); + ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); } TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaNan_AfterP2pRemove_ShouldSucceed) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); ASSERT_FALSE(createIface(IfaceType::STA).empty()); - const auto p2p_iface_name = createIface(IfaceType::P2P); + std::string p2p_iface_name = createIface(IfaceType::P2P); ASSERT_FALSE(p2p_iface_name.empty()); - ASSERT_TRUE(createIface(IfaceType::NAN).empty()); + ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); // After removing P2P iface, NAN iface creation should succeed. removeIface(IfaceType::P2P, p2p_iface_name); - ASSERT_FALSE(createIface(IfaceType::NAN).empty()); + ASSERT_FALSE(createIface(IfaceType::NAN_IFACE).empty()); } TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaP2p_AfterNanRemove_ShouldSucceed) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); ASSERT_FALSE(createIface(IfaceType::STA).empty()); - const auto nan_iface_name = createIface(IfaceType::NAN); + std::string nan_iface_name = createIface(IfaceType::NAN_IFACE); ASSERT_FALSE(nan_iface_name.empty()); ASSERT_TRUE(createIface(IfaceType::P2P).empty()); // After removing NAN iface, P2P iface creation should succeed. - removeIface(IfaceType::NAN, nan_iface_name); + removeIface(IfaceType::NAN_IFACE, nan_iface_name); ASSERT_FALSE(createIface(IfaceType::P2P).empty()); } @@ -444,7 +454,7 @@ TEST_F(WifiChipV1_AwareIfaceCombinationTest, ApMode_CreateP2p_ShouldFail) { TEST_F(WifiChipV1_AwareIfaceCombinationTest, ApMode_CreateNan_ShouldFail) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - ASSERT_TRUE(createIface(IfaceType::NAN).empty()); + ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); } TEST_F(WifiChipV1_AwareIfaceCombinationTest, RttControllerFlowStaModeNoSta) { @@ -460,7 +470,7 @@ TEST_F(WifiChipV1_AwareIfaceCombinationTest, RttControllerFlowStaModeWithSta) { TEST_F(WifiChipV1_AwareIfaceCombinationTest, RttControllerFlowApToSta) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - const auto ap_iface_name = createIface(IfaceType::AP); + std::string ap_iface_name = createIface(IfaceType::AP); ASSERT_FALSE(ap_iface_name.empty()); ASSERT_FALSE(createRttController()); @@ -475,9 +485,7 @@ TEST_F(WifiChipV1_AwareIfaceCombinationTest, SelectTxScenarioWithOnlySta) { ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); EXPECT_CALL(*legacy_hal_, selectTxPowerScenario("wlan0", testing::_)) .WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS)); - chip_->selectTxPowerScenario_1_2( - V1_2::IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF, - [](const WifiStatus& status) { ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(chip_->selectTxPowerScenario(IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF).isOk()); } TEST_F(WifiChipV1_AwareIfaceCombinationTest, SelectTxScenarioWithOnlyAp) { @@ -485,9 +493,7 @@ TEST_F(WifiChipV1_AwareIfaceCombinationTest, SelectTxScenarioWithOnlyAp) { ASSERT_EQ(createIface(IfaceType::AP), "wlan0"); EXPECT_CALL(*legacy_hal_, selectTxPowerScenario("wlan0", testing::_)) .WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS)); - chip_->selectTxPowerScenario_1_2( - V1_2::IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF, - [](const WifiStatus& status) { ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(chip_->selectTxPowerScenario(IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF).isOk()); } ////////// V2 + Aware Iface Combinations //////////// @@ -515,7 +521,7 @@ TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateP2p_ShouldSucceed) { TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateNan_ShouldSucceed) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::NAN).empty()); + ASSERT_FALSE(createIface(IfaceType::NAN_IFACE).empty()); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateAp_ShouldSucceed) { @@ -543,9 +549,9 @@ TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateApSta_ShouldSucceed) { TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateSta_AfterStaApRemove_ShouldSucceed) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - const auto sta_iface_name = createIface(IfaceType::STA); + std::string sta_iface_name = createIface(IfaceType::STA); ASSERT_FALSE(sta_iface_name.empty()); - const auto ap_iface_name = createIface(IfaceType::AP); + std::string ap_iface_name = createIface(IfaceType::AP); ASSERT_FALSE(ap_iface_name.empty()); ASSERT_TRUE(createIface(IfaceType::STA).empty()); @@ -565,44 +571,44 @@ TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaP2p_ShouldSucceed) { TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaNan_ShouldSucceed) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); ASSERT_FALSE(createIface(IfaceType::STA).empty()); - ASSERT_FALSE(createIface(IfaceType::NAN).empty()); + ASSERT_FALSE(createIface(IfaceType::NAN_IFACE).empty()); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaP2PNan_ShouldFail) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); ASSERT_FALSE(createIface(IfaceType::STA).empty()); ASSERT_FALSE(createIface(IfaceType::P2P).empty()); - ASSERT_TRUE(createIface(IfaceType::NAN).empty()); + ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaNan_AfterP2pRemove_ShouldSucceed) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); ASSERT_FALSE(createIface(IfaceType::STA).empty()); - const auto p2p_iface_name = createIface(IfaceType::P2P); + std::string p2p_iface_name = createIface(IfaceType::P2P); ASSERT_FALSE(p2p_iface_name.empty()); - ASSERT_TRUE(createIface(IfaceType::NAN).empty()); + ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); // After removing P2P iface, NAN iface creation should succeed. removeIface(IfaceType::P2P, p2p_iface_name); - ASSERT_FALSE(createIface(IfaceType::NAN).empty()); + ASSERT_FALSE(createIface(IfaceType::NAN_IFACE).empty()); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaP2p_AfterNanRemove_ShouldSucceed) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); ASSERT_FALSE(createIface(IfaceType::STA).empty()); - const auto nan_iface_name = createIface(IfaceType::NAN); + std::string nan_iface_name = createIface(IfaceType::NAN_IFACE); ASSERT_FALSE(nan_iface_name.empty()); ASSERT_TRUE(createIface(IfaceType::P2P).empty()); // After removing NAN iface, P2P iface creation should succeed. - removeIface(IfaceType::NAN, nan_iface_name); + removeIface(IfaceType::NAN_IFACE, nan_iface_name); ASSERT_FALSE(createIface(IfaceType::P2P).empty()); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateApNan_ShouldFail) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); ASSERT_FALSE(createIface(IfaceType::AP).empty()); - ASSERT_TRUE(createIface(IfaceType::NAN).empty()); + ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateApP2p_ShouldFail) { @@ -614,31 +620,31 @@ TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateApP2p_ShouldFail) { TEST_F(WifiChipV2_AwareIfaceCombinationTest, StaMode_CreateStaNan_AfterP2pRemove_ShouldSucceed) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); ASSERT_FALSE(createIface(IfaceType::STA).empty()); - const auto p2p_iface_name = createIface(IfaceType::P2P); + std::string p2p_iface_name = createIface(IfaceType::P2P); ASSERT_FALSE(p2p_iface_name.empty()); - ASSERT_TRUE(createIface(IfaceType::NAN).empty()); + ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); // After removing P2P iface, NAN iface creation should succeed. removeIface(IfaceType::P2P, p2p_iface_name); - ASSERT_FALSE(createIface(IfaceType::NAN).empty()); + ASSERT_FALSE(createIface(IfaceType::NAN_IFACE).empty()); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, StaMode_CreateStaP2p_AfterNanRemove_ShouldSucceed) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); ASSERT_FALSE(createIface(IfaceType::STA).empty()); - const auto nan_iface_name = createIface(IfaceType::NAN); + std::string nan_iface_name = createIface(IfaceType::NAN_IFACE); ASSERT_FALSE(nan_iface_name.empty()); ASSERT_TRUE(createIface(IfaceType::P2P).empty()); // After removing NAN iface, P2P iface creation should succeed. - removeIface(IfaceType::NAN, nan_iface_name); + removeIface(IfaceType::NAN_IFACE, nan_iface_name); ASSERT_FALSE(createIface(IfaceType::P2P).empty()); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaAp_EnsureDifferentIfaceNames) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - const auto sta_iface_name = createIface(IfaceType::STA); - const auto ap_iface_name = createIface(IfaceType::AP); + std::string sta_iface_name = createIface(IfaceType::STA); + std::string ap_iface_name = createIface(IfaceType::AP); ASSERT_FALSE(sta_iface_name.empty()); ASSERT_FALSE(ap_iface_name.empty()); ASSERT_NE(sta_iface_name, ap_iface_name); @@ -667,9 +673,7 @@ TEST_F(WifiChipV2_AwareIfaceCombinationTest, SelectTxScenarioWithOnlySta) { ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); EXPECT_CALL(*legacy_hal_, selectTxPowerScenario("wlan0", testing::_)) .WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS)); - chip_->selectTxPowerScenario_1_2( - V1_2::IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF, - [](const WifiStatus& status) { ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(chip_->selectTxPowerScenario(IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF).isOk()); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, SelectTxScenarioWithOnlyAp) { @@ -677,9 +681,7 @@ TEST_F(WifiChipV2_AwareIfaceCombinationTest, SelectTxScenarioWithOnlyAp) { ASSERT_EQ(createIface(IfaceType::AP), "wlan1"); EXPECT_CALL(*legacy_hal_, selectTxPowerScenario("wlan1", testing::_)) .WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS)); - chip_->selectTxPowerScenario_1_2( - V1_2::IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF, - [](const WifiStatus& status) { ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(chip_->selectTxPowerScenario(IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF).isOk()); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, InvalidateAndRemoveNanOnStaRemove) { @@ -687,35 +689,29 @@ TEST_F(WifiChipV2_AwareIfaceCombinationTest, InvalidateAndRemoveNanOnStaRemove) ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); // Create NAN iface - ASSERT_EQ(createIface(IfaceType::NAN), "wlan0"); + ASSERT_EQ(createIface(IfaceType::NAN_IFACE), "wlan0"); // We should have 1 nan iface. - chip_->getNanIfaceNames([](const WifiStatus& status, const hidl_vec& iface_names) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - ASSERT_EQ(iface_names.size(), 1u); - ASSERT_EQ(iface_names[0], "wlan0"); - }); - // Retrieve the exact iface object. - sp nan_iface; - chip_->getNanIface("wlan0", - [&nan_iface](const WifiStatus& status, - const sp& iface) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - ASSERT_NE(iface.get(), nullptr); - nan_iface = iface; - }); + std::vector iface_names; + ASSERT_TRUE(chip_->getNanIfaceNames(&iface_names).isOk()); + ASSERT_EQ(iface_names.size(), 1u); + ASSERT_EQ(iface_names[0], "wlan0"); - // Remove the STA iface. + // Retrieve the nan iface object. + std::shared_ptr nan_iface; + ASSERT_TRUE(chip_->getNanIface("wlan0", &nan_iface).isOk()); + ASSERT_NE(nan_iface.get(), nullptr); + + // Remove the STA iface. We should have 0 nan ifaces now. removeIface(IfaceType::STA, "wlan0"); - // We should have 0 nan iface now. - chip_->getNanIfaceNames([](const WifiStatus& status, const hidl_vec& iface_names) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - ASSERT_EQ(iface_names.size(), 0u); - }); - // Any operation on the nan iface object should return error now. - nan_iface->getName([](const WifiStatus& status, const std::string& /* iface_name */) { - ASSERT_EQ(WifiStatusCode::ERROR_WIFI_IFACE_INVALID, status.code); - }); + ASSERT_TRUE(chip_->getNanIfaceNames(&iface_names).isOk()); + ASSERT_EQ(iface_names.size(), 0u); + + // Any operation on the nan iface object should now return an error. + std::string name; + auto status = nan_iface->getName(&name); + ASSERT_EQ(status.getServiceSpecificError(), + static_cast(WifiStatusCode::ERROR_WIFI_IFACE_INVALID)); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, InvalidateAndRemoveRttControllerOnStaRemove) { @@ -723,30 +719,25 @@ TEST_F(WifiChipV2_AwareIfaceCombinationTest, InvalidateAndRemoveRttControllerOnS ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); // Create RTT controller - sp rtt_controller; - chip_->createRttController_1_6( - NULL, [&rtt_controller](const WifiStatus& status, const sp& rtt) { - if (WifiStatusCode::SUCCESS == status.code) { - ASSERT_NE(rtt.get(), nullptr); - rtt_controller = rtt; - } - }); + std::shared_ptr rtt_controller; + ASSERT_TRUE(chip_->createRttController(nullptr, &rtt_controller).isOk()); // Remove the STA iface. removeIface(IfaceType::STA, "wlan0"); - // Any operation on the rtt controller object should return error now. - rtt_controller->getBoundIface([](const WifiStatus& status, const sp& /* iface */) { - ASSERT_EQ(WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, status.code); - }); + // Any operation on the rtt controller object should now return an error. + std::shared_ptr bound_iface; + auto status = rtt_controller->getBoundIface(&bound_iface); + ASSERT_EQ(status.getServiceSpecificError(), + static_cast(WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID)); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateNanWithSharedNanIface) { property_set("wifi.aware.interface", nullptr); findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); - ASSERT_EQ(createIface(IfaceType::NAN), "wlan0"); - removeIface(IfaceType::NAN, "wlan0"); + ASSERT_EQ(createIface(IfaceType::NAN_IFACE), "wlan0"); + removeIface(IfaceType::NAN_IFACE, "wlan0"); EXPECT_CALL(*iface_util_, setUpState(testing::_, testing::_)).Times(0); } @@ -756,10 +747,10 @@ TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateNanWithDedicatedNanIface) { ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); EXPECT_CALL(*iface_util_, ifNameToIndex("aware0")).WillOnce(testing::Return(4)); EXPECT_CALL(*iface_util_, setUpState("aware0", true)).WillOnce(testing::Return(true)); - ASSERT_EQ(createIface(IfaceType::NAN), "aware0"); + ASSERT_EQ(createIface(IfaceType::NAN_IFACE), "aware0"); EXPECT_CALL(*iface_util_, setUpState("aware0", false)).WillOnce(testing::Return(true)); - removeIface(IfaceType::NAN, "aware0"); + removeIface(IfaceType::NAN_IFACE, "aware0"); } ////////// V1 Iface Combinations when AP creation is disabled ////////// @@ -857,8 +848,8 @@ TEST_F(WifiChip_MultiIfaceTest, CreateApStartsWithIdx1) { ASSERT_EQ(createIface(IfaceType::STA), "wlan1"); ASSERT_EQ(createIface(IfaceType::STA), "wlan3"); } -} // namespace implementation -} // namespace V1_6 + } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl diff --git a/wifi/1.6/default/tests/wifi_iface_util_unit_tests.cpp b/wifi/aidl/default/tests/wifi_iface_util_unit_tests.cpp similarity index 92% rename from wifi/1.6/default/tests/wifi_iface_util_unit_tests.cpp rename to wifi/aidl/default/tests/wifi_iface_util_unit_tests.cpp index cc9a3340a5..e0db6fdc90 100644 --- a/wifi/1.6/default/tests/wifi_iface_util_unit_tests.cpp +++ b/wifi/aidl/default/tests/wifi_iface_util_unit_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019, The Android Open Source Project + * 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. @@ -18,7 +18,6 @@ #include #include -#undef NAN #include "wifi_iface_util.h" #include "mock_interface_tool.h" @@ -38,16 +37,16 @@ bool isValidUnicastLocallyAssignedMacAddress(const std::array& mac_a } } // namespace +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { namespace iface_util { + class WifiIfaceUtilTest : public Test { protected: - std::shared_ptr> iface_tool_{ - new NiceMock}; + std::shared_ptr> iface_tool_{ + new NiceMock<::android::wifi_system::MockInterfaceTool>}; legacy_hal::wifi_hal_fn fake_func_table_; std::shared_ptr> legacy_hal_{ new NiceMock(iface_tool_, fake_func_table_, true)}; @@ -89,8 +88,7 @@ TEST_F(WifiIfaceUtilTest, IfaceEventHandlers_SetMacAddress) { ASSERT_FALSE(callback_invoked); } } // namespace iface_util -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp b/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp new file mode 100644 index 0000000000..d40801faef --- /dev/null +++ b/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp @@ -0,0 +1,168 @@ +/* + * 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. + */ + +#include +#include +#include +#include + +#include "wifi_nan_iface.h" + +#include "mock_interface_tool.h" +#include "mock_wifi_feature_flags.h" +#include "mock_wifi_iface_util.h" +#include "mock_wifi_legacy_hal.h" + +using testing::NiceMock; +using testing::Return; +using testing::Test; + +namespace { +constexpr char kIfaceName[] = "mockWlan0"; +} // namespace + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { + +bool CaptureIfaceEventHandlers(const std::string& /* iface_name*/, + iface_util::IfaceEventHandlers in_iface_event_handlers, + iface_util::IfaceEventHandlers* out_iface_event_handlers) { + *out_iface_event_handlers = in_iface_event_handlers; + return true; +} + +class MockNanIface : public WifiNanIface { + public: + MockNanIface(const std::string& ifname, bool is_dedicated_iface, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util) + : WifiNanIface(ifname, is_dedicated_iface, legacy_hal, iface_util) {} + + static std::shared_ptr createMock( + const std::string& ifname, bool is_dedicated_iface, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util) { + std::shared_ptr ptr = ndk::SharedRefBase::make( + ifname, is_dedicated_iface, legacy_hal, iface_util); + std::weak_ptr weak_ptr_this(ptr); + ptr->setWeakPtr(weak_ptr_this); + ptr->registerCallbackHandlers(); + return ptr; + } + + // Override getEventCallbacks() so that we can return a mocked callback object. + std::set> getEventCallbacks() override { + return {callback_}; + } + + void setMockCallback(std::shared_ptr cb) { callback_ = cb; } + + private: + std::shared_ptr callback_; +}; + +class MockNanIfaceEventCallback : public IWifiNanIfaceEventCallback { + public: + ndk::SpAIBinder asBinder() override { return ::ndk::SpAIBinder{}; } + bool isRemote() override { return false; } + + ::ndk::ScopedAStatus getInterfaceVersion(int32_t* _aidl_return) override { + *_aidl_return = 1; + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus getInterfaceHash(std::string* _aidl_return) override { + *_aidl_return = "some_hash"; + return ndk::ScopedAStatus::ok(); + } + + MOCK_METHOD3(notifyCapabilitiesResponse, + ndk::ScopedAStatus(char16_t, const NanStatus&, const NanCapabilities&)); + MOCK_METHOD2(notifyEnableResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD2(notifyConfigResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD2(notifyDisableResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD3(notifyStartPublishResponse, + ndk::ScopedAStatus(char16_t, const NanStatus&, int8_t)); + MOCK_METHOD2(notifyStopPublishResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD3(notifyStartSubscribeResponse, + ndk::ScopedAStatus(char16_t, const NanStatus&, int8_t)); + MOCK_METHOD2(notifyStopSubscribeResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD2(notifyTransmitFollowupResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD2(notifyCreateDataInterfaceResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD2(notifyDeleteDataInterfaceResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD3(notifyInitiateDataPathResponse, + ndk::ScopedAStatus(char16_t, const NanStatus&, int32_t)); + MOCK_METHOD2(notifyRespondToDataPathIndicationResponse, + ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD2(notifyTerminateDataPathResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD1(eventClusterEvent, ndk::ScopedAStatus(const NanClusterEventInd&)); + MOCK_METHOD1(eventDisabled, ndk::ScopedAStatus(const NanStatus&)); + MOCK_METHOD2(eventPublishTerminated, ndk::ScopedAStatus(int8_t, const NanStatus&)); + MOCK_METHOD2(eventSubscribeTerminated, ndk::ScopedAStatus(int8_t, const NanStatus&)); + MOCK_METHOD1(eventMatch, ndk::ScopedAStatus(const NanMatchInd&)); + MOCK_METHOD2(eventMatchExpired, ndk::ScopedAStatus(int8_t, int32_t)); + MOCK_METHOD1(eventFollowupReceived, ndk::ScopedAStatus(const NanFollowupReceivedInd&)); + MOCK_METHOD2(eventTransmitFollowup, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD1(eventDataPathRequest, ndk::ScopedAStatus(const NanDataPathRequestInd&)); + MOCK_METHOD1(eventDataPathConfirm, ndk::ScopedAStatus(const NanDataPathConfirmInd&)); + MOCK_METHOD1(eventDataPathTerminated, ndk::ScopedAStatus(int32_t)); + MOCK_METHOD1(eventDataPathScheduleUpdate, + ndk::ScopedAStatus(const NanDataPathScheduleUpdateInd&)); +}; + +class WifiNanIfaceTest : public Test { + protected: + legacy_hal::wifi_hal_fn fake_func_table_; + std::shared_ptr> iface_tool_{ + new NiceMock<::android::wifi_system::MockInterfaceTool>}; + std::shared_ptr> legacy_hal_{ + new NiceMock(iface_tool_, fake_func_table_, true)}; + std::shared_ptr> iface_util_{ + new NiceMock(iface_tool_, legacy_hal_)}; +}; + +TEST_F(WifiNanIfaceTest, IfacEventHandlers_OnStateToggleOffOn) { + // Ensure that event handlers are registered during nan iface creation. + iface_util::IfaceEventHandlers captured_iface_event_handlers = {}; + EXPECT_CALL(*legacy_hal_, nanRegisterCallbackHandlers(testing::_, testing::_)) + .WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS)); + EXPECT_CALL(*iface_util_, registerIfaceEventHandlers(testing::_, testing::_)) + .WillOnce(testing::Invoke(bind(CaptureIfaceEventHandlers, std::placeholders::_1, + std::placeholders::_2, &captured_iface_event_handlers))); + + // Create nan iface and register a callback. + // Note: Since we can't register a callback directly (gTest fails on + // AIBinder_linkToDeath), simulate the registration by overriding + // getEventCallbacks() to return our mock callback object. + std::shared_ptr mock_nan_iface = + MockNanIface::createMock(kIfaceName, false, legacy_hal_, iface_util_); + std::shared_ptr mock_event_callback = + ndk::SharedRefBase::make(); + mock_nan_iface->setMockCallback(mock_event_callback); + + // Ensure that the eventDisabled() function in the mock callback will be invoked. + NanStatus expected_nan_status = {NanStatusCode::UNSUPPORTED_CONCURRENCY_NAN_DISABLED, ""}; + EXPECT_CALL(*mock_event_callback, eventDisabled(expected_nan_status)).Times(1); + + // Trigger the iface state toggle callback. + captured_iface_event_handlers.on_state_toggle_off_on(kIfaceName); +} + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/1.6/default/wifi.cpp b/wifi/aidl/default/wifi.cpp similarity index 60% rename from wifi/1.6/default/wifi.cpp rename to wifi/aidl/default/wifi.cpp index c302ce2434..e30c38abcf 100644 --- a/wifi/1.6/default/wifi.cpp +++ b/wifi/aidl/default/wifi.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * 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. @@ -14,26 +14,26 @@ * limitations under the License. */ +#include "wifi.h" + #include -#include "hidl_return_util.h" -#include "wifi.h" +#include "aidl_return_util.h" #include "wifi_status_util.h" namespace { // Starting Chip ID, will be assigned to primary chip -static constexpr android::hardware::wifi::V1_0::ChipId kPrimaryChipId = 0; +static constexpr int32_t kPrimaryChipId = 0; } // namespace +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { -using hidl_return_util::validateAndCall; -using hidl_return_util::validateAndCallWithLock; +using aidl_return_util::validateAndCall; +using aidl_return_util::validateAndCallWithLock; -Wifi::Wifi(const std::shared_ptr iface_tool, +Wifi::Wifi(const std::shared_ptr<::android::wifi_system::InterfaceTool> iface_tool, const std::shared_ptr legacy_hal_factory, const std::shared_ptr mode_controller, const std::shared_ptr feature_flags) @@ -48,86 +48,74 @@ bool Wifi::isValid() { return true; } -Return Wifi::registerEventCallback(const sp& event_callback, - registerEventCallback_cb hidl_status_cb) { +ndk::ScopedAStatus Wifi::registerEventCallback( + const std::shared_ptr& in_callback) { return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN, - &Wifi::registerEventCallbackInternal, hidl_status_cb, event_callback); + &Wifi::registerEventCallbackInternal, in_callback); } -Return Wifi::registerEventCallback_1_5(const sp& event_callback, - registerEventCallback_1_5_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN, - &Wifi::registerEventCallbackInternal_1_5, hidl_status_cb, - event_callback); +ndk::ScopedAStatus Wifi::isStarted(bool* _aidl_return) { + *_aidl_return = (run_state_ != RunState::STOPPED); + return ndk::ScopedAStatus::ok(); } -Return Wifi::isStarted() { - return run_state_ != RunState::STOPPED; +ndk::ScopedAStatus Wifi::start() { + return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN, &Wifi::startInternal); } -Return Wifi::start(start_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN, &Wifi::startInternal, - hidl_status_cb); +ndk::ScopedAStatus Wifi::stop() { + return validateAndCallWithLock(this, WifiStatusCode::ERROR_UNKNOWN, &Wifi::stopInternal); } -Return Wifi::stop(stop_cb hidl_status_cb) { - return validateAndCallWithLock(this, WifiStatusCode::ERROR_UNKNOWN, &Wifi::stopInternal, - hidl_status_cb); -} - -Return Wifi::getChipIds(getChipIds_cb hidl_status_cb) { +ndk::ScopedAStatus Wifi::getChipIds(std::vector* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN, &Wifi::getChipIdsInternal, - hidl_status_cb); + _aidl_return); } -Return Wifi::getChip(ChipId chip_id, getChip_cb hidl_status_cb) { +ndk::ScopedAStatus Wifi::getChip(int32_t in_chipId, std::shared_ptr* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN, &Wifi::getChipInternal, - hidl_status_cb, chip_id); + _aidl_return, in_chipId); } -Return Wifi::debug(const hidl_handle& handle, const hidl_vec&) { - LOG(INFO) << "-----------Debug is called----------------"; +binder_status_t Wifi::dump(int fd, const char** args, uint32_t numArgs) { + LOG(INFO) << "-----------Debug was called----------------"; if (chips_.size() == 0) { - return Void(); + LOG(INFO) << "No chips to display."; + return STATUS_OK; } - for (sp chip : chips_) { + for (std::shared_ptr chip : chips_) { if (!chip.get()) continue; - - chip->debug(handle, {}); + chip->dump(fd, args, numArgs); } - return Void(); + return STATUS_OK; } -WifiStatus Wifi::registerEventCallbackInternal( - const sp& event_callback __unused) { - // Deprecated support for this callback. - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus Wifi::registerEventCallbackInternal_1_5( - const sp& event_callback) { +ndk::ScopedAStatus Wifi::registerEventCallbackInternal( + const std::shared_ptr& event_callback) { if (!event_cb_handler_.addCallback(event_callback)) { return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); } - return createWifiStatus(WifiStatusCode::SUCCESS); + return ndk::ScopedAStatus::ok(); } -WifiStatus Wifi::startInternal() { +ndk::ScopedAStatus Wifi::startInternal() { if (run_state_ == RunState::STARTED) { - return createWifiStatus(WifiStatusCode::SUCCESS); + return ndk::ScopedAStatus::ok(); } else if (run_state_ == RunState::STOPPING) { return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE, "HAL is stopping"); } - WifiStatus wifi_status = initializeModeControllerAndLegacyHal(); - if (wifi_status.code == WifiStatusCode::SUCCESS) { + ndk::ScopedAStatus wifi_status = initializeModeControllerAndLegacyHal(); + if (wifi_status.isOk()) { // Register the callback for subsystem restart const auto& on_subsystem_restart_callback = [this](const std::string& error) { - WifiStatus wifi_status = createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, error); + ndk::ScopedAStatus wifi_status = createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, error); for (const auto& callback : event_cb_handler_.getCallbacks()) { LOG(INFO) << "Attempting to invoke onSubsystemRestart " "callback"; - if (!callback->onSubsystemRestart(wifi_status).isOk()) { + WifiStatusCode errorCode = + static_cast(wifi_status.getServiceSpecificError()); + if (!callback->onSubsystemRestart(errorCode).isOk()) { LOG(ERROR) << "Failed to invoke onSubsystemRestart callback"; } else { LOG(INFO) << "Succeeded to invoke onSubsystemRestart " @@ -137,12 +125,12 @@ WifiStatus Wifi::startInternal() { }; // Create the chip instance once the HAL is started. - android::hardware::wifi::V1_0::ChipId chipId = kPrimaryChipId; + int32_t chipId = kPrimaryChipId; for (auto& hal : legacy_hals_) { chips_.push_back( - new WifiChip(chipId, chipId == kPrimaryChipId, hal, mode_controller_, - std::make_shared(iface_tool_, hal), - feature_flags_, on_subsystem_restart_callback)); + WifiChip::create(chipId, chipId == kPrimaryChipId, hal, mode_controller_, + std::make_shared(iface_tool_, hal), + feature_flags_, on_subsystem_restart_callback)); chipId++; } run_state_ = RunState::STARTED; @@ -154,7 +142,9 @@ WifiStatus Wifi::startInternal() { LOG(INFO) << "Wifi HAL started"; } else { for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onFailure(wifi_status).isOk()) { + WifiStatusCode errorCode = + static_cast(wifi_status.getServiceSpecificError()); + if (!callback->onFailure(errorCode).isOk()) { LOG(ERROR) << "Failed to invoke onFailure callback"; } } @@ -165,10 +155,10 @@ WifiStatus Wifi::startInternal() { return wifi_status; } -WifiStatus Wifi::stopInternal( +ndk::ScopedAStatus Wifi::stopInternal( /* NONNULL */ std::unique_lock* lock) { if (run_state_ == RunState::STOPPED) { - return createWifiStatus(WifiStatusCode::SUCCESS); + return ndk::ScopedAStatus::ok(); } else if (run_state_ == RunState::STOPPING) { return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE, "HAL is stopping"); } @@ -177,12 +167,12 @@ WifiStatus Wifi::stopInternal( for (auto& chip : chips_) { if (chip.get()) { chip->invalidate(); - chip.clear(); + chip.reset(); } } chips_.clear(); - WifiStatus wifi_status = stopLegacyHalAndDeinitializeModeController(lock); - if (wifi_status.code == WifiStatusCode::SUCCESS) { + ndk::ScopedAStatus wifi_status = stopLegacyHalAndDeinitializeModeController(lock); + if (wifi_status.isOk()) { for (const auto& callback : event_cb_handler_.getCallbacks()) { if (!callback->onStop().isOk()) { LOG(ERROR) << "Failed to invoke onStop callback"; @@ -191,7 +181,9 @@ WifiStatus Wifi::stopInternal( LOG(INFO) << "Wifi HAL stopped"; } else { for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onFailure(wifi_status).isOk()) { + WifiStatusCode errorCode = + static_cast(wifi_status.getServiceSpecificError()); + if (!callback->onFailure(errorCode).isOk()) { LOG(ERROR) << "Failed to invoke onFailure callback"; } } @@ -202,27 +194,26 @@ WifiStatus Wifi::stopInternal( return wifi_status; } -std::pair> Wifi::getChipIdsInternal() { - std::vector chip_ids; +std::pair, ndk::ScopedAStatus> Wifi::getChipIdsInternal() { + std::vector chip_ids; for (auto& chip : chips_) { - ChipId chip_id = getChipIdFromWifiChip(chip); - if (chip_id != UINT32_MAX) chip_ids.emplace_back(chip_id); + int32_t chip_id = getChipIdFromWifiChip(chip); + if (chip_id != INT32_MAX) chip_ids.emplace_back(chip_id); } - return {createWifiStatus(WifiStatusCode::SUCCESS), std::move(chip_ids)}; + return {std::move(chip_ids), ndk::ScopedAStatus::ok()}; } -std::pair> Wifi::getChipInternal(ChipId chip_id) { +std::pair, ndk::ScopedAStatus> Wifi::getChipInternal(int32_t chip_id) { for (auto& chip : chips_) { - ChipId cand_id = getChipIdFromWifiChip(chip); - if ((cand_id != UINT32_MAX) && (cand_id == chip_id)) - return {createWifiStatus(WifiStatusCode::SUCCESS), chip}; + int32_t cand_id = getChipIdFromWifiChip(chip); + if ((cand_id != INT32_MAX) && (cand_id == chip_id)) return {chip, ndk::ScopedAStatus::ok()}; } - return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr}; + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)}; } -WifiStatus Wifi::initializeModeControllerAndLegacyHal() { +ndk::ScopedAStatus Wifi::initializeModeControllerAndLegacyHal() { if (!mode_controller_->initialize()) { LOG(ERROR) << "Failed to initialize firmware mode controller"; return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); @@ -244,10 +235,10 @@ WifiStatus Wifi::initializeModeControllerAndLegacyHal() { } index++; } - return createWifiStatus(WifiStatusCode::SUCCESS); + return ndk::ScopedAStatus::ok(); } -WifiStatus Wifi::stopLegacyHalAndDeinitializeModeController( +ndk::ScopedAStatus Wifi::stopLegacyHalAndDeinitializeModeController( /* NONNULL */ std::unique_lock* lock) { legacy_hal::wifi_error legacy_status = legacy_hal::WIFI_SUCCESS; int index = 0; @@ -272,23 +263,22 @@ WifiStatus Wifi::stopLegacyHalAndDeinitializeModeController( LOG(ERROR) << "Failed to deinitialize firmware mode controller"; return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); } - return createWifiStatus(WifiStatusCode::SUCCESS); + return ndk::ScopedAStatus::ok(); } -ChipId Wifi::getChipIdFromWifiChip(sp& chip) { - ChipId chip_id = UINT32_MAX; +int32_t Wifi::getChipIdFromWifiChip(std::shared_ptr& chip) { + int32_t chip_id = INT32_MAX; if (chip.get()) { - chip->getId([&](WifiStatus status, uint32_t id) { - if (status.code == WifiStatusCode::SUCCESS) { - chip_id = id; - } - }); + ndk::ScopedAStatus status = chip->getId(&chip_id); + if (!status.isOk()) { + // Reset value if operation failed. + chip_id = INT32_MAX; + } } - return chip_id; } -} // namespace implementation -} // namespace V1_6 + } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/wifi.h b/wifi/aidl/default/wifi.h new file mode 100644 index 0000000000..933452448e --- /dev/null +++ b/wifi/aidl/default/wifi.h @@ -0,0 +1,96 @@ +/* + * 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. + */ + +#ifndef WIFI_H_ +#define WIFI_H_ + +#include +#include +#include + +#include + +#include "aidl_callback_util.h" +#include "wifi_chip.h" +#include "wifi_feature_flags.h" +#include "wifi_legacy_hal.h" +#include "wifi_legacy_hal_factory.h" +#include "wifi_mode_controller.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { + +/** + * Root AIDL interface object used to control the Wifi HAL. + */ +class Wifi : public BnWifi { + public: + Wifi(const std::shared_ptr<::android::wifi_system::InterfaceTool> iface_tool, + const std::shared_ptr legacy_hal_factory, + const std::shared_ptr mode_controller, + const std::shared_ptr feature_flags); + + bool isValid(); + + // AIDL methods exposed. + ndk::ScopedAStatus registerEventCallback( + const std::shared_ptr& in_callback) override; + ndk::ScopedAStatus isStarted(bool* _aidl_return) override; + ndk::ScopedAStatus start() override; + ndk::ScopedAStatus stop() override; + ndk::ScopedAStatus getChipIds(std::vector* _aidl_return) override; + ndk::ScopedAStatus getChip(int32_t in_chipId, + std::shared_ptr* _aidl_return) override; + binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; + + private: + enum class RunState { STOPPED, STARTED, STOPPING }; + + // Corresponding worker functions for the AIDL methods. + ndk::ScopedAStatus registerEventCallbackInternal( + const std::shared_ptr& event_callback __unused); + ndk::ScopedAStatus startInternal(); + ndk::ScopedAStatus stopInternal(std::unique_lock* lock); + std::pair, ndk::ScopedAStatus> getChipIdsInternal(); + std::pair, ndk::ScopedAStatus> getChipInternal(int32_t chip_id); + + ndk::ScopedAStatus initializeModeControllerAndLegacyHal(); + ndk::ScopedAStatus stopLegacyHalAndDeinitializeModeController( + std::unique_lock* lock); + int32_t getChipIdFromWifiChip(std::shared_ptr& chip); + + // Instance is created in this root level |IWifi| AIDL interface object + // and shared with all the child AIDL interface objects. + std::shared_ptr<::android::wifi_system::InterfaceTool> iface_tool_; + std::shared_ptr legacy_hal_factory_; + std::shared_ptr mode_controller_; + std::vector> legacy_hals_; + std::shared_ptr feature_flags_; + RunState run_state_; + std::vector> chips_; + aidl_callback_util::AidlCallbackHandler event_cb_handler_; + + DISALLOW_COPY_AND_ASSIGN(Wifi); +}; + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // WIFI_H_ diff --git a/wifi/1.6/default/wifi_ap_iface.cpp b/wifi/aidl/default/wifi_ap_iface.cpp similarity index 59% rename from wifi/1.6/default/wifi_ap_iface.cpp rename to wifi/aidl/default/wifi_ap_iface.cpp index b2957db13f..6cd932df41 100644 --- a/wifi/1.6/default/wifi_ap_iface.cpp +++ b/wifi/aidl/default/wifi_ap_iface.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * 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. @@ -14,19 +14,19 @@ * limitations under the License. */ +#include "wifi_ap_iface.h" + #include -#include "hidl_return_util.h" -#include "hidl_struct_util.h" -#include "wifi_ap_iface.h" +#include "aidl_return_util.h" +#include "aidl_struct_util.h" #include "wifi_status_util.h" +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { -using hidl_return_util::validateAndCall; +using aidl_return_util::validateAndCall; WifiApIface::WifiApIface(const std::string& ifname, const std::vector& instances, const std::weak_ptr legacy_hal, @@ -54,76 +54,66 @@ void WifiApIface::removeInstance(std::string instance) { instances_.erase(std::remove(instances_.begin(), instances_.end(), instance), instances_.end()); } -Return WifiApIface::getName(getName_cb hidl_status_cb) { +ndk::ScopedAStatus WifiApIface::getName(std::string* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::getNameInternal, hidl_status_cb); + &WifiApIface::getNameInternal, _aidl_return); } -Return WifiApIface::getType(getType_cb hidl_status_cb) { +ndk::ScopedAStatus WifiApIface::setCountryCode(const std::array& in_code) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::getTypeInternal, hidl_status_cb); + &WifiApIface::setCountryCodeInternal, in_code); } -Return WifiApIface::setCountryCode(const hidl_array& code, - setCountryCode_cb hidl_status_cb) { +ndk::ScopedAStatus WifiApIface::getValidFrequenciesForBand(WifiBand in_band, + std::vector* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::setCountryCodeInternal, hidl_status_cb, code); + &WifiApIface::getValidFrequenciesForBandInternal, _aidl_return, in_band); } -Return WifiApIface::getValidFrequenciesForBand(V1_0::WifiBand band, - getValidFrequenciesForBand_cb hidl_status_cb) { +ndk::ScopedAStatus WifiApIface::setMacAddress(const std::array& in_mac) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::getValidFrequenciesForBandInternal, hidl_status_cb, band); + &WifiApIface::setMacAddressInternal, in_mac); } -Return WifiApIface::setMacAddress(const hidl_array& mac, - setMacAddress_cb hidl_status_cb) { +ndk::ScopedAStatus WifiApIface::getFactoryMacAddress(std::array* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::setMacAddressInternal, hidl_status_cb, mac); -} - -Return WifiApIface::getFactoryMacAddress(getFactoryMacAddress_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::getFactoryMacAddressInternal, hidl_status_cb, + &WifiApIface::getFactoryMacAddressInternal, _aidl_return, instances_.size() > 0 ? instances_[0] : ifname_); } -Return WifiApIface::resetToFactoryMacAddress(resetToFactoryMacAddress_cb hidl_status_cb) { +ndk::ScopedAStatus WifiApIface::resetToFactoryMacAddress() { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::resetToFactoryMacAddressInternal, hidl_status_cb); + &WifiApIface::resetToFactoryMacAddressInternal); } -Return WifiApIface::getBridgedInstances(getBridgedInstances_cb hidl_status_cb) { +ndk::ScopedAStatus WifiApIface::getBridgedInstances(std::vector* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::getBridgedInstancesInternal, hidl_status_cb); + &WifiApIface::getBridgedInstancesInternal, _aidl_return); } -std::pair WifiApIface::getNameInternal() { - return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_}; +std::pair WifiApIface::getNameInternal() { + return {ifname_, ndk::ScopedAStatus::ok()}; } -std::pair WifiApIface::getTypeInternal() { - return {createWifiStatus(WifiStatusCode::SUCCESS), IfaceType::AP}; -} - -WifiStatus WifiApIface::setCountryCodeInternal(const std::array& code) { +ndk::ScopedAStatus WifiApIface::setCountryCodeInternal(const std::array& code) { legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->setCountryCode( instances_.size() > 0 ? instances_[0] : ifname_, code); return createWifiStatusFromLegacyError(legacy_status); } -std::pair> -WifiApIface::getValidFrequenciesForBandInternal(V1_0::WifiBand band) { - static_assert(sizeof(WifiChannelInMhz) == sizeof(uint32_t), "Size mismatch"); +std::pair, ndk::ScopedAStatus> WifiApIface::getValidFrequenciesForBandInternal( + WifiBand band) { + static_assert(sizeof(WifiChannelWidthInMhz) == sizeof(int32_t), "Size mismatch"); legacy_hal::wifi_error legacy_status; std::vector valid_frequencies; std::tie(legacy_status, valid_frequencies) = legacy_hal_.lock()->getValidFrequenciesForBand( instances_.size() > 0 ? instances_[0] : ifname_, - hidl_struct_util::convertHidlWifiBandToLegacy(band)); - return {createWifiStatusFromLegacyError(legacy_status), valid_frequencies}; + aidl_struct_util::convertAidlWifiBandToLegacy(band)); + return {std::vector(valid_frequencies.begin(), valid_frequencies.end()), + createWifiStatusFromLegacyError(legacy_status)}; } -WifiStatus WifiApIface::setMacAddressInternal(const std::array& mac) { +ndk::ScopedAStatus WifiApIface::setMacAddressInternal(const std::array& mac) { // Support random MAC up to 2 interfaces if (instances_.size() == 2) { int rbyte = 1; @@ -145,35 +135,35 @@ WifiStatus WifiApIface::setMacAddressInternal(const std::array& mac) LOG(ERROR) << "Fail to config MAC for interface " << ifname_; return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); } - return createWifiStatus(WifiStatusCode::SUCCESS); + return ndk::ScopedAStatus::ok(); } -std::pair> WifiApIface::getFactoryMacAddressInternal( +std::pair, ndk::ScopedAStatus> WifiApIface::getFactoryMacAddressInternal( const std::string& ifaceName) { std::array mac = iface_util_.lock()->getFactoryMacAddress(ifaceName); if (mac[0] == 0 && mac[1] == 0 && mac[2] == 0 && mac[3] == 0 && mac[4] == 0 && mac[5] == 0) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), mac}; + return {mac, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; } - return {createWifiStatus(WifiStatusCode::SUCCESS), mac}; + return {mac, ndk::ScopedAStatus::ok()}; } -WifiStatus WifiApIface::resetToFactoryMacAddressInternal() { - std::pair> getMacResult; +ndk::ScopedAStatus WifiApIface::resetToFactoryMacAddressInternal() { + std::pair, ndk::ScopedAStatus> getMacResult; if (instances_.size() == 2) { for (auto const& intf : instances_) { getMacResult = getFactoryMacAddressInternal(intf); LOG(DEBUG) << "Reset MAC to factory MAC on " << intf; - if (getMacResult.first.code != WifiStatusCode::SUCCESS || - !iface_util_.lock()->setMacAddress(intf, getMacResult.second)) { + if (!getMacResult.second.isOk() || + !iface_util_.lock()->setMacAddress(intf, getMacResult.first)) { return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); } } - // It needs to set mac address for bridged interface, otherwise the mac + // We need to set mac address for bridged interface, otherwise the mac // address of the bridged interface will be changed after one of the - // instance down. Thus we are generating a random MAC address for the - // bridged interface even if we got the request to reset the Factory - // MAC. Since the bridged interface is an internal interface for the - // operation of bpf and others networking operation. + // instances goes down. Thus we are generating a random MAC address for + // the bridged interface even if we got the request to reset the Factory + // MAC. This is because the bridged interface is an internal interface + // for the operation of bpf and other networking operations. if (!iface_util_.lock()->setMacAddress(ifname_, iface_util_.lock()->createRandomMacAddress())) { LOG(ERROR) << "Fail to config MAC for bridged interface " << ifname_; @@ -182,23 +172,19 @@ WifiStatus WifiApIface::resetToFactoryMacAddressInternal() { } else { getMacResult = getFactoryMacAddressInternal(ifname_); LOG(DEBUG) << "Reset MAC to factory MAC on " << ifname_; - if (getMacResult.first.code != WifiStatusCode::SUCCESS || - !iface_util_.lock()->setMacAddress(ifname_, getMacResult.second)) { + if (!getMacResult.second.isOk() || + !iface_util_.lock()->setMacAddress(ifname_, getMacResult.first)) { return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); } } - return createWifiStatus(WifiStatusCode::SUCCESS); + return ndk::ScopedAStatus::ok(); } -std::pair> WifiApIface::getBridgedInstancesInternal() { - std::vector instances; - for (const auto& instance_name : instances_) { - instances.push_back(instance_name); - } - return {createWifiStatus(WifiStatusCode::SUCCESS), instances}; +std::pair, ndk::ScopedAStatus> WifiApIface::getBridgedInstancesInternal() { + return {instances_, ndk::ScopedAStatus::ok()}; } -} // namespace implementation -} // namespace V1_6 + } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/wifi_ap_iface.h b/wifi/aidl/default/wifi_ap_iface.h new file mode 100644 index 0000000000..b5673fcaac --- /dev/null +++ b/wifi/aidl/default/wifi_ap_iface.h @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifndef WIFI_AP_IFACE_H_ +#define WIFI_AP_IFACE_H_ + +#include +#include + +#include "wifi_iface_util.h" +#include "wifi_legacy_hal.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { + +/** + * AIDL interface object used to control an AP Iface instance. + */ +class WifiApIface : public BnWifiApIface { + public: + WifiApIface(const std::string& ifname, const std::vector& instances, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util); + // Refer to |WifiChip::invalidate()|. + void invalidate(); + bool isValid(); + std::string getName(); + void removeInstance(std::string instance); + + // AIDL methods exposed. + ndk::ScopedAStatus getName(std::string* _aidl_return) override; + ndk::ScopedAStatus setCountryCode(const std::array& in_code) override; + ndk::ScopedAStatus getValidFrequenciesForBand(WifiBand in_band, + std::vector* _aidl_return) override; + ndk::ScopedAStatus setMacAddress(const std::array& in_mac) override; + ndk::ScopedAStatus getFactoryMacAddress(std::array* _aidl_return) override; + ndk::ScopedAStatus resetToFactoryMacAddress() override; + ndk::ScopedAStatus getBridgedInstances(std::vector* _aidl_return) override; + + private: + // Corresponding worker functions for the AIDL methods. + std::pair getNameInternal(); + ndk::ScopedAStatus setCountryCodeInternal(const std::array& code); + std::pair, ndk::ScopedAStatus> getValidFrequenciesForBandInternal( + WifiBand band); + ndk::ScopedAStatus setMacAddressInternal(const std::array& mac); + std::pair, ndk::ScopedAStatus> getFactoryMacAddressInternal( + const std::string& ifaceName); + ndk::ScopedAStatus resetToFactoryMacAddressInternal(); + std::pair, ndk::ScopedAStatus> getBridgedInstancesInternal(); + + std::string ifname_; + std::vector instances_; + std::weak_ptr legacy_hal_; + std::weak_ptr iface_util_; + bool is_valid_; + + DISALLOW_COPY_AND_ASSIGN(WifiApIface); +}; + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // WIFI_AP_IFACE_H_ diff --git a/wifi/1.6/default/wifi_chip.cpp b/wifi/aidl/default/wifi_chip.cpp similarity index 64% rename from wifi/1.6/default/wifi_chip.cpp rename to wifi/aidl/default/wifi_chip.cpp index 920beb8778..076f351448 100644 --- a/wifi/1.6/default/wifi_chip.cpp +++ b/wifi/aidl/default/wifi_chip.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * 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. @@ -14,30 +14,27 @@ * limitations under the License. */ -#include +#include "wifi_chip.h" #include #include #include +#include #include #include #include -#include "hidl_return_util.h" -#include "hidl_struct_util.h" -#include "wifi_chip.h" +#include "aidl_return_util.h" +#include "aidl_struct_util.h" #include "wifi_status_util.h" #define P2P_MGMT_DEVICE_PREFIX "p2p-dev-" namespace { -using android::sp; +using aidl::android::hardware::wifi::IfaceType; +using aidl::android::hardware::wifi::IWifiChip; +using CoexRestriction = aidl::android::hardware::wifi::IWifiChip::CoexRestriction; using android::base::unique_fd; -using android::hardware::hidl_string; -using android::hardware::hidl_vec; -using android::hardware::wifi::V1_0::ChipModeId; -using android::hardware::wifi::V1_0::IfaceType; -using android::hardware::wifi::V1_0::IWifiChip; constexpr char kCpioMagic[] = "070701"; constexpr size_t kMaxBufferSizeBytes = 1024 * 1024 * 3; @@ -50,13 +47,13 @@ constexpr unsigned kMaxWlanIfaces = 5; constexpr char kApBridgeIfacePrefix[] = "ap_br_"; template -void invalidateAndClear(std::vector>& ifaces, sp iface) { +void invalidateAndClear(std::vector>& ifaces, std::shared_ptr iface) { iface->invalidate(); ifaces.erase(std::remove(ifaces.begin(), ifaces.end(), iface), ifaces.end()); } template -void invalidateAndClearAll(std::vector>& ifaces) { +void invalidateAndClearAll(std::vector>& ifaces) { for (const auto& iface : ifaces) { iface->invalidate(); } @@ -64,8 +61,8 @@ void invalidateAndClearAll(std::vector>& ifaces) { } template -std::vector getNames(std::vector>& ifaces) { - std::vector names; +std::vector getNames(std::vector>& ifaces) { + std::vector names; for (const auto& iface : ifaces) { names.emplace_back(iface->getName()); } @@ -73,8 +70,9 @@ std::vector getNames(std::vector>& ifaces) { } template -sp findUsingName(std::vector>& ifaces, const std::string& name) { - std::vector names; +std::shared_ptr findUsingName(std::vector>& ifaces, + const std::string& name) { + std::vector names; for (const auto& iface : ifaces) { if (name == iface->getName()) { return iface; @@ -169,8 +167,8 @@ void setActiveWlanIfaceNameProperty(const std::string& ifname) { } } -// delete files that meet either conditions: -// 1. older than a predefined time in the wifi tombstone dir. +// Delete files that meet either condition: +// 1. Older than a predefined time in the wifi tombstone dir. // 2. Files in excess to a predefined amount, starting from the oldest ones bool removeOldFilesInternal() { time_t now = time(0); @@ -354,15 +352,14 @@ std::vector makeCharVec(const std::string& str) { } // namespace +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { -using hidl_return_util::validateAndCall; -using hidl_return_util::validateAndCallWithLock; +using aidl_return_util::validateAndCall; +using aidl_return_util::validateAndCallWithLock; -WifiChip::WifiChip(ChipId chip_id, bool is_primary, +WifiChip::WifiChip(int32_t chip_id, bool is_primary, const std::weak_ptr legacy_hal, const std::weak_ptr mode_controller, const std::shared_ptr iface_util, @@ -380,6 +377,19 @@ WifiChip::WifiChip(ChipId chip_id, bool is_primary, setActiveWlanIfaceNameProperty(kNoActiveWlanIfaceNamePropertyValue); } +std::shared_ptr WifiChip::create( + int32_t chip_id, bool is_primary, const std::weak_ptr legacy_hal, + const std::weak_ptr mode_controller, + const std::shared_ptr iface_util, + const std::weak_ptr feature_flags, + const std::function& handler) { + std::shared_ptr ptr = ndk::SharedRefBase::make( + chip_id, is_primary, legacy_hal, mode_controller, iface_util, feature_flags, handler); + std::weak_ptr weak_ptr_this(ptr); + ptr->setWeakPtr(weak_ptr_this); + return ptr; +} + void WifiChip::invalidate() { if (!writeRingbufferFilesInternal()) { LOG(ERROR) << "Error writing files to flash"; @@ -391,348 +401,283 @@ void WifiChip::invalidate() { is_valid_ = false; } +void WifiChip::setWeakPtr(std::weak_ptr ptr) { + weak_ptr_this_ = ptr; +} + bool WifiChip::isValid() { return is_valid_; } -std::set> WifiChip::getEventCallbacks() { +std::set> WifiChip::getEventCallbacks() { return event_cb_handler_.getCallbacks(); } -Return WifiChip::getId(getId_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::getId(int32_t* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, &WifiChip::getIdInternal, - hidl_status_cb); + _aidl_return); } -// Deprecated support for this callback -Return WifiChip::registerEventCallback(const sp& event_callback, - registerEventCallback_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::registerEventCallback( + const std::shared_ptr& event_callback) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::registerEventCallbackInternal, hidl_status_cb, - event_callback); + &WifiChip::registerEventCallbackInternal, event_callback); } -Return WifiChip::getCapabilities(getCapabilities_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::getCapabilities(IWifiChip::ChipCapabilityMask* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getCapabilitiesInternal, hidl_status_cb); + &WifiChip::getCapabilitiesInternal, _aidl_return); } -Return WifiChip::getAvailableModes(getAvailableModes_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::getAvailableModes(std::vector* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getAvailableModesInternal, hidl_status_cb); + &WifiChip::getAvailableModesInternal, _aidl_return); } -Return WifiChip::configureChip(ChipModeId mode_id, configureChip_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::configureChip(int32_t in_modeId) { return validateAndCallWithLock(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::configureChipInternal, hidl_status_cb, mode_id); + &WifiChip::configureChipInternal, in_modeId); } -Return WifiChip::getMode(getMode_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::getMode(int32_t* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getModeInternal, hidl_status_cb); + &WifiChip::getModeInternal, _aidl_return); } -Return WifiChip::requestChipDebugInfo(requestChipDebugInfo_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::requestChipDebugInfo(IWifiChip::ChipDebugInfo* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::requestChipDebugInfoInternal, hidl_status_cb); + &WifiChip::requestChipDebugInfoInternal, _aidl_return); } -Return WifiChip::requestDriverDebugDump(requestDriverDebugDump_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::requestDriverDebugDump(std::vector* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::requestDriverDebugDumpInternal, hidl_status_cb); + &WifiChip::requestDriverDebugDumpInternal, _aidl_return); } -Return WifiChip::requestFirmwareDebugDump(requestFirmwareDebugDump_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::requestFirmwareDebugDump(std::vector* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::requestFirmwareDebugDumpInternal, hidl_status_cb); + &WifiChip::requestFirmwareDebugDumpInternal, _aidl_return); } -Return WifiChip::createApIface(createApIface_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::createApIface(std::shared_ptr* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::createApIfaceInternal, hidl_status_cb); + &WifiChip::createApIfaceInternal, _aidl_return); } -Return WifiChip::createBridgedApIface(createBridgedApIface_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::createBridgedApIface(std::shared_ptr* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::createBridgedApIfaceInternal, hidl_status_cb); + &WifiChip::createBridgedApIfaceInternal, _aidl_return); } -Return WifiChip::getApIfaceNames(getApIfaceNames_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::getApIfaceNames(std::vector* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getApIfaceNamesInternal, hidl_status_cb); + &WifiChip::getApIfaceNamesInternal, _aidl_return); } -Return WifiChip::getApIface(const hidl_string& ifname, getApIface_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::getApIface(const std::string& in_ifname, + std::shared_ptr* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getApIfaceInternal, hidl_status_cb, ifname); + &WifiChip::getApIfaceInternal, _aidl_return, in_ifname); } -Return WifiChip::removeApIface(const hidl_string& ifname, removeApIface_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::removeApIface(const std::string& in_ifname) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::removeApIfaceInternal, hidl_status_cb, ifname); + &WifiChip::removeApIfaceInternal, in_ifname); } -Return WifiChip::removeIfaceInstanceFromBridgedApIface( - const hidl_string& ifname, const hidl_string& ifInstanceName, - removeIfaceInstanceFromBridgedApIface_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::removeIfaceInstanceFromBridgedApIface( + const std::string& in_brIfaceName, const std::string& in_ifaceInstanceName) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::removeIfaceInstanceFromBridgedApIfaceInternal, hidl_status_cb, - ifname, ifInstanceName); + &WifiChip::removeIfaceInstanceFromBridgedApIfaceInternal, in_brIfaceName, + in_ifaceInstanceName); } -Return WifiChip::createNanIface(createNanIface_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::createNanIface(std::shared_ptr* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::createNanIfaceInternal, hidl_status_cb); + &WifiChip::createNanIfaceInternal, _aidl_return); } -Return WifiChip::getNanIfaceNames(getNanIfaceNames_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::getNanIfaceNames(std::vector* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getNanIfaceNamesInternal, hidl_status_cb); + &WifiChip::getNanIfaceNamesInternal, _aidl_return); } -Return WifiChip::getNanIface(const hidl_string& ifname, getNanIface_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::getNanIface(const std::string& in_ifname, + std::shared_ptr* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getNanIfaceInternal, hidl_status_cb, ifname); + &WifiChip::getNanIfaceInternal, _aidl_return, in_ifname); } -Return WifiChip::removeNanIface(const hidl_string& ifname, removeNanIface_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::removeNanIface(const std::string& in_ifname) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::removeNanIfaceInternal, hidl_status_cb, ifname); + &WifiChip::removeNanIfaceInternal, in_ifname); } -Return WifiChip::createP2pIface(createP2pIface_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::createP2pIface(std::shared_ptr* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::createP2pIfaceInternal, hidl_status_cb); + &WifiChip::createP2pIfaceInternal, _aidl_return); } -Return WifiChip::getP2pIfaceNames(getP2pIfaceNames_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::getP2pIfaceNames(std::vector* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getP2pIfaceNamesInternal, hidl_status_cb); + &WifiChip::getP2pIfaceNamesInternal, _aidl_return); } -Return WifiChip::getP2pIface(const hidl_string& ifname, getP2pIface_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::getP2pIface(const std::string& in_ifname, + std::shared_ptr* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getP2pIfaceInternal, hidl_status_cb, ifname); + &WifiChip::getP2pIfaceInternal, _aidl_return, in_ifname); } -Return WifiChip::removeP2pIface(const hidl_string& ifname, removeP2pIface_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::removeP2pIface(const std::string& in_ifname) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::removeP2pIfaceInternal, hidl_status_cb, ifname); + &WifiChip::removeP2pIfaceInternal, in_ifname); } -Return WifiChip::createStaIface(createStaIface_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::createStaIface(std::shared_ptr* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::createStaIfaceInternal, hidl_status_cb); + &WifiChip::createStaIfaceInternal, _aidl_return); } -Return WifiChip::getStaIfaceNames(getStaIfaceNames_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::getStaIfaceNames(std::vector* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getStaIfaceNamesInternal, hidl_status_cb); + &WifiChip::getStaIfaceNamesInternal, _aidl_return); } -Return WifiChip::getStaIface(const hidl_string& ifname, getStaIface_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::getStaIface(const std::string& in_ifname, + std::shared_ptr* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getStaIfaceInternal, hidl_status_cb, ifname); + &WifiChip::getStaIfaceInternal, _aidl_return, in_ifname); } -Return WifiChip::removeStaIface(const hidl_string& ifname, removeStaIface_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::removeStaIface(const std::string& in_ifname) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::removeStaIfaceInternal, hidl_status_cb, ifname); + &WifiChip::removeStaIfaceInternal, in_ifname); } -Return WifiChip::createRttController(const sp& bound_iface, - createRttController_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::createRttController( + const std::shared_ptr& in_boundIface, + std::shared_ptr* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::createRttControllerInternal, hidl_status_cb, bound_iface); + &WifiChip::createRttControllerInternal, _aidl_return, in_boundIface); } -Return WifiChip::getDebugRingBuffersStatus(getDebugRingBuffersStatus_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::getDebugRingBuffersStatus( + std::vector* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getDebugRingBuffersStatusInternal, hidl_status_cb); + &WifiChip::getDebugRingBuffersStatusInternal, _aidl_return); } -Return WifiChip::startLoggingToDebugRingBuffer( - const hidl_string& ring_name, WifiDebugRingBufferVerboseLevel verbose_level, - uint32_t max_interval_in_sec, uint32_t min_data_size_in_bytes, - startLoggingToDebugRingBuffer_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::startLoggingToDebugRingBuffer( + const std::string& in_ringName, WifiDebugRingBufferVerboseLevel in_verboseLevel, + int32_t in_maxIntervalInSec, int32_t in_minDataSizeInBytes) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::startLoggingToDebugRingBufferInternal, hidl_status_cb, - ring_name, verbose_level, max_interval_in_sec, min_data_size_in_bytes); + &WifiChip::startLoggingToDebugRingBufferInternal, in_ringName, + in_verboseLevel, in_maxIntervalInSec, in_minDataSizeInBytes); } -Return WifiChip::forceDumpToDebugRingBuffer(const hidl_string& ring_name, - forceDumpToDebugRingBuffer_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::forceDumpToDebugRingBuffer(const std::string& in_ringName) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::forceDumpToDebugRingBufferInternal, hidl_status_cb, - ring_name); + &WifiChip::forceDumpToDebugRingBufferInternal, in_ringName); } -Return WifiChip::flushRingBufferToFile(flushRingBufferToFile_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::flushRingBufferToFile() { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::flushRingBufferToFileInternal, hidl_status_cb); + &WifiChip::flushRingBufferToFileInternal); } -Return WifiChip::stopLoggingToDebugRingBuffer( - stopLoggingToDebugRingBuffer_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::stopLoggingToDebugRingBuffer() { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::stopLoggingToDebugRingBufferInternal, hidl_status_cb); + &WifiChip::stopLoggingToDebugRingBufferInternal); } -Return WifiChip::getDebugHostWakeReasonStats(getDebugHostWakeReasonStats_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::getDebugHostWakeReasonStats( + WifiDebugHostWakeReasonStats* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getDebugHostWakeReasonStatsInternal, hidl_status_cb); + &WifiChip::getDebugHostWakeReasonStatsInternal, _aidl_return); } -Return WifiChip::enableDebugErrorAlerts(bool enable, - enableDebugErrorAlerts_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::enableDebugErrorAlerts(bool in_enable) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::enableDebugErrorAlertsInternal, hidl_status_cb, enable); + &WifiChip::enableDebugErrorAlertsInternal, in_enable); } -Return WifiChip::selectTxPowerScenario(V1_1::IWifiChip::TxPowerScenario scenario, - selectTxPowerScenario_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::selectTxPowerScenario(IWifiChip::TxPowerScenario in_scenario) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::selectTxPowerScenarioInternal, hidl_status_cb, scenario); + &WifiChip::selectTxPowerScenarioInternal, in_scenario); } -Return WifiChip::resetTxPowerScenario(resetTxPowerScenario_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::resetTxPowerScenario() { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::resetTxPowerScenarioInternal, hidl_status_cb); + &WifiChip::resetTxPowerScenarioInternal); } -Return WifiChip::setLatencyMode(LatencyMode mode, setLatencyMode_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::setLatencyMode(IWifiChip::LatencyMode in_mode) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::setLatencyModeInternal, hidl_status_cb, mode); + &WifiChip::setLatencyModeInternal, in_mode); } -Return WifiChip::registerEventCallback_1_2( - const sp& event_callback, - registerEventCallback_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::registerEventCallbackInternal_1_2, hidl_status_cb, - event_callback); -} - -Return WifiChip::selectTxPowerScenario_1_2(TxPowerScenario scenario, - selectTxPowerScenario_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::selectTxPowerScenarioInternal_1_2, hidl_status_cb, scenario); -} - -Return WifiChip::getCapabilities_1_3(getCapabilities_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getCapabilitiesInternal_1_3, hidl_status_cb); -} - -Return WifiChip::getCapabilities_1_5(getCapabilities_1_5_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getCapabilitiesInternal_1_5, hidl_status_cb); -} - -Return WifiChip::debug(const hidl_handle& handle, const hidl_vec&) { - if (handle != nullptr && handle->numFds >= 1) { - { - std::unique_lock lk(lock_t); - for (const auto& item : ringbuffer_map_) { - forceDumpToDebugRingBufferInternal(item.first); - } - // unique_lock unlocked here +binder_status_t WifiChip::dump(int fd, const char**, uint32_t) { + { + std::unique_lock lk(lock_t); + for (const auto& item : ringbuffer_map_) { + forceDumpToDebugRingBufferInternal(item.first); } - usleep(100 * 1000); // sleep for 100 milliseconds to wait for - // ringbuffer updates. - int fd = handle->data[0]; - if (!writeRingbufferFilesInternal()) { - LOG(ERROR) << "Error writing files to flash"; - } - uint32_t n_error = cpioArchiveFilesInDir(fd, kTombstoneFolderPath); - if (n_error != 0) { - LOG(ERROR) << n_error << " errors occured in cpio function"; - } - fsync(fd); - } else { - LOG(ERROR) << "File handle error"; + // unique_lock unlocked here } - return Void(); + usleep(100 * 1000); // sleep for 100 milliseconds to wait for + // ringbuffer updates. + if (!writeRingbufferFilesInternal()) { + LOG(ERROR) << "Error writing files to flash"; + } + uint32_t n_error = cpioArchiveFilesInDir(fd, kTombstoneFolderPath); + if (n_error != 0) { + LOG(ERROR) << n_error << " errors occurred in cpio function"; + } + fsync(fd); + return STATUS_OK; } -Return WifiChip::createRttController_1_4(const sp& bound_iface, - createRttController_1_4_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::setMultiStaPrimaryConnection(const std::string& in_ifName) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::createRttControllerInternal_1_4, hidl_status_cb, bound_iface); + &WifiChip::setMultiStaPrimaryConnectionInternal, in_ifName); } -Return WifiChip::registerEventCallback_1_4( - const sp& event_callback, - registerEventCallback_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::setMultiStaUseCase(IWifiChip::MultiStaUseCase in_useCase) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::registerEventCallbackInternal_1_4, hidl_status_cb, - event_callback); + &WifiChip::setMultiStaUseCaseInternal, in_useCase); } -Return WifiChip::setMultiStaPrimaryConnection( - const hidl_string& ifname, setMultiStaPrimaryConnection_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::setCoexUnsafeChannels( + const std::vector& in_unsafeChannels, + CoexRestriction in_restrictions) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::setMultiStaPrimaryConnectionInternal, hidl_status_cb, ifname); + &WifiChip::setCoexUnsafeChannelsInternal, in_unsafeChannels, + in_restrictions); } -Return WifiChip::setMultiStaUseCase(MultiStaUseCase use_case, - setMultiStaUseCase_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::setMultiStaUseCaseInternal, hidl_status_cb, use_case); -} - -Return WifiChip::setCoexUnsafeChannels(const hidl_vec& unsafeChannels, - hidl_bitfield restrictions, - setCoexUnsafeChannels_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::setCoexUnsafeChannelsInternal, hidl_status_cb, unsafeChannels, - restrictions); -} - -Return WifiChip::setCountryCode(const hidl_array& code, - setCountryCode_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::setCountryCode(const std::array& in_code) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiChip::setCountryCodeInternal, hidl_status_cb, code); + &WifiChip::setCountryCodeInternal, in_code); } -Return WifiChip::getUsableChannels( - WifiBand band, hidl_bitfield ifaceModeMask, - hidl_bitfield filterMask, - getUsableChannels_cb _hidl_cb) { +ndk::ScopedAStatus WifiChip::getUsableChannels(WifiBand in_band, WifiIfaceMode in_ifaceModeMask, + UsableChannelFilter in_filterMask, + std::vector* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getUsableChannelsInternal, _hidl_cb, band, ifaceModeMask, - filterMask); + &WifiChip::getUsableChannelsInternal, _aidl_return, in_band, + in_ifaceModeMask, in_filterMask); } -Return WifiChip::triggerSubsystemRestart(triggerSubsystemRestart_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::triggerSubsystemRestart() { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::triggerSubsystemRestartInternal, hidl_status_cb); + &WifiChip::triggerSubsystemRestartInternal); } -Return WifiChip::createRttController_1_6(const sp& bound_iface, - createRttController_1_6_cb hidl_status_cb) { +ndk::ScopedAStatus WifiChip::getSupportedRadioCombinationsMatrix( + WifiRadioCombinationMatrix* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::createRttControllerInternal_1_6, hidl_status_cb, bound_iface); -} - -Return WifiChip::getUsableChannels_1_6( - WifiBand band, hidl_bitfield ifaceModeMask, - hidl_bitfield filterMask, - getUsableChannels_1_6_cb _hidl_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getUsableChannelsInternal_1_6, _hidl_cb, band, ifaceModeMask, - filterMask); -} - -Return WifiChip::getSupportedRadioCombinationsMatrix( - getSupportedRadioCombinationsMatrix_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getSupportedRadioCombinationsMatrixInternal, hidl_status_cb); -} - -Return WifiChip::getAvailableModes_1_6(getAvailableModes_1_6_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getAvailableModesInternal_1_6, hidl_status_cb); + &WifiChip::getSupportedRadioCombinationsMatrixInternal, _aidl_return); } void WifiChip::invalidateAndRemoveAllIfaces() { @@ -755,7 +700,7 @@ void WifiChip::invalidateAndRemoveDependencies(const std::string& removed_iface_ if (nan_iface->getName() == removed_iface_name) { nan_iface->invalidate(); for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onIfaceRemoved(IfaceType::NAN, removed_iface_name).isOk()) { + if (!callback->onIfaceRemoved(IfaceType::NAN_IFACE, removed_iface_name).isOk()) { LOG(ERROR) << "Failed to invoke onIfaceRemoved callback"; } } @@ -776,89 +721,61 @@ void WifiChip::invalidateAndRemoveDependencies(const std::string& removed_iface_ } } -std::pair WifiChip::getIdInternal() { - return {createWifiStatus(WifiStatusCode::SUCCESS), chip_id_}; +std::pair WifiChip::getIdInternal() { + return {chip_id_, ndk::ScopedAStatus::ok()}; } -WifiStatus WifiChip::registerEventCallbackInternal( - const sp& /* event_callback */) { - // Deprecated support for this callback. - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -std::pair WifiChip::getCapabilitiesInternal() { - // Deprecated support for this callback. - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), 0}; -} - -std::pair> -WifiChip::getAvailableModesInternal() { - // Deprecated support -- use getAvailableModes_1_6 for more granular concurrency combinations. - std::vector modes_1_0 = {}; - for (const auto& mode_1_6 : modes_) { - std::vector combos_1_0; - for (const auto& combo_1_6 : mode_1_6.availableCombinations) { - std::vector limits_1_0; - for (const auto& limit_1_6 : combo_1_6.limits) { - std::vector types_1_0; - for (IfaceConcurrencyType type_1_6 : limit_1_6.types) { - switch (type_1_6) { - case IfaceConcurrencyType::STA: - types_1_0.push_back(IfaceType::STA); - break; - case IfaceConcurrencyType::AP: - types_1_0.push_back(IfaceType::AP); - break; - case IfaceConcurrencyType::AP_BRIDGED: - // Ignore AP_BRIDGED - break; - case IfaceConcurrencyType::P2P: - types_1_0.push_back(IfaceType::P2P); - break; - case IfaceConcurrencyType::NAN: - types_1_0.push_back(IfaceType::NAN); - break; - } - } - if (types_1_0.empty()) { - continue; - } - V1_0::IWifiChip::ChipIfaceCombinationLimit limit_1_0; - limit_1_0.types = hidl_vec(types_1_0); - limit_1_0.maxIfaces = limit_1_6.maxIfaces; - limits_1_0.push_back(limit_1_0); - } - if (limits_1_0.empty()) { - continue; - } - V1_0::IWifiChip::ChipIfaceCombination combo_1_0; - combo_1_0.limits = hidl_vec(limits_1_0); - combos_1_0.push_back(combo_1_0); - } - if (combos_1_0.empty()) { - continue; - } - V1_0::IWifiChip::ChipMode mode_1_0; - mode_1_0.id = mode_1_6.id; - mode_1_0.availableCombinations = hidl_vec(combos_1_0); - modes_1_0.push_back(mode_1_0); +ndk::ScopedAStatus WifiChip::registerEventCallbackInternal( + const std::shared_ptr& event_callback) { + if (!event_cb_handler_.addCallback(event_callback)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); } - return {createWifiStatus(WifiStatusCode::SUCCESS), modes_1_0}; + return ndk::ScopedAStatus::ok(); } -WifiStatus WifiChip::configureChipInternal( - /* NONNULL */ std::unique_lock* lock, ChipModeId mode_id) { +std::pair WifiChip::getCapabilitiesInternal() { + legacy_hal::wifi_error legacy_status; + uint64_t legacy_feature_set; + uint32_t legacy_logger_feature_set; + const auto ifname = getFirstActiveWlanIfaceName(); + std::tie(legacy_status, legacy_feature_set) = + legacy_hal_.lock()->getSupportedFeatureSet(ifname); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {IWifiChip::ChipCapabilityMask{}, createWifiStatusFromLegacyError(legacy_status)}; + } + std::tie(legacy_status, legacy_logger_feature_set) = + legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + // some devices don't support querying logger feature set + legacy_logger_feature_set = 0; + } + uint32_t aidl_caps; + if (!aidl_struct_util::convertLegacyFeaturesToAidlChipCapabilities( + legacy_feature_set, legacy_logger_feature_set, &aidl_caps)) { + return {IWifiChip::ChipCapabilityMask{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {static_cast(aidl_caps), ndk::ScopedAStatus::ok()}; +} + +std::pair, ndk::ScopedAStatus> +WifiChip::getAvailableModesInternal() { + return {modes_, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiChip::configureChipInternal( + /* NONNULL */ std::unique_lock* lock, int32_t mode_id) { if (!isValidModeId(mode_id)) { return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); } if (mode_id == current_mode_id_) { LOG(DEBUG) << "Already in the specified mode " << mode_id; - return createWifiStatus(WifiStatusCode::SUCCESS); + return ndk::ScopedAStatus::ok(); } - WifiStatus status = handleChipConfiguration(lock, mode_id); - if (status.code != WifiStatusCode::SUCCESS) { + ndk::ScopedAStatus status = handleChipConfiguration(lock, mode_id); + if (!status.isOk()) { + WifiStatusCode errorCode = static_cast(status.getServiceSpecificError()); for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onChipReconfigureFailure(status).isOk()) { + if (!callback->onChipReconfigureFailure(errorCode).isOk()) { LOG(ERROR) << "Failed to invoke onChipReconfigureFailure callback"; } } @@ -878,24 +795,24 @@ WifiStatus WifiChip::configureChipInternal( return status; } -std::pair WifiChip::getModeInternal() { +std::pair WifiChip::getModeInternal() { if (!isValidModeId(current_mode_id_)) { - return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), current_mode_id_}; + return {current_mode_id_, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; } - return {createWifiStatus(WifiStatusCode::SUCCESS), current_mode_id_}; + return {current_mode_id_, ndk::ScopedAStatus::ok()}; } -std::pair WifiChip::requestChipDebugInfoInternal() { - V1_4::IWifiChip::ChipDebugInfo result; +std::pair WifiChip::requestChipDebugInfoInternal() { + IWifiChip::ChipDebugInfo result; legacy_hal::wifi_error legacy_status; std::string driver_desc; const auto ifname = getFirstActiveWlanIfaceName(); std::tie(legacy_status, driver_desc) = legacy_hal_.lock()->getDriverVersion(ifname); if (legacy_status != legacy_hal::WIFI_SUCCESS) { LOG(ERROR) << "Failed to get driver version: " << legacyErrorToString(legacy_status); - WifiStatus status = + ndk::ScopedAStatus status = createWifiStatusFromLegacyError(legacy_status, "failed to get driver version"); - return {status, result}; + return {std::move(result), std::move(status)}; } result.driverDescription = driver_desc.c_str(); @@ -903,59 +820,60 @@ std::pair WifiChip::requestChipDebug std::tie(legacy_status, firmware_desc) = legacy_hal_.lock()->getFirmwareVersion(ifname); if (legacy_status != legacy_hal::WIFI_SUCCESS) { LOG(ERROR) << "Failed to get firmware version: " << legacyErrorToString(legacy_status); - WifiStatus status = + ndk::ScopedAStatus status = createWifiStatusFromLegacyError(legacy_status, "failed to get firmware version"); - return {status, result}; + return {std::move(result), std::move(status)}; } result.firmwareDescription = firmware_desc.c_str(); - return {createWifiStatus(WifiStatusCode::SUCCESS), result}; + return {std::move(result), ndk::ScopedAStatus::ok()}; } -std::pair> WifiChip::requestDriverDebugDumpInternal() { +std::pair, ndk::ScopedAStatus> WifiChip::requestDriverDebugDumpInternal() { legacy_hal::wifi_error legacy_status; std::vector driver_dump; std::tie(legacy_status, driver_dump) = legacy_hal_.lock()->requestDriverMemoryDump(getFirstActiveWlanIfaceName()); if (legacy_status != legacy_hal::WIFI_SUCCESS) { LOG(ERROR) << "Failed to get driver debug dump: " << legacyErrorToString(legacy_status); - return {createWifiStatusFromLegacyError(legacy_status), std::vector()}; + return {std::vector(), createWifiStatusFromLegacyError(legacy_status)}; } - return {createWifiStatus(WifiStatusCode::SUCCESS), driver_dump}; + return {driver_dump, ndk::ScopedAStatus::ok()}; } -std::pair> WifiChip::requestFirmwareDebugDumpInternal() { +std::pair, ndk::ScopedAStatus> WifiChip::requestFirmwareDebugDumpInternal() { legacy_hal::wifi_error legacy_status; std::vector firmware_dump; std::tie(legacy_status, firmware_dump) = legacy_hal_.lock()->requestFirmwareMemoryDump(getFirstActiveWlanIfaceName()); if (legacy_status != legacy_hal::WIFI_SUCCESS) { LOG(ERROR) << "Failed to get firmware debug dump: " << legacyErrorToString(legacy_status); - return {createWifiStatusFromLegacyError(legacy_status), {}}; + return {std::vector(), createWifiStatusFromLegacyError(legacy_status)}; } - return {createWifiStatus(WifiStatusCode::SUCCESS), firmware_dump}; + return {firmware_dump, ndk::ScopedAStatus::ok()}; } -WifiStatus WifiChip::createVirtualApInterface(const std::string& apVirtIf) { +ndk::ScopedAStatus WifiChip::createVirtualApInterface(const std::string& apVirtIf) { legacy_hal::wifi_error legacy_status; legacy_status = legacy_hal_.lock()->createVirtualInterface( - apVirtIf, hidl_struct_util::convertHidlIfaceTypeToLegacy(IfaceType::AP)); + apVirtIf, aidl_struct_util::convertAidlIfaceTypeToLegacy(IfaceType::AP)); if (legacy_status != legacy_hal::WIFI_SUCCESS) { LOG(ERROR) << "Failed to add interface: " << apVirtIf << " " << legacyErrorToString(legacy_status); return createWifiStatusFromLegacyError(legacy_status); } - return createWifiStatus(WifiStatusCode::SUCCESS); + return ndk::ScopedAStatus::ok(); } -sp WifiChip::newWifiApIface(std::string& ifname) { +std::shared_ptr WifiChip::newWifiApIface(std::string& ifname) { std::vector ap_instances; for (auto const& it : br_ifaces_ap_instances_) { if (it.first == ifname) { ap_instances = it.second; } } - sp iface = new WifiApIface(ifname, ap_instances, legacy_hal_, iface_util_); + std::shared_ptr iface = + ndk::SharedRefBase::make(ifname, ap_instances, legacy_hal_, iface_util_); ap_ifaces_.push_back(iface); for (const auto& callback : event_cb_handler_.getCallbacks()) { if (!callback->onIfaceAdded(IfaceType::AP, ifname).isOk()) { @@ -966,75 +884,77 @@ sp WifiChip::newWifiApIface(std::string& ifname) { return iface; } -std::pair> WifiChip::createApIfaceInternal() { +std::pair, ndk::ScopedAStatus> WifiChip::createApIfaceInternal() { if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::AP)) { - return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; + return {std::shared_ptr(), + createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; } std::string ifname = allocateApIfaceName(); - WifiStatus status = createVirtualApInterface(ifname); - if (status.code != WifiStatusCode::SUCCESS) { - return {status, {}}; + ndk::ScopedAStatus status = createVirtualApInterface(ifname); + if (!status.isOk()) { + return {std::shared_ptr(), std::move(status)}; } - sp iface = newWifiApIface(ifname); - return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; + std::shared_ptr iface = newWifiApIface(ifname); + return {iface, ndk::ScopedAStatus::ok()}; } -std::pair> WifiChip::createBridgedApIfaceInternal() { +std::pair, ndk::ScopedAStatus> +WifiChip::createBridgedApIfaceInternal() { if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::AP_BRIDGED)) { - return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; } std::vector ap_instances = allocateBridgedApInstanceNames(); if (ap_instances.size() < 2) { LOG(ERROR) << "Fail to allocate two instances"; - return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; } std::string br_ifname = kApBridgeIfacePrefix + ap_instances[0]; for (int i = 0; i < 2; i++) { - WifiStatus status = createVirtualApInterface(ap_instances[i]); - if (status.code != WifiStatusCode::SUCCESS) { + ndk::ScopedAStatus status = createVirtualApInterface(ap_instances[i]); + if (!status.isOk()) { if (i != 0) { // The failure happened when creating second virtual // iface. legacy_hal_.lock()->deleteVirtualInterface( ap_instances.front()); // Remove the first virtual iface. } - return {status, {}}; + return {nullptr, std::move(status)}; } } br_ifaces_ap_instances_[br_ifname] = ap_instances; if (!iface_util_->createBridge(br_ifname)) { LOG(ERROR) << "Failed createBridge - br_name=" << br_ifname.c_str(); - deleteApIface(br_ifname); - return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; + invalidateAndClearBridgedAp(br_ifname); + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; } for (auto const& instance : ap_instances) { // Bind ap instance interface to AP bridge if (!iface_util_->addIfaceToBridge(br_ifname, instance)) { LOG(ERROR) << "Failed add if to Bridge - if_name=" << instance.c_str(); - deleteApIface(br_ifname); - return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; + invalidateAndClearBridgedAp(br_ifname); + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; } } - sp iface = newWifiApIface(br_ifname); - return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; + std::shared_ptr iface = newWifiApIface(br_ifname); + return {iface, ndk::ScopedAStatus::ok()}; } -std::pair> WifiChip::getApIfaceNamesInternal() { +std::pair, ndk::ScopedAStatus> WifiChip::getApIfaceNamesInternal() { if (ap_ifaces_.empty()) { - return {createWifiStatus(WifiStatusCode::SUCCESS), {}}; + return {std::vector(), ndk::ScopedAStatus::ok()}; } - return {createWifiStatus(WifiStatusCode::SUCCESS), getNames(ap_ifaces_)}; + return {getNames(ap_ifaces_), ndk::ScopedAStatus::ok()}; } -std::pair> WifiChip::getApIfaceInternal( +std::pair, ndk::ScopedAStatus> WifiChip::getApIfaceInternal( const std::string& ifname) { const auto iface = findUsingName(ap_ifaces_, ifname); if (!iface.get()) { - return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr}; + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)}; } - return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; + return {iface, ndk::ScopedAStatus::ok()}; } -WifiStatus WifiChip::removeApIfaceInternal(const std::string& ifname) { +ndk::ScopedAStatus WifiChip::removeApIfaceInternal(const std::string& ifname) { const auto iface = findUsingName(ap_ifaces_, ifname); if (!iface.get()) { return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); @@ -1044,7 +964,8 @@ WifiStatus WifiChip::removeApIfaceInternal(const std::string& ifname) { // nan/rtt objects over AP iface. But, there is no harm to do it // here and not make that assumption all over the place. invalidateAndRemoveDependencies(ifname); - deleteApIface(ifname); + // Clear the bridge interface and the iface instance. + invalidateAndClearBridgedAp(ifname); invalidateAndClear(ap_ifaces_, iface); for (const auto& callback : event_cb_handler_.getCallbacks()) { if (!callback->onIfaceRemoved(IfaceType::AP, ifname).isOk()) { @@ -1052,10 +973,10 @@ WifiStatus WifiChip::removeApIfaceInternal(const std::string& ifname) { } } setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); - return createWifiStatus(WifiStatusCode::SUCCESS); + return ndk::ScopedAStatus::ok(); } -WifiStatus WifiChip::removeIfaceInstanceFromBridgedApIfaceInternal( +ndk::ScopedAStatus WifiChip::removeIfaceInstanceFromBridgedApIfaceInternal( const std::string& ifname, const std::string& ifInstanceName) { const auto iface = findUsingName(ap_ifaces_, ifname); if (!iface.get() || ifInstanceName.empty()) { @@ -1092,12 +1013,12 @@ WifiStatus WifiChip::removeIfaceInstanceFromBridgedApIfaceInternal( iface->removeInstance(ifInstanceName); setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); - return createWifiStatus(WifiStatusCode::SUCCESS); + return ndk::ScopedAStatus::ok(); } -std::pair> WifiChip::createNanIfaceInternal() { - if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::NAN)) { - return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; +std::pair, ndk::ScopedAStatus> WifiChip::createNanIfaceInternal() { + if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::NAN_IFACE)) { + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; } bool is_dedicated_iface = true; std::string ifname = getPredefinedNanIfaceName(); @@ -1107,77 +1028,80 @@ std::pair> WifiChip::createNanIfaceInternal( ifname = getFirstActiveWlanIfaceName(); is_dedicated_iface = false; } - sp iface = new WifiNanIface(ifname, is_dedicated_iface, legacy_hal_, iface_util_); + std::shared_ptr iface = + WifiNanIface::create(ifname, is_dedicated_iface, legacy_hal_, iface_util_); nan_ifaces_.push_back(iface); for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onIfaceAdded(IfaceType::NAN, ifname).isOk()) { + if (!callback->onIfaceAdded(IfaceType::NAN_IFACE, ifname).isOk()) { LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; } } - return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; + return {iface, ndk::ScopedAStatus::ok()}; } -std::pair> WifiChip::getNanIfaceNamesInternal() { +std::pair, ndk::ScopedAStatus> WifiChip::getNanIfaceNamesInternal() { if (nan_ifaces_.empty()) { - return {createWifiStatus(WifiStatusCode::SUCCESS), {}}; + return {std::vector(), ndk::ScopedAStatus::ok()}; } - return {createWifiStatus(WifiStatusCode::SUCCESS), getNames(nan_ifaces_)}; + return {getNames(nan_ifaces_), ndk::ScopedAStatus::ok()}; } -std::pair> WifiChip::getNanIfaceInternal( +std::pair, ndk::ScopedAStatus> WifiChip::getNanIfaceInternal( const std::string& ifname) { const auto iface = findUsingName(nan_ifaces_, ifname); if (!iface.get()) { - return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr}; + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)}; } - return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; + return {iface, ndk::ScopedAStatus::ok()}; } -WifiStatus WifiChip::removeNanIfaceInternal(const std::string& ifname) { +ndk::ScopedAStatus WifiChip::removeNanIfaceInternal(const std::string& ifname) { const auto iface = findUsingName(nan_ifaces_, ifname); if (!iface.get()) { return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); } invalidateAndClear(nan_ifaces_, iface); for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onIfaceRemoved(IfaceType::NAN, ifname).isOk()) { + if (!callback->onIfaceRemoved(IfaceType::NAN_IFACE, ifname).isOk()) { LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; } } - return createWifiStatus(WifiStatusCode::SUCCESS); + return ndk::ScopedAStatus::ok(); } -std::pair> WifiChip::createP2pIfaceInternal() { +std::pair, ndk::ScopedAStatus> WifiChip::createP2pIfaceInternal() { if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::P2P)) { - return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; } std::string ifname = getPredefinedP2pIfaceName(); - sp iface = new WifiP2pIface(ifname, legacy_hal_); + std::shared_ptr iface = + ndk::SharedRefBase::make(ifname, legacy_hal_); p2p_ifaces_.push_back(iface); for (const auto& callback : event_cb_handler_.getCallbacks()) { if (!callback->onIfaceAdded(IfaceType::P2P, ifname).isOk()) { LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; } } - return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; + return {iface, ndk::ScopedAStatus::ok()}; } -std::pair> WifiChip::getP2pIfaceNamesInternal() { +std::pair, ndk::ScopedAStatus> WifiChip::getP2pIfaceNamesInternal() { if (p2p_ifaces_.empty()) { - return {createWifiStatus(WifiStatusCode::SUCCESS), {}}; + return {std::vector(), ndk::ScopedAStatus::ok()}; } - return {createWifiStatus(WifiStatusCode::SUCCESS), getNames(p2p_ifaces_)}; + return {getNames(p2p_ifaces_), ndk::ScopedAStatus::ok()}; } -std::pair> WifiChip::getP2pIfaceInternal(const std::string& ifname) { +std::pair, ndk::ScopedAStatus> WifiChip::getP2pIfaceInternal( + const std::string& ifname) { const auto iface = findUsingName(p2p_ifaces_, ifname); if (!iface.get()) { - return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr}; + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)}; } - return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; + return {iface, ndk::ScopedAStatus::ok()}; } -WifiStatus WifiChip::removeP2pIfaceInternal(const std::string& ifname) { +ndk::ScopedAStatus WifiChip::removeP2pIfaceInternal(const std::string& ifname) { const auto iface = findUsingName(p2p_ifaces_, ifname); if (!iface.get()) { return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); @@ -1188,22 +1112,23 @@ WifiStatus WifiChip::removeP2pIfaceInternal(const std::string& ifname) { LOG(ERROR) << "Failed to invoke onIfaceRemoved callback"; } } - return createWifiStatus(WifiStatusCode::SUCCESS); + return ndk::ScopedAStatus::ok(); } -std::pair> WifiChip::createStaIfaceInternal() { +std::pair, ndk::ScopedAStatus> WifiChip::createStaIfaceInternal() { if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::STA)) { - return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; } std::string ifname = allocateStaIfaceName(); legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->createVirtualInterface( - ifname, hidl_struct_util::convertHidlIfaceTypeToLegacy(IfaceType::STA)); + ifname, aidl_struct_util::convertAidlIfaceTypeToLegacy(IfaceType::STA)); if (legacy_status != legacy_hal::WIFI_SUCCESS) { LOG(ERROR) << "Failed to add interface: " << ifname << " " << legacyErrorToString(legacy_status); - return {createWifiStatusFromLegacyError(legacy_status), {}}; + return {nullptr, createWifiStatusFromLegacyError(legacy_status)}; } - sp iface = new WifiStaIface(ifname, legacy_hal_, iface_util_); + std::shared_ptr iface = + ndk::SharedRefBase::make(ifname, legacy_hal_, iface_util_); sta_ifaces_.push_back(iface); for (const auto& callback : event_cb_handler_.getCallbacks()) { if (!callback->onIfaceAdded(IfaceType::STA, ifname).isOk()) { @@ -1211,26 +1136,26 @@ std::pair> WifiChip::createStaIfaceInternal( } } setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); - return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; + return {iface, ndk::ScopedAStatus::ok()}; } -std::pair> WifiChip::getStaIfaceNamesInternal() { +std::pair, ndk::ScopedAStatus> WifiChip::getStaIfaceNamesInternal() { if (sta_ifaces_.empty()) { - return {createWifiStatus(WifiStatusCode::SUCCESS), {}}; + return {std::vector(), ndk::ScopedAStatus::ok()}; } - return {createWifiStatus(WifiStatusCode::SUCCESS), getNames(sta_ifaces_)}; + return {getNames(sta_ifaces_), ndk::ScopedAStatus::ok()}; } -std::pair> WifiChip::getStaIfaceInternal( +std::pair, ndk::ScopedAStatus> WifiChip::getStaIfaceInternal( const std::string& ifname) { const auto iface = findUsingName(sta_ifaces_, ifname); if (!iface.get()) { - return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr}; + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)}; } - return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; + return {iface, ndk::ScopedAStatus::ok()}; } -WifiStatus WifiChip::removeStaIfaceInternal(const std::string& ifname) { +ndk::ScopedAStatus WifiChip::removeStaIfaceInternal(const std::string& ifname) { const auto iface = findUsingName(sta_ifaces_, ifname); if (!iface.get()) { return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); @@ -1249,37 +1174,47 @@ WifiStatus WifiChip::removeStaIfaceInternal(const std::string& ifname) { } } setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); - return createWifiStatus(WifiStatusCode::SUCCESS); + return ndk::ScopedAStatus::ok(); } -std::pair> WifiChip::createRttControllerInternal( - const sp& /*bound_iface*/) { - LOG(ERROR) << "createRttController is not supported on this HAL"; - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; +std::pair, ndk::ScopedAStatus> +WifiChip::createRttControllerInternal(const std::shared_ptr& bound_iface) { + if (sta_ifaces_.size() == 0 && + !canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::STA)) { + LOG(ERROR) << "createRttControllerInternal: Chip cannot support STAs " + "(and RTT by extension)"; + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; + } + std::shared_ptr rtt = + WifiRttController::create(getFirstActiveWlanIfaceName(), bound_iface, legacy_hal_); + rtt_controllers_.emplace_back(rtt); + return {rtt, ndk::ScopedAStatus::ok()}; } -std::pair> +std::pair, ndk::ScopedAStatus> WifiChip::getDebugRingBuffersStatusInternal() { legacy_hal::wifi_error legacy_status; std::vector legacy_ring_buffer_status_vec; std::tie(legacy_status, legacy_ring_buffer_status_vec) = legacy_hal_.lock()->getRingBuffersStatus(getFirstActiveWlanIfaceName()); if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), {}}; + return {std::vector(), + createWifiStatusFromLegacyError(legacy_status)}; } - std::vector hidl_ring_buffer_status_vec; - if (!hidl_struct_util::convertLegacyVectorOfDebugRingBufferStatusToHidl( - legacy_ring_buffer_status_vec, &hidl_ring_buffer_status_vec)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; + std::vector aidl_ring_buffer_status_vec; + if (!aidl_struct_util::convertLegacyVectorOfDebugRingBufferStatusToAidl( + legacy_ring_buffer_status_vec, &aidl_ring_buffer_status_vec)) { + return {std::vector(), + createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_ring_buffer_status_vec}; + return {aidl_ring_buffer_status_vec, ndk::ScopedAStatus::ok()}; } -WifiStatus WifiChip::startLoggingToDebugRingBufferInternal( - const hidl_string& ring_name, WifiDebugRingBufferVerboseLevel verbose_level, +ndk::ScopedAStatus WifiChip::startLoggingToDebugRingBufferInternal( + const std::string& ring_name, WifiDebugRingBufferVerboseLevel verbose_level, uint32_t max_interval_in_sec, uint32_t min_data_size_in_bytes) { - WifiStatus status = registerDebugRingBufferCallback(); - if (status.code != WifiStatusCode::SUCCESS) { + ndk::ScopedAStatus status = registerDebugRingBufferCallback(); + if (!status.isOk()) { return status; } legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startRingBufferLogging( @@ -1290,16 +1225,16 @@ WifiStatus WifiChip::startLoggingToDebugRingBufferInternal( std::pair(ring_name, Ringbuffer(kMaxBufferSizeBytes))); // if verbose logging enabled, turn up HAL daemon logging as well. if (verbose_level < WifiDebugRingBufferVerboseLevel::VERBOSE) { - android::base::SetMinimumLogSeverity(android::base::DEBUG); + ::android::base::SetMinimumLogSeverity(::android::base::DEBUG); } else { - android::base::SetMinimumLogSeverity(android::base::VERBOSE); + ::android::base::SetMinimumLogSeverity(::android::base::VERBOSE); } return createWifiStatusFromLegacyError(legacy_status); } -WifiStatus WifiChip::forceDumpToDebugRingBufferInternal(const hidl_string& ring_name) { - WifiStatus status = registerDebugRingBufferCallback(); - if (status.code != WifiStatusCode::SUCCESS) { +ndk::ScopedAStatus WifiChip::forceDumpToDebugRingBufferInternal(const std::string& ring_name) { + ndk::ScopedAStatus status = registerDebugRingBufferCallback(); + if (!status.isOk()) { return status; } legacy_hal::wifi_error legacy_status = @@ -1308,15 +1243,15 @@ WifiStatus WifiChip::forceDumpToDebugRingBufferInternal(const hidl_string& ring_ return createWifiStatusFromLegacyError(legacy_status); } -WifiStatus WifiChip::flushRingBufferToFileInternal() { +ndk::ScopedAStatus WifiChip::flushRingBufferToFileInternal() { if (!writeRingbufferFilesInternal()) { LOG(ERROR) << "Error writing files to flash"; return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); } - return createWifiStatus(WifiStatusCode::SUCCESS); + return ndk::ScopedAStatus::ok(); } -WifiStatus WifiChip::stopLoggingToDebugRingBufferInternal() { +ndk::ScopedAStatus WifiChip::stopLoggingToDebugRingBufferInternal() { legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->deregisterRingBufferCallbackHandler(getFirstActiveWlanIfaceName()); if (legacy_status == legacy_hal::WIFI_SUCCESS) { @@ -1325,29 +1260,29 @@ WifiStatus WifiChip::stopLoggingToDebugRingBufferInternal() { return createWifiStatusFromLegacyError(legacy_status); } -std::pair +std::pair WifiChip::getDebugHostWakeReasonStatsInternal() { legacy_hal::wifi_error legacy_status; legacy_hal::WakeReasonStats legacy_stats; std::tie(legacy_status, legacy_stats) = legacy_hal_.lock()->getWakeReasonStats(getFirstActiveWlanIfaceName()); if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), {}}; + return {WifiDebugHostWakeReasonStats{}, createWifiStatusFromLegacyError(legacy_status)}; } - WifiDebugHostWakeReasonStats hidl_stats; - if (!hidl_struct_util::convertLegacyWakeReasonStatsToHidl(legacy_stats, &hidl_stats)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; + WifiDebugHostWakeReasonStats aidl_stats; + if (!aidl_struct_util::convertLegacyWakeReasonStatsToAidl(legacy_stats, &aidl_stats)) { + return {WifiDebugHostWakeReasonStats{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_stats}; + return {aidl_stats, ndk::ScopedAStatus::ok()}; } -WifiStatus WifiChip::enableDebugErrorAlertsInternal(bool enable) { +ndk::ScopedAStatus WifiChip::enableDebugErrorAlertsInternal(bool enable) { legacy_hal::wifi_error legacy_status; if (enable) { - android::wp weak_ptr_this(this); + std::weak_ptr weak_ptr_this = weak_ptr_this_; const auto& on_alert_callback = [weak_ptr_this](int32_t error_code, std::vector debug_data) { - const auto shared_ptr_this = weak_ptr_this.promote(); + const auto shared_ptr_this = weak_ptr_this.lock(); if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { LOG(ERROR) << "Callback invoked on an invalid object"; return; @@ -1367,106 +1302,51 @@ WifiStatus WifiChip::enableDebugErrorAlertsInternal(bool enable) { return createWifiStatusFromLegacyError(legacy_status); } -WifiStatus WifiChip::selectTxPowerScenarioInternal(V1_1::IWifiChip::TxPowerScenario scenario) { +ndk::ScopedAStatus WifiChip::selectTxPowerScenarioInternal(IWifiChip::TxPowerScenario scenario) { auto legacy_status = legacy_hal_.lock()->selectTxPowerScenario( getFirstActiveWlanIfaceName(), - hidl_struct_util::convertHidlTxPowerScenarioToLegacy(scenario)); + aidl_struct_util::convertAidlTxPowerScenarioToLegacy(scenario)); return createWifiStatusFromLegacyError(legacy_status); } -WifiStatus WifiChip::resetTxPowerScenarioInternal() { +ndk::ScopedAStatus WifiChip::resetTxPowerScenarioInternal() { auto legacy_status = legacy_hal_.lock()->resetTxPowerScenario(getFirstActiveWlanIfaceName()); return createWifiStatusFromLegacyError(legacy_status); } -WifiStatus WifiChip::setLatencyModeInternal(LatencyMode mode) { +ndk::ScopedAStatus WifiChip::setLatencyModeInternal(IWifiChip::LatencyMode mode) { auto legacy_status = legacy_hal_.lock()->setLatencyMode( - getFirstActiveWlanIfaceName(), hidl_struct_util::convertHidlLatencyModeToLegacy(mode)); + getFirstActiveWlanIfaceName(), aidl_struct_util::convertAidlLatencyModeToLegacy(mode)); return createWifiStatusFromLegacyError(legacy_status); } -WifiStatus WifiChip::registerEventCallbackInternal_1_2( - const sp& /* event_callback */) { - // Deprecated support for this callback. - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiChip::selectTxPowerScenarioInternal_1_2(TxPowerScenario scenario) { - auto legacy_status = legacy_hal_.lock()->selectTxPowerScenario( - getFirstActiveWlanIfaceName(), - hidl_struct_util::convertHidlTxPowerScenarioToLegacy_1_2(scenario)); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair WifiChip::getCapabilitiesInternal_1_3() { - // Deprecated support for this callback. - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), 0}; -} - -std::pair WifiChip::getCapabilitiesInternal_1_5() { - legacy_hal::wifi_error legacy_status; - uint64_t legacy_feature_set; - uint32_t legacy_logger_feature_set; - const auto ifname = getFirstActiveWlanIfaceName(); - std::tie(legacy_status, legacy_feature_set) = - legacy_hal_.lock()->getSupportedFeatureSet(ifname); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), 0}; - } - std::tie(legacy_status, legacy_logger_feature_set) = - legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - // some devices don't support querying logger feature set - legacy_logger_feature_set = 0; - } - uint32_t hidl_caps; - if (!hidl_struct_util::convertLegacyFeaturesToHidlChipCapabilities( - legacy_feature_set, legacy_logger_feature_set, &hidl_caps)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), 0}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps}; -} - -std::pair> WifiChip::createRttControllerInternal_1_4( - const sp& /*bound_iface*/) { - LOG(ERROR) << "createRttController_1_4 is not supported on this HAL"; - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; -} - -WifiStatus WifiChip::registerEventCallbackInternal_1_4( - const sp& event_callback) { - if (!event_cb_handler_.addCallback(event_callback)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -WifiStatus WifiChip::setMultiStaPrimaryConnectionInternal(const std::string& ifname) { +ndk::ScopedAStatus WifiChip::setMultiStaPrimaryConnectionInternal(const std::string& ifname) { auto legacy_status = legacy_hal_.lock()->multiStaSetPrimaryConnection(ifname); return createWifiStatusFromLegacyError(legacy_status); } -WifiStatus WifiChip::setMultiStaUseCaseInternal(MultiStaUseCase use_case) { +ndk::ScopedAStatus WifiChip::setMultiStaUseCaseInternal(IWifiChip::MultiStaUseCase use_case) { auto legacy_status = legacy_hal_.lock()->multiStaSetUseCase( - hidl_struct_util::convertHidlMultiStaUseCaseToLegacy(use_case)); + aidl_struct_util::convertAidlMultiStaUseCaseToLegacy(use_case)); return createWifiStatusFromLegacyError(legacy_status); } -WifiStatus WifiChip::setCoexUnsafeChannelsInternal(std::vector unsafe_channels, - uint32_t restrictions) { +ndk::ScopedAStatus WifiChip::setCoexUnsafeChannelsInternal( + std::vector unsafe_channels, CoexRestriction restrictions) { std::vector legacy_unsafe_channels; - if (!hidl_struct_util::convertHidlVectorOfCoexUnsafeChannelToLegacy(unsafe_channels, + if (!aidl_struct_util::convertAidlVectorOfCoexUnsafeChannelToLegacy(unsafe_channels, &legacy_unsafe_channels)) { return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); } + uint32_t aidl_restrictions = static_cast(restrictions); uint32_t legacy_restrictions = 0; - if (restrictions & CoexRestriction::WIFI_DIRECT) { + if (aidl_restrictions & static_cast(CoexRestriction::WIFI_DIRECT)) { legacy_restrictions |= legacy_hal::wifi_coex_restriction::WIFI_DIRECT; } - if (restrictions & CoexRestriction::SOFTAP) { + if (aidl_restrictions & static_cast(CoexRestriction::SOFTAP)) { legacy_restrictions |= legacy_hal::wifi_coex_restriction::SOFTAP; } - if (restrictions & CoexRestriction::WIFI_AWARE) { + if (aidl_restrictions & static_cast(CoexRestriction::WIFI_AWARE)) { legacy_restrictions |= legacy_hal::wifi_coex_restriction::WIFI_AWARE; } auto legacy_status = @@ -1474,57 +1354,34 @@ WifiStatus WifiChip::setCoexUnsafeChannelsInternal(std::vector& code) { +ndk::ScopedAStatus WifiChip::setCountryCodeInternal(const std::array& code) { auto legacy_status = legacy_hal_.lock()->setCountryCode(getFirstActiveWlanIfaceName(), code); return createWifiStatusFromLegacyError(legacy_status); } -std::pair> WifiChip::getUsableChannelsInternal( - WifiBand /*band*/, uint32_t /*ifaceModeMask*/, uint32_t /*filterMask*/) { - LOG(ERROR) << "getUsableChannels is not supported on this HAL"; - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; -} - -WifiStatus WifiChip::triggerSubsystemRestartInternal() { - auto legacy_status = legacy_hal_.lock()->triggerSubsystemRestart(); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair> WifiChip::createRttControllerInternal_1_6( - const sp& bound_iface) { - if (sta_ifaces_.size() == 0 && - !canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::STA)) { - LOG(ERROR) << "createRttControllerInternal_1_6: Chip cannot support STAs " - "(and RTT by extension)"; - return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; - } - sp rtt = - new WifiRttController(getFirstActiveWlanIfaceName(), bound_iface, legacy_hal_); - rtt_controllers_.emplace_back(rtt); - return {createWifiStatus(WifiStatusCode::SUCCESS), rtt}; -} - -std::pair> WifiChip::getUsableChannelsInternal_1_6( - WifiBand band, uint32_t ifaceModeMask, uint32_t filterMask) { +std::pair, ndk::ScopedAStatus> WifiChip::getUsableChannelsInternal( + WifiBand band, WifiIfaceMode ifaceModeMask, UsableChannelFilter filterMask) { legacy_hal::wifi_error legacy_status; std::vector legacy_usable_channels; std::tie(legacy_status, legacy_usable_channels) = legacy_hal_.lock()->getUsableChannels( - hidl_struct_util::convertHidlWifiBandToLegacyMacBand(band), - hidl_struct_util::convertHidlWifiIfaceModeToLegacy(ifaceModeMask), - hidl_struct_util::convertHidlUsableChannelFilterToLegacy(filterMask)); + aidl_struct_util::convertAidlWifiBandToLegacyMacBand(band), + aidl_struct_util::convertAidlWifiIfaceModeToLegacy( + static_cast(ifaceModeMask)), + aidl_struct_util::convertAidlUsableChannelFilterToLegacy( + static_cast(filterMask))); if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), {}}; + return {std::vector(), createWifiStatusFromLegacyError(legacy_status)}; } - std::vector hidl_usable_channels; - if (!hidl_struct_util::convertLegacyWifiUsableChannelsToHidl(legacy_usable_channels, - &hidl_usable_channels)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; + std::vector aidl_usable_channels; + if (!aidl_struct_util::convertLegacyWifiUsableChannelsToAidl(legacy_usable_channels, + &aidl_usable_channels)) { + return {std::vector(), createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_usable_channels}; + return {aidl_usable_channels, ndk::ScopedAStatus::ok()}; } -std::pair +std::pair WifiChip::getSupportedRadioCombinationsMatrixInternal() { legacy_hal::wifi_error legacy_status; legacy_hal::wifi_radio_combination_matrix* legacy_matrix; @@ -1534,25 +1391,25 @@ WifiChip::getSupportedRadioCombinationsMatrixInternal() { if (legacy_status != legacy_hal::WIFI_SUCCESS) { LOG(ERROR) << "Failed to get SupportedRadioCombinations matrix from legacy HAL: " << legacyErrorToString(legacy_status); - return {createWifiStatusFromLegacyError(legacy_status), {}}; + return {WifiRadioCombinationMatrix{}, createWifiStatusFromLegacyError(legacy_status)}; } - V1_6::WifiRadioCombinationMatrix hidl_matrix; - if (!hidl_struct_util::convertLegacyRadioCombinationsMatrixToHidl(legacy_matrix, - &hidl_matrix)) { - LOG(ERROR) << "Failed convertLegacyRadioCombinationsMatrixToHidl() "; - return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), {}}; + WifiRadioCombinationMatrix aidl_matrix; + if (!aidl_struct_util::convertLegacyRadioCombinationsMatrixToAidl(legacy_matrix, + &aidl_matrix)) { + LOG(ERROR) << "Failed convertLegacyRadioCombinationsMatrixToAidl() "; + return {WifiRadioCombinationMatrix(), createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)}; } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_matrix}; + return {aidl_matrix, ndk::ScopedAStatus::ok()}; } -std::pair> -WifiChip::getAvailableModesInternal_1_6() { - return {createWifiStatus(WifiStatusCode::SUCCESS), modes_}; +ndk::ScopedAStatus WifiChip::triggerSubsystemRestartInternal() { + auto legacy_status = legacy_hal_.lock()->triggerSubsystemRestart(); + return createWifiStatusFromLegacyError(legacy_status); } -WifiStatus WifiChip::handleChipConfiguration( - /* NONNULL */ std::unique_lock* lock, ChipModeId mode_id) { +ndk::ScopedAStatus WifiChip::handleChipConfiguration( + /* NONNULL */ std::unique_lock* lock, int32_t mode_id) { // If the chip is already configured in a different mode, stop // the legacy HAL and then start it after firmware mode change. if (isValidModeId(current_mode_id_)) { @@ -1581,41 +1438,41 @@ WifiStatus WifiChip::handleChipConfiguration( } // Every time the HAL is restarted, we need to register the // radio mode change callback. - WifiStatus status = registerRadioModeChangeCallback(); - if (status.code != WifiStatusCode::SUCCESS) { - // This probably is not a critical failure? + ndk::ScopedAStatus status = registerRadioModeChangeCallback(); + if (!status.isOk()) { + // This is probably not a critical failure? LOG(ERROR) << "Failed to register radio mode change callback"; } // Extract and save the version information into property. - std::pair version_info; + std::pair version_info; version_info = WifiChip::requestChipDebugInfoInternal(); - if (WifiStatusCode::SUCCESS == version_info.first.code) { + if (version_info.second.isOk()) { property_set("vendor.wlan.firmware.version", - version_info.second.firmwareDescription.c_str()); - property_set("vendor.wlan.driver.version", version_info.second.driverDescription.c_str()); + version_info.first.firmwareDescription.c_str()); + property_set("vendor.wlan.driver.version", version_info.first.driverDescription.c_str()); } - return createWifiStatus(WifiStatusCode::SUCCESS); + return ndk::ScopedAStatus::ok(); } -WifiStatus WifiChip::registerDebugRingBufferCallback() { +ndk::ScopedAStatus WifiChip::registerDebugRingBufferCallback() { if (debug_ring_buffer_cb_registered_) { - return createWifiStatus(WifiStatusCode::SUCCESS); + return ndk::ScopedAStatus::ok(); } - android::wp weak_ptr_this(this); + std::weak_ptr weak_ptr_this = weak_ptr_this_; const auto& on_ring_buffer_data_callback = [weak_ptr_this](const std::string& name, const std::vector& data, const legacy_hal::wifi_ring_buffer_status& status) { - const auto shared_ptr_this = weak_ptr_this.promote(); + const auto shared_ptr_this = weak_ptr_this.lock(); if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { LOG(ERROR) << "Callback invoked on an invalid object"; return; } - WifiDebugRingBufferStatus hidl_status; + WifiDebugRingBufferStatus aidl_status; Ringbuffer::AppendStatus appendstatus; - if (!hidl_struct_util::convertLegacyDebugRingBufferStatusToHidl(status, - &hidl_status)) { + if (!aidl_struct_util::convertLegacyDebugRingBufferStatusToAidl(status, + &aidl_status)) { LOG(ERROR) << "Error converting ring buffer status"; return; } @@ -1636,7 +1493,6 @@ WifiStatus WifiChip::registerDebugRingBufferCallback() { shared_ptr_this->writeRingbufferFilesInternal(); return; } - }; legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->registerRingBufferCallbackHandler( getFirstActiveWlanIfaceName(), on_ring_buffer_data_callback); @@ -1647,25 +1503,24 @@ WifiStatus WifiChip::registerDebugRingBufferCallback() { return createWifiStatusFromLegacyError(legacy_status); } -WifiStatus WifiChip::registerRadioModeChangeCallback() { - android::wp weak_ptr_this(this); +ndk::ScopedAStatus WifiChip::registerRadioModeChangeCallback() { + std::weak_ptr weak_ptr_this = weak_ptr_this_; const auto& on_radio_mode_change_callback = [weak_ptr_this](const std::vector& mac_infos) { - const auto shared_ptr_this = weak_ptr_this.promote(); + const auto shared_ptr_this = weak_ptr_this.lock(); if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { LOG(ERROR) << "Callback invoked on an invalid object"; return; } - std::vector hidl_radio_mode_infos; - if (!hidl_struct_util::convertLegacyWifiMacInfosToHidl(mac_infos, - &hidl_radio_mode_infos)) { + std::vector aidl_radio_mode_infos; + if (!aidl_struct_util::convertLegacyWifiMacInfosToAidl(mac_infos, + &aidl_radio_mode_infos)) { LOG(ERROR) << "Error converting wifi mac info"; return; } for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onRadioModeChange_1_4(hidl_radio_mode_infos).isOk()) { - LOG(ERROR) << "Failed to invoke onRadioModeChange_1_4" - << " callback on: " << toString(callback); + if (!callback->onRadioModeChange(aidl_radio_mode_infos).isOk()) { + LOG(ERROR) << "Failed to invoke onRadioModeChange callback"; } } }; @@ -1675,11 +1530,11 @@ WifiStatus WifiChip::registerRadioModeChangeCallback() { return createWifiStatusFromLegacyError(legacy_status); } -std::vector +std::vector WifiChip::getCurrentModeConcurrencyCombinations() { if (!isValidModeId(current_mode_id_)) { LOG(ERROR) << "Chip not configured in a mode yet"; - return {}; + return std::vector(); } for (const auto& mode : modes_) { if (mode.id == current_mode_id_) { @@ -1687,7 +1542,7 @@ WifiChip::getCurrentModeConcurrencyCombinations() { } } CHECK(0) << "Expected to find concurrency combinations for current mode!"; - return {}; + return std::vector(); } // Returns a map indexed by IfaceConcurrencyType with the number of ifaces currently @@ -1707,7 +1562,7 @@ std::map WifiChip::getCurrentConcurrencyCombinatio } iface_counts[IfaceConcurrencyType::AP] = num_ap; iface_counts[IfaceConcurrencyType::AP_BRIDGED] = num_ap_bridged; - iface_counts[IfaceConcurrencyType::NAN] = nan_ifaces_.size(); + iface_counts[IfaceConcurrencyType::NAN_IFACE] = nan_ifaces_.size(); iface_counts[IfaceConcurrencyType::P2P] = p2p_ifaces_.size(); iface_counts[IfaceConcurrencyType::STA] = sta_ifaces_.size(); return iface_counts; @@ -1718,10 +1573,10 @@ std::map WifiChip::getCurrentConcurrencyCombinatio // of each concurrency type in the combination. // This method is a port of HalDeviceManager.expandConcurrencyCombos() from framework. std::vector> WifiChip::expandConcurrencyCombinations( - const V1_6::IWifiChip::ChipConcurrencyCombination& combination) { - uint32_t num_expanded_combos = 1; + const IWifiChip::ChipConcurrencyCombination& combination) { + int32_t num_expanded_combos = 1; for (const auto& limit : combination.limits) { - for (uint32_t i = 0; i < limit.maxIfaces; i++) { + for (int32_t i = 0; i < limit.maxIfaces; i++) { num_expanded_combos *= limit.types.size(); } } @@ -1731,17 +1586,17 @@ std::vector> WifiChip::expandConcurrencyC std::vector> expanded_combos; expanded_combos.resize(num_expanded_combos); for (auto& expanded_combo : expanded_combos) { - for (const auto type : - {IfaceConcurrencyType::AP, IfaceConcurrencyType::AP_BRIDGED, IfaceConcurrencyType::NAN, - IfaceConcurrencyType::P2P, IfaceConcurrencyType::STA}) { + for (const auto type : {IfaceConcurrencyType::AP, IfaceConcurrencyType::AP_BRIDGED, + IfaceConcurrencyType::NAN_IFACE, IfaceConcurrencyType::P2P, + IfaceConcurrencyType::STA}) { expanded_combo[type] = 0; } } - uint32_t span = num_expanded_combos; + int32_t span = num_expanded_combos; for (const auto& limit : combination.limits) { - for (uint32_t i = 0; i < limit.maxIfaces; i++) { + for (int32_t i = 0; i < limit.maxIfaces; i++) { span /= limit.types.size(); - for (uint32_t k = 0; k < num_expanded_combos; ++k) { + for (int32_t k = 0; k < num_expanded_combos; ++k) { const auto iface_type = limit.types[(k / span) % limit.types.size()]; expanded_combos[k][iface_type]++; } @@ -1757,8 +1612,8 @@ bool WifiChip::canExpandedConcurrencyComboSupportConcurrencyTypeWithCurrentTypes // Check if we have space for 1 more iface of |type| in this combo for (const auto type : - {IfaceConcurrencyType::AP, IfaceConcurrencyType::AP_BRIDGED, IfaceConcurrencyType::NAN, - IfaceConcurrencyType::P2P, IfaceConcurrencyType::STA}) { + {IfaceConcurrencyType::AP, IfaceConcurrencyType::AP_BRIDGED, + IfaceConcurrencyType::NAN_IFACE, IfaceConcurrencyType::P2P, IfaceConcurrencyType::STA}) { size_t num_ifaces_needed = current_combo.at(type); if (type == requested_type) { num_ifaces_needed++; @@ -1802,8 +1657,8 @@ bool WifiChip::canExpandedConcurrencyComboSupportConcurrencyCombo( const std::map& req_combo) { // Check if we have space for 1 more |type| in this combo for (const auto type : - {IfaceConcurrencyType::AP, IfaceConcurrencyType::AP_BRIDGED, IfaceConcurrencyType::NAN, - IfaceConcurrencyType::P2P, IfaceConcurrencyType::STA}) { + {IfaceConcurrencyType::AP, IfaceConcurrencyType::AP_BRIDGED, + IfaceConcurrencyType::NAN_IFACE, IfaceConcurrencyType::P2P, IfaceConcurrencyType::STA}) { if (req_combo.count(type) == 0) { // Concurrency type not in the req_combo. continue; @@ -1816,6 +1671,7 @@ bool WifiChip::canExpandedConcurrencyComboSupportConcurrencyCombo( } return true; } + // This method does the following: // a) Enumerate all possible concurrency combos by expanding the current // ChipConcurrencyCombination. @@ -1851,7 +1707,7 @@ bool WifiChip::canCurrentModeSupportConcurrencyType(IfaceConcurrencyType request return canCurrentModeSupportConcurrencyCombo(req_iface_combo); } -bool WifiChip::isValidModeId(ChipModeId mode_id) { +bool WifiChip::isValidModeId(int32_t mode_id) { for (const auto& mode : modes_) { if (mode.id == mode_id) { return true; @@ -2017,28 +1873,21 @@ void WifiChip::invalidateAndClearBridgedApAll() { br_ifaces_ap_instances_.clear(); } -void WifiChip::deleteApIface(const std::string& if_name) { - if (if_name.empty()) return; - // delete bridged interfaces if have +void WifiChip::invalidateAndClearBridgedAp(const std::string& br_name) { + if (br_name.empty()) return; + // delete managed interfaces for (auto const& it : br_ifaces_ap_instances_) { - if (it.first == if_name) { + if (it.first == br_name) { for (auto const& iface : it.second) { - iface_util_->removeIfaceFromBridge(if_name, iface); + iface_util_->removeIfaceFromBridge(br_name, iface); legacy_hal_.lock()->deleteVirtualInterface(iface); } - iface_util_->deleteBridge(if_name); - br_ifaces_ap_instances_.erase(if_name); - // ifname is bridged AP, return here. - return; + iface_util_->deleteBridge(br_name); + br_ifaces_ap_instances_.erase(br_name); + break; } } - - // No bridged AP case, delete AP iface - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->deleteVirtualInterface(if_name); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - LOG(ERROR) << "Failed to remove interface: " << if_name << " " - << legacyErrorToString(legacy_status); - } + return; } bool WifiChip::findUsingNameFromBridgedApInstances(const std::string& name) { @@ -2055,8 +1904,7 @@ bool WifiChip::findUsingNameFromBridgedApInstances(const std::string& name) { return false; } -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/wifi_chip.h b/wifi/aidl/default/wifi_chip.h new file mode 100644 index 0000000000..59eaa4a58c --- /dev/null +++ b/wifi/aidl/default/wifi_chip.h @@ -0,0 +1,287 @@ +/* + * 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. + */ + +#ifndef WIFI_CHIP_H_ +#define WIFI_CHIP_H_ + +#include +#include +#include + +#include +#include +#include + +#include "aidl_callback_util.h" +#include "ringbuffer.h" +#include "wifi_ap_iface.h" +#include "wifi_feature_flags.h" +#include "wifi_legacy_hal.h" +#include "wifi_mode_controller.h" +#include "wifi_nan_iface.h" +#include "wifi_p2p_iface.h" +#include "wifi_rtt_controller.h" +#include "wifi_sta_iface.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { + +/** + * AIDL interface object used to control a Wifi HAL chip instance. + * Since there is only a single chip instance used today, there is no + * identifying handle information stored here. + */ +class WifiChip : public BnWifiChip { + public: + WifiChip(int32_t chip_id, bool is_primary, + const std::weak_ptr legacy_hal, + const std::weak_ptr mode_controller, + const std::shared_ptr iface_util, + const std::weak_ptr feature_flags, + const std::function& subsystemCallbackHandler); + + // Factory method - use instead of default constructor. + static std::shared_ptr create( + int32_t chip_id, bool is_primary, + const std::weak_ptr legacy_hal, + const std::weak_ptr mode_controller, + const std::shared_ptr iface_util, + const std::weak_ptr feature_flags, + const std::function& subsystemCallbackHandler); + + // AIDL does not provide a built-in mechanism to let the server invalidate + // an AIDL interface object after creation. If any client process holds onto + // a reference to the object in their context, any method calls on that + // reference will continue to be directed to the server. + // + // However Wifi HAL needs to control the lifetime of these objects. So, add + // a public |invalidate| method to |WifiChip| and its child objects. This + // will be used to mark an object invalid when either: + // a) Wifi HAL is stopped, or + // b) Wifi Chip is reconfigured. + // + // All AIDL method implementations should check if the object is still + // marked valid before processing them. + void invalidate(); + bool isValid(); + std::set> getEventCallbacks(); + + // AIDL methods exposed. + ndk::ScopedAStatus getId(int32_t* _aidl_return) override; + ndk::ScopedAStatus registerEventCallback( + const std::shared_ptr& in_callback) override; + ndk::ScopedAStatus getCapabilities(IWifiChip::ChipCapabilityMask* _aidl_return) override; + ndk::ScopedAStatus getAvailableModes(std::vector* _aidl_return) override; + ndk::ScopedAStatus configureChip(int32_t in_modeId) override; + ndk::ScopedAStatus getMode(int32_t* _aidl_return) override; + ndk::ScopedAStatus requestChipDebugInfo(IWifiChip::ChipDebugInfo* _aidl_return) override; + ndk::ScopedAStatus requestDriverDebugDump(std::vector* _aidl_return) override; + ndk::ScopedAStatus requestFirmwareDebugDump(std::vector* _aidl_return) override; + ndk::ScopedAStatus createApIface(std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus createBridgedApIface(std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus getApIfaceNames(std::vector* _aidl_return) override; + ndk::ScopedAStatus getApIface(const std::string& in_ifname, + std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus removeApIface(const std::string& in_ifname) override; + ndk::ScopedAStatus removeIfaceInstanceFromBridgedApIface( + const std::string& in_brIfaceName, const std::string& in_ifaceInstanceName) override; + ndk::ScopedAStatus createNanIface(std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus getNanIfaceNames(std::vector* _aidl_return) override; + ndk::ScopedAStatus getNanIface(const std::string& in_ifname, + std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus removeNanIface(const std::string& in_ifname) override; + ndk::ScopedAStatus createP2pIface(std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus getP2pIfaceNames(std::vector* _aidl_return) override; + ndk::ScopedAStatus getP2pIface(const std::string& in_ifname, + std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus removeP2pIface(const std::string& in_ifname) override; + ndk::ScopedAStatus createStaIface(std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus getStaIfaceNames(std::vector* _aidl_return) override; + ndk::ScopedAStatus getStaIface(const std::string& in_ifname, + std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus removeStaIface(const std::string& in_ifname) override; + ndk::ScopedAStatus createRttController( + const std::shared_ptr& in_boundIface, + std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus getDebugRingBuffersStatus( + std::vector* _aidl_return) override; + ndk::ScopedAStatus startLoggingToDebugRingBuffer( + const std::string& in_ringName, WifiDebugRingBufferVerboseLevel in_verboseLevel, + int32_t in_maxIntervalInSec, int32_t in_minDataSizeInBytes) override; + ndk::ScopedAStatus forceDumpToDebugRingBuffer(const std::string& in_ringName) override; + ndk::ScopedAStatus flushRingBufferToFile() override; + ndk::ScopedAStatus stopLoggingToDebugRingBuffer() override; + ndk::ScopedAStatus getDebugHostWakeReasonStats( + WifiDebugHostWakeReasonStats* _aidl_return) override; + ndk::ScopedAStatus enableDebugErrorAlerts(bool in_enable) override; + ndk::ScopedAStatus selectTxPowerScenario(IWifiChip::TxPowerScenario in_scenario) override; + ndk::ScopedAStatus resetTxPowerScenario() override; + ndk::ScopedAStatus setLatencyMode(IWifiChip::LatencyMode in_mode) override; + ndk::ScopedAStatus setMultiStaPrimaryConnection(const std::string& in_ifName) override; + ndk::ScopedAStatus setMultiStaUseCase(IWifiChip::MultiStaUseCase in_useCase) override; + ndk::ScopedAStatus setCoexUnsafeChannels( + const std::vector& in_unsafeChannels, + CoexRestriction in_restrictions) override; + ndk::ScopedAStatus setCountryCode(const std::array& in_code) override; + ndk::ScopedAStatus getUsableChannels(WifiBand in_band, WifiIfaceMode in_ifaceModeMask, + UsableChannelFilter in_filterMask, + std::vector* _aidl_return) override; + ndk::ScopedAStatus triggerSubsystemRestart() override; + ndk::ScopedAStatus getSupportedRadioCombinationsMatrix( + WifiRadioCombinationMatrix* _aidl_return) override; + binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; + + private: + void invalidateAndRemoveAllIfaces(); + // When a STA iface is removed any dependent NAN-ifaces/RTT-controllers are + // invalidated & removed. + void invalidateAndRemoveDependencies(const std::string& removed_iface_name); + + // Corresponding worker functions for the AIDL methods. + std::pair getIdInternal(); + ndk::ScopedAStatus registerEventCallbackInternal( + const std::shared_ptr& event_callback); + std::pair getCapabilitiesInternal(); + std::pair, ndk::ScopedAStatus> getAvailableModesInternal(); + ndk::ScopedAStatus configureChipInternal(std::unique_lock* lock, + int32_t mode_id); + std::pair getModeInternal(); + std::pair requestChipDebugInfoInternal(); + std::pair, ndk::ScopedAStatus> requestDriverDebugDumpInternal(); + std::pair, ndk::ScopedAStatus> requestFirmwareDebugDumpInternal(); + std::shared_ptr newWifiApIface(std::string& ifname); + ndk::ScopedAStatus createVirtualApInterface(const std::string& apVirtIf); + std::pair, ndk::ScopedAStatus> createApIfaceInternal(); + std::pair, ndk::ScopedAStatus> createBridgedApIfaceInternal(); + std::pair, ndk::ScopedAStatus> getApIfaceNamesInternal(); + std::pair, ndk::ScopedAStatus> getApIfaceInternal( + const std::string& ifname); + ndk::ScopedAStatus removeApIfaceInternal(const std::string& ifname); + ndk::ScopedAStatus removeIfaceInstanceFromBridgedApIfaceInternal( + const std::string& brIfaceName, const std::string& ifInstanceName); + std::pair, ndk::ScopedAStatus> createNanIfaceInternal(); + std::pair, ndk::ScopedAStatus> getNanIfaceNamesInternal(); + std::pair, ndk::ScopedAStatus> getNanIfaceInternal( + const std::string& ifname); + ndk::ScopedAStatus removeNanIfaceInternal(const std::string& ifname); + std::pair, ndk::ScopedAStatus> createP2pIfaceInternal(); + std::pair, ndk::ScopedAStatus> getP2pIfaceNamesInternal(); + std::pair, ndk::ScopedAStatus> getP2pIfaceInternal( + const std::string& ifname); + ndk::ScopedAStatus removeP2pIfaceInternal(const std::string& ifname); + std::pair, ndk::ScopedAStatus> createStaIfaceInternal(); + std::pair, ndk::ScopedAStatus> getStaIfaceNamesInternal(); + std::pair, ndk::ScopedAStatus> getStaIfaceInternal( + const std::string& ifname); + ndk::ScopedAStatus removeStaIfaceInternal(const std::string& ifname); + std::pair, ndk::ScopedAStatus> createRttControllerInternal( + const std::shared_ptr& bound_iface); + std::pair, ndk::ScopedAStatus> + getDebugRingBuffersStatusInternal(); + ndk::ScopedAStatus startLoggingToDebugRingBufferInternal( + const std::string& ring_name, WifiDebugRingBufferVerboseLevel verbose_level, + uint32_t max_interval_in_sec, uint32_t min_data_size_in_bytes); + ndk::ScopedAStatus forceDumpToDebugRingBufferInternal(const std::string& ring_name); + ndk::ScopedAStatus flushRingBufferToFileInternal(); + ndk::ScopedAStatus stopLoggingToDebugRingBufferInternal(); + std::pair + getDebugHostWakeReasonStatsInternal(); + ndk::ScopedAStatus enableDebugErrorAlertsInternal(bool enable); + ndk::ScopedAStatus selectTxPowerScenarioInternal(IWifiChip::TxPowerScenario scenario); + ndk::ScopedAStatus resetTxPowerScenarioInternal(); + ndk::ScopedAStatus setLatencyModeInternal(IWifiChip::LatencyMode mode); + ndk::ScopedAStatus setMultiStaPrimaryConnectionInternal(const std::string& ifname); + ndk::ScopedAStatus setMultiStaUseCaseInternal(IWifiChip::MultiStaUseCase use_case); + ndk::ScopedAStatus setCoexUnsafeChannelsInternal( + std::vector unsafe_channels, + CoexRestriction restrictions); + ndk::ScopedAStatus setCountryCodeInternal(const std::array& in_code); + std::pair, ndk::ScopedAStatus> getUsableChannelsInternal( + WifiBand band, WifiIfaceMode ifaceModeMask, UsableChannelFilter filterMask); + ndk::ScopedAStatus handleChipConfiguration(std::unique_lock* lock, + int32_t mode_id); + ndk::ScopedAStatus registerDebugRingBufferCallback(); + ndk::ScopedAStatus registerRadioModeChangeCallback(); + + std::vector getCurrentModeConcurrencyCombinations(); + std::map getCurrentConcurrencyCombination(); + std::vector> expandConcurrencyCombinations( + const ChipConcurrencyCombination& combination); + bool canExpandedConcurrencyComboSupportConcurrencyTypeWithCurrentTypes( + const std::map& expanded_combo, + IfaceConcurrencyType requested_type); + bool canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType requested_type); + bool canExpandedConcurrencyComboSupportConcurrencyCombo( + const std::map& expanded_combo, + const std::map& req_combo); + bool canCurrentModeSupportConcurrencyCombo( + const std::map& req_combo); + bool canCurrentModeSupportConcurrencyType(IfaceConcurrencyType requested_type); + + bool isValidModeId(int32_t mode_id); + bool isStaApConcurrencyAllowedInCurrentMode(); + bool isDualStaConcurrencyAllowedInCurrentMode(); + uint32_t startIdxOfApIface(); + std::string getFirstActiveWlanIfaceName(); + std::string allocateApOrStaIfaceName(IfaceType type, uint32_t start_idx); + std::string allocateApIfaceName(); + std::vector allocateBridgedApInstanceNames(); + std::string allocateStaIfaceName(); + bool writeRingbufferFilesInternal(); + std::string getWlanIfaceNameWithType(IfaceType type, unsigned idx); + void invalidateAndClearBridgedApAll(); + void invalidateAndClearBridgedAp(const std::string& br_name); + bool findUsingNameFromBridgedApInstances(const std::string& name); + ndk::ScopedAStatus triggerSubsystemRestartInternal(); + std::pair + getSupportedRadioCombinationsMatrixInternal(); + void setWeakPtr(std::weak_ptr ptr); + + int32_t chip_id_; + std::weak_ptr legacy_hal_; + std::weak_ptr mode_controller_; + std::shared_ptr iface_util_; + std::vector> ap_ifaces_; + std::vector> nan_ifaces_; + std::vector> p2p_ifaces_; + std::vector> sta_ifaces_; + std::vector> rtt_controllers_; + std::map ringbuffer_map_; + bool is_valid_; + // Members pertaining to chip configuration. + int32_t current_mode_id_; + std::mutex lock_t; + std::vector modes_; + // The legacy ring buffer callback API has only a global callback + // registration mechanism. Use this to check if we have already + // registered a callback. + bool debug_ring_buffer_cb_registered_; + aidl_callback_util::AidlCallbackHandler event_cb_handler_; + std::weak_ptr weak_ptr_this_; + + const std::function subsystemCallbackHandler_; + std::map> br_ifaces_ap_instances_; + DISALLOW_COPY_AND_ASSIGN(WifiChip); +}; + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // WIFI_CHIP_H_ diff --git a/wifi/1.6/default/wifi_feature_flags.cpp b/wifi/aidl/default/wifi_feature_flags.cpp similarity index 59% rename from wifi/1.6/default/wifi_feature_flags.cpp rename to wifi/aidl/default/wifi_feature_flags.cpp index e80a3cdcb6..3c9f042607 100644 --- a/wifi/1.6/default/wifi_feature_flags.cpp +++ b/wifi/aidl/default/wifi_feature_flags.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * 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. @@ -21,17 +21,12 @@ #include "wifi_feature_flags.h" +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { namespace feature_flags { -using V1_0::ChipModeId; -using V1_0::IWifiChip; -using V1_6::IfaceConcurrencyType; - /* The chip may either have a single mode supporting any number of combinations, * or a fixed dual-mode (so it involves firmware loading to switch between * modes) setting. If there is a need to support more modes, it needs to be @@ -41,7 +36,7 @@ using V1_6::IfaceConcurrencyType; * Supported combinations are defined in device's makefile, for example: * WIFI_HAL_INTERFACE_COMBINATIONS := {{{STA, AP}, 1}, {{P2P, NAN}, 1}}, * WIFI_HAL_INTERFACE_COMBINATIONS += {{{STA}, 1}, {{AP}, 2}} - * What means: + * What this means: * Interface concurrency combination 1: 1 STA or AP and 1 P2P or NAN concurrent iface * operations. * Interface concurrency combination 2: 1 STA and 2 AP concurrent iface operations. @@ -71,10 +66,10 @@ using V1_6::IfaceConcurrencyType; */ // clang-format off #ifdef WIFI_HAL_INTERFACE_COMBINATIONS -constexpr ChipModeId kMainModeId = chip_mode_ids::kV3; +constexpr int kMainModeId = chip_mode_ids::kV3; #elif defined(WIFI_HIDL_FEATURE_DUAL_INTERFACE) // former V2 (fixed dual interface) setup expressed as V3 -constexpr ChipModeId kMainModeId = chip_mode_ids::kV3; +constexpr int kMainModeId = chip_mode_ids::kV3; # ifdef WIFI_HIDL_FEATURE_DISABLE_AP # ifdef WIFI_HIDL_FEATURE_AWARE // 1 STA + 1 of (P2P or NAN) @@ -96,7 +91,7 @@ constexpr ChipModeId kMainModeId = chip_mode_ids::kV3; # endif #else // V1 (fixed single interface, dual-mode chip) -constexpr ChipModeId kMainModeId = chip_mode_ids::kV1Sta; +constexpr int kMainModeId = chip_mode_ids::kV1Sta; # ifdef WIFI_HIDL_FEATURE_AWARE // 1 STA + 1 of (P2P or NAN) # define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{P2P, NAN}, 1}} @@ -111,44 +106,35 @@ constexpr ChipModeId kMainModeId = chip_mode_ids::kV1Sta; #endif // clang-format on -/** - * Helper class to convert a collection of combination limits to a combination. - * - * The main point here is to simplify the syntax required by - * WIFI_HAL_INTERFACE_COMBINATIONS. - */ -struct ChipConcurrencyCombination - : public hidl_vec { - ChipConcurrencyCombination( - const std::initializer_list list) - : hidl_vec(list) {} - - operator V1_6::IWifiChip::ChipConcurrencyCombination() const { return {*this}; } - - static hidl_vec make_vec( - const std::initializer_list list) { - return hidl_vec( // - std::begin(list), std::end(list)); +// Convert from the legacy format (used by the WIFI_HAL_INTERFACE_COMBINATIONS +// config variable) to a list of ChipConcurrencyCombination objects. +std::vector legacyToChipConcurrencyComboList( + std::vector> legacyLimits) { + std::vector combos; + for (auto& legacyLimit : legacyLimits) { + IWifiChip::ChipConcurrencyCombination combo = {legacyLimit}; + combos.push_back(combo); } -}; + return combos; +} #define STA IfaceConcurrencyType::STA #define AP IfaceConcurrencyType::AP #define AP_BRIDGED IfaceConcurrencyType::AP_BRIDGED #define P2P IfaceConcurrencyType::P2P -#define NAN IfaceConcurrencyType::NAN -static const std::vector kChipModesPrimary{ - {kMainModeId, ChipConcurrencyCombination::make_vec({WIFI_HAL_INTERFACE_COMBINATIONS})}, +#define NAN IfaceConcurrencyType::NAN_IFACE +static const std::vector kChipModesPrimary{ + {kMainModeId, legacyToChipConcurrencyComboList({WIFI_HAL_INTERFACE_COMBINATIONS})}, #ifdef WIFI_HAL_INTERFACE_COMBINATIONS_AP {chip_mode_ids::kV1Ap, - ChipConcurrencyCombination::make_vec({WIFI_HAL_INTERFACE_COMBINATIONS_AP})}, + legacyToChipConcurrencyComboList({WIFI_HAL_INTERFACE_COMBINATIONS_AP})}, #endif }; -static const std::vector kChipModesSecondary{ +static const std::vector kChipModesSecondary{ #ifdef WIFI_HAL_INTERFACE_COMBINATIONS_SECONDARY_CHIP {chip_mode_ids::kV3, - ChipConcurrencyCombination::make_vec({WIFI_HAL_INTERFACE_COMBINATIONS_SECONDARY_CHIP})}, + legacyToChipConcurrencyComboList({WIFI_HAL_INTERFACE_COMBINATIONS_SECONDARY_CHIP})}, #endif }; @@ -157,50 +143,46 @@ constexpr char kDebugPresetInterfaceCombinationIdxProperty[] = // List of pre-defined concurrency combinations that can be enabled at runtime via // setting the property: "kDebugPresetInterfaceCombinationIdxProperty" to the // corresponding index value. -static const std::vector>> - kDebugChipModes{// Legacy combination - No STA/AP concurrencies. - // 0 - (1 AP) or (1 STA + 1 of (P2P or NAN)) - {"No STA/AP Concurrency", - {{kMainModeId, ChipConcurrencyCombination::make_vec( - {{{{AP}, 1}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}}, +static const std::vector>> kDebugChipModes{ + // Legacy combination - No STA/AP concurrencies. + // 0 - (1 AP) or (1 STA + 1 of (P2P or NAN)) + {"No STA/AP Concurrency", + {{kMainModeId, + legacyToChipConcurrencyComboList({{{{AP}, 1}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}}, - // STA + AP concurrency - // 1 - (1 STA + 1 AP) or (1 STA + 1 of (P2P or NAN)) - {"STA + AP Concurrency", - {{kMainModeId, - ChipConcurrencyCombination::make_vec( - {{{{STA}, 1}, {{AP}, 1}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}}, + // STA + AP concurrency + // 1 - (1 STA + 1 AP) or (1 STA + 1 of (P2P or NAN)) + {"STA + AP Concurrency", + {{kMainModeId, legacyToChipConcurrencyComboList( + {{{{STA}, 1}, {{AP}, 1}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}}, - // STA + STA concurrency - // 2 - (1 STA + 1 AP) or (2 STA + 1 of (P2P or NAN)) - {"Dual STA Concurrency", - {{kMainModeId, - ChipConcurrencyCombination::make_vec( - {{{{STA}, 1}, {{AP}, 1}}, {{{STA}, 2}, {{P2P, NAN}, 1}}})}}}, + // STA + STA concurrency + // 2 - (1 STA + 1 AP) or (2 STA + 1 of (P2P or NAN)) + {"Dual STA Concurrency", + {{kMainModeId, legacyToChipConcurrencyComboList( + {{{{STA}, 1}, {{AP}, 1}}, {{{STA}, 2}, {{P2P, NAN}, 1}}})}}}, - // AP + AP + STA concurrency - // 3 - (1 STA + 2 AP) or (1 STA + 1 of (P2P or NAN)) - {"Dual AP Concurrency", - {{kMainModeId, - ChipConcurrencyCombination::make_vec( - {{{{STA}, 1}, {{AP}, 2}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}}, + // AP + AP + STA concurrency + // 3 - (1 STA + 2 AP) or (1 STA + 1 of (P2P or NAN)) + {"Dual AP Concurrency", + {{kMainModeId, legacyToChipConcurrencyComboList( + {{{{STA}, 1}, {{AP}, 2}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}}, - // STA + STA concurrency and AP + AP + STA concurrency - // 4 - (1 STA + 2 AP) or (2 STA + 1 of (P2P or NAN)) - {"Dual STA & Dual AP Concurrency", - {{kMainModeId, - ChipConcurrencyCombination::make_vec( - {{{{STA}, 1}, {{AP}, 2}}, {{{STA}, 2}, {{P2P, NAN}, 1}}})}}}, + // STA + STA concurrency and AP + AP + STA concurrency + // 4 - (1 STA + 2 AP) or (2 STA + 1 of (P2P or NAN)) + {"Dual STA & Dual AP Concurrency", + {{kMainModeId, legacyToChipConcurrencyComboList( + {{{{STA}, 1}, {{AP}, 2}}, {{{STA}, 2}, {{P2P, NAN}, 1}}})}}}, - // STA + STA concurrency - // 5 - (1 STA + 1 AP (bridged or single) | P2P | NAN), or (2 STA)) - {"Dual STA or STA plus single other interface", - {{kMainModeId, ChipConcurrencyCombination::make_vec( - {{{{STA}, 1}, {{P2P, NAN, AP, AP_BRIDGED}, 1}}, - {{{STA}, 2}}})}}}}; + // STA + STA concurrency + // 5 - (1 STA + 1 AP (bridged or single) | P2P | NAN), or (2 STA)) + {"Dual STA or STA plus single other interface", + {{kMainModeId, legacyToChipConcurrencyComboList( + {{{{STA}, 1}, {{P2P, NAN, AP, AP_BRIDGED}, 1}}, {{{STA}, 2}}})}}}}; #undef STA #undef AP +#undef AP_BRIDGED #undef P2P #undef NAN @@ -214,7 +196,7 @@ static const std::vector WifiFeatureFlags::getChipModesForPrimary() { +std::vector WifiFeatureFlags::getChipModesForPrimary() { std::array buffer; auto res = property_get(kDebugPresetInterfaceCombinationIdxProperty, buffer.data(), nullptr); // Debug property not set, use the device preset concurrency combination. @@ -228,20 +210,19 @@ std::vector WifiFeatureFlags::getChipModesForPrimary( return kChipModesPrimary; } std::string name; - std::vector chip_modes; + std::vector chip_modes; std::tie(name, chip_modes) = kDebugChipModes[idx]; LOG(INFO) << "Using debug chip mode: <" << name << "> set via property: " << kDebugPresetInterfaceCombinationIdxProperty; return chip_modes; } -std::vector WifiFeatureFlags::getChipModes(bool is_primary) { +std::vector WifiFeatureFlags::getChipModes(bool is_primary) { return (is_primary) ? getChipModesForPrimary() : kChipModesSecondary; } } // namespace feature_flags -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl diff --git a/wifi/1.6/default/wifi_feature_flags.h b/wifi/aidl/default/wifi_feature_flags.h similarity index 67% rename from wifi/1.6/default/wifi_feature_flags.h rename to wifi/aidl/default/wifi_feature_flags.h index 1635341e3f..af1b6a674d 100644 --- a/wifi/1.6/default/wifi_feature_flags.h +++ b/wifi/aidl/default/wifi_feature_flags.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * 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. @@ -17,24 +17,23 @@ #ifndef WIFI_FEATURE_FLAGS_H_ #define WIFI_FEATURE_FLAGS_H_ -#include +#include +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { namespace feature_flags { namespace chip_mode_ids { // These mode ID's should be unique (even across combo versions). Refer to -// handleChipConfiguration() for it's usage. -constexpr V1_0::ChipModeId kInvalid = UINT32_MAX; +// handleChipConfiguration() for its usage. +constexpr uint32_t kInvalid = UINT32_MAX; // Mode ID's for V1 -constexpr V1_0::ChipModeId kV1Sta = 0; -constexpr V1_0::ChipModeId kV1Ap = 1; +constexpr uint32_t kV1Sta = 0; +constexpr uint32_t kV1Ap = 1; // Mode ID for V3 -constexpr V1_0::ChipModeId kV3 = 3; +constexpr uint32_t kV3 = 3; } // namespace chip_mode_ids class WifiFeatureFlags { @@ -42,17 +41,16 @@ class WifiFeatureFlags { WifiFeatureFlags(); virtual ~WifiFeatureFlags() = default; - virtual std::vector getChipModes(bool is_primary); + virtual std::vector getChipModes(bool is_primary); private: - std::vector getChipModesForPrimary(); + std::vector getChipModesForPrimary(); }; } // namespace feature_flags -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl #endif // WIFI_FEATURE_FLAGS_H_ diff --git a/wifi/1.6/default/wifi_iface_util.cpp b/wifi/aidl/default/wifi_iface_util.cpp similarity index 95% rename from wifi/1.6/default/wifi_iface_util.cpp rename to wifi/aidl/default/wifi_iface_util.cpp index d55e4f8251..f788217dcf 100644 --- a/wifi/1.6/default/wifi_iface_util.cpp +++ b/wifi/aidl/default/wifi_iface_util.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 The Android Open Source Project + * 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. @@ -14,33 +14,32 @@ * limitations under the License. */ +#include +#include #include +#include + #include #include #include #include -#include -#include -#include - -#undef NAN #include "wifi_iface_util.h" namespace { // Constants to set the local bit & clear the multicast bit. constexpr uint8_t kMacAddressMulticastMask = 0x01; constexpr uint8_t kMacAddressLocallyAssignedMask = 0x02; + } // namespace +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { namespace iface_util { -WifiIfaceUtil::WifiIfaceUtil(const std::weak_ptr iface_tool, +WifiIfaceUtil::WifiIfaceUtil(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, const std::weak_ptr legacy_hal) : iface_tool_(iface_tool), legacy_hal_(legacy_hal), @@ -169,8 +168,7 @@ bool WifiIfaceUtil::removeIfaceFromBridge(const std::string& br_name, const std: } } // namespace iface_util -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl diff --git a/wifi/1.6/default/wifi_iface_util.h b/wifi/aidl/default/wifi_iface_util.h similarity index 89% rename from wifi/1.6/default/wifi_iface_util.h rename to wifi/aidl/default/wifi_iface_util.h index c5db5deed1..a3236a5622 100644 --- a/wifi/1.6/default/wifi_iface_util.h +++ b/wifi/aidl/default/wifi_iface_util.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 The Android Open Source Project + * 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. @@ -17,17 +17,15 @@ #ifndef WIFI_IFACE_UTIL_H_ #define WIFI_IFACE_UTIL_H_ +#include #include -#include - #include "wifi_legacy_hal.h" +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { namespace iface_util { // Iface event handlers. @@ -42,7 +40,7 @@ struct IfaceEventHandlers { */ class WifiIfaceUtil { public: - WifiIfaceUtil(const std::weak_ptr iface_tool, + WifiIfaceUtil(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, const std::weak_ptr legacy_hal); virtual ~WifiIfaceUtil() = default; @@ -71,17 +69,16 @@ class WifiIfaceUtil { virtual std::array createRandomMacAddress(); private: - std::weak_ptr iface_tool_; + std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool_; std::weak_ptr legacy_hal_; std::unique_ptr> random_mac_address_; std::map event_handlers_map_; }; } // namespace iface_util -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl #endif // WIFI_IFACE_UTIL_H_ diff --git a/wifi/1.6/default/wifi_legacy_hal.cpp b/wifi/aidl/default/wifi_legacy_hal.cpp similarity index 94% rename from wifi/1.6/default/wifi_legacy_hal.cpp rename to wifi/aidl/default/wifi_legacy_hal.cpp index 43cb7c42a1..43e73cae9f 100644 --- a/wifi/1.6/default/wifi_legacy_hal.cpp +++ b/wifi/aidl/default/wifi_legacy_hal.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * 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. @@ -14,15 +14,16 @@ * limitations under the License. */ -#include -#include +#include "wifi_legacy_hal.h" #include #include #include -#include "hidl_sync_util.h" -#include "wifi_legacy_hal.h" +#include +#include + +#include "aidl_sync_util.h" #include "wifi_legacy_hal_stubs.h" namespace { @@ -38,7 +39,7 @@ static constexpr uint32_t kMaxWakeReasonStatsArraySize = 32; static constexpr uint32_t kMaxRingBuffers = 10; static constexpr uint32_t kMaxWifiUsableChannels = 256; static constexpr uint32_t kMaxSupportedRadioCombinationsMatrixLength = 256; -// need a long timeout (1000ms) for chips that unload their driver. +// Need a long timeout (1000ms) for chips that unload their driver. static constexpr uint32_t kMaxStopCompleteWaitMs = 1000; static constexpr char kDriverPropName[] = "wlan.driver.status"; @@ -51,11 +52,10 @@ std::vector makeCharVec(const std::string& str) { } } // namespace +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { namespace legacy_hal { // Legacy HAL functions accept "C" style function pointers, so use global @@ -65,7 +65,7 @@ namespace legacy_hal { // Callback to be invoked once |stop| is complete std::function on_stop_complete_internal_callback; void onAsyncStopComplete(wifi_handle handle) { - const auto lock = hidl_sync_util::acquireGlobalLock(); + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_stop_complete_internal_callback) { on_stop_complete_internal_callback(handle); // Invalidate this callback since we don't want this firing again. @@ -92,7 +92,7 @@ void onSyncFirmwareMemoryDump(char* buffer, int buffer_size) { // Callback to be invoked for Gscan events. std::function on_gscan_event_internal_callback; void onAsyncGscanEvent(wifi_request_id id, wifi_scan_event event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_gscan_event_internal_callback) { on_gscan_event_internal_callback(id, event); } @@ -103,7 +103,7 @@ std::function on_gscan_full_result_internal_callback; void onAsyncGscanFullResult(wifi_request_id id, wifi_scan_result* result, uint32_t buckets_scanned) { - const auto lock = hidl_sync_util::acquireGlobalLock(); + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_gscan_full_result_internal_callback) { on_gscan_full_result_internal_callback(id, result, buckets_scanned); } @@ -123,7 +123,7 @@ void onSyncLinkLayerStatsResult(wifi_request_id id, wifi_iface_stat* iface_stat, std::function on_rssi_threshold_breached_internal_callback; void onAsyncRssiThresholdBreached(wifi_request_id id, uint8_t* bssid, int8_t rssi) { - const auto lock = hidl_sync_util::acquireGlobalLock(); + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_rssi_threshold_breached_internal_callback) { on_rssi_threshold_breached_internal_callback(id, bssid, rssi); } @@ -134,7 +134,7 @@ std::function on_ring_buffer_data_internal_callback; void onAsyncRingBufferData(char* ring_name, char* buffer, int buffer_size, wifi_ring_buffer_status* status) { - const auto lock = hidl_sync_util::acquireGlobalLock(); + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_ring_buffer_data_internal_callback) { on_ring_buffer_data_internal_callback(ring_name, buffer, buffer_size, status); } @@ -143,7 +143,7 @@ void onAsyncRingBufferData(char* ring_name, char* buffer, int buffer_size, // Callback to be invoked for error alert indication. std::function on_error_alert_internal_callback; void onAsyncErrorAlert(wifi_request_id id, char* buffer, int buffer_size, int err_code) { - const auto lock = hidl_sync_util::acquireGlobalLock(); + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_error_alert_internal_callback) { on_error_alert_internal_callback(id, buffer, buffer_size, err_code); } @@ -153,7 +153,7 @@ void onAsyncErrorAlert(wifi_request_id id, char* buffer, int buffer_size, int er std::function on_radio_mode_change_internal_callback; void onAsyncRadioModeChange(wifi_request_id id, uint32_t num_macs, wifi_mac_info* mac_infos) { - const auto lock = hidl_sync_util::acquireGlobalLock(); + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_radio_mode_change_internal_callback) { on_radio_mode_change_internal_callback(id, num_macs, mac_infos); } @@ -162,7 +162,7 @@ void onAsyncRadioModeChange(wifi_request_id id, uint32_t num_macs, wifi_mac_info // Callback to be invoked to report subsystem restart std::function on_subsystem_restart_internal_callback; void onAsyncSubsystemRestart(const char* error) { - const auto lock = hidl_sync_util::acquireGlobalLock(); + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_subsystem_restart_internal_callback) { on_subsystem_restart_internal_callback(error); } @@ -172,7 +172,7 @@ void onAsyncSubsystemRestart(const char* error) { std::function on_rtt_results_internal_callback; void onAsyncRttResults(wifi_request_id id, unsigned num_results, wifi_rtt_result* rtt_results[]) { - const auto lock = hidl_sync_util::acquireGlobalLock(); + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_rtt_results_internal_callback) { on_rtt_results_internal_callback(id, num_results, rtt_results); on_rtt_results_internal_callback = nullptr; @@ -184,37 +184,37 @@ void onAsyncRttResults(wifi_request_id id, unsigned num_results, wifi_rtt_result // callbacks. // So, handle all of them here directly to avoid adding an unnecessary layer. std::function on_nan_notify_response_user_callback; -void onAysncNanNotifyResponse(transaction_id id, NanResponseMsg* msg) { - const auto lock = hidl_sync_util::acquireGlobalLock(); +void onAsyncNanNotifyResponse(transaction_id id, NanResponseMsg* msg) { + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_nan_notify_response_user_callback && msg) { on_nan_notify_response_user_callback(id, *msg); } } std::function on_nan_event_publish_replied_user_callback; -void onAysncNanEventPublishReplied(NanPublishRepliedInd* /* event */) { - LOG(ERROR) << "onAysncNanEventPublishReplied triggered"; +void onAsyncNanEventPublishReplied(NanPublishRepliedInd* /* event */) { + LOG(ERROR) << "onAsyncNanEventPublishReplied triggered"; } std::function on_nan_event_publish_terminated_user_callback; -void onAysncNanEventPublishTerminated(NanPublishTerminatedInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); +void onAsyncNanEventPublishTerminated(NanPublishTerminatedInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_nan_event_publish_terminated_user_callback && event) { on_nan_event_publish_terminated_user_callback(*event); } } std::function on_nan_event_match_user_callback; -void onAysncNanEventMatch(NanMatchInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); +void onAsyncNanEventMatch(NanMatchInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_nan_event_match_user_callback && event) { on_nan_event_match_user_callback(*event); } } std::function on_nan_event_match_expired_user_callback; -void onAysncNanEventMatchExpired(NanMatchExpiredInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); +void onAsyncNanEventMatchExpired(NanMatchExpiredInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_nan_event_match_expired_user_callback && event) { on_nan_event_match_expired_user_callback(*event); } @@ -222,95 +222,95 @@ void onAysncNanEventMatchExpired(NanMatchExpiredInd* event) { std::function on_nan_event_subscribe_terminated_user_callback; -void onAysncNanEventSubscribeTerminated(NanSubscribeTerminatedInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); +void onAsyncNanEventSubscribeTerminated(NanSubscribeTerminatedInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_nan_event_subscribe_terminated_user_callback && event) { on_nan_event_subscribe_terminated_user_callback(*event); } } std::function on_nan_event_followup_user_callback; -void onAysncNanEventFollowup(NanFollowupInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); +void onAsyncNanEventFollowup(NanFollowupInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_nan_event_followup_user_callback && event) { on_nan_event_followup_user_callback(*event); } } std::function on_nan_event_disc_eng_event_user_callback; -void onAysncNanEventDiscEngEvent(NanDiscEngEventInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); +void onAsyncNanEventDiscEngEvent(NanDiscEngEventInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_nan_event_disc_eng_event_user_callback && event) { on_nan_event_disc_eng_event_user_callback(*event); } } std::function on_nan_event_disabled_user_callback; -void onAysncNanEventDisabled(NanDisabledInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); +void onAsyncNanEventDisabled(NanDisabledInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_nan_event_disabled_user_callback && event) { on_nan_event_disabled_user_callback(*event); } } std::function on_nan_event_tca_user_callback; -void onAysncNanEventTca(NanTCAInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); +void onAsyncNanEventTca(NanTCAInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_nan_event_tca_user_callback && event) { on_nan_event_tca_user_callback(*event); } } std::function on_nan_event_beacon_sdf_payload_user_callback; -void onAysncNanEventBeaconSdfPayload(NanBeaconSdfPayloadInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); +void onAsyncNanEventBeaconSdfPayload(NanBeaconSdfPayloadInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_nan_event_beacon_sdf_payload_user_callback && event) { on_nan_event_beacon_sdf_payload_user_callback(*event); } } std::function on_nan_event_data_path_request_user_callback; -void onAysncNanEventDataPathRequest(NanDataPathRequestInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); +void onAsyncNanEventDataPathRequest(NanDataPathRequestInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_nan_event_data_path_request_user_callback && event) { on_nan_event_data_path_request_user_callback(*event); } } std::function on_nan_event_data_path_confirm_user_callback; -void onAysncNanEventDataPathConfirm(NanDataPathConfirmInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); +void onAsyncNanEventDataPathConfirm(NanDataPathConfirmInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_nan_event_data_path_confirm_user_callback && event) { on_nan_event_data_path_confirm_user_callback(*event); } } std::function on_nan_event_data_path_end_user_callback; -void onAysncNanEventDataPathEnd(NanDataPathEndInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); +void onAsyncNanEventDataPathEnd(NanDataPathEndInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_nan_event_data_path_end_user_callback && event) { on_nan_event_data_path_end_user_callback(*event); } } std::function on_nan_event_transmit_follow_up_user_callback; -void onAysncNanEventTransmitFollowUp(NanTransmitFollowupInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); +void onAsyncNanEventTransmitFollowUp(NanTransmitFollowupInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_nan_event_transmit_follow_up_user_callback && event) { on_nan_event_transmit_follow_up_user_callback(*event); } } std::function on_nan_event_range_request_user_callback; -void onAysncNanEventRangeRequest(NanRangeRequestInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); +void onAsyncNanEventRangeRequest(NanRangeRequestInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_nan_event_range_request_user_callback && event) { on_nan_event_range_request_user_callback(*event); } } std::function on_nan_event_range_report_user_callback; -void onAysncNanEventRangeReport(NanRangeReportInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); +void onAsyncNanEventRangeReport(NanRangeReportInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_nan_event_range_report_user_callback && event) { on_nan_event_range_report_user_callback(*event); } @@ -318,7 +318,7 @@ void onAysncNanEventRangeReport(NanRangeReportInd* event) { std::function on_nan_event_schedule_update_user_callback; void onAsyncNanEventScheduleUpdate(NanDataPathScheduleUpdateInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_nan_event_schedule_update_user_callback && event) { on_nan_event_schedule_update_user_callback(*event); } @@ -327,7 +327,7 @@ void onAsyncNanEventScheduleUpdate(NanDataPathScheduleUpdateInd* event) { // Callbacks for the various TWT operations. std::function on_twt_event_setup_response_callback; void onAsyncTwtEventSetupResponse(TwtSetupResponse* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_twt_event_setup_response_callback && event) { on_twt_event_setup_response_callback(*event); } @@ -335,7 +335,7 @@ void onAsyncTwtEventSetupResponse(TwtSetupResponse* event) { std::function on_twt_event_teardown_completion_callback; void onAsyncTwtEventTeardownCompletion(TwtTeardownCompletion* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_twt_event_teardown_completion_callback && event) { on_twt_event_teardown_completion_callback(*event); } @@ -343,7 +343,7 @@ void onAsyncTwtEventTeardownCompletion(TwtTeardownCompletion* event) { std::function on_twt_event_info_frame_received_callback; void onAsyncTwtEventInfoFrameReceived(TwtInfoFrameReceived* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_twt_event_info_frame_received_callback && event) { on_twt_event_info_frame_received_callback(*event); } @@ -351,7 +351,7 @@ void onAsyncTwtEventInfoFrameReceived(TwtInfoFrameReceived* event) { std::function on_twt_event_device_notify_callback; void onAsyncTwtEventDeviceNotify(TwtDeviceNotify* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_twt_event_device_notify_callback && event) { on_twt_event_device_notify_callback(*event); } @@ -360,7 +360,7 @@ void onAsyncTwtEventDeviceNotify(TwtDeviceNotify* event) { // Callback to report current CHRE NAN state std::function on_chre_nan_rtt_internal_callback; void onAsyncChreNanRttState(chre_nan_rtt_state state) { - const auto lock = hidl_sync_util::acquireGlobalLock(); + const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_chre_nan_rtt_internal_callback) { on_chre_nan_rtt_internal_callback(state); } @@ -376,7 +376,7 @@ void onSyncCachedScanResults(wifi_cached_scan_report* cache_report) { // End of the free-standing "C" style callbacks. -WifiLegacyHal::WifiLegacyHal(const std::weak_ptr iface_tool, +WifiLegacyHal::WifiLegacyHal(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, const wifi_hal_fn& fn, bool is_primary) : global_func_table_(fn), global_handle_(nullptr), @@ -769,7 +769,7 @@ wifi_error WifiLegacyHal::startRssiMonitoring( if (!bssid_ptr) { return; } - std::array bssid_arr; + std::array bssid_arr; // |bssid_ptr| pointer is assumed to have 6 bytes for the mac // address. std::copy(bssid_ptr, bssid_ptr + 6, std::begin(bssid_arr)); @@ -820,12 +820,12 @@ wifi_error WifiLegacyHal::configureNdOffload(const std::string& iface_name, bool return global_func_table_.wifi_configure_nd_offload(getIfaceHandle(iface_name), enable); } -wifi_error WifiLegacyHal::startSendingOffloadedPacket(const std::string& iface_name, - uint32_t cmd_id, uint16_t ether_type, +wifi_error WifiLegacyHal::startSendingOffloadedPacket(const std::string& iface_name, int32_t cmd_id, + uint16_t ether_type, const std::vector& ip_packet_data, const std::array& src_address, const std::array& dst_address, - uint32_t period_in_ms) { + int32_t period_in_ms) { std::vector ip_packet_data_internal(ip_packet_data); std::vector src_address_internal(src_address.data(), src_address.data() + src_address.size()); @@ -1120,14 +1120,15 @@ wifi_error WifiLegacyHal::startRttRangeRequest( wifi_error WifiLegacyHal::cancelRttRangeRequest( const std::string& iface_name, wifi_request_id id, - const std::vector>& mac_addrs) { + const std::vector>& mac_addrs) { if (!on_rtt_results_internal_callback) { return WIFI_ERROR_NOT_AVAILABLE; } - static_assert(sizeof(mac_addr) == sizeof(std::array), "MAC address size mismatch"); + static_assert(sizeof(mac_addr) == sizeof(std::array), + "MAC address size mismatch"); // TODO: How do we handle partial cancels (i.e only a subset of enabled mac // addressed are cancelled). - std::vector> mac_addrs_internal(mac_addrs); + std::vector> mac_addrs_internal(mac_addrs); wifi_error status = global_func_table_.wifi_rtt_range_cancel( id, getIfaceHandle(iface_name), mac_addrs.size(), reinterpret_cast(mac_addrs_internal.data())); @@ -1202,14 +1203,14 @@ wifi_error WifiLegacyHal::nanRegisterCallbackHandlers(const std::string& iface_n return global_func_table_.wifi_nan_register_handler( getIfaceHandle(iface_name), - {onAysncNanNotifyResponse, onAysncNanEventPublishReplied, - onAysncNanEventPublishTerminated, onAysncNanEventMatch, onAysncNanEventMatchExpired, - onAysncNanEventSubscribeTerminated, onAysncNanEventFollowup, - onAysncNanEventDiscEngEvent, onAysncNanEventDisabled, onAysncNanEventTca, - onAysncNanEventBeaconSdfPayload, onAysncNanEventDataPathRequest, - onAysncNanEventDataPathConfirm, onAysncNanEventDataPathEnd, - onAysncNanEventTransmitFollowUp, onAysncNanEventRangeRequest, - onAysncNanEventRangeReport, onAsyncNanEventScheduleUpdate}); + {onAsyncNanNotifyResponse, onAsyncNanEventPublishReplied, + onAsyncNanEventPublishTerminated, onAsyncNanEventMatch, onAsyncNanEventMatchExpired, + onAsyncNanEventSubscribeTerminated, onAsyncNanEventFollowup, + onAsyncNanEventDiscEngEvent, onAsyncNanEventDisabled, onAsyncNanEventTca, + onAsyncNanEventBeaconSdfPayload, onAsyncNanEventDataPathRequest, + onAsyncNanEventDataPathConfirm, onAsyncNanEventDataPathEnd, + onAsyncNanEventTransmitFollowUp, onAsyncNanEventRangeRequest, + onAsyncNanEventRangeReport, onAsyncNanEventScheduleUpdate}); } wifi_error WifiLegacyHal::nanEnableRequest(const std::string& iface_name, transaction_id id, @@ -1340,7 +1341,7 @@ wifi_error WifiLegacyHal::nanDataEnd(const std::string& iface_name, transaction_ } wifi_error WifiLegacyHal::setCountryCode(const std::string& iface_name, - std::array code) { + const std::array code) { std::string code_str(code.data(), code.data() + code.size()); return global_func_table_.wifi_set_country_code(getIfaceHandle(iface_name), code_str.c_str()); } @@ -1384,7 +1385,7 @@ wifi_interface_handle WifiLegacyHal::getIfaceHandle(const std::string& iface_nam void WifiLegacyHal::runEventLoop() { LOG(DEBUG) << "Starting legacy HAL event loop"; global_func_table_.wifi_event_loop(global_handle_); - const auto lock = hidl_sync_util::acquireGlobalLock(); + const auto lock = aidl_sync_util::acquireGlobalLock(); if (!awaiting_event_loop_termination_) { LOG(FATAL) << "Legacy HAL event loop terminated, but HAL was not stopping"; } @@ -1647,8 +1648,7 @@ void WifiLegacyHal::invalidate() { } } // namespace legacy_hal -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl diff --git a/wifi/1.6/default/wifi_legacy_hal.h b/wifi/aidl/default/wifi_legacy_hal.h similarity index 97% rename from wifi/1.6/default/wifi_legacy_hal.h rename to wifi/aidl/default/wifi_legacy_hal.h index 1fd784ad43..cd8c0b1136 100644 --- a/wifi/1.6/default/wifi_legacy_hal.h +++ b/wifi/aidl/default/wifi_legacy_hal.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * 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. @@ -17,22 +17,22 @@ #ifndef WIFI_LEGACY_HAL_H_ #define WIFI_LEGACY_HAL_H_ -#include -#include -#include -#include -#include - #include #include +#include +#include +#include +#include +#include +#include + +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { // This is in a separate namespace to prevent typename conflicts between -// the legacy HAL types and the HIDL interface types. +// the legacy HAL types and the AIDL interface types. namespace legacy_hal { // Import all the types defined inside the legacy HAL header files into this // namespace. @@ -411,7 +411,7 @@ using on_gscan_results_callback = // Invoked when the rssi value breaches the thresholds set. using on_rssi_threshold_breached_callback = - std::function, int8_t)>; + std::function, int8_t)>; // Callback for RTT range request results. // Rtt results contain IE info and are hence passed by reference, to @@ -481,8 +481,8 @@ struct CachedScanResultsCallbackHandlers { */ class WifiLegacyHal { public: - WifiLegacyHal(const std::weak_ptr iface_tool, const wifi_hal_fn& fn, - bool is_primary); + WifiLegacyHal(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, + const wifi_hal_fn& fn, bool is_primary); virtual ~WifiLegacyHal() = default; // Initialize the legacy HAL function table. @@ -521,7 +521,7 @@ class WifiLegacyHal { // |on_results_user_callback| on success. // b) |WIFI_SCAN_FAILED| scan event or failure to retrieve cached scan // results - // triggers the externally provided |on_failure_user_callback|. + // Triggers the externally provided |on_failure_user_callback|. // c) Full scan result event triggers the externally provided // |on_full_result_user_callback|. wifi_error startGscan(const std::string& iface_name, wifi_request_id id, @@ -547,12 +547,12 @@ class WifiLegacyHal { wifi_error configureRoaming(const std::string& iface_name, const wifi_roaming_config& config); wifi_error enableFirmwareRoaming(const std::string& iface_name, fw_roaming_state_t state); wifi_error configureNdOffload(const std::string& iface_name, bool enable); - wifi_error startSendingOffloadedPacket(const std::string& iface_name, uint32_t cmd_id, + wifi_error startSendingOffloadedPacket(const std::string& iface_name, int32_t cmd_id, uint16_t ether_type, const std::vector& ip_packet_data, const std::array& src_address, const std::array& dst_address, - uint32_t period_in_ms); + int32_t period_in_ms); wifi_error stopSendingOffloadedPacket(const std::string& iface_name, uint32_t cmd_id); virtual wifi_error selectTxPowerScenario(const std::string& iface_name, wifi_power_scenario scenario); @@ -591,7 +591,7 @@ class WifiLegacyHal { const std::vector& rtt_configs, const on_rtt_results_callback& on_results_callback); wifi_error cancelRttRangeRequest(const std::string& iface_name, wifi_request_id id, - const std::vector>& mac_addrs); + const std::vector>& mac_addrs); std::pair getRttCapabilities(const std::string& iface_name); std::pair getRttResponderInfo(const std::string& iface_name); wifi_error enableRttResponder(const std::string& iface_name, wifi_request_id id, @@ -638,9 +638,9 @@ class WifiLegacyHal { const NanDataPathIndicationResponse& msg); wifi_error nanDataEnd(const std::string& iface_name, transaction_id id, uint32_t ndpInstanceId); // AP functions. - wifi_error setCountryCode(const std::string& iface_name, std::array code); + wifi_error setCountryCode(const std::string& iface_name, const std::array code); - // interface functions. + // Interface functions. virtual wifi_error createVirtualInterface(const std::string& ifname, wifi_interface_type iftype); virtual wifi_error deleteVirtualInterface(const std::string& ifname); @@ -721,8 +721,8 @@ class WifiLegacyHal { std::condition_variable_any stop_wait_cv_; // Flag to indicate if the legacy HAL has been started. bool is_started_; - std::weak_ptr iface_tool_; - // flag to indicate if this HAL is for the primary chip. This is used + std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool_; + // Flag to indicate if this HAL is for the primary chip. This is used // in order to avoid some hard-coded behavior used with older HALs, // such as bring wlan0 interface up/down on start/stop HAL. // it may be removed once vendor HALs are updated. @@ -730,10 +730,9 @@ class WifiLegacyHal { }; } // namespace legacy_hal -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl #endif // WIFI_LEGACY_HAL_H_ diff --git a/wifi/1.6/default/wifi_legacy_hal_factory.cpp b/wifi/aidl/default/wifi_legacy_hal_factory.cpp similarity index 97% rename from wifi/1.6/default/wifi_legacy_hal_factory.cpp rename to wifi/aidl/default/wifi_legacy_hal_factory.cpp index 147bf4d7cc..60f81ed764 100644 --- a/wifi/1.6/default/wifi_legacy_hal_factory.cpp +++ b/wifi/aidl/default/wifi_legacy_hal_factory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 The Android Open Source Project + * 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. @@ -14,17 +14,17 @@ * limitations under the License. */ -#include -#include -#include +#include "wifi_legacy_hal_factory.h" #include +#include #include #include #include #include +#include +#include -#include "wifi_legacy_hal_factory.h" #include "wifi_legacy_hal_stubs.h" namespace { @@ -59,15 +59,14 @@ bool isFileExtension(const char* name, const char* ext) { } }; // namespace +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { namespace legacy_hal { WifiLegacyHalFactory::WifiLegacyHalFactory( - const std::weak_ptr iface_tool) + const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool) : iface_tool_(iface_tool) {} std::vector> WifiLegacyHalFactory::getHals() { @@ -247,8 +246,7 @@ out_err: } } // namespace legacy_hal -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl diff --git a/wifi/1.6/default/wifi_legacy_hal_factory.h b/wifi/aidl/default/wifi_legacy_hal_factory.h similarity index 82% rename from wifi/1.6/default/wifi_legacy_hal_factory.h rename to wifi/aidl/default/wifi_legacy_hal_factory.h index 9f4423efb7..e7b287a6f5 100644 --- a/wifi/1.6/default/wifi_legacy_hal_factory.h +++ b/wifi/aidl/default/wifi_legacy_hal_factory.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 The Android Open Source Project + * 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. @@ -21,20 +21,19 @@ #include "wifi_legacy_hal.h" +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { // This is in a separate namespace to prevent typename conflicts between -// the legacy HAL types and the HIDL interface types. +// the legacy HAL types and the AIDL interface types. namespace legacy_hal { /** * Class that creates WifiLegacyHal objects for vendor HALs in the system. */ class WifiLegacyHalFactory { public: - WifiLegacyHalFactory(const std::weak_ptr iface_tool); + WifiLegacyHalFactory(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool); virtual ~WifiLegacyHalFactory() = default; std::vector> getHals(); @@ -51,16 +50,15 @@ class WifiLegacyHalFactory { bool initLinkedHalFunctionTable(wifi_hal_fn* hal_fn); bool loadVendorHalLib(const std::string& path, wifi_hal_lib_desc& desc); - std::weak_ptr iface_tool_; + std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool_; std::vector descs_; std::vector> legacy_hals_; }; } // namespace legacy_hal -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl #endif // WIFI_LEGACY_HAL_FACTORY_H_ diff --git a/wifi/1.6/default/wifi_legacy_hal_stubs.cpp b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp similarity index 98% rename from wifi/1.6/default/wifi_legacy_hal_stubs.cpp rename to wifi/aidl/default/wifi_legacy_hal_stubs.cpp index 8f8527a4cc..cff7f6977b 100644 --- a/wifi/1.6/default/wifi_legacy_hal_stubs.cpp +++ b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * 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. @@ -17,11 +17,10 @@ #include "wifi_legacy_hal_stubs.h" // TODO: Remove these stubs from HalTool in libwifi-system. +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { namespace legacy_hal { template struct stubFunction; @@ -170,9 +169,9 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { populateStubFor(&hal_fn->wifi_get_cached_scan_results); return true; } + } // namespace legacy_hal -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl diff --git a/wifi/1.6/default/wifi_legacy_hal_stubs.h b/wifi/aidl/default/wifi_legacy_hal_stubs.h similarity index 86% rename from wifi/1.6/default/wifi_legacy_hal_stubs.h rename to wifi/aidl/default/wifi_legacy_hal_stubs.h index c9a03bf4c9..603ecf2eae 100644 --- a/wifi/1.6/default/wifi_legacy_hal_stubs.h +++ b/wifi/aidl/default/wifi_legacy_hal_stubs.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * 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. @@ -19,19 +19,17 @@ #include +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { namespace legacy_hal { bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn); } // namespace legacy_hal -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl #endif // WIFI_LEGACY_HAL_STUBS_H_ diff --git a/wifi/1.6/default/wifi_mode_controller.cpp b/wifi/aidl/default/wifi_mode_controller.cpp similarity index 91% rename from wifi/1.6/default/wifi_mode_controller.cpp rename to wifi/aidl/default/wifi_mode_controller.cpp index 4b8ac7dd1c..07cb072363 100644 --- a/wifi/1.6/default/wifi_mode_controller.cpp +++ b/wifi/aidl/default/wifi_mode_controller.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * 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. @@ -14,16 +14,16 @@ * limitations under the License. */ +#include "wifi_mode_controller.h" + #include #include #include -#include "wifi_mode_controller.h" - -using android::hardware::wifi::V1_0::IfaceType; +namespace { +using aidl::android::hardware::wifi::IfaceType; using android::wifi_hal::DriverTool; -namespace { int convertIfaceTypeToFirmwareMode(IfaceType type) { int mode; switch (type) { @@ -33,7 +33,7 @@ int convertIfaceTypeToFirmwareMode(IfaceType type) { case IfaceType::P2P: mode = DriverTool::kFirmwareModeP2p; break; - case IfaceType::NAN: + case IfaceType::NAN_IFACE: // NAN is exposed in STA mode currently. mode = DriverTool::kFirmwareModeSta; break; @@ -45,11 +45,10 @@ int convertIfaceTypeToFirmwareMode(IfaceType type) { } } // namespace +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { namespace mode_controller { WifiModeController::WifiModeController() : driver_tool_(new DriverTool) {} @@ -81,9 +80,9 @@ bool WifiModeController::deinitialize() { } return true; } + } // namespace mode_controller -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl diff --git a/wifi/1.6/default/wifi_mode_controller.h b/wifi/aidl/default/wifi_mode_controller.h similarity index 84% rename from wifi/1.6/default/wifi_mode_controller.h rename to wifi/aidl/default/wifi_mode_controller.h index fee2b66d4e..1a9fb1a498 100644 --- a/wifi/1.6/default/wifi_mode_controller.h +++ b/wifi/aidl/default/wifi_mode_controller.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * 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. @@ -17,17 +17,14 @@ #ifndef WIFI_MODE_CONTROLLER_H_ #define WIFI_MODE_CONTROLLER_H_ +#include #include -#include - +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { namespace mode_controller { -using namespace android::hardware::wifi::V1_0; /** * Class that encapsulates all firmware mode configuration. @@ -50,14 +47,13 @@ class WifiModeController { virtual bool deinitialize(); private: - std::unique_ptr driver_tool_; + std::unique_ptr<::android::wifi_hal::DriverTool> driver_tool_; }; } // namespace mode_controller -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl #endif // WIFI_MODE_CONTROLLER_H_ diff --git a/wifi/aidl/default/wifi_nan_iface.cpp b/wifi/aidl/default/wifi_nan_iface.cpp new file mode 100644 index 0000000000..9edef09b7b --- /dev/null +++ b/wifi/aidl/default/wifi_nan_iface.cpp @@ -0,0 +1,751 @@ +/* + * 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. + */ + +#include "wifi_nan_iface.h" + +#include + +#include "aidl_return_util.h" +#include "aidl_struct_util.h" +#include "wifi_status_util.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +using aidl_return_util::validateAndCall; + +WifiNanIface::WifiNanIface(const std::string& ifname, bool is_dedicated_iface, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util) + : ifname_(ifname), + is_dedicated_iface_(is_dedicated_iface), + legacy_hal_(legacy_hal), + iface_util_(iface_util), + is_valid_(true) {} + +std::shared_ptr WifiNanIface::create( + const std::string& ifname, bool is_dedicated_iface, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util) { + std::shared_ptr ptr = ndk::SharedRefBase::make( + ifname, is_dedicated_iface, legacy_hal, iface_util); + if (is_dedicated_iface) { + // If using a dedicated iface, set the iface up first. + if (!iface_util.lock()->setUpState(ifname, true)) { + // Fatal failure, invalidate the iface object. + ptr->invalidate(); + return nullptr; + } + } + std::weak_ptr weak_ptr_this(ptr); + ptr->setWeakPtr(weak_ptr_this); + ptr->registerCallbackHandlers(); + return ptr; +} + +void WifiNanIface::registerCallbackHandlers() { + // Register all the callbacks here. These should be valid for the lifetime + // of the object. Whenever the mode changes legacy HAL will remove + // all of these callbacks. + legacy_hal::NanCallbackHandlers callback_handlers; + std::weak_ptr weak_ptr_this = weak_ptr_this_; + + // Callback for response. + callback_handlers.on_notify_response = [weak_ptr_this](legacy_hal::transaction_id id, + const legacy_hal::NanResponseMsg& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanStatus nanStatus; + if (!aidl_struct_util::convertLegacyNanResponseHeaderToAidl(msg, &nanStatus)) { + LOG(ERROR) << "Failed to convert nan response header"; + return; + } + + switch (msg.response_type) { + case legacy_hal::NAN_RESPONSE_ENABLED: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyEnableResponse(id, nanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_DISABLED: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyDisableResponse(id, nanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_PUBLISH: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyStartPublishResponse(id, nanStatus, + msg.body.publish_response.publish_id) + .isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_PUBLISH_CANCEL: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyStopPublishResponse(id, nanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_TRANSMIT_FOLLOWUP: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyTransmitFollowupResponse(id, nanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_SUBSCRIBE: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyStartSubscribeResponse( + id, nanStatus, msg.body.subscribe_response.subscribe_id) + .isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_SUBSCRIBE_CANCEL: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyStopSubscribeResponse(id, nanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_CONFIG: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyConfigResponse(id, nanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_GET_CAPABILITIES: { + NanCapabilities aidl_struct; + if (!aidl_struct_util::convertLegacyNanCapabilitiesResponseToAidl( + msg.body.nan_capabilities, &aidl_struct)) { + LOG(ERROR) << "Failed to convert nan capabilities response"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyCapabilitiesResponse(id, nanStatus, aidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_DP_INTERFACE_CREATE: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyCreateDataInterfaceResponse(id, nanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_DP_INTERFACE_DELETE: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyDeleteDataInterfaceResponse(id, nanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_DP_INITIATOR_RESPONSE: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyInitiateDataPathResponse( + id, nanStatus, + msg.body.data_request_response.ndp_instance_id) + .isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_DP_RESPONDER_RESPONSE: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyRespondToDataPathIndicationResponse(id, nanStatus) + .isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_DP_END: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyTerminateDataPathResponse(id, nanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_BEACON_SDF_PAYLOAD: + /* fall through */ + case legacy_hal::NAN_RESPONSE_TCA: + /* fall through */ + case legacy_hal::NAN_RESPONSE_STATS: + /* fall through */ + case legacy_hal::NAN_RESPONSE_ERROR: + /* fall through */ + default: + LOG(ERROR) << "Unknown or unhandled response type: " << msg.response_type; + return; + } + }; + + callback_handlers.on_event_disc_eng_event = [weak_ptr_this]( + const legacy_hal::NanDiscEngEventInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanClusterEventInd aidl_struct; + // event types defined identically - hence can be cast + aidl_struct.eventType = (NanClusterEventType)msg.event_type; + aidl_struct.addr = std::array(); + std::copy(msg.data.mac_addr.addr, msg.data.mac_addr.addr + 6, std::begin(aidl_struct.addr)); + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventClusterEvent(aidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_disabled = [weak_ptr_this](const legacy_hal::NanDisabledInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanStatus status; + aidl_struct_util::convertToNanStatus(msg.reason, msg.nan_reason, sizeof(msg.nan_reason), + &status); + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventDisabled(status).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_publish_terminated = + [weak_ptr_this](const legacy_hal::NanPublishTerminatedInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanStatus status; + aidl_struct_util::convertToNanStatus(msg.reason, msg.nan_reason, + sizeof(msg.nan_reason), &status); + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventPublishTerminated(msg.publish_id, status).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_subscribe_terminated = + [weak_ptr_this](const legacy_hal::NanSubscribeTerminatedInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanStatus status; + aidl_struct_util::convertToNanStatus(msg.reason, msg.nan_reason, + sizeof(msg.nan_reason), &status); + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventSubscribeTerminated(msg.subscribe_id, status).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_match = [weak_ptr_this](const legacy_hal::NanMatchInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanMatchInd aidl_struct; + if (!aidl_struct_util::convertLegacyNanMatchIndToAidl(msg, &aidl_struct)) { + LOG(ERROR) << "Failed to convert nan capabilities response"; + return; + } + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventMatch(aidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_match_expired = [weak_ptr_this]( + const legacy_hal::NanMatchExpiredInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventMatchExpired(msg.publish_subscribe_id, msg.requestor_instance_id) + .isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_followup = [weak_ptr_this](const legacy_hal::NanFollowupInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanFollowupReceivedInd aidl_struct; + if (!aidl_struct_util::convertLegacyNanFollowupIndToAidl(msg, &aidl_struct)) { + LOG(ERROR) << "Failed to convert nan capabilities response"; + return; + } + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventFollowupReceived(aidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_transmit_follow_up = + [weak_ptr_this](const legacy_hal::NanTransmitFollowupInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanStatus status; + aidl_struct_util::convertToNanStatus(msg.reason, msg.nan_reason, + sizeof(msg.nan_reason), &status); + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventTransmitFollowup(msg.id, status).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_data_path_request = + [weak_ptr_this](const legacy_hal::NanDataPathRequestInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanDataPathRequestInd aidl_struct; + if (!aidl_struct_util::convertLegacyNanDataPathRequestIndToAidl(msg, + &aidl_struct)) { + LOG(ERROR) << "Failed to convert nan capabilities response"; + return; + } + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventDataPathRequest(aidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_data_path_confirm = + [weak_ptr_this](const legacy_hal::NanDataPathConfirmInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanDataPathConfirmInd aidl_struct; + if (!aidl_struct_util::convertLegacyNanDataPathConfirmIndToAidl(msg, + &aidl_struct)) { + LOG(ERROR) << "Failed to convert nan capabilities response"; + return; + } + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventDataPathConfirm(aidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_data_path_end = + [weak_ptr_this](const legacy_hal::NanDataPathEndInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + for (int i = 0; i < msg.num_ndp_instances; ++i) { + if (!callback->eventDataPathTerminated(msg.ndp_instance_id[i]).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + } + }; + + callback_handlers.on_event_beacon_sdf_payload = + [](const legacy_hal::NanBeaconSdfPayloadInd& /* msg */) { + LOG(ERROR) << "on_event_beacon_sdf_payload - should not be called"; + }; + + callback_handlers.on_event_range_request = [](const legacy_hal::NanRangeRequestInd& /* msg */) { + LOG(ERROR) << "on_event_range_request - should not be called"; + }; + + callback_handlers.on_event_range_report = [](const legacy_hal::NanRangeReportInd& /* msg */) { + LOG(ERROR) << "on_event_range_report - should not be called"; + }; + + callback_handlers.on_event_schedule_update = + [weak_ptr_this](const legacy_hal::NanDataPathScheduleUpdateInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanDataPathScheduleUpdateInd aidl_struct; + if (!aidl_struct_util::convertLegacyNanDataPathScheduleUpdateIndToAidl( + msg, &aidl_struct)) { + LOG(ERROR) << "Failed to convert nan capabilities response"; + return; + } + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventDataPathScheduleUpdate(aidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanRegisterCallbackHandlers(ifname_, callback_handlers); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to register nan callbacks. Invalidating object"; + invalidate(); + } + + // Register for iface state toggle events. + iface_util::IfaceEventHandlers event_handlers = {}; + event_handlers.on_state_toggle_off_on = [weak_ptr_this](const std::string& /* iface_name */) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + // Tell framework that NAN has been disabled. + NanStatus status = {NanStatusCode::UNSUPPORTED_CONCURRENCY_NAN_DISABLED, ""}; + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventDisabled(status).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + iface_util_.lock()->registerIfaceEventHandlers(ifname_, event_handlers); +} + +void WifiNanIface::setWeakPtr(std::weak_ptr ptr) { + weak_ptr_this_ = ptr; +} + +void WifiNanIface::invalidate() { + if (!isValid()) { + return; + } + // send commands to HAL to actually disable and destroy interfaces + legacy_hal_.lock()->nanDisableRequest(ifname_, 0xFFFF); + legacy_hal_.lock()->nanDataInterfaceDelete(ifname_, 0xFFFE, "aware_data0"); + legacy_hal_.lock()->nanDataInterfaceDelete(ifname_, 0xFFFD, "aware_data1"); + iface_util_.lock()->unregisterIfaceEventHandlers(ifname_); + legacy_hal_.reset(); + event_cb_handler_.invalidate(); + is_valid_ = false; + if (is_dedicated_iface_) { + // If using a dedicated iface, set the iface down. + iface_util_.lock()->setUpState(ifname_, false); + } +} + +bool WifiNanIface::isValid() { + return is_valid_; +} + +std::string WifiNanIface::getName() { + return ifname_; +} + +std::set> WifiNanIface::getEventCallbacks() { + LOG(ERROR) << "Using original getEventCallbacks"; + return event_cb_handler_.getCallbacks(); +} + +ndk::ScopedAStatus WifiNanIface::getName(std::string* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::getNameInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiNanIface::registerEventCallback( + const std::shared_ptr& callback) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::registerEventCallbackInternal, callback); +} + +ndk::ScopedAStatus WifiNanIface::getCapabilitiesRequest(char16_t in_cmdId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::getCapabilitiesRequestInternal, in_cmdId); +} + +ndk::ScopedAStatus WifiNanIface::enableRequest(char16_t in_cmdId, const NanEnableRequest& in_msg1, + const NanConfigRequestSupplemental& in_msg2) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::enableRequestInternal, in_cmdId, in_msg1, in_msg2); +} + +ndk::ScopedAStatus WifiNanIface::configRequest(char16_t in_cmdId, const NanConfigRequest& in_msg1, + const NanConfigRequestSupplemental& in_msg2) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::configRequestInternal, in_cmdId, in_msg1, in_msg2); +} + +ndk::ScopedAStatus WifiNanIface::disableRequest(char16_t in_cmdId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::disableRequestInternal, in_cmdId); +} + +ndk::ScopedAStatus WifiNanIface::startPublishRequest(char16_t in_cmdId, + const NanPublishRequest& in_msg) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::startPublishRequestInternal, in_cmdId, in_msg); +} + +ndk::ScopedAStatus WifiNanIface::stopPublishRequest(char16_t in_cmdId, int8_t in_sessionId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::stopPublishRequestInternal, in_cmdId, in_sessionId); +} + +ndk::ScopedAStatus WifiNanIface::startSubscribeRequest(char16_t in_cmdId, + const NanSubscribeRequest& in_msg) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::startSubscribeRequestInternal, in_cmdId, in_msg); +} + +ndk::ScopedAStatus WifiNanIface::stopSubscribeRequest(char16_t in_cmdId, int8_t in_sessionId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::stopSubscribeRequestInternal, in_cmdId, in_sessionId); +} + +ndk::ScopedAStatus WifiNanIface::transmitFollowupRequest(char16_t in_cmdId, + const NanTransmitFollowupRequest& in_msg) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::transmitFollowupRequestInternal, in_cmdId, in_msg); +} + +ndk::ScopedAStatus WifiNanIface::createDataInterfaceRequest(char16_t in_cmdId, + const std::string& in_ifaceName) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::createDataInterfaceRequestInternal, in_cmdId, + in_ifaceName); +} + +ndk::ScopedAStatus WifiNanIface::deleteDataInterfaceRequest(char16_t in_cmdId, + const std::string& in_ifaceName) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::deleteDataInterfaceRequestInternal, in_cmdId, + in_ifaceName); +} + +ndk::ScopedAStatus WifiNanIface::initiateDataPathRequest(char16_t in_cmdId, + const NanInitiateDataPathRequest& in_msg) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::initiateDataPathRequestInternal, in_cmdId, in_msg); +} + +ndk::ScopedAStatus WifiNanIface::respondToDataPathIndicationRequest( + char16_t in_cmdId, const NanRespondToDataPathIndicationRequest& in_msg) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::respondToDataPathIndicationRequestInternal, in_cmdId, + in_msg); +} + +ndk::ScopedAStatus WifiNanIface::terminateDataPathRequest(char16_t in_cmdId, + int32_t in_ndpInstanceId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::terminateDataPathRequestInternal, in_cmdId, + in_ndpInstanceId); +} + +std::pair WifiNanIface::getNameInternal() { + return {ifname_, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiNanIface::registerEventCallbackInternal( + const std::shared_ptr& callback) { + if (!event_cb_handler_.addCallback(callback)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus WifiNanIface::getCapabilitiesRequestInternal(char16_t cmd_id) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->nanGetCapabilities(ifname_, cmd_id); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiNanIface::enableRequestInternal(char16_t cmd_id, + const NanEnableRequest& msg1, + const NanConfigRequestSupplemental& msg2) { + legacy_hal::NanEnableRequest legacy_msg; + if (!aidl_struct_util::convertAidlNanEnableRequestToLegacy(msg1, msg2, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanEnableRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiNanIface::configRequestInternal(char16_t cmd_id, + const NanConfigRequest& msg1, + const NanConfigRequestSupplemental& msg2) { + legacy_hal::NanConfigRequest legacy_msg; + if (!aidl_struct_util::convertAidlNanConfigRequestToLegacy(msg1, msg2, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanConfigRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiNanIface::disableRequestInternal(char16_t cmd_id) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->nanDisableRequest(ifname_, cmd_id); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiNanIface::startPublishRequestInternal(char16_t cmd_id, + const NanPublishRequest& msg) { + legacy_hal::NanPublishRequest legacy_msg; + if (!aidl_struct_util::convertAidlNanPublishRequestToLegacy(msg, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanPublishRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiNanIface::stopPublishRequestInternal(char16_t cmd_id, int8_t sessionId) { + legacy_hal::NanPublishCancelRequest legacy_msg; + legacy_msg.publish_id = sessionId; + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanPublishCancelRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiNanIface::startSubscribeRequestInternal(char16_t cmd_id, + const NanSubscribeRequest& msg) { + legacy_hal::NanSubscribeRequest legacy_msg; + if (!aidl_struct_util::convertAidlNanSubscribeRequestToLegacy(msg, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanSubscribeRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiNanIface::stopSubscribeRequestInternal(char16_t cmd_id, int8_t sessionId) { + legacy_hal::NanSubscribeCancelRequest legacy_msg; + legacy_msg.subscribe_id = sessionId; + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanSubscribeCancelRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiNanIface::transmitFollowupRequestInternal( + char16_t cmd_id, const NanTransmitFollowupRequest& msg) { + legacy_hal::NanTransmitFollowupRequest legacy_msg; + if (!aidl_struct_util::convertAidlNanTransmitFollowupRequestToLegacy(msg, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanTransmitFollowupRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiNanIface::createDataInterfaceRequestInternal(char16_t cmd_id, + const std::string& iface_name) { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanDataInterfaceCreate(ifname_, cmd_id, iface_name); + return createWifiStatusFromLegacyError(legacy_status); +} +ndk::ScopedAStatus WifiNanIface::deleteDataInterfaceRequestInternal(char16_t cmd_id, + const std::string& iface_name) { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanDataInterfaceDelete(ifname_, cmd_id, iface_name); + return createWifiStatusFromLegacyError(legacy_status); +} +ndk::ScopedAStatus WifiNanIface::initiateDataPathRequestInternal( + char16_t cmd_id, const NanInitiateDataPathRequest& msg) { + legacy_hal::NanDataPathInitiatorRequest legacy_msg; + if (!aidl_struct_util::convertAidlNanDataPathInitiatorRequestToLegacy(msg, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanDataRequestInitiator(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} +ndk::ScopedAStatus WifiNanIface::respondToDataPathIndicationRequestInternal( + char16_t cmd_id, const NanRespondToDataPathIndicationRequest& msg) { + legacy_hal::NanDataPathIndicationResponse legacy_msg; + if (!aidl_struct_util::convertAidlNanDataPathIndicationResponseToLegacy(msg, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanDataIndicationResponse(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} +ndk::ScopedAStatus WifiNanIface::terminateDataPathRequestInternal(char16_t cmd_id, + int32_t ndpInstanceId) { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanDataEnd(ifname_, cmd_id, ndpInstanceId); + return createWifiStatusFromLegacyError(legacy_status); +} + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/wifi_nan_iface.h b/wifi/aidl/default/wifi_nan_iface.h new file mode 100644 index 0000000000..101890594c --- /dev/null +++ b/wifi/aidl/default/wifi_nan_iface.h @@ -0,0 +1,134 @@ +/* + * 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. + */ + +#ifndef WIFI_NAN_IFACE_H_ +#define WIFI_NAN_IFACE_H_ + +#include +#include +#include + +#include "aidl_callback_util.h" +#include "wifi_iface_util.h" +#include "wifi_legacy_hal.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { + +/** + * AIDL interface object used to control a NAN Iface instance. + */ +class WifiNanIface : public BnWifiNanIface { + public: + WifiNanIface(const std::string& ifname, bool is_dedicated_iface, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util); + + // Factory method - use instead of default constructor. + static std::shared_ptr create( + const std::string& ifname, bool is_dedicated_iface, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util); + + // Refer to |WifiChip::invalidate()|. + void invalidate(); + bool isValid(); + std::string getName(); + + // AIDL methods exposed. + ndk::ScopedAStatus getName(std::string* _aidl_return) override; + ndk::ScopedAStatus registerEventCallback( + const std::shared_ptr& in_callback) override; + ndk::ScopedAStatus getCapabilitiesRequest(char16_t in_cmdId) override; + ndk::ScopedAStatus enableRequest(char16_t in_cmdId, const NanEnableRequest& in_msg1, + const NanConfigRequestSupplemental& in_msg2) override; + ndk::ScopedAStatus configRequest(char16_t in_cmdId, const NanConfigRequest& in_msg1, + const NanConfigRequestSupplemental& in_msg2) override; + ndk::ScopedAStatus disableRequest(char16_t in_cmdId) override; + ndk::ScopedAStatus startPublishRequest(char16_t in_cmdId, + const NanPublishRequest& in_msg) override; + ndk::ScopedAStatus stopPublishRequest(char16_t in_cmdId, int8_t in_sessionId) override; + ndk::ScopedAStatus startSubscribeRequest(char16_t in_cmdId, + const NanSubscribeRequest& in_msg) override; + ndk::ScopedAStatus stopSubscribeRequest(char16_t in_cmdId, int8_t in_sessionId) override; + ndk::ScopedAStatus transmitFollowupRequest(char16_t in_cmdId, + const NanTransmitFollowupRequest& in_msg) override; + ndk::ScopedAStatus createDataInterfaceRequest(char16_t in_cmdId, + const std::string& in_ifaceName) override; + ndk::ScopedAStatus deleteDataInterfaceRequest(char16_t in_cmdId, + const std::string& in_ifaceName) override; + ndk::ScopedAStatus initiateDataPathRequest(char16_t in_cmdId, + const NanInitiateDataPathRequest& in_msg) override; + ndk::ScopedAStatus respondToDataPathIndicationRequest( + char16_t in_cmdId, const NanRespondToDataPathIndicationRequest& in_msg) override; + ndk::ScopedAStatus terminateDataPathRequest(char16_t in_cmdId, + int32_t in_ndpInstanceId) override; + + protected: + // Accessible to child class in the gTest suite. + void setWeakPtr(std::weak_ptr ptr); + void registerCallbackHandlers(); + + private: + // Corresponding worker functions for the AIDL methods. + std::pair getNameInternal(); + ndk::ScopedAStatus registerEventCallbackInternal( + const std::shared_ptr& callback); + ndk::ScopedAStatus getCapabilitiesRequestInternal(char16_t cmd_id); + ndk::ScopedAStatus enableRequestInternal(char16_t cmd_id, const NanEnableRequest& msg1, + const NanConfigRequestSupplemental& msg2); + ndk::ScopedAStatus configRequestInternal(char16_t cmd_id, const NanConfigRequest& msg1, + const NanConfigRequestSupplemental& msg2); + ndk::ScopedAStatus disableRequestInternal(char16_t cmd_id); + ndk::ScopedAStatus startPublishRequestInternal(char16_t cmd_id, const NanPublishRequest& msg); + ndk::ScopedAStatus stopPublishRequestInternal(char16_t cmd_id, int8_t sessionId); + ndk::ScopedAStatus startSubscribeRequestInternal(char16_t cmd_id, + const NanSubscribeRequest& msg); + ndk::ScopedAStatus stopSubscribeRequestInternal(char16_t cmd_id, int8_t sessionId); + ndk::ScopedAStatus transmitFollowupRequestInternal(char16_t cmd_id, + const NanTransmitFollowupRequest& msg); + ndk::ScopedAStatus createDataInterfaceRequestInternal(char16_t cmd_id, + const std::string& iface_name); + ndk::ScopedAStatus deleteDataInterfaceRequestInternal(char16_t cmd_id, + const std::string& iface_name); + ndk::ScopedAStatus initiateDataPathRequestInternal(char16_t cmd_id, + const NanInitiateDataPathRequest& msg); + ndk::ScopedAStatus respondToDataPathIndicationRequestInternal( + char16_t cmd_id, const NanRespondToDataPathIndicationRequest& msg); + ndk::ScopedAStatus terminateDataPathRequestInternal(char16_t cmd_id, int32_t ndpInstanceId); + + // Overridden in the gTest suite. + virtual std::set> getEventCallbacks(); + + std::string ifname_; + bool is_dedicated_iface_; + std::weak_ptr legacy_hal_; + std::weak_ptr iface_util_; + bool is_valid_; + std::weak_ptr weak_ptr_this_; + aidl_callback_util::AidlCallbackHandler event_cb_handler_; + + DISALLOW_COPY_AND_ASSIGN(WifiNanIface); +}; + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // WIFI_NAN_IFACE_H_ diff --git a/wifi/1.6/default/wifi_p2p_iface.cpp b/wifi/aidl/default/wifi_p2p_iface.cpp similarity index 60% rename from wifi/1.6/default/wifi_p2p_iface.cpp rename to wifi/aidl/default/wifi_p2p_iface.cpp index d4b1fcabf1..48ec6d6d87 100644 --- a/wifi/1.6/default/wifi_p2p_iface.cpp +++ b/wifi/aidl/default/wifi_p2p_iface.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * 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. @@ -14,18 +14,18 @@ * limitations under the License. */ +#include "wifi_p2p_iface.h" + #include -#include "hidl_return_util.h" -#include "wifi_p2p_iface.h" +#include "aidl_return_util.h" #include "wifi_status_util.h" +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { -using hidl_return_util::validateAndCall; +using aidl_return_util::validateAndCall; WifiP2pIface::WifiP2pIface(const std::string& ifname, const std::weak_ptr legacy_hal) @@ -44,26 +44,16 @@ std::string WifiP2pIface::getName() { return ifname_; } -Return WifiP2pIface::getName(getName_cb hidl_status_cb) { +ndk::ScopedAStatus WifiP2pIface::getName(std::string* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiP2pIface::getNameInternal, hidl_status_cb); + &WifiP2pIface::getNameInternal, _aidl_return); } -Return WifiP2pIface::getType(getType_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiP2pIface::getTypeInternal, hidl_status_cb); +std::pair WifiP2pIface::getNameInternal() { + return {ifname_, ndk::ScopedAStatus::ok()}; } -std::pair WifiP2pIface::getNameInternal() { - return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_}; -} - -std::pair WifiP2pIface::getTypeInternal() { - return {createWifiStatus(WifiStatusCode::SUCCESS), IfaceType::P2P}; -} - -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl diff --git a/wifi/1.6/default/wifi_p2p_iface.h b/wifi/aidl/default/wifi_p2p_iface.h similarity index 64% rename from wifi/1.6/default/wifi_p2p_iface.h rename to wifi/aidl/default/wifi_p2p_iface.h index 00894437cf..d17470ed23 100644 --- a/wifi/1.6/default/wifi_p2p_iface.h +++ b/wifi/aidl/default/wifi_p2p_iface.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * 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. @@ -17,22 +17,20 @@ #ifndef WIFI_P2P_IFACE_H_ #define WIFI_P2P_IFACE_H_ +#include #include -#include #include "wifi_legacy_hal.h" +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { -using namespace android::hardware::wifi::V1_0; /** - * HIDL interface object used to control a P2P Iface instance. + * AIDL interface object used to control a P2P Iface instance. */ -class WifiP2pIface : public V1_0::IWifiP2pIface { +class WifiP2pIface : public BnWifiP2pIface { public: WifiP2pIface(const std::string& ifname, const std::weak_ptr legacy_hal); @@ -41,14 +39,12 @@ class WifiP2pIface : public V1_0::IWifiP2pIface { bool isValid(); std::string getName(); - // HIDL methods exposed. - Return getName(getName_cb hidl_status_cb) override; - Return getType(getType_cb hidl_status_cb) override; + // AIDL methods exposed. + ndk::ScopedAStatus getName(std::string* _aidl_return) override; private: - // Corresponding worker functions for the HIDL methods. - std::pair getNameInternal(); - std::pair getTypeInternal(); + // Corresponding worker functions for the AIDL methods. + std::pair getNameInternal(); std::string ifname_; std::weak_ptr legacy_hal_; @@ -57,10 +53,9 @@ class WifiP2pIface : public V1_0::IWifiP2pIface { DISALLOW_COPY_AND_ASSIGN(WifiP2pIface); }; -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl #endif // WIFI_P2P_IFACE_H_ diff --git a/wifi/aidl/default/wifi_rtt_controller.cpp b/wifi/aidl/default/wifi_rtt_controller.cpp new file mode 100644 index 0000000000..856c3cd054 --- /dev/null +++ b/wifi/aidl/default/wifi_rtt_controller.cpp @@ -0,0 +1,255 @@ +/* + * 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. + */ + +#include "wifi_rtt_controller.h" + +#include + +#include "aidl_return_util.h" +#include "aidl_struct_util.h" +#include "wifi_status_util.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +using aidl_return_util::validateAndCall; + +WifiRttController::WifiRttController(const std::string& iface_name, + const std::shared_ptr& bound_iface, + const std::weak_ptr legacy_hal) + : ifname_(iface_name), bound_iface_(bound_iface), legacy_hal_(legacy_hal), is_valid_(true) {} + +std::shared_ptr WifiRttController::create( + const std::string& iface_name, const std::shared_ptr& bound_iface, + const std::weak_ptr legacy_hal) { + std::shared_ptr ptr = + ndk::SharedRefBase::make(iface_name, bound_iface, legacy_hal); + std::weak_ptr weak_ptr_this(ptr); + ptr->setWeakPtr(weak_ptr_this); + return ptr; +} + +void WifiRttController::invalidate() { + legacy_hal_.reset(); + event_callbacks_.clear(); + is_valid_ = false; +}; + +bool WifiRttController::isValid() { + return is_valid_; +} + +void WifiRttController::setWeakPtr(std::weak_ptr ptr) { + weak_ptr_this_ = ptr; +} + +std::vector> +WifiRttController::getEventCallbacks() { + return event_callbacks_; +} + +std::string WifiRttController::getIfaceName() { + return ifname_; +} + +ndk::ScopedAStatus WifiRttController::getBoundIface(std::shared_ptr* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::getBoundIfaceInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiRttController::registerEventCallback( + const std::shared_ptr& callback) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::registerEventCallbackInternal, callback); +} + +ndk::ScopedAStatus WifiRttController::rangeRequest(int32_t in_cmdId, + const std::vector& in_rttConfigs) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::rangeRequestInternal, in_cmdId, in_rttConfigs); +} + +ndk::ScopedAStatus WifiRttController::rangeCancel(int32_t in_cmdId, + const std::vector& in_addrs) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::rangeCancelInternal, in_cmdId, in_addrs); +} + +ndk::ScopedAStatus WifiRttController::getCapabilities(RttCapabilities* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::getCapabilitiesInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiRttController::setLci(int32_t in_cmdId, const RttLciInformation& in_lci) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::setLciInternal, in_cmdId, in_lci); +} + +ndk::ScopedAStatus WifiRttController::setLcr(int32_t in_cmdId, const RttLcrInformation& in_lcr) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::setLcrInternal, in_cmdId, in_lcr); +} + +ndk::ScopedAStatus WifiRttController::getResponderInfo(RttResponder* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::getResponderInfoInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiRttController::enableResponder(int32_t in_cmdId, + const WifiChannelInfo& in_channelHint, + int32_t in_maxDurationInSeconds, + const RttResponder& in_info) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::enableResponderInternal, in_cmdId, in_channelHint, + in_maxDurationInSeconds, in_info); +} + +ndk::ScopedAStatus WifiRttController::disableResponder(int32_t in_cmdId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::disableResponderInternal, in_cmdId); +} + +std::pair, ndk::ScopedAStatus> +WifiRttController::getBoundIfaceInternal() { + return {bound_iface_, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiRttController::registerEventCallbackInternal( + const std::shared_ptr& callback) { + event_callbacks_.emplace_back(callback); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus WifiRttController::rangeRequestInternal( + int32_t cmd_id, const std::vector& rtt_configs) { + std::vector legacy_configs; + if (!aidl_struct_util::convertAidlVectorOfRttConfigToLegacy(rtt_configs, &legacy_configs)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + std::weak_ptr weak_ptr_this = weak_ptr_this_; + const auto& on_results_callback = + [weak_ptr_this](legacy_hal::wifi_request_id id, + const std::vector& results) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + std::vector aidl_results; + if (!aidl_struct_util::convertLegacyVectorOfRttResultToAidl(results, + &aidl_results)) { + LOG(ERROR) << "Failed to convert rtt results to AIDL structs"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onResults(id, aidl_results).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startRttRangeRequest( + ifname_, cmd_id, legacy_configs, on_results_callback); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiRttController::rangeCancelInternal(int32_t cmd_id, + const std::vector& addrs) { + std::vector> legacy_addrs; + for (const auto& addr : addrs) { + std::array addr_array; + std::copy_n(addr.data.begin(), ETH_ALEN, addr_array.begin()); + legacy_addrs.push_back(addr_array); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->cancelRttRangeRequest(ifname_, cmd_id, legacy_addrs); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair WifiRttController::getCapabilitiesInternal() { + legacy_hal::wifi_error legacy_status; + legacy_hal::wifi_rtt_capabilities legacy_caps; + std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getRttCapabilities(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {RttCapabilities{}, createWifiStatusFromLegacyError(legacy_status)}; + } + RttCapabilities aidl_caps; + if (!aidl_struct_util::convertLegacyRttCapabilitiesToAidl(legacy_caps, &aidl_caps)) { + return {RttCapabilities{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {aidl_caps, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiRttController::setLciInternal(int32_t cmd_id, const RttLciInformation& lci) { + legacy_hal::wifi_lci_information legacy_lci; + if (!aidl_struct_util::convertAidlRttLciInformationToLegacy(lci, &legacy_lci)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->setRttLci(ifname_, cmd_id, legacy_lci); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiRttController::setLcrInternal(int32_t cmd_id, const RttLcrInformation& lcr) { + legacy_hal::wifi_lcr_information legacy_lcr; + if (!aidl_struct_util::convertAidlRttLcrInformationToLegacy(lcr, &legacy_lcr)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->setRttLcr(ifname_, cmd_id, legacy_lcr); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair WifiRttController::getResponderInfoInternal() { + legacy_hal::wifi_error legacy_status; + legacy_hal::wifi_rtt_responder legacy_responder; + std::tie(legacy_status, legacy_responder) = legacy_hal_.lock()->getRttResponderInfo(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {RttResponder{}, createWifiStatusFromLegacyError(legacy_status)}; + } + RttResponder aidl_responder; + if (!aidl_struct_util::convertLegacyRttResponderToAidl(legacy_responder, &aidl_responder)) { + return {RttResponder{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {aidl_responder, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiRttController::enableResponderInternal(int32_t cmd_id, + const WifiChannelInfo& channel_hint, + int32_t max_duration_seconds, + const RttResponder& info) { + legacy_hal::wifi_channel_info legacy_channel_info; + if (!aidl_struct_util::convertAidlWifiChannelInfoToLegacy(channel_hint, &legacy_channel_info)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_rtt_responder legacy_responder; + if (!aidl_struct_util::convertAidlRttResponderToLegacy(info, &legacy_responder)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->enableRttResponder( + ifname_, cmd_id, legacy_channel_info, max_duration_seconds, legacy_responder); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiRttController::disableResponderInternal(int32_t cmd_id) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->disableRttResponder(ifname_, cmd_id); + return createWifiStatusFromLegacyError(legacy_status); +} + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/wifi_rtt_controller.h b/wifi/aidl/default/wifi_rtt_controller.h new file mode 100644 index 0000000000..db690c3ad3 --- /dev/null +++ b/wifi/aidl/default/wifi_rtt_controller.h @@ -0,0 +1,102 @@ +/* + * 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. + */ + +#ifndef WIFI_RTT_CONTROLLER_H_ +#define WIFI_RTT_CONTROLLER_H_ + +#include +#include +#include +#include + +#include "wifi_legacy_hal.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { + +/** + * AIDL interface object used to control all RTT operations. + */ +class WifiRttController : public BnWifiRttController { + public: + WifiRttController(const std::string& iface_name, + const std::shared_ptr& bound_iface, + const std::weak_ptr legacy_hal); + // Factory method - use instead of default constructor. + static std::shared_ptr create( + const std::string& iface_name, const std::shared_ptr& bound_iface, + const std::weak_ptr legacy_hal); + + // Refer to |WifiChip::invalidate()|. + void invalidate(); + bool isValid(); + std::vector> getEventCallbacks(); + std::string getIfaceName(); + + // AIDL methods exposed. + ndk::ScopedAStatus getBoundIface(std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus registerEventCallback( + const std::shared_ptr& callback) override; + ndk::ScopedAStatus rangeRequest(int32_t in_cmdId, + const std::vector& in_rttConfigs) override; + ndk::ScopedAStatus rangeCancel(int32_t in_cmdId, + const std::vector& in_addrs) override; + ndk::ScopedAStatus getCapabilities(RttCapabilities* _aidl_return) override; + ndk::ScopedAStatus setLci(int32_t in_cmdId, const RttLciInformation& in_lci) override; + ndk::ScopedAStatus setLcr(int32_t in_cmdId, const RttLcrInformation& in_lcr) override; + ndk::ScopedAStatus getResponderInfo(RttResponder* _aidl_return) override; + ndk::ScopedAStatus enableResponder(int32_t in_cmdId, const WifiChannelInfo& in_channelHint, + int32_t in_maxDurationInSeconds, + const RttResponder& in_info) override; + ndk::ScopedAStatus disableResponder(int32_t in_cmdId) override; + + private: + // Corresponding worker functions for the AIDL methods. + std::pair, ndk::ScopedAStatus> getBoundIfaceInternal(); + ndk::ScopedAStatus registerEventCallbackInternal( + const std::shared_ptr& callback); + ndk::ScopedAStatus rangeRequestInternal(int32_t cmd_id, + const std::vector& rtt_configs); + ndk::ScopedAStatus rangeCancelInternal(int32_t cmd_id, const std::vector& addrs); + std::pair getCapabilitiesInternal(); + ndk::ScopedAStatus setLciInternal(int32_t cmd_id, const RttLciInformation& lci); + ndk::ScopedAStatus setLcrInternal(int32_t cmd_id, const RttLcrInformation& lcr); + std::pair getResponderInfoInternal(); + ndk::ScopedAStatus enableResponderInternal(int32_t cmd_id, const WifiChannelInfo& channel_hint, + int32_t max_duration_seconds, + const RttResponder& info); + ndk::ScopedAStatus disableResponderInternal(int32_t cmd_id); + + void setWeakPtr(std::weak_ptr ptr); + + std::string ifname_; + std::shared_ptr bound_iface_; + std::weak_ptr legacy_hal_; + std::vector> event_callbacks_; + std::weak_ptr weak_ptr_this_; + bool is_valid_; + + DISALLOW_COPY_AND_ASSIGN(WifiRttController); +}; + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // WIFI_RTT_CONTROLLER_H_ diff --git a/wifi/aidl/default/wifi_sta_iface.cpp b/wifi/aidl/default/wifi_sta_iface.cpp new file mode 100644 index 0000000000..ce90349bc5 --- /dev/null +++ b/wifi/aidl/default/wifi_sta_iface.cpp @@ -0,0 +1,558 @@ +/* + * 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. + */ + +#include "wifi_sta_iface.h" + +#include + +#include "aidl_return_util.h" +#include "aidl_struct_util.h" +#include "wifi_status_util.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +using aidl_return_util::validateAndCall; + +WifiStaIface::WifiStaIface(const std::string& ifname, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util) + : ifname_(ifname), legacy_hal_(legacy_hal), iface_util_(iface_util), is_valid_(true) { + // Turn on DFS channel usage for STA iface. + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->setDfsFlag(ifname_, true); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to set DFS flag; DFS channels may be unavailable."; + } +} + +std::shared_ptr WifiStaIface::create( + const std::string& ifname, const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util) { + std::shared_ptr ptr = + ndk::SharedRefBase::make(ifname, legacy_hal, iface_util); + std::weak_ptr weak_ptr_this(ptr); + ptr->setWeakPtr(weak_ptr_this); + return ptr; +} + +void WifiStaIface::invalidate() { + legacy_hal_.reset(); + event_cb_handler_.invalidate(); + is_valid_ = false; +} + +void WifiStaIface::setWeakPtr(std::weak_ptr ptr) { + weak_ptr_this_ = ptr; +} + +bool WifiStaIface::isValid() { + return is_valid_; +} + +std::string WifiStaIface::getName() { + return ifname_; +} + +std::set> WifiStaIface::getEventCallbacks() { + return event_cb_handler_.getCallbacks(); +} + +ndk::ScopedAStatus WifiStaIface::getName(std::string* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getNameInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiStaIface::registerEventCallback( + const std::shared_ptr& in_callback) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::registerEventCallbackInternal, in_callback); +} + +ndk::ScopedAStatus WifiStaIface::getCapabilities( + IWifiStaIface::StaIfaceCapabilityMask* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getCapabilitiesInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiStaIface::getApfPacketFilterCapabilities( + StaApfPacketFilterCapabilities* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getApfPacketFilterCapabilitiesInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiStaIface::installApfPacketFilter(const std::vector& in_program) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::installApfPacketFilterInternal, in_program); +} + +ndk::ScopedAStatus WifiStaIface::readApfPacketFilterData(std::vector* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::readApfPacketFilterDataInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiStaIface::getBackgroundScanCapabilities( + StaBackgroundScanCapabilities* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getBackgroundScanCapabilitiesInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiStaIface::getValidFrequenciesForBand(WifiBand in_band, + std::vector* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getValidFrequenciesForBandInternal, _aidl_return, + in_band); +} + +ndk::ScopedAStatus WifiStaIface::startBackgroundScan(int32_t in_cmdId, + const StaBackgroundScanParameters& in_params) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::startBackgroundScanInternal, in_cmdId, in_params); +} + +ndk::ScopedAStatus WifiStaIface::stopBackgroundScan(int32_t in_cmdId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::stopBackgroundScanInternal, in_cmdId); +} + +ndk::ScopedAStatus WifiStaIface::enableLinkLayerStatsCollection(bool in_debug) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::enableLinkLayerStatsCollectionInternal, in_debug); +} + +ndk::ScopedAStatus WifiStaIface::disableLinkLayerStatsCollection() { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::disableLinkLayerStatsCollectionInternal); +} + +ndk::ScopedAStatus WifiStaIface::getLinkLayerStats(StaLinkLayerStats* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getLinkLayerStatsInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiStaIface::startRssiMonitoring(int32_t in_cmdId, int32_t in_maxRssi, + int32_t in_minRssi) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::startRssiMonitoringInternal, in_cmdId, in_maxRssi, + in_minRssi); +} + +ndk::ScopedAStatus WifiStaIface::stopRssiMonitoring(int32_t in_cmdId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::stopRssiMonitoringInternal, in_cmdId); +} + +ndk::ScopedAStatus WifiStaIface::getRoamingCapabilities(StaRoamingCapabilities* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getRoamingCapabilitiesInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiStaIface::configureRoaming(const StaRoamingConfig& in_config) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::configureRoamingInternal, in_config); +} + +ndk::ScopedAStatus WifiStaIface::setRoamingState(StaRoamingState in_state) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::setRoamingStateInternal, in_state); +} + +ndk::ScopedAStatus WifiStaIface::enableNdOffload(bool in_enable) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::enableNdOffloadInternal, in_enable); +} + +ndk::ScopedAStatus WifiStaIface::startSendingKeepAlivePackets( + int32_t in_cmdId, const std::vector& in_ipPacketData, char16_t in_etherType, + const std::array& in_srcAddress, const std::array& in_dstAddress, + int32_t in_periodInMs) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::startSendingKeepAlivePacketsInternal, in_cmdId, + in_ipPacketData, in_etherType, in_srcAddress, in_dstAddress, + in_periodInMs); +} + +ndk::ScopedAStatus WifiStaIface::stopSendingKeepAlivePackets(int32_t in_cmdId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::stopSendingKeepAlivePacketsInternal, in_cmdId); +} + +ndk::ScopedAStatus WifiStaIface::startDebugPacketFateMonitoring() { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::startDebugPacketFateMonitoringInternal); +} + +ndk::ScopedAStatus WifiStaIface::getDebugTxPacketFates( + std::vector* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getDebugTxPacketFatesInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiStaIface::getDebugRxPacketFates( + std::vector* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getDebugRxPacketFatesInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiStaIface::setMacAddress(const std::array& in_mac) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::setMacAddressInternal, in_mac); +} + +ndk::ScopedAStatus WifiStaIface::getFactoryMacAddress(std::array* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getFactoryMacAddressInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiStaIface::setScanMode(bool in_enable) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::setScanModeInternal, in_enable); +} + +std::pair WifiStaIface::getNameInternal() { + return {ifname_, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiStaIface::registerEventCallbackInternal( + const std::shared_ptr& callback) { + if (!event_cb_handler_.addCallback(callback)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + return ndk::ScopedAStatus::ok(); +} + +std::pair +WifiStaIface::getCapabilitiesInternal() { + legacy_hal::wifi_error legacy_status; + uint64_t legacy_feature_set; + std::tie(legacy_status, legacy_feature_set) = + legacy_hal_.lock()->getSupportedFeatureSet(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {IWifiStaIface::StaIfaceCapabilityMask{}, + createWifiStatusFromLegacyError(legacy_status)}; + } + uint32_t legacy_logger_feature_set; + std::tie(legacy_status, legacy_logger_feature_set) = + legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + // some devices don't support querying logger feature set + legacy_logger_feature_set = 0; + } + uint32_t aidl_caps; + if (!aidl_struct_util::convertLegacyFeaturesToAidlStaCapabilities( + legacy_feature_set, legacy_logger_feature_set, &aidl_caps)) { + return {IWifiStaIface::StaIfaceCapabilityMask{}, + createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {static_cast(aidl_caps), + ndk::ScopedAStatus::ok()}; +} + +std::pair +WifiStaIface::getApfPacketFilterCapabilitiesInternal() { + legacy_hal::wifi_error legacy_status; + legacy_hal::PacketFilterCapabilities legacy_caps; + std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getPacketFilterCapabilities(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {StaApfPacketFilterCapabilities{}, createWifiStatusFromLegacyError(legacy_status)}; + } + StaApfPacketFilterCapabilities aidl_caps; + if (!aidl_struct_util::convertLegacyApfCapabilitiesToAidl(legacy_caps, &aidl_caps)) { + return {StaApfPacketFilterCapabilities{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {aidl_caps, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiStaIface::installApfPacketFilterInternal( + const std::vector& program) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->setPacketFilter(ifname_, program); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair, ndk::ScopedAStatus> +WifiStaIface::readApfPacketFilterDataInternal() { + const std::pair> legacy_status_and_data = + legacy_hal_.lock()->readApfPacketFilterData(ifname_); + return {std::move(legacy_status_and_data.second), + createWifiStatusFromLegacyError(legacy_status_and_data.first)}; +} + +std::pair +WifiStaIface::getBackgroundScanCapabilitiesInternal() { + legacy_hal::wifi_error legacy_status; + legacy_hal::wifi_gscan_capabilities legacy_caps; + std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getGscanCapabilities(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {StaBackgroundScanCapabilities{}, createWifiStatusFromLegacyError(legacy_status)}; + } + StaBackgroundScanCapabilities aidl_caps; + if (!aidl_struct_util::convertLegacyGscanCapabilitiesToAidl(legacy_caps, &aidl_caps)) { + return {StaBackgroundScanCapabilities{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {aidl_caps, ndk::ScopedAStatus::ok()}; +} + +std::pair, ndk::ScopedAStatus> +WifiStaIface::getValidFrequenciesForBandInternal(WifiBand band) { + static_assert(sizeof(WifiChannelWidthInMhz) == sizeof(int32_t), "Size mismatch"); + legacy_hal::wifi_error legacy_status; + std::vector valid_frequencies; + std::tie(legacy_status, valid_frequencies) = legacy_hal_.lock()->getValidFrequenciesForBand( + ifname_, aidl_struct_util::convertAidlWifiBandToLegacy(band)); + return {std::vector(valid_frequencies.begin(), valid_frequencies.end()), + createWifiStatusFromLegacyError(legacy_status)}; +} + +ndk::ScopedAStatus WifiStaIface::startBackgroundScanInternal( + int32_t cmd_id, const StaBackgroundScanParameters& params) { + legacy_hal::wifi_scan_cmd_params legacy_params; + if (!aidl_struct_util::convertAidlGscanParamsToLegacy(params, &legacy_params)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + std::weak_ptr weak_ptr_this = weak_ptr_this_; + const auto& on_failure_callback = [weak_ptr_this](legacy_hal::wifi_request_id id) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onBackgroundScanFailure(id).isOk()) { + LOG(ERROR) << "Failed to invoke onBackgroundScanFailure callback"; + } + } + }; + const auto& on_results_callback = + [weak_ptr_this](legacy_hal::wifi_request_id id, + const std::vector& results) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + std::vector aidl_scan_datas; + if (!aidl_struct_util::convertLegacyVectorOfCachedGscanResultsToAidl( + results, &aidl_scan_datas)) { + LOG(ERROR) << "Failed to convert scan results to AIDL structs"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onBackgroundScanResults(id, aidl_scan_datas).isOk()) { + LOG(ERROR) << "Failed to invoke onBackgroundScanResults callback"; + } + } + }; + const auto& on_full_result_callback = [weak_ptr_this]( + legacy_hal::wifi_request_id id, + const legacy_hal::wifi_scan_result* result, + uint32_t buckets_scanned) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + StaScanResult aidl_scan_result; + if (!aidl_struct_util::convertLegacyGscanResultToAidl(*result, true, &aidl_scan_result)) { + LOG(ERROR) << "Failed to convert full scan results to AIDL structs"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onBackgroundFullScanResult(id, buckets_scanned, aidl_scan_result) + .isOk()) { + LOG(ERROR) << "Failed to invoke onBackgroundFullScanResult callback"; + } + } + }; + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->startGscan(ifname_, cmd_id, legacy_params, on_failure_callback, + on_results_callback, on_full_result_callback); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiStaIface::stopBackgroundScanInternal(int32_t cmd_id) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->stopGscan(ifname_, cmd_id); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiStaIface::enableLinkLayerStatsCollectionInternal(bool debug) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->enableLinkLayerStats(ifname_, debug); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiStaIface::disableLinkLayerStatsCollectionInternal() { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->disableLinkLayerStats(ifname_); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair WifiStaIface::getLinkLayerStatsInternal() { + legacy_hal::wifi_error legacy_status; + legacy_hal::LinkLayerStats legacy_stats; + std::tie(legacy_status, legacy_stats) = legacy_hal_.lock()->getLinkLayerStats(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {StaLinkLayerStats{}, createWifiStatusFromLegacyError(legacy_status)}; + } + StaLinkLayerStats aidl_stats; + if (!aidl_struct_util::convertLegacyLinkLayerStatsToAidl(legacy_stats, &aidl_stats)) { + return {StaLinkLayerStats{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {aidl_stats, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiStaIface::startRssiMonitoringInternal(int32_t cmd_id, int32_t max_rssi, + int32_t min_rssi) { + std::weak_ptr weak_ptr_this = weak_ptr_this_; + const auto& on_threshold_breached_callback = + [weak_ptr_this](legacy_hal::wifi_request_id id, std::array bssid, + int8_t rssi) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onRssiThresholdBreached(id, bssid, rssi).isOk()) { + LOG(ERROR) << "Failed to invoke onRssiThresholdBreached callback"; + } + } + }; + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startRssiMonitoring( + ifname_, cmd_id, max_rssi, min_rssi, on_threshold_breached_callback); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiStaIface::stopRssiMonitoringInternal(int32_t cmd_id) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->stopRssiMonitoring(ifname_, cmd_id); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair +WifiStaIface::getRoamingCapabilitiesInternal() { + legacy_hal::wifi_error legacy_status; + legacy_hal::wifi_roaming_capabilities legacy_caps; + std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getRoamingCapabilities(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {StaRoamingCapabilities{}, createWifiStatusFromLegacyError(legacy_status)}; + } + StaRoamingCapabilities aidl_caps; + if (!aidl_struct_util::convertLegacyRoamingCapabilitiesToAidl(legacy_caps, &aidl_caps)) { + return {StaRoamingCapabilities{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {aidl_caps, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiStaIface::configureRoamingInternal(const StaRoamingConfig& config) { + legacy_hal::wifi_roaming_config legacy_config; + if (!aidl_struct_util::convertAidlRoamingConfigToLegacy(config, &legacy_config)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->configureRoaming(ifname_, legacy_config); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiStaIface::setRoamingStateInternal(StaRoamingState state) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->enableFirmwareRoaming( + ifname_, aidl_struct_util::convertAidlRoamingStateToLegacy(state)); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiStaIface::enableNdOffloadInternal(bool enable) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->configureNdOffload(ifname_, enable); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiStaIface::startSendingKeepAlivePacketsInternal( + int32_t cmd_id, const std::vector& ip_packet_data, char16_t ether_type, + const std::array& src_address, const std::array& dst_address, + int32_t period_in_ms) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startSendingOffloadedPacket( + ifname_, cmd_id, ether_type, ip_packet_data, src_address, dst_address, period_in_ms); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiStaIface::stopSendingKeepAlivePacketsInternal(int32_t cmd_id) { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->stopSendingOffloadedPacket(ifname_, cmd_id); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiStaIface::startDebugPacketFateMonitoringInternal() { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startPktFateMonitoring(ifname_); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair, ndk::ScopedAStatus> +WifiStaIface::getDebugTxPacketFatesInternal() { + legacy_hal::wifi_error legacy_status; + std::vector legacy_fates; + std::tie(legacy_status, legacy_fates) = legacy_hal_.lock()->getTxPktFates(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {std::vector(), + createWifiStatusFromLegacyError(legacy_status)}; + } + std::vector aidl_fates; + if (!aidl_struct_util::convertLegacyVectorOfDebugTxPacketFateToAidl(legacy_fates, + &aidl_fates)) { + return {std::vector(), + createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {aidl_fates, ndk::ScopedAStatus::ok()}; +} + +std::pair, ndk::ScopedAStatus> +WifiStaIface::getDebugRxPacketFatesInternal() { + legacy_hal::wifi_error legacy_status; + std::vector legacy_fates; + std::tie(legacy_status, legacy_fates) = legacy_hal_.lock()->getRxPktFates(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {std::vector(), + createWifiStatusFromLegacyError(legacy_status)}; + } + std::vector aidl_fates; + if (!aidl_struct_util::convertLegacyVectorOfDebugRxPacketFateToAidl(legacy_fates, + &aidl_fates)) { + return {std::vector(), + createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {aidl_fates, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiStaIface::setMacAddressInternal(const std::array& mac) { + bool status = iface_util_.lock()->setMacAddress(ifname_, mac); + if (!status) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + return ndk::ScopedAStatus::ok(); +} + +std::pair, ndk::ScopedAStatus> WifiStaIface::getFactoryMacAddressInternal() { + std::array mac = iface_util_.lock()->getFactoryMacAddress(ifname_); + if (mac[0] == 0 && mac[1] == 0 && mac[2] == 0 && mac[3] == 0 && mac[4] == 0 && mac[5] == 0) { + return {mac, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {mac, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiStaIface::setScanModeInternal(bool enable) { + // OEM's need to implement this on their devices if needed. + LOG(WARNING) << "setScanModeInternal(" << enable << ") not supported"; + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/wifi_sta_iface.h b/wifi/aidl/default/wifi_sta_iface.h new file mode 100644 index 0000000000..8ac3470edb --- /dev/null +++ b/wifi/aidl/default/wifi_sta_iface.h @@ -0,0 +1,154 @@ +/* + * 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. + */ + +#ifndef WIFI_STA_IFACE_H_ +#define WIFI_STA_IFACE_H_ + +#include +#include +#include + +#include "aidl_callback_util.h" +#include "wifi_iface_util.h" +#include "wifi_legacy_hal.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { + +/** + * AIDL interface object used to control a STA Iface instance. + */ +class WifiStaIface : public BnWifiStaIface { + public: + WifiStaIface(const std::string& ifname, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util); + + // Factory method - use instead of default constructor. + static std::shared_ptr create( + const std::string& ifname, const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util); + + // Refer to |WifiChip::invalidate()|. + void invalidate(); + bool isValid(); + std::set> getEventCallbacks(); + std::string getName(); + + // AIDL methods exposed. + ndk::ScopedAStatus getName(std::string* _aidl_return) override; + ndk::ScopedAStatus registerEventCallback( + const std::shared_ptr& in_callback) override; + ndk::ScopedAStatus getCapabilities( + IWifiStaIface::StaIfaceCapabilityMask* _aidl_return) override; + ndk::ScopedAStatus getApfPacketFilterCapabilities( + StaApfPacketFilterCapabilities* _aidl_return) override; + ndk::ScopedAStatus installApfPacketFilter(const std::vector& in_program) override; + ndk::ScopedAStatus readApfPacketFilterData(std::vector* _aidl_return) override; + ndk::ScopedAStatus getBackgroundScanCapabilities( + StaBackgroundScanCapabilities* _aidl_return) override; + ndk::ScopedAStatus getValidFrequenciesForBand(WifiBand in_band, + std::vector* _aidl_return) override; + ndk::ScopedAStatus startBackgroundScan(int32_t in_cmdId, + const StaBackgroundScanParameters& in_params) override; + ndk::ScopedAStatus stopBackgroundScan(int32_t in_cmdId) override; + ndk::ScopedAStatus enableLinkLayerStatsCollection(bool in_debug) override; + ndk::ScopedAStatus disableLinkLayerStatsCollection() override; + ndk::ScopedAStatus getLinkLayerStats(StaLinkLayerStats* _aidl_return) override; + ndk::ScopedAStatus startRssiMonitoring(int32_t in_cmdId, int32_t in_maxRssi, + int32_t in_minRssi) override; + ndk::ScopedAStatus stopRssiMonitoring(int32_t in_cmdId) override; + ndk::ScopedAStatus getRoamingCapabilities(StaRoamingCapabilities* _aidl_return) override; + ndk::ScopedAStatus configureRoaming(const StaRoamingConfig& in_config) override; + ndk::ScopedAStatus setRoamingState(StaRoamingState in_state) override; + ndk::ScopedAStatus enableNdOffload(bool in_enable) override; + ndk::ScopedAStatus startSendingKeepAlivePackets(int32_t in_cmdId, + const std::vector& in_ipPacketData, + char16_t in_etherType, + const std::array& in_srcAddress, + const std::array& in_dstAddress, + int32_t in_periodInMs) override; + ndk::ScopedAStatus stopSendingKeepAlivePackets(int32_t in_cmdId) override; + ndk::ScopedAStatus startDebugPacketFateMonitoring() override; + ndk::ScopedAStatus getDebugTxPacketFates( + std::vector* _aidl_return) override; + ndk::ScopedAStatus getDebugRxPacketFates( + std::vector* _aidl_return) override; + ndk::ScopedAStatus setMacAddress(const std::array& in_mac) override; + ndk::ScopedAStatus getFactoryMacAddress(std::array* _aidl_return) override; + ndk::ScopedAStatus setScanMode(bool in_enable) override; + + private: + // Corresponding worker functions for the AIDL methods. + std::pair getNameInternal(); + ndk::ScopedAStatus registerEventCallbackInternal( + const std::shared_ptr& callback); + std::pair getCapabilitiesInternal(); + std::pair + getApfPacketFilterCapabilitiesInternal(); + ndk::ScopedAStatus installApfPacketFilterInternal(const std::vector& program); + std::pair, ndk::ScopedAStatus> readApfPacketFilterDataInternal(); + std::pair + getBackgroundScanCapabilitiesInternal(); + std::pair, ndk::ScopedAStatus> getValidFrequenciesForBandInternal( + WifiBand band); + ndk::ScopedAStatus startBackgroundScanInternal(int32_t cmd_id, + const StaBackgroundScanParameters& params); + ndk::ScopedAStatus stopBackgroundScanInternal(int32_t cmd_id); + ndk::ScopedAStatus enableLinkLayerStatsCollectionInternal(bool debug); + ndk::ScopedAStatus disableLinkLayerStatsCollectionInternal(); + std::pair getLinkLayerStatsInternal(); + ndk::ScopedAStatus startRssiMonitoringInternal(int32_t cmd_id, int32_t max_rssi, + int32_t min_rssi); + ndk::ScopedAStatus stopRssiMonitoringInternal(int32_t cmd_id); + std::pair getRoamingCapabilitiesInternal(); + ndk::ScopedAStatus configureRoamingInternal(const StaRoamingConfig& config); + ndk::ScopedAStatus setRoamingStateInternal(StaRoamingState state); + ndk::ScopedAStatus enableNdOffloadInternal(bool enable); + ndk::ScopedAStatus startSendingKeepAlivePacketsInternal( + int32_t cmd_id, const std::vector& ip_packet_data, char16_t ether_type, + const std::array& src_address, const std::array& dst_address, + int32_t period_in_ms); + ndk::ScopedAStatus stopSendingKeepAlivePacketsInternal(int32_t cmd_id); + ndk::ScopedAStatus startDebugPacketFateMonitoringInternal(); + std::pair, ndk::ScopedAStatus> + getDebugTxPacketFatesInternal(); + std::pair, ndk::ScopedAStatus> + getDebugRxPacketFatesInternal(); + ndk::ScopedAStatus setMacAddressInternal(const std::array& mac); + std::pair, ndk::ScopedAStatus> getFactoryMacAddressInternal(); + ndk::ScopedAStatus setScanModeInternal(bool enable); + + void setWeakPtr(std::weak_ptr ptr); + + std::string ifname_; + std::weak_ptr legacy_hal_; + std::weak_ptr iface_util_; + std::weak_ptr weak_ptr_this_; + bool is_valid_; + aidl_callback_util::AidlCallbackHandler event_cb_handler_; + + DISALLOW_COPY_AND_ASSIGN(WifiStaIface); +}; + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // WIFI_STA_IFACE_H_ diff --git a/wifi/1.6/default/wifi_status_util.cpp b/wifi/aidl/default/wifi_status_util.cpp similarity index 80% rename from wifi/1.6/default/wifi_status_util.cpp rename to wifi/aidl/default/wifi_status_util.cpp index 3b18e537cd..25ecd716da 100644 --- a/wifi/1.6/default/wifi_status_util.cpp +++ b/wifi/aidl/default/wifi_status_util.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * 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. @@ -16,11 +16,10 @@ #include "wifi_status_util.h" +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { std::string legacyErrorToString(legacy_hal::wifi_error error) { switch (error) { @@ -51,16 +50,21 @@ std::string legacyErrorToString(legacy_hal::wifi_error error) { } } -WifiStatus createWifiStatus(WifiStatusCode code, const std::string& description) { - return {code, description}; +ndk::ScopedAStatus createWifiStatus(WifiStatusCode code, const std::string& description) { + return ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(static_cast(code), + description.c_str()); } -WifiStatus createWifiStatus(WifiStatusCode code) { - return createWifiStatus(code, ""); +ndk::ScopedAStatus createWifiStatus(WifiStatusCode code) { + return ndk::ScopedAStatus::fromServiceSpecificError(static_cast(code)); } -WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error, const std::string& desc) { +ndk::ScopedAStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error, + const std::string& desc) { switch (error) { + case legacy_hal::WIFI_ERROR_NONE: + return ndk::ScopedAStatus::ok(); + case legacy_hal::WIFI_ERROR_UNINITIALIZED: case legacy_hal::WIFI_ERROR_NOT_AVAILABLE: return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE, desc); @@ -84,9 +88,6 @@ WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error, const s case legacy_hal::WIFI_ERROR_BUSY: return createWifiStatus(WifiStatusCode::ERROR_BUSY); - case legacy_hal::WIFI_ERROR_NONE: - return createWifiStatus(WifiStatusCode::SUCCESS, desc); - case legacy_hal::WIFI_ERROR_UNKNOWN: return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, "unknown"); @@ -95,12 +96,11 @@ WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error, const s } } -WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error) { +ndk::ScopedAStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error) { return createWifiStatusFromLegacyError(error, ""); } -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl diff --git a/wifi/1.6/default/wifi_status_util.h b/wifi/aidl/default/wifi_status_util.h similarity index 59% rename from wifi/1.6/default/wifi_status_util.h rename to wifi/aidl/default/wifi_status_util.h index ea1c29486b..633811dbf6 100644 --- a/wifi/1.6/default/wifi_status_util.h +++ b/wifi/aidl/default/wifi_status_util.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 The Android Open Source Project + * 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. @@ -17,28 +17,26 @@ #ifndef WIFI_STATUS_UTIL_H_ #define WIFI_STATUS_UTIL_H_ -#include +#include #include "wifi_legacy_hal.h" +namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace V1_6 { -namespace implementation { -using namespace android::hardware::wifi::V1_0; +using ::aidl::android::hardware::wifi::WifiStatusCode; std::string legacyErrorToString(legacy_hal::wifi_error error); -WifiStatus createWifiStatus(WifiStatusCode code, const std::string& description); -WifiStatus createWifiStatus(WifiStatusCode code); -WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error, - const std::string& description); -WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error); +ndk::ScopedAStatus createWifiStatus(WifiStatusCode code, const std::string& description); +ndk::ScopedAStatus createWifiStatus(WifiStatusCode code); +ndk::ScopedAStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error, + const std::string& description); +ndk::ScopedAStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error); -} // namespace implementation -} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android +} // namespace aidl #endif // WIFI_STATUS_UTIL_H_ diff --git a/wifi/aidl/vts/functional/Android.bp b/wifi/aidl/vts/functional/Android.bp new file mode 100644 index 0000000000..1277182493 --- /dev/null +++ b/wifi/aidl/vts/functional/Android.bp @@ -0,0 +1,169 @@ +// +// 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. +// + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_test { + name: "VtsHalWifiChipTargetTest", + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + srcs: [ + "wifi_chip_aidl_test.cpp", + ], + shared_libs: [ + "libbinder", + "libbinder_ndk", + "libvndksupport", + ], + static_libs: [ + "VtsHalWifiTargetTestUtil", + "android.hardware.wifi-V1-ndk", + "libwifi-system-iface", + ], + test_suites: [ + "general-tests", + "vts", + ], +} + +cc_test { + name: "VtsHalWifiStaIfaceTargetTest", + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + srcs: [ + "wifi_sta_iface_aidl_test.cpp", + ], + shared_libs: [ + "libbinder", + "libbinder_ndk", + "libvndksupport", + ], + static_libs: [ + "VtsHalWifiTargetTestUtil", + "android.hardware.wifi-V1-ndk", + "libwifi-system-iface", + ], + test_suites: [ + "general-tests", + "vts", + ], +} + +cc_test { + name: "VtsHalWifiApIfaceTargetTest", + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + srcs: [ + "wifi_ap_iface_aidl_test.cpp", + ], + shared_libs: [ + "libbinder", + "libbinder_ndk", + "libvndksupport", + ], + static_libs: [ + "VtsHalWifiTargetTestUtil", + "android.hardware.wifi-V1-ndk", + "libwifi-system-iface", + ], + test_suites: [ + "general-tests", + "vts", + ], +} + +cc_test { + name: "VtsHalWifiNanIfaceTargetTest", + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + srcs: [ + "wifi_nan_iface_aidl_test.cpp", + ], + shared_libs: [ + "libbinder", + "libbinder_ndk", + "libvndksupport", + ], + static_libs: [ + "VtsHalWifiTargetTestUtil", + "android.hardware.wifi-V1-ndk", + "libwifi-system-iface", + ], + test_suites: [ + "general-tests", + "vts", + ], +} + +cc_test { + name: "VtsHalWifiRttControllerTargetTest", + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + srcs: [ + "wifi_rtt_controller_aidl_test.cpp", + ], + shared_libs: [ + "libbinder", + "libbinder_ndk", + "libvndksupport", + ], + static_libs: [ + "VtsHalWifiTargetTestUtil", + "android.hardware.wifi-V1-ndk", + "libwifi-system-iface", + ], + test_suites: [ + "general-tests", + "vts", + ], +} + +cc_library_static { + name: "VtsHalWifiTargetTestUtil", + defaults: ["VtsHalTargetTestDefaults"], + srcs: [ + "wifi_aidl_test_utils.cpp", + ], + export_include_dirs: [ + ".", + ], + shared_libs: [ + "libbinder", + "libbinder_ndk", + "libnativehelper", + ], + static_libs: [ + "android.hardware.wifi-V1-ndk", + "libwifi-system-iface", + ], +} diff --git a/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp b/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp new file mode 100644 index 0000000000..6722f36dc9 --- /dev/null +++ b/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp @@ -0,0 +1,216 @@ +/* + * 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. + */ + +#include "wifi_aidl_test_utils.h" + +using ::android::wifi_system::InterfaceTool; + +namespace { +bool findAnyModeSupportingConcurrencyType(IfaceConcurrencyType desired_type, + const std::vector& modes, + int* mode_id) { + for (const auto& mode : modes) { + for (const auto& combination : mode.availableCombinations) { + for (const auto& iface_limit : combination.limits) { + const auto& iface_types = iface_limit.types; + if (std::find(iface_types.begin(), iface_types.end(), desired_type) != + iface_types.end()) { + *mode_id = mode.id; + return true; + } + } + } + } + return false; +} + +bool configureChipToSupportConcurrencyTypeInternal(const std::shared_ptr& wifi_chip, + IfaceConcurrencyType type, + int* configured_mode_id) { + if (!configured_mode_id) { + return false; + } + std::vector chip_modes; + auto status = wifi_chip->getAvailableModes(&chip_modes); + if (!status.isOk()) { + return false; + } + if (!findAnyModeSupportingConcurrencyType(type, chip_modes, configured_mode_id)) { + return false; + } + if (!wifi_chip->configureChip(*configured_mode_id).isOk()) { + return false; + } + return true; +} + +bool configureChipToSupportConcurrencyTypeInternal(const std::shared_ptr& wifi_chip, + IfaceConcurrencyType type) { + int mode_id; + return configureChipToSupportConcurrencyTypeInternal(wifi_chip, type, &mode_id); +} +} // namespace + +bool checkStatusCode(ndk::ScopedAStatus* status, WifiStatusCode expected_code) { + if (status == nullptr) { + return false; + } + return status->getServiceSpecificError() == static_cast(expected_code); +} + +std::shared_ptr getWifi(const char* instance_name) { + return IWifi::fromBinder(ndk::SpAIBinder(AServiceManager_waitForService(instance_name))); +} + +std::shared_ptr getWifiChip(const char* instance_name) { + std::shared_ptr wifi = getWifi(instance_name); + if (!wifi.get()) { + return nullptr; + } + + const int retry_interval_ms = 2; + const int max_retries = 5; + int retry_count = 0; + auto status = wifi->start(); + while (retry_count < max_retries && !status.isOk()) { + retry_count++; + usleep(retry_interval_ms * 1000); + status = wifi->start(); + } + if (!status.isOk()) { + return nullptr; + } + + std::vector chip_ids = {}; + status = wifi->getChipIds(&chip_ids); + if (!status.isOk() || chip_ids.size() == 0) { + return nullptr; + } + std::shared_ptr chip; + status = wifi->getChip(chip_ids[0], &chip); + if (!status.isOk()) { + return nullptr; + } + return chip; +} + +void setupStaIface(const std::shared_ptr& iface) { + std::string iface_name; + auto status = iface->getName(&iface_name); + if (status.isOk()) { + InterfaceTool iface_tool; + iface_tool.SetUpState(iface_name.c_str(), true); + } +} + +void setupNanIface(const std::shared_ptr& iface) { + std::string iface_name; + auto status = iface->getName(&iface_name); + if (status.isOk()) { + InterfaceTool iface_tool; + iface_tool.SetUpState(iface_name.c_str(), true); + } +} + +std::shared_ptr getWifiStaIface(const char* instance_name) { + std::shared_ptr wifi_chip = getWifiChip(instance_name); + if (!wifi_chip.get()) { + return nullptr; + } + if (!configureChipToSupportConcurrencyTypeInternal(wifi_chip, IfaceConcurrencyType::STA)) { + return nullptr; + } + std::shared_ptr iface; + auto status = wifi_chip->createStaIface(&iface); + if (!status.isOk()) { + return nullptr; + } + setupStaIface(iface); + return iface; +} + +std::shared_ptr getWifiNanIface(const char* instance_name) { + std::shared_ptr wifi_chip = getWifiChip(instance_name); + if (!wifi_chip.get()) { + return nullptr; + } + if (!configureChipToSupportConcurrencyTypeInternal(wifi_chip, + IfaceConcurrencyType::NAN_IFACE)) { + return nullptr; + } + std::shared_ptr iface; + auto status = wifi_chip->createNanIface(&iface); + if (!status.isOk()) { + return nullptr; + } + setupNanIface(iface); + return iface; +} + +std::shared_ptr getWifiApIface(const char* instance_name) { + std::shared_ptr wifi_chip = getWifiChip(instance_name); + if (!wifi_chip.get()) { + return nullptr; + } + if (!configureChipToSupportConcurrencyTypeInternal(wifi_chip, IfaceConcurrencyType::AP)) { + return nullptr; + } + std::shared_ptr iface; + auto status = wifi_chip->createApIface(&iface); + if (!status.isOk()) { + return nullptr; + } + return iface; +} + +std::shared_ptr getBridgedWifiApIface(std::shared_ptr wifi_chip) { + if (!wifi_chip.get()) { + return nullptr; + } + int mode_id; + std::shared_ptr iface; + configureChipToSupportConcurrencyTypeInternal(wifi_chip, IfaceConcurrencyType::AP, &mode_id); + auto status = wifi_chip->createBridgedApIface(&iface); + if (!status.isOk()) { + return nullptr; + } + return iface; +} + +std::shared_ptr getBridgedWifiApIface(const char* instance_name) { + std::shared_ptr wifi_chip = getWifiChip(instance_name); + return getBridgedWifiApIface(wifi_chip); +} + +bool configureChipToSupportConcurrencyType(const std::shared_ptr& wifi_chip, + IfaceConcurrencyType type, int* configured_mode_id) { + return configureChipToSupportConcurrencyTypeInternal(wifi_chip, type, configured_mode_id); +} + +void stopWifiService(const char* instance_name) { + std::shared_ptr wifi = getWifi(instance_name); + if (wifi != nullptr) { + wifi->stop(); + } +} + +int32_t getChipCapabilities(const std::shared_ptr& wifi_chip) { + IWifiChip::ChipCapabilityMask caps = {}; + if (wifi_chip->getCapabilities(&caps).isOk()) { + return static_cast(caps); + } + return 0; +} diff --git a/wifi/aidl/vts/functional/wifi_aidl_test_utils.h b/wifi/aidl/vts/functional/wifi_aidl_test_utils.h new file mode 100644 index 0000000000..ad16603dd3 --- /dev/null +++ b/wifi/aidl/vts/functional/wifi_aidl_test_utils.h @@ -0,0 +1,48 @@ +/* + * 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. + */ + +#pragma once + +#include + +#include +#include +#include +#include + +using aidl::android::hardware::wifi::IfaceConcurrencyType; +using aidl::android::hardware::wifi::IWifi; +using aidl::android::hardware::wifi::IWifiApIface; +using aidl::android::hardware::wifi::IWifiChip; +using aidl::android::hardware::wifi::IWifiNanIface; +using aidl::android::hardware::wifi::IWifiStaIface; +using aidl::android::hardware::wifi::WifiStatusCode; + +// Helper functions to obtain references to the various AIDL interface objects. +std::shared_ptr getWifi(const char* instance_name); +std::shared_ptr getWifiChip(const char* instance_name); +std::shared_ptr getWifiStaIface(const char* instance_name); +std::shared_ptr getWifiNanIface(const char* instance_name); +std::shared_ptr getWifiApIface(const char* instance_name); +std::shared_ptr getBridgedWifiApIface(const char* instance_name); +std::shared_ptr getBridgedWifiApIface(std::shared_ptr wifi_chip); +// Configure the chip in a mode to support the creation of the provided iface type. +bool configureChipToSupportConcurrencyType(const std::shared_ptr& wifi_chip, + IfaceConcurrencyType type, int* configured_mode_id); +// Used to trigger IWifi.stop() at the end of every test. +void stopWifiService(const char* instance_name); +int32_t getChipCapabilities(const std::shared_ptr& wifi_chip); +bool checkStatusCode(ndk::ScopedAStatus* status, WifiStatusCode expected_code); diff --git a/wifi/aidl/vts/functional/wifi_ap_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_ap_iface_aidl_test.cpp new file mode 100644 index 0000000000..0eaf660d49 --- /dev/null +++ b/wifi/aidl/vts/functional/wifi_ap_iface_aidl_test.cpp @@ -0,0 +1,154 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Staache 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. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "wifi_aidl_test_utils.h" + +using aidl::android::hardware::wifi::IWifiApIface; +using aidl::android::hardware::wifi::WifiBand; + +class WifiApIfaceAidlTest : public testing::TestWithParam { + public: + void SetUp() override { + isBridgedSupport_ = testing::checkSubstringInCommandOutput( + "/system/bin/cmd wifi get-softap-supported-features", + "wifi_softap_bridged_ap_supported"); + stopWifiService(getInstanceName()); + } + + void TearDown() override { stopWifiService(getInstanceName()); } + + protected: + bool isBridgedSupport_ = false; + const char* getInstanceName() { return GetParam().c_str(); } +}; + +/* + * SetMacAddress + */ +TEST_P(WifiApIfaceAidlTest, SetMacAddress) { + std::shared_ptr wifi_ap_iface = getWifiApIface(getInstanceName()); + ASSERT_NE(nullptr, wifi_ap_iface.get()); + std::array mac = {0x12, 0x22, 0x33, 0x52, 0x10, 0x44}; + EXPECT_TRUE(wifi_ap_iface->setMacAddress(mac).isOk()); +} + +/* + * SetCountryCode + */ +TEST_P(WifiApIfaceAidlTest, SetCountryCode) { + std::shared_ptr wifi_ap_iface = getWifiApIface(getInstanceName()); + ASSERT_NE(nullptr, wifi_ap_iface.get()); + + const std::array country_code = {0x55, 0x53}; + EXPECT_TRUE(wifi_ap_iface->setCountryCode(country_code).isOk()); +} + +/* + * GetValidFrequenciesForBand + * Ensures that we can retrieve valid frequencies for the 2.4 GHz band. + */ +TEST_P(WifiApIfaceAidlTest, GetValidFrequenciesForBand) { + std::shared_ptr wifi_ap_iface = getWifiApIface(getInstanceName()); + ASSERT_NE(nullptr, wifi_ap_iface.get()); + + std::vector freqs; + EXPECT_TRUE(wifi_ap_iface->getValidFrequenciesForBand(WifiBand::BAND_24GHZ, &freqs).isOk()); + EXPECT_NE(freqs.size(), 0); +} + +/* + * GetFactoryMacAddress + */ +TEST_P(WifiApIfaceAidlTest, GetFactoryMacAddress) { + std::shared_ptr wifi_ap_iface = getWifiApIface(getInstanceName()); + ASSERT_NE(nullptr, wifi_ap_iface.get()); + + std::array mac; + EXPECT_TRUE(wifi_ap_iface->getFactoryMacAddress(&mac).isOk()); + std::array all_zero_mac = {0, 0, 0, 0, 0, 0}; + EXPECT_NE(mac, all_zero_mac); +} + +/** + * GetBridgedInstances - non-bridged mode + */ +TEST_P(WifiApIfaceAidlTest, GetBridgedInstances) { + std::shared_ptr wifi_ap_iface = getWifiApIface(getInstanceName()); + ASSERT_NE(nullptr, wifi_ap_iface.get()); + + std::vector instances; + EXPECT_TRUE(wifi_ap_iface->getBridgedInstances(&instances).isOk()); + EXPECT_EQ(instances.size(), 0); +} + +/** + * GetBridgedInstances - bridged AP mode. + */ +TEST_P(WifiApIfaceAidlTest, GetBridgedInstances_Bridged) { + if (!isBridgedSupport_) { + GTEST_SKIP() << "Missing Bridged AP support"; + } + std::shared_ptr wifi_ap_iface = getBridgedWifiApIface(getInstanceName()); + ASSERT_NE(nullptr, wifi_ap_iface.get()); + + std::vector instances; + EXPECT_TRUE(wifi_ap_iface->getBridgedInstances(&instances).isOk()); + EXPECT_EQ(instances.size(), 2); +} + +/** + * ResetToFactoryMacAddress - non-bridged mode + */ +TEST_P(WifiApIfaceAidlTest, ResetToFactoryMacAddress) { + std::shared_ptr wifi_ap_iface = getWifiApIface(getInstanceName()); + ASSERT_NE(nullptr, wifi_ap_iface.get()); + EXPECT_TRUE(wifi_ap_iface->resetToFactoryMacAddress().isOk()); +} + +/** + * ResetToFactoryMacAddress - bridged AP mode + */ +TEST_P(WifiApIfaceAidlTest, ResetToFactoryMacAddress_Bridged) { + if (!isBridgedSupport_) { + GTEST_SKIP() << "Missing Bridged AP support"; + } + std::shared_ptr wifi_ap_iface = getBridgedWifiApIface(getInstanceName()); + ASSERT_NE(nullptr, wifi_ap_iface.get()); + EXPECT_TRUE(wifi_ap_iface->resetToFactoryMacAddress().isOk()); +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiApIfaceAidlTest); +INSTANTIATE_TEST_SUITE_P(WifiTest, WifiApIfaceAidlTest, + testing::ValuesIn(android::getAidlHalInstanceNames(IWifi::descriptor)), + android::PrintInstanceNameToString); + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + android::ProcessState::self()->setThreadPoolMaxThreadCount(1); + android::ProcessState::self()->startThreadPool(); + return RUN_ALL_TESTS(); +} diff --git a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp new file mode 100644 index 0000000000..0806ed289d --- /dev/null +++ b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp @@ -0,0 +1,889 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Staache 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. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "wifi_aidl_test_utils.h" + +using aidl::android::hardware::wifi::BnWifiChipEventCallback; +using aidl::android::hardware::wifi::IfaceType; +using aidl::android::hardware::wifi::IWifiApIface; +using aidl::android::hardware::wifi::IWifiChip; +using aidl::android::hardware::wifi::IWifiNanIface; +using aidl::android::hardware::wifi::IWifiP2pIface; +using aidl::android::hardware::wifi::IWifiRttController; +using aidl::android::hardware::wifi::WifiBand; +using aidl::android::hardware::wifi::WifiDebugHostWakeReasonStats; +using aidl::android::hardware::wifi::WifiDebugRingBufferStatus; +using aidl::android::hardware::wifi::WifiDebugRingBufferVerboseLevel; +using aidl::android::hardware::wifi::WifiIfaceMode; +using aidl::android::hardware::wifi::WifiRadioCombinationMatrix; +using aidl::android::hardware::wifi::WifiStatusCode; +using aidl::android::hardware::wifi::WifiUsableChannel; + +class WifiChipAidlTest : public testing::TestWithParam { + public: + void SetUp() override { + stopWifiService(getInstanceName()); + wifi_chip_ = getWifiChip(getInstanceName()); + ASSERT_NE(nullptr, wifi_chip_.get()); + } + + void TearDown() override { stopWifiService(getInstanceName()); } + + protected: + int configureChipForConcurrencyType(IfaceConcurrencyType type) { + int mode_id; + EXPECT_TRUE(configureChipToSupportConcurrencyType(wifi_chip_, type, &mode_id)); + return mode_id; + } + + std::shared_ptr configureChipForStaAndGetIface() { + std::shared_ptr iface; + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + EXPECT_TRUE(wifi_chip_->createStaIface(&iface).isOk()); + EXPECT_NE(nullptr, iface.get()); + return iface; + } + + std::shared_ptr configureChipForP2pAndGetIface() { + std::shared_ptr iface; + configureChipForConcurrencyType(IfaceConcurrencyType::P2P); + EXPECT_TRUE(wifi_chip_->createP2pIface(&iface).isOk()); + EXPECT_NE(nullptr, iface.get()); + return iface; + } + + std::shared_ptr configureChipForApAndGetIface() { + std::shared_ptr iface; + configureChipForConcurrencyType(IfaceConcurrencyType::AP); + EXPECT_TRUE(wifi_chip_->createApIface(&iface).isOk()); + EXPECT_NE(nullptr, iface.get()); + return iface; + } + + std::shared_ptr configureChipForNanAndGetIface() { + std::shared_ptr iface; + configureChipForConcurrencyType(IfaceConcurrencyType::NAN_IFACE); + EXPECT_TRUE(wifi_chip_->createNanIface(&iface).isOk()); + EXPECT_NE(nullptr, iface.get()); + return iface; + } + + std::string getStaIfaceName(const std::shared_ptr& iface) { + std::string iface_name; + EXPECT_TRUE(iface->getName(&iface_name).isOk()); + return iface_name; + } + + std::string getP2pIfaceName(const std::shared_ptr& iface) { + std::string iface_name; + EXPECT_TRUE(iface->getName(&iface_name).isOk()); + return iface_name; + } + + std::string getApIfaceName(const std::shared_ptr& iface) { + std::string iface_name; + EXPECT_TRUE(iface->getName(&iface_name).isOk()); + return iface_name; + } + + std::string getNanIfaceName(const std::shared_ptr& iface) { + std::string iface_name; + EXPECT_TRUE(iface->getName(&iface_name).isOk()); + return iface_name; + } + + std::vector> create2StaIfacesIfPossible() { + std::shared_ptr iface1 = configureChipForStaAndGetIface(); + + // Try create a create second iface. + std::shared_ptr iface2; + bool add_second_success = wifi_chip_->createStaIface(&iface2).isOk(); + if (!add_second_success) { + return {iface1}; + } + EXPECT_NE(nullptr, iface2.get()); + return {iface1, iface2}; + } + + bool hasAnyRingBufferCapabilities(int32_t caps) { + return caps & + (static_cast( + IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_CONNECT_EVENT) | + static_cast(IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_POWER_EVENT) | + static_cast( + IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_WAKELOCK_EVENT) | + static_cast(IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_VENDOR_DATA)); + } + + const char* getInstanceName() { return GetParam().c_str(); } + + std::shared_ptr wifi_chip_; +}; + +class WifiChipEventCallback : public BnWifiChipEventCallback { + public: + WifiChipEventCallback() = default; + + ::ndk::ScopedAStatus onChipReconfigureFailure(WifiStatusCode /* status */) override { + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus onChipReconfigured(int /* modeId */) override { + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus onDebugErrorAlert(int /* errorCode */, + const std::vector& /* debugData */) override { + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus onDebugRingBufferDataAvailable( + const WifiDebugRingBufferStatus& /* status */, + const std::vector& /* data */) override { + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus onIfaceAdded(IfaceType /* type */, + const std::string& /* name */) override { + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus onIfaceRemoved(IfaceType /* type */, + const std::string& /* name */) override { + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus onRadioModeChange( + const std::vector& /* radioModeInfos */) override { + return ndk::ScopedAStatus::ok(); + } +}; + +/* + * RegisterEventCallback + * + * Note: it is not feasible to test the invocation of the callback function, + * since events are triggered internally in the HAL implementation and cannot be + * triggered from the test case. + */ +TEST_P(WifiChipAidlTest, RegisterEventCallback) { + std::shared_ptr callback = + ndk::SharedRefBase::make(); + ASSERT_NE(nullptr, callback.get()); + EXPECT_TRUE(wifi_chip_->registerEventCallback(callback).isOk()); +} + +/* + * GetCapabilities + */ +TEST_P(WifiChipAidlTest, GetCapabilities) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + EXPECT_NE(static_cast(caps), 0); +} + +/* + * GetId + */ +TEST_P(WifiChipAidlTest, GetId) { + int id; + EXPECT_TRUE(wifi_chip_->getId(&id).isOk()); +} + +/* + * GetAvailableModes + */ +TEST_P(WifiChipAidlTest, GetAvailableModes) { + std::vector modes; + EXPECT_TRUE(wifi_chip_->getAvailableModes(&modes).isOk()); + EXPECT_NE(modes.size(), 0); +} + +/* + * GetMode + */ +TEST_P(WifiChipAidlTest, GetMode) { + int expected_mode = configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int retrieved_mode; + EXPECT_TRUE(wifi_chip_->getMode(&retrieved_mode).isOk()); + EXPECT_EQ(retrieved_mode, expected_mode); +} + +/* + * GetUsableChannels + */ +TEST_P(WifiChipAidlTest, GetUsableChannels) { + WifiBand band = WifiBand::BAND_24GHZ_5GHZ_6GHZ; + uint32_t ifaceModeMask = static_cast(WifiIfaceMode::IFACE_MODE_P2P_CLIENT) | + static_cast(WifiIfaceMode::IFACE_MODE_P2P_GO); + uint32_t filterMask = + static_cast(IWifiChip::UsableChannelFilter::CELLULAR_COEXISTENCE) | + static_cast(IWifiChip::UsableChannelFilter::CONCURRENCY); + + std::vector channels; + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + auto status = wifi_chip_->getUsableChannels( + band, static_cast(ifaceModeMask), + static_cast(filterMask), &channels); + if (checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { + GTEST_SKIP() << "getUsableChannels() is not supported by vendor."; + } + EXPECT_TRUE(status.isOk()); +} + +/* + * GetSupportedRadioCombinationsMatrix + */ +TEST_P(WifiChipAidlTest, GetSupportedRadioCombinationsMatrix) { + WifiRadioCombinationMatrix combination_matrix = {}; + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + auto status = wifi_chip_->getSupportedRadioCombinationsMatrix(&combination_matrix); + if (checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { + GTEST_SKIP() << "Skipping this test since getSupportedRadioCombinationsMatrix() " + "is not supported by vendor."; + } + EXPECT_TRUE(status.isOk()); +} + +/* + * SetCountryCode + */ +TEST_P(WifiChipAidlTest, SetCountryCode) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + std::array country_code = {0x55, 0x53}; + EXPECT_TRUE(wifi_chip_->setCountryCode(country_code).isOk()); +} + +/* + * SetLatencyMode_normal + * Tests the setLatencyMode() API with Latency mode NORMAL. + */ +TEST_P(WifiChipAidlTest, SetLatencyMode_normal) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + auto status = wifi_chip_->setLatencyMode(IWifiChip::LatencyMode::NORMAL); + if (caps & static_cast(IWifiChip::ChipCapabilityMask::SET_LATENCY_MODE)) { + EXPECT_TRUE(status.isOk()); + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * SetLatencyMode_low + * Tests the setLatencyMode() API with Latency mode LOW. + */ +TEST_P(WifiChipAidlTest, SetLatencyMode_low) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + auto status = wifi_chip_->setLatencyMode(IWifiChip::LatencyMode::LOW); + if (caps & static_cast(IWifiChip::ChipCapabilityMask::SET_LATENCY_MODE)) { + EXPECT_TRUE(status.isOk()); + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * SetMultiStaPrimaryConnection + * + * Only runs if the device supports 2 STA ifaces. + */ +TEST_P(WifiChipAidlTest, SetMultiStaPrimaryConnection) { + auto ifaces = create2StaIfacesIfPossible(); + if (ifaces.size() < 2) { + GTEST_SKIP() << "Device does not support more than 1 STA concurrently"; + } + + auto status = wifi_chip_->setMultiStaPrimaryConnection(getStaIfaceName(ifaces[0])); + if (!status.isOk()) { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * SetMultiStaUseCase + * + * Only runs if the device supports 2 STA ifaces. + */ +TEST_P(WifiChipAidlTest, setMultiStaUseCase) { + auto ifaces = create2StaIfacesIfPossible(); + if (ifaces.size() < 2) { + GTEST_SKIP() << "Device does not support more than 1 STA concurrently"; + } + + auto status = wifi_chip_->setMultiStaUseCase( + IWifiChip::MultiStaUseCase::DUAL_STA_TRANSIENT_PREFER_PRIMARY); + if (!status.isOk()) { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * SetCoexUnsafeChannels + */ +TEST_P(WifiChipAidlTest, SetCoexUnsafeChannels) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + + // Test with an empty vector of CoexUnsafeChannels. + std::vector vec; + IWifiChip::CoexRestriction restrictions = static_cast(0); + auto status = wifi_chip_->setCoexUnsafeChannels(vec, restrictions); + if (!status.isOk()) { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } + + // Test with a non-empty vector of CoexUnsafeChannels. + IWifiChip::CoexUnsafeChannel unsafeChannel24Ghz; + unsafeChannel24Ghz.band = WifiBand::BAND_24GHZ; + unsafeChannel24Ghz.channel = 6; + vec.push_back(unsafeChannel24Ghz); + IWifiChip::CoexUnsafeChannel unsafeChannel5Ghz; + unsafeChannel5Ghz.band = WifiBand::BAND_5GHZ; + unsafeChannel5Ghz.channel = 36; + vec.push_back(unsafeChannel5Ghz); + restrictions = static_cast( + static_cast(IWifiChip::CoexRestriction::WIFI_AWARE) | + static_cast(IWifiChip::CoexRestriction::SOFTAP) | + static_cast(IWifiChip::CoexRestriction::WIFI_DIRECT)); + + status = wifi_chip_->setCoexUnsafeChannels(vec, restrictions); + if (!status.isOk()) { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * SelectTxPowerScenario - Body + */ +TEST_P(WifiChipAidlTest, SelectTxPowerScenario_body) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + int32_t expected_caps = + static_cast(IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT) | + static_cast(IWifiChip::ChipCapabilityMask::USE_BODY_HEAD_SAR); + auto status = wifi_chip_->selectTxPowerScenario(IWifiChip::TxPowerScenario::ON_BODY_CELL_OFF); + if (caps & expected_caps) { + EXPECT_TRUE(status.isOk()); + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * SelectTxPowerScenario - Voice Call + */ +TEST_P(WifiChipAidlTest, SelectTxPowerScenario_voiceCall) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + auto status = wifi_chip_->selectTxPowerScenario(IWifiChip::TxPowerScenario::VOICE_CALL); + if (caps & static_cast(IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT)) { + EXPECT_TRUE(status.isOk()); + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * ResetTxPowerScenario + */ +TEST_P(WifiChipAidlTest, ResetTxPowerScenario) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + auto status = wifi_chip_->resetTxPowerScenario(); + if (caps & static_cast(IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT)) { + EXPECT_TRUE(status.isOk()); + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * ConfigureChip + */ +TEST_P(WifiChipAidlTest, ConfigureChip) { + std::vector modes; + EXPECT_TRUE(wifi_chip_->getAvailableModes(&modes).isOk()); + EXPECT_NE(modes.size(), 0); + for (const auto& mode : modes) { + // configureChip() requires a fresh IWifiChip object. + wifi_chip_ = getWifiChip(getInstanceName()); + ASSERT_NE(nullptr, wifi_chip_.get()); + EXPECT_TRUE(wifi_chip_->configureChip(mode.id).isOk()); + stopWifiService(getInstanceName()); + // Sleep for 5 milliseconds between each wifi state toggle. + usleep(5000); + } +} + +/* + * RequestChipDebugInfo + */ +TEST_P(WifiChipAidlTest, RequestChipDebugInfo) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + IWifiChip::ChipDebugInfo debug_info = {}; + EXPECT_TRUE(wifi_chip_->requestChipDebugInfo(&debug_info).isOk()); + EXPECT_NE(debug_info.driverDescription.size(), 0); + EXPECT_NE(debug_info.firmwareDescription.size(), 0); +} + +/* + * RequestFirmwareDebugDump + */ +TEST_P(WifiChipAidlTest, RequestFirmwareDebugDump) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + std::vector debug_dump; + auto status = wifi_chip_->requestFirmwareDebugDump(&debug_dump); + if (caps & static_cast(IWifiChip::ChipCapabilityMask::DEBUG_MEMORY_FIRMWARE_DUMP)) { + EXPECT_TRUE(status.isOk()); + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * RequestDriverDebugDump + */ +TEST_P(WifiChipAidlTest, RequestDriverDebugDump) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + std::vector debug_dump; + auto status = wifi_chip_->requestDriverDebugDump(&debug_dump); + if (caps & static_cast(IWifiChip::ChipCapabilityMask::DEBUG_MEMORY_DRIVER_DUMP)) { + EXPECT_TRUE(status.isOk()); + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * GetDebugRingBuffersStatus + */ +TEST_P(WifiChipAidlTest, GetDebugRingBuffersStatus) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + std::vector ring_buffer_status; + auto status = wifi_chip_->getDebugRingBuffersStatus(&ring_buffer_status); + if (hasAnyRingBufferCapabilities(caps)) { + EXPECT_TRUE(status.isOk()); + ASSERT_NE(ring_buffer_status.size(), 0); + for (const auto& ring_buffer : ring_buffer_status) { + EXPECT_NE(ring_buffer.ringName.size(), 0); + } + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * GetDebugHostWakeReasonStats + */ +TEST_P(WifiChipAidlTest, GetDebugHostWakeReasonStats) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + WifiDebugHostWakeReasonStats wake_reason_stats = {}; + auto status = wifi_chip_->getDebugHostWakeReasonStats(&wake_reason_stats); + if (caps & static_cast(IWifiChip::ChipCapabilityMask::DEBUG_HOST_WAKE_REASON_STATS)) { + EXPECT_TRUE(status.isOk()); + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * StartLoggingToDebugRingBuffer + */ +TEST_P(WifiChipAidlTest, StartLoggingToDebugRingBuffer) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + std::string ring_name; + std::vector ring_buffer_status; + auto status = wifi_chip_->getDebugRingBuffersStatus(&ring_buffer_status); + + if (hasAnyRingBufferCapabilities(caps)) { + EXPECT_TRUE(status.isOk()); + ASSERT_NE(ring_buffer_status.size(), 0); + ring_name = ring_buffer_status[0].ringName; + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } + + status = wifi_chip_->startLoggingToDebugRingBuffer( + ring_name, WifiDebugRingBufferVerboseLevel::VERBOSE, 5, 1024); + if (hasAnyRingBufferCapabilities(caps)) { + EXPECT_TRUE(status.isOk()); + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * ForceDumpToDebugRingBuffer + */ +TEST_P(WifiChipAidlTest, ForceDumpToDebugRingBuffer) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + std::string ring_name; + std::vector ring_buffer_status; + auto status = wifi_chip_->getDebugRingBuffersStatus(&ring_buffer_status); + + if (hasAnyRingBufferCapabilities(caps)) { + EXPECT_TRUE(status.isOk()); + ASSERT_NE(ring_buffer_status.size(), 0); + ring_name = ring_buffer_status[0].ringName; + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } + + status = wifi_chip_->forceDumpToDebugRingBuffer(ring_name); + if (hasAnyRingBufferCapabilities(caps)) { + EXPECT_TRUE(status.isOk()); + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * CreateStaIface + * Configures the chip in STA mode and creates an iface. + */ +TEST_P(WifiChipAidlTest, CreateStaIface) { + configureChipForStaAndGetIface(); +} + +/* + * CreateApIface + */ +TEST_P(WifiChipAidlTest, CreateApIface) { + configureChipForApAndGetIface(); +} + +/* + * CreateNanIface + */ +TEST_P(WifiChipAidlTest, CreateNanIface) { + configureChipForNanAndGetIface(); +} + +/* + * CreateP2pIface + */ +TEST_P(WifiChipAidlTest, CreateP2pIface) { + configureChipForNanAndGetIface(); +} + +/* + * GetStaIfaceNames + * Configures the chip in STA mode and ensures that the iface name list is + * empty before creating the iface. Then create the iface and ensure that + * iface name is returned in the iface name list. + */ +TEST_P(WifiChipAidlTest, GetStaIfaceNames) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + + std::vector iface_names; + EXPECT_TRUE(wifi_chip_->getP2pIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 0); + + std::shared_ptr iface; + EXPECT_TRUE(wifi_chip_->createStaIface(&iface).isOk()); + ASSERT_NE(nullptr, iface.get()); + + std::string iface_name = getStaIfaceName(iface); + EXPECT_TRUE(wifi_chip_->getStaIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 1); + EXPECT_EQ(iface_name, iface_names[0]); + + EXPECT_TRUE(wifi_chip_->removeStaIface(iface_name).isOk()); + EXPECT_TRUE(wifi_chip_->getStaIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 0); +} + +/* + * GetP2pIfaceNames + */ +TEST_P(WifiChipAidlTest, GetP2pIfaceNames) { + configureChipForConcurrencyType(IfaceConcurrencyType::P2P); + + std::vector iface_names; + EXPECT_TRUE(wifi_chip_->getP2pIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 0); + + std::shared_ptr iface; + EXPECT_TRUE(wifi_chip_->createP2pIface(&iface).isOk()); + ASSERT_NE(nullptr, iface.get()); + + std::string iface_name = getP2pIfaceName(iface); + EXPECT_TRUE(wifi_chip_->getP2pIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 1); + EXPECT_EQ(iface_name, iface_names[0]); + + EXPECT_TRUE(wifi_chip_->removeP2pIface(iface_name).isOk()); + EXPECT_TRUE(wifi_chip_->getP2pIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 0); +} + +/* + * GetApIfaceNames + */ +TEST_P(WifiChipAidlTest, GetApIfaceNames) { + configureChipForConcurrencyType(IfaceConcurrencyType::AP); + + std::vector iface_names; + EXPECT_TRUE(wifi_chip_->getApIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 0); + + std::shared_ptr iface; + EXPECT_TRUE(wifi_chip_->createApIface(&iface).isOk()); + ASSERT_NE(nullptr, iface.get()); + + std::string iface_name = getApIfaceName(iface); + EXPECT_TRUE(wifi_chip_->getApIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 1); + EXPECT_EQ(iface_name, iface_names[0]); + + EXPECT_TRUE(wifi_chip_->removeApIface(iface_name).isOk()); + EXPECT_TRUE(wifi_chip_->getApIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 0); +} + +/* + * GetNanIfaceNames + */ +TEST_P(WifiChipAidlTest, GetNanIfaceNames) { + configureChipForConcurrencyType(IfaceConcurrencyType::NAN_IFACE); + + std::vector iface_names; + EXPECT_TRUE(wifi_chip_->getNanIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 0); + + std::shared_ptr iface; + EXPECT_TRUE(wifi_chip_->createNanIface(&iface).isOk()); + ASSERT_NE(nullptr, iface.get()); + + std::string iface_name = getNanIfaceName(iface); + EXPECT_TRUE(wifi_chip_->getNanIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 1); + EXPECT_EQ(iface_name, iface_names[0]); + + EXPECT_TRUE(wifi_chip_->removeNanIface(iface_name).isOk()); + EXPECT_TRUE(wifi_chip_->getNanIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 0); +} + +/* + * GetStaIface + * Configures the chip in STA mode and creates an iface. Then retrieves + * the iface object using its name and ensures that any other name + * doesn't retrieve a valid iface object. + */ +TEST_P(WifiChipAidlTest, GetStaIface) { + std::shared_ptr iface = configureChipForStaAndGetIface(); + std::string iface_name = getStaIfaceName(iface); + + std::shared_ptr retrieved_iface; + EXPECT_TRUE(wifi_chip_->getStaIface(iface_name, &retrieved_iface).isOk()); + EXPECT_NE(nullptr, retrieved_iface.get()); + + std::string invalid_name = iface_name + "0"; + std::shared_ptr invalid_iface; + auto status = wifi_chip_->getStaIface(invalid_name, &invalid_iface); + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); + EXPECT_EQ(nullptr, invalid_iface.get()); +} + +/* + * GetP2pIface + */ +TEST_P(WifiChipAidlTest, GetP2pIface) { + std::shared_ptr iface = configureChipForP2pAndGetIface(); + std::string iface_name = getP2pIfaceName(iface); + + std::shared_ptr retrieved_iface; + EXPECT_TRUE(wifi_chip_->getP2pIface(iface_name, &retrieved_iface).isOk()); + EXPECT_NE(nullptr, retrieved_iface.get()); + + std::string invalid_name = iface_name + "0"; + std::shared_ptr invalid_iface; + auto status = wifi_chip_->getP2pIface(invalid_name, &invalid_iface); + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); + EXPECT_EQ(nullptr, invalid_iface.get()); +} + +/* + * GetApIface + */ +TEST_P(WifiChipAidlTest, GetApIface) { + std::shared_ptr iface = configureChipForApAndGetIface(); + std::string iface_name = getApIfaceName(iface); + + std::shared_ptr retrieved_iface; + EXPECT_TRUE(wifi_chip_->getApIface(iface_name, &retrieved_iface).isOk()); + EXPECT_NE(nullptr, retrieved_iface.get()); + + std::string invalid_name = iface_name + "0"; + std::shared_ptr invalid_iface; + auto status = wifi_chip_->getApIface(invalid_name, &invalid_iface); + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); + EXPECT_EQ(nullptr, invalid_iface.get()); +} + +/* + * GetNanIface + */ +TEST_P(WifiChipAidlTest, GetNanIface) { + std::shared_ptr iface = configureChipForNanAndGetIface(); + std::string iface_name = getNanIfaceName(iface); + + std::shared_ptr retrieved_iface; + EXPECT_TRUE(wifi_chip_->getNanIface(iface_name, &retrieved_iface).isOk()); + EXPECT_NE(nullptr, retrieved_iface.get()); + + std::string invalid_name = iface_name + "0"; + std::shared_ptr invalid_iface; + auto status = wifi_chip_->getNanIface(invalid_name, &invalid_iface); + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); + EXPECT_EQ(nullptr, invalid_iface.get()); +} + +/* + * RemoveStaIface + * Configures the chip in STA mode and creates an iface. Then removes + * the iface object using the correct name and ensures that any other + * name doesn't remove the iface. + */ +TEST_P(WifiChipAidlTest, RemoveStaIface) { + std::shared_ptr iface = configureChipForStaAndGetIface(); + std::string iface_name = getStaIfaceName(iface); + + std::string invalid_name = iface_name + "0"; + auto status = wifi_chip_->removeStaIface(invalid_name); + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); + EXPECT_TRUE(wifi_chip_->removeStaIface(iface_name).isOk()); + + // No such iface exists now, so this should return failure. + EXPECT_FALSE(wifi_chip_->removeStaIface(iface_name).isOk()); +} + +/* + * RemoveP2pIface + */ +TEST_P(WifiChipAidlTest, RemoveP2pIface) { + std::shared_ptr iface = configureChipForP2pAndGetIface(); + std::string iface_name = getP2pIfaceName(iface); + + std::string invalid_name = iface_name + "0"; + auto status = wifi_chip_->removeP2pIface(invalid_name); + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); + EXPECT_TRUE(wifi_chip_->removeP2pIface(iface_name).isOk()); + + // No such iface exists now, so this should return failure. + EXPECT_FALSE(wifi_chip_->removeP2pIface(iface_name).isOk()); +} + +/* + * RemoveApIface + */ +TEST_P(WifiChipAidlTest, RemoveApIface) { + std::shared_ptr iface = configureChipForApAndGetIface(); + std::string iface_name = getApIfaceName(iface); + + std::string invalid_name = iface_name + "0"; + auto status = wifi_chip_->removeApIface(invalid_name); + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); + EXPECT_TRUE(wifi_chip_->removeApIface(iface_name).isOk()); + + // No such iface exists now, so this should return failure. + EXPECT_FALSE(wifi_chip_->removeApIface(iface_name).isOk()); +} + +/* + * RemoveNanIface + */ +TEST_P(WifiChipAidlTest, RemoveNanIface) { + std::shared_ptr iface = configureChipForNanAndGetIface(); + std::string iface_name = getNanIfaceName(iface); + + std::string invalid_name = iface_name + "0"; + auto status = wifi_chip_->removeNanIface(invalid_name); + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); + EXPECT_TRUE(wifi_chip_->removeNanIface(iface_name).isOk()); + + // No such iface exists now, so this should return failure. + EXPECT_FALSE(wifi_chip_->removeNanIface(iface_name).isOk()); +} + +/* + * CreateRttController + */ +TEST_P(WifiChipAidlTest, CreateRttController) { + std::shared_ptr iface = configureChipForStaAndGetIface(); + std::shared_ptr rtt_controller; + auto status = wifi_chip_->createRttController(iface, &rtt_controller); + if (status.isOk()) { + EXPECT_NE(nullptr, rtt_controller.get()); + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/** + * CreateBridgedApIface & RemoveIfaceInstanceFromBridgedApIface + */ +TEST_P(WifiChipAidlTest, CreateBridgedApIfaceAndremoveIfaceInstanceFromBridgedApIfaceTest) { + bool isBridgedSupport = testing::checkSubstringInCommandOutput( + "/system/bin/cmd wifi get-softap-supported-features", + "wifi_softap_bridged_ap_supported"); + if (!isBridgedSupport) { + GTEST_SKIP() << "Missing Bridged AP support"; + } + + std::shared_ptr wifi_chip = getWifiChip(getInstanceName()); + ASSERT_NE(nullptr, wifi_chip.get()); + std::shared_ptr wifi_ap_iface = getBridgedWifiApIface(wifi_chip); + ASSERT_NE(nullptr, wifi_ap_iface.get()); + + std::string br_name; + std::vector instances; + EXPECT_TRUE(wifi_ap_iface->getName(&br_name).isOk()); + EXPECT_TRUE(wifi_ap_iface->getBridgedInstances(&instances).isOk()); + EXPECT_EQ(instances.size(), 2); + + std::vector instances_after_remove; + EXPECT_TRUE(wifi_chip->removeIfaceInstanceFromBridgedApIface(br_name, instances[0]).isOk()); + EXPECT_TRUE(wifi_ap_iface->getBridgedInstances(&instances_after_remove).isOk()); + EXPECT_EQ(instances_after_remove.size(), 1); +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiChipAidlTest); +INSTANTIATE_TEST_SUITE_P(WifiTest, WifiChipAidlTest, + testing::ValuesIn(android::getAidlHalInstanceNames(IWifi::descriptor)), + android::PrintInstanceNameToString); + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + android::ProcessState::self()->setThreadPoolMaxThreadCount(1); + android::ProcessState::self()->startThreadPool(); + return RUN_ALL_TESTS(); +} diff --git a/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp new file mode 100644 index 0000000000..457d57ad75 --- /dev/null +++ b/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp @@ -0,0 +1,627 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Staache 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. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "wifi_aidl_test_utils.h" + +using aidl::android::hardware::wifi::BnWifiNanIfaceEventCallback; +using aidl::android::hardware::wifi::IWifiNanIface; +using aidl::android::hardware::wifi::NanBandIndex; +using aidl::android::hardware::wifi::NanBandSpecificConfig; +using aidl::android::hardware::wifi::NanCapabilities; +using aidl::android::hardware::wifi::NanClusterEventInd; +using aidl::android::hardware::wifi::NanConfigRequest; +using aidl::android::hardware::wifi::NanConfigRequestSupplemental; +using aidl::android::hardware::wifi::NanDataPathConfirmInd; +using aidl::android::hardware::wifi::NanDataPathRequestInd; +using aidl::android::hardware::wifi::NanDataPathScheduleUpdateInd; +using aidl::android::hardware::wifi::NanDataPathSecurityType; +using aidl::android::hardware::wifi::NanEnableRequest; +using aidl::android::hardware::wifi::NanFollowupReceivedInd; +using aidl::android::hardware::wifi::NanInitiateDataPathRequest; +using aidl::android::hardware::wifi::NanMatchAlg; +using aidl::android::hardware::wifi::NanMatchInd; +using aidl::android::hardware::wifi::NanPublishRequest; +using aidl::android::hardware::wifi::NanPublishType; +using aidl::android::hardware::wifi::NanRespondToDataPathIndicationRequest; +using aidl::android::hardware::wifi::NanStatus; +using aidl::android::hardware::wifi::NanStatusCode; +using aidl::android::hardware::wifi::NanTxType; + +#define TIMEOUT_PERIOD 10 + +class WifiNanIfaceAidlTest : public testing::TestWithParam { + public: + void SetUp() override { + if (!::testing::deviceSupportsFeature("android.hardware.wifi.aware")) + GTEST_SKIP() << "Skipping this test since NAN is not supported."; + stopWifiService(getInstanceName()); + + wifi_nan_iface_ = getWifiNanIface(getInstanceName()); + ASSERT_NE(nullptr, wifi_nan_iface_.get()); + std::shared_ptr callback = + ndk::SharedRefBase::make(*this); + EXPECT_TRUE(wifi_nan_iface_->registerEventCallback(callback).isOk()); + } + + void TearDown() override { stopWifiService(getInstanceName()); } + + // Used as a mechanism to inform the test about data/event callbacks. + inline void notify() { + std::unique_lock lock(mtx_); + count_++; + cv_.notify_one(); + } + + enum CallbackType { + INVALID = -2, + ANY_CALLBACK = -1, + + NOTIFY_CAPABILITIES_RESPONSE = 0, + NOTIFY_ENABLE_RESPONSE, + NOTIFY_CONFIG_RESPONSE, + NOTIFY_DISABLE_RESPONSE, + NOTIFY_START_PUBLISH_RESPONSE, + NOTIFY_STOP_PUBLISH_RESPONSE, + NOTIFY_START_SUBSCRIBE_RESPONSE, + NOTIFY_STOP_SUBSCRIBE_RESPONSE, + NOTIFY_TRANSMIT_FOLLOWUP_RESPONSE, + NOTIFY_CREATE_DATA_INTERFACE_RESPONSE, + NOTIFY_DELETE_DATA_INTERFACE_RESPONSE, + NOTIFY_INITIATE_DATA_PATH_RESPONSE, + NOTIFY_RESPOND_TO_DATA_PATH_INDICATION_RESPONSE, + NOTIFY_TERMINATE_DATA_PATH_RESPONSE, + + EVENT_CLUSTER_EVENT, + EVENT_DISABLED, + EVENT_PUBLISH_TERMINATED, + EVENT_SUBSCRIBE_TERMINATED, + EVENT_MATCH, + EVENT_MATCH_EXPIRED, + EVENT_FOLLOWUP_RECEIVED, + EVENT_TRANSMIT_FOLLOWUP, + EVENT_DATA_PATH_REQUEST, + EVENT_DATA_PATH_CONFIRM, + EVENT_DATA_PATH_TERMINATED, + EVENT_DATA_PATH_SCHEDULE_UPDATE, + }; + + // Test code calls this function to wait for data/event callback. + // Must set callbackType = INVALID before calling this function. + inline std::cv_status wait(CallbackType waitForCallbackType) { + std::unique_lock lock(mtx_); + EXPECT_NE(INVALID, waitForCallbackType); + + std::cv_status status = std::cv_status::no_timeout; + auto now = std::chrono::system_clock::now(); + while (count_ == 0) { + status = cv_.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD)); + if (status == std::cv_status::timeout) return status; + if (waitForCallbackType != ANY_CALLBACK && callback_type_ != INVALID && + callback_type_ != waitForCallbackType) { + count_--; + } + } + count_--; + return status; + } + + class WifiNanIfaceEventCallback : public BnWifiNanIfaceEventCallback { + public: + WifiNanIfaceEventCallback(WifiNanIfaceAidlTest& parent) : parent_(parent){}; + + ::ndk::ScopedAStatus eventClusterEvent(const NanClusterEventInd& event) override { + parent_.callback_type_ = EVENT_CLUSTER_EVENT; + parent_.nan_cluster_event_ind_ = event; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventDataPathConfirm(const NanDataPathConfirmInd& event) override { + parent_.callback_type_ = EVENT_DATA_PATH_CONFIRM; + parent_.nan_data_path_confirm_ind_ = event; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventDataPathRequest(const NanDataPathRequestInd& event) override { + parent_.callback_type_ = EVENT_DATA_PATH_REQUEST; + parent_.nan_data_path_request_ind_ = event; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventDataPathScheduleUpdate( + const NanDataPathScheduleUpdateInd& event) override { + parent_.callback_type_ = EVENT_DATA_PATH_SCHEDULE_UPDATE; + parent_.nan_data_path_schedule_update_ind_ = event; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventDataPathTerminated(int32_t ndpInstanceId) override { + parent_.callback_type_ = EVENT_DATA_PATH_TERMINATED; + parent_.ndp_instance_id_ = ndpInstanceId; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventDisabled(const NanStatus& status) override { + parent_.callback_type_ = EVENT_DISABLED; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventFollowupReceived(const NanFollowupReceivedInd& event) override { + parent_.callback_type_ = EVENT_FOLLOWUP_RECEIVED; + parent_.nan_followup_received_ind_ = event; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventMatch(const NanMatchInd& event) override { + parent_.callback_type_ = EVENT_MATCH; + parent_.nan_match_ind_ = event; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventMatchExpired(int8_t discoverySessionId, int32_t peerId) override { + parent_.callback_type_ = EVENT_MATCH_EXPIRED; + parent_.session_id_ = discoverySessionId; + parent_.peer_id_ = peerId; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventPublishTerminated(int8_t sessionId, + const NanStatus& status) override { + parent_.callback_type_ = EVENT_PUBLISH_TERMINATED; + parent_.session_id_ = sessionId; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventSubscribeTerminated(int8_t sessionId, + const NanStatus& status) override { + parent_.callback_type_ = EVENT_SUBSCRIBE_TERMINATED; + parent_.session_id_ = sessionId; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventTransmitFollowup(char16_t id, const NanStatus& status) override { + parent_.callback_type_ = EVENT_TRANSMIT_FOLLOWUP; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyCapabilitiesResponse( + char16_t id, const NanStatus& status, + const NanCapabilities& capabilities) override { + parent_.callback_type_ = NOTIFY_CAPABILITIES_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.capabilities_ = capabilities; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyConfigResponse(char16_t id, const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_CONFIG_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyCreateDataInterfaceResponse(char16_t id, + const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_CREATE_DATA_INTERFACE_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyDeleteDataInterfaceResponse(char16_t id, + const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_DELETE_DATA_INTERFACE_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyDisableResponse(char16_t id, const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_DISABLE_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyEnableResponse(char16_t id, const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_ENABLE_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyInitiateDataPathResponse(char16_t id, const NanStatus& status, + int32_t ndpInstanceId) override { + parent_.callback_type_ = NOTIFY_INITIATE_DATA_PATH_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.ndp_instance_id_ = ndpInstanceId; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyRespondToDataPathIndicationResponse( + char16_t id, const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_RESPOND_TO_DATA_PATH_INDICATION_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyStartPublishResponse(char16_t id, const NanStatus& status, + int8_t sessionId) override { + parent_.callback_type_ = NOTIFY_START_PUBLISH_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.session_id_ = sessionId; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyStartSubscribeResponse(char16_t id, const NanStatus& status, + int8_t sessionId) override { + parent_.callback_type_ = NOTIFY_START_SUBSCRIBE_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.session_id_ = sessionId; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyStopPublishResponse(char16_t id, + const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_STOP_PUBLISH_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyStopSubscribeResponse(char16_t id, + const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_STOP_SUBSCRIBE_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyTerminateDataPathResponse(char16_t id, + const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_TERMINATE_DATA_PATH_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyTransmitFollowupResponse(char16_t id, + const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_TRANSMIT_FOLLOWUP_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + + private: + WifiNanIfaceAidlTest& parent_; + }; + + protected: + std::shared_ptr wifi_nan_iface_; + CallbackType callback_type_; + uint16_t id_; + uint8_t session_id_; + uint32_t ndp_instance_id_; + uint32_t peer_id_; + NanCapabilities capabilities_; + NanClusterEventInd nan_cluster_event_ind_; + NanDataPathConfirmInd nan_data_path_confirm_ind_; + NanDataPathRequestInd nan_data_path_request_ind_; + NanDataPathScheduleUpdateInd nan_data_path_schedule_update_ind_; + NanFollowupReceivedInd nan_followup_received_ind_; + NanMatchInd nan_match_ind_; + NanStatus status_; + + const char* getInstanceName() { return GetParam().c_str(); } + + private: + // synchronization objects + std::mutex mtx_; + std::condition_variable cv_; + int count_ = 0; +}; + +/* + * FailOnIfaceInvalid + * Ensure that API calls to an interface fail with code ERROR_WIFI_IFACE_INVALID + * after wifi is disabled. + */ +TEST_P(WifiNanIfaceAidlTest, FailOnIfaceInvalid) { + stopWifiService(getInstanceName()); + sleep(5); // Ensure that all chips/interfaces are invalidated. + auto status = wifi_nan_iface_->getCapabilitiesRequest(0); + ASSERT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_WIFI_IFACE_INVALID)); +} + +/* + * EnableRequest - Invalid Args + */ +TEST_P(WifiNanIfaceAidlTest, EnableRequest_InvalidArgs) { + uint16_t inputCmdId = 10; + callback_type_ = INVALID; + NanEnableRequest nanEnableRequest = {}; + NanConfigRequestSupplemental nanConfigRequestSupp = {}; + auto status = + wifi_nan_iface_->enableRequest(inputCmdId, nanEnableRequest, nanConfigRequestSupp); + if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { + ASSERT_TRUE(status.isOk()); + + // Wait for a callback. + ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_ENABLE_RESPONSE)); + ASSERT_EQ(NOTIFY_ENABLE_RESPONSE, callback_type_); + ASSERT_EQ(id_, inputCmdId); + ASSERT_EQ(status_.status, NanStatusCode::INVALID_ARGS); + } +} + +/* + * ConfigRequest - Invalid Args + */ +TEST_P(WifiNanIfaceAidlTest, ConfigRequest_InvalidArgs) { + uint16_t inputCmdId = 10; + callback_type_ = INVALID; + NanConfigRequest nanConfigRequest = {}; + NanConfigRequestSupplemental nanConfigRequestSupp = {}; + auto status = + wifi_nan_iface_->configRequest(inputCmdId, nanConfigRequest, nanConfigRequestSupp); + + if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { + ASSERT_TRUE(status.isOk()); + + // Wait for a callback. + ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_CONFIG_RESPONSE)); + ASSERT_EQ(NOTIFY_CONFIG_RESPONSE, callback_type_); + ASSERT_EQ(id_, inputCmdId); + ASSERT_EQ(status_.status, NanStatusCode::INVALID_ARGS); + } +} + +/* + * EnableRequest - Invalid Args in Shim Conversion + */ +TEST_P(WifiNanIfaceAidlTest, EnableRequest_InvalidShimArgs) { + uint16_t inputCmdId = 10; + NanEnableRequest nanEnableRequest = {}; + nanEnableRequest.configParams.numberOfPublishServiceIdsInBeacon = -15; // must be > 0 + NanConfigRequestSupplemental nanConfigRequestSupp = {}; + auto status = + wifi_nan_iface_->enableRequest(inputCmdId, nanEnableRequest, nanConfigRequestSupp); + if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { + ASSERT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); + } +} + +/* + * ConfigRequest - Invalid Args in Shim Conversion + */ +TEST_P(WifiNanIfaceAidlTest, ConfigRequest_InvalidShimArgs) { + uint16_t inputCmdId = 10; + NanConfigRequest nanConfigRequest = {}; + nanConfigRequest.numberOfPublishServiceIdsInBeacon = -15; // must be > 0 + NanConfigRequestSupplemental nanConfigRequestSupp = {}; + auto status = + wifi_nan_iface_->configRequest(inputCmdId, nanConfigRequest, nanConfigRequestSupp); + if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { + ASSERT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); + } +} + +/* + * NotifyCapabilitiesResponse + */ +TEST_P(WifiNanIfaceAidlTest, NotifyCapabilitiesResponse) { + uint16_t inputCmdId = 10; + callback_type_ = INVALID; + EXPECT_TRUE(wifi_nan_iface_->getCapabilitiesRequest(inputCmdId).isOk()); + + // Wait for a callback. + ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_CAPABILITIES_RESPONSE)); + ASSERT_EQ(NOTIFY_CAPABILITIES_RESPONSE, callback_type_); + ASSERT_EQ(id_, inputCmdId); + ASSERT_EQ(status_.status, NanStatusCode::SUCCESS); + + // Check for reasonable capability values. + EXPECT_GT(capabilities_.maxConcurrentClusters, 0); + EXPECT_GT(capabilities_.maxPublishes, 0); + EXPECT_GT(capabilities_.maxSubscribes, 0); + EXPECT_EQ(capabilities_.maxServiceNameLen, 255); + EXPECT_EQ(capabilities_.maxMatchFilterLen, 255); + EXPECT_GT(capabilities_.maxTotalMatchFilterLen, 255); + EXPECT_EQ(capabilities_.maxServiceSpecificInfoLen, 255); + EXPECT_GE(capabilities_.maxExtendedServiceSpecificInfoLen, 255); + EXPECT_GT(capabilities_.maxNdiInterfaces, 0); + EXPECT_GT(capabilities_.maxNdpSessions, 0); + EXPECT_GT(capabilities_.maxAppInfoLen, 0); + EXPECT_GT(capabilities_.maxQueuedTransmitFollowupMsgs, 0); + EXPECT_GT(capabilities_.maxSubscribeInterfaceAddresses, 0); + EXPECT_NE(static_cast(capabilities_.supportedCipherSuites), 0); +} + +/* + * StartPublishRequest + */ +TEST_P(WifiNanIfaceAidlTest, StartPublishRequest) { + uint16_t inputCmdId = 10; + NanBandSpecificConfig config24 = {}; + config24.rssiClose = 60; + config24.rssiMiddle = 70; + config24.rssiCloseProximity = 60; + config24.dwellTimeMs = 200; + config24.scanPeriodSec = 20; + config24.validDiscoveryWindowIntervalVal = false; + config24.discoveryWindowIntervalVal = 0; + + NanBandSpecificConfig config5 = {}; + config5.rssiClose = 60; + config5.rssiMiddle = 75; + config5.rssiCloseProximity = 60; + config5.dwellTimeMs = 200; + config5.scanPeriodSec = 20; + config5.validDiscoveryWindowIntervalVal = false; + config5.discoveryWindowIntervalVal = 0; + + NanEnableRequest req = {}; + req.operateInBand[static_cast(NanBandIndex::NAN_BAND_24GHZ)] = true; + req.operateInBand[static_cast(NanBandIndex::NAN_BAND_5GHZ)] = false; + req.hopCountMax = 2; + req.configParams.masterPref = 0; + req.configParams.disableDiscoveryAddressChangeIndication = true; + req.configParams.disableStartedClusterIndication = true; + req.configParams.disableJoinedClusterIndication = true; + req.configParams.includePublishServiceIdsInBeacon = true; + req.configParams.numberOfPublishServiceIdsInBeacon = 0; + req.configParams.includeSubscribeServiceIdsInBeacon = true; + req.configParams.numberOfSubscribeServiceIdsInBeacon = 0; + req.configParams.rssiWindowSize = 8; + req.configParams.macAddressRandomizationIntervalSec = 1800; + req.configParams.bandSpecificConfig[static_cast(NanBandIndex::NAN_BAND_24GHZ)] = + config24; + req.configParams.bandSpecificConfig[static_cast(NanBandIndex::NAN_BAND_5GHZ)] = + config5; + + req.debugConfigs.validClusterIdVals = true; + req.debugConfigs.clusterIdTopRangeVal = 65535; + req.debugConfigs.clusterIdBottomRangeVal = 0; + req.debugConfigs.validIntfAddrVal = false; + req.debugConfigs.validOuiVal = false; + req.debugConfigs.ouiVal = 0; + req.debugConfigs.validRandomFactorForceVal = false; + req.debugConfigs.randomFactorForceVal = 0; + req.debugConfigs.validHopCountForceVal = false; + req.debugConfigs.hopCountForceVal = 0; + req.debugConfigs.validDiscoveryChannelVal = false; + req.debugConfigs.discoveryChannelMhzVal[static_cast(NanBandIndex::NAN_BAND_24GHZ)] = 0; + req.debugConfigs.discoveryChannelMhzVal[static_cast(NanBandIndex::NAN_BAND_5GHZ)] = 0; + req.debugConfigs.validUseBeaconsInBandVal = false; + req.debugConfigs.useBeaconsInBandVal[static_cast(NanBandIndex::NAN_BAND_24GHZ)] = true; + req.debugConfigs.useBeaconsInBandVal[static_cast(NanBandIndex::NAN_BAND_5GHZ)] = true; + req.debugConfigs.validUseSdfInBandVal = false; + req.debugConfigs.useSdfInBandVal[static_cast(NanBandIndex::NAN_BAND_24GHZ)] = true; + req.debugConfigs.useSdfInBandVal[static_cast(NanBandIndex::NAN_BAND_5GHZ)] = true; + + NanConfigRequestSupplemental nanConfigRequestSupp = {}; + nanConfigRequestSupp.discoveryBeaconIntervalMs = 20; + nanConfigRequestSupp.numberOfSpatialStreamsInDiscovery = 0; + nanConfigRequestSupp.enableDiscoveryWindowEarlyTermination = false; + + callback_type_ = INVALID; + auto status = wifi_nan_iface_->enableRequest(inputCmdId, req, nanConfigRequestSupp); + if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { + ASSERT_TRUE(status.isOk()); + + // Wait for a callback. + ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_ENABLE_RESPONSE)); + ASSERT_EQ(NOTIFY_ENABLE_RESPONSE, callback_type_); + ASSERT_EQ(id_, inputCmdId); + ASSERT_EQ(status_.status, NanStatusCode::SUCCESS); + } + + NanPublishRequest nanPublishRequest = {}; + nanPublishRequest.baseConfigs.sessionId = 0; + nanPublishRequest.baseConfigs.ttlSec = 0; + nanPublishRequest.baseConfigs.discoveryWindowPeriod = 1; + nanPublishRequest.baseConfigs.discoveryCount = 0; + nanPublishRequest.baseConfigs.serviceName = {97}; + nanPublishRequest.baseConfigs.discoveryMatchIndicator = NanMatchAlg::MATCH_NEVER; + nanPublishRequest.baseConfigs.useRssiThreshold = false; + nanPublishRequest.baseConfigs.disableDiscoveryTerminationIndication = false; + nanPublishRequest.baseConfigs.disableMatchExpirationIndication = true; + nanPublishRequest.baseConfigs.disableFollowupReceivedIndication = false; + nanPublishRequest.baseConfigs.securityConfig.securityType = NanDataPathSecurityType::OPEN; + nanPublishRequest.autoAcceptDataPathRequests = false; + nanPublishRequest.publishType = NanPublishType::UNSOLICITED; + nanPublishRequest.txType = NanTxType::BROADCAST; + + status = wifi_nan_iface_->startPublishRequest(inputCmdId + 1, nanPublishRequest); + if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { + ASSERT_TRUE(status.isOk()); + + // Wait for a callback. + ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_START_PUBLISH_RESPONSE)); + ASSERT_EQ(NOTIFY_START_PUBLISH_RESPONSE, callback_type_); + ASSERT_EQ(id_, inputCmdId + 1); + ASSERT_EQ(status_.status, NanStatusCode::SUCCESS); + } +} + +/* + * RespondToDataPathIndicationRequest - Invalid Args + */ +TEST_P(WifiNanIfaceAidlTest, RespondToDataPathIndicationRequest_InvalidArgs) { + uint16_t inputCmdId = 10; + callback_type_ = INVALID; + NanRespondToDataPathIndicationRequest nanRespondToDataPathIndicationRequest = {}; + nanRespondToDataPathIndicationRequest.ifaceName = "AwareInterfaceNameTooLong"; + auto status = wifi_nan_iface_->respondToDataPathIndicationRequest( + inputCmdId, nanRespondToDataPathIndicationRequest); + + if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { + ASSERT_EQ(status.getServiceSpecificError(), + static_cast(WifiStatusCode::ERROR_INVALID_ARGS)); + } +} + +/* + * InitiateDataPathRequest - Invalid Args + */ +TEST_P(WifiNanIfaceAidlTest, InitiateDataPathRequest_InvalidArgs) { + uint16_t inputCmdId = 10; + callback_type_ = INVALID; + NanInitiateDataPathRequest nanInitiateDataPathRequest = {}; + nanInitiateDataPathRequest.ifaceName = "AwareInterfaceNameTooLong"; + auto status = wifi_nan_iface_->initiateDataPathRequest(inputCmdId, nanInitiateDataPathRequest); + + if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { + ASSERT_EQ(status.getServiceSpecificError(), + static_cast(WifiStatusCode::ERROR_INVALID_ARGS)); + } +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiNanIfaceAidlTest); +INSTANTIATE_TEST_SUITE_P(WifiTest, WifiNanIfaceAidlTest, + testing::ValuesIn(android::getAidlHalInstanceNames(IWifi::descriptor)), + android::PrintInstanceNameToString); + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + android::ProcessState::self()->setThreadPoolMaxThreadCount(1); + android::ProcessState::self()->startThreadPool(); + return RUN_ALL_TESTS(); +} diff --git a/wifi/aidl/vts/functional/wifi_rtt_controller_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_rtt_controller_aidl_test.cpp new file mode 100644 index 0000000000..d763fe64a5 --- /dev/null +++ b/wifi/aidl/vts/functional/wifi_rtt_controller_aidl_test.cpp @@ -0,0 +1,234 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Staache 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. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "wifi_aidl_test_utils.h" + +using aidl::android::hardware::wifi::BnWifiRttControllerEventCallback; +using aidl::android::hardware::wifi::IWifiRttController; +using aidl::android::hardware::wifi::RttBw; +using aidl::android::hardware::wifi::RttCapabilities; +using aidl::android::hardware::wifi::RttConfig; +using aidl::android::hardware::wifi::RttPeerType; +using aidl::android::hardware::wifi::RttPreamble; +using aidl::android::hardware::wifi::RttResponder; +using aidl::android::hardware::wifi::RttResult; +using aidl::android::hardware::wifi::RttType; +using aidl::android::hardware::wifi::WifiChannelInfo; +using aidl::android::hardware::wifi::WifiChannelWidthInMhz; +using aidl::android::hardware::wifi::WifiStatusCode; + +class WifiRttControllerAidlTest : public testing::TestWithParam { + public: + void SetUp() override { + if (!::testing::deviceSupportsFeature("android.hardware.wifi.rtt")) + GTEST_SKIP() << "Skipping this test since RTT is not supported."; + stopWifiService(getInstanceName()); + wifi_rtt_controller_ = getWifiRttController(); + ASSERT_NE(nullptr, wifi_rtt_controller_.get()); + + // Check RTT support before we run the test. + RttCapabilities caps = {}; + auto status = wifi_rtt_controller_->getCapabilities(&caps); + if (checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { + GTEST_SKIP() << "Skipping this test since RTT is not supported."; + } + } + + void TearDown() override { stopWifiService(getInstanceName()); } + + protected: + std::shared_ptr getWifiRttController() { + std::shared_ptr wifi_chip = getWifiChip(getInstanceName()); + EXPECT_NE(nullptr, wifi_chip.get()); + + std::shared_ptr wifi_sta_iface = getWifiStaIface(getInstanceName()); + EXPECT_NE(nullptr, wifi_sta_iface.get()); + + std::shared_ptr rtt_controller; + EXPECT_TRUE(wifi_chip->createRttController(wifi_sta_iface, &rtt_controller).isOk()); + EXPECT_NE(nullptr, rtt_controller.get()); + return rtt_controller; + } + + std::shared_ptr wifi_rtt_controller_; + + private: + const char* getInstanceName() { return GetParam().c_str(); } +}; + +class WifiRttControllerEventCallback : public BnWifiRttControllerEventCallback { + public: + WifiRttControllerEventCallback() = default; + + ::ndk::ScopedAStatus onResults(int /* cmdId */, + const std::vector& /* results */) override { + return ndk::ScopedAStatus::ok(); + } +}; + +/* + * RegisterEventCallback + * + * Note: it is not feasible to test the invocation of the callback function, + * since events are triggered internally in the HAL implementation and cannot be + * triggered from the test case. + */ +TEST_P(WifiRttControllerAidlTest, RegisterEventCallback) { + std::shared_ptr callback = + ndk::SharedRefBase::make(); + ASSERT_NE(nullptr, callback.get()); + EXPECT_TRUE(wifi_rtt_controller_->registerEventCallback(callback).isOk()); +} + +/* + * GetCapabilities + */ +TEST_P(WifiRttControllerAidlTest, GetCapabilities) { + RttCapabilities caps = {}; + EXPECT_TRUE(wifi_rtt_controller_->getCapabilities(&caps).isOk()); +} + +/* + * GetResponderInfo + */ +TEST_P(WifiRttControllerAidlTest, GetResponderInfo) { + RttResponder responder = {}; + EXPECT_TRUE(wifi_rtt_controller_->getResponderInfo(&responder).isOk()); +} + +/* + * EnableResponder + */ +TEST_P(WifiRttControllerAidlTest, EnableResponder) { + int cmdId = 55; + WifiChannelInfo channelInfo; + channelInfo.width = WifiChannelWidthInMhz::WIDTH_80; + channelInfo.centerFreq = 5660; + channelInfo.centerFreq0 = 5660; + channelInfo.centerFreq1 = 0; + + RttResponder responder = {}; + EXPECT_TRUE(wifi_rtt_controller_->getResponderInfo(&responder).isOk()); + EXPECT_TRUE(wifi_rtt_controller_->enableResponder(cmdId, channelInfo, 10, responder).isOk()); +} + +/* + * Request2SidedRangeMeasurement + * Tests the two sided ranging - 802.11mc FTM protocol. + */ +TEST_P(WifiRttControllerAidlTest, Request2SidedRangeMeasurement) { + RttCapabilities caps = {}; + EXPECT_TRUE(wifi_rtt_controller_->getCapabilities(&caps).isOk()); + if (!caps.rttFtmSupported) { + GTEST_SKIP() << "Skipping two sided RTT since driver/fw does not support"; + } + + RttConfig config; + config.addr = {{0x00, 0x01, 0x02, 0x03, 0x04, 0x05}}; + config.type = RttType::TWO_SIDED; + config.peer = RttPeerType::AP; + config.channel.width = WifiChannelWidthInMhz::WIDTH_80; + config.channel.centerFreq = 5180; + config.channel.centerFreq0 = 5210; + config.channel.centerFreq1 = 0; + config.bw = RttBw::BW_20MHZ; + config.preamble = RttPreamble::HT; + config.mustRequestLci = false; + config.mustRequestLcr = false; + config.burstPeriod = 0; + config.numBurst = 0; + config.numFramesPerBurst = 8; + config.numRetriesPerRttFrame = 0; + config.numRetriesPerFtmr = 0; + config.burstDuration = 9; + + int cmdId = 55; + std::vector configs = {config}; + EXPECT_TRUE(wifi_rtt_controller_->rangeRequest(cmdId, configs).isOk()); + + // Sleep for 2 seconds to wait for driver/firmware to complete RTT. + sleep(2); +} + +/* + * RangeRequest + */ +TEST_P(WifiRttControllerAidlTest, RangeRequest) { + RttCapabilities caps = {}; + EXPECT_TRUE(wifi_rtt_controller_->getCapabilities(&caps).isOk()); + if (!caps.rttOneSidedSupported) { + GTEST_SKIP() << "Skipping one sided RTT since driver/fw does not support"; + } + + // Get the highest supported preamble. + int preamble = 1; + int caps_preamble_support = static_cast(caps.preambleSupport); + caps_preamble_support >>= 1; + while (caps_preamble_support != 0) { + caps_preamble_support >>= 1; + preamble <<= 1; + } + + RttConfig config; + config.addr = {{0x00, 0x01, 0x02, 0x03, 0x04, 0x05}}; + config.type = RttType::ONE_SIDED; + config.peer = RttPeerType::AP; + config.channel.width = WifiChannelWidthInMhz::WIDTH_80; + config.channel.centerFreq = 5765; + config.channel.centerFreq0 = 5775; + config.channel.centerFreq1 = 0; + config.bw = RttBw::BW_80MHZ; + config.preamble = static_cast(preamble); + config.mustRequestLci = false; + config.mustRequestLcr = false; + config.burstPeriod = 0; + config.numBurst = 0; + config.numFramesPerBurst = 8; + config.numRetriesPerRttFrame = 3; + config.numRetriesPerFtmr = 3; + config.burstDuration = 9; + + int cmdId = 55; + std::vector configs = {config}; + EXPECT_TRUE(wifi_rtt_controller_->rangeRequest(cmdId, configs).isOk()); + + // Sleep for 2 seconds to wait for driver/firmware to complete RTT. + sleep(2); +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiRttControllerAidlTest); +INSTANTIATE_TEST_SUITE_P(WifiTest, WifiRttControllerAidlTest, + testing::ValuesIn(android::getAidlHalInstanceNames(IWifi::descriptor)), + android::PrintInstanceNameToString); + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + android::ProcessState::self()->setThreadPoolMaxThreadCount(1); + android::ProcessState::self()->startThreadPool(); + return RUN_ALL_TESTS(); +} diff --git a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp new file mode 100644 index 0000000000..ef7e2747c9 --- /dev/null +++ b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp @@ -0,0 +1,282 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Staache 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. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "wifi_aidl_test_utils.h" + +using aidl::android::hardware::wifi::IWifi; +using aidl::android::hardware::wifi::IWifiStaIface; +using aidl::android::hardware::wifi::MacAddress; +using aidl::android::hardware::wifi::Ssid; +using aidl::android::hardware::wifi::StaApfPacketFilterCapabilities; +using aidl::android::hardware::wifi::StaBackgroundScanCapabilities; +using aidl::android::hardware::wifi::StaLinkLayerStats; +using aidl::android::hardware::wifi::StaRoamingCapabilities; +using aidl::android::hardware::wifi::StaRoamingConfig; +using aidl::android::hardware::wifi::StaRoamingState; +using aidl::android::hardware::wifi::WifiBand; +using aidl::android::hardware::wifi::WifiDebugRxPacketFateReport; +using aidl::android::hardware::wifi::WifiDebugTxPacketFateReport; +using aidl::android::hardware::wifi::WifiStatusCode; + +class WifiStaIfaceAidlTest : public testing::TestWithParam { + public: + void SetUp() override { + stopWifiService(getInstanceName()); + wifi_sta_iface_ = getWifiStaIface(getInstanceName()); + ASSERT_NE(nullptr, wifi_sta_iface_.get()); + } + + void TearDown() override { stopWifiService(getInstanceName()); } + + protected: + bool isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask expected) { + IWifiStaIface::StaIfaceCapabilityMask caps = {}; + EXPECT_TRUE(wifi_sta_iface_->getCapabilities(&caps).isOk()); + return static_cast(caps) & static_cast(expected); + } + + ndk::ScopedAStatus createStaIface(std::shared_ptr* sta_iface) { + std::shared_ptr wifi_chip = getWifiChip(getInstanceName()); + EXPECT_NE(nullptr, wifi_chip.get()); + return wifi_chip->createStaIface(sta_iface); + } + + std::shared_ptr wifi_sta_iface_; + + private: + const char* getInstanceName() { return GetParam().c_str(); } +}; + +/* + * GetFactoryMacAddress + * Ensures that calls to getFactoryMacAddress will retrieve a non-zero MAC. + */ +TEST_P(WifiStaIfaceAidlTest, GetFactoryMacAddress) { + std::array mac; + EXPECT_TRUE(wifi_sta_iface_->getFactoryMacAddress(&mac).isOk()); + std::array all_zero_mac = {0, 0, 0, 0, 0, 0}; + EXPECT_NE(mac, all_zero_mac); +} + +/* + * GetCapabilities + */ +TEST_P(WifiStaIfaceAidlTest, GetCapabilities) { + IWifiStaIface::StaIfaceCapabilityMask caps = {}; + EXPECT_TRUE(wifi_sta_iface_->getCapabilities(&caps).isOk()); + EXPECT_NE(static_cast(caps), 0); +} + +/* + * GetApfPacketFilterCapabilities + */ +TEST_P(WifiStaIfaceAidlTest, GetApfPacketFilterCapabilities) { + if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::APF)) { + GTEST_SKIP() << "APF packet filter capabilities are not supported."; + } + StaApfPacketFilterCapabilities apf_caps = {}; + EXPECT_TRUE(wifi_sta_iface_->getApfPacketFilterCapabilities(&apf_caps).isOk()); +} + +/* + * GetBackgroundScanCapabilities + */ +TEST_P(WifiStaIfaceAidlTest, GetBackgroundScanCapabilities) { + if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::BACKGROUND_SCAN)) { + GTEST_SKIP() << "Background scan capabilities are not supported."; + } + StaBackgroundScanCapabilities caps = {}; + EXPECT_TRUE(wifi_sta_iface_->getBackgroundScanCapabilities(&caps).isOk()); +} + +/* + * GetValidFrequenciesForBand + * Ensures that we can retrieve valid frequencies for the 2.4 GHz band. + */ +TEST_P(WifiStaIfaceAidlTest, GetValidFrequenciesForBand) { + std::vector freqs; + EXPECT_TRUE(wifi_sta_iface_->getValidFrequenciesForBand(WifiBand::BAND_24GHZ, &freqs).isOk()); + EXPECT_NE(freqs.size(), 0); +} + +/* + * GetLinkLayerStats + * Ensures that calls to getLinkLayerStats will retrieve a non-empty + * StaLinkLayerStats after link layer stats collection is enabled. + */ +TEST_P(WifiStaIfaceAidlTest, GetLinkLayerStats) { + if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::LINK_LAYER_STATS)) { + GTEST_SKIP() << "Skipping this test since link layer stats are not supported."; + } + + // Enable link layer stats collection. + EXPECT_TRUE(wifi_sta_iface_->enableLinkLayerStatsCollection(true).isOk()); + + // Retrieve link layer stats. + StaLinkLayerStats link_layer_stats = {}; + EXPECT_TRUE(wifi_sta_iface_->getLinkLayerStats(&link_layer_stats).isOk()); + EXPECT_GT(link_layer_stats.timeStampInMs, 0); + + // Try to create a 2nd iface. If successful, it should fill the duty cycle field. + std::shared_ptr iface; + auto status = createStaIface(&iface); + if (status.isOk()) { + EXPECT_GT(link_layer_stats.iface.timeSliceDutyCycleInPercent, 0); + } + + // Disable link layer stats collection. + EXPECT_TRUE(wifi_sta_iface_->disableLinkLayerStatsCollection().isOk()); +} + +/* + * SetMacAddress + * Ensures that calls to setMacAddress will return successfully. + */ +TEST_P(WifiStaIfaceAidlTest, SetMacAddress) { + std::array mac = {0x12, 0x22, 0x33, 0x52, 0x10, 0x41}; + EXPECT_TRUE(wifi_sta_iface_->setMacAddress(mac).isOk()); +} + +/* + * SetScanMode + */ +TEST_P(WifiStaIfaceAidlTest, SetScanMode) { + auto status = wifi_sta_iface_->setScanMode(true); + EXPECT_TRUE(status.isOk() || checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + + status = wifi_sta_iface_->setScanMode(false); + EXPECT_TRUE(status.isOk() || checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); +} + +/* + * LinkLayerStatsCollection + */ +TEST_P(WifiStaIfaceAidlTest, LinkLayerStatsCollection) { + if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::LINK_LAYER_STATS)) { + GTEST_SKIP() << "Link layer stats collection is not supported."; + } + + // Enable link layer stats collection. + EXPECT_TRUE(wifi_sta_iface_->enableLinkLayerStatsCollection(true).isOk()); + + // Retrieve link layer stats. + StaLinkLayerStats link_layer_stats = {}; + EXPECT_TRUE(wifi_sta_iface_->getLinkLayerStats(&link_layer_stats).isOk()); + + // Disable link layer stats collection. + EXPECT_TRUE(wifi_sta_iface_->disableLinkLayerStatsCollection().isOk()); +} + +/* + * RSSIMonitoring + * Ensures that calls to startRssiMonitoring and stopRssiMonitoring will fail + * if the device is not connected to an AP. + */ +TEST_P(WifiStaIfaceAidlTest, RSSIMonitoring) { + if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::RSSI_MONITOR)) { + GTEST_SKIP() << "RSSI monitoring is not supported."; + } + + const int cmd = 1; + const int maxRssi = -50; + const int minRssi = -90; + // Expected to fail because device is not connected to an AP. + EXPECT_FALSE(wifi_sta_iface_->startRssiMonitoring(cmd, maxRssi, minRssi).isOk()); + EXPECT_FALSE(wifi_sta_iface_->stopRssiMonitoring(cmd).isOk()); +} + +/* + * RoamingControl + */ +TEST_P(WifiStaIfaceAidlTest, RoamingControl) { + if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::CONTROL_ROAMING)) { + GTEST_SKIP() << "Roaming control is not supported."; + } + + // Retrieve roaming capabilities. + StaRoamingCapabilities caps = {}; + EXPECT_TRUE(wifi_sta_iface_->getRoamingCapabilities(&caps).isOk()); + + // Set up roaming configuration based on roaming capabilities. + StaRoamingConfig roaming_config = {}; + if (caps.maxBlocklistSize > 0) { + MacAddress block_list_entry; + block_list_entry.data = std::array{{0x11, 0x22, 0x33, 0x44, 0x55, 0x66}}; + roaming_config.bssidBlocklist = {block_list_entry}; + } + if (caps.maxAllowlistSize > 0) { + Ssid allow_list_entry = {}; + allow_list_entry.data = std::array{{0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC}}; + roaming_config.ssidAllowlist = {allow_list_entry}; + } + + // Configure roaming. + EXPECT_TRUE(wifi_sta_iface_->configureRoaming(roaming_config).isOk()); + + // Enable roaming. + EXPECT_TRUE(wifi_sta_iface_->setRoamingState(StaRoamingState::ENABLED).isOk()); +} + +/* + * EnableNDOffload + */ +TEST_P(WifiStaIfaceAidlTest, EnableNDOffload) { + if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::ND_OFFLOAD)) { + GTEST_SKIP() << "ND offload is not supported."; + } + EXPECT_TRUE(wifi_sta_iface_->enableNdOffload(true).isOk()); +} + +/* + * PacketFateMonitoring + */ +TEST_P(WifiStaIfaceAidlTest, PacketFateMonitoring) { + if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::DEBUG_PACKET_FATE)) { + GTEST_SKIP() << "Packet fate monitoring is not supported."; + } + + // Start packet fate monitoring. + EXPECT_TRUE(wifi_sta_iface_->startDebugPacketFateMonitoring().isOk()); + + // Retrieve packets. + std::vector rx_reports; + std::vector tx_reports; + EXPECT_TRUE(wifi_sta_iface_->getDebugRxPacketFates(&rx_reports).isOk()); + EXPECT_TRUE(wifi_sta_iface_->getDebugTxPacketFates(&tx_reports).isOk()); +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiStaIfaceAidlTest); +INSTANTIATE_TEST_SUITE_P(WifiTest, WifiStaIfaceAidlTest, + testing::ValuesIn(android::getAidlHalInstanceNames(IWifi::descriptor)), + android::PrintInstanceNameToString); + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + android::ProcessState::self()->setThreadPoolMaxThreadCount(1); + android::ProcessState::self()->startThreadPool(); + return RUN_ALL_TESTS(); +} diff --git a/wifi/apex/Android.bp b/wifi/apex/Android.bp index 0afb96b85d..e1fefb9575 100644 --- a/wifi/apex/Android.bp +++ b/wifi/apex/Android.bp @@ -15,7 +15,7 @@ android_app_certificate { genrule { name: "gen-android.hardware.wifi.rc", - srcs: [":default-android.hardware.wifi@1.0-service.rc"], + srcs: [":default-android.hardware.wifi-service.rc"], out: ["com.android.hardware.wifi-service.rc"], cmd: "sed -e 's@/vendor/bin/@/apex/com.android.hardware.wifi/bin/@' $(in) > $(out)", } @@ -28,7 +28,7 @@ prebuilt_etc { prebuilt_etc { name: "com.android.hardware.wifi.xml", - src: ":default-android.hardware.wifi@1.0-service.xml", + src: ":default-android.hardware.wifi-service.xml", installable: false, } @@ -43,13 +43,13 @@ apex { updatable: false, soc_specific: true, binaries: [ - "android.hardware.wifi@1.0-service", + "android.hardware.wifi-service", ], prebuilts: [ "com.android.hardware.wifi.rc", "com.android.hardware.wifi.xml", ], overrides: [ - "android.hardware.wifi@1.0-service", + "android.hardware.wifi-service", ], } diff --git a/wifi/apex/file_contexts b/wifi/apex/file_contexts index 812d51db58..6368729c9a 100644 --- a/wifi/apex/file_contexts +++ b/wifi/apex/file_contexts @@ -1,3 +1,3 @@ (/.*)? u:object_r:vendor_file:s0 -/bin/hw/android\.hardware\.wifi@1.0-service u:object_r:hal_wifi_default_exec:s0 +/bin/hw/android\.hardware\.wifi-service u:object_r:hal_wifi_default_exec:s0 From fc6bd8c564604a27aacfb4c7aea39bb7c12efd64 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Fri, 4 Nov 2022 21:45:53 +0000 Subject: [PATCH 413/998] Remove dependencies on the HIDL Vendor HAL from the hostapd and supplicant VTS tests. Bug: 205044134 Test: atest VtsHalHostapdTargetTest atest VtsHalWifiSupplicantStaIfaceTargetTest \ VtsHalWifiSupplicantStaNetworkTargetTest \ VtsHalWifiSupplicantP2pIfaceTargetTest Change-Id: Ibdc5ea1f482a5c886029e5048d884ac15ac4d56e --- wifi/hostapd/aidl/vts/functional/Android.bp | 16 +-- .../functional/VtsHalHostapdTargetTest.cpp | 41 +++--- .../supplicant/aidl/vts/functional/Android.bp | 39 +----- .../vts/functional/supplicant_test_utils.h | 130 +++++++++++++++--- 4 files changed, 138 insertions(+), 88 deletions(-) diff --git a/wifi/hostapd/aidl/vts/functional/Android.bp b/wifi/hostapd/aidl/vts/functional/Android.bp index e61d3975bb..a9fdec8380 100644 --- a/wifi/hostapd/aidl/vts/functional/Android.bp +++ b/wifi/hostapd/aidl/vts/functional/Android.bp @@ -20,20 +20,10 @@ cc_test { "libvndksupport", ], static_libs: [ + "android.hardware.wifi-V1-ndk", "android.hardware.wifi.hostapd-V1-ndk", - "VtsHalWifiV1_0TargetTestUtil", - "VtsHalWifiV1_5TargetTestUtil", - "VtsHalWifiHostapdV1_0TargetTestUtil", - "android.hardware.wifi.hostapd@1.0", - "android.hardware.wifi.hostapd@1.1", - "android.hardware.wifi.hostapd@1.2", - "android.hardware.wifi.hostapd@1.3", - "android.hardware.wifi@1.0", - "android.hardware.wifi@1.1", - "android.hardware.wifi@1.2", - "android.hardware.wifi@1.3", - "android.hardware.wifi@1.4", - "android.hardware.wifi@1.5", + "libwifi-system-iface", + "VtsHalWifiTargetTestUtil", ], test_suites: [ "general-tests", diff --git a/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp b/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp index bd2649fc50..65ffa7b59e 100644 --- a/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp +++ b/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp @@ -13,8 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include -#include +#include #include #include @@ -24,12 +23,11 @@ #include #include #include -#include -#include -#include -#include -#include +#include "wifi_aidl_test_utils.h" + +using aidl::android::hardware::wifi::IWifi; +using aidl::android::hardware::wifi::IWifiApIface; using aidl::android::hardware::wifi::hostapd::BandMask; using aidl::android::hardware::wifi::hostapd::BnHostapdCallback; using aidl::android::hardware::wifi::hostapd::ChannelBandwidth; @@ -44,6 +42,8 @@ using aidl::android::hardware::wifi::hostapd::NetworkParams; using android::ProcessState; namespace { +const std::string kWifiInstanceNameStr = std::string() + IWifi::descriptor + "/default"; +const char* kWifiInstanceName = kWifiInstanceNameStr.c_str(); const unsigned char kNwSsid[] = {'t', 'e', 's', 't', '1', '2', '3', '4', '5'}; const std::string kPassphrase = "test12345"; const std::string kInvalidMinPassphrase = "test"; @@ -75,17 +75,13 @@ class HostapdAidl : public testing::TestWithParam { "/system/bin/cmd wifi get-softap-supported-features", "wifi_softap_wpa3_sae_supported"); isBridgedSupport = testing::checkSubstringInCommandOutput( - "/system/bin/cmd wifi get-softap-supported-features", - "wifi_softap_bridged_ap_supported"); - const std::vector instances = android::hardware::getAllHalInstanceNames( - ::android::hardware::wifi::V1_0::IWifi::descriptor); - EXPECT_NE(0, instances.size()); - wifiInstanceName = instances[0]; + "/system/bin/cmd wifi get-softap-supported-features", + "wifi_softap_bridged_ap_supported"); } virtual void TearDown() override { - if (getWifi(wifiInstanceName) != nullptr) { - stopWifi(wifiInstanceName); + if (getWifi(kWifiInstanceName) != nullptr) { + stopWifiService(kWifiInstanceName); } hostapd->terminate(); // Wait 3 seconds to allow terminate to complete @@ -93,24 +89,23 @@ class HostapdAidl : public testing::TestWithParam { } std::shared_ptr hostapd; - std::string wifiInstanceName; bool isAcsSupport; bool isWpa3SaeSupport; bool isBridgedSupport; std::string setupApIfaceAndGetName(bool isBridged) { - android::sp<::android::hardware::wifi::V1_0::IWifiApIface> wifi_ap_iface; + std::shared_ptr wifi_ap_iface; if (isBridged) { - wifi_ap_iface = getBridgedWifiApIface_1_5(wifiInstanceName); + wifi_ap_iface = getBridgedWifiApIface(kWifiInstanceName); } else { - wifi_ap_iface = getWifiApIface_1_5(wifiInstanceName); + wifi_ap_iface = getWifiApIface(kWifiInstanceName); } EXPECT_NE(nullptr, wifi_ap_iface.get()); - const auto& status_and_name = HIDL_INVOKE(wifi_ap_iface, getName); - EXPECT_EQ(android::hardware::wifi::V1_0::WifiStatusCode::SUCCESS, - status_and_name.first.code); - return status_and_name.second; + std::string ap_iface_name; + auto status = wifi_ap_iface->getName(&ap_iface_name); + EXPECT_TRUE(status.isOk()); + return ap_iface_name; } IfaceParams getIfaceParamsWithoutAcs(std::string iface_name) { diff --git a/wifi/supplicant/aidl/vts/functional/Android.bp b/wifi/supplicant/aidl/vts/functional/Android.bp index b959c7504d..937fdc765c 100644 --- a/wifi/supplicant/aidl/vts/functional/Android.bp +++ b/wifi/supplicant/aidl/vts/functional/Android.bp @@ -36,20 +36,11 @@ cc_test { "libvndksupport", ], static_libs: [ - "android.hardware.wifi@1.0", - "android.hardware.wifi@1.1", - "android.hardware.wifi@1.2", - "android.hardware.wifi@1.3", - "android.hardware.wifi@1.4", - "android.hardware.wifi@1.5", - "android.hardware.wifi.supplicant@1.0", - "android.hardware.wifi.supplicant@1.1", + "android.hardware.wifi-V1-ndk", "android.hardware.wifi.supplicant-V2-ndk", "libwifi-system", "libwifi-system-iface", - "VtsHalWifiV1_0TargetTestUtil", - "VtsHalWifiV1_5TargetTestUtil", - "VtsHalWifiSupplicantV1_0TargetTestUtil", + "VtsHalWifiTargetTestUtil", ], test_suites: [ "general-tests", @@ -70,20 +61,11 @@ cc_test { "libvndksupport", ], static_libs: [ - "android.hardware.wifi@1.0", - "android.hardware.wifi@1.1", - "android.hardware.wifi@1.2", - "android.hardware.wifi@1.3", - "android.hardware.wifi@1.4", - "android.hardware.wifi@1.5", - "android.hardware.wifi.supplicant@1.0", - "android.hardware.wifi.supplicant@1.1", + "android.hardware.wifi-V1-ndk", "android.hardware.wifi.supplicant-V2-ndk", "libwifi-system", "libwifi-system-iface", - "VtsHalWifiV1_0TargetTestUtil", - "VtsHalWifiV1_5TargetTestUtil", - "VtsHalWifiSupplicantV1_0TargetTestUtil", + "VtsHalWifiTargetTestUtil", ], test_suites: [ "general-tests", @@ -104,20 +86,11 @@ cc_test { "libvndksupport", ], static_libs: [ - "android.hardware.wifi@1.0", - "android.hardware.wifi@1.1", - "android.hardware.wifi@1.2", - "android.hardware.wifi@1.3", - "android.hardware.wifi@1.4", - "android.hardware.wifi@1.5", - "android.hardware.wifi.supplicant@1.0", - "android.hardware.wifi.supplicant@1.1", + "android.hardware.wifi-V1-ndk", "android.hardware.wifi.supplicant-V2-ndk", "libwifi-system", "libwifi-system-iface", - "VtsHalWifiV1_0TargetTestUtil", - "VtsHalWifiV1_5TargetTestUtil", - "VtsHalWifiSupplicantV1_0TargetTestUtil", + "VtsHalWifiTargetTestUtil", ], test_suites: [ "general-tests", diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h b/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h index 31042a2b7c..740dc9f7b0 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h +++ b/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h @@ -14,16 +14,18 @@ * limitations under the License. */ -#ifndef SUPPLICANT_TEST_UTILS_H -#define SUPPLICANT_TEST_UTILS_H +#pragma once #include +#include #include -#include -#include -#include #include +#include "wifi_aidl_test_utils.h" + +using aidl::android::hardware::wifi::IfaceConcurrencyType; +using aidl::android::hardware::wifi::IWifi; +using aidl::android::hardware::wifi::IWifiChip; using aidl::android::hardware::wifi::supplicant::IfaceInfo; using aidl::android::hardware::wifi::supplicant::ISupplicant; using aidl::android::hardware::wifi::supplicant::ISupplicantP2pIface; @@ -31,6 +33,90 @@ using aidl::android::hardware::wifi::supplicant::ISupplicantStaIface; using aidl::android::hardware::wifi::supplicant::KeyMgmtMask; using android::wifi_system::SupplicantManager; +const std::string kWifiInstanceName = std::string() + IWifi::descriptor + "/default"; + +// Initialize the driver and firmware to STA mode using the vendor HAL. +void initializeDriverAndFirmware(const std::string& wifi_instance_name) { + // Skip if wifi instance is not set. + if (wifi_instance_name == "") { + return; + } + if (getWifi(wifi_instance_name.c_str()) != nullptr) { + std::shared_ptr wifi_chip = getWifiChip(wifi_instance_name.c_str()); + int mode_id; + EXPECT_TRUE(configureChipToSupportConcurrencyType(wifi_chip, IfaceConcurrencyType::STA, + &mode_id)); + } else { + LOG(WARNING) << __func__ << ": Vendor HAL not supported"; + } +} + +// Deinitialize the driver and firmware using the vendor HAL. +void deInitializeDriverAndFirmware(const std::string& wifi_instance_name) { + // Skip if wifi instance is not set. + if (wifi_instance_name == "") { + return; + } + if (getWifi(wifi_instance_name.c_str()) != nullptr) { + stopWifiService(wifi_instance_name.c_str()); + } else { + LOG(WARNING) << __func__ << ": Vendor HAL not supported"; + } +} + +bool waitForSupplicantState(bool is_running) { + SupplicantManager supplicant_manager; + int count = 50; /* wait at most 5 seconds for completion */ + while (count-- > 0) { + if (supplicant_manager.IsSupplicantRunning() == is_running) { + return true; + } + usleep(100000); + } + LOG(ERROR) << "Supplicant not " << is_running ? "running" : "stopped"; + return false; +} + +bool waitForSupplicantStart() { + return waitForSupplicantState(true); +} + +bool waitForSupplicantStop() { + return waitForSupplicantState(false); +} + +bool waitForWifiHalStop(const std::string& wifi_instance_name) { + std::shared_ptr wifi = getWifi(wifi_instance_name.c_str()); + int count = 50; /* wait at most 5 seconds for completion */ + while (count-- > 0) { + if (wifi != nullptr) { + bool started = false; + auto status = wifi->isStarted(&started); + if (status.isOk() && !started) { + return true; + } + } + usleep(100000); + wifi = getWifi(wifi_instance_name.c_str()); + } + LOG(ERROR) << "Wifi HAL was not stopped"; + return false; +} + +bool waitForFrameworkReady() { + int waitCount = 15; + do { + // Check whether package service is ready or not. + if (!testing::checkSubstringInCommandOutput("/system/bin/service check package", + ": not found")) { + return true; + } + LOG(INFO) << "Framework is not ready"; + sleep(1); + } while (waitCount-- > 0); + return false; +} + std::string getStaIfaceName() { std::array buffer; property_get("wifi.interface", buffer.data(), "wlan0"); @@ -43,14 +129,6 @@ std::string getP2pIfaceName() { return std::string(buffer.data()); } -std::string getWifiInstanceName() { - const std::vector instances = - android::hardware::getAllHalInstanceNames( - ::android::hardware::wifi::V1_0::IWifi::descriptor); - EXPECT_NE(0, instances.size()); - return instances.size() != 0 ? instances[0] : ""; -} - bool keyMgmtSupported(std::shared_ptr iface, KeyMgmtMask expected) { KeyMgmtMask caps; @@ -68,17 +146,33 @@ bool isFilsSupported(std::shared_ptr iface) { } void startSupplicant() { - initializeDriverAndFirmware(getWifiInstanceName()); + initializeDriverAndFirmware(kWifiInstanceName); SupplicantManager supplicant_manager; ASSERT_TRUE(supplicant_manager.StartSupplicant()); ASSERT_TRUE(supplicant_manager.IsSupplicantRunning()); } -// Wrapper around the implementation in supplicant_hidl_test_util. -void stopSupplicantService() { stopSupplicant(getWifiInstanceName()); } +void stopSupplicantService() { + SupplicantManager supplicant_manager; + ASSERT_TRUE(supplicant_manager.StopSupplicant()); + deInitializeDriverAndFirmware(kWifiInstanceName); + ASSERT_FALSE(supplicant_manager.IsSupplicantRunning()); +} + +bool startWifiFramework() { + std::system("svc wifi enable"); + std::system("cmd wifi set-scan-always-available enabled"); + return waitForSupplicantStart(); // wait for wifi to start. +} + +bool stopWifiFramework(const std::string& wifi_instance_name) { + std::system("svc wifi disable"); + std::system("cmd wifi set-scan-always-available disabled"); + return waitForSupplicantStop() && waitForWifiHalStop(wifi_instance_name); +} void initializeService() { - ASSERT_TRUE(stopWifiFramework(getWifiInstanceName())); + ASSERT_TRUE(stopWifiFramework(kWifiInstanceName)); std::system("/system/bin/start"); ASSERT_TRUE(waitForFrameworkReady()); stopSupplicantService(); @@ -106,5 +200,3 @@ std::shared_ptr getSupplicant(const char* supplicant_name) { } return supplicant; } - -#endif // SUPPLICANT_TEST_UTILS_H \ No newline at end of file From c69e968ba70c3bd313e2d021dd5797c9011300f9 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Tue, 22 Nov 2022 12:50:00 -0800 Subject: [PATCH 414/998] Add HAL changes for EV_BRAKE_REGENERATION_LEVEL Bug: 259451659 Test: atest VtsHalAutomotiveVehicle_TargetTest atest CtsCarTestCases:CarPropertyManagerTest atest CtsCarTestCases:VehiclePropertyIdsTest Change-Id: I07cf21f15cca0cebe25d65dd92eb1dff57c390a1 --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 15 +++++++++++++++ .../generated_lib/cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../default_config/config/DefaultProperties.json | 15 +++++++++++++++ .../src/VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 41 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 79352c7d7a..d609b8873c 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -71,6 +71,7 @@ enum VehicleProperty { CURRENT_GEAR = 289408001, PARKING_BRAKE_ON = 287310850, PARKING_BRAKE_AUTO_APPLY = 287310851, + EV_BRAKE_REGENERATION_LEVEL = 289408012, FUEL_LEVEL_LOW = 287310853, NIGHT_MODE = 287310855, TURN_SIGNAL_STATE = 289408008, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 8d21485691..bd1de75eeb 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -484,6 +484,21 @@ enum VehicleProperty { */ PARKING_BRAKE_AUTO_APPLY = 0x0403 + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN + /** + * Regenerative braking level of a electronic vehicle + * + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All values between + * minInt32Value and maxInt32Value must be supported. The minInt32Value must be 0. + * + * The maxInt32Value in default area's VehicleAreaConfig indicates the maximum amount of energy + * regenerated from braking. The minInt32Value in default area's VehicleAreaConfig indicates no + * regenerative braking. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + EV_BRAKE_REGENERATION_LEVEL = + 0x040C + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, /** * Warning for fuel low level. * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index aece6320c0..fe43626dc3 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -71,6 +71,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::CURRENT_GEAR, VehiclePropertyAccess::READ}, {VehicleProperty::PARKING_BRAKE_ON, VehiclePropertyAccess::READ}, {VehicleProperty::PARKING_BRAKE_AUTO_APPLY, VehiclePropertyAccess::READ}, + {VehicleProperty::EV_BRAKE_REGENERATION_LEVEL, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::FUEL_LEVEL_LOW, VehiclePropertyAccess::READ}, {VehicleProperty::NIGHT_MODE, VehiclePropertyAccess::READ}, {VehicleProperty::TURN_SIGNAL_STATE, VehiclePropertyAccess::READ}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index d514558d82..5d747639c9 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -71,6 +71,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::CURRENT_GEAR, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::PARKING_BRAKE_ON, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::PARKING_BRAKE_AUTO_APPLY, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EV_BRAKE_REGENERATION_LEVEL, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::FUEL_LEVEL_LOW, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::NIGHT_MODE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::TURN_SIGNAL_STATE, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 8ae95b9bfc..24594e2315 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -63,6 +63,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.CURRENT_GEAR, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.PARKING_BRAKE_ON, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.PARKING_BRAKE_AUTO_APPLY, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.EV_BRAKE_REGENERATION_LEVEL, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.FUEL_LEVEL_LOW, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.NIGHT_MODE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.TURN_SIGNAL_STATE, VehiclePropertyAccess.READ), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 0afbeaada4..fbaf358f5d 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -63,6 +63,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.CURRENT_GEAR, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.PARKING_BRAKE_ON, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.PARKING_BRAKE_AUTO_APPLY, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EV_BRAKE_REGENERATION_LEVEL, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.FUEL_LEVEL_LOW, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.NIGHT_MODE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.TURN_SIGNAL_STATE, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index f61eead965..9a500021a9 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1528,6 +1528,21 @@ ] } }, + { + "property": "VehicleProperty::EV_BRAKE_REGENERATION_LEVEL", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": 0, + "minInt32Value": 0, + "maxInt32Value": 3 + } + ] + }, { "property": "VehicleProperty::FUEL_LEVEL_LOW", "defaultValue": { diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index fb5eb8e263..a8f45dee14 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -481,6 +481,12 @@ void VtsHalAutomotiveVehicleTargetTest::verifyProperty(VehicleProperty propId, actualPropertyType); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvBrakeRegenerationLevelConfig) { + verifyProperty(VehicleProperty::EV_BRAKE_REGENERATION_LEVEL, + VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDoorChildLockEnabledConfig) { verifyProperty(VehicleProperty::DOOR_CHILD_LOCK_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From 446ac2c2379f1f59133b7d15d2f31f9845c84e9f Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Thu, 6 Oct 2022 12:10:11 -0700 Subject: [PATCH 415/998] wifi: Get MLO capabilities from chip Define a new AIDL API to get MLO capabilities from the vendor chip. Bug: 231497844 Test: mm -j Change-Id: Ia2da1d46cad39d6d9bcb21d88800c93ee10cb019 --- .../android/hardware/wifi/IWifiChip.aidl | 1 + .../hardware/wifi/MloCapabilities.aidl | 38 +++++++++++++++++++ .../aidl/android/hardware/wifi/IWifiChip.aidl | 13 +++++++ .../hardware/wifi/MloCapabilities.aidl | 34 +++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/MloCapabilities.aidl create mode 100644 wifi/aidl/android/hardware/wifi/MloCapabilities.aidl diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl index 647891f7cb..0eba80399c 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl @@ -59,6 +59,7 @@ interface IWifiChip { @PropagateAllowBlocking android.hardware.wifi.IWifiStaIface getStaIface(in String ifname); String[] getStaIfaceNames(); android.hardware.wifi.WifiRadioCombinationMatrix getSupportedRadioCombinationsMatrix(); + android.hardware.wifi.MloCapabilities getMloCapabilities(); android.hardware.wifi.WifiUsableChannel[] getUsableChannels(in android.hardware.wifi.WifiBand band, in android.hardware.wifi.WifiIfaceMode ifaceModeMask, in android.hardware.wifi.IWifiChip.UsableChannelFilter filterMask); void registerEventCallback(in android.hardware.wifi.IWifiChipEventCallback callback); void removeApIface(in String ifname); diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/MloCapabilities.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/MloCapabilities.aidl new file mode 100644 index 0000000000..a42960f948 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/MloCapabilities.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable MloCapabilities { + int maxLinkCount; +} diff --git a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl index fe9a6f399b..c4c0260f0a 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl @@ -24,6 +24,7 @@ import android.hardware.wifi.IWifiRttController; import android.hardware.wifi.IWifiStaIface; import android.hardware.wifi.IfaceConcurrencyType; import android.hardware.wifi.IfaceType; +import android.hardware.wifi.MloCapabilities; import android.hardware.wifi.WifiBand; import android.hardware.wifi.WifiDebugHostWakeReasonStats; import android.hardware.wifi.WifiDebugRingBufferStatus; @@ -784,6 +785,18 @@ interface IWifiChip { */ WifiRadioCombinationMatrix getSupportedRadioCombinationsMatrix(); + /** + * Get MLO capabilities supported by this chip. + * + * @return MLO capabilities represented by |MloCapabilities|. + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|, + * |WifiStatusCode.ERROR_NOT_SUPPORTED|, + * |WifiStatusCode.FAILURE_UNKNOWN| + * + */ + MloCapabilities getMloCapabilities(); + /** * Retrieve a list of usable Wifi channels for the specified band & * operational modes. diff --git a/wifi/aidl/android/hardware/wifi/MloCapabilities.aidl b/wifi/aidl/android/hardware/wifi/MloCapabilities.aidl new file mode 100644 index 0000000000..fca101d200 --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/MloCapabilities.aidl @@ -0,0 +1,34 @@ +/* + * 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. + */ + +package android.hardware.wifi; + +/** + * With MLO, Multi-Link Devices (MLD) can simultaneously use multiple bands + * under different circumstances(e.g. load balancing, data aggregation ..etc.). + * MloCapabilities captures chip capabilities for Multi-link operation. + */ +@VintfStability +parcelable MloCapabilities { + /** + * Maximum number of links used in Multi-Link Operation. The maximum + * number of links used for MLO can be different from the number of + * radios supported by the chip. + * + * This is a static configuration of the chip. + */ + int maxLinkCount; +} From ae73a6ebd544ebd0cf6361cc21f4e3058b0701c9 Mon Sep 17 00:00:00 2001 From: John Reck Date: Mon, 28 Nov 2022 19:53:12 -0500 Subject: [PATCH 416/998] Add some more tests & tweak spec around SMPTE2094-40 Test: this Change-Id: If7c549b8efcf490859f10c225a700188b76a54fa --- .../graphics/common/StandardMetadataType.aidl | 6 +- .../hardware/graphics/mapper/IMapper.h | 22 +- ...VtsHalGraphicsMapperStableC_TargetTest.cpp | 202 +++++++++++++++++- 3 files changed, 215 insertions(+), 15 deletions(-) diff --git a/graphics/common/aidl/android/hardware/graphics/common/StandardMetadataType.aidl b/graphics/common/aidl/android/hardware/graphics/common/StandardMetadataType.aidl index 8126143dd0..4bca795602 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/StandardMetadataType.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/StandardMetadataType.aidl @@ -22,9 +22,9 @@ package android.hardware.graphics.common; * This is an enum that defines the common types of gralloc 4 buffer metadata. The comments for * each enum include a description of the metadata that is associated with the type. * - * IMapper@4.x must support getting the following standard buffer metadata types, with the exception - * of SMPTE 2094-10 metadata. IMapper@4.x may support setting these standard buffer metadata types - * as well. + * IMapper@4.x & later must support getting the following standard buffer metadata types, with the + * exception of SMPTE 2094-10 and SMPTE 2094-40 metadata. IMapper@4.x & later may support setting + * these standard buffer metadata types as well. * * When encoding these StandardMetadataTypes into a byte stream, the associated MetadataType is * is first encoded followed by the StandardMetadataType value. The MetadataType is encoded by diff --git a/graphics/mapper/stable-c/include/android/hardware/graphics/mapper/IMapper.h b/graphics/mapper/stable-c/include/android/hardware/graphics/mapper/IMapper.h index f27b0f4ce7..0f6d146fb8 100644 --- a/graphics/mapper/stable-c/include/android/hardware/graphics/mapper/IMapper.h +++ b/graphics/mapper/stable-c/include/android/hardware/graphics/mapper/IMapper.h @@ -509,11 +509,12 @@ typedef struct AIMapperV5 { * particular Metadata field. * * The framework will attempt to set the following StandardMetadataType - * values: DATASPACE, SMPTE2086, CTA861_3, SMPTE2094_40 and BLEND_MODE. - * We require everyone to support setting those fields. If a device's Composer - * implementation supports a field, it should be supported here. Over time these - * metadata fields will be moved out of Composer/BufferQueue/etc. and into the - * buffer's Metadata fields. + * values: DATASPACE, SMPTE2086, CTA861_3, and BLEND_MODE. + * We require everyone to support setting those fields. Framework will also attempt to set + * SMPTE2094_40 and SMPTE2094_10 if available, and it is required to support setting those + * if it is possible to get them. If a device's Composer implementation supports a field, + * it should be supported here. Over time these metadata fields will be moved out of + * Composer/BufferQueue/etc. and into the buffer's Metadata fields. * * @param buffer Buffer receiving desired metadata * @param metadataType MetadataType for the metadata value being set @@ -546,11 +547,12 @@ typedef struct AIMapperV5 { * particular Metadata field. * * The framework will attempt to set the following StandardMetadataType - * values: DATASPACE, SMPTE2086, CTA861_3, SMPTE2094_40 and BLEND_MODE. - * We require everyone to support setting those fields. If a device's Composer - * implementation supports a field, it should be supported here. Over time these - * metadata fields will be moved out of Composer/BufferQueue/etc. and into the - * buffer's Metadata fields. + * values: DATASPACE, SMPTE2086, CTA861_3, and BLEND_MODE. + * We require everyone to support setting those fields. Framework will also attempt to set + * SMPTE2094_40 and SMPTE2094_10 if available, and it is required to support setting those + * if it is possible to get them. If a device's Composer implementation supports a field, + * it should be supported here. Over time these metadata fields will be moved out of + * Composer/BufferQueue/etc. and into the buffer's Metadata fields. * * @param buffer Buffer receiving desired metadata * @param standardMetadataType StandardMetadataType for the metadata value being set diff --git a/graphics/mapper/stable-c/vts/VtsHalGraphicsMapperStableC_TargetTest.cpp b/graphics/mapper/stable-c/vts/VtsHalGraphicsMapperStableC_TargetTest.cpp index 6ab11a305d..326346cf8e 100644 --- a/graphics/mapper/stable-c/vts/VtsHalGraphicsMapperStableC_TargetTest.cpp +++ b/graphics/mapper/stable-c/vts/VtsHalGraphicsMapperStableC_TargetTest.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -66,6 +67,24 @@ struct YCbCr { int64_t verticalSubSampling; }; +constexpr const char* STANDARD_METADATA_NAME = + "android.hardware.graphics.common.StandardMetadataType"; + +static bool isStandardMetadata(AIMapper_MetadataType metadataType) { + return strcmp(STANDARD_METADATA_NAME, metadataType.name) == 0; +} + +static std::string toString(const std::vector types) { + std::stringstream buf; + buf << "["; + for (auto type : types) { + buf << toString(type) << ", "; + } + buf.seekp(-2, buf.cur); + buf << "]"; + return buf.str(); +} + class BufferHandle { AIMapper* mIMapper; buffer_handle_t mHandle = nullptr; @@ -1533,8 +1552,187 @@ TEST_P(GraphicsMapperStableCTests, GetSmpte2094_40) { auto bufferHandle = buffer->import(); ASSERT_TRUE(bufferHandle); auto value = getStandardMetadata(*bufferHandle); - ASSERT_TRUE(value.has_value()); - EXPECT_FALSE(value->has_value()); + if (value.has_value()) { + EXPECT_FALSE(value->has_value()); + } +} + +TEST_P(GraphicsMapperStableCTests, SupportsRequiredGettersSetters) { + auto buffer = allocateGeneric(); + ASSERT_TRUE(buffer); + auto bufferHandle = buffer->import(); + ASSERT_TRUE(bufferHandle); + const AIMapper_MetadataTypeDescription* descriptions = nullptr; + size_t descriptionCount = 0; + ASSERT_EQ(AIMAPPER_ERROR_NONE, + mapper()->v5.listSupportedMetadataTypes(&descriptions, &descriptionCount)); + std::vector requiredGetters = { + StandardMetadataType::BUFFER_ID, + StandardMetadataType::NAME, + StandardMetadataType::WIDTH, + StandardMetadataType::HEIGHT, + StandardMetadataType::LAYER_COUNT, + StandardMetadataType::PIXEL_FORMAT_REQUESTED, + StandardMetadataType::PIXEL_FORMAT_FOURCC, + StandardMetadataType::PIXEL_FORMAT_MODIFIER, + StandardMetadataType::USAGE, + StandardMetadataType::ALLOCATION_SIZE, + StandardMetadataType::PROTECTED_CONTENT, + StandardMetadataType::COMPRESSION, + StandardMetadataType::INTERLACED, + StandardMetadataType::CHROMA_SITING, + StandardMetadataType::PLANE_LAYOUTS, + StandardMetadataType::CROP, + StandardMetadataType::DATASPACE, + StandardMetadataType::BLEND_MODE, + StandardMetadataType::SMPTE2086, + StandardMetadataType::CTA861_3, + }; + + std::vector requiredSetters = { + StandardMetadataType::DATASPACE, + StandardMetadataType::BLEND_MODE, + StandardMetadataType::SMPTE2086, + StandardMetadataType::CTA861_3, + }; + + for (int i = 0; i < descriptionCount; i++) { + const auto& it = descriptions[i]; + if (isStandardMetadata(it.metadataType)) { + EXPECT_GT(it.metadataType.value, static_cast(StandardMetadataType::INVALID)); + EXPECT_LT(it.metadataType.value, + ndk::internal::enum_values.size()); + + if (it.isGettable) { + std::erase(requiredGetters, + static_cast(it.metadataType.value)); + } + if (it.isSettable) { + std::erase(requiredSetters, + static_cast(it.metadataType.value)); + } + } else { + EXPECT_NE(nullptr, it.description) << "Non-standard metadata must have a description"; + int len = strlen(it.description); + EXPECT_GE(len, 0) << "Non-standard metadata must have a description"; + } + } + + EXPECT_EQ(0, requiredGetters.size()) << "Missing required getters" << toString(requiredGetters); + EXPECT_EQ(0, requiredSetters.size()) << "Missing required setters" << toString(requiredSetters); +} + +/* + * Test that verifies that if the optional StandardMetadataTypes have getters, they have + * the required setters as well + */ +TEST_P(GraphicsMapperStableCTests, CheckRequiredSettersIfHasGetters) { + auto buffer = allocateGeneric(); + ASSERT_TRUE(buffer); + auto bufferHandle = buffer->import(); + ASSERT_TRUE(bufferHandle); + const AIMapper_MetadataTypeDescription* descriptions = nullptr; + size_t descriptionCount = 0; + ASSERT_EQ(AIMAPPER_ERROR_NONE, + mapper()->v5.listSupportedMetadataTypes(&descriptions, &descriptionCount)); + + for (int i = 0; i < descriptionCount; i++) { + const auto& it = descriptions[i]; + if (isStandardMetadata(it.metadataType)) { + const auto type = static_cast(it.metadataType.value); + switch (type) { + case StandardMetadataType::SMPTE2094_10: + case StandardMetadataType::SMPTE2094_40: + if (it.isGettable) { + EXPECT_TRUE(it.isSettable) + << "Type " << toString(type) << " must be settable if gettable"; + } + break; + default: + break; + } + } + } +} + +TEST_P(GraphicsMapperStableCTests, ListSupportedWorks) { + auto buffer = allocateGeneric(); + ASSERT_TRUE(buffer); + auto bufferHandle = buffer->import(); + ASSERT_TRUE(bufferHandle); + const AIMapper_MetadataTypeDescription* descriptions = nullptr; + size_t descriptionCount = 0; + ASSERT_EQ(AIMAPPER_ERROR_NONE, + mapper()->v5.listSupportedMetadataTypes(&descriptions, &descriptionCount)); + + std::vector metadataBuffer; + auto get = [&](AIMapper_MetadataType metadataType) -> int32_t { + int32_t size = mapper()->v5.getMetadata(*bufferHandle, metadataType, nullptr, 0); + if (size >= 0) { + metadataBuffer.resize(size); + size = mapper()->v5.getMetadata(*bufferHandle, metadataType, metadataBuffer.data(), + metadataBuffer.size()); + EXPECT_EQ(size, metadataBuffer.size()); + } + return size; + }; + + for (int i = 0; i < descriptionCount; i++) { + const auto& it = descriptions[i]; + if (!isStandardMetadata(it.metadataType)) { + continue; + } + if (!it.isGettable) { + EXPECT_FALSE(it.isSettable) + << "StandardMetadata that isn't gettable must not be settable"; + continue; + } + EXPECT_GE(get(it.metadataType), 0) + << "Get failed for claimed supported getter of " + << toString(static_cast(it.metadataType.value)); + if (it.isSettable) { + EXPECT_EQ(AIMAPPER_ERROR_NONE, + mapper()->v5.setMetadata(*bufferHandle, it.metadataType, + metadataBuffer.data(), metadataBuffer.size())) + << "Failed to set metadata for " + << toString(static_cast(it.metadataType.value)); + } + } +} + +TEST_P(GraphicsMapperStableCTests, GetMetadataBadValue) { + auto get = [this](StandardMetadataType type) -> AIMapper_Error { + // This is a _Nonnull parameter, but this is enough obfuscation to fool the linter + buffer_handle_t buffer = nullptr; + int32_t ret = + mapper()->v5.getStandardMetadata(buffer, static_cast(type), nullptr, 0); + return (ret < 0) ? (AIMapper_Error)-ret : AIMAPPER_ERROR_NONE; + }; + + for (auto type : ndk::enum_range()) { + if (type == StandardMetadataType::INVALID) { + continue; + } + EXPECT_EQ(AIMAPPER_ERROR_BAD_BUFFER, get(type)) << "Wrong error for " << toString(type); + } +} + +TEST_P(GraphicsMapperStableCTests, GetUnsupportedMetadata) { + auto buffer = allocateGeneric(); + ASSERT_TRUE(buffer); + auto bufferHandle = buffer->import(); + ASSERT_TRUE(bufferHandle); + + int result = mapper()->v5.getMetadata(*bufferHandle, {"Fake", 1}, nullptr, 0); + EXPECT_EQ(AIMAPPER_ERROR_UNSUPPORTED, -result); + + result = mapper()->v5.getStandardMetadata( + *bufferHandle, static_cast(StandardMetadataType::INVALID), nullptr, 0); + EXPECT_EQ(AIMAPPER_ERROR_UNSUPPORTED, -result); + + constexpr int64_t unknownStandardType = ndk::internal::enum_values.size(); + result = mapper()->v5.getStandardMetadata(*bufferHandle, unknownStandardType, nullptr, 0); + EXPECT_EQ(AIMAPPER_ERROR_UNSUPPORTED, -result); } std::vector>> getIAllocatorsAtLeastVersion( From 8fe32b251309e394c788a988130a44fbb1d3fd05 Mon Sep 17 00:00:00 2001 From: Ray Chin Date: Tue, 1 Nov 2022 11:51:23 +0800 Subject: [PATCH 417/998] Add isLnaSupported in HAL layer Bug: 239240674 Test: atest android.media.tv.tuner.cts with cf_x86_tv-userdebug Change-Id: I87aaff87a9ff0d92f4d3895bfe41f5f6fffa1938 --- tv/tuner/OWNERS | 6 ++++++ .../current/android/hardware/tv/tuner/ITuner.aidl | 1 + tv/tuner/aidl/android/hardware/tv/tuner/ITuner.aidl | 10 ++++++++++ tv/tuner/aidl/default/Tuner.cpp | 7 +++++++ tv/tuner/aidl/default/Tuner.h | 1 + 5 files changed, 25 insertions(+) create mode 100644 tv/tuner/OWNERS diff --git a/tv/tuner/OWNERS b/tv/tuner/OWNERS new file mode 100644 index 0000000000..83e090db2a --- /dev/null +++ b/tv/tuner/OWNERS @@ -0,0 +1,6 @@ +# Bug component: 136752 + +quxiangfang@google.com +shubang@google.com +hgchen@google.com +raychin@google.com diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/ITuner.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/ITuner.aidl index 0ff2da9aa1..5d1d21513e 100644 --- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/ITuner.aidl +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/ITuner.aidl @@ -47,4 +47,5 @@ interface ITuner { void setLna(in boolean bEnable); void setMaxNumberOfFrontends(in android.hardware.tv.tuner.FrontendType frontendType, in int maxNumber); int getMaxNumberOfFrontends(in android.hardware.tv.tuner.FrontendType frontendType); + boolean isLnaSupported(); } diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/ITuner.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/ITuner.aidl index 03def33d46..4a0b7a23ee 100644 --- a/tv/tuner/aidl/android/hardware/tv/tuner/ITuner.aidl +++ b/tv/tuner/aidl/android/hardware/tv/tuner/ITuner.aidl @@ -125,6 +125,9 @@ interface ITuner { /** * Enable or Disable Low Noise Amplifier (LNA). * + * If the device doesn't support LNA, the HAL implement should set {@link Result#UNAVAILABLE} + * to EX_SERVICE_SPECIFIC as the service specific error. + * * @param bEnable true if activate LNA module; false if deactivate LNA */ void setLna(in boolean bEnable); @@ -148,4 +151,11 @@ interface ITuner { * @return the maximum usable number of the queried frontend type. */ int getMaxNumberOfFrontends(in FrontendType frontendType); + + /** + * Is Low Noise Amplifier (LNA) supported. + * + * @return true if supported, otherwise false + */ + boolean isLnaSupported(); } diff --git a/tv/tuner/aidl/default/Tuner.cpp b/tv/tuner/aidl/default/Tuner.cpp index 591f936fbe..8c715a0e12 100644 --- a/tv/tuner/aidl/default/Tuner.cpp +++ b/tv/tuner/aidl/default/Tuner.cpp @@ -204,6 +204,13 @@ std::shared_ptr Tuner::getFrontendById(int32_t frontendId) { return ::ndk::ScopedAStatus::ok(); } +::ndk::ScopedAStatus Tuner::isLnaSupported(bool* _aidl_return) { + ALOGV("%s", __FUNCTION__); + + *_aidl_return = true; + return ::ndk::ScopedAStatus::ok(); +} + binder_status_t Tuner::dump(int fd, const char** args, uint32_t numArgs) { ALOGV("%s", __FUNCTION__); { diff --git a/tv/tuner/aidl/default/Tuner.h b/tv/tuner/aidl/default/Tuner.h index ad73003eeb..a77c9304a1 100644 --- a/tv/tuner/aidl/default/Tuner.h +++ b/tv/tuner/aidl/default/Tuner.h @@ -61,6 +61,7 @@ class Tuner : public BnTuner { int32_t in_maxNumber) override; ::ndk::ScopedAStatus getMaxNumberOfFrontends(FrontendType in_frontendType, int32_t* _aidl_return) override; + ::ndk::ScopedAStatus isLnaSupported(bool* _aidl_return) override; binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; From 44b1c3737101ccf363e8dbf099a532c5b904ef11 Mon Sep 17 00:00:00 2001 From: David Li Date: Wed, 23 Nov 2022 15:36:37 +0800 Subject: [PATCH 418/998] add defaults and host_supported to the AIDL interface targets Test: make -j128 Change-Id: Icf69d2860419dd821b9b0730ea6cd4c4cdf42621 --- audio/aidl/Android.bp | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index 8c32f14aaa..92d7d54f7d 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -23,9 +23,18 @@ package { default_applicable_licenses: ["hardware_interfaces_license"], } +aidl_interface_defaults { + name: "android.hardware.audio_defaults", + host_supported: true, + vendor_available: true, + stability: "vintf", +} + aidl_interface { name: "android.hardware.audio.common", - vendor_available: true, + defaults: [ + "android.hardware.audio_defaults", + ], srcs: [ "android/hardware/audio/common/PlaybackTrackMetadata.aidl", "android/hardware/audio/common/RecordTrackMetadata.aidl", @@ -35,7 +44,6 @@ aidl_interface { imports: [ "android.media.audio.common.types-V2", ], - stability: "vintf", backend: { cpp: { enabled: true, @@ -87,9 +95,18 @@ cc_defaults { ], } +cc_defaults { + name: "latest_android_hardware_audio_common_ndk_shared", + shared_libs: [ + latest_android_hardware_audio_common + "-ndk", + ], +} + aidl_interface { name: "android.hardware.audio.core", - vendor_available: true, + defaults: [ + "android.hardware.audio_defaults", + ], srcs: [ "android/hardware/audio/core/AudioMode.aidl", "android/hardware/audio/core/AudioPatch.aidl", @@ -110,7 +127,6 @@ aidl_interface { "android.hardware.audio.common-V1", "android.media.audio.common.types-V2", ], - stability: "vintf", backend: { // The C++ backend is disabled transitively due to use of FMQ. cpp: { @@ -148,7 +164,9 @@ cc_defaults { aidl_interface { name: "android.hardware.audio.effect", - vendor_available: true, + defaults: [ + "android.hardware.audio_defaults", + ], srcs: [ "android/hardware/audio/effect/BassBoost.aidl", "android/hardware/audio/effect/Capability.aidl", @@ -177,7 +195,6 @@ aidl_interface { "android.hardware.audio.common-V1", "android.media.audio.common.types-V2", ], - stability: "vintf", backend: { // The C++ backend is disabled transitively due to use of FMQ. cpp: { From d76e07e604f7083558f17bacf8880a6c8cf609bc Mon Sep 17 00:00:00 2001 From: Chris Weir Date: Fri, 8 Jul 2022 09:52:52 -0700 Subject: [PATCH 419/998] AIDL CAN HAL CAN HAL: now HIDL-free with 100% of your daily value of AIDL. Bug: 170405615 Test: atest CanControllerAidlTest Test: manually test slcan and socketcan hardware Change-Id: I06bbb1379f4385e89757722c0276009b54cc7255 --- automotive/can/aidl/Android.bp | 40 +++ .../hardware/automotive/can/BusConfig.aidl | 46 +++ .../automotive/can/ICanController.aidl | 41 +++ .../automotive/can/IndexedInterface.aidl | 38 ++ .../automotive/can/InterfaceType.aidl | 41 +++ .../automotive/can/NativeInterface.aidl | 42 +++ .../hardware/automotive/can/Result.aidl | 45 +++ .../automotive/can/SlcanInterface.aidl | 42 +++ .../automotive/can/VirtualInterface.aidl | 38 ++ .../hardware/automotive/can/BusConfig.aidl | 78 ++++ .../automotive/can/ICanController.aidl | 64 ++++ .../automotive/can/IndexedInterface.aidl | 22 ++ .../automotive/can/InterfaceType.aidl | 37 ++ .../automotive/can/NativeInterface.aidl | 41 +++ .../hardware/automotive/can/Result.aidl | 60 ++++ .../automotive/can/SlcanInterface.aidl | 32 ++ .../automotive/can/VirtualInterface.aidl | 25 ++ automotive/can/aidl/default/Android.bp | 51 +++ automotive/can/aidl/default/CanBus.cpp | 93 +++++ automotive/can/aidl/default/CanBus.h | 77 ++++ automotive/can/aidl/default/CanBusNative.cpp | 54 +++ automotive/can/aidl/default/CanBusNative.h | 33 ++ automotive/can/aidl/default/CanBusSlcan.cpp | 174 +++++++++ automotive/can/aidl/default/CanBusSlcan.h | 40 +++ automotive/can/aidl/default/CanBusVirtual.cpp | 52 +++ automotive/can/aidl/default/CanBusVirtual.h | 34 ++ automotive/can/aidl/default/CanController.cpp | 333 ++++++++++++++++++ automotive/can/aidl/default/CanController.h | 45 +++ .../android.hardware.automotive.can.rc | 5 + .../android.hardware.automotive.can.xml | 26 ++ automotive/can/aidl/default/service.cpp | 43 +++ .../default/tools/configurator/Android.bp | 43 +++ .../configurator/canhalconfigurator-aidl.rc | 3 + .../tools/configurator/canhalconfigurator.cpp | 118 +++++++ .../tools/configurator/canprototools.cpp | 200 +++++++++++ .../tools/configurator/canprototools.h | 54 +++ .../tools/configurator/proto/Android.bp | 37 ++ .../configurator/proto/canbus_config.proto | 52 +++ automotive/can/aidl/vts/functional/Android.bp | 51 +++ .../vts/functional/CanControllerAidlTest.cpp | 96 +++++ automotive/can/aidl/vts/functional/OWNERS | 3 + .../compatibility_matrix.current.xml | 8 + 42 files changed, 2457 insertions(+) create mode 100644 automotive/can/aidl/Android.bp create mode 100644 automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/BusConfig.aidl create mode 100644 automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/ICanController.aidl create mode 100644 automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/IndexedInterface.aidl create mode 100644 automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/InterfaceType.aidl create mode 100644 automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/NativeInterface.aidl create mode 100644 automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/Result.aidl create mode 100644 automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/SlcanInterface.aidl create mode 100644 automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/VirtualInterface.aidl create mode 100644 automotive/can/aidl/android/hardware/automotive/can/BusConfig.aidl create mode 100644 automotive/can/aidl/android/hardware/automotive/can/ICanController.aidl create mode 100644 automotive/can/aidl/android/hardware/automotive/can/IndexedInterface.aidl create mode 100644 automotive/can/aidl/android/hardware/automotive/can/InterfaceType.aidl create mode 100644 automotive/can/aidl/android/hardware/automotive/can/NativeInterface.aidl create mode 100644 automotive/can/aidl/android/hardware/automotive/can/Result.aidl create mode 100644 automotive/can/aidl/android/hardware/automotive/can/SlcanInterface.aidl create mode 100644 automotive/can/aidl/android/hardware/automotive/can/VirtualInterface.aidl create mode 100644 automotive/can/aidl/default/Android.bp create mode 100644 automotive/can/aidl/default/CanBus.cpp create mode 100644 automotive/can/aidl/default/CanBus.h create mode 100644 automotive/can/aidl/default/CanBusNative.cpp create mode 100644 automotive/can/aidl/default/CanBusNative.h create mode 100644 automotive/can/aidl/default/CanBusSlcan.cpp create mode 100644 automotive/can/aidl/default/CanBusSlcan.h create mode 100644 automotive/can/aidl/default/CanBusVirtual.cpp create mode 100644 automotive/can/aidl/default/CanBusVirtual.h create mode 100644 automotive/can/aidl/default/CanController.cpp create mode 100644 automotive/can/aidl/default/CanController.h create mode 100644 automotive/can/aidl/default/android.hardware.automotive.can.rc create mode 100644 automotive/can/aidl/default/android.hardware.automotive.can.xml create mode 100644 automotive/can/aidl/default/service.cpp create mode 100644 automotive/can/aidl/default/tools/configurator/Android.bp create mode 100644 automotive/can/aidl/default/tools/configurator/canhalconfigurator-aidl.rc create mode 100644 automotive/can/aidl/default/tools/configurator/canhalconfigurator.cpp create mode 100644 automotive/can/aidl/default/tools/configurator/canprototools.cpp create mode 100644 automotive/can/aidl/default/tools/configurator/canprototools.h create mode 100644 automotive/can/aidl/default/tools/configurator/proto/Android.bp create mode 100644 automotive/can/aidl/default/tools/configurator/proto/canbus_config.proto create mode 100644 automotive/can/aidl/vts/functional/Android.bp create mode 100644 automotive/can/aidl/vts/functional/CanControllerAidlTest.cpp create mode 100644 automotive/can/aidl/vts/functional/OWNERS diff --git a/automotive/can/aidl/Android.bp b/automotive/can/aidl/Android.bp new file mode 100644 index 0000000000..67333b9730 --- /dev/null +++ b/automotive/can/aidl/Android.bp @@ -0,0 +1,40 @@ +// +// 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. +// + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +aidl_interface { + name: "android.hardware.automotive.can", + vendor_available: true, + srcs: ["android/hardware/automotive/can/*.aidl"], + stability: "vintf", + host_supported: true, + backend: { + java: { + enabled: false, + }, + rust: { + enabled: true, + }, + }, +} diff --git a/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/BusConfig.aidl b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/BusConfig.aidl new file mode 100644 index 0000000000..0212e00f4c --- /dev/null +++ b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/BusConfig.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.can; +@VintfStability +parcelable BusConfig { + String name; + android.hardware.automotive.can.BusConfig.InterfaceId interfaceId; + int bitrate; + union InterfaceId { + android.hardware.automotive.can.VirtualInterface virtualif; + android.hardware.automotive.can.NativeInterface nativeif; + android.hardware.automotive.can.SlcanInterface slcan; + android.hardware.automotive.can.IndexedInterface indexed; + } +} diff --git a/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/ICanController.aidl b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/ICanController.aidl new file mode 100644 index 0000000000..5d032f27ab --- /dev/null +++ b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/ICanController.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.can; +@VintfStability +interface ICanController { + android.hardware.automotive.can.InterfaceType[] getSupportedInterfaceTypes(); + String getInterfaceName(in String busName); + String upBus(in android.hardware.automotive.can.BusConfig config); + void downBus(in String name); +} diff --git a/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/IndexedInterface.aidl b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/IndexedInterface.aidl new file mode 100644 index 0000000000..1b00adf1e1 --- /dev/null +++ b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/IndexedInterface.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.can; +@VintfStability +parcelable IndexedInterface { + byte index; +} diff --git a/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/InterfaceType.aidl b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/InterfaceType.aidl new file mode 100644 index 0000000000..44865aafb7 --- /dev/null +++ b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/InterfaceType.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.can; +@Backing(type="byte") @VintfStability +enum InterfaceType { + VIRTUAL = 0, + NATIVE = 1, + SLCAN = 2, + INDEXED = 3, +} diff --git a/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/NativeInterface.aidl b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/NativeInterface.aidl new file mode 100644 index 0000000000..5d6c119356 --- /dev/null +++ b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/NativeInterface.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.can; +@VintfStability +parcelable NativeInterface { + android.hardware.automotive.can.NativeInterface.InterfaceId interfaceId; + union InterfaceId { + String ifname; + String[] serialno; + } +} diff --git a/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/Result.aidl b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/Result.aidl new file mode 100644 index 0000000000..010792a054 --- /dev/null +++ b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/Result.aidl @@ -0,0 +1,45 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.can; +@Backing(type="int") @VintfStability +enum Result { + OK = 0, + UNKNOWN_ERROR = 1, + INVALID_STATE = 2, + NOT_SUPPORTED = 3, + BAD_INTERFACE_ID = 4, + BAD_BITRATE = 5, + BAD_BUS_NAME = 6, + INTERFACE_DOWN = 7, +} diff --git a/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/SlcanInterface.aidl b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/SlcanInterface.aidl new file mode 100644 index 0000000000..af0c07d22a --- /dev/null +++ b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/SlcanInterface.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.can; +@VintfStability +parcelable SlcanInterface { + android.hardware.automotive.can.SlcanInterface.InterfaceId interfaceId; + union InterfaceId { + String ttyname; + String[] serialno; + } +} diff --git a/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/VirtualInterface.aidl b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/VirtualInterface.aidl new file mode 100644 index 0000000000..c870612dd9 --- /dev/null +++ b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/current/android/hardware/automotive/can/VirtualInterface.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.can; +@VintfStability +parcelable VirtualInterface { + String ifname; +} diff --git a/automotive/can/aidl/android/hardware/automotive/can/BusConfig.aidl b/automotive/can/aidl/android/hardware/automotive/can/BusConfig.aidl new file mode 100644 index 0000000000..4e1027ba2d --- /dev/null +++ b/automotive/can/aidl/android/hardware/automotive/can/BusConfig.aidl @@ -0,0 +1,78 @@ +/* + * 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. + */ +package android.hardware.automotive.can; + +import android.hardware.automotive.can.IndexedInterface; +import android.hardware.automotive.can.NativeInterface; +import android.hardware.automotive.can.SlcanInterface; +import android.hardware.automotive.can.VirtualInterface; + +/** + * Configuration of the (physical or virtual) CAN bus. + * + * ISO TP and CAN FD support is dependent upon the hardware. + */ +@VintfStability +parcelable BusConfig { + /** + * Name by which a given bus may be referenced. + * + * It must consist of only alphanumeric characters and underscore + * (a-z, A-Z, 0-9, '_'), at least 1 and at most 32 characters long. + * + * This field is *not* meant to distinguish between hardware interfaces + * nor preselect parameters like bitrate. + * + * This field represents a more human-friendly name for a CAN bus: + * e.x. rather than /some/dev/can1234, "name" might be "BodyCAN" or "CCAN" + */ + String name; + + /** + * Hardware interface configuration. + * + * This union's discriminator has an equivalent enum {@see InterfaceType} to + * express compatibility via getSupportedInterfaceTypes(). + */ + union InterfaceId { + /** Virtual SocketCAN interface. */ + VirtualInterface virtualif; + + /** Native SocketCAN interface. */ + NativeInterface nativeif; + + /** Serial line CAN interface. */ + SlcanInterface slcan; + + /** + * Proprietary, device-specific interface. + * + * Non-SocketCAN interfaces should use this variant. + */ + IndexedInterface indexed; + } + + InterfaceId interfaceId; + + /** + * Bit rate for CAN communication. + * + * Typical bit rates are: 100000, 125000, 250000, 500000. + * + * For {@see interfaceId#virtual} interfaces, this value is ignored. + */ + int bitrate; +} diff --git a/automotive/can/aidl/android/hardware/automotive/can/ICanController.aidl b/automotive/can/aidl/android/hardware/automotive/can/ICanController.aidl new file mode 100644 index 0000000000..97c2674e8c --- /dev/null +++ b/automotive/can/aidl/android/hardware/automotive/can/ICanController.aidl @@ -0,0 +1,64 @@ +/* + * 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. + */ +package android.hardware.automotive.can; + +import android.hardware.automotive.can.BusConfig; +import android.hardware.automotive.can.InterfaceType; +import android.hardware.automotive.can.Result; + +/** + * Represents a CAN controller that's capable of configuring CAN bus interfaces. + * + * The goal of this service is to configure and manage CAN interfaces. + * + * Providing an ICanController interface to configure CAN buses is optional. + * A system can elect to configure CAN buses manually if the hardware is + * dedicated to a specific application. + */ +@VintfStability +interface ICanController { + /** + * Fetches the list of interface types supported by this HAL server. + * + * @return iftypes The list of supported interface types. + */ + InterfaceType[] getSupportedInterfaceTypes(); + + /** + * Gets the interface name given the name of the bus. This will + * + * @param busName Name of the CAN bus who's interface name we would like + * (e.x. BCAN, CCAN, HS3, BodyCAN, ...) + * @return name of the socketcan network interface corresponding to busName + * (e.x. can0, vcan5, ...) + */ + String getInterfaceName(in String busName); + + /** + * Bring up a CAN bus. + * + * @param config Configuration for the CAN bus. + * @return name of iface if successful + */ + String upBus(in BusConfig config); + + /** + * Bring down a CAN bus. + * + * @param name Name of the bus (@see BusConfig#name} to bring down. + */ + void downBus(in String name); +} diff --git a/automotive/can/aidl/android/hardware/automotive/can/IndexedInterface.aidl b/automotive/can/aidl/android/hardware/automotive/can/IndexedInterface.aidl new file mode 100644 index 0000000000..13e223ff3d --- /dev/null +++ b/automotive/can/aidl/android/hardware/automotive/can/IndexedInterface.aidl @@ -0,0 +1,22 @@ +/* + * 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. + */ +package android.hardware.automotive.can; + +@VintfStability +parcelable IndexedInterface { + /** Interface number, 0-based. */ + byte index; +} diff --git a/automotive/can/aidl/android/hardware/automotive/can/InterfaceType.aidl b/automotive/can/aidl/android/hardware/automotive/can/InterfaceType.aidl new file mode 100644 index 0000000000..b13648a8b6 --- /dev/null +++ b/automotive/can/aidl/android/hardware/automotive/can/InterfaceType.aidl @@ -0,0 +1,37 @@ +/* + * 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. + */ +package android.hardware.automotive.can; + +/** + * Type of an interface, an equivalent to BusConfig::InterfaceId + * union discriminator. Defines a number of specific standard hardware + * families and a generic catch-all type of {@see INDEXED}. + */ +@VintfStability +@Backing(type="byte") +enum InterfaceType { + /** Virtual SocketCAN interface. */ + VIRTUAL, + + /** Native SocketCAN interface. */ + NATIVE, + + /** Serial line CAN interface. */ + SLCAN, + + /** Proprietary, device-specific interface. */ + INDEXED, +} diff --git a/automotive/can/aidl/android/hardware/automotive/can/NativeInterface.aidl b/automotive/can/aidl/android/hardware/automotive/can/NativeInterface.aidl new file mode 100644 index 0000000000..30c24c3d55 --- /dev/null +++ b/automotive/can/aidl/android/hardware/automotive/can/NativeInterface.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +package android.hardware.automotive.can; + +@VintfStability +parcelable NativeInterface { + union InterfaceId { + /** Interface name, such as can0. */ + String ifname; + + /** + * Alternatively to providing {@see ifname}, one may provide a list of + * interface serial number suffixes. If there happens to be a device + * (like USB2CAN) with a matching serial number suffix, the HAL service + * will locate it. + * + * Client may utilize this in two ways: by matching against the + * entire serial number, or the last few characters (usually + * one). The former is better for small-scale test deployments + * (with just a handful of vehicles), the latter is good for + * larger scale (where a small suffix list may support large + * test fleet). + */ + String[] serialno; + } + + InterfaceId interfaceId; +} diff --git a/automotive/can/aidl/android/hardware/automotive/can/Result.aidl b/automotive/can/aidl/android/hardware/automotive/can/Result.aidl new file mode 100644 index 0000000000..cdd0066328 --- /dev/null +++ b/automotive/can/aidl/android/hardware/automotive/can/Result.aidl @@ -0,0 +1,60 @@ +/* + * 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. + */ +package android.hardware.automotive.can; + +/** + * Possible error codes (or OK) for ICanController. + */ +@VintfStability +@Backing(type="int") +enum Result { + OK, + + /** + * General error class, if others are not applicable. + */ + UNKNOWN_ERROR, + + /** + * Up request was called out of order (i.e. trying to up the interface + * twice). + */ + INVALID_STATE, + + /** Interface type is not supported. */ + NOT_SUPPORTED, + + /** + * Provided interface ID (index, name, device path) doesn't exist or there + * is no device with a given serial number. + */ + BAD_INTERFACE_ID, + + /** Provided bit rate is not supported by the hardware. */ + BAD_BITRATE, + + /** + * Provided bus name ({@see BusConfig#name}) has invalid format or doesn't exist. + */ + BAD_BUS_NAME, + + /** + * The interface for the bus you are trying to interact with is currently + * down. As opposed to INVALID_STATE, this serves to warn the caller + * _before_ they attempt an invalid operation. + */ + INTERFACE_DOWN, +} diff --git a/automotive/can/aidl/android/hardware/automotive/can/SlcanInterface.aidl b/automotive/can/aidl/android/hardware/automotive/can/SlcanInterface.aidl new file mode 100644 index 0000000000..4ed85838df --- /dev/null +++ b/automotive/can/aidl/android/hardware/automotive/can/SlcanInterface.aidl @@ -0,0 +1,32 @@ +/* + * 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. + */ +package android.hardware.automotive.can; + +@VintfStability +parcelable SlcanInterface { + union InterfaceId { + /** Path to a device, such as /dev/ttyUSB0. */ + String ttyname; + + /** + * List of interface serial number suffixes. + * {@see Socketcan::serialno} + */ + String[] serialno; + } + + InterfaceId interfaceId; +} diff --git a/automotive/can/aidl/android/hardware/automotive/can/VirtualInterface.aidl b/automotive/can/aidl/android/hardware/automotive/can/VirtualInterface.aidl new file mode 100644 index 0000000000..7e1e5e17ca --- /dev/null +++ b/automotive/can/aidl/android/hardware/automotive/can/VirtualInterface.aidl @@ -0,0 +1,25 @@ +/* + * 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. + */ +package android.hardware.automotive.can; + +@VintfStability +parcelable VirtualInterface { + /** + * Interface name, such as vcan0. If the interface doesn't + * exist, HAL server must create it. + */ + String ifname; +} diff --git a/automotive/can/aidl/default/Android.bp b/automotive/can/aidl/default/Android.bp new file mode 100644 index 0000000000..d44cb91cf9 --- /dev/null +++ b/automotive/can/aidl/default/Android.bp @@ -0,0 +1,51 @@ +// +// 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. +// + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_binary { + name: "android.hardware.automotive.can-service", + init_rc: ["android.hardware.automotive.can.rc"], + defaults: ["android.hardware.automotive.can@defaults"], + vendor: true, + relative_install_path: "hw", + srcs: [ + "CanBus.cpp", + "CanBusSlcan.cpp", + "CanBusNative.cpp", + "CanBusVirtual.cpp", + "CanController.cpp", + "service.cpp", + ], + shared_libs: [ + "android.hardware.automotive.can-V1-ndk", + "libbase", + "libbinder_ndk", + ], + static_libs: [ + "android.hardware.automotive.can@libnetdevice", + "android.hardware.automotive@libc++fs", + "libnl++", + ], + vintf_fragments: ["android.hardware.automotive.can.xml"], +} diff --git a/automotive/can/aidl/default/CanBus.cpp b/automotive/can/aidl/default/CanBus.cpp new file mode 100644 index 0000000000..d1f9b78d95 --- /dev/null +++ b/automotive/can/aidl/default/CanBus.cpp @@ -0,0 +1,93 @@ +/* + * Copyright 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. + */ + +#include "CanBus.h" + +#include +#include + +namespace aidl::android::hardware::automotive::can { + +CanBus::CanBus(std::string_view ifname) : mIfname(ifname) {} + +CanBus::~CanBus() { + std::lock_guard lck(mIsUpGuard); + CHECK(!mIsUp) << "Interface is still up while being destroyed"; +} + +Result CanBus::preUp() { + return Result::OK; +} + +bool CanBus::postDown() { + return true; +} + +std::string CanBus::getIfaceName() { + return mIfname; +} + +Result CanBus::up() { + std::lock_guard lck(mIsUpGuard); + + if (mIsUp) { + LOG(WARNING) << "Interface is already up"; + return Result::INVALID_STATE; + } + + const auto preResult = preUp(); + if (preResult != Result::OK) return preResult; + + const auto isUp = ::android::netdevice::isUp(mIfname); + if (!isUp.has_value()) { + // preUp() should prepare the interface (either create or make sure it's there) + LOG(ERROR) << "Interface " << mIfname << " didn't get prepared"; + return Result::BAD_INTERFACE_ID; + } + + if (!*isUp && !::android::netdevice::up(mIfname)) { + LOG(ERROR) << "Can't bring " << mIfname << " up"; + return Result::UNKNOWN_ERROR; + } + mDownAfterUse = !*isUp; + + mIsUp = true; + return Result::OK; +} + +Result CanBus::down() { + std::lock_guard lck(mIsUpGuard); + + if (!mIsUp) { + LOG(WARNING) << "Interface is already down"; + return Result::INVALID_STATE; + } + mIsUp = false; + + Result success = Result::OK; + + if (mDownAfterUse && !::android::netdevice::down(mIfname)) { + LOG(ERROR) << "Can't bring " << mIfname << " down"; + // don't return yet, let's try to do best-effort cleanup + success = Result::UNKNOWN_ERROR; + } + + if (!postDown()) success = Result::UNKNOWN_ERROR; + + return success; +} + +} // namespace aidl::android::hardware::automotive::can diff --git a/automotive/can/aidl/default/CanBus.h b/automotive/can/aidl/default/CanBus.h new file mode 100644 index 0000000000..abdbe5148f --- /dev/null +++ b/automotive/can/aidl/default/CanBus.h @@ -0,0 +1,77 @@ +/* + * Copyright 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. + */ +#pragma once + +#include + +#include +#include + +#include +#include + +namespace aidl::android::hardware::automotive::can { + +class CanBus { + public: + /** + * Some interface types (such as SLCAN) don't get an interface name until after being + * initialized, hence ifname is optional. + * + * You MUST ensure mIfname is initialized prior to the completion of preUp(). + */ + CanBus(std::string_view ifname = std::string_view{""}); + + virtual ~CanBus(); + + Result up(); + Result down(); + std::string getIfaceName(); + + protected: + /** + * Prepare the SocketCAN interface. + * + * After calling this method, mIfname network interface is available and ready to be brought up. + * + * \return true upon success and false upon failure + */ + virtual Result preUp(); + + /** + * Cleanup after bringing the interface down. + * + * This is a counterpart to preUp(). + * + * \return true upon success and false upon failure + */ + virtual bool postDown(); + + /** Network interface name. */ + std::string mIfname; + + private: + /** + * Guard for up flag is required to be held for entire time when the interface is being used + * because we don't want the interface to be torn down while executing that operation. + */ + std::mutex mIsUpGuard; + bool mIsUp GUARDED_BY(mIsUpGuard) = false; + + bool mDownAfterUse; +}; + +} // namespace aidl::android::hardware::automotive::can diff --git a/automotive/can/aidl/default/CanBusNative.cpp b/automotive/can/aidl/default/CanBusNative.cpp new file mode 100644 index 0000000000..8a7de99203 --- /dev/null +++ b/automotive/can/aidl/default/CanBusNative.cpp @@ -0,0 +1,54 @@ +/* + * Copyright 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. + */ + +#include "CanBusNative.h" + +#include +#include +#include + +namespace aidl::android::hardware::automotive::can { + +using namespace ::android; + +CanBusNative::CanBusNative(const std::string& ifname, uint32_t bitrate) + : CanBus(ifname), mBitrate(bitrate) {} + +Result CanBusNative::preUp() { + if (!netdevice::exists(mIfname)) { + LOG(ERROR) << "Interface " << mIfname << " doesn't exist"; + return Result::BAD_INTERFACE_ID; + } + + if (mBitrate == 0) { + // interface is already up and we just want to register it + return Result::OK; + } + + if (!netdevice::down(mIfname)) { + LOG(ERROR) << "Can't bring " << mIfname << " down (to configure it)"; + return Result::UNKNOWN_ERROR; + } + + if (!netdevice::can::setBitrate(mIfname, mBitrate)) { + LOG(ERROR) << "Can't set bitrate " << mBitrate << " for " << mIfname; + return Result::BAD_BITRATE; + } + + return Result::OK; +} + +} // namespace aidl::android::hardware::automotive::can diff --git a/automotive/can/aidl/default/CanBusNative.h b/automotive/can/aidl/default/CanBusNative.h new file mode 100644 index 0000000000..32846c7109 --- /dev/null +++ b/automotive/can/aidl/default/CanBusNative.h @@ -0,0 +1,33 @@ +/* + * Copyright 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. + */ +#pragma once + +#include "CanBus.h" + +namespace aidl::android::hardware::automotive::can { + +class CanBusNative : public CanBus { + public: + CanBusNative(const std::string& ifname, uint32_t bitrate); + + protected: + virtual Result preUp() override; + + private: + const uint32_t mBitrate; +}; + +} // namespace aidl::android::hardware::automotive::can diff --git a/automotive/can/aidl/default/CanBusSlcan.cpp b/automotive/can/aidl/default/CanBusSlcan.cpp new file mode 100644 index 0000000000..6060419dbd --- /dev/null +++ b/automotive/can/aidl/default/CanBusSlcan.cpp @@ -0,0 +1,174 @@ +/* + * Copyright 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. + */ + +#include "CanBusSlcan.h" + +#include +#include +#include + +#include +#include +#include +#include + +#include + +namespace aidl::android::hardware::automotive::can { + +using namespace std::string_view_literals; +using namespace ::android::base; + +namespace slcanprotocol { +static constexpr std::string_view kOpenCommand = "O\r"sv; +static constexpr std::string_view kCloseCommand = "C\r"sv; +static constexpr int kSlcanDiscipline = N_SLCAN; +static constexpr int kDefaultDiscipline = N_TTY; + +static const std::map kBitrateCommands = { + {10000, "C\rS0\r"sv}, {20000, "C\rS1\r"sv}, {50000, "C\rS2\r"sv}, + {100000, "C\rS3\r"sv}, {125000, "C\rS4\r"sv}, {250000, "C\rS5\r"sv}, + {500000, "C\rS6\r"sv}, {800000, "C\rS7\r"sv}, {1000000, "C\rS8\r"sv}}; +} // namespace slcanprotocol + +/** + * Serial Line CAN constructor + * \param string uartName - name of slcan device (e.x. /dev/ttyUSB0) + * \param uint32_t bitrate - speed of the CAN bus (125k = MSCAN, 500k = HSCAN) + */ +CanBusSlcan::CanBusSlcan(const std::string& uartName, uint32_t bitrate) + : CanBus(), mTtyPath(uartName), kBitrate(bitrate) {} + +/** helper function to update CanBusSlcan object's iface name */ +Result CanBusSlcan::updateIfaceName(unique_fd& uartFd) { + struct ifreq ifrequest = {}; + /* + * Fetching the iface name with an ioctl won't interfere with an open socketCAN iface attached + * to this tty. This is important in the event we are trying to register a SLCAN based iface + * that has already been configured and brought up. + */ + if (ioctl(uartFd.get(), SIOCGIFNAME, ifrequest.ifr_name) < 0) { + PLOG(ERROR) << "Failed to get the name of the created device"; + return Result::UNKNOWN_ERROR; + } + + // Update the CanBus object with name that was assigned to it + mIfname = ifrequest.ifr_name; + return Result::OK; +} + +Result CanBusSlcan::preUp() { + // verify valid bitrate and translate to serial command format + std::optional canBitrateCommand = std::nullopt; + if (kBitrate != 0) { + const auto lookupIt = slcanprotocol::kBitrateCommands.find(kBitrate); + if (lookupIt == slcanprotocol::kBitrateCommands.end()) { + return Result::BAD_BITRATE; + } + canBitrateCommand = lookupIt->second; + } + + /* Attempt to open the uart in r/w without blocking or becoming the + * controlling terminal */ + mFd = unique_fd(open(mTtyPath.c_str(), O_RDWR | O_NONBLOCK | O_NOCTTY | O_CLOEXEC)); + if (!mFd.ok()) { + PLOG(ERROR) << "SLCAN Failed to open " << mTtyPath; + return Result::BAD_INTERFACE_ID; + } + + // If the device is already up, update the iface name in our CanBusSlcan object + if (kBitrate == 0) { + return updateIfaceName(mFd); + } + + // blank terminal settings and pull them from the device + struct termios terminalSettings = {}; + if (tcgetattr(mFd.get(), &terminalSettings) < 0) { + PLOG(ERROR) << "Failed to read attrs of" << mTtyPath; + return Result::UNKNOWN_ERROR; + } + + // change settings to raw mode + cfmakeraw(&terminalSettings); + + // disable software flow control + terminalSettings.c_iflag &= ~IXOFF; + // enable hardware flow control + terminalSettings.c_cflag |= CRTSCTS; + + struct serial_struct serialSettings; + // get serial settings + if (ioctl(mFd.get(), TIOCGSERIAL, &serialSettings) < 0) { + PLOG(ERROR) << "Failed to read serial settings from " << mTtyPath; + return Result::UNKNOWN_ERROR; + } + // set low latency mode + serialSettings.flags |= ASYNC_LOW_LATENCY; + // apply serial settings + if (ioctl(mFd.get(), TIOCSSERIAL, &serialSettings) < 0) { + PLOG(ERROR) << "Failed to set low latency mode on " << mTtyPath; + return Result::UNKNOWN_ERROR; + } + + /* TCSADRAIN applies settings after we finish writing the rest of our + * changes (as opposed to TCSANOW, which changes immediately) */ + if (tcsetattr(mFd.get(), TCSADRAIN, &terminalSettings) < 0) { + PLOG(ERROR) << "Failed to apply terminal settings to " << mTtyPath; + return Result::UNKNOWN_ERROR; + } + + // apply speed setting for CAN + if (!WriteStringToFd(*canBitrateCommand, mFd)) { + PLOG(ERROR) << "Failed to apply CAN bitrate"; + return Result::UNKNOWN_ERROR; + } + + // TODO(b/144775286): set open flag & support listen only + if (!WriteStringToFd(slcanprotocol::kOpenCommand, mFd)) { + PLOG(ERROR) << "Failed to set open flag"; + return Result::UNKNOWN_ERROR; + } + + // set line discipline to slcan + if (ioctl(mFd.get(), TIOCSETD, &slcanprotocol::kSlcanDiscipline) < 0) { + PLOG(ERROR) << "Failed to set line discipline to slcan"; + return Result::UNKNOWN_ERROR; + } + + // Update the CanBus object with name that was assigned to it + return updateIfaceName(mFd); +} + +bool CanBusSlcan::postDown() { + // reset the line discipline to TTY mode + if (ioctl(mFd.get(), TIOCSETD, &slcanprotocol::kDefaultDiscipline) < 0) { + LOG(ERROR) << "Failed to reset line discipline!"; + return false; + } + + // issue the close command + if (!WriteStringToFd(slcanprotocol::kCloseCommand, mFd)) { + LOG(ERROR) << "Failed to close tty!"; + return false; + } + + // close our unique_fd + mFd.reset(); + + return true; +} + +} // namespace aidl::android::hardware::automotive::can diff --git a/automotive/can/aidl/default/CanBusSlcan.h b/automotive/can/aidl/default/CanBusSlcan.h new file mode 100644 index 0000000000..a1c908cc4f --- /dev/null +++ b/automotive/can/aidl/default/CanBusSlcan.h @@ -0,0 +1,40 @@ +/* + * Copyright 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. + */ +#pragma once + +#include "CanBus.h" + +#include + +namespace aidl::android::hardware::automotive::can { + +class CanBusSlcan : public CanBus { + public: + CanBusSlcan(const std::string& uartName, uint32_t bitrate); + + protected: + virtual Result preUp() override; + virtual bool postDown() override; + + private: + Result updateIfaceName(::android::base::unique_fd& uartFd); + + const std::string mTtyPath; + const uint32_t kBitrate; + ::android::base::unique_fd mFd; +}; + +} // namespace aidl::android::hardware::automotive::can diff --git a/automotive/can/aidl/default/CanBusVirtual.cpp b/automotive/can/aidl/default/CanBusVirtual.cpp new file mode 100644 index 0000000000..28a1258ad2 --- /dev/null +++ b/automotive/can/aidl/default/CanBusVirtual.cpp @@ -0,0 +1,52 @@ +/* + * Copyright 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. + */ + +#include "CanBusVirtual.h" + +#include +#include + +namespace aidl::android::hardware::automotive::can { + +using namespace ::android; + +CanBusVirtual::CanBusVirtual(const std::string& ifname) : CanBus(ifname) {} + +Result CanBusVirtual::preUp() { + if (netdevice::exists(mIfname)) return Result::OK; + + LOG(DEBUG) << "Virtual interface " << mIfname << " doesn't exist, creating..."; + mWasCreated = true; + if (!netdevice::add(mIfname, "vcan")) { + LOG(ERROR) << "Can't create vcan interface " << mIfname; + return Result::UNKNOWN_ERROR; + } + + return Result::OK; +} + +bool CanBusVirtual::postDown() { + if (mWasCreated) { + mWasCreated = false; + if (!netdevice::del(mIfname)) { + LOG(ERROR) << "Couldn't remove vcan interface " << mIfname; + return false; + } + } + return true; +} + +} // namespace aidl::android::hardware::automotive::can diff --git a/automotive/can/aidl/default/CanBusVirtual.h b/automotive/can/aidl/default/CanBusVirtual.h new file mode 100644 index 0000000000..9c5d35d0bf --- /dev/null +++ b/automotive/can/aidl/default/CanBusVirtual.h @@ -0,0 +1,34 @@ +/* + * Copyright 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. + */ +#pragma once + +#include "CanBus.h" + +namespace aidl::android::hardware::automotive::can { + +class CanBusVirtual : public CanBus { + public: + CanBusVirtual(const std::string& ifname); + + protected: + virtual Result preUp() override; + virtual bool postDown() override; + + private: + bool mWasCreated = false; +}; + +} // namespace aidl::android::hardware::automotive::can diff --git a/automotive/can/aidl/default/CanController.cpp b/automotive/can/aidl/default/CanController.cpp new file mode 100644 index 0000000000..e4b5306815 --- /dev/null +++ b/automotive/can/aidl/default/CanController.cpp @@ -0,0 +1,333 @@ +/* + * Copyright 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. + */ + +#include "CanController.h" + +#include "CanBusNative.h" +#include "CanBusSlcan.h" +#include "CanBusVirtual.h" + +#include +#include + +#include +#include +#include + +namespace aidl::android::hardware::automotive::can { + +namespace fs = ::android::hardware::automotive::filesystem; + +namespace fsErrors { +static const std::error_code ok; +static const std::error_code eperm(EPERM, std::generic_category()); +static const std::error_code enoent(ENOENT, std::generic_category()); +static const std::error_code eacces(EACCES, std::generic_category()); +} // namespace fsErrors + +/* In the /sys/devices tree, there are files called "serial", which contain the serial numbers + * for various devices. The exact location inside of this directory is dependent upon the + * hardware we are running on, so we have to start from /sys/devices and work our way down. */ +static const fs::path kDevPath("/sys/devices/"); +static const std::regex kTtyRe("^tty[A-Z]+[0-9]+$"); +static constexpr auto kOpts = ~(fs::directory_options::follow_directory_symlink | + fs::directory_options::skip_permission_denied); + +constexpr auto ok = &ndk::ScopedAStatus::ok; + +/** + * A helper object to associate the interface name and type of a USB to CAN adapter. + */ +struct UsbCanIface { + InterfaceType iftype; + std::string ifaceName; +}; + +static bool isValidName(const std::string& name) { + static const std::regex nameRE("^[a-zA-Z0-9_]{1,32}$"); + return std::regex_match(name, nameRE); +} + +/** + * Given a path, get the last element from it. + * + * \param itrPath - the path we want the last element of + * \return - the last element in the path (in string form). + */ +static std::string getLeaf(const fs::path& itrPath) { + /* end() returns an iterator one past the leaf of the path, so we've overshot + decrement (--) to go back one to the leaf + dereference and now we have our leaf. */ + return *(--(itrPath.end())); +} + +static ndk::ScopedAStatus resultToStatus(Result res, const std::string& msg = "") { + if (msg.empty()) { + return ndk::ScopedAStatus(AStatus_fromServiceSpecificError(static_cast(res))); + } + return ndk::ScopedAStatus( + AStatus_fromServiceSpecificErrorWithMessage(static_cast(res), msg.c_str())); +} + +/** + * Given a UsbCanIface object, get the ifaceName given the serialPath. + * + * \param serialPath - Absolute path to a "serial" file for a given device in /sys. + * \return A populated UsbCanIface. On failure, nullopt is returned. + */ +static std::optional getIfaceName(const fs::path& serialPath) { + std::error_code fsStatus; + // Since the path is to a file called "serial", we need to search its parent directory. + fs::recursive_directory_iterator fsItr(serialPath.parent_path(), kOpts, fsStatus); + if (fsStatus != fsErrors::ok) { + LOG(ERROR) << "Failed to open " << serialPath.parent_path(); + return std::nullopt; + } + + for (; fsStatus == fsErrors::ok && fsItr != fs::recursive_directory_iterator(); + fsItr.increment(fsStatus)) { + /* We want either a directory called "net" or a directory that looks like tty, so + * skip files. */ + bool isDir = fsItr->is_directory(fsStatus); + if (fsStatus != fsErrors::ok || !isDir) continue; + + std::string currentDir = getLeaf(fsItr->path()); + if (currentDir == "net") { + /* This device is a SocketCAN device. The iface name is the only directory under + * net/. Multiple directories under net/ is an error.*/ + fs::directory_iterator netItr(fsItr->path(), kOpts, fsStatus); + if (fsStatus != fsErrors::ok) { + LOG(ERROR) << "Failed to open " << fsItr->path() << " to get net name!"; + return std::nullopt; + } + + // The leaf of our path should be the interface name. + std::string netName = getLeaf(netItr->path()); + + // Check if there is more than one item in net/ + netItr.increment(fsStatus); + if (fsStatus != fsErrors::ok) { + // It's possible we have a valid net name, but this is most likely an error. + LOG(ERROR) << "Failed to verify " << fsItr->path() << " has valid net name!"; + return std::nullopt; + } + if (netItr != fs::directory_iterator()) { + // There should never be more than one name under net/ + LOG(ERROR) << "Found more than one net name in " << fsItr->path() << "!"; + return std::nullopt; + } + return {{InterfaceType::NATIVE, netName}}; + } else if (std::regex_match(currentDir, kTtyRe)) { + // This device is a USB serial device, and currentDir is the tty name. + return {{InterfaceType::SLCAN, "/dev/" + currentDir}}; + } + } + + // check if the loop above exited due to a c++fs error. + if (fsStatus != fsErrors::ok) { + LOG(ERROR) << "Failed search filesystem: " << fsStatus; + } + return std::nullopt; +} + +/** + * A helper function to read the serial number from a "serial" file in /sys/devices/ + * + * \param serialnoPath - path to the file to read. + * \return the serial number, or nullopt on failure. + */ +static std::optional readSerialNo(const std::string& serialnoPath) { + std::ifstream serialnoStream(serialnoPath); + std::string serialno; + if (!serialnoStream.good()) { + LOG(ERROR) << "Failed to read serial number from " << serialnoPath; + return std::nullopt; + } + std::getline(serialnoStream, serialno); + return serialno; +} + +/** + * Searches for USB devices found in /sys/devices/, and attempts to find a device matching the + * provided list of serial numbers. + * + * \param configSerialnos - a list of serial number (suffixes) from the HAL config. + * \param iftype - the type of the interface to be located. + * \return a matching USB device. On failure, std::nullopt is returned. + */ +static std::optional findUsbDevice(const std::vector& configSerialnos) { + std::error_code fsStatus; + fs::recursive_directory_iterator fsItr(kDevPath, kOpts, fsStatus); + if (fsStatus != fsErrors::ok) { + LOG(ERROR) << "Failed to open " << kDevPath; + return std::nullopt; + } + + for (; fsStatus == fsErrors::ok && fsItr != fs::recursive_directory_iterator(); + fsItr.increment(fsStatus)) { + // We want to find a file called "serial", which is in a directory somewhere. Skip files. + bool isDir = fsItr->is_directory(fsStatus); + if (fsStatus != fsErrors::ok) { + LOG(ERROR) << "Failed check if " << fsStatus; + return std::nullopt; + } + if (!isDir) continue; + + auto serialnoPath = fsItr->path() / "serial"; + bool isReg = fs::is_regular_file(serialnoPath, fsStatus); + + /* Make sure we have permissions to this directory, ignore enoent, since the file + * "serial" may not exist, which is ok. */ + if (fsStatus == fsErrors::eperm || fsStatus == fsErrors::eacces) { + /* This means we don't have access to this directory. If we recurse into it, this + * will cause the iterator to loose its state and we'll crash. */ + fsItr.disable_recursion_pending(); + continue; + } + if (fsStatus == fsErrors::enoent) continue; + if (fsStatus != fsErrors::ok) { + LOG(WARNING) << "An unexpected error occurred while checking for serialno: " + << fsStatus; + continue; + } + if (!isReg) continue; + + // we found a serial number + auto serialno = readSerialNo(serialnoPath); + if (!serialno.has_value()) continue; + + // see if the serial number exists in the config + for (auto&& cfgSn : configSerialnos) { + if (serialno->ends_with(std::string(cfgSn))) { + auto ifaceInfo = getIfaceName(serialnoPath); + if (!ifaceInfo.has_value()) break; + return ifaceInfo; + } + } + } + if (fsStatus != fsErrors::ok) { + LOG(ERROR) << "Error searching filesystem: " << fsStatus; + return std::nullopt; + } + return std::nullopt; +} + +ndk::ScopedAStatus CanController::getSupportedInterfaceTypes( + std::vector* supportedTypes) { + *supportedTypes = {InterfaceType::VIRTUAL, InterfaceType::NATIVE, InterfaceType::SLCAN}; + return ok(); +} + +ndk::ScopedAStatus CanController::getInterfaceName(const std::string& busName, + std::string* ifaceName) { + *ifaceName = {}; + if (mBusesByName.find(busName) == mBusesByName.end()) { + return resultToStatus(Result::BAD_BUS_NAME, fmt::format("{} doesn't exist", busName)); + } + *ifaceName = std::string(mBusesByName[busName]->getIfaceName()); + return ok(); +} + +ndk::ScopedAStatus CanController::upBus(const BusConfig& config, std::string* ifaceName) { + if (!isValidName(config.name)) { + LOG(ERROR) << "Bus name " << config.name << " is invalid"; + return resultToStatus(Result::BAD_BUS_NAME, + fmt::format("{} is not a valid bus name", config.name)); + } else if (mBusesByName.find(config.name) != mBusesByName.end()) { + LOG(ERROR) << "A bus named " << config.name << " already exists!"; + return resultToStatus(Result::INVALID_STATE, + fmt::format("A bus named {} already exists", config.name)); + } + + if (config.interfaceId.getTag() == BusConfig::InterfaceId::Tag::virtualif) { + auto& virtualif = config.interfaceId.get(); + mBusesByName[config.name] = std::make_unique(virtualif.ifname); + } + + else if (config.interfaceId.getTag() == BusConfig::InterfaceId::Tag::nativeif) { + auto& nativeif = config.interfaceId.get(); + std::string ifaceName; + if (nativeif.interfaceId.getTag() == NativeInterface::InterfaceId::Tag::serialno) { + // Configure by serial number. + auto selectedDevice = findUsbDevice( + nativeif.interfaceId.get()); + // verify the returned device is the correct one + if (!selectedDevice.has_value() || selectedDevice->iftype != InterfaceType::NATIVE) { + return resultToStatus( + Result::BAD_INTERFACE_ID, + "Couldn't find a native socketcan device with the given serial number(s)"); + } + ifaceName = selectedDevice->ifaceName; + } else { + // configure by iface name. + ifaceName = nativeif.interfaceId.get(); + } + mBusesByName[config.name] = std::make_unique(ifaceName, config.bitrate); + } + + else if (config.interfaceId.getTag() == BusConfig::InterfaceId::Tag::slcan) { + auto& slcanif = config.interfaceId.get(); + std::string ttyName; + if (slcanif.interfaceId.getTag() == SlcanInterface::InterfaceId::Tag::serialno) { + // Configure by serial number. + auto selectedDevice = findUsbDevice( + slcanif.interfaceId.get()); + if (!selectedDevice.has_value() || selectedDevice->iftype != InterfaceType::SLCAN) { + return resultToStatus( + Result::BAD_INTERFACE_ID, + "Couldn't find a slcan device with the given serial number(s)"); + } + ttyName = selectedDevice->ifaceName; + } else { + // Configure by tty name. + ttyName = slcanif.interfaceId.get(); + } + mBusesByName[config.name] = std::make_unique(ttyName, config.bitrate); + } + + else if (config.interfaceId.getTag() == BusConfig::InterfaceId::Tag::indexed) { + return resultToStatus(Result::NOT_SUPPORTED, + "Indexed devices are not supported in this implementation"); + } else { + // this shouldn't happen. + return resultToStatus(Result::UNKNOWN_ERROR, "Unknown interface id type"); + } + + Result result = mBusesByName[config.name]->up(); + if (result != Result::OK) { + // the bus failed to come up, don't leave a broken entry in the map. + mBusesByName.erase(config.name); + return resultToStatus(result, fmt::format("CanBus::up failed for {}", config.name)); + } + + *ifaceName = mBusesByName[config.name]->getIfaceName(); + return ok(); +} + +ndk::ScopedAStatus CanController::downBus(const std::string& busName) { + if (mBusesByName.find(busName) == mBusesByName.end()) { + return resultToStatus( + Result::UNKNOWN_ERROR, + fmt::format("Couldn't bring down {}, because it doesn't exist", busName)); + } + Result result = mBusesByName[busName]->down(); + if (result != Result::OK) { + return resultToStatus(result, fmt::format("Couldn't bring down {}!", busName)); + } + mBusesByName.erase(busName); + return ok(); +} +} // namespace aidl::android::hardware::automotive::can diff --git a/automotive/can/aidl/default/CanController.h b/automotive/can/aidl/default/CanController.h new file mode 100644 index 0000000000..784906e589 --- /dev/null +++ b/automotive/can/aidl/default/CanController.h @@ -0,0 +1,45 @@ +/* + * Copyright 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. + */ + +#pragma once + +#include + +#include "CanBus.h" + +#include + +#include +#include + +namespace aidl::android::hardware::automotive::can { + +class CanController : public BnCanController { + public: + ndk::ScopedAStatus getSupportedInterfaceTypes( + std::vector* supportedTypes) override; + + ndk::ScopedAStatus getInterfaceName(const std::string& busName, + std::string* ifaceName) override; + + ndk::ScopedAStatus upBus(const BusConfig& config, std::string* ifaceName) override; + + ndk::ScopedAStatus downBus(const std::string& busName) override; + + private: + std::map> mBusesByName = {}; +}; +} // namespace aidl::android::hardware::automotive::can diff --git a/automotive/can/aidl/default/android.hardware.automotive.can.rc b/automotive/can/aidl/default/android.hardware.automotive.can.rc new file mode 100644 index 0000000000..f8437528b3 --- /dev/null +++ b/automotive/can/aidl/default/android.hardware.automotive.can.rc @@ -0,0 +1,5 @@ +service android.hardware.automotive.can /vendor/bin/hw/android.hardware.automotive.can-service + class hal + capabilities NET_ADMIN + user vehicle_network + group system inet diff --git a/automotive/can/aidl/default/android.hardware.automotive.can.xml b/automotive/can/aidl/default/android.hardware.automotive.can.xml new file mode 100644 index 0000000000..873f3335b9 --- /dev/null +++ b/automotive/can/aidl/default/android.hardware.automotive.can.xml @@ -0,0 +1,26 @@ + + + + + + android.hardware.automotive.can + 1 + + ICanController + default + + + diff --git a/automotive/can/aidl/default/service.cpp b/automotive/can/aidl/default/service.cpp new file mode 100644 index 0000000000..eb45167e44 --- /dev/null +++ b/automotive/can/aidl/default/service.cpp @@ -0,0 +1,43 @@ +/* + * Copyright 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. + */ + +#include "CanController.h" + +#include +#include +#include + +namespace android::hardware::automotive::can { + +using namespace std::string_literals; +using ::aidl::android::hardware::automotive::can::CanController; + +extern "C" int main() { + base::SetDefaultTag("CanController"); + base::SetMinimumLogSeverity(base::VERBOSE); + + LOG(VERBOSE) << "Starting up..."; + auto service = ndk::SharedRefBase::make(); + const auto instance = CanController::descriptor + "/default"s; + const auto status = AServiceManager_addService(service->asBinder().get(), instance.c_str()); + CHECK_EQ(status, STATUS_OK) << "Failed to add service " << instance; + LOG(VERBOSE) << "Started successfully!"; + + ABinderProcess_joinThreadPool(); + LOG(FATAL) << "CanController exited unexpectedly!"; + return EXIT_FAILURE; +} +} // namespace android::hardware::automotive::can diff --git a/automotive/can/aidl/default/tools/configurator/Android.bp b/automotive/can/aidl/default/tools/configurator/Android.bp new file mode 100644 index 0000000000..1169894a28 --- /dev/null +++ b/automotive/can/aidl/default/tools/configurator/Android.bp @@ -0,0 +1,43 @@ +// +// 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. +// + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_binary { + name: "canhalconfigurator-aidl", + init_rc: ["canhalconfigurator-aidl.rc"], + defaults: ["android.hardware.automotive.can@defaults"], + srcs: [ + "canhalconfigurator.cpp", + "canprototools.cpp", + ], + shared_libs: [ + "libbase", + "libbinder_ndk", + "libprotobuf-cpp-full", + ], + static_libs: [ + "android.hardware.automotive.can-V1-ndk", + "android.hardware.automotive.can-aidl-config-format", + ], +} diff --git a/automotive/can/aidl/default/tools/configurator/canhalconfigurator-aidl.rc b/automotive/can/aidl/default/tools/configurator/canhalconfigurator-aidl.rc new file mode 100644 index 0000000000..e1b4d3548a --- /dev/null +++ b/automotive/can/aidl/default/tools/configurator/canhalconfigurator-aidl.rc @@ -0,0 +1,3 @@ +service canhalconfigurator /system/bin/canhalconfigurator-aidl + class core + oneshot diff --git a/automotive/can/aidl/default/tools/configurator/canhalconfigurator.cpp b/automotive/can/aidl/default/tools/configurator/canhalconfigurator.cpp new file mode 100644 index 0000000000..94e77b4a48 --- /dev/null +++ b/automotive/can/aidl/default/tools/configurator/canhalconfigurator.cpp @@ -0,0 +1,118 @@ +/* + * 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. + */ + +#include "canbus_config.pb.h" +#include "canprototools.h" + +#include +#include +#include + +#include +#include + +namespace android::hardware::automotive::can { + +using namespace std::string_literals; +using ::aidl::android::hardware::automotive::can::ICanController; + +static constexpr std::string_view kDefaultConfigPath = "/etc/canbus_config.pb"; + +/** + * Takes output from parsed protobuf config and uses it to configure the CAN HAL. + * + * \param pb_cfg is an instance of the autogenerated protobuf object for our configuration. + * \return boolean status, true on success, false on failure. + */ +static bool processPbCfg(const config::CanBusConfig& pb_cfg) { + for (auto const& bus : pb_cfg.buses()) { + if (bus.name().empty()) { + LOG(ERROR) << "Invalid config: Bus config must have a valid name field"; + return false; + } + + auto busCfgMaybe = config::fromPbBus(bus); + if (!busCfgMaybe.has_value()) { + return false; + } + auto busCfg = *busCfgMaybe; + + const auto instance = ICanController::descriptor + "/default"s; + const auto service = ICanController::fromBinder( + ndk::SpAIBinder(AServiceManager_waitForService(instance.c_str()))); + if (service == nullptr) { + LOG(FATAL) << "Can't find CAN HAL! (has it started yet?)"; + return false; + } + + LOG(VERBOSE) << "Bringing up a " << busCfg.name << " @ " << busCfg.bitrate; + + std::string ifaceName; + const auto status = service->upBus(busCfg, &ifaceName); + if (!status.isOk() && status.getExceptionCode() != EX_SERVICE_SPECIFIC) { + LOG(FATAL) << "Binder transaction failed!" << status.getStatus(); + return false; + } else if (!status.isOk()) { + LOG(ERROR) << "upBus failed: " << config::resultStringFromStatus(status) << ": " + << status.getMessage(); + continue; + } + + LOG(INFO) << bus.name() << " has been successfully configured on " << ifaceName; + } + return true; +} + +/** + * This kicks off the CAN HAL configuration process. This starts the following: + * 1. Reading the config file + * 2. Setting up CAN buses + * 3. Handling services + * \param filepath is a string specifying the absolute path of the config file + * \return boolean status, true on success, false on failure + */ +static bool configuratorStart(const std::string& filepath) { + base::SetDefaultTag("CanConfigurator"); + auto pbCfg = config::parseConfigFile(filepath); + if (!pbCfg.has_value()) { + return false; + } + // process the rest of the config file data and configure the CAN buses. + if (!processPbCfg(*pbCfg)) { + return false; + } + LOG(INFO) << "CAN HAL has been configured!"; + return true; +} + +extern "C" int main(int argc, char* argv[]) { + std::string configFilepath = static_cast(kDefaultConfigPath); + + // allow for CLI specification of a config file. + if (argc == 2) { + configFilepath = argv[1]; + } else if (argc > 2) { + std::cerr << "usage: " << argv[0] << " [optional config filepath]"; + return 1; + } + + if (!configuratorStart(configFilepath)) { + return 1; + } + return 0; +} + +} // namespace android::hardware::automotive::can diff --git a/automotive/can/aidl/default/tools/configurator/canprototools.cpp b/automotive/can/aidl/default/tools/configurator/canprototools.cpp new file mode 100644 index 0000000000..2aea315391 --- /dev/null +++ b/automotive/can/aidl/default/tools/configurator/canprototools.cpp @@ -0,0 +1,200 @@ +/* + * 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. + */ +#include "canprototools.h" + +#include +#include +#include +#include + +#include +#include +#include + +#include + +namespace android::hardware::automotive::can::config { + +using ::aidl::android::hardware::automotive::can::BusConfig; +using ::aidl::android::hardware::automotive::can::IndexedInterface; +using ::aidl::android::hardware::automotive::can::InterfaceType; +using ::aidl::android::hardware::automotive::can::NativeInterface; +using ::aidl::android::hardware::automotive::can::Result; +using ::aidl::android::hardware::automotive::can::SlcanInterface; +using ::aidl::android::hardware::automotive::can::VirtualInterface; + +/** + * Helper function for parseConfigFile. readString is used to get the fist n characters (n) from an + * istream object (s) and return it as a string object. + * + * \param s istream of the file you intend to read. + * \param n streamsize object of the number of characters you'd like. + * \return optional string containing up to n characters from the stream(s) you provided. + */ +static std::optional readString(std::istream& s, std::streamsize n) { + char buff[n]; + auto got = s.read(buff, n).gcount(); + if (!s.good() && !s.eof()) return std::nullopt; + return std::string(buff, 0, std::min(n, got)); +} + +std::optional parseConfigFile(const std::string& filepath) { + std::ifstream cfg_stream(filepath); + + // text headers that would be present in a plaintext proto config file. + static const std::array text_headers = {"buses", "#", "controller"}; + auto cfg_file_snippet = readString(cfg_stream, 10); + + if (!cfg_file_snippet.has_value()) { + LOG(ERROR) << "Can't open " << filepath << " for reading"; + return std::nullopt; + } + cfg_stream.seekg(0); + + // check if any of the textHeaders are at the start of the config file. + bool text_format = false; + for (auto const& header : text_headers) { + if (cfg_file_snippet->compare(0, header.length(), header) == 0) { + text_format = true; + break; + } + } + + CanBusConfig config; + if (text_format) { + google::protobuf::io::IstreamInputStream pb_stream(&cfg_stream); + if (!google::protobuf::TextFormat::Parse(&pb_stream, &config)) { + LOG(ERROR) << "Failed to parse (text format) " << filepath; + return std::nullopt; + } + } else if (!config.ParseFromIstream(&cfg_stream)) { + LOG(ERROR) << "Failed to parse (binary format) " << filepath; + return std::nullopt; + } + return config; +} + +std::optional fromPbBus(const Bus& pb_bus) { + BusConfig bus_cfg = {}; + bus_cfg.name = pb_bus.name(); + + switch (pb_bus.iface_type_case()) { + case Bus::kNative: { + const std::string ifname = pb_bus.native().ifname(); + const std::vector serials = {pb_bus.native().serialno().begin(), + pb_bus.native().serialno().end()}; + if (ifname.empty() == serials.empty()) { + LOG(ERROR) << "Invalid config: native type bus must have an iface name xor a " + << "serial number"; + return std::nullopt; + } + bus_cfg.bitrate = pb_bus.bitrate(); + NativeInterface nativeif = {}; + if (!ifname.empty()) + nativeif.interfaceId.set(ifname); + if (!serials.empty()) + nativeif.interfaceId.set(serials); + bus_cfg.interfaceId.set(nativeif); + break; + } + case Bus::kSlcan: { + const std::string ttyname = pb_bus.slcan().ttyname(); + const std::vector serials = {pb_bus.slcan().serialno().begin(), + pb_bus.slcan().serialno().end()}; + if (ttyname.empty() == serials.empty()) { + LOG(ERROR) << "Invalid config: slcan type bus must have a tty name xor a serial " + << "number"; + return std::nullopt; + } + bus_cfg.bitrate = pb_bus.bitrate(); + SlcanInterface slcan = {}; + if (!ttyname.empty()) + slcan.interfaceId.set(ttyname); + if (!serials.empty()) + slcan.interfaceId.set(serials); + bus_cfg.interfaceId.set(slcan); + break; + } + case Bus::kVirtual: { + // Theoretically, we could just create the next available vcan iface. + const std::string ifname = pb_bus.virtual_().ifname(); + if (ifname.empty()) { + LOG(ERROR) << "Invalid config: native type bus must have an iface name"; + return std::nullopt; + } + VirtualInterface virtualif = {}; + virtualif.ifname = ifname; + bus_cfg.interfaceId.set(virtualif); + break; + } + case Bus::kIndexed: { + const uint8_t index = pb_bus.indexed().index(); + if (index > UINT8_MAX) { + LOG(ERROR) << "Interface index out of range: " << index; + return std::nullopt; + } + IndexedInterface indexedif = {}; + indexedif.index = index; + bus_cfg.interfaceId.set(indexedif); + break; + } + default: + LOG(ERROR) << "Invalid config: bad interface type for " << bus_cfg.name; + return std::nullopt; + } + return bus_cfg; +} + +std::optional getHalIftype(const Bus& pb_bus) { + switch (pb_bus.iface_type_case()) { + case Bus::kNative: + return InterfaceType::NATIVE; + case Bus::kSlcan: + return InterfaceType::SLCAN; + case Bus::kVirtual: + return InterfaceType::VIRTUAL; + case Bus::kIndexed: + return InterfaceType::INDEXED; + default: + return std::nullopt; + } +} + +std::string resultStringFromStatus(const ndk::ScopedAStatus& status) { + const auto res = static_cast(status.getServiceSpecificError()); + switch (res) { + case Result::OK: + return "OK"; + case Result::UNKNOWN_ERROR: + return "UNKNOWN_ERROR"; + case Result::INVALID_STATE: + return "INVALID_STATE"; + case Result::NOT_SUPPORTED: + return "NOT_SUPPORTED"; + case Result::BAD_INTERFACE_ID: + return "BAD_INTERFACE_ID"; + case Result::BAD_BITRATE: + return "BAD_BITRATE"; + case Result::BAD_BUS_NAME: + return "BAD_BUS_NAME"; + case Result::INTERFACE_DOWN: + return "INTERFACE_DOWN"; + default: + return "Invalid Result!"; + } +} + +} // namespace android::hardware::automotive::can::config diff --git a/automotive/can/aidl/default/tools/configurator/canprototools.h b/automotive/can/aidl/default/tools/configurator/canprototools.h new file mode 100644 index 0000000000..377ee7f92a --- /dev/null +++ b/automotive/can/aidl/default/tools/configurator/canprototools.h @@ -0,0 +1,54 @@ +/* + * 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. + */ +#pragma once + +#include "canbus_config.pb.h" + +#include +#include +#include + +namespace android::hardware::automotive::can::config { + +/** + * This reads the protobuf config file into a protobuf object. Both text based protobuf files as + * well as binary format protobuf files are supported. + * + * \param filepath string containing the name of the config file to read. + * \return a CanBusConfig protobuf object constructed from the config file. + */ +std::optional parseConfigFile(const std::string& filepath); + +/** + * Converts protobuf format single-bus config object to a HAL bus config object. + * + * \param pb_bus is the protobuf object representing a the configuration of one CAN bus. + * \return a converted HAL bus config object. + */ +std::optional<::aidl::android::hardware::automotive::can::BusConfig> fromPbBus(const Bus& pb_bus); + +/** + * Get the CAN HAL interface type specified by a given protobuf config object. + * + * \param pb_bus is the protobuf object representing a the configuration of one CAN bus. + * \return the CAN HAL interface type. + */ +std::optional<::aidl::android::hardware::automotive::can::InterfaceType> getHalIftype( + const Bus& pb_bus); + +std::string resultStringFromStatus(const ndk::ScopedAStatus& status); + +} // namespace android::hardware::automotive::can::config diff --git a/automotive/can/aidl/default/tools/configurator/proto/Android.bp b/automotive/can/aidl/default/tools/configurator/proto/Android.bp new file mode 100644 index 0000000000..da1b37c664 --- /dev/null +++ b/automotive/can/aidl/default/tools/configurator/proto/Android.bp @@ -0,0 +1,37 @@ +// +// 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. +// + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_library_static { + name: "android.hardware.automotive.can-aidl-config-format", + defaults: ["android.hardware.automotive.can@defaults"], + proto: { + export_proto_headers: true, + type: "full", + }, + strip: { + keep_symbols: true, + }, + srcs: ["canbus_config.proto"], +} diff --git a/automotive/can/aidl/default/tools/configurator/proto/canbus_config.proto b/automotive/can/aidl/default/tools/configurator/proto/canbus_config.proto new file mode 100644 index 0000000000..b03b03567f --- /dev/null +++ b/automotive/can/aidl/default/tools/configurator/proto/canbus_config.proto @@ -0,0 +1,52 @@ +/* + * 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 = "proto3"; + +package android.hardware.automotive.can.config; + +message IfaceNative { + string ifname = 1; + repeated string serialno = 2; +}; + +message IfaceSlcan { + string ttyname = 1; + repeated string serialno = 2; +}; + +message IfaceVirtual { + string ifname = 1; +}; + +message IfaceIndexed { + uint32 index = 1; +}; + +message Bus { + string name = 1; // this is the name presented in the HAL + oneof iface_type { + IfaceNative native = 2; + IfaceSlcan slcan = 3; + IfaceVirtual virtual = 4; + IfaceIndexed indexed = 5; + } + uint32 bitrate = 6; +}; + +message CanBusConfig { + repeated Bus buses = 1; +}; diff --git a/automotive/can/aidl/vts/functional/Android.bp b/automotive/can/aidl/vts/functional/Android.bp new file mode 100644 index 0000000000..b816a4952e --- /dev/null +++ b/automotive/can/aidl/vts/functional/Android.bp @@ -0,0 +1,51 @@ +// +// 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. +// + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_test { + name: "VtsHalCanControllerV1_0Test", + defaults: [ + "VtsHalTargetTestDefaults", + "android.hardware.automotive.can@defaults", + "use_libaidlvintf_gtest_helper_static", + ], + cpp_std: "experimental", + srcs: [ + "CanControllerAidlTest.cpp", + ], + shared_libs: [ + "libbase", + "libbinder_ndk", + ], + static_libs: [ + "android.hardware.automotive.can-V1-ndk", + "android.hardware.automotive.can@libnetdevice", + "libnl++", + "libgmock", + ], + test_suites: [ + "general-tests", + "vts", + ], +} diff --git a/automotive/can/aidl/vts/functional/CanControllerAidlTest.cpp b/automotive/can/aidl/vts/functional/CanControllerAidlTest.cpp new file mode 100644 index 0000000000..c2b28795b2 --- /dev/null +++ b/automotive/can/aidl/vts/functional/CanControllerAidlTest.cpp @@ -0,0 +1,96 @@ +/* + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +using aidl::android::hardware::automotive::can::BusConfig; +using aidl::android::hardware::automotive::can::ICanController; +using aidl::android::hardware::automotive::can::VirtualInterface; +using namespace std::chrono_literals; +using namespace std::string_literals; + +class CanControllerAidlTest : public ::testing::TestWithParam { + public: + virtual void SetUp() override { + android::base::SetDefaultTag("CAN_HAL_VTS"); + android::base::SetMinimumLogSeverity(android::base::VERBOSE); + const auto instance = ICanController::descriptor + "/default"s; + mCanControllerService = ICanController::fromBinder( + ndk::SpAIBinder(AServiceManager_waitForService(instance.c_str()))); + + ASSERT_NE(mCanControllerService, nullptr); + } + virtual void TearDown() override {} + + static bool mTestCaseInitialized; + std::shared_ptr mCanControllerService; +}; + +// we can't test a real bus, since we can't make any assumptions about hardware +// this checks upBus, getInterfaceName, and downBus +TEST_P(CanControllerAidlTest, ToggleBus) { + const std::string_view canIface = "vcan50"; + const std::string busName = "VTS_CAN"; + + std::string upBusReturn; // should be vcan50 + BusConfig config = {}; + VirtualInterface iface = {}; + iface.ifname = canIface; + config.interfaceId.set(iface); + config.name = busName; + auto aidlStatus = mCanControllerService->upBus(config, &upBusReturn); + ASSERT_TRUE(aidlStatus.isOk()); + EXPECT_EQ(upBusReturn, canIface); + + std::string ifaceName; + aidlStatus = mCanControllerService->getInterfaceName(busName, &ifaceName); + ASSERT_TRUE(aidlStatus.isOk()); + EXPECT_EQ(ifaceName, canIface); + + aidlStatus = mCanControllerService->downBus(busName); + ASSERT_TRUE(aidlStatus.isOk()); +} + +TEST_P(CanControllerAidlTest, GetSupported) { + LOG(VERBOSE) << "Get the supported iface types"; + std::vector<::aidl::android::hardware::automotive::can::InterfaceType> supportedTypes; + auto aidlStatus = mCanControllerService->getSupportedInterfaceTypes(&supportedTypes); + ASSERT_TRUE(aidlStatus.isOk()); + EXPECT_FALSE(supportedTypes.empty()); +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(CanControllerAidlTest); +INSTANTIATE_TEST_SUITE_P( + PerInstance, CanControllerAidlTest, + testing::ValuesIn(android::getAidlHalInstanceNames(ICanController::descriptor)), + android::PrintInstanceNameToString); diff --git a/automotive/can/aidl/vts/functional/OWNERS b/automotive/can/aidl/vts/functional/OWNERS new file mode 100644 index 0000000000..85257a3537 --- /dev/null +++ b/automotive/can/aidl/vts/functional/OWNERS @@ -0,0 +1,3 @@ +# Bug component: 533426 +twasilczyk@google.com +chrisweir@google.com diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index dc87c63789..ebc3dffda8 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -68,6 +68,14 @@ default + + android.hardware.automotive.can + 1 + + ICanController + default + + android.hardware.automotive.can 1.0 From 9d37ac07a26647f9e174a98ec595ba8e5e51c1de Mon Sep 17 00:00:00 2001 From: Gil Cukierman Date: Wed, 30 Nov 2022 17:07:43 -0500 Subject: [PATCH 420/998] Update setNullCipherAndIntegrityEnabled AIDL Docs Specify that integrity protection for user data is optional Bug: 237529943 Test: N/A docstring Change-Id: Ifde9da07462ba14f55fb0c0f73935373bb4ba8b7 --- .../aidl/android/hardware/radio/network/IRadioNetwork.aidl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl index 6cd0339c05..70427f81f0 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl @@ -488,7 +488,11 @@ oneway interface IRadioNetwork { /** * Set if null encryption and integrity modes are enabled. If the value of enabled is false * the modem must not allow any network communications with null ciphering or null integrity - * modes. In case of an emergency call, the modem must bypass this setting. + * modes. + * + * In the case when enabled is false, integrity protection for user data is optional, but + * ciphering for user data is required. In case of an emergency call, the modem must bypass + * this setting. * * Null ciphering and integrity modes include (but are not limited to): * 2G: A5/0 From c1e4c064b3af12eeb803070f13678737050e600b Mon Sep 17 00:00:00 2001 From: John Reck Date: Tue, 1 Nov 2022 17:29:48 -0400 Subject: [PATCH 421/998] Add ABI check to IMapper5 Bug: 254345788 Test: Make change, verify build fails Change-Id: Ib97b26f1483293b0461c47184ae39c48b9404b0f --- graphics/mapper/stable-c/Android.bp | 19 +++++++++++++++ graphics/mapper/stable-c/imapper.map.txt | 4 ++++ .../mapper/stable-c/imapper5_abicheck.cpp | 23 +++++++++++++++++++ .../hardware/graphics/mapper/IMapper.h | 4 +--- 4 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 graphics/mapper/stable-c/imapper.map.txt create mode 100644 graphics/mapper/stable-c/imapper5_abicheck.cpp diff --git a/graphics/mapper/stable-c/Android.bp b/graphics/mapper/stable-c/Android.bp index c03f67ea47..9764036660 100644 --- a/graphics/mapper/stable-c/Android.bp +++ b/graphics/mapper/stable-c/Android.bp @@ -35,6 +35,25 @@ cc_library_headers { ], } +cc_library_shared { + name: "libimapper_stablec_abicheck", + visibility: ["//visibility:private"], + defaults: [ + "android.hardware.graphics.allocator-ndk_shared", + "android.hardware.graphics.common-ndk_shared", + ], + header_libs: [ + "libimapper_stablec", + ], + srcs: [ + "imapper5_abicheck.cpp", + ], + header_abi_checker: { + enabled: true, + symbol_file: "imapper.map.txt", + }, +} + cc_library_headers { name: "libimapper_providerutils", vendor_available: true, diff --git a/graphics/mapper/stable-c/imapper.map.txt b/graphics/mapper/stable-c/imapper.map.txt new file mode 100644 index 0000000000..43abd33a1a --- /dev/null +++ b/graphics/mapper/stable-c/imapper.map.txt @@ -0,0 +1,4 @@ +LIBIMAPPER { # introduced=UpsideDownCake + global: + AIMapper_loadIMapper; +} diff --git a/graphics/mapper/stable-c/imapper5_abicheck.cpp b/graphics/mapper/stable-c/imapper5_abicheck.cpp new file mode 100644 index 0000000000..92f7198807 --- /dev/null +++ b/graphics/mapper/stable-c/imapper5_abicheck.cpp @@ -0,0 +1,23 @@ +/* + * 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. + */ + +#include + +AIMapper_Error AIMapper_loadIMapper(AIMapper* _Nullable* _Nonnull outImplementation) { + static AIMapper mapper = {AIMAPPER_VERSION_5, {}}; + *outImplementation = &mapper; + return AIMAPPER_ERROR_NONE; +} \ No newline at end of file diff --git a/graphics/mapper/stable-c/include/android/hardware/graphics/mapper/IMapper.h b/graphics/mapper/stable-c/include/android/hardware/graphics/mapper/IMapper.h index 0f6d146fb8..e9dea1a3c8 100644 --- a/graphics/mapper/stable-c/include/android/hardware/graphics/mapper/IMapper.h +++ b/graphics/mapper/stable-c/include/android/hardware/graphics/mapper/IMapper.h @@ -26,10 +26,8 @@ #pragma once +#include #include -#include -#include -#include #include #include From a67db85ec4afca23e5df0edc5b484dfc44cdefa6 Mon Sep 17 00:00:00 2001 From: Emilian Peev Date: Wed, 30 Nov 2022 14:48:13 -0800 Subject: [PATCH 422/998] Camera: Add extension specific metadata section Bug: 257136838 Test: Camera CTS Change-Id: Iba2432b6ccec37c901a3e0b340e019e30c12fbf6 --- .../android/hardware/camera/metadata/CameraMetadataSection.aidl | 1 + .../hardware/camera/metadata/CameraMetadataSectionStart.aidl | 1 + .../android/hardware/camera/metadata/CameraMetadataSection.aidl | 1 + .../hardware/camera/metadata/CameraMetadataSectionStart.aidl | 1 + 4 files changed, 4 insertions(+) diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSection.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSection.aidl index 8bed156d8f..e28ecad1c3 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSection.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSection.aidl @@ -70,5 +70,6 @@ enum CameraMetadataSection { ANDROID_HEIC_INFO = 29, ANDROID_AUTOMOTIVE = 30, ANDROID_AUTOMOTIVE_LENS = 31, + ANDROID_EXTENSION = 32, VENDOR_SECTION = 32768, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl index 1725347698..a223309668 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl @@ -70,5 +70,6 @@ enum CameraMetadataSectionStart { ANDROID_HEIC_INFO_START = 1900544, ANDROID_AUTOMOTIVE_START = 1966080, ANDROID_AUTOMOTIVE_LENS_START = 2031616, + ANDROID_EXTENSION_START = 2097152, VENDOR_SECTION_START = -2147483648, } diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataSection.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataSection.aidl index 99e28b9cc7..0d79f0d0f1 100644 --- a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataSection.aidl +++ b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataSection.aidl @@ -61,5 +61,6 @@ enum CameraMetadataSection { ANDROID_HEIC_INFO, ANDROID_AUTOMOTIVE, ANDROID_AUTOMOTIVE_LENS, + ANDROID_EXTENSION, VENDOR_SECTION = 0x8000, } diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl index 62c71e9a74..8f571285ce 100644 --- a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl +++ b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl @@ -63,5 +63,6 @@ enum CameraMetadataSectionStart { ANDROID_HEIC_INFO_START = CameraMetadataSection.ANDROID_HEIC_INFO << 16, ANDROID_AUTOMOTIVE_START = CameraMetadataSection.ANDROID_AUTOMOTIVE << 16, ANDROID_AUTOMOTIVE_LENS_START = CameraMetadataSection.ANDROID_AUTOMOTIVE_LENS << 16, + ANDROID_EXTENSION_START = CameraMetadataSection.ANDROID_EXTENSION << 16, VENDOR_SECTION_START = CameraMetadataSection.VENDOR_SECTION << 16, } From 68b70cc924e38745e8305ebb5830c6e1ba77d4c1 Mon Sep 17 00:00:00 2001 From: shrikar Date: Wed, 30 Nov 2022 17:08:04 -0800 Subject: [PATCH 423/998] Fixed SEAT_AIRBAG_ENABLED throwing ASSUMPTION_FAILED in cts test Bug: 257268798 Test: atest CarPropertyManagerTest Change-Id: I38fa60ece4123f374edf18a27c856512f7e07b39 --- .../android/hardware/automotive/vehicle/VehicleProperty.aidl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index b6886c0ae0..ab454954df 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1742,6 +1742,9 @@ enum VehicleProperty { * * This property can be set to VehiclePropertyAccess.READ read only for the sake of regulation * or safety concerns. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE */ SEAT_AIRBAG_ENABLED = 0x0B9E + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.BOOLEAN, From 2bbf8ee86db5be185acc8a5fe0093471578e2c1a Mon Sep 17 00:00:00 2001 From: Ricky Niu Date: Thu, 1 Dec 2022 15:24:44 +0800 Subject: [PATCH 424/998] Fixed the build break in cf_x86_tv-userdebug Change the long to int64_t in function setCurrentUsbFunctions Bug: 260947383 Change-Id: I4832e2890ea561c8ad377e5a62bfa22dae35bf0f Signed-off-by: Ricky Niu --- usb/gadget/aidl/default/UsbGadget.cpp | 11 ++++++----- usb/gadget/aidl/default/UsbGadget.h | 4 ++-- usb/gadget/aidl/default/service_gadget.cpp | 5 ----- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/usb/gadget/aidl/default/UsbGadget.cpp b/usb/gadget/aidl/default/UsbGadget.cpp index 1f1dc742b6..c4986e8e18 100644 --- a/usb/gadget/aidl/default/UsbGadget.cpp +++ b/usb/gadget/aidl/default/UsbGadget.cpp @@ -149,7 +149,9 @@ Status UsbGadget::setupFunctions(long functions, const shared_ptr &callback, uint64_t timeout, int64_t in_transactionId) { bool ffsEnabled = false; - ALOGI("functions: %ld, timeout: %ld", functions, timeout); + if (timeout == 0) { + ALOGI("timeout not setup"); + } if ((functions & GadgetFunction::ADB) != 0) { ffsEnabled = true; @@ -193,9 +195,9 @@ Status getI2cBusHelper(string *name) { return Status::ERROR; } -ScopedAStatus UsbGadget::setCurrentUsbFunctions(long functions, +ScopedAStatus UsbGadget::setCurrentUsbFunctions(int64_t functions, const shared_ptr &callback, - int64_t timeout, + int64_t timeoutMs, int64_t in_transactionId) { std::unique_lock lk(mLockSetCurrentFunction); std::string current_usb_power_operation_mode, current_usb_type; @@ -203,7 +205,6 @@ ScopedAStatus UsbGadget::setCurrentUsbFunctions(long functions, string accessoryCurrentLimitEnablePath, accessoryCurrentLimitPath, path; - ALOGI("enter setCurrentUsbFunctions, in_transactionId=%ld , %ld", in_transactionId , timeout); mCurrentUsbFunctions = functions; mCurrentUsbFunctionsApplied = false; @@ -237,7 +238,7 @@ ScopedAStatus UsbGadget::setCurrentUsbFunctions(long functions, -1, "Error while calling setCurrentUsbFunctionsCb"); } - status = setupFunctions(functions, callback, timeout, in_transactionId); + status = setupFunctions(functions, callback, timeoutMs, in_transactionId); if (status != Status::SUCCESS) { goto error; } diff --git a/usb/gadget/aidl/default/UsbGadget.h b/usb/gadget/aidl/default/UsbGadget.h index e1194198eb..adcfcfa7ca 100644 --- a/usb/gadget/aidl/default/UsbGadget.h +++ b/usb/gadget/aidl/default/UsbGadget.h @@ -89,9 +89,9 @@ struct UsbGadget : public BnUsbGadget { bool mCurrentUsbFunctionsApplied; UsbSpeed mUsbSpeed; - ScopedAStatus setCurrentUsbFunctions(long functions, + ScopedAStatus setCurrentUsbFunctions(int64_t functions, const shared_ptr &callback, - int64_t timeout, int64_t in_transactionId) override; + int64_t timeoutMs, int64_t in_transactionId) override; ScopedAStatus getCurrentUsbFunctions(const shared_ptr &callback, int64_t in_transactionId) override; diff --git a/usb/gadget/aidl/default/service_gadget.cpp b/usb/gadget/aidl/default/service_gadget.cpp index 3cc5718a8f..7efbadd516 100644 --- a/usb/gadget/aidl/default/service_gadget.cpp +++ b/usb/gadget/aidl/default/service_gadget.cpp @@ -17,11 +17,6 @@ #include #include #include "UsbGadget.h" -/*using android::OK; -using android::hardware::configureRpcThreadpool; -using android::hardware::joinRpcThreadpool; -using android::sp; -using android::status_t;*/ using ::aidl::android::hardware::usb::gadget::UsbGadget; int main() { ABinderProcess_setThreadPoolMaxThreadCount(0); From e1857f8dbda78cd6d2eeb908ed8931d55e42446f Mon Sep 17 00:00:00 2001 From: Avichal Rakesh Date: Wed, 8 Jun 2022 17:47:23 -0700 Subject: [PATCH 425/998] Migrate reference external HAL implementation to AIDL Android T migrated the HAL interface to AIDL, but the reference HAL was never updated to use AIDL. This CL migrates the reference HAL implementation for external cameras to use AIDL as well. The external HAL uses V4L2 standard to expose USB cameras to the cameraserver. The reference HAL implementation for internal camera was dropped because it is not possible to write a generic HAL that works with some large percentage of internal cameras. Bug: 219974678 Test: Existing CTS tests pass with external camera connected. Change-Id: I35f3dc32c16670eca7735a4ac00fed3daf36aa65 --- camera/common/1.0/default/Android.bp | 1 + camera/common/1.0/default/SimpleThread.cpp | 65 + .../common/1.0/default/include/SimpleThread.h | 64 + camera/device/default/Android.bp | 71 + .../device/default/ExternalCameraDevice.cpp | 1001 ++++++ camera/device/default/ExternalCameraDevice.h | 191 ++ .../default/ExternalCameraDeviceSession.cpp | 2947 +++++++++++++++++ .../default/ExternalCameraDeviceSession.h | 399 +++ .../default/ExternalCameraOfflineSession.cpp | 547 +++ .../default/ExternalCameraOfflineSession.h | 143 + camera/device/default/ExternalCameraUtils.cpp | 860 +++++ camera/device/default/ExternalCameraUtils.h | 300 ++ camera/device/default/OWNERS | 1 + camera/device/default/convert.cpp | 71 + camera/device/default/convert.h | 58 + camera/provider/default/Android.bp | 104 + .../default/ExternalCameraProvider.cpp | 382 +++ .../provider/default/ExternalCameraProvider.h | 117 + camera/provider/default/OWNERS | 1 + ...amera.provider-V1-external-service-lazy.rc | 10 + ...are.camera.provider-V1-external-service.rc | 8 + camera/provider/default/external-service.cpp | 52 + 22 files changed, 7393 insertions(+) create mode 100644 camera/common/1.0/default/SimpleThread.cpp create mode 100644 camera/common/1.0/default/include/SimpleThread.h create mode 100644 camera/device/default/Android.bp create mode 100644 camera/device/default/ExternalCameraDevice.cpp create mode 100644 camera/device/default/ExternalCameraDevice.h create mode 100644 camera/device/default/ExternalCameraDeviceSession.cpp create mode 100644 camera/device/default/ExternalCameraDeviceSession.h create mode 100644 camera/device/default/ExternalCameraOfflineSession.cpp create mode 100644 camera/device/default/ExternalCameraOfflineSession.h create mode 100644 camera/device/default/ExternalCameraUtils.cpp create mode 100644 camera/device/default/ExternalCameraUtils.h create mode 100644 camera/device/default/OWNERS create mode 100644 camera/device/default/convert.cpp create mode 100644 camera/device/default/convert.h create mode 100644 camera/provider/default/Android.bp create mode 100644 camera/provider/default/ExternalCameraProvider.cpp create mode 100644 camera/provider/default/ExternalCameraProvider.h create mode 100644 camera/provider/default/OWNERS create mode 100644 camera/provider/default/android.hardware.camera.provider-V1-external-service-lazy.rc create mode 100644 camera/provider/default/android.hardware.camera.provider-V1-external-service.rc create mode 100644 camera/provider/default/external-service.cpp diff --git a/camera/common/1.0/default/Android.bp b/camera/common/1.0/default/Android.bp index 4a5ca83803..1a4d16b8f9 100644 --- a/camera/common/1.0/default/Android.bp +++ b/camera/common/1.0/default/Android.bp @@ -18,6 +18,7 @@ cc_library_static { "VendorTagDescriptor.cpp", "HandleImporter.cpp", "Exif.cpp", + "SimpleThread.cpp", ], cflags: [ "-Werror", diff --git a/camera/common/1.0/default/SimpleThread.cpp b/camera/common/1.0/default/SimpleThread.cpp new file mode 100644 index 0000000000..46e89ba47b --- /dev/null +++ b/camera/common/1.0/default/SimpleThread.cpp @@ -0,0 +1,65 @@ +/* + * 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. + */ + +#include "SimpleThread.h" + +namespace android { +namespace hardware { +namespace camera { +namespace common { +namespace helper { + +SimpleThread::SimpleThread() : mDone(true), mThread() {} +SimpleThread::~SimpleThread() { + // Safe to call requestExitAndWait() from the destructor because requestExitAndWait() ensures + // that the thread is joinable before joining on it. This is different from how + // android::Thread worked. + requestExitAndWait(); +} + +void SimpleThread::run() { + requestExitAndWait(); // Exit current execution, if any. + + // start thread + mDone.store(false, std::memory_order_release); + mThread = std::thread(&SimpleThread::runLoop, this); +} + +void SimpleThread::requestExitAndWait() { + // Signal thread to stop + mDone.store(true, std::memory_order_release); + + // Wait for thread to exit if needed. This should happen in no more than one iteration of + // threadLoop + if (mThread.joinable()) { + mThread.join(); + } + mThread = std::thread(); +} + +void SimpleThread::runLoop() { + while (!exitPending()) { + if (!threadLoop()) { + break; + } + } +} + +} // namespace helper +} // namespace common +} // namespace camera +} // namespace hardware +} // namespace android \ No newline at end of file diff --git a/camera/common/1.0/default/include/SimpleThread.h b/camera/common/1.0/default/include/SimpleThread.h new file mode 100644 index 0000000000..d1becd60be --- /dev/null +++ b/camera/common/1.0/default/include/SimpleThread.h @@ -0,0 +1,64 @@ +/* + * 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. + */ + +#ifndef HARDWARE_INTERFACES_CAMERA_COMMON_SIMPLETHREAD_H_ +#define HARDWARE_INTERFACES_CAMERA_COMMON_SIMPLETHREAD_H_ + +#include + +namespace android { +namespace hardware { +namespace camera { +namespace common { +namespace helper { + +// A simple looper based on std::thread. +class SimpleThread { + public: + SimpleThread(); + virtual ~SimpleThread(); + + // Explicit call to start execution of the thread. No thread is created before this function + // is called. + virtual void run() final; + virtual void requestExitAndWait() final; + + protected: + // Main logic of the thread. This function is called repeatedly until it returns false. + // Thread execution stops if this function returns false. + virtual bool threadLoop() = 0; + + // Returns true if the thread execution should stop. Should be used by threadLoop to check if + // the thread has been requested to exit. + virtual inline bool exitPending() final { return mDone.load(std::memory_order_acquire); } + + private: + // Wraps threadLoop in a simple while loop that allows safe exit + virtual void runLoop() final; + + // Flag to signal end of thread execution. This flag is checked before every iteration + // of threadLoop. + std::atomic_bool mDone; + std::thread mThread; +}; + +} // namespace helper +} // namespace common +} // namespace camera +} // namespace hardware +} // namespace android + +#endif // HARDWARE_INTERFACES_CAMERA_COMMON_SIMPLETHREAD_H_ diff --git a/camera/device/default/Android.bp b/camera/device/default/Android.bp new file mode 100644 index 0000000000..b577597d8c --- /dev/null +++ b/camera/device/default/Android.bp @@ -0,0 +1,71 @@ +// +// Copyright (C) 2020 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 { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_library_shared { + name: "camera.device-external-impl", + defaults: ["hidl_defaults"], + proprietary: true, + srcs: [ + "ExternalCameraDevice.cpp", + "ExternalCameraDeviceSession.cpp", + "ExternalCameraOfflineSession.cpp", + "ExternalCameraUtils.cpp", + "convert.cpp", + ], + shared_libs: [ + "android.hardware.camera.common-V1-ndk", + "android.hardware.camera.device-V1-ndk", + "android.hardware.graphics.allocator-V1-ndk", + "android.hardware.graphics.common-V4-ndk", + "android.hardware.graphics.mapper@2.0", + "android.hardware.graphics.mapper@3.0", + "android.hardware.graphics.mapper@4.0", + "android.hidl.allocator@1.0", + "android.hidl.memory@1.0", + "libbinder_ndk", + "libcamera_metadata", + "libcutils", + "libexif", + "libfmq", + "libgralloctypes", + "libhardware", + "libhidlbase", + "libhidlmemory", + "libjpeg", + "liblog", + "libsync", + "libtinyxml2", + "libutils", + "libyuv", + ], + static_libs: [ + "android.hardware.camera.common@1.0-helper", + "libaidlcommonsupport", + ], + header_libs: [ + "media_plugin_headers", + ], + export_include_dirs: ["."], +} diff --git a/camera/device/default/ExternalCameraDevice.cpp b/camera/device/default/ExternalCameraDevice.cpp new file mode 100644 index 0000000000..677fb429ef --- /dev/null +++ b/camera/device/default/ExternalCameraDevice.cpp @@ -0,0 +1,1001 @@ +/* + * 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. + */ + +#define LOG_TAG "ExtCamDev" +// #define LOG_NDEBUG 0 +#include + +#include "ExternalCameraDevice.h" + +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace camera { +namespace device { +namespace implementation { + +using ::aidl::android::hardware::camera::common::Status; + +namespace { +// Only support MJPEG for now as it seems to be the one supports higher fps +// Other formats to consider in the future: +// * V4L2_PIX_FMT_YVU420 (== YV12) +// * V4L2_PIX_FMT_YVYU (YVYU: can be converted to YV12 or other YUV420_888 formats) +const std::array kSupportedFourCCs{ + {V4L2_PIX_FMT_MJPEG, V4L2_PIX_FMT_Z16}}; // double braces required in C++11 + +constexpr int MAX_RETRY = 5; // Allow retry v4l2 open failures a few times. +constexpr int OPEN_RETRY_SLEEP_US = 100'000; // 100ms * MAX_RETRY = 0.5 seconds + +const std::regex kDevicePathRE("/dev/video([0-9]+)"); +} // namespace + +std::string ExternalCameraDevice::kDeviceVersion = "1.1"; + +ExternalCameraDevice::ExternalCameraDevice(const std::string& devicePath, + const ExternalCameraConfig& config) + : mCameraId("-1"), mDevicePath(devicePath), mCfg(config) { + std::smatch sm; + if (std::regex_match(mDevicePath, sm, kDevicePathRE)) { + mCameraId = std::to_string(mCfg.cameraIdOffset + std::stoi(sm[1])); + } else { + ALOGE("%s: device path match failed for %s", __FUNCTION__, mDevicePath.c_str()); + } +} + +ExternalCameraDevice::~ExternalCameraDevice() {} + +ndk::ScopedAStatus ExternalCameraDevice::getCameraCharacteristics(CameraMetadata* _aidl_return) { + Mutex::Autolock _l(mLock); + if (_aidl_return == nullptr) { + return fromStatus(Status::ILLEGAL_ARGUMENT); + } + + if (isInitFailedLocked()) { + return fromStatus(Status::INTERNAL_ERROR); + } + + const camera_metadata_t* rawMetadata = mCameraCharacteristics.getAndLock(); + convertToAidl(rawMetadata, _aidl_return); + mCameraCharacteristics.unlock(rawMetadata); + return fromStatus(Status::OK); +} + +ndk::ScopedAStatus ExternalCameraDevice::getPhysicalCameraCharacteristics(const std::string&, + CameraMetadata*) { + ALOGE("%s: Physical camera functions are not supported for external cameras.", __FUNCTION__); + return fromStatus(Status::ILLEGAL_ARGUMENT); +} + +ndk::ScopedAStatus ExternalCameraDevice::getResourceCost(CameraResourceCost* _aidl_return) { + if (_aidl_return == nullptr) { + return fromStatus(Status::ILLEGAL_ARGUMENT); + } + + _aidl_return->resourceCost = 100; + return fromStatus(Status::OK); +} + +ndk::ScopedAStatus ExternalCameraDevice::isStreamCombinationSupported( + const StreamConfiguration& in_streams, bool* _aidl_return) { + if (isInitFailed()) { + ALOGE("%s: camera %s. camera init failed!", __FUNCTION__, mCameraId.c_str()); + return fromStatus(Status::INTERNAL_ERROR); + } + Status s = ExternalCameraDeviceSession::isStreamCombinationSupported(in_streams, + mSupportedFormats, mCfg); + *_aidl_return = s == Status::OK; + return fromStatus(Status::OK); +} + +ndk::ScopedAStatus ExternalCameraDevice::open( + const std::shared_ptr& in_callback, + std::shared_ptr* _aidl_return) { + if (_aidl_return == nullptr) { + ALOGE("%s: cannot open camera %s. return session ptr is null!", __FUNCTION__, + mCameraId.c_str()); + return fromStatus(Status::ILLEGAL_ARGUMENT); + } + + Mutex::Autolock _l(mLock); + if (isInitFailedLocked()) { + ALOGE("%s: cannot open camera %s. camera init failed!", __FUNCTION__, mCameraId.c_str()); + return fromStatus(Status::INTERNAL_ERROR); + } + + std::shared_ptr session; + ALOGV("%s: Initializing device for camera %s", __FUNCTION__, mCameraId.c_str()); + session = mSession.lock(); + + if (session != nullptr && !session->isClosed()) { + ALOGE("%s: cannot open an already opened camera!", __FUNCTION__); + return fromStatus(Status::CAMERA_IN_USE); + } + + int numAttempt = 0; + unique_fd fd(::open(mDevicePath.c_str(), O_RDWR)); + while (fd.get() < 0 && numAttempt < MAX_RETRY) { + // Previous retry attempts failed. Retry opening the device at most MAX_RETRY times + ALOGW("%s: v4l2 device %s open failed, wait 33ms and try again", __FUNCTION__, + mDevicePath.c_str()); + usleep(OPEN_RETRY_SLEEP_US); // sleep and try again + fd.reset(::open(mDevicePath.c_str(), O_RDWR)); + numAttempt++; + } + + if (fd.get() < 0) { + ALOGE("%s: v4l2 device open %s failed: %s", __FUNCTION__, mDevicePath.c_str(), + strerror(errno)); + return fromStatus(Status::INTERNAL_ERROR); + } + + session = createSession(in_callback, mCfg, mSupportedFormats, mCroppingType, + mCameraCharacteristics, mCameraId, std::move(fd)); + if (session == nullptr) { + ALOGE("%s: camera device session allocation failed", __FUNCTION__); + return fromStatus(Status::INTERNAL_ERROR); + } + + if (session->isInitFailed()) { + ALOGE("%s: camera device session init failed", __FUNCTION__); + return fromStatus(Status::INTERNAL_ERROR); + } + + mSession = session; + *_aidl_return = session; + return fromStatus(Status::OK); +} + +ndk::ScopedAStatus ExternalCameraDevice::openInjectionSession( + const std::shared_ptr&, std::shared_ptr*) { + return fromStatus(Status::OPERATION_NOT_SUPPORTED); +} + +ndk::ScopedAStatus ExternalCameraDevice::setTorchMode(bool) { + return fromStatus(Status::OPERATION_NOT_SUPPORTED); +} + +ndk::ScopedAStatus ExternalCameraDevice::turnOnTorchWithStrengthLevel(int32_t) { + return fromStatus(Status::OPERATION_NOT_SUPPORTED); +} + +ndk::ScopedAStatus ExternalCameraDevice::getTorchStrengthLevel(int32_t*) { + return fromStatus(Status::OPERATION_NOT_SUPPORTED); +} + +std::shared_ptr ExternalCameraDevice::createSession( + const std::shared_ptr& cb, const ExternalCameraConfig& cfg, + const std::vector& sortedFormats, const CroppingType& croppingType, + const common::V1_0::helper::CameraMetadata& chars, const std::string& cameraId, + unique_fd v4l2Fd) { + return ndk::SharedRefBase::make( + cb, cfg, sortedFormats, croppingType, chars, cameraId, std::move(v4l2Fd)); +} + +bool ExternalCameraDevice::isInitFailed() { + Mutex::Autolock _l(mLock); + return isInitFailedLocked(); +} + +bool ExternalCameraDevice::isInitFailedLocked() { + if (!mInitialized) { + status_t ret = initCameraCharacteristics(); + if (ret != OK) { + ALOGE("%s: init camera characteristics failed: errorno %d", __FUNCTION__, ret); + mInitFailed = true; + } + mInitialized = true; + } + return mInitFailed; +} + +void ExternalCameraDevice::initSupportedFormatsLocked(int fd) { + std::vector horizontalFmts = + getCandidateSupportedFormatsLocked(fd, HORIZONTAL, mCfg.fpsLimits, mCfg.depthFpsLimits, + mCfg.minStreamSize, mCfg.depthEnabled); + std::vector verticalFmts = + getCandidateSupportedFormatsLocked(fd, VERTICAL, mCfg.fpsLimits, mCfg.depthFpsLimits, + mCfg.minStreamSize, mCfg.depthEnabled); + + size_t horiSize = horizontalFmts.size(); + size_t vertSize = verticalFmts.size(); + + if (horiSize == 0 && vertSize == 0) { + ALOGE("%s: cannot find suitable cropping type!", __FUNCTION__); + return; + } + + if (horiSize == 0) { + mSupportedFormats = verticalFmts; + mCroppingType = VERTICAL; + return; + } else if (vertSize == 0) { + mSupportedFormats = horizontalFmts; + mCroppingType = HORIZONTAL; + return; + } + + const auto& maxHoriSize = horizontalFmts[horizontalFmts.size() - 1]; + const auto& maxVertSize = verticalFmts[verticalFmts.size() - 1]; + + // Try to keep the largest possible output size + // When they are the same or ambiguous, pick the one support more sizes + if (maxHoriSize.width == maxVertSize.width && maxHoriSize.height == maxVertSize.height) { + if (horiSize > vertSize) { + mSupportedFormats = horizontalFmts; + mCroppingType = HORIZONTAL; + } else { + mSupportedFormats = verticalFmts; + mCroppingType = VERTICAL; + } + } else if (maxHoriSize.width >= maxVertSize.width && maxHoriSize.height >= maxVertSize.height) { + mSupportedFormats = horizontalFmts; + mCroppingType = HORIZONTAL; + } else if (maxHoriSize.width <= maxVertSize.width && maxHoriSize.height <= maxVertSize.height) { + mSupportedFormats = verticalFmts; + mCroppingType = VERTICAL; + } else { + if (horiSize > vertSize) { + mSupportedFormats = horizontalFmts; + mCroppingType = HORIZONTAL; + } else { + mSupportedFormats = verticalFmts; + mCroppingType = VERTICAL; + } + } +} + +status_t ExternalCameraDevice::initCameraCharacteristics() { + if (!mCameraCharacteristics.isEmpty()) { + // Camera Characteristics previously initialized. Skip. + return OK; + } + + // init camera characteristics + unique_fd fd(::open(mDevicePath.c_str(), O_RDWR)); + if (fd.get() < 0) { + ALOGE("%s: v4l2 device open %s failed", __FUNCTION__, mDevicePath.c_str()); + return DEAD_OBJECT; + } + + status_t ret; + ret = initDefaultCharsKeys(&mCameraCharacteristics); + if (ret != OK) { + ALOGE("%s: init default characteristics key failed: errorno %d", __FUNCTION__, ret); + mCameraCharacteristics.clear(); + return ret; + } + + ret = initCameraControlsCharsKeys(fd.get(), &mCameraCharacteristics); + if (ret != OK) { + ALOGE("%s: init camera control characteristics key failed: errorno %d", __FUNCTION__, ret); + mCameraCharacteristics.clear(); + return ret; + } + + ret = initOutputCharsKeys(fd.get(), &mCameraCharacteristics); + if (ret != OK) { + ALOGE("%s: init output characteristics key failed: errorno %d", __FUNCTION__, ret); + mCameraCharacteristics.clear(); + return ret; + } + + ret = initAvailableCapabilities(&mCameraCharacteristics); + if (ret != OK) { + ALOGE("%s: init available capabilities key failed: errorno %d", __FUNCTION__, ret); + mCameraCharacteristics.clear(); + return ret; + } + + return OK; +} + +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) +#define UPDATE(tag, data, size) \ + do { \ + if (metadata->update((tag), (data), (size))) { \ + ALOGE("Update " #tag " failed!"); \ + return -EINVAL; \ + } \ + } while (0) + +status_t ExternalCameraDevice::initAvailableCapabilities( + ::android::hardware::camera::common::V1_0::helper::CameraMetadata* metadata) { + if (mSupportedFormats.empty()) { + ALOGE("%s: Supported formats list is empty", __FUNCTION__); + return UNKNOWN_ERROR; + } + + bool hasDepth = false; + bool hasColor = false; + for (const auto& fmt : mSupportedFormats) { + switch (fmt.fourcc) { + case V4L2_PIX_FMT_Z16: + hasDepth = true; + break; + case V4L2_PIX_FMT_MJPEG: + hasColor = true; + break; + default: + ALOGW("%s: Unsupported format found", __FUNCTION__); + } + } + + std::vector availableCapabilities; + if (hasDepth) { + availableCapabilities.push_back(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT); + } + if (hasColor) { + availableCapabilities.push_back(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE); + } + if (!availableCapabilities.empty()) { + UPDATE(ANDROID_REQUEST_AVAILABLE_CAPABILITIES, availableCapabilities.data(), + availableCapabilities.size()); + } + + return OK; +} + +status_t ExternalCameraDevice::initDefaultCharsKeys( + ::android::hardware::camera::common::V1_0::helper::CameraMetadata* metadata) { + const uint8_t hardware_level = ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL; + UPDATE(ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL, &hardware_level, 1); + + // android.colorCorrection + const uint8_t availableAberrationModes[] = {ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF}; + UPDATE(ANDROID_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES, availableAberrationModes, + ARRAY_SIZE(availableAberrationModes)); + + // android.control + const uint8_t antibandingMode = ANDROID_CONTROL_AE_ANTIBANDING_MODE_AUTO; + UPDATE(ANDROID_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES, &antibandingMode, 1); + + const int32_t controlMaxRegions[] = {/*AE*/ 0, /*AWB*/ 0, /*AF*/ 0}; + UPDATE(ANDROID_CONTROL_MAX_REGIONS, controlMaxRegions, ARRAY_SIZE(controlMaxRegions)); + + const uint8_t videoStabilizationMode = ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_OFF; + UPDATE(ANDROID_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES, &videoStabilizationMode, 1); + + const uint8_t awbAvailableMode = ANDROID_CONTROL_AWB_MODE_AUTO; + UPDATE(ANDROID_CONTROL_AWB_AVAILABLE_MODES, &awbAvailableMode, 1); + + const uint8_t aeAvailableMode = ANDROID_CONTROL_AE_MODE_ON; + UPDATE(ANDROID_CONTROL_AE_AVAILABLE_MODES, &aeAvailableMode, 1); + + const uint8_t availableFffect = ANDROID_CONTROL_EFFECT_MODE_OFF; + UPDATE(ANDROID_CONTROL_AVAILABLE_EFFECTS, &availableFffect, 1); + + const uint8_t controlAvailableModes[] = {ANDROID_CONTROL_MODE_OFF, ANDROID_CONTROL_MODE_AUTO}; + UPDATE(ANDROID_CONTROL_AVAILABLE_MODES, controlAvailableModes, + ARRAY_SIZE(controlAvailableModes)); + + // android.edge + const uint8_t edgeMode = ANDROID_EDGE_MODE_OFF; + UPDATE(ANDROID_EDGE_AVAILABLE_EDGE_MODES, &edgeMode, 1); + + // android.flash + const uint8_t flashInfo = ANDROID_FLASH_INFO_AVAILABLE_FALSE; + UPDATE(ANDROID_FLASH_INFO_AVAILABLE, &flashInfo, 1); + + // android.hotPixel + const uint8_t hotPixelMode = ANDROID_HOT_PIXEL_MODE_OFF; + UPDATE(ANDROID_HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES, &hotPixelMode, 1); + + // android.jpeg + const int32_t jpegAvailableThumbnailSizes[] = {0, 0, 176, 144, 240, 144, 256, + 144, 240, 160, 256, 154, 240, 180}; + UPDATE(ANDROID_JPEG_AVAILABLE_THUMBNAIL_SIZES, jpegAvailableThumbnailSizes, + ARRAY_SIZE(jpegAvailableThumbnailSizes)); + + const int32_t jpegMaxSize = mCfg.maxJpegBufSize; + UPDATE(ANDROID_JPEG_MAX_SIZE, &jpegMaxSize, 1); + + // android.lens + const uint8_t focusDistanceCalibration = + ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_UNCALIBRATED; + UPDATE(ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION, &focusDistanceCalibration, 1); + + const uint8_t opticalStabilizationMode = ANDROID_LENS_OPTICAL_STABILIZATION_MODE_OFF; + UPDATE(ANDROID_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION, &opticalStabilizationMode, 1); + + const uint8_t facing = ANDROID_LENS_FACING_EXTERNAL; + UPDATE(ANDROID_LENS_FACING, &facing, 1); + + // android.noiseReduction + const uint8_t noiseReductionMode = ANDROID_NOISE_REDUCTION_MODE_OFF; + UPDATE(ANDROID_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES, &noiseReductionMode, 1); + UPDATE(ANDROID_NOISE_REDUCTION_MODE, &noiseReductionMode, 1); + + const int32_t partialResultCount = 1; + UPDATE(ANDROID_REQUEST_PARTIAL_RESULT_COUNT, &partialResultCount, 1); + + // This means pipeline latency of X frame intervals. The maximum number is 4. + const uint8_t requestPipelineMaxDepth = 4; + UPDATE(ANDROID_REQUEST_PIPELINE_MAX_DEPTH, &requestPipelineMaxDepth, 1); + + // Three numbers represent the maximum numbers of different types of output + // streams simultaneously. The types are raw sensor, processed (but not + // stalling), and processed (but stalling). For usb limited mode, raw sensor + // is not supported. Stalling stream is JPEG. Non-stalling streams are + // YUV_420_888 or YV12. + const int32_t requestMaxNumOutputStreams[] = { + /*RAW*/ 0, + /*Processed*/ ExternalCameraDeviceSession::kMaxProcessedStream, + /*Stall*/ ExternalCameraDeviceSession::kMaxStallStream}; + UPDATE(ANDROID_REQUEST_MAX_NUM_OUTPUT_STREAMS, requestMaxNumOutputStreams, + ARRAY_SIZE(requestMaxNumOutputStreams)); + + // Limited mode doesn't support reprocessing. + const int32_t requestMaxNumInputStreams = 0; + UPDATE(ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS, &requestMaxNumInputStreams, 1); + + // android.scaler + // TODO: b/72263447 V4L2_CID_ZOOM_* + const float scalerAvailableMaxDigitalZoom[] = {1}; + UPDATE(ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM, scalerAvailableMaxDigitalZoom, + ARRAY_SIZE(scalerAvailableMaxDigitalZoom)); + + const uint8_t croppingType = ANDROID_SCALER_CROPPING_TYPE_CENTER_ONLY; + UPDATE(ANDROID_SCALER_CROPPING_TYPE, &croppingType, 1); + + const int32_t testPatternModes[] = {ANDROID_SENSOR_TEST_PATTERN_MODE_OFF, + ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR}; + UPDATE(ANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES, testPatternModes, + ARRAY_SIZE(testPatternModes)); + + const uint8_t timestampSource = ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN; + UPDATE(ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE, ×tampSource, 1); + + // Orientation is a bit odd for external camera, but consider it as the orientation + // between the external camera sensor (which is usually landscape) and the device's + // natural display orientation. For devices with natural landscape display (ex: tablet/TV), the + // orientation should be 0. For devices with natural portrait display (phone), the orientation + // should be 270. + const int32_t orientation = mCfg.orientation; + UPDATE(ANDROID_SENSOR_ORIENTATION, &orientation, 1); + + // android.shading + const uint8_t availableMode = ANDROID_SHADING_MODE_OFF; + UPDATE(ANDROID_SHADING_AVAILABLE_MODES, &availableMode, 1); + + // android.statistics + const uint8_t faceDetectMode = ANDROID_STATISTICS_FACE_DETECT_MODE_OFF; + UPDATE(ANDROID_STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES, &faceDetectMode, 1); + + const int32_t maxFaceCount = 0; + UPDATE(ANDROID_STATISTICS_INFO_MAX_FACE_COUNT, &maxFaceCount, 1); + + const uint8_t availableHotpixelMode = ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE_OFF; + UPDATE(ANDROID_STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES, &availableHotpixelMode, 1); + + const uint8_t lensShadingMapMode = ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_OFF; + UPDATE(ANDROID_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES, &lensShadingMapMode, 1); + + // android.sync + const int32_t maxLatency = ANDROID_SYNC_MAX_LATENCY_UNKNOWN; + UPDATE(ANDROID_SYNC_MAX_LATENCY, &maxLatency, 1); + + /* Other sensor/RAW related keys: + * android.sensor.info.colorFilterArrangement -> no need if we don't do RAW + * android.sensor.info.physicalSize -> not available + * android.sensor.info.whiteLevel -> not available/not needed + * android.sensor.info.lensShadingApplied -> not needed + * android.sensor.info.preCorrectionActiveArraySize -> not available/not needed + * android.sensor.blackLevelPattern -> not available/not needed + */ + + const int32_t availableRequestKeys[] = {ANDROID_COLOR_CORRECTION_ABERRATION_MODE, + ANDROID_CONTROL_AE_ANTIBANDING_MODE, + ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION, + ANDROID_CONTROL_AE_LOCK, + ANDROID_CONTROL_AE_MODE, + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER, + ANDROID_CONTROL_AE_TARGET_FPS_RANGE, + ANDROID_CONTROL_AF_MODE, + ANDROID_CONTROL_AF_TRIGGER, + ANDROID_CONTROL_AWB_LOCK, + ANDROID_CONTROL_AWB_MODE, + ANDROID_CONTROL_CAPTURE_INTENT, + ANDROID_CONTROL_EFFECT_MODE, + ANDROID_CONTROL_MODE, + ANDROID_CONTROL_SCENE_MODE, + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE, + ANDROID_FLASH_MODE, + ANDROID_JPEG_ORIENTATION, + ANDROID_JPEG_QUALITY, + ANDROID_JPEG_THUMBNAIL_QUALITY, + ANDROID_JPEG_THUMBNAIL_SIZE, + ANDROID_LENS_OPTICAL_STABILIZATION_MODE, + ANDROID_NOISE_REDUCTION_MODE, + ANDROID_SCALER_CROP_REGION, + ANDROID_SENSOR_TEST_PATTERN_MODE, + ANDROID_STATISTICS_FACE_DETECT_MODE, + ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE}; + UPDATE(ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS, availableRequestKeys, + ARRAY_SIZE(availableRequestKeys)); + + const int32_t availableResultKeys[] = {ANDROID_COLOR_CORRECTION_ABERRATION_MODE, + ANDROID_CONTROL_AE_ANTIBANDING_MODE, + ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION, + ANDROID_CONTROL_AE_LOCK, + ANDROID_CONTROL_AE_MODE, + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER, + ANDROID_CONTROL_AE_STATE, + ANDROID_CONTROL_AE_TARGET_FPS_RANGE, + ANDROID_CONTROL_AF_MODE, + ANDROID_CONTROL_AF_STATE, + ANDROID_CONTROL_AF_TRIGGER, + ANDROID_CONTROL_AWB_LOCK, + ANDROID_CONTROL_AWB_MODE, + ANDROID_CONTROL_AWB_STATE, + ANDROID_CONTROL_CAPTURE_INTENT, + ANDROID_CONTROL_EFFECT_MODE, + ANDROID_CONTROL_MODE, + ANDROID_CONTROL_SCENE_MODE, + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE, + ANDROID_FLASH_MODE, + ANDROID_FLASH_STATE, + ANDROID_JPEG_ORIENTATION, + ANDROID_JPEG_QUALITY, + ANDROID_JPEG_THUMBNAIL_QUALITY, + ANDROID_JPEG_THUMBNAIL_SIZE, + ANDROID_LENS_OPTICAL_STABILIZATION_MODE, + ANDROID_NOISE_REDUCTION_MODE, + ANDROID_REQUEST_PIPELINE_DEPTH, + ANDROID_SCALER_CROP_REGION, + ANDROID_SENSOR_TIMESTAMP, + ANDROID_STATISTICS_FACE_DETECT_MODE, + ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE, + ANDROID_STATISTICS_LENS_SHADING_MAP_MODE, + ANDROID_STATISTICS_SCENE_FLICKER}; + UPDATE(ANDROID_REQUEST_AVAILABLE_RESULT_KEYS, availableResultKeys, + ARRAY_SIZE(availableResultKeys)); + + UPDATE(ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS, AVAILABLE_CHARACTERISTICS_KEYS.data(), + AVAILABLE_CHARACTERISTICS_KEYS.size()); + + return OK; +} + +status_t ExternalCameraDevice::initCameraControlsCharsKeys( + int, ::android::hardware::camera::common::V1_0::helper::CameraMetadata* metadata) { + // android.sensor.info.sensitivityRange -> V4L2_CID_ISO_SENSITIVITY + // android.sensor.info.exposureTimeRange -> V4L2_CID_EXPOSURE_ABSOLUTE + // android.sensor.info.maxFrameDuration -> TBD + // android.lens.info.minimumFocusDistance -> V4L2_CID_FOCUS_ABSOLUTE + // android.lens.info.hyperfocalDistance + // android.lens.info.availableFocalLengths -> not available? + + // android.control + // No AE compensation support for now. + // TODO: V4L2_CID_EXPOSURE_BIAS + const int32_t controlAeCompensationRange[] = {0, 0}; + UPDATE(ANDROID_CONTROL_AE_COMPENSATION_RANGE, controlAeCompensationRange, + ARRAY_SIZE(controlAeCompensationRange)); + const camera_metadata_rational_t controlAeCompensationStep[] = {{0, 1}}; + UPDATE(ANDROID_CONTROL_AE_COMPENSATION_STEP, controlAeCompensationStep, + ARRAY_SIZE(controlAeCompensationStep)); + + // TODO: Check V4L2_CID_AUTO_FOCUS_*. + const uint8_t afAvailableModes[] = {ANDROID_CONTROL_AF_MODE_AUTO, ANDROID_CONTROL_AF_MODE_OFF}; + UPDATE(ANDROID_CONTROL_AF_AVAILABLE_MODES, afAvailableModes, ARRAY_SIZE(afAvailableModes)); + + // TODO: V4L2_CID_SCENE_MODE + const uint8_t availableSceneMode = ANDROID_CONTROL_SCENE_MODE_DISABLED; + UPDATE(ANDROID_CONTROL_AVAILABLE_SCENE_MODES, &availableSceneMode, 1); + + // TODO: V4L2_CID_3A_LOCK + const uint8_t aeLockAvailable = ANDROID_CONTROL_AE_LOCK_AVAILABLE_FALSE; + UPDATE(ANDROID_CONTROL_AE_LOCK_AVAILABLE, &aeLockAvailable, 1); + const uint8_t awbLockAvailable = ANDROID_CONTROL_AWB_LOCK_AVAILABLE_FALSE; + UPDATE(ANDROID_CONTROL_AWB_LOCK_AVAILABLE, &awbLockAvailable, 1); + + // TODO: V4L2_CID_ZOOM_* + const float scalerAvailableMaxDigitalZoom[] = {1}; + UPDATE(ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM, scalerAvailableMaxDigitalZoom, + ARRAY_SIZE(scalerAvailableMaxDigitalZoom)); + + return OK; +} + +status_t ExternalCameraDevice::initOutputCharsKeys( + int fd, ::android::hardware::camera::common::V1_0::helper::CameraMetadata* metadata) { + initSupportedFormatsLocked(fd); + if (mSupportedFormats.empty()) { + ALOGE("%s: Init supported format list failed", __FUNCTION__); + return UNKNOWN_ERROR; + } + + bool hasDepth = false; + bool hasColor = false; + + // For V4L2_PIX_FMT_Z16 + std::array halDepthFormats{{HAL_PIXEL_FORMAT_Y16}}; + // For V4L2_PIX_FMT_MJPEG + std::array halFormats{{HAL_PIXEL_FORMAT_BLOB, HAL_PIXEL_FORMAT_YCbCr_420_888, + HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED}}; + + for (const auto& supportedFormat : mSupportedFormats) { + switch (supportedFormat.fourcc) { + case V4L2_PIX_FMT_Z16: + hasDepth = true; + break; + case V4L2_PIX_FMT_MJPEG: + hasColor = true; + break; + default: + ALOGW("%s: format %c%c%c%c is not supported!", __FUNCTION__, + supportedFormat.fourcc & 0xFF, (supportedFormat.fourcc >> 8) & 0xFF, + (supportedFormat.fourcc >> 16) & 0xFF, (supportedFormat.fourcc >> 24) & 0xFF); + } + } + + if (hasDepth) { + status_t ret = initOutputCharsKeysByFormat( + metadata, V4L2_PIX_FMT_Z16, halDepthFormats, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_OUTPUT, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS, + ANDROID_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS, + ANDROID_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS); + if (ret != OK) { + ALOGE("%s: Unable to initialize depth format keys: %s", __FUNCTION__, + statusToString(ret).c_str()); + return ret; + } + } + if (hasColor) { + status_t ret = + initOutputCharsKeysByFormat(metadata, V4L2_PIX_FMT_MJPEG, halFormats, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, + ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS, + ANDROID_SCALER_AVAILABLE_STALL_DURATIONS); + if (ret != OK) { + ALOGE("%s: Unable to initialize color format keys: %s", __FUNCTION__, + statusToString(ret).c_str()); + return ret; + } + } + + status_t ret = calculateMinFps(metadata); + if (ret != OK) { + ALOGE("%s: Unable to update fps metadata: %s", __FUNCTION__, statusToString(ret).c_str()); + return ret; + } + + SupportedV4L2Format maximumFormat{.width = 0, .height = 0}; + for (const auto& supportedFormat : mSupportedFormats) { + if (supportedFormat.width >= maximumFormat.width && + supportedFormat.height >= maximumFormat.height) { + maximumFormat = supportedFormat; + } + } + int32_t activeArraySize[] = {0, 0, static_cast(maximumFormat.width), + static_cast(maximumFormat.height)}; + UPDATE(ANDROID_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE, activeArraySize, + ARRAY_SIZE(activeArraySize)); + UPDATE(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE, activeArraySize, ARRAY_SIZE(activeArraySize)); + + int32_t pixelArraySize[] = {static_cast(maximumFormat.width), + static_cast(maximumFormat.height)}; + UPDATE(ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE, pixelArraySize, ARRAY_SIZE(pixelArraySize)); + return OK; +} + +template +status_t ExternalCameraDevice::initOutputCharsKeysByFormat( + ::android::hardware::camera::common::V1_0::helper::CameraMetadata* metadata, + uint32_t fourcc, const std::array& halFormats, int streamConfigTag, + int streamConfigurationKey, int minFrameDurationKey, int stallDurationKey) { + if (mSupportedFormats.empty()) { + ALOGE("%s: Init supported format list failed", __FUNCTION__); + return UNKNOWN_ERROR; + } + + std::vector streamConfigurations; + std::vector minFrameDurations; + std::vector stallDurations; + + for (const auto& supportedFormat : mSupportedFormats) { + if (supportedFormat.fourcc != fourcc) { + // Skip 4CCs not meant for the halFormats + continue; + } + for (const auto& format : halFormats) { + streamConfigurations.push_back(format); + streamConfigurations.push_back(supportedFormat.width); + streamConfigurations.push_back(supportedFormat.height); + streamConfigurations.push_back(streamConfigTag); + } + + int64_t minFrameDuration = std::numeric_limits::max(); + for (const auto& fr : supportedFormat.frameRates) { + // 1000000000LL < (2^32 - 1) and + // fr.durationNumerator is uint32_t, so no overflow here + int64_t frameDuration = 1000000000LL * fr.durationNumerator / fr.durationDenominator; + if (frameDuration < minFrameDuration) { + minFrameDuration = frameDuration; + } + } + + for (const auto& format : halFormats) { + minFrameDurations.push_back(format); + minFrameDurations.push_back(supportedFormat.width); + minFrameDurations.push_back(supportedFormat.height); + minFrameDurations.push_back(minFrameDuration); + } + + // The stall duration is 0 for non-jpeg formats. For JPEG format, stall + // duration can be 0 if JPEG is small. Here we choose 1 sec for JPEG. + // TODO: b/72261675. Maybe set this dynamically + for (const auto& format : halFormats) { + const int64_t NS_TO_SECOND = 1E9; + int64_t stall_duration = (format == HAL_PIXEL_FORMAT_BLOB) ? NS_TO_SECOND : 0; + stallDurations.push_back(format); + stallDurations.push_back(supportedFormat.width); + stallDurations.push_back(supportedFormat.height); + stallDurations.push_back(stall_duration); + } + } + + UPDATE(streamConfigurationKey, streamConfigurations.data(), streamConfigurations.size()); + + UPDATE(minFrameDurationKey, minFrameDurations.data(), minFrameDurations.size()); + + UPDATE(stallDurationKey, stallDurations.data(), stallDurations.size()); + + return OK; +} + +status_t ExternalCameraDevice::calculateMinFps( + ::android::hardware::camera::common::V1_0::helper::CameraMetadata* metadata) { + std::set framerates; + int32_t minFps = std::numeric_limits::max(); + + for (const auto& supportedFormat : mSupportedFormats) { + for (const auto& fr : supportedFormat.frameRates) { + int32_t frameRateInt = static_cast(fr.getFramesPerSecond()); + if (minFps > frameRateInt) { + minFps = frameRateInt; + } + framerates.insert(frameRateInt); + } + } + + std::vector fpsRanges; + // FPS ranges + for (const auto& framerate : framerates) { + // Empirical: webcams often have close to 2x fps error and cannot support fixed fps range + fpsRanges.push_back(framerate / 2); + fpsRanges.push_back(framerate); + } + minFps /= 2; + int64_t maxFrameDuration = 1000000000LL / minFps; + + UPDATE(ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES, fpsRanges.data(), fpsRanges.size()); + + UPDATE(ANDROID_SENSOR_INFO_MAX_FRAME_DURATION, &maxFrameDuration, 1); + + return OK; +} + +#undef ARRAY_SIZE +#undef UPDATE + +void ExternalCameraDevice::getFrameRateList(int fd, double fpsUpperBound, + SupportedV4L2Format* format) { + format->frameRates.clear(); + + v4l2_frmivalenum frameInterval{ + .index = 0, + .pixel_format = format->fourcc, + .width = static_cast<__u32>(format->width), + .height = static_cast<__u32>(format->height), + }; + + for (frameInterval.index = 0; + TEMP_FAILURE_RETRY(ioctl(fd, VIDIOC_ENUM_FRAMEINTERVALS, &frameInterval)) == 0; + ++frameInterval.index) { + if (frameInterval.type == V4L2_FRMIVAL_TYPE_DISCRETE) { + if (frameInterval.discrete.numerator != 0) { + SupportedV4L2Format::FrameRate fr = {frameInterval.discrete.numerator, + frameInterval.discrete.denominator}; + double framerate = fr.getFramesPerSecond(); + if (framerate > fpsUpperBound) { + continue; + } + ALOGV("index:%d, format:%c%c%c%c, w %d, h %d, framerate %f", frameInterval.index, + frameInterval.pixel_format & 0xFF, (frameInterval.pixel_format >> 8) & 0xFF, + (frameInterval.pixel_format >> 16) & 0xFF, + (frameInterval.pixel_format >> 24) & 0xFF, frameInterval.width, + frameInterval.height, framerate); + format->frameRates.push_back(fr); + } + } + } + + if (format->frameRates.empty()) { + ALOGE("%s: failed to get supported frame rates for format:%c%c%c%c w %d h %d", __FUNCTION__, + frameInterval.pixel_format & 0xFF, (frameInterval.pixel_format >> 8) & 0xFF, + (frameInterval.pixel_format >> 16) & 0xFF, (frameInterval.pixel_format >> 24) & 0xFF, + frameInterval.width, frameInterval.height); + } +} + +void ExternalCameraDevice::updateFpsBounds( + int fd, CroppingType cropType, + const std::vector& fpsLimits, + SupportedV4L2Format format, std::vector& outFmts) { + double fpsUpperBound = -1.0; + for (const auto& limit : fpsLimits) { + if (cropType == VERTICAL) { + if (format.width <= limit.size.width) { + fpsUpperBound = limit.fpsUpperBound; + break; + } + } else { // HORIZONTAL + if (format.height <= limit.size.height) { + fpsUpperBound = limit.fpsUpperBound; + break; + } + } + } + if (fpsUpperBound < 0.f) { + return; + } + + getFrameRateList(fd, fpsUpperBound, &format); + if (!format.frameRates.empty()) { + outFmts.push_back(format); + } +} + +std::vector ExternalCameraDevice::getCandidateSupportedFormatsLocked( + int fd, CroppingType cropType, + const std::vector& fpsLimits, + const std::vector& depthFpsLimits, + const Size& minStreamSize, bool depthEnabled) { + std::vector outFmts; + struct v4l2_fmtdesc fmtdesc { + .index = 0, .type = V4L2_BUF_TYPE_VIDEO_CAPTURE + }; + int ret = 0; + while (ret == 0) { + ret = TEMP_FAILURE_RETRY(ioctl(fd, VIDIOC_ENUM_FMT, &fmtdesc)); + ALOGV("index:%d,ret:%d, format:%c%c%c%c", fmtdesc.index, ret, fmtdesc.pixelformat & 0xFF, + (fmtdesc.pixelformat >> 8) & 0xFF, (fmtdesc.pixelformat >> 16) & 0xFF, + (fmtdesc.pixelformat >> 24) & 0xFF); + + if (ret != 0 || (fmtdesc.flags & V4L2_FMT_FLAG_EMULATED)) { + // Skip if IOCTL failed, or if the format is emulated + fmtdesc.index++; + continue; + } + auto it = + std::find(kSupportedFourCCs.begin(), kSupportedFourCCs.end(), fmtdesc.pixelformat); + if (it == kSupportedFourCCs.end()) { + fmtdesc.index++; + continue; + } + + // Found supported format + v4l2_frmsizeenum frameSize{.index = 0, .pixel_format = fmtdesc.pixelformat}; + for (; TEMP_FAILURE_RETRY(ioctl(fd, VIDIOC_ENUM_FRAMESIZES, &frameSize)) == 0; + ++frameSize.index) { + if (frameSize.type == V4L2_FRMSIZE_TYPE_DISCRETE) { + ALOGV("index:%d, format:%c%c%c%c, w %d, h %d", frameSize.index, + fmtdesc.pixelformat & 0xFF, (fmtdesc.pixelformat >> 8) & 0xFF, + (fmtdesc.pixelformat >> 16) & 0xFF, (fmtdesc.pixelformat >> 24) & 0xFF, + frameSize.discrete.width, frameSize.discrete.height); + + // Disregard h > w formats so all aspect ratio (h/w) <= 1.0 + // This will simplify the crop/scaling logic down the road + if (frameSize.discrete.height > frameSize.discrete.width) { + continue; + } + + // Discard all formats which is smaller than minStreamSize + if (frameSize.discrete.width < minStreamSize.width || + frameSize.discrete.height < minStreamSize.height) { + continue; + } + + SupportedV4L2Format format{ + .width = static_cast(frameSize.discrete.width), + .height = static_cast(frameSize.discrete.height), + .fourcc = fmtdesc.pixelformat}; + + if (format.fourcc == V4L2_PIX_FMT_Z16 && depthEnabled) { + updateFpsBounds(fd, cropType, depthFpsLimits, format, outFmts); + } else { + updateFpsBounds(fd, cropType, fpsLimits, format, outFmts); + } + } + } + fmtdesc.index++; + } + trimSupportedFormats(cropType, &outFmts); + return outFmts; +} + +void ExternalCameraDevice::trimSupportedFormats(CroppingType cropType, + std::vector* pFmts) { + std::vector& sortedFmts = *pFmts; + if (cropType == VERTICAL) { + std::sort(sortedFmts.begin(), sortedFmts.end(), + [](const SupportedV4L2Format& a, const SupportedV4L2Format& b) -> bool { + if (a.width == b.width) { + return a.height < b.height; + } + return a.width < b.width; + }); + } else { + std::sort(sortedFmts.begin(), sortedFmts.end(), + [](const SupportedV4L2Format& a, const SupportedV4L2Format& b) -> bool { + if (a.height == b.height) { + return a.width < b.width; + } + return a.height < b.height; + }); + } + + if (sortedFmts.empty()) { + ALOGE("%s: input format list is empty!", __FUNCTION__); + return; + } + + const auto& maxSize = sortedFmts[sortedFmts.size() - 1]; + float maxSizeAr = ASPECT_RATIO(maxSize); + + // Remove formats that has aspect ratio not croppable from largest size + std::vector out; + for (const auto& fmt : sortedFmts) { + float ar = ASPECT_RATIO(fmt); + if (isAspectRatioClose(ar, maxSizeAr)) { + out.push_back(fmt); + } else if (cropType == HORIZONTAL && ar < maxSizeAr) { + out.push_back(fmt); + } else if (cropType == VERTICAL && ar > maxSizeAr) { + out.push_back(fmt); + } else { + ALOGV("%s: size (%d,%d) is removed due to unable to crop %s from (%d,%d)", __FUNCTION__, + fmt.width, fmt.height, cropType == VERTICAL ? "vertically" : "horizontally", + maxSize.width, maxSize.height); + } + } + sortedFmts = out; +} + +binder_status_t ExternalCameraDevice::dump(int fd, const char** args, uint32_t numArgs) { + std::shared_ptr session = mSession.lock(); + if (session == nullptr) { + dprintf(fd, "No active camera device session instance\n"); + return STATUS_OK; + } + + return session->dump(fd, args, numArgs); +} + +} // namespace implementation +} // namespace device +} // namespace camera +} // namespace hardware +} // namespace android \ No newline at end of file diff --git a/camera/device/default/ExternalCameraDevice.h b/camera/device/default/ExternalCameraDevice.h new file mode 100644 index 0000000000..bcae1945e9 --- /dev/null +++ b/camera/device/default/ExternalCameraDevice.h @@ -0,0 +1,191 @@ +/* + * 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. + */ + +#ifndef HARDWARE_INTERFACES_CAMERA_DEVICE_DEFAULT_EXTERNALCAMERADEVICE_H_ +#define HARDWARE_INTERFACES_CAMERA_DEVICE_DEFAULT_EXTERNALCAMERADEVICE_H_ + +#include +#include +#include + +namespace android { +namespace hardware { +namespace camera { +namespace device { +namespace implementation { + +using ::aidl::android::hardware::camera::common::CameraResourceCost; +using ::aidl::android::hardware::camera::device::BnCameraDevice; +using ::aidl::android::hardware::camera::device::CameraMetadata; +using ::aidl::android::hardware::camera::device::ICameraDeviceCallback; +using ::aidl::android::hardware::camera::device::ICameraDeviceSession; +using ::aidl::android::hardware::camera::device::ICameraInjectionSession; +using ::aidl::android::hardware::camera::device::StreamConfiguration; +using ::android::hardware::camera::external::common::ExternalCameraConfig; + +class ExternalCameraDevice : public BnCameraDevice { + public: + // Called by external camera provider HAL. + // Provider HAL must ensure the uniqueness of CameraDevice object per cameraId, or there could + // be multiple CameraDevice trying to access the same physical camera. Also, provider will have + // to keep track of all CameraDevice objects in order to notify CameraDevice when the underlying + // camera is detached. + ExternalCameraDevice(const std::string& devicePath, const ExternalCameraConfig& config); + ~ExternalCameraDevice() override; + + ndk::ScopedAStatus getCameraCharacteristics(CameraMetadata* _aidl_return) override; + ndk::ScopedAStatus getPhysicalCameraCharacteristics(const std::string& in_physicalCameraId, + CameraMetadata* _aidl_return) override; + ndk::ScopedAStatus getResourceCost(CameraResourceCost* _aidl_return) override; + ndk::ScopedAStatus isStreamCombinationSupported(const StreamConfiguration& in_streams, + bool* _aidl_return) override; + ndk::ScopedAStatus open(const std::shared_ptr& in_callback, + std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus openInjectionSession( + const std::shared_ptr& in_callback, + std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus setTorchMode(bool in_on) override; + ndk::ScopedAStatus turnOnTorchWithStrengthLevel(int32_t in_torchStrength) override; + ndk::ScopedAStatus getTorchStrengthLevel(int32_t* _aidl_return) override; + + binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; + + // Caller must use this method to check if CameraDevice ctor failed + bool isInitFailed(); + + // Device version to be used by the external camera provider. + // Should be of the form . + static std::string kDeviceVersion; + + private: + virtual std::shared_ptr createSession( + const std::shared_ptr&, const ExternalCameraConfig& cfg, + const std::vector& sortedFormats, const CroppingType& croppingType, + const common::V1_0::helper::CameraMetadata& chars, const std::string& cameraId, + unique_fd v4l2Fd); + + bool isInitFailedLocked(); + + // Init supported w/h/format/fps in mSupportedFormats. Caller still owns fd + void initSupportedFormatsLocked(int fd); + + // Calls into virtual member function. Do not use it in constructor + status_t initCameraCharacteristics(); + // Init available capabilities keys + virtual status_t initAvailableCapabilities( + ::android::hardware::camera::common::V1_0::helper::CameraMetadata*); + // Init non-device dependent keys + virtual status_t initDefaultCharsKeys( + ::android::hardware::camera::common::V1_0::helper::CameraMetadata*); + // Init camera control chars keys. Caller still owns fd + status_t initCameraControlsCharsKeys( + int fd, ::android::hardware::camera::common::V1_0::helper::CameraMetadata*); + // Init camera output configuration related keys. Caller still owns fd + status_t initOutputCharsKeys( + int fd, ::android::hardware::camera::common::V1_0::helper::CameraMetadata*); + + // Helper function for initOutputCharskeys + template + status_t initOutputCharsKeysByFormat( + ::android::hardware::camera::common::V1_0::helper::CameraMetadata* metadata, + uint32_t fourcc, const std::array& halFormats, int streamConfigTag, + int streamConfiguration, int minFrameDuration, int stallDuration); + + status_t calculateMinFps(::android::hardware::camera::common::V1_0::helper::CameraMetadata*); + + static void getFrameRateList(int fd, double fpsUpperBound, SupportedV4L2Format* format); + + static void updateFpsBounds(int fd, CroppingType cropType, + const std::vector& fpsLimits, + SupportedV4L2Format format, + std::vector& outFmts); + + // Get candidate supported formats list of input cropping type. + static std::vector getCandidateSupportedFormatsLocked( + int fd, CroppingType cropType, + const std::vector& fpsLimits, + const std::vector& depthFpsLimits, + const Size& minStreamSize, bool depthEnabled); + // Trim supported format list by the cropping type. Also sort output formats by width/height + static void trimSupportedFormats(CroppingType cropType, + /*inout*/ std::vector* pFmts); + + Mutex mLock; + bool mInitialized = false; + bool mInitFailed = false; + std::string mCameraId; + std::string mDevicePath; + const ExternalCameraConfig& mCfg; + std::vector mSupportedFormats; + CroppingType mCroppingType; + + std::weak_ptr mSession = + std::weak_ptr(); + + ::android::hardware::camera::common::V1_0::helper::CameraMetadata mCameraCharacteristics; + + const std::vector AVAILABLE_CHARACTERISTICS_KEYS = { + ANDROID_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES, + ANDROID_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES, + ANDROID_CONTROL_AE_AVAILABLE_MODES, + ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES, + ANDROID_CONTROL_AE_COMPENSATION_RANGE, + ANDROID_CONTROL_AE_COMPENSATION_STEP, + ANDROID_CONTROL_AE_LOCK_AVAILABLE, + ANDROID_CONTROL_AF_AVAILABLE_MODES, + ANDROID_CONTROL_AVAILABLE_EFFECTS, + ANDROID_CONTROL_AVAILABLE_MODES, + ANDROID_CONTROL_AVAILABLE_SCENE_MODES, + ANDROID_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES, + ANDROID_CONTROL_AWB_AVAILABLE_MODES, + ANDROID_CONTROL_AWB_LOCK_AVAILABLE, + ANDROID_CONTROL_MAX_REGIONS, + ANDROID_FLASH_INFO_AVAILABLE, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL, + ANDROID_JPEG_AVAILABLE_THUMBNAIL_SIZES, + ANDROID_LENS_FACING, + ANDROID_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION, + ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION, + ANDROID_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES, + ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS, + ANDROID_REQUEST_MAX_NUM_OUTPUT_STREAMS, + ANDROID_REQUEST_PARTIAL_RESULT_COUNT, + ANDROID_REQUEST_PIPELINE_MAX_DEPTH, + ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, + ANDROID_SCALER_CROPPING_TYPE, + ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE, + ANDROID_SENSOR_INFO_MAX_FRAME_DURATION, + ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE, + ANDROID_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE, + ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE, + ANDROID_SENSOR_ORIENTATION, + ANDROID_SHADING_AVAILABLE_MODES, + ANDROID_STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES, + ANDROID_STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES, + ANDROID_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES, + ANDROID_STATISTICS_INFO_MAX_FACE_COUNT, + ANDROID_SYNC_MAX_LATENCY}; +}; + +} // namespace implementation +} // namespace device +} // namespace camera +} // namespace hardware +} // namespace android + +#endif // HARDWARE_INTERFACES_CAMERA_DEVICE_DEFAULT_EXTERNALCAMERADEVICE_H_ diff --git a/camera/device/default/ExternalCameraDeviceSession.cpp b/camera/device/default/ExternalCameraDeviceSession.cpp new file mode 100644 index 0000000000..68c6d2eed3 --- /dev/null +++ b/camera/device/default/ExternalCameraDeviceSession.cpp @@ -0,0 +1,2947 @@ +/* + * 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. + */ + +#define LOG_TAG "ExtCamDevSsn" +// #define LOG_NDEBUG 0 +#include + +#include "ExternalCameraDeviceSession.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define HAVE_JPEG // required for libyuv.h to export MJPEG decode APIs +#include +#include + +namespace android { +namespace hardware { +namespace camera { +namespace device { +namespace implementation { + +namespace { + +// Size of request/result metadata fast message queue. Change to 0 to always use hwbinder buffer. +static constexpr size_t kMetadataMsgQueueSize = 1 << 18 /* 256kB */; + +const int kBadFramesAfterStreamOn = 1; // drop x frames after streamOn to get rid of some initial + // bad frames. TODO: develop a better bad frame detection + // method +constexpr int MAX_RETRY = 15; // Allow retry some ioctl failures a few times to account for some + // webcam showing temporarily ioctl failures. +constexpr int IOCTL_RETRY_SLEEP_US = 33000; // 33ms * MAX_RETRY = 0.5 seconds + +// Constants for tryLock during dumpstate +static constexpr int kDumpLockRetries = 50; +static constexpr int kDumpLockSleep = 60000; + +bool tryLock(Mutex& mutex) { + bool locked = false; + for (int i = 0; i < kDumpLockRetries; ++i) { + if (mutex.tryLock() == NO_ERROR) { + locked = true; + break; + } + usleep(kDumpLockSleep); + } + return locked; +} + +bool tryLock(std::mutex& mutex) { + bool locked = false; + for (int i = 0; i < kDumpLockRetries; ++i) { + if (mutex.try_lock()) { + locked = true; + break; + } + usleep(kDumpLockSleep); + } + return locked; +} + +} // anonymous namespace + +using ::aidl::android::hardware::camera::device::BufferRequestStatus; +using ::aidl::android::hardware::camera::device::CameraBlob; +using ::aidl::android::hardware::camera::device::CameraBlobId; +using ::aidl::android::hardware::camera::device::ErrorMsg; +using ::aidl::android::hardware::camera::device::ShutterMsg; +using ::aidl::android::hardware::camera::device::StreamBuffer; +using ::aidl::android::hardware::camera::device::StreamBufferRet; +using ::aidl::android::hardware::camera::device::StreamBuffersVal; +using ::aidl::android::hardware::camera::device::StreamConfigurationMode; +using ::aidl::android::hardware::camera::device::StreamRotation; +using ::aidl::android::hardware::camera::device::StreamType; +using ::aidl::android::hardware::graphics::common::Dataspace; +using ::android::hardware::camera::common::V1_0::helper::ExifUtils; + +// Static instances +const int ExternalCameraDeviceSession::kMaxProcessedStream; +const int ExternalCameraDeviceSession::kMaxStallStream; +HandleImporter ExternalCameraDeviceSession::sHandleImporter; + +ExternalCameraDeviceSession::ExternalCameraDeviceSession( + const std::shared_ptr& callback, const ExternalCameraConfig& cfg, + const std::vector& sortedFormats, const CroppingType& croppingType, + const common::V1_0::helper::CameraMetadata& chars, const std::string& cameraId, + unique_fd v4l2Fd) + : mCallback(callback), + mCfg(cfg), + mCameraCharacteristics(chars), + mSupportedFormats(sortedFormats), + mCroppingType(croppingType), + mCameraId(cameraId), + mV4l2Fd(std::move(v4l2Fd)), + mMaxThumbResolution(getMaxThumbResolution()), + mMaxJpegResolution(getMaxJpegResolution()) {} + +Size ExternalCameraDeviceSession::getMaxThumbResolution() const { + return getMaxThumbnailResolution(mCameraCharacteristics); +} + +Size ExternalCameraDeviceSession::getMaxJpegResolution() const { + Size ret{0, 0}; + for (auto& fmt : mSupportedFormats) { + if (fmt.width * fmt.height > ret.width * ret.height) { + ret = Size{fmt.width, fmt.height}; + } + } + return ret; +} + +bool ExternalCameraDeviceSession::initialize() { + if (mV4l2Fd.get() < 0) { + ALOGE("%s: invalid v4l2 device fd %d!", __FUNCTION__, mV4l2Fd.get()); + return true; + } + + struct v4l2_capability capability; + int ret = ioctl(mV4l2Fd.get(), VIDIOC_QUERYCAP, &capability); + std::string make, model; + if (ret < 0) { + ALOGW("%s v4l2 QUERYCAP failed", __FUNCTION__); + mExifMake = "Generic UVC webcam"; + mExifModel = "Generic UVC webcam"; + } else { + // capability.card is UTF-8 encoded + char card[32]; + int j = 0; + for (int i = 0; i < 32; i++) { + if (capability.card[i] < 128) { + card[j++] = capability.card[i]; + } + if (capability.card[i] == '\0') { + break; + } + } + if (j == 0 || card[j - 1] != '\0') { + mExifMake = "Generic UVC webcam"; + mExifModel = "Generic UVC webcam"; + } else { + mExifMake = card; + mExifModel = card; + } + } + + initOutputThread(); + if (mOutputThread == nullptr) { + ALOGE("%s: init OutputThread failed!", __FUNCTION__); + return true; + } + mOutputThread->setExifMakeModel(mExifMake, mExifModel); + + status_t status = initDefaultRequests(); + if (status != OK) { + ALOGE("%s: init default requests failed!", __FUNCTION__); + return true; + } + + mRequestMetadataQueue = + std::make_unique(kMetadataMsgQueueSize, false /* non blocking */); + if (!mRequestMetadataQueue->isValid()) { + ALOGE("%s: invalid request fmq", __FUNCTION__); + return true; + } + + mResultMetadataQueue = + std::make_shared(kMetadataMsgQueueSize, false /* non blocking */); + if (!mResultMetadataQueue->isValid()) { + ALOGE("%s: invalid result fmq", __FUNCTION__); + return true; + } + + mOutputThread->run(); + return false; +} + +bool ExternalCameraDeviceSession::isInitFailed() { + Mutex::Autolock _l(mLock); + if (!mInitialized) { + mInitFail = initialize(); + mInitialized = true; + } + return mInitFail; +} + +void ExternalCameraDeviceSession::initOutputThread() { + // Grab a shared_ptr to 'this' from ndk::SharedRefBase::ref() + std::shared_ptr thiz = ref(); + + if (mSupportBufMgr) { + mBufferRequestThread = std::make_shared(/*parent=*/thiz, mCallback); + mBufferRequestThread->run(); + } + mOutputThread = std::make_shared(/*parent=*/thiz, mCroppingType, + mCameraCharacteristics, mBufferRequestThread); +} + +void ExternalCameraDeviceSession::closeOutputThread() { + closeOutputThreadImpl(); +} + +void ExternalCameraDeviceSession::closeOutputThreadImpl() { + if (mOutputThread != nullptr) { + mOutputThread->flush(); + mOutputThread->requestExitAndWait(); + mOutputThread.reset(); + } +} + +Status ExternalCameraDeviceSession::initStatus() const { + Mutex::Autolock _l(mLock); + Status status = Status::OK; + if (mInitFail || mClosed) { + ALOGI("%s: session initFailed %d closed %d", __FUNCTION__, mInitFail, mClosed); + status = Status::INTERNAL_ERROR; + } + return status; +} + +ExternalCameraDeviceSession::~ExternalCameraDeviceSession() { + if (!isClosed()) { + ALOGE("ExternalCameraDeviceSession deleted before close!"); + close(/*callerIsDtor*/ true); + } +} + +ScopedAStatus ExternalCameraDeviceSession::constructDefaultRequestSettings( + RequestTemplate in_type, CameraMetadata* _aidl_return) { + CameraMetadata emptyMetadata; + Status status = initStatus(); + if (status != Status::OK) { + return fromStatus(status); + } + switch (in_type) { + case RequestTemplate::PREVIEW: + case RequestTemplate::STILL_CAPTURE: + case RequestTemplate::VIDEO_RECORD: + case RequestTemplate::VIDEO_SNAPSHOT: { + *_aidl_return = mDefaultRequests[in_type]; + break; + } + case RequestTemplate::MANUAL: + case RequestTemplate::ZERO_SHUTTER_LAG: + // Don't support MANUAL, ZSL templates + status = Status::ILLEGAL_ARGUMENT; + break; + default: + ALOGE("%s: unknown request template type %d", __FUNCTION__, static_cast(in_type)); + status = Status::ILLEGAL_ARGUMENT; + break; + } + return fromStatus(status); +} + +ScopedAStatus ExternalCameraDeviceSession::configureStreams( + const StreamConfiguration& in_requestedConfiguration, + std::vector* _aidl_return) { + uint32_t blobBufferSize = 0; + _aidl_return->clear(); + Mutex::Autolock _il(mInterfaceLock); + + Status status = + isStreamCombinationSupported(in_requestedConfiguration, mSupportedFormats, mCfg); + if (status != Status::OK) { + return fromStatus(status); + } + + status = initStatus(); + if (status != Status::OK) { + return fromStatus(status); + } + + { + std::lock_guard lk(mInflightFramesLock); + if (!mInflightFrames.empty()) { + ALOGE("%s: trying to configureStreams while there are still %zu inflight frames!", + __FUNCTION__, mInflightFrames.size()); + return fromStatus(Status::INTERNAL_ERROR); + } + } + + Mutex::Autolock _l(mLock); + { + Mutex::Autolock _cl(mCbsLock); + // Add new streams + for (const auto& stream : in_requestedConfiguration.streams) { + if (mStreamMap.count(stream.id) == 0) { + mStreamMap[stream.id] = stream; + mCirculatingBuffers.emplace(stream.id, CirculatingBuffers{}); + } + } + + // Cleanup removed streams + for (auto it = mStreamMap.begin(); it != mStreamMap.end();) { + int id = it->first; + bool found = false; + for (const auto& stream : in_requestedConfiguration.streams) { + if (id == stream.id) { + found = true; + break; + } + } + if (!found) { + // Unmap all buffers of deleted stream + cleanupBuffersLocked(id); + it = mStreamMap.erase(it); + } else { + ++it; + } + } + } + + // Now select a V4L2 format to produce all output streams + float desiredAr = (mCroppingType == VERTICAL) ? kMaxAspectRatio : kMinAspectRatio; + uint32_t maxDim = 0; + for (const auto& stream : in_requestedConfiguration.streams) { + float aspectRatio = ASPECT_RATIO(stream); + ALOGI("%s: request stream %dx%d", __FUNCTION__, stream.width, stream.height); + if ((mCroppingType == VERTICAL && aspectRatio < desiredAr) || + (mCroppingType == HORIZONTAL && aspectRatio > desiredAr)) { + desiredAr = aspectRatio; + } + + // The dimension that's not cropped + uint32_t dim = (mCroppingType == VERTICAL) ? stream.width : stream.height; + if (dim > maxDim) { + maxDim = dim; + } + } + + // Find the smallest format that matches the desired aspect ratio and is wide/high enough + SupportedV4L2Format v4l2Fmt{.width = 0, .height = 0}; + for (const auto& fmt : mSupportedFormats) { + uint32_t dim = (mCroppingType == VERTICAL) ? fmt.width : fmt.height; + if (dim >= maxDim) { + float aspectRatio = ASPECT_RATIO(fmt); + if (isAspectRatioClose(aspectRatio, desiredAr)) { + v4l2Fmt = fmt; + // since mSupportedFormats is sorted by width then height, the first matching fmt + // will be the smallest one with matching aspect ratio + break; + } + } + } + + if (v4l2Fmt.width == 0) { + // Cannot find exact good aspect ratio candidate, try to find a close one + for (const auto& fmt : mSupportedFormats) { + uint32_t dim = (mCroppingType == VERTICAL) ? fmt.width : fmt.height; + if (dim >= maxDim) { + float aspectRatio = ASPECT_RATIO(fmt); + if ((mCroppingType == VERTICAL && aspectRatio < desiredAr) || + (mCroppingType == HORIZONTAL && aspectRatio > desiredAr)) { + v4l2Fmt = fmt; + break; + } + } + } + } + + if (v4l2Fmt.width == 0) { + ALOGE("%s: unable to find a resolution matching (%s at least %d, aspect ratio %f)", + __FUNCTION__, (mCroppingType == VERTICAL) ? "width" : "height", maxDim, desiredAr); + return fromStatus(Status::ILLEGAL_ARGUMENT); + } + + if (configureV4l2StreamLocked(v4l2Fmt) != 0) { + ALOGE("V4L configuration failed!, format:%c%c%c%c, w %d, h %d", v4l2Fmt.fourcc & 0xFF, + (v4l2Fmt.fourcc >> 8) & 0xFF, (v4l2Fmt.fourcc >> 16) & 0xFF, + (v4l2Fmt.fourcc >> 24) & 0xFF, v4l2Fmt.width, v4l2Fmt.height); + return fromStatus(Status::INTERNAL_ERROR); + } + + Size v4lSize = {v4l2Fmt.width, v4l2Fmt.height}; + Size thumbSize{0, 0}; + camera_metadata_ro_entry entry = + mCameraCharacteristics.find(ANDROID_JPEG_AVAILABLE_THUMBNAIL_SIZES); + for (uint32_t i = 0; i < entry.count; i += 2) { + Size sz{entry.data.i32[i], entry.data.i32[i + 1]}; + if (sz.width * sz.height > thumbSize.width * thumbSize.height) { + thumbSize = sz; + } + } + + if (thumbSize.width * thumbSize.height == 0) { + ALOGE("%s: non-zero thumbnail size not available", __FUNCTION__); + return fromStatus(Status::INTERNAL_ERROR); + } + + mBlobBufferSize = blobBufferSize; + status = mOutputThread->allocateIntermediateBuffers( + v4lSize, mMaxThumbResolution, in_requestedConfiguration.streams, blobBufferSize); + if (status != Status::OK) { + ALOGE("%s: allocating intermediate buffers failed!", __FUNCTION__); + return fromStatus(status); + } + + std::vector& out = *_aidl_return; + out.resize(in_requestedConfiguration.streams.size()); + for (size_t i = 0; i < in_requestedConfiguration.streams.size(); i++) { + out[i].overrideDataSpace = in_requestedConfiguration.streams[i].dataSpace; + out[i].id = in_requestedConfiguration.streams[i].id; + // TODO: double check should we add those CAMERA flags + mStreamMap[in_requestedConfiguration.streams[i].id].usage = out[i].producerUsage = + static_cast(((int64_t)in_requestedConfiguration.streams[i].usage) | + ((int64_t)BufferUsage::CPU_WRITE_OFTEN) | + ((int64_t)BufferUsage::CAMERA_OUTPUT)); + out[i].consumerUsage = static_cast(0); + out[i].maxBuffers = static_cast(mV4L2BufferCount); + + switch (in_requestedConfiguration.streams[i].format) { + case PixelFormat::BLOB: + case PixelFormat::YCBCR_420_888: + case PixelFormat::YV12: // Used by SurfaceTexture + case PixelFormat::Y16: + // No override + out[i].overrideFormat = in_requestedConfiguration.streams[i].format; + break; + case PixelFormat::IMPLEMENTATION_DEFINED: + // Implementation Defined + // This should look at the Stream's dataspace flag to determine the format or leave + // it as is if the rest of the system knows how to handle a private format. To keep + // this HAL generic, this is being overridden to YUV420 + out[i].overrideFormat = PixelFormat::YCBCR_420_888; + // Save overridden format in mStreamMap + mStreamMap[in_requestedConfiguration.streams[i].id].format = out[i].overrideFormat; + break; + default: + ALOGE("%s: unsupported format 0x%x", __FUNCTION__, + in_requestedConfiguration.streams[i].format); + return fromStatus(Status::ILLEGAL_ARGUMENT); + } + } + + mFirstRequest = true; + mLastStreamConfigCounter = in_requestedConfiguration.streamConfigCounter; + return fromStatus(Status::OK); +} + +ScopedAStatus ExternalCameraDeviceSession::flush() { + ATRACE_CALL(); + Mutex::Autolock _il(mInterfaceLock); + Status status = initStatus(); + if (status != Status::OK) { + return fromStatus(status); + } + mOutputThread->flush(); + return fromStatus(Status::OK); +} + +ScopedAStatus ExternalCameraDeviceSession::getCaptureRequestMetadataQueue( + MQDescriptor* _aidl_return) { + Mutex::Autolock _il(mInterfaceLock); + *_aidl_return = mRequestMetadataQueue->dupeDesc(); + return fromStatus(Status::OK); +} + +ScopedAStatus ExternalCameraDeviceSession::getCaptureResultMetadataQueue( + MQDescriptor* _aidl_return) { + Mutex::Autolock _il(mInterfaceLock); + *_aidl_return = mResultMetadataQueue->dupeDesc(); + return fromStatus(Status::OK); +} + +ScopedAStatus ExternalCameraDeviceSession::isReconfigurationRequired( + const CameraMetadata& in_oldSessionParams, const CameraMetadata& in_newSessionParams, + bool* _aidl_return) { + // reconfiguration required if there is any change in the session params + *_aidl_return = in_oldSessionParams != in_newSessionParams; + return fromStatus(Status::OK); +} + +ScopedAStatus ExternalCameraDeviceSession::processCaptureRequest( + const std::vector& in_requests, + const std::vector& in_cachesToRemove, int32_t* _aidl_return) { + Mutex::Autolock _il(mInterfaceLock); + updateBufferCaches(in_cachesToRemove); + + int32_t& numRequestProcessed = *_aidl_return; + numRequestProcessed = 0; + Status s = Status::OK; + for (size_t i = 0; i < in_requests.size(); i++, numRequestProcessed++) { + s = processOneCaptureRequest(in_requests[i]); + if (s != Status::OK) { + break; + } + } + + return fromStatus(s); +} + +Status ExternalCameraDeviceSession::processOneCaptureRequest(const CaptureRequest& request) { + ATRACE_CALL(); + Status status = initStatus(); + if (status != Status::OK) { + return status; + } + + if (request.inputBuffer.streamId != -1) { + ALOGE("%s: external camera does not support reprocessing!", __FUNCTION__); + return Status::ILLEGAL_ARGUMENT; + } + + Mutex::Autolock _l(mLock); + if (!mV4l2Streaming) { + ALOGE("%s: cannot process request in streamOff state!", __FUNCTION__); + return Status::INTERNAL_ERROR; + } + + const camera_metadata_t* rawSettings = nullptr; + bool converted; + CameraMetadata settingsFmq; // settings from FMQ + + if (request.fmqSettingsSize > 0) { + // non-blocking read; client must write metadata before calling + // processOneCaptureRequest + settingsFmq.metadata.resize(request.fmqSettingsSize); + bool read = mRequestMetadataQueue->read( + reinterpret_cast(settingsFmq.metadata.data()), request.fmqSettingsSize); + if (read) { + converted = convertFromAidl(settingsFmq, &rawSettings); + } else { + ALOGE("%s: capture request settings metadata couldn't be read from fmq!", __FUNCTION__); + converted = false; + } + } else { + converted = convertFromAidl(request.settings, &rawSettings); + } + + if (converted && rawSettings != nullptr) { + mLatestReqSetting = rawSettings; + } + + if (!converted) { + ALOGE("%s: capture request settings metadata is corrupt!", __FUNCTION__); + return Status::ILLEGAL_ARGUMENT; + } + + if (mFirstRequest && rawSettings == nullptr) { + ALOGE("%s: capture request settings must not be null for first request!", __FUNCTION__); + return Status::ILLEGAL_ARGUMENT; + } + + std::vector allBufPtrs; + std::vector allFences; + size_t numOutputBufs = request.outputBuffers.size(); + + if (numOutputBufs == 0) { + ALOGE("%s: capture request must have at least one output buffer!", __FUNCTION__); + return Status::ILLEGAL_ARGUMENT; + } + + camera_metadata_entry fpsRange = mLatestReqSetting.find(ANDROID_CONTROL_AE_TARGET_FPS_RANGE); + if (fpsRange.count == 2) { + double requestFpsMax = fpsRange.data.i32[1]; + double closestFps = 0.0; + double fpsError = 1000.0; + bool fpsSupported = false; + for (const auto& fr : mV4l2StreamingFmt.frameRates) { + double f = fr.getFramesPerSecond(); + if (std::fabs(requestFpsMax - f) < 1.0) { + fpsSupported = true; + break; + } + if (std::fabs(requestFpsMax - f) < fpsError) { + fpsError = std::fabs(requestFpsMax - f); + closestFps = f; + } + } + if (!fpsSupported) { + /* This can happen in a few scenarios: + * 1. The application is sending an FPS range not supported by the configured outputs. + * 2. The application is sending a valid FPS range for all configured outputs, but + * the selected V4L2 size can only run at slower speed. This should be very rare + * though: for this to happen a sensor needs to support at least 3 different aspect + * ratio outputs, and when (at least) two outputs are both not the main aspect ratio + * of the webcam, a third size that's larger might be picked and runs into this + * issue. + */ + ALOGW("%s: cannot reach fps %d! Will do %f instead", __FUNCTION__, fpsRange.data.i32[1], + closestFps); + requestFpsMax = closestFps; + } + + if (requestFpsMax != mV4l2StreamingFps) { + { + std::unique_lock lk(mV4l2BufferLock); + while (mNumDequeuedV4l2Buffers != 0) { + // Wait until pipeline is idle before reconfigure stream + int waitRet = waitForV4L2BufferReturnLocked(lk); + if (waitRet != 0) { + ALOGE("%s: wait for pipeline idle failed!", __FUNCTION__); + return Status::INTERNAL_ERROR; + } + } + } + configureV4l2StreamLocked(mV4l2StreamingFmt, requestFpsMax); + } + } + + status = importRequestLocked(request, allBufPtrs, allFences); + if (status != Status::OK) { + return status; + } + + nsecs_t shutterTs = 0; + std::unique_ptr frameIn = dequeueV4l2FrameLocked(&shutterTs); + if (frameIn == nullptr) { + ALOGE("%s: V4L2 deque frame failed!", __FUNCTION__); + return Status::INTERNAL_ERROR; + } + + std::shared_ptr halReq = std::make_shared(); + halReq->frameNumber = request.frameNumber; + halReq->setting = mLatestReqSetting; + halReq->frameIn = std::move(frameIn); + halReq->shutterTs = shutterTs; + halReq->buffers.resize(numOutputBufs); + for (size_t i = 0; i < numOutputBufs; i++) { + HalStreamBuffer& halBuf = halReq->buffers[i]; + int streamId = halBuf.streamId = request.outputBuffers[i].streamId; + halBuf.bufferId = request.outputBuffers[i].bufferId; + const Stream& stream = mStreamMap[streamId]; + halBuf.width = stream.width; + halBuf.height = stream.height; + halBuf.format = stream.format; + halBuf.usage = stream.usage; + halBuf.bufPtr = allBufPtrs[i]; + halBuf.acquireFence = allFences[i]; + halBuf.fenceTimeout = false; + } + { + std::lock_guard lk(mInflightFramesLock); + mInflightFrames.insert(halReq->frameNumber); + } + // Send request to OutputThread for the rest of processing + mOutputThread->submitRequest(halReq); + mFirstRequest = false; + return Status::OK; +} + +ScopedAStatus ExternalCameraDeviceSession::signalStreamFlush( + const std::vector& /*in_streamIds*/, int32_t in_streamConfigCounter) { + { + Mutex::Autolock _l(mLock); + if (in_streamConfigCounter < mLastStreamConfigCounter) { + // stale call. new streams have been configured since this call was issued. + // Do nothing. + return fromStatus(Status::OK); + } + } + + // TODO: implement if needed. + return fromStatus(Status::OK); +} + +ScopedAStatus ExternalCameraDeviceSession::switchToOffline( + const std::vector& in_streamsToKeep, + CameraOfflineSessionInfo* out_offlineSessionInfo, + std::shared_ptr* _aidl_return) { + std::vector msgs; + std::vector results; + CameraOfflineSessionInfo info; + std::shared_ptr session; + Status st = switchToOffline(in_streamsToKeep, &msgs, &results, &info, &session); + + mCallback->notify(msgs); + invokeProcessCaptureResultCallback(results, /* tryWriteFmq= */ true); + freeReleaseFences(results); + + // setup return values + *out_offlineSessionInfo = info; + *_aidl_return = session; + return fromStatus(st); +} + +Status ExternalCameraDeviceSession::switchToOffline( + const std::vector& offlineStreams, std::vector* msgs, + std::vector* results, CameraOfflineSessionInfo* info, + std::shared_ptr* session) { + ATRACE_CALL(); + if (offlineStreams.size() > 1) { + ALOGE("%s: more than one offline stream is not supported", __FUNCTION__); + return Status::ILLEGAL_ARGUMENT; + } + + if (info == nullptr || results == nullptr || info == nullptr || session == nullptr) { + ALOGE("%s, output arguments (%p, %p, %p, %p) much not be null", __FUNCTION__, msgs, results, + info, session); + } + + Mutex::Autolock _il(mInterfaceLock); + Status status = initStatus(); + if (status != Status::OK) { + return status; + } + + Mutex::Autolock _l(mLock); + for (auto streamId : offlineStreams) { + if (!supportOfflineLocked(streamId)) { + return Status::ILLEGAL_ARGUMENT; + } + } + + // pause output thread and get all remaining inflight requests + auto remainingReqs = mOutputThread->switchToOffline(); + std::vector> halReqs; + + // Send out buffer/request error for remaining requests and filter requests + // to be handled in offline mode + for (auto& halReq : remainingReqs) { + bool dropReq = canDropRequest(offlineStreams, halReq); + if (dropReq) { + // Request is dropped completely. Just send request error and + // there is no need to send the request to offline session + processCaptureRequestError(halReq, msgs, results); + continue; + } + + // All requests reach here must have at least one offline stream output + NotifyMsg shutter; + aidl::android::hardware::camera::device::ShutterMsg shutterMsg = { + .frameNumber = static_cast(halReq->frameNumber), + .timestamp = halReq->shutterTs}; + shutter.set(shutterMsg); + msgs->push_back(shutter); + + std::vector offlineBuffers; + for (const auto& buffer : halReq->buffers) { + bool dropBuffer = true; + for (auto offlineStreamId : offlineStreams) { + if (buffer.streamId == offlineStreamId) { + dropBuffer = false; + break; + } + } + if (dropBuffer) { + aidl::android::hardware::camera::device::ErrorMsg errorMsg = { + .frameNumber = static_cast(halReq->frameNumber), + .errorStreamId = buffer.streamId, + .errorCode = ErrorCode::ERROR_BUFFER}; + + NotifyMsg error; + error.set(errorMsg); + msgs->push_back(error); + + results->push_back({ + .frameNumber = static_cast(halReq->frameNumber), + .outputBuffers = {}, + .inputBuffer = {.streamId = -1}, + .partialResult = 0, // buffer only result + }); + + CaptureResult& result = results->back(); + result.outputBuffers.resize(1); + StreamBuffer& outputBuffer = result.outputBuffers[0]; + outputBuffer.streamId = buffer.streamId; + outputBuffer.bufferId = buffer.bufferId; + outputBuffer.status = BufferStatus::ERROR; + if (buffer.acquireFence >= 0) { + native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0); + handle->data[0] = buffer.acquireFence; + outputBuffer.releaseFence = android::makeToAidl(handle); + } + } else { + offlineBuffers.push_back(buffer); + } + } + halReq->buffers = offlineBuffers; + halReqs.push_back(halReq); + } + + // convert hal requests to offline request + std::deque> offlineReqs(halReqs.size()); + size_t i = 0; + for (auto& v4lReq : halReqs) { + offlineReqs[i] = std::make_shared(); + offlineReqs[i]->frameNumber = v4lReq->frameNumber; + offlineReqs[i]->setting = v4lReq->setting; + offlineReqs[i]->shutterTs = v4lReq->shutterTs; + offlineReqs[i]->buffers = v4lReq->buffers; + std::shared_ptr v4l2Frame(static_cast(v4lReq->frameIn.get())); + offlineReqs[i]->frameIn = std::make_shared(v4l2Frame); + i++; + // enqueue V4L2 frame + enqueueV4l2Frame(v4l2Frame); + } + + // Collect buffer caches/streams + std::vector streamInfos(offlineStreams.size()); + std::map circulatingBuffers; + { + Mutex::Autolock _cbsl(mCbsLock); + for (auto streamId : offlineStreams) { + circulatingBuffers[streamId] = mCirculatingBuffers.at(streamId); + mCirculatingBuffers.erase(streamId); + streamInfos.push_back(mStreamMap.at(streamId)); + mStreamMap.erase(streamId); + } + } + + fillOfflineSessionInfo(offlineStreams, offlineReqs, circulatingBuffers, info); + // create the offline session object + bool afTrigger; + { + std::lock_guard _lk(mAfTriggerLock); + afTrigger = mAfTrigger; + } + + std::shared_ptr sessionImpl = + ndk::SharedRefBase::make( + mCroppingType, mCameraCharacteristics, mCameraId, mExifMake, mExifModel, + mBlobBufferSize, afTrigger, streamInfos, offlineReqs, circulatingBuffers); + + bool initFailed = sessionImpl->initialize(); + if (initFailed) { + ALOGE("%s: offline session initialize failed!", __FUNCTION__); + return Status::INTERNAL_ERROR; + } + + // cleanup stream and buffer caches + { + Mutex::Autolock _cbsl(mCbsLock); + for (auto pair : mStreamMap) { + cleanupBuffersLocked(/*Stream ID*/ pair.first); + } + mCirculatingBuffers.clear(); + } + mStreamMap.clear(); + + // update inflight records + { + std::lock_guard _lk(mInflightFramesLock); + mInflightFrames.clear(); + } + + // stop v4l2 streaming + if (v4l2StreamOffLocked() != 0) { + ALOGE("%s: stop V4L2 streaming failed!", __FUNCTION__); + return Status::INTERNAL_ERROR; + } + + // No need to return session if there is no offline requests left + if (!offlineReqs.empty()) { + *session = sessionImpl; + } else { + *session = nullptr; + } + + return Status::OK; +} + +#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) +#define UPDATE(md, tag, data, size) \ + do { \ + if ((md).update((tag), (data), (size))) { \ + ALOGE("Update " #tag " failed!"); \ + return BAD_VALUE; \ + } \ + } while (0) + +status_t ExternalCameraDeviceSession::initDefaultRequests() { + common::V1_0::helper::CameraMetadata md; + + const uint8_t aberrationMode = ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF; + UPDATE(md, ANDROID_COLOR_CORRECTION_ABERRATION_MODE, &aberrationMode, 1); + + const int32_t exposureCompensation = 0; + UPDATE(md, ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION, &exposureCompensation, 1); + + const uint8_t videoStabilizationMode = ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_OFF; + UPDATE(md, ANDROID_CONTROL_VIDEO_STABILIZATION_MODE, &videoStabilizationMode, 1); + + const uint8_t awbMode = ANDROID_CONTROL_AWB_MODE_AUTO; + UPDATE(md, ANDROID_CONTROL_AWB_MODE, &awbMode, 1); + + const uint8_t aeMode = ANDROID_CONTROL_AE_MODE_ON; + UPDATE(md, ANDROID_CONTROL_AE_MODE, &aeMode, 1); + + const uint8_t aePrecaptureTrigger = ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE; + UPDATE(md, ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER, &aePrecaptureTrigger, 1); + + const uint8_t afMode = ANDROID_CONTROL_AF_MODE_AUTO; + UPDATE(md, ANDROID_CONTROL_AF_MODE, &afMode, 1); + + const uint8_t afTrigger = ANDROID_CONTROL_AF_TRIGGER_IDLE; + UPDATE(md, ANDROID_CONTROL_AF_TRIGGER, &afTrigger, 1); + + const uint8_t sceneMode = ANDROID_CONTROL_SCENE_MODE_DISABLED; + UPDATE(md, ANDROID_CONTROL_SCENE_MODE, &sceneMode, 1); + + const uint8_t effectMode = ANDROID_CONTROL_EFFECT_MODE_OFF; + UPDATE(md, ANDROID_CONTROL_EFFECT_MODE, &effectMode, 1); + + const uint8_t flashMode = ANDROID_FLASH_MODE_OFF; + UPDATE(md, ANDROID_FLASH_MODE, &flashMode, 1); + + const int32_t thumbnailSize[] = {240, 180}; + UPDATE(md, ANDROID_JPEG_THUMBNAIL_SIZE, thumbnailSize, 2); + + const uint8_t jpegQuality = 90; + UPDATE(md, ANDROID_JPEG_QUALITY, &jpegQuality, 1); + UPDATE(md, ANDROID_JPEG_THUMBNAIL_QUALITY, &jpegQuality, 1); + + const int32_t jpegOrientation = 0; + UPDATE(md, ANDROID_JPEG_ORIENTATION, &jpegOrientation, 1); + + const uint8_t oisMode = ANDROID_LENS_OPTICAL_STABILIZATION_MODE_OFF; + UPDATE(md, ANDROID_LENS_OPTICAL_STABILIZATION_MODE, &oisMode, 1); + + const uint8_t nrMode = ANDROID_NOISE_REDUCTION_MODE_OFF; + UPDATE(md, ANDROID_NOISE_REDUCTION_MODE, &nrMode, 1); + + const int32_t testPatternModes = ANDROID_SENSOR_TEST_PATTERN_MODE_OFF; + UPDATE(md, ANDROID_SENSOR_TEST_PATTERN_MODE, &testPatternModes, 1); + + const uint8_t fdMode = ANDROID_STATISTICS_FACE_DETECT_MODE_OFF; + UPDATE(md, ANDROID_STATISTICS_FACE_DETECT_MODE, &fdMode, 1); + + const uint8_t hotpixelMode = ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE_OFF; + UPDATE(md, ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE, &hotpixelMode, 1); + + bool support30Fps = false; + int32_t maxFps = std::numeric_limits::min(); + for (const auto& supportedFormat : mSupportedFormats) { + for (const auto& fr : supportedFormat.frameRates) { + int32_t framerateInt = static_cast(fr.getFramesPerSecond()); + if (maxFps < framerateInt) { + maxFps = framerateInt; + } + if (framerateInt == 30) { + support30Fps = true; + break; + } + } + if (support30Fps) { + break; + } + } + + int32_t defaultFramerate = support30Fps ? 30 : maxFps; + int32_t defaultFpsRange[] = {defaultFramerate / 2, defaultFramerate}; + UPDATE(md, ANDROID_CONTROL_AE_TARGET_FPS_RANGE, defaultFpsRange, ARRAY_SIZE(defaultFpsRange)); + + uint8_t antibandingMode = ANDROID_CONTROL_AE_ANTIBANDING_MODE_AUTO; + UPDATE(md, ANDROID_CONTROL_AE_ANTIBANDING_MODE, &antibandingMode, 1); + + const uint8_t controlMode = ANDROID_CONTROL_MODE_AUTO; + UPDATE(md, ANDROID_CONTROL_MODE, &controlMode, 1); + + for (const auto& type : ndk::enum_range()) { + common::V1_0::helper::CameraMetadata mdCopy = md; + uint8_t intent = ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW; + switch (type) { + case RequestTemplate::PREVIEW: + intent = ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW; + break; + case RequestTemplate::STILL_CAPTURE: + intent = ANDROID_CONTROL_CAPTURE_INTENT_STILL_CAPTURE; + break; + case RequestTemplate::VIDEO_RECORD: + intent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_RECORD; + break; + case RequestTemplate::VIDEO_SNAPSHOT: + intent = ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT; + break; + default: + ALOGV("%s: unsupported RequestTemplate type %d", __FUNCTION__, type); + continue; + } + UPDATE(mdCopy, ANDROID_CONTROL_CAPTURE_INTENT, &intent, 1); + camera_metadata_t* mdPtr = mdCopy.release(); + uint8_t* rawMd = reinterpret_cast(mdPtr); + CameraMetadata aidlMd; + aidlMd.metadata.assign(rawMd, rawMd + get_camera_metadata_size(mdPtr)); + mDefaultRequests[type] = aidlMd; + free_camera_metadata(mdPtr); + } + return OK; +} + +status_t ExternalCameraDeviceSession::fillCaptureResult(common::V1_0::helper::CameraMetadata& md, + nsecs_t timestamp) { + bool afTrigger = false; + { + std::lock_guard lk(mAfTriggerLock); + afTrigger = mAfTrigger; + if (md.exists(ANDROID_CONTROL_AF_TRIGGER)) { + camera_metadata_entry entry = md.find(ANDROID_CONTROL_AF_TRIGGER); + if (entry.data.u8[0] == ANDROID_CONTROL_AF_TRIGGER_START) { + mAfTrigger = afTrigger = true; + } else if (entry.data.u8[0] == ANDROID_CONTROL_AF_TRIGGER_CANCEL) { + mAfTrigger = afTrigger = false; + } + } + } + + // For USB camera, the USB camera handles everything and we don't have control + // over AF. We only simply fake the AF metadata based on the request + // received here. + uint8_t afState; + if (afTrigger) { + afState = ANDROID_CONTROL_AF_STATE_FOCUSED_LOCKED; + } else { + afState = ANDROID_CONTROL_AF_STATE_INACTIVE; + } + UPDATE(md, ANDROID_CONTROL_AF_STATE, &afState, 1); + + camera_metadata_ro_entry activeArraySize = + mCameraCharacteristics.find(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE); + + return fillCaptureResultCommon(md, timestamp, activeArraySize); +} + +int ExternalCameraDeviceSession::configureV4l2StreamLocked(const SupportedV4L2Format& v4l2Fmt, + double requestFps) { + ATRACE_CALL(); + int ret = v4l2StreamOffLocked(); + if (ret != OK) { + ALOGE("%s: stop v4l2 streaming failed: ret %d", __FUNCTION__, ret); + return ret; + } + + // VIDIOC_S_FMT w/h/fmt + v4l2_format fmt; + fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + fmt.fmt.pix.width = v4l2Fmt.width; + fmt.fmt.pix.height = v4l2Fmt.height; + fmt.fmt.pix.pixelformat = v4l2Fmt.fourcc; + + { + int numAttempt = 0; + do { + ret = TEMP_FAILURE_RETRY(ioctl(mV4l2Fd.get(), VIDIOC_S_FMT, &fmt)); + if (numAttempt == MAX_RETRY) { + break; + } + numAttempt++; + if (ret < 0) { + ALOGW("%s: VIDIOC_S_FMT failed, wait 33ms and try again", __FUNCTION__); + usleep(IOCTL_RETRY_SLEEP_US); // sleep and try again + } + } while (ret < 0); + if (ret < 0) { + ALOGE("%s: S_FMT ioctl failed: %s", __FUNCTION__, strerror(errno)); + return -errno; + } + } + + if (v4l2Fmt.width != fmt.fmt.pix.width || v4l2Fmt.height != fmt.fmt.pix.height || + v4l2Fmt.fourcc != fmt.fmt.pix.pixelformat) { + ALOGE("%s: S_FMT expect %c%c%c%c %dx%d, got %c%c%c%c %dx%d instead!", __FUNCTION__, + v4l2Fmt.fourcc & 0xFF, (v4l2Fmt.fourcc >> 8) & 0xFF, (v4l2Fmt.fourcc >> 16) & 0xFF, + (v4l2Fmt.fourcc >> 24) & 0xFF, v4l2Fmt.width, v4l2Fmt.height, + fmt.fmt.pix.pixelformat & 0xFF, (fmt.fmt.pix.pixelformat >> 8) & 0xFF, + (fmt.fmt.pix.pixelformat >> 16) & 0xFF, (fmt.fmt.pix.pixelformat >> 24) & 0xFF, + fmt.fmt.pix.width, fmt.fmt.pix.height); + return -EINVAL; + } + + uint32_t bufferSize = fmt.fmt.pix.sizeimage; + ALOGI("%s: V4L2 buffer size is %d", __FUNCTION__, bufferSize); + uint32_t expectedMaxBufferSize = kMaxBytesPerPixel * fmt.fmt.pix.width * fmt.fmt.pix.height; + if ((bufferSize == 0) || (bufferSize > expectedMaxBufferSize)) { + ALOGE("%s: V4L2 buffer size: %u looks invalid. Expected maximum size: %u", __FUNCTION__, + bufferSize, expectedMaxBufferSize); + return -EINVAL; + } + mMaxV4L2BufferSize = bufferSize; + + const double kDefaultFps = 30.0; + double fps = std::numeric_limits::max(); + if (requestFps != 0.0) { + fps = requestFps; + } else { + double maxFps = -1.0; + // Try to pick the slowest fps that is at least 30 + for (const auto& fr : v4l2Fmt.frameRates) { + double f = fr.getFramesPerSecond(); + if (maxFps < f) { + maxFps = f; + } + if (f >= kDefaultFps && f < fps) { + fps = f; + } + } + // No fps > 30 found, use the highest fps available within supported formats. + if (fps == std::numeric_limits::max()) { + fps = maxFps; + } + } + + int fpsRet = setV4l2FpsLocked(fps); + if (fpsRet != 0 && fpsRet != -EINVAL) { + ALOGE("%s: set fps failed: %s", __FUNCTION__, strerror(fpsRet)); + return fpsRet; + } + + uint32_t v4lBufferCount = (fps >= kDefaultFps) ? mCfg.numVideoBuffers : mCfg.numStillBuffers; + + // VIDIOC_REQBUFS: create buffers + v4l2_requestbuffers req_buffers{}; + req_buffers.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + req_buffers.memory = V4L2_MEMORY_MMAP; + req_buffers.count = v4lBufferCount; + if (TEMP_FAILURE_RETRY(ioctl(mV4l2Fd.get(), VIDIOC_REQBUFS, &req_buffers)) < 0) { + ALOGE("%s: VIDIOC_REQBUFS failed: %s", __FUNCTION__, strerror(errno)); + return -errno; + } + + // Driver can indeed return more buffer if it needs more to operate + if (req_buffers.count < v4lBufferCount) { + ALOGE("%s: VIDIOC_REQBUFS expected %d buffers, got %d instead", __FUNCTION__, + v4lBufferCount, req_buffers.count); + return NO_MEMORY; + } + + // VIDIOC_QUERYBUF: get buffer offset in the V4L2 fd + // VIDIOC_QBUF: send buffer to driver + mV4L2BufferCount = req_buffers.count; + for (uint32_t i = 0; i < req_buffers.count; i++) { + v4l2_buffer buffer = { + .index = i, .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, .memory = V4L2_MEMORY_MMAP}; + + if (TEMP_FAILURE_RETRY(ioctl(mV4l2Fd.get(), VIDIOC_QUERYBUF, &buffer)) < 0) { + ALOGE("%s: QUERYBUF %d failed: %s", __FUNCTION__, i, strerror(errno)); + return -errno; + } + + if (TEMP_FAILURE_RETRY(ioctl(mV4l2Fd.get(), VIDIOC_QBUF, &buffer)) < 0) { + ALOGE("%s: QBUF %d failed: %s", __FUNCTION__, i, strerror(errno)); + return -errno; + } + } + + { + // VIDIOC_STREAMON: start streaming + v4l2_buf_type capture_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + int numAttempt = 0; + do { + ret = TEMP_FAILURE_RETRY(ioctl(mV4l2Fd.get(), VIDIOC_STREAMON, &capture_type)); + if (numAttempt == MAX_RETRY) { + break; + } + if (ret < 0) { + ALOGW("%s: VIDIOC_STREAMON failed, wait 33ms and try again", __FUNCTION__); + usleep(IOCTL_RETRY_SLEEP_US); // sleep 100 ms and try again + } + } while (ret < 0); + + if (ret < 0) { + ALOGE("%s: VIDIOC_STREAMON ioctl failed: %s", __FUNCTION__, strerror(errno)); + return -errno; + } + } + + // Swallow first few frames after streamOn to account for bad frames from some devices + for (int i = 0; i < kBadFramesAfterStreamOn; i++) { + v4l2_buffer buffer{}; + buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + buffer.memory = V4L2_MEMORY_MMAP; + if (TEMP_FAILURE_RETRY(ioctl(mV4l2Fd.get(), VIDIOC_DQBUF, &buffer)) < 0) { + ALOGE("%s: DQBUF fails: %s", __FUNCTION__, strerror(errno)); + return -errno; + } + + if (TEMP_FAILURE_RETRY(ioctl(mV4l2Fd.get(), VIDIOC_QBUF, &buffer)) < 0) { + ALOGE("%s: QBUF index %d fails: %s", __FUNCTION__, buffer.index, strerror(errno)); + return -errno; + } + } + + ALOGI("%s: start V4L2 streaming %dx%d@%ffps", __FUNCTION__, v4l2Fmt.width, v4l2Fmt.height, fps); + mV4l2StreamingFmt = v4l2Fmt; + mV4l2Streaming = true; + return OK; +} + +std::unique_ptr ExternalCameraDeviceSession::dequeueV4l2FrameLocked(nsecs_t* shutterTs) { + ATRACE_CALL(); + std::unique_ptr ret = nullptr; + if (shutterTs == nullptr) { + ALOGE("%s: shutterTs must not be null!", __FUNCTION__); + return ret; + } + + { + std::unique_lock lk(mV4l2BufferLock); + if (mNumDequeuedV4l2Buffers == mV4L2BufferCount) { + int waitRet = waitForV4L2BufferReturnLocked(lk); + if (waitRet != 0) { + return ret; + } + } + } + + ATRACE_BEGIN("VIDIOC_DQBUF"); + v4l2_buffer buffer{}; + buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + buffer.memory = V4L2_MEMORY_MMAP; + if (TEMP_FAILURE_RETRY(ioctl(mV4l2Fd.get(), VIDIOC_DQBUF, &buffer)) < 0) { + ALOGE("%s: DQBUF fails: %s", __FUNCTION__, strerror(errno)); + return ret; + } + ATRACE_END(); + + if (buffer.index >= mV4L2BufferCount) { + ALOGE("%s: Invalid buffer id: %d", __FUNCTION__, buffer.index); + return ret; + } + + if (buffer.flags & V4L2_BUF_FLAG_ERROR) { + ALOGE("%s: v4l2 buf error! buf flag 0x%x", __FUNCTION__, buffer.flags); + // TODO: try to dequeue again + } + + if (buffer.bytesused > mMaxV4L2BufferSize) { + ALOGE("%s: v4l2 buffer bytes used: %u maximum %u", __FUNCTION__, buffer.bytesused, + mMaxV4L2BufferSize); + return ret; + } + + if (buffer.flags & V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC) { + // Ideally we should also check for V4L2_BUF_FLAG_TSTAMP_SRC_SOE, but + // even V4L2_BUF_FLAG_TSTAMP_SRC_EOF is better than capture a timestamp now + *shutterTs = static_cast(buffer.timestamp.tv_sec) * 1000000000LL + + buffer.timestamp.tv_usec * 1000LL; + } else { + *shutterTs = systemTime(SYSTEM_TIME_MONOTONIC); + } + + { + std::lock_guard lk(mV4l2BufferLock); + mNumDequeuedV4l2Buffers++; + } + + return std::make_unique(mV4l2StreamingFmt.width, mV4l2StreamingFmt.height, + mV4l2StreamingFmt.fourcc, buffer.index, mV4l2Fd.get(), + buffer.bytesused, buffer.m.offset); +} + +void ExternalCameraDeviceSession::enqueueV4l2Frame(const std::shared_ptr& frame) { + ATRACE_CALL(); + frame->unmap(); + ATRACE_BEGIN("VIDIOC_QBUF"); + v4l2_buffer buffer{}; + buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + buffer.memory = V4L2_MEMORY_MMAP; + buffer.index = frame->mBufferIndex; + if (TEMP_FAILURE_RETRY(ioctl(mV4l2Fd.get(), VIDIOC_QBUF, &buffer)) < 0) { + ALOGE("%s: QBUF index %d fails: %s", __FUNCTION__, frame->mBufferIndex, strerror(errno)); + return; + } + ATRACE_END(); + + { + std::lock_guard lk(mV4l2BufferLock); + mNumDequeuedV4l2Buffers--; + } + mV4L2BufferReturned.notify_one(); +} + +bool ExternalCameraDeviceSession::isSupported( + const Stream& stream, const std::vector& supportedFormats, + const ExternalCameraConfig& devCfg) { + Dataspace ds = stream.dataSpace; + PixelFormat fmt = stream.format; + uint32_t width = stream.width; + uint32_t height = stream.height; + // TODO: check usage flags + + if (stream.streamType != StreamType::OUTPUT) { + ALOGE("%s: does not support non-output stream type", __FUNCTION__); + return false; + } + + if (stream.rotation != StreamRotation::ROTATION_0) { + ALOGE("%s: does not support stream rotation", __FUNCTION__); + return false; + } + + switch (fmt) { + case PixelFormat::BLOB: + if (ds != Dataspace::JFIF) { + ALOGI("%s: BLOB format does not support dataSpace %x", __FUNCTION__, ds); + return false; + } + break; + case PixelFormat::IMPLEMENTATION_DEFINED: + case PixelFormat::YCBCR_420_888: + case PixelFormat::YV12: + // TODO: check what dataspace we can support here. + // intentional no-ops. + break; + case PixelFormat::Y16: + if (!devCfg.depthEnabled) { + ALOGI("%s: Depth is not Enabled", __FUNCTION__); + return false; + } + if (!(static_cast(ds) & static_cast(Dataspace::DEPTH))) { + ALOGI("%s: Y16 supports only dataSpace DEPTH", __FUNCTION__); + return false; + } + break; + default: + ALOGI("%s: does not support format %x", __FUNCTION__, fmt); + return false; + } + + // Assume we can convert any V4L2 format to any of supported output format for now, i.e. + // ignoring v4l2Fmt.fourcc for now. Might need more subtle check if we support more v4l format + // in the futrue. + for (const auto& v4l2Fmt : supportedFormats) { + if (width == v4l2Fmt.width && height == v4l2Fmt.height) { + return true; + } + } + ALOGI("%s: resolution %dx%d is not supported", __FUNCTION__, width, height); + return false; +} + +Status ExternalCameraDeviceSession::importRequestLocked(const CaptureRequest& request, + std::vector& allBufPtrs, + std::vector& allFences) { + return importRequestLockedImpl(request, allBufPtrs, allFences); +} + +Status ExternalCameraDeviceSession::importRequestLockedImpl( + const CaptureRequest& request, std::vector& allBufPtrs, + std::vector& allFences) { + size_t numOutputBufs = request.outputBuffers.size(); + size_t numBufs = numOutputBufs; + // Validate all I/O buffers + std::vector allBufs; + std::vector allBufIds; + allBufs.resize(numBufs); + allBufIds.resize(numBufs); + allBufPtrs.resize(numBufs); + allFences.resize(numBufs); + std::vector streamIds(numBufs); + + for (size_t i = 0; i < numOutputBufs; i++) { + allBufs[i] = ::android::makeFromAidl(request.outputBuffers[i].buffer); + allBufIds[i] = request.outputBuffers[i].bufferId; + allBufPtrs[i] = &allBufs[i]; + streamIds[i] = request.outputBuffers[i].streamId; + } + + { + Mutex::Autolock _l(mCbsLock); + for (size_t i = 0; i < numBufs; i++) { + Status st = importBufferLocked(streamIds[i], allBufIds[i], allBufs[i], &allBufPtrs[i]); + if (st != Status::OK) { + // Detailed error logs printed in importBuffer + return st; + } + } + } + + // All buffers are imported. Now validate output buffer acquire fences + for (size_t i = 0; i < numOutputBufs; i++) { + if (!sHandleImporter.importFence( + ::android::makeFromAidl(request.outputBuffers[i].acquireFence), allFences[i])) { + ALOGE("%s: output buffer %zu acquire fence is invalid", __FUNCTION__, i); + cleanupInflightFences(allFences, i); + return Status::INTERNAL_ERROR; + } + } + return Status::OK; +} + +Status ExternalCameraDeviceSession::importBuffer(int32_t streamId, uint64_t bufId, + buffer_handle_t buf, + /*out*/ buffer_handle_t** outBufPtr) { + Mutex::Autolock _l(mCbsLock); + return importBufferLocked(streamId, bufId, buf, outBufPtr); +} + +Status ExternalCameraDeviceSession::importBufferLocked(int32_t streamId, uint64_t bufId, + buffer_handle_t buf, + buffer_handle_t** outBufPtr) { + return importBufferImpl(mCirculatingBuffers, sHandleImporter, streamId, bufId, buf, outBufPtr); +} + +ScopedAStatus ExternalCameraDeviceSession::close() { + close(false); + return fromStatus(Status::OK); +} + +void ExternalCameraDeviceSession::close(bool callerIsDtor) { + Mutex::Autolock _il(mInterfaceLock); + bool closed = isClosed(); + if (!closed) { + if (callerIsDtor) { + closeOutputThreadImpl(); + } else { + closeOutputThread(); + } + + Mutex::Autolock _l(mLock); + // free all buffers + { + Mutex::Autolock _cbsl(mCbsLock); + for (auto pair : mStreamMap) { + cleanupBuffersLocked(/*Stream ID*/ pair.first); + } + } + v4l2StreamOffLocked(); + ALOGV("%s: closing V4L2 camera FD %d", __FUNCTION__, mV4l2Fd.get()); + mV4l2Fd.reset(); + mClosed = true; + } +} + +bool ExternalCameraDeviceSession::isClosed() { + Mutex::Autolock _l(mLock); + return mClosed; +} + +ScopedAStatus ExternalCameraDeviceSession::repeatingRequestEnd( + int32_t /*in_frameNumber*/, const std::vector& /*in_streamIds*/) { + // TODO: Figure this one out. + return fromStatus(Status::OK); +} + +int ExternalCameraDeviceSession::v4l2StreamOffLocked() { + if (!mV4l2Streaming) { + return OK; + } + + { + std::lock_guard lk(mV4l2BufferLock); + if (mNumDequeuedV4l2Buffers != 0) { + ALOGE("%s: there are %zu inflight V4L buffers", __FUNCTION__, mNumDequeuedV4l2Buffers); + return -1; + } + } + mV4L2BufferCount = 0; + + // VIDIOC_STREAMOFF + v4l2_buf_type capture_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + if (TEMP_FAILURE_RETRY(ioctl(mV4l2Fd.get(), VIDIOC_STREAMOFF, &capture_type)) < 0) { + ALOGE("%s: STREAMOFF failed: %s", __FUNCTION__, strerror(errno)); + return -errno; + } + + // VIDIOC_REQBUFS: clear buffers + v4l2_requestbuffers req_buffers{}; + req_buffers.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + req_buffers.memory = V4L2_MEMORY_MMAP; + req_buffers.count = 0; + if (TEMP_FAILURE_RETRY(ioctl(mV4l2Fd.get(), VIDIOC_REQBUFS, &req_buffers)) < 0) { + ALOGE("%s: REQBUFS failed: %s", __FUNCTION__, strerror(errno)); + return -errno; + } + + mV4l2Streaming = false; + return OK; +} + +int ExternalCameraDeviceSession::setV4l2FpsLocked(double fps) { + // VIDIOC_G_PARM/VIDIOC_S_PARM: set fps + v4l2_streamparm streamparm = {.type = V4L2_BUF_TYPE_VIDEO_CAPTURE}; + // The following line checks that the driver knows about framerate get/set. + int ret = TEMP_FAILURE_RETRY(ioctl(mV4l2Fd.get(), VIDIOC_G_PARM, &streamparm)); + if (ret != 0) { + if (errno == -EINVAL) { + ALOGW("%s: device does not support VIDIOC_G_PARM", __FUNCTION__); + } + return -errno; + } + // Now check if the device is able to accept a capture framerate set. + if (!(streamparm.parm.capture.capability & V4L2_CAP_TIMEPERFRAME)) { + ALOGW("%s: device does not support V4L2_CAP_TIMEPERFRAME", __FUNCTION__); + return -EINVAL; + } + + // fps is float, approximate by a fraction. + const int kFrameRatePrecision = 10000; + streamparm.parm.capture.timeperframe.numerator = kFrameRatePrecision; + streamparm.parm.capture.timeperframe.denominator = (fps * kFrameRatePrecision); + + if (TEMP_FAILURE_RETRY(ioctl(mV4l2Fd.get(), VIDIOC_S_PARM, &streamparm)) < 0) { + ALOGE("%s: failed to set framerate to %f: %s", __FUNCTION__, fps, strerror(errno)); + return -1; + } + + double retFps = streamparm.parm.capture.timeperframe.denominator / + static_cast(streamparm.parm.capture.timeperframe.numerator); + if (std::fabs(fps - retFps) > 1.0) { + ALOGE("%s: expect fps %f, got %f instead", __FUNCTION__, fps, retFps); + return -1; + } + mV4l2StreamingFps = fps; + return 0; +} + +void ExternalCameraDeviceSession::cleanupInflightFences(std::vector& allFences, + size_t numFences) { + for (size_t j = 0; j < numFences; j++) { + sHandleImporter.closeFence(allFences[j]); + } +} + +void ExternalCameraDeviceSession::cleanupBuffersLocked(int id) { + for (auto& pair : mCirculatingBuffers.at(id)) { + sHandleImporter.freeBuffer(pair.second); + } + mCirculatingBuffers[id].clear(); + mCirculatingBuffers.erase(id); +} + +void ExternalCameraDeviceSession::notifyShutter(int32_t frameNumber, nsecs_t shutterTs) { + NotifyMsg msg; + msg.set(ShutterMsg{ + .frameNumber = frameNumber, + .timestamp = shutterTs, + }); + mCallback->notify({msg}); +} +void ExternalCameraDeviceSession::notifyError(int32_t frameNumber, int32_t streamId, ErrorCode ec) { + NotifyMsg msg; + msg.set(ErrorMsg{ + .frameNumber = frameNumber, + .errorStreamId = streamId, + .errorCode = ec, + }); + mCallback->notify({msg}); +} + +void ExternalCameraDeviceSession::invokeProcessCaptureResultCallback( + std::vector& results, bool tryWriteFmq) { + if (mProcessCaptureResultLock.tryLock() != OK) { + const nsecs_t NS_TO_SECOND = 1000000000; + ALOGV("%s: previous call is not finished! waiting 1s...", __FUNCTION__); + if (mProcessCaptureResultLock.timedLock(/* 1s */ NS_TO_SECOND) != OK) { + ALOGE("%s: cannot acquire lock in 1s, cannot proceed", __FUNCTION__); + return; + } + } + if (tryWriteFmq && mResultMetadataQueue->availableToWrite() > 0) { + for (CaptureResult& result : results) { + CameraMetadata& md = result.result; + if (!md.metadata.empty()) { + if (mResultMetadataQueue->write(reinterpret_cast(md.metadata.data()), + md.metadata.size())) { + result.fmqResultSize = md.metadata.size(); + md.metadata.resize(0); + } else { + ALOGW("%s: couldn't utilize fmq, fall back to hwbinder", __FUNCTION__); + result.fmqResultSize = 0; + } + } else { + result.fmqResultSize = 0; + } + } + } + auto status = mCallback->processCaptureResult(results); + if (!status.isOk()) { + ALOGE("%s: processCaptureResult ERROR : %d:%d", __FUNCTION__, status.getExceptionCode(), + status.getServiceSpecificError()); + } + + mProcessCaptureResultLock.unlock(); +} + +int ExternalCameraDeviceSession::waitForV4L2BufferReturnLocked(std::unique_lock& lk) { + ATRACE_CALL(); + auto timeout = std::chrono::seconds(kBufferWaitTimeoutSec); + mLock.unlock(); + auto st = mV4L2BufferReturned.wait_for(lk, timeout); + // Here we introduce an order where mV4l2BufferLock is acquired before mLock, while + // the normal lock acquisition order is reversed. This is fine because in most of + // cases we are protected by mInterfaceLock. The only thread that can cause deadlock + // is the OutputThread, where we do need to make sure we don't acquire mLock then + // mV4l2BufferLock + mLock.lock(); + if (st == std::cv_status::timeout) { + ALOGE("%s: wait for V4L2 buffer return timeout!", __FUNCTION__); + return -1; + } + return 0; +} + +bool ExternalCameraDeviceSession::supportOfflineLocked(int32_t streamId) { + const Stream& stream = mStreamMap[streamId]; + if (stream.format == PixelFormat::BLOB && + static_cast(stream.dataSpace) == static_cast(Dataspace::JFIF)) { + return true; + } + // TODO: support YUV output stream? + return false; +} + +bool ExternalCameraDeviceSession::canDropRequest(const std::vector& offlineStreams, + std::shared_ptr halReq) { + for (const auto& buffer : halReq->buffers) { + for (auto offlineStreamId : offlineStreams) { + if (buffer.streamId == offlineStreamId) { + return false; + } + } + } + // Only drop a request completely if it has no offline output + return true; +} + +void ExternalCameraDeviceSession::fillOfflineSessionInfo( + const std::vector& offlineStreams, + std::deque>& offlineReqs, + const std::map& circulatingBuffers, + CameraOfflineSessionInfo* info) { + if (info == nullptr) { + ALOGE("%s: output info must not be null!", __FUNCTION__); + return; + } + + info->offlineStreams.resize(offlineStreams.size()); + info->offlineRequests.resize(offlineReqs.size()); + + // Fill in offline reqs and count outstanding buffers + for (size_t i = 0; i < offlineReqs.size(); i++) { + info->offlineRequests[i].frameNumber = offlineReqs[i]->frameNumber; + info->offlineRequests[i].pendingStreams.resize(offlineReqs[i]->buffers.size()); + for (size_t bIdx = 0; bIdx < offlineReqs[i]->buffers.size(); bIdx++) { + int32_t streamId = offlineReqs[i]->buffers[bIdx].streamId; + info->offlineRequests[i].pendingStreams[bIdx] = streamId; + } + } + + for (size_t i = 0; i < offlineStreams.size(); i++) { + int32_t streamId = offlineStreams[i]; + info->offlineStreams[i].id = streamId; + // outstanding buffers are 0 since we are doing hal buffer management and + // offline session will ask for those buffers later + info->offlineStreams[i].numOutstandingBuffers = 0; + const CirculatingBuffers& bufIdMap = circulatingBuffers.at(streamId); + info->offlineStreams[i].circulatingBufferIds.resize(bufIdMap.size()); + size_t bIdx = 0; + for (const auto& pair : bufIdMap) { + // Fill in bufferId + info->offlineStreams[i].circulatingBufferIds[bIdx++] = pair.first; + } + } +} + +Status ExternalCameraDeviceSession::isStreamCombinationSupported( + const StreamConfiguration& config, const std::vector& supportedFormats, + const ExternalCameraConfig& devCfg) { + if (config.operationMode != StreamConfigurationMode::NORMAL_MODE) { + ALOGE("%s: unsupported operation mode: %d", __FUNCTION__, config.operationMode); + return Status::ILLEGAL_ARGUMENT; + } + + if (config.streams.size() == 0) { + ALOGE("%s: cannot configure zero stream", __FUNCTION__); + return Status::ILLEGAL_ARGUMENT; + } + + int numProcessedStream = 0; + int numStallStream = 0; + for (const auto& stream : config.streams) { + // Check if the format/width/height combo is supported + if (!isSupported(stream, supportedFormats, devCfg)) { + return Status::ILLEGAL_ARGUMENT; + } + if (stream.format == PixelFormat::BLOB) { + numStallStream++; + } else { + numProcessedStream++; + } + } + + if (numProcessedStream > kMaxProcessedStream) { + ALOGE("%s: too many processed streams (expect <= %d, got %d)", __FUNCTION__, + kMaxProcessedStream, numProcessedStream); + return Status::ILLEGAL_ARGUMENT; + } + + if (numStallStream > kMaxStallStream) { + ALOGE("%s: too many stall streams (expect <= %d, got %d)", __FUNCTION__, kMaxStallStream, + numStallStream); + return Status::ILLEGAL_ARGUMENT; + } + + return Status::OK; +} +void ExternalCameraDeviceSession::updateBufferCaches( + const std::vector& cachesToRemove) { + Mutex::Autolock _l(mCbsLock); + for (auto& cache : cachesToRemove) { + auto cbsIt = mCirculatingBuffers.find(cache.streamId); + if (cbsIt == mCirculatingBuffers.end()) { + // The stream could have been removed + continue; + } + CirculatingBuffers& cbs = cbsIt->second; + auto it = cbs.find(cache.bufferId); + if (it != cbs.end()) { + sHandleImporter.freeBuffer(it->second); + cbs.erase(it); + } else { + ALOGE("%s: stream %d buffer %" PRIu64 " is not cached", __FUNCTION__, cache.streamId, + cache.bufferId); + } + } +} + +Status ExternalCameraDeviceSession::processCaptureRequestError( + const std::shared_ptr& req, std::vector* outMsgs, + std::vector* outResults) { + ATRACE_CALL(); + // Return V4L2 buffer to V4L2 buffer queue + std::shared_ptr v4l2Frame = std::static_pointer_cast(req->frameIn); + enqueueV4l2Frame(v4l2Frame); + + if (outMsgs == nullptr) { + notifyShutter(req->frameNumber, req->shutterTs); + notifyError(/*frameNum*/ req->frameNumber, /*stream*/ -1, ErrorCode::ERROR_REQUEST); + } else { + NotifyMsg shutter; + shutter.set( + ShutterMsg{.frameNumber = req->frameNumber, .timestamp = req->shutterTs}); + + NotifyMsg error; + error.set(ErrorMsg{.frameNumber = req->frameNumber, + .errorStreamId = -1, + .errorCode = ErrorCode::ERROR_REQUEST}); + outMsgs->push_back(shutter); + outMsgs->push_back(error); + } + + // Fill output buffers + CaptureResult result; + result.frameNumber = req->frameNumber; + result.partialResult = 1; + result.inputBuffer.streamId = -1; + result.outputBuffers.resize(req->buffers.size()); + for (size_t i = 0; i < req->buffers.size(); i++) { + result.outputBuffers[i].streamId = req->buffers[i].streamId; + result.outputBuffers[i].bufferId = req->buffers[i].bufferId; + result.outputBuffers[i].status = BufferStatus::ERROR; + if (req->buffers[i].acquireFence >= 0) { + native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0); + handle->data[0] = req->buffers[i].acquireFence; + result.outputBuffers[i].releaseFence = ::android::makeToAidl(handle); + } + } + + // update inflight records + { + std::lock_guard lk(mInflightFramesLock); + mInflightFrames.erase(req->frameNumber); + } + + if (outResults == nullptr) { + // Callback into framework + std::vector results(1); + results[0] = std::move(result); + invokeProcessCaptureResultCallback(results, /* tryWriteFmq */ true); + freeReleaseFences(results); + } else { + outResults->push_back(std::move(result)); + } + return Status::OK; +} + +Status ExternalCameraDeviceSession::processCaptureResult(std::shared_ptr& req) { + ATRACE_CALL(); + // Return V4L2 buffer to V4L2 buffer queue + std::shared_ptr v4l2Frame = std::static_pointer_cast(req->frameIn); + enqueueV4l2Frame(v4l2Frame); + + // NotifyShutter + notifyShutter(req->frameNumber, req->shutterTs); + + // Fill output buffers; + std::vector results(1); + CaptureResult& result = results[0]; + result.frameNumber = req->frameNumber; + result.partialResult = 1; + result.inputBuffer.streamId = -1; + result.outputBuffers.resize(req->buffers.size()); + for (size_t i = 0; i < req->buffers.size(); i++) { + result.outputBuffers[i].streamId = req->buffers[i].streamId; + result.outputBuffers[i].bufferId = req->buffers[i].bufferId; + if (req->buffers[i].fenceTimeout) { + result.outputBuffers[i].status = BufferStatus::ERROR; + if (req->buffers[i].acquireFence >= 0) { + native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0); + handle->data[0] = req->buffers[i].acquireFence; + result.outputBuffers[i].releaseFence = ::android::makeToAidl(handle); + } + notifyError(req->frameNumber, req->buffers[i].streamId, ErrorCode::ERROR_BUFFER); + } else { + result.outputBuffers[i].status = BufferStatus::OK; + // TODO: refactor + if (req->buffers[i].acquireFence >= 0) { + native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0); + handle->data[0] = req->buffers[i].acquireFence; + result.outputBuffers[i].releaseFence = ::android::makeToAidl(handle); + } + } + } + + // Fill capture result metadata + fillCaptureResult(req->setting, req->shutterTs); + const camera_metadata_t* rawResult = req->setting.getAndLock(); + convertToAidl(rawResult, &result.result); + req->setting.unlock(rawResult); + + // update inflight records + { + std::lock_guard lk(mInflightFramesLock); + mInflightFrames.erase(req->frameNumber); + } + + // Callback into framework + invokeProcessCaptureResultCallback(results, /* tryWriteFmq */ true); + freeReleaseFences(results); + return Status::OK; +} + +ssize_t ExternalCameraDeviceSession::getJpegBufferSize(int32_t width, int32_t height) const { + // Constant from camera3.h + const ssize_t kMinJpegBufferSize = 256 * 1024 + sizeof(CameraBlob); + // Get max jpeg size (area-wise). + if (mMaxJpegResolution.width == 0) { + ALOGE("%s: No supported JPEG stream", __FUNCTION__); + return BAD_VALUE; + } + + // Get max jpeg buffer size + ssize_t maxJpegBufferSize = 0; + camera_metadata_ro_entry jpegBufMaxSize = mCameraCharacteristics.find(ANDROID_JPEG_MAX_SIZE); + if (jpegBufMaxSize.count == 0) { + ALOGE("%s: Can't find maximum JPEG size in static metadata!", __FUNCTION__); + return BAD_VALUE; + } + maxJpegBufferSize = jpegBufMaxSize.data.i32[0]; + + if (maxJpegBufferSize <= kMinJpegBufferSize) { + ALOGE("%s: ANDROID_JPEG_MAX_SIZE (%zd) <= kMinJpegBufferSize (%zd)", __FUNCTION__, + maxJpegBufferSize, kMinJpegBufferSize); + return BAD_VALUE; + } + + // Calculate final jpeg buffer size for the given resolution. + float scaleFactor = + ((float)(width * height)) / (mMaxJpegResolution.width * mMaxJpegResolution.height); + ssize_t jpegBufferSize = + scaleFactor * (maxJpegBufferSize - kMinJpegBufferSize) + kMinJpegBufferSize; + if (jpegBufferSize > maxJpegBufferSize) { + jpegBufferSize = maxJpegBufferSize; + } + + return jpegBufferSize; +} +binder_status_t ExternalCameraDeviceSession::dump(int fd, const char** /*args*/, + uint32_t /*numArgs*/) { + bool intfLocked = tryLock(mInterfaceLock); + if (!intfLocked) { + dprintf(fd, "!! ExternalCameraDeviceSession interface may be deadlocked !!\n"); + } + + if (isClosed()) { + dprintf(fd, "External camera %s is closed\n", mCameraId.c_str()); + return STATUS_OK; + } + + bool streaming = false; + size_t v4L2BufferCount = 0; + SupportedV4L2Format streamingFmt; + { + bool sessionLocked = tryLock(mLock); + if (!sessionLocked) { + dprintf(fd, "!! ExternalCameraDeviceSession mLock may be deadlocked !!\n"); + } + streaming = mV4l2Streaming; + streamingFmt = mV4l2StreamingFmt; + v4L2BufferCount = mV4L2BufferCount; + + if (sessionLocked) { + mLock.unlock(); + } + } + + std::unordered_set inflightFrames; + { + bool iffLocked = tryLock(mInflightFramesLock); + if (!iffLocked) { + dprintf(fd, + "!! ExternalCameraDeviceSession mInflightFramesLock may be deadlocked !!\n"); + } + inflightFrames = mInflightFrames; + if (iffLocked) { + mInflightFramesLock.unlock(); + } + } + + dprintf(fd, "External camera %s V4L2 FD %d, cropping type %s, %s\n", mCameraId.c_str(), + mV4l2Fd.get(), (mCroppingType == VERTICAL) ? "vertical" : "horizontal", + streaming ? "streaming" : "not streaming"); + + if (streaming) { + // TODO: dump fps later + dprintf(fd, "Current V4L2 format %c%c%c%c %dx%d @ %ffps\n", streamingFmt.fourcc & 0xFF, + (streamingFmt.fourcc >> 8) & 0xFF, (streamingFmt.fourcc >> 16) & 0xFF, + (streamingFmt.fourcc >> 24) & 0xFF, streamingFmt.width, streamingFmt.height, + mV4l2StreamingFps); + + size_t numDequeuedV4l2Buffers = 0; + { + std::lock_guard lk(mV4l2BufferLock); + numDequeuedV4l2Buffers = mNumDequeuedV4l2Buffers; + } + dprintf(fd, "V4L2 buffer queue size %zu, dequeued %zu\n", v4L2BufferCount, + numDequeuedV4l2Buffers); + } + + dprintf(fd, "In-flight frames (not sorted):"); + for (const auto& frameNumber : inflightFrames) { + dprintf(fd, "%d, ", frameNumber); + } + dprintf(fd, "\n"); + mOutputThread->dump(fd); + dprintf(fd, "\n"); + + if (intfLocked) { + mInterfaceLock.unlock(); + } + + return STATUS_OK; +} + +// Start ExternalCameraDeviceSession::BufferRequestThread functions +ExternalCameraDeviceSession::BufferRequestThread::BufferRequestThread( + std::weak_ptr parent, + std::shared_ptr callbacks) + : mParent(parent), mCallbacks(callbacks) {} + +int ExternalCameraDeviceSession::BufferRequestThread::requestBufferStart( + const std::vector& bufReqs) { + if (bufReqs.empty()) { + ALOGE("%s: bufReqs is empty!", __FUNCTION__); + return -1; + } + + { + std::lock_guard lk(mLock); + if (mRequestingBuffer) { + ALOGE("%s: BufferRequestThread does not support more than one concurrent request!", + __FUNCTION__); + return -1; + } + + mBufferReqs = bufReqs; + mRequestingBuffer = true; + } + mRequestCond.notify_one(); + return 0; +} + +int ExternalCameraDeviceSession::BufferRequestThread::waitForBufferRequestDone( + std::vector* outBufReqs) { + std::unique_lock lk(mLock); + if (!mRequestingBuffer) { + ALOGE("%s: no pending buffer request!", __FUNCTION__); + return -1; + } + + if (mPendingReturnBufferReqs.empty()) { + std::chrono::milliseconds timeout = std::chrono::milliseconds(kReqProcTimeoutMs); + auto st = mRequestDoneCond.wait_for(lk, timeout); + if (st == std::cv_status::timeout) { + ALOGE("%s: wait for buffer request finish timeout!", __FUNCTION__); + return -1; + } + } + mRequestingBuffer = false; + *outBufReqs = std::move(mPendingReturnBufferReqs); + mPendingReturnBufferReqs.clear(); + return 0; +} + +void ExternalCameraDeviceSession::BufferRequestThread::waitForNextRequest() { + ATRACE_CALL(); + std::unique_lock lk(mLock); + int waitTimes = 0; + while (mBufferReqs.empty()) { + if (exitPending()) { + return; + } + auto timeout = std::chrono::milliseconds(kReqWaitTimeoutMs); + auto st = mRequestCond.wait_for(lk, timeout); + if (st == std::cv_status::timeout) { + waitTimes++; + if (waitTimes == kReqWaitTimesWarn) { + // BufferRequestThread just wait forever for new buffer request + // But it will print some periodic warning indicating it's waiting + ALOGV("%s: still waiting for new buffer request", __FUNCTION__); + waitTimes = 0; + } + } + } + + // Fill in BufferRequest + mHalBufferReqs.resize(mBufferReqs.size()); + for (size_t i = 0; i < mHalBufferReqs.size(); i++) { + mHalBufferReqs[i].streamId = mBufferReqs[i].streamId; + mHalBufferReqs[i].numBuffersRequested = 1; + } +} + +bool ExternalCameraDeviceSession::BufferRequestThread::threadLoop() { + waitForNextRequest(); + if (exitPending()) { + return false; + } + + ATRACE_BEGIN("AIDL requestStreamBuffers"); + BufferRequestStatus status; + std::vector bufRets; + ScopedAStatus ret = mCallbacks->requestStreamBuffers(mHalBufferReqs, &bufRets, &status); + if (!ret.isOk()) { + ALOGE("%s: Transaction error: %d:%d", __FUNCTION__, ret.getExceptionCode(), + ret.getServiceSpecificError()); + return false; + } + + std::unique_lock lk(mLock); + if (status == BufferRequestStatus::OK || status == BufferRequestStatus::FAILED_PARTIAL) { + if (bufRets.size() != mHalBufferReqs.size()) { + ALOGE("%s: expect %zu buffer requests returned, only got %zu", __FUNCTION__, + mHalBufferReqs.size(), bufRets.size()); + return false; + } + + auto parent = mParent.lock(); + if (parent == nullptr) { + ALOGE("%s: session has been disconnected!", __FUNCTION__); + return false; + } + + std::vector importedFences; + importedFences.resize(bufRets.size()); + for (size_t i = 0; i < bufRets.size(); i++) { + int streamId = bufRets[i].streamId; + switch (bufRets[i].val.getTag()) { + case StreamBuffersVal::Tag::error: + continue; + case StreamBuffersVal::Tag::buffers: { + const std::vector& hBufs = + bufRets[i].val.get(); + if (hBufs.size() != 1) { + ALOGE("%s: expect 1 buffer returned, got %zu!", __FUNCTION__, hBufs.size()); + return false; + } + const StreamBuffer& hBuf = hBufs[0]; + + mBufferReqs[i].bufferId = hBuf.bufferId; + // TODO: create a batch import API so we don't need to lock/unlock mCbsLock + // repeatedly? + lk.unlock(); + Status s = + parent->importBuffer(streamId, hBuf.bufferId, makeFromAidl(hBuf.buffer), + /*out*/ &mBufferReqs[i].bufPtr); + lk.lock(); + + if (s != Status::OK) { + ALOGE("%s: stream %d import buffer failed!", __FUNCTION__, streamId); + cleanupInflightFences(importedFences, i - 1); + return false; + } + if (!sHandleImporter.importFence(makeFromAidl(hBuf.acquireFence), + mBufferReqs[i].acquireFence)) { + ALOGE("%s: stream %d import fence failed!", __FUNCTION__, streamId); + cleanupInflightFences(importedFences, i - 1); + return false; + } + importedFences[i] = mBufferReqs[i].acquireFence; + } break; + default: + ALOGE("%s: Unknown StreamBuffersVal!", __FUNCTION__); + return false; + } + } + } else { + ALOGE("%s: requestStreamBuffers call failed!", __FUNCTION__); + } + + mPendingReturnBufferReqs = std::move(mBufferReqs); + mBufferReqs.clear(); + + lk.unlock(); + mRequestDoneCond.notify_one(); + return true; +} + +// End ExternalCameraDeviceSession::BufferRequestThread functions + +// Start ExternalCameraDeviceSession::OutputThread functions + +ExternalCameraDeviceSession::OutputThread::OutputThread( + std::weak_ptr parent, CroppingType ct, + const common::V1_0::helper::CameraMetadata& chars, + std::shared_ptr bufReqThread) + : mParent(parent), + mCroppingType(ct), + mCameraCharacteristics(chars), + mBufferRequestThread(bufReqThread) {} + +ExternalCameraDeviceSession::OutputThread::~OutputThread() {} + +Status ExternalCameraDeviceSession::OutputThread::allocateIntermediateBuffers( + const Size& v4lSize, const Size& thumbSize, const std::vector& streams, + uint32_t blobBufferSize) { + std::lock_guard lk(mBufferLock); + if (!mScaledYu12Frames.empty()) { + ALOGE("%s: intermediate buffer pool has %zu inflight buffers! (expect 0)", __FUNCTION__, + mScaledYu12Frames.size()); + return Status::INTERNAL_ERROR; + } + + // Allocating intermediate YU12 frame + if (mYu12Frame == nullptr || mYu12Frame->mWidth != v4lSize.width || + mYu12Frame->mHeight != v4lSize.height) { + mYu12Frame.reset(); + mYu12Frame = std::make_shared(v4lSize.width, v4lSize.height); + int ret = mYu12Frame->allocate(&mYu12FrameLayout); + if (ret != 0) { + ALOGE("%s: allocating YU12 frame failed!", __FUNCTION__); + return Status::INTERNAL_ERROR; + } + } + + // Allocating intermediate YU12 thumbnail frame + if (mYu12ThumbFrame == nullptr || mYu12ThumbFrame->mWidth != thumbSize.width || + mYu12ThumbFrame->mHeight != thumbSize.height) { + mYu12ThumbFrame.reset(); + mYu12ThumbFrame = std::make_shared(thumbSize.width, thumbSize.height); + int ret = mYu12ThumbFrame->allocate(&mYu12ThumbFrameLayout); + if (ret != 0) { + ALOGE("%s: allocating YU12 thumb frame failed!", __FUNCTION__); + return Status::INTERNAL_ERROR; + } + } + + // Allocating scaled buffers + for (const auto& stream : streams) { + Size sz = {stream.width, stream.height}; + if (sz == v4lSize) { + continue; // Don't need an intermediate buffer same size as v4lBuffer + } + if (mIntermediateBuffers.count(sz) == 0) { + // Create new intermediate buffer + std::shared_ptr buf = + std::make_shared(stream.width, stream.height); + int ret = buf->allocate(); + if (ret != 0) { + ALOGE("%s: allocating intermediate YU12 frame %dx%d failed!", __FUNCTION__, + stream.width, stream.height); + return Status::INTERNAL_ERROR; + } + mIntermediateBuffers[sz] = buf; + } + } + + // Remove unconfigured buffers + auto it = mIntermediateBuffers.begin(); + while (it != mIntermediateBuffers.end()) { + bool configured = false; + auto sz = it->first; + for (const auto& stream : streams) { + if (stream.width == sz.width && stream.height == sz.height) { + configured = true; + break; + } + } + if (configured) { + it++; + } else { + it = mIntermediateBuffers.erase(it); + } + } + + // Allocate mute test pattern frame + mMuteTestPatternFrame.resize(mYu12Frame->mWidth * mYu12Frame->mHeight * 3); + + mBlobBufferSize = blobBufferSize; + return Status::OK; +} + +Status ExternalCameraDeviceSession::OutputThread::submitRequest( + const std::shared_ptr& req) { + std::unique_lock lk(mRequestListLock); + mRequestList.push_back(req); + lk.unlock(); + mRequestCond.notify_one(); + return Status::OK; +} + +void ExternalCameraDeviceSession::OutputThread::flush() { + ATRACE_CALL(); + auto parent = mParent.lock(); + if (parent == nullptr) { + ALOGE("%s: session has been disconnected!", __FUNCTION__); + return; + } + + std::unique_lock lk(mRequestListLock); + std::list> reqs = std::move(mRequestList); + mRequestList.clear(); + if (mProcessingRequest) { + auto timeout = std::chrono::seconds(kFlushWaitTimeoutSec); + auto st = mRequestDoneCond.wait_for(lk, timeout); + if (st == std::cv_status::timeout) { + ALOGE("%s: wait for inflight request finish timeout!", __FUNCTION__); + } + } + + ALOGV("%s: flushing inflight requests", __FUNCTION__); + lk.unlock(); + for (const auto& req : reqs) { + parent->processCaptureRequestError(req); + } +} + +void ExternalCameraDeviceSession::OutputThread::dump(int fd) { + std::lock_guard lk(mRequestListLock); + if (mProcessingRequest) { + dprintf(fd, "OutputThread processing frame %d\n", mProcessingFrameNumber); + } else { + dprintf(fd, "OutputThread not processing any frames\n"); + } + dprintf(fd, "OutputThread request list contains frame: "); + for (const auto& req : mRequestList) { + dprintf(fd, "%d, ", req->frameNumber); + } + dprintf(fd, "\n"); +} + +void ExternalCameraDeviceSession::OutputThread::setExifMakeModel(const std::string& make, + const std::string& model) { + mExifMake = make; + mExifModel = model; +} + +std::list> +ExternalCameraDeviceSession::OutputThread::switchToOffline() { + ATRACE_CALL(); + auto parent = mParent.lock(); + if (parent == nullptr) { + ALOGE("%s: session has been disconnected!", __FUNCTION__); + return {}; + } + + std::unique_lock lk(mRequestListLock); + std::list> reqs = std::move(mRequestList); + mRequestList.clear(); + if (mProcessingRequest) { + auto timeout = std::chrono::seconds(kFlushWaitTimeoutSec); + auto st = mRequestDoneCond.wait_for(lk, timeout); + if (st == std::cv_status::timeout) { + ALOGE("%s: wait for inflight request finish timeout!", __FUNCTION__); + } + } + lk.unlock(); + clearIntermediateBuffers(); + ALOGV("%s: returning %zu request for offline processing", __FUNCTION__, reqs.size()); + return reqs; +} + +int ExternalCameraDeviceSession::OutputThread::requestBufferStart( + const std::vector& bufs) { + if (mBufferRequestThread == nullptr) { + return 0; + } + return mBufferRequestThread->requestBufferStart(bufs); +} + +int ExternalCameraDeviceSession::OutputThread::waitForBufferRequestDone( + std::vector* outBufs) { + if (mBufferRequestThread == nullptr) { + return 0; + } + return mBufferRequestThread->waitForBufferRequestDone(outBufs); +} + +void ExternalCameraDeviceSession::OutputThread::waitForNextRequest( + std::shared_ptr* out) { + ATRACE_CALL(); + if (out == nullptr) { + ALOGE("%s: out is null", __FUNCTION__); + return; + } + + std::unique_lock lk(mRequestListLock); + int waitTimes = 0; + while (mRequestList.empty()) { + if (exitPending()) { + return; + } + auto timeout = std::chrono::milliseconds(kReqWaitTimeoutMs); + auto st = mRequestCond.wait_for(lk, timeout); + if (st == std::cv_status::timeout) { + waitTimes++; + if (waitTimes == kReqWaitTimesMax) { + // no new request, return + return; + } + } + } + *out = mRequestList.front(); + mRequestList.pop_front(); + mProcessingRequest = true; + mProcessingFrameNumber = (*out)->frameNumber; +} + +void ExternalCameraDeviceSession::OutputThread::signalRequestDone() { + std::unique_lock lk(mRequestListLock); + mProcessingRequest = false; + mProcessingFrameNumber = 0; + lk.unlock(); + mRequestDoneCond.notify_one(); +} + +int ExternalCameraDeviceSession::OutputThread::cropAndScaleLocked( + std::shared_ptr& in, const Size& outSz, YCbCrLayout* out) { + Size inSz = {in->mWidth, in->mHeight}; + + int ret; + if (inSz == outSz) { + ret = in->getLayout(out); + if (ret != 0) { + ALOGE("%s: failed to get input image layout", __FUNCTION__); + return ret; + } + return ret; + } + + // Cropping to output aspect ratio + IMapper::Rect inputCrop; + ret = getCropRect(mCroppingType, inSz, outSz, &inputCrop); + if (ret != 0) { + ALOGE("%s: failed to compute crop rect for output size %dx%d", __FUNCTION__, outSz.width, + outSz.height); + return ret; + } + + YCbCrLayout croppedLayout; + ret = in->getCroppedLayout(inputCrop, &croppedLayout); + if (ret != 0) { + ALOGE("%s: failed to crop input image %dx%d to output size %dx%d", __FUNCTION__, inSz.width, + inSz.height, outSz.width, outSz.height); + return ret; + } + + if ((mCroppingType == VERTICAL && inSz.width == outSz.width) || + (mCroppingType == HORIZONTAL && inSz.height == outSz.height)) { + // No scale is needed + *out = croppedLayout; + return 0; + } + + auto it = mScaledYu12Frames.find(outSz); + std::shared_ptr scaledYu12Buf; + if (it != mScaledYu12Frames.end()) { + scaledYu12Buf = it->second; + } else { + it = mIntermediateBuffers.find(outSz); + if (it == mIntermediateBuffers.end()) { + ALOGE("%s: failed to find intermediate buffer size %dx%d", __FUNCTION__, outSz.width, + outSz.height); + return -1; + } + scaledYu12Buf = it->second; + } + // Scale + YCbCrLayout outLayout; + ret = scaledYu12Buf->getLayout(&outLayout); + if (ret != 0) { + ALOGE("%s: failed to get output buffer layout", __FUNCTION__); + return ret; + } + + ret = libyuv::I420Scale( + static_cast(croppedLayout.y), croppedLayout.yStride, + static_cast(croppedLayout.cb), croppedLayout.cStride, + static_cast(croppedLayout.cr), croppedLayout.cStride, inputCrop.width, + inputCrop.height, static_cast(outLayout.y), outLayout.yStride, + static_cast(outLayout.cb), outLayout.cStride, + static_cast(outLayout.cr), outLayout.cStride, outSz.width, outSz.height, + // TODO: b/72261744 see if we can use better filter without losing too much perf + libyuv::FilterMode::kFilterNone); + + if (ret != 0) { + ALOGE("%s: failed to scale buffer from %dx%d to %dx%d. Ret %d", __FUNCTION__, + inputCrop.width, inputCrop.height, outSz.width, outSz.height, ret); + return ret; + } + + *out = outLayout; + mScaledYu12Frames.insert({outSz, scaledYu12Buf}); + return 0; +} + +int ExternalCameraDeviceSession::OutputThread::cropAndScaleThumbLocked( + std::shared_ptr& in, const Size& outSz, YCbCrLayout* out) { + Size inSz{in->mWidth, in->mHeight}; + + if ((outSz.width * outSz.height) > (mYu12ThumbFrame->mWidth * mYu12ThumbFrame->mHeight)) { + ALOGE("%s: Requested thumbnail size too big (%d,%d) > (%d,%d)", __FUNCTION__, outSz.width, + outSz.height, mYu12ThumbFrame->mWidth, mYu12ThumbFrame->mHeight); + return -1; + } + + int ret; + + /* This will crop-and-zoom the input YUV frame to the thumbnail size + * Based on the following logic: + * 1) Square pixels come in, square pixels come out, therefore single + * scale factor is computed to either make input bigger or smaller + * depending on if we are upscaling or downscaling + * 2) That single scale factor would either make height too tall or width + * too wide so we need to crop the input either horizontally or vertically + * but not both + */ + + /* Convert the input and output dimensions into floats for ease of math */ + float fWin = static_cast(inSz.width); + float fHin = static_cast(inSz.height); + float fWout = static_cast(outSz.width); + float fHout = static_cast(outSz.height); + + /* Compute the one scale factor from (1) above, it will be the smaller of + * the two possibilities. */ + float scaleFactor = std::min(fHin / fHout, fWin / fWout); + + /* Since we are crop-and-zooming (as opposed to letter/pillar boxing) we can + * simply multiply the output by our scaleFactor to get the cropped input + * size. Note that at least one of {fWcrop, fHcrop} is going to wind up + * being {fWin, fHin} respectively because fHout or fWout cancels out the + * scaleFactor calculation above. + * + * Specifically: + * if ( fHin / fHout ) < ( fWin / fWout ) we crop the sides off + * input, in which case + * scaleFactor = fHin / fHout + * fWcrop = fHin / fHout * fWout + * fHcrop = fHin + * + * Note that fWcrop <= fWin ( because ( fHin / fHout ) * fWout < fWin, which + * is just the inequality above with both sides multiplied by fWout + * + * on the other hand if ( fWin / fWout ) < ( fHin / fHout) we crop the top + * and the bottom off of input, and + * scaleFactor = fWin / fWout + * fWcrop = fWin + * fHCrop = fWin / fWout * fHout + */ + float fWcrop = scaleFactor * fWout; + float fHcrop = scaleFactor * fHout; + + /* Convert to integer and truncate to an even number */ + Size cropSz = {.width = 2 * static_cast(fWcrop / 2.0f), + .height = 2 * static_cast(fHcrop / 2.0f)}; + + /* Convert to a centered rectange with even top/left */ + IMapper::Rect inputCrop{.left = 2 * static_cast((inSz.width - cropSz.width) / 4), + .top = 2 * static_cast((inSz.height - cropSz.height) / 4), + .width = static_cast(cropSz.width), + .height = static_cast(cropSz.height)}; + + if ((inputCrop.top < 0) || (inputCrop.top >= static_cast(inSz.height)) || + (inputCrop.left < 0) || (inputCrop.left >= static_cast(inSz.width)) || + (inputCrop.width <= 0) || + (inputCrop.width + inputCrop.left > static_cast(inSz.width)) || + (inputCrop.height <= 0) || + (inputCrop.height + inputCrop.top > static_cast(inSz.height))) { + ALOGE("%s: came up with really wrong crop rectangle", __FUNCTION__); + ALOGE("%s: input layout %dx%d to for output size %dx%d", __FUNCTION__, inSz.width, + inSz.height, outSz.width, outSz.height); + ALOGE("%s: computed input crop +%d,+%d %dx%d", __FUNCTION__, inputCrop.left, inputCrop.top, + inputCrop.width, inputCrop.height); + return -1; + } + + YCbCrLayout inputLayout; + ret = in->getCroppedLayout(inputCrop, &inputLayout); + if (ret != 0) { + ALOGE("%s: failed to crop input layout %dx%d to for output size %dx%d", __FUNCTION__, + inSz.width, inSz.height, outSz.width, outSz.height); + ALOGE("%s: computed input crop +%d,+%d %dx%d", __FUNCTION__, inputCrop.left, inputCrop.top, + inputCrop.width, inputCrop.height); + return ret; + } + ALOGV("%s: crop input layout %dx%d to for output size %dx%d", __FUNCTION__, inSz.width, + inSz.height, outSz.width, outSz.height); + ALOGV("%s: computed input crop +%d,+%d %dx%d", __FUNCTION__, inputCrop.left, inputCrop.top, + inputCrop.width, inputCrop.height); + + // Scale + YCbCrLayout outFullLayout; + + ret = mYu12ThumbFrame->getLayout(&outFullLayout); + if (ret != 0) { + ALOGE("%s: failed to get output buffer layout", __FUNCTION__); + return ret; + } + + ret = libyuv::I420Scale(static_cast(inputLayout.y), inputLayout.yStride, + static_cast(inputLayout.cb), inputLayout.cStride, + static_cast(inputLayout.cr), inputLayout.cStride, + inputCrop.width, inputCrop.height, + static_cast(outFullLayout.y), outFullLayout.yStride, + static_cast(outFullLayout.cb), outFullLayout.cStride, + static_cast(outFullLayout.cr), outFullLayout.cStride, + outSz.width, outSz.height, libyuv::FilterMode::kFilterNone); + + if (ret != 0) { + ALOGE("%s: failed to scale buffer from %dx%d to %dx%d. Ret %d", __FUNCTION__, + inputCrop.width, inputCrop.height, outSz.width, outSz.height, ret); + return ret; + } + + *out = outFullLayout; + return 0; +} + +int ExternalCameraDeviceSession::OutputThread::createJpegLocked( + HalStreamBuffer& halBuf, const common::V1_0::helper::CameraMetadata& setting) { + ATRACE_CALL(); + int ret; + auto lfail = [&](auto... args) { + ALOGE(args...); + + return 1; + }; + auto parent = mParent.lock(); + if (parent == nullptr) { + ALOGE("%s: session has been disconnected!", __FUNCTION__); + return 1; + } + + ALOGV("%s: HAL buffer sid: %d bid: %" PRIu64 " w: %u h: %u", __FUNCTION__, halBuf.streamId, + static_cast(halBuf.bufferId), halBuf.width, halBuf.height); + ALOGV("%s: HAL buffer fmt: %x usage: %" PRIx64 " ptr: %p", __FUNCTION__, halBuf.format, + static_cast(halBuf.usage), halBuf.bufPtr); + ALOGV("%s: YV12 buffer %d x %d", __FUNCTION__, mYu12Frame->mWidth, mYu12Frame->mHeight); + + int jpegQuality, thumbQuality; + Size thumbSize; + bool outputThumbnail = true; + + if (setting.exists(ANDROID_JPEG_QUALITY)) { + camera_metadata_ro_entry entry = setting.find(ANDROID_JPEG_QUALITY); + jpegQuality = entry.data.u8[0]; + } else { + return lfail("%s: ANDROID_JPEG_QUALITY not set", __FUNCTION__); + } + + if (setting.exists(ANDROID_JPEG_THUMBNAIL_QUALITY)) { + camera_metadata_ro_entry entry = setting.find(ANDROID_JPEG_THUMBNAIL_QUALITY); + thumbQuality = entry.data.u8[0]; + } else { + return lfail("%s: ANDROID_JPEG_THUMBNAIL_QUALITY not set", __FUNCTION__); + } + + if (setting.exists(ANDROID_JPEG_THUMBNAIL_SIZE)) { + camera_metadata_ro_entry entry = setting.find(ANDROID_JPEG_THUMBNAIL_SIZE); + thumbSize = Size{.width = entry.data.i32[0], .height = entry.data.i32[1]}; + if (thumbSize.width == 0 && thumbSize.height == 0) { + outputThumbnail = false; + } + } else { + return lfail("%s: ANDROID_JPEG_THUMBNAIL_SIZE not set", __FUNCTION__); + } + + /* Cropped and scaled YU12 buffer for main and thumbnail */ + YCbCrLayout yu12Main; + Size jpegSize{halBuf.width, halBuf.height}; + + /* Compute temporary buffer sizes accounting for the following: + * thumbnail can't exceed APP1 size of 64K + * main image needs to hold APP1, headers, and at most a poorly + * compressed image */ + const ssize_t maxThumbCodeSize = 64 * 1024; + const ssize_t maxJpegCodeSize = + mBlobBufferSize == 0 ? parent->getJpegBufferSize(jpegSize.width, jpegSize.height) + : mBlobBufferSize; + + /* Check that getJpegBufferSize did not return an error */ + if (maxJpegCodeSize < 0) { + return lfail("%s: getJpegBufferSize returned %zd", __FUNCTION__, maxJpegCodeSize); + } + + /* Hold actual thumbnail and main image code sizes */ + size_t thumbCodeSize = 0, jpegCodeSize = 0; + /* Temporary thumbnail code buffer */ + std::vector thumbCode(outputThumbnail ? maxThumbCodeSize : 0); + + YCbCrLayout yu12Thumb; + if (outputThumbnail) { + ret = cropAndScaleThumbLocked(mYu12Frame, thumbSize, &yu12Thumb); + + if (ret != 0) { + return lfail("%s: crop and scale thumbnail failed!", __FUNCTION__); + } + } + + /* Scale and crop main jpeg */ + ret = cropAndScaleLocked(mYu12Frame, jpegSize, &yu12Main); + + if (ret != 0) { + return lfail("%s: crop and scale main failed!", __FUNCTION__); + } + + /* Encode the thumbnail image */ + if (outputThumbnail) { + ret = encodeJpegYU12(thumbSize, yu12Thumb, thumbQuality, 0, 0, &thumbCode[0], + maxThumbCodeSize, thumbCodeSize); + + if (ret != 0) { + return lfail("%s: thumbnail encodeJpegYU12 failed with %d", __FUNCTION__, ret); + } + } + + /* Combine camera characteristics with request settings to form EXIF + * metadata */ + common::V1_0::helper::CameraMetadata meta(mCameraCharacteristics); + meta.append(setting); + + /* Generate EXIF object */ + std::unique_ptr utils(ExifUtils::create()); + /* Make sure it's initialized */ + utils->initialize(); + + utils->setFromMetadata(meta, jpegSize.width, jpegSize.height); + utils->setMake(mExifMake); + utils->setModel(mExifModel); + + ret = utils->generateApp1(outputThumbnail ? &thumbCode[0] : nullptr, thumbCodeSize); + + if (!ret) { + return lfail("%s: generating APP1 failed", __FUNCTION__); + } + + /* Get internal buffer */ + size_t exifDataSize = utils->getApp1Length(); + const uint8_t* exifData = utils->getApp1Buffer(); + + /* Lock the HAL jpeg code buffer */ + void* bufPtr = sHandleImporter.lock(*(halBuf.bufPtr), static_cast(halBuf.usage), + maxJpegCodeSize); + + if (!bufPtr) { + return lfail("%s: could not lock %zu bytes", __FUNCTION__, maxJpegCodeSize); + } + + /* Encode the main jpeg image */ + ret = encodeJpegYU12(jpegSize, yu12Main, jpegQuality, exifData, exifDataSize, bufPtr, + maxJpegCodeSize, jpegCodeSize); + + /* TODO: Not sure this belongs here, maybe better to pass jpegCodeSize out + * and do this when returning buffer to parent */ + CameraBlob blob{CameraBlobId::JPEG, static_cast(jpegCodeSize)}; + void* blobDst = reinterpret_cast(reinterpret_cast(bufPtr) + maxJpegCodeSize - + sizeof(CameraBlob)); + memcpy(blobDst, &blob, sizeof(CameraBlob)); + + /* Unlock the HAL jpeg code buffer */ + int relFence = sHandleImporter.unlock(*(halBuf.bufPtr)); + if (relFence >= 0) { + halBuf.acquireFence = relFence; + } + + /* Check if our JPEG actually succeeded */ + if (ret != 0) { + return lfail("%s: encodeJpegYU12 failed with %d", __FUNCTION__, ret); + } + + ALOGV("%s: encoded JPEG (ret:%d) with Q:%d max size: %zu", __FUNCTION__, ret, jpegQuality, + maxJpegCodeSize); + + return 0; +} + +void ExternalCameraDeviceSession::OutputThread::clearIntermediateBuffers() { + std::lock_guard lk(mBufferLock); + mYu12Frame.reset(); + mYu12ThumbFrame.reset(); + mIntermediateBuffers.clear(); + mMuteTestPatternFrame.clear(); + mBlobBufferSize = 0; +} + +bool ExternalCameraDeviceSession::OutputThread::threadLoop() { + std::shared_ptr req; + auto parent = mParent.lock(); + if (parent == nullptr) { + ALOGE("%s: session has been disconnected!", __FUNCTION__); + return false; + } + + // TODO: maybe we need to setup a sensor thread to dq/enq v4l frames + // regularly to prevent v4l buffer queue filled with stale buffers + // when app doesn't program a preview request + waitForNextRequest(&req); + if (req == nullptr) { + // No new request, wait again + return true; + } + + auto onDeviceError = [&](auto... args) { + ALOGE(args...); + parent->notifyError(req->frameNumber, /*stream*/ -1, ErrorCode::ERROR_DEVICE); + signalRequestDone(); + return false; + }; + + if (req->frameIn->mFourcc != V4L2_PIX_FMT_MJPEG && req->frameIn->mFourcc != V4L2_PIX_FMT_Z16) { + return onDeviceError("%s: do not support V4L2 format %c%c%c%c", __FUNCTION__, + req->frameIn->mFourcc & 0xFF, (req->frameIn->mFourcc >> 8) & 0xFF, + (req->frameIn->mFourcc >> 16) & 0xFF, + (req->frameIn->mFourcc >> 24) & 0xFF); + } + + int res = requestBufferStart(req->buffers); + if (res != 0) { + ALOGE("%s: send BufferRequest failed! res %d", __FUNCTION__, res); + return onDeviceError("%s: failed to send buffer request!", __FUNCTION__); + } + + std::unique_lock lk(mBufferLock); + // Convert input V4L2 frame to YU12 of the same size + // TODO: see if we can save some computation by converting to YV12 here + uint8_t* inData; + size_t inDataSize; + if (req->frameIn->getData(&inData, &inDataSize) != 0) { + lk.unlock(); + return onDeviceError("%s: V4L2 buffer map failed", __FUNCTION__); + } + + // Process camera mute state + auto testPatternMode = req->setting.find(ANDROID_SENSOR_TEST_PATTERN_MODE); + if (testPatternMode.count == 1) { + if (mCameraMuted != (testPatternMode.data.u8[0] != ANDROID_SENSOR_TEST_PATTERN_MODE_OFF)) { + mCameraMuted = !mCameraMuted; + // Get solid color for test pattern, if any was set + if (testPatternMode.data.u8[0] == ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR) { + auto entry = req->setting.find(ANDROID_SENSOR_TEST_PATTERN_DATA); + if (entry.count == 4) { + // Update the mute frame if the pattern color has changed + if (memcmp(entry.data.i32, mTestPatternData, sizeof(mTestPatternData)) != 0) { + memcpy(mTestPatternData, entry.data.i32, sizeof(mTestPatternData)); + // Fill the mute frame with the solid color, use only 8 MSB of RGGB as RGB + for (int i = 0; i < mMuteTestPatternFrame.size(); i += 3) { + mMuteTestPatternFrame[i] = entry.data.i32[0] >> 24; + mMuteTestPatternFrame[i + 1] = entry.data.i32[1] >> 24; + mMuteTestPatternFrame[i + 2] = entry.data.i32[3] >> 24; + } + } + } + } + } + } + + // TODO: in some special case maybe we can decode jpg directly to gralloc output? + if (req->frameIn->mFourcc == V4L2_PIX_FMT_MJPEG) { + ATRACE_BEGIN("MJPGtoI420"); + res = 0; + if (mCameraMuted) { + res = libyuv::ConvertToI420( + mMuteTestPatternFrame.data(), mMuteTestPatternFrame.size(), + static_cast(mYu12FrameLayout.y), mYu12FrameLayout.yStride, + static_cast(mYu12FrameLayout.cb), mYu12FrameLayout.cStride, + static_cast(mYu12FrameLayout.cr), mYu12FrameLayout.cStride, 0, 0, + mYu12Frame->mWidth, mYu12Frame->mHeight, mYu12Frame->mWidth, + mYu12Frame->mHeight, libyuv::kRotate0, libyuv::FOURCC_RAW); + } else { + res = libyuv::MJPGToI420( + inData, inDataSize, static_cast(mYu12FrameLayout.y), + mYu12FrameLayout.yStride, static_cast(mYu12FrameLayout.cb), + mYu12FrameLayout.cStride, static_cast(mYu12FrameLayout.cr), + mYu12FrameLayout.cStride, mYu12Frame->mWidth, mYu12Frame->mHeight, + mYu12Frame->mWidth, mYu12Frame->mHeight); + } + ATRACE_END(); + + if (res != 0) { + // For some webcam, the first few V4L2 frames might be malformed... + ALOGE("%s: Convert V4L2 frame to YU12 failed! res %d", __FUNCTION__, res); + lk.unlock(); + Status st = parent->processCaptureRequestError(req); + if (st != Status::OK) { + return onDeviceError("%s: failed to process capture request error!", __FUNCTION__); + } + signalRequestDone(); + return true; + } + } + + ATRACE_BEGIN("Wait for BufferRequest done"); + res = waitForBufferRequestDone(&req->buffers); + ATRACE_END(); + + if (res != 0) { + ALOGE("%s: wait for BufferRequest done failed! res %d", __FUNCTION__, res); + lk.unlock(); + return onDeviceError("%s: failed to process buffer request error!", __FUNCTION__); + } + + ALOGV("%s processing new request", __FUNCTION__); + const int kSyncWaitTimeoutMs = 500; + for (auto& halBuf : req->buffers) { + if (*(halBuf.bufPtr) == nullptr) { + ALOGW("%s: buffer for stream %d missing", __FUNCTION__, halBuf.streamId); + halBuf.fenceTimeout = true; + } else if (halBuf.acquireFence >= 0) { + int ret = sync_wait(halBuf.acquireFence, kSyncWaitTimeoutMs); + if (ret) { + halBuf.fenceTimeout = true; + } else { + ::close(halBuf.acquireFence); + halBuf.acquireFence = -1; + } + } + + if (halBuf.fenceTimeout) { + continue; + } + + // Gralloc lockYCbCr the buffer + switch (halBuf.format) { + case PixelFormat::BLOB: { + int ret = createJpegLocked(halBuf, req->setting); + + if (ret != 0) { + lk.unlock(); + return onDeviceError("%s: createJpegLocked failed with %d", __FUNCTION__, ret); + } + } break; + case PixelFormat::Y16: { + void* outLayout = sHandleImporter.lock( + *(halBuf.bufPtr), static_cast(halBuf.usage), inDataSize); + + std::memcpy(outLayout, inData, inDataSize); + + int relFence = sHandleImporter.unlock(*(halBuf.bufPtr)); + if (relFence >= 0) { + halBuf.acquireFence = relFence; + } + } break; + case PixelFormat::YCBCR_420_888: + case PixelFormat::YV12: { + IMapper::Rect outRect{0, 0, static_cast(halBuf.width), + static_cast(halBuf.height)}; + YCbCrLayout outLayout = sHandleImporter.lockYCbCr( + *(halBuf.bufPtr), static_cast(halBuf.usage), outRect); + ALOGV("%s: outLayout y %p cb %p cr %p y_str %d c_str %d c_step %d", __FUNCTION__, + outLayout.y, outLayout.cb, outLayout.cr, outLayout.yStride, outLayout.cStride, + outLayout.chromaStep); + + // Convert to output buffer size/format + uint32_t outputFourcc = getFourCcFromLayout(outLayout); + ALOGV("%s: converting to format %c%c%c%c", __FUNCTION__, outputFourcc & 0xFF, + (outputFourcc >> 8) & 0xFF, (outputFourcc >> 16) & 0xFF, + (outputFourcc >> 24) & 0xFF); + + YCbCrLayout cropAndScaled; + ATRACE_BEGIN("cropAndScaleLocked"); + int ret = cropAndScaleLocked(mYu12Frame, Size{halBuf.width, halBuf.height}, + &cropAndScaled); + ATRACE_END(); + if (ret != 0) { + lk.unlock(); + return onDeviceError("%s: crop and scale failed!", __FUNCTION__); + } + + Size sz{halBuf.width, halBuf.height}; + ATRACE_BEGIN("formatConvert"); + ret = formatConvert(cropAndScaled, outLayout, sz, outputFourcc); + ATRACE_END(); + if (ret != 0) { + lk.unlock(); + return onDeviceError("%s: format conversion failed!", __FUNCTION__); + } + int relFence = sHandleImporter.unlock(*(halBuf.bufPtr)); + if (relFence >= 0) { + halBuf.acquireFence = relFence; + } + } break; + default: + lk.unlock(); + return onDeviceError("%s: unknown output format %x", __FUNCTION__, halBuf.format); + } + } // for each buffer + mScaledYu12Frames.clear(); + + // Don't hold the lock while calling back to parent + lk.unlock(); + Status st = parent->processCaptureResult(req); + if (st != Status::OK) { + return onDeviceError("%s: failed to process capture result!", __FUNCTION__); + } + signalRequestDone(); + return true; +} + +// End ExternalCameraDeviceSession::OutputThread functions + +} // namespace implementation +} // namespace device +} // namespace camera +} // namespace hardware +} // namespace android diff --git a/camera/device/default/ExternalCameraDeviceSession.h b/camera/device/default/ExternalCameraDeviceSession.h new file mode 100644 index 0000000000..5d420925c3 --- /dev/null +++ b/camera/device/default/ExternalCameraDeviceSession.h @@ -0,0 +1,399 @@ +/* + * 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. + */ + +#ifndef HARDWARE_INTERFACES_CAMERA_DEVICE_DEFAULT_EXTERNALCAMERADEVICESESSION_H_ +#define HARDWARE_INTERFACES_CAMERA_DEVICE_DEFAULT_EXTERNALCAMERADEVICESESSION_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace camera { +namespace device { +namespace implementation { + +using ::aidl::android::hardware::camera::common::Status; +using ::aidl::android::hardware::camera::device::BnCameraDeviceSession; +using ::aidl::android::hardware::camera::device::BufferCache; +using ::aidl::android::hardware::camera::device::BufferRequest; +using ::aidl::android::hardware::camera::device::CameraMetadata; +using ::aidl::android::hardware::camera::device::CameraOfflineSessionInfo; +using ::aidl::android::hardware::camera::device::CaptureRequest; +using ::aidl::android::hardware::camera::device::HalStream; +using ::aidl::android::hardware::camera::device::ICameraDeviceCallback; +using ::aidl::android::hardware::camera::device::ICameraOfflineSession; +using ::aidl::android::hardware::camera::device::RequestTemplate; +using ::aidl::android::hardware::camera::device::Stream; +using ::aidl::android::hardware::camera::device::StreamConfiguration; +using ::aidl::android::hardware::common::fmq::MQDescriptor; +using ::aidl::android::hardware::common::fmq::SynchronizedReadWrite; +using ::android::AidlMessageQueue; +using ::android::base::unique_fd; +using ::android::hardware::camera::common::helper::SimpleThread; +using ::android::hardware::camera::external::common::ExternalCameraConfig; +using ::android::hardware::camera::external::common::SizeHasher; +using ::ndk::ScopedAStatus; + +class ExternalCameraDeviceSession : public BnCameraDeviceSession, public OutputThreadInterface { + public: + ExternalCameraDeviceSession(const std::shared_ptr&, + const ExternalCameraConfig& cfg, + const std::vector& sortedFormats, + const CroppingType& croppingType, + const common::V1_0::helper::CameraMetadata& chars, + const std::string& cameraId, unique_fd v4l2Fd); + ~ExternalCameraDeviceSession() override; + + // Caller must use this method to check if CameraDeviceSession ctor failed + bool isInitFailed(); + bool isClosed(); + + ScopedAStatus close() override; + + ScopedAStatus configureStreams(const StreamConfiguration& in_requestedConfiguration, + std::vector* _aidl_return) override; + ScopedAStatus constructDefaultRequestSettings(RequestTemplate in_type, + CameraMetadata* _aidl_return) override; + ScopedAStatus flush() override; + ScopedAStatus getCaptureRequestMetadataQueue( + MQDescriptor* _aidl_return) override; + ScopedAStatus getCaptureResultMetadataQueue( + MQDescriptor* _aidl_return) override; + ScopedAStatus isReconfigurationRequired(const CameraMetadata& in_oldSessionParams, + const CameraMetadata& in_newSessionParams, + bool* _aidl_return) override; + ScopedAStatus processCaptureRequest(const std::vector& in_requests, + const std::vector& in_cachesToRemove, + int32_t* _aidl_return) override; + ScopedAStatus signalStreamFlush(const std::vector& in_streamIds, + int32_t in_streamConfigCounter) override; + ScopedAStatus switchToOffline(const std::vector& in_streamsToKeep, + CameraOfflineSessionInfo* out_offlineSessionInfo, + std::shared_ptr* _aidl_return) override; + ScopedAStatus repeatingRequestEnd(int32_t in_frameNumber, + const std::vector& in_streamIds) override; + + Status importBuffer(int32_t streamId, uint64_t bufId, buffer_handle_t buf, + buffer_handle_t** outBufPtr) override; + + void notifyError(int32_t frameNumber, int32_t streamId, ErrorCode ec) override; + + Status processCaptureRequestError(const std::shared_ptr& ptr, + std::vector* msgs, + std::vector* results) override; + + Status processCaptureResult(std::shared_ptr& ptr) override; + ssize_t getJpegBufferSize(int32_t width, int32_t height) const override; + + // Called by CameraDevice to dump active device states + binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; + + static Status isStreamCombinationSupported( + const StreamConfiguration& config, + const std::vector& supportedFormats, + const ExternalCameraConfig& devCfg); + + static const int kMaxProcessedStream = 2; + static const int kMaxStallStream = 1; + static const uint32_t kMaxBytesPerPixel = 2; + + class BufferRequestThread : public SimpleThread { + public: + BufferRequestThread(std::weak_ptr parent, + std::shared_ptr callbacks); + + int requestBufferStart(const std::vector&); + int waitForBufferRequestDone( + /*out*/ std::vector*); + + bool threadLoop() override; + + private: + void waitForNextRequest(); + + const std::weak_ptr mParent; + const std::shared_ptr mCallbacks; + + std::mutex mLock; + bool mRequestingBuffer = false; + + std::vector mBufferReqs; + std::vector mPendingReturnBufferReqs; + // mHalBufferReqs is not under mLock protection during the HIDL transaction + std::vector mHalBufferReqs; + + // request buffers takes much less time in steady state, but can take much longer + // when requesting 1st buffer from a stream. + // TODO: consider a separate timeout for new vs. steady state? + // TODO: or make sure framework is warming up the pipeline during configure new stream? + static const int kReqProcTimeoutMs = 66; + + static const int kReqWaitTimeoutMs = 33; + static const int kReqWaitTimesWarn = 90; // 33ms * 90 ~= 3 sec + std::condition_variable mRequestCond; // signaled when a new buffer request incoming + std::condition_variable mRequestDoneCond; // signaled when a request is done + }; + + class OutputThread : public SimpleThread { + public: + OutputThread(std::weak_ptr parent, CroppingType, + const common::V1_0::helper::CameraMetadata&, + std::shared_ptr bufReqThread); + ~OutputThread(); + + Status allocateIntermediateBuffers(const Size& v4lSize, const Size& thumbSize, + const std::vector& streams, + uint32_t blobBufferSize); + Status submitRequest(const std::shared_ptr&); + void flush(); + void dump(int fd); + bool threadLoop() override; + + void setExifMakeModel(const std::string& make, const std::string& model); + + // The remaining request list is returned for offline processing + std::list> switchToOffline(); + + protected: + static const int kFlushWaitTimeoutSec = 3; // 3 sec + static const int kReqWaitTimeoutMs = 33; // 33ms + static const int kReqWaitTimesMax = 90; // 33ms * 90 ~= 3 sec + + // Methods to request output buffer in parallel + int requestBufferStart(const std::vector&); + int waitForBufferRequestDone( + /*out*/ std::vector*); + + void waitForNextRequest(std::shared_ptr* out); + void signalRequestDone(); + + int cropAndScaleLocked(std::shared_ptr& in, const Size& outSize, + YCbCrLayout* out); + + int cropAndScaleThumbLocked(std::shared_ptr& in, const Size& outSize, + YCbCrLayout* out); + + int createJpegLocked(HalStreamBuffer& halBuf, + const common::V1_0::helper::CameraMetadata& settings); + + void clearIntermediateBuffers(); + + const std::weak_ptr mParent; + const CroppingType mCroppingType; + const common::V1_0::helper::CameraMetadata mCameraCharacteristics; + + mutable std::mutex mRequestListLock; // Protect access to mRequestList, + // mProcessingRequest and mProcessingFrameNumber + std::condition_variable mRequestCond; // signaled when a new request is submitted + std::condition_variable mRequestDoneCond; // signaled when a request is done processing + std::list> mRequestList; + bool mProcessingRequest = false; + uint32_t mProcessingFrameNumber = 0; + + // V4L2 frameIn + // (MJPG decode)-> mYu12Frame + // (Scale)-> mScaledYu12Frames + // (Format convert) -> output gralloc frames + mutable std::mutex mBufferLock; // Protect access to intermediate buffers + std::shared_ptr mYu12Frame; + std::shared_ptr mYu12ThumbFrame; + std::unordered_map, SizeHasher> mIntermediateBuffers; + std::unordered_map, SizeHasher> mScaledYu12Frames; + YCbCrLayout mYu12FrameLayout; + YCbCrLayout mYu12ThumbFrameLayout; + std::vector mMuteTestPatternFrame; + uint32_t mTestPatternData[4] = {0, 0, 0, 0}; + bool mCameraMuted = false; + uint32_t mBlobBufferSize = 0; // 0 -> HAL derive buffer size, else: use given size + + std::string mExifMake; + std::string mExifModel; + + const std::shared_ptr mBufferRequestThread; + }; + + private: + bool initialize(); + // To init/close different version of output thread + void initOutputThread(); + void closeOutputThread(); + void closeOutputThreadImpl(); + + void close(bool callerIsDtor); + Status initStatus() const; + status_t initDefaultRequests(); + + status_t fillCaptureResult(common::V1_0::helper::CameraMetadata& md, nsecs_t timestamp); + int configureV4l2StreamLocked(const SupportedV4L2Format& fmt, double fps = 0.0); + int v4l2StreamOffLocked(); + + int setV4l2FpsLocked(double fps); + + std::unique_ptr dequeueV4l2FrameLocked( + /*out*/ nsecs_t* shutterTs); // Called with mLock held + + void enqueueV4l2Frame(const std::shared_ptr&); + + // Check if input Stream is one of supported stream setting on this device + static bool isSupported(const Stream& stream, + const std::vector& supportedFormats, + const ExternalCameraConfig& cfg); + + // Validate and import request's output buffers and acquire fence + Status importRequestLocked(const CaptureRequest& request, + std::vector& allBufPtrs, + std::vector& allFences); + + Status importRequestLockedImpl(const CaptureRequest& request, + std::vector& allBufPtrs, + std::vector& allFences); + + Status importBufferLocked(int32_t streamId, uint64_t bufId, buffer_handle_t buf, + /*out*/ buffer_handle_t** outBufPtr); + static void cleanupInflightFences(std::vector& allFences, size_t numFences); + void cleanupBuffersLocked(int id); + + void updateBufferCaches(const std::vector& cachesToRemove); + + Status processOneCaptureRequest(const CaptureRequest& request); + void notifyShutter(int32_t frameNumber, nsecs_t shutterTs); + + void invokeProcessCaptureResultCallback(std::vector& results, bool tryWriteFmq); + Size getMaxJpegResolution() const; + + Size getMaxThumbResolution() const; + + int waitForV4L2BufferReturnLocked(std::unique_lock& lk); + + // Main body of switchToOffline. This method does not invoke any callbacks + // but instead returns the necessary callbacks in output arguments so callers + // can callback later without holding any locks + Status switchToOffline(const std::vector& offlineStreams, + /*out*/ std::vector* msgs, + /*out*/ std::vector* results, + /*out*/ CameraOfflineSessionInfo* info, + /*out*/ std::shared_ptr* session); + + bool supportOfflineLocked(int32_t streamId); + + // Whether a request can be completely dropped when switching to offline + bool canDropRequest(const std::vector& offlineStreams, + std::shared_ptr halReq); + + void fillOfflineSessionInfo(const std::vector& offlineStreams, + std::deque>& offlineReqs, + const std::map& circulatingBuffers, + /*out*/ CameraOfflineSessionInfo* info); + + // Protect (most of) HIDL interface methods from synchronized-entering + mutable Mutex mInterfaceLock; + + mutable Mutex mLock; // Protect all private members except otherwise noted + const std::shared_ptr mCallback; + const ExternalCameraConfig& mCfg; + const common::V1_0::helper::CameraMetadata mCameraCharacteristics; + const std::vector mSupportedFormats; + const CroppingType mCroppingType; + const std::string mCameraId; + + // Not protected by mLock, this is almost a const. + // Setup in constructor, reset in close() after OutputThread is joined + unique_fd mV4l2Fd; + + // device is closed either + // - closed by user + // - init failed + // - camera disconnected + bool mClosed = false; + bool mInitialized = false; + bool mInitFail = false; + bool mFirstRequest = false; + common::V1_0::helper::CameraMetadata mLatestReqSetting; + + bool mV4l2Streaming = false; + SupportedV4L2Format mV4l2StreamingFmt; + double mV4l2StreamingFps = 0.0; + size_t mV4L2BufferCount = 0; + + static const int kBufferWaitTimeoutSec = 3; // TODO: handle long exposure (or not allowing) + std::mutex mV4l2BufferLock; // protect the buffer count and condition below + std::condition_variable mV4L2BufferReturned; + size_t mNumDequeuedV4l2Buffers = 0; + uint32_t mMaxV4L2BufferSize = 0; + + // Not protected by mLock (but might be used when mLock is locked) + std::shared_ptr mOutputThread; + + // Stream ID -> Stream cache + std::unordered_map mStreamMap; + + std::mutex mInflightFramesLock; // protect mInflightFrames + std::unordered_set mInflightFrames; + + // Stream ID -> circulating buffers map + std::map mCirculatingBuffers; + // Protect mCirculatingBuffers, must not lock mLock after acquiring this lock + mutable Mutex mCbsLock; + + std::mutex mAfTriggerLock; // protect mAfTrigger + bool mAfTrigger = false; + + uint32_t mBlobBufferSize = 0; + + static HandleImporter sHandleImporter; + + bool mSupportBufMgr; + std::shared_ptr mBufferRequestThread; + + /* Beginning of members not changed after initialize() */ + using RequestMetadataQueue = AidlMessageQueue; + std::unique_ptr mRequestMetadataQueue; + using ResultMetadataQueue = AidlMessageQueue; + std::shared_ptr mResultMetadataQueue; + + // Protect against invokeProcessCaptureResultCallback() + Mutex mProcessCaptureResultLock; + + // tracks last seen stream config counter + int32_t mLastStreamConfigCounter = -1; + + std::unordered_map mDefaultRequests; + + const Size mMaxThumbResolution; + const Size mMaxJpegResolution; + + std::string mExifMake; + std::string mExifModel; + /* End of members not changed after initialize() */ +}; + +} // namespace implementation +} // namespace device +} // namespace camera +} // namespace hardware +} // namespace android + +#endif // HARDWARE_INTERFACES_CAMERA_DEVICE_DEFAULT_EXTERNALCAMERADEVICESESSION_H_ diff --git a/camera/device/default/ExternalCameraOfflineSession.cpp b/camera/device/default/ExternalCameraOfflineSession.cpp new file mode 100644 index 0000000000..4c7f732f87 --- /dev/null +++ b/camera/device/default/ExternalCameraOfflineSession.cpp @@ -0,0 +1,547 @@ +/* + * 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. + */ + +#define LOG_TAG "ExtCamOfflnSsn" +#include + +#include "ExternalCameraOfflineSession.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define HAVE_JPEG // required for libyuv.h to export MJPEG decode APIs +#include + +namespace { + +// Size of request/result metadata fast message queue. Change to 0 to always use hwbinder buffer. +constexpr size_t kMetadataMsgQueueSize = 1 << 18 /* 256kB */; + +} // anonymous namespace + +namespace android { +namespace hardware { +namespace camera { +namespace device { +namespace implementation { + +using ::aidl::android::hardware::camera::device::BufferStatus; +using ::aidl::android::hardware::camera::device::ErrorMsg; +using ::aidl::android::hardware::camera::device::ShutterMsg; +using ::aidl::android::hardware::camera::device::StreamBuffer; + +// Static instance +HandleImporter ExternalCameraOfflineSession::sHandleImporter; + +ExternalCameraOfflineSession::ExternalCameraOfflineSession( + const CroppingType& croppingType, const common::V1_0::helper::CameraMetadata& chars, + const std::string& cameraId, const std::string& exifMake, const std::string& exifModel, + uint32_t blobBufferSize, bool afTrigger, const std::vector& offlineStreams, + std::deque>& offlineReqs, + const std::map& circulatingBuffers) + : mCroppingType(croppingType), + mChars(chars), + mCameraId(cameraId), + mExifMake(exifMake), + mExifModel(exifModel), + mBlobBufferSize(blobBufferSize), + mAfTrigger(afTrigger), + mOfflineStreams(offlineStreams), + mOfflineReqs(offlineReqs), + mCirculatingBuffers(circulatingBuffers) {} + +ExternalCameraOfflineSession::~ExternalCameraOfflineSession() { + close(); +} + +bool ExternalCameraOfflineSession::initialize() { + mResultMetadataQueue = + std::make_shared(kMetadataMsgQueueSize, false /* non blocking */); + if (!mResultMetadataQueue->isValid()) { + ALOGE("%s: invalid result fmq", __FUNCTION__); + return true; + } + return false; +} + +Status ExternalCameraOfflineSession::importBuffer(int32_t streamId, uint64_t bufId, + buffer_handle_t buf, + buffer_handle_t** outBufPtr) { + Mutex::Autolock _l(mCbsLock); + return importBufferImpl(mCirculatingBuffers, sHandleImporter, streamId, bufId, buf, outBufPtr); +} + +Status ExternalCameraOfflineSession::processCaptureResult(std::shared_ptr& req) { + ATRACE_CALL(); + // Fill output buffers + std::vector results; + results.resize(1); + CaptureResult& result = results[0]; + result.frameNumber = req->frameNumber; + result.partialResult = 1; + result.inputBuffer.streamId = -1; + result.outputBuffers.resize(req->buffers.size()); + for (size_t i = 0; i < req->buffers.size(); i++) { + StreamBuffer& outputBuffer = result.outputBuffers[i]; + outputBuffer.streamId = req->buffers[i].streamId; + outputBuffer.bufferId = req->buffers[i].bufferId; + if (req->buffers[i].fenceTimeout) { + outputBuffer.status = BufferStatus::ERROR; + if (req->buffers[i].acquireFence >= 0) { + native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0); + handle->data[0] = req->buffers[i].acquireFence; + result.outputBuffers[i].releaseFence = android::makeToAidl(handle); + } + notifyError(req->frameNumber, req->buffers[i].streamId, ErrorCode::ERROR_BUFFER); + } else { + result.outputBuffers[i].status = BufferStatus::OK; + // TODO: refactor + if (req->buffers[i].acquireFence >= 0) { + native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0); + handle->data[0] = req->buffers[i].acquireFence; + outputBuffer.releaseFence = android::makeToAidl(handle); + } + } + } + + // Fill capture result metadata + fillCaptureResult(req->setting, req->shutterTs); + const camera_metadata_t* rawResult = req->setting.getAndLock(); + convertToAidl(rawResult, &result.result); + req->setting.unlock(rawResult); + + // Callback into framework + invokeProcessCaptureResultCallback(results, /* tryWriteFmq */ true); + freeReleaseFences(results); + return Status::OK; +} + +#define UPDATE(md, tag, data, size) \ + do { \ + if ((md).update((tag), (data), (size))) { \ + ALOGE("Update " #tag " failed!"); \ + return BAD_VALUE; \ + } \ + } while (0) + +status_t ExternalCameraOfflineSession::fillCaptureResult(common::V1_0::helper::CameraMetadata md, + nsecs_t timestamp) { + bool afTrigger = false; + { + std::lock_guard lk(mAfTriggerLock); + afTrigger = mAfTrigger; + if (md.exists(ANDROID_CONTROL_AF_TRIGGER)) { + camera_metadata_entry entry = md.find(ANDROID_CONTROL_AF_TRIGGER); + if (entry.data.u8[0] == ANDROID_CONTROL_AF_TRIGGER_START) { + mAfTrigger = afTrigger = true; + } else if (entry.data.u8[0] == ANDROID_CONTROL_AF_TRIGGER_CANCEL) { + mAfTrigger = afTrigger = false; + } + } + } + + // For USB camera, the USB camera handles everything and we don't have control + // over AF. We only simply fake the AF metadata based on the request + // received here. + uint8_t afState; + if (afTrigger) { + afState = ANDROID_CONTROL_AF_STATE_FOCUSED_LOCKED; + } else { + afState = ANDROID_CONTROL_AF_STATE_INACTIVE; + } + UPDATE(md, ANDROID_CONTROL_AF_STATE, &afState, 1); + + camera_metadata_ro_entry activeArraySize = mChars.find(ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE); + + return fillCaptureResultCommon(md, timestamp, activeArraySize); +} +void ExternalCameraOfflineSession::invokeProcessCaptureResultCallback( + std::vector& results, bool tryWriteFmq) { + if (mProcessCaptureResultLock.tryLock() != OK) { + const nsecs_t NS_TO_SECOND = 1E9; + ALOGV("%s: previous call is not finished! waiting 1s...", __FUNCTION__); + if (mProcessCaptureResultLock.timedLock(/* 1s */ NS_TO_SECOND) != OK) { + ALOGE("%s: cannot acquire lock in 1s, cannot proceed", __FUNCTION__); + return; + } + } + if (tryWriteFmq && mResultMetadataQueue->availableToWrite() > 0) { + for (CaptureResult& result : results) { + if (!result.result.metadata.empty()) { + if (mResultMetadataQueue->write( + reinterpret_cast(result.result.metadata.data()), + result.result.metadata.size())) { + result.fmqResultSize = result.result.metadata.size(); + result.result.metadata.clear(); + } else { + ALOGW("%s: couldn't utilize fmq, fall back to hwbinder", __FUNCTION__); + result.fmqResultSize = 0; + } + } else { + result.fmqResultSize = 0; + } + } + } + auto status = mCallback->processCaptureResult(results); + if (!status.isOk()) { + ALOGE("%s: processCaptureResult ERROR : %d:%d", __FUNCTION__, status.getExceptionCode(), + status.getServiceSpecificError()); + } + + mProcessCaptureResultLock.unlock(); +} + +Status ExternalCameraOfflineSession::processCaptureRequestError( + const std::shared_ptr& req, std::vector* outMsgs, + std::vector* outResults) { + ATRACE_CALL(); + + if (outMsgs == nullptr) { + notifyError(/*frameNum*/ req->frameNumber, /*stream*/ -1, ErrorCode::ERROR_REQUEST); + } else { + NotifyMsg shutter; + shutter.set(ShutterMsg{ + .frameNumber = req->frameNumber, + .timestamp = req->shutterTs, + }); + + NotifyMsg error; + error.set(ErrorMsg{.frameNumber = req->frameNumber, + .errorStreamId = -1, + .errorCode = ErrorCode::ERROR_REQUEST}); + outMsgs->push_back(shutter); + outMsgs->push_back(error); + } + + // Fill output buffers + CaptureResult result; + result.frameNumber = req->frameNumber; + result.partialResult = 1; + result.inputBuffer.streamId = -1; + result.outputBuffers.resize(req->buffers.size()); + for (size_t i = 0; i < req->buffers.size(); i++) { + StreamBuffer& outputBuffer = result.outputBuffers[i]; + outputBuffer.streamId = req->buffers[i].streamId; + outputBuffer.bufferId = req->buffers[i].bufferId; + outputBuffer.status = BufferStatus::ERROR; + if (req->buffers[i].acquireFence >= 0) { + native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0); + handle->data[0] = req->buffers[i].acquireFence; + outputBuffer.releaseFence = makeToAidl(handle); + } + } + + if (outResults == nullptr) { + // Callback into framework + std::vector results(1); + results[0] = std::move(result); + invokeProcessCaptureResultCallback(results, /* tryWriteFmq */ true); + freeReleaseFences(results); + } else { + outResults->push_back(std::move(result)); + } + return Status::OK; +} + +ssize_t ExternalCameraOfflineSession::getJpegBufferSize(int32_t, int32_t) const { + // Empty implementation here as the jpeg buffer size is passed in by ctor + return 0; +} + +void ExternalCameraOfflineSession::notifyError(int32_t frameNumber, int32_t streamId, + ErrorCode ec) { + NotifyMsg msg; + msg.set( + ErrorMsg{.frameNumber = frameNumber, .errorStreamId = streamId, .errorCode = ec}); + mCallback->notify({msg}); +} + +ScopedAStatus ExternalCameraOfflineSession::setCallback( + const std::shared_ptr& in_cb) { + Mutex::Autolock _il(mInterfaceLock); + if (mCallback != nullptr && in_cb != nullptr) { + ALOGE("%s: callback must not be set twice!", __FUNCTION__); + return fromStatus(Status::OK); + } + mCallback = in_cb; + + initOutputThread(); + + if (mOutputThread == nullptr) { + ALOGE("%s: init OutputThread failed!", __FUNCTION__); + } + return fromStatus(Status::OK); +} +void ExternalCameraOfflineSession::initOutputThread() { + if (mOutputThread != nullptr) { + ALOGE("%s: OutputThread already exist!", __FUNCTION__); + return; + } + + // Grab a shared_ptr to 'this' from ndk::SharedRefBase::ref() + std::shared_ptr thiz = ref(); + + mBufferRequestThread = std::make_shared( + /*parent=*/thiz, mCallback); + mBufferRequestThread->run(); + + mOutputThread = std::make_shared(/*parent=*/thiz, mCroppingType, mChars, + mBufferRequestThread, mOfflineReqs); + + mOutputThread->setExifMakeModel(mExifMake, mExifModel); + + Size inputSize = {mOfflineReqs[0]->frameIn->mWidth, mOfflineReqs[0]->frameIn->mHeight}; + Size maxThumbSize = getMaxThumbnailResolution(mChars); + mOutputThread->allocateIntermediateBuffers(inputSize, maxThumbSize, mOfflineStreams, + mBlobBufferSize); + + mOutputThread->run(); +} + +ScopedAStatus ExternalCameraOfflineSession::getCaptureResultMetadataQueue( + MQDescriptor* _aidl_return) { + Mutex::Autolock _il(mInterfaceLock); + *_aidl_return = mResultMetadataQueue->dupeDesc(); + return fromStatus(Status::OK); +} + +ScopedAStatus ExternalCameraOfflineSession::close() { + Mutex::Autolock _il(mInterfaceLock); + { + Mutex::Autolock _l(mLock); + if (mClosed) { + ALOGW("%s: offline session already closed!", __FUNCTION__); + return fromStatus(Status::OK); + } + } + if (mBufferRequestThread != nullptr) { + mBufferRequestThread->requestExitAndWait(); + mBufferRequestThread.reset(); + } + if (mOutputThread) { + mOutputThread->flush(); + mOutputThread->requestExitAndWait(); + mOutputThread.reset(); + } + + Mutex::Autolock _l(mLock); + // free all buffers + { + Mutex::Autolock _cbl(mCbsLock); + for (auto& stream : mOfflineStreams) { + cleanupBuffersLocked(stream.id); + } + } + mCallback.reset(); + mClosed = true; + return fromStatus(Status::OK); +} +void ExternalCameraOfflineSession::cleanupBuffersLocked(int32_t id) { + for (auto& pair : mCirculatingBuffers.at(id)) { + sHandleImporter.freeBuffer(pair.second); + } + mCirculatingBuffers[id].clear(); + mCirculatingBuffers.erase(id); +} + +bool ExternalCameraOfflineSession::OutputThread::threadLoop() { + auto parent = mParent.lock(); + if (parent == nullptr) { + ALOGE("%s: session has been disconnected!", __FUNCTION__); + return false; + } + + if (mOfflineReqs.empty()) { + ALOGI("%s: all offline requests are processed. Stopping.", __FUNCTION__); + return false; + } + + std::shared_ptr req = mOfflineReqs.front(); + mOfflineReqs.pop_front(); + + auto onDeviceError = [&](auto... args) { + ALOGE(args...); + parent->notifyError(req->frameNumber, /*stream*/ -1, ErrorCode::ERROR_DEVICE); + signalRequestDone(); + return false; + }; + + if (req->frameIn->mFourcc != V4L2_PIX_FMT_MJPEG && req->frameIn->mFourcc != V4L2_PIX_FMT_Z16) { + return onDeviceError("%s: do not support V4L2 format %c%c%c%c", __FUNCTION__, + req->frameIn->mFourcc & 0xFF, (req->frameIn->mFourcc >> 8) & 0xFF, + (req->frameIn->mFourcc >> 16) & 0xFF, + (req->frameIn->mFourcc >> 24) & 0xFF); + } + + int res = requestBufferStart(req->buffers); + if (res != 0) { + ALOGE("%s: send BufferRequest failed! res %d", __FUNCTION__, res); + return onDeviceError("%s: failed to send buffer request!", __FUNCTION__); + } + + std::unique_lock lk(mBufferLock); + // Convert input V4L2 frame to YU12 of the same size + // TODO: see if we can save some computation by converting to YV12 here + uint8_t* inData; + size_t inDataSize; + if (req->frameIn->getData(&inData, &inDataSize) != 0) { + lk.unlock(); + return onDeviceError("%s: V4L2 buffer map failed", __FUNCTION__); + } + + // TODO: in some special case maybe we can decode jpg directly to gralloc output? + if (req->frameIn->mFourcc == V4L2_PIX_FMT_MJPEG) { + ATRACE_BEGIN("MJPGtoI420"); + int convRes = libyuv::MJPGToI420( + inData, inDataSize, static_cast(mYu12FrameLayout.y), + mYu12FrameLayout.yStride, static_cast(mYu12FrameLayout.cb), + mYu12FrameLayout.cStride, static_cast(mYu12FrameLayout.cr), + mYu12FrameLayout.cStride, mYu12Frame->mWidth, mYu12Frame->mHeight, + mYu12Frame->mWidth, mYu12Frame->mHeight); + ATRACE_END(); + + if (convRes != 0) { + // For some webcam, the first few V4L2 frames might be malformed... + ALOGE("%s: Convert V4L2 frame to YU12 failed! res %d", __FUNCTION__, convRes); + lk.unlock(); + Status st = parent->processCaptureRequestError(req); + if (st != Status::OK) { + return onDeviceError("%s: failed to process capture request error!", __FUNCTION__); + } + signalRequestDone(); + return true; + } + } + + ATRACE_BEGIN("Wait for BufferRequest done"); + res = waitForBufferRequestDone(&req->buffers); + ATRACE_END(); + + if (res != 0) { + ALOGE("%s: wait for BufferRequest done failed! res %d", __FUNCTION__, res); + lk.unlock(); + return onDeviceError("%s: failed to process buffer request error!", __FUNCTION__); + } + + ALOGV("%s processing new request", __FUNCTION__); + const int kSyncWaitTimeoutMs = 500; + for (auto& halBuf : req->buffers) { + if (*(halBuf.bufPtr) == nullptr) { + ALOGW("%s: buffer for stream %d missing", __FUNCTION__, halBuf.streamId); + halBuf.fenceTimeout = true; + } else if (halBuf.acquireFence >= 0) { + int ret = sync_wait(halBuf.acquireFence, kSyncWaitTimeoutMs); + if (ret) { + halBuf.fenceTimeout = true; + } else { + ::close(halBuf.acquireFence); + halBuf.acquireFence = -1; + } + } + + if (halBuf.fenceTimeout) { + continue; + } + + // Gralloc lockYCbCr the buffer + switch (halBuf.format) { + case PixelFormat::BLOB: { + int ret = createJpegLocked(halBuf, req->setting); + + if (ret != 0) { + lk.unlock(); + return onDeviceError("%s: createJpegLocked failed with %d", __FUNCTION__, ret); + } + } break; + case PixelFormat::Y16: { + void* outLayout = sHandleImporter.lock( + *(halBuf.bufPtr), static_cast(halBuf.usage), inDataSize); + + std::memcpy(outLayout, inData, inDataSize); + + int relFence = sHandleImporter.unlock(*(halBuf.bufPtr)); + if (relFence >= 0) { + halBuf.acquireFence = relFence; + } + } break; + case PixelFormat::YCBCR_420_888: + case PixelFormat::YV12: { + IMapper::Rect outRect{0, 0, static_cast(halBuf.width), + static_cast(halBuf.height)}; + YCbCrLayout outLayout = sHandleImporter.lockYCbCr( + *(halBuf.bufPtr), static_cast(halBuf.usage), outRect); + ALOGV("%s: outLayout y %p cb %p cr %p y_str %d c_str %d c_step %d", __FUNCTION__, + outLayout.y, outLayout.cb, outLayout.cr, outLayout.yStride, outLayout.cStride, + outLayout.chromaStep); + + // Convert to output buffer size/format + uint32_t outputFourcc = getFourCcFromLayout(outLayout); + ALOGV("%s: converting to format %c%c%c%c", __FUNCTION__, outputFourcc & 0xFF, + (outputFourcc >> 8) & 0xFF, (outputFourcc >> 16) & 0xFF, + (outputFourcc >> 24) & 0xFF); + + YCbCrLayout cropAndScaled; + ATRACE_BEGIN("cropAndScaleLocked"); + int ret = cropAndScaleLocked(mYu12Frame, Size{halBuf.width, halBuf.height}, + &cropAndScaled); + ATRACE_END(); + if (ret != 0) { + lk.unlock(); + return onDeviceError("%s: crop and scale failed!", __FUNCTION__); + } + + Size sz{halBuf.width, halBuf.height}; + ATRACE_BEGIN("formatConvert"); + ret = formatConvert(cropAndScaled, outLayout, sz, outputFourcc); + ATRACE_END(); + if (ret != 0) { + lk.unlock(); + return onDeviceError("%s: format coversion failed!", __FUNCTION__); + } + int relFence = sHandleImporter.unlock(*(halBuf.bufPtr)); + if (relFence >= 0) { + halBuf.acquireFence = relFence; + } + } break; + default: + lk.unlock(); + return onDeviceError("%s: unknown output format %x", __FUNCTION__, halBuf.format); + } + } // for each buffer + mScaledYu12Frames.clear(); + + // Don't hold the lock while calling back to parent + lk.unlock(); + Status st = parent->processCaptureResult(req); + if (st != Status::OK) { + return onDeviceError("%s: failed to process capture result!", __FUNCTION__); + } + signalRequestDone(); + return true; +} + +} // namespace implementation +} // namespace device +} // namespace camera +} // namespace hardware +} // namespace android \ No newline at end of file diff --git a/camera/device/default/ExternalCameraOfflineSession.h b/camera/device/default/ExternalCameraOfflineSession.h new file mode 100644 index 0000000000..5795c95bd0 --- /dev/null +++ b/camera/device/default/ExternalCameraOfflineSession.h @@ -0,0 +1,143 @@ +/* + * 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. + */ + +#ifndef HARDWARE_INTERFACES_CAMERA_DEVICE_DEFAULT_EXTERNALCAMERAOFFLINESESSION_H_ +#define HARDWARE_INTERFACES_CAMERA_DEVICE_DEFAULT_EXTERNALCAMERAOFFLINESESSION_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace camera { +namespace device { +namespace implementation { + +using ::aidl::android::hardware::camera::common::Status; +using ::aidl::android::hardware::camera::device::BnCameraOfflineSession; +using ::aidl::android::hardware::camera::device::ICameraDeviceCallback; +using ::aidl::android::hardware::camera::device::Stream; +using ::aidl::android::hardware::common::fmq::MQDescriptor; +using ::aidl::android::hardware::common::fmq::SynchronizedReadWrite; + +class ExternalCameraOfflineSession : public BnCameraOfflineSession, + public virtual RefBase, + public virtual OutputThreadInterface { + public: + ExternalCameraOfflineSession(const CroppingType& croppingType, + const common::V1_0::helper::CameraMetadata& chars, + const std::string& cameraId, const std::string& exifMake, + const std::string& exifModel, uint32_t blobBufferSize, + bool afTrigger, const std::vector& offlineStreams, + std::deque>& offlineReqs, + const std::map& circulatingBuffers); + + ~ExternalCameraOfflineSession() override; + + bool initialize(); + + // Methods from OutputThreadInterface + Status importBuffer(int32_t streamId, uint64_t bufId, buffer_handle_t buf, + /*out*/ buffer_handle_t** outBufPtr) override; + + Status processCaptureResult(std::shared_ptr&) override; + + Status processCaptureRequestError(const std::shared_ptr&, + /*out*/ std::vector* msgs, + /*out*/ std::vector* results) override; + + ssize_t getJpegBufferSize(int32_t width, int32_t height) const override; + + void notifyError(int32_t frameNumber, int32_t streamId, ErrorCode ec) override; + // End of OutputThreadInterface methods + + ScopedAStatus setCallback(const std::shared_ptr& in_cb) override; + ScopedAStatus getCaptureResultMetadataQueue( + MQDescriptor* _aidl_return) override; + ScopedAStatus close() override; + + private: + class OutputThread : public ExternalCameraDeviceSession::OutputThread { + public: + OutputThread(std::weak_ptr parent, CroppingType ct, + const common::V1_0::helper::CameraMetadata& chars, + std::shared_ptr bufReqThread, + std::deque>& offlineReqs) + : ExternalCameraDeviceSession::OutputThread(std::move(parent), ct, chars, + std::move(bufReqThread)), + mOfflineReqs(offlineReqs) {} + + bool threadLoop() override; + + protected: + std::deque> mOfflineReqs; + }; // OutputThread + + status_t fillCaptureResult(common::V1_0::helper::CameraMetadata md, nsecs_t timestamp); + void invokeProcessCaptureResultCallback(std::vector& results, bool tryWriteFmq); + void initOutputThread(); + void cleanupBuffersLocked(int32_t id); + + // Protect (most of) HIDL interface methods from synchronized-entering + mutable Mutex mInterfaceLock; + + mutable Mutex mLock; // Protect all data members except otherwise noted + + bool mClosed = false; + const CroppingType mCroppingType; + const common::V1_0::helper::CameraMetadata mChars; + const std::string mCameraId; + const std::string mExifMake; + const std::string mExifModel; + const uint32_t mBlobBufferSize; + + std::mutex mAfTriggerLock; // protect mAfTrigger + bool mAfTrigger; + + const std::vector mOfflineStreams; + std::deque> mOfflineReqs; + + // Protect mCirculatingBuffers, must not lock mLock after acquiring this lock + mutable Mutex mCbsLock; + std::map mCirculatingBuffers; + + static HandleImporter sHandleImporter; + + using ResultMetadataQueue = AidlMessageQueue; + std::shared_ptr mResultMetadataQueue; + + // Protect against invokeProcessCaptureResultCallback() + Mutex mProcessCaptureResultLock; + + std::shared_ptr mCallback; + + std::shared_ptr mBufferRequestThread; + std::shared_ptr mOutputThread; +}; + +} // namespace implementation +} // namespace device +} // namespace camera +} // namespace hardware +} // namespace android + +#endif // HARDWARE_INTERFACES_CAMERA_DEVICE_DEFAULT_EXTERNALCAMERAOFFLINESESSION_H_ diff --git a/camera/device/default/ExternalCameraUtils.cpp b/camera/device/default/ExternalCameraUtils.cpp new file mode 100644 index 0000000000..cfb95f2a4d --- /dev/null +++ b/camera/device/default/ExternalCameraUtils.cpp @@ -0,0 +1,860 @@ +/* + * 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. + */ + +#define LOG_TAG "ExtCamUtils" +// #define LOG_NDEBUG 0 + +#include "ExternalCameraUtils.h" + +#include +#include +#include +#include +#include +#include +#include + +#define HAVE_JPEG // required for libyuv.h to export MJPEG decode APIs +#include + +namespace android { +namespace hardware { +namespace camera { + +namespace external { +namespace common { + +namespace { +const int kDefaultCameraIdOffset = 100; +const int kDefaultJpegBufSize = 5 << 20; // 5MB +const int kDefaultNumVideoBuffer = 4; +const int kDefaultNumStillBuffer = 2; +const int kDefaultOrientation = 0; // suitable for natural landscape displays like tablet/TV + // For phone devices 270 is better +} // anonymous namespace + +const char* ExternalCameraConfig::kDefaultCfgPath = "/vendor/etc/external_camera_config.xml"; + +ExternalCameraConfig ExternalCameraConfig::loadFromCfg(const char* cfgPath) { + using namespace tinyxml2; + ExternalCameraConfig ret; + + XMLDocument configXml; + XMLError err = configXml.LoadFile(cfgPath); + if (err != XML_SUCCESS) { + ALOGE("%s: Unable to load external camera config file '%s'. Error: %s", __FUNCTION__, + cfgPath, XMLDocument::ErrorIDToName(err)); + return ret; + } else { + ALOGI("%s: load external camera config succeeded!", __FUNCTION__); + } + + XMLElement* extCam = configXml.FirstChildElement("ExternalCamera"); + if (extCam == nullptr) { + ALOGI("%s: no external camera config specified", __FUNCTION__); + return ret; + } + + XMLElement* providerCfg = extCam->FirstChildElement("Provider"); + if (providerCfg == nullptr) { + ALOGI("%s: no external camera provider config specified", __FUNCTION__); + return ret; + } + + XMLElement* cameraIdOffset = providerCfg->FirstChildElement("CameraIdOffset"); + if (cameraIdOffset != nullptr) { + ret.cameraIdOffset = std::atoi(cameraIdOffset->GetText()); + } + + XMLElement* ignore = providerCfg->FirstChildElement("ignore"); + if (ignore == nullptr) { + ALOGI("%s: no internal ignored device specified", __FUNCTION__); + return ret; + } + + XMLElement* id = ignore->FirstChildElement("id"); + while (id != nullptr) { + const char* text = id->GetText(); + if (text != nullptr) { + ret.mInternalDevices.insert(text); + ALOGI("%s: device %s will be ignored by external camera provider", __FUNCTION__, text); + } + id = id->NextSiblingElement("id"); + } + + XMLElement* deviceCfg = extCam->FirstChildElement("Device"); + if (deviceCfg == nullptr) { + ALOGI("%s: no external camera device config specified", __FUNCTION__); + return ret; + } + + XMLElement* jpegBufSz = deviceCfg->FirstChildElement("MaxJpegBufferSize"); + if (jpegBufSz == nullptr) { + ALOGI("%s: no max jpeg buffer size specified", __FUNCTION__); + } else { + ret.maxJpegBufSize = jpegBufSz->UnsignedAttribute("bytes", /*Default*/ kDefaultJpegBufSize); + } + + XMLElement* numVideoBuf = deviceCfg->FirstChildElement("NumVideoBuffers"); + if (numVideoBuf == nullptr) { + ALOGI("%s: no num video buffers specified", __FUNCTION__); + } else { + ret.numVideoBuffers = + numVideoBuf->UnsignedAttribute("count", /*Default*/ kDefaultNumVideoBuffer); + } + + XMLElement* numStillBuf = deviceCfg->FirstChildElement("NumStillBuffers"); + if (numStillBuf == nullptr) { + ALOGI("%s: no num still buffers specified", __FUNCTION__); + } else { + ret.numStillBuffers = + numStillBuf->UnsignedAttribute("count", /*Default*/ kDefaultNumStillBuffer); + } + + XMLElement* fpsList = deviceCfg->FirstChildElement("FpsList"); + if (fpsList == nullptr) { + ALOGI("%s: no fps list specified", __FUNCTION__); + } else { + if (!updateFpsList(fpsList, ret.fpsLimits)) { + return ret; + } + } + + XMLElement* depth = deviceCfg->FirstChildElement("Depth16Supported"); + if (depth == nullptr) { + ret.depthEnabled = false; + ALOGI("%s: depth output is not enabled", __FUNCTION__); + } else { + ret.depthEnabled = depth->BoolAttribute("enabled", false); + } + + if (ret.depthEnabled) { + XMLElement* depthFpsList = deviceCfg->FirstChildElement("DepthFpsList"); + if (depthFpsList == nullptr) { + ALOGW("%s: no depth fps list specified", __FUNCTION__); + } else { + if (!updateFpsList(depthFpsList, ret.depthFpsLimits)) { + return ret; + } + } + } + + XMLElement* minStreamSize = deviceCfg->FirstChildElement("MinimumStreamSize"); + if (minStreamSize == nullptr) { + ALOGI("%s: no minimum stream size specified", __FUNCTION__); + } else { + ret.minStreamSize = { + static_cast(minStreamSize->UnsignedAttribute("width", /*Default*/ 0)), + static_cast(minStreamSize->UnsignedAttribute("height", /*Default*/ 0))}; + } + + XMLElement* orientation = deviceCfg->FirstChildElement("Orientation"); + if (orientation == nullptr) { + ALOGI("%s: no sensor orientation specified", __FUNCTION__); + } else { + ret.orientation = orientation->IntAttribute("degree", /*Default*/ kDefaultOrientation); + } + + ALOGI("%s: external camera cfg loaded: maxJpgBufSize %d," + " num video buffers %d, num still buffers %d, orientation %d", + __FUNCTION__, ret.maxJpegBufSize, ret.numVideoBuffers, ret.numStillBuffers, + ret.orientation); + for (const auto& limit : ret.fpsLimits) { + ALOGI("%s: fpsLimitList: %dx%d@%f", __FUNCTION__, limit.size.width, limit.size.height, + limit.fpsUpperBound); + } + for (const auto& limit : ret.depthFpsLimits) { + ALOGI("%s: depthFpsLimitList: %dx%d@%f", __FUNCTION__, limit.size.width, limit.size.height, + limit.fpsUpperBound); + } + ALOGI("%s: minStreamSize: %dx%d", __FUNCTION__, ret.minStreamSize.width, + ret.minStreamSize.height); + return ret; +} + +bool ExternalCameraConfig::updateFpsList(tinyxml2::XMLElement* fpsList, + std::vector& fpsLimits) { + using namespace tinyxml2; + std::vector limits; + XMLElement* row = fpsList->FirstChildElement("Limit"); + while (row != nullptr) { + FpsLimitation prevLimit{{0, 0}, 1000.0}; + FpsLimitation limit = { + {/* width */ static_cast(row->UnsignedAttribute("width", /*Default*/ 0)), + /* height */ static_cast( + row->UnsignedAttribute("height", /*Default*/ 0))}, + /* fpsUpperBound */ row->DoubleAttribute("fpsBound", /*Default*/ 1000.0)}; + if (limit.size.width <= prevLimit.size.width || + limit.size.height <= prevLimit.size.height || + limit.fpsUpperBound >= prevLimit.fpsUpperBound) { + ALOGE("%s: FPS limit list must have increasing size and decreasing fps!" + " Prev %dx%d@%f, Current %dx%d@%f", + __FUNCTION__, prevLimit.size.width, prevLimit.size.height, + prevLimit.fpsUpperBound, limit.size.width, limit.size.height, + limit.fpsUpperBound); + return false; + } + limits.push_back(limit); + row = row->NextSiblingElement("Limit"); + } + fpsLimits = limits; + return true; +} + +ExternalCameraConfig::ExternalCameraConfig() + : cameraIdOffset(kDefaultCameraIdOffset), + maxJpegBufSize(kDefaultJpegBufSize), + numVideoBuffers(kDefaultNumVideoBuffer), + numStillBuffers(kDefaultNumStillBuffer), + depthEnabled(false), + orientation(kDefaultOrientation) { + fpsLimits.push_back({/* size */ {/* width */ 640, /* height */ 480}, /* fpsUpperBound */ 30.0}); + fpsLimits.push_back({/* size */ {/* width */ 1280, /* height */ 720}, /* fpsUpperBound */ 7.5}); + fpsLimits.push_back( + {/* size */ {/* width */ 1920, /* height */ 1080}, /* fpsUpperBound */ 5.0}); + minStreamSize = {0, 0}; +} + +} // namespace common +} // namespace external + +namespace device { +namespace implementation { + +double SupportedV4L2Format::FrameRate::getFramesPerSecond() const { + return static_cast(durationDenominator) / durationNumerator; +} + +Frame::Frame(uint32_t width, uint32_t height, uint32_t fourcc) + : mWidth(width), mHeight(height), mFourcc(fourcc) {} +Frame::~Frame() {} + +V4L2Frame::V4L2Frame(uint32_t w, uint32_t h, uint32_t fourcc, int bufIdx, int fd, uint32_t dataSize, + uint64_t offset) + : Frame(w, h, fourcc), mBufferIndex(bufIdx), mFd(fd), mDataSize(dataSize), mOffset(offset) {} + +V4L2Frame::~V4L2Frame() { + unmap(); +} + +int V4L2Frame::getData(uint8_t** outData, size_t* dataSize) { + return map(outData, dataSize); +} + +int V4L2Frame::map(uint8_t** data, size_t* dataSize) { + if (data == nullptr || dataSize == nullptr) { + ALOGI("%s: V4L2 buffer map bad argument: data %p, dataSize %p", __FUNCTION__, data, + dataSize); + return -EINVAL; + } + + std::lock_guard lk(mLock); + if (!mMapped) { + void* addr = mmap(nullptr, mDataSize, PROT_READ, MAP_SHARED, mFd, mOffset); + if (addr == MAP_FAILED) { + ALOGE("%s: V4L2 buffer map failed: %s", __FUNCTION__, strerror(errno)); + return -EINVAL; + } + mData = static_cast(addr); + mMapped = true; + } + *data = mData; + *dataSize = mDataSize; + ALOGV("%s: V4L map FD %d, data %p size %zu", __FUNCTION__, mFd, mData, mDataSize); + return 0; +} + +int V4L2Frame::unmap() { + std::lock_guard lk(mLock); + if (mMapped) { + ALOGV("%s: V4L unmap data %p size %zu", __FUNCTION__, mData, mDataSize); + if (munmap(mData, mDataSize) != 0) { + ALOGE("%s: V4L2 buffer unmap failed: %s", __FUNCTION__, strerror(errno)); + return -EINVAL; + } + mMapped = false; + } + return 0; +} + +AllocatedFrame::AllocatedFrame(uint32_t w, uint32_t h) : Frame(w, h, V4L2_PIX_FMT_YUV420) {} +AllocatedFrame::~AllocatedFrame() {} + +int AllocatedFrame::getData(uint8_t** outData, size_t* dataSize) { + YCbCrLayout layout; + int ret = allocate(&layout); + if (ret != 0) { + return ret; + } + *outData = mData.data(); + *dataSize = mBufferSize; + return 0; +} + +int AllocatedFrame::allocate(YCbCrLayout* out) { + std::lock_guard lk(mLock); + if ((mWidth % 2) || (mHeight % 2)) { + ALOGE("%s: bad dimension %dx%d (not multiple of 2)", __FUNCTION__, mWidth, mHeight); + return -EINVAL; + } + + // This frame might be sent to jpeglib to be encoded. Since AllocatedFrame only contains YUV420, + // jpeglib expects height and width of Y component to be an integral multiple of 2*DCTSIZE, + // and heights and widths of Cb and Cr components to be an integral multiple of DCTSIZE. If the + // image size does not meet this requirement, libjpeg expects its input to be padded to meet the + // constraints. This padding is removed from the final encoded image so the content in the + // padding doesn't matter. What matters is that the memory is accessible to jpeglib at the time + // of encoding. + // For example, if the image size is 1500x844 and DCTSIZE is 8, jpeglib expects a YUV 420 + // frame with components of following sizes: + // Y: 1504x848 because 1504 and 848 are the next smallest multiples of 2*8 + // Cb/Cr: 752x424 which are the next smallest multiples of 8 + + // jpeglib takes an array of row pointers which makes vertical padding trivial when setting up + // the pointers. Padding horizontally is a bit more complicated. AllocatedFrame holds the data + // in a flattened buffer, which means memory accesses past a row will flow into the next logical + // row. For any row of a component, we can consider the first few bytes of the next row as + // padding for the current one. This is true for Y and Cb components and all but last row of the + // Cr component. Reading past the last row of Cr component will lead to undefined behavior as + // libjpeg attempts to read memory past the allocated buffer. To prevent undefined behavior, + // the buffer allocated here is padded such that libjpeg never accesses unallocated memory when + // reading the last row. Effectively, we only need to ensure that the last row of Cr component + // has width that is an integral multiple of DCTSIZE. + + size_t dataSize = mWidth * mHeight * 3 / 2; // YUV420 + + size_t cbWidth = mWidth / 2; + size_t requiredCbWidth = DCTSIZE * ((cbWidth + DCTSIZE - 1) / DCTSIZE); + size_t padding = requiredCbWidth - cbWidth; + size_t finalSize = dataSize + padding; + + if (mData.size() != finalSize) { + mData.resize(finalSize); + mBufferSize = dataSize; + } + + if (out != nullptr) { + out->y = mData.data(); + out->yStride = mWidth; + uint8_t* cbStart = mData.data() + mWidth * mHeight; + uint8_t* crStart = cbStart + mWidth * mHeight / 4; + out->cb = cbStart; + out->cr = crStart; + out->cStride = mWidth / 2; + out->chromaStep = 1; + } + return 0; +} + +int AllocatedFrame::getLayout(YCbCrLayout* out) { + IMapper::Rect noCrop = {0, 0, static_cast(mWidth), static_cast(mHeight)}; + return getCroppedLayout(noCrop, out); +} + +int AllocatedFrame::getCroppedLayout(const IMapper::Rect& rect, YCbCrLayout* out) { + if (out == nullptr) { + ALOGE("%s: null out", __FUNCTION__); + return -1; + } + + std::lock_guard lk(mLock); + if ((rect.left + rect.width) > static_cast(mWidth) || + (rect.top + rect.height) > static_cast(mHeight) || (rect.left % 2) || (rect.top % 2) || + (rect.width % 2) || (rect.height % 2)) { + ALOGE("%s: bad rect left %d top %d w %d h %d", __FUNCTION__, rect.left, rect.top, + rect.width, rect.height); + return -1; + } + + out->y = mData.data() + mWidth * rect.top + rect.left; + out->yStride = mWidth; + uint8_t* cbStart = mData.data() + mWidth * mHeight; + uint8_t* crStart = cbStart + mWidth * mHeight / 4; + out->cb = cbStart + mWidth * rect.top / 4 + rect.left / 2; + out->cr = crStart + mWidth * rect.top / 4 + rect.left / 2; + out->cStride = mWidth / 2; + out->chromaStep = 1; + return 0; +} + +bool isAspectRatioClose(float ar1, float ar2) { + constexpr float kAspectRatioMatchThres = 0.025f; // This threshold is good enough to + // distinguish 4:3/16:9/20:9 1.33/1.78/2 + return std::abs(ar1 - ar2) < kAspectRatioMatchThres; +} + +aidl::android::hardware::camera::common::Status importBufferImpl( + /*inout*/ std::map& circulatingBuffers, + /*inout*/ HandleImporter& handleImporter, int32_t streamId, uint64_t bufId, + buffer_handle_t buf, + /*out*/ buffer_handle_t** outBufPtr) { + using ::aidl::android::hardware::camera::common::Status; + if (buf == nullptr && bufId == BUFFER_ID_NO_BUFFER) { + ALOGE("%s: bufferId %" PRIu64 " has null buffer handle!", __FUNCTION__, bufId); + return Status::ILLEGAL_ARGUMENT; + } + + CirculatingBuffers& cbs = circulatingBuffers[streamId]; + if (cbs.count(bufId) == 0) { + if (buf == nullptr) { + ALOGE("%s: bufferId %" PRIu64 " has null buffer handle!", __FUNCTION__, bufId); + return Status::ILLEGAL_ARGUMENT; + } + // Register a newly seen buffer + buffer_handle_t importedBuf = buf; + handleImporter.importBuffer(importedBuf); + if (importedBuf == nullptr) { + ALOGE("%s: output buffer for stream %d is invalid!", __FUNCTION__, streamId); + return Status::INTERNAL_ERROR; + } else { + cbs[bufId] = importedBuf; + } + } + *outBufPtr = &cbs[bufId]; + return Status::OK; +} + +uint32_t getFourCcFromLayout(const YCbCrLayout& layout) { + intptr_t cb = reinterpret_cast(layout.cb); + intptr_t cr = reinterpret_cast(layout.cr); + if (std::abs(cb - cr) == 1 && layout.chromaStep == 2) { + // Interleaved format + if (layout.cb > layout.cr) { + return V4L2_PIX_FMT_NV21; + } else { + return V4L2_PIX_FMT_NV12; + } + } else if (layout.chromaStep == 1) { + // Planar format + if (layout.cb > layout.cr) { + return V4L2_PIX_FMT_YVU420; // YV12 + } else { + return V4L2_PIX_FMT_YUV420; // YU12 + } + } else { + return FLEX_YUV_GENERIC; + } +} + +int getCropRect(CroppingType ct, const Size& inSize, const Size& outSize, IMapper::Rect* out) { + if (out == nullptr) { + ALOGE("%s: out is null", __FUNCTION__); + return -1; + } + + uint32_t inW = inSize.width; + uint32_t inH = inSize.height; + uint32_t outW = outSize.width; + uint32_t outH = outSize.height; + + // Handle special case where aspect ratio is close to input but scaled + // dimension is slightly larger than input + float arIn = ASPECT_RATIO(inSize); + float arOut = ASPECT_RATIO(outSize); + if (isAspectRatioClose(arIn, arOut)) { + out->left = 0; + out->top = 0; + out->width = static_cast(inW); + out->height = static_cast(inH); + return 0; + } + + if (ct == VERTICAL) { + uint64_t scaledOutH = static_cast(outH) * inW / outW; + if (scaledOutH > inH) { + ALOGE("%s: Output size %dx%d cannot be vertically cropped from input size %dx%d", + __FUNCTION__, outW, outH, inW, inH); + return -1; + } + scaledOutH = scaledOutH & ~0x1; // make it multiple of 2 + + out->left = 0; + out->top = static_cast((inH - scaledOutH) / 2) & ~0x1; + out->width = static_cast(inW); + out->height = static_cast(scaledOutH); + ALOGV("%s: crop %dx%d to %dx%d: top %d, scaledH %d", __FUNCTION__, inW, inH, outW, outH, + out->top, static_cast(scaledOutH)); + } else { + uint64_t scaledOutW = static_cast(outW) * inH / outH; + if (scaledOutW > inW) { + ALOGE("%s: Output size %dx%d cannot be horizontally cropped from input size %dx%d", + __FUNCTION__, outW, outH, inW, inH); + return -1; + } + scaledOutW = scaledOutW & ~0x1; // make it multiple of 2 + + out->left = static_cast((inW - scaledOutW) / 2) & ~0x1; + out->top = 0; + out->width = static_cast(scaledOutW); + out->height = static_cast(inH); + ALOGV("%s: crop %dx%d to %dx%d: top %d, scaledW %d", __FUNCTION__, inW, inH, outW, outH, + out->top, static_cast(scaledOutW)); + } + + return 0; +} + +int formatConvert(const YCbCrLayout& in, const YCbCrLayout& out, Size sz, uint32_t format) { + int ret = 0; + switch (format) { + case V4L2_PIX_FMT_NV21: + ret = libyuv::I420ToNV21( + static_cast(in.y), static_cast(in.yStride), + static_cast(in.cb), static_cast(in.cStride), + static_cast(in.cr), static_cast(in.cStride), + static_cast(out.y), static_cast(out.yStride), + static_cast(out.cr), static_cast(out.cStride), + static_cast(sz.width), static_cast(sz.height)); + if (ret != 0) { + ALOGE("%s: convert to NV21 buffer failed! ret %d", __FUNCTION__, ret); + return ret; + } + break; + case V4L2_PIX_FMT_NV12: + ret = libyuv::I420ToNV12( + static_cast(in.y), static_cast(in.yStride), + static_cast(in.cb), static_cast(in.cStride), + static_cast(in.cr), static_cast(in.cStride), + static_cast(out.y), static_cast(out.yStride), + static_cast(out.cb), static_cast(out.cStride), + static_cast(sz.width), static_cast(sz.height)); + if (ret != 0) { + ALOGE("%s: convert to NV12 buffer failed! ret %d", __FUNCTION__, ret); + return ret; + } + break; + case V4L2_PIX_FMT_YVU420: // YV12 + case V4L2_PIX_FMT_YUV420: // YU12 + // TODO: maybe we can speed up here by somehow save this copy? + ret = libyuv::I420Copy(static_cast(in.y), static_cast(in.yStride), + static_cast(in.cb), static_cast(in.cStride), + static_cast(in.cr), static_cast(in.cStride), + static_cast(out.y), static_cast(out.yStride), + static_cast(out.cb), static_cast(out.cStride), + static_cast(out.cr), static_cast(out.cStride), + static_cast(sz.width), static_cast(sz.height)); + if (ret != 0) { + ALOGE("%s: copy to YV12 or YU12 buffer failed! ret %d", __FUNCTION__, ret); + return ret; + } + break; + case FLEX_YUV_GENERIC: + // TODO: b/72261744 write to arbitrary flexible YUV layout. Slow. + ALOGE("%s: unsupported flexible yuv layout" + " y %p cb %p cr %p y_str %d c_str %d c_step %d", + __FUNCTION__, out.y, out.cb, out.cr, out.yStride, out.cStride, out.chromaStep); + return -1; + default: + ALOGE("%s: unknown YUV format 0x%x!", __FUNCTION__, format); + return -1; + } + return 0; +} + +int encodeJpegYU12(const Size& inSz, const YCbCrLayout& inLayout, int jpegQuality, + const void* app1Buffer, size_t app1Size, void* out, size_t maxOutSize, + size_t& actualCodeSize) { + /* libjpeg is a C library so we use C-style "inheritance" by + * putting libjpeg's jpeg_destination_mgr first in our custom + * struct. This allows us to cast jpeg_destination_mgr* to + * CustomJpegDestMgr* when we get it passed to us in a callback */ + struct CustomJpegDestMgr { + struct jpeg_destination_mgr mgr; + JOCTET* mBuffer; + size_t mBufferSize; + size_t mEncodedSize; + bool mSuccess; + } dmgr; + + jpeg_compress_struct cinfo = {}; + jpeg_error_mgr jerr; + + /* Initialize error handling with standard callbacks, but + * then override output_message (to print to ALOG) and + * error_exit to set a flag and print a message instead + * of killing the whole process */ + cinfo.err = jpeg_std_error(&jerr); + + cinfo.err->output_message = [](j_common_ptr cinfo) { + char buffer[JMSG_LENGTH_MAX]; + + /* Create the message */ + (*cinfo->err->format_message)(cinfo, buffer); + ALOGE("libjpeg error: %s", buffer); + }; + cinfo.err->error_exit = [](j_common_ptr cinfo) { + (*cinfo->err->output_message)(cinfo); + if (cinfo->client_data) { + auto& dmgr = *reinterpret_cast(cinfo->client_data); + dmgr.mSuccess = false; + } + }; + + /* Now that we initialized some callbacks, let's create our compressor */ + jpeg_create_compress(&cinfo); + + /* Initialize our destination manager */ + dmgr.mBuffer = static_cast(out); + dmgr.mBufferSize = maxOutSize; + dmgr.mEncodedSize = 0; + dmgr.mSuccess = true; + cinfo.client_data = static_cast(&dmgr); + + /* These lambdas become C-style function pointers and as per C++11 spec + * may not capture anything */ + dmgr.mgr.init_destination = [](j_compress_ptr cinfo) { + auto& dmgr = reinterpret_cast(*cinfo->dest); + dmgr.mgr.next_output_byte = dmgr.mBuffer; + dmgr.mgr.free_in_buffer = dmgr.mBufferSize; + ALOGV("%s:%d jpeg start: %p [%zu]", __FUNCTION__, __LINE__, dmgr.mBuffer, dmgr.mBufferSize); + }; + + dmgr.mgr.empty_output_buffer = [](j_compress_ptr cinfo __unused) { + ALOGV("%s:%d Out of buffer", __FUNCTION__, __LINE__); + return 0; + }; + + dmgr.mgr.term_destination = [](j_compress_ptr cinfo) { + auto& dmgr = reinterpret_cast(*cinfo->dest); + dmgr.mEncodedSize = dmgr.mBufferSize - dmgr.mgr.free_in_buffer; + ALOGV("%s:%d Done with jpeg: %zu", __FUNCTION__, __LINE__, dmgr.mEncodedSize); + }; + cinfo.dest = reinterpret_cast(&dmgr); + + /* We are going to be using JPEG in raw data mode, so we are passing + * straight subsampled planar YCbCr and it will not touch our pixel + * data or do any scaling or anything */ + cinfo.image_width = inSz.width; + cinfo.image_height = inSz.height; + cinfo.input_components = 3; + cinfo.in_color_space = JCS_YCbCr; + + /* Initialize defaults and then override what we want */ + jpeg_set_defaults(&cinfo); + + jpeg_set_quality(&cinfo, jpegQuality, 1); + jpeg_set_colorspace(&cinfo, JCS_YCbCr); + cinfo.raw_data_in = 1; + cinfo.dct_method = JDCT_IFAST; + + /* Configure sampling factors. The sampling factor is JPEG subsampling 420 + * because the source format is YUV420. Note that libjpeg sampling factors + * are... a little weird. Sampling of Y=2,U=1,V=1 means there is 1 U and + * 1 V value for each 2 Y values */ + cinfo.comp_info[0].h_samp_factor = 2; + cinfo.comp_info[0].v_samp_factor = 2; + cinfo.comp_info[1].h_samp_factor = 1; + cinfo.comp_info[1].v_samp_factor = 1; + cinfo.comp_info[2].h_samp_factor = 1; + cinfo.comp_info[2].v_samp_factor = 1; + + /* Start the compressor */ + jpeg_start_compress(&cinfo, TRUE); + + /* Let's not hardcode YUV420 in 6 places... 5 was enough */ + int maxVSampFactor = cinfo.max_v_samp_factor; + int cVSubSampling = cinfo.comp_info[0].v_samp_factor / cinfo.comp_info[1].v_samp_factor; + + /* Compute our macroblock height, so we can pad our input to be vertically + * macroblock aligned. No need to for horizontal alignment since AllocatedFrame already + * pads horizontally */ + + size_t mcuV = DCTSIZE * maxVSampFactor; + size_t paddedHeight = mcuV * ((inSz.height + mcuV - 1) / mcuV); + + /* libjpeg uses arrays of row pointers, which makes it really easy to pad + * data vertically (unfortunately doesn't help horizontally) */ + std::vector yLines(paddedHeight); + std::vector cbLines(paddedHeight / cVSubSampling); + std::vector crLines(paddedHeight / cVSubSampling); + + uint8_t* py = static_cast(inLayout.y); + uint8_t* pcb = static_cast(inLayout.cb); + uint8_t* pcr = static_cast(inLayout.cr); + + for (int32_t i = 0; i < paddedHeight; i++) { + /* Once we are in the padding territory we still point to the last line + * effectively replicating it several times ~ CLAMP_TO_EDGE */ + int li = std::min(i, inSz.height - 1); + yLines[i] = static_cast(py + li * inLayout.yStride); + if (i < paddedHeight / cVSubSampling) { + li = std::min(i, (inSz.height - 1) / cVSubSampling); + cbLines[i] = static_cast(pcb + li * inLayout.cStride); + crLines[i] = static_cast(pcr + li * inLayout.cStride); + } + } + + /* If APP1 data was passed in, use it */ + if (app1Buffer && app1Size) { + jpeg_write_marker(&cinfo, JPEG_APP0 + 1, static_cast(app1Buffer), app1Size); + } + + /* While we still have padded height left to go, keep giving it one + * macroblock at a time. */ + while (cinfo.next_scanline < cinfo.image_height) { + const uint32_t batchSize = DCTSIZE * maxVSampFactor; + const uint32_t nl = cinfo.next_scanline; + JSAMPARRAY planes[3]{&yLines[nl], &cbLines[nl / cVSubSampling], + &crLines[nl / cVSubSampling]}; + + uint32_t done = jpeg_write_raw_data(&cinfo, planes, batchSize); + + if (done != batchSize) { + ALOGE("%s: compressed %u lines, expected %u (total %u/%u)", __FUNCTION__, done, + batchSize, cinfo.next_scanline, cinfo.image_height); + return -1; + } + } + + /* This will flush everything */ + jpeg_finish_compress(&cinfo); + + /* Grab the actual code size and set it */ + actualCodeSize = dmgr.mEncodedSize; + + return 0; +} + +Size getMaxThumbnailResolution(const common::V1_0::helper::CameraMetadata& chars) { + Size thumbSize{0, 0}; + camera_metadata_ro_entry entry = chars.find(ANDROID_JPEG_AVAILABLE_THUMBNAIL_SIZES); + for (uint32_t i = 0; i < entry.count; i += 2) { + Size sz{.width = entry.data.i32[i], .height = entry.data.i32[i + 1]}; + if (sz.width * sz.height > thumbSize.width * thumbSize.height) { + thumbSize = sz; + } + } + + if (thumbSize.width * thumbSize.height == 0) { + ALOGW("%s: non-zero thumbnail size not available", __FUNCTION__); + } + + return thumbSize; +} + +void freeReleaseFences(std::vector& results) { + for (auto& result : results) { + native_handle_t* inputReleaseFence = + ::android::makeFromAidl(result.inputBuffer.releaseFence); + if (inputReleaseFence != nullptr) { + native_handle_close(inputReleaseFence); + native_handle_delete(inputReleaseFence); + } + for (auto& buf : result.outputBuffers) { + native_handle_t* outReleaseFence = ::android::makeFromAidl(buf.releaseFence); + if (outReleaseFence != nullptr) { + native_handle_close(outReleaseFence); + native_handle_delete(outReleaseFence); + } + } + } +} + +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) +#define UPDATE(md, tag, data, size) \ + do { \ + if ((md).update((tag), (data), (size))) { \ + ALOGE("Update " #tag " failed!"); \ + return BAD_VALUE; \ + } \ + } while (0) + +status_t fillCaptureResultCommon(CameraMetadata& md, nsecs_t timestamp, + camera_metadata_ro_entry& activeArraySize) { + if (activeArraySize.count < 4) { + ALOGE("%s: cannot find active array size!", __FUNCTION__); + return -EINVAL; + } + // android.control + // For USB camera, we don't know the AE state. Set the state to converged to + // indicate the frame should be good to use. Then apps don't have to wait the + // AE state. + const uint8_t aeState = ANDROID_CONTROL_AE_STATE_CONVERGED; + UPDATE(md, ANDROID_CONTROL_AE_STATE, &aeState, 1); + + const uint8_t ae_lock = ANDROID_CONTROL_AE_LOCK_OFF; + UPDATE(md, ANDROID_CONTROL_AE_LOCK, &ae_lock, 1); + + // Set AWB state to converged to indicate the frame should be good to use. + const uint8_t awbState = ANDROID_CONTROL_AWB_STATE_CONVERGED; + UPDATE(md, ANDROID_CONTROL_AWB_STATE, &awbState, 1); + + const uint8_t awbLock = ANDROID_CONTROL_AWB_LOCK_OFF; + UPDATE(md, ANDROID_CONTROL_AWB_LOCK, &awbLock, 1); + + const uint8_t flashState = ANDROID_FLASH_STATE_UNAVAILABLE; + UPDATE(md, ANDROID_FLASH_STATE, &flashState, 1); + + // This means pipeline latency of X frame intervals. The maximum number is 4. + const uint8_t requestPipelineMaxDepth = 4; + UPDATE(md, ANDROID_REQUEST_PIPELINE_DEPTH, &requestPipelineMaxDepth, 1); + + // android.scaler + const int32_t crop_region[] = { + activeArraySize.data.i32[0], + activeArraySize.data.i32[1], + activeArraySize.data.i32[2], + activeArraySize.data.i32[3], + }; + UPDATE(md, ANDROID_SCALER_CROP_REGION, crop_region, ARRAY_SIZE(crop_region)); + + // android.sensor + UPDATE(md, ANDROID_SENSOR_TIMESTAMP, ×tamp, 1); + + // android.statistics + const uint8_t lensShadingMapMode = ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_OFF; + UPDATE(md, ANDROID_STATISTICS_LENS_SHADING_MAP_MODE, &lensShadingMapMode, 1); + + const uint8_t sceneFlicker = ANDROID_STATISTICS_SCENE_FLICKER_NONE; + UPDATE(md, ANDROID_STATISTICS_SCENE_FLICKER, &sceneFlicker, 1); + + return OK; +} + +#undef ARRAY_SIZE +#undef UPDATE + +AllocatedV4L2Frame::AllocatedV4L2Frame(std::shared_ptr frameIn) + : Frame(frameIn->mWidth, frameIn->mHeight, frameIn->mFourcc) { + uint8_t* dataIn; + size_t dataSize; + if (frameIn->getData(&dataIn, &dataSize) != 0) { + ALOGE("%s: map input V4L2 frame failed!", __FUNCTION__); + return; + } + + mData.resize(dataSize); + std::memcpy(mData.data(), dataIn, dataSize); +} + +AllocatedV4L2Frame::~AllocatedV4L2Frame() {} + +int AllocatedV4L2Frame::getData(uint8_t** outData, size_t* dataSize) { + if (outData == nullptr || dataSize == nullptr) { + ALOGE("%s: outData(%p)/dataSize(%p) must not be null", __FUNCTION__, outData, dataSize); + return -1; + } + + *outData = mData.data(); + *dataSize = mData.size(); + return 0; +} + +} // namespace implementation +} // namespace device +} // namespace camera +} // namespace hardware +} // namespace android \ No newline at end of file diff --git a/camera/device/default/ExternalCameraUtils.h b/camera/device/default/ExternalCameraUtils.h new file mode 100644 index 0000000000..b37933ce7e --- /dev/null +++ b/camera/device/default/ExternalCameraUtils.h @@ -0,0 +1,300 @@ +/* + * 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. + */ + +#ifndef HARDWARE_INTERFACES_CAMERA_DEVICE_DEFAULT_EXTERNALCAMERAUTILS_H_ +#define HARDWARE_INTERFACES_CAMERA_DEVICE_DEFAULT_EXTERNALCAMERAUTILS_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using ::aidl::android::hardware::camera::common::Status; +using ::aidl::android::hardware::camera::device::CaptureResult; +using ::aidl::android::hardware::camera::device::ErrorCode; +using ::aidl::android::hardware::camera::device::NotifyMsg; +using ::aidl::android::hardware::graphics::common::BufferUsage; +using ::aidl::android::hardware::graphics::common::PixelFormat; +using ::android::hardware::camera::common::V1_0::helper::CameraMetadata; +using ::android::hardware::camera::common::V1_0::helper::HandleImporter; + +namespace android { +namespace hardware { +namespace camera { + +namespace external { +namespace common { + +struct Size { + int32_t width; + int32_t height; + + bool operator==(const Size& other) const { + return (width == other.width && height == other.height); + } +}; + +struct SizeHasher { + size_t operator()(const Size& sz) const { + size_t result = 1; + result = 31 * result + sz.width; + result = 31 * result + sz.height; + return result; + } +}; + +struct ExternalCameraConfig { + static const char* kDefaultCfgPath; + static ExternalCameraConfig loadFromCfg(const char* cfgPath = kDefaultCfgPath); + + // CameraId base offset for numerical representation + uint32_t cameraIdOffset; + + // List of internal V4L2 video nodes external camera HAL must ignore. + std::unordered_set mInternalDevices; + + // Maximal size of a JPEG buffer, in bytes + int32_t maxJpegBufSize; + + // Maximum Size that can sustain 30fps streaming + Size maxVideoSize; + + // Size of v4l2 buffer queue when streaming <= kMaxVideoSize + uint32_t numVideoBuffers; + + // Size of v4l2 buffer queue when streaming > kMaxVideoSize + uint32_t numStillBuffers; + + // Indication that the device connected supports depth output + bool depthEnabled; + + struct FpsLimitation { + Size size; + double fpsUpperBound; + }; + std::vector fpsLimits; + std::vector depthFpsLimits; + + // Minimum output stream size + Size minStreamSize; + + // The value of android.sensor.orientation + int32_t orientation; + + private: + ExternalCameraConfig(); + static bool updateFpsList(tinyxml2::XMLElement* fpsList, std::vector& fpsLimits); +}; + +} // namespace common +} // namespace external + +namespace device { +namespace implementation { + +struct SupportedV4L2Format { + int32_t width; + int32_t height; + uint32_t fourcc; + // All supported frame rate for this w/h/fourcc combination + struct FrameRate { + // Duration (in seconds) of a single frame. + // Numerator and denominator of the frame duration are stored separately. + // For ex. a frame lasting 1/30 of a second will be stored as {1, 30} + uint32_t durationNumerator; // frame duration numerator. Ex: 1 + uint32_t durationDenominator; // frame duration denominator. Ex: 30 + double getFramesPerSecond() const; // FPS as double. Ex: 30.0 + }; + std::vector frameRates; +}; + +// A Base class with basic information about a frame +struct Frame : public std::enable_shared_from_this { + public: + Frame(uint32_t width, uint32_t height, uint32_t fourcc); + virtual ~Frame(); + const int32_t mWidth; + const int32_t mHeight; + const uint32_t mFourcc; + + // getData might involve map/allocation + virtual int getData(uint8_t** outData, size_t* dataSize) = 0; +}; + +// A class provide access to a dequeued V4L2 frame buffer (mostly in MJPG format) +// Also contains necessary information to enqueue the buffer back to V4L2 buffer queue +class V4L2Frame : public Frame { + public: + V4L2Frame(uint32_t w, uint32_t h, uint32_t fourcc, int bufIdx, int fd, uint32_t dataSize, + uint64_t offset); + virtual ~V4L2Frame(); + + virtual int getData(uint8_t** outData, size_t* dataSize) override; + + const int mBufferIndex; // for later enqueue + int map(uint8_t** data, size_t* dataSize); + int unmap(); + + private: + std::mutex mLock; + const int mFd; // used for mmap but doesn't claim ownership + const size_t mDataSize; + const uint64_t mOffset; // used for mmap + uint8_t* mData = nullptr; + bool mMapped = false; +}; + +// A RAII class representing a CPU allocated YUV frame used as intermediate buffers +// when generating output images. +class AllocatedFrame : public Frame { + public: + AllocatedFrame(uint32_t w, uint32_t h); // only support V4L2_PIX_FMT_YUV420 for now + ~AllocatedFrame() override; + + virtual int getData(uint8_t** outData, size_t* dataSize) override; + + int allocate(YCbCrLayout* out = nullptr); + int getLayout(YCbCrLayout* out); + int getCroppedLayout(const IMapper::Rect&, YCbCrLayout* out); // return non-zero for bad input + private: + std::mutex mLock; + std::vector mData; + size_t mBufferSize; // size of mData before padding. Actual size of mData might be slightly + // bigger to horizontally pad the frame for jpeglib. +}; + +enum CroppingType { HORIZONTAL = 0, VERTICAL = 1 }; + +// Aspect ratio is defined as width/height here and ExternalCameraDevice +// will guarantee all supported sizes has width >= height (so aspect ratio >= 1.0) +#define ASPECT_RATIO(sz) (static_cast((sz).width) / (sz).height) +const float kMaxAspectRatio = std::numeric_limits::max(); +const float kMinAspectRatio = 1.f; + +bool isAspectRatioClose(float ar1, float ar2); + +struct HalStreamBuffer { + int32_t streamId; + int64_t bufferId; + int32_t width; + int32_t height; + ::aidl::android::hardware::graphics::common::PixelFormat format; + ::aidl::android::hardware::graphics::common::BufferUsage usage; + buffer_handle_t* bufPtr; + int acquireFence; + bool fenceTimeout; +}; + +struct HalRequest { + int32_t frameNumber; + common::V1_0::helper::CameraMetadata setting; + std::shared_ptr frameIn; + nsecs_t shutterTs; + std::vector buffers; +}; + +static const uint64_t BUFFER_ID_NO_BUFFER = 0; + +// buffers currently circulating between HAL and camera service +// key: bufferId sent via HIDL interface +// value: imported buffer_handle_t +// Buffer will be imported during processCaptureRequest (or requestStreamBuffer +// in the case of HAL buffer manager is enabled) and will be freed +// when the stream is deleted or camera device session is closed +typedef std::unordered_map CirculatingBuffers; + +aidl::android::hardware::camera::common::Status importBufferImpl( + /*inout*/ std::map& circulatingBuffers, + /*inout*/ HandleImporter& handleImporter, int32_t streamId, uint64_t bufId, + buffer_handle_t buf, + /*out*/ buffer_handle_t** outBufPtr); + +static const uint32_t FLEX_YUV_GENERIC = + static_cast('F') | static_cast('L') << 8 | + static_cast('E') << 16 | static_cast('X') << 24; + +// returns FLEX_YUV_GENERIC for formats other than YV12/YU12/NV12/NV21 +uint32_t getFourCcFromLayout(const YCbCrLayout&); + +using ::android::hardware::camera::external::common::Size; +int getCropRect(CroppingType ct, const Size& inSize, const Size& outSize, IMapper::Rect* out); + +int formatConvert(const YCbCrLayout& in, const YCbCrLayout& out, Size sz, uint32_t format); + +int encodeJpegYU12(const Size& inSz, const YCbCrLayout& inLayout, int jpegQuality, + const void* app1Buffer, size_t app1Size, void* out, size_t maxOutSize, + size_t& actualCodeSize); + +Size getMaxThumbnailResolution(const common::V1_0::helper::CameraMetadata&); + +void freeReleaseFences(std::vector&); + +status_t fillCaptureResultCommon(common::V1_0::helper::CameraMetadata& md, nsecs_t timestamp, + camera_metadata_ro_entry& activeArraySize); + +// Interface for OutputThread calling back to parent +struct OutputThreadInterface { + virtual ~OutputThreadInterface() {} + virtual aidl::android::hardware::camera::common::Status importBuffer( + int32_t streamId, uint64_t bufId, buffer_handle_t buf, + /*out*/ buffer_handle_t** outBufPtr) = 0; + + virtual void notifyError(int32_t frameNumber, int32_t streamId, ErrorCode ec) = 0; + + // Callbacks are fired within the method if msgs/results are nullptr. + // Otherwise the callbacks will be returned and caller is responsible to + // fire the callback later + virtual aidl::android::hardware::camera::common::Status processCaptureRequestError( + const std::shared_ptr&, + /*out*/ std::vector* msgs, + /*out*/ std::vector* results) = 0; + + virtual aidl::android::hardware::camera::common::Status processCaptureRequestError( + const std::shared_ptr& reqs) final { + return processCaptureRequestError(reqs, nullptr, nullptr); + } + + virtual aidl::android::hardware::camera::common::Status processCaptureResult( + std::shared_ptr&) = 0; + + virtual ssize_t getJpegBufferSize(int32_t width, int32_t height) const = 0; +}; + +// A CPU copy of a mapped V4L2Frame. Will map the input V4L2 frame. +class AllocatedV4L2Frame : public Frame { + public: + AllocatedV4L2Frame(std::shared_ptr frameIn); + ~AllocatedV4L2Frame() override; + virtual int getData(uint8_t** outData, size_t* dataSize) override; + + private: + std::vector mData; +}; + +} // namespace implementation +} // namespace device +} // namespace camera +} // namespace hardware +} // namespace android + +#endif // HARDWARE_INTERFACES_CAMERA_DEVICE_DEFAULT_EXTERNALCAMERAUTILS_H_ diff --git a/camera/device/default/OWNERS b/camera/device/default/OWNERS new file mode 100644 index 0000000000..f48a95c5b3 --- /dev/null +++ b/camera/device/default/OWNERS @@ -0,0 +1 @@ +include platform/frameworks/av:/camera/OWNERS diff --git a/camera/device/default/convert.cpp b/camera/device/default/convert.cpp new file mode 100644 index 0000000000..8134dd5e6b --- /dev/null +++ b/camera/device/default/convert.cpp @@ -0,0 +1,71 @@ +/* + * 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. + */ + +#define LOG_TAG "android.hardware.camera.device@3.4-convert-impl" +#include + +#include "convert.h" + +#include +#include +#include + +namespace android { +namespace hardware { +namespace camera { +namespace device { +namespace implementation { + +using ::aidl::android::hardware::camera::device::ErrorCode; +using ::aidl::android::hardware::camera::device::ErrorMsg; +using ::aidl::android::hardware::camera::device::ShutterMsg; +using ::aidl::android::hardware::graphics::common::BufferUsage; +using ::aidl::android::hardware::graphics::common::PixelFormat; + +void convertToAidl(const camera_metadata_t* src, CameraMetadata* dest) { + if (src == nullptr) { + return; + } + + size_t size = get_camera_metadata_size(src); + auto* src_start = (uint8_t*)src; + uint8_t* src_end = src_start + size; + dest->metadata.assign(src_start, src_end); +} + +bool convertFromAidl(const CameraMetadata& src, const camera_metadata_t** dst) { + const std::vector& metadata = src.metadata; + if (metadata.empty()) { + // Special case for null metadata + *dst = nullptr; + return true; + } + + const uint8_t* data = metadata.data(); + // check that the size of CameraMetadata match underlying camera_metadata_t + if (get_camera_metadata_size((camera_metadata_t*)data) != metadata.size()) { + ALOGE("%s: input CameraMetadata is corrupt!", __FUNCTION__); + return false; + } + *dst = (camera_metadata_t*)data; + return true; +} + +} // namespace implementation +} // namespace device +} // namespace camera +} // namespace hardware +} // namespace android diff --git a/camera/device/default/convert.h b/camera/device/default/convert.h new file mode 100644 index 0000000000..5a508fc4d8 --- /dev/null +++ b/camera/device/default/convert.h @@ -0,0 +1,58 @@ +/* + * 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. + */ + +#ifndef HARDWARE_INTERFACES_CAMERA_DEVICE_DEFAULT_CONVERT_H_ +#define HARDWARE_INTERFACES_CAMERA_DEVICE_DEFAULT_CONVERT_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace camera { +namespace device { +namespace implementation { + +using ::aidl::android::hardware::camera::common::Status; +using ::aidl::android::hardware::camera::device::BufferStatus; +using ::aidl::android::hardware::camera::device::CameraMetadata; +using ::aidl::android::hardware::camera::device::HalStream; +using ::aidl::android::hardware::camera::device::NotifyMsg; +using ::aidl::android::hardware::camera::device::Stream; + +void convertToAidl(const camera_metadata_t* src, CameraMetadata* dest); + +bool convertFromAidl(const CameraMetadata& src, const camera_metadata_t** dst); + +inline ndk::ScopedAStatus fromStatus(Status status) { + return status == Status::OK + ? ndk::ScopedAStatus::ok() + : ndk::ScopedAStatus::fromServiceSpecificError(static_cast(status)); +} + +} // namespace implementation +} // namespace device +} // namespace camera +} // namespace hardware +} // namespace android + +#endif // HARDWARE_INTERFACES_CAMERA_DEVICE_DEFAULT_CONVERT_H_ diff --git a/camera/provider/default/Android.bp b/camera/provider/default/Android.bp new file mode 100644 index 0000000000..ed45cbed9d --- /dev/null +++ b/camera/provider/default/Android.bp @@ -0,0 +1,104 @@ +// +// Copyright (C) 2020 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 { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_library_shared { + name: "android.hardware.camera.provider-V1-external-impl", + defaults: ["hidl_defaults"], + proprietary: true, + srcs: [ + "ExternalCameraProvider.cpp", + ], + shared_libs: [ + "android.hardware.camera.common-V1-ndk", + "android.hardware.camera.device-V1-ndk", + "android.hardware.camera.provider-V1-ndk", + "android.hardware.graphics.mapper@2.0", + "android.hardware.graphics.mapper@3.0", + "android.hardware.graphics.mapper@4.0", + "android.hidl.allocator@1.0", + "android.hidl.memory@1.0", + "camera.device-external-impl", + "libbinder_ndk", + "libcamera_metadata", + "libcutils", + "libfmq", + "libhardware", + "libhidlbase", + "liblog", + "libtinyxml2", + "libutils", + ], + static_libs: [ + "android.hardware.camera.common@1.0-helper", + ], + export_include_dirs: ["."], +} + +cc_defaults { + name: "camera_external_service_defaults", + defaults: ["hidl_defaults"], + proprietary: true, + relative_install_path: "hw", + srcs: ["external-service.cpp"], + compile_multilib: "first", + shared_libs: [ + "android.hardware.camera.common-V1-ndk", + "android.hardware.camera.device-V1-ndk", + "android.hardware.camera.provider-V1-ndk", + "android.hardware.camera.provider-V1-external-impl", + "android.hardware.graphics.mapper@2.0", + "android.hardware.graphics.mapper@3.0", + "android.hardware.graphics.mapper@4.0", + "android.hidl.allocator@1.0", + "android.hidl.memory@1.0", + "camera.device-external-impl", + "libbinder_ndk", + "libcamera_metadata", + "libcutils", + "libfmq", + "libhardware", + "libhidlbase", + "liblog", + "libtinyxml2", + "libutils", + ], + static_libs: [ + "android.hardware.camera.common@1.0-helper", + ], +} + +cc_binary { + name: "android.hardware.camera.provider-V1-external-service", + defaults: ["camera_external_service_defaults"], + init_rc: ["android.hardware.camera.provider-V1-external-service.rc"], +} + +cc_binary { + name: "android.hardware.camera.provider-V1-external-service-lazy", + overrides: ["android.hardware.camera.provider-V1-external-service"], + defaults: ["camera_external_service_defaults"], + init_rc: ["android.hardware.camera.provider-V1-external-service-lazy.rc"], + cflags: ["-DLAZY_SERVICE"], +} diff --git a/camera/provider/default/ExternalCameraProvider.cpp b/camera/provider/default/ExternalCameraProvider.cpp new file mode 100644 index 0000000000..d47ddbfef7 --- /dev/null +++ b/camera/provider/default/ExternalCameraProvider.cpp @@ -0,0 +1,382 @@ +/* + * 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. + */ + +#define LOG_TAG "ExtCamPrvdr" +// #define LOG_NDEBUG 0 + +#include "ExternalCameraProvider.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace camera { +namespace provider { +namespace implementation { + +using ::aidl::android::hardware::camera::common::Status; +using ::android::hardware::camera::device::implementation::ExternalCameraDevice; +using ::android::hardware::camera::device::implementation::fromStatus; +using ::android::hardware::camera::external::common::ExternalCameraConfig; + +namespace { +// "device@/external/" +const std::regex kDeviceNameRE("device@([0-9]+\\.[0-9]+)/external/(.+)"); +const int kMaxDevicePathLen = 256; +constexpr char kDevicePath[] = "/dev/"; +constexpr char kPrefix[] = "video"; +constexpr int kPrefixLen = sizeof(kPrefix) - 1; +constexpr int kDevicePrefixLen = sizeof(kDevicePath) + kPrefixLen + 1; + +bool matchDeviceName(int cameraIdOffset, const std::string& deviceName, std::string* deviceVersion, + std::string* cameraDevicePath) { + std::smatch sm; + if (std::regex_match(deviceName, sm, kDeviceNameRE)) { + if (deviceVersion != nullptr) { + *deviceVersion = sm[1]; + } + if (cameraDevicePath != nullptr) { + *cameraDevicePath = "/dev/video" + std::to_string(std::stoi(sm[2]) - cameraIdOffset); + } + return true; + } + return false; +} +} // namespace + +ExternalCameraProvider::ExternalCameraProvider() : mCfg(ExternalCameraConfig::loadFromCfg()) { + mHotPlugThread = std::make_shared(this); + mHotPlugThread->run(); +} + +ExternalCameraProvider::~ExternalCameraProvider() { + mHotPlugThread->requestExitAndWait(); +} + +ndk::ScopedAStatus ExternalCameraProvider::setCallback( + const std::shared_ptr& in_callback) { + { + Mutex::Autolock _l(mLock); + mCallback = in_callback; + } + + if (mCallback == nullptr) { + return fromStatus(Status::OK); + } + + for (const auto& pair : mCameraStatusMap) { + mCallback->cameraDeviceStatusChange(pair.first, pair.second); + } + return fromStatus(Status::OK); +} + +ndk::ScopedAStatus ExternalCameraProvider::getVendorTags( + std::vector* _aidl_return) { + if (_aidl_return == nullptr) { + return fromStatus(Status::ILLEGAL_ARGUMENT); + } + // No vendor tag support for USB camera + *_aidl_return = {}; + return fromStatus(Status::OK); +} + +ndk::ScopedAStatus ExternalCameraProvider::getCameraIdList(std::vector* _aidl_return) { + if (_aidl_return == nullptr) { + return fromStatus(Status::ILLEGAL_ARGUMENT); + } + // External camera HAL always report 0 camera, and extra cameras + // are just reported via cameraDeviceStatusChange callbacks + *_aidl_return = {}; + return fromStatus(Status::OK); +} + +ndk::ScopedAStatus ExternalCameraProvider::getCameraDeviceInterface( + const std::string& in_cameraDeviceName, std::shared_ptr* _aidl_return) { + if (_aidl_return == nullptr) { + return fromStatus(Status::ILLEGAL_ARGUMENT); + } + std::string cameraDevicePath, deviceVersion; + bool match = matchDeviceName(mCfg.cameraIdOffset, in_cameraDeviceName, &deviceVersion, + &cameraDevicePath); + + if (!match) { + *_aidl_return = nullptr; + return fromStatus(Status::ILLEGAL_ARGUMENT); + } + + if (mCameraStatusMap.count(in_cameraDeviceName) == 0 || + mCameraStatusMap[in_cameraDeviceName] != CameraDeviceStatus::PRESENT) { + *_aidl_return = nullptr; + return fromStatus(Status::ILLEGAL_ARGUMENT); + } + + ALOGV("Constructing external camera device"); + std::shared_ptr deviceImpl = + ndk::SharedRefBase::make(cameraDevicePath, mCfg); + if (deviceImpl == nullptr || deviceImpl->isInitFailed()) { + ALOGE("%s: camera device %s init failed!", __FUNCTION__, cameraDevicePath.c_str()); + *_aidl_return = nullptr; + return fromStatus(Status::INTERNAL_ERROR); + } + + IF_ALOGV() { + int interfaceVersion; + deviceImpl->getInterfaceVersion(&interfaceVersion); + ALOGV("%s: device interface version: %d", __FUNCTION__, interfaceVersion); + } + + *_aidl_return = deviceImpl; + return fromStatus(Status::OK); +} + +ndk::ScopedAStatus ExternalCameraProvider::notifyDeviceStateChange(int64_t) { + return fromStatus(Status::OK); +} + +ndk::ScopedAStatus ExternalCameraProvider::getConcurrentCameraIds( + std::vector* _aidl_return) { + if (_aidl_return == nullptr) { + return fromStatus(Status::ILLEGAL_ARGUMENT); + } + *_aidl_return = {}; + return fromStatus(Status::OK); +} + +ndk::ScopedAStatus ExternalCameraProvider::isConcurrentStreamCombinationSupported( + const std::vector&, bool* _aidl_return) { + if (_aidl_return == nullptr) { + return fromStatus(Status::ILLEGAL_ARGUMENT); + } + // No concurrent stream combinations are supported + *_aidl_return = false; + return fromStatus(Status::OK); +} + +void ExternalCameraProvider::addExternalCamera(const char* devName) { + ALOGV("%s: ExtCam: adding %s to External Camera HAL!", __FUNCTION__, devName); + Mutex::Autolock _l(mLock); + std::string deviceName; + std::string cameraId = + std::to_string(mCfg.cameraIdOffset + std::atoi(devName + kDevicePrefixLen)); + deviceName = + std::string("device@") + ExternalCameraDevice::kDeviceVersion + "/external/" + cameraId; + mCameraStatusMap[deviceName] = CameraDeviceStatus::PRESENT; + if (mCallback != nullptr) { + mCallback->cameraDeviceStatusChange(deviceName, CameraDeviceStatus::PRESENT); + } +} + +void ExternalCameraProvider::deviceAdded(const char* devName) { + { + base::unique_fd fd(::open(devName, O_RDWR)); + if (fd.get() < 0) { + ALOGE("%s open v4l2 device %s failed:%s", __FUNCTION__, devName, strerror(errno)); + return; + } + + struct v4l2_capability capability; + int ret = ioctl(fd.get(), VIDIOC_QUERYCAP, &capability); + if (ret < 0) { + ALOGE("%s v4l2 QUERYCAP %s failed", __FUNCTION__, devName); + return; + } + + if (!(capability.device_caps & V4L2_CAP_VIDEO_CAPTURE)) { + ALOGW("%s device %s does not support VIDEO_CAPTURE", __FUNCTION__, devName); + return; + } + } + + // See if we can initialize ExternalCameraDevice correctly + std::shared_ptr deviceImpl = + ndk::SharedRefBase::make(devName, mCfg); + if (deviceImpl == nullptr || deviceImpl->isInitFailed()) { + ALOGW("%s: Attempt to init camera device %s failed!", __FUNCTION__, devName); + return; + } + deviceImpl.reset(); + addExternalCamera(devName); +} + +void ExternalCameraProvider::deviceRemoved(const char* devName) { + Mutex::Autolock _l(mLock); + std::string deviceName; + std::string cameraId = + std::to_string(mCfg.cameraIdOffset + std::atoi(devName + kDevicePrefixLen)); + + deviceName = + std::string("device@") + ExternalCameraDevice::kDeviceVersion + "/external/" + cameraId; + + if (mCameraStatusMap.erase(deviceName) == 0) { + // Unknown device, do not fire callback + ALOGE("%s: cannot find camera device to remove %s", __FUNCTION__, devName); + return; + } + + if (mCallback != nullptr) { + mCallback->cameraDeviceStatusChange(deviceName, CameraDeviceStatus::NOT_PRESENT); + } +} + +void ExternalCameraProvider::updateAttachedCameras() { + ALOGV("%s start scanning for existing V4L2 devices", __FUNCTION__); + + // Find existing /dev/video* devices + DIR* devdir = opendir(kDevicePath); + if (devdir == nullptr) { + ALOGE("%s: cannot open %s! Exiting threadloop", __FUNCTION__, kDevicePath); + return; + } + + struct dirent* de; + while ((de = readdir(devdir)) != nullptr) { + // Find external v4l devices that's existing before we start watching and add them + if (!strncmp(kPrefix, de->d_name, kPrefixLen)) { + std::string deviceId(de->d_name + kPrefixLen); + if (mCfg.mInternalDevices.count(deviceId) == 0) { + ALOGV("Non-internal v4l device %s found", de->d_name); + char v4l2DevicePath[kMaxDevicePathLen]; + snprintf(v4l2DevicePath, kMaxDevicePathLen, "%s%s", kDevicePath, de->d_name); + deviceAdded(v4l2DevicePath); + } + } + } + closedir(devdir); +} + +// Start ExternalCameraProvider::HotplugThread functions + +ExternalCameraProvider::HotplugThread::HotplugThread(ExternalCameraProvider* parent) + : mParent(parent), mInternalDevices(parent->mCfg.mInternalDevices) {} + +ExternalCameraProvider::HotplugThread::~HotplugThread() { + // Clean up inotify descriptor if needed. + if (mINotifyFD >= 0) { + close(mINotifyFD); + } +} + +bool ExternalCameraProvider::HotplugThread::initialize() { + // Update existing cameras + mParent->updateAttachedCameras(); + + // Set up non-blocking fd. The threadLoop will be responsible for polling read at the + // desired frequency + mINotifyFD = inotify_init(); + if (mINotifyFD < 0) { + ALOGE("%s: inotify init failed! Exiting threadloop", __FUNCTION__); + return false; + } + + // Start watching /dev/ directory for created and deleted files + mWd = inotify_add_watch(mINotifyFD, kDevicePath, IN_CREATE | IN_DELETE); + if (mWd < 0) { + ALOGE("%s: inotify add watch failed! Exiting threadloop", __FUNCTION__); + return false; + } + + mPollFd = {.fd = mINotifyFD, .events = POLLIN}; + + mIsInitialized = true; + return true; +} + +bool ExternalCameraProvider::HotplugThread::threadLoop() { + // Initialize inotify descriptors if needed. + if (!mIsInitialized && !initialize()) { + return true; + } + + // poll /dev/* and handle timeouts and error + int pollRet = poll(&mPollFd, /* fd_count= */ 1, /* timeout= */ 250); + if (pollRet == 0) { + // no read event in 100ms + mPollFd.revents = 0; + return true; + } else if (pollRet < 0) { + ALOGE("%s: error while polling for /dev/*: %d", __FUNCTION__, errno); + mPollFd.revents = 0; + return true; + } else if (mPollFd.revents & POLLERR) { + ALOGE("%s: polling /dev/ returned POLLERR", __FUNCTION__); + mPollFd.revents = 0; + return true; + } else if (mPollFd.revents & POLLHUP) { + ALOGE("%s: polling /dev/ returned POLLHUP", __FUNCTION__); + mPollFd.revents = 0; + return true; + } else if (mPollFd.revents & POLLNVAL) { + ALOGE("%s: polling /dev/ returned POLLNVAL", __FUNCTION__); + mPollFd.revents = 0; + return true; + } + // mPollFd.revents must contain POLLIN, so safe to reset it before reading + mPollFd.revents = 0; + + uint64_t offset = 0; + ssize_t ret = read(mINotifyFD, mEventBuf, sizeof(mEventBuf)); + if (ret < sizeof(struct inotify_event)) { + // invalid event. skip + return true; + } + + while (offset < ret) { + struct inotify_event* event = (struct inotify_event*)&mEventBuf[offset]; + offset += sizeof(struct inotify_event) + event->len; + + if (event->wd != mWd) { + // event for an unrelated descriptor. ignore. + continue; + } + + ALOGV("%s inotify_event %s", __FUNCTION__, event->name); + if (strncmp(kPrefix, event->name, kPrefixLen) != 0) { + // event not for /dev/video*. ignore. + continue; + } + + std::string deviceId = event->name + kPrefixLen; + if (mInternalDevices.count(deviceId) != 0) { + // update to an internal device. ignore. + continue; + } + + char v4l2DevicePath[kMaxDevicePathLen]; + snprintf(v4l2DevicePath, kMaxDevicePathLen, "%s%s", kDevicePath, event->name); + + if (event->mask & IN_CREATE) { + mParent->deviceAdded(v4l2DevicePath); + } else if (event->mask & IN_DELETE) { + mParent->deviceRemoved(v4l2DevicePath); + } + } + return true; +} + +// End ExternalCameraProvider::HotplugThread functions + +} // namespace implementation +} // namespace provider +} // namespace camera +} // namespace hardware +} // namespace android \ No newline at end of file diff --git a/camera/provider/default/ExternalCameraProvider.h b/camera/provider/default/ExternalCameraProvider.h new file mode 100644 index 0000000000..347a53ce53 --- /dev/null +++ b/camera/provider/default/ExternalCameraProvider.h @@ -0,0 +1,117 @@ +/* + * 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. + */ + +#ifndef HARDWARE_INTERFACES_CAMERA_PROVIDER_DEFAULT_EXTERNALCAMERAPROVIDER_H_ +#define HARDWARE_INTERFACES_CAMERA_PROVIDER_DEFAULT_EXTERNALCAMERAPROVIDER_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace camera { +namespace provider { +namespace implementation { + +using ::aidl::android::hardware::camera::common::CameraDeviceStatus; +using ::aidl::android::hardware::camera::common::VendorTagSection; +using ::aidl::android::hardware::camera::device::ICameraDevice; +using ::aidl::android::hardware::camera::provider::BnCameraProvider; +using ::aidl::android::hardware::camera::provider::CameraIdAndStreamCombination; +using ::aidl::android::hardware::camera::provider::ConcurrentCameraIdCombination; +using ::aidl::android::hardware::camera::provider::ICameraProviderCallback; +using ::android::hardware::camera::common::helper::SimpleThread; +using ::android::hardware::camera::external::common::ExternalCameraConfig; + +class ExternalCameraProvider : public BnCameraProvider { + public: + ExternalCameraProvider(); + ~ExternalCameraProvider() override; + ndk::ScopedAStatus setCallback( + const std::shared_ptr& in_callback) override; + ndk::ScopedAStatus getVendorTags(std::vector* _aidl_return) override; + ndk::ScopedAStatus getCameraIdList(std::vector* _aidl_return) override; + ndk::ScopedAStatus getCameraDeviceInterface( + const std::string& in_cameraDeviceName, + std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus notifyDeviceStateChange(int64_t in_deviceState) override; + ndk::ScopedAStatus getConcurrentCameraIds( + std::vector* _aidl_return) override; + ndk::ScopedAStatus isConcurrentStreamCombinationSupported( + const std::vector& in_configs, + bool* _aidl_return) override; + + private: + void addExternalCamera(const char* devName); + void deviceAdded(const char* devName); + void deviceRemoved(const char* devName); + void updateAttachedCameras(); + + // A separate thread to monitor '/dev' directory for '/dev/video*' entries + // This thread calls back into ExternalCameraProvider when an actionable change is detected. + class HotplugThread : public SimpleThread { + public: + explicit HotplugThread(ExternalCameraProvider* parent); + ~HotplugThread() override; + + protected: + bool threadLoop() override; + + private: + // Returns true if thread initialization succeeded, and false if thread initialization + // failed. + bool initialize(); + + ExternalCameraProvider* mParent = nullptr; + const std::unordered_set mInternalDevices; + + bool mIsInitialized = false; + + int mINotifyFD = -1; + int mWd = -1; + + // struct to wrap mINotifyFD and poll it with timeout + struct pollfd mPollFd = {}; + char mEventBuf[512] = {0}; + }; + + Mutex mLock; + std::shared_ptr mCallback = nullptr; + std::unordered_map mCameraStatusMap; // camera id -> status + const ExternalCameraConfig mCfg; + std::shared_ptr mHotPlugThread; +}; + +} // namespace implementation +} // namespace provider +} // namespace camera +} // namespace hardware +} // namespace android + +#endif // HARDWARE_INTERFACES_CAMERA_PROVIDER_DEFAULT_EXTERNALCAMERAPROVIDER_H_ diff --git a/camera/provider/default/OWNERS b/camera/provider/default/OWNERS new file mode 100644 index 0000000000..f48a95c5b3 --- /dev/null +++ b/camera/provider/default/OWNERS @@ -0,0 +1 @@ +include platform/frameworks/av:/camera/OWNERS diff --git a/camera/provider/default/android.hardware.camera.provider-V1-external-service-lazy.rc b/camera/provider/default/android.hardware.camera.provider-V1-external-service-lazy.rc new file mode 100644 index 0000000000..dcdd88cc15 --- /dev/null +++ b/camera/provider/default/android.hardware.camera.provider-V1-external-service-lazy.rc @@ -0,0 +1,10 @@ +service vendor.camera.provider-ext /vendor/bin/hw/android.hardware.camera.provider-V1-external-service-lazy + interface aidl android.hardware.camera.provider.ICameraProvider/external/0 + class hal + oneshot + disabled + user cameraserver + group audio camera input drmrpc usb + ioprio rt 4 + capabilities SYS_NICE + task_profiles CameraServiceCapacity MaxPerformance \ No newline at end of file diff --git a/camera/provider/default/android.hardware.camera.provider-V1-external-service.rc b/camera/provider/default/android.hardware.camera.provider-V1-external-service.rc new file mode 100644 index 0000000000..302c56f48b --- /dev/null +++ b/camera/provider/default/android.hardware.camera.provider-V1-external-service.rc @@ -0,0 +1,8 @@ +service vendor.camera.provider-ext /vendor/bin/hw/android.hardware.camera.provider-V1-external-service + interface aidl android.hardware.camera.provider.ICameraProvider/external/0 + class hal + user cameraserver + group audio camera input drmrpc usb + ioprio rt 4 + capabilities SYS_NICE + task_profiles CameraServiceCapacity MaxPerformance \ No newline at end of file diff --git a/camera/provider/default/external-service.cpp b/camera/provider/default/external-service.cpp new file mode 100644 index 0000000000..b18f182aad --- /dev/null +++ b/camera/provider/default/external-service.cpp @@ -0,0 +1,52 @@ +/* + * 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. + */ + +#include +#include +#include +#include + +using ::android::hardware::camera::provider::implementation::ExternalCameraProvider; + +namespace { +// Default recommended RPC thread count for camera provider implementations +const int HWBINDER_THREAD_COUNT = 6; +} // namespace + +int main() { + ALOGI("CameraProvider: external webcam service is starting."); + + ABinderProcess_setThreadPoolMaxThreadCount(HWBINDER_THREAD_COUNT); + + std::shared_ptr defaultProvider = + ndk::SharedRefBase::make(); + const std::string serviceName = std::string(ExternalCameraProvider::descriptor) + "/external/0"; + +#ifdef LAZY_SERVICE + binder_exception_t ret = AServiceManager_registerLazyService(defaultProvider->asBinder().get(), + serviceName.c_str()); + LOG_ALWAYS_FATAL_IF(ret != EX_NONE, + "Error while registering lazy ext camera provider service: %d", ret); +#else + binder_exception_t ret = + AServiceManager_addService(defaultProvider->asBinder().get(), serviceName.c_str()); + LOG_ALWAYS_FATAL_IF(ret != EX_NONE, "Error while registering ext camera provider service: %d", + ret); +#endif + + ABinderProcess_joinThreadPool(); + return EXIT_FAILURE; // should not reach +} \ No newline at end of file From 0d2d8a4b4d2fd3bdd5f58f07839cb277e9af213f Mon Sep 17 00:00:00 2001 From: Avichal Rakesh Date: Tue, 14 Jun 2022 17:23:40 -0700 Subject: [PATCH 426/998] Camera: Move common-helper target out of HIDL directory This CL moves the common helper classes from inside the HIDL directory and refactors the HIDL-esque namespaces to android style namespaces. To preserve compatibility, the header files export the new symbols under old namespace and the old build module exports symbols from the new build module. This refactor is transparent to the codebase. Also ran clangformat to appease the repohook gods. Bug: 219974678 Test: Existing VTS tests pass on Cuttlefish Change-Id: I8c3160497c1e2fe7a0a7155641f0e1f5e47ec32e --- camera/common/{1.0 => }/default/Android.bp | 10 +- .../{1.0 => }/default/CameraMetadata.cpp | 176 ++++++-------- .../common/{1.0 => }/default/CameraModule.cpp | 127 +++++----- .../{1.0 => }/default/CameraParameters.cpp | 220 +++++++---------- camera/common/{1.0 => }/default/Exif.cpp | 228 ++++++------------ .../{1.0 => }/default/HandleImporter.cpp | 187 +++++++------- camera/common/{1.0 => }/default/OWNERS | 0 .../common/{1.0 => }/default/SimpleThread.cpp | 0 .../{1.0 => }/default/VendorTagDescriptor.cpp | 73 +++--- .../default/include/CameraMetadata.h | 72 +++--- .../{1.0 => }/default/include/CameraModule.h | 50 ++-- .../default/include/CameraParameters.h | 77 +++--- .../common/{1.0 => }/default/include/Exif.h | 24 +- .../default/include/HandleImporter.h | 35 +-- .../{1.0 => }/default/include/SimpleThread.h | 0 .../default/include/VendorTagDescriptor.h | 152 ++++++------ 16 files changed, 629 insertions(+), 802 deletions(-) rename camera/common/{1.0 => }/default/Android.bp (80%) rename camera/common/{1.0 => }/default/CameraMetadata.cpp (74%) rename camera/common/{1.0 => }/default/CameraModule.cpp (84%) rename camera/common/{1.0 => }/default/CameraParameters.cpp (77%) rename camera/common/{1.0 => }/default/Exif.cpp (83%) rename camera/common/{1.0 => }/default/HandleImporter.cpp (74%) rename camera/common/{1.0 => }/default/OWNERS (100%) rename camera/common/{1.0 => }/default/SimpleThread.cpp (100%) rename camera/common/{1.0 => }/default/VendorTagDescriptor.cpp (91%) rename camera/common/{1.0 => }/default/include/CameraMetadata.h (76%) rename camera/common/{1.0 => }/default/include/CameraModule.h (72%) rename camera/common/{1.0 => }/default/include/CameraParameters.h (94%) rename camera/common/{1.0 => }/default/include/Exif.h (95%) rename camera/common/{1.0 => }/default/include/HandleImporter.h (80%) rename camera/common/{1.0 => }/default/include/SimpleThread.h (100%) rename camera/common/{1.0 => }/default/include/VendorTagDescriptor.h (60%) diff --git a/camera/common/1.0/default/Android.bp b/camera/common/default/Android.bp similarity index 80% rename from camera/common/1.0/default/Android.bp rename to camera/common/default/Android.bp index 1a4d16b8f9..e8c8f9dba0 100644 --- a/camera/common/1.0/default/Android.bp +++ b/camera/common/default/Android.bp @@ -8,7 +8,7 @@ package { } cc_library_static { - name: "android.hardware.camera.common@1.0-helper", + name: "android.hardware.camera.common-helper", vendor_available: true, defaults: ["hidl_defaults"], srcs: [ @@ -38,3 +38,11 @@ cc_library_static { include_dirs: ["system/media/private/camera/include"], export_include_dirs: ["include"], } + +// NOTE: Deprecated module kept for compatibility reasons. +// Depend on "android.hardware.camera.common-helper" instead +cc_library_static { + name: "android.hardware.camera.common@1.0-helper", + vendor_available: true, + whole_static_libs: ["android.hardware.camera.common-helper"], +} diff --git a/camera/common/1.0/default/CameraMetadata.cpp b/camera/common/default/CameraMetadata.cpp similarity index 74% rename from camera/common/1.0/default/CameraMetadata.cpp rename to camera/common/default/CameraMetadata.cpp index eb1bd1c149..ed5626115d 100644 --- a/camera/common/1.0/default/CameraMetadata.cpp +++ b/camera/common/default/CameraMetadata.cpp @@ -27,44 +27,36 @@ namespace android { namespace hardware { namespace camera { namespace common { -namespace V1_0 { namespace helper { -#define ALIGN_TO(val, alignment) \ - (((uintptr_t)(val) + ((alignment) - 1)) & ~((alignment) - 1)) +#define ALIGN_TO(val, alignment) (((uintptr_t)(val) + ((alignment)-1)) & ~((alignment)-1)) -CameraMetadata::CameraMetadata() : - mBuffer(NULL), mLocked(false) { -} +CameraMetadata::CameraMetadata() : mBuffer(NULL), mLocked(false) {} -CameraMetadata::CameraMetadata(size_t entryCapacity, size_t dataCapacity) : - mLocked(false) -{ +CameraMetadata::CameraMetadata(size_t entryCapacity, size_t dataCapacity) : mLocked(false) { mBuffer = allocate_camera_metadata(entryCapacity, dataCapacity); } -CameraMetadata::CameraMetadata(const CameraMetadata &other) : - mLocked(false) { +CameraMetadata::CameraMetadata(const CameraMetadata& other) : mLocked(false) { mBuffer = clone_camera_metadata(other.mBuffer); } -CameraMetadata::CameraMetadata(camera_metadata_t *buffer) : - mBuffer(NULL), mLocked(false) { +CameraMetadata::CameraMetadata(camera_metadata_t* buffer) : mBuffer(NULL), mLocked(false) { acquire(buffer); } -CameraMetadata &CameraMetadata::operator=(const CameraMetadata &other) { +CameraMetadata& CameraMetadata::operator=(const CameraMetadata& other) { return operator=(other.mBuffer); } -CameraMetadata &CameraMetadata::operator=(const camera_metadata_t *buffer) { +CameraMetadata& CameraMetadata::operator=(const camera_metadata_t* buffer) { if (mLocked) { ALOGE("%s: Assignment to a locked CameraMetadata!", __FUNCTION__); return *this; } if (CC_LIKELY(buffer != mBuffer)) { - camera_metadata_t *newBuffer = clone_camera_metadata(buffer); + camera_metadata_t* newBuffer = clone_camera_metadata(buffer); clear(); mBuffer = newBuffer; } @@ -81,14 +73,13 @@ const camera_metadata_t* CameraMetadata::getAndLock() const { return mBuffer; } -status_t CameraMetadata::unlock(const camera_metadata_t *buffer) const { +status_t CameraMetadata::unlock(const camera_metadata_t* buffer) const { if (!mLocked) { ALOGE("%s: Can't unlock a non-locked CameraMetadata!", __FUNCTION__); return INVALID_OPERATION; } if (buffer != mBuffer) { - ALOGE("%s: Can't unlock CameraMetadata with wrong pointer!", - __FUNCTION__); + ALOGE("%s: Can't unlock CameraMetadata with wrong pointer!", __FUNCTION__); return BAD_VALUE; } mLocked = false; @@ -100,7 +91,7 @@ camera_metadata_t* CameraMetadata::release() { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); return NULL; } - camera_metadata_t *released = mBuffer; + camera_metadata_t* released = mBuffer; mBuffer = NULL; return released; } @@ -116,7 +107,7 @@ void CameraMetadata::clear() { } } -void CameraMetadata::acquire(camera_metadata_t *buffer) { +void CameraMetadata::acquire(camera_metadata_t* buffer) { if (mLocked) { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); return; @@ -124,12 +115,11 @@ void CameraMetadata::acquire(camera_metadata_t *buffer) { clear(); mBuffer = buffer; - ALOGE_IF(validate_camera_metadata_structure(mBuffer, /*size*/NULL) != OK, - "%s: Failed to validate metadata structure %p", - __FUNCTION__, buffer); + ALOGE_IF(validate_camera_metadata_structure(mBuffer, /*size*/ NULL) != OK, + "%s: Failed to validate metadata structure %p", __FUNCTION__, buffer); } -void CameraMetadata::acquire(CameraMetadata &other) { +void CameraMetadata::acquire(CameraMetadata& other) { if (mLocked) { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); return; @@ -137,7 +127,7 @@ void CameraMetadata::acquire(CameraMetadata &other) { acquire(other.release()); } -status_t CameraMetadata::append(const CameraMetadata &other) { +status_t CameraMetadata::append(const CameraMetadata& other) { return append(other.mBuffer); } @@ -154,8 +144,7 @@ status_t CameraMetadata::append(const camera_metadata_t* other) { } size_t CameraMetadata::entryCount() const { - return (mBuffer == NULL) ? 0 : - get_camera_metadata_entry_count(mBuffer); + return (mBuffer == NULL) ? 0 : get_camera_metadata_entry_count(mBuffer); } bool CameraMetadata::isEmpty() const { @@ -172,11 +161,11 @@ status_t CameraMetadata::sort() { status_t CameraMetadata::checkType(uint32_t tag, uint8_t expectedType) { int tagType = get_local_camera_metadata_tag_type(tag, mBuffer); - if ( CC_UNLIKELY(tagType == -1)) { + if (CC_UNLIKELY(tagType == -1)) { ALOGE("Update metadata entry: Unknown tag %d", tag); return INVALID_OPERATION; } - if ( CC_UNLIKELY(tagType != expectedType) ) { + if (CC_UNLIKELY(tagType != expectedType)) { ALOGE("Mismatched tag type when updating entry %s (%d) of type %s; " "got type %s data instead ", get_local_camera_metadata_tag_name(tag, mBuffer), tag, @@ -186,112 +175,105 @@ status_t CameraMetadata::checkType(uint32_t tag, uint8_t expectedType) { return OK; } -status_t CameraMetadata::update(uint32_t tag, - const int32_t *data, size_t data_count) { +status_t CameraMetadata::update(uint32_t tag, const int32_t* data, size_t data_count) { status_t res; if (mLocked) { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); return INVALID_OPERATION; } - if ( (res = checkType(tag, TYPE_INT32)) != OK) { + if ((res = checkType(tag, TYPE_INT32)) != OK) { return res; } return updateImpl(tag, (const void*)data, data_count); } -status_t CameraMetadata::update(uint32_t tag, - const uint8_t *data, size_t data_count) { +status_t CameraMetadata::update(uint32_t tag, const uint8_t* data, size_t data_count) { status_t res; if (mLocked) { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); return INVALID_OPERATION; } - if ( (res = checkType(tag, TYPE_BYTE)) != OK) { + if ((res = checkType(tag, TYPE_BYTE)) != OK) { return res; } return updateImpl(tag, (const void*)data, data_count); } -status_t CameraMetadata::update(uint32_t tag, - const float *data, size_t data_count) { +status_t CameraMetadata::update(uint32_t tag, const float* data, size_t data_count) { status_t res; if (mLocked) { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); return INVALID_OPERATION; } - if ( (res = checkType(tag, TYPE_FLOAT)) != OK) { + if ((res = checkType(tag, TYPE_FLOAT)) != OK) { return res; } return updateImpl(tag, (const void*)data, data_count); } -status_t CameraMetadata::update(uint32_t tag, - const int64_t *data, size_t data_count) { +status_t CameraMetadata::update(uint32_t tag, const int64_t* data, size_t data_count) { status_t res; if (mLocked) { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); return INVALID_OPERATION; } - if ( (res = checkType(tag, TYPE_INT64)) != OK) { + if ((res = checkType(tag, TYPE_INT64)) != OK) { return res; } return updateImpl(tag, (const void*)data, data_count); } -status_t CameraMetadata::update(uint32_t tag, - const double *data, size_t data_count) { +status_t CameraMetadata::update(uint32_t tag, const double* data, size_t data_count) { status_t res; if (mLocked) { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); return INVALID_OPERATION; } - if ( (res = checkType(tag, TYPE_DOUBLE)) != OK) { + if ((res = checkType(tag, TYPE_DOUBLE)) != OK) { return res; } return updateImpl(tag, (const void*)data, data_count); } -status_t CameraMetadata::update(uint32_t tag, - const camera_metadata_rational_t *data, size_t data_count) { +status_t CameraMetadata::update(uint32_t tag, const camera_metadata_rational_t* data, + size_t data_count) { status_t res; if (mLocked) { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); return INVALID_OPERATION; } - if ( (res = checkType(tag, TYPE_RATIONAL)) != OK) { + if ((res = checkType(tag, TYPE_RATIONAL)) != OK) { return res; } return updateImpl(tag, (const void*)data, data_count); } -status_t CameraMetadata::update(uint32_t tag, - const String8 &string) { +status_t CameraMetadata::update(uint32_t tag, const String8& string) { status_t res; if (mLocked) { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); return INVALID_OPERATION; } - if ( (res = checkType(tag, TYPE_BYTE)) != OK) { + if ((res = checkType(tag, TYPE_BYTE)) != OK) { return res; } // string.size() doesn't count the null termination character. return updateImpl(tag, (const void*)string.string(), string.size() + 1); } -status_t CameraMetadata::update(const camera_metadata_ro_entry &entry) { +status_t CameraMetadata::update(const camera_metadata_ro_entry& entry) { status_t res; if (mLocked) { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); return INVALID_OPERATION; } - if ( (res = checkType(entry.tag, entry.type)) != OK) { + if ((res = checkType(entry.tag, entry.type)) != OK) { return res; } return updateImpl(entry.tag, (const void*)entry.data.u8, entry.count); } -status_t CameraMetadata::updateImpl(uint32_t tag, const void *data, - size_t data_count) { +status_t CameraMetadata::updateImpl(uint32_t tag, const void* data, size_t data_count) { status_t res; if (mLocked) { ALOGE("%s: CameraMetadata is locked", __FUNCTION__); @@ -308,13 +290,11 @@ status_t CameraMetadata::updateImpl(uint32_t tag, const void *data, uintptr_t bufAddr = reinterpret_cast(mBuffer); uintptr_t dataAddr = reinterpret_cast(data); if (dataAddr > bufAddr && dataAddr < (bufAddr + bufferSize)) { - ALOGE("%s: Update attempted with data from the same metadata buffer!", - __FUNCTION__); + ALOGE("%s: Update attempted with data from the same metadata buffer!", __FUNCTION__); return INVALID_OPERATION; } - size_t data_size = calculate_camera_metadata_entry_data_size(type, - data_count); + size_t data_size = calculate_camera_metadata_entry_data_size(type, data_count); res = resizeIfNeeded(1, data_size); @@ -322,11 +302,9 @@ status_t CameraMetadata::updateImpl(uint32_t tag, const void *data, camera_metadata_entry_t entry; res = find_camera_metadata_entry(mBuffer, tag, &entry); if (res == NAME_NOT_FOUND) { - res = add_camera_metadata_entry(mBuffer, - tag, data, data_count); + res = add_camera_metadata_entry(mBuffer, tag, data, data_count); } else if (res == OK) { - res = update_camera_metadata_entry(mBuffer, - entry.index, data, data_count, NULL); + res = update_camera_metadata_entry(mBuffer, entry.index, data, data_count, NULL); } } @@ -337,11 +315,10 @@ status_t CameraMetadata::updateImpl(uint32_t tag, const void *data, } IF_ALOGV() { - ALOGE_IF(validate_camera_metadata_structure(mBuffer, /*size*/NULL) != - OK, + ALOGE_IF(validate_camera_metadata_structure(mBuffer, /*size*/ NULL) != OK, - "%s: Failed to validate metadata structure after update %p", - __FUNCTION__, mBuffer); + "%s: Failed to validate metadata structure after update %p", __FUNCTION__, + mBuffer); } return res; @@ -361,7 +338,7 @@ camera_metadata_entry_t CameraMetadata::find(uint32_t tag) { return entry; } res = find_camera_metadata_entry(mBuffer, tag, &entry); - if (CC_UNLIKELY( res != OK )) { + if (CC_UNLIKELY(res != OK)) { entry.count = 0; entry.data.u8 = NULL; } @@ -372,7 +349,7 @@ camera_metadata_ro_entry_t CameraMetadata::find(uint32_t tag) const { status_t res; camera_metadata_ro_entry entry; res = find_camera_metadata_ro_entry(mBuffer, tag, &entry); - if (CC_UNLIKELY( res != OK )) { + if (CC_UNLIKELY(res != OK)) { entry.count = 0; entry.data.u8 = NULL; } @@ -418,23 +395,17 @@ status_t CameraMetadata::resizeIfNeeded(size_t extraEntries, size_t extraData) { } else { size_t currentEntryCount = get_camera_metadata_entry_count(mBuffer); size_t currentEntryCap = get_camera_metadata_entry_capacity(mBuffer); - size_t newEntryCount = currentEntryCount + - extraEntries; - newEntryCount = (newEntryCount > currentEntryCap) ? - newEntryCount * 2 : currentEntryCap; + size_t newEntryCount = currentEntryCount + extraEntries; + newEntryCount = (newEntryCount > currentEntryCap) ? newEntryCount * 2 : currentEntryCap; size_t currentDataCount = get_camera_metadata_data_count(mBuffer); size_t currentDataCap = get_camera_metadata_data_capacity(mBuffer); - size_t newDataCount = currentDataCount + - extraData; - newDataCount = (newDataCount > currentDataCap) ? - newDataCount * 2 : currentDataCap; + size_t newDataCount = currentDataCount + extraData; + newDataCount = (newDataCount > currentDataCap) ? newDataCount * 2 : currentDataCap; - if (newEntryCount > currentEntryCap || - newDataCount > currentDataCap) { - camera_metadata_t *oldBuffer = mBuffer; - mBuffer = allocate_camera_metadata(newEntryCount, - newDataCount); + if (newEntryCount > currentEntryCap || newDataCount > currentDataCap) { + camera_metadata_t* oldBuffer = mBuffer; + mBuffer = allocate_camera_metadata(newEntryCount, newDataCount); if (mBuffer == NULL) { ALOGE("%s: Can't allocate larger metadata buffer", __FUNCTION__); return NO_MEMORY; @@ -462,14 +433,13 @@ void CameraMetadata::swap(CameraMetadata& other) { mBuffer = otherBuf; } -status_t CameraMetadata::getTagFromName(const char *name, - const VendorTagDescriptor* vTags, uint32_t *tag) { - +status_t CameraMetadata::getTagFromName(const char* name, const VendorTagDescriptor* vTags, + uint32_t* tag) { if (name == nullptr || tag == nullptr) return BAD_VALUE; size_t nameLength = strlen(name); - const SortedVector *vendorSections; + const SortedVector* vendorSections; size_t vendorSectionCount = 0; if (vTags != NULL) { @@ -478,18 +448,18 @@ status_t CameraMetadata::getTagFromName(const char *name, } // First, find the section by the longest string match - const char *section = NULL; + const char* section = NULL; size_t sectionIndex = 0; size_t sectionLength = 0; size_t totalSectionCount = ANDROID_SECTION_COUNT + vendorSectionCount; for (size_t i = 0; i < totalSectionCount; ++i) { - - const char *str = (i < ANDROID_SECTION_COUNT) ? camera_metadata_section_names[i] : - (*vendorSections)[i - ANDROID_SECTION_COUNT].string(); + const char* str = (i < ANDROID_SECTION_COUNT) + ? camera_metadata_section_names[i] + : (*vendorSections)[i - ANDROID_SECTION_COUNT].string(); ALOGV("%s: Trying to match against section '%s'", __FUNCTION__, str); - if (strstr(name, str) == name) { // name begins with the section name + if (strstr(name, str) == name) { // name begins with the section name size_t strLength = strlen(str); ALOGV("%s: Name begins with section name", __FUNCTION__); @@ -508,12 +478,11 @@ status_t CameraMetadata::getTagFromName(const char *name, if (section == NULL) { return NAME_NOT_FOUND; } else { - ALOGV("%s: Found matched section '%s' (%zu)", - __FUNCTION__, section, sectionIndex); + ALOGV("%s: Found matched section '%s' (%zu)", __FUNCTION__, section, sectionIndex); } // Get the tag name component of the name - const char *nameTagName = name + sectionLength + 1; // x.y.z -> z + const char* nameTagName = name + sectionLength + 1; // x.y.z -> z if (sectionLength + 1 >= nameLength) { return BAD_VALUE; } @@ -522,16 +491,15 @@ status_t CameraMetadata::getTagFromName(const char *name, uint32_t candidateTag = 0; if (sectionIndex < ANDROID_SECTION_COUNT) { // Match built-in tags (typically android.*) - uint32_t tagBegin, tagEnd; // [tagBegin, tagEnd) + uint32_t tagBegin, tagEnd; // [tagBegin, tagEnd) tagBegin = camera_metadata_section_bounds[sectionIndex][0]; tagEnd = camera_metadata_section_bounds[sectionIndex][1]; for (candidateTag = tagBegin; candidateTag < tagEnd; ++candidateTag) { - const char *tagName = get_camera_metadata_tag_name(candidateTag); + const char* tagName = get_camera_metadata_tag_name(candidateTag); if (strcmp(nameTagName, tagName) == 0) { - ALOGV("%s: Found matched tag '%s' (%d)", - __FUNCTION__, tagName, candidateTag); + ALOGV("%s: Found matched tag '%s' (%d)", __FUNCTION__, tagName, candidateTag); break; } } @@ -554,10 +522,8 @@ status_t CameraMetadata::getTagFromName(const char *name, return OK; } - -} // namespace helper -} // namespace V1_0 -} // namespace common -} // namespace camera -} // namespace hardware -} // namespace android +} // namespace helper +} // namespace common +} // namespace camera +} // namespace hardware +} // namespace android diff --git a/camera/common/1.0/default/CameraModule.cpp b/camera/common/default/CameraModule.cpp similarity index 84% rename from camera/common/1.0/default/CameraModule.cpp rename to camera/common/default/CameraModule.cpp index 16fb85cc64..9960842ead 100644 --- a/camera/common/1.0/default/CameraModule.cpp +++ b/camera/common/default/CameraModule.cpp @@ -16,7 +16,7 @@ #define LOG_TAG "CamComm1.0-CamModule" #define ATRACE_TAG ATRACE_TAG_CAMERA -//#define LOG_NDEBUG 0 +// #define LOG_NDEBUG 0 #include @@ -26,11 +26,9 @@ namespace android { namespace hardware { namespace camera { namespace common { -namespace V1_0 { namespace helper { -void CameraModule::deriveCameraCharacteristicsKeys( - uint32_t deviceVersion, CameraMetadata &chars) { +void CameraModule::deriveCameraCharacteristicsKeys(uint32_t deviceVersion, CameraMetadata& chars) { ATRACE_CALL(); Vector derivedCharKeys; @@ -40,9 +38,9 @@ void CameraModule::deriveCameraCharacteristicsKeys( if (deviceVersion < CAMERA_DEVICE_API_VERSION_3_3) { Vector controlModes; uint8_t data = ANDROID_CONTROL_AE_LOCK_AVAILABLE_TRUE; - chars.update(ANDROID_CONTROL_AE_LOCK_AVAILABLE, &data, /*count*/1); + chars.update(ANDROID_CONTROL_AE_LOCK_AVAILABLE, &data, /*count*/ 1); data = ANDROID_CONTROL_AWB_LOCK_AVAILABLE_TRUE; - chars.update(ANDROID_CONTROL_AWB_LOCK_AVAILABLE, &data, /*count*/1); + chars.update(ANDROID_CONTROL_AWB_LOCK_AVAILABLE, &data, /*count*/ 1); controlModes.push(ANDROID_CONTROL_MODE_AUTO); camera_metadata_entry entry = chars.find(ANDROID_CONTROL_AVAILABLE_SCENE_MODES); if (entry.count > 1 || entry.data.u8[0] != ANDROID_CONTROL_SCENE_MODE_DISABLED) { @@ -121,14 +119,14 @@ void CameraModule::deriveCameraCharacteristicsKeys( if (entry.count > 0) { Vector highSpeedConfig; for (size_t i = 0; i < entry.count; i += 4) { - highSpeedConfig.add(entry.data.i32[i]); // width - highSpeedConfig.add(entry.data.i32[i + 1]); // height - highSpeedConfig.add(entry.data.i32[i + 2]); // fps_min - highSpeedConfig.add(entry.data.i32[i + 3]); // fps_max - highSpeedConfig.add(1); // batchSize_max. default to 1 for HAL3.2 + highSpeedConfig.add(entry.data.i32[i]); // width + highSpeedConfig.add(entry.data.i32[i + 1]); // height + highSpeedConfig.add(entry.data.i32[i + 2]); // fps_min + highSpeedConfig.add(entry.data.i32[i + 3]); // fps_max + highSpeedConfig.add(1); // batchSize_max. default to 1 for HAL3.2 } chars.update(ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS, - highSpeedConfig); + highSpeedConfig); } } @@ -145,25 +143,23 @@ void CameraModule::deriveCameraCharacteristicsKeys( const int STREAM_IS_INPUT_OFFSET = 3; Vector rawOpaqueSizes; - for (size_t i=0; i < entry.count; i += STREAM_CONFIGURATION_SIZE) { + for (size_t i = 0; i < entry.count; i += STREAM_CONFIGURATION_SIZE) { int32_t format = entry.data.i32[i + STREAM_FORMAT_OFFSET]; int32_t width = entry.data.i32[i + STREAM_WIDTH_OFFSET]; int32_t height = entry.data.i32[i + STREAM_HEIGHT_OFFSET]; int32_t isInput = entry.data.i32[i + STREAM_IS_INPUT_OFFSET]; if (isInput == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT && - format == HAL_PIXEL_FORMAT_RAW_OPAQUE) { + format == HAL_PIXEL_FORMAT_RAW_OPAQUE) { supportRawOpaque = true; rawOpaqueSizes.push(width); rawOpaqueSizes.push(height); // 2 bytes per pixel. This rough estimation is only used when // HAL does not fill in the opaque raw size - rawOpaqueSizes.push(width * height *2); + rawOpaqueSizes.push(width * height * 2); } if (isInput == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT && - (format == HAL_PIXEL_FORMAT_RAW16 || - format == HAL_PIXEL_FORMAT_RAW10 || - format == HAL_PIXEL_FORMAT_RAW12 || - format == HAL_PIXEL_FORMAT_RAW_OPAQUE)) { + (format == HAL_PIXEL_FORMAT_RAW16 || format == HAL_PIXEL_FORMAT_RAW10 || + format == HAL_PIXEL_FORMAT_RAW12 || format == HAL_PIXEL_FORMAT_RAW_OPAQUE)) { supportAnyRaw = true; } } @@ -183,9 +179,7 @@ void CameraModule::deriveCameraCharacteristicsKeys( entry = chars.find(ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE); if (entry.count == 0) { // Fill in default value (100, 100) - chars.update( - ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE, - defaultRange, 2); + chars.update(ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE, defaultRange, 2); derivedCharKeys.push(ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE); // Actual request/results will be derived by camera device. derivedRequestKeys.push(ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST); @@ -197,22 +191,19 @@ void CameraModule::deriveCameraCharacteristicsKeys( // Add those newly added keys to AVAILABLE_CHARACTERISTICS_KEYS // This has to be done at this end of this function. if (derivedCharKeys.size() > 0) { - appendAvailableKeys( - chars, ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS, derivedCharKeys); + appendAvailableKeys(chars, ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS, derivedCharKeys); } if (derivedRequestKeys.size() > 0) { - appendAvailableKeys( - chars, ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS, derivedRequestKeys); + appendAvailableKeys(chars, ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS, derivedRequestKeys); } if (derivedResultKeys.size() > 0) { - appendAvailableKeys( - chars, ANDROID_REQUEST_AVAILABLE_RESULT_KEYS, derivedResultKeys); + appendAvailableKeys(chars, ANDROID_REQUEST_AVAILABLE_RESULT_KEYS, derivedResultKeys); } return; } -void CameraModule::appendAvailableKeys(CameraMetadata &chars, - int32_t keyTag, const Vector& appendKeys) { +void CameraModule::appendAvailableKeys(CameraMetadata& chars, int32_t keyTag, + const Vector& appendKeys) { camera_metadata_entry entry = chars.find(keyTag); Vector availableKeys; availableKeys.setCapacity(entry.count + appendKeys.size()); @@ -225,7 +216,7 @@ void CameraModule::appendAvailableKeys(CameraMetadata &chars, chars.update(keyTag, availableKeys); } -CameraModule::CameraModule(camera_module_t *module) : mNumberOfCameras(0) { +CameraModule::CameraModule(camera_module_t* module) : mNumberOfCameras(0) { if (module == NULL) { ALOGE("%s: camera hardware module must not be null", __FUNCTION__); assert(0); @@ -233,8 +224,7 @@ CameraModule::CameraModule(camera_module_t *module) : mNumberOfCameras(0) { mModule = module; } -CameraModule::~CameraModule() -{ +CameraModule::~CameraModule() { while (mCameraInfoMap.size() > 0) { camera_info cameraInfo = mCameraInfoMap.editValueAt(0); if (cameraInfo.static_camera_characteristics != NULL) { @@ -256,8 +246,7 @@ CameraModule::~CameraModule() int CameraModule::init() { ATRACE_CALL(); int res = OK; - if (getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_4 && - mModule->init != NULL) { + if (getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_4 && mModule->init != NULL) { ATRACE_BEGIN("camera_module->init"); res = mModule->init(); ATRACE_END(); @@ -267,7 +256,7 @@ int CameraModule::init() { return res; } -int CameraModule::getCameraInfo(int cameraId, struct camera_info *info) { +int CameraModule::getCameraInfo(int cameraId, struct camera_info* info) { ATRACE_CALL(); Mutex::Autolock lock(mCameraInfoLock); if (cameraId < 0) { @@ -318,7 +307,7 @@ int CameraModule::getCameraInfo(int cameraId, struct camera_info *info) { return OK; } -int CameraModule::getPhysicalCameraInfo(int physicalCameraId, camera_metadata_t **physicalInfo) { +int CameraModule::getPhysicalCameraInfo(int physicalCameraId, camera_metadata_t** physicalInfo) { ATRACE_CALL(); Mutex::Autolock lock(mCameraInfoLock); if (physicalCameraId < mNumberOfCameras) { @@ -330,7 +319,7 @@ int CameraModule::getPhysicalCameraInfo(int physicalCameraId, camera_metadata_t int apiVersion = mModule->common.module_api_version; if (apiVersion < CAMERA_MODULE_API_VERSION_2_5) { ALOGE("%s: Module version must be at least 2.5 to handle getPhysicalCameraInfo", - __FUNCTION__); + __FUNCTION__); return -ENODEV; } if (mModule->get_physical_camera_info == nullptr) { @@ -341,7 +330,7 @@ int CameraModule::getPhysicalCameraInfo(int physicalCameraId, camera_metadata_t ssize_t index = mPhysicalCameraInfoMap.indexOfKey(physicalCameraId); if (index == NAME_NOT_FOUND) { // Get physical camera characteristics, and cache it - camera_metadata_t *info = nullptr; + camera_metadata_t* info = nullptr; ATRACE_BEGIN("camera_module->get_physical_camera_info"); int ret = mModule->get_physical_camera_info(physicalCameraId, &info); ATRACE_END(); @@ -396,8 +385,7 @@ bool CameraModule::isOpenLegacyDefined() const { return mModule->open_legacy != NULL; } -int CameraModule::openLegacy( - const char* id, uint32_t halVersion, struct hw_device_t** device) { +int CameraModule::openLegacy(const char* id, uint32_t halVersion, struct hw_device_t** device) { int res; ATRACE_BEGIN("camera_module->open_legacy"); res = mModule->open_legacy(&mModule->common, id, halVersion, device); @@ -413,7 +401,7 @@ int CameraModule::getNumberOfCameras() { return numCameras; } -int CameraModule::setCallbacks(const camera_module_callbacks_t *callbacks) { +int CameraModule::setCallbacks(const camera_module_callbacks_t* callbacks) { int res = OK; ATRACE_BEGIN("camera_module->set_callbacks"); if (getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_1) { @@ -438,8 +426,7 @@ void CameraModule::getVendorTagOps(vendor_tag_ops_t* ops) { bool CameraModule::isSetTorchModeSupported() const { if (getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_4) { if (mModule->set_torch_mode == NULL) { - ALOGE("%s: Module 2.4 device must support set torch API!", - __FUNCTION__); + ALOGE("%s: Module 2.4 device must support set torch API!", __FUNCTION__); return false; } return true; @@ -457,7 +444,7 @@ int CameraModule::setTorchMode(const char* camera_id, bool enable) { return res; } -int CameraModule::isStreamCombinationSupported(int cameraId, camera_stream_combination_t *streams) { +int CameraModule::isStreamCombinationSupported(int cameraId, camera_stream_combination_t* streams) { int res = INVALID_OPERATION; if (mModule->is_stream_combination_supported != NULL) { ATRACE_BEGIN("camera_module->is_stream_combination_supported"); @@ -468,44 +455,41 @@ int CameraModule::isStreamCombinationSupported(int cameraId, camera_stream_combi } void CameraModule::notifyDeviceStateChange(uint64_t deviceState) { - if (getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_5 && - mModule->notify_device_state_change != NULL) { - ATRACE_BEGIN("camera_module->notify_device_state_change"); - ALOGI("%s: calling notify_device_state_change with state %" PRId64, __FUNCTION__, - deviceState); - mModule->notify_device_state_change(deviceState); - ATRACE_END(); - } + if (getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_5 && + mModule->notify_device_state_change != NULL) { + ATRACE_BEGIN("camera_module->notify_device_state_change"); + ALOGI("%s: calling notify_device_state_change with state %" PRId64, __FUNCTION__, + deviceState); + mModule->notify_device_state_change(deviceState); + ATRACE_END(); + } } -bool CameraModule::isLogicalMultiCamera( - const common::V1_0::helper::CameraMetadata& metadata, - std::unordered_set* physicalCameraIds) { +bool CameraModule::isLogicalMultiCamera(const common::helper::CameraMetadata& metadata, + std::unordered_set* physicalCameraIds) { if (physicalCameraIds == nullptr) { ALOGE("%s: physicalCameraIds must not be null", __FUNCTION__); return false; } bool isLogicalMultiCamera = false; - camera_metadata_ro_entry_t capabilities = - metadata.find(ANDROID_REQUEST_AVAILABLE_CAPABILITIES); + camera_metadata_ro_entry_t capabilities = metadata.find(ANDROID_REQUEST_AVAILABLE_CAPABILITIES); for (size_t i = 0; i < capabilities.count; i++) { if (capabilities.data.u8[i] == - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA) { + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA) { isLogicalMultiCamera = true; break; } } if (isLogicalMultiCamera) { - camera_metadata_ro_entry_t entry = - metadata.find(ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS); + camera_metadata_ro_entry_t entry = metadata.find(ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS); const uint8_t* ids = entry.data.u8; size_t start = 0; for (size_t i = 0; i < entry.count; ++i) { if (ids[i] == '\0') { if (start != i) { - const char* physicalId = reinterpret_cast(ids+start); + const char* physicalId = reinterpret_cast(ids + start); physicalCameraIds->emplace(physicalId); } start = i + 1; @@ -516,7 +500,7 @@ bool CameraModule::isLogicalMultiCamera( } status_t CameraModule::filterOpenErrorCode(status_t err) { - switch(err) { + switch (err) { case NO_ERROR: case -EBUSY: case -EINVAL: @@ -533,9 +517,9 @@ void CameraModule::removeCamera(int cameraId) { // static_camera_characteristics if (getDeviceVersion(cameraId) >= CAMERA_DEVICE_API_VERSION_3_0) { std::unordered_set physicalIds; - camera_metadata_t *metadata = const_cast( + camera_metadata_t* metadata = const_cast( mCameraInfoMap.valueFor(cameraId).static_camera_characteristics); - common::V1_0::helper::CameraMetadata hidlMetadata(metadata); + common::helper::CameraMetadata hidlMetadata(metadata); if (isLogicalMultiCamera(hidlMetadata, &physicalIds)) { for (const auto& id : physicalIds) { @@ -545,7 +529,7 @@ void CameraModule::removeCamera(int cameraId) { mPhysicalCameraInfoMap.removeItem(idInt); } else { ALOGE("%s: Cannot find corresponding static metadata for physical id %s", - __FUNCTION__, id.c_str()); + __FUNCTION__, id.c_str()); } } } @@ -575,9 +559,8 @@ void* CameraModule::getDso() { return mModule->common.dso; } -} // namespace helper -} // namespace V1_0 -} // namespace common -} // namespace camera -} // namespace hardware -} // namespace android +} // namespace helper +} // namespace common +} // namespace camera +} // namespace hardware +} // namespace android diff --git a/camera/common/1.0/default/CameraParameters.cpp b/camera/common/default/CameraParameters.cpp similarity index 77% rename from camera/common/1.0/default/CameraParameters.cpp rename to camera/common/default/CameraParameters.cpp index e707b0855a..37e28a25d1 100644 --- a/camera/common/1.0/default/CameraParameters.cpp +++ b/camera/common/default/CameraParameters.cpp @@ -18,17 +18,16 @@ #define LOG_TAG "CameraParams" #include -#include #include +#include +#include #include #include "CameraParameters.h" -#include namespace android { namespace hardware { namespace camera { namespace common { -namespace V1_0 { namespace helper { // Parameter keys to communicate between camera application and driver. @@ -79,7 +78,8 @@ const char CameraParameters::KEY_EXPOSURE_COMPENSATION_STEP[] = "exposure-compen const char CameraParameters::KEY_AUTO_EXPOSURE_LOCK[] = "auto-exposure-lock"; const char CameraParameters::KEY_AUTO_EXPOSURE_LOCK_SUPPORTED[] = "auto-exposure-lock-supported"; const char CameraParameters::KEY_AUTO_WHITEBALANCE_LOCK[] = "auto-whitebalance-lock"; -const char CameraParameters::KEY_AUTO_WHITEBALANCE_LOCK_SUPPORTED[] = "auto-whitebalance-lock-supported"; +const char CameraParameters::KEY_AUTO_WHITEBALANCE_LOCK_SUPPORTED[] = + "auto-whitebalance-lock-supported"; const char CameraParameters::KEY_MAX_NUM_METERING_AREAS[] = "max-num-metering-areas"; const char CameraParameters::KEY_METERING_AREAS[] = "metering-areas"; const char CameraParameters::KEY_ZOOM[] = "zoom"; @@ -91,7 +91,8 @@ const char CameraParameters::KEY_FOCUS_DISTANCES[] = "focus-distances"; const char CameraParameters::KEY_VIDEO_FRAME_FORMAT[] = "video-frame-format"; const char CameraParameters::KEY_VIDEO_SIZE[] = "video-size"; const char CameraParameters::KEY_SUPPORTED_VIDEO_SIZES[] = "video-size-values"; -const char CameraParameters::KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO[] = "preferred-preview-size-for-video"; +const char CameraParameters::KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO[] = + "preferred-preview-size-for-video"; const char CameraParameters::KEY_MAX_NUM_DETECTED_FACES_HW[] = "max-num-detected-faces-hw"; const char CameraParameters::KEY_MAX_NUM_DETECTED_FACES_SW[] = "max-num-detected-faces-sw"; const char CameraParameters::KEY_RECORDING_HINT[] = "recording-hint"; @@ -160,7 +161,7 @@ const char CameraParameters::SCENE_MODE_HDR[] = "hdr"; const char CameraParameters::PIXEL_FORMAT_YUV422SP[] = "yuv422sp"; const char CameraParameters::PIXEL_FORMAT_YUV420SP[] = "yuv420sp"; const char CameraParameters::PIXEL_FORMAT_YUV422I[] = "yuv422i-yuyv"; -const char CameraParameters::PIXEL_FORMAT_YUV420P[] = "yuv420p"; +const char CameraParameters::PIXEL_FORMAT_YUV420P[] = "yuv420p"; const char CameraParameters::PIXEL_FORMAT_RGB565[] = "rgb565"; const char CameraParameters::PIXEL_FORMAT_RGBA8888[] = "rgba8888"; const char CameraParameters::PIXEL_FORMAT_JPEG[] = "jpeg"; @@ -180,17 +181,11 @@ const char CameraParameters::FOCUS_MODE_CONTINUOUS_PICTURE[] = "continuous-pictu const char CameraParameters::LIGHTFX_LOWLIGHT[] = "low-light"; const char CameraParameters::LIGHTFX_HDR[] = "high-dynamic-range"; -CameraParameters::CameraParameters() - : mMap() -{ -} +CameraParameters::CameraParameters() : mMap() {} -CameraParameters::~CameraParameters() -{ -} +CameraParameters::~CameraParameters() {} -String8 CameraParameters::flatten() const -{ +String8 CameraParameters::flatten() const { String8 flattened(""); size_t size = mMap.size(); @@ -202,31 +197,28 @@ String8 CameraParameters::flatten() const flattened += k; flattened += "="; flattened += v; - if (i != size-1) - flattened += ";"; + if (i != size - 1) flattened += ";"; } return flattened; } -void CameraParameters::unflatten(const String8 ¶ms) -{ - const char *a = params.string(); - const char *b; +void CameraParameters::unflatten(const String8& params) { + const char* a = params.string(); + const char* b; mMap.clear(); for (;;) { // Find the bounds of the key name. b = strchr(a, '='); - if (b == 0) - break; + if (b == 0) break; // Create the key string. - String8 k(a, (size_t)(b-a)); + String8 k(a, (size_t)(b - a)); // Find the value. - a = b+1; + a = b + 1; b = strchr(a, ';'); if (b == 0) { // If there's no semicolon, this is the last item. @@ -235,15 +227,13 @@ void CameraParameters::unflatten(const String8 ¶ms) break; } - String8 v(a, (size_t)(b-a)); + String8 v(a, (size_t)(b - a)); mMap.add(k, v); - a = b+1; + a = b + 1; } } - -void CameraParameters::set(const char *key, const char *value) -{ +void CameraParameters::set(const char* key, const char* value) { // i think i can do this with strspn() if (strchr(key, '=') || strchr(key, ';')) { // ALOGE("Key \"%s\"contains invalid character (= or ;)", key); @@ -258,54 +248,44 @@ void CameraParameters::set(const char *key, const char *value) mMap.replaceValueFor(String8(key), String8(value)); } -void CameraParameters::set(const char *key, int value) -{ +void CameraParameters::set(const char* key, int value) { char str[16]; sprintf(str, "%d", value); set(key, str); } -void CameraParameters::setFloat(const char *key, float value) -{ +void CameraParameters::setFloat(const char* key, float value) { char str[16]; // 14 should be enough. We overestimate to be safe. snprintf(str, sizeof(str), "%g", value); set(key, str); } -const char *CameraParameters::get(const char *key) const -{ +const char* CameraParameters::get(const char* key) const { String8 v = mMap.valueFor(String8(key)); - if (v.length() == 0) - return 0; + if (v.length() == 0) return 0; return v.string(); } -int CameraParameters::getInt(const char *key) const -{ - const char *v = get(key); - if (v == 0) - return -1; +int CameraParameters::getInt(const char* key) const { + const char* v = get(key); + if (v == 0) return -1; return strtol(v, 0, 0); } -float CameraParameters::getFloat(const char *key) const -{ - const char *v = get(key); +float CameraParameters::getFloat(const char* key) const { + const char* v = get(key); if (v == 0) return -1; return strtof(v, 0); } -void CameraParameters::remove(const char *key) -{ +void CameraParameters::remove(const char* key) { mMap.removeItem(String8(key)); } // Parse string like "640x480" or "10000,20000" -static int parse_pair(const char *str, int *first, int *second, char delim, - char **endptr = NULL) -{ +static int parse_pair(const char* str, int* first, int* second, char delim, char** endptr = NULL) { // Find the first integer. - char *end; + char* end; int w = (int)strtol(str, &end, 10); // If a delimeter does not immediately follow, give up. if (*end != delim) { @@ -314,7 +294,7 @@ static int parse_pair(const char *str, int *first, int *second, char delim, } // Find the second integer, immediately after the delimeter. - int h = (int)strtol(end+1, &end, 10); + int h = (int)strtol(end + 1, &end, 10); *first = w; *second = h; @@ -326,18 +306,16 @@ static int parse_pair(const char *str, int *first, int *second, char delim, return 0; } -static void parseSizesList(const char *sizesStr, Vector &sizes) -{ +static void parseSizesList(const char* sizesStr, Vector& sizes) { if (sizesStr == 0) { return; } - char *sizeStartPtr = (char *)sizesStr; + char* sizeStartPtr = (char*)sizesStr; while (true) { int width, height; - int success = parse_pair(sizeStartPtr, &width, &height, 'x', - &sizeStartPtr); + int success = parse_pair(sizeStartPtr, &width, &height, 'x', &sizeStartPtr); if (success == -1 || (*sizeStartPtr != ',' && *sizeStartPtr != '\0')) { ALOGE("Picture sizes string \"%s\" contains invalid character.", sizesStr); return; @@ -351,119 +329,101 @@ static void parseSizesList(const char *sizesStr, Vector &sizes) } } -void CameraParameters::setPreviewSize(int width, int height) -{ +void CameraParameters::setPreviewSize(int width, int height) { char str[32]; sprintf(str, "%dx%d", width, height); set(KEY_PREVIEW_SIZE, str); } -void CameraParameters::getPreviewSize(int *width, int *height) const -{ +void CameraParameters::getPreviewSize(int* width, int* height) const { *width = *height = -1; // Get the current string, if it doesn't exist, leave the -1x-1 - const char *p = get(KEY_PREVIEW_SIZE); - if (p == 0) return; + const char* p = get(KEY_PREVIEW_SIZE); + if (p == 0) return; parse_pair(p, width, height, 'x'); } -void CameraParameters::getPreferredPreviewSizeForVideo(int *width, int *height) const -{ +void CameraParameters::getPreferredPreviewSizeForVideo(int* width, int* height) const { *width = *height = -1; - const char *p = get(KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO); - if (p == 0) return; + const char* p = get(KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO); + if (p == 0) return; parse_pair(p, width, height, 'x'); } -void CameraParameters::getSupportedPreviewSizes(Vector &sizes) const -{ - const char *previewSizesStr = get(KEY_SUPPORTED_PREVIEW_SIZES); +void CameraParameters::getSupportedPreviewSizes(Vector& sizes) const { + const char* previewSizesStr = get(KEY_SUPPORTED_PREVIEW_SIZES); parseSizesList(previewSizesStr, sizes); } -void CameraParameters::setVideoSize(int width, int height) -{ +void CameraParameters::setVideoSize(int width, int height) { char str[32]; sprintf(str, "%dx%d", width, height); set(KEY_VIDEO_SIZE, str); } -void CameraParameters::getVideoSize(int *width, int *height) const -{ +void CameraParameters::getVideoSize(int* width, int* height) const { *width = *height = -1; - const char *p = get(KEY_VIDEO_SIZE); + const char* p = get(KEY_VIDEO_SIZE); if (p == 0) return; parse_pair(p, width, height, 'x'); } -void CameraParameters::getSupportedVideoSizes(Vector &sizes) const -{ - const char *videoSizesStr = get(KEY_SUPPORTED_VIDEO_SIZES); +void CameraParameters::getSupportedVideoSizes(Vector& sizes) const { + const char* videoSizesStr = get(KEY_SUPPORTED_VIDEO_SIZES); parseSizesList(videoSizesStr, sizes); } -void CameraParameters::setPreviewFrameRate(int fps) -{ +void CameraParameters::setPreviewFrameRate(int fps) { set(KEY_PREVIEW_FRAME_RATE, fps); } -int CameraParameters::getPreviewFrameRate() const -{ +int CameraParameters::getPreviewFrameRate() const { return getInt(KEY_PREVIEW_FRAME_RATE); } -void CameraParameters::getPreviewFpsRange(int *min_fps, int *max_fps) const -{ +void CameraParameters::getPreviewFpsRange(int* min_fps, int* max_fps) const { *min_fps = *max_fps = -1; - const char *p = get(KEY_PREVIEW_FPS_RANGE); + const char* p = get(KEY_PREVIEW_FPS_RANGE); if (p == 0) return; parse_pair(p, min_fps, max_fps, ','); } -void CameraParameters::setPreviewFormat(const char *format) -{ +void CameraParameters::setPreviewFormat(const char* format) { set(KEY_PREVIEW_FORMAT, format); } -const char *CameraParameters::getPreviewFormat() const -{ +const char* CameraParameters::getPreviewFormat() const { return get(KEY_PREVIEW_FORMAT); } -void CameraParameters::setPictureSize(int width, int height) -{ +void CameraParameters::setPictureSize(int width, int height) { char str[32]; sprintf(str, "%dx%d", width, height); set(KEY_PICTURE_SIZE, str); } -void CameraParameters::getPictureSize(int *width, int *height) const -{ +void CameraParameters::getPictureSize(int* width, int* height) const { *width = *height = -1; // Get the current string, if it doesn't exist, leave the -1x-1 - const char *p = get(KEY_PICTURE_SIZE); + const char* p = get(KEY_PICTURE_SIZE); if (p == 0) return; parse_pair(p, width, height, 'x'); } -void CameraParameters::getSupportedPictureSizes(Vector &sizes) const -{ - const char *pictureSizesStr = get(KEY_SUPPORTED_PICTURE_SIZES); +void CameraParameters::getSupportedPictureSizes(Vector& sizes) const { + const char* pictureSizesStr = get(KEY_SUPPORTED_PICTURE_SIZES); parseSizesList(pictureSizesStr, sizes); } -void CameraParameters::setPictureFormat(const char *format) -{ +void CameraParameters::setPictureFormat(const char* format) { set(KEY_PICTURE_FORMAT, format); } -const char *CameraParameters::getPictureFormat() const -{ +const char* CameraParameters::getPictureFormat() const { return get(KEY_PICTURE_FORMAT); } -void CameraParameters::dump() const -{ +void CameraParameters::dump() const { ALOGD("dump: mMap.size = %zu", mMap.size()); for (size_t i = 0; i < mMap.size(); i++) { String8 k, v; @@ -473,8 +433,7 @@ void CameraParameters::dump() const } } -status_t CameraParameters::dump(int fd, const Vector& /*args*/) const -{ +status_t CameraParameters::dump(int fd, const Vector& /*args*/) const { const size_t SIZE = 256; char buffer[SIZE]; String8 result; @@ -492,8 +451,7 @@ status_t CameraParameters::dump(int fd, const Vector& /*args*/) const } void CameraParameters::getSupportedPreviewFormats(Vector& formats) const { - const char* supportedPreviewFormats = - get(CameraParameters::KEY_SUPPORTED_PREVIEW_FORMATS); + const char* supportedPreviewFormats = get(CameraParameters::KEY_SUPPORTED_PREVIEW_FORMATS); if (supportedPreviewFormats == NULL) { ALOGW("%s: No supported preview formats.", __FUNCTION__); @@ -515,35 +473,31 @@ void CameraParameters::getSupportedPreviewFormats(Vector& formats) const { fmtStr.unlockBuffer(fmtStr.size()); } - int CameraParameters::previewFormatToEnum(const char* format) { - return - !format ? - HAL_PIXEL_FORMAT_YCrCb_420_SP : - !strcmp(format, PIXEL_FORMAT_YUV422SP) ? - HAL_PIXEL_FORMAT_YCbCr_422_SP : // NV16 - !strcmp(format, PIXEL_FORMAT_YUV420SP) ? - HAL_PIXEL_FORMAT_YCrCb_420_SP : // NV21 - !strcmp(format, PIXEL_FORMAT_YUV422I) ? - HAL_PIXEL_FORMAT_YCbCr_422_I : // YUY2 - !strcmp(format, PIXEL_FORMAT_YUV420P) ? - HAL_PIXEL_FORMAT_YV12 : // YV12 - !strcmp(format, PIXEL_FORMAT_RGB565) ? - HAL_PIXEL_FORMAT_RGB_565 : // RGB565 - !strcmp(format, PIXEL_FORMAT_RGBA8888) ? - HAL_PIXEL_FORMAT_RGBA_8888 : // RGB8888 - !strcmp(format, PIXEL_FORMAT_BAYER_RGGB) ? - HAL_PIXEL_FORMAT_RAW16 : // Raw sensor data - -1; + return !format ? HAL_PIXEL_FORMAT_YCrCb_420_SP + : !strcmp(format, PIXEL_FORMAT_YUV422SP) ? HAL_PIXEL_FORMAT_YCbCr_422_SP + : // NV16 + !strcmp(format, PIXEL_FORMAT_YUV420SP) ? HAL_PIXEL_FORMAT_YCrCb_420_SP + : // NV21 + !strcmp(format, PIXEL_FORMAT_YUV422I) ? HAL_PIXEL_FORMAT_YCbCr_422_I + : // YUY2 + !strcmp(format, PIXEL_FORMAT_YUV420P) ? HAL_PIXEL_FORMAT_YV12 + : // YV12 + !strcmp(format, PIXEL_FORMAT_RGB565) ? HAL_PIXEL_FORMAT_RGB_565 + : // RGB565 + !strcmp(format, PIXEL_FORMAT_RGBA8888) ? HAL_PIXEL_FORMAT_RGBA_8888 + : // RGB8888 + !strcmp(format, PIXEL_FORMAT_BAYER_RGGB) ? HAL_PIXEL_FORMAT_RAW16 + : // Raw sensor data + -1; } bool CameraParameters::isEmpty() const { return mMap.isEmpty(); } -}; -}; -}; -}; -}; -}; // namespace android +}; // namespace helper +}; // namespace common +}; // namespace camera +}; // namespace hardware +}; // namespace android diff --git a/camera/common/1.0/default/Exif.cpp b/camera/common/default/Exif.cpp similarity index 83% rename from camera/common/1.0/default/Exif.cpp rename to camera/common/default/Exif.cpp index 413b6bb975..f4b2a3189e 100644 --- a/camera/common/1.0/default/Exif.cpp +++ b/camera/common/default/Exif.cpp @@ -16,7 +16,7 @@ #define LOG_TAG "CamComm1.0-Exif" #define ATRACE_TAG ATRACE_TAG_CAMERA -//#define LOG_NDEBUG 0 +// #define LOG_NDEBUG 0 #include @@ -41,15 +41,12 @@ struct default_delete { } // namespace std - namespace android { namespace hardware { namespace camera { namespace common { -namespace V1_0 { namespace helper { - class ExifUtilsImpl : public ExifUtils { public: ExifUtilsImpl(); @@ -61,8 +58,7 @@ class ExifUtilsImpl : public ExifUtils { virtual bool initialize(); // set all known fields from a metadata structure - virtual bool setFromMetadata(const CameraMetadata& metadata, - const size_t imageWidth, + virtual bool setFromMetadata(const CameraMetadata& metadata, const size_t imageWidth, const size_t imageHeight); // sets the len aperture. @@ -254,7 +250,6 @@ class ExifUtilsImpl : public ExifUtils { // Returns false if memory allocation fails. virtual bool setExifVersion(const std::string& exif_version); - // Resets the pointers and memories. virtual void reset(); @@ -262,8 +257,7 @@ class ExifUtilsImpl : public ExifUtils { // if the tag exists. // Returns the entry of the tag. The reference count of returned ExifEntry is // two. - virtual std::unique_ptr addVariableLengthEntry(ExifIfd ifd, - ExifTag tag, + virtual std::unique_ptr addVariableLengthEntry(ExifIfd ifd, ExifTag tag, ExifFormat format, uint64_t components, unsigned int size); @@ -275,32 +269,17 @@ class ExifUtilsImpl : public ExifUtils { virtual std::unique_ptr addEntry(ExifIfd ifd, ExifTag tag); // Helpe functions to add exif data with different types. - virtual bool setShort(ExifIfd ifd, - ExifTag tag, - uint16_t value, - const std::string& msg); + virtual bool setShort(ExifIfd ifd, ExifTag tag, uint16_t value, const std::string& msg); - virtual bool setLong(ExifIfd ifd, - ExifTag tag, - uint32_t value, - const std::string& msg); + virtual bool setLong(ExifIfd ifd, ExifTag tag, uint32_t value, const std::string& msg); - virtual bool setRational(ExifIfd ifd, - ExifTag tag, - uint32_t numerator, - uint32_t denominator, + virtual bool setRational(ExifIfd ifd, ExifTag tag, uint32_t numerator, uint32_t denominator, const std::string& msg); - virtual bool setSRational(ExifIfd ifd, - ExifTag tag, - int32_t numerator, - int32_t denominator, + virtual bool setSRational(ExifIfd ifd, ExifTag tag, int32_t numerator, int32_t denominator, const std::string& msg); - virtual bool setString(ExifIfd ifd, - ExifTag tag, - ExifFormat format, - const std::string& buffer, + virtual bool setString(ExifIfd ifd, ExifTag tag, ExifFormat format, const std::string& buffer, const std::string& msg); // Destroys the buffer of APP1 segment if exists. @@ -313,37 +292,31 @@ class ExifUtilsImpl : public ExifUtils { uint8_t* app1_buffer_; // The length of |app1_buffer_|. unsigned int app1_length_; - }; -#define SET_SHORT(ifd, tag, value) \ - do { \ - if (setShort(ifd, tag, value, #tag) == false) \ - return false; \ +#define SET_SHORT(ifd, tag, value) \ + do { \ + if (setShort(ifd, tag, value, #tag) == false) return false; \ } while (0); -#define SET_LONG(ifd, tag, value) \ - do { \ - if (setLong(ifd, tag, value, #tag) == false) \ - return false; \ +#define SET_LONG(ifd, tag, value) \ + do { \ + if (setLong(ifd, tag, value, #tag) == false) return false; \ } while (0); -#define SET_RATIONAL(ifd, tag, numerator, denominator) \ - do { \ - if (setRational(ifd, tag, numerator, denominator, #tag) == false) \ - return false; \ +#define SET_RATIONAL(ifd, tag, numerator, denominator) \ + do { \ + if (setRational(ifd, tag, numerator, denominator, #tag) == false) return false; \ } while (0); -#define SET_SRATIONAL(ifd, tag, numerator, denominator) \ - do { \ - if (setSRational(ifd, tag, numerator, denominator, #tag) == false) \ - return false; \ +#define SET_SRATIONAL(ifd, tag, numerator, denominator) \ + do { \ + if (setSRational(ifd, tag, numerator, denominator, #tag) == false) return false; \ } while (0); #define SET_STRING(ifd, tag, format, buffer) \ do { \ - if (setString(ifd, tag, format, buffer, #tag) == false) \ - return false; \ + if (setString(ifd, tag, format, buffer, #tag) == false) return false; \ } while (0); // This comes from the Exif Version 2.2 standard table 6. @@ -353,30 +326,25 @@ static void setLatitudeOrLongitudeData(unsigned char* data, double num) { // Take the integer part of |num|. ExifLong degrees = static_cast(num); ExifLong minutes = static_cast(60 * (num - degrees)); - ExifLong microseconds = - static_cast(3600000000u * (num - degrees - minutes / 60.0)); + ExifLong microseconds = static_cast(3600000000u * (num - degrees - minutes / 60.0)); exif_set_rational(data, EXIF_BYTE_ORDER_INTEL, {degrees, 1}); - exif_set_rational(data + sizeof(ExifRational), EXIF_BYTE_ORDER_INTEL, - {minutes, 1}); + exif_set_rational(data + sizeof(ExifRational), EXIF_BYTE_ORDER_INTEL, {minutes, 1}); exif_set_rational(data + 2 * sizeof(ExifRational), EXIF_BYTE_ORDER_INTEL, - {microseconds, 1000000}); + {microseconds, 1000000}); } -ExifUtils *ExifUtils::create() { +ExifUtils* ExifUtils::create() { return new ExifUtilsImpl(); } -ExifUtils::~ExifUtils() { -} +ExifUtils::~ExifUtils() {} -ExifUtilsImpl::ExifUtilsImpl() - : exif_data_(nullptr), app1_buffer_(nullptr), app1_length_(0) {} +ExifUtilsImpl::ExifUtilsImpl() : exif_data_(nullptr), app1_buffer_(nullptr), app1_length_(0) {} ExifUtilsImpl::~ExifUtilsImpl() { reset(); } - bool ExifUtilsImpl::initialize() { reset(); exif_data_ = exif_data_new(); @@ -403,8 +371,7 @@ bool ExifUtilsImpl::setAperture(uint32_t numerator, uint32_t denominator) { } bool ExifUtilsImpl::setBrightness(int32_t numerator, int32_t denominator) { - SET_SRATIONAL(EXIF_IFD_EXIF, EXIF_TAG_BRIGHTNESS_VALUE, numerator, - denominator); + SET_SRATIONAL(EXIF_IFD_EXIF, EXIF_TAG_BRIGHTNESS_VALUE, numerator, denominator); return true; } @@ -413,10 +380,9 @@ bool ExifUtilsImpl::setColorSpace(uint16_t color_space) { return true; } -bool ExifUtilsImpl::setComponentsConfiguration( - const std::string& components_configuration) { - SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_COMPONENTS_CONFIGURATION, - EXIF_FORMAT_UNDEFINED, components_configuration); +bool ExifUtilsImpl::setComponentsConfiguration(const std::string& components_configuration) { + SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_COMPONENTS_CONFIGURATION, EXIF_FORMAT_UNDEFINED, + components_configuration); return true; } @@ -433,37 +399,31 @@ bool ExifUtilsImpl::setContrast(uint16_t contrast) { bool ExifUtilsImpl::setDateTime(const struct tm& t) { // The length is 20 bytes including NULL for termination in Exif standard. char str[20]; - int result = snprintf(str, sizeof(str), "%04i:%02i:%02i %02i:%02i:%02i", - t.tm_year + 1900, t.tm_mon + 1, t.tm_mday, t.tm_hour, - t.tm_min, t.tm_sec); + int result = snprintf(str, sizeof(str), "%04i:%02i:%02i %02i:%02i:%02i", t.tm_year + 1900, + t.tm_mon + 1, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec); if (result != sizeof(str) - 1) { ALOGW("%s: Input time is invalid", __FUNCTION__); return false; } std::string buffer(str); SET_STRING(EXIF_IFD_0, EXIF_TAG_DATE_TIME, EXIF_FORMAT_ASCII, buffer); - SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_DATE_TIME_ORIGINAL, EXIF_FORMAT_ASCII, - buffer); - SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_DATE_TIME_DIGITIZED, EXIF_FORMAT_ASCII, - buffer); + SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_DATE_TIME_ORIGINAL, EXIF_FORMAT_ASCII, buffer); + SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_DATE_TIME_DIGITIZED, EXIF_FORMAT_ASCII, buffer); return true; } bool ExifUtilsImpl::setDescription(const std::string& description) { - SET_STRING(EXIF_IFD_0, EXIF_TAG_IMAGE_DESCRIPTION, EXIF_FORMAT_ASCII, - description); + SET_STRING(EXIF_IFD_0, EXIF_TAG_IMAGE_DESCRIPTION, EXIF_FORMAT_ASCII, description); return true; } bool ExifUtilsImpl::setDigitalZoomRatio(uint32_t numerator, uint32_t denominator) { - SET_RATIONAL(EXIF_IFD_EXIF, EXIF_TAG_DIGITAL_ZOOM_RATIO, numerator, - denominator); + SET_RATIONAL(EXIF_IFD_EXIF, EXIF_TAG_DIGITAL_ZOOM_RATIO, numerator, denominator); return true; } bool ExifUtilsImpl::setExposureBias(int32_t numerator, int32_t denominator) { - SET_SRATIONAL(EXIF_IFD_EXIF, EXIF_TAG_EXPOSURE_BIAS_VALUE, numerator, - denominator); + SET_SRATIONAL(EXIF_IFD_EXIF, EXIF_TAG_EXPOSURE_BIAS_VALUE, numerator, denominator); return true; } @@ -526,7 +486,7 @@ bool ExifUtilsImpl::setGpsAltitude(double altitude) { return false; } exif_set_rational(entry->data, EXIF_BYTE_ORDER_INTEL, - {static_cast(altitude * 1000), 1000}); + {static_cast(altitude * 1000), 1000}); return true; } @@ -588,26 +548,23 @@ bool ExifUtilsImpl::setGpsLongitude(double longitude) { } bool ExifUtilsImpl::setGpsProcessingMethod(const std::string& method) { - std::string buffer = - std::string(gExifAsciiPrefix, sizeof(gExifAsciiPrefix)) + method; + std::string buffer = std::string(gExifAsciiPrefix, sizeof(gExifAsciiPrefix)) + method; SET_STRING(EXIF_IFD_GPS, static_cast(EXIF_TAG_GPS_PROCESSING_METHOD), - EXIF_FORMAT_UNDEFINED, buffer); + EXIF_FORMAT_UNDEFINED, buffer); return true; } bool ExifUtilsImpl::setGpsTimestamp(const struct tm& t) { const ExifTag dateTag = static_cast(EXIF_TAG_GPS_DATE_STAMP); const size_t kGpsDateStampSize = 11; - std::unique_ptr entry = - addVariableLengthEntry(EXIF_IFD_GPS, dateTag, EXIF_FORMAT_ASCII, - kGpsDateStampSize, kGpsDateStampSize); + std::unique_ptr entry = addVariableLengthEntry( + EXIF_IFD_GPS, dateTag, EXIF_FORMAT_ASCII, kGpsDateStampSize, kGpsDateStampSize); if (!entry) { ALOGE("%s: Adding GPSDateStamp exif entry failed", __FUNCTION__); return false; } - int result = - snprintf(reinterpret_cast(entry->data), kGpsDateStampSize, - "%04i:%02i:%02i", t.tm_year + 1900, t.tm_mon + 1, t.tm_mday); + int result = snprintf(reinterpret_cast(entry->data), kGpsDateStampSize, "%04i:%02i:%02i", + t.tm_year + 1900, t.tm_mon + 1, t.tm_mday); if (result != kGpsDateStampSize - 1) { ALOGW("%s: Input time is invalid", __FUNCTION__); return false; @@ -615,18 +572,16 @@ bool ExifUtilsImpl::setGpsTimestamp(const struct tm& t) { const ExifTag timeTag = static_cast(EXIF_TAG_GPS_TIME_STAMP); entry = addVariableLengthEntry(EXIF_IFD_GPS, timeTag, EXIF_FORMAT_RATIONAL, 3, - 3 * sizeof(ExifRational)); + 3 * sizeof(ExifRational)); if (!entry) { ALOGE("%s: Adding GPSTimeStamp exif entry failed", __FUNCTION__); return false; } - exif_set_rational(entry->data, EXIF_BYTE_ORDER_INTEL, - {static_cast(t.tm_hour), 1}); + exif_set_rational(entry->data, EXIF_BYTE_ORDER_INTEL, {static_cast(t.tm_hour), 1}); exif_set_rational(entry->data + sizeof(ExifRational), EXIF_BYTE_ORDER_INTEL, - {static_cast(t.tm_min), 1}); - exif_set_rational(entry->data + 2 * sizeof(ExifRational), - EXIF_BYTE_ORDER_INTEL, - {static_cast(t.tm_sec), 1}); + {static_cast(t.tm_min), 1}); + exif_set_rational(entry->data + 2 * sizeof(ExifRational), EXIF_BYTE_ORDER_INTEL, + {static_cast(t.tm_sec), 1}); return true; } @@ -654,8 +609,7 @@ bool ExifUtilsImpl::setLightSource(uint16_t light_source) { } bool ExifUtilsImpl::setMaxAperture(uint32_t numerator, uint32_t denominator) { - SET_RATIONAL(EXIF_IFD_EXIF, EXIF_TAG_MAX_APERTURE_VALUE, numerator, - denominator); + SET_RATIONAL(EXIF_IFD_EXIF, EXIF_TAG_MAX_APERTURE_VALUE, numerator, denominator); return true; } @@ -714,24 +668,19 @@ bool ExifUtilsImpl::setSharpness(uint16_t sharpness) { } bool ExifUtilsImpl::setShutterSpeed(int32_t numerator, int32_t denominator) { - SET_SRATIONAL(EXIF_IFD_EXIF, EXIF_TAG_SHUTTER_SPEED_VALUE, numerator, - denominator); + SET_SRATIONAL(EXIF_IFD_EXIF, EXIF_TAG_SHUTTER_SPEED_VALUE, numerator, denominator); return true; } bool ExifUtilsImpl::setSubjectDistance(uint32_t numerator, uint32_t denominator) { - SET_RATIONAL(EXIF_IFD_EXIF, EXIF_TAG_SUBJECT_DISTANCE, numerator, - denominator); + SET_RATIONAL(EXIF_IFD_EXIF, EXIF_TAG_SUBJECT_DISTANCE, numerator, denominator); return true; } bool ExifUtilsImpl::setSubsecTime(const std::string& subsec_time) { - SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_SUB_SEC_TIME, EXIF_FORMAT_ASCII, - subsec_time); - SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_SUB_SEC_TIME_ORIGINAL, EXIF_FORMAT_ASCII, - subsec_time); - SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_SUB_SEC_TIME_DIGITIZED, EXIF_FORMAT_ASCII, - subsec_time); + SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_SUB_SEC_TIME, EXIF_FORMAT_ASCII, subsec_time); + SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_SUB_SEC_TIME_ORIGINAL, EXIF_FORMAT_ASCII, subsec_time); + SET_STRING(EXIF_IFD_EXIF, EXIF_TAG_SUB_SEC_TIME_DIGITIZED, EXIF_FORMAT_ASCII, subsec_time); return true; } @@ -816,8 +765,7 @@ void ExifUtilsImpl::reset() { } } -std::unique_ptr ExifUtilsImpl::addVariableLengthEntry(ExifIfd ifd, - ExifTag tag, +std::unique_ptr ExifUtilsImpl::addVariableLengthEntry(ExifIfd ifd, ExifTag tag, ExifFormat format, uint64_t components, unsigned int size) { @@ -872,10 +820,7 @@ std::unique_ptr ExifUtilsImpl::addEntry(ExifIfd ifd, ExifTag tag) { return entry; } -bool ExifUtilsImpl::setShort(ExifIfd ifd, - ExifTag tag, - uint16_t value, - const std::string& msg) { +bool ExifUtilsImpl::setShort(ExifIfd ifd, ExifTag tag, uint16_t value, const std::string& msg) { std::unique_ptr entry = addEntry(ifd, tag); if (!entry) { ALOGE("%s: Adding '%s' entry failed", __FUNCTION__, msg.c_str()); @@ -885,10 +830,7 @@ bool ExifUtilsImpl::setShort(ExifIfd ifd, return true; } -bool ExifUtilsImpl::setLong(ExifIfd ifd, - ExifTag tag, - uint32_t value, - const std::string& msg) { +bool ExifUtilsImpl::setLong(ExifIfd ifd, ExifTag tag, uint32_t value, const std::string& msg) { std::unique_ptr entry = addEntry(ifd, tag); if (!entry) { ALOGE("%s: Adding '%s' entry failed", __FUNCTION__, msg.c_str()); @@ -898,41 +840,30 @@ bool ExifUtilsImpl::setLong(ExifIfd ifd, return true; } -bool ExifUtilsImpl::setRational(ExifIfd ifd, - ExifTag tag, - uint32_t numerator, - uint32_t denominator, +bool ExifUtilsImpl::setRational(ExifIfd ifd, ExifTag tag, uint32_t numerator, uint32_t denominator, const std::string& msg) { std::unique_ptr entry = addEntry(ifd, tag); if (!entry) { ALOGE("%s: Adding '%s' entry failed", __FUNCTION__, msg.c_str()); return false; } - exif_set_rational(entry->data, EXIF_BYTE_ORDER_INTEL, - {numerator, denominator}); + exif_set_rational(entry->data, EXIF_BYTE_ORDER_INTEL, {numerator, denominator}); return true; } -bool ExifUtilsImpl::setSRational(ExifIfd ifd, - ExifTag tag, - int32_t numerator, - int32_t denominator, +bool ExifUtilsImpl::setSRational(ExifIfd ifd, ExifTag tag, int32_t numerator, int32_t denominator, const std::string& msg) { std::unique_ptr entry = addEntry(ifd, tag); if (!entry) { ALOGE("%s: Adding '%s' entry failed", __FUNCTION__, msg.c_str()); return false; } - exif_set_srational(entry->data, EXIF_BYTE_ORDER_INTEL, - {numerator, denominator}); + exif_set_srational(entry->data, EXIF_BYTE_ORDER_INTEL, {numerator, denominator}); return true; } -bool ExifUtilsImpl::setString(ExifIfd ifd, - ExifTag tag, - ExifFormat format, - const std::string& buffer, - const std::string& msg) { +bool ExifUtilsImpl::setString(ExifIfd ifd, ExifTag tag, ExifFormat format, + const std::string& buffer, const std::string& msg) { size_t entry_size = buffer.length(); // Since the exif format is undefined, NULL termination is not necessary. if (format == EXIF_FORMAT_ASCII) { @@ -959,13 +890,11 @@ void ExifUtilsImpl::destroyApp1() { app1_length_ = 0; } -bool ExifUtilsImpl::setFromMetadata(const CameraMetadata& metadata, - const size_t imageWidth, +bool ExifUtilsImpl::setFromMetadata(const CameraMetadata& metadata, const size_t imageWidth, const size_t imageHeight) { // How precise the float-to-rational conversion for EXIF tags would be. constexpr int kRationalPrecision = 10000; - if (!setImageWidth(imageWidth) || - !setImageHeight(imageHeight)) { + if (!setImageWidth(imageWidth) || !setImageHeight(imageHeight)) { ALOGE("%s: setting image resolution failed.", __FUNCTION__); return false; } @@ -984,9 +913,8 @@ bool ExifUtilsImpl::setFromMetadata(const CameraMetadata& metadata, if (entry.count) { focal_length = entry.data.f[0]; - if (!setFocalLength( - static_cast(focal_length * kRationalPrecision), - kRationalPrecision)) { + if (!setFocalLength(static_cast(focal_length * kRationalPrecision), + kRationalPrecision)) { ALOGE("%s: setting focal length failed.", __FUNCTION__); return false; } @@ -1048,7 +976,7 @@ bool ExifUtilsImpl::setFromMetadata(const CameraMetadata& metadata, if (metadata.exists(ANDROID_SENSOR_EXPOSURE_TIME)) { entry = metadata.find(ANDROID_SENSOR_EXPOSURE_TIME); // int64_t of nanoseconds - if (!setExposureTime(entry.data.i64[0],1000000000u)) { + if (!setExposureTime(entry.data.i64[0], 1000000000u)) { ALOGE("%s: setting exposure time failed.", __FUNCTION__); return false; } @@ -1057,8 +985,7 @@ bool ExifUtilsImpl::setFromMetadata(const CameraMetadata& metadata, if (metadata.exists(ANDROID_LENS_APERTURE)) { const int kAperturePrecision = 10000; entry = metadata.find(ANDROID_LENS_APERTURE); - if (!setFNumber(entry.data.f[0] * kAperturePrecision, - kAperturePrecision)) { + if (!setFNumber(entry.data.f[0] * kAperturePrecision, kAperturePrecision)) { ALOGE("%s: setting F number failed.", __FUNCTION__); return false; } @@ -1073,7 +1000,7 @@ bool ExifUtilsImpl::setFromMetadata(const CameraMetadata& metadata, return false; } } else { - ALOGE("%s: Unsupported flash info: %d",__FUNCTION__, entry.data.u8[0]); + ALOGE("%s: Unsupported flash info: %d", __FUNCTION__, entry.data.u8[0]); return false; } } @@ -1107,9 +1034,8 @@ bool ExifUtilsImpl::setFromMetadata(const CameraMetadata& metadata, return true; } -} // namespace helper -} // namespace V1_0 -} // namespace common -} // namespace camera -} // namespace hardware -} // namespace android +} // namespace helper +} // namespace common +} // namespace camera +} // namespace hardware +} // namespace android diff --git a/camera/common/1.0/default/HandleImporter.cpp b/camera/common/default/HandleImporter.cpp similarity index 74% rename from camera/common/1.0/default/HandleImporter.cpp rename to camera/common/default/HandleImporter.cpp index d2fdf02457..1145baa5f1 100644 --- a/camera/common/1.0/default/HandleImporter.cpp +++ b/camera/common/default/HandleImporter.cpp @@ -18,14 +18,13 @@ #include "HandleImporter.h" #include -#include "aidl/android/hardware/graphics/common/Smpte2086.h" #include +#include "aidl/android/hardware/graphics/common/Smpte2086.h" namespace android { namespace hardware { namespace camera { namespace common { -namespace V1_0 { namespace helper { using aidl::android::hardware::graphics::common::PlaneLayout; @@ -75,20 +74,18 @@ void HandleImporter::cleanup() { mInitialized = false; } -template +template bool HandleImporter::importBufferInternal(const sp mapper, buffer_handle_t& handle) { E error; buffer_handle_t importedHandle; auto ret = mapper->importBuffer( - hidl_handle(handle), - [&](const auto& tmpError, const auto& tmpBufferHandle) { - error = tmpError; - importedHandle = static_cast(tmpBufferHandle); - }); + hidl_handle(handle), [&](const auto& tmpError, const auto& tmpBufferHandle) { + error = tmpError; + importedHandle = static_cast(tmpBufferHandle); + }); if (!ret.isOk()) { - ALOGE("%s: mapper importBuffer failed: %s", - __FUNCTION__, ret.description().c_str()); + ALOGE("%s: mapper importBuffer failed: %s", __FUNCTION__, ret.description().c_str()); return false; } @@ -100,61 +97,62 @@ bool HandleImporter::importBufferInternal(const sp mapper, buffer_handle_t& h return true; } -template +template YCbCrLayout HandleImporter::lockYCbCrInternal(const sp mapper, buffer_handle_t& buf, - uint64_t cpuUsage, const IMapper::Rect& accessRegion) { + uint64_t cpuUsage, + const IMapper::Rect& accessRegion) { hidl_handle acquireFenceHandle; auto buffer = const_cast(buf); YCbCrLayout layout = {}; - typename M::Rect accessRegionCopy = {accessRegion.left, accessRegion.top, - accessRegion.width, accessRegion.height}; + typename M::Rect accessRegionCopy = {accessRegion.left, accessRegion.top, accessRegion.width, + accessRegion.height}; mapper->lockYCbCr(buffer, cpuUsage, accessRegionCopy, acquireFenceHandle, - [&](const auto& tmpError, const auto& tmpLayout) { - if (tmpError == E::NONE) { - // Member by member copy from different versions of YCbCrLayout. - layout.y = tmpLayout.y; - layout.cb = tmpLayout.cb; - layout.cr = tmpLayout.cr; - layout.yStride = tmpLayout.yStride; - layout.cStride = tmpLayout.cStride; - layout.chromaStep = tmpLayout.chromaStep; - } else { - ALOGE("%s: failed to lockYCbCr error %d!", __FUNCTION__, tmpError); - } - }); + [&](const auto& tmpError, const auto& tmpLayout) { + if (tmpError == E::NONE) { + // Member by member copy from different versions of YCbCrLayout. + layout.y = tmpLayout.y; + layout.cb = tmpLayout.cb; + layout.cr = tmpLayout.cr; + layout.yStride = tmpLayout.yStride; + layout.cStride = tmpLayout.cStride; + layout.chromaStep = tmpLayout.chromaStep; + } else { + ALOGE("%s: failed to lockYCbCr error %d!", __FUNCTION__, tmpError); + } + }); return layout; } bool isMetadataPesent(const sp mapper, const buffer_handle_t& buf, - MetadataType metadataType) { + MetadataType metadataType) { auto buffer = const_cast(buf); bool ret = false; hidl_vec vec; - mapper->get(buffer, metadataType, [&] (const auto& tmpError, - const auto& tmpMetadata) { - if (tmpError == MapperErrorV4::NONE) { - vec = tmpMetadata; - } else { - ALOGE("%s: failed to get metadata %d!", __FUNCTION__, tmpError); - }}); + mapper->get(buffer, metadataType, [&](const auto& tmpError, const auto& tmpMetadata) { + if (tmpError == MapperErrorV4::NONE) { + vec = tmpMetadata; + } else { + ALOGE("%s: failed to get metadata %d!", __FUNCTION__, tmpError); + } + }); if (vec.size() > 0) { - if (metadataType == gralloc4::MetadataType_Smpte2086){ - std::optional realSmpte2086; - gralloc4::decodeSmpte2086(vec, &realSmpte2086); - ret = realSmpte2086.has_value(); - } else if (metadataType == gralloc4::MetadataType_Smpte2094_10) { - std::optional> realSmpte2094_10; - gralloc4::decodeSmpte2094_10(vec, &realSmpte2094_10); - ret = realSmpte2094_10.has_value(); - } else if (metadataType == gralloc4::MetadataType_Smpte2094_40) { - std::optional> realSmpte2094_40; - gralloc4::decodeSmpte2094_40(vec, &realSmpte2094_40); - ret = realSmpte2094_40.has_value(); - } else { - ALOGE("%s: Unknown metadata type!", __FUNCTION__); - } + if (metadataType == gralloc4::MetadataType_Smpte2086) { + std::optional realSmpte2086; + gralloc4::decodeSmpte2086(vec, &realSmpte2086); + ret = realSmpte2086.has_value(); + } else if (metadataType == gralloc4::MetadataType_Smpte2094_10) { + std::optional> realSmpte2094_10; + gralloc4::decodeSmpte2094_10(vec, &realSmpte2094_10); + ret = realSmpte2094_10.has_value(); + } else if (metadataType == gralloc4::MetadataType_Smpte2094_40) { + std::optional> realSmpte2094_40; + gralloc4::decodeSmpte2094_40(vec, &realSmpte2094_40); + ret = realSmpte2094_40.has_value(); + } else { + ALOGE("%s: Unknown metadata type!", __FUNCTION__); + } } return ret; @@ -239,31 +237,29 @@ YCbCrLayout HandleImporter::lockYCbCrInternal( return layout; } -template +template int HandleImporter::unlockInternal(const sp mapper, buffer_handle_t& buf) { int releaseFence = -1; auto buffer = const_cast(buf); - mapper->unlock( - buffer, [&](const auto& tmpError, const auto& tmpReleaseFence) { - if (tmpError == E::NONE) { - auto fenceHandle = tmpReleaseFence.getNativeHandle(); - if (fenceHandle) { - if (fenceHandle->numInts != 0 || fenceHandle->numFds != 1) { - ALOGE("%s: bad release fence numInts %d numFds %d", - __FUNCTION__, fenceHandle->numInts, fenceHandle->numFds); - return; - } - releaseFence = dup(fenceHandle->data[0]); - if (releaseFence < 0) { - ALOGE("%s: bad release fence FD %d", - __FUNCTION__, releaseFence); - } + mapper->unlock(buffer, [&](const auto& tmpError, const auto& tmpReleaseFence) { + if (tmpError == E::NONE) { + auto fenceHandle = tmpReleaseFence.getNativeHandle(); + if (fenceHandle) { + if (fenceHandle->numInts != 0 || fenceHandle->numFds != 1) { + ALOGE("%s: bad release fence numInts %d numFds %d", __FUNCTION__, + fenceHandle->numInts, fenceHandle->numFds); + return; + } + releaseFence = dup(fenceHandle->data[0]); + if (releaseFence < 0) { + ALOGE("%s: bad release fence FD %d", __FUNCTION__, releaseFence); } - } else { - ALOGE("%s: failed to unlock error %d!", __FUNCTION__, tmpError); } - }); + } else { + ALOGE("%s: failed to unlock error %d!", __FUNCTION__, tmpError); + } + }); return releaseFence; } @@ -315,14 +311,12 @@ void HandleImporter::freeBuffer(buffer_handle_t handle) { } else if (mMapperV3 != nullptr) { auto ret = mMapperV3->freeBuffer(const_cast(handle)); if (!ret.isOk()) { - ALOGE("%s: mapper freeBuffer failed: %s", - __FUNCTION__, ret.description().c_str()); + ALOGE("%s: mapper freeBuffer failed: %s", __FUNCTION__, ret.description().c_str()); } } else { auto ret = mMapperV2->freeBuffer(const_cast(handle)); if (!ret.isOk()) { - ALOGE("%s: mapper freeBuffer failed: %s", - __FUNCTION__, ret.description().c_str()); + ALOGE("%s: mapper freeBuffer failed: %s", __FUNCTION__, ret.description().c_str()); } } } @@ -337,8 +331,7 @@ bool HandleImporter::importFence(const native_handle_t* handle, int& fd) const { return false; } } else { - ALOGE("invalid fence handle with %d file descriptors", - handle->numFds); + ALOGE("invalid fence handle with %d file descriptors", handle->numFds); return false; } @@ -351,8 +344,7 @@ void HandleImporter::closeFence(int fd) const { } } -void* HandleImporter::lock( - buffer_handle_t& buf, uint64_t cpuUsage, size_t size) { +void* HandleImporter::lock(buffer_handle_t& buf, uint64_t cpuUsage, size_t size) { IMapper::Rect accessRegion{0, 0, static_cast(size), 1}; return lock(buf, cpuUsage, accessRegion); } @@ -401,13 +393,13 @@ void* HandleImporter::lock(buffer_handle_t& buf, uint64_t cpuUsage, }); } else { mMapperV2->lock(buffer, cpuUsage, accessRegion, acquireFenceHandle, - [&](const auto& tmpError, const auto& tmpPtr) { - if (tmpError == MapperErrorV2::NONE) { - ret = tmpPtr; - } else { - ALOGE("%s: failed to lock error %d!", __FUNCTION__, tmpError); - } - }); + [&](const auto& tmpError, const auto& tmpPtr) { + if (tmpError == MapperErrorV2::NONE) { + ret = tmpPtr; + } else { + ALOGE("%s: failed to lock error %d!", __FUNCTION__, tmpError); + } + }); } ALOGV("%s: ptr %p accessRegion.top: %d accessRegion.left: %d accessRegion.width: %d " @@ -417,9 +409,8 @@ void* HandleImporter::lock(buffer_handle_t& buf, uint64_t cpuUsage, return ret; } -YCbCrLayout HandleImporter::lockYCbCr( - buffer_handle_t& buf, uint64_t cpuUsage, - const IMapper::Rect& accessRegion) { +YCbCrLayout HandleImporter::lockYCbCr(buffer_handle_t& buf, uint64_t cpuUsage, + const IMapper::Rect& accessRegion) { Mutex::Autolock lock(mLock); if (!mInitialized) { @@ -431,20 +422,18 @@ YCbCrLayout HandleImporter::lockYCbCr( } if (mMapperV3 != nullptr) { - return lockYCbCrInternal( - mMapperV3, buf, cpuUsage, accessRegion); + return lockYCbCrInternal(mMapperV3, buf, cpuUsage, accessRegion); } if (mMapperV2 != nullptr) { - return lockYCbCrInternal( - mMapperV2, buf, cpuUsage, accessRegion); + return lockYCbCrInternal(mMapperV2, buf, cpuUsage, accessRegion); } ALOGE("%s: mMapperV4, mMapperV3 and mMapperV2 are all null!", __FUNCTION__); return {}; } -status_t HandleImporter::getMonoPlanarStrideBytes(buffer_handle_t &buf, uint32_t *stride /*out*/) { +status_t HandleImporter::getMonoPlanarStrideBytes(buffer_handle_t& buf, uint32_t* stride /*out*/) { if (stride == nullptr) { return BAD_VALUE; } @@ -458,7 +447,7 @@ status_t HandleImporter::getMonoPlanarStrideBytes(buffer_handle_t &buf, uint32_t if (mMapperV4 != nullptr) { std::vector planeLayouts = getPlaneLayouts(mMapperV4, buf); if (planeLayouts.size() != 1) { - ALOGE("%s: Unexpected number of planes %zu!", __FUNCTION__, planeLayouts.size()); + ALOGE("%s: Unexpected number of planes %zu!", __FUNCTION__, planeLayouts.size()); return BAD_VALUE; } @@ -534,10 +523,8 @@ bool HandleImporter::isSmpte2094_40Present(const buffer_handle_t& buf) { return false; } - -} // namespace helper -} // namespace V1_0 -} // namespace common -} // namespace camera -} // namespace hardware -} // namespace android +} // namespace helper +} // namespace common +} // namespace camera +} // namespace hardware +} // namespace android diff --git a/camera/common/1.0/default/OWNERS b/camera/common/default/OWNERS similarity index 100% rename from camera/common/1.0/default/OWNERS rename to camera/common/default/OWNERS diff --git a/camera/common/1.0/default/SimpleThread.cpp b/camera/common/default/SimpleThread.cpp similarity index 100% rename from camera/common/1.0/default/SimpleThread.cpp rename to camera/common/default/SimpleThread.cpp diff --git a/camera/common/1.0/default/VendorTagDescriptor.cpp b/camera/common/default/VendorTagDescriptor.cpp similarity index 91% rename from camera/common/1.0/default/VendorTagDescriptor.cpp rename to camera/common/default/VendorTagDescriptor.cpp index d2bee85daf..1282bd0ccb 100644 --- a/camera/common/1.0/default/VendorTagDescriptor.cpp +++ b/camera/common/default/VendorTagDescriptor.cpp @@ -16,9 +16,9 @@ #define LOG_TAG "CamComm1.0-VTDesc" +#include #include #include -#include #include #include #include @@ -36,15 +36,12 @@ namespace params { VendorTagDescriptor::~VendorTagDescriptor() { size_t len = mReverseMapping.size(); - for (size_t i = 0; i < len; ++i) { + for (size_t i = 0; i < len; ++i) { delete mReverseMapping[i]; } } -VendorTagDescriptor::VendorTagDescriptor() : - mTagCount(0), - mVendorOps() { -} +VendorTagDescriptor::VendorTagDescriptor() : mTagCount(0), mVendorOps() {} VendorTagDescriptor::VendorTagDescriptor(const VendorTagDescriptor& src) { copyFrom(src); @@ -127,7 +124,8 @@ const SortedVector* VendorTagDescriptor::getAllSectionNames() const { return &mSections; } -status_t VendorTagDescriptor::lookupTag(const String8& name, const String8& section, /*out*/uint32_t* tag) const { +status_t VendorTagDescriptor::lookupTag(const String8& name, const String8& section, + /*out*/ uint32_t* tag) const { ssize_t index = mReverseMapping.indexOfKey(section); if (index < 0) { ALOGE("%s: Section '%s' does not exist.", __FUNCTION__, section.string()); @@ -147,18 +145,16 @@ status_t VendorTagDescriptor::lookupTag(const String8& name, const String8& sect } void VendorTagDescriptor::dump(int fd, int verbosity, int indentation) const { - size_t size = mTagToNameMap.size(); if (size == 0) { - dprintf(fd, "%*sDumping configured vendor tag descriptors: None set\n", - indentation, ""); + dprintf(fd, "%*sDumping configured vendor tag descriptors: None set\n", indentation, ""); return; } - dprintf(fd, "%*sDumping configured vendor tag descriptors: %zu entries\n", - indentation, "", size); + dprintf(fd, "%*sDumping configured vendor tag descriptors: %zu entries\n", indentation, "", + size); for (size_t i = 0; i < size; ++i) { - uint32_t tag = mTagToNameMap.keyAt(i); + uint32_t tag = mTagToNameMap.keyAt(i); if (verbosity < 1) { dprintf(fd, "%*s0x%x\n", indentation + 2, "", tag); @@ -168,12 +164,11 @@ void VendorTagDescriptor::dump(int fd, int verbosity, int indentation) const { uint32_t sectionId = mTagToSectionMap.valueFor(tag); String8 sectionName = mSections[sectionId]; int type = mTagToTypeMap.at(tag); - const char* typeName = (type >= 0 && type < NUM_TYPES) ? - camera_metadata_type_names[type] : "UNKNOWN"; - dprintf(fd, "%*s0x%x (%s) with type %d (%s) defined in section %s\n", indentation + 2, - "", tag, name.string(), type, typeName, sectionName.string()); + const char* typeName = + (type >= 0 && type < NUM_TYPES) ? camera_metadata_type_names[type] : "UNKNOWN"; + dprintf(fd, "%*s0x%x (%s) with type %d (%s) defined in section %s\n", indentation + 2, "", + tag, name.string(), type, typeName, sectionName.string()); } - } int VendorTagDescriptorCache::getTagCount(metadata_vendor_id_t id) const { @@ -240,7 +235,7 @@ void VendorTagDescriptorCache::dump(int fd, int verbosity, int indentation) cons } int32_t VendorTagDescriptorCache::addVendorDescriptor( - metadata_vendor_id_t id, sp desc) { + metadata_vendor_id_t id, sp desc) { auto entry = mVendorMap.find(id); if (entry != mVendorMap.end()) { ALOGE("%s: Vendor descriptor with same id already present!", __func__); @@ -252,8 +247,8 @@ int32_t VendorTagDescriptorCache::addVendorDescriptor( } int32_t VendorTagDescriptorCache::getVendorTagDescriptor( - metadata_vendor_id_t id, - sp* desc /*out*/) { + metadata_vendor_id_t id, + sp* desc /*out*/) { auto entry = mVendorMap.find(id); if (entry == mVendorMap.end()) { return NAME_NOT_FOUND; @@ -263,12 +258,11 @@ int32_t VendorTagDescriptorCache::getVendorTagDescriptor( return NO_ERROR; } -} // namespace params -} // namespace camera2 +} // namespace params +} // namespace camera2 namespace camera { namespace common { -namespace V1_0 { namespace helper { extern "C" { @@ -292,8 +286,8 @@ static sp sGlobalVendorTagDescriptor; static sp sGlobalVendorTagDescriptorCache; status_t VendorTagDescriptor::createDescriptorFromOps(const vendor_tag_ops_t* vOps, - /*out*/ - sp& descriptor) { + /*out*/ + sp& descriptor) { if (vOps == NULL) { ALOGE("%s: vendor_tag_ops argument was NULL.", __FUNCTION__); return BAD_VALUE; @@ -307,9 +301,9 @@ status_t VendorTagDescriptor::createDescriptorFromOps(const vendor_tag_ops_t* vO Vector tagArray; LOG_ALWAYS_FATAL_IF(tagArray.resize(tagCount) != tagCount, - "%s: too many (%u) vendor tags defined.", __FUNCTION__, tagCount); + "%s: too many (%u) vendor tags defined.", __FUNCTION__, tagCount); - vOps->get_all_tags(vOps, /*out*/tagArray.editArray()); + vOps->get_all_tags(vOps, /*out*/ tagArray.editArray()); sp desc = new VendorTagDescriptor(); desc->mTagCount = tagCount; @@ -323,13 +317,13 @@ status_t VendorTagDescriptor::createDescriptorFromOps(const vendor_tag_ops_t* vO ALOGE("%s: vendor tag %d not in vendor tag section.", __FUNCTION__, tag); return BAD_VALUE; } - const char *tagName = vOps->get_tag_name(vOps, tag); + const char* tagName = vOps->get_tag_name(vOps, tag); if (tagName == NULL) { ALOGE("%s: no tag name defined for vendor tag %d.", __FUNCTION__, tag); return BAD_VALUE; } desc->mTagToNameMap.add(tag, String8(tagName)); - const char *sectionName = vOps->get_section_name(vOps, tag); + const char* sectionName = vOps->get_section_name(vOps, tag); if (sectionName == NULL) { ALOGE("%s: no section name defined for vendor tag %d.", __FUNCTION__, tag); return BAD_VALUE; @@ -386,9 +380,9 @@ status_t VendorTagDescriptor::setAsGlobalVendorTagDescriptor(const spget_tag_name = vendor_tag_descriptor_get_tag_name; opsPtr->get_tag_type = vendor_tag_descriptor_get_tag_type; } - if((res = set_camera_metadata_vendor_ops(opsPtr)) != OK) { - ALOGE("%s: Could not set vendor tag descriptor, received error %s (%d)." - , __FUNCTION__, strerror(-res), res); + if ((res = set_camera_metadata_vendor_ops(opsPtr)) != OK) { + ALOGE("%s: Could not set vendor tag descriptor, received error %s (%d).", __FUNCTION__, + strerror(-res), res); } return res; } @@ -405,7 +399,7 @@ sp VendorTagDescriptor::getGlobalVendorTagDescriptor() { } status_t VendorTagDescriptorCache::setAsGlobalVendorTagCache( - const sp& cache) { + const sp& cache) { status_t res = OK; Mutex::Autolock al(sLock); sGlobalVendorTagDescriptorCache = cache; @@ -530,9 +524,8 @@ int vendor_tag_descriptor_cache_get_tag_type(uint32_t tag, metadata_vendor_id_t } /* extern "C" */ -} // namespace helper -} // namespace V1_0 -} // namespace common -} // namespace camera -} // namespace hardware -} // namespace android +} // namespace helper +} // namespace common +} // namespace camera +} // namespace hardware +} // namespace android diff --git a/camera/common/1.0/default/include/CameraMetadata.h b/camera/common/default/include/CameraMetadata.h similarity index 76% rename from camera/common/1.0/default/include/CameraMetadata.h rename to camera/common/default/include/CameraMetadata.h index d5e4d5691d..b67914ea45 100644 --- a/camera/common/1.0/default/include/CameraMetadata.h +++ b/camera/common/default/include/CameraMetadata.h @@ -26,7 +26,6 @@ namespace android { namespace hardware { namespace camera { namespace common { -namespace V1_0 { namespace helper { class VendorTagDescriptor; @@ -46,15 +45,15 @@ class CameraMetadata { ~CameraMetadata(); /** Takes ownership of passed-in buffer */ - CameraMetadata(camera_metadata_t *buffer); + CameraMetadata(camera_metadata_t* buffer); /** Clones the metadata */ - CameraMetadata(const CameraMetadata &other); + CameraMetadata(const CameraMetadata& other); /** * Assignment clones metadata buffer. */ - CameraMetadata &operator=(const CameraMetadata &other); - CameraMetadata &operator=(const camera_metadata_t *buffer); + CameraMetadata& operator=(const CameraMetadata& other); + CameraMetadata& operator=(const camera_metadata_t* buffer); /** * Get reference to the underlying metadata buffer. Ownership remains with @@ -71,7 +70,7 @@ class CameraMetadata { * from getAndLock must be provided to guarantee that the right object is * being unlocked. */ - status_t unlock(const camera_metadata_t *buffer) const; + status_t unlock(const camera_metadata_t* buffer) const; /** * Release a raw metadata buffer to the caller. After this call, @@ -98,12 +97,12 @@ class CameraMetadata { * Acquires raw buffer from other CameraMetadata object. After the call, the argument * object no longer has any metadata. */ - void acquire(CameraMetadata &other); + void acquire(CameraMetadata& other); /** * Append metadata from another CameraMetadata object. */ - status_t append(const CameraMetadata &other); + status_t append(const CameraMetadata& other); /** * Append metadata from a raw camera_metadata buffer @@ -130,24 +129,16 @@ class CameraMetadata { * will reallocate the buffer if insufficient space exists. Overloaded for * the various types of valid data. */ - status_t update(uint32_t tag, - const uint8_t *data, size_t data_count); - status_t update(uint32_t tag, - const int32_t *data, size_t data_count); - status_t update(uint32_t tag, - const float *data, size_t data_count); - status_t update(uint32_t tag, - const int64_t *data, size_t data_count); - status_t update(uint32_t tag, - const double *data, size_t data_count); - status_t update(uint32_t tag, - const camera_metadata_rational_t *data, size_t data_count); - status_t update(uint32_t tag, - const String8 &string); - status_t update(const camera_metadata_ro_entry &entry); + status_t update(uint32_t tag, const uint8_t* data, size_t data_count); + status_t update(uint32_t tag, const int32_t* data, size_t data_count); + status_t update(uint32_t tag, const float* data, size_t data_count); + status_t update(uint32_t tag, const int64_t* data, size_t data_count); + status_t update(uint32_t tag, const double* data, size_t data_count); + status_t update(uint32_t tag, const camera_metadata_rational_t* data, size_t data_count); + status_t update(uint32_t tag, const String8& string); + status_t update(const camera_metadata_ro_entry& entry); - - template + template status_t update(uint32_t tag, Vector data) { return update(tag, data.array(), data.size()); } @@ -177,7 +168,7 @@ class CameraMetadata { * Swap the underlying camera metadata between this and the other * metadata object. */ - void swap(CameraMetadata &other); + void swap(CameraMetadata& other); /** * Dump contents into FD for debugging. The verbosity levels are @@ -196,12 +187,12 @@ class CameraMetadata { * * This is a slow method. */ - static status_t getTagFromName(const char *name, - const VendorTagDescriptor* vTags, uint32_t *tag); + static status_t getTagFromName(const char* name, const VendorTagDescriptor* vTags, + uint32_t* tag); private: - camera_metadata_t *mBuffer; - mutable bool mLocked; + camera_metadata_t* mBuffer; + mutable bool mLocked; /** * Check if tag has a given type @@ -211,20 +202,25 @@ class CameraMetadata { /** * Base update entry method */ - status_t updateImpl(uint32_t tag, const void *data, size_t data_count); + status_t updateImpl(uint32_t tag, const void* data, size_t data_count); /** * Resize metadata buffer if needed by reallocating it and copying it over. */ status_t resizeIfNeeded(size_t extraEntries, size_t extraData); - }; -} // namespace helper -} // namespace V1_0 -} // namespace common -} // namespace camera -} // namespace hardware -} // namespace android +} // namespace helper + +// NOTE: Deprecated namespace. This namespace should no longer be used. +namespace V1_0::helper { +// Export symbols to the old namespace to preserve compatibility +typedef android::hardware::camera::common::helper::CameraMetadata CameraMetadata; +} // namespace V1_0::helper + +} // namespace common +} // namespace camera +} // namespace hardware +} // namespace android #endif diff --git a/camera/common/1.0/default/include/CameraModule.h b/camera/common/default/include/CameraModule.h similarity index 72% rename from camera/common/1.0/default/include/CameraModule.h rename to camera/common/default/include/CameraModule.h index c89e934655..5c1f8ec848 100644 --- a/camera/common/1.0/default/include/CameraModule.h +++ b/camera/common/default/include/CameraModule.h @@ -21,8 +21,8 @@ #include #include -#include #include +#include #include #include "CameraMetadata.h" @@ -31,7 +31,6 @@ namespace android { namespace hardware { namespace camera { namespace common { -namespace V1_0 { namespace helper { /** * A wrapper class for HAL camera module. @@ -41,21 +40,21 @@ namespace helper { * camera characteristics keys defined in newer HAL version on an older HAL. */ class CameraModule : public RefBase { -public: - explicit CameraModule(camera_module_t *module); + public: + explicit CameraModule(camera_module_t* module); virtual ~CameraModule(); // Must be called after construction // Returns OK on success, NO_INIT on failure int init(); - int getCameraInfo(int cameraId, struct camera_info *info); + int getCameraInfo(int cameraId, struct camera_info* info); int getDeviceVersion(int cameraId); int getNumberOfCameras(void); int open(const char* id, struct hw_device_t** device); bool isOpenLegacyDefined() const; int openLegacy(const char* id, uint32_t halVersion, struct hw_device_t** device); - int setCallbacks(const camera_module_callbacks_t *callbacks); + int setCallbacks(const camera_module_callbacks_t* callbacks); bool isVendorTagDefined() const; void getVendorTagOps(vendor_tag_ops_t* ops); bool isSetTorchModeSupported() const; @@ -65,25 +64,24 @@ public: uint16_t getHalApiVersion() const; const char* getModuleAuthor() const; // Only used by CameraModuleFixture native test. Do NOT use elsewhere. - void *getDso(); + void* getDso(); // Only used by CameraProvider void removeCamera(int cameraId); - int getPhysicalCameraInfo(int physicalCameraId, camera_metadata_t **physicalInfo); - int isStreamCombinationSupported(int cameraId, camera_stream_combination_t *streams); + int getPhysicalCameraInfo(int physicalCameraId, camera_metadata_t** physicalInfo); + int isStreamCombinationSupported(int cameraId, camera_stream_combination_t* streams); void notifyDeviceStateChange(uint64_t deviceState); - static bool isLogicalMultiCamera( - const common::V1_0::helper::CameraMetadata& metadata, - std::unordered_set* physicalCameraIds); + static bool isLogicalMultiCamera(const common::helper::CameraMetadata& metadata, + std::unordered_set* physicalCameraIds); -private: + private: // Derive camera characteristics keys defined after HAL device version - static void deriveCameraCharacteristicsKeys(uint32_t deviceVersion, CameraMetadata &chars); + static void deriveCameraCharacteristicsKeys(uint32_t deviceVersion, CameraMetadata& chars); // Helper function to append available[request|result|chars]Keys - static void appendAvailableKeys(CameraMetadata &chars, - int32_t keyTag, const Vector& appendKeys); + static void appendAvailableKeys(CameraMetadata& chars, int32_t keyTag, + const Vector& appendKeys); status_t filterOpenErrorCode(status_t err); - camera_module_t *mModule; + camera_module_t* mModule; int mNumberOfCameras; KeyedVector mCameraInfoMap; KeyedVector mDeviceVersionMap; @@ -91,11 +89,17 @@ private: Mutex mCameraInfoLock; }; -} // namespace helper -} // namespace V1_0 -} // namespace common -} // namespace camera -} // namespace hardware -} // namespace android +} // namespace helper + +// NOTE: Deprecated namespace. This namespace should no longer be used for the following symbols +namespace V1_0::helper { +// Export symbols to the old namespace to preserve compatibility +typedef android::hardware::camera::common::helper::CameraModule CameraModule; +} // namespace V1_0::helper + +} // namespace common +} // namespace camera +} // namespace hardware +} // namespace android #endif diff --git a/camera/common/1.0/default/include/CameraParameters.h b/camera/common/default/include/CameraParameters.h similarity index 94% rename from camera/common/1.0/default/include/CameraParameters.h rename to camera/common/default/include/CameraParameters.h index e4ff6f21c3..d2b5075f43 100644 --- a/camera/common/1.0/default/include/CameraParameters.h +++ b/camera/common/default/include/CameraParameters.h @@ -24,7 +24,6 @@ namespace android { namespace hardware { namespace camera { namespace common { -namespace V1_0 { namespace helper { struct Size { @@ -42,28 +41,27 @@ struct Size { } }; -class CameraParameters -{ -public: +class CameraParameters { + public: CameraParameters(); - CameraParameters(const String8 ¶ms) { unflatten(params); } + CameraParameters(const String8& params) { unflatten(params); } ~CameraParameters(); String8 flatten() const; - void unflatten(const String8 ¶ms); + void unflatten(const String8& params); - void set(const char *key, const char *value); - void set(const char *key, int value); - void setFloat(const char *key, float value); - const char *get(const char *key) const; - int getInt(const char *key) const; - float getFloat(const char *key) const; + void set(const char* key, const char* value); + void set(const char* key, int value); + void setFloat(const char* key, float value); + const char* get(const char* key) const; + int getInt(const char* key) const; + float getFloat(const char* key) const; - void remove(const char *key); + void remove(const char* key); void setPreviewSize(int width, int height); - void getPreviewSize(int *width, int *height) const; - void getSupportedPreviewSizes(Vector &sizes) const; + void getPreviewSize(int* width, int* height) const; + void getSupportedPreviewSizes(Vector& sizes) const; // Set the dimensions in pixels to the given width and height // for video frames. The given width and height must be one @@ -76,14 +74,14 @@ public: // supported dimensions returned from getSupportedVideoSizes(). // Must not be called if getSupportedVideoSizes() returns an // empty Vector of Size. - void getVideoSize(int *width, int *height) const; + void getVideoSize(int* width, int* height) const; // Retrieve a Vector of supported dimensions (width and height) // in pixels for video frames. If sizes returned from the method // is empty, the camera does not support calls to setVideoSize() // or getVideoSize(). In adddition, it also indicates that // the camera only has a single output, and does not have // separate output for video frames and preview frame. - void getSupportedVideoSizes(Vector &sizes) const; + void getSupportedVideoSizes(Vector& sizes) const; // Retrieve the preferred preview size (width and height) in pixels // for video recording. The given width and height must be one of // supported preview sizes returned from getSupportedPreviewSizes(). @@ -91,18 +89,18 @@ public: // Vector of Size. If getSupportedVideoSizes() returns an empty // Vector of Size, the width and height returned from this method // is invalid, and is "-1x-1". - void getPreferredPreviewSizeForVideo(int *width, int *height) const; + void getPreferredPreviewSizeForVideo(int* width, int* height) const; void setPreviewFrameRate(int fps); int getPreviewFrameRate() const; - void getPreviewFpsRange(int *min_fps, int *max_fps) const; - void setPreviewFormat(const char *format); - const char *getPreviewFormat() const; + void getPreviewFpsRange(int* min_fps, int* max_fps) const; + void setPreviewFormat(const char* format); + const char* getPreviewFormat() const; void setPictureSize(int width, int height); - void getPictureSize(int *width, int *height) const; - void getSupportedPictureSizes(Vector &sizes) const; - void setPictureFormat(const char *format); - const char *getPictureFormat() const; + void getPictureSize(int* width, int* height) const; + void getSupportedPictureSizes(Vector& sizes) const; + void setPictureFormat(const char* format); + const char* getPictureFormat() const; void dump() const; status_t dump(int fd, const Vector& args) const; @@ -619,9 +617,9 @@ public: // Pixel color formats for KEY_PREVIEW_FORMAT, KEY_PICTURE_FORMAT, // and KEY_VIDEO_FRAME_FORMAT static const char PIXEL_FORMAT_YUV422SP[]; - static const char PIXEL_FORMAT_YUV420SP[]; // NV21 - static const char PIXEL_FORMAT_YUV422I[]; // YUY2 - static const char PIXEL_FORMAT_YUV420P[]; // YV12 + static const char PIXEL_FORMAT_YUV420SP[]; // NV21 + static const char PIXEL_FORMAT_YUV422I[]; // YUY2 + static const char PIXEL_FORMAT_YUV420P[]; // YV12 static const char PIXEL_FORMAT_RGB565[]; static const char PIXEL_FORMAT_RGBA8888[]; static const char PIXEL_FORMAT_JPEG[]; @@ -695,15 +693,22 @@ public: */ static int previewFormatToEnum(const char* format); -private: - DefaultKeyedVector mMap; + private: + DefaultKeyedVector mMap; }; -}; -}; -}; -}; -}; -}; // namespace +}; // namespace helper + +// NOTE: Deprecated namespace. This namespace should no longer be used for the following symbols +namespace V1_0::helper { +// Export symbols to the old namespace to preserve compatibility +typedef android::hardware::camera::common::helper::CameraParameters CameraParameters; +typedef android::hardware::camera::common::helper::Size Size; +} // namespace V1_0::helper + +}; // namespace common +}; // namespace camera +}; // namespace hardware +}; // namespace android #endif diff --git a/camera/common/1.0/default/include/Exif.h b/camera/common/default/include/Exif.h similarity index 95% rename from camera/common/1.0/default/include/Exif.h rename to camera/common/default/include/Exif.h index dc31679a67..6974b8ea30 100644 --- a/camera/common/1.0/default/include/Exif.h +++ b/camera/common/default/include/Exif.h @@ -23,10 +23,8 @@ namespace android { namespace hardware { namespace camera { namespace common { -namespace V1_0 { namespace helper { - // This is based on the original ChromeOS ARC implementation of a V4L2 HAL // ExifUtils can generate APP1 segment with tags which caller set. ExifUtils can @@ -44,8 +42,7 @@ namespace helper { // uint8_t* app1Buffer = new uint8_t[app1Length]; // memcpy(app1Buffer, utils->GetApp1Buffer(), app1Length); class ExifUtils { - - public: + public: virtual ~ExifUtils(); static ExifUtils* create(); @@ -55,8 +52,7 @@ class ExifUtils { virtual bool initialize() = 0; // Set all known fields from a metadata structure - virtual bool setFromMetadata(const CameraMetadata& metadata, - const size_t imageWidth, + virtual bool setFromMetadata(const CameraMetadata& metadata, const size_t imageWidth, const size_t imageHeight) = 0; // Sets the len aperture. @@ -244,13 +240,17 @@ class ExifUtils { virtual unsigned int getApp1Length() = 0; }; +} // namespace helper -} // namespace helper -} // namespace V1_0 -} // namespace common -} // namespace camera -} // namespace hardware -} // namespace android +// NOTE: Deprecated namespace. This namespace should no longer be used for the following symbols +namespace V1_0::helper { +// Export symbols to the old namespace to preserve compatibility +typedef android::hardware::camera::common::helper::ExifUtils ExifUtils; +} // namespace V1_0::helper +} // namespace common +} // namespace camera +} // namespace hardware +} // namespace android #endif // ANDROID_HARDWARE_INTERFACES_CAMERA_COMMON_1_0_EXIF_H diff --git a/camera/common/1.0/default/include/HandleImporter.h b/camera/common/default/include/HandleImporter.h similarity index 80% rename from camera/common/1.0/default/include/HandleImporter.h rename to camera/common/default/include/HandleImporter.h index 83fa755c99..5408ba92e6 100644 --- a/camera/common/1.0/default/include/HandleImporter.h +++ b/camera/common/default/include/HandleImporter.h @@ -30,12 +30,11 @@ namespace android { namespace hardware { namespace camera { namespace common { -namespace V1_0 { namespace helper { // Borrowed from graphics HAL. Use this until gralloc mapper HAL is working class HandleImporter { -public: + public: HandleImporter(); // In IComposer, any buffer_handle_t is owned by the caller and we need to @@ -59,23 +58,23 @@ public: // Query the stride of the first plane in bytes. status_t getMonoPlanarStrideBytes(buffer_handle_t& buf, uint32_t* stride /*out*/); - int unlock(buffer_handle_t& buf); // returns release fence + int unlock(buffer_handle_t& buf); // returns release fence // Query Gralloc4 metadata bool isSmpte2086Present(const buffer_handle_t& buf); bool isSmpte2094_10Present(const buffer_handle_t& buf); bool isSmpte2094_40Present(const buffer_handle_t& buf); -private: + private: void initializeLocked(); void cleanup(); - template + template bool importBufferInternal(const sp mapper, buffer_handle_t& handle); - template + template YCbCrLayout lockYCbCrInternal(const sp mapper, buffer_handle_t& buf, uint64_t cpuUsage, - const IMapper::Rect& accessRegion); - template + const IMapper::Rect& accessRegion); + template int unlockInternal(const sp mapper, buffer_handle_t& buf); Mutex mLock; @@ -85,11 +84,17 @@ private: sp mMapperV4; }; -} // namespace helper -} // namespace V1_0 -} // namespace common -} // namespace camera -} // namespace hardware -} // namespace android +} // namespace helper -#endif // CAMERA_COMMON_1_0_HANDLEIMPORTED_H +// NOTE: Deprecated namespace. This namespace should no longer be used for the following symbols +namespace V1_0::helper { +// Export symbols to the old namespace to preserve compatibility +typedef android::hardware::camera::common::helper::HandleImporter HandleImporter; +} // namespace V1_0::helper + +} // namespace common +} // namespace camera +} // namespace hardware +} // namespace android + +#endif // CAMERA_COMMON_1_0_HANDLEIMPORTED_H diff --git a/camera/common/1.0/default/include/SimpleThread.h b/camera/common/default/include/SimpleThread.h similarity index 100% rename from camera/common/1.0/default/include/SimpleThread.h rename to camera/common/default/include/SimpleThread.h diff --git a/camera/common/1.0/default/include/VendorTagDescriptor.h b/camera/common/default/include/VendorTagDescriptor.h similarity index 60% rename from camera/common/1.0/default/include/VendorTagDescriptor.h rename to camera/common/default/include/VendorTagDescriptor.h index 0f54db52d1..3133c26e00 100644 --- a/camera/common/1.0/default/include/VendorTagDescriptor.h +++ b/camera/common/default/include/VendorTagDescriptor.h @@ -17,11 +17,11 @@ #ifndef CAMERA_COMMON_1_0_VENDORTAGDESCRIPTOR_H #define CAMERA_COMMON_1_0_VENDORTAGDESCRIPTOR_H -#include -#include -#include -#include #include +#include +#include +#include +#include #include #include @@ -37,78 +37,77 @@ namespace params { * information enumerated by the HAL to clients of the camera service. */ class VendorTagDescriptor { - public: - virtual ~VendorTagDescriptor(); + public: + virtual ~VendorTagDescriptor(); - VendorTagDescriptor(); - VendorTagDescriptor(const VendorTagDescriptor& src); - VendorTagDescriptor& operator=(const VendorTagDescriptor& rhs); + VendorTagDescriptor(); + VendorTagDescriptor(const VendorTagDescriptor& src); + VendorTagDescriptor& operator=(const VendorTagDescriptor& rhs); - void copyFrom(const VendorTagDescriptor& src); + void copyFrom(const VendorTagDescriptor& src); - /** - * The following 'get*' methods implement the corresponding - * functions defined in - * system/media/camera/include/system/camera_vendor_tags.h - */ + /** + * The following 'get*' methods implement the corresponding + * functions defined in + * system/media/camera/include/system/camera_vendor_tags.h + */ - // Returns the number of vendor tags defined. - int getTagCount() const; + // Returns the number of vendor tags defined. + int getTagCount() const; - // Returns an array containing the id's of vendor tags defined. - void getTagArray(uint32_t* tagArray) const; + // Returns an array containing the id's of vendor tags defined. + void getTagArray(uint32_t* tagArray) const; - // Returns the section name string for a given vendor tag id. - const char* getSectionName(uint32_t tag) const; + // Returns the section name string for a given vendor tag id. + const char* getSectionName(uint32_t tag) const; - // Returns the index in section vectors returned in getAllSectionNames() - // for a given vendor tag id. -1 if input tag does not exist. - ssize_t getSectionIndex(uint32_t tag) const; + // Returns the index in section vectors returned in getAllSectionNames() + // for a given vendor tag id. -1 if input tag does not exist. + ssize_t getSectionIndex(uint32_t tag) const; - // Returns the tag name string for a given vendor tag id. - const char* getTagName(uint32_t tag) const; + // Returns the tag name string for a given vendor tag id. + const char* getTagName(uint32_t tag) const; - // Returns the tag type for a given vendor tag id. - int getTagType(uint32_t tag) const; + // Returns the tag type for a given vendor tag id. + int getTagType(uint32_t tag) const; - /** - * Convenience method to get a vector containing all vendor tag - * sections, or an empty vector if none are defined. - * The pointer is valid for the lifetime of the VendorTagDescriptor, - * or until copyFrom is invoked. - */ - const SortedVector* getAllSectionNames() const; + /** + * Convenience method to get a vector containing all vendor tag + * sections, or an empty vector if none are defined. + * The pointer is valid for the lifetime of the VendorTagDescriptor, + * or until copyFrom is invoked. + */ + const SortedVector* getAllSectionNames() const; - /** - * Lookup the tag id for a given tag name and section. - * - * Returns OK on success, or a negative error code. - */ - status_t lookupTag(const String8& name, const String8& section, /*out*/uint32_t* tag) const; + /** + * Lookup the tag id for a given tag name and section. + * + * Returns OK on success, or a negative error code. + */ + status_t lookupTag(const String8& name, const String8& section, /*out*/ uint32_t* tag) const; - /** - * Dump the currently configured vendor tags to a file descriptor. - */ - void dump(int fd, int verbosity, int indentation) const; + /** + * Dump the currently configured vendor tags to a file descriptor. + */ + void dump(int fd, int verbosity, int indentation) const; - protected: - KeyedVector*> mReverseMapping; - KeyedVector mTagToNameMap; - KeyedVector mTagToSectionMap; // Value is offset in mSections + protected: + KeyedVector*> mReverseMapping; + KeyedVector mTagToNameMap; + KeyedVector mTagToSectionMap; // Value is offset in mSections - std::unordered_map mTagToTypeMap; - SortedVector mSections; - // must be int32_t to be compatible with Parcel::writeInt32 - int32_t mTagCount; + std::unordered_map mTagToTypeMap; + SortedVector mSections; + // must be int32_t to be compatible with Parcel::writeInt32 + int32_t mTagCount; - vendor_tag_ops mVendorOps; + vendor_tag_ops mVendorOps; }; } /* namespace params */ } /* namespace camera2 */ namespace camera { namespace common { -namespace V1_0 { namespace helper { /** @@ -119,12 +118,9 @@ namespace helper { * Parcelable objects cannot require being kept in an sp<> and still work with auto-generated AIDL * interface implementations. */ -class VendorTagDescriptor : - public ::android::hardware::camera2::params::VendorTagDescriptor, - public LightRefBase { - +class VendorTagDescriptor : public ::android::hardware::camera2::params::VendorTagDescriptor, + public LightRefBase { public: - /** * Create a VendorTagDescriptor object from the given vendor_tag_ops_t * struct. @@ -132,8 +128,8 @@ class VendorTagDescriptor : * Returns OK on success, or a negative error code. */ static status_t createDescriptorFromOps(const vendor_tag_ops_t* vOps, - /*out*/ - sp& descriptor); + /*out*/ + sp& descriptor); /** * Sets the global vendor tag descriptor to use for this process. @@ -154,11 +150,9 @@ class VendorTagDescriptor : * Clears the global vendor tag descriptor used by this process. */ static void clearGlobalVendorTagDescriptor(); - }; } /* namespace helper */ -} /* namespace V1_0 */ } /* namespace common */ } /* namespace camera */ @@ -166,9 +160,8 @@ namespace camera2 { namespace params { class VendorTagDescriptorCache { - public: - typedef android::hardware::camera::common::V1_0::helper::VendorTagDescriptor - VendorTagDescriptor; + public: + typedef android::hardware::camera::common::helper::VendorTagDescriptor VendorTagDescriptor; VendorTagDescriptorCache(){}; int32_t addVendorDescriptor(metadata_vendor_id_t id, sp desc); @@ -194,7 +187,7 @@ class VendorTagDescriptorCache { */ void dump(int fd, int verbosity, int indentation) const; - protected: + protected: std::unordered_map> mVendorMap; struct vendor_tag_cache_ops mVendorCacheOps; }; @@ -204,13 +197,12 @@ class VendorTagDescriptorCache { namespace camera { namespace common { -namespace V1_0 { namespace helper { class VendorTagDescriptorCache : public ::android::hardware::camera2::params::VendorTagDescriptorCache, public LightRefBase { - public: + public: /** * Sets the global vendor tag descriptor cache to use for this process. * Camera metadata operations that access vendor tags will use the @@ -232,11 +224,19 @@ class VendorTagDescriptorCache static void clearGlobalVendorTagCache(); }; -} // namespace helper -} // namespace V1_0 -} // namespace common -} // namespace camera -} // namespace hardware -} // namespace android +} // namespace helper + +// NOTE: Deprecated namespace. This namespace should no longer be used for the following symbols +namespace V1_0::helper { +// Export symbols to the old namespace to preserve compatibility +typedef android::hardware::camera::common::helper::VendorTagDescriptor VendorTagDescriptor; +typedef android::hardware::camera::common::helper::VendorTagDescriptorCache + VendorTagDescriptorCache; +} // namespace V1_0::helper + +} // namespace common +} // namespace camera +} // namespace hardware +} // namespace android #endif /* CAMERA_COMMON_1_0_VENDORTAGDESCRIPTOR_H */ From 43e52ca7a7850a280445b1fae3dd67f36267df14 Mon Sep 17 00:00:00 2001 From: arunvoddu Date: Wed, 16 Nov 2022 03:52:44 +0000 Subject: [PATCH 427/998] HAL changes to Carrier Restriction status feature Bug: 189884347 Test: Build successfully Change-Id: I9d98e721c1e339a236de9e22f8faca3ac5233938 --- .../radio/sim/CarrierRestrictions.aidl | 14 ++++++++--- .../radio/sim/CarrierRestrictions.aidl | 23 +++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl index 944f1ca981..8a61dca20a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl @@ -34,7 +34,15 @@ package android.hardware.radio.sim; @JavaDerive(toString=true) @VintfStability parcelable CarrierRestrictions { - android.hardware.radio.sim.Carrier[] allowedCarriers; - android.hardware.radio.sim.Carrier[] excludedCarriers; - boolean allowedCarriersPrioritized; + @Backing(type="int") @VintfStability + enum CarrierRestrictionStatus { + UNKNOWN = 0, + NOT_RESTRICTED = 1, + RESTRICTED = 2, + } + android.hardware.radio.sim.Carrier[] allowedCarriers; + android.hardware.radio.sim.Carrier[] excludedCarriers; + boolean allowedCarriersPrioritized; + CarrierRestrictionStatus status; + int carrierId; } diff --git a/radio/aidl/android/hardware/radio/sim/CarrierRestrictions.aidl b/radio/aidl/android/hardware/radio/sim/CarrierRestrictions.aidl index 3dce9076ea..5a79f0fa63 100644 --- a/radio/aidl/android/hardware/radio/sim/CarrierRestrictions.aidl +++ b/radio/aidl/android/hardware/radio/sim/CarrierRestrictions.aidl @@ -21,6 +21,22 @@ import android.hardware.radio.sim.Carrier; @VintfStability @JavaDerive(toString=true) parcelable CarrierRestrictions { + @VintfStability + @Backing(type="int") + /** This enum defines the carrier restriction status values */ + enum CarrierRestrictionStatus { + /** + * Carrier restriction status value is unknown, used in cases where modem is dependent on + * external module to know about the lock status and the module hasn’t yet provided the lock + * status. For example, when the lock status is maintained on a cloud server and device has + * just booted after out of box and not yet connected to the internet. + */ + UNKNOWN = 0, + /** There is no carrier restriction on the device */ + NOT_RESTRICTED = 1, + /** The device is restricted to a carrier */ + RESTRICTED = 2, + } /** * Allowed carriers */ @@ -40,4 +56,11 @@ parcelable CarrierRestrictions { * and not in the allowed list. */ boolean allowedCarriersPrioritized; + /** Current restriction status as defined in CarrierRestrictionStatus enum */ + CarrierRestrictionStatus status; + /** + * Android carrier ID of the locked carrier. + * see https://source.android.com/docs/core/connect/carrierid + */ + int carrierId; } From 1b72d1b2c7bbea9a32d60d892ea172c2ec91e706 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Wed, 30 Nov 2022 01:03:58 +0000 Subject: [PATCH 428/998] Update HAL code comments for EV_BATTERY_LEVEL Bug: 260464610 Test: N/A Change-Id: I6577d7bf055cdee7648309b3cb9beb76104dfc81 --- .../hardware/automotive/vehicle/VehicleProperty.aidl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 8d21485691..c80ac1d060 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -327,9 +327,11 @@ enum VehicleProperty { FUEL_DOOR_OPEN = 0x0308 + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN /** - * EV battery level in WH, if EV or hybrid + * Battery level for EV or hybrid vehicle * - * Value may not exceed INFO_EV_BATTERY_CAPACITY + * Returns the current battery level, if EV or hybrid. This value will not exceed + * EV_CURRENT_BATTERY_CAPACITY. To calculate the battery percentage, use: + * (EV_BATTERY_LEVEL/EV_CURRENT_BATTERY_CAPACITY)*100. * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ From 8cfe13bf1f07a7f2240166ee5cbdb4064dbb2d42 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Wed, 30 Nov 2022 00:16:16 +0000 Subject: [PATCH 429/998] Update HAL code comments for INFO_EV_BATTERY_CAPACITY Bug: 260464528 Test: N/A Change-Id: I7f32bcb10e24271ca9452fdb63841d6a5e4eb2f1 --- .../hardware/automotive/vehicle/VehicleProperty.aidl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 8d21485691..6d0fd69064 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -97,8 +97,12 @@ enum VehicleProperty { INFO_FUEL_TYPE = 0x0105 + 0x10000000 + 0x01000000 + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC /** - * Battery capacity of the vehicle, if EV or hybrid. This is the nominal - * battery capacity when the vehicle is new. + * Nominal battery capacity for EV or hybrid vehicle + * + * Returns the nominal battery capacity, if EV or hybrid. This is the battery capacity when the + * vehicle is new. This value might be different from EV_CURRENT_BATTERY_CAPACITY because + * EV_CURRENT_BATTERY_CAPACITY returns the real-time battery capacity taking into account + * factors such as battery aging and temperature dependency. * * @change_mode VehiclePropertyChangeMode.STATIC * @access VehiclePropertyAccess.READ From 0891de19e6947fe1a90f5e7ea7eb21bc88365a17 Mon Sep 17 00:00:00 2001 From: ziyiw Date: Mon, 28 Nov 2022 22:26:11 +0000 Subject: [PATCH 430/998] Add supported maximum number of ranging session as capability. Test: compile Bug: 259493075 Change-Id: Ibe7edb84c968b70be62059bb0bb6ffeedfa4bad6 --- .../uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl | 2 ++ .../uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl index 6ec8d57703..b9ac7b9861 100644 --- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl @@ -43,10 +43,12 @@ enum UwbVendorCapabilityTlvTypes { CCC_SUPPORTED_UWB_CONFIGS = 165, CCC_SUPPORTED_PULSE_SHAPE_COMBOS = 166, CCC_SUPPORTED_RAN_MULTIPLIER = 167, + CCC_SUPPORTED_MAX_RANGING_SESSION_NUMBER = 168, SUPPORTED_AOA_RESULT_REQ_ANTENNA_INTERLEAVING = 227, SUPPORTED_MIN_RANGING_INTERVAL_MS = 228, SUPPORTED_RANGE_DATA_NTF_CONFIG = 229, SUPPORTED_RSSI_REPORTING = 230, SUPPORTED_DIAGNOSTICS = 231, SUPPORTED_MIN_SLOT_DURATION = 232, + SUPPORTED_MAX_RANGING_SESSION_NUMBER = 233, } diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl index b182f9d00c..a3bb7a62ec 100644 --- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl +++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl @@ -139,6 +139,11 @@ enum UwbVendorCapabilityTlvTypes { /** Int value for indicating supported ran multiplier */ CCC_SUPPORTED_RAN_MULTIPLIER = 0xA7, + /** + * Int value to indicate supported max number of ccc ranging sessions + */ + CCC_SUPPORTED_MAX_RANGING_SESSION_NUMBER = 0xA8, + /********************************************* * FIRA specific ********************************************/ @@ -184,4 +189,9 @@ enum UwbVendorCapabilityTlvTypes { * 4 byte value to indicate supported min slot duration in ms. */ SUPPORTED_MIN_SLOT_DURATION = 0xE8, + + /** + * Int value to indicate supported max number of fira ranging sessions + */ + SUPPORTED_MAX_RANGING_SESSION_NUMBER = 0xE9, } From 631a8118d724aded134a0acfdf29b163897f450c Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Thu, 1 Dec 2022 22:29:32 +0000 Subject: [PATCH 431/998] Revert "Convert vendor HAL service to use new AIDL interface." This reverts commit e58e263bce07e33bcf928388d21c9f544eb537e7. Reason for revert: Blocking Wembley team Change-Id: I3cf471e88b880a95a0a2c39f47fb0804deee65cf --- wifi/{aidl => 1.6}/default/Android.bp | 84 +- wifi/{aidl => 1.6}/default/THREADING.README | 12 +- .../android.hardware.wifi@1.0-service-lazy.rc | 14 + .../android.hardware.wifi@1.0-service.rc | 12 + .../android.hardware.wifi@1.0-service.xml | 11 + wifi/1.6/default/hidl_callback_util.h | 122 + wifi/1.6/default/hidl_return_util.h | 118 + wifi/1.6/default/hidl_struct_util.cpp | 3007 +++++++++++++++++ wifi/1.6/default/hidl_struct_util.h | 204 ++ .../default/hidl_sync_util.cpp} | 14 +- .../default/hidl_sync_util.h} | 20 +- wifi/{aidl => 1.6}/default/ringbuffer.cpp | 12 +- wifi/{aidl => 1.6}/default/ringbuffer.h | 8 +- wifi/1.6/default/service.cpp | 71 + .../tests/hidl_struct_util_unit_tests.cpp} | 245 +- wifi/{aidl => 1.6}/default/tests/main.cpp | 2 +- .../default/tests/mock_interface_tool.cpp | 3 +- .../default/tests/mock_interface_tool.h | 2 +- .../default/tests/mock_wifi_feature_flags.cpp | 8 +- .../default/tests/mock_wifi_feature_flags.h | 11 +- .../default/tests/mock_wifi_iface_util.cpp | 15 +- .../default/tests/mock_wifi_iface_util.h | 16 +- .../default/tests/mock_wifi_legacy_hal.cpp | 14 +- .../default/tests/mock_wifi_legacy_hal.h | 10 +- .../tests/mock_wifi_mode_controller.cpp | 9 +- .../default/tests/mock_wifi_mode_controller.h | 8 +- .../default/tests/ringbuffer_unit_tests.cpp | 9 +- wifi/{aidl => 1.6}/default/tests/runtests.sh | 6 +- .../default/tests/wifi_chip_unit_tests.cpp | 429 +-- .../tests/wifi_iface_util_unit_tests.cpp | 14 +- .../tests/wifi_nan_iface_unit_tests.cpp | 138 + wifi/{aidl => 1.6}/default/wifi.cpp | 166 +- wifi/1.6/default/wifi.h | 105 + wifi/{aidl => 1.6}/default/wifi_ap_iface.cpp | 118 +- wifi/1.6/default/wifi_ap_iface.h | 89 + wifi/{aidl => 1.6}/default/wifi_chip.cpp | 1038 +++--- wifi/1.6/default/wifi_chip.h | 317 ++ .../default/wifi_feature_flags.cpp | 135 +- .../default/wifi_feature_flags.h | 24 +- .../{aidl => 1.6}/default/wifi_iface_util.cpp | 20 +- wifi/{aidl => 1.6}/default/wifi_iface_util.h | 15 +- .../{aidl => 1.6}/default/wifi_legacy_hal.cpp | 154 +- wifi/{aidl => 1.6}/default/wifi_legacy_hal.h | 39 +- .../default/wifi_legacy_hal_factory.cpp | 18 +- .../default/wifi_legacy_hal_factory.h | 14 +- .../default/wifi_legacy_hal_stubs.cpp | 9 +- .../default/wifi_legacy_hal_stubs.h | 8 +- .../default/wifi_mode_controller.cpp | 19 +- .../default/wifi_mode_controller.h | 14 +- wifi/1.6/default/wifi_nan_iface.cpp | 1016 ++++++ wifi/1.6/default/wifi_nan_iface.h | 208 ++ wifi/{aidl => 1.6}/default/wifi_p2p_iface.cpp | 32 +- wifi/{aidl => 1.6}/default/wifi_p2p_iface.h | 25 +- wifi/1.6/default/wifi_rtt_controller.cpp | 377 +++ wifi/1.6/default/wifi_rtt_controller.h | 138 + wifi/1.6/default/wifi_sta_iface.cpp | 592 ++++ wifi/1.6/default/wifi_sta_iface.h | 157 + .../default/wifi_status_util.cpp | 28 +- wifi/{aidl => 1.6}/default/wifi_status_util.h | 22 +- wifi/aidl/default/aidl_callback_util.h | 140 - wifi/aidl/default/aidl_return_util.h | 85 - wifi/aidl/default/aidl_struct_util.cpp | 2775 --------------- wifi/aidl/default/aidl_struct_util.h | 180 - .../android.hardware.wifi-service-lazy.rc | 8 - .../default/android.hardware.wifi-service.rc | 6 - .../default/android.hardware.wifi-service.xml | 6 - wifi/aidl/default/service.cpp | 73 - .../tests/wifi_nan_iface_unit_tests.cpp | 168 - wifi/aidl/default/wifi.h | 96 - wifi/aidl/default/wifi_ap_iface.h | 81 - wifi/aidl/default/wifi_chip.h | 287 -- wifi/aidl/default/wifi_nan_iface.cpp | 751 ---- wifi/aidl/default/wifi_nan_iface.h | 134 - wifi/aidl/default/wifi_rtt_controller.cpp | 255 -- wifi/aidl/default/wifi_rtt_controller.h | 102 - wifi/aidl/default/wifi_sta_iface.cpp | 558 --- wifi/aidl/default/wifi_sta_iface.h | 154 - wifi/aidl/vts/functional/Android.bp | 169 - .../vts/functional/wifi_aidl_test_utils.cpp | 216 -- .../vts/functional/wifi_aidl_test_utils.h | 48 - .../functional/wifi_ap_iface_aidl_test.cpp | 154 - .../vts/functional/wifi_chip_aidl_test.cpp | 889 ----- .../functional/wifi_nan_iface_aidl_test.cpp | 627 ---- .../wifi_rtt_controller_aidl_test.cpp | 234 -- .../functional/wifi_sta_iface_aidl_test.cpp | 282 -- wifi/apex/Android.bp | 8 +- wifi/apex/file_contexts | 2 +- 87 files changed, 8271 insertions(+), 9762 deletions(-) rename wifi/{aidl => 1.6}/default/Android.bp (67%) rename wifi/{aidl => 1.6}/default/THREADING.README (82%) create mode 100644 wifi/1.6/default/android.hardware.wifi@1.0-service-lazy.rc create mode 100644 wifi/1.6/default/android.hardware.wifi@1.0-service.rc create mode 100644 wifi/1.6/default/android.hardware.wifi@1.0-service.xml create mode 100644 wifi/1.6/default/hidl_callback_util.h create mode 100644 wifi/1.6/default/hidl_return_util.h create mode 100644 wifi/1.6/default/hidl_struct_util.cpp create mode 100644 wifi/1.6/default/hidl_struct_util.h rename wifi/{aidl/default/aidl_sync_util.cpp => 1.6/default/hidl_sync_util.cpp} (78%) rename wifi/{aidl/default/aidl_sync_util.h => 1.6/default/hidl_sync_util.h} (71%) rename wifi/{aidl => 1.6}/default/ringbuffer.cpp (92%) rename wifi/{aidl => 1.6}/default/ringbuffer.h (90%) create mode 100644 wifi/1.6/default/service.cpp rename wifi/{aidl/default/tests/aidl_struct_util_unit_tests.cpp => 1.6/default/tests/hidl_struct_util_unit_tests.cpp} (69%) rename wifi/{aidl => 1.6}/default/tests/main.cpp (94%) rename wifi/{aidl => 1.6}/default/tests/mock_interface_tool.cpp (86%) rename wifi/{aidl => 1.6}/default/tests/mock_interface_tool.h (96%) rename wifi/{aidl => 1.6}/default/tests/mock_wifi_feature_flags.cpp (85%) rename wifi/{aidl => 1.6}/default/tests/mock_wifi_feature_flags.h (77%) rename wifi/{aidl => 1.6}/default/tests/mock_wifi_iface_util.cpp (68%) rename wifi/{aidl => 1.6}/default/tests/mock_wifi_iface_util.h (79%) rename wifi/{aidl => 1.6}/default/tests/mock_wifi_legacy_hal.cpp (69%) rename wifi/{aidl => 1.6}/default/tests/mock_wifi_legacy_hal.h (92%) rename wifi/{aidl => 1.6}/default/tests/mock_wifi_mode_controller.cpp (87%) rename wifi/{aidl => 1.6}/default/tests/mock_wifi_mode_controller.h (89%) rename wifi/{aidl => 1.6}/default/tests/ringbuffer_unit_tests.cpp (95%) rename wifi/{aidl => 1.6}/default/tests/runtests.sh (79%) rename wifi/{aidl => 1.6}/default/tests/wifi_chip_unit_tests.cpp (66%) rename wifi/{aidl => 1.6}/default/tests/wifi_iface_util_unit_tests.cpp (92%) create mode 100644 wifi/1.6/default/tests/wifi_nan_iface_unit_tests.cpp rename wifi/{aidl => 1.6}/default/wifi.cpp (60%) create mode 100644 wifi/1.6/default/wifi.h rename wifi/{aidl => 1.6}/default/wifi_ap_iface.cpp (59%) create mode 100644 wifi/1.6/default/wifi_ap_iface.h rename wifi/{aidl => 1.6}/default/wifi_chip.cpp (64%) create mode 100644 wifi/1.6/default/wifi_chip.h rename wifi/{aidl => 1.6}/default/wifi_feature_flags.cpp (59%) rename wifi/{aidl => 1.6}/default/wifi_feature_flags.h (67%) rename wifi/{aidl => 1.6}/default/wifi_iface_util.cpp (95%) rename wifi/{aidl => 1.6}/default/wifi_iface_util.h (89%) rename wifi/{aidl => 1.6}/default/wifi_legacy_hal.cpp (94%) rename wifi/{aidl => 1.6}/default/wifi_legacy_hal.h (97%) rename wifi/{aidl => 1.6}/default/wifi_legacy_hal_factory.cpp (97%) rename wifi/{aidl => 1.6}/default/wifi_legacy_hal_factory.h (82%) rename wifi/{aidl => 1.6}/default/wifi_legacy_hal_stubs.cpp (98%) rename wifi/{aidl => 1.6}/default/wifi_legacy_hal_stubs.h (86%) rename wifi/{aidl => 1.6}/default/wifi_mode_controller.cpp (91%) rename wifi/{aidl => 1.6}/default/wifi_mode_controller.h (84%) create mode 100644 wifi/1.6/default/wifi_nan_iface.cpp create mode 100644 wifi/1.6/default/wifi_nan_iface.h rename wifi/{aidl => 1.6}/default/wifi_p2p_iface.cpp (60%) rename wifi/{aidl => 1.6}/default/wifi_p2p_iface.h (64%) create mode 100644 wifi/1.6/default/wifi_rtt_controller.cpp create mode 100644 wifi/1.6/default/wifi_rtt_controller.h create mode 100644 wifi/1.6/default/wifi_sta_iface.cpp create mode 100644 wifi/1.6/default/wifi_sta_iface.h rename wifi/{aidl => 1.6}/default/wifi_status_util.cpp (80%) rename wifi/{aidl => 1.6}/default/wifi_status_util.h (59%) delete mode 100644 wifi/aidl/default/aidl_callback_util.h delete mode 100644 wifi/aidl/default/aidl_return_util.h delete mode 100644 wifi/aidl/default/aidl_struct_util.cpp delete mode 100644 wifi/aidl/default/aidl_struct_util.h delete mode 100644 wifi/aidl/default/android.hardware.wifi-service-lazy.rc delete mode 100644 wifi/aidl/default/android.hardware.wifi-service.rc delete mode 100644 wifi/aidl/default/android.hardware.wifi-service.xml delete mode 100644 wifi/aidl/default/service.cpp delete mode 100644 wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp delete mode 100644 wifi/aidl/default/wifi.h delete mode 100644 wifi/aidl/default/wifi_ap_iface.h delete mode 100644 wifi/aidl/default/wifi_chip.h delete mode 100644 wifi/aidl/default/wifi_nan_iface.cpp delete mode 100644 wifi/aidl/default/wifi_nan_iface.h delete mode 100644 wifi/aidl/default/wifi_rtt_controller.cpp delete mode 100644 wifi/aidl/default/wifi_rtt_controller.h delete mode 100644 wifi/aidl/default/wifi_sta_iface.cpp delete mode 100644 wifi/aidl/default/wifi_sta_iface.h delete mode 100644 wifi/aidl/vts/functional/Android.bp delete mode 100644 wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp delete mode 100644 wifi/aidl/vts/functional/wifi_aidl_test_utils.h delete mode 100644 wifi/aidl/vts/functional/wifi_ap_iface_aidl_test.cpp delete mode 100644 wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp delete mode 100644 wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp delete mode 100644 wifi/aidl/vts/functional/wifi_rtt_controller_aidl_test.cpp delete mode 100644 wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp diff --git a/wifi/aidl/default/Android.bp b/wifi/1.6/default/Android.bp similarity index 67% rename from wifi/aidl/default/Android.bp rename to wifi/1.6/default/Android.bp index 441d461b78..0f98e71445 100644 --- a/wifi/aidl/default/Android.bp +++ b/wifi/1.6/default/Android.bp @@ -1,4 +1,4 @@ -// Copyright (C) 2022 The Android Open Source Project +// Copyright (C) 2021 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. @@ -36,7 +36,7 @@ soong_config_module_type { } wifi_hal_cc_defaults { - name: "android.hardware.wifi-service-cppflags-defaults", + name: "android.hardware.wifi@1.0-service-cppflags-defaults", soong_config_variables: { hidl_feature_aware: { cppflags: ["-DWIFI_HIDL_FEATURE_AWARE"], @@ -60,8 +60,8 @@ wifi_hal_cc_defaults { } cc_library_static { - name: "android.hardware.wifi-service-lib", - defaults: ["android.hardware.wifi-service-cppflags-defaults"], + name: "android.hardware.wifi@1.0-service-lib", + defaults: ["android.hardware.wifi@1.0-service-cppflags-defaults"], proprietary: true, compile_multilib: "first", cppflags: [ @@ -72,8 +72,8 @@ cc_library_static { // Allow implicit fallthroughs in wifi_legacy_hal.cpp until they are fixed. cflags: ["-Wno-error=implicit-fallthrough"], srcs: [ - "aidl_struct_util.cpp", - "aidl_sync_util.cpp", + "hidl_struct_util.cpp", + "hidl_sync_util.cpp", "ringbuffer.cpp", "wifi.cpp", "wifi_ap_iface.cpp", @@ -93,23 +93,29 @@ cc_library_static { shared_libs: [ "libbase", - "libbinder_ndk", "libcutils", + "libhidlbase", "liblog", "libnl", "libutils", "libwifi-hal", "libwifi-system-iface", "libxml2", - "android.hardware.wifi-V1-ndk", + "android.hardware.wifi@1.0", + "android.hardware.wifi@1.1", + "android.hardware.wifi@1.2", + "android.hardware.wifi@1.3", + "android.hardware.wifi@1.4", + "android.hardware.wifi@1.5", + "android.hardware.wifi@1.6", ], export_include_dirs: ["."], } cc_binary { - name: "android.hardware.wifi-service", - vintf_fragments: ["android.hardware.wifi-service.xml"], + name: "android.hardware.wifi@1.0-service", + vintf_fragments: ["android.hardware.wifi@1.0-service.xml"], relative_install_path: "hw", proprietary: true, cppflags: [ @@ -120,24 +126,30 @@ cc_binary { srcs: ["service.cpp"], shared_libs: [ "libbase", - "libbinder_ndk", "libcutils", + "libhidlbase", "liblog", "libnl", "libutils", "libwifi-hal", "libwifi-system-iface", "libxml2", - "android.hardware.wifi-V1-ndk", + "android.hardware.wifi@1.0", + "android.hardware.wifi@1.1", + "android.hardware.wifi@1.2", + "android.hardware.wifi@1.3", + "android.hardware.wifi@1.4", + "android.hardware.wifi@1.5", + "android.hardware.wifi@1.6", ], - static_libs: ["android.hardware.wifi-service-lib"], - init_rc: ["android.hardware.wifi-service.rc"], + static_libs: ["android.hardware.wifi@1.0-service-lib"], + init_rc: ["android.hardware.wifi@1.0-service.rc"], } cc_binary { - name: "android.hardware.wifi-service-lazy", - vintf_fragments: ["android.hardware.wifi-service.xml"], - overrides: ["android.hardware.wifi-service"], + name: "android.hardware.wifi@1.0-service-lazy", + vintf_fragments: ["android.hardware.wifi@1.0-service.xml"], + overrides: ["android.hardware.wifi@1.0-service"], cflags: ["-DLAZY_SERVICE"], relative_install_path: "hw", proprietary: true, @@ -149,22 +161,28 @@ cc_binary { srcs: ["service.cpp"], shared_libs: [ "libbase", - "libbinder_ndk", "libcutils", + "libhidlbase", "liblog", "libnl", "libutils", "libwifi-hal", "libwifi-system-iface", "libxml2", - "android.hardware.wifi-V1-ndk", + "android.hardware.wifi@1.0", + "android.hardware.wifi@1.1", + "android.hardware.wifi@1.2", + "android.hardware.wifi@1.3", + "android.hardware.wifi@1.4", + "android.hardware.wifi@1.5", + "android.hardware.wifi@1.6", ], - static_libs: ["android.hardware.wifi-service-lib"], - init_rc: ["android.hardware.wifi-service-lazy.rc"], + static_libs: ["android.hardware.wifi@1.0-service-lib"], + init_rc: ["android.hardware.wifi@1.0-service-lazy.rc"], } cc_test { - name: "android.hardware.wifi-service-tests", + name: "android.hardware.wifi@1.0-service-tests", proprietary: true, compile_multilib: "first", cppflags: [ @@ -173,7 +191,7 @@ cc_test { "-Wextra", ], srcs: [ - "tests/aidl_struct_util_unit_tests.cpp", + "tests/hidl_struct_util_unit_tests.cpp", "tests/main.cpp", "tests/mock_interface_tool.cpp", "tests/mock_wifi_feature_flags.cpp", @@ -188,13 +206,19 @@ cc_test { static_libs: [ "libgmock", "libgtest", - "android.hardware.wifi-V1-ndk", - "android.hardware.wifi-service-lib", + "android.hardware.wifi@1.0", + "android.hardware.wifi@1.1", + "android.hardware.wifi@1.2", + "android.hardware.wifi@1.3", + "android.hardware.wifi@1.4", + "android.hardware.wifi@1.5", + "android.hardware.wifi@1.6", + "android.hardware.wifi@1.0-service-lib", ], shared_libs: [ "libbase", - "libbinder_ndk", "libcutils", + "libhidlbase", "liblog", "libnl", "libutils", @@ -204,11 +228,11 @@ cc_test { } filegroup { - name: "default-android.hardware.wifi-service.rc", - srcs: ["android.hardware.wifi-service.rc"], + name: "default-android.hardware.wifi@1.0-service.rc", + srcs: ["android.hardware.wifi@1.0-service.rc"], } filegroup { - name: "default-android.hardware.wifi-service.xml", - srcs: ["android.hardware.wifi-service.xml"], + name: "default-android.hardware.wifi@1.0-service.xml", + srcs: ["android.hardware.wifi@1.0-service.xml"], } diff --git a/wifi/aidl/default/THREADING.README b/wifi/1.6/default/THREADING.README similarity index 82% rename from wifi/aidl/default/THREADING.README rename to wifi/1.6/default/THREADING.README index 45679da069..8366ca0201 100644 --- a/wifi/aidl/default/THREADING.README +++ b/wifi/1.6/default/THREADING.README @@ -1,7 +1,7 @@ Vendor HAL Threading Model ========================== The vendor HAL service has two threads: -1. AIDL thread: This is the main thread which processes all the incoming AIDL +1. HIDL thread: This is the main thread which processes all the incoming HIDL RPC's. 2. Legacy HAL event loop thread: This is the thread forked off for processing the legacy HAL event loop (wifi_event_loop()). This thread is used to process @@ -11,9 +11,9 @@ callbacks passed to the legacy HAL API's are invoked on this thread. Synchronization Concerns ======================== wifi_legacy_hal.cpp has a bunch of global "C" style functions to handle the -legacy callbacks. Each of these "C" style functions invokes a corresponding +legacy callbacks. Each of these "C" style function invokes a corresponding "std::function" version of the callback which does the actual processing. -The variables holding these "std::function" callbacks are reset from the AIDL +The variables holding these "std::function" callbacks are reset from the HIDL thread when they are no longer used. For example: stopGscan() will reset the corresponding "on_gscan_*" callback variables which were set when startGscan() was invoked. This is not thread safe since these callback variables are @@ -24,12 +24,12 @@ Synchronization Solution Adding a global lock seems to be the most trivial solution to the problem. a) All of the asynchronous "C" style callbacks will acquire the global lock before invoking the corresponding "std::function" callback variables. -b) All of the AIDL methods will also acquire the global lock before processing -(in aidl_return_util::validateAndCall()). +b) All of the HIDL methods will also acquire the global lock before processing +(in hidl_return_util::validateAndCall()). Note: It's important that we only acquire the global lock for asynchronous callbacks, because there is no guarantee (or documentation to clarify) that the synchronous callbacks are invoked on the same invocation thread. If that is not the case in some implementation, we will end up deadlocking the system since the -AIDL thread would have acquired the global lock which is needed by the +HIDL thread would have acquired the global lock which is needed by the synchronous callback executed on the legacy hal event loop thread. diff --git a/wifi/1.6/default/android.hardware.wifi@1.0-service-lazy.rc b/wifi/1.6/default/android.hardware.wifi@1.0-service-lazy.rc new file mode 100644 index 0000000000..ee8c818d90 --- /dev/null +++ b/wifi/1.6/default/android.hardware.wifi@1.0-service-lazy.rc @@ -0,0 +1,14 @@ +service vendor.wifi_hal_legacy /vendor/bin/hw/android.hardware.wifi@1.0-service-lazy + interface android.hardware.wifi@1.0::IWifi default + interface android.hardware.wifi@1.1::IWifi default + interface android.hardware.wifi@1.2::IWifi default + interface android.hardware.wifi@1.3::IWifi default + interface android.hardware.wifi@1.4::IWifi default + interface android.hardware.wifi@1.5::IWifi default + interface android.hardware.wifi@1.6::IWifi default + oneshot + disabled + class hal + capabilities NET_ADMIN NET_RAW SYS_MODULE + user wifi + group wifi gps diff --git a/wifi/1.6/default/android.hardware.wifi@1.0-service.rc b/wifi/1.6/default/android.hardware.wifi@1.0-service.rc new file mode 100644 index 0000000000..18f40d0bb5 --- /dev/null +++ b/wifi/1.6/default/android.hardware.wifi@1.0-service.rc @@ -0,0 +1,12 @@ +service vendor.wifi_hal_legacy /vendor/bin/hw/android.hardware.wifi@1.0-service + interface android.hardware.wifi@1.0::IWifi default + interface android.hardware.wifi@1.1::IWifi default + interface android.hardware.wifi@1.2::IWifi default + interface android.hardware.wifi@1.3::IWifi default + interface android.hardware.wifi@1.4::IWifi default + interface android.hardware.wifi@1.5::IWifi default + interface android.hardware.wifi@1.6::IWifi default + class hal + capabilities NET_ADMIN NET_RAW SYS_MODULE + user wifi + group wifi gps diff --git a/wifi/1.6/default/android.hardware.wifi@1.0-service.xml b/wifi/1.6/default/android.hardware.wifi@1.0-service.xml new file mode 100644 index 0000000000..771fbaaf42 --- /dev/null +++ b/wifi/1.6/default/android.hardware.wifi@1.0-service.xml @@ -0,0 +1,11 @@ + + + android.hardware.wifi + hwbinder + 1.6 + + IWifi + default + + + diff --git a/wifi/1.6/default/hidl_callback_util.h b/wifi/1.6/default/hidl_callback_util.h new file mode 100644 index 0000000000..aab0ae5393 --- /dev/null +++ b/wifi/1.6/default/hidl_callback_util.h @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2017 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. + */ + +#ifndef HIDL_CALLBACK_UTIL_H_ +#define HIDL_CALLBACK_UTIL_H_ + +#include + +#include +#include + +namespace { +// Type of callback invoked by the death handler. +using on_death_cb_function = std::function; + +// Private class used to keep track of death of individual +// callbacks stored in HidlCallbackHandler. +template +class HidlDeathHandler : public android::hardware::hidl_death_recipient { + public: + HidlDeathHandler(const on_death_cb_function& user_cb_function) + : cb_function_(user_cb_function) {} + ~HidlDeathHandler() = default; + + // Death notification for callbacks. + void serviceDied(uint64_t cookie, + const android::wp& /* who */) override { + cb_function_(cookie); + } + + private: + on_death_cb_function cb_function_; + + DISALLOW_COPY_AND_ASSIGN(HidlDeathHandler); +}; +} // namespace + +namespace android { +namespace hardware { +namespace wifi { +namespace V1_6 { +namespace implementation { +namespace hidl_callback_util { +template +// Provides a class to manage callbacks for the various HIDL interfaces and +// handle the death of the process hosting each callback. +class HidlCallbackHandler { + public: + HidlCallbackHandler() + : death_handler_(new HidlDeathHandler( + std::bind(&HidlCallbackHandler::onObjectDeath, this, std::placeholders::_1))) {} + ~HidlCallbackHandler() = default; + + bool addCallback(const sp& cb) { + // TODO(b/33818800): Can't compare proxies yet. So, use the cookie + // (callback proxy's raw pointer) to track the death of individual + // clients. + uint64_t cookie = reinterpret_cast(cb.get()); + for (const auto& s : cb_set_) { + if (interfacesEqual(cb, s)) { + LOG(ERROR) << "Duplicate death notification registration"; + return true; + } + } + if (!cb->linkToDeath(death_handler_, cookie)) { + LOG(ERROR) << "Failed to register death notification"; + return false; + } + cb_set_.insert(cb); + return true; + } + + const std::set>& getCallbacks() { return cb_set_; } + + // Death notification for callbacks. + void onObjectDeath(uint64_t cookie) { + CallbackType* cb = reinterpret_cast(cookie); + const auto& iter = cb_set_.find(cb); + if (iter == cb_set_.end()) { + LOG(ERROR) << "Unknown callback death notification received"; + return; + } + cb_set_.erase(iter); + LOG(DEBUG) << "Dead callback removed from list"; + } + + void invalidate() { + for (const sp& cb : cb_set_) { + if (!cb->unlinkToDeath(death_handler_)) { + LOG(ERROR) << "Failed to deregister death notification"; + } + } + cb_set_.clear(); + } + + private: + std::set> cb_set_; + sp> death_handler_; + + DISALLOW_COPY_AND_ASSIGN(HidlCallbackHandler); +}; + +} // namespace hidl_callback_util +} // namespace implementation +} // namespace V1_6 +} // namespace wifi +} // namespace hardware +} // namespace android +#endif // HIDL_CALLBACK_UTIL_H_ diff --git a/wifi/1.6/default/hidl_return_util.h b/wifi/1.6/default/hidl_return_util.h new file mode 100644 index 0000000000..a0efac2c57 --- /dev/null +++ b/wifi/1.6/default/hidl_return_util.h @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2016 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. + */ + +#ifndef HIDL_RETURN_UTIL_H_ +#define HIDL_RETURN_UTIL_H_ + +#include "hidl_sync_util.h" +#include "wifi_status_util.h" + +namespace android { +namespace hardware { +namespace wifi { +namespace V1_6 { +namespace implementation { +namespace hidl_return_util { +using namespace android::hardware::wifi::V1_0; + +/** + * These utility functions are used to invoke a method on the provided + * HIDL interface object. + * These functions checks if the provided HIDL interface object is valid. + * a) if valid, Invokes the corresponding internal implementation function of + * the HIDL method. It then invokes the HIDL continuation callback with + * the status and any returned values. + * b) if invalid, invokes the HIDL continuation callback with the + * provided error status and default values. + */ +// Use for HIDL methods which return only an instance of WifiStatus. +template +Return validateAndCall(ObjT* obj, WifiStatusCode status_code_if_invalid, WorkFuncT&& work, + const std::function& hidl_cb, + Args&&... args) { + const auto lock = hidl_sync_util::acquireGlobalLock(); + if (obj->isValid()) { + hidl_cb((obj->*work)(std::forward(args)...)); + } else { + hidl_cb(createWifiStatus(status_code_if_invalid)); + } + return Void(); +} + +// Use for HIDL methods which return only an instance of WifiStatus. +// This version passes the global lock acquired to the body of the method. +// Note: Only used by IWifi::stop() currently. +template +Return validateAndCallWithLock(ObjT* obj, WifiStatusCode status_code_if_invalid, + WorkFuncT&& work, + const std::function& hidl_cb, + Args&&... args) { + auto lock = hidl_sync_util::acquireGlobalLock(); + if (obj->isValid()) { + hidl_cb((obj->*work)(&lock, std::forward(args)...)); + } else { + hidl_cb(createWifiStatus(status_code_if_invalid)); + } + return Void(); +} + +// Use for HIDL methods which return instance of WifiStatus and a single return +// value. +template +Return validateAndCall(ObjT* obj, WifiStatusCode status_code_if_invalid, WorkFuncT&& work, + const std::function& hidl_cb, + Args&&... args) { + const auto lock = hidl_sync_util::acquireGlobalLock(); + if (obj->isValid()) { + const auto& ret_pair = (obj->*work)(std::forward(args)...); + const WifiStatus& status = std::get<0>(ret_pair); + const auto& ret_value = std::get<1>(ret_pair); + hidl_cb(status, ret_value); + } else { + hidl_cb(createWifiStatus(status_code_if_invalid), + typename std::remove_reference::type()); + } + return Void(); +} + +// Use for HIDL methods which return instance of WifiStatus and 2 return +// values. +template +Return validateAndCall( + ObjT* obj, WifiStatusCode status_code_if_invalid, WorkFuncT&& work, + const std::function& hidl_cb, Args&&... args) { + const auto lock = hidl_sync_util::acquireGlobalLock(); + if (obj->isValid()) { + const auto& ret_tuple = (obj->*work)(std::forward(args)...); + const WifiStatus& status = std::get<0>(ret_tuple); + const auto& ret_value1 = std::get<1>(ret_tuple); + const auto& ret_value2 = std::get<2>(ret_tuple); + hidl_cb(status, ret_value1, ret_value2); + } else { + hidl_cb(createWifiStatus(status_code_if_invalid), + typename std::remove_reference::type(), + typename std::remove_reference::type()); + } + return Void(); +} + +} // namespace hidl_return_util +} // namespace implementation +} // namespace V1_6 +} // namespace wifi +} // namespace hardware +} // namespace android +#endif // HIDL_RETURN_UTIL_H_ diff --git a/wifi/1.6/default/hidl_struct_util.cpp b/wifi/1.6/default/hidl_struct_util.cpp new file mode 100644 index 0000000000..2112b260f3 --- /dev/null +++ b/wifi/1.6/default/hidl_struct_util.cpp @@ -0,0 +1,3007 @@ +/* + * Copyright (C) 2016 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. + */ + +#include +#include + +#include "hidl_struct_util.h" + +namespace android { +namespace hardware { +namespace wifi { +namespace V1_6 { +namespace implementation { +namespace hidl_struct_util { + +using V1_6::NanConfigRequestSupplemental; + +WifiChannelWidthInMhz convertLegacyWifiChannelWidthToHidl(legacy_hal::wifi_channel_width type); + +hidl_string safeConvertChar(const char* str, size_t max_len) { + const char* c = str; + size_t size = 0; + while (*c && (unsigned char)*c < 128 && size < max_len) { + ++size; + ++c; + } + return hidl_string(str, size); +} + +IWifiChip::ChipCapabilityMask convertLegacyLoggerFeatureToHidlChipCapability(uint32_t feature) { + using HidlChipCaps = IWifiChip::ChipCapabilityMask; + switch (feature) { + case legacy_hal::WIFI_LOGGER_MEMORY_DUMP_SUPPORTED: + return HidlChipCaps::DEBUG_MEMORY_FIRMWARE_DUMP; + case legacy_hal::WIFI_LOGGER_DRIVER_DUMP_SUPPORTED: + return HidlChipCaps::DEBUG_MEMORY_DRIVER_DUMP; + case legacy_hal::WIFI_LOGGER_CONNECT_EVENT_SUPPORTED: + return HidlChipCaps::DEBUG_RING_BUFFER_CONNECT_EVENT; + case legacy_hal::WIFI_LOGGER_POWER_EVENT_SUPPORTED: + return HidlChipCaps::DEBUG_RING_BUFFER_POWER_EVENT; + case legacy_hal::WIFI_LOGGER_WAKE_LOCK_SUPPORTED: + return HidlChipCaps::DEBUG_RING_BUFFER_WAKELOCK_EVENT; + }; + CHECK(false) << "Unknown legacy feature: " << feature; + return {}; +} + +IWifiStaIface::StaIfaceCapabilityMask convertLegacyLoggerFeatureToHidlStaIfaceCapability( + uint32_t feature) { + using HidlStaIfaceCaps = IWifiStaIface::StaIfaceCapabilityMask; + switch (feature) { + case legacy_hal::WIFI_LOGGER_PACKET_FATE_SUPPORTED: + return HidlStaIfaceCaps::DEBUG_PACKET_FATE; + }; + CHECK(false) << "Unknown legacy feature: " << feature; + return {}; +} + +V1_5::IWifiChip::ChipCapabilityMask convertLegacyFeatureToHidlChipCapability(uint64_t feature) { + using HidlChipCaps = V1_5::IWifiChip::ChipCapabilityMask; + switch (feature) { + case WIFI_FEATURE_SET_TX_POWER_LIMIT: + return HidlChipCaps::SET_TX_POWER_LIMIT; + case WIFI_FEATURE_USE_BODY_HEAD_SAR: + return HidlChipCaps::USE_BODY_HEAD_SAR; + case WIFI_FEATURE_D2D_RTT: + return HidlChipCaps::D2D_RTT; + case WIFI_FEATURE_D2AP_RTT: + return HidlChipCaps::D2AP_RTT; + case WIFI_FEATURE_INFRA_60G: + return HidlChipCaps::WIGIG; + case WIFI_FEATURE_SET_LATENCY_MODE: + return HidlChipCaps::SET_LATENCY_MODE; + case WIFI_FEATURE_P2P_RAND_MAC: + return HidlChipCaps::P2P_RAND_MAC; + }; + CHECK(false) << "Unknown legacy feature: " << feature; + return {}; +} + +IWifiStaIface::StaIfaceCapabilityMask convertLegacyFeatureToHidlStaIfaceCapability( + uint64_t feature) { + using HidlStaIfaceCaps = IWifiStaIface::StaIfaceCapabilityMask; + switch (feature) { + case WIFI_FEATURE_GSCAN: + return HidlStaIfaceCaps::BACKGROUND_SCAN; + case WIFI_FEATURE_LINK_LAYER_STATS: + return HidlStaIfaceCaps::LINK_LAYER_STATS; + case WIFI_FEATURE_RSSI_MONITOR: + return HidlStaIfaceCaps::RSSI_MONITOR; + case WIFI_FEATURE_CONTROL_ROAMING: + return HidlStaIfaceCaps::CONTROL_ROAMING; + case WIFI_FEATURE_IE_WHITELIST: + return HidlStaIfaceCaps::PROBE_IE_WHITELIST; + case WIFI_FEATURE_SCAN_RAND: + return HidlStaIfaceCaps::SCAN_RAND; + case WIFI_FEATURE_INFRA_5G: + return HidlStaIfaceCaps::STA_5G; + case WIFI_FEATURE_HOTSPOT: + return HidlStaIfaceCaps::HOTSPOT; + case WIFI_FEATURE_PNO: + return HidlStaIfaceCaps::PNO; + case WIFI_FEATURE_TDLS: + return HidlStaIfaceCaps::TDLS; + case WIFI_FEATURE_TDLS_OFFCHANNEL: + return HidlStaIfaceCaps::TDLS_OFFCHANNEL; + case WIFI_FEATURE_CONFIG_NDO: + return HidlStaIfaceCaps::ND_OFFLOAD; + case WIFI_FEATURE_MKEEP_ALIVE: + return HidlStaIfaceCaps::KEEP_ALIVE; + }; + CHECK(false) << "Unknown legacy feature: " << feature; + return {}; +} + +bool convertLegacyFeaturesToHidlChipCapabilities(uint64_t legacy_feature_set, + uint32_t legacy_logger_feature_set, + uint32_t* hidl_caps) { + if (!hidl_caps) { + return false; + } + *hidl_caps = {}; + using HidlChipCaps = IWifiChip::ChipCapabilityMask; + for (const auto feature : {legacy_hal::WIFI_LOGGER_MEMORY_DUMP_SUPPORTED, + legacy_hal::WIFI_LOGGER_DRIVER_DUMP_SUPPORTED, + legacy_hal::WIFI_LOGGER_CONNECT_EVENT_SUPPORTED, + legacy_hal::WIFI_LOGGER_POWER_EVENT_SUPPORTED, + legacy_hal::WIFI_LOGGER_WAKE_LOCK_SUPPORTED}) { + if (feature & legacy_logger_feature_set) { + *hidl_caps |= convertLegacyLoggerFeatureToHidlChipCapability(feature); + } + } + std::vector features = {WIFI_FEATURE_SET_TX_POWER_LIMIT, + WIFI_FEATURE_USE_BODY_HEAD_SAR, + WIFI_FEATURE_D2D_RTT, + WIFI_FEATURE_D2AP_RTT, + WIFI_FEATURE_INFRA_60G, + WIFI_FEATURE_SET_LATENCY_MODE, + WIFI_FEATURE_P2P_RAND_MAC}; + for (const auto feature : features) { + if (feature & legacy_feature_set) { + *hidl_caps |= convertLegacyFeatureToHidlChipCapability(feature); + } + } + + // There are no flags for these 3 in the legacy feature set. Adding them to + // the set because all the current devices support it. + *hidl_caps |= HidlChipCaps::DEBUG_RING_BUFFER_VENDOR_DATA; + *hidl_caps |= HidlChipCaps::DEBUG_HOST_WAKE_REASON_STATS; + *hidl_caps |= HidlChipCaps::DEBUG_ERROR_ALERTS; + return true; +} + +WifiDebugRingBufferFlags convertLegacyDebugRingBufferFlagsToHidl(uint32_t flag) { + switch (flag) { + case WIFI_RING_BUFFER_FLAG_HAS_BINARY_ENTRIES: + return WifiDebugRingBufferFlags::HAS_BINARY_ENTRIES; + case WIFI_RING_BUFFER_FLAG_HAS_ASCII_ENTRIES: + return WifiDebugRingBufferFlags::HAS_ASCII_ENTRIES; + }; + CHECK(false) << "Unknown legacy flag: " << flag; + return {}; +} + +bool convertLegacyDebugRingBufferStatusToHidl( + const legacy_hal::wifi_ring_buffer_status& legacy_status, + WifiDebugRingBufferStatus* hidl_status) { + if (!hidl_status) { + return false; + } + *hidl_status = {}; + hidl_status->ringName = safeConvertChar(reinterpret_cast(legacy_status.name), + sizeof(legacy_status.name)); + hidl_status->flags = 0; + for (const auto flag : + {WIFI_RING_BUFFER_FLAG_HAS_BINARY_ENTRIES, WIFI_RING_BUFFER_FLAG_HAS_ASCII_ENTRIES}) { + if (flag & legacy_status.flags) { + hidl_status->flags |= static_cast::type>( + convertLegacyDebugRingBufferFlagsToHidl(flag)); + } + } + hidl_status->ringId = legacy_status.ring_id; + hidl_status->sizeInBytes = legacy_status.ring_buffer_byte_size; + // Calculate free size of the ring the buffer. We don't need to send the + // exact read/write pointers that were there in the legacy HAL interface. + if (legacy_status.written_bytes >= legacy_status.read_bytes) { + hidl_status->freeSizeInBytes = legacy_status.ring_buffer_byte_size - + (legacy_status.written_bytes - legacy_status.read_bytes); + } else { + hidl_status->freeSizeInBytes = legacy_status.read_bytes - legacy_status.written_bytes; + } + hidl_status->verboseLevel = legacy_status.verbose_level; + return true; +} + +bool convertLegacyVectorOfDebugRingBufferStatusToHidl( + const std::vector& legacy_status_vec, + std::vector* hidl_status_vec) { + if (!hidl_status_vec) { + return false; + } + *hidl_status_vec = {}; + for (const auto& legacy_status : legacy_status_vec) { + WifiDebugRingBufferStatus hidl_status; + if (!convertLegacyDebugRingBufferStatusToHidl(legacy_status, &hidl_status)) { + return false; + } + hidl_status_vec->push_back(hidl_status); + } + return true; +} + +bool convertLegacyWakeReasonStatsToHidl(const legacy_hal::WakeReasonStats& legacy_stats, + WifiDebugHostWakeReasonStats* hidl_stats) { + if (!hidl_stats) { + return false; + } + *hidl_stats = {}; + hidl_stats->totalCmdEventWakeCnt = legacy_stats.wake_reason_cnt.total_cmd_event_wake; + hidl_stats->cmdEventWakeCntPerType = legacy_stats.cmd_event_wake_cnt; + hidl_stats->totalDriverFwLocalWakeCnt = legacy_stats.wake_reason_cnt.total_driver_fw_local_wake; + hidl_stats->driverFwLocalWakeCntPerType = legacy_stats.driver_fw_local_wake_cnt; + hidl_stats->totalRxPacketWakeCnt = legacy_stats.wake_reason_cnt.total_rx_data_wake; + hidl_stats->rxPktWakeDetails.rxUnicastCnt = + legacy_stats.wake_reason_cnt.rx_wake_details.rx_unicast_cnt; + hidl_stats->rxPktWakeDetails.rxMulticastCnt = + legacy_stats.wake_reason_cnt.rx_wake_details.rx_multicast_cnt; + hidl_stats->rxPktWakeDetails.rxBroadcastCnt = + legacy_stats.wake_reason_cnt.rx_wake_details.rx_broadcast_cnt; + hidl_stats->rxMulticastPkWakeDetails.ipv4RxMulticastAddrCnt = + legacy_stats.wake_reason_cnt.rx_multicast_wake_pkt_info.ipv4_rx_multicast_addr_cnt; + hidl_stats->rxMulticastPkWakeDetails.ipv6RxMulticastAddrCnt = + legacy_stats.wake_reason_cnt.rx_multicast_wake_pkt_info.ipv6_rx_multicast_addr_cnt; + hidl_stats->rxMulticastPkWakeDetails.otherRxMulticastAddrCnt = + legacy_stats.wake_reason_cnt.rx_multicast_wake_pkt_info.other_rx_multicast_addr_cnt; + hidl_stats->rxIcmpPkWakeDetails.icmpPkt = + legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp_pkt; + hidl_stats->rxIcmpPkWakeDetails.icmp6Pkt = + legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_pkt; + hidl_stats->rxIcmpPkWakeDetails.icmp6Ra = + legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_ra; + hidl_stats->rxIcmpPkWakeDetails.icmp6Na = + legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_na; + hidl_stats->rxIcmpPkWakeDetails.icmp6Ns = + legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_ns; + return true; +} + +legacy_hal::wifi_power_scenario convertHidlTxPowerScenarioToLegacy( + V1_1::IWifiChip::TxPowerScenario hidl_scenario) { + switch (hidl_scenario) { + // This is the only supported scenario for V1_1 + case V1_1::IWifiChip::TxPowerScenario::VOICE_CALL: + return legacy_hal::WIFI_POWER_SCENARIO_VOICE_CALL; + }; + CHECK(false); +} + +legacy_hal::wifi_power_scenario convertHidlTxPowerScenarioToLegacy_1_2( + V1_2::IWifiChip::TxPowerScenario hidl_scenario) { + switch (hidl_scenario) { + // This is the only supported scenario for V1_1 + case V1_2::IWifiChip::TxPowerScenario::VOICE_CALL: + return legacy_hal::WIFI_POWER_SCENARIO_VOICE_CALL; + // Those are the supported scenarios for V1_2 + case V1_2::IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF: + return legacy_hal::WIFI_POWER_SCENARIO_ON_HEAD_CELL_OFF; + case V1_2::IWifiChip::TxPowerScenario::ON_HEAD_CELL_ON: + return legacy_hal::WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON; + case V1_2::IWifiChip::TxPowerScenario::ON_BODY_CELL_OFF: + return legacy_hal::WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF; + case V1_2::IWifiChip::TxPowerScenario::ON_BODY_CELL_ON: + return legacy_hal::WIFI_POWER_SCENARIO_ON_BODY_CELL_ON; + }; + CHECK(false); +} + +legacy_hal::wifi_latency_mode convertHidlLatencyModeToLegacy( + V1_3::IWifiChip::LatencyMode hidl_latency_mode) { + switch (hidl_latency_mode) { + case V1_3::IWifiChip::LatencyMode::NORMAL: + return legacy_hal::WIFI_LATENCY_MODE_NORMAL; + case V1_3::IWifiChip::LatencyMode::LOW: + return legacy_hal::WIFI_LATENCY_MODE_LOW; + } + CHECK(false); +} + +bool convertLegacyWifiMacInfoToHidl( + const legacy_hal::WifiMacInfo& legacy_mac_info, + V1_4::IWifiChipEventCallback::RadioModeInfo* hidl_radio_mode_info) { + if (!hidl_radio_mode_info) { + return false; + } + *hidl_radio_mode_info = {}; + + hidl_radio_mode_info->radioId = legacy_mac_info.wlan_mac_id; + // Convert from bitmask of bands in the legacy HAL to enum value in + // the HIDL interface. + if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND && + legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND && + legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND) { + hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_24GHZ_5GHZ_6GHZ; + } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND && + legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND) { + hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_5GHZ_6GHZ; + } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND) { + hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_6GHZ; + } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND && + legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND) { + hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_24GHZ_5GHZ; + } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND) { + hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_24GHZ; + } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND) { + hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_5GHZ; + } else { + hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_UNSPECIFIED; + } + std::vector iface_info_vec; + for (const auto& legacy_iface_info : legacy_mac_info.iface_infos) { + V1_2::IWifiChipEventCallback::IfaceInfo iface_info; + iface_info.name = legacy_iface_info.name; + iface_info.channel = legacy_iface_info.channel; + iface_info_vec.push_back(iface_info); + } + hidl_radio_mode_info->ifaceInfos = iface_info_vec; + return true; +} + +uint32_t convertHidlWifiBandToLegacyMacBand(V1_5::WifiBand hidl_band) { + switch (hidl_band) { + case V1_5::WifiBand::BAND_24GHZ: + return legacy_hal::WLAN_MAC_2_4_BAND; + case V1_5::WifiBand::BAND_5GHZ: + case V1_5::WifiBand::BAND_5GHZ_DFS: + case V1_5::WifiBand::BAND_5GHZ_WITH_DFS: + return legacy_hal::WLAN_MAC_5_0_BAND; + case V1_5::WifiBand::BAND_24GHZ_5GHZ: + case V1_5::WifiBand::BAND_24GHZ_5GHZ_WITH_DFS: + return (legacy_hal::WLAN_MAC_2_4_BAND | legacy_hal::WLAN_MAC_5_0_BAND); + case V1_5::WifiBand::BAND_6GHZ: + return legacy_hal::WLAN_MAC_6_0_BAND; + case V1_5::WifiBand::BAND_5GHZ_6GHZ: + return (legacy_hal::WLAN_MAC_5_0_BAND | legacy_hal::WLAN_MAC_6_0_BAND); + case V1_5::WifiBand::BAND_24GHZ_5GHZ_6GHZ: + case V1_5::WifiBand::BAND_24GHZ_5GHZ_WITH_DFS_6GHZ: + return (legacy_hal::WLAN_MAC_2_4_BAND | legacy_hal::WLAN_MAC_5_0_BAND | + legacy_hal::WLAN_MAC_6_0_BAND); + case V1_5::WifiBand::BAND_60GHZ: + return legacy_hal::WLAN_MAC_60_0_BAND; + default: + return (legacy_hal::WLAN_MAC_2_4_BAND | legacy_hal::WLAN_MAC_5_0_BAND | + legacy_hal::WLAN_MAC_6_0_BAND | legacy_hal::WLAN_MAC_60_0_BAND); + } +} + +V1_5::WifiBand convertLegacyMacBandToHidlWifiBand(uint32_t band) { + switch (band) { + case legacy_hal::WLAN_MAC_2_4_BAND: + return V1_5::WifiBand::BAND_24GHZ; + case legacy_hal::WLAN_MAC_5_0_BAND: + return V1_5::WifiBand::BAND_5GHZ; + case legacy_hal::WLAN_MAC_6_0_BAND: + return V1_5::WifiBand::BAND_6GHZ; + case legacy_hal::WLAN_MAC_60_0_BAND: + return V1_5::WifiBand::BAND_60GHZ; + default: + return V1_5::WifiBand::BAND_UNSPECIFIED; + } +} + +uint32_t convertHidlWifiIfaceModeToLegacy(uint32_t hidl_iface_mask) { + uint32_t legacy_iface_mask = 0; + if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_STA) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_STA); + } + if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_SOFTAP) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_SOFTAP); + } + if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_P2P_CLIENT) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_P2P_CLIENT); + } + if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_P2P_GO) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_P2P_GO); + } + if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_NAN) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_NAN); + } + if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_TDLS) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_TDLS); + } + if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_MESH) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_MESH); + } + if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_IBSS) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_IBSS); + } + return legacy_iface_mask; +} + +uint32_t convertLegacyWifiInterfaceModeToHidl(uint32_t legacy_iface_mask) { + uint32_t hidl_iface_mask = 0; + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_STA)) { + hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_STA; + } + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_SOFTAP)) { + hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_SOFTAP; + } + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_P2P_CLIENT)) { + hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_P2P_CLIENT; + } + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_P2P_GO)) { + hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_P2P_GO; + } + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_NAN)) { + hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_NAN; + } + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_TDLS)) { + hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_TDLS; + } + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_MESH)) { + hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_MESH; + } + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_IBSS)) { + hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_IBSS; + } + return hidl_iface_mask; +} + +uint32_t convertHidlUsableChannelFilterToLegacy(uint32_t hidl_filter_mask) { + uint32_t legacy_filter_mask = 0; + if (hidl_filter_mask & V1_5::IWifiChip::UsableChannelFilter::CELLULAR_COEXISTENCE) { + legacy_filter_mask |= legacy_hal::WIFI_USABLE_CHANNEL_FILTER_CELLULAR_COEXISTENCE; + } + if (hidl_filter_mask & V1_5::IWifiChip::UsableChannelFilter::CONCURRENCY) { + legacy_filter_mask |= legacy_hal::WIFI_USABLE_CHANNEL_FILTER_CONCURRENCY; + } + if (hidl_filter_mask & V1_6::IWifiChip::UsableChannelFilter::NAN_INSTANT_MODE) { + legacy_filter_mask |= WIFI_USABLE_CHANNEL_FILTER_NAN_INSTANT_MODE; + } + return legacy_filter_mask; +} + +bool convertLegacyWifiUsableChannelToHidl( + const legacy_hal::wifi_usable_channel& legacy_usable_channel, + V1_6::WifiUsableChannel* hidl_usable_channel) { + if (!hidl_usable_channel) { + return false; + } + *hidl_usable_channel = {}; + hidl_usable_channel->channel = legacy_usable_channel.freq; + hidl_usable_channel->channelBandwidth = + convertLegacyWifiChannelWidthToHidl(legacy_usable_channel.width); + hidl_usable_channel->ifaceModeMask = + convertLegacyWifiInterfaceModeToHidl(legacy_usable_channel.iface_mode_mask); + + return true; +} + +bool convertLegacyWifiUsableChannelsToHidl( + const std::vector& legacy_usable_channels, + std::vector* hidl_usable_channels) { + if (!hidl_usable_channels) { + return false; + } + *hidl_usable_channels = {}; + for (const auto& legacy_usable_channel : legacy_usable_channels) { + V1_6::WifiUsableChannel hidl_usable_channel; + if (!convertLegacyWifiUsableChannelToHidl(legacy_usable_channel, &hidl_usable_channel)) { + return false; + } + hidl_usable_channels->push_back(hidl_usable_channel); + } + return true; +} + +bool convertLegacyWifiMacInfosToHidl( + const std::vector& legacy_mac_infos, + std::vector* hidl_radio_mode_infos) { + if (!hidl_radio_mode_infos) { + return false; + } + *hidl_radio_mode_infos = {}; + + for (const auto& legacy_mac_info : legacy_mac_infos) { + V1_4::IWifiChipEventCallback::RadioModeInfo hidl_radio_mode_info; + if (!convertLegacyWifiMacInfoToHidl(legacy_mac_info, &hidl_radio_mode_info)) { + return false; + } + hidl_radio_mode_infos->push_back(hidl_radio_mode_info); + } + return true; +} + +bool convertLegacyFeaturesToHidlStaCapabilities(uint64_t legacy_feature_set, + uint32_t legacy_logger_feature_set, + uint32_t* hidl_caps) { + if (!hidl_caps) { + return false; + } + *hidl_caps = {}; + using HidlStaIfaceCaps = IWifiStaIface::StaIfaceCapabilityMask; + for (const auto feature : {legacy_hal::WIFI_LOGGER_PACKET_FATE_SUPPORTED}) { + if (feature & legacy_logger_feature_set) { + *hidl_caps |= convertLegacyLoggerFeatureToHidlStaIfaceCapability(feature); + } + } + for (const auto feature : + {WIFI_FEATURE_GSCAN, WIFI_FEATURE_LINK_LAYER_STATS, WIFI_FEATURE_RSSI_MONITOR, + WIFI_FEATURE_CONTROL_ROAMING, WIFI_FEATURE_IE_WHITELIST, WIFI_FEATURE_SCAN_RAND, + WIFI_FEATURE_INFRA_5G, WIFI_FEATURE_HOTSPOT, WIFI_FEATURE_PNO, WIFI_FEATURE_TDLS, + WIFI_FEATURE_TDLS_OFFCHANNEL, WIFI_FEATURE_CONFIG_NDO, WIFI_FEATURE_MKEEP_ALIVE}) { + if (feature & legacy_feature_set) { + *hidl_caps |= convertLegacyFeatureToHidlStaIfaceCapability(feature); + } + } + // There is no flag for this one in the legacy feature set. Adding it to the + // set because all the current devices support it. + *hidl_caps |= HidlStaIfaceCaps::APF; + return true; +} + +bool convertLegacyApfCapabilitiesToHidl(const legacy_hal::PacketFilterCapabilities& legacy_caps, + StaApfPacketFilterCapabilities* hidl_caps) { + if (!hidl_caps) { + return false; + } + *hidl_caps = {}; + hidl_caps->version = legacy_caps.version; + hidl_caps->maxLength = legacy_caps.max_len; + return true; +} + +uint8_t convertHidlGscanReportEventFlagToLegacy( + StaBackgroundScanBucketEventReportSchemeMask hidl_flag) { + using HidlFlag = StaBackgroundScanBucketEventReportSchemeMask; + switch (hidl_flag) { + case HidlFlag::EACH_SCAN: + return REPORT_EVENTS_EACH_SCAN; + case HidlFlag::FULL_RESULTS: + return REPORT_EVENTS_FULL_RESULTS; + case HidlFlag::NO_BATCH: + return REPORT_EVENTS_NO_BATCH; + }; + CHECK(false); +} + +StaScanDataFlagMask convertLegacyGscanDataFlagToHidl(uint8_t legacy_flag) { + switch (legacy_flag) { + case legacy_hal::WIFI_SCAN_FLAG_INTERRUPTED: + return StaScanDataFlagMask::INTERRUPTED; + }; + CHECK(false) << "Unknown legacy flag: " << legacy_flag; + // To silence the compiler warning about reaching the end of non-void + // function. + return {}; +} + +bool convertLegacyGscanCapabilitiesToHidl(const legacy_hal::wifi_gscan_capabilities& legacy_caps, + StaBackgroundScanCapabilities* hidl_caps) { + if (!hidl_caps) { + return false; + } + *hidl_caps = {}; + hidl_caps->maxCacheSize = legacy_caps.max_scan_cache_size; + hidl_caps->maxBuckets = legacy_caps.max_scan_buckets; + hidl_caps->maxApCachePerScan = legacy_caps.max_ap_cache_per_scan; + hidl_caps->maxReportingThreshold = legacy_caps.max_scan_reporting_threshold; + return true; +} + +legacy_hal::wifi_band convertHidlWifiBandToLegacy(V1_0::WifiBand band) { + switch (band) { + case V1_0::WifiBand::BAND_UNSPECIFIED: + return legacy_hal::WIFI_BAND_UNSPECIFIED; + case V1_0::WifiBand::BAND_24GHZ: + return legacy_hal::WIFI_BAND_BG; + case V1_0::WifiBand::BAND_5GHZ: + return legacy_hal::WIFI_BAND_A; + case V1_0::WifiBand::BAND_5GHZ_DFS: + return legacy_hal::WIFI_BAND_A_DFS; + case V1_0::WifiBand::BAND_5GHZ_WITH_DFS: + return legacy_hal::WIFI_BAND_A_WITH_DFS; + case V1_0::WifiBand::BAND_24GHZ_5GHZ: + return legacy_hal::WIFI_BAND_ABG; + case V1_0::WifiBand::BAND_24GHZ_5GHZ_WITH_DFS: + return legacy_hal::WIFI_BAND_ABG_WITH_DFS; + }; + CHECK(false); +} + +bool convertHidlGscanParamsToLegacy(const StaBackgroundScanParameters& hidl_scan_params, + legacy_hal::wifi_scan_cmd_params* legacy_scan_params) { + if (!legacy_scan_params) { + return false; + } + *legacy_scan_params = {}; + legacy_scan_params->base_period = hidl_scan_params.basePeriodInMs; + legacy_scan_params->max_ap_per_scan = hidl_scan_params.maxApPerScan; + legacy_scan_params->report_threshold_percent = hidl_scan_params.reportThresholdPercent; + legacy_scan_params->report_threshold_num_scans = hidl_scan_params.reportThresholdNumScans; + if (hidl_scan_params.buckets.size() > MAX_BUCKETS) { + return false; + } + legacy_scan_params->num_buckets = hidl_scan_params.buckets.size(); + for (uint32_t bucket_idx = 0; bucket_idx < hidl_scan_params.buckets.size(); bucket_idx++) { + const StaBackgroundScanBucketParameters& hidl_bucket_spec = + hidl_scan_params.buckets[bucket_idx]; + legacy_hal::wifi_scan_bucket_spec& legacy_bucket_spec = + legacy_scan_params->buckets[bucket_idx]; + if (hidl_bucket_spec.bucketIdx >= MAX_BUCKETS) { + return false; + } + legacy_bucket_spec.bucket = hidl_bucket_spec.bucketIdx; + legacy_bucket_spec.band = convertHidlWifiBandToLegacy(hidl_bucket_spec.band); + legacy_bucket_spec.period = hidl_bucket_spec.periodInMs; + legacy_bucket_spec.max_period = hidl_bucket_spec.exponentialMaxPeriodInMs; + legacy_bucket_spec.base = hidl_bucket_spec.exponentialBase; + legacy_bucket_spec.step_count = hidl_bucket_spec.exponentialStepCount; + legacy_bucket_spec.report_events = 0; + using HidlFlag = StaBackgroundScanBucketEventReportSchemeMask; + for (const auto flag : {HidlFlag::EACH_SCAN, HidlFlag::FULL_RESULTS, HidlFlag::NO_BATCH}) { + if (hidl_bucket_spec.eventReportScheme & + static_cast::type>(flag)) { + legacy_bucket_spec.report_events |= convertHidlGscanReportEventFlagToLegacy(flag); + } + } + if (hidl_bucket_spec.frequencies.size() > MAX_CHANNELS) { + return false; + } + legacy_bucket_spec.num_channels = hidl_bucket_spec.frequencies.size(); + for (uint32_t freq_idx = 0; freq_idx < hidl_bucket_spec.frequencies.size(); freq_idx++) { + legacy_bucket_spec.channels[freq_idx].channel = hidl_bucket_spec.frequencies[freq_idx]; + } + } + return true; +} + +bool convertLegacyIeToHidl(const legacy_hal::wifi_information_element& legacy_ie, + WifiInformationElement* hidl_ie) { + if (!hidl_ie) { + return false; + } + *hidl_ie = {}; + hidl_ie->id = legacy_ie.id; + hidl_ie->data = std::vector(legacy_ie.data, legacy_ie.data + legacy_ie.len); + return true; +} + +bool convertLegacyIeBlobToHidl(const uint8_t* ie_blob, uint32_t ie_blob_len, + std::vector* hidl_ies) { + if (!ie_blob || !hidl_ies) { + return false; + } + *hidl_ies = {}; + const uint8_t* ies_begin = ie_blob; + const uint8_t* ies_end = ie_blob + ie_blob_len; + const uint8_t* next_ie = ies_begin; + using wifi_ie = legacy_hal::wifi_information_element; + constexpr size_t kIeHeaderLen = sizeof(wifi_ie); + // Each IE should atleast have the header (i.e |id| & |len| fields). + while (next_ie + kIeHeaderLen <= ies_end) { + const wifi_ie& legacy_ie = (*reinterpret_cast(next_ie)); + uint32_t curr_ie_len = kIeHeaderLen + legacy_ie.len; + if (next_ie + curr_ie_len > ies_end) { + LOG(ERROR) << "Error parsing IE blob. Next IE: " << (void*)next_ie + << ", Curr IE len: " << curr_ie_len << ", IEs End: " << (void*)ies_end; + break; + } + WifiInformationElement hidl_ie; + if (!convertLegacyIeToHidl(legacy_ie, &hidl_ie)) { + LOG(ERROR) << "Error converting IE. Id: " << legacy_ie.id << ", len: " << legacy_ie.len; + break; + } + hidl_ies->push_back(std::move(hidl_ie)); + next_ie += curr_ie_len; + } + // Check if the blob has been fully consumed. + if (next_ie != ies_end) { + LOG(ERROR) << "Failed to fully parse IE blob. Next IE: " << (void*)next_ie + << ", IEs End: " << (void*)ies_end; + } + return true; +} + +bool convertLegacyGscanResultToHidl(const legacy_hal::wifi_scan_result& legacy_scan_result, + bool has_ie_data, StaScanResult* hidl_scan_result) { + if (!hidl_scan_result) { + return false; + } + *hidl_scan_result = {}; + hidl_scan_result->timeStampInUs = legacy_scan_result.ts; + hidl_scan_result->ssid = std::vector( + legacy_scan_result.ssid, + legacy_scan_result.ssid + + strnlen(legacy_scan_result.ssid, sizeof(legacy_scan_result.ssid) - 1)); + memcpy(hidl_scan_result->bssid.data(), legacy_scan_result.bssid, + hidl_scan_result->bssid.size()); + hidl_scan_result->frequency = legacy_scan_result.channel; + hidl_scan_result->rssi = legacy_scan_result.rssi; + hidl_scan_result->beaconPeriodInMs = legacy_scan_result.beacon_period; + hidl_scan_result->capability = legacy_scan_result.capability; + if (has_ie_data) { + std::vector ies; + if (!convertLegacyIeBlobToHidl(reinterpret_cast(legacy_scan_result.ie_data), + legacy_scan_result.ie_length, &ies)) { + return false; + } + hidl_scan_result->informationElements = std::move(ies); + } + return true; +} + +bool convertLegacyCachedGscanResultsToHidl( + const legacy_hal::wifi_cached_scan_results& legacy_cached_scan_result, + StaScanData* hidl_scan_data) { + if (!hidl_scan_data) { + return false; + } + *hidl_scan_data = {}; + hidl_scan_data->flags = 0; + for (const auto flag : {legacy_hal::WIFI_SCAN_FLAG_INTERRUPTED}) { + if (legacy_cached_scan_result.flags & flag) { + hidl_scan_data->flags |= static_cast::type>( + convertLegacyGscanDataFlagToHidl(flag)); + } + } + hidl_scan_data->bucketsScanned = legacy_cached_scan_result.buckets_scanned; + + CHECK(legacy_cached_scan_result.num_results >= 0 && + legacy_cached_scan_result.num_results <= MAX_AP_CACHE_PER_SCAN); + std::vector hidl_scan_results; + for (int32_t result_idx = 0; result_idx < legacy_cached_scan_result.num_results; result_idx++) { + StaScanResult hidl_scan_result; + if (!convertLegacyGscanResultToHidl(legacy_cached_scan_result.results[result_idx], false, + &hidl_scan_result)) { + return false; + } + hidl_scan_results.push_back(hidl_scan_result); + } + hidl_scan_data->results = std::move(hidl_scan_results); + return true; +} + +bool convertLegacyVectorOfCachedGscanResultsToHidl( + const std::vector& legacy_cached_scan_results, + std::vector* hidl_scan_datas) { + if (!hidl_scan_datas) { + return false; + } + *hidl_scan_datas = {}; + for (const auto& legacy_cached_scan_result : legacy_cached_scan_results) { + StaScanData hidl_scan_data; + if (!convertLegacyCachedGscanResultsToHidl(legacy_cached_scan_result, &hidl_scan_data)) { + return false; + } + hidl_scan_datas->push_back(hidl_scan_data); + } + return true; +} + +WifiDebugTxPacketFate convertLegacyDebugTxPacketFateToHidl(legacy_hal::wifi_tx_packet_fate fate) { + switch (fate) { + case legacy_hal::TX_PKT_FATE_ACKED: + return WifiDebugTxPacketFate::ACKED; + case legacy_hal::TX_PKT_FATE_SENT: + return WifiDebugTxPacketFate::SENT; + case legacy_hal::TX_PKT_FATE_FW_QUEUED: + return WifiDebugTxPacketFate::FW_QUEUED; + case legacy_hal::TX_PKT_FATE_FW_DROP_INVALID: + return WifiDebugTxPacketFate::FW_DROP_INVALID; + case legacy_hal::TX_PKT_FATE_FW_DROP_NOBUFS: + return WifiDebugTxPacketFate::FW_DROP_NOBUFS; + case legacy_hal::TX_PKT_FATE_FW_DROP_OTHER: + return WifiDebugTxPacketFate::FW_DROP_OTHER; + case legacy_hal::TX_PKT_FATE_DRV_QUEUED: + return WifiDebugTxPacketFate::DRV_QUEUED; + case legacy_hal::TX_PKT_FATE_DRV_DROP_INVALID: + return WifiDebugTxPacketFate::DRV_DROP_INVALID; + case legacy_hal::TX_PKT_FATE_DRV_DROP_NOBUFS: + return WifiDebugTxPacketFate::DRV_DROP_NOBUFS; + case legacy_hal::TX_PKT_FATE_DRV_DROP_OTHER: + return WifiDebugTxPacketFate::DRV_DROP_OTHER; + }; + CHECK(false) << "Unknown legacy fate type: " << fate; +} + +WifiDebugRxPacketFate convertLegacyDebugRxPacketFateToHidl(legacy_hal::wifi_rx_packet_fate fate) { + switch (fate) { + case legacy_hal::RX_PKT_FATE_SUCCESS: + return WifiDebugRxPacketFate::SUCCESS; + case legacy_hal::RX_PKT_FATE_FW_QUEUED: + return WifiDebugRxPacketFate::FW_QUEUED; + case legacy_hal::RX_PKT_FATE_FW_DROP_FILTER: + return WifiDebugRxPacketFate::FW_DROP_FILTER; + case legacy_hal::RX_PKT_FATE_FW_DROP_INVALID: + return WifiDebugRxPacketFate::FW_DROP_INVALID; + case legacy_hal::RX_PKT_FATE_FW_DROP_NOBUFS: + return WifiDebugRxPacketFate::FW_DROP_NOBUFS; + case legacy_hal::RX_PKT_FATE_FW_DROP_OTHER: + return WifiDebugRxPacketFate::FW_DROP_OTHER; + case legacy_hal::RX_PKT_FATE_DRV_QUEUED: + return WifiDebugRxPacketFate::DRV_QUEUED; + case legacy_hal::RX_PKT_FATE_DRV_DROP_FILTER: + return WifiDebugRxPacketFate::DRV_DROP_FILTER; + case legacy_hal::RX_PKT_FATE_DRV_DROP_INVALID: + return WifiDebugRxPacketFate::DRV_DROP_INVALID; + case legacy_hal::RX_PKT_FATE_DRV_DROP_NOBUFS: + return WifiDebugRxPacketFate::DRV_DROP_NOBUFS; + case legacy_hal::RX_PKT_FATE_DRV_DROP_OTHER: + return WifiDebugRxPacketFate::DRV_DROP_OTHER; + }; + CHECK(false) << "Unknown legacy fate type: " << fate; +} + +WifiDebugPacketFateFrameType convertLegacyDebugPacketFateFrameTypeToHidl( + legacy_hal::frame_type type) { + switch (type) { + case legacy_hal::FRAME_TYPE_UNKNOWN: + return WifiDebugPacketFateFrameType::UNKNOWN; + case legacy_hal::FRAME_TYPE_ETHERNET_II: + return WifiDebugPacketFateFrameType::ETHERNET_II; + case legacy_hal::FRAME_TYPE_80211_MGMT: + return WifiDebugPacketFateFrameType::MGMT_80211; + }; + CHECK(false) << "Unknown legacy frame type: " << type; +} + +bool convertLegacyDebugPacketFateFrameToHidl(const legacy_hal::frame_info& legacy_frame, + WifiDebugPacketFateFrameInfo* hidl_frame) { + if (!hidl_frame) { + return false; + } + *hidl_frame = {}; + hidl_frame->frameType = convertLegacyDebugPacketFateFrameTypeToHidl(legacy_frame.payload_type); + hidl_frame->frameLen = legacy_frame.frame_len; + hidl_frame->driverTimestampUsec = legacy_frame.driver_timestamp_usec; + hidl_frame->firmwareTimestampUsec = legacy_frame.firmware_timestamp_usec; + const uint8_t* frame_begin = + reinterpret_cast(legacy_frame.frame_content.ethernet_ii_bytes); + hidl_frame->frameContent = + std::vector(frame_begin, frame_begin + legacy_frame.frame_len); + return true; +} + +bool convertLegacyDebugTxPacketFateToHidl(const legacy_hal::wifi_tx_report& legacy_fate, + WifiDebugTxPacketFateReport* hidl_fate) { + if (!hidl_fate) { + return false; + } + *hidl_fate = {}; + hidl_fate->fate = convertLegacyDebugTxPacketFateToHidl(legacy_fate.fate); + return convertLegacyDebugPacketFateFrameToHidl(legacy_fate.frame_inf, &hidl_fate->frameInfo); +} + +bool convertLegacyVectorOfDebugTxPacketFateToHidl( + const std::vector& legacy_fates, + std::vector* hidl_fates) { + if (!hidl_fates) { + return false; + } + *hidl_fates = {}; + for (const auto& legacy_fate : legacy_fates) { + WifiDebugTxPacketFateReport hidl_fate; + if (!convertLegacyDebugTxPacketFateToHidl(legacy_fate, &hidl_fate)) { + return false; + } + hidl_fates->push_back(hidl_fate); + } + return true; +} + +bool convertLegacyDebugRxPacketFateToHidl(const legacy_hal::wifi_rx_report& legacy_fate, + WifiDebugRxPacketFateReport* hidl_fate) { + if (!hidl_fate) { + return false; + } + *hidl_fate = {}; + hidl_fate->fate = convertLegacyDebugRxPacketFateToHidl(legacy_fate.fate); + return convertLegacyDebugPacketFateFrameToHidl(legacy_fate.frame_inf, &hidl_fate->frameInfo); +} + +bool convertLegacyVectorOfDebugRxPacketFateToHidl( + const std::vector& legacy_fates, + std::vector* hidl_fates) { + if (!hidl_fates) { + return false; + } + *hidl_fates = {}; + for (const auto& legacy_fate : legacy_fates) { + WifiDebugRxPacketFateReport hidl_fate; + if (!convertLegacyDebugRxPacketFateToHidl(legacy_fate, &hidl_fate)) { + return false; + } + hidl_fates->push_back(hidl_fate); + } + return true; +} + +bool convertLegacyLinkLayerRadioStatsToHidl( + const legacy_hal::LinkLayerRadioStats& legacy_radio_stat, + V1_6::StaLinkLayerRadioStats* hidl_radio_stat) { + if (!hidl_radio_stat) { + return false; + } + *hidl_radio_stat = {}; + + hidl_radio_stat->radioId = legacy_radio_stat.stats.radio; + hidl_radio_stat->V1_0.onTimeInMs = legacy_radio_stat.stats.on_time; + hidl_radio_stat->V1_0.txTimeInMs = legacy_radio_stat.stats.tx_time; + hidl_radio_stat->V1_0.rxTimeInMs = legacy_radio_stat.stats.rx_time; + hidl_radio_stat->V1_0.onTimeInMsForScan = legacy_radio_stat.stats.on_time_scan; + hidl_radio_stat->V1_0.txTimeInMsPerLevel = legacy_radio_stat.tx_time_per_levels; + hidl_radio_stat->onTimeInMsForNanScan = legacy_radio_stat.stats.on_time_nbd; + hidl_radio_stat->onTimeInMsForBgScan = legacy_radio_stat.stats.on_time_gscan; + hidl_radio_stat->onTimeInMsForRoamScan = legacy_radio_stat.stats.on_time_roam_scan; + hidl_radio_stat->onTimeInMsForPnoScan = legacy_radio_stat.stats.on_time_pno_scan; + hidl_radio_stat->onTimeInMsForHs20Scan = legacy_radio_stat.stats.on_time_hs20; + + std::vector hidl_channel_stats; + + for (const auto& channel_stat : legacy_radio_stat.channel_stats) { + V1_6::WifiChannelStats hidl_channel_stat; + hidl_channel_stat.onTimeInMs = channel_stat.on_time; + hidl_channel_stat.ccaBusyTimeInMs = channel_stat.cca_busy_time; + /* + * TODO once b/119142899 is fixed, + * replace below code with convertLegacyWifiChannelInfoToHidl() + */ + hidl_channel_stat.channel.width = WifiChannelWidthInMhz::WIDTH_20; + hidl_channel_stat.channel.centerFreq = channel_stat.channel.center_freq; + hidl_channel_stat.channel.centerFreq0 = channel_stat.channel.center_freq0; + hidl_channel_stat.channel.centerFreq1 = channel_stat.channel.center_freq1; + hidl_channel_stats.push_back(hidl_channel_stat); + } + + hidl_radio_stat->channelStats = hidl_channel_stats; + + return true; +} + +bool convertLegacyLinkLayerStatsToHidl(const legacy_hal::LinkLayerStats& legacy_stats, + V1_6::StaLinkLayerStats* hidl_stats) { + if (!hidl_stats) { + return false; + } + *hidl_stats = {}; + // iface legacy_stats conversion. + hidl_stats->iface.V1_0.beaconRx = legacy_stats.iface.beacon_rx; + hidl_stats->iface.V1_0.avgRssiMgmt = legacy_stats.iface.rssi_mgmt; + hidl_stats->iface.V1_0.wmeBePktStats.rxMpdu = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].rx_mpdu; + hidl_stats->iface.V1_0.wmeBePktStats.txMpdu = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].tx_mpdu; + hidl_stats->iface.V1_0.wmeBePktStats.lostMpdu = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].mpdu_lost; + hidl_stats->iface.V1_0.wmeBePktStats.retries = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].retries; + hidl_stats->iface.wmeBeContentionTimeStats.contentionTimeMinInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_min; + hidl_stats->iface.wmeBeContentionTimeStats.contentionTimeMaxInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_max; + hidl_stats->iface.wmeBeContentionTimeStats.contentionTimeAvgInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_avg; + hidl_stats->iface.wmeBeContentionTimeStats.contentionNumSamples = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_num_samples; + hidl_stats->iface.V1_0.wmeBkPktStats.rxMpdu = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].rx_mpdu; + hidl_stats->iface.V1_0.wmeBkPktStats.txMpdu = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].tx_mpdu; + hidl_stats->iface.V1_0.wmeBkPktStats.lostMpdu = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].mpdu_lost; + hidl_stats->iface.V1_0.wmeBkPktStats.retries = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].retries; + hidl_stats->iface.wmeBkContentionTimeStats.contentionTimeMinInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_min; + hidl_stats->iface.wmeBkContentionTimeStats.contentionTimeMaxInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_max; + hidl_stats->iface.wmeBkContentionTimeStats.contentionTimeAvgInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_avg; + hidl_stats->iface.wmeBkContentionTimeStats.contentionNumSamples = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_num_samples; + hidl_stats->iface.V1_0.wmeViPktStats.rxMpdu = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].rx_mpdu; + hidl_stats->iface.V1_0.wmeViPktStats.txMpdu = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].tx_mpdu; + hidl_stats->iface.V1_0.wmeViPktStats.lostMpdu = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].mpdu_lost; + hidl_stats->iface.V1_0.wmeViPktStats.retries = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].retries; + hidl_stats->iface.wmeViContentionTimeStats.contentionTimeMinInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_min; + hidl_stats->iface.wmeViContentionTimeStats.contentionTimeMaxInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_max; + hidl_stats->iface.wmeViContentionTimeStats.contentionTimeAvgInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_avg; + hidl_stats->iface.wmeViContentionTimeStats.contentionNumSamples = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_num_samples; + hidl_stats->iface.V1_0.wmeVoPktStats.rxMpdu = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].rx_mpdu; + hidl_stats->iface.V1_0.wmeVoPktStats.txMpdu = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].tx_mpdu; + hidl_stats->iface.V1_0.wmeVoPktStats.lostMpdu = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].mpdu_lost; + hidl_stats->iface.V1_0.wmeVoPktStats.retries = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].retries; + hidl_stats->iface.wmeVoContentionTimeStats.contentionTimeMinInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_min; + hidl_stats->iface.wmeVoContentionTimeStats.contentionTimeMaxInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_max; + hidl_stats->iface.wmeVoContentionTimeStats.contentionTimeAvgInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_avg; + hidl_stats->iface.wmeVoContentionTimeStats.contentionNumSamples = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_num_samples; + hidl_stats->iface.timeSliceDutyCycleInPercent = + legacy_stats.iface.info.time_slicing_duty_cycle_percent; + // peer info legacy_stats conversion. + std::vector hidl_peers_info_stats; + for (const auto& legacy_peer_info_stats : legacy_stats.peers) { + V1_6::StaPeerInfo hidl_peer_info_stats; + if (!convertLegacyPeerInfoStatsToHidl(legacy_peer_info_stats, &hidl_peer_info_stats)) { + return false; + } + hidl_peers_info_stats.push_back(hidl_peer_info_stats); + } + hidl_stats->iface.peers = hidl_peers_info_stats; + // radio legacy_stats conversion. + std::vector hidl_radios_stats; + for (const auto& legacy_radio_stats : legacy_stats.radios) { + V1_6::StaLinkLayerRadioStats hidl_radio_stats; + if (!convertLegacyLinkLayerRadioStatsToHidl(legacy_radio_stats, &hidl_radio_stats)) { + return false; + } + hidl_radios_stats.push_back(hidl_radio_stats); + } + hidl_stats->radios = hidl_radios_stats; + // Timestamp in the HAL wrapper here since it's not provided in the legacy + // HAL API. + hidl_stats->timeStampInMs = uptimeMillis(); + return true; +} + +bool convertLegacyPeerInfoStatsToHidl(const legacy_hal::WifiPeerInfo& legacy_peer_info_stats, + V1_6::StaPeerInfo* hidl_peer_info_stats) { + if (!hidl_peer_info_stats) { + return false; + } + *hidl_peer_info_stats = {}; + hidl_peer_info_stats->staCount = legacy_peer_info_stats.peer_info.bssload.sta_count; + hidl_peer_info_stats->chanUtil = legacy_peer_info_stats.peer_info.bssload.chan_util; + + std::vector hidlRateStats; + for (const auto& legacy_rate_stats : legacy_peer_info_stats.rate_stats) { + V1_6::StaRateStat rateStat; + if (!convertLegacyWifiRateInfoToHidl(legacy_rate_stats.rate, &rateStat.rateInfo)) { + return false; + } + rateStat.txMpdu = legacy_rate_stats.tx_mpdu; + rateStat.rxMpdu = legacy_rate_stats.rx_mpdu; + rateStat.mpduLost = legacy_rate_stats.mpdu_lost; + rateStat.retries = legacy_rate_stats.retries; + hidlRateStats.push_back(rateStat); + } + hidl_peer_info_stats->rateStats = hidlRateStats; + return true; +} + +bool convertLegacyRoamingCapabilitiesToHidl( + const legacy_hal::wifi_roaming_capabilities& legacy_caps, + StaRoamingCapabilities* hidl_caps) { + if (!hidl_caps) { + return false; + } + *hidl_caps = {}; + hidl_caps->maxBlacklistSize = legacy_caps.max_blacklist_size; + hidl_caps->maxWhitelistSize = legacy_caps.max_whitelist_size; + return true; +} + +bool convertHidlRoamingConfigToLegacy(const StaRoamingConfig& hidl_config, + legacy_hal::wifi_roaming_config* legacy_config) { + if (!legacy_config) { + return false; + } + *legacy_config = {}; + if (hidl_config.bssidBlacklist.size() > MAX_BLACKLIST_BSSID || + hidl_config.ssidWhitelist.size() > MAX_WHITELIST_SSID) { + return false; + } + legacy_config->num_blacklist_bssid = hidl_config.bssidBlacklist.size(); + uint32_t i = 0; + for (const auto& bssid : hidl_config.bssidBlacklist) { + CHECK(bssid.size() == sizeof(legacy_hal::mac_addr)); + memcpy(legacy_config->blacklist_bssid[i++], bssid.data(), bssid.size()); + } + legacy_config->num_whitelist_ssid = hidl_config.ssidWhitelist.size(); + i = 0; + for (const auto& ssid : hidl_config.ssidWhitelist) { + CHECK(ssid.size() <= sizeof(legacy_hal::ssid_t::ssid_str)); + legacy_config->whitelist_ssid[i].length = ssid.size(); + memcpy(legacy_config->whitelist_ssid[i].ssid_str, ssid.data(), ssid.size()); + i++; + } + return true; +} + +legacy_hal::fw_roaming_state_t convertHidlRoamingStateToLegacy(StaRoamingState state) { + switch (state) { + case StaRoamingState::ENABLED: + return legacy_hal::ROAMING_ENABLE; + case StaRoamingState::DISABLED: + return legacy_hal::ROAMING_DISABLE; + }; + CHECK(false); +} + +legacy_hal::NanMatchAlg convertHidlNanMatchAlgToLegacy(NanMatchAlg type) { + switch (type) { + case NanMatchAlg::MATCH_ONCE: + return legacy_hal::NAN_MATCH_ALG_MATCH_ONCE; + case NanMatchAlg::MATCH_CONTINUOUS: + return legacy_hal::NAN_MATCH_ALG_MATCH_CONTINUOUS; + case NanMatchAlg::MATCH_NEVER: + return legacy_hal::NAN_MATCH_ALG_MATCH_NEVER; + } + CHECK(false); +} + +legacy_hal::NanPublishType convertHidlNanPublishTypeToLegacy(NanPublishType type) { + switch (type) { + case NanPublishType::UNSOLICITED: + return legacy_hal::NAN_PUBLISH_TYPE_UNSOLICITED; + case NanPublishType::SOLICITED: + return legacy_hal::NAN_PUBLISH_TYPE_SOLICITED; + case NanPublishType::UNSOLICITED_SOLICITED: + return legacy_hal::NAN_PUBLISH_TYPE_UNSOLICITED_SOLICITED; + } + CHECK(false); +} + +legacy_hal::NanTxType convertHidlNanTxTypeToLegacy(NanTxType type) { + switch (type) { + case NanTxType::BROADCAST: + return legacy_hal::NAN_TX_TYPE_BROADCAST; + case NanTxType::UNICAST: + return legacy_hal::NAN_TX_TYPE_UNICAST; + } + CHECK(false); +} + +legacy_hal::NanSubscribeType convertHidlNanSubscribeTypeToLegacy(NanSubscribeType type) { + switch (type) { + case NanSubscribeType::PASSIVE: + return legacy_hal::NAN_SUBSCRIBE_TYPE_PASSIVE; + case NanSubscribeType::ACTIVE: + return legacy_hal::NAN_SUBSCRIBE_TYPE_ACTIVE; + } + CHECK(false); +} + +legacy_hal::NanSRFType convertHidlNanSrfTypeToLegacy(NanSrfType type) { + switch (type) { + case NanSrfType::BLOOM_FILTER: + return legacy_hal::NAN_SRF_ATTR_BLOOM_FILTER; + case NanSrfType::PARTIAL_MAC_ADDR: + return legacy_hal::NAN_SRF_ATTR_PARTIAL_MAC_ADDR; + } + CHECK(false); +} + +legacy_hal::NanDataPathChannelCfg convertHidlNanDataPathChannelCfgToLegacy( + NanDataPathChannelCfg type) { + switch (type) { + case NanDataPathChannelCfg::CHANNEL_NOT_REQUESTED: + return legacy_hal::NAN_DP_CHANNEL_NOT_REQUESTED; + case NanDataPathChannelCfg::REQUEST_CHANNEL_SETUP: + return legacy_hal::NAN_DP_REQUEST_CHANNEL_SETUP; + case NanDataPathChannelCfg::FORCE_CHANNEL_SETUP: + return legacy_hal::NAN_DP_FORCE_CHANNEL_SETUP; + } + CHECK(false); +} + +NanStatusType convertLegacyNanStatusTypeToHidl(legacy_hal::NanStatusType type) { + switch (type) { + case legacy_hal::NAN_STATUS_SUCCESS: + return NanStatusType::SUCCESS; + case legacy_hal::NAN_STATUS_INTERNAL_FAILURE: + return NanStatusType::INTERNAL_FAILURE; + case legacy_hal::NAN_STATUS_PROTOCOL_FAILURE: + return NanStatusType::PROTOCOL_FAILURE; + case legacy_hal::NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID: + return NanStatusType::INVALID_SESSION_ID; + case legacy_hal::NAN_STATUS_NO_RESOURCE_AVAILABLE: + return NanStatusType::NO_RESOURCES_AVAILABLE; + case legacy_hal::NAN_STATUS_INVALID_PARAM: + return NanStatusType::INVALID_ARGS; + case legacy_hal::NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID: + return NanStatusType::INVALID_PEER_ID; + case legacy_hal::NAN_STATUS_INVALID_NDP_ID: + return NanStatusType::INVALID_NDP_ID; + case legacy_hal::NAN_STATUS_NAN_NOT_ALLOWED: + return NanStatusType::NAN_NOT_ALLOWED; + case legacy_hal::NAN_STATUS_NO_OTA_ACK: + return NanStatusType::NO_OTA_ACK; + case legacy_hal::NAN_STATUS_ALREADY_ENABLED: + return NanStatusType::ALREADY_ENABLED; + case legacy_hal::NAN_STATUS_FOLLOWUP_QUEUE_FULL: + return NanStatusType::FOLLOWUP_TX_QUEUE_FULL; + case legacy_hal::NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED: + return NanStatusType::UNSUPPORTED_CONCURRENCY_NAN_DISABLED; + } + CHECK(false); +} + +void convertToWifiNanStatus(legacy_hal::NanStatusType type, const char* str, size_t max_len, + WifiNanStatus* wifiNanStatus) { + wifiNanStatus->status = convertLegacyNanStatusTypeToHidl(type); + wifiNanStatus->description = safeConvertChar(str, max_len); +} + +bool convertHidlNanEnableRequestToLegacy(const V1_4::NanEnableRequest& hidl_request, + legacy_hal::NanEnableRequest* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertHidlNanEnableRequestToLegacy: null legacy_request"; + return false; + } + *legacy_request = {}; + + legacy_request->config_2dot4g_support = 1; + legacy_request->support_2dot4g_val = + hidl_request.operateInBand[(size_t)NanBandIndex::NAN_BAND_24GHZ]; + legacy_request->config_support_5g = 1; + legacy_request->support_5g_val = + hidl_request.operateInBand[(size_t)NanBandIndex::NAN_BAND_5GHZ]; + legacy_request->config_hop_count_limit = 1; + legacy_request->hop_count_limit_val = hidl_request.hopCountMax; + legacy_request->master_pref = hidl_request.configParams.masterPref; + legacy_request->discovery_indication_cfg = 0; + legacy_request->discovery_indication_cfg |= + hidl_request.configParams.disableDiscoveryAddressChangeIndication ? 0x1 : 0x0; + legacy_request->discovery_indication_cfg |= + hidl_request.configParams.disableStartedClusterIndication ? 0x2 : 0x0; + legacy_request->discovery_indication_cfg |= + hidl_request.configParams.disableJoinedClusterIndication ? 0x4 : 0x0; + legacy_request->config_sid_beacon = 1; + if (hidl_request.configParams.numberOfPublishServiceIdsInBeacon > 127) { + LOG(ERROR) << "convertHidlNanEnableRequestToLegacy: " + "numberOfPublishServiceIdsInBeacon > 127"; + return false; + } + legacy_request->sid_beacon_val = + (hidl_request.configParams.includePublishServiceIdsInBeacon ? 0x1 : 0x0) | + (hidl_request.configParams.numberOfPublishServiceIdsInBeacon << 1); + legacy_request->config_subscribe_sid_beacon = 1; + if (hidl_request.configParams.numberOfSubscribeServiceIdsInBeacon > 127) { + LOG(ERROR) << "convertHidlNanEnableRequestToLegacy: " + "numberOfSubscribeServiceIdsInBeacon > 127"; + return false; + } + legacy_request->subscribe_sid_beacon_val = + (hidl_request.configParams.includeSubscribeServiceIdsInBeacon ? 0x1 : 0x0) | + (hidl_request.configParams.numberOfSubscribeServiceIdsInBeacon << 1); + legacy_request->config_rssi_window_size = 1; + legacy_request->rssi_window_size_val = hidl_request.configParams.rssiWindowSize; + legacy_request->config_disc_mac_addr_randomization = 1; + legacy_request->disc_mac_addr_rand_interval_sec = + hidl_request.configParams.macAddressRandomizationIntervalSec; + legacy_request->config_2dot4g_rssi_close = 1; + if (hidl_request.configParams.bandSpecificConfig.size() != 3) { + LOG(ERROR) << "convertHidlNanEnableRequestToLegacy: " + "bandSpecificConfig.size() != 3"; + return false; + } + legacy_request->rssi_close_2dot4g_val = + hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .rssiClose; + legacy_request->config_2dot4g_rssi_middle = 1; + legacy_request->rssi_middle_2dot4g_val = + hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .rssiMiddle; + legacy_request->config_2dot4g_rssi_proximity = 1; + legacy_request->rssi_proximity_2dot4g_val = + hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .rssiCloseProximity; + legacy_request->config_scan_params = 1; + legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_24G_BAND] = + hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .dwellTimeMs; + legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_24G_BAND] = + hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .scanPeriodSec; + legacy_request->config_dw.config_2dot4g_dw_band = + hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .validDiscoveryWindowIntervalVal; + legacy_request->config_dw.dw_2dot4g_interval_val = + hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .discoveryWindowIntervalVal; + legacy_request->config_5g_rssi_close = 1; + legacy_request->rssi_close_5g_val = + hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .rssiClose; + legacy_request->config_5g_rssi_middle = 1; + legacy_request->rssi_middle_5g_val = + hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .rssiMiddle; + legacy_request->config_5g_rssi_close_proximity = 1; + legacy_request->rssi_close_proximity_5g_val = + hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .rssiCloseProximity; + legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = + hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .dwellTimeMs; + legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = + hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .scanPeriodSec; + legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = + hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .dwellTimeMs; + legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = + hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .scanPeriodSec; + legacy_request->config_dw.config_5g_dw_band = + hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .validDiscoveryWindowIntervalVal; + legacy_request->config_dw.dw_5g_interval_val = + hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .discoveryWindowIntervalVal; + if (hidl_request.debugConfigs.validClusterIdVals) { + legacy_request->cluster_low = hidl_request.debugConfigs.clusterIdBottomRangeVal; + legacy_request->cluster_high = hidl_request.debugConfigs.clusterIdTopRangeVal; + } else { // need 'else' since not configurable in legacy HAL + legacy_request->cluster_low = 0x0000; + legacy_request->cluster_high = 0xFFFF; + } + legacy_request->config_intf_addr = hidl_request.debugConfigs.validIntfAddrVal; + memcpy(legacy_request->intf_addr_val, hidl_request.debugConfigs.intfAddrVal.data(), 6); + legacy_request->config_oui = hidl_request.debugConfigs.validOuiVal; + legacy_request->oui_val = hidl_request.debugConfigs.ouiVal; + legacy_request->config_random_factor_force = + hidl_request.debugConfigs.validRandomFactorForceVal; + legacy_request->random_factor_force_val = hidl_request.debugConfigs.randomFactorForceVal; + legacy_request->config_hop_count_force = hidl_request.debugConfigs.validHopCountForceVal; + legacy_request->hop_count_force_val = hidl_request.debugConfigs.hopCountForceVal; + legacy_request->config_24g_channel = hidl_request.debugConfigs.validDiscoveryChannelVal; + legacy_request->channel_24g_val = + hidl_request.debugConfigs.discoveryChannelMhzVal[(size_t)NanBandIndex::NAN_BAND_24GHZ]; + legacy_request->config_5g_channel = hidl_request.debugConfigs.validDiscoveryChannelVal; + legacy_request->channel_5g_val = + hidl_request.debugConfigs.discoveryChannelMhzVal[(size_t)NanBandIndex::NAN_BAND_5GHZ]; + legacy_request->config_2dot4g_beacons = hidl_request.debugConfigs.validUseBeaconsInBandVal; + legacy_request->beacon_2dot4g_val = + hidl_request.debugConfigs.useBeaconsInBandVal[(size_t)NanBandIndex::NAN_BAND_24GHZ]; + legacy_request->config_5g_beacons = hidl_request.debugConfigs.validUseBeaconsInBandVal; + legacy_request->beacon_5g_val = + hidl_request.debugConfigs.useBeaconsInBandVal[(size_t)NanBandIndex::NAN_BAND_5GHZ]; + legacy_request->config_2dot4g_sdf = hidl_request.debugConfigs.validUseSdfInBandVal; + legacy_request->sdf_2dot4g_val = + hidl_request.debugConfigs.useSdfInBandVal[(size_t)NanBandIndex::NAN_BAND_24GHZ]; + legacy_request->config_5g_sdf = hidl_request.debugConfigs.validUseSdfInBandVal; + legacy_request->sdf_5g_val = + hidl_request.debugConfigs.useSdfInBandVal[(size_t)NanBandIndex::NAN_BAND_5GHZ]; + + /* TODO: b/145609058 + * Missing updates needed to legacy_hal::NanEnableRequest and conversion to + * it for 6GHz band */ + + return true; +} + +bool convertHidlNanEnableRequest_1_6ToLegacy(const V1_4::NanEnableRequest& hidl_request1, + const NanConfigRequestSupplemental& hidl_request2, + legacy_hal::NanEnableRequest* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertHidlNanEnableRequest_1_6ToLegacy: null legacy_request"; + return false; + } + + *legacy_request = {}; + if (!convertHidlNanEnableRequestToLegacy(hidl_request1, legacy_request)) { + return false; + } + + legacy_request->config_discovery_beacon_int = 1; + legacy_request->discovery_beacon_interval = hidl_request2.V1_5.V1_2.discoveryBeaconIntervalMs; + legacy_request->config_nss = 1; + legacy_request->nss = hidl_request2.V1_5.V1_2.numberOfSpatialStreamsInDiscovery; + legacy_request->config_dw_early_termination = 1; + legacy_request->enable_dw_termination = + hidl_request2.V1_5.V1_2.enableDiscoveryWindowEarlyTermination; + legacy_request->config_enable_ranging = 1; + legacy_request->enable_ranging = hidl_request2.V1_5.V1_2.enableRanging; + + legacy_request->config_enable_instant_mode = 1; + legacy_request->enable_instant_mode = hidl_request2.V1_5.enableInstantCommunicationMode; + legacy_request->config_instant_mode_channel = 1; + legacy_request->instant_mode_channel = hidl_request2.instantModeChannel; + + return true; +} + +bool convertHidlNanConfigRequest_1_6ToLegacy(const V1_4::NanConfigRequest& hidl_request1, + const NanConfigRequestSupplemental& hidl_request2, + legacy_hal::NanConfigRequest* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertHidlNanConfigRequest_1_6ToLegacy: null legacy_request"; + return false; + } + + *legacy_request = {}; + if (!convertHidlNanConfigRequestToLegacy(hidl_request1, legacy_request)) { + return false; + } + + legacy_request->config_discovery_beacon_int = 1; + legacy_request->discovery_beacon_interval = hidl_request2.V1_5.V1_2.discoveryBeaconIntervalMs; + legacy_request->config_nss = 1; + legacy_request->nss = hidl_request2.V1_5.V1_2.numberOfSpatialStreamsInDiscovery; + legacy_request->config_dw_early_termination = 1; + legacy_request->enable_dw_termination = + hidl_request2.V1_5.V1_2.enableDiscoveryWindowEarlyTermination; + legacy_request->config_enable_ranging = 1; + legacy_request->enable_ranging = hidl_request2.V1_5.V1_2.enableRanging; + + legacy_request->config_enable_instant_mode = 1; + legacy_request->enable_instant_mode = hidl_request2.V1_5.enableInstantCommunicationMode; + legacy_request->config_instant_mode_channel = 1; + legacy_request->instant_mode_channel = hidl_request2.instantModeChannel; + + return true; +} + +bool convertHidlNanPublishRequestToLegacy(const V1_6::NanPublishRequest& hidl_request, + legacy_hal::NanPublishRequest* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: null legacy_request"; + return false; + } + *legacy_request = {}; + + legacy_request->publish_id = hidl_request.baseConfigs.sessionId; + legacy_request->ttl = hidl_request.baseConfigs.ttlSec; + legacy_request->period = hidl_request.baseConfigs.discoveryWindowPeriod; + legacy_request->publish_count = hidl_request.baseConfigs.discoveryCount; + legacy_request->service_name_len = hidl_request.baseConfigs.serviceName.size(); + if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { + LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: service_name_len " + "too large"; + return false; + } + memcpy(legacy_request->service_name, hidl_request.baseConfigs.serviceName.data(), + legacy_request->service_name_len); + legacy_request->publish_match_indicator = + convertHidlNanMatchAlgToLegacy(hidl_request.baseConfigs.discoveryMatchIndicator); + legacy_request->service_specific_info_len = hidl_request.baseConfigs.serviceSpecificInfo.size(); + if (legacy_request->service_specific_info_len > NAN_MAX_SERVICE_SPECIFIC_INFO_LEN) { + LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: " + "service_specific_info_len too large"; + return false; + } + memcpy(legacy_request->service_specific_info, + hidl_request.baseConfigs.serviceSpecificInfo.data(), + legacy_request->service_specific_info_len); + legacy_request->sdea_service_specific_info_len = + hidl_request.baseConfigs.extendedServiceSpecificInfo.size(); + if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) { + LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: " + "sdea_service_specific_info_len too large"; + return false; + } + memcpy(legacy_request->sdea_service_specific_info, + hidl_request.baseConfigs.extendedServiceSpecificInfo.data(), + legacy_request->sdea_service_specific_info_len); + legacy_request->rx_match_filter_len = hidl_request.baseConfigs.rxMatchFilter.size(); + if (legacy_request->rx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { + LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: " + "rx_match_filter_len too large"; + return false; + } + memcpy(legacy_request->rx_match_filter, hidl_request.baseConfigs.rxMatchFilter.data(), + legacy_request->rx_match_filter_len); + legacy_request->tx_match_filter_len = hidl_request.baseConfigs.txMatchFilter.size(); + if (legacy_request->tx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { + LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: " + "tx_match_filter_len too large"; + return false; + } + memcpy(legacy_request->tx_match_filter, hidl_request.baseConfigs.txMatchFilter.data(), + legacy_request->tx_match_filter_len); + legacy_request->rssi_threshold_flag = hidl_request.baseConfigs.useRssiThreshold; + legacy_request->recv_indication_cfg = 0; + legacy_request->recv_indication_cfg |= + hidl_request.baseConfigs.disableDiscoveryTerminationIndication ? 0x1 : 0x0; + legacy_request->recv_indication_cfg |= + hidl_request.baseConfigs.disableMatchExpirationIndication ? 0x2 : 0x0; + legacy_request->recv_indication_cfg |= + hidl_request.baseConfigs.disableFollowupReceivedIndication ? 0x4 : 0x0; + legacy_request->recv_indication_cfg |= 0x8; + legacy_request->cipher_type = (unsigned int)hidl_request.baseConfigs.securityConfig.cipherType; + + legacy_request->scid_len = hidl_request.baseConfigs.securityConfig.scid.size(); + if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) { + LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: scid_len too large"; + return false; + } + memcpy(legacy_request->scid, hidl_request.baseConfigs.securityConfig.scid.data(), + legacy_request->scid_len); + + if (hidl_request.baseConfigs.securityConfig.securityType == NanDataPathSecurityType::PMK) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; + legacy_request->key_info.body.pmk_info.pmk_len = + hidl_request.baseConfigs.securityConfig.pmk.size(); + if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { + LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: invalid pmk_len"; + return false; + } + memcpy(legacy_request->key_info.body.pmk_info.pmk, + hidl_request.baseConfigs.securityConfig.pmk.data(), + legacy_request->key_info.body.pmk_info.pmk_len); + } + if (hidl_request.baseConfigs.securityConfig.securityType == + NanDataPathSecurityType::PASSPHRASE) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; + legacy_request->key_info.body.passphrase_info.passphrase_len = + hidl_request.baseConfigs.securityConfig.passphrase.size(); + if (legacy_request->key_info.body.passphrase_info.passphrase_len < + NAN_SECURITY_MIN_PASSPHRASE_LEN) { + LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: " + "passphrase_len too small"; + return false; + } + if (legacy_request->key_info.body.passphrase_info.passphrase_len > + NAN_SECURITY_MAX_PASSPHRASE_LEN) { + LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: " + "passphrase_len too large"; + return false; + } + memcpy(legacy_request->key_info.body.passphrase_info.passphrase, + hidl_request.baseConfigs.securityConfig.passphrase.data(), + legacy_request->key_info.body.passphrase_info.passphrase_len); + } + legacy_request->sdea_params.security_cfg = + (hidl_request.baseConfigs.securityConfig.securityType != NanDataPathSecurityType::OPEN) + ? legacy_hal::NAN_DP_CONFIG_SECURITY + : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; + + legacy_request->sdea_params.ranging_state = hidl_request.baseConfigs.rangingRequired + ? legacy_hal::NAN_RANGING_ENABLE + : legacy_hal::NAN_RANGING_DISABLE; + legacy_request->ranging_cfg.ranging_interval_msec = + hidl_request.baseConfigs.rangingIntervalMsec; + legacy_request->ranging_cfg.config_ranging_indications = + hidl_request.baseConfigs.configRangingIndications; + legacy_request->ranging_cfg.distance_ingress_mm = + hidl_request.baseConfigs.distanceIngressCm * 10; + legacy_request->ranging_cfg.distance_egress_mm = hidl_request.baseConfigs.distanceEgressCm * 10; + legacy_request->ranging_auto_response = hidl_request.baseConfigs.rangingRequired + ? legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE + : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE; + legacy_request->sdea_params.range_report = legacy_hal::NAN_DISABLE_RANGE_REPORT; + legacy_request->publish_type = convertHidlNanPublishTypeToLegacy(hidl_request.publishType); + legacy_request->tx_type = convertHidlNanTxTypeToLegacy(hidl_request.txType); + legacy_request->service_responder_policy = hidl_request.autoAcceptDataPathRequests + ? legacy_hal::NAN_SERVICE_ACCEPT_POLICY_ALL + : legacy_hal::NAN_SERVICE_ACCEPT_POLICY_NONE; + + return true; +} + +bool convertHidlNanSubscribeRequestToLegacy(const V1_0::NanSubscribeRequest& hidl_request, + legacy_hal::NanSubscribeRequest* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: legacy_request is null"; + return false; + } + *legacy_request = {}; + + legacy_request->subscribe_id = hidl_request.baseConfigs.sessionId; + legacy_request->ttl = hidl_request.baseConfigs.ttlSec; + legacy_request->period = hidl_request.baseConfigs.discoveryWindowPeriod; + legacy_request->subscribe_count = hidl_request.baseConfigs.discoveryCount; + legacy_request->service_name_len = hidl_request.baseConfigs.serviceName.size(); + if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { + LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " + "service_name_len too large"; + return false; + } + memcpy(legacy_request->service_name, hidl_request.baseConfigs.serviceName.data(), + legacy_request->service_name_len); + legacy_request->subscribe_match_indicator = + convertHidlNanMatchAlgToLegacy(hidl_request.baseConfigs.discoveryMatchIndicator); + legacy_request->service_specific_info_len = hidl_request.baseConfigs.serviceSpecificInfo.size(); + if (legacy_request->service_specific_info_len > NAN_MAX_SERVICE_SPECIFIC_INFO_LEN) { + LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " + "service_specific_info_len too large"; + return false; + } + memcpy(legacy_request->service_specific_info, + hidl_request.baseConfigs.serviceSpecificInfo.data(), + legacy_request->service_specific_info_len); + legacy_request->sdea_service_specific_info_len = + hidl_request.baseConfigs.extendedServiceSpecificInfo.size(); + if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) { + LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " + "sdea_service_specific_info_len too large"; + return false; + } + memcpy(legacy_request->sdea_service_specific_info, + hidl_request.baseConfigs.extendedServiceSpecificInfo.data(), + legacy_request->sdea_service_specific_info_len); + legacy_request->rx_match_filter_len = hidl_request.baseConfigs.rxMatchFilter.size(); + if (legacy_request->rx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { + LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " + "rx_match_filter_len too large"; + return false; + } + memcpy(legacy_request->rx_match_filter, hidl_request.baseConfigs.rxMatchFilter.data(), + legacy_request->rx_match_filter_len); + legacy_request->tx_match_filter_len = hidl_request.baseConfigs.txMatchFilter.size(); + if (legacy_request->tx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { + LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " + "tx_match_filter_len too large"; + return false; + } + memcpy(legacy_request->tx_match_filter, hidl_request.baseConfigs.txMatchFilter.data(), + legacy_request->tx_match_filter_len); + legacy_request->rssi_threshold_flag = hidl_request.baseConfigs.useRssiThreshold; + legacy_request->recv_indication_cfg = 0; + legacy_request->recv_indication_cfg |= + hidl_request.baseConfigs.disableDiscoveryTerminationIndication ? 0x1 : 0x0; + legacy_request->recv_indication_cfg |= + hidl_request.baseConfigs.disableMatchExpirationIndication ? 0x2 : 0x0; + legacy_request->recv_indication_cfg |= + hidl_request.baseConfigs.disableFollowupReceivedIndication ? 0x4 : 0x0; + legacy_request->cipher_type = (unsigned int)hidl_request.baseConfigs.securityConfig.cipherType; + if (hidl_request.baseConfigs.securityConfig.securityType == NanDataPathSecurityType::PMK) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; + legacy_request->key_info.body.pmk_info.pmk_len = + hidl_request.baseConfigs.securityConfig.pmk.size(); + if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { + LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: invalid pmk_len"; + return false; + } + memcpy(legacy_request->key_info.body.pmk_info.pmk, + hidl_request.baseConfigs.securityConfig.pmk.data(), + legacy_request->key_info.body.pmk_info.pmk_len); + } + if (hidl_request.baseConfigs.securityConfig.securityType == + NanDataPathSecurityType::PASSPHRASE) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; + legacy_request->key_info.body.passphrase_info.passphrase_len = + hidl_request.baseConfigs.securityConfig.passphrase.size(); + if (legacy_request->key_info.body.passphrase_info.passphrase_len < + NAN_SECURITY_MIN_PASSPHRASE_LEN) { + LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " + "passphrase_len too small"; + return false; + } + if (legacy_request->key_info.body.passphrase_info.passphrase_len > + NAN_SECURITY_MAX_PASSPHRASE_LEN) { + LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " + "passphrase_len too large"; + return false; + } + memcpy(legacy_request->key_info.body.passphrase_info.passphrase, + hidl_request.baseConfigs.securityConfig.passphrase.data(), + legacy_request->key_info.body.passphrase_info.passphrase_len); + } + legacy_request->sdea_params.security_cfg = + (hidl_request.baseConfigs.securityConfig.securityType != NanDataPathSecurityType::OPEN) + ? legacy_hal::NAN_DP_CONFIG_SECURITY + : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; + legacy_request->sdea_params.ranging_state = hidl_request.baseConfigs.rangingRequired + ? legacy_hal::NAN_RANGING_ENABLE + : legacy_hal::NAN_RANGING_DISABLE; + legacy_request->ranging_cfg.ranging_interval_msec = + hidl_request.baseConfigs.rangingIntervalMsec; + legacy_request->ranging_cfg.config_ranging_indications = + hidl_request.baseConfigs.configRangingIndications; + legacy_request->ranging_cfg.distance_ingress_mm = + hidl_request.baseConfigs.distanceIngressCm * 10; + legacy_request->ranging_cfg.distance_egress_mm = hidl_request.baseConfigs.distanceEgressCm * 10; + legacy_request->ranging_auto_response = hidl_request.baseConfigs.rangingRequired + ? legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE + : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE; + legacy_request->sdea_params.range_report = legacy_hal::NAN_DISABLE_RANGE_REPORT; + legacy_request->subscribe_type = + convertHidlNanSubscribeTypeToLegacy(hidl_request.subscribeType); + legacy_request->serviceResponseFilter = convertHidlNanSrfTypeToLegacy(hidl_request.srfType); + legacy_request->serviceResponseInclude = hidl_request.srfRespondIfInAddressSet + ? legacy_hal::NAN_SRF_INCLUDE_RESPOND + : legacy_hal::NAN_SRF_INCLUDE_DO_NOT_RESPOND; + legacy_request->useServiceResponseFilter = + hidl_request.shouldUseSrf ? legacy_hal::NAN_USE_SRF : legacy_hal::NAN_DO_NOT_USE_SRF; + legacy_request->ssiRequiredForMatchIndication = + hidl_request.isSsiRequiredForMatch ? legacy_hal::NAN_SSI_REQUIRED_IN_MATCH_IND + : legacy_hal::NAN_SSI_NOT_REQUIRED_IN_MATCH_IND; + legacy_request->num_intf_addr_present = hidl_request.intfAddr.size(); + if (legacy_request->num_intf_addr_present > NAN_MAX_SUBSCRIBE_MAX_ADDRESS) { + LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " + "num_intf_addr_present - too many"; + return false; + } + for (int i = 0; i < legacy_request->num_intf_addr_present; i++) { + memcpy(legacy_request->intf_addr[i], hidl_request.intfAddr[i].data(), 6); + } + + return true; +} + +bool convertHidlNanTransmitFollowupRequestToLegacy( + const NanTransmitFollowupRequest& hidl_request, + legacy_hal::NanTransmitFollowupRequest* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertHidlNanTransmitFollowupRequestToLegacy: " + "legacy_request is null"; + return false; + } + *legacy_request = {}; + + legacy_request->publish_subscribe_id = hidl_request.discoverySessionId; + legacy_request->requestor_instance_id = hidl_request.peerId; + memcpy(legacy_request->addr, hidl_request.addr.data(), 6); + legacy_request->priority = hidl_request.isHighPriority ? legacy_hal::NAN_TX_PRIORITY_HIGH + : legacy_hal::NAN_TX_PRIORITY_NORMAL; + legacy_request->dw_or_faw = hidl_request.shouldUseDiscoveryWindow + ? legacy_hal::NAN_TRANSMIT_IN_DW + : legacy_hal::NAN_TRANSMIT_IN_FAW; + legacy_request->service_specific_info_len = hidl_request.serviceSpecificInfo.size(); + if (legacy_request->service_specific_info_len > NAN_MAX_SERVICE_SPECIFIC_INFO_LEN) { + LOG(ERROR) << "convertHidlNanTransmitFollowupRequestToLegacy: " + "service_specific_info_len too large"; + return false; + } + memcpy(legacy_request->service_specific_info, hidl_request.serviceSpecificInfo.data(), + legacy_request->service_specific_info_len); + legacy_request->sdea_service_specific_info_len = + hidl_request.extendedServiceSpecificInfo.size(); + if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) { + LOG(ERROR) << "convertHidlNanTransmitFollowupRequestToLegacy: " + "sdea_service_specific_info_len too large"; + return false; + } + memcpy(legacy_request->sdea_service_specific_info, + hidl_request.extendedServiceSpecificInfo.data(), + legacy_request->sdea_service_specific_info_len); + legacy_request->recv_indication_cfg = hidl_request.disableFollowupResultIndication ? 0x1 : 0x0; + + return true; +} + +bool convertHidlNanConfigRequestToLegacy(const V1_4::NanConfigRequest& hidl_request, + legacy_hal::NanConfigRequest* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertHidlNanConfigRequestToLegacy: legacy_request is null"; + return false; + } + *legacy_request = {}; + + // TODO: b/34059183 tracks missing configurations in legacy HAL or uknown + // defaults + legacy_request->master_pref = hidl_request.masterPref; + legacy_request->discovery_indication_cfg = 0; + legacy_request->discovery_indication_cfg |= + hidl_request.disableDiscoveryAddressChangeIndication ? 0x1 : 0x0; + legacy_request->discovery_indication_cfg |= + hidl_request.disableStartedClusterIndication ? 0x2 : 0x0; + legacy_request->discovery_indication_cfg |= + hidl_request.disableJoinedClusterIndication ? 0x4 : 0x0; + legacy_request->config_sid_beacon = 1; + if (hidl_request.numberOfPublishServiceIdsInBeacon > 127) { + LOG(ERROR) << "convertHidlNanConfigRequestToLegacy: " + "numberOfPublishServiceIdsInBeacon > 127"; + return false; + } + legacy_request->sid_beacon = (hidl_request.includePublishServiceIdsInBeacon ? 0x1 : 0x0) | + (hidl_request.numberOfPublishServiceIdsInBeacon << 1); + legacy_request->config_subscribe_sid_beacon = 1; + if (hidl_request.numberOfSubscribeServiceIdsInBeacon > 127) { + LOG(ERROR) << "convertHidlNanConfigRequestToLegacy: " + "numberOfSubscribeServiceIdsInBeacon > 127"; + return false; + } + legacy_request->subscribe_sid_beacon_val = + (hidl_request.includeSubscribeServiceIdsInBeacon ? 0x1 : 0x0) | + (hidl_request.numberOfSubscribeServiceIdsInBeacon << 1); + legacy_request->config_rssi_window_size = 1; + legacy_request->rssi_window_size_val = hidl_request.rssiWindowSize; + legacy_request->config_disc_mac_addr_randomization = 1; + legacy_request->disc_mac_addr_rand_interval_sec = + hidl_request.macAddressRandomizationIntervalSec; + /* TODO : missing + legacy_request->config_2dot4g_rssi_close = 1; + legacy_request->rssi_close_2dot4g_val = + hidl_request.bandSpecificConfig[ + (size_t) NanBandIndex::NAN_BAND_24GHZ].rssiClose; + legacy_request->config_2dot4g_rssi_middle = 1; + legacy_request->rssi_middle_2dot4g_val = + hidl_request.bandSpecificConfig[ + (size_t) NanBandIndex::NAN_BAND_24GHZ].rssiMiddle; + legacy_request->config_2dot4g_rssi_proximity = 1; + legacy_request->rssi_proximity_2dot4g_val = + hidl_request.bandSpecificConfig[ + (size_t) NanBandIndex::NAN_BAND_24GHZ].rssiCloseProximity; + */ + legacy_request->config_scan_params = 1; + legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_24G_BAND] = + hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ].dwellTimeMs; + legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_24G_BAND] = + hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ].scanPeriodSec; + legacy_request->config_dw.config_2dot4g_dw_band = + hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .validDiscoveryWindowIntervalVal; + legacy_request->config_dw.dw_2dot4g_interval_val = + hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .discoveryWindowIntervalVal; + /* TODO: missing + legacy_request->config_5g_rssi_close = 1; + legacy_request->rssi_close_5g_val = + hidl_request.bandSpecificConfig[ + (size_t) NanBandIndex::NAN_BAND_5GHZ].rssiClose; + legacy_request->config_5g_rssi_middle = 1; + legacy_request->rssi_middle_5g_val = + hidl_request.bandSpecificConfig[ + (size_t) NanBandIndex::NAN_BAND_5GHZ].rssiMiddle; + */ + legacy_request->config_5g_rssi_close_proximity = 1; + legacy_request->rssi_close_proximity_5g_val = + hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].rssiCloseProximity; + legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = + hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].dwellTimeMs; + legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = + hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].scanPeriodSec; + legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = + hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].dwellTimeMs; + legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = + hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].scanPeriodSec; + legacy_request->config_dw.config_5g_dw_band = + hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .validDiscoveryWindowIntervalVal; + legacy_request->config_dw.dw_5g_interval_val = + hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .discoveryWindowIntervalVal; + /* TODO: b/145609058 + * Missing updates needed to legacy_hal::NanConfigRequest and conversion to + * it for 6GHz band */ + + return true; +} + +bool convertHidlNanDataPathInitiatorRequestToLegacy( + const V1_0::NanInitiateDataPathRequest& hidl_request, + legacy_hal::NanDataPathInitiatorRequest* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " + "legacy_request is null"; + return false; + } + *legacy_request = {}; + + legacy_request->requestor_instance_id = hidl_request.peerId; + memcpy(legacy_request->peer_disc_mac_addr, hidl_request.peerDiscMacAddr.data(), 6); + legacy_request->channel_request_type = + convertHidlNanDataPathChannelCfgToLegacy(hidl_request.channelRequestType); + legacy_request->channel = hidl_request.channel; + if (strnlen(hidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) { + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " + "ifaceName too long"; + return false; + } + strlcpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1); + legacy_request->ndp_cfg.security_cfg = + (hidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN) + ? legacy_hal::NAN_DP_CONFIG_SECURITY + : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; + legacy_request->app_info.ndp_app_info_len = hidl_request.appInfo.size(); + if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) { + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " + "ndp_app_info_len too large"; + return false; + } + memcpy(legacy_request->app_info.ndp_app_info, hidl_request.appInfo.data(), + legacy_request->app_info.ndp_app_info_len); + legacy_request->cipher_type = (unsigned int)hidl_request.securityConfig.cipherType; + if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; + legacy_request->key_info.body.pmk_info.pmk_len = hidl_request.securityConfig.pmk.size(); + if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " + "invalid pmk_len"; + return false; + } + memcpy(legacy_request->key_info.body.pmk_info.pmk, hidl_request.securityConfig.pmk.data(), + legacy_request->key_info.body.pmk_info.pmk_len); + } + if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; + legacy_request->key_info.body.passphrase_info.passphrase_len = + hidl_request.securityConfig.passphrase.size(); + if (legacy_request->key_info.body.passphrase_info.passphrase_len < + NAN_SECURITY_MIN_PASSPHRASE_LEN) { + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " + "passphrase_len too small"; + return false; + } + if (legacy_request->key_info.body.passphrase_info.passphrase_len > + NAN_SECURITY_MAX_PASSPHRASE_LEN) { + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " + "passphrase_len too large"; + return false; + } + memcpy(legacy_request->key_info.body.passphrase_info.passphrase, + hidl_request.securityConfig.passphrase.data(), + legacy_request->key_info.body.passphrase_info.passphrase_len); + } + legacy_request->service_name_len = hidl_request.serviceNameOutOfBand.size(); + if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " + "service_name_len too large"; + return false; + } + memcpy(legacy_request->service_name, hidl_request.serviceNameOutOfBand.data(), + legacy_request->service_name_len); + + return true; +} + +bool convertHidlNanDataPathInitiatorRequest_1_6ToLegacy( + const V1_6::NanInitiateDataPathRequest& hidl_request, + legacy_hal::NanDataPathInitiatorRequest* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " + "legacy_request is null"; + return false; + } + *legacy_request = {}; + + legacy_request->requestor_instance_id = hidl_request.peerId; + memcpy(legacy_request->peer_disc_mac_addr, hidl_request.peerDiscMacAddr.data(), 6); + legacy_request->channel_request_type = + convertHidlNanDataPathChannelCfgToLegacy(hidl_request.channelRequestType); + legacy_request->channel = hidl_request.channel; + if (strnlen(hidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) { + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " + "ifaceName too long"; + return false; + } + strlcpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1); + legacy_request->ndp_cfg.security_cfg = + (hidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN) + ? legacy_hal::NAN_DP_CONFIG_SECURITY + : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; + legacy_request->app_info.ndp_app_info_len = hidl_request.appInfo.size(); + if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) { + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " + "ndp_app_info_len too large"; + return false; + } + memcpy(legacy_request->app_info.ndp_app_info, hidl_request.appInfo.data(), + legacy_request->app_info.ndp_app_info_len); + legacy_request->cipher_type = (unsigned int)hidl_request.securityConfig.cipherType; + if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; + legacy_request->key_info.body.pmk_info.pmk_len = hidl_request.securityConfig.pmk.size(); + if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " + "invalid pmk_len"; + return false; + } + memcpy(legacy_request->key_info.body.pmk_info.pmk, hidl_request.securityConfig.pmk.data(), + legacy_request->key_info.body.pmk_info.pmk_len); + } + if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; + legacy_request->key_info.body.passphrase_info.passphrase_len = + hidl_request.securityConfig.passphrase.size(); + if (legacy_request->key_info.body.passphrase_info.passphrase_len < + NAN_SECURITY_MIN_PASSPHRASE_LEN) { + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " + "passphrase_len too small"; + return false; + } + if (legacy_request->key_info.body.passphrase_info.passphrase_len > + NAN_SECURITY_MAX_PASSPHRASE_LEN) { + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " + "passphrase_len too large"; + return false; + } + memcpy(legacy_request->key_info.body.passphrase_info.passphrase, + hidl_request.securityConfig.passphrase.data(), + legacy_request->key_info.body.passphrase_info.passphrase_len); + } + legacy_request->service_name_len = hidl_request.serviceNameOutOfBand.size(); + if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " + "service_name_len too large"; + return false; + } + memcpy(legacy_request->service_name, hidl_request.serviceNameOutOfBand.data(), + legacy_request->service_name_len); + legacy_request->scid_len = hidl_request.securityConfig.scid.size(); + if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) { + LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: scid_len too large"; + return false; + } + memcpy(legacy_request->scid, hidl_request.securityConfig.scid.data(), legacy_request->scid_len); + + return true; +} + +bool convertHidlNanDataPathIndicationResponseToLegacy( + const V1_0::NanRespondToDataPathIndicationRequest& hidl_request, + legacy_hal::NanDataPathIndicationResponse* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: " + "legacy_request is null"; + return false; + } + *legacy_request = {}; + + legacy_request->rsp_code = hidl_request.acceptRequest ? legacy_hal::NAN_DP_REQUEST_ACCEPT + : legacy_hal::NAN_DP_REQUEST_REJECT; + legacy_request->ndp_instance_id = hidl_request.ndpInstanceId; + if (strnlen(hidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: " + "ifaceName too long"; + return false; + } + strlcpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1); + legacy_request->ndp_cfg.security_cfg = + (hidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN) + ? legacy_hal::NAN_DP_CONFIG_SECURITY + : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; + legacy_request->app_info.ndp_app_info_len = hidl_request.appInfo.size(); + if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: " + "ndp_app_info_len too large"; + return false; + } + memcpy(legacy_request->app_info.ndp_app_info, hidl_request.appInfo.data(), + legacy_request->app_info.ndp_app_info_len); + legacy_request->cipher_type = (unsigned int)hidl_request.securityConfig.cipherType; + if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; + legacy_request->key_info.body.pmk_info.pmk_len = hidl_request.securityConfig.pmk.size(); + if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: " + "invalid pmk_len"; + return false; + } + memcpy(legacy_request->key_info.body.pmk_info.pmk, hidl_request.securityConfig.pmk.data(), + legacy_request->key_info.body.pmk_info.pmk_len); + } + if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; + legacy_request->key_info.body.passphrase_info.passphrase_len = + hidl_request.securityConfig.passphrase.size(); + if (legacy_request->key_info.body.passphrase_info.passphrase_len < + NAN_SECURITY_MIN_PASSPHRASE_LEN) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: " + "passphrase_len too small"; + return false; + } + if (legacy_request->key_info.body.passphrase_info.passphrase_len > + NAN_SECURITY_MAX_PASSPHRASE_LEN) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: " + "passphrase_len too large"; + return false; + } + memcpy(legacy_request->key_info.body.passphrase_info.passphrase, + hidl_request.securityConfig.passphrase.data(), + legacy_request->key_info.body.passphrase_info.passphrase_len); + } + legacy_request->service_name_len = hidl_request.serviceNameOutOfBand.size(); + if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: " + "service_name_len too large"; + return false; + } + memcpy(legacy_request->service_name, hidl_request.serviceNameOutOfBand.data(), + legacy_request->service_name_len); + + return true; +} + +bool convertHidlNanDataPathIndicationResponse_1_6ToLegacy( + const V1_6::NanRespondToDataPathIndicationRequest& hidl_request, + legacy_hal::NanDataPathIndicationResponse* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " + "legacy_request is null"; + return false; + } + *legacy_request = {}; + + legacy_request->rsp_code = hidl_request.acceptRequest ? legacy_hal::NAN_DP_REQUEST_ACCEPT + : legacy_hal::NAN_DP_REQUEST_REJECT; + legacy_request->ndp_instance_id = hidl_request.ndpInstanceId; + if (strnlen(hidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " + "ifaceName too long"; + return false; + } + strlcpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1); + legacy_request->ndp_cfg.security_cfg = + (hidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN) + ? legacy_hal::NAN_DP_CONFIG_SECURITY + : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; + legacy_request->app_info.ndp_app_info_len = hidl_request.appInfo.size(); + if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " + "ndp_app_info_len too large"; + return false; + } + memcpy(legacy_request->app_info.ndp_app_info, hidl_request.appInfo.data(), + legacy_request->app_info.ndp_app_info_len); + legacy_request->cipher_type = (unsigned int)hidl_request.securityConfig.cipherType; + if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; + legacy_request->key_info.body.pmk_info.pmk_len = hidl_request.securityConfig.pmk.size(); + if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " + "invalid pmk_len"; + return false; + } + memcpy(legacy_request->key_info.body.pmk_info.pmk, hidl_request.securityConfig.pmk.data(), + legacy_request->key_info.body.pmk_info.pmk_len); + } + if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; + legacy_request->key_info.body.passphrase_info.passphrase_len = + hidl_request.securityConfig.passphrase.size(); + if (legacy_request->key_info.body.passphrase_info.passphrase_len < + NAN_SECURITY_MIN_PASSPHRASE_LEN) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " + "passphrase_len too small"; + return false; + } + if (legacy_request->key_info.body.passphrase_info.passphrase_len > + NAN_SECURITY_MAX_PASSPHRASE_LEN) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " + "passphrase_len too large"; + return false; + } + memcpy(legacy_request->key_info.body.passphrase_info.passphrase, + hidl_request.securityConfig.passphrase.data(), + legacy_request->key_info.body.passphrase_info.passphrase_len); + } + legacy_request->service_name_len = hidl_request.serviceNameOutOfBand.size(); + if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " + "service_name_len too large"; + return false; + } + memcpy(legacy_request->service_name, hidl_request.serviceNameOutOfBand.data(), + legacy_request->service_name_len); + legacy_request->scid_len = hidl_request.securityConfig.scid.size(); + if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) { + LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: scid_len too large"; + return false; + } + memcpy(legacy_request->scid, hidl_request.securityConfig.scid.data(), legacy_request->scid_len); + + return true; +} + +bool convertLegacyNanResponseHeaderToHidl(const legacy_hal::NanResponseMsg& legacy_response, + WifiNanStatus* wifiNanStatus) { + if (!wifiNanStatus) { + LOG(ERROR) << "convertLegacyNanResponseHeaderToHidl: wifiNanStatus is null"; + return false; + } + *wifiNanStatus = {}; + + convertToWifiNanStatus(legacy_response.status, legacy_response.nan_error, + sizeof(legacy_response.nan_error), wifiNanStatus); + return true; +} + +bool convertLegacyNanCapabilitiesResponseToHidl(const legacy_hal::NanCapabilities& legacy_response, + V1_6::NanCapabilities* hidl_response) { + if (!hidl_response) { + LOG(ERROR) << "convertLegacyNanCapabilitiesResponseToHidl: " + "hidl_response is null"; + return false; + } + *hidl_response = {}; + + hidl_response->maxConcurrentClusters = legacy_response.max_concurrent_nan_clusters; + hidl_response->maxPublishes = legacy_response.max_publishes; + hidl_response->maxSubscribes = legacy_response.max_subscribes; + hidl_response->maxServiceNameLen = legacy_response.max_service_name_len; + hidl_response->maxMatchFilterLen = legacy_response.max_match_filter_len; + hidl_response->maxTotalMatchFilterLen = legacy_response.max_total_match_filter_len; + hidl_response->maxServiceSpecificInfoLen = legacy_response.max_service_specific_info_len; + hidl_response->maxExtendedServiceSpecificInfoLen = + legacy_response.max_sdea_service_specific_info_len; + hidl_response->maxNdiInterfaces = legacy_response.max_ndi_interfaces; + hidl_response->maxNdpSessions = legacy_response.max_ndp_sessions; + hidl_response->maxAppInfoLen = legacy_response.max_app_info_len; + hidl_response->maxQueuedTransmitFollowupMsgs = + legacy_response.max_queued_transmit_followup_msgs; + hidl_response->maxSubscribeInterfaceAddresses = legacy_response.max_subscribe_address; + hidl_response->supportedCipherSuites = legacy_response.cipher_suites_supported; + hidl_response->instantCommunicationModeSupportFlag = legacy_response.is_instant_mode_supported; + + return true; +} + +bool convertLegacyNanMatchIndToHidl(const legacy_hal::NanMatchInd& legacy_ind, + V1_6::NanMatchInd* hidl_ind) { + if (!hidl_ind) { + LOG(ERROR) << "convertLegacyNanMatchIndToHidl: hidl_ind is null"; + return false; + } + *hidl_ind = {}; + + hidl_ind->discoverySessionId = legacy_ind.publish_subscribe_id; + hidl_ind->peerId = legacy_ind.requestor_instance_id; + hidl_ind->addr = hidl_array(legacy_ind.addr); + hidl_ind->serviceSpecificInfo = std::vector( + legacy_ind.service_specific_info, + legacy_ind.service_specific_info + legacy_ind.service_specific_info_len); + hidl_ind->extendedServiceSpecificInfo = std::vector( + legacy_ind.sdea_service_specific_info, + legacy_ind.sdea_service_specific_info + legacy_ind.sdea_service_specific_info_len); + hidl_ind->matchFilter = + std::vector(legacy_ind.sdf_match_filter, + legacy_ind.sdf_match_filter + legacy_ind.sdf_match_filter_len); + hidl_ind->matchOccuredInBeaconFlag = legacy_ind.match_occured_flag == 1; + hidl_ind->outOfResourceFlag = legacy_ind.out_of_resource_flag == 1; + hidl_ind->rssiValue = legacy_ind.rssi_value; + hidl_ind->peerCipherType = (V1_6::NanCipherSuiteType)legacy_ind.peer_cipher_type; + hidl_ind->peerRequiresSecurityEnabledInNdp = + legacy_ind.peer_sdea_params.security_cfg == legacy_hal::NAN_DP_CONFIG_SECURITY; + hidl_ind->peerRequiresRanging = + legacy_ind.peer_sdea_params.ranging_state == legacy_hal::NAN_RANGING_ENABLE; + hidl_ind->rangingMeasurementInMm = legacy_ind.range_info.range_measurement_mm; + hidl_ind->rangingIndicationType = legacy_ind.range_info.ranging_event_type; + hidl_ind->scid = std::vector(legacy_ind.scid, legacy_ind.scid + legacy_ind.scid_len); + return true; +} + +bool convertLegacyNanFollowupIndToHidl(const legacy_hal::NanFollowupInd& legacy_ind, + NanFollowupReceivedInd* hidl_ind) { + if (!hidl_ind) { + LOG(ERROR) << "convertLegacyNanFollowupIndToHidl: hidl_ind is null"; + return false; + } + *hidl_ind = {}; + + hidl_ind->discoverySessionId = legacy_ind.publish_subscribe_id; + hidl_ind->peerId = legacy_ind.requestor_instance_id; + hidl_ind->addr = hidl_array(legacy_ind.addr); + hidl_ind->receivedInFaw = legacy_ind.dw_or_faw == 1; + hidl_ind->serviceSpecificInfo = std::vector( + legacy_ind.service_specific_info, + legacy_ind.service_specific_info + legacy_ind.service_specific_info_len); + hidl_ind->extendedServiceSpecificInfo = std::vector( + legacy_ind.sdea_service_specific_info, + legacy_ind.sdea_service_specific_info + legacy_ind.sdea_service_specific_info_len); + + return true; +} + +bool convertLegacyNanDataPathRequestIndToHidl(const legacy_hal::NanDataPathRequestInd& legacy_ind, + NanDataPathRequestInd* hidl_ind) { + if (!hidl_ind) { + LOG(ERROR) << "convertLegacyNanDataPathRequestIndToHidl: hidl_ind is null"; + return false; + } + *hidl_ind = {}; + + hidl_ind->discoverySessionId = legacy_ind.service_instance_id; + hidl_ind->peerDiscMacAddr = hidl_array(legacy_ind.peer_disc_mac_addr); + hidl_ind->ndpInstanceId = legacy_ind.ndp_instance_id; + hidl_ind->securityRequired = + legacy_ind.ndp_cfg.security_cfg == legacy_hal::NAN_DP_CONFIG_SECURITY; + hidl_ind->appInfo = std::vector( + legacy_ind.app_info.ndp_app_info, + legacy_ind.app_info.ndp_app_info + legacy_ind.app_info.ndp_app_info_len); + + return true; +} + +bool convertLegacyNdpChannelInfoToHidl(const legacy_hal::NanChannelInfo& legacy_struct, + V1_6::NanDataPathChannelInfo* hidl_struct) { + if (!hidl_struct) { + LOG(ERROR) << "convertLegacyNdpChannelInfoToHidl: hidl_struct is null"; + return false; + } + *hidl_struct = {}; + + hidl_struct->channelFreq = legacy_struct.channel; + hidl_struct->channelBandwidth = convertLegacyWifiChannelWidthToHidl( + (legacy_hal::wifi_channel_width)legacy_struct.bandwidth); + hidl_struct->numSpatialStreams = legacy_struct.nss; + + return true; +} + +bool convertLegacyNanDataPathConfirmIndToHidl(const legacy_hal::NanDataPathConfirmInd& legacy_ind, + V1_6::NanDataPathConfirmInd* hidl_ind) { + if (!hidl_ind) { + LOG(ERROR) << "convertLegacyNanDataPathConfirmIndToHidl: hidl_ind is null"; + return false; + } + *hidl_ind = {}; + + hidl_ind->V1_0.ndpInstanceId = legacy_ind.ndp_instance_id; + hidl_ind->V1_0.dataPathSetupSuccess = legacy_ind.rsp_code == legacy_hal::NAN_DP_REQUEST_ACCEPT; + hidl_ind->V1_0.peerNdiMacAddr = hidl_array(legacy_ind.peer_ndi_mac_addr); + hidl_ind->V1_0.appInfo = std::vector( + legacy_ind.app_info.ndp_app_info, + legacy_ind.app_info.ndp_app_info + legacy_ind.app_info.ndp_app_info_len); + hidl_ind->V1_0.status.status = convertLegacyNanStatusTypeToHidl(legacy_ind.reason_code); + hidl_ind->V1_0.status.description = ""; // TODO: b/34059183 + + std::vector channelInfo; + for (unsigned int i = 0; i < legacy_ind.num_channels; ++i) { + V1_6::NanDataPathChannelInfo hidl_struct; + if (!convertLegacyNdpChannelInfoToHidl(legacy_ind.channel_info[i], &hidl_struct)) { + return false; + } + channelInfo.push_back(hidl_struct); + } + hidl_ind->channelInfo = channelInfo; + + return true; +} + +bool convertLegacyNanDataPathScheduleUpdateIndToHidl( + const legacy_hal::NanDataPathScheduleUpdateInd& legacy_ind, + V1_6::NanDataPathScheduleUpdateInd* hidl_ind) { + if (!hidl_ind) { + LOG(ERROR) << "convertLegacyNanDataPathScheduleUpdateIndToHidl: " + "hidl_ind is null"; + return false; + } + *hidl_ind = {}; + + hidl_ind->peerDiscoveryAddress = hidl_array(legacy_ind.peer_mac_addr); + std::vector channelInfo; + for (unsigned int i = 0; i < legacy_ind.num_channels; ++i) { + V1_6::NanDataPathChannelInfo hidl_struct; + if (!convertLegacyNdpChannelInfoToHidl(legacy_ind.channel_info[i], &hidl_struct)) { + return false; + } + channelInfo.push_back(hidl_struct); + } + hidl_ind->channelInfo = channelInfo; + std::vector ndpInstanceIds; + for (unsigned int i = 0; i < legacy_ind.num_ndp_instances; ++i) { + ndpInstanceIds.push_back(legacy_ind.ndp_instance_id[i]); + } + hidl_ind->ndpInstanceIds = ndpInstanceIds; + + return true; +} + +legacy_hal::wifi_rtt_type convertHidlRttTypeToLegacy(RttType type) { + switch (type) { + case RttType::ONE_SIDED: + return legacy_hal::RTT_TYPE_1_SIDED; + case RttType::TWO_SIDED: + return legacy_hal::RTT_TYPE_2_SIDED; + }; + CHECK(false); +} + +RttType convertLegacyRttTypeToHidl(legacy_hal::wifi_rtt_type type) { + switch (type) { + case legacy_hal::RTT_TYPE_1_SIDED: + return RttType::ONE_SIDED; + case legacy_hal::RTT_TYPE_2_SIDED: + return RttType::TWO_SIDED; + }; + CHECK(false) << "Unknown legacy type: " << type; +} + +legacy_hal::rtt_peer_type convertHidlRttPeerTypeToLegacy(RttPeerType type) { + switch (type) { + case RttPeerType::AP: + return legacy_hal::RTT_PEER_AP; + case RttPeerType::STA: + return legacy_hal::RTT_PEER_STA; + case RttPeerType::P2P_GO: + return legacy_hal::RTT_PEER_P2P_GO; + case RttPeerType::P2P_CLIENT: + return legacy_hal::RTT_PEER_P2P_CLIENT; + case RttPeerType::NAN: + return legacy_hal::RTT_PEER_NAN; + }; + CHECK(false); +} + +legacy_hal::wifi_channel_width convertHidlWifiChannelWidthToLegacy(WifiChannelWidthInMhz type) { + switch (type) { + case WifiChannelWidthInMhz::WIDTH_20: + return legacy_hal::WIFI_CHAN_WIDTH_20; + case WifiChannelWidthInMhz::WIDTH_40: + return legacy_hal::WIFI_CHAN_WIDTH_40; + case WifiChannelWidthInMhz::WIDTH_80: + return legacy_hal::WIFI_CHAN_WIDTH_80; + case WifiChannelWidthInMhz::WIDTH_160: + return legacy_hal::WIFI_CHAN_WIDTH_160; + case WifiChannelWidthInMhz::WIDTH_80P80: + return legacy_hal::WIFI_CHAN_WIDTH_80P80; + case WifiChannelWidthInMhz::WIDTH_5: + return legacy_hal::WIFI_CHAN_WIDTH_5; + case WifiChannelWidthInMhz::WIDTH_10: + return legacy_hal::WIFI_CHAN_WIDTH_10; + case V1_6::WifiChannelWidthInMhz::WIDTH_320: + return legacy_hal::WIFI_CHAN_WIDTH_320; + case WifiChannelWidthInMhz::WIDTH_INVALID: + return legacy_hal::WIFI_CHAN_WIDTH_INVALID; + }; + CHECK(false); +} + +V1_6::WifiChannelWidthInMhz convertLegacyWifiChannelWidthToHidl( + legacy_hal::wifi_channel_width type) { + switch (type) { + case legacy_hal::WIFI_CHAN_WIDTH_20: + return WifiChannelWidthInMhz::WIDTH_20; + case legacy_hal::WIFI_CHAN_WIDTH_40: + return WifiChannelWidthInMhz::WIDTH_40; + case legacy_hal::WIFI_CHAN_WIDTH_80: + return WifiChannelWidthInMhz::WIDTH_80; + case legacy_hal::WIFI_CHAN_WIDTH_160: + return WifiChannelWidthInMhz::WIDTH_160; + case legacy_hal::WIFI_CHAN_WIDTH_80P80: + return WifiChannelWidthInMhz::WIDTH_80P80; + case legacy_hal::WIFI_CHAN_WIDTH_5: + return WifiChannelWidthInMhz::WIDTH_5; + case legacy_hal::WIFI_CHAN_WIDTH_10: + return WifiChannelWidthInMhz::WIDTH_10; + case legacy_hal::WIFI_CHAN_WIDTH_320: + return V1_6::WifiChannelWidthInMhz::WIDTH_320; + default: + return WifiChannelWidthInMhz::WIDTH_INVALID; + }; +} + +legacy_hal::wifi_rtt_preamble convertHidlRttPreambleToLegacy(V1_6::RttPreamble type) { + switch (type) { + case V1_6::RttPreamble::LEGACY: + return legacy_hal::WIFI_RTT_PREAMBLE_LEGACY; + case V1_6::RttPreamble::HT: + return legacy_hal::WIFI_RTT_PREAMBLE_HT; + case V1_6::RttPreamble::VHT: + return legacy_hal::WIFI_RTT_PREAMBLE_VHT; + case V1_6::RttPreamble::HE: + return legacy_hal::WIFI_RTT_PREAMBLE_HE; + case V1_6::RttPreamble::EHT: + return legacy_hal::WIFI_RTT_PREAMBLE_EHT; + }; + CHECK(false); +} + +V1_6::RttPreamble convertLegacyRttPreambleToHidl(legacy_hal::wifi_rtt_preamble type) { + switch (type) { + case legacy_hal::WIFI_RTT_PREAMBLE_LEGACY: + return V1_6::RttPreamble::LEGACY; + case legacy_hal::WIFI_RTT_PREAMBLE_HT: + return V1_6::RttPreamble::HT; + case legacy_hal::WIFI_RTT_PREAMBLE_VHT: + return V1_6::RttPreamble::VHT; + case legacy_hal::WIFI_RTT_PREAMBLE_HE: + return V1_6::RttPreamble::HE; + case legacy_hal::WIFI_RTT_PREAMBLE_EHT: + return V1_6::RttPreamble::EHT; + }; + CHECK(false) << "Unknown legacy type: " << type; +} + +legacy_hal::wifi_rtt_bw convertHidlRttBwToLegacy(RttBw type) { + switch (type) { + case RttBw::BW_5MHZ: + return legacy_hal::WIFI_RTT_BW_5; + case RttBw::BW_10MHZ: + return legacy_hal::WIFI_RTT_BW_10; + case RttBw::BW_20MHZ: + return legacy_hal::WIFI_RTT_BW_20; + case RttBw::BW_40MHZ: + return legacy_hal::WIFI_RTT_BW_40; + case RttBw::BW_80MHZ: + return legacy_hal::WIFI_RTT_BW_80; + case RttBw::BW_160MHZ: + return legacy_hal::WIFI_RTT_BW_160; + case RttBw::BW_320MHZ: + return legacy_hal::WIFI_RTT_BW_320; + }; + CHECK(false); +} + +RttBw convertLegacyRttBwToHidl(legacy_hal::wifi_rtt_bw type) { + switch (type) { + case legacy_hal::WIFI_RTT_BW_5: + return RttBw::BW_5MHZ; + case legacy_hal::WIFI_RTT_BW_10: + return RttBw::BW_10MHZ; + case legacy_hal::WIFI_RTT_BW_20: + return RttBw::BW_20MHZ; + case legacy_hal::WIFI_RTT_BW_40: + return RttBw::BW_40MHZ; + case legacy_hal::WIFI_RTT_BW_80: + return RttBw::BW_80MHZ; + case legacy_hal::WIFI_RTT_BW_160: + return RttBw::BW_160MHZ; + case legacy_hal::WIFI_RTT_BW_320: + return RttBw::BW_320MHZ; + }; + CHECK(false) << "Unknown legacy type: " << type; +} + +legacy_hal::wifi_motion_pattern convertHidlRttMotionPatternToLegacy(RttMotionPattern type) { + switch (type) { + case RttMotionPattern::NOT_EXPECTED: + return legacy_hal::WIFI_MOTION_NOT_EXPECTED; + case RttMotionPattern::EXPECTED: + return legacy_hal::WIFI_MOTION_EXPECTED; + case RttMotionPattern::UNKNOWN: + return legacy_hal::WIFI_MOTION_UNKNOWN; + }; + CHECK(false); +} + +V1_6::WifiRatePreamble convertLegacyWifiRatePreambleToHidl(uint8_t preamble) { + switch (preamble) { + case 0: + return V1_6::WifiRatePreamble::OFDM; + case 1: + return V1_6::WifiRatePreamble::CCK; + case 2: + return V1_6::WifiRatePreamble::HT; + case 3: + return V1_6::WifiRatePreamble::VHT; + case 4: + return V1_6::WifiRatePreamble::HE; + case 5: + return V1_6::WifiRatePreamble::EHT; + default: + return V1_6::WifiRatePreamble::RESERVED; + }; + CHECK(false) << "Unknown legacy preamble: " << preamble; +} + +WifiRateNss convertLegacyWifiRateNssToHidl(uint8_t nss) { + switch (nss) { + case 0: + return WifiRateNss::NSS_1x1; + case 1: + return WifiRateNss::NSS_2x2; + case 2: + return WifiRateNss::NSS_3x3; + case 3: + return WifiRateNss::NSS_4x4; + }; + CHECK(false) << "Unknown legacy nss: " << nss; + return {}; +} + +RttStatus convertLegacyRttStatusToHidl(legacy_hal::wifi_rtt_status status) { + switch (status) { + case legacy_hal::RTT_STATUS_SUCCESS: + return RttStatus::SUCCESS; + case legacy_hal::RTT_STATUS_FAILURE: + return RttStatus::FAILURE; + case legacy_hal::RTT_STATUS_FAIL_NO_RSP: + return RttStatus::FAIL_NO_RSP; + case legacy_hal::RTT_STATUS_FAIL_REJECTED: + return RttStatus::FAIL_REJECTED; + case legacy_hal::RTT_STATUS_FAIL_NOT_SCHEDULED_YET: + return RttStatus::FAIL_NOT_SCHEDULED_YET; + case legacy_hal::RTT_STATUS_FAIL_TM_TIMEOUT: + return RttStatus::FAIL_TM_TIMEOUT; + case legacy_hal::RTT_STATUS_FAIL_AP_ON_DIFF_CHANNEL: + return RttStatus::FAIL_AP_ON_DIFF_CHANNEL; + case legacy_hal::RTT_STATUS_FAIL_NO_CAPABILITY: + return RttStatus::FAIL_NO_CAPABILITY; + case legacy_hal::RTT_STATUS_ABORTED: + return RttStatus::ABORTED; + case legacy_hal::RTT_STATUS_FAIL_INVALID_TS: + return RttStatus::FAIL_INVALID_TS; + case legacy_hal::RTT_STATUS_FAIL_PROTOCOL: + return RttStatus::FAIL_PROTOCOL; + case legacy_hal::RTT_STATUS_FAIL_SCHEDULE: + return RttStatus::FAIL_SCHEDULE; + case legacy_hal::RTT_STATUS_FAIL_BUSY_TRY_LATER: + return RttStatus::FAIL_BUSY_TRY_LATER; + case legacy_hal::RTT_STATUS_INVALID_REQ: + return RttStatus::INVALID_REQ; + case legacy_hal::RTT_STATUS_NO_WIFI: + return RttStatus::NO_WIFI; + case legacy_hal::RTT_STATUS_FAIL_FTM_PARAM_OVERRIDE: + return RttStatus::FAIL_FTM_PARAM_OVERRIDE; + case legacy_hal::RTT_STATUS_NAN_RANGING_PROTOCOL_FAILURE: + return RttStatus::FAILURE; // TODO: add HIDL enumeration + case legacy_hal::RTT_STATUS_NAN_RANGING_CONCURRENCY_NOT_SUPPORTED: + return RttStatus::FAILURE; // TODO: add HIDL enumeration + }; + CHECK(false) << "Unknown legacy status: " << status; +} + +bool convertHidlWifiChannelInfoToLegacy(const WifiChannelInfo& hidl_info, + legacy_hal::wifi_channel_info* legacy_info) { + if (!legacy_info) { + return false; + } + *legacy_info = {}; + legacy_info->width = convertHidlWifiChannelWidthToLegacy(hidl_info.width); + legacy_info->center_freq = hidl_info.centerFreq; + legacy_info->center_freq0 = hidl_info.centerFreq0; + legacy_info->center_freq1 = hidl_info.centerFreq1; + return true; +} + +bool convertLegacyWifiChannelInfoToHidl(const legacy_hal::wifi_channel_info& legacy_info, + WifiChannelInfo* hidl_info) { + if (!hidl_info) { + return false; + } + *hidl_info = {}; + hidl_info->width = convertLegacyWifiChannelWidthToHidl(legacy_info.width); + hidl_info->centerFreq = legacy_info.center_freq; + hidl_info->centerFreq0 = legacy_info.center_freq0; + hidl_info->centerFreq1 = legacy_info.center_freq1; + return true; +} + +bool convertHidlRttConfigToLegacy(const V1_6::RttConfig& hidl_config, + legacy_hal::wifi_rtt_config* legacy_config) { + if (!legacy_config) { + return false; + } + *legacy_config = {}; + CHECK(hidl_config.addr.size() == sizeof(legacy_config->addr)); + memcpy(legacy_config->addr, hidl_config.addr.data(), hidl_config.addr.size()); + legacy_config->type = convertHidlRttTypeToLegacy(hidl_config.type); + legacy_config->peer = convertHidlRttPeerTypeToLegacy(hidl_config.peer); + if (!convertHidlWifiChannelInfoToLegacy(hidl_config.channel, &legacy_config->channel)) { + return false; + } + legacy_config->burst_period = hidl_config.burstPeriod; + legacy_config->num_burst = hidl_config.numBurst; + legacy_config->num_frames_per_burst = hidl_config.numFramesPerBurst; + legacy_config->num_retries_per_rtt_frame = hidl_config.numRetriesPerRttFrame; + legacy_config->num_retries_per_ftmr = hidl_config.numRetriesPerFtmr; + legacy_config->LCI_request = hidl_config.mustRequestLci; + legacy_config->LCR_request = hidl_config.mustRequestLcr; + legacy_config->burst_duration = hidl_config.burstDuration; + legacy_config->preamble = convertHidlRttPreambleToLegacy(hidl_config.preamble); + legacy_config->bw = convertHidlRttBwToLegacy(hidl_config.bw); + return true; +} + +bool convertHidlVectorOfRttConfigToLegacy( + const std::vector& hidl_configs, + std::vector* legacy_configs) { + if (!legacy_configs) { + return false; + } + *legacy_configs = {}; + for (const auto& hidl_config : hidl_configs) { + legacy_hal::wifi_rtt_config legacy_config; + if (!convertHidlRttConfigToLegacy(hidl_config, &legacy_config)) { + return false; + } + legacy_configs->push_back(legacy_config); + } + return true; +} + +bool convertHidlRttLciInformationToLegacy(const RttLciInformation& hidl_info, + legacy_hal::wifi_lci_information* legacy_info) { + if (!legacy_info) { + return false; + } + *legacy_info = {}; + legacy_info->latitude = hidl_info.latitude; + legacy_info->longitude = hidl_info.longitude; + legacy_info->altitude = hidl_info.altitude; + legacy_info->latitude_unc = hidl_info.latitudeUnc; + legacy_info->longitude_unc = hidl_info.longitudeUnc; + legacy_info->altitude_unc = hidl_info.altitudeUnc; + legacy_info->motion_pattern = convertHidlRttMotionPatternToLegacy(hidl_info.motionPattern); + legacy_info->floor = hidl_info.floor; + legacy_info->height_above_floor = hidl_info.heightAboveFloor; + legacy_info->height_unc = hidl_info.heightUnc; + return true; +} + +bool convertHidlRttLcrInformationToLegacy(const RttLcrInformation& hidl_info, + legacy_hal::wifi_lcr_information* legacy_info) { + if (!legacy_info) { + return false; + } + *legacy_info = {}; + CHECK(hidl_info.countryCode.size() == sizeof(legacy_info->country_code)); + memcpy(legacy_info->country_code, hidl_info.countryCode.data(), hidl_info.countryCode.size()); + if (hidl_info.civicInfo.size() > sizeof(legacy_info->civic_info)) { + return false; + } + legacy_info->length = hidl_info.civicInfo.size(); + memcpy(legacy_info->civic_info, hidl_info.civicInfo.c_str(), hidl_info.civicInfo.size()); + return true; +} + +bool convertHidlRttResponderToLegacy(const V1_6::RttResponder& hidl_responder, + legacy_hal::wifi_rtt_responder* legacy_responder) { + if (!legacy_responder) { + return false; + } + *legacy_responder = {}; + if (!convertHidlWifiChannelInfoToLegacy(hidl_responder.channel, &legacy_responder->channel)) { + return false; + } + legacy_responder->preamble = convertHidlRttPreambleToLegacy(hidl_responder.preamble); + return true; +} + +bool convertLegacyRttResponderToHidl(const legacy_hal::wifi_rtt_responder& legacy_responder, + V1_6::RttResponder* hidl_responder) { + if (!hidl_responder) { + return false; + } + *hidl_responder = {}; + if (!convertLegacyWifiChannelInfoToHidl(legacy_responder.channel, &hidl_responder->channel)) { + return false; + } + hidl_responder->preamble = convertLegacyRttPreambleToHidl(legacy_responder.preamble); + return true; +} + +bool convertLegacyRttCapabilitiesToHidl( + const legacy_hal::wifi_rtt_capabilities& legacy_capabilities, + V1_6::RttCapabilities* hidl_capabilities) { + if (!hidl_capabilities) { + return false; + } + *hidl_capabilities = {}; + hidl_capabilities->rttOneSidedSupported = legacy_capabilities.rtt_one_sided_supported; + hidl_capabilities->rttFtmSupported = legacy_capabilities.rtt_ftm_supported; + hidl_capabilities->lciSupported = legacy_capabilities.lci_support; + hidl_capabilities->lcrSupported = legacy_capabilities.lcr_support; + hidl_capabilities->responderSupported = legacy_capabilities.responder_supported; + hidl_capabilities->preambleSupport = 0; + for (const auto flag : {legacy_hal::WIFI_RTT_PREAMBLE_LEGACY, legacy_hal::WIFI_RTT_PREAMBLE_HT, + legacy_hal::WIFI_RTT_PREAMBLE_VHT, legacy_hal::WIFI_RTT_PREAMBLE_HE, + legacy_hal::WIFI_RTT_PREAMBLE_EHT}) { + if (legacy_capabilities.preamble_support & flag) { + hidl_capabilities->preambleSupport |= + static_cast::type>( + convertLegacyRttPreambleToHidl(flag)); + } + } + hidl_capabilities->bwSupport = 0; + for (const auto flag : + {legacy_hal::WIFI_RTT_BW_5, legacy_hal::WIFI_RTT_BW_10, legacy_hal::WIFI_RTT_BW_20, + legacy_hal::WIFI_RTT_BW_40, legacy_hal::WIFI_RTT_BW_80, legacy_hal::WIFI_RTT_BW_160, + legacy_hal::WIFI_RTT_BW_320}) { + if (legacy_capabilities.bw_support & flag) { + hidl_capabilities->bwSupport |= + static_cast::type>(convertLegacyRttBwToHidl(flag)); + } + } + hidl_capabilities->mcVersion = legacy_capabilities.mc_version; + return true; +} + +bool convertLegacyWifiRateInfoToHidl(const legacy_hal::wifi_rate& legacy_rate, + V1_6::WifiRateInfo* hidl_rate) { + if (!hidl_rate) { + return false; + } + *hidl_rate = {}; + hidl_rate->preamble = convertLegacyWifiRatePreambleToHidl(legacy_rate.preamble); + hidl_rate->nss = convertLegacyWifiRateNssToHidl(legacy_rate.nss); + hidl_rate->bw = convertLegacyWifiChannelWidthToHidl( + static_cast(legacy_rate.bw)); + hidl_rate->rateMcsIdx = legacy_rate.rateMcsIdx; + hidl_rate->bitRateInKbps = legacy_rate.bitrate; + return true; +} + +bool convertLegacyRttResultToHidl(const legacy_hal::wifi_rtt_result& legacy_result, + V1_6::RttResult* hidl_result) { + if (!hidl_result) { + return false; + } + *hidl_result = {}; + CHECK(sizeof(legacy_result.addr) == hidl_result->addr.size()); + memcpy(hidl_result->addr.data(), legacy_result.addr, sizeof(legacy_result.addr)); + hidl_result->burstNum = legacy_result.burst_num; + hidl_result->measurementNumber = legacy_result.measurement_number; + hidl_result->successNumber = legacy_result.success_number; + hidl_result->numberPerBurstPeer = legacy_result.number_per_burst_peer; + hidl_result->status = convertLegacyRttStatusToHidl(legacy_result.status); + hidl_result->retryAfterDuration = legacy_result.retry_after_duration; + hidl_result->type = convertLegacyRttTypeToHidl(legacy_result.type); + hidl_result->rssi = legacy_result.rssi; + hidl_result->rssiSpread = legacy_result.rssi_spread; + if (!convertLegacyWifiRateInfoToHidl(legacy_result.tx_rate, &hidl_result->txRate)) { + return false; + } + if (!convertLegacyWifiRateInfoToHidl(legacy_result.rx_rate, &hidl_result->rxRate)) { + return false; + } + hidl_result->rtt = legacy_result.rtt; + hidl_result->rttSd = legacy_result.rtt_sd; + hidl_result->rttSpread = legacy_result.rtt_spread; + hidl_result->distanceInMm = legacy_result.distance_mm; + hidl_result->distanceSdInMm = legacy_result.distance_sd_mm; + hidl_result->distanceSpreadInMm = legacy_result.distance_spread_mm; + hidl_result->timeStampInUs = legacy_result.ts; + hidl_result->burstDurationInMs = legacy_result.burst_duration; + hidl_result->negotiatedBurstNum = legacy_result.negotiated_burst_num; + if (legacy_result.LCI && !convertLegacyIeToHidl(*legacy_result.LCI, &hidl_result->lci)) { + return false; + } + if (legacy_result.LCR && !convertLegacyIeToHidl(*legacy_result.LCR, &hidl_result->lcr)) { + return false; + } + return true; +} + +bool convertLegacyVectorOfRttResultToHidl( + const std::vector& legacy_results, + std::vector* hidl_results) { + if (!hidl_results) { + return false; + } + *hidl_results = {}; + for (const auto legacy_result : legacy_results) { + V1_6::RttResult hidl_result; + if (!convertLegacyRttResultToHidl(*legacy_result, &hidl_result)) { + return false; + } + hidl_results->push_back(hidl_result); + } + return true; +} + +legacy_hal::wifi_interface_type convertHidlIfaceTypeToLegacy(IfaceType hidl_interface_type) { + switch (hidl_interface_type) { + case IfaceType::STA: + return legacy_hal::WIFI_INTERFACE_TYPE_STA; + case IfaceType::AP: + return legacy_hal::WIFI_INTERFACE_TYPE_AP; + case IfaceType::P2P: + return legacy_hal::WIFI_INTERFACE_TYPE_P2P; + case IfaceType::NAN: + return legacy_hal::WIFI_INTERFACE_TYPE_NAN; + } + CHECK(false); +} + +legacy_hal::wifi_multi_sta_use_case convertHidlMultiStaUseCaseToLegacy( + V1_5::IWifiChip::MultiStaUseCase use_case) { + switch (use_case) { + case V1_5::IWifiChip::MultiStaUseCase::DUAL_STA_TRANSIENT_PREFER_PRIMARY: + return legacy_hal::WIFI_DUAL_STA_TRANSIENT_PREFER_PRIMARY; + case V1_5::IWifiChip::MultiStaUseCase::DUAL_STA_NON_TRANSIENT_UNBIASED: + return legacy_hal::WIFI_DUAL_STA_NON_TRANSIENT_UNBIASED; + } + CHECK(false); +} + +bool convertHidlCoexUnsafeChannelToLegacy( + const V1_5::IWifiChip::CoexUnsafeChannel& hidl_unsafe_channel, + legacy_hal::wifi_coex_unsafe_channel* legacy_unsafe_channel) { + if (!legacy_unsafe_channel) { + return false; + } + *legacy_unsafe_channel = {}; + switch (hidl_unsafe_channel.band) { + case V1_5::WifiBand::BAND_24GHZ: + legacy_unsafe_channel->band = legacy_hal::WLAN_MAC_2_4_BAND; + break; + case V1_5::WifiBand::BAND_5GHZ: + legacy_unsafe_channel->band = legacy_hal::WLAN_MAC_5_0_BAND; + break; + default: + return false; + }; + legacy_unsafe_channel->channel = hidl_unsafe_channel.channel; + legacy_unsafe_channel->power_cap_dbm = hidl_unsafe_channel.powerCapDbm; + return true; +} + +bool convertHidlVectorOfCoexUnsafeChannelToLegacy( + const std::vector& hidl_unsafe_channels, + std::vector* legacy_unsafe_channels) { + if (!legacy_unsafe_channels) { + return false; + } + *legacy_unsafe_channels = {}; + for (const auto& hidl_unsafe_channel : hidl_unsafe_channels) { + legacy_hal::wifi_coex_unsafe_channel legacy_unsafe_channel; + if (!hidl_struct_util::convertHidlCoexUnsafeChannelToLegacy(hidl_unsafe_channel, + &legacy_unsafe_channel)) { + return false; + } + legacy_unsafe_channels->push_back(legacy_unsafe_channel); + } + return true; +} + +V1_6::WifiAntennaMode convertLegacyAntennaConfigurationToHidl(uint32_t antenna_cfg) { + switch (antenna_cfg) { + case legacy_hal::WIFI_ANTENNA_1X1: + return V1_6::WifiAntennaMode::WIFI_ANTENNA_MODE_1X1; + case legacy_hal::WIFI_ANTENNA_2X2: + return V1_6::WifiAntennaMode::WIFI_ANTENNA_MODE_2X2; + case legacy_hal::WIFI_ANTENNA_3X3: + return V1_6::WifiAntennaMode::WIFI_ANTENNA_MODE_3X3; + case legacy_hal::WIFI_ANTENNA_4X4: + return V1_6::WifiAntennaMode::WIFI_ANTENNA_MODE_4X4; + default: + return V1_6::WifiAntennaMode::WIFI_ANTENNA_MODE_UNSPECIFIED; + } +} + +bool convertLegacyWifiRadioConfigurationToHidl( + legacy_hal::wifi_radio_configuration* radio_configuration, + V1_6::WifiRadioConfiguration* hidl_radio_configuration) { + if (!hidl_radio_configuration) { + return false; + } + *hidl_radio_configuration = {}; + hidl_radio_configuration->bandInfo = + hidl_struct_util::convertLegacyMacBandToHidlWifiBand(radio_configuration->band); + if (hidl_radio_configuration->bandInfo == V1_5::WifiBand::BAND_UNSPECIFIED) { + LOG(ERROR) << "Unspecified band"; + return false; + } + hidl_radio_configuration->antennaMode = + hidl_struct_util::convertLegacyAntennaConfigurationToHidl( + radio_configuration->antenna_cfg); + return true; +} + +bool convertLegacyRadioCombinationsMatrixToHidl( + legacy_hal::wifi_radio_combination_matrix* legacy_matrix, + WifiRadioCombinationMatrix* hidl_matrix) { + if (!hidl_matrix || !legacy_matrix) { + return false; + } + *hidl_matrix = {}; + + int num_combinations = legacy_matrix->num_radio_combinations; + std::vector radio_combinations_vec; + if (!num_combinations) { + LOG(ERROR) << "zero radio combinations"; + return false; + } + wifi_radio_combination* l_radio_combinations_ptr = legacy_matrix->radio_combinations; + for (int i = 0; i < num_combinations; i++) { + int num_configurations = l_radio_combinations_ptr->num_radio_configurations; + WifiRadioCombination radioCombination; + std::vector radio_configurations_vec; + if (!num_configurations) { + LOG(ERROR) << "zero radio configurations"; + return false; + } + for (int j = 0; j < num_configurations; j++) { + WifiRadioConfiguration radioConfiguration; + wifi_radio_configuration* l_radio_configurations_ptr = + &l_radio_combinations_ptr->radio_configurations[j]; + if (!hidl_struct_util::convertLegacyWifiRadioConfigurationToHidl( + l_radio_configurations_ptr, &radioConfiguration)) { + LOG(ERROR) << "Error converting wifi radio configuration"; + return false; + } + radio_configurations_vec.push_back(radioConfiguration); + } + radioCombination.radioConfigurations = radio_configurations_vec; + radio_combinations_vec.push_back(radioCombination); + l_radio_combinations_ptr = + (wifi_radio_combination*)((u8*)l_radio_combinations_ptr + + sizeof(wifi_radio_combination) + + (sizeof(wifi_radio_configuration) * num_configurations)); + } + hidl_matrix->radioCombinations = radio_combinations_vec; + return true; +} + +} // namespace hidl_struct_util +} // namespace implementation +} // namespace V1_6 +} // namespace wifi +} // namespace hardware +} // namespace android diff --git a/wifi/1.6/default/hidl_struct_util.h b/wifi/1.6/default/hidl_struct_util.h new file mode 100644 index 0000000000..2d4a5f13f4 --- /dev/null +++ b/wifi/1.6/default/hidl_struct_util.h @@ -0,0 +1,204 @@ +/* + * Copyright (C) 2016 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. + */ + +#ifndef HIDL_STRUCT_UTIL_H_ +#define HIDL_STRUCT_UTIL_H_ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "wifi_legacy_hal.h" + +/** + * This file contains a bunch of functions to convert structs from the legacy + * HAL to HIDL and vice versa. + * TODO(b/32093047): Add unit tests for these conversion methods in the VTS test + * suite. + */ +namespace android { +namespace hardware { +namespace wifi { +namespace V1_6 { +namespace implementation { +namespace hidl_struct_util { +using namespace android::hardware::wifi::V1_0; + +// Chip conversion methods. +bool convertLegacyFeaturesToHidlChipCapabilities(uint64_t legacy_feature_set, + uint32_t legacy_logger_feature_set, + uint32_t* hidl_caps); +bool convertLegacyDebugRingBufferStatusToHidl( + const legacy_hal::wifi_ring_buffer_status& legacy_status, + WifiDebugRingBufferStatus* hidl_status); +bool convertLegacyVectorOfDebugRingBufferStatusToHidl( + const std::vector& legacy_status_vec, + std::vector* hidl_status_vec); +bool convertLegacyWakeReasonStatsToHidl(const legacy_hal::WakeReasonStats& legacy_stats, + WifiDebugHostWakeReasonStats* hidl_stats); +legacy_hal::wifi_power_scenario convertHidlTxPowerScenarioToLegacy( + V1_1::IWifiChip::TxPowerScenario hidl_scenario); +legacy_hal::wifi_latency_mode convertHidlLatencyModeToLegacy( + V1_3::IWifiChip::LatencyMode hidl_latency_mode); +legacy_hal::wifi_power_scenario convertHidlTxPowerScenarioToLegacy_1_2( + V1_2::IWifiChip::TxPowerScenario hidl_scenario); +bool convertLegacyWifiMacInfosToHidl( + const std::vector& legacy_mac_infos, + std::vector* hidl_radio_mode_infos); +legacy_hal::wifi_interface_type convertHidlIfaceTypeToLegacy(IfaceType hidl_interface_type); +legacy_hal::wifi_multi_sta_use_case convertHidlMultiStaUseCaseToLegacy( + V1_5::IWifiChip::MultiStaUseCase use_case); +bool convertHidlCoexUnsafeChannelToLegacy( + const V1_5::IWifiChip::CoexUnsafeChannel& hidl_unsafe_channel, + legacy_hal::wifi_coex_unsafe_channel* legacy_unsafe_channel); +bool convertHidlVectorOfCoexUnsafeChannelToLegacy( + const std::vector& hidl_unsafe_channels, + std::vector* legacy_unsafe_channels); +bool convertLegacyRadioCombinationsMatrixToHidl( + legacy_hal::wifi_radio_combination_matrix* legacy_matrix, + V1_6::WifiRadioCombinationMatrix* hidl_matrix); +V1_5::WifiBand convertLegacyMacBandToHidlWifiBand(uint32_t band); +V1_6::WifiAntennaMode convertLegacyAntennaConfigurationToHidl(uint32_t antenna_cfg); + +// STA iface conversion methods. +bool convertLegacyFeaturesToHidlStaCapabilities(uint64_t legacy_feature_set, + uint32_t legacy_logger_feature_set, + uint32_t* hidl_caps); +bool convertLegacyApfCapabilitiesToHidl(const legacy_hal::PacketFilterCapabilities& legacy_caps, + StaApfPacketFilterCapabilities* hidl_caps); +bool convertLegacyGscanCapabilitiesToHidl(const legacy_hal::wifi_gscan_capabilities& legacy_caps, + StaBackgroundScanCapabilities* hidl_caps); +legacy_hal::wifi_band convertHidlWifiBandToLegacy(V1_0::WifiBand band); +bool convertHidlGscanParamsToLegacy(const StaBackgroundScanParameters& hidl_scan_params, + legacy_hal::wifi_scan_cmd_params* legacy_scan_params); +// |has_ie_data| indicates whether or not the wifi_scan_result includes 802.11 +// Information Elements (IEs) +bool convertLegacyGscanResultToHidl(const legacy_hal::wifi_scan_result& legacy_scan_result, + bool has_ie_data, StaScanResult* hidl_scan_result); +// |cached_results| is assumed to not include IEs. +bool convertLegacyVectorOfCachedGscanResultsToHidl( + const std::vector& legacy_cached_scan_results, + std::vector* hidl_scan_datas); +bool convertLegacyLinkLayerStatsToHidl(const legacy_hal::LinkLayerStats& legacy_stats, + V1_6::StaLinkLayerStats* hidl_stats); +bool convertLegacyRoamingCapabilitiesToHidl( + const legacy_hal::wifi_roaming_capabilities& legacy_caps, + StaRoamingCapabilities* hidl_caps); +bool convertHidlRoamingConfigToLegacy(const StaRoamingConfig& hidl_config, + legacy_hal::wifi_roaming_config* legacy_config); +legacy_hal::fw_roaming_state_t convertHidlRoamingStateToLegacy(StaRoamingState state); +bool convertLegacyVectorOfDebugTxPacketFateToHidl( + const std::vector& legacy_fates, + std::vector* hidl_fates); +bool convertLegacyVectorOfDebugRxPacketFateToHidl( + const std::vector& legacy_fates, + std::vector* hidl_fates); + +// NAN iface conversion methods. +void convertToWifiNanStatus(legacy_hal::NanStatusType type, const char* str, size_t max_len, + WifiNanStatus* wifiNanStatus); +bool convertHidlNanEnableRequestToLegacy(const V1_4::NanEnableRequest& hidl_request, + legacy_hal::NanEnableRequest* legacy_request); +bool convertHidlNanConfigRequestToLegacy(const V1_4::NanConfigRequest& hidl_request, + legacy_hal::NanConfigRequest* legacy_request); +bool convertHidlNanEnableRequest_1_6ToLegacy( + const V1_4::NanEnableRequest& hidl_request1, + const V1_6::NanConfigRequestSupplemental& hidl_request2, + legacy_hal::NanEnableRequest* legacy_request); +bool convertHidlNanConfigRequest_1_6ToLegacy( + const V1_4::NanConfigRequest& hidl_request1, + const V1_6::NanConfigRequestSupplemental& hidl_request2, + legacy_hal::NanConfigRequest* legacy_request); +bool convertHidlNanPublishRequestToLegacy(const V1_6::NanPublishRequest& hidl_request, + legacy_hal::NanPublishRequest* legacy_request); +bool convertHidlNanSubscribeRequestToLegacy(const V1_0::NanSubscribeRequest& hidl_request, + legacy_hal::NanSubscribeRequest* legacy_request); +bool convertHidlNanTransmitFollowupRequestToLegacy( + const NanTransmitFollowupRequest& hidl_request, + legacy_hal::NanTransmitFollowupRequest* legacy_request); +bool convertHidlNanDataPathInitiatorRequestToLegacy( + const V1_0::NanInitiateDataPathRequest& hidl_request, + legacy_hal::NanDataPathInitiatorRequest* legacy_request); +bool convertHidlNanDataPathIndicationResponseToLegacy( + const V1_0::NanRespondToDataPathIndicationRequest& hidl_response, + legacy_hal::NanDataPathIndicationResponse* legacy_response); +bool convertHidlNanDataPathInitiatorRequest_1_6ToLegacy( + const V1_6::NanInitiateDataPathRequest& hidl_request, + legacy_hal::NanDataPathInitiatorRequest* legacy_request); +bool convertHidlNanDataPathIndicationResponse_1_6ToLegacy( + const V1_6::NanRespondToDataPathIndicationRequest& hidl_response, + legacy_hal::NanDataPathIndicationResponse* legacy_response); + +bool convertLegacyNanResponseHeaderToHidl(const legacy_hal::NanResponseMsg& legacy_response, + WifiNanStatus* wifiNanStatus); +bool convertLegacyNanCapabilitiesResponseToHidl(const legacy_hal::NanCapabilities& legacy_response, + V1_6::NanCapabilities* hidl_response); +bool convertLegacyNanMatchIndToHidl(const legacy_hal::NanMatchInd& legacy_ind, + V1_6::NanMatchInd* hidl_ind); +bool convertLegacyNanFollowupIndToHidl(const legacy_hal::NanFollowupInd& legacy_ind, + NanFollowupReceivedInd* hidl_ind); +bool convertLegacyNanDataPathRequestIndToHidl(const legacy_hal::NanDataPathRequestInd& legacy_ind, + NanDataPathRequestInd* hidl_ind); +bool convertLegacyNanDataPathConfirmIndToHidl(const legacy_hal::NanDataPathConfirmInd& legacy_ind, + V1_6::NanDataPathConfirmInd* hidl_ind); +bool convertLegacyNanDataPathScheduleUpdateIndToHidl( + const legacy_hal::NanDataPathScheduleUpdateInd& legacy_ind, + V1_6::NanDataPathScheduleUpdateInd* hidl_ind); + +// RTT controller conversion methods. +bool convertHidlVectorOfRttConfigToLegacy(const std::vector& hidl_configs, + std::vector* legacy_configs); +bool convertHidlRttLciInformationToLegacy(const RttLciInformation& hidl_info, + legacy_hal::wifi_lci_information* legacy_info); +bool convertHidlRttLcrInformationToLegacy(const RttLcrInformation& hidl_info, + legacy_hal::wifi_lcr_information* legacy_info); +bool convertHidlRttResponderToLegacy(const V1_6::RttResponder& hidl_responder, + legacy_hal::wifi_rtt_responder* legacy_responder); +bool convertHidlWifiChannelInfoToLegacy(const V1_6::WifiChannelInfo& hidl_info, + legacy_hal::wifi_channel_info* legacy_info); +bool convertLegacyRttResponderToHidl(const legacy_hal::wifi_rtt_responder& legacy_responder, + V1_6::RttResponder* hidl_responder); +bool convertLegacyRttCapabilitiesToHidl( + const legacy_hal::wifi_rtt_capabilities& legacy_capabilities, + V1_6::RttCapabilities* hidl_capabilities); +bool convertLegacyVectorOfRttResultToHidl( + const std::vector& legacy_results, + std::vector* hidl_results); +uint32_t convertHidlWifiBandToLegacyMacBand(V1_5::WifiBand band); +uint32_t convertHidlWifiIfaceModeToLegacy(uint32_t hidl_iface_mask); +uint32_t convertHidlUsableChannelFilterToLegacy(uint32_t hidl_filter_mask); +bool convertLegacyWifiUsableChannelsToHidl( + const std::vector& legacy_usable_channels, + std::vector* hidl_usable_channels); +bool convertLegacyPeerInfoStatsToHidl(const legacy_hal::WifiPeerInfo& legacy_peer_info_stats, + V1_6::StaPeerInfo* hidl_peer_info_stats); +bool convertLegacyWifiRateInfoToHidl(const legacy_hal::wifi_rate& legacy_rate, + V1_6::WifiRateInfo* hidl_rate); +} // namespace hidl_struct_util +} // namespace implementation +} // namespace V1_6 +} // namespace wifi +} // namespace hardware +} // namespace android + +#endif // HIDL_STRUCT_UTIL_H_ diff --git a/wifi/aidl/default/aidl_sync_util.cpp b/wifi/1.6/default/hidl_sync_util.cpp similarity index 78% rename from wifi/aidl/default/aidl_sync_util.cpp rename to wifi/1.6/default/hidl_sync_util.cpp index d81eb81182..358d95e668 100644 --- a/wifi/aidl/default/aidl_sync_util.cpp +++ b/wifi/1.6/default/hidl_sync_util.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2016 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. @@ -14,24 +14,26 @@ * limitations under the License. */ -#include "aidl_sync_util.h" +#include "hidl_sync_util.h" namespace { std::recursive_mutex g_mutex; } // namespace -namespace aidl { namespace android { namespace hardware { namespace wifi { -namespace aidl_sync_util { +namespace V1_6 { +namespace implementation { +namespace hidl_sync_util { std::unique_lock acquireGlobalLock() { return std::unique_lock{g_mutex}; } -} // namespace aidl_sync_util +} // namespace hidl_sync_util +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl diff --git a/wifi/aidl/default/aidl_sync_util.h b/wifi/1.6/default/hidl_sync_util.h similarity index 71% rename from wifi/aidl/default/aidl_sync_util.h rename to wifi/1.6/default/hidl_sync_util.h index a61cd3f57c..2c1c37b0ad 100644 --- a/wifi/aidl/default/aidl_sync_util.h +++ b/wifi/1.6/default/hidl_sync_util.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2016 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. @@ -14,22 +14,24 @@ * limitations under the License. */ -#ifndef AIDL_SYNC_UTIL_H_ -#define AIDL_SYNC_UTIL_H_ +#ifndef HIDL_SYNC_UTIL_H_ +#define HIDL_SYNC_UTIL_H_ #include // Utility that provides a global lock to synchronize access between -// the AIDL thread and the legacy HAL's event loop. -namespace aidl { +// the HIDL thread and the legacy HAL's event loop. namespace android { namespace hardware { namespace wifi { -namespace aidl_sync_util { +namespace V1_6 { +namespace implementation { +namespace hidl_sync_util { std::unique_lock acquireGlobalLock(); -} // namespace aidl_sync_util +} // namespace hidl_sync_util +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl -#endif // AIDL_SYNC_UTIL_H_ +#endif // HIDL_SYNC_UTIL_H_ diff --git a/wifi/aidl/default/ringbuffer.cpp b/wifi/1.6/default/ringbuffer.cpp similarity index 92% rename from wifi/aidl/default/ringbuffer.cpp rename to wifi/1.6/default/ringbuffer.cpp index 9d08a7368e..981bf7bce7 100644 --- a/wifi/aidl/default/ringbuffer.cpp +++ b/wifi/1.6/default/ringbuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2018 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. @@ -14,14 +14,15 @@ * limitations under the License. */ -#include "ringbuffer.h" - #include -namespace aidl { +#include "ringbuffer.h" + namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { Ringbuffer::Ringbuffer(size_t maxSize) : size_(0), maxSize_(maxSize) {} @@ -56,7 +57,8 @@ void Ringbuffer::clear() { size_ = 0; } +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl diff --git a/wifi/aidl/default/ringbuffer.h b/wifi/1.6/default/ringbuffer.h similarity index 90% rename from wifi/aidl/default/ringbuffer.h rename to wifi/1.6/default/ringbuffer.h index 80c0c11045..c6a1e4c52d 100644 --- a/wifi/aidl/default/ringbuffer.h +++ b/wifi/1.6/default/ringbuffer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2018 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. @@ -20,10 +20,11 @@ #include #include -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { /** * Ringbuffer object used to store debug data. @@ -52,9 +53,10 @@ class Ringbuffer { size_t maxSize_; }; +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl #endif // RINGBUFFER_H_ diff --git a/wifi/1.6/default/service.cpp b/wifi/1.6/default/service.cpp new file mode 100644 index 0000000000..c874d8b199 --- /dev/null +++ b/wifi/1.6/default/service.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2016 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. + */ + +#include +#include +#include +#include +#include +#include + +#include "wifi.h" +#include "wifi_feature_flags.h" +#include "wifi_legacy_hal.h" +#include "wifi_legacy_hal_factory.h" +#include "wifi_mode_controller.h" + +using android::hardware::configureRpcThreadpool; +using android::hardware::joinRpcThreadpool; +using android::hardware::LazyServiceRegistrar; +using android::hardware::wifi::V1_6::implementation::feature_flags::WifiFeatureFlags; +using android::hardware::wifi::V1_6::implementation::legacy_hal::WifiLegacyHal; +using android::hardware::wifi::V1_6::implementation::legacy_hal::WifiLegacyHalFactory; +using android::hardware::wifi::V1_6::implementation::mode_controller::WifiModeController; + +#ifdef LAZY_SERVICE +const bool kLazyService = true; +#else +const bool kLazyService = false; +#endif + +int main(int /*argc*/, char** argv) { + signal(SIGPIPE, SIG_IGN); + android::base::InitLogging(argv, android::base::LogdLogger(android::base::SYSTEM)); + LOG(INFO) << "Wifi Hal is booting up..."; + + configureRpcThreadpool(1, true /* callerWillJoin */); + + const auto iface_tool = std::make_shared(); + const auto legacy_hal_factory = std::make_shared(iface_tool); + + // Setup hwbinder service + android::sp service = + new android::hardware::wifi::V1_6::implementation::Wifi( + iface_tool, legacy_hal_factory, std::make_shared(), + std::make_shared()); + if (kLazyService) { + auto registrar = LazyServiceRegistrar::getInstance(); + CHECK_EQ(registrar.registerService(service), android::NO_ERROR) + << "Failed to register wifi HAL"; + } else { + CHECK_EQ(service->registerAsService(), android::NO_ERROR) << "Failed to register wifi HAL"; + } + + joinRpcThreadpool(); + + LOG(INFO) << "Wifi Hal is terminating..."; + return 0; +} diff --git a/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp b/wifi/1.6/default/tests/hidl_struct_util_unit_tests.cpp similarity index 69% rename from wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp rename to wifi/1.6/default/tests/hidl_struct_util_unit_tests.cpp index 4a69c2426b..0dd0aa15bb 100644 --- a/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp +++ b/wifi/1.6/default/tests/hidl_struct_util_unit_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2017, 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. @@ -18,7 +18,8 @@ #include #include -#include "aidl_struct_util.h" +#undef NAN +#include "hidl_struct_util.h" using testing::Test; @@ -30,15 +31,17 @@ constexpr uint32_t kIfaceChannel2 = 5; constexpr char kIfaceName1[] = "wlan0"; constexpr char kIfaceName2[] = "wlan1"; } // namespace - -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { +using namespace android::hardware::wifi::V1_0; +using ::android::hardware::wifi::V1_6::WifiChannelWidthInMhz; -class AidlStructUtilTest : public Test {}; +class HidlStructUtilTest : public Test {}; -TEST_F(AidlStructUtilTest, CanConvertLegacyWifiMacInfosToAidlWithOneMac) { +TEST_F(HidlStructUtilTest, CanConvertLegacyWifiMacInfosToHidlWithOneMac) { std::vector legacy_mac_infos; legacy_hal::WifiMacInfo legacy_mac_info1 = { .wlan_mac_id = kMacId1, @@ -49,24 +52,24 @@ TEST_F(AidlStructUtilTest, CanConvertLegacyWifiMacInfosToAidlWithOneMac) { legacy_mac_info1.iface_infos.push_back(legacy_iface_info2); legacy_mac_infos.push_back(legacy_mac_info1); - std::vector aidl_radio_mode_infos; - ASSERT_TRUE(aidl_struct_util::convertLegacyWifiMacInfosToAidl(legacy_mac_infos, - &aidl_radio_mode_infos)); + std::vector hidl_radio_mode_infos; + ASSERT_TRUE(hidl_struct_util::convertLegacyWifiMacInfosToHidl(legacy_mac_infos, + &hidl_radio_mode_infos)); - ASSERT_EQ(1u, aidl_radio_mode_infos.size()); - auto aidl_radio_mode_info1 = aidl_radio_mode_infos[0]; - EXPECT_EQ(legacy_mac_info1.wlan_mac_id, (uint32_t)aidl_radio_mode_info1.radioId); - EXPECT_EQ(WifiBand::BAND_24GHZ_5GHZ, aidl_radio_mode_info1.bandInfo); - ASSERT_EQ(2u, aidl_radio_mode_info1.ifaceInfos.size()); - auto aidl_iface_info1 = aidl_radio_mode_info1.ifaceInfos[0]; - EXPECT_EQ(legacy_iface_info1.name, aidl_iface_info1.name); - EXPECT_EQ(static_cast(legacy_iface_info1.channel), aidl_iface_info1.channel); - auto aidl_iface_info2 = aidl_radio_mode_info1.ifaceInfos[1]; - EXPECT_EQ(legacy_iface_info2.name, aidl_iface_info2.name); - EXPECT_EQ(static_cast(legacy_iface_info2.channel), aidl_iface_info2.channel); + ASSERT_EQ(1u, hidl_radio_mode_infos.size()); + auto hidl_radio_mode_info1 = hidl_radio_mode_infos[0]; + EXPECT_EQ(legacy_mac_info1.wlan_mac_id, hidl_radio_mode_info1.radioId); + EXPECT_EQ(V1_4::WifiBand::BAND_24GHZ_5GHZ, hidl_radio_mode_info1.bandInfo); + ASSERT_EQ(2u, hidl_radio_mode_info1.ifaceInfos.size()); + auto hidl_iface_info1 = hidl_radio_mode_info1.ifaceInfos[0]; + EXPECT_EQ(legacy_iface_info1.name, hidl_iface_info1.name); + EXPECT_EQ(static_cast(legacy_iface_info1.channel), hidl_iface_info1.channel); + auto hidl_iface_info2 = hidl_radio_mode_info1.ifaceInfos[1]; + EXPECT_EQ(legacy_iface_info2.name, hidl_iface_info2.name); + EXPECT_EQ(static_cast(legacy_iface_info2.channel), hidl_iface_info2.channel); } -TEST_F(AidlStructUtilTest, CanConvertLegacyWifiMacInfosToAidlWithTwoMac) { +TEST_F(HidlStructUtilTest, CanConvertLegacyWifiMacInfosToHidlWithTwoMac) { std::vector legacy_mac_infos; legacy_hal::WifiMacInfo legacy_mac_info1 = {.wlan_mac_id = kMacId1, .mac_band = legacy_hal::WLAN_MAC_5_0_BAND}; @@ -79,40 +82,40 @@ TEST_F(AidlStructUtilTest, CanConvertLegacyWifiMacInfosToAidlWithTwoMac) { legacy_mac_info2.iface_infos.push_back(legacy_iface_info2); legacy_mac_infos.push_back(legacy_mac_info2); - std::vector aidl_radio_mode_infos; - ASSERT_TRUE(aidl_struct_util::convertLegacyWifiMacInfosToAidl(legacy_mac_infos, - &aidl_radio_mode_infos)); + std::vector hidl_radio_mode_infos; + ASSERT_TRUE(hidl_struct_util::convertLegacyWifiMacInfosToHidl(legacy_mac_infos, + &hidl_radio_mode_infos)); - ASSERT_EQ(2u, aidl_radio_mode_infos.size()); + ASSERT_EQ(2u, hidl_radio_mode_infos.size()); // Find mac info 1. - const auto aidl_radio_mode_info1 = - std::find_if(aidl_radio_mode_infos.begin(), aidl_radio_mode_infos.end(), - [&legacy_mac_info1](const IWifiChipEventCallback::RadioModeInfo& x) { - return (uint32_t)x.radioId == legacy_mac_info1.wlan_mac_id; + const auto hidl_radio_mode_info1 = + std::find_if(hidl_radio_mode_infos.begin(), hidl_radio_mode_infos.end(), + [&legacy_mac_info1](const V1_4::IWifiChipEventCallback::RadioModeInfo& x) { + return x.radioId == legacy_mac_info1.wlan_mac_id; }); - ASSERT_NE(aidl_radio_mode_infos.end(), aidl_radio_mode_info1); - EXPECT_EQ(WifiBand::BAND_5GHZ, aidl_radio_mode_info1->bandInfo); - ASSERT_EQ(1u, aidl_radio_mode_info1->ifaceInfos.size()); - auto aidl_iface_info1 = aidl_radio_mode_info1->ifaceInfos[0]; - EXPECT_EQ(legacy_iface_info1.name, aidl_iface_info1.name); - EXPECT_EQ(static_cast(legacy_iface_info1.channel), aidl_iface_info1.channel); + ASSERT_NE(hidl_radio_mode_infos.end(), hidl_radio_mode_info1); + EXPECT_EQ(V1_4::WifiBand::BAND_5GHZ, hidl_radio_mode_info1->bandInfo); + ASSERT_EQ(1u, hidl_radio_mode_info1->ifaceInfos.size()); + auto hidl_iface_info1 = hidl_radio_mode_info1->ifaceInfos[0]; + EXPECT_EQ(legacy_iface_info1.name, hidl_iface_info1.name); + EXPECT_EQ(static_cast(legacy_iface_info1.channel), hidl_iface_info1.channel); // Find mac info 2. - const auto aidl_radio_mode_info2 = - std::find_if(aidl_radio_mode_infos.begin(), aidl_radio_mode_infos.end(), - [&legacy_mac_info2](const IWifiChipEventCallback::RadioModeInfo& x) { - return (uint32_t)x.radioId == legacy_mac_info2.wlan_mac_id; + const auto hidl_radio_mode_info2 = + std::find_if(hidl_radio_mode_infos.begin(), hidl_radio_mode_infos.end(), + [&legacy_mac_info2](const V1_4::IWifiChipEventCallback::RadioModeInfo& x) { + return x.radioId == legacy_mac_info2.wlan_mac_id; }); - ASSERT_NE(aidl_radio_mode_infos.end(), aidl_radio_mode_info2); - EXPECT_EQ(WifiBand::BAND_24GHZ, aidl_radio_mode_info2->bandInfo); - ASSERT_EQ(1u, aidl_radio_mode_info2->ifaceInfos.size()); - auto aidl_iface_info2 = aidl_radio_mode_info2->ifaceInfos[0]; - EXPECT_EQ(legacy_iface_info2.name, aidl_iface_info2.name); - EXPECT_EQ(static_cast(legacy_iface_info2.channel), aidl_iface_info2.channel); + ASSERT_NE(hidl_radio_mode_infos.end(), hidl_radio_mode_info2); + EXPECT_EQ(V1_4::WifiBand::BAND_24GHZ, hidl_radio_mode_info2->bandInfo); + ASSERT_EQ(1u, hidl_radio_mode_info2->ifaceInfos.size()); + auto hidl_iface_info2 = hidl_radio_mode_info2->ifaceInfos[0]; + EXPECT_EQ(legacy_iface_info2.name, hidl_iface_info2.name); + EXPECT_EQ(static_cast(legacy_iface_info2.channel), hidl_iface_info2.channel); } -TEST_F(AidlStructUtilTest, canConvertLegacyLinkLayerStatsToAidl) { +TEST_F(HidlStructUtilTest, canConvertLegacyLinkLayerStatsToHidl) { legacy_hal::LinkLayerStats legacy_stats{}; legacy_stats.radios.push_back(legacy_hal::LinkLayerRadioStats{}); legacy_stats.radios.push_back(legacy_hal::LinkLayerRadioStats{}); @@ -213,77 +216,77 @@ TEST_F(AidlStructUtilTest, canConvertLegacyLinkLayerStatsToAidl) { peer.rate_stats.push_back(rate_stat2); } - StaLinkLayerStats converted{}; - aidl_struct_util::convertLegacyLinkLayerStatsToAidl(legacy_stats, &converted); - EXPECT_EQ(legacy_stats.iface.beacon_rx, (uint32_t)converted.iface.beaconRx); - EXPECT_EQ(legacy_stats.iface.rssi_mgmt, converted.iface.avgRssiMgmt); + V1_6::StaLinkLayerStats converted{}; + hidl_struct_util::convertLegacyLinkLayerStatsToHidl(legacy_stats, &converted); + EXPECT_EQ(legacy_stats.iface.beacon_rx, converted.iface.V1_0.beaconRx); + EXPECT_EQ(legacy_stats.iface.rssi_mgmt, converted.iface.V1_0.avgRssiMgmt); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].rx_mpdu, - converted.iface.wmeBePktStats.rxMpdu); + converted.iface.V1_0.wmeBePktStats.rxMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].tx_mpdu, - converted.iface.wmeBePktStats.txMpdu); + converted.iface.V1_0.wmeBePktStats.txMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].mpdu_lost, - converted.iface.wmeBePktStats.lostMpdu); + converted.iface.V1_0.wmeBePktStats.lostMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].retries, - converted.iface.wmeBePktStats.retries); + converted.iface.V1_0.wmeBePktStats.retries); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_min, - (uint32_t)converted.iface.wmeBeContentionTimeStats.contentionTimeMinInUsec); + converted.iface.wmeBeContentionTimeStats.contentionTimeMinInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_max, - (uint32_t)converted.iface.wmeBeContentionTimeStats.contentionTimeMaxInUsec); + converted.iface.wmeBeContentionTimeStats.contentionTimeMaxInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_avg, - (uint32_t)converted.iface.wmeBeContentionTimeStats.contentionTimeAvgInUsec); + converted.iface.wmeBeContentionTimeStats.contentionTimeAvgInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_num_samples, - (uint32_t)converted.iface.wmeBeContentionTimeStats.contentionNumSamples); + converted.iface.wmeBeContentionTimeStats.contentionNumSamples); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].rx_mpdu, - converted.iface.wmeBkPktStats.rxMpdu); + converted.iface.V1_0.wmeBkPktStats.rxMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].tx_mpdu, - converted.iface.wmeBkPktStats.txMpdu); + converted.iface.V1_0.wmeBkPktStats.txMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].mpdu_lost, - converted.iface.wmeBkPktStats.lostMpdu); + converted.iface.V1_0.wmeBkPktStats.lostMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].retries, - converted.iface.wmeBkPktStats.retries); + converted.iface.V1_0.wmeBkPktStats.retries); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_min, - (uint32_t)converted.iface.wmeBkContentionTimeStats.contentionTimeMinInUsec); + converted.iface.wmeBkContentionTimeStats.contentionTimeMinInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_max, - (uint32_t)converted.iface.wmeBkContentionTimeStats.contentionTimeMaxInUsec); + converted.iface.wmeBkContentionTimeStats.contentionTimeMaxInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_avg, - (uint32_t)converted.iface.wmeBkContentionTimeStats.contentionTimeAvgInUsec); + converted.iface.wmeBkContentionTimeStats.contentionTimeAvgInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_num_samples, - (uint32_t)converted.iface.wmeBkContentionTimeStats.contentionNumSamples); + converted.iface.wmeBkContentionTimeStats.contentionNumSamples); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].rx_mpdu, - converted.iface.wmeViPktStats.rxMpdu); + converted.iface.V1_0.wmeViPktStats.rxMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].tx_mpdu, - converted.iface.wmeViPktStats.txMpdu); + converted.iface.V1_0.wmeViPktStats.txMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].mpdu_lost, - converted.iface.wmeViPktStats.lostMpdu); + converted.iface.V1_0.wmeViPktStats.lostMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].retries, - converted.iface.wmeViPktStats.retries); + converted.iface.V1_0.wmeViPktStats.retries); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_min, - (uint32_t)converted.iface.wmeViContentionTimeStats.contentionTimeMinInUsec); + converted.iface.wmeViContentionTimeStats.contentionTimeMinInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_max, - (uint32_t)converted.iface.wmeViContentionTimeStats.contentionTimeMaxInUsec); + converted.iface.wmeViContentionTimeStats.contentionTimeMaxInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_avg, - (uint32_t)converted.iface.wmeViContentionTimeStats.contentionTimeAvgInUsec); + converted.iface.wmeViContentionTimeStats.contentionTimeAvgInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_num_samples, - (uint32_t)converted.iface.wmeViContentionTimeStats.contentionNumSamples); + converted.iface.wmeViContentionTimeStats.contentionNumSamples); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].rx_mpdu, - converted.iface.wmeVoPktStats.rxMpdu); + converted.iface.V1_0.wmeVoPktStats.rxMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].tx_mpdu, - converted.iface.wmeVoPktStats.txMpdu); + converted.iface.V1_0.wmeVoPktStats.txMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].mpdu_lost, - converted.iface.wmeVoPktStats.lostMpdu); + converted.iface.V1_0.wmeVoPktStats.lostMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].retries, - converted.iface.wmeVoPktStats.retries); + converted.iface.V1_0.wmeVoPktStats.retries); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_min, - (uint32_t)converted.iface.wmeVoContentionTimeStats.contentionTimeMinInUsec); + converted.iface.wmeVoContentionTimeStats.contentionTimeMinInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_max, - (uint32_t)converted.iface.wmeVoContentionTimeStats.contentionTimeMaxInUsec); + converted.iface.wmeVoContentionTimeStats.contentionTimeMaxInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_avg, - (uint32_t)converted.iface.wmeVoContentionTimeStats.contentionTimeAvgInUsec); + converted.iface.wmeVoContentionTimeStats.contentionTimeAvgInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_num_samples, - (uint32_t)converted.iface.wmeVoContentionTimeStats.contentionNumSamples); + converted.iface.wmeVoContentionTimeStats.contentionNumSamples); EXPECT_EQ(legacy_stats.iface.info.time_slicing_duty_cycle_percent, converted.iface.timeSliceDutyCycleInPercent); @@ -291,43 +294,42 @@ TEST_F(AidlStructUtilTest, canConvertLegacyLinkLayerStatsToAidl) { EXPECT_EQ(legacy_stats.radios.size(), converted.radios.size()); for (size_t i = 0; i < legacy_stats.radios.size(); i++) { EXPECT_EQ(legacy_stats.radios[i].stats.radio, converted.radios[i].radioId); - EXPECT_EQ(legacy_stats.radios[i].stats.on_time, (uint32_t)converted.radios[i].onTimeInMs); - EXPECT_EQ(legacy_stats.radios[i].stats.tx_time, (uint32_t)converted.radios[i].txTimeInMs); - EXPECT_EQ(legacy_stats.radios[i].stats.rx_time, (uint32_t)converted.radios[i].rxTimeInMs); + EXPECT_EQ(legacy_stats.radios[i].stats.on_time, converted.radios[i].V1_0.onTimeInMs); + EXPECT_EQ(legacy_stats.radios[i].stats.tx_time, converted.radios[i].V1_0.txTimeInMs); + EXPECT_EQ(legacy_stats.radios[i].stats.rx_time, converted.radios[i].V1_0.rxTimeInMs); EXPECT_EQ(legacy_stats.radios[i].stats.on_time_scan, - (uint32_t)converted.radios[i].onTimeInMsForScan); + converted.radios[i].V1_0.onTimeInMsForScan); EXPECT_EQ(legacy_stats.radios[i].tx_time_per_levels.size(), - converted.radios[i].txTimeInMsPerLevel.size()); + converted.radios[i].V1_0.txTimeInMsPerLevel.size()); for (size_t j = 0; j < legacy_stats.radios[i].tx_time_per_levels.size(); j++) { EXPECT_EQ(legacy_stats.radios[i].tx_time_per_levels[j], - (uint32_t)converted.radios[i].txTimeInMsPerLevel[j]); + converted.radios[i].V1_0.txTimeInMsPerLevel[j]); } EXPECT_EQ(legacy_stats.radios[i].stats.on_time_nbd, - (uint32_t)converted.radios[i].onTimeInMsForNanScan); + converted.radios[i].onTimeInMsForNanScan); EXPECT_EQ(legacy_stats.radios[i].stats.on_time_gscan, - (uint32_t)converted.radios[i].onTimeInMsForBgScan); + converted.radios[i].onTimeInMsForBgScan); EXPECT_EQ(legacy_stats.radios[i].stats.on_time_roam_scan, - (uint32_t)converted.radios[i].onTimeInMsForRoamScan); + converted.radios[i].onTimeInMsForRoamScan); EXPECT_EQ(legacy_stats.radios[i].stats.on_time_pno_scan, - (uint32_t)converted.radios[i].onTimeInMsForPnoScan); + converted.radios[i].onTimeInMsForPnoScan); EXPECT_EQ(legacy_stats.radios[i].stats.on_time_hs20, - (uint32_t)converted.radios[i].onTimeInMsForHs20Scan); + converted.radios[i].onTimeInMsForHs20Scan); EXPECT_EQ(legacy_stats.radios[i].channel_stats.size(), converted.radios[i].channelStats.size()); for (size_t k = 0; k < legacy_stats.radios[i].channel_stats.size(); k++) { auto& legacy_channel_st = legacy_stats.radios[i].channel_stats[k]; EXPECT_EQ(WifiChannelWidthInMhz::WIDTH_20, converted.radios[i].channelStats[k].channel.width); - EXPECT_EQ(legacy_channel_st.channel.center_freq, + EXPECT_EQ(WifiChannelInMhz(legacy_channel_st.channel.center_freq), converted.radios[i].channelStats[k].channel.centerFreq); - EXPECT_EQ(legacy_channel_st.channel.center_freq0, + EXPECT_EQ(WifiChannelInMhz(legacy_channel_st.channel.center_freq0), converted.radios[i].channelStats[k].channel.centerFreq0); - EXPECT_EQ(legacy_channel_st.channel.center_freq1, + EXPECT_EQ(WifiChannelInMhz(legacy_channel_st.channel.center_freq1), converted.radios[i].channelStats[k].channel.centerFreq1); EXPECT_EQ(legacy_channel_st.cca_busy_time, - (uint32_t)converted.radios[i].channelStats[k].ccaBusyTimeInMs); - EXPECT_EQ(legacy_channel_st.on_time, - (uint32_t)converted.radios[i].channelStats[k].onTimeInMs); + converted.radios[i].channelStats[k].ccaBusyTimeInMs); + EXPECT_EQ(legacy_channel_st.on_time, converted.radios[i].channelStats[k].onTimeInMs); } } @@ -345,36 +347,35 @@ TEST_F(AidlStructUtilTest, canConvertLegacyLinkLayerStatsToAidl) { EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].rate.bw, (uint32_t)converted.iface.peers[i].rateStats[j].rateInfo.bw); EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].rate.rateMcsIdx, - (uint32_t)converted.iface.peers[i].rateStats[j].rateInfo.rateMcsIdx); + converted.iface.peers[i].rateStats[j].rateInfo.rateMcsIdx); EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].tx_mpdu, - (uint32_t)converted.iface.peers[i].rateStats[j].txMpdu); + converted.iface.peers[i].rateStats[j].txMpdu); EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].rx_mpdu, - (uint32_t)converted.iface.peers[i].rateStats[j].rxMpdu); + converted.iface.peers[i].rateStats[j].rxMpdu); EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].mpdu_lost, - (uint32_t)converted.iface.peers[i].rateStats[j].mpduLost); + converted.iface.peers[i].rateStats[j].mpduLost); EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].retries, - (uint32_t)converted.iface.peers[i].rateStats[j].retries); + converted.iface.peers[i].rateStats[j].retries); } } } -TEST_F(AidlStructUtilTest, CanConvertLegacyFeaturesToAidl) { - using AidlChipCaps = IWifiChip::ChipCapabilityMask; +TEST_F(HidlStructUtilTest, CanConvertLegacyFeaturesToHidl) { + using HidlChipCaps = V1_3::IWifiChip::ChipCapabilityMask; - uint32_t aidl_caps; + uint32_t hidle_caps; uint32_t legacy_feature_set = WIFI_FEATURE_D2D_RTT | WIFI_FEATURE_SET_LATENCY_MODE; uint32_t legacy_logger_feature_set = legacy_hal::WIFI_LOGGER_DRIVER_DUMP_SUPPORTED; - ASSERT_TRUE(aidl_struct_util::convertLegacyFeaturesToAidlChipCapabilities( - legacy_feature_set, legacy_logger_feature_set, &aidl_caps)); + ASSERT_TRUE(hidl_struct_util::convertLegacyFeaturesToHidlChipCapabilities( + legacy_feature_set, legacy_logger_feature_set, &hidle_caps)); - EXPECT_EQ((uint32_t)AidlChipCaps::DEBUG_RING_BUFFER_VENDOR_DATA | - (uint32_t)AidlChipCaps::DEBUG_HOST_WAKE_REASON_STATS | - (uint32_t)AidlChipCaps::DEBUG_ERROR_ALERTS | (uint32_t)AidlChipCaps::D2D_RTT | - (uint32_t)AidlChipCaps::SET_LATENCY_MODE | - (uint32_t)AidlChipCaps::DEBUG_MEMORY_DRIVER_DUMP, - aidl_caps); + EXPECT_EQ(HidlChipCaps::DEBUG_RING_BUFFER_VENDOR_DATA | + HidlChipCaps::DEBUG_HOST_WAKE_REASON_STATS | + HidlChipCaps::DEBUG_ERROR_ALERTS | HidlChipCaps::D2D_RTT | + HidlChipCaps::SET_LATENCY_MODE | HidlChipCaps::DEBUG_MEMORY_DRIVER_DUMP, + hidle_caps); } void insertRadioCombination(legacy_hal::wifi_radio_combination* dst_radio_combination_ptr, @@ -389,16 +390,16 @@ void verifyRadioCombination(WifiRadioCombination* radioCombination, size_t num_r legacy_hal::wifi_radio_configuration* radio_configuration) { EXPECT_EQ(num_radio_configurations, radioCombination->radioConfigurations.size()); for (size_t i = 0; i < num_radio_configurations; i++) { - EXPECT_EQ(aidl_struct_util::convertLegacyMacBandToAidlWifiBand(radio_configuration->band), + EXPECT_EQ(hidl_struct_util::convertLegacyMacBandToHidlWifiBand(radio_configuration->band), radioCombination->radioConfigurations[i].bandInfo); - EXPECT_EQ(aidl_struct_util::convertLegacyAntennaConfigurationToAidl( + EXPECT_EQ(hidl_struct_util::convertLegacyAntennaConfigurationToHidl( radio_configuration->antenna_cfg), radioCombination->radioConfigurations[i].antennaMode); radio_configuration++; } } -TEST_F(AidlStructUtilTest, canConvertLegacyRadioCombinationsMatrixToAidl) { +TEST_F(HidlStructUtilTest, canConvertLegacyRadioCombinationsMatrixToHidl) { legacy_hal::wifi_radio_configuration radio_configurations_array1[] = { {.band = legacy_hal::WLAN_MAC_2_4_BAND, .antenna_cfg = legacy_hal::WIFI_ANTENNA_1X1}, }; @@ -460,8 +461,8 @@ TEST_F(AidlStructUtilTest, canConvertLegacyRadioCombinationsMatrixToAidl) { sizeof(radio_configurations_array3) / sizeof(radio_configurations_array3[0]), radio_configurations_array3); - WifiRadioCombinationMatrix converted_matrix{}; - aidl_struct_util::convertLegacyRadioCombinationsMatrixToAidl(legacy_matrix, &converted_matrix); + V1_6::WifiRadioCombinationMatrix converted_matrix{}; + hidl_struct_util::convertLegacyRadioCombinationsMatrixToHidl(legacy_matrix, &converted_matrix); // Verify the conversion EXPECT_EQ(legacy_matrix->num_radio_combinations, converted_matrix.radioCombinations.size()); @@ -478,8 +479,8 @@ TEST_F(AidlStructUtilTest, canConvertLegacyRadioCombinationsMatrixToAidl) { sizeof(radio_configurations_array3) / sizeof(radio_configurations_array3[0]), radio_configurations_array3); } - +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl diff --git a/wifi/aidl/default/tests/main.cpp b/wifi/1.6/default/tests/main.cpp similarity index 94% rename from wifi/aidl/default/tests/main.cpp rename to wifi/1.6/default/tests/main.cpp index 767422c408..9aac837242 100644 --- a/wifi/aidl/default/tests/main.cpp +++ b/wifi/1.6/default/tests/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2017 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. diff --git a/wifi/aidl/default/tests/mock_interface_tool.cpp b/wifi/1.6/default/tests/mock_interface_tool.cpp similarity index 86% rename from wifi/aidl/default/tests/mock_interface_tool.cpp rename to wifi/1.6/default/tests/mock_interface_tool.cpp index 79f3d1e638..b99a16446c 100644 --- a/wifi/aidl/default/tests/mock_interface_tool.cpp +++ b/wifi/1.6/default/tests/mock_interface_tool.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2019 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. @@ -17,6 +17,7 @@ #include #include +#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 #include "mock_interface_tool.h" namespace android { diff --git a/wifi/aidl/default/tests/mock_interface_tool.h b/wifi/1.6/default/tests/mock_interface_tool.h similarity index 96% rename from wifi/aidl/default/tests/mock_interface_tool.h rename to wifi/1.6/default/tests/mock_interface_tool.h index 9795de8014..7ce3992c7e 100644 --- a/wifi/aidl/default/tests/mock_interface_tool.h +++ b/wifi/1.6/default/tests/mock_interface_tool.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2019 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. diff --git a/wifi/aidl/default/tests/mock_wifi_feature_flags.cpp b/wifi/1.6/default/tests/mock_wifi_feature_flags.cpp similarity index 85% rename from wifi/aidl/default/tests/mock_wifi_feature_flags.cpp rename to wifi/1.6/default/tests/mock_wifi_feature_flags.cpp index 0c4e59deb3..d10b74c3a0 100644 --- a/wifi/aidl/default/tests/mock_wifi_feature_flags.cpp +++ b/wifi/1.6/default/tests/mock_wifi_feature_flags.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2017 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. @@ -18,16 +18,18 @@ #include "mock_wifi_feature_flags.h" -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { namespace feature_flags { MockWifiFeatureFlags::MockWifiFeatureFlags() {} } // namespace feature_flags +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl diff --git a/wifi/aidl/default/tests/mock_wifi_feature_flags.h b/wifi/1.6/default/tests/mock_wifi_feature_flags.h similarity index 77% rename from wifi/aidl/default/tests/mock_wifi_feature_flags.h rename to wifi/1.6/default/tests/mock_wifi_feature_flags.h index 9143d15d61..fbe1f7a5ac 100644 --- a/wifi/aidl/default/tests/mock_wifi_feature_flags.h +++ b/wifi/1.6/default/tests/mock_wifi_feature_flags.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2017 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. @@ -18,27 +18,30 @@ #define MOCK_WIFI_FEATURE_FLAGS_H_ #include +#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 #include "wifi_feature_flags.h" -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { namespace feature_flags { class MockWifiFeatureFlags : public WifiFeatureFlags { public: MockWifiFeatureFlags(); - MOCK_METHOD1(getChipModes, std::vector(bool is_primary)); + MOCK_METHOD1(getChipModes, std::vector(bool is_primary)); MOCK_METHOD0(isApMacRandomizationDisabled, bool()); }; } // namespace feature_flags +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl #endif // MOCK_WIFI_FEATURE_FLAGS_H_ diff --git a/wifi/aidl/default/tests/mock_wifi_iface_util.cpp b/wifi/1.6/default/tests/mock_wifi_iface_util.cpp similarity index 68% rename from wifi/aidl/default/tests/mock_wifi_iface_util.cpp rename to wifi/1.6/default/tests/mock_wifi_iface_util.cpp index 0f787f22b2..24b16cb469 100644 --- a/wifi/aidl/default/tests/mock_wifi_iface_util.cpp +++ b/wifi/1.6/default/tests/mock_wifi_iface_util.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2019 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. @@ -18,21 +18,22 @@ #include #include +#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 #include "mock_wifi_iface_util.h" -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { namespace iface_util { -MockWifiIfaceUtil::MockWifiIfaceUtil( - const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, - const std::weak_ptr legacy_hal) +MockWifiIfaceUtil::MockWifiIfaceUtil(const std::weak_ptr iface_tool, + const std::weak_ptr legacy_hal) : WifiIfaceUtil(iface_tool, legacy_hal) {} - } // namespace iface_util +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl diff --git a/wifi/aidl/default/tests/mock_wifi_iface_util.h b/wifi/1.6/default/tests/mock_wifi_iface_util.h similarity index 79% rename from wifi/aidl/default/tests/mock_wifi_iface_util.h rename to wifi/1.6/default/tests/mock_wifi_iface_util.h index 49a8636345..2701c36d76 100644 --- a/wifi/aidl/default/tests/mock_wifi_iface_util.h +++ b/wifi/1.6/default/tests/mock_wifi_iface_util.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2019 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. @@ -21,30 +21,30 @@ #include "wifi_iface_util.h" -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { namespace iface_util { -class MockWifiIfaceUtil : public iface_util::WifiIfaceUtil { +class MockWifiIfaceUtil : public WifiIfaceUtil { public: - MockWifiIfaceUtil(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, + MockWifiIfaceUtil(const std::weak_ptr iface_tool, const std::weak_ptr legacy_hal); MOCK_METHOD1(getFactoryMacAddress, std::array(const std::string&)); MOCK_METHOD2(setMacAddress, bool(const std::string&, const std::array&)); MOCK_METHOD0(getOrCreateRandomMacAddress, std::array()); - MOCK_METHOD2(registerIfaceEventHandlers, - void(const std::string&, iface_util::IfaceEventHandlers)); + MOCK_METHOD2(registerIfaceEventHandlers, void(const std::string&, IfaceEventHandlers)); MOCK_METHOD1(unregisterIfaceEventHandlers, void(const std::string&)); MOCK_METHOD2(setUpState, bool(const std::string&, bool)); MOCK_METHOD1(ifNameToIndex, unsigned(const std::string&)); }; - } // namespace iface_util +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl #endif // MOCK_WIFI_IFACE_UTIL_H_ diff --git a/wifi/aidl/default/tests/mock_wifi_legacy_hal.cpp b/wifi/1.6/default/tests/mock_wifi_legacy_hal.cpp similarity index 69% rename from wifi/aidl/default/tests/mock_wifi_legacy_hal.cpp rename to wifi/1.6/default/tests/mock_wifi_legacy_hal.cpp index 33b2b1ce36..2c558612e3 100644 --- a/wifi/aidl/default/tests/mock_wifi_legacy_hal.cpp +++ b/wifi/1.6/default/tests/mock_wifi_legacy_hal.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2017 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. @@ -18,20 +18,22 @@ #include #include +#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 #include "mock_wifi_legacy_hal.h" -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { namespace legacy_hal { -MockWifiLegacyHal::MockWifiLegacyHal( - const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, - const wifi_hal_fn& fn, bool is_primary) +MockWifiLegacyHal::MockWifiLegacyHal(const std::weak_ptr iface_tool, + const wifi_hal_fn& fn, bool is_primary) : WifiLegacyHal(iface_tool, fn, is_primary) {} } // namespace legacy_hal +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl diff --git a/wifi/aidl/default/tests/mock_wifi_legacy_hal.h b/wifi/1.6/default/tests/mock_wifi_legacy_hal.h similarity index 92% rename from wifi/aidl/default/tests/mock_wifi_legacy_hal.h rename to wifi/1.6/default/tests/mock_wifi_legacy_hal.h index 28129a9947..85dbf0fe49 100644 --- a/wifi/aidl/default/tests/mock_wifi_legacy_hal.h +++ b/wifi/1.6/default/tests/mock_wifi_legacy_hal.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2017 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. @@ -21,15 +21,16 @@ #include "wifi_legacy_hal.h" -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { namespace legacy_hal { class MockWifiLegacyHal : public WifiLegacyHal { public: - MockWifiLegacyHal(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, + MockWifiLegacyHal(const std::weak_ptr iface_tool, const wifi_hal_fn& fn, bool is_primary); MOCK_METHOD0(initialize, wifi_error()); MOCK_METHOD0(start, wifi_error()); @@ -61,9 +62,10 @@ class MockWifiLegacyHal : public WifiLegacyHal { MOCK_METHOD1(getSupportedFeatureSet, std::pair(const std::string&)); }; } // namespace legacy_hal +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl #endif // MOCK_WIFI_LEGACY_HAL_H_ diff --git a/wifi/aidl/default/tests/mock_wifi_mode_controller.cpp b/wifi/1.6/default/tests/mock_wifi_mode_controller.cpp similarity index 87% rename from wifi/aidl/default/tests/mock_wifi_mode_controller.cpp rename to wifi/1.6/default/tests/mock_wifi_mode_controller.cpp index f4cc4c4108..446f8296f8 100644 --- a/wifi/aidl/default/tests/mock_wifi_mode_controller.cpp +++ b/wifi/1.6/default/tests/mock_wifi_mode_controller.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2017 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. @@ -21,16 +21,17 @@ #undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 #include "mock_wifi_mode_controller.h" -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { namespace mode_controller { MockWifiModeController::MockWifiModeController() : WifiModeController() {} - } // namespace mode_controller +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl diff --git a/wifi/aidl/default/tests/mock_wifi_mode_controller.h b/wifi/1.6/default/tests/mock_wifi_mode_controller.h similarity index 89% rename from wifi/aidl/default/tests/mock_wifi_mode_controller.h rename to wifi/1.6/default/tests/mock_wifi_mode_controller.h index f77f7d0f96..addcc81591 100644 --- a/wifi/aidl/default/tests/mock_wifi_mode_controller.h +++ b/wifi/1.6/default/tests/mock_wifi_mode_controller.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2017 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. @@ -21,10 +21,11 @@ #include "wifi_mode_controller.h" -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { namespace mode_controller { class MockWifiModeController : public WifiModeController { @@ -36,9 +37,10 @@ class MockWifiModeController : public WifiModeController { MOCK_METHOD0(deinitialize, bool()); }; } // namespace mode_controller +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl #endif // MOCK_WIFI_MODE_CONTROLLER_H_ diff --git a/wifi/aidl/default/tests/ringbuffer_unit_tests.cpp b/wifi/1.6/default/tests/ringbuffer_unit_tests.cpp similarity index 95% rename from wifi/aidl/default/tests/ringbuffer_unit_tests.cpp rename to wifi/1.6/default/tests/ringbuffer_unit_tests.cpp index c257100be9..eb86194ff0 100644 --- a/wifi/aidl/default/tests/ringbuffer_unit_tests.cpp +++ b/wifi/1.6/default/tests/ringbuffer_unit_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2018, 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. @@ -21,10 +21,11 @@ using testing::Return; using testing::Test; -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { class RingbufferTest : public Test { public: @@ -89,8 +90,8 @@ TEST_F(RingbufferTest, OversizedAppendDoesNotDropExistingData) { ASSERT_EQ(1u, buffer_.getData().size()); EXPECT_EQ(input, buffer_.getData().front()); } - +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl diff --git a/wifi/aidl/default/tests/runtests.sh b/wifi/1.6/default/tests/runtests.sh similarity index 79% rename from wifi/aidl/default/tests/runtests.sh rename to wifi/1.6/default/tests/runtests.sh index 1f53ab8e05..6bce3ef8c4 100755 --- a/wifi/aidl/default/tests/runtests.sh +++ b/wifi/1.6/default/tests/runtests.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright(C) 2022 The Android Open Source Project +# Copyright(C) 2017 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. @@ -20,7 +20,7 @@ if [ -z $ANDROID_BUILD_TOP ]; then fi set -e -$ANDROID_BUILD_TOP/build/soong/soong_ui.bash --make-mode android.hardware.wifi-service-tests +$ANDROID_BUILD_TOP/build/soong/soong_ui.bash --make-mode android.hardware.wifi@1.0-service-tests adb root adb sync data -adb shell /data/nativetest64/vendor/android.hardware.wifi-service-tests/android.hardware.wifi-service-tests +adb shell /data/nativetest64/vendor/android.hardware.wifi@1.0-service-tests/android.hardware.wifi@1.0-service-tests diff --git a/wifi/aidl/default/tests/wifi_chip_unit_tests.cpp b/wifi/1.6/default/tests/wifi_chip_unit_tests.cpp similarity index 66% rename from wifi/aidl/default/tests/wifi_chip_unit_tests.cpp rename to wifi/1.6/default/tests/wifi_chip_unit_tests.cpp index e66b650ded..81117c5e06 100644 --- a/wifi/aidl/default/tests/wifi_chip_unit_tests.cpp +++ b/wifi/1.6/default/tests/wifi_chip_unit_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2017, 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. @@ -19,6 +19,7 @@ #include #include +#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 #include "wifi_chip.h" #include "mock_interface_tool.h" @@ -32,38 +33,28 @@ using testing::Return; using testing::Test; namespace { -constexpr int kFakeChipId = 5; +using android::hardware::wifi::V1_0::ChipId; + +constexpr ChipId kFakeChipId = 5; } // namespace -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { class WifiChipTest : public Test { protected: void setupV1IfaceCombination() { // clang-format off - // 1 STA + 1 P2P - const std::vector combinationsSta = - { - { - { - {{IfaceConcurrencyType::STA}, 1}, - {{IfaceConcurrencyType::P2P}, 1} - } - } - }; - // 1 AP - const std::vector combinationsAp = - { - { - { - {{IfaceConcurrencyType::AP}, 1} - } - } + const hidl_vec combinationsSta = { + {{{{IfaceConcurrencyType::STA}, 1}, {{IfaceConcurrencyType::P2P}, 1}}} }; - const std::vector modes = { + const hidl_vec combinationsAp = { + {{{{IfaceConcurrencyType::AP}, 1}}} + }; + const std::vector modes = { {feature_flags::chip_mode_ids::kV1Sta, combinationsSta}, {feature_flags::chip_mode_ids::kV1Ap, combinationsAp} }; @@ -73,26 +64,14 @@ class WifiChipTest : public Test { void setupV1_AwareIfaceCombination() { // clang-format off - // 1 STA + 1 of (P2P or NAN) - const std::vector combinationsSta = - { - { - { - {{IfaceConcurrencyType::STA}, 1}, - {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN_IFACE}, 1} - } - } + const hidl_vec combinationsSta = { + {{{{IfaceConcurrencyType::STA}, 1}, + {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN}, 1}}} }; - // 1 AP - const std::vector combinationsAp = - { - { - { - {{IfaceConcurrencyType::AP}, 1} - } - } + const hidl_vec combinationsAp = { + {{{{IfaceConcurrencyType::AP}, 1}}} }; - const std::vector modes = { + const std::vector modes = { {feature_flags::chip_mode_ids::kV1Sta, combinationsSta}, {feature_flags::chip_mode_ids::kV1Ap, combinationsAp} }; @@ -102,17 +81,11 @@ class WifiChipTest : public Test { void setupV1_AwareDisabledApIfaceCombination() { // clang-format off - // 1 STA + 1 of (P2P or NAN) - const std::vector combinationsSta = - { - { - { - {{IfaceConcurrencyType::STA}, 1}, - {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN_IFACE}, 1} - } - } + const hidl_vec combinationsSta = { + {{{{IfaceConcurrencyType::STA}, 1}, + {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN}, 1}}} }; - const std::vector modes = { + const std::vector modes = { {feature_flags::chip_mode_ids::kV1Sta, combinationsSta} }; // clang-format on @@ -121,23 +94,12 @@ class WifiChipTest : public Test { void setupV2_AwareIfaceCombination() { // clang-format off - // (1 STA + 1 AP) or (1 STA + 1 of (P2P or NAN)) - const std::vector combinations = - { - { - { - {{IfaceConcurrencyType::STA}, 1}, - {{IfaceConcurrencyType::AP}, 1} - } - }, - { - { - {{IfaceConcurrencyType::STA}, 1}, - {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN_IFACE}, 1} - } - } + const hidl_vec combinations = { + {{{{IfaceConcurrencyType::STA}, 1}, {{IfaceConcurrencyType::AP}, 1}}}, + {{{{IfaceConcurrencyType::STA}, 1}, + {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN}, 1}}} }; - const std::vector modes = { + const std::vector modes = { {feature_flags::chip_mode_ids::kV3, combinations} }; // clang-format on @@ -146,17 +108,11 @@ class WifiChipTest : public Test { void setupV2_AwareDisabledApIfaceCombination() { // clang-format off - // 1 STA + 1 of (P2P or NAN) - const std::vector combinations = - { - { - { - {{IfaceConcurrencyType::STA}, 1}, - {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN_IFACE}, 1} - } - } + const hidl_vec combinations = { + {{{{IfaceConcurrencyType::STA}, 1}, + {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN}, 1}}} }; - const std::vector modes = { + const std::vector modes = { {feature_flags::chip_mode_ids::kV3, combinations} }; // clang-format on @@ -165,17 +121,10 @@ class WifiChipTest : public Test { void setup_MultiIfaceCombination() { // clang-format off - // 3 STA + 1 AP - const std::vector combinations = - { - { - { - {{IfaceConcurrencyType::STA}, 3}, - {{IfaceConcurrencyType::AP}, 1} - } - } + const hidl_vec combinations = { + {{{{IfaceConcurrencyType::STA}, 3}, {{IfaceConcurrencyType::AP}, 1}}} }; - const std::vector modes = { + const std::vector modes = { {feature_flags::chip_mode_ids::kV3, combinations} }; // clang-format on @@ -183,93 +132,134 @@ class WifiChipTest : public Test { } void assertNumberOfModes(uint32_t num_modes) { - std::vector modes; - ASSERT_TRUE(chip_->getAvailableModes(&modes).isOk()); - // V2_Aware has 1 mode of operation. - ASSERT_EQ(num_modes, modes.size()); + chip_->getAvailableModes_1_6([num_modes](const WifiStatus& status, + const std::vector& modes) { + ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); + // V2_Aware has 1 mode of operation. + ASSERT_EQ(num_modes, modes.size()); + }); } void findModeAndConfigureForIfaceType(const IfaceConcurrencyType& type) { - // This should be aligned with kInvalidModeId in wifi_chip.cpp - int32_t mode_id = INT32_MAX; - std::vector modes; - ASSERT_TRUE(chip_->getAvailableModes(&modes).isOk()); - - for (const auto& mode : modes) { - for (const auto& combination : mode.availableCombinations) { - for (const auto& limit : combination.limits) { - if (limit.types.end() != - std::find(limit.types.begin(), limit.types.end(), type)) { - mode_id = mode.id; + // This should be aligned with kInvalidModeId in wifi_chip.cpp. + ChipModeId mode_id = UINT32_MAX; + chip_->getAvailableModes_1_6([&mode_id, &type]( + const WifiStatus& status, + const std::vector& modes) { + ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); + for (const auto& mode : modes) { + for (const auto& combination : mode.availableCombinations) { + for (const auto& limit : combination.limits) { + if (limit.types.end() != + std::find(limit.types.begin(), limit.types.end(), type)) { + mode_id = mode.id; + } } } } - } + }); + ASSERT_NE(UINT32_MAX, mode_id); - ASSERT_NE(INT32_MAX, mode_id); - ASSERT_TRUE(chip_->configureChip(mode_id).isOk()); + chip_->configureChip(mode_id, [](const WifiStatus& status) { + ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); + }); } // Returns an empty string on error. std::string createIface(const IfaceType& type) { std::string iface_name; if (type == IfaceType::AP) { - std::shared_ptr iface; - if (!chip_->createApIface(&iface).isOk()) { - return ""; - } - EXPECT_NE(iface.get(), nullptr); - EXPECT_TRUE(iface->getName(&iface_name).isOk()); - } else if (type == IfaceType::NAN_IFACE) { - std::shared_ptr iface; - if (!chip_->createNanIface(&iface).isOk()) { - return ""; - } - EXPECT_NE(iface.get(), nullptr); - EXPECT_TRUE(iface->getName(&iface_name).isOk()); + chip_->createApIface( + [&iface_name](const WifiStatus& status, const sp& iface) { + if (WifiStatusCode::SUCCESS == status.code) { + ASSERT_NE(iface.get(), nullptr); + iface->getName([&iface_name](const WifiStatus& status, + const hidl_string& name) { + ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); + iface_name = name.c_str(); + }); + } + }); + } else if (type == IfaceType::NAN) { + chip_->createNanIface( + [&iface_name](const WifiStatus& status, + const sp& iface) { + if (WifiStatusCode::SUCCESS == status.code) { + ASSERT_NE(iface.get(), nullptr); + iface->getName([&iface_name](const WifiStatus& status, + const hidl_string& name) { + ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); + iface_name = name.c_str(); + }); + } + }); } else if (type == IfaceType::P2P) { - std::shared_ptr iface; - if (!chip_->createP2pIface(&iface).isOk()) { - return ""; - } - EXPECT_NE(iface.get(), nullptr); - EXPECT_TRUE(iface->getName(&iface_name).isOk()); + chip_->createP2pIface( + [&iface_name](const WifiStatus& status, const sp& iface) { + if (WifiStatusCode::SUCCESS == status.code) { + ASSERT_NE(iface.get(), nullptr); + iface->getName([&iface_name](const WifiStatus& status, + const hidl_string& name) { + ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); + iface_name = name.c_str(); + }); + } + }); } else if (type == IfaceType::STA) { - std::shared_ptr iface; - if (!chip_->createStaIface(&iface).isOk()) { - return ""; - } - EXPECT_NE(iface.get(), nullptr); - EXPECT_TRUE(iface->getName(&iface_name).isOk()); + chip_->createStaIface( + [&iface_name](const WifiStatus& status, const sp& iface) { + if (WifiStatusCode::SUCCESS == status.code) { + ASSERT_NE(iface.get(), nullptr); + iface->getName([&iface_name](const WifiStatus& status, + const hidl_string& name) { + ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); + iface_name = name.c_str(); + }); + } + }); } return iface_name; } void removeIface(const IfaceType& type, const std::string& iface_name) { if (type == IfaceType::AP) { - ASSERT_TRUE(chip_->removeApIface(iface_name).isOk()); - } else if (type == IfaceType::NAN_IFACE) { - ASSERT_TRUE(chip_->removeNanIface(iface_name).isOk()); + chip_->removeApIface(iface_name, [](const WifiStatus& status) { + ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); + }); + } else if (type == IfaceType::NAN) { + chip_->removeNanIface(iface_name, [](const WifiStatus& status) { + ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); + }); } else if (type == IfaceType::P2P) { - ASSERT_TRUE(chip_->removeP2pIface(iface_name).isOk()); + chip_->removeP2pIface(iface_name, [](const WifiStatus& status) { + ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); + }); } else if (type == IfaceType::STA) { - ASSERT_TRUE(chip_->removeStaIface(iface_name).isOk()); + chip_->removeStaIface(iface_name, [](const WifiStatus& status) { + ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); + }); } } bool createRttController() { - std::shared_ptr rtt_controller; - auto status = chip_->createRttController(nullptr, &rtt_controller); - return status.isOk(); + bool success = false; + chip_->createRttController_1_6( + NULL, [&success](const WifiStatus& status, const sp& rtt) { + if (WifiStatusCode::SUCCESS == status.code) { + ASSERT_NE(rtt.get(), nullptr); + success = true; + } + }); + return success; } static void subsystemRestartHandler(const std::string& /*error*/) {} - std::shared_ptr chip_; - int chip_id_ = kFakeChipId; + sp chip_; + ChipId chip_id_ = kFakeChipId; legacy_hal::wifi_hal_fn fake_func_table_; - std::shared_ptr> iface_tool_{ - new NiceMock<::android::wifi_system::MockInterfaceTool>}; + std::shared_ptr> iface_tool_{ + new NiceMock}; std::shared_ptr> legacy_hal_{ new NiceMock(iface_tool_, fake_func_table_, true)}; std::shared_ptr> mode_controller_{ @@ -281,8 +271,8 @@ class WifiChipTest : public Test { public: void SetUp() override { - chip_ = WifiChip::create(chip_id_, true, legacy_hal_, mode_controller_, iface_util_, - feature_flags_, subsystemRestartHandler); + chip_ = new WifiChip(chip_id_, true, legacy_hal_, mode_controller_, iface_util_, + feature_flags_, subsystemRestartHandler); EXPECT_CALL(*mode_controller_, changeFirmwareMode(testing::_)) .WillRepeatedly(testing::Return(true)); @@ -311,7 +301,7 @@ class WifiChipV1IfaceCombinationTest : public WifiChipTest { setupV1IfaceCombination(); WifiChipTest::SetUp(); // V1 has 2 modes of operation. - assertNumberOfModes(2); + assertNumberOfModes(2u); } }; @@ -327,7 +317,7 @@ TEST_F(WifiChipV1IfaceCombinationTest, StaMode_CreateP2p_ShouldSucceed) { TEST_F(WifiChipV1IfaceCombinationTest, StaMode_CreateNan_ShouldFail) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); + ASSERT_TRUE(createIface(IfaceType::NAN).empty()); } TEST_F(WifiChipV1IfaceCombinationTest, StaMode_CreateAp_ShouldFail) { @@ -358,7 +348,7 @@ TEST_F(WifiChipV1IfaceCombinationTest, ApMode_CreateP2p_ShouldFail) { TEST_F(WifiChipV1IfaceCombinationTest, ApMode_CreateNan_ShouldFail) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); + ASSERT_TRUE(createIface(IfaceType::NAN).empty()); } ////////// V1 + Aware Iface Combinations //////////// @@ -386,7 +376,7 @@ TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateP2p_ShouldSucceed) { TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateNan_ShouldSucceed) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::NAN_IFACE).empty()); + ASSERT_FALSE(createIface(IfaceType::NAN).empty()); } TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateAp_ShouldFail) { @@ -403,37 +393,37 @@ TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaP2p_ShouldSucceed) TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaNan_ShouldSucceed) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); ASSERT_FALSE(createIface(IfaceType::STA).empty()); - ASSERT_FALSE(createIface(IfaceType::NAN_IFACE).empty()); + ASSERT_FALSE(createIface(IfaceType::NAN).empty()); } TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaP2PNan_ShouldFail) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); ASSERT_FALSE(createIface(IfaceType::STA).empty()); ASSERT_FALSE(createIface(IfaceType::P2P).empty()); - ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); + ASSERT_TRUE(createIface(IfaceType::NAN).empty()); } TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaNan_AfterP2pRemove_ShouldSucceed) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); ASSERT_FALSE(createIface(IfaceType::STA).empty()); - std::string p2p_iface_name = createIface(IfaceType::P2P); + const auto p2p_iface_name = createIface(IfaceType::P2P); ASSERT_FALSE(p2p_iface_name.empty()); - ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); + ASSERT_TRUE(createIface(IfaceType::NAN).empty()); // After removing P2P iface, NAN iface creation should succeed. removeIface(IfaceType::P2P, p2p_iface_name); - ASSERT_FALSE(createIface(IfaceType::NAN_IFACE).empty()); + ASSERT_FALSE(createIface(IfaceType::NAN).empty()); } TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaP2p_AfterNanRemove_ShouldSucceed) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); ASSERT_FALSE(createIface(IfaceType::STA).empty()); - std::string nan_iface_name = createIface(IfaceType::NAN_IFACE); + const auto nan_iface_name = createIface(IfaceType::NAN); ASSERT_FALSE(nan_iface_name.empty()); ASSERT_TRUE(createIface(IfaceType::P2P).empty()); // After removing NAN iface, P2P iface creation should succeed. - removeIface(IfaceType::NAN_IFACE, nan_iface_name); + removeIface(IfaceType::NAN, nan_iface_name); ASSERT_FALSE(createIface(IfaceType::P2P).empty()); } @@ -454,7 +444,7 @@ TEST_F(WifiChipV1_AwareIfaceCombinationTest, ApMode_CreateP2p_ShouldFail) { TEST_F(WifiChipV1_AwareIfaceCombinationTest, ApMode_CreateNan_ShouldFail) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); + ASSERT_TRUE(createIface(IfaceType::NAN).empty()); } TEST_F(WifiChipV1_AwareIfaceCombinationTest, RttControllerFlowStaModeNoSta) { @@ -470,7 +460,7 @@ TEST_F(WifiChipV1_AwareIfaceCombinationTest, RttControllerFlowStaModeWithSta) { TEST_F(WifiChipV1_AwareIfaceCombinationTest, RttControllerFlowApToSta) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - std::string ap_iface_name = createIface(IfaceType::AP); + const auto ap_iface_name = createIface(IfaceType::AP); ASSERT_FALSE(ap_iface_name.empty()); ASSERT_FALSE(createRttController()); @@ -485,7 +475,9 @@ TEST_F(WifiChipV1_AwareIfaceCombinationTest, SelectTxScenarioWithOnlySta) { ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); EXPECT_CALL(*legacy_hal_, selectTxPowerScenario("wlan0", testing::_)) .WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS)); - ASSERT_TRUE(chip_->selectTxPowerScenario(IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF).isOk()); + chip_->selectTxPowerScenario_1_2( + V1_2::IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF, + [](const WifiStatus& status) { ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); }); } TEST_F(WifiChipV1_AwareIfaceCombinationTest, SelectTxScenarioWithOnlyAp) { @@ -493,7 +485,9 @@ TEST_F(WifiChipV1_AwareIfaceCombinationTest, SelectTxScenarioWithOnlyAp) { ASSERT_EQ(createIface(IfaceType::AP), "wlan0"); EXPECT_CALL(*legacy_hal_, selectTxPowerScenario("wlan0", testing::_)) .WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS)); - ASSERT_TRUE(chip_->selectTxPowerScenario(IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF).isOk()); + chip_->selectTxPowerScenario_1_2( + V1_2::IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF, + [](const WifiStatus& status) { ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); }); } ////////// V2 + Aware Iface Combinations //////////// @@ -521,7 +515,7 @@ TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateP2p_ShouldSucceed) { TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateNan_ShouldSucceed) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::NAN_IFACE).empty()); + ASSERT_FALSE(createIface(IfaceType::NAN).empty()); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateAp_ShouldSucceed) { @@ -549,9 +543,9 @@ TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateApSta_ShouldSucceed) { TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateSta_AfterStaApRemove_ShouldSucceed) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - std::string sta_iface_name = createIface(IfaceType::STA); + const auto sta_iface_name = createIface(IfaceType::STA); ASSERT_FALSE(sta_iface_name.empty()); - std::string ap_iface_name = createIface(IfaceType::AP); + const auto ap_iface_name = createIface(IfaceType::AP); ASSERT_FALSE(ap_iface_name.empty()); ASSERT_TRUE(createIface(IfaceType::STA).empty()); @@ -571,44 +565,44 @@ TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaP2p_ShouldSucceed) { TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaNan_ShouldSucceed) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); ASSERT_FALSE(createIface(IfaceType::STA).empty()); - ASSERT_FALSE(createIface(IfaceType::NAN_IFACE).empty()); + ASSERT_FALSE(createIface(IfaceType::NAN).empty()); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaP2PNan_ShouldFail) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); ASSERT_FALSE(createIface(IfaceType::STA).empty()); ASSERT_FALSE(createIface(IfaceType::P2P).empty()); - ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); + ASSERT_TRUE(createIface(IfaceType::NAN).empty()); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaNan_AfterP2pRemove_ShouldSucceed) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); ASSERT_FALSE(createIface(IfaceType::STA).empty()); - std::string p2p_iface_name = createIface(IfaceType::P2P); + const auto p2p_iface_name = createIface(IfaceType::P2P); ASSERT_FALSE(p2p_iface_name.empty()); - ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); + ASSERT_TRUE(createIface(IfaceType::NAN).empty()); // After removing P2P iface, NAN iface creation should succeed. removeIface(IfaceType::P2P, p2p_iface_name); - ASSERT_FALSE(createIface(IfaceType::NAN_IFACE).empty()); + ASSERT_FALSE(createIface(IfaceType::NAN).empty()); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaP2p_AfterNanRemove_ShouldSucceed) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); ASSERT_FALSE(createIface(IfaceType::STA).empty()); - std::string nan_iface_name = createIface(IfaceType::NAN_IFACE); + const auto nan_iface_name = createIface(IfaceType::NAN); ASSERT_FALSE(nan_iface_name.empty()); ASSERT_TRUE(createIface(IfaceType::P2P).empty()); // After removing NAN iface, P2P iface creation should succeed. - removeIface(IfaceType::NAN_IFACE, nan_iface_name); + removeIface(IfaceType::NAN, nan_iface_name); ASSERT_FALSE(createIface(IfaceType::P2P).empty()); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateApNan_ShouldFail) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); ASSERT_FALSE(createIface(IfaceType::AP).empty()); - ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); + ASSERT_TRUE(createIface(IfaceType::NAN).empty()); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateApP2p_ShouldFail) { @@ -620,31 +614,31 @@ TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateApP2p_ShouldFail) { TEST_F(WifiChipV2_AwareIfaceCombinationTest, StaMode_CreateStaNan_AfterP2pRemove_ShouldSucceed) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); ASSERT_FALSE(createIface(IfaceType::STA).empty()); - std::string p2p_iface_name = createIface(IfaceType::P2P); + const auto p2p_iface_name = createIface(IfaceType::P2P); ASSERT_FALSE(p2p_iface_name.empty()); - ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); + ASSERT_TRUE(createIface(IfaceType::NAN).empty()); // After removing P2P iface, NAN iface creation should succeed. removeIface(IfaceType::P2P, p2p_iface_name); - ASSERT_FALSE(createIface(IfaceType::NAN_IFACE).empty()); + ASSERT_FALSE(createIface(IfaceType::NAN).empty()); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, StaMode_CreateStaP2p_AfterNanRemove_ShouldSucceed) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); ASSERT_FALSE(createIface(IfaceType::STA).empty()); - std::string nan_iface_name = createIface(IfaceType::NAN_IFACE); + const auto nan_iface_name = createIface(IfaceType::NAN); ASSERT_FALSE(nan_iface_name.empty()); ASSERT_TRUE(createIface(IfaceType::P2P).empty()); // After removing NAN iface, P2P iface creation should succeed. - removeIface(IfaceType::NAN_IFACE, nan_iface_name); + removeIface(IfaceType::NAN, nan_iface_name); ASSERT_FALSE(createIface(IfaceType::P2P).empty()); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaAp_EnsureDifferentIfaceNames) { findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - std::string sta_iface_name = createIface(IfaceType::STA); - std::string ap_iface_name = createIface(IfaceType::AP); + const auto sta_iface_name = createIface(IfaceType::STA); + const auto ap_iface_name = createIface(IfaceType::AP); ASSERT_FALSE(sta_iface_name.empty()); ASSERT_FALSE(ap_iface_name.empty()); ASSERT_NE(sta_iface_name, ap_iface_name); @@ -673,7 +667,9 @@ TEST_F(WifiChipV2_AwareIfaceCombinationTest, SelectTxScenarioWithOnlySta) { ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); EXPECT_CALL(*legacy_hal_, selectTxPowerScenario("wlan0", testing::_)) .WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS)); - ASSERT_TRUE(chip_->selectTxPowerScenario(IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF).isOk()); + chip_->selectTxPowerScenario_1_2( + V1_2::IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF, + [](const WifiStatus& status) { ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); }); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, SelectTxScenarioWithOnlyAp) { @@ -681,7 +677,9 @@ TEST_F(WifiChipV2_AwareIfaceCombinationTest, SelectTxScenarioWithOnlyAp) { ASSERT_EQ(createIface(IfaceType::AP), "wlan1"); EXPECT_CALL(*legacy_hal_, selectTxPowerScenario("wlan1", testing::_)) .WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS)); - ASSERT_TRUE(chip_->selectTxPowerScenario(IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF).isOk()); + chip_->selectTxPowerScenario_1_2( + V1_2::IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF, + [](const WifiStatus& status) { ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); }); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, InvalidateAndRemoveNanOnStaRemove) { @@ -689,29 +687,35 @@ TEST_F(WifiChipV2_AwareIfaceCombinationTest, InvalidateAndRemoveNanOnStaRemove) ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); // Create NAN iface - ASSERT_EQ(createIface(IfaceType::NAN_IFACE), "wlan0"); + ASSERT_EQ(createIface(IfaceType::NAN), "wlan0"); // We should have 1 nan iface. - std::vector iface_names; - ASSERT_TRUE(chip_->getNanIfaceNames(&iface_names).isOk()); - ASSERT_EQ(iface_names.size(), 1u); - ASSERT_EQ(iface_names[0], "wlan0"); + chip_->getNanIfaceNames([](const WifiStatus& status, const hidl_vec& iface_names) { + ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); + ASSERT_EQ(iface_names.size(), 1u); + ASSERT_EQ(iface_names[0], "wlan0"); + }); + // Retrieve the exact iface object. + sp nan_iface; + chip_->getNanIface("wlan0", + [&nan_iface](const WifiStatus& status, + const sp& iface) { + ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); + ASSERT_NE(iface.get(), nullptr); + nan_iface = iface; + }); - // Retrieve the nan iface object. - std::shared_ptr nan_iface; - ASSERT_TRUE(chip_->getNanIface("wlan0", &nan_iface).isOk()); - ASSERT_NE(nan_iface.get(), nullptr); - - // Remove the STA iface. We should have 0 nan ifaces now. + // Remove the STA iface. removeIface(IfaceType::STA, "wlan0"); - ASSERT_TRUE(chip_->getNanIfaceNames(&iface_names).isOk()); - ASSERT_EQ(iface_names.size(), 0u); - - // Any operation on the nan iface object should now return an error. - std::string name; - auto status = nan_iface->getName(&name); - ASSERT_EQ(status.getServiceSpecificError(), - static_cast(WifiStatusCode::ERROR_WIFI_IFACE_INVALID)); + // We should have 0 nan iface now. + chip_->getNanIfaceNames([](const WifiStatus& status, const hidl_vec& iface_names) { + ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); + ASSERT_EQ(iface_names.size(), 0u); + }); + // Any operation on the nan iface object should return error now. + nan_iface->getName([](const WifiStatus& status, const std::string& /* iface_name */) { + ASSERT_EQ(WifiStatusCode::ERROR_WIFI_IFACE_INVALID, status.code); + }); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, InvalidateAndRemoveRttControllerOnStaRemove) { @@ -719,25 +723,30 @@ TEST_F(WifiChipV2_AwareIfaceCombinationTest, InvalidateAndRemoveRttControllerOnS ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); // Create RTT controller - std::shared_ptr rtt_controller; - ASSERT_TRUE(chip_->createRttController(nullptr, &rtt_controller).isOk()); + sp rtt_controller; + chip_->createRttController_1_6( + NULL, [&rtt_controller](const WifiStatus& status, const sp& rtt) { + if (WifiStatusCode::SUCCESS == status.code) { + ASSERT_NE(rtt.get(), nullptr); + rtt_controller = rtt; + } + }); // Remove the STA iface. removeIface(IfaceType::STA, "wlan0"); - // Any operation on the rtt controller object should now return an error. - std::shared_ptr bound_iface; - auto status = rtt_controller->getBoundIface(&bound_iface); - ASSERT_EQ(status.getServiceSpecificError(), - static_cast(WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID)); + // Any operation on the rtt controller object should return error now. + rtt_controller->getBoundIface([](const WifiStatus& status, const sp& /* iface */) { + ASSERT_EQ(WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, status.code); + }); } TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateNanWithSharedNanIface) { property_set("wifi.aware.interface", nullptr); findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); - ASSERT_EQ(createIface(IfaceType::NAN_IFACE), "wlan0"); - removeIface(IfaceType::NAN_IFACE, "wlan0"); + ASSERT_EQ(createIface(IfaceType::NAN), "wlan0"); + removeIface(IfaceType::NAN, "wlan0"); EXPECT_CALL(*iface_util_, setUpState(testing::_, testing::_)).Times(0); } @@ -747,10 +756,10 @@ TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateNanWithDedicatedNanIface) { ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); EXPECT_CALL(*iface_util_, ifNameToIndex("aware0")).WillOnce(testing::Return(4)); EXPECT_CALL(*iface_util_, setUpState("aware0", true)).WillOnce(testing::Return(true)); - ASSERT_EQ(createIface(IfaceType::NAN_IFACE), "aware0"); + ASSERT_EQ(createIface(IfaceType::NAN), "aware0"); EXPECT_CALL(*iface_util_, setUpState("aware0", false)).WillOnce(testing::Return(true)); - removeIface(IfaceType::NAN_IFACE, "aware0"); + removeIface(IfaceType::NAN, "aware0"); } ////////// V1 Iface Combinations when AP creation is disabled ////////// @@ -848,8 +857,8 @@ TEST_F(WifiChip_MultiIfaceTest, CreateApStartsWithIdx1) { ASSERT_EQ(createIface(IfaceType::STA), "wlan1"); ASSERT_EQ(createIface(IfaceType::STA), "wlan3"); } - +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl diff --git a/wifi/aidl/default/tests/wifi_iface_util_unit_tests.cpp b/wifi/1.6/default/tests/wifi_iface_util_unit_tests.cpp similarity index 92% rename from wifi/aidl/default/tests/wifi_iface_util_unit_tests.cpp rename to wifi/1.6/default/tests/wifi_iface_util_unit_tests.cpp index e0db6fdc90..cc9a3340a5 100644 --- a/wifi/aidl/default/tests/wifi_iface_util_unit_tests.cpp +++ b/wifi/1.6/default/tests/wifi_iface_util_unit_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2019, 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. @@ -18,6 +18,7 @@ #include #include +#undef NAN #include "wifi_iface_util.h" #include "mock_interface_tool.h" @@ -37,16 +38,16 @@ bool isValidUnicastLocallyAssignedMacAddress(const std::array& mac_a } } // namespace -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { namespace iface_util { - class WifiIfaceUtilTest : public Test { protected: - std::shared_ptr> iface_tool_{ - new NiceMock<::android::wifi_system::MockInterfaceTool>}; + std::shared_ptr> iface_tool_{ + new NiceMock}; legacy_hal::wifi_hal_fn fake_func_table_; std::shared_ptr> legacy_hal_{ new NiceMock(iface_tool_, fake_func_table_, true)}; @@ -88,7 +89,8 @@ TEST_F(WifiIfaceUtilTest, IfaceEventHandlers_SetMacAddress) { ASSERT_FALSE(callback_invoked); } } // namespace iface_util +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl diff --git a/wifi/1.6/default/tests/wifi_nan_iface_unit_tests.cpp b/wifi/1.6/default/tests/wifi_nan_iface_unit_tests.cpp new file mode 100644 index 0000000000..8a5ddcd998 --- /dev/null +++ b/wifi/1.6/default/tests/wifi_nan_iface_unit_tests.cpp @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2019, 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. + */ + +#include +#include +#include +#include + +#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 +#include "wifi_nan_iface.h" + +#include "mock_interface_tool.h" +#include "mock_wifi_feature_flags.h" +#include "mock_wifi_iface_util.h" +#include "mock_wifi_legacy_hal.h" + +using testing::NiceMock; +using testing::Return; +using testing::Test; + +namespace { +constexpr char kIfaceName[] = "mockWlan0"; +} // namespace + +namespace android { +namespace hardware { +namespace wifi { +namespace V1_6 { +namespace implementation { + +using android::hardware::wifi::V1_2::NanDataPathConfirmInd; + +bool CaptureIfaceEventHandlers(const std::string& /* iface_name*/, + iface_util::IfaceEventHandlers in_iface_event_handlers, + iface_util::IfaceEventHandlers* out_iface_event_handlers) { + *out_iface_event_handlers = in_iface_event_handlers; + return true; +} + +class MockNanIfaceEventCallback : public V1_5::IWifiNanIfaceEventCallback { + public: + MockNanIfaceEventCallback() = default; + + MOCK_METHOD3(notifyCapabilitiesResponse, + Return(uint16_t, const WifiNanStatus&, + const android::hardware::wifi::V1_0::NanCapabilities&)); + MOCK_METHOD2(notifyEnableResponse, Return(uint16_t, const WifiNanStatus&)); + MOCK_METHOD2(notifyConfigResponse, Return(uint16_t, const WifiNanStatus&)); + MOCK_METHOD2(notifyDisableResponse, Return(uint16_t, const WifiNanStatus&)); + MOCK_METHOD3(notifyStartPublishResponse, Return(uint16_t, const WifiNanStatus&, uint8_t)); + MOCK_METHOD2(notifyStopPublishResponse, Return(uint16_t, const WifiNanStatus&)); + MOCK_METHOD3(notifyStartSubscribeResponse, + Return(uint16_t, const WifiNanStatus&, uint8_t)); + MOCK_METHOD2(notifyStopSubscribeResponse, Return(uint16_t, const WifiNanStatus&)); + MOCK_METHOD2(notifyTransmitFollowupResponse, Return(uint16_t, const WifiNanStatus&)); + MOCK_METHOD2(notifyCreateDataInterfaceResponse, Return(uint16_t, const WifiNanStatus&)); + MOCK_METHOD2(notifyDeleteDataInterfaceResponse, Return(uint16_t, const WifiNanStatus&)); + MOCK_METHOD3(notifyInitiateDataPathResponse, + Return(uint16_t, const WifiNanStatus&, uint32_t)); + MOCK_METHOD2(notifyRespondToDataPathIndicationResponse, + Return(uint16_t, const WifiNanStatus&)); + MOCK_METHOD2(notifyTerminateDataPathResponse, Return(uint16_t, const WifiNanStatus&)); + MOCK_METHOD1(eventClusterEvent, Return(const NanClusterEventInd&)); + MOCK_METHOD1(eventDisabled, Return(const WifiNanStatus&)); + MOCK_METHOD2(eventPublishTerminated, Return(uint8_t, const WifiNanStatus&)); + MOCK_METHOD2(eventSubscribeTerminated, Return(uint8_t, const WifiNanStatus&)); + MOCK_METHOD1(eventMatch, Return(const V1_0::NanMatchInd&)); + MOCK_METHOD1(eventMatch_1_6, Return(const NanMatchInd&)); + MOCK_METHOD2(eventMatchExpired, Return(uint8_t, uint32_t)); + MOCK_METHOD1(eventFollowupReceived, Return(const NanFollowupReceivedInd&)); + MOCK_METHOD2(eventTransmitFollowup, Return(uint16_t, const WifiNanStatus&)); + MOCK_METHOD1(eventDataPathRequest, Return(const NanDataPathRequestInd&)); + MOCK_METHOD1(eventDataPathConfirm, + Return(const android::hardware::wifi::V1_0::NanDataPathConfirmInd&)); + MOCK_METHOD1(eventDataPathTerminated, Return(uint32_t)); + MOCK_METHOD1(eventDataPathConfirm_1_2, + Return(const android::hardware::wifi::V1_2::NanDataPathConfirmInd&)); + MOCK_METHOD1(eventDataPathConfirm_1_6, Return(const NanDataPathConfirmInd&)); + MOCK_METHOD1(eventDataPathScheduleUpdate, + Return(const android::hardware::wifi::V1_2::NanDataPathScheduleUpdateInd&)); + MOCK_METHOD1(eventDataPathScheduleUpdate_1_6, + Return(const NanDataPathScheduleUpdateInd&)); + MOCK_METHOD3(notifyCapabilitiesResponse_1_5, + Return(uint16_t, const WifiNanStatus&, const V1_5::NanCapabilities&)); +}; + +class WifiNanIfaceTest : public Test { + protected: + legacy_hal::wifi_hal_fn fake_func_table_; + std::shared_ptr> iface_tool_{ + new NiceMock}; + std::shared_ptr> legacy_hal_{ + new NiceMock(iface_tool_, fake_func_table_, true)}; + std::shared_ptr> iface_util_{ + new NiceMock(iface_tool_, legacy_hal_)}; +}; + +TEST_F(WifiNanIfaceTest, IfacEventHandlers_OnStateToggleOffOn) { + iface_util::IfaceEventHandlers captured_iface_event_handlers = {}; + EXPECT_CALL(*legacy_hal_, nanRegisterCallbackHandlers(testing::_, testing::_)) + .WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS)); + EXPECT_CALL(*iface_util_, registerIfaceEventHandlers(testing::_, testing::_)) + .WillOnce(testing::Invoke(bind(CaptureIfaceEventHandlers, std::placeholders::_1, + std::placeholders::_2, &captured_iface_event_handlers))); + sp nan_iface = new WifiNanIface(kIfaceName, false, legacy_hal_, iface_util_); + + // Register a mock nan event callback. + sp> mock_event_callback{ + new NiceMock}; + nan_iface->registerEventCallback(mock_event_callback, [](const WifiStatus& status) { + ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); + }); + // Ensure that the eventDisabled() function in mock callback will be + // invoked. + WifiNanStatus expected_nan_status = {NanStatusType::UNSUPPORTED_CONCURRENCY_NAN_DISABLED, ""}; + EXPECT_CALL(*mock_event_callback, eventDisabled(expected_nan_status)).Times(1); + + // Trigger the iface state toggle callback. + captured_iface_event_handlers.on_state_toggle_off_on(kIfaceName); +} +} // namespace implementation +} // namespace V1_6 +} // namespace wifi +} // namespace hardware +} // namespace android diff --git a/wifi/aidl/default/wifi.cpp b/wifi/1.6/default/wifi.cpp similarity index 60% rename from wifi/aidl/default/wifi.cpp rename to wifi/1.6/default/wifi.cpp index e30c38abcf..c302ce2434 100644 --- a/wifi/aidl/default/wifi.cpp +++ b/wifi/1.6/default/wifi.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2016 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. @@ -14,26 +14,26 @@ * limitations under the License. */ -#include "wifi.h" - #include -#include "aidl_return_util.h" +#include "hidl_return_util.h" +#include "wifi.h" #include "wifi_status_util.h" namespace { // Starting Chip ID, will be assigned to primary chip -static constexpr int32_t kPrimaryChipId = 0; +static constexpr android::hardware::wifi::V1_0::ChipId kPrimaryChipId = 0; } // namespace -namespace aidl { namespace android { namespace hardware { namespace wifi { -using aidl_return_util::validateAndCall; -using aidl_return_util::validateAndCallWithLock; +namespace V1_6 { +namespace implementation { +using hidl_return_util::validateAndCall; +using hidl_return_util::validateAndCallWithLock; -Wifi::Wifi(const std::shared_ptr<::android::wifi_system::InterfaceTool> iface_tool, +Wifi::Wifi(const std::shared_ptr iface_tool, const std::shared_ptr legacy_hal_factory, const std::shared_ptr mode_controller, const std::shared_ptr feature_flags) @@ -48,74 +48,86 @@ bool Wifi::isValid() { return true; } -ndk::ScopedAStatus Wifi::registerEventCallback( - const std::shared_ptr& in_callback) { +Return Wifi::registerEventCallback(const sp& event_callback, + registerEventCallback_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN, - &Wifi::registerEventCallbackInternal, in_callback); + &Wifi::registerEventCallbackInternal, hidl_status_cb, event_callback); } -ndk::ScopedAStatus Wifi::isStarted(bool* _aidl_return) { - *_aidl_return = (run_state_ != RunState::STOPPED); - return ndk::ScopedAStatus::ok(); +Return Wifi::registerEventCallback_1_5(const sp& event_callback, + registerEventCallback_1_5_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN, + &Wifi::registerEventCallbackInternal_1_5, hidl_status_cb, + event_callback); } -ndk::ScopedAStatus Wifi::start() { - return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN, &Wifi::startInternal); +Return Wifi::isStarted() { + return run_state_ != RunState::STOPPED; } -ndk::ScopedAStatus Wifi::stop() { - return validateAndCallWithLock(this, WifiStatusCode::ERROR_UNKNOWN, &Wifi::stopInternal); +Return Wifi::start(start_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN, &Wifi::startInternal, + hidl_status_cb); } -ndk::ScopedAStatus Wifi::getChipIds(std::vector* _aidl_return) { +Return Wifi::stop(stop_cb hidl_status_cb) { + return validateAndCallWithLock(this, WifiStatusCode::ERROR_UNKNOWN, &Wifi::stopInternal, + hidl_status_cb); +} + +Return Wifi::getChipIds(getChipIds_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN, &Wifi::getChipIdsInternal, - _aidl_return); + hidl_status_cb); } -ndk::ScopedAStatus Wifi::getChip(int32_t in_chipId, std::shared_ptr* _aidl_return) { +Return Wifi::getChip(ChipId chip_id, getChip_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN, &Wifi::getChipInternal, - _aidl_return, in_chipId); + hidl_status_cb, chip_id); } -binder_status_t Wifi::dump(int fd, const char** args, uint32_t numArgs) { - LOG(INFO) << "-----------Debug was called----------------"; +Return Wifi::debug(const hidl_handle& handle, const hidl_vec&) { + LOG(INFO) << "-----------Debug is called----------------"; if (chips_.size() == 0) { - LOG(INFO) << "No chips to display."; - return STATUS_OK; + return Void(); } - for (std::shared_ptr chip : chips_) { + for (sp chip : chips_) { if (!chip.get()) continue; - chip->dump(fd, args, numArgs); + + chip->debug(handle, {}); } - return STATUS_OK; + return Void(); } -ndk::ScopedAStatus Wifi::registerEventCallbackInternal( - const std::shared_ptr& event_callback) { +WifiStatus Wifi::registerEventCallbackInternal( + const sp& event_callback __unused) { + // Deprecated support for this callback. + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + +WifiStatus Wifi::registerEventCallbackInternal_1_5( + const sp& event_callback) { if (!event_cb_handler_.addCallback(event_callback)) { return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); } - return ndk::ScopedAStatus::ok(); + return createWifiStatus(WifiStatusCode::SUCCESS); } -ndk::ScopedAStatus Wifi::startInternal() { +WifiStatus Wifi::startInternal() { if (run_state_ == RunState::STARTED) { - return ndk::ScopedAStatus::ok(); + return createWifiStatus(WifiStatusCode::SUCCESS); } else if (run_state_ == RunState::STOPPING) { return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE, "HAL is stopping"); } - ndk::ScopedAStatus wifi_status = initializeModeControllerAndLegacyHal(); - if (wifi_status.isOk()) { + WifiStatus wifi_status = initializeModeControllerAndLegacyHal(); + if (wifi_status.code == WifiStatusCode::SUCCESS) { // Register the callback for subsystem restart const auto& on_subsystem_restart_callback = [this](const std::string& error) { - ndk::ScopedAStatus wifi_status = createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, error); + WifiStatus wifi_status = createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, error); for (const auto& callback : event_cb_handler_.getCallbacks()) { LOG(INFO) << "Attempting to invoke onSubsystemRestart " "callback"; - WifiStatusCode errorCode = - static_cast(wifi_status.getServiceSpecificError()); - if (!callback->onSubsystemRestart(errorCode).isOk()) { + if (!callback->onSubsystemRestart(wifi_status).isOk()) { LOG(ERROR) << "Failed to invoke onSubsystemRestart callback"; } else { LOG(INFO) << "Succeeded to invoke onSubsystemRestart " @@ -125,12 +137,12 @@ ndk::ScopedAStatus Wifi::startInternal() { }; // Create the chip instance once the HAL is started. - int32_t chipId = kPrimaryChipId; + android::hardware::wifi::V1_0::ChipId chipId = kPrimaryChipId; for (auto& hal : legacy_hals_) { chips_.push_back( - WifiChip::create(chipId, chipId == kPrimaryChipId, hal, mode_controller_, - std::make_shared(iface_tool_, hal), - feature_flags_, on_subsystem_restart_callback)); + new WifiChip(chipId, chipId == kPrimaryChipId, hal, mode_controller_, + std::make_shared(iface_tool_, hal), + feature_flags_, on_subsystem_restart_callback)); chipId++; } run_state_ = RunState::STARTED; @@ -142,9 +154,7 @@ ndk::ScopedAStatus Wifi::startInternal() { LOG(INFO) << "Wifi HAL started"; } else { for (const auto& callback : event_cb_handler_.getCallbacks()) { - WifiStatusCode errorCode = - static_cast(wifi_status.getServiceSpecificError()); - if (!callback->onFailure(errorCode).isOk()) { + if (!callback->onFailure(wifi_status).isOk()) { LOG(ERROR) << "Failed to invoke onFailure callback"; } } @@ -155,10 +165,10 @@ ndk::ScopedAStatus Wifi::startInternal() { return wifi_status; } -ndk::ScopedAStatus Wifi::stopInternal( +WifiStatus Wifi::stopInternal( /* NONNULL */ std::unique_lock* lock) { if (run_state_ == RunState::STOPPED) { - return ndk::ScopedAStatus::ok(); + return createWifiStatus(WifiStatusCode::SUCCESS); } else if (run_state_ == RunState::STOPPING) { return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE, "HAL is stopping"); } @@ -167,12 +177,12 @@ ndk::ScopedAStatus Wifi::stopInternal( for (auto& chip : chips_) { if (chip.get()) { chip->invalidate(); - chip.reset(); + chip.clear(); } } chips_.clear(); - ndk::ScopedAStatus wifi_status = stopLegacyHalAndDeinitializeModeController(lock); - if (wifi_status.isOk()) { + WifiStatus wifi_status = stopLegacyHalAndDeinitializeModeController(lock); + if (wifi_status.code == WifiStatusCode::SUCCESS) { for (const auto& callback : event_cb_handler_.getCallbacks()) { if (!callback->onStop().isOk()) { LOG(ERROR) << "Failed to invoke onStop callback"; @@ -181,9 +191,7 @@ ndk::ScopedAStatus Wifi::stopInternal( LOG(INFO) << "Wifi HAL stopped"; } else { for (const auto& callback : event_cb_handler_.getCallbacks()) { - WifiStatusCode errorCode = - static_cast(wifi_status.getServiceSpecificError()); - if (!callback->onFailure(errorCode).isOk()) { + if (!callback->onFailure(wifi_status).isOk()) { LOG(ERROR) << "Failed to invoke onFailure callback"; } } @@ -194,26 +202,27 @@ ndk::ScopedAStatus Wifi::stopInternal( return wifi_status; } -std::pair, ndk::ScopedAStatus> Wifi::getChipIdsInternal() { - std::vector chip_ids; +std::pair> Wifi::getChipIdsInternal() { + std::vector chip_ids; for (auto& chip : chips_) { - int32_t chip_id = getChipIdFromWifiChip(chip); - if (chip_id != INT32_MAX) chip_ids.emplace_back(chip_id); + ChipId chip_id = getChipIdFromWifiChip(chip); + if (chip_id != UINT32_MAX) chip_ids.emplace_back(chip_id); } - return {std::move(chip_ids), ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), std::move(chip_ids)}; } -std::pair, ndk::ScopedAStatus> Wifi::getChipInternal(int32_t chip_id) { +std::pair> Wifi::getChipInternal(ChipId chip_id) { for (auto& chip : chips_) { - int32_t cand_id = getChipIdFromWifiChip(chip); - if ((cand_id != INT32_MAX) && (cand_id == chip_id)) return {chip, ndk::ScopedAStatus::ok()}; + ChipId cand_id = getChipIdFromWifiChip(chip); + if ((cand_id != UINT32_MAX) && (cand_id == chip_id)) + return {createWifiStatus(WifiStatusCode::SUCCESS), chip}; } - return {nullptr, createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)}; + return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr}; } -ndk::ScopedAStatus Wifi::initializeModeControllerAndLegacyHal() { +WifiStatus Wifi::initializeModeControllerAndLegacyHal() { if (!mode_controller_->initialize()) { LOG(ERROR) << "Failed to initialize firmware mode controller"; return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); @@ -235,10 +244,10 @@ ndk::ScopedAStatus Wifi::initializeModeControllerAndLegacyHal() { } index++; } - return ndk::ScopedAStatus::ok(); + return createWifiStatus(WifiStatusCode::SUCCESS); } -ndk::ScopedAStatus Wifi::stopLegacyHalAndDeinitializeModeController( +WifiStatus Wifi::stopLegacyHalAndDeinitializeModeController( /* NONNULL */ std::unique_lock* lock) { legacy_hal::wifi_error legacy_status = legacy_hal::WIFI_SUCCESS; int index = 0; @@ -263,22 +272,23 @@ ndk::ScopedAStatus Wifi::stopLegacyHalAndDeinitializeModeController( LOG(ERROR) << "Failed to deinitialize firmware mode controller"; return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); } - return ndk::ScopedAStatus::ok(); + return createWifiStatus(WifiStatusCode::SUCCESS); } -int32_t Wifi::getChipIdFromWifiChip(std::shared_ptr& chip) { - int32_t chip_id = INT32_MAX; +ChipId Wifi::getChipIdFromWifiChip(sp& chip) { + ChipId chip_id = UINT32_MAX; if (chip.get()) { - ndk::ScopedAStatus status = chip->getId(&chip_id); - if (!status.isOk()) { - // Reset value if operation failed. - chip_id = INT32_MAX; - } + chip->getId([&](WifiStatus status, uint32_t id) { + if (status.code == WifiStatusCode::SUCCESS) { + chip_id = id; + } + }); } + return chip_id; } - +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl diff --git a/wifi/1.6/default/wifi.h b/wifi/1.6/default/wifi.h new file mode 100644 index 0000000000..435358e797 --- /dev/null +++ b/wifi/1.6/default/wifi.h @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2016 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. + */ + +#ifndef WIFI_H_ +#define WIFI_H_ + +// HACK: NAN is a macro defined in math.h, which can be included in various +// headers. This wifi HAL uses an enum called NAN, which does not compile when +// the macro is defined. Undefine NAN to work around it. +#undef NAN +#include + +#include +#include +#include + +#include "hidl_callback_util.h" +#include "wifi_chip.h" +#include "wifi_feature_flags.h" +#include "wifi_legacy_hal.h" +#include "wifi_legacy_hal_factory.h" +#include "wifi_mode_controller.h" + +namespace android { +namespace hardware { +namespace wifi { +namespace V1_6 { +namespace implementation { + +/** + * Root HIDL interface object used to control the Wifi HAL. + */ +class Wifi : public V1_6::IWifi { + public: + Wifi(const std::shared_ptr iface_tool, + const std::shared_ptr legacy_hal_factory, + const std::shared_ptr mode_controller, + const std::shared_ptr feature_flags); + + bool isValid(); + + // HIDL methods exposed. + Return registerEventCallback(const sp& event_callback, + registerEventCallback_cb hidl_status_cb) override; + Return registerEventCallback_1_5(const sp& event_callback, + registerEventCallback_1_5_cb hidl_status_cb) override; + Return isStarted() override; + Return start(start_cb hidl_status_cb) override; + Return stop(stop_cb hidl_status_cb) override; + Return getChipIds(getChipIds_cb hidl_status_cb) override; + Return getChip(ChipId chip_id, getChip_cb hidl_status_cb) override; + Return debug(const hidl_handle& handle, const hidl_vec& options) override; + + private: + enum class RunState { STOPPED, STARTED, STOPPING }; + + // Corresponding worker functions for the HIDL methods. + WifiStatus registerEventCallbackInternal( + const sp& event_callback __unused); + WifiStatus registerEventCallbackInternal_1_5( + const sp& event_callback); + WifiStatus startInternal(); + WifiStatus stopInternal(std::unique_lock* lock); + std::pair> getChipIdsInternal(); + std::pair> getChipInternal(ChipId chip_id); + + WifiStatus initializeModeControllerAndLegacyHal(); + WifiStatus stopLegacyHalAndDeinitializeModeController( + std::unique_lock* lock); + ChipId getChipIdFromWifiChip(sp& chip); + + // Instance is created in this root level |IWifi| HIDL interface object + // and shared with all the child HIDL interface objects. + std::shared_ptr iface_tool_; + std::shared_ptr legacy_hal_factory_; + std::shared_ptr mode_controller_; + std::vector> legacy_hals_; + std::shared_ptr feature_flags_; + RunState run_state_; + std::vector> chips_; + hidl_callback_util::HidlCallbackHandler event_cb_handler_; + + DISALLOW_COPY_AND_ASSIGN(Wifi); +}; + +} // namespace implementation +} // namespace V1_6 +} // namespace wifi +} // namespace hardware +} // namespace android + +#endif // WIFI_H_ diff --git a/wifi/aidl/default/wifi_ap_iface.cpp b/wifi/1.6/default/wifi_ap_iface.cpp similarity index 59% rename from wifi/aidl/default/wifi_ap_iface.cpp rename to wifi/1.6/default/wifi_ap_iface.cpp index 6cd932df41..b2957db13f 100644 --- a/wifi/aidl/default/wifi_ap_iface.cpp +++ b/wifi/1.6/default/wifi_ap_iface.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2016 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. @@ -14,19 +14,19 @@ * limitations under the License. */ -#include "wifi_ap_iface.h" - #include -#include "aidl_return_util.h" -#include "aidl_struct_util.h" +#include "hidl_return_util.h" +#include "hidl_struct_util.h" +#include "wifi_ap_iface.h" #include "wifi_status_util.h" -namespace aidl { namespace android { namespace hardware { namespace wifi { -using aidl_return_util::validateAndCall; +namespace V1_6 { +namespace implementation { +using hidl_return_util::validateAndCall; WifiApIface::WifiApIface(const std::string& ifname, const std::vector& instances, const std::weak_ptr legacy_hal, @@ -54,66 +54,76 @@ void WifiApIface::removeInstance(std::string instance) { instances_.erase(std::remove(instances_.begin(), instances_.end(), instance), instances_.end()); } -ndk::ScopedAStatus WifiApIface::getName(std::string* _aidl_return) { +Return WifiApIface::getName(getName_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::getNameInternal, _aidl_return); + &WifiApIface::getNameInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiApIface::setCountryCode(const std::array& in_code) { +Return WifiApIface::getType(getType_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::setCountryCodeInternal, in_code); + &WifiApIface::getTypeInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiApIface::getValidFrequenciesForBand(WifiBand in_band, - std::vector* _aidl_return) { +Return WifiApIface::setCountryCode(const hidl_array& code, + setCountryCode_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::getValidFrequenciesForBandInternal, _aidl_return, in_band); + &WifiApIface::setCountryCodeInternal, hidl_status_cb, code); } -ndk::ScopedAStatus WifiApIface::setMacAddress(const std::array& in_mac) { +Return WifiApIface::getValidFrequenciesForBand(V1_0::WifiBand band, + getValidFrequenciesForBand_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::setMacAddressInternal, in_mac); + &WifiApIface::getValidFrequenciesForBandInternal, hidl_status_cb, band); } -ndk::ScopedAStatus WifiApIface::getFactoryMacAddress(std::array* _aidl_return) { +Return WifiApIface::setMacAddress(const hidl_array& mac, + setMacAddress_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::getFactoryMacAddressInternal, _aidl_return, + &WifiApIface::setMacAddressInternal, hidl_status_cb, mac); +} + +Return WifiApIface::getFactoryMacAddress(getFactoryMacAddress_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiApIface::getFactoryMacAddressInternal, hidl_status_cb, instances_.size() > 0 ? instances_[0] : ifname_); } -ndk::ScopedAStatus WifiApIface::resetToFactoryMacAddress() { +Return WifiApIface::resetToFactoryMacAddress(resetToFactoryMacAddress_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::resetToFactoryMacAddressInternal); + &WifiApIface::resetToFactoryMacAddressInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiApIface::getBridgedInstances(std::vector* _aidl_return) { +Return WifiApIface::getBridgedInstances(getBridgedInstances_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::getBridgedInstancesInternal, _aidl_return); + &WifiApIface::getBridgedInstancesInternal, hidl_status_cb); } -std::pair WifiApIface::getNameInternal() { - return {ifname_, ndk::ScopedAStatus::ok()}; +std::pair WifiApIface::getNameInternal() { + return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_}; } -ndk::ScopedAStatus WifiApIface::setCountryCodeInternal(const std::array& code) { +std::pair WifiApIface::getTypeInternal() { + return {createWifiStatus(WifiStatusCode::SUCCESS), IfaceType::AP}; +} + +WifiStatus WifiApIface::setCountryCodeInternal(const std::array& code) { legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->setCountryCode( instances_.size() > 0 ? instances_[0] : ifname_, code); return createWifiStatusFromLegacyError(legacy_status); } -std::pair, ndk::ScopedAStatus> WifiApIface::getValidFrequenciesForBandInternal( - WifiBand band) { - static_assert(sizeof(WifiChannelWidthInMhz) == sizeof(int32_t), "Size mismatch"); +std::pair> +WifiApIface::getValidFrequenciesForBandInternal(V1_0::WifiBand band) { + static_assert(sizeof(WifiChannelInMhz) == sizeof(uint32_t), "Size mismatch"); legacy_hal::wifi_error legacy_status; std::vector valid_frequencies; std::tie(legacy_status, valid_frequencies) = legacy_hal_.lock()->getValidFrequenciesForBand( instances_.size() > 0 ? instances_[0] : ifname_, - aidl_struct_util::convertAidlWifiBandToLegacy(band)); - return {std::vector(valid_frequencies.begin(), valid_frequencies.end()), - createWifiStatusFromLegacyError(legacy_status)}; + hidl_struct_util::convertHidlWifiBandToLegacy(band)); + return {createWifiStatusFromLegacyError(legacy_status), valid_frequencies}; } -ndk::ScopedAStatus WifiApIface::setMacAddressInternal(const std::array& mac) { +WifiStatus WifiApIface::setMacAddressInternal(const std::array& mac) { // Support random MAC up to 2 interfaces if (instances_.size() == 2) { int rbyte = 1; @@ -135,35 +145,35 @@ ndk::ScopedAStatus WifiApIface::setMacAddressInternal(const std::array, ndk::ScopedAStatus> WifiApIface::getFactoryMacAddressInternal( +std::pair> WifiApIface::getFactoryMacAddressInternal( const std::string& ifaceName) { std::array mac = iface_util_.lock()->getFactoryMacAddress(ifaceName); if (mac[0] == 0 && mac[1] == 0 && mac[2] == 0 && mac[3] == 0 && mac[4] == 0 && mac[5] == 0) { - return {mac, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), mac}; } - return {mac, ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), mac}; } -ndk::ScopedAStatus WifiApIface::resetToFactoryMacAddressInternal() { - std::pair, ndk::ScopedAStatus> getMacResult; +WifiStatus WifiApIface::resetToFactoryMacAddressInternal() { + std::pair> getMacResult; if (instances_.size() == 2) { for (auto const& intf : instances_) { getMacResult = getFactoryMacAddressInternal(intf); LOG(DEBUG) << "Reset MAC to factory MAC on " << intf; - if (!getMacResult.second.isOk() || - !iface_util_.lock()->setMacAddress(intf, getMacResult.first)) { + if (getMacResult.first.code != WifiStatusCode::SUCCESS || + !iface_util_.lock()->setMacAddress(intf, getMacResult.second)) { return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); } } - // We need to set mac address for bridged interface, otherwise the mac + // It needs to set mac address for bridged interface, otherwise the mac // address of the bridged interface will be changed after one of the - // instances goes down. Thus we are generating a random MAC address for - // the bridged interface even if we got the request to reset the Factory - // MAC. This is because the bridged interface is an internal interface - // for the operation of bpf and other networking operations. + // instance down. Thus we are generating a random MAC address for the + // bridged interface even if we got the request to reset the Factory + // MAC. Since the bridged interface is an internal interface for the + // operation of bpf and others networking operation. if (!iface_util_.lock()->setMacAddress(ifname_, iface_util_.lock()->createRandomMacAddress())) { LOG(ERROR) << "Fail to config MAC for bridged interface " << ifname_; @@ -172,19 +182,23 @@ ndk::ScopedAStatus WifiApIface::resetToFactoryMacAddressInternal() { } else { getMacResult = getFactoryMacAddressInternal(ifname_); LOG(DEBUG) << "Reset MAC to factory MAC on " << ifname_; - if (!getMacResult.second.isOk() || - !iface_util_.lock()->setMacAddress(ifname_, getMacResult.first)) { + if (getMacResult.first.code != WifiStatusCode::SUCCESS || + !iface_util_.lock()->setMacAddress(ifname_, getMacResult.second)) { return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); } } - return ndk::ScopedAStatus::ok(); + return createWifiStatus(WifiStatusCode::SUCCESS); } -std::pair, ndk::ScopedAStatus> WifiApIface::getBridgedInstancesInternal() { - return {instances_, ndk::ScopedAStatus::ok()}; +std::pair> WifiApIface::getBridgedInstancesInternal() { + std::vector instances; + for (const auto& instance_name : instances_) { + instances.push_back(instance_name); + } + return {createWifiStatus(WifiStatusCode::SUCCESS), instances}; } - +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl diff --git a/wifi/1.6/default/wifi_ap_iface.h b/wifi/1.6/default/wifi_ap_iface.h new file mode 100644 index 0000000000..d1c06424df --- /dev/null +++ b/wifi/1.6/default/wifi_ap_iface.h @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2016 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. + */ + +#ifndef WIFI_AP_IFACE_H_ +#define WIFI_AP_IFACE_H_ + +#include +#include + +#include "wifi_iface_util.h" +#include "wifi_legacy_hal.h" + +namespace android { +namespace hardware { +namespace wifi { +namespace V1_6 { +namespace implementation { +using namespace android::hardware::wifi::V1_0; + +/** + * HIDL interface object used to control a AP Iface instance. + */ +class WifiApIface : public V1_5::IWifiApIface { + public: + WifiApIface(const std::string& ifname, const std::vector& instances, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util); + // Refer to |WifiChip::invalidate()|. + void invalidate(); + bool isValid(); + std::string getName(); + void removeInstance(std::string instance); + + // HIDL methods exposed. + Return getName(getName_cb hidl_status_cb) override; + Return getType(getType_cb hidl_status_cb) override; + Return setCountryCode(const hidl_array& code, + setCountryCode_cb hidl_status_cb) override; + Return getValidFrequenciesForBand(V1_0::WifiBand band, + getValidFrequenciesForBand_cb hidl_status_cb) override; + Return setMacAddress(const hidl_array& mac, + setMacAddress_cb hidl_status_cb) override; + Return getFactoryMacAddress(getFactoryMacAddress_cb hidl_status_cb) override; + Return resetToFactoryMacAddress(resetToFactoryMacAddress_cb hidl_status_cb) override; + + Return getBridgedInstances(getBridgedInstances_cb hidl_status_cb) override; + + private: + // Corresponding worker functions for the HIDL methods. + std::pair getNameInternal(); + std::pair getTypeInternal(); + WifiStatus setCountryCodeInternal(const std::array& code); + std::pair> getValidFrequenciesForBandInternal( + V1_0::WifiBand band); + WifiStatus setMacAddressInternal(const std::array& mac); + std::pair> getFactoryMacAddressInternal( + const std::string& ifaceName); + WifiStatus resetToFactoryMacAddressInternal(); + std::pair> getBridgedInstancesInternal(); + + std::string ifname_; + std::vector instances_; + std::weak_ptr legacy_hal_; + std::weak_ptr iface_util_; + bool is_valid_; + + DISALLOW_COPY_AND_ASSIGN(WifiApIface); +}; + +} // namespace implementation +} // namespace V1_6 +} // namespace wifi +} // namespace hardware +} // namespace android + +#endif // WIFI_AP_IFACE_H_ diff --git a/wifi/aidl/default/wifi_chip.cpp b/wifi/1.6/default/wifi_chip.cpp similarity index 64% rename from wifi/aidl/default/wifi_chip.cpp rename to wifi/1.6/default/wifi_chip.cpp index 076f351448..920beb8778 100644 --- a/wifi/aidl/default/wifi_chip.cpp +++ b/wifi/1.6/default/wifi_chip.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2016 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. @@ -14,27 +14,30 @@ * limitations under the License. */ -#include "wifi_chip.h" +#include #include #include #include -#include #include #include #include -#include "aidl_return_util.h" -#include "aidl_struct_util.h" +#include "hidl_return_util.h" +#include "hidl_struct_util.h" +#include "wifi_chip.h" #include "wifi_status_util.h" #define P2P_MGMT_DEVICE_PREFIX "p2p-dev-" namespace { -using aidl::android::hardware::wifi::IfaceType; -using aidl::android::hardware::wifi::IWifiChip; -using CoexRestriction = aidl::android::hardware::wifi::IWifiChip::CoexRestriction; +using android::sp; using android::base::unique_fd; +using android::hardware::hidl_string; +using android::hardware::hidl_vec; +using android::hardware::wifi::V1_0::ChipModeId; +using android::hardware::wifi::V1_0::IfaceType; +using android::hardware::wifi::V1_0::IWifiChip; constexpr char kCpioMagic[] = "070701"; constexpr size_t kMaxBufferSizeBytes = 1024 * 1024 * 3; @@ -47,13 +50,13 @@ constexpr unsigned kMaxWlanIfaces = 5; constexpr char kApBridgeIfacePrefix[] = "ap_br_"; template -void invalidateAndClear(std::vector>& ifaces, std::shared_ptr iface) { +void invalidateAndClear(std::vector>& ifaces, sp iface) { iface->invalidate(); ifaces.erase(std::remove(ifaces.begin(), ifaces.end(), iface), ifaces.end()); } template -void invalidateAndClearAll(std::vector>& ifaces) { +void invalidateAndClearAll(std::vector>& ifaces) { for (const auto& iface : ifaces) { iface->invalidate(); } @@ -61,8 +64,8 @@ void invalidateAndClearAll(std::vector>& ifaces) { } template -std::vector getNames(std::vector>& ifaces) { - std::vector names; +std::vector getNames(std::vector>& ifaces) { + std::vector names; for (const auto& iface : ifaces) { names.emplace_back(iface->getName()); } @@ -70,9 +73,8 @@ std::vector getNames(std::vector>& ifaces) { } template -std::shared_ptr findUsingName(std::vector>& ifaces, - const std::string& name) { - std::vector names; +sp findUsingName(std::vector>& ifaces, const std::string& name) { + std::vector names; for (const auto& iface : ifaces) { if (name == iface->getName()) { return iface; @@ -167,8 +169,8 @@ void setActiveWlanIfaceNameProperty(const std::string& ifname) { } } -// Delete files that meet either condition: -// 1. Older than a predefined time in the wifi tombstone dir. +// delete files that meet either conditions: +// 1. older than a predefined time in the wifi tombstone dir. // 2. Files in excess to a predefined amount, starting from the oldest ones bool removeOldFilesInternal() { time_t now = time(0); @@ -352,14 +354,15 @@ std::vector makeCharVec(const std::string& str) { } // namespace -namespace aidl { namespace android { namespace hardware { namespace wifi { -using aidl_return_util::validateAndCall; -using aidl_return_util::validateAndCallWithLock; +namespace V1_6 { +namespace implementation { +using hidl_return_util::validateAndCall; +using hidl_return_util::validateAndCallWithLock; -WifiChip::WifiChip(int32_t chip_id, bool is_primary, +WifiChip::WifiChip(ChipId chip_id, bool is_primary, const std::weak_ptr legacy_hal, const std::weak_ptr mode_controller, const std::shared_ptr iface_util, @@ -377,19 +380,6 @@ WifiChip::WifiChip(int32_t chip_id, bool is_primary, setActiveWlanIfaceNameProperty(kNoActiveWlanIfaceNamePropertyValue); } -std::shared_ptr WifiChip::create( - int32_t chip_id, bool is_primary, const std::weak_ptr legacy_hal, - const std::weak_ptr mode_controller, - const std::shared_ptr iface_util, - const std::weak_ptr feature_flags, - const std::function& handler) { - std::shared_ptr ptr = ndk::SharedRefBase::make( - chip_id, is_primary, legacy_hal, mode_controller, iface_util, feature_flags, handler); - std::weak_ptr weak_ptr_this(ptr); - ptr->setWeakPtr(weak_ptr_this); - return ptr; -} - void WifiChip::invalidate() { if (!writeRingbufferFilesInternal()) { LOG(ERROR) << "Error writing files to flash"; @@ -401,283 +391,348 @@ void WifiChip::invalidate() { is_valid_ = false; } -void WifiChip::setWeakPtr(std::weak_ptr ptr) { - weak_ptr_this_ = ptr; -} - bool WifiChip::isValid() { return is_valid_; } -std::set> WifiChip::getEventCallbacks() { +std::set> WifiChip::getEventCallbacks() { return event_cb_handler_.getCallbacks(); } -ndk::ScopedAStatus WifiChip::getId(int32_t* _aidl_return) { +Return WifiChip::getId(getId_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, &WifiChip::getIdInternal, - _aidl_return); + hidl_status_cb); } -ndk::ScopedAStatus WifiChip::registerEventCallback( - const std::shared_ptr& event_callback) { +// Deprecated support for this callback +Return WifiChip::registerEventCallback(const sp& event_callback, + registerEventCallback_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::registerEventCallbackInternal, event_callback); + &WifiChip::registerEventCallbackInternal, hidl_status_cb, + event_callback); } -ndk::ScopedAStatus WifiChip::getCapabilities(IWifiChip::ChipCapabilityMask* _aidl_return) { +Return WifiChip::getCapabilities(getCapabilities_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getCapabilitiesInternal, _aidl_return); + &WifiChip::getCapabilitiesInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiChip::getAvailableModes(std::vector* _aidl_return) { +Return WifiChip::getAvailableModes(getAvailableModes_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getAvailableModesInternal, _aidl_return); + &WifiChip::getAvailableModesInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiChip::configureChip(int32_t in_modeId) { +Return WifiChip::configureChip(ChipModeId mode_id, configureChip_cb hidl_status_cb) { return validateAndCallWithLock(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::configureChipInternal, in_modeId); + &WifiChip::configureChipInternal, hidl_status_cb, mode_id); } -ndk::ScopedAStatus WifiChip::getMode(int32_t* _aidl_return) { +Return WifiChip::getMode(getMode_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getModeInternal, _aidl_return); + &WifiChip::getModeInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiChip::requestChipDebugInfo(IWifiChip::ChipDebugInfo* _aidl_return) { +Return WifiChip::requestChipDebugInfo(requestChipDebugInfo_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::requestChipDebugInfoInternal, _aidl_return); + &WifiChip::requestChipDebugInfoInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiChip::requestDriverDebugDump(std::vector* _aidl_return) { +Return WifiChip::requestDriverDebugDump(requestDriverDebugDump_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::requestDriverDebugDumpInternal, _aidl_return); + &WifiChip::requestDriverDebugDumpInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiChip::requestFirmwareDebugDump(std::vector* _aidl_return) { +Return WifiChip::requestFirmwareDebugDump(requestFirmwareDebugDump_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::requestFirmwareDebugDumpInternal, _aidl_return); + &WifiChip::requestFirmwareDebugDumpInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiChip::createApIface(std::shared_ptr* _aidl_return) { +Return WifiChip::createApIface(createApIface_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::createApIfaceInternal, _aidl_return); + &WifiChip::createApIfaceInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiChip::createBridgedApIface(std::shared_ptr* _aidl_return) { +Return WifiChip::createBridgedApIface(createBridgedApIface_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::createBridgedApIfaceInternal, _aidl_return); + &WifiChip::createBridgedApIfaceInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiChip::getApIfaceNames(std::vector* _aidl_return) { +Return WifiChip::getApIfaceNames(getApIfaceNames_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getApIfaceNamesInternal, _aidl_return); + &WifiChip::getApIfaceNamesInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiChip::getApIface(const std::string& in_ifname, - std::shared_ptr* _aidl_return) { +Return WifiChip::getApIface(const hidl_string& ifname, getApIface_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getApIfaceInternal, _aidl_return, in_ifname); + &WifiChip::getApIfaceInternal, hidl_status_cb, ifname); } -ndk::ScopedAStatus WifiChip::removeApIface(const std::string& in_ifname) { +Return WifiChip::removeApIface(const hidl_string& ifname, removeApIface_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::removeApIfaceInternal, in_ifname); + &WifiChip::removeApIfaceInternal, hidl_status_cb, ifname); } -ndk::ScopedAStatus WifiChip::removeIfaceInstanceFromBridgedApIface( - const std::string& in_brIfaceName, const std::string& in_ifaceInstanceName) { +Return WifiChip::removeIfaceInstanceFromBridgedApIface( + const hidl_string& ifname, const hidl_string& ifInstanceName, + removeIfaceInstanceFromBridgedApIface_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::removeIfaceInstanceFromBridgedApIfaceInternal, in_brIfaceName, - in_ifaceInstanceName); + &WifiChip::removeIfaceInstanceFromBridgedApIfaceInternal, hidl_status_cb, + ifname, ifInstanceName); } -ndk::ScopedAStatus WifiChip::createNanIface(std::shared_ptr* _aidl_return) { +Return WifiChip::createNanIface(createNanIface_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::createNanIfaceInternal, _aidl_return); + &WifiChip::createNanIfaceInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiChip::getNanIfaceNames(std::vector* _aidl_return) { +Return WifiChip::getNanIfaceNames(getNanIfaceNames_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getNanIfaceNamesInternal, _aidl_return); + &WifiChip::getNanIfaceNamesInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiChip::getNanIface(const std::string& in_ifname, - std::shared_ptr* _aidl_return) { +Return WifiChip::getNanIface(const hidl_string& ifname, getNanIface_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getNanIfaceInternal, _aidl_return, in_ifname); + &WifiChip::getNanIfaceInternal, hidl_status_cb, ifname); } -ndk::ScopedAStatus WifiChip::removeNanIface(const std::string& in_ifname) { +Return WifiChip::removeNanIface(const hidl_string& ifname, removeNanIface_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::removeNanIfaceInternal, in_ifname); + &WifiChip::removeNanIfaceInternal, hidl_status_cb, ifname); } -ndk::ScopedAStatus WifiChip::createP2pIface(std::shared_ptr* _aidl_return) { +Return WifiChip::createP2pIface(createP2pIface_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::createP2pIfaceInternal, _aidl_return); + &WifiChip::createP2pIfaceInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiChip::getP2pIfaceNames(std::vector* _aidl_return) { +Return WifiChip::getP2pIfaceNames(getP2pIfaceNames_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getP2pIfaceNamesInternal, _aidl_return); + &WifiChip::getP2pIfaceNamesInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiChip::getP2pIface(const std::string& in_ifname, - std::shared_ptr* _aidl_return) { +Return WifiChip::getP2pIface(const hidl_string& ifname, getP2pIface_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getP2pIfaceInternal, _aidl_return, in_ifname); + &WifiChip::getP2pIfaceInternal, hidl_status_cb, ifname); } -ndk::ScopedAStatus WifiChip::removeP2pIface(const std::string& in_ifname) { +Return WifiChip::removeP2pIface(const hidl_string& ifname, removeP2pIface_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::removeP2pIfaceInternal, in_ifname); + &WifiChip::removeP2pIfaceInternal, hidl_status_cb, ifname); } -ndk::ScopedAStatus WifiChip::createStaIface(std::shared_ptr* _aidl_return) { +Return WifiChip::createStaIface(createStaIface_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::createStaIfaceInternal, _aidl_return); + &WifiChip::createStaIfaceInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiChip::getStaIfaceNames(std::vector* _aidl_return) { +Return WifiChip::getStaIfaceNames(getStaIfaceNames_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getStaIfaceNamesInternal, _aidl_return); + &WifiChip::getStaIfaceNamesInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiChip::getStaIface(const std::string& in_ifname, - std::shared_ptr* _aidl_return) { +Return WifiChip::getStaIface(const hidl_string& ifname, getStaIface_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getStaIfaceInternal, _aidl_return, in_ifname); + &WifiChip::getStaIfaceInternal, hidl_status_cb, ifname); } -ndk::ScopedAStatus WifiChip::removeStaIface(const std::string& in_ifname) { +Return WifiChip::removeStaIface(const hidl_string& ifname, removeStaIface_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::removeStaIfaceInternal, in_ifname); + &WifiChip::removeStaIfaceInternal, hidl_status_cb, ifname); } -ndk::ScopedAStatus WifiChip::createRttController( - const std::shared_ptr& in_boundIface, - std::shared_ptr* _aidl_return) { +Return WifiChip::createRttController(const sp& bound_iface, + createRttController_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::createRttControllerInternal, _aidl_return, in_boundIface); + &WifiChip::createRttControllerInternal, hidl_status_cb, bound_iface); } -ndk::ScopedAStatus WifiChip::getDebugRingBuffersStatus( - std::vector* _aidl_return) { +Return WifiChip::getDebugRingBuffersStatus(getDebugRingBuffersStatus_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getDebugRingBuffersStatusInternal, _aidl_return); + &WifiChip::getDebugRingBuffersStatusInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiChip::startLoggingToDebugRingBuffer( - const std::string& in_ringName, WifiDebugRingBufferVerboseLevel in_verboseLevel, - int32_t in_maxIntervalInSec, int32_t in_minDataSizeInBytes) { +Return WifiChip::startLoggingToDebugRingBuffer( + const hidl_string& ring_name, WifiDebugRingBufferVerboseLevel verbose_level, + uint32_t max_interval_in_sec, uint32_t min_data_size_in_bytes, + startLoggingToDebugRingBuffer_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::startLoggingToDebugRingBufferInternal, in_ringName, - in_verboseLevel, in_maxIntervalInSec, in_minDataSizeInBytes); + &WifiChip::startLoggingToDebugRingBufferInternal, hidl_status_cb, + ring_name, verbose_level, max_interval_in_sec, min_data_size_in_bytes); } -ndk::ScopedAStatus WifiChip::forceDumpToDebugRingBuffer(const std::string& in_ringName) { +Return WifiChip::forceDumpToDebugRingBuffer(const hidl_string& ring_name, + forceDumpToDebugRingBuffer_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::forceDumpToDebugRingBufferInternal, in_ringName); + &WifiChip::forceDumpToDebugRingBufferInternal, hidl_status_cb, + ring_name); } -ndk::ScopedAStatus WifiChip::flushRingBufferToFile() { +Return WifiChip::flushRingBufferToFile(flushRingBufferToFile_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::flushRingBufferToFileInternal); + &WifiChip::flushRingBufferToFileInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiChip::stopLoggingToDebugRingBuffer() { +Return WifiChip::stopLoggingToDebugRingBuffer( + stopLoggingToDebugRingBuffer_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::stopLoggingToDebugRingBufferInternal); + &WifiChip::stopLoggingToDebugRingBufferInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiChip::getDebugHostWakeReasonStats( - WifiDebugHostWakeReasonStats* _aidl_return) { +Return WifiChip::getDebugHostWakeReasonStats(getDebugHostWakeReasonStats_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getDebugHostWakeReasonStatsInternal, _aidl_return); + &WifiChip::getDebugHostWakeReasonStatsInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiChip::enableDebugErrorAlerts(bool in_enable) { +Return WifiChip::enableDebugErrorAlerts(bool enable, + enableDebugErrorAlerts_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::enableDebugErrorAlertsInternal, in_enable); + &WifiChip::enableDebugErrorAlertsInternal, hidl_status_cb, enable); } -ndk::ScopedAStatus WifiChip::selectTxPowerScenario(IWifiChip::TxPowerScenario in_scenario) { +Return WifiChip::selectTxPowerScenario(V1_1::IWifiChip::TxPowerScenario scenario, + selectTxPowerScenario_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::selectTxPowerScenarioInternal, in_scenario); + &WifiChip::selectTxPowerScenarioInternal, hidl_status_cb, scenario); } -ndk::ScopedAStatus WifiChip::resetTxPowerScenario() { +Return WifiChip::resetTxPowerScenario(resetTxPowerScenario_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::resetTxPowerScenarioInternal); + &WifiChip::resetTxPowerScenarioInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiChip::setLatencyMode(IWifiChip::LatencyMode in_mode) { +Return WifiChip::setLatencyMode(LatencyMode mode, setLatencyMode_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::setLatencyModeInternal, in_mode); + &WifiChip::setLatencyModeInternal, hidl_status_cb, mode); } -binder_status_t WifiChip::dump(int fd, const char**, uint32_t) { - { - std::unique_lock lk(lock_t); - for (const auto& item : ringbuffer_map_) { - forceDumpToDebugRingBufferInternal(item.first); +Return WifiChip::registerEventCallback_1_2( + const sp& event_callback, + registerEventCallback_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::registerEventCallbackInternal_1_2, hidl_status_cb, + event_callback); +} + +Return WifiChip::selectTxPowerScenario_1_2(TxPowerScenario scenario, + selectTxPowerScenario_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::selectTxPowerScenarioInternal_1_2, hidl_status_cb, scenario); +} + +Return WifiChip::getCapabilities_1_3(getCapabilities_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::getCapabilitiesInternal_1_3, hidl_status_cb); +} + +Return WifiChip::getCapabilities_1_5(getCapabilities_1_5_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::getCapabilitiesInternal_1_5, hidl_status_cb); +} + +Return WifiChip::debug(const hidl_handle& handle, const hidl_vec&) { + if (handle != nullptr && handle->numFds >= 1) { + { + std::unique_lock lk(lock_t); + for (const auto& item : ringbuffer_map_) { + forceDumpToDebugRingBufferInternal(item.first); + } + // unique_lock unlocked here } - // unique_lock unlocked here + usleep(100 * 1000); // sleep for 100 milliseconds to wait for + // ringbuffer updates. + int fd = handle->data[0]; + if (!writeRingbufferFilesInternal()) { + LOG(ERROR) << "Error writing files to flash"; + } + uint32_t n_error = cpioArchiveFilesInDir(fd, kTombstoneFolderPath); + if (n_error != 0) { + LOG(ERROR) << n_error << " errors occured in cpio function"; + } + fsync(fd); + } else { + LOG(ERROR) << "File handle error"; } - usleep(100 * 1000); // sleep for 100 milliseconds to wait for - // ringbuffer updates. - if (!writeRingbufferFilesInternal()) { - LOG(ERROR) << "Error writing files to flash"; - } - uint32_t n_error = cpioArchiveFilesInDir(fd, kTombstoneFolderPath); - if (n_error != 0) { - LOG(ERROR) << n_error << " errors occurred in cpio function"; - } - fsync(fd); - return STATUS_OK; + return Void(); } -ndk::ScopedAStatus WifiChip::setMultiStaPrimaryConnection(const std::string& in_ifName) { +Return WifiChip::createRttController_1_4(const sp& bound_iface, + createRttController_1_4_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::setMultiStaPrimaryConnectionInternal, in_ifName); + &WifiChip::createRttControllerInternal_1_4, hidl_status_cb, bound_iface); } -ndk::ScopedAStatus WifiChip::setMultiStaUseCase(IWifiChip::MultiStaUseCase in_useCase) { +Return WifiChip::registerEventCallback_1_4( + const sp& event_callback, + registerEventCallback_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::setMultiStaUseCaseInternal, in_useCase); + &WifiChip::registerEventCallbackInternal_1_4, hidl_status_cb, + event_callback); } -ndk::ScopedAStatus WifiChip::setCoexUnsafeChannels( - const std::vector& in_unsafeChannels, - CoexRestriction in_restrictions) { +Return WifiChip::setMultiStaPrimaryConnection( + const hidl_string& ifname, setMultiStaPrimaryConnection_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::setCoexUnsafeChannelsInternal, in_unsafeChannels, - in_restrictions); + &WifiChip::setMultiStaPrimaryConnectionInternal, hidl_status_cb, ifname); } -ndk::ScopedAStatus WifiChip::setCountryCode(const std::array& in_code) { +Return WifiChip::setMultiStaUseCase(MultiStaUseCase use_case, + setMultiStaUseCase_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::setMultiStaUseCaseInternal, hidl_status_cb, use_case); +} + +Return WifiChip::setCoexUnsafeChannels(const hidl_vec& unsafeChannels, + hidl_bitfield restrictions, + setCoexUnsafeChannels_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::setCoexUnsafeChannelsInternal, hidl_status_cb, unsafeChannels, + restrictions); +} + +Return WifiChip::setCountryCode(const hidl_array& code, + setCountryCode_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiChip::setCountryCodeInternal, in_code); + &WifiChip::setCountryCodeInternal, hidl_status_cb, code); } -ndk::ScopedAStatus WifiChip::getUsableChannels(WifiBand in_band, WifiIfaceMode in_ifaceModeMask, - UsableChannelFilter in_filterMask, - std::vector* _aidl_return) { +Return WifiChip::getUsableChannels( + WifiBand band, hidl_bitfield ifaceModeMask, + hidl_bitfield filterMask, + getUsableChannels_cb _hidl_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getUsableChannelsInternal, _aidl_return, in_band, - in_ifaceModeMask, in_filterMask); + &WifiChip::getUsableChannelsInternal, _hidl_cb, band, ifaceModeMask, + filterMask); } -ndk::ScopedAStatus WifiChip::triggerSubsystemRestart() { +Return WifiChip::triggerSubsystemRestart(triggerSubsystemRestart_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::triggerSubsystemRestartInternal); + &WifiChip::triggerSubsystemRestartInternal, hidl_status_cb); } -ndk::ScopedAStatus WifiChip::getSupportedRadioCombinationsMatrix( - WifiRadioCombinationMatrix* _aidl_return) { +Return WifiChip::createRttController_1_6(const sp& bound_iface, + createRttController_1_6_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getSupportedRadioCombinationsMatrixInternal, _aidl_return); + &WifiChip::createRttControllerInternal_1_6, hidl_status_cb, bound_iface); +} + +Return WifiChip::getUsableChannels_1_6( + WifiBand band, hidl_bitfield ifaceModeMask, + hidl_bitfield filterMask, + getUsableChannels_1_6_cb _hidl_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::getUsableChannelsInternal_1_6, _hidl_cb, band, ifaceModeMask, + filterMask); +} + +Return WifiChip::getSupportedRadioCombinationsMatrix( + getSupportedRadioCombinationsMatrix_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::getSupportedRadioCombinationsMatrixInternal, hidl_status_cb); +} + +Return WifiChip::getAvailableModes_1_6(getAvailableModes_1_6_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::getAvailableModesInternal_1_6, hidl_status_cb); } void WifiChip::invalidateAndRemoveAllIfaces() { @@ -700,7 +755,7 @@ void WifiChip::invalidateAndRemoveDependencies(const std::string& removed_iface_ if (nan_iface->getName() == removed_iface_name) { nan_iface->invalidate(); for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onIfaceRemoved(IfaceType::NAN_IFACE, removed_iface_name).isOk()) { + if (!callback->onIfaceRemoved(IfaceType::NAN, removed_iface_name).isOk()) { LOG(ERROR) << "Failed to invoke onIfaceRemoved callback"; } } @@ -721,61 +776,89 @@ void WifiChip::invalidateAndRemoveDependencies(const std::string& removed_iface_ } } -std::pair WifiChip::getIdInternal() { - return {chip_id_, ndk::ScopedAStatus::ok()}; +std::pair WifiChip::getIdInternal() { + return {createWifiStatus(WifiStatusCode::SUCCESS), chip_id_}; } -ndk::ScopedAStatus WifiChip::registerEventCallbackInternal( - const std::shared_ptr& event_callback) { - if (!event_cb_handler_.addCallback(event_callback)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - return ndk::ScopedAStatus::ok(); +WifiStatus WifiChip::registerEventCallbackInternal( + const sp& /* event_callback */) { + // Deprecated support for this callback. + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); } -std::pair WifiChip::getCapabilitiesInternal() { - legacy_hal::wifi_error legacy_status; - uint64_t legacy_feature_set; - uint32_t legacy_logger_feature_set; - const auto ifname = getFirstActiveWlanIfaceName(); - std::tie(legacy_status, legacy_feature_set) = - legacy_hal_.lock()->getSupportedFeatureSet(ifname); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {IWifiChip::ChipCapabilityMask{}, createWifiStatusFromLegacyError(legacy_status)}; - } - std::tie(legacy_status, legacy_logger_feature_set) = - legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - // some devices don't support querying logger feature set - legacy_logger_feature_set = 0; - } - uint32_t aidl_caps; - if (!aidl_struct_util::convertLegacyFeaturesToAidlChipCapabilities( - legacy_feature_set, legacy_logger_feature_set, &aidl_caps)) { - return {IWifiChip::ChipCapabilityMask{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; - } - return {static_cast(aidl_caps), ndk::ScopedAStatus::ok()}; +std::pair WifiChip::getCapabilitiesInternal() { + // Deprecated support for this callback. + return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), 0}; } -std::pair, ndk::ScopedAStatus> +std::pair> WifiChip::getAvailableModesInternal() { - return {modes_, ndk::ScopedAStatus::ok()}; + // Deprecated support -- use getAvailableModes_1_6 for more granular concurrency combinations. + std::vector modes_1_0 = {}; + for (const auto& mode_1_6 : modes_) { + std::vector combos_1_0; + for (const auto& combo_1_6 : mode_1_6.availableCombinations) { + std::vector limits_1_0; + for (const auto& limit_1_6 : combo_1_6.limits) { + std::vector types_1_0; + for (IfaceConcurrencyType type_1_6 : limit_1_6.types) { + switch (type_1_6) { + case IfaceConcurrencyType::STA: + types_1_0.push_back(IfaceType::STA); + break; + case IfaceConcurrencyType::AP: + types_1_0.push_back(IfaceType::AP); + break; + case IfaceConcurrencyType::AP_BRIDGED: + // Ignore AP_BRIDGED + break; + case IfaceConcurrencyType::P2P: + types_1_0.push_back(IfaceType::P2P); + break; + case IfaceConcurrencyType::NAN: + types_1_0.push_back(IfaceType::NAN); + break; + } + } + if (types_1_0.empty()) { + continue; + } + V1_0::IWifiChip::ChipIfaceCombinationLimit limit_1_0; + limit_1_0.types = hidl_vec(types_1_0); + limit_1_0.maxIfaces = limit_1_6.maxIfaces; + limits_1_0.push_back(limit_1_0); + } + if (limits_1_0.empty()) { + continue; + } + V1_0::IWifiChip::ChipIfaceCombination combo_1_0; + combo_1_0.limits = hidl_vec(limits_1_0); + combos_1_0.push_back(combo_1_0); + } + if (combos_1_0.empty()) { + continue; + } + V1_0::IWifiChip::ChipMode mode_1_0; + mode_1_0.id = mode_1_6.id; + mode_1_0.availableCombinations = hidl_vec(combos_1_0); + modes_1_0.push_back(mode_1_0); + } + return {createWifiStatus(WifiStatusCode::SUCCESS), modes_1_0}; } -ndk::ScopedAStatus WifiChip::configureChipInternal( - /* NONNULL */ std::unique_lock* lock, int32_t mode_id) { +WifiStatus WifiChip::configureChipInternal( + /* NONNULL */ std::unique_lock* lock, ChipModeId mode_id) { if (!isValidModeId(mode_id)) { return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); } if (mode_id == current_mode_id_) { LOG(DEBUG) << "Already in the specified mode " << mode_id; - return ndk::ScopedAStatus::ok(); + return createWifiStatus(WifiStatusCode::SUCCESS); } - ndk::ScopedAStatus status = handleChipConfiguration(lock, mode_id); - if (!status.isOk()) { - WifiStatusCode errorCode = static_cast(status.getServiceSpecificError()); + WifiStatus status = handleChipConfiguration(lock, mode_id); + if (status.code != WifiStatusCode::SUCCESS) { for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onChipReconfigureFailure(errorCode).isOk()) { + if (!callback->onChipReconfigureFailure(status).isOk()) { LOG(ERROR) << "Failed to invoke onChipReconfigureFailure callback"; } } @@ -795,24 +878,24 @@ ndk::ScopedAStatus WifiChip::configureChipInternal( return status; } -std::pair WifiChip::getModeInternal() { +std::pair WifiChip::getModeInternal() { if (!isValidModeId(current_mode_id_)) { - return {current_mode_id_, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; + return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), current_mode_id_}; } - return {current_mode_id_, ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), current_mode_id_}; } -std::pair WifiChip::requestChipDebugInfoInternal() { - IWifiChip::ChipDebugInfo result; +std::pair WifiChip::requestChipDebugInfoInternal() { + V1_4::IWifiChip::ChipDebugInfo result; legacy_hal::wifi_error legacy_status; std::string driver_desc; const auto ifname = getFirstActiveWlanIfaceName(); std::tie(legacy_status, driver_desc) = legacy_hal_.lock()->getDriverVersion(ifname); if (legacy_status != legacy_hal::WIFI_SUCCESS) { LOG(ERROR) << "Failed to get driver version: " << legacyErrorToString(legacy_status); - ndk::ScopedAStatus status = + WifiStatus status = createWifiStatusFromLegacyError(legacy_status, "failed to get driver version"); - return {std::move(result), std::move(status)}; + return {status, result}; } result.driverDescription = driver_desc.c_str(); @@ -820,60 +903,59 @@ std::pair WifiChip::requestChipDeb std::tie(legacy_status, firmware_desc) = legacy_hal_.lock()->getFirmwareVersion(ifname); if (legacy_status != legacy_hal::WIFI_SUCCESS) { LOG(ERROR) << "Failed to get firmware version: " << legacyErrorToString(legacy_status); - ndk::ScopedAStatus status = + WifiStatus status = createWifiStatusFromLegacyError(legacy_status, "failed to get firmware version"); - return {std::move(result), std::move(status)}; + return {status, result}; } result.firmwareDescription = firmware_desc.c_str(); - return {std::move(result), ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), result}; } -std::pair, ndk::ScopedAStatus> WifiChip::requestDriverDebugDumpInternal() { +std::pair> WifiChip::requestDriverDebugDumpInternal() { legacy_hal::wifi_error legacy_status; std::vector driver_dump; std::tie(legacy_status, driver_dump) = legacy_hal_.lock()->requestDriverMemoryDump(getFirstActiveWlanIfaceName()); if (legacy_status != legacy_hal::WIFI_SUCCESS) { LOG(ERROR) << "Failed to get driver debug dump: " << legacyErrorToString(legacy_status); - return {std::vector(), createWifiStatusFromLegacyError(legacy_status)}; + return {createWifiStatusFromLegacyError(legacy_status), std::vector()}; } - return {driver_dump, ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), driver_dump}; } -std::pair, ndk::ScopedAStatus> WifiChip::requestFirmwareDebugDumpInternal() { +std::pair> WifiChip::requestFirmwareDebugDumpInternal() { legacy_hal::wifi_error legacy_status; std::vector firmware_dump; std::tie(legacy_status, firmware_dump) = legacy_hal_.lock()->requestFirmwareMemoryDump(getFirstActiveWlanIfaceName()); if (legacy_status != legacy_hal::WIFI_SUCCESS) { LOG(ERROR) << "Failed to get firmware debug dump: " << legacyErrorToString(legacy_status); - return {std::vector(), createWifiStatusFromLegacyError(legacy_status)}; + return {createWifiStatusFromLegacyError(legacy_status), {}}; } - return {firmware_dump, ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), firmware_dump}; } -ndk::ScopedAStatus WifiChip::createVirtualApInterface(const std::string& apVirtIf) { +WifiStatus WifiChip::createVirtualApInterface(const std::string& apVirtIf) { legacy_hal::wifi_error legacy_status; legacy_status = legacy_hal_.lock()->createVirtualInterface( - apVirtIf, aidl_struct_util::convertAidlIfaceTypeToLegacy(IfaceType::AP)); + apVirtIf, hidl_struct_util::convertHidlIfaceTypeToLegacy(IfaceType::AP)); if (legacy_status != legacy_hal::WIFI_SUCCESS) { LOG(ERROR) << "Failed to add interface: " << apVirtIf << " " << legacyErrorToString(legacy_status); return createWifiStatusFromLegacyError(legacy_status); } - return ndk::ScopedAStatus::ok(); + return createWifiStatus(WifiStatusCode::SUCCESS); } -std::shared_ptr WifiChip::newWifiApIface(std::string& ifname) { +sp WifiChip::newWifiApIface(std::string& ifname) { std::vector ap_instances; for (auto const& it : br_ifaces_ap_instances_) { if (it.first == ifname) { ap_instances = it.second; } } - std::shared_ptr iface = - ndk::SharedRefBase::make(ifname, ap_instances, legacy_hal_, iface_util_); + sp iface = new WifiApIface(ifname, ap_instances, legacy_hal_, iface_util_); ap_ifaces_.push_back(iface); for (const auto& callback : event_cb_handler_.getCallbacks()) { if (!callback->onIfaceAdded(IfaceType::AP, ifname).isOk()) { @@ -884,77 +966,75 @@ std::shared_ptr WifiChip::newWifiApIface(std::string& ifname) { return iface; } -std::pair, ndk::ScopedAStatus> WifiChip::createApIfaceInternal() { +std::pair> WifiChip::createApIfaceInternal() { if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::AP)) { - return {std::shared_ptr(), - createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; + return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; } std::string ifname = allocateApIfaceName(); - ndk::ScopedAStatus status = createVirtualApInterface(ifname); - if (!status.isOk()) { - return {std::shared_ptr(), std::move(status)}; + WifiStatus status = createVirtualApInterface(ifname); + if (status.code != WifiStatusCode::SUCCESS) { + return {status, {}}; } - std::shared_ptr iface = newWifiApIface(ifname); - return {iface, ndk::ScopedAStatus::ok()}; + sp iface = newWifiApIface(ifname); + return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; } -std::pair, ndk::ScopedAStatus> -WifiChip::createBridgedApIfaceInternal() { +std::pair> WifiChip::createBridgedApIfaceInternal() { if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::AP_BRIDGED)) { - return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; + return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; } std::vector ap_instances = allocateBridgedApInstanceNames(); if (ap_instances.size() < 2) { LOG(ERROR) << "Fail to allocate two instances"; - return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; + return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; } std::string br_ifname = kApBridgeIfacePrefix + ap_instances[0]; for (int i = 0; i < 2; i++) { - ndk::ScopedAStatus status = createVirtualApInterface(ap_instances[i]); - if (!status.isOk()) { + WifiStatus status = createVirtualApInterface(ap_instances[i]); + if (status.code != WifiStatusCode::SUCCESS) { if (i != 0) { // The failure happened when creating second virtual // iface. legacy_hal_.lock()->deleteVirtualInterface( ap_instances.front()); // Remove the first virtual iface. } - return {nullptr, std::move(status)}; + return {status, {}}; } } br_ifaces_ap_instances_[br_ifname] = ap_instances; if (!iface_util_->createBridge(br_ifname)) { LOG(ERROR) << "Failed createBridge - br_name=" << br_ifname.c_str(); - invalidateAndClearBridgedAp(br_ifname); - return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; + deleteApIface(br_ifname); + return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; } for (auto const& instance : ap_instances) { // Bind ap instance interface to AP bridge if (!iface_util_->addIfaceToBridge(br_ifname, instance)) { LOG(ERROR) << "Failed add if to Bridge - if_name=" << instance.c_str(); - invalidateAndClearBridgedAp(br_ifname); - return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; + deleteApIface(br_ifname); + return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; } } - std::shared_ptr iface = newWifiApIface(br_ifname); - return {iface, ndk::ScopedAStatus::ok()}; + sp iface = newWifiApIface(br_ifname); + return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; } -std::pair, ndk::ScopedAStatus> WifiChip::getApIfaceNamesInternal() { +std::pair> WifiChip::getApIfaceNamesInternal() { if (ap_ifaces_.empty()) { - return {std::vector(), ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), {}}; } - return {getNames(ap_ifaces_), ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), getNames(ap_ifaces_)}; } -std::pair, ndk::ScopedAStatus> WifiChip::getApIfaceInternal( +std::pair> WifiChip::getApIfaceInternal( const std::string& ifname) { const auto iface = findUsingName(ap_ifaces_, ifname); if (!iface.get()) { - return {nullptr, createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)}; + return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr}; } - return {iface, ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; } -ndk::ScopedAStatus WifiChip::removeApIfaceInternal(const std::string& ifname) { +WifiStatus WifiChip::removeApIfaceInternal(const std::string& ifname) { const auto iface = findUsingName(ap_ifaces_, ifname); if (!iface.get()) { return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); @@ -964,8 +1044,7 @@ ndk::ScopedAStatus WifiChip::removeApIfaceInternal(const std::string& ifname) { // nan/rtt objects over AP iface. But, there is no harm to do it // here and not make that assumption all over the place. invalidateAndRemoveDependencies(ifname); - // Clear the bridge interface and the iface instance. - invalidateAndClearBridgedAp(ifname); + deleteApIface(ifname); invalidateAndClear(ap_ifaces_, iface); for (const auto& callback : event_cb_handler_.getCallbacks()) { if (!callback->onIfaceRemoved(IfaceType::AP, ifname).isOk()) { @@ -973,10 +1052,10 @@ ndk::ScopedAStatus WifiChip::removeApIfaceInternal(const std::string& ifname) { } } setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); - return ndk::ScopedAStatus::ok(); + return createWifiStatus(WifiStatusCode::SUCCESS); } -ndk::ScopedAStatus WifiChip::removeIfaceInstanceFromBridgedApIfaceInternal( +WifiStatus WifiChip::removeIfaceInstanceFromBridgedApIfaceInternal( const std::string& ifname, const std::string& ifInstanceName) { const auto iface = findUsingName(ap_ifaces_, ifname); if (!iface.get() || ifInstanceName.empty()) { @@ -1013,12 +1092,12 @@ ndk::ScopedAStatus WifiChip::removeIfaceInstanceFromBridgedApIfaceInternal( iface->removeInstance(ifInstanceName); setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); - return ndk::ScopedAStatus::ok(); + return createWifiStatus(WifiStatusCode::SUCCESS); } -std::pair, ndk::ScopedAStatus> WifiChip::createNanIfaceInternal() { - if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::NAN_IFACE)) { - return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; +std::pair> WifiChip::createNanIfaceInternal() { + if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::NAN)) { + return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; } bool is_dedicated_iface = true; std::string ifname = getPredefinedNanIfaceName(); @@ -1028,80 +1107,77 @@ std::pair, ndk::ScopedAStatus> WifiChip::createNa ifname = getFirstActiveWlanIfaceName(); is_dedicated_iface = false; } - std::shared_ptr iface = - WifiNanIface::create(ifname, is_dedicated_iface, legacy_hal_, iface_util_); + sp iface = new WifiNanIface(ifname, is_dedicated_iface, legacy_hal_, iface_util_); nan_ifaces_.push_back(iface); for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onIfaceAdded(IfaceType::NAN_IFACE, ifname).isOk()) { + if (!callback->onIfaceAdded(IfaceType::NAN, ifname).isOk()) { LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; } } - return {iface, ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; } -std::pair, ndk::ScopedAStatus> WifiChip::getNanIfaceNamesInternal() { +std::pair> WifiChip::getNanIfaceNamesInternal() { if (nan_ifaces_.empty()) { - return {std::vector(), ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), {}}; } - return {getNames(nan_ifaces_), ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), getNames(nan_ifaces_)}; } -std::pair, ndk::ScopedAStatus> WifiChip::getNanIfaceInternal( +std::pair> WifiChip::getNanIfaceInternal( const std::string& ifname) { const auto iface = findUsingName(nan_ifaces_, ifname); if (!iface.get()) { - return {nullptr, createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)}; + return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr}; } - return {iface, ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; } -ndk::ScopedAStatus WifiChip::removeNanIfaceInternal(const std::string& ifname) { +WifiStatus WifiChip::removeNanIfaceInternal(const std::string& ifname) { const auto iface = findUsingName(nan_ifaces_, ifname); if (!iface.get()) { return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); } invalidateAndClear(nan_ifaces_, iface); for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onIfaceRemoved(IfaceType::NAN_IFACE, ifname).isOk()) { + if (!callback->onIfaceRemoved(IfaceType::NAN, ifname).isOk()) { LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; } } - return ndk::ScopedAStatus::ok(); + return createWifiStatus(WifiStatusCode::SUCCESS); } -std::pair, ndk::ScopedAStatus> WifiChip::createP2pIfaceInternal() { +std::pair> WifiChip::createP2pIfaceInternal() { if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::P2P)) { - return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; + return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; } std::string ifname = getPredefinedP2pIfaceName(); - std::shared_ptr iface = - ndk::SharedRefBase::make(ifname, legacy_hal_); + sp iface = new WifiP2pIface(ifname, legacy_hal_); p2p_ifaces_.push_back(iface); for (const auto& callback : event_cb_handler_.getCallbacks()) { if (!callback->onIfaceAdded(IfaceType::P2P, ifname).isOk()) { LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; } } - return {iface, ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; } -std::pair, ndk::ScopedAStatus> WifiChip::getP2pIfaceNamesInternal() { +std::pair> WifiChip::getP2pIfaceNamesInternal() { if (p2p_ifaces_.empty()) { - return {std::vector(), ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), {}}; } - return {getNames(p2p_ifaces_), ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), getNames(p2p_ifaces_)}; } -std::pair, ndk::ScopedAStatus> WifiChip::getP2pIfaceInternal( - const std::string& ifname) { +std::pair> WifiChip::getP2pIfaceInternal(const std::string& ifname) { const auto iface = findUsingName(p2p_ifaces_, ifname); if (!iface.get()) { - return {nullptr, createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)}; + return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr}; } - return {iface, ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; } -ndk::ScopedAStatus WifiChip::removeP2pIfaceInternal(const std::string& ifname) { +WifiStatus WifiChip::removeP2pIfaceInternal(const std::string& ifname) { const auto iface = findUsingName(p2p_ifaces_, ifname); if (!iface.get()) { return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); @@ -1112,23 +1188,22 @@ ndk::ScopedAStatus WifiChip::removeP2pIfaceInternal(const std::string& ifname) { LOG(ERROR) << "Failed to invoke onIfaceRemoved callback"; } } - return ndk::ScopedAStatus::ok(); + return createWifiStatus(WifiStatusCode::SUCCESS); } -std::pair, ndk::ScopedAStatus> WifiChip::createStaIfaceInternal() { +std::pair> WifiChip::createStaIfaceInternal() { if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::STA)) { - return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; + return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; } std::string ifname = allocateStaIfaceName(); legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->createVirtualInterface( - ifname, aidl_struct_util::convertAidlIfaceTypeToLegacy(IfaceType::STA)); + ifname, hidl_struct_util::convertHidlIfaceTypeToLegacy(IfaceType::STA)); if (legacy_status != legacy_hal::WIFI_SUCCESS) { LOG(ERROR) << "Failed to add interface: " << ifname << " " << legacyErrorToString(legacy_status); - return {nullptr, createWifiStatusFromLegacyError(legacy_status)}; + return {createWifiStatusFromLegacyError(legacy_status), {}}; } - std::shared_ptr iface = - ndk::SharedRefBase::make(ifname, legacy_hal_, iface_util_); + sp iface = new WifiStaIface(ifname, legacy_hal_, iface_util_); sta_ifaces_.push_back(iface); for (const auto& callback : event_cb_handler_.getCallbacks()) { if (!callback->onIfaceAdded(IfaceType::STA, ifname).isOk()) { @@ -1136,26 +1211,26 @@ std::pair, ndk::ScopedAStatus> WifiChip::createSt } } setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); - return {iface, ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; } -std::pair, ndk::ScopedAStatus> WifiChip::getStaIfaceNamesInternal() { +std::pair> WifiChip::getStaIfaceNamesInternal() { if (sta_ifaces_.empty()) { - return {std::vector(), ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), {}}; } - return {getNames(sta_ifaces_), ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), getNames(sta_ifaces_)}; } -std::pair, ndk::ScopedAStatus> WifiChip::getStaIfaceInternal( +std::pair> WifiChip::getStaIfaceInternal( const std::string& ifname) { const auto iface = findUsingName(sta_ifaces_, ifname); if (!iface.get()) { - return {nullptr, createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)}; + return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr}; } - return {iface, ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; } -ndk::ScopedAStatus WifiChip::removeStaIfaceInternal(const std::string& ifname) { +WifiStatus WifiChip::removeStaIfaceInternal(const std::string& ifname) { const auto iface = findUsingName(sta_ifaces_, ifname); if (!iface.get()) { return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); @@ -1174,47 +1249,37 @@ ndk::ScopedAStatus WifiChip::removeStaIfaceInternal(const std::string& ifname) { } } setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); - return ndk::ScopedAStatus::ok(); + return createWifiStatus(WifiStatusCode::SUCCESS); } -std::pair, ndk::ScopedAStatus> -WifiChip::createRttControllerInternal(const std::shared_ptr& bound_iface) { - if (sta_ifaces_.size() == 0 && - !canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::STA)) { - LOG(ERROR) << "createRttControllerInternal: Chip cannot support STAs " - "(and RTT by extension)"; - return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; - } - std::shared_ptr rtt = - WifiRttController::create(getFirstActiveWlanIfaceName(), bound_iface, legacy_hal_); - rtt_controllers_.emplace_back(rtt); - return {rtt, ndk::ScopedAStatus::ok()}; +std::pair> WifiChip::createRttControllerInternal( + const sp& /*bound_iface*/) { + LOG(ERROR) << "createRttController is not supported on this HAL"; + return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; } -std::pair, ndk::ScopedAStatus> +std::pair> WifiChip::getDebugRingBuffersStatusInternal() { legacy_hal::wifi_error legacy_status; std::vector legacy_ring_buffer_status_vec; std::tie(legacy_status, legacy_ring_buffer_status_vec) = legacy_hal_.lock()->getRingBuffersStatus(getFirstActiveWlanIfaceName()); if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {std::vector(), - createWifiStatusFromLegacyError(legacy_status)}; + return {createWifiStatusFromLegacyError(legacy_status), {}}; } - std::vector aidl_ring_buffer_status_vec; - if (!aidl_struct_util::convertLegacyVectorOfDebugRingBufferStatusToAidl( - legacy_ring_buffer_status_vec, &aidl_ring_buffer_status_vec)) { - return {std::vector(), - createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + std::vector hidl_ring_buffer_status_vec; + if (!hidl_struct_util::convertLegacyVectorOfDebugRingBufferStatusToHidl( + legacy_ring_buffer_status_vec, &hidl_ring_buffer_status_vec)) { + return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; } - return {aidl_ring_buffer_status_vec, ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_ring_buffer_status_vec}; } -ndk::ScopedAStatus WifiChip::startLoggingToDebugRingBufferInternal( - const std::string& ring_name, WifiDebugRingBufferVerboseLevel verbose_level, +WifiStatus WifiChip::startLoggingToDebugRingBufferInternal( + const hidl_string& ring_name, WifiDebugRingBufferVerboseLevel verbose_level, uint32_t max_interval_in_sec, uint32_t min_data_size_in_bytes) { - ndk::ScopedAStatus status = registerDebugRingBufferCallback(); - if (!status.isOk()) { + WifiStatus status = registerDebugRingBufferCallback(); + if (status.code != WifiStatusCode::SUCCESS) { return status; } legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startRingBufferLogging( @@ -1225,16 +1290,16 @@ ndk::ScopedAStatus WifiChip::startLoggingToDebugRingBufferInternal( std::pair(ring_name, Ringbuffer(kMaxBufferSizeBytes))); // if verbose logging enabled, turn up HAL daemon logging as well. if (verbose_level < WifiDebugRingBufferVerboseLevel::VERBOSE) { - ::android::base::SetMinimumLogSeverity(::android::base::DEBUG); + android::base::SetMinimumLogSeverity(android::base::DEBUG); } else { - ::android::base::SetMinimumLogSeverity(::android::base::VERBOSE); + android::base::SetMinimumLogSeverity(android::base::VERBOSE); } return createWifiStatusFromLegacyError(legacy_status); } -ndk::ScopedAStatus WifiChip::forceDumpToDebugRingBufferInternal(const std::string& ring_name) { - ndk::ScopedAStatus status = registerDebugRingBufferCallback(); - if (!status.isOk()) { +WifiStatus WifiChip::forceDumpToDebugRingBufferInternal(const hidl_string& ring_name) { + WifiStatus status = registerDebugRingBufferCallback(); + if (status.code != WifiStatusCode::SUCCESS) { return status; } legacy_hal::wifi_error legacy_status = @@ -1243,15 +1308,15 @@ ndk::ScopedAStatus WifiChip::forceDumpToDebugRingBufferInternal(const std::strin return createWifiStatusFromLegacyError(legacy_status); } -ndk::ScopedAStatus WifiChip::flushRingBufferToFileInternal() { +WifiStatus WifiChip::flushRingBufferToFileInternal() { if (!writeRingbufferFilesInternal()) { LOG(ERROR) << "Error writing files to flash"; return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); } - return ndk::ScopedAStatus::ok(); + return createWifiStatus(WifiStatusCode::SUCCESS); } -ndk::ScopedAStatus WifiChip::stopLoggingToDebugRingBufferInternal() { +WifiStatus WifiChip::stopLoggingToDebugRingBufferInternal() { legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->deregisterRingBufferCallbackHandler(getFirstActiveWlanIfaceName()); if (legacy_status == legacy_hal::WIFI_SUCCESS) { @@ -1260,29 +1325,29 @@ ndk::ScopedAStatus WifiChip::stopLoggingToDebugRingBufferInternal() { return createWifiStatusFromLegacyError(legacy_status); } -std::pair +std::pair WifiChip::getDebugHostWakeReasonStatsInternal() { legacy_hal::wifi_error legacy_status; legacy_hal::WakeReasonStats legacy_stats; std::tie(legacy_status, legacy_stats) = legacy_hal_.lock()->getWakeReasonStats(getFirstActiveWlanIfaceName()); if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {WifiDebugHostWakeReasonStats{}, createWifiStatusFromLegacyError(legacy_status)}; + return {createWifiStatusFromLegacyError(legacy_status), {}}; } - WifiDebugHostWakeReasonStats aidl_stats; - if (!aidl_struct_util::convertLegacyWakeReasonStatsToAidl(legacy_stats, &aidl_stats)) { - return {WifiDebugHostWakeReasonStats{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + WifiDebugHostWakeReasonStats hidl_stats; + if (!hidl_struct_util::convertLegacyWakeReasonStatsToHidl(legacy_stats, &hidl_stats)) { + return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; } - return {aidl_stats, ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_stats}; } -ndk::ScopedAStatus WifiChip::enableDebugErrorAlertsInternal(bool enable) { +WifiStatus WifiChip::enableDebugErrorAlertsInternal(bool enable) { legacy_hal::wifi_error legacy_status; if (enable) { - std::weak_ptr weak_ptr_this = weak_ptr_this_; + android::wp weak_ptr_this(this); const auto& on_alert_callback = [weak_ptr_this](int32_t error_code, std::vector debug_data) { - const auto shared_ptr_this = weak_ptr_this.lock(); + const auto shared_ptr_this = weak_ptr_this.promote(); if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { LOG(ERROR) << "Callback invoked on an invalid object"; return; @@ -1302,51 +1367,106 @@ ndk::ScopedAStatus WifiChip::enableDebugErrorAlertsInternal(bool enable) { return createWifiStatusFromLegacyError(legacy_status); } -ndk::ScopedAStatus WifiChip::selectTxPowerScenarioInternal(IWifiChip::TxPowerScenario scenario) { +WifiStatus WifiChip::selectTxPowerScenarioInternal(V1_1::IWifiChip::TxPowerScenario scenario) { auto legacy_status = legacy_hal_.lock()->selectTxPowerScenario( getFirstActiveWlanIfaceName(), - aidl_struct_util::convertAidlTxPowerScenarioToLegacy(scenario)); + hidl_struct_util::convertHidlTxPowerScenarioToLegacy(scenario)); return createWifiStatusFromLegacyError(legacy_status); } -ndk::ScopedAStatus WifiChip::resetTxPowerScenarioInternal() { +WifiStatus WifiChip::resetTxPowerScenarioInternal() { auto legacy_status = legacy_hal_.lock()->resetTxPowerScenario(getFirstActiveWlanIfaceName()); return createWifiStatusFromLegacyError(legacy_status); } -ndk::ScopedAStatus WifiChip::setLatencyModeInternal(IWifiChip::LatencyMode mode) { +WifiStatus WifiChip::setLatencyModeInternal(LatencyMode mode) { auto legacy_status = legacy_hal_.lock()->setLatencyMode( - getFirstActiveWlanIfaceName(), aidl_struct_util::convertAidlLatencyModeToLegacy(mode)); + getFirstActiveWlanIfaceName(), hidl_struct_util::convertHidlLatencyModeToLegacy(mode)); return createWifiStatusFromLegacyError(legacy_status); } -ndk::ScopedAStatus WifiChip::setMultiStaPrimaryConnectionInternal(const std::string& ifname) { +WifiStatus WifiChip::registerEventCallbackInternal_1_2( + const sp& /* event_callback */) { + // Deprecated support for this callback. + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + +WifiStatus WifiChip::selectTxPowerScenarioInternal_1_2(TxPowerScenario scenario) { + auto legacy_status = legacy_hal_.lock()->selectTxPowerScenario( + getFirstActiveWlanIfaceName(), + hidl_struct_util::convertHidlTxPowerScenarioToLegacy_1_2(scenario)); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair WifiChip::getCapabilitiesInternal_1_3() { + // Deprecated support for this callback. + return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), 0}; +} + +std::pair WifiChip::getCapabilitiesInternal_1_5() { + legacy_hal::wifi_error legacy_status; + uint64_t legacy_feature_set; + uint32_t legacy_logger_feature_set; + const auto ifname = getFirstActiveWlanIfaceName(); + std::tie(legacy_status, legacy_feature_set) = + legacy_hal_.lock()->getSupportedFeatureSet(ifname); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {createWifiStatusFromLegacyError(legacy_status), 0}; + } + std::tie(legacy_status, legacy_logger_feature_set) = + legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + // some devices don't support querying logger feature set + legacy_logger_feature_set = 0; + } + uint32_t hidl_caps; + if (!hidl_struct_util::convertLegacyFeaturesToHidlChipCapabilities( + legacy_feature_set, legacy_logger_feature_set, &hidl_caps)) { + return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), 0}; + } + return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps}; +} + +std::pair> WifiChip::createRttControllerInternal_1_4( + const sp& /*bound_iface*/) { + LOG(ERROR) << "createRttController_1_4 is not supported on this HAL"; + return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; +} + +WifiStatus WifiChip::registerEventCallbackInternal_1_4( + const sp& event_callback) { + if (!event_cb_handler_.addCallback(event_callback)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + return createWifiStatus(WifiStatusCode::SUCCESS); +} + +WifiStatus WifiChip::setMultiStaPrimaryConnectionInternal(const std::string& ifname) { auto legacy_status = legacy_hal_.lock()->multiStaSetPrimaryConnection(ifname); return createWifiStatusFromLegacyError(legacy_status); } -ndk::ScopedAStatus WifiChip::setMultiStaUseCaseInternal(IWifiChip::MultiStaUseCase use_case) { +WifiStatus WifiChip::setMultiStaUseCaseInternal(MultiStaUseCase use_case) { auto legacy_status = legacy_hal_.lock()->multiStaSetUseCase( - aidl_struct_util::convertAidlMultiStaUseCaseToLegacy(use_case)); + hidl_struct_util::convertHidlMultiStaUseCaseToLegacy(use_case)); return createWifiStatusFromLegacyError(legacy_status); } -ndk::ScopedAStatus WifiChip::setCoexUnsafeChannelsInternal( - std::vector unsafe_channels, CoexRestriction restrictions) { +WifiStatus WifiChip::setCoexUnsafeChannelsInternal(std::vector unsafe_channels, + uint32_t restrictions) { std::vector legacy_unsafe_channels; - if (!aidl_struct_util::convertAidlVectorOfCoexUnsafeChannelToLegacy(unsafe_channels, + if (!hidl_struct_util::convertHidlVectorOfCoexUnsafeChannelToLegacy(unsafe_channels, &legacy_unsafe_channels)) { return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); } - uint32_t aidl_restrictions = static_cast(restrictions); uint32_t legacy_restrictions = 0; - if (aidl_restrictions & static_cast(CoexRestriction::WIFI_DIRECT)) { + if (restrictions & CoexRestriction::WIFI_DIRECT) { legacy_restrictions |= legacy_hal::wifi_coex_restriction::WIFI_DIRECT; } - if (aidl_restrictions & static_cast(CoexRestriction::SOFTAP)) { + if (restrictions & CoexRestriction::SOFTAP) { legacy_restrictions |= legacy_hal::wifi_coex_restriction::SOFTAP; } - if (aidl_restrictions & static_cast(CoexRestriction::WIFI_AWARE)) { + if (restrictions & CoexRestriction::WIFI_AWARE) { legacy_restrictions |= legacy_hal::wifi_coex_restriction::WIFI_AWARE; } auto legacy_status = @@ -1354,34 +1474,57 @@ ndk::ScopedAStatus WifiChip::setCoexUnsafeChannelsInternal( return createWifiStatusFromLegacyError(legacy_status); } -ndk::ScopedAStatus WifiChip::setCountryCodeInternal(const std::array& code) { +WifiStatus WifiChip::setCountryCodeInternal(const std::array& code) { auto legacy_status = legacy_hal_.lock()->setCountryCode(getFirstActiveWlanIfaceName(), code); return createWifiStatusFromLegacyError(legacy_status); } -std::pair, ndk::ScopedAStatus> WifiChip::getUsableChannelsInternal( - WifiBand band, WifiIfaceMode ifaceModeMask, UsableChannelFilter filterMask) { +std::pair> WifiChip::getUsableChannelsInternal( + WifiBand /*band*/, uint32_t /*ifaceModeMask*/, uint32_t /*filterMask*/) { + LOG(ERROR) << "getUsableChannels is not supported on this HAL"; + return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; +} + +WifiStatus WifiChip::triggerSubsystemRestartInternal() { + auto legacy_status = legacy_hal_.lock()->triggerSubsystemRestart(); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair> WifiChip::createRttControllerInternal_1_6( + const sp& bound_iface) { + if (sta_ifaces_.size() == 0 && + !canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::STA)) { + LOG(ERROR) << "createRttControllerInternal_1_6: Chip cannot support STAs " + "(and RTT by extension)"; + return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; + } + sp rtt = + new WifiRttController(getFirstActiveWlanIfaceName(), bound_iface, legacy_hal_); + rtt_controllers_.emplace_back(rtt); + return {createWifiStatus(WifiStatusCode::SUCCESS), rtt}; +} + +std::pair> WifiChip::getUsableChannelsInternal_1_6( + WifiBand band, uint32_t ifaceModeMask, uint32_t filterMask) { legacy_hal::wifi_error legacy_status; std::vector legacy_usable_channels; std::tie(legacy_status, legacy_usable_channels) = legacy_hal_.lock()->getUsableChannels( - aidl_struct_util::convertAidlWifiBandToLegacyMacBand(band), - aidl_struct_util::convertAidlWifiIfaceModeToLegacy( - static_cast(ifaceModeMask)), - aidl_struct_util::convertAidlUsableChannelFilterToLegacy( - static_cast(filterMask))); + hidl_struct_util::convertHidlWifiBandToLegacyMacBand(band), + hidl_struct_util::convertHidlWifiIfaceModeToLegacy(ifaceModeMask), + hidl_struct_util::convertHidlUsableChannelFilterToLegacy(filterMask)); if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {std::vector(), createWifiStatusFromLegacyError(legacy_status)}; + return {createWifiStatusFromLegacyError(legacy_status), {}}; } - std::vector aidl_usable_channels; - if (!aidl_struct_util::convertLegacyWifiUsableChannelsToAidl(legacy_usable_channels, - &aidl_usable_channels)) { - return {std::vector(), createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + std::vector hidl_usable_channels; + if (!hidl_struct_util::convertLegacyWifiUsableChannelsToHidl(legacy_usable_channels, + &hidl_usable_channels)) { + return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; } - return {aidl_usable_channels, ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_usable_channels}; } -std::pair +std::pair WifiChip::getSupportedRadioCombinationsMatrixInternal() { legacy_hal::wifi_error legacy_status; legacy_hal::wifi_radio_combination_matrix* legacy_matrix; @@ -1391,25 +1534,25 @@ WifiChip::getSupportedRadioCombinationsMatrixInternal() { if (legacy_status != legacy_hal::WIFI_SUCCESS) { LOG(ERROR) << "Failed to get SupportedRadioCombinations matrix from legacy HAL: " << legacyErrorToString(legacy_status); - return {WifiRadioCombinationMatrix{}, createWifiStatusFromLegacyError(legacy_status)}; + return {createWifiStatusFromLegacyError(legacy_status), {}}; } - WifiRadioCombinationMatrix aidl_matrix; - if (!aidl_struct_util::convertLegacyRadioCombinationsMatrixToAidl(legacy_matrix, - &aidl_matrix)) { - LOG(ERROR) << "Failed convertLegacyRadioCombinationsMatrixToAidl() "; - return {WifiRadioCombinationMatrix(), createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)}; + V1_6::WifiRadioCombinationMatrix hidl_matrix; + if (!hidl_struct_util::convertLegacyRadioCombinationsMatrixToHidl(legacy_matrix, + &hidl_matrix)) { + LOG(ERROR) << "Failed convertLegacyRadioCombinationsMatrixToHidl() "; + return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), {}}; } - return {aidl_matrix, ndk::ScopedAStatus::ok()}; + return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_matrix}; } -ndk::ScopedAStatus WifiChip::triggerSubsystemRestartInternal() { - auto legacy_status = legacy_hal_.lock()->triggerSubsystemRestart(); - return createWifiStatusFromLegacyError(legacy_status); +std::pair> +WifiChip::getAvailableModesInternal_1_6() { + return {createWifiStatus(WifiStatusCode::SUCCESS), modes_}; } -ndk::ScopedAStatus WifiChip::handleChipConfiguration( - /* NONNULL */ std::unique_lock* lock, int32_t mode_id) { +WifiStatus WifiChip::handleChipConfiguration( + /* NONNULL */ std::unique_lock* lock, ChipModeId mode_id) { // If the chip is already configured in a different mode, stop // the legacy HAL and then start it after firmware mode change. if (isValidModeId(current_mode_id_)) { @@ -1438,41 +1581,41 @@ ndk::ScopedAStatus WifiChip::handleChipConfiguration( } // Every time the HAL is restarted, we need to register the // radio mode change callback. - ndk::ScopedAStatus status = registerRadioModeChangeCallback(); - if (!status.isOk()) { - // This is probably not a critical failure? + WifiStatus status = registerRadioModeChangeCallback(); + if (status.code != WifiStatusCode::SUCCESS) { + // This probably is not a critical failure? LOG(ERROR) << "Failed to register radio mode change callback"; } // Extract and save the version information into property. - std::pair version_info; + std::pair version_info; version_info = WifiChip::requestChipDebugInfoInternal(); - if (version_info.second.isOk()) { + if (WifiStatusCode::SUCCESS == version_info.first.code) { property_set("vendor.wlan.firmware.version", - version_info.first.firmwareDescription.c_str()); - property_set("vendor.wlan.driver.version", version_info.first.driverDescription.c_str()); + version_info.second.firmwareDescription.c_str()); + property_set("vendor.wlan.driver.version", version_info.second.driverDescription.c_str()); } - return ndk::ScopedAStatus::ok(); + return createWifiStatus(WifiStatusCode::SUCCESS); } -ndk::ScopedAStatus WifiChip::registerDebugRingBufferCallback() { +WifiStatus WifiChip::registerDebugRingBufferCallback() { if (debug_ring_buffer_cb_registered_) { - return ndk::ScopedAStatus::ok(); + return createWifiStatus(WifiStatusCode::SUCCESS); } - std::weak_ptr weak_ptr_this = weak_ptr_this_; + android::wp weak_ptr_this(this); const auto& on_ring_buffer_data_callback = [weak_ptr_this](const std::string& name, const std::vector& data, const legacy_hal::wifi_ring_buffer_status& status) { - const auto shared_ptr_this = weak_ptr_this.lock(); + const auto shared_ptr_this = weak_ptr_this.promote(); if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { LOG(ERROR) << "Callback invoked on an invalid object"; return; } - WifiDebugRingBufferStatus aidl_status; + WifiDebugRingBufferStatus hidl_status; Ringbuffer::AppendStatus appendstatus; - if (!aidl_struct_util::convertLegacyDebugRingBufferStatusToAidl(status, - &aidl_status)) { + if (!hidl_struct_util::convertLegacyDebugRingBufferStatusToHidl(status, + &hidl_status)) { LOG(ERROR) << "Error converting ring buffer status"; return; } @@ -1493,6 +1636,7 @@ ndk::ScopedAStatus WifiChip::registerDebugRingBufferCallback() { shared_ptr_this->writeRingbufferFilesInternal(); return; } + }; legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->registerRingBufferCallbackHandler( getFirstActiveWlanIfaceName(), on_ring_buffer_data_callback); @@ -1503,24 +1647,25 @@ ndk::ScopedAStatus WifiChip::registerDebugRingBufferCallback() { return createWifiStatusFromLegacyError(legacy_status); } -ndk::ScopedAStatus WifiChip::registerRadioModeChangeCallback() { - std::weak_ptr weak_ptr_this = weak_ptr_this_; +WifiStatus WifiChip::registerRadioModeChangeCallback() { + android::wp weak_ptr_this(this); const auto& on_radio_mode_change_callback = [weak_ptr_this](const std::vector& mac_infos) { - const auto shared_ptr_this = weak_ptr_this.lock(); + const auto shared_ptr_this = weak_ptr_this.promote(); if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { LOG(ERROR) << "Callback invoked on an invalid object"; return; } - std::vector aidl_radio_mode_infos; - if (!aidl_struct_util::convertLegacyWifiMacInfosToAidl(mac_infos, - &aidl_radio_mode_infos)) { + std::vector hidl_radio_mode_infos; + if (!hidl_struct_util::convertLegacyWifiMacInfosToHidl(mac_infos, + &hidl_radio_mode_infos)) { LOG(ERROR) << "Error converting wifi mac info"; return; } for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onRadioModeChange(aidl_radio_mode_infos).isOk()) { - LOG(ERROR) << "Failed to invoke onRadioModeChange callback"; + if (!callback->onRadioModeChange_1_4(hidl_radio_mode_infos).isOk()) { + LOG(ERROR) << "Failed to invoke onRadioModeChange_1_4" + << " callback on: " << toString(callback); } } }; @@ -1530,11 +1675,11 @@ ndk::ScopedAStatus WifiChip::registerRadioModeChangeCallback() { return createWifiStatusFromLegacyError(legacy_status); } -std::vector +std::vector WifiChip::getCurrentModeConcurrencyCombinations() { if (!isValidModeId(current_mode_id_)) { LOG(ERROR) << "Chip not configured in a mode yet"; - return std::vector(); + return {}; } for (const auto& mode : modes_) { if (mode.id == current_mode_id_) { @@ -1542,7 +1687,7 @@ WifiChip::getCurrentModeConcurrencyCombinations() { } } CHECK(0) << "Expected to find concurrency combinations for current mode!"; - return std::vector(); + return {}; } // Returns a map indexed by IfaceConcurrencyType with the number of ifaces currently @@ -1562,7 +1707,7 @@ std::map WifiChip::getCurrentConcurrencyCombinatio } iface_counts[IfaceConcurrencyType::AP] = num_ap; iface_counts[IfaceConcurrencyType::AP_BRIDGED] = num_ap_bridged; - iface_counts[IfaceConcurrencyType::NAN_IFACE] = nan_ifaces_.size(); + iface_counts[IfaceConcurrencyType::NAN] = nan_ifaces_.size(); iface_counts[IfaceConcurrencyType::P2P] = p2p_ifaces_.size(); iface_counts[IfaceConcurrencyType::STA] = sta_ifaces_.size(); return iface_counts; @@ -1573,10 +1718,10 @@ std::map WifiChip::getCurrentConcurrencyCombinatio // of each concurrency type in the combination. // This method is a port of HalDeviceManager.expandConcurrencyCombos() from framework. std::vector> WifiChip::expandConcurrencyCombinations( - const IWifiChip::ChipConcurrencyCombination& combination) { - int32_t num_expanded_combos = 1; + const V1_6::IWifiChip::ChipConcurrencyCombination& combination) { + uint32_t num_expanded_combos = 1; for (const auto& limit : combination.limits) { - for (int32_t i = 0; i < limit.maxIfaces; i++) { + for (uint32_t i = 0; i < limit.maxIfaces; i++) { num_expanded_combos *= limit.types.size(); } } @@ -1586,17 +1731,17 @@ std::vector> WifiChip::expandConcurrencyC std::vector> expanded_combos; expanded_combos.resize(num_expanded_combos); for (auto& expanded_combo : expanded_combos) { - for (const auto type : {IfaceConcurrencyType::AP, IfaceConcurrencyType::AP_BRIDGED, - IfaceConcurrencyType::NAN_IFACE, IfaceConcurrencyType::P2P, - IfaceConcurrencyType::STA}) { + for (const auto type : + {IfaceConcurrencyType::AP, IfaceConcurrencyType::AP_BRIDGED, IfaceConcurrencyType::NAN, + IfaceConcurrencyType::P2P, IfaceConcurrencyType::STA}) { expanded_combo[type] = 0; } } - int32_t span = num_expanded_combos; + uint32_t span = num_expanded_combos; for (const auto& limit : combination.limits) { - for (int32_t i = 0; i < limit.maxIfaces; i++) { + for (uint32_t i = 0; i < limit.maxIfaces; i++) { span /= limit.types.size(); - for (int32_t k = 0; k < num_expanded_combos; ++k) { + for (uint32_t k = 0; k < num_expanded_combos; ++k) { const auto iface_type = limit.types[(k / span) % limit.types.size()]; expanded_combos[k][iface_type]++; } @@ -1612,8 +1757,8 @@ bool WifiChip::canExpandedConcurrencyComboSupportConcurrencyTypeWithCurrentTypes // Check if we have space for 1 more iface of |type| in this combo for (const auto type : - {IfaceConcurrencyType::AP, IfaceConcurrencyType::AP_BRIDGED, - IfaceConcurrencyType::NAN_IFACE, IfaceConcurrencyType::P2P, IfaceConcurrencyType::STA}) { + {IfaceConcurrencyType::AP, IfaceConcurrencyType::AP_BRIDGED, IfaceConcurrencyType::NAN, + IfaceConcurrencyType::P2P, IfaceConcurrencyType::STA}) { size_t num_ifaces_needed = current_combo.at(type); if (type == requested_type) { num_ifaces_needed++; @@ -1657,8 +1802,8 @@ bool WifiChip::canExpandedConcurrencyComboSupportConcurrencyCombo( const std::map& req_combo) { // Check if we have space for 1 more |type| in this combo for (const auto type : - {IfaceConcurrencyType::AP, IfaceConcurrencyType::AP_BRIDGED, - IfaceConcurrencyType::NAN_IFACE, IfaceConcurrencyType::P2P, IfaceConcurrencyType::STA}) { + {IfaceConcurrencyType::AP, IfaceConcurrencyType::AP_BRIDGED, IfaceConcurrencyType::NAN, + IfaceConcurrencyType::P2P, IfaceConcurrencyType::STA}) { if (req_combo.count(type) == 0) { // Concurrency type not in the req_combo. continue; @@ -1671,7 +1816,6 @@ bool WifiChip::canExpandedConcurrencyComboSupportConcurrencyCombo( } return true; } - // This method does the following: // a) Enumerate all possible concurrency combos by expanding the current // ChipConcurrencyCombination. @@ -1707,7 +1851,7 @@ bool WifiChip::canCurrentModeSupportConcurrencyType(IfaceConcurrencyType request return canCurrentModeSupportConcurrencyCombo(req_iface_combo); } -bool WifiChip::isValidModeId(int32_t mode_id) { +bool WifiChip::isValidModeId(ChipModeId mode_id) { for (const auto& mode : modes_) { if (mode.id == mode_id) { return true; @@ -1873,21 +2017,28 @@ void WifiChip::invalidateAndClearBridgedApAll() { br_ifaces_ap_instances_.clear(); } -void WifiChip::invalidateAndClearBridgedAp(const std::string& br_name) { - if (br_name.empty()) return; - // delete managed interfaces +void WifiChip::deleteApIface(const std::string& if_name) { + if (if_name.empty()) return; + // delete bridged interfaces if have for (auto const& it : br_ifaces_ap_instances_) { - if (it.first == br_name) { + if (it.first == if_name) { for (auto const& iface : it.second) { - iface_util_->removeIfaceFromBridge(br_name, iface); + iface_util_->removeIfaceFromBridge(if_name, iface); legacy_hal_.lock()->deleteVirtualInterface(iface); } - iface_util_->deleteBridge(br_name); - br_ifaces_ap_instances_.erase(br_name); - break; + iface_util_->deleteBridge(if_name); + br_ifaces_ap_instances_.erase(if_name); + // ifname is bridged AP, return here. + return; } } - return; + + // No bridged AP case, delete AP iface + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->deleteVirtualInterface(if_name); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to remove interface: " << if_name << " " + << legacyErrorToString(legacy_status); + } } bool WifiChip::findUsingNameFromBridgedApInstances(const std::string& name) { @@ -1904,7 +2055,8 @@ bool WifiChip::findUsingNameFromBridgedApInstances(const std::string& name) { return false; } +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl diff --git a/wifi/1.6/default/wifi_chip.h b/wifi/1.6/default/wifi_chip.h new file mode 100644 index 0000000000..e8ddaa6f9e --- /dev/null +++ b/wifi/1.6/default/wifi_chip.h @@ -0,0 +1,317 @@ +/* + * Copyright (C) 2016 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. + */ + +#ifndef WIFI_CHIP_H_ +#define WIFI_CHIP_H_ + +// HACK: NAN is a macro defined in math.h, which can be included in various +// headers. This wifi HAL uses an enum called NAN, which does not compile when +// the macro is defined. Undefine NAN to work around it. +#undef NAN + +#include +#include +#include + +#include +#include +#include +#include + +#include "hidl_callback_util.h" +#include "ringbuffer.h" +#include "wifi_ap_iface.h" +#include "wifi_feature_flags.h" +#include "wifi_legacy_hal.h" +#include "wifi_mode_controller.h" +#include "wifi_nan_iface.h" +#include "wifi_p2p_iface.h" +#include "wifi_rtt_controller.h" +#include "wifi_sta_iface.h" + +namespace android { +namespace hardware { +namespace wifi { +namespace V1_6 { +namespace implementation { +using namespace android::hardware::wifi::V1_0; +using V1_5::WifiBand; + +/** + * HIDL interface object used to control a Wifi HAL chip instance. + * Since there is only a single chip instance used today, there is no + * identifying handle information stored here. + */ +class WifiChip : public V1_6::IWifiChip { + public: + WifiChip(ChipId chip_id, bool is_primary, + const std::weak_ptr legacy_hal, + const std::weak_ptr mode_controller, + const std::shared_ptr iface_util, + const std::weak_ptr feature_flags, + const std::function& subsystemCallbackHandler); + // HIDL does not provide a built-in mechanism to let the server invalidate + // a HIDL interface object after creation. If any client process holds onto + // a reference to the object in their context, any method calls on that + // reference will continue to be directed to the server. + // + // However Wifi HAL needs to control the lifetime of these objects. So, add + // a public |invalidate| method to |WifiChip| and it's child objects. This + // will be used to mark an object invalid when either: + // a) Wifi HAL is stopped, or + // b) Wifi Chip is reconfigured. + // + // All HIDL method implementations should check if the object is still + // marked valid before processing them. + void invalidate(); + bool isValid(); + std::set> getEventCallbacks(); + + // HIDL methods exposed. + Return getId(getId_cb hidl_status_cb) override; + // Deprecated support for this callback + Return registerEventCallback(const sp& event_callback, + registerEventCallback_cb hidl_status_cb) override; + Return getCapabilities(getCapabilities_cb hidl_status_cb) override; + Return getAvailableModes(getAvailableModes_cb hidl_status_cb) override; + Return configureChip(ChipModeId mode_id, configureChip_cb hidl_status_cb) override; + Return getMode(getMode_cb hidl_status_cb) override; + Return requestChipDebugInfo(requestChipDebugInfo_cb hidl_status_cb) override; + Return requestDriverDebugDump(requestDriverDebugDump_cb hidl_status_cb) override; + Return requestFirmwareDebugDump(requestFirmwareDebugDump_cb hidl_status_cb) override; + Return createApIface(createApIface_cb hidl_status_cb) override; + Return createBridgedApIface(createBridgedApIface_cb hidl_status_cb) override; + Return getApIfaceNames(getApIfaceNames_cb hidl_status_cb) override; + Return getApIface(const hidl_string& ifname, getApIface_cb hidl_status_cb) override; + Return removeApIface(const hidl_string& ifname, removeApIface_cb hidl_status_cb) override; + Return removeIfaceInstanceFromBridgedApIface( + const hidl_string& brIfaceName, const hidl_string& ifaceInstanceName, + removeIfaceInstanceFromBridgedApIface_cb hidl_status_cb) override; + Return createNanIface(createNanIface_cb hidl_status_cb) override; + Return getNanIfaceNames(getNanIfaceNames_cb hidl_status_cb) override; + Return getNanIface(const hidl_string& ifname, getNanIface_cb hidl_status_cb) override; + Return removeNanIface(const hidl_string& ifname, + removeNanIface_cb hidl_status_cb) override; + Return createP2pIface(createP2pIface_cb hidl_status_cb) override; + Return getP2pIfaceNames(getP2pIfaceNames_cb hidl_status_cb) override; + Return getP2pIface(const hidl_string& ifname, getP2pIface_cb hidl_status_cb) override; + Return removeP2pIface(const hidl_string& ifname, + removeP2pIface_cb hidl_status_cb) override; + Return createStaIface(createStaIface_cb hidl_status_cb) override; + Return getStaIfaceNames(getStaIfaceNames_cb hidl_status_cb) override; + Return getStaIface(const hidl_string& ifname, getStaIface_cb hidl_status_cb) override; + Return removeStaIface(const hidl_string& ifname, + removeStaIface_cb hidl_status_cb) override; + Return createRttController(const sp& bound_iface, + createRttController_cb hidl_status_cb) override; + Return getDebugRingBuffersStatus(getDebugRingBuffersStatus_cb hidl_status_cb) override; + Return startLoggingToDebugRingBuffer( + const hidl_string& ring_name, WifiDebugRingBufferVerboseLevel verbose_level, + uint32_t max_interval_in_sec, uint32_t min_data_size_in_bytes, + startLoggingToDebugRingBuffer_cb hidl_status_cb) override; + Return forceDumpToDebugRingBuffer(const hidl_string& ring_name, + forceDumpToDebugRingBuffer_cb hidl_status_cb) override; + Return flushRingBufferToFile(flushRingBufferToFile_cb hidl_status_cb) override; + Return stopLoggingToDebugRingBuffer( + stopLoggingToDebugRingBuffer_cb hidl_status_cb) override; + Return getDebugHostWakeReasonStats( + getDebugHostWakeReasonStats_cb hidl_status_cb) override; + Return enableDebugErrorAlerts(bool enable, + enableDebugErrorAlerts_cb hidl_status_cb) override; + Return selectTxPowerScenario(V1_1::IWifiChip::TxPowerScenario scenario, + selectTxPowerScenario_cb hidl_status_cb) override; + Return resetTxPowerScenario(resetTxPowerScenario_cb hidl_status_cb) override; + Return setLatencyMode(LatencyMode mode, setLatencyMode_cb hidl_status_cb) override; + Return registerEventCallback_1_2(const sp& event_callback, + registerEventCallback_1_2_cb hidl_status_cb) override; + Return selectTxPowerScenario_1_2(TxPowerScenario scenario, + selectTxPowerScenario_cb hidl_status_cb) override; + Return getCapabilities_1_3(getCapabilities_cb hidl_status_cb) override; + Return getCapabilities_1_5(getCapabilities_1_5_cb hidl_status_cb) override; + Return debug(const hidl_handle& handle, const hidl_vec& options) override; + Return createRttController_1_4(const sp& bound_iface, + createRttController_1_4_cb hidl_status_cb) override; + Return registerEventCallback_1_4(const sp& event_callback, + registerEventCallback_1_4_cb hidl_status_cb) override; + Return setMultiStaPrimaryConnection( + const hidl_string& ifname, setMultiStaPrimaryConnection_cb hidl_status_cb) override; + Return setMultiStaUseCase(MultiStaUseCase use_case, + setMultiStaUseCase_cb hidl_status_cb) override; + Return setCoexUnsafeChannels(const hidl_vec& unsafe_channels, + hidl_bitfield restrictions, + setCoexUnsafeChannels_cb hidl_status_cb) override; + Return setCountryCode(const hidl_array& code, + setCountryCode_cb _hidl_cb) override; + Return getUsableChannels(WifiBand band, hidl_bitfield ifaceModeMask, + hidl_bitfield filterMask, + getUsableChannels_cb _hidl_cb) override; + Return triggerSubsystemRestart(triggerSubsystemRestart_cb hidl_status_cb) override; + Return createRttController_1_6(const sp& bound_iface, + createRttController_1_6_cb hidl_status_cb) override; + Return getUsableChannels_1_6(WifiBand band, + hidl_bitfield ifaceModeMask, + hidl_bitfield filterMask, + getUsableChannels_1_6_cb _hidl_cb) override; + Return getSupportedRadioCombinationsMatrix( + getSupportedRadioCombinationsMatrix_cb hidl_status_cb) override; + Return getAvailableModes_1_6(getAvailableModes_1_6_cb hidl_status_cb) override; + + private: + void invalidateAndRemoveAllIfaces(); + // When a STA iface is removed any dependent NAN-ifaces/RTT-controllers are + // invalidated & removed. + void invalidateAndRemoveDependencies(const std::string& removed_iface_name); + + // Corresponding worker functions for the HIDL methods. + std::pair getIdInternal(); + // Deprecated support for this callback + WifiStatus registerEventCallbackInternal( + const sp& event_callback); + std::pair getCapabilitiesInternal(); + std::pair> getAvailableModesInternal(); + WifiStatus configureChipInternal(std::unique_lock* lock, + ChipModeId mode_id); + std::pair getModeInternal(); + std::pair requestChipDebugInfoInternal(); + std::pair> requestDriverDebugDumpInternal(); + std::pair> requestFirmwareDebugDumpInternal(); + sp newWifiApIface(std::string& ifname); + WifiStatus createVirtualApInterface(const std::string& apVirtIf); + std::pair> createApIfaceInternal(); + std::pair> createBridgedApIfaceInternal(); + std::pair> getApIfaceNamesInternal(); + std::pair> getApIfaceInternal(const std::string& ifname); + WifiStatus removeApIfaceInternal(const std::string& ifname); + WifiStatus removeIfaceInstanceFromBridgedApIfaceInternal(const std::string& brIfaceName, + const std::string& ifInstanceName); + std::pair> createNanIfaceInternal(); + std::pair> getNanIfaceNamesInternal(); + std::pair> getNanIfaceInternal(const std::string& ifname); + WifiStatus removeNanIfaceInternal(const std::string& ifname); + std::pair> createP2pIfaceInternal(); + std::pair> getP2pIfaceNamesInternal(); + std::pair> getP2pIfaceInternal(const std::string& ifname); + WifiStatus removeP2pIfaceInternal(const std::string& ifname); + std::pair> createStaIfaceInternal(); + std::pair> getStaIfaceNamesInternal(); + std::pair> getStaIfaceInternal(const std::string& ifname); + WifiStatus removeStaIfaceInternal(const std::string& ifname); + std::pair> createRttControllerInternal( + const sp& bound_iface); + std::pair> + getDebugRingBuffersStatusInternal(); + WifiStatus startLoggingToDebugRingBufferInternal(const hidl_string& ring_name, + WifiDebugRingBufferVerboseLevel verbose_level, + uint32_t max_interval_in_sec, + uint32_t min_data_size_in_bytes); + WifiStatus forceDumpToDebugRingBufferInternal(const hidl_string& ring_name); + WifiStatus flushRingBufferToFileInternal(); + WifiStatus stopLoggingToDebugRingBufferInternal(); + std::pair getDebugHostWakeReasonStatsInternal(); + WifiStatus enableDebugErrorAlertsInternal(bool enable); + WifiStatus selectTxPowerScenarioInternal(V1_1::IWifiChip::TxPowerScenario scenario); + WifiStatus resetTxPowerScenarioInternal(); + WifiStatus setLatencyModeInternal(LatencyMode mode); + WifiStatus registerEventCallbackInternal_1_2( + const sp& event_callback); + WifiStatus selectTxPowerScenarioInternal_1_2(TxPowerScenario scenario); + std::pair getCapabilitiesInternal_1_3(); + std::pair getCapabilitiesInternal_1_5(); + std::pair> createRttControllerInternal_1_4( + const sp& bound_iface); + WifiStatus registerEventCallbackInternal_1_4( + const sp& event_callback); + WifiStatus setMultiStaPrimaryConnectionInternal(const std::string& ifname); + WifiStatus setMultiStaUseCaseInternal(MultiStaUseCase use_case); + WifiStatus setCoexUnsafeChannelsInternal(std::vector unsafe_channels, + uint32_t restrictions); + WifiStatus setCountryCodeInternal(const std::array& code); + std::pair> getUsableChannelsInternal( + WifiBand band, uint32_t ifaceModeMask, uint32_t filterMask); + WifiStatus handleChipConfiguration(std::unique_lock* lock, + ChipModeId mode_id); + WifiStatus registerDebugRingBufferCallback(); + WifiStatus registerRadioModeChangeCallback(); + std::vector + getCurrentModeConcurrencyCombinations(); + std::map getCurrentConcurrencyCombination(); + std::vector> expandConcurrencyCombinations( + const V1_6::IWifiChip::ChipConcurrencyCombination& combination); + bool canExpandedConcurrencyComboSupportConcurrencyTypeWithCurrentTypes( + const std::map& expanded_combo, + IfaceConcurrencyType requested_type); + bool canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType requested_type); + bool canExpandedConcurrencyComboSupportConcurrencyCombo( + const std::map& expanded_combo, + const std::map& req_combo); + bool canCurrentModeSupportConcurrencyCombo( + const std::map& req_combo); + bool canCurrentModeSupportConcurrencyType(IfaceConcurrencyType requested_type); + bool isValidModeId(ChipModeId mode_id); + bool isStaApConcurrencyAllowedInCurrentMode(); + bool isDualStaConcurrencyAllowedInCurrentMode(); + uint32_t startIdxOfApIface(); + std::string getFirstActiveWlanIfaceName(); + std::string allocateApOrStaIfaceName(IfaceType type, uint32_t start_idx); + std::string allocateApIfaceName(); + std::vector allocateBridgedApInstanceNames(); + std::string allocateStaIfaceName(); + bool writeRingbufferFilesInternal(); + std::string getWlanIfaceNameWithType(IfaceType type, unsigned idx); + void invalidateAndClearBridgedApAll(); + void deleteApIface(const std::string& if_name); + bool findUsingNameFromBridgedApInstances(const std::string& name); + WifiStatus triggerSubsystemRestartInternal(); + std::pair> createRttControllerInternal_1_6( + const sp& bound_iface); + std::pair> getUsableChannelsInternal_1_6( + WifiBand band, uint32_t ifaceModeMask, uint32_t filterMask); + std::pair getSupportedRadioCombinationsMatrixInternal(); + std::pair> getAvailableModesInternal_1_6(); + + ChipId chip_id_; + std::weak_ptr legacy_hal_; + std::weak_ptr mode_controller_; + std::shared_ptr iface_util_; + std::vector> ap_ifaces_; + std::vector> nan_ifaces_; + std::vector> p2p_ifaces_; + std::vector> sta_ifaces_; + std::vector> rtt_controllers_; + std::map ringbuffer_map_; + bool is_valid_; + // Members pertaining to chip configuration. + uint32_t current_mode_id_; + std::mutex lock_t; + std::vector modes_; + // The legacy ring buffer callback API has only a global callback + // registration mechanism. Use this to check if we have already + // registered a callback. + bool debug_ring_buffer_cb_registered_; + hidl_callback_util::HidlCallbackHandler event_cb_handler_; + + const std::function subsystemCallbackHandler_; + std::map> br_ifaces_ap_instances_; + DISALLOW_COPY_AND_ASSIGN(WifiChip); +}; + +} // namespace implementation +} // namespace V1_6 +} // namespace wifi +} // namespace hardware +} // namespace android + +#endif // WIFI_CHIP_H_ diff --git a/wifi/aidl/default/wifi_feature_flags.cpp b/wifi/1.6/default/wifi_feature_flags.cpp similarity index 59% rename from wifi/aidl/default/wifi_feature_flags.cpp rename to wifi/1.6/default/wifi_feature_flags.cpp index 3c9f042607..e80a3cdcb6 100644 --- a/wifi/aidl/default/wifi_feature_flags.cpp +++ b/wifi/1.6/default/wifi_feature_flags.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2016 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. @@ -21,12 +21,17 @@ #include "wifi_feature_flags.h" -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { namespace feature_flags { +using V1_0::ChipModeId; +using V1_0::IWifiChip; +using V1_6::IfaceConcurrencyType; + /* The chip may either have a single mode supporting any number of combinations, * or a fixed dual-mode (so it involves firmware loading to switch between * modes) setting. If there is a need to support more modes, it needs to be @@ -36,7 +41,7 @@ namespace feature_flags { * Supported combinations are defined in device's makefile, for example: * WIFI_HAL_INTERFACE_COMBINATIONS := {{{STA, AP}, 1}, {{P2P, NAN}, 1}}, * WIFI_HAL_INTERFACE_COMBINATIONS += {{{STA}, 1}, {{AP}, 2}} - * What this means: + * What means: * Interface concurrency combination 1: 1 STA or AP and 1 P2P or NAN concurrent iface * operations. * Interface concurrency combination 2: 1 STA and 2 AP concurrent iface operations. @@ -66,10 +71,10 @@ namespace feature_flags { */ // clang-format off #ifdef WIFI_HAL_INTERFACE_COMBINATIONS -constexpr int kMainModeId = chip_mode_ids::kV3; +constexpr ChipModeId kMainModeId = chip_mode_ids::kV3; #elif defined(WIFI_HIDL_FEATURE_DUAL_INTERFACE) // former V2 (fixed dual interface) setup expressed as V3 -constexpr int kMainModeId = chip_mode_ids::kV3; +constexpr ChipModeId kMainModeId = chip_mode_ids::kV3; # ifdef WIFI_HIDL_FEATURE_DISABLE_AP # ifdef WIFI_HIDL_FEATURE_AWARE // 1 STA + 1 of (P2P or NAN) @@ -91,7 +96,7 @@ constexpr int kMainModeId = chip_mode_ids::kV3; # endif #else // V1 (fixed single interface, dual-mode chip) -constexpr int kMainModeId = chip_mode_ids::kV1Sta; +constexpr ChipModeId kMainModeId = chip_mode_ids::kV1Sta; # ifdef WIFI_HIDL_FEATURE_AWARE // 1 STA + 1 of (P2P or NAN) # define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{P2P, NAN}, 1}} @@ -106,35 +111,44 @@ constexpr int kMainModeId = chip_mode_ids::kV1Sta; #endif // clang-format on -// Convert from the legacy format (used by the WIFI_HAL_INTERFACE_COMBINATIONS -// config variable) to a list of ChipConcurrencyCombination objects. -std::vector legacyToChipConcurrencyComboList( - std::vector> legacyLimits) { - std::vector combos; - for (auto& legacyLimit : legacyLimits) { - IWifiChip::ChipConcurrencyCombination combo = {legacyLimit}; - combos.push_back(combo); +/** + * Helper class to convert a collection of combination limits to a combination. + * + * The main point here is to simplify the syntax required by + * WIFI_HAL_INTERFACE_COMBINATIONS. + */ +struct ChipConcurrencyCombination + : public hidl_vec { + ChipConcurrencyCombination( + const std::initializer_list list) + : hidl_vec(list) {} + + operator V1_6::IWifiChip::ChipConcurrencyCombination() const { return {*this}; } + + static hidl_vec make_vec( + const std::initializer_list list) { + return hidl_vec( // + std::begin(list), std::end(list)); } - return combos; -} +}; #define STA IfaceConcurrencyType::STA #define AP IfaceConcurrencyType::AP #define AP_BRIDGED IfaceConcurrencyType::AP_BRIDGED #define P2P IfaceConcurrencyType::P2P -#define NAN IfaceConcurrencyType::NAN_IFACE -static const std::vector kChipModesPrimary{ - {kMainModeId, legacyToChipConcurrencyComboList({WIFI_HAL_INTERFACE_COMBINATIONS})}, +#define NAN IfaceConcurrencyType::NAN +static const std::vector kChipModesPrimary{ + {kMainModeId, ChipConcurrencyCombination::make_vec({WIFI_HAL_INTERFACE_COMBINATIONS})}, #ifdef WIFI_HAL_INTERFACE_COMBINATIONS_AP {chip_mode_ids::kV1Ap, - legacyToChipConcurrencyComboList({WIFI_HAL_INTERFACE_COMBINATIONS_AP})}, + ChipConcurrencyCombination::make_vec({WIFI_HAL_INTERFACE_COMBINATIONS_AP})}, #endif }; -static const std::vector kChipModesSecondary{ +static const std::vector kChipModesSecondary{ #ifdef WIFI_HAL_INTERFACE_COMBINATIONS_SECONDARY_CHIP {chip_mode_ids::kV3, - legacyToChipConcurrencyComboList({WIFI_HAL_INTERFACE_COMBINATIONS_SECONDARY_CHIP})}, + ChipConcurrencyCombination::make_vec({WIFI_HAL_INTERFACE_COMBINATIONS_SECONDARY_CHIP})}, #endif }; @@ -143,46 +157,50 @@ constexpr char kDebugPresetInterfaceCombinationIdxProperty[] = // List of pre-defined concurrency combinations that can be enabled at runtime via // setting the property: "kDebugPresetInterfaceCombinationIdxProperty" to the // corresponding index value. -static const std::vector>> kDebugChipModes{ - // Legacy combination - No STA/AP concurrencies. - // 0 - (1 AP) or (1 STA + 1 of (P2P or NAN)) - {"No STA/AP Concurrency", - {{kMainModeId, - legacyToChipConcurrencyComboList({{{{AP}, 1}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}}, +static const std::vector>> + kDebugChipModes{// Legacy combination - No STA/AP concurrencies. + // 0 - (1 AP) or (1 STA + 1 of (P2P or NAN)) + {"No STA/AP Concurrency", + {{kMainModeId, ChipConcurrencyCombination::make_vec( + {{{{AP}, 1}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}}, - // STA + AP concurrency - // 1 - (1 STA + 1 AP) or (1 STA + 1 of (P2P or NAN)) - {"STA + AP Concurrency", - {{kMainModeId, legacyToChipConcurrencyComboList( - {{{{STA}, 1}, {{AP}, 1}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}}, + // STA + AP concurrency + // 1 - (1 STA + 1 AP) or (1 STA + 1 of (P2P or NAN)) + {"STA + AP Concurrency", + {{kMainModeId, + ChipConcurrencyCombination::make_vec( + {{{{STA}, 1}, {{AP}, 1}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}}, - // STA + STA concurrency - // 2 - (1 STA + 1 AP) or (2 STA + 1 of (P2P or NAN)) - {"Dual STA Concurrency", - {{kMainModeId, legacyToChipConcurrencyComboList( - {{{{STA}, 1}, {{AP}, 1}}, {{{STA}, 2}, {{P2P, NAN}, 1}}})}}}, + // STA + STA concurrency + // 2 - (1 STA + 1 AP) or (2 STA + 1 of (P2P or NAN)) + {"Dual STA Concurrency", + {{kMainModeId, + ChipConcurrencyCombination::make_vec( + {{{{STA}, 1}, {{AP}, 1}}, {{{STA}, 2}, {{P2P, NAN}, 1}}})}}}, - // AP + AP + STA concurrency - // 3 - (1 STA + 2 AP) or (1 STA + 1 of (P2P or NAN)) - {"Dual AP Concurrency", - {{kMainModeId, legacyToChipConcurrencyComboList( - {{{{STA}, 1}, {{AP}, 2}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}}, + // AP + AP + STA concurrency + // 3 - (1 STA + 2 AP) or (1 STA + 1 of (P2P or NAN)) + {"Dual AP Concurrency", + {{kMainModeId, + ChipConcurrencyCombination::make_vec( + {{{{STA}, 1}, {{AP}, 2}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}}, - // STA + STA concurrency and AP + AP + STA concurrency - // 4 - (1 STA + 2 AP) or (2 STA + 1 of (P2P or NAN)) - {"Dual STA & Dual AP Concurrency", - {{kMainModeId, legacyToChipConcurrencyComboList( - {{{{STA}, 1}, {{AP}, 2}}, {{{STA}, 2}, {{P2P, NAN}, 1}}})}}}, + // STA + STA concurrency and AP + AP + STA concurrency + // 4 - (1 STA + 2 AP) or (2 STA + 1 of (P2P or NAN)) + {"Dual STA & Dual AP Concurrency", + {{kMainModeId, + ChipConcurrencyCombination::make_vec( + {{{{STA}, 1}, {{AP}, 2}}, {{{STA}, 2}, {{P2P, NAN}, 1}}})}}}, - // STA + STA concurrency - // 5 - (1 STA + 1 AP (bridged or single) | P2P | NAN), or (2 STA)) - {"Dual STA or STA plus single other interface", - {{kMainModeId, legacyToChipConcurrencyComboList( - {{{{STA}, 1}, {{P2P, NAN, AP, AP_BRIDGED}, 1}}, {{{STA}, 2}}})}}}}; + // STA + STA concurrency + // 5 - (1 STA + 1 AP (bridged or single) | P2P | NAN), or (2 STA)) + {"Dual STA or STA plus single other interface", + {{kMainModeId, ChipConcurrencyCombination::make_vec( + {{{{STA}, 1}, {{P2P, NAN, AP, AP_BRIDGED}, 1}}, + {{{STA}, 2}}})}}}}; #undef STA #undef AP -#undef AP_BRIDGED #undef P2P #undef NAN @@ -196,7 +214,7 @@ static const std::vector WifiFeatureFlags::WifiFeatureFlags() {} -std::vector WifiFeatureFlags::getChipModesForPrimary() { +std::vector WifiFeatureFlags::getChipModesForPrimary() { std::array buffer; auto res = property_get(kDebugPresetInterfaceCombinationIdxProperty, buffer.data(), nullptr); // Debug property not set, use the device preset concurrency combination. @@ -210,19 +228,20 @@ std::vector WifiFeatureFlags::getChipModesForPrimary() { return kChipModesPrimary; } std::string name; - std::vector chip_modes; + std::vector chip_modes; std::tie(name, chip_modes) = kDebugChipModes[idx]; LOG(INFO) << "Using debug chip mode: <" << name << "> set via property: " << kDebugPresetInterfaceCombinationIdxProperty; return chip_modes; } -std::vector WifiFeatureFlags::getChipModes(bool is_primary) { +std::vector WifiFeatureFlags::getChipModes(bool is_primary) { return (is_primary) ? getChipModesForPrimary() : kChipModesSecondary; } } // namespace feature_flags +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl diff --git a/wifi/aidl/default/wifi_feature_flags.h b/wifi/1.6/default/wifi_feature_flags.h similarity index 67% rename from wifi/aidl/default/wifi_feature_flags.h rename to wifi/1.6/default/wifi_feature_flags.h index af1b6a674d..1635341e3f 100644 --- a/wifi/aidl/default/wifi_feature_flags.h +++ b/wifi/1.6/default/wifi_feature_flags.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2016 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. @@ -17,23 +17,24 @@ #ifndef WIFI_FEATURE_FLAGS_H_ #define WIFI_FEATURE_FLAGS_H_ -#include +#include -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { namespace feature_flags { namespace chip_mode_ids { // These mode ID's should be unique (even across combo versions). Refer to -// handleChipConfiguration() for its usage. -constexpr uint32_t kInvalid = UINT32_MAX; +// handleChipConfiguration() for it's usage. +constexpr V1_0::ChipModeId kInvalid = UINT32_MAX; // Mode ID's for V1 -constexpr uint32_t kV1Sta = 0; -constexpr uint32_t kV1Ap = 1; +constexpr V1_0::ChipModeId kV1Sta = 0; +constexpr V1_0::ChipModeId kV1Ap = 1; // Mode ID for V3 -constexpr uint32_t kV3 = 3; +constexpr V1_0::ChipModeId kV3 = 3; } // namespace chip_mode_ids class WifiFeatureFlags { @@ -41,16 +42,17 @@ class WifiFeatureFlags { WifiFeatureFlags(); virtual ~WifiFeatureFlags() = default; - virtual std::vector getChipModes(bool is_primary); + virtual std::vector getChipModes(bool is_primary); private: - std::vector getChipModesForPrimary(); + std::vector getChipModesForPrimary(); }; } // namespace feature_flags +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl #endif // WIFI_FEATURE_FLAGS_H_ diff --git a/wifi/aidl/default/wifi_iface_util.cpp b/wifi/1.6/default/wifi_iface_util.cpp similarity index 95% rename from wifi/aidl/default/wifi_iface_util.cpp rename to wifi/1.6/default/wifi_iface_util.cpp index f788217dcf..d55e4f8251 100644 --- a/wifi/aidl/default/wifi_iface_util.cpp +++ b/wifi/1.6/default/wifi_iface_util.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2019 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. @@ -14,32 +14,33 @@ * limitations under the License. */ -#include -#include #include -#include - #include #include #include #include +#include +#include +#include + +#undef NAN #include "wifi_iface_util.h" namespace { // Constants to set the local bit & clear the multicast bit. constexpr uint8_t kMacAddressMulticastMask = 0x01; constexpr uint8_t kMacAddressLocallyAssignedMask = 0x02; - } // namespace -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { namespace iface_util { -WifiIfaceUtil::WifiIfaceUtil(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, +WifiIfaceUtil::WifiIfaceUtil(const std::weak_ptr iface_tool, const std::weak_ptr legacy_hal) : iface_tool_(iface_tool), legacy_hal_(legacy_hal), @@ -168,7 +169,8 @@ bool WifiIfaceUtil::removeIfaceFromBridge(const std::string& br_name, const std: } } // namespace iface_util +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl diff --git a/wifi/aidl/default/wifi_iface_util.h b/wifi/1.6/default/wifi_iface_util.h similarity index 89% rename from wifi/aidl/default/wifi_iface_util.h rename to wifi/1.6/default/wifi_iface_util.h index a3236a5622..c5db5deed1 100644 --- a/wifi/aidl/default/wifi_iface_util.h +++ b/wifi/1.6/default/wifi_iface_util.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2019 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. @@ -17,15 +17,17 @@ #ifndef WIFI_IFACE_UTIL_H_ #define WIFI_IFACE_UTIL_H_ -#include #include +#include + #include "wifi_legacy_hal.h" -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { namespace iface_util { // Iface event handlers. @@ -40,7 +42,7 @@ struct IfaceEventHandlers { */ class WifiIfaceUtil { public: - WifiIfaceUtil(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, + WifiIfaceUtil(const std::weak_ptr iface_tool, const std::weak_ptr legacy_hal); virtual ~WifiIfaceUtil() = default; @@ -69,16 +71,17 @@ class WifiIfaceUtil { virtual std::array createRandomMacAddress(); private: - std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool_; + std::weak_ptr iface_tool_; std::weak_ptr legacy_hal_; std::unique_ptr> random_mac_address_; std::map event_handlers_map_; }; } // namespace iface_util +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl #endif // WIFI_IFACE_UTIL_H_ diff --git a/wifi/aidl/default/wifi_legacy_hal.cpp b/wifi/1.6/default/wifi_legacy_hal.cpp similarity index 94% rename from wifi/aidl/default/wifi_legacy_hal.cpp rename to wifi/1.6/default/wifi_legacy_hal.cpp index 43e73cae9f..43cb7c42a1 100644 --- a/wifi/aidl/default/wifi_legacy_hal.cpp +++ b/wifi/1.6/default/wifi_legacy_hal.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2016 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. @@ -14,16 +14,15 @@ * limitations under the License. */ -#include "wifi_legacy_hal.h" +#include +#include #include #include #include -#include -#include - -#include "aidl_sync_util.h" +#include "hidl_sync_util.h" +#include "wifi_legacy_hal.h" #include "wifi_legacy_hal_stubs.h" namespace { @@ -39,7 +38,7 @@ static constexpr uint32_t kMaxWakeReasonStatsArraySize = 32; static constexpr uint32_t kMaxRingBuffers = 10; static constexpr uint32_t kMaxWifiUsableChannels = 256; static constexpr uint32_t kMaxSupportedRadioCombinationsMatrixLength = 256; -// Need a long timeout (1000ms) for chips that unload their driver. +// need a long timeout (1000ms) for chips that unload their driver. static constexpr uint32_t kMaxStopCompleteWaitMs = 1000; static constexpr char kDriverPropName[] = "wlan.driver.status"; @@ -52,10 +51,11 @@ std::vector makeCharVec(const std::string& str) { } } // namespace -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { namespace legacy_hal { // Legacy HAL functions accept "C" style function pointers, so use global @@ -65,7 +65,7 @@ namespace legacy_hal { // Callback to be invoked once |stop| is complete std::function on_stop_complete_internal_callback; void onAsyncStopComplete(wifi_handle handle) { - const auto lock = aidl_sync_util::acquireGlobalLock(); + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_stop_complete_internal_callback) { on_stop_complete_internal_callback(handle); // Invalidate this callback since we don't want this firing again. @@ -92,7 +92,7 @@ void onSyncFirmwareMemoryDump(char* buffer, int buffer_size) { // Callback to be invoked for Gscan events. std::function on_gscan_event_internal_callback; void onAsyncGscanEvent(wifi_request_id id, wifi_scan_event event) { - const auto lock = aidl_sync_util::acquireGlobalLock(); + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_gscan_event_internal_callback) { on_gscan_event_internal_callback(id, event); } @@ -103,7 +103,7 @@ std::function on_gscan_full_result_internal_callback; void onAsyncGscanFullResult(wifi_request_id id, wifi_scan_result* result, uint32_t buckets_scanned) { - const auto lock = aidl_sync_util::acquireGlobalLock(); + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_gscan_full_result_internal_callback) { on_gscan_full_result_internal_callback(id, result, buckets_scanned); } @@ -123,7 +123,7 @@ void onSyncLinkLayerStatsResult(wifi_request_id id, wifi_iface_stat* iface_stat, std::function on_rssi_threshold_breached_internal_callback; void onAsyncRssiThresholdBreached(wifi_request_id id, uint8_t* bssid, int8_t rssi) { - const auto lock = aidl_sync_util::acquireGlobalLock(); + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_rssi_threshold_breached_internal_callback) { on_rssi_threshold_breached_internal_callback(id, bssid, rssi); } @@ -134,7 +134,7 @@ std::function on_ring_buffer_data_internal_callback; void onAsyncRingBufferData(char* ring_name, char* buffer, int buffer_size, wifi_ring_buffer_status* status) { - const auto lock = aidl_sync_util::acquireGlobalLock(); + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_ring_buffer_data_internal_callback) { on_ring_buffer_data_internal_callback(ring_name, buffer, buffer_size, status); } @@ -143,7 +143,7 @@ void onAsyncRingBufferData(char* ring_name, char* buffer, int buffer_size, // Callback to be invoked for error alert indication. std::function on_error_alert_internal_callback; void onAsyncErrorAlert(wifi_request_id id, char* buffer, int buffer_size, int err_code) { - const auto lock = aidl_sync_util::acquireGlobalLock(); + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_error_alert_internal_callback) { on_error_alert_internal_callback(id, buffer, buffer_size, err_code); } @@ -153,7 +153,7 @@ void onAsyncErrorAlert(wifi_request_id id, char* buffer, int buffer_size, int er std::function on_radio_mode_change_internal_callback; void onAsyncRadioModeChange(wifi_request_id id, uint32_t num_macs, wifi_mac_info* mac_infos) { - const auto lock = aidl_sync_util::acquireGlobalLock(); + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_radio_mode_change_internal_callback) { on_radio_mode_change_internal_callback(id, num_macs, mac_infos); } @@ -162,7 +162,7 @@ void onAsyncRadioModeChange(wifi_request_id id, uint32_t num_macs, wifi_mac_info // Callback to be invoked to report subsystem restart std::function on_subsystem_restart_internal_callback; void onAsyncSubsystemRestart(const char* error) { - const auto lock = aidl_sync_util::acquireGlobalLock(); + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_subsystem_restart_internal_callback) { on_subsystem_restart_internal_callback(error); } @@ -172,7 +172,7 @@ void onAsyncSubsystemRestart(const char* error) { std::function on_rtt_results_internal_callback; void onAsyncRttResults(wifi_request_id id, unsigned num_results, wifi_rtt_result* rtt_results[]) { - const auto lock = aidl_sync_util::acquireGlobalLock(); + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_rtt_results_internal_callback) { on_rtt_results_internal_callback(id, num_results, rtt_results); on_rtt_results_internal_callback = nullptr; @@ -184,37 +184,37 @@ void onAsyncRttResults(wifi_request_id id, unsigned num_results, wifi_rtt_result // callbacks. // So, handle all of them here directly to avoid adding an unnecessary layer. std::function on_nan_notify_response_user_callback; -void onAsyncNanNotifyResponse(transaction_id id, NanResponseMsg* msg) { - const auto lock = aidl_sync_util::acquireGlobalLock(); +void onAysncNanNotifyResponse(transaction_id id, NanResponseMsg* msg) { + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_nan_notify_response_user_callback && msg) { on_nan_notify_response_user_callback(id, *msg); } } std::function on_nan_event_publish_replied_user_callback; -void onAsyncNanEventPublishReplied(NanPublishRepliedInd* /* event */) { - LOG(ERROR) << "onAsyncNanEventPublishReplied triggered"; +void onAysncNanEventPublishReplied(NanPublishRepliedInd* /* event */) { + LOG(ERROR) << "onAysncNanEventPublishReplied triggered"; } std::function on_nan_event_publish_terminated_user_callback; -void onAsyncNanEventPublishTerminated(NanPublishTerminatedInd* event) { - const auto lock = aidl_sync_util::acquireGlobalLock(); +void onAysncNanEventPublishTerminated(NanPublishTerminatedInd* event) { + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_nan_event_publish_terminated_user_callback && event) { on_nan_event_publish_terminated_user_callback(*event); } } std::function on_nan_event_match_user_callback; -void onAsyncNanEventMatch(NanMatchInd* event) { - const auto lock = aidl_sync_util::acquireGlobalLock(); +void onAysncNanEventMatch(NanMatchInd* event) { + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_nan_event_match_user_callback && event) { on_nan_event_match_user_callback(*event); } } std::function on_nan_event_match_expired_user_callback; -void onAsyncNanEventMatchExpired(NanMatchExpiredInd* event) { - const auto lock = aidl_sync_util::acquireGlobalLock(); +void onAysncNanEventMatchExpired(NanMatchExpiredInd* event) { + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_nan_event_match_expired_user_callback && event) { on_nan_event_match_expired_user_callback(*event); } @@ -222,95 +222,95 @@ void onAsyncNanEventMatchExpired(NanMatchExpiredInd* event) { std::function on_nan_event_subscribe_terminated_user_callback; -void onAsyncNanEventSubscribeTerminated(NanSubscribeTerminatedInd* event) { - const auto lock = aidl_sync_util::acquireGlobalLock(); +void onAysncNanEventSubscribeTerminated(NanSubscribeTerminatedInd* event) { + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_nan_event_subscribe_terminated_user_callback && event) { on_nan_event_subscribe_terminated_user_callback(*event); } } std::function on_nan_event_followup_user_callback; -void onAsyncNanEventFollowup(NanFollowupInd* event) { - const auto lock = aidl_sync_util::acquireGlobalLock(); +void onAysncNanEventFollowup(NanFollowupInd* event) { + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_nan_event_followup_user_callback && event) { on_nan_event_followup_user_callback(*event); } } std::function on_nan_event_disc_eng_event_user_callback; -void onAsyncNanEventDiscEngEvent(NanDiscEngEventInd* event) { - const auto lock = aidl_sync_util::acquireGlobalLock(); +void onAysncNanEventDiscEngEvent(NanDiscEngEventInd* event) { + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_nan_event_disc_eng_event_user_callback && event) { on_nan_event_disc_eng_event_user_callback(*event); } } std::function on_nan_event_disabled_user_callback; -void onAsyncNanEventDisabled(NanDisabledInd* event) { - const auto lock = aidl_sync_util::acquireGlobalLock(); +void onAysncNanEventDisabled(NanDisabledInd* event) { + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_nan_event_disabled_user_callback && event) { on_nan_event_disabled_user_callback(*event); } } std::function on_nan_event_tca_user_callback; -void onAsyncNanEventTca(NanTCAInd* event) { - const auto lock = aidl_sync_util::acquireGlobalLock(); +void onAysncNanEventTca(NanTCAInd* event) { + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_nan_event_tca_user_callback && event) { on_nan_event_tca_user_callback(*event); } } std::function on_nan_event_beacon_sdf_payload_user_callback; -void onAsyncNanEventBeaconSdfPayload(NanBeaconSdfPayloadInd* event) { - const auto lock = aidl_sync_util::acquireGlobalLock(); +void onAysncNanEventBeaconSdfPayload(NanBeaconSdfPayloadInd* event) { + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_nan_event_beacon_sdf_payload_user_callback && event) { on_nan_event_beacon_sdf_payload_user_callback(*event); } } std::function on_nan_event_data_path_request_user_callback; -void onAsyncNanEventDataPathRequest(NanDataPathRequestInd* event) { - const auto lock = aidl_sync_util::acquireGlobalLock(); +void onAysncNanEventDataPathRequest(NanDataPathRequestInd* event) { + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_nan_event_data_path_request_user_callback && event) { on_nan_event_data_path_request_user_callback(*event); } } std::function on_nan_event_data_path_confirm_user_callback; -void onAsyncNanEventDataPathConfirm(NanDataPathConfirmInd* event) { - const auto lock = aidl_sync_util::acquireGlobalLock(); +void onAysncNanEventDataPathConfirm(NanDataPathConfirmInd* event) { + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_nan_event_data_path_confirm_user_callback && event) { on_nan_event_data_path_confirm_user_callback(*event); } } std::function on_nan_event_data_path_end_user_callback; -void onAsyncNanEventDataPathEnd(NanDataPathEndInd* event) { - const auto lock = aidl_sync_util::acquireGlobalLock(); +void onAysncNanEventDataPathEnd(NanDataPathEndInd* event) { + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_nan_event_data_path_end_user_callback && event) { on_nan_event_data_path_end_user_callback(*event); } } std::function on_nan_event_transmit_follow_up_user_callback; -void onAsyncNanEventTransmitFollowUp(NanTransmitFollowupInd* event) { - const auto lock = aidl_sync_util::acquireGlobalLock(); +void onAysncNanEventTransmitFollowUp(NanTransmitFollowupInd* event) { + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_nan_event_transmit_follow_up_user_callback && event) { on_nan_event_transmit_follow_up_user_callback(*event); } } std::function on_nan_event_range_request_user_callback; -void onAsyncNanEventRangeRequest(NanRangeRequestInd* event) { - const auto lock = aidl_sync_util::acquireGlobalLock(); +void onAysncNanEventRangeRequest(NanRangeRequestInd* event) { + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_nan_event_range_request_user_callback && event) { on_nan_event_range_request_user_callback(*event); } } std::function on_nan_event_range_report_user_callback; -void onAsyncNanEventRangeReport(NanRangeReportInd* event) { - const auto lock = aidl_sync_util::acquireGlobalLock(); +void onAysncNanEventRangeReport(NanRangeReportInd* event) { + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_nan_event_range_report_user_callback && event) { on_nan_event_range_report_user_callback(*event); } @@ -318,7 +318,7 @@ void onAsyncNanEventRangeReport(NanRangeReportInd* event) { std::function on_nan_event_schedule_update_user_callback; void onAsyncNanEventScheduleUpdate(NanDataPathScheduleUpdateInd* event) { - const auto lock = aidl_sync_util::acquireGlobalLock(); + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_nan_event_schedule_update_user_callback && event) { on_nan_event_schedule_update_user_callback(*event); } @@ -327,7 +327,7 @@ void onAsyncNanEventScheduleUpdate(NanDataPathScheduleUpdateInd* event) { // Callbacks for the various TWT operations. std::function on_twt_event_setup_response_callback; void onAsyncTwtEventSetupResponse(TwtSetupResponse* event) { - const auto lock = aidl_sync_util::acquireGlobalLock(); + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_twt_event_setup_response_callback && event) { on_twt_event_setup_response_callback(*event); } @@ -335,7 +335,7 @@ void onAsyncTwtEventSetupResponse(TwtSetupResponse* event) { std::function on_twt_event_teardown_completion_callback; void onAsyncTwtEventTeardownCompletion(TwtTeardownCompletion* event) { - const auto lock = aidl_sync_util::acquireGlobalLock(); + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_twt_event_teardown_completion_callback && event) { on_twt_event_teardown_completion_callback(*event); } @@ -343,7 +343,7 @@ void onAsyncTwtEventTeardownCompletion(TwtTeardownCompletion* event) { std::function on_twt_event_info_frame_received_callback; void onAsyncTwtEventInfoFrameReceived(TwtInfoFrameReceived* event) { - const auto lock = aidl_sync_util::acquireGlobalLock(); + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_twt_event_info_frame_received_callback && event) { on_twt_event_info_frame_received_callback(*event); } @@ -351,7 +351,7 @@ void onAsyncTwtEventInfoFrameReceived(TwtInfoFrameReceived* event) { std::function on_twt_event_device_notify_callback; void onAsyncTwtEventDeviceNotify(TwtDeviceNotify* event) { - const auto lock = aidl_sync_util::acquireGlobalLock(); + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_twt_event_device_notify_callback && event) { on_twt_event_device_notify_callback(*event); } @@ -360,7 +360,7 @@ void onAsyncTwtEventDeviceNotify(TwtDeviceNotify* event) { // Callback to report current CHRE NAN state std::function on_chre_nan_rtt_internal_callback; void onAsyncChreNanRttState(chre_nan_rtt_state state) { - const auto lock = aidl_sync_util::acquireGlobalLock(); + const auto lock = hidl_sync_util::acquireGlobalLock(); if (on_chre_nan_rtt_internal_callback) { on_chre_nan_rtt_internal_callback(state); } @@ -376,7 +376,7 @@ void onSyncCachedScanResults(wifi_cached_scan_report* cache_report) { // End of the free-standing "C" style callbacks. -WifiLegacyHal::WifiLegacyHal(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, +WifiLegacyHal::WifiLegacyHal(const std::weak_ptr iface_tool, const wifi_hal_fn& fn, bool is_primary) : global_func_table_(fn), global_handle_(nullptr), @@ -769,7 +769,7 @@ wifi_error WifiLegacyHal::startRssiMonitoring( if (!bssid_ptr) { return; } - std::array bssid_arr; + std::array bssid_arr; // |bssid_ptr| pointer is assumed to have 6 bytes for the mac // address. std::copy(bssid_ptr, bssid_ptr + 6, std::begin(bssid_arr)); @@ -820,12 +820,12 @@ wifi_error WifiLegacyHal::configureNdOffload(const std::string& iface_name, bool return global_func_table_.wifi_configure_nd_offload(getIfaceHandle(iface_name), enable); } -wifi_error WifiLegacyHal::startSendingOffloadedPacket(const std::string& iface_name, int32_t cmd_id, - uint16_t ether_type, +wifi_error WifiLegacyHal::startSendingOffloadedPacket(const std::string& iface_name, + uint32_t cmd_id, uint16_t ether_type, const std::vector& ip_packet_data, const std::array& src_address, const std::array& dst_address, - int32_t period_in_ms) { + uint32_t period_in_ms) { std::vector ip_packet_data_internal(ip_packet_data); std::vector src_address_internal(src_address.data(), src_address.data() + src_address.size()); @@ -1120,15 +1120,14 @@ wifi_error WifiLegacyHal::startRttRangeRequest( wifi_error WifiLegacyHal::cancelRttRangeRequest( const std::string& iface_name, wifi_request_id id, - const std::vector>& mac_addrs) { + const std::vector>& mac_addrs) { if (!on_rtt_results_internal_callback) { return WIFI_ERROR_NOT_AVAILABLE; } - static_assert(sizeof(mac_addr) == sizeof(std::array), - "MAC address size mismatch"); + static_assert(sizeof(mac_addr) == sizeof(std::array), "MAC address size mismatch"); // TODO: How do we handle partial cancels (i.e only a subset of enabled mac // addressed are cancelled). - std::vector> mac_addrs_internal(mac_addrs); + std::vector> mac_addrs_internal(mac_addrs); wifi_error status = global_func_table_.wifi_rtt_range_cancel( id, getIfaceHandle(iface_name), mac_addrs.size(), reinterpret_cast(mac_addrs_internal.data())); @@ -1203,14 +1202,14 @@ wifi_error WifiLegacyHal::nanRegisterCallbackHandlers(const std::string& iface_n return global_func_table_.wifi_nan_register_handler( getIfaceHandle(iface_name), - {onAsyncNanNotifyResponse, onAsyncNanEventPublishReplied, - onAsyncNanEventPublishTerminated, onAsyncNanEventMatch, onAsyncNanEventMatchExpired, - onAsyncNanEventSubscribeTerminated, onAsyncNanEventFollowup, - onAsyncNanEventDiscEngEvent, onAsyncNanEventDisabled, onAsyncNanEventTca, - onAsyncNanEventBeaconSdfPayload, onAsyncNanEventDataPathRequest, - onAsyncNanEventDataPathConfirm, onAsyncNanEventDataPathEnd, - onAsyncNanEventTransmitFollowUp, onAsyncNanEventRangeRequest, - onAsyncNanEventRangeReport, onAsyncNanEventScheduleUpdate}); + {onAysncNanNotifyResponse, onAysncNanEventPublishReplied, + onAysncNanEventPublishTerminated, onAysncNanEventMatch, onAysncNanEventMatchExpired, + onAysncNanEventSubscribeTerminated, onAysncNanEventFollowup, + onAysncNanEventDiscEngEvent, onAysncNanEventDisabled, onAysncNanEventTca, + onAysncNanEventBeaconSdfPayload, onAysncNanEventDataPathRequest, + onAysncNanEventDataPathConfirm, onAysncNanEventDataPathEnd, + onAysncNanEventTransmitFollowUp, onAysncNanEventRangeRequest, + onAysncNanEventRangeReport, onAsyncNanEventScheduleUpdate}); } wifi_error WifiLegacyHal::nanEnableRequest(const std::string& iface_name, transaction_id id, @@ -1341,7 +1340,7 @@ wifi_error WifiLegacyHal::nanDataEnd(const std::string& iface_name, transaction_ } wifi_error WifiLegacyHal::setCountryCode(const std::string& iface_name, - const std::array code) { + std::array code) { std::string code_str(code.data(), code.data() + code.size()); return global_func_table_.wifi_set_country_code(getIfaceHandle(iface_name), code_str.c_str()); } @@ -1385,7 +1384,7 @@ wifi_interface_handle WifiLegacyHal::getIfaceHandle(const std::string& iface_nam void WifiLegacyHal::runEventLoop() { LOG(DEBUG) << "Starting legacy HAL event loop"; global_func_table_.wifi_event_loop(global_handle_); - const auto lock = aidl_sync_util::acquireGlobalLock(); + const auto lock = hidl_sync_util::acquireGlobalLock(); if (!awaiting_event_loop_termination_) { LOG(FATAL) << "Legacy HAL event loop terminated, but HAL was not stopping"; } @@ -1648,7 +1647,8 @@ void WifiLegacyHal::invalidate() { } } // namespace legacy_hal +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl diff --git a/wifi/aidl/default/wifi_legacy_hal.h b/wifi/1.6/default/wifi_legacy_hal.h similarity index 97% rename from wifi/aidl/default/wifi_legacy_hal.h rename to wifi/1.6/default/wifi_legacy_hal.h index cd8c0b1136..1fd784ad43 100644 --- a/wifi/aidl/default/wifi_legacy_hal.h +++ b/wifi/1.6/default/wifi_legacy_hal.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2016 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. @@ -17,22 +17,22 @@ #ifndef WIFI_LEGACY_HAL_H_ #define WIFI_LEGACY_HAL_H_ -#include -#include - #include #include #include -#include #include #include -namespace aidl { +#include +#include + namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { // This is in a separate namespace to prevent typename conflicts between -// the legacy HAL types and the AIDL interface types. +// the legacy HAL types and the HIDL interface types. namespace legacy_hal { // Import all the types defined inside the legacy HAL header files into this // namespace. @@ -411,7 +411,7 @@ using on_gscan_results_callback = // Invoked when the rssi value breaches the thresholds set. using on_rssi_threshold_breached_callback = - std::function, int8_t)>; + std::function, int8_t)>; // Callback for RTT range request results. // Rtt results contain IE info and are hence passed by reference, to @@ -481,8 +481,8 @@ struct CachedScanResultsCallbackHandlers { */ class WifiLegacyHal { public: - WifiLegacyHal(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, - const wifi_hal_fn& fn, bool is_primary); + WifiLegacyHal(const std::weak_ptr iface_tool, const wifi_hal_fn& fn, + bool is_primary); virtual ~WifiLegacyHal() = default; // Initialize the legacy HAL function table. @@ -521,7 +521,7 @@ class WifiLegacyHal { // |on_results_user_callback| on success. // b) |WIFI_SCAN_FAILED| scan event or failure to retrieve cached scan // results - // Triggers the externally provided |on_failure_user_callback|. + // triggers the externally provided |on_failure_user_callback|. // c) Full scan result event triggers the externally provided // |on_full_result_user_callback|. wifi_error startGscan(const std::string& iface_name, wifi_request_id id, @@ -547,12 +547,12 @@ class WifiLegacyHal { wifi_error configureRoaming(const std::string& iface_name, const wifi_roaming_config& config); wifi_error enableFirmwareRoaming(const std::string& iface_name, fw_roaming_state_t state); wifi_error configureNdOffload(const std::string& iface_name, bool enable); - wifi_error startSendingOffloadedPacket(const std::string& iface_name, int32_t cmd_id, + wifi_error startSendingOffloadedPacket(const std::string& iface_name, uint32_t cmd_id, uint16_t ether_type, const std::vector& ip_packet_data, const std::array& src_address, const std::array& dst_address, - int32_t period_in_ms); + uint32_t period_in_ms); wifi_error stopSendingOffloadedPacket(const std::string& iface_name, uint32_t cmd_id); virtual wifi_error selectTxPowerScenario(const std::string& iface_name, wifi_power_scenario scenario); @@ -591,7 +591,7 @@ class WifiLegacyHal { const std::vector& rtt_configs, const on_rtt_results_callback& on_results_callback); wifi_error cancelRttRangeRequest(const std::string& iface_name, wifi_request_id id, - const std::vector>& mac_addrs); + const std::vector>& mac_addrs); std::pair getRttCapabilities(const std::string& iface_name); std::pair getRttResponderInfo(const std::string& iface_name); wifi_error enableRttResponder(const std::string& iface_name, wifi_request_id id, @@ -638,9 +638,9 @@ class WifiLegacyHal { const NanDataPathIndicationResponse& msg); wifi_error nanDataEnd(const std::string& iface_name, transaction_id id, uint32_t ndpInstanceId); // AP functions. - wifi_error setCountryCode(const std::string& iface_name, const std::array code); + wifi_error setCountryCode(const std::string& iface_name, std::array code); - // Interface functions. + // interface functions. virtual wifi_error createVirtualInterface(const std::string& ifname, wifi_interface_type iftype); virtual wifi_error deleteVirtualInterface(const std::string& ifname); @@ -721,8 +721,8 @@ class WifiLegacyHal { std::condition_variable_any stop_wait_cv_; // Flag to indicate if the legacy HAL has been started. bool is_started_; - std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool_; - // Flag to indicate if this HAL is for the primary chip. This is used + std::weak_ptr iface_tool_; + // flag to indicate if this HAL is for the primary chip. This is used // in order to avoid some hard-coded behavior used with older HALs, // such as bring wlan0 interface up/down on start/stop HAL. // it may be removed once vendor HALs are updated. @@ -730,9 +730,10 @@ class WifiLegacyHal { }; } // namespace legacy_hal +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl #endif // WIFI_LEGACY_HAL_H_ diff --git a/wifi/aidl/default/wifi_legacy_hal_factory.cpp b/wifi/1.6/default/wifi_legacy_hal_factory.cpp similarity index 97% rename from wifi/aidl/default/wifi_legacy_hal_factory.cpp rename to wifi/1.6/default/wifi_legacy_hal_factory.cpp index 60f81ed764..147bf4d7cc 100644 --- a/wifi/aidl/default/wifi_legacy_hal_factory.cpp +++ b/wifi/1.6/default/wifi_legacy_hal_factory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2020 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. @@ -14,17 +14,17 @@ * limitations under the License. */ -#include "wifi_legacy_hal_factory.h" +#include +#include +#include #include -#include #include #include #include #include -#include -#include +#include "wifi_legacy_hal_factory.h" #include "wifi_legacy_hal_stubs.h" namespace { @@ -59,14 +59,15 @@ bool isFileExtension(const char* name, const char* ext) { } }; // namespace -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { namespace legacy_hal { WifiLegacyHalFactory::WifiLegacyHalFactory( - const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool) + const std::weak_ptr iface_tool) : iface_tool_(iface_tool) {} std::vector> WifiLegacyHalFactory::getHals() { @@ -246,7 +247,8 @@ out_err: } } // namespace legacy_hal +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl diff --git a/wifi/aidl/default/wifi_legacy_hal_factory.h b/wifi/1.6/default/wifi_legacy_hal_factory.h similarity index 82% rename from wifi/aidl/default/wifi_legacy_hal_factory.h rename to wifi/1.6/default/wifi_legacy_hal_factory.h index e7b287a6f5..9f4423efb7 100644 --- a/wifi/aidl/default/wifi_legacy_hal_factory.h +++ b/wifi/1.6/default/wifi_legacy_hal_factory.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2020 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. @@ -21,19 +21,20 @@ #include "wifi_legacy_hal.h" -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { // This is in a separate namespace to prevent typename conflicts between -// the legacy HAL types and the AIDL interface types. +// the legacy HAL types and the HIDL interface types. namespace legacy_hal { /** * Class that creates WifiLegacyHal objects for vendor HALs in the system. */ class WifiLegacyHalFactory { public: - WifiLegacyHalFactory(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool); + WifiLegacyHalFactory(const std::weak_ptr iface_tool); virtual ~WifiLegacyHalFactory() = default; std::vector> getHals(); @@ -50,15 +51,16 @@ class WifiLegacyHalFactory { bool initLinkedHalFunctionTable(wifi_hal_fn* hal_fn); bool loadVendorHalLib(const std::string& path, wifi_hal_lib_desc& desc); - std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool_; + std::weak_ptr iface_tool_; std::vector descs_; std::vector> legacy_hals_; }; } // namespace legacy_hal +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl #endif // WIFI_LEGACY_HAL_FACTORY_H_ diff --git a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp b/wifi/1.6/default/wifi_legacy_hal_stubs.cpp similarity index 98% rename from wifi/aidl/default/wifi_legacy_hal_stubs.cpp rename to wifi/1.6/default/wifi_legacy_hal_stubs.cpp index cff7f6977b..8f8527a4cc 100644 --- a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp +++ b/wifi/1.6/default/wifi_legacy_hal_stubs.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2016 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. @@ -17,10 +17,11 @@ #include "wifi_legacy_hal_stubs.h" // TODO: Remove these stubs from HalTool in libwifi-system. -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { namespace legacy_hal { template struct stubFunction; @@ -169,9 +170,9 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { populateStubFor(&hal_fn->wifi_get_cached_scan_results); return true; } - } // namespace legacy_hal +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl diff --git a/wifi/aidl/default/wifi_legacy_hal_stubs.h b/wifi/1.6/default/wifi_legacy_hal_stubs.h similarity index 86% rename from wifi/aidl/default/wifi_legacy_hal_stubs.h rename to wifi/1.6/default/wifi_legacy_hal_stubs.h index 603ecf2eae..c9a03bf4c9 100644 --- a/wifi/aidl/default/wifi_legacy_hal_stubs.h +++ b/wifi/1.6/default/wifi_legacy_hal_stubs.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2016 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. @@ -19,17 +19,19 @@ #include -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { namespace legacy_hal { bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn); } // namespace legacy_hal +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl #endif // WIFI_LEGACY_HAL_STUBS_H_ diff --git a/wifi/aidl/default/wifi_mode_controller.cpp b/wifi/1.6/default/wifi_mode_controller.cpp similarity index 91% rename from wifi/aidl/default/wifi_mode_controller.cpp rename to wifi/1.6/default/wifi_mode_controller.cpp index 07cb072363..4b8ac7dd1c 100644 --- a/wifi/aidl/default/wifi_mode_controller.cpp +++ b/wifi/1.6/default/wifi_mode_controller.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2016 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. @@ -14,16 +14,16 @@ * limitations under the License. */ -#include "wifi_mode_controller.h" - #include #include #include -namespace { -using aidl::android::hardware::wifi::IfaceType; +#include "wifi_mode_controller.h" + +using android::hardware::wifi::V1_0::IfaceType; using android::wifi_hal::DriverTool; +namespace { int convertIfaceTypeToFirmwareMode(IfaceType type) { int mode; switch (type) { @@ -33,7 +33,7 @@ int convertIfaceTypeToFirmwareMode(IfaceType type) { case IfaceType::P2P: mode = DriverTool::kFirmwareModeP2p; break; - case IfaceType::NAN_IFACE: + case IfaceType::NAN: // NAN is exposed in STA mode currently. mode = DriverTool::kFirmwareModeSta; break; @@ -45,10 +45,11 @@ int convertIfaceTypeToFirmwareMode(IfaceType type) { } } // namespace -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { namespace mode_controller { WifiModeController::WifiModeController() : driver_tool_(new DriverTool) {} @@ -80,9 +81,9 @@ bool WifiModeController::deinitialize() { } return true; } - } // namespace mode_controller +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl diff --git a/wifi/aidl/default/wifi_mode_controller.h b/wifi/1.6/default/wifi_mode_controller.h similarity index 84% rename from wifi/aidl/default/wifi_mode_controller.h rename to wifi/1.6/default/wifi_mode_controller.h index 1a9fb1a498..fee2b66d4e 100644 --- a/wifi/aidl/default/wifi_mode_controller.h +++ b/wifi/1.6/default/wifi_mode_controller.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2016 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. @@ -17,14 +17,17 @@ #ifndef WIFI_MODE_CONTROLLER_H_ #define WIFI_MODE_CONTROLLER_H_ -#include #include -namespace aidl { +#include + namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { namespace mode_controller { +using namespace android::hardware::wifi::V1_0; /** * Class that encapsulates all firmware mode configuration. @@ -47,13 +50,14 @@ class WifiModeController { virtual bool deinitialize(); private: - std::unique_ptr<::android::wifi_hal::DriverTool> driver_tool_; + std::unique_ptr driver_tool_; }; } // namespace mode_controller +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl #endif // WIFI_MODE_CONTROLLER_H_ diff --git a/wifi/1.6/default/wifi_nan_iface.cpp b/wifi/1.6/default/wifi_nan_iface.cpp new file mode 100644 index 0000000000..ac2ebc940e --- /dev/null +++ b/wifi/1.6/default/wifi_nan_iface.cpp @@ -0,0 +1,1016 @@ +/* + * Copyright (C) 2016 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. + */ + +#include + +#include "hidl_return_util.h" +#include "hidl_struct_util.h" +#include "wifi_nan_iface.h" +#include "wifi_status_util.h" + +namespace android { +namespace hardware { +namespace wifi { +namespace V1_6 { +namespace implementation { +using hidl_return_util::validateAndCall; + +WifiNanIface::WifiNanIface(const std::string& ifname, bool is_dedicated_iface, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util) + : ifname_(ifname), + is_dedicated_iface_(is_dedicated_iface), + legacy_hal_(legacy_hal), + iface_util_(iface_util), + is_valid_(true) { + if (is_dedicated_iface_) { + // If using a dedicated iface, set the iface up first. + if (!iface_util_.lock()->setUpState(ifname_, true)) { + // Fatal failure, invalidate the iface object. + invalidate(); + return; + } + } + // Register all the callbacks here. these should be valid for the lifetime + // of the object. Whenever the mode changes legacy HAL will remove + // all of these callbacks. + legacy_hal::NanCallbackHandlers callback_handlers; + android::wp weak_ptr_this(this); + + // Callback for response. + callback_handlers.on_notify_response = [weak_ptr_this](legacy_hal::transaction_id id, + const legacy_hal::NanResponseMsg& msg) { + const auto shared_ptr_this = weak_ptr_this.promote(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + WifiNanStatus wifiNanStatus; + if (!hidl_struct_util::convertLegacyNanResponseHeaderToHidl(msg, &wifiNanStatus)) { + LOG(ERROR) << "Failed to convert nan response header"; + return; + } + + switch (msg.response_type) { + case legacy_hal::NAN_RESPONSE_ENABLED: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyEnableResponse(id, wifiNanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_DISABLED: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyDisableResponse(id, wifiNanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_PUBLISH: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyStartPublishResponse(id, wifiNanStatus, + msg.body.publish_response.publish_id) + .isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_PUBLISH_CANCEL: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyStopPublishResponse(id, wifiNanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_TRANSMIT_FOLLOWUP: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyTransmitFollowupResponse(id, wifiNanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_SUBSCRIBE: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyStartSubscribeResponse( + id, wifiNanStatus, + msg.body.subscribe_response.subscribe_id) + .isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_SUBSCRIBE_CANCEL: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyStopSubscribeResponse(id, wifiNanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_CONFIG: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyConfigResponse(id, wifiNanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_GET_CAPABILITIES: { + V1_6::NanCapabilities hidl_struct; + if (!hidl_struct_util::convertLegacyNanCapabilitiesResponseToHidl( + msg.body.nan_capabilities, &hidl_struct)) { + LOG(ERROR) << "Failed to convert nan capabilities response"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks_1_6()) { + if (!callback->notifyCapabilitiesResponse_1_6(id, wifiNanStatus, hidl_struct) + .isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_DP_INTERFACE_CREATE: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyCreateDataInterfaceResponse(id, wifiNanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_DP_INTERFACE_DELETE: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyDeleteDataInterfaceResponse(id, wifiNanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_DP_INITIATOR_RESPONSE: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyInitiateDataPathResponse( + id, wifiNanStatus, + msg.body.data_request_response.ndp_instance_id) + .isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_DP_RESPONDER_RESPONSE: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyRespondToDataPathIndicationResponse(id, wifiNanStatus) + .isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_DP_END: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyTerminateDataPathResponse(id, wifiNanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_BEACON_SDF_PAYLOAD: + /* fall through */ + case legacy_hal::NAN_RESPONSE_TCA: + /* fall through */ + case legacy_hal::NAN_RESPONSE_STATS: + /* fall through */ + case legacy_hal::NAN_RESPONSE_ERROR: + /* fall through */ + default: + LOG(ERROR) << "Unknown or unhandled response type: " << msg.response_type; + return; + } + }; + + callback_handlers.on_event_disc_eng_event = + [weak_ptr_this](const legacy_hal::NanDiscEngEventInd& msg) { + const auto shared_ptr_this = weak_ptr_this.promote(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanClusterEventInd hidl_struct; + // event types defined identically - hence can be cast + hidl_struct.eventType = (NanClusterEventType)msg.event_type; + hidl_struct.addr = msg.data.mac_addr.addr; + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventClusterEvent(hidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_disabled = [weak_ptr_this](const legacy_hal::NanDisabledInd& msg) { + const auto shared_ptr_this = weak_ptr_this.promote(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + WifiNanStatus status; + hidl_struct_util::convertToWifiNanStatus(msg.reason, msg.nan_reason, sizeof(msg.nan_reason), + &status); + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventDisabled(status).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_publish_terminated = + [weak_ptr_this](const legacy_hal::NanPublishTerminatedInd& msg) { + const auto shared_ptr_this = weak_ptr_this.promote(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + WifiNanStatus status; + hidl_struct_util::convertToWifiNanStatus(msg.reason, msg.nan_reason, + sizeof(msg.nan_reason), &status); + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventPublishTerminated(msg.publish_id, status).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_subscribe_terminated = + [weak_ptr_this](const legacy_hal::NanSubscribeTerminatedInd& msg) { + const auto shared_ptr_this = weak_ptr_this.promote(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + WifiNanStatus status; + hidl_struct_util::convertToWifiNanStatus(msg.reason, msg.nan_reason, + sizeof(msg.nan_reason), &status); + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventSubscribeTerminated(msg.subscribe_id, status).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_match = [weak_ptr_this](const legacy_hal::NanMatchInd& msg) { + const auto shared_ptr_this = weak_ptr_this.promote(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + V1_6::NanMatchInd hidl_struct; + if (!hidl_struct_util::convertLegacyNanMatchIndToHidl(msg, &hidl_struct)) { + LOG(ERROR) << "Failed to convert nan capabilities response"; + return; + } + + for (const auto& callback : shared_ptr_this->getEventCallbacks_1_6()) { + if (!callback->eventMatch_1_6(hidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_match_expired = [weak_ptr_this]( + const legacy_hal::NanMatchExpiredInd& msg) { + const auto shared_ptr_this = weak_ptr_this.promote(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventMatchExpired(msg.publish_subscribe_id, msg.requestor_instance_id) + .isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_followup = [weak_ptr_this](const legacy_hal::NanFollowupInd& msg) { + const auto shared_ptr_this = weak_ptr_this.promote(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanFollowupReceivedInd hidl_struct; + if (!hidl_struct_util::convertLegacyNanFollowupIndToHidl(msg, &hidl_struct)) { + LOG(ERROR) << "Failed to convert nan capabilities response"; + return; + } + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventFollowupReceived(hidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_transmit_follow_up = + [weak_ptr_this](const legacy_hal::NanTransmitFollowupInd& msg) { + const auto shared_ptr_this = weak_ptr_this.promote(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + WifiNanStatus status; + hidl_struct_util::convertToWifiNanStatus(msg.reason, msg.nan_reason, + sizeof(msg.nan_reason), &status); + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventTransmitFollowup(msg.id, status).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_data_path_request = + [weak_ptr_this](const legacy_hal::NanDataPathRequestInd& msg) { + const auto shared_ptr_this = weak_ptr_this.promote(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanDataPathRequestInd hidl_struct; + if (!hidl_struct_util::convertLegacyNanDataPathRequestIndToHidl(msg, + &hidl_struct)) { + LOG(ERROR) << "Failed to convert nan capabilities response"; + return; + } + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventDataPathRequest(hidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_data_path_confirm = + [weak_ptr_this](const legacy_hal::NanDataPathConfirmInd& msg) { + const auto shared_ptr_this = weak_ptr_this.promote(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + V1_6::NanDataPathConfirmInd hidl_struct; + if (!hidl_struct_util::convertLegacyNanDataPathConfirmIndToHidl(msg, + &hidl_struct)) { + LOG(ERROR) << "Failed to convert nan capabilities response"; + return; + } + + for (const auto& callback : shared_ptr_this->getEventCallbacks_1_6()) { + if (!callback->eventDataPathConfirm_1_6(hidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_data_path_end = + [weak_ptr_this](const legacy_hal::NanDataPathEndInd& msg) { + const auto shared_ptr_this = weak_ptr_this.promote(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + for (int i = 0; i < msg.num_ndp_instances; ++i) { + if (!callback->eventDataPathTerminated(msg.ndp_instance_id[i]).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + } + }; + + callback_handlers.on_event_beacon_sdf_payload = + [weak_ptr_this](const legacy_hal::NanBeaconSdfPayloadInd& /* msg */) { + LOG(ERROR) << "on_event_beacon_sdf_payload - should not be called"; + }; + + callback_handlers.on_event_range_request = + [weak_ptr_this](const legacy_hal::NanRangeRequestInd& /* msg */) { + LOG(ERROR) << "on_event_range_request - should not be called"; + }; + + callback_handlers.on_event_range_report = + [weak_ptr_this](const legacy_hal::NanRangeReportInd& /* msg */) { + LOG(ERROR) << "on_event_range_report - should not be called"; + }; + + callback_handlers.on_event_schedule_update = + [weak_ptr_this](const legacy_hal::NanDataPathScheduleUpdateInd& msg) { + const auto shared_ptr_this = weak_ptr_this.promote(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + V1_6::NanDataPathScheduleUpdateInd hidl_struct; + if (!hidl_struct_util::convertLegacyNanDataPathScheduleUpdateIndToHidl( + msg, &hidl_struct)) { + LOG(ERROR) << "Failed to convert nan capabilities response"; + return; + } + + for (const auto& callback : shared_ptr_this->getEventCallbacks_1_6()) { + if (!callback->eventDataPathScheduleUpdate_1_6(hidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanRegisterCallbackHandlers(ifname_, callback_handlers); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to register nan callbacks. Invalidating object"; + invalidate(); + } + + // Register for iface state toggle events. + iface_util::IfaceEventHandlers event_handlers = {}; + event_handlers.on_state_toggle_off_on = [weak_ptr_this](const std::string& /* iface_name */) { + const auto shared_ptr_this = weak_ptr_this.promote(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + // Tell framework that NAN has been disabled. + WifiNanStatus status = {NanStatusType::UNSUPPORTED_CONCURRENCY_NAN_DISABLED, ""}; + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventDisabled(status).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + iface_util_.lock()->registerIfaceEventHandlers(ifname_, event_handlers); +} + +void WifiNanIface::invalidate() { + if (!isValid()) { + return; + } + // send commands to HAL to actually disable and destroy interfaces + legacy_hal_.lock()->nanDisableRequest(ifname_, 0xFFFF); + legacy_hal_.lock()->nanDataInterfaceDelete(ifname_, 0xFFFE, "aware_data0"); + legacy_hal_.lock()->nanDataInterfaceDelete(ifname_, 0xFFFD, "aware_data1"); + iface_util_.lock()->unregisterIfaceEventHandlers(ifname_); + legacy_hal_.reset(); + event_cb_handler_.invalidate(); + event_cb_handler_1_2_.invalidate(); + event_cb_handler_1_5_.invalidate(); + is_valid_ = false; + if (is_dedicated_iface_) { + // If using a dedicated iface, set the iface down. + iface_util_.lock()->setUpState(ifname_, false); + } +} + +bool WifiNanIface::isValid() { + return is_valid_; +} + +std::string WifiNanIface::getName() { + return ifname_; +} + +std::set> WifiNanIface::getEventCallbacks() { + return event_cb_handler_.getCallbacks(); +} + +std::set> WifiNanIface::getEventCallbacks_1_2() { + return event_cb_handler_1_2_.getCallbacks(); +} + +std::set> WifiNanIface::getEventCallbacks_1_5() { + return event_cb_handler_1_5_.getCallbacks(); +} + +std::set> WifiNanIface::getEventCallbacks_1_6() { + return event_cb_handler_1_6_.getCallbacks(); +} + +Return WifiNanIface::getName(getName_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::getNameInternal, hidl_status_cb); +} + +Return WifiNanIface::getType(getType_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::getTypeInternal, hidl_status_cb); +} + +Return WifiNanIface::registerEventCallback( + const sp& callback, + registerEventCallback_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::registerEventCallbackInternal, hidl_status_cb, callback); +} + +Return WifiNanIface::getCapabilitiesRequest(uint16_t cmd_id, + getCapabilitiesRequest_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::getCapabilitiesRequestInternal, hidl_status_cb, cmd_id); +} + +Return WifiNanIface::enableRequest(uint16_t cmd_id, const V1_0::NanEnableRequest& msg, + enableRequest_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::enableRequestInternal, hidl_status_cb, cmd_id, msg); +} + +Return WifiNanIface::configRequest(uint16_t cmd_id, const V1_0::NanConfigRequest& msg, + configRequest_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::configRequestInternal, hidl_status_cb, cmd_id, msg); +} + +Return WifiNanIface::disableRequest(uint16_t cmd_id, disableRequest_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::disableRequestInternal, hidl_status_cb, cmd_id); +} + +Return WifiNanIface::startPublishRequest(uint16_t cmd_id, const V1_0::NanPublishRequest& msg, + startPublishRequest_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::startPublishRequestInternal, hidl_status_cb, cmd_id, msg); +} + +Return WifiNanIface::stopPublishRequest(uint16_t cmd_id, uint8_t sessionId, + stopPublishRequest_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::stopPublishRequestInternal, hidl_status_cb, cmd_id, + sessionId); +} + +Return WifiNanIface::startSubscribeRequest(uint16_t cmd_id, + const V1_0::NanSubscribeRequest& msg, + startSubscribeRequest_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::startSubscribeRequestInternal, hidl_status_cb, cmd_id, + msg); +} + +Return WifiNanIface::stopSubscribeRequest(uint16_t cmd_id, uint8_t sessionId, + stopSubscribeRequest_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::stopSubscribeRequestInternal, hidl_status_cb, cmd_id, + sessionId); +} + +Return WifiNanIface::transmitFollowupRequest(uint16_t cmd_id, + const NanTransmitFollowupRequest& msg, + transmitFollowupRequest_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::transmitFollowupRequestInternal, hidl_status_cb, cmd_id, + msg); +} + +Return WifiNanIface::createDataInterfaceRequest( + uint16_t cmd_id, const hidl_string& iface_name, + createDataInterfaceRequest_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::createDataInterfaceRequestInternal, hidl_status_cb, + cmd_id, iface_name); +} + +Return WifiNanIface::deleteDataInterfaceRequest( + uint16_t cmd_id, const hidl_string& iface_name, + deleteDataInterfaceRequest_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::deleteDataInterfaceRequestInternal, hidl_status_cb, + cmd_id, iface_name); +} + +Return WifiNanIface::initiateDataPathRequest(uint16_t cmd_id, + const V1_0::NanInitiateDataPathRequest& msg, + initiateDataPathRequest_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::initiateDataPathRequestInternal, hidl_status_cb, cmd_id, + msg); +} + +Return WifiNanIface::respondToDataPathIndicationRequest( + uint16_t cmd_id, const V1_0::NanRespondToDataPathIndicationRequest& msg, + respondToDataPathIndicationRequest_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::respondToDataPathIndicationRequestInternal, + hidl_status_cb, cmd_id, msg); +} + +Return WifiNanIface::terminateDataPathRequest(uint16_t cmd_id, uint32_t ndpInstanceId, + terminateDataPathRequest_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::terminateDataPathRequestInternal, hidl_status_cb, cmd_id, + ndpInstanceId); +} + +Return WifiNanIface::registerEventCallback_1_2( + const sp& callback, + registerEventCallback_1_2_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::registerEventCallback_1_2Internal, hidl_status_cb, + callback); +} + +Return WifiNanIface::enableRequest_1_2(uint16_t cmd_id, const V1_0::NanEnableRequest& msg1, + const V1_2::NanConfigRequestSupplemental& msg2, + enableRequest_1_2_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::enableRequest_1_2Internal, hidl_status_cb, cmd_id, msg1, + msg2); +} + +Return WifiNanIface::configRequest_1_2(uint16_t cmd_id, const V1_0::NanConfigRequest& msg1, + const V1_2::NanConfigRequestSupplemental& msg2, + configRequest_1_2_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::configRequest_1_2Internal, hidl_status_cb, cmd_id, msg1, + msg2); +} + +Return WifiNanIface::enableRequest_1_4(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, + const V1_2::NanConfigRequestSupplemental& msg2, + enableRequest_1_4_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::enableRequest_1_4Internal, hidl_status_cb, cmd_id, msg1, + msg2); +} + +Return WifiNanIface::configRequest_1_4(uint16_t cmd_id, const V1_4::NanConfigRequest& msg1, + const V1_2::NanConfigRequestSupplemental& msg2, + configRequest_1_4_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::configRequest_1_4Internal, hidl_status_cb, cmd_id, msg1, + msg2); +} + +Return WifiNanIface::registerEventCallback_1_5( + const sp& callback, + registerEventCallback_1_5_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::registerEventCallback_1_5Internal, hidl_status_cb, + callback); +} + +Return WifiNanIface::enableRequest_1_5(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, + const V1_5::NanConfigRequestSupplemental& msg2, + enableRequest_1_5_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::enableRequest_1_5Internal, hidl_status_cb, cmd_id, msg1, + msg2); +} + +Return WifiNanIface::configRequest_1_5(uint16_t cmd_id, const V1_4::NanConfigRequest& msg1, + const V1_5::NanConfigRequestSupplemental& msg2, + configRequest_1_5_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::configRequest_1_5Internal, hidl_status_cb, cmd_id, msg1, + msg2); +} + +Return WifiNanIface::getCapabilitiesRequest_1_5( + uint16_t cmd_id, getCapabilitiesRequest_1_5_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::getCapabilitiesRequest_1_5Internal, hidl_status_cb, + cmd_id); +} + +Return WifiNanIface::enableRequest_1_6(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, + const V1_6::NanConfigRequestSupplemental& msg2, + enableRequest_1_5_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::enableRequest_1_6Internal, hidl_status_cb, cmd_id, msg1, + msg2); +} + +Return WifiNanIface::configRequest_1_6(uint16_t cmd_id, const V1_4::NanConfigRequest& msg1, + const V1_6::NanConfigRequestSupplemental& msg2, + configRequest_1_5_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::configRequest_1_6Internal, hidl_status_cb, cmd_id, msg1, + msg2); +} + +Return WifiNanIface::initiateDataPathRequest_1_6(uint16_t cmd_id, + const V1_6::NanInitiateDataPathRequest& msg, + initiateDataPathRequest_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::initiateDataPathRequest_1_6Internal, hidl_status_cb, + cmd_id, msg); +} + +Return WifiNanIface::respondToDataPathIndicationRequest_1_6( + uint16_t cmd_id, const V1_6::NanRespondToDataPathIndicationRequest& msg, + respondToDataPathIndicationRequest_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::respondToDataPathIndicationRequest_1_6Internal, + hidl_status_cb, cmd_id, msg); +} + +Return WifiNanIface::startPublishRequest_1_6(uint16_t cmd_id, + const V1_6::NanPublishRequest& msg, + startPublishRequest_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::startPublishRequest_1_6Internal, hidl_status_cb, cmd_id, + msg); +} + +std::pair WifiNanIface::getNameInternal() { + return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_}; +} + +std::pair WifiNanIface::getTypeInternal() { + return {createWifiStatus(WifiStatusCode::SUCCESS), IfaceType::NAN}; +} + +Return WifiNanIface::registerEventCallback_1_6( + const sp& callback, + registerEventCallback_1_6_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::registerEventCallback_1_6Internal, hidl_status_cb, + callback); +} + +WifiStatus WifiNanIface::registerEventCallbackInternal( + const sp& callback) { + if (!event_cb_handler_.addCallback(callback)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + return createWifiStatus(WifiStatusCode::SUCCESS); +} + +WifiStatus WifiNanIface::getCapabilitiesRequestInternal(uint16_t /* cmd_id */) { + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + +WifiStatus WifiNanIface::enableRequestInternal(uint16_t /* cmd_id */, + const V1_0::NanEnableRequest& /* msg */) { + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + +WifiStatus WifiNanIface::configRequestInternal(uint16_t /* cmd_id */, + const V1_0::NanConfigRequest& /* msg */) { + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + +WifiStatus WifiNanIface::disableRequestInternal(uint16_t cmd_id) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->nanDisableRequest(ifname_, cmd_id); + return createWifiStatusFromLegacyError(legacy_status); +} + +WifiStatus WifiNanIface::startPublishRequestInternal(uint16_t /* cmd_id */, + const V1_0::NanPublishRequest& /* msg */) { + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + +WifiStatus WifiNanIface::stopPublishRequestInternal(uint16_t cmd_id, uint8_t sessionId) { + legacy_hal::NanPublishCancelRequest legacy_msg; + legacy_msg.publish_id = sessionId; + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanPublishCancelRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} + +WifiStatus WifiNanIface::startSubscribeRequestInternal(uint16_t cmd_id, + const V1_0::NanSubscribeRequest& msg) { + legacy_hal::NanSubscribeRequest legacy_msg; + if (!hidl_struct_util::convertHidlNanSubscribeRequestToLegacy(msg, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanSubscribeRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} + +WifiStatus WifiNanIface::stopSubscribeRequestInternal(uint16_t cmd_id, uint8_t sessionId) { + legacy_hal::NanSubscribeCancelRequest legacy_msg; + legacy_msg.subscribe_id = sessionId; + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanSubscribeCancelRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} + +WifiStatus WifiNanIface::transmitFollowupRequestInternal(uint16_t cmd_id, + const NanTransmitFollowupRequest& msg) { + legacy_hal::NanTransmitFollowupRequest legacy_msg; + if (!hidl_struct_util::convertHidlNanTransmitFollowupRequestToLegacy(msg, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanTransmitFollowupRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} + +WifiStatus WifiNanIface::createDataInterfaceRequestInternal(uint16_t cmd_id, + const std::string& iface_name) { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanDataInterfaceCreate(ifname_, cmd_id, iface_name); + return createWifiStatusFromLegacyError(legacy_status); +} +WifiStatus WifiNanIface::deleteDataInterfaceRequestInternal(uint16_t cmd_id, + const std::string& iface_name) { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanDataInterfaceDelete(ifname_, cmd_id, iface_name); + return createWifiStatusFromLegacyError(legacy_status); +} +WifiStatus WifiNanIface::initiateDataPathRequestInternal( + uint16_t cmd_id, const V1_0::NanInitiateDataPathRequest& msg) { + legacy_hal::NanDataPathInitiatorRequest legacy_msg; + if (!hidl_struct_util::convertHidlNanDataPathInitiatorRequestToLegacy(msg, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanDataRequestInitiator(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} +WifiStatus WifiNanIface::respondToDataPathIndicationRequestInternal( + uint16_t cmd_id, const V1_0::NanRespondToDataPathIndicationRequest& msg) { + legacy_hal::NanDataPathIndicationResponse legacy_msg; + if (!hidl_struct_util::convertHidlNanDataPathIndicationResponseToLegacy(msg, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanDataIndicationResponse(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} +WifiStatus WifiNanIface::terminateDataPathRequestInternal(uint16_t cmd_id, uint32_t ndpInstanceId) { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanDataEnd(ifname_, cmd_id, ndpInstanceId); + return createWifiStatusFromLegacyError(legacy_status); +} + +WifiStatus WifiNanIface::registerEventCallback_1_2Internal( + const sp& callback) { + sp callback_1_0 = callback; + if (!event_cb_handler_.addCallback(callback_1_0)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + if (!event_cb_handler_1_2_.addCallback(callback)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + return createWifiStatus(WifiStatusCode::SUCCESS); +} + +WifiStatus WifiNanIface::enableRequest_1_2Internal( + uint16_t /* cmd_id */, const V1_0::NanEnableRequest& /* msg1 */, + const V1_2::NanConfigRequestSupplemental& /* msg2 */) { + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + +WifiStatus WifiNanIface::configRequest_1_2Internal( + uint16_t /* cmd_id */, const V1_0::NanConfigRequest& /* msg1 */, + const V1_2::NanConfigRequestSupplemental& /* msg2 */) { + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + +WifiStatus WifiNanIface::enableRequest_1_4Internal( + uint16_t /* cmd_id */, const V1_4::NanEnableRequest& /* msg1 */, + const V1_2::NanConfigRequestSupplemental& /* msg2 */) { + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + +WifiStatus WifiNanIface::configRequest_1_4Internal( + uint16_t /* cmd_id */, const V1_4::NanConfigRequest& /* msg1 */, + const V1_2::NanConfigRequestSupplemental& /* msg2 */) { + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + +WifiStatus WifiNanIface::registerEventCallback_1_5Internal( + const sp& callback) { + sp callback_1_0 = callback; + if (!event_cb_handler_.addCallback(callback_1_0)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + sp callback_1_2 = callback; + if (!event_cb_handler_1_2_.addCallback(callback_1_2)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + if (!event_cb_handler_1_5_.addCallback(callback)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + return createWifiStatus(WifiStatusCode::SUCCESS); +} + +WifiStatus WifiNanIface::getCapabilitiesRequest_1_5Internal(uint16_t cmd_id) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->nanGetCapabilities(ifname_, cmd_id); + return createWifiStatusFromLegacyError(legacy_status); +} + +WifiStatus WifiNanIface::enableRequest_1_5Internal( + uint16_t /* cmd_id */, const V1_4::NanEnableRequest& /* msg1 */, + const V1_5::NanConfigRequestSupplemental& /* msg2 */) { + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + +WifiStatus WifiNanIface::configRequest_1_5Internal( + uint16_t /* cmd_id */, const V1_4::NanConfigRequest& /* msg1 */, + const V1_5::NanConfigRequestSupplemental& /* msg2 */) { + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + +WifiStatus WifiNanIface::enableRequest_1_6Internal(uint16_t cmd_id, + const V1_4::NanEnableRequest& msg1, + const V1_6::NanConfigRequestSupplemental& msg2) { + legacy_hal::NanEnableRequest legacy_msg; + if (!hidl_struct_util::convertHidlNanEnableRequest_1_6ToLegacy(msg1, msg2, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanEnableRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} + +WifiStatus WifiNanIface::configRequest_1_6Internal(uint16_t cmd_id, + const V1_4::NanConfigRequest& msg1, + const V1_6::NanConfigRequestSupplemental& msg2) { + legacy_hal::NanConfigRequest legacy_msg; + if (!hidl_struct_util::convertHidlNanConfigRequest_1_6ToLegacy(msg1, msg2, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanConfigRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} + +WifiStatus WifiNanIface::initiateDataPathRequest_1_6Internal( + uint16_t cmd_id, const V1_6::NanInitiateDataPathRequest& msg) { + legacy_hal::NanDataPathInitiatorRequest legacy_msg; + if (!hidl_struct_util::convertHidlNanDataPathInitiatorRequest_1_6ToLegacy(msg, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanDataRequestInitiator(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} + +WifiStatus WifiNanIface::respondToDataPathIndicationRequest_1_6Internal( + uint16_t cmd_id, const V1_6::NanRespondToDataPathIndicationRequest& msg) { + legacy_hal::NanDataPathIndicationResponse legacy_msg; + if (!hidl_struct_util::convertHidlNanDataPathIndicationResponse_1_6ToLegacy(msg, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanDataIndicationResponse(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} + +WifiStatus WifiNanIface::startPublishRequest_1_6Internal(uint16_t cmd_id, + const V1_6::NanPublishRequest& msg) { + legacy_hal::NanPublishRequest legacy_msg; + if (!hidl_struct_util::convertHidlNanPublishRequestToLegacy(msg, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanPublishRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} + +WifiStatus WifiNanIface::registerEventCallback_1_6Internal( + const sp& callback) { + sp callback_1_0 = callback; + if (!event_cb_handler_.addCallback(callback_1_0)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + sp callback_1_2 = callback; + if (!event_cb_handler_1_2_.addCallback(callback_1_2)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + sp callback_1_5 = callback; + if (!event_cb_handler_1_5_.addCallback(callback_1_5)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + if (!event_cb_handler_1_6_.addCallback(callback)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + return createWifiStatus(WifiStatusCode::SUCCESS); +} +} // namespace implementation +} // namespace V1_6 +} // namespace wifi +} // namespace hardware +} // namespace android diff --git a/wifi/1.6/default/wifi_nan_iface.h b/wifi/1.6/default/wifi_nan_iface.h new file mode 100644 index 0000000000..15bf57298c --- /dev/null +++ b/wifi/1.6/default/wifi_nan_iface.h @@ -0,0 +1,208 @@ +/* + * Copyright (C) 2016 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. + */ + +#ifndef WIFI_NAN_IFACE_H_ +#define WIFI_NAN_IFACE_H_ + +#include +#include +#include + +#include "hidl_callback_util.h" +#include "wifi_iface_util.h" +#include "wifi_legacy_hal.h" + +namespace android { +namespace hardware { +namespace wifi { +namespace V1_6 { +namespace implementation { +using namespace android::hardware::wifi::V1_0; +using namespace android::hardware::wifi::V1_2; +using namespace android::hardware::wifi::V1_4; +using namespace android::hardware::wifi::V1_6; + +/** + * HIDL interface object used to control a NAN Iface instance. + */ +class WifiNanIface : public V1_6::IWifiNanIface { + public: + WifiNanIface(const std::string& ifname, bool is_dedicated_iface, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util); + // Refer to |WifiChip::invalidate()|. + void invalidate(); + bool isValid(); + std::string getName(); + + // HIDL methods exposed. + Return getName(getName_cb hidl_status_cb) override; + Return getType(getType_cb hidl_status_cb) override; + Return registerEventCallback(const sp& callback, + registerEventCallback_cb hidl_status_cb) override; + Return getCapabilitiesRequest(uint16_t cmd_id, + getCapabilitiesRequest_cb hidl_status_cb) override; + Return enableRequest(uint16_t cmd_id, const V1_0::NanEnableRequest& msg, + enableRequest_cb hidl_status_cb) override; + Return configRequest(uint16_t cmd_id, const V1_0::NanConfigRequest& msg, + configRequest_cb hidl_status_cb) override; + Return disableRequest(uint16_t cmd_id, disableRequest_cb hidl_status_cb) override; + Return startPublishRequest(uint16_t cmd_id, const V1_0::NanPublishRequest& msg, + startPublishRequest_cb hidl_status_cb) override; + Return stopPublishRequest(uint16_t cmd_id, uint8_t sessionId, + stopPublishRequest_cb hidl_status_cb) override; + Return startSubscribeRequest(uint16_t cmd_id, const V1_0::NanSubscribeRequest& msg, + startSubscribeRequest_cb hidl_status_cb) override; + Return stopSubscribeRequest(uint16_t cmd_id, uint8_t sessionId, + stopSubscribeRequest_cb hidl_status_cb) override; + Return transmitFollowupRequest(uint16_t cmd_id, const NanTransmitFollowupRequest& msg, + transmitFollowupRequest_cb hidl_status_cb) override; + Return createDataInterfaceRequest(uint16_t cmd_id, const hidl_string& iface_name, + createDataInterfaceRequest_cb hidl_status_cb) override; + Return deleteDataInterfaceRequest(uint16_t cmd_id, const hidl_string& iface_name, + deleteDataInterfaceRequest_cb hidl_status_cb) override; + Return initiateDataPathRequest(uint16_t cmd_id, + const V1_0::NanInitiateDataPathRequest& msg, + initiateDataPathRequest_cb hidl_status_cb) override; + Return respondToDataPathIndicationRequest( + uint16_t cmd_id, const V1_0::NanRespondToDataPathIndicationRequest& msg, + respondToDataPathIndicationRequest_cb hidl_status_cb) override; + Return terminateDataPathRequest(uint16_t cmd_id, uint32_t ndpInstanceId, + terminateDataPathRequest_cb hidl_status_cb) override; + + Return registerEventCallback_1_2(const sp& callback, + registerEventCallback_1_2_cb hidl_status_cb) override; + Return enableRequest_1_2(uint16_t cmd_id, const V1_0::NanEnableRequest& msg1, + const V1_2::NanConfigRequestSupplemental& msg2, + enableRequest_1_2_cb hidl_status_cb) override; + Return configRequest_1_2(uint16_t cmd_id, const V1_0::NanConfigRequest& msg1, + const V1_2::NanConfigRequestSupplemental& msg2, + configRequest_1_2_cb hidl_status_cb) override; + Return enableRequest_1_4(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, + const V1_2::NanConfigRequestSupplemental& msg2, + enableRequest_1_4_cb hidl_status_cb) override; + Return configRequest_1_4(uint16_t cmd_id, const V1_4::NanConfigRequest& msg1, + const V1_2::NanConfigRequestSupplemental& msg2, + configRequest_1_4_cb hidl_status_cb) override; + Return registerEventCallback_1_5(const sp& callback, + registerEventCallback_1_5_cb hidl_status_cb) override; + Return enableRequest_1_5(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, + const V1_5::NanConfigRequestSupplemental& msg2, + enableRequest_1_5_cb hidl_status_cb) override; + Return configRequest_1_5(uint16_t cmd_id, const V1_4::NanConfigRequest& msg1, + const V1_5::NanConfigRequestSupplemental& msg2, + configRequest_1_5_cb hidl_status_cb) override; + Return getCapabilitiesRequest_1_5(uint16_t cmd_id, + getCapabilitiesRequest_cb hidl_status_cb) override; + Return registerEventCallback_1_6(const sp& callback, + registerEventCallback_1_6_cb hidl_status_cb) override; + Return initiateDataPathRequest_1_6( + uint16_t cmd_id, const V1_6::NanInitiateDataPathRequest& msg, + initiateDataPathRequest_1_6_cb hidl_status_cb) override; + Return respondToDataPathIndicationRequest_1_6( + uint16_t cmd_id, const V1_6::NanRespondToDataPathIndicationRequest& msg, + respondToDataPathIndicationRequest_1_6_cb hidl_status_cb) override; + Return enableRequest_1_6(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, + const V1_6::NanConfigRequestSupplemental& msg2, + enableRequest_1_6_cb hidl_status_cb) override; + Return configRequest_1_6(uint16_t cmd_id, const V1_4::NanConfigRequest& msg1, + const V1_6::NanConfigRequestSupplemental& msg2, + configRequest_1_6_cb hidl_status_cb) override; + Return startPublishRequest_1_6(uint16_t cmd_id, const V1_6::NanPublishRequest& msg, + startPublishRequest_cb hidl_status_cb) override; + + private: + // Corresponding worker functions for the HIDL methods. + std::pair getNameInternal(); + std::pair getTypeInternal(); + WifiStatus registerEventCallbackInternal(const sp& callback); + WifiStatus getCapabilitiesRequestInternal(uint16_t cmd_id); + WifiStatus enableRequestInternal(uint16_t cmd_id, const V1_0::NanEnableRequest& msg); + WifiStatus configRequestInternal(uint16_t cmd_id, const V1_0::NanConfigRequest& msg); + WifiStatus disableRequestInternal(uint16_t cmd_id); + WifiStatus startPublishRequestInternal(uint16_t cmd_id, const V1_0::NanPublishRequest& msg); + WifiStatus stopPublishRequestInternal(uint16_t cmd_id, uint8_t sessionId); + WifiStatus startSubscribeRequestInternal(uint16_t cmd_id, const V1_0::NanSubscribeRequest& msg); + WifiStatus stopSubscribeRequestInternal(uint16_t cmd_id, uint8_t sessionId); + WifiStatus transmitFollowupRequestInternal(uint16_t cmd_id, + const NanTransmitFollowupRequest& msg); + WifiStatus createDataInterfaceRequestInternal(uint16_t cmd_id, const std::string& iface_name); + WifiStatus deleteDataInterfaceRequestInternal(uint16_t cmd_id, const std::string& iface_name); + WifiStatus initiateDataPathRequestInternal(uint16_t cmd_id, + const V1_0::NanInitiateDataPathRequest& msg); + WifiStatus respondToDataPathIndicationRequestInternal( + uint16_t cmd_id, const V1_0::NanRespondToDataPathIndicationRequest& msg); + WifiStatus terminateDataPathRequestInternal(uint16_t cmd_id, uint32_t ndpInstanceId); + + WifiStatus registerEventCallback_1_2Internal( + const sp& callback); + WifiStatus enableRequest_1_2Internal(uint16_t cmd_id, const V1_0::NanEnableRequest& msg1, + const V1_2::NanConfigRequestSupplemental& msg2); + WifiStatus configRequest_1_2Internal(uint16_t cmd_id, const V1_0::NanConfigRequest& msg, + const V1_2::NanConfigRequestSupplemental& msg2); + WifiStatus enableRequest_1_4Internal(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, + const V1_2::NanConfigRequestSupplemental& msg2); + WifiStatus configRequest_1_4Internal(uint16_t cmd_id, const V1_4::NanConfigRequest& msg, + const V1_2::NanConfigRequestSupplemental& msg2); + WifiStatus registerEventCallback_1_5Internal( + const sp& callback); + WifiStatus enableRequest_1_5Internal(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, + const V1_5::NanConfigRequestSupplemental& msg2); + WifiStatus configRequest_1_5Internal(uint16_t cmd_id, const V1_4::NanConfigRequest& msg, + const V1_5::NanConfigRequestSupplemental& msg2); + WifiStatus getCapabilitiesRequest_1_5Internal(uint16_t cmd_id); + WifiStatus registerEventCallback_1_6Internal( + const sp& callback); + + WifiStatus enableRequest_1_6Internal(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, + const V1_6::NanConfigRequestSupplemental& msg2); + WifiStatus configRequest_1_6Internal(uint16_t cmd_id, const V1_4::NanConfigRequest& msg, + const V1_6::NanConfigRequestSupplemental& msg2); + WifiStatus startPublishRequest_1_6Internal(uint16_t cmd_id, const V1_6::NanPublishRequest& msg); + WifiStatus initiateDataPathRequest_1_6Internal(uint16_t cmd_id, + const V1_6::NanInitiateDataPathRequest& msg); + WifiStatus respondToDataPathIndicationRequest_1_6Internal( + uint16_t cmd_id, const V1_6::NanRespondToDataPathIndicationRequest& msg); + + // all 1_0 and descendant callbacks + std::set> getEventCallbacks(); + // all 1_2 and descendant callbacks + std::set> getEventCallbacks_1_2(); + // all 1_5 and descendant callbacks + std::set> getEventCallbacks_1_5(); + // all 1_6 and descendant callbacks + std::set> getEventCallbacks_1_6(); + + std::string ifname_; + bool is_dedicated_iface_; + std::weak_ptr legacy_hal_; + std::weak_ptr iface_util_; + bool is_valid_; + hidl_callback_util::HidlCallbackHandler event_cb_handler_; + hidl_callback_util::HidlCallbackHandler event_cb_handler_1_2_; + hidl_callback_util::HidlCallbackHandler event_cb_handler_1_5_; + hidl_callback_util::HidlCallbackHandler event_cb_handler_1_6_; + + DISALLOW_COPY_AND_ASSIGN(WifiNanIface); +}; + +} // namespace implementation +} // namespace V1_6 +} // namespace wifi +} // namespace hardware +} // namespace android + +#endif // WIFI_NAN_IFACE_H_ diff --git a/wifi/aidl/default/wifi_p2p_iface.cpp b/wifi/1.6/default/wifi_p2p_iface.cpp similarity index 60% rename from wifi/aidl/default/wifi_p2p_iface.cpp rename to wifi/1.6/default/wifi_p2p_iface.cpp index 48ec6d6d87..d4b1fcabf1 100644 --- a/wifi/aidl/default/wifi_p2p_iface.cpp +++ b/wifi/1.6/default/wifi_p2p_iface.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2016 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. @@ -14,18 +14,18 @@ * limitations under the License. */ -#include "wifi_p2p_iface.h" - #include -#include "aidl_return_util.h" +#include "hidl_return_util.h" +#include "wifi_p2p_iface.h" #include "wifi_status_util.h" -namespace aidl { namespace android { namespace hardware { namespace wifi { -using aidl_return_util::validateAndCall; +namespace V1_6 { +namespace implementation { +using hidl_return_util::validateAndCall; WifiP2pIface::WifiP2pIface(const std::string& ifname, const std::weak_ptr legacy_hal) @@ -44,16 +44,26 @@ std::string WifiP2pIface::getName() { return ifname_; } -ndk::ScopedAStatus WifiP2pIface::getName(std::string* _aidl_return) { +Return WifiP2pIface::getName(getName_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiP2pIface::getNameInternal, _aidl_return); + &WifiP2pIface::getNameInternal, hidl_status_cb); } -std::pair WifiP2pIface::getNameInternal() { - return {ifname_, ndk::ScopedAStatus::ok()}; +Return WifiP2pIface::getType(getType_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiP2pIface::getTypeInternal, hidl_status_cb); } +std::pair WifiP2pIface::getNameInternal() { + return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_}; +} + +std::pair WifiP2pIface::getTypeInternal() { + return {createWifiStatus(WifiStatusCode::SUCCESS), IfaceType::P2P}; +} + +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl diff --git a/wifi/aidl/default/wifi_p2p_iface.h b/wifi/1.6/default/wifi_p2p_iface.h similarity index 64% rename from wifi/aidl/default/wifi_p2p_iface.h rename to wifi/1.6/default/wifi_p2p_iface.h index d17470ed23..00894437cf 100644 --- a/wifi/aidl/default/wifi_p2p_iface.h +++ b/wifi/1.6/default/wifi_p2p_iface.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2016 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. @@ -17,20 +17,22 @@ #ifndef WIFI_P2P_IFACE_H_ #define WIFI_P2P_IFACE_H_ -#include #include +#include #include "wifi_legacy_hal.h" -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { +using namespace android::hardware::wifi::V1_0; /** - * AIDL interface object used to control a P2P Iface instance. + * HIDL interface object used to control a P2P Iface instance. */ -class WifiP2pIface : public BnWifiP2pIface { +class WifiP2pIface : public V1_0::IWifiP2pIface { public: WifiP2pIface(const std::string& ifname, const std::weak_ptr legacy_hal); @@ -39,12 +41,14 @@ class WifiP2pIface : public BnWifiP2pIface { bool isValid(); std::string getName(); - // AIDL methods exposed. - ndk::ScopedAStatus getName(std::string* _aidl_return) override; + // HIDL methods exposed. + Return getName(getName_cb hidl_status_cb) override; + Return getType(getType_cb hidl_status_cb) override; private: - // Corresponding worker functions for the AIDL methods. - std::pair getNameInternal(); + // Corresponding worker functions for the HIDL methods. + std::pair getNameInternal(); + std::pair getTypeInternal(); std::string ifname_; std::weak_ptr legacy_hal_; @@ -53,9 +57,10 @@ class WifiP2pIface : public BnWifiP2pIface { DISALLOW_COPY_AND_ASSIGN(WifiP2pIface); }; +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl #endif // WIFI_P2P_IFACE_H_ diff --git a/wifi/1.6/default/wifi_rtt_controller.cpp b/wifi/1.6/default/wifi_rtt_controller.cpp new file mode 100644 index 0000000000..aa9ee2f520 --- /dev/null +++ b/wifi/1.6/default/wifi_rtt_controller.cpp @@ -0,0 +1,377 @@ +/* + * Copyright (C) 2016 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. + */ + +#include + +#include "hidl_return_util.h" +#include "hidl_struct_util.h" +#include "wifi_rtt_controller.h" +#include "wifi_status_util.h" + +namespace android { +namespace hardware { +namespace wifi { +namespace V1_6 { +namespace implementation { +using hidl_return_util::validateAndCall; + +WifiRttController::WifiRttController(const std::string& iface_name, + const sp& bound_iface, + const std::weak_ptr legacy_hal) + : ifname_(iface_name), bound_iface_(bound_iface), legacy_hal_(legacy_hal), is_valid_(true) {} + +void WifiRttController::invalidate() { + legacy_hal_.reset(); + event_callbacks_.clear(); + is_valid_ = false; +} + +bool WifiRttController::isValid() { + return is_valid_; +} + +std::vector> WifiRttController::getEventCallbacks() { + return event_callbacks_; +} + +std::string WifiRttController::getIfaceName() { + return ifname_; +} + +Return WifiRttController::getBoundIface(getBoundIface_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::getBoundIfaceInternal, hidl_status_cb); +} + +Return WifiRttController::registerEventCallback( + const sp& callback, + registerEventCallback_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::registerEventCallbackInternal, hidl_status_cb, + callback); +} + +Return WifiRttController::rangeRequest(uint32_t cmd_id, + const hidl_vec& rtt_configs, + rangeRequest_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::rangeRequestInternal, hidl_status_cb, cmd_id, + rtt_configs); +} + +Return WifiRttController::rangeCancel(uint32_t cmd_id, + const hidl_vec>& addrs, + rangeCancel_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::rangeCancelInternal, hidl_status_cb, cmd_id, addrs); +} + +Return WifiRttController::getCapabilities(getCapabilities_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::getCapabilitiesInternal, hidl_status_cb); +} + +Return WifiRttController::setLci(uint32_t cmd_id, const RttLciInformation& lci, + setLci_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::setLciInternal, hidl_status_cb, cmd_id, lci); +} + +Return WifiRttController::setLcr(uint32_t cmd_id, const RttLcrInformation& lcr, + setLcr_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::setLcrInternal, hidl_status_cb, cmd_id, lcr); +} + +Return WifiRttController::getResponderInfo(getResponderInfo_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::getResponderInfoInternal, hidl_status_cb); +} + +Return WifiRttController::enableResponder(uint32_t cmd_id, + const V1_0::WifiChannelInfo& channel_hint, + uint32_t max_duration_seconds, + const V1_0::RttResponder& info, + enableResponder_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::enableResponderInternal, hidl_status_cb, cmd_id, + channel_hint, max_duration_seconds, info); +} + +Return WifiRttController::disableResponder(uint32_t cmd_id, + disableResponder_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::disableResponderInternal, hidl_status_cb, cmd_id); +} + +Return WifiRttController::registerEventCallback_1_4( + const sp& callback, + registerEventCallback_1_4_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::registerEventCallbackInternal_1_4, hidl_status_cb, + callback); +} + +Return WifiRttController::rangeRequest_1_4(uint32_t cmd_id, + const hidl_vec& rtt_configs, + rangeRequest_1_4_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::rangeRequestInternal_1_4, hidl_status_cb, cmd_id, + rtt_configs); +} + +Return WifiRttController::getCapabilities_1_4(getCapabilities_1_4_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::getCapabilitiesInternal_1_4, hidl_status_cb); +} + +Return WifiRttController::getResponderInfo_1_4(getResponderInfo_1_4_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::getResponderInfoInternal_1_4, hidl_status_cb); +} + +Return WifiRttController::enableResponder_1_4(uint32_t cmd_id, + const V1_0::WifiChannelInfo& channel_hint, + uint32_t max_duration_seconds, + const V1_4::RttResponder& info, + enableResponder_1_4_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::enableResponderInternal_1_4, hidl_status_cb, cmd_id, + channel_hint, max_duration_seconds, info); +} + +Return WifiRttController::registerEventCallback_1_6( + const sp& callback, + registerEventCallback_1_6_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::registerEventCallbackInternal_1_6, hidl_status_cb, + callback); +} + +Return WifiRttController::rangeRequest_1_6(uint32_t cmd_id, + const hidl_vec& rtt_configs, + rangeRequest_1_6_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::rangeRequestInternal_1_6, hidl_status_cb, cmd_id, + rtt_configs); +} + +Return WifiRttController::getCapabilities_1_6(getCapabilities_1_6_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::getCapabilitiesInternal_1_6, hidl_status_cb); +} + +Return WifiRttController::getResponderInfo_1_6(getResponderInfo_1_6_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::getResponderInfoInternal_1_6, hidl_status_cb); +} + +Return WifiRttController::enableResponder_1_6(uint32_t cmd_id, + const V1_6::WifiChannelInfo& channel_hint, + uint32_t max_duration_seconds, + const V1_6::RttResponder& info, + enableResponder_1_6_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::enableResponderInternal_1_6, hidl_status_cb, cmd_id, + channel_hint, max_duration_seconds, info); +} + +std::pair> WifiRttController::getBoundIfaceInternal() { + return {createWifiStatus(WifiStatusCode::SUCCESS), bound_iface_}; +} + +WifiStatus WifiRttController::registerEventCallbackInternal( + const sp& /* callback */) { + // Deprecated support for this api + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + +WifiStatus WifiRttController::rangeRequestInternal( + uint32_t /* cmd_id */, const std::vector& /* rtt_configs */) { + // Deprecated support for this api + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + +WifiStatus WifiRttController::rangeCancelInternal( + uint32_t cmd_id, const std::vector>& addrs) { + std::vector> legacy_addrs; + for (const auto& addr : addrs) { + legacy_addrs.push_back(addr); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->cancelRttRangeRequest(ifname_, cmd_id, legacy_addrs); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair WifiRttController::getCapabilitiesInternal() { + // Deprecated support for this api + return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; +} + +WifiStatus WifiRttController::setLciInternal(uint32_t cmd_id, const RttLciInformation& lci) { + legacy_hal::wifi_lci_information legacy_lci; + if (!hidl_struct_util::convertHidlRttLciInformationToLegacy(lci, &legacy_lci)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->setRttLci(ifname_, cmd_id, legacy_lci); + return createWifiStatusFromLegacyError(legacy_status); +} + +WifiStatus WifiRttController::setLcrInternal(uint32_t cmd_id, const RttLcrInformation& lcr) { + legacy_hal::wifi_lcr_information legacy_lcr; + if (!hidl_struct_util::convertHidlRttLcrInformationToLegacy(lcr, &legacy_lcr)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->setRttLcr(ifname_, cmd_id, legacy_lcr); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair WifiRttController::getResponderInfoInternal() { + // Deprecated support for this api + return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; +} + +WifiStatus WifiRttController::enableResponderInternal( + uint32_t /* cmd_id */, const V1_0::WifiChannelInfo& /* channel_hint */, + uint32_t /* max_duration_seconds */, const V1_0::RttResponder& /* info */) { + // Deprecated support for this api + return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED)}; +} + +WifiStatus WifiRttController::disableResponderInternal(uint32_t cmd_id) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->disableRttResponder(ifname_, cmd_id); + return createWifiStatusFromLegacyError(legacy_status); +} + +WifiStatus WifiRttController::registerEventCallbackInternal_1_4( + const sp& /* callback */) { + // Deprecated support for this api + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + +WifiStatus WifiRttController::rangeRequestInternal_1_4( + uint32_t /* cmd_id */, const std::vector& /* rtt_configs */) { + // Deprecated support for this api + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + +std::pair WifiRttController::getCapabilitiesInternal_1_4() { + // Deprecated support for this api + return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; +} + +std::pair WifiRttController::getResponderInfoInternal_1_4() { + // Deprecated support for this api + return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; +} + +WifiStatus WifiRttController::enableResponderInternal_1_4( + uint32_t /* cmd_id */, const V1_0::WifiChannelInfo& /* channel_hint */, + uint32_t /* max_duration_seconds */, const V1_4::RttResponder& /* info */) { + // Deprecated support for this api + return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED)}; +} + +WifiStatus WifiRttController::registerEventCallbackInternal_1_6( + const sp& callback) { + // TODO(b/31632518): remove the callback when the client is destroyed + event_callbacks_.emplace_back(callback); + return createWifiStatus(WifiStatusCode::SUCCESS); +} + +WifiStatus WifiRttController::rangeRequestInternal_1_6( + uint32_t cmd_id, const std::vector& rtt_configs) { + std::vector legacy_configs; + if (!hidl_struct_util::convertHidlVectorOfRttConfigToLegacy(rtt_configs, &legacy_configs)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + android::wp weak_ptr_this(this); + const auto& on_results_callback = + [weak_ptr_this](legacy_hal::wifi_request_id id, + const std::vector& results) { + const auto shared_ptr_this = weak_ptr_this.promote(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + std::vector hidl_results; + if (!hidl_struct_util::convertLegacyVectorOfRttResultToHidl(results, + &hidl_results)) { + LOG(ERROR) << "Failed to convert rtt results to HIDL structs"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onResults_1_6(id, hidl_results).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startRttRangeRequest( + ifname_, cmd_id, legacy_configs, on_results_callback); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair WifiRttController::getCapabilitiesInternal_1_6() { + legacy_hal::wifi_error legacy_status; + legacy_hal::wifi_rtt_capabilities legacy_caps; + std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getRttCapabilities(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {createWifiStatusFromLegacyError(legacy_status), {}}; + } + V1_6::RttCapabilities hidl_caps; + if (!hidl_struct_util::convertLegacyRttCapabilitiesToHidl(legacy_caps, &hidl_caps)) { + return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; + } + return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps}; +} + +std::pair WifiRttController::getResponderInfoInternal_1_6() { + legacy_hal::wifi_error legacy_status; + legacy_hal::wifi_rtt_responder legacy_responder; + std::tie(legacy_status, legacy_responder) = legacy_hal_.lock()->getRttResponderInfo(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {createWifiStatusFromLegacyError(legacy_status), {}}; + } + V1_6::RttResponder hidl_responder; + if (!hidl_struct_util::convertLegacyRttResponderToHidl(legacy_responder, &hidl_responder)) { + return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; + } + return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_responder}; +} + +WifiStatus WifiRttController::enableResponderInternal_1_6(uint32_t cmd_id, + const V1_6::WifiChannelInfo& channel_hint, + uint32_t max_duration_seconds, + const V1_6::RttResponder& info) { + legacy_hal::wifi_channel_info legacy_channel_info; + if (!hidl_struct_util::convertHidlWifiChannelInfoToLegacy(channel_hint, &legacy_channel_info)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_rtt_responder legacy_responder; + if (!hidl_struct_util::convertHidlRttResponderToLegacy(info, &legacy_responder)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->enableRttResponder( + ifname_, cmd_id, legacy_channel_info, max_duration_seconds, legacy_responder); + return createWifiStatusFromLegacyError(legacy_status); +} +} // namespace implementation +} // namespace V1_6 +} // namespace wifi +} // namespace hardware +} // namespace android diff --git a/wifi/1.6/default/wifi_rtt_controller.h b/wifi/1.6/default/wifi_rtt_controller.h new file mode 100644 index 0000000000..fd5f68b6a8 --- /dev/null +++ b/wifi/1.6/default/wifi_rtt_controller.h @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2016 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. + */ + +#ifndef WIFI_RTT_CONTROLLER_H_ +#define WIFI_RTT_CONTROLLER_H_ + +#include +#include +#include +#include + +#include "wifi_legacy_hal.h" + +namespace android { +namespace hardware { +namespace wifi { +namespace V1_6 { +namespace implementation { + +/** + * HIDL interface object used to control all RTT operations. + */ +class WifiRttController : public V1_6::IWifiRttController { + public: + WifiRttController(const std::string& iface_name, const sp& bound_iface, + const std::weak_ptr legacy_hal); + // Refer to |WifiChip::invalidate()|. + void invalidate(); + bool isValid(); + std::vector> getEventCallbacks(); + std::string getIfaceName(); + + // HIDL methods exposed. + Return getBoundIface(getBoundIface_cb hidl_status_cb) override; + Return registerEventCallback(const sp& callback, + registerEventCallback_cb hidl_status_cb) override; + Return rangeRequest(uint32_t cmd_id, const hidl_vec& rtt_configs, + rangeRequest_cb hidl_status_cb) override; + Return rangeCancel(uint32_t cmd_id, const hidl_vec>& addrs, + rangeCancel_cb hidl_status_cb) override; + Return getCapabilities(getCapabilities_cb hidl_status_cb) override; + Return setLci(uint32_t cmd_id, const RttLciInformation& lci, + setLci_cb hidl_status_cb) override; + Return setLcr(uint32_t cmd_id, const RttLcrInformation& lcr, + setLcr_cb hidl_status_cb) override; + Return getResponderInfo(getResponderInfo_cb hidl_status_cb) override; + Return enableResponder(uint32_t cmd_id, const V1_0::WifiChannelInfo& channel_hint, + uint32_t max_duration_seconds, const V1_0::RttResponder& info, + enableResponder_cb hidl_status_cb) override; + Return disableResponder(uint32_t cmd_id, disableResponder_cb hidl_status_cb) override; + Return registerEventCallback_1_4( + const sp& callback, + registerEventCallback_1_4_cb hidl_status_cb) override; + Return rangeRequest_1_4(uint32_t cmd_id, const hidl_vec& rtt_configs, + rangeRequest_1_4_cb hidl_status_cb) override; + Return getCapabilities_1_4(getCapabilities_1_4_cb hidl_status_cb) override; + Return getResponderInfo_1_4(getResponderInfo_1_4_cb hidl_status_cb) override; + Return enableResponder_1_4(uint32_t cmd_id, const V1_0::WifiChannelInfo& channel_hint, + uint32_t max_duration_seconds, const V1_4::RttResponder& info, + enableResponder_1_4_cb hidl_status_cb) override; + Return registerEventCallback_1_6( + const sp& callback, + registerEventCallback_1_6_cb hidl_status_cb) override; + Return rangeRequest_1_6(uint32_t cmd_id, const hidl_vec& rtt_configs, + rangeRequest_1_6_cb hidl_status_cb) override; + Return getCapabilities_1_6(getCapabilities_1_6_cb hidl_status_cb) override; + Return getResponderInfo_1_6(getResponderInfo_1_6_cb hidl_status_cb) override; + Return enableResponder_1_6(uint32_t cmd_id, const V1_6::WifiChannelInfo& channel_hint, + uint32_t max_duration_seconds, const V1_6::RttResponder& info, + enableResponder_1_6_cb hidl_status_cb) override; + + private: + // Corresponding worker functions for the HIDL methods. + std::pair> getBoundIfaceInternal(); + WifiStatus registerEventCallbackInternal( + const sp& callback); + WifiStatus rangeRequestInternal(uint32_t cmd_id, + const std::vector& rtt_configs); + WifiStatus rangeCancelInternal(uint32_t cmd_id, + const std::vector>& addrs); + std::pair getCapabilitiesInternal(); + WifiStatus setLciInternal(uint32_t cmd_id, const RttLciInformation& lci); + WifiStatus setLcrInternal(uint32_t cmd_id, const RttLcrInformation& lcr); + std::pair getResponderInfoInternal(); + WifiStatus enableResponderInternal(uint32_t cmd_id, const V1_0::WifiChannelInfo& channel_hint, + uint32_t max_duration_seconds, + const V1_0::RttResponder& info); + WifiStatus disableResponderInternal(uint32_t cmd_id); + WifiStatus registerEventCallbackInternal_1_4( + const sp& callback); + WifiStatus rangeRequestInternal_1_4(uint32_t cmd_id, + const std::vector& rtt_configs); + std::pair getCapabilitiesInternal_1_4(); + std::pair getResponderInfoInternal_1_4(); + WifiStatus enableResponderInternal_1_4(uint32_t cmd_id, + const V1_0::WifiChannelInfo& channel_hint, + uint32_t max_duration_seconds, + const V1_4::RttResponder& info); + WifiStatus registerEventCallbackInternal_1_6( + const sp& callback); + WifiStatus rangeRequestInternal_1_6(uint32_t cmd_id, + const std::vector& rtt_configs); + std::pair getCapabilitiesInternal_1_6(); + std::pair getResponderInfoInternal_1_6(); + WifiStatus enableResponderInternal_1_6(uint32_t cmd_id, + const V1_6::WifiChannelInfo& channel_hint, + uint32_t max_duration_seconds, + const V1_6::RttResponder& info); + + std::string ifname_; + sp bound_iface_; + std::weak_ptr legacy_hal_; + std::vector> event_callbacks_; + bool is_valid_; + + DISALLOW_COPY_AND_ASSIGN(WifiRttController); +}; + +} // namespace implementation +} // namespace V1_6 +} // namespace wifi +} // namespace hardware +} // namespace android + +#endif // WIFI_RTT_CONTROLLER_H_ diff --git a/wifi/1.6/default/wifi_sta_iface.cpp b/wifi/1.6/default/wifi_sta_iface.cpp new file mode 100644 index 0000000000..dd11839c97 --- /dev/null +++ b/wifi/1.6/default/wifi_sta_iface.cpp @@ -0,0 +1,592 @@ +/* + * Copyright (C) 2016 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. + */ + +#include + +#include "hidl_return_util.h" +#include "hidl_struct_util.h" +#include "wifi_sta_iface.h" +#include "wifi_status_util.h" + +namespace android { +namespace hardware { +namespace wifi { +namespace V1_6 { +namespace implementation { +using hidl_return_util::validateAndCall; + +WifiStaIface::WifiStaIface(const std::string& ifname, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util) + : ifname_(ifname), legacy_hal_(legacy_hal), iface_util_(iface_util), is_valid_(true) { + // Turn on DFS channel usage for STA iface. + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->setDfsFlag(ifname_, true); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to set DFS flag; DFS channels may be unavailable."; + } +} + +void WifiStaIface::invalidate() { + legacy_hal_.reset(); + event_cb_handler_.invalidate(); + is_valid_ = false; +} + +bool WifiStaIface::isValid() { + return is_valid_; +} + +std::string WifiStaIface::getName() { + return ifname_; +} + +std::set> WifiStaIface::getEventCallbacks() { + return event_cb_handler_.getCallbacks(); +} + +Return WifiStaIface::getName(getName_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getNameInternal, hidl_status_cb); +} + +Return WifiStaIface::getType(getType_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getTypeInternal, hidl_status_cb); +} + +Return WifiStaIface::registerEventCallback(const sp& callback, + registerEventCallback_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::registerEventCallbackInternal, hidl_status_cb, callback); +} + +Return WifiStaIface::getCapabilities(getCapabilities_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getCapabilitiesInternal, hidl_status_cb); +} + +Return WifiStaIface::getApfPacketFilterCapabilities( + getApfPacketFilterCapabilities_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getApfPacketFilterCapabilitiesInternal, hidl_status_cb); +} + +Return WifiStaIface::installApfPacketFilter(uint32_t cmd_id, const hidl_vec& program, + installApfPacketFilter_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::installApfPacketFilterInternal, hidl_status_cb, cmd_id, + program); +} + +Return WifiStaIface::readApfPacketFilterData(readApfPacketFilterData_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::readApfPacketFilterDataInternal, hidl_status_cb); +} + +Return WifiStaIface::getBackgroundScanCapabilities( + getBackgroundScanCapabilities_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getBackgroundScanCapabilitiesInternal, hidl_status_cb); +} + +Return WifiStaIface::getValidFrequenciesForBand( + V1_0::WifiBand band, getValidFrequenciesForBand_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getValidFrequenciesForBandInternal, hidl_status_cb, band); +} + +Return WifiStaIface::startBackgroundScan(uint32_t cmd_id, + const StaBackgroundScanParameters& params, + startBackgroundScan_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::startBackgroundScanInternal, hidl_status_cb, cmd_id, + params); +} + +Return WifiStaIface::stopBackgroundScan(uint32_t cmd_id, + stopBackgroundScan_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::stopBackgroundScanInternal, hidl_status_cb, cmd_id); +} + +Return WifiStaIface::enableLinkLayerStatsCollection( + bool debug, enableLinkLayerStatsCollection_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::enableLinkLayerStatsCollectionInternal, hidl_status_cb, + debug); +} + +Return WifiStaIface::disableLinkLayerStatsCollection( + disableLinkLayerStatsCollection_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::disableLinkLayerStatsCollectionInternal, hidl_status_cb); +} + +Return WifiStaIface::getLinkLayerStats(getLinkLayerStats_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getLinkLayerStatsInternal, hidl_status_cb); +} + +Return WifiStaIface::getLinkLayerStats_1_3(getLinkLayerStats_1_3_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getLinkLayerStatsInternal_1_3, hidl_status_cb); +} + +Return WifiStaIface::getLinkLayerStats_1_5(getLinkLayerStats_1_5_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getLinkLayerStatsInternal_1_5, hidl_status_cb); +} + +Return WifiStaIface::getLinkLayerStats_1_6(getLinkLayerStats_1_6_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getLinkLayerStatsInternal_1_6, hidl_status_cb); +} + +Return WifiStaIface::startRssiMonitoring(uint32_t cmd_id, int32_t max_rssi, int32_t min_rssi, + startRssiMonitoring_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::startRssiMonitoringInternal, hidl_status_cb, cmd_id, + max_rssi, min_rssi); +} + +Return WifiStaIface::stopRssiMonitoring(uint32_t cmd_id, + stopRssiMonitoring_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::stopRssiMonitoringInternal, hidl_status_cb, cmd_id); +} + +Return WifiStaIface::getRoamingCapabilities(getRoamingCapabilities_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getRoamingCapabilitiesInternal, hidl_status_cb); +} + +Return WifiStaIface::configureRoaming(const StaRoamingConfig& config, + configureRoaming_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::configureRoamingInternal, hidl_status_cb, config); +} + +Return WifiStaIface::setRoamingState(StaRoamingState state, + setRoamingState_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::setRoamingStateInternal, hidl_status_cb, state); +} + +Return WifiStaIface::enableNdOffload(bool enable, enableNdOffload_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::enableNdOffloadInternal, hidl_status_cb, enable); +} + +Return WifiStaIface::startSendingKeepAlivePackets( + uint32_t cmd_id, const hidl_vec& ip_packet_data, uint16_t ether_type, + const hidl_array& src_address, const hidl_array& dst_address, + uint32_t period_in_ms, startSendingKeepAlivePackets_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::startSendingKeepAlivePacketsInternal, hidl_status_cb, + cmd_id, ip_packet_data, ether_type, src_address, dst_address, + period_in_ms); +} + +Return WifiStaIface::stopSendingKeepAlivePackets( + uint32_t cmd_id, stopSendingKeepAlivePackets_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::stopSendingKeepAlivePacketsInternal, hidl_status_cb, + cmd_id); +} + +Return WifiStaIface::setScanningMacOui(const hidl_array& oui, + setScanningMacOui_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::setScanningMacOuiInternal, hidl_status_cb, oui); +} + +Return WifiStaIface::startDebugPacketFateMonitoring( + startDebugPacketFateMonitoring_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::startDebugPacketFateMonitoringInternal, hidl_status_cb); +} + +Return WifiStaIface::getDebugTxPacketFates(getDebugTxPacketFates_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getDebugTxPacketFatesInternal, hidl_status_cb); +} + +Return WifiStaIface::getDebugRxPacketFates(getDebugRxPacketFates_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getDebugRxPacketFatesInternal, hidl_status_cb); +} + +Return WifiStaIface::setMacAddress(const hidl_array& mac, + setMacAddress_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::setMacAddressInternal, hidl_status_cb, mac); +} + +Return WifiStaIface::getFactoryMacAddress(getFactoryMacAddress_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getFactoryMacAddressInternal, hidl_status_cb); +} + +Return WifiStaIface::setScanMode(bool enable, setScanMode_cb hidl_status_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::setScanModeInternal, hidl_status_cb, enable); +} + +std::pair WifiStaIface::getNameInternal() { + return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_}; +} + +std::pair WifiStaIface::getTypeInternal() { + return {createWifiStatus(WifiStatusCode::SUCCESS), IfaceType::STA}; +} + +WifiStatus WifiStaIface::registerEventCallbackInternal( + const sp& callback) { + if (!event_cb_handler_.addCallback(callback)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + return createWifiStatus(WifiStatusCode::SUCCESS); +} + +std::pair WifiStaIface::getCapabilitiesInternal() { + legacy_hal::wifi_error legacy_status; + uint64_t legacy_feature_set; + std::tie(legacy_status, legacy_feature_set) = + legacy_hal_.lock()->getSupportedFeatureSet(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {createWifiStatusFromLegacyError(legacy_status), 0}; + } + uint32_t legacy_logger_feature_set; + std::tie(legacy_status, legacy_logger_feature_set) = + legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + // some devices don't support querying logger feature set + legacy_logger_feature_set = 0; + } + uint32_t hidl_caps; + if (!hidl_struct_util::convertLegacyFeaturesToHidlStaCapabilities( + legacy_feature_set, legacy_logger_feature_set, &hidl_caps)) { + return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), 0}; + } + return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps}; +} + +std::pair +WifiStaIface::getApfPacketFilterCapabilitiesInternal() { + legacy_hal::wifi_error legacy_status; + legacy_hal::PacketFilterCapabilities legacy_caps; + std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getPacketFilterCapabilities(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {createWifiStatusFromLegacyError(legacy_status), {}}; + } + StaApfPacketFilterCapabilities hidl_caps; + if (!hidl_struct_util::convertLegacyApfCapabilitiesToHidl(legacy_caps, &hidl_caps)) { + return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; + } + return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps}; +} + +WifiStatus WifiStaIface::installApfPacketFilterInternal(uint32_t /* cmd_id */, + const std::vector& program) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->setPacketFilter(ifname_, program); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair> WifiStaIface::readApfPacketFilterDataInternal() { + const std::pair> legacy_status_and_data = + legacy_hal_.lock()->readApfPacketFilterData(ifname_); + return {createWifiStatusFromLegacyError(legacy_status_and_data.first), + std::move(legacy_status_and_data.second)}; +} + +std::pair +WifiStaIface::getBackgroundScanCapabilitiesInternal() { + legacy_hal::wifi_error legacy_status; + legacy_hal::wifi_gscan_capabilities legacy_caps; + std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getGscanCapabilities(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {createWifiStatusFromLegacyError(legacy_status), {}}; + } + StaBackgroundScanCapabilities hidl_caps; + if (!hidl_struct_util::convertLegacyGscanCapabilitiesToHidl(legacy_caps, &hidl_caps)) { + return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; + } + return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps}; +} + +std::pair> +WifiStaIface::getValidFrequenciesForBandInternal(V1_0::WifiBand band) { + static_assert(sizeof(WifiChannelInMhz) == sizeof(uint32_t), "Size mismatch"); + legacy_hal::wifi_error legacy_status; + std::vector valid_frequencies; + std::tie(legacy_status, valid_frequencies) = legacy_hal_.lock()->getValidFrequenciesForBand( + ifname_, hidl_struct_util::convertHidlWifiBandToLegacy(band)); + return {createWifiStatusFromLegacyError(legacy_status), valid_frequencies}; +} + +WifiStatus WifiStaIface::startBackgroundScanInternal(uint32_t cmd_id, + const StaBackgroundScanParameters& params) { + legacy_hal::wifi_scan_cmd_params legacy_params; + if (!hidl_struct_util::convertHidlGscanParamsToLegacy(params, &legacy_params)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + android::wp weak_ptr_this(this); + const auto& on_failure_callback = [weak_ptr_this](legacy_hal::wifi_request_id id) { + const auto shared_ptr_this = weak_ptr_this.promote(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onBackgroundScanFailure(id).isOk()) { + LOG(ERROR) << "Failed to invoke onBackgroundScanFailure callback"; + } + } + }; + const auto& on_results_callback = + [weak_ptr_this](legacy_hal::wifi_request_id id, + const std::vector& results) { + const auto shared_ptr_this = weak_ptr_this.promote(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + std::vector hidl_scan_datas; + if (!hidl_struct_util::convertLegacyVectorOfCachedGscanResultsToHidl( + results, &hidl_scan_datas)) { + LOG(ERROR) << "Failed to convert scan results to HIDL structs"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onBackgroundScanResults(id, hidl_scan_datas).isOk()) { + LOG(ERROR) << "Failed to invoke onBackgroundScanResults callback"; + } + } + }; + const auto& on_full_result_callback = [weak_ptr_this]( + legacy_hal::wifi_request_id id, + const legacy_hal::wifi_scan_result* result, + uint32_t buckets_scanned) { + const auto shared_ptr_this = weak_ptr_this.promote(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + StaScanResult hidl_scan_result; + if (!hidl_struct_util::convertLegacyGscanResultToHidl(*result, true, &hidl_scan_result)) { + LOG(ERROR) << "Failed to convert full scan results to HIDL structs"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onBackgroundFullScanResult(id, buckets_scanned, hidl_scan_result) + .isOk()) { + LOG(ERROR) << "Failed to invoke onBackgroundFullScanResult callback"; + } + } + }; + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->startGscan(ifname_, cmd_id, legacy_params, on_failure_callback, + on_results_callback, on_full_result_callback); + return createWifiStatusFromLegacyError(legacy_status); +} + +WifiStatus WifiStaIface::stopBackgroundScanInternal(uint32_t cmd_id) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->stopGscan(ifname_, cmd_id); + return createWifiStatusFromLegacyError(legacy_status); +} + +WifiStatus WifiStaIface::enableLinkLayerStatsCollectionInternal(bool debug) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->enableLinkLayerStats(ifname_, debug); + return createWifiStatusFromLegacyError(legacy_status); +} + +WifiStatus WifiStaIface::disableLinkLayerStatsCollectionInternal() { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->disableLinkLayerStats(ifname_); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair WifiStaIface::getLinkLayerStatsInternal() { + return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; +} + +std::pair WifiStaIface::getLinkLayerStatsInternal_1_3() { + return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; +} + +std::pair WifiStaIface::getLinkLayerStatsInternal_1_5() { + return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; +} + +std::pair WifiStaIface::getLinkLayerStatsInternal_1_6() { + legacy_hal::wifi_error legacy_status; + legacy_hal::LinkLayerStats legacy_stats; + std::tie(legacy_status, legacy_stats) = legacy_hal_.lock()->getLinkLayerStats(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {createWifiStatusFromLegacyError(legacy_status), {}}; + } + V1_6::StaLinkLayerStats hidl_stats; + if (!hidl_struct_util::convertLegacyLinkLayerStatsToHidl(legacy_stats, &hidl_stats)) { + return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; + } + return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_stats}; +} + +WifiStatus WifiStaIface::startRssiMonitoringInternal(uint32_t cmd_id, int32_t max_rssi, + int32_t min_rssi) { + android::wp weak_ptr_this(this); + const auto& on_threshold_breached_callback = [weak_ptr_this](legacy_hal::wifi_request_id id, + std::array bssid, + int8_t rssi) { + const auto shared_ptr_this = weak_ptr_this.promote(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onRssiThresholdBreached(id, bssid, rssi).isOk()) { + LOG(ERROR) << "Failed to invoke onRssiThresholdBreached callback"; + } + } + }; + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startRssiMonitoring( + ifname_, cmd_id, max_rssi, min_rssi, on_threshold_breached_callback); + return createWifiStatusFromLegacyError(legacy_status); +} + +WifiStatus WifiStaIface::stopRssiMonitoringInternal(uint32_t cmd_id) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->stopRssiMonitoring(ifname_, cmd_id); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair WifiStaIface::getRoamingCapabilitiesInternal() { + legacy_hal::wifi_error legacy_status; + legacy_hal::wifi_roaming_capabilities legacy_caps; + std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getRoamingCapabilities(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {createWifiStatusFromLegacyError(legacy_status), {}}; + } + StaRoamingCapabilities hidl_caps; + if (!hidl_struct_util::convertLegacyRoamingCapabilitiesToHidl(legacy_caps, &hidl_caps)) { + return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; + } + return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps}; +} + +WifiStatus WifiStaIface::configureRoamingInternal(const StaRoamingConfig& config) { + legacy_hal::wifi_roaming_config legacy_config; + if (!hidl_struct_util::convertHidlRoamingConfigToLegacy(config, &legacy_config)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->configureRoaming(ifname_, legacy_config); + return createWifiStatusFromLegacyError(legacy_status); +} + +WifiStatus WifiStaIface::setRoamingStateInternal(StaRoamingState state) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->enableFirmwareRoaming( + ifname_, hidl_struct_util::convertHidlRoamingStateToLegacy(state)); + return createWifiStatusFromLegacyError(legacy_status); +} + +WifiStatus WifiStaIface::enableNdOffloadInternal(bool enable) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->configureNdOffload(ifname_, enable); + return createWifiStatusFromLegacyError(legacy_status); +} + +WifiStatus WifiStaIface::startSendingKeepAlivePacketsInternal( + uint32_t cmd_id, const std::vector& ip_packet_data, uint16_t ether_type, + const std::array& src_address, const std::array& dst_address, + uint32_t period_in_ms) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startSendingOffloadedPacket( + ifname_, cmd_id, ether_type, ip_packet_data, src_address, dst_address, period_in_ms); + return createWifiStatusFromLegacyError(legacy_status); +} + +WifiStatus WifiStaIface::stopSendingKeepAlivePacketsInternal(uint32_t cmd_id) { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->stopSendingOffloadedPacket(ifname_, cmd_id); + return createWifiStatusFromLegacyError(legacy_status); +} + +WifiStatus WifiStaIface::setScanningMacOuiInternal(const std::array& /* oui */) { + // deprecated. + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + +WifiStatus WifiStaIface::startDebugPacketFateMonitoringInternal() { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startPktFateMonitoring(ifname_); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair> +WifiStaIface::getDebugTxPacketFatesInternal() { + legacy_hal::wifi_error legacy_status; + std::vector legacy_fates; + std::tie(legacy_status, legacy_fates) = legacy_hal_.lock()->getTxPktFates(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {createWifiStatusFromLegacyError(legacy_status), {}}; + } + std::vector hidl_fates; + if (!hidl_struct_util::convertLegacyVectorOfDebugTxPacketFateToHidl(legacy_fates, + &hidl_fates)) { + return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; + } + return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_fates}; +} + +std::pair> +WifiStaIface::getDebugRxPacketFatesInternal() { + legacy_hal::wifi_error legacy_status; + std::vector legacy_fates; + std::tie(legacy_status, legacy_fates) = legacy_hal_.lock()->getRxPktFates(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {createWifiStatusFromLegacyError(legacy_status), {}}; + } + std::vector hidl_fates; + if (!hidl_struct_util::convertLegacyVectorOfDebugRxPacketFateToHidl(legacy_fates, + &hidl_fates)) { + return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; + } + return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_fates}; +} + +WifiStatus WifiStaIface::setMacAddressInternal(const std::array& mac) { + bool status = iface_util_.lock()->setMacAddress(ifname_, mac); + if (!status) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + return createWifiStatus(WifiStatusCode::SUCCESS); +} + +std::pair> WifiStaIface::getFactoryMacAddressInternal() { + std::array mac = iface_util_.lock()->getFactoryMacAddress(ifname_); + if (mac[0] == 0 && mac[1] == 0 && mac[2] == 0 && mac[3] == 0 && mac[4] == 0 && mac[5] == 0) { + return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), mac}; + } + return {createWifiStatus(WifiStatusCode::SUCCESS), mac}; +} + +WifiStatus WifiStaIface::setScanModeInternal(bool enable) { + // OEM's need to implement this on their devices if needed. + LOG(WARNING) << "setScanModeInternal(" << enable << ") not supported"; + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + +} // namespace implementation +} // namespace V1_6 +} // namespace wifi +} // namespace hardware +} // namespace android diff --git a/wifi/1.6/default/wifi_sta_iface.h b/wifi/1.6/default/wifi_sta_iface.h new file mode 100644 index 0000000000..c01c50b612 --- /dev/null +++ b/wifi/1.6/default/wifi_sta_iface.h @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2016 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. + */ + +#ifndef WIFI_STA_IFACE_H_ +#define WIFI_STA_IFACE_H_ + +#include +#include +#include + +#include "hidl_callback_util.h" +#include "wifi_iface_util.h" +#include "wifi_legacy_hal.h" + +namespace android { +namespace hardware { +namespace wifi { +namespace V1_6 { +namespace implementation { +using namespace android::hardware::wifi::V1_0; + +/** + * HIDL interface object used to control a STA Iface instance. + */ +class WifiStaIface : public V1_6::IWifiStaIface { + public: + WifiStaIface(const std::string& ifname, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util); + // Refer to |WifiChip::invalidate()|. + void invalidate(); + bool isValid(); + std::set> getEventCallbacks(); + std::string getName(); + + // HIDL methods exposed. + Return getName(getName_cb hidl_status_cb) override; + Return getType(getType_cb hidl_status_cb) override; + Return registerEventCallback(const sp& callback, + registerEventCallback_cb hidl_status_cb) override; + Return getCapabilities(getCapabilities_cb hidl_status_cb) override; + Return getApfPacketFilterCapabilities( + getApfPacketFilterCapabilities_cb hidl_status_cb) override; + Return installApfPacketFilter(uint32_t cmd_id, const hidl_vec& program, + installApfPacketFilter_cb hidl_status_cb) override; + Return readApfPacketFilterData(readApfPacketFilterData_cb hidl_status_cb) override; + Return getBackgroundScanCapabilities( + getBackgroundScanCapabilities_cb hidl_status_cb) override; + Return getValidFrequenciesForBand(V1_0::WifiBand band, + getValidFrequenciesForBand_cb hidl_status_cb) override; + Return startBackgroundScan(uint32_t cmd_id, const StaBackgroundScanParameters& params, + startBackgroundScan_cb hidl_status_cb) override; + Return stopBackgroundScan(uint32_t cmd_id, stopBackgroundScan_cb hidl_status_cb) override; + Return enableLinkLayerStatsCollection( + bool debug, enableLinkLayerStatsCollection_cb hidl_status_cb) override; + Return disableLinkLayerStatsCollection( + disableLinkLayerStatsCollection_cb hidl_status_cb) override; + Return getLinkLayerStats(getLinkLayerStats_cb hidl_status_cb) override; + Return getLinkLayerStats_1_3(getLinkLayerStats_1_3_cb hidl_status_cb) override; + Return getLinkLayerStats_1_5(getLinkLayerStats_1_5_cb hidl_status_cb) override; + Return getLinkLayerStats_1_6(getLinkLayerStats_1_6_cb hidl_status_cb) override; + Return startRssiMonitoring(uint32_t cmd_id, int32_t max_rssi, int32_t min_rssi, + startRssiMonitoring_cb hidl_status_cb) override; + Return stopRssiMonitoring(uint32_t cmd_id, stopRssiMonitoring_cb hidl_status_cb) override; + Return getRoamingCapabilities(getRoamingCapabilities_cb hidl_status_cb) override; + Return configureRoaming(const StaRoamingConfig& config, + configureRoaming_cb hidl_status_cb) override; + Return setRoamingState(StaRoamingState state, setRoamingState_cb hidl_status_cb) override; + Return enableNdOffload(bool enable, enableNdOffload_cb hidl_status_cb) override; + Return startSendingKeepAlivePackets( + uint32_t cmd_id, const hidl_vec& ip_packet_data, uint16_t ether_type, + const hidl_array& src_address, const hidl_array& dst_address, + uint32_t period_in_ms, startSendingKeepAlivePackets_cb hidl_status_cb) override; + Return stopSendingKeepAlivePackets( + uint32_t cmd_id, stopSendingKeepAlivePackets_cb hidl_status_cb) override; + Return setScanningMacOui(const hidl_array& oui, + setScanningMacOui_cb hidl_status_cb) override; + Return startDebugPacketFateMonitoring( + startDebugPacketFateMonitoring_cb hidl_status_cb) override; + Return getDebugTxPacketFates(getDebugTxPacketFates_cb hidl_status_cb) override; + Return getDebugRxPacketFates(getDebugRxPacketFates_cb hidl_status_cb) override; + Return setMacAddress(const hidl_array& mac, + setMacAddress_cb hidl_status_cb) override; + Return getFactoryMacAddress(getFactoryMacAddress_cb hidl_status_cb) override; + Return setScanMode(bool enable, setScanMode_cb hidl_status_cb) override; + + private: + // Corresponding worker functions for the HIDL methods. + std::pair getNameInternal(); + std::pair getTypeInternal(); + WifiStatus registerEventCallbackInternal(const sp& callback); + std::pair getCapabilitiesInternal(); + std::pair getApfPacketFilterCapabilitiesInternal(); + WifiStatus installApfPacketFilterInternal(uint32_t cmd_id, const std::vector& program); + std::pair> readApfPacketFilterDataInternal(); + std::pair getBackgroundScanCapabilitiesInternal(); + std::pair> getValidFrequenciesForBandInternal( + V1_0::WifiBand band); + WifiStatus startBackgroundScanInternal(uint32_t cmd_id, + const StaBackgroundScanParameters& params); + WifiStatus stopBackgroundScanInternal(uint32_t cmd_id); + WifiStatus enableLinkLayerStatsCollectionInternal(bool debug); + WifiStatus disableLinkLayerStatsCollectionInternal(); + std::pair getLinkLayerStatsInternal(); + std::pair getLinkLayerStatsInternal_1_3(); + std::pair getLinkLayerStatsInternal_1_5(); + std::pair getLinkLayerStatsInternal_1_6(); + WifiStatus startRssiMonitoringInternal(uint32_t cmd_id, int32_t max_rssi, int32_t min_rssi); + WifiStatus stopRssiMonitoringInternal(uint32_t cmd_id); + std::pair getRoamingCapabilitiesInternal(); + WifiStatus configureRoamingInternal(const StaRoamingConfig& config); + WifiStatus setRoamingStateInternal(StaRoamingState state); + WifiStatus enableNdOffloadInternal(bool enable); + WifiStatus startSendingKeepAlivePacketsInternal(uint32_t cmd_id, + const std::vector& ip_packet_data, + uint16_t ether_type, + const std::array& src_address, + const std::array& dst_address, + uint32_t period_in_ms); + WifiStatus stopSendingKeepAlivePacketsInternal(uint32_t cmd_id); + WifiStatus setScanningMacOuiInternal(const std::array& oui); + WifiStatus startDebugPacketFateMonitoringInternal(); + std::pair> getDebugTxPacketFatesInternal(); + std::pair> getDebugRxPacketFatesInternal(); + WifiStatus setMacAddressInternal(const std::array& mac); + std::pair> getFactoryMacAddressInternal(); + WifiStatus setScanModeInternal(bool enable); + + std::string ifname_; + std::weak_ptr legacy_hal_; + std::weak_ptr iface_util_; + bool is_valid_; + hidl_callback_util::HidlCallbackHandler event_cb_handler_; + + DISALLOW_COPY_AND_ASSIGN(WifiStaIface); +}; + +} // namespace implementation +} // namespace V1_6 +} // namespace wifi +} // namespace hardware +} // namespace android + +#endif // WIFI_STA_IFACE_H_ diff --git a/wifi/aidl/default/wifi_status_util.cpp b/wifi/1.6/default/wifi_status_util.cpp similarity index 80% rename from wifi/aidl/default/wifi_status_util.cpp rename to wifi/1.6/default/wifi_status_util.cpp index 25ecd716da..3b18e537cd 100644 --- a/wifi/aidl/default/wifi_status_util.cpp +++ b/wifi/1.6/default/wifi_status_util.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2016 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. @@ -16,10 +16,11 @@ #include "wifi_status_util.h" -namespace aidl { namespace android { namespace hardware { namespace wifi { +namespace V1_6 { +namespace implementation { std::string legacyErrorToString(legacy_hal::wifi_error error) { switch (error) { @@ -50,21 +51,16 @@ std::string legacyErrorToString(legacy_hal::wifi_error error) { } } -ndk::ScopedAStatus createWifiStatus(WifiStatusCode code, const std::string& description) { - return ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(static_cast(code), - description.c_str()); +WifiStatus createWifiStatus(WifiStatusCode code, const std::string& description) { + return {code, description}; } -ndk::ScopedAStatus createWifiStatus(WifiStatusCode code) { - return ndk::ScopedAStatus::fromServiceSpecificError(static_cast(code)); +WifiStatus createWifiStatus(WifiStatusCode code) { + return createWifiStatus(code, ""); } -ndk::ScopedAStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error, - const std::string& desc) { +WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error, const std::string& desc) { switch (error) { - case legacy_hal::WIFI_ERROR_NONE: - return ndk::ScopedAStatus::ok(); - case legacy_hal::WIFI_ERROR_UNINITIALIZED: case legacy_hal::WIFI_ERROR_NOT_AVAILABLE: return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE, desc); @@ -88,6 +84,9 @@ ndk::ScopedAStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error, case legacy_hal::WIFI_ERROR_BUSY: return createWifiStatus(WifiStatusCode::ERROR_BUSY); + case legacy_hal::WIFI_ERROR_NONE: + return createWifiStatus(WifiStatusCode::SUCCESS, desc); + case legacy_hal::WIFI_ERROR_UNKNOWN: return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, "unknown"); @@ -96,11 +95,12 @@ ndk::ScopedAStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error, } } -ndk::ScopedAStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error) { +WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error) { return createWifiStatusFromLegacyError(error, ""); } +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl diff --git a/wifi/aidl/default/wifi_status_util.h b/wifi/1.6/default/wifi_status_util.h similarity index 59% rename from wifi/aidl/default/wifi_status_util.h rename to wifi/1.6/default/wifi_status_util.h index 633811dbf6..ea1c29486b 100644 --- a/wifi/aidl/default/wifi_status_util.h +++ b/wifi/1.6/default/wifi_status_util.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2016 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. @@ -17,26 +17,28 @@ #ifndef WIFI_STATUS_UTIL_H_ #define WIFI_STATUS_UTIL_H_ -#include +#include #include "wifi_legacy_hal.h" -namespace aidl { namespace android { namespace hardware { namespace wifi { -using ::aidl::android::hardware::wifi::WifiStatusCode; +namespace V1_6 { +namespace implementation { +using namespace android::hardware::wifi::V1_0; std::string legacyErrorToString(legacy_hal::wifi_error error); -ndk::ScopedAStatus createWifiStatus(WifiStatusCode code, const std::string& description); -ndk::ScopedAStatus createWifiStatus(WifiStatusCode code); -ndk::ScopedAStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error, - const std::string& description); -ndk::ScopedAStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error); +WifiStatus createWifiStatus(WifiStatusCode code, const std::string& description); +WifiStatus createWifiStatus(WifiStatusCode code); +WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error, + const std::string& description); +WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error); +} // namespace implementation +} // namespace V1_6 } // namespace wifi } // namespace hardware } // namespace android -} // namespace aidl #endif // WIFI_STATUS_UTIL_H_ diff --git a/wifi/aidl/default/aidl_callback_util.h b/wifi/aidl/default/aidl_callback_util.h deleted file mode 100644 index 41d70a53aa..0000000000 --- a/wifi/aidl/default/aidl_callback_util.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * 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. - */ - -#ifndef AIDL_CALLBACK_UTIL_H_ -#define AIDL_CALLBACK_UTIL_H_ - -#include - -#include -#include - -namespace { -std::unordered_map callback_handler_map_; -} - -namespace aidl { -namespace android { -namespace hardware { -namespace wifi { -namespace aidl_callback_util { - -// Provides a class to manage callbacks for the various AIDL interfaces and -// handle the death of the process hosting each callback. -template -class AidlCallbackHandler { - public: - AidlCallbackHandler() { - death_handler_ = AIBinder_DeathRecipient_new(AidlCallbackHandler::onCallbackDeath); - } - ~AidlCallbackHandler() { invalidate(); } - - bool addCallback(const std::shared_ptr& cb) { - void* cbPtr = reinterpret_cast(cb->asBinder().get()); - const auto& cbPosition = findCbInSet(cbPtr); - if (cbPosition != cb_set_.end()) { - LOG(WARNING) << "Duplicate death notification registration"; - return true; - } - - if (AIBinder_linkToDeath(cb->asBinder().get(), death_handler_, cbPtr /* cookie */) != - STATUS_OK) { - LOG(ERROR) << "Failed to register death notification"; - return false; - } - - callback_handler_map_[cbPtr] = reinterpret_cast(this); - cb_set_.insert(cb); - return true; - } - - const std::set>& getCallbacks() { return cb_set_; } - - void invalidate() { - for (auto cb : cb_set_) { - void* cookie = reinterpret_cast(cb->asBinder().get()); - if (AIBinder_unlinkToDeath(cb->asBinder().get(), death_handler_, cookie) != STATUS_OK) { - LOG(ERROR) << "Failed to deregister death notification"; - } - if (!removeCbFromHandlerMap(cookie)) { - LOG(ERROR) << "Failed to remove callback from handler map"; - } - } - cb_set_.clear(); - } - - // Entry point for the death handling logic. AIBinder_DeathRecipient - // can only call a static function, so use the cookie to find the - // proper handler and route the request there. - static void onCallbackDeath(void* cookie) { - auto cbQuery = callback_handler_map_.find(cookie); - if (cbQuery == callback_handler_map_.end()) { - LOG(ERROR) << "Invalid death cookie received"; - return; - } - - AidlCallbackHandler* cbHandler = reinterpret_cast(cbQuery->second); - if (cbHandler == nullptr) { - LOG(ERROR) << "Handler mapping contained an invalid handler"; - return; - } - cbHandler->handleCallbackDeath(cbQuery->first); - } - - private: - std::set> cb_set_; - AIBinder_DeathRecipient* death_handler_; - - typename std::set>::iterator findCbInSet(void* cbPtr) { - const auto& cbPosition = std::find_if( - cb_set_.begin(), cb_set_.end(), [cbPtr](const std::shared_ptr& p) { - return cbPtr == reinterpret_cast(p->asBinder().get()); - }); - return cbPosition; - } - - bool removeCbFromHandlerMap(void* cbPtr) { - auto cbQuery = callback_handler_map_.find(cbPtr); - if (cbQuery != callback_handler_map_.end()) { - callback_handler_map_.erase(cbQuery); - return true; - } - return false; - } - - void handleCallbackDeath(void* cbPtr) { - const auto& cbPosition = findCbInSet(cbPtr); - if (cbPosition == cb_set_.end()) { - LOG(ERROR) << "Unknown callback death notification received"; - return; - } - cb_set_.erase(cbPosition); - - if (!removeCbFromHandlerMap(cbPtr)) { - LOG(ERROR) << "Callback was not in callback handler map"; - } - } - - DISALLOW_COPY_AND_ASSIGN(AidlCallbackHandler); -}; - -} // namespace aidl_callback_util -} // namespace wifi -} // namespace hardware -} // namespace android -} // namespace aidl - -#endif // AIDL_CALLBACK_UTIL_H_ diff --git a/wifi/aidl/default/aidl_return_util.h b/wifi/aidl/default/aidl_return_util.h deleted file mode 100644 index 9a49a22e2a..0000000000 --- a/wifi/aidl/default/aidl_return_util.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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. - */ - -#ifndef AIDL_RETURN_UTIL_H_ -#define AIDL_RETURN_UTIL_H_ - -#include "aidl_sync_util.h" -#include "wifi_status_util.h" - -namespace aidl { -namespace android { -namespace hardware { -namespace wifi { -namespace aidl_return_util { -using aidl::android::hardware::wifi::WifiStatusCode; -using aidl::android::hardware::wifi::aidl_sync_util::acquireGlobalLock; - -/** - * These utility functions are used to invoke a method on the provided - * AIDL interface object. - * These functions checks if the provided AIDL interface object is valid. - * a) If valid, Invokes the corresponding internal implementation function of - * the AIDL method. - * b) If invalid, return without calling the internal implementation function. - */ - -// Use for AIDL methods which return only an AIDL status. -template -::ndk::ScopedAStatus validateAndCall(ObjT* obj, WifiStatusCode status_code_if_invalid, - WorkFuncT&& work, Args&&... args) { - const auto lock = acquireGlobalLock(); - if (obj->isValid()) { - return (obj->*work)(std::forward(args)...); - } else { - return createWifiStatus(status_code_if_invalid); - } -} - -// Use for AIDL methods which return only an AIDL status. -// This version passes the global lock acquired to the body of the method. -template -::ndk::ScopedAStatus validateAndCallWithLock(ObjT* obj, WifiStatusCode status_code_if_invalid, - WorkFuncT&& work, Args&&... args) { - auto lock = acquireGlobalLock(); - if (obj->isValid()) { - return (obj->*work)(&lock, std::forward(args)...); - } else { - return createWifiStatus(status_code_if_invalid); - } -} - -// Use for AIDL methods which have a return value along with the AIDL status -template -::ndk::ScopedAStatus validateAndCall(ObjT* obj, WifiStatusCode status_code_if_invalid, - WorkFuncT&& work, ReturnT* ret_val, Args&&... args) { - const auto lock = acquireGlobalLock(); - if (obj->isValid()) { - auto call_pair = (obj->*work)(std::forward(args)...); - *ret_val = call_pair.first; - return std::forward<::ndk::ScopedAStatus>(call_pair.second); - } else { - return ndk::ScopedAStatus::fromServiceSpecificError( - static_cast(status_code_if_invalid)); - } -} - -} // namespace aidl_return_util -} // namespace wifi -} // namespace hardware -} // namespace android -} // namespace aidl -#endif // AIDL_RETURN_UTIL_H_ diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp deleted file mode 100644 index 07612b65c5..0000000000 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ /dev/null @@ -1,2775 +0,0 @@ -/* - * 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. - */ - -#include -#include - -#include "aidl_struct_util.h" - -namespace aidl { -namespace android { -namespace hardware { -namespace wifi { -namespace aidl_struct_util { - -WifiChannelWidthInMhz convertLegacyWifiChannelWidthToAidl(legacy_hal::wifi_channel_width type); - -std::string safeConvertChar(const char* str, size_t max_len) { - const char* c = str; - size_t size = 0; - while (*c && (unsigned char)*c < 128 && size < max_len) { - ++size; - ++c; - } - return std::string(str, size); -} - -inline std::vector uintToIntVec(const std::vector& in) { - return std::vector(in.begin(), in.end()); -} - -IWifiChip::ChipCapabilityMask convertLegacyLoggerFeatureToAidlChipCapability(uint32_t feature) { - switch (feature) { - case legacy_hal::WIFI_LOGGER_MEMORY_DUMP_SUPPORTED: - return IWifiChip::ChipCapabilityMask::DEBUG_MEMORY_FIRMWARE_DUMP; - case legacy_hal::WIFI_LOGGER_DRIVER_DUMP_SUPPORTED: - return IWifiChip::ChipCapabilityMask::DEBUG_MEMORY_DRIVER_DUMP; - case legacy_hal::WIFI_LOGGER_CONNECT_EVENT_SUPPORTED: - return IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_CONNECT_EVENT; - case legacy_hal::WIFI_LOGGER_POWER_EVENT_SUPPORTED: - return IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_POWER_EVENT; - case legacy_hal::WIFI_LOGGER_WAKE_LOCK_SUPPORTED: - return IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_WAKELOCK_EVENT; - }; - CHECK(false) << "Unknown legacy feature: " << feature; - return {}; -} - -IWifiStaIface::StaIfaceCapabilityMask convertLegacyLoggerFeatureToAidlStaIfaceCapability( - uint32_t feature) { - switch (feature) { - case legacy_hal::WIFI_LOGGER_PACKET_FATE_SUPPORTED: - return IWifiStaIface::StaIfaceCapabilityMask::DEBUG_PACKET_FATE; - }; - CHECK(false) << "Unknown legacy feature: " << feature; - return {}; -} - -IWifiChip::ChipCapabilityMask convertLegacyFeatureToAidlChipCapability(uint64_t feature) { - switch (feature) { - case WIFI_FEATURE_SET_TX_POWER_LIMIT: - return IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT; - case WIFI_FEATURE_USE_BODY_HEAD_SAR: - return IWifiChip::ChipCapabilityMask::USE_BODY_HEAD_SAR; - case WIFI_FEATURE_D2D_RTT: - return IWifiChip::ChipCapabilityMask::D2D_RTT; - case WIFI_FEATURE_D2AP_RTT: - return IWifiChip::ChipCapabilityMask::D2AP_RTT; - case WIFI_FEATURE_INFRA_60G: - return IWifiChip::ChipCapabilityMask::WIGIG; - case WIFI_FEATURE_SET_LATENCY_MODE: - return IWifiChip::ChipCapabilityMask::SET_LATENCY_MODE; - case WIFI_FEATURE_P2P_RAND_MAC: - return IWifiChip::ChipCapabilityMask::P2P_RAND_MAC; - }; - CHECK(false) << "Unknown legacy feature: " << feature; - return {}; -} - -IWifiStaIface::StaIfaceCapabilityMask convertLegacyFeatureToAidlStaIfaceCapability( - uint64_t feature) { - switch (feature) { - case WIFI_FEATURE_GSCAN: - return IWifiStaIface::StaIfaceCapabilityMask::BACKGROUND_SCAN; - case WIFI_FEATURE_LINK_LAYER_STATS: - return IWifiStaIface::StaIfaceCapabilityMask::LINK_LAYER_STATS; - case WIFI_FEATURE_RSSI_MONITOR: - return IWifiStaIface::StaIfaceCapabilityMask::RSSI_MONITOR; - case WIFI_FEATURE_CONTROL_ROAMING: - return IWifiStaIface::StaIfaceCapabilityMask::CONTROL_ROAMING; - case WIFI_FEATURE_IE_WHITELIST: - return IWifiStaIface::StaIfaceCapabilityMask::PROBE_IE_ALLOWLIST; - case WIFI_FEATURE_SCAN_RAND: - return IWifiStaIface::StaIfaceCapabilityMask::SCAN_RAND; - case WIFI_FEATURE_INFRA_5G: - return IWifiStaIface::StaIfaceCapabilityMask::STA_5G; - case WIFI_FEATURE_HOTSPOT: - return IWifiStaIface::StaIfaceCapabilityMask::HOTSPOT; - case WIFI_FEATURE_PNO: - return IWifiStaIface::StaIfaceCapabilityMask::PNO; - case WIFI_FEATURE_TDLS: - return IWifiStaIface::StaIfaceCapabilityMask::TDLS; - case WIFI_FEATURE_TDLS_OFFCHANNEL: - return IWifiStaIface::StaIfaceCapabilityMask::TDLS_OFFCHANNEL; - case WIFI_FEATURE_CONFIG_NDO: - return IWifiStaIface::StaIfaceCapabilityMask::ND_OFFLOAD; - case WIFI_FEATURE_MKEEP_ALIVE: - return IWifiStaIface::StaIfaceCapabilityMask::KEEP_ALIVE; - }; - CHECK(false) << "Unknown legacy feature: " << feature; - return {}; -} - -bool convertLegacyFeaturesToAidlChipCapabilities(uint64_t legacy_feature_set, - uint32_t legacy_logger_feature_set, - uint32_t* aidl_caps) { - if (!aidl_caps) { - return false; - } - *aidl_caps = {}; - for (const auto feature : {legacy_hal::WIFI_LOGGER_MEMORY_DUMP_SUPPORTED, - legacy_hal::WIFI_LOGGER_DRIVER_DUMP_SUPPORTED, - legacy_hal::WIFI_LOGGER_CONNECT_EVENT_SUPPORTED, - legacy_hal::WIFI_LOGGER_POWER_EVENT_SUPPORTED, - legacy_hal::WIFI_LOGGER_WAKE_LOCK_SUPPORTED}) { - if (feature & legacy_logger_feature_set) { - *aidl_caps |= - static_cast(convertLegacyLoggerFeatureToAidlChipCapability(feature)); - } - } - std::vector features = {WIFI_FEATURE_SET_TX_POWER_LIMIT, - WIFI_FEATURE_USE_BODY_HEAD_SAR, - WIFI_FEATURE_D2D_RTT, - WIFI_FEATURE_D2AP_RTT, - WIFI_FEATURE_INFRA_60G, - WIFI_FEATURE_SET_LATENCY_MODE, - WIFI_FEATURE_P2P_RAND_MAC}; - for (const auto feature : features) { - if (feature & legacy_feature_set) { - *aidl_caps |= static_cast(convertLegacyFeatureToAidlChipCapability(feature)); - } - } - - // There are no flags for these 3 in the legacy feature set. Adding them to - // the set because all the current devices support it. - *aidl_caps |= - static_cast(IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_VENDOR_DATA); - *aidl_caps |= - static_cast(IWifiChip::ChipCapabilityMask::DEBUG_HOST_WAKE_REASON_STATS); - *aidl_caps |= static_cast(IWifiChip::ChipCapabilityMask::DEBUG_ERROR_ALERTS); - return true; -} - -WifiDebugRingBufferFlags convertLegacyDebugRingBufferFlagsToAidl(uint32_t flag) { - switch (flag) { - case WIFI_RING_BUFFER_FLAG_HAS_BINARY_ENTRIES: - return WifiDebugRingBufferFlags::HAS_BINARY_ENTRIES; - case WIFI_RING_BUFFER_FLAG_HAS_ASCII_ENTRIES: - return WifiDebugRingBufferFlags::HAS_ASCII_ENTRIES; - }; - CHECK(false) << "Unknown legacy flag: " << flag; - return {}; -} - -bool convertLegacyDebugRingBufferStatusToAidl( - const legacy_hal::wifi_ring_buffer_status& legacy_status, - WifiDebugRingBufferStatus* aidl_status) { - if (!aidl_status) { - return false; - } - *aidl_status = {}; - aidl_status->ringName = safeConvertChar(reinterpret_cast(legacy_status.name), - sizeof(legacy_status.name)); - aidl_status->flags = 0; - for (const auto flag : - {WIFI_RING_BUFFER_FLAG_HAS_BINARY_ENTRIES, WIFI_RING_BUFFER_FLAG_HAS_ASCII_ENTRIES}) { - if (flag & legacy_status.flags) { - aidl_status->flags |= static_cast::type>( - convertLegacyDebugRingBufferFlagsToAidl(flag)); - } - } - aidl_status->ringId = legacy_status.ring_id; - aidl_status->sizeInBytes = legacy_status.ring_buffer_byte_size; - // Calculate free size of the ring the buffer. We don't need to send the - // exact read/write pointers that were there in the legacy HAL interface. - if (legacy_status.written_bytes >= legacy_status.read_bytes) { - aidl_status->freeSizeInBytes = legacy_status.ring_buffer_byte_size - - (legacy_status.written_bytes - legacy_status.read_bytes); - } else { - aidl_status->freeSizeInBytes = legacy_status.read_bytes - legacy_status.written_bytes; - } - aidl_status->verboseLevel = legacy_status.verbose_level; - return true; -} - -bool convertLegacyVectorOfDebugRingBufferStatusToAidl( - const std::vector& legacy_status_vec, - std::vector* aidl_status_vec) { - if (!aidl_status_vec) { - return false; - } - *aidl_status_vec = {}; - for (const auto& legacy_status : legacy_status_vec) { - WifiDebugRingBufferStatus aidl_status; - if (!convertLegacyDebugRingBufferStatusToAidl(legacy_status, &aidl_status)) { - return false; - } - aidl_status_vec->push_back(aidl_status); - } - return true; -} - -bool convertLegacyWakeReasonStatsToAidl(const legacy_hal::WakeReasonStats& legacy_stats, - WifiDebugHostWakeReasonStats* aidl_stats) { - if (!aidl_stats) { - return false; - } - *aidl_stats = {}; - aidl_stats->totalCmdEventWakeCnt = legacy_stats.wake_reason_cnt.total_cmd_event_wake; - aidl_stats->cmdEventWakeCntPerType = uintToIntVec(legacy_stats.cmd_event_wake_cnt); - aidl_stats->totalDriverFwLocalWakeCnt = legacy_stats.wake_reason_cnt.total_driver_fw_local_wake; - aidl_stats->driverFwLocalWakeCntPerType = uintToIntVec(legacy_stats.driver_fw_local_wake_cnt); - aidl_stats->totalRxPacketWakeCnt = legacy_stats.wake_reason_cnt.total_rx_data_wake; - aidl_stats->rxPktWakeDetails.rxUnicastCnt = - legacy_stats.wake_reason_cnt.rx_wake_details.rx_unicast_cnt; - aidl_stats->rxPktWakeDetails.rxMulticastCnt = - legacy_stats.wake_reason_cnt.rx_wake_details.rx_multicast_cnt; - aidl_stats->rxPktWakeDetails.rxBroadcastCnt = - legacy_stats.wake_reason_cnt.rx_wake_details.rx_broadcast_cnt; - aidl_stats->rxMulticastPkWakeDetails.ipv4RxMulticastAddrCnt = - legacy_stats.wake_reason_cnt.rx_multicast_wake_pkt_info.ipv4_rx_multicast_addr_cnt; - aidl_stats->rxMulticastPkWakeDetails.ipv6RxMulticastAddrCnt = - legacy_stats.wake_reason_cnt.rx_multicast_wake_pkt_info.ipv6_rx_multicast_addr_cnt; - aidl_stats->rxMulticastPkWakeDetails.otherRxMulticastAddrCnt = - legacy_stats.wake_reason_cnt.rx_multicast_wake_pkt_info.other_rx_multicast_addr_cnt; - aidl_stats->rxIcmpPkWakeDetails.icmpPkt = - legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp_pkt; - aidl_stats->rxIcmpPkWakeDetails.icmp6Pkt = - legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_pkt; - aidl_stats->rxIcmpPkWakeDetails.icmp6Ra = - legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_ra; - aidl_stats->rxIcmpPkWakeDetails.icmp6Na = - legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_na; - aidl_stats->rxIcmpPkWakeDetails.icmp6Ns = - legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_ns; - return true; -} - -legacy_hal::wifi_power_scenario convertAidlTxPowerScenarioToLegacy( - IWifiChip::TxPowerScenario aidl_scenario) { - switch (aidl_scenario) { - case IWifiChip::TxPowerScenario::VOICE_CALL: - return legacy_hal::WIFI_POWER_SCENARIO_VOICE_CALL; - case IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF: - return legacy_hal::WIFI_POWER_SCENARIO_ON_HEAD_CELL_OFF; - case IWifiChip::TxPowerScenario::ON_HEAD_CELL_ON: - return legacy_hal::WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON; - case IWifiChip::TxPowerScenario::ON_BODY_CELL_OFF: - return legacy_hal::WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF; - case IWifiChip::TxPowerScenario::ON_BODY_CELL_ON: - return legacy_hal::WIFI_POWER_SCENARIO_ON_BODY_CELL_ON; - }; - CHECK(false); -} - -legacy_hal::wifi_latency_mode convertAidlLatencyModeToLegacy( - IWifiChip::LatencyMode aidl_latency_mode) { - switch (aidl_latency_mode) { - case IWifiChip::LatencyMode::NORMAL: - return legacy_hal::WIFI_LATENCY_MODE_NORMAL; - case IWifiChip::LatencyMode::LOW: - return legacy_hal::WIFI_LATENCY_MODE_LOW; - } - CHECK(false); -} - -bool convertLegacyWifiMacInfoToAidl(const legacy_hal::WifiMacInfo& legacy_mac_info, - IWifiChipEventCallback::RadioModeInfo* aidl_radio_mode_info) { - if (!aidl_radio_mode_info) { - return false; - } - *aidl_radio_mode_info = {}; - - aidl_radio_mode_info->radioId = legacy_mac_info.wlan_mac_id; - // Convert from bitmask of bands in the legacy HAL to enum value in - // the AIDL interface. - if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND && - legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND && - legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND) { - aidl_radio_mode_info->bandInfo = WifiBand::BAND_24GHZ_5GHZ_6GHZ; - } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND && - legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND) { - aidl_radio_mode_info->bandInfo = WifiBand::BAND_5GHZ_6GHZ; - } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND) { - aidl_radio_mode_info->bandInfo = WifiBand::BAND_6GHZ; - } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND && - legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND) { - aidl_radio_mode_info->bandInfo = WifiBand::BAND_24GHZ_5GHZ; - } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND) { - aidl_radio_mode_info->bandInfo = WifiBand::BAND_24GHZ; - } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND) { - aidl_radio_mode_info->bandInfo = WifiBand::BAND_5GHZ; - } else { - aidl_radio_mode_info->bandInfo = WifiBand::BAND_UNSPECIFIED; - } - std::vector iface_info_vec; - for (const auto& legacy_iface_info : legacy_mac_info.iface_infos) { - IWifiChipEventCallback::IfaceInfo iface_info; - iface_info.name = legacy_iface_info.name; - iface_info.channel = legacy_iface_info.channel; - iface_info_vec.push_back(iface_info); - } - aidl_radio_mode_info->ifaceInfos = iface_info_vec; - return true; -} - -uint32_t convertAidlWifiBandToLegacyMacBand(WifiBand aidl_band) { - switch (aidl_band) { - case WifiBand::BAND_24GHZ: - return legacy_hal::WLAN_MAC_2_4_BAND; - case WifiBand::BAND_5GHZ: - case WifiBand::BAND_5GHZ_DFS: - case WifiBand::BAND_5GHZ_WITH_DFS: - return legacy_hal::WLAN_MAC_5_0_BAND; - case WifiBand::BAND_24GHZ_5GHZ: - case WifiBand::BAND_24GHZ_5GHZ_WITH_DFS: - return (legacy_hal::WLAN_MAC_2_4_BAND | legacy_hal::WLAN_MAC_5_0_BAND); - case WifiBand::BAND_6GHZ: - return legacy_hal::WLAN_MAC_6_0_BAND; - case WifiBand::BAND_5GHZ_6GHZ: - return (legacy_hal::WLAN_MAC_5_0_BAND | legacy_hal::WLAN_MAC_6_0_BAND); - case WifiBand::BAND_24GHZ_5GHZ_6GHZ: - case WifiBand::BAND_24GHZ_5GHZ_WITH_DFS_6GHZ: - return (legacy_hal::WLAN_MAC_2_4_BAND | legacy_hal::WLAN_MAC_5_0_BAND | - legacy_hal::WLAN_MAC_6_0_BAND); - case WifiBand::BAND_60GHZ: - return legacy_hal::WLAN_MAC_60_0_BAND; - default: - return (legacy_hal::WLAN_MAC_2_4_BAND | legacy_hal::WLAN_MAC_5_0_BAND | - legacy_hal::WLAN_MAC_6_0_BAND | legacy_hal::WLAN_MAC_60_0_BAND); - } -} - -WifiBand convertLegacyMacBandToAidlWifiBand(uint32_t band) { - switch (band) { - case legacy_hal::WLAN_MAC_2_4_BAND: - return WifiBand::BAND_24GHZ; - case legacy_hal::WLAN_MAC_5_0_BAND: - return WifiBand::BAND_5GHZ; - case legacy_hal::WLAN_MAC_6_0_BAND: - return WifiBand::BAND_6GHZ; - case legacy_hal::WLAN_MAC_60_0_BAND: - return WifiBand::BAND_60GHZ; - default: - return WifiBand::BAND_UNSPECIFIED; - } -} - -uint32_t convertAidlWifiIfaceModeToLegacy(uint32_t aidl_iface_mask) { - uint32_t legacy_iface_mask = 0; - if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_STA)) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_STA); - } - if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_SOFTAP)) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_SOFTAP); - } - if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_P2P_CLIENT)) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_P2P_CLIENT); - } - if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_P2P_GO)) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_P2P_GO); - } - if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_NAN)) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_NAN); - } - if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_TDLS)) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_TDLS); - } - if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_MESH)) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_MESH); - } - if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_IBSS)) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_IBSS); - } - return legacy_iface_mask; -} - -uint32_t convertLegacyWifiInterfaceModeToAidl(uint32_t legacy_iface_mask) { - uint32_t aidl_iface_mask = 0; - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_STA)) { - aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_STA); - } - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_SOFTAP)) { - aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_SOFTAP); - } - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_P2P_CLIENT)) { - aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_P2P_CLIENT); - } - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_P2P_GO)) { - aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_P2P_GO); - } - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_NAN)) { - aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_NAN); - } - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_TDLS)) { - aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_TDLS); - } - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_MESH)) { - aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_MESH); - } - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_IBSS)) { - aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_IBSS); - } - return aidl_iface_mask; -} - -uint32_t convertAidlUsableChannelFilterToLegacy(uint32_t aidl_filter_mask) { - uint32_t legacy_filter_mask = 0; - if (aidl_filter_mask & - static_cast(IWifiChip::UsableChannelFilter::CELLULAR_COEXISTENCE)) { - legacy_filter_mask |= legacy_hal::WIFI_USABLE_CHANNEL_FILTER_CELLULAR_COEXISTENCE; - } - if (aidl_filter_mask & static_cast(IWifiChip::UsableChannelFilter::CONCURRENCY)) { - legacy_filter_mask |= legacy_hal::WIFI_USABLE_CHANNEL_FILTER_CONCURRENCY; - } - if (aidl_filter_mask & static_cast(IWifiChip::UsableChannelFilter::NAN_INSTANT_MODE)) { - legacy_filter_mask |= WIFI_USABLE_CHANNEL_FILTER_NAN_INSTANT_MODE; - } - return legacy_filter_mask; -} - -bool convertLegacyWifiUsableChannelToAidl( - const legacy_hal::wifi_usable_channel& legacy_usable_channel, - WifiUsableChannel* aidl_usable_channel) { - if (!aidl_usable_channel) { - return false; - } - *aidl_usable_channel = {}; - aidl_usable_channel->channel = legacy_usable_channel.freq; - aidl_usable_channel->channelBandwidth = - convertLegacyWifiChannelWidthToAidl(legacy_usable_channel.width); - aidl_usable_channel->ifaceModeMask = static_cast( - convertLegacyWifiInterfaceModeToAidl(legacy_usable_channel.iface_mode_mask)); - - return true; -} - -bool convertLegacyWifiUsableChannelsToAidl( - const std::vector& legacy_usable_channels, - std::vector* aidl_usable_channels) { - if (!aidl_usable_channels) { - return false; - } - *aidl_usable_channels = {}; - for (const auto& legacy_usable_channel : legacy_usable_channels) { - WifiUsableChannel aidl_usable_channel; - if (!convertLegacyWifiUsableChannelToAidl(legacy_usable_channel, &aidl_usable_channel)) { - return false; - } - aidl_usable_channels->push_back(aidl_usable_channel); - } - return true; -} - -bool convertLegacyWifiMacInfosToAidl( - const std::vector& legacy_mac_infos, - std::vector* aidl_radio_mode_infos) { - if (!aidl_radio_mode_infos) { - return false; - } - *aidl_radio_mode_infos = {}; - - for (const auto& legacy_mac_info : legacy_mac_infos) { - IWifiChipEventCallback::RadioModeInfo aidl_radio_mode_info; - if (!convertLegacyWifiMacInfoToAidl(legacy_mac_info, &aidl_radio_mode_info)) { - return false; - } - aidl_radio_mode_infos->push_back(aidl_radio_mode_info); - } - return true; -} - -bool convertLegacyFeaturesToAidlStaCapabilities(uint64_t legacy_feature_set, - uint32_t legacy_logger_feature_set, - uint32_t* aidl_caps) { - if (!aidl_caps) { - return false; - } - *aidl_caps = {}; - for (const auto feature : {legacy_hal::WIFI_LOGGER_PACKET_FATE_SUPPORTED}) { - if (feature & legacy_logger_feature_set) { - *aidl_caps |= static_cast( - convertLegacyLoggerFeatureToAidlStaIfaceCapability(feature)); - } - } - for (const auto feature : - {WIFI_FEATURE_GSCAN, WIFI_FEATURE_LINK_LAYER_STATS, WIFI_FEATURE_RSSI_MONITOR, - WIFI_FEATURE_CONTROL_ROAMING, WIFI_FEATURE_IE_WHITELIST, WIFI_FEATURE_SCAN_RAND, - WIFI_FEATURE_INFRA_5G, WIFI_FEATURE_HOTSPOT, WIFI_FEATURE_PNO, WIFI_FEATURE_TDLS, - WIFI_FEATURE_TDLS_OFFCHANNEL, WIFI_FEATURE_CONFIG_NDO, WIFI_FEATURE_MKEEP_ALIVE}) { - if (feature & legacy_feature_set) { - *aidl_caps |= - static_cast(convertLegacyFeatureToAidlStaIfaceCapability(feature)); - } - } - // There is no flag for this one in the legacy feature set. Adding it to the - // set because all the current devices support it. - *aidl_caps |= static_cast(IWifiStaIface::StaIfaceCapabilityMask::APF); - return true; -} - -bool convertLegacyApfCapabilitiesToAidl(const legacy_hal::PacketFilterCapabilities& legacy_caps, - StaApfPacketFilterCapabilities* aidl_caps) { - if (!aidl_caps) { - return false; - } - *aidl_caps = {}; - aidl_caps->version = legacy_caps.version; - aidl_caps->maxLength = legacy_caps.max_len; - return true; -} - -uint8_t convertAidlGscanReportEventFlagToLegacy( - StaBackgroundScanBucketEventReportSchemeMask aidl_flag) { - using AidlFlag = StaBackgroundScanBucketEventReportSchemeMask; - switch (aidl_flag) { - case AidlFlag::EACH_SCAN: - return REPORT_EVENTS_EACH_SCAN; - case AidlFlag::FULL_RESULTS: - return REPORT_EVENTS_FULL_RESULTS; - case AidlFlag::NO_BATCH: - return REPORT_EVENTS_NO_BATCH; - }; - CHECK(false); -} - -StaScanDataFlagMask convertLegacyGscanDataFlagToAidl(uint8_t legacy_flag) { - switch (legacy_flag) { - case legacy_hal::WIFI_SCAN_FLAG_INTERRUPTED: - return StaScanDataFlagMask::INTERRUPTED; - }; - CHECK(false) << "Unknown legacy flag: " << legacy_flag; - // To silence the compiler warning about reaching the end of non-void - // function. - return {}; -} - -bool convertLegacyGscanCapabilitiesToAidl(const legacy_hal::wifi_gscan_capabilities& legacy_caps, - StaBackgroundScanCapabilities* aidl_caps) { - if (!aidl_caps) { - return false; - } - *aidl_caps = {}; - aidl_caps->maxCacheSize = legacy_caps.max_scan_cache_size; - aidl_caps->maxBuckets = legacy_caps.max_scan_buckets; - aidl_caps->maxApCachePerScan = legacy_caps.max_ap_cache_per_scan; - aidl_caps->maxReportingThreshold = legacy_caps.max_scan_reporting_threshold; - return true; -} - -legacy_hal::wifi_band convertAidlWifiBandToLegacy(WifiBand band) { - switch (band) { - case WifiBand::BAND_UNSPECIFIED: - return legacy_hal::WIFI_BAND_UNSPECIFIED; - case WifiBand::BAND_24GHZ: - return legacy_hal::WIFI_BAND_BG; - case WifiBand::BAND_5GHZ: - return legacy_hal::WIFI_BAND_A; - case WifiBand::BAND_5GHZ_DFS: - return legacy_hal::WIFI_BAND_A_DFS; - case WifiBand::BAND_5GHZ_WITH_DFS: - return legacy_hal::WIFI_BAND_A_WITH_DFS; - case WifiBand::BAND_24GHZ_5GHZ: - return legacy_hal::WIFI_BAND_ABG; - case WifiBand::BAND_24GHZ_5GHZ_WITH_DFS: - return legacy_hal::WIFI_BAND_ABG_WITH_DFS; - default: - CHECK(false); - return {}; - }; -} - -bool convertAidlGscanParamsToLegacy(const StaBackgroundScanParameters& aidl_scan_params, - legacy_hal::wifi_scan_cmd_params* legacy_scan_params) { - if (!legacy_scan_params) { - return false; - } - *legacy_scan_params = {}; - legacy_scan_params->base_period = aidl_scan_params.basePeriodInMs; - legacy_scan_params->max_ap_per_scan = aidl_scan_params.maxApPerScan; - legacy_scan_params->report_threshold_percent = aidl_scan_params.reportThresholdPercent; - legacy_scan_params->report_threshold_num_scans = aidl_scan_params.reportThresholdNumScans; - if (aidl_scan_params.buckets.size() > MAX_BUCKETS) { - return false; - } - legacy_scan_params->num_buckets = aidl_scan_params.buckets.size(); - for (uint32_t bucket_idx = 0; bucket_idx < aidl_scan_params.buckets.size(); bucket_idx++) { - const StaBackgroundScanBucketParameters& aidl_bucket_spec = - aidl_scan_params.buckets[bucket_idx]; - legacy_hal::wifi_scan_bucket_spec& legacy_bucket_spec = - legacy_scan_params->buckets[bucket_idx]; - if (aidl_bucket_spec.bucketIdx >= MAX_BUCKETS) { - return false; - } - legacy_bucket_spec.bucket = aidl_bucket_spec.bucketIdx; - legacy_bucket_spec.band = convertAidlWifiBandToLegacy(aidl_bucket_spec.band); - legacy_bucket_spec.period = aidl_bucket_spec.periodInMs; - legacy_bucket_spec.max_period = aidl_bucket_spec.exponentialMaxPeriodInMs; - legacy_bucket_spec.base = aidl_bucket_spec.exponentialBase; - legacy_bucket_spec.step_count = aidl_bucket_spec.exponentialStepCount; - legacy_bucket_spec.report_events = 0; - using AidlFlag = StaBackgroundScanBucketEventReportSchemeMask; - for (const auto flag : {AidlFlag::EACH_SCAN, AidlFlag::FULL_RESULTS, AidlFlag::NO_BATCH}) { - if (static_cast(aidl_bucket_spec.eventReportScheme) & - static_cast::type>(flag)) { - legacy_bucket_spec.report_events |= convertAidlGscanReportEventFlagToLegacy(flag); - } - } - if (aidl_bucket_spec.frequencies.size() > MAX_CHANNELS) { - return false; - } - legacy_bucket_spec.num_channels = aidl_bucket_spec.frequencies.size(); - for (uint32_t freq_idx = 0; freq_idx < aidl_bucket_spec.frequencies.size(); freq_idx++) { - legacy_bucket_spec.channels[freq_idx].channel = aidl_bucket_spec.frequencies[freq_idx]; - } - } - return true; -} - -bool convertLegacyIeToAidl(const legacy_hal::wifi_information_element& legacy_ie, - WifiInformationElement* aidl_ie) { - if (!aidl_ie) { - return false; - } - *aidl_ie = {}; - aidl_ie->id = legacy_ie.id; - aidl_ie->data = std::vector(legacy_ie.data, legacy_ie.data + legacy_ie.len); - return true; -} - -bool convertLegacyIeBlobToAidl(const uint8_t* ie_blob, uint32_t ie_blob_len, - std::vector* aidl_ies) { - if (!ie_blob || !aidl_ies) { - return false; - } - *aidl_ies = {}; - const uint8_t* ies_begin = ie_blob; - const uint8_t* ies_end = ie_blob + ie_blob_len; - const uint8_t* next_ie = ies_begin; - using wifi_ie = legacy_hal::wifi_information_element; - constexpr size_t kIeHeaderLen = sizeof(wifi_ie); - // Each IE should at least have the header (i.e |id| & |len| fields). - while (next_ie + kIeHeaderLen <= ies_end) { - const wifi_ie& legacy_ie = (*reinterpret_cast(next_ie)); - uint32_t curr_ie_len = kIeHeaderLen + legacy_ie.len; - if (next_ie + curr_ie_len > ies_end) { - LOG(ERROR) << "Error parsing IE blob. Next IE: " << (void*)next_ie - << ", Curr IE len: " << curr_ie_len << ", IEs End: " << (void*)ies_end; - break; - } - WifiInformationElement aidl_ie; - if (!convertLegacyIeToAidl(legacy_ie, &aidl_ie)) { - LOG(ERROR) << "Error converting IE. Id: " << legacy_ie.id << ", len: " << legacy_ie.len; - break; - } - aidl_ies->push_back(std::move(aidl_ie)); - next_ie += curr_ie_len; - } - // Check if the blob has been fully consumed. - if (next_ie != ies_end) { - LOG(ERROR) << "Failed to fully parse IE blob. Next IE: " << (void*)next_ie - << ", IEs End: " << (void*)ies_end; - } - return true; -} - -bool convertLegacyGscanResultToAidl(const legacy_hal::wifi_scan_result& legacy_scan_result, - bool has_ie_data, StaScanResult* aidl_scan_result) { - if (!aidl_scan_result) { - return false; - } - *aidl_scan_result = {}; - aidl_scan_result->timeStampInUs = legacy_scan_result.ts; - aidl_scan_result->ssid = std::vector( - legacy_scan_result.ssid, - legacy_scan_result.ssid + - strnlen(legacy_scan_result.ssid, sizeof(legacy_scan_result.ssid) - 1)); - aidl_scan_result->bssid = std::array(); - std::copy(legacy_scan_result.bssid, legacy_scan_result.bssid + 6, - std::begin(aidl_scan_result->bssid)); - aidl_scan_result->frequency = legacy_scan_result.channel; - aidl_scan_result->rssi = legacy_scan_result.rssi; - aidl_scan_result->beaconPeriodInMs = legacy_scan_result.beacon_period; - aidl_scan_result->capability = legacy_scan_result.capability; - if (has_ie_data) { - std::vector ies; - if (!convertLegacyIeBlobToAidl(reinterpret_cast(legacy_scan_result.ie_data), - legacy_scan_result.ie_length, &ies)) { - return false; - } - aidl_scan_result->informationElements = std::move(ies); - } - return true; -} - -bool convertLegacyCachedGscanResultsToAidl( - const legacy_hal::wifi_cached_scan_results& legacy_cached_scan_result, - StaScanData* aidl_scan_data) { - if (!aidl_scan_data) { - return false; - } - *aidl_scan_data = {}; - int32_t flags = 0; - for (const auto flag : {legacy_hal::WIFI_SCAN_FLAG_INTERRUPTED}) { - if (legacy_cached_scan_result.flags & flag) { - flags |= static_cast::type>( - convertLegacyGscanDataFlagToAidl(flag)); - } - } - aidl_scan_data->flags = static_cast(flags); - aidl_scan_data->bucketsScanned = legacy_cached_scan_result.buckets_scanned; - - CHECK(legacy_cached_scan_result.num_results >= 0 && - legacy_cached_scan_result.num_results <= MAX_AP_CACHE_PER_SCAN); - std::vector aidl_scan_results; - for (int32_t result_idx = 0; result_idx < legacy_cached_scan_result.num_results; result_idx++) { - StaScanResult aidl_scan_result; - if (!convertLegacyGscanResultToAidl(legacy_cached_scan_result.results[result_idx], false, - &aidl_scan_result)) { - return false; - } - aidl_scan_results.push_back(aidl_scan_result); - } - aidl_scan_data->results = std::move(aidl_scan_results); - return true; -} - -bool convertLegacyVectorOfCachedGscanResultsToAidl( - const std::vector& legacy_cached_scan_results, - std::vector* aidl_scan_datas) { - if (!aidl_scan_datas) { - return false; - } - *aidl_scan_datas = {}; - for (const auto& legacy_cached_scan_result : legacy_cached_scan_results) { - StaScanData aidl_scan_data; - if (!convertLegacyCachedGscanResultsToAidl(legacy_cached_scan_result, &aidl_scan_data)) { - return false; - } - aidl_scan_datas->push_back(aidl_scan_data); - } - return true; -} - -WifiDebugTxPacketFate convertLegacyDebugTxPacketFateToAidl(legacy_hal::wifi_tx_packet_fate fate) { - switch (fate) { - case legacy_hal::TX_PKT_FATE_ACKED: - return WifiDebugTxPacketFate::ACKED; - case legacy_hal::TX_PKT_FATE_SENT: - return WifiDebugTxPacketFate::SENT; - case legacy_hal::TX_PKT_FATE_FW_QUEUED: - return WifiDebugTxPacketFate::FW_QUEUED; - case legacy_hal::TX_PKT_FATE_FW_DROP_INVALID: - return WifiDebugTxPacketFate::FW_DROP_INVALID; - case legacy_hal::TX_PKT_FATE_FW_DROP_NOBUFS: - return WifiDebugTxPacketFate::FW_DROP_NOBUFS; - case legacy_hal::TX_PKT_FATE_FW_DROP_OTHER: - return WifiDebugTxPacketFate::FW_DROP_OTHER; - case legacy_hal::TX_PKT_FATE_DRV_QUEUED: - return WifiDebugTxPacketFate::DRV_QUEUED; - case legacy_hal::TX_PKT_FATE_DRV_DROP_INVALID: - return WifiDebugTxPacketFate::DRV_DROP_INVALID; - case legacy_hal::TX_PKT_FATE_DRV_DROP_NOBUFS: - return WifiDebugTxPacketFate::DRV_DROP_NOBUFS; - case legacy_hal::TX_PKT_FATE_DRV_DROP_OTHER: - return WifiDebugTxPacketFate::DRV_DROP_OTHER; - }; - CHECK(false) << "Unknown legacy fate type: " << fate; -} - -WifiDebugRxPacketFate convertLegacyDebugRxPacketFateToAidl(legacy_hal::wifi_rx_packet_fate fate) { - switch (fate) { - case legacy_hal::RX_PKT_FATE_SUCCESS: - return WifiDebugRxPacketFate::SUCCESS; - case legacy_hal::RX_PKT_FATE_FW_QUEUED: - return WifiDebugRxPacketFate::FW_QUEUED; - case legacy_hal::RX_PKT_FATE_FW_DROP_FILTER: - return WifiDebugRxPacketFate::FW_DROP_FILTER; - case legacy_hal::RX_PKT_FATE_FW_DROP_INVALID: - return WifiDebugRxPacketFate::FW_DROP_INVALID; - case legacy_hal::RX_PKT_FATE_FW_DROP_NOBUFS: - return WifiDebugRxPacketFate::FW_DROP_NOBUFS; - case legacy_hal::RX_PKT_FATE_FW_DROP_OTHER: - return WifiDebugRxPacketFate::FW_DROP_OTHER; - case legacy_hal::RX_PKT_FATE_DRV_QUEUED: - return WifiDebugRxPacketFate::DRV_QUEUED; - case legacy_hal::RX_PKT_FATE_DRV_DROP_FILTER: - return WifiDebugRxPacketFate::DRV_DROP_FILTER; - case legacy_hal::RX_PKT_FATE_DRV_DROP_INVALID: - return WifiDebugRxPacketFate::DRV_DROP_INVALID; - case legacy_hal::RX_PKT_FATE_DRV_DROP_NOBUFS: - return WifiDebugRxPacketFate::DRV_DROP_NOBUFS; - case legacy_hal::RX_PKT_FATE_DRV_DROP_OTHER: - return WifiDebugRxPacketFate::DRV_DROP_OTHER; - }; - CHECK(false) << "Unknown legacy fate type: " << fate; -} - -WifiDebugPacketFateFrameType convertLegacyDebugPacketFateFrameTypeToAidl( - legacy_hal::frame_type type) { - switch (type) { - case legacy_hal::FRAME_TYPE_UNKNOWN: - return WifiDebugPacketFateFrameType::UNKNOWN; - case legacy_hal::FRAME_TYPE_ETHERNET_II: - return WifiDebugPacketFateFrameType::ETHERNET_II; - case legacy_hal::FRAME_TYPE_80211_MGMT: - return WifiDebugPacketFateFrameType::MGMT_80211; - }; - CHECK(false) << "Unknown legacy frame type: " << type; -} - -bool convertLegacyDebugPacketFateFrameToAidl(const legacy_hal::frame_info& legacy_frame, - WifiDebugPacketFateFrameInfo* aidl_frame) { - if (!aidl_frame) { - return false; - } - *aidl_frame = {}; - aidl_frame->frameType = convertLegacyDebugPacketFateFrameTypeToAidl(legacy_frame.payload_type); - aidl_frame->frameLen = legacy_frame.frame_len; - aidl_frame->driverTimestampUsec = legacy_frame.driver_timestamp_usec; - aidl_frame->firmwareTimestampUsec = legacy_frame.firmware_timestamp_usec; - const uint8_t* frame_begin = - reinterpret_cast(legacy_frame.frame_content.ethernet_ii_bytes); - aidl_frame->frameContent = - std::vector(frame_begin, frame_begin + legacy_frame.frame_len); - return true; -} - -bool convertLegacyDebugTxPacketFateToAidl(const legacy_hal::wifi_tx_report& legacy_fate, - WifiDebugTxPacketFateReport* aidl_fate) { - if (!aidl_fate) { - return false; - } - *aidl_fate = {}; - aidl_fate->fate = convertLegacyDebugTxPacketFateToAidl(legacy_fate.fate); - return convertLegacyDebugPacketFateFrameToAidl(legacy_fate.frame_inf, &aidl_fate->frameInfo); -} - -bool convertLegacyVectorOfDebugTxPacketFateToAidl( - const std::vector& legacy_fates, - std::vector* aidl_fates) { - if (!aidl_fates) { - return false; - } - *aidl_fates = {}; - for (const auto& legacy_fate : legacy_fates) { - WifiDebugTxPacketFateReport aidl_fate; - if (!convertLegacyDebugTxPacketFateToAidl(legacy_fate, &aidl_fate)) { - return false; - } - aidl_fates->push_back(aidl_fate); - } - return true; -} - -bool convertLegacyDebugRxPacketFateToAidl(const legacy_hal::wifi_rx_report& legacy_fate, - WifiDebugRxPacketFateReport* aidl_fate) { - if (!aidl_fate) { - return false; - } - *aidl_fate = {}; - aidl_fate->fate = convertLegacyDebugRxPacketFateToAidl(legacy_fate.fate); - return convertLegacyDebugPacketFateFrameToAidl(legacy_fate.frame_inf, &aidl_fate->frameInfo); -} - -bool convertLegacyVectorOfDebugRxPacketFateToAidl( - const std::vector& legacy_fates, - std::vector* aidl_fates) { - if (!aidl_fates) { - return false; - } - *aidl_fates = {}; - for (const auto& legacy_fate : legacy_fates) { - WifiDebugRxPacketFateReport aidl_fate; - if (!convertLegacyDebugRxPacketFateToAidl(legacy_fate, &aidl_fate)) { - return false; - } - aidl_fates->push_back(aidl_fate); - } - return true; -} - -bool convertLegacyLinkLayerRadioStatsToAidl( - const legacy_hal::LinkLayerRadioStats& legacy_radio_stat, - StaLinkLayerRadioStats* aidl_radio_stat) { - if (!aidl_radio_stat) { - return false; - } - *aidl_radio_stat = {}; - - aidl_radio_stat->radioId = legacy_radio_stat.stats.radio; - aidl_radio_stat->onTimeInMs = legacy_radio_stat.stats.on_time; - aidl_radio_stat->txTimeInMs = legacy_radio_stat.stats.tx_time; - aidl_radio_stat->rxTimeInMs = legacy_radio_stat.stats.rx_time; - aidl_radio_stat->onTimeInMsForScan = legacy_radio_stat.stats.on_time_scan; - aidl_radio_stat->txTimeInMsPerLevel = uintToIntVec(legacy_radio_stat.tx_time_per_levels); - aidl_radio_stat->onTimeInMsForNanScan = legacy_radio_stat.stats.on_time_nbd; - aidl_radio_stat->onTimeInMsForBgScan = legacy_radio_stat.stats.on_time_gscan; - aidl_radio_stat->onTimeInMsForRoamScan = legacy_radio_stat.stats.on_time_roam_scan; - aidl_radio_stat->onTimeInMsForPnoScan = legacy_radio_stat.stats.on_time_pno_scan; - aidl_radio_stat->onTimeInMsForHs20Scan = legacy_radio_stat.stats.on_time_hs20; - - std::vector aidl_channel_stats; - - for (const auto& channel_stat : legacy_radio_stat.channel_stats) { - WifiChannelStats aidl_channel_stat; - aidl_channel_stat.onTimeInMs = channel_stat.on_time; - aidl_channel_stat.ccaBusyTimeInMs = channel_stat.cca_busy_time; - aidl_channel_stat.channel.width = WifiChannelWidthInMhz::WIDTH_20; - aidl_channel_stat.channel.centerFreq = channel_stat.channel.center_freq; - aidl_channel_stat.channel.centerFreq0 = channel_stat.channel.center_freq0; - aidl_channel_stat.channel.centerFreq1 = channel_stat.channel.center_freq1; - aidl_channel_stats.push_back(aidl_channel_stat); - } - - aidl_radio_stat->channelStats = aidl_channel_stats; - - return true; -} - -bool convertLegacyLinkLayerStatsToAidl(const legacy_hal::LinkLayerStats& legacy_stats, - StaLinkLayerStats* aidl_stats) { - if (!aidl_stats) { - return false; - } - *aidl_stats = {}; - // iface legacy_stats conversion. - aidl_stats->iface.beaconRx = legacy_stats.iface.beacon_rx; - aidl_stats->iface.avgRssiMgmt = legacy_stats.iface.rssi_mgmt; - aidl_stats->iface.wmeBePktStats.rxMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].rx_mpdu; - aidl_stats->iface.wmeBePktStats.txMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].tx_mpdu; - aidl_stats->iface.wmeBePktStats.lostMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].mpdu_lost; - aidl_stats->iface.wmeBePktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].retries; - aidl_stats->iface.wmeBeContentionTimeStats.contentionTimeMinInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_min; - aidl_stats->iface.wmeBeContentionTimeStats.contentionTimeMaxInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_max; - aidl_stats->iface.wmeBeContentionTimeStats.contentionTimeAvgInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_avg; - aidl_stats->iface.wmeBeContentionTimeStats.contentionNumSamples = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_num_samples; - aidl_stats->iface.wmeBkPktStats.rxMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].rx_mpdu; - aidl_stats->iface.wmeBkPktStats.txMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].tx_mpdu; - aidl_stats->iface.wmeBkPktStats.lostMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].mpdu_lost; - aidl_stats->iface.wmeBkPktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].retries; - aidl_stats->iface.wmeBkContentionTimeStats.contentionTimeMinInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_min; - aidl_stats->iface.wmeBkContentionTimeStats.contentionTimeMaxInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_max; - aidl_stats->iface.wmeBkContentionTimeStats.contentionTimeAvgInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_avg; - aidl_stats->iface.wmeBkContentionTimeStats.contentionNumSamples = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_num_samples; - aidl_stats->iface.wmeViPktStats.rxMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].rx_mpdu; - aidl_stats->iface.wmeViPktStats.txMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].tx_mpdu; - aidl_stats->iface.wmeViPktStats.lostMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].mpdu_lost; - aidl_stats->iface.wmeViPktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].retries; - aidl_stats->iface.wmeViContentionTimeStats.contentionTimeMinInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_min; - aidl_stats->iface.wmeViContentionTimeStats.contentionTimeMaxInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_max; - aidl_stats->iface.wmeViContentionTimeStats.contentionTimeAvgInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_avg; - aidl_stats->iface.wmeViContentionTimeStats.contentionNumSamples = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_num_samples; - aidl_stats->iface.wmeVoPktStats.rxMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].rx_mpdu; - aidl_stats->iface.wmeVoPktStats.txMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].tx_mpdu; - aidl_stats->iface.wmeVoPktStats.lostMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].mpdu_lost; - aidl_stats->iface.wmeVoPktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].retries; - aidl_stats->iface.wmeVoContentionTimeStats.contentionTimeMinInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_min; - aidl_stats->iface.wmeVoContentionTimeStats.contentionTimeMaxInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_max; - aidl_stats->iface.wmeVoContentionTimeStats.contentionTimeAvgInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_avg; - aidl_stats->iface.wmeVoContentionTimeStats.contentionNumSamples = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_num_samples; - aidl_stats->iface.timeSliceDutyCycleInPercent = - legacy_stats.iface.info.time_slicing_duty_cycle_percent; - // peer info legacy_stats conversion. - std::vector aidl_peers_info_stats; - for (const auto& legacy_peer_info_stats : legacy_stats.peers) { - StaPeerInfo aidl_peer_info_stats; - if (!convertLegacyPeerInfoStatsToAidl(legacy_peer_info_stats, &aidl_peer_info_stats)) { - return false; - } - aidl_peers_info_stats.push_back(aidl_peer_info_stats); - } - aidl_stats->iface.peers = aidl_peers_info_stats; - // radio legacy_stats conversion. - std::vector aidl_radios_stats; - for (const auto& legacy_radio_stats : legacy_stats.radios) { - StaLinkLayerRadioStats aidl_radio_stats; - if (!convertLegacyLinkLayerRadioStatsToAidl(legacy_radio_stats, &aidl_radio_stats)) { - return false; - } - aidl_radios_stats.push_back(aidl_radio_stats); - } - aidl_stats->radios = aidl_radios_stats; - aidl_stats->timeStampInMs = ::android::uptimeMillis(); - return true; -} - -bool convertLegacyPeerInfoStatsToAidl(const legacy_hal::WifiPeerInfo& legacy_peer_info_stats, - StaPeerInfo* aidl_peer_info_stats) { - if (!aidl_peer_info_stats) { - return false; - } - *aidl_peer_info_stats = {}; - aidl_peer_info_stats->staCount = legacy_peer_info_stats.peer_info.bssload.sta_count; - aidl_peer_info_stats->chanUtil = legacy_peer_info_stats.peer_info.bssload.chan_util; - - std::vector aidlRateStats; - for (const auto& legacy_rate_stats : legacy_peer_info_stats.rate_stats) { - StaRateStat rateStat; - if (!convertLegacyWifiRateInfoToAidl(legacy_rate_stats.rate, &rateStat.rateInfo)) { - return false; - } - rateStat.txMpdu = legacy_rate_stats.tx_mpdu; - rateStat.rxMpdu = legacy_rate_stats.rx_mpdu; - rateStat.mpduLost = legacy_rate_stats.mpdu_lost; - rateStat.retries = legacy_rate_stats.retries; - aidlRateStats.push_back(rateStat); - } - aidl_peer_info_stats->rateStats = aidlRateStats; - return true; -} - -bool convertLegacyRoamingCapabilitiesToAidl( - const legacy_hal::wifi_roaming_capabilities& legacy_caps, - StaRoamingCapabilities* aidl_caps) { - if (!aidl_caps) { - return false; - } - *aidl_caps = {}; - aidl_caps->maxBlocklistSize = legacy_caps.max_blacklist_size; - aidl_caps->maxAllowlistSize = legacy_caps.max_whitelist_size; - return true; -} - -bool convertAidlRoamingConfigToLegacy(const StaRoamingConfig& aidl_config, - legacy_hal::wifi_roaming_config* legacy_config) { - if (!legacy_config) { - return false; - } - *legacy_config = {}; - if (aidl_config.bssidBlocklist.size() > MAX_BLACKLIST_BSSID || - aidl_config.ssidAllowlist.size() > MAX_WHITELIST_SSID) { - return false; - } - legacy_config->num_blacklist_bssid = aidl_config.bssidBlocklist.size(); - uint32_t i = 0; - for (const auto& bssid : aidl_config.bssidBlocklist) { - CHECK(bssid.data.size() == sizeof(legacy_hal::mac_addr)); - memcpy(legacy_config->blacklist_bssid[i++], bssid.data.data(), bssid.data.size()); - } - legacy_config->num_whitelist_ssid = aidl_config.ssidAllowlist.size(); - i = 0; - for (const auto& ssid : aidl_config.ssidAllowlist) { - CHECK(ssid.data.size() <= sizeof(legacy_hal::ssid_t::ssid_str)); - legacy_config->whitelist_ssid[i].length = ssid.data.size(); - memcpy(legacy_config->whitelist_ssid[i].ssid_str, ssid.data.data(), ssid.data.size()); - i++; - } - return true; -} - -legacy_hal::fw_roaming_state_t convertAidlRoamingStateToLegacy(StaRoamingState state) { - switch (state) { - case StaRoamingState::ENABLED: - return legacy_hal::ROAMING_ENABLE; - case StaRoamingState::DISABLED: - return legacy_hal::ROAMING_DISABLE; - }; - CHECK(false); -} - -legacy_hal::NanMatchAlg convertAidlNanMatchAlgToLegacy(NanMatchAlg type) { - switch (type) { - case NanMatchAlg::MATCH_ONCE: - return legacy_hal::NAN_MATCH_ALG_MATCH_ONCE; - case NanMatchAlg::MATCH_CONTINUOUS: - return legacy_hal::NAN_MATCH_ALG_MATCH_CONTINUOUS; - case NanMatchAlg::MATCH_NEVER: - return legacy_hal::NAN_MATCH_ALG_MATCH_NEVER; - } - CHECK(false); -} - -legacy_hal::NanPublishType convertAidlNanPublishTypeToLegacy(NanPublishType type) { - switch (type) { - case NanPublishType::UNSOLICITED: - return legacy_hal::NAN_PUBLISH_TYPE_UNSOLICITED; - case NanPublishType::SOLICITED: - return legacy_hal::NAN_PUBLISH_TYPE_SOLICITED; - case NanPublishType::UNSOLICITED_SOLICITED: - return legacy_hal::NAN_PUBLISH_TYPE_UNSOLICITED_SOLICITED; - } - CHECK(false); -} - -legacy_hal::NanTxType convertAidlNanTxTypeToLegacy(NanTxType type) { - switch (type) { - case NanTxType::BROADCAST: - return legacy_hal::NAN_TX_TYPE_BROADCAST; - case NanTxType::UNICAST: - return legacy_hal::NAN_TX_TYPE_UNICAST; - } - CHECK(false); -} - -legacy_hal::NanSubscribeType convertAidlNanSubscribeTypeToLegacy(NanSubscribeType type) { - switch (type) { - case NanSubscribeType::PASSIVE: - return legacy_hal::NAN_SUBSCRIBE_TYPE_PASSIVE; - case NanSubscribeType::ACTIVE: - return legacy_hal::NAN_SUBSCRIBE_TYPE_ACTIVE; - } - CHECK(false); -} - -legacy_hal::NanSRFType convertAidlNanSrfTypeToLegacy(NanSrfType type) { - switch (type) { - case NanSrfType::BLOOM_FILTER: - return legacy_hal::NAN_SRF_ATTR_BLOOM_FILTER; - case NanSrfType::PARTIAL_MAC_ADDR: - return legacy_hal::NAN_SRF_ATTR_PARTIAL_MAC_ADDR; - } - CHECK(false); -} - -legacy_hal::NanDataPathChannelCfg convertAidlNanDataPathChannelCfgToLegacy( - NanDataPathChannelCfg type) { - switch (type) { - case NanDataPathChannelCfg::CHANNEL_NOT_REQUESTED: - return legacy_hal::NAN_DP_CHANNEL_NOT_REQUESTED; - case NanDataPathChannelCfg::REQUEST_CHANNEL_SETUP: - return legacy_hal::NAN_DP_REQUEST_CHANNEL_SETUP; - case NanDataPathChannelCfg::FORCE_CHANNEL_SETUP: - return legacy_hal::NAN_DP_FORCE_CHANNEL_SETUP; - } - CHECK(false); -} - -NanStatusCode convertLegacyNanStatusTypeToAidl(legacy_hal::NanStatusType type) { - switch (type) { - case legacy_hal::NAN_STATUS_SUCCESS: - return NanStatusCode::SUCCESS; - case legacy_hal::NAN_STATUS_INTERNAL_FAILURE: - return NanStatusCode::INTERNAL_FAILURE; - case legacy_hal::NAN_STATUS_PROTOCOL_FAILURE: - return NanStatusCode::PROTOCOL_FAILURE; - case legacy_hal::NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID: - return NanStatusCode::INVALID_SESSION_ID; - case legacy_hal::NAN_STATUS_NO_RESOURCE_AVAILABLE: - return NanStatusCode::NO_RESOURCES_AVAILABLE; - case legacy_hal::NAN_STATUS_INVALID_PARAM: - return NanStatusCode::INVALID_ARGS; - case legacy_hal::NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID: - return NanStatusCode::INVALID_PEER_ID; - case legacy_hal::NAN_STATUS_INVALID_NDP_ID: - return NanStatusCode::INVALID_NDP_ID; - case legacy_hal::NAN_STATUS_NAN_NOT_ALLOWED: - return NanStatusCode::NAN_NOT_ALLOWED; - case legacy_hal::NAN_STATUS_NO_OTA_ACK: - return NanStatusCode::NO_OTA_ACK; - case legacy_hal::NAN_STATUS_ALREADY_ENABLED: - return NanStatusCode::ALREADY_ENABLED; - case legacy_hal::NAN_STATUS_FOLLOWUP_QUEUE_FULL: - return NanStatusCode::FOLLOWUP_TX_QUEUE_FULL; - case legacy_hal::NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED: - return NanStatusCode::UNSUPPORTED_CONCURRENCY_NAN_DISABLED; - } - CHECK(false); -} - -void convertToNanStatus(legacy_hal::NanStatusType type, const char* str, size_t max_len, - NanStatus* nanStatus) { - nanStatus->status = convertLegacyNanStatusTypeToAidl(type); - nanStatus->description = safeConvertChar(str, max_len); -} - -bool convertAidlNanEnableRequestToLegacy(const NanEnableRequest& aidl_request1, - const NanConfigRequestSupplemental& aidl_request2, - legacy_hal::NanEnableRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertAidlNanEnableRequestToLegacy: null legacy_request"; - return false; - } - *legacy_request = {}; - - legacy_request->config_2dot4g_support = 1; - legacy_request->support_2dot4g_val = - aidl_request1.operateInBand[(size_t)NanBandIndex::NAN_BAND_24GHZ]; - legacy_request->config_support_5g = 1; - legacy_request->support_5g_val = - aidl_request1.operateInBand[(size_t)NanBandIndex::NAN_BAND_5GHZ]; - legacy_request->config_hop_count_limit = 1; - legacy_request->hop_count_limit_val = aidl_request1.hopCountMax; - legacy_request->master_pref = aidl_request1.configParams.masterPref; - legacy_request->discovery_indication_cfg = 0; - legacy_request->discovery_indication_cfg |= - aidl_request1.configParams.disableDiscoveryAddressChangeIndication ? 0x1 : 0x0; - legacy_request->discovery_indication_cfg |= - aidl_request1.configParams.disableStartedClusterIndication ? 0x2 : 0x0; - legacy_request->discovery_indication_cfg |= - aidl_request1.configParams.disableJoinedClusterIndication ? 0x4 : 0x0; - legacy_request->config_sid_beacon = 1; - if (aidl_request1.configParams.numberOfPublishServiceIdsInBeacon < 0) { - LOG(ERROR) << "convertAidlNanEnableRequestToLegacy: " - "numberOfPublishServiceIdsInBeacon < 0"; - return false; - } - legacy_request->sid_beacon_val = - (aidl_request1.configParams.includePublishServiceIdsInBeacon ? 0x1 : 0x0) | - (aidl_request1.configParams.numberOfPublishServiceIdsInBeacon << 1); - legacy_request->config_subscribe_sid_beacon = 1; - if (aidl_request1.configParams.numberOfSubscribeServiceIdsInBeacon < 0) { - LOG(ERROR) << "convertAidlNanEnableRequestToLegacy: " - "numberOfSubscribeServiceIdsInBeacon < 0"; - return false; - } - legacy_request->subscribe_sid_beacon_val = - (aidl_request1.configParams.includeSubscribeServiceIdsInBeacon ? 0x1 : 0x0) | - (aidl_request1.configParams.numberOfSubscribeServiceIdsInBeacon << 1); - legacy_request->config_rssi_window_size = 1; - legacy_request->rssi_window_size_val = aidl_request1.configParams.rssiWindowSize; - legacy_request->config_disc_mac_addr_randomization = 1; - legacy_request->disc_mac_addr_rand_interval_sec = - aidl_request1.configParams.macAddressRandomizationIntervalSec; - legacy_request->config_2dot4g_rssi_close = 1; - if (aidl_request1.configParams.bandSpecificConfig.size() != 3) { - LOG(ERROR) << "convertAidlNanEnableRequestToLegacy: " - "bandSpecificConfig.size() != 3"; - return false; - } - legacy_request->rssi_close_2dot4g_val = - aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .rssiClose; - legacy_request->config_2dot4g_rssi_middle = 1; - legacy_request->rssi_middle_2dot4g_val = - aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .rssiMiddle; - legacy_request->config_2dot4g_rssi_proximity = 1; - legacy_request->rssi_proximity_2dot4g_val = - aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .rssiCloseProximity; - legacy_request->config_scan_params = 1; - legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_24G_BAND] = - aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .dwellTimeMs; - legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_24G_BAND] = - aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .scanPeriodSec; - legacy_request->config_dw.config_2dot4g_dw_band = - aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .validDiscoveryWindowIntervalVal; - legacy_request->config_dw.dw_2dot4g_interval_val = - aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .discoveryWindowIntervalVal; - legacy_request->config_5g_rssi_close = 1; - legacy_request->rssi_close_5g_val = - aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .rssiClose; - legacy_request->config_5g_rssi_middle = 1; - legacy_request->rssi_middle_5g_val = - aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .rssiMiddle; - legacy_request->config_5g_rssi_close_proximity = 1; - legacy_request->rssi_close_proximity_5g_val = - aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .rssiCloseProximity; - legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = - aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .dwellTimeMs; - legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = - aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .scanPeriodSec; - legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = - aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .dwellTimeMs; - legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = - aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .scanPeriodSec; - legacy_request->config_dw.config_5g_dw_band = - aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .validDiscoveryWindowIntervalVal; - legacy_request->config_dw.dw_5g_interval_val = - aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .discoveryWindowIntervalVal; - if (aidl_request1.debugConfigs.validClusterIdVals) { - legacy_request->cluster_low = aidl_request1.debugConfigs.clusterIdBottomRangeVal; - legacy_request->cluster_high = aidl_request1.debugConfigs.clusterIdTopRangeVal; - } else { // need 'else' since not configurable in legacy HAL - legacy_request->cluster_low = 0x0000; - legacy_request->cluster_high = 0xFFFF; - } - legacy_request->config_intf_addr = aidl_request1.debugConfigs.validIntfAddrVal; - memcpy(legacy_request->intf_addr_val, aidl_request1.debugConfigs.intfAddrVal.data(), 6); - legacy_request->config_oui = aidl_request1.debugConfigs.validOuiVal; - legacy_request->oui_val = aidl_request1.debugConfigs.ouiVal; - legacy_request->config_random_factor_force = - aidl_request1.debugConfigs.validRandomFactorForceVal; - legacy_request->random_factor_force_val = aidl_request1.debugConfigs.randomFactorForceVal; - legacy_request->config_hop_count_force = aidl_request1.debugConfigs.validHopCountForceVal; - legacy_request->hop_count_force_val = aidl_request1.debugConfigs.hopCountForceVal; - legacy_request->config_24g_channel = aidl_request1.debugConfigs.validDiscoveryChannelVal; - legacy_request->channel_24g_val = - aidl_request1.debugConfigs.discoveryChannelMhzVal[(size_t)NanBandIndex::NAN_BAND_24GHZ]; - legacy_request->config_5g_channel = aidl_request1.debugConfigs.validDiscoveryChannelVal; - legacy_request->channel_5g_val = - aidl_request1.debugConfigs.discoveryChannelMhzVal[(size_t)NanBandIndex::NAN_BAND_5GHZ]; - legacy_request->config_2dot4g_beacons = aidl_request1.debugConfigs.validUseBeaconsInBandVal; - legacy_request->beacon_2dot4g_val = - aidl_request1.debugConfigs.useBeaconsInBandVal[(size_t)NanBandIndex::NAN_BAND_24GHZ]; - legacy_request->config_5g_beacons = aidl_request1.debugConfigs.validUseBeaconsInBandVal; - legacy_request->beacon_5g_val = - aidl_request1.debugConfigs.useBeaconsInBandVal[(size_t)NanBandIndex::NAN_BAND_5GHZ]; - legacy_request->config_2dot4g_sdf = aidl_request1.debugConfigs.validUseSdfInBandVal; - legacy_request->sdf_2dot4g_val = - aidl_request1.debugConfigs.useSdfInBandVal[(size_t)NanBandIndex::NAN_BAND_24GHZ]; - legacy_request->config_5g_sdf = aidl_request1.debugConfigs.validUseSdfInBandVal; - legacy_request->sdf_5g_val = - aidl_request1.debugConfigs.useSdfInBandVal[(size_t)NanBandIndex::NAN_BAND_5GHZ]; - - legacy_request->config_discovery_beacon_int = 1; - legacy_request->discovery_beacon_interval = aidl_request2.discoveryBeaconIntervalMs; - legacy_request->config_nss = 1; - legacy_request->nss = aidl_request2.numberOfSpatialStreamsInDiscovery; - legacy_request->config_dw_early_termination = 1; - legacy_request->enable_dw_termination = aidl_request2.enableDiscoveryWindowEarlyTermination; - legacy_request->config_enable_ranging = 1; - legacy_request->enable_ranging = aidl_request2.enableRanging; - - legacy_request->config_enable_instant_mode = 1; - legacy_request->enable_instant_mode = aidl_request2.enableInstantCommunicationMode; - legacy_request->config_instant_mode_channel = 1; - legacy_request->instant_mode_channel = aidl_request2.instantModeChannel; - - return true; -} - -bool convertAidlNanConfigRequestToLegacy(const NanConfigRequest& aidl_request1, - const NanConfigRequestSupplemental& aidl_request2, - legacy_hal::NanConfigRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertAidlNanConfigRequestToLegacy: null legacy_request"; - return false; - } - *legacy_request = {}; - - legacy_request->master_pref = aidl_request1.masterPref; - legacy_request->discovery_indication_cfg = 0; - legacy_request->discovery_indication_cfg |= - aidl_request1.disableDiscoveryAddressChangeIndication ? 0x1 : 0x0; - legacy_request->discovery_indication_cfg |= - aidl_request1.disableStartedClusterIndication ? 0x2 : 0x0; - legacy_request->discovery_indication_cfg |= - aidl_request1.disableJoinedClusterIndication ? 0x4 : 0x0; - legacy_request->config_sid_beacon = 1; - if (aidl_request1.numberOfPublishServiceIdsInBeacon < 0) { - LOG(ERROR) << "convertAidlNanConfigRequestToLegacy: " - "numberOfPublishServiceIdsInBeacon < 0"; - return false; - } - legacy_request->sid_beacon = (aidl_request1.includePublishServiceIdsInBeacon ? 0x1 : 0x0) | - (aidl_request1.numberOfPublishServiceIdsInBeacon << 1); - legacy_request->config_subscribe_sid_beacon = 1; - if (aidl_request1.numberOfSubscribeServiceIdsInBeacon < 0) { - LOG(ERROR) << "convertAidlNanConfigRequestToLegacy: " - "numberOfSubscribeServiceIdsInBeacon < 0"; - return false; - } - legacy_request->subscribe_sid_beacon_val = - (aidl_request1.includeSubscribeServiceIdsInBeacon ? 0x1 : 0x0) | - (aidl_request1.numberOfSubscribeServiceIdsInBeacon << 1); - legacy_request->config_rssi_window_size = 1; - legacy_request->rssi_window_size_val = aidl_request1.rssiWindowSize; - legacy_request->config_disc_mac_addr_randomization = 1; - legacy_request->disc_mac_addr_rand_interval_sec = - aidl_request1.macAddressRandomizationIntervalSec; - - legacy_request->config_scan_params = 1; - legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_24G_BAND] = - aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ].dwellTimeMs; - legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_24G_BAND] = - aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ].scanPeriodSec; - legacy_request->config_dw.config_2dot4g_dw_band = - aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .validDiscoveryWindowIntervalVal; - legacy_request->config_dw.dw_2dot4g_interval_val = - aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .discoveryWindowIntervalVal; - - legacy_request->config_5g_rssi_close_proximity = 1; - legacy_request->rssi_close_proximity_5g_val = - aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .rssiCloseProximity; - legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = - aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].dwellTimeMs; - legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = - aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].scanPeriodSec; - legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = - aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].dwellTimeMs; - legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = - aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].scanPeriodSec; - legacy_request->config_dw.config_5g_dw_band = - aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .validDiscoveryWindowIntervalVal; - legacy_request->config_dw.dw_5g_interval_val = - aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .discoveryWindowIntervalVal; - - legacy_request->config_discovery_beacon_int = 1; - legacy_request->discovery_beacon_interval = aidl_request2.discoveryBeaconIntervalMs; - legacy_request->config_nss = 1; - legacy_request->nss = aidl_request2.numberOfSpatialStreamsInDiscovery; - legacy_request->config_dw_early_termination = 1; - legacy_request->enable_dw_termination = aidl_request2.enableDiscoveryWindowEarlyTermination; - legacy_request->config_enable_ranging = 1; - legacy_request->enable_ranging = aidl_request2.enableRanging; - - legacy_request->config_enable_instant_mode = 1; - legacy_request->enable_instant_mode = aidl_request2.enableInstantCommunicationMode; - legacy_request->config_instant_mode_channel = 1; - legacy_request->instant_mode_channel = aidl_request2.instantModeChannel; - - return true; -} - -bool convertAidlNanPublishRequestToLegacy(const NanPublishRequest& aidl_request, - legacy_hal::NanPublishRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: null legacy_request"; - return false; - } - *legacy_request = {}; - - legacy_request->publish_id = aidl_request.baseConfigs.sessionId; - legacy_request->ttl = aidl_request.baseConfigs.ttlSec; - legacy_request->period = aidl_request.baseConfigs.discoveryWindowPeriod; - legacy_request->publish_count = aidl_request.baseConfigs.discoveryCount; - legacy_request->service_name_len = aidl_request.baseConfigs.serviceName.size(); - if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { - LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: service_name_len " - "too large"; - return false; - } - memcpy(legacy_request->service_name, aidl_request.baseConfigs.serviceName.data(), - legacy_request->service_name_len); - legacy_request->publish_match_indicator = - convertAidlNanMatchAlgToLegacy(aidl_request.baseConfigs.discoveryMatchIndicator); - legacy_request->service_specific_info_len = aidl_request.baseConfigs.serviceSpecificInfo.size(); - if (legacy_request->service_specific_info_len > NAN_MAX_SERVICE_SPECIFIC_INFO_LEN) { - LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: " - "service_specific_info_len too large"; - return false; - } - memcpy(legacy_request->service_specific_info, - aidl_request.baseConfigs.serviceSpecificInfo.data(), - legacy_request->service_specific_info_len); - legacy_request->sdea_service_specific_info_len = - aidl_request.baseConfigs.extendedServiceSpecificInfo.size(); - if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) { - LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: " - "sdea_service_specific_info_len too large"; - return false; - } - memcpy(legacy_request->sdea_service_specific_info, - aidl_request.baseConfigs.extendedServiceSpecificInfo.data(), - legacy_request->sdea_service_specific_info_len); - legacy_request->rx_match_filter_len = aidl_request.baseConfigs.rxMatchFilter.size(); - if (legacy_request->rx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { - LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: " - "rx_match_filter_len too large"; - return false; - } - memcpy(legacy_request->rx_match_filter, aidl_request.baseConfigs.rxMatchFilter.data(), - legacy_request->rx_match_filter_len); - legacy_request->tx_match_filter_len = aidl_request.baseConfigs.txMatchFilter.size(); - if (legacy_request->tx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { - LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: " - "tx_match_filter_len too large"; - return false; - } - memcpy(legacy_request->tx_match_filter, aidl_request.baseConfigs.txMatchFilter.data(), - legacy_request->tx_match_filter_len); - legacy_request->rssi_threshold_flag = aidl_request.baseConfigs.useRssiThreshold; - legacy_request->recv_indication_cfg = 0; - legacy_request->recv_indication_cfg |= - aidl_request.baseConfigs.disableDiscoveryTerminationIndication ? 0x1 : 0x0; - legacy_request->recv_indication_cfg |= - aidl_request.baseConfigs.disableMatchExpirationIndication ? 0x2 : 0x0; - legacy_request->recv_indication_cfg |= - aidl_request.baseConfigs.disableFollowupReceivedIndication ? 0x4 : 0x0; - legacy_request->recv_indication_cfg |= 0x8; - legacy_request->cipher_type = (unsigned int)aidl_request.baseConfigs.securityConfig.cipherType; - - legacy_request->scid_len = aidl_request.baseConfigs.securityConfig.scid.size(); - if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) { - LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: scid_len too large"; - return false; - } - memcpy(legacy_request->scid, aidl_request.baseConfigs.securityConfig.scid.data(), - legacy_request->scid_len); - - if (aidl_request.baseConfigs.securityConfig.securityType == NanDataPathSecurityType::PMK) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; - legacy_request->key_info.body.pmk_info.pmk_len = - aidl_request.baseConfigs.securityConfig.pmk.size(); - if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { - LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: invalid pmk_len"; - return false; - } - memcpy(legacy_request->key_info.body.pmk_info.pmk, - aidl_request.baseConfigs.securityConfig.pmk.data(), - legacy_request->key_info.body.pmk_info.pmk_len); - } - if (aidl_request.baseConfigs.securityConfig.securityType == - NanDataPathSecurityType::PASSPHRASE) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; - legacy_request->key_info.body.passphrase_info.passphrase_len = - aidl_request.baseConfigs.securityConfig.passphrase.size(); - if (legacy_request->key_info.body.passphrase_info.passphrase_len < - NAN_SECURITY_MIN_PASSPHRASE_LEN) { - LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: " - "passphrase_len too small"; - return false; - } - if (legacy_request->key_info.body.passphrase_info.passphrase_len > - NAN_SECURITY_MAX_PASSPHRASE_LEN) { - LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: " - "passphrase_len too large"; - return false; - } - memcpy(legacy_request->key_info.body.passphrase_info.passphrase, - aidl_request.baseConfigs.securityConfig.passphrase.data(), - legacy_request->key_info.body.passphrase_info.passphrase_len); - } - legacy_request->sdea_params.security_cfg = - (aidl_request.baseConfigs.securityConfig.securityType != NanDataPathSecurityType::OPEN) - ? legacy_hal::NAN_DP_CONFIG_SECURITY - : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; - - legacy_request->sdea_params.ranging_state = aidl_request.baseConfigs.rangingRequired - ? legacy_hal::NAN_RANGING_ENABLE - : legacy_hal::NAN_RANGING_DISABLE; - legacy_request->ranging_cfg.ranging_interval_msec = aidl_request.baseConfigs.rangingIntervalMs; - legacy_request->ranging_cfg.config_ranging_indications = - static_cast(aidl_request.baseConfigs.configRangingIndications); - legacy_request->ranging_cfg.distance_ingress_mm = - aidl_request.baseConfigs.distanceIngressCm * 10; - legacy_request->ranging_cfg.distance_egress_mm = aidl_request.baseConfigs.distanceEgressCm * 10; - legacy_request->ranging_auto_response = aidl_request.baseConfigs.rangingRequired - ? legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE - : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE; - legacy_request->sdea_params.range_report = legacy_hal::NAN_DISABLE_RANGE_REPORT; - legacy_request->publish_type = convertAidlNanPublishTypeToLegacy(aidl_request.publishType); - legacy_request->tx_type = convertAidlNanTxTypeToLegacy(aidl_request.txType); - legacy_request->service_responder_policy = aidl_request.autoAcceptDataPathRequests - ? legacy_hal::NAN_SERVICE_ACCEPT_POLICY_ALL - : legacy_hal::NAN_SERVICE_ACCEPT_POLICY_NONE; - - return true; -} - -bool convertAidlNanSubscribeRequestToLegacy(const NanSubscribeRequest& aidl_request, - legacy_hal::NanSubscribeRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: legacy_request is null"; - return false; - } - *legacy_request = {}; - - legacy_request->subscribe_id = aidl_request.baseConfigs.sessionId; - legacy_request->ttl = aidl_request.baseConfigs.ttlSec; - legacy_request->period = aidl_request.baseConfigs.discoveryWindowPeriod; - legacy_request->subscribe_count = aidl_request.baseConfigs.discoveryCount; - legacy_request->service_name_len = aidl_request.baseConfigs.serviceName.size(); - if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { - LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " - "service_name_len too large"; - return false; - } - memcpy(legacy_request->service_name, aidl_request.baseConfigs.serviceName.data(), - legacy_request->service_name_len); - legacy_request->subscribe_match_indicator = - convertAidlNanMatchAlgToLegacy(aidl_request.baseConfigs.discoveryMatchIndicator); - legacy_request->service_specific_info_len = aidl_request.baseConfigs.serviceSpecificInfo.size(); - if (legacy_request->service_specific_info_len > NAN_MAX_SERVICE_SPECIFIC_INFO_LEN) { - LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " - "service_specific_info_len too large"; - return false; - } - memcpy(legacy_request->service_specific_info, - aidl_request.baseConfigs.serviceSpecificInfo.data(), - legacy_request->service_specific_info_len); - legacy_request->sdea_service_specific_info_len = - aidl_request.baseConfigs.extendedServiceSpecificInfo.size(); - if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) { - LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " - "sdea_service_specific_info_len too large"; - return false; - } - memcpy(legacy_request->sdea_service_specific_info, - aidl_request.baseConfigs.extendedServiceSpecificInfo.data(), - legacy_request->sdea_service_specific_info_len); - legacy_request->rx_match_filter_len = aidl_request.baseConfigs.rxMatchFilter.size(); - if (legacy_request->rx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { - LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " - "rx_match_filter_len too large"; - return false; - } - memcpy(legacy_request->rx_match_filter, aidl_request.baseConfigs.rxMatchFilter.data(), - legacy_request->rx_match_filter_len); - legacy_request->tx_match_filter_len = aidl_request.baseConfigs.txMatchFilter.size(); - if (legacy_request->tx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { - LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " - "tx_match_filter_len too large"; - return false; - } - memcpy(legacy_request->tx_match_filter, aidl_request.baseConfigs.txMatchFilter.data(), - legacy_request->tx_match_filter_len); - legacy_request->rssi_threshold_flag = aidl_request.baseConfigs.useRssiThreshold; - legacy_request->recv_indication_cfg = 0; - legacy_request->recv_indication_cfg |= - aidl_request.baseConfigs.disableDiscoveryTerminationIndication ? 0x1 : 0x0; - legacy_request->recv_indication_cfg |= - aidl_request.baseConfigs.disableMatchExpirationIndication ? 0x2 : 0x0; - legacy_request->recv_indication_cfg |= - aidl_request.baseConfigs.disableFollowupReceivedIndication ? 0x4 : 0x0; - legacy_request->cipher_type = (unsigned int)aidl_request.baseConfigs.securityConfig.cipherType; - if (aidl_request.baseConfigs.securityConfig.securityType == NanDataPathSecurityType::PMK) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; - legacy_request->key_info.body.pmk_info.pmk_len = - aidl_request.baseConfigs.securityConfig.pmk.size(); - if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { - LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: invalid pmk_len"; - return false; - } - memcpy(legacy_request->key_info.body.pmk_info.pmk, - aidl_request.baseConfigs.securityConfig.pmk.data(), - legacy_request->key_info.body.pmk_info.pmk_len); - } - if (aidl_request.baseConfigs.securityConfig.securityType == - NanDataPathSecurityType::PASSPHRASE) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; - legacy_request->key_info.body.passphrase_info.passphrase_len = - aidl_request.baseConfigs.securityConfig.passphrase.size(); - if (legacy_request->key_info.body.passphrase_info.passphrase_len < - NAN_SECURITY_MIN_PASSPHRASE_LEN) { - LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " - "passphrase_len too small"; - return false; - } - if (legacy_request->key_info.body.passphrase_info.passphrase_len > - NAN_SECURITY_MAX_PASSPHRASE_LEN) { - LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " - "passphrase_len too large"; - return false; - } - memcpy(legacy_request->key_info.body.passphrase_info.passphrase, - aidl_request.baseConfigs.securityConfig.passphrase.data(), - legacy_request->key_info.body.passphrase_info.passphrase_len); - } - legacy_request->sdea_params.security_cfg = - (aidl_request.baseConfigs.securityConfig.securityType != NanDataPathSecurityType::OPEN) - ? legacy_hal::NAN_DP_CONFIG_SECURITY - : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; - legacy_request->sdea_params.ranging_state = aidl_request.baseConfigs.rangingRequired - ? legacy_hal::NAN_RANGING_ENABLE - : legacy_hal::NAN_RANGING_DISABLE; - legacy_request->ranging_cfg.ranging_interval_msec = aidl_request.baseConfigs.rangingIntervalMs; - legacy_request->ranging_cfg.config_ranging_indications = - static_cast(aidl_request.baseConfigs.configRangingIndications); - legacy_request->ranging_cfg.distance_ingress_mm = - aidl_request.baseConfigs.distanceIngressCm * 10; - legacy_request->ranging_cfg.distance_egress_mm = aidl_request.baseConfigs.distanceEgressCm * 10; - legacy_request->ranging_auto_response = aidl_request.baseConfigs.rangingRequired - ? legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE - : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE; - legacy_request->sdea_params.range_report = legacy_hal::NAN_DISABLE_RANGE_REPORT; - legacy_request->subscribe_type = - convertAidlNanSubscribeTypeToLegacy(aidl_request.subscribeType); - legacy_request->serviceResponseFilter = convertAidlNanSrfTypeToLegacy(aidl_request.srfType); - legacy_request->serviceResponseInclude = aidl_request.srfRespondIfInAddressSet - ? legacy_hal::NAN_SRF_INCLUDE_RESPOND - : legacy_hal::NAN_SRF_INCLUDE_DO_NOT_RESPOND; - legacy_request->useServiceResponseFilter = - aidl_request.shouldUseSrf ? legacy_hal::NAN_USE_SRF : legacy_hal::NAN_DO_NOT_USE_SRF; - legacy_request->ssiRequiredForMatchIndication = - aidl_request.isSsiRequiredForMatch ? legacy_hal::NAN_SSI_REQUIRED_IN_MATCH_IND - : legacy_hal::NAN_SSI_NOT_REQUIRED_IN_MATCH_IND; - legacy_request->num_intf_addr_present = aidl_request.intfAddr.size(); - if (legacy_request->num_intf_addr_present > NAN_MAX_SUBSCRIBE_MAX_ADDRESS) { - LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " - "num_intf_addr_present - too many"; - return false; - } - for (int i = 0; i < legacy_request->num_intf_addr_present; i++) { - memcpy(legacy_request->intf_addr[i], aidl_request.intfAddr[i].data.data(), 6); - } - - return true; -} - -bool convertAidlNanTransmitFollowupRequestToLegacy( - const NanTransmitFollowupRequest& aidl_request, - legacy_hal::NanTransmitFollowupRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertAidlNanTransmitFollowupRequestToLegacy: " - "legacy_request is null"; - return false; - } - *legacy_request = {}; - - legacy_request->publish_subscribe_id = aidl_request.discoverySessionId; - legacy_request->requestor_instance_id = aidl_request.peerId; - memcpy(legacy_request->addr, aidl_request.addr.data(), 6); - legacy_request->priority = aidl_request.isHighPriority ? legacy_hal::NAN_TX_PRIORITY_HIGH - : legacy_hal::NAN_TX_PRIORITY_NORMAL; - legacy_request->dw_or_faw = aidl_request.shouldUseDiscoveryWindow - ? legacy_hal::NAN_TRANSMIT_IN_DW - : legacy_hal::NAN_TRANSMIT_IN_FAW; - legacy_request->service_specific_info_len = aidl_request.serviceSpecificInfo.size(); - if (legacy_request->service_specific_info_len > NAN_MAX_SERVICE_SPECIFIC_INFO_LEN) { - LOG(ERROR) << "convertAidlNanTransmitFollowupRequestToLegacy: " - "service_specific_info_len too large"; - return false; - } - memcpy(legacy_request->service_specific_info, aidl_request.serviceSpecificInfo.data(), - legacy_request->service_specific_info_len); - legacy_request->sdea_service_specific_info_len = - aidl_request.extendedServiceSpecificInfo.size(); - if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) { - LOG(ERROR) << "convertAidlNanTransmitFollowupRequestToLegacy: " - "sdea_service_specific_info_len too large"; - return false; - } - memcpy(legacy_request->sdea_service_specific_info, - aidl_request.extendedServiceSpecificInfo.data(), - legacy_request->sdea_service_specific_info_len); - legacy_request->recv_indication_cfg = aidl_request.disableFollowupResultIndication ? 0x1 : 0x0; - - return true; -} - -bool convertAidlNanDataPathInitiatorRequestToLegacy( - const NanInitiateDataPathRequest& aidl_request, - legacy_hal::NanDataPathInitiatorRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: " - "legacy_request is null"; - return false; - } - *legacy_request = {}; - - legacy_request->requestor_instance_id = aidl_request.peerId; - memcpy(legacy_request->peer_disc_mac_addr, aidl_request.peerDiscMacAddr.data(), 6); - legacy_request->channel_request_type = - convertAidlNanDataPathChannelCfgToLegacy(aidl_request.channelRequestType); - legacy_request->channel = aidl_request.channel; - if (strnlen(aidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) { - LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: " - "ifaceName too long"; - return false; - } - strlcpy(legacy_request->ndp_iface, aidl_request.ifaceName.c_str(), IFNAMSIZ + 1); - legacy_request->ndp_cfg.security_cfg = - (aidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN) - ? legacy_hal::NAN_DP_CONFIG_SECURITY - : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; - legacy_request->app_info.ndp_app_info_len = aidl_request.appInfo.size(); - if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) { - LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: " - "ndp_app_info_len too large"; - return false; - } - memcpy(legacy_request->app_info.ndp_app_info, aidl_request.appInfo.data(), - legacy_request->app_info.ndp_app_info_len); - legacy_request->cipher_type = (unsigned int)aidl_request.securityConfig.cipherType; - if (aidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; - legacy_request->key_info.body.pmk_info.pmk_len = aidl_request.securityConfig.pmk.size(); - if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { - LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: " - "invalid pmk_len"; - return false; - } - memcpy(legacy_request->key_info.body.pmk_info.pmk, aidl_request.securityConfig.pmk.data(), - legacy_request->key_info.body.pmk_info.pmk_len); - } - if (aidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; - legacy_request->key_info.body.passphrase_info.passphrase_len = - aidl_request.securityConfig.passphrase.size(); - if (legacy_request->key_info.body.passphrase_info.passphrase_len < - NAN_SECURITY_MIN_PASSPHRASE_LEN) { - LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: " - "passphrase_len too small"; - return false; - } - if (legacy_request->key_info.body.passphrase_info.passphrase_len > - NAN_SECURITY_MAX_PASSPHRASE_LEN) { - LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: " - "passphrase_len too large"; - return false; - } - memcpy(legacy_request->key_info.body.passphrase_info.passphrase, - aidl_request.securityConfig.passphrase.data(), - legacy_request->key_info.body.passphrase_info.passphrase_len); - } - legacy_request->service_name_len = aidl_request.serviceNameOutOfBand.size(); - if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { - LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: " - "service_name_len too large"; - return false; - } - memcpy(legacy_request->service_name, aidl_request.serviceNameOutOfBand.data(), - legacy_request->service_name_len); - legacy_request->scid_len = aidl_request.securityConfig.scid.size(); - if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) { - LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: scid_len too large"; - return false; - } - memcpy(legacy_request->scid, aidl_request.securityConfig.scid.data(), legacy_request->scid_len); - - return true; -} - -bool convertAidlNanDataPathIndicationResponseToLegacy( - const NanRespondToDataPathIndicationRequest& aidl_request, - legacy_hal::NanDataPathIndicationResponse* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: " - "legacy_request is null"; - return false; - } - *legacy_request = {}; - - legacy_request->rsp_code = aidl_request.acceptRequest ? legacy_hal::NAN_DP_REQUEST_ACCEPT - : legacy_hal::NAN_DP_REQUEST_REJECT; - legacy_request->ndp_instance_id = aidl_request.ndpInstanceId; - if (strnlen(aidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) { - LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: " - "ifaceName too long"; - return false; - } - strlcpy(legacy_request->ndp_iface, aidl_request.ifaceName.c_str(), IFNAMSIZ + 1); - legacy_request->ndp_cfg.security_cfg = - (aidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN) - ? legacy_hal::NAN_DP_CONFIG_SECURITY - : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; - legacy_request->app_info.ndp_app_info_len = aidl_request.appInfo.size(); - if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) { - LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: " - "ndp_app_info_len too large"; - return false; - } - memcpy(legacy_request->app_info.ndp_app_info, aidl_request.appInfo.data(), - legacy_request->app_info.ndp_app_info_len); - legacy_request->cipher_type = (unsigned int)aidl_request.securityConfig.cipherType; - if (aidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; - legacy_request->key_info.body.pmk_info.pmk_len = aidl_request.securityConfig.pmk.size(); - if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { - LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: " - "invalid pmk_len"; - return false; - } - memcpy(legacy_request->key_info.body.pmk_info.pmk, aidl_request.securityConfig.pmk.data(), - legacy_request->key_info.body.pmk_info.pmk_len); - } - if (aidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; - legacy_request->key_info.body.passphrase_info.passphrase_len = - aidl_request.securityConfig.passphrase.size(); - if (legacy_request->key_info.body.passphrase_info.passphrase_len < - NAN_SECURITY_MIN_PASSPHRASE_LEN) { - LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: " - "passphrase_len too small"; - return false; - } - if (legacy_request->key_info.body.passphrase_info.passphrase_len > - NAN_SECURITY_MAX_PASSPHRASE_LEN) { - LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: " - "passphrase_len too large"; - return false; - } - memcpy(legacy_request->key_info.body.passphrase_info.passphrase, - aidl_request.securityConfig.passphrase.data(), - legacy_request->key_info.body.passphrase_info.passphrase_len); - } - legacy_request->service_name_len = aidl_request.serviceNameOutOfBand.size(); - if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { - LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: " - "service_name_len too large"; - return false; - } - memcpy(legacy_request->service_name, aidl_request.serviceNameOutOfBand.data(), - legacy_request->service_name_len); - legacy_request->scid_len = aidl_request.securityConfig.scid.size(); - if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) { - LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: scid_len too large"; - return false; - } - memcpy(legacy_request->scid, aidl_request.securityConfig.scid.data(), legacy_request->scid_len); - - return true; -} - -bool convertLegacyNanResponseHeaderToAidl(const legacy_hal::NanResponseMsg& legacy_response, - NanStatus* nanStatus) { - if (!nanStatus) { - LOG(ERROR) << "convertLegacyNanResponseHeaderToAidl: nanStatus is null"; - return false; - } - *nanStatus = {}; - - convertToNanStatus(legacy_response.status, legacy_response.nan_error, - sizeof(legacy_response.nan_error), nanStatus); - return true; -} - -bool convertLegacyNanCapabilitiesResponseToAidl(const legacy_hal::NanCapabilities& legacy_response, - NanCapabilities* aidl_response) { - if (!aidl_response) { - LOG(ERROR) << "convertLegacyNanCapabilitiesResponseToAidl: " - "aidl_response is null"; - return false; - } - *aidl_response = {}; - - aidl_response->maxConcurrentClusters = legacy_response.max_concurrent_nan_clusters; - aidl_response->maxPublishes = legacy_response.max_publishes; - aidl_response->maxSubscribes = legacy_response.max_subscribes; - aidl_response->maxServiceNameLen = legacy_response.max_service_name_len; - aidl_response->maxMatchFilterLen = legacy_response.max_match_filter_len; - aidl_response->maxTotalMatchFilterLen = legacy_response.max_total_match_filter_len; - aidl_response->maxServiceSpecificInfoLen = legacy_response.max_service_specific_info_len; - aidl_response->maxExtendedServiceSpecificInfoLen = - legacy_response.max_sdea_service_specific_info_len; - aidl_response->maxNdiInterfaces = legacy_response.max_ndi_interfaces; - aidl_response->maxNdpSessions = legacy_response.max_ndp_sessions; - aidl_response->maxAppInfoLen = legacy_response.max_app_info_len; - aidl_response->maxQueuedTransmitFollowupMsgs = - legacy_response.max_queued_transmit_followup_msgs; - aidl_response->maxSubscribeInterfaceAddresses = legacy_response.max_subscribe_address; - aidl_response->supportedCipherSuites = - static_cast(legacy_response.cipher_suites_supported); - aidl_response->instantCommunicationModeSupportFlag = legacy_response.is_instant_mode_supported; - - return true; -} - -bool convertLegacyNanMatchIndToAidl(const legacy_hal::NanMatchInd& legacy_ind, - NanMatchInd* aidl_ind) { - if (!aidl_ind) { - LOG(ERROR) << "convertLegacyNanMatchIndToAidl: aidl_ind is null"; - return false; - } - *aidl_ind = {}; - - aidl_ind->discoverySessionId = legacy_ind.publish_subscribe_id; - aidl_ind->peerId = legacy_ind.requestor_instance_id; - aidl_ind->addr = std::array(); - std::copy(legacy_ind.addr, legacy_ind.addr + 6, std::begin(aidl_ind->addr)); - aidl_ind->serviceSpecificInfo = std::vector( - legacy_ind.service_specific_info, - legacy_ind.service_specific_info + legacy_ind.service_specific_info_len); - aidl_ind->extendedServiceSpecificInfo = std::vector( - legacy_ind.sdea_service_specific_info, - legacy_ind.sdea_service_specific_info + legacy_ind.sdea_service_specific_info_len); - aidl_ind->matchFilter = - std::vector(legacy_ind.sdf_match_filter, - legacy_ind.sdf_match_filter + legacy_ind.sdf_match_filter_len); - aidl_ind->matchOccurredInBeaconFlag = legacy_ind.match_occured_flag == 1; // NOTYPO - aidl_ind->outOfResourceFlag = legacy_ind.out_of_resource_flag == 1; - aidl_ind->rssiValue = legacy_ind.rssi_value; - aidl_ind->peerCipherType = (NanCipherSuiteType)legacy_ind.peer_cipher_type; - aidl_ind->peerRequiresSecurityEnabledInNdp = - legacy_ind.peer_sdea_params.security_cfg == legacy_hal::NAN_DP_CONFIG_SECURITY; - aidl_ind->peerRequiresRanging = - legacy_ind.peer_sdea_params.ranging_state == legacy_hal::NAN_RANGING_ENABLE; - aidl_ind->rangingMeasurementInMm = legacy_ind.range_info.range_measurement_mm; - aidl_ind->rangingIndicationType = - static_cast(legacy_ind.range_info.ranging_event_type); - aidl_ind->scid = std::vector(legacy_ind.scid, legacy_ind.scid + legacy_ind.scid_len); - return true; -} - -bool convertLegacyNanFollowupIndToAidl(const legacy_hal::NanFollowupInd& legacy_ind, - NanFollowupReceivedInd* aidl_ind) { - if (!aidl_ind) { - LOG(ERROR) << "convertLegacyNanFollowupIndToAidl: aidl_ind is null"; - return false; - } - *aidl_ind = {}; - - aidl_ind->discoverySessionId = legacy_ind.publish_subscribe_id; - aidl_ind->peerId = legacy_ind.requestor_instance_id; - aidl_ind->addr = std::array(); - std::copy(legacy_ind.addr, legacy_ind.addr + 6, std::begin(aidl_ind->addr)); - aidl_ind->receivedInFaw = legacy_ind.dw_or_faw == 1; - aidl_ind->serviceSpecificInfo = std::vector( - legacy_ind.service_specific_info, - legacy_ind.service_specific_info + legacy_ind.service_specific_info_len); - aidl_ind->extendedServiceSpecificInfo = std::vector( - legacy_ind.sdea_service_specific_info, - legacy_ind.sdea_service_specific_info + legacy_ind.sdea_service_specific_info_len); - - return true; -} - -bool convertLegacyNanDataPathRequestIndToAidl(const legacy_hal::NanDataPathRequestInd& legacy_ind, - NanDataPathRequestInd* aidl_ind) { - if (!aidl_ind) { - LOG(ERROR) << "convertLegacyNanDataPathRequestIndToAidl: aidl_ind is null"; - return false; - } - *aidl_ind = {}; - - aidl_ind->discoverySessionId = legacy_ind.service_instance_id; - aidl_ind->peerDiscMacAddr = std::array(); - std::copy(legacy_ind.peer_disc_mac_addr, legacy_ind.peer_disc_mac_addr + 6, - std::begin(aidl_ind->peerDiscMacAddr)); - aidl_ind->ndpInstanceId = legacy_ind.ndp_instance_id; - aidl_ind->securityRequired = - legacy_ind.ndp_cfg.security_cfg == legacy_hal::NAN_DP_CONFIG_SECURITY; - aidl_ind->appInfo = std::vector( - legacy_ind.app_info.ndp_app_info, - legacy_ind.app_info.ndp_app_info + legacy_ind.app_info.ndp_app_info_len); - - return true; -} - -bool convertLegacyNdpChannelInfoToAidl(const legacy_hal::NanChannelInfo& legacy_struct, - NanDataPathChannelInfo* aidl_struct) { - if (!aidl_struct) { - LOG(ERROR) << "convertLegacyNdpChannelInfoToAidl: aidl_struct is null"; - return false; - } - *aidl_struct = {}; - - aidl_struct->channelFreq = legacy_struct.channel; - aidl_struct->channelBandwidth = convertLegacyWifiChannelWidthToAidl( - (legacy_hal::wifi_channel_width)legacy_struct.bandwidth); - aidl_struct->numSpatialStreams = legacy_struct.nss; - - return true; -} - -bool convertLegacyNanDataPathConfirmIndToAidl(const legacy_hal::NanDataPathConfirmInd& legacy_ind, - NanDataPathConfirmInd* aidl_ind) { - if (!aidl_ind) { - LOG(ERROR) << "convertLegacyNanDataPathConfirmIndToAidl: aidl_ind is null"; - return false; - } - *aidl_ind = {}; - - aidl_ind->ndpInstanceId = legacy_ind.ndp_instance_id; - aidl_ind->dataPathSetupSuccess = legacy_ind.rsp_code == legacy_hal::NAN_DP_REQUEST_ACCEPT; - aidl_ind->peerNdiMacAddr = std::array(); - std::copy(legacy_ind.peer_ndi_mac_addr, legacy_ind.peer_ndi_mac_addr + 6, - std::begin(aidl_ind->peerNdiMacAddr)); - aidl_ind->appInfo = std::vector( - legacy_ind.app_info.ndp_app_info, - legacy_ind.app_info.ndp_app_info + legacy_ind.app_info.ndp_app_info_len); - aidl_ind->status.status = convertLegacyNanStatusTypeToAidl(legacy_ind.reason_code); - aidl_ind->status.description = ""; - - std::vector channelInfo; - for (unsigned int i = 0; i < legacy_ind.num_channels; ++i) { - NanDataPathChannelInfo aidl_struct; - if (!convertLegacyNdpChannelInfoToAidl(legacy_ind.channel_info[i], &aidl_struct)) { - return false; - } - channelInfo.push_back(aidl_struct); - } - aidl_ind->channelInfo = channelInfo; - - return true; -} - -bool convertLegacyNanDataPathScheduleUpdateIndToAidl( - const legacy_hal::NanDataPathScheduleUpdateInd& legacy_ind, - NanDataPathScheduleUpdateInd* aidl_ind) { - if (!aidl_ind) { - LOG(ERROR) << "convertLegacyNanDataPathScheduleUpdateIndToAidl: " - "aidl_ind is null"; - return false; - } - *aidl_ind = {}; - - aidl_ind->peerDiscoveryAddress = std::array(); - std::copy(legacy_ind.peer_mac_addr, legacy_ind.peer_mac_addr + 6, - std::begin(aidl_ind->peerDiscoveryAddress)); - std::vector channelInfo; - for (unsigned int i = 0; i < legacy_ind.num_channels; ++i) { - NanDataPathChannelInfo aidl_struct; - if (!convertLegacyNdpChannelInfoToAidl(legacy_ind.channel_info[i], &aidl_struct)) { - return false; - } - channelInfo.push_back(aidl_struct); - } - aidl_ind->channelInfo = channelInfo; - std::vector ndpInstanceIds; - for (unsigned int i = 0; i < legacy_ind.num_ndp_instances; ++i) { - ndpInstanceIds.push_back(legacy_ind.ndp_instance_id[i]); - } - aidl_ind->ndpInstanceIds = uintToIntVec(ndpInstanceIds); - - return true; -} - -legacy_hal::wifi_rtt_type convertAidlRttTypeToLegacy(RttType type) { - switch (type) { - case RttType::ONE_SIDED: - return legacy_hal::RTT_TYPE_1_SIDED; - case RttType::TWO_SIDED: - return legacy_hal::RTT_TYPE_2_SIDED; - }; - CHECK(false); -} - -RttType convertLegacyRttTypeToAidl(legacy_hal::wifi_rtt_type type) { - switch (type) { - case legacy_hal::RTT_TYPE_1_SIDED: - return RttType::ONE_SIDED; - case legacy_hal::RTT_TYPE_2_SIDED: - return RttType::TWO_SIDED; - }; - CHECK(false) << "Unknown legacy type: " << type; -} - -legacy_hal::rtt_peer_type convertAidlRttPeerTypeToLegacy(RttPeerType type) { - switch (type) { - case RttPeerType::AP: - return legacy_hal::RTT_PEER_AP; - case RttPeerType::STA: - return legacy_hal::RTT_PEER_STA; - case RttPeerType::P2P_GO: - return legacy_hal::RTT_PEER_P2P_GO; - case RttPeerType::P2P_CLIENT: - return legacy_hal::RTT_PEER_P2P_CLIENT; - case RttPeerType::NAN_TYPE: - return legacy_hal::RTT_PEER_NAN; - }; - CHECK(false); -} - -legacy_hal::wifi_channel_width convertAidlWifiChannelWidthToLegacy(WifiChannelWidthInMhz type) { - switch (type) { - case WifiChannelWidthInMhz::WIDTH_20: - return legacy_hal::WIFI_CHAN_WIDTH_20; - case WifiChannelWidthInMhz::WIDTH_40: - return legacy_hal::WIFI_CHAN_WIDTH_40; - case WifiChannelWidthInMhz::WIDTH_80: - return legacy_hal::WIFI_CHAN_WIDTH_80; - case WifiChannelWidthInMhz::WIDTH_160: - return legacy_hal::WIFI_CHAN_WIDTH_160; - case WifiChannelWidthInMhz::WIDTH_80P80: - return legacy_hal::WIFI_CHAN_WIDTH_80P80; - case WifiChannelWidthInMhz::WIDTH_5: - return legacy_hal::WIFI_CHAN_WIDTH_5; - case WifiChannelWidthInMhz::WIDTH_10: - return legacy_hal::WIFI_CHAN_WIDTH_10; - case WifiChannelWidthInMhz::WIDTH_320: - return legacy_hal::WIFI_CHAN_WIDTH_320; - case WifiChannelWidthInMhz::WIDTH_INVALID: - return legacy_hal::WIFI_CHAN_WIDTH_INVALID; - }; - CHECK(false); -} - -WifiChannelWidthInMhz convertLegacyWifiChannelWidthToAidl(legacy_hal::wifi_channel_width type) { - switch (type) { - case legacy_hal::WIFI_CHAN_WIDTH_20: - return WifiChannelWidthInMhz::WIDTH_20; - case legacy_hal::WIFI_CHAN_WIDTH_40: - return WifiChannelWidthInMhz::WIDTH_40; - case legacy_hal::WIFI_CHAN_WIDTH_80: - return WifiChannelWidthInMhz::WIDTH_80; - case legacy_hal::WIFI_CHAN_WIDTH_160: - return WifiChannelWidthInMhz::WIDTH_160; - case legacy_hal::WIFI_CHAN_WIDTH_80P80: - return WifiChannelWidthInMhz::WIDTH_80P80; - case legacy_hal::WIFI_CHAN_WIDTH_5: - return WifiChannelWidthInMhz::WIDTH_5; - case legacy_hal::WIFI_CHAN_WIDTH_10: - return WifiChannelWidthInMhz::WIDTH_10; - case legacy_hal::WIFI_CHAN_WIDTH_320: - return WifiChannelWidthInMhz::WIDTH_320; - default: - return WifiChannelWidthInMhz::WIDTH_INVALID; - }; -} - -legacy_hal::wifi_rtt_preamble convertAidlRttPreambleToLegacy(RttPreamble type) { - switch (type) { - case RttPreamble::LEGACY: - return legacy_hal::WIFI_RTT_PREAMBLE_LEGACY; - case RttPreamble::HT: - return legacy_hal::WIFI_RTT_PREAMBLE_HT; - case RttPreamble::VHT: - return legacy_hal::WIFI_RTT_PREAMBLE_VHT; - case RttPreamble::HE: - return legacy_hal::WIFI_RTT_PREAMBLE_HE; - case RttPreamble::EHT: - return legacy_hal::WIFI_RTT_PREAMBLE_EHT; - }; - CHECK(false); -} - -RttPreamble convertLegacyRttPreambleToAidl(legacy_hal::wifi_rtt_preamble type) { - switch (type) { - case legacy_hal::WIFI_RTT_PREAMBLE_LEGACY: - return RttPreamble::LEGACY; - case legacy_hal::WIFI_RTT_PREAMBLE_HT: - return RttPreamble::HT; - case legacy_hal::WIFI_RTT_PREAMBLE_VHT: - return RttPreamble::VHT; - case legacy_hal::WIFI_RTT_PREAMBLE_HE: - return RttPreamble::HE; - case legacy_hal::WIFI_RTT_PREAMBLE_EHT: - return RttPreamble::EHT; - }; - CHECK(false) << "Unknown legacy type: " << type; -} - -legacy_hal::wifi_rtt_bw convertAidlRttBwToLegacy(RttBw type) { - switch (type) { - case RttBw::BW_5MHZ: - return legacy_hal::WIFI_RTT_BW_5; - case RttBw::BW_10MHZ: - return legacy_hal::WIFI_RTT_BW_10; - case RttBw::BW_20MHZ: - return legacy_hal::WIFI_RTT_BW_20; - case RttBw::BW_40MHZ: - return legacy_hal::WIFI_RTT_BW_40; - case RttBw::BW_80MHZ: - return legacy_hal::WIFI_RTT_BW_80; - case RttBw::BW_160MHZ: - return legacy_hal::WIFI_RTT_BW_160; - case RttBw::BW_320MHZ: - return legacy_hal::WIFI_RTT_BW_320; - }; - CHECK(false); -} - -RttBw convertLegacyRttBwToAidl(legacy_hal::wifi_rtt_bw type) { - switch (type) { - case legacy_hal::WIFI_RTT_BW_5: - return RttBw::BW_5MHZ; - case legacy_hal::WIFI_RTT_BW_10: - return RttBw::BW_10MHZ; - case legacy_hal::WIFI_RTT_BW_20: - return RttBw::BW_20MHZ; - case legacy_hal::WIFI_RTT_BW_40: - return RttBw::BW_40MHZ; - case legacy_hal::WIFI_RTT_BW_80: - return RttBw::BW_80MHZ; - case legacy_hal::WIFI_RTT_BW_160: - return RttBw::BW_160MHZ; - case legacy_hal::WIFI_RTT_BW_320: - return RttBw::BW_320MHZ; - }; - CHECK(false) << "Unknown legacy type: " << type; -} - -legacy_hal::wifi_motion_pattern convertAidlRttMotionPatternToLegacy(RttMotionPattern type) { - switch (type) { - case RttMotionPattern::NOT_EXPECTED: - return legacy_hal::WIFI_MOTION_NOT_EXPECTED; - case RttMotionPattern::EXPECTED: - return legacy_hal::WIFI_MOTION_EXPECTED; - case RttMotionPattern::UNKNOWN: - return legacy_hal::WIFI_MOTION_UNKNOWN; - }; - CHECK(false); -} - -WifiRatePreamble convertLegacyWifiRatePreambleToAidl(uint8_t preamble) { - switch (preamble) { - case 0: - return WifiRatePreamble::OFDM; - case 1: - return WifiRatePreamble::CCK; - case 2: - return WifiRatePreamble::HT; - case 3: - return WifiRatePreamble::VHT; - case 4: - return WifiRatePreamble::HE; - case 5: - return WifiRatePreamble::EHT; - default: - return WifiRatePreamble::RESERVED; - }; - CHECK(false) << "Unknown legacy preamble: " << preamble; -} - -WifiRateNss convertLegacyWifiRateNssToAidl(uint8_t nss) { - switch (nss) { - case 0: - return WifiRateNss::NSS_1x1; - case 1: - return WifiRateNss::NSS_2x2; - case 2: - return WifiRateNss::NSS_3x3; - case 3: - return WifiRateNss::NSS_4x4; - }; - CHECK(false) << "Unknown legacy nss: " << nss; - return {}; -} - -RttStatus convertLegacyRttStatusToAidl(legacy_hal::wifi_rtt_status status) { - switch (status) { - case legacy_hal::RTT_STATUS_SUCCESS: - return RttStatus::SUCCESS; - case legacy_hal::RTT_STATUS_FAILURE: - return RttStatus::FAILURE; - case legacy_hal::RTT_STATUS_FAIL_NO_RSP: - return RttStatus::FAIL_NO_RSP; - case legacy_hal::RTT_STATUS_FAIL_REJECTED: - return RttStatus::FAIL_REJECTED; - case legacy_hal::RTT_STATUS_FAIL_NOT_SCHEDULED_YET: - return RttStatus::FAIL_NOT_SCHEDULED_YET; - case legacy_hal::RTT_STATUS_FAIL_TM_TIMEOUT: - return RttStatus::FAIL_TM_TIMEOUT; - case legacy_hal::RTT_STATUS_FAIL_AP_ON_DIFF_CHANNEL: - return RttStatus::FAIL_AP_ON_DIFF_CHANNEL; - case legacy_hal::RTT_STATUS_FAIL_NO_CAPABILITY: - return RttStatus::FAIL_NO_CAPABILITY; - case legacy_hal::RTT_STATUS_ABORTED: - return RttStatus::ABORTED; - case legacy_hal::RTT_STATUS_FAIL_INVALID_TS: - return RttStatus::FAIL_INVALID_TS; - case legacy_hal::RTT_STATUS_FAIL_PROTOCOL: - return RttStatus::FAIL_PROTOCOL; - case legacy_hal::RTT_STATUS_FAIL_SCHEDULE: - return RttStatus::FAIL_SCHEDULE; - case legacy_hal::RTT_STATUS_FAIL_BUSY_TRY_LATER: - return RttStatus::FAIL_BUSY_TRY_LATER; - case legacy_hal::RTT_STATUS_INVALID_REQ: - return RttStatus::INVALID_REQ; - case legacy_hal::RTT_STATUS_NO_WIFI: - return RttStatus::NO_WIFI; - case legacy_hal::RTT_STATUS_FAIL_FTM_PARAM_OVERRIDE: - return RttStatus::FAIL_FTM_PARAM_OVERRIDE; - case legacy_hal::RTT_STATUS_NAN_RANGING_PROTOCOL_FAILURE: - return RttStatus::NAN_RANGING_PROTOCOL_FAILURE; - case legacy_hal::RTT_STATUS_NAN_RANGING_CONCURRENCY_NOT_SUPPORTED: - return RttStatus::NAN_RANGING_CONCURRENCY_NOT_SUPPORTED; - }; - CHECK(false) << "Unknown legacy status: " << status; -} - -bool convertAidlWifiChannelInfoToLegacy(const WifiChannelInfo& aidl_info, - legacy_hal::wifi_channel_info* legacy_info) { - if (!legacy_info) { - return false; - } - *legacy_info = {}; - legacy_info->width = convertAidlWifiChannelWidthToLegacy(aidl_info.width); - legacy_info->center_freq = aidl_info.centerFreq; - legacy_info->center_freq0 = aidl_info.centerFreq0; - legacy_info->center_freq1 = aidl_info.centerFreq1; - return true; -} - -bool convertLegacyWifiChannelInfoToAidl(const legacy_hal::wifi_channel_info& legacy_info, - WifiChannelInfo* aidl_info) { - if (!aidl_info) { - return false; - } - *aidl_info = {}; - aidl_info->width = convertLegacyWifiChannelWidthToAidl(legacy_info.width); - aidl_info->centerFreq = legacy_info.center_freq; - aidl_info->centerFreq0 = legacy_info.center_freq0; - aidl_info->centerFreq1 = legacy_info.center_freq1; - return true; -} - -bool convertAidlRttConfigToLegacy(const RttConfig& aidl_config, - legacy_hal::wifi_rtt_config* legacy_config) { - if (!legacy_config) { - return false; - } - *legacy_config = {}; - CHECK(aidl_config.addr.size() == sizeof(legacy_config->addr)); - memcpy(legacy_config->addr, aidl_config.addr.data(), aidl_config.addr.size()); - legacy_config->type = convertAidlRttTypeToLegacy(aidl_config.type); - legacy_config->peer = convertAidlRttPeerTypeToLegacy(aidl_config.peer); - if (!convertAidlWifiChannelInfoToLegacy(aidl_config.channel, &legacy_config->channel)) { - return false; - } - legacy_config->burst_period = aidl_config.burstPeriod; - legacy_config->num_burst = aidl_config.numBurst; - legacy_config->num_frames_per_burst = aidl_config.numFramesPerBurst; - legacy_config->num_retries_per_rtt_frame = aidl_config.numRetriesPerRttFrame; - legacy_config->num_retries_per_ftmr = aidl_config.numRetriesPerFtmr; - legacy_config->LCI_request = aidl_config.mustRequestLci; - legacy_config->LCR_request = aidl_config.mustRequestLcr; - legacy_config->burst_duration = aidl_config.burstDuration; - legacy_config->preamble = convertAidlRttPreambleToLegacy(aidl_config.preamble); - legacy_config->bw = convertAidlRttBwToLegacy(aidl_config.bw); - return true; -} - -bool convertAidlVectorOfRttConfigToLegacy( - const std::vector& aidl_configs, - std::vector* legacy_configs) { - if (!legacy_configs) { - return false; - } - *legacy_configs = {}; - for (const auto& aidl_config : aidl_configs) { - legacy_hal::wifi_rtt_config legacy_config; - if (!convertAidlRttConfigToLegacy(aidl_config, &legacy_config)) { - return false; - } - legacy_configs->push_back(legacy_config); - } - return true; -} - -bool convertAidlRttLciInformationToLegacy(const RttLciInformation& aidl_info, - legacy_hal::wifi_lci_information* legacy_info) { - if (!legacy_info) { - return false; - } - *legacy_info = {}; - legacy_info->latitude = aidl_info.latitude; - legacy_info->longitude = aidl_info.longitude; - legacy_info->altitude = aidl_info.altitude; - legacy_info->latitude_unc = aidl_info.latitudeUnc; - legacy_info->longitude_unc = aidl_info.longitudeUnc; - legacy_info->altitude_unc = aidl_info.altitudeUnc; - legacy_info->motion_pattern = convertAidlRttMotionPatternToLegacy(aidl_info.motionPattern); - legacy_info->floor = aidl_info.floor; - legacy_info->height_above_floor = aidl_info.heightAboveFloor; - legacy_info->height_unc = aidl_info.heightUnc; - return true; -} - -bool convertAidlRttLcrInformationToLegacy(const RttLcrInformation& aidl_info, - legacy_hal::wifi_lcr_information* legacy_info) { - if (!legacy_info) { - return false; - } - *legacy_info = {}; - CHECK(aidl_info.countryCode.size() == sizeof(legacy_info->country_code)); - memcpy(legacy_info->country_code, aidl_info.countryCode.data(), aidl_info.countryCode.size()); - if (aidl_info.civicInfo.size() > sizeof(legacy_info->civic_info)) { - return false; - } - legacy_info->length = aidl_info.civicInfo.size(); - memcpy(legacy_info->civic_info, aidl_info.civicInfo.c_str(), aidl_info.civicInfo.size()); - return true; -} - -bool convertAidlRttResponderToLegacy(const RttResponder& aidl_responder, - legacy_hal::wifi_rtt_responder* legacy_responder) { - if (!legacy_responder) { - return false; - } - *legacy_responder = {}; - if (!convertAidlWifiChannelInfoToLegacy(aidl_responder.channel, &legacy_responder->channel)) { - return false; - } - legacy_responder->preamble = convertAidlRttPreambleToLegacy(aidl_responder.preamble); - return true; -} - -bool convertLegacyRttResponderToAidl(const legacy_hal::wifi_rtt_responder& legacy_responder, - RttResponder* aidl_responder) { - if (!aidl_responder) { - return false; - } - *aidl_responder = {}; - if (!convertLegacyWifiChannelInfoToAidl(legacy_responder.channel, &aidl_responder->channel)) { - return false; - } - aidl_responder->preamble = convertLegacyRttPreambleToAidl(legacy_responder.preamble); - return true; -} - -bool convertLegacyRttCapabilitiesToAidl( - const legacy_hal::wifi_rtt_capabilities& legacy_capabilities, - RttCapabilities* aidl_capabilities) { - if (!aidl_capabilities) { - return false; - } - *aidl_capabilities = {}; - aidl_capabilities->rttOneSidedSupported = legacy_capabilities.rtt_one_sided_supported; - aidl_capabilities->rttFtmSupported = legacy_capabilities.rtt_ftm_supported; - aidl_capabilities->lciSupported = legacy_capabilities.lci_support; - aidl_capabilities->lcrSupported = legacy_capabilities.lcr_support; - aidl_capabilities->responderSupported = legacy_capabilities.responder_supported; - int32_t preambleSupport = 0; - for (const auto flag : {legacy_hal::WIFI_RTT_PREAMBLE_LEGACY, legacy_hal::WIFI_RTT_PREAMBLE_HT, - legacy_hal::WIFI_RTT_PREAMBLE_VHT, legacy_hal::WIFI_RTT_PREAMBLE_HE, - legacy_hal::WIFI_RTT_PREAMBLE_EHT}) { - if (legacy_capabilities.preamble_support & flag) { - preambleSupport |= static_cast::type>( - convertLegacyRttPreambleToAidl(flag)); - } - } - aidl_capabilities->preambleSupport = static_cast(preambleSupport); - int32_t bwSupport = 0; - for (const auto flag : - {legacy_hal::WIFI_RTT_BW_5, legacy_hal::WIFI_RTT_BW_10, legacy_hal::WIFI_RTT_BW_20, - legacy_hal::WIFI_RTT_BW_40, legacy_hal::WIFI_RTT_BW_80, legacy_hal::WIFI_RTT_BW_160, - legacy_hal::WIFI_RTT_BW_320}) { - if (legacy_capabilities.bw_support & flag) { - bwSupport |= - static_cast::type>(convertLegacyRttBwToAidl(flag)); - } - } - aidl_capabilities->bwSupport = static_cast(bwSupport); - aidl_capabilities->mcVersion = legacy_capabilities.mc_version; - return true; -} - -bool convertLegacyWifiRateInfoToAidl(const legacy_hal::wifi_rate& legacy_rate, - WifiRateInfo* aidl_rate) { - if (!aidl_rate) { - return false; - } - *aidl_rate = {}; - aidl_rate->preamble = convertLegacyWifiRatePreambleToAidl(legacy_rate.preamble); - aidl_rate->nss = convertLegacyWifiRateNssToAidl(legacy_rate.nss); - aidl_rate->bw = convertLegacyWifiChannelWidthToAidl( - static_cast(legacy_rate.bw)); - aidl_rate->rateMcsIdx = legacy_rate.rateMcsIdx; - aidl_rate->bitRateInKbps = legacy_rate.bitrate; - return true; -} - -bool convertLegacyRttResultToAidl(const legacy_hal::wifi_rtt_result& legacy_result, - RttResult* aidl_result) { - if (!aidl_result) { - return false; - } - *aidl_result = {}; - aidl_result->addr = std::array(); - CHECK(sizeof(legacy_result.addr) == aidl_result->addr.size()); - std::copy(legacy_result.addr, legacy_result.addr + 6, std::begin(aidl_result->addr)); - aidl_result->burstNum = legacy_result.burst_num; - aidl_result->measurementNumber = legacy_result.measurement_number; - aidl_result->successNumber = legacy_result.success_number; - aidl_result->numberPerBurstPeer = legacy_result.number_per_burst_peer; - aidl_result->status = convertLegacyRttStatusToAidl(legacy_result.status); - aidl_result->retryAfterDuration = legacy_result.retry_after_duration; - aidl_result->type = convertLegacyRttTypeToAidl(legacy_result.type); - aidl_result->rssi = legacy_result.rssi; - aidl_result->rssiSpread = legacy_result.rssi_spread; - if (!convertLegacyWifiRateInfoToAidl(legacy_result.tx_rate, &aidl_result->txRate)) { - return false; - } - if (!convertLegacyWifiRateInfoToAidl(legacy_result.rx_rate, &aidl_result->rxRate)) { - return false; - } - aidl_result->rtt = legacy_result.rtt; - aidl_result->rttSd = legacy_result.rtt_sd; - aidl_result->rttSpread = legacy_result.rtt_spread; - aidl_result->distanceInMm = legacy_result.distance_mm; - aidl_result->distanceSdInMm = legacy_result.distance_sd_mm; - aidl_result->distanceSpreadInMm = legacy_result.distance_spread_mm; - aidl_result->timeStampInUs = legacy_result.ts; - aidl_result->burstDurationInMs = legacy_result.burst_duration; - aidl_result->negotiatedBurstNum = legacy_result.negotiated_burst_num; - if (legacy_result.LCI && !convertLegacyIeToAidl(*legacy_result.LCI, &aidl_result->lci)) { - return false; - } - if (legacy_result.LCR && !convertLegacyIeToAidl(*legacy_result.LCR, &aidl_result->lcr)) { - return false; - } - return true; -} - -bool convertLegacyVectorOfRttResultToAidl( - const std::vector& legacy_results, - std::vector* aidl_results) { - if (!aidl_results) { - return false; - } - *aidl_results = {}; - for (const auto legacy_result : legacy_results) { - RttResult aidl_result; - if (!convertLegacyRttResultToAidl(*legacy_result, &aidl_result)) { - return false; - } - aidl_results->push_back(aidl_result); - } - return true; -} - -legacy_hal::wifi_interface_type convertAidlIfaceTypeToLegacy(IfaceType aidl_interface_type) { - switch (aidl_interface_type) { - case IfaceType::STA: - return legacy_hal::WIFI_INTERFACE_TYPE_STA; - case IfaceType::AP: - return legacy_hal::WIFI_INTERFACE_TYPE_AP; - case IfaceType::P2P: - return legacy_hal::WIFI_INTERFACE_TYPE_P2P; - case IfaceType::NAN_IFACE: - return legacy_hal::WIFI_INTERFACE_TYPE_NAN; - } - CHECK(false); -} - -legacy_hal::wifi_multi_sta_use_case convertAidlMultiStaUseCaseToLegacy( - IWifiChip::MultiStaUseCase use_case) { - switch (use_case) { - case IWifiChip::MultiStaUseCase::DUAL_STA_TRANSIENT_PREFER_PRIMARY: - return legacy_hal::WIFI_DUAL_STA_TRANSIENT_PREFER_PRIMARY; - case IWifiChip::MultiStaUseCase::DUAL_STA_NON_TRANSIENT_UNBIASED: - return legacy_hal::WIFI_DUAL_STA_NON_TRANSIENT_UNBIASED; - } - CHECK(false); -} - -bool convertAidlCoexUnsafeChannelToLegacy( - const IWifiChip::CoexUnsafeChannel& aidl_unsafe_channel, - legacy_hal::wifi_coex_unsafe_channel* legacy_unsafe_channel) { - if (!legacy_unsafe_channel) { - return false; - } - *legacy_unsafe_channel = {}; - switch (aidl_unsafe_channel.band) { - case WifiBand::BAND_24GHZ: - legacy_unsafe_channel->band = legacy_hal::WLAN_MAC_2_4_BAND; - break; - case WifiBand::BAND_5GHZ: - legacy_unsafe_channel->band = legacy_hal::WLAN_MAC_5_0_BAND; - break; - default: - return false; - }; - legacy_unsafe_channel->channel = aidl_unsafe_channel.channel; - legacy_unsafe_channel->power_cap_dbm = aidl_unsafe_channel.powerCapDbm; - return true; -} - -bool convertAidlVectorOfCoexUnsafeChannelToLegacy( - const std::vector& aidl_unsafe_channels, - std::vector* legacy_unsafe_channels) { - if (!legacy_unsafe_channels) { - return false; - } - *legacy_unsafe_channels = {}; - for (const auto& aidl_unsafe_channel : aidl_unsafe_channels) { - legacy_hal::wifi_coex_unsafe_channel legacy_unsafe_channel; - if (!aidl_struct_util::convertAidlCoexUnsafeChannelToLegacy(aidl_unsafe_channel, - &legacy_unsafe_channel)) { - return false; - } - legacy_unsafe_channels->push_back(legacy_unsafe_channel); - } - return true; -} - -WifiAntennaMode convertLegacyAntennaConfigurationToAidl(uint32_t antenna_cfg) { - switch (antenna_cfg) { - case legacy_hal::WIFI_ANTENNA_1X1: - return WifiAntennaMode::WIFI_ANTENNA_MODE_1X1; - case legacy_hal::WIFI_ANTENNA_2X2: - return WifiAntennaMode::WIFI_ANTENNA_MODE_2X2; - case legacy_hal::WIFI_ANTENNA_3X3: - return WifiAntennaMode::WIFI_ANTENNA_MODE_3X3; - case legacy_hal::WIFI_ANTENNA_4X4: - return WifiAntennaMode::WIFI_ANTENNA_MODE_4X4; - default: - return WifiAntennaMode::WIFI_ANTENNA_MODE_UNSPECIFIED; - } -} - -bool convertLegacyWifiRadioConfigurationToAidl( - legacy_hal::wifi_radio_configuration* radio_configuration, - WifiRadioConfiguration* aidl_radio_configuration) { - if (!aidl_radio_configuration) { - return false; - } - *aidl_radio_configuration = {}; - aidl_radio_configuration->bandInfo = - aidl_struct_util::convertLegacyMacBandToAidlWifiBand(radio_configuration->band); - if (aidl_radio_configuration->bandInfo == WifiBand::BAND_UNSPECIFIED) { - LOG(ERROR) << "Unspecified band"; - return false; - } - aidl_radio_configuration->antennaMode = - aidl_struct_util::convertLegacyAntennaConfigurationToAidl( - radio_configuration->antenna_cfg); - return true; -} - -bool convertLegacyRadioCombinationsMatrixToAidl( - legacy_hal::wifi_radio_combination_matrix* legacy_matrix, - WifiRadioCombinationMatrix* aidl_matrix) { - if (!aidl_matrix || !legacy_matrix) { - return false; - } - *aidl_matrix = {}; - - int num_combinations = legacy_matrix->num_radio_combinations; - std::vector radio_combinations_vec; - if (!num_combinations) { - LOG(ERROR) << "zero radio combinations"; - return false; - } - wifi_radio_combination* l_radio_combinations_ptr = legacy_matrix->radio_combinations; - for (int i = 0; i < num_combinations; i++) { - int num_configurations = l_radio_combinations_ptr->num_radio_configurations; - WifiRadioCombination radioCombination; - std::vector radio_configurations_vec; - if (!num_configurations) { - LOG(ERROR) << "zero radio configurations"; - return false; - } - for (int j = 0; j < num_configurations; j++) { - WifiRadioConfiguration radioConfiguration; - wifi_radio_configuration* l_radio_configurations_ptr = - &l_radio_combinations_ptr->radio_configurations[j]; - if (!aidl_struct_util::convertLegacyWifiRadioConfigurationToAidl( - l_radio_configurations_ptr, &radioConfiguration)) { - LOG(ERROR) << "Error converting wifi radio configuration"; - return false; - } - radio_configurations_vec.push_back(radioConfiguration); - } - radioCombination.radioConfigurations = radio_configurations_vec; - radio_combinations_vec.push_back(radioCombination); - l_radio_combinations_ptr = - (wifi_radio_combination*)((u8*)l_radio_combinations_ptr + - sizeof(wifi_radio_combination) + - (sizeof(wifi_radio_configuration) * num_configurations)); - } - aidl_matrix->radioCombinations = radio_combinations_vec; - return true; -} - -} // namespace aidl_struct_util -} // namespace wifi -} // namespace hardware -} // namespace android -} // namespace aidl diff --git a/wifi/aidl/default/aidl_struct_util.h b/wifi/aidl/default/aidl_struct_util.h deleted file mode 100644 index 4ebfc10787..0000000000 --- a/wifi/aidl/default/aidl_struct_util.h +++ /dev/null @@ -1,180 +0,0 @@ -/* - * 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. - */ - -#ifndef AIDL_STRUCT_UTIL_H_ -#define AIDL_STRUCT_UTIL_H_ - -#include -#include -#include -#include - -#include - -#include "wifi_legacy_hal.h" - -/** - * This file contains a bunch of functions to convert structs from the legacy - * HAL to AIDL and vice versa. - */ -namespace aidl { -namespace android { -namespace hardware { -namespace wifi { -namespace aidl_struct_util { - -// Chip conversion methods. -bool convertLegacyFeaturesToAidlChipCapabilities(uint64_t legacy_feature_set, - uint32_t legacy_logger_feature_set, - uint32_t* aidl_caps); -bool convertLegacyDebugRingBufferStatusToAidl( - const legacy_hal::wifi_ring_buffer_status& legacy_status, - WifiDebugRingBufferStatus* aidl_status); -bool convertLegacyVectorOfDebugRingBufferStatusToAidl( - const std::vector& legacy_status_vec, - std::vector* aidl_status_vec); -bool convertLegacyWakeReasonStatsToAidl(const legacy_hal::WakeReasonStats& legacy_stats, - WifiDebugHostWakeReasonStats* aidl_stats); -legacy_hal::wifi_power_scenario convertAidlTxPowerScenarioToLegacy( - IWifiChip::TxPowerScenario aidl_scenario); -legacy_hal::wifi_latency_mode convertAidlLatencyModeToLegacy( - IWifiChip::LatencyMode aidl_latency_mode); -bool convertLegacyWifiMacInfosToAidl( - const std::vector& legacy_mac_infos, - std::vector* aidl_radio_mode_infos); -legacy_hal::wifi_interface_type convertAidlIfaceTypeToLegacy(IfaceType aidl_interface_type); -legacy_hal::wifi_multi_sta_use_case convertAidlMultiStaUseCaseToLegacy( - IWifiChip::MultiStaUseCase use_case); -bool convertAidlCoexUnsafeChannelToLegacy( - const IWifiChip::CoexUnsafeChannel& aidl_unsafe_channel, - legacy_hal::wifi_coex_unsafe_channel* legacy_unsafe_channel); -bool convertAidlVectorOfCoexUnsafeChannelToLegacy( - const std::vector& aidl_unsafe_channels, - std::vector* legacy_unsafe_channels); -bool convertLegacyRadioCombinationsMatrixToAidl( - legacy_hal::wifi_radio_combination_matrix* legacy_matrix, - WifiRadioCombinationMatrix* aidl_matrix); -WifiBand convertLegacyMacBandToAidlWifiBand(uint32_t band); -WifiAntennaMode convertLegacyAntennaConfigurationToAidl(uint32_t antenna_cfg); - -// STA iface conversion methods. -bool convertLegacyFeaturesToAidlStaCapabilities(uint64_t legacy_feature_set, - uint32_t legacy_logger_feature_set, - uint32_t* aidl_caps); -bool convertLegacyApfCapabilitiesToAidl(const legacy_hal::PacketFilterCapabilities& legacy_caps, - StaApfPacketFilterCapabilities* aidl_caps); -bool convertLegacyGscanCapabilitiesToAidl(const legacy_hal::wifi_gscan_capabilities& legacy_caps, - StaBackgroundScanCapabilities* aidl_caps); -legacy_hal::wifi_band convertAidlWifiBandToLegacy(WifiBand band); -bool convertAidlGscanParamsToLegacy(const StaBackgroundScanParameters& aidl_scan_params, - legacy_hal::wifi_scan_cmd_params* legacy_scan_params); -// |has_ie_data| indicates whether or not the wifi_scan_result includes 802.11 -// Information Elements (IEs) -bool convertLegacyGscanResultToAidl(const legacy_hal::wifi_scan_result& legacy_scan_result, - bool has_ie_data, StaScanResult* aidl_scan_result); -// |cached_results| is assumed to not include IEs. -bool convertLegacyVectorOfCachedGscanResultsToAidl( - const std::vector& legacy_cached_scan_results, - std::vector* aidl_scan_datas); -bool convertLegacyLinkLayerStatsToAidl(const legacy_hal::LinkLayerStats& legacy_stats, - StaLinkLayerStats* aidl_stats); -bool convertLegacyRoamingCapabilitiesToAidl( - const legacy_hal::wifi_roaming_capabilities& legacy_caps, - StaRoamingCapabilities* aidl_caps); -bool convertAidlRoamingConfigToLegacy(const StaRoamingConfig& aidl_config, - legacy_hal::wifi_roaming_config* legacy_config); -legacy_hal::fw_roaming_state_t convertAidlRoamingStateToLegacy(StaRoamingState state); -bool convertLegacyVectorOfDebugTxPacketFateToAidl( - const std::vector& legacy_fates, - std::vector* aidl_fates); -bool convertLegacyVectorOfDebugRxPacketFateToAidl( - const std::vector& legacy_fates, - std::vector* aidl_fates); - -// NAN iface conversion methods. -void convertToNanStatus(legacy_hal::NanStatusType type, const char* str, size_t max_len, - NanStatus* nanStatus); -bool convertAidlNanEnableRequestToLegacy(const NanEnableRequest& aidl_request1, - const NanConfigRequestSupplemental& aidl_request2, - legacy_hal::NanEnableRequest* legacy_request); -bool convertAidlNanConfigRequestToLegacy(const NanConfigRequest& aidl_request1, - const NanConfigRequestSupplemental& aidl_request2, - legacy_hal::NanConfigRequest* legacy_request); -bool convertAidlNanPublishRequestToLegacy(const NanPublishRequest& aidl_request, - legacy_hal::NanPublishRequest* legacy_request); -bool convertAidlNanSubscribeRequestToLegacy(const NanSubscribeRequest& aidl_request, - legacy_hal::NanSubscribeRequest* legacy_request); -bool convertAidlNanTransmitFollowupRequestToLegacy( - const NanTransmitFollowupRequest& aidl_request, - legacy_hal::NanTransmitFollowupRequest* legacy_request); -bool convertAidlNanDataPathInitiatorRequestToLegacy( - const NanInitiateDataPathRequest& aidl_request, - legacy_hal::NanDataPathInitiatorRequest* legacy_request); -bool convertAidlNanDataPathIndicationResponseToLegacy( - const NanRespondToDataPathIndicationRequest& aidl_response, - legacy_hal::NanDataPathIndicationResponse* legacy_response); -bool convertLegacyNanResponseHeaderToAidl(const legacy_hal::NanResponseMsg& legacy_response, - NanStatus* nanStatus); -bool convertLegacyNanCapabilitiesResponseToAidl(const legacy_hal::NanCapabilities& legacy_response, - NanCapabilities* aidl_response); -bool convertLegacyNanMatchIndToAidl(const legacy_hal::NanMatchInd& legacy_ind, - NanMatchInd* aidl_ind); -bool convertLegacyNanFollowupIndToAidl(const legacy_hal::NanFollowupInd& legacy_ind, - NanFollowupReceivedInd* aidl_ind); -bool convertLegacyNanDataPathRequestIndToAidl(const legacy_hal::NanDataPathRequestInd& legacy_ind, - NanDataPathRequestInd* aidl_ind); -bool convertLegacyNanDataPathConfirmIndToAidl(const legacy_hal::NanDataPathConfirmInd& legacy_ind, - NanDataPathConfirmInd* aidl_ind); -bool convertLegacyNanDataPathScheduleUpdateIndToAidl( - const legacy_hal::NanDataPathScheduleUpdateInd& legacy_ind, - NanDataPathScheduleUpdateInd* aidl_ind); - -// RTT controller conversion methods. -bool convertAidlVectorOfRttConfigToLegacy(const std::vector& aidl_configs, - std::vector* legacy_configs); -bool convertAidlRttLciInformationToLegacy(const RttLciInformation& aidl_info, - legacy_hal::wifi_lci_information* legacy_info); -bool convertAidlRttLcrInformationToLegacy(const RttLcrInformation& aidl_info, - legacy_hal::wifi_lcr_information* legacy_info); -bool convertAidlRttResponderToLegacy(const RttResponder& aidl_responder, - legacy_hal::wifi_rtt_responder* legacy_responder); -bool convertAidlWifiChannelInfoToLegacy(const WifiChannelInfo& aidl_info, - legacy_hal::wifi_channel_info* legacy_info); -bool convertLegacyRttResponderToAidl(const legacy_hal::wifi_rtt_responder& legacy_responder, - RttResponder* aidl_responder); -bool convertLegacyRttCapabilitiesToAidl( - const legacy_hal::wifi_rtt_capabilities& legacy_capabilities, - RttCapabilities* aidl_capabilities); -bool convertLegacyVectorOfRttResultToAidl( - const std::vector& legacy_results, - std::vector* aidl_results); -uint32_t convertAidlWifiBandToLegacyMacBand(WifiBand band); -uint32_t convertAidlWifiIfaceModeToLegacy(uint32_t aidl_iface_mask); -uint32_t convertAidlUsableChannelFilterToLegacy(uint32_t aidl_filter_mask); -bool convertLegacyWifiUsableChannelsToAidl( - const std::vector& legacy_usable_channels, - std::vector* aidl_usable_channels); -bool convertLegacyPeerInfoStatsToAidl(const legacy_hal::WifiPeerInfo& legacy_peer_info_stats, - StaPeerInfo* aidl_peer_info_stats); -bool convertLegacyWifiRateInfoToAidl(const legacy_hal::wifi_rate& legacy_rate, - WifiRateInfo* aidl_rate); -} // namespace aidl_struct_util -} // namespace wifi -} // namespace hardware -} // namespace android -} // namespace aidl - -#endif // AIDL_STRUCT_UTIL_H_ diff --git a/wifi/aidl/default/android.hardware.wifi-service-lazy.rc b/wifi/aidl/default/android.hardware.wifi-service-lazy.rc deleted file mode 100644 index 12d3ff7bde..0000000000 --- a/wifi/aidl/default/android.hardware.wifi-service-lazy.rc +++ /dev/null @@ -1,8 +0,0 @@ -service vendor.wifi_hal_legacy /vendor/bin/hw/android.hardware.wifi-service-lazy - interface aidl android.hardware.wifi.IWifi/default - oneshot - disabled - class hal - capabilities NET_ADMIN NET_RAW SYS_MODULE - user wifi - group wifi gps diff --git a/wifi/aidl/default/android.hardware.wifi-service.rc b/wifi/aidl/default/android.hardware.wifi-service.rc deleted file mode 100644 index ec8acf5767..0000000000 --- a/wifi/aidl/default/android.hardware.wifi-service.rc +++ /dev/null @@ -1,6 +0,0 @@ -service vendor.wifi_hal_legacy /vendor/bin/hw/android.hardware.wifi-service - interface aidl android.hardware.wifi.IWifi/default - class hal - capabilities NET_ADMIN NET_RAW SYS_MODULE - user wifi - group wifi gps diff --git a/wifi/aidl/default/android.hardware.wifi-service.xml b/wifi/aidl/default/android.hardware.wifi-service.xml deleted file mode 100644 index 5398ee77b5..0000000000 --- a/wifi/aidl/default/android.hardware.wifi-service.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - android.hardware.wifi - IWifi/default - - diff --git a/wifi/aidl/default/service.cpp b/wifi/aidl/default/service.cpp deleted file mode 100644 index 789a7a5868..0000000000 --- a/wifi/aidl/default/service.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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. - */ - -#include -#include -#include -#include - -#include "wifi.h" -#include "wifi_feature_flags.h" -#include "wifi_legacy_hal.h" -#include "wifi_legacy_hal_factory.h" -#include "wifi_mode_controller.h" - -using aidl::android::hardware::wifi::feature_flags::WifiFeatureFlags; -using aidl::android::hardware::wifi::legacy_hal::WifiLegacyHal; -using aidl::android::hardware::wifi::legacy_hal::WifiLegacyHalFactory; -using aidl::android::hardware::wifi::mode_controller::WifiModeController; - -#ifdef LAZY_SERVICE -const bool kLazyService = true; -#else -const bool kLazyService = false; -#endif - -int main(int /*argc*/, char** argv) { - signal(SIGPIPE, SIG_IGN); - android::base::InitLogging(argv, android::base::LogdLogger(android::base::SYSTEM)); - LOG(INFO) << "Wifi Hal is booting up..."; - - // Prepare the RPC-serving thread pool. Allocate 1 thread in the pool, - // which our main thread will join below. - ABinderProcess_setThreadPoolMaxThreadCount(1); - - const auto iface_tool = std::make_shared<::android::wifi_system::InterfaceTool>(); - const auto legacy_hal_factory = std::make_shared(iface_tool); - - // Setup binder service - std::shared_ptr service = - ndk::SharedRefBase::make( - iface_tool, legacy_hal_factory, std::make_shared(), - std::make_shared()); - std::string instance = - std::string() + aidl::android::hardware::wifi::Wifi::descriptor + "/default"; - if (kLazyService) { - auto result = - AServiceManager_registerLazyService(service->asBinder().get(), instance.c_str()); - CHECK_EQ(result, STATUS_OK) << "Failed to register lazy wifi HAL"; - } else { - auto result = AServiceManager_addService(service->asBinder().get(), instance.c_str()); - CHECK_EQ(result, STATUS_OK) << "Failed to register wifi HAL"; - } - - ABinderProcess_startThreadPool(); - LOG(INFO) << "Joining RPC thread pool"; - ABinderProcess_joinThreadPool(); - - LOG(INFO) << "Wifi Hal is terminating..."; - return 0; -} diff --git a/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp b/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp deleted file mode 100644 index d40801faef..0000000000 --- a/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/* - * 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. - */ - -#include -#include -#include -#include - -#include "wifi_nan_iface.h" - -#include "mock_interface_tool.h" -#include "mock_wifi_feature_flags.h" -#include "mock_wifi_iface_util.h" -#include "mock_wifi_legacy_hal.h" - -using testing::NiceMock; -using testing::Return; -using testing::Test; - -namespace { -constexpr char kIfaceName[] = "mockWlan0"; -} // namespace - -namespace aidl { -namespace android { -namespace hardware { -namespace wifi { - -bool CaptureIfaceEventHandlers(const std::string& /* iface_name*/, - iface_util::IfaceEventHandlers in_iface_event_handlers, - iface_util::IfaceEventHandlers* out_iface_event_handlers) { - *out_iface_event_handlers = in_iface_event_handlers; - return true; -} - -class MockNanIface : public WifiNanIface { - public: - MockNanIface(const std::string& ifname, bool is_dedicated_iface, - const std::weak_ptr legacy_hal, - const std::weak_ptr iface_util) - : WifiNanIface(ifname, is_dedicated_iface, legacy_hal, iface_util) {} - - static std::shared_ptr createMock( - const std::string& ifname, bool is_dedicated_iface, - const std::weak_ptr legacy_hal, - const std::weak_ptr iface_util) { - std::shared_ptr ptr = ndk::SharedRefBase::make( - ifname, is_dedicated_iface, legacy_hal, iface_util); - std::weak_ptr weak_ptr_this(ptr); - ptr->setWeakPtr(weak_ptr_this); - ptr->registerCallbackHandlers(); - return ptr; - } - - // Override getEventCallbacks() so that we can return a mocked callback object. - std::set> getEventCallbacks() override { - return {callback_}; - } - - void setMockCallback(std::shared_ptr cb) { callback_ = cb; } - - private: - std::shared_ptr callback_; -}; - -class MockNanIfaceEventCallback : public IWifiNanIfaceEventCallback { - public: - ndk::SpAIBinder asBinder() override { return ::ndk::SpAIBinder{}; } - bool isRemote() override { return false; } - - ::ndk::ScopedAStatus getInterfaceVersion(int32_t* _aidl_return) override { - *_aidl_return = 1; - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus getInterfaceHash(std::string* _aidl_return) override { - *_aidl_return = "some_hash"; - return ndk::ScopedAStatus::ok(); - } - - MOCK_METHOD3(notifyCapabilitiesResponse, - ndk::ScopedAStatus(char16_t, const NanStatus&, const NanCapabilities&)); - MOCK_METHOD2(notifyEnableResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); - MOCK_METHOD2(notifyConfigResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); - MOCK_METHOD2(notifyDisableResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); - MOCK_METHOD3(notifyStartPublishResponse, - ndk::ScopedAStatus(char16_t, const NanStatus&, int8_t)); - MOCK_METHOD2(notifyStopPublishResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); - MOCK_METHOD3(notifyStartSubscribeResponse, - ndk::ScopedAStatus(char16_t, const NanStatus&, int8_t)); - MOCK_METHOD2(notifyStopSubscribeResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); - MOCK_METHOD2(notifyTransmitFollowupResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); - MOCK_METHOD2(notifyCreateDataInterfaceResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); - MOCK_METHOD2(notifyDeleteDataInterfaceResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); - MOCK_METHOD3(notifyInitiateDataPathResponse, - ndk::ScopedAStatus(char16_t, const NanStatus&, int32_t)); - MOCK_METHOD2(notifyRespondToDataPathIndicationResponse, - ndk::ScopedAStatus(char16_t, const NanStatus&)); - MOCK_METHOD2(notifyTerminateDataPathResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); - MOCK_METHOD1(eventClusterEvent, ndk::ScopedAStatus(const NanClusterEventInd&)); - MOCK_METHOD1(eventDisabled, ndk::ScopedAStatus(const NanStatus&)); - MOCK_METHOD2(eventPublishTerminated, ndk::ScopedAStatus(int8_t, const NanStatus&)); - MOCK_METHOD2(eventSubscribeTerminated, ndk::ScopedAStatus(int8_t, const NanStatus&)); - MOCK_METHOD1(eventMatch, ndk::ScopedAStatus(const NanMatchInd&)); - MOCK_METHOD2(eventMatchExpired, ndk::ScopedAStatus(int8_t, int32_t)); - MOCK_METHOD1(eventFollowupReceived, ndk::ScopedAStatus(const NanFollowupReceivedInd&)); - MOCK_METHOD2(eventTransmitFollowup, ndk::ScopedAStatus(char16_t, const NanStatus&)); - MOCK_METHOD1(eventDataPathRequest, ndk::ScopedAStatus(const NanDataPathRequestInd&)); - MOCK_METHOD1(eventDataPathConfirm, ndk::ScopedAStatus(const NanDataPathConfirmInd&)); - MOCK_METHOD1(eventDataPathTerminated, ndk::ScopedAStatus(int32_t)); - MOCK_METHOD1(eventDataPathScheduleUpdate, - ndk::ScopedAStatus(const NanDataPathScheduleUpdateInd&)); -}; - -class WifiNanIfaceTest : public Test { - protected: - legacy_hal::wifi_hal_fn fake_func_table_; - std::shared_ptr> iface_tool_{ - new NiceMock<::android::wifi_system::MockInterfaceTool>}; - std::shared_ptr> legacy_hal_{ - new NiceMock(iface_tool_, fake_func_table_, true)}; - std::shared_ptr> iface_util_{ - new NiceMock(iface_tool_, legacy_hal_)}; -}; - -TEST_F(WifiNanIfaceTest, IfacEventHandlers_OnStateToggleOffOn) { - // Ensure that event handlers are registered during nan iface creation. - iface_util::IfaceEventHandlers captured_iface_event_handlers = {}; - EXPECT_CALL(*legacy_hal_, nanRegisterCallbackHandlers(testing::_, testing::_)) - .WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS)); - EXPECT_CALL(*iface_util_, registerIfaceEventHandlers(testing::_, testing::_)) - .WillOnce(testing::Invoke(bind(CaptureIfaceEventHandlers, std::placeholders::_1, - std::placeholders::_2, &captured_iface_event_handlers))); - - // Create nan iface and register a callback. - // Note: Since we can't register a callback directly (gTest fails on - // AIBinder_linkToDeath), simulate the registration by overriding - // getEventCallbacks() to return our mock callback object. - std::shared_ptr mock_nan_iface = - MockNanIface::createMock(kIfaceName, false, legacy_hal_, iface_util_); - std::shared_ptr mock_event_callback = - ndk::SharedRefBase::make(); - mock_nan_iface->setMockCallback(mock_event_callback); - - // Ensure that the eventDisabled() function in the mock callback will be invoked. - NanStatus expected_nan_status = {NanStatusCode::UNSUPPORTED_CONCURRENCY_NAN_DISABLED, ""}; - EXPECT_CALL(*mock_event_callback, eventDisabled(expected_nan_status)).Times(1); - - // Trigger the iface state toggle callback. - captured_iface_event_handlers.on_state_toggle_off_on(kIfaceName); -} - -} // namespace wifi -} // namespace hardware -} // namespace android -} // namespace aidl diff --git a/wifi/aidl/default/wifi.h b/wifi/aidl/default/wifi.h deleted file mode 100644 index 933452448e..0000000000 --- a/wifi/aidl/default/wifi.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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. - */ - -#ifndef WIFI_H_ -#define WIFI_H_ - -#include -#include -#include - -#include - -#include "aidl_callback_util.h" -#include "wifi_chip.h" -#include "wifi_feature_flags.h" -#include "wifi_legacy_hal.h" -#include "wifi_legacy_hal_factory.h" -#include "wifi_mode_controller.h" - -namespace aidl { -namespace android { -namespace hardware { -namespace wifi { - -/** - * Root AIDL interface object used to control the Wifi HAL. - */ -class Wifi : public BnWifi { - public: - Wifi(const std::shared_ptr<::android::wifi_system::InterfaceTool> iface_tool, - const std::shared_ptr legacy_hal_factory, - const std::shared_ptr mode_controller, - const std::shared_ptr feature_flags); - - bool isValid(); - - // AIDL methods exposed. - ndk::ScopedAStatus registerEventCallback( - const std::shared_ptr& in_callback) override; - ndk::ScopedAStatus isStarted(bool* _aidl_return) override; - ndk::ScopedAStatus start() override; - ndk::ScopedAStatus stop() override; - ndk::ScopedAStatus getChipIds(std::vector* _aidl_return) override; - ndk::ScopedAStatus getChip(int32_t in_chipId, - std::shared_ptr* _aidl_return) override; - binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; - - private: - enum class RunState { STOPPED, STARTED, STOPPING }; - - // Corresponding worker functions for the AIDL methods. - ndk::ScopedAStatus registerEventCallbackInternal( - const std::shared_ptr& event_callback __unused); - ndk::ScopedAStatus startInternal(); - ndk::ScopedAStatus stopInternal(std::unique_lock* lock); - std::pair, ndk::ScopedAStatus> getChipIdsInternal(); - std::pair, ndk::ScopedAStatus> getChipInternal(int32_t chip_id); - - ndk::ScopedAStatus initializeModeControllerAndLegacyHal(); - ndk::ScopedAStatus stopLegacyHalAndDeinitializeModeController( - std::unique_lock* lock); - int32_t getChipIdFromWifiChip(std::shared_ptr& chip); - - // Instance is created in this root level |IWifi| AIDL interface object - // and shared with all the child AIDL interface objects. - std::shared_ptr<::android::wifi_system::InterfaceTool> iface_tool_; - std::shared_ptr legacy_hal_factory_; - std::shared_ptr mode_controller_; - std::vector> legacy_hals_; - std::shared_ptr feature_flags_; - RunState run_state_; - std::vector> chips_; - aidl_callback_util::AidlCallbackHandler event_cb_handler_; - - DISALLOW_COPY_AND_ASSIGN(Wifi); -}; - -} // namespace wifi -} // namespace hardware -} // namespace android -} // namespace aidl - -#endif // WIFI_H_ diff --git a/wifi/aidl/default/wifi_ap_iface.h b/wifi/aidl/default/wifi_ap_iface.h deleted file mode 100644 index b5673fcaac..0000000000 --- a/wifi/aidl/default/wifi_ap_iface.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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. - */ - -#ifndef WIFI_AP_IFACE_H_ -#define WIFI_AP_IFACE_H_ - -#include -#include - -#include "wifi_iface_util.h" -#include "wifi_legacy_hal.h" - -namespace aidl { -namespace android { -namespace hardware { -namespace wifi { - -/** - * AIDL interface object used to control an AP Iface instance. - */ -class WifiApIface : public BnWifiApIface { - public: - WifiApIface(const std::string& ifname, const std::vector& instances, - const std::weak_ptr legacy_hal, - const std::weak_ptr iface_util); - // Refer to |WifiChip::invalidate()|. - void invalidate(); - bool isValid(); - std::string getName(); - void removeInstance(std::string instance); - - // AIDL methods exposed. - ndk::ScopedAStatus getName(std::string* _aidl_return) override; - ndk::ScopedAStatus setCountryCode(const std::array& in_code) override; - ndk::ScopedAStatus getValidFrequenciesForBand(WifiBand in_band, - std::vector* _aidl_return) override; - ndk::ScopedAStatus setMacAddress(const std::array& in_mac) override; - ndk::ScopedAStatus getFactoryMacAddress(std::array* _aidl_return) override; - ndk::ScopedAStatus resetToFactoryMacAddress() override; - ndk::ScopedAStatus getBridgedInstances(std::vector* _aidl_return) override; - - private: - // Corresponding worker functions for the AIDL methods. - std::pair getNameInternal(); - ndk::ScopedAStatus setCountryCodeInternal(const std::array& code); - std::pair, ndk::ScopedAStatus> getValidFrequenciesForBandInternal( - WifiBand band); - ndk::ScopedAStatus setMacAddressInternal(const std::array& mac); - std::pair, ndk::ScopedAStatus> getFactoryMacAddressInternal( - const std::string& ifaceName); - ndk::ScopedAStatus resetToFactoryMacAddressInternal(); - std::pair, ndk::ScopedAStatus> getBridgedInstancesInternal(); - - std::string ifname_; - std::vector instances_; - std::weak_ptr legacy_hal_; - std::weak_ptr iface_util_; - bool is_valid_; - - DISALLOW_COPY_AND_ASSIGN(WifiApIface); -}; - -} // namespace wifi -} // namespace hardware -} // namespace android -} // namespace aidl - -#endif // WIFI_AP_IFACE_H_ diff --git a/wifi/aidl/default/wifi_chip.h b/wifi/aidl/default/wifi_chip.h deleted file mode 100644 index 59eaa4a58c..0000000000 --- a/wifi/aidl/default/wifi_chip.h +++ /dev/null @@ -1,287 +0,0 @@ -/* - * 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. - */ - -#ifndef WIFI_CHIP_H_ -#define WIFI_CHIP_H_ - -#include -#include -#include - -#include -#include -#include - -#include "aidl_callback_util.h" -#include "ringbuffer.h" -#include "wifi_ap_iface.h" -#include "wifi_feature_flags.h" -#include "wifi_legacy_hal.h" -#include "wifi_mode_controller.h" -#include "wifi_nan_iface.h" -#include "wifi_p2p_iface.h" -#include "wifi_rtt_controller.h" -#include "wifi_sta_iface.h" - -namespace aidl { -namespace android { -namespace hardware { -namespace wifi { - -/** - * AIDL interface object used to control a Wifi HAL chip instance. - * Since there is only a single chip instance used today, there is no - * identifying handle information stored here. - */ -class WifiChip : public BnWifiChip { - public: - WifiChip(int32_t chip_id, bool is_primary, - const std::weak_ptr legacy_hal, - const std::weak_ptr mode_controller, - const std::shared_ptr iface_util, - const std::weak_ptr feature_flags, - const std::function& subsystemCallbackHandler); - - // Factory method - use instead of default constructor. - static std::shared_ptr create( - int32_t chip_id, bool is_primary, - const std::weak_ptr legacy_hal, - const std::weak_ptr mode_controller, - const std::shared_ptr iface_util, - const std::weak_ptr feature_flags, - const std::function& subsystemCallbackHandler); - - // AIDL does not provide a built-in mechanism to let the server invalidate - // an AIDL interface object after creation. If any client process holds onto - // a reference to the object in their context, any method calls on that - // reference will continue to be directed to the server. - // - // However Wifi HAL needs to control the lifetime of these objects. So, add - // a public |invalidate| method to |WifiChip| and its child objects. This - // will be used to mark an object invalid when either: - // a) Wifi HAL is stopped, or - // b) Wifi Chip is reconfigured. - // - // All AIDL method implementations should check if the object is still - // marked valid before processing them. - void invalidate(); - bool isValid(); - std::set> getEventCallbacks(); - - // AIDL methods exposed. - ndk::ScopedAStatus getId(int32_t* _aidl_return) override; - ndk::ScopedAStatus registerEventCallback( - const std::shared_ptr& in_callback) override; - ndk::ScopedAStatus getCapabilities(IWifiChip::ChipCapabilityMask* _aidl_return) override; - ndk::ScopedAStatus getAvailableModes(std::vector* _aidl_return) override; - ndk::ScopedAStatus configureChip(int32_t in_modeId) override; - ndk::ScopedAStatus getMode(int32_t* _aidl_return) override; - ndk::ScopedAStatus requestChipDebugInfo(IWifiChip::ChipDebugInfo* _aidl_return) override; - ndk::ScopedAStatus requestDriverDebugDump(std::vector* _aidl_return) override; - ndk::ScopedAStatus requestFirmwareDebugDump(std::vector* _aidl_return) override; - ndk::ScopedAStatus createApIface(std::shared_ptr* _aidl_return) override; - ndk::ScopedAStatus createBridgedApIface(std::shared_ptr* _aidl_return) override; - ndk::ScopedAStatus getApIfaceNames(std::vector* _aidl_return) override; - ndk::ScopedAStatus getApIface(const std::string& in_ifname, - std::shared_ptr* _aidl_return) override; - ndk::ScopedAStatus removeApIface(const std::string& in_ifname) override; - ndk::ScopedAStatus removeIfaceInstanceFromBridgedApIface( - const std::string& in_brIfaceName, const std::string& in_ifaceInstanceName) override; - ndk::ScopedAStatus createNanIface(std::shared_ptr* _aidl_return) override; - ndk::ScopedAStatus getNanIfaceNames(std::vector* _aidl_return) override; - ndk::ScopedAStatus getNanIface(const std::string& in_ifname, - std::shared_ptr* _aidl_return) override; - ndk::ScopedAStatus removeNanIface(const std::string& in_ifname) override; - ndk::ScopedAStatus createP2pIface(std::shared_ptr* _aidl_return) override; - ndk::ScopedAStatus getP2pIfaceNames(std::vector* _aidl_return) override; - ndk::ScopedAStatus getP2pIface(const std::string& in_ifname, - std::shared_ptr* _aidl_return) override; - ndk::ScopedAStatus removeP2pIface(const std::string& in_ifname) override; - ndk::ScopedAStatus createStaIface(std::shared_ptr* _aidl_return) override; - ndk::ScopedAStatus getStaIfaceNames(std::vector* _aidl_return) override; - ndk::ScopedAStatus getStaIface(const std::string& in_ifname, - std::shared_ptr* _aidl_return) override; - ndk::ScopedAStatus removeStaIface(const std::string& in_ifname) override; - ndk::ScopedAStatus createRttController( - const std::shared_ptr& in_boundIface, - std::shared_ptr* _aidl_return) override; - ndk::ScopedAStatus getDebugRingBuffersStatus( - std::vector* _aidl_return) override; - ndk::ScopedAStatus startLoggingToDebugRingBuffer( - const std::string& in_ringName, WifiDebugRingBufferVerboseLevel in_verboseLevel, - int32_t in_maxIntervalInSec, int32_t in_minDataSizeInBytes) override; - ndk::ScopedAStatus forceDumpToDebugRingBuffer(const std::string& in_ringName) override; - ndk::ScopedAStatus flushRingBufferToFile() override; - ndk::ScopedAStatus stopLoggingToDebugRingBuffer() override; - ndk::ScopedAStatus getDebugHostWakeReasonStats( - WifiDebugHostWakeReasonStats* _aidl_return) override; - ndk::ScopedAStatus enableDebugErrorAlerts(bool in_enable) override; - ndk::ScopedAStatus selectTxPowerScenario(IWifiChip::TxPowerScenario in_scenario) override; - ndk::ScopedAStatus resetTxPowerScenario() override; - ndk::ScopedAStatus setLatencyMode(IWifiChip::LatencyMode in_mode) override; - ndk::ScopedAStatus setMultiStaPrimaryConnection(const std::string& in_ifName) override; - ndk::ScopedAStatus setMultiStaUseCase(IWifiChip::MultiStaUseCase in_useCase) override; - ndk::ScopedAStatus setCoexUnsafeChannels( - const std::vector& in_unsafeChannels, - CoexRestriction in_restrictions) override; - ndk::ScopedAStatus setCountryCode(const std::array& in_code) override; - ndk::ScopedAStatus getUsableChannels(WifiBand in_band, WifiIfaceMode in_ifaceModeMask, - UsableChannelFilter in_filterMask, - std::vector* _aidl_return) override; - ndk::ScopedAStatus triggerSubsystemRestart() override; - ndk::ScopedAStatus getSupportedRadioCombinationsMatrix( - WifiRadioCombinationMatrix* _aidl_return) override; - binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; - - private: - void invalidateAndRemoveAllIfaces(); - // When a STA iface is removed any dependent NAN-ifaces/RTT-controllers are - // invalidated & removed. - void invalidateAndRemoveDependencies(const std::string& removed_iface_name); - - // Corresponding worker functions for the AIDL methods. - std::pair getIdInternal(); - ndk::ScopedAStatus registerEventCallbackInternal( - const std::shared_ptr& event_callback); - std::pair getCapabilitiesInternal(); - std::pair, ndk::ScopedAStatus> getAvailableModesInternal(); - ndk::ScopedAStatus configureChipInternal(std::unique_lock* lock, - int32_t mode_id); - std::pair getModeInternal(); - std::pair requestChipDebugInfoInternal(); - std::pair, ndk::ScopedAStatus> requestDriverDebugDumpInternal(); - std::pair, ndk::ScopedAStatus> requestFirmwareDebugDumpInternal(); - std::shared_ptr newWifiApIface(std::string& ifname); - ndk::ScopedAStatus createVirtualApInterface(const std::string& apVirtIf); - std::pair, ndk::ScopedAStatus> createApIfaceInternal(); - std::pair, ndk::ScopedAStatus> createBridgedApIfaceInternal(); - std::pair, ndk::ScopedAStatus> getApIfaceNamesInternal(); - std::pair, ndk::ScopedAStatus> getApIfaceInternal( - const std::string& ifname); - ndk::ScopedAStatus removeApIfaceInternal(const std::string& ifname); - ndk::ScopedAStatus removeIfaceInstanceFromBridgedApIfaceInternal( - const std::string& brIfaceName, const std::string& ifInstanceName); - std::pair, ndk::ScopedAStatus> createNanIfaceInternal(); - std::pair, ndk::ScopedAStatus> getNanIfaceNamesInternal(); - std::pair, ndk::ScopedAStatus> getNanIfaceInternal( - const std::string& ifname); - ndk::ScopedAStatus removeNanIfaceInternal(const std::string& ifname); - std::pair, ndk::ScopedAStatus> createP2pIfaceInternal(); - std::pair, ndk::ScopedAStatus> getP2pIfaceNamesInternal(); - std::pair, ndk::ScopedAStatus> getP2pIfaceInternal( - const std::string& ifname); - ndk::ScopedAStatus removeP2pIfaceInternal(const std::string& ifname); - std::pair, ndk::ScopedAStatus> createStaIfaceInternal(); - std::pair, ndk::ScopedAStatus> getStaIfaceNamesInternal(); - std::pair, ndk::ScopedAStatus> getStaIfaceInternal( - const std::string& ifname); - ndk::ScopedAStatus removeStaIfaceInternal(const std::string& ifname); - std::pair, ndk::ScopedAStatus> createRttControllerInternal( - const std::shared_ptr& bound_iface); - std::pair, ndk::ScopedAStatus> - getDebugRingBuffersStatusInternal(); - ndk::ScopedAStatus startLoggingToDebugRingBufferInternal( - const std::string& ring_name, WifiDebugRingBufferVerboseLevel verbose_level, - uint32_t max_interval_in_sec, uint32_t min_data_size_in_bytes); - ndk::ScopedAStatus forceDumpToDebugRingBufferInternal(const std::string& ring_name); - ndk::ScopedAStatus flushRingBufferToFileInternal(); - ndk::ScopedAStatus stopLoggingToDebugRingBufferInternal(); - std::pair - getDebugHostWakeReasonStatsInternal(); - ndk::ScopedAStatus enableDebugErrorAlertsInternal(bool enable); - ndk::ScopedAStatus selectTxPowerScenarioInternal(IWifiChip::TxPowerScenario scenario); - ndk::ScopedAStatus resetTxPowerScenarioInternal(); - ndk::ScopedAStatus setLatencyModeInternal(IWifiChip::LatencyMode mode); - ndk::ScopedAStatus setMultiStaPrimaryConnectionInternal(const std::string& ifname); - ndk::ScopedAStatus setMultiStaUseCaseInternal(IWifiChip::MultiStaUseCase use_case); - ndk::ScopedAStatus setCoexUnsafeChannelsInternal( - std::vector unsafe_channels, - CoexRestriction restrictions); - ndk::ScopedAStatus setCountryCodeInternal(const std::array& in_code); - std::pair, ndk::ScopedAStatus> getUsableChannelsInternal( - WifiBand band, WifiIfaceMode ifaceModeMask, UsableChannelFilter filterMask); - ndk::ScopedAStatus handleChipConfiguration(std::unique_lock* lock, - int32_t mode_id); - ndk::ScopedAStatus registerDebugRingBufferCallback(); - ndk::ScopedAStatus registerRadioModeChangeCallback(); - - std::vector getCurrentModeConcurrencyCombinations(); - std::map getCurrentConcurrencyCombination(); - std::vector> expandConcurrencyCombinations( - const ChipConcurrencyCombination& combination); - bool canExpandedConcurrencyComboSupportConcurrencyTypeWithCurrentTypes( - const std::map& expanded_combo, - IfaceConcurrencyType requested_type); - bool canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType requested_type); - bool canExpandedConcurrencyComboSupportConcurrencyCombo( - const std::map& expanded_combo, - const std::map& req_combo); - bool canCurrentModeSupportConcurrencyCombo( - const std::map& req_combo); - bool canCurrentModeSupportConcurrencyType(IfaceConcurrencyType requested_type); - - bool isValidModeId(int32_t mode_id); - bool isStaApConcurrencyAllowedInCurrentMode(); - bool isDualStaConcurrencyAllowedInCurrentMode(); - uint32_t startIdxOfApIface(); - std::string getFirstActiveWlanIfaceName(); - std::string allocateApOrStaIfaceName(IfaceType type, uint32_t start_idx); - std::string allocateApIfaceName(); - std::vector allocateBridgedApInstanceNames(); - std::string allocateStaIfaceName(); - bool writeRingbufferFilesInternal(); - std::string getWlanIfaceNameWithType(IfaceType type, unsigned idx); - void invalidateAndClearBridgedApAll(); - void invalidateAndClearBridgedAp(const std::string& br_name); - bool findUsingNameFromBridgedApInstances(const std::string& name); - ndk::ScopedAStatus triggerSubsystemRestartInternal(); - std::pair - getSupportedRadioCombinationsMatrixInternal(); - void setWeakPtr(std::weak_ptr ptr); - - int32_t chip_id_; - std::weak_ptr legacy_hal_; - std::weak_ptr mode_controller_; - std::shared_ptr iface_util_; - std::vector> ap_ifaces_; - std::vector> nan_ifaces_; - std::vector> p2p_ifaces_; - std::vector> sta_ifaces_; - std::vector> rtt_controllers_; - std::map ringbuffer_map_; - bool is_valid_; - // Members pertaining to chip configuration. - int32_t current_mode_id_; - std::mutex lock_t; - std::vector modes_; - // The legacy ring buffer callback API has only a global callback - // registration mechanism. Use this to check if we have already - // registered a callback. - bool debug_ring_buffer_cb_registered_; - aidl_callback_util::AidlCallbackHandler event_cb_handler_; - std::weak_ptr weak_ptr_this_; - - const std::function subsystemCallbackHandler_; - std::map> br_ifaces_ap_instances_; - DISALLOW_COPY_AND_ASSIGN(WifiChip); -}; - -} // namespace wifi -} // namespace hardware -} // namespace android -} // namespace aidl - -#endif // WIFI_CHIP_H_ diff --git a/wifi/aidl/default/wifi_nan_iface.cpp b/wifi/aidl/default/wifi_nan_iface.cpp deleted file mode 100644 index 9edef09b7b..0000000000 --- a/wifi/aidl/default/wifi_nan_iface.cpp +++ /dev/null @@ -1,751 +0,0 @@ -/* - * 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. - */ - -#include "wifi_nan_iface.h" - -#include - -#include "aidl_return_util.h" -#include "aidl_struct_util.h" -#include "wifi_status_util.h" - -namespace aidl { -namespace android { -namespace hardware { -namespace wifi { -using aidl_return_util::validateAndCall; - -WifiNanIface::WifiNanIface(const std::string& ifname, bool is_dedicated_iface, - const std::weak_ptr legacy_hal, - const std::weak_ptr iface_util) - : ifname_(ifname), - is_dedicated_iface_(is_dedicated_iface), - legacy_hal_(legacy_hal), - iface_util_(iface_util), - is_valid_(true) {} - -std::shared_ptr WifiNanIface::create( - const std::string& ifname, bool is_dedicated_iface, - const std::weak_ptr legacy_hal, - const std::weak_ptr iface_util) { - std::shared_ptr ptr = ndk::SharedRefBase::make( - ifname, is_dedicated_iface, legacy_hal, iface_util); - if (is_dedicated_iface) { - // If using a dedicated iface, set the iface up first. - if (!iface_util.lock()->setUpState(ifname, true)) { - // Fatal failure, invalidate the iface object. - ptr->invalidate(); - return nullptr; - } - } - std::weak_ptr weak_ptr_this(ptr); - ptr->setWeakPtr(weak_ptr_this); - ptr->registerCallbackHandlers(); - return ptr; -} - -void WifiNanIface::registerCallbackHandlers() { - // Register all the callbacks here. These should be valid for the lifetime - // of the object. Whenever the mode changes legacy HAL will remove - // all of these callbacks. - legacy_hal::NanCallbackHandlers callback_handlers; - std::weak_ptr weak_ptr_this = weak_ptr_this_; - - // Callback for response. - callback_handlers.on_notify_response = [weak_ptr_this](legacy_hal::transaction_id id, - const legacy_hal::NanResponseMsg& msg) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - NanStatus nanStatus; - if (!aidl_struct_util::convertLegacyNanResponseHeaderToAidl(msg, &nanStatus)) { - LOG(ERROR) << "Failed to convert nan response header"; - return; - } - - switch (msg.response_type) { - case legacy_hal::NAN_RESPONSE_ENABLED: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyEnableResponse(id, nanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_DISABLED: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyDisableResponse(id, nanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_PUBLISH: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyStartPublishResponse(id, nanStatus, - msg.body.publish_response.publish_id) - .isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_PUBLISH_CANCEL: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyStopPublishResponse(id, nanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_TRANSMIT_FOLLOWUP: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyTransmitFollowupResponse(id, nanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_SUBSCRIBE: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyStartSubscribeResponse( - id, nanStatus, msg.body.subscribe_response.subscribe_id) - .isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_SUBSCRIBE_CANCEL: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyStopSubscribeResponse(id, nanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_CONFIG: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyConfigResponse(id, nanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_GET_CAPABILITIES: { - NanCapabilities aidl_struct; - if (!aidl_struct_util::convertLegacyNanCapabilitiesResponseToAidl( - msg.body.nan_capabilities, &aidl_struct)) { - LOG(ERROR) << "Failed to convert nan capabilities response"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyCapabilitiesResponse(id, nanStatus, aidl_struct).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_DP_INTERFACE_CREATE: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyCreateDataInterfaceResponse(id, nanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_DP_INTERFACE_DELETE: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyDeleteDataInterfaceResponse(id, nanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_DP_INITIATOR_RESPONSE: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyInitiateDataPathResponse( - id, nanStatus, - msg.body.data_request_response.ndp_instance_id) - .isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_DP_RESPONDER_RESPONSE: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyRespondToDataPathIndicationResponse(id, nanStatus) - .isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_DP_END: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyTerminateDataPathResponse(id, nanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_BEACON_SDF_PAYLOAD: - /* fall through */ - case legacy_hal::NAN_RESPONSE_TCA: - /* fall through */ - case legacy_hal::NAN_RESPONSE_STATS: - /* fall through */ - case legacy_hal::NAN_RESPONSE_ERROR: - /* fall through */ - default: - LOG(ERROR) << "Unknown or unhandled response type: " << msg.response_type; - return; - } - }; - - callback_handlers.on_event_disc_eng_event = [weak_ptr_this]( - const legacy_hal::NanDiscEngEventInd& msg) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - NanClusterEventInd aidl_struct; - // event types defined identically - hence can be cast - aidl_struct.eventType = (NanClusterEventType)msg.event_type; - aidl_struct.addr = std::array(); - std::copy(msg.data.mac_addr.addr, msg.data.mac_addr.addr + 6, std::begin(aidl_struct.addr)); - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventClusterEvent(aidl_struct).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_disabled = [weak_ptr_this](const legacy_hal::NanDisabledInd& msg) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - NanStatus status; - aidl_struct_util::convertToNanStatus(msg.reason, msg.nan_reason, sizeof(msg.nan_reason), - &status); - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventDisabled(status).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_publish_terminated = - [weak_ptr_this](const legacy_hal::NanPublishTerminatedInd& msg) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - NanStatus status; - aidl_struct_util::convertToNanStatus(msg.reason, msg.nan_reason, - sizeof(msg.nan_reason), &status); - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventPublishTerminated(msg.publish_id, status).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_subscribe_terminated = - [weak_ptr_this](const legacy_hal::NanSubscribeTerminatedInd& msg) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - NanStatus status; - aidl_struct_util::convertToNanStatus(msg.reason, msg.nan_reason, - sizeof(msg.nan_reason), &status); - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventSubscribeTerminated(msg.subscribe_id, status).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_match = [weak_ptr_this](const legacy_hal::NanMatchInd& msg) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - NanMatchInd aidl_struct; - if (!aidl_struct_util::convertLegacyNanMatchIndToAidl(msg, &aidl_struct)) { - LOG(ERROR) << "Failed to convert nan capabilities response"; - return; - } - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventMatch(aidl_struct).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_match_expired = [weak_ptr_this]( - const legacy_hal::NanMatchExpiredInd& msg) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventMatchExpired(msg.publish_subscribe_id, msg.requestor_instance_id) - .isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_followup = [weak_ptr_this](const legacy_hal::NanFollowupInd& msg) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - NanFollowupReceivedInd aidl_struct; - if (!aidl_struct_util::convertLegacyNanFollowupIndToAidl(msg, &aidl_struct)) { - LOG(ERROR) << "Failed to convert nan capabilities response"; - return; - } - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventFollowupReceived(aidl_struct).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_transmit_follow_up = - [weak_ptr_this](const legacy_hal::NanTransmitFollowupInd& msg) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - NanStatus status; - aidl_struct_util::convertToNanStatus(msg.reason, msg.nan_reason, - sizeof(msg.nan_reason), &status); - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventTransmitFollowup(msg.id, status).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_data_path_request = - [weak_ptr_this](const legacy_hal::NanDataPathRequestInd& msg) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - NanDataPathRequestInd aidl_struct; - if (!aidl_struct_util::convertLegacyNanDataPathRequestIndToAidl(msg, - &aidl_struct)) { - LOG(ERROR) << "Failed to convert nan capabilities response"; - return; - } - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventDataPathRequest(aidl_struct).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_data_path_confirm = - [weak_ptr_this](const legacy_hal::NanDataPathConfirmInd& msg) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - NanDataPathConfirmInd aidl_struct; - if (!aidl_struct_util::convertLegacyNanDataPathConfirmIndToAidl(msg, - &aidl_struct)) { - LOG(ERROR) << "Failed to convert nan capabilities response"; - return; - } - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventDataPathConfirm(aidl_struct).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_data_path_end = - [weak_ptr_this](const legacy_hal::NanDataPathEndInd& msg) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - for (int i = 0; i < msg.num_ndp_instances; ++i) { - if (!callback->eventDataPathTerminated(msg.ndp_instance_id[i]).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - } - }; - - callback_handlers.on_event_beacon_sdf_payload = - [](const legacy_hal::NanBeaconSdfPayloadInd& /* msg */) { - LOG(ERROR) << "on_event_beacon_sdf_payload - should not be called"; - }; - - callback_handlers.on_event_range_request = [](const legacy_hal::NanRangeRequestInd& /* msg */) { - LOG(ERROR) << "on_event_range_request - should not be called"; - }; - - callback_handlers.on_event_range_report = [](const legacy_hal::NanRangeReportInd& /* msg */) { - LOG(ERROR) << "on_event_range_report - should not be called"; - }; - - callback_handlers.on_event_schedule_update = - [weak_ptr_this](const legacy_hal::NanDataPathScheduleUpdateInd& msg) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - NanDataPathScheduleUpdateInd aidl_struct; - if (!aidl_struct_util::convertLegacyNanDataPathScheduleUpdateIndToAidl( - msg, &aidl_struct)) { - LOG(ERROR) << "Failed to convert nan capabilities response"; - return; - } - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventDataPathScheduleUpdate(aidl_struct).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanRegisterCallbackHandlers(ifname_, callback_handlers); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - LOG(ERROR) << "Failed to register nan callbacks. Invalidating object"; - invalidate(); - } - - // Register for iface state toggle events. - iface_util::IfaceEventHandlers event_handlers = {}; - event_handlers.on_state_toggle_off_on = [weak_ptr_this](const std::string& /* iface_name */) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - // Tell framework that NAN has been disabled. - NanStatus status = {NanStatusCode::UNSUPPORTED_CONCURRENCY_NAN_DISABLED, ""}; - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventDisabled(status).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - iface_util_.lock()->registerIfaceEventHandlers(ifname_, event_handlers); -} - -void WifiNanIface::setWeakPtr(std::weak_ptr ptr) { - weak_ptr_this_ = ptr; -} - -void WifiNanIface::invalidate() { - if (!isValid()) { - return; - } - // send commands to HAL to actually disable and destroy interfaces - legacy_hal_.lock()->nanDisableRequest(ifname_, 0xFFFF); - legacy_hal_.lock()->nanDataInterfaceDelete(ifname_, 0xFFFE, "aware_data0"); - legacy_hal_.lock()->nanDataInterfaceDelete(ifname_, 0xFFFD, "aware_data1"); - iface_util_.lock()->unregisterIfaceEventHandlers(ifname_); - legacy_hal_.reset(); - event_cb_handler_.invalidate(); - is_valid_ = false; - if (is_dedicated_iface_) { - // If using a dedicated iface, set the iface down. - iface_util_.lock()->setUpState(ifname_, false); - } -} - -bool WifiNanIface::isValid() { - return is_valid_; -} - -std::string WifiNanIface::getName() { - return ifname_; -} - -std::set> WifiNanIface::getEventCallbacks() { - LOG(ERROR) << "Using original getEventCallbacks"; - return event_cb_handler_.getCallbacks(); -} - -ndk::ScopedAStatus WifiNanIface::getName(std::string* _aidl_return) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::getNameInternal, _aidl_return); -} - -ndk::ScopedAStatus WifiNanIface::registerEventCallback( - const std::shared_ptr& callback) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::registerEventCallbackInternal, callback); -} - -ndk::ScopedAStatus WifiNanIface::getCapabilitiesRequest(char16_t in_cmdId) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::getCapabilitiesRequestInternal, in_cmdId); -} - -ndk::ScopedAStatus WifiNanIface::enableRequest(char16_t in_cmdId, const NanEnableRequest& in_msg1, - const NanConfigRequestSupplemental& in_msg2) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::enableRequestInternal, in_cmdId, in_msg1, in_msg2); -} - -ndk::ScopedAStatus WifiNanIface::configRequest(char16_t in_cmdId, const NanConfigRequest& in_msg1, - const NanConfigRequestSupplemental& in_msg2) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::configRequestInternal, in_cmdId, in_msg1, in_msg2); -} - -ndk::ScopedAStatus WifiNanIface::disableRequest(char16_t in_cmdId) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::disableRequestInternal, in_cmdId); -} - -ndk::ScopedAStatus WifiNanIface::startPublishRequest(char16_t in_cmdId, - const NanPublishRequest& in_msg) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::startPublishRequestInternal, in_cmdId, in_msg); -} - -ndk::ScopedAStatus WifiNanIface::stopPublishRequest(char16_t in_cmdId, int8_t in_sessionId) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::stopPublishRequestInternal, in_cmdId, in_sessionId); -} - -ndk::ScopedAStatus WifiNanIface::startSubscribeRequest(char16_t in_cmdId, - const NanSubscribeRequest& in_msg) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::startSubscribeRequestInternal, in_cmdId, in_msg); -} - -ndk::ScopedAStatus WifiNanIface::stopSubscribeRequest(char16_t in_cmdId, int8_t in_sessionId) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::stopSubscribeRequestInternal, in_cmdId, in_sessionId); -} - -ndk::ScopedAStatus WifiNanIface::transmitFollowupRequest(char16_t in_cmdId, - const NanTransmitFollowupRequest& in_msg) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::transmitFollowupRequestInternal, in_cmdId, in_msg); -} - -ndk::ScopedAStatus WifiNanIface::createDataInterfaceRequest(char16_t in_cmdId, - const std::string& in_ifaceName) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::createDataInterfaceRequestInternal, in_cmdId, - in_ifaceName); -} - -ndk::ScopedAStatus WifiNanIface::deleteDataInterfaceRequest(char16_t in_cmdId, - const std::string& in_ifaceName) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::deleteDataInterfaceRequestInternal, in_cmdId, - in_ifaceName); -} - -ndk::ScopedAStatus WifiNanIface::initiateDataPathRequest(char16_t in_cmdId, - const NanInitiateDataPathRequest& in_msg) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::initiateDataPathRequestInternal, in_cmdId, in_msg); -} - -ndk::ScopedAStatus WifiNanIface::respondToDataPathIndicationRequest( - char16_t in_cmdId, const NanRespondToDataPathIndicationRequest& in_msg) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::respondToDataPathIndicationRequestInternal, in_cmdId, - in_msg); -} - -ndk::ScopedAStatus WifiNanIface::terminateDataPathRequest(char16_t in_cmdId, - int32_t in_ndpInstanceId) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::terminateDataPathRequestInternal, in_cmdId, - in_ndpInstanceId); -} - -std::pair WifiNanIface::getNameInternal() { - return {ifname_, ndk::ScopedAStatus::ok()}; -} - -ndk::ScopedAStatus WifiNanIface::registerEventCallbackInternal( - const std::shared_ptr& callback) { - if (!event_cb_handler_.addCallback(callback)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus WifiNanIface::getCapabilitiesRequestInternal(char16_t cmd_id) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->nanGetCapabilities(ifname_, cmd_id); - return createWifiStatusFromLegacyError(legacy_status); -} - -ndk::ScopedAStatus WifiNanIface::enableRequestInternal(char16_t cmd_id, - const NanEnableRequest& msg1, - const NanConfigRequestSupplemental& msg2) { - legacy_hal::NanEnableRequest legacy_msg; - if (!aidl_struct_util::convertAidlNanEnableRequestToLegacy(msg1, msg2, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanEnableRequest(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -ndk::ScopedAStatus WifiNanIface::configRequestInternal(char16_t cmd_id, - const NanConfigRequest& msg1, - const NanConfigRequestSupplemental& msg2) { - legacy_hal::NanConfigRequest legacy_msg; - if (!aidl_struct_util::convertAidlNanConfigRequestToLegacy(msg1, msg2, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanConfigRequest(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -ndk::ScopedAStatus WifiNanIface::disableRequestInternal(char16_t cmd_id) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->nanDisableRequest(ifname_, cmd_id); - return createWifiStatusFromLegacyError(legacy_status); -} - -ndk::ScopedAStatus WifiNanIface::startPublishRequestInternal(char16_t cmd_id, - const NanPublishRequest& msg) { - legacy_hal::NanPublishRequest legacy_msg; - if (!aidl_struct_util::convertAidlNanPublishRequestToLegacy(msg, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanPublishRequest(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -ndk::ScopedAStatus WifiNanIface::stopPublishRequestInternal(char16_t cmd_id, int8_t sessionId) { - legacy_hal::NanPublishCancelRequest legacy_msg; - legacy_msg.publish_id = sessionId; - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanPublishCancelRequest(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -ndk::ScopedAStatus WifiNanIface::startSubscribeRequestInternal(char16_t cmd_id, - const NanSubscribeRequest& msg) { - legacy_hal::NanSubscribeRequest legacy_msg; - if (!aidl_struct_util::convertAidlNanSubscribeRequestToLegacy(msg, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanSubscribeRequest(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -ndk::ScopedAStatus WifiNanIface::stopSubscribeRequestInternal(char16_t cmd_id, int8_t sessionId) { - legacy_hal::NanSubscribeCancelRequest legacy_msg; - legacy_msg.subscribe_id = sessionId; - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanSubscribeCancelRequest(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -ndk::ScopedAStatus WifiNanIface::transmitFollowupRequestInternal( - char16_t cmd_id, const NanTransmitFollowupRequest& msg) { - legacy_hal::NanTransmitFollowupRequest legacy_msg; - if (!aidl_struct_util::convertAidlNanTransmitFollowupRequestToLegacy(msg, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanTransmitFollowupRequest(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -ndk::ScopedAStatus WifiNanIface::createDataInterfaceRequestInternal(char16_t cmd_id, - const std::string& iface_name) { - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanDataInterfaceCreate(ifname_, cmd_id, iface_name); - return createWifiStatusFromLegacyError(legacy_status); -} -ndk::ScopedAStatus WifiNanIface::deleteDataInterfaceRequestInternal(char16_t cmd_id, - const std::string& iface_name) { - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanDataInterfaceDelete(ifname_, cmd_id, iface_name); - return createWifiStatusFromLegacyError(legacy_status); -} -ndk::ScopedAStatus WifiNanIface::initiateDataPathRequestInternal( - char16_t cmd_id, const NanInitiateDataPathRequest& msg) { - legacy_hal::NanDataPathInitiatorRequest legacy_msg; - if (!aidl_struct_util::convertAidlNanDataPathInitiatorRequestToLegacy(msg, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanDataRequestInitiator(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} -ndk::ScopedAStatus WifiNanIface::respondToDataPathIndicationRequestInternal( - char16_t cmd_id, const NanRespondToDataPathIndicationRequest& msg) { - legacy_hal::NanDataPathIndicationResponse legacy_msg; - if (!aidl_struct_util::convertAidlNanDataPathIndicationResponseToLegacy(msg, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanDataIndicationResponse(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} -ndk::ScopedAStatus WifiNanIface::terminateDataPathRequestInternal(char16_t cmd_id, - int32_t ndpInstanceId) { - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanDataEnd(ifname_, cmd_id, ndpInstanceId); - return createWifiStatusFromLegacyError(legacy_status); -} - -} // namespace wifi -} // namespace hardware -} // namespace android -} // namespace aidl diff --git a/wifi/aidl/default/wifi_nan_iface.h b/wifi/aidl/default/wifi_nan_iface.h deleted file mode 100644 index 101890594c..0000000000 --- a/wifi/aidl/default/wifi_nan_iface.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * 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. - */ - -#ifndef WIFI_NAN_IFACE_H_ -#define WIFI_NAN_IFACE_H_ - -#include -#include -#include - -#include "aidl_callback_util.h" -#include "wifi_iface_util.h" -#include "wifi_legacy_hal.h" - -namespace aidl { -namespace android { -namespace hardware { -namespace wifi { - -/** - * AIDL interface object used to control a NAN Iface instance. - */ -class WifiNanIface : public BnWifiNanIface { - public: - WifiNanIface(const std::string& ifname, bool is_dedicated_iface, - const std::weak_ptr legacy_hal, - const std::weak_ptr iface_util); - - // Factory method - use instead of default constructor. - static std::shared_ptr create( - const std::string& ifname, bool is_dedicated_iface, - const std::weak_ptr legacy_hal, - const std::weak_ptr iface_util); - - // Refer to |WifiChip::invalidate()|. - void invalidate(); - bool isValid(); - std::string getName(); - - // AIDL methods exposed. - ndk::ScopedAStatus getName(std::string* _aidl_return) override; - ndk::ScopedAStatus registerEventCallback( - const std::shared_ptr& in_callback) override; - ndk::ScopedAStatus getCapabilitiesRequest(char16_t in_cmdId) override; - ndk::ScopedAStatus enableRequest(char16_t in_cmdId, const NanEnableRequest& in_msg1, - const NanConfigRequestSupplemental& in_msg2) override; - ndk::ScopedAStatus configRequest(char16_t in_cmdId, const NanConfigRequest& in_msg1, - const NanConfigRequestSupplemental& in_msg2) override; - ndk::ScopedAStatus disableRequest(char16_t in_cmdId) override; - ndk::ScopedAStatus startPublishRequest(char16_t in_cmdId, - const NanPublishRequest& in_msg) override; - ndk::ScopedAStatus stopPublishRequest(char16_t in_cmdId, int8_t in_sessionId) override; - ndk::ScopedAStatus startSubscribeRequest(char16_t in_cmdId, - const NanSubscribeRequest& in_msg) override; - ndk::ScopedAStatus stopSubscribeRequest(char16_t in_cmdId, int8_t in_sessionId) override; - ndk::ScopedAStatus transmitFollowupRequest(char16_t in_cmdId, - const NanTransmitFollowupRequest& in_msg) override; - ndk::ScopedAStatus createDataInterfaceRequest(char16_t in_cmdId, - const std::string& in_ifaceName) override; - ndk::ScopedAStatus deleteDataInterfaceRequest(char16_t in_cmdId, - const std::string& in_ifaceName) override; - ndk::ScopedAStatus initiateDataPathRequest(char16_t in_cmdId, - const NanInitiateDataPathRequest& in_msg) override; - ndk::ScopedAStatus respondToDataPathIndicationRequest( - char16_t in_cmdId, const NanRespondToDataPathIndicationRequest& in_msg) override; - ndk::ScopedAStatus terminateDataPathRequest(char16_t in_cmdId, - int32_t in_ndpInstanceId) override; - - protected: - // Accessible to child class in the gTest suite. - void setWeakPtr(std::weak_ptr ptr); - void registerCallbackHandlers(); - - private: - // Corresponding worker functions for the AIDL methods. - std::pair getNameInternal(); - ndk::ScopedAStatus registerEventCallbackInternal( - const std::shared_ptr& callback); - ndk::ScopedAStatus getCapabilitiesRequestInternal(char16_t cmd_id); - ndk::ScopedAStatus enableRequestInternal(char16_t cmd_id, const NanEnableRequest& msg1, - const NanConfigRequestSupplemental& msg2); - ndk::ScopedAStatus configRequestInternal(char16_t cmd_id, const NanConfigRequest& msg1, - const NanConfigRequestSupplemental& msg2); - ndk::ScopedAStatus disableRequestInternal(char16_t cmd_id); - ndk::ScopedAStatus startPublishRequestInternal(char16_t cmd_id, const NanPublishRequest& msg); - ndk::ScopedAStatus stopPublishRequestInternal(char16_t cmd_id, int8_t sessionId); - ndk::ScopedAStatus startSubscribeRequestInternal(char16_t cmd_id, - const NanSubscribeRequest& msg); - ndk::ScopedAStatus stopSubscribeRequestInternal(char16_t cmd_id, int8_t sessionId); - ndk::ScopedAStatus transmitFollowupRequestInternal(char16_t cmd_id, - const NanTransmitFollowupRequest& msg); - ndk::ScopedAStatus createDataInterfaceRequestInternal(char16_t cmd_id, - const std::string& iface_name); - ndk::ScopedAStatus deleteDataInterfaceRequestInternal(char16_t cmd_id, - const std::string& iface_name); - ndk::ScopedAStatus initiateDataPathRequestInternal(char16_t cmd_id, - const NanInitiateDataPathRequest& msg); - ndk::ScopedAStatus respondToDataPathIndicationRequestInternal( - char16_t cmd_id, const NanRespondToDataPathIndicationRequest& msg); - ndk::ScopedAStatus terminateDataPathRequestInternal(char16_t cmd_id, int32_t ndpInstanceId); - - // Overridden in the gTest suite. - virtual std::set> getEventCallbacks(); - - std::string ifname_; - bool is_dedicated_iface_; - std::weak_ptr legacy_hal_; - std::weak_ptr iface_util_; - bool is_valid_; - std::weak_ptr weak_ptr_this_; - aidl_callback_util::AidlCallbackHandler event_cb_handler_; - - DISALLOW_COPY_AND_ASSIGN(WifiNanIface); -}; - -} // namespace wifi -} // namespace hardware -} // namespace android -} // namespace aidl - -#endif // WIFI_NAN_IFACE_H_ diff --git a/wifi/aidl/default/wifi_rtt_controller.cpp b/wifi/aidl/default/wifi_rtt_controller.cpp deleted file mode 100644 index 856c3cd054..0000000000 --- a/wifi/aidl/default/wifi_rtt_controller.cpp +++ /dev/null @@ -1,255 +0,0 @@ -/* - * 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. - */ - -#include "wifi_rtt_controller.h" - -#include - -#include "aidl_return_util.h" -#include "aidl_struct_util.h" -#include "wifi_status_util.h" - -namespace aidl { -namespace android { -namespace hardware { -namespace wifi { -using aidl_return_util::validateAndCall; - -WifiRttController::WifiRttController(const std::string& iface_name, - const std::shared_ptr& bound_iface, - const std::weak_ptr legacy_hal) - : ifname_(iface_name), bound_iface_(bound_iface), legacy_hal_(legacy_hal), is_valid_(true) {} - -std::shared_ptr WifiRttController::create( - const std::string& iface_name, const std::shared_ptr& bound_iface, - const std::weak_ptr legacy_hal) { - std::shared_ptr ptr = - ndk::SharedRefBase::make(iface_name, bound_iface, legacy_hal); - std::weak_ptr weak_ptr_this(ptr); - ptr->setWeakPtr(weak_ptr_this); - return ptr; -} - -void WifiRttController::invalidate() { - legacy_hal_.reset(); - event_callbacks_.clear(); - is_valid_ = false; -}; - -bool WifiRttController::isValid() { - return is_valid_; -} - -void WifiRttController::setWeakPtr(std::weak_ptr ptr) { - weak_ptr_this_ = ptr; -} - -std::vector> -WifiRttController::getEventCallbacks() { - return event_callbacks_; -} - -std::string WifiRttController::getIfaceName() { - return ifname_; -} - -ndk::ScopedAStatus WifiRttController::getBoundIface(std::shared_ptr* _aidl_return) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::getBoundIfaceInternal, _aidl_return); -} - -ndk::ScopedAStatus WifiRttController::registerEventCallback( - const std::shared_ptr& callback) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::registerEventCallbackInternal, callback); -} - -ndk::ScopedAStatus WifiRttController::rangeRequest(int32_t in_cmdId, - const std::vector& in_rttConfigs) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::rangeRequestInternal, in_cmdId, in_rttConfigs); -} - -ndk::ScopedAStatus WifiRttController::rangeCancel(int32_t in_cmdId, - const std::vector& in_addrs) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::rangeCancelInternal, in_cmdId, in_addrs); -} - -ndk::ScopedAStatus WifiRttController::getCapabilities(RttCapabilities* _aidl_return) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::getCapabilitiesInternal, _aidl_return); -} - -ndk::ScopedAStatus WifiRttController::setLci(int32_t in_cmdId, const RttLciInformation& in_lci) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::setLciInternal, in_cmdId, in_lci); -} - -ndk::ScopedAStatus WifiRttController::setLcr(int32_t in_cmdId, const RttLcrInformation& in_lcr) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::setLcrInternal, in_cmdId, in_lcr); -} - -ndk::ScopedAStatus WifiRttController::getResponderInfo(RttResponder* _aidl_return) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::getResponderInfoInternal, _aidl_return); -} - -ndk::ScopedAStatus WifiRttController::enableResponder(int32_t in_cmdId, - const WifiChannelInfo& in_channelHint, - int32_t in_maxDurationInSeconds, - const RttResponder& in_info) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::enableResponderInternal, in_cmdId, in_channelHint, - in_maxDurationInSeconds, in_info); -} - -ndk::ScopedAStatus WifiRttController::disableResponder(int32_t in_cmdId) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::disableResponderInternal, in_cmdId); -} - -std::pair, ndk::ScopedAStatus> -WifiRttController::getBoundIfaceInternal() { - return {bound_iface_, ndk::ScopedAStatus::ok()}; -} - -ndk::ScopedAStatus WifiRttController::registerEventCallbackInternal( - const std::shared_ptr& callback) { - event_callbacks_.emplace_back(callback); - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus WifiRttController::rangeRequestInternal( - int32_t cmd_id, const std::vector& rtt_configs) { - std::vector legacy_configs; - if (!aidl_struct_util::convertAidlVectorOfRttConfigToLegacy(rtt_configs, &legacy_configs)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - std::weak_ptr weak_ptr_this = weak_ptr_this_; - const auto& on_results_callback = - [weak_ptr_this](legacy_hal::wifi_request_id id, - const std::vector& results) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - std::vector aidl_results; - if (!aidl_struct_util::convertLegacyVectorOfRttResultToAidl(results, - &aidl_results)) { - LOG(ERROR) << "Failed to convert rtt results to AIDL structs"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onResults(id, aidl_results).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startRttRangeRequest( - ifname_, cmd_id, legacy_configs, on_results_callback); - return createWifiStatusFromLegacyError(legacy_status); -} - -ndk::ScopedAStatus WifiRttController::rangeCancelInternal(int32_t cmd_id, - const std::vector& addrs) { - std::vector> legacy_addrs; - for (const auto& addr : addrs) { - std::array addr_array; - std::copy_n(addr.data.begin(), ETH_ALEN, addr_array.begin()); - legacy_addrs.push_back(addr_array); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->cancelRttRangeRequest(ifname_, cmd_id, legacy_addrs); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair WifiRttController::getCapabilitiesInternal() { - legacy_hal::wifi_error legacy_status; - legacy_hal::wifi_rtt_capabilities legacy_caps; - std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getRttCapabilities(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {RttCapabilities{}, createWifiStatusFromLegacyError(legacy_status)}; - } - RttCapabilities aidl_caps; - if (!aidl_struct_util::convertLegacyRttCapabilitiesToAidl(legacy_caps, &aidl_caps)) { - return {RttCapabilities{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; - } - return {aidl_caps, ndk::ScopedAStatus::ok()}; -} - -ndk::ScopedAStatus WifiRttController::setLciInternal(int32_t cmd_id, const RttLciInformation& lci) { - legacy_hal::wifi_lci_information legacy_lci; - if (!aidl_struct_util::convertAidlRttLciInformationToLegacy(lci, &legacy_lci)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->setRttLci(ifname_, cmd_id, legacy_lci); - return createWifiStatusFromLegacyError(legacy_status); -} - -ndk::ScopedAStatus WifiRttController::setLcrInternal(int32_t cmd_id, const RttLcrInformation& lcr) { - legacy_hal::wifi_lcr_information legacy_lcr; - if (!aidl_struct_util::convertAidlRttLcrInformationToLegacy(lcr, &legacy_lcr)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->setRttLcr(ifname_, cmd_id, legacy_lcr); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair WifiRttController::getResponderInfoInternal() { - legacy_hal::wifi_error legacy_status; - legacy_hal::wifi_rtt_responder legacy_responder; - std::tie(legacy_status, legacy_responder) = legacy_hal_.lock()->getRttResponderInfo(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {RttResponder{}, createWifiStatusFromLegacyError(legacy_status)}; - } - RttResponder aidl_responder; - if (!aidl_struct_util::convertLegacyRttResponderToAidl(legacy_responder, &aidl_responder)) { - return {RttResponder{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; - } - return {aidl_responder, ndk::ScopedAStatus::ok()}; -} - -ndk::ScopedAStatus WifiRttController::enableResponderInternal(int32_t cmd_id, - const WifiChannelInfo& channel_hint, - int32_t max_duration_seconds, - const RttResponder& info) { - legacy_hal::wifi_channel_info legacy_channel_info; - if (!aidl_struct_util::convertAidlWifiChannelInfoToLegacy(channel_hint, &legacy_channel_info)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_rtt_responder legacy_responder; - if (!aidl_struct_util::convertAidlRttResponderToLegacy(info, &legacy_responder)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->enableRttResponder( - ifname_, cmd_id, legacy_channel_info, max_duration_seconds, legacy_responder); - return createWifiStatusFromLegacyError(legacy_status); -} - -ndk::ScopedAStatus WifiRttController::disableResponderInternal(int32_t cmd_id) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->disableRttResponder(ifname_, cmd_id); - return createWifiStatusFromLegacyError(legacy_status); -} - -} // namespace wifi -} // namespace hardware -} // namespace android -} // namespace aidl diff --git a/wifi/aidl/default/wifi_rtt_controller.h b/wifi/aidl/default/wifi_rtt_controller.h deleted file mode 100644 index db690c3ad3..0000000000 --- a/wifi/aidl/default/wifi_rtt_controller.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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. - */ - -#ifndef WIFI_RTT_CONTROLLER_H_ -#define WIFI_RTT_CONTROLLER_H_ - -#include -#include -#include -#include - -#include "wifi_legacy_hal.h" - -namespace aidl { -namespace android { -namespace hardware { -namespace wifi { - -/** - * AIDL interface object used to control all RTT operations. - */ -class WifiRttController : public BnWifiRttController { - public: - WifiRttController(const std::string& iface_name, - const std::shared_ptr& bound_iface, - const std::weak_ptr legacy_hal); - // Factory method - use instead of default constructor. - static std::shared_ptr create( - const std::string& iface_name, const std::shared_ptr& bound_iface, - const std::weak_ptr legacy_hal); - - // Refer to |WifiChip::invalidate()|. - void invalidate(); - bool isValid(); - std::vector> getEventCallbacks(); - std::string getIfaceName(); - - // AIDL methods exposed. - ndk::ScopedAStatus getBoundIface(std::shared_ptr* _aidl_return) override; - ndk::ScopedAStatus registerEventCallback( - const std::shared_ptr& callback) override; - ndk::ScopedAStatus rangeRequest(int32_t in_cmdId, - const std::vector& in_rttConfigs) override; - ndk::ScopedAStatus rangeCancel(int32_t in_cmdId, - const std::vector& in_addrs) override; - ndk::ScopedAStatus getCapabilities(RttCapabilities* _aidl_return) override; - ndk::ScopedAStatus setLci(int32_t in_cmdId, const RttLciInformation& in_lci) override; - ndk::ScopedAStatus setLcr(int32_t in_cmdId, const RttLcrInformation& in_lcr) override; - ndk::ScopedAStatus getResponderInfo(RttResponder* _aidl_return) override; - ndk::ScopedAStatus enableResponder(int32_t in_cmdId, const WifiChannelInfo& in_channelHint, - int32_t in_maxDurationInSeconds, - const RttResponder& in_info) override; - ndk::ScopedAStatus disableResponder(int32_t in_cmdId) override; - - private: - // Corresponding worker functions for the AIDL methods. - std::pair, ndk::ScopedAStatus> getBoundIfaceInternal(); - ndk::ScopedAStatus registerEventCallbackInternal( - const std::shared_ptr& callback); - ndk::ScopedAStatus rangeRequestInternal(int32_t cmd_id, - const std::vector& rtt_configs); - ndk::ScopedAStatus rangeCancelInternal(int32_t cmd_id, const std::vector& addrs); - std::pair getCapabilitiesInternal(); - ndk::ScopedAStatus setLciInternal(int32_t cmd_id, const RttLciInformation& lci); - ndk::ScopedAStatus setLcrInternal(int32_t cmd_id, const RttLcrInformation& lcr); - std::pair getResponderInfoInternal(); - ndk::ScopedAStatus enableResponderInternal(int32_t cmd_id, const WifiChannelInfo& channel_hint, - int32_t max_duration_seconds, - const RttResponder& info); - ndk::ScopedAStatus disableResponderInternal(int32_t cmd_id); - - void setWeakPtr(std::weak_ptr ptr); - - std::string ifname_; - std::shared_ptr bound_iface_; - std::weak_ptr legacy_hal_; - std::vector> event_callbacks_; - std::weak_ptr weak_ptr_this_; - bool is_valid_; - - DISALLOW_COPY_AND_ASSIGN(WifiRttController); -}; - -} // namespace wifi -} // namespace hardware -} // namespace android -} // namespace aidl - -#endif // WIFI_RTT_CONTROLLER_H_ diff --git a/wifi/aidl/default/wifi_sta_iface.cpp b/wifi/aidl/default/wifi_sta_iface.cpp deleted file mode 100644 index ce90349bc5..0000000000 --- a/wifi/aidl/default/wifi_sta_iface.cpp +++ /dev/null @@ -1,558 +0,0 @@ -/* - * 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. - */ - -#include "wifi_sta_iface.h" - -#include - -#include "aidl_return_util.h" -#include "aidl_struct_util.h" -#include "wifi_status_util.h" - -namespace aidl { -namespace android { -namespace hardware { -namespace wifi { -using aidl_return_util::validateAndCall; - -WifiStaIface::WifiStaIface(const std::string& ifname, - const std::weak_ptr legacy_hal, - const std::weak_ptr iface_util) - : ifname_(ifname), legacy_hal_(legacy_hal), iface_util_(iface_util), is_valid_(true) { - // Turn on DFS channel usage for STA iface. - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->setDfsFlag(ifname_, true); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - LOG(ERROR) << "Failed to set DFS flag; DFS channels may be unavailable."; - } -} - -std::shared_ptr WifiStaIface::create( - const std::string& ifname, const std::weak_ptr legacy_hal, - const std::weak_ptr iface_util) { - std::shared_ptr ptr = - ndk::SharedRefBase::make(ifname, legacy_hal, iface_util); - std::weak_ptr weak_ptr_this(ptr); - ptr->setWeakPtr(weak_ptr_this); - return ptr; -} - -void WifiStaIface::invalidate() { - legacy_hal_.reset(); - event_cb_handler_.invalidate(); - is_valid_ = false; -} - -void WifiStaIface::setWeakPtr(std::weak_ptr ptr) { - weak_ptr_this_ = ptr; -} - -bool WifiStaIface::isValid() { - return is_valid_; -} - -std::string WifiStaIface::getName() { - return ifname_; -} - -std::set> WifiStaIface::getEventCallbacks() { - return event_cb_handler_.getCallbacks(); -} - -ndk::ScopedAStatus WifiStaIface::getName(std::string* _aidl_return) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getNameInternal, _aidl_return); -} - -ndk::ScopedAStatus WifiStaIface::registerEventCallback( - const std::shared_ptr& in_callback) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::registerEventCallbackInternal, in_callback); -} - -ndk::ScopedAStatus WifiStaIface::getCapabilities( - IWifiStaIface::StaIfaceCapabilityMask* _aidl_return) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getCapabilitiesInternal, _aidl_return); -} - -ndk::ScopedAStatus WifiStaIface::getApfPacketFilterCapabilities( - StaApfPacketFilterCapabilities* _aidl_return) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getApfPacketFilterCapabilitiesInternal, _aidl_return); -} - -ndk::ScopedAStatus WifiStaIface::installApfPacketFilter(const std::vector& in_program) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::installApfPacketFilterInternal, in_program); -} - -ndk::ScopedAStatus WifiStaIface::readApfPacketFilterData(std::vector* _aidl_return) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::readApfPacketFilterDataInternal, _aidl_return); -} - -ndk::ScopedAStatus WifiStaIface::getBackgroundScanCapabilities( - StaBackgroundScanCapabilities* _aidl_return) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getBackgroundScanCapabilitiesInternal, _aidl_return); -} - -ndk::ScopedAStatus WifiStaIface::getValidFrequenciesForBand(WifiBand in_band, - std::vector* _aidl_return) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getValidFrequenciesForBandInternal, _aidl_return, - in_band); -} - -ndk::ScopedAStatus WifiStaIface::startBackgroundScan(int32_t in_cmdId, - const StaBackgroundScanParameters& in_params) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::startBackgroundScanInternal, in_cmdId, in_params); -} - -ndk::ScopedAStatus WifiStaIface::stopBackgroundScan(int32_t in_cmdId) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::stopBackgroundScanInternal, in_cmdId); -} - -ndk::ScopedAStatus WifiStaIface::enableLinkLayerStatsCollection(bool in_debug) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::enableLinkLayerStatsCollectionInternal, in_debug); -} - -ndk::ScopedAStatus WifiStaIface::disableLinkLayerStatsCollection() { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::disableLinkLayerStatsCollectionInternal); -} - -ndk::ScopedAStatus WifiStaIface::getLinkLayerStats(StaLinkLayerStats* _aidl_return) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getLinkLayerStatsInternal, _aidl_return); -} - -ndk::ScopedAStatus WifiStaIface::startRssiMonitoring(int32_t in_cmdId, int32_t in_maxRssi, - int32_t in_minRssi) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::startRssiMonitoringInternal, in_cmdId, in_maxRssi, - in_minRssi); -} - -ndk::ScopedAStatus WifiStaIface::stopRssiMonitoring(int32_t in_cmdId) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::stopRssiMonitoringInternal, in_cmdId); -} - -ndk::ScopedAStatus WifiStaIface::getRoamingCapabilities(StaRoamingCapabilities* _aidl_return) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getRoamingCapabilitiesInternal, _aidl_return); -} - -ndk::ScopedAStatus WifiStaIface::configureRoaming(const StaRoamingConfig& in_config) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::configureRoamingInternal, in_config); -} - -ndk::ScopedAStatus WifiStaIface::setRoamingState(StaRoamingState in_state) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::setRoamingStateInternal, in_state); -} - -ndk::ScopedAStatus WifiStaIface::enableNdOffload(bool in_enable) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::enableNdOffloadInternal, in_enable); -} - -ndk::ScopedAStatus WifiStaIface::startSendingKeepAlivePackets( - int32_t in_cmdId, const std::vector& in_ipPacketData, char16_t in_etherType, - const std::array& in_srcAddress, const std::array& in_dstAddress, - int32_t in_periodInMs) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::startSendingKeepAlivePacketsInternal, in_cmdId, - in_ipPacketData, in_etherType, in_srcAddress, in_dstAddress, - in_periodInMs); -} - -ndk::ScopedAStatus WifiStaIface::stopSendingKeepAlivePackets(int32_t in_cmdId) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::stopSendingKeepAlivePacketsInternal, in_cmdId); -} - -ndk::ScopedAStatus WifiStaIface::startDebugPacketFateMonitoring() { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::startDebugPacketFateMonitoringInternal); -} - -ndk::ScopedAStatus WifiStaIface::getDebugTxPacketFates( - std::vector* _aidl_return) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getDebugTxPacketFatesInternal, _aidl_return); -} - -ndk::ScopedAStatus WifiStaIface::getDebugRxPacketFates( - std::vector* _aidl_return) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getDebugRxPacketFatesInternal, _aidl_return); -} - -ndk::ScopedAStatus WifiStaIface::setMacAddress(const std::array& in_mac) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::setMacAddressInternal, in_mac); -} - -ndk::ScopedAStatus WifiStaIface::getFactoryMacAddress(std::array* _aidl_return) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getFactoryMacAddressInternal, _aidl_return); -} - -ndk::ScopedAStatus WifiStaIface::setScanMode(bool in_enable) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::setScanModeInternal, in_enable); -} - -std::pair WifiStaIface::getNameInternal() { - return {ifname_, ndk::ScopedAStatus::ok()}; -} - -ndk::ScopedAStatus WifiStaIface::registerEventCallbackInternal( - const std::shared_ptr& callback) { - if (!event_cb_handler_.addCallback(callback)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - return ndk::ScopedAStatus::ok(); -} - -std::pair -WifiStaIface::getCapabilitiesInternal() { - legacy_hal::wifi_error legacy_status; - uint64_t legacy_feature_set; - std::tie(legacy_status, legacy_feature_set) = - legacy_hal_.lock()->getSupportedFeatureSet(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {IWifiStaIface::StaIfaceCapabilityMask{}, - createWifiStatusFromLegacyError(legacy_status)}; - } - uint32_t legacy_logger_feature_set; - std::tie(legacy_status, legacy_logger_feature_set) = - legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - // some devices don't support querying logger feature set - legacy_logger_feature_set = 0; - } - uint32_t aidl_caps; - if (!aidl_struct_util::convertLegacyFeaturesToAidlStaCapabilities( - legacy_feature_set, legacy_logger_feature_set, &aidl_caps)) { - return {IWifiStaIface::StaIfaceCapabilityMask{}, - createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; - } - return {static_cast(aidl_caps), - ndk::ScopedAStatus::ok()}; -} - -std::pair -WifiStaIface::getApfPacketFilterCapabilitiesInternal() { - legacy_hal::wifi_error legacy_status; - legacy_hal::PacketFilterCapabilities legacy_caps; - std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getPacketFilterCapabilities(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {StaApfPacketFilterCapabilities{}, createWifiStatusFromLegacyError(legacy_status)}; - } - StaApfPacketFilterCapabilities aidl_caps; - if (!aidl_struct_util::convertLegacyApfCapabilitiesToAidl(legacy_caps, &aidl_caps)) { - return {StaApfPacketFilterCapabilities{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; - } - return {aidl_caps, ndk::ScopedAStatus::ok()}; -} - -ndk::ScopedAStatus WifiStaIface::installApfPacketFilterInternal( - const std::vector& program) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->setPacketFilter(ifname_, program); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair, ndk::ScopedAStatus> -WifiStaIface::readApfPacketFilterDataInternal() { - const std::pair> legacy_status_and_data = - legacy_hal_.lock()->readApfPacketFilterData(ifname_); - return {std::move(legacy_status_and_data.second), - createWifiStatusFromLegacyError(legacy_status_and_data.first)}; -} - -std::pair -WifiStaIface::getBackgroundScanCapabilitiesInternal() { - legacy_hal::wifi_error legacy_status; - legacy_hal::wifi_gscan_capabilities legacy_caps; - std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getGscanCapabilities(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {StaBackgroundScanCapabilities{}, createWifiStatusFromLegacyError(legacy_status)}; - } - StaBackgroundScanCapabilities aidl_caps; - if (!aidl_struct_util::convertLegacyGscanCapabilitiesToAidl(legacy_caps, &aidl_caps)) { - return {StaBackgroundScanCapabilities{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; - } - return {aidl_caps, ndk::ScopedAStatus::ok()}; -} - -std::pair, ndk::ScopedAStatus> -WifiStaIface::getValidFrequenciesForBandInternal(WifiBand band) { - static_assert(sizeof(WifiChannelWidthInMhz) == sizeof(int32_t), "Size mismatch"); - legacy_hal::wifi_error legacy_status; - std::vector valid_frequencies; - std::tie(legacy_status, valid_frequencies) = legacy_hal_.lock()->getValidFrequenciesForBand( - ifname_, aidl_struct_util::convertAidlWifiBandToLegacy(band)); - return {std::vector(valid_frequencies.begin(), valid_frequencies.end()), - createWifiStatusFromLegacyError(legacy_status)}; -} - -ndk::ScopedAStatus WifiStaIface::startBackgroundScanInternal( - int32_t cmd_id, const StaBackgroundScanParameters& params) { - legacy_hal::wifi_scan_cmd_params legacy_params; - if (!aidl_struct_util::convertAidlGscanParamsToLegacy(params, &legacy_params)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - std::weak_ptr weak_ptr_this = weak_ptr_this_; - const auto& on_failure_callback = [weak_ptr_this](legacy_hal::wifi_request_id id) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onBackgroundScanFailure(id).isOk()) { - LOG(ERROR) << "Failed to invoke onBackgroundScanFailure callback"; - } - } - }; - const auto& on_results_callback = - [weak_ptr_this](legacy_hal::wifi_request_id id, - const std::vector& results) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - std::vector aidl_scan_datas; - if (!aidl_struct_util::convertLegacyVectorOfCachedGscanResultsToAidl( - results, &aidl_scan_datas)) { - LOG(ERROR) << "Failed to convert scan results to AIDL structs"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onBackgroundScanResults(id, aidl_scan_datas).isOk()) { - LOG(ERROR) << "Failed to invoke onBackgroundScanResults callback"; - } - } - }; - const auto& on_full_result_callback = [weak_ptr_this]( - legacy_hal::wifi_request_id id, - const legacy_hal::wifi_scan_result* result, - uint32_t buckets_scanned) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - StaScanResult aidl_scan_result; - if (!aidl_struct_util::convertLegacyGscanResultToAidl(*result, true, &aidl_scan_result)) { - LOG(ERROR) << "Failed to convert full scan results to AIDL structs"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onBackgroundFullScanResult(id, buckets_scanned, aidl_scan_result) - .isOk()) { - LOG(ERROR) << "Failed to invoke onBackgroundFullScanResult callback"; - } - } - }; - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->startGscan(ifname_, cmd_id, legacy_params, on_failure_callback, - on_results_callback, on_full_result_callback); - return createWifiStatusFromLegacyError(legacy_status); -} - -ndk::ScopedAStatus WifiStaIface::stopBackgroundScanInternal(int32_t cmd_id) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->stopGscan(ifname_, cmd_id); - return createWifiStatusFromLegacyError(legacy_status); -} - -ndk::ScopedAStatus WifiStaIface::enableLinkLayerStatsCollectionInternal(bool debug) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->enableLinkLayerStats(ifname_, debug); - return createWifiStatusFromLegacyError(legacy_status); -} - -ndk::ScopedAStatus WifiStaIface::disableLinkLayerStatsCollectionInternal() { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->disableLinkLayerStats(ifname_); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair WifiStaIface::getLinkLayerStatsInternal() { - legacy_hal::wifi_error legacy_status; - legacy_hal::LinkLayerStats legacy_stats; - std::tie(legacy_status, legacy_stats) = legacy_hal_.lock()->getLinkLayerStats(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {StaLinkLayerStats{}, createWifiStatusFromLegacyError(legacy_status)}; - } - StaLinkLayerStats aidl_stats; - if (!aidl_struct_util::convertLegacyLinkLayerStatsToAidl(legacy_stats, &aidl_stats)) { - return {StaLinkLayerStats{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; - } - return {aidl_stats, ndk::ScopedAStatus::ok()}; -} - -ndk::ScopedAStatus WifiStaIface::startRssiMonitoringInternal(int32_t cmd_id, int32_t max_rssi, - int32_t min_rssi) { - std::weak_ptr weak_ptr_this = weak_ptr_this_; - const auto& on_threshold_breached_callback = - [weak_ptr_this](legacy_hal::wifi_request_id id, std::array bssid, - int8_t rssi) { - const auto shared_ptr_this = weak_ptr_this.lock(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onRssiThresholdBreached(id, bssid, rssi).isOk()) { - LOG(ERROR) << "Failed to invoke onRssiThresholdBreached callback"; - } - } - }; - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startRssiMonitoring( - ifname_, cmd_id, max_rssi, min_rssi, on_threshold_breached_callback); - return createWifiStatusFromLegacyError(legacy_status); -} - -ndk::ScopedAStatus WifiStaIface::stopRssiMonitoringInternal(int32_t cmd_id) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->stopRssiMonitoring(ifname_, cmd_id); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair -WifiStaIface::getRoamingCapabilitiesInternal() { - legacy_hal::wifi_error legacy_status; - legacy_hal::wifi_roaming_capabilities legacy_caps; - std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getRoamingCapabilities(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {StaRoamingCapabilities{}, createWifiStatusFromLegacyError(legacy_status)}; - } - StaRoamingCapabilities aidl_caps; - if (!aidl_struct_util::convertLegacyRoamingCapabilitiesToAidl(legacy_caps, &aidl_caps)) { - return {StaRoamingCapabilities{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; - } - return {aidl_caps, ndk::ScopedAStatus::ok()}; -} - -ndk::ScopedAStatus WifiStaIface::configureRoamingInternal(const StaRoamingConfig& config) { - legacy_hal::wifi_roaming_config legacy_config; - if (!aidl_struct_util::convertAidlRoamingConfigToLegacy(config, &legacy_config)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->configureRoaming(ifname_, legacy_config); - return createWifiStatusFromLegacyError(legacy_status); -} - -ndk::ScopedAStatus WifiStaIface::setRoamingStateInternal(StaRoamingState state) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->enableFirmwareRoaming( - ifname_, aidl_struct_util::convertAidlRoamingStateToLegacy(state)); - return createWifiStatusFromLegacyError(legacy_status); -} - -ndk::ScopedAStatus WifiStaIface::enableNdOffloadInternal(bool enable) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->configureNdOffload(ifname_, enable); - return createWifiStatusFromLegacyError(legacy_status); -} - -ndk::ScopedAStatus WifiStaIface::startSendingKeepAlivePacketsInternal( - int32_t cmd_id, const std::vector& ip_packet_data, char16_t ether_type, - const std::array& src_address, const std::array& dst_address, - int32_t period_in_ms) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startSendingOffloadedPacket( - ifname_, cmd_id, ether_type, ip_packet_data, src_address, dst_address, period_in_ms); - return createWifiStatusFromLegacyError(legacy_status); -} - -ndk::ScopedAStatus WifiStaIface::stopSendingKeepAlivePacketsInternal(int32_t cmd_id) { - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->stopSendingOffloadedPacket(ifname_, cmd_id); - return createWifiStatusFromLegacyError(legacy_status); -} - -ndk::ScopedAStatus WifiStaIface::startDebugPacketFateMonitoringInternal() { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startPktFateMonitoring(ifname_); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair, ndk::ScopedAStatus> -WifiStaIface::getDebugTxPacketFatesInternal() { - legacy_hal::wifi_error legacy_status; - std::vector legacy_fates; - std::tie(legacy_status, legacy_fates) = legacy_hal_.lock()->getTxPktFates(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {std::vector(), - createWifiStatusFromLegacyError(legacy_status)}; - } - std::vector aidl_fates; - if (!aidl_struct_util::convertLegacyVectorOfDebugTxPacketFateToAidl(legacy_fates, - &aidl_fates)) { - return {std::vector(), - createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; - } - return {aidl_fates, ndk::ScopedAStatus::ok()}; -} - -std::pair, ndk::ScopedAStatus> -WifiStaIface::getDebugRxPacketFatesInternal() { - legacy_hal::wifi_error legacy_status; - std::vector legacy_fates; - std::tie(legacy_status, legacy_fates) = legacy_hal_.lock()->getRxPktFates(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {std::vector(), - createWifiStatusFromLegacyError(legacy_status)}; - } - std::vector aidl_fates; - if (!aidl_struct_util::convertLegacyVectorOfDebugRxPacketFateToAidl(legacy_fates, - &aidl_fates)) { - return {std::vector(), - createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; - } - return {aidl_fates, ndk::ScopedAStatus::ok()}; -} - -ndk::ScopedAStatus WifiStaIface::setMacAddressInternal(const std::array& mac) { - bool status = iface_util_.lock()->setMacAddress(ifname_, mac); - if (!status) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - return ndk::ScopedAStatus::ok(); -} - -std::pair, ndk::ScopedAStatus> WifiStaIface::getFactoryMacAddressInternal() { - std::array mac = iface_util_.lock()->getFactoryMacAddress(ifname_); - if (mac[0] == 0 && mac[1] == 0 && mac[2] == 0 && mac[3] == 0 && mac[4] == 0 && mac[5] == 0) { - return {mac, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; - } - return {mac, ndk::ScopedAStatus::ok()}; -} - -ndk::ScopedAStatus WifiStaIface::setScanModeInternal(bool enable) { - // OEM's need to implement this on their devices if needed. - LOG(WARNING) << "setScanModeInternal(" << enable << ") not supported"; - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -} // namespace wifi -} // namespace hardware -} // namespace android -} // namespace aidl diff --git a/wifi/aidl/default/wifi_sta_iface.h b/wifi/aidl/default/wifi_sta_iface.h deleted file mode 100644 index 8ac3470edb..0000000000 --- a/wifi/aidl/default/wifi_sta_iface.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - * 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. - */ - -#ifndef WIFI_STA_IFACE_H_ -#define WIFI_STA_IFACE_H_ - -#include -#include -#include - -#include "aidl_callback_util.h" -#include "wifi_iface_util.h" -#include "wifi_legacy_hal.h" - -namespace aidl { -namespace android { -namespace hardware { -namespace wifi { - -/** - * AIDL interface object used to control a STA Iface instance. - */ -class WifiStaIface : public BnWifiStaIface { - public: - WifiStaIface(const std::string& ifname, - const std::weak_ptr legacy_hal, - const std::weak_ptr iface_util); - - // Factory method - use instead of default constructor. - static std::shared_ptr create( - const std::string& ifname, const std::weak_ptr legacy_hal, - const std::weak_ptr iface_util); - - // Refer to |WifiChip::invalidate()|. - void invalidate(); - bool isValid(); - std::set> getEventCallbacks(); - std::string getName(); - - // AIDL methods exposed. - ndk::ScopedAStatus getName(std::string* _aidl_return) override; - ndk::ScopedAStatus registerEventCallback( - const std::shared_ptr& in_callback) override; - ndk::ScopedAStatus getCapabilities( - IWifiStaIface::StaIfaceCapabilityMask* _aidl_return) override; - ndk::ScopedAStatus getApfPacketFilterCapabilities( - StaApfPacketFilterCapabilities* _aidl_return) override; - ndk::ScopedAStatus installApfPacketFilter(const std::vector& in_program) override; - ndk::ScopedAStatus readApfPacketFilterData(std::vector* _aidl_return) override; - ndk::ScopedAStatus getBackgroundScanCapabilities( - StaBackgroundScanCapabilities* _aidl_return) override; - ndk::ScopedAStatus getValidFrequenciesForBand(WifiBand in_band, - std::vector* _aidl_return) override; - ndk::ScopedAStatus startBackgroundScan(int32_t in_cmdId, - const StaBackgroundScanParameters& in_params) override; - ndk::ScopedAStatus stopBackgroundScan(int32_t in_cmdId) override; - ndk::ScopedAStatus enableLinkLayerStatsCollection(bool in_debug) override; - ndk::ScopedAStatus disableLinkLayerStatsCollection() override; - ndk::ScopedAStatus getLinkLayerStats(StaLinkLayerStats* _aidl_return) override; - ndk::ScopedAStatus startRssiMonitoring(int32_t in_cmdId, int32_t in_maxRssi, - int32_t in_minRssi) override; - ndk::ScopedAStatus stopRssiMonitoring(int32_t in_cmdId) override; - ndk::ScopedAStatus getRoamingCapabilities(StaRoamingCapabilities* _aidl_return) override; - ndk::ScopedAStatus configureRoaming(const StaRoamingConfig& in_config) override; - ndk::ScopedAStatus setRoamingState(StaRoamingState in_state) override; - ndk::ScopedAStatus enableNdOffload(bool in_enable) override; - ndk::ScopedAStatus startSendingKeepAlivePackets(int32_t in_cmdId, - const std::vector& in_ipPacketData, - char16_t in_etherType, - const std::array& in_srcAddress, - const std::array& in_dstAddress, - int32_t in_periodInMs) override; - ndk::ScopedAStatus stopSendingKeepAlivePackets(int32_t in_cmdId) override; - ndk::ScopedAStatus startDebugPacketFateMonitoring() override; - ndk::ScopedAStatus getDebugTxPacketFates( - std::vector* _aidl_return) override; - ndk::ScopedAStatus getDebugRxPacketFates( - std::vector* _aidl_return) override; - ndk::ScopedAStatus setMacAddress(const std::array& in_mac) override; - ndk::ScopedAStatus getFactoryMacAddress(std::array* _aidl_return) override; - ndk::ScopedAStatus setScanMode(bool in_enable) override; - - private: - // Corresponding worker functions for the AIDL methods. - std::pair getNameInternal(); - ndk::ScopedAStatus registerEventCallbackInternal( - const std::shared_ptr& callback); - std::pair getCapabilitiesInternal(); - std::pair - getApfPacketFilterCapabilitiesInternal(); - ndk::ScopedAStatus installApfPacketFilterInternal(const std::vector& program); - std::pair, ndk::ScopedAStatus> readApfPacketFilterDataInternal(); - std::pair - getBackgroundScanCapabilitiesInternal(); - std::pair, ndk::ScopedAStatus> getValidFrequenciesForBandInternal( - WifiBand band); - ndk::ScopedAStatus startBackgroundScanInternal(int32_t cmd_id, - const StaBackgroundScanParameters& params); - ndk::ScopedAStatus stopBackgroundScanInternal(int32_t cmd_id); - ndk::ScopedAStatus enableLinkLayerStatsCollectionInternal(bool debug); - ndk::ScopedAStatus disableLinkLayerStatsCollectionInternal(); - std::pair getLinkLayerStatsInternal(); - ndk::ScopedAStatus startRssiMonitoringInternal(int32_t cmd_id, int32_t max_rssi, - int32_t min_rssi); - ndk::ScopedAStatus stopRssiMonitoringInternal(int32_t cmd_id); - std::pair getRoamingCapabilitiesInternal(); - ndk::ScopedAStatus configureRoamingInternal(const StaRoamingConfig& config); - ndk::ScopedAStatus setRoamingStateInternal(StaRoamingState state); - ndk::ScopedAStatus enableNdOffloadInternal(bool enable); - ndk::ScopedAStatus startSendingKeepAlivePacketsInternal( - int32_t cmd_id, const std::vector& ip_packet_data, char16_t ether_type, - const std::array& src_address, const std::array& dst_address, - int32_t period_in_ms); - ndk::ScopedAStatus stopSendingKeepAlivePacketsInternal(int32_t cmd_id); - ndk::ScopedAStatus startDebugPacketFateMonitoringInternal(); - std::pair, ndk::ScopedAStatus> - getDebugTxPacketFatesInternal(); - std::pair, ndk::ScopedAStatus> - getDebugRxPacketFatesInternal(); - ndk::ScopedAStatus setMacAddressInternal(const std::array& mac); - std::pair, ndk::ScopedAStatus> getFactoryMacAddressInternal(); - ndk::ScopedAStatus setScanModeInternal(bool enable); - - void setWeakPtr(std::weak_ptr ptr); - - std::string ifname_; - std::weak_ptr legacy_hal_; - std::weak_ptr iface_util_; - std::weak_ptr weak_ptr_this_; - bool is_valid_; - aidl_callback_util::AidlCallbackHandler event_cb_handler_; - - DISALLOW_COPY_AND_ASSIGN(WifiStaIface); -}; - -} // namespace wifi -} // namespace hardware -} // namespace android -} // namespace aidl - -#endif // WIFI_STA_IFACE_H_ diff --git a/wifi/aidl/vts/functional/Android.bp b/wifi/aidl/vts/functional/Android.bp deleted file mode 100644 index 1277182493..0000000000 --- a/wifi/aidl/vts/functional/Android.bp +++ /dev/null @@ -1,169 +0,0 @@ -// -// 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. -// - -package { - // See: http://go/android-license-faq - // A large-scale-change added 'default_applicable_licenses' to import - // all of the 'license_kinds' from "hardware_interfaces_license" - // to get the below license kinds: - // SPDX-license-identifier-Apache-2.0 - default_applicable_licenses: ["hardware_interfaces_license"], -} - -cc_test { - name: "VtsHalWifiChipTargetTest", - defaults: [ - "VtsHalTargetTestDefaults", - "use_libaidlvintf_gtest_helper_static", - ], - srcs: [ - "wifi_chip_aidl_test.cpp", - ], - shared_libs: [ - "libbinder", - "libbinder_ndk", - "libvndksupport", - ], - static_libs: [ - "VtsHalWifiTargetTestUtil", - "android.hardware.wifi-V1-ndk", - "libwifi-system-iface", - ], - test_suites: [ - "general-tests", - "vts", - ], -} - -cc_test { - name: "VtsHalWifiStaIfaceTargetTest", - defaults: [ - "VtsHalTargetTestDefaults", - "use_libaidlvintf_gtest_helper_static", - ], - srcs: [ - "wifi_sta_iface_aidl_test.cpp", - ], - shared_libs: [ - "libbinder", - "libbinder_ndk", - "libvndksupport", - ], - static_libs: [ - "VtsHalWifiTargetTestUtil", - "android.hardware.wifi-V1-ndk", - "libwifi-system-iface", - ], - test_suites: [ - "general-tests", - "vts", - ], -} - -cc_test { - name: "VtsHalWifiApIfaceTargetTest", - defaults: [ - "VtsHalTargetTestDefaults", - "use_libaidlvintf_gtest_helper_static", - ], - srcs: [ - "wifi_ap_iface_aidl_test.cpp", - ], - shared_libs: [ - "libbinder", - "libbinder_ndk", - "libvndksupport", - ], - static_libs: [ - "VtsHalWifiTargetTestUtil", - "android.hardware.wifi-V1-ndk", - "libwifi-system-iface", - ], - test_suites: [ - "general-tests", - "vts", - ], -} - -cc_test { - name: "VtsHalWifiNanIfaceTargetTest", - defaults: [ - "VtsHalTargetTestDefaults", - "use_libaidlvintf_gtest_helper_static", - ], - srcs: [ - "wifi_nan_iface_aidl_test.cpp", - ], - shared_libs: [ - "libbinder", - "libbinder_ndk", - "libvndksupport", - ], - static_libs: [ - "VtsHalWifiTargetTestUtil", - "android.hardware.wifi-V1-ndk", - "libwifi-system-iface", - ], - test_suites: [ - "general-tests", - "vts", - ], -} - -cc_test { - name: "VtsHalWifiRttControllerTargetTest", - defaults: [ - "VtsHalTargetTestDefaults", - "use_libaidlvintf_gtest_helper_static", - ], - srcs: [ - "wifi_rtt_controller_aidl_test.cpp", - ], - shared_libs: [ - "libbinder", - "libbinder_ndk", - "libvndksupport", - ], - static_libs: [ - "VtsHalWifiTargetTestUtil", - "android.hardware.wifi-V1-ndk", - "libwifi-system-iface", - ], - test_suites: [ - "general-tests", - "vts", - ], -} - -cc_library_static { - name: "VtsHalWifiTargetTestUtil", - defaults: ["VtsHalTargetTestDefaults"], - srcs: [ - "wifi_aidl_test_utils.cpp", - ], - export_include_dirs: [ - ".", - ], - shared_libs: [ - "libbinder", - "libbinder_ndk", - "libnativehelper", - ], - static_libs: [ - "android.hardware.wifi-V1-ndk", - "libwifi-system-iface", - ], -} diff --git a/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp b/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp deleted file mode 100644 index 6722f36dc9..0000000000 --- a/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp +++ /dev/null @@ -1,216 +0,0 @@ -/* - * 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. - */ - -#include "wifi_aidl_test_utils.h" - -using ::android::wifi_system::InterfaceTool; - -namespace { -bool findAnyModeSupportingConcurrencyType(IfaceConcurrencyType desired_type, - const std::vector& modes, - int* mode_id) { - for (const auto& mode : modes) { - for (const auto& combination : mode.availableCombinations) { - for (const auto& iface_limit : combination.limits) { - const auto& iface_types = iface_limit.types; - if (std::find(iface_types.begin(), iface_types.end(), desired_type) != - iface_types.end()) { - *mode_id = mode.id; - return true; - } - } - } - } - return false; -} - -bool configureChipToSupportConcurrencyTypeInternal(const std::shared_ptr& wifi_chip, - IfaceConcurrencyType type, - int* configured_mode_id) { - if (!configured_mode_id) { - return false; - } - std::vector chip_modes; - auto status = wifi_chip->getAvailableModes(&chip_modes); - if (!status.isOk()) { - return false; - } - if (!findAnyModeSupportingConcurrencyType(type, chip_modes, configured_mode_id)) { - return false; - } - if (!wifi_chip->configureChip(*configured_mode_id).isOk()) { - return false; - } - return true; -} - -bool configureChipToSupportConcurrencyTypeInternal(const std::shared_ptr& wifi_chip, - IfaceConcurrencyType type) { - int mode_id; - return configureChipToSupportConcurrencyTypeInternal(wifi_chip, type, &mode_id); -} -} // namespace - -bool checkStatusCode(ndk::ScopedAStatus* status, WifiStatusCode expected_code) { - if (status == nullptr) { - return false; - } - return status->getServiceSpecificError() == static_cast(expected_code); -} - -std::shared_ptr getWifi(const char* instance_name) { - return IWifi::fromBinder(ndk::SpAIBinder(AServiceManager_waitForService(instance_name))); -} - -std::shared_ptr getWifiChip(const char* instance_name) { - std::shared_ptr wifi = getWifi(instance_name); - if (!wifi.get()) { - return nullptr; - } - - const int retry_interval_ms = 2; - const int max_retries = 5; - int retry_count = 0; - auto status = wifi->start(); - while (retry_count < max_retries && !status.isOk()) { - retry_count++; - usleep(retry_interval_ms * 1000); - status = wifi->start(); - } - if (!status.isOk()) { - return nullptr; - } - - std::vector chip_ids = {}; - status = wifi->getChipIds(&chip_ids); - if (!status.isOk() || chip_ids.size() == 0) { - return nullptr; - } - std::shared_ptr chip; - status = wifi->getChip(chip_ids[0], &chip); - if (!status.isOk()) { - return nullptr; - } - return chip; -} - -void setupStaIface(const std::shared_ptr& iface) { - std::string iface_name; - auto status = iface->getName(&iface_name); - if (status.isOk()) { - InterfaceTool iface_tool; - iface_tool.SetUpState(iface_name.c_str(), true); - } -} - -void setupNanIface(const std::shared_ptr& iface) { - std::string iface_name; - auto status = iface->getName(&iface_name); - if (status.isOk()) { - InterfaceTool iface_tool; - iface_tool.SetUpState(iface_name.c_str(), true); - } -} - -std::shared_ptr getWifiStaIface(const char* instance_name) { - std::shared_ptr wifi_chip = getWifiChip(instance_name); - if (!wifi_chip.get()) { - return nullptr; - } - if (!configureChipToSupportConcurrencyTypeInternal(wifi_chip, IfaceConcurrencyType::STA)) { - return nullptr; - } - std::shared_ptr iface; - auto status = wifi_chip->createStaIface(&iface); - if (!status.isOk()) { - return nullptr; - } - setupStaIface(iface); - return iface; -} - -std::shared_ptr getWifiNanIface(const char* instance_name) { - std::shared_ptr wifi_chip = getWifiChip(instance_name); - if (!wifi_chip.get()) { - return nullptr; - } - if (!configureChipToSupportConcurrencyTypeInternal(wifi_chip, - IfaceConcurrencyType::NAN_IFACE)) { - return nullptr; - } - std::shared_ptr iface; - auto status = wifi_chip->createNanIface(&iface); - if (!status.isOk()) { - return nullptr; - } - setupNanIface(iface); - return iface; -} - -std::shared_ptr getWifiApIface(const char* instance_name) { - std::shared_ptr wifi_chip = getWifiChip(instance_name); - if (!wifi_chip.get()) { - return nullptr; - } - if (!configureChipToSupportConcurrencyTypeInternal(wifi_chip, IfaceConcurrencyType::AP)) { - return nullptr; - } - std::shared_ptr iface; - auto status = wifi_chip->createApIface(&iface); - if (!status.isOk()) { - return nullptr; - } - return iface; -} - -std::shared_ptr getBridgedWifiApIface(std::shared_ptr wifi_chip) { - if (!wifi_chip.get()) { - return nullptr; - } - int mode_id; - std::shared_ptr iface; - configureChipToSupportConcurrencyTypeInternal(wifi_chip, IfaceConcurrencyType::AP, &mode_id); - auto status = wifi_chip->createBridgedApIface(&iface); - if (!status.isOk()) { - return nullptr; - } - return iface; -} - -std::shared_ptr getBridgedWifiApIface(const char* instance_name) { - std::shared_ptr wifi_chip = getWifiChip(instance_name); - return getBridgedWifiApIface(wifi_chip); -} - -bool configureChipToSupportConcurrencyType(const std::shared_ptr& wifi_chip, - IfaceConcurrencyType type, int* configured_mode_id) { - return configureChipToSupportConcurrencyTypeInternal(wifi_chip, type, configured_mode_id); -} - -void stopWifiService(const char* instance_name) { - std::shared_ptr wifi = getWifi(instance_name); - if (wifi != nullptr) { - wifi->stop(); - } -} - -int32_t getChipCapabilities(const std::shared_ptr& wifi_chip) { - IWifiChip::ChipCapabilityMask caps = {}; - if (wifi_chip->getCapabilities(&caps).isOk()) { - return static_cast(caps); - } - return 0; -} diff --git a/wifi/aidl/vts/functional/wifi_aidl_test_utils.h b/wifi/aidl/vts/functional/wifi_aidl_test_utils.h deleted file mode 100644 index ad16603dd3..0000000000 --- a/wifi/aidl/vts/functional/wifi_aidl_test_utils.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include - -#include -#include -#include -#include - -using aidl::android::hardware::wifi::IfaceConcurrencyType; -using aidl::android::hardware::wifi::IWifi; -using aidl::android::hardware::wifi::IWifiApIface; -using aidl::android::hardware::wifi::IWifiChip; -using aidl::android::hardware::wifi::IWifiNanIface; -using aidl::android::hardware::wifi::IWifiStaIface; -using aidl::android::hardware::wifi::WifiStatusCode; - -// Helper functions to obtain references to the various AIDL interface objects. -std::shared_ptr getWifi(const char* instance_name); -std::shared_ptr getWifiChip(const char* instance_name); -std::shared_ptr getWifiStaIface(const char* instance_name); -std::shared_ptr getWifiNanIface(const char* instance_name); -std::shared_ptr getWifiApIface(const char* instance_name); -std::shared_ptr getBridgedWifiApIface(const char* instance_name); -std::shared_ptr getBridgedWifiApIface(std::shared_ptr wifi_chip); -// Configure the chip in a mode to support the creation of the provided iface type. -bool configureChipToSupportConcurrencyType(const std::shared_ptr& wifi_chip, - IfaceConcurrencyType type, int* configured_mode_id); -// Used to trigger IWifi.stop() at the end of every test. -void stopWifiService(const char* instance_name); -int32_t getChipCapabilities(const std::shared_ptr& wifi_chip); -bool checkStatusCode(ndk::ScopedAStatus* status, WifiStatusCode expected_code); diff --git a/wifi/aidl/vts/functional/wifi_ap_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_ap_iface_aidl_test.cpp deleted file mode 100644 index 0eaf660d49..0000000000 --- a/wifi/aidl/vts/functional/wifi_ap_iface_aidl_test.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Staache 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. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "wifi_aidl_test_utils.h" - -using aidl::android::hardware::wifi::IWifiApIface; -using aidl::android::hardware::wifi::WifiBand; - -class WifiApIfaceAidlTest : public testing::TestWithParam { - public: - void SetUp() override { - isBridgedSupport_ = testing::checkSubstringInCommandOutput( - "/system/bin/cmd wifi get-softap-supported-features", - "wifi_softap_bridged_ap_supported"); - stopWifiService(getInstanceName()); - } - - void TearDown() override { stopWifiService(getInstanceName()); } - - protected: - bool isBridgedSupport_ = false; - const char* getInstanceName() { return GetParam().c_str(); } -}; - -/* - * SetMacAddress - */ -TEST_P(WifiApIfaceAidlTest, SetMacAddress) { - std::shared_ptr wifi_ap_iface = getWifiApIface(getInstanceName()); - ASSERT_NE(nullptr, wifi_ap_iface.get()); - std::array mac = {0x12, 0x22, 0x33, 0x52, 0x10, 0x44}; - EXPECT_TRUE(wifi_ap_iface->setMacAddress(mac).isOk()); -} - -/* - * SetCountryCode - */ -TEST_P(WifiApIfaceAidlTest, SetCountryCode) { - std::shared_ptr wifi_ap_iface = getWifiApIface(getInstanceName()); - ASSERT_NE(nullptr, wifi_ap_iface.get()); - - const std::array country_code = {0x55, 0x53}; - EXPECT_TRUE(wifi_ap_iface->setCountryCode(country_code).isOk()); -} - -/* - * GetValidFrequenciesForBand - * Ensures that we can retrieve valid frequencies for the 2.4 GHz band. - */ -TEST_P(WifiApIfaceAidlTest, GetValidFrequenciesForBand) { - std::shared_ptr wifi_ap_iface = getWifiApIface(getInstanceName()); - ASSERT_NE(nullptr, wifi_ap_iface.get()); - - std::vector freqs; - EXPECT_TRUE(wifi_ap_iface->getValidFrequenciesForBand(WifiBand::BAND_24GHZ, &freqs).isOk()); - EXPECT_NE(freqs.size(), 0); -} - -/* - * GetFactoryMacAddress - */ -TEST_P(WifiApIfaceAidlTest, GetFactoryMacAddress) { - std::shared_ptr wifi_ap_iface = getWifiApIface(getInstanceName()); - ASSERT_NE(nullptr, wifi_ap_iface.get()); - - std::array mac; - EXPECT_TRUE(wifi_ap_iface->getFactoryMacAddress(&mac).isOk()); - std::array all_zero_mac = {0, 0, 0, 0, 0, 0}; - EXPECT_NE(mac, all_zero_mac); -} - -/** - * GetBridgedInstances - non-bridged mode - */ -TEST_P(WifiApIfaceAidlTest, GetBridgedInstances) { - std::shared_ptr wifi_ap_iface = getWifiApIface(getInstanceName()); - ASSERT_NE(nullptr, wifi_ap_iface.get()); - - std::vector instances; - EXPECT_TRUE(wifi_ap_iface->getBridgedInstances(&instances).isOk()); - EXPECT_EQ(instances.size(), 0); -} - -/** - * GetBridgedInstances - bridged AP mode. - */ -TEST_P(WifiApIfaceAidlTest, GetBridgedInstances_Bridged) { - if (!isBridgedSupport_) { - GTEST_SKIP() << "Missing Bridged AP support"; - } - std::shared_ptr wifi_ap_iface = getBridgedWifiApIface(getInstanceName()); - ASSERT_NE(nullptr, wifi_ap_iface.get()); - - std::vector instances; - EXPECT_TRUE(wifi_ap_iface->getBridgedInstances(&instances).isOk()); - EXPECT_EQ(instances.size(), 2); -} - -/** - * ResetToFactoryMacAddress - non-bridged mode - */ -TEST_P(WifiApIfaceAidlTest, ResetToFactoryMacAddress) { - std::shared_ptr wifi_ap_iface = getWifiApIface(getInstanceName()); - ASSERT_NE(nullptr, wifi_ap_iface.get()); - EXPECT_TRUE(wifi_ap_iface->resetToFactoryMacAddress().isOk()); -} - -/** - * ResetToFactoryMacAddress - bridged AP mode - */ -TEST_P(WifiApIfaceAidlTest, ResetToFactoryMacAddress_Bridged) { - if (!isBridgedSupport_) { - GTEST_SKIP() << "Missing Bridged AP support"; - } - std::shared_ptr wifi_ap_iface = getBridgedWifiApIface(getInstanceName()); - ASSERT_NE(nullptr, wifi_ap_iface.get()); - EXPECT_TRUE(wifi_ap_iface->resetToFactoryMacAddress().isOk()); -} - -GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiApIfaceAidlTest); -INSTANTIATE_TEST_SUITE_P(WifiTest, WifiApIfaceAidlTest, - testing::ValuesIn(android::getAidlHalInstanceNames(IWifi::descriptor)), - android::PrintInstanceNameToString); - -int main(int argc, char** argv) { - ::testing::InitGoogleTest(&argc, argv); - android::ProcessState::self()->setThreadPoolMaxThreadCount(1); - android::ProcessState::self()->startThreadPool(); - return RUN_ALL_TESTS(); -} diff --git a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp deleted file mode 100644 index 0806ed289d..0000000000 --- a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp +++ /dev/null @@ -1,889 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Staache 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. - */ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "wifi_aidl_test_utils.h" - -using aidl::android::hardware::wifi::BnWifiChipEventCallback; -using aidl::android::hardware::wifi::IfaceType; -using aidl::android::hardware::wifi::IWifiApIface; -using aidl::android::hardware::wifi::IWifiChip; -using aidl::android::hardware::wifi::IWifiNanIface; -using aidl::android::hardware::wifi::IWifiP2pIface; -using aidl::android::hardware::wifi::IWifiRttController; -using aidl::android::hardware::wifi::WifiBand; -using aidl::android::hardware::wifi::WifiDebugHostWakeReasonStats; -using aidl::android::hardware::wifi::WifiDebugRingBufferStatus; -using aidl::android::hardware::wifi::WifiDebugRingBufferVerboseLevel; -using aidl::android::hardware::wifi::WifiIfaceMode; -using aidl::android::hardware::wifi::WifiRadioCombinationMatrix; -using aidl::android::hardware::wifi::WifiStatusCode; -using aidl::android::hardware::wifi::WifiUsableChannel; - -class WifiChipAidlTest : public testing::TestWithParam { - public: - void SetUp() override { - stopWifiService(getInstanceName()); - wifi_chip_ = getWifiChip(getInstanceName()); - ASSERT_NE(nullptr, wifi_chip_.get()); - } - - void TearDown() override { stopWifiService(getInstanceName()); } - - protected: - int configureChipForConcurrencyType(IfaceConcurrencyType type) { - int mode_id; - EXPECT_TRUE(configureChipToSupportConcurrencyType(wifi_chip_, type, &mode_id)); - return mode_id; - } - - std::shared_ptr configureChipForStaAndGetIface() { - std::shared_ptr iface; - configureChipForConcurrencyType(IfaceConcurrencyType::STA); - EXPECT_TRUE(wifi_chip_->createStaIface(&iface).isOk()); - EXPECT_NE(nullptr, iface.get()); - return iface; - } - - std::shared_ptr configureChipForP2pAndGetIface() { - std::shared_ptr iface; - configureChipForConcurrencyType(IfaceConcurrencyType::P2P); - EXPECT_TRUE(wifi_chip_->createP2pIface(&iface).isOk()); - EXPECT_NE(nullptr, iface.get()); - return iface; - } - - std::shared_ptr configureChipForApAndGetIface() { - std::shared_ptr iface; - configureChipForConcurrencyType(IfaceConcurrencyType::AP); - EXPECT_TRUE(wifi_chip_->createApIface(&iface).isOk()); - EXPECT_NE(nullptr, iface.get()); - return iface; - } - - std::shared_ptr configureChipForNanAndGetIface() { - std::shared_ptr iface; - configureChipForConcurrencyType(IfaceConcurrencyType::NAN_IFACE); - EXPECT_TRUE(wifi_chip_->createNanIface(&iface).isOk()); - EXPECT_NE(nullptr, iface.get()); - return iface; - } - - std::string getStaIfaceName(const std::shared_ptr& iface) { - std::string iface_name; - EXPECT_TRUE(iface->getName(&iface_name).isOk()); - return iface_name; - } - - std::string getP2pIfaceName(const std::shared_ptr& iface) { - std::string iface_name; - EXPECT_TRUE(iface->getName(&iface_name).isOk()); - return iface_name; - } - - std::string getApIfaceName(const std::shared_ptr& iface) { - std::string iface_name; - EXPECT_TRUE(iface->getName(&iface_name).isOk()); - return iface_name; - } - - std::string getNanIfaceName(const std::shared_ptr& iface) { - std::string iface_name; - EXPECT_TRUE(iface->getName(&iface_name).isOk()); - return iface_name; - } - - std::vector> create2StaIfacesIfPossible() { - std::shared_ptr iface1 = configureChipForStaAndGetIface(); - - // Try create a create second iface. - std::shared_ptr iface2; - bool add_second_success = wifi_chip_->createStaIface(&iface2).isOk(); - if (!add_second_success) { - return {iface1}; - } - EXPECT_NE(nullptr, iface2.get()); - return {iface1, iface2}; - } - - bool hasAnyRingBufferCapabilities(int32_t caps) { - return caps & - (static_cast( - IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_CONNECT_EVENT) | - static_cast(IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_POWER_EVENT) | - static_cast( - IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_WAKELOCK_EVENT) | - static_cast(IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_VENDOR_DATA)); - } - - const char* getInstanceName() { return GetParam().c_str(); } - - std::shared_ptr wifi_chip_; -}; - -class WifiChipEventCallback : public BnWifiChipEventCallback { - public: - WifiChipEventCallback() = default; - - ::ndk::ScopedAStatus onChipReconfigureFailure(WifiStatusCode /* status */) override { - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus onChipReconfigured(int /* modeId */) override { - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus onDebugErrorAlert(int /* errorCode */, - const std::vector& /* debugData */) override { - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus onDebugRingBufferDataAvailable( - const WifiDebugRingBufferStatus& /* status */, - const std::vector& /* data */) override { - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus onIfaceAdded(IfaceType /* type */, - const std::string& /* name */) override { - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus onIfaceRemoved(IfaceType /* type */, - const std::string& /* name */) override { - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus onRadioModeChange( - const std::vector& /* radioModeInfos */) override { - return ndk::ScopedAStatus::ok(); - } -}; - -/* - * RegisterEventCallback - * - * Note: it is not feasible to test the invocation of the callback function, - * since events are triggered internally in the HAL implementation and cannot be - * triggered from the test case. - */ -TEST_P(WifiChipAidlTest, RegisterEventCallback) { - std::shared_ptr callback = - ndk::SharedRefBase::make(); - ASSERT_NE(nullptr, callback.get()); - EXPECT_TRUE(wifi_chip_->registerEventCallback(callback).isOk()); -} - -/* - * GetCapabilities - */ -TEST_P(WifiChipAidlTest, GetCapabilities) { - configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); - EXPECT_NE(static_cast(caps), 0); -} - -/* - * GetId - */ -TEST_P(WifiChipAidlTest, GetId) { - int id; - EXPECT_TRUE(wifi_chip_->getId(&id).isOk()); -} - -/* - * GetAvailableModes - */ -TEST_P(WifiChipAidlTest, GetAvailableModes) { - std::vector modes; - EXPECT_TRUE(wifi_chip_->getAvailableModes(&modes).isOk()); - EXPECT_NE(modes.size(), 0); -} - -/* - * GetMode - */ -TEST_P(WifiChipAidlTest, GetMode) { - int expected_mode = configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int retrieved_mode; - EXPECT_TRUE(wifi_chip_->getMode(&retrieved_mode).isOk()); - EXPECT_EQ(retrieved_mode, expected_mode); -} - -/* - * GetUsableChannels - */ -TEST_P(WifiChipAidlTest, GetUsableChannels) { - WifiBand band = WifiBand::BAND_24GHZ_5GHZ_6GHZ; - uint32_t ifaceModeMask = static_cast(WifiIfaceMode::IFACE_MODE_P2P_CLIENT) | - static_cast(WifiIfaceMode::IFACE_MODE_P2P_GO); - uint32_t filterMask = - static_cast(IWifiChip::UsableChannelFilter::CELLULAR_COEXISTENCE) | - static_cast(IWifiChip::UsableChannelFilter::CONCURRENCY); - - std::vector channels; - configureChipForConcurrencyType(IfaceConcurrencyType::STA); - auto status = wifi_chip_->getUsableChannels( - band, static_cast(ifaceModeMask), - static_cast(filterMask), &channels); - if (checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { - GTEST_SKIP() << "getUsableChannels() is not supported by vendor."; - } - EXPECT_TRUE(status.isOk()); -} - -/* - * GetSupportedRadioCombinationsMatrix - */ -TEST_P(WifiChipAidlTest, GetSupportedRadioCombinationsMatrix) { - WifiRadioCombinationMatrix combination_matrix = {}; - configureChipForConcurrencyType(IfaceConcurrencyType::STA); - auto status = wifi_chip_->getSupportedRadioCombinationsMatrix(&combination_matrix); - if (checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { - GTEST_SKIP() << "Skipping this test since getSupportedRadioCombinationsMatrix() " - "is not supported by vendor."; - } - EXPECT_TRUE(status.isOk()); -} - -/* - * SetCountryCode - */ -TEST_P(WifiChipAidlTest, SetCountryCode) { - configureChipForConcurrencyType(IfaceConcurrencyType::STA); - std::array country_code = {0x55, 0x53}; - EXPECT_TRUE(wifi_chip_->setCountryCode(country_code).isOk()); -} - -/* - * SetLatencyMode_normal - * Tests the setLatencyMode() API with Latency mode NORMAL. - */ -TEST_P(WifiChipAidlTest, SetLatencyMode_normal) { - configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); - auto status = wifi_chip_->setLatencyMode(IWifiChip::LatencyMode::NORMAL); - if (caps & static_cast(IWifiChip::ChipCapabilityMask::SET_LATENCY_MODE)) { - EXPECT_TRUE(status.isOk()); - } else { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - } -} - -/* - * SetLatencyMode_low - * Tests the setLatencyMode() API with Latency mode LOW. - */ -TEST_P(WifiChipAidlTest, SetLatencyMode_low) { - configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); - auto status = wifi_chip_->setLatencyMode(IWifiChip::LatencyMode::LOW); - if (caps & static_cast(IWifiChip::ChipCapabilityMask::SET_LATENCY_MODE)) { - EXPECT_TRUE(status.isOk()); - } else { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - } -} - -/* - * SetMultiStaPrimaryConnection - * - * Only runs if the device supports 2 STA ifaces. - */ -TEST_P(WifiChipAidlTest, SetMultiStaPrimaryConnection) { - auto ifaces = create2StaIfacesIfPossible(); - if (ifaces.size() < 2) { - GTEST_SKIP() << "Device does not support more than 1 STA concurrently"; - } - - auto status = wifi_chip_->setMultiStaPrimaryConnection(getStaIfaceName(ifaces[0])); - if (!status.isOk()) { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - } -} - -/* - * SetMultiStaUseCase - * - * Only runs if the device supports 2 STA ifaces. - */ -TEST_P(WifiChipAidlTest, setMultiStaUseCase) { - auto ifaces = create2StaIfacesIfPossible(); - if (ifaces.size() < 2) { - GTEST_SKIP() << "Device does not support more than 1 STA concurrently"; - } - - auto status = wifi_chip_->setMultiStaUseCase( - IWifiChip::MultiStaUseCase::DUAL_STA_TRANSIENT_PREFER_PRIMARY); - if (!status.isOk()) { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - } -} - -/* - * SetCoexUnsafeChannels - */ -TEST_P(WifiChipAidlTest, SetCoexUnsafeChannels) { - configureChipForConcurrencyType(IfaceConcurrencyType::STA); - - // Test with an empty vector of CoexUnsafeChannels. - std::vector vec; - IWifiChip::CoexRestriction restrictions = static_cast(0); - auto status = wifi_chip_->setCoexUnsafeChannels(vec, restrictions); - if (!status.isOk()) { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - } - - // Test with a non-empty vector of CoexUnsafeChannels. - IWifiChip::CoexUnsafeChannel unsafeChannel24Ghz; - unsafeChannel24Ghz.band = WifiBand::BAND_24GHZ; - unsafeChannel24Ghz.channel = 6; - vec.push_back(unsafeChannel24Ghz); - IWifiChip::CoexUnsafeChannel unsafeChannel5Ghz; - unsafeChannel5Ghz.band = WifiBand::BAND_5GHZ; - unsafeChannel5Ghz.channel = 36; - vec.push_back(unsafeChannel5Ghz); - restrictions = static_cast( - static_cast(IWifiChip::CoexRestriction::WIFI_AWARE) | - static_cast(IWifiChip::CoexRestriction::SOFTAP) | - static_cast(IWifiChip::CoexRestriction::WIFI_DIRECT)); - - status = wifi_chip_->setCoexUnsafeChannels(vec, restrictions); - if (!status.isOk()) { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - } -} - -/* - * SelectTxPowerScenario - Body - */ -TEST_P(WifiChipAidlTest, SelectTxPowerScenario_body) { - configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); - int32_t expected_caps = - static_cast(IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT) | - static_cast(IWifiChip::ChipCapabilityMask::USE_BODY_HEAD_SAR); - auto status = wifi_chip_->selectTxPowerScenario(IWifiChip::TxPowerScenario::ON_BODY_CELL_OFF); - if (caps & expected_caps) { - EXPECT_TRUE(status.isOk()); - } else { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - } -} - -/* - * SelectTxPowerScenario - Voice Call - */ -TEST_P(WifiChipAidlTest, SelectTxPowerScenario_voiceCall) { - configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); - auto status = wifi_chip_->selectTxPowerScenario(IWifiChip::TxPowerScenario::VOICE_CALL); - if (caps & static_cast(IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT)) { - EXPECT_TRUE(status.isOk()); - } else { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - } -} - -/* - * ResetTxPowerScenario - */ -TEST_P(WifiChipAidlTest, ResetTxPowerScenario) { - configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); - auto status = wifi_chip_->resetTxPowerScenario(); - if (caps & static_cast(IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT)) { - EXPECT_TRUE(status.isOk()); - } else { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - } -} - -/* - * ConfigureChip - */ -TEST_P(WifiChipAidlTest, ConfigureChip) { - std::vector modes; - EXPECT_TRUE(wifi_chip_->getAvailableModes(&modes).isOk()); - EXPECT_NE(modes.size(), 0); - for (const auto& mode : modes) { - // configureChip() requires a fresh IWifiChip object. - wifi_chip_ = getWifiChip(getInstanceName()); - ASSERT_NE(nullptr, wifi_chip_.get()); - EXPECT_TRUE(wifi_chip_->configureChip(mode.id).isOk()); - stopWifiService(getInstanceName()); - // Sleep for 5 milliseconds between each wifi state toggle. - usleep(5000); - } -} - -/* - * RequestChipDebugInfo - */ -TEST_P(WifiChipAidlTest, RequestChipDebugInfo) { - configureChipForConcurrencyType(IfaceConcurrencyType::STA); - IWifiChip::ChipDebugInfo debug_info = {}; - EXPECT_TRUE(wifi_chip_->requestChipDebugInfo(&debug_info).isOk()); - EXPECT_NE(debug_info.driverDescription.size(), 0); - EXPECT_NE(debug_info.firmwareDescription.size(), 0); -} - -/* - * RequestFirmwareDebugDump - */ -TEST_P(WifiChipAidlTest, RequestFirmwareDebugDump) { - configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); - std::vector debug_dump; - auto status = wifi_chip_->requestFirmwareDebugDump(&debug_dump); - if (caps & static_cast(IWifiChip::ChipCapabilityMask::DEBUG_MEMORY_FIRMWARE_DUMP)) { - EXPECT_TRUE(status.isOk()); - } else { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - } -} - -/* - * RequestDriverDebugDump - */ -TEST_P(WifiChipAidlTest, RequestDriverDebugDump) { - configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); - std::vector debug_dump; - auto status = wifi_chip_->requestDriverDebugDump(&debug_dump); - if (caps & static_cast(IWifiChip::ChipCapabilityMask::DEBUG_MEMORY_DRIVER_DUMP)) { - EXPECT_TRUE(status.isOk()); - } else { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - } -} - -/* - * GetDebugRingBuffersStatus - */ -TEST_P(WifiChipAidlTest, GetDebugRingBuffersStatus) { - configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); - std::vector ring_buffer_status; - auto status = wifi_chip_->getDebugRingBuffersStatus(&ring_buffer_status); - if (hasAnyRingBufferCapabilities(caps)) { - EXPECT_TRUE(status.isOk()); - ASSERT_NE(ring_buffer_status.size(), 0); - for (const auto& ring_buffer : ring_buffer_status) { - EXPECT_NE(ring_buffer.ringName.size(), 0); - } - } else { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - } -} - -/* - * GetDebugHostWakeReasonStats - */ -TEST_P(WifiChipAidlTest, GetDebugHostWakeReasonStats) { - configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); - WifiDebugHostWakeReasonStats wake_reason_stats = {}; - auto status = wifi_chip_->getDebugHostWakeReasonStats(&wake_reason_stats); - if (caps & static_cast(IWifiChip::ChipCapabilityMask::DEBUG_HOST_WAKE_REASON_STATS)) { - EXPECT_TRUE(status.isOk()); - } else { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - } -} - -/* - * StartLoggingToDebugRingBuffer - */ -TEST_P(WifiChipAidlTest, StartLoggingToDebugRingBuffer) { - configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); - std::string ring_name; - std::vector ring_buffer_status; - auto status = wifi_chip_->getDebugRingBuffersStatus(&ring_buffer_status); - - if (hasAnyRingBufferCapabilities(caps)) { - EXPECT_TRUE(status.isOk()); - ASSERT_NE(ring_buffer_status.size(), 0); - ring_name = ring_buffer_status[0].ringName; - } else { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - } - - status = wifi_chip_->startLoggingToDebugRingBuffer( - ring_name, WifiDebugRingBufferVerboseLevel::VERBOSE, 5, 1024); - if (hasAnyRingBufferCapabilities(caps)) { - EXPECT_TRUE(status.isOk()); - } else { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - } -} - -/* - * ForceDumpToDebugRingBuffer - */ -TEST_P(WifiChipAidlTest, ForceDumpToDebugRingBuffer) { - configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); - std::string ring_name; - std::vector ring_buffer_status; - auto status = wifi_chip_->getDebugRingBuffersStatus(&ring_buffer_status); - - if (hasAnyRingBufferCapabilities(caps)) { - EXPECT_TRUE(status.isOk()); - ASSERT_NE(ring_buffer_status.size(), 0); - ring_name = ring_buffer_status[0].ringName; - } else { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - } - - status = wifi_chip_->forceDumpToDebugRingBuffer(ring_name); - if (hasAnyRingBufferCapabilities(caps)) { - EXPECT_TRUE(status.isOk()); - } else { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - } -} - -/* - * CreateStaIface - * Configures the chip in STA mode and creates an iface. - */ -TEST_P(WifiChipAidlTest, CreateStaIface) { - configureChipForStaAndGetIface(); -} - -/* - * CreateApIface - */ -TEST_P(WifiChipAidlTest, CreateApIface) { - configureChipForApAndGetIface(); -} - -/* - * CreateNanIface - */ -TEST_P(WifiChipAidlTest, CreateNanIface) { - configureChipForNanAndGetIface(); -} - -/* - * CreateP2pIface - */ -TEST_P(WifiChipAidlTest, CreateP2pIface) { - configureChipForNanAndGetIface(); -} - -/* - * GetStaIfaceNames - * Configures the chip in STA mode and ensures that the iface name list is - * empty before creating the iface. Then create the iface and ensure that - * iface name is returned in the iface name list. - */ -TEST_P(WifiChipAidlTest, GetStaIfaceNames) { - configureChipForConcurrencyType(IfaceConcurrencyType::STA); - - std::vector iface_names; - EXPECT_TRUE(wifi_chip_->getP2pIfaceNames(&iface_names).isOk()); - EXPECT_EQ(iface_names.size(), 0); - - std::shared_ptr iface; - EXPECT_TRUE(wifi_chip_->createStaIface(&iface).isOk()); - ASSERT_NE(nullptr, iface.get()); - - std::string iface_name = getStaIfaceName(iface); - EXPECT_TRUE(wifi_chip_->getStaIfaceNames(&iface_names).isOk()); - EXPECT_EQ(iface_names.size(), 1); - EXPECT_EQ(iface_name, iface_names[0]); - - EXPECT_TRUE(wifi_chip_->removeStaIface(iface_name).isOk()); - EXPECT_TRUE(wifi_chip_->getStaIfaceNames(&iface_names).isOk()); - EXPECT_EQ(iface_names.size(), 0); -} - -/* - * GetP2pIfaceNames - */ -TEST_P(WifiChipAidlTest, GetP2pIfaceNames) { - configureChipForConcurrencyType(IfaceConcurrencyType::P2P); - - std::vector iface_names; - EXPECT_TRUE(wifi_chip_->getP2pIfaceNames(&iface_names).isOk()); - EXPECT_EQ(iface_names.size(), 0); - - std::shared_ptr iface; - EXPECT_TRUE(wifi_chip_->createP2pIface(&iface).isOk()); - ASSERT_NE(nullptr, iface.get()); - - std::string iface_name = getP2pIfaceName(iface); - EXPECT_TRUE(wifi_chip_->getP2pIfaceNames(&iface_names).isOk()); - EXPECT_EQ(iface_names.size(), 1); - EXPECT_EQ(iface_name, iface_names[0]); - - EXPECT_TRUE(wifi_chip_->removeP2pIface(iface_name).isOk()); - EXPECT_TRUE(wifi_chip_->getP2pIfaceNames(&iface_names).isOk()); - EXPECT_EQ(iface_names.size(), 0); -} - -/* - * GetApIfaceNames - */ -TEST_P(WifiChipAidlTest, GetApIfaceNames) { - configureChipForConcurrencyType(IfaceConcurrencyType::AP); - - std::vector iface_names; - EXPECT_TRUE(wifi_chip_->getApIfaceNames(&iface_names).isOk()); - EXPECT_EQ(iface_names.size(), 0); - - std::shared_ptr iface; - EXPECT_TRUE(wifi_chip_->createApIface(&iface).isOk()); - ASSERT_NE(nullptr, iface.get()); - - std::string iface_name = getApIfaceName(iface); - EXPECT_TRUE(wifi_chip_->getApIfaceNames(&iface_names).isOk()); - EXPECT_EQ(iface_names.size(), 1); - EXPECT_EQ(iface_name, iface_names[0]); - - EXPECT_TRUE(wifi_chip_->removeApIface(iface_name).isOk()); - EXPECT_TRUE(wifi_chip_->getApIfaceNames(&iface_names).isOk()); - EXPECT_EQ(iface_names.size(), 0); -} - -/* - * GetNanIfaceNames - */ -TEST_P(WifiChipAidlTest, GetNanIfaceNames) { - configureChipForConcurrencyType(IfaceConcurrencyType::NAN_IFACE); - - std::vector iface_names; - EXPECT_TRUE(wifi_chip_->getNanIfaceNames(&iface_names).isOk()); - EXPECT_EQ(iface_names.size(), 0); - - std::shared_ptr iface; - EXPECT_TRUE(wifi_chip_->createNanIface(&iface).isOk()); - ASSERT_NE(nullptr, iface.get()); - - std::string iface_name = getNanIfaceName(iface); - EXPECT_TRUE(wifi_chip_->getNanIfaceNames(&iface_names).isOk()); - EXPECT_EQ(iface_names.size(), 1); - EXPECT_EQ(iface_name, iface_names[0]); - - EXPECT_TRUE(wifi_chip_->removeNanIface(iface_name).isOk()); - EXPECT_TRUE(wifi_chip_->getNanIfaceNames(&iface_names).isOk()); - EXPECT_EQ(iface_names.size(), 0); -} - -/* - * GetStaIface - * Configures the chip in STA mode and creates an iface. Then retrieves - * the iface object using its name and ensures that any other name - * doesn't retrieve a valid iface object. - */ -TEST_P(WifiChipAidlTest, GetStaIface) { - std::shared_ptr iface = configureChipForStaAndGetIface(); - std::string iface_name = getStaIfaceName(iface); - - std::shared_ptr retrieved_iface; - EXPECT_TRUE(wifi_chip_->getStaIface(iface_name, &retrieved_iface).isOk()); - EXPECT_NE(nullptr, retrieved_iface.get()); - - std::string invalid_name = iface_name + "0"; - std::shared_ptr invalid_iface; - auto status = wifi_chip_->getStaIface(invalid_name, &invalid_iface); - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); - EXPECT_EQ(nullptr, invalid_iface.get()); -} - -/* - * GetP2pIface - */ -TEST_P(WifiChipAidlTest, GetP2pIface) { - std::shared_ptr iface = configureChipForP2pAndGetIface(); - std::string iface_name = getP2pIfaceName(iface); - - std::shared_ptr retrieved_iface; - EXPECT_TRUE(wifi_chip_->getP2pIface(iface_name, &retrieved_iface).isOk()); - EXPECT_NE(nullptr, retrieved_iface.get()); - - std::string invalid_name = iface_name + "0"; - std::shared_ptr invalid_iface; - auto status = wifi_chip_->getP2pIface(invalid_name, &invalid_iface); - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); - EXPECT_EQ(nullptr, invalid_iface.get()); -} - -/* - * GetApIface - */ -TEST_P(WifiChipAidlTest, GetApIface) { - std::shared_ptr iface = configureChipForApAndGetIface(); - std::string iface_name = getApIfaceName(iface); - - std::shared_ptr retrieved_iface; - EXPECT_TRUE(wifi_chip_->getApIface(iface_name, &retrieved_iface).isOk()); - EXPECT_NE(nullptr, retrieved_iface.get()); - - std::string invalid_name = iface_name + "0"; - std::shared_ptr invalid_iface; - auto status = wifi_chip_->getApIface(invalid_name, &invalid_iface); - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); - EXPECT_EQ(nullptr, invalid_iface.get()); -} - -/* - * GetNanIface - */ -TEST_P(WifiChipAidlTest, GetNanIface) { - std::shared_ptr iface = configureChipForNanAndGetIface(); - std::string iface_name = getNanIfaceName(iface); - - std::shared_ptr retrieved_iface; - EXPECT_TRUE(wifi_chip_->getNanIface(iface_name, &retrieved_iface).isOk()); - EXPECT_NE(nullptr, retrieved_iface.get()); - - std::string invalid_name = iface_name + "0"; - std::shared_ptr invalid_iface; - auto status = wifi_chip_->getNanIface(invalid_name, &invalid_iface); - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); - EXPECT_EQ(nullptr, invalid_iface.get()); -} - -/* - * RemoveStaIface - * Configures the chip in STA mode and creates an iface. Then removes - * the iface object using the correct name and ensures that any other - * name doesn't remove the iface. - */ -TEST_P(WifiChipAidlTest, RemoveStaIface) { - std::shared_ptr iface = configureChipForStaAndGetIface(); - std::string iface_name = getStaIfaceName(iface); - - std::string invalid_name = iface_name + "0"; - auto status = wifi_chip_->removeStaIface(invalid_name); - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); - EXPECT_TRUE(wifi_chip_->removeStaIface(iface_name).isOk()); - - // No such iface exists now, so this should return failure. - EXPECT_FALSE(wifi_chip_->removeStaIface(iface_name).isOk()); -} - -/* - * RemoveP2pIface - */ -TEST_P(WifiChipAidlTest, RemoveP2pIface) { - std::shared_ptr iface = configureChipForP2pAndGetIface(); - std::string iface_name = getP2pIfaceName(iface); - - std::string invalid_name = iface_name + "0"; - auto status = wifi_chip_->removeP2pIface(invalid_name); - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); - EXPECT_TRUE(wifi_chip_->removeP2pIface(iface_name).isOk()); - - // No such iface exists now, so this should return failure. - EXPECT_FALSE(wifi_chip_->removeP2pIface(iface_name).isOk()); -} - -/* - * RemoveApIface - */ -TEST_P(WifiChipAidlTest, RemoveApIface) { - std::shared_ptr iface = configureChipForApAndGetIface(); - std::string iface_name = getApIfaceName(iface); - - std::string invalid_name = iface_name + "0"; - auto status = wifi_chip_->removeApIface(invalid_name); - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); - EXPECT_TRUE(wifi_chip_->removeApIface(iface_name).isOk()); - - // No such iface exists now, so this should return failure. - EXPECT_FALSE(wifi_chip_->removeApIface(iface_name).isOk()); -} - -/* - * RemoveNanIface - */ -TEST_P(WifiChipAidlTest, RemoveNanIface) { - std::shared_ptr iface = configureChipForNanAndGetIface(); - std::string iface_name = getNanIfaceName(iface); - - std::string invalid_name = iface_name + "0"; - auto status = wifi_chip_->removeNanIface(invalid_name); - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); - EXPECT_TRUE(wifi_chip_->removeNanIface(iface_name).isOk()); - - // No such iface exists now, so this should return failure. - EXPECT_FALSE(wifi_chip_->removeNanIface(iface_name).isOk()); -} - -/* - * CreateRttController - */ -TEST_P(WifiChipAidlTest, CreateRttController) { - std::shared_ptr iface = configureChipForStaAndGetIface(); - std::shared_ptr rtt_controller; - auto status = wifi_chip_->createRttController(iface, &rtt_controller); - if (status.isOk()) { - EXPECT_NE(nullptr, rtt_controller.get()); - } else { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - } -} - -/** - * CreateBridgedApIface & RemoveIfaceInstanceFromBridgedApIface - */ -TEST_P(WifiChipAidlTest, CreateBridgedApIfaceAndremoveIfaceInstanceFromBridgedApIfaceTest) { - bool isBridgedSupport = testing::checkSubstringInCommandOutput( - "/system/bin/cmd wifi get-softap-supported-features", - "wifi_softap_bridged_ap_supported"); - if (!isBridgedSupport) { - GTEST_SKIP() << "Missing Bridged AP support"; - } - - std::shared_ptr wifi_chip = getWifiChip(getInstanceName()); - ASSERT_NE(nullptr, wifi_chip.get()); - std::shared_ptr wifi_ap_iface = getBridgedWifiApIface(wifi_chip); - ASSERT_NE(nullptr, wifi_ap_iface.get()); - - std::string br_name; - std::vector instances; - EXPECT_TRUE(wifi_ap_iface->getName(&br_name).isOk()); - EXPECT_TRUE(wifi_ap_iface->getBridgedInstances(&instances).isOk()); - EXPECT_EQ(instances.size(), 2); - - std::vector instances_after_remove; - EXPECT_TRUE(wifi_chip->removeIfaceInstanceFromBridgedApIface(br_name, instances[0]).isOk()); - EXPECT_TRUE(wifi_ap_iface->getBridgedInstances(&instances_after_remove).isOk()); - EXPECT_EQ(instances_after_remove.size(), 1); -} - -GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiChipAidlTest); -INSTANTIATE_TEST_SUITE_P(WifiTest, WifiChipAidlTest, - testing::ValuesIn(android::getAidlHalInstanceNames(IWifi::descriptor)), - android::PrintInstanceNameToString); - -int main(int argc, char** argv) { - ::testing::InitGoogleTest(&argc, argv); - android::ProcessState::self()->setThreadPoolMaxThreadCount(1); - android::ProcessState::self()->startThreadPool(); - return RUN_ALL_TESTS(); -} diff --git a/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp deleted file mode 100644 index 457d57ad75..0000000000 --- a/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp +++ /dev/null @@ -1,627 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Staache 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. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "wifi_aidl_test_utils.h" - -using aidl::android::hardware::wifi::BnWifiNanIfaceEventCallback; -using aidl::android::hardware::wifi::IWifiNanIface; -using aidl::android::hardware::wifi::NanBandIndex; -using aidl::android::hardware::wifi::NanBandSpecificConfig; -using aidl::android::hardware::wifi::NanCapabilities; -using aidl::android::hardware::wifi::NanClusterEventInd; -using aidl::android::hardware::wifi::NanConfigRequest; -using aidl::android::hardware::wifi::NanConfigRequestSupplemental; -using aidl::android::hardware::wifi::NanDataPathConfirmInd; -using aidl::android::hardware::wifi::NanDataPathRequestInd; -using aidl::android::hardware::wifi::NanDataPathScheduleUpdateInd; -using aidl::android::hardware::wifi::NanDataPathSecurityType; -using aidl::android::hardware::wifi::NanEnableRequest; -using aidl::android::hardware::wifi::NanFollowupReceivedInd; -using aidl::android::hardware::wifi::NanInitiateDataPathRequest; -using aidl::android::hardware::wifi::NanMatchAlg; -using aidl::android::hardware::wifi::NanMatchInd; -using aidl::android::hardware::wifi::NanPublishRequest; -using aidl::android::hardware::wifi::NanPublishType; -using aidl::android::hardware::wifi::NanRespondToDataPathIndicationRequest; -using aidl::android::hardware::wifi::NanStatus; -using aidl::android::hardware::wifi::NanStatusCode; -using aidl::android::hardware::wifi::NanTxType; - -#define TIMEOUT_PERIOD 10 - -class WifiNanIfaceAidlTest : public testing::TestWithParam { - public: - void SetUp() override { - if (!::testing::deviceSupportsFeature("android.hardware.wifi.aware")) - GTEST_SKIP() << "Skipping this test since NAN is not supported."; - stopWifiService(getInstanceName()); - - wifi_nan_iface_ = getWifiNanIface(getInstanceName()); - ASSERT_NE(nullptr, wifi_nan_iface_.get()); - std::shared_ptr callback = - ndk::SharedRefBase::make(*this); - EXPECT_TRUE(wifi_nan_iface_->registerEventCallback(callback).isOk()); - } - - void TearDown() override { stopWifiService(getInstanceName()); } - - // Used as a mechanism to inform the test about data/event callbacks. - inline void notify() { - std::unique_lock lock(mtx_); - count_++; - cv_.notify_one(); - } - - enum CallbackType { - INVALID = -2, - ANY_CALLBACK = -1, - - NOTIFY_CAPABILITIES_RESPONSE = 0, - NOTIFY_ENABLE_RESPONSE, - NOTIFY_CONFIG_RESPONSE, - NOTIFY_DISABLE_RESPONSE, - NOTIFY_START_PUBLISH_RESPONSE, - NOTIFY_STOP_PUBLISH_RESPONSE, - NOTIFY_START_SUBSCRIBE_RESPONSE, - NOTIFY_STOP_SUBSCRIBE_RESPONSE, - NOTIFY_TRANSMIT_FOLLOWUP_RESPONSE, - NOTIFY_CREATE_DATA_INTERFACE_RESPONSE, - NOTIFY_DELETE_DATA_INTERFACE_RESPONSE, - NOTIFY_INITIATE_DATA_PATH_RESPONSE, - NOTIFY_RESPOND_TO_DATA_PATH_INDICATION_RESPONSE, - NOTIFY_TERMINATE_DATA_PATH_RESPONSE, - - EVENT_CLUSTER_EVENT, - EVENT_DISABLED, - EVENT_PUBLISH_TERMINATED, - EVENT_SUBSCRIBE_TERMINATED, - EVENT_MATCH, - EVENT_MATCH_EXPIRED, - EVENT_FOLLOWUP_RECEIVED, - EVENT_TRANSMIT_FOLLOWUP, - EVENT_DATA_PATH_REQUEST, - EVENT_DATA_PATH_CONFIRM, - EVENT_DATA_PATH_TERMINATED, - EVENT_DATA_PATH_SCHEDULE_UPDATE, - }; - - // Test code calls this function to wait for data/event callback. - // Must set callbackType = INVALID before calling this function. - inline std::cv_status wait(CallbackType waitForCallbackType) { - std::unique_lock lock(mtx_); - EXPECT_NE(INVALID, waitForCallbackType); - - std::cv_status status = std::cv_status::no_timeout; - auto now = std::chrono::system_clock::now(); - while (count_ == 0) { - status = cv_.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD)); - if (status == std::cv_status::timeout) return status; - if (waitForCallbackType != ANY_CALLBACK && callback_type_ != INVALID && - callback_type_ != waitForCallbackType) { - count_--; - } - } - count_--; - return status; - } - - class WifiNanIfaceEventCallback : public BnWifiNanIfaceEventCallback { - public: - WifiNanIfaceEventCallback(WifiNanIfaceAidlTest& parent) : parent_(parent){}; - - ::ndk::ScopedAStatus eventClusterEvent(const NanClusterEventInd& event) override { - parent_.callback_type_ = EVENT_CLUSTER_EVENT; - parent_.nan_cluster_event_ind_ = event; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus eventDataPathConfirm(const NanDataPathConfirmInd& event) override { - parent_.callback_type_ = EVENT_DATA_PATH_CONFIRM; - parent_.nan_data_path_confirm_ind_ = event; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus eventDataPathRequest(const NanDataPathRequestInd& event) override { - parent_.callback_type_ = EVENT_DATA_PATH_REQUEST; - parent_.nan_data_path_request_ind_ = event; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus eventDataPathScheduleUpdate( - const NanDataPathScheduleUpdateInd& event) override { - parent_.callback_type_ = EVENT_DATA_PATH_SCHEDULE_UPDATE; - parent_.nan_data_path_schedule_update_ind_ = event; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus eventDataPathTerminated(int32_t ndpInstanceId) override { - parent_.callback_type_ = EVENT_DATA_PATH_TERMINATED; - parent_.ndp_instance_id_ = ndpInstanceId; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus eventDisabled(const NanStatus& status) override { - parent_.callback_type_ = EVENT_DISABLED; - parent_.status_ = status; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus eventFollowupReceived(const NanFollowupReceivedInd& event) override { - parent_.callback_type_ = EVENT_FOLLOWUP_RECEIVED; - parent_.nan_followup_received_ind_ = event; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus eventMatch(const NanMatchInd& event) override { - parent_.callback_type_ = EVENT_MATCH; - parent_.nan_match_ind_ = event; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus eventMatchExpired(int8_t discoverySessionId, int32_t peerId) override { - parent_.callback_type_ = EVENT_MATCH_EXPIRED; - parent_.session_id_ = discoverySessionId; - parent_.peer_id_ = peerId; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus eventPublishTerminated(int8_t sessionId, - const NanStatus& status) override { - parent_.callback_type_ = EVENT_PUBLISH_TERMINATED; - parent_.session_id_ = sessionId; - parent_.status_ = status; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus eventSubscribeTerminated(int8_t sessionId, - const NanStatus& status) override { - parent_.callback_type_ = EVENT_SUBSCRIBE_TERMINATED; - parent_.session_id_ = sessionId; - parent_.status_ = status; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus eventTransmitFollowup(char16_t id, const NanStatus& status) override { - parent_.callback_type_ = EVENT_TRANSMIT_FOLLOWUP; - parent_.id_ = id; - parent_.status_ = status; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus notifyCapabilitiesResponse( - char16_t id, const NanStatus& status, - const NanCapabilities& capabilities) override { - parent_.callback_type_ = NOTIFY_CAPABILITIES_RESPONSE; - parent_.id_ = id; - parent_.status_ = status; - parent_.capabilities_ = capabilities; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus notifyConfigResponse(char16_t id, const NanStatus& status) override { - parent_.callback_type_ = NOTIFY_CONFIG_RESPONSE; - parent_.id_ = id; - parent_.status_ = status; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus notifyCreateDataInterfaceResponse(char16_t id, - const NanStatus& status) override { - parent_.callback_type_ = NOTIFY_CREATE_DATA_INTERFACE_RESPONSE; - parent_.id_ = id; - parent_.status_ = status; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus notifyDeleteDataInterfaceResponse(char16_t id, - const NanStatus& status) override { - parent_.callback_type_ = NOTIFY_DELETE_DATA_INTERFACE_RESPONSE; - parent_.id_ = id; - parent_.status_ = status; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus notifyDisableResponse(char16_t id, const NanStatus& status) override { - parent_.callback_type_ = NOTIFY_DISABLE_RESPONSE; - parent_.id_ = id; - parent_.status_ = status; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus notifyEnableResponse(char16_t id, const NanStatus& status) override { - parent_.callback_type_ = NOTIFY_ENABLE_RESPONSE; - parent_.id_ = id; - parent_.status_ = status; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus notifyInitiateDataPathResponse(char16_t id, const NanStatus& status, - int32_t ndpInstanceId) override { - parent_.callback_type_ = NOTIFY_INITIATE_DATA_PATH_RESPONSE; - parent_.id_ = id; - parent_.status_ = status; - parent_.ndp_instance_id_ = ndpInstanceId; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus notifyRespondToDataPathIndicationResponse( - char16_t id, const NanStatus& status) override { - parent_.callback_type_ = NOTIFY_RESPOND_TO_DATA_PATH_INDICATION_RESPONSE; - parent_.id_ = id; - parent_.status_ = status; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus notifyStartPublishResponse(char16_t id, const NanStatus& status, - int8_t sessionId) override { - parent_.callback_type_ = NOTIFY_START_PUBLISH_RESPONSE; - parent_.id_ = id; - parent_.status_ = status; - parent_.session_id_ = sessionId; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus notifyStartSubscribeResponse(char16_t id, const NanStatus& status, - int8_t sessionId) override { - parent_.callback_type_ = NOTIFY_START_SUBSCRIBE_RESPONSE; - parent_.id_ = id; - parent_.status_ = status; - parent_.session_id_ = sessionId; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus notifyStopPublishResponse(char16_t id, - const NanStatus& status) override { - parent_.callback_type_ = NOTIFY_STOP_PUBLISH_RESPONSE; - parent_.id_ = id; - parent_.status_ = status; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus notifyStopSubscribeResponse(char16_t id, - const NanStatus& status) override { - parent_.callback_type_ = NOTIFY_STOP_SUBSCRIBE_RESPONSE; - parent_.id_ = id; - parent_.status_ = status; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus notifyTerminateDataPathResponse(char16_t id, - const NanStatus& status) override { - parent_.callback_type_ = NOTIFY_TERMINATE_DATA_PATH_RESPONSE; - parent_.id_ = id; - parent_.status_ = status; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - ::ndk::ScopedAStatus notifyTransmitFollowupResponse(char16_t id, - const NanStatus& status) override { - parent_.callback_type_ = NOTIFY_TRANSMIT_FOLLOWUP_RESPONSE; - parent_.id_ = id; - parent_.status_ = status; - parent_.notify(); - return ndk::ScopedAStatus::ok(); - } - - private: - WifiNanIfaceAidlTest& parent_; - }; - - protected: - std::shared_ptr wifi_nan_iface_; - CallbackType callback_type_; - uint16_t id_; - uint8_t session_id_; - uint32_t ndp_instance_id_; - uint32_t peer_id_; - NanCapabilities capabilities_; - NanClusterEventInd nan_cluster_event_ind_; - NanDataPathConfirmInd nan_data_path_confirm_ind_; - NanDataPathRequestInd nan_data_path_request_ind_; - NanDataPathScheduleUpdateInd nan_data_path_schedule_update_ind_; - NanFollowupReceivedInd nan_followup_received_ind_; - NanMatchInd nan_match_ind_; - NanStatus status_; - - const char* getInstanceName() { return GetParam().c_str(); } - - private: - // synchronization objects - std::mutex mtx_; - std::condition_variable cv_; - int count_ = 0; -}; - -/* - * FailOnIfaceInvalid - * Ensure that API calls to an interface fail with code ERROR_WIFI_IFACE_INVALID - * after wifi is disabled. - */ -TEST_P(WifiNanIfaceAidlTest, FailOnIfaceInvalid) { - stopWifiService(getInstanceName()); - sleep(5); // Ensure that all chips/interfaces are invalidated. - auto status = wifi_nan_iface_->getCapabilitiesRequest(0); - ASSERT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_WIFI_IFACE_INVALID)); -} - -/* - * EnableRequest - Invalid Args - */ -TEST_P(WifiNanIfaceAidlTest, EnableRequest_InvalidArgs) { - uint16_t inputCmdId = 10; - callback_type_ = INVALID; - NanEnableRequest nanEnableRequest = {}; - NanConfigRequestSupplemental nanConfigRequestSupp = {}; - auto status = - wifi_nan_iface_->enableRequest(inputCmdId, nanEnableRequest, nanConfigRequestSupp); - if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { - ASSERT_TRUE(status.isOk()); - - // Wait for a callback. - ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_ENABLE_RESPONSE)); - ASSERT_EQ(NOTIFY_ENABLE_RESPONSE, callback_type_); - ASSERT_EQ(id_, inputCmdId); - ASSERT_EQ(status_.status, NanStatusCode::INVALID_ARGS); - } -} - -/* - * ConfigRequest - Invalid Args - */ -TEST_P(WifiNanIfaceAidlTest, ConfigRequest_InvalidArgs) { - uint16_t inputCmdId = 10; - callback_type_ = INVALID; - NanConfigRequest nanConfigRequest = {}; - NanConfigRequestSupplemental nanConfigRequestSupp = {}; - auto status = - wifi_nan_iface_->configRequest(inputCmdId, nanConfigRequest, nanConfigRequestSupp); - - if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { - ASSERT_TRUE(status.isOk()); - - // Wait for a callback. - ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_CONFIG_RESPONSE)); - ASSERT_EQ(NOTIFY_CONFIG_RESPONSE, callback_type_); - ASSERT_EQ(id_, inputCmdId); - ASSERT_EQ(status_.status, NanStatusCode::INVALID_ARGS); - } -} - -/* - * EnableRequest - Invalid Args in Shim Conversion - */ -TEST_P(WifiNanIfaceAidlTest, EnableRequest_InvalidShimArgs) { - uint16_t inputCmdId = 10; - NanEnableRequest nanEnableRequest = {}; - nanEnableRequest.configParams.numberOfPublishServiceIdsInBeacon = -15; // must be > 0 - NanConfigRequestSupplemental nanConfigRequestSupp = {}; - auto status = - wifi_nan_iface_->enableRequest(inputCmdId, nanEnableRequest, nanConfigRequestSupp); - if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { - ASSERT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); - } -} - -/* - * ConfigRequest - Invalid Args in Shim Conversion - */ -TEST_P(WifiNanIfaceAidlTest, ConfigRequest_InvalidShimArgs) { - uint16_t inputCmdId = 10; - NanConfigRequest nanConfigRequest = {}; - nanConfigRequest.numberOfPublishServiceIdsInBeacon = -15; // must be > 0 - NanConfigRequestSupplemental nanConfigRequestSupp = {}; - auto status = - wifi_nan_iface_->configRequest(inputCmdId, nanConfigRequest, nanConfigRequestSupp); - if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { - ASSERT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); - } -} - -/* - * NotifyCapabilitiesResponse - */ -TEST_P(WifiNanIfaceAidlTest, NotifyCapabilitiesResponse) { - uint16_t inputCmdId = 10; - callback_type_ = INVALID; - EXPECT_TRUE(wifi_nan_iface_->getCapabilitiesRequest(inputCmdId).isOk()); - - // Wait for a callback. - ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_CAPABILITIES_RESPONSE)); - ASSERT_EQ(NOTIFY_CAPABILITIES_RESPONSE, callback_type_); - ASSERT_EQ(id_, inputCmdId); - ASSERT_EQ(status_.status, NanStatusCode::SUCCESS); - - // Check for reasonable capability values. - EXPECT_GT(capabilities_.maxConcurrentClusters, 0); - EXPECT_GT(capabilities_.maxPublishes, 0); - EXPECT_GT(capabilities_.maxSubscribes, 0); - EXPECT_EQ(capabilities_.maxServiceNameLen, 255); - EXPECT_EQ(capabilities_.maxMatchFilterLen, 255); - EXPECT_GT(capabilities_.maxTotalMatchFilterLen, 255); - EXPECT_EQ(capabilities_.maxServiceSpecificInfoLen, 255); - EXPECT_GE(capabilities_.maxExtendedServiceSpecificInfoLen, 255); - EXPECT_GT(capabilities_.maxNdiInterfaces, 0); - EXPECT_GT(capabilities_.maxNdpSessions, 0); - EXPECT_GT(capabilities_.maxAppInfoLen, 0); - EXPECT_GT(capabilities_.maxQueuedTransmitFollowupMsgs, 0); - EXPECT_GT(capabilities_.maxSubscribeInterfaceAddresses, 0); - EXPECT_NE(static_cast(capabilities_.supportedCipherSuites), 0); -} - -/* - * StartPublishRequest - */ -TEST_P(WifiNanIfaceAidlTest, StartPublishRequest) { - uint16_t inputCmdId = 10; - NanBandSpecificConfig config24 = {}; - config24.rssiClose = 60; - config24.rssiMiddle = 70; - config24.rssiCloseProximity = 60; - config24.dwellTimeMs = 200; - config24.scanPeriodSec = 20; - config24.validDiscoveryWindowIntervalVal = false; - config24.discoveryWindowIntervalVal = 0; - - NanBandSpecificConfig config5 = {}; - config5.rssiClose = 60; - config5.rssiMiddle = 75; - config5.rssiCloseProximity = 60; - config5.dwellTimeMs = 200; - config5.scanPeriodSec = 20; - config5.validDiscoveryWindowIntervalVal = false; - config5.discoveryWindowIntervalVal = 0; - - NanEnableRequest req = {}; - req.operateInBand[static_cast(NanBandIndex::NAN_BAND_24GHZ)] = true; - req.operateInBand[static_cast(NanBandIndex::NAN_BAND_5GHZ)] = false; - req.hopCountMax = 2; - req.configParams.masterPref = 0; - req.configParams.disableDiscoveryAddressChangeIndication = true; - req.configParams.disableStartedClusterIndication = true; - req.configParams.disableJoinedClusterIndication = true; - req.configParams.includePublishServiceIdsInBeacon = true; - req.configParams.numberOfPublishServiceIdsInBeacon = 0; - req.configParams.includeSubscribeServiceIdsInBeacon = true; - req.configParams.numberOfSubscribeServiceIdsInBeacon = 0; - req.configParams.rssiWindowSize = 8; - req.configParams.macAddressRandomizationIntervalSec = 1800; - req.configParams.bandSpecificConfig[static_cast(NanBandIndex::NAN_BAND_24GHZ)] = - config24; - req.configParams.bandSpecificConfig[static_cast(NanBandIndex::NAN_BAND_5GHZ)] = - config5; - - req.debugConfigs.validClusterIdVals = true; - req.debugConfigs.clusterIdTopRangeVal = 65535; - req.debugConfigs.clusterIdBottomRangeVal = 0; - req.debugConfigs.validIntfAddrVal = false; - req.debugConfigs.validOuiVal = false; - req.debugConfigs.ouiVal = 0; - req.debugConfigs.validRandomFactorForceVal = false; - req.debugConfigs.randomFactorForceVal = 0; - req.debugConfigs.validHopCountForceVal = false; - req.debugConfigs.hopCountForceVal = 0; - req.debugConfigs.validDiscoveryChannelVal = false; - req.debugConfigs.discoveryChannelMhzVal[static_cast(NanBandIndex::NAN_BAND_24GHZ)] = 0; - req.debugConfigs.discoveryChannelMhzVal[static_cast(NanBandIndex::NAN_BAND_5GHZ)] = 0; - req.debugConfigs.validUseBeaconsInBandVal = false; - req.debugConfigs.useBeaconsInBandVal[static_cast(NanBandIndex::NAN_BAND_24GHZ)] = true; - req.debugConfigs.useBeaconsInBandVal[static_cast(NanBandIndex::NAN_BAND_5GHZ)] = true; - req.debugConfigs.validUseSdfInBandVal = false; - req.debugConfigs.useSdfInBandVal[static_cast(NanBandIndex::NAN_BAND_24GHZ)] = true; - req.debugConfigs.useSdfInBandVal[static_cast(NanBandIndex::NAN_BAND_5GHZ)] = true; - - NanConfigRequestSupplemental nanConfigRequestSupp = {}; - nanConfigRequestSupp.discoveryBeaconIntervalMs = 20; - nanConfigRequestSupp.numberOfSpatialStreamsInDiscovery = 0; - nanConfigRequestSupp.enableDiscoveryWindowEarlyTermination = false; - - callback_type_ = INVALID; - auto status = wifi_nan_iface_->enableRequest(inputCmdId, req, nanConfigRequestSupp); - if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { - ASSERT_TRUE(status.isOk()); - - // Wait for a callback. - ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_ENABLE_RESPONSE)); - ASSERT_EQ(NOTIFY_ENABLE_RESPONSE, callback_type_); - ASSERT_EQ(id_, inputCmdId); - ASSERT_EQ(status_.status, NanStatusCode::SUCCESS); - } - - NanPublishRequest nanPublishRequest = {}; - nanPublishRequest.baseConfigs.sessionId = 0; - nanPublishRequest.baseConfigs.ttlSec = 0; - nanPublishRequest.baseConfigs.discoveryWindowPeriod = 1; - nanPublishRequest.baseConfigs.discoveryCount = 0; - nanPublishRequest.baseConfigs.serviceName = {97}; - nanPublishRequest.baseConfigs.discoveryMatchIndicator = NanMatchAlg::MATCH_NEVER; - nanPublishRequest.baseConfigs.useRssiThreshold = false; - nanPublishRequest.baseConfigs.disableDiscoveryTerminationIndication = false; - nanPublishRequest.baseConfigs.disableMatchExpirationIndication = true; - nanPublishRequest.baseConfigs.disableFollowupReceivedIndication = false; - nanPublishRequest.baseConfigs.securityConfig.securityType = NanDataPathSecurityType::OPEN; - nanPublishRequest.autoAcceptDataPathRequests = false; - nanPublishRequest.publishType = NanPublishType::UNSOLICITED; - nanPublishRequest.txType = NanTxType::BROADCAST; - - status = wifi_nan_iface_->startPublishRequest(inputCmdId + 1, nanPublishRequest); - if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { - ASSERT_TRUE(status.isOk()); - - // Wait for a callback. - ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_START_PUBLISH_RESPONSE)); - ASSERT_EQ(NOTIFY_START_PUBLISH_RESPONSE, callback_type_); - ASSERT_EQ(id_, inputCmdId + 1); - ASSERT_EQ(status_.status, NanStatusCode::SUCCESS); - } -} - -/* - * RespondToDataPathIndicationRequest - Invalid Args - */ -TEST_P(WifiNanIfaceAidlTest, RespondToDataPathIndicationRequest_InvalidArgs) { - uint16_t inputCmdId = 10; - callback_type_ = INVALID; - NanRespondToDataPathIndicationRequest nanRespondToDataPathIndicationRequest = {}; - nanRespondToDataPathIndicationRequest.ifaceName = "AwareInterfaceNameTooLong"; - auto status = wifi_nan_iface_->respondToDataPathIndicationRequest( - inputCmdId, nanRespondToDataPathIndicationRequest); - - if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { - ASSERT_EQ(status.getServiceSpecificError(), - static_cast(WifiStatusCode::ERROR_INVALID_ARGS)); - } -} - -/* - * InitiateDataPathRequest - Invalid Args - */ -TEST_P(WifiNanIfaceAidlTest, InitiateDataPathRequest_InvalidArgs) { - uint16_t inputCmdId = 10; - callback_type_ = INVALID; - NanInitiateDataPathRequest nanInitiateDataPathRequest = {}; - nanInitiateDataPathRequest.ifaceName = "AwareInterfaceNameTooLong"; - auto status = wifi_nan_iface_->initiateDataPathRequest(inputCmdId, nanInitiateDataPathRequest); - - if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { - ASSERT_EQ(status.getServiceSpecificError(), - static_cast(WifiStatusCode::ERROR_INVALID_ARGS)); - } -} - -GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiNanIfaceAidlTest); -INSTANTIATE_TEST_SUITE_P(WifiTest, WifiNanIfaceAidlTest, - testing::ValuesIn(android::getAidlHalInstanceNames(IWifi::descriptor)), - android::PrintInstanceNameToString); - -int main(int argc, char** argv) { - ::testing::InitGoogleTest(&argc, argv); - android::ProcessState::self()->setThreadPoolMaxThreadCount(1); - android::ProcessState::self()->startThreadPool(); - return RUN_ALL_TESTS(); -} diff --git a/wifi/aidl/vts/functional/wifi_rtt_controller_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_rtt_controller_aidl_test.cpp deleted file mode 100644 index d763fe64a5..0000000000 --- a/wifi/aidl/vts/functional/wifi_rtt_controller_aidl_test.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Staache 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. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "wifi_aidl_test_utils.h" - -using aidl::android::hardware::wifi::BnWifiRttControllerEventCallback; -using aidl::android::hardware::wifi::IWifiRttController; -using aidl::android::hardware::wifi::RttBw; -using aidl::android::hardware::wifi::RttCapabilities; -using aidl::android::hardware::wifi::RttConfig; -using aidl::android::hardware::wifi::RttPeerType; -using aidl::android::hardware::wifi::RttPreamble; -using aidl::android::hardware::wifi::RttResponder; -using aidl::android::hardware::wifi::RttResult; -using aidl::android::hardware::wifi::RttType; -using aidl::android::hardware::wifi::WifiChannelInfo; -using aidl::android::hardware::wifi::WifiChannelWidthInMhz; -using aidl::android::hardware::wifi::WifiStatusCode; - -class WifiRttControllerAidlTest : public testing::TestWithParam { - public: - void SetUp() override { - if (!::testing::deviceSupportsFeature("android.hardware.wifi.rtt")) - GTEST_SKIP() << "Skipping this test since RTT is not supported."; - stopWifiService(getInstanceName()); - wifi_rtt_controller_ = getWifiRttController(); - ASSERT_NE(nullptr, wifi_rtt_controller_.get()); - - // Check RTT support before we run the test. - RttCapabilities caps = {}; - auto status = wifi_rtt_controller_->getCapabilities(&caps); - if (checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { - GTEST_SKIP() << "Skipping this test since RTT is not supported."; - } - } - - void TearDown() override { stopWifiService(getInstanceName()); } - - protected: - std::shared_ptr getWifiRttController() { - std::shared_ptr wifi_chip = getWifiChip(getInstanceName()); - EXPECT_NE(nullptr, wifi_chip.get()); - - std::shared_ptr wifi_sta_iface = getWifiStaIface(getInstanceName()); - EXPECT_NE(nullptr, wifi_sta_iface.get()); - - std::shared_ptr rtt_controller; - EXPECT_TRUE(wifi_chip->createRttController(wifi_sta_iface, &rtt_controller).isOk()); - EXPECT_NE(nullptr, rtt_controller.get()); - return rtt_controller; - } - - std::shared_ptr wifi_rtt_controller_; - - private: - const char* getInstanceName() { return GetParam().c_str(); } -}; - -class WifiRttControllerEventCallback : public BnWifiRttControllerEventCallback { - public: - WifiRttControllerEventCallback() = default; - - ::ndk::ScopedAStatus onResults(int /* cmdId */, - const std::vector& /* results */) override { - return ndk::ScopedAStatus::ok(); - } -}; - -/* - * RegisterEventCallback - * - * Note: it is not feasible to test the invocation of the callback function, - * since events are triggered internally in the HAL implementation and cannot be - * triggered from the test case. - */ -TEST_P(WifiRttControllerAidlTest, RegisterEventCallback) { - std::shared_ptr callback = - ndk::SharedRefBase::make(); - ASSERT_NE(nullptr, callback.get()); - EXPECT_TRUE(wifi_rtt_controller_->registerEventCallback(callback).isOk()); -} - -/* - * GetCapabilities - */ -TEST_P(WifiRttControllerAidlTest, GetCapabilities) { - RttCapabilities caps = {}; - EXPECT_TRUE(wifi_rtt_controller_->getCapabilities(&caps).isOk()); -} - -/* - * GetResponderInfo - */ -TEST_P(WifiRttControllerAidlTest, GetResponderInfo) { - RttResponder responder = {}; - EXPECT_TRUE(wifi_rtt_controller_->getResponderInfo(&responder).isOk()); -} - -/* - * EnableResponder - */ -TEST_P(WifiRttControllerAidlTest, EnableResponder) { - int cmdId = 55; - WifiChannelInfo channelInfo; - channelInfo.width = WifiChannelWidthInMhz::WIDTH_80; - channelInfo.centerFreq = 5660; - channelInfo.centerFreq0 = 5660; - channelInfo.centerFreq1 = 0; - - RttResponder responder = {}; - EXPECT_TRUE(wifi_rtt_controller_->getResponderInfo(&responder).isOk()); - EXPECT_TRUE(wifi_rtt_controller_->enableResponder(cmdId, channelInfo, 10, responder).isOk()); -} - -/* - * Request2SidedRangeMeasurement - * Tests the two sided ranging - 802.11mc FTM protocol. - */ -TEST_P(WifiRttControllerAidlTest, Request2SidedRangeMeasurement) { - RttCapabilities caps = {}; - EXPECT_TRUE(wifi_rtt_controller_->getCapabilities(&caps).isOk()); - if (!caps.rttFtmSupported) { - GTEST_SKIP() << "Skipping two sided RTT since driver/fw does not support"; - } - - RttConfig config; - config.addr = {{0x00, 0x01, 0x02, 0x03, 0x04, 0x05}}; - config.type = RttType::TWO_SIDED; - config.peer = RttPeerType::AP; - config.channel.width = WifiChannelWidthInMhz::WIDTH_80; - config.channel.centerFreq = 5180; - config.channel.centerFreq0 = 5210; - config.channel.centerFreq1 = 0; - config.bw = RttBw::BW_20MHZ; - config.preamble = RttPreamble::HT; - config.mustRequestLci = false; - config.mustRequestLcr = false; - config.burstPeriod = 0; - config.numBurst = 0; - config.numFramesPerBurst = 8; - config.numRetriesPerRttFrame = 0; - config.numRetriesPerFtmr = 0; - config.burstDuration = 9; - - int cmdId = 55; - std::vector configs = {config}; - EXPECT_TRUE(wifi_rtt_controller_->rangeRequest(cmdId, configs).isOk()); - - // Sleep for 2 seconds to wait for driver/firmware to complete RTT. - sleep(2); -} - -/* - * RangeRequest - */ -TEST_P(WifiRttControllerAidlTest, RangeRequest) { - RttCapabilities caps = {}; - EXPECT_TRUE(wifi_rtt_controller_->getCapabilities(&caps).isOk()); - if (!caps.rttOneSidedSupported) { - GTEST_SKIP() << "Skipping one sided RTT since driver/fw does not support"; - } - - // Get the highest supported preamble. - int preamble = 1; - int caps_preamble_support = static_cast(caps.preambleSupport); - caps_preamble_support >>= 1; - while (caps_preamble_support != 0) { - caps_preamble_support >>= 1; - preamble <<= 1; - } - - RttConfig config; - config.addr = {{0x00, 0x01, 0x02, 0x03, 0x04, 0x05}}; - config.type = RttType::ONE_SIDED; - config.peer = RttPeerType::AP; - config.channel.width = WifiChannelWidthInMhz::WIDTH_80; - config.channel.centerFreq = 5765; - config.channel.centerFreq0 = 5775; - config.channel.centerFreq1 = 0; - config.bw = RttBw::BW_80MHZ; - config.preamble = static_cast(preamble); - config.mustRequestLci = false; - config.mustRequestLcr = false; - config.burstPeriod = 0; - config.numBurst = 0; - config.numFramesPerBurst = 8; - config.numRetriesPerRttFrame = 3; - config.numRetriesPerFtmr = 3; - config.burstDuration = 9; - - int cmdId = 55; - std::vector configs = {config}; - EXPECT_TRUE(wifi_rtt_controller_->rangeRequest(cmdId, configs).isOk()); - - // Sleep for 2 seconds to wait for driver/firmware to complete RTT. - sleep(2); -} - -GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiRttControllerAidlTest); -INSTANTIATE_TEST_SUITE_P(WifiTest, WifiRttControllerAidlTest, - testing::ValuesIn(android::getAidlHalInstanceNames(IWifi::descriptor)), - android::PrintInstanceNameToString); - -int main(int argc, char** argv) { - ::testing::InitGoogleTest(&argc, argv); - android::ProcessState::self()->setThreadPoolMaxThreadCount(1); - android::ProcessState::self()->startThreadPool(); - return RUN_ALL_TESTS(); -} diff --git a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp deleted file mode 100644 index ef7e2747c9..0000000000 --- a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Staache 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. - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "wifi_aidl_test_utils.h" - -using aidl::android::hardware::wifi::IWifi; -using aidl::android::hardware::wifi::IWifiStaIface; -using aidl::android::hardware::wifi::MacAddress; -using aidl::android::hardware::wifi::Ssid; -using aidl::android::hardware::wifi::StaApfPacketFilterCapabilities; -using aidl::android::hardware::wifi::StaBackgroundScanCapabilities; -using aidl::android::hardware::wifi::StaLinkLayerStats; -using aidl::android::hardware::wifi::StaRoamingCapabilities; -using aidl::android::hardware::wifi::StaRoamingConfig; -using aidl::android::hardware::wifi::StaRoamingState; -using aidl::android::hardware::wifi::WifiBand; -using aidl::android::hardware::wifi::WifiDebugRxPacketFateReport; -using aidl::android::hardware::wifi::WifiDebugTxPacketFateReport; -using aidl::android::hardware::wifi::WifiStatusCode; - -class WifiStaIfaceAidlTest : public testing::TestWithParam { - public: - void SetUp() override { - stopWifiService(getInstanceName()); - wifi_sta_iface_ = getWifiStaIface(getInstanceName()); - ASSERT_NE(nullptr, wifi_sta_iface_.get()); - } - - void TearDown() override { stopWifiService(getInstanceName()); } - - protected: - bool isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask expected) { - IWifiStaIface::StaIfaceCapabilityMask caps = {}; - EXPECT_TRUE(wifi_sta_iface_->getCapabilities(&caps).isOk()); - return static_cast(caps) & static_cast(expected); - } - - ndk::ScopedAStatus createStaIface(std::shared_ptr* sta_iface) { - std::shared_ptr wifi_chip = getWifiChip(getInstanceName()); - EXPECT_NE(nullptr, wifi_chip.get()); - return wifi_chip->createStaIface(sta_iface); - } - - std::shared_ptr wifi_sta_iface_; - - private: - const char* getInstanceName() { return GetParam().c_str(); } -}; - -/* - * GetFactoryMacAddress - * Ensures that calls to getFactoryMacAddress will retrieve a non-zero MAC. - */ -TEST_P(WifiStaIfaceAidlTest, GetFactoryMacAddress) { - std::array mac; - EXPECT_TRUE(wifi_sta_iface_->getFactoryMacAddress(&mac).isOk()); - std::array all_zero_mac = {0, 0, 0, 0, 0, 0}; - EXPECT_NE(mac, all_zero_mac); -} - -/* - * GetCapabilities - */ -TEST_P(WifiStaIfaceAidlTest, GetCapabilities) { - IWifiStaIface::StaIfaceCapabilityMask caps = {}; - EXPECT_TRUE(wifi_sta_iface_->getCapabilities(&caps).isOk()); - EXPECT_NE(static_cast(caps), 0); -} - -/* - * GetApfPacketFilterCapabilities - */ -TEST_P(WifiStaIfaceAidlTest, GetApfPacketFilterCapabilities) { - if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::APF)) { - GTEST_SKIP() << "APF packet filter capabilities are not supported."; - } - StaApfPacketFilterCapabilities apf_caps = {}; - EXPECT_TRUE(wifi_sta_iface_->getApfPacketFilterCapabilities(&apf_caps).isOk()); -} - -/* - * GetBackgroundScanCapabilities - */ -TEST_P(WifiStaIfaceAidlTest, GetBackgroundScanCapabilities) { - if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::BACKGROUND_SCAN)) { - GTEST_SKIP() << "Background scan capabilities are not supported."; - } - StaBackgroundScanCapabilities caps = {}; - EXPECT_TRUE(wifi_sta_iface_->getBackgroundScanCapabilities(&caps).isOk()); -} - -/* - * GetValidFrequenciesForBand - * Ensures that we can retrieve valid frequencies for the 2.4 GHz band. - */ -TEST_P(WifiStaIfaceAidlTest, GetValidFrequenciesForBand) { - std::vector freqs; - EXPECT_TRUE(wifi_sta_iface_->getValidFrequenciesForBand(WifiBand::BAND_24GHZ, &freqs).isOk()); - EXPECT_NE(freqs.size(), 0); -} - -/* - * GetLinkLayerStats - * Ensures that calls to getLinkLayerStats will retrieve a non-empty - * StaLinkLayerStats after link layer stats collection is enabled. - */ -TEST_P(WifiStaIfaceAidlTest, GetLinkLayerStats) { - if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::LINK_LAYER_STATS)) { - GTEST_SKIP() << "Skipping this test since link layer stats are not supported."; - } - - // Enable link layer stats collection. - EXPECT_TRUE(wifi_sta_iface_->enableLinkLayerStatsCollection(true).isOk()); - - // Retrieve link layer stats. - StaLinkLayerStats link_layer_stats = {}; - EXPECT_TRUE(wifi_sta_iface_->getLinkLayerStats(&link_layer_stats).isOk()); - EXPECT_GT(link_layer_stats.timeStampInMs, 0); - - // Try to create a 2nd iface. If successful, it should fill the duty cycle field. - std::shared_ptr iface; - auto status = createStaIface(&iface); - if (status.isOk()) { - EXPECT_GT(link_layer_stats.iface.timeSliceDutyCycleInPercent, 0); - } - - // Disable link layer stats collection. - EXPECT_TRUE(wifi_sta_iface_->disableLinkLayerStatsCollection().isOk()); -} - -/* - * SetMacAddress - * Ensures that calls to setMacAddress will return successfully. - */ -TEST_P(WifiStaIfaceAidlTest, SetMacAddress) { - std::array mac = {0x12, 0x22, 0x33, 0x52, 0x10, 0x41}; - EXPECT_TRUE(wifi_sta_iface_->setMacAddress(mac).isOk()); -} - -/* - * SetScanMode - */ -TEST_P(WifiStaIfaceAidlTest, SetScanMode) { - auto status = wifi_sta_iface_->setScanMode(true); - EXPECT_TRUE(status.isOk() || checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - - status = wifi_sta_iface_->setScanMode(false); - EXPECT_TRUE(status.isOk() || checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); -} - -/* - * LinkLayerStatsCollection - */ -TEST_P(WifiStaIfaceAidlTest, LinkLayerStatsCollection) { - if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::LINK_LAYER_STATS)) { - GTEST_SKIP() << "Link layer stats collection is not supported."; - } - - // Enable link layer stats collection. - EXPECT_TRUE(wifi_sta_iface_->enableLinkLayerStatsCollection(true).isOk()); - - // Retrieve link layer stats. - StaLinkLayerStats link_layer_stats = {}; - EXPECT_TRUE(wifi_sta_iface_->getLinkLayerStats(&link_layer_stats).isOk()); - - // Disable link layer stats collection. - EXPECT_TRUE(wifi_sta_iface_->disableLinkLayerStatsCollection().isOk()); -} - -/* - * RSSIMonitoring - * Ensures that calls to startRssiMonitoring and stopRssiMonitoring will fail - * if the device is not connected to an AP. - */ -TEST_P(WifiStaIfaceAidlTest, RSSIMonitoring) { - if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::RSSI_MONITOR)) { - GTEST_SKIP() << "RSSI monitoring is not supported."; - } - - const int cmd = 1; - const int maxRssi = -50; - const int minRssi = -90; - // Expected to fail because device is not connected to an AP. - EXPECT_FALSE(wifi_sta_iface_->startRssiMonitoring(cmd, maxRssi, minRssi).isOk()); - EXPECT_FALSE(wifi_sta_iface_->stopRssiMonitoring(cmd).isOk()); -} - -/* - * RoamingControl - */ -TEST_P(WifiStaIfaceAidlTest, RoamingControl) { - if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::CONTROL_ROAMING)) { - GTEST_SKIP() << "Roaming control is not supported."; - } - - // Retrieve roaming capabilities. - StaRoamingCapabilities caps = {}; - EXPECT_TRUE(wifi_sta_iface_->getRoamingCapabilities(&caps).isOk()); - - // Set up roaming configuration based on roaming capabilities. - StaRoamingConfig roaming_config = {}; - if (caps.maxBlocklistSize > 0) { - MacAddress block_list_entry; - block_list_entry.data = std::array{{0x11, 0x22, 0x33, 0x44, 0x55, 0x66}}; - roaming_config.bssidBlocklist = {block_list_entry}; - } - if (caps.maxAllowlistSize > 0) { - Ssid allow_list_entry = {}; - allow_list_entry.data = std::array{{0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC}}; - roaming_config.ssidAllowlist = {allow_list_entry}; - } - - // Configure roaming. - EXPECT_TRUE(wifi_sta_iface_->configureRoaming(roaming_config).isOk()); - - // Enable roaming. - EXPECT_TRUE(wifi_sta_iface_->setRoamingState(StaRoamingState::ENABLED).isOk()); -} - -/* - * EnableNDOffload - */ -TEST_P(WifiStaIfaceAidlTest, EnableNDOffload) { - if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::ND_OFFLOAD)) { - GTEST_SKIP() << "ND offload is not supported."; - } - EXPECT_TRUE(wifi_sta_iface_->enableNdOffload(true).isOk()); -} - -/* - * PacketFateMonitoring - */ -TEST_P(WifiStaIfaceAidlTest, PacketFateMonitoring) { - if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::DEBUG_PACKET_FATE)) { - GTEST_SKIP() << "Packet fate monitoring is not supported."; - } - - // Start packet fate monitoring. - EXPECT_TRUE(wifi_sta_iface_->startDebugPacketFateMonitoring().isOk()); - - // Retrieve packets. - std::vector rx_reports; - std::vector tx_reports; - EXPECT_TRUE(wifi_sta_iface_->getDebugRxPacketFates(&rx_reports).isOk()); - EXPECT_TRUE(wifi_sta_iface_->getDebugTxPacketFates(&tx_reports).isOk()); -} - -GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiStaIfaceAidlTest); -INSTANTIATE_TEST_SUITE_P(WifiTest, WifiStaIfaceAidlTest, - testing::ValuesIn(android::getAidlHalInstanceNames(IWifi::descriptor)), - android::PrintInstanceNameToString); - -int main(int argc, char** argv) { - ::testing::InitGoogleTest(&argc, argv); - android::ProcessState::self()->setThreadPoolMaxThreadCount(1); - android::ProcessState::self()->startThreadPool(); - return RUN_ALL_TESTS(); -} diff --git a/wifi/apex/Android.bp b/wifi/apex/Android.bp index e1fefb9575..0afb96b85d 100644 --- a/wifi/apex/Android.bp +++ b/wifi/apex/Android.bp @@ -15,7 +15,7 @@ android_app_certificate { genrule { name: "gen-android.hardware.wifi.rc", - srcs: [":default-android.hardware.wifi-service.rc"], + srcs: [":default-android.hardware.wifi@1.0-service.rc"], out: ["com.android.hardware.wifi-service.rc"], cmd: "sed -e 's@/vendor/bin/@/apex/com.android.hardware.wifi/bin/@' $(in) > $(out)", } @@ -28,7 +28,7 @@ prebuilt_etc { prebuilt_etc { name: "com.android.hardware.wifi.xml", - src: ":default-android.hardware.wifi-service.xml", + src: ":default-android.hardware.wifi@1.0-service.xml", installable: false, } @@ -43,13 +43,13 @@ apex { updatable: false, soc_specific: true, binaries: [ - "android.hardware.wifi-service", + "android.hardware.wifi@1.0-service", ], prebuilts: [ "com.android.hardware.wifi.rc", "com.android.hardware.wifi.xml", ], overrides: [ - "android.hardware.wifi-service", + "android.hardware.wifi@1.0-service", ], } diff --git a/wifi/apex/file_contexts b/wifi/apex/file_contexts index 6368729c9a..812d51db58 100644 --- a/wifi/apex/file_contexts +++ b/wifi/apex/file_contexts @@ -1,3 +1,3 @@ (/.*)? u:object_r:vendor_file:s0 -/bin/hw/android\.hardware\.wifi-service u:object_r:hal_wifi_default_exec:s0 +/bin/hw/android\.hardware\.wifi@1.0-service u:object_r:hal_wifi_default_exec:s0 From fe0d53312cb599f313f12c6c275ece8612ef6fa4 Mon Sep 17 00:00:00 2001 From: Gaurav Bhola Date: Thu, 1 Dec 2022 15:53:26 -0800 Subject: [PATCH 432/998] Add 2 new properties in VHAL for Special Input handling on passenger displays - HW_KEY_INPUT_V2: A per seat property to inject the h/w key events like HOME, BACK, VOLUME etc - HW_MOTION_INPUT: A per seat property to inject the h/w motion events i.e. motion events arising from mouse, trackpads etc. Bug: 260000521 Test: Builds successfully Change-Id: I1b49823769f4b5a2bdcc94e58c6d18c7332f5a28 --- .../automotive/vehicle/VehicleDisplay.aidl | 3 + .../VehicleHwMotionButtonStateFlag.aidl | 44 +++++++++ .../vehicle/VehicleHwMotionInputAction.aidl | 50 +++++++++++ .../vehicle/VehicleHwMotionInputSource.aidl | 53 +++++++++++ .../vehicle/VehicleHwMotionToolType.aidl | 42 +++++++++ .../automotive/vehicle/VehicleProperty.aidl | 2 + .../automotive/vehicle/VehicleDisplay.aidl | 16 ++++ .../VehicleHwMotionButtonStateFlag.aidl | 53 +++++++++++ .../vehicle/VehicleHwMotionInputAction.aidl | 77 ++++++++++++++++ .../vehicle/VehicleHwMotionInputSource.aidl | 89 +++++++++++++++++++ .../vehicle/VehicleHwMotionToolType.aidl | 45 ++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 56 ++++++++++++ .../cpp/AccessForVehicleProperty.h | 2 + .../cpp/ChangeModeForVehicleProperty.h | 2 + .../java/AccessForVehicleProperty.java | 2 + .../java/ChangeModeForVehicleProperty.java | 2 + 16 files changed, 538 insertions(+) create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionInputAction.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionInputSource.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionToolType.aidl create mode 100644 automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl create mode 100644 automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionInputAction.aidl create mode 100644 automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionInputSource.aidl create mode 100644 automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionToolType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleDisplay.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleDisplay.aidl index 5aeafa4676..be335ec7e7 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleDisplay.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleDisplay.aidl @@ -36,4 +36,7 @@ package android.hardware.automotive.vehicle; enum VehicleDisplay { MAIN = 0, INSTRUMENT_CLUSTER = 1, + HUD = 2, + INPUT = 3, + AUXILIARY = 4, } diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl new file mode 100644 index 0000000000..a7fee0806c --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleHwMotionButtonStateFlag { + BUTTON_PRIMARY = 1, + BUTTON_SECONDARY = 2, + BUTTON_TERTIARY = 4, + BUTTON_BACK = 8, + BUTTON_FORWARD = 16, + BUTTON_STYLUS_PRIMARY = 32, + BUTTON_STYLUS_SECONDARY = 64, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionInputAction.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionInputAction.aidl new file mode 100644 index 0000000000..db4b41eb9d --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionInputAction.aidl @@ -0,0 +1,50 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleHwMotionInputAction { + ACTION_DOWN = 0, + ACTION_UP = 1, + ACTION_MOVE = 2, + ACTION_CANCEL = 3, + ACTION_OUTSIDE = 4, + ACTION_POINTER_DOWN = 5, + ACTION_POINTER_UP = 6, + ACTION_HOVER_MOVE = 7, + ACTION_SCROLL = 8, + ACTION_HOVER_ENTER = 9, + ACTION_HOVER_EXIT = 10, + ACTION_BUTTON_PRESS = 11, + ACTION_BUTTON_RELEASE = 12, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionInputSource.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionInputSource.aidl new file mode 100644 index 0000000000..88c7873a43 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionInputSource.aidl @@ -0,0 +1,53 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleHwMotionInputSource { + SOURCE_UNKNOWN = 0, + SOURCE_KEYBOARD = 1, + SOURCE_DPAD = 2, + SOURCE_GAMEPAD = 3, + SOURCE_TOUCHSCREEN = 4, + SOURCE_MOUSE = 5, + SOURCE_STYLUS = 6, + SOURCE_BLUETOOTH_STYLUS = 7, + SOURCE_TRACKBALL = 8, + SOURCE_MOUSE_RELATIVE = 9, + SOURCE_TOUCHPAD = 10, + SOURCE_TOUCH_NAVIGATION = 11, + SOURCE_ROTARY_ENCODER = 12, + SOURCE_JOYSTICK = 13, + SOURCE_HDMI = 14, + SOURCE_SENSOR = 15, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionToolType.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionToolType.aidl new file mode 100644 index 0000000000..2b3bc7f157 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionToolType.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleHwMotionToolType { + TOOL_TYPE_UNKNOWN = 0, + TOOL_TYPE_FINGER = 1, + TOOL_TYPE_STYLUS = 2, + TOOL_TYPE_MOUSE = 3, + TOOL_TYPE_ERASER = 4, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 24fd518b38..dfd18b6cbb 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -114,6 +114,8 @@ enum VehicleProperty { AP_POWER_BOOTUP_REASON = 289409538, DISPLAY_BRIGHTNESS = 289409539, HW_KEY_INPUT = 289475088, + HW_KEY_INPUT_V2 = 367004177, + HW_MOTION_INPUT = 367004178, HW_ROTARY_INPUT = 289475104, HW_CUSTOM_INPUT = 289475120, DOOR_POS = 373295872, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleDisplay.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleDisplay.aidl index 1759a90e51..6642eee501 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleDisplay.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleDisplay.aidl @@ -23,5 +23,21 @@ enum VehicleDisplay { * The primary Android display (for example, center console) */ MAIN = 0, + /** + * Instrument cluster display. This may exist only for driver + */ INSTRUMENT_CLUSTER = 1, + + /** + * Head Up Display. This may exist only for driver + */ + HUD = 2, + /** + * Dedicated display for showing IME for {@code MAIN} + */ + INPUT = 3, + /** + * Auxiliary display which can provide additional screen for {@code MAIN} display + */ + AUXILIARY = 4, } diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl new file mode 100644 index 0000000000..5313a55b12 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl @@ -0,0 +1,53 @@ +/* + * 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. + */ + +package android.hardware.automotive.vehicle; + +/** + * See {@code android.view.MotionEvent#getButtonState()} for more details. + */ +@VintfStability +@Backing(type="int") +enum VehicleHwMotionButtonStateFlag { + /** + * Button state primary + */ + BUTTON_PRIMARY = 0x0001, + /** + * Button state secondary + */ + BUTTON_SECONDARY = 0x0002, + /** + * Button state tertiary + */ + BUTTON_TERTIARY = 0x0004, + /** + * Button state back + */ + BUTTON_BACK = 0x0008, + /** + * Button state forward + */ + BUTTON_FORWARD = 0x0010, + /** + * Button state stylus primary + */ + BUTTON_STYLUS_PRIMARY = 0x0020, + /** + * Button state stylus secondary + */ + BUTTON_STYLUS_SECONDARY = 0x0040, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionInputAction.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionInputAction.aidl new file mode 100644 index 0000000000..d80119a1b9 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionInputAction.aidl @@ -0,0 +1,77 @@ +/* + * 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. + */ + +package android.hardware.automotive.vehicle; + +/** + * See {@code android.view.MotionEvent#ACTION_*} fields for more details. + */ +@VintfStability +@Backing(type="int") +enum VehicleHwMotionInputAction { + /** + * Motion down + */ + ACTION_DOWN = 0, + /** + * Motion up + */ + ACTION_UP = 1, + /** + * Motion move + */ + ACTION_MOVE = 2, + /** + * Motion cancel + */ + ACTION_CANCEL = 3, + /** + * Motion outside + */ + ACTION_OUTSIDE = 4, + /** + * Motion pointer down + */ + ACTION_POINTER_DOWN = 5, + /** + * Motion pointer up + */ + ACTION_POINTER_UP = 6, + /** + * Motion hover move + */ + ACTION_HOVER_MOVE = 7, + /** + * Motion scroll + */ + ACTION_SCROLL = 8, + /** + * Motion hover enter + */ + ACTION_HOVER_ENTER = 9, + /** + * Motion hover exit + */ + ACTION_HOVER_EXIT = 10, + /** + * Motion button press + */ + ACTION_BUTTON_PRESS = 11, + /** + * Motion button release + */ + ACTION_BUTTON_RELEASE = 12, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionInputSource.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionInputSource.aidl new file mode 100644 index 0000000000..fb799838d4 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionInputSource.aidl @@ -0,0 +1,89 @@ +/* + * 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. + */ + +package android.hardware.automotive.vehicle; + +/** + * See {@code android.view.InputDevice#SOURCE_*} for more details. + */ +@VintfStability +@Backing(type="int") +enum VehicleHwMotionInputSource { + /** + * Unknown source + */ + SOURCE_UNKNOWN = 0, + /** + * Source keyboard + */ + SOURCE_KEYBOARD = 1, + /** + * Source dpad + */ + SOURCE_DPAD = 2, + /** + * Source game pad + */ + SOURCE_GAMEPAD = 3, + /** + * Source touch screen + */ + SOURCE_TOUCHSCREEN = 4, + /** + * Source mouse + */ + SOURCE_MOUSE = 5, + /** + * Source stylus + */ + SOURCE_STYLUS = 6, + /** + * Source bluetooth stylus + */ + SOURCE_BLUETOOTH_STYLUS = 7, + /** + * Source trackball + */ + SOURCE_TRACKBALL = 8, + /** + * Source mouse relative + */ + SOURCE_MOUSE_RELATIVE = 9, + /** + * Source touchpad + */ + SOURCE_TOUCHPAD = 10, + /** + * Source touch navigation + */ + SOURCE_TOUCH_NAVIGATION = 11, + /** + * Source rotary encoder + */ + SOURCE_ROTARY_ENCODER = 12, + /** + * Source joystick + */ + SOURCE_JOYSTICK = 13, + /** + * Source hdmi + */ + SOURCE_HDMI = 14, + /** + * Source sensor + */ + SOURCE_SENSOR = 15, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionToolType.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionToolType.aidl new file mode 100644 index 0000000000..08c9aed606 --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionToolType.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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.hardware.automotive.vehicle; + +/** + * See {@code android.view.MotionEvent#TOOL_TYPE_*} for more details. + */ +@VintfStability +@Backing(type="int") +enum VehicleHwMotionToolType { + /** + * Unknown type such as for a trackballl or other non-pointing device + */ + TOOL_TYPE_UNKNOWN = 0, + /** + * Finger type + */ + TOOL_TYPE_FINGER = 1, + /** + * Stylus type + */ + TOOL_TYPE_STYLUS = 2, + /** + * Mouse type + */ + TOOL_TYPE_MOUSE = 3, + /** + * Eraser type + */ + TOOL_TYPE_ERASER = 4, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 51d5bbdf87..a9d3c40d44 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1227,6 +1227,62 @@ enum VehicleProperty { */ HW_KEY_INPUT = 0x0A10 + 0x10000000 + 0x01000000 + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC + /** + * Property to feed H/W input events to android + * + * int32array[0]: target display defined by VehicleDisplay like VehicleDisplay::MAIN, + * VehicleDisplay::INSTRUMENT_CLUSTER, VehicleDisplay::AUX + * int32array[1]: key code, must use standard android key code like KEYCODE_HOME, KEYCODE_BACK + * int32array[2]: action defined in VehicleHwKeyInputAction like + * VehicleHwKeyInputAction::ACTION_UP, VehicleHwKeyInputAction::ACTION_UP + * int32array[3]: repeat count of the event. For key down events, this is the repeat count + * with the first down starting at 0 and counting up from there. For key up + * events, this is always equal to 0 + * + * int64array[0]: down time, elapsed nanoseconds since boot. Denotes the time of the most + * recent key down event. For the down event, it will be the event time of the + * down event itself + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @config_flags + */ + HW_KEY_INPUT_V2 = + 0x0A11 + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.MIXED, + /** + * Property to feed H/W input events to android + * + * int32array[0]: target display defined by VehicleDisplay like VehicleDisplay::MAIN, + * VehicleDisplay::INSTRUMENT_CLUSTER, VehicleDisplay::AUX + * int32array[1]: input type defined in VehicleHwMotionInputSource like + * VehicleHwMotionInputSource::SOURCE_KEYBOARD, + * VehicleHwMotionInputSource::SOURCE_DPAD + * int32array[2]: action code defined in VehicleHwMotionInputAction like + * VehicleHwMotionInputAction::ACTION_UP, VehicleHwMotionInputAction::ACTION_DOWN + * int32array[3]: button state flag defined in VehicleHwMotionButtonStateFlag like + * VehicleHwMotionButtonStateFlag::BUTTON_PRIMARY, + * VehicleHwMotionButtonStateFlag::BUTTON_SECONDARY + * int32array[4]: pointer events count, N. N must be a positive integer + * int32array[5:5+N-1]: pointer id, length N + * int32array[5+N:5+2*N-1] : tool type, length N. As defined in VehicleHwMotionToolType like + * VehicleHwMotionToolType::TOOL_TYPE_FINGER, + * VehicleHwMotionToolType::TOOL_TYPE_STYLUS + * + * floatArray[0:N-1] : x data, length N + * floatArray[N:2*N-1] : y data, length N + * floatArray[2*N:3*N-1] : pressure data, length N + * floatArray[3*N:4*N-1] : size data, length N + * + * int64array[0]: down time, elapsed nanoseconds since boot. Denotes the time when the user + * originally pressed down to start a stream of position events. For the down + * event, it will be the event time of the down event itself + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @config_flags + */ + HW_MOTION_INPUT = + 0x0A12 + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.MIXED, /** * Property to feed H/W rotary events to android * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index d5182dd20a..b761342e15 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -114,6 +114,8 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::AP_POWER_BOOTUP_REASON, VehiclePropertyAccess::READ}, {VehicleProperty::DISPLAY_BRIGHTNESS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HW_KEY_INPUT, VehiclePropertyAccess::READ}, + {VehicleProperty::HW_KEY_INPUT_V2, VehiclePropertyAccess::READ}, + {VehicleProperty::HW_MOTION_INPUT, VehiclePropertyAccess::READ}, {VehicleProperty::HW_ROTARY_INPUT, VehiclePropertyAccess::READ}, {VehicleProperty::HW_CUSTOM_INPUT, VehiclePropertyAccess::READ}, {VehicleProperty::DOOR_POS, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 47bad2c936..af26582738 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -114,6 +114,8 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::AP_POWER_BOOTUP_REASON, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::DISPLAY_BRIGHTNESS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HW_KEY_INPUT, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HW_KEY_INPUT_V2, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HW_MOTION_INPUT, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HW_ROTARY_INPUT, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HW_CUSTOM_INPUT, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::DOOR_POS, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 85a62d3d50..60d17fa890 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -106,6 +106,8 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.AP_POWER_BOOTUP_REASON, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.DISPLAY_BRIGHTNESS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HW_KEY_INPUT, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HW_KEY_INPUT_V2, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HW_MOTION_INPUT, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.HW_ROTARY_INPUT, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.HW_CUSTOM_INPUT, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.DOOR_POS, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 46b9663452..047665f6c4 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -106,6 +106,8 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.AP_POWER_BOOTUP_REASON, VehiclePropertyChangeMode.STATIC), Map.entry(VehicleProperty.DISPLAY_BRIGHTNESS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HW_KEY_INPUT, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HW_KEY_INPUT_V2, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HW_MOTION_INPUT, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HW_ROTARY_INPUT, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HW_CUSTOM_INPUT, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.DOOR_POS, VehiclePropertyChangeMode.ON_CHANGE), From d078837144dce668caca4eb51786bd936268227b Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Thu, 1 Dec 2022 13:55:10 -0800 Subject: [PATCH 433/998] Fix FakeUserHal issues. FakeuserHal was not working and this CL fixes two issues. One is the fake property value's timestamp is by default 0 which cause the write to property store failed. The second is that areaId needs to be set to 0 when responding to the client. Test: atest FakeVehicleHardwareTest test on gcar_emu adb shell cmd car_service get-initial-user-info COLD_BOOT adb shell dumpsys android.hardware.automotive.vehicle.IVehicle/default --set 299896583 -a 1 -i 666 1 11 adb shell cmd car_service get-initial-user-info COLD_BOOT Bug: 260934188 Change-Id: I61d895a15d21308700849acacf39057b1845430f --- .../impl/fake_impl/hardware/src/FakeVehicleHardware.cpp | 6 +++++- .../fake_impl/hardware/test/FakeVehicleHardwareTest.cpp | 6 +++++- .../vehicle/aidl/impl/fake_impl/userhal/src/FakeUserHal.cpp | 3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index d87e5aaaef..0a502c31ab 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -320,7 +320,11 @@ VhalResult FakeVehicleHardware::setUserHalProp(const VehiclePropValue& val if (updatedValue != nullptr) { ALOGI("onSetProperty(): updating property returned by HAL: %s", updatedValue->toString().c_str()); - if (auto writeResult = mServerSidePropStore->writeValue(std::move(result.value())); + // Update timestamp otherwise writeValue might fail because the timestamp is outdated. + updatedValue->timestamp = elapsedRealtimeNano(); + if (auto writeResult = mServerSidePropStore->writeValue( + std::move(result.value()), + /*updateStatus=*/true, VehiclePropertyStore::EventMode::ALWAYS); !writeResult.ok()) { return StatusError(getErrorCode(writeResult)) << "failed to write value into property store, error: " diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp index c230c51cd0..3f97a4df70 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp @@ -1223,6 +1223,8 @@ TEST_F(FakeVehicleHardwareTest, testSwitchUser) { ASSERT_EQ(events.size(), static_cast(1)); events[0].timestamp = 0; + // The returned event will have area ID 0. + valueToSet.areaId = 0; ASSERT_EQ(events[0], valueToSet); // Try to get switch_user again, should return default value. @@ -1277,6 +1279,8 @@ TEST_F(FakeVehicleHardwareTest, testCreateUser) { auto events = getChangedProperties(); ASSERT_EQ(events.size(), static_cast(1)); events[0].timestamp = 0; + // The returned event will have area ID 0. + valueToSet.areaId = 0; EXPECT_EQ(events[0], valueToSet); // Try to get create_user again, should return default value. @@ -1330,7 +1334,7 @@ TEST_F(FakeVehicleHardwareTest, testInitialUserInfo) { ASSERT_EQ(events.size(), static_cast(1)); events[0].timestamp = 0; EXPECT_EQ(events[0], (VehiclePropValue{ - .areaId = 1, + .areaId = 0, .prop = toInt(VehicleProperty::INITIAL_USER_INFO), .value.int32Values = {3, 1, 11}, })); diff --git a/automotive/vehicle/aidl/impl/fake_impl/userhal/src/FakeUserHal.cpp b/automotive/vehicle/aidl/impl/fake_impl/userhal/src/FakeUserHal.cpp index 7748fb6618..91318be8d7 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/userhal/src/FakeUserHal.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/userhal/src/FakeUserHal.cpp @@ -328,6 +328,9 @@ FakeUserHal::ValueResultType FakeUserHal::sendUserHalResponse( << "invalid action on lshal response: " << response->toString(); } + // Update area ID to 0 since this is a global property (and the area ID was only set to emulate + // the request id behavior). + response->areaId = 0; ALOGD("updating property to: %s", response->toString().c_str()); return response; } From d9bbd44bf31a09c013fadd9d5a0dfae65dc54a3d Mon Sep 17 00:00:00 2001 From: arunvoddu Date: Tue, 15 Nov 2022 08:39:26 +0000 Subject: [PATCH 434/998] HAL changes to PrimaryImei feature Bug: 184001777 Test: Build successfully Change-Id: I54c35d9bebd32180583241bfba4d2fd93f85381d --- .../hardware/radio/modem/IRadioModem.aidl | 4 ++ .../radio/modem/IRadioModemResponse.aidl | 4 ++ .../hardware/radio/modem/ImeiInfo.aidl | 45 +++++++++++++++ .../hardware/radio/modem/IRadioModem.aidl | 10 ++++ .../radio/modem/IRadioModemResponse.aidl | 19 +++++++ .../hardware/radio/modem/ImeiInfo.aidl | 55 +++++++++++++++++++ .../include/libradiocompat/RadioModem.h | 1 + .../libradiocompat/modem/RadioModem.cpp | 9 ++- radio/aidl/vts/radio_modem_response.cpp | 7 +++ radio/aidl/vts/radio_modem_test.cpp | 19 +++++++ radio/aidl/vts/radio_modem_utils.h | 4 ++ 11 files changed, 176 insertions(+), 1 deletion(-) create mode 100644 radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ImeiInfo.aidl create mode 100644 radio/aidl/android/hardware/radio/modem/ImeiInfo.aidl diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModem.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModem.aidl index 74dc39d99a..8546be789b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModem.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModem.aidl @@ -36,6 +36,9 @@ package android.hardware.radio.modem; interface IRadioModem { oneway void enableModem(in int serial, in boolean on); oneway void getBasebandVersion(in int serial); + /** + * @deprecated use getImei(int serial) + */ oneway void getDeviceIdentity(in int serial); oneway void getHardwareConfig(in int serial); oneway void getModemActivityInfo(in int serial); @@ -60,4 +63,5 @@ interface IRadioModem { oneway void setRadioCapability(in int serial, in android.hardware.radio.modem.RadioCapability rc); oneway void setRadioPower(in int serial, in boolean powerOn, in boolean forEmergencyCall, in boolean preferredForEmergencyCall); oneway void setResponseFunctions(in android.hardware.radio.modem.IRadioModemResponse radioModemResponse, in android.hardware.radio.modem.IRadioModemIndication radioModemIndication); + oneway void getImei(in int serial); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModemResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModemResponse.aidl index af8bbe1282..5955439666 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModemResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/IRadioModemResponse.aidl @@ -37,6 +37,9 @@ interface IRadioModemResponse { oneway void acknowledgeRequest(in int serial); oneway void enableModemResponse(in android.hardware.radio.RadioResponseInfo info); oneway void getBasebandVersionResponse(in android.hardware.radio.RadioResponseInfo info, in String version); + /** + * @deprecated use getImeiResponse(RadioResponseInfo responseInfo, ImeiInfo imeiInfo) + */ oneway void getDeviceIdentityResponse(in android.hardware.radio.RadioResponseInfo info, in String imei, in String imeisv, in String esn, in String meid); oneway void getHardwareConfigResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.modem.HardwareConfig[] config); oneway void getModemActivityInfoResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.modem.ActivityStatsInfo activityInfo); @@ -59,4 +62,5 @@ interface IRadioModemResponse { oneway void sendDeviceStateResponse(in android.hardware.radio.RadioResponseInfo info); oneway void setRadioCapabilityResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.modem.RadioCapability rc); oneway void setRadioPowerResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void getImeiResponse(in android.hardware.radio.RadioResponseInfo responseInfo, in @nullable android.hardware.radio.modem.ImeiInfo imeiInfo); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ImeiInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ImeiInfo.aidl new file mode 100644 index 0000000000..dda706258b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ImeiInfo.aidl @@ -0,0 +1,45 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.modem; +@JavaDerive(toString=true) @VintfStability +parcelable ImeiInfo { + @Backing(type="int") @VintfStability + enum ImeiType { + PRIMARY = 1, + SECONDARY = 2, + } + ImeiType type; + String imei; + String svn; +} \ No newline at end of file diff --git a/radio/aidl/android/hardware/radio/modem/IRadioModem.aidl b/radio/aidl/android/hardware/radio/modem/IRadioModem.aidl index a5d98d3e25..2011c53e13 100644 --- a/radio/aidl/android/hardware/radio/modem/IRadioModem.aidl +++ b/radio/aidl/android/hardware/radio/modem/IRadioModem.aidl @@ -67,6 +67,7 @@ oneway interface IRadioModem { * @param serial Serial number of request. * * Response function is IRadioModemResponse.getDeviceIdentityResponse() + * @deprecated use getImei(int serial) */ void getDeviceIdentity(in int serial); @@ -235,4 +236,13 @@ oneway interface IRadioModem { */ void setResponseFunctions(in IRadioModemResponse radioModemResponse, in IRadioModemIndication radioModemIndication); + + /** + * Request the IMEI associated with the radio. + * + * @param serial : Serial number of request. + * + * Response function is IRadioModemResponse.getImeiResponse() + */ + void getImei(in int serial); } diff --git a/radio/aidl/android/hardware/radio/modem/IRadioModemResponse.aidl b/radio/aidl/android/hardware/radio/modem/IRadioModemResponse.aidl index eca31924fb..fd4bffb659 100644 --- a/radio/aidl/android/hardware/radio/modem/IRadioModemResponse.aidl +++ b/radio/aidl/android/hardware/radio/modem/IRadioModemResponse.aidl @@ -20,6 +20,7 @@ import android.hardware.radio.RadioResponseInfo; import android.hardware.radio.modem.ActivityStatsInfo; import android.hardware.radio.modem.HardwareConfig; import android.hardware.radio.modem.RadioCapability; +import android.hardware.radio.modem.ImeiInfo; /** * Interface declaring response functions to solicited radio requests for modem APIs. @@ -87,6 +88,8 @@ oneway interface IRadioModemResponse { * RadioError:NOT_PROVISIONED * RadioError:NO_RESOURCES * RadioError:CANCELLED + * RadioError:REQUEST_NOT_SUPPORTED + * @deprecated use getImeiResponse(RadioResponseInfo responseInfo, ImeiInfo imeiInfo) */ void getDeviceIdentityResponse(in RadioResponseInfo info, in String imei, in String imeisv, in String esn, in String meid); @@ -250,4 +253,20 @@ oneway interface IRadioModemResponse { * RadioError:NO_RF_CALIBRATION_INFO */ void setRadioPowerResponse(in RadioResponseInfo info); + + /** + * ImeiInfo to encapsulate the IMEI information from modem. When the return error code + * is {@code RadioError:NONE}, {@code imeiInfo} must be non-null, and a valid IMEITYPE, + * IMEI and SVN must be filled in {@code imeiInfo}. When the error code is not + * {@code RadioError:NONE}, {@code imeiInfo} must be {@code null}. + * + * @param responseInfo Response info struct containing response type, serial no. and error + * @param imeiInfo IMEI information + * + * Valid errors returned: + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:MODEM_ERR + */ + void getImeiResponse(in RadioResponseInfo responseInfo, in @nullable ImeiInfo imeiInfo); } diff --git a/radio/aidl/android/hardware/radio/modem/ImeiInfo.aidl b/radio/aidl/android/hardware/radio/modem/ImeiInfo.aidl new file mode 100644 index 0000000000..2d25bb71c1 --- /dev/null +++ b/radio/aidl/android/hardware/radio/modem/ImeiInfo.aidl @@ -0,0 +1,55 @@ +/* + * 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. + */ + +package android.hardware.radio.modem; + +/** + * ImeiInfo to encapsulate the IMEI information from modem + */ + +@VintfStability +@JavaDerive(toString=true) +parcelable ImeiInfo { + + @VintfStability + @Backing(type="int") + /** + * ImeiType enum is used identify the IMEI as primary or secondary as mentioned in GSMA TS.37 + */ + enum ImeiType { + /** + * This is the primary IMEI of the device as mentioned in the GSMA TS.37. In a multi-SIM + * device the modem must set one IMEI with this type as mentioned in GSMA TS37_2.2_REQ_8. + * A single SIM with one IMEI must by default set that IMEI with this type. + */ + PRIMARY = 1, + /** This is not the primary IMEI of the device */ + SECONDARY = 2, + } + + /** Primary or secondary IMEI as mentioned in GSMA spec TS.37 */ + ImeiType type; + /** + * IMEI value, see 3gpp spec 23.003 section 6. Note: This primary IMEI mapping must be + * permanent throughout the lifetime of the device irrespective of the factory data reset, + * SIM activations or swaps. + */ + String imei; + /** + * IMEI software version, see 3gpp spec 23.003 section 6. + */ + String svn; +} \ No newline at end of file diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioModem.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioModem.h index beb1fb0b49..54bedd8141 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioModem.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioModem.h @@ -26,6 +26,7 @@ class RadioModem : public RadioCompatBase, ::ndk::ScopedAStatus enableModem(int32_t serial, bool on) override; ::ndk::ScopedAStatus getBasebandVersion(int32_t serial) override; ::ndk::ScopedAStatus getDeviceIdentity(int32_t serial) override; + ::ndk::ScopedAStatus getImei(int32_t serial) override; ::ndk::ScopedAStatus getHardwareConfig(int32_t serial) override; ::ndk::ScopedAStatus getModemActivityInfo(int32_t serial) override; ::ndk::ScopedAStatus getModemStackStatus(int32_t serial) override; diff --git a/radio/aidl/compat/libradiocompat/modem/RadioModem.cpp b/radio/aidl/compat/libradiocompat/modem/RadioModem.cpp index d28b94041b..f088b10b19 100644 --- a/radio/aidl/compat/libradiocompat/modem/RadioModem.cpp +++ b/radio/aidl/compat/libradiocompat/modem/RadioModem.cpp @@ -15,7 +15,7 @@ */ #include - +#include "commonStructs.h" #include "debug.h" #include "structs.h" @@ -49,6 +49,13 @@ ScopedAStatus RadioModem::getDeviceIdentity(int32_t serial) { return ok(); } +ScopedAStatus RadioModem::getImei(int32_t serial) { + LOG_CALL << serial; + LOG(ERROR) << " getImei is unsupported by HIDL HALs"; + respond()->getImeiResponse(notSupported(serial), {}); + return ok(); +} + ScopedAStatus RadioModem::getHardwareConfig(int32_t serial) { LOG_CALL << serial; mHal1_5->getHardwareConfig(serial); diff --git a/radio/aidl/vts/radio_modem_response.cpp b/radio/aidl/vts/radio_modem_response.cpp index 20b44c5831..050b2c838f 100644 --- a/radio/aidl/vts/radio_modem_response.cpp +++ b/radio/aidl/vts/radio_modem_response.cpp @@ -46,6 +46,13 @@ ndk::ScopedAStatus RadioModemResponse::getDeviceIdentityResponse(const RadioResp return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus RadioModemResponse::getImeiResponse(const RadioResponseInfo& info, + const std::optional& /*imeiInfo*/) { + rspInfo = info; + parent_modem.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + ndk::ScopedAStatus RadioModemResponse::getHardwareConfigResponse( const RadioResponseInfo& info, const std::vector& /*config*/) { rspInfo = info; diff --git a/radio/aidl/vts/radio_modem_test.cpp b/radio/aidl/vts/radio_modem_test.cpp index f88da13af1..c00b238d8e 100644 --- a/radio/aidl/vts/radio_modem_test.cpp +++ b/radio/aidl/vts/radio_modem_test.cpp @@ -187,6 +187,25 @@ TEST_P(RadioModemTest, getDeviceIdentity) { LOG(DEBUG) << "getDeviceIdentity finished"; } +/* + * Test IRadioModem.getImei() for the response returned. + */ +TEST_P(RadioModemTest, getImei) { + LOG(DEBUG) << "getImei"; + serial = GetRandomSerialNumber(); + + radio_modem->getImei(serial); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_modem->rspInfo.type); + EXPECT_EQ(serial, radioRsp_modem->rspInfo.serial); + + if (cardStatus.cardState == CardStatus::STATE_ABSENT) { + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, + {RadioError::NONE, RadioError::EMPTY_RECORD})); + } + LOG(DEBUG) << "getImei finished"; +} + /* * Test IRadioModem.nvReadItem() for the response returned. */ diff --git a/radio/aidl/vts/radio_modem_utils.h b/radio/aidl/vts/radio_modem_utils.h index 49e1891212..d2f5a104bc 100644 --- a/radio/aidl/vts/radio_modem_utils.h +++ b/radio/aidl/vts/radio_modem_utils.h @@ -19,6 +19,7 @@ #include #include #include +#include #include "radio_aidl_hal_utils.h" @@ -52,6 +53,9 @@ class RadioModemResponse : public BnRadioModemResponse { const std::string& esn, const std::string& meid) override; + virtual ndk::ScopedAStatus getImeiResponse(const RadioResponseInfo& info, + const std::optional& config) override; + virtual ndk::ScopedAStatus getHardwareConfigResponse( const RadioResponseInfo& info, const std::vector& config) override; From fb0e9cfe441a38535155a7efe63f6a32d7fdcd4b Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Fri, 2 Dec 2022 08:41:45 +0000 Subject: [PATCH 435/998] Revert "wifi: Get MLO capabilities from chip" This reverts commit 446ac2c2379f1f59133b7d15d2f31f9845c84e9f. Reason for revert: Broken Build 9360556 on git_master on aosp_bramble-userdebug Change-Id: Iedae7c2823439b0151e87910b5de8c3e3302c003 --- .../android/hardware/wifi/IWifiChip.aidl | 1 - .../hardware/wifi/MloCapabilities.aidl | 38 ------------------- .../aidl/android/hardware/wifi/IWifiChip.aidl | 13 ------- .../hardware/wifi/MloCapabilities.aidl | 34 ----------------- 4 files changed, 86 deletions(-) delete mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/MloCapabilities.aidl delete mode 100644 wifi/aidl/android/hardware/wifi/MloCapabilities.aidl diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl index 0eba80399c..647891f7cb 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl @@ -59,7 +59,6 @@ interface IWifiChip { @PropagateAllowBlocking android.hardware.wifi.IWifiStaIface getStaIface(in String ifname); String[] getStaIfaceNames(); android.hardware.wifi.WifiRadioCombinationMatrix getSupportedRadioCombinationsMatrix(); - android.hardware.wifi.MloCapabilities getMloCapabilities(); android.hardware.wifi.WifiUsableChannel[] getUsableChannels(in android.hardware.wifi.WifiBand band, in android.hardware.wifi.WifiIfaceMode ifaceModeMask, in android.hardware.wifi.IWifiChip.UsableChannelFilter filterMask); void registerEventCallback(in android.hardware.wifi.IWifiChipEventCallback callback); void removeApIface(in String ifname); diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/MloCapabilities.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/MloCapabilities.aidl deleted file mode 100644 index a42960f948..0000000000 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/MloCapabilities.aidl +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.wifi; -@VintfStability -parcelable MloCapabilities { - int maxLinkCount; -} diff --git a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl index c4c0260f0a..fe9a6f399b 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl @@ -24,7 +24,6 @@ import android.hardware.wifi.IWifiRttController; import android.hardware.wifi.IWifiStaIface; import android.hardware.wifi.IfaceConcurrencyType; import android.hardware.wifi.IfaceType; -import android.hardware.wifi.MloCapabilities; import android.hardware.wifi.WifiBand; import android.hardware.wifi.WifiDebugHostWakeReasonStats; import android.hardware.wifi.WifiDebugRingBufferStatus; @@ -785,18 +784,6 @@ interface IWifiChip { */ WifiRadioCombinationMatrix getSupportedRadioCombinationsMatrix(); - /** - * Get MLO capabilities supported by this chip. - * - * @return MLO capabilities represented by |MloCapabilities|. - * @throws ServiceSpecificException with one of the following values: - * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|, - * |WifiStatusCode.ERROR_NOT_SUPPORTED|, - * |WifiStatusCode.FAILURE_UNKNOWN| - * - */ - MloCapabilities getMloCapabilities(); - /** * Retrieve a list of usable Wifi channels for the specified band & * operational modes. diff --git a/wifi/aidl/android/hardware/wifi/MloCapabilities.aidl b/wifi/aidl/android/hardware/wifi/MloCapabilities.aidl deleted file mode 100644 index fca101d200..0000000000 --- a/wifi/aidl/android/hardware/wifi/MloCapabilities.aidl +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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. - */ - -package android.hardware.wifi; - -/** - * With MLO, Multi-Link Devices (MLD) can simultaneously use multiple bands - * under different circumstances(e.g. load balancing, data aggregation ..etc.). - * MloCapabilities captures chip capabilities for Multi-link operation. - */ -@VintfStability -parcelable MloCapabilities { - /** - * Maximum number of links used in Multi-Link Operation. The maximum - * number of links used for MLO can be different from the number of - * radios supported by the chip. - * - * This is a static configuration of the chip. - */ - int maxLinkCount; -} From e80aabbc1d4693a5f775eebdcbb211986c77bdcf Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Thu, 1 Dec 2022 22:24:16 +0000 Subject: [PATCH 436/998] Revert "Remove dependencies on the HIDL Vendor HAL from" This reverts commit fc6bd8c564604a27aacfb4c7aea39bb7c12efd64. Reason for revert: Blocking Wembley team Bug: 261042084 Test: Local test as in 261042084#comment8 Change-Id: I9103fa8bdcdea48648574f034c51ea8f2b9c25cc --- wifi/hostapd/aidl/vts/functional/Android.bp | 16 ++- .../functional/VtsHalHostapdTargetTest.cpp | 41 +++--- .../supplicant/aidl/vts/functional/Android.bp | 39 +++++- .../vts/functional/supplicant_test_utils.h | 130 +++--------------- 4 files changed, 88 insertions(+), 138 deletions(-) diff --git a/wifi/hostapd/aidl/vts/functional/Android.bp b/wifi/hostapd/aidl/vts/functional/Android.bp index a9fdec8380..e61d3975bb 100644 --- a/wifi/hostapd/aidl/vts/functional/Android.bp +++ b/wifi/hostapd/aidl/vts/functional/Android.bp @@ -20,10 +20,20 @@ cc_test { "libvndksupport", ], static_libs: [ - "android.hardware.wifi-V1-ndk", "android.hardware.wifi.hostapd-V1-ndk", - "libwifi-system-iface", - "VtsHalWifiTargetTestUtil", + "VtsHalWifiV1_0TargetTestUtil", + "VtsHalWifiV1_5TargetTestUtil", + "VtsHalWifiHostapdV1_0TargetTestUtil", + "android.hardware.wifi.hostapd@1.0", + "android.hardware.wifi.hostapd@1.1", + "android.hardware.wifi.hostapd@1.2", + "android.hardware.wifi.hostapd@1.3", + "android.hardware.wifi@1.0", + "android.hardware.wifi@1.1", + "android.hardware.wifi@1.2", + "android.hardware.wifi@1.3", + "android.hardware.wifi@1.4", + "android.hardware.wifi@1.5", ], test_suites: [ "general-tests", diff --git a/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp b/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp index 65ffa7b59e..bd2649fc50 100644 --- a/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp +++ b/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp @@ -13,7 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include +#include +#include #include #include @@ -23,11 +24,12 @@ #include #include #include +#include +#include +#include +#include +#include -#include "wifi_aidl_test_utils.h" - -using aidl::android::hardware::wifi::IWifi; -using aidl::android::hardware::wifi::IWifiApIface; using aidl::android::hardware::wifi::hostapd::BandMask; using aidl::android::hardware::wifi::hostapd::BnHostapdCallback; using aidl::android::hardware::wifi::hostapd::ChannelBandwidth; @@ -42,8 +44,6 @@ using aidl::android::hardware::wifi::hostapd::NetworkParams; using android::ProcessState; namespace { -const std::string kWifiInstanceNameStr = std::string() + IWifi::descriptor + "/default"; -const char* kWifiInstanceName = kWifiInstanceNameStr.c_str(); const unsigned char kNwSsid[] = {'t', 'e', 's', 't', '1', '2', '3', '4', '5'}; const std::string kPassphrase = "test12345"; const std::string kInvalidMinPassphrase = "test"; @@ -75,13 +75,17 @@ class HostapdAidl : public testing::TestWithParam { "/system/bin/cmd wifi get-softap-supported-features", "wifi_softap_wpa3_sae_supported"); isBridgedSupport = testing::checkSubstringInCommandOutput( - "/system/bin/cmd wifi get-softap-supported-features", - "wifi_softap_bridged_ap_supported"); + "/system/bin/cmd wifi get-softap-supported-features", + "wifi_softap_bridged_ap_supported"); + const std::vector instances = android::hardware::getAllHalInstanceNames( + ::android::hardware::wifi::V1_0::IWifi::descriptor); + EXPECT_NE(0, instances.size()); + wifiInstanceName = instances[0]; } virtual void TearDown() override { - if (getWifi(kWifiInstanceName) != nullptr) { - stopWifiService(kWifiInstanceName); + if (getWifi(wifiInstanceName) != nullptr) { + stopWifi(wifiInstanceName); } hostapd->terminate(); // Wait 3 seconds to allow terminate to complete @@ -89,23 +93,24 @@ class HostapdAidl : public testing::TestWithParam { } std::shared_ptr hostapd; + std::string wifiInstanceName; bool isAcsSupport; bool isWpa3SaeSupport; bool isBridgedSupport; std::string setupApIfaceAndGetName(bool isBridged) { - std::shared_ptr wifi_ap_iface; + android::sp<::android::hardware::wifi::V1_0::IWifiApIface> wifi_ap_iface; if (isBridged) { - wifi_ap_iface = getBridgedWifiApIface(kWifiInstanceName); + wifi_ap_iface = getBridgedWifiApIface_1_5(wifiInstanceName); } else { - wifi_ap_iface = getWifiApIface(kWifiInstanceName); + wifi_ap_iface = getWifiApIface_1_5(wifiInstanceName); } EXPECT_NE(nullptr, wifi_ap_iface.get()); - std::string ap_iface_name; - auto status = wifi_ap_iface->getName(&ap_iface_name); - EXPECT_TRUE(status.isOk()); - return ap_iface_name; + const auto& status_and_name = HIDL_INVOKE(wifi_ap_iface, getName); + EXPECT_EQ(android::hardware::wifi::V1_0::WifiStatusCode::SUCCESS, + status_and_name.first.code); + return status_and_name.second; } IfaceParams getIfaceParamsWithoutAcs(std::string iface_name) { diff --git a/wifi/supplicant/aidl/vts/functional/Android.bp b/wifi/supplicant/aidl/vts/functional/Android.bp index 937fdc765c..b959c7504d 100644 --- a/wifi/supplicant/aidl/vts/functional/Android.bp +++ b/wifi/supplicant/aidl/vts/functional/Android.bp @@ -36,11 +36,20 @@ cc_test { "libvndksupport", ], static_libs: [ - "android.hardware.wifi-V1-ndk", + "android.hardware.wifi@1.0", + "android.hardware.wifi@1.1", + "android.hardware.wifi@1.2", + "android.hardware.wifi@1.3", + "android.hardware.wifi@1.4", + "android.hardware.wifi@1.5", + "android.hardware.wifi.supplicant@1.0", + "android.hardware.wifi.supplicant@1.1", "android.hardware.wifi.supplicant-V2-ndk", "libwifi-system", "libwifi-system-iface", - "VtsHalWifiTargetTestUtil", + "VtsHalWifiV1_0TargetTestUtil", + "VtsHalWifiV1_5TargetTestUtil", + "VtsHalWifiSupplicantV1_0TargetTestUtil", ], test_suites: [ "general-tests", @@ -61,11 +70,20 @@ cc_test { "libvndksupport", ], static_libs: [ - "android.hardware.wifi-V1-ndk", + "android.hardware.wifi@1.0", + "android.hardware.wifi@1.1", + "android.hardware.wifi@1.2", + "android.hardware.wifi@1.3", + "android.hardware.wifi@1.4", + "android.hardware.wifi@1.5", + "android.hardware.wifi.supplicant@1.0", + "android.hardware.wifi.supplicant@1.1", "android.hardware.wifi.supplicant-V2-ndk", "libwifi-system", "libwifi-system-iface", - "VtsHalWifiTargetTestUtil", + "VtsHalWifiV1_0TargetTestUtil", + "VtsHalWifiV1_5TargetTestUtil", + "VtsHalWifiSupplicantV1_0TargetTestUtil", ], test_suites: [ "general-tests", @@ -86,11 +104,20 @@ cc_test { "libvndksupport", ], static_libs: [ - "android.hardware.wifi-V1-ndk", + "android.hardware.wifi@1.0", + "android.hardware.wifi@1.1", + "android.hardware.wifi@1.2", + "android.hardware.wifi@1.3", + "android.hardware.wifi@1.4", + "android.hardware.wifi@1.5", + "android.hardware.wifi.supplicant@1.0", + "android.hardware.wifi.supplicant@1.1", "android.hardware.wifi.supplicant-V2-ndk", "libwifi-system", "libwifi-system-iface", - "VtsHalWifiTargetTestUtil", + "VtsHalWifiV1_0TargetTestUtil", + "VtsHalWifiV1_5TargetTestUtil", + "VtsHalWifiSupplicantV1_0TargetTestUtil", ], test_suites: [ "general-tests", diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h b/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h index 740dc9f7b0..31042a2b7c 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h +++ b/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h @@ -14,18 +14,16 @@ * limitations under the License. */ -#pragma once +#ifndef SUPPLICANT_TEST_UTILS_H +#define SUPPLICANT_TEST_UTILS_H #include -#include #include +#include +#include +#include #include -#include "wifi_aidl_test_utils.h" - -using aidl::android::hardware::wifi::IfaceConcurrencyType; -using aidl::android::hardware::wifi::IWifi; -using aidl::android::hardware::wifi::IWifiChip; using aidl::android::hardware::wifi::supplicant::IfaceInfo; using aidl::android::hardware::wifi::supplicant::ISupplicant; using aidl::android::hardware::wifi::supplicant::ISupplicantP2pIface; @@ -33,90 +31,6 @@ using aidl::android::hardware::wifi::supplicant::ISupplicantStaIface; using aidl::android::hardware::wifi::supplicant::KeyMgmtMask; using android::wifi_system::SupplicantManager; -const std::string kWifiInstanceName = std::string() + IWifi::descriptor + "/default"; - -// Initialize the driver and firmware to STA mode using the vendor HAL. -void initializeDriverAndFirmware(const std::string& wifi_instance_name) { - // Skip if wifi instance is not set. - if (wifi_instance_name == "") { - return; - } - if (getWifi(wifi_instance_name.c_str()) != nullptr) { - std::shared_ptr wifi_chip = getWifiChip(wifi_instance_name.c_str()); - int mode_id; - EXPECT_TRUE(configureChipToSupportConcurrencyType(wifi_chip, IfaceConcurrencyType::STA, - &mode_id)); - } else { - LOG(WARNING) << __func__ << ": Vendor HAL not supported"; - } -} - -// Deinitialize the driver and firmware using the vendor HAL. -void deInitializeDriverAndFirmware(const std::string& wifi_instance_name) { - // Skip if wifi instance is not set. - if (wifi_instance_name == "") { - return; - } - if (getWifi(wifi_instance_name.c_str()) != nullptr) { - stopWifiService(wifi_instance_name.c_str()); - } else { - LOG(WARNING) << __func__ << ": Vendor HAL not supported"; - } -} - -bool waitForSupplicantState(bool is_running) { - SupplicantManager supplicant_manager; - int count = 50; /* wait at most 5 seconds for completion */ - while (count-- > 0) { - if (supplicant_manager.IsSupplicantRunning() == is_running) { - return true; - } - usleep(100000); - } - LOG(ERROR) << "Supplicant not " << is_running ? "running" : "stopped"; - return false; -} - -bool waitForSupplicantStart() { - return waitForSupplicantState(true); -} - -bool waitForSupplicantStop() { - return waitForSupplicantState(false); -} - -bool waitForWifiHalStop(const std::string& wifi_instance_name) { - std::shared_ptr wifi = getWifi(wifi_instance_name.c_str()); - int count = 50; /* wait at most 5 seconds for completion */ - while (count-- > 0) { - if (wifi != nullptr) { - bool started = false; - auto status = wifi->isStarted(&started); - if (status.isOk() && !started) { - return true; - } - } - usleep(100000); - wifi = getWifi(wifi_instance_name.c_str()); - } - LOG(ERROR) << "Wifi HAL was not stopped"; - return false; -} - -bool waitForFrameworkReady() { - int waitCount = 15; - do { - // Check whether package service is ready or not. - if (!testing::checkSubstringInCommandOutput("/system/bin/service check package", - ": not found")) { - return true; - } - LOG(INFO) << "Framework is not ready"; - sleep(1); - } while (waitCount-- > 0); - return false; -} - std::string getStaIfaceName() { std::array buffer; property_get("wifi.interface", buffer.data(), "wlan0"); @@ -129,6 +43,14 @@ std::string getP2pIfaceName() { return std::string(buffer.data()); } +std::string getWifiInstanceName() { + const std::vector instances = + android::hardware::getAllHalInstanceNames( + ::android::hardware::wifi::V1_0::IWifi::descriptor); + EXPECT_NE(0, instances.size()); + return instances.size() != 0 ? instances[0] : ""; +} + bool keyMgmtSupported(std::shared_ptr iface, KeyMgmtMask expected) { KeyMgmtMask caps; @@ -146,33 +68,17 @@ bool isFilsSupported(std::shared_ptr iface) { } void startSupplicant() { - initializeDriverAndFirmware(kWifiInstanceName); + initializeDriverAndFirmware(getWifiInstanceName()); SupplicantManager supplicant_manager; ASSERT_TRUE(supplicant_manager.StartSupplicant()); ASSERT_TRUE(supplicant_manager.IsSupplicantRunning()); } -void stopSupplicantService() { - SupplicantManager supplicant_manager; - ASSERT_TRUE(supplicant_manager.StopSupplicant()); - deInitializeDriverAndFirmware(kWifiInstanceName); - ASSERT_FALSE(supplicant_manager.IsSupplicantRunning()); -} - -bool startWifiFramework() { - std::system("svc wifi enable"); - std::system("cmd wifi set-scan-always-available enabled"); - return waitForSupplicantStart(); // wait for wifi to start. -} - -bool stopWifiFramework(const std::string& wifi_instance_name) { - std::system("svc wifi disable"); - std::system("cmd wifi set-scan-always-available disabled"); - return waitForSupplicantStop() && waitForWifiHalStop(wifi_instance_name); -} +// Wrapper around the implementation in supplicant_hidl_test_util. +void stopSupplicantService() { stopSupplicant(getWifiInstanceName()); } void initializeService() { - ASSERT_TRUE(stopWifiFramework(kWifiInstanceName)); + ASSERT_TRUE(stopWifiFramework(getWifiInstanceName())); std::system("/system/bin/start"); ASSERT_TRUE(waitForFrameworkReady()); stopSupplicantService(); @@ -200,3 +106,5 @@ std::shared_ptr getSupplicant(const char* supplicant_name) { } return supplicant; } + +#endif // SUPPLICANT_TEST_UTILS_H \ No newline at end of file From fd5e65c7c14dafc19729f64711c395f6adf33e55 Mon Sep 17 00:00:00 2001 From: Arthur Ishiguro Date: Tue, 8 Nov 2022 16:49:47 +0000 Subject: [PATCH 437/998] Adds a HAL API to get the list of preloaded nanoapp Bug: 258074235 Test: make android.hardware.contexthub-update-api Test: atest VtsAidlHalContextHubTargetTest Change-Id: Ifdb849d3ccb6a9303c6f561e941c5be9aa13661f --- .../compatibility_matrix.current.xml | 1 + .../android/hardware/contexthub/IContextHub.aidl | 1 + .../android/hardware/contexthub/IContextHub.aidl | 9 +++++++++ contexthub/aidl/default/Android.bp | 4 ++-- contexthub/aidl/default/ContextHub.cpp | 11 +++++++++++ contexthub/aidl/default/contexthub-default.xml | 7 +++++-- .../default/include/contexthub-impl/ContextHub.h | 3 +++ contexthub/aidl/vts/Android.bp | 2 +- .../aidl/vts/VtsAidlHalContextHubTargetTest.cpp | 13 +++++++++++++ 9 files changed, 46 insertions(+), 5 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 4c7ca23c05..f3954738e7 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -206,6 +206,7 @@ android.hardware.contexthub + 2 IContextHub default diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl index f0676bec74..272d76823b 100644 --- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl @@ -45,5 +45,6 @@ interface IContextHub { void sendMessageToHub(in int contextHubId, in android.hardware.contexthub.ContextHubMessage message); void onHostEndpointConnected(in android.hardware.contexthub.HostEndpointInfo hostEndpointInfo); void onHostEndpointDisconnected(char hostEndpointId); + long[] getPreloadedNanoappIds(); const int EX_CONTEXT_HUB_UNSPECIFIED = -1; } diff --git a/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl index 16666efd95..9fa67a5aa1 100644 --- a/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl +++ b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl @@ -21,6 +21,7 @@ import android.hardware.contexthub.ContextHubMessage; import android.hardware.contexthub.HostEndpointInfo; import android.hardware.contexthub.IContextHubCallback; import android.hardware.contexthub.NanoappBinary; +import android.hardware.contexthub.NanoappInfo; import android.hardware.contexthub.Setting; @VintfStability @@ -194,6 +195,14 @@ interface IContextHub { */ void onHostEndpointDisconnected(char hostEndpointId); + /** + * Provides the list of preloaded nanoapp IDs on the system. The output of this API must + * not change. + * + * @return The list of preloaded nanoapp IDs + */ + long[] getPreloadedNanoappIds(); + /** * Error codes that are used as service specific errors with the AIDL return * value EX_SERVICE_SPECIFIC. diff --git a/contexthub/aidl/default/Android.bp b/contexthub/aidl/default/Android.bp index 269057a2a2..6ee7407de8 100644 --- a/contexthub/aidl/default/Android.bp +++ b/contexthub/aidl/default/Android.bp @@ -29,7 +29,7 @@ cc_library_static { shared_libs: [ "libbase", "libbinder_ndk", - "android.hardware.contexthub-V1-ndk", + "android.hardware.contexthub-V2-ndk", ], export_include_dirs: ["include"], srcs: [ @@ -50,7 +50,7 @@ cc_binary { shared_libs: [ "libbase", "libbinder_ndk", - "android.hardware.contexthub-V1-ndk", + "android.hardware.contexthub-V2-ndk", ], static_libs: [ "libcontexthubexampleimpl", diff --git a/contexthub/aidl/default/ContextHub.cpp b/contexthub/aidl/default/ContextHub.cpp index 35e4650ef2..ac1dc46139 100644 --- a/contexthub/aidl/default/ContextHub.cpp +++ b/contexthub/aidl/default/ContextHub.cpp @@ -76,6 +76,17 @@ ScopedAStatus ContextHub::queryNanoapps(int32_t in_contextHubId) { } } +ScopedAStatus ContextHub::getPreloadedNanoappIds(std::vector* out_preloadedNanoappIds) { + if (out_preloadedNanoappIds == nullptr) { + return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + + for (uint64_t i = 0; i < 10; ++i) { + out_preloadedNanoappIds->push_back(i); + } + return ndk::ScopedAStatus::ok(); +} + ScopedAStatus ContextHub::registerCallback(int32_t in_contextHubId, const std::shared_ptr& in_cb) { if (in_contextHubId == kMockHubId) { diff --git a/contexthub/aidl/default/contexthub-default.xml b/contexthub/aidl/default/contexthub-default.xml index e383c50ca0..930f672197 100644 --- a/contexthub/aidl/default/contexthub-default.xml +++ b/contexthub/aidl/default/contexthub-default.xml @@ -1,7 +1,10 @@ android.hardware.contexthub - 1 - IContextHub/default + 2 + + IContextHub + default + diff --git a/contexthub/aidl/default/include/contexthub-impl/ContextHub.h b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h index 03d8432134..4aeb948375 100644 --- a/contexthub/aidl/default/include/contexthub-impl/ContextHub.h +++ b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h @@ -19,6 +19,7 @@ #include #include +#include namespace aidl { namespace android { @@ -37,6 +38,8 @@ class ContextHub : public BnContextHub { int32_t in_transactionId) override; ::ndk::ScopedAStatus onSettingChanged(Setting in_setting, bool in_enabled) override; ::ndk::ScopedAStatus queryNanoapps(int32_t in_contextHubId) override; + ::ndk::ScopedAStatus getPreloadedNanoappIds( + std::vector* out_preloadedNanoappIds) override; ::ndk::ScopedAStatus registerCallback( int32_t in_contextHubId, const std::shared_ptr& in_cb) override; ::ndk::ScopedAStatus sendMessageToHub(int32_t in_contextHubId, diff --git a/contexthub/aidl/vts/Android.bp b/contexthub/aidl/vts/Android.bp index 673eac0b93..1534b40876 100644 --- a/contexthub/aidl/vts/Android.bp +++ b/contexthub/aidl/vts/Android.bp @@ -32,7 +32,7 @@ cc_test { "libbinder", ], static_libs: [ - "android.hardware.contexthub-V1-cpp", + "android.hardware.contexthub-V2-cpp", "VtsHalContexthubUtils", ], test_suites: [ diff --git a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp index 3c01c6bac2..8104f27f5b 100644 --- a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp +++ b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp @@ -156,6 +156,19 @@ TEST_P(ContextHubAidl, TestQueryApps) { } } +// Calls getPreloadedNanoapps() and verifies there are preloaded nanoapps +TEST_P(ContextHubAidl, TestGetPreloadedNanoapps) { + std::vector preloadedNanoappIds; + Status status = contextHub->getPreloadedNanoappIds(&preloadedNanoappIds); + if (status.exceptionCode() == Status::EX_UNSUPPORTED_OPERATION || + status.transactionError() == android::UNKNOWN_TRANSACTION) { + return; // not supported -> old API; or not implemented + } + + ASSERT_TRUE(status.isOk()); + ASSERT_FALSE(preloadedNanoappIds.empty()); +} + // Helper callback that puts the TransactionResult for the expectedTransactionId into a // promise class TransactionResultCallback : public android::hardware::contexthub::BnContextHubCallback { From 23247c497a570f38e431c1218cf064599af126c5 Mon Sep 17 00:00:00 2001 From: Tyler Trephan Date: Thu, 17 Nov 2022 01:36:55 +0000 Subject: [PATCH 438/998] Added new supportedEnumValues to VehicleAreaConfig.aidl file Test: atest CarPropertyManagerTest JsonConfigLoaderUnitTest Bug: 259476396 Change-Id: Iea031a5b0bca2f9030dbfb2df2fc182cb600a785 --- .../automotive/vehicle/VehicleAreaConfig.aidl | 1 + .../automotive/vehicle/VehicleAreaConfig.aidl | 7 ++ .../JsonConfigLoader/src/JsonConfigLoader.cpp | 8 ++ .../test/JsonConfigLoaderUnitTest.cpp | 83 +++++++++++++++++++ .../impl/utils/common/include/PropertyUtils.h | 1 + 5 files changed, 100 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl index b93a11b60f..6960894f13 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl @@ -41,4 +41,5 @@ parcelable VehicleAreaConfig { long maxInt64Value; float minFloatValue; float maxFloatValue; + @nullable long[] supportedEnumValues; } diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl index b44996dc7e..abd9540876 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl @@ -40,4 +40,11 @@ parcelable VehicleAreaConfig { float minFloatValue; float maxFloatValue; + + /** + * If the property has a @data_enum, then it is possible to specify a supported subset of the + * @data_enum. If the property has a @data_enum and supportedEnumValues is null, then it is + * assumed all @data_enum values are supported unless specified through another mechanism. + */ + @nullable long[] supportedEnumValues; } diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index e4f13e8dc3..20048a245d 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -105,6 +105,7 @@ const std::unordered_map CONSTANTS_BY_NAME = { FAN_DIRECTION_FLOOR | FAN_DIRECTION_DEFROST | FAN_DIRECTION_FACE}, {"FUEL_DOOR_REAR_LEFT", FUEL_DOOR_REAR_LEFT}, {"LIGHT_STATE_ON", LIGHT_STATE_ON}, + {"LIGHT_STATE_OFF", LIGHT_STATE_OFF}, {"LIGHT_SWITCH_OFF", LIGHT_SWITCH_OFF}, {"LIGHT_SWITCH_AUTO", LIGHT_SWITCH_AUTO}, {"MIRROR_DRIVER_LEFT_RIGHT", @@ -460,6 +461,13 @@ void JsonConfigParser::parseAreas(const Json::Value& parentJsonNode, const std:: &areaConfig.minFloatValue, errors); tryParseJsonValueToVariable(jsonAreaConfig, "maxFloatValue", /*optional=*/true, &areaConfig.maxFloatValue, errors); + + std::vector supportedEnumValues; + tryParseJsonArrayToVariable(jsonAreaConfig, "supportedEnumValues", /*optional=*/true, + &supportedEnumValues, errors); + if (!supportedEnumValues.empty()) { + areaConfig.supportedEnumValues = std::move(supportedEnumValues); + } config->config.areaConfigs.push_back(std::move(areaConfig)); RawPropValues areaValue = {}; diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/JsonConfigLoaderUnitTest.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/JsonConfigLoaderUnitTest.cpp index 9ff8c1b250..98826537e7 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/JsonConfigLoaderUnitTest.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/JsonConfigLoaderUnitTest.cpp @@ -616,6 +616,89 @@ TEST_F(JsonConfigLoaderUnitTest, testAreas_FailInvalidTypeForOneAreaValue) { << "Wrong type for DefaultValue for one area must cause error"; } +TEST_F(JsonConfigLoaderUnitTest, testAreas_HandlesNoSupportedEnumValuesDeclared) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::CABIN_LIGHTS_STATE", + "areas": [{ + "areaId": 0, + }] + }] + } + )"); + + auto result = mLoader.loadPropConfig(iss); + ASSERT_TRUE(result.ok()); + + auto configs = result.value(); + ASSERT_EQ(configs.size(), 1u); + + const VehiclePropConfig& config = configs.begin()->second.config; + ASSERT_EQ(config.areaConfigs.size(), 1u); + + const VehicleAreaConfig& areaConfig = config.areaConfigs[0]; + ASSERT_EQ(areaConfig.areaId, 0); + ASSERT_FALSE(areaConfig.supportedEnumValues); +} + +TEST_F(JsonConfigLoaderUnitTest, testAreas_HandlesSupportedEnumValues) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::CABIN_LIGHTS_STATE", + "areas": [{ + "areaId": 0, + "supportedEnumValues": ["Constants::LIGHT_STATE_ON", "Constants::LIGHT_STATE_OFF"] + }] + }] + } + )"); + + auto result = mLoader.loadPropConfig(iss); + ASSERT_TRUE(result.ok()); + + auto configs = result.value(); + ASSERT_EQ(configs.size(), 1u); + + const VehiclePropConfig& config = configs.begin()->second.config; + ASSERT_EQ(config.areaConfigs.size(), 1u); + + const VehicleAreaConfig& areaConfig = config.areaConfigs[0]; + ASSERT_EQ(areaConfig.areaId, 0); + ASSERT_TRUE(areaConfig.supportedEnumValues); + ASSERT_EQ(areaConfig.supportedEnumValues.value().size(), 2u); + ASSERT_EQ(areaConfig.supportedEnumValues.value(), + std::vector({LIGHT_STATE_ON, LIGHT_STATE_OFF})); +} + +TEST_F(JsonConfigLoaderUnitTest, testAreas_HandlesEmptySupportedEnumValues) { + std::istringstream iss(R"( + { + "properties": [{ + "property": "VehicleProperty::CABIN_LIGHTS_STATE", + "areas": [{ + "areaId": 0, + "supportedEnumValues": [] + }] + }] + } + )"); + + auto result = mLoader.loadPropConfig(iss); + ASSERT_TRUE(result.ok()); + + auto configs = result.value(); + ASSERT_EQ(configs.size(), 1u); + + const VehiclePropConfig& config = configs.begin()->second.config; + ASSERT_EQ(config.areaConfigs.size(), 1u); + + const VehicleAreaConfig& areaConfig = config.areaConfigs[0]; + ASSERT_EQ(areaConfig.areaId, 0); + ASSERT_FALSE(areaConfig.supportedEnumValues); +} + } // namespace vehicle } // namespace automotive } // namespace hardware diff --git a/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h b/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h index caf17e8045..bf27c95c94 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h @@ -96,6 +96,7 @@ constexpr int FUEL_DOOR_REAR_LEFT = toInt(propertyutils_impl::PortLocationType:: constexpr int CHARGE_PORT_FRONT_LEFT = toInt(propertyutils_impl::PortLocationType::FRONT_LEFT); constexpr int CHARGE_PORT_REAR_LEFT = toInt(propertyutils_impl::PortLocationType::REAR_LEFT); constexpr int LIGHT_STATE_ON = toInt(propertyutils_impl::VehicleLightState::ON); +constexpr int LIGHT_STATE_OFF = toInt(propertyutils_impl::VehicleLightState::OFF); constexpr int LIGHT_SWITCH_OFF = toInt(propertyutils_impl::VehicleLightSwitch::OFF); constexpr int LIGHT_SWITCH_AUTO = toInt(propertyutils_impl::VehicleLightSwitch::AUTOMATIC); constexpr int WHEEL_FRONT_LEFT = toInt(propertyutils_impl::VehicleAreaWheel::LEFT_FRONT); From 59c2ac021ce426d587bf41a2fe0a0bbf2395a4c2 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Fri, 2 Dec 2022 01:05:20 +0000 Subject: [PATCH 439/998] [UserHal] Fix emulated vhal --user-hal Change vhal so that it prints help message with --help argument. Remove prefixes from dump function. Updated testDumpFakeUserHal. Test: adb shell dumpsys android.hardware.automotive.vehicle.IVehicle/default --help Fixes: 260943479 Change-Id: I5dff80558482108ea1e875154a0c94c8f5cd0b67 --- .../hardware/src/FakeVehicleHardware.cpp | 6 +----- .../hardware/test/FakeVehicleHardwareTest.cpp | 16 +++------------ .../fake_impl/userhal/include/FakeUserHal.h | 2 +- .../fake_impl/userhal/src/FakeUserHal.cpp | 20 +++++++++---------- .../aidl/impl/vhal/src/DefaultVehicleHal.cpp | 2 +- 5 files changed, 15 insertions(+), 31 deletions(-) diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index d87e5aaaef..8f45875733 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -623,11 +623,7 @@ DumpResult FakeVehicleHardware::dump(const std::vector& options) { } else if (EqualsIgnoreCase(option, "--inject-event")) { result.buffer = dumpInjectEvent(options); } else if (EqualsIgnoreCase(option, kUserHalDumpOption)) { - if (options.size() == 1) { - result.buffer = mFakeUserHal->showDumpHelp(); - } else { - result.buffer = mFakeUserHal->dump(options[1]); - } + result.buffer = mFakeUserHal->dump(); } else if (EqualsIgnoreCase(option, "--genfakedata")) { result.buffer = genFakeDataCommand(options); } else { diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp index c230c51cd0..e1354c3e53 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp @@ -1516,26 +1516,16 @@ TEST_F(FakeVehicleHardwareTest, testDumpInvalidOptions) { ASSERT_THAT(result.buffer, ContainsRegex("Invalid option: --invalid")); } -TEST_F(FakeVehicleHardwareTest, testDumpFakeUserHalHelp) { - std::vector options; - options.push_back("--user-hal"); - - DumpResult result = getHardware()->dump(options); - ASSERT_FALSE(result.callerShouldDumpState); - ASSERT_NE(result.buffer, ""); - ASSERT_THAT(result.buffer, ContainsRegex("dumps state used for user management")); -} - TEST_F(FakeVehicleHardwareTest, testDumpFakeUserHal) { std::vector options; options.push_back("--user-hal"); - // Indent: " ". - options.push_back(" "); DumpResult result = getHardware()->dump(options); ASSERT_FALSE(result.callerShouldDumpState); ASSERT_NE(result.buffer, ""); - ASSERT_THAT(result.buffer, ContainsRegex(" No InitialUserInfo response\n")); + ASSERT_THAT(result.buffer, + ContainsRegex("No InitialUserInfo response\nNo SwitchUser response\nNo CreateUser " + "response\nNo SetUserIdentificationAssociation response\n")); } struct SetPropTestCase { diff --git a/automotive/vehicle/aidl/impl/fake_impl/userhal/include/FakeUserHal.h b/automotive/vehicle/aidl/impl/fake_impl/userhal/include/FakeUserHal.h index 4ae9c8c1cb..fcbe8fddea 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/userhal/include/FakeUserHal.h +++ b/automotive/vehicle/aidl/impl/fake_impl/userhal/include/FakeUserHal.h @@ -64,7 +64,7 @@ class FakeUserHal final { std::string showDumpHelp() const; // Dump its contents. - std::string dump(std::string indent) const; + std::string dump() const; private: const std::shared_ptr mValuePool; diff --git a/automotive/vehicle/aidl/impl/fake_impl/userhal/src/FakeUserHal.cpp b/automotive/vehicle/aidl/impl/fake_impl/userhal/src/FakeUserHal.cpp index 7748fb6618..6f6790b447 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/userhal/src/FakeUserHal.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/userhal/src/FakeUserHal.cpp @@ -336,33 +336,31 @@ std::string FakeUserHal::showDumpHelp() const { return fmt::format("{}: dumps state used for user management\n", kUserHalDumpOption); } -std::string FakeUserHal::dump(std::string indent) const { +std::string FakeUserHal::dump() const { std::scoped_lock lockGuard(mLock); std::string info; if (mInitialUserResponseFromCmd != nullptr) { - info += fmt::format("{}InitialUserInfo response: {}\n", indent, + info += fmt::format("InitialUserInfo response: {}\n", mInitialUserResponseFromCmd->toString()); } else { - info += fmt::format("{}No InitialUserInfo response\n", indent); + info += "No InitialUserInfo response\n"; } if (mSwitchUserResponseFromCmd != nullptr) { - info += fmt::format("{}SwitchUser response: {}\n", indent, - mSwitchUserResponseFromCmd->toString()); + info += fmt::format("SwitchUser response: {}\n", mSwitchUserResponseFromCmd->toString()); } else { - info += fmt::format("{}No SwitchUser response\n", indent); + info += "No SwitchUser response\n"; } if (mCreateUserResponseFromCmd != nullptr) { - info += fmt::format("{}CreateUser response: {}\n", indent, - mCreateUserResponseFromCmd->toString()); + info += fmt::format("CreateUser response: {}\n", mCreateUserResponseFromCmd->toString()); } else { - info += fmt::format("{}No CreateUser response\n", indent); + info += "No CreateUser response\n"; } if (mSetUserIdentificationAssociationResponseFromCmd != nullptr) { - info += fmt::format("{}SetUserIdentificationAssociation response: {}\n", indent, + info += fmt::format("SetUserIdentificationAssociation response: {}\n", mSetUserIdentificationAssociationResponseFromCmd->toString()); } else { - info += fmt::format("{}No SetUserIdentificationAssociation response\n", indent); + info += "No SetUserIdentificationAssociation response\n"; } return info; } diff --git a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp index d447bf8cb9..62e9dc81f1 100644 --- a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp +++ b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp @@ -792,7 +792,7 @@ binder_status_t DefaultVehicleHal::dump(int fd, const char** args, uint32_t numA DumpResult result = mVehicleHardware->dump(options); dprintf(fd, "%s", (result.buffer + "\n").c_str()); if (!result.callerShouldDumpState) { - dprintf(fd, "Skip dumping Vehicle HAL State.\n"); + ALOGE("Skip dumping Vehicle HAL State."); return STATUS_OK; } dprintf(fd, "Vehicle HAL State: \n"); From d20f22d2505bfa5d85fccfc128d912de1a6defbf Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 30 Nov 2022 14:57:40 -0800 Subject: [PATCH 440/998] Define SHUTDOWN_REQUEST property. Test: m -j android.hardware.automotive.vehicle-update-api Bug: 260913967 Change-Id: I9661fdd0426b5d42c9b949cbf97a15dfed7d9590 --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 39 ++++++++++++++++++- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 3 +- .../java/ChangeModeForVehicleProperty.java | 3 +- 6 files changed, 45 insertions(+), 3 deletions(-) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 24fd518b38..ab64e07a51 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -224,4 +224,5 @@ enum VehicleProperty { VEHICLE_CURB_WEIGHT = 289410886, GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT = 289410887, SUPPORTED_PROPERTY_IDS = 289476424, + SHUTDOWN_REQUEST = 289410889, } diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 6c2ef5f701..baca8ab43c 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1154,7 +1154,7 @@ enum VehicleProperty { * It is assumed that AP's power state is controlled by a separate power * controller. * - * For configuration information, VehiclePropConfig.configArray can have bit flag combining + * For configuration information, VehiclePropConfig.configArray must have bit flag combining * values in VehicleApPowerStateConfigFlag. * * int32Values[0] : VehicleApPowerStateReq enum value @@ -3140,4 +3140,41 @@ enum VehicleProperty { */ SUPPORTED_PROPERTY_IDS = 0x0F48 + 0x10000000 + 0x01000000 + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC + + /** + * Request the head unit to be shutdown. + * + *

This usually involves telling a separate system outside the head unit (e.g. a power + * controller) to prepare shutting down the head unit. + * + *

This does not mean the head unit will shutdown immediately. + * + *

This means that another system will start sending a shutdown signal to the head unit, + * which will cause VHAL to send SHUTDOWN_PREPARE message to Android. Android will then start + * the shut down process by handling the message. + * + *

This property is only for issuing a request and only supports writing. Every time this + * property value is set, the request to shutdown will be issued no matter what the current + * property value is. The current property value is meaningless. + * + *

Since this property is write-only, subscribing is not allowed and no property change + * event will be generated. + * + *

The value to set indicates the shutdown option, it must be one of + * {@code VehicleApPowerStateShutdownParam}, e.g., + * VehicleApPowerStateShutdownParam.SLEEP_IMMEDIATELY. This shutdown option might not be honored + * if the system doesn't support such option. In such case, an error will not be returned. + * + *

For configuration information, VehiclePropConfig.configArray must have bit flag combining + * values in {@code VehicleApPowerStateConfigFlag} to indicate which shutdown options are + * supported. + * + *

Returns error if failed to send the shutdown request to the other system. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.WRITE + * @data_enum VehicleApPowerStateShutdownParam + */ + SHUTDOWN_REQUEST = + 0x0F49 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, } diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index d5182dd20a..85ca474060 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -224,6 +224,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::VEHICLE_CURB_WEIGHT, VehiclePropertyAccess::READ}, {VehicleProperty::GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyAccess::READ}, {VehicleProperty::SUPPORTED_PROPERTY_IDS, VehiclePropertyAccess::READ}, + {VehicleProperty::SHUTDOWN_REQUEST, VehiclePropertyAccess::WRITE}, }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 47bad2c936..f95580ad2a 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -224,6 +224,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::VEHICLE_CURB_WEIGHT, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::SUPPORTED_PROPERTY_IDS, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::SHUTDOWN_REQUEST, VehiclePropertyChangeMode::ON_CHANGE}, }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 85a62d3d50..d0caed2c9f 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -215,7 +215,8 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.TRAILER_PRESENT, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.VEHICLE_CURB_WEIGHT, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyAccess.READ), - Map.entry(VehicleProperty.SUPPORTED_PROPERTY_IDS, VehiclePropertyAccess.READ) + Map.entry(VehicleProperty.SUPPORTED_PROPERTY_IDS, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.SHUTDOWN_REQUEST, VehiclePropertyAccess.WRITE) ); } diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 46b9663452..96fe0a517b 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -215,7 +215,8 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.TRAILER_PRESENT, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.VEHICLE_CURB_WEIGHT, VehiclePropertyChangeMode.STATIC), Map.entry(VehicleProperty.GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyChangeMode.STATIC), - Map.entry(VehicleProperty.SUPPORTED_PROPERTY_IDS, VehiclePropertyChangeMode.STATIC) + Map.entry(VehicleProperty.SUPPORTED_PROPERTY_IDS, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.SHUTDOWN_REQUEST, VehiclePropertyChangeMode.ON_CHANGE) ); } From f3262f970d8affea4d156e88095e56feaf45644d Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Fri, 15 Jul 2022 23:25:39 +0000 Subject: [PATCH 441/998] Add AIDL implementation for the vendor HAL service. Bug: 205044134 Test: Pass AIDL VTS tests and regression tests. Change-Id: Iad04ce01f71fc220443e05a4be05d7d5545227e8 --- wifi/aidl/default/Android.bp | 214 ++ wifi/aidl/default/THREADING.README | 35 + wifi/aidl/default/aidl_callback_util.h | 140 + wifi/aidl/default/aidl_return_util.h | 85 + wifi/aidl/default/aidl_struct_util.cpp | 2775 +++++++++++++++++ wifi/aidl/default/aidl_struct_util.h | 180 ++ wifi/aidl/default/aidl_sync_util.cpp | 37 + wifi/aidl/default/aidl_sync_util.h | 35 + .../android.hardware.wifi-service-lazy.rc | 8 + .../default/android.hardware.wifi-service.rc | 6 + .../default/android.hardware.wifi-service.xml | 6 + wifi/aidl/default/ringbuffer.cpp | 62 + wifi/aidl/default/ringbuffer.h | 60 + wifi/aidl/default/service.cpp | 73 + .../tests/aidl_struct_util_unit_tests.cpp | 485 +++ wifi/aidl/default/tests/main.cpp | 28 + .../default/tests/mock_interface_tool.cpp | 28 + wifi/aidl/default/tests/mock_interface_tool.h | 42 + .../default/tests/mock_wifi_feature_flags.cpp | 33 + .../default/tests/mock_wifi_feature_flags.h | 44 + .../default/tests/mock_wifi_iface_util.cpp | 38 + .../aidl/default/tests/mock_wifi_iface_util.h | 50 + .../default/tests/mock_wifi_legacy_hal.cpp | 37 + .../aidl/default/tests/mock_wifi_legacy_hal.h | 69 + .../tests/mock_wifi_mode_controller.cpp | 36 + .../default/tests/mock_wifi_mode_controller.h | 44 + .../default/tests/ringbuffer_unit_tests.cpp | 96 + wifi/aidl/default/tests/runtests.sh | 26 + .../default/tests/wifi_chip_unit_tests.cpp | 855 +++++ .../tests/wifi_iface_util_unit_tests.cpp | 94 + .../tests/wifi_nan_iface_unit_tests.cpp | 168 + wifi/aidl/default/wifi.cpp | 284 ++ wifi/aidl/default/wifi.h | 96 + wifi/aidl/default/wifi_ap_iface.cpp | 190 ++ wifi/aidl/default/wifi_ap_iface.h | 81 + wifi/aidl/default/wifi_chip.cpp | 1910 ++++++++++++ wifi/aidl/default/wifi_chip.h | 287 ++ wifi/aidl/default/wifi_feature_flags.cpp | 228 ++ wifi/aidl/default/wifi_feature_flags.h | 56 + wifi/aidl/default/wifi_iface_util.cpp | 174 ++ wifi/aidl/default/wifi_iface_util.h | 84 + wifi/aidl/default/wifi_legacy_hal.cpp | 1654 ++++++++++ wifi/aidl/default/wifi_legacy_hal.h | 738 +++++ wifi/aidl/default/wifi_legacy_hal_factory.cpp | 252 ++ wifi/aidl/default/wifi_legacy_hal_factory.h | 64 + wifi/aidl/default/wifi_legacy_hal_stubs.cpp | 177 ++ wifi/aidl/default/wifi_legacy_hal_stubs.h | 35 + wifi/aidl/default/wifi_mode_controller.cpp | 88 + wifi/aidl/default/wifi_mode_controller.h | 59 + wifi/aidl/default/wifi_nan_iface.cpp | 751 +++++ wifi/aidl/default/wifi_nan_iface.h | 134 + wifi/aidl/default/wifi_p2p_iface.cpp | 59 + wifi/aidl/default/wifi_p2p_iface.h | 61 + wifi/aidl/default/wifi_rtt_controller.cpp | 255 ++ wifi/aidl/default/wifi_rtt_controller.h | 102 + wifi/aidl/default/wifi_sta_iface.cpp | 558 ++++ wifi/aidl/default/wifi_sta_iface.h | 154 + wifi/aidl/default/wifi_status_util.cpp | 106 + wifi/aidl/default/wifi_status_util.h | 42 + wifi/aidl/vts/functional/Android.bp | 169 + .../vts/functional/wifi_aidl_test_utils.cpp | 216 ++ .../vts/functional/wifi_aidl_test_utils.h | 48 + .../functional/wifi_ap_iface_aidl_test.cpp | 154 + .../vts/functional/wifi_chip_aidl_test.cpp | 889 ++++++ .../functional/wifi_nan_iface_aidl_test.cpp | 627 ++++ .../wifi_rtt_controller_aidl_test.cpp | 234 ++ .../functional/wifi_sta_iface_aidl_test.cpp | 282 ++ 67 files changed, 17187 insertions(+) create mode 100644 wifi/aidl/default/Android.bp create mode 100644 wifi/aidl/default/THREADING.README create mode 100644 wifi/aidl/default/aidl_callback_util.h create mode 100644 wifi/aidl/default/aidl_return_util.h create mode 100644 wifi/aidl/default/aidl_struct_util.cpp create mode 100644 wifi/aidl/default/aidl_struct_util.h create mode 100644 wifi/aidl/default/aidl_sync_util.cpp create mode 100644 wifi/aidl/default/aidl_sync_util.h create mode 100644 wifi/aidl/default/android.hardware.wifi-service-lazy.rc create mode 100644 wifi/aidl/default/android.hardware.wifi-service.rc create mode 100644 wifi/aidl/default/android.hardware.wifi-service.xml create mode 100644 wifi/aidl/default/ringbuffer.cpp create mode 100644 wifi/aidl/default/ringbuffer.h create mode 100644 wifi/aidl/default/service.cpp create mode 100644 wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp create mode 100644 wifi/aidl/default/tests/main.cpp create mode 100644 wifi/aidl/default/tests/mock_interface_tool.cpp create mode 100644 wifi/aidl/default/tests/mock_interface_tool.h create mode 100644 wifi/aidl/default/tests/mock_wifi_feature_flags.cpp create mode 100644 wifi/aidl/default/tests/mock_wifi_feature_flags.h create mode 100644 wifi/aidl/default/tests/mock_wifi_iface_util.cpp create mode 100644 wifi/aidl/default/tests/mock_wifi_iface_util.h create mode 100644 wifi/aidl/default/tests/mock_wifi_legacy_hal.cpp create mode 100644 wifi/aidl/default/tests/mock_wifi_legacy_hal.h create mode 100644 wifi/aidl/default/tests/mock_wifi_mode_controller.cpp create mode 100644 wifi/aidl/default/tests/mock_wifi_mode_controller.h create mode 100644 wifi/aidl/default/tests/ringbuffer_unit_tests.cpp create mode 100755 wifi/aidl/default/tests/runtests.sh create mode 100644 wifi/aidl/default/tests/wifi_chip_unit_tests.cpp create mode 100644 wifi/aidl/default/tests/wifi_iface_util_unit_tests.cpp create mode 100644 wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp create mode 100644 wifi/aidl/default/wifi.cpp create mode 100644 wifi/aidl/default/wifi.h create mode 100644 wifi/aidl/default/wifi_ap_iface.cpp create mode 100644 wifi/aidl/default/wifi_ap_iface.h create mode 100644 wifi/aidl/default/wifi_chip.cpp create mode 100644 wifi/aidl/default/wifi_chip.h create mode 100644 wifi/aidl/default/wifi_feature_flags.cpp create mode 100644 wifi/aidl/default/wifi_feature_flags.h create mode 100644 wifi/aidl/default/wifi_iface_util.cpp create mode 100644 wifi/aidl/default/wifi_iface_util.h create mode 100644 wifi/aidl/default/wifi_legacy_hal.cpp create mode 100644 wifi/aidl/default/wifi_legacy_hal.h create mode 100644 wifi/aidl/default/wifi_legacy_hal_factory.cpp create mode 100644 wifi/aidl/default/wifi_legacy_hal_factory.h create mode 100644 wifi/aidl/default/wifi_legacy_hal_stubs.cpp create mode 100644 wifi/aidl/default/wifi_legacy_hal_stubs.h create mode 100644 wifi/aidl/default/wifi_mode_controller.cpp create mode 100644 wifi/aidl/default/wifi_mode_controller.h create mode 100644 wifi/aidl/default/wifi_nan_iface.cpp create mode 100644 wifi/aidl/default/wifi_nan_iface.h create mode 100644 wifi/aidl/default/wifi_p2p_iface.cpp create mode 100644 wifi/aidl/default/wifi_p2p_iface.h create mode 100644 wifi/aidl/default/wifi_rtt_controller.cpp create mode 100644 wifi/aidl/default/wifi_rtt_controller.h create mode 100644 wifi/aidl/default/wifi_sta_iface.cpp create mode 100644 wifi/aidl/default/wifi_sta_iface.h create mode 100644 wifi/aidl/default/wifi_status_util.cpp create mode 100644 wifi/aidl/default/wifi_status_util.h create mode 100644 wifi/aidl/vts/functional/Android.bp create mode 100644 wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp create mode 100644 wifi/aidl/vts/functional/wifi_aidl_test_utils.h create mode 100644 wifi/aidl/vts/functional/wifi_ap_iface_aidl_test.cpp create mode 100644 wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp create mode 100644 wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp create mode 100644 wifi/aidl/vts/functional/wifi_rtt_controller_aidl_test.cpp create mode 100644 wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp diff --git a/wifi/aidl/default/Android.bp b/wifi/aidl/default/Android.bp new file mode 100644 index 0000000000..441d461b78 --- /dev/null +++ b/wifi/aidl/default/Android.bp @@ -0,0 +1,214 @@ +// 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. + +package { + default_applicable_licenses: ["hardware_interfaces_license"], +} + +soong_config_module_type { + name: "wifi_hal_cc_defaults", + module_type: "cc_defaults", + config_namespace: "wifi", + bool_variables: [ + "hidl_feature_aware", // WIFI_HIDL_FEATURE_AWARE + "hidl_feature_dual_interface", // WIFI_HIDL_FEATURE_DUAL_INTERFACE + "hidl_feature_disable_ap", // WIFI_HIDL_FEATURE_DISABLE_AP + "hidl_feature_disable_ap_mac_randomization", // WIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION + "avoid_iface_reset_mac_change", // WIFI_AVOID_IFACE_RESET_MAC_CHANGE + ], + value_variables: [ + "hal_interface_combinations", // WIFI_HAL_INTERFACE_COMBINATIONS + ], + properties: [ + "cppflags", + ], +} + +wifi_hal_cc_defaults { + name: "android.hardware.wifi-service-cppflags-defaults", + soong_config_variables: { + hidl_feature_aware: { + cppflags: ["-DWIFI_HIDL_FEATURE_AWARE"], + }, + hidl_feature_dual_interface: { + cppflags: ["-DWIFI_HIDL_FEATURE_DUAL_INTERFACE"], + }, + hidl_feature_disable_ap: { + cppflags: ["-DWIFI_HIDL_FEATURE_DISABLE_AP"], + }, + hidl_feature_disable_ap_mac_randomization: { + cppflags: ["-DWIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION"], + }, + avoid_iface_reset_mac_change: { + cppflags: ["-DWIFI_AVOID_IFACE_RESET_MAC_CHANGE"], + }, + hal_interface_combinations: { + cppflags: ["-DWIFI_HAL_INTERFACE_COMBINATIONS=%s"], + }, + }, +} + +cc_library_static { + name: "android.hardware.wifi-service-lib", + defaults: ["android.hardware.wifi-service-cppflags-defaults"], + proprietary: true, + compile_multilib: "first", + cppflags: [ + "-Wall", + "-Werror", + "-Wextra", + ], + // Allow implicit fallthroughs in wifi_legacy_hal.cpp until they are fixed. + cflags: ["-Wno-error=implicit-fallthrough"], + srcs: [ + "aidl_struct_util.cpp", + "aidl_sync_util.cpp", + "ringbuffer.cpp", + "wifi.cpp", + "wifi_ap_iface.cpp", + "wifi_chip.cpp", + "wifi_feature_flags.cpp", + "wifi_iface_util.cpp", + "wifi_legacy_hal.cpp", + "wifi_legacy_hal_factory.cpp", + "wifi_legacy_hal_stubs.cpp", + "wifi_mode_controller.cpp", + "wifi_nan_iface.cpp", + "wifi_p2p_iface.cpp", + "wifi_rtt_controller.cpp", + "wifi_sta_iface.cpp", + "wifi_status_util.cpp", + ], + + shared_libs: [ + "libbase", + "libbinder_ndk", + "libcutils", + "liblog", + "libnl", + "libutils", + "libwifi-hal", + "libwifi-system-iface", + "libxml2", + "android.hardware.wifi-V1-ndk", + ], + + export_include_dirs: ["."], +} + +cc_binary { + name: "android.hardware.wifi-service", + vintf_fragments: ["android.hardware.wifi-service.xml"], + relative_install_path: "hw", + proprietary: true, + cppflags: [ + "-Wall", + "-Werror", + "-Wextra", + ], + srcs: ["service.cpp"], + shared_libs: [ + "libbase", + "libbinder_ndk", + "libcutils", + "liblog", + "libnl", + "libutils", + "libwifi-hal", + "libwifi-system-iface", + "libxml2", + "android.hardware.wifi-V1-ndk", + ], + static_libs: ["android.hardware.wifi-service-lib"], + init_rc: ["android.hardware.wifi-service.rc"], +} + +cc_binary { + name: "android.hardware.wifi-service-lazy", + vintf_fragments: ["android.hardware.wifi-service.xml"], + overrides: ["android.hardware.wifi-service"], + cflags: ["-DLAZY_SERVICE"], + relative_install_path: "hw", + proprietary: true, + cppflags: [ + "-Wall", + "-Werror", + "-Wextra", + ], + srcs: ["service.cpp"], + shared_libs: [ + "libbase", + "libbinder_ndk", + "libcutils", + "liblog", + "libnl", + "libutils", + "libwifi-hal", + "libwifi-system-iface", + "libxml2", + "android.hardware.wifi-V1-ndk", + ], + static_libs: ["android.hardware.wifi-service-lib"], + init_rc: ["android.hardware.wifi-service-lazy.rc"], +} + +cc_test { + name: "android.hardware.wifi-service-tests", + proprietary: true, + compile_multilib: "first", + cppflags: [ + "-Wall", + "-Werror", + "-Wextra", + ], + srcs: [ + "tests/aidl_struct_util_unit_tests.cpp", + "tests/main.cpp", + "tests/mock_interface_tool.cpp", + "tests/mock_wifi_feature_flags.cpp", + "tests/mock_wifi_iface_util.cpp", + "tests/mock_wifi_legacy_hal.cpp", + "tests/mock_wifi_mode_controller.cpp", + "tests/ringbuffer_unit_tests.cpp", + "tests/wifi_nan_iface_unit_tests.cpp", + "tests/wifi_chip_unit_tests.cpp", + "tests/wifi_iface_util_unit_tests.cpp", + ], + static_libs: [ + "libgmock", + "libgtest", + "android.hardware.wifi-V1-ndk", + "android.hardware.wifi-service-lib", + ], + shared_libs: [ + "libbase", + "libbinder_ndk", + "libcutils", + "liblog", + "libnl", + "libutils", + "libwifi-hal", + "libwifi-system-iface", + ], +} + +filegroup { + name: "default-android.hardware.wifi-service.rc", + srcs: ["android.hardware.wifi-service.rc"], +} + +filegroup { + name: "default-android.hardware.wifi-service.xml", + srcs: ["android.hardware.wifi-service.xml"], +} diff --git a/wifi/aidl/default/THREADING.README b/wifi/aidl/default/THREADING.README new file mode 100644 index 0000000000..45679da069 --- /dev/null +++ b/wifi/aidl/default/THREADING.README @@ -0,0 +1,35 @@ +Vendor HAL Threading Model +========================== +The vendor HAL service has two threads: +1. AIDL thread: This is the main thread which processes all the incoming AIDL +RPC's. +2. Legacy HAL event loop thread: This is the thread forked off for processing +the legacy HAL event loop (wifi_event_loop()). This thread is used to process +any asynchronous netlink events posted by the driver. Any asynchronous +callbacks passed to the legacy HAL API's are invoked on this thread. + +Synchronization Concerns +======================== +wifi_legacy_hal.cpp has a bunch of global "C" style functions to handle the +legacy callbacks. Each of these "C" style functions invokes a corresponding +"std::function" version of the callback which does the actual processing. +The variables holding these "std::function" callbacks are reset from the AIDL +thread when they are no longer used. For example: stopGscan() will reset the +corresponding "on_gscan_*" callback variables which were set when startGscan() +was invoked. This is not thread safe since these callback variables are +accesed from the legacy hal event loop thread as well. + +Synchronization Solution +======================== +Adding a global lock seems to be the most trivial solution to the problem. +a) All of the asynchronous "C" style callbacks will acquire the global lock +before invoking the corresponding "std::function" callback variables. +b) All of the AIDL methods will also acquire the global lock before processing +(in aidl_return_util::validateAndCall()). + +Note: It's important that we only acquire the global lock for asynchronous +callbacks, because there is no guarantee (or documentation to clarify) that the +synchronous callbacks are invoked on the same invocation thread. If that is not +the case in some implementation, we will end up deadlocking the system since the +AIDL thread would have acquired the global lock which is needed by the +synchronous callback executed on the legacy hal event loop thread. diff --git a/wifi/aidl/default/aidl_callback_util.h b/wifi/aidl/default/aidl_callback_util.h new file mode 100644 index 0000000000..41d70a53aa --- /dev/null +++ b/wifi/aidl/default/aidl_callback_util.h @@ -0,0 +1,140 @@ +/* + * 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. + */ + +#ifndef AIDL_CALLBACK_UTIL_H_ +#define AIDL_CALLBACK_UTIL_H_ + +#include + +#include +#include + +namespace { +std::unordered_map callback_handler_map_; +} + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace aidl_callback_util { + +// Provides a class to manage callbacks for the various AIDL interfaces and +// handle the death of the process hosting each callback. +template +class AidlCallbackHandler { + public: + AidlCallbackHandler() { + death_handler_ = AIBinder_DeathRecipient_new(AidlCallbackHandler::onCallbackDeath); + } + ~AidlCallbackHandler() { invalidate(); } + + bool addCallback(const std::shared_ptr& cb) { + void* cbPtr = reinterpret_cast(cb->asBinder().get()); + const auto& cbPosition = findCbInSet(cbPtr); + if (cbPosition != cb_set_.end()) { + LOG(WARNING) << "Duplicate death notification registration"; + return true; + } + + if (AIBinder_linkToDeath(cb->asBinder().get(), death_handler_, cbPtr /* cookie */) != + STATUS_OK) { + LOG(ERROR) << "Failed to register death notification"; + return false; + } + + callback_handler_map_[cbPtr] = reinterpret_cast(this); + cb_set_.insert(cb); + return true; + } + + const std::set>& getCallbacks() { return cb_set_; } + + void invalidate() { + for (auto cb : cb_set_) { + void* cookie = reinterpret_cast(cb->asBinder().get()); + if (AIBinder_unlinkToDeath(cb->asBinder().get(), death_handler_, cookie) != STATUS_OK) { + LOG(ERROR) << "Failed to deregister death notification"; + } + if (!removeCbFromHandlerMap(cookie)) { + LOG(ERROR) << "Failed to remove callback from handler map"; + } + } + cb_set_.clear(); + } + + // Entry point for the death handling logic. AIBinder_DeathRecipient + // can only call a static function, so use the cookie to find the + // proper handler and route the request there. + static void onCallbackDeath(void* cookie) { + auto cbQuery = callback_handler_map_.find(cookie); + if (cbQuery == callback_handler_map_.end()) { + LOG(ERROR) << "Invalid death cookie received"; + return; + } + + AidlCallbackHandler* cbHandler = reinterpret_cast(cbQuery->second); + if (cbHandler == nullptr) { + LOG(ERROR) << "Handler mapping contained an invalid handler"; + return; + } + cbHandler->handleCallbackDeath(cbQuery->first); + } + + private: + std::set> cb_set_; + AIBinder_DeathRecipient* death_handler_; + + typename std::set>::iterator findCbInSet(void* cbPtr) { + const auto& cbPosition = std::find_if( + cb_set_.begin(), cb_set_.end(), [cbPtr](const std::shared_ptr& p) { + return cbPtr == reinterpret_cast(p->asBinder().get()); + }); + return cbPosition; + } + + bool removeCbFromHandlerMap(void* cbPtr) { + auto cbQuery = callback_handler_map_.find(cbPtr); + if (cbQuery != callback_handler_map_.end()) { + callback_handler_map_.erase(cbQuery); + return true; + } + return false; + } + + void handleCallbackDeath(void* cbPtr) { + const auto& cbPosition = findCbInSet(cbPtr); + if (cbPosition == cb_set_.end()) { + LOG(ERROR) << "Unknown callback death notification received"; + return; + } + cb_set_.erase(cbPosition); + + if (!removeCbFromHandlerMap(cbPtr)) { + LOG(ERROR) << "Callback was not in callback handler map"; + } + } + + DISALLOW_COPY_AND_ASSIGN(AidlCallbackHandler); +}; + +} // namespace aidl_callback_util +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // AIDL_CALLBACK_UTIL_H_ diff --git a/wifi/aidl/default/aidl_return_util.h b/wifi/aidl/default/aidl_return_util.h new file mode 100644 index 0000000000..9a49a22e2a --- /dev/null +++ b/wifi/aidl/default/aidl_return_util.h @@ -0,0 +1,85 @@ +/* + * 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. + */ + +#ifndef AIDL_RETURN_UTIL_H_ +#define AIDL_RETURN_UTIL_H_ + +#include "aidl_sync_util.h" +#include "wifi_status_util.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace aidl_return_util { +using aidl::android::hardware::wifi::WifiStatusCode; +using aidl::android::hardware::wifi::aidl_sync_util::acquireGlobalLock; + +/** + * These utility functions are used to invoke a method on the provided + * AIDL interface object. + * These functions checks if the provided AIDL interface object is valid. + * a) If valid, Invokes the corresponding internal implementation function of + * the AIDL method. + * b) If invalid, return without calling the internal implementation function. + */ + +// Use for AIDL methods which return only an AIDL status. +template +::ndk::ScopedAStatus validateAndCall(ObjT* obj, WifiStatusCode status_code_if_invalid, + WorkFuncT&& work, Args&&... args) { + const auto lock = acquireGlobalLock(); + if (obj->isValid()) { + return (obj->*work)(std::forward(args)...); + } else { + return createWifiStatus(status_code_if_invalid); + } +} + +// Use for AIDL methods which return only an AIDL status. +// This version passes the global lock acquired to the body of the method. +template +::ndk::ScopedAStatus validateAndCallWithLock(ObjT* obj, WifiStatusCode status_code_if_invalid, + WorkFuncT&& work, Args&&... args) { + auto lock = acquireGlobalLock(); + if (obj->isValid()) { + return (obj->*work)(&lock, std::forward(args)...); + } else { + return createWifiStatus(status_code_if_invalid); + } +} + +// Use for AIDL methods which have a return value along with the AIDL status +template +::ndk::ScopedAStatus validateAndCall(ObjT* obj, WifiStatusCode status_code_if_invalid, + WorkFuncT&& work, ReturnT* ret_val, Args&&... args) { + const auto lock = acquireGlobalLock(); + if (obj->isValid()) { + auto call_pair = (obj->*work)(std::forward(args)...); + *ret_val = call_pair.first; + return std::forward<::ndk::ScopedAStatus>(call_pair.second); + } else { + return ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(status_code_if_invalid)); + } +} + +} // namespace aidl_return_util +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl +#endif // AIDL_RETURN_UTIL_H_ diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp new file mode 100644 index 0000000000..07612b65c5 --- /dev/null +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -0,0 +1,2775 @@ +/* + * 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. + */ + +#include +#include + +#include "aidl_struct_util.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace aidl_struct_util { + +WifiChannelWidthInMhz convertLegacyWifiChannelWidthToAidl(legacy_hal::wifi_channel_width type); + +std::string safeConvertChar(const char* str, size_t max_len) { + const char* c = str; + size_t size = 0; + while (*c && (unsigned char)*c < 128 && size < max_len) { + ++size; + ++c; + } + return std::string(str, size); +} + +inline std::vector uintToIntVec(const std::vector& in) { + return std::vector(in.begin(), in.end()); +} + +IWifiChip::ChipCapabilityMask convertLegacyLoggerFeatureToAidlChipCapability(uint32_t feature) { + switch (feature) { + case legacy_hal::WIFI_LOGGER_MEMORY_DUMP_SUPPORTED: + return IWifiChip::ChipCapabilityMask::DEBUG_MEMORY_FIRMWARE_DUMP; + case legacy_hal::WIFI_LOGGER_DRIVER_DUMP_SUPPORTED: + return IWifiChip::ChipCapabilityMask::DEBUG_MEMORY_DRIVER_DUMP; + case legacy_hal::WIFI_LOGGER_CONNECT_EVENT_SUPPORTED: + return IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_CONNECT_EVENT; + case legacy_hal::WIFI_LOGGER_POWER_EVENT_SUPPORTED: + return IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_POWER_EVENT; + case legacy_hal::WIFI_LOGGER_WAKE_LOCK_SUPPORTED: + return IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_WAKELOCK_EVENT; + }; + CHECK(false) << "Unknown legacy feature: " << feature; + return {}; +} + +IWifiStaIface::StaIfaceCapabilityMask convertLegacyLoggerFeatureToAidlStaIfaceCapability( + uint32_t feature) { + switch (feature) { + case legacy_hal::WIFI_LOGGER_PACKET_FATE_SUPPORTED: + return IWifiStaIface::StaIfaceCapabilityMask::DEBUG_PACKET_FATE; + }; + CHECK(false) << "Unknown legacy feature: " << feature; + return {}; +} + +IWifiChip::ChipCapabilityMask convertLegacyFeatureToAidlChipCapability(uint64_t feature) { + switch (feature) { + case WIFI_FEATURE_SET_TX_POWER_LIMIT: + return IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT; + case WIFI_FEATURE_USE_BODY_HEAD_SAR: + return IWifiChip::ChipCapabilityMask::USE_BODY_HEAD_SAR; + case WIFI_FEATURE_D2D_RTT: + return IWifiChip::ChipCapabilityMask::D2D_RTT; + case WIFI_FEATURE_D2AP_RTT: + return IWifiChip::ChipCapabilityMask::D2AP_RTT; + case WIFI_FEATURE_INFRA_60G: + return IWifiChip::ChipCapabilityMask::WIGIG; + case WIFI_FEATURE_SET_LATENCY_MODE: + return IWifiChip::ChipCapabilityMask::SET_LATENCY_MODE; + case WIFI_FEATURE_P2P_RAND_MAC: + return IWifiChip::ChipCapabilityMask::P2P_RAND_MAC; + }; + CHECK(false) << "Unknown legacy feature: " << feature; + return {}; +} + +IWifiStaIface::StaIfaceCapabilityMask convertLegacyFeatureToAidlStaIfaceCapability( + uint64_t feature) { + switch (feature) { + case WIFI_FEATURE_GSCAN: + return IWifiStaIface::StaIfaceCapabilityMask::BACKGROUND_SCAN; + case WIFI_FEATURE_LINK_LAYER_STATS: + return IWifiStaIface::StaIfaceCapabilityMask::LINK_LAYER_STATS; + case WIFI_FEATURE_RSSI_MONITOR: + return IWifiStaIface::StaIfaceCapabilityMask::RSSI_MONITOR; + case WIFI_FEATURE_CONTROL_ROAMING: + return IWifiStaIface::StaIfaceCapabilityMask::CONTROL_ROAMING; + case WIFI_FEATURE_IE_WHITELIST: + return IWifiStaIface::StaIfaceCapabilityMask::PROBE_IE_ALLOWLIST; + case WIFI_FEATURE_SCAN_RAND: + return IWifiStaIface::StaIfaceCapabilityMask::SCAN_RAND; + case WIFI_FEATURE_INFRA_5G: + return IWifiStaIface::StaIfaceCapabilityMask::STA_5G; + case WIFI_FEATURE_HOTSPOT: + return IWifiStaIface::StaIfaceCapabilityMask::HOTSPOT; + case WIFI_FEATURE_PNO: + return IWifiStaIface::StaIfaceCapabilityMask::PNO; + case WIFI_FEATURE_TDLS: + return IWifiStaIface::StaIfaceCapabilityMask::TDLS; + case WIFI_FEATURE_TDLS_OFFCHANNEL: + return IWifiStaIface::StaIfaceCapabilityMask::TDLS_OFFCHANNEL; + case WIFI_FEATURE_CONFIG_NDO: + return IWifiStaIface::StaIfaceCapabilityMask::ND_OFFLOAD; + case WIFI_FEATURE_MKEEP_ALIVE: + return IWifiStaIface::StaIfaceCapabilityMask::KEEP_ALIVE; + }; + CHECK(false) << "Unknown legacy feature: " << feature; + return {}; +} + +bool convertLegacyFeaturesToAidlChipCapabilities(uint64_t legacy_feature_set, + uint32_t legacy_logger_feature_set, + uint32_t* aidl_caps) { + if (!aidl_caps) { + return false; + } + *aidl_caps = {}; + for (const auto feature : {legacy_hal::WIFI_LOGGER_MEMORY_DUMP_SUPPORTED, + legacy_hal::WIFI_LOGGER_DRIVER_DUMP_SUPPORTED, + legacy_hal::WIFI_LOGGER_CONNECT_EVENT_SUPPORTED, + legacy_hal::WIFI_LOGGER_POWER_EVENT_SUPPORTED, + legacy_hal::WIFI_LOGGER_WAKE_LOCK_SUPPORTED}) { + if (feature & legacy_logger_feature_set) { + *aidl_caps |= + static_cast(convertLegacyLoggerFeatureToAidlChipCapability(feature)); + } + } + std::vector features = {WIFI_FEATURE_SET_TX_POWER_LIMIT, + WIFI_FEATURE_USE_BODY_HEAD_SAR, + WIFI_FEATURE_D2D_RTT, + WIFI_FEATURE_D2AP_RTT, + WIFI_FEATURE_INFRA_60G, + WIFI_FEATURE_SET_LATENCY_MODE, + WIFI_FEATURE_P2P_RAND_MAC}; + for (const auto feature : features) { + if (feature & legacy_feature_set) { + *aidl_caps |= static_cast(convertLegacyFeatureToAidlChipCapability(feature)); + } + } + + // There are no flags for these 3 in the legacy feature set. Adding them to + // the set because all the current devices support it. + *aidl_caps |= + static_cast(IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_VENDOR_DATA); + *aidl_caps |= + static_cast(IWifiChip::ChipCapabilityMask::DEBUG_HOST_WAKE_REASON_STATS); + *aidl_caps |= static_cast(IWifiChip::ChipCapabilityMask::DEBUG_ERROR_ALERTS); + return true; +} + +WifiDebugRingBufferFlags convertLegacyDebugRingBufferFlagsToAidl(uint32_t flag) { + switch (flag) { + case WIFI_RING_BUFFER_FLAG_HAS_BINARY_ENTRIES: + return WifiDebugRingBufferFlags::HAS_BINARY_ENTRIES; + case WIFI_RING_BUFFER_FLAG_HAS_ASCII_ENTRIES: + return WifiDebugRingBufferFlags::HAS_ASCII_ENTRIES; + }; + CHECK(false) << "Unknown legacy flag: " << flag; + return {}; +} + +bool convertLegacyDebugRingBufferStatusToAidl( + const legacy_hal::wifi_ring_buffer_status& legacy_status, + WifiDebugRingBufferStatus* aidl_status) { + if (!aidl_status) { + return false; + } + *aidl_status = {}; + aidl_status->ringName = safeConvertChar(reinterpret_cast(legacy_status.name), + sizeof(legacy_status.name)); + aidl_status->flags = 0; + for (const auto flag : + {WIFI_RING_BUFFER_FLAG_HAS_BINARY_ENTRIES, WIFI_RING_BUFFER_FLAG_HAS_ASCII_ENTRIES}) { + if (flag & legacy_status.flags) { + aidl_status->flags |= static_cast::type>( + convertLegacyDebugRingBufferFlagsToAidl(flag)); + } + } + aidl_status->ringId = legacy_status.ring_id; + aidl_status->sizeInBytes = legacy_status.ring_buffer_byte_size; + // Calculate free size of the ring the buffer. We don't need to send the + // exact read/write pointers that were there in the legacy HAL interface. + if (legacy_status.written_bytes >= legacy_status.read_bytes) { + aidl_status->freeSizeInBytes = legacy_status.ring_buffer_byte_size - + (legacy_status.written_bytes - legacy_status.read_bytes); + } else { + aidl_status->freeSizeInBytes = legacy_status.read_bytes - legacy_status.written_bytes; + } + aidl_status->verboseLevel = legacy_status.verbose_level; + return true; +} + +bool convertLegacyVectorOfDebugRingBufferStatusToAidl( + const std::vector& legacy_status_vec, + std::vector* aidl_status_vec) { + if (!aidl_status_vec) { + return false; + } + *aidl_status_vec = {}; + for (const auto& legacy_status : legacy_status_vec) { + WifiDebugRingBufferStatus aidl_status; + if (!convertLegacyDebugRingBufferStatusToAidl(legacy_status, &aidl_status)) { + return false; + } + aidl_status_vec->push_back(aidl_status); + } + return true; +} + +bool convertLegacyWakeReasonStatsToAidl(const legacy_hal::WakeReasonStats& legacy_stats, + WifiDebugHostWakeReasonStats* aidl_stats) { + if (!aidl_stats) { + return false; + } + *aidl_stats = {}; + aidl_stats->totalCmdEventWakeCnt = legacy_stats.wake_reason_cnt.total_cmd_event_wake; + aidl_stats->cmdEventWakeCntPerType = uintToIntVec(legacy_stats.cmd_event_wake_cnt); + aidl_stats->totalDriverFwLocalWakeCnt = legacy_stats.wake_reason_cnt.total_driver_fw_local_wake; + aidl_stats->driverFwLocalWakeCntPerType = uintToIntVec(legacy_stats.driver_fw_local_wake_cnt); + aidl_stats->totalRxPacketWakeCnt = legacy_stats.wake_reason_cnt.total_rx_data_wake; + aidl_stats->rxPktWakeDetails.rxUnicastCnt = + legacy_stats.wake_reason_cnt.rx_wake_details.rx_unicast_cnt; + aidl_stats->rxPktWakeDetails.rxMulticastCnt = + legacy_stats.wake_reason_cnt.rx_wake_details.rx_multicast_cnt; + aidl_stats->rxPktWakeDetails.rxBroadcastCnt = + legacy_stats.wake_reason_cnt.rx_wake_details.rx_broadcast_cnt; + aidl_stats->rxMulticastPkWakeDetails.ipv4RxMulticastAddrCnt = + legacy_stats.wake_reason_cnt.rx_multicast_wake_pkt_info.ipv4_rx_multicast_addr_cnt; + aidl_stats->rxMulticastPkWakeDetails.ipv6RxMulticastAddrCnt = + legacy_stats.wake_reason_cnt.rx_multicast_wake_pkt_info.ipv6_rx_multicast_addr_cnt; + aidl_stats->rxMulticastPkWakeDetails.otherRxMulticastAddrCnt = + legacy_stats.wake_reason_cnt.rx_multicast_wake_pkt_info.other_rx_multicast_addr_cnt; + aidl_stats->rxIcmpPkWakeDetails.icmpPkt = + legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp_pkt; + aidl_stats->rxIcmpPkWakeDetails.icmp6Pkt = + legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_pkt; + aidl_stats->rxIcmpPkWakeDetails.icmp6Ra = + legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_ra; + aidl_stats->rxIcmpPkWakeDetails.icmp6Na = + legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_na; + aidl_stats->rxIcmpPkWakeDetails.icmp6Ns = + legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_ns; + return true; +} + +legacy_hal::wifi_power_scenario convertAidlTxPowerScenarioToLegacy( + IWifiChip::TxPowerScenario aidl_scenario) { + switch (aidl_scenario) { + case IWifiChip::TxPowerScenario::VOICE_CALL: + return legacy_hal::WIFI_POWER_SCENARIO_VOICE_CALL; + case IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF: + return legacy_hal::WIFI_POWER_SCENARIO_ON_HEAD_CELL_OFF; + case IWifiChip::TxPowerScenario::ON_HEAD_CELL_ON: + return legacy_hal::WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON; + case IWifiChip::TxPowerScenario::ON_BODY_CELL_OFF: + return legacy_hal::WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF; + case IWifiChip::TxPowerScenario::ON_BODY_CELL_ON: + return legacy_hal::WIFI_POWER_SCENARIO_ON_BODY_CELL_ON; + }; + CHECK(false); +} + +legacy_hal::wifi_latency_mode convertAidlLatencyModeToLegacy( + IWifiChip::LatencyMode aidl_latency_mode) { + switch (aidl_latency_mode) { + case IWifiChip::LatencyMode::NORMAL: + return legacy_hal::WIFI_LATENCY_MODE_NORMAL; + case IWifiChip::LatencyMode::LOW: + return legacy_hal::WIFI_LATENCY_MODE_LOW; + } + CHECK(false); +} + +bool convertLegacyWifiMacInfoToAidl(const legacy_hal::WifiMacInfo& legacy_mac_info, + IWifiChipEventCallback::RadioModeInfo* aidl_radio_mode_info) { + if (!aidl_radio_mode_info) { + return false; + } + *aidl_radio_mode_info = {}; + + aidl_radio_mode_info->radioId = legacy_mac_info.wlan_mac_id; + // Convert from bitmask of bands in the legacy HAL to enum value in + // the AIDL interface. + if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND && + legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND && + legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND) { + aidl_radio_mode_info->bandInfo = WifiBand::BAND_24GHZ_5GHZ_6GHZ; + } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND && + legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND) { + aidl_radio_mode_info->bandInfo = WifiBand::BAND_5GHZ_6GHZ; + } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND) { + aidl_radio_mode_info->bandInfo = WifiBand::BAND_6GHZ; + } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND && + legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND) { + aidl_radio_mode_info->bandInfo = WifiBand::BAND_24GHZ_5GHZ; + } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND) { + aidl_radio_mode_info->bandInfo = WifiBand::BAND_24GHZ; + } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND) { + aidl_radio_mode_info->bandInfo = WifiBand::BAND_5GHZ; + } else { + aidl_radio_mode_info->bandInfo = WifiBand::BAND_UNSPECIFIED; + } + std::vector iface_info_vec; + for (const auto& legacy_iface_info : legacy_mac_info.iface_infos) { + IWifiChipEventCallback::IfaceInfo iface_info; + iface_info.name = legacy_iface_info.name; + iface_info.channel = legacy_iface_info.channel; + iface_info_vec.push_back(iface_info); + } + aidl_radio_mode_info->ifaceInfos = iface_info_vec; + return true; +} + +uint32_t convertAidlWifiBandToLegacyMacBand(WifiBand aidl_band) { + switch (aidl_band) { + case WifiBand::BAND_24GHZ: + return legacy_hal::WLAN_MAC_2_4_BAND; + case WifiBand::BAND_5GHZ: + case WifiBand::BAND_5GHZ_DFS: + case WifiBand::BAND_5GHZ_WITH_DFS: + return legacy_hal::WLAN_MAC_5_0_BAND; + case WifiBand::BAND_24GHZ_5GHZ: + case WifiBand::BAND_24GHZ_5GHZ_WITH_DFS: + return (legacy_hal::WLAN_MAC_2_4_BAND | legacy_hal::WLAN_MAC_5_0_BAND); + case WifiBand::BAND_6GHZ: + return legacy_hal::WLAN_MAC_6_0_BAND; + case WifiBand::BAND_5GHZ_6GHZ: + return (legacy_hal::WLAN_MAC_5_0_BAND | legacy_hal::WLAN_MAC_6_0_BAND); + case WifiBand::BAND_24GHZ_5GHZ_6GHZ: + case WifiBand::BAND_24GHZ_5GHZ_WITH_DFS_6GHZ: + return (legacy_hal::WLAN_MAC_2_4_BAND | legacy_hal::WLAN_MAC_5_0_BAND | + legacy_hal::WLAN_MAC_6_0_BAND); + case WifiBand::BAND_60GHZ: + return legacy_hal::WLAN_MAC_60_0_BAND; + default: + return (legacy_hal::WLAN_MAC_2_4_BAND | legacy_hal::WLAN_MAC_5_0_BAND | + legacy_hal::WLAN_MAC_6_0_BAND | legacy_hal::WLAN_MAC_60_0_BAND); + } +} + +WifiBand convertLegacyMacBandToAidlWifiBand(uint32_t band) { + switch (band) { + case legacy_hal::WLAN_MAC_2_4_BAND: + return WifiBand::BAND_24GHZ; + case legacy_hal::WLAN_MAC_5_0_BAND: + return WifiBand::BAND_5GHZ; + case legacy_hal::WLAN_MAC_6_0_BAND: + return WifiBand::BAND_6GHZ; + case legacy_hal::WLAN_MAC_60_0_BAND: + return WifiBand::BAND_60GHZ; + default: + return WifiBand::BAND_UNSPECIFIED; + } +} + +uint32_t convertAidlWifiIfaceModeToLegacy(uint32_t aidl_iface_mask) { + uint32_t legacy_iface_mask = 0; + if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_STA)) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_STA); + } + if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_SOFTAP)) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_SOFTAP); + } + if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_P2P_CLIENT)) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_P2P_CLIENT); + } + if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_P2P_GO)) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_P2P_GO); + } + if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_NAN)) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_NAN); + } + if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_TDLS)) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_TDLS); + } + if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_MESH)) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_MESH); + } + if (aidl_iface_mask & static_cast(WifiIfaceMode::IFACE_MODE_IBSS)) { + legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_IBSS); + } + return legacy_iface_mask; +} + +uint32_t convertLegacyWifiInterfaceModeToAidl(uint32_t legacy_iface_mask) { + uint32_t aidl_iface_mask = 0; + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_STA)) { + aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_STA); + } + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_SOFTAP)) { + aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_SOFTAP); + } + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_P2P_CLIENT)) { + aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_P2P_CLIENT); + } + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_P2P_GO)) { + aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_P2P_GO); + } + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_NAN)) { + aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_NAN); + } + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_TDLS)) { + aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_TDLS); + } + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_MESH)) { + aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_MESH); + } + if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_IBSS)) { + aidl_iface_mask |= static_cast(WifiIfaceMode::IFACE_MODE_IBSS); + } + return aidl_iface_mask; +} + +uint32_t convertAidlUsableChannelFilterToLegacy(uint32_t aidl_filter_mask) { + uint32_t legacy_filter_mask = 0; + if (aidl_filter_mask & + static_cast(IWifiChip::UsableChannelFilter::CELLULAR_COEXISTENCE)) { + legacy_filter_mask |= legacy_hal::WIFI_USABLE_CHANNEL_FILTER_CELLULAR_COEXISTENCE; + } + if (aidl_filter_mask & static_cast(IWifiChip::UsableChannelFilter::CONCURRENCY)) { + legacy_filter_mask |= legacy_hal::WIFI_USABLE_CHANNEL_FILTER_CONCURRENCY; + } + if (aidl_filter_mask & static_cast(IWifiChip::UsableChannelFilter::NAN_INSTANT_MODE)) { + legacy_filter_mask |= WIFI_USABLE_CHANNEL_FILTER_NAN_INSTANT_MODE; + } + return legacy_filter_mask; +} + +bool convertLegacyWifiUsableChannelToAidl( + const legacy_hal::wifi_usable_channel& legacy_usable_channel, + WifiUsableChannel* aidl_usable_channel) { + if (!aidl_usable_channel) { + return false; + } + *aidl_usable_channel = {}; + aidl_usable_channel->channel = legacy_usable_channel.freq; + aidl_usable_channel->channelBandwidth = + convertLegacyWifiChannelWidthToAidl(legacy_usable_channel.width); + aidl_usable_channel->ifaceModeMask = static_cast( + convertLegacyWifiInterfaceModeToAidl(legacy_usable_channel.iface_mode_mask)); + + return true; +} + +bool convertLegacyWifiUsableChannelsToAidl( + const std::vector& legacy_usable_channels, + std::vector* aidl_usable_channels) { + if (!aidl_usable_channels) { + return false; + } + *aidl_usable_channels = {}; + for (const auto& legacy_usable_channel : legacy_usable_channels) { + WifiUsableChannel aidl_usable_channel; + if (!convertLegacyWifiUsableChannelToAidl(legacy_usable_channel, &aidl_usable_channel)) { + return false; + } + aidl_usable_channels->push_back(aidl_usable_channel); + } + return true; +} + +bool convertLegacyWifiMacInfosToAidl( + const std::vector& legacy_mac_infos, + std::vector* aidl_radio_mode_infos) { + if (!aidl_radio_mode_infos) { + return false; + } + *aidl_radio_mode_infos = {}; + + for (const auto& legacy_mac_info : legacy_mac_infos) { + IWifiChipEventCallback::RadioModeInfo aidl_radio_mode_info; + if (!convertLegacyWifiMacInfoToAidl(legacy_mac_info, &aidl_radio_mode_info)) { + return false; + } + aidl_radio_mode_infos->push_back(aidl_radio_mode_info); + } + return true; +} + +bool convertLegacyFeaturesToAidlStaCapabilities(uint64_t legacy_feature_set, + uint32_t legacy_logger_feature_set, + uint32_t* aidl_caps) { + if (!aidl_caps) { + return false; + } + *aidl_caps = {}; + for (const auto feature : {legacy_hal::WIFI_LOGGER_PACKET_FATE_SUPPORTED}) { + if (feature & legacy_logger_feature_set) { + *aidl_caps |= static_cast( + convertLegacyLoggerFeatureToAidlStaIfaceCapability(feature)); + } + } + for (const auto feature : + {WIFI_FEATURE_GSCAN, WIFI_FEATURE_LINK_LAYER_STATS, WIFI_FEATURE_RSSI_MONITOR, + WIFI_FEATURE_CONTROL_ROAMING, WIFI_FEATURE_IE_WHITELIST, WIFI_FEATURE_SCAN_RAND, + WIFI_FEATURE_INFRA_5G, WIFI_FEATURE_HOTSPOT, WIFI_FEATURE_PNO, WIFI_FEATURE_TDLS, + WIFI_FEATURE_TDLS_OFFCHANNEL, WIFI_FEATURE_CONFIG_NDO, WIFI_FEATURE_MKEEP_ALIVE}) { + if (feature & legacy_feature_set) { + *aidl_caps |= + static_cast(convertLegacyFeatureToAidlStaIfaceCapability(feature)); + } + } + // There is no flag for this one in the legacy feature set. Adding it to the + // set because all the current devices support it. + *aidl_caps |= static_cast(IWifiStaIface::StaIfaceCapabilityMask::APF); + return true; +} + +bool convertLegacyApfCapabilitiesToAidl(const legacy_hal::PacketFilterCapabilities& legacy_caps, + StaApfPacketFilterCapabilities* aidl_caps) { + if (!aidl_caps) { + return false; + } + *aidl_caps = {}; + aidl_caps->version = legacy_caps.version; + aidl_caps->maxLength = legacy_caps.max_len; + return true; +} + +uint8_t convertAidlGscanReportEventFlagToLegacy( + StaBackgroundScanBucketEventReportSchemeMask aidl_flag) { + using AidlFlag = StaBackgroundScanBucketEventReportSchemeMask; + switch (aidl_flag) { + case AidlFlag::EACH_SCAN: + return REPORT_EVENTS_EACH_SCAN; + case AidlFlag::FULL_RESULTS: + return REPORT_EVENTS_FULL_RESULTS; + case AidlFlag::NO_BATCH: + return REPORT_EVENTS_NO_BATCH; + }; + CHECK(false); +} + +StaScanDataFlagMask convertLegacyGscanDataFlagToAidl(uint8_t legacy_flag) { + switch (legacy_flag) { + case legacy_hal::WIFI_SCAN_FLAG_INTERRUPTED: + return StaScanDataFlagMask::INTERRUPTED; + }; + CHECK(false) << "Unknown legacy flag: " << legacy_flag; + // To silence the compiler warning about reaching the end of non-void + // function. + return {}; +} + +bool convertLegacyGscanCapabilitiesToAidl(const legacy_hal::wifi_gscan_capabilities& legacy_caps, + StaBackgroundScanCapabilities* aidl_caps) { + if (!aidl_caps) { + return false; + } + *aidl_caps = {}; + aidl_caps->maxCacheSize = legacy_caps.max_scan_cache_size; + aidl_caps->maxBuckets = legacy_caps.max_scan_buckets; + aidl_caps->maxApCachePerScan = legacy_caps.max_ap_cache_per_scan; + aidl_caps->maxReportingThreshold = legacy_caps.max_scan_reporting_threshold; + return true; +} + +legacy_hal::wifi_band convertAidlWifiBandToLegacy(WifiBand band) { + switch (band) { + case WifiBand::BAND_UNSPECIFIED: + return legacy_hal::WIFI_BAND_UNSPECIFIED; + case WifiBand::BAND_24GHZ: + return legacy_hal::WIFI_BAND_BG; + case WifiBand::BAND_5GHZ: + return legacy_hal::WIFI_BAND_A; + case WifiBand::BAND_5GHZ_DFS: + return legacy_hal::WIFI_BAND_A_DFS; + case WifiBand::BAND_5GHZ_WITH_DFS: + return legacy_hal::WIFI_BAND_A_WITH_DFS; + case WifiBand::BAND_24GHZ_5GHZ: + return legacy_hal::WIFI_BAND_ABG; + case WifiBand::BAND_24GHZ_5GHZ_WITH_DFS: + return legacy_hal::WIFI_BAND_ABG_WITH_DFS; + default: + CHECK(false); + return {}; + }; +} + +bool convertAidlGscanParamsToLegacy(const StaBackgroundScanParameters& aidl_scan_params, + legacy_hal::wifi_scan_cmd_params* legacy_scan_params) { + if (!legacy_scan_params) { + return false; + } + *legacy_scan_params = {}; + legacy_scan_params->base_period = aidl_scan_params.basePeriodInMs; + legacy_scan_params->max_ap_per_scan = aidl_scan_params.maxApPerScan; + legacy_scan_params->report_threshold_percent = aidl_scan_params.reportThresholdPercent; + legacy_scan_params->report_threshold_num_scans = aidl_scan_params.reportThresholdNumScans; + if (aidl_scan_params.buckets.size() > MAX_BUCKETS) { + return false; + } + legacy_scan_params->num_buckets = aidl_scan_params.buckets.size(); + for (uint32_t bucket_idx = 0; bucket_idx < aidl_scan_params.buckets.size(); bucket_idx++) { + const StaBackgroundScanBucketParameters& aidl_bucket_spec = + aidl_scan_params.buckets[bucket_idx]; + legacy_hal::wifi_scan_bucket_spec& legacy_bucket_spec = + legacy_scan_params->buckets[bucket_idx]; + if (aidl_bucket_spec.bucketIdx >= MAX_BUCKETS) { + return false; + } + legacy_bucket_spec.bucket = aidl_bucket_spec.bucketIdx; + legacy_bucket_spec.band = convertAidlWifiBandToLegacy(aidl_bucket_spec.band); + legacy_bucket_spec.period = aidl_bucket_spec.periodInMs; + legacy_bucket_spec.max_period = aidl_bucket_spec.exponentialMaxPeriodInMs; + legacy_bucket_spec.base = aidl_bucket_spec.exponentialBase; + legacy_bucket_spec.step_count = aidl_bucket_spec.exponentialStepCount; + legacy_bucket_spec.report_events = 0; + using AidlFlag = StaBackgroundScanBucketEventReportSchemeMask; + for (const auto flag : {AidlFlag::EACH_SCAN, AidlFlag::FULL_RESULTS, AidlFlag::NO_BATCH}) { + if (static_cast(aidl_bucket_spec.eventReportScheme) & + static_cast::type>(flag)) { + legacy_bucket_spec.report_events |= convertAidlGscanReportEventFlagToLegacy(flag); + } + } + if (aidl_bucket_spec.frequencies.size() > MAX_CHANNELS) { + return false; + } + legacy_bucket_spec.num_channels = aidl_bucket_spec.frequencies.size(); + for (uint32_t freq_idx = 0; freq_idx < aidl_bucket_spec.frequencies.size(); freq_idx++) { + legacy_bucket_spec.channels[freq_idx].channel = aidl_bucket_spec.frequencies[freq_idx]; + } + } + return true; +} + +bool convertLegacyIeToAidl(const legacy_hal::wifi_information_element& legacy_ie, + WifiInformationElement* aidl_ie) { + if (!aidl_ie) { + return false; + } + *aidl_ie = {}; + aidl_ie->id = legacy_ie.id; + aidl_ie->data = std::vector(legacy_ie.data, legacy_ie.data + legacy_ie.len); + return true; +} + +bool convertLegacyIeBlobToAidl(const uint8_t* ie_blob, uint32_t ie_blob_len, + std::vector* aidl_ies) { + if (!ie_blob || !aidl_ies) { + return false; + } + *aidl_ies = {}; + const uint8_t* ies_begin = ie_blob; + const uint8_t* ies_end = ie_blob + ie_blob_len; + const uint8_t* next_ie = ies_begin; + using wifi_ie = legacy_hal::wifi_information_element; + constexpr size_t kIeHeaderLen = sizeof(wifi_ie); + // Each IE should at least have the header (i.e |id| & |len| fields). + while (next_ie + kIeHeaderLen <= ies_end) { + const wifi_ie& legacy_ie = (*reinterpret_cast(next_ie)); + uint32_t curr_ie_len = kIeHeaderLen + legacy_ie.len; + if (next_ie + curr_ie_len > ies_end) { + LOG(ERROR) << "Error parsing IE blob. Next IE: " << (void*)next_ie + << ", Curr IE len: " << curr_ie_len << ", IEs End: " << (void*)ies_end; + break; + } + WifiInformationElement aidl_ie; + if (!convertLegacyIeToAidl(legacy_ie, &aidl_ie)) { + LOG(ERROR) << "Error converting IE. Id: " << legacy_ie.id << ", len: " << legacy_ie.len; + break; + } + aidl_ies->push_back(std::move(aidl_ie)); + next_ie += curr_ie_len; + } + // Check if the blob has been fully consumed. + if (next_ie != ies_end) { + LOG(ERROR) << "Failed to fully parse IE blob. Next IE: " << (void*)next_ie + << ", IEs End: " << (void*)ies_end; + } + return true; +} + +bool convertLegacyGscanResultToAidl(const legacy_hal::wifi_scan_result& legacy_scan_result, + bool has_ie_data, StaScanResult* aidl_scan_result) { + if (!aidl_scan_result) { + return false; + } + *aidl_scan_result = {}; + aidl_scan_result->timeStampInUs = legacy_scan_result.ts; + aidl_scan_result->ssid = std::vector( + legacy_scan_result.ssid, + legacy_scan_result.ssid + + strnlen(legacy_scan_result.ssid, sizeof(legacy_scan_result.ssid) - 1)); + aidl_scan_result->bssid = std::array(); + std::copy(legacy_scan_result.bssid, legacy_scan_result.bssid + 6, + std::begin(aidl_scan_result->bssid)); + aidl_scan_result->frequency = legacy_scan_result.channel; + aidl_scan_result->rssi = legacy_scan_result.rssi; + aidl_scan_result->beaconPeriodInMs = legacy_scan_result.beacon_period; + aidl_scan_result->capability = legacy_scan_result.capability; + if (has_ie_data) { + std::vector ies; + if (!convertLegacyIeBlobToAidl(reinterpret_cast(legacy_scan_result.ie_data), + legacy_scan_result.ie_length, &ies)) { + return false; + } + aidl_scan_result->informationElements = std::move(ies); + } + return true; +} + +bool convertLegacyCachedGscanResultsToAidl( + const legacy_hal::wifi_cached_scan_results& legacy_cached_scan_result, + StaScanData* aidl_scan_data) { + if (!aidl_scan_data) { + return false; + } + *aidl_scan_data = {}; + int32_t flags = 0; + for (const auto flag : {legacy_hal::WIFI_SCAN_FLAG_INTERRUPTED}) { + if (legacy_cached_scan_result.flags & flag) { + flags |= static_cast::type>( + convertLegacyGscanDataFlagToAidl(flag)); + } + } + aidl_scan_data->flags = static_cast(flags); + aidl_scan_data->bucketsScanned = legacy_cached_scan_result.buckets_scanned; + + CHECK(legacy_cached_scan_result.num_results >= 0 && + legacy_cached_scan_result.num_results <= MAX_AP_CACHE_PER_SCAN); + std::vector aidl_scan_results; + for (int32_t result_idx = 0; result_idx < legacy_cached_scan_result.num_results; result_idx++) { + StaScanResult aidl_scan_result; + if (!convertLegacyGscanResultToAidl(legacy_cached_scan_result.results[result_idx], false, + &aidl_scan_result)) { + return false; + } + aidl_scan_results.push_back(aidl_scan_result); + } + aidl_scan_data->results = std::move(aidl_scan_results); + return true; +} + +bool convertLegacyVectorOfCachedGscanResultsToAidl( + const std::vector& legacy_cached_scan_results, + std::vector* aidl_scan_datas) { + if (!aidl_scan_datas) { + return false; + } + *aidl_scan_datas = {}; + for (const auto& legacy_cached_scan_result : legacy_cached_scan_results) { + StaScanData aidl_scan_data; + if (!convertLegacyCachedGscanResultsToAidl(legacy_cached_scan_result, &aidl_scan_data)) { + return false; + } + aidl_scan_datas->push_back(aidl_scan_data); + } + return true; +} + +WifiDebugTxPacketFate convertLegacyDebugTxPacketFateToAidl(legacy_hal::wifi_tx_packet_fate fate) { + switch (fate) { + case legacy_hal::TX_PKT_FATE_ACKED: + return WifiDebugTxPacketFate::ACKED; + case legacy_hal::TX_PKT_FATE_SENT: + return WifiDebugTxPacketFate::SENT; + case legacy_hal::TX_PKT_FATE_FW_QUEUED: + return WifiDebugTxPacketFate::FW_QUEUED; + case legacy_hal::TX_PKT_FATE_FW_DROP_INVALID: + return WifiDebugTxPacketFate::FW_DROP_INVALID; + case legacy_hal::TX_PKT_FATE_FW_DROP_NOBUFS: + return WifiDebugTxPacketFate::FW_DROP_NOBUFS; + case legacy_hal::TX_PKT_FATE_FW_DROP_OTHER: + return WifiDebugTxPacketFate::FW_DROP_OTHER; + case legacy_hal::TX_PKT_FATE_DRV_QUEUED: + return WifiDebugTxPacketFate::DRV_QUEUED; + case legacy_hal::TX_PKT_FATE_DRV_DROP_INVALID: + return WifiDebugTxPacketFate::DRV_DROP_INVALID; + case legacy_hal::TX_PKT_FATE_DRV_DROP_NOBUFS: + return WifiDebugTxPacketFate::DRV_DROP_NOBUFS; + case legacy_hal::TX_PKT_FATE_DRV_DROP_OTHER: + return WifiDebugTxPacketFate::DRV_DROP_OTHER; + }; + CHECK(false) << "Unknown legacy fate type: " << fate; +} + +WifiDebugRxPacketFate convertLegacyDebugRxPacketFateToAidl(legacy_hal::wifi_rx_packet_fate fate) { + switch (fate) { + case legacy_hal::RX_PKT_FATE_SUCCESS: + return WifiDebugRxPacketFate::SUCCESS; + case legacy_hal::RX_PKT_FATE_FW_QUEUED: + return WifiDebugRxPacketFate::FW_QUEUED; + case legacy_hal::RX_PKT_FATE_FW_DROP_FILTER: + return WifiDebugRxPacketFate::FW_DROP_FILTER; + case legacy_hal::RX_PKT_FATE_FW_DROP_INVALID: + return WifiDebugRxPacketFate::FW_DROP_INVALID; + case legacy_hal::RX_PKT_FATE_FW_DROP_NOBUFS: + return WifiDebugRxPacketFate::FW_DROP_NOBUFS; + case legacy_hal::RX_PKT_FATE_FW_DROP_OTHER: + return WifiDebugRxPacketFate::FW_DROP_OTHER; + case legacy_hal::RX_PKT_FATE_DRV_QUEUED: + return WifiDebugRxPacketFate::DRV_QUEUED; + case legacy_hal::RX_PKT_FATE_DRV_DROP_FILTER: + return WifiDebugRxPacketFate::DRV_DROP_FILTER; + case legacy_hal::RX_PKT_FATE_DRV_DROP_INVALID: + return WifiDebugRxPacketFate::DRV_DROP_INVALID; + case legacy_hal::RX_PKT_FATE_DRV_DROP_NOBUFS: + return WifiDebugRxPacketFate::DRV_DROP_NOBUFS; + case legacy_hal::RX_PKT_FATE_DRV_DROP_OTHER: + return WifiDebugRxPacketFate::DRV_DROP_OTHER; + }; + CHECK(false) << "Unknown legacy fate type: " << fate; +} + +WifiDebugPacketFateFrameType convertLegacyDebugPacketFateFrameTypeToAidl( + legacy_hal::frame_type type) { + switch (type) { + case legacy_hal::FRAME_TYPE_UNKNOWN: + return WifiDebugPacketFateFrameType::UNKNOWN; + case legacy_hal::FRAME_TYPE_ETHERNET_II: + return WifiDebugPacketFateFrameType::ETHERNET_II; + case legacy_hal::FRAME_TYPE_80211_MGMT: + return WifiDebugPacketFateFrameType::MGMT_80211; + }; + CHECK(false) << "Unknown legacy frame type: " << type; +} + +bool convertLegacyDebugPacketFateFrameToAidl(const legacy_hal::frame_info& legacy_frame, + WifiDebugPacketFateFrameInfo* aidl_frame) { + if (!aidl_frame) { + return false; + } + *aidl_frame = {}; + aidl_frame->frameType = convertLegacyDebugPacketFateFrameTypeToAidl(legacy_frame.payload_type); + aidl_frame->frameLen = legacy_frame.frame_len; + aidl_frame->driverTimestampUsec = legacy_frame.driver_timestamp_usec; + aidl_frame->firmwareTimestampUsec = legacy_frame.firmware_timestamp_usec; + const uint8_t* frame_begin = + reinterpret_cast(legacy_frame.frame_content.ethernet_ii_bytes); + aidl_frame->frameContent = + std::vector(frame_begin, frame_begin + legacy_frame.frame_len); + return true; +} + +bool convertLegacyDebugTxPacketFateToAidl(const legacy_hal::wifi_tx_report& legacy_fate, + WifiDebugTxPacketFateReport* aidl_fate) { + if (!aidl_fate) { + return false; + } + *aidl_fate = {}; + aidl_fate->fate = convertLegacyDebugTxPacketFateToAidl(legacy_fate.fate); + return convertLegacyDebugPacketFateFrameToAidl(legacy_fate.frame_inf, &aidl_fate->frameInfo); +} + +bool convertLegacyVectorOfDebugTxPacketFateToAidl( + const std::vector& legacy_fates, + std::vector* aidl_fates) { + if (!aidl_fates) { + return false; + } + *aidl_fates = {}; + for (const auto& legacy_fate : legacy_fates) { + WifiDebugTxPacketFateReport aidl_fate; + if (!convertLegacyDebugTxPacketFateToAidl(legacy_fate, &aidl_fate)) { + return false; + } + aidl_fates->push_back(aidl_fate); + } + return true; +} + +bool convertLegacyDebugRxPacketFateToAidl(const legacy_hal::wifi_rx_report& legacy_fate, + WifiDebugRxPacketFateReport* aidl_fate) { + if (!aidl_fate) { + return false; + } + *aidl_fate = {}; + aidl_fate->fate = convertLegacyDebugRxPacketFateToAidl(legacy_fate.fate); + return convertLegacyDebugPacketFateFrameToAidl(legacy_fate.frame_inf, &aidl_fate->frameInfo); +} + +bool convertLegacyVectorOfDebugRxPacketFateToAidl( + const std::vector& legacy_fates, + std::vector* aidl_fates) { + if (!aidl_fates) { + return false; + } + *aidl_fates = {}; + for (const auto& legacy_fate : legacy_fates) { + WifiDebugRxPacketFateReport aidl_fate; + if (!convertLegacyDebugRxPacketFateToAidl(legacy_fate, &aidl_fate)) { + return false; + } + aidl_fates->push_back(aidl_fate); + } + return true; +} + +bool convertLegacyLinkLayerRadioStatsToAidl( + const legacy_hal::LinkLayerRadioStats& legacy_radio_stat, + StaLinkLayerRadioStats* aidl_radio_stat) { + if (!aidl_radio_stat) { + return false; + } + *aidl_radio_stat = {}; + + aidl_radio_stat->radioId = legacy_radio_stat.stats.radio; + aidl_radio_stat->onTimeInMs = legacy_radio_stat.stats.on_time; + aidl_radio_stat->txTimeInMs = legacy_radio_stat.stats.tx_time; + aidl_radio_stat->rxTimeInMs = legacy_radio_stat.stats.rx_time; + aidl_radio_stat->onTimeInMsForScan = legacy_radio_stat.stats.on_time_scan; + aidl_radio_stat->txTimeInMsPerLevel = uintToIntVec(legacy_radio_stat.tx_time_per_levels); + aidl_radio_stat->onTimeInMsForNanScan = legacy_radio_stat.stats.on_time_nbd; + aidl_radio_stat->onTimeInMsForBgScan = legacy_radio_stat.stats.on_time_gscan; + aidl_radio_stat->onTimeInMsForRoamScan = legacy_radio_stat.stats.on_time_roam_scan; + aidl_radio_stat->onTimeInMsForPnoScan = legacy_radio_stat.stats.on_time_pno_scan; + aidl_radio_stat->onTimeInMsForHs20Scan = legacy_radio_stat.stats.on_time_hs20; + + std::vector aidl_channel_stats; + + for (const auto& channel_stat : legacy_radio_stat.channel_stats) { + WifiChannelStats aidl_channel_stat; + aidl_channel_stat.onTimeInMs = channel_stat.on_time; + aidl_channel_stat.ccaBusyTimeInMs = channel_stat.cca_busy_time; + aidl_channel_stat.channel.width = WifiChannelWidthInMhz::WIDTH_20; + aidl_channel_stat.channel.centerFreq = channel_stat.channel.center_freq; + aidl_channel_stat.channel.centerFreq0 = channel_stat.channel.center_freq0; + aidl_channel_stat.channel.centerFreq1 = channel_stat.channel.center_freq1; + aidl_channel_stats.push_back(aidl_channel_stat); + } + + aidl_radio_stat->channelStats = aidl_channel_stats; + + return true; +} + +bool convertLegacyLinkLayerStatsToAidl(const legacy_hal::LinkLayerStats& legacy_stats, + StaLinkLayerStats* aidl_stats) { + if (!aidl_stats) { + return false; + } + *aidl_stats = {}; + // iface legacy_stats conversion. + aidl_stats->iface.beaconRx = legacy_stats.iface.beacon_rx; + aidl_stats->iface.avgRssiMgmt = legacy_stats.iface.rssi_mgmt; + aidl_stats->iface.wmeBePktStats.rxMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].rx_mpdu; + aidl_stats->iface.wmeBePktStats.txMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].tx_mpdu; + aidl_stats->iface.wmeBePktStats.lostMpdu = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].mpdu_lost; + aidl_stats->iface.wmeBePktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].retries; + aidl_stats->iface.wmeBeContentionTimeStats.contentionTimeMinInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_min; + aidl_stats->iface.wmeBeContentionTimeStats.contentionTimeMaxInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_max; + aidl_stats->iface.wmeBeContentionTimeStats.contentionTimeAvgInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_avg; + aidl_stats->iface.wmeBeContentionTimeStats.contentionNumSamples = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_num_samples; + aidl_stats->iface.wmeBkPktStats.rxMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].rx_mpdu; + aidl_stats->iface.wmeBkPktStats.txMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].tx_mpdu; + aidl_stats->iface.wmeBkPktStats.lostMpdu = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].mpdu_lost; + aidl_stats->iface.wmeBkPktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].retries; + aidl_stats->iface.wmeBkContentionTimeStats.contentionTimeMinInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_min; + aidl_stats->iface.wmeBkContentionTimeStats.contentionTimeMaxInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_max; + aidl_stats->iface.wmeBkContentionTimeStats.contentionTimeAvgInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_avg; + aidl_stats->iface.wmeBkContentionTimeStats.contentionNumSamples = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_num_samples; + aidl_stats->iface.wmeViPktStats.rxMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].rx_mpdu; + aidl_stats->iface.wmeViPktStats.txMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].tx_mpdu; + aidl_stats->iface.wmeViPktStats.lostMpdu = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].mpdu_lost; + aidl_stats->iface.wmeViPktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].retries; + aidl_stats->iface.wmeViContentionTimeStats.contentionTimeMinInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_min; + aidl_stats->iface.wmeViContentionTimeStats.contentionTimeMaxInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_max; + aidl_stats->iface.wmeViContentionTimeStats.contentionTimeAvgInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_avg; + aidl_stats->iface.wmeViContentionTimeStats.contentionNumSamples = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_num_samples; + aidl_stats->iface.wmeVoPktStats.rxMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].rx_mpdu; + aidl_stats->iface.wmeVoPktStats.txMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].tx_mpdu; + aidl_stats->iface.wmeVoPktStats.lostMpdu = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].mpdu_lost; + aidl_stats->iface.wmeVoPktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].retries; + aidl_stats->iface.wmeVoContentionTimeStats.contentionTimeMinInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_min; + aidl_stats->iface.wmeVoContentionTimeStats.contentionTimeMaxInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_max; + aidl_stats->iface.wmeVoContentionTimeStats.contentionTimeAvgInUsec = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_avg; + aidl_stats->iface.wmeVoContentionTimeStats.contentionNumSamples = + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_num_samples; + aidl_stats->iface.timeSliceDutyCycleInPercent = + legacy_stats.iface.info.time_slicing_duty_cycle_percent; + // peer info legacy_stats conversion. + std::vector aidl_peers_info_stats; + for (const auto& legacy_peer_info_stats : legacy_stats.peers) { + StaPeerInfo aidl_peer_info_stats; + if (!convertLegacyPeerInfoStatsToAidl(legacy_peer_info_stats, &aidl_peer_info_stats)) { + return false; + } + aidl_peers_info_stats.push_back(aidl_peer_info_stats); + } + aidl_stats->iface.peers = aidl_peers_info_stats; + // radio legacy_stats conversion. + std::vector aidl_radios_stats; + for (const auto& legacy_radio_stats : legacy_stats.radios) { + StaLinkLayerRadioStats aidl_radio_stats; + if (!convertLegacyLinkLayerRadioStatsToAidl(legacy_radio_stats, &aidl_radio_stats)) { + return false; + } + aidl_radios_stats.push_back(aidl_radio_stats); + } + aidl_stats->radios = aidl_radios_stats; + aidl_stats->timeStampInMs = ::android::uptimeMillis(); + return true; +} + +bool convertLegacyPeerInfoStatsToAidl(const legacy_hal::WifiPeerInfo& legacy_peer_info_stats, + StaPeerInfo* aidl_peer_info_stats) { + if (!aidl_peer_info_stats) { + return false; + } + *aidl_peer_info_stats = {}; + aidl_peer_info_stats->staCount = legacy_peer_info_stats.peer_info.bssload.sta_count; + aidl_peer_info_stats->chanUtil = legacy_peer_info_stats.peer_info.bssload.chan_util; + + std::vector aidlRateStats; + for (const auto& legacy_rate_stats : legacy_peer_info_stats.rate_stats) { + StaRateStat rateStat; + if (!convertLegacyWifiRateInfoToAidl(legacy_rate_stats.rate, &rateStat.rateInfo)) { + return false; + } + rateStat.txMpdu = legacy_rate_stats.tx_mpdu; + rateStat.rxMpdu = legacy_rate_stats.rx_mpdu; + rateStat.mpduLost = legacy_rate_stats.mpdu_lost; + rateStat.retries = legacy_rate_stats.retries; + aidlRateStats.push_back(rateStat); + } + aidl_peer_info_stats->rateStats = aidlRateStats; + return true; +} + +bool convertLegacyRoamingCapabilitiesToAidl( + const legacy_hal::wifi_roaming_capabilities& legacy_caps, + StaRoamingCapabilities* aidl_caps) { + if (!aidl_caps) { + return false; + } + *aidl_caps = {}; + aidl_caps->maxBlocklistSize = legacy_caps.max_blacklist_size; + aidl_caps->maxAllowlistSize = legacy_caps.max_whitelist_size; + return true; +} + +bool convertAidlRoamingConfigToLegacy(const StaRoamingConfig& aidl_config, + legacy_hal::wifi_roaming_config* legacy_config) { + if (!legacy_config) { + return false; + } + *legacy_config = {}; + if (aidl_config.bssidBlocklist.size() > MAX_BLACKLIST_BSSID || + aidl_config.ssidAllowlist.size() > MAX_WHITELIST_SSID) { + return false; + } + legacy_config->num_blacklist_bssid = aidl_config.bssidBlocklist.size(); + uint32_t i = 0; + for (const auto& bssid : aidl_config.bssidBlocklist) { + CHECK(bssid.data.size() == sizeof(legacy_hal::mac_addr)); + memcpy(legacy_config->blacklist_bssid[i++], bssid.data.data(), bssid.data.size()); + } + legacy_config->num_whitelist_ssid = aidl_config.ssidAllowlist.size(); + i = 0; + for (const auto& ssid : aidl_config.ssidAllowlist) { + CHECK(ssid.data.size() <= sizeof(legacy_hal::ssid_t::ssid_str)); + legacy_config->whitelist_ssid[i].length = ssid.data.size(); + memcpy(legacy_config->whitelist_ssid[i].ssid_str, ssid.data.data(), ssid.data.size()); + i++; + } + return true; +} + +legacy_hal::fw_roaming_state_t convertAidlRoamingStateToLegacy(StaRoamingState state) { + switch (state) { + case StaRoamingState::ENABLED: + return legacy_hal::ROAMING_ENABLE; + case StaRoamingState::DISABLED: + return legacy_hal::ROAMING_DISABLE; + }; + CHECK(false); +} + +legacy_hal::NanMatchAlg convertAidlNanMatchAlgToLegacy(NanMatchAlg type) { + switch (type) { + case NanMatchAlg::MATCH_ONCE: + return legacy_hal::NAN_MATCH_ALG_MATCH_ONCE; + case NanMatchAlg::MATCH_CONTINUOUS: + return legacy_hal::NAN_MATCH_ALG_MATCH_CONTINUOUS; + case NanMatchAlg::MATCH_NEVER: + return legacy_hal::NAN_MATCH_ALG_MATCH_NEVER; + } + CHECK(false); +} + +legacy_hal::NanPublishType convertAidlNanPublishTypeToLegacy(NanPublishType type) { + switch (type) { + case NanPublishType::UNSOLICITED: + return legacy_hal::NAN_PUBLISH_TYPE_UNSOLICITED; + case NanPublishType::SOLICITED: + return legacy_hal::NAN_PUBLISH_TYPE_SOLICITED; + case NanPublishType::UNSOLICITED_SOLICITED: + return legacy_hal::NAN_PUBLISH_TYPE_UNSOLICITED_SOLICITED; + } + CHECK(false); +} + +legacy_hal::NanTxType convertAidlNanTxTypeToLegacy(NanTxType type) { + switch (type) { + case NanTxType::BROADCAST: + return legacy_hal::NAN_TX_TYPE_BROADCAST; + case NanTxType::UNICAST: + return legacy_hal::NAN_TX_TYPE_UNICAST; + } + CHECK(false); +} + +legacy_hal::NanSubscribeType convertAidlNanSubscribeTypeToLegacy(NanSubscribeType type) { + switch (type) { + case NanSubscribeType::PASSIVE: + return legacy_hal::NAN_SUBSCRIBE_TYPE_PASSIVE; + case NanSubscribeType::ACTIVE: + return legacy_hal::NAN_SUBSCRIBE_TYPE_ACTIVE; + } + CHECK(false); +} + +legacy_hal::NanSRFType convertAidlNanSrfTypeToLegacy(NanSrfType type) { + switch (type) { + case NanSrfType::BLOOM_FILTER: + return legacy_hal::NAN_SRF_ATTR_BLOOM_FILTER; + case NanSrfType::PARTIAL_MAC_ADDR: + return legacy_hal::NAN_SRF_ATTR_PARTIAL_MAC_ADDR; + } + CHECK(false); +} + +legacy_hal::NanDataPathChannelCfg convertAidlNanDataPathChannelCfgToLegacy( + NanDataPathChannelCfg type) { + switch (type) { + case NanDataPathChannelCfg::CHANNEL_NOT_REQUESTED: + return legacy_hal::NAN_DP_CHANNEL_NOT_REQUESTED; + case NanDataPathChannelCfg::REQUEST_CHANNEL_SETUP: + return legacy_hal::NAN_DP_REQUEST_CHANNEL_SETUP; + case NanDataPathChannelCfg::FORCE_CHANNEL_SETUP: + return legacy_hal::NAN_DP_FORCE_CHANNEL_SETUP; + } + CHECK(false); +} + +NanStatusCode convertLegacyNanStatusTypeToAidl(legacy_hal::NanStatusType type) { + switch (type) { + case legacy_hal::NAN_STATUS_SUCCESS: + return NanStatusCode::SUCCESS; + case legacy_hal::NAN_STATUS_INTERNAL_FAILURE: + return NanStatusCode::INTERNAL_FAILURE; + case legacy_hal::NAN_STATUS_PROTOCOL_FAILURE: + return NanStatusCode::PROTOCOL_FAILURE; + case legacy_hal::NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID: + return NanStatusCode::INVALID_SESSION_ID; + case legacy_hal::NAN_STATUS_NO_RESOURCE_AVAILABLE: + return NanStatusCode::NO_RESOURCES_AVAILABLE; + case legacy_hal::NAN_STATUS_INVALID_PARAM: + return NanStatusCode::INVALID_ARGS; + case legacy_hal::NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID: + return NanStatusCode::INVALID_PEER_ID; + case legacy_hal::NAN_STATUS_INVALID_NDP_ID: + return NanStatusCode::INVALID_NDP_ID; + case legacy_hal::NAN_STATUS_NAN_NOT_ALLOWED: + return NanStatusCode::NAN_NOT_ALLOWED; + case legacy_hal::NAN_STATUS_NO_OTA_ACK: + return NanStatusCode::NO_OTA_ACK; + case legacy_hal::NAN_STATUS_ALREADY_ENABLED: + return NanStatusCode::ALREADY_ENABLED; + case legacy_hal::NAN_STATUS_FOLLOWUP_QUEUE_FULL: + return NanStatusCode::FOLLOWUP_TX_QUEUE_FULL; + case legacy_hal::NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED: + return NanStatusCode::UNSUPPORTED_CONCURRENCY_NAN_DISABLED; + } + CHECK(false); +} + +void convertToNanStatus(legacy_hal::NanStatusType type, const char* str, size_t max_len, + NanStatus* nanStatus) { + nanStatus->status = convertLegacyNanStatusTypeToAidl(type); + nanStatus->description = safeConvertChar(str, max_len); +} + +bool convertAidlNanEnableRequestToLegacy(const NanEnableRequest& aidl_request1, + const NanConfigRequestSupplemental& aidl_request2, + legacy_hal::NanEnableRequest* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertAidlNanEnableRequestToLegacy: null legacy_request"; + return false; + } + *legacy_request = {}; + + legacy_request->config_2dot4g_support = 1; + legacy_request->support_2dot4g_val = + aidl_request1.operateInBand[(size_t)NanBandIndex::NAN_BAND_24GHZ]; + legacy_request->config_support_5g = 1; + legacy_request->support_5g_val = + aidl_request1.operateInBand[(size_t)NanBandIndex::NAN_BAND_5GHZ]; + legacy_request->config_hop_count_limit = 1; + legacy_request->hop_count_limit_val = aidl_request1.hopCountMax; + legacy_request->master_pref = aidl_request1.configParams.masterPref; + legacy_request->discovery_indication_cfg = 0; + legacy_request->discovery_indication_cfg |= + aidl_request1.configParams.disableDiscoveryAddressChangeIndication ? 0x1 : 0x0; + legacy_request->discovery_indication_cfg |= + aidl_request1.configParams.disableStartedClusterIndication ? 0x2 : 0x0; + legacy_request->discovery_indication_cfg |= + aidl_request1.configParams.disableJoinedClusterIndication ? 0x4 : 0x0; + legacy_request->config_sid_beacon = 1; + if (aidl_request1.configParams.numberOfPublishServiceIdsInBeacon < 0) { + LOG(ERROR) << "convertAidlNanEnableRequestToLegacy: " + "numberOfPublishServiceIdsInBeacon < 0"; + return false; + } + legacy_request->sid_beacon_val = + (aidl_request1.configParams.includePublishServiceIdsInBeacon ? 0x1 : 0x0) | + (aidl_request1.configParams.numberOfPublishServiceIdsInBeacon << 1); + legacy_request->config_subscribe_sid_beacon = 1; + if (aidl_request1.configParams.numberOfSubscribeServiceIdsInBeacon < 0) { + LOG(ERROR) << "convertAidlNanEnableRequestToLegacy: " + "numberOfSubscribeServiceIdsInBeacon < 0"; + return false; + } + legacy_request->subscribe_sid_beacon_val = + (aidl_request1.configParams.includeSubscribeServiceIdsInBeacon ? 0x1 : 0x0) | + (aidl_request1.configParams.numberOfSubscribeServiceIdsInBeacon << 1); + legacy_request->config_rssi_window_size = 1; + legacy_request->rssi_window_size_val = aidl_request1.configParams.rssiWindowSize; + legacy_request->config_disc_mac_addr_randomization = 1; + legacy_request->disc_mac_addr_rand_interval_sec = + aidl_request1.configParams.macAddressRandomizationIntervalSec; + legacy_request->config_2dot4g_rssi_close = 1; + if (aidl_request1.configParams.bandSpecificConfig.size() != 3) { + LOG(ERROR) << "convertAidlNanEnableRequestToLegacy: " + "bandSpecificConfig.size() != 3"; + return false; + } + legacy_request->rssi_close_2dot4g_val = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .rssiClose; + legacy_request->config_2dot4g_rssi_middle = 1; + legacy_request->rssi_middle_2dot4g_val = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .rssiMiddle; + legacy_request->config_2dot4g_rssi_proximity = 1; + legacy_request->rssi_proximity_2dot4g_val = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .rssiCloseProximity; + legacy_request->config_scan_params = 1; + legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_24G_BAND] = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .dwellTimeMs; + legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_24G_BAND] = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .scanPeriodSec; + legacy_request->config_dw.config_2dot4g_dw_band = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .validDiscoveryWindowIntervalVal; + legacy_request->config_dw.dw_2dot4g_interval_val = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .discoveryWindowIntervalVal; + legacy_request->config_5g_rssi_close = 1; + legacy_request->rssi_close_5g_val = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .rssiClose; + legacy_request->config_5g_rssi_middle = 1; + legacy_request->rssi_middle_5g_val = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .rssiMiddle; + legacy_request->config_5g_rssi_close_proximity = 1; + legacy_request->rssi_close_proximity_5g_val = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .rssiCloseProximity; + legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .dwellTimeMs; + legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .scanPeriodSec; + legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .dwellTimeMs; + legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .scanPeriodSec; + legacy_request->config_dw.config_5g_dw_band = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .validDiscoveryWindowIntervalVal; + legacy_request->config_dw.dw_5g_interval_val = + aidl_request1.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .discoveryWindowIntervalVal; + if (aidl_request1.debugConfigs.validClusterIdVals) { + legacy_request->cluster_low = aidl_request1.debugConfigs.clusterIdBottomRangeVal; + legacy_request->cluster_high = aidl_request1.debugConfigs.clusterIdTopRangeVal; + } else { // need 'else' since not configurable in legacy HAL + legacy_request->cluster_low = 0x0000; + legacy_request->cluster_high = 0xFFFF; + } + legacy_request->config_intf_addr = aidl_request1.debugConfigs.validIntfAddrVal; + memcpy(legacy_request->intf_addr_val, aidl_request1.debugConfigs.intfAddrVal.data(), 6); + legacy_request->config_oui = aidl_request1.debugConfigs.validOuiVal; + legacy_request->oui_val = aidl_request1.debugConfigs.ouiVal; + legacy_request->config_random_factor_force = + aidl_request1.debugConfigs.validRandomFactorForceVal; + legacy_request->random_factor_force_val = aidl_request1.debugConfigs.randomFactorForceVal; + legacy_request->config_hop_count_force = aidl_request1.debugConfigs.validHopCountForceVal; + legacy_request->hop_count_force_val = aidl_request1.debugConfigs.hopCountForceVal; + legacy_request->config_24g_channel = aidl_request1.debugConfigs.validDiscoveryChannelVal; + legacy_request->channel_24g_val = + aidl_request1.debugConfigs.discoveryChannelMhzVal[(size_t)NanBandIndex::NAN_BAND_24GHZ]; + legacy_request->config_5g_channel = aidl_request1.debugConfigs.validDiscoveryChannelVal; + legacy_request->channel_5g_val = + aidl_request1.debugConfigs.discoveryChannelMhzVal[(size_t)NanBandIndex::NAN_BAND_5GHZ]; + legacy_request->config_2dot4g_beacons = aidl_request1.debugConfigs.validUseBeaconsInBandVal; + legacy_request->beacon_2dot4g_val = + aidl_request1.debugConfigs.useBeaconsInBandVal[(size_t)NanBandIndex::NAN_BAND_24GHZ]; + legacy_request->config_5g_beacons = aidl_request1.debugConfigs.validUseBeaconsInBandVal; + legacy_request->beacon_5g_val = + aidl_request1.debugConfigs.useBeaconsInBandVal[(size_t)NanBandIndex::NAN_BAND_5GHZ]; + legacy_request->config_2dot4g_sdf = aidl_request1.debugConfigs.validUseSdfInBandVal; + legacy_request->sdf_2dot4g_val = + aidl_request1.debugConfigs.useSdfInBandVal[(size_t)NanBandIndex::NAN_BAND_24GHZ]; + legacy_request->config_5g_sdf = aidl_request1.debugConfigs.validUseSdfInBandVal; + legacy_request->sdf_5g_val = + aidl_request1.debugConfigs.useSdfInBandVal[(size_t)NanBandIndex::NAN_BAND_5GHZ]; + + legacy_request->config_discovery_beacon_int = 1; + legacy_request->discovery_beacon_interval = aidl_request2.discoveryBeaconIntervalMs; + legacy_request->config_nss = 1; + legacy_request->nss = aidl_request2.numberOfSpatialStreamsInDiscovery; + legacy_request->config_dw_early_termination = 1; + legacy_request->enable_dw_termination = aidl_request2.enableDiscoveryWindowEarlyTermination; + legacy_request->config_enable_ranging = 1; + legacy_request->enable_ranging = aidl_request2.enableRanging; + + legacy_request->config_enable_instant_mode = 1; + legacy_request->enable_instant_mode = aidl_request2.enableInstantCommunicationMode; + legacy_request->config_instant_mode_channel = 1; + legacy_request->instant_mode_channel = aidl_request2.instantModeChannel; + + return true; +} + +bool convertAidlNanConfigRequestToLegacy(const NanConfigRequest& aidl_request1, + const NanConfigRequestSupplemental& aidl_request2, + legacy_hal::NanConfigRequest* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertAidlNanConfigRequestToLegacy: null legacy_request"; + return false; + } + *legacy_request = {}; + + legacy_request->master_pref = aidl_request1.masterPref; + legacy_request->discovery_indication_cfg = 0; + legacy_request->discovery_indication_cfg |= + aidl_request1.disableDiscoveryAddressChangeIndication ? 0x1 : 0x0; + legacy_request->discovery_indication_cfg |= + aidl_request1.disableStartedClusterIndication ? 0x2 : 0x0; + legacy_request->discovery_indication_cfg |= + aidl_request1.disableJoinedClusterIndication ? 0x4 : 0x0; + legacy_request->config_sid_beacon = 1; + if (aidl_request1.numberOfPublishServiceIdsInBeacon < 0) { + LOG(ERROR) << "convertAidlNanConfigRequestToLegacy: " + "numberOfPublishServiceIdsInBeacon < 0"; + return false; + } + legacy_request->sid_beacon = (aidl_request1.includePublishServiceIdsInBeacon ? 0x1 : 0x0) | + (aidl_request1.numberOfPublishServiceIdsInBeacon << 1); + legacy_request->config_subscribe_sid_beacon = 1; + if (aidl_request1.numberOfSubscribeServiceIdsInBeacon < 0) { + LOG(ERROR) << "convertAidlNanConfigRequestToLegacy: " + "numberOfSubscribeServiceIdsInBeacon < 0"; + return false; + } + legacy_request->subscribe_sid_beacon_val = + (aidl_request1.includeSubscribeServiceIdsInBeacon ? 0x1 : 0x0) | + (aidl_request1.numberOfSubscribeServiceIdsInBeacon << 1); + legacy_request->config_rssi_window_size = 1; + legacy_request->rssi_window_size_val = aidl_request1.rssiWindowSize; + legacy_request->config_disc_mac_addr_randomization = 1; + legacy_request->disc_mac_addr_rand_interval_sec = + aidl_request1.macAddressRandomizationIntervalSec; + + legacy_request->config_scan_params = 1; + legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_24G_BAND] = + aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ].dwellTimeMs; + legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_24G_BAND] = + aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ].scanPeriodSec; + legacy_request->config_dw.config_2dot4g_dw_band = + aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .validDiscoveryWindowIntervalVal; + legacy_request->config_dw.dw_2dot4g_interval_val = + aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] + .discoveryWindowIntervalVal; + + legacy_request->config_5g_rssi_close_proximity = 1; + legacy_request->rssi_close_proximity_5g_val = + aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .rssiCloseProximity; + legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = + aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].dwellTimeMs; + legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = + aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].scanPeriodSec; + legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = + aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].dwellTimeMs; + legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = + aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].scanPeriodSec; + legacy_request->config_dw.config_5g_dw_band = + aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .validDiscoveryWindowIntervalVal; + legacy_request->config_dw.dw_5g_interval_val = + aidl_request1.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] + .discoveryWindowIntervalVal; + + legacy_request->config_discovery_beacon_int = 1; + legacy_request->discovery_beacon_interval = aidl_request2.discoveryBeaconIntervalMs; + legacy_request->config_nss = 1; + legacy_request->nss = aidl_request2.numberOfSpatialStreamsInDiscovery; + legacy_request->config_dw_early_termination = 1; + legacy_request->enable_dw_termination = aidl_request2.enableDiscoveryWindowEarlyTermination; + legacy_request->config_enable_ranging = 1; + legacy_request->enable_ranging = aidl_request2.enableRanging; + + legacy_request->config_enable_instant_mode = 1; + legacy_request->enable_instant_mode = aidl_request2.enableInstantCommunicationMode; + legacy_request->config_instant_mode_channel = 1; + legacy_request->instant_mode_channel = aidl_request2.instantModeChannel; + + return true; +} + +bool convertAidlNanPublishRequestToLegacy(const NanPublishRequest& aidl_request, + legacy_hal::NanPublishRequest* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: null legacy_request"; + return false; + } + *legacy_request = {}; + + legacy_request->publish_id = aidl_request.baseConfigs.sessionId; + legacy_request->ttl = aidl_request.baseConfigs.ttlSec; + legacy_request->period = aidl_request.baseConfigs.discoveryWindowPeriod; + legacy_request->publish_count = aidl_request.baseConfigs.discoveryCount; + legacy_request->service_name_len = aidl_request.baseConfigs.serviceName.size(); + if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { + LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: service_name_len " + "too large"; + return false; + } + memcpy(legacy_request->service_name, aidl_request.baseConfigs.serviceName.data(), + legacy_request->service_name_len); + legacy_request->publish_match_indicator = + convertAidlNanMatchAlgToLegacy(aidl_request.baseConfigs.discoveryMatchIndicator); + legacy_request->service_specific_info_len = aidl_request.baseConfigs.serviceSpecificInfo.size(); + if (legacy_request->service_specific_info_len > NAN_MAX_SERVICE_SPECIFIC_INFO_LEN) { + LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: " + "service_specific_info_len too large"; + return false; + } + memcpy(legacy_request->service_specific_info, + aidl_request.baseConfigs.serviceSpecificInfo.data(), + legacy_request->service_specific_info_len); + legacy_request->sdea_service_specific_info_len = + aidl_request.baseConfigs.extendedServiceSpecificInfo.size(); + if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) { + LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: " + "sdea_service_specific_info_len too large"; + return false; + } + memcpy(legacy_request->sdea_service_specific_info, + aidl_request.baseConfigs.extendedServiceSpecificInfo.data(), + legacy_request->sdea_service_specific_info_len); + legacy_request->rx_match_filter_len = aidl_request.baseConfigs.rxMatchFilter.size(); + if (legacy_request->rx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { + LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: " + "rx_match_filter_len too large"; + return false; + } + memcpy(legacy_request->rx_match_filter, aidl_request.baseConfigs.rxMatchFilter.data(), + legacy_request->rx_match_filter_len); + legacy_request->tx_match_filter_len = aidl_request.baseConfigs.txMatchFilter.size(); + if (legacy_request->tx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { + LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: " + "tx_match_filter_len too large"; + return false; + } + memcpy(legacy_request->tx_match_filter, aidl_request.baseConfigs.txMatchFilter.data(), + legacy_request->tx_match_filter_len); + legacy_request->rssi_threshold_flag = aidl_request.baseConfigs.useRssiThreshold; + legacy_request->recv_indication_cfg = 0; + legacy_request->recv_indication_cfg |= + aidl_request.baseConfigs.disableDiscoveryTerminationIndication ? 0x1 : 0x0; + legacy_request->recv_indication_cfg |= + aidl_request.baseConfigs.disableMatchExpirationIndication ? 0x2 : 0x0; + legacy_request->recv_indication_cfg |= + aidl_request.baseConfigs.disableFollowupReceivedIndication ? 0x4 : 0x0; + legacy_request->recv_indication_cfg |= 0x8; + legacy_request->cipher_type = (unsigned int)aidl_request.baseConfigs.securityConfig.cipherType; + + legacy_request->scid_len = aidl_request.baseConfigs.securityConfig.scid.size(); + if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) { + LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: scid_len too large"; + return false; + } + memcpy(legacy_request->scid, aidl_request.baseConfigs.securityConfig.scid.data(), + legacy_request->scid_len); + + if (aidl_request.baseConfigs.securityConfig.securityType == NanDataPathSecurityType::PMK) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; + legacy_request->key_info.body.pmk_info.pmk_len = + aidl_request.baseConfigs.securityConfig.pmk.size(); + if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { + LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: invalid pmk_len"; + return false; + } + memcpy(legacy_request->key_info.body.pmk_info.pmk, + aidl_request.baseConfigs.securityConfig.pmk.data(), + legacy_request->key_info.body.pmk_info.pmk_len); + } + if (aidl_request.baseConfigs.securityConfig.securityType == + NanDataPathSecurityType::PASSPHRASE) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; + legacy_request->key_info.body.passphrase_info.passphrase_len = + aidl_request.baseConfigs.securityConfig.passphrase.size(); + if (legacy_request->key_info.body.passphrase_info.passphrase_len < + NAN_SECURITY_MIN_PASSPHRASE_LEN) { + LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: " + "passphrase_len too small"; + return false; + } + if (legacy_request->key_info.body.passphrase_info.passphrase_len > + NAN_SECURITY_MAX_PASSPHRASE_LEN) { + LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: " + "passphrase_len too large"; + return false; + } + memcpy(legacy_request->key_info.body.passphrase_info.passphrase, + aidl_request.baseConfigs.securityConfig.passphrase.data(), + legacy_request->key_info.body.passphrase_info.passphrase_len); + } + legacy_request->sdea_params.security_cfg = + (aidl_request.baseConfigs.securityConfig.securityType != NanDataPathSecurityType::OPEN) + ? legacy_hal::NAN_DP_CONFIG_SECURITY + : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; + + legacy_request->sdea_params.ranging_state = aidl_request.baseConfigs.rangingRequired + ? legacy_hal::NAN_RANGING_ENABLE + : legacy_hal::NAN_RANGING_DISABLE; + legacy_request->ranging_cfg.ranging_interval_msec = aidl_request.baseConfigs.rangingIntervalMs; + legacy_request->ranging_cfg.config_ranging_indications = + static_cast(aidl_request.baseConfigs.configRangingIndications); + legacy_request->ranging_cfg.distance_ingress_mm = + aidl_request.baseConfigs.distanceIngressCm * 10; + legacy_request->ranging_cfg.distance_egress_mm = aidl_request.baseConfigs.distanceEgressCm * 10; + legacy_request->ranging_auto_response = aidl_request.baseConfigs.rangingRequired + ? legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE + : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE; + legacy_request->sdea_params.range_report = legacy_hal::NAN_DISABLE_RANGE_REPORT; + legacy_request->publish_type = convertAidlNanPublishTypeToLegacy(aidl_request.publishType); + legacy_request->tx_type = convertAidlNanTxTypeToLegacy(aidl_request.txType); + legacy_request->service_responder_policy = aidl_request.autoAcceptDataPathRequests + ? legacy_hal::NAN_SERVICE_ACCEPT_POLICY_ALL + : legacy_hal::NAN_SERVICE_ACCEPT_POLICY_NONE; + + return true; +} + +bool convertAidlNanSubscribeRequestToLegacy(const NanSubscribeRequest& aidl_request, + legacy_hal::NanSubscribeRequest* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: legacy_request is null"; + return false; + } + *legacy_request = {}; + + legacy_request->subscribe_id = aidl_request.baseConfigs.sessionId; + legacy_request->ttl = aidl_request.baseConfigs.ttlSec; + legacy_request->period = aidl_request.baseConfigs.discoveryWindowPeriod; + legacy_request->subscribe_count = aidl_request.baseConfigs.discoveryCount; + legacy_request->service_name_len = aidl_request.baseConfigs.serviceName.size(); + if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { + LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " + "service_name_len too large"; + return false; + } + memcpy(legacy_request->service_name, aidl_request.baseConfigs.serviceName.data(), + legacy_request->service_name_len); + legacy_request->subscribe_match_indicator = + convertAidlNanMatchAlgToLegacy(aidl_request.baseConfigs.discoveryMatchIndicator); + legacy_request->service_specific_info_len = aidl_request.baseConfigs.serviceSpecificInfo.size(); + if (legacy_request->service_specific_info_len > NAN_MAX_SERVICE_SPECIFIC_INFO_LEN) { + LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " + "service_specific_info_len too large"; + return false; + } + memcpy(legacy_request->service_specific_info, + aidl_request.baseConfigs.serviceSpecificInfo.data(), + legacy_request->service_specific_info_len); + legacy_request->sdea_service_specific_info_len = + aidl_request.baseConfigs.extendedServiceSpecificInfo.size(); + if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) { + LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " + "sdea_service_specific_info_len too large"; + return false; + } + memcpy(legacy_request->sdea_service_specific_info, + aidl_request.baseConfigs.extendedServiceSpecificInfo.data(), + legacy_request->sdea_service_specific_info_len); + legacy_request->rx_match_filter_len = aidl_request.baseConfigs.rxMatchFilter.size(); + if (legacy_request->rx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { + LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " + "rx_match_filter_len too large"; + return false; + } + memcpy(legacy_request->rx_match_filter, aidl_request.baseConfigs.rxMatchFilter.data(), + legacy_request->rx_match_filter_len); + legacy_request->tx_match_filter_len = aidl_request.baseConfigs.txMatchFilter.size(); + if (legacy_request->tx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { + LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " + "tx_match_filter_len too large"; + return false; + } + memcpy(legacy_request->tx_match_filter, aidl_request.baseConfigs.txMatchFilter.data(), + legacy_request->tx_match_filter_len); + legacy_request->rssi_threshold_flag = aidl_request.baseConfigs.useRssiThreshold; + legacy_request->recv_indication_cfg = 0; + legacy_request->recv_indication_cfg |= + aidl_request.baseConfigs.disableDiscoveryTerminationIndication ? 0x1 : 0x0; + legacy_request->recv_indication_cfg |= + aidl_request.baseConfigs.disableMatchExpirationIndication ? 0x2 : 0x0; + legacy_request->recv_indication_cfg |= + aidl_request.baseConfigs.disableFollowupReceivedIndication ? 0x4 : 0x0; + legacy_request->cipher_type = (unsigned int)aidl_request.baseConfigs.securityConfig.cipherType; + if (aidl_request.baseConfigs.securityConfig.securityType == NanDataPathSecurityType::PMK) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; + legacy_request->key_info.body.pmk_info.pmk_len = + aidl_request.baseConfigs.securityConfig.pmk.size(); + if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { + LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: invalid pmk_len"; + return false; + } + memcpy(legacy_request->key_info.body.pmk_info.pmk, + aidl_request.baseConfigs.securityConfig.pmk.data(), + legacy_request->key_info.body.pmk_info.pmk_len); + } + if (aidl_request.baseConfigs.securityConfig.securityType == + NanDataPathSecurityType::PASSPHRASE) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; + legacy_request->key_info.body.passphrase_info.passphrase_len = + aidl_request.baseConfigs.securityConfig.passphrase.size(); + if (legacy_request->key_info.body.passphrase_info.passphrase_len < + NAN_SECURITY_MIN_PASSPHRASE_LEN) { + LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " + "passphrase_len too small"; + return false; + } + if (legacy_request->key_info.body.passphrase_info.passphrase_len > + NAN_SECURITY_MAX_PASSPHRASE_LEN) { + LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " + "passphrase_len too large"; + return false; + } + memcpy(legacy_request->key_info.body.passphrase_info.passphrase, + aidl_request.baseConfigs.securityConfig.passphrase.data(), + legacy_request->key_info.body.passphrase_info.passphrase_len); + } + legacy_request->sdea_params.security_cfg = + (aidl_request.baseConfigs.securityConfig.securityType != NanDataPathSecurityType::OPEN) + ? legacy_hal::NAN_DP_CONFIG_SECURITY + : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; + legacy_request->sdea_params.ranging_state = aidl_request.baseConfigs.rangingRequired + ? legacy_hal::NAN_RANGING_ENABLE + : legacy_hal::NAN_RANGING_DISABLE; + legacy_request->ranging_cfg.ranging_interval_msec = aidl_request.baseConfigs.rangingIntervalMs; + legacy_request->ranging_cfg.config_ranging_indications = + static_cast(aidl_request.baseConfigs.configRangingIndications); + legacy_request->ranging_cfg.distance_ingress_mm = + aidl_request.baseConfigs.distanceIngressCm * 10; + legacy_request->ranging_cfg.distance_egress_mm = aidl_request.baseConfigs.distanceEgressCm * 10; + legacy_request->ranging_auto_response = aidl_request.baseConfigs.rangingRequired + ? legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE + : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE; + legacy_request->sdea_params.range_report = legacy_hal::NAN_DISABLE_RANGE_REPORT; + legacy_request->subscribe_type = + convertAidlNanSubscribeTypeToLegacy(aidl_request.subscribeType); + legacy_request->serviceResponseFilter = convertAidlNanSrfTypeToLegacy(aidl_request.srfType); + legacy_request->serviceResponseInclude = aidl_request.srfRespondIfInAddressSet + ? legacy_hal::NAN_SRF_INCLUDE_RESPOND + : legacy_hal::NAN_SRF_INCLUDE_DO_NOT_RESPOND; + legacy_request->useServiceResponseFilter = + aidl_request.shouldUseSrf ? legacy_hal::NAN_USE_SRF : legacy_hal::NAN_DO_NOT_USE_SRF; + legacy_request->ssiRequiredForMatchIndication = + aidl_request.isSsiRequiredForMatch ? legacy_hal::NAN_SSI_REQUIRED_IN_MATCH_IND + : legacy_hal::NAN_SSI_NOT_REQUIRED_IN_MATCH_IND; + legacy_request->num_intf_addr_present = aidl_request.intfAddr.size(); + if (legacy_request->num_intf_addr_present > NAN_MAX_SUBSCRIBE_MAX_ADDRESS) { + LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: " + "num_intf_addr_present - too many"; + return false; + } + for (int i = 0; i < legacy_request->num_intf_addr_present; i++) { + memcpy(legacy_request->intf_addr[i], aidl_request.intfAddr[i].data.data(), 6); + } + + return true; +} + +bool convertAidlNanTransmitFollowupRequestToLegacy( + const NanTransmitFollowupRequest& aidl_request, + legacy_hal::NanTransmitFollowupRequest* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertAidlNanTransmitFollowupRequestToLegacy: " + "legacy_request is null"; + return false; + } + *legacy_request = {}; + + legacy_request->publish_subscribe_id = aidl_request.discoverySessionId; + legacy_request->requestor_instance_id = aidl_request.peerId; + memcpy(legacy_request->addr, aidl_request.addr.data(), 6); + legacy_request->priority = aidl_request.isHighPriority ? legacy_hal::NAN_TX_PRIORITY_HIGH + : legacy_hal::NAN_TX_PRIORITY_NORMAL; + legacy_request->dw_or_faw = aidl_request.shouldUseDiscoveryWindow + ? legacy_hal::NAN_TRANSMIT_IN_DW + : legacy_hal::NAN_TRANSMIT_IN_FAW; + legacy_request->service_specific_info_len = aidl_request.serviceSpecificInfo.size(); + if (legacy_request->service_specific_info_len > NAN_MAX_SERVICE_SPECIFIC_INFO_LEN) { + LOG(ERROR) << "convertAidlNanTransmitFollowupRequestToLegacy: " + "service_specific_info_len too large"; + return false; + } + memcpy(legacy_request->service_specific_info, aidl_request.serviceSpecificInfo.data(), + legacy_request->service_specific_info_len); + legacy_request->sdea_service_specific_info_len = + aidl_request.extendedServiceSpecificInfo.size(); + if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) { + LOG(ERROR) << "convertAidlNanTransmitFollowupRequestToLegacy: " + "sdea_service_specific_info_len too large"; + return false; + } + memcpy(legacy_request->sdea_service_specific_info, + aidl_request.extendedServiceSpecificInfo.data(), + legacy_request->sdea_service_specific_info_len); + legacy_request->recv_indication_cfg = aidl_request.disableFollowupResultIndication ? 0x1 : 0x0; + + return true; +} + +bool convertAidlNanDataPathInitiatorRequestToLegacy( + const NanInitiateDataPathRequest& aidl_request, + legacy_hal::NanDataPathInitiatorRequest* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: " + "legacy_request is null"; + return false; + } + *legacy_request = {}; + + legacy_request->requestor_instance_id = aidl_request.peerId; + memcpy(legacy_request->peer_disc_mac_addr, aidl_request.peerDiscMacAddr.data(), 6); + legacy_request->channel_request_type = + convertAidlNanDataPathChannelCfgToLegacy(aidl_request.channelRequestType); + legacy_request->channel = aidl_request.channel; + if (strnlen(aidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) { + LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: " + "ifaceName too long"; + return false; + } + strlcpy(legacy_request->ndp_iface, aidl_request.ifaceName.c_str(), IFNAMSIZ + 1); + legacy_request->ndp_cfg.security_cfg = + (aidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN) + ? legacy_hal::NAN_DP_CONFIG_SECURITY + : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; + legacy_request->app_info.ndp_app_info_len = aidl_request.appInfo.size(); + if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) { + LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: " + "ndp_app_info_len too large"; + return false; + } + memcpy(legacy_request->app_info.ndp_app_info, aidl_request.appInfo.data(), + legacy_request->app_info.ndp_app_info_len); + legacy_request->cipher_type = (unsigned int)aidl_request.securityConfig.cipherType; + if (aidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; + legacy_request->key_info.body.pmk_info.pmk_len = aidl_request.securityConfig.pmk.size(); + if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { + LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: " + "invalid pmk_len"; + return false; + } + memcpy(legacy_request->key_info.body.pmk_info.pmk, aidl_request.securityConfig.pmk.data(), + legacy_request->key_info.body.pmk_info.pmk_len); + } + if (aidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; + legacy_request->key_info.body.passphrase_info.passphrase_len = + aidl_request.securityConfig.passphrase.size(); + if (legacy_request->key_info.body.passphrase_info.passphrase_len < + NAN_SECURITY_MIN_PASSPHRASE_LEN) { + LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: " + "passphrase_len too small"; + return false; + } + if (legacy_request->key_info.body.passphrase_info.passphrase_len > + NAN_SECURITY_MAX_PASSPHRASE_LEN) { + LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: " + "passphrase_len too large"; + return false; + } + memcpy(legacy_request->key_info.body.passphrase_info.passphrase, + aidl_request.securityConfig.passphrase.data(), + legacy_request->key_info.body.passphrase_info.passphrase_len); + } + legacy_request->service_name_len = aidl_request.serviceNameOutOfBand.size(); + if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { + LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: " + "service_name_len too large"; + return false; + } + memcpy(legacy_request->service_name, aidl_request.serviceNameOutOfBand.data(), + legacy_request->service_name_len); + legacy_request->scid_len = aidl_request.securityConfig.scid.size(); + if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) { + LOG(ERROR) << "convertAidlNanDataPathInitiatorRequestToLegacy: scid_len too large"; + return false; + } + memcpy(legacy_request->scid, aidl_request.securityConfig.scid.data(), legacy_request->scid_len); + + return true; +} + +bool convertAidlNanDataPathIndicationResponseToLegacy( + const NanRespondToDataPathIndicationRequest& aidl_request, + legacy_hal::NanDataPathIndicationResponse* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: " + "legacy_request is null"; + return false; + } + *legacy_request = {}; + + legacy_request->rsp_code = aidl_request.acceptRequest ? legacy_hal::NAN_DP_REQUEST_ACCEPT + : legacy_hal::NAN_DP_REQUEST_REJECT; + legacy_request->ndp_instance_id = aidl_request.ndpInstanceId; + if (strnlen(aidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) { + LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: " + "ifaceName too long"; + return false; + } + strlcpy(legacy_request->ndp_iface, aidl_request.ifaceName.c_str(), IFNAMSIZ + 1); + legacy_request->ndp_cfg.security_cfg = + (aidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN) + ? legacy_hal::NAN_DP_CONFIG_SECURITY + : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; + legacy_request->app_info.ndp_app_info_len = aidl_request.appInfo.size(); + if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) { + LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: " + "ndp_app_info_len too large"; + return false; + } + memcpy(legacy_request->app_info.ndp_app_info, aidl_request.appInfo.data(), + legacy_request->app_info.ndp_app_info_len); + legacy_request->cipher_type = (unsigned int)aidl_request.securityConfig.cipherType; + if (aidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; + legacy_request->key_info.body.pmk_info.pmk_len = aidl_request.securityConfig.pmk.size(); + if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { + LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: " + "invalid pmk_len"; + return false; + } + memcpy(legacy_request->key_info.body.pmk_info.pmk, aidl_request.securityConfig.pmk.data(), + legacy_request->key_info.body.pmk_info.pmk_len); + } + if (aidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; + legacy_request->key_info.body.passphrase_info.passphrase_len = + aidl_request.securityConfig.passphrase.size(); + if (legacy_request->key_info.body.passphrase_info.passphrase_len < + NAN_SECURITY_MIN_PASSPHRASE_LEN) { + LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: " + "passphrase_len too small"; + return false; + } + if (legacy_request->key_info.body.passphrase_info.passphrase_len > + NAN_SECURITY_MAX_PASSPHRASE_LEN) { + LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: " + "passphrase_len too large"; + return false; + } + memcpy(legacy_request->key_info.body.passphrase_info.passphrase, + aidl_request.securityConfig.passphrase.data(), + legacy_request->key_info.body.passphrase_info.passphrase_len); + } + legacy_request->service_name_len = aidl_request.serviceNameOutOfBand.size(); + if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { + LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: " + "service_name_len too large"; + return false; + } + memcpy(legacy_request->service_name, aidl_request.serviceNameOutOfBand.data(), + legacy_request->service_name_len); + legacy_request->scid_len = aidl_request.securityConfig.scid.size(); + if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) { + LOG(ERROR) << "convertAidlNanDataPathIndicationResponseToLegacy: scid_len too large"; + return false; + } + memcpy(legacy_request->scid, aidl_request.securityConfig.scid.data(), legacy_request->scid_len); + + return true; +} + +bool convertLegacyNanResponseHeaderToAidl(const legacy_hal::NanResponseMsg& legacy_response, + NanStatus* nanStatus) { + if (!nanStatus) { + LOG(ERROR) << "convertLegacyNanResponseHeaderToAidl: nanStatus is null"; + return false; + } + *nanStatus = {}; + + convertToNanStatus(legacy_response.status, legacy_response.nan_error, + sizeof(legacy_response.nan_error), nanStatus); + return true; +} + +bool convertLegacyNanCapabilitiesResponseToAidl(const legacy_hal::NanCapabilities& legacy_response, + NanCapabilities* aidl_response) { + if (!aidl_response) { + LOG(ERROR) << "convertLegacyNanCapabilitiesResponseToAidl: " + "aidl_response is null"; + return false; + } + *aidl_response = {}; + + aidl_response->maxConcurrentClusters = legacy_response.max_concurrent_nan_clusters; + aidl_response->maxPublishes = legacy_response.max_publishes; + aidl_response->maxSubscribes = legacy_response.max_subscribes; + aidl_response->maxServiceNameLen = legacy_response.max_service_name_len; + aidl_response->maxMatchFilterLen = legacy_response.max_match_filter_len; + aidl_response->maxTotalMatchFilterLen = legacy_response.max_total_match_filter_len; + aidl_response->maxServiceSpecificInfoLen = legacy_response.max_service_specific_info_len; + aidl_response->maxExtendedServiceSpecificInfoLen = + legacy_response.max_sdea_service_specific_info_len; + aidl_response->maxNdiInterfaces = legacy_response.max_ndi_interfaces; + aidl_response->maxNdpSessions = legacy_response.max_ndp_sessions; + aidl_response->maxAppInfoLen = legacy_response.max_app_info_len; + aidl_response->maxQueuedTransmitFollowupMsgs = + legacy_response.max_queued_transmit_followup_msgs; + aidl_response->maxSubscribeInterfaceAddresses = legacy_response.max_subscribe_address; + aidl_response->supportedCipherSuites = + static_cast(legacy_response.cipher_suites_supported); + aidl_response->instantCommunicationModeSupportFlag = legacy_response.is_instant_mode_supported; + + return true; +} + +bool convertLegacyNanMatchIndToAidl(const legacy_hal::NanMatchInd& legacy_ind, + NanMatchInd* aidl_ind) { + if (!aidl_ind) { + LOG(ERROR) << "convertLegacyNanMatchIndToAidl: aidl_ind is null"; + return false; + } + *aidl_ind = {}; + + aidl_ind->discoverySessionId = legacy_ind.publish_subscribe_id; + aidl_ind->peerId = legacy_ind.requestor_instance_id; + aidl_ind->addr = std::array(); + std::copy(legacy_ind.addr, legacy_ind.addr + 6, std::begin(aidl_ind->addr)); + aidl_ind->serviceSpecificInfo = std::vector( + legacy_ind.service_specific_info, + legacy_ind.service_specific_info + legacy_ind.service_specific_info_len); + aidl_ind->extendedServiceSpecificInfo = std::vector( + legacy_ind.sdea_service_specific_info, + legacy_ind.sdea_service_specific_info + legacy_ind.sdea_service_specific_info_len); + aidl_ind->matchFilter = + std::vector(legacy_ind.sdf_match_filter, + legacy_ind.sdf_match_filter + legacy_ind.sdf_match_filter_len); + aidl_ind->matchOccurredInBeaconFlag = legacy_ind.match_occured_flag == 1; // NOTYPO + aidl_ind->outOfResourceFlag = legacy_ind.out_of_resource_flag == 1; + aidl_ind->rssiValue = legacy_ind.rssi_value; + aidl_ind->peerCipherType = (NanCipherSuiteType)legacy_ind.peer_cipher_type; + aidl_ind->peerRequiresSecurityEnabledInNdp = + legacy_ind.peer_sdea_params.security_cfg == legacy_hal::NAN_DP_CONFIG_SECURITY; + aidl_ind->peerRequiresRanging = + legacy_ind.peer_sdea_params.ranging_state == legacy_hal::NAN_RANGING_ENABLE; + aidl_ind->rangingMeasurementInMm = legacy_ind.range_info.range_measurement_mm; + aidl_ind->rangingIndicationType = + static_cast(legacy_ind.range_info.ranging_event_type); + aidl_ind->scid = std::vector(legacy_ind.scid, legacy_ind.scid + legacy_ind.scid_len); + return true; +} + +bool convertLegacyNanFollowupIndToAidl(const legacy_hal::NanFollowupInd& legacy_ind, + NanFollowupReceivedInd* aidl_ind) { + if (!aidl_ind) { + LOG(ERROR) << "convertLegacyNanFollowupIndToAidl: aidl_ind is null"; + return false; + } + *aidl_ind = {}; + + aidl_ind->discoverySessionId = legacy_ind.publish_subscribe_id; + aidl_ind->peerId = legacy_ind.requestor_instance_id; + aidl_ind->addr = std::array(); + std::copy(legacy_ind.addr, legacy_ind.addr + 6, std::begin(aidl_ind->addr)); + aidl_ind->receivedInFaw = legacy_ind.dw_or_faw == 1; + aidl_ind->serviceSpecificInfo = std::vector( + legacy_ind.service_specific_info, + legacy_ind.service_specific_info + legacy_ind.service_specific_info_len); + aidl_ind->extendedServiceSpecificInfo = std::vector( + legacy_ind.sdea_service_specific_info, + legacy_ind.sdea_service_specific_info + legacy_ind.sdea_service_specific_info_len); + + return true; +} + +bool convertLegacyNanDataPathRequestIndToAidl(const legacy_hal::NanDataPathRequestInd& legacy_ind, + NanDataPathRequestInd* aidl_ind) { + if (!aidl_ind) { + LOG(ERROR) << "convertLegacyNanDataPathRequestIndToAidl: aidl_ind is null"; + return false; + } + *aidl_ind = {}; + + aidl_ind->discoverySessionId = legacy_ind.service_instance_id; + aidl_ind->peerDiscMacAddr = std::array(); + std::copy(legacy_ind.peer_disc_mac_addr, legacy_ind.peer_disc_mac_addr + 6, + std::begin(aidl_ind->peerDiscMacAddr)); + aidl_ind->ndpInstanceId = legacy_ind.ndp_instance_id; + aidl_ind->securityRequired = + legacy_ind.ndp_cfg.security_cfg == legacy_hal::NAN_DP_CONFIG_SECURITY; + aidl_ind->appInfo = std::vector( + legacy_ind.app_info.ndp_app_info, + legacy_ind.app_info.ndp_app_info + legacy_ind.app_info.ndp_app_info_len); + + return true; +} + +bool convertLegacyNdpChannelInfoToAidl(const legacy_hal::NanChannelInfo& legacy_struct, + NanDataPathChannelInfo* aidl_struct) { + if (!aidl_struct) { + LOG(ERROR) << "convertLegacyNdpChannelInfoToAidl: aidl_struct is null"; + return false; + } + *aidl_struct = {}; + + aidl_struct->channelFreq = legacy_struct.channel; + aidl_struct->channelBandwidth = convertLegacyWifiChannelWidthToAidl( + (legacy_hal::wifi_channel_width)legacy_struct.bandwidth); + aidl_struct->numSpatialStreams = legacy_struct.nss; + + return true; +} + +bool convertLegacyNanDataPathConfirmIndToAidl(const legacy_hal::NanDataPathConfirmInd& legacy_ind, + NanDataPathConfirmInd* aidl_ind) { + if (!aidl_ind) { + LOG(ERROR) << "convertLegacyNanDataPathConfirmIndToAidl: aidl_ind is null"; + return false; + } + *aidl_ind = {}; + + aidl_ind->ndpInstanceId = legacy_ind.ndp_instance_id; + aidl_ind->dataPathSetupSuccess = legacy_ind.rsp_code == legacy_hal::NAN_DP_REQUEST_ACCEPT; + aidl_ind->peerNdiMacAddr = std::array(); + std::copy(legacy_ind.peer_ndi_mac_addr, legacy_ind.peer_ndi_mac_addr + 6, + std::begin(aidl_ind->peerNdiMacAddr)); + aidl_ind->appInfo = std::vector( + legacy_ind.app_info.ndp_app_info, + legacy_ind.app_info.ndp_app_info + legacy_ind.app_info.ndp_app_info_len); + aidl_ind->status.status = convertLegacyNanStatusTypeToAidl(legacy_ind.reason_code); + aidl_ind->status.description = ""; + + std::vector channelInfo; + for (unsigned int i = 0; i < legacy_ind.num_channels; ++i) { + NanDataPathChannelInfo aidl_struct; + if (!convertLegacyNdpChannelInfoToAidl(legacy_ind.channel_info[i], &aidl_struct)) { + return false; + } + channelInfo.push_back(aidl_struct); + } + aidl_ind->channelInfo = channelInfo; + + return true; +} + +bool convertLegacyNanDataPathScheduleUpdateIndToAidl( + const legacy_hal::NanDataPathScheduleUpdateInd& legacy_ind, + NanDataPathScheduleUpdateInd* aidl_ind) { + if (!aidl_ind) { + LOG(ERROR) << "convertLegacyNanDataPathScheduleUpdateIndToAidl: " + "aidl_ind is null"; + return false; + } + *aidl_ind = {}; + + aidl_ind->peerDiscoveryAddress = std::array(); + std::copy(legacy_ind.peer_mac_addr, legacy_ind.peer_mac_addr + 6, + std::begin(aidl_ind->peerDiscoveryAddress)); + std::vector channelInfo; + for (unsigned int i = 0; i < legacy_ind.num_channels; ++i) { + NanDataPathChannelInfo aidl_struct; + if (!convertLegacyNdpChannelInfoToAidl(legacy_ind.channel_info[i], &aidl_struct)) { + return false; + } + channelInfo.push_back(aidl_struct); + } + aidl_ind->channelInfo = channelInfo; + std::vector ndpInstanceIds; + for (unsigned int i = 0; i < legacy_ind.num_ndp_instances; ++i) { + ndpInstanceIds.push_back(legacy_ind.ndp_instance_id[i]); + } + aidl_ind->ndpInstanceIds = uintToIntVec(ndpInstanceIds); + + return true; +} + +legacy_hal::wifi_rtt_type convertAidlRttTypeToLegacy(RttType type) { + switch (type) { + case RttType::ONE_SIDED: + return legacy_hal::RTT_TYPE_1_SIDED; + case RttType::TWO_SIDED: + return legacy_hal::RTT_TYPE_2_SIDED; + }; + CHECK(false); +} + +RttType convertLegacyRttTypeToAidl(legacy_hal::wifi_rtt_type type) { + switch (type) { + case legacy_hal::RTT_TYPE_1_SIDED: + return RttType::ONE_SIDED; + case legacy_hal::RTT_TYPE_2_SIDED: + return RttType::TWO_SIDED; + }; + CHECK(false) << "Unknown legacy type: " << type; +} + +legacy_hal::rtt_peer_type convertAidlRttPeerTypeToLegacy(RttPeerType type) { + switch (type) { + case RttPeerType::AP: + return legacy_hal::RTT_PEER_AP; + case RttPeerType::STA: + return legacy_hal::RTT_PEER_STA; + case RttPeerType::P2P_GO: + return legacy_hal::RTT_PEER_P2P_GO; + case RttPeerType::P2P_CLIENT: + return legacy_hal::RTT_PEER_P2P_CLIENT; + case RttPeerType::NAN_TYPE: + return legacy_hal::RTT_PEER_NAN; + }; + CHECK(false); +} + +legacy_hal::wifi_channel_width convertAidlWifiChannelWidthToLegacy(WifiChannelWidthInMhz type) { + switch (type) { + case WifiChannelWidthInMhz::WIDTH_20: + return legacy_hal::WIFI_CHAN_WIDTH_20; + case WifiChannelWidthInMhz::WIDTH_40: + return legacy_hal::WIFI_CHAN_WIDTH_40; + case WifiChannelWidthInMhz::WIDTH_80: + return legacy_hal::WIFI_CHAN_WIDTH_80; + case WifiChannelWidthInMhz::WIDTH_160: + return legacy_hal::WIFI_CHAN_WIDTH_160; + case WifiChannelWidthInMhz::WIDTH_80P80: + return legacy_hal::WIFI_CHAN_WIDTH_80P80; + case WifiChannelWidthInMhz::WIDTH_5: + return legacy_hal::WIFI_CHAN_WIDTH_5; + case WifiChannelWidthInMhz::WIDTH_10: + return legacy_hal::WIFI_CHAN_WIDTH_10; + case WifiChannelWidthInMhz::WIDTH_320: + return legacy_hal::WIFI_CHAN_WIDTH_320; + case WifiChannelWidthInMhz::WIDTH_INVALID: + return legacy_hal::WIFI_CHAN_WIDTH_INVALID; + }; + CHECK(false); +} + +WifiChannelWidthInMhz convertLegacyWifiChannelWidthToAidl(legacy_hal::wifi_channel_width type) { + switch (type) { + case legacy_hal::WIFI_CHAN_WIDTH_20: + return WifiChannelWidthInMhz::WIDTH_20; + case legacy_hal::WIFI_CHAN_WIDTH_40: + return WifiChannelWidthInMhz::WIDTH_40; + case legacy_hal::WIFI_CHAN_WIDTH_80: + return WifiChannelWidthInMhz::WIDTH_80; + case legacy_hal::WIFI_CHAN_WIDTH_160: + return WifiChannelWidthInMhz::WIDTH_160; + case legacy_hal::WIFI_CHAN_WIDTH_80P80: + return WifiChannelWidthInMhz::WIDTH_80P80; + case legacy_hal::WIFI_CHAN_WIDTH_5: + return WifiChannelWidthInMhz::WIDTH_5; + case legacy_hal::WIFI_CHAN_WIDTH_10: + return WifiChannelWidthInMhz::WIDTH_10; + case legacy_hal::WIFI_CHAN_WIDTH_320: + return WifiChannelWidthInMhz::WIDTH_320; + default: + return WifiChannelWidthInMhz::WIDTH_INVALID; + }; +} + +legacy_hal::wifi_rtt_preamble convertAidlRttPreambleToLegacy(RttPreamble type) { + switch (type) { + case RttPreamble::LEGACY: + return legacy_hal::WIFI_RTT_PREAMBLE_LEGACY; + case RttPreamble::HT: + return legacy_hal::WIFI_RTT_PREAMBLE_HT; + case RttPreamble::VHT: + return legacy_hal::WIFI_RTT_PREAMBLE_VHT; + case RttPreamble::HE: + return legacy_hal::WIFI_RTT_PREAMBLE_HE; + case RttPreamble::EHT: + return legacy_hal::WIFI_RTT_PREAMBLE_EHT; + }; + CHECK(false); +} + +RttPreamble convertLegacyRttPreambleToAidl(legacy_hal::wifi_rtt_preamble type) { + switch (type) { + case legacy_hal::WIFI_RTT_PREAMBLE_LEGACY: + return RttPreamble::LEGACY; + case legacy_hal::WIFI_RTT_PREAMBLE_HT: + return RttPreamble::HT; + case legacy_hal::WIFI_RTT_PREAMBLE_VHT: + return RttPreamble::VHT; + case legacy_hal::WIFI_RTT_PREAMBLE_HE: + return RttPreamble::HE; + case legacy_hal::WIFI_RTT_PREAMBLE_EHT: + return RttPreamble::EHT; + }; + CHECK(false) << "Unknown legacy type: " << type; +} + +legacy_hal::wifi_rtt_bw convertAidlRttBwToLegacy(RttBw type) { + switch (type) { + case RttBw::BW_5MHZ: + return legacy_hal::WIFI_RTT_BW_5; + case RttBw::BW_10MHZ: + return legacy_hal::WIFI_RTT_BW_10; + case RttBw::BW_20MHZ: + return legacy_hal::WIFI_RTT_BW_20; + case RttBw::BW_40MHZ: + return legacy_hal::WIFI_RTT_BW_40; + case RttBw::BW_80MHZ: + return legacy_hal::WIFI_RTT_BW_80; + case RttBw::BW_160MHZ: + return legacy_hal::WIFI_RTT_BW_160; + case RttBw::BW_320MHZ: + return legacy_hal::WIFI_RTT_BW_320; + }; + CHECK(false); +} + +RttBw convertLegacyRttBwToAidl(legacy_hal::wifi_rtt_bw type) { + switch (type) { + case legacy_hal::WIFI_RTT_BW_5: + return RttBw::BW_5MHZ; + case legacy_hal::WIFI_RTT_BW_10: + return RttBw::BW_10MHZ; + case legacy_hal::WIFI_RTT_BW_20: + return RttBw::BW_20MHZ; + case legacy_hal::WIFI_RTT_BW_40: + return RttBw::BW_40MHZ; + case legacy_hal::WIFI_RTT_BW_80: + return RttBw::BW_80MHZ; + case legacy_hal::WIFI_RTT_BW_160: + return RttBw::BW_160MHZ; + case legacy_hal::WIFI_RTT_BW_320: + return RttBw::BW_320MHZ; + }; + CHECK(false) << "Unknown legacy type: " << type; +} + +legacy_hal::wifi_motion_pattern convertAidlRttMotionPatternToLegacy(RttMotionPattern type) { + switch (type) { + case RttMotionPattern::NOT_EXPECTED: + return legacy_hal::WIFI_MOTION_NOT_EXPECTED; + case RttMotionPattern::EXPECTED: + return legacy_hal::WIFI_MOTION_EXPECTED; + case RttMotionPattern::UNKNOWN: + return legacy_hal::WIFI_MOTION_UNKNOWN; + }; + CHECK(false); +} + +WifiRatePreamble convertLegacyWifiRatePreambleToAidl(uint8_t preamble) { + switch (preamble) { + case 0: + return WifiRatePreamble::OFDM; + case 1: + return WifiRatePreamble::CCK; + case 2: + return WifiRatePreamble::HT; + case 3: + return WifiRatePreamble::VHT; + case 4: + return WifiRatePreamble::HE; + case 5: + return WifiRatePreamble::EHT; + default: + return WifiRatePreamble::RESERVED; + }; + CHECK(false) << "Unknown legacy preamble: " << preamble; +} + +WifiRateNss convertLegacyWifiRateNssToAidl(uint8_t nss) { + switch (nss) { + case 0: + return WifiRateNss::NSS_1x1; + case 1: + return WifiRateNss::NSS_2x2; + case 2: + return WifiRateNss::NSS_3x3; + case 3: + return WifiRateNss::NSS_4x4; + }; + CHECK(false) << "Unknown legacy nss: " << nss; + return {}; +} + +RttStatus convertLegacyRttStatusToAidl(legacy_hal::wifi_rtt_status status) { + switch (status) { + case legacy_hal::RTT_STATUS_SUCCESS: + return RttStatus::SUCCESS; + case legacy_hal::RTT_STATUS_FAILURE: + return RttStatus::FAILURE; + case legacy_hal::RTT_STATUS_FAIL_NO_RSP: + return RttStatus::FAIL_NO_RSP; + case legacy_hal::RTT_STATUS_FAIL_REJECTED: + return RttStatus::FAIL_REJECTED; + case legacy_hal::RTT_STATUS_FAIL_NOT_SCHEDULED_YET: + return RttStatus::FAIL_NOT_SCHEDULED_YET; + case legacy_hal::RTT_STATUS_FAIL_TM_TIMEOUT: + return RttStatus::FAIL_TM_TIMEOUT; + case legacy_hal::RTT_STATUS_FAIL_AP_ON_DIFF_CHANNEL: + return RttStatus::FAIL_AP_ON_DIFF_CHANNEL; + case legacy_hal::RTT_STATUS_FAIL_NO_CAPABILITY: + return RttStatus::FAIL_NO_CAPABILITY; + case legacy_hal::RTT_STATUS_ABORTED: + return RttStatus::ABORTED; + case legacy_hal::RTT_STATUS_FAIL_INVALID_TS: + return RttStatus::FAIL_INVALID_TS; + case legacy_hal::RTT_STATUS_FAIL_PROTOCOL: + return RttStatus::FAIL_PROTOCOL; + case legacy_hal::RTT_STATUS_FAIL_SCHEDULE: + return RttStatus::FAIL_SCHEDULE; + case legacy_hal::RTT_STATUS_FAIL_BUSY_TRY_LATER: + return RttStatus::FAIL_BUSY_TRY_LATER; + case legacy_hal::RTT_STATUS_INVALID_REQ: + return RttStatus::INVALID_REQ; + case legacy_hal::RTT_STATUS_NO_WIFI: + return RttStatus::NO_WIFI; + case legacy_hal::RTT_STATUS_FAIL_FTM_PARAM_OVERRIDE: + return RttStatus::FAIL_FTM_PARAM_OVERRIDE; + case legacy_hal::RTT_STATUS_NAN_RANGING_PROTOCOL_FAILURE: + return RttStatus::NAN_RANGING_PROTOCOL_FAILURE; + case legacy_hal::RTT_STATUS_NAN_RANGING_CONCURRENCY_NOT_SUPPORTED: + return RttStatus::NAN_RANGING_CONCURRENCY_NOT_SUPPORTED; + }; + CHECK(false) << "Unknown legacy status: " << status; +} + +bool convertAidlWifiChannelInfoToLegacy(const WifiChannelInfo& aidl_info, + legacy_hal::wifi_channel_info* legacy_info) { + if (!legacy_info) { + return false; + } + *legacy_info = {}; + legacy_info->width = convertAidlWifiChannelWidthToLegacy(aidl_info.width); + legacy_info->center_freq = aidl_info.centerFreq; + legacy_info->center_freq0 = aidl_info.centerFreq0; + legacy_info->center_freq1 = aidl_info.centerFreq1; + return true; +} + +bool convertLegacyWifiChannelInfoToAidl(const legacy_hal::wifi_channel_info& legacy_info, + WifiChannelInfo* aidl_info) { + if (!aidl_info) { + return false; + } + *aidl_info = {}; + aidl_info->width = convertLegacyWifiChannelWidthToAidl(legacy_info.width); + aidl_info->centerFreq = legacy_info.center_freq; + aidl_info->centerFreq0 = legacy_info.center_freq0; + aidl_info->centerFreq1 = legacy_info.center_freq1; + return true; +} + +bool convertAidlRttConfigToLegacy(const RttConfig& aidl_config, + legacy_hal::wifi_rtt_config* legacy_config) { + if (!legacy_config) { + return false; + } + *legacy_config = {}; + CHECK(aidl_config.addr.size() == sizeof(legacy_config->addr)); + memcpy(legacy_config->addr, aidl_config.addr.data(), aidl_config.addr.size()); + legacy_config->type = convertAidlRttTypeToLegacy(aidl_config.type); + legacy_config->peer = convertAidlRttPeerTypeToLegacy(aidl_config.peer); + if (!convertAidlWifiChannelInfoToLegacy(aidl_config.channel, &legacy_config->channel)) { + return false; + } + legacy_config->burst_period = aidl_config.burstPeriod; + legacy_config->num_burst = aidl_config.numBurst; + legacy_config->num_frames_per_burst = aidl_config.numFramesPerBurst; + legacy_config->num_retries_per_rtt_frame = aidl_config.numRetriesPerRttFrame; + legacy_config->num_retries_per_ftmr = aidl_config.numRetriesPerFtmr; + legacy_config->LCI_request = aidl_config.mustRequestLci; + legacy_config->LCR_request = aidl_config.mustRequestLcr; + legacy_config->burst_duration = aidl_config.burstDuration; + legacy_config->preamble = convertAidlRttPreambleToLegacy(aidl_config.preamble); + legacy_config->bw = convertAidlRttBwToLegacy(aidl_config.bw); + return true; +} + +bool convertAidlVectorOfRttConfigToLegacy( + const std::vector& aidl_configs, + std::vector* legacy_configs) { + if (!legacy_configs) { + return false; + } + *legacy_configs = {}; + for (const auto& aidl_config : aidl_configs) { + legacy_hal::wifi_rtt_config legacy_config; + if (!convertAidlRttConfigToLegacy(aidl_config, &legacy_config)) { + return false; + } + legacy_configs->push_back(legacy_config); + } + return true; +} + +bool convertAidlRttLciInformationToLegacy(const RttLciInformation& aidl_info, + legacy_hal::wifi_lci_information* legacy_info) { + if (!legacy_info) { + return false; + } + *legacy_info = {}; + legacy_info->latitude = aidl_info.latitude; + legacy_info->longitude = aidl_info.longitude; + legacy_info->altitude = aidl_info.altitude; + legacy_info->latitude_unc = aidl_info.latitudeUnc; + legacy_info->longitude_unc = aidl_info.longitudeUnc; + legacy_info->altitude_unc = aidl_info.altitudeUnc; + legacy_info->motion_pattern = convertAidlRttMotionPatternToLegacy(aidl_info.motionPattern); + legacy_info->floor = aidl_info.floor; + legacy_info->height_above_floor = aidl_info.heightAboveFloor; + legacy_info->height_unc = aidl_info.heightUnc; + return true; +} + +bool convertAidlRttLcrInformationToLegacy(const RttLcrInformation& aidl_info, + legacy_hal::wifi_lcr_information* legacy_info) { + if (!legacy_info) { + return false; + } + *legacy_info = {}; + CHECK(aidl_info.countryCode.size() == sizeof(legacy_info->country_code)); + memcpy(legacy_info->country_code, aidl_info.countryCode.data(), aidl_info.countryCode.size()); + if (aidl_info.civicInfo.size() > sizeof(legacy_info->civic_info)) { + return false; + } + legacy_info->length = aidl_info.civicInfo.size(); + memcpy(legacy_info->civic_info, aidl_info.civicInfo.c_str(), aidl_info.civicInfo.size()); + return true; +} + +bool convertAidlRttResponderToLegacy(const RttResponder& aidl_responder, + legacy_hal::wifi_rtt_responder* legacy_responder) { + if (!legacy_responder) { + return false; + } + *legacy_responder = {}; + if (!convertAidlWifiChannelInfoToLegacy(aidl_responder.channel, &legacy_responder->channel)) { + return false; + } + legacy_responder->preamble = convertAidlRttPreambleToLegacy(aidl_responder.preamble); + return true; +} + +bool convertLegacyRttResponderToAidl(const legacy_hal::wifi_rtt_responder& legacy_responder, + RttResponder* aidl_responder) { + if (!aidl_responder) { + return false; + } + *aidl_responder = {}; + if (!convertLegacyWifiChannelInfoToAidl(legacy_responder.channel, &aidl_responder->channel)) { + return false; + } + aidl_responder->preamble = convertLegacyRttPreambleToAidl(legacy_responder.preamble); + return true; +} + +bool convertLegacyRttCapabilitiesToAidl( + const legacy_hal::wifi_rtt_capabilities& legacy_capabilities, + RttCapabilities* aidl_capabilities) { + if (!aidl_capabilities) { + return false; + } + *aidl_capabilities = {}; + aidl_capabilities->rttOneSidedSupported = legacy_capabilities.rtt_one_sided_supported; + aidl_capabilities->rttFtmSupported = legacy_capabilities.rtt_ftm_supported; + aidl_capabilities->lciSupported = legacy_capabilities.lci_support; + aidl_capabilities->lcrSupported = legacy_capabilities.lcr_support; + aidl_capabilities->responderSupported = legacy_capabilities.responder_supported; + int32_t preambleSupport = 0; + for (const auto flag : {legacy_hal::WIFI_RTT_PREAMBLE_LEGACY, legacy_hal::WIFI_RTT_PREAMBLE_HT, + legacy_hal::WIFI_RTT_PREAMBLE_VHT, legacy_hal::WIFI_RTT_PREAMBLE_HE, + legacy_hal::WIFI_RTT_PREAMBLE_EHT}) { + if (legacy_capabilities.preamble_support & flag) { + preambleSupport |= static_cast::type>( + convertLegacyRttPreambleToAidl(flag)); + } + } + aidl_capabilities->preambleSupport = static_cast(preambleSupport); + int32_t bwSupport = 0; + for (const auto flag : + {legacy_hal::WIFI_RTT_BW_5, legacy_hal::WIFI_RTT_BW_10, legacy_hal::WIFI_RTT_BW_20, + legacy_hal::WIFI_RTT_BW_40, legacy_hal::WIFI_RTT_BW_80, legacy_hal::WIFI_RTT_BW_160, + legacy_hal::WIFI_RTT_BW_320}) { + if (legacy_capabilities.bw_support & flag) { + bwSupport |= + static_cast::type>(convertLegacyRttBwToAidl(flag)); + } + } + aidl_capabilities->bwSupport = static_cast(bwSupport); + aidl_capabilities->mcVersion = legacy_capabilities.mc_version; + return true; +} + +bool convertLegacyWifiRateInfoToAidl(const legacy_hal::wifi_rate& legacy_rate, + WifiRateInfo* aidl_rate) { + if (!aidl_rate) { + return false; + } + *aidl_rate = {}; + aidl_rate->preamble = convertLegacyWifiRatePreambleToAidl(legacy_rate.preamble); + aidl_rate->nss = convertLegacyWifiRateNssToAidl(legacy_rate.nss); + aidl_rate->bw = convertLegacyWifiChannelWidthToAidl( + static_cast(legacy_rate.bw)); + aidl_rate->rateMcsIdx = legacy_rate.rateMcsIdx; + aidl_rate->bitRateInKbps = legacy_rate.bitrate; + return true; +} + +bool convertLegacyRttResultToAidl(const legacy_hal::wifi_rtt_result& legacy_result, + RttResult* aidl_result) { + if (!aidl_result) { + return false; + } + *aidl_result = {}; + aidl_result->addr = std::array(); + CHECK(sizeof(legacy_result.addr) == aidl_result->addr.size()); + std::copy(legacy_result.addr, legacy_result.addr + 6, std::begin(aidl_result->addr)); + aidl_result->burstNum = legacy_result.burst_num; + aidl_result->measurementNumber = legacy_result.measurement_number; + aidl_result->successNumber = legacy_result.success_number; + aidl_result->numberPerBurstPeer = legacy_result.number_per_burst_peer; + aidl_result->status = convertLegacyRttStatusToAidl(legacy_result.status); + aidl_result->retryAfterDuration = legacy_result.retry_after_duration; + aidl_result->type = convertLegacyRttTypeToAidl(legacy_result.type); + aidl_result->rssi = legacy_result.rssi; + aidl_result->rssiSpread = legacy_result.rssi_spread; + if (!convertLegacyWifiRateInfoToAidl(legacy_result.tx_rate, &aidl_result->txRate)) { + return false; + } + if (!convertLegacyWifiRateInfoToAidl(legacy_result.rx_rate, &aidl_result->rxRate)) { + return false; + } + aidl_result->rtt = legacy_result.rtt; + aidl_result->rttSd = legacy_result.rtt_sd; + aidl_result->rttSpread = legacy_result.rtt_spread; + aidl_result->distanceInMm = legacy_result.distance_mm; + aidl_result->distanceSdInMm = legacy_result.distance_sd_mm; + aidl_result->distanceSpreadInMm = legacy_result.distance_spread_mm; + aidl_result->timeStampInUs = legacy_result.ts; + aidl_result->burstDurationInMs = legacy_result.burst_duration; + aidl_result->negotiatedBurstNum = legacy_result.negotiated_burst_num; + if (legacy_result.LCI && !convertLegacyIeToAidl(*legacy_result.LCI, &aidl_result->lci)) { + return false; + } + if (legacy_result.LCR && !convertLegacyIeToAidl(*legacy_result.LCR, &aidl_result->lcr)) { + return false; + } + return true; +} + +bool convertLegacyVectorOfRttResultToAidl( + const std::vector& legacy_results, + std::vector* aidl_results) { + if (!aidl_results) { + return false; + } + *aidl_results = {}; + for (const auto legacy_result : legacy_results) { + RttResult aidl_result; + if (!convertLegacyRttResultToAidl(*legacy_result, &aidl_result)) { + return false; + } + aidl_results->push_back(aidl_result); + } + return true; +} + +legacy_hal::wifi_interface_type convertAidlIfaceTypeToLegacy(IfaceType aidl_interface_type) { + switch (aidl_interface_type) { + case IfaceType::STA: + return legacy_hal::WIFI_INTERFACE_TYPE_STA; + case IfaceType::AP: + return legacy_hal::WIFI_INTERFACE_TYPE_AP; + case IfaceType::P2P: + return legacy_hal::WIFI_INTERFACE_TYPE_P2P; + case IfaceType::NAN_IFACE: + return legacy_hal::WIFI_INTERFACE_TYPE_NAN; + } + CHECK(false); +} + +legacy_hal::wifi_multi_sta_use_case convertAidlMultiStaUseCaseToLegacy( + IWifiChip::MultiStaUseCase use_case) { + switch (use_case) { + case IWifiChip::MultiStaUseCase::DUAL_STA_TRANSIENT_PREFER_PRIMARY: + return legacy_hal::WIFI_DUAL_STA_TRANSIENT_PREFER_PRIMARY; + case IWifiChip::MultiStaUseCase::DUAL_STA_NON_TRANSIENT_UNBIASED: + return legacy_hal::WIFI_DUAL_STA_NON_TRANSIENT_UNBIASED; + } + CHECK(false); +} + +bool convertAidlCoexUnsafeChannelToLegacy( + const IWifiChip::CoexUnsafeChannel& aidl_unsafe_channel, + legacy_hal::wifi_coex_unsafe_channel* legacy_unsafe_channel) { + if (!legacy_unsafe_channel) { + return false; + } + *legacy_unsafe_channel = {}; + switch (aidl_unsafe_channel.band) { + case WifiBand::BAND_24GHZ: + legacy_unsafe_channel->band = legacy_hal::WLAN_MAC_2_4_BAND; + break; + case WifiBand::BAND_5GHZ: + legacy_unsafe_channel->band = legacy_hal::WLAN_MAC_5_0_BAND; + break; + default: + return false; + }; + legacy_unsafe_channel->channel = aidl_unsafe_channel.channel; + legacy_unsafe_channel->power_cap_dbm = aidl_unsafe_channel.powerCapDbm; + return true; +} + +bool convertAidlVectorOfCoexUnsafeChannelToLegacy( + const std::vector& aidl_unsafe_channels, + std::vector* legacy_unsafe_channels) { + if (!legacy_unsafe_channels) { + return false; + } + *legacy_unsafe_channels = {}; + for (const auto& aidl_unsafe_channel : aidl_unsafe_channels) { + legacy_hal::wifi_coex_unsafe_channel legacy_unsafe_channel; + if (!aidl_struct_util::convertAidlCoexUnsafeChannelToLegacy(aidl_unsafe_channel, + &legacy_unsafe_channel)) { + return false; + } + legacy_unsafe_channels->push_back(legacy_unsafe_channel); + } + return true; +} + +WifiAntennaMode convertLegacyAntennaConfigurationToAidl(uint32_t antenna_cfg) { + switch (antenna_cfg) { + case legacy_hal::WIFI_ANTENNA_1X1: + return WifiAntennaMode::WIFI_ANTENNA_MODE_1X1; + case legacy_hal::WIFI_ANTENNA_2X2: + return WifiAntennaMode::WIFI_ANTENNA_MODE_2X2; + case legacy_hal::WIFI_ANTENNA_3X3: + return WifiAntennaMode::WIFI_ANTENNA_MODE_3X3; + case legacy_hal::WIFI_ANTENNA_4X4: + return WifiAntennaMode::WIFI_ANTENNA_MODE_4X4; + default: + return WifiAntennaMode::WIFI_ANTENNA_MODE_UNSPECIFIED; + } +} + +bool convertLegacyWifiRadioConfigurationToAidl( + legacy_hal::wifi_radio_configuration* radio_configuration, + WifiRadioConfiguration* aidl_radio_configuration) { + if (!aidl_radio_configuration) { + return false; + } + *aidl_radio_configuration = {}; + aidl_radio_configuration->bandInfo = + aidl_struct_util::convertLegacyMacBandToAidlWifiBand(radio_configuration->band); + if (aidl_radio_configuration->bandInfo == WifiBand::BAND_UNSPECIFIED) { + LOG(ERROR) << "Unspecified band"; + return false; + } + aidl_radio_configuration->antennaMode = + aidl_struct_util::convertLegacyAntennaConfigurationToAidl( + radio_configuration->antenna_cfg); + return true; +} + +bool convertLegacyRadioCombinationsMatrixToAidl( + legacy_hal::wifi_radio_combination_matrix* legacy_matrix, + WifiRadioCombinationMatrix* aidl_matrix) { + if (!aidl_matrix || !legacy_matrix) { + return false; + } + *aidl_matrix = {}; + + int num_combinations = legacy_matrix->num_radio_combinations; + std::vector radio_combinations_vec; + if (!num_combinations) { + LOG(ERROR) << "zero radio combinations"; + return false; + } + wifi_radio_combination* l_radio_combinations_ptr = legacy_matrix->radio_combinations; + for (int i = 0; i < num_combinations; i++) { + int num_configurations = l_radio_combinations_ptr->num_radio_configurations; + WifiRadioCombination radioCombination; + std::vector radio_configurations_vec; + if (!num_configurations) { + LOG(ERROR) << "zero radio configurations"; + return false; + } + for (int j = 0; j < num_configurations; j++) { + WifiRadioConfiguration radioConfiguration; + wifi_radio_configuration* l_radio_configurations_ptr = + &l_radio_combinations_ptr->radio_configurations[j]; + if (!aidl_struct_util::convertLegacyWifiRadioConfigurationToAidl( + l_radio_configurations_ptr, &radioConfiguration)) { + LOG(ERROR) << "Error converting wifi radio configuration"; + return false; + } + radio_configurations_vec.push_back(radioConfiguration); + } + radioCombination.radioConfigurations = radio_configurations_vec; + radio_combinations_vec.push_back(radioCombination); + l_radio_combinations_ptr = + (wifi_radio_combination*)((u8*)l_radio_combinations_ptr + + sizeof(wifi_radio_combination) + + (sizeof(wifi_radio_configuration) * num_configurations)); + } + aidl_matrix->radioCombinations = radio_combinations_vec; + return true; +} + +} // namespace aidl_struct_util +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/aidl_struct_util.h b/wifi/aidl/default/aidl_struct_util.h new file mode 100644 index 0000000000..4ebfc10787 --- /dev/null +++ b/wifi/aidl/default/aidl_struct_util.h @@ -0,0 +1,180 @@ +/* + * 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. + */ + +#ifndef AIDL_STRUCT_UTIL_H_ +#define AIDL_STRUCT_UTIL_H_ + +#include +#include +#include +#include + +#include + +#include "wifi_legacy_hal.h" + +/** + * This file contains a bunch of functions to convert structs from the legacy + * HAL to AIDL and vice versa. + */ +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace aidl_struct_util { + +// Chip conversion methods. +bool convertLegacyFeaturesToAidlChipCapabilities(uint64_t legacy_feature_set, + uint32_t legacy_logger_feature_set, + uint32_t* aidl_caps); +bool convertLegacyDebugRingBufferStatusToAidl( + const legacy_hal::wifi_ring_buffer_status& legacy_status, + WifiDebugRingBufferStatus* aidl_status); +bool convertLegacyVectorOfDebugRingBufferStatusToAidl( + const std::vector& legacy_status_vec, + std::vector* aidl_status_vec); +bool convertLegacyWakeReasonStatsToAidl(const legacy_hal::WakeReasonStats& legacy_stats, + WifiDebugHostWakeReasonStats* aidl_stats); +legacy_hal::wifi_power_scenario convertAidlTxPowerScenarioToLegacy( + IWifiChip::TxPowerScenario aidl_scenario); +legacy_hal::wifi_latency_mode convertAidlLatencyModeToLegacy( + IWifiChip::LatencyMode aidl_latency_mode); +bool convertLegacyWifiMacInfosToAidl( + const std::vector& legacy_mac_infos, + std::vector* aidl_radio_mode_infos); +legacy_hal::wifi_interface_type convertAidlIfaceTypeToLegacy(IfaceType aidl_interface_type); +legacy_hal::wifi_multi_sta_use_case convertAidlMultiStaUseCaseToLegacy( + IWifiChip::MultiStaUseCase use_case); +bool convertAidlCoexUnsafeChannelToLegacy( + const IWifiChip::CoexUnsafeChannel& aidl_unsafe_channel, + legacy_hal::wifi_coex_unsafe_channel* legacy_unsafe_channel); +bool convertAidlVectorOfCoexUnsafeChannelToLegacy( + const std::vector& aidl_unsafe_channels, + std::vector* legacy_unsafe_channels); +bool convertLegacyRadioCombinationsMatrixToAidl( + legacy_hal::wifi_radio_combination_matrix* legacy_matrix, + WifiRadioCombinationMatrix* aidl_matrix); +WifiBand convertLegacyMacBandToAidlWifiBand(uint32_t band); +WifiAntennaMode convertLegacyAntennaConfigurationToAidl(uint32_t antenna_cfg); + +// STA iface conversion methods. +bool convertLegacyFeaturesToAidlStaCapabilities(uint64_t legacy_feature_set, + uint32_t legacy_logger_feature_set, + uint32_t* aidl_caps); +bool convertLegacyApfCapabilitiesToAidl(const legacy_hal::PacketFilterCapabilities& legacy_caps, + StaApfPacketFilterCapabilities* aidl_caps); +bool convertLegacyGscanCapabilitiesToAidl(const legacy_hal::wifi_gscan_capabilities& legacy_caps, + StaBackgroundScanCapabilities* aidl_caps); +legacy_hal::wifi_band convertAidlWifiBandToLegacy(WifiBand band); +bool convertAidlGscanParamsToLegacy(const StaBackgroundScanParameters& aidl_scan_params, + legacy_hal::wifi_scan_cmd_params* legacy_scan_params); +// |has_ie_data| indicates whether or not the wifi_scan_result includes 802.11 +// Information Elements (IEs) +bool convertLegacyGscanResultToAidl(const legacy_hal::wifi_scan_result& legacy_scan_result, + bool has_ie_data, StaScanResult* aidl_scan_result); +// |cached_results| is assumed to not include IEs. +bool convertLegacyVectorOfCachedGscanResultsToAidl( + const std::vector& legacy_cached_scan_results, + std::vector* aidl_scan_datas); +bool convertLegacyLinkLayerStatsToAidl(const legacy_hal::LinkLayerStats& legacy_stats, + StaLinkLayerStats* aidl_stats); +bool convertLegacyRoamingCapabilitiesToAidl( + const legacy_hal::wifi_roaming_capabilities& legacy_caps, + StaRoamingCapabilities* aidl_caps); +bool convertAidlRoamingConfigToLegacy(const StaRoamingConfig& aidl_config, + legacy_hal::wifi_roaming_config* legacy_config); +legacy_hal::fw_roaming_state_t convertAidlRoamingStateToLegacy(StaRoamingState state); +bool convertLegacyVectorOfDebugTxPacketFateToAidl( + const std::vector& legacy_fates, + std::vector* aidl_fates); +bool convertLegacyVectorOfDebugRxPacketFateToAidl( + const std::vector& legacy_fates, + std::vector* aidl_fates); + +// NAN iface conversion methods. +void convertToNanStatus(legacy_hal::NanStatusType type, const char* str, size_t max_len, + NanStatus* nanStatus); +bool convertAidlNanEnableRequestToLegacy(const NanEnableRequest& aidl_request1, + const NanConfigRequestSupplemental& aidl_request2, + legacy_hal::NanEnableRequest* legacy_request); +bool convertAidlNanConfigRequestToLegacy(const NanConfigRequest& aidl_request1, + const NanConfigRequestSupplemental& aidl_request2, + legacy_hal::NanConfigRequest* legacy_request); +bool convertAidlNanPublishRequestToLegacy(const NanPublishRequest& aidl_request, + legacy_hal::NanPublishRequest* legacy_request); +bool convertAidlNanSubscribeRequestToLegacy(const NanSubscribeRequest& aidl_request, + legacy_hal::NanSubscribeRequest* legacy_request); +bool convertAidlNanTransmitFollowupRequestToLegacy( + const NanTransmitFollowupRequest& aidl_request, + legacy_hal::NanTransmitFollowupRequest* legacy_request); +bool convertAidlNanDataPathInitiatorRequestToLegacy( + const NanInitiateDataPathRequest& aidl_request, + legacy_hal::NanDataPathInitiatorRequest* legacy_request); +bool convertAidlNanDataPathIndicationResponseToLegacy( + const NanRespondToDataPathIndicationRequest& aidl_response, + legacy_hal::NanDataPathIndicationResponse* legacy_response); +bool convertLegacyNanResponseHeaderToAidl(const legacy_hal::NanResponseMsg& legacy_response, + NanStatus* nanStatus); +bool convertLegacyNanCapabilitiesResponseToAidl(const legacy_hal::NanCapabilities& legacy_response, + NanCapabilities* aidl_response); +bool convertLegacyNanMatchIndToAidl(const legacy_hal::NanMatchInd& legacy_ind, + NanMatchInd* aidl_ind); +bool convertLegacyNanFollowupIndToAidl(const legacy_hal::NanFollowupInd& legacy_ind, + NanFollowupReceivedInd* aidl_ind); +bool convertLegacyNanDataPathRequestIndToAidl(const legacy_hal::NanDataPathRequestInd& legacy_ind, + NanDataPathRequestInd* aidl_ind); +bool convertLegacyNanDataPathConfirmIndToAidl(const legacy_hal::NanDataPathConfirmInd& legacy_ind, + NanDataPathConfirmInd* aidl_ind); +bool convertLegacyNanDataPathScheduleUpdateIndToAidl( + const legacy_hal::NanDataPathScheduleUpdateInd& legacy_ind, + NanDataPathScheduleUpdateInd* aidl_ind); + +// RTT controller conversion methods. +bool convertAidlVectorOfRttConfigToLegacy(const std::vector& aidl_configs, + std::vector* legacy_configs); +bool convertAidlRttLciInformationToLegacy(const RttLciInformation& aidl_info, + legacy_hal::wifi_lci_information* legacy_info); +bool convertAidlRttLcrInformationToLegacy(const RttLcrInformation& aidl_info, + legacy_hal::wifi_lcr_information* legacy_info); +bool convertAidlRttResponderToLegacy(const RttResponder& aidl_responder, + legacy_hal::wifi_rtt_responder* legacy_responder); +bool convertAidlWifiChannelInfoToLegacy(const WifiChannelInfo& aidl_info, + legacy_hal::wifi_channel_info* legacy_info); +bool convertLegacyRttResponderToAidl(const legacy_hal::wifi_rtt_responder& legacy_responder, + RttResponder* aidl_responder); +bool convertLegacyRttCapabilitiesToAidl( + const legacy_hal::wifi_rtt_capabilities& legacy_capabilities, + RttCapabilities* aidl_capabilities); +bool convertLegacyVectorOfRttResultToAidl( + const std::vector& legacy_results, + std::vector* aidl_results); +uint32_t convertAidlWifiBandToLegacyMacBand(WifiBand band); +uint32_t convertAidlWifiIfaceModeToLegacy(uint32_t aidl_iface_mask); +uint32_t convertAidlUsableChannelFilterToLegacy(uint32_t aidl_filter_mask); +bool convertLegacyWifiUsableChannelsToAidl( + const std::vector& legacy_usable_channels, + std::vector* aidl_usable_channels); +bool convertLegacyPeerInfoStatsToAidl(const legacy_hal::WifiPeerInfo& legacy_peer_info_stats, + StaPeerInfo* aidl_peer_info_stats); +bool convertLegacyWifiRateInfoToAidl(const legacy_hal::wifi_rate& legacy_rate, + WifiRateInfo* aidl_rate); +} // namespace aidl_struct_util +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // AIDL_STRUCT_UTIL_H_ diff --git a/wifi/aidl/default/aidl_sync_util.cpp b/wifi/aidl/default/aidl_sync_util.cpp new file mode 100644 index 0000000000..d81eb81182 --- /dev/null +++ b/wifi/aidl/default/aidl_sync_util.cpp @@ -0,0 +1,37 @@ +/* + * 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. + */ + +#include "aidl_sync_util.h" + +namespace { +std::recursive_mutex g_mutex; +} // namespace + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace aidl_sync_util { + +std::unique_lock acquireGlobalLock() { + return std::unique_lock{g_mutex}; +} + +} // namespace aidl_sync_util +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/aidl_sync_util.h b/wifi/aidl/default/aidl_sync_util.h new file mode 100644 index 0000000000..a61cd3f57c --- /dev/null +++ b/wifi/aidl/default/aidl_sync_util.h @@ -0,0 +1,35 @@ +/* + * 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. + */ + +#ifndef AIDL_SYNC_UTIL_H_ +#define AIDL_SYNC_UTIL_H_ + +#include + +// Utility that provides a global lock to synchronize access between +// the AIDL thread and the legacy HAL's event loop. +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace aidl_sync_util { +std::unique_lock acquireGlobalLock(); +} // namespace aidl_sync_util +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl +#endif // AIDL_SYNC_UTIL_H_ diff --git a/wifi/aidl/default/android.hardware.wifi-service-lazy.rc b/wifi/aidl/default/android.hardware.wifi-service-lazy.rc new file mode 100644 index 0000000000..12d3ff7bde --- /dev/null +++ b/wifi/aidl/default/android.hardware.wifi-service-lazy.rc @@ -0,0 +1,8 @@ +service vendor.wifi_hal_legacy /vendor/bin/hw/android.hardware.wifi-service-lazy + interface aidl android.hardware.wifi.IWifi/default + oneshot + disabled + class hal + capabilities NET_ADMIN NET_RAW SYS_MODULE + user wifi + group wifi gps diff --git a/wifi/aidl/default/android.hardware.wifi-service.rc b/wifi/aidl/default/android.hardware.wifi-service.rc new file mode 100644 index 0000000000..ec8acf5767 --- /dev/null +++ b/wifi/aidl/default/android.hardware.wifi-service.rc @@ -0,0 +1,6 @@ +service vendor.wifi_hal_legacy /vendor/bin/hw/android.hardware.wifi-service + interface aidl android.hardware.wifi.IWifi/default + class hal + capabilities NET_ADMIN NET_RAW SYS_MODULE + user wifi + group wifi gps diff --git a/wifi/aidl/default/android.hardware.wifi-service.xml b/wifi/aidl/default/android.hardware.wifi-service.xml new file mode 100644 index 0000000000..5398ee77b5 --- /dev/null +++ b/wifi/aidl/default/android.hardware.wifi-service.xml @@ -0,0 +1,6 @@ + + + android.hardware.wifi + IWifi/default + + diff --git a/wifi/aidl/default/ringbuffer.cpp b/wifi/aidl/default/ringbuffer.cpp new file mode 100644 index 0000000000..9d08a7368e --- /dev/null +++ b/wifi/aidl/default/ringbuffer.cpp @@ -0,0 +1,62 @@ +/* + * 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. + */ + +#include "ringbuffer.h" + +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { + +Ringbuffer::Ringbuffer(size_t maxSize) : size_(0), maxSize_(maxSize) {} + +enum Ringbuffer::AppendStatus Ringbuffer::append(const std::vector& input) { + if (input.size() == 0) { + return AppendStatus::FAIL_IP_BUFFER_ZERO; + } + if (input.size() > maxSize_) { + LOG(INFO) << "Oversized message of " << input.size() << " bytes is dropped"; + return AppendStatus::FAIL_IP_BUFFER_EXCEEDED_MAXSIZE; + } + data_.push_back(input); + size_ += input.size() * sizeof(input[0]); + while (size_ > maxSize_) { + if (data_.front().size() <= 0 || data_.front().size() > maxSize_) { + LOG(ERROR) << "First buffer in the ring buffer is Invalid. Size: " + << data_.front().size(); + return AppendStatus::FAIL_RING_BUFFER_CORRUPTED; + } + size_ -= data_.front().size() * sizeof(data_.front()[0]); + data_.pop_front(); + } + return AppendStatus::SUCCESS; +} + +const std::list>& Ringbuffer::getData() const { + return data_; +} + +void Ringbuffer::clear() { + data_.clear(); + size_ = 0; +} + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/ringbuffer.h b/wifi/aidl/default/ringbuffer.h new file mode 100644 index 0000000000..80c0c11045 --- /dev/null +++ b/wifi/aidl/default/ringbuffer.h @@ -0,0 +1,60 @@ +/* + * 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. + */ + +#ifndef RINGBUFFER_H_ +#define RINGBUFFER_H_ + +#include +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { + +/** + * Ringbuffer object used to store debug data. + */ +class Ringbuffer { + public: + // Error codes for the append ring buffer operation + enum AppendStatus { + SUCCESS, + FAIL_GENERIC, + FAIL_IP_BUFFER_ZERO, + FAIL_IP_BUFFER_EXCEEDED_MAXSIZE, + FAIL_RING_BUFFER_CORRUPTED + }; + explicit Ringbuffer(size_t maxSize); + + // Appends the data buffer and deletes from the front until buffer is + // within |maxSize_|. + enum AppendStatus append(const std::vector& input); + const std::list>& getData() const; + void clear(); + + private: + std::list> data_; + size_t size_; + size_t maxSize_; +}; + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // RINGBUFFER_H_ diff --git a/wifi/aidl/default/service.cpp b/wifi/aidl/default/service.cpp new file mode 100644 index 0000000000..789a7a5868 --- /dev/null +++ b/wifi/aidl/default/service.cpp @@ -0,0 +1,73 @@ +/* + * 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. + */ + +#include +#include +#include +#include + +#include "wifi.h" +#include "wifi_feature_flags.h" +#include "wifi_legacy_hal.h" +#include "wifi_legacy_hal_factory.h" +#include "wifi_mode_controller.h" + +using aidl::android::hardware::wifi::feature_flags::WifiFeatureFlags; +using aidl::android::hardware::wifi::legacy_hal::WifiLegacyHal; +using aidl::android::hardware::wifi::legacy_hal::WifiLegacyHalFactory; +using aidl::android::hardware::wifi::mode_controller::WifiModeController; + +#ifdef LAZY_SERVICE +const bool kLazyService = true; +#else +const bool kLazyService = false; +#endif + +int main(int /*argc*/, char** argv) { + signal(SIGPIPE, SIG_IGN); + android::base::InitLogging(argv, android::base::LogdLogger(android::base::SYSTEM)); + LOG(INFO) << "Wifi Hal is booting up..."; + + // Prepare the RPC-serving thread pool. Allocate 1 thread in the pool, + // which our main thread will join below. + ABinderProcess_setThreadPoolMaxThreadCount(1); + + const auto iface_tool = std::make_shared<::android::wifi_system::InterfaceTool>(); + const auto legacy_hal_factory = std::make_shared(iface_tool); + + // Setup binder service + std::shared_ptr service = + ndk::SharedRefBase::make( + iface_tool, legacy_hal_factory, std::make_shared(), + std::make_shared()); + std::string instance = + std::string() + aidl::android::hardware::wifi::Wifi::descriptor + "/default"; + if (kLazyService) { + auto result = + AServiceManager_registerLazyService(service->asBinder().get(), instance.c_str()); + CHECK_EQ(result, STATUS_OK) << "Failed to register lazy wifi HAL"; + } else { + auto result = AServiceManager_addService(service->asBinder().get(), instance.c_str()); + CHECK_EQ(result, STATUS_OK) << "Failed to register wifi HAL"; + } + + ABinderProcess_startThreadPool(); + LOG(INFO) << "Joining RPC thread pool"; + ABinderProcess_joinThreadPool(); + + LOG(INFO) << "Wifi Hal is terminating..."; + return 0; +} diff --git a/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp new file mode 100644 index 0000000000..4a69c2426b --- /dev/null +++ b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp @@ -0,0 +1,485 @@ +/* + * 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. + */ + +#include +#include +#include + +#include "aidl_struct_util.h" + +using testing::Test; + +namespace { +constexpr uint32_t kMacId1 = 1; +constexpr uint32_t kMacId2 = 2; +constexpr uint32_t kIfaceChannel1 = 3; +constexpr uint32_t kIfaceChannel2 = 5; +constexpr char kIfaceName1[] = "wlan0"; +constexpr char kIfaceName2[] = "wlan1"; +} // namespace + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { + +class AidlStructUtilTest : public Test {}; + +TEST_F(AidlStructUtilTest, CanConvertLegacyWifiMacInfosToAidlWithOneMac) { + std::vector legacy_mac_infos; + legacy_hal::WifiMacInfo legacy_mac_info1 = { + .wlan_mac_id = kMacId1, + .mac_band = legacy_hal::WLAN_MAC_5_0_BAND | legacy_hal::WLAN_MAC_2_4_BAND}; + legacy_hal::WifiIfaceInfo legacy_iface_info1 = {.name = kIfaceName1, .channel = kIfaceChannel1}; + legacy_hal::WifiIfaceInfo legacy_iface_info2 = {.name = kIfaceName2, .channel = kIfaceChannel2}; + legacy_mac_info1.iface_infos.push_back(legacy_iface_info1); + legacy_mac_info1.iface_infos.push_back(legacy_iface_info2); + legacy_mac_infos.push_back(legacy_mac_info1); + + std::vector aidl_radio_mode_infos; + ASSERT_TRUE(aidl_struct_util::convertLegacyWifiMacInfosToAidl(legacy_mac_infos, + &aidl_radio_mode_infos)); + + ASSERT_EQ(1u, aidl_radio_mode_infos.size()); + auto aidl_radio_mode_info1 = aidl_radio_mode_infos[0]; + EXPECT_EQ(legacy_mac_info1.wlan_mac_id, (uint32_t)aidl_radio_mode_info1.radioId); + EXPECT_EQ(WifiBand::BAND_24GHZ_5GHZ, aidl_radio_mode_info1.bandInfo); + ASSERT_EQ(2u, aidl_radio_mode_info1.ifaceInfos.size()); + auto aidl_iface_info1 = aidl_radio_mode_info1.ifaceInfos[0]; + EXPECT_EQ(legacy_iface_info1.name, aidl_iface_info1.name); + EXPECT_EQ(static_cast(legacy_iface_info1.channel), aidl_iface_info1.channel); + auto aidl_iface_info2 = aidl_radio_mode_info1.ifaceInfos[1]; + EXPECT_EQ(legacy_iface_info2.name, aidl_iface_info2.name); + EXPECT_EQ(static_cast(legacy_iface_info2.channel), aidl_iface_info2.channel); +} + +TEST_F(AidlStructUtilTest, CanConvertLegacyWifiMacInfosToAidlWithTwoMac) { + std::vector legacy_mac_infos; + legacy_hal::WifiMacInfo legacy_mac_info1 = {.wlan_mac_id = kMacId1, + .mac_band = legacy_hal::WLAN_MAC_5_0_BAND}; + legacy_hal::WifiIfaceInfo legacy_iface_info1 = {.name = kIfaceName1, .channel = kIfaceChannel1}; + legacy_hal::WifiMacInfo legacy_mac_info2 = {.wlan_mac_id = kMacId2, + .mac_band = legacy_hal::WLAN_MAC_2_4_BAND}; + legacy_hal::WifiIfaceInfo legacy_iface_info2 = {.name = kIfaceName2, .channel = kIfaceChannel2}; + legacy_mac_info1.iface_infos.push_back(legacy_iface_info1); + legacy_mac_infos.push_back(legacy_mac_info1); + legacy_mac_info2.iface_infos.push_back(legacy_iface_info2); + legacy_mac_infos.push_back(legacy_mac_info2); + + std::vector aidl_radio_mode_infos; + ASSERT_TRUE(aidl_struct_util::convertLegacyWifiMacInfosToAidl(legacy_mac_infos, + &aidl_radio_mode_infos)); + + ASSERT_EQ(2u, aidl_radio_mode_infos.size()); + + // Find mac info 1. + const auto aidl_radio_mode_info1 = + std::find_if(aidl_radio_mode_infos.begin(), aidl_radio_mode_infos.end(), + [&legacy_mac_info1](const IWifiChipEventCallback::RadioModeInfo& x) { + return (uint32_t)x.radioId == legacy_mac_info1.wlan_mac_id; + }); + ASSERT_NE(aidl_radio_mode_infos.end(), aidl_radio_mode_info1); + EXPECT_EQ(WifiBand::BAND_5GHZ, aidl_radio_mode_info1->bandInfo); + ASSERT_EQ(1u, aidl_radio_mode_info1->ifaceInfos.size()); + auto aidl_iface_info1 = aidl_radio_mode_info1->ifaceInfos[0]; + EXPECT_EQ(legacy_iface_info1.name, aidl_iface_info1.name); + EXPECT_EQ(static_cast(legacy_iface_info1.channel), aidl_iface_info1.channel); + + // Find mac info 2. + const auto aidl_radio_mode_info2 = + std::find_if(aidl_radio_mode_infos.begin(), aidl_radio_mode_infos.end(), + [&legacy_mac_info2](const IWifiChipEventCallback::RadioModeInfo& x) { + return (uint32_t)x.radioId == legacy_mac_info2.wlan_mac_id; + }); + ASSERT_NE(aidl_radio_mode_infos.end(), aidl_radio_mode_info2); + EXPECT_EQ(WifiBand::BAND_24GHZ, aidl_radio_mode_info2->bandInfo); + ASSERT_EQ(1u, aidl_radio_mode_info2->ifaceInfos.size()); + auto aidl_iface_info2 = aidl_radio_mode_info2->ifaceInfos[0]; + EXPECT_EQ(legacy_iface_info2.name, aidl_iface_info2.name); + EXPECT_EQ(static_cast(legacy_iface_info2.channel), aidl_iface_info2.channel); +} + +TEST_F(AidlStructUtilTest, canConvertLegacyLinkLayerStatsToAidl) { + legacy_hal::LinkLayerStats legacy_stats{}; + legacy_stats.radios.push_back(legacy_hal::LinkLayerRadioStats{}); + legacy_stats.radios.push_back(legacy_hal::LinkLayerRadioStats{}); + legacy_stats.peers.push_back(legacy_hal::WifiPeerInfo{}); + legacy_stats.peers.push_back(legacy_hal::WifiPeerInfo{}); + legacy_stats.iface.beacon_rx = rand(); + legacy_stats.iface.rssi_mgmt = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].rx_mpdu = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].tx_mpdu = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].mpdu_lost = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].retries = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_min = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_max = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_avg = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_num_samples = rand(); + + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].rx_mpdu = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].tx_mpdu = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].mpdu_lost = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].retries = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_min = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_max = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_avg = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_num_samples = rand(); + + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].rx_mpdu = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].tx_mpdu = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].mpdu_lost = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].retries = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_min = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_max = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_avg = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_num_samples = rand(); + + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].rx_mpdu = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].tx_mpdu = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].mpdu_lost = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].retries = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_min = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_max = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_avg = rand(); + legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_num_samples = rand(); + + legacy_stats.iface.info.time_slicing_duty_cycle_percent = rand(); + legacy_stats.iface.num_peers = 1; + + for (auto& radio : legacy_stats.radios) { + radio.stats.radio = rand(); + radio.stats.on_time = rand(); + radio.stats.tx_time = rand(); + radio.stats.rx_time = rand(); + radio.stats.on_time_scan = rand(); + radio.stats.on_time_nbd = rand(); + radio.stats.on_time_gscan = rand(); + radio.stats.on_time_roam_scan = rand(); + radio.stats.on_time_pno_scan = rand(); + radio.stats.on_time_hs20 = rand(); + for (int i = 0; i < 4; i++) { + radio.tx_time_per_levels.push_back(rand()); + } + + legacy_hal::wifi_channel_stat channel_stat1 = { + .channel = {legacy_hal::WIFI_CHAN_WIDTH_20, 2437, 2437, 0}, + .on_time = 0x1111, + .cca_busy_time = 0x55, + }; + legacy_hal::wifi_channel_stat channel_stat2 = { + .channel = {legacy_hal::WIFI_CHAN_WIDTH_20, 5180, 5180, 0}, + .on_time = 0x2222, + .cca_busy_time = 0x66, + }; + radio.channel_stats.push_back(channel_stat1); + radio.channel_stats.push_back(channel_stat2); + } + + for (auto& peer : legacy_stats.peers) { + peer.peer_info.bssload.sta_count = rand(); + peer.peer_info.bssload.chan_util = rand(); + wifi_rate_stat rate_stat1 = { + .rate = {3, 1, 2, 5, 0, 0}, + .tx_mpdu = 0, + .rx_mpdu = 1, + .mpdu_lost = 2, + .retries = 3, + .retries_short = 4, + .retries_long = 5, + }; + wifi_rate_stat rate_stat2 = { + .rate = {2, 2, 1, 6, 0, 1}, + .tx_mpdu = 6, + .rx_mpdu = 7, + .mpdu_lost = 8, + .retries = 9, + .retries_short = 10, + .retries_long = 11, + }; + peer.rate_stats.push_back(rate_stat1); + peer.rate_stats.push_back(rate_stat2); + } + + StaLinkLayerStats converted{}; + aidl_struct_util::convertLegacyLinkLayerStatsToAidl(legacy_stats, &converted); + EXPECT_EQ(legacy_stats.iface.beacon_rx, (uint32_t)converted.iface.beaconRx); + EXPECT_EQ(legacy_stats.iface.rssi_mgmt, converted.iface.avgRssiMgmt); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].rx_mpdu, + converted.iface.wmeBePktStats.rxMpdu); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].tx_mpdu, + converted.iface.wmeBePktStats.txMpdu); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].mpdu_lost, + converted.iface.wmeBePktStats.lostMpdu); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].retries, + converted.iface.wmeBePktStats.retries); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_min, + (uint32_t)converted.iface.wmeBeContentionTimeStats.contentionTimeMinInUsec); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_max, + (uint32_t)converted.iface.wmeBeContentionTimeStats.contentionTimeMaxInUsec); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_avg, + (uint32_t)converted.iface.wmeBeContentionTimeStats.contentionTimeAvgInUsec); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_num_samples, + (uint32_t)converted.iface.wmeBeContentionTimeStats.contentionNumSamples); + + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].rx_mpdu, + converted.iface.wmeBkPktStats.rxMpdu); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].tx_mpdu, + converted.iface.wmeBkPktStats.txMpdu); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].mpdu_lost, + converted.iface.wmeBkPktStats.lostMpdu); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].retries, + converted.iface.wmeBkPktStats.retries); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_min, + (uint32_t)converted.iface.wmeBkContentionTimeStats.contentionTimeMinInUsec); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_max, + (uint32_t)converted.iface.wmeBkContentionTimeStats.contentionTimeMaxInUsec); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_avg, + (uint32_t)converted.iface.wmeBkContentionTimeStats.contentionTimeAvgInUsec); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_num_samples, + (uint32_t)converted.iface.wmeBkContentionTimeStats.contentionNumSamples); + + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].rx_mpdu, + converted.iface.wmeViPktStats.rxMpdu); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].tx_mpdu, + converted.iface.wmeViPktStats.txMpdu); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].mpdu_lost, + converted.iface.wmeViPktStats.lostMpdu); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].retries, + converted.iface.wmeViPktStats.retries); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_min, + (uint32_t)converted.iface.wmeViContentionTimeStats.contentionTimeMinInUsec); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_max, + (uint32_t)converted.iface.wmeViContentionTimeStats.contentionTimeMaxInUsec); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_avg, + (uint32_t)converted.iface.wmeViContentionTimeStats.contentionTimeAvgInUsec); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_num_samples, + (uint32_t)converted.iface.wmeViContentionTimeStats.contentionNumSamples); + + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].rx_mpdu, + converted.iface.wmeVoPktStats.rxMpdu); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].tx_mpdu, + converted.iface.wmeVoPktStats.txMpdu); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].mpdu_lost, + converted.iface.wmeVoPktStats.lostMpdu); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].retries, + converted.iface.wmeVoPktStats.retries); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_min, + (uint32_t)converted.iface.wmeVoContentionTimeStats.contentionTimeMinInUsec); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_max, + (uint32_t)converted.iface.wmeVoContentionTimeStats.contentionTimeMaxInUsec); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_avg, + (uint32_t)converted.iface.wmeVoContentionTimeStats.contentionTimeAvgInUsec); + EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_num_samples, + (uint32_t)converted.iface.wmeVoContentionTimeStats.contentionNumSamples); + + EXPECT_EQ(legacy_stats.iface.info.time_slicing_duty_cycle_percent, + converted.iface.timeSliceDutyCycleInPercent); + + EXPECT_EQ(legacy_stats.radios.size(), converted.radios.size()); + for (size_t i = 0; i < legacy_stats.radios.size(); i++) { + EXPECT_EQ(legacy_stats.radios[i].stats.radio, converted.radios[i].radioId); + EXPECT_EQ(legacy_stats.radios[i].stats.on_time, (uint32_t)converted.radios[i].onTimeInMs); + EXPECT_EQ(legacy_stats.radios[i].stats.tx_time, (uint32_t)converted.radios[i].txTimeInMs); + EXPECT_EQ(legacy_stats.radios[i].stats.rx_time, (uint32_t)converted.radios[i].rxTimeInMs); + EXPECT_EQ(legacy_stats.radios[i].stats.on_time_scan, + (uint32_t)converted.radios[i].onTimeInMsForScan); + EXPECT_EQ(legacy_stats.radios[i].tx_time_per_levels.size(), + converted.radios[i].txTimeInMsPerLevel.size()); + for (size_t j = 0; j < legacy_stats.radios[i].tx_time_per_levels.size(); j++) { + EXPECT_EQ(legacy_stats.radios[i].tx_time_per_levels[j], + (uint32_t)converted.radios[i].txTimeInMsPerLevel[j]); + } + EXPECT_EQ(legacy_stats.radios[i].stats.on_time_nbd, + (uint32_t)converted.radios[i].onTimeInMsForNanScan); + EXPECT_EQ(legacy_stats.radios[i].stats.on_time_gscan, + (uint32_t)converted.radios[i].onTimeInMsForBgScan); + EXPECT_EQ(legacy_stats.radios[i].stats.on_time_roam_scan, + (uint32_t)converted.radios[i].onTimeInMsForRoamScan); + EXPECT_EQ(legacy_stats.radios[i].stats.on_time_pno_scan, + (uint32_t)converted.radios[i].onTimeInMsForPnoScan); + EXPECT_EQ(legacy_stats.radios[i].stats.on_time_hs20, + (uint32_t)converted.radios[i].onTimeInMsForHs20Scan); + EXPECT_EQ(legacy_stats.radios[i].channel_stats.size(), + converted.radios[i].channelStats.size()); + for (size_t k = 0; k < legacy_stats.radios[i].channel_stats.size(); k++) { + auto& legacy_channel_st = legacy_stats.radios[i].channel_stats[k]; + EXPECT_EQ(WifiChannelWidthInMhz::WIDTH_20, + converted.radios[i].channelStats[k].channel.width); + EXPECT_EQ(legacy_channel_st.channel.center_freq, + converted.radios[i].channelStats[k].channel.centerFreq); + EXPECT_EQ(legacy_channel_st.channel.center_freq0, + converted.radios[i].channelStats[k].channel.centerFreq0); + EXPECT_EQ(legacy_channel_st.channel.center_freq1, + converted.radios[i].channelStats[k].channel.centerFreq1); + EXPECT_EQ(legacy_channel_st.cca_busy_time, + (uint32_t)converted.radios[i].channelStats[k].ccaBusyTimeInMs); + EXPECT_EQ(legacy_channel_st.on_time, + (uint32_t)converted.radios[i].channelStats[k].onTimeInMs); + } + } + + EXPECT_EQ(legacy_stats.peers.size(), converted.iface.peers.size()); + for (size_t i = 0; i < legacy_stats.peers.size(); i++) { + EXPECT_EQ(legacy_stats.peers[i].peer_info.bssload.sta_count, + converted.iface.peers[i].staCount); + EXPECT_EQ(legacy_stats.peers[i].peer_info.bssload.chan_util, + converted.iface.peers[i].chanUtil); + for (size_t j = 0; j < legacy_stats.peers[i].rate_stats.size(); j++) { + EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].rate.preamble, + (uint32_t)converted.iface.peers[i].rateStats[j].rateInfo.preamble); + EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].rate.nss, + (uint32_t)converted.iface.peers[i].rateStats[j].rateInfo.nss); + EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].rate.bw, + (uint32_t)converted.iface.peers[i].rateStats[j].rateInfo.bw); + EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].rate.rateMcsIdx, + (uint32_t)converted.iface.peers[i].rateStats[j].rateInfo.rateMcsIdx); + EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].tx_mpdu, + (uint32_t)converted.iface.peers[i].rateStats[j].txMpdu); + EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].rx_mpdu, + (uint32_t)converted.iface.peers[i].rateStats[j].rxMpdu); + EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].mpdu_lost, + (uint32_t)converted.iface.peers[i].rateStats[j].mpduLost); + EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].retries, + (uint32_t)converted.iface.peers[i].rateStats[j].retries); + } + } +} + +TEST_F(AidlStructUtilTest, CanConvertLegacyFeaturesToAidl) { + using AidlChipCaps = IWifiChip::ChipCapabilityMask; + + uint32_t aidl_caps; + + uint32_t legacy_feature_set = WIFI_FEATURE_D2D_RTT | WIFI_FEATURE_SET_LATENCY_MODE; + uint32_t legacy_logger_feature_set = legacy_hal::WIFI_LOGGER_DRIVER_DUMP_SUPPORTED; + + ASSERT_TRUE(aidl_struct_util::convertLegacyFeaturesToAidlChipCapabilities( + legacy_feature_set, legacy_logger_feature_set, &aidl_caps)); + + EXPECT_EQ((uint32_t)AidlChipCaps::DEBUG_RING_BUFFER_VENDOR_DATA | + (uint32_t)AidlChipCaps::DEBUG_HOST_WAKE_REASON_STATS | + (uint32_t)AidlChipCaps::DEBUG_ERROR_ALERTS | (uint32_t)AidlChipCaps::D2D_RTT | + (uint32_t)AidlChipCaps::SET_LATENCY_MODE | + (uint32_t)AidlChipCaps::DEBUG_MEMORY_DRIVER_DUMP, + aidl_caps); +} + +void insertRadioCombination(legacy_hal::wifi_radio_combination* dst_radio_combination_ptr, + int num_radio_configurations, + legacy_hal::wifi_radio_configuration* radio_configuration) { + dst_radio_combination_ptr->num_radio_configurations = num_radio_configurations; + memcpy(dst_radio_combination_ptr->radio_configurations, radio_configuration, + num_radio_configurations * sizeof(legacy_hal::wifi_radio_configuration)); +} + +void verifyRadioCombination(WifiRadioCombination* radioCombination, size_t num_radio_configurations, + legacy_hal::wifi_radio_configuration* radio_configuration) { + EXPECT_EQ(num_radio_configurations, radioCombination->radioConfigurations.size()); + for (size_t i = 0; i < num_radio_configurations; i++) { + EXPECT_EQ(aidl_struct_util::convertLegacyMacBandToAidlWifiBand(radio_configuration->band), + radioCombination->radioConfigurations[i].bandInfo); + EXPECT_EQ(aidl_struct_util::convertLegacyAntennaConfigurationToAidl( + radio_configuration->antenna_cfg), + radioCombination->radioConfigurations[i].antennaMode); + radio_configuration++; + } +} + +TEST_F(AidlStructUtilTest, canConvertLegacyRadioCombinationsMatrixToAidl) { + legacy_hal::wifi_radio_configuration radio_configurations_array1[] = { + {.band = legacy_hal::WLAN_MAC_2_4_BAND, .antenna_cfg = legacy_hal::WIFI_ANTENNA_1X1}, + }; + legacy_hal::wifi_radio_configuration radio_configurations_array2[] = { + {.band = legacy_hal::WLAN_MAC_2_4_BAND, .antenna_cfg = legacy_hal::WIFI_ANTENNA_2X2}, + {.band = legacy_hal::WLAN_MAC_5_0_BAND, .antenna_cfg = legacy_hal::WIFI_ANTENNA_3X3}, + }; + legacy_hal::wifi_radio_configuration radio_configurations_array3[] = { + {.band = legacy_hal::WLAN_MAC_2_4_BAND, .antenna_cfg = legacy_hal::WIFI_ANTENNA_2X2}, + {.band = legacy_hal::WLAN_MAC_6_0_BAND, .antenna_cfg = legacy_hal::WIFI_ANTENNA_1X1}, + {.band = legacy_hal::WLAN_MAC_5_0_BAND, .antenna_cfg = legacy_hal::WIFI_ANTENNA_4X4}, + }; + + int num_radio_configs = 0; + int num_combinations = 0; + std::array buffer; + buffer.fill(0); + legacy_hal::wifi_radio_combination_matrix* legacy_matrix = + reinterpret_cast(buffer.data()); + legacy_hal::wifi_radio_combination* radio_combinations; + + // Prepare a legacy wifi_radio_combination_matrix + legacy_matrix->num_radio_combinations = 3; + // Insert first combination + radio_combinations = + (legacy_hal::wifi_radio_combination*)((char*)legacy_matrix->radio_combinations); + insertRadioCombination( + radio_combinations, + sizeof(radio_configurations_array1) / sizeof(radio_configurations_array1[0]), + radio_configurations_array1); + num_combinations++; + num_radio_configs += + sizeof(radio_configurations_array1) / sizeof(radio_configurations_array1[0]); + + // Insert second combination + radio_combinations = + (legacy_hal::wifi_radio_combination*)((char*)legacy_matrix->radio_combinations + + (num_combinations * + sizeof(legacy_hal::wifi_radio_combination)) + + (num_radio_configs * + sizeof(wifi_radio_configuration))); + insertRadioCombination( + radio_combinations, + sizeof(radio_configurations_array2) / sizeof(radio_configurations_array2[0]), + radio_configurations_array2); + num_combinations++; + num_radio_configs += + sizeof(radio_configurations_array2) / sizeof(radio_configurations_array2[0]); + + // Insert third combination + radio_combinations = + (legacy_hal::wifi_radio_combination*)((char*)legacy_matrix->radio_combinations + + (num_combinations * + sizeof(legacy_hal::wifi_radio_combination)) + + (num_radio_configs * + sizeof(wifi_radio_configuration))); + insertRadioCombination( + radio_combinations, + sizeof(radio_configurations_array3) / sizeof(radio_configurations_array3[0]), + radio_configurations_array3); + + WifiRadioCombinationMatrix converted_matrix{}; + aidl_struct_util::convertLegacyRadioCombinationsMatrixToAidl(legacy_matrix, &converted_matrix); + + // Verify the conversion + EXPECT_EQ(legacy_matrix->num_radio_combinations, converted_matrix.radioCombinations.size()); + verifyRadioCombination( + &converted_matrix.radioCombinations[0], + sizeof(radio_configurations_array1) / sizeof(radio_configurations_array1[0]), + radio_configurations_array1); + verifyRadioCombination( + &converted_matrix.radioCombinations[1], + sizeof(radio_configurations_array2) / sizeof(radio_configurations_array2[0]), + radio_configurations_array2); + verifyRadioCombination( + &converted_matrix.radioCombinations[2], + sizeof(radio_configurations_array3) / sizeof(radio_configurations_array3[0]), + radio_configurations_array3); +} + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/tests/main.cpp b/wifi/aidl/default/tests/main.cpp new file mode 100644 index 0000000000..767422c408 --- /dev/null +++ b/wifi/aidl/default/tests/main.cpp @@ -0,0 +1,28 @@ +/* + * 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. + */ + +#include +#include + +#include + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + ::testing::InitGoogleMock(&argc, argv); + // Force ourselves to always log to stderr + android::base::InitLogging(argv, android::base::StderrLogger); + return RUN_ALL_TESTS(); +} diff --git a/wifi/aidl/default/tests/mock_interface_tool.cpp b/wifi/aidl/default/tests/mock_interface_tool.cpp new file mode 100644 index 0000000000..79f3d1e638 --- /dev/null +++ b/wifi/aidl/default/tests/mock_interface_tool.cpp @@ -0,0 +1,28 @@ +/* + * 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. + */ +#include +#include +#include + +#include "mock_interface_tool.h" + +namespace android { +namespace wifi_system { + +MockInterfaceTool::MockInterfaceTool() {} + +} // namespace wifi_system +} // namespace android diff --git a/wifi/aidl/default/tests/mock_interface_tool.h b/wifi/aidl/default/tests/mock_interface_tool.h new file mode 100644 index 0000000000..9795de8014 --- /dev/null +++ b/wifi/aidl/default/tests/mock_interface_tool.h @@ -0,0 +1,42 @@ +/* + * 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. + */ + +#ifndef MOCK_INTERFACE_TOOL_H +#define MOCK_INTERFACE_TOOL_H + +#include +#include + +namespace android { +namespace wifi_system { + +class MockInterfaceTool : public InterfaceTool { + public: + MockInterfaceTool(); + + MOCK_METHOD1(GetUpState, bool(const char* if_name)); + MOCK_METHOD2(SetUpState, bool(const char* if_name, bool request_up)); + MOCK_METHOD1(SetWifiUpState, bool(bool request_up)); + MOCK_METHOD2(SetMacAddress, + bool(const char* if_name, const std::array& address)); + MOCK_METHOD1(GetFactoryMacAddress, std::array(const char* if_name)); + +}; // class MockInterfaceTool + +} // namespace wifi_system +} // namespace android + +#endif // MOCK_INTERFACE_TOOL_H diff --git a/wifi/aidl/default/tests/mock_wifi_feature_flags.cpp b/wifi/aidl/default/tests/mock_wifi_feature_flags.cpp new file mode 100644 index 0000000000..0c4e59deb3 --- /dev/null +++ b/wifi/aidl/default/tests/mock_wifi_feature_flags.cpp @@ -0,0 +1,33 @@ +/* + * 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. + */ + +#include + +#include "mock_wifi_feature_flags.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace feature_flags { + +MockWifiFeatureFlags::MockWifiFeatureFlags() {} + +} // namespace feature_flags +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/tests/mock_wifi_feature_flags.h b/wifi/aidl/default/tests/mock_wifi_feature_flags.h new file mode 100644 index 0000000000..9143d15d61 --- /dev/null +++ b/wifi/aidl/default/tests/mock_wifi_feature_flags.h @@ -0,0 +1,44 @@ +/* + * 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. + */ + +#ifndef MOCK_WIFI_FEATURE_FLAGS_H_ +#define MOCK_WIFI_FEATURE_FLAGS_H_ + +#include + +#include "wifi_feature_flags.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace feature_flags { + +class MockWifiFeatureFlags : public WifiFeatureFlags { + public: + MockWifiFeatureFlags(); + + MOCK_METHOD1(getChipModes, std::vector(bool is_primary)); + MOCK_METHOD0(isApMacRandomizationDisabled, bool()); +}; + +} // namespace feature_flags +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // MOCK_WIFI_FEATURE_FLAGS_H_ diff --git a/wifi/aidl/default/tests/mock_wifi_iface_util.cpp b/wifi/aidl/default/tests/mock_wifi_iface_util.cpp new file mode 100644 index 0000000000..0f787f22b2 --- /dev/null +++ b/wifi/aidl/default/tests/mock_wifi_iface_util.cpp @@ -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. + */ + +#include +#include +#include + +#include "mock_wifi_iface_util.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace iface_util { + +MockWifiIfaceUtil::MockWifiIfaceUtil( + const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, + const std::weak_ptr legacy_hal) + : WifiIfaceUtil(iface_tool, legacy_hal) {} + +} // namespace iface_util +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/tests/mock_wifi_iface_util.h b/wifi/aidl/default/tests/mock_wifi_iface_util.h new file mode 100644 index 0000000000..49a8636345 --- /dev/null +++ b/wifi/aidl/default/tests/mock_wifi_iface_util.h @@ -0,0 +1,50 @@ +/* + * 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. + */ + +#ifndef MOCK_WIFI_IFACE_UTIL_H_ +#define MOCK_WIFI_IFACE_UTIL_H_ + +#include + +#include "wifi_iface_util.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace iface_util { + +class MockWifiIfaceUtil : public iface_util::WifiIfaceUtil { + public: + MockWifiIfaceUtil(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, + const std::weak_ptr legacy_hal); + MOCK_METHOD1(getFactoryMacAddress, std::array(const std::string&)); + MOCK_METHOD2(setMacAddress, bool(const std::string&, const std::array&)); + MOCK_METHOD0(getOrCreateRandomMacAddress, std::array()); + MOCK_METHOD2(registerIfaceEventHandlers, + void(const std::string&, iface_util::IfaceEventHandlers)); + MOCK_METHOD1(unregisterIfaceEventHandlers, void(const std::string&)); + MOCK_METHOD2(setUpState, bool(const std::string&, bool)); + MOCK_METHOD1(ifNameToIndex, unsigned(const std::string&)); +}; + +} // namespace iface_util +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // MOCK_WIFI_IFACE_UTIL_H_ diff --git a/wifi/aidl/default/tests/mock_wifi_legacy_hal.cpp b/wifi/aidl/default/tests/mock_wifi_legacy_hal.cpp new file mode 100644 index 0000000000..33b2b1ce36 --- /dev/null +++ b/wifi/aidl/default/tests/mock_wifi_legacy_hal.cpp @@ -0,0 +1,37 @@ +/* + * 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. + */ + +#include +#include +#include + +#include "mock_wifi_legacy_hal.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace legacy_hal { + +MockWifiLegacyHal::MockWifiLegacyHal( + const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, + const wifi_hal_fn& fn, bool is_primary) + : WifiLegacyHal(iface_tool, fn, is_primary) {} +} // namespace legacy_hal +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/tests/mock_wifi_legacy_hal.h b/wifi/aidl/default/tests/mock_wifi_legacy_hal.h new file mode 100644 index 0000000000..28129a9947 --- /dev/null +++ b/wifi/aidl/default/tests/mock_wifi_legacy_hal.h @@ -0,0 +1,69 @@ +/* + * 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. + */ + +#ifndef MOCK_WIFI_LEGACY_HAL_H_ +#define MOCK_WIFI_LEGACY_HAL_H_ + +#include + +#include "wifi_legacy_hal.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace legacy_hal { + +class MockWifiLegacyHal : public WifiLegacyHal { + public: + MockWifiLegacyHal(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, + const wifi_hal_fn& fn, bool is_primary); + MOCK_METHOD0(initialize, wifi_error()); + MOCK_METHOD0(start, wifi_error()); + MOCK_METHOD2(stop, + wifi_error(std::unique_lock*, const std::function&)); + MOCK_METHOD2(setDfsFlag, wifi_error(const std::string&, bool)); + MOCK_METHOD2(registerRadioModeChangeCallbackHandler, + wifi_error(const std::string&, const on_radio_mode_change_callback&)); + MOCK_METHOD1(getFirmwareVersion, + std::pair(const std::string& iface_name)); + MOCK_METHOD1(getDriverVersion, + std::pair(const std::string& iface_name)); + + MOCK_METHOD2(selectTxPowerScenario, + wifi_error(const std::string& iface_name, wifi_power_scenario scenario)); + MOCK_METHOD1(resetTxPowerScenario, wifi_error(const std::string& iface_name)); + MOCK_METHOD2(nanRegisterCallbackHandlers, + wifi_error(const std::string&, const NanCallbackHandlers&)); + MOCK_METHOD2(nanDisableRequest, wifi_error(const std::string&, transaction_id)); + MOCK_METHOD3(nanDataInterfaceDelete, + wifi_error(const std::string&, transaction_id, const std::string&)); + MOCK_METHOD2(createVirtualInterface, + wifi_error(const std::string& ifname, wifi_interface_type iftype)); + MOCK_METHOD1(deleteVirtualInterface, wifi_error(const std::string& ifname)); + MOCK_METHOD0(waitForDriverReady, wifi_error()); + MOCK_METHOD2(getSupportedIfaceName, wifi_error(uint32_t, std::string&)); + MOCK_METHOD1(registerSubsystemRestartCallbackHandler, + wifi_error(const on_subsystem_restart_callback&)); + MOCK_METHOD1(getSupportedFeatureSet, std::pair(const std::string&)); +}; +} // namespace legacy_hal +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // MOCK_WIFI_LEGACY_HAL_H_ diff --git a/wifi/aidl/default/tests/mock_wifi_mode_controller.cpp b/wifi/aidl/default/tests/mock_wifi_mode_controller.cpp new file mode 100644 index 0000000000..f4cc4c4108 --- /dev/null +++ b/wifi/aidl/default/tests/mock_wifi_mode_controller.cpp @@ -0,0 +1,36 @@ +/* + * 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. + */ + +#include +#include +#include + +#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 +#include "mock_wifi_mode_controller.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace mode_controller { + +MockWifiModeController::MockWifiModeController() : WifiModeController() {} + +} // namespace mode_controller +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/tests/mock_wifi_mode_controller.h b/wifi/aidl/default/tests/mock_wifi_mode_controller.h new file mode 100644 index 0000000000..f77f7d0f96 --- /dev/null +++ b/wifi/aidl/default/tests/mock_wifi_mode_controller.h @@ -0,0 +1,44 @@ +/* + * 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. + */ + +#ifndef MOCK_WIFI_MODE_CONTROLLER_H_ +#define MOCK_WIFI_MODE_CONTROLLER_H_ + +#include + +#include "wifi_mode_controller.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace mode_controller { + +class MockWifiModeController : public WifiModeController { + public: + MockWifiModeController(); + MOCK_METHOD0(initialize, bool()); + MOCK_METHOD1(changeFirmwareMode, bool(IfaceType)); + MOCK_METHOD1(isFirmwareModeChangeNeeded, bool(IfaceType)); + MOCK_METHOD0(deinitialize, bool()); +}; +} // namespace mode_controller +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // MOCK_WIFI_MODE_CONTROLLER_H_ diff --git a/wifi/aidl/default/tests/ringbuffer_unit_tests.cpp b/wifi/aidl/default/tests/ringbuffer_unit_tests.cpp new file mode 100644 index 0000000000..c257100be9 --- /dev/null +++ b/wifi/aidl/default/tests/ringbuffer_unit_tests.cpp @@ -0,0 +1,96 @@ +/* + * 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. + */ + +#include + +#include "ringbuffer.h" + +using testing::Return; +using testing::Test; + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { + +class RingbufferTest : public Test { + public: + const uint32_t maxBufferSize_ = 10; + Ringbuffer buffer_{maxBufferSize_}; +}; + +TEST_F(RingbufferTest, CreateEmptyBuffer) { + ASSERT_TRUE(buffer_.getData().empty()); +} + +TEST_F(RingbufferTest, CanUseFullBufferCapacity) { + const std::vector input(maxBufferSize_ / 2, '0'); + const std::vector input2(maxBufferSize_ / 2, '1'); + buffer_.append(input); + buffer_.append(input2); + ASSERT_EQ(2u, buffer_.getData().size()); + EXPECT_EQ(input, buffer_.getData().front()); + EXPECT_EQ(input2, buffer_.getData().back()); +} + +TEST_F(RingbufferTest, OldDataIsRemovedOnOverflow) { + const std::vector input(maxBufferSize_ / 2, '0'); + const std::vector input2(maxBufferSize_ / 2, '1'); + const std::vector input3 = {'G'}; + buffer_.append(input); + buffer_.append(input2); + buffer_.append(input3); + ASSERT_EQ(2u, buffer_.getData().size()); + EXPECT_EQ(input2, buffer_.getData().front()); + EXPECT_EQ(input3, buffer_.getData().back()); +} + +TEST_F(RingbufferTest, MultipleOldDataIsRemovedOnOverflow) { + const std::vector input(maxBufferSize_ / 2, '0'); + const std::vector input2(maxBufferSize_ / 2, '1'); + const std::vector input3(maxBufferSize_, '2'); + buffer_.append(input); + buffer_.append(input2); + buffer_.append(input3); + ASSERT_EQ(1u, buffer_.getData().size()); + EXPECT_EQ(input3, buffer_.getData().front()); +} + +TEST_F(RingbufferTest, AppendingEmptyBufferDoesNotAddGarbage) { + const std::vector input = {}; + buffer_.append(input); + ASSERT_TRUE(buffer_.getData().empty()); +} + +TEST_F(RingbufferTest, OversizedAppendIsDropped) { + const std::vector input(maxBufferSize_ + 1, '0'); + buffer_.append(input); + ASSERT_TRUE(buffer_.getData().empty()); +} + +TEST_F(RingbufferTest, OversizedAppendDoesNotDropExistingData) { + const std::vector input(maxBufferSize_, '0'); + const std::vector input2(maxBufferSize_ + 1, '1'); + buffer_.append(input); + buffer_.append(input2); + ASSERT_EQ(1u, buffer_.getData().size()); + EXPECT_EQ(input, buffer_.getData().front()); +} + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/tests/runtests.sh b/wifi/aidl/default/tests/runtests.sh new file mode 100755 index 0000000000..1f53ab8e05 --- /dev/null +++ b/wifi/aidl/default/tests/runtests.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +# 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. + +if [ -z $ANDROID_BUILD_TOP ]; then + echo "You need to source and lunch before you can use this script" + exit 1 +fi +set -e + +$ANDROID_BUILD_TOP/build/soong/soong_ui.bash --make-mode android.hardware.wifi-service-tests +adb root +adb sync data +adb shell /data/nativetest64/vendor/android.hardware.wifi-service-tests/android.hardware.wifi-service-tests diff --git a/wifi/aidl/default/tests/wifi_chip_unit_tests.cpp b/wifi/aidl/default/tests/wifi_chip_unit_tests.cpp new file mode 100644 index 0000000000..e66b650ded --- /dev/null +++ b/wifi/aidl/default/tests/wifi_chip_unit_tests.cpp @@ -0,0 +1,855 @@ +/* + * 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. + */ + +#include +#include +#include +#include + +#include "wifi_chip.h" + +#include "mock_interface_tool.h" +#include "mock_wifi_feature_flags.h" +#include "mock_wifi_iface_util.h" +#include "mock_wifi_legacy_hal.h" +#include "mock_wifi_mode_controller.h" + +using testing::NiceMock; +using testing::Return; +using testing::Test; + +namespace { +constexpr int kFakeChipId = 5; +} // namespace + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { + +class WifiChipTest : public Test { + protected: + void setupV1IfaceCombination() { + // clang-format off + // 1 STA + 1 P2P + const std::vector combinationsSta = + { + { + { + {{IfaceConcurrencyType::STA}, 1}, + {{IfaceConcurrencyType::P2P}, 1} + } + } + }; + // 1 AP + const std::vector combinationsAp = + { + { + { + {{IfaceConcurrencyType::AP}, 1} + } + } + }; + const std::vector modes = { + {feature_flags::chip_mode_ids::kV1Sta, combinationsSta}, + {feature_flags::chip_mode_ids::kV1Ap, combinationsAp} + }; + // clang-format on + EXPECT_CALL(*feature_flags_, getChipModes(true)).WillRepeatedly(testing::Return(modes)); + } + + void setupV1_AwareIfaceCombination() { + // clang-format off + // 1 STA + 1 of (P2P or NAN) + const std::vector combinationsSta = + { + { + { + {{IfaceConcurrencyType::STA}, 1}, + {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN_IFACE}, 1} + } + } + }; + // 1 AP + const std::vector combinationsAp = + { + { + { + {{IfaceConcurrencyType::AP}, 1} + } + } + }; + const std::vector modes = { + {feature_flags::chip_mode_ids::kV1Sta, combinationsSta}, + {feature_flags::chip_mode_ids::kV1Ap, combinationsAp} + }; + // clang-format on + EXPECT_CALL(*feature_flags_, getChipModes(true)).WillRepeatedly(testing::Return(modes)); + } + + void setupV1_AwareDisabledApIfaceCombination() { + // clang-format off + // 1 STA + 1 of (P2P or NAN) + const std::vector combinationsSta = + { + { + { + {{IfaceConcurrencyType::STA}, 1}, + {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN_IFACE}, 1} + } + } + }; + const std::vector modes = { + {feature_flags::chip_mode_ids::kV1Sta, combinationsSta} + }; + // clang-format on + EXPECT_CALL(*feature_flags_, getChipModes(true)).WillRepeatedly(testing::Return(modes)); + } + + void setupV2_AwareIfaceCombination() { + // clang-format off + // (1 STA + 1 AP) or (1 STA + 1 of (P2P or NAN)) + const std::vector combinations = + { + { + { + {{IfaceConcurrencyType::STA}, 1}, + {{IfaceConcurrencyType::AP}, 1} + } + }, + { + { + {{IfaceConcurrencyType::STA}, 1}, + {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN_IFACE}, 1} + } + } + }; + const std::vector modes = { + {feature_flags::chip_mode_ids::kV3, combinations} + }; + // clang-format on + EXPECT_CALL(*feature_flags_, getChipModes(true)).WillRepeatedly(testing::Return(modes)); + } + + void setupV2_AwareDisabledApIfaceCombination() { + // clang-format off + // 1 STA + 1 of (P2P or NAN) + const std::vector combinations = + { + { + { + {{IfaceConcurrencyType::STA}, 1}, + {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN_IFACE}, 1} + } + } + }; + const std::vector modes = { + {feature_flags::chip_mode_ids::kV3, combinations} + }; + // clang-format on + EXPECT_CALL(*feature_flags_, getChipModes(true)).WillRepeatedly(testing::Return(modes)); + } + + void setup_MultiIfaceCombination() { + // clang-format off + // 3 STA + 1 AP + const std::vector combinations = + { + { + { + {{IfaceConcurrencyType::STA}, 3}, + {{IfaceConcurrencyType::AP}, 1} + } + } + }; + const std::vector modes = { + {feature_flags::chip_mode_ids::kV3, combinations} + }; + // clang-format on + EXPECT_CALL(*feature_flags_, getChipModes(true)).WillRepeatedly(testing::Return(modes)); + } + + void assertNumberOfModes(uint32_t num_modes) { + std::vector modes; + ASSERT_TRUE(chip_->getAvailableModes(&modes).isOk()); + // V2_Aware has 1 mode of operation. + ASSERT_EQ(num_modes, modes.size()); + } + + void findModeAndConfigureForIfaceType(const IfaceConcurrencyType& type) { + // This should be aligned with kInvalidModeId in wifi_chip.cpp + int32_t mode_id = INT32_MAX; + std::vector modes; + ASSERT_TRUE(chip_->getAvailableModes(&modes).isOk()); + + for (const auto& mode : modes) { + for (const auto& combination : mode.availableCombinations) { + for (const auto& limit : combination.limits) { + if (limit.types.end() != + std::find(limit.types.begin(), limit.types.end(), type)) { + mode_id = mode.id; + } + } + } + } + + ASSERT_NE(INT32_MAX, mode_id); + ASSERT_TRUE(chip_->configureChip(mode_id).isOk()); + } + + // Returns an empty string on error. + std::string createIface(const IfaceType& type) { + std::string iface_name; + if (type == IfaceType::AP) { + std::shared_ptr iface; + if (!chip_->createApIface(&iface).isOk()) { + return ""; + } + EXPECT_NE(iface.get(), nullptr); + EXPECT_TRUE(iface->getName(&iface_name).isOk()); + } else if (type == IfaceType::NAN_IFACE) { + std::shared_ptr iface; + if (!chip_->createNanIface(&iface).isOk()) { + return ""; + } + EXPECT_NE(iface.get(), nullptr); + EXPECT_TRUE(iface->getName(&iface_name).isOk()); + } else if (type == IfaceType::P2P) { + std::shared_ptr iface; + if (!chip_->createP2pIface(&iface).isOk()) { + return ""; + } + EXPECT_NE(iface.get(), nullptr); + EXPECT_TRUE(iface->getName(&iface_name).isOk()); + } else if (type == IfaceType::STA) { + std::shared_ptr iface; + if (!chip_->createStaIface(&iface).isOk()) { + return ""; + } + EXPECT_NE(iface.get(), nullptr); + EXPECT_TRUE(iface->getName(&iface_name).isOk()); + } + return iface_name; + } + + void removeIface(const IfaceType& type, const std::string& iface_name) { + if (type == IfaceType::AP) { + ASSERT_TRUE(chip_->removeApIface(iface_name).isOk()); + } else if (type == IfaceType::NAN_IFACE) { + ASSERT_TRUE(chip_->removeNanIface(iface_name).isOk()); + } else if (type == IfaceType::P2P) { + ASSERT_TRUE(chip_->removeP2pIface(iface_name).isOk()); + } else if (type == IfaceType::STA) { + ASSERT_TRUE(chip_->removeStaIface(iface_name).isOk()); + } + } + + bool createRttController() { + std::shared_ptr rtt_controller; + auto status = chip_->createRttController(nullptr, &rtt_controller); + return status.isOk(); + } + + static void subsystemRestartHandler(const std::string& /*error*/) {} + + std::shared_ptr chip_; + int chip_id_ = kFakeChipId; + legacy_hal::wifi_hal_fn fake_func_table_; + std::shared_ptr> iface_tool_{ + new NiceMock<::android::wifi_system::MockInterfaceTool>}; + std::shared_ptr> legacy_hal_{ + new NiceMock(iface_tool_, fake_func_table_, true)}; + std::shared_ptr> mode_controller_{ + new NiceMock}; + std::shared_ptr> iface_util_{ + new NiceMock(iface_tool_, legacy_hal_)}; + std::shared_ptr> feature_flags_{ + new NiceMock}; + + public: + void SetUp() override { + chip_ = WifiChip::create(chip_id_, true, legacy_hal_, mode_controller_, iface_util_, + feature_flags_, subsystemRestartHandler); + + EXPECT_CALL(*mode_controller_, changeFirmwareMode(testing::_)) + .WillRepeatedly(testing::Return(true)); + EXPECT_CALL(*legacy_hal_, start()) + .WillRepeatedly(testing::Return(legacy_hal::WIFI_SUCCESS)); + // Vendor HAL does not override the name by default. + EXPECT_CALL(*legacy_hal_, getSupportedIfaceName(testing::_, testing::_)) + .WillRepeatedly(testing::Return(legacy_hal::WIFI_ERROR_UNKNOWN)); + } + + void TearDown() override { + // Restore default system iface names (This should ideally be using a + // mock). + property_set("wifi.interface", "wlan0"); + property_set("wifi.concurrent.interface", "wlan1"); + property_set("wifi.aware.interface", nullptr); + } +}; + +////////// V1 Iface Combinations //////////// +// Mode 1 - STA + P2P +// Mode 2 - AP +class WifiChipV1IfaceCombinationTest : public WifiChipTest { + public: + void SetUp() override { + setupV1IfaceCombination(); + WifiChipTest::SetUp(); + // V1 has 2 modes of operation. + assertNumberOfModes(2); + } +}; + +TEST_F(WifiChipV1IfaceCombinationTest, StaMode_CreateSta_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); +} + +TEST_F(WifiChipV1IfaceCombinationTest, StaMode_CreateP2p_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::P2P).empty()); +} + +TEST_F(WifiChipV1IfaceCombinationTest, StaMode_CreateNan_ShouldFail) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); +} + +TEST_F(WifiChipV1IfaceCombinationTest, StaMode_CreateAp_ShouldFail) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_TRUE(createIface(IfaceType::AP).empty()); +} + +TEST_F(WifiChipV1IfaceCombinationTest, StaMode_CreateStaP2p_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::STA).empty()); + ASSERT_FALSE(createIface(IfaceType::P2P).empty()); +} + +TEST_F(WifiChipV1IfaceCombinationTest, ApMode_CreateAp_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); + ASSERT_EQ(createIface(IfaceType::AP), "wlan0"); +} + +TEST_F(WifiChipV1IfaceCombinationTest, ApMode_CreateSta_ShouldFail) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); + ASSERT_TRUE(createIface(IfaceType::STA).empty()); +} + +TEST_F(WifiChipV1IfaceCombinationTest, ApMode_CreateP2p_ShouldFail) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); + ASSERT_TRUE(createIface(IfaceType::STA).empty()); +} + +TEST_F(WifiChipV1IfaceCombinationTest, ApMode_CreateNan_ShouldFail) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); + ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); +} + +////////// V1 + Aware Iface Combinations //////////// +// Mode 1 - STA + P2P/NAN +// Mode 2 - AP +class WifiChipV1_AwareIfaceCombinationTest : public WifiChipTest { + public: + void SetUp() override { + setupV1_AwareIfaceCombination(); + WifiChipTest::SetUp(); + // V1_Aware has 2 modes of operation. + assertNumberOfModes(2u); + } +}; + +TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateSta_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); +} + +TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateP2p_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::P2P).empty()); +} + +TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateNan_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::NAN_IFACE).empty()); +} + +TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateAp_ShouldFail) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_TRUE(createIface(IfaceType::AP).empty()); +} + +TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaP2p_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::STA).empty()); + ASSERT_FALSE(createIface(IfaceType::P2P).empty()); +} + +TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaNan_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::STA).empty()); + ASSERT_FALSE(createIface(IfaceType::NAN_IFACE).empty()); +} + +TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaP2PNan_ShouldFail) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::STA).empty()); + ASSERT_FALSE(createIface(IfaceType::P2P).empty()); + ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); +} + +TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaNan_AfterP2pRemove_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::STA).empty()); + std::string p2p_iface_name = createIface(IfaceType::P2P); + ASSERT_FALSE(p2p_iface_name.empty()); + ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); + + // After removing P2P iface, NAN iface creation should succeed. + removeIface(IfaceType::P2P, p2p_iface_name); + ASSERT_FALSE(createIface(IfaceType::NAN_IFACE).empty()); +} + +TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaP2p_AfterNanRemove_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::STA).empty()); + std::string nan_iface_name = createIface(IfaceType::NAN_IFACE); + ASSERT_FALSE(nan_iface_name.empty()); + ASSERT_TRUE(createIface(IfaceType::P2P).empty()); + + // After removing NAN iface, P2P iface creation should succeed. + removeIface(IfaceType::NAN_IFACE, nan_iface_name); + ASSERT_FALSE(createIface(IfaceType::P2P).empty()); +} + +TEST_F(WifiChipV1_AwareIfaceCombinationTest, ApMode_CreateAp_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); + ASSERT_EQ(createIface(IfaceType::AP), "wlan0"); +} + +TEST_F(WifiChipV1_AwareIfaceCombinationTest, ApMode_CreateSta_ShouldFail) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); + ASSERT_TRUE(createIface(IfaceType::STA).empty()); +} + +TEST_F(WifiChipV1_AwareIfaceCombinationTest, ApMode_CreateP2p_ShouldFail) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); + ASSERT_TRUE(createIface(IfaceType::STA).empty()); +} + +TEST_F(WifiChipV1_AwareIfaceCombinationTest, ApMode_CreateNan_ShouldFail) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); + ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); +} + +TEST_F(WifiChipV1_AwareIfaceCombinationTest, RttControllerFlowStaModeNoSta) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_TRUE(createRttController()); +} + +TEST_F(WifiChipV1_AwareIfaceCombinationTest, RttControllerFlowStaModeWithSta) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::STA).empty()); + ASSERT_TRUE(createRttController()); +} + +TEST_F(WifiChipV1_AwareIfaceCombinationTest, RttControllerFlowApToSta) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); + std::string ap_iface_name = createIface(IfaceType::AP); + ASSERT_FALSE(ap_iface_name.empty()); + ASSERT_FALSE(createRttController()); + + removeIface(IfaceType::AP, ap_iface_name); + + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_TRUE(createRttController()); +} + +TEST_F(WifiChipV1_AwareIfaceCombinationTest, SelectTxScenarioWithOnlySta) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); + EXPECT_CALL(*legacy_hal_, selectTxPowerScenario("wlan0", testing::_)) + .WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS)); + ASSERT_TRUE(chip_->selectTxPowerScenario(IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF).isOk()); +} + +TEST_F(WifiChipV1_AwareIfaceCombinationTest, SelectTxScenarioWithOnlyAp) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); + ASSERT_EQ(createIface(IfaceType::AP), "wlan0"); + EXPECT_CALL(*legacy_hal_, selectTxPowerScenario("wlan0", testing::_)) + .WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS)); + ASSERT_TRUE(chip_->selectTxPowerScenario(IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF).isOk()); +} + +////////// V2 + Aware Iface Combinations //////////// +// Mode 1 - STA + STA/AP +// - STA + P2P/NAN +class WifiChipV2_AwareIfaceCombinationTest : public WifiChipTest { + public: + void SetUp() override { + setupV2_AwareIfaceCombination(); + WifiChipTest::SetUp(); + // V2_Aware has 1 mode of operation. + assertNumberOfModes(1u); + } +}; + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateSta_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateP2p_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::P2P).empty()); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateNan_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::NAN_IFACE).empty()); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateAp_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_EQ(createIface(IfaceType::AP), "wlan1"); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaSta_ShouldFail) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); + ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); + ASSERT_TRUE(createIface(IfaceType::STA).empty()); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaAp_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); + ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); + ASSERT_EQ(createIface(IfaceType::AP), "wlan1"); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateApSta_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); + ASSERT_EQ(createIface(IfaceType::AP), "wlan1"); + ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateSta_AfterStaApRemove_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + std::string sta_iface_name = createIface(IfaceType::STA); + ASSERT_FALSE(sta_iface_name.empty()); + std::string ap_iface_name = createIface(IfaceType::AP); + ASSERT_FALSE(ap_iface_name.empty()); + + ASSERT_TRUE(createIface(IfaceType::STA).empty()); + + // After removing AP & STA iface, STA iface creation should succeed. + removeIface(IfaceType::STA, sta_iface_name); + removeIface(IfaceType::AP, ap_iface_name); + ASSERT_FALSE(createIface(IfaceType::STA).empty()); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaP2p_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::STA).empty()); + ASSERT_FALSE(createIface(IfaceType::P2P).empty()); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaNan_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::STA).empty()); + ASSERT_FALSE(createIface(IfaceType::NAN_IFACE).empty()); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaP2PNan_ShouldFail) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::STA).empty()); + ASSERT_FALSE(createIface(IfaceType::P2P).empty()); + ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaNan_AfterP2pRemove_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::STA).empty()); + std::string p2p_iface_name = createIface(IfaceType::P2P); + ASSERT_FALSE(p2p_iface_name.empty()); + ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); + + // After removing P2P iface, NAN iface creation should succeed. + removeIface(IfaceType::P2P, p2p_iface_name); + ASSERT_FALSE(createIface(IfaceType::NAN_IFACE).empty()); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaP2p_AfterNanRemove_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::STA).empty()); + std::string nan_iface_name = createIface(IfaceType::NAN_IFACE); + ASSERT_FALSE(nan_iface_name.empty()); + ASSERT_TRUE(createIface(IfaceType::P2P).empty()); + + // After removing NAN iface, P2P iface creation should succeed. + removeIface(IfaceType::NAN_IFACE, nan_iface_name); + ASSERT_FALSE(createIface(IfaceType::P2P).empty()); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateApNan_ShouldFail) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); + ASSERT_FALSE(createIface(IfaceType::AP).empty()); + ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateApP2p_ShouldFail) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); + ASSERT_FALSE(createIface(IfaceType::AP).empty()); + ASSERT_TRUE(createIface(IfaceType::P2P).empty()); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, StaMode_CreateStaNan_AfterP2pRemove_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::STA).empty()); + std::string p2p_iface_name = createIface(IfaceType::P2P); + ASSERT_FALSE(p2p_iface_name.empty()); + ASSERT_TRUE(createIface(IfaceType::NAN_IFACE).empty()); + + // After removing P2P iface, NAN iface creation should succeed. + removeIface(IfaceType::P2P, p2p_iface_name); + ASSERT_FALSE(createIface(IfaceType::NAN_IFACE).empty()); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, StaMode_CreateStaP2p_AfterNanRemove_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::STA).empty()); + std::string nan_iface_name = createIface(IfaceType::NAN_IFACE); + ASSERT_FALSE(nan_iface_name.empty()); + ASSERT_TRUE(createIface(IfaceType::P2P).empty()); + + // After removing NAN iface, P2P iface creation should succeed. + removeIface(IfaceType::NAN_IFACE, nan_iface_name); + ASSERT_FALSE(createIface(IfaceType::P2P).empty()); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaAp_EnsureDifferentIfaceNames) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); + std::string sta_iface_name = createIface(IfaceType::STA); + std::string ap_iface_name = createIface(IfaceType::AP); + ASSERT_FALSE(sta_iface_name.empty()); + ASSERT_FALSE(ap_iface_name.empty()); + ASSERT_NE(sta_iface_name, ap_iface_name); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, RttControllerFlowStaModeNoSta) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_TRUE(createRttController()); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, RttControllerFlowStaModeWithSta) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::STA).empty()); + ASSERT_TRUE(createRttController()); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, RttControllerFlow) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::STA).empty()); + ASSERT_FALSE(createIface(IfaceType::AP).empty()); + ASSERT_TRUE(createRttController()); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, SelectTxScenarioWithOnlySta) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); + EXPECT_CALL(*legacy_hal_, selectTxPowerScenario("wlan0", testing::_)) + .WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS)); + ASSERT_TRUE(chip_->selectTxPowerScenario(IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF).isOk()); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, SelectTxScenarioWithOnlyAp) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); + ASSERT_EQ(createIface(IfaceType::AP), "wlan1"); + EXPECT_CALL(*legacy_hal_, selectTxPowerScenario("wlan1", testing::_)) + .WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS)); + ASSERT_TRUE(chip_->selectTxPowerScenario(IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF).isOk()); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, InvalidateAndRemoveNanOnStaRemove) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); + + // Create NAN iface + ASSERT_EQ(createIface(IfaceType::NAN_IFACE), "wlan0"); + + // We should have 1 nan iface. + std::vector iface_names; + ASSERT_TRUE(chip_->getNanIfaceNames(&iface_names).isOk()); + ASSERT_EQ(iface_names.size(), 1u); + ASSERT_EQ(iface_names[0], "wlan0"); + + // Retrieve the nan iface object. + std::shared_ptr nan_iface; + ASSERT_TRUE(chip_->getNanIface("wlan0", &nan_iface).isOk()); + ASSERT_NE(nan_iface.get(), nullptr); + + // Remove the STA iface. We should have 0 nan ifaces now. + removeIface(IfaceType::STA, "wlan0"); + ASSERT_TRUE(chip_->getNanIfaceNames(&iface_names).isOk()); + ASSERT_EQ(iface_names.size(), 0u); + + // Any operation on the nan iface object should now return an error. + std::string name; + auto status = nan_iface->getName(&name); + ASSERT_EQ(status.getServiceSpecificError(), + static_cast(WifiStatusCode::ERROR_WIFI_IFACE_INVALID)); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, InvalidateAndRemoveRttControllerOnStaRemove) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); + + // Create RTT controller + std::shared_ptr rtt_controller; + ASSERT_TRUE(chip_->createRttController(nullptr, &rtt_controller).isOk()); + + // Remove the STA iface. + removeIface(IfaceType::STA, "wlan0"); + + // Any operation on the rtt controller object should now return an error. + std::shared_ptr bound_iface; + auto status = rtt_controller->getBoundIface(&bound_iface); + ASSERT_EQ(status.getServiceSpecificError(), + static_cast(WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID)); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateNanWithSharedNanIface) { + property_set("wifi.aware.interface", nullptr); + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); + ASSERT_EQ(createIface(IfaceType::NAN_IFACE), "wlan0"); + removeIface(IfaceType::NAN_IFACE, "wlan0"); + EXPECT_CALL(*iface_util_, setUpState(testing::_, testing::_)).Times(0); +} + +TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateNanWithDedicatedNanIface) { + property_set("wifi.aware.interface", "aware0"); + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); + EXPECT_CALL(*iface_util_, ifNameToIndex("aware0")).WillOnce(testing::Return(4)); + EXPECT_CALL(*iface_util_, setUpState("aware0", true)).WillOnce(testing::Return(true)); + ASSERT_EQ(createIface(IfaceType::NAN_IFACE), "aware0"); + + EXPECT_CALL(*iface_util_, setUpState("aware0", false)).WillOnce(testing::Return(true)); + removeIface(IfaceType::NAN_IFACE, "aware0"); +} + +////////// V1 Iface Combinations when AP creation is disabled ////////// +class WifiChipV1_AwareDisabledApIfaceCombinationTest : public WifiChipTest { + public: + void SetUp() override { + setupV1_AwareDisabledApIfaceCombination(); + WifiChipTest::SetUp(); + } +}; + +TEST_F(WifiChipV1_AwareDisabledApIfaceCombinationTest, StaMode_CreateSta_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::STA).empty()); + ASSERT_TRUE(createIface(IfaceType::AP).empty()); +} + +////////// V2 Iface Combinations when AP creation is disabled ////////// +class WifiChipV2_AwareDisabledApIfaceCombinationTest : public WifiChipTest { + public: + void SetUp() override { + setupV2_AwareDisabledApIfaceCombination(); + WifiChipTest::SetUp(); + } +}; + +TEST_F(WifiChipV2_AwareDisabledApIfaceCombinationTest, CreateSta_ShouldSucceed) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::STA).empty()); + ASSERT_TRUE(createIface(IfaceType::AP).empty()); +} + +////////// Hypothetical Iface Combination with multiple ifaces ////////// +class WifiChip_MultiIfaceTest : public WifiChipTest { + public: + void SetUp() override { + setup_MultiIfaceCombination(); + WifiChipTest::SetUp(); + } +}; + +TEST_F(WifiChip_MultiIfaceTest, Create3Sta) { + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_FALSE(createIface(IfaceType::STA).empty()); + ASSERT_FALSE(createIface(IfaceType::STA).empty()); + ASSERT_FALSE(createIface(IfaceType::STA).empty()); + ASSERT_TRUE(createIface(IfaceType::STA).empty()); +} + +TEST_F(WifiChip_MultiIfaceTest, CreateStaWithDefaultNames) { + property_set("wifi.interface.0", ""); + property_set("wifi.interface.1", ""); + property_set("wifi.interface.2", ""); + property_set("wifi.interface", ""); + property_set("wifi.concurrent.interface", ""); + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); + ASSERT_EQ(createIface(IfaceType::STA), "wlan1"); + ASSERT_EQ(createIface(IfaceType::STA), "wlan2"); +} + +TEST_F(WifiChip_MultiIfaceTest, CreateStaWithCustomNames) { + property_set("wifi.interface.0", "test0"); + property_set("wifi.interface.1", "test1"); + property_set("wifi.interface.2", "test2"); + property_set("wifi.interface", "bad0"); + property_set("wifi.concurrent.interface", "bad1"); + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_EQ(createIface(IfaceType::STA), "bad0"); + ASSERT_EQ(createIface(IfaceType::STA), "bad1"); + ASSERT_EQ(createIface(IfaceType::STA), "test2"); +} + +TEST_F(WifiChip_MultiIfaceTest, CreateStaWithCustomAltNames) { + property_set("wifi.interface.0", ""); + property_set("wifi.interface.1", ""); + property_set("wifi.interface.2", ""); + property_set("wifi.interface", "testA0"); + property_set("wifi.concurrent.interface", "testA1"); + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + ASSERT_EQ(createIface(IfaceType::STA), "testA0"); + ASSERT_EQ(createIface(IfaceType::STA), "testA1"); + ASSERT_EQ(createIface(IfaceType::STA), "wlan2"); +} + +TEST_F(WifiChip_MultiIfaceTest, CreateApStartsWithIdx1) { + // WifiChip_MultiIfaceTest iface combo: STAx3 + APx1 + // When the HAL support dual STAs, AP should start with idx 2. + findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); + // First AP will be slotted to wlan1. + ASSERT_EQ(createIface(IfaceType::AP), "wlan2"); + // First STA will be slotted to wlan0. + ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); + // All further STA will be slotted to the remaining free indices. + ASSERT_EQ(createIface(IfaceType::STA), "wlan1"); + ASSERT_EQ(createIface(IfaceType::STA), "wlan3"); +} + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/tests/wifi_iface_util_unit_tests.cpp b/wifi/aidl/default/tests/wifi_iface_util_unit_tests.cpp new file mode 100644 index 0000000000..e0db6fdc90 --- /dev/null +++ b/wifi/aidl/default/tests/wifi_iface_util_unit_tests.cpp @@ -0,0 +1,94 @@ +/* + * 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. + */ + +#include +#include +#include + +#include "wifi_iface_util.h" + +#include "mock_interface_tool.h" +#include "mock_wifi_legacy_hal.h" + +using testing::NiceMock; +using testing::Test; + +namespace { +constexpr uint8_t kValidUnicastLocallyAssignedMacAddressMask = 0x02; +constexpr uint8_t kMacAddress[] = {0x02, 0x12, 0x45, 0x56, 0xab, 0xcc}; +constexpr char kIfaceName[] = "test-wlan0"; + +bool isValidUnicastLocallyAssignedMacAddress(const std::array& mac_address) { + uint8_t first_byte = mac_address[0]; + return (first_byte & 0x3) == kValidUnicastLocallyAssignedMacAddressMask; +} +} // namespace + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace iface_util { + +class WifiIfaceUtilTest : public Test { + protected: + std::shared_ptr> iface_tool_{ + new NiceMock<::android::wifi_system::MockInterfaceTool>}; + legacy_hal::wifi_hal_fn fake_func_table_; + std::shared_ptr> legacy_hal_{ + new NiceMock(iface_tool_, fake_func_table_, true)}; + WifiIfaceUtil* iface_util_ = new WifiIfaceUtil(iface_tool_, legacy_hal_); +}; + +TEST_F(WifiIfaceUtilTest, GetOrCreateRandomMacAddress) { + auto mac_address = iface_util_->getOrCreateRandomMacAddress(); + ASSERT_TRUE(isValidUnicastLocallyAssignedMacAddress(mac_address)); + + // All further calls should return the same MAC address. + ASSERT_EQ(mac_address, iface_util_->getOrCreateRandomMacAddress()); + ASSERT_EQ(mac_address, iface_util_->getOrCreateRandomMacAddress()); +} + +TEST_F(WifiIfaceUtilTest, IfaceEventHandlers_SetMacAddress) { + std::array mac_address = {}; + std::copy(std::begin(kMacAddress), std::end(kMacAddress), std::begin(mac_address)); + EXPECT_CALL(*iface_tool_, SetMacAddress(testing::_, testing::_)) + .WillRepeatedly(testing::Return(true)); + EXPECT_CALL(*iface_tool_, SetUpState(testing::_, testing::_)) + .WillRepeatedly(testing::Return(true)); + + // Register for iface state toggle events. + bool callback_invoked = false; + iface_util::IfaceEventHandlers event_handlers = {}; + event_handlers.on_state_toggle_off_on = + [&callback_invoked](const std::string& /* iface_name */) { callback_invoked = true; }; + iface_util_->registerIfaceEventHandlers(kIfaceName, event_handlers); + // Invoke setMacAddress and ensure that the cb is invoked. + ASSERT_TRUE(iface_util_->setMacAddress(kIfaceName, mac_address)); + ASSERT_TRUE(callback_invoked); + + // Unregister for iface state toggle events. + callback_invoked = false; + iface_util_->unregisterIfaceEventHandlers(kIfaceName); + // Invoke setMacAddress and ensure that the cb is not invoked. + ASSERT_TRUE(iface_util_->setMacAddress(kIfaceName, mac_address)); + ASSERT_FALSE(callback_invoked); +} +} // namespace iface_util +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp b/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp new file mode 100644 index 0000000000..d40801faef --- /dev/null +++ b/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp @@ -0,0 +1,168 @@ +/* + * 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. + */ + +#include +#include +#include +#include + +#include "wifi_nan_iface.h" + +#include "mock_interface_tool.h" +#include "mock_wifi_feature_flags.h" +#include "mock_wifi_iface_util.h" +#include "mock_wifi_legacy_hal.h" + +using testing::NiceMock; +using testing::Return; +using testing::Test; + +namespace { +constexpr char kIfaceName[] = "mockWlan0"; +} // namespace + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { + +bool CaptureIfaceEventHandlers(const std::string& /* iface_name*/, + iface_util::IfaceEventHandlers in_iface_event_handlers, + iface_util::IfaceEventHandlers* out_iface_event_handlers) { + *out_iface_event_handlers = in_iface_event_handlers; + return true; +} + +class MockNanIface : public WifiNanIface { + public: + MockNanIface(const std::string& ifname, bool is_dedicated_iface, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util) + : WifiNanIface(ifname, is_dedicated_iface, legacy_hal, iface_util) {} + + static std::shared_ptr createMock( + const std::string& ifname, bool is_dedicated_iface, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util) { + std::shared_ptr ptr = ndk::SharedRefBase::make( + ifname, is_dedicated_iface, legacy_hal, iface_util); + std::weak_ptr weak_ptr_this(ptr); + ptr->setWeakPtr(weak_ptr_this); + ptr->registerCallbackHandlers(); + return ptr; + } + + // Override getEventCallbacks() so that we can return a mocked callback object. + std::set> getEventCallbacks() override { + return {callback_}; + } + + void setMockCallback(std::shared_ptr cb) { callback_ = cb; } + + private: + std::shared_ptr callback_; +}; + +class MockNanIfaceEventCallback : public IWifiNanIfaceEventCallback { + public: + ndk::SpAIBinder asBinder() override { return ::ndk::SpAIBinder{}; } + bool isRemote() override { return false; } + + ::ndk::ScopedAStatus getInterfaceVersion(int32_t* _aidl_return) override { + *_aidl_return = 1; + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus getInterfaceHash(std::string* _aidl_return) override { + *_aidl_return = "some_hash"; + return ndk::ScopedAStatus::ok(); + } + + MOCK_METHOD3(notifyCapabilitiesResponse, + ndk::ScopedAStatus(char16_t, const NanStatus&, const NanCapabilities&)); + MOCK_METHOD2(notifyEnableResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD2(notifyConfigResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD2(notifyDisableResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD3(notifyStartPublishResponse, + ndk::ScopedAStatus(char16_t, const NanStatus&, int8_t)); + MOCK_METHOD2(notifyStopPublishResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD3(notifyStartSubscribeResponse, + ndk::ScopedAStatus(char16_t, const NanStatus&, int8_t)); + MOCK_METHOD2(notifyStopSubscribeResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD2(notifyTransmitFollowupResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD2(notifyCreateDataInterfaceResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD2(notifyDeleteDataInterfaceResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD3(notifyInitiateDataPathResponse, + ndk::ScopedAStatus(char16_t, const NanStatus&, int32_t)); + MOCK_METHOD2(notifyRespondToDataPathIndicationResponse, + ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD2(notifyTerminateDataPathResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD1(eventClusterEvent, ndk::ScopedAStatus(const NanClusterEventInd&)); + MOCK_METHOD1(eventDisabled, ndk::ScopedAStatus(const NanStatus&)); + MOCK_METHOD2(eventPublishTerminated, ndk::ScopedAStatus(int8_t, const NanStatus&)); + MOCK_METHOD2(eventSubscribeTerminated, ndk::ScopedAStatus(int8_t, const NanStatus&)); + MOCK_METHOD1(eventMatch, ndk::ScopedAStatus(const NanMatchInd&)); + MOCK_METHOD2(eventMatchExpired, ndk::ScopedAStatus(int8_t, int32_t)); + MOCK_METHOD1(eventFollowupReceived, ndk::ScopedAStatus(const NanFollowupReceivedInd&)); + MOCK_METHOD2(eventTransmitFollowup, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD1(eventDataPathRequest, ndk::ScopedAStatus(const NanDataPathRequestInd&)); + MOCK_METHOD1(eventDataPathConfirm, ndk::ScopedAStatus(const NanDataPathConfirmInd&)); + MOCK_METHOD1(eventDataPathTerminated, ndk::ScopedAStatus(int32_t)); + MOCK_METHOD1(eventDataPathScheduleUpdate, + ndk::ScopedAStatus(const NanDataPathScheduleUpdateInd&)); +}; + +class WifiNanIfaceTest : public Test { + protected: + legacy_hal::wifi_hal_fn fake_func_table_; + std::shared_ptr> iface_tool_{ + new NiceMock<::android::wifi_system::MockInterfaceTool>}; + std::shared_ptr> legacy_hal_{ + new NiceMock(iface_tool_, fake_func_table_, true)}; + std::shared_ptr> iface_util_{ + new NiceMock(iface_tool_, legacy_hal_)}; +}; + +TEST_F(WifiNanIfaceTest, IfacEventHandlers_OnStateToggleOffOn) { + // Ensure that event handlers are registered during nan iface creation. + iface_util::IfaceEventHandlers captured_iface_event_handlers = {}; + EXPECT_CALL(*legacy_hal_, nanRegisterCallbackHandlers(testing::_, testing::_)) + .WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS)); + EXPECT_CALL(*iface_util_, registerIfaceEventHandlers(testing::_, testing::_)) + .WillOnce(testing::Invoke(bind(CaptureIfaceEventHandlers, std::placeholders::_1, + std::placeholders::_2, &captured_iface_event_handlers))); + + // Create nan iface and register a callback. + // Note: Since we can't register a callback directly (gTest fails on + // AIBinder_linkToDeath), simulate the registration by overriding + // getEventCallbacks() to return our mock callback object. + std::shared_ptr mock_nan_iface = + MockNanIface::createMock(kIfaceName, false, legacy_hal_, iface_util_); + std::shared_ptr mock_event_callback = + ndk::SharedRefBase::make(); + mock_nan_iface->setMockCallback(mock_event_callback); + + // Ensure that the eventDisabled() function in the mock callback will be invoked. + NanStatus expected_nan_status = {NanStatusCode::UNSUPPORTED_CONCURRENCY_NAN_DISABLED, ""}; + EXPECT_CALL(*mock_event_callback, eventDisabled(expected_nan_status)).Times(1); + + // Trigger the iface state toggle callback. + captured_iface_event_handlers.on_state_toggle_off_on(kIfaceName); +} + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/wifi.cpp b/wifi/aidl/default/wifi.cpp new file mode 100644 index 0000000000..e30c38abcf --- /dev/null +++ b/wifi/aidl/default/wifi.cpp @@ -0,0 +1,284 @@ +/* + * 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. + */ + +#include "wifi.h" + +#include + +#include "aidl_return_util.h" +#include "wifi_status_util.h" + +namespace { +// Starting Chip ID, will be assigned to primary chip +static constexpr int32_t kPrimaryChipId = 0; +} // namespace + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +using aidl_return_util::validateAndCall; +using aidl_return_util::validateAndCallWithLock; + +Wifi::Wifi(const std::shared_ptr<::android::wifi_system::InterfaceTool> iface_tool, + const std::shared_ptr legacy_hal_factory, + const std::shared_ptr mode_controller, + const std::shared_ptr feature_flags) + : iface_tool_(iface_tool), + legacy_hal_factory_(legacy_hal_factory), + mode_controller_(mode_controller), + feature_flags_(feature_flags), + run_state_(RunState::STOPPED) {} + +bool Wifi::isValid() { + // This object is always valid. + return true; +} + +ndk::ScopedAStatus Wifi::registerEventCallback( + const std::shared_ptr& in_callback) { + return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN, + &Wifi::registerEventCallbackInternal, in_callback); +} + +ndk::ScopedAStatus Wifi::isStarted(bool* _aidl_return) { + *_aidl_return = (run_state_ != RunState::STOPPED); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Wifi::start() { + return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN, &Wifi::startInternal); +} + +ndk::ScopedAStatus Wifi::stop() { + return validateAndCallWithLock(this, WifiStatusCode::ERROR_UNKNOWN, &Wifi::stopInternal); +} + +ndk::ScopedAStatus Wifi::getChipIds(std::vector* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN, &Wifi::getChipIdsInternal, + _aidl_return); +} + +ndk::ScopedAStatus Wifi::getChip(int32_t in_chipId, std::shared_ptr* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN, &Wifi::getChipInternal, + _aidl_return, in_chipId); +} + +binder_status_t Wifi::dump(int fd, const char** args, uint32_t numArgs) { + LOG(INFO) << "-----------Debug was called----------------"; + if (chips_.size() == 0) { + LOG(INFO) << "No chips to display."; + return STATUS_OK; + } + + for (std::shared_ptr chip : chips_) { + if (!chip.get()) continue; + chip->dump(fd, args, numArgs); + } + return STATUS_OK; +} + +ndk::ScopedAStatus Wifi::registerEventCallbackInternal( + const std::shared_ptr& event_callback) { + if (!event_cb_handler_.addCallback(event_callback)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Wifi::startInternal() { + if (run_state_ == RunState::STARTED) { + return ndk::ScopedAStatus::ok(); + } else if (run_state_ == RunState::STOPPING) { + return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE, "HAL is stopping"); + } + ndk::ScopedAStatus wifi_status = initializeModeControllerAndLegacyHal(); + if (wifi_status.isOk()) { + // Register the callback for subsystem restart + const auto& on_subsystem_restart_callback = [this](const std::string& error) { + ndk::ScopedAStatus wifi_status = createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, error); + for (const auto& callback : event_cb_handler_.getCallbacks()) { + LOG(INFO) << "Attempting to invoke onSubsystemRestart " + "callback"; + WifiStatusCode errorCode = + static_cast(wifi_status.getServiceSpecificError()); + if (!callback->onSubsystemRestart(errorCode).isOk()) { + LOG(ERROR) << "Failed to invoke onSubsystemRestart callback"; + } else { + LOG(INFO) << "Succeeded to invoke onSubsystemRestart " + "callback"; + } + } + }; + + // Create the chip instance once the HAL is started. + int32_t chipId = kPrimaryChipId; + for (auto& hal : legacy_hals_) { + chips_.push_back( + WifiChip::create(chipId, chipId == kPrimaryChipId, hal, mode_controller_, + std::make_shared(iface_tool_, hal), + feature_flags_, on_subsystem_restart_callback)); + chipId++; + } + run_state_ = RunState::STARTED; + for (const auto& callback : event_cb_handler_.getCallbacks()) { + if (!callback->onStart().isOk()) { + LOG(ERROR) << "Failed to invoke onStart callback"; + }; + } + LOG(INFO) << "Wifi HAL started"; + } else { + for (const auto& callback : event_cb_handler_.getCallbacks()) { + WifiStatusCode errorCode = + static_cast(wifi_status.getServiceSpecificError()); + if (!callback->onFailure(errorCode).isOk()) { + LOG(ERROR) << "Failed to invoke onFailure callback"; + } + } + LOG(ERROR) << "Wifi HAL start failed"; + // Clear the event callback objects since the HAL start failed. + event_cb_handler_.invalidate(); + } + return wifi_status; +} + +ndk::ScopedAStatus Wifi::stopInternal( + /* NONNULL */ std::unique_lock* lock) { + if (run_state_ == RunState::STOPPED) { + return ndk::ScopedAStatus::ok(); + } else if (run_state_ == RunState::STOPPING) { + return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE, "HAL is stopping"); + } + // Clear the chip object and its child objects since the HAL is now + // stopped. + for (auto& chip : chips_) { + if (chip.get()) { + chip->invalidate(); + chip.reset(); + } + } + chips_.clear(); + ndk::ScopedAStatus wifi_status = stopLegacyHalAndDeinitializeModeController(lock); + if (wifi_status.isOk()) { + for (const auto& callback : event_cb_handler_.getCallbacks()) { + if (!callback->onStop().isOk()) { + LOG(ERROR) << "Failed to invoke onStop callback"; + }; + } + LOG(INFO) << "Wifi HAL stopped"; + } else { + for (const auto& callback : event_cb_handler_.getCallbacks()) { + WifiStatusCode errorCode = + static_cast(wifi_status.getServiceSpecificError()); + if (!callback->onFailure(errorCode).isOk()) { + LOG(ERROR) << "Failed to invoke onFailure callback"; + } + } + LOG(ERROR) << "Wifi HAL stop failed"; + } + // Clear the event callback objects since the HAL is now stopped. + event_cb_handler_.invalidate(); + return wifi_status; +} + +std::pair, ndk::ScopedAStatus> Wifi::getChipIdsInternal() { + std::vector chip_ids; + + for (auto& chip : chips_) { + int32_t chip_id = getChipIdFromWifiChip(chip); + if (chip_id != INT32_MAX) chip_ids.emplace_back(chip_id); + } + return {std::move(chip_ids), ndk::ScopedAStatus::ok()}; +} + +std::pair, ndk::ScopedAStatus> Wifi::getChipInternal(int32_t chip_id) { + for (auto& chip : chips_) { + int32_t cand_id = getChipIdFromWifiChip(chip); + if ((cand_id != INT32_MAX) && (cand_id == chip_id)) return {chip, ndk::ScopedAStatus::ok()}; + } + + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)}; +} + +ndk::ScopedAStatus Wifi::initializeModeControllerAndLegacyHal() { + if (!mode_controller_->initialize()) { + LOG(ERROR) << "Failed to initialize firmware mode controller"; + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + + legacy_hals_ = legacy_hal_factory_->getHals(); + if (legacy_hals_.empty()) return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + int index = 0; // for failure log + for (auto& hal : legacy_hals_) { + legacy_hal::wifi_error legacy_status = hal->initialize(); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + // Currently WifiLegacyHal::initialize does not allocate extra mem, + // only initializes the function table. If this changes, need to + // implement WifiLegacyHal::deinitialize and deinitalize the + // HALs already initialized + LOG(ERROR) << "Failed to initialize legacy HAL index: " << index + << " error: " << legacyErrorToString(legacy_status); + return createWifiStatusFromLegacyError(legacy_status); + } + index++; + } + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Wifi::stopLegacyHalAndDeinitializeModeController( + /* NONNULL */ std::unique_lock* lock) { + legacy_hal::wifi_error legacy_status = legacy_hal::WIFI_SUCCESS; + int index = 0; + + run_state_ = RunState::STOPPING; + for (auto& hal : legacy_hals_) { + legacy_hal::wifi_error tmp = hal->stop(lock, [&]() {}); + if (tmp != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to stop legacy HAL index: " << index + << " error: " << legacyErrorToString(legacy_status); + legacy_status = tmp; + } + index++; + } + run_state_ = RunState::STOPPED; + + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "One or more legacy HALs failed to stop"; + return createWifiStatusFromLegacyError(legacy_status); + } + if (!mode_controller_->deinitialize()) { + LOG(ERROR) << "Failed to deinitialize firmware mode controller"; + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + return ndk::ScopedAStatus::ok(); +} + +int32_t Wifi::getChipIdFromWifiChip(std::shared_ptr& chip) { + int32_t chip_id = INT32_MAX; + if (chip.get()) { + ndk::ScopedAStatus status = chip->getId(&chip_id); + if (!status.isOk()) { + // Reset value if operation failed. + chip_id = INT32_MAX; + } + } + return chip_id; +} + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/wifi.h b/wifi/aidl/default/wifi.h new file mode 100644 index 0000000000..933452448e --- /dev/null +++ b/wifi/aidl/default/wifi.h @@ -0,0 +1,96 @@ +/* + * 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. + */ + +#ifndef WIFI_H_ +#define WIFI_H_ + +#include +#include +#include + +#include + +#include "aidl_callback_util.h" +#include "wifi_chip.h" +#include "wifi_feature_flags.h" +#include "wifi_legacy_hal.h" +#include "wifi_legacy_hal_factory.h" +#include "wifi_mode_controller.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { + +/** + * Root AIDL interface object used to control the Wifi HAL. + */ +class Wifi : public BnWifi { + public: + Wifi(const std::shared_ptr<::android::wifi_system::InterfaceTool> iface_tool, + const std::shared_ptr legacy_hal_factory, + const std::shared_ptr mode_controller, + const std::shared_ptr feature_flags); + + bool isValid(); + + // AIDL methods exposed. + ndk::ScopedAStatus registerEventCallback( + const std::shared_ptr& in_callback) override; + ndk::ScopedAStatus isStarted(bool* _aidl_return) override; + ndk::ScopedAStatus start() override; + ndk::ScopedAStatus stop() override; + ndk::ScopedAStatus getChipIds(std::vector* _aidl_return) override; + ndk::ScopedAStatus getChip(int32_t in_chipId, + std::shared_ptr* _aidl_return) override; + binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; + + private: + enum class RunState { STOPPED, STARTED, STOPPING }; + + // Corresponding worker functions for the AIDL methods. + ndk::ScopedAStatus registerEventCallbackInternal( + const std::shared_ptr& event_callback __unused); + ndk::ScopedAStatus startInternal(); + ndk::ScopedAStatus stopInternal(std::unique_lock* lock); + std::pair, ndk::ScopedAStatus> getChipIdsInternal(); + std::pair, ndk::ScopedAStatus> getChipInternal(int32_t chip_id); + + ndk::ScopedAStatus initializeModeControllerAndLegacyHal(); + ndk::ScopedAStatus stopLegacyHalAndDeinitializeModeController( + std::unique_lock* lock); + int32_t getChipIdFromWifiChip(std::shared_ptr& chip); + + // Instance is created in this root level |IWifi| AIDL interface object + // and shared with all the child AIDL interface objects. + std::shared_ptr<::android::wifi_system::InterfaceTool> iface_tool_; + std::shared_ptr legacy_hal_factory_; + std::shared_ptr mode_controller_; + std::vector> legacy_hals_; + std::shared_ptr feature_flags_; + RunState run_state_; + std::vector> chips_; + aidl_callback_util::AidlCallbackHandler event_cb_handler_; + + DISALLOW_COPY_AND_ASSIGN(Wifi); +}; + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // WIFI_H_ diff --git a/wifi/aidl/default/wifi_ap_iface.cpp b/wifi/aidl/default/wifi_ap_iface.cpp new file mode 100644 index 0000000000..6cd932df41 --- /dev/null +++ b/wifi/aidl/default/wifi_ap_iface.cpp @@ -0,0 +1,190 @@ +/* + * 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. + */ + +#include "wifi_ap_iface.h" + +#include + +#include "aidl_return_util.h" +#include "aidl_struct_util.h" +#include "wifi_status_util.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +using aidl_return_util::validateAndCall; + +WifiApIface::WifiApIface(const std::string& ifname, const std::vector& instances, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util) + : ifname_(ifname), + instances_(instances), + legacy_hal_(legacy_hal), + iface_util_(iface_util), + is_valid_(true) {} + +void WifiApIface::invalidate() { + legacy_hal_.reset(); + is_valid_ = false; +} + +bool WifiApIface::isValid() { + return is_valid_; +} + +std::string WifiApIface::getName() { + return ifname_; +} + +void WifiApIface::removeInstance(std::string instance) { + instances_.erase(std::remove(instances_.begin(), instances_.end(), instance), instances_.end()); +} + +ndk::ScopedAStatus WifiApIface::getName(std::string* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiApIface::getNameInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiApIface::setCountryCode(const std::array& in_code) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiApIface::setCountryCodeInternal, in_code); +} + +ndk::ScopedAStatus WifiApIface::getValidFrequenciesForBand(WifiBand in_band, + std::vector* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiApIface::getValidFrequenciesForBandInternal, _aidl_return, in_band); +} + +ndk::ScopedAStatus WifiApIface::setMacAddress(const std::array& in_mac) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiApIface::setMacAddressInternal, in_mac); +} + +ndk::ScopedAStatus WifiApIface::getFactoryMacAddress(std::array* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiApIface::getFactoryMacAddressInternal, _aidl_return, + instances_.size() > 0 ? instances_[0] : ifname_); +} + +ndk::ScopedAStatus WifiApIface::resetToFactoryMacAddress() { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiApIface::resetToFactoryMacAddressInternal); +} + +ndk::ScopedAStatus WifiApIface::getBridgedInstances(std::vector* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiApIface::getBridgedInstancesInternal, _aidl_return); +} + +std::pair WifiApIface::getNameInternal() { + return {ifname_, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiApIface::setCountryCodeInternal(const std::array& code) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->setCountryCode( + instances_.size() > 0 ? instances_[0] : ifname_, code); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair, ndk::ScopedAStatus> WifiApIface::getValidFrequenciesForBandInternal( + WifiBand band) { + static_assert(sizeof(WifiChannelWidthInMhz) == sizeof(int32_t), "Size mismatch"); + legacy_hal::wifi_error legacy_status; + std::vector valid_frequencies; + std::tie(legacy_status, valid_frequencies) = legacy_hal_.lock()->getValidFrequenciesForBand( + instances_.size() > 0 ? instances_[0] : ifname_, + aidl_struct_util::convertAidlWifiBandToLegacy(band)); + return {std::vector(valid_frequencies.begin(), valid_frequencies.end()), + createWifiStatusFromLegacyError(legacy_status)}; +} + +ndk::ScopedAStatus WifiApIface::setMacAddressInternal(const std::array& mac) { + // Support random MAC up to 2 interfaces + if (instances_.size() == 2) { + int rbyte = 1; + for (auto const& intf : instances_) { + std::array rmac = mac; + // reverse the bits to avoid collision + rmac[rbyte] = 0xff - rmac[rbyte]; + if (!iface_util_.lock()->setMacAddress(intf, rmac)) { + LOG(INFO) << "Failed to set random mac address on " << intf; + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + rbyte++; + } + } + // It also needs to set mac address for bridged interface, otherwise the mac + // address of bridged interface will be changed after one of instance + // down. + if (!iface_util_.lock()->setMacAddress(ifname_, mac)) { + LOG(ERROR) << "Fail to config MAC for interface " << ifname_; + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + return ndk::ScopedAStatus::ok(); +} + +std::pair, ndk::ScopedAStatus> WifiApIface::getFactoryMacAddressInternal( + const std::string& ifaceName) { + std::array mac = iface_util_.lock()->getFactoryMacAddress(ifaceName); + if (mac[0] == 0 && mac[1] == 0 && mac[2] == 0 && mac[3] == 0 && mac[4] == 0 && mac[5] == 0) { + return {mac, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {mac, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiApIface::resetToFactoryMacAddressInternal() { + std::pair, ndk::ScopedAStatus> getMacResult; + if (instances_.size() == 2) { + for (auto const& intf : instances_) { + getMacResult = getFactoryMacAddressInternal(intf); + LOG(DEBUG) << "Reset MAC to factory MAC on " << intf; + if (!getMacResult.second.isOk() || + !iface_util_.lock()->setMacAddress(intf, getMacResult.first)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + } + // We need to set mac address for bridged interface, otherwise the mac + // address of the bridged interface will be changed after one of the + // instances goes down. Thus we are generating a random MAC address for + // the bridged interface even if we got the request to reset the Factory + // MAC. This is because the bridged interface is an internal interface + // for the operation of bpf and other networking operations. + if (!iface_util_.lock()->setMacAddress(ifname_, + iface_util_.lock()->createRandomMacAddress())) { + LOG(ERROR) << "Fail to config MAC for bridged interface " << ifname_; + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + } else { + getMacResult = getFactoryMacAddressInternal(ifname_); + LOG(DEBUG) << "Reset MAC to factory MAC on " << ifname_; + if (!getMacResult.second.isOk() || + !iface_util_.lock()->setMacAddress(ifname_, getMacResult.first)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + } + return ndk::ScopedAStatus::ok(); +} + +std::pair, ndk::ScopedAStatus> WifiApIface::getBridgedInstancesInternal() { + return {instances_, ndk::ScopedAStatus::ok()}; +} + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/wifi_ap_iface.h b/wifi/aidl/default/wifi_ap_iface.h new file mode 100644 index 0000000000..b5673fcaac --- /dev/null +++ b/wifi/aidl/default/wifi_ap_iface.h @@ -0,0 +1,81 @@ +/* + * 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. + */ + +#ifndef WIFI_AP_IFACE_H_ +#define WIFI_AP_IFACE_H_ + +#include +#include + +#include "wifi_iface_util.h" +#include "wifi_legacy_hal.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { + +/** + * AIDL interface object used to control an AP Iface instance. + */ +class WifiApIface : public BnWifiApIface { + public: + WifiApIface(const std::string& ifname, const std::vector& instances, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util); + // Refer to |WifiChip::invalidate()|. + void invalidate(); + bool isValid(); + std::string getName(); + void removeInstance(std::string instance); + + // AIDL methods exposed. + ndk::ScopedAStatus getName(std::string* _aidl_return) override; + ndk::ScopedAStatus setCountryCode(const std::array& in_code) override; + ndk::ScopedAStatus getValidFrequenciesForBand(WifiBand in_band, + std::vector* _aidl_return) override; + ndk::ScopedAStatus setMacAddress(const std::array& in_mac) override; + ndk::ScopedAStatus getFactoryMacAddress(std::array* _aidl_return) override; + ndk::ScopedAStatus resetToFactoryMacAddress() override; + ndk::ScopedAStatus getBridgedInstances(std::vector* _aidl_return) override; + + private: + // Corresponding worker functions for the AIDL methods. + std::pair getNameInternal(); + ndk::ScopedAStatus setCountryCodeInternal(const std::array& code); + std::pair, ndk::ScopedAStatus> getValidFrequenciesForBandInternal( + WifiBand band); + ndk::ScopedAStatus setMacAddressInternal(const std::array& mac); + std::pair, ndk::ScopedAStatus> getFactoryMacAddressInternal( + const std::string& ifaceName); + ndk::ScopedAStatus resetToFactoryMacAddressInternal(); + std::pair, ndk::ScopedAStatus> getBridgedInstancesInternal(); + + std::string ifname_; + std::vector instances_; + std::weak_ptr legacy_hal_; + std::weak_ptr iface_util_; + bool is_valid_; + + DISALLOW_COPY_AND_ASSIGN(WifiApIface); +}; + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // WIFI_AP_IFACE_H_ diff --git a/wifi/aidl/default/wifi_chip.cpp b/wifi/aidl/default/wifi_chip.cpp new file mode 100644 index 0000000000..076f351448 --- /dev/null +++ b/wifi/aidl/default/wifi_chip.cpp @@ -0,0 +1,1910 @@ +/* + * 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. + */ + +#include "wifi_chip.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "aidl_return_util.h" +#include "aidl_struct_util.h" +#include "wifi_status_util.h" + +#define P2P_MGMT_DEVICE_PREFIX "p2p-dev-" + +namespace { +using aidl::android::hardware::wifi::IfaceType; +using aidl::android::hardware::wifi::IWifiChip; +using CoexRestriction = aidl::android::hardware::wifi::IWifiChip::CoexRestriction; +using android::base::unique_fd; + +constexpr char kCpioMagic[] = "070701"; +constexpr size_t kMaxBufferSizeBytes = 1024 * 1024 * 3; +constexpr uint32_t kMaxRingBufferFileAgeSeconds = 60 * 60 * 10; +constexpr uint32_t kMaxRingBufferFileNum = 20; +constexpr char kTombstoneFolderPath[] = "/data/vendor/tombstones/wifi/"; +constexpr char kActiveWlanIfaceNameProperty[] = "wifi.active.interface"; +constexpr char kNoActiveWlanIfaceNamePropertyValue[] = ""; +constexpr unsigned kMaxWlanIfaces = 5; +constexpr char kApBridgeIfacePrefix[] = "ap_br_"; + +template +void invalidateAndClear(std::vector>& ifaces, std::shared_ptr iface) { + iface->invalidate(); + ifaces.erase(std::remove(ifaces.begin(), ifaces.end(), iface), ifaces.end()); +} + +template +void invalidateAndClearAll(std::vector>& ifaces) { + for (const auto& iface : ifaces) { + iface->invalidate(); + } + ifaces.clear(); +} + +template +std::vector getNames(std::vector>& ifaces) { + std::vector names; + for (const auto& iface : ifaces) { + names.emplace_back(iface->getName()); + } + return names; +} + +template +std::shared_ptr findUsingName(std::vector>& ifaces, + const std::string& name) { + std::vector names; + for (const auto& iface : ifaces) { + if (name == iface->getName()) { + return iface; + } + } + return nullptr; +} + +std::string getWlanIfaceName(unsigned idx) { + if (idx >= kMaxWlanIfaces) { + CHECK(false) << "Requested interface beyond wlan" << kMaxWlanIfaces; + return {}; + } + + std::array buffer; + if (idx == 0 || idx == 1) { + const char* altPropName = (idx == 0) ? "wifi.interface" : "wifi.concurrent.interface"; + auto res = property_get(altPropName, buffer.data(), nullptr); + if (res > 0) return buffer.data(); + } + std::string propName = "wifi.interface." + std::to_string(idx); + auto res = property_get(propName.c_str(), buffer.data(), nullptr); + if (res > 0) return buffer.data(); + + return "wlan" + std::to_string(idx); +} + +// Returns the dedicated iface name if defined. +// Returns two ifaces in bridged mode. +std::vector getPredefinedApIfaceNames(bool is_bridged) { + std::vector ifnames; + std::array buffer; + buffer.fill(0); + if (property_get("ro.vendor.wifi.sap.interface", buffer.data(), nullptr) == 0) { + return ifnames; + } + ifnames.push_back(buffer.data()); + if (is_bridged) { + buffer.fill(0); + if (property_get("ro.vendor.wifi.sap.concurrent.iface", buffer.data(), nullptr) == 0) { + return ifnames; + } + ifnames.push_back(buffer.data()); + } + return ifnames; +} + +std::string getPredefinedP2pIfaceName() { + std::array primaryIfaceName; + char p2pParentIfname[100]; + std::string p2pDevIfName = ""; + std::array buffer; + property_get("wifi.direct.interface", buffer.data(), "p2p0"); + if (strncmp(buffer.data(), P2P_MGMT_DEVICE_PREFIX, strlen(P2P_MGMT_DEVICE_PREFIX)) == 0) { + /* Get the p2p parent interface name from p2p device interface name set + * in property */ + strlcpy(p2pParentIfname, buffer.data() + strlen(P2P_MGMT_DEVICE_PREFIX), + strlen(buffer.data()) - strlen(P2P_MGMT_DEVICE_PREFIX)); + if (property_get(kActiveWlanIfaceNameProperty, primaryIfaceName.data(), nullptr) == 0) { + return buffer.data(); + } + /* Check if the parent interface derived from p2p device interface name + * is active */ + if (strncmp(p2pParentIfname, primaryIfaceName.data(), + strlen(buffer.data()) - strlen(P2P_MGMT_DEVICE_PREFIX)) != 0) { + /* + * Update the predefined p2p device interface parent interface name + * with current active wlan interface + */ + p2pDevIfName += P2P_MGMT_DEVICE_PREFIX; + p2pDevIfName += primaryIfaceName.data(); + LOG(INFO) << "update the p2p device interface name to " << p2pDevIfName.c_str(); + return p2pDevIfName; + } + } + return buffer.data(); +} + +// Returns the dedicated iface name if one is defined. +std::string getPredefinedNanIfaceName() { + std::array buffer; + if (property_get("wifi.aware.interface", buffer.data(), nullptr) == 0) { + return {}; + } + return buffer.data(); +} + +void setActiveWlanIfaceNameProperty(const std::string& ifname) { + auto res = property_set(kActiveWlanIfaceNameProperty, ifname.data()); + if (res != 0) { + PLOG(ERROR) << "Failed to set active wlan iface name property"; + } +} + +// Delete files that meet either condition: +// 1. Older than a predefined time in the wifi tombstone dir. +// 2. Files in excess to a predefined amount, starting from the oldest ones +bool removeOldFilesInternal() { + time_t now = time(0); + const time_t delete_files_before = now - kMaxRingBufferFileAgeSeconds; + std::unique_ptr dir_dump(opendir(kTombstoneFolderPath), closedir); + if (!dir_dump) { + PLOG(ERROR) << "Failed to open directory"; + return false; + } + struct dirent* dp; + bool success = true; + std::list> valid_files; + while ((dp = readdir(dir_dump.get()))) { + if (dp->d_type != DT_REG) { + continue; + } + std::string cur_file_name(dp->d_name); + struct stat cur_file_stat; + std::string cur_file_path = kTombstoneFolderPath + cur_file_name; + if (stat(cur_file_path.c_str(), &cur_file_stat) == -1) { + PLOG(ERROR) << "Failed to get file stat for " << cur_file_path; + success = false; + continue; + } + const time_t cur_file_time = cur_file_stat.st_mtime; + valid_files.push_back(std::pair(cur_file_time, cur_file_path)); + } + valid_files.sort(); // sort the list of files by last modified time from + // small to big. + uint32_t cur_file_count = valid_files.size(); + for (auto cur_file : valid_files) { + if (cur_file_count > kMaxRingBufferFileNum || cur_file.first < delete_files_before) { + if (unlink(cur_file.second.c_str()) != 0) { + PLOG(ERROR) << "Error deleting file"; + success = false; + } + cur_file_count--; + } else { + break; + } + } + return success; +} + +// Helper function for |cpioArchiveFilesInDir| +bool cpioWriteHeader(int out_fd, struct stat& st, const char* file_name, size_t file_name_len) { + const int buf_size = 32 * 1024; + std::array read_buf; + ssize_t llen = snprintf( + read_buf.data(), buf_size, "%s%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X", + kCpioMagic, static_cast(st.st_ino), st.st_mode, st.st_uid, st.st_gid, + static_cast(st.st_nlink), static_cast(st.st_mtime), + static_cast(st.st_size), major(st.st_dev), minor(st.st_dev), major(st.st_rdev), + minor(st.st_rdev), static_cast(file_name_len), 0); + if (write(out_fd, read_buf.data(), llen < buf_size ? llen : buf_size - 1) == -1) { + PLOG(ERROR) << "Error writing cpio header to file " << file_name; + return false; + } + if (write(out_fd, file_name, file_name_len) == -1) { + PLOG(ERROR) << "Error writing filename to file " << file_name; + return false; + } + + // NUL Pad header up to 4 multiple bytes. + llen = (llen + file_name_len) % 4; + if (llen != 0) { + const uint32_t zero = 0; + if (write(out_fd, &zero, 4 - llen) == -1) { + PLOG(ERROR) << "Error padding 0s to file " << file_name; + return false; + } + } + return true; +} + +// Helper function for |cpioArchiveFilesInDir| +size_t cpioWriteFileContent(int fd_read, int out_fd, struct stat& st) { + // writing content of file + std::array read_buf; + ssize_t llen = st.st_size; + size_t n_error = 0; + while (llen > 0) { + ssize_t bytes_read = read(fd_read, read_buf.data(), read_buf.size()); + if (bytes_read == -1) { + PLOG(ERROR) << "Error reading file"; + return ++n_error; + } + llen -= bytes_read; + if (write(out_fd, read_buf.data(), bytes_read) == -1) { + PLOG(ERROR) << "Error writing data to file"; + return ++n_error; + } + if (bytes_read == 0) { // this should never happen, but just in case + // to unstuck from while loop + PLOG(ERROR) << "Unexpected read result"; + n_error++; + break; + } + } + llen = st.st_size % 4; + if (llen != 0) { + const uint32_t zero = 0; + if (write(out_fd, &zero, 4 - llen) == -1) { + PLOG(ERROR) << "Error padding 0s to file"; + return ++n_error; + } + } + return n_error; +} + +// Helper function for |cpioArchiveFilesInDir| +bool cpioWriteFileTrailer(int out_fd) { + const int buf_size = 4096; + std::array read_buf; + read_buf.fill(0); + ssize_t llen = snprintf(read_buf.data(), 4096, "070701%040X%056X%08XTRAILER!!!", 1, 0x0b, 0); + if (write(out_fd, read_buf.data(), (llen < buf_size ? llen : buf_size - 1) + 4) == -1) { + PLOG(ERROR) << "Error writing trailing bytes"; + return false; + } + return true; +} + +// Archives all files in |input_dir| and writes result into |out_fd| +// Logic obtained from //external/toybox/toys/posix/cpio.c "Output cpio archive" +// portion +size_t cpioArchiveFilesInDir(int out_fd, const char* input_dir) { + struct dirent* dp; + size_t n_error = 0; + std::unique_ptr dir_dump(opendir(input_dir), closedir); + if (!dir_dump) { + PLOG(ERROR) << "Failed to open directory"; + return ++n_error; + } + while ((dp = readdir(dir_dump.get()))) { + if (dp->d_type != DT_REG) { + continue; + } + std::string cur_file_name(dp->d_name); + struct stat st; + const std::string cur_file_path = kTombstoneFolderPath + cur_file_name; + if (stat(cur_file_path.c_str(), &st) == -1) { + PLOG(ERROR) << "Failed to get file stat for " << cur_file_path; + n_error++; + continue; + } + const int fd_read = open(cur_file_path.c_str(), O_RDONLY); + if (fd_read == -1) { + PLOG(ERROR) << "Failed to open file " << cur_file_path; + n_error++; + continue; + } + std::string file_name_with_last_modified_time = + cur_file_name + "-" + std::to_string(st.st_mtime); + // string.size() does not include the null terminator. The cpio FreeBSD + // file header expects the null character to be included in the length. + const size_t file_name_len = file_name_with_last_modified_time.size() + 1; + unique_fd file_auto_closer(fd_read); + if (!cpioWriteHeader(out_fd, st, file_name_with_last_modified_time.c_str(), + file_name_len)) { + return ++n_error; + } + size_t write_error = cpioWriteFileContent(fd_read, out_fd, st); + if (write_error) { + return n_error + write_error; + } + } + if (!cpioWriteFileTrailer(out_fd)) { + return ++n_error; + } + return n_error; +} + +// Helper function to create a non-const char*. +std::vector makeCharVec(const std::string& str) { + std::vector vec(str.size() + 1); + vec.assign(str.begin(), str.end()); + vec.push_back('\0'); + return vec; +} + +} // namespace + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +using aidl_return_util::validateAndCall; +using aidl_return_util::validateAndCallWithLock; + +WifiChip::WifiChip(int32_t chip_id, bool is_primary, + const std::weak_ptr legacy_hal, + const std::weak_ptr mode_controller, + const std::shared_ptr iface_util, + const std::weak_ptr feature_flags, + const std::function& handler) + : chip_id_(chip_id), + legacy_hal_(legacy_hal), + mode_controller_(mode_controller), + iface_util_(iface_util), + is_valid_(true), + current_mode_id_(feature_flags::chip_mode_ids::kInvalid), + modes_(feature_flags.lock()->getChipModes(is_primary)), + debug_ring_buffer_cb_registered_(false), + subsystemCallbackHandler_(handler) { + setActiveWlanIfaceNameProperty(kNoActiveWlanIfaceNamePropertyValue); +} + +std::shared_ptr WifiChip::create( + int32_t chip_id, bool is_primary, const std::weak_ptr legacy_hal, + const std::weak_ptr mode_controller, + const std::shared_ptr iface_util, + const std::weak_ptr feature_flags, + const std::function& handler) { + std::shared_ptr ptr = ndk::SharedRefBase::make( + chip_id, is_primary, legacy_hal, mode_controller, iface_util, feature_flags, handler); + std::weak_ptr weak_ptr_this(ptr); + ptr->setWeakPtr(weak_ptr_this); + return ptr; +} + +void WifiChip::invalidate() { + if (!writeRingbufferFilesInternal()) { + LOG(ERROR) << "Error writing files to flash"; + } + invalidateAndRemoveAllIfaces(); + setActiveWlanIfaceNameProperty(kNoActiveWlanIfaceNamePropertyValue); + legacy_hal_.reset(); + event_cb_handler_.invalidate(); + is_valid_ = false; +} + +void WifiChip::setWeakPtr(std::weak_ptr ptr) { + weak_ptr_this_ = ptr; +} + +bool WifiChip::isValid() { + return is_valid_; +} + +std::set> WifiChip::getEventCallbacks() { + return event_cb_handler_.getCallbacks(); +} + +ndk::ScopedAStatus WifiChip::getId(int32_t* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, &WifiChip::getIdInternal, + _aidl_return); +} + +ndk::ScopedAStatus WifiChip::registerEventCallback( + const std::shared_ptr& event_callback) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::registerEventCallbackInternal, event_callback); +} + +ndk::ScopedAStatus WifiChip::getCapabilities(IWifiChip::ChipCapabilityMask* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::getCapabilitiesInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiChip::getAvailableModes(std::vector* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::getAvailableModesInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiChip::configureChip(int32_t in_modeId) { + return validateAndCallWithLock(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::configureChipInternal, in_modeId); +} + +ndk::ScopedAStatus WifiChip::getMode(int32_t* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::getModeInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiChip::requestChipDebugInfo(IWifiChip::ChipDebugInfo* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::requestChipDebugInfoInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiChip::requestDriverDebugDump(std::vector* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::requestDriverDebugDumpInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiChip::requestFirmwareDebugDump(std::vector* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::requestFirmwareDebugDumpInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiChip::createApIface(std::shared_ptr* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::createApIfaceInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiChip::createBridgedApIface(std::shared_ptr* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::createBridgedApIfaceInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiChip::getApIfaceNames(std::vector* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::getApIfaceNamesInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiChip::getApIface(const std::string& in_ifname, + std::shared_ptr* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::getApIfaceInternal, _aidl_return, in_ifname); +} + +ndk::ScopedAStatus WifiChip::removeApIface(const std::string& in_ifname) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::removeApIfaceInternal, in_ifname); +} + +ndk::ScopedAStatus WifiChip::removeIfaceInstanceFromBridgedApIface( + const std::string& in_brIfaceName, const std::string& in_ifaceInstanceName) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::removeIfaceInstanceFromBridgedApIfaceInternal, in_brIfaceName, + in_ifaceInstanceName); +} + +ndk::ScopedAStatus WifiChip::createNanIface(std::shared_ptr* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::createNanIfaceInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiChip::getNanIfaceNames(std::vector* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::getNanIfaceNamesInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiChip::getNanIface(const std::string& in_ifname, + std::shared_ptr* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::getNanIfaceInternal, _aidl_return, in_ifname); +} + +ndk::ScopedAStatus WifiChip::removeNanIface(const std::string& in_ifname) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::removeNanIfaceInternal, in_ifname); +} + +ndk::ScopedAStatus WifiChip::createP2pIface(std::shared_ptr* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::createP2pIfaceInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiChip::getP2pIfaceNames(std::vector* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::getP2pIfaceNamesInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiChip::getP2pIface(const std::string& in_ifname, + std::shared_ptr* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::getP2pIfaceInternal, _aidl_return, in_ifname); +} + +ndk::ScopedAStatus WifiChip::removeP2pIface(const std::string& in_ifname) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::removeP2pIfaceInternal, in_ifname); +} + +ndk::ScopedAStatus WifiChip::createStaIface(std::shared_ptr* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::createStaIfaceInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiChip::getStaIfaceNames(std::vector* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::getStaIfaceNamesInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiChip::getStaIface(const std::string& in_ifname, + std::shared_ptr* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::getStaIfaceInternal, _aidl_return, in_ifname); +} + +ndk::ScopedAStatus WifiChip::removeStaIface(const std::string& in_ifname) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::removeStaIfaceInternal, in_ifname); +} + +ndk::ScopedAStatus WifiChip::createRttController( + const std::shared_ptr& in_boundIface, + std::shared_ptr* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::createRttControllerInternal, _aidl_return, in_boundIface); +} + +ndk::ScopedAStatus WifiChip::getDebugRingBuffersStatus( + std::vector* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::getDebugRingBuffersStatusInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiChip::startLoggingToDebugRingBuffer( + const std::string& in_ringName, WifiDebugRingBufferVerboseLevel in_verboseLevel, + int32_t in_maxIntervalInSec, int32_t in_minDataSizeInBytes) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::startLoggingToDebugRingBufferInternal, in_ringName, + in_verboseLevel, in_maxIntervalInSec, in_minDataSizeInBytes); +} + +ndk::ScopedAStatus WifiChip::forceDumpToDebugRingBuffer(const std::string& in_ringName) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::forceDumpToDebugRingBufferInternal, in_ringName); +} + +ndk::ScopedAStatus WifiChip::flushRingBufferToFile() { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::flushRingBufferToFileInternal); +} + +ndk::ScopedAStatus WifiChip::stopLoggingToDebugRingBuffer() { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::stopLoggingToDebugRingBufferInternal); +} + +ndk::ScopedAStatus WifiChip::getDebugHostWakeReasonStats( + WifiDebugHostWakeReasonStats* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::getDebugHostWakeReasonStatsInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiChip::enableDebugErrorAlerts(bool in_enable) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::enableDebugErrorAlertsInternal, in_enable); +} + +ndk::ScopedAStatus WifiChip::selectTxPowerScenario(IWifiChip::TxPowerScenario in_scenario) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::selectTxPowerScenarioInternal, in_scenario); +} + +ndk::ScopedAStatus WifiChip::resetTxPowerScenario() { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::resetTxPowerScenarioInternal); +} + +ndk::ScopedAStatus WifiChip::setLatencyMode(IWifiChip::LatencyMode in_mode) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::setLatencyModeInternal, in_mode); +} + +binder_status_t WifiChip::dump(int fd, const char**, uint32_t) { + { + std::unique_lock lk(lock_t); + for (const auto& item : ringbuffer_map_) { + forceDumpToDebugRingBufferInternal(item.first); + } + // unique_lock unlocked here + } + usleep(100 * 1000); // sleep for 100 milliseconds to wait for + // ringbuffer updates. + if (!writeRingbufferFilesInternal()) { + LOG(ERROR) << "Error writing files to flash"; + } + uint32_t n_error = cpioArchiveFilesInDir(fd, kTombstoneFolderPath); + if (n_error != 0) { + LOG(ERROR) << n_error << " errors occurred in cpio function"; + } + fsync(fd); + return STATUS_OK; +} + +ndk::ScopedAStatus WifiChip::setMultiStaPrimaryConnection(const std::string& in_ifName) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::setMultiStaPrimaryConnectionInternal, in_ifName); +} + +ndk::ScopedAStatus WifiChip::setMultiStaUseCase(IWifiChip::MultiStaUseCase in_useCase) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::setMultiStaUseCaseInternal, in_useCase); +} + +ndk::ScopedAStatus WifiChip::setCoexUnsafeChannels( + const std::vector& in_unsafeChannels, + CoexRestriction in_restrictions) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::setCoexUnsafeChannelsInternal, in_unsafeChannels, + in_restrictions); +} + +ndk::ScopedAStatus WifiChip::setCountryCode(const std::array& in_code) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiChip::setCountryCodeInternal, in_code); +} + +ndk::ScopedAStatus WifiChip::getUsableChannels(WifiBand in_band, WifiIfaceMode in_ifaceModeMask, + UsableChannelFilter in_filterMask, + std::vector* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::getUsableChannelsInternal, _aidl_return, in_band, + in_ifaceModeMask, in_filterMask); +} + +ndk::ScopedAStatus WifiChip::triggerSubsystemRestart() { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::triggerSubsystemRestartInternal); +} + +ndk::ScopedAStatus WifiChip::getSupportedRadioCombinationsMatrix( + WifiRadioCombinationMatrix* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::getSupportedRadioCombinationsMatrixInternal, _aidl_return); +} + +void WifiChip::invalidateAndRemoveAllIfaces() { + invalidateAndClearBridgedApAll(); + invalidateAndClearAll(ap_ifaces_); + invalidateAndClearAll(nan_ifaces_); + invalidateAndClearAll(p2p_ifaces_); + invalidateAndClearAll(sta_ifaces_); + // Since all the ifaces are invalid now, all RTT controller objects + // using those ifaces also need to be invalidated. + for (const auto& rtt : rtt_controllers_) { + rtt->invalidate(); + } + rtt_controllers_.clear(); +} + +void WifiChip::invalidateAndRemoveDependencies(const std::string& removed_iface_name) { + for (auto it = nan_ifaces_.begin(); it != nan_ifaces_.end();) { + auto nan_iface = *it; + if (nan_iface->getName() == removed_iface_name) { + nan_iface->invalidate(); + for (const auto& callback : event_cb_handler_.getCallbacks()) { + if (!callback->onIfaceRemoved(IfaceType::NAN_IFACE, removed_iface_name).isOk()) { + LOG(ERROR) << "Failed to invoke onIfaceRemoved callback"; + } + } + it = nan_ifaces_.erase(it); + } else { + ++it; + } + } + + for (auto it = rtt_controllers_.begin(); it != rtt_controllers_.end();) { + auto rtt = *it; + if (rtt->getIfaceName() == removed_iface_name) { + rtt->invalidate(); + it = rtt_controllers_.erase(it); + } else { + ++it; + } + } +} + +std::pair WifiChip::getIdInternal() { + return {chip_id_, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiChip::registerEventCallbackInternal( + const std::shared_ptr& event_callback) { + if (!event_cb_handler_.addCallback(event_callback)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + return ndk::ScopedAStatus::ok(); +} + +std::pair WifiChip::getCapabilitiesInternal() { + legacy_hal::wifi_error legacy_status; + uint64_t legacy_feature_set; + uint32_t legacy_logger_feature_set; + const auto ifname = getFirstActiveWlanIfaceName(); + std::tie(legacy_status, legacy_feature_set) = + legacy_hal_.lock()->getSupportedFeatureSet(ifname); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {IWifiChip::ChipCapabilityMask{}, createWifiStatusFromLegacyError(legacy_status)}; + } + std::tie(legacy_status, legacy_logger_feature_set) = + legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + // some devices don't support querying logger feature set + legacy_logger_feature_set = 0; + } + uint32_t aidl_caps; + if (!aidl_struct_util::convertLegacyFeaturesToAidlChipCapabilities( + legacy_feature_set, legacy_logger_feature_set, &aidl_caps)) { + return {IWifiChip::ChipCapabilityMask{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {static_cast(aidl_caps), ndk::ScopedAStatus::ok()}; +} + +std::pair, ndk::ScopedAStatus> +WifiChip::getAvailableModesInternal() { + return {modes_, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiChip::configureChipInternal( + /* NONNULL */ std::unique_lock* lock, int32_t mode_id) { + if (!isValidModeId(mode_id)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + if (mode_id == current_mode_id_) { + LOG(DEBUG) << "Already in the specified mode " << mode_id; + return ndk::ScopedAStatus::ok(); + } + ndk::ScopedAStatus status = handleChipConfiguration(lock, mode_id); + if (!status.isOk()) { + WifiStatusCode errorCode = static_cast(status.getServiceSpecificError()); + for (const auto& callback : event_cb_handler_.getCallbacks()) { + if (!callback->onChipReconfigureFailure(errorCode).isOk()) { + LOG(ERROR) << "Failed to invoke onChipReconfigureFailure callback"; + } + } + return status; + } + for (const auto& callback : event_cb_handler_.getCallbacks()) { + if (!callback->onChipReconfigured(mode_id).isOk()) { + LOG(ERROR) << "Failed to invoke onChipReconfigured callback"; + } + } + current_mode_id_ = mode_id; + LOG(INFO) << "Configured chip in mode " << mode_id; + setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); + + legacy_hal_.lock()->registerSubsystemRestartCallbackHandler(subsystemCallbackHandler_); + + return status; +} + +std::pair WifiChip::getModeInternal() { + if (!isValidModeId(current_mode_id_)) { + return {current_mode_id_, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; + } + return {current_mode_id_, ndk::ScopedAStatus::ok()}; +} + +std::pair WifiChip::requestChipDebugInfoInternal() { + IWifiChip::ChipDebugInfo result; + legacy_hal::wifi_error legacy_status; + std::string driver_desc; + const auto ifname = getFirstActiveWlanIfaceName(); + std::tie(legacy_status, driver_desc) = legacy_hal_.lock()->getDriverVersion(ifname); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to get driver version: " << legacyErrorToString(legacy_status); + ndk::ScopedAStatus status = + createWifiStatusFromLegacyError(legacy_status, "failed to get driver version"); + return {std::move(result), std::move(status)}; + } + result.driverDescription = driver_desc.c_str(); + + std::string firmware_desc; + std::tie(legacy_status, firmware_desc) = legacy_hal_.lock()->getFirmwareVersion(ifname); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to get firmware version: " << legacyErrorToString(legacy_status); + ndk::ScopedAStatus status = + createWifiStatusFromLegacyError(legacy_status, "failed to get firmware version"); + return {std::move(result), std::move(status)}; + } + result.firmwareDescription = firmware_desc.c_str(); + + return {std::move(result), ndk::ScopedAStatus::ok()}; +} + +std::pair, ndk::ScopedAStatus> WifiChip::requestDriverDebugDumpInternal() { + legacy_hal::wifi_error legacy_status; + std::vector driver_dump; + std::tie(legacy_status, driver_dump) = + legacy_hal_.lock()->requestDriverMemoryDump(getFirstActiveWlanIfaceName()); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to get driver debug dump: " << legacyErrorToString(legacy_status); + return {std::vector(), createWifiStatusFromLegacyError(legacy_status)}; + } + return {driver_dump, ndk::ScopedAStatus::ok()}; +} + +std::pair, ndk::ScopedAStatus> WifiChip::requestFirmwareDebugDumpInternal() { + legacy_hal::wifi_error legacy_status; + std::vector firmware_dump; + std::tie(legacy_status, firmware_dump) = + legacy_hal_.lock()->requestFirmwareMemoryDump(getFirstActiveWlanIfaceName()); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to get firmware debug dump: " << legacyErrorToString(legacy_status); + return {std::vector(), createWifiStatusFromLegacyError(legacy_status)}; + } + return {firmware_dump, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiChip::createVirtualApInterface(const std::string& apVirtIf) { + legacy_hal::wifi_error legacy_status; + legacy_status = legacy_hal_.lock()->createVirtualInterface( + apVirtIf, aidl_struct_util::convertAidlIfaceTypeToLegacy(IfaceType::AP)); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to add interface: " << apVirtIf << " " + << legacyErrorToString(legacy_status); + return createWifiStatusFromLegacyError(legacy_status); + } + return ndk::ScopedAStatus::ok(); +} + +std::shared_ptr WifiChip::newWifiApIface(std::string& ifname) { + std::vector ap_instances; + for (auto const& it : br_ifaces_ap_instances_) { + if (it.first == ifname) { + ap_instances = it.second; + } + } + std::shared_ptr iface = + ndk::SharedRefBase::make(ifname, ap_instances, legacy_hal_, iface_util_); + ap_ifaces_.push_back(iface); + for (const auto& callback : event_cb_handler_.getCallbacks()) { + if (!callback->onIfaceAdded(IfaceType::AP, ifname).isOk()) { + LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; + } + } + setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); + return iface; +} + +std::pair, ndk::ScopedAStatus> WifiChip::createApIfaceInternal() { + if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::AP)) { + return {std::shared_ptr(), + createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; + } + std::string ifname = allocateApIfaceName(); + ndk::ScopedAStatus status = createVirtualApInterface(ifname); + if (!status.isOk()) { + return {std::shared_ptr(), std::move(status)}; + } + std::shared_ptr iface = newWifiApIface(ifname); + return {iface, ndk::ScopedAStatus::ok()}; +} + +std::pair, ndk::ScopedAStatus> +WifiChip::createBridgedApIfaceInternal() { + if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::AP_BRIDGED)) { + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; + } + std::vector ap_instances = allocateBridgedApInstanceNames(); + if (ap_instances.size() < 2) { + LOG(ERROR) << "Fail to allocate two instances"; + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; + } + std::string br_ifname = kApBridgeIfacePrefix + ap_instances[0]; + for (int i = 0; i < 2; i++) { + ndk::ScopedAStatus status = createVirtualApInterface(ap_instances[i]); + if (!status.isOk()) { + if (i != 0) { // The failure happened when creating second virtual + // iface. + legacy_hal_.lock()->deleteVirtualInterface( + ap_instances.front()); // Remove the first virtual iface. + } + return {nullptr, std::move(status)}; + } + } + br_ifaces_ap_instances_[br_ifname] = ap_instances; + if (!iface_util_->createBridge(br_ifname)) { + LOG(ERROR) << "Failed createBridge - br_name=" << br_ifname.c_str(); + invalidateAndClearBridgedAp(br_ifname); + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; + } + for (auto const& instance : ap_instances) { + // Bind ap instance interface to AP bridge + if (!iface_util_->addIfaceToBridge(br_ifname, instance)) { + LOG(ERROR) << "Failed add if to Bridge - if_name=" << instance.c_str(); + invalidateAndClearBridgedAp(br_ifname); + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; + } + } + std::shared_ptr iface = newWifiApIface(br_ifname); + return {iface, ndk::ScopedAStatus::ok()}; +} + +std::pair, ndk::ScopedAStatus> WifiChip::getApIfaceNamesInternal() { + if (ap_ifaces_.empty()) { + return {std::vector(), ndk::ScopedAStatus::ok()}; + } + return {getNames(ap_ifaces_), ndk::ScopedAStatus::ok()}; +} + +std::pair, ndk::ScopedAStatus> WifiChip::getApIfaceInternal( + const std::string& ifname) { + const auto iface = findUsingName(ap_ifaces_, ifname); + if (!iface.get()) { + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)}; + } + return {iface, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiChip::removeApIfaceInternal(const std::string& ifname) { + const auto iface = findUsingName(ap_ifaces_, ifname); + if (!iface.get()) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + // Invalidate & remove any dependent objects first. + // Note: This is probably not required because we never create + // nan/rtt objects over AP iface. But, there is no harm to do it + // here and not make that assumption all over the place. + invalidateAndRemoveDependencies(ifname); + // Clear the bridge interface and the iface instance. + invalidateAndClearBridgedAp(ifname); + invalidateAndClear(ap_ifaces_, iface); + for (const auto& callback : event_cb_handler_.getCallbacks()) { + if (!callback->onIfaceRemoved(IfaceType::AP, ifname).isOk()) { + LOG(ERROR) << "Failed to invoke onIfaceRemoved callback"; + } + } + setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus WifiChip::removeIfaceInstanceFromBridgedApIfaceInternal( + const std::string& ifname, const std::string& ifInstanceName) { + const auto iface = findUsingName(ap_ifaces_, ifname); + if (!iface.get() || ifInstanceName.empty()) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + // Requires to remove one of the instance in bridge mode + for (auto const& it : br_ifaces_ap_instances_) { + if (it.first == ifname) { + std::vector ap_instances = it.second; + for (auto const& iface : ap_instances) { + if (iface == ifInstanceName) { + if (!iface_util_->removeIfaceFromBridge(it.first, iface)) { + LOG(ERROR) << "Failed to remove interface: " << ifInstanceName << " from " + << ifname; + return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->deleteVirtualInterface(iface); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to del interface: " << iface << " " + << legacyErrorToString(legacy_status); + return createWifiStatusFromLegacyError(legacy_status); + } + ap_instances.erase( + std::remove(ap_instances.begin(), ap_instances.end(), ifInstanceName), + ap_instances.end()); + br_ifaces_ap_instances_[ifname] = ap_instances; + break; + } + } + break; + } + } + iface->removeInstance(ifInstanceName); + setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); + + return ndk::ScopedAStatus::ok(); +} + +std::pair, ndk::ScopedAStatus> WifiChip::createNanIfaceInternal() { + if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::NAN_IFACE)) { + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; + } + bool is_dedicated_iface = true; + std::string ifname = getPredefinedNanIfaceName(); + if (ifname.empty() || !iface_util_->ifNameToIndex(ifname)) { + // Use the first shared STA iface (wlan0) if a dedicated aware iface is + // not defined. + ifname = getFirstActiveWlanIfaceName(); + is_dedicated_iface = false; + } + std::shared_ptr iface = + WifiNanIface::create(ifname, is_dedicated_iface, legacy_hal_, iface_util_); + nan_ifaces_.push_back(iface); + for (const auto& callback : event_cb_handler_.getCallbacks()) { + if (!callback->onIfaceAdded(IfaceType::NAN_IFACE, ifname).isOk()) { + LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; + } + } + return {iface, ndk::ScopedAStatus::ok()}; +} + +std::pair, ndk::ScopedAStatus> WifiChip::getNanIfaceNamesInternal() { + if (nan_ifaces_.empty()) { + return {std::vector(), ndk::ScopedAStatus::ok()}; + } + return {getNames(nan_ifaces_), ndk::ScopedAStatus::ok()}; +} + +std::pair, ndk::ScopedAStatus> WifiChip::getNanIfaceInternal( + const std::string& ifname) { + const auto iface = findUsingName(nan_ifaces_, ifname); + if (!iface.get()) { + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)}; + } + return {iface, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiChip::removeNanIfaceInternal(const std::string& ifname) { + const auto iface = findUsingName(nan_ifaces_, ifname); + if (!iface.get()) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + invalidateAndClear(nan_ifaces_, iface); + for (const auto& callback : event_cb_handler_.getCallbacks()) { + if (!callback->onIfaceRemoved(IfaceType::NAN_IFACE, ifname).isOk()) { + LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; + } + } + return ndk::ScopedAStatus::ok(); +} + +std::pair, ndk::ScopedAStatus> WifiChip::createP2pIfaceInternal() { + if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::P2P)) { + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; + } + std::string ifname = getPredefinedP2pIfaceName(); + std::shared_ptr iface = + ndk::SharedRefBase::make(ifname, legacy_hal_); + p2p_ifaces_.push_back(iface); + for (const auto& callback : event_cb_handler_.getCallbacks()) { + if (!callback->onIfaceAdded(IfaceType::P2P, ifname).isOk()) { + LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; + } + } + return {iface, ndk::ScopedAStatus::ok()}; +} + +std::pair, ndk::ScopedAStatus> WifiChip::getP2pIfaceNamesInternal() { + if (p2p_ifaces_.empty()) { + return {std::vector(), ndk::ScopedAStatus::ok()}; + } + return {getNames(p2p_ifaces_), ndk::ScopedAStatus::ok()}; +} + +std::pair, ndk::ScopedAStatus> WifiChip::getP2pIfaceInternal( + const std::string& ifname) { + const auto iface = findUsingName(p2p_ifaces_, ifname); + if (!iface.get()) { + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)}; + } + return {iface, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiChip::removeP2pIfaceInternal(const std::string& ifname) { + const auto iface = findUsingName(p2p_ifaces_, ifname); + if (!iface.get()) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + invalidateAndClear(p2p_ifaces_, iface); + for (const auto& callback : event_cb_handler_.getCallbacks()) { + if (!callback->onIfaceRemoved(IfaceType::P2P, ifname).isOk()) { + LOG(ERROR) << "Failed to invoke onIfaceRemoved callback"; + } + } + return ndk::ScopedAStatus::ok(); +} + +std::pair, ndk::ScopedAStatus> WifiChip::createStaIfaceInternal() { + if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::STA)) { + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; + } + std::string ifname = allocateStaIfaceName(); + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->createVirtualInterface( + ifname, aidl_struct_util::convertAidlIfaceTypeToLegacy(IfaceType::STA)); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to add interface: " << ifname << " " + << legacyErrorToString(legacy_status); + return {nullptr, createWifiStatusFromLegacyError(legacy_status)}; + } + std::shared_ptr iface = + ndk::SharedRefBase::make(ifname, legacy_hal_, iface_util_); + sta_ifaces_.push_back(iface); + for (const auto& callback : event_cb_handler_.getCallbacks()) { + if (!callback->onIfaceAdded(IfaceType::STA, ifname).isOk()) { + LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; + } + } + setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); + return {iface, ndk::ScopedAStatus::ok()}; +} + +std::pair, ndk::ScopedAStatus> WifiChip::getStaIfaceNamesInternal() { + if (sta_ifaces_.empty()) { + return {std::vector(), ndk::ScopedAStatus::ok()}; + } + return {getNames(sta_ifaces_), ndk::ScopedAStatus::ok()}; +} + +std::pair, ndk::ScopedAStatus> WifiChip::getStaIfaceInternal( + const std::string& ifname) { + const auto iface = findUsingName(sta_ifaces_, ifname); + if (!iface.get()) { + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)}; + } + return {iface, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiChip::removeStaIfaceInternal(const std::string& ifname) { + const auto iface = findUsingName(sta_ifaces_, ifname); + if (!iface.get()) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + // Invalidate & remove any dependent objects first. + invalidateAndRemoveDependencies(ifname); + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->deleteVirtualInterface(ifname); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to remove interface: " << ifname << " " + << legacyErrorToString(legacy_status); + } + invalidateAndClear(sta_ifaces_, iface); + for (const auto& callback : event_cb_handler_.getCallbacks()) { + if (!callback->onIfaceRemoved(IfaceType::STA, ifname).isOk()) { + LOG(ERROR) << "Failed to invoke onIfaceRemoved callback"; + } + } + setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); + return ndk::ScopedAStatus::ok(); +} + +std::pair, ndk::ScopedAStatus> +WifiChip::createRttControllerInternal(const std::shared_ptr& bound_iface) { + if (sta_ifaces_.size() == 0 && + !canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::STA)) { + LOG(ERROR) << "createRttControllerInternal: Chip cannot support STAs " + "(and RTT by extension)"; + return {nullptr, createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE)}; + } + std::shared_ptr rtt = + WifiRttController::create(getFirstActiveWlanIfaceName(), bound_iface, legacy_hal_); + rtt_controllers_.emplace_back(rtt); + return {rtt, ndk::ScopedAStatus::ok()}; +} + +std::pair, ndk::ScopedAStatus> +WifiChip::getDebugRingBuffersStatusInternal() { + legacy_hal::wifi_error legacy_status; + std::vector legacy_ring_buffer_status_vec; + std::tie(legacy_status, legacy_ring_buffer_status_vec) = + legacy_hal_.lock()->getRingBuffersStatus(getFirstActiveWlanIfaceName()); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {std::vector(), + createWifiStatusFromLegacyError(legacy_status)}; + } + std::vector aidl_ring_buffer_status_vec; + if (!aidl_struct_util::convertLegacyVectorOfDebugRingBufferStatusToAidl( + legacy_ring_buffer_status_vec, &aidl_ring_buffer_status_vec)) { + return {std::vector(), + createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {aidl_ring_buffer_status_vec, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiChip::startLoggingToDebugRingBufferInternal( + const std::string& ring_name, WifiDebugRingBufferVerboseLevel verbose_level, + uint32_t max_interval_in_sec, uint32_t min_data_size_in_bytes) { + ndk::ScopedAStatus status = registerDebugRingBufferCallback(); + if (!status.isOk()) { + return status; + } + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startRingBufferLogging( + getFirstActiveWlanIfaceName(), ring_name, + static_cast::type>(verbose_level), + max_interval_in_sec, min_data_size_in_bytes); + ringbuffer_map_.insert( + std::pair(ring_name, Ringbuffer(kMaxBufferSizeBytes))); + // if verbose logging enabled, turn up HAL daemon logging as well. + if (verbose_level < WifiDebugRingBufferVerboseLevel::VERBOSE) { + ::android::base::SetMinimumLogSeverity(::android::base::DEBUG); + } else { + ::android::base::SetMinimumLogSeverity(::android::base::VERBOSE); + } + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiChip::forceDumpToDebugRingBufferInternal(const std::string& ring_name) { + ndk::ScopedAStatus status = registerDebugRingBufferCallback(); + if (!status.isOk()) { + return status; + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->getRingBufferData(getFirstActiveWlanIfaceName(), ring_name); + + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiChip::flushRingBufferToFileInternal() { + if (!writeRingbufferFilesInternal()) { + LOG(ERROR) << "Error writing files to flash"; + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus WifiChip::stopLoggingToDebugRingBufferInternal() { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->deregisterRingBufferCallbackHandler(getFirstActiveWlanIfaceName()); + if (legacy_status == legacy_hal::WIFI_SUCCESS) { + debug_ring_buffer_cb_registered_ = false; + } + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair +WifiChip::getDebugHostWakeReasonStatsInternal() { + legacy_hal::wifi_error legacy_status; + legacy_hal::WakeReasonStats legacy_stats; + std::tie(legacy_status, legacy_stats) = + legacy_hal_.lock()->getWakeReasonStats(getFirstActiveWlanIfaceName()); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {WifiDebugHostWakeReasonStats{}, createWifiStatusFromLegacyError(legacy_status)}; + } + WifiDebugHostWakeReasonStats aidl_stats; + if (!aidl_struct_util::convertLegacyWakeReasonStatsToAidl(legacy_stats, &aidl_stats)) { + return {WifiDebugHostWakeReasonStats{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {aidl_stats, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiChip::enableDebugErrorAlertsInternal(bool enable) { + legacy_hal::wifi_error legacy_status; + if (enable) { + std::weak_ptr weak_ptr_this = weak_ptr_this_; + const auto& on_alert_callback = [weak_ptr_this](int32_t error_code, + std::vector debug_data) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onDebugErrorAlert(error_code, debug_data).isOk()) { + LOG(ERROR) << "Failed to invoke onDebugErrorAlert callback"; + } + } + }; + legacy_status = legacy_hal_.lock()->registerErrorAlertCallbackHandler( + getFirstActiveWlanIfaceName(), on_alert_callback); + } else { + legacy_status = legacy_hal_.lock()->deregisterErrorAlertCallbackHandler( + getFirstActiveWlanIfaceName()); + } + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiChip::selectTxPowerScenarioInternal(IWifiChip::TxPowerScenario scenario) { + auto legacy_status = legacy_hal_.lock()->selectTxPowerScenario( + getFirstActiveWlanIfaceName(), + aidl_struct_util::convertAidlTxPowerScenarioToLegacy(scenario)); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiChip::resetTxPowerScenarioInternal() { + auto legacy_status = legacy_hal_.lock()->resetTxPowerScenario(getFirstActiveWlanIfaceName()); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiChip::setLatencyModeInternal(IWifiChip::LatencyMode mode) { + auto legacy_status = legacy_hal_.lock()->setLatencyMode( + getFirstActiveWlanIfaceName(), aidl_struct_util::convertAidlLatencyModeToLegacy(mode)); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiChip::setMultiStaPrimaryConnectionInternal(const std::string& ifname) { + auto legacy_status = legacy_hal_.lock()->multiStaSetPrimaryConnection(ifname); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiChip::setMultiStaUseCaseInternal(IWifiChip::MultiStaUseCase use_case) { + auto legacy_status = legacy_hal_.lock()->multiStaSetUseCase( + aidl_struct_util::convertAidlMultiStaUseCaseToLegacy(use_case)); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiChip::setCoexUnsafeChannelsInternal( + std::vector unsafe_channels, CoexRestriction restrictions) { + std::vector legacy_unsafe_channels; + if (!aidl_struct_util::convertAidlVectorOfCoexUnsafeChannelToLegacy(unsafe_channels, + &legacy_unsafe_channels)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + uint32_t aidl_restrictions = static_cast(restrictions); + uint32_t legacy_restrictions = 0; + if (aidl_restrictions & static_cast(CoexRestriction::WIFI_DIRECT)) { + legacy_restrictions |= legacy_hal::wifi_coex_restriction::WIFI_DIRECT; + } + if (aidl_restrictions & static_cast(CoexRestriction::SOFTAP)) { + legacy_restrictions |= legacy_hal::wifi_coex_restriction::SOFTAP; + } + if (aidl_restrictions & static_cast(CoexRestriction::WIFI_AWARE)) { + legacy_restrictions |= legacy_hal::wifi_coex_restriction::WIFI_AWARE; + } + auto legacy_status = + legacy_hal_.lock()->setCoexUnsafeChannels(legacy_unsafe_channels, legacy_restrictions); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiChip::setCountryCodeInternal(const std::array& code) { + auto legacy_status = legacy_hal_.lock()->setCountryCode(getFirstActiveWlanIfaceName(), code); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair, ndk::ScopedAStatus> WifiChip::getUsableChannelsInternal( + WifiBand band, WifiIfaceMode ifaceModeMask, UsableChannelFilter filterMask) { + legacy_hal::wifi_error legacy_status; + std::vector legacy_usable_channels; + std::tie(legacy_status, legacy_usable_channels) = legacy_hal_.lock()->getUsableChannels( + aidl_struct_util::convertAidlWifiBandToLegacyMacBand(band), + aidl_struct_util::convertAidlWifiIfaceModeToLegacy( + static_cast(ifaceModeMask)), + aidl_struct_util::convertAidlUsableChannelFilterToLegacy( + static_cast(filterMask))); + + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {std::vector(), createWifiStatusFromLegacyError(legacy_status)}; + } + std::vector aidl_usable_channels; + if (!aidl_struct_util::convertLegacyWifiUsableChannelsToAidl(legacy_usable_channels, + &aidl_usable_channels)) { + return {std::vector(), createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {aidl_usable_channels, ndk::ScopedAStatus::ok()}; +} + +std::pair +WifiChip::getSupportedRadioCombinationsMatrixInternal() { + legacy_hal::wifi_error legacy_status; + legacy_hal::wifi_radio_combination_matrix* legacy_matrix; + + std::tie(legacy_status, legacy_matrix) = + legacy_hal_.lock()->getSupportedRadioCombinationsMatrix(); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to get SupportedRadioCombinations matrix from legacy HAL: " + << legacyErrorToString(legacy_status); + return {WifiRadioCombinationMatrix{}, createWifiStatusFromLegacyError(legacy_status)}; + } + + WifiRadioCombinationMatrix aidl_matrix; + if (!aidl_struct_util::convertLegacyRadioCombinationsMatrixToAidl(legacy_matrix, + &aidl_matrix)) { + LOG(ERROR) << "Failed convertLegacyRadioCombinationsMatrixToAidl() "; + return {WifiRadioCombinationMatrix(), createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)}; + } + return {aidl_matrix, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiChip::triggerSubsystemRestartInternal() { + auto legacy_status = legacy_hal_.lock()->triggerSubsystemRestart(); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiChip::handleChipConfiguration( + /* NONNULL */ std::unique_lock* lock, int32_t mode_id) { + // If the chip is already configured in a different mode, stop + // the legacy HAL and then start it after firmware mode change. + if (isValidModeId(current_mode_id_)) { + LOG(INFO) << "Reconfiguring chip from mode " << current_mode_id_ << " to mode " << mode_id; + invalidateAndRemoveAllIfaces(); + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->stop(lock, []() {}); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to stop legacy HAL: " << legacyErrorToString(legacy_status); + return createWifiStatusFromLegacyError(legacy_status); + } + } + // Firmware mode change not needed for V2 devices. + bool success = true; + if (mode_id == feature_flags::chip_mode_ids::kV1Sta) { + success = mode_controller_.lock()->changeFirmwareMode(IfaceType::STA); + } else if (mode_id == feature_flags::chip_mode_ids::kV1Ap) { + success = mode_controller_.lock()->changeFirmwareMode(IfaceType::AP); + } + if (!success) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->start(); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to start legacy HAL: " << legacyErrorToString(legacy_status); + return createWifiStatusFromLegacyError(legacy_status); + } + // Every time the HAL is restarted, we need to register the + // radio mode change callback. + ndk::ScopedAStatus status = registerRadioModeChangeCallback(); + if (!status.isOk()) { + // This is probably not a critical failure? + LOG(ERROR) << "Failed to register radio mode change callback"; + } + // Extract and save the version information into property. + std::pair version_info; + version_info = WifiChip::requestChipDebugInfoInternal(); + if (version_info.second.isOk()) { + property_set("vendor.wlan.firmware.version", + version_info.first.firmwareDescription.c_str()); + property_set("vendor.wlan.driver.version", version_info.first.driverDescription.c_str()); + } + + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus WifiChip::registerDebugRingBufferCallback() { + if (debug_ring_buffer_cb_registered_) { + return ndk::ScopedAStatus::ok(); + } + + std::weak_ptr weak_ptr_this = weak_ptr_this_; + const auto& on_ring_buffer_data_callback = + [weak_ptr_this](const std::string& name, const std::vector& data, + const legacy_hal::wifi_ring_buffer_status& status) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + WifiDebugRingBufferStatus aidl_status; + Ringbuffer::AppendStatus appendstatus; + if (!aidl_struct_util::convertLegacyDebugRingBufferStatusToAidl(status, + &aidl_status)) { + LOG(ERROR) << "Error converting ring buffer status"; + return; + } + { + std::unique_lock lk(shared_ptr_this->lock_t); + const auto& target = shared_ptr_this->ringbuffer_map_.find(name); + if (target != shared_ptr_this->ringbuffer_map_.end()) { + Ringbuffer& cur_buffer = target->second; + appendstatus = cur_buffer.append(data); + } else { + LOG(ERROR) << "Ringname " << name << " not found"; + return; + } + // unique_lock unlocked here + } + if (appendstatus == Ringbuffer::AppendStatus::FAIL_RING_BUFFER_CORRUPTED) { + LOG(ERROR) << "Ringname " << name << " is corrupted. Clear the ring buffer"; + shared_ptr_this->writeRingbufferFilesInternal(); + return; + } + }; + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->registerRingBufferCallbackHandler( + getFirstActiveWlanIfaceName(), on_ring_buffer_data_callback); + + if (legacy_status == legacy_hal::WIFI_SUCCESS) { + debug_ring_buffer_cb_registered_ = true; + } + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiChip::registerRadioModeChangeCallback() { + std::weak_ptr weak_ptr_this = weak_ptr_this_; + const auto& on_radio_mode_change_callback = + [weak_ptr_this](const std::vector& mac_infos) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + std::vector aidl_radio_mode_infos; + if (!aidl_struct_util::convertLegacyWifiMacInfosToAidl(mac_infos, + &aidl_radio_mode_infos)) { + LOG(ERROR) << "Error converting wifi mac info"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onRadioModeChange(aidl_radio_mode_infos).isOk()) { + LOG(ERROR) << "Failed to invoke onRadioModeChange callback"; + } + } + }; + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->registerRadioModeChangeCallbackHandler( + getFirstActiveWlanIfaceName(), on_radio_mode_change_callback); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::vector +WifiChip::getCurrentModeConcurrencyCombinations() { + if (!isValidModeId(current_mode_id_)) { + LOG(ERROR) << "Chip not configured in a mode yet"; + return std::vector(); + } + for (const auto& mode : modes_) { + if (mode.id == current_mode_id_) { + return mode.availableCombinations; + } + } + CHECK(0) << "Expected to find concurrency combinations for current mode!"; + return std::vector(); +} + +// Returns a map indexed by IfaceConcurrencyType with the number of ifaces currently +// created of the corresponding concurrency type. +std::map WifiChip::getCurrentConcurrencyCombination() { + std::map iface_counts; + uint32_t num_ap = 0; + uint32_t num_ap_bridged = 0; + for (const auto& ap_iface : ap_ifaces_) { + std::string ap_iface_name = ap_iface->getName(); + if (br_ifaces_ap_instances_.count(ap_iface_name) > 0 && + br_ifaces_ap_instances_[ap_iface_name].size() > 1) { + num_ap_bridged++; + } else { + num_ap++; + } + } + iface_counts[IfaceConcurrencyType::AP] = num_ap; + iface_counts[IfaceConcurrencyType::AP_BRIDGED] = num_ap_bridged; + iface_counts[IfaceConcurrencyType::NAN_IFACE] = nan_ifaces_.size(); + iface_counts[IfaceConcurrencyType::P2P] = p2p_ifaces_.size(); + iface_counts[IfaceConcurrencyType::STA] = sta_ifaces_.size(); + return iface_counts; +} + +// This expands the provided concurrency combinations to a more parseable +// form. Returns a vector of available combinations possible with the number +// of each concurrency type in the combination. +// This method is a port of HalDeviceManager.expandConcurrencyCombos() from framework. +std::vector> WifiChip::expandConcurrencyCombinations( + const IWifiChip::ChipConcurrencyCombination& combination) { + int32_t num_expanded_combos = 1; + for (const auto& limit : combination.limits) { + for (int32_t i = 0; i < limit.maxIfaces; i++) { + num_expanded_combos *= limit.types.size(); + } + } + + // Allocate the vector of expanded combos and reset all concurrency type counts to 0 + // in each combo. + std::vector> expanded_combos; + expanded_combos.resize(num_expanded_combos); + for (auto& expanded_combo : expanded_combos) { + for (const auto type : {IfaceConcurrencyType::AP, IfaceConcurrencyType::AP_BRIDGED, + IfaceConcurrencyType::NAN_IFACE, IfaceConcurrencyType::P2P, + IfaceConcurrencyType::STA}) { + expanded_combo[type] = 0; + } + } + int32_t span = num_expanded_combos; + for (const auto& limit : combination.limits) { + for (int32_t i = 0; i < limit.maxIfaces; i++) { + span /= limit.types.size(); + for (int32_t k = 0; k < num_expanded_combos; ++k) { + const auto iface_type = limit.types[(k / span) % limit.types.size()]; + expanded_combos[k][iface_type]++; + } + } + } + return expanded_combos; +} + +bool WifiChip::canExpandedConcurrencyComboSupportConcurrencyTypeWithCurrentTypes( + const std::map& expanded_combo, + IfaceConcurrencyType requested_type) { + const auto current_combo = getCurrentConcurrencyCombination(); + + // Check if we have space for 1 more iface of |type| in this combo + for (const auto type : + {IfaceConcurrencyType::AP, IfaceConcurrencyType::AP_BRIDGED, + IfaceConcurrencyType::NAN_IFACE, IfaceConcurrencyType::P2P, IfaceConcurrencyType::STA}) { + size_t num_ifaces_needed = current_combo.at(type); + if (type == requested_type) { + num_ifaces_needed++; + } + size_t num_ifaces_allowed = expanded_combo.at(type); + if (num_ifaces_needed > num_ifaces_allowed) { + return false; + } + } + return true; +} + +// This method does the following: +// a) Enumerate all possible concurrency combos by expanding the current +// ChipConcurrencyCombination. +// b) Check if the requested concurrency type can be added to the current mode +// with the concurrency combination that is already active. +bool WifiChip::canCurrentModeSupportConcurrencyTypeWithCurrentTypes( + IfaceConcurrencyType requested_type) { + if (!isValidModeId(current_mode_id_)) { + LOG(ERROR) << "Chip not configured in a mode yet"; + return false; + } + const auto combinations = getCurrentModeConcurrencyCombinations(); + for (const auto& combination : combinations) { + const auto expanded_combos = expandConcurrencyCombinations(combination); + for (const auto& expanded_combo : expanded_combos) { + if (canExpandedConcurrencyComboSupportConcurrencyTypeWithCurrentTypes(expanded_combo, + requested_type)) { + return true; + } + } + } + return false; +} + +// Note: This does not consider concurrency types already active. It only checks if the +// provided expanded concurrency combination can support the requested combo. +bool WifiChip::canExpandedConcurrencyComboSupportConcurrencyCombo( + const std::map& expanded_combo, + const std::map& req_combo) { + // Check if we have space for 1 more |type| in this combo + for (const auto type : + {IfaceConcurrencyType::AP, IfaceConcurrencyType::AP_BRIDGED, + IfaceConcurrencyType::NAN_IFACE, IfaceConcurrencyType::P2P, IfaceConcurrencyType::STA}) { + if (req_combo.count(type) == 0) { + // Concurrency type not in the req_combo. + continue; + } + size_t num_ifaces_needed = req_combo.at(type); + size_t num_ifaces_allowed = expanded_combo.at(type); + if (num_ifaces_needed > num_ifaces_allowed) { + return false; + } + } + return true; +} + +// This method does the following: +// a) Enumerate all possible concurrency combos by expanding the current +// ChipConcurrencyCombination. +// b) Check if the requested concurrency combo can be added to the current mode. +// Note: This does not consider concurrency types already active. It only checks if the +// current mode can support the requested combo. +bool WifiChip::canCurrentModeSupportConcurrencyCombo( + const std::map& req_combo) { + if (!isValidModeId(current_mode_id_)) { + LOG(ERROR) << "Chip not configured in a mode yet"; + return false; + } + const auto combinations = getCurrentModeConcurrencyCombinations(); + for (const auto& combination : combinations) { + const auto expanded_combos = expandConcurrencyCombinations(combination); + for (const auto& expanded_combo : expanded_combos) { + if (canExpandedConcurrencyComboSupportConcurrencyCombo(expanded_combo, req_combo)) { + return true; + } + } + } + return false; +} + +// This method does the following: +// a) Enumerate all possible concurrency combos by expanding the current +// ChipConcurrencyCombination. +// b) Check if the requested concurrency type can be added to the current mode. +bool WifiChip::canCurrentModeSupportConcurrencyType(IfaceConcurrencyType requested_type) { + // Check if we can support at least 1 of the requested concurrency type. + std::map req_iface_combo; + req_iface_combo[requested_type] = 1; + return canCurrentModeSupportConcurrencyCombo(req_iface_combo); +} + +bool WifiChip::isValidModeId(int32_t mode_id) { + for (const auto& mode : modes_) { + if (mode.id == mode_id) { + return true; + } + } + return false; +} + +bool WifiChip::isStaApConcurrencyAllowedInCurrentMode() { + // Check if we can support at least 1 STA & 1 AP concurrently. + std::map req_iface_combo; + req_iface_combo[IfaceConcurrencyType::STA] = 1; + req_iface_combo[IfaceConcurrencyType::AP] = 1; + return canCurrentModeSupportConcurrencyCombo(req_iface_combo); +} + +bool WifiChip::isDualStaConcurrencyAllowedInCurrentMode() { + // Check if we can support at least 2 STA concurrently. + std::map req_iface_combo; + req_iface_combo[IfaceConcurrencyType::STA] = 2; + return canCurrentModeSupportConcurrencyCombo(req_iface_combo); +} + +std::string WifiChip::getFirstActiveWlanIfaceName() { + if (sta_ifaces_.size() > 0) return sta_ifaces_[0]->getName(); + if (ap_ifaces_.size() > 0) { + // If the first active wlan iface is bridged iface. + // Return first instance name. + for (auto const& it : br_ifaces_ap_instances_) { + if (it.first == ap_ifaces_[0]->getName()) { + return it.second[0]; + } + } + return ap_ifaces_[0]->getName(); + } + // This could happen if the chip call is made before any STA/AP + // iface is created. Default to wlan0 for such cases. + LOG(WARNING) << "No active wlan interfaces in use! Using default"; + return getWlanIfaceNameWithType(IfaceType::STA, 0); +} + +// Return the first wlan (wlan0, wlan1 etc.) starting from |start_idx| +// not already in use. +// Note: This doesn't check the actual presence of these interfaces. +std::string WifiChip::allocateApOrStaIfaceName(IfaceType type, uint32_t start_idx) { + for (unsigned idx = start_idx; idx < kMaxWlanIfaces; idx++) { + const auto ifname = getWlanIfaceNameWithType(type, idx); + if (findUsingNameFromBridgedApInstances(ifname)) continue; + if (findUsingName(ap_ifaces_, ifname)) continue; + if (findUsingName(sta_ifaces_, ifname)) continue; + return ifname; + } + // This should never happen. We screwed up somewhere if it did. + CHECK(false) << "All wlan interfaces in use already!"; + return {}; +} + +uint32_t WifiChip::startIdxOfApIface() { + if (isDualStaConcurrencyAllowedInCurrentMode()) { + // When the HAL support dual STAs, AP should start with idx 2. + return 2; + } else if (isStaApConcurrencyAllowedInCurrentMode()) { + // When the HAL support STA + AP but it doesn't support dual STAs. + // AP should start with idx 1. + return 1; + } + // No concurrency support. + return 0; +} + +// AP iface names start with idx 1 for modes supporting +// concurrent STA and not dual AP, else start with idx 0. +std::string WifiChip::allocateApIfaceName() { + // Check if we have a dedicated iface for AP. + std::vector ifnames = getPredefinedApIfaceNames(true); + for (auto const& ifname : ifnames) { + if (findUsingName(ap_ifaces_, ifname)) continue; + return ifname; + } + return allocateApOrStaIfaceName(IfaceType::AP, startIdxOfApIface()); +} + +std::vector WifiChip::allocateBridgedApInstanceNames() { + // Check if we have a dedicated iface for AP. + std::vector instances = getPredefinedApIfaceNames(true); + if (instances.size() == 2) { + return instances; + } else { + int num_ifaces_need_to_allocate = 2 - instances.size(); + for (int i = 0; i < num_ifaces_need_to_allocate; i++) { + std::string instance_name = + allocateApOrStaIfaceName(IfaceType::AP, startIdxOfApIface() + i); + if (!instance_name.empty()) { + instances.push_back(instance_name); + } + } + } + return instances; +} + +// STA iface names start with idx 0. +// Primary STA iface will always be 0. +std::string WifiChip::allocateStaIfaceName() { + return allocateApOrStaIfaceName(IfaceType::STA, 0); +} + +bool WifiChip::writeRingbufferFilesInternal() { + if (!removeOldFilesInternal()) { + LOG(ERROR) << "Error occurred while deleting old tombstone files"; + return false; + } + // write ringbuffers to file + { + std::unique_lock lk(lock_t); + for (auto& item : ringbuffer_map_) { + Ringbuffer& cur_buffer = item.second; + if (cur_buffer.getData().empty()) { + continue; + } + const std::string file_path_raw = kTombstoneFolderPath + item.first + "XXXXXXXXXX"; + const int dump_fd = mkstemp(makeCharVec(file_path_raw).data()); + if (dump_fd == -1) { + PLOG(ERROR) << "create file failed"; + return false; + } + unique_fd file_auto_closer(dump_fd); + for (const auto& cur_block : cur_buffer.getData()) { + if (cur_block.size() <= 0 || cur_block.size() > kMaxBufferSizeBytes) { + PLOG(ERROR) << "Ring buffer: " << item.first + << " is corrupted. Invalid block size: " << cur_block.size(); + break; + } + if (write(dump_fd, cur_block.data(), sizeof(cur_block[0]) * cur_block.size()) == + -1) { + PLOG(ERROR) << "Error writing to file"; + } + } + cur_buffer.clear(); + } + // unique_lock unlocked here + } + return true; +} + +std::string WifiChip::getWlanIfaceNameWithType(IfaceType type, unsigned idx) { + std::string ifname; + + // let the legacy hal override the interface name + legacy_hal::wifi_error err = legacy_hal_.lock()->getSupportedIfaceName((uint32_t)type, ifname); + if (err == legacy_hal::WIFI_SUCCESS) return ifname; + + return getWlanIfaceName(idx); +} + +void WifiChip::invalidateAndClearBridgedApAll() { + for (auto const& it : br_ifaces_ap_instances_) { + for (auto const& iface : it.second) { + iface_util_->removeIfaceFromBridge(it.first, iface); + legacy_hal_.lock()->deleteVirtualInterface(iface); + } + iface_util_->deleteBridge(it.first); + } + br_ifaces_ap_instances_.clear(); +} + +void WifiChip::invalidateAndClearBridgedAp(const std::string& br_name) { + if (br_name.empty()) return; + // delete managed interfaces + for (auto const& it : br_ifaces_ap_instances_) { + if (it.first == br_name) { + for (auto const& iface : it.second) { + iface_util_->removeIfaceFromBridge(br_name, iface); + legacy_hal_.lock()->deleteVirtualInterface(iface); + } + iface_util_->deleteBridge(br_name); + br_ifaces_ap_instances_.erase(br_name); + break; + } + } + return; +} + +bool WifiChip::findUsingNameFromBridgedApInstances(const std::string& name) { + for (auto const& it : br_ifaces_ap_instances_) { + if (it.first == name) { + return true; + } + for (auto const& iface : it.second) { + if (iface == name) { + return true; + } + } + } + return false; +} + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/wifi_chip.h b/wifi/aidl/default/wifi_chip.h new file mode 100644 index 0000000000..59eaa4a58c --- /dev/null +++ b/wifi/aidl/default/wifi_chip.h @@ -0,0 +1,287 @@ +/* + * 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. + */ + +#ifndef WIFI_CHIP_H_ +#define WIFI_CHIP_H_ + +#include +#include +#include + +#include +#include +#include + +#include "aidl_callback_util.h" +#include "ringbuffer.h" +#include "wifi_ap_iface.h" +#include "wifi_feature_flags.h" +#include "wifi_legacy_hal.h" +#include "wifi_mode_controller.h" +#include "wifi_nan_iface.h" +#include "wifi_p2p_iface.h" +#include "wifi_rtt_controller.h" +#include "wifi_sta_iface.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { + +/** + * AIDL interface object used to control a Wifi HAL chip instance. + * Since there is only a single chip instance used today, there is no + * identifying handle information stored here. + */ +class WifiChip : public BnWifiChip { + public: + WifiChip(int32_t chip_id, bool is_primary, + const std::weak_ptr legacy_hal, + const std::weak_ptr mode_controller, + const std::shared_ptr iface_util, + const std::weak_ptr feature_flags, + const std::function& subsystemCallbackHandler); + + // Factory method - use instead of default constructor. + static std::shared_ptr create( + int32_t chip_id, bool is_primary, + const std::weak_ptr legacy_hal, + const std::weak_ptr mode_controller, + const std::shared_ptr iface_util, + const std::weak_ptr feature_flags, + const std::function& subsystemCallbackHandler); + + // AIDL does not provide a built-in mechanism to let the server invalidate + // an AIDL interface object after creation. If any client process holds onto + // a reference to the object in their context, any method calls on that + // reference will continue to be directed to the server. + // + // However Wifi HAL needs to control the lifetime of these objects. So, add + // a public |invalidate| method to |WifiChip| and its child objects. This + // will be used to mark an object invalid when either: + // a) Wifi HAL is stopped, or + // b) Wifi Chip is reconfigured. + // + // All AIDL method implementations should check if the object is still + // marked valid before processing them. + void invalidate(); + bool isValid(); + std::set> getEventCallbacks(); + + // AIDL methods exposed. + ndk::ScopedAStatus getId(int32_t* _aidl_return) override; + ndk::ScopedAStatus registerEventCallback( + const std::shared_ptr& in_callback) override; + ndk::ScopedAStatus getCapabilities(IWifiChip::ChipCapabilityMask* _aidl_return) override; + ndk::ScopedAStatus getAvailableModes(std::vector* _aidl_return) override; + ndk::ScopedAStatus configureChip(int32_t in_modeId) override; + ndk::ScopedAStatus getMode(int32_t* _aidl_return) override; + ndk::ScopedAStatus requestChipDebugInfo(IWifiChip::ChipDebugInfo* _aidl_return) override; + ndk::ScopedAStatus requestDriverDebugDump(std::vector* _aidl_return) override; + ndk::ScopedAStatus requestFirmwareDebugDump(std::vector* _aidl_return) override; + ndk::ScopedAStatus createApIface(std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus createBridgedApIface(std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus getApIfaceNames(std::vector* _aidl_return) override; + ndk::ScopedAStatus getApIface(const std::string& in_ifname, + std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus removeApIface(const std::string& in_ifname) override; + ndk::ScopedAStatus removeIfaceInstanceFromBridgedApIface( + const std::string& in_brIfaceName, const std::string& in_ifaceInstanceName) override; + ndk::ScopedAStatus createNanIface(std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus getNanIfaceNames(std::vector* _aidl_return) override; + ndk::ScopedAStatus getNanIface(const std::string& in_ifname, + std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus removeNanIface(const std::string& in_ifname) override; + ndk::ScopedAStatus createP2pIface(std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus getP2pIfaceNames(std::vector* _aidl_return) override; + ndk::ScopedAStatus getP2pIface(const std::string& in_ifname, + std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus removeP2pIface(const std::string& in_ifname) override; + ndk::ScopedAStatus createStaIface(std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus getStaIfaceNames(std::vector* _aidl_return) override; + ndk::ScopedAStatus getStaIface(const std::string& in_ifname, + std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus removeStaIface(const std::string& in_ifname) override; + ndk::ScopedAStatus createRttController( + const std::shared_ptr& in_boundIface, + std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus getDebugRingBuffersStatus( + std::vector* _aidl_return) override; + ndk::ScopedAStatus startLoggingToDebugRingBuffer( + const std::string& in_ringName, WifiDebugRingBufferVerboseLevel in_verboseLevel, + int32_t in_maxIntervalInSec, int32_t in_minDataSizeInBytes) override; + ndk::ScopedAStatus forceDumpToDebugRingBuffer(const std::string& in_ringName) override; + ndk::ScopedAStatus flushRingBufferToFile() override; + ndk::ScopedAStatus stopLoggingToDebugRingBuffer() override; + ndk::ScopedAStatus getDebugHostWakeReasonStats( + WifiDebugHostWakeReasonStats* _aidl_return) override; + ndk::ScopedAStatus enableDebugErrorAlerts(bool in_enable) override; + ndk::ScopedAStatus selectTxPowerScenario(IWifiChip::TxPowerScenario in_scenario) override; + ndk::ScopedAStatus resetTxPowerScenario() override; + ndk::ScopedAStatus setLatencyMode(IWifiChip::LatencyMode in_mode) override; + ndk::ScopedAStatus setMultiStaPrimaryConnection(const std::string& in_ifName) override; + ndk::ScopedAStatus setMultiStaUseCase(IWifiChip::MultiStaUseCase in_useCase) override; + ndk::ScopedAStatus setCoexUnsafeChannels( + const std::vector& in_unsafeChannels, + CoexRestriction in_restrictions) override; + ndk::ScopedAStatus setCountryCode(const std::array& in_code) override; + ndk::ScopedAStatus getUsableChannels(WifiBand in_band, WifiIfaceMode in_ifaceModeMask, + UsableChannelFilter in_filterMask, + std::vector* _aidl_return) override; + ndk::ScopedAStatus triggerSubsystemRestart() override; + ndk::ScopedAStatus getSupportedRadioCombinationsMatrix( + WifiRadioCombinationMatrix* _aidl_return) override; + binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; + + private: + void invalidateAndRemoveAllIfaces(); + // When a STA iface is removed any dependent NAN-ifaces/RTT-controllers are + // invalidated & removed. + void invalidateAndRemoveDependencies(const std::string& removed_iface_name); + + // Corresponding worker functions for the AIDL methods. + std::pair getIdInternal(); + ndk::ScopedAStatus registerEventCallbackInternal( + const std::shared_ptr& event_callback); + std::pair getCapabilitiesInternal(); + std::pair, ndk::ScopedAStatus> getAvailableModesInternal(); + ndk::ScopedAStatus configureChipInternal(std::unique_lock* lock, + int32_t mode_id); + std::pair getModeInternal(); + std::pair requestChipDebugInfoInternal(); + std::pair, ndk::ScopedAStatus> requestDriverDebugDumpInternal(); + std::pair, ndk::ScopedAStatus> requestFirmwareDebugDumpInternal(); + std::shared_ptr newWifiApIface(std::string& ifname); + ndk::ScopedAStatus createVirtualApInterface(const std::string& apVirtIf); + std::pair, ndk::ScopedAStatus> createApIfaceInternal(); + std::pair, ndk::ScopedAStatus> createBridgedApIfaceInternal(); + std::pair, ndk::ScopedAStatus> getApIfaceNamesInternal(); + std::pair, ndk::ScopedAStatus> getApIfaceInternal( + const std::string& ifname); + ndk::ScopedAStatus removeApIfaceInternal(const std::string& ifname); + ndk::ScopedAStatus removeIfaceInstanceFromBridgedApIfaceInternal( + const std::string& brIfaceName, const std::string& ifInstanceName); + std::pair, ndk::ScopedAStatus> createNanIfaceInternal(); + std::pair, ndk::ScopedAStatus> getNanIfaceNamesInternal(); + std::pair, ndk::ScopedAStatus> getNanIfaceInternal( + const std::string& ifname); + ndk::ScopedAStatus removeNanIfaceInternal(const std::string& ifname); + std::pair, ndk::ScopedAStatus> createP2pIfaceInternal(); + std::pair, ndk::ScopedAStatus> getP2pIfaceNamesInternal(); + std::pair, ndk::ScopedAStatus> getP2pIfaceInternal( + const std::string& ifname); + ndk::ScopedAStatus removeP2pIfaceInternal(const std::string& ifname); + std::pair, ndk::ScopedAStatus> createStaIfaceInternal(); + std::pair, ndk::ScopedAStatus> getStaIfaceNamesInternal(); + std::pair, ndk::ScopedAStatus> getStaIfaceInternal( + const std::string& ifname); + ndk::ScopedAStatus removeStaIfaceInternal(const std::string& ifname); + std::pair, ndk::ScopedAStatus> createRttControllerInternal( + const std::shared_ptr& bound_iface); + std::pair, ndk::ScopedAStatus> + getDebugRingBuffersStatusInternal(); + ndk::ScopedAStatus startLoggingToDebugRingBufferInternal( + const std::string& ring_name, WifiDebugRingBufferVerboseLevel verbose_level, + uint32_t max_interval_in_sec, uint32_t min_data_size_in_bytes); + ndk::ScopedAStatus forceDumpToDebugRingBufferInternal(const std::string& ring_name); + ndk::ScopedAStatus flushRingBufferToFileInternal(); + ndk::ScopedAStatus stopLoggingToDebugRingBufferInternal(); + std::pair + getDebugHostWakeReasonStatsInternal(); + ndk::ScopedAStatus enableDebugErrorAlertsInternal(bool enable); + ndk::ScopedAStatus selectTxPowerScenarioInternal(IWifiChip::TxPowerScenario scenario); + ndk::ScopedAStatus resetTxPowerScenarioInternal(); + ndk::ScopedAStatus setLatencyModeInternal(IWifiChip::LatencyMode mode); + ndk::ScopedAStatus setMultiStaPrimaryConnectionInternal(const std::string& ifname); + ndk::ScopedAStatus setMultiStaUseCaseInternal(IWifiChip::MultiStaUseCase use_case); + ndk::ScopedAStatus setCoexUnsafeChannelsInternal( + std::vector unsafe_channels, + CoexRestriction restrictions); + ndk::ScopedAStatus setCountryCodeInternal(const std::array& in_code); + std::pair, ndk::ScopedAStatus> getUsableChannelsInternal( + WifiBand band, WifiIfaceMode ifaceModeMask, UsableChannelFilter filterMask); + ndk::ScopedAStatus handleChipConfiguration(std::unique_lock* lock, + int32_t mode_id); + ndk::ScopedAStatus registerDebugRingBufferCallback(); + ndk::ScopedAStatus registerRadioModeChangeCallback(); + + std::vector getCurrentModeConcurrencyCombinations(); + std::map getCurrentConcurrencyCombination(); + std::vector> expandConcurrencyCombinations( + const ChipConcurrencyCombination& combination); + bool canExpandedConcurrencyComboSupportConcurrencyTypeWithCurrentTypes( + const std::map& expanded_combo, + IfaceConcurrencyType requested_type); + bool canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType requested_type); + bool canExpandedConcurrencyComboSupportConcurrencyCombo( + const std::map& expanded_combo, + const std::map& req_combo); + bool canCurrentModeSupportConcurrencyCombo( + const std::map& req_combo); + bool canCurrentModeSupportConcurrencyType(IfaceConcurrencyType requested_type); + + bool isValidModeId(int32_t mode_id); + bool isStaApConcurrencyAllowedInCurrentMode(); + bool isDualStaConcurrencyAllowedInCurrentMode(); + uint32_t startIdxOfApIface(); + std::string getFirstActiveWlanIfaceName(); + std::string allocateApOrStaIfaceName(IfaceType type, uint32_t start_idx); + std::string allocateApIfaceName(); + std::vector allocateBridgedApInstanceNames(); + std::string allocateStaIfaceName(); + bool writeRingbufferFilesInternal(); + std::string getWlanIfaceNameWithType(IfaceType type, unsigned idx); + void invalidateAndClearBridgedApAll(); + void invalidateAndClearBridgedAp(const std::string& br_name); + bool findUsingNameFromBridgedApInstances(const std::string& name); + ndk::ScopedAStatus triggerSubsystemRestartInternal(); + std::pair + getSupportedRadioCombinationsMatrixInternal(); + void setWeakPtr(std::weak_ptr ptr); + + int32_t chip_id_; + std::weak_ptr legacy_hal_; + std::weak_ptr mode_controller_; + std::shared_ptr iface_util_; + std::vector> ap_ifaces_; + std::vector> nan_ifaces_; + std::vector> p2p_ifaces_; + std::vector> sta_ifaces_; + std::vector> rtt_controllers_; + std::map ringbuffer_map_; + bool is_valid_; + // Members pertaining to chip configuration. + int32_t current_mode_id_; + std::mutex lock_t; + std::vector modes_; + // The legacy ring buffer callback API has only a global callback + // registration mechanism. Use this to check if we have already + // registered a callback. + bool debug_ring_buffer_cb_registered_; + aidl_callback_util::AidlCallbackHandler event_cb_handler_; + std::weak_ptr weak_ptr_this_; + + const std::function subsystemCallbackHandler_; + std::map> br_ifaces_ap_instances_; + DISALLOW_COPY_AND_ASSIGN(WifiChip); +}; + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // WIFI_CHIP_H_ diff --git a/wifi/aidl/default/wifi_feature_flags.cpp b/wifi/aidl/default/wifi_feature_flags.cpp new file mode 100644 index 0000000000..3c9f042607 --- /dev/null +++ b/wifi/aidl/default/wifi_feature_flags.cpp @@ -0,0 +1,228 @@ +/* + * 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. + */ + +#include + +#include +#include + +#include "wifi_feature_flags.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace feature_flags { + +/* The chip may either have a single mode supporting any number of combinations, + * or a fixed dual-mode (so it involves firmware loading to switch between + * modes) setting. If there is a need to support more modes, it needs to be + * implemented manually in WiFi HAL (see changeFirmwareMode in + * WifiChip::handleChipConfiguration). + * + * Supported combinations are defined in device's makefile, for example: + * WIFI_HAL_INTERFACE_COMBINATIONS := {{{STA, AP}, 1}, {{P2P, NAN}, 1}}, + * WIFI_HAL_INTERFACE_COMBINATIONS += {{{STA}, 1}, {{AP}, 2}} + * What this means: + * Interface concurrency combination 1: 1 STA or AP and 1 P2P or NAN concurrent iface + * operations. + * Interface concurrency combination 2: 1 STA and 2 AP concurrent iface operations. + * + * For backward compatibility, the following makefile flags can be used to + * generate combinations list: + * - WIFI_HIDL_FEATURE_DUAL_INTERFACE + * - WIFI_HIDL_FEATURE_DISABLE_AP + * - WIFI_HIDL_FEATURE_AWARE + * However, they are ignored if WIFI_HAL_INTERFACE_COMBINATIONS was provided. + * With WIFI_HIDL_FEATURE_DUAL_INTERFACE flag set, there is a single mode with + * two concurrency combinations: + * Interface Concurrency Combination 1: Will support 1 STA and 1 P2P or NAN (optional) + * concurrent iface operations. + * Interface Concurrency Combination 2: Will support 1 STA and 1 AP concurrent + * iface operations. + * + * The only dual-mode configuration supported is for alternating STA and AP + * mode, that may involve firmware reloading. In such case, there are 2 separate + * modes of operation with 1 concurrency combination each: + * Mode 1 (STA mode): Will support 1 STA and 1 P2P or NAN (optional) + * concurrent iface operations. + * Mode 2 (AP mode): Will support 1 AP iface operation. + * + * If Aware is enabled, the concurrency combination will be modified to support either + * P2P or NAN in place of just P2P. + */ +// clang-format off +#ifdef WIFI_HAL_INTERFACE_COMBINATIONS +constexpr int kMainModeId = chip_mode_ids::kV3; +#elif defined(WIFI_HIDL_FEATURE_DUAL_INTERFACE) +// former V2 (fixed dual interface) setup expressed as V3 +constexpr int kMainModeId = chip_mode_ids::kV3; +# ifdef WIFI_HIDL_FEATURE_DISABLE_AP +# ifdef WIFI_HIDL_FEATURE_AWARE +// 1 STA + 1 of (P2P or NAN) +# define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{P2P, NAN}, 1}} +# else +// 1 STA + 1 P2P +# define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{P2P}, 1}} +# endif +# else +# ifdef WIFI_HIDL_FEATURE_AWARE +// (1 STA + 1 AP) or (1 STA + 1 of (P2P or NAN)) +# define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{AP}, 1}},\ + {{{STA}, 1}, {{P2P, NAN}, 1}} +# else +// (1 STA + 1 AP) or (1 STA + 1 P2P) +# define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{AP}, 1}},\ + {{{STA}, 1}, {{P2P}, 1}} +# endif +# endif +#else +// V1 (fixed single interface, dual-mode chip) +constexpr int kMainModeId = chip_mode_ids::kV1Sta; +# ifdef WIFI_HIDL_FEATURE_AWARE +// 1 STA + 1 of (P2P or NAN) +# define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{P2P, NAN}, 1}} +# else +// 1 STA + 1 P2P +# define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{P2P}, 1}} +# endif + +# ifndef WIFI_HIDL_FEATURE_DISABLE_AP +# define WIFI_HAL_INTERFACE_COMBINATIONS_AP {{{AP}, 1}} +# endif +#endif +// clang-format on + +// Convert from the legacy format (used by the WIFI_HAL_INTERFACE_COMBINATIONS +// config variable) to a list of ChipConcurrencyCombination objects. +std::vector legacyToChipConcurrencyComboList( + std::vector> legacyLimits) { + std::vector combos; + for (auto& legacyLimit : legacyLimits) { + IWifiChip::ChipConcurrencyCombination combo = {legacyLimit}; + combos.push_back(combo); + } + return combos; +} + +#define STA IfaceConcurrencyType::STA +#define AP IfaceConcurrencyType::AP +#define AP_BRIDGED IfaceConcurrencyType::AP_BRIDGED +#define P2P IfaceConcurrencyType::P2P +#define NAN IfaceConcurrencyType::NAN_IFACE +static const std::vector kChipModesPrimary{ + {kMainModeId, legacyToChipConcurrencyComboList({WIFI_HAL_INTERFACE_COMBINATIONS})}, +#ifdef WIFI_HAL_INTERFACE_COMBINATIONS_AP + {chip_mode_ids::kV1Ap, + legacyToChipConcurrencyComboList({WIFI_HAL_INTERFACE_COMBINATIONS_AP})}, +#endif +}; + +static const std::vector kChipModesSecondary{ +#ifdef WIFI_HAL_INTERFACE_COMBINATIONS_SECONDARY_CHIP + {chip_mode_ids::kV3, + legacyToChipConcurrencyComboList({WIFI_HAL_INTERFACE_COMBINATIONS_SECONDARY_CHIP})}, +#endif +}; + +constexpr char kDebugPresetInterfaceCombinationIdxProperty[] = + "persist.vendor.debug.wifi.hal.preset_interface_combination_idx"; +// List of pre-defined concurrency combinations that can be enabled at runtime via +// setting the property: "kDebugPresetInterfaceCombinationIdxProperty" to the +// corresponding index value. +static const std::vector>> kDebugChipModes{ + // Legacy combination - No STA/AP concurrencies. + // 0 - (1 AP) or (1 STA + 1 of (P2P or NAN)) + {"No STA/AP Concurrency", + {{kMainModeId, + legacyToChipConcurrencyComboList({{{{AP}, 1}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}}, + + // STA + AP concurrency + // 1 - (1 STA + 1 AP) or (1 STA + 1 of (P2P or NAN)) + {"STA + AP Concurrency", + {{kMainModeId, legacyToChipConcurrencyComboList( + {{{{STA}, 1}, {{AP}, 1}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}}, + + // STA + STA concurrency + // 2 - (1 STA + 1 AP) or (2 STA + 1 of (P2P or NAN)) + {"Dual STA Concurrency", + {{kMainModeId, legacyToChipConcurrencyComboList( + {{{{STA}, 1}, {{AP}, 1}}, {{{STA}, 2}, {{P2P, NAN}, 1}}})}}}, + + // AP + AP + STA concurrency + // 3 - (1 STA + 2 AP) or (1 STA + 1 of (P2P or NAN)) + {"Dual AP Concurrency", + {{kMainModeId, legacyToChipConcurrencyComboList( + {{{{STA}, 1}, {{AP}, 2}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}}, + + // STA + STA concurrency and AP + AP + STA concurrency + // 4 - (1 STA + 2 AP) or (2 STA + 1 of (P2P or NAN)) + {"Dual STA & Dual AP Concurrency", + {{kMainModeId, legacyToChipConcurrencyComboList( + {{{{STA}, 1}, {{AP}, 2}}, {{{STA}, 2}, {{P2P, NAN}, 1}}})}}}, + + // STA + STA concurrency + // 5 - (1 STA + 1 AP (bridged or single) | P2P | NAN), or (2 STA)) + {"Dual STA or STA plus single other interface", + {{kMainModeId, legacyToChipConcurrencyComboList( + {{{{STA}, 1}, {{P2P, NAN, AP, AP_BRIDGED}, 1}}, {{{STA}, 2}}})}}}}; + +#undef STA +#undef AP +#undef AP_BRIDGED +#undef P2P +#undef NAN + +#ifdef WIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION +#pragma message \ + "WIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION is deprecated; override " \ + "'config_wifi_ap_randomization_supported' in " \ + "frameworks/base/core/res/res/values/config.xml in the device overlay " \ + "instead" +#endif // WIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION + +WifiFeatureFlags::WifiFeatureFlags() {} + +std::vector WifiFeatureFlags::getChipModesForPrimary() { + std::array buffer; + auto res = property_get(kDebugPresetInterfaceCombinationIdxProperty, buffer.data(), nullptr); + // Debug property not set, use the device preset concurrency combination. + if (res <= 0) return kChipModesPrimary; + + // Debug property set, use one of the debug preset concurrency combination. + unsigned long idx = std::stoul(buffer.data()); + if (idx >= kDebugChipModes.size()) { + LOG(ERROR) << "Invalid index set in property: " + << kDebugPresetInterfaceCombinationIdxProperty; + return kChipModesPrimary; + } + std::string name; + std::vector chip_modes; + std::tie(name, chip_modes) = kDebugChipModes[idx]; + LOG(INFO) << "Using debug chip mode: <" << name + << "> set via property: " << kDebugPresetInterfaceCombinationIdxProperty; + return chip_modes; +} + +std::vector WifiFeatureFlags::getChipModes(bool is_primary) { + return (is_primary) ? getChipModesForPrimary() : kChipModesSecondary; +} + +} // namespace feature_flags +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/wifi_feature_flags.h b/wifi/aidl/default/wifi_feature_flags.h new file mode 100644 index 0000000000..af1b6a674d --- /dev/null +++ b/wifi/aidl/default/wifi_feature_flags.h @@ -0,0 +1,56 @@ +/* + * 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. + */ + +#ifndef WIFI_FEATURE_FLAGS_H_ +#define WIFI_FEATURE_FLAGS_H_ + +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace feature_flags { + +namespace chip_mode_ids { +// These mode ID's should be unique (even across combo versions). Refer to +// handleChipConfiguration() for its usage. +constexpr uint32_t kInvalid = UINT32_MAX; +// Mode ID's for V1 +constexpr uint32_t kV1Sta = 0; +constexpr uint32_t kV1Ap = 1; +// Mode ID for V3 +constexpr uint32_t kV3 = 3; +} // namespace chip_mode_ids + +class WifiFeatureFlags { + public: + WifiFeatureFlags(); + virtual ~WifiFeatureFlags() = default; + + virtual std::vector getChipModes(bool is_primary); + + private: + std::vector getChipModesForPrimary(); +}; + +} // namespace feature_flags +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // WIFI_FEATURE_FLAGS_H_ diff --git a/wifi/aidl/default/wifi_iface_util.cpp b/wifi/aidl/default/wifi_iface_util.cpp new file mode 100644 index 0000000000..f788217dcf --- /dev/null +++ b/wifi/aidl/default/wifi_iface_util.cpp @@ -0,0 +1,174 @@ +/* + * 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. + */ + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "wifi_iface_util.h" + +namespace { +// Constants to set the local bit & clear the multicast bit. +constexpr uint8_t kMacAddressMulticastMask = 0x01; +constexpr uint8_t kMacAddressLocallyAssignedMask = 0x02; + +} // namespace + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace iface_util { + +WifiIfaceUtil::WifiIfaceUtil(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, + const std::weak_ptr legacy_hal) + : iface_tool_(iface_tool), + legacy_hal_(legacy_hal), + random_mac_address_(nullptr), + event_handlers_map_() {} + +std::array WifiIfaceUtil::getFactoryMacAddress(const std::string& iface_name) { + return iface_tool_.lock()->GetFactoryMacAddress(iface_name.c_str()); +} + +bool WifiIfaceUtil::setMacAddress(const std::string& iface_name, + const std::array& mac) { +#ifndef WIFI_AVOID_IFACE_RESET_MAC_CHANGE + legacy_hal::wifi_error legacy_status; + uint64_t legacy_feature_set; + std::tie(legacy_status, legacy_feature_set) = + legacy_hal_.lock()->getSupportedFeatureSet(iface_name); + + if (!(legacy_feature_set & WIFI_FEATURE_DYNAMIC_SET_MAC) && + !iface_tool_.lock()->SetUpState(iface_name.c_str(), false)) { + LOG(ERROR) << "SetUpState(false) failed."; + return false; + } +#endif + bool success = iface_tool_.lock()->SetMacAddress(iface_name.c_str(), mac); +#ifndef WIFI_AVOID_IFACE_RESET_MAC_CHANGE + if (!(legacy_feature_set & WIFI_FEATURE_DYNAMIC_SET_MAC) && + !iface_tool_.lock()->SetUpState(iface_name.c_str(), true)) { + LOG(ERROR) << "SetUpState(true) failed. Wait for driver ready."; + // Wait for driver ready and try to set iface UP again + if (legacy_hal_.lock()->waitForDriverReady() != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "SetUpState(true) wait for driver ready failed."; + return false; + } + if (!iface_tool_.lock()->SetUpState(iface_name.c_str(), true)) { + LOG(ERROR) << "SetUpState(true) failed after retry."; + return false; + } + } +#endif + IfaceEventHandlers event_handlers = {}; + const auto it = event_handlers_map_.find(iface_name); + if (it != event_handlers_map_.end()) { + event_handlers = it->second; + } + if (event_handlers.on_state_toggle_off_on != nullptr) { + event_handlers.on_state_toggle_off_on(iface_name); + } + if (!success) { + LOG(ERROR) << "SetMacAddress failed on " << iface_name; + } else { + LOG(DEBUG) << "SetMacAddress succeeded on " << iface_name; + } + return success; +} + +std::array WifiIfaceUtil::getOrCreateRandomMacAddress() { + if (random_mac_address_) { + return *random_mac_address_.get(); + } + random_mac_address_ = std::make_unique>(createRandomMacAddress()); + return *random_mac_address_.get(); +} + +void WifiIfaceUtil::registerIfaceEventHandlers(const std::string& iface_name, + IfaceEventHandlers handlers) { + event_handlers_map_[iface_name] = handlers; +} + +void WifiIfaceUtil::unregisterIfaceEventHandlers(const std::string& iface_name) { + event_handlers_map_.erase(iface_name); +} + +std::array WifiIfaceUtil::createRandomMacAddress() { + std::array address = {}; + std::random_device rd; + std::default_random_engine engine(rd()); + std::uniform_int_distribution dist(std::numeric_limits::min(), + std::numeric_limits::max()); + for (size_t i = 0; i < address.size(); i++) { + address[i] = dist(engine); + } + // Set the local bit and clear the multicast bit. + address[0] |= kMacAddressLocallyAssignedMask; + address[0] &= ~kMacAddressMulticastMask; + return address; +} + +bool WifiIfaceUtil::setUpState(const std::string& iface_name, bool request_up) { + if (!iface_tool_.lock()->SetUpState(iface_name.c_str(), request_up)) { + LOG(ERROR) << "SetUpState to " << request_up << " failed"; + return false; + } + return true; +} + +unsigned WifiIfaceUtil::ifNameToIndex(const std::string& iface_name) { + return if_nametoindex(iface_name.c_str()); +} + +bool WifiIfaceUtil::createBridge(const std::string& br_name) { + if (!iface_tool_.lock()->createBridge(br_name)) { + return false; + } + + if (!iface_tool_.lock()->SetUpState(br_name.c_str(), true)) { + LOG(ERROR) << "bridge SetUpState(true) failed."; + } + return true; +} + +bool WifiIfaceUtil::deleteBridge(const std::string& br_name) { + if (!iface_tool_.lock()->SetUpState(br_name.c_str(), false)) { + LOG(INFO) << "SetUpState(false) failed for bridge=" << br_name.c_str(); + } + + return iface_tool_.lock()->deleteBridge(br_name); +} + +bool WifiIfaceUtil::addIfaceToBridge(const std::string& br_name, const std::string& if_name) { + return iface_tool_.lock()->addIfaceToBridge(br_name, if_name); +} + +bool WifiIfaceUtil::removeIfaceFromBridge(const std::string& br_name, const std::string& if_name) { + return iface_tool_.lock()->removeIfaceFromBridge(br_name, if_name); +} + +} // namespace iface_util +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/wifi_iface_util.h b/wifi/aidl/default/wifi_iface_util.h new file mode 100644 index 0000000000..a3236a5622 --- /dev/null +++ b/wifi/aidl/default/wifi_iface_util.h @@ -0,0 +1,84 @@ +/* + * 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. + */ + +#ifndef WIFI_IFACE_UTIL_H_ +#define WIFI_IFACE_UTIL_H_ + +#include +#include + +#include "wifi_legacy_hal.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace iface_util { + +// Iface event handlers. +struct IfaceEventHandlers { + // Callback to be invoked when the iface is set down & up for MAC address + // change. + std::function on_state_toggle_off_on; +}; + +/** + * Util class for common iface operations. + */ +class WifiIfaceUtil { + public: + WifiIfaceUtil(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, + const std::weak_ptr legacy_hal); + virtual ~WifiIfaceUtil() = default; + + virtual std::array getFactoryMacAddress(const std::string& iface_name); + virtual bool setMacAddress(const std::string& iface_name, const std::array& mac); + // Get or create a random MAC address. The MAC address returned from + // this method will remain the same throughout the lifetime of the HAL + // daemon. (So, changes on every reboot) + virtual std::array getOrCreateRandomMacAddress(); + + // Register for any iface event callbacks for the provided interface. + virtual void registerIfaceEventHandlers(const std::string& iface_name, + IfaceEventHandlers handlers); + virtual void unregisterIfaceEventHandlers(const std::string& iface_name); + virtual bool setUpState(const std::string& iface_name, bool request_up); + virtual unsigned ifNameToIndex(const std::string& iface_name); + + virtual bool createBridge(const std::string& br_name); + + virtual bool deleteBridge(const std::string& br_name); + + virtual bool addIfaceToBridge(const std::string& br_name, const std::string& if_name); + + virtual bool removeIfaceFromBridge(const std::string& br_name, const std::string& if_name); + // Get a random MAC address. + virtual std::array createRandomMacAddress(); + + private: + std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool_; + std::weak_ptr legacy_hal_; + std::unique_ptr> random_mac_address_; + std::map event_handlers_map_; +}; + +} // namespace iface_util +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // WIFI_IFACE_UTIL_H_ diff --git a/wifi/aidl/default/wifi_legacy_hal.cpp b/wifi/aidl/default/wifi_legacy_hal.cpp new file mode 100644 index 0000000000..43e73cae9f --- /dev/null +++ b/wifi/aidl/default/wifi_legacy_hal.cpp @@ -0,0 +1,1654 @@ +/* + * 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. + */ + +#include "wifi_legacy_hal.h" + +#include +#include +#include + +#include +#include + +#include "aidl_sync_util.h" +#include "wifi_legacy_hal_stubs.h" + +namespace { +// Constants ported over from the legacy HAL calling code +// (com_android_server_wifi_WifiNative.cpp). This will all be thrown +// away when this shim layer is replaced by the real vendor +// implementation. +static constexpr uint32_t kMaxVersionStringLength = 256; +static constexpr uint32_t kMaxCachedGscanResults = 64; +static constexpr uint32_t kMaxGscanFrequenciesForBand = 64; +static constexpr uint32_t kLinkLayerStatsDataMpduSizeThreshold = 128; +static constexpr uint32_t kMaxWakeReasonStatsArraySize = 32; +static constexpr uint32_t kMaxRingBuffers = 10; +static constexpr uint32_t kMaxWifiUsableChannels = 256; +static constexpr uint32_t kMaxSupportedRadioCombinationsMatrixLength = 256; +// Need a long timeout (1000ms) for chips that unload their driver. +static constexpr uint32_t kMaxStopCompleteWaitMs = 1000; +static constexpr char kDriverPropName[] = "wlan.driver.status"; + +// Helper function to create a non-const char* for legacy Hal API's. +std::vector makeCharVec(const std::string& str) { + std::vector vec(str.size() + 1); + vec.assign(str.begin(), str.end()); + vec.push_back('\0'); + return vec; +} +} // namespace + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace legacy_hal { + +// Legacy HAL functions accept "C" style function pointers, so use global +// functions to pass to the legacy HAL function and store the corresponding +// std::function methods to be invoked. +// +// Callback to be invoked once |stop| is complete +std::function on_stop_complete_internal_callback; +void onAsyncStopComplete(wifi_handle handle) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_stop_complete_internal_callback) { + on_stop_complete_internal_callback(handle); + // Invalidate this callback since we don't want this firing again. + on_stop_complete_internal_callback = nullptr; + } +} + +// Callback to be invoked for driver dump. +std::function on_driver_memory_dump_internal_callback; +void onSyncDriverMemoryDump(char* buffer, int buffer_size) { + if (on_driver_memory_dump_internal_callback) { + on_driver_memory_dump_internal_callback(buffer, buffer_size); + } +} + +// Callback to be invoked for firmware dump. +std::function on_firmware_memory_dump_internal_callback; +void onSyncFirmwareMemoryDump(char* buffer, int buffer_size) { + if (on_firmware_memory_dump_internal_callback) { + on_firmware_memory_dump_internal_callback(buffer, buffer_size); + } +} + +// Callback to be invoked for Gscan events. +std::function on_gscan_event_internal_callback; +void onAsyncGscanEvent(wifi_request_id id, wifi_scan_event event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_gscan_event_internal_callback) { + on_gscan_event_internal_callback(id, event); + } +} + +// Callback to be invoked for Gscan full results. +std::function + on_gscan_full_result_internal_callback; +void onAsyncGscanFullResult(wifi_request_id id, wifi_scan_result* result, + uint32_t buckets_scanned) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_gscan_full_result_internal_callback) { + on_gscan_full_result_internal_callback(id, result, buckets_scanned); + } +} + +// Callback to be invoked for link layer stats results. +std::function + on_link_layer_stats_result_internal_callback; +void onSyncLinkLayerStatsResult(wifi_request_id id, wifi_iface_stat* iface_stat, int num_radios, + wifi_radio_stat* radio_stat) { + if (on_link_layer_stats_result_internal_callback) { + on_link_layer_stats_result_internal_callback(id, iface_stat, num_radios, radio_stat); + } +} + +// Callback to be invoked for rssi threshold breach. +std::function + on_rssi_threshold_breached_internal_callback; +void onAsyncRssiThresholdBreached(wifi_request_id id, uint8_t* bssid, int8_t rssi) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_rssi_threshold_breached_internal_callback) { + on_rssi_threshold_breached_internal_callback(id, bssid, rssi); + } +} + +// Callback to be invoked for ring buffer data indication. +std::function + on_ring_buffer_data_internal_callback; +void onAsyncRingBufferData(char* ring_name, char* buffer, int buffer_size, + wifi_ring_buffer_status* status) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_ring_buffer_data_internal_callback) { + on_ring_buffer_data_internal_callback(ring_name, buffer, buffer_size, status); + } +} + +// Callback to be invoked for error alert indication. +std::function on_error_alert_internal_callback; +void onAsyncErrorAlert(wifi_request_id id, char* buffer, int buffer_size, int err_code) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_error_alert_internal_callback) { + on_error_alert_internal_callback(id, buffer, buffer_size, err_code); + } +} + +// Callback to be invoked for radio mode change indication. +std::function + on_radio_mode_change_internal_callback; +void onAsyncRadioModeChange(wifi_request_id id, uint32_t num_macs, wifi_mac_info* mac_infos) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_radio_mode_change_internal_callback) { + on_radio_mode_change_internal_callback(id, num_macs, mac_infos); + } +} + +// Callback to be invoked to report subsystem restart +std::function on_subsystem_restart_internal_callback; +void onAsyncSubsystemRestart(const char* error) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_subsystem_restart_internal_callback) { + on_subsystem_restart_internal_callback(error); + } +} + +// Callback to be invoked for rtt results results. +std::function + on_rtt_results_internal_callback; +void onAsyncRttResults(wifi_request_id id, unsigned num_results, wifi_rtt_result* rtt_results[]) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_rtt_results_internal_callback) { + on_rtt_results_internal_callback(id, num_results, rtt_results); + on_rtt_results_internal_callback = nullptr; + } +} + +// Callbacks for the various NAN operations. +// NOTE: These have very little conversions to perform before invoking the user +// callbacks. +// So, handle all of them here directly to avoid adding an unnecessary layer. +std::function on_nan_notify_response_user_callback; +void onAsyncNanNotifyResponse(transaction_id id, NanResponseMsg* msg) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_nan_notify_response_user_callback && msg) { + on_nan_notify_response_user_callback(id, *msg); + } +} + +std::function on_nan_event_publish_replied_user_callback; +void onAsyncNanEventPublishReplied(NanPublishRepliedInd* /* event */) { + LOG(ERROR) << "onAsyncNanEventPublishReplied triggered"; +} + +std::function on_nan_event_publish_terminated_user_callback; +void onAsyncNanEventPublishTerminated(NanPublishTerminatedInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_nan_event_publish_terminated_user_callback && event) { + on_nan_event_publish_terminated_user_callback(*event); + } +} + +std::function on_nan_event_match_user_callback; +void onAsyncNanEventMatch(NanMatchInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_nan_event_match_user_callback && event) { + on_nan_event_match_user_callback(*event); + } +} + +std::function on_nan_event_match_expired_user_callback; +void onAsyncNanEventMatchExpired(NanMatchExpiredInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_nan_event_match_expired_user_callback && event) { + on_nan_event_match_expired_user_callback(*event); + } +} + +std::function + on_nan_event_subscribe_terminated_user_callback; +void onAsyncNanEventSubscribeTerminated(NanSubscribeTerminatedInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_nan_event_subscribe_terminated_user_callback && event) { + on_nan_event_subscribe_terminated_user_callback(*event); + } +} + +std::function on_nan_event_followup_user_callback; +void onAsyncNanEventFollowup(NanFollowupInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_nan_event_followup_user_callback && event) { + on_nan_event_followup_user_callback(*event); + } +} + +std::function on_nan_event_disc_eng_event_user_callback; +void onAsyncNanEventDiscEngEvent(NanDiscEngEventInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_nan_event_disc_eng_event_user_callback && event) { + on_nan_event_disc_eng_event_user_callback(*event); + } +} + +std::function on_nan_event_disabled_user_callback; +void onAsyncNanEventDisabled(NanDisabledInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_nan_event_disabled_user_callback && event) { + on_nan_event_disabled_user_callback(*event); + } +} + +std::function on_nan_event_tca_user_callback; +void onAsyncNanEventTca(NanTCAInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_nan_event_tca_user_callback && event) { + on_nan_event_tca_user_callback(*event); + } +} + +std::function on_nan_event_beacon_sdf_payload_user_callback; +void onAsyncNanEventBeaconSdfPayload(NanBeaconSdfPayloadInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_nan_event_beacon_sdf_payload_user_callback && event) { + on_nan_event_beacon_sdf_payload_user_callback(*event); + } +} + +std::function on_nan_event_data_path_request_user_callback; +void onAsyncNanEventDataPathRequest(NanDataPathRequestInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_nan_event_data_path_request_user_callback && event) { + on_nan_event_data_path_request_user_callback(*event); + } +} +std::function on_nan_event_data_path_confirm_user_callback; +void onAsyncNanEventDataPathConfirm(NanDataPathConfirmInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_nan_event_data_path_confirm_user_callback && event) { + on_nan_event_data_path_confirm_user_callback(*event); + } +} + +std::function on_nan_event_data_path_end_user_callback; +void onAsyncNanEventDataPathEnd(NanDataPathEndInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_nan_event_data_path_end_user_callback && event) { + on_nan_event_data_path_end_user_callback(*event); + } +} + +std::function on_nan_event_transmit_follow_up_user_callback; +void onAsyncNanEventTransmitFollowUp(NanTransmitFollowupInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_nan_event_transmit_follow_up_user_callback && event) { + on_nan_event_transmit_follow_up_user_callback(*event); + } +} + +std::function on_nan_event_range_request_user_callback; +void onAsyncNanEventRangeRequest(NanRangeRequestInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_nan_event_range_request_user_callback && event) { + on_nan_event_range_request_user_callback(*event); + } +} + +std::function on_nan_event_range_report_user_callback; +void onAsyncNanEventRangeReport(NanRangeReportInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_nan_event_range_report_user_callback && event) { + on_nan_event_range_report_user_callback(*event); + } +} + +std::function on_nan_event_schedule_update_user_callback; +void onAsyncNanEventScheduleUpdate(NanDataPathScheduleUpdateInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_nan_event_schedule_update_user_callback && event) { + on_nan_event_schedule_update_user_callback(*event); + } +} + +// Callbacks for the various TWT operations. +std::function on_twt_event_setup_response_callback; +void onAsyncTwtEventSetupResponse(TwtSetupResponse* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_twt_event_setup_response_callback && event) { + on_twt_event_setup_response_callback(*event); + } +} + +std::function on_twt_event_teardown_completion_callback; +void onAsyncTwtEventTeardownCompletion(TwtTeardownCompletion* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_twt_event_teardown_completion_callback && event) { + on_twt_event_teardown_completion_callback(*event); + } +} + +std::function on_twt_event_info_frame_received_callback; +void onAsyncTwtEventInfoFrameReceived(TwtInfoFrameReceived* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_twt_event_info_frame_received_callback && event) { + on_twt_event_info_frame_received_callback(*event); + } +} + +std::function on_twt_event_device_notify_callback; +void onAsyncTwtEventDeviceNotify(TwtDeviceNotify* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_twt_event_device_notify_callback && event) { + on_twt_event_device_notify_callback(*event); + } +} + +// Callback to report current CHRE NAN state +std::function on_chre_nan_rtt_internal_callback; +void onAsyncChreNanRttState(chre_nan_rtt_state state) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_chre_nan_rtt_internal_callback) { + on_chre_nan_rtt_internal_callback(state); + } +} + +// Callback to report cached scan results +std::function on_cached_scan_results_internal_callback; +void onSyncCachedScanResults(wifi_cached_scan_report* cache_report) { + if (on_cached_scan_results_internal_callback) { + on_cached_scan_results_internal_callback(cache_report); + } +} + +// End of the free-standing "C" style callbacks. + +WifiLegacyHal::WifiLegacyHal(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, + const wifi_hal_fn& fn, bool is_primary) + : global_func_table_(fn), + global_handle_(nullptr), + awaiting_event_loop_termination_(false), + is_started_(false), + iface_tool_(iface_tool), + is_primary_(is_primary) {} + +wifi_error WifiLegacyHal::initialize() { + LOG(DEBUG) << "Initialize legacy HAL"; + // this now does nothing, since HAL function table is provided + // to the constructor + return WIFI_SUCCESS; +} + +wifi_error WifiLegacyHal::start() { + // Ensure that we're starting in a good state. + CHECK(global_func_table_.wifi_initialize && !global_handle_ && iface_name_to_handle_.empty() && + !awaiting_event_loop_termination_); + if (is_started_) { + LOG(DEBUG) << "Legacy HAL already started"; + return WIFI_SUCCESS; + } + LOG(DEBUG) << "Waiting for the driver ready"; + wifi_error status = global_func_table_.wifi_wait_for_driver_ready(); + if (status == WIFI_ERROR_TIMED_OUT || status == WIFI_ERROR_UNKNOWN) { + LOG(ERROR) << "Failed or timed out awaiting driver ready"; + return status; + } + + if (is_primary_) { + property_set(kDriverPropName, "ok"); + + if (!iface_tool_.lock()->SetWifiUpState(true)) { + LOG(ERROR) << "Failed to set WiFi interface up"; + return WIFI_ERROR_UNKNOWN; + } + } + + LOG(DEBUG) << "Starting legacy HAL"; + status = global_func_table_.wifi_initialize(&global_handle_); + if (status != WIFI_SUCCESS || !global_handle_) { + LOG(ERROR) << "Failed to retrieve global handle"; + return status; + } + std::thread(&WifiLegacyHal::runEventLoop, this).detach(); + status = retrieveIfaceHandles(); + if (status != WIFI_SUCCESS || iface_name_to_handle_.empty()) { + LOG(ERROR) << "Failed to retrieve wlan interface handle"; + return status; + } + LOG(DEBUG) << "Legacy HAL start complete"; + is_started_ = true; + return WIFI_SUCCESS; +} + +wifi_error WifiLegacyHal::stop( + /* NONNULL */ std::unique_lock* lock, + const std::function& on_stop_complete_user_callback) { + if (!is_started_) { + LOG(DEBUG) << "Legacy HAL already stopped"; + on_stop_complete_user_callback(); + return WIFI_SUCCESS; + } + LOG(DEBUG) << "Stopping legacy HAL"; + on_stop_complete_internal_callback = [on_stop_complete_user_callback, + this](wifi_handle handle) { + CHECK_EQ(global_handle_, handle) << "Handle mismatch"; + LOG(INFO) << "Legacy HAL stop complete callback received"; + // Invalidate all the internal pointers now that the HAL is + // stopped. + invalidate(); + if (is_primary_) iface_tool_.lock()->SetWifiUpState(false); + on_stop_complete_user_callback(); + is_started_ = false; + }; + awaiting_event_loop_termination_ = true; + global_func_table_.wifi_cleanup(global_handle_, onAsyncStopComplete); + const auto status = + stop_wait_cv_.wait_for(*lock, std::chrono::milliseconds(kMaxStopCompleteWaitMs), + [this] { return !awaiting_event_loop_termination_; }); + if (!status) { + LOG(ERROR) << "Legacy HAL stop failed or timed out"; + return WIFI_ERROR_UNKNOWN; + } + LOG(DEBUG) << "Legacy HAL stop complete"; + return WIFI_SUCCESS; +} + +bool WifiLegacyHal::isStarted() { + return is_started_; +} + +wifi_error WifiLegacyHal::waitForDriverReady() { + return global_func_table_.wifi_wait_for_driver_ready(); +} + +std::pair WifiLegacyHal::getDriverVersion(const std::string& iface_name) { + std::array buffer; + buffer.fill(0); + wifi_error status = global_func_table_.wifi_get_driver_version(getIfaceHandle(iface_name), + buffer.data(), buffer.size()); + return {status, buffer.data()}; +} + +std::pair WifiLegacyHal::getFirmwareVersion( + const std::string& iface_name) { + std::array buffer; + buffer.fill(0); + wifi_error status = global_func_table_.wifi_get_firmware_version(getIfaceHandle(iface_name), + buffer.data(), buffer.size()); + return {status, buffer.data()}; +} + +std::pair> WifiLegacyHal::requestDriverMemoryDump( + const std::string& iface_name) { + std::vector driver_dump; + on_driver_memory_dump_internal_callback = [&driver_dump](char* buffer, int buffer_size) { + driver_dump.insert(driver_dump.end(), reinterpret_cast(buffer), + reinterpret_cast(buffer) + buffer_size); + }; + wifi_error status = global_func_table_.wifi_get_driver_memory_dump(getIfaceHandle(iface_name), + {onSyncDriverMemoryDump}); + on_driver_memory_dump_internal_callback = nullptr; + return {status, std::move(driver_dump)}; +} + +std::pair> WifiLegacyHal::requestFirmwareMemoryDump( + const std::string& iface_name) { + std::vector firmware_dump; + on_firmware_memory_dump_internal_callback = [&firmware_dump](char* buffer, int buffer_size) { + firmware_dump.insert(firmware_dump.end(), reinterpret_cast(buffer), + reinterpret_cast(buffer) + buffer_size); + }; + wifi_error status = global_func_table_.wifi_get_firmware_memory_dump( + getIfaceHandle(iface_name), {onSyncFirmwareMemoryDump}); + on_firmware_memory_dump_internal_callback = nullptr; + return {status, std::move(firmware_dump)}; +} + +std::pair WifiLegacyHal::getSupportedFeatureSet( + const std::string& iface_name) { + feature_set set = 0, chip_set = 0; + wifi_error status = WIFI_SUCCESS; + + static_assert(sizeof(set) == sizeof(uint64_t), + "Some feature_flags can not be represented in output"); + wifi_interface_handle iface_handle = getIfaceHandle(iface_name); + + global_func_table_.wifi_get_chip_feature_set( + global_handle_, &chip_set); /* ignore error, chip_set will stay 0 */ + + if (iface_handle) { + status = global_func_table_.wifi_get_supported_feature_set(iface_handle, &set); + } + return {status, static_cast(set | chip_set)}; +} + +std::pair WifiLegacyHal::getPacketFilterCapabilities( + const std::string& iface_name) { + PacketFilterCapabilities caps; + wifi_error status = global_func_table_.wifi_get_packet_filter_capabilities( + getIfaceHandle(iface_name), &caps.version, &caps.max_len); + return {status, caps}; +} + +wifi_error WifiLegacyHal::setPacketFilter(const std::string& iface_name, + const std::vector& program) { + return global_func_table_.wifi_set_packet_filter(getIfaceHandle(iface_name), program.data(), + program.size()); +} + +std::pair> WifiLegacyHal::readApfPacketFilterData( + const std::string& iface_name) { + PacketFilterCapabilities caps; + wifi_error status = global_func_table_.wifi_get_packet_filter_capabilities( + getIfaceHandle(iface_name), &caps.version, &caps.max_len); + if (status != WIFI_SUCCESS) { + return {status, {}}; + } + + // Size the buffer to read the entire program & work memory. + std::vector buffer(caps.max_len); + + status = global_func_table_.wifi_read_packet_filter( + getIfaceHandle(iface_name), /*src_offset=*/0, buffer.data(), buffer.size()); + return {status, std::move(buffer)}; +} + +std::pair WifiLegacyHal::getGscanCapabilities( + const std::string& iface_name) { + wifi_gscan_capabilities caps; + wifi_error status = + global_func_table_.wifi_get_gscan_capabilities(getIfaceHandle(iface_name), &caps); + return {status, caps}; +} + +wifi_error WifiLegacyHal::startGscan( + const std::string& iface_name, wifi_request_id id, const wifi_scan_cmd_params& params, + const std::function& on_failure_user_callback, + const on_gscan_results_callback& on_results_user_callback, + const on_gscan_full_result_callback& on_full_result_user_callback) { + // If there is already an ongoing background scan, reject new scan requests. + if (on_gscan_event_internal_callback || on_gscan_full_result_internal_callback) { + return WIFI_ERROR_NOT_AVAILABLE; + } + + // This callback will be used to either trigger |on_results_user_callback| + // or |on_failure_user_callback|. + on_gscan_event_internal_callback = [iface_name, on_failure_user_callback, + on_results_user_callback, + this](wifi_request_id id, wifi_scan_event event) { + switch (event) { + case WIFI_SCAN_RESULTS_AVAILABLE: + case WIFI_SCAN_THRESHOLD_NUM_SCANS: + case WIFI_SCAN_THRESHOLD_PERCENT: { + wifi_error status; + std::vector cached_scan_results; + std::tie(status, cached_scan_results) = getGscanCachedResults(iface_name); + if (status == WIFI_SUCCESS) { + on_results_user_callback(id, cached_scan_results); + return; + } + FALLTHROUGH_INTENDED; + } + // Fall through if failed. Failure to retrieve cached scan + // results should trigger a background scan failure. + case WIFI_SCAN_FAILED: + on_failure_user_callback(id); + on_gscan_event_internal_callback = nullptr; + on_gscan_full_result_internal_callback = nullptr; + return; + } + LOG(FATAL) << "Unexpected gscan event received: " << event; + }; + + on_gscan_full_result_internal_callback = [on_full_result_user_callback]( + wifi_request_id id, wifi_scan_result* result, + uint32_t buckets_scanned) { + if (result) { + on_full_result_user_callback(id, result, buckets_scanned); + } + }; + + wifi_scan_result_handler handler = {onAsyncGscanFullResult, onAsyncGscanEvent}; + wifi_error status = + global_func_table_.wifi_start_gscan(id, getIfaceHandle(iface_name), params, handler); + if (status != WIFI_SUCCESS) { + on_gscan_event_internal_callback = nullptr; + on_gscan_full_result_internal_callback = nullptr; + } + return status; +} + +wifi_error WifiLegacyHal::stopGscan(const std::string& iface_name, wifi_request_id id) { + // If there is no an ongoing background scan, reject stop requests. + // TODO(b/32337212): This needs to be handled by the HIDL object because we + // need to return the NOT_STARTED error code. + if (!on_gscan_event_internal_callback && !on_gscan_full_result_internal_callback) { + return WIFI_ERROR_NOT_AVAILABLE; + } + wifi_error status = global_func_table_.wifi_stop_gscan(id, getIfaceHandle(iface_name)); + // If the request Id is wrong, don't stop the ongoing background scan. Any + // other error should be treated as the end of background scan. + if (status != WIFI_ERROR_INVALID_REQUEST_ID) { + on_gscan_event_internal_callback = nullptr; + on_gscan_full_result_internal_callback = nullptr; + } + return status; +} + +std::pair> WifiLegacyHal::getValidFrequenciesForBand( + const std::string& iface_name, wifi_band band) { + static_assert(sizeof(uint32_t) >= sizeof(wifi_channel), + "Wifi Channel cannot be represented in output"); + std::vector freqs; + freqs.resize(kMaxGscanFrequenciesForBand); + int32_t num_freqs = 0; + wifi_error status = global_func_table_.wifi_get_valid_channels( + getIfaceHandle(iface_name), band, freqs.size(), + reinterpret_cast(freqs.data()), &num_freqs); + CHECK(num_freqs >= 0 && static_cast(num_freqs) <= kMaxGscanFrequenciesForBand); + freqs.resize(num_freqs); + return {status, std::move(freqs)}; +} + +wifi_error WifiLegacyHal::setDfsFlag(const std::string& iface_name, bool dfs_on) { + return global_func_table_.wifi_set_nodfs_flag(getIfaceHandle(iface_name), dfs_on ? 0 : 1); +} + +wifi_error WifiLegacyHal::enableLinkLayerStats(const std::string& iface_name, bool debug) { + wifi_link_layer_params params; + params.mpdu_size_threshold = kLinkLayerStatsDataMpduSizeThreshold; + params.aggressive_statistics_gathering = debug; + return global_func_table_.wifi_set_link_stats(getIfaceHandle(iface_name), params); +} + +wifi_error WifiLegacyHal::disableLinkLayerStats(const std::string& iface_name) { + // TODO: Do we care about these responses? + uint32_t clear_mask_rsp; + uint8_t stop_rsp; + return global_func_table_.wifi_clear_link_stats(getIfaceHandle(iface_name), 0xFFFFFFFF, + &clear_mask_rsp, 1, &stop_rsp); +} + +std::pair WifiLegacyHal::getLinkLayerStats( + const std::string& iface_name) { + LinkLayerStats link_stats{}; + LinkLayerStats* link_stats_ptr = &link_stats; + + on_link_layer_stats_result_internal_callback = [&link_stats_ptr]( + wifi_request_id /* id */, + wifi_iface_stat* iface_stats_ptr, + int num_radios, + wifi_radio_stat* radio_stats_ptr) { + wifi_radio_stat* l_radio_stats_ptr; + wifi_peer_info* l_peer_info_stats_ptr; + + if (iface_stats_ptr != nullptr) { + link_stats_ptr->iface = *iface_stats_ptr; + l_peer_info_stats_ptr = iface_stats_ptr->peer_info; + for (uint32_t i = 0; i < iface_stats_ptr->num_peers; i++) { + WifiPeerInfo peer; + peer.peer_info = *l_peer_info_stats_ptr; + if (l_peer_info_stats_ptr->num_rate > 0) { + /* Copy the rate stats */ + peer.rate_stats.assign( + l_peer_info_stats_ptr->rate_stats, + l_peer_info_stats_ptr->rate_stats + l_peer_info_stats_ptr->num_rate); + } + peer.peer_info.num_rate = 0; + link_stats_ptr->peers.push_back(peer); + l_peer_info_stats_ptr = + (wifi_peer_info*)((u8*)l_peer_info_stats_ptr + sizeof(wifi_peer_info) + + (sizeof(wifi_rate_stat) * + l_peer_info_stats_ptr->num_rate)); + } + link_stats_ptr->iface.num_peers = 0; + } else { + LOG(ERROR) << "Invalid iface stats in link layer stats"; + } + if (num_radios <= 0 || radio_stats_ptr == nullptr) { + LOG(ERROR) << "Invalid radio stats in link layer stats"; + return; + } + l_radio_stats_ptr = radio_stats_ptr; + for (int i = 0; i < num_radios; i++) { + LinkLayerRadioStats radio; + + radio.stats = *l_radio_stats_ptr; + // Copy over the tx level array to the separate vector. + if (l_radio_stats_ptr->num_tx_levels > 0 && + l_radio_stats_ptr->tx_time_per_levels != nullptr) { + radio.tx_time_per_levels.assign( + l_radio_stats_ptr->tx_time_per_levels, + l_radio_stats_ptr->tx_time_per_levels + l_radio_stats_ptr->num_tx_levels); + } + radio.stats.num_tx_levels = 0; + radio.stats.tx_time_per_levels = nullptr; + /* Copy over the channel stat to separate vector */ + if (l_radio_stats_ptr->num_channels > 0) { + /* Copy the channel stats */ + radio.channel_stats.assign( + l_radio_stats_ptr->channels, + l_radio_stats_ptr->channels + l_radio_stats_ptr->num_channels); + } + link_stats_ptr->radios.push_back(radio); + l_radio_stats_ptr = + (wifi_radio_stat*)((u8*)l_radio_stats_ptr + sizeof(wifi_radio_stat) + + (sizeof(wifi_channel_stat) * + l_radio_stats_ptr->num_channels)); + } + }; + + wifi_error status = global_func_table_.wifi_get_link_stats(0, getIfaceHandle(iface_name), + {onSyncLinkLayerStatsResult}); + on_link_layer_stats_result_internal_callback = nullptr; + return {status, link_stats}; +} + +wifi_error WifiLegacyHal::startRssiMonitoring( + const std::string& iface_name, wifi_request_id id, int8_t max_rssi, int8_t min_rssi, + const on_rssi_threshold_breached_callback& on_threshold_breached_user_callback) { + if (on_rssi_threshold_breached_internal_callback) { + return WIFI_ERROR_NOT_AVAILABLE; + } + on_rssi_threshold_breached_internal_callback = [on_threshold_breached_user_callback]( + wifi_request_id id, uint8_t* bssid_ptr, + int8_t rssi) { + if (!bssid_ptr) { + return; + } + std::array bssid_arr; + // |bssid_ptr| pointer is assumed to have 6 bytes for the mac + // address. + std::copy(bssid_ptr, bssid_ptr + 6, std::begin(bssid_arr)); + on_threshold_breached_user_callback(id, bssid_arr, rssi); + }; + wifi_error status = global_func_table_.wifi_start_rssi_monitoring( + id, getIfaceHandle(iface_name), max_rssi, min_rssi, {onAsyncRssiThresholdBreached}); + if (status != WIFI_SUCCESS) { + on_rssi_threshold_breached_internal_callback = nullptr; + } + return status; +} + +wifi_error WifiLegacyHal::stopRssiMonitoring(const std::string& iface_name, wifi_request_id id) { + if (!on_rssi_threshold_breached_internal_callback) { + return WIFI_ERROR_NOT_AVAILABLE; + } + wifi_error status = + global_func_table_.wifi_stop_rssi_monitoring(id, getIfaceHandle(iface_name)); + // If the request Id is wrong, don't stop the ongoing rssi monitoring. Any + // other error should be treated as the end of background scan. + if (status != WIFI_ERROR_INVALID_REQUEST_ID) { + on_rssi_threshold_breached_internal_callback = nullptr; + } + return status; +} + +std::pair WifiLegacyHal::getRoamingCapabilities( + const std::string& iface_name) { + wifi_roaming_capabilities caps; + wifi_error status = + global_func_table_.wifi_get_roaming_capabilities(getIfaceHandle(iface_name), &caps); + return {status, caps}; +} + +wifi_error WifiLegacyHal::configureRoaming(const std::string& iface_name, + const wifi_roaming_config& config) { + wifi_roaming_config config_internal = config; + return global_func_table_.wifi_configure_roaming(getIfaceHandle(iface_name), &config_internal); +} + +wifi_error WifiLegacyHal::enableFirmwareRoaming(const std::string& iface_name, + fw_roaming_state_t state) { + return global_func_table_.wifi_enable_firmware_roaming(getIfaceHandle(iface_name), state); +} + +wifi_error WifiLegacyHal::configureNdOffload(const std::string& iface_name, bool enable) { + return global_func_table_.wifi_configure_nd_offload(getIfaceHandle(iface_name), enable); +} + +wifi_error WifiLegacyHal::startSendingOffloadedPacket(const std::string& iface_name, int32_t cmd_id, + uint16_t ether_type, + const std::vector& ip_packet_data, + const std::array& src_address, + const std::array& dst_address, + int32_t period_in_ms) { + std::vector ip_packet_data_internal(ip_packet_data); + std::vector src_address_internal(src_address.data(), + src_address.data() + src_address.size()); + std::vector dst_address_internal(dst_address.data(), + dst_address.data() + dst_address.size()); + return global_func_table_.wifi_start_sending_offloaded_packet( + cmd_id, getIfaceHandle(iface_name), ether_type, ip_packet_data_internal.data(), + ip_packet_data_internal.size(), src_address_internal.data(), + dst_address_internal.data(), period_in_ms); +} + +wifi_error WifiLegacyHal::stopSendingOffloadedPacket(const std::string& iface_name, + uint32_t cmd_id) { + return global_func_table_.wifi_stop_sending_offloaded_packet(cmd_id, + getIfaceHandle(iface_name)); +} + +wifi_error WifiLegacyHal::selectTxPowerScenario(const std::string& iface_name, + wifi_power_scenario scenario) { + return global_func_table_.wifi_select_tx_power_scenario(getIfaceHandle(iface_name), scenario); +} + +wifi_error WifiLegacyHal::resetTxPowerScenario(const std::string& iface_name) { + return global_func_table_.wifi_reset_tx_power_scenario(getIfaceHandle(iface_name)); +} + +wifi_error WifiLegacyHal::setLatencyMode(const std::string& iface_name, wifi_latency_mode mode) { + return global_func_table_.wifi_set_latency_mode(getIfaceHandle(iface_name), mode); +} + +wifi_error WifiLegacyHal::setThermalMitigationMode(wifi_thermal_mode mode, + uint32_t completion_window) { + return global_func_table_.wifi_set_thermal_mitigation_mode(global_handle_, mode, + completion_window); +} + +wifi_error WifiLegacyHal::setDscpToAccessCategoryMapping(uint32_t start, uint32_t end, + uint32_t access_category) { + return global_func_table_.wifi_map_dscp_access_category(global_handle_, start, end, + access_category); +} + +wifi_error WifiLegacyHal::resetDscpToAccessCategoryMapping() { + return global_func_table_.wifi_reset_dscp_mapping(global_handle_); +} + +std::pair WifiLegacyHal::getLoggerSupportedFeatureSet( + const std::string& iface_name) { + uint32_t supported_feature_flags = 0; + wifi_error status = WIFI_SUCCESS; + + wifi_interface_handle iface_handle = getIfaceHandle(iface_name); + + if (iface_handle) { + status = global_func_table_.wifi_get_logger_supported_feature_set(iface_handle, + &supported_feature_flags); + } + return {status, supported_feature_flags}; +} + +wifi_error WifiLegacyHal::startPktFateMonitoring(const std::string& iface_name) { + return global_func_table_.wifi_start_pkt_fate_monitoring(getIfaceHandle(iface_name)); +} + +std::pair> WifiLegacyHal::getTxPktFates( + const std::string& iface_name) { + std::vector tx_pkt_fates; + tx_pkt_fates.resize(MAX_FATE_LOG_LEN); + size_t num_fates = 0; + wifi_error status = global_func_table_.wifi_get_tx_pkt_fates( + getIfaceHandle(iface_name), tx_pkt_fates.data(), tx_pkt_fates.size(), &num_fates); + CHECK(num_fates <= MAX_FATE_LOG_LEN); + tx_pkt_fates.resize(num_fates); + return {status, std::move(tx_pkt_fates)}; +} + +std::pair> WifiLegacyHal::getRxPktFates( + const std::string& iface_name) { + std::vector rx_pkt_fates; + rx_pkt_fates.resize(MAX_FATE_LOG_LEN); + size_t num_fates = 0; + wifi_error status = global_func_table_.wifi_get_rx_pkt_fates( + getIfaceHandle(iface_name), rx_pkt_fates.data(), rx_pkt_fates.size(), &num_fates); + CHECK(num_fates <= MAX_FATE_LOG_LEN); + rx_pkt_fates.resize(num_fates); + return {status, std::move(rx_pkt_fates)}; +} + +std::pair WifiLegacyHal::getWakeReasonStats( + const std::string& iface_name) { + WakeReasonStats stats; + stats.cmd_event_wake_cnt.resize(kMaxWakeReasonStatsArraySize); + stats.driver_fw_local_wake_cnt.resize(kMaxWakeReasonStatsArraySize); + + // This legacy struct needs separate memory to store the variable sized wake + // reason types. + stats.wake_reason_cnt.cmd_event_wake_cnt = + reinterpret_cast(stats.cmd_event_wake_cnt.data()); + stats.wake_reason_cnt.cmd_event_wake_cnt_sz = stats.cmd_event_wake_cnt.size(); + stats.wake_reason_cnt.cmd_event_wake_cnt_used = 0; + stats.wake_reason_cnt.driver_fw_local_wake_cnt = + reinterpret_cast(stats.driver_fw_local_wake_cnt.data()); + stats.wake_reason_cnt.driver_fw_local_wake_cnt_sz = stats.driver_fw_local_wake_cnt.size(); + stats.wake_reason_cnt.driver_fw_local_wake_cnt_used = 0; + + wifi_error status = global_func_table_.wifi_get_wake_reason_stats(getIfaceHandle(iface_name), + &stats.wake_reason_cnt); + + CHECK(stats.wake_reason_cnt.cmd_event_wake_cnt_used >= 0 && + static_cast(stats.wake_reason_cnt.cmd_event_wake_cnt_used) <= + kMaxWakeReasonStatsArraySize); + stats.cmd_event_wake_cnt.resize(stats.wake_reason_cnt.cmd_event_wake_cnt_used); + stats.wake_reason_cnt.cmd_event_wake_cnt = nullptr; + + CHECK(stats.wake_reason_cnt.driver_fw_local_wake_cnt_used >= 0 && + static_cast(stats.wake_reason_cnt.driver_fw_local_wake_cnt_used) <= + kMaxWakeReasonStatsArraySize); + stats.driver_fw_local_wake_cnt.resize(stats.wake_reason_cnt.driver_fw_local_wake_cnt_used); + stats.wake_reason_cnt.driver_fw_local_wake_cnt = nullptr; + + return {status, stats}; +} + +wifi_error WifiLegacyHal::registerRingBufferCallbackHandler( + const std::string& iface_name, const on_ring_buffer_data_callback& on_user_data_callback) { + if (on_ring_buffer_data_internal_callback) { + return WIFI_ERROR_NOT_AVAILABLE; + } + on_ring_buffer_data_internal_callback = [on_user_data_callback]( + char* ring_name, char* buffer, int buffer_size, + wifi_ring_buffer_status* status) { + if (status && buffer) { + std::vector buffer_vector(reinterpret_cast(buffer), + reinterpret_cast(buffer) + buffer_size); + on_user_data_callback(ring_name, buffer_vector, *status); + } + }; + wifi_error status = global_func_table_.wifi_set_log_handler(0, getIfaceHandle(iface_name), + {onAsyncRingBufferData}); + if (status != WIFI_SUCCESS) { + on_ring_buffer_data_internal_callback = nullptr; + } + return status; +} + +wifi_error WifiLegacyHal::deregisterRingBufferCallbackHandler(const std::string& iface_name) { + if (!on_ring_buffer_data_internal_callback) { + return WIFI_ERROR_NOT_AVAILABLE; + } + on_ring_buffer_data_internal_callback = nullptr; + return global_func_table_.wifi_reset_log_handler(0, getIfaceHandle(iface_name)); +} + +std::pair> WifiLegacyHal::getRingBuffersStatus( + const std::string& iface_name) { + std::vector ring_buffers_status; + ring_buffers_status.resize(kMaxRingBuffers); + uint32_t num_rings = kMaxRingBuffers; + wifi_error status = global_func_table_.wifi_get_ring_buffers_status( + getIfaceHandle(iface_name), &num_rings, ring_buffers_status.data()); + CHECK(num_rings <= kMaxRingBuffers); + ring_buffers_status.resize(num_rings); + return {status, std::move(ring_buffers_status)}; +} + +wifi_error WifiLegacyHal::startRingBufferLogging(const std::string& iface_name, + const std::string& ring_name, + uint32_t verbose_level, uint32_t max_interval_sec, + uint32_t min_data_size) { + return global_func_table_.wifi_start_logging(getIfaceHandle(iface_name), verbose_level, 0, + max_interval_sec, min_data_size, + makeCharVec(ring_name).data()); +} + +wifi_error WifiLegacyHal::getRingBufferData(const std::string& iface_name, + const std::string& ring_name) { + return global_func_table_.wifi_get_ring_data(getIfaceHandle(iface_name), + makeCharVec(ring_name).data()); +} + +wifi_error WifiLegacyHal::registerErrorAlertCallbackHandler( + const std::string& iface_name, const on_error_alert_callback& on_user_alert_callback) { + if (on_error_alert_internal_callback) { + return WIFI_ERROR_NOT_AVAILABLE; + } + on_error_alert_internal_callback = [on_user_alert_callback](wifi_request_id id, char* buffer, + int buffer_size, int err_code) { + if (buffer) { + CHECK(id == 0); + on_user_alert_callback( + err_code, + std::vector(reinterpret_cast(buffer), + reinterpret_cast(buffer) + buffer_size)); + } + }; + wifi_error status = global_func_table_.wifi_set_alert_handler(0, getIfaceHandle(iface_name), + {onAsyncErrorAlert}); + if (status != WIFI_SUCCESS) { + on_error_alert_internal_callback = nullptr; + } + return status; +} + +wifi_error WifiLegacyHal::deregisterErrorAlertCallbackHandler(const std::string& iface_name) { + if (!on_error_alert_internal_callback) { + return WIFI_ERROR_NOT_AVAILABLE; + } + on_error_alert_internal_callback = nullptr; + return global_func_table_.wifi_reset_alert_handler(0, getIfaceHandle(iface_name)); +} + +wifi_error WifiLegacyHal::registerRadioModeChangeCallbackHandler( + const std::string& iface_name, + const on_radio_mode_change_callback& on_user_change_callback) { + if (on_radio_mode_change_internal_callback) { + return WIFI_ERROR_NOT_AVAILABLE; + } + on_radio_mode_change_internal_callback = [on_user_change_callback]( + wifi_request_id /* id */, uint32_t num_macs, + wifi_mac_info* mac_infos_arr) { + if (num_macs > 0 && mac_infos_arr) { + std::vector mac_infos_vec; + for (uint32_t i = 0; i < num_macs; i++) { + WifiMacInfo mac_info; + mac_info.wlan_mac_id = mac_infos_arr[i].wlan_mac_id; + mac_info.mac_band = mac_infos_arr[i].mac_band; + for (int32_t j = 0; j < mac_infos_arr[i].num_iface; j++) { + WifiIfaceInfo iface_info; + iface_info.name = mac_infos_arr[i].iface_info[j].iface_name; + iface_info.channel = mac_infos_arr[i].iface_info[j].channel; + mac_info.iface_infos.push_back(iface_info); + } + mac_infos_vec.push_back(mac_info); + } + on_user_change_callback(mac_infos_vec); + } + }; + wifi_error status = global_func_table_.wifi_set_radio_mode_change_handler( + 0, getIfaceHandle(iface_name), {onAsyncRadioModeChange}); + if (status != WIFI_SUCCESS) { + on_radio_mode_change_internal_callback = nullptr; + } + return status; +} + +wifi_error WifiLegacyHal::registerSubsystemRestartCallbackHandler( + const on_subsystem_restart_callback& on_restart_callback) { + if (on_subsystem_restart_internal_callback) { + return WIFI_ERROR_NOT_AVAILABLE; + } + on_subsystem_restart_internal_callback = [on_restart_callback](const char* error) { + on_restart_callback(error); + }; + wifi_error status = global_func_table_.wifi_set_subsystem_restart_handler( + global_handle_, {onAsyncSubsystemRestart}); + if (status != WIFI_SUCCESS) { + on_subsystem_restart_internal_callback = nullptr; + } + return status; +} + +wifi_error WifiLegacyHal::startRttRangeRequest( + const std::string& iface_name, wifi_request_id id, + const std::vector& rtt_configs, + const on_rtt_results_callback& on_results_user_callback) { + if (on_rtt_results_internal_callback) { + return WIFI_ERROR_NOT_AVAILABLE; + } + + on_rtt_results_internal_callback = [on_results_user_callback](wifi_request_id id, + unsigned num_results, + wifi_rtt_result* rtt_results[]) { + if (num_results > 0 && !rtt_results) { + LOG(ERROR) << "Unexpected nullptr in RTT results"; + return; + } + std::vector rtt_results_vec; + std::copy_if(rtt_results, rtt_results + num_results, back_inserter(rtt_results_vec), + [](wifi_rtt_result* rtt_result) { return rtt_result != nullptr; }); + on_results_user_callback(id, rtt_results_vec); + }; + + std::vector rtt_configs_internal(rtt_configs); + wifi_error status = global_func_table_.wifi_rtt_range_request( + id, getIfaceHandle(iface_name), rtt_configs.size(), rtt_configs_internal.data(), + {onAsyncRttResults}); + if (status != WIFI_SUCCESS) { + on_rtt_results_internal_callback = nullptr; + } + return status; +} + +wifi_error WifiLegacyHal::cancelRttRangeRequest( + const std::string& iface_name, wifi_request_id id, + const std::vector>& mac_addrs) { + if (!on_rtt_results_internal_callback) { + return WIFI_ERROR_NOT_AVAILABLE; + } + static_assert(sizeof(mac_addr) == sizeof(std::array), + "MAC address size mismatch"); + // TODO: How do we handle partial cancels (i.e only a subset of enabled mac + // addressed are cancelled). + std::vector> mac_addrs_internal(mac_addrs); + wifi_error status = global_func_table_.wifi_rtt_range_cancel( + id, getIfaceHandle(iface_name), mac_addrs.size(), + reinterpret_cast(mac_addrs_internal.data())); + // If the request Id is wrong, don't stop the ongoing range request. Any + // other error should be treated as the end of rtt ranging. + if (status != WIFI_ERROR_INVALID_REQUEST_ID) { + on_rtt_results_internal_callback = nullptr; + } + return status; +} + +std::pair WifiLegacyHal::getRttCapabilities( + const std::string& iface_name) { + wifi_rtt_capabilities rtt_caps; + wifi_error status = + global_func_table_.wifi_get_rtt_capabilities(getIfaceHandle(iface_name), &rtt_caps); + return {status, rtt_caps}; +} + +std::pair WifiLegacyHal::getRttResponderInfo( + const std::string& iface_name) { + wifi_rtt_responder rtt_responder; + wifi_error status = global_func_table_.wifi_rtt_get_responder_info(getIfaceHandle(iface_name), + &rtt_responder); + return {status, rtt_responder}; +} + +wifi_error WifiLegacyHal::enableRttResponder(const std::string& iface_name, wifi_request_id id, + const wifi_channel_info& channel_hint, + uint32_t max_duration_secs, + const wifi_rtt_responder& info) { + wifi_rtt_responder info_internal(info); + return global_func_table_.wifi_enable_responder(id, getIfaceHandle(iface_name), channel_hint, + max_duration_secs, &info_internal); +} + +wifi_error WifiLegacyHal::disableRttResponder(const std::string& iface_name, wifi_request_id id) { + return global_func_table_.wifi_disable_responder(id, getIfaceHandle(iface_name)); +} + +wifi_error WifiLegacyHal::setRttLci(const std::string& iface_name, wifi_request_id id, + const wifi_lci_information& info) { + wifi_lci_information info_internal(info); + return global_func_table_.wifi_set_lci(id, getIfaceHandle(iface_name), &info_internal); +} + +wifi_error WifiLegacyHal::setRttLcr(const std::string& iface_name, wifi_request_id id, + const wifi_lcr_information& info) { + wifi_lcr_information info_internal(info); + return global_func_table_.wifi_set_lcr(id, getIfaceHandle(iface_name), &info_internal); +} + +wifi_error WifiLegacyHal::nanRegisterCallbackHandlers(const std::string& iface_name, + const NanCallbackHandlers& user_callbacks) { + on_nan_notify_response_user_callback = user_callbacks.on_notify_response; + on_nan_event_publish_terminated_user_callback = user_callbacks.on_event_publish_terminated; + on_nan_event_match_user_callback = user_callbacks.on_event_match; + on_nan_event_match_expired_user_callback = user_callbacks.on_event_match_expired; + on_nan_event_subscribe_terminated_user_callback = user_callbacks.on_event_subscribe_terminated; + on_nan_event_followup_user_callback = user_callbacks.on_event_followup; + on_nan_event_disc_eng_event_user_callback = user_callbacks.on_event_disc_eng_event; + on_nan_event_disabled_user_callback = user_callbacks.on_event_disabled; + on_nan_event_tca_user_callback = user_callbacks.on_event_tca; + on_nan_event_beacon_sdf_payload_user_callback = user_callbacks.on_event_beacon_sdf_payload; + on_nan_event_data_path_request_user_callback = user_callbacks.on_event_data_path_request; + on_nan_event_data_path_confirm_user_callback = user_callbacks.on_event_data_path_confirm; + on_nan_event_data_path_end_user_callback = user_callbacks.on_event_data_path_end; + on_nan_event_transmit_follow_up_user_callback = user_callbacks.on_event_transmit_follow_up; + on_nan_event_range_request_user_callback = user_callbacks.on_event_range_request; + on_nan_event_range_report_user_callback = user_callbacks.on_event_range_report; + on_nan_event_schedule_update_user_callback = user_callbacks.on_event_schedule_update; + + return global_func_table_.wifi_nan_register_handler( + getIfaceHandle(iface_name), + {onAsyncNanNotifyResponse, onAsyncNanEventPublishReplied, + onAsyncNanEventPublishTerminated, onAsyncNanEventMatch, onAsyncNanEventMatchExpired, + onAsyncNanEventSubscribeTerminated, onAsyncNanEventFollowup, + onAsyncNanEventDiscEngEvent, onAsyncNanEventDisabled, onAsyncNanEventTca, + onAsyncNanEventBeaconSdfPayload, onAsyncNanEventDataPathRequest, + onAsyncNanEventDataPathConfirm, onAsyncNanEventDataPathEnd, + onAsyncNanEventTransmitFollowUp, onAsyncNanEventRangeRequest, + onAsyncNanEventRangeReport, onAsyncNanEventScheduleUpdate}); +} + +wifi_error WifiLegacyHal::nanEnableRequest(const std::string& iface_name, transaction_id id, + const NanEnableRequest& msg) { + NanEnableRequest msg_internal(msg); + return global_func_table_.wifi_nan_enable_request(id, getIfaceHandle(iface_name), + &msg_internal); +} + +wifi_error WifiLegacyHal::nanDisableRequest(const std::string& iface_name, transaction_id id) { + return global_func_table_.wifi_nan_disable_request(id, getIfaceHandle(iface_name)); +} + +wifi_error WifiLegacyHal::nanPublishRequest(const std::string& iface_name, transaction_id id, + const NanPublishRequest& msg) { + NanPublishRequest msg_internal(msg); + return global_func_table_.wifi_nan_publish_request(id, getIfaceHandle(iface_name), + &msg_internal); +} + +wifi_error WifiLegacyHal::nanPublishCancelRequest(const std::string& iface_name, transaction_id id, + const NanPublishCancelRequest& msg) { + NanPublishCancelRequest msg_internal(msg); + return global_func_table_.wifi_nan_publish_cancel_request(id, getIfaceHandle(iface_name), + &msg_internal); +} + +wifi_error WifiLegacyHal::nanSubscribeRequest(const std::string& iface_name, transaction_id id, + const NanSubscribeRequest& msg) { + NanSubscribeRequest msg_internal(msg); + return global_func_table_.wifi_nan_subscribe_request(id, getIfaceHandle(iface_name), + &msg_internal); +} + +wifi_error WifiLegacyHal::nanSubscribeCancelRequest(const std::string& iface_name, + transaction_id id, + const NanSubscribeCancelRequest& msg) { + NanSubscribeCancelRequest msg_internal(msg); + return global_func_table_.wifi_nan_subscribe_cancel_request(id, getIfaceHandle(iface_name), + &msg_internal); +} + +wifi_error WifiLegacyHal::nanTransmitFollowupRequest(const std::string& iface_name, + transaction_id id, + const NanTransmitFollowupRequest& msg) { + NanTransmitFollowupRequest msg_internal(msg); + return global_func_table_.wifi_nan_transmit_followup_request(id, getIfaceHandle(iface_name), + &msg_internal); +} + +wifi_error WifiLegacyHal::nanStatsRequest(const std::string& iface_name, transaction_id id, + const NanStatsRequest& msg) { + NanStatsRequest msg_internal(msg); + return global_func_table_.wifi_nan_stats_request(id, getIfaceHandle(iface_name), &msg_internal); +} + +wifi_error WifiLegacyHal::nanConfigRequest(const std::string& iface_name, transaction_id id, + const NanConfigRequest& msg) { + NanConfigRequest msg_internal(msg); + return global_func_table_.wifi_nan_config_request(id, getIfaceHandle(iface_name), + &msg_internal); +} + +wifi_error WifiLegacyHal::nanTcaRequest(const std::string& iface_name, transaction_id id, + const NanTCARequest& msg) { + NanTCARequest msg_internal(msg); + return global_func_table_.wifi_nan_tca_request(id, getIfaceHandle(iface_name), &msg_internal); +} + +wifi_error WifiLegacyHal::nanBeaconSdfPayloadRequest(const std::string& iface_name, + transaction_id id, + const NanBeaconSdfPayloadRequest& msg) { + NanBeaconSdfPayloadRequest msg_internal(msg); + return global_func_table_.wifi_nan_beacon_sdf_payload_request(id, getIfaceHandle(iface_name), + &msg_internal); +} + +std::pair WifiLegacyHal::nanGetVersion() { + NanVersion version; + wifi_error status = global_func_table_.wifi_nan_get_version(global_handle_, &version); + return {status, version}; +} + +wifi_error WifiLegacyHal::nanGetCapabilities(const std::string& iface_name, transaction_id id) { + return global_func_table_.wifi_nan_get_capabilities(id, getIfaceHandle(iface_name)); +} + +wifi_error WifiLegacyHal::nanDataInterfaceCreate(const std::string& iface_name, transaction_id id, + const std::string& data_iface_name) { + return global_func_table_.wifi_nan_data_interface_create(id, getIfaceHandle(iface_name), + makeCharVec(data_iface_name).data()); +} + +wifi_error WifiLegacyHal::nanDataInterfaceDelete(const std::string& iface_name, transaction_id id, + const std::string& data_iface_name) { + return global_func_table_.wifi_nan_data_interface_delete(id, getIfaceHandle(iface_name), + makeCharVec(data_iface_name).data()); +} + +wifi_error WifiLegacyHal::nanDataRequestInitiator(const std::string& iface_name, transaction_id id, + const NanDataPathInitiatorRequest& msg) { + NanDataPathInitiatorRequest msg_internal(msg); + return global_func_table_.wifi_nan_data_request_initiator(id, getIfaceHandle(iface_name), + &msg_internal); +} + +wifi_error WifiLegacyHal::nanDataIndicationResponse(const std::string& iface_name, + transaction_id id, + const NanDataPathIndicationResponse& msg) { + NanDataPathIndicationResponse msg_internal(msg); + return global_func_table_.wifi_nan_data_indication_response(id, getIfaceHandle(iface_name), + &msg_internal); +} + +typedef struct { + u8 num_ndp_instances; + NanDataPathId ndp_instance_id; +} NanDataPathEndSingleNdpIdRequest; + +wifi_error WifiLegacyHal::nanDataEnd(const std::string& iface_name, transaction_id id, + uint32_t ndpInstanceId) { + NanDataPathEndSingleNdpIdRequest msg; + msg.num_ndp_instances = 1; + msg.ndp_instance_id = ndpInstanceId; + wifi_error status = global_func_table_.wifi_nan_data_end(id, getIfaceHandle(iface_name), + (NanDataPathEndRequest*)&msg); + return status; +} + +wifi_error WifiLegacyHal::setCountryCode(const std::string& iface_name, + const std::array code) { + std::string code_str(code.data(), code.data() + code.size()); + return global_func_table_.wifi_set_country_code(getIfaceHandle(iface_name), code_str.c_str()); +} + +wifi_error WifiLegacyHal::retrieveIfaceHandles() { + wifi_interface_handle* iface_handles = nullptr; + int num_iface_handles = 0; + wifi_error status = + global_func_table_.wifi_get_ifaces(global_handle_, &num_iface_handles, &iface_handles); + if (status != WIFI_SUCCESS) { + LOG(ERROR) << "Failed to enumerate interface handles"; + return status; + } + iface_name_to_handle_.clear(); + for (int i = 0; i < num_iface_handles; ++i) { + std::array iface_name_arr = {}; + status = global_func_table_.wifi_get_iface_name(iface_handles[i], iface_name_arr.data(), + iface_name_arr.size()); + if (status != WIFI_SUCCESS) { + LOG(WARNING) << "Failed to get interface handle name"; + continue; + } + // Assuming the interface name is null terminated since the legacy HAL + // API does not return a size. + std::string iface_name(iface_name_arr.data()); + LOG(INFO) << "Adding interface handle for " << iface_name; + iface_name_to_handle_[iface_name] = iface_handles[i]; + } + return WIFI_SUCCESS; +} + +wifi_interface_handle WifiLegacyHal::getIfaceHandle(const std::string& iface_name) { + const auto iface_handle_iter = iface_name_to_handle_.find(iface_name); + if (iface_handle_iter == iface_name_to_handle_.end()) { + LOG(ERROR) << "Unknown iface name: " << iface_name; + return nullptr; + } + return iface_handle_iter->second; +} + +void WifiLegacyHal::runEventLoop() { + LOG(DEBUG) << "Starting legacy HAL event loop"; + global_func_table_.wifi_event_loop(global_handle_); + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (!awaiting_event_loop_termination_) { + LOG(FATAL) << "Legacy HAL event loop terminated, but HAL was not stopping"; + } + LOG(DEBUG) << "Legacy HAL event loop terminated"; + awaiting_event_loop_termination_ = false; + stop_wait_cv_.notify_one(); +} + +std::pair> WifiLegacyHal::getGscanCachedResults( + const std::string& iface_name) { + std::vector cached_scan_results; + cached_scan_results.resize(kMaxCachedGscanResults); + int32_t num_results = 0; + wifi_error status = global_func_table_.wifi_get_cached_gscan_results( + getIfaceHandle(iface_name), true /* always flush */, cached_scan_results.size(), + cached_scan_results.data(), &num_results); + CHECK(num_results >= 0 && static_cast(num_results) <= kMaxCachedGscanResults); + cached_scan_results.resize(num_results); + // Check for invalid IE lengths in these cached scan results and correct it. + for (auto& cached_scan_result : cached_scan_results) { + int num_scan_results = cached_scan_result.num_results; + for (int i = 0; i < num_scan_results; i++) { + auto& scan_result = cached_scan_result.results[i]; + if (scan_result.ie_length > 0) { + LOG(DEBUG) << "Cached scan result has non-zero IE length " << scan_result.ie_length; + scan_result.ie_length = 0; + } + } + } + return {status, std::move(cached_scan_results)}; +} + +wifi_error WifiLegacyHal::createVirtualInterface(const std::string& ifname, + wifi_interface_type iftype) { + // Create the interface if it doesn't exist. If interface already exist, + // Vendor Hal should return WIFI_SUCCESS. + wifi_error status = global_func_table_.wifi_virtual_interface_create(global_handle_, + ifname.c_str(), iftype); + return handleVirtualInterfaceCreateOrDeleteStatus(ifname, status); +} + +wifi_error WifiLegacyHal::deleteVirtualInterface(const std::string& ifname) { + // Delete the interface if it was created dynamically. + wifi_error status = + global_func_table_.wifi_virtual_interface_delete(global_handle_, ifname.c_str()); + return handleVirtualInterfaceCreateOrDeleteStatus(ifname, status); +} + +wifi_error WifiLegacyHal::handleVirtualInterfaceCreateOrDeleteStatus(const std::string& ifname, + wifi_error status) { + if (status == WIFI_SUCCESS) { + // refresh list of handlers now. + status = retrieveIfaceHandles(); + } else if (status == WIFI_ERROR_NOT_SUPPORTED) { + // Vendor hal does not implement this API. Such vendor implementations + // are expected to create / delete interface by other means. + + // check if interface exists. + if (if_nametoindex(ifname.c_str())) { + status = retrieveIfaceHandles(); + } + } + return status; +} + +wifi_error WifiLegacyHal::getSupportedIfaceName(uint32_t iface_type, std::string& ifname) { + std::array buffer; + + wifi_error res = global_func_table_.wifi_get_supported_iface_name( + global_handle_, (uint32_t)iface_type, buffer.data(), buffer.size()); + if (res == WIFI_SUCCESS) ifname = buffer.data(); + + return res; +} + +wifi_error WifiLegacyHal::multiStaSetPrimaryConnection(const std::string& ifname) { + return global_func_table_.wifi_multi_sta_set_primary_connection(global_handle_, + getIfaceHandle(ifname)); +} + +wifi_error WifiLegacyHal::multiStaSetUseCase(wifi_multi_sta_use_case use_case) { + return global_func_table_.wifi_multi_sta_set_use_case(global_handle_, use_case); +} + +wifi_error WifiLegacyHal::setCoexUnsafeChannels( + std::vector unsafe_channels, uint32_t restrictions) { + return global_func_table_.wifi_set_coex_unsafe_channels(global_handle_, unsafe_channels.size(), + unsafe_channels.data(), restrictions); +} + +wifi_error WifiLegacyHal::setVoipMode(const std::string& iface_name, wifi_voip_mode mode) { + return global_func_table_.wifi_set_voip_mode(getIfaceHandle(iface_name), mode); +} + +wifi_error WifiLegacyHal::twtRegisterHandler(const std::string& iface_name, + const TwtCallbackHandlers& user_callbacks) { + on_twt_event_setup_response_callback = user_callbacks.on_setup_response; + on_twt_event_teardown_completion_callback = user_callbacks.on_teardown_completion; + on_twt_event_info_frame_received_callback = user_callbacks.on_info_frame_received; + on_twt_event_device_notify_callback = user_callbacks.on_device_notify; + + return global_func_table_.wifi_twt_register_handler( + getIfaceHandle(iface_name), + {onAsyncTwtEventSetupResponse, onAsyncTwtEventTeardownCompletion, + onAsyncTwtEventInfoFrameReceived, onAsyncTwtEventDeviceNotify}); +} + +std::pair WifiLegacyHal::twtGetCapability( + const std::string& iface_name) { + TwtCapabilitySet capSet; + wifi_error status = + global_func_table_.wifi_twt_get_capability(getIfaceHandle(iface_name), &capSet); + return {status, capSet}; +} + +wifi_error WifiLegacyHal::twtSetupRequest(const std::string& iface_name, + const TwtSetupRequest& msg) { + TwtSetupRequest msgInternal(msg); + return global_func_table_.wifi_twt_setup_request(getIfaceHandle(iface_name), &msgInternal); +} + +wifi_error WifiLegacyHal::twtTearDownRequest(const std::string& iface_name, + const TwtTeardownRequest& msg) { + TwtTeardownRequest msgInternal(msg); + return global_func_table_.wifi_twt_teardown_request(getIfaceHandle(iface_name), &msgInternal); +} + +wifi_error WifiLegacyHal::twtInfoFrameRequest(const std::string& iface_name, + const TwtInfoFrameRequest& msg) { + TwtInfoFrameRequest msgInternal(msg); + return global_func_table_.wifi_twt_info_frame_request(getIfaceHandle(iface_name), &msgInternal); +} + +std::pair WifiLegacyHal::twtGetStats(const std::string& iface_name, + uint8_t configId) { + TwtStats stats; + wifi_error status = + global_func_table_.wifi_twt_get_stats(getIfaceHandle(iface_name), configId, &stats); + return {status, stats}; +} + +wifi_error WifiLegacyHal::twtClearStats(const std::string& iface_name, uint8_t configId) { + return global_func_table_.wifi_twt_clear_stats(getIfaceHandle(iface_name), configId); +} + +wifi_error WifiLegacyHal::setDtimConfig(const std::string& iface_name, uint32_t multiplier) { + return global_func_table_.wifi_set_dtim_config(getIfaceHandle(iface_name), multiplier); +} + +std::pair> WifiLegacyHal::getUsableChannels( + uint32_t band_mask, uint32_t iface_mode_mask, uint32_t filter_mask) { + std::vector channels; + channels.resize(kMaxWifiUsableChannels); + uint32_t size = 0; + wifi_error status = global_func_table_.wifi_get_usable_channels( + global_handle_, band_mask, iface_mode_mask, filter_mask, channels.size(), &size, + reinterpret_cast(channels.data())); + CHECK(size >= 0 && size <= kMaxWifiUsableChannels); + channels.resize(size); + return {status, std::move(channels)}; +} + +wifi_error WifiLegacyHal::triggerSubsystemRestart() { + return global_func_table_.wifi_trigger_subsystem_restart(global_handle_); +} + +wifi_error WifiLegacyHal::setIndoorState(bool isIndoor) { + return global_func_table_.wifi_set_indoor_state(global_handle_, isIndoor); +} + +std::pair +WifiLegacyHal::getSupportedRadioCombinationsMatrix() { + char* buffer = new char[kMaxSupportedRadioCombinationsMatrixLength]; + std::fill(buffer, buffer + kMaxSupportedRadioCombinationsMatrixLength, 0); + uint32_t size = 0; + wifi_radio_combination_matrix* radio_combination_matrix_ptr = + reinterpret_cast(buffer); + wifi_error status = global_func_table_.wifi_get_supported_radio_combinations_matrix( + global_handle_, kMaxSupportedRadioCombinationsMatrixLength, &size, + radio_combination_matrix_ptr); + CHECK(size >= 0 && size <= kMaxSupportedRadioCombinationsMatrixLength); + return {status, radio_combination_matrix_ptr}; +} + +wifi_error WifiLegacyHal::chreNanRttRequest(const std::string& iface_name, bool enable) { + if (enable) + return global_func_table_.wifi_nan_rtt_chre_enable_request(0, getIfaceHandle(iface_name), + NULL); + else + return global_func_table_.wifi_nan_rtt_chre_disable_request(0, getIfaceHandle(iface_name)); +} + +wifi_error WifiLegacyHal::chreRegisterHandler(const std::string& iface_name, + const ChreCallbackHandlers& handler) { + if (on_chre_nan_rtt_internal_callback) { + return WIFI_ERROR_NOT_AVAILABLE; + } + + on_chre_nan_rtt_internal_callback = handler.on_wifi_chre_nan_rtt_state; + + wifi_error status = global_func_table_.wifi_chre_register_handler(getIfaceHandle(iface_name), + {onAsyncChreNanRttState}); + if (status != WIFI_SUCCESS) { + on_chre_nan_rtt_internal_callback = nullptr; + } + return status; +} + +wifi_error WifiLegacyHal::enableWifiTxPowerLimits(const std::string& iface_name, bool enable) { + return global_func_table_.wifi_enable_tx_power_limits(getIfaceHandle(iface_name), enable); +} + +wifi_error WifiLegacyHal::getWifiCachedScanResults( + const std::string& iface_name, const CachedScanResultsCallbackHandlers& handler) { + on_cached_scan_results_internal_callback = handler.on_cached_scan_results; + + wifi_error status = global_func_table_.wifi_get_cached_scan_results(getIfaceHandle(iface_name), + {onSyncCachedScanResults}); + + on_cached_scan_results_internal_callback = nullptr; + return status; +} + +void WifiLegacyHal::invalidate() { + global_handle_ = nullptr; + iface_name_to_handle_.clear(); + on_driver_memory_dump_internal_callback = nullptr; + on_firmware_memory_dump_internal_callback = nullptr; + on_gscan_event_internal_callback = nullptr; + on_gscan_full_result_internal_callback = nullptr; + on_link_layer_stats_result_internal_callback = nullptr; + on_rssi_threshold_breached_internal_callback = nullptr; + on_ring_buffer_data_internal_callback = nullptr; + on_error_alert_internal_callback = nullptr; + on_radio_mode_change_internal_callback = nullptr; + on_subsystem_restart_internal_callback = nullptr; + on_rtt_results_internal_callback = nullptr; + on_nan_notify_response_user_callback = nullptr; + on_nan_event_publish_terminated_user_callback = nullptr; + on_nan_event_match_user_callback = nullptr; + on_nan_event_match_expired_user_callback = nullptr; + on_nan_event_subscribe_terminated_user_callback = nullptr; + on_nan_event_followup_user_callback = nullptr; + on_nan_event_disc_eng_event_user_callback = nullptr; + on_nan_event_disabled_user_callback = nullptr; + on_nan_event_tca_user_callback = nullptr; + on_nan_event_beacon_sdf_payload_user_callback = nullptr; + on_nan_event_data_path_request_user_callback = nullptr; + on_nan_event_data_path_confirm_user_callback = nullptr; + on_nan_event_data_path_end_user_callback = nullptr; + on_nan_event_transmit_follow_up_user_callback = nullptr; + on_nan_event_range_request_user_callback = nullptr; + on_nan_event_range_report_user_callback = nullptr; + on_nan_event_schedule_update_user_callback = nullptr; + on_twt_event_setup_response_callback = nullptr; + on_twt_event_teardown_completion_callback = nullptr; + on_twt_event_info_frame_received_callback = nullptr; + on_twt_event_device_notify_callback = nullptr; + on_chre_nan_rtt_internal_callback = nullptr; +} + +} // namespace legacy_hal +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/wifi_legacy_hal.h b/wifi/aidl/default/wifi_legacy_hal.h new file mode 100644 index 0000000000..cd8c0b1136 --- /dev/null +++ b/wifi/aidl/default/wifi_legacy_hal.h @@ -0,0 +1,738 @@ +/* + * 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. + */ + +#ifndef WIFI_LEGACY_HAL_H_ +#define WIFI_LEGACY_HAL_H_ + +#include +#include + +#include +#include +#include +#include +#include +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +// This is in a separate namespace to prevent typename conflicts between +// the legacy HAL types and the AIDL interface types. +namespace legacy_hal { +// Import all the types defined inside the legacy HAL header files into this +// namespace. +using ::chre_nan_rtt_state; +using ::frame_info; +using ::frame_type; +using ::FRAME_TYPE_80211_MGMT; +using ::FRAME_TYPE_ETHERNET_II; +using ::FRAME_TYPE_UNKNOWN; +using ::fw_roaming_state_t; +using ::mac_addr; +using ::NAN_CHANNEL_24G_BAND; +using ::NAN_CHANNEL_5G_BAND_HIGH; +using ::NAN_CHANNEL_5G_BAND_LOW; +using ::NAN_DISABLE_RANGE_REPORT; +using ::NAN_DO_NOT_USE_SRF; +using ::NAN_DP_CHANNEL_NOT_REQUESTED; +using ::NAN_DP_CONFIG_NO_SECURITY; +using ::NAN_DP_CONFIG_SECURITY; +using ::NAN_DP_END; +using ::NAN_DP_FORCE_CHANNEL_SETUP; +using ::NAN_DP_INITIATOR_RESPONSE; +using ::NAN_DP_INTERFACE_CREATE; +using ::NAN_DP_INTERFACE_DELETE; +using ::NAN_DP_REQUEST_ACCEPT; +using ::NAN_DP_REQUEST_CHANNEL_SETUP; +using ::NAN_DP_REQUEST_REJECT; +using ::NAN_DP_RESPONDER_RESPONSE; +using ::NAN_GET_CAPABILITIES; +using ::NAN_MATCH_ALG_MATCH_CONTINUOUS; +using ::NAN_MATCH_ALG_MATCH_NEVER; +using ::NAN_MATCH_ALG_MATCH_ONCE; +using ::NAN_PUBLISH_TYPE_SOLICITED; +using ::NAN_PUBLISH_TYPE_UNSOLICITED; +using ::NAN_PUBLISH_TYPE_UNSOLICITED_SOLICITED; +using ::NAN_RANGING_AUTO_RESPONSE_DISABLE; +using ::NAN_RANGING_AUTO_RESPONSE_ENABLE; +using ::NAN_RANGING_DISABLE; +using ::NAN_RANGING_ENABLE; +using ::NAN_RESPONSE_BEACON_SDF_PAYLOAD; +using ::NAN_RESPONSE_CONFIG; +using ::NAN_RESPONSE_DISABLED; +using ::NAN_RESPONSE_ENABLED; +using ::NAN_RESPONSE_ERROR; +using ::NAN_RESPONSE_PUBLISH; +using ::NAN_RESPONSE_PUBLISH_CANCEL; +using ::NAN_RESPONSE_STATS; +using ::NAN_RESPONSE_SUBSCRIBE; +using ::NAN_RESPONSE_SUBSCRIBE_CANCEL; +using ::NAN_RESPONSE_TCA; +using ::NAN_RESPONSE_TRANSMIT_FOLLOWUP; +using ::NAN_SECURITY_KEY_INPUT_PASSPHRASE; +using ::NAN_SECURITY_KEY_INPUT_PMK; +using ::NAN_SERVICE_ACCEPT_POLICY_ALL; +using ::NAN_SERVICE_ACCEPT_POLICY_NONE; +using ::NAN_SRF_ATTR_BLOOM_FILTER; +using ::NAN_SRF_ATTR_PARTIAL_MAC_ADDR; +using ::NAN_SRF_INCLUDE_DO_NOT_RESPOND; +using ::NAN_SRF_INCLUDE_RESPOND; +using ::NAN_SSI_NOT_REQUIRED_IN_MATCH_IND; +using ::NAN_SSI_REQUIRED_IN_MATCH_IND; +using ::NAN_STATUS_ALREADY_ENABLED; +using ::NAN_STATUS_FOLLOWUP_QUEUE_FULL; +using ::NAN_STATUS_INTERNAL_FAILURE; +using ::NAN_STATUS_INVALID_NDP_ID; +using ::NAN_STATUS_INVALID_PARAM; +using ::NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID; +using ::NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID; +using ::NAN_STATUS_NAN_NOT_ALLOWED; +using ::NAN_STATUS_NO_OTA_ACK; +using ::NAN_STATUS_NO_RESOURCE_AVAILABLE; +using ::NAN_STATUS_PROTOCOL_FAILURE; +using ::NAN_STATUS_SUCCESS; +using ::NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED; +using ::NAN_SUBSCRIBE_TYPE_ACTIVE; +using ::NAN_SUBSCRIBE_TYPE_PASSIVE; +using ::NAN_TRANSMIT_IN_DW; +using ::NAN_TRANSMIT_IN_FAW; +using ::NAN_TX_PRIORITY_HIGH; +using ::NAN_TX_PRIORITY_NORMAL; +using ::NAN_TX_TYPE_BROADCAST; +using ::NAN_TX_TYPE_UNICAST; +using ::NAN_USE_SRF; +using ::NanBeaconSdfPayloadInd; +using ::NanCapabilities; +using ::NanChannelInfo; +using ::NanConfigRequest; +using ::NanDataPathChannelCfg; +using ::NanDataPathConfirmInd; +using ::NanDataPathEndInd; +using ::NanDataPathIndicationResponse; +using ::NanDataPathInitiatorRequest; +using ::NanDataPathRequestInd; +using ::NanDataPathScheduleUpdateInd; +using ::NanDisabledInd; +using ::NanDiscEngEventInd; +using ::NanEnableRequest; +using ::NanFollowupInd; +using ::NanMatchAlg; +using ::NanMatchExpiredInd; +using ::NanMatchInd; +using ::NanPublishCancelRequest; +using ::NanPublishRequest; +using ::NanPublishTerminatedInd; +using ::NanPublishType; +using ::NanRangeReportInd; +using ::NanRangeRequestInd; +using ::NanResponseMsg; +using ::NanSRFType; +using ::NanStatusType; +using ::NanSubscribeCancelRequest; +using ::NanSubscribeRequest; +using ::NanSubscribeTerminatedInd; +using ::NanSubscribeType; +using ::NanTransmitFollowupInd; +using ::NanTransmitFollowupRequest; +using ::NanTxType; +using ::ROAMING_DISABLE; +using ::ROAMING_ENABLE; +using ::RTT_PEER_AP; +using ::RTT_PEER_NAN; +using ::RTT_PEER_P2P_CLIENT; +using ::RTT_PEER_P2P_GO; +using ::RTT_PEER_STA; +using ::rtt_peer_type; +using ::RTT_STATUS_ABORTED; +using ::RTT_STATUS_FAIL_AP_ON_DIFF_CHANNEL; +using ::RTT_STATUS_FAIL_BUSY_TRY_LATER; +using ::RTT_STATUS_FAIL_FTM_PARAM_OVERRIDE; +using ::RTT_STATUS_FAIL_INVALID_TS; +using ::RTT_STATUS_FAIL_NO_CAPABILITY; +using ::RTT_STATUS_FAIL_NO_RSP; +using ::RTT_STATUS_FAIL_NOT_SCHEDULED_YET; +using ::RTT_STATUS_FAIL_PROTOCOL; +using ::RTT_STATUS_FAIL_REJECTED; +using ::RTT_STATUS_FAIL_SCHEDULE; +using ::RTT_STATUS_FAIL_TM_TIMEOUT; +using ::RTT_STATUS_FAILURE; +using ::RTT_STATUS_INVALID_REQ; +using ::RTT_STATUS_NAN_RANGING_CONCURRENCY_NOT_SUPPORTED; +using ::RTT_STATUS_NAN_RANGING_PROTOCOL_FAILURE; +using ::RTT_STATUS_NO_WIFI; +using ::RTT_STATUS_SUCCESS; +using ::RTT_TYPE_1_SIDED; +using ::RTT_TYPE_2_SIDED; +using ::RX_PKT_FATE_DRV_DROP_FILTER; +using ::RX_PKT_FATE_DRV_DROP_INVALID; +using ::RX_PKT_FATE_DRV_DROP_NOBUFS; +using ::RX_PKT_FATE_DRV_DROP_OTHER; +using ::RX_PKT_FATE_DRV_QUEUED; +using ::RX_PKT_FATE_FW_DROP_FILTER; +using ::RX_PKT_FATE_FW_DROP_INVALID; +using ::RX_PKT_FATE_FW_DROP_NOBUFS; +using ::RX_PKT_FATE_FW_DROP_OTHER; +using ::RX_PKT_FATE_FW_QUEUED; +using ::RX_PKT_FATE_SUCCESS; +using ::ssid_t; +using ::transaction_id; +using ::TX_PKT_FATE_ACKED; +using ::TX_PKT_FATE_DRV_DROP_INVALID; +using ::TX_PKT_FATE_DRV_DROP_NOBUFS; +using ::TX_PKT_FATE_DRV_DROP_OTHER; +using ::TX_PKT_FATE_DRV_QUEUED; +using ::TX_PKT_FATE_FW_DROP_INVALID; +using ::TX_PKT_FATE_FW_DROP_NOBUFS; +using ::TX_PKT_FATE_FW_DROP_OTHER; +using ::TX_PKT_FATE_FW_QUEUED; +using ::TX_PKT_FATE_SENT; +using ::WIFI_AC_BE; +using ::WIFI_AC_BK; +using ::WIFI_AC_VI; +using ::WIFI_AC_VO; +using ::WIFI_ANTENNA_1X1; +using ::WIFI_ANTENNA_2X2; +using ::WIFI_ANTENNA_3X3; +using ::WIFI_ANTENNA_4X4; +using ::WIFI_ANTENNA_UNSPECIFIED; +using ::wifi_band; +using ::WIFI_BAND_A; +using ::WIFI_BAND_A_DFS; +using ::WIFI_BAND_A_WITH_DFS; +using ::WIFI_BAND_ABG; +using ::WIFI_BAND_ABG_WITH_DFS; +using ::WIFI_BAND_BG; +using ::WIFI_BAND_UNSPECIFIED; +using ::wifi_cached_scan_report; +using ::wifi_cached_scan_results; +using ::WIFI_CHAN_WIDTH_10; +using ::WIFI_CHAN_WIDTH_160; +using ::WIFI_CHAN_WIDTH_20; +using ::WIFI_CHAN_WIDTH_320; +using ::WIFI_CHAN_WIDTH_40; +using ::WIFI_CHAN_WIDTH_5; +using ::WIFI_CHAN_WIDTH_80; +using ::WIFI_CHAN_WIDTH_80P80; +using ::WIFI_CHAN_WIDTH_INVALID; +using ::wifi_channel_info; +using ::wifi_channel_stat; +using ::wifi_channel_width; +using ::wifi_coex_restriction; +using ::wifi_coex_unsafe_channel; +using ::WIFI_DUAL_STA_NON_TRANSIENT_UNBIASED; +using ::WIFI_DUAL_STA_TRANSIENT_PREFER_PRIMARY; +using ::wifi_error; +using ::WIFI_ERROR_BUSY; +using ::WIFI_ERROR_INVALID_ARGS; +using ::WIFI_ERROR_INVALID_REQUEST_ID; +using ::WIFI_ERROR_NONE; +using ::WIFI_ERROR_NOT_AVAILABLE; +using ::WIFI_ERROR_NOT_SUPPORTED; +using ::WIFI_ERROR_OUT_OF_MEMORY; +using ::WIFI_ERROR_TIMED_OUT; +using ::WIFI_ERROR_TOO_MANY_REQUESTS; +using ::WIFI_ERROR_UNINITIALIZED; +using ::WIFI_ERROR_UNKNOWN; +using ::wifi_gscan_capabilities; +using ::wifi_hal_fn; +using ::wifi_information_element; +using ::WIFI_INTERFACE_IBSS; +using ::WIFI_INTERFACE_MESH; +using ::wifi_interface_mode; +using ::WIFI_INTERFACE_NAN; +using ::WIFI_INTERFACE_P2P_CLIENT; +using ::WIFI_INTERFACE_P2P_GO; +using ::WIFI_INTERFACE_SOFTAP; +using ::WIFI_INTERFACE_STA; +using ::WIFI_INTERFACE_TDLS; +using ::wifi_interface_type; +using ::WIFI_INTERFACE_TYPE_AP; +using ::WIFI_INTERFACE_TYPE_NAN; +using ::WIFI_INTERFACE_TYPE_P2P; +using ::WIFI_INTERFACE_TYPE_STA; +using ::WIFI_INTERFACE_UNKNOWN; +using ::wifi_latency_mode; +using ::WIFI_LATENCY_MODE_LOW; +using ::WIFI_LATENCY_MODE_NORMAL; +using ::wifi_lci_information; +using ::wifi_lcr_information; +using ::WIFI_LOGGER_CONNECT_EVENT_SUPPORTED; +using ::WIFI_LOGGER_DRIVER_DUMP_SUPPORTED; +using ::WIFI_LOGGER_MEMORY_DUMP_SUPPORTED; +using ::WIFI_LOGGER_PACKET_FATE_SUPPORTED; +using ::WIFI_LOGGER_POWER_EVENT_SUPPORTED; +using ::WIFI_LOGGER_WAKE_LOCK_SUPPORTED; +using ::WIFI_MOTION_EXPECTED; +using ::WIFI_MOTION_NOT_EXPECTED; +using ::wifi_motion_pattern; +using ::WIFI_MOTION_UNKNOWN; +using ::wifi_multi_sta_use_case; +using ::wifi_power_scenario; +using ::WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF; +using ::WIFI_POWER_SCENARIO_ON_BODY_CELL_ON; +using ::WIFI_POWER_SCENARIO_ON_HEAD_CELL_OFF; +using ::WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON; +using ::WIFI_POWER_SCENARIO_VOICE_CALL; +using ::wifi_radio_combination; +using ::wifi_radio_combination_matrix; +using ::wifi_radio_configuration; +using ::wifi_rate; +using ::wifi_request_id; +using ::wifi_ring_buffer_status; +using ::wifi_roaming_capabilities; +using ::wifi_roaming_config; +using ::wifi_rtt_bw; +using ::WIFI_RTT_BW_10; +using ::WIFI_RTT_BW_160; +using ::WIFI_RTT_BW_20; +using ::WIFI_RTT_BW_320; +using ::WIFI_RTT_BW_40; +using ::WIFI_RTT_BW_5; +using ::WIFI_RTT_BW_80; +using ::wifi_rtt_capabilities; +using ::wifi_rtt_config; +using ::wifi_rtt_preamble; +using ::WIFI_RTT_PREAMBLE_EHT; +using ::WIFI_RTT_PREAMBLE_HE; +using ::WIFI_RTT_PREAMBLE_HT; +using ::WIFI_RTT_PREAMBLE_LEGACY; +using ::WIFI_RTT_PREAMBLE_VHT; +using ::wifi_rtt_responder; +using ::wifi_rtt_result; +using ::wifi_rtt_status; +using ::wifi_rtt_type; +using ::wifi_rx_packet_fate; +using ::wifi_rx_report; +using ::wifi_scan_bucket_spec; +using ::wifi_scan_cmd_params; +using ::WIFI_SCAN_FLAG_INTERRUPTED; +using ::wifi_scan_result; +using ::WIFI_SUCCESS; +using ::wifi_tx_packet_fate; +using ::wifi_tx_report; +using ::wifi_usable_channel; +using ::WIFI_USABLE_CHANNEL_FILTER_CELLULAR_COEXISTENCE; +using ::WIFI_USABLE_CHANNEL_FILTER_CONCURRENCY; +using ::WLAN_MAC_2_4_BAND; +using ::WLAN_MAC_5_0_BAND; +using ::WLAN_MAC_60_0_BAND; +using ::WLAN_MAC_6_0_BAND; + +// APF capabilities supported by the iface. +struct PacketFilterCapabilities { + uint32_t version; + uint32_t max_len; +}; + +// WARNING: We don't care about the variable sized members of either +// |wifi_iface_stat|, |wifi_radio_stat| structures. So, using the pragma +// to escape the compiler warnings regarding this. +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wgnu-variable-sized-type-not-at-end" +// The |wifi_radio_stat.tx_time_per_levels| stats is provided as a pointer in +// |wifi_radio_stat| structure in the legacy HAL API. Separate that out +// into a separate return element to avoid passing pointers around. +struct LinkLayerRadioStats { + wifi_radio_stat stats; + std::vector tx_time_per_levels; + std::vector channel_stats; +}; + +struct WifiPeerInfo { + wifi_peer_info peer_info; + std::vector rate_stats; +}; + +struct LinkLayerStats { + wifi_iface_stat iface; + std::vector radios; + std::vector peers; +}; +#pragma GCC diagnostic pop + +// The |WLAN_DRIVER_WAKE_REASON_CNT.cmd_event_wake_cnt| and +// |WLAN_DRIVER_WAKE_REASON_CNT.driver_fw_local_wake_cnt| stats is provided +// as a pointer in |WLAN_DRIVER_WAKE_REASON_CNT| structure in the legacy HAL +// API. Separate that out into a separate return elements to avoid passing +// pointers around. +struct WakeReasonStats { + WLAN_DRIVER_WAKE_REASON_CNT wake_reason_cnt; + std::vector cmd_event_wake_cnt; + std::vector driver_fw_local_wake_cnt; +}; + +// NAN response and event callbacks struct. +struct NanCallbackHandlers { + // NotifyResponse invoked to notify the status of the Request. + std::function on_notify_response; + // Various event callbacks. + std::function on_event_publish_terminated; + std::function on_event_match; + std::function on_event_match_expired; + std::function on_event_subscribe_terminated; + std::function on_event_followup; + std::function on_event_disc_eng_event; + std::function on_event_disabled; + std::function on_event_tca; + std::function on_event_beacon_sdf_payload; + std::function on_event_data_path_request; + std::function on_event_data_path_confirm; + std::function on_event_data_path_end; + std::function on_event_transmit_follow_up; + std::function on_event_range_request; + std::function on_event_range_report; + std::function on_event_schedule_update; +}; + +// Full scan results contain IE info and are hence passed by reference, to +// preserve the variable length array member |ie_data|. Callee must not retain +// the pointer. +using on_gscan_full_result_callback = + std::function; +// These scan results don't contain any IE info, so no need to pass by +// reference. +using on_gscan_results_callback = + std::function&)>; + +// Invoked when the rssi value breaches the thresholds set. +using on_rssi_threshold_breached_callback = + std::function, int8_t)>; + +// Callback for RTT range request results. +// Rtt results contain IE info and are hence passed by reference, to +// preserve the |LCI| and |LCR| pointers. Callee must not retain +// the pointer. +using on_rtt_results_callback = + std::function&)>; + +// Callback for ring buffer data. +using on_ring_buffer_data_callback = std::function&, const wifi_ring_buffer_status&)>; + +// Callback for alerts. +using on_error_alert_callback = std::function&)>; + +// Callback for subsystem restart +using on_subsystem_restart_callback = std::function; + +// Struct for the mac info from the legacy HAL. This is a cleaner version +// of the |wifi_mac_info| & |wifi_iface_info|. +typedef struct { + std::string name; + wifi_channel channel; +} WifiIfaceInfo; + +typedef struct { + uint32_t wlan_mac_id; + /* BIT MASK of BIT(WLAN_MAC*) as represented by wlan_mac_band */ + uint32_t mac_band; + /* Represents the connected Wi-Fi interfaces associated with each MAC */ + std::vector iface_infos; +} WifiMacInfo; + +// Callback for radio mode change +using on_radio_mode_change_callback = std::function&)>; + +// TWT response and event callbacks struct. +struct TwtCallbackHandlers { + // Callback for TWT setup response + std::function on_setup_response; + // Callback for TWT teardown completion + std::function on_teardown_completion; + // Callback for TWT info frame received event + std::function on_info_frame_received; + // Callback for TWT notification from the device + std::function on_device_notify; +}; + +// CHRE response and event callbacks struct. +struct ChreCallbackHandlers { + // Callback for CHRE NAN RTT + std::function on_wifi_chre_nan_rtt_state; +}; + +// Cached Scan Results response and event callbacks struct. +struct CachedScanResultsCallbackHandlers { + // Callback for Cached Scan Results + std::function on_cached_scan_results; +}; + +/** + * Class that encapsulates all legacy HAL interactions. + * This class manages the lifetime of the event loop thread used by legacy HAL. + * + * Note: There will only be a single instance of this class created in the Wifi + * object and will be valid for the lifetime of the process. + */ +class WifiLegacyHal { + public: + WifiLegacyHal(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool, + const wifi_hal_fn& fn, bool is_primary); + virtual ~WifiLegacyHal() = default; + + // Initialize the legacy HAL function table. + virtual wifi_error initialize(); + // Start the legacy HAL and the event looper thread. + virtual wifi_error start(); + // Deinitialize the legacy HAL and wait for the event loop thread to exit + // using a predefined timeout. + virtual wifi_error stop(std::unique_lock* lock, + const std::function& on_complete_callback); + virtual wifi_error waitForDriverReady(); + // Checks if legacy HAL has successfully started + bool isStarted(); + // Wrappers for all the functions in the legacy HAL function table. + virtual std::pair getDriverVersion(const std::string& iface_name); + virtual std::pair getFirmwareVersion(const std::string& iface_name); + std::pair> requestDriverMemoryDump( + const std::string& iface_name); + std::pair> requestFirmwareMemoryDump( + const std::string& iface_name); + virtual std::pair getSupportedFeatureSet(const std::string& iface_name); + // APF functions. + std::pair getPacketFilterCapabilities( + const std::string& iface_name); + wifi_error setPacketFilter(const std::string& iface_name, const std::vector& program); + std::pair> readApfPacketFilterData( + const std::string& iface_name); + // Gscan functions. + std::pair getGscanCapabilities( + const std::string& iface_name); + // These API's provides a simplified interface over the legacy Gscan API's: + // a) All scan events from the legacy HAL API other than the + // |WIFI_SCAN_FAILED| are treated as notification of results. + // This method then retrieves the cached scan results from the legacy + // HAL API and triggers the externally provided + // |on_results_user_callback| on success. + // b) |WIFI_SCAN_FAILED| scan event or failure to retrieve cached scan + // results + // Triggers the externally provided |on_failure_user_callback|. + // c) Full scan result event triggers the externally provided + // |on_full_result_user_callback|. + wifi_error startGscan(const std::string& iface_name, wifi_request_id id, + const wifi_scan_cmd_params& params, + const std::function& on_failure_callback, + const on_gscan_results_callback& on_results_callback, + const on_gscan_full_result_callback& on_full_result_callback); + wifi_error stopGscan(const std::string& iface_name, wifi_request_id id); + std::pair> getValidFrequenciesForBand( + const std::string& iface_name, wifi_band band); + virtual wifi_error setDfsFlag(const std::string& iface_name, bool dfs_on); + // Link layer stats functions. + wifi_error enableLinkLayerStats(const std::string& iface_name, bool debug); + wifi_error disableLinkLayerStats(const std::string& iface_name); + std::pair getLinkLayerStats(const std::string& iface_name); + // RSSI monitor functions. + wifi_error startRssiMonitoring( + const std::string& iface_name, wifi_request_id id, int8_t max_rssi, int8_t min_rssi, + const on_rssi_threshold_breached_callback& on_threshold_breached_callback); + wifi_error stopRssiMonitoring(const std::string& iface_name, wifi_request_id id); + std::pair getRoamingCapabilities( + const std::string& iface_name); + wifi_error configureRoaming(const std::string& iface_name, const wifi_roaming_config& config); + wifi_error enableFirmwareRoaming(const std::string& iface_name, fw_roaming_state_t state); + wifi_error configureNdOffload(const std::string& iface_name, bool enable); + wifi_error startSendingOffloadedPacket(const std::string& iface_name, int32_t cmd_id, + uint16_t ether_type, + const std::vector& ip_packet_data, + const std::array& src_address, + const std::array& dst_address, + int32_t period_in_ms); + wifi_error stopSendingOffloadedPacket(const std::string& iface_name, uint32_t cmd_id); + virtual wifi_error selectTxPowerScenario(const std::string& iface_name, + wifi_power_scenario scenario); + virtual wifi_error resetTxPowerScenario(const std::string& iface_name); + wifi_error setLatencyMode(const std::string& iface_name, wifi_latency_mode mode); + wifi_error setThermalMitigationMode(wifi_thermal_mode mode, uint32_t completion_window); + wifi_error setDscpToAccessCategoryMapping(uint32_t start, uint32_t end, + uint32_t access_category); + wifi_error resetDscpToAccessCategoryMapping(); + // Logger/debug functions. + std::pair getLoggerSupportedFeatureSet(const std::string& iface_name); + wifi_error startPktFateMonitoring(const std::string& iface_name); + std::pair> getTxPktFates(const std::string& iface_name); + std::pair> getRxPktFates(const std::string& iface_name); + std::pair getWakeReasonStats(const std::string& iface_name); + wifi_error registerRingBufferCallbackHandler( + const std::string& iface_name, const on_ring_buffer_data_callback& on_data_callback); + wifi_error deregisterRingBufferCallbackHandler(const std::string& iface_name); + virtual wifi_error registerSubsystemRestartCallbackHandler( + const on_subsystem_restart_callback& on_restart_callback); + std::pair> getRingBuffersStatus( + const std::string& iface_name); + wifi_error startRingBufferLogging(const std::string& iface_name, const std::string& ring_name, + uint32_t verbose_level, uint32_t max_interval_sec, + uint32_t min_data_size); + wifi_error getRingBufferData(const std::string& iface_name, const std::string& ring_name); + wifi_error registerErrorAlertCallbackHandler(const std::string& iface_name, + const on_error_alert_callback& on_alert_callback); + wifi_error deregisterErrorAlertCallbackHandler(const std::string& iface_name); + // Radio mode functions. + virtual wifi_error registerRadioModeChangeCallbackHandler( + const std::string& iface_name, + const on_radio_mode_change_callback& on_user_change_callback); + // RTT functions. + wifi_error startRttRangeRequest(const std::string& iface_name, wifi_request_id id, + const std::vector& rtt_configs, + const on_rtt_results_callback& on_results_callback); + wifi_error cancelRttRangeRequest(const std::string& iface_name, wifi_request_id id, + const std::vector>& mac_addrs); + std::pair getRttCapabilities(const std::string& iface_name); + std::pair getRttResponderInfo(const std::string& iface_name); + wifi_error enableRttResponder(const std::string& iface_name, wifi_request_id id, + const wifi_channel_info& channel_hint, uint32_t max_duration_secs, + const wifi_rtt_responder& info); + wifi_error disableRttResponder(const std::string& iface_name, wifi_request_id id); + wifi_error setRttLci(const std::string& iface_name, wifi_request_id id, + const wifi_lci_information& info); + wifi_error setRttLcr(const std::string& iface_name, wifi_request_id id, + const wifi_lcr_information& info); + // NAN functions. + virtual wifi_error nanRegisterCallbackHandlers(const std::string& iface_name, + const NanCallbackHandlers& callbacks); + wifi_error nanEnableRequest(const std::string& iface_name, transaction_id id, + const NanEnableRequest& msg); + virtual wifi_error nanDisableRequest(const std::string& iface_name, transaction_id id); + wifi_error nanPublishRequest(const std::string& iface_name, transaction_id id, + const NanPublishRequest& msg); + wifi_error nanPublishCancelRequest(const std::string& iface_name, transaction_id id, + const NanPublishCancelRequest& msg); + wifi_error nanSubscribeRequest(const std::string& iface_name, transaction_id id, + const NanSubscribeRequest& msg); + wifi_error nanSubscribeCancelRequest(const std::string& iface_name, transaction_id id, + const NanSubscribeCancelRequest& msg); + wifi_error nanTransmitFollowupRequest(const std::string& iface_name, transaction_id id, + const NanTransmitFollowupRequest& msg); + wifi_error nanStatsRequest(const std::string& iface_name, transaction_id id, + const NanStatsRequest& msg); + wifi_error nanConfigRequest(const std::string& iface_name, transaction_id id, + const NanConfigRequest& msg); + wifi_error nanTcaRequest(const std::string& iface_name, transaction_id id, + const NanTCARequest& msg); + wifi_error nanBeaconSdfPayloadRequest(const std::string& iface_name, transaction_id id, + const NanBeaconSdfPayloadRequest& msg); + std::pair nanGetVersion(); + wifi_error nanGetCapabilities(const std::string& iface_name, transaction_id id); + wifi_error nanDataInterfaceCreate(const std::string& iface_name, transaction_id id, + const std::string& data_iface_name); + virtual wifi_error nanDataInterfaceDelete(const std::string& iface_name, transaction_id id, + const std::string& data_iface_name); + wifi_error nanDataRequestInitiator(const std::string& iface_name, transaction_id id, + const NanDataPathInitiatorRequest& msg); + wifi_error nanDataIndicationResponse(const std::string& iface_name, transaction_id id, + const NanDataPathIndicationResponse& msg); + wifi_error nanDataEnd(const std::string& iface_name, transaction_id id, uint32_t ndpInstanceId); + // AP functions. + wifi_error setCountryCode(const std::string& iface_name, const std::array code); + + // Interface functions. + virtual wifi_error createVirtualInterface(const std::string& ifname, + wifi_interface_type iftype); + virtual wifi_error deleteVirtualInterface(const std::string& ifname); + virtual wifi_error getSupportedIfaceName(uint32_t iface_type, std::string& ifname); + + // STA + STA functions + virtual wifi_error multiStaSetPrimaryConnection(const std::string& ifname); + virtual wifi_error multiStaSetUseCase(wifi_multi_sta_use_case use_case); + + // Coex functions. + virtual wifi_error setCoexUnsafeChannels(std::vector unsafe_channels, + uint32_t restrictions); + + wifi_error setVoipMode(const std::string& iface_name, wifi_voip_mode mode); + + wifi_error twtRegisterHandler(const std::string& iface_name, + const TwtCallbackHandlers& handler); + + std::pair twtGetCapability(const std::string& iface_name); + + wifi_error twtSetupRequest(const std::string& iface_name, const TwtSetupRequest& msg); + + wifi_error twtTearDownRequest(const std::string& iface_name, const TwtTeardownRequest& msg); + + wifi_error twtInfoFrameRequest(const std::string& iface_name, const TwtInfoFrameRequest& msg); + + std::pair twtGetStats(const std::string& iface_name, uint8_t configId); + + wifi_error twtClearStats(const std::string& iface_name, uint8_t configId); + + wifi_error setDtimConfig(const std::string& iface_name, uint32_t multiplier); + + // Retrieve the list of usable channels in the requested bands + // for the requested modes + std::pair> getUsableChannels( + uint32_t band_mask, uint32_t iface_mode_mask, uint32_t filter_mask); + + wifi_error triggerSubsystemRestart(); + + wifi_error setIndoorState(bool isIndoor); + + std::pair getSupportedRadioCombinationsMatrix(); + + // CHRE NAN RTT function + wifi_error chreNanRttRequest(const std::string& iface_name, bool enable); + + wifi_error chreRegisterHandler(const std::string& iface_name, + const ChreCallbackHandlers& handler); + + wifi_error enableWifiTxPowerLimits(const std::string& iface_name, bool enable); + wifi_error getWifiCachedScanResults(const std::string& iface_name, + const CachedScanResultsCallbackHandlers& handler); + + private: + // Retrieve interface handles for all the available interfaces. + wifi_error retrieveIfaceHandles(); + wifi_interface_handle getIfaceHandle(const std::string& iface_name); + // Run the legacy HAL event loop thread. + void runEventLoop(); + // Retrieve the cached gscan results to pass the results back to the + // external callbacks. + std::pair> getGscanCachedResults( + const std::string& iface_name); + void invalidate(); + // Handles wifi (error) status of Virtual interface create/delete + wifi_error handleVirtualInterfaceCreateOrDeleteStatus(const std::string& ifname, + wifi_error status); + + // Global function table of legacy HAL. + wifi_hal_fn global_func_table_; + // Opaque handle to be used for all global operations. + wifi_handle global_handle_; + // Map of interface name to handle that is to be used for all interface + // specific operations. + std::map iface_name_to_handle_; + // Flag to indicate if we have initiated the cleanup of legacy HAL. + std::atomic awaiting_event_loop_termination_; + std::condition_variable_any stop_wait_cv_; + // Flag to indicate if the legacy HAL has been started. + bool is_started_; + std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool_; + // Flag to indicate if this HAL is for the primary chip. This is used + // in order to avoid some hard-coded behavior used with older HALs, + // such as bring wlan0 interface up/down on start/stop HAL. + // it may be removed once vendor HALs are updated. + bool is_primary_; +}; + +} // namespace legacy_hal +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // WIFI_LEGACY_HAL_H_ diff --git a/wifi/aidl/default/wifi_legacy_hal_factory.cpp b/wifi/aidl/default/wifi_legacy_hal_factory.cpp new file mode 100644 index 0000000000..60f81ed764 --- /dev/null +++ b/wifi/aidl/default/wifi_legacy_hal_factory.cpp @@ -0,0 +1,252 @@ +/* + * 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. + */ + +#include "wifi_legacy_hal_factory.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "wifi_legacy_hal_stubs.h" + +namespace { +static constexpr char kVendorHalsDescPath[] = "/vendor/etc/wifi/vendor_hals"; +static constexpr char kVendorHalsDescExt[] = ".xml"; +static constexpr uint32_t kVendorHalsDescVersion = 1; + +bool isDirectory(struct dirent* entryPtr) { + bool isDir = false; + if (entryPtr->d_type != DT_UNKNOWN && entryPtr->d_type != DT_LNK) { + isDir = (entryPtr->d_type == DT_DIR); + } else { + struct stat entryStat; + stat(entryPtr->d_name, &entryStat); + isDir = S_ISDIR(entryStat.st_mode); + } + return isDir; +} + +bool isFileExtension(const char* name, const char* ext) { + if (name == NULL) return false; + if (ext == NULL) return false; + + size_t extLen = strlen(ext); + size_t nameLen = strlen(name); + + if (extLen > nameLen) return false; + + if (strncmp(name + nameLen - extLen, ext, extLen) != 0) return false; + + return true; +} +}; // namespace + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace legacy_hal { + +WifiLegacyHalFactory::WifiLegacyHalFactory( + const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool) + : iface_tool_(iface_tool) {} + +std::vector> WifiLegacyHalFactory::getHals() { + if (legacy_hals_.empty()) { + if (!initVendorHalDescriptorFromLinked()) initVendorHalsDescriptorList(); + for (auto& desc : descs_) { + std::shared_ptr hal = + std::make_shared(iface_tool_, desc.fn, desc.primary); + legacy_hals_.push_back(hal); + } + } + + return legacy_hals_; +} + +bool WifiLegacyHalFactory::initVendorHalDescriptorFromLinked() { + wifi_hal_lib_desc desc; + + if (!initLinkedHalFunctionTable(&desc.fn)) return false; + + desc.primary = true; + desc.handle = NULL; + descs_.push_back(desc); + return true; +} + +bool WifiLegacyHalFactory::initLinkedHalFunctionTable(wifi_hal_fn* hal_fn) { + init_wifi_vendor_hal_func_table_t initfn; + + initfn = (init_wifi_vendor_hal_func_table_t)dlsym(RTLD_DEFAULT, + "init_wifi_vendor_hal_func_table"); + if (!initfn) { + LOG(INFO) << "no vendor HAL library linked, will try dynamic load"; + return false; + } + + if (!initHalFuncTableWithStubs(hal_fn)) { + LOG(ERROR) << "Can not initialize the basic function pointer table"; + return false; + } + + if (initfn(hal_fn) != WIFI_SUCCESS) { + LOG(ERROR) << "Can not initialize the vendor function pointer table"; + return false; + } + + return true; +} + +/* + * Overall structure of the HAL descriptor XML schema + * + * + * + * /vendor/lib64/libwifi-hal-qcom.so + * 1 + * + */ +void WifiLegacyHalFactory::initVendorHalsDescriptorList() { + xmlDocPtr xml; + xmlNodePtr node, cnode; + char* version; + std::string path; + xmlChar* value; + wifi_hal_lib_desc desc; + + LOG(INFO) << "processing vendor HALs descriptions in " << kVendorHalsDescPath; + DIR* dirPtr = ::opendir(kVendorHalsDescPath); + if (dirPtr == NULL) { + LOG(ERROR) << "failed to open " << kVendorHalsDescPath; + return; + } + for (struct dirent* entryPtr = ::readdir(dirPtr); entryPtr != NULL; + entryPtr = ::readdir(dirPtr)) { + if (isDirectory(entryPtr)) continue; + + if (!isFileExtension(entryPtr->d_name, kVendorHalsDescExt)) + continue; // only process .xml files + + LOG(INFO) << "processing config file: " << entryPtr->d_name; + + std::string fullPath(kVendorHalsDescPath); + fullPath.append("/"); + fullPath.append(entryPtr->d_name); + xml = xmlReadFile(fullPath.c_str(), "UTF-8", XML_PARSE_RECOVER); + if (!xml) { + LOG(ERROR) << "failed to parse: " << entryPtr->d_name << " skipping..."; + continue; + } + node = xmlDocGetRootElement(xml); + if (!node) { + LOG(ERROR) << "empty config file: " << entryPtr->d_name << " skipping..."; + goto skip; + } + if (xmlStrcmp(node->name, BAD_CAST "WifiVendorHal")) { + LOG(ERROR) << "bad config, root element not WifiVendorHal: " << entryPtr->d_name + << " skipping..."; + goto skip; + } + version = (char*)xmlGetProp(node, BAD_CAST "version"); + if (!version || strtoul(version, NULL, 0) != kVendorHalsDescVersion) { + LOG(ERROR) << "conf file: " << entryPtr->d_name + << "must have version: " << kVendorHalsDescVersion << ", skipping..."; + goto skip; + } + cnode = node->children; + path.clear(); + desc.primary = false; + while (cnode) { + if (!xmlStrcmp(cnode->name, BAD_CAST "path")) { + value = xmlNodeListGetString(xml, cnode->children, 1); + if (value) path = (char*)value; + xmlFree(value); + } else if (!xmlStrcmp(cnode->name, BAD_CAST "primary")) { + value = xmlNodeListGetString(xml, cnode->children, 1); + desc.primary = !xmlStrcmp(value, BAD_CAST "1"); + xmlFree(value); + } + cnode = cnode->next; + } + if (path.empty()) { + LOG(ERROR) << "hal library path not provided in: " << entryPtr->d_name + << ", skipping..."; + goto skip; + } + if (loadVendorHalLib(path, desc)) { + if (desc.primary) + descs_.insert(descs_.begin(), desc); + else + descs_.push_back(desc); + } + skip: + xmlFreeDoc(xml); + } + ::closedir(dirPtr); +} + +bool WifiLegacyHalFactory::loadVendorHalLib(const std::string& path, wifi_hal_lib_desc& desc) { + void* h = dlopen(path.c_str(), RTLD_NOW | RTLD_LOCAL); + init_wifi_vendor_hal_func_table_t initfn; + wifi_error res; + + if (!h) { + LOG(ERROR) << "failed to open vendor hal library: " << path; + return false; + } + initfn = (init_wifi_vendor_hal_func_table_t)dlsym(h, "init_wifi_vendor_hal_func_table"); + if (!initfn) { + LOG(ERROR) << "init_wifi_vendor_hal_func_table not found in: " << path; + goto out_err; + } + + if (!initHalFuncTableWithStubs(&desc.fn)) { + LOG(ERROR) << "Can not initialize the basic function pointer table"; + goto out_err; + } + res = initfn(&desc.fn); + if (res != WIFI_SUCCESS) { + LOG(ERROR) << "failed to initialize the vendor func table in: " << path + << " error: " << res; + goto out_err; + } + + res = desc.fn.wifi_early_initialize(); + // vendor HALs which do not implement early_initialize will return + // WIFI_ERROR_NOT_SUPPORTED, treat this as success. + if (res != WIFI_SUCCESS && res != WIFI_ERROR_NOT_SUPPORTED) { + LOG(ERROR) << "early initialization failed in: " << path << " error: " << res; + goto out_err; + } + + desc.handle = h; + return true; +out_err: + dlclose(h); + return false; +} + +} // namespace legacy_hal +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/wifi_legacy_hal_factory.h b/wifi/aidl/default/wifi_legacy_hal_factory.h new file mode 100644 index 0000000000..e7b287a6f5 --- /dev/null +++ b/wifi/aidl/default/wifi_legacy_hal_factory.h @@ -0,0 +1,64 @@ +/* + * 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. + */ + +#ifndef WIFI_LEGACY_HAL_FACTORY_H_ +#define WIFI_LEGACY_HAL_FACTORY_H_ + +#include + +#include "wifi_legacy_hal.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +// This is in a separate namespace to prevent typename conflicts between +// the legacy HAL types and the AIDL interface types. +namespace legacy_hal { +/** + * Class that creates WifiLegacyHal objects for vendor HALs in the system. + */ +class WifiLegacyHalFactory { + public: + WifiLegacyHalFactory(const std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool); + virtual ~WifiLegacyHalFactory() = default; + + std::vector> getHals(); + + private: + typedef struct { + wifi_hal_fn fn; + bool primary; + void* handle; + } wifi_hal_lib_desc; + + bool initVendorHalDescriptorFromLinked(); + void initVendorHalsDescriptorList(); + bool initLinkedHalFunctionTable(wifi_hal_fn* hal_fn); + bool loadVendorHalLib(const std::string& path, wifi_hal_lib_desc& desc); + + std::weak_ptr<::android::wifi_system::InterfaceTool> iface_tool_; + std::vector descs_; + std::vector> legacy_hals_; +}; + +} // namespace legacy_hal +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // WIFI_LEGACY_HAL_FACTORY_H_ diff --git a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp new file mode 100644 index 0000000000..cff7f6977b --- /dev/null +++ b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp @@ -0,0 +1,177 @@ +/* + * 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. + */ + +#include "wifi_legacy_hal_stubs.h" + +// TODO: Remove these stubs from HalTool in libwifi-system. +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace legacy_hal { +template +struct stubFunction; + +template +struct stubFunction { + static constexpr R invoke(Args...) { return WIFI_ERROR_NOT_SUPPORTED; } +}; +template +struct stubFunction { + static constexpr void invoke(Args...) {} +}; + +template +void populateStubFor(T* val) { + *val = &stubFunction::invoke; +} + +bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { + if (hal_fn == nullptr) { + return false; + } + populateStubFor(&hal_fn->wifi_initialize); + populateStubFor(&hal_fn->wifi_wait_for_driver_ready); + populateStubFor(&hal_fn->wifi_cleanup); + populateStubFor(&hal_fn->wifi_event_loop); + populateStubFor(&hal_fn->wifi_get_error_info); + populateStubFor(&hal_fn->wifi_get_supported_feature_set); + populateStubFor(&hal_fn->wifi_get_concurrency_matrix); + populateStubFor(&hal_fn->wifi_set_scanning_mac_oui); + populateStubFor(&hal_fn->wifi_get_supported_channels); + populateStubFor(&hal_fn->wifi_is_epr_supported); + populateStubFor(&hal_fn->wifi_get_ifaces); + populateStubFor(&hal_fn->wifi_get_iface_name); + populateStubFor(&hal_fn->wifi_set_iface_event_handler); + populateStubFor(&hal_fn->wifi_reset_iface_event_handler); + populateStubFor(&hal_fn->wifi_start_gscan); + populateStubFor(&hal_fn->wifi_stop_gscan); + populateStubFor(&hal_fn->wifi_get_cached_gscan_results); + populateStubFor(&hal_fn->wifi_set_bssid_hotlist); + populateStubFor(&hal_fn->wifi_reset_bssid_hotlist); + populateStubFor(&hal_fn->wifi_set_significant_change_handler); + populateStubFor(&hal_fn->wifi_reset_significant_change_handler); + populateStubFor(&hal_fn->wifi_get_gscan_capabilities); + populateStubFor(&hal_fn->wifi_set_link_stats); + populateStubFor(&hal_fn->wifi_get_link_stats); + populateStubFor(&hal_fn->wifi_clear_link_stats); + populateStubFor(&hal_fn->wifi_get_valid_channels); + populateStubFor(&hal_fn->wifi_rtt_range_request); + populateStubFor(&hal_fn->wifi_rtt_range_cancel); + populateStubFor(&hal_fn->wifi_get_rtt_capabilities); + populateStubFor(&hal_fn->wifi_rtt_get_responder_info); + populateStubFor(&hal_fn->wifi_enable_responder); + populateStubFor(&hal_fn->wifi_disable_responder); + populateStubFor(&hal_fn->wifi_set_nodfs_flag); + populateStubFor(&hal_fn->wifi_start_logging); + populateStubFor(&hal_fn->wifi_set_epno_list); + populateStubFor(&hal_fn->wifi_reset_epno_list); + populateStubFor(&hal_fn->wifi_set_country_code); + populateStubFor(&hal_fn->wifi_get_firmware_memory_dump); + populateStubFor(&hal_fn->wifi_set_log_handler); + populateStubFor(&hal_fn->wifi_reset_log_handler); + populateStubFor(&hal_fn->wifi_set_alert_handler); + populateStubFor(&hal_fn->wifi_reset_alert_handler); + populateStubFor(&hal_fn->wifi_get_firmware_version); + populateStubFor(&hal_fn->wifi_get_ring_buffers_status); + populateStubFor(&hal_fn->wifi_get_logger_supported_feature_set); + populateStubFor(&hal_fn->wifi_get_ring_data); + populateStubFor(&hal_fn->wifi_enable_tdls); + populateStubFor(&hal_fn->wifi_disable_tdls); + populateStubFor(&hal_fn->wifi_get_tdls_status); + populateStubFor(&hal_fn->wifi_get_tdls_capabilities); + populateStubFor(&hal_fn->wifi_get_driver_version); + populateStubFor(&hal_fn->wifi_set_passpoint_list); + populateStubFor(&hal_fn->wifi_reset_passpoint_list); + populateStubFor(&hal_fn->wifi_set_lci); + populateStubFor(&hal_fn->wifi_set_lcr); + populateStubFor(&hal_fn->wifi_start_sending_offloaded_packet); + populateStubFor(&hal_fn->wifi_stop_sending_offloaded_packet); + populateStubFor(&hal_fn->wifi_start_rssi_monitoring); + populateStubFor(&hal_fn->wifi_stop_rssi_monitoring); + populateStubFor(&hal_fn->wifi_get_wake_reason_stats); + populateStubFor(&hal_fn->wifi_configure_nd_offload); + populateStubFor(&hal_fn->wifi_get_driver_memory_dump); + populateStubFor(&hal_fn->wifi_start_pkt_fate_monitoring); + populateStubFor(&hal_fn->wifi_get_tx_pkt_fates); + populateStubFor(&hal_fn->wifi_get_rx_pkt_fates); + populateStubFor(&hal_fn->wifi_nan_enable_request); + populateStubFor(&hal_fn->wifi_nan_disable_request); + populateStubFor(&hal_fn->wifi_nan_publish_request); + populateStubFor(&hal_fn->wifi_nan_publish_cancel_request); + populateStubFor(&hal_fn->wifi_nan_subscribe_request); + populateStubFor(&hal_fn->wifi_nan_subscribe_cancel_request); + populateStubFor(&hal_fn->wifi_nan_transmit_followup_request); + populateStubFor(&hal_fn->wifi_nan_stats_request); + populateStubFor(&hal_fn->wifi_nan_config_request); + populateStubFor(&hal_fn->wifi_nan_tca_request); + populateStubFor(&hal_fn->wifi_nan_beacon_sdf_payload_request); + populateStubFor(&hal_fn->wifi_nan_register_handler); + populateStubFor(&hal_fn->wifi_nan_get_version); + populateStubFor(&hal_fn->wifi_nan_get_capabilities); + populateStubFor(&hal_fn->wifi_nan_data_interface_create); + populateStubFor(&hal_fn->wifi_nan_data_interface_delete); + populateStubFor(&hal_fn->wifi_nan_data_request_initiator); + populateStubFor(&hal_fn->wifi_nan_data_indication_response); + populateStubFor(&hal_fn->wifi_nan_data_end); + populateStubFor(&hal_fn->wifi_get_packet_filter_capabilities); + populateStubFor(&hal_fn->wifi_set_packet_filter); + populateStubFor(&hal_fn->wifi_read_packet_filter); + populateStubFor(&hal_fn->wifi_get_roaming_capabilities); + populateStubFor(&hal_fn->wifi_enable_firmware_roaming); + populateStubFor(&hal_fn->wifi_configure_roaming); + populateStubFor(&hal_fn->wifi_select_tx_power_scenario); + populateStubFor(&hal_fn->wifi_reset_tx_power_scenario); + populateStubFor(&hal_fn->wifi_set_radio_mode_change_handler); + populateStubFor(&hal_fn->wifi_set_latency_mode); + populateStubFor(&hal_fn->wifi_set_thermal_mitigation_mode); + populateStubFor(&hal_fn->wifi_virtual_interface_create); + populateStubFor(&hal_fn->wifi_virtual_interface_delete); + populateStubFor(&hal_fn->wifi_map_dscp_access_category); + populateStubFor(&hal_fn->wifi_reset_dscp_mapping); + populateStubFor(&hal_fn->wifi_set_subsystem_restart_handler); + populateStubFor(&hal_fn->wifi_get_supported_iface_name); + populateStubFor(&hal_fn->wifi_early_initialize); + populateStubFor(&hal_fn->wifi_get_chip_feature_set); + populateStubFor(&hal_fn->wifi_multi_sta_set_primary_connection); + populateStubFor(&hal_fn->wifi_multi_sta_set_use_case); + populateStubFor(&hal_fn->wifi_set_coex_unsafe_channels); + populateStubFor(&hal_fn->wifi_set_voip_mode); + populateStubFor(&hal_fn->wifi_twt_register_handler); + populateStubFor(&hal_fn->wifi_twt_get_capability); + populateStubFor(&hal_fn->wifi_twt_setup_request); + populateStubFor(&hal_fn->wifi_twt_teardown_request); + populateStubFor(&hal_fn->wifi_twt_info_frame_request); + populateStubFor(&hal_fn->wifi_twt_get_stats); + populateStubFor(&hal_fn->wifi_twt_clear_stats); + populateStubFor(&hal_fn->wifi_set_dtim_config); + populateStubFor(&hal_fn->wifi_get_usable_channels); + populateStubFor(&hal_fn->wifi_trigger_subsystem_restart); + populateStubFor(&hal_fn->wifi_set_indoor_state); + populateStubFor(&hal_fn->wifi_get_supported_radio_combinations_matrix); + populateStubFor(&hal_fn->wifi_nan_rtt_chre_enable_request); + populateStubFor(&hal_fn->wifi_nan_rtt_chre_disable_request); + populateStubFor(&hal_fn->wifi_chre_register_handler); + populateStubFor(&hal_fn->wifi_enable_tx_power_limits); + populateStubFor(&hal_fn->wifi_get_cached_scan_results); + return true; +} + +} // namespace legacy_hal +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/wifi_legacy_hal_stubs.h b/wifi/aidl/default/wifi_legacy_hal_stubs.h new file mode 100644 index 0000000000..603ecf2eae --- /dev/null +++ b/wifi/aidl/default/wifi_legacy_hal_stubs.h @@ -0,0 +1,35 @@ +/* + * 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. + */ + +#ifndef WIFI_LEGACY_HAL_STUBS_H_ +#define WIFI_LEGACY_HAL_STUBS_H_ + +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace legacy_hal { + +bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn); +} // namespace legacy_hal +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // WIFI_LEGACY_HAL_STUBS_H_ diff --git a/wifi/aidl/default/wifi_mode_controller.cpp b/wifi/aidl/default/wifi_mode_controller.cpp new file mode 100644 index 0000000000..07cb072363 --- /dev/null +++ b/wifi/aidl/default/wifi_mode_controller.cpp @@ -0,0 +1,88 @@ +/* + * 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. + */ + +#include "wifi_mode_controller.h" + +#include +#include +#include + +namespace { +using aidl::android::hardware::wifi::IfaceType; +using android::wifi_hal::DriverTool; + +int convertIfaceTypeToFirmwareMode(IfaceType type) { + int mode; + switch (type) { + case IfaceType::AP: + mode = DriverTool::kFirmwareModeAp; + break; + case IfaceType::P2P: + mode = DriverTool::kFirmwareModeP2p; + break; + case IfaceType::NAN_IFACE: + // NAN is exposed in STA mode currently. + mode = DriverTool::kFirmwareModeSta; + break; + case IfaceType::STA: + mode = DriverTool::kFirmwareModeSta; + break; + } + return mode; +} +} // namespace + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace mode_controller { + +WifiModeController::WifiModeController() : driver_tool_(new DriverTool) {} + +bool WifiModeController::isFirmwareModeChangeNeeded(IfaceType type) { + return driver_tool_->IsFirmwareModeChangeNeeded(convertIfaceTypeToFirmwareMode(type)); +} + +bool WifiModeController::initialize() { + if (!driver_tool_->LoadDriver()) { + LOG(ERROR) << "Failed to load WiFi driver"; + return false; + } + return true; +} + +bool WifiModeController::changeFirmwareMode(IfaceType type) { + if (!driver_tool_->ChangeFirmwareMode(convertIfaceTypeToFirmwareMode(type))) { + LOG(ERROR) << "Failed to change firmware mode"; + return false; + } + return true; +} + +bool WifiModeController::deinitialize() { + if (!driver_tool_->UnloadDriver()) { + LOG(ERROR) << "Failed to unload WiFi driver"; + return false; + } + return true; +} + +} // namespace mode_controller +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/wifi_mode_controller.h b/wifi/aidl/default/wifi_mode_controller.h new file mode 100644 index 0000000000..1a9fb1a498 --- /dev/null +++ b/wifi/aidl/default/wifi_mode_controller.h @@ -0,0 +1,59 @@ +/* + * 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. + */ + +#ifndef WIFI_MODE_CONTROLLER_H_ +#define WIFI_MODE_CONTROLLER_H_ + +#include +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +namespace mode_controller { + +/** + * Class that encapsulates all firmware mode configuration. + * This class will perform the necessary firmware reloads to put the chip in the + * required state (essentially a wrapper over DriverTool). + */ +class WifiModeController { + public: + WifiModeController(); + virtual ~WifiModeController() = default; + + // Checks if a firmware mode change is necessary to support the specified + // iface type operations. + virtual bool isFirmwareModeChangeNeeded(IfaceType type); + virtual bool initialize(); + // Change the firmware mode to support the specified iface type operations. + virtual bool changeFirmwareMode(IfaceType type); + // Unload the driver. This should be invoked whenever |IWifi.stop()| is + // invoked. + virtual bool deinitialize(); + + private: + std::unique_ptr<::android::wifi_hal::DriverTool> driver_tool_; +}; + +} // namespace mode_controller +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // WIFI_MODE_CONTROLLER_H_ diff --git a/wifi/aidl/default/wifi_nan_iface.cpp b/wifi/aidl/default/wifi_nan_iface.cpp new file mode 100644 index 0000000000..9edef09b7b --- /dev/null +++ b/wifi/aidl/default/wifi_nan_iface.cpp @@ -0,0 +1,751 @@ +/* + * 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. + */ + +#include "wifi_nan_iface.h" + +#include + +#include "aidl_return_util.h" +#include "aidl_struct_util.h" +#include "wifi_status_util.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +using aidl_return_util::validateAndCall; + +WifiNanIface::WifiNanIface(const std::string& ifname, bool is_dedicated_iface, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util) + : ifname_(ifname), + is_dedicated_iface_(is_dedicated_iface), + legacy_hal_(legacy_hal), + iface_util_(iface_util), + is_valid_(true) {} + +std::shared_ptr WifiNanIface::create( + const std::string& ifname, bool is_dedicated_iface, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util) { + std::shared_ptr ptr = ndk::SharedRefBase::make( + ifname, is_dedicated_iface, legacy_hal, iface_util); + if (is_dedicated_iface) { + // If using a dedicated iface, set the iface up first. + if (!iface_util.lock()->setUpState(ifname, true)) { + // Fatal failure, invalidate the iface object. + ptr->invalidate(); + return nullptr; + } + } + std::weak_ptr weak_ptr_this(ptr); + ptr->setWeakPtr(weak_ptr_this); + ptr->registerCallbackHandlers(); + return ptr; +} + +void WifiNanIface::registerCallbackHandlers() { + // Register all the callbacks here. These should be valid for the lifetime + // of the object. Whenever the mode changes legacy HAL will remove + // all of these callbacks. + legacy_hal::NanCallbackHandlers callback_handlers; + std::weak_ptr weak_ptr_this = weak_ptr_this_; + + // Callback for response. + callback_handlers.on_notify_response = [weak_ptr_this](legacy_hal::transaction_id id, + const legacy_hal::NanResponseMsg& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanStatus nanStatus; + if (!aidl_struct_util::convertLegacyNanResponseHeaderToAidl(msg, &nanStatus)) { + LOG(ERROR) << "Failed to convert nan response header"; + return; + } + + switch (msg.response_type) { + case legacy_hal::NAN_RESPONSE_ENABLED: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyEnableResponse(id, nanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_DISABLED: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyDisableResponse(id, nanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_PUBLISH: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyStartPublishResponse(id, nanStatus, + msg.body.publish_response.publish_id) + .isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_PUBLISH_CANCEL: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyStopPublishResponse(id, nanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_TRANSMIT_FOLLOWUP: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyTransmitFollowupResponse(id, nanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_SUBSCRIBE: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyStartSubscribeResponse( + id, nanStatus, msg.body.subscribe_response.subscribe_id) + .isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_SUBSCRIBE_CANCEL: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyStopSubscribeResponse(id, nanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_CONFIG: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyConfigResponse(id, nanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_GET_CAPABILITIES: { + NanCapabilities aidl_struct; + if (!aidl_struct_util::convertLegacyNanCapabilitiesResponseToAidl( + msg.body.nan_capabilities, &aidl_struct)) { + LOG(ERROR) << "Failed to convert nan capabilities response"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyCapabilitiesResponse(id, nanStatus, aidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_DP_INTERFACE_CREATE: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyCreateDataInterfaceResponse(id, nanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_DP_INTERFACE_DELETE: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyDeleteDataInterfaceResponse(id, nanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_DP_INITIATOR_RESPONSE: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyInitiateDataPathResponse( + id, nanStatus, + msg.body.data_request_response.ndp_instance_id) + .isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_DP_RESPONDER_RESPONSE: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyRespondToDataPathIndicationResponse(id, nanStatus) + .isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_DP_END: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyTerminateDataPathResponse(id, nanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESPONSE_BEACON_SDF_PAYLOAD: + /* fall through */ + case legacy_hal::NAN_RESPONSE_TCA: + /* fall through */ + case legacy_hal::NAN_RESPONSE_STATS: + /* fall through */ + case legacy_hal::NAN_RESPONSE_ERROR: + /* fall through */ + default: + LOG(ERROR) << "Unknown or unhandled response type: " << msg.response_type; + return; + } + }; + + callback_handlers.on_event_disc_eng_event = [weak_ptr_this]( + const legacy_hal::NanDiscEngEventInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanClusterEventInd aidl_struct; + // event types defined identically - hence can be cast + aidl_struct.eventType = (NanClusterEventType)msg.event_type; + aidl_struct.addr = std::array(); + std::copy(msg.data.mac_addr.addr, msg.data.mac_addr.addr + 6, std::begin(aidl_struct.addr)); + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventClusterEvent(aidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_disabled = [weak_ptr_this](const legacy_hal::NanDisabledInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanStatus status; + aidl_struct_util::convertToNanStatus(msg.reason, msg.nan_reason, sizeof(msg.nan_reason), + &status); + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventDisabled(status).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_publish_terminated = + [weak_ptr_this](const legacy_hal::NanPublishTerminatedInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanStatus status; + aidl_struct_util::convertToNanStatus(msg.reason, msg.nan_reason, + sizeof(msg.nan_reason), &status); + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventPublishTerminated(msg.publish_id, status).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_subscribe_terminated = + [weak_ptr_this](const legacy_hal::NanSubscribeTerminatedInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanStatus status; + aidl_struct_util::convertToNanStatus(msg.reason, msg.nan_reason, + sizeof(msg.nan_reason), &status); + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventSubscribeTerminated(msg.subscribe_id, status).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_match = [weak_ptr_this](const legacy_hal::NanMatchInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanMatchInd aidl_struct; + if (!aidl_struct_util::convertLegacyNanMatchIndToAidl(msg, &aidl_struct)) { + LOG(ERROR) << "Failed to convert nan capabilities response"; + return; + } + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventMatch(aidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_match_expired = [weak_ptr_this]( + const legacy_hal::NanMatchExpiredInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventMatchExpired(msg.publish_subscribe_id, msg.requestor_instance_id) + .isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_followup = [weak_ptr_this](const legacy_hal::NanFollowupInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanFollowupReceivedInd aidl_struct; + if (!aidl_struct_util::convertLegacyNanFollowupIndToAidl(msg, &aidl_struct)) { + LOG(ERROR) << "Failed to convert nan capabilities response"; + return; + } + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventFollowupReceived(aidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_transmit_follow_up = + [weak_ptr_this](const legacy_hal::NanTransmitFollowupInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanStatus status; + aidl_struct_util::convertToNanStatus(msg.reason, msg.nan_reason, + sizeof(msg.nan_reason), &status); + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventTransmitFollowup(msg.id, status).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_data_path_request = + [weak_ptr_this](const legacy_hal::NanDataPathRequestInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanDataPathRequestInd aidl_struct; + if (!aidl_struct_util::convertLegacyNanDataPathRequestIndToAidl(msg, + &aidl_struct)) { + LOG(ERROR) << "Failed to convert nan capabilities response"; + return; + } + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventDataPathRequest(aidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_data_path_confirm = + [weak_ptr_this](const legacy_hal::NanDataPathConfirmInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanDataPathConfirmInd aidl_struct; + if (!aidl_struct_util::convertLegacyNanDataPathConfirmIndToAidl(msg, + &aidl_struct)) { + LOG(ERROR) << "Failed to convert nan capabilities response"; + return; + } + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventDataPathConfirm(aidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + callback_handlers.on_event_data_path_end = + [weak_ptr_this](const legacy_hal::NanDataPathEndInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + for (int i = 0; i < msg.num_ndp_instances; ++i) { + if (!callback->eventDataPathTerminated(msg.ndp_instance_id[i]).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + } + }; + + callback_handlers.on_event_beacon_sdf_payload = + [](const legacy_hal::NanBeaconSdfPayloadInd& /* msg */) { + LOG(ERROR) << "on_event_beacon_sdf_payload - should not be called"; + }; + + callback_handlers.on_event_range_request = [](const legacy_hal::NanRangeRequestInd& /* msg */) { + LOG(ERROR) << "on_event_range_request - should not be called"; + }; + + callback_handlers.on_event_range_report = [](const legacy_hal::NanRangeReportInd& /* msg */) { + LOG(ERROR) << "on_event_range_report - should not be called"; + }; + + callback_handlers.on_event_schedule_update = + [weak_ptr_this](const legacy_hal::NanDataPathScheduleUpdateInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanDataPathScheduleUpdateInd aidl_struct; + if (!aidl_struct_util::convertLegacyNanDataPathScheduleUpdateIndToAidl( + msg, &aidl_struct)) { + LOG(ERROR) << "Failed to convert nan capabilities response"; + return; + } + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventDataPathScheduleUpdate(aidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanRegisterCallbackHandlers(ifname_, callback_handlers); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to register nan callbacks. Invalidating object"; + invalidate(); + } + + // Register for iface state toggle events. + iface_util::IfaceEventHandlers event_handlers = {}; + event_handlers.on_state_toggle_off_on = [weak_ptr_this](const std::string& /* iface_name */) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + // Tell framework that NAN has been disabled. + NanStatus status = {NanStatusCode::UNSUPPORTED_CONCURRENCY_NAN_DISABLED, ""}; + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventDisabled(status).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + iface_util_.lock()->registerIfaceEventHandlers(ifname_, event_handlers); +} + +void WifiNanIface::setWeakPtr(std::weak_ptr ptr) { + weak_ptr_this_ = ptr; +} + +void WifiNanIface::invalidate() { + if (!isValid()) { + return; + } + // send commands to HAL to actually disable and destroy interfaces + legacy_hal_.lock()->nanDisableRequest(ifname_, 0xFFFF); + legacy_hal_.lock()->nanDataInterfaceDelete(ifname_, 0xFFFE, "aware_data0"); + legacy_hal_.lock()->nanDataInterfaceDelete(ifname_, 0xFFFD, "aware_data1"); + iface_util_.lock()->unregisterIfaceEventHandlers(ifname_); + legacy_hal_.reset(); + event_cb_handler_.invalidate(); + is_valid_ = false; + if (is_dedicated_iface_) { + // If using a dedicated iface, set the iface down. + iface_util_.lock()->setUpState(ifname_, false); + } +} + +bool WifiNanIface::isValid() { + return is_valid_; +} + +std::string WifiNanIface::getName() { + return ifname_; +} + +std::set> WifiNanIface::getEventCallbacks() { + LOG(ERROR) << "Using original getEventCallbacks"; + return event_cb_handler_.getCallbacks(); +} + +ndk::ScopedAStatus WifiNanIface::getName(std::string* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::getNameInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiNanIface::registerEventCallback( + const std::shared_ptr& callback) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::registerEventCallbackInternal, callback); +} + +ndk::ScopedAStatus WifiNanIface::getCapabilitiesRequest(char16_t in_cmdId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::getCapabilitiesRequestInternal, in_cmdId); +} + +ndk::ScopedAStatus WifiNanIface::enableRequest(char16_t in_cmdId, const NanEnableRequest& in_msg1, + const NanConfigRequestSupplemental& in_msg2) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::enableRequestInternal, in_cmdId, in_msg1, in_msg2); +} + +ndk::ScopedAStatus WifiNanIface::configRequest(char16_t in_cmdId, const NanConfigRequest& in_msg1, + const NanConfigRequestSupplemental& in_msg2) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::configRequestInternal, in_cmdId, in_msg1, in_msg2); +} + +ndk::ScopedAStatus WifiNanIface::disableRequest(char16_t in_cmdId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::disableRequestInternal, in_cmdId); +} + +ndk::ScopedAStatus WifiNanIface::startPublishRequest(char16_t in_cmdId, + const NanPublishRequest& in_msg) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::startPublishRequestInternal, in_cmdId, in_msg); +} + +ndk::ScopedAStatus WifiNanIface::stopPublishRequest(char16_t in_cmdId, int8_t in_sessionId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::stopPublishRequestInternal, in_cmdId, in_sessionId); +} + +ndk::ScopedAStatus WifiNanIface::startSubscribeRequest(char16_t in_cmdId, + const NanSubscribeRequest& in_msg) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::startSubscribeRequestInternal, in_cmdId, in_msg); +} + +ndk::ScopedAStatus WifiNanIface::stopSubscribeRequest(char16_t in_cmdId, int8_t in_sessionId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::stopSubscribeRequestInternal, in_cmdId, in_sessionId); +} + +ndk::ScopedAStatus WifiNanIface::transmitFollowupRequest(char16_t in_cmdId, + const NanTransmitFollowupRequest& in_msg) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::transmitFollowupRequestInternal, in_cmdId, in_msg); +} + +ndk::ScopedAStatus WifiNanIface::createDataInterfaceRequest(char16_t in_cmdId, + const std::string& in_ifaceName) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::createDataInterfaceRequestInternal, in_cmdId, + in_ifaceName); +} + +ndk::ScopedAStatus WifiNanIface::deleteDataInterfaceRequest(char16_t in_cmdId, + const std::string& in_ifaceName) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::deleteDataInterfaceRequestInternal, in_cmdId, + in_ifaceName); +} + +ndk::ScopedAStatus WifiNanIface::initiateDataPathRequest(char16_t in_cmdId, + const NanInitiateDataPathRequest& in_msg) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::initiateDataPathRequestInternal, in_cmdId, in_msg); +} + +ndk::ScopedAStatus WifiNanIface::respondToDataPathIndicationRequest( + char16_t in_cmdId, const NanRespondToDataPathIndicationRequest& in_msg) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::respondToDataPathIndicationRequestInternal, in_cmdId, + in_msg); +} + +ndk::ScopedAStatus WifiNanIface::terminateDataPathRequest(char16_t in_cmdId, + int32_t in_ndpInstanceId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::terminateDataPathRequestInternal, in_cmdId, + in_ndpInstanceId); +} + +std::pair WifiNanIface::getNameInternal() { + return {ifname_, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiNanIface::registerEventCallbackInternal( + const std::shared_ptr& callback) { + if (!event_cb_handler_.addCallback(callback)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus WifiNanIface::getCapabilitiesRequestInternal(char16_t cmd_id) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->nanGetCapabilities(ifname_, cmd_id); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiNanIface::enableRequestInternal(char16_t cmd_id, + const NanEnableRequest& msg1, + const NanConfigRequestSupplemental& msg2) { + legacy_hal::NanEnableRequest legacy_msg; + if (!aidl_struct_util::convertAidlNanEnableRequestToLegacy(msg1, msg2, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanEnableRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiNanIface::configRequestInternal(char16_t cmd_id, + const NanConfigRequest& msg1, + const NanConfigRequestSupplemental& msg2) { + legacy_hal::NanConfigRequest legacy_msg; + if (!aidl_struct_util::convertAidlNanConfigRequestToLegacy(msg1, msg2, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanConfigRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiNanIface::disableRequestInternal(char16_t cmd_id) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->nanDisableRequest(ifname_, cmd_id); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiNanIface::startPublishRequestInternal(char16_t cmd_id, + const NanPublishRequest& msg) { + legacy_hal::NanPublishRequest legacy_msg; + if (!aidl_struct_util::convertAidlNanPublishRequestToLegacy(msg, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanPublishRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiNanIface::stopPublishRequestInternal(char16_t cmd_id, int8_t sessionId) { + legacy_hal::NanPublishCancelRequest legacy_msg; + legacy_msg.publish_id = sessionId; + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanPublishCancelRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiNanIface::startSubscribeRequestInternal(char16_t cmd_id, + const NanSubscribeRequest& msg) { + legacy_hal::NanSubscribeRequest legacy_msg; + if (!aidl_struct_util::convertAidlNanSubscribeRequestToLegacy(msg, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanSubscribeRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiNanIface::stopSubscribeRequestInternal(char16_t cmd_id, int8_t sessionId) { + legacy_hal::NanSubscribeCancelRequest legacy_msg; + legacy_msg.subscribe_id = sessionId; + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanSubscribeCancelRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiNanIface::transmitFollowupRequestInternal( + char16_t cmd_id, const NanTransmitFollowupRequest& msg) { + legacy_hal::NanTransmitFollowupRequest legacy_msg; + if (!aidl_struct_util::convertAidlNanTransmitFollowupRequestToLegacy(msg, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanTransmitFollowupRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiNanIface::createDataInterfaceRequestInternal(char16_t cmd_id, + const std::string& iface_name) { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanDataInterfaceCreate(ifname_, cmd_id, iface_name); + return createWifiStatusFromLegacyError(legacy_status); +} +ndk::ScopedAStatus WifiNanIface::deleteDataInterfaceRequestInternal(char16_t cmd_id, + const std::string& iface_name) { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanDataInterfaceDelete(ifname_, cmd_id, iface_name); + return createWifiStatusFromLegacyError(legacy_status); +} +ndk::ScopedAStatus WifiNanIface::initiateDataPathRequestInternal( + char16_t cmd_id, const NanInitiateDataPathRequest& msg) { + legacy_hal::NanDataPathInitiatorRequest legacy_msg; + if (!aidl_struct_util::convertAidlNanDataPathInitiatorRequestToLegacy(msg, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanDataRequestInitiator(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} +ndk::ScopedAStatus WifiNanIface::respondToDataPathIndicationRequestInternal( + char16_t cmd_id, const NanRespondToDataPathIndicationRequest& msg) { + legacy_hal::NanDataPathIndicationResponse legacy_msg; + if (!aidl_struct_util::convertAidlNanDataPathIndicationResponseToLegacy(msg, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanDataIndicationResponse(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} +ndk::ScopedAStatus WifiNanIface::terminateDataPathRequestInternal(char16_t cmd_id, + int32_t ndpInstanceId) { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanDataEnd(ifname_, cmd_id, ndpInstanceId); + return createWifiStatusFromLegacyError(legacy_status); +} + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/wifi_nan_iface.h b/wifi/aidl/default/wifi_nan_iface.h new file mode 100644 index 0000000000..101890594c --- /dev/null +++ b/wifi/aidl/default/wifi_nan_iface.h @@ -0,0 +1,134 @@ +/* + * 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. + */ + +#ifndef WIFI_NAN_IFACE_H_ +#define WIFI_NAN_IFACE_H_ + +#include +#include +#include + +#include "aidl_callback_util.h" +#include "wifi_iface_util.h" +#include "wifi_legacy_hal.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { + +/** + * AIDL interface object used to control a NAN Iface instance. + */ +class WifiNanIface : public BnWifiNanIface { + public: + WifiNanIface(const std::string& ifname, bool is_dedicated_iface, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util); + + // Factory method - use instead of default constructor. + static std::shared_ptr create( + const std::string& ifname, bool is_dedicated_iface, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util); + + // Refer to |WifiChip::invalidate()|. + void invalidate(); + bool isValid(); + std::string getName(); + + // AIDL methods exposed. + ndk::ScopedAStatus getName(std::string* _aidl_return) override; + ndk::ScopedAStatus registerEventCallback( + const std::shared_ptr& in_callback) override; + ndk::ScopedAStatus getCapabilitiesRequest(char16_t in_cmdId) override; + ndk::ScopedAStatus enableRequest(char16_t in_cmdId, const NanEnableRequest& in_msg1, + const NanConfigRequestSupplemental& in_msg2) override; + ndk::ScopedAStatus configRequest(char16_t in_cmdId, const NanConfigRequest& in_msg1, + const NanConfigRequestSupplemental& in_msg2) override; + ndk::ScopedAStatus disableRequest(char16_t in_cmdId) override; + ndk::ScopedAStatus startPublishRequest(char16_t in_cmdId, + const NanPublishRequest& in_msg) override; + ndk::ScopedAStatus stopPublishRequest(char16_t in_cmdId, int8_t in_sessionId) override; + ndk::ScopedAStatus startSubscribeRequest(char16_t in_cmdId, + const NanSubscribeRequest& in_msg) override; + ndk::ScopedAStatus stopSubscribeRequest(char16_t in_cmdId, int8_t in_sessionId) override; + ndk::ScopedAStatus transmitFollowupRequest(char16_t in_cmdId, + const NanTransmitFollowupRequest& in_msg) override; + ndk::ScopedAStatus createDataInterfaceRequest(char16_t in_cmdId, + const std::string& in_ifaceName) override; + ndk::ScopedAStatus deleteDataInterfaceRequest(char16_t in_cmdId, + const std::string& in_ifaceName) override; + ndk::ScopedAStatus initiateDataPathRequest(char16_t in_cmdId, + const NanInitiateDataPathRequest& in_msg) override; + ndk::ScopedAStatus respondToDataPathIndicationRequest( + char16_t in_cmdId, const NanRespondToDataPathIndicationRequest& in_msg) override; + ndk::ScopedAStatus terminateDataPathRequest(char16_t in_cmdId, + int32_t in_ndpInstanceId) override; + + protected: + // Accessible to child class in the gTest suite. + void setWeakPtr(std::weak_ptr ptr); + void registerCallbackHandlers(); + + private: + // Corresponding worker functions for the AIDL methods. + std::pair getNameInternal(); + ndk::ScopedAStatus registerEventCallbackInternal( + const std::shared_ptr& callback); + ndk::ScopedAStatus getCapabilitiesRequestInternal(char16_t cmd_id); + ndk::ScopedAStatus enableRequestInternal(char16_t cmd_id, const NanEnableRequest& msg1, + const NanConfigRequestSupplemental& msg2); + ndk::ScopedAStatus configRequestInternal(char16_t cmd_id, const NanConfigRequest& msg1, + const NanConfigRequestSupplemental& msg2); + ndk::ScopedAStatus disableRequestInternal(char16_t cmd_id); + ndk::ScopedAStatus startPublishRequestInternal(char16_t cmd_id, const NanPublishRequest& msg); + ndk::ScopedAStatus stopPublishRequestInternal(char16_t cmd_id, int8_t sessionId); + ndk::ScopedAStatus startSubscribeRequestInternal(char16_t cmd_id, + const NanSubscribeRequest& msg); + ndk::ScopedAStatus stopSubscribeRequestInternal(char16_t cmd_id, int8_t sessionId); + ndk::ScopedAStatus transmitFollowupRequestInternal(char16_t cmd_id, + const NanTransmitFollowupRequest& msg); + ndk::ScopedAStatus createDataInterfaceRequestInternal(char16_t cmd_id, + const std::string& iface_name); + ndk::ScopedAStatus deleteDataInterfaceRequestInternal(char16_t cmd_id, + const std::string& iface_name); + ndk::ScopedAStatus initiateDataPathRequestInternal(char16_t cmd_id, + const NanInitiateDataPathRequest& msg); + ndk::ScopedAStatus respondToDataPathIndicationRequestInternal( + char16_t cmd_id, const NanRespondToDataPathIndicationRequest& msg); + ndk::ScopedAStatus terminateDataPathRequestInternal(char16_t cmd_id, int32_t ndpInstanceId); + + // Overridden in the gTest suite. + virtual std::set> getEventCallbacks(); + + std::string ifname_; + bool is_dedicated_iface_; + std::weak_ptr legacy_hal_; + std::weak_ptr iface_util_; + bool is_valid_; + std::weak_ptr weak_ptr_this_; + aidl_callback_util::AidlCallbackHandler event_cb_handler_; + + DISALLOW_COPY_AND_ASSIGN(WifiNanIface); +}; + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // WIFI_NAN_IFACE_H_ diff --git a/wifi/aidl/default/wifi_p2p_iface.cpp b/wifi/aidl/default/wifi_p2p_iface.cpp new file mode 100644 index 0000000000..48ec6d6d87 --- /dev/null +++ b/wifi/aidl/default/wifi_p2p_iface.cpp @@ -0,0 +1,59 @@ +/* + * 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. + */ + +#include "wifi_p2p_iface.h" + +#include + +#include "aidl_return_util.h" +#include "wifi_status_util.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +using aidl_return_util::validateAndCall; + +WifiP2pIface::WifiP2pIface(const std::string& ifname, + const std::weak_ptr legacy_hal) + : ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {} + +void WifiP2pIface::invalidate() { + legacy_hal_.reset(); + is_valid_ = false; +} + +bool WifiP2pIface::isValid() { + return is_valid_; +} + +std::string WifiP2pIface::getName() { + return ifname_; +} + +ndk::ScopedAStatus WifiP2pIface::getName(std::string* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiP2pIface::getNameInternal, _aidl_return); +} + +std::pair WifiP2pIface::getNameInternal() { + return {ifname_, ndk::ScopedAStatus::ok()}; +} + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/wifi_p2p_iface.h b/wifi/aidl/default/wifi_p2p_iface.h new file mode 100644 index 0000000000..d17470ed23 --- /dev/null +++ b/wifi/aidl/default/wifi_p2p_iface.h @@ -0,0 +1,61 @@ +/* + * 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. + */ + +#ifndef WIFI_P2P_IFACE_H_ +#define WIFI_P2P_IFACE_H_ + +#include +#include + +#include "wifi_legacy_hal.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { + +/** + * AIDL interface object used to control a P2P Iface instance. + */ +class WifiP2pIface : public BnWifiP2pIface { + public: + WifiP2pIface(const std::string& ifname, + const std::weak_ptr legacy_hal); + // Refer to |WifiChip::invalidate()|. + void invalidate(); + bool isValid(); + std::string getName(); + + // AIDL methods exposed. + ndk::ScopedAStatus getName(std::string* _aidl_return) override; + + private: + // Corresponding worker functions for the AIDL methods. + std::pair getNameInternal(); + + std::string ifname_; + std::weak_ptr legacy_hal_; + bool is_valid_; + + DISALLOW_COPY_AND_ASSIGN(WifiP2pIface); +}; + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // WIFI_P2P_IFACE_H_ diff --git a/wifi/aidl/default/wifi_rtt_controller.cpp b/wifi/aidl/default/wifi_rtt_controller.cpp new file mode 100644 index 0000000000..856c3cd054 --- /dev/null +++ b/wifi/aidl/default/wifi_rtt_controller.cpp @@ -0,0 +1,255 @@ +/* + * 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. + */ + +#include "wifi_rtt_controller.h" + +#include + +#include "aidl_return_util.h" +#include "aidl_struct_util.h" +#include "wifi_status_util.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +using aidl_return_util::validateAndCall; + +WifiRttController::WifiRttController(const std::string& iface_name, + const std::shared_ptr& bound_iface, + const std::weak_ptr legacy_hal) + : ifname_(iface_name), bound_iface_(bound_iface), legacy_hal_(legacy_hal), is_valid_(true) {} + +std::shared_ptr WifiRttController::create( + const std::string& iface_name, const std::shared_ptr& bound_iface, + const std::weak_ptr legacy_hal) { + std::shared_ptr ptr = + ndk::SharedRefBase::make(iface_name, bound_iface, legacy_hal); + std::weak_ptr weak_ptr_this(ptr); + ptr->setWeakPtr(weak_ptr_this); + return ptr; +} + +void WifiRttController::invalidate() { + legacy_hal_.reset(); + event_callbacks_.clear(); + is_valid_ = false; +}; + +bool WifiRttController::isValid() { + return is_valid_; +} + +void WifiRttController::setWeakPtr(std::weak_ptr ptr) { + weak_ptr_this_ = ptr; +} + +std::vector> +WifiRttController::getEventCallbacks() { + return event_callbacks_; +} + +std::string WifiRttController::getIfaceName() { + return ifname_; +} + +ndk::ScopedAStatus WifiRttController::getBoundIface(std::shared_ptr* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::getBoundIfaceInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiRttController::registerEventCallback( + const std::shared_ptr& callback) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::registerEventCallbackInternal, callback); +} + +ndk::ScopedAStatus WifiRttController::rangeRequest(int32_t in_cmdId, + const std::vector& in_rttConfigs) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::rangeRequestInternal, in_cmdId, in_rttConfigs); +} + +ndk::ScopedAStatus WifiRttController::rangeCancel(int32_t in_cmdId, + const std::vector& in_addrs) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::rangeCancelInternal, in_cmdId, in_addrs); +} + +ndk::ScopedAStatus WifiRttController::getCapabilities(RttCapabilities* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::getCapabilitiesInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiRttController::setLci(int32_t in_cmdId, const RttLciInformation& in_lci) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::setLciInternal, in_cmdId, in_lci); +} + +ndk::ScopedAStatus WifiRttController::setLcr(int32_t in_cmdId, const RttLcrInformation& in_lcr) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::setLcrInternal, in_cmdId, in_lcr); +} + +ndk::ScopedAStatus WifiRttController::getResponderInfo(RttResponder* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::getResponderInfoInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiRttController::enableResponder(int32_t in_cmdId, + const WifiChannelInfo& in_channelHint, + int32_t in_maxDurationInSeconds, + const RttResponder& in_info) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::enableResponderInternal, in_cmdId, in_channelHint, + in_maxDurationInSeconds, in_info); +} + +ndk::ScopedAStatus WifiRttController::disableResponder(int32_t in_cmdId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, + &WifiRttController::disableResponderInternal, in_cmdId); +} + +std::pair, ndk::ScopedAStatus> +WifiRttController::getBoundIfaceInternal() { + return {bound_iface_, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiRttController::registerEventCallbackInternal( + const std::shared_ptr& callback) { + event_callbacks_.emplace_back(callback); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus WifiRttController::rangeRequestInternal( + int32_t cmd_id, const std::vector& rtt_configs) { + std::vector legacy_configs; + if (!aidl_struct_util::convertAidlVectorOfRttConfigToLegacy(rtt_configs, &legacy_configs)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + std::weak_ptr weak_ptr_this = weak_ptr_this_; + const auto& on_results_callback = + [weak_ptr_this](legacy_hal::wifi_request_id id, + const std::vector& results) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + std::vector aidl_results; + if (!aidl_struct_util::convertLegacyVectorOfRttResultToAidl(results, + &aidl_results)) { + LOG(ERROR) << "Failed to convert rtt results to AIDL structs"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onResults(id, aidl_results).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startRttRangeRequest( + ifname_, cmd_id, legacy_configs, on_results_callback); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiRttController::rangeCancelInternal(int32_t cmd_id, + const std::vector& addrs) { + std::vector> legacy_addrs; + for (const auto& addr : addrs) { + std::array addr_array; + std::copy_n(addr.data.begin(), ETH_ALEN, addr_array.begin()); + legacy_addrs.push_back(addr_array); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->cancelRttRangeRequest(ifname_, cmd_id, legacy_addrs); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair WifiRttController::getCapabilitiesInternal() { + legacy_hal::wifi_error legacy_status; + legacy_hal::wifi_rtt_capabilities legacy_caps; + std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getRttCapabilities(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {RttCapabilities{}, createWifiStatusFromLegacyError(legacy_status)}; + } + RttCapabilities aidl_caps; + if (!aidl_struct_util::convertLegacyRttCapabilitiesToAidl(legacy_caps, &aidl_caps)) { + return {RttCapabilities{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {aidl_caps, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiRttController::setLciInternal(int32_t cmd_id, const RttLciInformation& lci) { + legacy_hal::wifi_lci_information legacy_lci; + if (!aidl_struct_util::convertAidlRttLciInformationToLegacy(lci, &legacy_lci)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->setRttLci(ifname_, cmd_id, legacy_lci); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiRttController::setLcrInternal(int32_t cmd_id, const RttLcrInformation& lcr) { + legacy_hal::wifi_lcr_information legacy_lcr; + if (!aidl_struct_util::convertAidlRttLcrInformationToLegacy(lcr, &legacy_lcr)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->setRttLcr(ifname_, cmd_id, legacy_lcr); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair WifiRttController::getResponderInfoInternal() { + legacy_hal::wifi_error legacy_status; + legacy_hal::wifi_rtt_responder legacy_responder; + std::tie(legacy_status, legacy_responder) = legacy_hal_.lock()->getRttResponderInfo(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {RttResponder{}, createWifiStatusFromLegacyError(legacy_status)}; + } + RttResponder aidl_responder; + if (!aidl_struct_util::convertLegacyRttResponderToAidl(legacy_responder, &aidl_responder)) { + return {RttResponder{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {aidl_responder, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiRttController::enableResponderInternal(int32_t cmd_id, + const WifiChannelInfo& channel_hint, + int32_t max_duration_seconds, + const RttResponder& info) { + legacy_hal::wifi_channel_info legacy_channel_info; + if (!aidl_struct_util::convertAidlWifiChannelInfoToLegacy(channel_hint, &legacy_channel_info)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_rtt_responder legacy_responder; + if (!aidl_struct_util::convertAidlRttResponderToLegacy(info, &legacy_responder)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->enableRttResponder( + ifname_, cmd_id, legacy_channel_info, max_duration_seconds, legacy_responder); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiRttController::disableResponderInternal(int32_t cmd_id) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->disableRttResponder(ifname_, cmd_id); + return createWifiStatusFromLegacyError(legacy_status); +} + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/wifi_rtt_controller.h b/wifi/aidl/default/wifi_rtt_controller.h new file mode 100644 index 0000000000..db690c3ad3 --- /dev/null +++ b/wifi/aidl/default/wifi_rtt_controller.h @@ -0,0 +1,102 @@ +/* + * 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. + */ + +#ifndef WIFI_RTT_CONTROLLER_H_ +#define WIFI_RTT_CONTROLLER_H_ + +#include +#include +#include +#include + +#include "wifi_legacy_hal.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { + +/** + * AIDL interface object used to control all RTT operations. + */ +class WifiRttController : public BnWifiRttController { + public: + WifiRttController(const std::string& iface_name, + const std::shared_ptr& bound_iface, + const std::weak_ptr legacy_hal); + // Factory method - use instead of default constructor. + static std::shared_ptr create( + const std::string& iface_name, const std::shared_ptr& bound_iface, + const std::weak_ptr legacy_hal); + + // Refer to |WifiChip::invalidate()|. + void invalidate(); + bool isValid(); + std::vector> getEventCallbacks(); + std::string getIfaceName(); + + // AIDL methods exposed. + ndk::ScopedAStatus getBoundIface(std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus registerEventCallback( + const std::shared_ptr& callback) override; + ndk::ScopedAStatus rangeRequest(int32_t in_cmdId, + const std::vector& in_rttConfigs) override; + ndk::ScopedAStatus rangeCancel(int32_t in_cmdId, + const std::vector& in_addrs) override; + ndk::ScopedAStatus getCapabilities(RttCapabilities* _aidl_return) override; + ndk::ScopedAStatus setLci(int32_t in_cmdId, const RttLciInformation& in_lci) override; + ndk::ScopedAStatus setLcr(int32_t in_cmdId, const RttLcrInformation& in_lcr) override; + ndk::ScopedAStatus getResponderInfo(RttResponder* _aidl_return) override; + ndk::ScopedAStatus enableResponder(int32_t in_cmdId, const WifiChannelInfo& in_channelHint, + int32_t in_maxDurationInSeconds, + const RttResponder& in_info) override; + ndk::ScopedAStatus disableResponder(int32_t in_cmdId) override; + + private: + // Corresponding worker functions for the AIDL methods. + std::pair, ndk::ScopedAStatus> getBoundIfaceInternal(); + ndk::ScopedAStatus registerEventCallbackInternal( + const std::shared_ptr& callback); + ndk::ScopedAStatus rangeRequestInternal(int32_t cmd_id, + const std::vector& rtt_configs); + ndk::ScopedAStatus rangeCancelInternal(int32_t cmd_id, const std::vector& addrs); + std::pair getCapabilitiesInternal(); + ndk::ScopedAStatus setLciInternal(int32_t cmd_id, const RttLciInformation& lci); + ndk::ScopedAStatus setLcrInternal(int32_t cmd_id, const RttLcrInformation& lcr); + std::pair getResponderInfoInternal(); + ndk::ScopedAStatus enableResponderInternal(int32_t cmd_id, const WifiChannelInfo& channel_hint, + int32_t max_duration_seconds, + const RttResponder& info); + ndk::ScopedAStatus disableResponderInternal(int32_t cmd_id); + + void setWeakPtr(std::weak_ptr ptr); + + std::string ifname_; + std::shared_ptr bound_iface_; + std::weak_ptr legacy_hal_; + std::vector> event_callbacks_; + std::weak_ptr weak_ptr_this_; + bool is_valid_; + + DISALLOW_COPY_AND_ASSIGN(WifiRttController); +}; + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // WIFI_RTT_CONTROLLER_H_ diff --git a/wifi/aidl/default/wifi_sta_iface.cpp b/wifi/aidl/default/wifi_sta_iface.cpp new file mode 100644 index 0000000000..ce90349bc5 --- /dev/null +++ b/wifi/aidl/default/wifi_sta_iface.cpp @@ -0,0 +1,558 @@ +/* + * 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. + */ + +#include "wifi_sta_iface.h" + +#include + +#include "aidl_return_util.h" +#include "aidl_struct_util.h" +#include "wifi_status_util.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +using aidl_return_util::validateAndCall; + +WifiStaIface::WifiStaIface(const std::string& ifname, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util) + : ifname_(ifname), legacy_hal_(legacy_hal), iface_util_(iface_util), is_valid_(true) { + // Turn on DFS channel usage for STA iface. + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->setDfsFlag(ifname_, true); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to set DFS flag; DFS channels may be unavailable."; + } +} + +std::shared_ptr WifiStaIface::create( + const std::string& ifname, const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util) { + std::shared_ptr ptr = + ndk::SharedRefBase::make(ifname, legacy_hal, iface_util); + std::weak_ptr weak_ptr_this(ptr); + ptr->setWeakPtr(weak_ptr_this); + return ptr; +} + +void WifiStaIface::invalidate() { + legacy_hal_.reset(); + event_cb_handler_.invalidate(); + is_valid_ = false; +} + +void WifiStaIface::setWeakPtr(std::weak_ptr ptr) { + weak_ptr_this_ = ptr; +} + +bool WifiStaIface::isValid() { + return is_valid_; +} + +std::string WifiStaIface::getName() { + return ifname_; +} + +std::set> WifiStaIface::getEventCallbacks() { + return event_cb_handler_.getCallbacks(); +} + +ndk::ScopedAStatus WifiStaIface::getName(std::string* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getNameInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiStaIface::registerEventCallback( + const std::shared_ptr& in_callback) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::registerEventCallbackInternal, in_callback); +} + +ndk::ScopedAStatus WifiStaIface::getCapabilities( + IWifiStaIface::StaIfaceCapabilityMask* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getCapabilitiesInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiStaIface::getApfPacketFilterCapabilities( + StaApfPacketFilterCapabilities* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getApfPacketFilterCapabilitiesInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiStaIface::installApfPacketFilter(const std::vector& in_program) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::installApfPacketFilterInternal, in_program); +} + +ndk::ScopedAStatus WifiStaIface::readApfPacketFilterData(std::vector* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::readApfPacketFilterDataInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiStaIface::getBackgroundScanCapabilities( + StaBackgroundScanCapabilities* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getBackgroundScanCapabilitiesInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiStaIface::getValidFrequenciesForBand(WifiBand in_band, + std::vector* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getValidFrequenciesForBandInternal, _aidl_return, + in_band); +} + +ndk::ScopedAStatus WifiStaIface::startBackgroundScan(int32_t in_cmdId, + const StaBackgroundScanParameters& in_params) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::startBackgroundScanInternal, in_cmdId, in_params); +} + +ndk::ScopedAStatus WifiStaIface::stopBackgroundScan(int32_t in_cmdId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::stopBackgroundScanInternal, in_cmdId); +} + +ndk::ScopedAStatus WifiStaIface::enableLinkLayerStatsCollection(bool in_debug) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::enableLinkLayerStatsCollectionInternal, in_debug); +} + +ndk::ScopedAStatus WifiStaIface::disableLinkLayerStatsCollection() { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::disableLinkLayerStatsCollectionInternal); +} + +ndk::ScopedAStatus WifiStaIface::getLinkLayerStats(StaLinkLayerStats* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getLinkLayerStatsInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiStaIface::startRssiMonitoring(int32_t in_cmdId, int32_t in_maxRssi, + int32_t in_minRssi) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::startRssiMonitoringInternal, in_cmdId, in_maxRssi, + in_minRssi); +} + +ndk::ScopedAStatus WifiStaIface::stopRssiMonitoring(int32_t in_cmdId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::stopRssiMonitoringInternal, in_cmdId); +} + +ndk::ScopedAStatus WifiStaIface::getRoamingCapabilities(StaRoamingCapabilities* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getRoamingCapabilitiesInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiStaIface::configureRoaming(const StaRoamingConfig& in_config) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::configureRoamingInternal, in_config); +} + +ndk::ScopedAStatus WifiStaIface::setRoamingState(StaRoamingState in_state) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::setRoamingStateInternal, in_state); +} + +ndk::ScopedAStatus WifiStaIface::enableNdOffload(bool in_enable) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::enableNdOffloadInternal, in_enable); +} + +ndk::ScopedAStatus WifiStaIface::startSendingKeepAlivePackets( + int32_t in_cmdId, const std::vector& in_ipPacketData, char16_t in_etherType, + const std::array& in_srcAddress, const std::array& in_dstAddress, + int32_t in_periodInMs) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::startSendingKeepAlivePacketsInternal, in_cmdId, + in_ipPacketData, in_etherType, in_srcAddress, in_dstAddress, + in_periodInMs); +} + +ndk::ScopedAStatus WifiStaIface::stopSendingKeepAlivePackets(int32_t in_cmdId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::stopSendingKeepAlivePacketsInternal, in_cmdId); +} + +ndk::ScopedAStatus WifiStaIface::startDebugPacketFateMonitoring() { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::startDebugPacketFateMonitoringInternal); +} + +ndk::ScopedAStatus WifiStaIface::getDebugTxPacketFates( + std::vector* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getDebugTxPacketFatesInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiStaIface::getDebugRxPacketFates( + std::vector* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getDebugRxPacketFatesInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiStaIface::setMacAddress(const std::array& in_mac) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::setMacAddressInternal, in_mac); +} + +ndk::ScopedAStatus WifiStaIface::getFactoryMacAddress(std::array* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::getFactoryMacAddressInternal, _aidl_return); +} + +ndk::ScopedAStatus WifiStaIface::setScanMode(bool in_enable) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::setScanModeInternal, in_enable); +} + +std::pair WifiStaIface::getNameInternal() { + return {ifname_, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiStaIface::registerEventCallbackInternal( + const std::shared_ptr& callback) { + if (!event_cb_handler_.addCallback(callback)) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + return ndk::ScopedAStatus::ok(); +} + +std::pair +WifiStaIface::getCapabilitiesInternal() { + legacy_hal::wifi_error legacy_status; + uint64_t legacy_feature_set; + std::tie(legacy_status, legacy_feature_set) = + legacy_hal_.lock()->getSupportedFeatureSet(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {IWifiStaIface::StaIfaceCapabilityMask{}, + createWifiStatusFromLegacyError(legacy_status)}; + } + uint32_t legacy_logger_feature_set; + std::tie(legacy_status, legacy_logger_feature_set) = + legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + // some devices don't support querying logger feature set + legacy_logger_feature_set = 0; + } + uint32_t aidl_caps; + if (!aidl_struct_util::convertLegacyFeaturesToAidlStaCapabilities( + legacy_feature_set, legacy_logger_feature_set, &aidl_caps)) { + return {IWifiStaIface::StaIfaceCapabilityMask{}, + createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {static_cast(aidl_caps), + ndk::ScopedAStatus::ok()}; +} + +std::pair +WifiStaIface::getApfPacketFilterCapabilitiesInternal() { + legacy_hal::wifi_error legacy_status; + legacy_hal::PacketFilterCapabilities legacy_caps; + std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getPacketFilterCapabilities(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {StaApfPacketFilterCapabilities{}, createWifiStatusFromLegacyError(legacy_status)}; + } + StaApfPacketFilterCapabilities aidl_caps; + if (!aidl_struct_util::convertLegacyApfCapabilitiesToAidl(legacy_caps, &aidl_caps)) { + return {StaApfPacketFilterCapabilities{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {aidl_caps, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiStaIface::installApfPacketFilterInternal( + const std::vector& program) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->setPacketFilter(ifname_, program); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair, ndk::ScopedAStatus> +WifiStaIface::readApfPacketFilterDataInternal() { + const std::pair> legacy_status_and_data = + legacy_hal_.lock()->readApfPacketFilterData(ifname_); + return {std::move(legacy_status_and_data.second), + createWifiStatusFromLegacyError(legacy_status_and_data.first)}; +} + +std::pair +WifiStaIface::getBackgroundScanCapabilitiesInternal() { + legacy_hal::wifi_error legacy_status; + legacy_hal::wifi_gscan_capabilities legacy_caps; + std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getGscanCapabilities(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {StaBackgroundScanCapabilities{}, createWifiStatusFromLegacyError(legacy_status)}; + } + StaBackgroundScanCapabilities aidl_caps; + if (!aidl_struct_util::convertLegacyGscanCapabilitiesToAidl(legacy_caps, &aidl_caps)) { + return {StaBackgroundScanCapabilities{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {aidl_caps, ndk::ScopedAStatus::ok()}; +} + +std::pair, ndk::ScopedAStatus> +WifiStaIface::getValidFrequenciesForBandInternal(WifiBand band) { + static_assert(sizeof(WifiChannelWidthInMhz) == sizeof(int32_t), "Size mismatch"); + legacy_hal::wifi_error legacy_status; + std::vector valid_frequencies; + std::tie(legacy_status, valid_frequencies) = legacy_hal_.lock()->getValidFrequenciesForBand( + ifname_, aidl_struct_util::convertAidlWifiBandToLegacy(band)); + return {std::vector(valid_frequencies.begin(), valid_frequencies.end()), + createWifiStatusFromLegacyError(legacy_status)}; +} + +ndk::ScopedAStatus WifiStaIface::startBackgroundScanInternal( + int32_t cmd_id, const StaBackgroundScanParameters& params) { + legacy_hal::wifi_scan_cmd_params legacy_params; + if (!aidl_struct_util::convertAidlGscanParamsToLegacy(params, &legacy_params)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + std::weak_ptr weak_ptr_this = weak_ptr_this_; + const auto& on_failure_callback = [weak_ptr_this](legacy_hal::wifi_request_id id) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onBackgroundScanFailure(id).isOk()) { + LOG(ERROR) << "Failed to invoke onBackgroundScanFailure callback"; + } + } + }; + const auto& on_results_callback = + [weak_ptr_this](legacy_hal::wifi_request_id id, + const std::vector& results) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + std::vector aidl_scan_datas; + if (!aidl_struct_util::convertLegacyVectorOfCachedGscanResultsToAidl( + results, &aidl_scan_datas)) { + LOG(ERROR) << "Failed to convert scan results to AIDL structs"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onBackgroundScanResults(id, aidl_scan_datas).isOk()) { + LOG(ERROR) << "Failed to invoke onBackgroundScanResults callback"; + } + } + }; + const auto& on_full_result_callback = [weak_ptr_this]( + legacy_hal::wifi_request_id id, + const legacy_hal::wifi_scan_result* result, + uint32_t buckets_scanned) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + StaScanResult aidl_scan_result; + if (!aidl_struct_util::convertLegacyGscanResultToAidl(*result, true, &aidl_scan_result)) { + LOG(ERROR) << "Failed to convert full scan results to AIDL structs"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onBackgroundFullScanResult(id, buckets_scanned, aidl_scan_result) + .isOk()) { + LOG(ERROR) << "Failed to invoke onBackgroundFullScanResult callback"; + } + } + }; + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->startGscan(ifname_, cmd_id, legacy_params, on_failure_callback, + on_results_callback, on_full_result_callback); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiStaIface::stopBackgroundScanInternal(int32_t cmd_id) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->stopGscan(ifname_, cmd_id); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiStaIface::enableLinkLayerStatsCollectionInternal(bool debug) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->enableLinkLayerStats(ifname_, debug); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiStaIface::disableLinkLayerStatsCollectionInternal() { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->disableLinkLayerStats(ifname_); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair WifiStaIface::getLinkLayerStatsInternal() { + legacy_hal::wifi_error legacy_status; + legacy_hal::LinkLayerStats legacy_stats; + std::tie(legacy_status, legacy_stats) = legacy_hal_.lock()->getLinkLayerStats(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {StaLinkLayerStats{}, createWifiStatusFromLegacyError(legacy_status)}; + } + StaLinkLayerStats aidl_stats; + if (!aidl_struct_util::convertLegacyLinkLayerStatsToAidl(legacy_stats, &aidl_stats)) { + return {StaLinkLayerStats{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {aidl_stats, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiStaIface::startRssiMonitoringInternal(int32_t cmd_id, int32_t max_rssi, + int32_t min_rssi) { + std::weak_ptr weak_ptr_this = weak_ptr_this_; + const auto& on_threshold_breached_callback = + [weak_ptr_this](legacy_hal::wifi_request_id id, std::array bssid, + int8_t rssi) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onRssiThresholdBreached(id, bssid, rssi).isOk()) { + LOG(ERROR) << "Failed to invoke onRssiThresholdBreached callback"; + } + } + }; + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startRssiMonitoring( + ifname_, cmd_id, max_rssi, min_rssi, on_threshold_breached_callback); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiStaIface::stopRssiMonitoringInternal(int32_t cmd_id) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->stopRssiMonitoring(ifname_, cmd_id); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair +WifiStaIface::getRoamingCapabilitiesInternal() { + legacy_hal::wifi_error legacy_status; + legacy_hal::wifi_roaming_capabilities legacy_caps; + std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getRoamingCapabilities(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {StaRoamingCapabilities{}, createWifiStatusFromLegacyError(legacy_status)}; + } + StaRoamingCapabilities aidl_caps; + if (!aidl_struct_util::convertLegacyRoamingCapabilitiesToAidl(legacy_caps, &aidl_caps)) { + return {StaRoamingCapabilities{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {aidl_caps, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiStaIface::configureRoamingInternal(const StaRoamingConfig& config) { + legacy_hal::wifi_roaming_config legacy_config; + if (!aidl_struct_util::convertAidlRoamingConfigToLegacy(config, &legacy_config)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->configureRoaming(ifname_, legacy_config); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiStaIface::setRoamingStateInternal(StaRoamingState state) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->enableFirmwareRoaming( + ifname_, aidl_struct_util::convertAidlRoamingStateToLegacy(state)); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiStaIface::enableNdOffloadInternal(bool enable) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->configureNdOffload(ifname_, enable); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiStaIface::startSendingKeepAlivePacketsInternal( + int32_t cmd_id, const std::vector& ip_packet_data, char16_t ether_type, + const std::array& src_address, const std::array& dst_address, + int32_t period_in_ms) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startSendingOffloadedPacket( + ifname_, cmd_id, ether_type, ip_packet_data, src_address, dst_address, period_in_ms); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiStaIface::stopSendingKeepAlivePacketsInternal(int32_t cmd_id) { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->stopSendingOffloadedPacket(ifname_, cmd_id); + return createWifiStatusFromLegacyError(legacy_status); +} + +ndk::ScopedAStatus WifiStaIface::startDebugPacketFateMonitoringInternal() { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startPktFateMonitoring(ifname_); + return createWifiStatusFromLegacyError(legacy_status); +} + +std::pair, ndk::ScopedAStatus> +WifiStaIface::getDebugTxPacketFatesInternal() { + legacy_hal::wifi_error legacy_status; + std::vector legacy_fates; + std::tie(legacy_status, legacy_fates) = legacy_hal_.lock()->getTxPktFates(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {std::vector(), + createWifiStatusFromLegacyError(legacy_status)}; + } + std::vector aidl_fates; + if (!aidl_struct_util::convertLegacyVectorOfDebugTxPacketFateToAidl(legacy_fates, + &aidl_fates)) { + return {std::vector(), + createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {aidl_fates, ndk::ScopedAStatus::ok()}; +} + +std::pair, ndk::ScopedAStatus> +WifiStaIface::getDebugRxPacketFatesInternal() { + legacy_hal::wifi_error legacy_status; + std::vector legacy_fates; + std::tie(legacy_status, legacy_fates) = legacy_hal_.lock()->getRxPktFates(ifname_); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {std::vector(), + createWifiStatusFromLegacyError(legacy_status)}; + } + std::vector aidl_fates; + if (!aidl_struct_util::convertLegacyVectorOfDebugRxPacketFateToAidl(legacy_fates, + &aidl_fates)) { + return {std::vector(), + createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {aidl_fates, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiStaIface::setMacAddressInternal(const std::array& mac) { + bool status = iface_util_.lock()->setMacAddress(ifname_, mac); + if (!status) { + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); + } + return ndk::ScopedAStatus::ok(); +} + +std::pair, ndk::ScopedAStatus> WifiStaIface::getFactoryMacAddressInternal() { + std::array mac = iface_util_.lock()->getFactoryMacAddress(ifname_); + if (mac[0] == 0 && mac[1] == 0 && mac[2] == 0 && mac[3] == 0 && mac[4] == 0 && mac[5] == 0) { + return {mac, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + return {mac, ndk::ScopedAStatus::ok()}; +} + +ndk::ScopedAStatus WifiStaIface::setScanModeInternal(bool enable) { + // OEM's need to implement this on their devices if needed. + LOG(WARNING) << "setScanModeInternal(" << enable << ") not supported"; + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/wifi_sta_iface.h b/wifi/aidl/default/wifi_sta_iface.h new file mode 100644 index 0000000000..8ac3470edb --- /dev/null +++ b/wifi/aidl/default/wifi_sta_iface.h @@ -0,0 +1,154 @@ +/* + * 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. + */ + +#ifndef WIFI_STA_IFACE_H_ +#define WIFI_STA_IFACE_H_ + +#include +#include +#include + +#include "aidl_callback_util.h" +#include "wifi_iface_util.h" +#include "wifi_legacy_hal.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { + +/** + * AIDL interface object used to control a STA Iface instance. + */ +class WifiStaIface : public BnWifiStaIface { + public: + WifiStaIface(const std::string& ifname, + const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util); + + // Factory method - use instead of default constructor. + static std::shared_ptr create( + const std::string& ifname, const std::weak_ptr legacy_hal, + const std::weak_ptr iface_util); + + // Refer to |WifiChip::invalidate()|. + void invalidate(); + bool isValid(); + std::set> getEventCallbacks(); + std::string getName(); + + // AIDL methods exposed. + ndk::ScopedAStatus getName(std::string* _aidl_return) override; + ndk::ScopedAStatus registerEventCallback( + const std::shared_ptr& in_callback) override; + ndk::ScopedAStatus getCapabilities( + IWifiStaIface::StaIfaceCapabilityMask* _aidl_return) override; + ndk::ScopedAStatus getApfPacketFilterCapabilities( + StaApfPacketFilterCapabilities* _aidl_return) override; + ndk::ScopedAStatus installApfPacketFilter(const std::vector& in_program) override; + ndk::ScopedAStatus readApfPacketFilterData(std::vector* _aidl_return) override; + ndk::ScopedAStatus getBackgroundScanCapabilities( + StaBackgroundScanCapabilities* _aidl_return) override; + ndk::ScopedAStatus getValidFrequenciesForBand(WifiBand in_band, + std::vector* _aidl_return) override; + ndk::ScopedAStatus startBackgroundScan(int32_t in_cmdId, + const StaBackgroundScanParameters& in_params) override; + ndk::ScopedAStatus stopBackgroundScan(int32_t in_cmdId) override; + ndk::ScopedAStatus enableLinkLayerStatsCollection(bool in_debug) override; + ndk::ScopedAStatus disableLinkLayerStatsCollection() override; + ndk::ScopedAStatus getLinkLayerStats(StaLinkLayerStats* _aidl_return) override; + ndk::ScopedAStatus startRssiMonitoring(int32_t in_cmdId, int32_t in_maxRssi, + int32_t in_minRssi) override; + ndk::ScopedAStatus stopRssiMonitoring(int32_t in_cmdId) override; + ndk::ScopedAStatus getRoamingCapabilities(StaRoamingCapabilities* _aidl_return) override; + ndk::ScopedAStatus configureRoaming(const StaRoamingConfig& in_config) override; + ndk::ScopedAStatus setRoamingState(StaRoamingState in_state) override; + ndk::ScopedAStatus enableNdOffload(bool in_enable) override; + ndk::ScopedAStatus startSendingKeepAlivePackets(int32_t in_cmdId, + const std::vector& in_ipPacketData, + char16_t in_etherType, + const std::array& in_srcAddress, + const std::array& in_dstAddress, + int32_t in_periodInMs) override; + ndk::ScopedAStatus stopSendingKeepAlivePackets(int32_t in_cmdId) override; + ndk::ScopedAStatus startDebugPacketFateMonitoring() override; + ndk::ScopedAStatus getDebugTxPacketFates( + std::vector* _aidl_return) override; + ndk::ScopedAStatus getDebugRxPacketFates( + std::vector* _aidl_return) override; + ndk::ScopedAStatus setMacAddress(const std::array& in_mac) override; + ndk::ScopedAStatus getFactoryMacAddress(std::array* _aidl_return) override; + ndk::ScopedAStatus setScanMode(bool in_enable) override; + + private: + // Corresponding worker functions for the AIDL methods. + std::pair getNameInternal(); + ndk::ScopedAStatus registerEventCallbackInternal( + const std::shared_ptr& callback); + std::pair getCapabilitiesInternal(); + std::pair + getApfPacketFilterCapabilitiesInternal(); + ndk::ScopedAStatus installApfPacketFilterInternal(const std::vector& program); + std::pair, ndk::ScopedAStatus> readApfPacketFilterDataInternal(); + std::pair + getBackgroundScanCapabilitiesInternal(); + std::pair, ndk::ScopedAStatus> getValidFrequenciesForBandInternal( + WifiBand band); + ndk::ScopedAStatus startBackgroundScanInternal(int32_t cmd_id, + const StaBackgroundScanParameters& params); + ndk::ScopedAStatus stopBackgroundScanInternal(int32_t cmd_id); + ndk::ScopedAStatus enableLinkLayerStatsCollectionInternal(bool debug); + ndk::ScopedAStatus disableLinkLayerStatsCollectionInternal(); + std::pair getLinkLayerStatsInternal(); + ndk::ScopedAStatus startRssiMonitoringInternal(int32_t cmd_id, int32_t max_rssi, + int32_t min_rssi); + ndk::ScopedAStatus stopRssiMonitoringInternal(int32_t cmd_id); + std::pair getRoamingCapabilitiesInternal(); + ndk::ScopedAStatus configureRoamingInternal(const StaRoamingConfig& config); + ndk::ScopedAStatus setRoamingStateInternal(StaRoamingState state); + ndk::ScopedAStatus enableNdOffloadInternal(bool enable); + ndk::ScopedAStatus startSendingKeepAlivePacketsInternal( + int32_t cmd_id, const std::vector& ip_packet_data, char16_t ether_type, + const std::array& src_address, const std::array& dst_address, + int32_t period_in_ms); + ndk::ScopedAStatus stopSendingKeepAlivePacketsInternal(int32_t cmd_id); + ndk::ScopedAStatus startDebugPacketFateMonitoringInternal(); + std::pair, ndk::ScopedAStatus> + getDebugTxPacketFatesInternal(); + std::pair, ndk::ScopedAStatus> + getDebugRxPacketFatesInternal(); + ndk::ScopedAStatus setMacAddressInternal(const std::array& mac); + std::pair, ndk::ScopedAStatus> getFactoryMacAddressInternal(); + ndk::ScopedAStatus setScanModeInternal(bool enable); + + void setWeakPtr(std::weak_ptr ptr); + + std::string ifname_; + std::weak_ptr legacy_hal_; + std::weak_ptr iface_util_; + std::weak_ptr weak_ptr_this_; + bool is_valid_; + aidl_callback_util::AidlCallbackHandler event_cb_handler_; + + DISALLOW_COPY_AND_ASSIGN(WifiStaIface); +}; + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // WIFI_STA_IFACE_H_ diff --git a/wifi/aidl/default/wifi_status_util.cpp b/wifi/aidl/default/wifi_status_util.cpp new file mode 100644 index 0000000000..25ecd716da --- /dev/null +++ b/wifi/aidl/default/wifi_status_util.cpp @@ -0,0 +1,106 @@ +/* + * 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. + */ + +#include "wifi_status_util.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { + +std::string legacyErrorToString(legacy_hal::wifi_error error) { + switch (error) { + case legacy_hal::WIFI_SUCCESS: + return "SUCCESS"; + case legacy_hal::WIFI_ERROR_UNINITIALIZED: + return "UNINITIALIZED"; + case legacy_hal::WIFI_ERROR_NOT_AVAILABLE: + return "NOT_AVAILABLE"; + case legacy_hal::WIFI_ERROR_NOT_SUPPORTED: + return "NOT_SUPPORTED"; + case legacy_hal::WIFI_ERROR_INVALID_ARGS: + return "INVALID_ARGS"; + case legacy_hal::WIFI_ERROR_INVALID_REQUEST_ID: + return "INVALID_REQUEST_ID"; + case legacy_hal::WIFI_ERROR_TIMED_OUT: + return "TIMED_OUT"; + case legacy_hal::WIFI_ERROR_TOO_MANY_REQUESTS: + return "TOO_MANY_REQUESTS"; + case legacy_hal::WIFI_ERROR_OUT_OF_MEMORY: + return "OUT_OF_MEMORY"; + case legacy_hal::WIFI_ERROR_BUSY: + return "BUSY"; + case legacy_hal::WIFI_ERROR_UNKNOWN: + return "UNKNOWN"; + default: + return "UNKNOWN ERROR"; + } +} + +ndk::ScopedAStatus createWifiStatus(WifiStatusCode code, const std::string& description) { + return ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(static_cast(code), + description.c_str()); +} + +ndk::ScopedAStatus createWifiStatus(WifiStatusCode code) { + return ndk::ScopedAStatus::fromServiceSpecificError(static_cast(code)); +} + +ndk::ScopedAStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error, + const std::string& desc) { + switch (error) { + case legacy_hal::WIFI_ERROR_NONE: + return ndk::ScopedAStatus::ok(); + + case legacy_hal::WIFI_ERROR_UNINITIALIZED: + case legacy_hal::WIFI_ERROR_NOT_AVAILABLE: + return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE, desc); + + case legacy_hal::WIFI_ERROR_NOT_SUPPORTED: + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED, desc); + + case legacy_hal::WIFI_ERROR_INVALID_ARGS: + case legacy_hal::WIFI_ERROR_INVALID_REQUEST_ID: + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS, desc); + + case legacy_hal::WIFI_ERROR_TIMED_OUT: + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, desc + ", timed out"); + + case legacy_hal::WIFI_ERROR_TOO_MANY_REQUESTS: + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, desc + ", too many requests"); + + case legacy_hal::WIFI_ERROR_OUT_OF_MEMORY: + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, desc + ", out of memory"); + + case legacy_hal::WIFI_ERROR_BUSY: + return createWifiStatus(WifiStatusCode::ERROR_BUSY); + + case legacy_hal::WIFI_ERROR_UNKNOWN: + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, "unknown"); + + default: + return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, "unknown error"); + } +} + +ndk::ScopedAStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error) { + return createWifiStatusFromLegacyError(error, ""); +} + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/wifi/aidl/default/wifi_status_util.h b/wifi/aidl/default/wifi_status_util.h new file mode 100644 index 0000000000..633811dbf6 --- /dev/null +++ b/wifi/aidl/default/wifi_status_util.h @@ -0,0 +1,42 @@ +/* + * 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. + */ + +#ifndef WIFI_STATUS_UTIL_H_ +#define WIFI_STATUS_UTIL_H_ + +#include + +#include "wifi_legacy_hal.h" + +namespace aidl { +namespace android { +namespace hardware { +namespace wifi { +using ::aidl::android::hardware::wifi::WifiStatusCode; + +std::string legacyErrorToString(legacy_hal::wifi_error error); +ndk::ScopedAStatus createWifiStatus(WifiStatusCode code, const std::string& description); +ndk::ScopedAStatus createWifiStatus(WifiStatusCode code); +ndk::ScopedAStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error, + const std::string& description); +ndk::ScopedAStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error); + +} // namespace wifi +} // namespace hardware +} // namespace android +} // namespace aidl + +#endif // WIFI_STATUS_UTIL_H_ diff --git a/wifi/aidl/vts/functional/Android.bp b/wifi/aidl/vts/functional/Android.bp new file mode 100644 index 0000000000..1277182493 --- /dev/null +++ b/wifi/aidl/vts/functional/Android.bp @@ -0,0 +1,169 @@ +// +// 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. +// + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_test { + name: "VtsHalWifiChipTargetTest", + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + srcs: [ + "wifi_chip_aidl_test.cpp", + ], + shared_libs: [ + "libbinder", + "libbinder_ndk", + "libvndksupport", + ], + static_libs: [ + "VtsHalWifiTargetTestUtil", + "android.hardware.wifi-V1-ndk", + "libwifi-system-iface", + ], + test_suites: [ + "general-tests", + "vts", + ], +} + +cc_test { + name: "VtsHalWifiStaIfaceTargetTest", + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + srcs: [ + "wifi_sta_iface_aidl_test.cpp", + ], + shared_libs: [ + "libbinder", + "libbinder_ndk", + "libvndksupport", + ], + static_libs: [ + "VtsHalWifiTargetTestUtil", + "android.hardware.wifi-V1-ndk", + "libwifi-system-iface", + ], + test_suites: [ + "general-tests", + "vts", + ], +} + +cc_test { + name: "VtsHalWifiApIfaceTargetTest", + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + srcs: [ + "wifi_ap_iface_aidl_test.cpp", + ], + shared_libs: [ + "libbinder", + "libbinder_ndk", + "libvndksupport", + ], + static_libs: [ + "VtsHalWifiTargetTestUtil", + "android.hardware.wifi-V1-ndk", + "libwifi-system-iface", + ], + test_suites: [ + "general-tests", + "vts", + ], +} + +cc_test { + name: "VtsHalWifiNanIfaceTargetTest", + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + srcs: [ + "wifi_nan_iface_aidl_test.cpp", + ], + shared_libs: [ + "libbinder", + "libbinder_ndk", + "libvndksupport", + ], + static_libs: [ + "VtsHalWifiTargetTestUtil", + "android.hardware.wifi-V1-ndk", + "libwifi-system-iface", + ], + test_suites: [ + "general-tests", + "vts", + ], +} + +cc_test { + name: "VtsHalWifiRttControllerTargetTest", + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + srcs: [ + "wifi_rtt_controller_aidl_test.cpp", + ], + shared_libs: [ + "libbinder", + "libbinder_ndk", + "libvndksupport", + ], + static_libs: [ + "VtsHalWifiTargetTestUtil", + "android.hardware.wifi-V1-ndk", + "libwifi-system-iface", + ], + test_suites: [ + "general-tests", + "vts", + ], +} + +cc_library_static { + name: "VtsHalWifiTargetTestUtil", + defaults: ["VtsHalTargetTestDefaults"], + srcs: [ + "wifi_aidl_test_utils.cpp", + ], + export_include_dirs: [ + ".", + ], + shared_libs: [ + "libbinder", + "libbinder_ndk", + "libnativehelper", + ], + static_libs: [ + "android.hardware.wifi-V1-ndk", + "libwifi-system-iface", + ], +} diff --git a/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp b/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp new file mode 100644 index 0000000000..6722f36dc9 --- /dev/null +++ b/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp @@ -0,0 +1,216 @@ +/* + * 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. + */ + +#include "wifi_aidl_test_utils.h" + +using ::android::wifi_system::InterfaceTool; + +namespace { +bool findAnyModeSupportingConcurrencyType(IfaceConcurrencyType desired_type, + const std::vector& modes, + int* mode_id) { + for (const auto& mode : modes) { + for (const auto& combination : mode.availableCombinations) { + for (const auto& iface_limit : combination.limits) { + const auto& iface_types = iface_limit.types; + if (std::find(iface_types.begin(), iface_types.end(), desired_type) != + iface_types.end()) { + *mode_id = mode.id; + return true; + } + } + } + } + return false; +} + +bool configureChipToSupportConcurrencyTypeInternal(const std::shared_ptr& wifi_chip, + IfaceConcurrencyType type, + int* configured_mode_id) { + if (!configured_mode_id) { + return false; + } + std::vector chip_modes; + auto status = wifi_chip->getAvailableModes(&chip_modes); + if (!status.isOk()) { + return false; + } + if (!findAnyModeSupportingConcurrencyType(type, chip_modes, configured_mode_id)) { + return false; + } + if (!wifi_chip->configureChip(*configured_mode_id).isOk()) { + return false; + } + return true; +} + +bool configureChipToSupportConcurrencyTypeInternal(const std::shared_ptr& wifi_chip, + IfaceConcurrencyType type) { + int mode_id; + return configureChipToSupportConcurrencyTypeInternal(wifi_chip, type, &mode_id); +} +} // namespace + +bool checkStatusCode(ndk::ScopedAStatus* status, WifiStatusCode expected_code) { + if (status == nullptr) { + return false; + } + return status->getServiceSpecificError() == static_cast(expected_code); +} + +std::shared_ptr getWifi(const char* instance_name) { + return IWifi::fromBinder(ndk::SpAIBinder(AServiceManager_waitForService(instance_name))); +} + +std::shared_ptr getWifiChip(const char* instance_name) { + std::shared_ptr wifi = getWifi(instance_name); + if (!wifi.get()) { + return nullptr; + } + + const int retry_interval_ms = 2; + const int max_retries = 5; + int retry_count = 0; + auto status = wifi->start(); + while (retry_count < max_retries && !status.isOk()) { + retry_count++; + usleep(retry_interval_ms * 1000); + status = wifi->start(); + } + if (!status.isOk()) { + return nullptr; + } + + std::vector chip_ids = {}; + status = wifi->getChipIds(&chip_ids); + if (!status.isOk() || chip_ids.size() == 0) { + return nullptr; + } + std::shared_ptr chip; + status = wifi->getChip(chip_ids[0], &chip); + if (!status.isOk()) { + return nullptr; + } + return chip; +} + +void setupStaIface(const std::shared_ptr& iface) { + std::string iface_name; + auto status = iface->getName(&iface_name); + if (status.isOk()) { + InterfaceTool iface_tool; + iface_tool.SetUpState(iface_name.c_str(), true); + } +} + +void setupNanIface(const std::shared_ptr& iface) { + std::string iface_name; + auto status = iface->getName(&iface_name); + if (status.isOk()) { + InterfaceTool iface_tool; + iface_tool.SetUpState(iface_name.c_str(), true); + } +} + +std::shared_ptr getWifiStaIface(const char* instance_name) { + std::shared_ptr wifi_chip = getWifiChip(instance_name); + if (!wifi_chip.get()) { + return nullptr; + } + if (!configureChipToSupportConcurrencyTypeInternal(wifi_chip, IfaceConcurrencyType::STA)) { + return nullptr; + } + std::shared_ptr iface; + auto status = wifi_chip->createStaIface(&iface); + if (!status.isOk()) { + return nullptr; + } + setupStaIface(iface); + return iface; +} + +std::shared_ptr getWifiNanIface(const char* instance_name) { + std::shared_ptr wifi_chip = getWifiChip(instance_name); + if (!wifi_chip.get()) { + return nullptr; + } + if (!configureChipToSupportConcurrencyTypeInternal(wifi_chip, + IfaceConcurrencyType::NAN_IFACE)) { + return nullptr; + } + std::shared_ptr iface; + auto status = wifi_chip->createNanIface(&iface); + if (!status.isOk()) { + return nullptr; + } + setupNanIface(iface); + return iface; +} + +std::shared_ptr getWifiApIface(const char* instance_name) { + std::shared_ptr wifi_chip = getWifiChip(instance_name); + if (!wifi_chip.get()) { + return nullptr; + } + if (!configureChipToSupportConcurrencyTypeInternal(wifi_chip, IfaceConcurrencyType::AP)) { + return nullptr; + } + std::shared_ptr iface; + auto status = wifi_chip->createApIface(&iface); + if (!status.isOk()) { + return nullptr; + } + return iface; +} + +std::shared_ptr getBridgedWifiApIface(std::shared_ptr wifi_chip) { + if (!wifi_chip.get()) { + return nullptr; + } + int mode_id; + std::shared_ptr iface; + configureChipToSupportConcurrencyTypeInternal(wifi_chip, IfaceConcurrencyType::AP, &mode_id); + auto status = wifi_chip->createBridgedApIface(&iface); + if (!status.isOk()) { + return nullptr; + } + return iface; +} + +std::shared_ptr getBridgedWifiApIface(const char* instance_name) { + std::shared_ptr wifi_chip = getWifiChip(instance_name); + return getBridgedWifiApIface(wifi_chip); +} + +bool configureChipToSupportConcurrencyType(const std::shared_ptr& wifi_chip, + IfaceConcurrencyType type, int* configured_mode_id) { + return configureChipToSupportConcurrencyTypeInternal(wifi_chip, type, configured_mode_id); +} + +void stopWifiService(const char* instance_name) { + std::shared_ptr wifi = getWifi(instance_name); + if (wifi != nullptr) { + wifi->stop(); + } +} + +int32_t getChipCapabilities(const std::shared_ptr& wifi_chip) { + IWifiChip::ChipCapabilityMask caps = {}; + if (wifi_chip->getCapabilities(&caps).isOk()) { + return static_cast(caps); + } + return 0; +} diff --git a/wifi/aidl/vts/functional/wifi_aidl_test_utils.h b/wifi/aidl/vts/functional/wifi_aidl_test_utils.h new file mode 100644 index 0000000000..ad16603dd3 --- /dev/null +++ b/wifi/aidl/vts/functional/wifi_aidl_test_utils.h @@ -0,0 +1,48 @@ +/* + * 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. + */ + +#pragma once + +#include + +#include +#include +#include +#include + +using aidl::android::hardware::wifi::IfaceConcurrencyType; +using aidl::android::hardware::wifi::IWifi; +using aidl::android::hardware::wifi::IWifiApIface; +using aidl::android::hardware::wifi::IWifiChip; +using aidl::android::hardware::wifi::IWifiNanIface; +using aidl::android::hardware::wifi::IWifiStaIface; +using aidl::android::hardware::wifi::WifiStatusCode; + +// Helper functions to obtain references to the various AIDL interface objects. +std::shared_ptr getWifi(const char* instance_name); +std::shared_ptr getWifiChip(const char* instance_name); +std::shared_ptr getWifiStaIface(const char* instance_name); +std::shared_ptr getWifiNanIface(const char* instance_name); +std::shared_ptr getWifiApIface(const char* instance_name); +std::shared_ptr getBridgedWifiApIface(const char* instance_name); +std::shared_ptr getBridgedWifiApIface(std::shared_ptr wifi_chip); +// Configure the chip in a mode to support the creation of the provided iface type. +bool configureChipToSupportConcurrencyType(const std::shared_ptr& wifi_chip, + IfaceConcurrencyType type, int* configured_mode_id); +// Used to trigger IWifi.stop() at the end of every test. +void stopWifiService(const char* instance_name); +int32_t getChipCapabilities(const std::shared_ptr& wifi_chip); +bool checkStatusCode(ndk::ScopedAStatus* status, WifiStatusCode expected_code); diff --git a/wifi/aidl/vts/functional/wifi_ap_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_ap_iface_aidl_test.cpp new file mode 100644 index 0000000000..0eaf660d49 --- /dev/null +++ b/wifi/aidl/vts/functional/wifi_ap_iface_aidl_test.cpp @@ -0,0 +1,154 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Staache 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. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "wifi_aidl_test_utils.h" + +using aidl::android::hardware::wifi::IWifiApIface; +using aidl::android::hardware::wifi::WifiBand; + +class WifiApIfaceAidlTest : public testing::TestWithParam { + public: + void SetUp() override { + isBridgedSupport_ = testing::checkSubstringInCommandOutput( + "/system/bin/cmd wifi get-softap-supported-features", + "wifi_softap_bridged_ap_supported"); + stopWifiService(getInstanceName()); + } + + void TearDown() override { stopWifiService(getInstanceName()); } + + protected: + bool isBridgedSupport_ = false; + const char* getInstanceName() { return GetParam().c_str(); } +}; + +/* + * SetMacAddress + */ +TEST_P(WifiApIfaceAidlTest, SetMacAddress) { + std::shared_ptr wifi_ap_iface = getWifiApIface(getInstanceName()); + ASSERT_NE(nullptr, wifi_ap_iface.get()); + std::array mac = {0x12, 0x22, 0x33, 0x52, 0x10, 0x44}; + EXPECT_TRUE(wifi_ap_iface->setMacAddress(mac).isOk()); +} + +/* + * SetCountryCode + */ +TEST_P(WifiApIfaceAidlTest, SetCountryCode) { + std::shared_ptr wifi_ap_iface = getWifiApIface(getInstanceName()); + ASSERT_NE(nullptr, wifi_ap_iface.get()); + + const std::array country_code = {0x55, 0x53}; + EXPECT_TRUE(wifi_ap_iface->setCountryCode(country_code).isOk()); +} + +/* + * GetValidFrequenciesForBand + * Ensures that we can retrieve valid frequencies for the 2.4 GHz band. + */ +TEST_P(WifiApIfaceAidlTest, GetValidFrequenciesForBand) { + std::shared_ptr wifi_ap_iface = getWifiApIface(getInstanceName()); + ASSERT_NE(nullptr, wifi_ap_iface.get()); + + std::vector freqs; + EXPECT_TRUE(wifi_ap_iface->getValidFrequenciesForBand(WifiBand::BAND_24GHZ, &freqs).isOk()); + EXPECT_NE(freqs.size(), 0); +} + +/* + * GetFactoryMacAddress + */ +TEST_P(WifiApIfaceAidlTest, GetFactoryMacAddress) { + std::shared_ptr wifi_ap_iface = getWifiApIface(getInstanceName()); + ASSERT_NE(nullptr, wifi_ap_iface.get()); + + std::array mac; + EXPECT_TRUE(wifi_ap_iface->getFactoryMacAddress(&mac).isOk()); + std::array all_zero_mac = {0, 0, 0, 0, 0, 0}; + EXPECT_NE(mac, all_zero_mac); +} + +/** + * GetBridgedInstances - non-bridged mode + */ +TEST_P(WifiApIfaceAidlTest, GetBridgedInstances) { + std::shared_ptr wifi_ap_iface = getWifiApIface(getInstanceName()); + ASSERT_NE(nullptr, wifi_ap_iface.get()); + + std::vector instances; + EXPECT_TRUE(wifi_ap_iface->getBridgedInstances(&instances).isOk()); + EXPECT_EQ(instances.size(), 0); +} + +/** + * GetBridgedInstances - bridged AP mode. + */ +TEST_P(WifiApIfaceAidlTest, GetBridgedInstances_Bridged) { + if (!isBridgedSupport_) { + GTEST_SKIP() << "Missing Bridged AP support"; + } + std::shared_ptr wifi_ap_iface = getBridgedWifiApIface(getInstanceName()); + ASSERT_NE(nullptr, wifi_ap_iface.get()); + + std::vector instances; + EXPECT_TRUE(wifi_ap_iface->getBridgedInstances(&instances).isOk()); + EXPECT_EQ(instances.size(), 2); +} + +/** + * ResetToFactoryMacAddress - non-bridged mode + */ +TEST_P(WifiApIfaceAidlTest, ResetToFactoryMacAddress) { + std::shared_ptr wifi_ap_iface = getWifiApIface(getInstanceName()); + ASSERT_NE(nullptr, wifi_ap_iface.get()); + EXPECT_TRUE(wifi_ap_iface->resetToFactoryMacAddress().isOk()); +} + +/** + * ResetToFactoryMacAddress - bridged AP mode + */ +TEST_P(WifiApIfaceAidlTest, ResetToFactoryMacAddress_Bridged) { + if (!isBridgedSupport_) { + GTEST_SKIP() << "Missing Bridged AP support"; + } + std::shared_ptr wifi_ap_iface = getBridgedWifiApIface(getInstanceName()); + ASSERT_NE(nullptr, wifi_ap_iface.get()); + EXPECT_TRUE(wifi_ap_iface->resetToFactoryMacAddress().isOk()); +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiApIfaceAidlTest); +INSTANTIATE_TEST_SUITE_P(WifiTest, WifiApIfaceAidlTest, + testing::ValuesIn(android::getAidlHalInstanceNames(IWifi::descriptor)), + android::PrintInstanceNameToString); + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + android::ProcessState::self()->setThreadPoolMaxThreadCount(1); + android::ProcessState::self()->startThreadPool(); + return RUN_ALL_TESTS(); +} diff --git a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp new file mode 100644 index 0000000000..0806ed289d --- /dev/null +++ b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp @@ -0,0 +1,889 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Staache 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. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "wifi_aidl_test_utils.h" + +using aidl::android::hardware::wifi::BnWifiChipEventCallback; +using aidl::android::hardware::wifi::IfaceType; +using aidl::android::hardware::wifi::IWifiApIface; +using aidl::android::hardware::wifi::IWifiChip; +using aidl::android::hardware::wifi::IWifiNanIface; +using aidl::android::hardware::wifi::IWifiP2pIface; +using aidl::android::hardware::wifi::IWifiRttController; +using aidl::android::hardware::wifi::WifiBand; +using aidl::android::hardware::wifi::WifiDebugHostWakeReasonStats; +using aidl::android::hardware::wifi::WifiDebugRingBufferStatus; +using aidl::android::hardware::wifi::WifiDebugRingBufferVerboseLevel; +using aidl::android::hardware::wifi::WifiIfaceMode; +using aidl::android::hardware::wifi::WifiRadioCombinationMatrix; +using aidl::android::hardware::wifi::WifiStatusCode; +using aidl::android::hardware::wifi::WifiUsableChannel; + +class WifiChipAidlTest : public testing::TestWithParam { + public: + void SetUp() override { + stopWifiService(getInstanceName()); + wifi_chip_ = getWifiChip(getInstanceName()); + ASSERT_NE(nullptr, wifi_chip_.get()); + } + + void TearDown() override { stopWifiService(getInstanceName()); } + + protected: + int configureChipForConcurrencyType(IfaceConcurrencyType type) { + int mode_id; + EXPECT_TRUE(configureChipToSupportConcurrencyType(wifi_chip_, type, &mode_id)); + return mode_id; + } + + std::shared_ptr configureChipForStaAndGetIface() { + std::shared_ptr iface; + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + EXPECT_TRUE(wifi_chip_->createStaIface(&iface).isOk()); + EXPECT_NE(nullptr, iface.get()); + return iface; + } + + std::shared_ptr configureChipForP2pAndGetIface() { + std::shared_ptr iface; + configureChipForConcurrencyType(IfaceConcurrencyType::P2P); + EXPECT_TRUE(wifi_chip_->createP2pIface(&iface).isOk()); + EXPECT_NE(nullptr, iface.get()); + return iface; + } + + std::shared_ptr configureChipForApAndGetIface() { + std::shared_ptr iface; + configureChipForConcurrencyType(IfaceConcurrencyType::AP); + EXPECT_TRUE(wifi_chip_->createApIface(&iface).isOk()); + EXPECT_NE(nullptr, iface.get()); + return iface; + } + + std::shared_ptr configureChipForNanAndGetIface() { + std::shared_ptr iface; + configureChipForConcurrencyType(IfaceConcurrencyType::NAN_IFACE); + EXPECT_TRUE(wifi_chip_->createNanIface(&iface).isOk()); + EXPECT_NE(nullptr, iface.get()); + return iface; + } + + std::string getStaIfaceName(const std::shared_ptr& iface) { + std::string iface_name; + EXPECT_TRUE(iface->getName(&iface_name).isOk()); + return iface_name; + } + + std::string getP2pIfaceName(const std::shared_ptr& iface) { + std::string iface_name; + EXPECT_TRUE(iface->getName(&iface_name).isOk()); + return iface_name; + } + + std::string getApIfaceName(const std::shared_ptr& iface) { + std::string iface_name; + EXPECT_TRUE(iface->getName(&iface_name).isOk()); + return iface_name; + } + + std::string getNanIfaceName(const std::shared_ptr& iface) { + std::string iface_name; + EXPECT_TRUE(iface->getName(&iface_name).isOk()); + return iface_name; + } + + std::vector> create2StaIfacesIfPossible() { + std::shared_ptr iface1 = configureChipForStaAndGetIface(); + + // Try create a create second iface. + std::shared_ptr iface2; + bool add_second_success = wifi_chip_->createStaIface(&iface2).isOk(); + if (!add_second_success) { + return {iface1}; + } + EXPECT_NE(nullptr, iface2.get()); + return {iface1, iface2}; + } + + bool hasAnyRingBufferCapabilities(int32_t caps) { + return caps & + (static_cast( + IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_CONNECT_EVENT) | + static_cast(IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_POWER_EVENT) | + static_cast( + IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_WAKELOCK_EVENT) | + static_cast(IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_VENDOR_DATA)); + } + + const char* getInstanceName() { return GetParam().c_str(); } + + std::shared_ptr wifi_chip_; +}; + +class WifiChipEventCallback : public BnWifiChipEventCallback { + public: + WifiChipEventCallback() = default; + + ::ndk::ScopedAStatus onChipReconfigureFailure(WifiStatusCode /* status */) override { + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus onChipReconfigured(int /* modeId */) override { + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus onDebugErrorAlert(int /* errorCode */, + const std::vector& /* debugData */) override { + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus onDebugRingBufferDataAvailable( + const WifiDebugRingBufferStatus& /* status */, + const std::vector& /* data */) override { + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus onIfaceAdded(IfaceType /* type */, + const std::string& /* name */) override { + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus onIfaceRemoved(IfaceType /* type */, + const std::string& /* name */) override { + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus onRadioModeChange( + const std::vector& /* radioModeInfos */) override { + return ndk::ScopedAStatus::ok(); + } +}; + +/* + * RegisterEventCallback + * + * Note: it is not feasible to test the invocation of the callback function, + * since events are triggered internally in the HAL implementation and cannot be + * triggered from the test case. + */ +TEST_P(WifiChipAidlTest, RegisterEventCallback) { + std::shared_ptr callback = + ndk::SharedRefBase::make(); + ASSERT_NE(nullptr, callback.get()); + EXPECT_TRUE(wifi_chip_->registerEventCallback(callback).isOk()); +} + +/* + * GetCapabilities + */ +TEST_P(WifiChipAidlTest, GetCapabilities) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + EXPECT_NE(static_cast(caps), 0); +} + +/* + * GetId + */ +TEST_P(WifiChipAidlTest, GetId) { + int id; + EXPECT_TRUE(wifi_chip_->getId(&id).isOk()); +} + +/* + * GetAvailableModes + */ +TEST_P(WifiChipAidlTest, GetAvailableModes) { + std::vector modes; + EXPECT_TRUE(wifi_chip_->getAvailableModes(&modes).isOk()); + EXPECT_NE(modes.size(), 0); +} + +/* + * GetMode + */ +TEST_P(WifiChipAidlTest, GetMode) { + int expected_mode = configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int retrieved_mode; + EXPECT_TRUE(wifi_chip_->getMode(&retrieved_mode).isOk()); + EXPECT_EQ(retrieved_mode, expected_mode); +} + +/* + * GetUsableChannels + */ +TEST_P(WifiChipAidlTest, GetUsableChannels) { + WifiBand band = WifiBand::BAND_24GHZ_5GHZ_6GHZ; + uint32_t ifaceModeMask = static_cast(WifiIfaceMode::IFACE_MODE_P2P_CLIENT) | + static_cast(WifiIfaceMode::IFACE_MODE_P2P_GO); + uint32_t filterMask = + static_cast(IWifiChip::UsableChannelFilter::CELLULAR_COEXISTENCE) | + static_cast(IWifiChip::UsableChannelFilter::CONCURRENCY); + + std::vector channels; + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + auto status = wifi_chip_->getUsableChannels( + band, static_cast(ifaceModeMask), + static_cast(filterMask), &channels); + if (checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { + GTEST_SKIP() << "getUsableChannels() is not supported by vendor."; + } + EXPECT_TRUE(status.isOk()); +} + +/* + * GetSupportedRadioCombinationsMatrix + */ +TEST_P(WifiChipAidlTest, GetSupportedRadioCombinationsMatrix) { + WifiRadioCombinationMatrix combination_matrix = {}; + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + auto status = wifi_chip_->getSupportedRadioCombinationsMatrix(&combination_matrix); + if (checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { + GTEST_SKIP() << "Skipping this test since getSupportedRadioCombinationsMatrix() " + "is not supported by vendor."; + } + EXPECT_TRUE(status.isOk()); +} + +/* + * SetCountryCode + */ +TEST_P(WifiChipAidlTest, SetCountryCode) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + std::array country_code = {0x55, 0x53}; + EXPECT_TRUE(wifi_chip_->setCountryCode(country_code).isOk()); +} + +/* + * SetLatencyMode_normal + * Tests the setLatencyMode() API with Latency mode NORMAL. + */ +TEST_P(WifiChipAidlTest, SetLatencyMode_normal) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + auto status = wifi_chip_->setLatencyMode(IWifiChip::LatencyMode::NORMAL); + if (caps & static_cast(IWifiChip::ChipCapabilityMask::SET_LATENCY_MODE)) { + EXPECT_TRUE(status.isOk()); + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * SetLatencyMode_low + * Tests the setLatencyMode() API with Latency mode LOW. + */ +TEST_P(WifiChipAidlTest, SetLatencyMode_low) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + auto status = wifi_chip_->setLatencyMode(IWifiChip::LatencyMode::LOW); + if (caps & static_cast(IWifiChip::ChipCapabilityMask::SET_LATENCY_MODE)) { + EXPECT_TRUE(status.isOk()); + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * SetMultiStaPrimaryConnection + * + * Only runs if the device supports 2 STA ifaces. + */ +TEST_P(WifiChipAidlTest, SetMultiStaPrimaryConnection) { + auto ifaces = create2StaIfacesIfPossible(); + if (ifaces.size() < 2) { + GTEST_SKIP() << "Device does not support more than 1 STA concurrently"; + } + + auto status = wifi_chip_->setMultiStaPrimaryConnection(getStaIfaceName(ifaces[0])); + if (!status.isOk()) { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * SetMultiStaUseCase + * + * Only runs if the device supports 2 STA ifaces. + */ +TEST_P(WifiChipAidlTest, setMultiStaUseCase) { + auto ifaces = create2StaIfacesIfPossible(); + if (ifaces.size() < 2) { + GTEST_SKIP() << "Device does not support more than 1 STA concurrently"; + } + + auto status = wifi_chip_->setMultiStaUseCase( + IWifiChip::MultiStaUseCase::DUAL_STA_TRANSIENT_PREFER_PRIMARY); + if (!status.isOk()) { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * SetCoexUnsafeChannels + */ +TEST_P(WifiChipAidlTest, SetCoexUnsafeChannels) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + + // Test with an empty vector of CoexUnsafeChannels. + std::vector vec; + IWifiChip::CoexRestriction restrictions = static_cast(0); + auto status = wifi_chip_->setCoexUnsafeChannels(vec, restrictions); + if (!status.isOk()) { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } + + // Test with a non-empty vector of CoexUnsafeChannels. + IWifiChip::CoexUnsafeChannel unsafeChannel24Ghz; + unsafeChannel24Ghz.band = WifiBand::BAND_24GHZ; + unsafeChannel24Ghz.channel = 6; + vec.push_back(unsafeChannel24Ghz); + IWifiChip::CoexUnsafeChannel unsafeChannel5Ghz; + unsafeChannel5Ghz.band = WifiBand::BAND_5GHZ; + unsafeChannel5Ghz.channel = 36; + vec.push_back(unsafeChannel5Ghz); + restrictions = static_cast( + static_cast(IWifiChip::CoexRestriction::WIFI_AWARE) | + static_cast(IWifiChip::CoexRestriction::SOFTAP) | + static_cast(IWifiChip::CoexRestriction::WIFI_DIRECT)); + + status = wifi_chip_->setCoexUnsafeChannels(vec, restrictions); + if (!status.isOk()) { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * SelectTxPowerScenario - Body + */ +TEST_P(WifiChipAidlTest, SelectTxPowerScenario_body) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + int32_t expected_caps = + static_cast(IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT) | + static_cast(IWifiChip::ChipCapabilityMask::USE_BODY_HEAD_SAR); + auto status = wifi_chip_->selectTxPowerScenario(IWifiChip::TxPowerScenario::ON_BODY_CELL_OFF); + if (caps & expected_caps) { + EXPECT_TRUE(status.isOk()); + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * SelectTxPowerScenario - Voice Call + */ +TEST_P(WifiChipAidlTest, SelectTxPowerScenario_voiceCall) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + auto status = wifi_chip_->selectTxPowerScenario(IWifiChip::TxPowerScenario::VOICE_CALL); + if (caps & static_cast(IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT)) { + EXPECT_TRUE(status.isOk()); + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * ResetTxPowerScenario + */ +TEST_P(WifiChipAidlTest, ResetTxPowerScenario) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + auto status = wifi_chip_->resetTxPowerScenario(); + if (caps & static_cast(IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT)) { + EXPECT_TRUE(status.isOk()); + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * ConfigureChip + */ +TEST_P(WifiChipAidlTest, ConfigureChip) { + std::vector modes; + EXPECT_TRUE(wifi_chip_->getAvailableModes(&modes).isOk()); + EXPECT_NE(modes.size(), 0); + for (const auto& mode : modes) { + // configureChip() requires a fresh IWifiChip object. + wifi_chip_ = getWifiChip(getInstanceName()); + ASSERT_NE(nullptr, wifi_chip_.get()); + EXPECT_TRUE(wifi_chip_->configureChip(mode.id).isOk()); + stopWifiService(getInstanceName()); + // Sleep for 5 milliseconds between each wifi state toggle. + usleep(5000); + } +} + +/* + * RequestChipDebugInfo + */ +TEST_P(WifiChipAidlTest, RequestChipDebugInfo) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + IWifiChip::ChipDebugInfo debug_info = {}; + EXPECT_TRUE(wifi_chip_->requestChipDebugInfo(&debug_info).isOk()); + EXPECT_NE(debug_info.driverDescription.size(), 0); + EXPECT_NE(debug_info.firmwareDescription.size(), 0); +} + +/* + * RequestFirmwareDebugDump + */ +TEST_P(WifiChipAidlTest, RequestFirmwareDebugDump) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + std::vector debug_dump; + auto status = wifi_chip_->requestFirmwareDebugDump(&debug_dump); + if (caps & static_cast(IWifiChip::ChipCapabilityMask::DEBUG_MEMORY_FIRMWARE_DUMP)) { + EXPECT_TRUE(status.isOk()); + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * RequestDriverDebugDump + */ +TEST_P(WifiChipAidlTest, RequestDriverDebugDump) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + std::vector debug_dump; + auto status = wifi_chip_->requestDriverDebugDump(&debug_dump); + if (caps & static_cast(IWifiChip::ChipCapabilityMask::DEBUG_MEMORY_DRIVER_DUMP)) { + EXPECT_TRUE(status.isOk()); + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * GetDebugRingBuffersStatus + */ +TEST_P(WifiChipAidlTest, GetDebugRingBuffersStatus) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + std::vector ring_buffer_status; + auto status = wifi_chip_->getDebugRingBuffersStatus(&ring_buffer_status); + if (hasAnyRingBufferCapabilities(caps)) { + EXPECT_TRUE(status.isOk()); + ASSERT_NE(ring_buffer_status.size(), 0); + for (const auto& ring_buffer : ring_buffer_status) { + EXPECT_NE(ring_buffer.ringName.size(), 0); + } + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * GetDebugHostWakeReasonStats + */ +TEST_P(WifiChipAidlTest, GetDebugHostWakeReasonStats) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + WifiDebugHostWakeReasonStats wake_reason_stats = {}; + auto status = wifi_chip_->getDebugHostWakeReasonStats(&wake_reason_stats); + if (caps & static_cast(IWifiChip::ChipCapabilityMask::DEBUG_HOST_WAKE_REASON_STATS)) { + EXPECT_TRUE(status.isOk()); + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * StartLoggingToDebugRingBuffer + */ +TEST_P(WifiChipAidlTest, StartLoggingToDebugRingBuffer) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + std::string ring_name; + std::vector ring_buffer_status; + auto status = wifi_chip_->getDebugRingBuffersStatus(&ring_buffer_status); + + if (hasAnyRingBufferCapabilities(caps)) { + EXPECT_TRUE(status.isOk()); + ASSERT_NE(ring_buffer_status.size(), 0); + ring_name = ring_buffer_status[0].ringName; + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } + + status = wifi_chip_->startLoggingToDebugRingBuffer( + ring_name, WifiDebugRingBufferVerboseLevel::VERBOSE, 5, 1024); + if (hasAnyRingBufferCapabilities(caps)) { + EXPECT_TRUE(status.isOk()); + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * ForceDumpToDebugRingBuffer + */ +TEST_P(WifiChipAidlTest, ForceDumpToDebugRingBuffer) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + int32_t caps = getChipCapabilities(wifi_chip_); + std::string ring_name; + std::vector ring_buffer_status; + auto status = wifi_chip_->getDebugRingBuffersStatus(&ring_buffer_status); + + if (hasAnyRingBufferCapabilities(caps)) { + EXPECT_TRUE(status.isOk()); + ASSERT_NE(ring_buffer_status.size(), 0); + ring_name = ring_buffer_status[0].ringName; + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } + + status = wifi_chip_->forceDumpToDebugRingBuffer(ring_name); + if (hasAnyRingBufferCapabilities(caps)) { + EXPECT_TRUE(status.isOk()); + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/* + * CreateStaIface + * Configures the chip in STA mode and creates an iface. + */ +TEST_P(WifiChipAidlTest, CreateStaIface) { + configureChipForStaAndGetIface(); +} + +/* + * CreateApIface + */ +TEST_P(WifiChipAidlTest, CreateApIface) { + configureChipForApAndGetIface(); +} + +/* + * CreateNanIface + */ +TEST_P(WifiChipAidlTest, CreateNanIface) { + configureChipForNanAndGetIface(); +} + +/* + * CreateP2pIface + */ +TEST_P(WifiChipAidlTest, CreateP2pIface) { + configureChipForNanAndGetIface(); +} + +/* + * GetStaIfaceNames + * Configures the chip in STA mode and ensures that the iface name list is + * empty before creating the iface. Then create the iface and ensure that + * iface name is returned in the iface name list. + */ +TEST_P(WifiChipAidlTest, GetStaIfaceNames) { + configureChipForConcurrencyType(IfaceConcurrencyType::STA); + + std::vector iface_names; + EXPECT_TRUE(wifi_chip_->getP2pIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 0); + + std::shared_ptr iface; + EXPECT_TRUE(wifi_chip_->createStaIface(&iface).isOk()); + ASSERT_NE(nullptr, iface.get()); + + std::string iface_name = getStaIfaceName(iface); + EXPECT_TRUE(wifi_chip_->getStaIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 1); + EXPECT_EQ(iface_name, iface_names[0]); + + EXPECT_TRUE(wifi_chip_->removeStaIface(iface_name).isOk()); + EXPECT_TRUE(wifi_chip_->getStaIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 0); +} + +/* + * GetP2pIfaceNames + */ +TEST_P(WifiChipAidlTest, GetP2pIfaceNames) { + configureChipForConcurrencyType(IfaceConcurrencyType::P2P); + + std::vector iface_names; + EXPECT_TRUE(wifi_chip_->getP2pIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 0); + + std::shared_ptr iface; + EXPECT_TRUE(wifi_chip_->createP2pIface(&iface).isOk()); + ASSERT_NE(nullptr, iface.get()); + + std::string iface_name = getP2pIfaceName(iface); + EXPECT_TRUE(wifi_chip_->getP2pIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 1); + EXPECT_EQ(iface_name, iface_names[0]); + + EXPECT_TRUE(wifi_chip_->removeP2pIface(iface_name).isOk()); + EXPECT_TRUE(wifi_chip_->getP2pIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 0); +} + +/* + * GetApIfaceNames + */ +TEST_P(WifiChipAidlTest, GetApIfaceNames) { + configureChipForConcurrencyType(IfaceConcurrencyType::AP); + + std::vector iface_names; + EXPECT_TRUE(wifi_chip_->getApIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 0); + + std::shared_ptr iface; + EXPECT_TRUE(wifi_chip_->createApIface(&iface).isOk()); + ASSERT_NE(nullptr, iface.get()); + + std::string iface_name = getApIfaceName(iface); + EXPECT_TRUE(wifi_chip_->getApIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 1); + EXPECT_EQ(iface_name, iface_names[0]); + + EXPECT_TRUE(wifi_chip_->removeApIface(iface_name).isOk()); + EXPECT_TRUE(wifi_chip_->getApIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 0); +} + +/* + * GetNanIfaceNames + */ +TEST_P(WifiChipAidlTest, GetNanIfaceNames) { + configureChipForConcurrencyType(IfaceConcurrencyType::NAN_IFACE); + + std::vector iface_names; + EXPECT_TRUE(wifi_chip_->getNanIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 0); + + std::shared_ptr iface; + EXPECT_TRUE(wifi_chip_->createNanIface(&iface).isOk()); + ASSERT_NE(nullptr, iface.get()); + + std::string iface_name = getNanIfaceName(iface); + EXPECT_TRUE(wifi_chip_->getNanIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 1); + EXPECT_EQ(iface_name, iface_names[0]); + + EXPECT_TRUE(wifi_chip_->removeNanIface(iface_name).isOk()); + EXPECT_TRUE(wifi_chip_->getNanIfaceNames(&iface_names).isOk()); + EXPECT_EQ(iface_names.size(), 0); +} + +/* + * GetStaIface + * Configures the chip in STA mode and creates an iface. Then retrieves + * the iface object using its name and ensures that any other name + * doesn't retrieve a valid iface object. + */ +TEST_P(WifiChipAidlTest, GetStaIface) { + std::shared_ptr iface = configureChipForStaAndGetIface(); + std::string iface_name = getStaIfaceName(iface); + + std::shared_ptr retrieved_iface; + EXPECT_TRUE(wifi_chip_->getStaIface(iface_name, &retrieved_iface).isOk()); + EXPECT_NE(nullptr, retrieved_iface.get()); + + std::string invalid_name = iface_name + "0"; + std::shared_ptr invalid_iface; + auto status = wifi_chip_->getStaIface(invalid_name, &invalid_iface); + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); + EXPECT_EQ(nullptr, invalid_iface.get()); +} + +/* + * GetP2pIface + */ +TEST_P(WifiChipAidlTest, GetP2pIface) { + std::shared_ptr iface = configureChipForP2pAndGetIface(); + std::string iface_name = getP2pIfaceName(iface); + + std::shared_ptr retrieved_iface; + EXPECT_TRUE(wifi_chip_->getP2pIface(iface_name, &retrieved_iface).isOk()); + EXPECT_NE(nullptr, retrieved_iface.get()); + + std::string invalid_name = iface_name + "0"; + std::shared_ptr invalid_iface; + auto status = wifi_chip_->getP2pIface(invalid_name, &invalid_iface); + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); + EXPECT_EQ(nullptr, invalid_iface.get()); +} + +/* + * GetApIface + */ +TEST_P(WifiChipAidlTest, GetApIface) { + std::shared_ptr iface = configureChipForApAndGetIface(); + std::string iface_name = getApIfaceName(iface); + + std::shared_ptr retrieved_iface; + EXPECT_TRUE(wifi_chip_->getApIface(iface_name, &retrieved_iface).isOk()); + EXPECT_NE(nullptr, retrieved_iface.get()); + + std::string invalid_name = iface_name + "0"; + std::shared_ptr invalid_iface; + auto status = wifi_chip_->getApIface(invalid_name, &invalid_iface); + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); + EXPECT_EQ(nullptr, invalid_iface.get()); +} + +/* + * GetNanIface + */ +TEST_P(WifiChipAidlTest, GetNanIface) { + std::shared_ptr iface = configureChipForNanAndGetIface(); + std::string iface_name = getNanIfaceName(iface); + + std::shared_ptr retrieved_iface; + EXPECT_TRUE(wifi_chip_->getNanIface(iface_name, &retrieved_iface).isOk()); + EXPECT_NE(nullptr, retrieved_iface.get()); + + std::string invalid_name = iface_name + "0"; + std::shared_ptr invalid_iface; + auto status = wifi_chip_->getNanIface(invalid_name, &invalid_iface); + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); + EXPECT_EQ(nullptr, invalid_iface.get()); +} + +/* + * RemoveStaIface + * Configures the chip in STA mode and creates an iface. Then removes + * the iface object using the correct name and ensures that any other + * name doesn't remove the iface. + */ +TEST_P(WifiChipAidlTest, RemoveStaIface) { + std::shared_ptr iface = configureChipForStaAndGetIface(); + std::string iface_name = getStaIfaceName(iface); + + std::string invalid_name = iface_name + "0"; + auto status = wifi_chip_->removeStaIface(invalid_name); + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); + EXPECT_TRUE(wifi_chip_->removeStaIface(iface_name).isOk()); + + // No such iface exists now, so this should return failure. + EXPECT_FALSE(wifi_chip_->removeStaIface(iface_name).isOk()); +} + +/* + * RemoveP2pIface + */ +TEST_P(WifiChipAidlTest, RemoveP2pIface) { + std::shared_ptr iface = configureChipForP2pAndGetIface(); + std::string iface_name = getP2pIfaceName(iface); + + std::string invalid_name = iface_name + "0"; + auto status = wifi_chip_->removeP2pIface(invalid_name); + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); + EXPECT_TRUE(wifi_chip_->removeP2pIface(iface_name).isOk()); + + // No such iface exists now, so this should return failure. + EXPECT_FALSE(wifi_chip_->removeP2pIface(iface_name).isOk()); +} + +/* + * RemoveApIface + */ +TEST_P(WifiChipAidlTest, RemoveApIface) { + std::shared_ptr iface = configureChipForApAndGetIface(); + std::string iface_name = getApIfaceName(iface); + + std::string invalid_name = iface_name + "0"; + auto status = wifi_chip_->removeApIface(invalid_name); + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); + EXPECT_TRUE(wifi_chip_->removeApIface(iface_name).isOk()); + + // No such iface exists now, so this should return failure. + EXPECT_FALSE(wifi_chip_->removeApIface(iface_name).isOk()); +} + +/* + * RemoveNanIface + */ +TEST_P(WifiChipAidlTest, RemoveNanIface) { + std::shared_ptr iface = configureChipForNanAndGetIface(); + std::string iface_name = getNanIfaceName(iface); + + std::string invalid_name = iface_name + "0"; + auto status = wifi_chip_->removeNanIface(invalid_name); + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); + EXPECT_TRUE(wifi_chip_->removeNanIface(iface_name).isOk()); + + // No such iface exists now, so this should return failure. + EXPECT_FALSE(wifi_chip_->removeNanIface(iface_name).isOk()); +} + +/* + * CreateRttController + */ +TEST_P(WifiChipAidlTest, CreateRttController) { + std::shared_ptr iface = configureChipForStaAndGetIface(); + std::shared_ptr rtt_controller; + auto status = wifi_chip_->createRttController(iface, &rtt_controller); + if (status.isOk()) { + EXPECT_NE(nullptr, rtt_controller.get()); + } else { + EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + } +} + +/** + * CreateBridgedApIface & RemoveIfaceInstanceFromBridgedApIface + */ +TEST_P(WifiChipAidlTest, CreateBridgedApIfaceAndremoveIfaceInstanceFromBridgedApIfaceTest) { + bool isBridgedSupport = testing::checkSubstringInCommandOutput( + "/system/bin/cmd wifi get-softap-supported-features", + "wifi_softap_bridged_ap_supported"); + if (!isBridgedSupport) { + GTEST_SKIP() << "Missing Bridged AP support"; + } + + std::shared_ptr wifi_chip = getWifiChip(getInstanceName()); + ASSERT_NE(nullptr, wifi_chip.get()); + std::shared_ptr wifi_ap_iface = getBridgedWifiApIface(wifi_chip); + ASSERT_NE(nullptr, wifi_ap_iface.get()); + + std::string br_name; + std::vector instances; + EXPECT_TRUE(wifi_ap_iface->getName(&br_name).isOk()); + EXPECT_TRUE(wifi_ap_iface->getBridgedInstances(&instances).isOk()); + EXPECT_EQ(instances.size(), 2); + + std::vector instances_after_remove; + EXPECT_TRUE(wifi_chip->removeIfaceInstanceFromBridgedApIface(br_name, instances[0]).isOk()); + EXPECT_TRUE(wifi_ap_iface->getBridgedInstances(&instances_after_remove).isOk()); + EXPECT_EQ(instances_after_remove.size(), 1); +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiChipAidlTest); +INSTANTIATE_TEST_SUITE_P(WifiTest, WifiChipAidlTest, + testing::ValuesIn(android::getAidlHalInstanceNames(IWifi::descriptor)), + android::PrintInstanceNameToString); + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + android::ProcessState::self()->setThreadPoolMaxThreadCount(1); + android::ProcessState::self()->startThreadPool(); + return RUN_ALL_TESTS(); +} diff --git a/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp new file mode 100644 index 0000000000..457d57ad75 --- /dev/null +++ b/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp @@ -0,0 +1,627 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Staache 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. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "wifi_aidl_test_utils.h" + +using aidl::android::hardware::wifi::BnWifiNanIfaceEventCallback; +using aidl::android::hardware::wifi::IWifiNanIface; +using aidl::android::hardware::wifi::NanBandIndex; +using aidl::android::hardware::wifi::NanBandSpecificConfig; +using aidl::android::hardware::wifi::NanCapabilities; +using aidl::android::hardware::wifi::NanClusterEventInd; +using aidl::android::hardware::wifi::NanConfigRequest; +using aidl::android::hardware::wifi::NanConfigRequestSupplemental; +using aidl::android::hardware::wifi::NanDataPathConfirmInd; +using aidl::android::hardware::wifi::NanDataPathRequestInd; +using aidl::android::hardware::wifi::NanDataPathScheduleUpdateInd; +using aidl::android::hardware::wifi::NanDataPathSecurityType; +using aidl::android::hardware::wifi::NanEnableRequest; +using aidl::android::hardware::wifi::NanFollowupReceivedInd; +using aidl::android::hardware::wifi::NanInitiateDataPathRequest; +using aidl::android::hardware::wifi::NanMatchAlg; +using aidl::android::hardware::wifi::NanMatchInd; +using aidl::android::hardware::wifi::NanPublishRequest; +using aidl::android::hardware::wifi::NanPublishType; +using aidl::android::hardware::wifi::NanRespondToDataPathIndicationRequest; +using aidl::android::hardware::wifi::NanStatus; +using aidl::android::hardware::wifi::NanStatusCode; +using aidl::android::hardware::wifi::NanTxType; + +#define TIMEOUT_PERIOD 10 + +class WifiNanIfaceAidlTest : public testing::TestWithParam { + public: + void SetUp() override { + if (!::testing::deviceSupportsFeature("android.hardware.wifi.aware")) + GTEST_SKIP() << "Skipping this test since NAN is not supported."; + stopWifiService(getInstanceName()); + + wifi_nan_iface_ = getWifiNanIface(getInstanceName()); + ASSERT_NE(nullptr, wifi_nan_iface_.get()); + std::shared_ptr callback = + ndk::SharedRefBase::make(*this); + EXPECT_TRUE(wifi_nan_iface_->registerEventCallback(callback).isOk()); + } + + void TearDown() override { stopWifiService(getInstanceName()); } + + // Used as a mechanism to inform the test about data/event callbacks. + inline void notify() { + std::unique_lock lock(mtx_); + count_++; + cv_.notify_one(); + } + + enum CallbackType { + INVALID = -2, + ANY_CALLBACK = -1, + + NOTIFY_CAPABILITIES_RESPONSE = 0, + NOTIFY_ENABLE_RESPONSE, + NOTIFY_CONFIG_RESPONSE, + NOTIFY_DISABLE_RESPONSE, + NOTIFY_START_PUBLISH_RESPONSE, + NOTIFY_STOP_PUBLISH_RESPONSE, + NOTIFY_START_SUBSCRIBE_RESPONSE, + NOTIFY_STOP_SUBSCRIBE_RESPONSE, + NOTIFY_TRANSMIT_FOLLOWUP_RESPONSE, + NOTIFY_CREATE_DATA_INTERFACE_RESPONSE, + NOTIFY_DELETE_DATA_INTERFACE_RESPONSE, + NOTIFY_INITIATE_DATA_PATH_RESPONSE, + NOTIFY_RESPOND_TO_DATA_PATH_INDICATION_RESPONSE, + NOTIFY_TERMINATE_DATA_PATH_RESPONSE, + + EVENT_CLUSTER_EVENT, + EVENT_DISABLED, + EVENT_PUBLISH_TERMINATED, + EVENT_SUBSCRIBE_TERMINATED, + EVENT_MATCH, + EVENT_MATCH_EXPIRED, + EVENT_FOLLOWUP_RECEIVED, + EVENT_TRANSMIT_FOLLOWUP, + EVENT_DATA_PATH_REQUEST, + EVENT_DATA_PATH_CONFIRM, + EVENT_DATA_PATH_TERMINATED, + EVENT_DATA_PATH_SCHEDULE_UPDATE, + }; + + // Test code calls this function to wait for data/event callback. + // Must set callbackType = INVALID before calling this function. + inline std::cv_status wait(CallbackType waitForCallbackType) { + std::unique_lock lock(mtx_); + EXPECT_NE(INVALID, waitForCallbackType); + + std::cv_status status = std::cv_status::no_timeout; + auto now = std::chrono::system_clock::now(); + while (count_ == 0) { + status = cv_.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD)); + if (status == std::cv_status::timeout) return status; + if (waitForCallbackType != ANY_CALLBACK && callback_type_ != INVALID && + callback_type_ != waitForCallbackType) { + count_--; + } + } + count_--; + return status; + } + + class WifiNanIfaceEventCallback : public BnWifiNanIfaceEventCallback { + public: + WifiNanIfaceEventCallback(WifiNanIfaceAidlTest& parent) : parent_(parent){}; + + ::ndk::ScopedAStatus eventClusterEvent(const NanClusterEventInd& event) override { + parent_.callback_type_ = EVENT_CLUSTER_EVENT; + parent_.nan_cluster_event_ind_ = event; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventDataPathConfirm(const NanDataPathConfirmInd& event) override { + parent_.callback_type_ = EVENT_DATA_PATH_CONFIRM; + parent_.nan_data_path_confirm_ind_ = event; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventDataPathRequest(const NanDataPathRequestInd& event) override { + parent_.callback_type_ = EVENT_DATA_PATH_REQUEST; + parent_.nan_data_path_request_ind_ = event; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventDataPathScheduleUpdate( + const NanDataPathScheduleUpdateInd& event) override { + parent_.callback_type_ = EVENT_DATA_PATH_SCHEDULE_UPDATE; + parent_.nan_data_path_schedule_update_ind_ = event; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventDataPathTerminated(int32_t ndpInstanceId) override { + parent_.callback_type_ = EVENT_DATA_PATH_TERMINATED; + parent_.ndp_instance_id_ = ndpInstanceId; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventDisabled(const NanStatus& status) override { + parent_.callback_type_ = EVENT_DISABLED; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventFollowupReceived(const NanFollowupReceivedInd& event) override { + parent_.callback_type_ = EVENT_FOLLOWUP_RECEIVED; + parent_.nan_followup_received_ind_ = event; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventMatch(const NanMatchInd& event) override { + parent_.callback_type_ = EVENT_MATCH; + parent_.nan_match_ind_ = event; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventMatchExpired(int8_t discoverySessionId, int32_t peerId) override { + parent_.callback_type_ = EVENT_MATCH_EXPIRED; + parent_.session_id_ = discoverySessionId; + parent_.peer_id_ = peerId; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventPublishTerminated(int8_t sessionId, + const NanStatus& status) override { + parent_.callback_type_ = EVENT_PUBLISH_TERMINATED; + parent_.session_id_ = sessionId; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventSubscribeTerminated(int8_t sessionId, + const NanStatus& status) override { + parent_.callback_type_ = EVENT_SUBSCRIBE_TERMINATED; + parent_.session_id_ = sessionId; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventTransmitFollowup(char16_t id, const NanStatus& status) override { + parent_.callback_type_ = EVENT_TRANSMIT_FOLLOWUP; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyCapabilitiesResponse( + char16_t id, const NanStatus& status, + const NanCapabilities& capabilities) override { + parent_.callback_type_ = NOTIFY_CAPABILITIES_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.capabilities_ = capabilities; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyConfigResponse(char16_t id, const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_CONFIG_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyCreateDataInterfaceResponse(char16_t id, + const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_CREATE_DATA_INTERFACE_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyDeleteDataInterfaceResponse(char16_t id, + const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_DELETE_DATA_INTERFACE_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyDisableResponse(char16_t id, const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_DISABLE_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyEnableResponse(char16_t id, const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_ENABLE_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyInitiateDataPathResponse(char16_t id, const NanStatus& status, + int32_t ndpInstanceId) override { + parent_.callback_type_ = NOTIFY_INITIATE_DATA_PATH_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.ndp_instance_id_ = ndpInstanceId; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyRespondToDataPathIndicationResponse( + char16_t id, const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_RESPOND_TO_DATA_PATH_INDICATION_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyStartPublishResponse(char16_t id, const NanStatus& status, + int8_t sessionId) override { + parent_.callback_type_ = NOTIFY_START_PUBLISH_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.session_id_ = sessionId; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyStartSubscribeResponse(char16_t id, const NanStatus& status, + int8_t sessionId) override { + parent_.callback_type_ = NOTIFY_START_SUBSCRIBE_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.session_id_ = sessionId; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyStopPublishResponse(char16_t id, + const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_STOP_PUBLISH_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyStopSubscribeResponse(char16_t id, + const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_STOP_SUBSCRIBE_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyTerminateDataPathResponse(char16_t id, + const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_TERMINATE_DATA_PATH_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyTransmitFollowupResponse(char16_t id, + const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_TRANSMIT_FOLLOWUP_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + + private: + WifiNanIfaceAidlTest& parent_; + }; + + protected: + std::shared_ptr wifi_nan_iface_; + CallbackType callback_type_; + uint16_t id_; + uint8_t session_id_; + uint32_t ndp_instance_id_; + uint32_t peer_id_; + NanCapabilities capabilities_; + NanClusterEventInd nan_cluster_event_ind_; + NanDataPathConfirmInd nan_data_path_confirm_ind_; + NanDataPathRequestInd nan_data_path_request_ind_; + NanDataPathScheduleUpdateInd nan_data_path_schedule_update_ind_; + NanFollowupReceivedInd nan_followup_received_ind_; + NanMatchInd nan_match_ind_; + NanStatus status_; + + const char* getInstanceName() { return GetParam().c_str(); } + + private: + // synchronization objects + std::mutex mtx_; + std::condition_variable cv_; + int count_ = 0; +}; + +/* + * FailOnIfaceInvalid + * Ensure that API calls to an interface fail with code ERROR_WIFI_IFACE_INVALID + * after wifi is disabled. + */ +TEST_P(WifiNanIfaceAidlTest, FailOnIfaceInvalid) { + stopWifiService(getInstanceName()); + sleep(5); // Ensure that all chips/interfaces are invalidated. + auto status = wifi_nan_iface_->getCapabilitiesRequest(0); + ASSERT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_WIFI_IFACE_INVALID)); +} + +/* + * EnableRequest - Invalid Args + */ +TEST_P(WifiNanIfaceAidlTest, EnableRequest_InvalidArgs) { + uint16_t inputCmdId = 10; + callback_type_ = INVALID; + NanEnableRequest nanEnableRequest = {}; + NanConfigRequestSupplemental nanConfigRequestSupp = {}; + auto status = + wifi_nan_iface_->enableRequest(inputCmdId, nanEnableRequest, nanConfigRequestSupp); + if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { + ASSERT_TRUE(status.isOk()); + + // Wait for a callback. + ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_ENABLE_RESPONSE)); + ASSERT_EQ(NOTIFY_ENABLE_RESPONSE, callback_type_); + ASSERT_EQ(id_, inputCmdId); + ASSERT_EQ(status_.status, NanStatusCode::INVALID_ARGS); + } +} + +/* + * ConfigRequest - Invalid Args + */ +TEST_P(WifiNanIfaceAidlTest, ConfigRequest_InvalidArgs) { + uint16_t inputCmdId = 10; + callback_type_ = INVALID; + NanConfigRequest nanConfigRequest = {}; + NanConfigRequestSupplemental nanConfigRequestSupp = {}; + auto status = + wifi_nan_iface_->configRequest(inputCmdId, nanConfigRequest, nanConfigRequestSupp); + + if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { + ASSERT_TRUE(status.isOk()); + + // Wait for a callback. + ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_CONFIG_RESPONSE)); + ASSERT_EQ(NOTIFY_CONFIG_RESPONSE, callback_type_); + ASSERT_EQ(id_, inputCmdId); + ASSERT_EQ(status_.status, NanStatusCode::INVALID_ARGS); + } +} + +/* + * EnableRequest - Invalid Args in Shim Conversion + */ +TEST_P(WifiNanIfaceAidlTest, EnableRequest_InvalidShimArgs) { + uint16_t inputCmdId = 10; + NanEnableRequest nanEnableRequest = {}; + nanEnableRequest.configParams.numberOfPublishServiceIdsInBeacon = -15; // must be > 0 + NanConfigRequestSupplemental nanConfigRequestSupp = {}; + auto status = + wifi_nan_iface_->enableRequest(inputCmdId, nanEnableRequest, nanConfigRequestSupp); + if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { + ASSERT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); + } +} + +/* + * ConfigRequest - Invalid Args in Shim Conversion + */ +TEST_P(WifiNanIfaceAidlTest, ConfigRequest_InvalidShimArgs) { + uint16_t inputCmdId = 10; + NanConfigRequest nanConfigRequest = {}; + nanConfigRequest.numberOfPublishServiceIdsInBeacon = -15; // must be > 0 + NanConfigRequestSupplemental nanConfigRequestSupp = {}; + auto status = + wifi_nan_iface_->configRequest(inputCmdId, nanConfigRequest, nanConfigRequestSupp); + if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { + ASSERT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_INVALID_ARGS)); + } +} + +/* + * NotifyCapabilitiesResponse + */ +TEST_P(WifiNanIfaceAidlTest, NotifyCapabilitiesResponse) { + uint16_t inputCmdId = 10; + callback_type_ = INVALID; + EXPECT_TRUE(wifi_nan_iface_->getCapabilitiesRequest(inputCmdId).isOk()); + + // Wait for a callback. + ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_CAPABILITIES_RESPONSE)); + ASSERT_EQ(NOTIFY_CAPABILITIES_RESPONSE, callback_type_); + ASSERT_EQ(id_, inputCmdId); + ASSERT_EQ(status_.status, NanStatusCode::SUCCESS); + + // Check for reasonable capability values. + EXPECT_GT(capabilities_.maxConcurrentClusters, 0); + EXPECT_GT(capabilities_.maxPublishes, 0); + EXPECT_GT(capabilities_.maxSubscribes, 0); + EXPECT_EQ(capabilities_.maxServiceNameLen, 255); + EXPECT_EQ(capabilities_.maxMatchFilterLen, 255); + EXPECT_GT(capabilities_.maxTotalMatchFilterLen, 255); + EXPECT_EQ(capabilities_.maxServiceSpecificInfoLen, 255); + EXPECT_GE(capabilities_.maxExtendedServiceSpecificInfoLen, 255); + EXPECT_GT(capabilities_.maxNdiInterfaces, 0); + EXPECT_GT(capabilities_.maxNdpSessions, 0); + EXPECT_GT(capabilities_.maxAppInfoLen, 0); + EXPECT_GT(capabilities_.maxQueuedTransmitFollowupMsgs, 0); + EXPECT_GT(capabilities_.maxSubscribeInterfaceAddresses, 0); + EXPECT_NE(static_cast(capabilities_.supportedCipherSuites), 0); +} + +/* + * StartPublishRequest + */ +TEST_P(WifiNanIfaceAidlTest, StartPublishRequest) { + uint16_t inputCmdId = 10; + NanBandSpecificConfig config24 = {}; + config24.rssiClose = 60; + config24.rssiMiddle = 70; + config24.rssiCloseProximity = 60; + config24.dwellTimeMs = 200; + config24.scanPeriodSec = 20; + config24.validDiscoveryWindowIntervalVal = false; + config24.discoveryWindowIntervalVal = 0; + + NanBandSpecificConfig config5 = {}; + config5.rssiClose = 60; + config5.rssiMiddle = 75; + config5.rssiCloseProximity = 60; + config5.dwellTimeMs = 200; + config5.scanPeriodSec = 20; + config5.validDiscoveryWindowIntervalVal = false; + config5.discoveryWindowIntervalVal = 0; + + NanEnableRequest req = {}; + req.operateInBand[static_cast(NanBandIndex::NAN_BAND_24GHZ)] = true; + req.operateInBand[static_cast(NanBandIndex::NAN_BAND_5GHZ)] = false; + req.hopCountMax = 2; + req.configParams.masterPref = 0; + req.configParams.disableDiscoveryAddressChangeIndication = true; + req.configParams.disableStartedClusterIndication = true; + req.configParams.disableJoinedClusterIndication = true; + req.configParams.includePublishServiceIdsInBeacon = true; + req.configParams.numberOfPublishServiceIdsInBeacon = 0; + req.configParams.includeSubscribeServiceIdsInBeacon = true; + req.configParams.numberOfSubscribeServiceIdsInBeacon = 0; + req.configParams.rssiWindowSize = 8; + req.configParams.macAddressRandomizationIntervalSec = 1800; + req.configParams.bandSpecificConfig[static_cast(NanBandIndex::NAN_BAND_24GHZ)] = + config24; + req.configParams.bandSpecificConfig[static_cast(NanBandIndex::NAN_BAND_5GHZ)] = + config5; + + req.debugConfigs.validClusterIdVals = true; + req.debugConfigs.clusterIdTopRangeVal = 65535; + req.debugConfigs.clusterIdBottomRangeVal = 0; + req.debugConfigs.validIntfAddrVal = false; + req.debugConfigs.validOuiVal = false; + req.debugConfigs.ouiVal = 0; + req.debugConfigs.validRandomFactorForceVal = false; + req.debugConfigs.randomFactorForceVal = 0; + req.debugConfigs.validHopCountForceVal = false; + req.debugConfigs.hopCountForceVal = 0; + req.debugConfigs.validDiscoveryChannelVal = false; + req.debugConfigs.discoveryChannelMhzVal[static_cast(NanBandIndex::NAN_BAND_24GHZ)] = 0; + req.debugConfigs.discoveryChannelMhzVal[static_cast(NanBandIndex::NAN_BAND_5GHZ)] = 0; + req.debugConfigs.validUseBeaconsInBandVal = false; + req.debugConfigs.useBeaconsInBandVal[static_cast(NanBandIndex::NAN_BAND_24GHZ)] = true; + req.debugConfigs.useBeaconsInBandVal[static_cast(NanBandIndex::NAN_BAND_5GHZ)] = true; + req.debugConfigs.validUseSdfInBandVal = false; + req.debugConfigs.useSdfInBandVal[static_cast(NanBandIndex::NAN_BAND_24GHZ)] = true; + req.debugConfigs.useSdfInBandVal[static_cast(NanBandIndex::NAN_BAND_5GHZ)] = true; + + NanConfigRequestSupplemental nanConfigRequestSupp = {}; + nanConfigRequestSupp.discoveryBeaconIntervalMs = 20; + nanConfigRequestSupp.numberOfSpatialStreamsInDiscovery = 0; + nanConfigRequestSupp.enableDiscoveryWindowEarlyTermination = false; + + callback_type_ = INVALID; + auto status = wifi_nan_iface_->enableRequest(inputCmdId, req, nanConfigRequestSupp); + if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { + ASSERT_TRUE(status.isOk()); + + // Wait for a callback. + ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_ENABLE_RESPONSE)); + ASSERT_EQ(NOTIFY_ENABLE_RESPONSE, callback_type_); + ASSERT_EQ(id_, inputCmdId); + ASSERT_EQ(status_.status, NanStatusCode::SUCCESS); + } + + NanPublishRequest nanPublishRequest = {}; + nanPublishRequest.baseConfigs.sessionId = 0; + nanPublishRequest.baseConfigs.ttlSec = 0; + nanPublishRequest.baseConfigs.discoveryWindowPeriod = 1; + nanPublishRequest.baseConfigs.discoveryCount = 0; + nanPublishRequest.baseConfigs.serviceName = {97}; + nanPublishRequest.baseConfigs.discoveryMatchIndicator = NanMatchAlg::MATCH_NEVER; + nanPublishRequest.baseConfigs.useRssiThreshold = false; + nanPublishRequest.baseConfigs.disableDiscoveryTerminationIndication = false; + nanPublishRequest.baseConfigs.disableMatchExpirationIndication = true; + nanPublishRequest.baseConfigs.disableFollowupReceivedIndication = false; + nanPublishRequest.baseConfigs.securityConfig.securityType = NanDataPathSecurityType::OPEN; + nanPublishRequest.autoAcceptDataPathRequests = false; + nanPublishRequest.publishType = NanPublishType::UNSOLICITED; + nanPublishRequest.txType = NanTxType::BROADCAST; + + status = wifi_nan_iface_->startPublishRequest(inputCmdId + 1, nanPublishRequest); + if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { + ASSERT_TRUE(status.isOk()); + + // Wait for a callback. + ASSERT_EQ(std::cv_status::no_timeout, wait(NOTIFY_START_PUBLISH_RESPONSE)); + ASSERT_EQ(NOTIFY_START_PUBLISH_RESPONSE, callback_type_); + ASSERT_EQ(id_, inputCmdId + 1); + ASSERT_EQ(status_.status, NanStatusCode::SUCCESS); + } +} + +/* + * RespondToDataPathIndicationRequest - Invalid Args + */ +TEST_P(WifiNanIfaceAidlTest, RespondToDataPathIndicationRequest_InvalidArgs) { + uint16_t inputCmdId = 10; + callback_type_ = INVALID; + NanRespondToDataPathIndicationRequest nanRespondToDataPathIndicationRequest = {}; + nanRespondToDataPathIndicationRequest.ifaceName = "AwareInterfaceNameTooLong"; + auto status = wifi_nan_iface_->respondToDataPathIndicationRequest( + inputCmdId, nanRespondToDataPathIndicationRequest); + + if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { + ASSERT_EQ(status.getServiceSpecificError(), + static_cast(WifiStatusCode::ERROR_INVALID_ARGS)); + } +} + +/* + * InitiateDataPathRequest - Invalid Args + */ +TEST_P(WifiNanIfaceAidlTest, InitiateDataPathRequest_InvalidArgs) { + uint16_t inputCmdId = 10; + callback_type_ = INVALID; + NanInitiateDataPathRequest nanInitiateDataPathRequest = {}; + nanInitiateDataPathRequest.ifaceName = "AwareInterfaceNameTooLong"; + auto status = wifi_nan_iface_->initiateDataPathRequest(inputCmdId, nanInitiateDataPathRequest); + + if (!checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { + ASSERT_EQ(status.getServiceSpecificError(), + static_cast(WifiStatusCode::ERROR_INVALID_ARGS)); + } +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiNanIfaceAidlTest); +INSTANTIATE_TEST_SUITE_P(WifiTest, WifiNanIfaceAidlTest, + testing::ValuesIn(android::getAidlHalInstanceNames(IWifi::descriptor)), + android::PrintInstanceNameToString); + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + android::ProcessState::self()->setThreadPoolMaxThreadCount(1); + android::ProcessState::self()->startThreadPool(); + return RUN_ALL_TESTS(); +} diff --git a/wifi/aidl/vts/functional/wifi_rtt_controller_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_rtt_controller_aidl_test.cpp new file mode 100644 index 0000000000..d763fe64a5 --- /dev/null +++ b/wifi/aidl/vts/functional/wifi_rtt_controller_aidl_test.cpp @@ -0,0 +1,234 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Staache 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. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "wifi_aidl_test_utils.h" + +using aidl::android::hardware::wifi::BnWifiRttControllerEventCallback; +using aidl::android::hardware::wifi::IWifiRttController; +using aidl::android::hardware::wifi::RttBw; +using aidl::android::hardware::wifi::RttCapabilities; +using aidl::android::hardware::wifi::RttConfig; +using aidl::android::hardware::wifi::RttPeerType; +using aidl::android::hardware::wifi::RttPreamble; +using aidl::android::hardware::wifi::RttResponder; +using aidl::android::hardware::wifi::RttResult; +using aidl::android::hardware::wifi::RttType; +using aidl::android::hardware::wifi::WifiChannelInfo; +using aidl::android::hardware::wifi::WifiChannelWidthInMhz; +using aidl::android::hardware::wifi::WifiStatusCode; + +class WifiRttControllerAidlTest : public testing::TestWithParam { + public: + void SetUp() override { + if (!::testing::deviceSupportsFeature("android.hardware.wifi.rtt")) + GTEST_SKIP() << "Skipping this test since RTT is not supported."; + stopWifiService(getInstanceName()); + wifi_rtt_controller_ = getWifiRttController(); + ASSERT_NE(nullptr, wifi_rtt_controller_.get()); + + // Check RTT support before we run the test. + RttCapabilities caps = {}; + auto status = wifi_rtt_controller_->getCapabilities(&caps); + if (checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { + GTEST_SKIP() << "Skipping this test since RTT is not supported."; + } + } + + void TearDown() override { stopWifiService(getInstanceName()); } + + protected: + std::shared_ptr getWifiRttController() { + std::shared_ptr wifi_chip = getWifiChip(getInstanceName()); + EXPECT_NE(nullptr, wifi_chip.get()); + + std::shared_ptr wifi_sta_iface = getWifiStaIface(getInstanceName()); + EXPECT_NE(nullptr, wifi_sta_iface.get()); + + std::shared_ptr rtt_controller; + EXPECT_TRUE(wifi_chip->createRttController(wifi_sta_iface, &rtt_controller).isOk()); + EXPECT_NE(nullptr, rtt_controller.get()); + return rtt_controller; + } + + std::shared_ptr wifi_rtt_controller_; + + private: + const char* getInstanceName() { return GetParam().c_str(); } +}; + +class WifiRttControllerEventCallback : public BnWifiRttControllerEventCallback { + public: + WifiRttControllerEventCallback() = default; + + ::ndk::ScopedAStatus onResults(int /* cmdId */, + const std::vector& /* results */) override { + return ndk::ScopedAStatus::ok(); + } +}; + +/* + * RegisterEventCallback + * + * Note: it is not feasible to test the invocation of the callback function, + * since events are triggered internally in the HAL implementation and cannot be + * triggered from the test case. + */ +TEST_P(WifiRttControllerAidlTest, RegisterEventCallback) { + std::shared_ptr callback = + ndk::SharedRefBase::make(); + ASSERT_NE(nullptr, callback.get()); + EXPECT_TRUE(wifi_rtt_controller_->registerEventCallback(callback).isOk()); +} + +/* + * GetCapabilities + */ +TEST_P(WifiRttControllerAidlTest, GetCapabilities) { + RttCapabilities caps = {}; + EXPECT_TRUE(wifi_rtt_controller_->getCapabilities(&caps).isOk()); +} + +/* + * GetResponderInfo + */ +TEST_P(WifiRttControllerAidlTest, GetResponderInfo) { + RttResponder responder = {}; + EXPECT_TRUE(wifi_rtt_controller_->getResponderInfo(&responder).isOk()); +} + +/* + * EnableResponder + */ +TEST_P(WifiRttControllerAidlTest, EnableResponder) { + int cmdId = 55; + WifiChannelInfo channelInfo; + channelInfo.width = WifiChannelWidthInMhz::WIDTH_80; + channelInfo.centerFreq = 5660; + channelInfo.centerFreq0 = 5660; + channelInfo.centerFreq1 = 0; + + RttResponder responder = {}; + EXPECT_TRUE(wifi_rtt_controller_->getResponderInfo(&responder).isOk()); + EXPECT_TRUE(wifi_rtt_controller_->enableResponder(cmdId, channelInfo, 10, responder).isOk()); +} + +/* + * Request2SidedRangeMeasurement + * Tests the two sided ranging - 802.11mc FTM protocol. + */ +TEST_P(WifiRttControllerAidlTest, Request2SidedRangeMeasurement) { + RttCapabilities caps = {}; + EXPECT_TRUE(wifi_rtt_controller_->getCapabilities(&caps).isOk()); + if (!caps.rttFtmSupported) { + GTEST_SKIP() << "Skipping two sided RTT since driver/fw does not support"; + } + + RttConfig config; + config.addr = {{0x00, 0x01, 0x02, 0x03, 0x04, 0x05}}; + config.type = RttType::TWO_SIDED; + config.peer = RttPeerType::AP; + config.channel.width = WifiChannelWidthInMhz::WIDTH_80; + config.channel.centerFreq = 5180; + config.channel.centerFreq0 = 5210; + config.channel.centerFreq1 = 0; + config.bw = RttBw::BW_20MHZ; + config.preamble = RttPreamble::HT; + config.mustRequestLci = false; + config.mustRequestLcr = false; + config.burstPeriod = 0; + config.numBurst = 0; + config.numFramesPerBurst = 8; + config.numRetriesPerRttFrame = 0; + config.numRetriesPerFtmr = 0; + config.burstDuration = 9; + + int cmdId = 55; + std::vector configs = {config}; + EXPECT_TRUE(wifi_rtt_controller_->rangeRequest(cmdId, configs).isOk()); + + // Sleep for 2 seconds to wait for driver/firmware to complete RTT. + sleep(2); +} + +/* + * RangeRequest + */ +TEST_P(WifiRttControllerAidlTest, RangeRequest) { + RttCapabilities caps = {}; + EXPECT_TRUE(wifi_rtt_controller_->getCapabilities(&caps).isOk()); + if (!caps.rttOneSidedSupported) { + GTEST_SKIP() << "Skipping one sided RTT since driver/fw does not support"; + } + + // Get the highest supported preamble. + int preamble = 1; + int caps_preamble_support = static_cast(caps.preambleSupport); + caps_preamble_support >>= 1; + while (caps_preamble_support != 0) { + caps_preamble_support >>= 1; + preamble <<= 1; + } + + RttConfig config; + config.addr = {{0x00, 0x01, 0x02, 0x03, 0x04, 0x05}}; + config.type = RttType::ONE_SIDED; + config.peer = RttPeerType::AP; + config.channel.width = WifiChannelWidthInMhz::WIDTH_80; + config.channel.centerFreq = 5765; + config.channel.centerFreq0 = 5775; + config.channel.centerFreq1 = 0; + config.bw = RttBw::BW_80MHZ; + config.preamble = static_cast(preamble); + config.mustRequestLci = false; + config.mustRequestLcr = false; + config.burstPeriod = 0; + config.numBurst = 0; + config.numFramesPerBurst = 8; + config.numRetriesPerRttFrame = 3; + config.numRetriesPerFtmr = 3; + config.burstDuration = 9; + + int cmdId = 55; + std::vector configs = {config}; + EXPECT_TRUE(wifi_rtt_controller_->rangeRequest(cmdId, configs).isOk()); + + // Sleep for 2 seconds to wait for driver/firmware to complete RTT. + sleep(2); +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiRttControllerAidlTest); +INSTANTIATE_TEST_SUITE_P(WifiTest, WifiRttControllerAidlTest, + testing::ValuesIn(android::getAidlHalInstanceNames(IWifi::descriptor)), + android::PrintInstanceNameToString); + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + android::ProcessState::self()->setThreadPoolMaxThreadCount(1); + android::ProcessState::self()->startThreadPool(); + return RUN_ALL_TESTS(); +} diff --git a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp new file mode 100644 index 0000000000..ef7e2747c9 --- /dev/null +++ b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp @@ -0,0 +1,282 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Staache 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. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "wifi_aidl_test_utils.h" + +using aidl::android::hardware::wifi::IWifi; +using aidl::android::hardware::wifi::IWifiStaIface; +using aidl::android::hardware::wifi::MacAddress; +using aidl::android::hardware::wifi::Ssid; +using aidl::android::hardware::wifi::StaApfPacketFilterCapabilities; +using aidl::android::hardware::wifi::StaBackgroundScanCapabilities; +using aidl::android::hardware::wifi::StaLinkLayerStats; +using aidl::android::hardware::wifi::StaRoamingCapabilities; +using aidl::android::hardware::wifi::StaRoamingConfig; +using aidl::android::hardware::wifi::StaRoamingState; +using aidl::android::hardware::wifi::WifiBand; +using aidl::android::hardware::wifi::WifiDebugRxPacketFateReport; +using aidl::android::hardware::wifi::WifiDebugTxPacketFateReport; +using aidl::android::hardware::wifi::WifiStatusCode; + +class WifiStaIfaceAidlTest : public testing::TestWithParam { + public: + void SetUp() override { + stopWifiService(getInstanceName()); + wifi_sta_iface_ = getWifiStaIface(getInstanceName()); + ASSERT_NE(nullptr, wifi_sta_iface_.get()); + } + + void TearDown() override { stopWifiService(getInstanceName()); } + + protected: + bool isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask expected) { + IWifiStaIface::StaIfaceCapabilityMask caps = {}; + EXPECT_TRUE(wifi_sta_iface_->getCapabilities(&caps).isOk()); + return static_cast(caps) & static_cast(expected); + } + + ndk::ScopedAStatus createStaIface(std::shared_ptr* sta_iface) { + std::shared_ptr wifi_chip = getWifiChip(getInstanceName()); + EXPECT_NE(nullptr, wifi_chip.get()); + return wifi_chip->createStaIface(sta_iface); + } + + std::shared_ptr wifi_sta_iface_; + + private: + const char* getInstanceName() { return GetParam().c_str(); } +}; + +/* + * GetFactoryMacAddress + * Ensures that calls to getFactoryMacAddress will retrieve a non-zero MAC. + */ +TEST_P(WifiStaIfaceAidlTest, GetFactoryMacAddress) { + std::array mac; + EXPECT_TRUE(wifi_sta_iface_->getFactoryMacAddress(&mac).isOk()); + std::array all_zero_mac = {0, 0, 0, 0, 0, 0}; + EXPECT_NE(mac, all_zero_mac); +} + +/* + * GetCapabilities + */ +TEST_P(WifiStaIfaceAidlTest, GetCapabilities) { + IWifiStaIface::StaIfaceCapabilityMask caps = {}; + EXPECT_TRUE(wifi_sta_iface_->getCapabilities(&caps).isOk()); + EXPECT_NE(static_cast(caps), 0); +} + +/* + * GetApfPacketFilterCapabilities + */ +TEST_P(WifiStaIfaceAidlTest, GetApfPacketFilterCapabilities) { + if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::APF)) { + GTEST_SKIP() << "APF packet filter capabilities are not supported."; + } + StaApfPacketFilterCapabilities apf_caps = {}; + EXPECT_TRUE(wifi_sta_iface_->getApfPacketFilterCapabilities(&apf_caps).isOk()); +} + +/* + * GetBackgroundScanCapabilities + */ +TEST_P(WifiStaIfaceAidlTest, GetBackgroundScanCapabilities) { + if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::BACKGROUND_SCAN)) { + GTEST_SKIP() << "Background scan capabilities are not supported."; + } + StaBackgroundScanCapabilities caps = {}; + EXPECT_TRUE(wifi_sta_iface_->getBackgroundScanCapabilities(&caps).isOk()); +} + +/* + * GetValidFrequenciesForBand + * Ensures that we can retrieve valid frequencies for the 2.4 GHz band. + */ +TEST_P(WifiStaIfaceAidlTest, GetValidFrequenciesForBand) { + std::vector freqs; + EXPECT_TRUE(wifi_sta_iface_->getValidFrequenciesForBand(WifiBand::BAND_24GHZ, &freqs).isOk()); + EXPECT_NE(freqs.size(), 0); +} + +/* + * GetLinkLayerStats + * Ensures that calls to getLinkLayerStats will retrieve a non-empty + * StaLinkLayerStats after link layer stats collection is enabled. + */ +TEST_P(WifiStaIfaceAidlTest, GetLinkLayerStats) { + if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::LINK_LAYER_STATS)) { + GTEST_SKIP() << "Skipping this test since link layer stats are not supported."; + } + + // Enable link layer stats collection. + EXPECT_TRUE(wifi_sta_iface_->enableLinkLayerStatsCollection(true).isOk()); + + // Retrieve link layer stats. + StaLinkLayerStats link_layer_stats = {}; + EXPECT_TRUE(wifi_sta_iface_->getLinkLayerStats(&link_layer_stats).isOk()); + EXPECT_GT(link_layer_stats.timeStampInMs, 0); + + // Try to create a 2nd iface. If successful, it should fill the duty cycle field. + std::shared_ptr iface; + auto status = createStaIface(&iface); + if (status.isOk()) { + EXPECT_GT(link_layer_stats.iface.timeSliceDutyCycleInPercent, 0); + } + + // Disable link layer stats collection. + EXPECT_TRUE(wifi_sta_iface_->disableLinkLayerStatsCollection().isOk()); +} + +/* + * SetMacAddress + * Ensures that calls to setMacAddress will return successfully. + */ +TEST_P(WifiStaIfaceAidlTest, SetMacAddress) { + std::array mac = {0x12, 0x22, 0x33, 0x52, 0x10, 0x41}; + EXPECT_TRUE(wifi_sta_iface_->setMacAddress(mac).isOk()); +} + +/* + * SetScanMode + */ +TEST_P(WifiStaIfaceAidlTest, SetScanMode) { + auto status = wifi_sta_iface_->setScanMode(true); + EXPECT_TRUE(status.isOk() || checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + + status = wifi_sta_iface_->setScanMode(false); + EXPECT_TRUE(status.isOk() || checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); +} + +/* + * LinkLayerStatsCollection + */ +TEST_P(WifiStaIfaceAidlTest, LinkLayerStatsCollection) { + if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::LINK_LAYER_STATS)) { + GTEST_SKIP() << "Link layer stats collection is not supported."; + } + + // Enable link layer stats collection. + EXPECT_TRUE(wifi_sta_iface_->enableLinkLayerStatsCollection(true).isOk()); + + // Retrieve link layer stats. + StaLinkLayerStats link_layer_stats = {}; + EXPECT_TRUE(wifi_sta_iface_->getLinkLayerStats(&link_layer_stats).isOk()); + + // Disable link layer stats collection. + EXPECT_TRUE(wifi_sta_iface_->disableLinkLayerStatsCollection().isOk()); +} + +/* + * RSSIMonitoring + * Ensures that calls to startRssiMonitoring and stopRssiMonitoring will fail + * if the device is not connected to an AP. + */ +TEST_P(WifiStaIfaceAidlTest, RSSIMonitoring) { + if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::RSSI_MONITOR)) { + GTEST_SKIP() << "RSSI monitoring is not supported."; + } + + const int cmd = 1; + const int maxRssi = -50; + const int minRssi = -90; + // Expected to fail because device is not connected to an AP. + EXPECT_FALSE(wifi_sta_iface_->startRssiMonitoring(cmd, maxRssi, minRssi).isOk()); + EXPECT_FALSE(wifi_sta_iface_->stopRssiMonitoring(cmd).isOk()); +} + +/* + * RoamingControl + */ +TEST_P(WifiStaIfaceAidlTest, RoamingControl) { + if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::CONTROL_ROAMING)) { + GTEST_SKIP() << "Roaming control is not supported."; + } + + // Retrieve roaming capabilities. + StaRoamingCapabilities caps = {}; + EXPECT_TRUE(wifi_sta_iface_->getRoamingCapabilities(&caps).isOk()); + + // Set up roaming configuration based on roaming capabilities. + StaRoamingConfig roaming_config = {}; + if (caps.maxBlocklistSize > 0) { + MacAddress block_list_entry; + block_list_entry.data = std::array{{0x11, 0x22, 0x33, 0x44, 0x55, 0x66}}; + roaming_config.bssidBlocklist = {block_list_entry}; + } + if (caps.maxAllowlistSize > 0) { + Ssid allow_list_entry = {}; + allow_list_entry.data = std::array{{0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC}}; + roaming_config.ssidAllowlist = {allow_list_entry}; + } + + // Configure roaming. + EXPECT_TRUE(wifi_sta_iface_->configureRoaming(roaming_config).isOk()); + + // Enable roaming. + EXPECT_TRUE(wifi_sta_iface_->setRoamingState(StaRoamingState::ENABLED).isOk()); +} + +/* + * EnableNDOffload + */ +TEST_P(WifiStaIfaceAidlTest, EnableNDOffload) { + if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::ND_OFFLOAD)) { + GTEST_SKIP() << "ND offload is not supported."; + } + EXPECT_TRUE(wifi_sta_iface_->enableNdOffload(true).isOk()); +} + +/* + * PacketFateMonitoring + */ +TEST_P(WifiStaIfaceAidlTest, PacketFateMonitoring) { + if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::DEBUG_PACKET_FATE)) { + GTEST_SKIP() << "Packet fate monitoring is not supported."; + } + + // Start packet fate monitoring. + EXPECT_TRUE(wifi_sta_iface_->startDebugPacketFateMonitoring().isOk()); + + // Retrieve packets. + std::vector rx_reports; + std::vector tx_reports; + EXPECT_TRUE(wifi_sta_iface_->getDebugRxPacketFates(&rx_reports).isOk()); + EXPECT_TRUE(wifi_sta_iface_->getDebugTxPacketFates(&tx_reports).isOk()); +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiStaIfaceAidlTest); +INSTANTIATE_TEST_SUITE_P(WifiTest, WifiStaIfaceAidlTest, + testing::ValuesIn(android::getAidlHalInstanceNames(IWifi::descriptor)), + android::PrintInstanceNameToString); + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + android::ProcessState::self()->setThreadPoolMaxThreadCount(1); + android::ProcessState::self()->startThreadPool(); + return RUN_ALL_TESTS(); +} From f0bd8c223f6f57f5388e7bc328af3b55e169b7e6 Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Mon, 10 Oct 2022 10:55:01 -0700 Subject: [PATCH 442/998] wifi: Add TID to link mapping support TID-to-link mapping, which is introduced in IEEE 802.11be standard allows an Access Point and a Station to determine how uplink and downlink QoS traffic corresponding to TID values between 0 and 7 will be assigned to the setup multi links. This commit adds an interface to TID-to-link mapping in existing MloLink AIDL. BUG: 247119055 Test: mm -j Change-Id: I3ef6e37d9857606020a8e0580c82ca8ab1b8bf82 --- .../hardware/wifi/supplicant/MloLink.aidl | 2 ++ .../hardware/wifi/supplicant/MloLink.aidl | 28 +++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLink.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLink.aidl index 5e2c47bdb5..f30ca94615 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLink.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLink.aidl @@ -36,4 +36,6 @@ package android.hardware.wifi.supplicant; parcelable MloLink { byte linkId; byte[] staLinkMacAddress; + byte tidsUplinkMap; + byte tidsDownlinkMap; } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLink.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLink.aidl index 0e23728168..7608e0a5b3 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLink.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLink.aidl @@ -30,4 +30,32 @@ parcelable MloLink { * STA Link MAC Address */ byte[/* 6 */] staLinkMacAddress; + /** + * Bitset where each bit indicates TID mapped to this link in uplink and + * downlink direction. + * + * Traffic Identifier (TID) is an identifier used to classify a packet. It + * is represented as a four bit number identifying the QoS traffic within + * MAC data service. There are 16 possible values for TID, out of only 8 are + * practically used to identify differentiated services. + * + * A TID-to-link mapping indicates links on which frames belonging to each + * TID can be exchanged. IEEE 802.11be draft 2.0 defines the mapping for TID + * values between 0 to 7 only. Once associated, an MLO link state is + * considered as active if at least one TID is mapped to the link. Link + * state is considered as idle if no TID is mapped to the link. + * + * TIDs can be mapped to uplink, downlink or both directions. + * e.g. + * - TID 4 is mapped to this link in uplink direction, if bit 4 in + * MloLink#tids_uplink_map is set. + * - TID 2 is mapped to both directions for this link, if bit 2 of both + * MloLink#tids_uplink_map and MloLink#tids_downlink_map are set. + * + * In case of default link mapping, tids_uplink_map and tids_downlink_map + * is set to 0xFF for all the links. + * + */ + byte tidsUplinkMap; + byte tidsDownlinkMap; } From 9cb9424e1ff2fcc80f19ac030a9bfdb9705c4289 Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Tue, 15 Nov 2022 10:19:42 -0800 Subject: [PATCH 443/998] wifi: Notify MLO Link status updates Add a callback to notify MLO link status changes due to - Multi-Link Reconfiguration (AP Removal) - TID to link mapping updates Bug: 247119055 Bug: 248289182 Test: mm -j Change-Id: I1010cfb3ef608466a46d54e1ef2ae4e665504210 --- .../ISupplicantStaIfaceCallback.aidl | 6 +++ .../ISupplicantStaIfaceCallback.aidl | 38 +++++++++++++++++++ .../supplicant_sta_iface_aidl_test.cpp | 5 +++ 3 files changed, 49 insertions(+) diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl index c7dd5841bd..efd51b5bab 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl @@ -64,4 +64,10 @@ interface ISupplicantStaIfaceCallback { oneway void onQosPolicyReset(); oneway void onQosPolicyRequest(in int qosPolicyRequestId, in android.hardware.wifi.supplicant.QosPolicyData[] qosPolicyData); oneway void onStateChangedWithAkm(in android.hardware.wifi.supplicant.StaIfaceCallbackState newState, in byte[] bssid, in int id, in byte[] ssid, in boolean filsHlpSent, in android.hardware.wifi.supplicant.KeyMgmtMask keyMgmtMask); + oneway void onMloLinksInfoChanged(in android.hardware.wifi.supplicant.ISupplicantStaIfaceCallback.MloLinkInfoChangeReason reason); + @Backing(type="int") @VintfStability + enum MloLinkInfoChangeReason { + TID_TO_LINK_MAP = 0, + MULTI_LINK_RECONFIG_AP_REMOVAL = 1, + } } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl index c7961fa24b..4bd095e7e6 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl @@ -329,4 +329,42 @@ oneway interface ISupplicantStaIfaceCallback { */ void onStateChangedWithAkm(in StaIfaceCallbackState newState, in byte[] bssid, in int id, in byte[] ssid, in boolean filsHlpSent, in KeyMgmtMask keyMgmtMask); + + /** + * Reason codes to be used with the callback |ISupplicantStaIfaceCallback.onMloLinksInfoChanged| + */ + @VintfStability + @Backing(type="int") + enum MloLinkInfoChangeReason { + /** + * TID-to-link mapping has changed. Updated mappings will be set in + * |MloLinksInfo.MloLink[].tids_downlink_map| and + * |MloLinksInfo.MloLink[].tids_uplink_map| for each of the links. + * + * STA MLD will operate in default mode if a TID-to-link mapping is not + * indicated by the callback. In default mode, all TIDs are mapped to + * all setup links in downlink and uplink directions. + */ + TID_TO_LINK_MAP = 0, + /** + * Multi-link reconfiguration - AP removal as described in + * IEEE 802.11be spec, section 35.3.6. This is a mandatory feature for + * station. + * + * Removed link will not be present in |ISupplicantStaIface.getConnectionMloLinksInfo|. + */ + MULTI_LINK_RECONFIG_AP_REMOVAL = 1, + } + + /** + * Used to indicate that Multi Link status has changed due to the provided + * reason. Upadted MLO link status can be fetched using + * |ISupplicantStaIface.getConnectionMloLinksInfo| + * + * |MloLink.linkId| and |MloLink.staLinkMacAddress| are not expected + * to change. + * + * @param reason Reason as given in MloLinkInfoChangeReason. + */ + void onMloLinksInfoChanged(in MloLinkInfoChangeReason reason); } diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp index d57f539a20..e42608ee1a 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp +++ b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp @@ -213,6 +213,11 @@ class SupplicantStaIfaceCallback : public BnSupplicantStaIfaceCallback { ::aidl::android::hardware::wifi::supplicant::KeyMgmtMask /* keyMgmtMask*/) override { return ndk::ScopedAStatus::ok(); } + ::ndk::ScopedAStatus onMloLinksInfoChanged( + ::aidl::android::hardware::wifi::supplicant::ISupplicantStaIfaceCallback:: + MloLinkInfoChangeReason /* reason */) override { + return ndk::ScopedAStatus::ok(); + } }; class SupplicantStaIfaceAidlTest : public testing::TestWithParam { From 611648f7a007b3b491e70123c1e2fdca54388a9e Mon Sep 17 00:00:00 2001 From: Michael Butler Date: Mon, 14 Nov 2022 19:00:25 -0800 Subject: [PATCH 444/998] Add additional bounds checks to NNAPI FMQ deserialize utility functions This CL adds the following additional bounds checks: * Adds additional checks of the index of the std::vector before accessing the element at the index * Changes the array index operator [] to the checked std::vector::at method Bug: 256589724 Test: mma Merged-In: I6bfb02a5cd76258284cc4d797a4508b21e672c4b Change-Id: I6bfb02a5cd76258284cc4d797a4508b21e672c4b --- neuralnetworks/1.2/utils/src/BurstUtils.cpp | 56 ++++++++++++--------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/neuralnetworks/1.2/utils/src/BurstUtils.cpp b/neuralnetworks/1.2/utils/src/BurstUtils.cpp index b589c468ce..c4c096da2d 100644 --- a/neuralnetworks/1.2/utils/src/BurstUtils.cpp +++ b/neuralnetworks/1.2/utils/src/BurstUtils.cpp @@ -190,12 +190,13 @@ nn::Result, V1_2::MeasureTiming>> size_t index = 0; // validate packet information - if (data.size() == 0 || data[index].getDiscriminator() != discriminator::packetInformation) { + if (index >= data.size() || + data.at(index).getDiscriminator() != discriminator::packetInformation) { return NN_ERROR() << "FMQ Request packet ill-formed"; } // unpackage packet information - const FmqRequestDatum::PacketInformation& packetInfo = data[index].packetInformation(); + const FmqRequestDatum::PacketInformation& packetInfo = data.at(index).packetInformation(); index++; const uint32_t packetSize = packetInfo.packetSize; const uint32_t numberOfInputOperands = packetInfo.numberOfInputOperands; @@ -212,13 +213,14 @@ nn::Result, V1_2::MeasureTiming>> inputs.reserve(numberOfInputOperands); for (size_t operand = 0; operand < numberOfInputOperands; ++operand) { // validate input operand information - if (data[index].getDiscriminator() != discriminator::inputOperandInformation) { + if (index >= data.size() || + data.at(index).getDiscriminator() != discriminator::inputOperandInformation) { return NN_ERROR() << "FMQ Request packet ill-formed"; } // unpackage operand information const FmqRequestDatum::OperandInformation& operandInfo = - data[index].inputOperandInformation(); + data.at(index).inputOperandInformation(); index++; const bool hasNoValue = operandInfo.hasNoValue; const V1_0::DataLocation location = operandInfo.location; @@ -229,12 +231,13 @@ nn::Result, V1_2::MeasureTiming>> dimensions.reserve(numberOfDimensions); for (size_t i = 0; i < numberOfDimensions; ++i) { // validate dimension - if (data[index].getDiscriminator() != discriminator::inputOperandDimensionValue) { + if (index >= data.size() || + data.at(index).getDiscriminator() != discriminator::inputOperandDimensionValue) { return NN_ERROR() << "FMQ Request packet ill-formed"; } // unpackage dimension - const uint32_t dimension = data[index].inputOperandDimensionValue(); + const uint32_t dimension = data.at(index).inputOperandDimensionValue(); index++; // store result @@ -251,13 +254,14 @@ nn::Result, V1_2::MeasureTiming>> outputs.reserve(numberOfOutputOperands); for (size_t operand = 0; operand < numberOfOutputOperands; ++operand) { // validate output operand information - if (data[index].getDiscriminator() != discriminator::outputOperandInformation) { + if (index >= data.size() || + data.at(index).getDiscriminator() != discriminator::outputOperandInformation) { return NN_ERROR() << "FMQ Request packet ill-formed"; } // unpackage operand information const FmqRequestDatum::OperandInformation& operandInfo = - data[index].outputOperandInformation(); + data.at(index).outputOperandInformation(); index++; const bool hasNoValue = operandInfo.hasNoValue; const V1_0::DataLocation location = operandInfo.location; @@ -268,12 +272,13 @@ nn::Result, V1_2::MeasureTiming>> dimensions.reserve(numberOfDimensions); for (size_t i = 0; i < numberOfDimensions; ++i) { // validate dimension - if (data[index].getDiscriminator() != discriminator::outputOperandDimensionValue) { + if (index >= data.size() || + data.at(index).getDiscriminator() != discriminator::outputOperandDimensionValue) { return NN_ERROR() << "FMQ Request packet ill-formed"; } // unpackage dimension - const uint32_t dimension = data[index].outputOperandDimensionValue(); + const uint32_t dimension = data.at(index).outputOperandDimensionValue(); index++; // store result @@ -290,12 +295,13 @@ nn::Result, V1_2::MeasureTiming>> slots.reserve(numberOfPools); for (size_t pool = 0; pool < numberOfPools; ++pool) { // validate input operand information - if (data[index].getDiscriminator() != discriminator::poolIdentifier) { + if (index >= data.size() || + data.at(index).getDiscriminator() != discriminator::poolIdentifier) { return NN_ERROR() << "FMQ Request packet ill-formed"; } // unpackage operand information - const int32_t poolId = data[index].poolIdentifier(); + const int32_t poolId = data.at(index).poolIdentifier(); index++; // store result @@ -303,17 +309,17 @@ nn::Result, V1_2::MeasureTiming>> } // validate measureTiming - if (data[index].getDiscriminator() != discriminator::measureTiming) { + if (index >= data.size() || data.at(index).getDiscriminator() != discriminator::measureTiming) { return NN_ERROR() << "FMQ Request packet ill-formed"; } // unpackage measureTiming - const V1_2::MeasureTiming measure = data[index].measureTiming(); + const V1_2::MeasureTiming measure = data.at(index).measureTiming(); index++; // validate packet information if (index != packetSize) { - return NN_ERROR() << "FMQ Result packet ill-formed"; + return NN_ERROR() << "FMQ Request packet ill-formed"; } // return request @@ -328,12 +334,13 @@ nn::Result, V1_2::T size_t index = 0; // validate packet information - if (data.size() == 0 || data[index].getDiscriminator() != discriminator::packetInformation) { + if (index >= data.size() || + data.at(index).getDiscriminator() != discriminator::packetInformation) { return NN_ERROR() << "FMQ Result packet ill-formed"; } // unpackage packet information - const FmqResultDatum::PacketInformation& packetInfo = data[index].packetInformation(); + const FmqResultDatum::PacketInformation& packetInfo = data.at(index).packetInformation(); index++; const uint32_t packetSize = packetInfo.packetSize; const V1_0::ErrorStatus errorStatus = packetInfo.errorStatus; @@ -349,12 +356,13 @@ nn::Result, V1_2::T outputShapes.reserve(numberOfOperands); for (size_t operand = 0; operand < numberOfOperands; ++operand) { // validate operand information - if (data[index].getDiscriminator() != discriminator::operandInformation) { + if (index >= data.size() || + data.at(index).getDiscriminator() != discriminator::operandInformation) { return NN_ERROR() << "FMQ Result packet ill-formed"; } // unpackage operand information - const FmqResultDatum::OperandInformation& operandInfo = data[index].operandInformation(); + const FmqResultDatum::OperandInformation& operandInfo = data.at(index).operandInformation(); index++; const bool isSufficient = operandInfo.isSufficient; const uint32_t numberOfDimensions = operandInfo.numberOfDimensions; @@ -364,12 +372,13 @@ nn::Result, V1_2::T dimensions.reserve(numberOfDimensions); for (size_t i = 0; i < numberOfDimensions; ++i) { // validate dimension - if (data[index].getDiscriminator() != discriminator::operandDimensionValue) { + if (index >= data.size() || + data.at(index).getDiscriminator() != discriminator::operandDimensionValue) { return NN_ERROR() << "FMQ Result packet ill-formed"; } // unpackage dimension - const uint32_t dimension = data[index].operandDimensionValue(); + const uint32_t dimension = data.at(index).operandDimensionValue(); index++; // store result @@ -381,12 +390,13 @@ nn::Result, V1_2::T } // validate execution timing - if (data[index].getDiscriminator() != discriminator::executionTiming) { + if (index >= data.size() || + data.at(index).getDiscriminator() != discriminator::executionTiming) { return NN_ERROR() << "FMQ Result packet ill-formed"; } // unpackage execution timing - const V1_2::Timing timing = data[index].executionTiming(); + const V1_2::Timing timing = data.at(index).executionTiming(); index++; // validate packet information From 06493bc122dd6b5f9106e0c526288e7962c7ad5b Mon Sep 17 00:00:00 2001 From: Michael Butler Date: Mon, 14 Nov 2022 19:00:25 -0800 Subject: [PATCH 445/998] Add additional bounds checks to NNAPI FMQ deserialize utility functions This CL adds the following additional bounds checks: * Adds additional checks of the index of the std::vector before accessing the element at the index * Changes the array index operator [] to the checked std::vector::at method Bug: 256589724 Test: mma Merged-In: I6bfb02a5cd76258284cc4d797a4508b21e672c4b Change-Id: I6bfb02a5cd76258284cc4d797a4508b21e672c4b --- neuralnetworks/1.2/utils/src/BurstUtils.cpp | 56 ++++++++++++--------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/neuralnetworks/1.2/utils/src/BurstUtils.cpp b/neuralnetworks/1.2/utils/src/BurstUtils.cpp index b589c468ce..c4c096da2d 100644 --- a/neuralnetworks/1.2/utils/src/BurstUtils.cpp +++ b/neuralnetworks/1.2/utils/src/BurstUtils.cpp @@ -190,12 +190,13 @@ nn::Result, V1_2::MeasureTiming>> size_t index = 0; // validate packet information - if (data.size() == 0 || data[index].getDiscriminator() != discriminator::packetInformation) { + if (index >= data.size() || + data.at(index).getDiscriminator() != discriminator::packetInformation) { return NN_ERROR() << "FMQ Request packet ill-formed"; } // unpackage packet information - const FmqRequestDatum::PacketInformation& packetInfo = data[index].packetInformation(); + const FmqRequestDatum::PacketInformation& packetInfo = data.at(index).packetInformation(); index++; const uint32_t packetSize = packetInfo.packetSize; const uint32_t numberOfInputOperands = packetInfo.numberOfInputOperands; @@ -212,13 +213,14 @@ nn::Result, V1_2::MeasureTiming>> inputs.reserve(numberOfInputOperands); for (size_t operand = 0; operand < numberOfInputOperands; ++operand) { // validate input operand information - if (data[index].getDiscriminator() != discriminator::inputOperandInformation) { + if (index >= data.size() || + data.at(index).getDiscriminator() != discriminator::inputOperandInformation) { return NN_ERROR() << "FMQ Request packet ill-formed"; } // unpackage operand information const FmqRequestDatum::OperandInformation& operandInfo = - data[index].inputOperandInformation(); + data.at(index).inputOperandInformation(); index++; const bool hasNoValue = operandInfo.hasNoValue; const V1_0::DataLocation location = operandInfo.location; @@ -229,12 +231,13 @@ nn::Result, V1_2::MeasureTiming>> dimensions.reserve(numberOfDimensions); for (size_t i = 0; i < numberOfDimensions; ++i) { // validate dimension - if (data[index].getDiscriminator() != discriminator::inputOperandDimensionValue) { + if (index >= data.size() || + data.at(index).getDiscriminator() != discriminator::inputOperandDimensionValue) { return NN_ERROR() << "FMQ Request packet ill-formed"; } // unpackage dimension - const uint32_t dimension = data[index].inputOperandDimensionValue(); + const uint32_t dimension = data.at(index).inputOperandDimensionValue(); index++; // store result @@ -251,13 +254,14 @@ nn::Result, V1_2::MeasureTiming>> outputs.reserve(numberOfOutputOperands); for (size_t operand = 0; operand < numberOfOutputOperands; ++operand) { // validate output operand information - if (data[index].getDiscriminator() != discriminator::outputOperandInformation) { + if (index >= data.size() || + data.at(index).getDiscriminator() != discriminator::outputOperandInformation) { return NN_ERROR() << "FMQ Request packet ill-formed"; } // unpackage operand information const FmqRequestDatum::OperandInformation& operandInfo = - data[index].outputOperandInformation(); + data.at(index).outputOperandInformation(); index++; const bool hasNoValue = operandInfo.hasNoValue; const V1_0::DataLocation location = operandInfo.location; @@ -268,12 +272,13 @@ nn::Result, V1_2::MeasureTiming>> dimensions.reserve(numberOfDimensions); for (size_t i = 0; i < numberOfDimensions; ++i) { // validate dimension - if (data[index].getDiscriminator() != discriminator::outputOperandDimensionValue) { + if (index >= data.size() || + data.at(index).getDiscriminator() != discriminator::outputOperandDimensionValue) { return NN_ERROR() << "FMQ Request packet ill-formed"; } // unpackage dimension - const uint32_t dimension = data[index].outputOperandDimensionValue(); + const uint32_t dimension = data.at(index).outputOperandDimensionValue(); index++; // store result @@ -290,12 +295,13 @@ nn::Result, V1_2::MeasureTiming>> slots.reserve(numberOfPools); for (size_t pool = 0; pool < numberOfPools; ++pool) { // validate input operand information - if (data[index].getDiscriminator() != discriminator::poolIdentifier) { + if (index >= data.size() || + data.at(index).getDiscriminator() != discriminator::poolIdentifier) { return NN_ERROR() << "FMQ Request packet ill-formed"; } // unpackage operand information - const int32_t poolId = data[index].poolIdentifier(); + const int32_t poolId = data.at(index).poolIdentifier(); index++; // store result @@ -303,17 +309,17 @@ nn::Result, V1_2::MeasureTiming>> } // validate measureTiming - if (data[index].getDiscriminator() != discriminator::measureTiming) { + if (index >= data.size() || data.at(index).getDiscriminator() != discriminator::measureTiming) { return NN_ERROR() << "FMQ Request packet ill-formed"; } // unpackage measureTiming - const V1_2::MeasureTiming measure = data[index].measureTiming(); + const V1_2::MeasureTiming measure = data.at(index).measureTiming(); index++; // validate packet information if (index != packetSize) { - return NN_ERROR() << "FMQ Result packet ill-formed"; + return NN_ERROR() << "FMQ Request packet ill-formed"; } // return request @@ -328,12 +334,13 @@ nn::Result, V1_2::T size_t index = 0; // validate packet information - if (data.size() == 0 || data[index].getDiscriminator() != discriminator::packetInformation) { + if (index >= data.size() || + data.at(index).getDiscriminator() != discriminator::packetInformation) { return NN_ERROR() << "FMQ Result packet ill-formed"; } // unpackage packet information - const FmqResultDatum::PacketInformation& packetInfo = data[index].packetInformation(); + const FmqResultDatum::PacketInformation& packetInfo = data.at(index).packetInformation(); index++; const uint32_t packetSize = packetInfo.packetSize; const V1_0::ErrorStatus errorStatus = packetInfo.errorStatus; @@ -349,12 +356,13 @@ nn::Result, V1_2::T outputShapes.reserve(numberOfOperands); for (size_t operand = 0; operand < numberOfOperands; ++operand) { // validate operand information - if (data[index].getDiscriminator() != discriminator::operandInformation) { + if (index >= data.size() || + data.at(index).getDiscriminator() != discriminator::operandInformation) { return NN_ERROR() << "FMQ Result packet ill-formed"; } // unpackage operand information - const FmqResultDatum::OperandInformation& operandInfo = data[index].operandInformation(); + const FmqResultDatum::OperandInformation& operandInfo = data.at(index).operandInformation(); index++; const bool isSufficient = operandInfo.isSufficient; const uint32_t numberOfDimensions = operandInfo.numberOfDimensions; @@ -364,12 +372,13 @@ nn::Result, V1_2::T dimensions.reserve(numberOfDimensions); for (size_t i = 0; i < numberOfDimensions; ++i) { // validate dimension - if (data[index].getDiscriminator() != discriminator::operandDimensionValue) { + if (index >= data.size() || + data.at(index).getDiscriminator() != discriminator::operandDimensionValue) { return NN_ERROR() << "FMQ Result packet ill-formed"; } // unpackage dimension - const uint32_t dimension = data[index].operandDimensionValue(); + const uint32_t dimension = data.at(index).operandDimensionValue(); index++; // store result @@ -381,12 +390,13 @@ nn::Result, V1_2::T } // validate execution timing - if (data[index].getDiscriminator() != discriminator::executionTiming) { + if (index >= data.size() || + data.at(index).getDiscriminator() != discriminator::executionTiming) { return NN_ERROR() << "FMQ Result packet ill-formed"; } // unpackage execution timing - const V1_2::Timing timing = data[index].executionTiming(); + const V1_2::Timing timing = data.at(index).executionTiming(); index++; // validate packet information From 9b77fd1272b954aa7a63ba9cceea2704045f05ce Mon Sep 17 00:00:00 2001 From: Greg Kaiser Date: Mon, 5 Dec 2022 17:06:02 -0800 Subject: [PATCH 446/998] Fix NULL check We were checking 'info' twice and not checking 'msgs'. So we fix that up, and fix a typo in the message. Bug: 219974678 Test: TreeHugger Change-Id: Ia52178b758dc3d9753731b043da01743ff59e10c --- camera/device/default/ExternalCameraDeviceSession.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/camera/device/default/ExternalCameraDeviceSession.cpp b/camera/device/default/ExternalCameraDeviceSession.cpp index 68c6d2eed3..736bc3cbcd 100644 --- a/camera/device/default/ExternalCameraDeviceSession.cpp +++ b/camera/device/default/ExternalCameraDeviceSession.cpp @@ -714,8 +714,8 @@ Status ExternalCameraDeviceSession::switchToOffline( return Status::ILLEGAL_ARGUMENT; } - if (info == nullptr || results == nullptr || info == nullptr || session == nullptr) { - ALOGE("%s, output arguments (%p, %p, %p, %p) much not be null", __FUNCTION__, msgs, results, + if (msgs == nullptr || results == nullptr || info == nullptr || session == nullptr) { + ALOGE("%s, output arguments (%p, %p, %p, %p) must not be null", __FUNCTION__, msgs, results, info, session); } From 5c3a2b710ef80c109e9ff95b48ff112a68dd2ee4 Mon Sep 17 00:00:00 2001 From: ChengYou Ho Date: Wed, 30 Nov 2022 17:51:17 +0000 Subject: [PATCH 447/998] Add WeaverReadStatus to WeaverReadResponse Bug: 259556049 Change-Id: I83897038eda59ed8cae1bdb0ae68828201615ebc --- weaver/aidl/Android.bp | 7 +++- .../hardware/weaver/WeaverReadResponse.aidl | 3 +- .../hardware/weaver/WeaverReadStatus.aidl | 41 +++++++++++++++++++ .../hardware/weaver/WeaverReadResponse.aidl | 11 ++++- .../hardware/weaver/WeaverReadStatus.aidl | 26 ++++++++++++ weaver/aidl/vts/Android.bp | 2 +- weaver/aidl/vts/VtsHalWeaverTargetTest.cpp | 28 +++++++++---- 7 files changed, 104 insertions(+), 14 deletions(-) create mode 100644 weaver/aidl/aidl_api/android.hardware.weaver/current/android/hardware/weaver/WeaverReadStatus.aidl create mode 100644 weaver/aidl/android/hardware/weaver/WeaverReadStatus.aidl diff --git a/weaver/aidl/Android.bp b/weaver/aidl/Android.bp index caa92aa9b4..74cec99f7d 100644 --- a/weaver/aidl/Android.bp +++ b/weaver/aidl/Android.bp @@ -17,5 +17,10 @@ aidl_interface { platform_apis: true, }, }, - versions: ["1"], + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], } diff --git a/weaver/aidl/aidl_api/android.hardware.weaver/current/android/hardware/weaver/WeaverReadResponse.aidl b/weaver/aidl/aidl_api/android.hardware.weaver/current/android/hardware/weaver/WeaverReadResponse.aidl index 47ee4c8a13..96e528fa30 100644 --- a/weaver/aidl/aidl_api/android.hardware.weaver/current/android/hardware/weaver/WeaverReadResponse.aidl +++ b/weaver/aidl/aidl_api/android.hardware.weaver/current/android/hardware/weaver/WeaverReadResponse.aidl @@ -1,5 +1,5 @@ /* - * Copyright 2020 The Android Open Source Project + * Copyright 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. @@ -36,4 +36,5 @@ package android.hardware.weaver; parcelable WeaverReadResponse { long timeout; byte[] value; + android.hardware.weaver.WeaverReadStatus status = android.hardware.weaver.WeaverReadStatus.FAILED; } diff --git a/weaver/aidl/aidl_api/android.hardware.weaver/current/android/hardware/weaver/WeaverReadStatus.aidl b/weaver/aidl/aidl_api/android.hardware.weaver/current/android/hardware/weaver/WeaverReadStatus.aidl new file mode 100644 index 0000000000..fce9758f5c --- /dev/null +++ b/weaver/aidl/aidl_api/android.hardware.weaver/current/android/hardware/weaver/WeaverReadStatus.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.weaver; +@Backing(type="int") @VintfStability +enum WeaverReadStatus { + OK = 0, + FAILED = 1, + INCORRECT_KEY = 2, + THROTTLE = 3, +} diff --git a/weaver/aidl/android/hardware/weaver/WeaverReadResponse.aidl b/weaver/aidl/android/hardware/weaver/WeaverReadResponse.aidl index ec006e8c45..17ea718089 100644 --- a/weaver/aidl/android/hardware/weaver/WeaverReadResponse.aidl +++ b/weaver/aidl/android/hardware/weaver/WeaverReadResponse.aidl @@ -1,5 +1,5 @@ /* - * Copyright 2020 The Android Open Source Project + * Copyright 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. @@ -16,15 +16,22 @@ package android.hardware.weaver; +import android.hardware.weaver.WeaverReadStatus; + @VintfStability parcelable WeaverReadResponse { /** - * The time to wait, in milliseconds, before making the next request. + * The time to wait, in milliseconds, before making the next request, + * must be greater than or equal to zero and less than INT_MAX. */ long timeout; /** * The value read from the slot or empty if the value was not read. */ byte[] value; + /** + * Status from WeaverReadStatus + */ + WeaverReadStatus status = WeaverReadStatus.FAILED; } diff --git a/weaver/aidl/android/hardware/weaver/WeaverReadStatus.aidl b/weaver/aidl/android/hardware/weaver/WeaverReadStatus.aidl new file mode 100644 index 0000000000..36e731fabe --- /dev/null +++ b/weaver/aidl/android/hardware/weaver/WeaverReadStatus.aidl @@ -0,0 +1,26 @@ +/* + * 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. + */ + +package android.hardware.weaver; + +@VintfStability +@Backing(type="int") +enum WeaverReadStatus { + OK, + FAILED, + INCORRECT_KEY, + THROTTLE, +} diff --git a/weaver/aidl/vts/Android.bp b/weaver/aidl/vts/Android.bp index cf1661ce1e..557fe47aa7 100644 --- a/weaver/aidl/vts/Android.bp +++ b/weaver/aidl/vts/Android.bp @@ -34,7 +34,7 @@ cc_test { "libbinder_ndk", "libbase", ], - static_libs: ["android.hardware.weaver-V1-ndk"], + static_libs: ["android.hardware.weaver-V2-ndk"], test_suites: [ "general-tests", "vts", diff --git a/weaver/aidl/vts/VtsHalWeaverTargetTest.cpp b/weaver/aidl/vts/VtsHalWeaverTargetTest.cpp index 878c76203f..f016515a6a 100644 --- a/weaver/aidl/vts/VtsHalWeaverTargetTest.cpp +++ b/weaver/aidl/vts/VtsHalWeaverTargetTest.cpp @@ -25,6 +25,7 @@ using ::aidl::android::hardware::weaver::IWeaver; using ::aidl::android::hardware::weaver::WeaverConfig; using ::aidl::android::hardware::weaver::WeaverReadResponse; +using ::aidl::android::hardware::weaver::WeaverReadStatus; using ::ndk::SpAIBinder; @@ -102,14 +103,17 @@ TEST_P(WeaverAidlTest, WriteFollowedByReadGivesTheSameValue) { WeaverReadResponse response; std::vector readValue; uint32_t timeout; + WeaverReadStatus status; const auto readRet = weaver->read(slotId, KEY, &response); readValue = response.value; timeout = response.timeout; + status = response.status; ASSERT_TRUE(readRet.isOk()); EXPECT_EQ(readValue, VALUE); EXPECT_EQ(timeout, 0u); + EXPECT_EQ(status, WeaverReadStatus::OK); } /* @@ -128,14 +132,17 @@ TEST_P(WeaverAidlTest, OverwritingSlotUpdatesTheValue) { WeaverReadResponse response; std::vector readValue; uint32_t timeout; + WeaverReadStatus status; const auto readRet = weaver->read(slotId, KEY, &response); readValue = response.value; timeout = response.timeout; + status = response.status; ASSERT_TRUE(readRet.isOk()); EXPECT_EQ(readValue, OTHER_VALUE); EXPECT_EQ(timeout, 0u); + EXPECT_EQ(status, WeaverReadStatus::OK); } /* @@ -149,15 +156,16 @@ TEST_P(WeaverAidlTest, WriteFollowedByReadWithWrongKeyDoesNotGiveTheValue) { WeaverReadResponse response; std::vector readValue; + WeaverReadStatus status; const auto readRet = weaver->read(slotId, WRONG_KEY, &response); readValue = response.value; + status = response.status; - ASSERT_FALSE(readRet.isOk()); - ASSERT_EQ(EX_SERVICE_SPECIFIC, readRet.getExceptionCode()); - ASSERT_EQ(IWeaver::STATUS_INCORRECT_KEY, readRet.getServiceSpecificError()); + ASSERT_TRUE(readRet.isOk()); EXPECT_TRUE(readValue.empty()); + EXPECT_EQ(status, WeaverReadStatus::INCORRECT_KEY); } /* @@ -193,17 +201,18 @@ TEST_P(WeaverAidlTest, ReadingFromInvalidSlotFails) { WeaverReadResponse response; std::vector readValue; uint32_t timeout; + WeaverReadStatus status; const auto readRet = weaver->read(config.slots, KEY, &response); readValue = response.value; timeout = response.timeout; + status = response.status; - ASSERT_FALSE(readRet.isOk()); - ASSERT_EQ(EX_SERVICE_SPECIFIC, readRet.getExceptionCode()); - ASSERT_EQ(IWeaver::STATUS_FAILED, readRet.getServiceSpecificError()); + ASSERT_TRUE(readRet.isOk()); EXPECT_TRUE(readValue.empty()); EXPECT_EQ(timeout, 0u); + EXPECT_EQ(status, WeaverReadStatus::FAILED); } /* @@ -250,17 +259,18 @@ TEST_P(WeaverAidlTest, ReadWithTooLargeKeyFails) { WeaverReadResponse response; std::vector readValue; uint32_t timeout; + WeaverReadStatus status; const auto readRet = weaver->read(slotId, bigKey, &response); readValue = response.value; timeout = response.timeout; + status = response.status; - ASSERT_FALSE(readRet.isOk()); - ASSERT_EQ(EX_SERVICE_SPECIFIC, readRet.getExceptionCode()); - ASSERT_EQ(IWeaver::STATUS_FAILED, readRet.getServiceSpecificError()); + ASSERT_TRUE(readRet.isOk()); EXPECT_TRUE(readValue.empty()); EXPECT_EQ(timeout, 0u); + EXPECT_EQ(status, WeaverReadStatus::FAILED); } GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WeaverAidlTest); From 6ac8cd3ac2e3b3b65dbfa60d78d8bbec3372e3e0 Mon Sep 17 00:00:00 2001 From: Harry Cutts Date: Thu, 13 Oct 2022 13:40:55 +0000 Subject: [PATCH 448/998] Add GESTURE_{X,Y}_OFFSET axes to input HAL Bug: 246758376 Test: check that build succeeds Change-Id: I31e8b69756847d9e70a442cdfd89cd90ec79191f --- .../android/hardware/input/common/Axis.aidl | 2 ++ .../android/hardware/input/common/Axis.aidl | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Axis.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Axis.aidl index 2114c7deb1..7de95b1939 100644 --- a/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Axis.aidl +++ b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Axis.aidl @@ -79,4 +79,6 @@ enum Axis { GENERIC_14 = 45, GENERIC_15 = 46, GENERIC_16 = 47, + GESTURE_X_OFFSET = 48, + GESTURE_Y_OFFSET = 49, } diff --git a/input/common/aidl/android/hardware/input/common/Axis.aidl b/input/common/aidl/android/hardware/input/common/Axis.aidl index 11509494fa..1257687b0c 100644 --- a/input/common/aidl/android/hardware/input/common/Axis.aidl +++ b/input/common/aidl/android/hardware/input/common/Axis.aidl @@ -384,4 +384,21 @@ enum Axis { * The interpretation of a generic axis is device-specific. */ GENERIC_16 = 47, + + /** + * Axis constant: X gesture offset axis of a motion event. + * + * - For a touch pad, reports the distance that a swipe gesture has moved in the X + * axis, as a proportion of the touch pad's size. For example, if a touch pad is + * 1000 units wide, and a swipe gesture starts at X = 500 then moves to X = 400, + * this axis would have a value of -0.1. + */ + GESTURE_X_OFFSET = 48, + + /** + * Axis constant: Y gesture offset axis of a motion event. + * + * The same as GESTURE_X_OFFSET, but for the Y axis. + */ + GESTURE_Y_OFFSET = 49, } From ef57d1f4735f86f2d9907c1195ccf201974a5761 Mon Sep 17 00:00:00 2001 From: shrikar Date: Mon, 5 Dec 2022 16:26:03 -0800 Subject: [PATCH 449/998] Change default units to be consistent in DefaultProperties.json Bug: 259879204 Test: atest CarPropertyManagerTest Change-Id: I752632f4965b523fc16e438dffc8636244a6e23d --- .../aidl/impl/default_config/config/DefaultProperties.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index bd80ad5442..95327a3a12 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -123,7 +123,7 @@ "property": "VehicleProperty::VEHICLE_SPEED_DISPLAY_UNITS", "defaultValue": { "int32Values": [ - "VehicleUnit::KILOMETERS_PER_HOUR" + "VehicleUnit::MILES_PER_HOUR" ] }, "configArray": [ @@ -1556,7 +1556,7 @@ "property": "VehicleProperty::FUEL_VOLUME_DISPLAY_UNITS", "defaultValue": { "int32Values": [ - "VehicleUnit::LITER" + "VehicleUnit::US_GALLON" ] }, "configArray": [ From c276eafd3ad2a04f68ac08641573d245c304503e Mon Sep 17 00:00:00 2001 From: Steven Liu Date: Mon, 28 Nov 2022 16:59:40 +0000 Subject: [PATCH 450/998] Notify the AT_PERMANENT_ID_REQ is denied from peer. Bug: 239710602 Test: atest VtsHalWifiSupplicantStaNetworkTargetTest Change-Id: Ib21d601cc980505d7cb60091ec1dd88a579d9738 --- .../wifi/supplicant/ISupplicantStaNetworkCallback.aidl | 1 + .../wifi/supplicant/ISupplicantStaNetworkCallback.aidl | 7 +++++++ .../vts/functional/supplicant_sta_network_aidl_test.cpp | 1 + 3 files changed, 9 insertions(+) diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaNetworkCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaNetworkCallback.aidl index 6276a3521b..f9a078be4d 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaNetworkCallback.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaNetworkCallback.aidl @@ -39,4 +39,5 @@ interface ISupplicantStaNetworkCallback { oneway void onNetworkEapSimUmtsAuthRequest(in android.hardware.wifi.supplicant.NetworkRequestEapSimUmtsAuthParams params); oneway void onTransitionDisable(in android.hardware.wifi.supplicant.TransitionDisableIndication ind); oneway void onServerCertificateAvailable(in int depth, in byte[] subject, in byte[] certHash, in byte[] certBlob); + oneway void onPermanentIdReqDenied(); } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetworkCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetworkCallback.aidl index de7b675036..4f892be36f 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetworkCallback.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaNetworkCallback.aidl @@ -71,4 +71,11 @@ oneway interface ISupplicantStaNetworkCallback { */ void onServerCertificateAvailable( in int depth, in byte[] subject, in byte[] certHash, in byte[] certBlob); + + /** + * Used to notify the AT_PERMANENT_ID_REQ denied event. + * + * In strict conservative mode, AT_PERMANENT_ID_REQ is denied from eap_peer side. + */ + void onPermanentIdReqDenied(); } diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp index 6ff64a5ecc..0aebe6d716 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp +++ b/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp @@ -100,6 +100,7 @@ class SupplicantStaNetworkCallback : public BnSupplicantStaNetworkCallback { const std::vector& /* certBlob */) override { return ndk::ScopedAStatus::ok(); } + ::ndk::ScopedAStatus onPermanentIdReqDenied() override { return ndk::ScopedAStatus::ok(); } }; class SupplicantStaNetworkAidlTest From 4f5dd1c9532fbaae18aa646b66d73061143f9310 Mon Sep 17 00:00:00 2001 From: Wonsik Kim Date: Tue, 6 Dec 2022 12:29:54 -0800 Subject: [PATCH 451/998] Mark media.bufferpool2 and media.c2 as double-loadable LL-NDK(libmediandk) has the dependency on "android.hardware.media.bufferpool2" and "android.hardware.media.c2". Dependencies: libmediandk -> libstagefright -> libsfplugin_ccodec -> android.hardware.media.c2-V1-ndk libmediandk -> libstagefright -> libsfplugin_ccodec -> libcodec2_client -> libstagefright_bufferpool@ -> android.hardware.media.bufferpool2-V1-ndk Bug: 251850069 Test: builds Change-Id: I89aa17b8f1db9393d506edd9f242112cd11a05ec --- media/bufferpool/aidl/Android.bp | 1 + media/c2/aidl/Android.bp | 1 + 2 files changed, 2 insertions(+) diff --git a/media/bufferpool/aidl/Android.bp b/media/bufferpool/aidl/Android.bp index 68ac4896be..5ea294839f 100644 --- a/media/bufferpool/aidl/Android.bp +++ b/media/bufferpool/aidl/Android.bp @@ -24,6 +24,7 @@ package { aidl_interface { name: "android.hardware.media.bufferpool2", vendor_available: true, + double_loadable: true, srcs: ["android/hardware/media/bufferpool2/*.aidl"], imports: [ "android.hardware.common-V2", diff --git a/media/c2/aidl/Android.bp b/media/c2/aidl/Android.bp index 10867c047e..5e056c4934 100644 --- a/media/c2/aidl/Android.bp +++ b/media/c2/aidl/Android.bp @@ -3,6 +3,7 @@ aidl_interface { name: "android.hardware.media.c2", vendor_available: true, + double_loadable: true, srcs: ["android/hardware/media/c2/*.aidl"], include_dirs: [ "frameworks/native/aidl/gui", From f521450b35a65386f5f4610a8d3f884faa6215d7 Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Tue, 23 Aug 2022 19:49:31 +0000 Subject: [PATCH 452/998] wifi: Send DPP connection status result This change is for Enrollee to send the DPP connection status result frame to configurator. The changes includes, 1. Modified the existing onDppSuccessConfigReceived callback function to indicate that configurator has requested for the connection status result frame. 2. New callback function to indicate that the connection status result frame is sent. 3. Defined connection status code. Bug: 235844564 Test: m android.hardware.wifi.supplicant-update-api Test: Manual - Ran DPP tests and confirmed that connection status frame is processed correctly Change-Id: I45866707971c874c9270e7316a7b86fe0953d95a --- .../wifi/supplicant/DppConfigurationData.aidl | 43 +++++++++++++++ .../wifi/supplicant/DppStatusErrorCode.aidl | 53 +++++++++++++++++++ .../ISupplicantStaIfaceCallback.aidl | 5 ++ .../wifi/supplicant/DppConfigurationData.aidl | 53 +++++++++++++++++++ .../wifi/supplicant/DppStatusErrorCode.aidl | 43 +++++++++++++++ .../ISupplicantStaIfaceCallback.aidl | 17 ++++++ .../supplicant_sta_iface_aidl_test.cpp | 9 ++++ 7 files changed, 223 insertions(+) create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppConfigurationData.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppStatusErrorCode.aidl create mode 100644 wifi/supplicant/aidl/android/hardware/wifi/supplicant/DppConfigurationData.aidl create mode 100644 wifi/supplicant/aidl/android/hardware/wifi/supplicant/DppStatusErrorCode.aidl diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppConfigurationData.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppConfigurationData.aidl new file mode 100644 index 0000000000..2225330538 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppConfigurationData.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable DppConfigurationData { + byte[] ssid; + String password; + byte[] psk; + android.hardware.wifi.supplicant.DppAkm securityAkm; + android.hardware.wifi.supplicant.DppConnectionKeys dppConnectionKeys; + boolean connStatusRequested; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppStatusErrorCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppStatusErrorCode.aidl new file mode 100644 index 0000000000..d72633b569 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/DppStatusErrorCode.aidl @@ -0,0 +1,53 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum DppStatusErrorCode { + UNKNOWN = -1, + SUCCESS = 0, + NOT_COMPATIBLE = 1, + AUTH_FAILURE = 2, + UNWRAP_FAILURE = 3, + BAD_GROUP = 4, + CONFIGURE_FAILURE = 5, + RESPONSE_PENDING = 6, + INVALID_CONNECTOR = 7, + NO_MATCH = 8, + CONFIG_REJECTED = 9, + NO_AP = 10, + CONFIGURE_PENDING = 11, + CSR_NEEDED = 12, + CSR_BAD = 13, + NEW_KEY_NEEDED = 14, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl index efd51b5bab..45563b3aa2 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl @@ -44,6 +44,9 @@ interface ISupplicantStaIfaceCallback { oneway void onDppFailure(in android.hardware.wifi.supplicant.DppFailureCode code, in String ssid, in String channelList, in char[] bandList); oneway void onDppProgress(in android.hardware.wifi.supplicant.DppProgressCode code); oneway void onDppSuccess(in android.hardware.wifi.supplicant.DppEventType event); + /** + * @deprecated This callback is deprecated from AIDL v2, newer HAL should call onDppConfigReceived. + */ oneway void onDppSuccessConfigReceived(in byte[] ssid, in String password, in byte[] psk, in android.hardware.wifi.supplicant.DppAkm securityAkm, in android.hardware.wifi.supplicant.DppConnectionKeys dppConnectionKeys); oneway void onDppSuccessConfigSent(); oneway void onEapFailure(in byte[] bssid, in int errorCode); @@ -65,6 +68,8 @@ interface ISupplicantStaIfaceCallback { oneway void onQosPolicyRequest(in int qosPolicyRequestId, in android.hardware.wifi.supplicant.QosPolicyData[] qosPolicyData); oneway void onStateChangedWithAkm(in android.hardware.wifi.supplicant.StaIfaceCallbackState newState, in byte[] bssid, in int id, in byte[] ssid, in boolean filsHlpSent, in android.hardware.wifi.supplicant.KeyMgmtMask keyMgmtMask); oneway void onMloLinksInfoChanged(in android.hardware.wifi.supplicant.ISupplicantStaIfaceCallback.MloLinkInfoChangeReason reason); + oneway void onDppConfigReceived(in android.hardware.wifi.supplicant.DppConfigurationData configData); + oneway void onDppConnectionStatusResultSent(in android.hardware.wifi.supplicant.DppStatusErrorCode code); @Backing(type="int") @VintfStability enum MloLinkInfoChangeReason { TID_TO_LINK_MAP = 0, diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/DppConfigurationData.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/DppConfigurationData.aidl new file mode 100644 index 0000000000..b25bc402c8 --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/DppConfigurationData.aidl @@ -0,0 +1,53 @@ +/* + * 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. + */ +package android.hardware.wifi.supplicant; + +import android.hardware.wifi.supplicant.DppAkm; +import android.hardware.wifi.supplicant.DppConnectionKeys; + +/** + * DPP configuration related information. + */ +@VintfStability +parcelable DppConfigurationData { + /* + * SSID of the network. + */ + byte[] ssid; + /* + * WPA2 or SAE passphrase. + */ + String password; + /* + * Pre-shared key encoded in hex. + */ + byte[] psk; + /* + * AKM that can be provisioned using DPP. + */ + DppAkm securityAkm; + /* + * Connection keys that are used for DPP network connection. + */ + DppConnectionKeys dppConnectionKeys; + /* + * Optional flag to indicate that the configurator requested connection status + * result. + * This flag is set to true if the enrollee receives the configuration response + * frame with sendConnStatus attribute. + */ + boolean connStatusRequested; +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/DppStatusErrorCode.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/DppStatusErrorCode.aidl new file mode 100644 index 0000000000..30965d6978 --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/DppStatusErrorCode.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ + +package android.hardware.wifi.supplicant; + +/** + * DppStatusErrorCode: The possible values for the DPP status and error codes + * in the DPP protocol. + * See Easy Connect specification V2.0 section 8.3.4 for details. + */ +@VintfStability +@Backing(type="int") +enum DppStatusErrorCode { + UNKNOWN = -1, + SUCCESS = 0, + NOT_COMPATIBLE = 1, + AUTH_FAILURE = 2, + UNWRAP_FAILURE = 3, + BAD_GROUP = 4, + CONFIGURE_FAILURE = 5, + RESPONSE_PENDING = 6, + INVALID_CONNECTOR = 7, + NO_MATCH = 8, + CONFIG_REJECTED = 9, + NO_AP = 10, + CONFIGURE_PENDING = 11, + CSR_NEEDED = 12, + CSR_BAD = 13, + NEW_KEY_NEEDED = 14, +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl index 4bd095e7e6..29bb0f9aab 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl @@ -22,10 +22,12 @@ import android.hardware.wifi.supplicant.AuxiliarySupplicantEventCode; import android.hardware.wifi.supplicant.BssTmData; import android.hardware.wifi.supplicant.BssidChangeReason; import android.hardware.wifi.supplicant.DppAkm; +import android.hardware.wifi.supplicant.DppConfigurationData; import android.hardware.wifi.supplicant.DppConnectionKeys; import android.hardware.wifi.supplicant.DppEventType; import android.hardware.wifi.supplicant.DppFailureCode; import android.hardware.wifi.supplicant.DppProgressCode; +import android.hardware.wifi.supplicant.DppStatusErrorCode; import android.hardware.wifi.supplicant.Hs20AnqpData; import android.hardware.wifi.supplicant.KeyMgmtMask; import android.hardware.wifi.supplicant.OsuMethod; @@ -144,6 +146,9 @@ oneway interface ISupplicantStaIfaceCallback { * Indicates DPP configuration received success event in Enrolee mode. * This is also triggered when Configurator generates credentials for itself * using generateSelfDppConfiguration() API + *

+ * @deprecated This callback is deprecated from AIDL v2, newer HAL should call + * onDppConfigReceived. */ void onDppSuccessConfigReceived(in byte[] ssid, in String password, in byte[] psk, in DppAkm securityAkm, in DppConnectionKeys dppConnectionKeys); @@ -367,4 +372,16 @@ oneway interface ISupplicantStaIfaceCallback { * @param reason Reason as given in MloLinkInfoChangeReason. */ void onMloLinksInfoChanged(in MloLinkInfoChangeReason reason); + + /** + * Indicates DPP configuration received success event in Enrollee mode. + * This is also triggered when Configurator generates credentials for itself + * using generateSelfDppConfiguration() API + */ + void onDppConfigReceived(in DppConfigurationData configData); + + /** + * Indicates that DPP connection status result frame is sent. + */ + void onDppConnectionStatusResultSent(in DppStatusErrorCode code); } diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp index e42608ee1a..cb2881b469 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp +++ b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp @@ -218,6 +218,15 @@ class SupplicantStaIfaceCallback : public BnSupplicantStaIfaceCallback { MloLinkInfoChangeReason /* reason */) override { return ndk::ScopedAStatus::ok(); } + ::ndk::ScopedAStatus onDppConfigReceived( + const ::aidl::android::hardware::wifi::supplicant:: + DppConfigurationData& /* configData */) override { + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus onDppConnectionStatusResultSent( + ::aidl::android::hardware::wifi::supplicant::DppStatusErrorCode /* code */) override { + return ndk::ScopedAStatus::ok(); + } }; class SupplicantStaIfaceAidlTest : public testing::TestWithParam { From 08315ccbb6f515e919f4758ed0de52e4dc5cb2cf Mon Sep 17 00:00:00 2001 From: Vladimir Komsiyski Date: Tue, 6 Dec 2022 13:26:09 +0100 Subject: [PATCH 453/998] Define the runtime sensor handle range in ISensors.aidl Add a test to make sure that there are no sensors with handles within this range in the HAL. Fix: 259227294 Test: VtsAidlHalSensorsTargetTest Change-Id: Ib785984a0b43457eacd41031bbf361375f9d21f8 --- compatibility_matrices/compatibility_matrix.current.xml | 1 + .../current/android/hardware/sensors/ISensors.aidl | 2 ++ sensors/aidl/android/hardware/sensors/ISensors.aidl | 9 +++++++++ sensors/aidl/convert/Android.bp | 2 +- sensors/aidl/default/Android.bp | 4 ++-- sensors/aidl/default/multihal/Android.bp | 2 +- sensors/aidl/default/sensors-default.xml | 2 +- sensors/aidl/multihal/Android.bp | 2 +- .../aidl/multihal/android.hardware.sensors-multihal.xml | 2 +- sensors/aidl/vts/Android.bp | 2 +- sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp | 7 ++++++- 11 files changed, 26 insertions(+), 9 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index f8954a3f7c..7a29485289 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -593,6 +593,7 @@ android.hardware.sensors + 2 ISensors default diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/ISensors.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/ISensors.aidl index f60f5bb247..b26040b56d 100644 --- a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/ISensors.aidl +++ b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/ISensors.aidl @@ -58,6 +58,8 @@ interface ISensors { const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_DATA = 24; const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_RESERVED = 88; const int DIRECT_REPORT_SENSOR_EVENT_TOTAL_LENGTH = 104; + const int RUNTIME_SENSORS_HANDLE_BASE = 1593835520; + const int RUNTIME_SENSORS_HANDLE_END = 1610612735; @Backing(type="int") @VintfStability enum RateLevel { STOP = 0, diff --git a/sensors/aidl/android/hardware/sensors/ISensors.aidl b/sensors/aidl/android/hardware/sensors/ISensors.aidl index 2c684897cf..5e276dd90a 100644 --- a/sensors/aidl/android/hardware/sensors/ISensors.aidl +++ b/sensors/aidl/android/hardware/sensors/ISensors.aidl @@ -371,4 +371,13 @@ interface ISensors { const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_DATA = 0x18; const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_RESERVED = 0x58; const int DIRECT_REPORT_SENSOR_EVENT_TOTAL_LENGTH = 104; + + /** + * Constants related to reserved sensor handle ranges. + * + * The following range (inclusive) is reserved for usage by the system for + * runtime sensors. + */ + const int RUNTIME_SENSORS_HANDLE_BASE = 0x5F000000; + const int RUNTIME_SENSORS_HANDLE_END = 0x5FFFFFFF; } diff --git a/sensors/aidl/convert/Android.bp b/sensors/aidl/convert/Android.bp index d47de8ec6d..79e6263d5d 100644 --- a/sensors/aidl/convert/Android.bp +++ b/sensors/aidl/convert/Android.bp @@ -35,7 +35,7 @@ cc_library_static { "libhardware", "libbase", "libutils", - "android.hardware.sensors-V1-ndk", + "android.hardware.sensors-V2-ndk", ], local_include_dirs: ["include/aidl/sensors"], export_shared_lib_headers: [ diff --git a/sensors/aidl/default/Android.bp b/sensors/aidl/default/Android.bp index 3c66744324..16b4d3558a 100644 --- a/sensors/aidl/default/Android.bp +++ b/sensors/aidl/default/Android.bp @@ -41,7 +41,7 @@ cc_library_static { "libfmq", "libpower", "libbinder_ndk", - "android.hardware.sensors-V1-ndk", + "android.hardware.sensors-V2-ndk", ], export_include_dirs: ["include"], srcs: [ @@ -68,7 +68,7 @@ cc_binary { "libcutils", "liblog", "libutils", - "android.hardware.sensors-V1-ndk", + "android.hardware.sensors-V2-ndk", ], static_libs: [ "libsensorsexampleimpl", diff --git a/sensors/aidl/default/multihal/Android.bp b/sensors/aidl/default/multihal/Android.bp index eee10625bb..a20d6d7434 100644 --- a/sensors/aidl/default/multihal/Android.bp +++ b/sensors/aidl/default/multihal/Android.bp @@ -38,7 +38,7 @@ cc_library_static { "android.hardware.sensors@1.0", "android.hardware.sensors@2.0", "android.hardware.sensors@2.1", - "android.hardware.sensors-V1-ndk", + "android.hardware.sensors-V2-ndk", ], export_include_dirs: ["include"], srcs: [ diff --git a/sensors/aidl/default/sensors-default.xml b/sensors/aidl/default/sensors-default.xml index 7898a6bab0..36b28ed0a6 100644 --- a/sensors/aidl/default/sensors-default.xml +++ b/sensors/aidl/default/sensors-default.xml @@ -1,7 +1,7 @@ android.hardware.sensors - 1 + 2 ISensors/default diff --git a/sensors/aidl/multihal/Android.bp b/sensors/aidl/multihal/Android.bp index 6d35dafd6d..522d305d86 100644 --- a/sensors/aidl/multihal/Android.bp +++ b/sensors/aidl/multihal/Android.bp @@ -40,7 +40,7 @@ cc_binary { "android.hardware.sensors@2.0-ScopedWakelock", "android.hardware.sensors@2.0", "android.hardware.sensors@2.1", - "android.hardware.sensors-V1-ndk", + "android.hardware.sensors-V2-ndk", "libbase", "libcutils", "libfmq", diff --git a/sensors/aidl/multihal/android.hardware.sensors-multihal.xml b/sensors/aidl/multihal/android.hardware.sensors-multihal.xml index d78edffaf9..5da4fbd9a1 100644 --- a/sensors/aidl/multihal/android.hardware.sensors-multihal.xml +++ b/sensors/aidl/multihal/android.hardware.sensors-multihal.xml @@ -17,7 +17,7 @@ android.hardware.sensors - 1 + 2 ISensors/default diff --git a/sensors/aidl/vts/Android.bp b/sensors/aidl/vts/Android.bp index f3972ec2a3..c17a5585fd 100644 --- a/sensors/aidl/vts/Android.bp +++ b/sensors/aidl/vts/Android.bp @@ -41,7 +41,7 @@ cc_test { "android.hardware.common.fmq-V1-ndk", ], static_libs: [ - "android.hardware.sensors-V1-ndk", + "android.hardware.sensors-V2-ndk", "VtsHalSensorsTargetTestUtils", "libaidlcommonsupport", ], diff --git a/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp b/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp index d536e290b2..ad58e213ef 100644 --- a/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp +++ b/sensors/aidl/vts/VtsAidlHalSensorsTargetTest.cpp @@ -560,10 +560,15 @@ TEST_P(SensorsAidlTest, SensorListValid) { EXPECT_NO_FATAL_FAILURE(assertTypeMatchStringType(info.type, info.typeAsString)); } - // Test if all sensor has name and vendor + // Test if all sensors have name and vendor EXPECT_FALSE(info.name.empty()); EXPECT_FALSE(info.vendor.empty()); + // Make sure that the sensor handle is not within the reserved range for runtime + // sensors. + EXPECT_FALSE(ISensors::RUNTIME_SENSORS_HANDLE_BASE <= info.sensorHandle && + info.sensorHandle <= ISensors::RUNTIME_SENSORS_HANDLE_END); + // Make sure that sensors of the same type have a unique name. std::vector& v = sensorTypeNameMap[static_cast(info.type)]; bool isUniqueName = std::find(v.begin(), v.end(), info.name) == v.end(); From 9c1be5a0e1d1a916caf77c15ca60e32ebdc7f2f1 Mon Sep 17 00:00:00 2001 From: Jeff Pu Date: Tue, 6 Dec 2022 17:09:54 +0000 Subject: [PATCH 454/998] Add virtual fingerprint HAL child process based on demand Bug: 244854670 Test: Manual Change-Id: I403de4cc334aae8e888da064d9064ebe283bf572 --- biometrics/fingerprint/aidl/default/fingerprint-example.rc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/biometrics/fingerprint/aidl/default/fingerprint-example.rc b/biometrics/fingerprint/aidl/default/fingerprint-example.rc index 574438edbb..10db00d0f5 100644 --- a/biometrics/fingerprint/aidl/default/fingerprint-example.rc +++ b/biometrics/fingerprint/aidl/default/fingerprint-example.rc @@ -2,3 +2,8 @@ service vendor.fingerprint-example /vendor/bin/hw/android.hardware.biometrics.fi class hal user nobody group nobody + disabled +on property:ro.vendor.fingerprint_virtual_hal_start=true + enable vendor.fingerprint-example +on property:persist.vendor.fingerprint.virtual.type=* + enable vendor.fingerprint-example From daf12d944042180398acd45e9ccc684d5288c0f5 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Wed, 7 Dec 2022 00:43:46 +0000 Subject: [PATCH 455/998] Update weaver AIDL default to use V2 Test: VtsHalWeaverTargetTest Bug: 259556049 Change-Id: Id6aa9316a20541bf2c9a7cc53345a5010a188d00 --- .../compatibility_matrix.current.xml | 2 +- weaver/aidl/default/Android.bp | 2 +- weaver/aidl/default/Weaver.cpp | 11 ++++++----- .../android.hardware.weaver-service.example.xml | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index d0e844dd4b..3c7d893c19 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -693,7 +693,7 @@ android.hardware.weaver - 1 + 2 IWeaver default diff --git a/weaver/aidl/default/Android.bp b/weaver/aidl/default/Android.bp index 70d91718de..494cb1bf4a 100644 --- a/weaver/aidl/default/Android.bp +++ b/weaver/aidl/default/Android.bp @@ -34,7 +34,7 @@ cc_binary { "Weaver.cpp", ], shared_libs: [ - "android.hardware.weaver-V1-ndk", + "android.hardware.weaver-V2-ndk", "libbase", "libbinder_ndk", ], diff --git a/weaver/aidl/default/Weaver.cpp b/weaver/aidl/default/Weaver.cpp index 6b77924be7..c9ffe85594 100644 --- a/weaver/aidl/default/Weaver.cpp +++ b/weaver/aidl/default/Weaver.cpp @@ -37,18 +37,19 @@ std::array slot_array; } ::ndk::ScopedAStatus Weaver::read(int32_t in_slotId, const std::vector& in_key, WeaverReadResponse* out_response) { + using ::aidl::android::hardware::weaver::WeaverReadStatus; if (in_slotId > 15 || in_key.size() > 16) { - *out_response = {0, {}}; - return ndk::ScopedAStatus(AStatus_fromServiceSpecificError(Weaver::STATUS_FAILED)); + *out_response = {0, {}, WeaverReadStatus::FAILED}; + return ndk::ScopedAStatus::ok(); } if (slot_array[in_slotId].key != in_key) { - *out_response = {0, {}}; - return ndk::ScopedAStatus(AStatus_fromServiceSpecificError(Weaver::STATUS_INCORRECT_KEY)); + *out_response = {0, {}, WeaverReadStatus::INCORRECT_KEY}; + return ndk::ScopedAStatus::ok(); } - *out_response = {0, slot_array[in_slotId].value}; + *out_response = {0, slot_array[in_slotId].value, WeaverReadStatus::OK}; return ::ndk::ScopedAStatus::ok(); } diff --git a/weaver/aidl/default/android.hardware.weaver-service.example.xml b/weaver/aidl/default/android.hardware.weaver-service.example.xml index ed291cdf60..bfe43966ab 100644 --- a/weaver/aidl/default/android.hardware.weaver-service.example.xml +++ b/weaver/aidl/default/android.hardware.weaver-service.example.xml @@ -1,7 +1,7 @@ android.hardware.weaver - 1 + 2 IWeaver default From a61ca2a8721743dd79768e14a66a94da691d1553 Mon Sep 17 00:00:00 2001 From: Nolan Scobie Date: Wed, 7 Dec 2022 11:48:27 -0500 Subject: [PATCH 456/998] Add librenderengine_deps to targets depending on librenderengine See I46750a0336a29d8d32ad2cb79a71c90461272fce for context. Bug: 259248961 Test: presubmit builds Change-Id: Ibd8b75406bd79dab6bc20aeaad0d08c9fcdfeb41 --- graphics/composer/2.2/utils/vts/Android.bp | 1 + graphics/composer/2.2/vts/functional/Android.bp | 3 +-- graphics/composer/aidl/vts/Android.bp | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/graphics/composer/2.2/utils/vts/Android.bp b/graphics/composer/2.2/utils/vts/Android.bp index 478e2b7a33..d11592f512 100644 --- a/graphics/composer/2.2/utils/vts/Android.bp +++ b/graphics/composer/2.2/utils/vts/Android.bp @@ -29,6 +29,7 @@ cc_library_static { "android.hardware.graphics.allocator-ndk_static", "android.hardware.graphics.composer3-ndk_static", "hidl_defaults", + "librenderengine_deps", ], srcs: [ "ComposerVts.cpp", diff --git a/graphics/composer/2.2/vts/functional/Android.bp b/graphics/composer/2.2/vts/functional/Android.bp index c693d35b68..34763766da 100644 --- a/graphics/composer/2.2/vts/functional/Android.bp +++ b/graphics/composer/2.2/vts/functional/Android.bp @@ -29,8 +29,7 @@ cc_test { "VtsHalTargetTestDefaults", "android.hardware.graphics.allocator-ndk_static", "android.hardware.graphics.composer3-ndk_static", - // Needed for librenderengine - "skia_deps", + "librenderengine_deps", ], tidy_timeout_srcs: [ "VtsHalGraphicsComposerV2_2ReadbackTest.cpp", diff --git a/graphics/composer/aidl/vts/Android.bp b/graphics/composer/aidl/vts/Android.bp index cbd2da5fe0..88b5de41bb 100644 --- a/graphics/composer/aidl/vts/Android.bp +++ b/graphics/composer/aidl/vts/Android.bp @@ -28,8 +28,7 @@ cc_test { defaults: [ "VtsHalTargetTestDefaults", "use_libaidlvintf_gtest_helper_static", - // Needed for librenderengine - "skia_deps", + "librenderengine_deps", "android.hardware.graphics.common-ndk_static", "android.hardware.graphics.composer3-ndk_static", ], From d7483327cb906e3868827c6daf410aec9f2ba8df Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Tue, 29 Nov 2022 01:12:36 +0000 Subject: [PATCH 457/998] Add onTuneFailed when canceling tuning operation Due to RadioTuner API documentation, onTuneFailed should be called when a pending tuning operation is canceled. Therefore, a new result value Canceled was added in broadcast radio HAL. The onTuneFailed callback for pending tuning operations in default HAL was implemented by adding whatIfCanceled function field in Task struct in WorkerThread utils class. Bug: 257337458 Test: atest RadioTunerTest#cancel_whenTune Test: atest RadioTunerTest#cancel_whenSeek Change-Id: I901ab2cc3561082e5f11a9f6c33db044fc9bc28b --- .../hardware/broadcastradio/Result.aidl | 3 ++- .../broadcastradio/ITunerCallback.aidl | 1 + .../hardware/broadcastradio/Result.aidl | 6 ++++++ .../aidl/default/BroadcastRadio.cpp | 11 ++++++---- broadcastradio/common/utils/WorkerThread.cpp | 21 +++++++++++++------ .../broadcastradio-utils/WorkerThread.h | 3 +++ 6 files changed, 34 insertions(+), 11 deletions(-) diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Result.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Result.aidl index 07edae80ae..3464412918 100644 --- a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Result.aidl +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Result.aidl @@ -40,5 +40,6 @@ enum Result { INVALID_STATE = 3, NOT_SUPPORTED = 4, TIMEOUT = 5, - UNKNOWN_ERROR = 6, + CANCELED = 6, + UNKNOWN_ERROR = 7, } diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ITunerCallback.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ITunerCallback.aidl index 1f0221cbf9..8de12c844d 100644 --- a/broadcastradio/aidl/android/hardware/broadcastradio/ITunerCallback.aidl +++ b/broadcastradio/aidl/android/hardware/broadcastradio/ITunerCallback.aidl @@ -36,6 +36,7 @@ oneway interface ITunerCallback { * @param result {@link Result#TIMEOUT} in case that tune(), seek() or * step() is not completed within * @link IBroadcastRadio#TUNER_TIMEOUT_MS} + * or {@link Result#CANCELED} if the command was canceled. * @param selector A ProgramSelector structure passed from tune() call; * empty for step() and seek(). */ diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl index 9985ccbfd7..3f7ddac63d 100644 --- a/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl +++ b/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl @@ -54,6 +54,12 @@ enum Result { */ TIMEOUT, + /** + * Error used when a tune, seek, step or operation is canceled before + * being processed. + */ + CANCELED, + /** * Error that does not follow into the error categories above. */ diff --git a/broadcastradio/aidl/default/BroadcastRadio.cpp b/broadcastradio/aidl/default/BroadcastRadio.cpp index 0209a0e6ef..42e550e75a 100644 --- a/broadcastradio/aidl/default/BroadcastRadio.cpp +++ b/broadcastradio/aidl/default/BroadcastRadio.cpp @@ -238,7 +238,8 @@ ScopedAStatus BroadcastRadio::tune(const ProgramSelector& program) { } callback->onCurrentProgramInfoChanged(programInfo); }; - mThread->schedule(task, kTuneDelayTimeMs); + auto cancelTask = [program, callback]() { callback->onTuneFailed(Result::CANCELED, program); }; + mThread->schedule(task, cancelTask, kTuneDelayTimeMs); return ScopedAStatus::ok(); } @@ -258,6 +259,7 @@ ScopedAStatus BroadcastRadio::seek(bool directionUp, bool skipSubChannel) { const auto& list = mVirtualRadio.getProgramList(); std::shared_ptr callback = mCallback; + auto cancelTask = [callback]() { callback->onTuneFailed(Result::CANCELED, {}); }; if (list.empty()) { mIsTuneCompleted = false; auto task = [callback]() { @@ -265,7 +267,7 @@ ScopedAStatus BroadcastRadio::seek(bool directionUp, bool skipSubChannel) { callback->onTuneFailed(Result::TIMEOUT, {}); }; - mThread->schedule(task, kSeekDelayTimeMs); + mThread->schedule(task, cancelTask, kSeekDelayTimeMs); return ScopedAStatus::ok(); } @@ -298,7 +300,7 @@ ScopedAStatus BroadcastRadio::seek(bool directionUp, bool skipSubChannel) { } callback->onCurrentProgramInfoChanged(programInfo); }; - mThread->schedule(task, kSeekDelayTimeMs); + mThread->schedule(task, cancelTask, kSeekDelayTimeMs); return ScopedAStatus::ok(); } @@ -352,7 +354,8 @@ ScopedAStatus BroadcastRadio::step(bool directionUp) { } callback->onCurrentProgramInfoChanged(programInfo); }; - mThread->schedule(task, kStepDelayTimeMs); + auto cancelTask = [callback]() { callback->onTuneFailed(Result::CANCELED, {}); }; + mThread->schedule(task, cancelTask, kStepDelayTimeMs); return ScopedAStatus::ok(); } diff --git a/broadcastradio/common/utils/WorkerThread.cpp b/broadcastradio/common/utils/WorkerThread.cpp index dd87f538ea..43fd04a89a 100644 --- a/broadcastradio/common/utils/WorkerThread.cpp +++ b/broadcastradio/common/utils/WorkerThread.cpp @@ -18,14 +18,13 @@ namespace android { -using std::chrono::milliseconds; -using std::chrono::steady_clock; using std::function; using std::lock_guard; using std::mutex; -using std::priority_queue; -using std::this_thread::sleep_for; using std::unique_lock; +using std::chrono::milliseconds; +using std::chrono::steady_clock; +using std::this_thread::sleep_for; bool operator<(const WorkerThread::Task& lhs, const WorkerThread::Task& rhs) { return lhs.when > rhs.when; @@ -47,16 +46,26 @@ WorkerThread::~WorkerThread() { } void WorkerThread::schedule(function task, milliseconds delay) { + auto cancelTask = []() {}; + schedule(std::move(task), cancelTask, delay); +} + +void WorkerThread::schedule(function task, function cancelTask, + milliseconds delay) { auto when = steady_clock::now() + delay; lock_guard lk(mMut); - mTasks.push(Task({when, task})); + mTasks.push(Task({when, std::move(task), std::move(cancelTask)})); mCond.notify_one(); } void WorkerThread::cancelAll() { lock_guard lk(mMut); - priority_queue().swap(mTasks); // empty queue + while (!mTasks.empty()) { + auto task = mTasks.top(); + task.onCanceled(); + mTasks.pop(); + } } void WorkerThread::threadLoop() { diff --git a/broadcastradio/common/utils/include/broadcastradio-utils/WorkerThread.h b/broadcastradio/common/utils/include/broadcastradio-utils/WorkerThread.h index 62bede6ca0..457b57e403 100644 --- a/broadcastradio/common/utils/include/broadcastradio-utils/WorkerThread.h +++ b/broadcastradio/common/utils/include/broadcastradio-utils/WorkerThread.h @@ -28,12 +28,15 @@ class WorkerThread { virtual ~WorkerThread(); void schedule(std::function task, std::chrono::milliseconds delay); + void schedule(std::function task, std::function cancelTask, + std::chrono::milliseconds delay); void cancelAll(); private: struct Task { std::chrono::time_point when; std::function what; + std::function onCanceled; }; friend bool operator<(const Task& lhs, const Task& rhs); From bfc9931975f8be05aace18e21eea6eeb4d8e26cf Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Fri, 2 Dec 2022 20:44:40 +0000 Subject: [PATCH 458/998] Update Vendor HAL APEX to use the AIDL service. Bug: 205044134 Test: Check that AIDL service is running on a Bluejay device. Change-Id: I5a09fe1a68fee871e6ff8fa338f4482500e6cf48 --- wifi/apex/Android.bp | 8 ++++---- wifi/apex/file_contexts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wifi/apex/Android.bp b/wifi/apex/Android.bp index 0afb96b85d..e1fefb9575 100644 --- a/wifi/apex/Android.bp +++ b/wifi/apex/Android.bp @@ -15,7 +15,7 @@ android_app_certificate { genrule { name: "gen-android.hardware.wifi.rc", - srcs: [":default-android.hardware.wifi@1.0-service.rc"], + srcs: [":default-android.hardware.wifi-service.rc"], out: ["com.android.hardware.wifi-service.rc"], cmd: "sed -e 's@/vendor/bin/@/apex/com.android.hardware.wifi/bin/@' $(in) > $(out)", } @@ -28,7 +28,7 @@ prebuilt_etc { prebuilt_etc { name: "com.android.hardware.wifi.xml", - src: ":default-android.hardware.wifi@1.0-service.xml", + src: ":default-android.hardware.wifi-service.xml", installable: false, } @@ -43,13 +43,13 @@ apex { updatable: false, soc_specific: true, binaries: [ - "android.hardware.wifi@1.0-service", + "android.hardware.wifi-service", ], prebuilts: [ "com.android.hardware.wifi.rc", "com.android.hardware.wifi.xml", ], overrides: [ - "android.hardware.wifi@1.0-service", + "android.hardware.wifi-service", ], } diff --git a/wifi/apex/file_contexts b/wifi/apex/file_contexts index 812d51db58..6368729c9a 100644 --- a/wifi/apex/file_contexts +++ b/wifi/apex/file_contexts @@ -1,3 +1,3 @@ (/.*)? u:object_r:vendor_file:s0 -/bin/hw/android\.hardware\.wifi@1.0-service u:object_r:hal_wifi_default_exec:s0 +/bin/hw/android\.hardware\.wifi-service u:object_r:hal_wifi_default_exec:s0 From bd150ea1f169d3c8da4d99d8736cd561106c2522 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Fri, 4 Nov 2022 21:45:53 +0000 Subject: [PATCH 459/998] Update VTS test dependencies. Supplicant and Hostapd tests have a dependency on the Vendor HAL in order to do setup/cleanup, such as bringing up an interface. This change will make the tests compatible with either the HIDL or AIDL Vendor HAL, depending on which is available. Bug: 205044134 Test: atest VtsHalHostapdTargetTest atest VtsHalWifiSupplicantStaIfaceTargetTest \ VtsHalWifiSupplicantStaNetworkTargetTest \ VtsHalWifiSupplicantP2pIfaceTargetTest Tests were run using both the HIDL and AIDL Vendor HALs. Change-Id: I1f6b15016414a0bf614703315b47b5b47d3a1e50 --- .../vts/functional/wifi_aidl_test_utils.cpp | 4 + .../vts/functional/wifi_aidl_test_utils.h | 1 + wifi/hostapd/aidl/vts/functional/Android.bp | 3 + .../functional/VtsHalHostapdTargetTest.cpp | 62 ++++++-- .../supplicant/aidl/vts/functional/Android.bp | 6 + .../functional/supplicant_aidl_test_utils.h | 146 ++++++++++++++++++ .../functional/supplicant_legacy_test_utils.h | 55 +++++++ .../vts/functional/supplicant_test_utils.h | 51 ++---- 8 files changed, 284 insertions(+), 44 deletions(-) create mode 100644 wifi/supplicant/aidl/vts/functional/supplicant_aidl_test_utils.h create mode 100644 wifi/supplicant/aidl/vts/functional/supplicant_legacy_test_utils.h diff --git a/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp b/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp index 6722f36dc9..463545bbe0 100644 --- a/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp +++ b/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp @@ -214,3 +214,7 @@ int32_t getChipCapabilities(const std::shared_ptr& wifi_chip) { } return 0; } + +bool isAidlServiceAvailable(const char* instance_name) { + return AServiceManager_isDeclared(instance_name); +} diff --git a/wifi/aidl/vts/functional/wifi_aidl_test_utils.h b/wifi/aidl/vts/functional/wifi_aidl_test_utils.h index ad16603dd3..2eac9509e3 100644 --- a/wifi/aidl/vts/functional/wifi_aidl_test_utils.h +++ b/wifi/aidl/vts/functional/wifi_aidl_test_utils.h @@ -46,3 +46,4 @@ bool configureChipToSupportConcurrencyType(const std::shared_ptr& wif void stopWifiService(const char* instance_name); int32_t getChipCapabilities(const std::shared_ptr& wifi_chip); bool checkStatusCode(ndk::ScopedAStatus* status, WifiStatusCode expected_code); +bool isAidlServiceAvailable(const char* instance_name); diff --git a/wifi/hostapd/aidl/vts/functional/Android.bp b/wifi/hostapd/aidl/vts/functional/Android.bp index e61d3975bb..1942db176c 100644 --- a/wifi/hostapd/aidl/vts/functional/Android.bp +++ b/wifi/hostapd/aidl/vts/functional/Android.bp @@ -34,6 +34,9 @@ cc_test { "android.hardware.wifi@1.3", "android.hardware.wifi@1.4", "android.hardware.wifi@1.5", + "android.hardware.wifi-V1-ndk", + "libwifi-system-iface", + "VtsHalWifiTargetTestUtil", ], test_suites: [ "general-tests", diff --git a/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp b/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp index bd2649fc50..69f1b762a7 100644 --- a/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp +++ b/wifi/hostapd/aidl/vts/functional/VtsHalHostapdTargetTest.cpp @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include #include #include @@ -30,6 +31,8 @@ #include #include +#include "wifi_aidl_test_utils.h" + using aidl::android::hardware::wifi::hostapd::BandMask; using aidl::android::hardware::wifi::hostapd::BnHostapdCallback; using aidl::android::hardware::wifi::hostapd::ChannelBandwidth; @@ -54,6 +57,8 @@ const int kIfaceInvalidChannel = 567; const std::vector kTestZeroMacAddr(6, 0x0); const Ieee80211ReasonCode kTestDisconnectReasonCode = Ieee80211ReasonCode::WLAN_REASON_UNSPECIFIED; +const std::string kWifiAidlInstanceNameStr = std::string() + IWifi::descriptor + "/default"; +const char* kWifiAidlInstanceName = kWifiAidlInstanceNameStr.c_str(); inline BandMask operator|(BandMask a, BandMask b) { return static_cast(static_cast(a) | @@ -77,33 +82,70 @@ class HostapdAidl : public testing::TestWithParam { isBridgedSupport = testing::checkSubstringInCommandOutput( "/system/bin/cmd wifi get-softap-supported-features", "wifi_softap_bridged_ap_supported"); - const std::vector instances = android::hardware::getAllHalInstanceNames( - ::android::hardware::wifi::V1_0::IWifi::descriptor); - EXPECT_NE(0, instances.size()); - wifiInstanceName = instances[0]; + if (!isAidlServiceAvailable(kWifiAidlInstanceName)) { + const std::vector instances = android::hardware::getAllHalInstanceNames( + ::android::hardware::wifi::V1_0::IWifi::descriptor); + EXPECT_NE(0, instances.size()); + wifiHidlInstanceName = instances[0]; + } } virtual void TearDown() override { - if (getWifi(wifiInstanceName) != nullptr) { - stopWifi(wifiInstanceName); - } + stopVendorHal(); hostapd->terminate(); // Wait 3 seconds to allow terminate to complete sleep(3); } std::shared_ptr hostapd; - std::string wifiInstanceName; + std::string wifiHidlInstanceName; bool isAcsSupport; bool isWpa3SaeSupport; bool isBridgedSupport; + void stopVendorHal() { + if (isAidlServiceAvailable(kWifiAidlInstanceName)) { + // HIDL and AIDL versions of getWifi() take different arguments + // i.e. const char* vs string + if (getWifi(kWifiAidlInstanceName) != nullptr) { + stopWifiService(kWifiAidlInstanceName); + } + } else { + if (getWifi(wifiHidlInstanceName) != nullptr) { + stopWifi(wifiHidlInstanceName); + } + } + } + std::string setupApIfaceAndGetName(bool isBridged) { + if (isAidlServiceAvailable(kWifiAidlInstanceName)) { + return setupApIfaceAndGetNameAidl(isBridged); + } else { + return setupApIfaceAndGetNameHidl(isBridged); + } + } + + std::string setupApIfaceAndGetNameAidl(bool isBridged) { + std::shared_ptr wifi_ap_iface; + if (isBridged) { + wifi_ap_iface = getBridgedWifiApIface(kWifiAidlInstanceName); + } else { + wifi_ap_iface = getWifiApIface(kWifiAidlInstanceName); + } + EXPECT_NE(nullptr, wifi_ap_iface.get()); + + std::string ap_iface_name; + auto status = wifi_ap_iface->getName(&ap_iface_name); + EXPECT_TRUE(status.isOk()); + return ap_iface_name; + } + + std::string setupApIfaceAndGetNameHidl(bool isBridged) { android::sp<::android::hardware::wifi::V1_0::IWifiApIface> wifi_ap_iface; if (isBridged) { - wifi_ap_iface = getBridgedWifiApIface_1_5(wifiInstanceName); + wifi_ap_iface = getBridgedWifiApIface_1_5(wifiHidlInstanceName); } else { - wifi_ap_iface = getWifiApIface_1_5(wifiInstanceName); + wifi_ap_iface = getWifiApIface_1_5(wifiHidlInstanceName); } EXPECT_NE(nullptr, wifi_ap_iface.get()); diff --git a/wifi/supplicant/aidl/vts/functional/Android.bp b/wifi/supplicant/aidl/vts/functional/Android.bp index b959c7504d..f7c619ab51 100644 --- a/wifi/supplicant/aidl/vts/functional/Android.bp +++ b/wifi/supplicant/aidl/vts/functional/Android.bp @@ -50,6 +50,8 @@ cc_test { "VtsHalWifiV1_0TargetTestUtil", "VtsHalWifiV1_5TargetTestUtil", "VtsHalWifiSupplicantV1_0TargetTestUtil", + "android.hardware.wifi-V1-ndk", + "VtsHalWifiTargetTestUtil", ], test_suites: [ "general-tests", @@ -84,6 +86,8 @@ cc_test { "VtsHalWifiV1_0TargetTestUtil", "VtsHalWifiV1_5TargetTestUtil", "VtsHalWifiSupplicantV1_0TargetTestUtil", + "android.hardware.wifi-V1-ndk", + "VtsHalWifiTargetTestUtil", ], test_suites: [ "general-tests", @@ -118,6 +122,8 @@ cc_test { "VtsHalWifiV1_0TargetTestUtil", "VtsHalWifiV1_5TargetTestUtil", "VtsHalWifiSupplicantV1_0TargetTestUtil", + "android.hardware.wifi-V1-ndk", + "VtsHalWifiTargetTestUtil", ], test_suites: [ "general-tests", diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_aidl_test_utils.h b/wifi/supplicant/aidl/vts/functional/supplicant_aidl_test_utils.h new file mode 100644 index 0000000000..a850e507f0 --- /dev/null +++ b/wifi/supplicant/aidl/vts/functional/supplicant_aidl_test_utils.h @@ -0,0 +1,146 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include + +#include "wifi_aidl_test_utils.h" + +using android::wifi_system::SupplicantManager; + +// Helper methods to interact with wifi_aidl_test_utils +namespace SupplicantAidlTestUtils { +const std::string kWifiInstanceNameStr = std::string() + IWifi::descriptor + "/default"; +const char* kWifiInstanceName = kWifiInstanceNameStr.c_str(); + +// Initialize the driver and firmware to STA mode using the vendor HAL. +void initializeDriverAndFirmware(const std::string& wifi_instance_name) { + // Skip if wifi instance is not set. + if (wifi_instance_name == "") { + return; + } + if (getWifi(wifi_instance_name.c_str()) != nullptr) { + std::shared_ptr wifi_chip = getWifiChip(wifi_instance_name.c_str()); + int mode_id; + EXPECT_TRUE(configureChipToSupportConcurrencyType(wifi_chip, IfaceConcurrencyType::STA, + &mode_id)); + } else { + LOG(WARNING) << __func__ << ": Vendor HAL not supported"; + } +} + +// Deinitialize the driver and firmware using the vendor HAL. +void deInitializeDriverAndFirmware(const std::string& wifi_instance_name) { + // Skip if wifi instance is not set. + if (wifi_instance_name == "") { + return; + } + if (getWifi(wifi_instance_name.c_str()) != nullptr) { + stopWifiService(wifi_instance_name.c_str()); + } else { + LOG(WARNING) << __func__ << ": Vendor HAL not supported"; + } +} + +bool waitForSupplicantState(bool is_running) { + SupplicantManager supplicant_manager; + int count = 50; /* wait at most 5 seconds for completion */ + while (count-- > 0) { + if (supplicant_manager.IsSupplicantRunning() == is_running) { + return true; + } + usleep(100000); + } + LOG(ERROR) << "Unable to " << (is_running ? "start" : "stop") << " supplicant"; + return false; +} + +bool waitForSupplicantStart() { + return waitForSupplicantState(true); +} + +bool waitForSupplicantStop() { + return waitForSupplicantState(false); +} + +bool waitForWifiHalStop(const std::string& wifi_instance_name) { + std::shared_ptr wifi = getWifi(wifi_instance_name.c_str()); + int count = 50; /* wait at most 5 seconds for completion */ + while (count-- > 0) { + if (wifi != nullptr) { + bool started = false; + auto status = wifi->isStarted(&started); + if (status.isOk() && !started) { + return true; + } + } + usleep(100000); + wifi = getWifi(wifi_instance_name.c_str()); + } + LOG(ERROR) << "Wifi HAL was not stopped"; + return false; +} + +bool waitForFrameworkReady() { + int waitCount = 15; + do { + // Check whether package service is ready or not. + if (!testing::checkSubstringInCommandOutput("/system/bin/service check package", + ": not found")) { + return true; + } + LOG(INFO) << "Framework is not ready"; + sleep(1); + } while (waitCount-- > 0); + return false; +} + +bool useAidlService() { + return isAidlServiceAvailable(kWifiInstanceName); +} + +void startSupplicant() { + initializeDriverAndFirmware(kWifiInstanceName); + SupplicantManager supplicant_manager; + ASSERT_TRUE(supplicant_manager.StartSupplicant()); + ASSERT_TRUE(supplicant_manager.IsSupplicantRunning()); +} + +void stopSupplicantService() { + SupplicantManager supplicant_manager; + ASSERT_TRUE(supplicant_manager.StopSupplicant()); + deInitializeDriverAndFirmware(kWifiInstanceName); + ASSERT_FALSE(supplicant_manager.IsSupplicantRunning()); +} + +bool stopWifiFramework(const std::string& wifi_instance_name) { + std::system("svc wifi disable"); + std::system("cmd wifi set-scan-always-available disabled"); + return waitForSupplicantStop() && waitForWifiHalStop(wifi_instance_name); +} + +void initializeService() { + ASSERT_TRUE(stopWifiFramework(kWifiInstanceName)); + std::system("/system/bin/start"); + ASSERT_TRUE(waitForFrameworkReady()); + stopSupplicantService(); + startSupplicant(); +} +} // namespace SupplicantAidlTestUtils diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_legacy_test_utils.h b/wifi/supplicant/aidl/vts/functional/supplicant_legacy_test_utils.h new file mode 100644 index 0000000000..a20a45846b --- /dev/null +++ b/wifi/supplicant/aidl/vts/functional/supplicant_legacy_test_utils.h @@ -0,0 +1,55 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include + +using android::wifi_system::SupplicantManager; + +// Helper methods to interact with supplicant_hidl_test_utils +namespace SupplicantLegacyTestUtils { +std::string getWifiInstanceName() { + const std::vector instances = android::hardware::getAllHalInstanceNames( + ::android::hardware::wifi::V1_0::IWifi::descriptor); + EXPECT_NE(0, instances.size()); + return instances.size() != 0 ? instances[0] : ""; +} + +void stopSupplicantService() { + stopSupplicant(getWifiInstanceName()); +} + +void startSupplicant() { + initializeDriverAndFirmware(getWifiInstanceName()); + SupplicantManager supplicant_manager; + ASSERT_TRUE(supplicant_manager.StartSupplicant()); + ASSERT_TRUE(supplicant_manager.IsSupplicantRunning()); +} + +void initializeService() { + ASSERT_TRUE(stopWifiFramework(getWifiInstanceName())); + std::system("/system/bin/start"); + ASSERT_TRUE(waitForFrameworkReady()); + stopSupplicantService(); + startSupplicant(); +} +} // namespace SupplicantLegacyTestUtils diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h b/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h index 31042a2b7c..7eeab6870d 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h +++ b/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h @@ -14,22 +14,16 @@ * limitations under the License. */ -#ifndef SUPPLICANT_TEST_UTILS_H -#define SUPPLICANT_TEST_UTILS_H +#pragma once -#include -#include -#include -#include -#include -#include +#include "supplicant_aidl_test_utils.h" +#include "supplicant_legacy_test_utils.h" using aidl::android::hardware::wifi::supplicant::IfaceInfo; using aidl::android::hardware::wifi::supplicant::ISupplicant; using aidl::android::hardware::wifi::supplicant::ISupplicantP2pIface; using aidl::android::hardware::wifi::supplicant::ISupplicantStaIface; using aidl::android::hardware::wifi::supplicant::KeyMgmtMask; -using android::wifi_system::SupplicantManager; std::string getStaIfaceName() { std::array buffer; @@ -43,16 +37,7 @@ std::string getP2pIfaceName() { return std::string(buffer.data()); } -std::string getWifiInstanceName() { - const std::vector instances = - android::hardware::getAllHalInstanceNames( - ::android::hardware::wifi::V1_0::IWifi::descriptor); - EXPECT_NE(0, instances.size()); - return instances.size() != 0 ? instances[0] : ""; -} - -bool keyMgmtSupported(std::shared_ptr iface, - KeyMgmtMask expected) { +bool keyMgmtSupported(std::shared_ptr iface, KeyMgmtMask expected) { KeyMgmtMask caps; if (!iface->getKeyMgmtCapabilities(&caps).isOk()) { return false; @@ -67,22 +52,22 @@ bool isFilsSupported(std::shared_ptr iface) { return keyMgmtSupported(iface, filsMask); } -void startSupplicant() { - initializeDriverAndFirmware(getWifiInstanceName()); - SupplicantManager supplicant_manager; - ASSERT_TRUE(supplicant_manager.StartSupplicant()); - ASSERT_TRUE(supplicant_manager.IsSupplicantRunning()); +void stopSupplicantService() { + // Select method based on whether the HIDL or AIDL + // Vendor HAL is available. + if (SupplicantAidlTestUtils::useAidlService()) { + SupplicantAidlTestUtils::stopSupplicantService(); + } else { + SupplicantLegacyTestUtils::stopSupplicantService(); + } } -// Wrapper around the implementation in supplicant_hidl_test_util. -void stopSupplicantService() { stopSupplicant(getWifiInstanceName()); } - void initializeService() { - ASSERT_TRUE(stopWifiFramework(getWifiInstanceName())); - std::system("/system/bin/start"); - ASSERT_TRUE(waitForFrameworkReady()); - stopSupplicantService(); - startSupplicant(); + if (SupplicantAidlTestUtils::useAidlService()) { + SupplicantAidlTestUtils::stopSupplicantService(); + } else { + SupplicantLegacyTestUtils::stopSupplicantService(); + } } void addStaIface(const std::shared_ptr supplicant) { @@ -106,5 +91,3 @@ std::shared_ptr getSupplicant(const char* supplicant_name) { } return supplicant; } - -#endif // SUPPLICANT_TEST_UTILS_H \ No newline at end of file From aec678ac7d696c9d1648b8c8c3694243060c06e7 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Wed, 7 Dec 2022 16:22:42 -0800 Subject: [PATCH 460/998] Add HAL changes for EV_CURRENT_BATTERY_CAPACITY Bug: 259451992 Test: atest VtsHalAutomotiveVehicle_TargetTest atest CtsCarTestCases:CarPropertyManagerTest atest CtsCarTestCases:VehiclePropertyIdsTest Change-Id: Iafc291171e4ae571e5ca90715ea70d40208da144 --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 14 ++++++++++++++ .../generated_lib/cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../default_config/config/DefaultProperties.json | 8 ++++++++ .../vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 33 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 054e59d6ab..219ea3d7e3 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -61,6 +61,7 @@ enum VehicleProperty { FUEL_LEVEL = 291504903, FUEL_DOOR_OPEN = 287310600, EV_BATTERY_LEVEL = 291504905, + EV_CURRENT_BATTERY_CAPACITY = 291504909, EV_CHARGE_PORT_OPEN = 287310602, EV_CHARGE_PORT_CONNECTED = 287310603, EV_BATTERY_INSTANTANEOUS_CHARGE_RATE = 291504908, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index b3116bdaa9..472192fbda 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -343,6 +343,20 @@ enum VehicleProperty { */ EV_BATTERY_LEVEL = 0x0309 + 0x10000000 + 0x01000000 + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT + /** + * Current battery capacity for EV or hybrid vehicle + * + * Returns the actual value of battery capacity, if EV or hybrid. This property captures the + * real-time battery capacity taking into account factors such as battery aging and temperature + * dependency. Therefore, this value might be different from INFO_EV_BATTERY_CAPACITY because + * INFO_EV_BATTERY_CAPACITY returns the nominal battery capacity from when the vehicle was new. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @unit VehicleUnit:WH + */ + EV_CURRENT_BATTERY_CAPACITY = + 0x030D + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.FLOAT, /** * EV charge port open * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 82daa61b62..c898baf0fa 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -61,6 +61,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::FUEL_LEVEL, VehiclePropertyAccess::READ}, {VehicleProperty::FUEL_DOOR_OPEN, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::EV_BATTERY_LEVEL, VehiclePropertyAccess::READ}, + {VehicleProperty::EV_CURRENT_BATTERY_CAPACITY, VehiclePropertyAccess::READ}, {VehicleProperty::EV_CHARGE_PORT_OPEN, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::EV_CHARGE_PORT_CONNECTED, VehiclePropertyAccess::READ}, {VehicleProperty::EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, VehiclePropertyAccess::READ}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 419c6ded25..c501d9b0bf 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -61,6 +61,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::FUEL_LEVEL, VehiclePropertyChangeMode::CONTINUOUS}, {VehicleProperty::FUEL_DOOR_OPEN, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::EV_BATTERY_LEVEL, VehiclePropertyChangeMode::CONTINUOUS}, + {VehicleProperty::EV_CURRENT_BATTERY_CAPACITY, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::EV_CHARGE_PORT_OPEN, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::EV_CHARGE_PORT_CONNECTED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, VehiclePropertyChangeMode::CONTINUOUS}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 7c6a92ed14..ca85de5b52 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -53,6 +53,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.FUEL_LEVEL, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.FUEL_DOOR_OPEN, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.EV_BATTERY_LEVEL, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.EV_CURRENT_BATTERY_CAPACITY, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.EV_CHARGE_PORT_OPEN, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.EV_CHARGE_PORT_CONNECTED, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, VehiclePropertyAccess.READ), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index c54702b2fc..92a83a878b 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -53,6 +53,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.FUEL_LEVEL, VehiclePropertyChangeMode.CONTINUOUS), Map.entry(VehicleProperty.FUEL_DOOR_OPEN, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.EV_BATTERY_LEVEL, VehiclePropertyChangeMode.CONTINUOUS), + Map.entry(VehicleProperty.EV_CURRENT_BATTERY_CAPACITY, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.EV_CHARGE_PORT_OPEN, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.EV_CHARGE_PORT_CONNECTED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, VehiclePropertyChangeMode.CONTINUOUS), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 5623b8703a..45e21b2ed0 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1309,6 +1309,14 @@ "maxSampleRate": 100.0, "minSampleRate": 1.0 }, + { + "property": "VehicleProperty::EV_CURRENT_BATTERY_CAPACITY", + "defaultValue": { + "floatValues": [ + 150000.0 + ] + } + }, { "property": "VehicleProperty::EV_CHARGE_PORT_OPEN", "defaultValue": { diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 33a697c9ed..1943c4109c 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -487,6 +487,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvBrakeRegenerationLevelConfig) VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvCurrentBatteryCapacityConfig) { + verifyProperty(VehicleProperty::EV_CURRENT_BATTERY_CAPACITY, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::FLOAT); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDoorChildLockEnabledConfig) { verifyProperty(VehicleProperty::DOOR_CHILD_LOCK_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From 95a366dafb4bb1140398e830a477d515513e1a60 Mon Sep 17 00:00:00 2001 From: Bob Badour Date: Thu, 8 Dec 2022 06:18:33 -0800 Subject: [PATCH 461/998] [LSC] Add LOCAL_LICENSE_KINDS to hardware/interfaces Added SPDX-license-identifier-Apache-2.0 to: media/c2/aidl/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Change-Id: I5b515357122fc261c6e44e155eb03e9e07780393 --- media/c2/aidl/Android.bp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/media/c2/aidl/Android.bp b/media/c2/aidl/Android.bp index 5e056c4934..56531db55b 100644 --- a/media/c2/aidl/Android.bp +++ b/media/c2/aidl/Android.bp @@ -1,5 +1,14 @@ // This is the expected build file, but it may not be right in all cases +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.media.c2", vendor_available: true, From ccba2d78e925a7c4e34ed9cf72760329e82ddab3 Mon Sep 17 00:00:00 2001 From: Harry Cutts Date: Thu, 8 Dec 2022 14:28:02 +0000 Subject: [PATCH 462/998] Revert "Add GESTURE_{X,Y}_OFFSET axes to input HAL" Revert "Depend on V2 of the Input HAL from libservices" Revert submission 20187666-input-hal-gesture-offset Reason for revert: Causes build errors (https://android-build.googleplex.com/builds/submitted/9380741/sdk_finalization/latest/logs/build_error.log) Reverted Changes: I31e8b6975:Add GESTURE_{X,Y}_OFFSET axes to input HAL I2eb4924f3:Depend on V2 of the Input HAL from libservices I13d341fa0:Add asserts for new HAL axes in InputCommonConvert... Change-Id: I808e59e78c0fa8abedef6a58db9c277a84cbc5ae --- .../android/hardware/input/common/Axis.aidl | 2 -- .../android/hardware/input/common/Axis.aidl | 17 ----------------- 2 files changed, 19 deletions(-) diff --git a/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Axis.aidl b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Axis.aidl index 7de95b1939..2114c7deb1 100644 --- a/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Axis.aidl +++ b/input/common/aidl/aidl_api/android.hardware.input.common/current/android/hardware/input/common/Axis.aidl @@ -79,6 +79,4 @@ enum Axis { GENERIC_14 = 45, GENERIC_15 = 46, GENERIC_16 = 47, - GESTURE_X_OFFSET = 48, - GESTURE_Y_OFFSET = 49, } diff --git a/input/common/aidl/android/hardware/input/common/Axis.aidl b/input/common/aidl/android/hardware/input/common/Axis.aidl index 1257687b0c..11509494fa 100644 --- a/input/common/aidl/android/hardware/input/common/Axis.aidl +++ b/input/common/aidl/android/hardware/input/common/Axis.aidl @@ -384,21 +384,4 @@ enum Axis { * The interpretation of a generic axis is device-specific. */ GENERIC_16 = 47, - - /** - * Axis constant: X gesture offset axis of a motion event. - * - * - For a touch pad, reports the distance that a swipe gesture has moved in the X - * axis, as a proportion of the touch pad's size. For example, if a touch pad is - * 1000 units wide, and a swipe gesture starts at X = 500 then moves to X = 400, - * this axis would have a value of -0.1. - */ - GESTURE_X_OFFSET = 48, - - /** - * Axis constant: Y gesture offset axis of a motion event. - * - * The same as GESTURE_X_OFFSET, but for the Y axis. - */ - GESTURE_Y_OFFSET = 49, } From c18959820fe1e85d9d0fe1a38b15b7e1b9c7d994 Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Tue, 22 Nov 2022 16:32:24 -0800 Subject: [PATCH 463/998] wifi: Add Signal polling interface to AIDL Bug: 260018485 Test: m android.hardware.wifi.supplicant-update-api Change-Id: I8cfca1b2e17c153703b524a0d6dd13199c90cdd6 --- .../wifi/supplicant/ISupplicantStaIface.aidl | 1 + .../wifi/supplicant/SignalPollResult.aidl | 42 ++++++++++++++++++ .../wifi/supplicant/ISupplicantStaIface.aidl | 12 +++++ .../wifi/supplicant/SignalPollResult.aidl | 44 +++++++++++++++++++ 4 files changed, 99 insertions(+) create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SignalPollResult.aidl create mode 100644 wifi/supplicant/aidl/android/hardware/wifi/supplicant/SignalPollResult.aidl diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl index 53d5770e7f..3740a10202 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl @@ -95,4 +95,5 @@ interface ISupplicantStaIface { void stopDppInitiator(); void stopDppResponder(in int ownBootstrapId); void stopRxFilter(); + android.hardware.wifi.supplicant.SignalPollResult[] getSignalPollResults(); } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SignalPollResult.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SignalPollResult.aidl new file mode 100644 index 0000000000..52d3f2447d --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SignalPollResult.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable SignalPollResult { + int linkId; + int currentRssiDbm; + int txBitrateMbps; + int rxBitrateMbps; + int frequencyMhz; +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl index 9edf210be8..9ceb3c0fc4 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl @@ -31,6 +31,7 @@ import android.hardware.wifi.supplicant.KeyMgmtMask; import android.hardware.wifi.supplicant.MloLinksInfo; import android.hardware.wifi.supplicant.QosPolicyStatus; import android.hardware.wifi.supplicant.RxFilterType; +import android.hardware.wifi.supplicant.SignalPollResult; import android.hardware.wifi.supplicant.WpaDriverCapabilitiesMask; import android.hardware.wifi.supplicant.WpsConfigMethods; @@ -781,4 +782,15 @@ interface ISupplicantStaIface { * |SupplicantStatusCode.FAILURE_IFACE_INVALID| */ void stopRxFilter(); + + /** + * This method returns the signal poll results. Results will be for each + * link in case of Multiple Link Operation (MLO). + * + * @return Signal Poll Results per link. + * @throws ServiceSpecificException with one of the following values: + * |SupplicantStatusCode.FAILURE_UNKNOWN| + * |SupplicantStatusCode.FAILURE_UNSUPPORTED| + */ + SignalPollResult[] getSignalPollResults(); } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/SignalPollResult.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/SignalPollResult.aidl new file mode 100644 index 0000000000..a3b11a033a --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/SignalPollResult.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ + +package android.hardware.wifi.supplicant; + +/** + * Signal polling results. + */ +@VintfStability +parcelable SignalPollResult { + /** + * Link identifier. + */ + int linkId; + /** + * RSSI value in dBM. + */ + int currentRssiDbm; + /** + * Last transmitted packet bit rate in Mbps. + */ + int txBitrateMbps; + /** + * Last received packet bit rate in Mbps. + */ + int rxBitrateMbps; + /** + * Frequency in MHz. + */ + int frequencyMhz; +} From 7a7fd84ce2d63c5df311ca21a999925d514210dc Mon Sep 17 00:00:00 2001 From: Nate Jiang Date: Tue, 6 Dec 2022 17:11:13 -0800 Subject: [PATCH 464/998] Create a snapshot of the hardware_legacy Create a snapshot of hardware_legacy for legacy HIDL, to avoid any build breakage due to new hardware_legacy for the new AIDL. Should be removed with the HIDL when we finish the switch Bug: 205044134 Test: build and CtsWifiTest Change-Id: Ib1068112f6c90f2a41b68e20027d959c95798120 --- .../default/hal_legacy/AudioHardwareBase.h | 66 + .../hal_legacy/AudioHardwareInterface.h | 296 ++ .../default/hal_legacy/AudioPolicyInterface.h | 249 ++ .../hal_legacy/AudioPolicyManagerBase.h | 567 ++++ .../default/hal_legacy/AudioSystemLegacy.h | 358 +++ wifi/1.6/default/hal_legacy/IMountService.h | 65 + .../default/hal_legacy/audio_policy_conf.h | 54 + wifi/1.6/default/hal_legacy/gscan.h | 427 +++ .../1.6/default/hal_legacy/link_layer_stats.h | 285 ++ wifi/1.6/default/hal_legacy/power.h | 40 + wifi/1.6/default/hal_legacy/roam.h | 57 + wifi/1.6/default/hal_legacy/rtt.h | 314 ++ wifi/1.6/default/hal_legacy/tdls.h | 84 + wifi/1.6/default/hal_legacy/uevent.h | 35 + .../hal_legacy/wifi_cached_scan_results.h | 92 + wifi/1.6/default/hal_legacy/wifi_config.h | 44 + wifi/1.6/default/hal_legacy/wifi_hal.h | 1020 ++++++ wifi/1.6/default/hal_legacy/wifi_logger.h | 650 ++++ wifi/1.6/default/hal_legacy/wifi_nan.h | 2726 +++++++++++++++++ wifi/1.6/default/hal_legacy/wifi_offload.h | 30 + wifi/1.6/default/hal_legacy/wifi_twt.h | 156 + wifi/1.6/default/wifi_legacy_hal.h | 2 +- wifi/1.6/default/wifi_legacy_hal_stubs.h | 2 +- 23 files changed, 7617 insertions(+), 2 deletions(-) create mode 100644 wifi/1.6/default/hal_legacy/AudioHardwareBase.h create mode 100644 wifi/1.6/default/hal_legacy/AudioHardwareInterface.h create mode 100644 wifi/1.6/default/hal_legacy/AudioPolicyInterface.h create mode 100644 wifi/1.6/default/hal_legacy/AudioPolicyManagerBase.h create mode 100644 wifi/1.6/default/hal_legacy/AudioSystemLegacy.h create mode 100644 wifi/1.6/default/hal_legacy/IMountService.h create mode 100644 wifi/1.6/default/hal_legacy/audio_policy_conf.h create mode 100644 wifi/1.6/default/hal_legacy/gscan.h create mode 100644 wifi/1.6/default/hal_legacy/link_layer_stats.h create mode 100644 wifi/1.6/default/hal_legacy/power.h create mode 100644 wifi/1.6/default/hal_legacy/roam.h create mode 100644 wifi/1.6/default/hal_legacy/rtt.h create mode 100644 wifi/1.6/default/hal_legacy/tdls.h create mode 100644 wifi/1.6/default/hal_legacy/uevent.h create mode 100644 wifi/1.6/default/hal_legacy/wifi_cached_scan_results.h create mode 100644 wifi/1.6/default/hal_legacy/wifi_config.h create mode 100644 wifi/1.6/default/hal_legacy/wifi_hal.h create mode 100644 wifi/1.6/default/hal_legacy/wifi_logger.h create mode 100644 wifi/1.6/default/hal_legacy/wifi_nan.h create mode 100644 wifi/1.6/default/hal_legacy/wifi_offload.h create mode 100644 wifi/1.6/default/hal_legacy/wifi_twt.h diff --git a/wifi/1.6/default/hal_legacy/AudioHardwareBase.h b/wifi/1.6/default/hal_legacy/AudioHardwareBase.h new file mode 100644 index 0000000000..eb61472523 --- /dev/null +++ b/wifi/1.6/default/hal_legacy/AudioHardwareBase.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2007 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. + */ + +#ifndef ANDROID_AUDIO_HARDWARE_BASE_H +#define ANDROID_AUDIO_HARDWARE_BASE_H + +#include + +#include + +namespace android_audio_legacy { + +// ---------------------------------------------------------------------------- + +/** + * AudioHardwareBase is a convenient base class used for implementing the + * AudioHardwareInterface interface. + */ +class AudioHardwareBase : public AudioHardwareInterface { + public: + AudioHardwareBase(); + virtual ~AudioHardwareBase() {} + + /** + * setMode is called when the audio mode changes. NORMAL mode is for + * standard audio playback, RINGTONE when a ringtone is playing, IN_CALL + * when a telephony call is in progress, IN_COMMUNICATION when a VoIP call is in progress. + */ + virtual status_t setMode(int mode); + + virtual status_t setParameters(const String8& keyValuePairs); + virtual String8 getParameters(const String8& keys); + + virtual size_t getInputBufferSize(uint32_t sampleRate, int format, int channelCount); + virtual status_t getMasterVolume(float* volume); + + /**This method dumps the state of the audio hardware */ + virtual status_t dumpState(int fd, const Vector& args); + + protected: + /** returns true if the given mode maps to a telephony or VoIP call is in progress */ + virtual bool isModeInCall(int mode) { + return ((mode == AudioSystem::MODE_IN_CALL) || + (mode == AudioSystem::MODE_IN_COMMUNICATION)); + }; + /** returns true if a telephony or VoIP call is in progress */ + virtual bool isInCall() { return isModeInCall(mMode); }; + int mMode; +}; + +}; // namespace android_audio_legacy + +#endif // ANDROID_AUDIO_HARDWARE_BASE_H diff --git a/wifi/1.6/default/hal_legacy/AudioHardwareInterface.h b/wifi/1.6/default/hal_legacy/AudioHardwareInterface.h new file mode 100644 index 0000000000..7befb799af --- /dev/null +++ b/wifi/1.6/default/hal_legacy/AudioHardwareInterface.h @@ -0,0 +1,296 @@ +/* + * Copyright (C) 2007 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. + */ + +#ifndef ANDROID_AUDIO_HARDWARE_INTERFACE_H +#define ANDROID_AUDIO_HARDWARE_INTERFACE_H + +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include + +#include + +namespace android_audio_legacy { +using android::String16; +using android::String8; +using android::Vector; + +// ---------------------------------------------------------------------------- + +/** + * AudioStreamOut is the abstraction interface for the audio output hardware. + * + * It provides information about various properties of the audio output hardware driver. + */ +class AudioStreamOut { + public: + virtual ~AudioStreamOut() = 0; + + /** return audio sampling rate in hz - eg. 44100 */ + virtual uint32_t sampleRate() const = 0; + + /** returns size of output buffer - eg. 4800 */ + virtual size_t bufferSize() const = 0; + + /** + * returns the output channel mask + */ + virtual uint32_t channels() const = 0; + + /** + * return audio format in 8bit or 16bit PCM format - + * eg. AudioSystem:PCM_16_BIT + */ + virtual int format() const = 0; + + /** + * return the frame size (number of bytes per sample). + */ + uint32_t frameSize() const { + return audio_channel_count_from_out_mask(channels()) * + ((format() == AUDIO_FORMAT_PCM_16_BIT) ? sizeof(int16_t) : sizeof(int8_t)); + } + + /** + * return the audio hardware driver latency in milli seconds. + */ + virtual uint32_t latency() const = 0; + + /** + * Use this method in situations where audio mixing is done in the + * hardware. This method serves as a direct interface with hardware, + * allowing you to directly set the volume as apposed to via the framework. + * This method might produce multiple PCM outputs or hardware accelerated + * codecs, such as MP3 or AAC. + */ + virtual status_t setVolume(float left, float right) = 0; + + /** write audio buffer to driver. Returns number of bytes written */ + virtual ssize_t write(const void* buffer, size_t bytes) = 0; + + /** + * Put the audio hardware output into standby mode. Returns + * status based on include/utils/Errors.h + */ + virtual status_t standby() = 0; + + /** dump the state of the audio output device */ + virtual status_t dump(int fd, const Vector& args) = 0; + + // set/get audio output parameters. The function accepts a list of parameters + // key value pairs in the form: key1=value1;key2=value2;... + // Some keys are reserved for standard parameters (See AudioParameter class). + // If the implementation does not accept a parameter change while the output is + // active but the parameter is acceptable otherwise, it must return INVALID_OPERATION. + // The audio flinger will put the output in standby and then change the parameter value. + virtual status_t setParameters(const String8& keyValuePairs) = 0; + virtual String8 getParameters(const String8& keys) = 0; + + // return the number of audio frames written by the audio dsp to DAC since + // the output has exited standby + virtual status_t getRenderPosition(uint32_t* dspFrames) = 0; + + /** + * get the local time at which the next write to the audio driver will be + * presented + */ + virtual status_t getNextWriteTimestamp(int64_t* timestamp); + + /** + * Return a recent count of the number of audio frames presented to an external observer. + */ + virtual status_t getPresentationPosition(uint64_t* frames, struct timespec* timestamp); +}; + +/** + * AudioStreamIn is the abstraction interface for the audio input hardware. + * + * It defines the various properties of the audio hardware input driver. + */ +class AudioStreamIn { + public: + virtual ~AudioStreamIn() = 0; + + /** return audio sampling rate in hz - eg. 44100 */ + virtual uint32_t sampleRate() const = 0; + + /** return the input buffer size allowed by audio driver */ + virtual size_t bufferSize() const = 0; + + /** return input channel mask */ + virtual uint32_t channels() const = 0; + + /** + * return audio format in 8bit or 16bit PCM format - + * eg. AudioSystem:PCM_16_BIT + */ + virtual int format() const = 0; + + /** + * return the frame size (number of bytes per sample). + */ + uint32_t frameSize() const { + return audio_channel_count_from_in_mask(channels()) * + ((format() == AudioSystem::PCM_16_BIT) ? sizeof(int16_t) : sizeof(int8_t)); + } + + /** set the input gain for the audio driver. This method is for + * for future use */ + virtual status_t setGain(float gain) = 0; + + /** read audio buffer in from audio driver */ + virtual ssize_t read(void* buffer, ssize_t bytes) = 0; + + /** dump the state of the audio input device */ + virtual status_t dump(int fd, const Vector& args) = 0; + + /** + * Put the audio hardware input into standby mode. Returns + * status based on include/utils/Errors.h + */ + virtual status_t standby() = 0; + + // set/get audio input parameters. The function accepts a list of parameters + // key value pairs in the form: key1=value1;key2=value2;... + // Some keys are reserved for standard parameters (See AudioParameter class). + // If the implementation does not accept a parameter change while the output is + // active but the parameter is acceptable otherwise, it must return INVALID_OPERATION. + // The audio flinger will put the input in standby and then change the parameter value. + virtual status_t setParameters(const String8& keyValuePairs) = 0; + virtual String8 getParameters(const String8& keys) = 0; + + // Return the number of input frames lost in the audio driver since the last call of this + // function. Audio driver is expected to reset the value to 0 and restart counting upon + // returning the current value by this function call. Such loss typically occurs when the user + // space process is blocked longer than the capacity of audio driver buffers. Unit: the number + // of input audio frames + virtual unsigned int getInputFramesLost() const = 0; + + virtual status_t addAudioEffect(effect_handle_t effect) = 0; + virtual status_t removeAudioEffect(effect_handle_t effect) = 0; +}; + +/** + * AudioHardwareInterface.h defines the interface to the audio hardware abstraction layer. + * + * The interface supports setting and getting parameters, selecting audio routing + * paths, and defining input and output streams. + * + * AudioFlinger initializes the audio hardware and immediately opens an output stream. + * You can set Audio routing to output to handset, speaker, Bluetooth, or a headset. + * + * The audio input stream is initialized when AudioFlinger is called to carry out + * a record operation. + */ +class AudioHardwareInterface { + public: + virtual ~AudioHardwareInterface() {} + + /** + * check to see if the audio hardware interface has been initialized. + * return status based on values defined in include/utils/Errors.h + */ + virtual status_t initCheck() = 0; + + /** set the audio volume of a voice call. Range is between 0.0 and 1.0 */ + virtual status_t setVoiceVolume(float volume) = 0; + + /** + * set the audio volume for all audio activities other than voice call. + * Range between 0.0 and 1.0. If any value other than NO_ERROR is returned, + * the software mixer will emulate this capability. + */ + virtual status_t setMasterVolume(float volume) = 0; + + /** + * Get the current master volume value for the HAL, if the HAL supports + * master volume control. AudioFlinger will query this value from the + * primary audio HAL when the service starts and use the value for setting + * the initial master volume across all HALs. + */ + virtual status_t getMasterVolume(float* volume) = 0; + + /** + * setMode is called when the audio mode changes. NORMAL mode is for + * standard audio playback, RINGTONE when a ringtone is playing, and IN_CALL + * when a call is in progress. + */ + virtual status_t setMode(int mode) = 0; + + // mic mute + virtual status_t setMicMute(bool state) = 0; + virtual status_t getMicMute(bool* state) = 0; + + // set/get global audio parameters + virtual status_t setParameters(const String8& keyValuePairs) = 0; + virtual String8 getParameters(const String8& keys) = 0; + + // Returns audio input buffer size according to parameters passed or 0 if one of the + // parameters is not supported + virtual size_t getInputBufferSize(uint32_t sampleRate, int format, int channelCount) = 0; + + /** This method creates and opens the audio hardware output stream */ + virtual AudioStreamOut* openOutputStream(uint32_t devices, int* format = 0, + uint32_t* channels = 0, uint32_t* sampleRate = 0, + status_t* status = 0) = 0; + virtual AudioStreamOut* openOutputStreamWithFlags( + uint32_t devices, audio_output_flags_t flags = (audio_output_flags_t)0, int* format = 0, + uint32_t* channels = 0, uint32_t* sampleRate = 0, status_t* status = 0) = 0; + virtual void closeOutputStream(AudioStreamOut* out) = 0; + + /** This method creates and opens the audio hardware input stream */ + virtual AudioStreamIn* openInputStream(uint32_t devices, int* format, uint32_t* channels, + uint32_t* sampleRate, status_t* status, + AudioSystem::audio_in_acoustics acoustics) = 0; + virtual void closeInputStream(AudioStreamIn* in) = 0; + + /**This method dumps the state of the audio hardware */ + virtual status_t dumpState(int fd, const Vector& args) = 0; + + virtual status_t setMasterMute(bool muted) = 0; + + static AudioHardwareInterface* create(); + + virtual int createAudioPatch(unsigned int num_sources, const struct audio_port_config* sources, + unsigned int num_sinks, const struct audio_port_config* sinks, + audio_patch_handle_t* handle) = 0; + + virtual int releaseAudioPatch(audio_patch_handle_t handle) = 0; + + virtual int getAudioPort(struct audio_port* port) = 0; + + virtual int setAudioPortConfig(const struct audio_port_config* config) = 0; + + protected: + virtual status_t dump(int fd, const Vector& args) = 0; +}; + +// ---------------------------------------------------------------------------- + +extern "C" AudioHardwareInterface* createAudioHardware(void); + +}; // namespace android_audio_legacy + +#endif // ANDROID_AUDIO_HARDWARE_INTERFACE_H diff --git a/wifi/1.6/default/hal_legacy/AudioPolicyInterface.h b/wifi/1.6/default/hal_legacy/AudioPolicyInterface.h new file mode 100644 index 0000000000..ec9c432cdb --- /dev/null +++ b/wifi/1.6/default/hal_legacy/AudioPolicyInterface.h @@ -0,0 +1,249 @@ +/* + * Copyright (C) 2009 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. + */ + +#ifndef ANDROID_AUDIOPOLICYINTERFACE_H +#define ANDROID_AUDIOPOLICYINTERFACE_H + +#include +#include +#include + +#include +#include + +namespace android_audio_legacy { +using android::String8; +using android::ToneGenerator; +using android::Vector; + +// ---------------------------------------------------------------------------- + +// The AudioPolicyInterface and AudioPolicyClientInterface classes define the communication +// interfaces between the platform specific audio policy manager and Android generic audio policy +// manager. The platform specific audio policy manager must implement methods of the +// AudioPolicyInterface class. This implementation makes use of the AudioPolicyClientInterface to +// control the activity and configuration of audio input and output streams. +// +// The platform specific audio policy manager is in charge of the audio routing and volume control +// policies for a given platform. +// The main roles of this module are: +// - keep track of current system state (removable device connections, phone state, user +// requests...). System state changes and user actions are notified to audio policy manager with +// methods of the AudioPolicyInterface. +// - process getOutput() queries received when AudioTrack objects are created: Those queries +// return a handler on an output that has been selected, configured and opened by the audio policy +// manager and that must be used by the AudioTrack when registering to the AudioFlinger with the +// createTrack() method. When the AudioTrack object is released, a putOutput() query is received +// and the audio policy manager can decide to close or reconfigure the output depending on other +// streams using this output and current system state. +// - similarly process getInput() and putInput() queries received from AudioRecord objects and +// configure audio inputs. +// - process volume control requests: the stream volume is converted from an index value (received +// from UI) to a float value applicable to each output as a function of platform specific settings +// and current output route (destination device). It also make sure that streams are not muted if +// not allowed (e.g. camera shutter sound in some countries). +// +// The platform specific audio policy manager is provided as a shared library by platform vendors +// (as for libaudio.so) and is linked with libaudioflinger.so + +// Audio Policy Manager Interface +class AudioPolicyInterface { + public: + virtual ~AudioPolicyInterface() {} + // + // configuration functions + // + + // indicate a change in device connection status + virtual status_t setDeviceConnectionState(audio_devices_t device, + AudioSystem::device_connection_state state, + const char* device_address) = 0; + // retrieve a device connection status + virtual AudioSystem::device_connection_state getDeviceConnectionState( + audio_devices_t device, const char* device_address) = 0; + // indicate a change in phone state. Valid phones states are defined by AudioSystem::audio_mode + virtual void setPhoneState(int state) = 0; + // force using a specific device category for the specified usage + virtual void setForceUse(AudioSystem::force_use usage, AudioSystem::forced_config config) = 0; + // retrieve current device category forced for a given usage + virtual AudioSystem::forced_config getForceUse(AudioSystem::force_use usage) = 0; + // set a system property (e.g. camera sound always audible) + virtual void setSystemProperty(const char* property, const char* value) = 0; + // check proper initialization + virtual status_t initCheck() = 0; + + // + // Audio routing query functions + // + + // request an output appropriate for playback of the supplied stream type and parameters + virtual audio_io_handle_t getOutput(AudioSystem::stream_type stream, uint32_t samplingRate, + audio_format_t format, audio_channel_mask_t channelMask, + AudioSystem::output_flags flags, + const audio_offload_info_t* offloadInfo) = 0; + // indicates to the audio policy manager that the output starts being used by corresponding + // stream. + virtual status_t startOutput(audio_io_handle_t output, AudioSystem::stream_type stream, + audio_session_t session = AUDIO_SESSION_NONE) = 0; + // indicates to the audio policy manager that the output stops being used by corresponding + // stream. + virtual status_t stopOutput(audio_io_handle_t output, AudioSystem::stream_type stream, + audio_session_t session = AUDIO_SESSION_NONE) = 0; + // releases the output. + virtual void releaseOutput(audio_io_handle_t output) = 0; + + // request an input appropriate for record from the supplied device with supplied parameters. + virtual audio_io_handle_t getInput(int inputSource, uint32_t samplingRate, + audio_format_t format, audio_channel_mask_t channelMask, + AudioSystem::audio_in_acoustics acoustics) = 0; + // indicates to the audio policy manager that the input starts being used. + virtual status_t startInput(audio_io_handle_t input) = 0; + // indicates to the audio policy manager that the input stops being used. + virtual status_t stopInput(audio_io_handle_t input) = 0; + // releases the input. + virtual void releaseInput(audio_io_handle_t input) = 0; + + // + // volume control functions + // + + // initialises stream volume conversion parameters by specifying volume index range. + virtual void initStreamVolume(AudioSystem::stream_type stream, int indexMin, int indexMax) = 0; + + // sets the new stream volume at a level corresponding to the supplied index for the + // supplied device. By convention, specifying AUDIO_DEVICE_OUT_DEFAULT means + // setting volume for all devices + virtual status_t setStreamVolumeIndex(AudioSystem::stream_type stream, int index, + audio_devices_t device) = 0; + + // retrieve current volume index for the specified stream and the + // specified device. By convention, specifying AUDIO_DEVICE_OUT_DEFAULT means + // querying the volume of the active device. + virtual status_t getStreamVolumeIndex(AudioSystem::stream_type stream, int* index, + audio_devices_t device) = 0; + + // return the strategy corresponding to a given stream type + virtual uint32_t getStrategyForStream(AudioSystem::stream_type stream) = 0; + + // return the enabled output devices for the given stream type + virtual audio_devices_t getDevicesForStream(AudioSystem::stream_type stream) = 0; + + // Audio effect management + virtual audio_io_handle_t getOutputForEffect(const effect_descriptor_t* desc) = 0; + virtual status_t registerEffect(const effect_descriptor_t* desc, audio_io_handle_t io, + uint32_t strategy, audio_session_t session, int id) = 0; + virtual status_t unregisterEffect(int id) = 0; + virtual status_t setEffectEnabled(int id, bool enabled) = 0; + + virtual bool isStreamActive(int stream, uint32_t inPastMs = 0) const = 0; + virtual bool isStreamActiveRemotely(int stream, uint32_t inPastMs = 0) const = 0; + virtual bool isSourceActive(audio_source_t source) const = 0; + + // dump state + virtual status_t dump(int fd) = 0; + + virtual bool isOffloadSupported(const audio_offload_info_t& offloadInfo) = 0; +}; + +// Audio Policy client Interface +class AudioPolicyClientInterface { + public: + virtual ~AudioPolicyClientInterface() {} + + // + // Audio HW module functions + // + + // loads a HW module. + virtual audio_module_handle_t loadHwModule(const char* name) = 0; + + // + // Audio output Control functions + // + + // opens an audio output with the requested parameters. The parameter values can indicate to use + // the default values in case the audio policy manager has no specific requirements for the + // output being opened. When the function returns, the parameter values reflect the actual + // values used by the audio hardware output stream. The audio policy manager can check if the + // proposed parameters are suitable or not and act accordingly. + virtual audio_io_handle_t openOutput(audio_module_handle_t module, audio_devices_t* pDevices, + uint32_t* pSamplingRate, audio_format_t* pFormat, + audio_channel_mask_t* pChannelMask, uint32_t* pLatencyMs, + audio_output_flags_t flags, + const audio_offload_info_t* offloadInfo = NULL) = 0; + // creates a special output that is duplicated to the two outputs passed as arguments. The + // duplication is performed by a special mixer thread in the AudioFlinger. + virtual audio_io_handle_t openDuplicateOutput(audio_io_handle_t output1, + audio_io_handle_t output2) = 0; + // closes the output stream + virtual status_t closeOutput(audio_io_handle_t output) = 0; + // suspends the output. When an output is suspended, the corresponding audio hardware output + // stream is placed in standby and the AudioTracks attached to the mixer thread are still + // processed but the output mix is discarded. + virtual status_t suspendOutput(audio_io_handle_t output) = 0; + // restores a suspended output. + virtual status_t restoreOutput(audio_io_handle_t output) = 0; + + // + // Audio input Control functions + // + + // opens an audio input + virtual audio_io_handle_t openInput(audio_module_handle_t module, audio_devices_t* pDevices, + uint32_t* pSamplingRate, audio_format_t* pFormat, + audio_channel_mask_t* pChannelMask) = 0; + // closes an audio input + virtual status_t closeInput(audio_io_handle_t input) = 0; + // + // misc control functions + // + + // set a stream volume for a particular output. For the same user setting, a given stream type + // can have different volumes for each output (destination device) it is attached to. + virtual status_t setStreamVolume(AudioSystem::stream_type stream, float volume, + audio_io_handle_t output, int delayMs = 0) = 0; + + // invalidate a stream type, causing a reroute to an unspecified new output + virtual status_t invalidateStream(AudioSystem::stream_type stream) = 0; + + // function enabling to send proprietary informations directly from audio policy manager to + // audio hardware interface. + virtual void setParameters(audio_io_handle_t ioHandle, const String8& keyValuePairs, + int delayMs = 0) = 0; + // function enabling to receive proprietary informations directly from audio hardware interface + // to audio policy manager. + virtual String8 getParameters(audio_io_handle_t ioHandle, const String8& keys) = 0; + + // request the playback of a tone on the specified stream: used for instance to replace + // notification sounds when playing over a telephony device during a phone call. + virtual status_t startTone(ToneGenerator::tone_type tone, AudioSystem::stream_type stream) = 0; + virtual status_t stopTone() = 0; + + // set down link audio volume. + virtual status_t setVoiceVolume(float volume, int delayMs = 0) = 0; + + // move effect to the specified output + virtual status_t moveEffects(audio_session_t session, audio_io_handle_t srcOutput, + audio_io_handle_t dstOutput) = 0; +}; + +extern "C" AudioPolicyInterface* createAudioPolicyManager( + AudioPolicyClientInterface* clientInterface); +extern "C" void destroyAudioPolicyManager(AudioPolicyInterface* interface); + +}; // namespace android_audio_legacy + +#endif // ANDROID_AUDIOPOLICYINTERFACE_H diff --git a/wifi/1.6/default/hal_legacy/AudioPolicyManagerBase.h b/wifi/1.6/default/hal_legacy/AudioPolicyManagerBase.h new file mode 100644 index 0000000000..ccc0d32632 --- /dev/null +++ b/wifi/1.6/default/hal_legacy/AudioPolicyManagerBase.h @@ -0,0 +1,567 @@ +/* + * Copyright (C) 2009 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace android_audio_legacy { +using android::DefaultKeyedVector; +using android::KeyedVector; +using android::SortedVector; + +// ---------------------------------------------------------------------------- + +#define MAX_DEVICE_ADDRESS_LEN 20 +// Attenuation applied to STRATEGY_SONIFICATION streams when a headset is connected: 6dB +#define SONIFICATION_HEADSET_VOLUME_FACTOR 0.5 +// Min volume for STRATEGY_SONIFICATION streams when limited by music volume: -36dB +#define SONIFICATION_HEADSET_VOLUME_MIN 0.016 +// Time in milliseconds during which we consider that music is still active after a music +// track was stopped - see computeVolume() +#define SONIFICATION_HEADSET_MUSIC_DELAY 5000 +// Time in milliseconds after media stopped playing during which we consider that the +// sonification should be as unobtrusive as during the time media was playing. +#define SONIFICATION_RESPECTFUL_AFTER_MUSIC_DELAY 5000 +// Time in milliseconds during witch some streams are muted while the audio path +// is switched +#define MUTE_TIME_MS 2000 + +#define NUM_TEST_OUTPUTS 5 + +#define NUM_VOL_CURVE_KNEES 2 + +// Default minimum length allowed for offloading a compressed track +// Can be overridden by the audio.offload.min.duration.secs property +#define OFFLOAD_DEFAULT_MIN_DURATION_SECS 60 + +// ---------------------------------------------------------------------------- +// AudioPolicyManagerBase implements audio policy manager behavior common to all platforms. +// Each platform must implement an AudioPolicyManager class derived from AudioPolicyManagerBase +// and override methods for which the platform specific behavior differs from the implementation +// in AudioPolicyManagerBase. Even if no specific behavior is required, the AudioPolicyManager +// class must be implemented as well as the class factory function createAudioPolicyManager() +// and provided in a shared library libaudiopolicy.so. +// ---------------------------------------------------------------------------- + +class AudioPolicyManagerBase : public AudioPolicyInterface +#ifdef AUDIO_POLICY_TEST + , + public Thread +#endif // AUDIO_POLICY_TEST +{ + + public: + AudioPolicyManagerBase(AudioPolicyClientInterface* clientInterface); + virtual ~AudioPolicyManagerBase(); + + // AudioPolicyInterface + virtual status_t setDeviceConnectionState(audio_devices_t device, + AudioSystem::device_connection_state state, + const char* device_address); + virtual AudioSystem::device_connection_state getDeviceConnectionState( + audio_devices_t device, const char* device_address); + virtual void setPhoneState(int state); + virtual void setForceUse(AudioSystem::force_use usage, AudioSystem::forced_config config); + virtual AudioSystem::forced_config getForceUse(AudioSystem::force_use usage); + virtual void setSystemProperty(const char* property, const char* value); + virtual status_t initCheck(); + virtual audio_io_handle_t getOutput(AudioSystem::stream_type stream, uint32_t samplingRate, + audio_format_t format, audio_channel_mask_t channelMask, + AudioSystem::output_flags flags, + const audio_offload_info_t* offloadInfo); + virtual status_t startOutput(audio_io_handle_t output, AudioSystem::stream_type stream, + audio_session_t session = AUDIO_SESSION_NONE); + virtual status_t stopOutput(audio_io_handle_t output, AudioSystem::stream_type stream, + audio_session_t session = AUDIO_SESSION_NONE); + virtual void releaseOutput(audio_io_handle_t output); + virtual audio_io_handle_t getInput(int inputSource, uint32_t samplingRate, + audio_format_t format, audio_channel_mask_t channelMask, + AudioSystem::audio_in_acoustics acoustics); + + // indicates to the audio policy manager that the input starts being used. + virtual status_t startInput(audio_io_handle_t input); + + // indicates to the audio policy manager that the input stops being used. + virtual status_t stopInput(audio_io_handle_t input); + virtual void releaseInput(audio_io_handle_t input); + virtual void closeAllInputs(); + virtual void initStreamVolume(AudioSystem::stream_type stream, int indexMin, int indexMax); + virtual status_t setStreamVolumeIndex(AudioSystem::stream_type stream, int index, + audio_devices_t device); + virtual status_t getStreamVolumeIndex(AudioSystem::stream_type stream, int* index, + audio_devices_t device); + + // return the strategy corresponding to a given stream type + virtual uint32_t getStrategyForStream(AudioSystem::stream_type stream); + + // return the enabled output devices for the given stream type + virtual audio_devices_t getDevicesForStream(AudioSystem::stream_type stream); + + virtual audio_io_handle_t getOutputForEffect(const effect_descriptor_t* desc = NULL); + virtual status_t registerEffect(const effect_descriptor_t* desc, audio_io_handle_t io, + uint32_t strategy, audio_session_t session, int id); + virtual status_t unregisterEffect(int id); + virtual status_t setEffectEnabled(int id, bool enabled); + + virtual bool isStreamActive(int stream, uint32_t inPastMs = 0) const; + // return whether a stream is playing remotely, override to change the definition of + // local/remote playback, used for instance by notification manager to not make + // media players lose audio focus when not playing locally + virtual bool isStreamActiveRemotely(int stream, uint32_t inPastMs = 0) const; + virtual bool isSourceActive(audio_source_t source) const; + + virtual status_t dump(int fd); + + virtual bool isOffloadSupported(const audio_offload_info_t& offloadInfo); + + protected: + enum routing_strategy { + STRATEGY_MEDIA, + STRATEGY_PHONE, + STRATEGY_SONIFICATION, + STRATEGY_SONIFICATION_RESPECTFUL, + STRATEGY_DTMF, + STRATEGY_ENFORCED_AUDIBLE, + NUM_STRATEGIES + }; + + // 4 points to define the volume attenuation curve, each characterized by the volume + // index (from 0 to 100) at which they apply, and the attenuation in dB at that index. + // we use 100 steps to avoid rounding errors when computing the volume in volIndexToAmpl() + + enum { VOLMIN = 0, VOLKNEE1 = 1, VOLKNEE2 = 2, VOLMAX = 3, VOLCNT = 4 }; + + class VolumeCurvePoint { + public: + int mIndex; + float mDBAttenuation; + }; + + // device categories used for volume curve management. + enum device_category { + DEVICE_CATEGORY_HEADSET, + DEVICE_CATEGORY_SPEAKER, + DEVICE_CATEGORY_EARPIECE, + DEVICE_CATEGORY_CNT + }; + + class IOProfile; + + class HwModule { + public: + HwModule(const char* name); + ~HwModule(); + + void dump(int fd); + + const char* const mName; // base name of the audio HW module (primary, a2dp ...) + audio_module_handle_t mHandle; + Vector mOutputProfiles; // output profiles exposed by this module + Vector mInputProfiles; // input profiles exposed by this module + }; + + // the IOProfile class describes the capabilities of an output or input stream. + // It is currently assumed that all combination of listed parameters are supported. + // It is used by the policy manager to determine if an output or input is suitable for + // a given use case, open/close it accordingly and connect/disconnect audio tracks + // to/from it. + class IOProfile { + public: + IOProfile(HwModule* module); + ~IOProfile(); + + bool isCompatibleProfile(audio_devices_t device, uint32_t samplingRate, + audio_format_t format, audio_channel_mask_t channelMask, + audio_output_flags_t flags) const; + + void dump(int fd); + void log(); + + // by convention, "0' in the first entry in mSamplingRates, mChannelMasks or mFormats + // indicates the supported parameters should be read from the output stream + // after it is opened for the first time + Vector mSamplingRates; // supported sampling rates + Vector mChannelMasks; // supported channel masks + Vector mFormats; // supported audio formats + audio_devices_t mSupportedDevices; // supported devices (devices this output can be + // routed to) + audio_output_flags_t mFlags; // attribute flags (e.g primary output, + // direct output...). For outputs only. + HwModule* mModule; // audio HW module exposing this I/O stream + }; + + // default volume curve + static const VolumeCurvePoint sDefaultVolumeCurve[AudioPolicyManagerBase::VOLCNT]; + // default volume curve for media strategy + static const VolumeCurvePoint sDefaultMediaVolumeCurve[AudioPolicyManagerBase::VOLCNT]; + // volume curve for media strategy on speakers + static const VolumeCurvePoint sSpeakerMediaVolumeCurve[AudioPolicyManagerBase::VOLCNT]; + // volume curve for sonification strategy on speakers + static const VolumeCurvePoint sSpeakerSonificationVolumeCurve[AudioPolicyManagerBase::VOLCNT]; + static const VolumeCurvePoint + sSpeakerSonificationVolumeCurveDrc[AudioPolicyManagerBase::VOLCNT]; + static const VolumeCurvePoint sDefaultSystemVolumeCurve[AudioPolicyManagerBase::VOLCNT]; + static const VolumeCurvePoint sDefaultSystemVolumeCurveDrc[AudioPolicyManagerBase::VOLCNT]; + static const VolumeCurvePoint sHeadsetSystemVolumeCurve[AudioPolicyManagerBase::VOLCNT]; + static const VolumeCurvePoint sDefaultVoiceVolumeCurve[AudioPolicyManagerBase::VOLCNT]; + static const VolumeCurvePoint sSpeakerVoiceVolumeCurve[AudioPolicyManagerBase::VOLCNT]; + // default volume curves per stream and device category. See initializeVolumeCurves() + static const VolumeCurvePoint* sVolumeProfiles[AudioSystem::NUM_STREAM_TYPES] + [DEVICE_CATEGORY_CNT]; + + // descriptor for audio outputs. Used to maintain current configuration of each opened audio + // output and keep track of the usage of this output by each audio stream type. + class AudioOutputDescriptor { + public: + AudioOutputDescriptor(const IOProfile* profile); + + status_t dump(int fd); + + audio_devices_t device() const; + void changeRefCount(AudioSystem::stream_type stream, int delta); + + bool isDuplicated() const { return (mOutput1 != NULL && mOutput2 != NULL); } + audio_devices_t supportedDevices(); + uint32_t latency(); + bool sharesHwModuleWith(const AudioOutputDescriptor* outputDesc); + bool isActive(uint32_t inPastMs = 0) const; + bool isStreamActive(AudioSystem::stream_type stream, uint32_t inPastMs = 0, + nsecs_t sysTime = 0) const; + bool isStrategyActive(routing_strategy strategy, uint32_t inPastMs = 0, + nsecs_t sysTime = 0) const; + + audio_io_handle_t mId; // output handle + uint32_t mSamplingRate; // + audio_format_t mFormat; // + audio_channel_mask_t mChannelMask; // output configuration + uint32_t mLatency; // + audio_output_flags_t mFlags; // + audio_devices_t mDevice; // current device this output is routed to + uint32_t mRefCount[AudioSystem::NUM_STREAM_TYPES]; // number of streams of each type using + // this output + nsecs_t mStopTime[AudioSystem::NUM_STREAM_TYPES]; + AudioOutputDescriptor* mOutput1; // used by duplicated outputs: first output + AudioOutputDescriptor* mOutput2; // used by duplicated outputs: second output + float mCurVolume[AudioSystem::NUM_STREAM_TYPES]; // current stream volume + int mMuteCount[AudioSystem::NUM_STREAM_TYPES]; // mute request counter + const IOProfile* mProfile; // I/O profile this output derives from + bool mStrategyMutedByDevice[NUM_STRATEGIES]; // strategies muted because of incompatible + // device selection. See + // checkDeviceMuteStrategies() + uint32_t mDirectOpenCount; // number of clients using this output (direct outputs only) + bool mForceRouting; // Next routing for this output will be forced as current device routed + // is null + }; + + // descriptor for audio inputs. Used to maintain current configuration of each opened audio + // input and keep track of the usage of this input. + class AudioInputDescriptor { + public: + AudioInputDescriptor(const IOProfile* profile); + + status_t dump(int fd); + + audio_io_handle_t mId; // input handle + uint32_t mSamplingRate; // + audio_format_t mFormat; // input configuration + audio_channel_mask_t mChannelMask; // + audio_devices_t mDevice; // current device this input is routed to + uint32_t mRefCount; // number of AudioRecord clients using this output + int mInputSource; // input source selected by application (mediarecorder.h) + const IOProfile* mProfile; // I/O profile this output derives from + }; + + // stream descriptor used for volume control + class StreamDescriptor { + public: + StreamDescriptor(); + + int getVolumeIndex(audio_devices_t device); + void dump(int fd); + + int mIndexMin; // min volume index + int mIndexMax; // max volume index + KeyedVector mIndexCur; // current volume index per device + bool mCanBeMuted; // true is the stream can be muted + + const VolumeCurvePoint* mVolumeCurve[DEVICE_CATEGORY_CNT]; + }; + + // stream descriptor used for volume control + class EffectDescriptor { + public: + status_t dump(int fd); + + int mIo; // io the effect is attached to + routing_strategy mStrategy; // routing strategy the effect is associated to + audio_session_t mSession; // audio session the effect is on + effect_descriptor_t mDesc; // effect descriptor + bool mEnabled; // enabled state: CPU load being used or not + }; + + void addOutput(audio_io_handle_t id, AudioOutputDescriptor* outputDesc); + void addInput(audio_io_handle_t id, AudioInputDescriptor* inputDesc); + + // return the strategy corresponding to a given stream type + static routing_strategy getStrategy(AudioSystem::stream_type stream); + + // return appropriate device for streams handled by the specified strategy according to current + // phone state, connected devices... + // if fromCache is true, the device is returned from mDeviceForStrategy[], + // otherwise it is determine by current state + // (device connected,phone state, force use, a2dp output...) + // This allows to: + // 1 speed up process when the state is stable (when starting or stopping an output) + // 2 access to either current device selection (fromCache == true) or + // "future" device selection (fromCache == false) when called from a context + // where conditions are changing (setDeviceConnectionState(), setPhoneState()...) AND + // before updateDevicesAndOutputs() is called. + virtual audio_devices_t getDeviceForStrategy(routing_strategy strategy, bool fromCache); + + // change the route of the specified output. Returns the number of ms we have slept to + // allow new routing to take effect in certain cases. + uint32_t setOutputDevice(audio_io_handle_t output, audio_devices_t device, bool force = false, + int delayMs = 0); + + // select input device corresponding to requested audio source + virtual audio_devices_t getDeviceForInputSource(int inputSource); + + // return io handle of active input or 0 if no input is active + // Only considers inputs from physical devices (e.g. main mic, headset mic) when + // ignoreVirtualInputs is true. + audio_io_handle_t getActiveInput(bool ignoreVirtualInputs = true); + + // initialize volume curves for each strategy and device category + void initializeVolumeCurves(); + + // compute the actual volume for a given stream according to the requested index and a + // particular device + virtual float computeVolume(int stream, int index, audio_io_handle_t output, + audio_devices_t device); + + // check that volume change is permitted, compute and send new volume to audio hardware + status_t checkAndSetVolume(int stream, int index, audio_io_handle_t output, + audio_devices_t device, int delayMs = 0, bool force = false); + + // apply all stream volumes to the specified output and device + void applyStreamVolumes(audio_io_handle_t output, audio_devices_t device, int delayMs = 0, + bool force = false); + + // Mute or unmute all streams handled by the specified strategy on the specified output + void setStrategyMute(routing_strategy strategy, bool on, audio_io_handle_t output, + int delayMs = 0, audio_devices_t device = (audio_devices_t)0); + + // Mute or unmute the stream on the specified output + void setStreamMute(int stream, bool on, audio_io_handle_t output, int delayMs = 0, + audio_devices_t device = (audio_devices_t)0); + + // handle special cases for sonification strategy while in call: mute streams or replace by + // a special tone in the device used for communication + void handleIncallSonification(int stream, bool starting, bool stateChange); + + // true if device is in a telephony or VoIP call + virtual bool isInCall(); + + // true if given state represents a device in a telephony or VoIP call + virtual bool isStateInCall(int state); + + // when a device is connected, checks if an open output can be routed + // to this device. If none is open, tries to open one of the available outputs. + // Returns an output suitable to this device or 0. + // when a device is disconnected, checks if an output is not used any more and + // returns its handle if any. + // transfers the audio tracks and effects from one output thread to another accordingly. + status_t checkOutputsForDevice(audio_devices_t device, + AudioSystem::device_connection_state state, + SortedVector& outputs, + const String8 paramStr); + + status_t checkInputsForDevice(audio_devices_t device, + AudioSystem::device_connection_state state, + SortedVector& inputs, const String8 paramStr); + + // close an output and its companion duplicating output. + void closeOutput(audio_io_handle_t output); + + // checks and if necessary changes outputs used for all strategies. + // must be called every time a condition that affects the output choice for a given strategy + // changes: connected device, phone state, force use... + // Must be called before updateDevicesAndOutputs() + void checkOutputForStrategy(routing_strategy strategy); + + // Same as checkOutputForStrategy() but for a all strategies in order of priority + void checkOutputForAllStrategies(); + + // manages A2DP output suspend/restore according to phone state and BT SCO usage + void checkA2dpSuspend(); + + // returns the A2DP output handle if it is open or 0 otherwise + audio_io_handle_t getA2dpOutput(); + + // selects the most appropriate device on output for current state + // must be called every time a condition that affects the device choice for a given output is + // changed: connected device, phone state, force use, output start, output stop.. + // see getDeviceForStrategy() for the use of fromCache parameter + + audio_devices_t getNewDevice(audio_io_handle_t output, bool fromCache); + // updates cache of device used by all strategies (mDeviceForStrategy[]) + // must be called every time a condition that affects the device choice for a given strategy is + // changed: connected device, phone state, force use... + // cached values are used by getDeviceForStrategy() if parameter fromCache is true. + // Must be called after checkOutputForAllStrategies() + + void updateDevicesAndOutputs(); + + virtual uint32_t getMaxEffectsCpuLoad(); + virtual uint32_t getMaxEffectsMemory(); +#ifdef AUDIO_POLICY_TEST + virtual bool threadLoop(); + void exit(); + int testOutputIndex(audio_io_handle_t output); +#endif // AUDIO_POLICY_TEST + + status_t setEffectEnabled(EffectDescriptor* pDesc, bool enabled); + + // returns the category the device belongs to with regard to volume curve management + static device_category getDeviceCategory(audio_devices_t device); + + // extract one device relevant for volume control from multiple device selection + static audio_devices_t getDeviceForVolume(audio_devices_t device); + + SortedVector getOutputsForDevice( + audio_devices_t device, + DefaultKeyedVector openOutputs); + bool vectorsEqual(SortedVector& outputs1, + SortedVector& outputs2); + + // mute/unmute strategies using an incompatible device combination + // if muting, wait for the audio in pcm buffer to be drained before proceeding + // if unmuting, unmute only after the specified delay + // Returns the number of ms waited + uint32_t checkDeviceMuteStrategies(AudioOutputDescriptor* outputDesc, + audio_devices_t prevDevice, uint32_t delayMs); + + audio_io_handle_t selectOutput(const SortedVector& outputs, + AudioSystem::output_flags flags); + IOProfile* getInputProfile(audio_devices_t device, uint32_t samplingRate, audio_format_t format, + audio_channel_mask_t channelMask); + IOProfile* getProfileForDirectOutput(audio_devices_t device, uint32_t samplingRate, + audio_format_t format, audio_channel_mask_t channelMask, + audio_output_flags_t flags); + + audio_io_handle_t selectOutputForEffects(const SortedVector& outputs); + + bool isNonOffloadableEffectEnabled(); + + // + // Audio policy configuration file parsing (audio_policy.conf) + // + static uint32_t stringToEnum(const struct StringToEnum* table, size_t size, const char* name); + static bool stringToBool(const char* value); + static audio_output_flags_t parseFlagNames(char* name); + static audio_devices_t parseDeviceNames(char* name); + void loadSamplingRates(char* name, IOProfile* profile); + void loadFormats(char* name, IOProfile* profile); + void loadOutChannels(char* name, IOProfile* profile); + void loadInChannels(char* name, IOProfile* profile); + status_t loadOutput(cnode* root, HwModule* module); + status_t loadInput(cnode* root, HwModule* module); + void loadHwModule(cnode* root); + void loadHwModules(cnode* root); + void loadGlobalConfig(cnode* root); + status_t loadAudioPolicyConfig(const char* path); + void defaultAudioPolicyConfig(void); + + AudioPolicyClientInterface* mpClientInterface; // audio policy client interface + audio_io_handle_t mPrimaryOutput; // primary output handle + // list of descriptors for outputs currently opened + DefaultKeyedVector mOutputs; + // copy of mOutputs before setDeviceConnectionState() opens new outputs + // reset to mOutputs when updateDevicesAndOutputs() is called. + DefaultKeyedVector mPreviousOutputs; + + // list of input descriptors currently opened + DefaultKeyedVector mInputs; + + audio_devices_t mAvailableOutputDevices; // bit field of all available output devices + audio_devices_t mAvailableInputDevices; // bit field of all available input devices + // without AUDIO_DEVICE_BIT_IN to allow direct bit + // field comparisons + int mPhoneState; // current phone state + AudioSystem::forced_config + mForceUse[AudioSystem::NUM_FORCE_USE]; // current forced use configuration + + StreamDescriptor + mStreams[AudioSystem::NUM_STREAM_TYPES]; // stream descriptors for volume control + String8 mA2dpDeviceAddress; // A2DP device MAC address + String8 mScoDeviceAddress; // SCO device MAC address + String8 mUsbOutCardAndDevice; // USB audio ALSA card and device numbers: + // card=;device=<> + bool mLimitRingtoneVolume; // limit ringtone volume to music volume if headset connected + audio_devices_t mDeviceForStrategy[NUM_STRATEGIES]; + float mLastVoiceVolume; // last voice volume value sent to audio HAL + + // Maximum CPU load allocated to audio effects in 0.1 MIPS (ARMv5TE, 0 WS memory) units + static const uint32_t MAX_EFFECTS_CPU_LOAD = 1000; + // Maximum memory allocated to audio effects in KB + static const uint32_t MAX_EFFECTS_MEMORY = 512; + uint32_t mTotalEffectsCpuLoad; // current CPU load used by effects + uint32_t mTotalEffectsMemory; // current memory used by effects + KeyedVector mEffects; // list of registered audio effects + bool mA2dpSuspended; // true if A2DP output is suspended + bool mHasA2dp; // true on platforms with support for bluetooth A2DP + bool mHasUsb; // true on platforms with support for USB audio + bool mHasRemoteSubmix; // true on platforms with support for remote presentation of a submix + audio_devices_t mAttachedOutputDevices; // output devices always available on the platform + audio_devices_t mDefaultOutputDevice; // output device selected by default at boot time + // (must be in mAttachedOutputDevices) + bool mSpeakerDrcEnabled; // true on devices that use DRC on the DEVICE_CATEGORY_SPEAKER path + // to boost soft sounds, used to adjust volume curves accordingly + + Vector mHwModules; + +#ifdef AUDIO_POLICY_TEST + Mutex mLock; + Condition mWaitWorkCV; + + int mCurOutput; + bool mDirectOutput; + audio_io_handle_t mTestOutputs[NUM_TEST_OUTPUTS]; + int mTestInput; + uint32_t mTestDevice; + uint32_t mTestSamplingRate; + uint32_t mTestFormat; + uint32_t mTestChannels; + uint32_t mTestLatencyMs; +#endif // AUDIO_POLICY_TEST + + private: + static float volIndexToAmpl(audio_devices_t device, const StreamDescriptor& streamDesc, + int indexInUi); + // updates device caching and output for streams that can influence the + // routing of notifications + void handleNotificationRoutingForStream(AudioSystem::stream_type stream); + static bool isVirtualInputDevice(audio_devices_t device); +}; + +}; // namespace android_audio_legacy diff --git a/wifi/1.6/default/hal_legacy/AudioSystemLegacy.h b/wifi/1.6/default/hal_legacy/AudioSystemLegacy.h new file mode 100644 index 0000000000..943b0db944 --- /dev/null +++ b/wifi/1.6/default/hal_legacy/AudioSystemLegacy.h @@ -0,0 +1,358 @@ +/* + * Copyright (C) 2008 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. + */ + +#ifndef ANDROID_AUDIOSYSTEM_LEGACY_H_ +#define ANDROID_AUDIOSYSTEM_LEGACY_H_ + +#include +#include +#include + +#include +#include + +namespace android_audio_legacy { + +using android::AudioParameter; +using android::status_t; + +enum { + OK = android::OK, + NO_ERROR = android::NO_ERROR, + + UNKNOWN_ERROR = android::UNKNOWN_ERROR, + + NO_MEMORY = android::NO_MEMORY, + INVALID_OPERATION = android::INVALID_OPERATION, + BAD_VALUE = android::BAD_VALUE, + BAD_TYPE = android::BAD_TYPE, + NAME_NOT_FOUND = android::NAME_NOT_FOUND, + PERMISSION_DENIED = android::PERMISSION_DENIED, + NO_INIT = android::NO_INIT, + ALREADY_EXISTS = android::ALREADY_EXISTS, + DEAD_OBJECT = android::DEAD_OBJECT, + FAILED_TRANSACTION = android::FAILED_TRANSACTION, + BAD_INDEX = android::BAD_INDEX, + NOT_ENOUGH_DATA = android::NOT_ENOUGH_DATA, + WOULD_BLOCK = android::WOULD_BLOCK, + TIMED_OUT = android::TIMED_OUT, + UNKNOWN_TRANSACTION = android::UNKNOWN_TRANSACTION, +}; + +enum audio_source { + AUDIO_SOURCE_DEFAULT = 0, + AUDIO_SOURCE_MIC = 1, + AUDIO_SOURCE_VOICE_UPLINK = 2, + AUDIO_SOURCE_VOICE_DOWNLINK = 3, + AUDIO_SOURCE_VOICE_CALL = 4, + AUDIO_SOURCE_CAMCORDER = 5, + AUDIO_SOURCE_VOICE_RECOGNITION = 6, + AUDIO_SOURCE_VOICE_COMMUNICATION = 7, + AUDIO_SOURCE_MAX = AUDIO_SOURCE_VOICE_COMMUNICATION, + + AUDIO_SOURCE_LIST_END // must be last - used to validate audio source type +}; + +class AudioSystem { + public: +#if 1 + enum stream_type { + DEFAULT = -1, + VOICE_CALL = 0, + SYSTEM = 1, + RING = 2, + MUSIC = 3, + ALARM = 4, + NOTIFICATION = 5, + BLUETOOTH_SCO = 6, + ENFORCED_AUDIBLE = 7, // Sounds that cannot be muted by user and must be routed to speaker + DTMF = 8, + TTS = 9, + NUM_STREAM_TYPES + }; + + // Audio sub formats (see AudioSystem::audio_format). + enum pcm_sub_format { + PCM_SUB_16_BIT = 0x1, // must be 1 for backward compatibility + PCM_SUB_8_BIT = 0x2, // must be 2 for backward compatibility + }; + + enum audio_sessions { + SESSION_OUTPUT_STAGE = AUDIO_SESSION_OUTPUT_STAGE, + SESSION_OUTPUT_MIX = AUDIO_SESSION_OUTPUT_MIX, + }; + + // MP3 sub format field definition : can use 11 LSBs in the same way as MP3 frame header to + // specify bit rate, stereo mode, version... + enum mp3_sub_format { + // TODO + }; + + // AMR NB/WB sub format field definition: specify frame block interleaving, bandwidth efficient + // or octet aligned, encoding mode for recording... + enum amr_sub_format { + // TODO + }; + + // AAC sub format field definition: specify profile or bitrate for recording... + enum aac_sub_format { + // TODO + }; + + // VORBIS sub format field definition: specify quality for recording... + enum vorbis_sub_format { + // TODO + }; + + // Audio format consists in a main format field (upper 8 bits) and a sub format field (lower 24 + // bits). The main format indicates the main codec type. The sub format field indicates options + // and parameters for each format. The sub format is mainly used for record to indicate for + // instance the requested bitrate or profile. It can also be used for certain formats to give + // informations not present in the encoded audio stream (e.g. octet alignement for AMR). + enum audio_format { + INVALID_FORMAT = -1, + FORMAT_DEFAULT = 0, + PCM = 0x00000000, // must be 0 for backward compatibility + MP3 = 0x01000000, + AMR_NB = 0x02000000, + AMR_WB = 0x03000000, + AAC = 0x04000000, + HE_AAC_V1 = 0x05000000, + HE_AAC_V2 = 0x06000000, + VORBIS = 0x07000000, + MAIN_FORMAT_MASK = 0xFF000000, + SUB_FORMAT_MASK = 0x00FFFFFF, + // Aliases + PCM_16_BIT = (PCM | PCM_SUB_16_BIT), + PCM_8_BIT = (PCM | PCM_SUB_8_BIT) + }; + + enum audio_channels { + // output channels + CHANNEL_OUT_FRONT_LEFT = 0x1, + CHANNEL_OUT_FRONT_RIGHT = 0x2, + CHANNEL_OUT_FRONT_CENTER = 0x4, + CHANNEL_OUT_LOW_FREQUENCY = 0x8, + CHANNEL_OUT_BACK_LEFT = 0x10, + CHANNEL_OUT_BACK_RIGHT = 0x20, + CHANNEL_OUT_FRONT_LEFT_OF_CENTER = 0x40, + CHANNEL_OUT_FRONT_RIGHT_OF_CENTER = 0x80, + CHANNEL_OUT_BACK_CENTER = 0x100, + CHANNEL_OUT_SIDE_LEFT = 0x200, + CHANNEL_OUT_SIDE_RIGHT = 0x400, + CHANNEL_OUT_TOP_CENTER = 0x800, + CHANNEL_OUT_TOP_FRONT_LEFT = 0x1000, + CHANNEL_OUT_TOP_FRONT_CENTER = 0x2000, + CHANNEL_OUT_TOP_FRONT_RIGHT = 0x4000, + CHANNEL_OUT_TOP_BACK_LEFT = 0x8000, + CHANNEL_OUT_TOP_BACK_CENTER = 0x10000, + CHANNEL_OUT_TOP_BACK_RIGHT = 0x20000, + + CHANNEL_OUT_MONO = CHANNEL_OUT_FRONT_LEFT, + CHANNEL_OUT_STEREO = (CHANNEL_OUT_FRONT_LEFT | CHANNEL_OUT_FRONT_RIGHT), + CHANNEL_OUT_QUAD = (CHANNEL_OUT_FRONT_LEFT | CHANNEL_OUT_FRONT_RIGHT | + CHANNEL_OUT_BACK_LEFT | CHANNEL_OUT_BACK_RIGHT), + CHANNEL_OUT_SURROUND = (CHANNEL_OUT_FRONT_LEFT | CHANNEL_OUT_FRONT_RIGHT | + CHANNEL_OUT_FRONT_CENTER | CHANNEL_OUT_BACK_CENTER), + CHANNEL_OUT_5POINT1 = + (CHANNEL_OUT_FRONT_LEFT | CHANNEL_OUT_FRONT_RIGHT | CHANNEL_OUT_FRONT_CENTER | + CHANNEL_OUT_LOW_FREQUENCY | CHANNEL_OUT_BACK_LEFT | CHANNEL_OUT_BACK_RIGHT), + // matches the correct AudioFormat.CHANNEL_OUT_7POINT1_SURROUND definition for 7.1 + CHANNEL_OUT_7POINT1 = + (CHANNEL_OUT_FRONT_LEFT | CHANNEL_OUT_FRONT_RIGHT | CHANNEL_OUT_FRONT_CENTER | + CHANNEL_OUT_LOW_FREQUENCY | CHANNEL_OUT_BACK_LEFT | CHANNEL_OUT_BACK_RIGHT | + CHANNEL_OUT_SIDE_LEFT | CHANNEL_OUT_SIDE_RIGHT), + CHANNEL_OUT_ALL = + (CHANNEL_OUT_FRONT_LEFT | CHANNEL_OUT_FRONT_RIGHT | CHANNEL_OUT_FRONT_CENTER | + CHANNEL_OUT_LOW_FREQUENCY | CHANNEL_OUT_BACK_LEFT | CHANNEL_OUT_BACK_RIGHT | + CHANNEL_OUT_FRONT_LEFT_OF_CENTER | CHANNEL_OUT_FRONT_RIGHT_OF_CENTER | + CHANNEL_OUT_BACK_CENTER | CHANNEL_OUT_SIDE_LEFT | CHANNEL_OUT_SIDE_RIGHT | + CHANNEL_OUT_TOP_CENTER | CHANNEL_OUT_TOP_FRONT_LEFT | + CHANNEL_OUT_TOP_FRONT_CENTER | CHANNEL_OUT_TOP_FRONT_RIGHT | + CHANNEL_OUT_TOP_BACK_LEFT | CHANNEL_OUT_TOP_BACK_CENTER | + CHANNEL_OUT_TOP_BACK_RIGHT), + + // input channels + CHANNEL_IN_LEFT = 0x4, + CHANNEL_IN_RIGHT = 0x8, + CHANNEL_IN_FRONT = 0x10, + CHANNEL_IN_BACK = 0x20, + CHANNEL_IN_LEFT_PROCESSED = 0x40, + CHANNEL_IN_RIGHT_PROCESSED = 0x80, + CHANNEL_IN_FRONT_PROCESSED = 0x100, + CHANNEL_IN_BACK_PROCESSED = 0x200, + CHANNEL_IN_PRESSURE = 0x400, + CHANNEL_IN_X_AXIS = 0x800, + CHANNEL_IN_Y_AXIS = 0x1000, + CHANNEL_IN_Z_AXIS = 0x2000, + CHANNEL_IN_VOICE_UPLINK = 0x4000, + CHANNEL_IN_VOICE_DNLINK = 0x8000, + CHANNEL_IN_MONO = CHANNEL_IN_FRONT, + CHANNEL_IN_STEREO = (CHANNEL_IN_LEFT | CHANNEL_IN_RIGHT), + CHANNEL_IN_ALL = (CHANNEL_IN_LEFT | CHANNEL_IN_RIGHT | CHANNEL_IN_FRONT | CHANNEL_IN_BACK | + CHANNEL_IN_LEFT_PROCESSED | CHANNEL_IN_RIGHT_PROCESSED | + CHANNEL_IN_FRONT_PROCESSED | CHANNEL_IN_BACK_PROCESSED | + CHANNEL_IN_PRESSURE | CHANNEL_IN_X_AXIS | CHANNEL_IN_Y_AXIS | + CHANNEL_IN_Z_AXIS | CHANNEL_IN_VOICE_UPLINK | CHANNEL_IN_VOICE_DNLINK) + }; + + enum audio_mode { + MODE_INVALID = -2, + MODE_CURRENT = -1, + MODE_NORMAL = 0, + MODE_RINGTONE, + MODE_IN_CALL, + MODE_IN_COMMUNICATION, + NUM_MODES // not a valid entry, denotes end-of-list + }; + + enum audio_in_acoustics { + AGC_ENABLE = 0x0001, + AGC_DISABLE = 0, + NS_ENABLE = 0x0002, + NS_DISABLE = 0, + TX_IIR_ENABLE = 0x0004, + TX_DISABLE = 0 + }; + + // DO NOT USE: the "audio_devices" enumeration below is obsolete, use type "audio_devices_t" and + // audio device enumeration from system/audio.h instead. + enum audio_devices { + // output devices + DEVICE_OUT_EARPIECE = 0x1, + DEVICE_OUT_SPEAKER = 0x2, + DEVICE_OUT_WIRED_HEADSET = 0x4, + DEVICE_OUT_WIRED_HEADPHONE = 0x8, + DEVICE_OUT_BLUETOOTH_SCO = 0x10, + DEVICE_OUT_BLUETOOTH_SCO_HEADSET = 0x20, + DEVICE_OUT_BLUETOOTH_SCO_CARKIT = 0x40, + DEVICE_OUT_BLUETOOTH_A2DP = 0x80, + DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES = 0x100, + DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER = 0x200, + DEVICE_OUT_AUX_DIGITAL = 0x400, + DEVICE_OUT_ANLG_DOCK_HEADSET = 0x800, + DEVICE_OUT_DGTL_DOCK_HEADSET = 0x1000, + DEVICE_OUT_DEFAULT = 0x8000, + DEVICE_OUT_ALL = + (DEVICE_OUT_EARPIECE | DEVICE_OUT_SPEAKER | DEVICE_OUT_WIRED_HEADSET | + DEVICE_OUT_WIRED_HEADPHONE | DEVICE_OUT_BLUETOOTH_SCO | + DEVICE_OUT_BLUETOOTH_SCO_HEADSET | DEVICE_OUT_BLUETOOTH_SCO_CARKIT | + DEVICE_OUT_BLUETOOTH_A2DP | DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES | + DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER | DEVICE_OUT_AUX_DIGITAL | + DEVICE_OUT_ANLG_DOCK_HEADSET | DEVICE_OUT_DGTL_DOCK_HEADSET | DEVICE_OUT_DEFAULT), + DEVICE_OUT_ALL_A2DP = (DEVICE_OUT_BLUETOOTH_A2DP | DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES | + DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER), + + // input devices + DEVICE_IN_COMMUNICATION = 0x10000, + DEVICE_IN_AMBIENT = 0x20000, + DEVICE_IN_BUILTIN_MIC = 0x40000, + DEVICE_IN_BLUETOOTH_SCO_HEADSET = 0x80000, + DEVICE_IN_WIRED_HEADSET = 0x100000, + DEVICE_IN_AUX_DIGITAL = 0x200000, + DEVICE_IN_VOICE_CALL = 0x400000, + DEVICE_IN_BACK_MIC = 0x800000, + DEVICE_IN_DEFAULT = 0x80000000, + + DEVICE_IN_ALL = + (DEVICE_IN_COMMUNICATION | DEVICE_IN_AMBIENT | DEVICE_IN_BUILTIN_MIC | + DEVICE_IN_BLUETOOTH_SCO_HEADSET | DEVICE_IN_WIRED_HEADSET | DEVICE_IN_AUX_DIGITAL | + DEVICE_IN_VOICE_CALL | DEVICE_IN_BACK_MIC | DEVICE_IN_DEFAULT) + }; + + // request to open a direct output with getOutput() (by opposition to sharing an output with + // other AudioTracks) + enum output_flags { OUTPUT_FLAG_INDIRECT = 0x0, OUTPUT_FLAG_DIRECT = 0x1 }; + + // device categories used for setForceUse() + enum forced_config { + FORCE_NONE, + FORCE_SPEAKER, + FORCE_HEADPHONES, + FORCE_BT_SCO, + FORCE_BT_A2DP, + FORCE_WIRED_ACCESSORY, + FORCE_BT_CAR_DOCK, + FORCE_BT_DESK_DOCK, + FORCE_ANALOG_DOCK, + FORCE_DIGITAL_DOCK, + FORCE_NO_BT_A2DP, + FORCE_SYSTEM_ENFORCED, + NUM_FORCE_CONFIG, + FORCE_DEFAULT = FORCE_NONE + }; + + // usages used for setForceUse() + enum force_use { + FOR_COMMUNICATION, + FOR_MEDIA, + FOR_RECORD, + FOR_DOCK, + FOR_SYSTEM, + NUM_FORCE_USE + }; + + // + // AudioPolicyService interface + // + + // device connection states used for setDeviceConnectionState() + enum device_connection_state { + DEVICE_STATE_UNAVAILABLE, + DEVICE_STATE_AVAILABLE, + NUM_DEVICE_STATES + }; + +#endif + + static uint32_t popCount(uint32_t u) { return popcount(u); } + +#if 1 + static bool isOutputDevice(audio_devices device) { + if ((popcount(device) == 1) && ((device & ~DEVICE_OUT_ALL) == 0)) + return true; + else + return false; + } + static bool isInputDevice(audio_devices device) { + if ((popcount(device) == 1) && ((device & ~DEVICE_IN_ALL) == 0)) + return true; + else + return false; + } + static bool isA2dpDevice(audio_devices device) { + return audio_is_a2dp_device((audio_devices_t)device); + } + static bool isBluetoothScoDevice(audio_devices device) { + return audio_is_bluetooth_sco_device((audio_devices_t)device); + } + static bool isValidFormat(uint32_t format) { + return audio_is_valid_format((audio_format_t)format); + } + static bool isLinearPCM(uint32_t format) { return audio_is_linear_pcm((audio_format_t)format); } + static bool isOutputChannel(audio_channel_mask_t channel) { + return audio_is_output_channel(channel); + } + static bool isInputChannel(audio_channel_mask_t channel) { + return audio_is_input_channel(channel); + } + +#endif +}; + +}; // namespace android_audio_legacy + +#endif // ANDROID_AUDIOSYSTEM_LEGACY_H_ diff --git a/wifi/1.6/default/hal_legacy/IMountService.h b/wifi/1.6/default/hal_legacy/IMountService.h new file mode 100644 index 0000000000..158ff5945b --- /dev/null +++ b/wifi/1.6/default/hal_legacy/IMountService.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2007 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. + */ + +// +#ifndef ANDROID_HARDWARE_IMOUNTSERVICE_H +#define ANDROID_HARDWARE_IMOUNTSERVICE_H + +#include +#include + +namespace android { + +// ---------------------------------------------------------------------- + +class IMountService : public IInterface { + public: + static const int OperationSucceeded = 0; + static const int OperationFailedInternalError = -1; + static const int OperationFailedNoMedia = -2; + static const int OperationFailedMediaBlank = -3; + static const int OperationFailedMediaCorrupt = -4; + static const int OperationFailedVolumeNotMounted = -5; + + public: + DECLARE_META_INTERFACE(MountService); + + virtual void getShareMethodList() = 0; + virtual bool getShareMethodAvailable(String16 method) = 0; + virtual int shareVolume(String16 path, String16 method) = 0; + virtual int unshareVolume(String16 path, String16 method) = 0; + virtual bool getVolumeShared(String16 path, String16 method) = 0; + virtual int mountVolume(String16 path) = 0; + virtual int unmountVolume(String16 path) = 0; + virtual int formatVolume(String16 path) = 0; + virtual String16 getVolumeState(String16 mountPoint) = 0; + virtual int createSecureContainer(String16 id, int sizeMb, String16 fstype, String16 key, + int ownerUid) = 0; + virtual int finalizeSecureContainer(String16 id) = 0; + virtual int destroySecureContainer(String16 id) = 0; + virtual int mountSecureContainer(String16 id, String16 key, int ownerUid) = 0; + virtual int unmountSecureContainer(String16 id) = 0; + virtual int renameSecureContainer(String16 oldId, String16 newId) = 0; + virtual String16 getSecureContainerPath(String16 id) = 0; + virtual void getSecureContainerList() = 0; + virtual void shutdown() = 0; +}; + +// ---------------------------------------------------------------------- + +}; // namespace android + +#endif // ANDROID_HARDWARE_IMOUNTSERVICE_H diff --git a/wifi/1.6/default/hal_legacy/audio_policy_conf.h b/wifi/1.6/default/hal_legacy/audio_policy_conf.h new file mode 100644 index 0000000000..13d62f96de --- /dev/null +++ b/wifi/1.6/default/hal_legacy/audio_policy_conf.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2012 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. + */ + +#ifndef ANDROID_AUDIO_POLICY_CONF_H +#define ANDROID_AUDIO_POLICY_CONF_H + +///////////////////////////////////////////////// +// Definitions for audio policy configuration file (audio_policy.conf) +///////////////////////////////////////////////// + +#define AUDIO_HARDWARE_MODULE_ID_MAX_LEN 32 + +#define AUDIO_POLICY_CONFIG_FILE "/system/etc/audio_policy.conf" +#define AUDIO_POLICY_VENDOR_CONFIG_FILE "/vendor/etc/audio_policy.conf" + +// global configuration +#define GLOBAL_CONFIG_TAG "global_configuration" + +#define ATTACHED_OUTPUT_DEVICES_TAG "attached_output_devices" +#define DEFAULT_OUTPUT_DEVICE_TAG "default_output_device" +#define ATTACHED_INPUT_DEVICES_TAG "attached_input_devices" +#define SPEAKER_DRC_ENABLED_TAG "speaker_drc_enabled" + +// hw modules descriptions +#define AUDIO_HW_MODULE_TAG "audio_hw_modules" + +#define OUTPUTS_TAG "outputs" +#define INPUTS_TAG "inputs" + +#define SAMPLING_RATES_TAG "sampling_rates" +#define FORMATS_TAG "formats" +#define CHANNELS_TAG "channel_masks" +#define DEVICES_TAG "devices" +#define FLAGS_TAG "flags" + +#define DYNAMIC_VALUE_TAG \ + "dynamic" // special value for "channel_masks", "sampling_rates" and + // "formats" in outputs descriptors indicating that supported + // values should be queried after opening the output. + +#endif // ANDROID_AUDIO_POLICY_CONF_H diff --git a/wifi/1.6/default/hal_legacy/gscan.h b/wifi/1.6/default/hal_legacy/gscan.h new file mode 100644 index 0000000000..c6c52c6e1a --- /dev/null +++ b/wifi/1.6/default/hal_legacy/gscan.h @@ -0,0 +1,427 @@ +#include "wifi_hal.h" + +#ifndef __WIFI_HAL_GSCAN_H__ +#define __WIFI_HAL_GSCAN_H__ + +// Define static_assert() unless already defined by compiler. +#ifndef __has_feature +#define __has_feature(__x) 0 +#endif +#if !(__has_feature(cxx_static_assert)) && !defined(static_assert) +#define static_assert(__b, __m) \ + extern int compile_time_assert_failed[(__b) ? 1 : -1] __attribute__((unused)); +#endif + +/* AP Scans */ + +typedef enum { + WIFI_BAND_UNSPECIFIED, + WIFI_BAND_BG = 1, // 2.4 GHz + WIFI_BAND_A = 2, // 5 GHz without DFS + WIFI_BAND_A_DFS = 4, // 5 GHz DFS only + WIFI_BAND_A_WITH_DFS = 6, // 5 GHz with DFS + WIFI_BAND_ABG = 3, // 2.4 GHz + 5 GHz; no DFS + WIFI_BAND_ABG_WITH_DFS = 7, // 2.4 GHz + 5 GHz with DFS +} wifi_band; + +#define MAX_CHANNELS 16 +#define MAX_BUCKETS 16 +#define MAX_HOTLIST_APS 128 +#define MAX_SIGNIFICANT_CHANGE_APS 64 +#define MAX_EPNO_NETWORKS 64 +#define MAX_HOTLIST_SSID 8 +#define MAX_AP_CACHE_PER_SCAN 32 + +wifi_error wifi_get_valid_channels(wifi_interface_handle handle, int band, int max_channels, + wifi_channel* channels, int* num_channels); + +typedef struct { + int max_scan_cache_size; // total space allocated for scan (in bytes) + int max_scan_buckets; // maximum number of channel buckets + int max_ap_cache_per_scan; // maximum number of APs that can be stored per scan + int max_rssi_sample_size; // number of RSSI samples used for averaging RSSI + int max_scan_reporting_threshold; // max possible report_threshold as described + // in wifi_scan_cmd_params + int max_hotlist_bssids; // maximum number of entries for hotlist BSSIDs + int max_hotlist_ssids; // maximum number of entries for hotlist SSIDs + int max_significant_wifi_change_aps; // maximum number of entries for + // significant wifi change APs + int max_bssid_history_entries; // number of BSSID/RSSI entries that device can hold + int max_number_epno_networks; // max number of epno entries + int max_number_epno_networks_by_ssid; // max number of epno entries if ssid is specified, + // that is, epno entries for which an exact match is + // required, or entries corresponding to hidden ssids + int max_number_of_white_listed_ssid; // max number of white listed SSIDs, M target is 2 to 4 +} wifi_gscan_capabilities; + +wifi_error wifi_get_gscan_capabilities(wifi_interface_handle handle, + wifi_gscan_capabilities* capabilities); + +typedef enum { + WIFI_SCAN_RESULTS_AVAILABLE, // reported when REPORT_EVENTS_EACH_SCAN is set and a scan + // completes. WIFI_SCAN_THRESHOLD_NUM_SCANS or + // WIFI_SCAN_THRESHOLD_PERCENT can be reported instead if the + // reason for the event is available; however, at most one of + // these events should be reported per scan. If there are + // multiple buckets that were scanned this period and one has the + // EACH_SCAN flag set then this event should be prefered. + WIFI_SCAN_THRESHOLD_NUM_SCANS, // can be reported when REPORT_EVENTS_EACH_SCAN is not set and + // report_threshold_num_scans is reached. + WIFI_SCAN_THRESHOLD_PERCENT, // can be reported when REPORT_EVENTS_EACH_SCAN is not set and + // report_threshold_percent is reached. + WIFI_SCAN_FAILED, // reported when currently executing gscans have failed. + // start_gscan will need to be called again in order to continue + // scanning. This is intended to indicate abnormal scan + // terminations (not those as a result of stop_gscan). +} wifi_scan_event; + +/* Format of information elements found in the beacon */ +typedef struct { + byte id; // element identifier + byte len; // number of bytes to follow + byte data[]; +} wifi_information_element; + +typedef struct { + wifi_timestamp ts; // time since boot (in microsecond) when the result was + // retrieved + char ssid[32 + 1]; // null terminated + mac_addr bssid; + wifi_channel channel; // channel frequency in MHz + wifi_rssi rssi; // in db + wifi_timespan rtt; // in nanoseconds + wifi_timespan rtt_sd; // standard deviation in rtt + unsigned short beacon_period; // period advertised in the beacon + unsigned short capability; // capabilities advertised in the beacon + unsigned int ie_length; // size of the ie_data blob + char ie_data[1]; // blob of all the information elements found in the + // beacon; this data should be a packed list of + // wifi_information_element objects, one after the other. + // other fields +} wifi_scan_result; + +static_assert( + MAX_BUCKETS <= 8 * sizeof(unsigned), + "The buckets_scanned bitset is represented by an unsigned int and cannot support this many " + "buckets on this platform."); +typedef struct { + /* reported when each probe response is received, if report_events + * enabled in wifi_scan_cmd_params. buckets_scanned is a bitset of the + * buckets that are currently being scanned. See the buckets_scanned field + * in the wifi_cached_scan_results struct for more details. + */ + void (*on_full_scan_result)(wifi_request_id id, wifi_scan_result* result, + unsigned buckets_scanned); + + /* indicates progress of scanning statemachine */ + void (*on_scan_event)(wifi_request_id id, wifi_scan_event event); + +} wifi_scan_result_handler; + +typedef struct { + wifi_channel channel; // frequency + int dwellTimeMs; // dwell time hint + int passive; // 0 => active, 1 => passive scan; ignored for DFS + /* Add channel class */ +} wifi_scan_channel_spec; + +#define REPORT_EVENTS_EACH_SCAN (1 << 0) +#define REPORT_EVENTS_FULL_RESULTS (1 << 1) +#define REPORT_EVENTS_NO_BATCH (1 << 2) + +typedef struct { + int bucket; // bucket index, 0 based + wifi_band band; // when UNSPECIFIED, use channel list + int period; // desired period, in millisecond; if this is too + // low, the firmware should choose to generate results as + // fast as it can instead of failing the command. + // for exponential backoff bucket this is the min_period + /* report_events semantics - + * This is a bit field; which defines following bits - + * REPORT_EVENTS_EACH_SCAN => report a scan completion event after scan. If this is not set + * then scan completion events should be reported if + * report_threshold_percent or report_threshold_num_scans is + * reached. + * REPORT_EVENTS_FULL_RESULTS => forward scan results (beacons/probe responses + IEs) + * in real time to HAL, in addition to completion events + * Note: To keep backward compatibility, fire completion + * events regardless of REPORT_EVENTS_EACH_SCAN. + * REPORT_EVENTS_NO_BATCH => controls if scans for this bucket should be placed in the + * history buffer + */ + byte report_events; + int max_period; // if max_period is non zero or different than period, then this bucket is + // an exponential backoff bucket and the scan period will grow exponentially + // as per formula: actual_period(N) = period * (base ^ (N/step_count)) + // to a maximum period of max_period + int base; // for exponential back off bucket: multiplier: new_period=old_period*base + int step_count; // for exponential back off bucket, number of scans to perform for a given + // period + + int num_channels; + // channels to scan; these may include DFS channels + // Note that a given channel may appear in multiple buckets + wifi_scan_channel_spec channels[MAX_CHANNELS]; +} wifi_scan_bucket_spec; + +typedef struct { + int base_period; // base timer period in ms + int max_ap_per_scan; // number of access points to store in each scan entry in + // the BSSID/RSSI history buffer (keep the highest RSSI + // access points) + int report_threshold_percent; // in %, when scan buffer is this much full, wake up apps + // processor + int report_threshold_num_scans; // in number of scans, wake up AP after these many scans + int num_buckets; + wifi_scan_bucket_spec buckets[MAX_BUCKETS]; +} wifi_scan_cmd_params; + +/* + * Start periodic GSCAN + * When this is called all requested buckets should be scanned, starting the beginning of the cycle + * + * For example: + * If there are two buckets specified + * - Bucket 1: period=10s + * - Bucket 2: period=20s + * - Bucket 3: period=30s + * Then the following scans should occur + * - t=0 buckets 1, 2, and 3 are scanned + * - t=10 bucket 1 is scanned + * - t=20 bucket 1 and 2 are scanned + * - t=30 bucket 1 and 3 are scanned + * - t=40 bucket 1 and 2 are scanned + * - t=50 bucket 1 is scanned + * - t=60 buckets 1, 2, and 3 are scanned + * - and the patter repeats + * + * If any scan does not occur or is incomplete (error, interrupted, etc) then a cached scan result + * should still be recorded with the WIFI_SCAN_FLAG_INTERRUPTED flag set. + */ +wifi_error wifi_start_gscan(wifi_request_id id, wifi_interface_handle iface, + wifi_scan_cmd_params params, wifi_scan_result_handler handler); + +/* Stop periodic GSCAN */ +wifi_error wifi_stop_gscan(wifi_request_id id, wifi_interface_handle iface); + +typedef enum { + WIFI_SCAN_FLAG_INTERRUPTED = 1 // Indicates that scan results are not complete because + // probes were not sent on some channels +} wifi_scan_flags; + +/* Get the GSCAN cached scan results */ +typedef struct { + int scan_id; // a unique identifier for the scan unit + int flags; // a bitmask with additional + // information about scan. + unsigned buckets_scanned; // a bitset of the buckets that were scanned. + // for example a value of 13 (0b1101) would + // indicate that buckets 0, 2 and 3 were + // scanned to produce this list of results. + // should be set to 0 if this information is + // not available. + int num_results; // number of bssids retrieved by the scan + wifi_scan_result results[MAX_AP_CACHE_PER_SCAN]; // scan results - one for each bssid +} wifi_cached_scan_results; + +wifi_error wifi_get_cached_gscan_results(wifi_interface_handle iface, byte flush, int max, + wifi_cached_scan_results* results, int* num); + +/* BSSID Hotlist */ +typedef struct { + void (*on_hotlist_ap_found)(wifi_request_id id, unsigned num_results, + wifi_scan_result* results); + void (*on_hotlist_ap_lost)(wifi_request_id id, unsigned num_results, wifi_scan_result* results); +} wifi_hotlist_ap_found_handler; + +typedef struct { + mac_addr bssid; // AP BSSID + wifi_rssi low; // low threshold + wifi_rssi high; // high threshold +} ap_threshold_param; + +typedef struct { + int lost_ap_sample_size; + int num_bssid; // number of hotlist APs + ap_threshold_param ap[MAX_HOTLIST_APS]; // hotlist APs +} wifi_bssid_hotlist_params; + +/* Set the BSSID Hotlist */ +wifi_error wifi_set_bssid_hotlist(wifi_request_id id, wifi_interface_handle iface, + wifi_bssid_hotlist_params params, + wifi_hotlist_ap_found_handler handler); + +/* Clear the BSSID Hotlist */ +wifi_error wifi_reset_bssid_hotlist(wifi_request_id id, wifi_interface_handle iface); + +/* SSID Hotlist */ +typedef struct { + void (*on_hotlist_ssid_found)(wifi_request_id id, unsigned num_results, + wifi_scan_result* results); + void (*on_hotlist_ssid_lost)(wifi_request_id id, unsigned num_results, + wifi_scan_result* results); +} wifi_hotlist_ssid_handler; + +typedef struct { + char ssid[32 + 1]; // SSID + wifi_band band; // band for this set of threshold params + wifi_rssi low; // low threshold + wifi_rssi high; // high threshold +} ssid_threshold_param; + +typedef struct { + int lost_ssid_sample_size; + int num_ssid; // number of hotlist SSIDs + ssid_threshold_param ssid[MAX_HOTLIST_SSID]; // hotlist SSIDs +} wifi_ssid_hotlist_params; + +/* Significant wifi change */ +typedef struct { + mac_addr bssid; // BSSID + wifi_channel channel; // channel frequency in MHz + int num_rssi; // number of rssi samples + wifi_rssi rssi[]; // RSSI history in db +} wifi_significant_change_result; + +typedef struct { + void (*on_significant_change)(wifi_request_id id, unsigned num_results, + wifi_significant_change_result** results); +} wifi_significant_change_handler; + +// The sample size parameters in the wifi_significant_change_params structure +// represent the number of occurence of a g-scan where the BSSID was seen and RSSI was +// collected for that BSSID, or, the BSSID was expected to be seen and didn't. +// for instance: lost_ap_sample_size : number of time a g-scan was performed on the +// channel the BSSID was seen last, and the BSSID was not seen during those g-scans +typedef struct { + int rssi_sample_size; // number of samples for averaging RSSI + int lost_ap_sample_size; // number of samples to confirm AP loss + int min_breaching; // number of APs breaching threshold + int num_bssid; // max 64 + ap_threshold_param ap[MAX_SIGNIFICANT_CHANGE_APS]; +} wifi_significant_change_params; + +/* Set the Signifcant AP change list */ +wifi_error wifi_set_significant_change_handler(wifi_request_id id, wifi_interface_handle iface, + wifi_significant_change_params params, + wifi_significant_change_handler handler); + +/* Clear the Signifcant AP change list */ +wifi_error wifi_reset_significant_change_handler(wifi_request_id id, wifi_interface_handle iface); + +/* Random MAC OUI for PNO */ +wifi_error wifi_set_scanning_mac_oui(wifi_interface_handle handle, oui scan_oui); + +// Enhanced PNO: +// Enhanced PNO feature is expected to be enabled all of the time (e.g. screen lit) and may thus +// require firmware to store a large number of networks, covering the whole list of known networks. +// Therefore, it is acceptable for firmware to store a crc24, crc32 or other short hash of the SSID, +// such that a low but non-zero probability of collision exist. With that scheme it should be +// possible for firmware to keep an entry as small as 4 bytes for each pno network. +// For instance, a firmware pn0 entry can be implemented in the form of: +// PNO ENTRY = crc24(3 bytes) | flags>>3 (5 bits) | auth flags(3 bits) +// +// No scans should be automatically performed by the chip. Instead all scan results from gscan +// should be scored and the wifi_epno_handler on_network_found callback should be called with +// the scan results. +// +// A PNO network shall be reported once, that is, once a network is reported by firmware +// its entry shall be marked as "done" until framework calls wifi_set_epno_list again. +// Calling wifi_set_epno_list shall reset the "done" status of pno networks in firmware. +// +// A network should only be considered found if its RSSI is above the minimum RSSI for its +// frequency range (min5GHz_rssi and min24GHz_rssi for 5GHz and 2.4GHz networks respectively). +// When disconnected the list of scan results should be returned if any network is found. +// When connected the scan results shall be reported only if the score of any network in the scan +// is greater than that of the currently connected BSSID. +// +// The FW should calculate the score of all the candidates (including currently connected one) +// with following equation: +// RSSI score = (RSSI + 85) * 4; +// If RSSI score > initial_score_max , RSSI score = initial_score_max; +// final score = RSSI score +// + current_connection_bonus (if currently connected BSSID) +// + same_network_bonus (if network has SAME_NETWORK flag) +// + secure_bonus (if the network is not open) +// + band5GHz_bonus (if BSSID is on 5G) +// If there is a BSSID’s score > current BSSID’s score, then report the cached scan results +// at the end of the scan (excluding the ones on blacklist) to the upper layer. +// Additionally, all BSSIDs that are in the BSSID blacklist should be ignored by Enhanced PNO + +// Whether directed scan needs to be performed (for hidden SSIDs) +#define WIFI_PNO_FLAG_DIRECTED_SCAN (1 << 0) +// Whether PNO event shall be triggered if the network is found on A band +#define WIFI_PNO_FLAG_A_BAND (1 << 1) +// Whether PNO event shall be triggered if the network is found on G band +#define WIFI_PNO_FLAG_G_BAND (1 << 2) +// Whether strict matching is required +// If required then the firmware must store the network's SSID and not just a hash +#define WIFI_PNO_FLAG_STRICT_MATCH (1 << 3) +// If this SSID should be considered the same network as the currently connected one for scoring +#define WIFI_PNO_FLAG_SAME_NETWORK (1 << 4) + +// Code for matching the beacon AUTH IE - additional codes TBD +#define WIFI_PNO_AUTH_CODE_OPEN (1 << 0) // open +#define WIFI_PNO_AUTH_CODE_PSK (1 << 1) // WPA_PSK or WPA2PSK +#define WIFI_PNO_AUTH_CODE_EAPOL (1 << 2) // any EAPOL + +typedef struct { + char ssid[32 + 1]; // null terminated + byte flags; // WIFI_PNO_FLAG_XXX + byte auth_bit_field; // auth bit field for matching WPA IE +} wifi_epno_network; + +/* ePNO Parameters */ +typedef struct { + int min5GHz_rssi; // minimum 5GHz RSSI for a BSSID to be considered + int min24GHz_rssi; // minimum 2.4GHz RSSI for a BSSID to be considered + int initial_score_max; // the maximum score that a network can have before bonuses + int current_connection_bonus; // only report when there is a network's score this much higher + // than the current connection. + int same_network_bonus; // score bonus for all networks with the same network flag + int secure_bonus; // score bonus for networks that are not open + int band5GHz_bonus; // 5GHz RSSI score bonus (applied to all 5GHz networks) + int num_networks; // number of wifi_epno_network objects + wifi_epno_network networks[MAX_EPNO_NETWORKS]; // PNO networks +} wifi_epno_params; + +typedef struct { + // on results + void (*on_network_found)(wifi_request_id id, unsigned num_results, wifi_scan_result* results); +} wifi_epno_handler; + +/* Set the ePNO list - enable ePNO with the given parameters */ +wifi_error wifi_set_epno_list(wifi_request_id id, wifi_interface_handle iface, + const wifi_epno_params* epno_params, wifi_epno_handler handler); + +/* Reset the ePNO list - no ePNO networks should be matched after this */ +wifi_error wifi_reset_epno_list(wifi_request_id id, wifi_interface_handle iface); + +typedef struct { + int id; // identifier of this network block, report this in event + char realm[256]; // null terminated UTF8 encoded realm, 0 if unspecified + int64_t roamingConsortiumIds[16]; // roaming consortium ids to match, 0s if unspecified + byte plmn[3]; // mcc/mnc combination as per rules, 0s if unspecified +} wifi_passpoint_network; + +typedef struct { + void (*on_passpoint_network_found)( + wifi_request_id id, + int net_id, // network block identifier for the matched network + wifi_scan_result* result, // scan result, with channel and beacon information + int anqp_len, // length of ANQP blob + byte* anqp // ANQP data, in the information_element format + ); +} wifi_passpoint_event_handler; + +/* Sets a list for passpoint networks for PNO purposes; it should be matched + * against any passpoint networks (designated by Interworking element) found + * during regular PNO scan. */ +wifi_error wifi_set_passpoint_list(wifi_request_id id, wifi_interface_handle iface, int num, + wifi_passpoint_network* networks, + wifi_passpoint_event_handler handler); + +/* Reset passpoint network list - no Passpoint networks should be matched after this */ +wifi_error wifi_reset_passpoint_list(wifi_request_id id, wifi_interface_handle iface); + +#endif diff --git a/wifi/1.6/default/hal_legacy/link_layer_stats.h b/wifi/1.6/default/hal_legacy/link_layer_stats.h new file mode 100644 index 0000000000..7585cdfee4 --- /dev/null +++ b/wifi/1.6/default/hal_legacy/link_layer_stats.h @@ -0,0 +1,285 @@ +#include "wifi_hal.h" + +#ifndef __WIFI_HAL_STATS_H +#define __WIFI_HAL_STATS_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define STATS_MAJOR_VERSION 1 +#define STATS_MINOR_VERSION 0 +#define STATS_MICRO_VERSION 0 + +typedef enum { + WIFI_DISCONNECTED = 0, + WIFI_AUTHENTICATING = 1, + WIFI_ASSOCIATING = 2, + WIFI_ASSOCIATED = 3, + WIFI_EAPOL_STARTED = 4, // if done by firmware/driver + WIFI_EAPOL_COMPLETED = 5, // if done by firmware/driver +} wifi_connection_state; + +typedef enum { + WIFI_ROAMING_IDLE = 0, + WIFI_ROAMING_ACTIVE = 1, +} wifi_roam_state; + +typedef enum { + WIFI_INTERFACE_STA = 0, + WIFI_INTERFACE_SOFTAP = 1, + WIFI_INTERFACE_IBSS = 2, + WIFI_INTERFACE_P2P_CLIENT = 3, + WIFI_INTERFACE_P2P_GO = 4, + WIFI_INTERFACE_NAN = 5, + WIFI_INTERFACE_MESH = 6, + WIFI_INTERFACE_TDLS = 7, + WIFI_INTERFACE_UNKNOWN = -1 +} wifi_interface_mode; + +#define WIFI_CAPABILITY_QOS 0x00000001 // set for QOS association +#define WIFI_CAPABILITY_PROTECTED \ + 0x00000002 // set for protected association (802.11 beacon frame control protected bit set) +#define WIFI_CAPABILITY_INTERWORKING \ + 0x00000004 // set if 802.11 Extended Capabilities element interworking bit is set +#define WIFI_CAPABILITY_HS20 0x00000008 // set for HS20 association +#define WIFI_CAPABILITY_SSID_UTF8 \ + 0x00000010 // set is 802.11 Extended Capabilities element UTF-8 SSID bit is set +#define WIFI_CAPABILITY_COUNTRY 0x00000020 // set is 802.11 Country Element is present + +typedef struct { + wifi_interface_mode mode; // interface mode + u8 mac_addr[6]; // interface mac address (self) + wifi_connection_state state; // connection state (valid for STA, CLI only) + wifi_roam_state roaming; // roaming state + u32 capabilities; // WIFI_CAPABILITY_XXX (self) + u8 ssid[33]; // null terminated SSID + u8 bssid[6]; // bssid + u8 ap_country_str[3]; // country string advertised by AP + u8 country_str[3]; // country string for this association + u8 time_slicing_duty_cycle_percent; // if this iface is being served using time slicing on a + // radio with one or more ifaces (i.e MCC), then the duty + // cycle assigned to this iface in %. If not using time + // slicing (i.e SCC or DBS), set to 100. +} wifi_interface_link_layer_info; + +/* channel information */ +typedef struct { + wifi_channel_width width; // channel width (20, 40, 80, 80+80, 160, 320) + wifi_channel center_freq; // primary 20 MHz channel + wifi_channel center_freq0; // center frequency (MHz) first segment + wifi_channel center_freq1; // center frequency (MHz) second segment +} wifi_channel_info; + +/* wifi rate */ +typedef struct { + u32 preamble : 3; // 0: OFDM, 1:CCK, 2:HT 3:VHT 4:HE 5:EHT 6..7 reserved + u32 nss : 2; // 0:1x1, 1:2x2, 3:3x3, 4:4x4 + u32 bw : 3; // 0:20MHz, 1:40Mhz, 2:80Mhz, 3:160Mhz 4:320Mhz + u32 rateMcsIdx : 8; // OFDM/CCK rate code would be as per ieee std in the units of 0.5mbps + // HT/VHT/HE/EHT it would be mcs index + u32 reserved : 16; // reserved + u32 bitrate; // units of 100 Kbps +} wifi_rate; + +/* channel statistics */ +typedef struct { + wifi_channel_info channel; // channel + u32 on_time; // msecs the radio is awake (32 bits number accruing over time) + u32 cca_busy_time; // msecs the CCA register is busy (32 bits number accruing over time) +} wifi_channel_stat; + +// Max number of tx power levels. The actual number vary per device and is specified by +// |num_tx_levels| +#define RADIO_STAT_MAX_TX_LEVELS 256 + +/* radio statistics */ +typedef struct { + wifi_radio radio; // wifi radio (if multiple radio supported) + u32 on_time; // msecs the radio is awake (32 bits number accruing over time) + u32 tx_time; // msecs the radio is transmitting (32 bits number accruing over time) + u32 num_tx_levels; // number of radio transmit power levels + u32* tx_time_per_levels; // pointer to an array of radio transmit per power levels in + // msecs accured over time + u32 rx_time; // msecs the radio is in active receive (32 bits number accruing over time) + u32 on_time_scan; // msecs the radio is awake due to all scan (32 bits number accruing over + // time) + u32 on_time_nbd; // msecs the radio is awake due to NAN (32 bits number accruing over time) + u32 on_time_gscan; // msecs the radio is awake due to G?scan (32 bits number accruing over + // time) + u32 on_time_roam_scan; // msecs the radio is awake due to roam?scan (32 bits number accruing + // over time) + u32 on_time_pno_scan; // msecs the radio is awake due to PNO scan (32 bits number accruing over + // time) + u32 on_time_hs20; // msecs the radio is awake due to HS2.0 scans and GAS exchange (32 bits + // number accruing over time) + u32 num_channels; // number of channels + wifi_channel_stat channels[]; // channel statistics +} wifi_radio_stat; + +/** + * Packet statistics reporting by firmware is performed on MPDU basi (i.e. counters increase by 1 + * for each MPDU) As well, "data packet" in associated comments, shall be interpreted as 802.11 data + * packet, that is, 802.11 frame control subtype == 2 and excluding management and control frames. + * + * As an example, in the case of transmission of an MSDU fragmented in 16 MPDUs which are + * transmitted OTA in a 16 units long a-mpdu, for which a block ack is received with 5 bits set: + * tx_mpdu : shall increase by 5 + * retries : shall increase by 16 + * tx_ampdu : shall increase by 1 + * data packet counters shall not increase regardless of the number of BAR potentially sent by + * device for this a-mpdu data packet counters shall not increase regardless of the number of BA + * received by device for this a-mpdu + * + * For each subsequent retransmission of the 11 remaining non ACK'ed mpdus + * (regardless of the fact that they are transmitted in a-mpdu or not) + * retries : shall increase by 1 + * + * If no subsequent BA or ACK are received from AP, until packet lifetime expires for those 11 + * packet that were not ACK'ed mpdu_lost : shall increase by 11 + */ + +/* per rate statistics */ +typedef struct { + wifi_rate rate; // rate information + u32 tx_mpdu; // number of successfully transmitted data pkts (ACK rcvd) + u32 rx_mpdu; // number of received data pkts + u32 mpdu_lost; // number of data packet losses (no ACK) + u32 retries; // total number of data pkt retries + u32 retries_short; // number of short data pkt retries + u32 retries_long; // number of long data pkt retries +} wifi_rate_stat; + +/* access categories */ +typedef enum { + WIFI_AC_VO = 0, + WIFI_AC_VI = 1, + WIFI_AC_BE = 2, + WIFI_AC_BK = 3, + WIFI_AC_MAX = 4, +} wifi_traffic_ac; + +/* wifi peer type */ +typedef enum { + WIFI_PEER_STA, + WIFI_PEER_AP, + WIFI_PEER_P2P_GO, + WIFI_PEER_P2P_CLIENT, + WIFI_PEER_NAN, + WIFI_PEER_TDLS, + WIFI_PEER_INVALID, +} wifi_peer_type; + +/* per peer statistics */ +typedef struct bssload_info { + u16 sta_count; // station count + u16 chan_util; // channel utilization + u8 PAD[4]; +} bssload_info_t; + +typedef struct { + wifi_peer_type type; // peer type (AP, TDLS, GO etc.) + u8 peer_mac_address[6]; // mac address + u32 capabilities; // peer WIFI_CAPABILITY_XXX + bssload_info_t bssload; // STA count and CU + u32 num_rate; // number of rates + wifi_rate_stat rate_stats[]; // per rate statistics, number of entries = num_rate +} wifi_peer_info; + +/* Per access category statistics */ +typedef struct { + wifi_traffic_ac ac; // access category (VI, VO, BE, BK) + u32 tx_mpdu; // number of successfully transmitted unicast data pkts (ACK rcvd) + u32 rx_mpdu; // number of received unicast data packets + u32 tx_mcast; // number of succesfully transmitted multicast data packets + // STA case: implies ACK received from AP for the unicast packet in which mcast + // pkt was sent + u32 rx_mcast; // number of received multicast data packets + u32 rx_ampdu; // number of received unicast a-mpdus; support of this counter is optional + u32 tx_ampdu; // number of transmitted unicast a-mpdus; support of this counter is optional + u32 mpdu_lost; // number of data pkt losses (no ACK) + u32 retries; // total number of data pkt retries + u32 retries_short; // number of short data pkt retries + u32 retries_long; // number of long data pkt retries + u32 contention_time_min; // data pkt min contention time (usecs) + u32 contention_time_max; // data pkt max contention time (usecs) + u32 contention_time_avg; // data pkt avg contention time (usecs) + u32 contention_num_samples; // num of data pkts used for contention statistics +} wifi_wmm_ac_stat; + +/* interface statistics */ +typedef struct { + wifi_interface_handle iface; // wifi interface + wifi_interface_link_layer_info info; // current state of the interface + u32 beacon_rx; // access point beacon received count from connected AP + u64 average_tsf_offset; // average beacon offset encountered (beacon_TSF - TBTT) + // The average_tsf_offset field is used so as to calculate the + // typical beacon contention time on the channel as well may be + // used to debug beacon synchronization and related power consumption + // issue + u32 leaky_ap_detected; // indicate that this AP typically leaks packets beyond the driver guard + // time. + u32 leaky_ap_avg_num_frames_leaked; // average number of frame leaked by AP after frame with PM + // bit set was ACK'ed by AP + u32 leaky_ap_guard_time; // guard time currently in force (when implementing IEEE power + // management based on frame control PM bit), How long driver waits + // before shutting down the radio and after receiving an ACK for a + // data frame with PM bit set) + u32 mgmt_rx; // access point mgmt frames received count from connected AP (including Beacon) + u32 mgmt_action_rx; // action frames received count + u32 mgmt_action_tx; // action frames transmit count + wifi_rssi rssi_mgmt; // access Point Beacon and Management frames RSSI (averaged) + wifi_rssi rssi_data; // access Point Data Frames RSSI (averaged) from connected AP + wifi_rssi rssi_ack; // access Point ACK RSSI (averaged) from connected AP + wifi_wmm_ac_stat ac[WIFI_AC_MAX]; // per ac data packet statistics + u32 num_peers; // number of peers + wifi_peer_info peer_info[]; // per peer statistics +} wifi_iface_stat; + +/* configuration params */ +typedef struct { + u32 mpdu_size_threshold; // threshold to classify the pkts as short or long + // packet size < mpdu_size_threshold => short + u32 aggressive_statistics_gathering; // set for field debug mode. Driver should collect all + // statistics regardless of performance impact. +} wifi_link_layer_params; + +/* API to trigger the link layer statistics collection. + Unless his API is invoked - link layer statistics will not be collected. + Radio statistics (once started) do not stop or get reset unless wifi_clear_link_stats is invoked + Interface statistics (once started) reset and start afresh after each connection */ +wifi_error wifi_set_link_stats(wifi_interface_handle iface, wifi_link_layer_params params); + +/* callback for reporting link layer stats */ +typedef struct { + void (*on_link_stats_results)(wifi_request_id id, wifi_iface_stat* iface_stat, int num_radios, + wifi_radio_stat* radio_stat); +} wifi_stats_result_handler; + +/* api to collect the link layer statistics for a given iface and all the radio stats */ +wifi_error wifi_get_link_stats(wifi_request_id id, wifi_interface_handle iface, + wifi_stats_result_handler handler); + +/* wifi statistics bitmap */ +#define WIFI_STATS_RADIO 0x00000001 // all radio statistics +#define WIFI_STATS_RADIO_CCA 0x00000002 // cca_busy_time (within radio statistics) +#define WIFI_STATS_RADIO_CHANNELS 0x00000004 // all channel statistics (within radio statistics) +#define WIFI_STATS_RADIO_SCAN 0x00000008 // all scan statistics (within radio statistics) +#define WIFI_STATS_IFACE 0x00000010 // all interface statistics +#define WIFI_STATS_IFACE_TXRATE 0x00000020 // all tx rate statistics (within interface statistics) +#define WIFI_STATS_IFACE_AC 0x00000040 // all ac statistics (within interface statistics) +#define WIFI_STATS_IFACE_CONTENTION \ + 0x00000080 // all contention (min, max, avg) statistics (within ac statisctics) + +/* clear api to reset statistics, stats_clear_rsp_mask identifies what stats have been cleared + stop_req = 1 will imply whether to stop the statistics collection. + stop_rsp = 1 will imply that stop_req was honored and statistics collection was stopped. + */ +wifi_error wifi_clear_link_stats(wifi_interface_handle iface, u32 stats_clear_req_mask, + u32* stats_clear_rsp_mask, u8 stop_req, u8* stop_rsp); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /*__WIFI_HAL_STATS_ */ diff --git a/wifi/1.6/default/hal_legacy/power.h b/wifi/1.6/default/hal_legacy/power.h new file mode 100644 index 0000000000..2b6d12ac90 --- /dev/null +++ b/wifi/1.6/default/hal_legacy/power.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2008 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. + */ + +#ifndef _HARDWARE_POWER_H +#define _HARDWARE_POWER_H + +#include + +#if __cplusplus +extern "C" { +#endif + +enum { + PARTIAL_WAKE_LOCK = 1, // the cpu stays on, but the screen is off + FULL_WAKE_LOCK = 2 // the screen is also on +}; + +// while you have a lock held, the device will stay on at least at the +// level you request. +int acquire_wake_lock(int lock, const char* id); +int release_wake_lock(const char* id); + +#if __cplusplus +} // extern "C" +#endif + +#endif // _HARDWARE_POWER_H diff --git a/wifi/1.6/default/hal_legacy/roam.h b/wifi/1.6/default/hal_legacy/roam.h new file mode 100644 index 0000000000..3369e3e3e0 --- /dev/null +++ b/wifi/1.6/default/hal_legacy/roam.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2016 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. + */ + +#ifndef __WIFI_HAL_ROAM_H__ +#define __WIFI_HAL_ROAM_H__ + +#include "wifi_hal.h" + +#define MAX_BLACKLIST_BSSID 16 +#define MAX_WHITELIST_SSID 8 +#define MAX_SSID_LENGTH 32 + +typedef struct { + u32 max_blacklist_size; + u32 max_whitelist_size; +} wifi_roaming_capabilities; + +typedef enum { ROAMING_DISABLE, ROAMING_ENABLE } fw_roaming_state_t; + +typedef struct { + u32 length; + char ssid_str[MAX_SSID_LENGTH]; +} ssid_t; + +typedef struct { + u32 num_blacklist_bssid; // Number of bssids valid in blacklist_bssid[]. + mac_addr blacklist_bssid[MAX_BLACKLIST_BSSID]; // List of bssids which should not be considered + // for romaing by firmware/driver. + u32 num_whitelist_ssid; // Number of ssids valid in whitelist_ssid[]. + ssid_t whitelist_ssid[MAX_WHITELIST_SSID]; // List of ssids to which firmware/driver can + // consider to roam to. +} wifi_roaming_config; + +/* Get the chipset roaming capabilities. */ +wifi_error wifi_get_roaming_capabilities(wifi_interface_handle handle, + wifi_roaming_capabilities* caps); +/* Enable/disable firmware roaming */ +wifi_error wifi_enable_firmware_roaming(wifi_interface_handle handle, fw_roaming_state_t state); + +/* Pass down the blacklist BSSID and whitelist SSID to firmware. */ +wifi_error wifi_configure_roaming(wifi_interface_handle handle, + wifi_roaming_config* roaming_config); + +#endif /* __WIFI_HAL_ROAM_H__ */ diff --git a/wifi/1.6/default/hal_legacy/rtt.h b/wifi/1.6/default/hal_legacy/rtt.h new file mode 100644 index 0000000000..8be7fd38ae --- /dev/null +++ b/wifi/1.6/default/hal_legacy/rtt.h @@ -0,0 +1,314 @@ + +#include "gscan.h" +#include "wifi_hal.h" + +#ifndef __WIFI_HAL_RTT_H__ +#define __WIFI_HAL_RTT_H__ + +/* Ranging status */ +typedef enum { + RTT_STATUS_SUCCESS = 0, + RTT_STATUS_FAILURE = 1, // general failure status + RTT_STATUS_FAIL_NO_RSP = 2, // target STA does not respond to request + RTT_STATUS_FAIL_REJECTED = 3, // request rejected. Applies to 2-sided RTT only + RTT_STATUS_FAIL_NOT_SCHEDULED_YET = 4, + RTT_STATUS_FAIL_TM_TIMEOUT = 5, // timing measurement times out + RTT_STATUS_FAIL_AP_ON_DIFF_CHANNEL = 6, // Target on different channel, cannot range + RTT_STATUS_FAIL_NO_CAPABILITY = 7, // ranging not supported + RTT_STATUS_ABORTED = 8, // request aborted for unknown reason + RTT_STATUS_FAIL_INVALID_TS = 9, // Invalid T1-T4 timestamp + RTT_STATUS_FAIL_PROTOCOL = 10, // 11mc protocol failed + RTT_STATUS_FAIL_SCHEDULE = 11, // request could not be scheduled + RTT_STATUS_FAIL_BUSY_TRY_LATER = 12, // responder cannot collaborate at time of request + RTT_STATUS_INVALID_REQ = 13, // bad request args + RTT_STATUS_NO_WIFI = 14, // WiFi not enabled + RTT_STATUS_FAIL_FTM_PARAM_OVERRIDE = + 15, // Responder overrides param info, cannot range with new params + RTT_STATUS_NAN_RANGING_PROTOCOL_FAILURE = 16, // Negotiation failure + RTT_STATUS_NAN_RANGING_CONCURRENCY_NOT_SUPPORTED = 17, // concurrency not supported (NDP+RTT) +} wifi_rtt_status; + +/* RTT peer type */ +typedef enum { + RTT_PEER_AP = 0x1, + RTT_PEER_STA = 0x2, + RTT_PEER_P2P_GO = 0x3, + RTT_PEER_P2P_CLIENT = 0x4, + RTT_PEER_NAN = 0x5 +} rtt_peer_type; + +/* RTT Measurement Bandwidth */ +typedef enum { + WIFI_RTT_BW_5 = 0x01, + WIFI_RTT_BW_10 = 0x02, + WIFI_RTT_BW_20 = 0x04, + WIFI_RTT_BW_40 = 0x08, + WIFI_RTT_BW_80 = 0x10, + WIFI_RTT_BW_160 = 0x20, + WIFI_RTT_BW_320 = 0x40 +} wifi_rtt_bw; + +/* RTT Measurement Preamble */ +typedef enum { + WIFI_RTT_PREAMBLE_LEGACY = 0x1, + WIFI_RTT_PREAMBLE_HT = 0x2, + WIFI_RTT_PREAMBLE_VHT = 0x4, + WIFI_RTT_PREAMBLE_HE = 0x8, + WIFI_RTT_PREAMBLE_EHT = 0x10, +} wifi_rtt_preamble; + +/* RTT Type */ +typedef enum { + RTT_TYPE_1_SIDED = 0x1, + RTT_TYPE_2_SIDED = 0x2, +} wifi_rtt_type; + +/* RTT configuration */ +typedef struct { + mac_addr addr; // peer device mac address + wifi_rtt_type type; // 1-sided or 2-sided RTT + rtt_peer_type peer; // optional - peer device hint (STA, P2P, AP) + wifi_channel_info channel; // Required for STA-AP mode, optional for P2P, NBD etc. + unsigned burst_period; // Time interval between bursts (units: 100 ms). + // Applies to 1-sided and 2-sided RTT multi-burst requests. + // Range: 0-31, 0: no preference by initiator (2-sided RTT) + unsigned num_burst; // Total number of RTT bursts to be executed. It will be + // specified in the same way as the parameter "Number of + // Burst Exponent" found in the FTM frame format. It + // applies to both: 1-sided RTT and 2-sided RTT. Valid + // values are 0 to 15 as defined in 802.11mc std. + // 0 means single shot + // The implication of this parameter on the maximum + // number of RTT results is the following: + // for 1-sided RTT: max num of RTT results = + // (2^num_burst)*(num_frames_per_burst) for 2-sided RTT: max num of RTT + // results = (2^num_burst)*(num_frames_per_burst - 1) + unsigned num_frames_per_burst; // num of frames per burst. + // Minimum value = 1, Maximum value = 31 + // For 2-sided this equals the number of FTM frames + // to be attempted in a single burst. This also + // equals the number of FTM frames that the + // initiator will request that the responder send + // in a single frame. + unsigned + num_retries_per_rtt_frame; // number of retries for a failed RTT frame. Applies + // to 1-sided RTT only. Minimum value = 0, Maximum value = 3 + + // following fields are only valid for 2-side RTT + unsigned num_retries_per_ftmr; // Maximum number of retries that the initiator can + // retry an FTMR frame. + // Minimum value = 0, Maximum value = 3 + byte LCI_request; // 1: request LCI, 0: do not request LCI + byte LCR_request; // 1: request LCR, 0: do not request LCR + unsigned burst_duration; // Applies to 1-sided and 2-sided RTT. Valid values will + // be 2-11 and 15 as specified by the 802.11mc std for + // the FTM parameter burst duration. In a multi-burst + // request, if responder overrides with larger value, + // the initiator will return failure. In a single-burst + // request if responder overrides with larger value, + // the initiator will sent TMR_STOP to terminate RTT + // at the end of the burst_duration it requested. + wifi_rtt_preamble preamble; // RTT preamble to be used in the RTT frames + wifi_rtt_bw bw; // RTT BW to be used in the RTT frames +} wifi_rtt_config; + +/* RTT results */ +typedef struct { + mac_addr addr; // device mac address + unsigned burst_num; // burst number in a multi-burst request + unsigned measurement_number; // Total RTT measurement frames attempted + unsigned success_number; // Total successful RTT measurement frames + byte number_per_burst_peer; // Maximum number of "FTM frames per burst" supported by + // the responder STA. Applies to 2-sided RTT only. + // If reponder overrides with larger value: + // - for single-burst request initiator will truncate the + // larger value and send a TMR_STOP after receiving as + // many frames as originally requested. + // - for multi-burst request, initiator will return + // failure right away. + wifi_rtt_status status; // ranging status + byte retry_after_duration; // When status == RTT_STATUS_FAIL_BUSY_TRY_LATER, + // this will be the time provided by the responder as to + // when the request can be tried again. Applies to 2-sided + // RTT only. In sec, 1-31sec. + wifi_rtt_type type; // RTT type + wifi_rssi rssi; // average rssi in 0.5 dB steps e.g. 143 implies -71.5 dB + wifi_rssi rssi_spread; // rssi spread in 0.5 dB steps e.g. 5 implies 2.5 dB spread (optional) + wifi_rate tx_rate; // 1-sided RTT: TX rate of RTT frame. + // 2-sided RTT: TX rate of initiator's Ack in response to FTM frame. + wifi_rate rx_rate; // 1-sided RTT: TX rate of Ack from other side. + // 2-sided RTT: TX rate of FTM frame coming from responder. + wifi_timespan rtt; // round trip time in picoseconds + wifi_timespan rtt_sd; // rtt standard deviation in picoseconds + wifi_timespan rtt_spread; // difference between max and min rtt times recorded in picoseconds + int distance_mm; // distance in mm (optional) + int distance_sd_mm; // standard deviation in mm (optional) + int distance_spread_mm; // difference between max and min distance recorded in mm (optional) + wifi_timestamp ts; // time of the measurement (in microseconds since boot) + int burst_duration; // in ms, actual time taken by the FW to finish one burst + // measurement. Applies to 1-sided and 2-sided RTT. + int negotiated_burst_num; // Number of bursts allowed by the responder. Applies + // to 2-sided RTT only. + wifi_information_element* LCI; // for 11mc only + wifi_information_element* LCR; // for 11mc only +} wifi_rtt_result; + +/* RTT result callback */ +typedef struct { + void (*on_rtt_results)(wifi_request_id id, unsigned num_results, wifi_rtt_result* rtt_result[]); +} wifi_rtt_event_handler; + +/* API to request RTT measurement */ +wifi_error wifi_rtt_range_request(wifi_request_id id, wifi_interface_handle iface, + unsigned num_rtt_config, wifi_rtt_config rtt_config[], + wifi_rtt_event_handler handler); + +/* API to cancel RTT measurements */ +wifi_error wifi_rtt_range_cancel(wifi_request_id id, wifi_interface_handle iface, + unsigned num_devices, mac_addr addr[]); + +/* NBD ranging channel map */ +typedef struct { + wifi_channel availablity[32]; // specifies the channel map for each of the 16 TU windows + // frequency of 0 => unspecified; which means firmware is + // free to do whatever it wants in this window. +} wifi_channel_map; + +/* API to start publishing the channel map on responder device in a NBD cluster. + Responder device will take this request and schedule broadcasting the channel map + in a NBD ranging attribute in a SDF. DE will automatically remove the ranging + attribute from the OTA queue after number of DW specified by num_dw + where Each DW is 512 TUs apart */ +wifi_error wifi_rtt_channel_map_set(wifi_request_id id, wifi_interface_handle iface, + wifi_channel_map* params, unsigned num_dw); + +/* API to clear the channel map on the responder device in a NBD cluster. + Responder device will cancel future ranging channel request, starting from “next” + DW interval and will also stop broadcasting NBD ranging attribute in SDF */ +wifi_error wifi_rtt_channel_map_clear(wifi_request_id id, wifi_interface_handle iface); + +// Preamble definition for bit mask used in wifi_rtt_capabilities +#define PREAMBLE_LEGACY 0x1 +#define PREAMBLE_HT 0x2 +#define PREAMBLE_VHT 0x4 +#define PREAMBLE_HE 0x8 +#define PREAMBLE_EHT 0x10 + +// BW definition for bit mask used in wifi_rtt_capabilities +#define BW_5_SUPPORT 0x1 +#define BW_10_SUPPORT 0x2 +#define BW_20_SUPPORT 0x4 +#define BW_40_SUPPORT 0x8 +#define BW_80_SUPPORT 0x10 +#define BW_160_SUPPORT 0x20 +#define BW_320_SUPPORT 0x40 + +/* RTT Capabilities */ +typedef struct { + byte rtt_one_sided_supported; // if 1-sided rtt data collection is supported + byte rtt_ftm_supported; // if ftm rtt data collection is supported + byte lci_support; // if initiator supports LCI request. Applies to 2-sided RTT + byte lcr_support; // if initiator supports LCR request. Applies to 2-sided RTT + byte preamble_support; // bit mask indicates what preamble is supported by initiator + byte bw_support; // bit mask indicates what BW is supported by initiator + byte responder_supported; // if 11mc responder mode is supported + byte mc_version; // draft 11mc spec version supported by chip. For instance, + // version 4.0 should be 40 and version 4.3 should be 43 etc. +} wifi_rtt_capabilities; + +/* RTT capabilities of the device */ +wifi_error wifi_get_rtt_capabilities(wifi_interface_handle iface, + wifi_rtt_capabilities* capabilities); + +/* debugging definitions */ +enum { + RTT_DEBUG_DISABLE, + RTT_DEBUG_LOG, + RTT_DEBUG_PROTO, + RTT_DEBUG_BURST, + RTT_DEBUG_ACCURACY, + RTT_DEBUG_LOGDETAIL +}; // rtt debug type + +enum { RTT_DEBUG_FORMAT_TXT, RTT_DEBUG_FORMAT_BINARY }; // rtt debug format + +typedef struct rtt_debug { + unsigned version; + unsigned len; // total length of after len field + unsigned type; // rtt debug type + unsigned format; // rtt debug format + char dbuf[0]; // debug content +} rtt_debug_t; + +/* set configuration for debug */ +wifi_error wifi_rtt_debug_cfg(wifi_interface_handle h, unsigned rtt_dbg_type, char* cfgbuf, + unsigned cfg_buf_size); +/* get the debug information */ +wifi_error wifi_rtt_debug_get(wifi_interface_handle h, rtt_debug_t** debugbuf); +/* free the debug buffer */ +wifi_error wifi_rtt_debug_free(wifi_interface_handle h, rtt_debug_t* debugbuf); + +/* API for setting LCI/LCR information to be provided to a requestor */ +typedef enum { + WIFI_MOTION_NOT_EXPECTED = 0, // Not expected to change location + WIFI_MOTION_EXPECTED = 1, // Expected to change location + WIFI_MOTION_UNKNOWN = 2, // Movement pattern unknown +} wifi_motion_pattern; + +typedef struct { + long latitude; // latitude in degrees * 2^25 , 2's complement + long longitude; // latitude in degrees * 2^25 , 2's complement + int altitude; // Altitude in units of 1/256 m + byte latitude_unc; // As defined in Section 2.3.2 of IETF RFC 6225 + byte longitude_unc; // As defined in Section 2.3.2 of IETF RFC 6225 + byte altitude_unc; // As defined in Section 2.4.5 from IETF RFC 6225: + + // Following element for configuring the Z subelement + wifi_motion_pattern motion_pattern; + int floor; // floor in units of 1/16th of floor. 0x80000000 if unknown. + int height_above_floor; // in units of 1/64 m + int height_unc; // in units of 1/64 m. 0 if unknown +} wifi_lci_information; + +typedef struct { + char country_code[2]; // country code + int length; // length of the info field + char civic_info[256]; // Civic info to be copied in FTM frame +} wifi_lcr_information; + +// API to configure the LCI. Used in RTT Responder mode only +wifi_error wifi_set_lci(wifi_request_id id, wifi_interface_handle iface, wifi_lci_information* lci); + +// API to configure the LCR. Used in RTT Responder mode only. +wifi_error wifi_set_lcr(wifi_request_id id, wifi_interface_handle iface, wifi_lcr_information* lcr); + +/** + * RTT Responder information + */ +typedef struct { + wifi_channel_info channel; + wifi_rtt_preamble preamble; +} wifi_rtt_responder; + +/** + * Get RTT responder information e.g. WiFi channel to enable responder on. + */ +wifi_error wifi_rtt_get_responder_info(wifi_interface_handle iface, + wifi_rtt_responder* responder_info); + +/** + * Enable RTT responder mode. + * channel_hint - hint of the channel information where RTT responder should be enabled on. + * max_duration_seconds - timeout of responder mode. + * channel_used - channel used for RTT responder, NULL if responder is not enabled. + */ +wifi_error wifi_enable_responder(wifi_request_id id, wifi_interface_handle iface, + wifi_channel_info channel_hint, unsigned max_duration_seconds, + wifi_rtt_responder* responder_info); + +/** + * Disable RTT responder mode. + */ +wifi_error wifi_disable_responder(wifi_request_id id, wifi_interface_handle iface); + +#endif diff --git a/wifi/1.6/default/hal_legacy/tdls.h b/wifi/1.6/default/hal_legacy/tdls.h new file mode 100644 index 0000000000..787b13a338 --- /dev/null +++ b/wifi/1.6/default/hal_legacy/tdls.h @@ -0,0 +1,84 @@ + +#include "wifi_hal.h" + +#ifndef _TDLS_H_ +#define _TDLS_H_ + +typedef enum { + WIFI_TDLS_DISABLED = 1, /* TDLS is not enabled, default status for all STAs */ + WIFI_TDLS_ENABLED, /* TDLS is enabled, but not yet tried */ + WIFI_TDLS_ESTABLISHED, /* Direct link is established */ + WIFI_TDLS_ESTABLISHED_OFF_CHANNEL, /* Direct link is established using MCC */ + WIFI_TDLS_DROPPED, /* Direct link was established, + * but is temporarily dropped now */ + WIFI_TDLS_FAILED /* TDLS permanent failed. Inform error to upper layer + * and go back to WIFI_TDLS_DISABLED */ +} wifi_tdls_state; + +typedef enum { + WIFI_TDLS_SUCCESS, /* Success */ + WIFI_TDLS_UNSPECIFIED = -1, /* Unspecified reason */ + WIFI_TDLS_NOT_SUPPORTED = -2, /* Remote side doesn't support TDLS */ + WIFI_TDLS_UNSUPPORTED_BAND = -3, /* Remote side doesn't support this band */ + WIFI_TDLS_NOT_BENEFICIAL = -4, /* Going to AP is better than going direct */ + WIFI_TDLS_DROPPED_BY_REMOTE = -5 /* Remote side doesn't want it anymore */ +} wifi_tdls_reason; + +typedef struct { + int channel; /* channel hint, in channel number (NOT frequency ) */ + int global_operating_class; /* operating class to use */ + int max_latency_ms; /* max latency that can be tolerated by apps */ + int min_bandwidth_kbps; /* bandwidth required by apps, in kilo bits per second */ +} wifi_tdls_params; + +typedef struct { + int channel; + int global_operating_class; + wifi_tdls_state state; + wifi_tdls_reason reason; +} wifi_tdls_status; + +typedef struct { + int max_concurrent_tdls_session_num; /* Maximum TDLS session number can be supported by the + * Firmware and hardware*/ + int is_global_tdls_supported; /* 1 -- support, 0 -- not support */ + int is_per_mac_tdls_supported; /* 1 -- support, 0 -- not support */ + int is_off_channel_tdls_supported; /* 1 -- support, 0 -- not support */ +} wifi_tdls_capabilities; + +typedef struct { + /* on_tdls_state_changed - reports state of TDLS link to framework + * Report this event when the state of TDLS link changes */ + void (*on_tdls_state_changed)(mac_addr addr, wifi_tdls_status status); +} wifi_tdls_handler; + +/* wifi_enable_tdls - enables TDLS-auto mode for a specific route + * + * params specifies hints, which provide more information about + * why TDLS is being sought. The firmware should do its best to + * honor the hints before downgrading regular AP link + * If upper layer has no specific values, this should be NULL + * + * handler is used to inform the upper layer about the status change and the corresponding reason + */ +wifi_error wifi_enable_tdls(wifi_interface_handle iface, mac_addr addr, wifi_tdls_params* params, + wifi_tdls_handler handler); + +/* wifi_disable_tdls - disables TDLS-auto mode for a specific route + * + * This terminates any existing TDLS with addr device, and frees the + * device resources to make TDLS connections on new routes. + * + * DON'T fire any more events on 'handler' specified in earlier call to + * wifi_enable_tdls after this action. + */ +wifi_error wifi_disable_tdls(wifi_interface_handle iface, mac_addr addr); + +/* wifi_get_tdls_status - allows getting the status of TDLS for a specific route */ +wifi_error wifi_get_tdls_status(wifi_interface_handle iface, mac_addr addr, + wifi_tdls_status* status); + +/* return the current HW + Firmware combination's TDLS capabilities */ +wifi_error wifi_get_tdls_capabilities(wifi_interface_handle iface, + wifi_tdls_capabilities* capabilities); +#endif diff --git a/wifi/1.6/default/hal_legacy/uevent.h b/wifi/1.6/default/hal_legacy/uevent.h new file mode 100644 index 0000000000..5b82b327e4 --- /dev/null +++ b/wifi/1.6/default/hal_legacy/uevent.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2008 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. + */ + +#ifndef _HARDWARE_UEVENT_H +#define _HARDWARE_UEVENT_H + +#if __cplusplus +extern "C" { +#endif + +int uevent_init(); +int uevent_get_fd(); +int uevent_next_event(char* buffer, int buffer_length); +int uevent_add_native_handler(void (*handler)(void* data, const char* msg, int msg_len), + void* handler_data); +int uevent_remove_native_handler(void (*handler)(void* data, const char* msg, int msg_len)); + +#if __cplusplus +} // extern "C" +#endif + +#endif // _HARDWARE_UEVENT_H diff --git a/wifi/1.6/default/hal_legacy/wifi_cached_scan_results.h b/wifi/1.6/default/hal_legacy/wifi_cached_scan_results.h new file mode 100644 index 0000000000..c7392c24f1 --- /dev/null +++ b/wifi/1.6/default/hal_legacy/wifi_cached_scan_results.h @@ -0,0 +1,92 @@ +/* + * 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. + */ + +#ifndef __WIFI_CACHED_SCAN_RESULTS_H__ +#define __WIFI_CACHED_SCAN_RESULTS_H__ + +#include "wifi_hal.h" + +#define WIFI_CACHED_SCAN_RESULT_FLAGS_NONE (0) +/* Element ID 61 (HT Operation) is present (see HT 7.3.2) */ +#define WIFI_CACHED_SCAN_RESULT_FLAGS_HT_OPS_PRESENT (1 << 0) +/* Element ID 192 (VHT Operation) is present (see VHT 8.4.2) */ +#define WIFI_CACHED_SCAN_RESULT_FLAGS_VHT_OPS_PRESENT (1 << 1) +/* Element ID 255 + Extension 36 (HE Operation) is present + * (see 802.11ax 9.4.2.1) + */ +#define WIFI_CACHED_SCAN_RESULT_FLAGS_HE_OPS_PRESENT (1 << 2) +/* Element ID 255 + Extension 106 (HE Operation) is present + * (see 802.11be D1.5 9.4.2.1) + */ +#define WIFI_CACHED_SCAN_RESULT_FLAGS_EHT_OPS_PRESENT (1 << 3) +/* Element ID 127 (Extended Capabilities) is present, and bit 70 + * (Fine Timing Measurement Responder) is set to 1 + * (see IEEE Std 802.11-2016 9.4.2.27) + */ +#define WIFI_CACHED_SCAN_RESULT_FLAGS_IS_FTM_RESPONDER (1 << 4) + +/** + * Provides information about a single access point (AP) detected in a scan. + */ +typedef struct { + /* Number of milliseconds prior to ts in the enclosing + * wifi_cached_scan_result_report struct when + * the probe response or beacon frame that + * was used to populate this structure was received. + */ + u32 age_ms; + /* The Capability Information field */ + u16 capability; + /* null terminated */ + u8 ssid[33]; + u8 ssid_len; + u8 bssid[6]; + /* A set of flags from WIFI_CACHED_SCAN_RESULT_FLAGS_* */ + u8 flags; + s8 rssi; + wifi_channel_spec chanspec; +} wifi_cached_scan_result; + +/* + * Data structure sent with events of type WifiCachedScanResult. + */ +typedef struct { + /* time since boot (in microsecond) when the result was retrieved */ + wifi_timestamp ts; + /* If 0, indicates that all frequencies in current regulation were + * scanned. Otherwise, indicates the number of frequencies scanned, as + * specified in scanned_freq_list. + */ + u16 scanned_freq_num; + /* Pointer to an array containing scanned_freq_num values comprising the + * set of frequencies that were scanned. Frequencies are specified as + * channel center frequencies in MHz. May be NULL if scannedFreqListLen is + * 0. + */ + const u32* scanned_freq_list; + /* The total number of cached results returned. */ + u8 result_cnt; + /* Pointer to an array containing result_cnt entries. May be NULL if + * result_cnt is 0. + */ + const wifi_cached_scan_result* results; +} wifi_cached_scan_report; + +/* callback for reporting cached scan report */ +typedef struct { + void (*on_cached_scan_results)(wifi_cached_scan_report* cache_report); +} wifi_cached_scan_result_handler; +#endif diff --git a/wifi/1.6/default/hal_legacy/wifi_config.h b/wifi/1.6/default/hal_legacy/wifi_config.h new file mode 100644 index 0000000000..459a3feb61 --- /dev/null +++ b/wifi/1.6/default/hal_legacy/wifi_config.h @@ -0,0 +1,44 @@ +#include "wifi_hal.h" + +#ifndef __WIFI_HAL_CONFIG_H +#define __WIFI_HAL_CONFIG_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define CONFIG_MAJOR_VERSION 1 +#define CONFIG_MINOR_VERSION 0 +#define CONFIG_MICRO_VERSION 0 + +// whether the wifi chipset wakes at every dtim beacon or a multiple of the dtim period +// if extended_dtim is set to 3, the STA shall wake up every 3 DTIM beacons +wifi_error wifi_extended_dtim_config_set(wifi_request_id id, wifi_interface_handle iface, + int extended_dtim); + +// set the country code to driver +wifi_error wifi_set_country_code(wifi_interface_handle iface, const char* country_code); + +// set the wifi_iface stats averaging factor used to calculate +// statistics like average the TSF offset or average number of frame leaked +// For instance, upon beacon reception: +// current_avg = ((beacon_TSF - TBTT) * factor + previous_avg * (0x10000 - factor) ) / 0x10000 +// For instance, when evaluating leaky APs: +// current_avg = ((num frame received within guard time) * factor + previous_avg * (0x10000 - +// factor)) / 0x10000 + +wifi_error wifi_set_beacon_wifi_iface_stats_averaging_factor(wifi_request_id id, + wifi_interface_handle iface, + u16 factor); + +// configure guard time, i.e. when implementing IEEE power management based on +// frame control PM bit, how long driver waits before shutting down the radio and +// after receiving an ACK for a data frame with PM bit set +wifi_error wifi_set_guard_time(wifi_request_id id, wifi_interface_handle iface, u32 guard_time); + +#ifdef __cplusplus +} + +#endif /* __cplusplus */ + +#endif /*__WIFI_HAL_STATS_ */ diff --git a/wifi/1.6/default/hal_legacy/wifi_hal.h b/wifi/1.6/default/hal_legacy/wifi_hal.h new file mode 100644 index 0000000000..383ba718a3 --- /dev/null +++ b/wifi/1.6/default/hal_legacy/wifi_hal.h @@ -0,0 +1,1020 @@ +/* + * Copyright (C) 2016 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. + */ + +#ifndef __WIFI_HAL_H__ +#define __WIFI_HAL_H__ + +#ifdef __cplusplus +extern "C" { +#endif +#include + +#define IFNAMSIZ 16 + +/* typedefs */ +typedef unsigned char byte; +typedef unsigned char u8; +typedef signed char s8; +typedef uint16_t u16; +typedef uint32_t u32; +typedef int32_t s32; +typedef uint64_t u64; +typedef int64_t s64; +typedef int wifi_request_id; +typedef int wifi_channel; // indicates channel frequency in MHz +typedef int wifi_rssi; +typedef int wifi_radio; +typedef byte mac_addr[6]; +typedef byte oui[3]; +typedef int64_t wifi_timestamp; // In microseconds (us) +typedef int64_t wifi_timespan; // In picoseconds (ps) +typedef uint64_t feature_set; + +/* forward declarations */ +struct wifi_info; +struct wifi_interface_info; +typedef struct wifi_info* wifi_handle; +typedef struct wifi_interface_info* wifi_interface_handle; + +/* WiFi Common definitions */ +/* channel operating width */ +typedef enum { + WIFI_CHAN_WIDTH_20 = 0, + WIFI_CHAN_WIDTH_40 = 1, + WIFI_CHAN_WIDTH_80 = 2, + WIFI_CHAN_WIDTH_160 = 3, + WIFI_CHAN_WIDTH_80P80 = 4, + WIFI_CHAN_WIDTH_5 = 5, + WIFI_CHAN_WIDTH_10 = 6, + WIFI_CHAN_WIDTH_320 = 7, + WIFI_CHAN_WIDTH_INVALID = -1 +} wifi_channel_width; + +/* Pre selected Power scenarios to be applied from BDF file */ +typedef enum { + WIFI_POWER_SCENARIO_INVALID = -2, + WIFI_POWER_SCENARIO_DEFAULT = -1, + WIFI_POWER_SCENARIO_VOICE_CALL = 0, + WIFI_POWER_SCENARIO_ON_HEAD_CELL_OFF = 1, + WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON = 2, + WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF = 3, + WIFI_POWER_SCENARIO_ON_BODY_CELL_ON = 4, + WIFI_POWER_SCENARIO_ON_BODY_BT = 5, + WIFI_POWER_SCENARIO_ON_HEAD_HOTSPOT = 6, + WIFI_POWER_SCENARIO_ON_HEAD_HOTSPOT_MMW = 7, + WIFI_POWER_SCENARIO_ON_BODY_CELL_ON_BT = 8, + WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT = 9, + WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_BT = 10, + WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_MMW = 11, + WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_BT_MMW = 12, + WIFI_POWER_SCENARIO_ON_HEAD_CELL_OFF_UNFOLDED = 13, + WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON_UNFOLDED = 14, + WIFI_POWER_SCENARIO_ON_HEAD_HOTSPOT_UNFOLDED = 15, + WIFI_POWER_SCENARIO_ON_HEAD_HOTSPOT_MMW_UNFOLDED = 16, + WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF_UNFOLDED = 17, + WIFI_POWER_SCENARIO_ON_BODY_BT_UNFOLDED = 18, + WIFI_POWER_SCENARIO_ON_BODY_CELL_ON_UNFOLDED = 19, + WIFI_POWER_SCENARIO_ON_BODY_CELL_ON_BT_UNFOLDED = 20, + WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_UNFOLDED = 21, + WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_BT_UNFOLDED = 22, + WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_MMW_UNFOLDED = 23, + WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_BT_MMW_UNFOLDED = 24, +} wifi_power_scenario; + +typedef enum { + WIFI_LATENCY_MODE_NORMAL = 0, + WIFI_LATENCY_MODE_LOW = 1, +} wifi_latency_mode; + +/* Wifi Thermal mitigation modes */ +typedef enum { + WIFI_MITIGATION_NONE = 0, + WIFI_MITIGATION_LIGHT = 1, + WIFI_MITIGATION_MODERATE = 2, + WIFI_MITIGATION_SEVERE = 3, + WIFI_MITIGATION_CRITICAL = 4, + WIFI_MITIGATION_EMERGENCY = 5, +} wifi_thermal_mode; + +/* + * Wifi voice over IP mode + * may add new modes later, for example, voice + video over IP mode. + */ +typedef enum { + WIFI_VOIP_MODE_OFF = 0, + WIFI_VOIP_MODE_ON = 1, +} wifi_voip_mode; + +/* List of interface types supported */ +typedef enum { + WIFI_INTERFACE_TYPE_STA = 0, + WIFI_INTERFACE_TYPE_AP = 1, + WIFI_INTERFACE_TYPE_P2P = 2, + WIFI_INTERFACE_TYPE_NAN = 3, +} wifi_interface_type; + +/* + * enum wlan_mac_band - Band information corresponding to the WLAN MAC. + */ +typedef enum { + /* WLAN MAC Operates in 2.4 GHz Band */ + WLAN_MAC_2_4_BAND = 1 << 0, + /* WLAN MAC Operates in 5 GHz Band */ + WLAN_MAC_5_0_BAND = 1 << 1, + /* WLAN MAC Operates in 6 GHz Band */ + WLAN_MAC_6_0_BAND = 1 << 2, + /* WLAN MAC Operates in 60 GHz Band */ + WLAN_MAC_60_0_BAND = 1 << 3, +} wlan_mac_band; + +/* List of chre nan rtt state */ +typedef enum { + CHRE_PREEMPTED = 0, + CHRE_UNAVAILABLE = 1, + CHRE_AVAILABLE = 2, +} chre_nan_rtt_state; + +typedef struct { + wifi_channel_width width; + int center_frequency0; + int center_frequency1; + int primary_frequency; +} wifi_channel_spec; + +/* + * wifi_usable_channel specifies a channel frequency, bandwidth, and bitmask + * of modes allowed on the channel. + */ +typedef struct { + /* Channel frequency in MHz */ + wifi_channel freq; + /* Channel operating width (20, 40, 80, 160, 320 etc.) */ + wifi_channel_width width; + /* BIT MASK of BIT(WIFI_INTERFACE_*) represented by |wifi_interface_mode| + * Bitmask does not represent concurrency. + * Examples: + * - If a channel is usable only for STA, then only the WIFI_INTERFACE_STA + * bit would be set for that channel. + * - If 5GHz SAP is not allowed, then none of the 5GHz channels will have + * WIFI_INTERFACE_SOFTAP bit set. + * Note: TDLS bit is set only if there is a STA connection. TDLS bit is set + * on non-STA channels only if TDLS off channel is supported. + */ + u32 iface_mode_mask; +} wifi_usable_channel; + +/* + * wifi_usable_channel_filter + */ +typedef enum { + /* Filter Wifi channels that should be avoided due to cellular coex + * restrictions. Some Wifi channels can have extreme interference + * from/to cellular due to short frequency separation with neighboring + * cellular channels or when there is harmonic and intermodulation + * interference. Channels which only have some performance degradation + * (e.g. power back off is sufficient to deal with coexistence issue) + * can be included and should not be filtered out. + */ + WIFI_USABLE_CHANNEL_FILTER_CELLULAR_COEXISTENCE = 1 << 0, + /* Filter channels due to concurrency state. + * Examples: + * - 5GHz SAP operation may be supported in standalone mode, but if + * there is STA connection on 5GHz DFS channel, none of the 5GHz + * channels are usable for SAP if device does not support DFS SAP mode. + * - P2P GO may not be supported on indoor channels in EU during + * standalone mode but if there is a STA connection on indoor channel, + * P2P GO may be supported by some vendors on the same STA channel. + */ + WIFI_USABLE_CHANNEL_FILTER_CONCURRENCY = 1 << 1, + /* This Filter queries Wifi channels and bands that are supported for + * NAN3.1 Instant communication mode. This filter should only be applied to NAN interface. + * If 5G is supported default discovery channel 149/44 is considered, + * If 5G is not supported then channel 6 has to be considered. + * Based on regulatory domain if channel 149 and 44 are restricted, channel 6 should + * be considered for instant communication channel + */ + WIFI_USABLE_CHANNEL_FILTER_NAN_INSTANT_MODE = 1 << 2, +} wifi_usable_channel_filter; + +typedef enum { + WIFI_SUCCESS = 0, + WIFI_ERROR_NONE = 0, + WIFI_ERROR_UNKNOWN = -1, + WIFI_ERROR_UNINITIALIZED = -2, + WIFI_ERROR_NOT_SUPPORTED = -3, + WIFI_ERROR_NOT_AVAILABLE = -4, // Not available right now, but try later + WIFI_ERROR_INVALID_ARGS = -5, + WIFI_ERROR_INVALID_REQUEST_ID = -6, + WIFI_ERROR_TIMED_OUT = -7, + WIFI_ERROR_TOO_MANY_REQUESTS = -8, // Too many instances of this request + WIFI_ERROR_OUT_OF_MEMORY = -9, + WIFI_ERROR_BUSY = -10, +} wifi_error; + +typedef enum { + WIFI_ACCESS_CATEGORY_BEST_EFFORT = 0, + WIFI_ACCESS_CATEGORY_BACKGROUND = 1, + WIFI_ACCESS_CATEGORY_VIDEO = 2, + WIFI_ACCESS_CATEGORY_VOICE = 3 +} wifi_access_category; + +/* Antenna configuration */ +typedef enum { + WIFI_ANTENNA_UNSPECIFIED = 0, + WIFI_ANTENNA_1X1 = 1, + WIFI_ANTENNA_2X2 = 2, + WIFI_ANTENNA_3X3 = 3, + WIFI_ANTENNA_4X4 = 4, +} wifi_antenna_configuration; + +/* Wifi Radio configuration */ +typedef struct { + /* Operating band */ + wlan_mac_band band; + /* Antenna configuration */ + wifi_antenna_configuration antenna_cfg; +} wifi_radio_configuration; + +/* WiFi Radio Combination */ +typedef struct { + u32 num_radio_configurations; + wifi_radio_configuration radio_configurations[]; +} wifi_radio_combination; + +/* WiFi Radio combinations matrix */ +/* For Example in case of a chip which has two radios, where one radio is + * capable of 2.4GHz 2X2 only and another radio which is capable of either + * 5GHz or 6GHz 2X2, number of possible radio combinations in this case + * are 5 and possible combinations are + * {{{2G 2X2}}, //Standalone 2G + * {{5G 2X2}}, //Standalone 5G + * {{6G 2X2}}, //Standalone 6G + * {{2G 2X2}, {5G 2X2}}, //2G+5G DBS + * {{2G 2X2}, {6G 2X2}}} //2G+6G DBS + * Note: Since this chip doesn’t support 5G+6G simultaneous operation + * as there is only one radio which can support both, So it can only + * do MCC 5G+6G. This table should not get populated with possible MCC + * configurations. This is only for simultaneous radio configurations + * (such as Standalone, multi band simultaneous or single band simultaneous). + */ +typedef struct { + u32 num_radio_combinations; + /* Each row represents possible radio combinations */ + wifi_radio_combination radio_combinations[]; +} wifi_radio_combination_matrix; + +/* Initialize/Cleanup */ + +wifi_error wifi_initialize(wifi_handle* handle); + +/** + * wifi_wait_for_driver + * Function should block until the driver is ready to proceed. + * Any errors from this function is considered fatal & will fail the HAL startup sequence. + * + * on success returns WIFI_SUCCESS + * on failure returns WIFI_ERROR_TIMED_OUT + */ +wifi_error wifi_wait_for_driver_ready(void); + +typedef void (*wifi_cleaned_up_handler)(wifi_handle handle); +void wifi_cleanup(wifi_handle handle, wifi_cleaned_up_handler handler); +void wifi_event_loop(wifi_handle handle); + +/* Error handling */ +void wifi_get_error_info(wifi_error err, const char** msg); // return a pointer to a static string + +/* Feature enums */ +#define WIFI_FEATURE_INFRA (uint64_t)0x1 // Basic infrastructure mode +#define WIFI_FEATURE_INFRA_5G (uint64_t)0x2 // Support for 5 GHz Band +#define WIFI_FEATURE_HOTSPOT (uint64_t)0x4 // Support for GAS/ANQP +#define WIFI_FEATURE_P2P (uint64_t)0x8 // Wifi-Direct +#define WIFI_FEATURE_SOFT_AP (uint64_t)0x10 // Soft AP +#define WIFI_FEATURE_GSCAN (uint64_t)0x20 // Google-Scan APIs +#define WIFI_FEATURE_NAN (uint64_t)0x40 // Neighbor Awareness Networking +#define WIFI_FEATURE_D2D_RTT (uint64_t)0x80 // Device-to-device RTT +#define WIFI_FEATURE_D2AP_RTT (uint64_t)0x100 // Device-to-AP RTT +#define WIFI_FEATURE_BATCH_SCAN (uint64_t)0x200 // Batched Scan (legacy) +#define WIFI_FEATURE_PNO (uint64_t)0x400 // Preferred network offload +#define WIFI_FEATURE_ADDITIONAL_STA (uint64_t)0x800 // Support for two STAs +#define WIFI_FEATURE_TDLS (uint64_t)0x1000 // Tunnel directed link setup +#define WIFI_FEATURE_TDLS_OFFCHANNEL (uint64_t)0x2000 // Support for TDLS off channel +#define WIFI_FEATURE_EPR (uint64_t)0x4000 // Enhanced power reporting +#define WIFI_FEATURE_AP_STA (uint64_t)0x8000 // Support for AP STA Concurrency +#define WIFI_FEATURE_LINK_LAYER_STATS (uint64_t)0x10000 // Link layer stats collection +#define WIFI_FEATURE_LOGGER (uint64_t)0x20000 // WiFi Logger +#define WIFI_FEATURE_HAL_EPNO (uint64_t)0x40000 // WiFi PNO enhanced +#define WIFI_FEATURE_RSSI_MONITOR (uint64_t)0x80000 // RSSI Monitor +#define WIFI_FEATURE_MKEEP_ALIVE (uint64_t)0x100000 // WiFi mkeep_alive +#define WIFI_FEATURE_CONFIG_NDO (uint64_t)0x200000 // ND offload configure +#define WIFI_FEATURE_TX_TRANSMIT_POWER (uint64_t)0x400000 // Capture Tx transmit power levels +#define WIFI_FEATURE_CONTROL_ROAMING (uint64_t)0x800000 // Enable/Disable firmware roaming +#define WIFI_FEATURE_IE_WHITELIST (uint64_t)0x1000000 // Support Probe IE white listing +#define WIFI_FEATURE_SCAN_RAND \ + (uint64_t)0x2000000 // Support MAC & Probe Sequence Number randomization +#define WIFI_FEATURE_SET_TX_POWER_LIMIT (uint64_t)0x4000000 // Support Tx Power Limit setting +#define WIFI_FEATURE_USE_BODY_HEAD_SAR \ + (uint64_t)0x8000000 // Support Using Body/Head Proximity for SAR +#define WIFI_FEATURE_DYNAMIC_SET_MAC \ + (uint64_t)0x10000000 // Support changing MAC address without iface reset(down and up) +#define WIFI_FEATURE_SET_LATENCY_MODE (uint64_t)0x40000000 // Support Latency mode setting +#define WIFI_FEATURE_P2P_RAND_MAC (uint64_t)0x80000000 // Support P2P MAC randomization +#define WIFI_FEATURE_INFRA_60G (uint64_t)0x100000000 // Support for 60GHz Band +// Add more features here + +#define IS_MASK_SET(mask, flags) (((flags) & (mask)) == (mask)) + +#define IS_SUPPORTED_FEATURE(feature, featureSet) IS_MASK_SET(feature, featureSet) + +/* Feature set */ +wifi_error wifi_get_supported_feature_set(wifi_interface_handle handle, feature_set* set); + +/* + * Each row represents a valid feature combination; + * all other combinations are invalid! + */ +wifi_error wifi_get_concurrency_matrix(wifi_interface_handle handle, int set_size_max, + feature_set set[], int* set_size); + +/* multiple interface support */ + +wifi_error wifi_get_ifaces(wifi_handle handle, int* num_ifaces, wifi_interface_handle** ifaces); +wifi_error wifi_get_iface_name(wifi_interface_handle iface, char* name, size_t size); +wifi_interface_handle wifi_get_iface_handle(wifi_handle handle, char* name); + +/* STA + STA support - Supported if WIFI_FEATURE_ADDITIONAL_STA is set */ + +/** + * Invoked to indicate that the provided iface is the primary STA iface when there are more + * than 1 STA iface concurrently active. + * + * Note: If the wifi firmware/chip cannot support multiple instances of any offload + * (like roaming, APF, rssi threshold, etc), the firmware should ensure that these + * offloads are at least enabled for the primary interface. If the new primary interface is + * already connected to a network, the firmware must switch all the offloads on + * this new interface without disconnecting. + */ +wifi_error wifi_multi_sta_set_primary_connection(wifi_handle handle, wifi_interface_handle iface); + +/** + * When there are 2 or more simultaneous STA connections, this use case hint indicates what + * use-case is being enabled by the framework. This use case hint can be used by the firmware + * to modify various firmware configurations like: + * - Allowed BSSIDs the firmware can choose for the initial connection/roaming attempts. + * - Duty cycle to choose for the 2 STA connections if the radio is in MCC mode. + * - Whether roaming, APF and other offloads needs to be enabled or not. + * + * Note: + * - This will be invoked before an active wifi connection is established on the second interface. + * - This use-case hint is implicitly void when the second STA interface is brought down. + */ +typedef enum { + /** + * Usage: + * - This will be sent down for make before break use-case. + * - Platform is trying to speculatively connect to a second network and evaluate it without + * disrupting the primary connection. + * + * Requirements for Firmware: + * - Do not reduce the number of tx/rx chains of primary connection. + * - If using MCC, should set the MCC duty cycle of the primary connection to be higher than + * the secondary connection (maybe 70/30 split). + * - Should pick the best BSSID for the secondary STA (disregard the chip mode) independent of + * the primary STA: + * - Don’t optimize for DBS vs MCC/SCC + * - Should not impact the primary connection’s bssid selection: + * - Don’t downgrade chains of the existing primary connection. + * - Don’t optimize for DBS vs MCC/SCC. + */ + WIFI_DUAL_STA_TRANSIENT_PREFER_PRIMARY = 0, + /** + * Usage: + * - This will be sent down for any app requested peer to peer connections. + * - In this case, both the connections needs to be allocated equal resources. + * - For the peer to peer use case, BSSID for the secondary connection will be chosen by the + * framework. + * + * Requirements for Firmware: + * - Can choose MCC or DBS mode depending on the MCC efficiency and HW capability. + * - If using MCC, set the MCC duty cycle of the primary connection to be equal to the secondary + * connection. + * - Prefer BSSID candidates which will help provide the best "overall" performance for both the + * connections. + */ + WIFI_DUAL_STA_NON_TRANSIENT_UNBIASED = 1 +} wifi_multi_sta_use_case; + +wifi_error wifi_multi_sta_set_use_case(wifi_handle handle, wifi_multi_sta_use_case use_case); + +/* Configuration events */ + +typedef struct { + void (*on_country_code_changed)(char code[2]); // We can get this from supplicant too + + // More event handlers +} wifi_event_handler; + +typedef struct { + char iface_name[IFNAMSIZ + 1]; + wifi_channel channel; +} wifi_iface_info; + +typedef struct { + u32 wlan_mac_id; + /* BIT MASK of BIT(WLAN_MAC*) as represented by wlan_mac_band */ + u32 mac_band; + /* Represents the connected Wi-Fi interfaces associated with each MAC */ + int num_iface; + wifi_iface_info* iface_info; +} wifi_mac_info; + +typedef struct { + void (*on_radio_mode_change)(wifi_request_id id, unsigned num_mac, wifi_mac_info* mac_info); +} wifi_radio_mode_change_handler; + +typedef struct { + void (*on_rssi_threshold_breached)(wifi_request_id id, u8* cur_bssid, s8 cur_rssi); +} wifi_rssi_event_handler; + +typedef struct { + void (*on_subsystem_restart)(const char* error); +} wifi_subsystem_restart_handler; + +typedef struct { + void (*on_chre_nan_rtt_change)(chre_nan_rtt_state state); +} wifi_chre_handler; + +wifi_error wifi_set_iface_event_handler(wifi_request_id id, wifi_interface_handle iface, + wifi_event_handler eh); +wifi_error wifi_reset_iface_event_handler(wifi_request_id id, wifi_interface_handle iface); + +wifi_error wifi_set_nodfs_flag(wifi_interface_handle handle, u32 nodfs); +wifi_error wifi_select_tx_power_scenario(wifi_interface_handle handle, + wifi_power_scenario scenario); +wifi_error wifi_reset_tx_power_scenario(wifi_interface_handle handle); +wifi_error wifi_set_latency_mode(wifi_interface_handle handle, wifi_latency_mode mode); +wifi_error wifi_map_dscp_access_category(wifi_handle handle, uint32_t start, uint32_t end, + uint32_t access_category); +wifi_error wifi_reset_dscp_mapping(wifi_handle handle); + +wifi_error wifi_set_subsystem_restart_handler(wifi_handle handle, + wifi_subsystem_restart_handler handler); + +/** + * Wifi HAL Thermal Mitigation API + * + * wifi_handle : wifi global handle (note: this is not a interface specific + * command). Mitigation is expected to be applied across all active interfaces + * The implementation and the mitigation action mapping to each mode is chip + * specific. Mitigation will be active until Wifi is turned off or + * WIFI_MITIGATION_NONE mode is sent + * + * mode: Thermal mitigation mode + * WIFI_MITIGATION_NONE : Clear all Wifi thermal mitigation actions + * WIFI_MITIGATION_LIGHT : Light Throttling where UX is not impacted + * WIFI_MITIGATION_MODERATE : Moderate throttling where UX not largely impacted + * WIFI_MITIGATION_SEVERE : Severe throttling where UX is largely impacted + * WIFI_MITIGATION_CRITICAL : Platform has done everything to reduce power + * WIFI_MITIGATION_EMERGENCY: Key components in platform are shutting down + * + * completion_window + * Deadline (in milliseconds) to complete this request, value 0 implies apply + * immediately. Deadline is basically a relaxed limit and allows vendors to + * apply the mitigation within the window (if it cannot apply immediately) + * + * Return + * WIFI_ERROR_NOT_SUPPORTED : Chip does not support thermal mitigation + * WIFI_ERROR_BUSY : Mitigation is supported, but retry later + * WIFI_ERROR_NONE : Mitigation request has been accepted + */ +wifi_error wifi_set_thermal_mitigation_mode(wifi_handle handle, wifi_thermal_mode mode, + u32 completion_window); + +typedef struct rx_data_cnt_details_t { + int rx_unicast_cnt; /*Total rx unicast packet which woke up host */ + int rx_multicast_cnt; /*Total rx multicast packet which woke up host */ + int rx_broadcast_cnt; /*Total rx broadcast packet which woke up host */ +} RX_DATA_WAKE_CNT_DETAILS; + +typedef struct rx_wake_pkt_type_classification_t { + int icmp_pkt; /*wake icmp packet count */ + int icmp6_pkt; /*wake icmp6 packet count */ + int icmp6_ra; /*wake icmp6 RA packet count */ + int icmp6_na; /*wake icmp6 NA packet count */ + int icmp6_ns; /*wake icmp6 NS packet count */ + // ToDo: Any more interesting classification to add? +} RX_WAKE_PKT_TYPE_CLASSFICATION; + +typedef struct rx_multicast_cnt_t { + int ipv4_rx_multicast_addr_cnt; /*Rx wake packet was ipv4 multicast */ + int ipv6_rx_multicast_addr_cnt; /*Rx wake packet was ipv6 multicast */ + int other_rx_multicast_addr_cnt; /*Rx wake packet was non-ipv4 and non-ipv6*/ +} RX_MULTICAST_WAKE_DATA_CNT; + +/* + * Structure holding all the driver/firmware wake count reasons. + * + * Buffers for the array fields (cmd_event_wake_cnt/driver_fw_local_wake_cnt) + * are allocated and freed by the framework. The size of each allocated + * array is indicated by the corresponding |_cnt| field. HAL needs to fill in + * the corresponding |_used| field to indicate the number of elements used in + * the array. + */ +typedef struct wlan_driver_wake_reason_cnt_t { + int total_cmd_event_wake; /* Total count of cmd event wakes */ + int* cmd_event_wake_cnt; /* Individual wake count array, each index a reason */ + int cmd_event_wake_cnt_sz; /* Max number of cmd event wake reasons */ + int cmd_event_wake_cnt_used; /* Number of cmd event wake reasons specific to the driver */ + + int total_driver_fw_local_wake; /* Total count of drive/fw wakes, for local reasons */ + int* driver_fw_local_wake_cnt; /* Individual wake count array, each index a reason */ + int driver_fw_local_wake_cnt_sz; /* Max number of local driver/fw wake reasons */ + int driver_fw_local_wake_cnt_used; /* Number of local driver/fw wake reasons specific to the + driver */ + + int total_rx_data_wake; /* total data rx packets, that woke up host */ + RX_DATA_WAKE_CNT_DETAILS rx_wake_details; + RX_WAKE_PKT_TYPE_CLASSFICATION rx_wake_pkt_classification_info; + RX_MULTICAST_WAKE_DATA_CNT rx_multicast_wake_pkt_info; +} WLAN_DRIVER_WAKE_REASON_CNT; + +/* Wi-Fi coex channel avoidance support */ + +#define WIFI_COEX_NO_POWER_CAP (int32_t)0x7FFFFFF + +typedef enum { WIFI_AWARE = 1 << 0, SOFTAP = 1 << 1, WIFI_DIRECT = 1 << 2 } wifi_coex_restriction; + +/** + * Representation of a Wi-Fi channel to be avoided for Wi-Fi coex channel avoidance. + * + * band is represented as an WLAN_MAC* enum value defined in wlan_mac_band. + * If power_cap_dbm is WIFI_COEX_NO_POWER_CAP, then no power cap should be applied if the specified + * channel is used. + */ +typedef struct { + wlan_mac_band band; + u32 channel; + s32 power_cap_dbm; +} wifi_coex_unsafe_channel; + +/* include various feature headers */ + +#include "gscan.h" +#include "link_layer_stats.h" +#include "roam.h" +#include "rtt.h" +#include "tdls.h" +#include "wifi_cached_scan_results.h" +#include "wifi_config.h" +#include "wifi_logger.h" +#include "wifi_nan.h" +#include "wifi_offload.h" +#include "wifi_twt.h" + +// wifi HAL function pointer table +typedef struct { + wifi_error (*wifi_initialize)(wifi_handle*); + wifi_error (*wifi_wait_for_driver_ready)(void); + void (*wifi_cleanup)(wifi_handle, wifi_cleaned_up_handler); + void (*wifi_event_loop)(wifi_handle); + void (*wifi_get_error_info)(wifi_error, const char**); + wifi_error (*wifi_get_supported_feature_set)(wifi_interface_handle, feature_set*); + wifi_error (*wifi_get_concurrency_matrix)(wifi_interface_handle, int, feature_set*, int*); + wifi_error (*wifi_set_scanning_mac_oui)(wifi_interface_handle, unsigned char*); + wifi_error (*wifi_get_supported_channels)(wifi_handle, int*, wifi_channel*); + wifi_error (*wifi_is_epr_supported)(wifi_handle); + wifi_error (*wifi_get_ifaces)(wifi_handle, int*, wifi_interface_handle**); + wifi_error (*wifi_get_iface_name)(wifi_interface_handle, char* name, size_t); + wifi_error (*wifi_set_iface_event_handler)(wifi_request_id, wifi_interface_handle, + wifi_event_handler); + wifi_error (*wifi_reset_iface_event_handler)(wifi_request_id, wifi_interface_handle); + wifi_error (*wifi_start_gscan)(wifi_request_id, wifi_interface_handle, wifi_scan_cmd_params, + wifi_scan_result_handler); + wifi_error (*wifi_stop_gscan)(wifi_request_id, wifi_interface_handle); + wifi_error (*wifi_get_cached_gscan_results)(wifi_interface_handle, byte, int, + wifi_cached_scan_results*, int*); + wifi_error (*wifi_set_bssid_hotlist)(wifi_request_id, wifi_interface_handle, + wifi_bssid_hotlist_params, wifi_hotlist_ap_found_handler); + wifi_error (*wifi_reset_bssid_hotlist)(wifi_request_id, wifi_interface_handle); + wifi_error (*wifi_set_significant_change_handler)(wifi_request_id, wifi_interface_handle, + wifi_significant_change_params, + wifi_significant_change_handler); + wifi_error (*wifi_reset_significant_change_handler)(wifi_request_id, wifi_interface_handle); + wifi_error (*wifi_get_gscan_capabilities)(wifi_interface_handle, wifi_gscan_capabilities*); + wifi_error (*wifi_set_link_stats)(wifi_interface_handle, wifi_link_layer_params); + wifi_error (*wifi_get_link_stats)(wifi_request_id, wifi_interface_handle, + wifi_stats_result_handler); + wifi_error (*wifi_clear_link_stats)(wifi_interface_handle, u32, u32*, u8, u8*); + wifi_error (*wifi_get_valid_channels)(wifi_interface_handle, int, int, wifi_channel*, int*); + wifi_error (*wifi_rtt_range_request)(wifi_request_id, wifi_interface_handle, unsigned, + wifi_rtt_config[], wifi_rtt_event_handler); + wifi_error (*wifi_rtt_range_cancel)(wifi_request_id, wifi_interface_handle, unsigned, + mac_addr[]); + wifi_error (*wifi_get_rtt_capabilities)(wifi_interface_handle, wifi_rtt_capabilities*); + wifi_error (*wifi_rtt_get_responder_info)(wifi_interface_handle iface, + wifi_rtt_responder* responder_info); + wifi_error (*wifi_enable_responder)(wifi_request_id id, wifi_interface_handle iface, + wifi_channel_info channel_hint, + unsigned max_duration_seconds, + wifi_rtt_responder* responder_info); + wifi_error (*wifi_disable_responder)(wifi_request_id id, wifi_interface_handle iface); + wifi_error (*wifi_set_nodfs_flag)(wifi_interface_handle, u32); + wifi_error (*wifi_start_logging)(wifi_interface_handle, u32, u32, u32, u32, char*); + wifi_error (*wifi_set_epno_list)(wifi_request_id, wifi_interface_handle, + const wifi_epno_params*, wifi_epno_handler); + wifi_error (*wifi_reset_epno_list)(wifi_request_id, wifi_interface_handle); + wifi_error (*wifi_set_country_code)(wifi_interface_handle, const char*); + wifi_error (*wifi_get_firmware_memory_dump)(wifi_interface_handle iface, + wifi_firmware_memory_dump_handler handler); + wifi_error (*wifi_set_log_handler)(wifi_request_id id, wifi_interface_handle iface, + wifi_ring_buffer_data_handler handler); + wifi_error (*wifi_reset_log_handler)(wifi_request_id id, wifi_interface_handle iface); + wifi_error (*wifi_set_alert_handler)(wifi_request_id id, wifi_interface_handle iface, + wifi_alert_handler handler); + wifi_error (*wifi_reset_alert_handler)(wifi_request_id id, wifi_interface_handle iface); + wifi_error (*wifi_get_firmware_version)(wifi_interface_handle iface, char* buffer, + int buffer_size); + wifi_error (*wifi_get_ring_buffers_status)(wifi_interface_handle iface, u32* num_rings, + wifi_ring_buffer_status* status); + wifi_error (*wifi_get_logger_supported_feature_set)(wifi_interface_handle iface, + unsigned int* support); + wifi_error (*wifi_get_ring_data)(wifi_interface_handle iface, char* ring_name); + wifi_error (*wifi_enable_tdls)(wifi_interface_handle, mac_addr, wifi_tdls_params*, + wifi_tdls_handler); + wifi_error (*wifi_disable_tdls)(wifi_interface_handle, mac_addr); + wifi_error (*wifi_get_tdls_status)(wifi_interface_handle, mac_addr, wifi_tdls_status*); + wifi_error (*wifi_get_tdls_capabilities)(wifi_interface_handle iface, + wifi_tdls_capabilities* capabilities); + wifi_error (*wifi_get_driver_version)(wifi_interface_handle iface, char* buffer, + int buffer_size); + wifi_error (*wifi_set_passpoint_list)(wifi_request_id id, wifi_interface_handle iface, int num, + wifi_passpoint_network* networks, + wifi_passpoint_event_handler handler); + wifi_error (*wifi_reset_passpoint_list)(wifi_request_id id, wifi_interface_handle iface); + wifi_error (*wifi_set_lci)(wifi_request_id id, wifi_interface_handle iface, + wifi_lci_information* lci); + wifi_error (*wifi_set_lcr)(wifi_request_id id, wifi_interface_handle iface, + wifi_lcr_information* lcr); + wifi_error (*wifi_start_sending_offloaded_packet)(wifi_request_id id, + wifi_interface_handle iface, u16 ether_type, + u8* ip_packet, u16 ip_packet_len, + u8* src_mac_addr, u8* dst_mac_addr, + u32 period_msec); + wifi_error (*wifi_stop_sending_offloaded_packet)(wifi_request_id id, + wifi_interface_handle iface); + wifi_error (*wifi_start_rssi_monitoring)(wifi_request_id id, wifi_interface_handle iface, + s8 max_rssi, s8 min_rssi, wifi_rssi_event_handler eh); + wifi_error (*wifi_stop_rssi_monitoring)(wifi_request_id id, wifi_interface_handle iface); + wifi_error (*wifi_get_wake_reason_stats)(wifi_interface_handle iface, + WLAN_DRIVER_WAKE_REASON_CNT* wifi_wake_reason_cnt); + wifi_error (*wifi_configure_nd_offload)(wifi_interface_handle iface, u8 enable); + wifi_error (*wifi_get_driver_memory_dump)(wifi_interface_handle iface, + wifi_driver_memory_dump_callbacks callbacks); + wifi_error (*wifi_start_pkt_fate_monitoring)(wifi_interface_handle iface); + wifi_error (*wifi_get_tx_pkt_fates)(wifi_interface_handle handle, + wifi_tx_report* tx_report_bufs, size_t n_requested_fates, + size_t* n_provided_fates); + wifi_error (*wifi_get_rx_pkt_fates)(wifi_interface_handle handle, + wifi_rx_report* rx_report_bufs, size_t n_requested_fates, + size_t* n_provided_fates); + + /* NAN functions */ + wifi_error (*wifi_nan_enable_request)(transaction_id id, wifi_interface_handle iface, + NanEnableRequest* msg); + wifi_error (*wifi_nan_disable_request)(transaction_id id, wifi_interface_handle iface); + wifi_error (*wifi_nan_publish_request)(transaction_id id, wifi_interface_handle iface, + NanPublishRequest* msg); + wifi_error (*wifi_nan_publish_cancel_request)(transaction_id id, wifi_interface_handle iface, + NanPublishCancelRequest* msg); + wifi_error (*wifi_nan_subscribe_request)(transaction_id id, wifi_interface_handle iface, + NanSubscribeRequest* msg); + wifi_error (*wifi_nan_subscribe_cancel_request)(transaction_id id, wifi_interface_handle iface, + NanSubscribeCancelRequest* msg); + wifi_error (*wifi_nan_transmit_followup_request)(transaction_id id, wifi_interface_handle iface, + NanTransmitFollowupRequest* msg); + wifi_error (*wifi_nan_stats_request)(transaction_id id, wifi_interface_handle iface, + NanStatsRequest* msg); + wifi_error (*wifi_nan_config_request)(transaction_id id, wifi_interface_handle iface, + NanConfigRequest* msg); + wifi_error (*wifi_nan_tca_request)(transaction_id id, wifi_interface_handle iface, + NanTCARequest* msg); + wifi_error (*wifi_nan_beacon_sdf_payload_request)(transaction_id id, + wifi_interface_handle iface, + NanBeaconSdfPayloadRequest* msg); + wifi_error (*wifi_nan_register_handler)(wifi_interface_handle iface, + NanCallbackHandler handlers); + wifi_error (*wifi_nan_get_version)(wifi_handle handle, NanVersion* version); + wifi_error (*wifi_nan_get_capabilities)(transaction_id id, wifi_interface_handle iface); + wifi_error (*wifi_nan_data_interface_create)(transaction_id id, wifi_interface_handle iface, + char* iface_name); + wifi_error (*wifi_nan_data_interface_delete)(transaction_id id, wifi_interface_handle iface, + char* iface_name); + wifi_error (*wifi_nan_data_request_initiator)(transaction_id id, wifi_interface_handle iface, + NanDataPathInitiatorRequest* msg); + wifi_error (*wifi_nan_data_indication_response)(transaction_id id, wifi_interface_handle iface, + NanDataPathIndicationResponse* msg); + wifi_error (*wifi_nan_data_end)(transaction_id id, wifi_interface_handle iface, + NanDataPathEndRequest* msg); + wifi_error (*wifi_select_tx_power_scenario)(wifi_interface_handle iface, + wifi_power_scenario scenario); + wifi_error (*wifi_reset_tx_power_scenario)(wifi_interface_handle iface); + + /** + * Returns the chipset's hardware filtering capabilities: + * @param version pointer to version of the packet filter interpreter + *                supported, filled in upon return. 0 indicates no support. + * @param max_len pointer to maximum size of the filter bytecode, filled in + *                upon return. + */ + wifi_error (*wifi_get_packet_filter_capabilities)(wifi_interface_handle handle, u32* version, + u32* max_len); + /** +     * Programs the packet filter. + * @param program pointer to the program byte-code. + * @param len length of the program byte-code. +     */ + wifi_error (*wifi_set_packet_filter)(wifi_interface_handle handle, const u8* program, u32 len); + wifi_error (*wifi_read_packet_filter)(wifi_interface_handle handle, u32 src_offset, + u8* host_dst, u32 length); + wifi_error (*wifi_get_roaming_capabilities)(wifi_interface_handle handle, + wifi_roaming_capabilities* caps); + wifi_error (*wifi_enable_firmware_roaming)(wifi_interface_handle handle, + fw_roaming_state_t state); + wifi_error (*wifi_configure_roaming)(wifi_interface_handle handle, + wifi_roaming_config* roaming_config); + wifi_error (*wifi_set_radio_mode_change_handler)(wifi_request_id id, + wifi_interface_handle iface, + wifi_radio_mode_change_handler eh); + wifi_error (*wifi_set_latency_mode)(wifi_interface_handle iface, wifi_latency_mode mode); + wifi_error (*wifi_set_thermal_mitigation_mode)(wifi_handle handle, wifi_thermal_mode mode, + u32 completion_window); + wifi_error (*wifi_map_dscp_access_category)(wifi_handle handle, u32 start, u32 end, + u32 access_category); + wifi_error (*wifi_reset_dscp_mapping)(wifi_handle handle); + + wifi_error (*wifi_virtual_interface_create)(wifi_handle handle, const char* ifname, + wifi_interface_type iface_type); + wifi_error (*wifi_virtual_interface_delete)(wifi_handle handle, const char* ifname); + + wifi_error (*wifi_set_subsystem_restart_handler)(wifi_handle handle, + wifi_subsystem_restart_handler handler); + + /** + * Allow vendor HAL to choose interface name when creating + * an interface. This can be implemented by chips with their + * own interface naming policy. + * If not implemented, the default naming will be used. + */ + wifi_error (*wifi_get_supported_iface_name)(wifi_handle handle, u32 iface_type, char* name, + size_t len); + + /** + * Perform early initialization steps that are needed when WIFI + * is disabled. + * If the function returns failure, it means the vendor HAL is unusable + * (for example, if chip hardware is not installed) and no further + * functions should be called. + */ + wifi_error (*wifi_early_initialize)(void); + + /** + * Get supported feature set which are chip-global, that is + * not dependent on any created interface. + */ + wifi_error (*wifi_get_chip_feature_set)(wifi_handle handle, feature_set* set); + + /** + * Invoked to indicate that the provided iface is the primary STA iface when there are more + * than 1 STA iface concurrently active. + */ + wifi_error (*wifi_multi_sta_set_primary_connection)(wifi_handle handle, + wifi_interface_handle iface); + + /** + * When there are 2 simultaneous STA connections, this use case hint + * indicates what STA + STA use-case is being enabled by the framework. + */ + wifi_error (*wifi_multi_sta_set_use_case)(wifi_handle handle, wifi_multi_sta_use_case use_case); + + /** + * Invoked to indicate that the following list of wifi_coex_unsafe_channel should be avoided + * with the specified restrictions. + * @param unsafeChannels list of current |wifi_coex_unsafe_channel| to avoid. + * @param restrictions bitmask of |wifi_coex_restriction| indicating wifi interfaces to + * restrict from the current unsafe channels. + */ + wifi_error (*wifi_set_coex_unsafe_channels)(wifi_handle handle, u32 num_channels, + wifi_coex_unsafe_channel* unsafeChannels, + u32 restrictions); + + /** + * Invoked to set voip optimization mode for the provided STA iface + */ + wifi_error (*wifi_set_voip_mode)(wifi_interface_handle iface, wifi_voip_mode mode); + + /**@brief twt_register_handler + * Request to register TWT callback before sending any TWT request + * @param wifi_interface_handle: + * @param TwtCallbackHandler: callback function pointers + * @return Synchronous wifi_error + */ + wifi_error (*wifi_twt_register_handler)(wifi_interface_handle iface, + TwtCallbackHandler handler); + + /**@brief twt_get_capability + * Request TWT capability + * @param wifi_interface_handle: + * @return Synchronous wifi_error and TwtCapabilitySet + */ + wifi_error (*wifi_twt_get_capability)(wifi_interface_handle iface, + TwtCapabilitySet* twt_cap_set); + + /**@brief twt_setup_request + * Request to send TWT setup frame + * @param wifi_interface_handle: + * @param TwtSetupRequest: detailed parameters of setup request + * @return Synchronous wifi_error + * @return Asynchronous EventTwtSetupResponse CB return TwtSetupResponse + */ + wifi_error (*wifi_twt_setup_request)(wifi_interface_handle iface, TwtSetupRequest* msg); + + /**@brief twt_teardown_request + * Request to send TWT teardown frame + * @param wifi_interface_handle: + * @param TwtTeardownRequest: detailed parameters of teardown request + * @return Synchronous wifi_error + * @return Asynchronous EventTwtTeardownCompletion CB return TwtTeardownCompletion + * TwtTeardownCompletion may also be received due to other events + * like CSA, BTCX, TWT scheduler, MultiConnection, peer-initiated teardown, etc. + */ + wifi_error (*wifi_twt_teardown_request)(wifi_interface_handle iface, TwtTeardownRequest* msg); + + /**@brief twt_info_frame_request + * Request to send TWT info frame + * @param wifi_interface_handle: + * @param TwtInfoFrameRequest: detailed parameters in info frame + * @return Synchronous wifi_error + * @return Asynchronous EventTwtInfoFrameReceived CB return TwtInfoFrameReceived + * Driver may also receive Peer-initiated TwtInfoFrame + */ + wifi_error (*wifi_twt_info_frame_request)(wifi_interface_handle iface, + TwtInfoFrameRequest* msg); + + /**@brief twt_get_stats + * Request to get TWT stats + * @param wifi_interface_handle: + * @param config_id: configuration ID of TWT request + * @return Synchronous wifi_error and TwtStats + */ + wifi_error (*wifi_twt_get_stats)(wifi_interface_handle iface, u8 config_id, TwtStats* stats); + + /**@brief twt_clear_stats + * Request to clear TWT stats + * @param wifi_interface_handle: + * @param config_id: configuration ID of TWT request + * @return Synchronous wifi_error + */ + wifi_error (*wifi_twt_clear_stats)(wifi_interface_handle iface, u8 config_id); + + /** + * Invoked to set DTIM configuration when the host is in the suspend mode + * @param wifi_interface_handle: + * @param multiplier: when STA in the power saving mode, the wake up interval will be set to + * 1) multiplier * DTIM period if multiplier > 0. + * 2) the device default value if multiplier <=0 + * Some implementations may apply an additional cap to wake up interval in the case of 1). + */ + wifi_error (*wifi_set_dtim_config)(wifi_interface_handle handle, u32 multiplier); + + /**@brief wifi_get_usable_channels + * Request list of usable channels for the requested bands and modes. Usable + * implies channel is allowed as per regulatory for the current country code + * and not restricted due to other hard limitations (e.g. DFS, Coex) In + * certain modes (e.g. STA+SAP) there could be other hard restrictions + * since MCC operation many not be supported by SAP. This API also allows + * driver to return list of usable channels for each mode uniquely to + * distinguish cases where only a limited set of modes are allowed on + * a given channel e.g. srd channels may be supported for P2P but not + * for SAP or P2P-Client may be allowed on an indoor channel but P2P-GO + * may not be allowed. This API is not interface specific and will be + * used to query capabilities of driver in terms of what modes (STA, SAP, + * P2P_CLI, P2P_GO, NAN, TDLS) can be supported on each of the channels. + * @param handle global wifi_handle + * @param band_mask BIT MASK of WLAN_MAC* as represented by |wlan_mac_band| + * @param iface_mode_mask BIT MASK of BIT(WIFI_INTERFACE_*) represented by + * |wifi_interface_mode|. Bitmask respresents all the modes that the + * caller is interested in (e.g. STA, SAP, WFD-CLI, WFD-GO, TDLS, NAN). + * Note: Bitmask does not represent concurrency matrix. If the caller + * is interested in CLI, GO modes, the iface_mode_mask would be set + * to WIFI_INTERFACE_P2P_CLIENT|WIFI_INTERFACE_P2P_GO. + * @param filter_mask BIT MASK of WIFI_USABLE_CHANNEL_FILTER_* represented by + * |wifi_usable_channel_filter|. Indicates if the channel list should + * be filtered based on additional criteria. If filter_mask is not + * specified, driver should return list of usable channels purely + * based on regulatory constraints. + * @param max_size maximum number of |wifi_usable_channel| + * @param size actual number of |wifi_usable_channel| entries returned by driver + * @param channels list of usable channels represented by |wifi_usable_channel| + */ + wifi_error (*wifi_get_usable_channels)(wifi_handle handle, u32 band_mask, u32 iface_mode_mask, + u32 filter_mask, u32 max_size, u32* size, + wifi_usable_channel* channels); + + /** + * Trigger wifi subsystem restart to reload firmware + */ + wifi_error (*wifi_trigger_subsystem_restart)(wifi_handle handle); + + /** + * Invoked to set that the device is operating in an indoor environment. + * @param handle global wifi_handle + * @param isIndoor: true if the device is operating in an indoor + * environment, false otherwise. + * @return Synchronous wifi_error + */ + wifi_error (*wifi_set_indoor_state)(wifi_handle handle, bool isIndoor); + + /**@brief wifi_get_supported_radio_combinations_matrix + * Request all the possible radio combinations this device can offer. + * @param handle global wifi_handle + * @param max_size maximum size allocated for filling the wifi_radio_combination_matrix + * @param wifi_radio_combination_matrix to return all the possible radio + * combinations. + * @param size actual size of wifi_radio_combination_matrix returned from + * lower layer + * + */ + wifi_error (*wifi_get_supported_radio_combinations_matrix)( + wifi_handle handle, u32 max_size, u32* size, + wifi_radio_combination_matrix* radio_combination_matrix); + + /**@brief wifi_nan_rtt_chre_enable_request + * Request to enable CHRE NAN RTT + * @param transaction_id: NAN transaction id + * @param wifi_interface_handle + * @param NanEnableRequest request message + * @return Synchronous wifi_error + */ + wifi_error (*wifi_nan_rtt_chre_enable_request)(transaction_id id, wifi_interface_handle iface, + NanEnableRequest* msg); + + /**@brief wifi_nan_rtt_chre_disable_request + * Request to disable CHRE NAN RTT + * @param transaction_id: NAN transaction id + * @param wifi_interface_handle + * @return Synchronous wifi_error + */ + wifi_error (*wifi_nan_rtt_chre_disable_request)(transaction_id id, wifi_interface_handle iface); + + /**@brief wifi_chre_register_handler + * register a handler to get the state of CHR + * @param wifi_interface_handle + * @param wifi_chre_handler: callback function pointer + * @return Synchronous wifi_error + */ + wifi_error (*wifi_chre_register_handler)(wifi_interface_handle iface, + wifi_chre_handler handler); + + /**@brief wifi_enable_tx_power_limits + * Enable WiFi Tx power limis + * @param wifi_interface_handle + * @param isEnable : If enable TX limit or not + * @return Synchronous wifi_error + */ + wifi_error (*wifi_enable_tx_power_limits)(wifi_interface_handle iface, bool isEnable); + + /**@brief wifi_get_cached_scan_results + * Retrieve scan results cached in wifi firmware + * @param wifi_interface_handle + * @param wifi_cached_scan_result_handler : callback function pointer + * @return Synchronous wifi_error + */ + wifi_error (*wifi_get_cached_scan_results)(wifi_interface_handle iface, + wifi_cached_scan_result_handler handler); + /* + * when adding new functions make sure to add stubs in + * hal_tool.cpp::init_wifi_stub_hal_func_table + */ +} wifi_hal_fn; + +wifi_error init_wifi_vendor_hal_func_table(wifi_hal_fn* fn); +typedef wifi_error (*init_wifi_vendor_hal_func_table_t)(wifi_hal_fn* fn); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/wifi/1.6/default/hal_legacy/wifi_logger.h b/wifi/1.6/default/hal_legacy/wifi_logger.h new file mode 100644 index 0000000000..76d6f7400d --- /dev/null +++ b/wifi/1.6/default/hal_legacy/wifi_logger.h @@ -0,0 +1,650 @@ +#include "wifi_hal.h" + +#ifndef __WIFI_HAL_LOGGER_H +#define __WIFI_HAL_LOGGER_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define LOGGER_MAJOR_VERSION 1 +#define LOGGER_MINOR_VERSION 0 +#define LOGGER_MICRO_VERSION 0 + +/** + * WiFi logger life cycle is as follow: + * + * - At initialization time, framework will call wifi_get_ring_buffers_status + * so as to obtain the names and list of supported buffers. + * - When WiFi operation start framework will call wifi_start_logging + * so as to trigger log collection. + * - Developper UI will provide an option to the user, so as it can set the verbose level + * of individual buffer as reported by wifi_get_ring_buffers_status. + * - During wifi operations, driver will periodically report per ring data to framework + * by invoking the on_ring_buffer_data call back. + * - when capturing a bug report, framework will indicate to driver that all the data + * has to be uploaded, urgently, by calling wifi_get_ring_data. + * + * The data uploaded by driver will be stored by framework in separate files, with one stream + * of file per ring. + * Framework will store the files in pcapng format, allowing for easy merging and parsing + * with network analyzer tools. + */ + +typedef int wifi_ring_buffer_id; + +#define PER_PACKET_ENTRY_FLAGS_DIRECTION_TX 1 // 0: TX, 1: RX +#define PER_PACKET_ENTRY_FLAGS_TX_SUCCESS \ + 2 // whether packet was transmitted or + // received/decrypted successfully +#define PER_PACKET_ENTRY_FLAGS_80211_HEADER 4 // has full 802.11 header, else has 802.3 header +#define PER_PACKET_ENTRY_FLAGS_PROTECTED 8 // whether packet was encrypted + +typedef struct { + u8 flags; + u8 tid; // transmit or received tid + u16 MCS; // modulation and bandwidth + u8 rssi; // TX: RSSI of ACK for that packet + // RX: RSSI of packet + u8 num_retries; // number of attempted retries + u16 last_transmit_rate; // last transmit rate in .5 mbps + u16 link_layer_transmit_sequence; // transmit/reeive sequence for that MPDU packet + u64 firmware_entry_timestamp; // TX: firmware timestamp (us) when packet is queued within + // firmware buffer for SDIO/HSIC or into PCIe buffer + // RX: firmware receive timestamp + u64 start_contention_timestamp; // firmware timestamp (us) when packet start contending for the + // medium for the first time, at head of its AC queue, + // or as part of an MPDU or A-MPDU. This timestamp is + // not updated for each retry, only the first transmit attempt. + u64 transmit_success_timestamp; // fimrware timestamp (us) when packet is successfully + // transmitted or aborted because it has exhausted + // its maximum number of retries. + u8 data[0]; // packet data. The length of packet data is determined by the entry_size field of + // the wifi_ring_buffer_entry structure. It is expected that first bytes of the + // packet, or packet headers only (up to TCP or RTP/UDP headers) + // will be copied into the ring +} __attribute__((packed)) wifi_ring_per_packet_status_entry; + +/* Below events refer to the wifi_connectivity_event ring and shall be supported */ +#define WIFI_EVENT_ASSOCIATION_REQUESTED 0 // driver receives association command from kernel +#define WIFI_EVENT_AUTH_COMPLETE 1 +#define WIFI_EVENT_ASSOC_COMPLETE 2 +#define WIFI_EVENT_FW_AUTH_STARTED 3 // fw event indicating auth frames are sent +#define WIFI_EVENT_FW_ASSOC_STARTED 4 // fw event indicating assoc frames are sent +#define WIFI_EVENT_FW_RE_ASSOC_STARTED 5 // fw event indicating reassoc frames are sent +#define WIFI_EVENT_DRIVER_SCAN_REQUESTED 6 +#define WIFI_EVENT_DRIVER_SCAN_RESULT_FOUND 7 +#define WIFI_EVENT_DRIVER_SCAN_COMPLETE 8 +#define WIFI_EVENT_G_SCAN_STARTED 9 +#define WIFI_EVENT_G_SCAN_COMPLETE 10 +#define WIFI_EVENT_DISASSOCIATION_REQUESTED 11 +#define WIFI_EVENT_RE_ASSOCIATION_REQUESTED 12 +#define WIFI_EVENT_ROAM_REQUESTED 13 +#define WIFI_EVENT_BEACON_RECEIVED \ + 14 // received beacon from AP (event enabled + // only in verbose mode) +#define WIFI_EVENT_ROAM_SCAN_STARTED 15 // firmware has triggered a roam scan (not g-scan) +#define WIFI_EVENT_ROAM_SCAN_COMPLETE 16 // firmware has completed a roam scan (not g-scan) +#define WIFI_EVENT_ROAM_SEARCH_STARTED \ + 17 // firmware has started searching for roam + // candidates (with reason =xx) +#define WIFI_EVENT_ROAM_SEARCH_STOPPED \ + 18 // firmware has stopped searching for roam + // candidates (with reason =xx) +#define WIFI_EVENT_CHANNEL_SWITCH_ANOUNCEMENT 20 // received channel switch anouncement from AP +#define WIFI_EVENT_FW_EAPOL_FRAME_TRANSMIT_START \ + 21 // fw start transmit eapol frame, with + // EAPOL index 1-4 +#define WIFI_EVENT_FW_EAPOL_FRAME_TRANSMIT_STOP \ + 22 // fw gives up eapol frame, with rate, + // success/failure and number retries +#define WIFI_EVENT_DRIVER_EAPOL_FRAME_TRANSMIT_REQUESTED \ + 23 // kernel queue EAPOL for transmission + // in driver with EAPOL index 1-4 +#define WIFI_EVENT_FW_EAPOL_FRAME_RECEIVED \ + 24 // with rate, regardless of the fact that + // EAPOL frame is accepted or rejected by fw +#define WIFI_EVENT_DRIVER_EAPOL_FRAME_RECEIVED \ + 26 // with rate, and eapol index, driver has + // received EAPOL frame and will queue it up + // to wpa_supplicant +#define WIFI_EVENT_BLOCK_ACK_NEGOTIATION_COMPLETE 27 // with success/failure, parameters +#define WIFI_EVENT_BT_COEX_BT_SCO_START 28 +#define WIFI_EVENT_BT_COEX_BT_SCO_STOP 29 +#define WIFI_EVENT_BT_COEX_BT_SCAN_START \ + 30 // for paging/scan etc., when BT starts transmiting + // twice per BT slot +#define WIFI_EVENT_BT_COEX_BT_SCAN_STOP 31 +#define WIFI_EVENT_BT_COEX_BT_HID_START 32 +#define WIFI_EVENT_BT_COEX_BT_HID_STOP 33 +#define WIFI_EVENT_ROAM_AUTH_STARTED 34 // fw sends auth frame in roaming to next candidate +#define WIFI_EVENT_ROAM_AUTH_COMPLETE 35 // fw receive auth confirm from ap +#define WIFI_EVENT_ROAM_ASSOC_STARTED \ + 36 // firmware sends assoc/reassoc frame in + // roaming to next candidate +#define WIFI_EVENT_ROAM_ASSOC_COMPLETE 37 // firmware receive assoc/reassoc confirm from ap +#define WIFI_EVENT_G_SCAN_STOP 38 // firmware sends stop G_SCAN +#define WIFI_EVENT_G_SCAN_CYCLE_STARTED 39 // firmware indicates G_SCAN scan cycle started +#define WIFI_EVENT_G_SCAN_CYCLE_COMPLETED 40 // firmware indicates G_SCAN scan cycle completed +#define WIFI_EVENT_G_SCAN_BUCKET_STARTED \ + 41 // firmware indicates G_SCAN scan start + // for a particular bucket +#define WIFI_EVENT_G_SCAN_BUCKET_COMPLETED \ + 42 // firmware indicates G_SCAN scan completed for + // for a particular bucket +#define WIFI_EVENT_G_SCAN_RESULTS_AVAILABLE \ + 43 // Event received from firmware about G_SCAN scan + // results being available +#define WIFI_EVENT_G_SCAN_CAPABILITIES \ + 44 // Event received from firmware with G_SCAN + // capabilities +#define WIFI_EVENT_ROAM_CANDIDATE_FOUND \ + 45 // Event received from firmware when eligible + // candidate is found +#define WIFI_EVENT_ROAM_SCAN_CONFIG \ + 46 // Event received from firmware when roam scan + // configuration gets enabled or disabled +#define WIFI_EVENT_AUTH_TIMEOUT 47 // firmware/driver timed out authentication +#define WIFI_EVENT_ASSOC_TIMEOUT 48 // firmware/driver timed out association +#define WIFI_EVENT_MEM_ALLOC_FAILURE 49 // firmware/driver encountered allocation failure +#define WIFI_EVENT_DRIVER_PNO_ADD 50 // driver added a PNO network in firmware +#define WIFI_EVENT_DRIVER_PNO_REMOVE 51 // driver removed a PNO network in firmware +#define WIFI_EVENT_DRIVER_PNO_NETWORK_FOUND \ + 52 // driver received PNO networks + // found indication from firmware +#define WIFI_EVENT_DRIVER_PNO_SCAN_REQUESTED 53 // driver triggered a scan for PNO networks +#define WIFI_EVENT_DRIVER_PNO_SCAN_RESULT_FOUND \ + 54 // driver received scan results + // of PNO networks +#define WIFI_EVENT_DRIVER_PNO_SCAN_COMPLETE \ + 55 // driver updated scan results from + // PNO networks to cfg80211 + +/** + * Parameters of wifi logger events are TLVs + * Event parameters tags are defined as: + */ +#define WIFI_TAG_VENDOR_SPECIFIC 0 // take a byte stream as parameter +#define WIFI_TAG_BSSID 1 // takes a 6 bytes MAC address as parameter +#define WIFI_TAG_ADDR 2 // takes a 6 bytes MAC address as parameter +#define WIFI_TAG_SSID 3 // takes a 32 bytes SSID address as parameter +#define WIFI_TAG_STATUS 4 // takes an integer as parameter +#define WIFI_TAG_CHANNEL_SPEC 5 // takes one or more wifi_channel_spec as parameter +#define WIFI_TAG_WAKE_LOCK_EVENT 6 // takes a wake_lock_event struct as parameter +#define WIFI_TAG_ADDR1 7 // takes a 6 bytes MAC address as parameter +#define WIFI_TAG_ADDR2 8 // takes a 6 bytes MAC address as parameter +#define WIFI_TAG_ADDR3 9 // takes a 6 bytes MAC address as parameter +#define WIFI_TAG_ADDR4 10 // takes a 6 bytes MAC address as parameter +#define WIFI_TAG_TSF 11 // take a 64 bits TSF value as parameter +#define WIFI_TAG_IE \ + 12 // take one or more specific 802.11 IEs parameter, + // IEs are in turn indicated in TLV format as per + // 802.11 spec +#define WIFI_TAG_INTERFACE 13 // take interface name as parameter +#define WIFI_TAG_REASON_CODE 14 // take a reason code as per 802.11 as parameter +#define WIFI_TAG_RATE_MBPS 15 // take a wifi rate in 0.5 mbps +#define WIFI_TAG_REQUEST_ID 16 // take an integer as parameter +#define WIFI_TAG_BUCKET_ID 17 // take an integer as parameter +#define WIFI_TAG_GSCAN_PARAMS 18 // takes a wifi_scan_cmd_params struct as parameter +#define WIFI_TAG_GSCAN_CAPABILITIES 19 // takes a wifi_gscan_capabilities struct as parameter +#define WIFI_TAG_SCAN_ID 20 // take an integer as parameter +#define WIFI_TAG_RSSI 21 // take an integer as parameter +#define WIFI_TAG_CHANNEL 22 // take an integer as parameter +#define WIFI_TAG_LINK_ID 23 // take an integer as parameter +#define WIFI_TAG_LINK_ROLE 24 // take an integer as parameter +#define WIFI_TAG_LINK_STATE 25 // take an integer as parameter +#define WIFI_TAG_LINK_TYPE 26 // take an integer as parameter +#define WIFI_TAG_TSCO 27 // take an integer as parameter +#define WIFI_TAG_RSCO 28 // take an integer as parameter +#define WIFI_TAG_EAPOL_MESSAGE_TYPE \ + 29 // take an integer as parameter + // M1-1, M2-2, M3-3, M4-4 + +typedef struct { + u16 tag; + u16 length; // length of value + u8 value[0]; +} __attribute__((packed)) tlv_log; + +typedef struct { + u16 event; + tlv_log tlvs[0]; // separate parameter structure per event to be provided and optional data + // the event_data is expected to include an official android part, with some + // parameter as transmit rate, num retries, num scan result found etc... + // as well, event_data can include a vendor proprietary part which is + // understood by the developer only. +} __attribute__((packed)) wifi_ring_buffer_driver_connectivity_event; + +/** + * Ring buffer name for power events ring. note that power event are extremely frequents + * and thus should be stored in their own ring/file so as not to clobber connectivity events. + */ +typedef struct { + int status; // 0 taken, 1 released + int reason; // reason why this wake lock is taken + char name[0]; // null terminated +} __attribute__((packed)) wake_lock_event; + +typedef struct { + u16 event; + tlv_log tlvs[0]; +} __attribute__((packed)) wifi_power_event; + +/** + * This structure represent a logger entry within a ring buffer. + * Wifi driver are responsible to manage the ring buffer and write the debug + * information into those rings. + * + * In general, the debug entries can be used to store meaningful 802.11 information (SME, MLME, + * connection and packet statistics) as well as vendor proprietary data that is specific to a + * specific driver or chipset. + * Binary entries can be used so as to store packet data or vendor specific information and + * will be treated as blobs of data by android. + * + * A user land process will be started by framework so as to periodically retrieve the + * data logged by drivers into their ring buffer, store the data into log files and include + * the logs into android bugreports. + */ +enum { + RING_BUFFER_ENTRY_FLAGS_HAS_BINARY = (1 << (0)), // set for binary entries + RING_BUFFER_ENTRY_FLAGS_HAS_TIMESTAMP = (1 << (1)) // set if 64 bits timestamp is present +}; + +enum { + ENTRY_TYPE_CONNECT_EVENT = 1, + ENTRY_TYPE_PKT, + ENTRY_TYPE_WAKE_LOCK, + ENTRY_TYPE_POWER_EVENT, + ENTRY_TYPE_DATA +}; + +typedef struct { + u16 entry_size; // the size of payload excluding the header. + u8 flags; + u8 type; // entry type + u64 timestamp; // present if has_timestamp bit is set. +} __attribute__((packed)) wifi_ring_buffer_entry; + +#define WIFI_RING_BUFFER_FLAG_HAS_BINARY_ENTRIES 0x00000001 // set if binary entries are present +#define WIFI_RING_BUFFER_FLAG_HAS_ASCII_ENTRIES 0x00000002 // set if ascii entries are present + +/* ring buffer params */ +/** + * written_bytes and read_bytes implement a producer consumer API + * hence written_bytes >= read_bytes + * a modulo arithmetic of the buffer size has to be applied to those counters: + * actual offset into ring buffer = written_bytes % ring_buffer_byte_size + * + */ +typedef struct { + u8 name[32]; + u32 flags; + wifi_ring_buffer_id ring_id; // unique integer representing the ring + u32 ring_buffer_byte_size; // total memory size allocated for the buffer + u32 verbose_level; // verbose level for ring buffer + u32 written_bytes; // number of bytes that was written to the buffer by driver, + // monotonously increasing integer + u32 read_bytes; // number of bytes that was read from the buffer by user land, + // monotonously increasing integer + u32 written_records; // number of records that was written to the buffer by driver, + // monotonously increasing integer +} wifi_ring_buffer_status; + +/** + * Callback for reporting ring data + * + * The ring buffer data collection is event based: + * - Driver calls on_ring_buffer_data when new records are available, the wifi_ring_buffer_status + * passed up to framework in the call back indicates to framework if more data is available in + * the ring buffer. It is not expected that driver will necessarily always empty the ring + * immediately as data is available, instead driver will report data every X seconds or if + * N bytes are available. + * - In the case where a bug report has to be captured, framework will require driver to upload + * all data immediately. This is indicated to driver when framework calls wifi_get_ringdata. + * When framework calls wifi_get_ring_data, driver will start sending all available data in the + * indicated ring by repeatedly invoking the on_ring_buffer_data callback. + * + * The callback is called by log handler whenever ring data comes in driver. + */ +typedef struct { + void (*on_ring_buffer_data)(char* ring_name, char* buffer, int buffer_size, + wifi_ring_buffer_status* status); +} wifi_ring_buffer_data_handler; + +/** + * API to set the log handler for getting ring data + * - Only a single instance of log handler can be instantiated for each ring buffer. + */ +wifi_error wifi_set_log_handler(wifi_request_id id, wifi_interface_handle iface, + wifi_ring_buffer_data_handler handler); + +/* API to reset the log handler */ +wifi_error wifi_reset_log_handler(wifi_request_id id, wifi_interface_handle iface); + +/** + * Callback for reporting FW dump + * + * The buffer data collection is event based such as FW health check or FW dump. + * The callback is called by alert handler. + */ +typedef struct { + void (*on_alert)(wifi_request_id id, char* buffer, int buffer_size, int err_code); +} wifi_alert_handler; + +/* + * API to set the alert handler for the alert case in Wi-Fi Chip + * - Only a single instance of alert handler can be instantiated. + */ +wifi_error wifi_set_alert_handler(wifi_request_id id, wifi_interface_handle iface, + wifi_alert_handler handler); + +/* API to reset the alert handler */ +wifi_error wifi_reset_alert_handler(wifi_request_id id, wifi_interface_handle iface); + +/* API for framework to indicate driver has to upload and drain all data of a given ring */ +wifi_error wifi_get_ring_data(wifi_interface_handle iface, char* ring_name); + +/** + * API to trigger the debug collection. + * Unless his API is invoked - logging is not triggered. + * - Verbose_level 0 corresponds to no collection, + * and it makes log handler stop by no more events from driver. + * - Verbose_level 1 correspond to normal log level, with minimal user impact. + * This is the default value. + * - Verbose_level 2 are enabled when user is lazily trying to reproduce a problem, + * wifi performances and power can be impacted but device should not otherwise be + * significantly impacted. + * - Verbose_level 3+ are used when trying to actively debug a problem. + * + * ring_name represent the name of the ring for which data collection shall start. + * + * flags: TBD parameter used to enable/disable specific events on a ring + * max_interval: maximum interval in seconds for driver to invoke on_ring_buffer_data, + * ignore if zero + * min_data_size: minimum data size in buffer for driver to invoke on_ring_buffer_data, + * ignore if zero + */ +wifi_error wifi_start_logging(wifi_interface_handle iface, u32 verbose_level, u32 flags, + u32 max_interval_sec, u32 min_data_size, char* ring_name); + +/** + * API to get the status of all ring buffers supported by driver. + * - Caller is responsible to allocate / free ring buffer status. + * - Maximum no of ring buffer would be 10. + */ +wifi_error wifi_get_ring_buffers_status(wifi_interface_handle iface, u32* num_rings, + wifi_ring_buffer_status* status); + +/** + * Synchronous memory dump by user request. + * - Caller is responsible to store memory dump data into a local, + * e.g., /data/misc/wifi/memdump.bin + */ +typedef struct { + void (*on_firmware_memory_dump)(char* buffer, int buffer_size); +} wifi_firmware_memory_dump_handler; + +/** + * API to collect a firmware memory dump for a given iface by async memdump event. + * - Triggered by Alerthandler, esp. when FW problem or FW health check happens + * - Caller is responsible to store fw dump data into a local, + * e.g., /data/misc/wifi/alertdump-1.bin + */ +wifi_error wifi_get_firmware_memory_dump(wifi_interface_handle iface, + wifi_firmware_memory_dump_handler handler); + +/** + * API to collect a firmware version string. + * - Caller is responsible to allocate / free a buffer to retrieve firmware verion info. + * - Max string will be at most 256 bytes. + */ +wifi_error wifi_get_firmware_version(wifi_interface_handle iface, char* buffer, int buffer_size); + +/** + * API to collect a driver version string. + * - Caller is responsible to allocate / free a buffer to retrieve driver verion info. + * - Max string will be at most 256 bytes. + */ +wifi_error wifi_get_driver_version(wifi_interface_handle iface, char* buffer, int buffer_size); + +/* Feature set */ +enum { + WIFI_LOGGER_MEMORY_DUMP_SUPPORTED = (1 << (0)), // Memory dump of FW + WIFI_LOGGER_PER_PACKET_TX_RX_STATUS_SUPPORTED = (1 << (1)), // PKT status + WIFI_LOGGER_CONNECT_EVENT_SUPPORTED = (1 << (2)), // Connectivity event + WIFI_LOGGER_POWER_EVENT_SUPPORTED = (1 << (3)), // POWER of Driver + WIFI_LOGGER_WAKE_LOCK_SUPPORTED = (1 << (4)), // WAKE LOCK of Driver + WIFI_LOGGER_VERBOSE_SUPPORTED = (1 << (5)), // verbose log of FW + WIFI_LOGGER_WATCHDOG_TIMER_SUPPORTED = (1 << (6)), // monitor the health of FW + WIFI_LOGGER_DRIVER_DUMP_SUPPORTED = (1 << (7)), // dumps driver state + WIFI_LOGGER_PACKET_FATE_SUPPORTED = (1 << (8)), // tracks connection packets' fate +}; + +/** + * API to retrieve the current supportive features. + * - An integer variable is enough to have bit mapping info by caller. + */ +wifi_error wifi_get_logger_supported_feature_set(wifi_interface_handle iface, + unsigned int* support); + +typedef struct { + /* Buffer is to be allocated and freed by HAL implementation. */ + void (*on_driver_memory_dump)(char* buffer, int buffer_size); +} wifi_driver_memory_dump_callbacks; + +/** + API to collect driver state. + + Framework will call this API soon before or after (but not + concurrently with) wifi_get_firmware_memory_dump(). Capturing + firmware and driver dumps is intended to help identify + inconsistent state between these components. + + - In response to this call, HAL implementation should make one or + more calls to callbacks.on_driver_memory_dump(). Framework will + copy data out of the received |buffer|s, and concatenate the + contents thereof. + - HAL implemention will indicate completion of the driver memory + dump by returning from this call. +*/ +wifi_error wifi_get_driver_memory_dump(wifi_interface_handle iface, + wifi_driver_memory_dump_callbacks callbacks); + +/* packet fate logs */ + +#define MD5_PREFIX_LEN 4 +#define MAX_FATE_LOG_LEN 32 +#define MAX_FRAME_LEN_ETHERNET 1518 +#define MAX_FRAME_LEN_80211_MGMT 2352 // 802.11-2012 Fig. 8-34 + +typedef enum { + // Sent over air and ACKed. + TX_PKT_FATE_ACKED, + + // Sent over air but not ACKed. (Normal for broadcast/multicast.) + TX_PKT_FATE_SENT, + + // Queued within firmware, but not yet sent over air. + TX_PKT_FATE_FW_QUEUED, + + // Dropped by firmware as invalid. E.g. bad source address, bad checksum, + // or invalid for current state. + TX_PKT_FATE_FW_DROP_INVALID, + + // Dropped by firmware due to lack of buffer space. + TX_PKT_FATE_FW_DROP_NOBUFS, + + // Dropped by firmware for any other reason. Includes frames that + // were sent by driver to firmware, but unaccounted for by + // firmware. + TX_PKT_FATE_FW_DROP_OTHER, + + // Queued within driver, not yet sent to firmware. + TX_PKT_FATE_DRV_QUEUED, + + // Dropped by driver as invalid. E.g. bad source address, or + // invalid for current state. + TX_PKT_FATE_DRV_DROP_INVALID, + + // Dropped by driver due to lack of buffer space. + TX_PKT_FATE_DRV_DROP_NOBUFS, + + // Dropped by driver for any other reason. + TX_PKT_FATE_DRV_DROP_OTHER, +} wifi_tx_packet_fate; + +typedef enum { + // Valid and delivered to network stack (e.g., netif_rx()). + RX_PKT_FATE_SUCCESS, + + // Queued within firmware, but not yet sent to driver. + RX_PKT_FATE_FW_QUEUED, + + // Dropped by firmware due to host-programmable filters. + RX_PKT_FATE_FW_DROP_FILTER, + + // Dropped by firmware as invalid. E.g. bad checksum, decrypt failed, + // or invalid for current state. + RX_PKT_FATE_FW_DROP_INVALID, + + // Dropped by firmware due to lack of buffer space. + RX_PKT_FATE_FW_DROP_NOBUFS, + + // Dropped by firmware for any other reason. + RX_PKT_FATE_FW_DROP_OTHER, + + // Queued within driver, not yet delivered to network stack. + RX_PKT_FATE_DRV_QUEUED, + + // Dropped by driver due to filter rules. + RX_PKT_FATE_DRV_DROP_FILTER, + + // Dropped by driver as invalid. E.g. not permitted in current state. + RX_PKT_FATE_DRV_DROP_INVALID, + + // Dropped by driver due to lack of buffer space. + RX_PKT_FATE_DRV_DROP_NOBUFS, + + // Dropped by driver for any other reason. + RX_PKT_FATE_DRV_DROP_OTHER, +} wifi_rx_packet_fate; + +typedef enum { + FRAME_TYPE_UNKNOWN, + FRAME_TYPE_ETHERNET_II, + FRAME_TYPE_80211_MGMT, +} frame_type; + +typedef struct { + // The type of MAC-layer frame that this frame_info holds. + // - For data frames, use FRAME_TYPE_ETHERNET_II. + // - For management frames, use FRAME_TYPE_80211_MGMT. + // - If the type of the frame is unknown, use FRAME_TYPE_UNKNOWN. + frame_type payload_type; + + // The number of bytes included in |frame_content|. If the frame + // contents are missing (e.g. RX frame dropped in firmware), + // |frame_len| should be set to 0. + size_t frame_len; + + // Host clock when this frame was received by the driver (either + // outbound from the host network stack, or inbound from the + // firmware). + // - The timestamp should be taken from a clock which includes time + // the host spent suspended (e.g. ktime_get_boottime()). + // - If no host timestamp is available (e.g. RX frame was dropped in + // firmware), this field should be set to 0. + u32 driver_timestamp_usec; + + // Firmware clock when this frame was received by the firmware + // (either outbound from the host, or inbound from a remote + // station). + // - The timestamp should be taken from a clock which includes time + // firmware spent suspended (if applicable). + // - If no firmware timestamp is available (e.g. TX frame was + // dropped by driver), this field should be set to 0. + // - Consumers of |frame_info| should _not_ assume any + // synchronization between driver and firmware clocks. + u32 firmware_timestamp_usec; + + // Actual frame content. + // - Should be provided for TX frames originated by the host. + // - Should be provided for RX frames received by the driver. + // - Optionally provided for TX frames originated by firmware. (At + // discretion of HAL implementation.) + // - Optionally provided for RX frames dropped in firmware. (At + // discretion of HAL implementation.) + // - If frame content is not provided, |frame_len| should be set + // to 0. + union { + char ethernet_ii_bytes[MAX_FRAME_LEN_ETHERNET]; + char ieee_80211_mgmt_bytes[MAX_FRAME_LEN_80211_MGMT]; + } frame_content; +} frame_info; + +typedef struct { + // Prefix of MD5 hash of |frame_inf.frame_content|. If frame + // content is not provided, prefix of MD5 hash over the same data + // that would be in frame_content, if frame content were provided. + char md5_prefix[MD5_PREFIX_LEN]; + wifi_tx_packet_fate fate; + frame_info frame_inf; +} wifi_tx_report; + +typedef struct { + // Prefix of MD5 hash of |frame_inf.frame_content|. If frame + // content is not provided, prefix of MD5 hash over the same data + // that would be in frame_content, if frame content were provided. + char md5_prefix[MD5_PREFIX_LEN]; + wifi_rx_packet_fate fate; + frame_info frame_inf; +} wifi_rx_report; + +/** + API to start packet fate monitoring. + - Once stared, monitoring should remain active until HAL is unloaded. + - When HAL is unloaded, all packet fate buffers should be cleared. +*/ +wifi_error wifi_start_pkt_fate_monitoring(wifi_interface_handle handle); + +/** + API to retrieve fates of outbound packets. + - HAL implementation should fill |tx_report_bufs| with fates of + _first_ min(n_requested_fates, actual packets) frames + transmitted for the most recent association. The fate reports + should follow the same order as their respective packets. + - HAL implementation may choose (but is not required) to include + reports for management frames. + - Packets reported by firmware, but not recognized by driver, + should be included. However, the ordering of the corresponding + reports is at the discretion of HAL implementation. + - Framework may call this API multiple times for the same association. + - Framework will ensure |n_requested_fates <= MAX_FATE_LOG_LEN|. + - Framework will allocate and free the referenced storage. +*/ +wifi_error wifi_get_tx_pkt_fates(wifi_interface_handle handle, wifi_tx_report* tx_report_bufs, + size_t n_requested_fates, size_t* n_provided_fates); + +/** + API to retrieve fates of inbound packets. + - HAL implementation should fill |rx_report_bufs| with fates of + _first_ min(n_requested_fates, actual packets) frames + received for the most recent association. The fate reports + should follow the same order as their respective packets. + - HAL implementation may choose (but is not required) to include + reports for management frames. + - Packets reported by firmware, but not recognized by driver, + should be included. However, the ordering of the corresponding + reports is at the discretion of HAL implementation. + - Framework may call this API multiple times for the same association. + - Framework will ensure |n_requested_fates <= MAX_FATE_LOG_LEN|. + - Framework will allocate and free the referenced storage. +*/ +wifi_error wifi_get_rx_pkt_fates(wifi_interface_handle handle, wifi_rx_report* rx_report_bufs, + size_t n_requested_fates, size_t* n_provided_fates); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /*__WIFI_HAL_STATS_ */ diff --git a/wifi/1.6/default/hal_legacy/wifi_nan.h b/wifi/1.6/default/hal_legacy/wifi_nan.h new file mode 100644 index 0000000000..3591b98adc --- /dev/null +++ b/wifi/1.6/default/hal_legacy/wifi_nan.h @@ -0,0 +1,2726 @@ +/* + * Copyright (C) 2016 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. + */ + +#ifndef __NAN_H__ +#define __NAN_H__ + +#include +#include +#include "wifi_hal.h" + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/***************************************************************************** + * Neighbour Aware Network Service Structures and Functions + *****************************************************************************/ + +/* + Definitions + All multi-byte fields within all NAN protocol stack messages are assumed to be in Little Endian + order. +*/ + +typedef int NanVersion; +typedef u16 transaction_id; +typedef u32 NanDataPathId; + +#define NAN_MAC_ADDR_LEN 6 +#define NAN_MAJOR_VERSION 2 +#define NAN_MINOR_VERSION 0 +#define NAN_MICRO_VERSION 1 +#define NAN_MAX_SOCIAL_CHANNELS 3 + +/* NAN Maximum Lengths */ +#define NAN_MAX_SERVICE_NAME_LEN 255 +#define NAN_MAX_MATCH_FILTER_LEN 255 +#define NAN_MAX_SERVICE_SPECIFIC_INFO_LEN 1024 +#define NAN_MAX_VSA_DATA_LEN 1024 +#define NAN_MAX_MESH_DATA_LEN 32 +#define NAN_MAX_INFRA_DATA_LEN 32 +#define NAN_MAX_CLUSTER_ATTRIBUTE_LEN 255 +#define NAN_MAX_SUBSCRIBE_MAX_ADDRESS 42 +#define NAN_MAX_FAM_CHANNELS 32 +#define NAN_MAX_POSTDISCOVERY_LEN 5 +#define NAN_MAX_FRAME_DATA_LEN 504 +#define NAN_DP_MAX_APP_INFO_LEN 512 +#define NAN_ERROR_STR_LEN 255 +#define NAN_PMK_INFO_LEN 32 +#define NAN_MAX_SCID_BUF_LEN 1024 +#define NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN 1024 +#define NAN_SECURITY_MIN_PASSPHRASE_LEN 8 +#define NAN_SECURITY_MAX_PASSPHRASE_LEN 63 +#define NAN_MAX_CHANNEL_INFO_SUPPORTED 4 + +/* + Definition of various NanResponseType +*/ +typedef enum { + NAN_RESPONSE_ENABLED = 0, + NAN_RESPONSE_DISABLED = 1, + NAN_RESPONSE_PUBLISH = 2, + NAN_RESPONSE_PUBLISH_CANCEL = 3, + NAN_RESPONSE_TRANSMIT_FOLLOWUP = 4, + NAN_RESPONSE_SUBSCRIBE = 5, + NAN_RESPONSE_SUBSCRIBE_CANCEL = 6, + NAN_RESPONSE_STATS = 7, + NAN_RESPONSE_CONFIG = 8, + NAN_RESPONSE_TCA = 9, + NAN_RESPONSE_ERROR = 10, + NAN_RESPONSE_BEACON_SDF_PAYLOAD = 11, + NAN_GET_CAPABILITIES = 12, + NAN_DP_INTERFACE_CREATE = 13, + NAN_DP_INTERFACE_DELETE = 14, + NAN_DP_INITIATOR_RESPONSE = 15, + NAN_DP_RESPONDER_RESPONSE = 16, + NAN_DP_END = 17 +} NanResponseType; + +/* NAN Publish Types */ +typedef enum { + NAN_PUBLISH_TYPE_UNSOLICITED = 0, + NAN_PUBLISH_TYPE_SOLICITED, + NAN_PUBLISH_TYPE_UNSOLICITED_SOLICITED +} NanPublishType; + +/* NAN Transmit Priorities */ +typedef enum { NAN_TX_PRIORITY_NORMAL = 0, NAN_TX_PRIORITY_HIGH } NanTxPriority; + +/* NAN Statistics Request ID Codes */ +typedef enum { + NAN_STATS_ID_DE_PUBLISH = 0, + NAN_STATS_ID_DE_SUBSCRIBE, + NAN_STATS_ID_DE_MAC, + NAN_STATS_ID_DE_TIMING_SYNC, + NAN_STATS_ID_DE_DW, + NAN_STATS_ID_DE +} NanStatsType; + +/* NAN Protocol Event ID Codes */ +typedef enum { + NAN_EVENT_ID_DISC_MAC_ADDR = 0, + NAN_EVENT_ID_STARTED_CLUSTER, + NAN_EVENT_ID_JOINED_CLUSTER +} NanDiscEngEventType; + +/* NAN Data Path type */ +typedef enum { NAN_DATA_PATH_UNICAST_MSG = 0, NAN_DATA_PATH_MULTICAST_MSG } NdpType; + +/* NAN Ranging Configuration */ +typedef enum { NAN_RANGING_DISABLE = 0, NAN_RANGING_ENABLE } NanRangingState; + +/* TCA Type */ +typedef enum { NAN_TCA_ID_CLUSTER_SIZE = 0 } NanTcaType; + +/* NAN Channel Info */ +typedef struct { + u32 channel; + u32 bandwidth; + u32 nss; +} NanChannelInfo; + +/* + Various NAN Protocol Response code +*/ +typedef enum { + /* NAN Protocol Response Codes */ + NAN_STATUS_SUCCESS = 0, + /* NAN Discovery Engine/Host driver failures */ + NAN_STATUS_INTERNAL_FAILURE = 1, + /* NAN OTA failures */ + NAN_STATUS_PROTOCOL_FAILURE = 2, + /* if the publish/subscribe id is invalid */ + NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID = 3, + /* If we run out of resources allocated */ + NAN_STATUS_NO_RESOURCE_AVAILABLE = 4, + /* if invalid params are passed */ + NAN_STATUS_INVALID_PARAM = 5, + /* if the requestor instance id is invalid */ + NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID = 6, + /* if the ndp id is invalid */ + NAN_STATUS_INVALID_NDP_ID = 7, + /* if NAN is enabled when wifi is turned off */ + NAN_STATUS_NAN_NOT_ALLOWED = 8, + /* if over the air ack is not received */ + NAN_STATUS_NO_OTA_ACK = 9, + /* If NAN is already enabled and we are try to re-enable the same */ + NAN_STATUS_ALREADY_ENABLED = 10, + /* If followup message internal queue is full */ + NAN_STATUS_FOLLOWUP_QUEUE_FULL = 11, + /* Unsupported concurrency session enabled, NAN disabled notified */ + NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED = 12 +} NanStatusType; + +/* NAN Transmit Types */ +typedef enum { NAN_TX_TYPE_BROADCAST = 0, NAN_TX_TYPE_UNICAST } NanTxType; + +/* NAN Subscribe Type */ +typedef enum { NAN_SUBSCRIBE_TYPE_PASSIVE = 0, NAN_SUBSCRIBE_TYPE_ACTIVE } NanSubscribeType; + +/* NAN Service Response Filter Attribute Bit */ +typedef enum { NAN_SRF_ATTR_BLOOM_FILTER = 0, NAN_SRF_ATTR_PARTIAL_MAC_ADDR } NanSRFType; + +/* NAN Service Response Filter Include Bit */ +typedef enum { NAN_SRF_INCLUDE_DO_NOT_RESPOND = 0, NAN_SRF_INCLUDE_RESPOND } NanSRFIncludeType; + +/* NAN Match indication type */ +typedef enum { + NAN_MATCH_ALG_MATCH_ONCE = 0, + NAN_MATCH_ALG_MATCH_CONTINUOUS, + NAN_MATCH_ALG_MATCH_NEVER +} NanMatchAlg; + +/* NAN Transmit Window Type */ +typedef enum { NAN_TRANSMIT_IN_DW = 0, NAN_TRANSMIT_IN_FAW } NanTransmitWindowType; + +/* NAN SRF State in Subscribe */ +typedef enum { NAN_DO_NOT_USE_SRF = 0, NAN_USE_SRF } NanSRFState; + +/* NAN Include SSI in MatchInd */ +typedef enum { + NAN_SSI_NOT_REQUIRED_IN_MATCH_IND = 0, + NAN_SSI_REQUIRED_IN_MATCH_IND +} NanSsiInMatchInd; + +/* NAN DP security Configuration */ +typedef enum { NAN_DP_CONFIG_NO_SECURITY = 0, NAN_DP_CONFIG_SECURITY } NanDataPathSecurityCfgStatus; + +typedef enum { NAN_QOS_NOT_REQUIRED = 0, NAN_QOS_REQUIRED } NanQosCfgStatus; + +/* Data request Responder's response */ +typedef enum { NAN_DP_REQUEST_ACCEPT = 0, NAN_DP_REQUEST_REJECT } NanDataPathResponseCode; + +/* NAN DP channel config options */ +typedef enum { + NAN_DP_CHANNEL_NOT_REQUESTED = 0, + NAN_DP_REQUEST_CHANNEL_SETUP, + NAN_DP_FORCE_CHANNEL_SETUP +} NanDataPathChannelCfg; + +/* Enable/Disable NAN Ranging Auto response */ +typedef enum { + NAN_RANGING_AUTO_RESPONSE_ENABLE = 1, + NAN_RANGING_AUTO_RESPONSE_DISABLE +} NanRangingAutoResponse; + +/* Enable/Disable NAN service range report */ +typedef enum { NAN_DISABLE_RANGE_REPORT = 1, NAN_ENABLE_RANGE_REPORT } NanRangeReport; + +/* NAN Range Response */ +typedef enum { + NAN_RANGE_REQUEST_ACCEPT = 1, + NAN_RANGE_REQUEST_REJECT, + NAN_RANGE_REQUEST_CANCEL +} NanRangeResponse; + +/* NAN Security Key Input Type*/ +typedef enum { + NAN_SECURITY_KEY_INPUT_PMK = 1, + NAN_SECURITY_KEY_INPUT_PASSPHRASE +} NanSecurityKeyInputType; + +typedef struct { + /* pmk length */ + u32 pmk_len; + /* + PMK: Info is optional in Discovery phase. + PMK info can be passed during + the NDP session. + */ + u8 pmk[NAN_PMK_INFO_LEN]; +} NanSecurityPmk; + +typedef struct { + /* passphrase length */ + u32 passphrase_len; + /* + passphrase info is optional in Discovery phase. + passphrase info can be passed during + the NDP session. + */ + u8 passphrase[NAN_SECURITY_MAX_PASSPHRASE_LEN]; +} NanSecurityPassPhrase; + +typedef struct { + NanSecurityKeyInputType key_type; + union { + NanSecurityPmk pmk_info; + NanSecurityPassPhrase passphrase_info; + } body; +} NanSecurityKeyInfo; + +/* NAN Security Cipher Suites Mask */ +#define NAN_CIPHER_SUITE_SHARED_KEY_NONE 0x00 +#define NAN_CIPHER_SUITE_SHARED_KEY_128_MASK 0x01 +#define NAN_CIPHER_SUITE_SHARED_KEY_256_MASK 0x02 +#define NAN_CIPHER_SUITE_PUBLIC_KEY_2WDH_128_MASK 0x04 +#define NAN_CIPHER_SUITE_PUBLIC_KEY_2WDH_256_MASK 0x08 + +/* NAN ranging indication condition MASKS */ +#define NAN_RANGING_INDICATE_CONTINUOUS_MASK 0x01 +#define NAN_RANGING_INDICATE_INGRESS_MET_MASK 0x02 +#define NAN_RANGING_INDICATE_EGRESS_MET_MASK 0x04 + +/* NAN schedule update reason MASKS */ +#define NAN_SCHEDULE_UPDATE_NSS_MASK 0x01 +#define NAN_SCHEDULE_UPDATE_CHANNEL_MASK 0x02 + +/* + Structure to set the Service Descriptor Extension + Attribute (SDEA) passed as part of NanPublishRequest/ + NanSubscribeRequest/NanMatchInd. +*/ +typedef struct { + /* + Optional configuration of Data Path Enable request. + configure flag determines whether configuration needs + to be passed or not. + */ + u8 config_nan_data_path; + NdpType ndp_type; + /* + NAN secuirty required flag to indicate + if the security is enabled or disabled + */ + NanDataPathSecurityCfgStatus security_cfg; + /* + NAN ranging required flag to indicate + if ranging is enabled on disabled + */ + NanRangingState ranging_state; + /* + Enable/Disable Ranging report, + when configured NanRangeReportInd received + */ + NanRangeReport range_report; + /* + NAN QOS required flag to indicate + if QOS is required or not. + */ + NanQosCfgStatus qos_cfg; +} NanSdeaCtrlParams; + +/* + Nan Ranging Peer Info in MatchInd +*/ +typedef struct { + /* + Distance to the NAN device with the MAC address indicated + with ranged mac address. + */ + u32 range_measurement_mm; + /* Ranging event matching the configuration of continuous/ingress/egress. */ + u32 ranging_event_type; +} NanRangeInfo; + +/* Nan/NDP Capabilites info */ +typedef struct { + u32 max_concurrent_nan_clusters; + u32 max_publishes; + u32 max_subscribes; + u32 max_service_name_len; + u32 max_match_filter_len; + u32 max_total_match_filter_len; + u32 max_service_specific_info_len; + u32 max_vsa_data_len; + u32 max_mesh_data_len; + u32 max_ndi_interfaces; + u32 max_ndp_sessions; + u32 max_app_info_len; + u32 max_queued_transmit_followup_msgs; + u32 ndp_supported_bands; + u32 cipher_suites_supported; + u32 max_scid_len; + bool is_ndp_security_supported; + u32 max_sdea_service_specific_info_len; + u32 max_subscribe_address; + u32 ndpe_attr_supported; + bool is_instant_mode_supported; +} NanCapabilities; + +/* + Nan accept policy: Per service basis policy + Based on this policy(ALL/NONE), responder side + will send ACCEPT/REJECT +*/ +typedef enum { + NAN_SERVICE_ACCEPT_POLICY_NONE = 0, + /* Default value */ + NAN_SERVICE_ACCEPT_POLICY_ALL +} NanServiceAcceptPolicy; + +/* + Host can send Vendor specific attributes which the Discovery Engine can + enclose in Beacons and/or Service Discovery frames transmitted. + Below structure is used to populate that. +*/ +typedef struct { + /* + 0 = transmit only in the next discovery window + 1 = transmit in next 16 discovery window + */ + u8 payload_transmit_flag; + /* + Below flags will determine in which all frames + the vendor specific attributes should be included + */ + u8 tx_in_discovery_beacon; + u8 tx_in_sync_beacon; + u8 tx_in_service_discovery; + /* Organizationally Unique Identifier */ + u32 vendor_oui; + /* + vendor specific attribute to be transmitted + vsa_len : Length of the vsa data. + */ + u32 vsa_len; + u8 vsa[NAN_MAX_VSA_DATA_LEN]; +} NanTransmitVendorSpecificAttribute; + +/* + Discovery Engine will forward any Vendor Specific Attributes + which it received as part of this structure. +*/ +/* Mask to determine on which frames attribute was received */ +#define RX_DISCOVERY_BEACON_MASK 0x01 +#define RX_SYNC_BEACON_MASK 0x02 +#define RX_SERVICE_DISCOVERY_MASK 0x04 +typedef struct { + /* + Frames on which this vendor specific attribute + was received. Mask defined above + */ + u8 vsa_received_on; + /* Organizationally Unique Identifier */ + u32 vendor_oui; + /* vendor specific attribute */ + u32 attr_len; + u8 vsa[NAN_MAX_VSA_DATA_LEN]; +} NanReceiveVendorSpecificAttribute; + +/* + NAN Beacon SDF Payload Received structure + Discovery engine sends the details of received Beacon or + Service Discovery Frames as part of this structure. +*/ +typedef struct { + /* Frame data */ + u32 frame_len; + u8 frame_data[NAN_MAX_FRAME_DATA_LEN]; +} NanBeaconSdfPayloadReceive; + +/* + Host can set the Periodic scan parameters for each of the + 3(6, 44, 149) Social channels. Only these channels are allowed + any other channels are rejected +*/ +typedef enum { + NAN_CHANNEL_24G_BAND = 0, + NAN_CHANNEL_5G_BAND_LOW, + NAN_CHANNEL_5G_BAND_HIGH +} NanChannelIndex; + +/* + Structure to set the Social Channel Scan parameters + passed as part of NanEnableRequest/NanConfigRequest +*/ +typedef struct { + /* + Dwell time of each social channel in milliseconds + NanChannelIndex corresponds to the respective channel + If time set to 0 then the FW default time will be used. + */ + u8 dwell_time[NAN_MAX_SOCIAL_CHANNELS]; // default value 200 msec + + /* + Scan period of each social channel in seconds + NanChannelIndex corresponds to the respective channel + If time set to 0 then the FW default time will be used. + */ + u16 scan_period[NAN_MAX_SOCIAL_CHANNELS]; // default value 20 sec +} NanSocialChannelScanParams; + +/* + Host can send Post Connectivity Capability attributes + to be included in Service Discovery frames transmitted + as part of this structure. +*/ +typedef struct { + /* + 0 = transmit only in the next discovery window + 1 = transmit in next 16 discovery window + */ + u8 payload_transmit_flag; + /* 1 - Wifi Direct supported 0 - Not supported */ + u8 is_wfd_supported; + /* 1 - Wifi Direct Services supported 0 - Not supported */ + u8 is_wfds_supported; + /* 1 - TDLS supported 0 - Not supported */ + u8 is_tdls_supported; + /* 1 - IBSS supported 0 - Not supported */ + u8 is_ibss_supported; + /* 1 - Mesh supported 0 - Not supported */ + u8 is_mesh_supported; + /* + 1 - NAN Device currently connect to WLAN Infra AP + 0 - otherwise + */ + u8 wlan_infra_field; +} NanTransmitPostConnectivityCapability; + +/* + Discovery engine providing the post connectivity capability + received. +*/ +typedef struct { + /* 1 - Wifi Direct supported 0 - Not supported */ + u8 is_wfd_supported; + /* 1 - Wifi Direct Services supported 0 - Not supported */ + u8 is_wfds_supported; + /* 1 - TDLS supported 0 - Not supported */ + u8 is_tdls_supported; + /* 1 - IBSS supported 0 - Not supported */ + u8 is_ibss_supported; + /* 1 - Mesh supported 0 - Not supported */ + u8 is_mesh_supported; + /* + 1 - NAN Device currently connect to WLAN Infra AP + 0 - otherwise + */ + u8 wlan_infra_field; +} NanReceivePostConnectivityCapability; + +/* + Indicates the availability interval duration associated with the + Availability Intervals Bitmap field +*/ +typedef enum { + NAN_DURATION_16MS = 0, + NAN_DURATION_32MS = 1, + NAN_DURATION_64MS = 2 +} NanAvailDuration; + +/* Further availability per channel information */ +typedef struct { + /* Defined above */ + NanAvailDuration entry_control; + /* + 1 byte field indicating the frequency band the NAN Device + will be available as defined in IEEE Std. 802.11-2012 + Annex E Table E-4 Global Operating Classes + */ + u8 class_val; + /* + 1 byte field indicating the channel the NAN Device + will be available. + */ + u8 channel; + /* + Map Id - 4 bit field which identifies the Further + availability map attribute. + */ + u8 mapid; + /* + divides the time between the beginnings of consecutive Discovery + Windows of a given NAN cluster into consecutive time intervals + of equal durations. The time interval duration is specified by + the Availability Interval Duration subfield of the Entry Control + field. + + A Nan device that sets the i-th bit of the Availability + Intervals Bitmap to 1 shall be present during the corresponding + i-th time interval in the operation channel indicated by the + Operating Class and Channel Number fields in the same Availability Entry. + + A Nan device that sets the i-th bit of the Availability Intervals Bitmap to + 0 may be present during the corresponding i-th time interval in the operation + channel indicated by the Operating Class and Channel Number fields in the same + Availability Entry. + + The size of the Bitmap is dependent upon the Availability Interval Duration + chosen in the Entry Control Field. The size can be either 1, 2 or 4 bytes long + + - Duration field is equal to 0, only AIB[0] is valid + - Duration field is equal to 1, only AIB [0] and AIB [1] is valid + - Duration field is equal to 2, AIB [0], AIB [1], AIB [2] and AIB [3] are valid + */ + u32 avail_interval_bitmap; +} NanFurtherAvailabilityChannel; + +/* + Further availability map which can be sent and received from + Discovery engine +*/ +typedef struct { + /* + Number of channels indicates the number of channel + entries which is part of fam + */ + u8 numchans; + NanFurtherAvailabilityChannel famchan[NAN_MAX_FAM_CHANNELS]; +} NanFurtherAvailabilityMap; + +/* + Host can send Post-Nan Discovery attributes which the Discovery Engine can + enclose in Service Discovery frames +*/ +/* Possible connection types in Post NAN Discovery attributes */ +typedef enum { + NAN_CONN_WLAN_INFRA = 0, + NAN_CONN_P2P_OPER = 1, + NAN_CONN_WLAN_IBSS = 2, + NAN_CONN_WLAN_MESH = 3, + NAN_CONN_FURTHER_SERVICE_AVAILABILITY = 4, + NAN_CONN_WLAN_RANGING = 5 +} NanConnectionType; + +/* Possible device roles in Post NAN Discovery attributes */ +typedef enum { + NAN_WLAN_INFRA_AP = 0, + NAN_WLAN_INFRA_STA = 1, + NAN_P2P_OPER_GO = 2, + NAN_P2P_OPER_DEV = 3, + NAN_P2P_OPER_CLI = 4 +} NanDeviceRole; + +/* Configuration params of NAN Ranging */ +typedef struct { + /* + Interval in milli sec between two ranging measurements. + If the Awake DW intervals in NanEnable/Config are larger + than the ranging intervals priority is given to Awake DW + Intervals. Only on a match the ranging is initiated for the + peer + */ + u32 ranging_interval_msec; + /* + Flags indicating the type of ranging event to be notified + NAN_RANGING_INDICATE_ MASKS are used to set these. + BIT0 - Continuous Ranging event notification. + BIT1 - Ingress distance is <=. + BIT2 - Egress distance is >=. + */ + u32 config_ranging_indications; + /* Ingress distance in millimeters (optional) */ + u32 distance_ingress_mm; + /* Egress distance in millmilliimeters (optional) */ + u32 distance_egress_mm; +} NanRangingCfg; + +/* NAN Ranging request's response */ +typedef struct { + /* Publish Id of an earlier Publisher */ + u16 publish_id; + /* + A 32 bit Requestor instance Id which is sent to the Application. + This Id will be used in subsequent RangeResponse on Subscribe side. + */ + u32 requestor_instance_id; + /* Peer MAC addr of Range Requestor */ + u8 peer_addr[NAN_MAC_ADDR_LEN]; + /* Response indicating ACCEPT/REJECT/CANCEL of Range Request */ + NanRangeResponse ranging_response; +} NanRangeResponseCfg; + +/* Structure of Post NAN Discovery attribute */ +typedef struct { + /* Connection type of the host */ + NanConnectionType type; + /* + Device role of the host based on + the connection type + */ + NanDeviceRole role; + /* + Flag to send the information as a single shot or repeated + for next 16 discovery windows + 0 - Single_shot + 1 - next 16 discovery windows + */ + u8 transmit_freq; + /* Duration of the availability bitmask */ + NanAvailDuration duration; + /* Availability interval bitmap based on duration */ + u32 avail_interval_bitmap; + /* + Mac address depending on the conn type and device role + -------------------------------------------------- + | Conn Type | Device Role | Mac address Usage | + -------------------------------------------------- + | WLAN_INFRA | AP/STA | BSSID of the AP | + -------------------------------------------------- + | P2P_OPER | GO | GO's address | + -------------------------------------------------- + | P2P_OPER | P2P_DEVICE | Address of who | + | | | would become GO | + -------------------------------------------------- + | WLAN_IBSS | NA | BSSID | + -------------------------------------------------- + | WLAN_MESH | NA | BSSID | + -------------------------------------------------- + */ + u8 addr[NAN_MAC_ADDR_LEN]; + /* + Mandatory mesh id value if connection type is WLAN_MESH + Mesh id contains 0-32 octet identifier and should be + as per IEEE Std.802.11-2012 spec. + */ + u16 mesh_id_len; + u8 mesh_id[NAN_MAX_MESH_DATA_LEN]; + /* + Optional infrastructure SSID if conn_type is set to + NAN_CONN_WLAN_INFRA + */ + u16 infrastructure_ssid_len; + u8 infrastructure_ssid_val[NAN_MAX_INFRA_DATA_LEN]; +} NanTransmitPostDiscovery; + +/* + Discovery engine providing the structure of Post NAN + Discovery +*/ +typedef struct { + /* Connection type of the host */ + NanConnectionType type; + /* + Device role of the host based on + the connection type + */ + NanDeviceRole role; + /* Duration of the availability bitmask */ + NanAvailDuration duration; + /* Availability interval bitmap based on duration */ + u32 avail_interval_bitmap; + /* + Map Id - 4 bit field which identifies the Further + availability map attribute. + */ + u8 mapid; + /* + Mac address depending on the conn type and device role + -------------------------------------------------- + | Conn Type | Device Role | Mac address Usage | + -------------------------------------------------- + | WLAN_INFRA | AP/STA | BSSID of the AP | + -------------------------------------------------- + | P2P_OPER | GO | GO's address | + -------------------------------------------------- + | P2P_OPER | P2P_DEVICE | Address of who | + | | | would become GO | + -------------------------------------------------- + | WLAN_IBSS | NA | BSSID | + -------------------------------------------------- + | WLAN_MESH | NA | BSSID | + -------------------------------------------------- + */ + u8 addr[NAN_MAC_ADDR_LEN]; + /* + Mandatory mesh id value if connection type is WLAN_MESH + Mesh id contains 0-32 octet identifier and should be + as per IEEE Std.802.11-2012 spec. + */ + u16 mesh_id_len; + u8 mesh_id[NAN_MAX_MESH_DATA_LEN]; + /* + Optional infrastructure SSID if conn_type is set to + NAN_CONN_WLAN_INFRA + */ + u16 infrastructure_ssid_len; + u8 infrastructure_ssid_val[NAN_MAX_INFRA_DATA_LEN]; +} NanReceivePostDiscovery; + +/* + NAN device level configuration of SDF and Sync beacons in both + 2.4/5GHz bands +*/ +typedef struct { + /* Configure 2.4GHz DW Band */ + u8 config_2dot4g_dw_band; + /* + Indicates the interval for Sync beacons and SDF's in 2.4GHz band. + Valid values of DW Interval are: 1, 2, 3, 4 and 5, 0 is reserved. + The SDF includes in OTA when enabled. The publish/subscribe period + values don't override the device level configurations. + */ + u32 dw_2dot4g_interval_val; // default value 1 + /* Configure 5GHz DW Band */ + u8 config_5g_dw_band; + /* + Indicates the interval for Sync beacons and SDF's in 5GHz band + Valid values of DW Interval are: 1, 2, 3, 4 and 5, 0 no wake up for + any interval. The SDF includes in OTA when enabled. The publish/subscribe + period values don't override the device level configurations. + */ + u32 dw_5g_interval_val; // default value 1 when 5G is enabled +} NanConfigDW; + +/* + Enable Request Message Structure + The NanEnableReq message instructs the Discovery Engine to enter an operational state +*/ +typedef struct { + /* Mandatory parameters below */ + u8 master_pref; // default value 0x02 + /* + A cluster_low value matching cluster_high indicates a request to join + a cluster with that value. If the requested cluster is not found the + device will start its own cluster. + */ + u16 cluster_low; // default value 0 + u16 cluster_high; // default value 0xFFFF + + /* + Optional configuration of Enable request. + Each of the optional parameters have configure flag which + determine whether configuration is to be passed or not. + */ + u8 config_support_5g; + u8 support_5g_val; // default value 0; turned off by default + /* + BIT 0 is used to specify to include Service IDs in Sync/Discovery beacons + 0 - Do not include SIDs in any beacons + 1 - Include SIDs in all beacons. + Rest 7 bits are count field which allows control over the number of SIDs + included in the Beacon. 0 means to include as many SIDs that fit into + the maximum allow Beacon frame size + */ + u8 config_sid_beacon; + u8 sid_beacon_val; // default value 0x01 + /* + The rssi values below should be specified without sign. + For eg: -70dBm should be specified as 70. + */ + u8 config_2dot4g_rssi_close; + u8 rssi_close_2dot4g_val; // default value -60 dBm + + u8 config_2dot4g_rssi_middle; + u8 rssi_middle_2dot4g_val; // default value -70 dBm + + u8 config_2dot4g_rssi_proximity; + u8 rssi_proximity_2dot4g_val; // default value -60dBm + + u8 config_hop_count_limit; + u8 hop_count_limit_val; // default value 0x02 + + /* + Defines 2.4G channel access support + 0 - No Support + 1 - Supported + */ + u8 config_2dot4g_support; + u8 support_2dot4g_val; // default value 0x01 + /* + Defines 2.4G channels will be used for sync/discovery beacons + 0 - 2.4G channels not used for beacons + 1 - 2.4G channels used for beacons + */ + u8 config_2dot4g_beacons; + u8 beacon_2dot4g_val; // default value 1 + /* + Defines 2.4G channels will be used for Service Discovery frames + 0 - 2.4G channels not used for Service Discovery frames + 1 - 2.4G channels used for Service Discovery frames + */ + u8 config_2dot4g_sdf; + u8 sdf_2dot4g_val; // default value 1 + /* + Defines 5G channels will be used for sync/discovery beacons + 0 - 5G channels not used for beacons + 1 - 5G channels used for beacons + */ + u8 config_5g_beacons; + u8 beacon_5g_val; // default value 1 when 5G is enabled + /* + Defines 5G channels will be used for Service Discovery frames + 0 - 5G channels not used for Service Discovery frames + 1 - 5G channels used for Service Discovery frames + */ + u8 config_5g_sdf; + u8 sdf_5g_val; // default value is 0 when 5G is enabled + /* + 1 byte value which defines the RSSI in + dBm for a close by Peer in 5 Ghz channels. + The rssi values should be specified without sign. + For eg: -70dBm should be specified as 70. + */ + u8 config_5g_rssi_close; + u8 rssi_close_5g_val; // default value -60dBm when 5G is enabled + /* + 1 byte value which defines the RSSI value in + dBm for a close by Peer in 5 Ghz channels. + The rssi values should be specified without sign. + For eg: -70dBm should be specified as 70. + */ + u8 config_5g_rssi_middle; + u8 rssi_middle_5g_val; // default value -75dBm when 5G is enabled + /* + 1 byte value which defines the RSSI filter + threshold. Any Service Descriptors received above this + value that are configured for RSSI filtering will be dropped. + The rssi values should be specified without sign. + For eg: -70dBm should be specified as 70. + */ + u8 config_5g_rssi_close_proximity; + u8 rssi_close_proximity_5g_val; // default value -60dBm when 5G is enabled + /* + 1 byte quantity which defines the window size over + which the “average RSSI” will be calculated over. + */ + u8 config_rssi_window_size; + u8 rssi_window_size_val; // default value 0x08 + /* + The 24 bit Organizationally Unique ID + the 8 bit Network Id. + */ + u8 config_oui; + u32 oui_val; // default value {0x51, 0x6F, 0x9A, 0x01, 0x00, 0x00} + /* + NAN Interface Address, If not configured the Discovery Engine + will generate a 6 byte Random MAC. + */ + u8 config_intf_addr; + u8 intf_addr_val[NAN_MAC_ADDR_LEN]; + /* + If set to 1, the Discovery Engine will enclose the Cluster + Attribute only sent in Beacons in a Vendor Specific Attribute + and transmit in a Service Descriptor Frame. + */ + u8 config_cluster_attribute_val; + /* + The periodicity in seconds between full scan’s to find any new + clusters available in the area. A Full scan should not be done + more than every 10 seconds and should not be done less than every + 30 seconds. + */ + u8 config_scan_params; + NanSocialChannelScanParams scan_params_val; + /* + 1 byte quantity which forces the Random Factor to a particular + value for all transmitted Sync/Discovery beacons + */ + u8 config_random_factor_force; + u8 random_factor_force_val; // default value off and set to 0x00 + /* + 1 byte quantity which forces the HC for all transmitted Sync and + Discovery Beacon NO matter the real HC being received over the + air. + */ + u8 config_hop_count_force; + u8 hop_count_force_val; // default value 0x00 + + /* channel frequency in MHz to enable Nan on */ + u8 config_24g_channel; + wifi_channel channel_24g_val; // default value channel 0x6 + + u8 config_5g_channel; + wifi_channel channel_5g_val; // default value channel 44 or 149 regulatory + // domain + /* Configure 2.4/5GHz DW */ + NanConfigDW config_dw; + + /* + By default discovery MAC address randomization is enabled + and default interval value is 30 minutes i.e. 1800 seconds. + The value 0 is used to disable MAC addr randomization. + */ + u8 config_disc_mac_addr_randomization; + u32 disc_mac_addr_rand_interval_sec; // default value 1800 sec + + /* + Set/Enable corresponding bits to disable Discovery indications: + BIT0 - Disable Discovery MAC Address Event. + BIT1 - Disable Started Cluster Event. + BIT2 - Disable Joined Cluster Event. + */ + u8 discovery_indication_cfg; // default value 0x0 + /* + BIT 0 is used to specify to include Service IDs in Sync/Discovery beacons + 0 - Do not include SIDs in any beacons + 1 - Include SIDs in all beacons. + Rest 7 bits are count field which allows control over the number of SIDs + included in the Beacon. 0 means to include as many SIDs that fit into + the maximum allow Beacon frame size + */ + u8 config_subscribe_sid_beacon; + u32 subscribe_sid_beacon_val; // default value 0x0 + /* + Discovery Beacon Interval config. + Default value is 128 msec in 2G DW and 176 msec in 2G/5G DW. + When 0 value is passed it is reset to default value of 128 or 176 msec. + */ + u8 config_discovery_beacon_int; + u32 discovery_beacon_interval; + /* + Enable Number of Spatial Streams. + This is NAN Power Optimization feature for NAN discovery. + */ + u8 config_nss; + // default value is implementation specific and passing 0 sets it to default + u32 nss; + /* + Enable device level NAN Ranging feature. + 0 - Disable + 1 - Enable + */ + u8 config_enable_ranging; + u32 enable_ranging; + /* + Enable/Disable DW Early termination. + 0 - Disable + 1 - Enable + */ + u8 config_dw_early_termination; + u32 enable_dw_termination; + /* + Indicate whether to use NDPE attribute to bring-up TCP/IP connection. + If config_ndpe_attr is not configured, the default behavior is + not using NDPE attr, and the capability is not advertised. + 0 - Not use + 1 - Use + */ + u8 config_ndpe_attr; + u32 use_ndpe_attr; + /* + Enable NAN v3.1 instant communication mode. + 0 - Disable + 1 - Enable + */ + u8 config_enable_instant_mode; + u32 enable_instant_mode; + /* + Config NAN v3.1 instant communication channel frequency selected over NFC/OOB method. + If dual band is supported default channel is 149 or 44 as per regulatory domain, + else channel 6 (send frequency in MHz). + Sometimes depending on country code retrictions, even 149/44 may be restricted + in those cases instant channel will be operational only in 2.4GHz. + Use wifi_get_usable_channels() API to get supported bands/channels before + Instant mode NFC handshake is triggered + */ + u8 config_instant_mode_channel; + wifi_channel instant_mode_channel; +} NanEnableRequest; + +/* + Publish Msg Structure + Message is used to request the DE to publish the Service Name + using the parameters passed into the Discovery Window +*/ +typedef struct { + u16 publish_id; /* id 0 means new publish, any other id is existing publish */ + u16 ttl; /* how many seconds to run for. 0 means forever until canceled */ + /* + period: Awake DW Interval for publish(service) + Indicates the interval between two Discovery Windows in which + the device supporting the service is awake to transmit or + receive the Service Discovery frames. + Valid values of Awake DW Interval are: 1, 2, 4, 8 and 16, value 0 will + default to 1. + */ + u16 period; + NanPublishType publish_type; /* 0= unsolicited, solicited = 1, 2= both */ + NanTxType tx_type; /* 0 = broadcast, 1= unicast if solicited publish */ + u8 publish_count; /* number of OTA Publish, 0 means forever until canceled */ + u16 service_name_len; /* length of service name */ + u8 service_name[NAN_MAX_SERVICE_NAME_LEN]; /* UTF-8 encoded string identifying the service */ + /* + Field which specifies how the matching indication to host is controlled. + 0 - Match and Indicate Once + 1 - Match and Indicate continuous + 2 - Match and Indicate never. This means don't indicate the match to the host. + 3 - Reserved + */ + NanMatchAlg publish_match_indicator; + + /* + Sequence of values + NAN Device that has invoked a Subscribe method corresponding to this Publish method + */ + u16 service_specific_info_len; + u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN]; + + /* + Ordered sequence of pairs which specify further response conditions + beyond the service name used to filter subscribe messages to respond to. + This is only needed when the PT is set to NAN_SOLICITED or NAN_SOLICITED_UNSOLICITED. + */ + u16 rx_match_filter_len; + u8 rx_match_filter[NAN_MAX_MATCH_FILTER_LEN]; + + /* + Ordered sequence of pairs to be included in the Discovery Frame. + If present it is always sent in a Discovery Frame + */ + u16 tx_match_filter_len; + u8 tx_match_filter[NAN_MAX_MATCH_FILTER_LEN]; + + /* + flag which specifies that the Publish should use the configured RSSI + threshold and the received RSSI in order to filter requests + 0 – ignore the configured RSSI threshold when running a Service + Descriptor attribute or Service ID List Attribute through the DE matching logic. + 1 – use the configured RSSI threshold when running a Service + Descriptor attribute or Service ID List Attribute through the DE matching logic. + + */ + u8 rssi_threshold_flag; + + /* + 8-bit bitmap which allows the Host to associate this publish + with a particular Post-NAN Connectivity attribute + which has been sent down in a NanConfigureRequest/NanEnableRequest + message. If the DE fails to find a configured Post-NAN + connectivity attributes referenced by the bitmap, + the DE will return an error code to the Host. + If the Publish is configured to use a Post-NAN Connectivity + attribute and the Host does not refresh the Post-NAN Connectivity + attribute the Publish will be canceled and the Host will be sent + a PublishTerminatedIndication message. + */ + u8 connmap; + /* + Set/Enable corresponding bits to disable any indications that follow a publish. + BIT0 - Disable publish termination indication. + BIT1 - Disable match expired indication. + BIT2 - Disable followUp indication received (OTA). + BIT3 - Disable publishReplied indication. + */ + u8 recv_indication_cfg; + /* + Nan accept policy for the specific service(publish) + */ + NanServiceAcceptPolicy service_responder_policy; + /* NAN Cipher Suite Type */ + u32 cipher_type; + /* + Nan Security Key Info is optional in Discovery phase. + PMK or passphrase info can be passed during + the NDP session. + */ + NanSecurityKeyInfo key_info; + + /* Security Context Identifiers length */ + u32 scid_len; + /* + Security Context Identifier attribute contains PMKID + shall be included in NDP setup and response messages. + Security Context Identifier, Identifies the Security + Context. For NAN Shared Key Cipher Suite, this field + contains the 16 octet PMKID identifying the PMK used + for setting up the Secure Data Path. + */ + u8 scid[NAN_MAX_SCID_BUF_LEN]; + + /* NAN configure service discovery extended attributes */ + NanSdeaCtrlParams sdea_params; + + /* NAN Ranging configuration */ + NanRangingCfg ranging_cfg; + + /* Enable/disable NAN serivce Ranging auto response mode */ + NanRangingAutoResponse ranging_auto_response; + + /* + When the ranging_auto_response_cfg is not set, NanRangeRequestInd is + received. Nan Range Response to Peer MAC Addr is notified to indicate + ACCEPT/REJECT/CANCEL to the requestor. + */ + NanRangeResponseCfg range_response_cfg; + + /* + Sequence of values indicating the service specific info in SDEA + */ + u16 sdea_service_specific_info_len; + u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN]; +} NanPublishRequest; + +/* + Publish Cancel Msg Structure + The PublishServiceCancelReq Message is used to request the DE to stop publishing + the Service Name identified by the Publish Id in the message. +*/ +typedef struct { + u16 publish_id; +} NanPublishCancelRequest; + +/* + NAN Subscribe Structure + The SubscribeServiceReq message is sent to the Discovery Engine + whenever the Upper layers would like to listen for a Service Name +*/ +typedef struct { + u16 subscribe_id; /* id 0 means new subscribe, non zero is existing subscribe */ + u16 ttl; /* how many seconds to run for. 0 means forever until canceled */ + /* + period: Awake DW Interval for subscribe(service) + Indicates the interval between two Discovery Windows in which + the device supporting the service is awake to transmit or + receive the Service Discovery frames. + Valid values of Awake DW Interval are: 1, 2, 4, 8 and 16, value 0 will + default to 1. + */ + u16 period; + + /* Flag which specifies how the Subscribe request shall be processed. */ + NanSubscribeType subscribe_type; /* 0 - PASSIVE , 1- ACTIVE */ + + /* Flag which specifies on Active Subscribes how the Service Response Filter attribute is + * populated.*/ + NanSRFType serviceResponseFilter; /* 0 - Bloom Filter, 1 - MAC Addr */ + + /* Flag which specifies how the Service Response Filter Include bit is populated.*/ + NanSRFIncludeType + serviceResponseInclude; /* 0=Do not respond if in the Address Set, 1= Respond */ + + /* Flag which specifies if the Service Response Filter should be used when creating + * Subscribes.*/ + NanSRFState useServiceResponseFilter; /* 0=Do not send the Service Response Filter,1= send */ + + /* + Flag which specifies if the Service Specific Info is needed in + the Publish message before creating the MatchIndication + */ + NanSsiInMatchInd ssiRequiredForMatchIndication; /* 0=Not needed, 1= Required */ + + /* + Field which specifies how the matching indication to host is controlled. + 0 - Match and Indicate Once + 1 - Match and Indicate continuous + 2 - Match and Indicate never. This means don't indicate the match to the host. + 3 - Reserved + */ + NanMatchAlg subscribe_match_indicator; + + /* + The number of Subscribe Matches which should occur + before the Subscribe request is automatically terminated. + */ + u8 subscribe_count; /* If this value is 0 this field is not used by the DE.*/ + + u16 service_name_len; /* length of service name */ + u8 service_name[NAN_MAX_SERVICE_NAME_LEN]; /* UTF-8 encoded string identifying the service */ + + /* Sequence of values which further specify the published service beyond the service name*/ + u16 service_specific_info_len; + u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN]; + + /* + Ordered sequence of pairs used to filter out received publish discovery + messages. This can be sent both for a Passive or an Active Subscribe + */ + u16 rx_match_filter_len; + u8 rx_match_filter[NAN_MAX_MATCH_FILTER_LEN]; + + /* + Ordered sequence of pairs included in the + Discovery Frame when an Active Subscribe is used. + */ + u16 tx_match_filter_len; + u8 tx_match_filter[NAN_MAX_MATCH_FILTER_LEN]; + + /* + Flag which specifies that the Subscribe should use the configured RSSI + threshold and the received RSSI in order to filter requests + 0 – ignore the configured RSSI threshold when running a Service + Descriptor attribute or Service ID List Attribute through the DE matching logic. + 1 – use the configured RSSI threshold when running a Service + Descriptor attribute or Service ID List Attribute through the DE matching logic. + + */ + u8 rssi_threshold_flag; + + /* + 8-bit bitmap which allows the Host to associate this Active + Subscribe with a particular Post-NAN Connectivity attribute + which has been sent down in a NanConfigureRequest/NanEnableRequest + message. If the DE fails to find a configured Post-NAN + connectivity attributes referenced by the bitmap, + the DE will return an error code to the Host. + If the Subscribe is configured to use a Post-NAN Connectivity + attribute and the Host does not refresh the Post-NAN Connectivity + attribute the Subscribe will be canceled and the Host will be sent + a SubscribeTerminatedIndication message. + */ + u8 connmap; + /* + NAN Interface Address, conforming to the format as described in + 8.2.4.3.2 of IEEE Std. 802.11-2012. + */ + u8 num_intf_addr_present; + u8 intf_addr[NAN_MAX_SUBSCRIBE_MAX_ADDRESS][NAN_MAC_ADDR_LEN]; + /* + Set/Enable corresponding bits to disable indications that follow a subscribe. + BIT0 - Disable subscribe termination indication. + BIT1 - Disable match expired indication. + BIT2 - Disable followUp indication received (OTA). + */ + u8 recv_indication_cfg; + + /* NAN Cipher Suite Type */ + u32 cipher_type; + /* + Nan Security Key Info is optional in Discovery phase. + PMK or passphrase info can be passed during + the NDP session. + */ + NanSecurityKeyInfo key_info; + + /* Security Context Identifiers length */ + u32 scid_len; + /* + Security Context Identifier attribute contains PMKID + shall be included in NDP setup and response messages. + Security Context Identifier, Identifies the Security + Context. For NAN Shared Key Cipher Suite, this field + contains the 16 octet PMKID identifying the PMK used + for setting up the Secure Data Path. + */ + u8 scid[NAN_MAX_SCID_BUF_LEN]; + + /* NAN configure service discovery extended attributes */ + NanSdeaCtrlParams sdea_params; + + /* NAN Ranging configuration */ + NanRangingCfg ranging_cfg; + + /* Enable/disable NAN serivce Ranging auto response mode */ + NanRangingAutoResponse ranging_auto_response; + + /* + When the ranging_auto_response_cfg is not set, NanRangeRequestInd is + received. Nan Range Response to Peer MAC Addr is notified to indicate + ACCEPT/REJECT/CANCEL to the requestor. + */ + NanRangeResponseCfg range_response_cfg; + + /* + Sequence of values indicating the service specific info in SDEA + */ + u16 sdea_service_specific_info_len; + u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN]; +} NanSubscribeRequest; + +/* + NAN Subscribe Cancel Structure + The SubscribeCancelReq Message is used to request the DE to stop looking for the Service Name. +*/ +typedef struct { + u16 subscribe_id; +} NanSubscribeCancelRequest; + +/* + Transmit follow up Structure + The TransmitFollowupReq message is sent to the DE to allow the sending of the + Service_Specific_Info to a particular MAC address. +*/ +typedef struct { + /* Publish or Subscribe Id of an earlier Publish/Subscribe */ + u16 publish_subscribe_id; + + /* + This Id is the Requestor Instance that is passed as + part of earlier MatchInd/FollowupInd message. + */ + u32 requestor_instance_id; + u8 addr[NAN_MAC_ADDR_LEN]; /* Unicast address */ + NanTxPriority priority; /* priority of the request 2=high */ + NanTransmitWindowType dw_or_faw; /* 0= send in a DW, 1=send in FAW */ + + /* + Sequence of values which further specify the published service beyond + the service name. + */ + u16 service_specific_info_len; + u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN]; + /* + Set/Enable corresponding bits to disable responses after followUp. + BIT0 - Disable followUp response from FW. + */ + u8 recv_indication_cfg; + + /* + Sequence of values indicating the service specific info in SDEA + */ + u16 sdea_service_specific_info_len; + u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN]; +} NanTransmitFollowupRequest; + +/* + Stats Request structure + The Discovery Engine can be queried at runtime by the Host processor for statistics + concerning various parts of the Discovery Engine. +*/ +typedef struct { + NanStatsType stats_type; /* NAN Statistics Request Type */ + u8 clear; /* 0= Do not clear the stats and return the current contents , 1= Clear the associated + stats */ +} NanStatsRequest; + +/* + Config Structure + The NanConfigurationReq message is sent by the Host to the + Discovery Engine in order to configure the Discovery Engine during runtime. +*/ +typedef struct { + u8 config_sid_beacon; + u8 sid_beacon; + u8 config_rssi_proximity; + u8 rssi_proximity; // default value -60dBm + u8 config_master_pref; + u8 master_pref; // default value 0x02 + /* + 1 byte value which defines the RSSI filter threshold. + Any Service Descriptors received above this value + that are configured for RSSI filtering will be dropped. + The rssi values should be specified without sign. + For eg: -70dBm should be specified as 70. + */ + u8 config_5g_rssi_close_proximity; + u8 rssi_close_proximity_5g_val; // default value -60dBm + /* + Optional configuration of Configure request. + Each of the optional parameters have configure flag which + determine whether configuration is to be passed or not. + */ + /* + 1 byte quantity which defines the window size over + which the “average RSSI” will be calculated over. + */ + u8 config_rssi_window_size; + u8 rssi_window_size_val; // default value 0x08 + /* + If set to 1, the Discovery Engine will enclose the Cluster + Attribute only sent in Beacons in a Vendor Specific Attribute + and transmit in a Service Descriptor Frame. + */ + u8 config_cluster_attribute_val; + /* + The periodicity in seconds between full scan’s to find any new + clusters available in the area. A Full scan should not be done + more than every 10 seconds and should not be done less than every + 30 seconds. + */ + u8 config_scan_params; + NanSocialChannelScanParams scan_params_val; + /* + 1 byte quantity which forces the Random Factor to a particular + value for all transmitted Sync/Discovery beacons + */ + u8 config_random_factor_force; + u8 random_factor_force_val; // default value 0x00 + /* + 1 byte quantity which forces the HC for all transmitted Sync and + Discovery Beacon NO matter the real HC being received over the + air. + */ + u8 config_hop_count_force; + u8 hop_count_force_val; // default value of 0 + /* NAN Post Connectivity Capability */ + u8 config_conn_capability; + NanTransmitPostConnectivityCapability conn_capability_val; + /* NAN Post Discover Capability */ + u8 num_config_discovery_attr; + NanTransmitPostDiscovery discovery_attr_val[NAN_MAX_POSTDISCOVERY_LEN]; + /* NAN Further availability Map */ + u8 config_fam; + NanFurtherAvailabilityMap fam_val; + /* Configure 2.4/5GHz DW */ + NanConfigDW config_dw; + /* + By default discovery MAC address randomization is enabled + and default interval value is 30 minutes i.e. 1800 seconds. + The value 0 is used to disable MAC addr randomization. + */ + u8 config_disc_mac_addr_randomization; + u32 disc_mac_addr_rand_interval_sec; // default value of 30 minutes + + /* + Set/Enable corresponding bits to disable Discovery indications: + BIT0 - Disable Discovery MAC Address Event. + BIT1 - Disable Started Cluster Event. + BIT2 - Disable Joined Cluster Event. + */ + u8 discovery_indication_cfg; // default value of 0 + /* + BIT 0 is used to specify to include Service IDs in Sync/Discovery beacons + 0 - Do not include SIDs in any beacons + 1 - Include SIDs in all beacons. + Rest 7 bits are count field which allows control over the number of SIDs + included in the Beacon. 0 means to include as many SIDs that fit into + the maximum allow Beacon frame size + */ + u8 config_subscribe_sid_beacon; + u32 subscribe_sid_beacon_val; // default value 0x0 + /* + Discovery Beacon Interval config. + Default value is 128 msec in 2G DW and 176 msec in 2G/5G DW. + When 0 value is passed it is reset to default value of 128 or 176 msec. + */ + u8 config_discovery_beacon_int; + u32 discovery_beacon_interval; + /* + Enable Number of Spatial Streams. + This is NAN Power Optimization feature for NAN discovery. + */ + u8 config_nss; + // default value is implementation specific and passing 0 sets it to default + u32 nss; + /* + Enable device level NAN Ranging feature. + 0 - Disable + 1 - Enable + */ + u8 config_enable_ranging; + u32 enable_ranging; + /* + Enable/Disable DW Early termination. + 0 - Disable + 1 - Enable + */ + u8 config_dw_early_termination; + u32 enable_dw_termination; + /* + Indicate whether to use NDPE attribute to bring-up TCP/IP connection + If config_ndpe_attr is not configured, the default behavior is + not using NDPE attr, and the capability is not advertised. + 0 - Not use + 1 - Use + */ + u8 config_ndpe_attr; + u32 use_ndpe_attr; + /* + Enable NAN v3.1 instant communication mode. + 0 - Disable + 1 - Enable + */ + u8 config_enable_instant_mode; + u32 enable_instant_mode; + /* + Config NAN v3.1 instant communication channel selected over NFC/OOB method. + If dual band is supported default channel is 149 or 44 as per regulatory domain, + else channel 6 (send frequency in MHz). + Sometimes depending on country code retrictions, even 149/44 may be restricted + in those cases instant channel will be operational only in 2.4GHz. + Use wifi_get_usable_channels() API to get supported bands/channels before + Instant mode NFC handshake is triggered + */ + u8 config_instant_mode_channel; + wifi_channel instant_mode_channel; +} NanConfigRequest; + +/* + TCA Structure + The Discovery Engine can be configured to send up Events whenever a configured + Threshold Crossing Alert (TCA) Type crosses an integral threshold in a particular direction. +*/ +typedef struct { + NanTcaType tca_type; /* Nan Protocol Threshold Crossing Alert (TCA) Codes */ + + /* flag which control whether or not an event is generated for the Rising direction */ + u8 rising_direction_evt_flag; /* 0 - no event, 1 - event */ + + /* flag which control whether or not an event is generated for the Falling direction */ + u8 falling_direction_evt_flag; /* 0 - no event, 1 - event */ + + /* flag which requests a previous TCA request to be cleared from the DE */ + u8 clear; /*0= Do not clear the TCA, 1=Clear the TCA */ + + /* 32 bit value which represents the threshold to be used.*/ + u32 threshold; +} NanTCARequest; + +/* + Beacon Sdf Payload Structure + The Discovery Engine can be configured to publish vendor specific attributes as part of + beacon or service discovery frame transmitted as part of this request.. +*/ +typedef struct { + /* + NanVendorAttribute will have the Vendor Specific Attribute which the + vendor wants to publish as part of Discovery or Sync or Service discovery frame + */ + NanTransmitVendorSpecificAttribute vsa; +} NanBeaconSdfPayloadRequest; + +/* Publish statistics. */ +typedef struct { + u32 validPublishServiceReqMsgs; + u32 validPublishServiceRspMsgs; + u32 validPublishServiceCancelReqMsgs; + u32 validPublishServiceCancelRspMsgs; + u32 validPublishRepliedIndMsgs; + u32 validPublishTerminatedIndMsgs; + u32 validActiveSubscribes; + u32 validMatches; + u32 validFollowups; + u32 invalidPublishServiceReqMsgs; + u32 invalidPublishServiceCancelReqMsgs; + u32 invalidActiveSubscribes; + u32 invalidMatches; + u32 invalidFollowups; + u32 publishCount; + u32 publishNewMatchCount; + u32 pubsubGlobalNewMatchCount; +} NanPublishStats; + +/* Subscribe statistics. */ +typedef struct { + u32 validSubscribeServiceReqMsgs; + u32 validSubscribeServiceRspMsgs; + u32 validSubscribeServiceCancelReqMsgs; + u32 validSubscribeServiceCancelRspMsgs; + u32 validSubscribeTerminatedIndMsgs; + u32 validSubscribeMatchIndMsgs; + u32 validSubscribeUnmatchIndMsgs; + u32 validSolicitedPublishes; + u32 validMatches; + u32 validFollowups; + u32 invalidSubscribeServiceReqMsgs; + u32 invalidSubscribeServiceCancelReqMsgs; + u32 invalidSubscribeFollowupReqMsgs; + u32 invalidSolicitedPublishes; + u32 invalidMatches; + u32 invalidFollowups; + u32 subscribeCount; + u32 bloomFilterIndex; + u32 subscribeNewMatchCount; + u32 pubsubGlobalNewMatchCount; +} NanSubscribeStats; + +/* NAN DW Statistics*/ +typedef struct { + /* RX stats */ + u32 validFrames; + u32 validActionFrames; + u32 validBeaconFrames; + u32 ignoredActionFrames; + u32 ignoredBeaconFrames; + u32 invalidFrames; + u32 invalidActionFrames; + u32 invalidBeaconFrames; + u32 invalidMacHeaders; + u32 invalidPafHeaders; + u32 nonNanBeaconFrames; + + u32 earlyActionFrames; + u32 inDwActionFrames; + u32 lateActionFrames; + + /* TX stats */ + u32 framesQueued; + u32 totalTRSpUpdates; + u32 completeByTRSp; + u32 completeByTp75DW; + u32 completeByTendDW; + u32 lateActionFramesTx; +} NanDWStats; + +/* NAN MAC Statistics. */ +typedef struct { + /* RX stats */ + u32 validFrames; + u32 validActionFrames; + u32 validBeaconFrames; + u32 ignoredActionFrames; + u32 ignoredBeaconFrames; + u32 invalidFrames; + u32 invalidActionFrames; + u32 invalidBeaconFrames; + u32 invalidMacHeaders; + u32 invalidPafHeaders; + u32 nonNanBeaconFrames; + + u32 earlyActionFrames; + u32 inDwActionFrames; + u32 lateActionFrames; + + /* TX stats */ + u32 framesQueued; + u32 totalTRSpUpdates; + u32 completeByTRSp; + u32 completeByTp75DW; + u32 completeByTendDW; + u32 lateActionFramesTx; + + u32 twIncreases; + u32 twDecreases; + u32 twChanges; + u32 twHighwater; + u32 bloomFilterIndex; +} NanMacStats; + +/* NAN Sync Statistics*/ +typedef struct { + u64 currTsf; + u64 myRank; + u64 currAmRank; + u64 lastAmRank; + u32 currAmBTT; + u32 lastAmBTT; + u8 currAmHopCount; + u8 currRole; + u16 currClusterId; + + u64 timeSpentInCurrRole; + u64 totalTimeSpentAsMaster; + u64 totalTimeSpentAsNonMasterSync; + u64 totalTimeSpentAsNonMasterNonSync; + u32 transitionsToAnchorMaster; + u32 transitionsToMaster; + u32 transitionsToNonMasterSync; + u32 transitionsToNonMasterNonSync; + u32 amrUpdateCount; + u32 amrUpdateRankChangedCount; + u32 amrUpdateBTTChangedCount; + u32 amrUpdateHcChangedCount; + u32 amrUpdateNewDeviceCount; + u32 amrExpireCount; + u32 mergeCount; + u32 beaconsAboveHcLimit; + u32 beaconsBelowRssiThresh; + u32 beaconsIgnoredNoSpace; + u32 beaconsForOurCluster; + u32 beaconsForOtherCluster; + u32 beaconCancelRequests; + u32 beaconCancelFailures; + u32 beaconUpdateRequests; + u32 beaconUpdateFailures; + u32 syncBeaconTxAttempts; + u32 syncBeaconTxFailures; + u32 discBeaconTxAttempts; + u32 discBeaconTxFailures; + u32 amHopCountExpireCount; + u32 ndpChannelFreq; + u32 ndpChannelFreq2; + u32 schedUpdateChannelFreq; +} NanSyncStats; + +/* NAN Misc DE Statistics */ +typedef struct { + u32 validErrorRspMsgs; + u32 validTransmitFollowupReqMsgs; + u32 validTransmitFollowupRspMsgs; + u32 validFollowupIndMsgs; + u32 validConfigurationReqMsgs; + u32 validConfigurationRspMsgs; + u32 validStatsReqMsgs; + u32 validStatsRspMsgs; + u32 validEnableReqMsgs; + u32 validEnableRspMsgs; + u32 validDisableReqMsgs; + u32 validDisableRspMsgs; + u32 validDisableIndMsgs; + u32 validEventIndMsgs; + u32 validTcaReqMsgs; + u32 validTcaRspMsgs; + u32 validTcaIndMsgs; + u32 invalidTransmitFollowupReqMsgs; + u32 invalidConfigurationReqMsgs; + u32 invalidStatsReqMsgs; + u32 invalidEnableReqMsgs; + u32 invalidDisableReqMsgs; + u32 invalidTcaReqMsgs; +} NanDeStats; + +/* Publish Response Message structure */ +typedef struct { + u16 publish_id; +} NanPublishResponse; + +/* Subscribe Response Message structure */ +typedef struct { + u16 subscribe_id; +} NanSubscribeResponse; + +/* + Stats Response Message structure + The Discovery Engine response to a request by the Host for statistics. +*/ +typedef struct { + NanStatsType stats_type; + union { + NanPublishStats publish_stats; + NanSubscribeStats subscribe_stats; + NanMacStats mac_stats; + NanSyncStats sync_stats; + NanDeStats de_stats; + NanDWStats dw_stats; + } data; +} NanStatsResponse; + +/* Response returned for Initiators Data request */ +typedef struct { + /* + Unique token Id generated on the initiator + side used for a NDP session between two NAN devices + */ + NanDataPathId ndp_instance_id; +} NanDataPathRequestResponse; + +/* + NAN Response messages +*/ +typedef struct { + NanStatusType status; /* contains the result code */ + char nan_error[NAN_ERROR_STR_LEN]; /* Describe the NAN error type */ + NanResponseType response_type; /* NanResponseType Definitions */ + union { + NanPublishResponse publish_response; + NanSubscribeResponse subscribe_response; + NanStatsResponse stats_response; + NanDataPathRequestResponse data_request_response; + NanCapabilities nan_capabilities; + } body; +} NanResponseMsg; + +/* + Publish Replied Indication + The PublishRepliedInd Message is sent by the DE when an Active Subscribe is + received over the air and it matches a Solicited PublishServiceReq which had + been created with the replied_event_flag set. +*/ +typedef struct { + /* + A 32 bit Requestor Instance Id which is sent to the Application. + This Id will be sent in any subsequent UnmatchInd/FollowupInd + messages + */ + u32 requestor_instance_id; + u8 addr[NAN_MAC_ADDR_LEN]; + /* + If RSSI filtering was configured in NanPublishRequest then this + field will contain the received RSSI value. 0 if not + */ + u8 rssi_value; +} NanPublishRepliedInd; + +/* + Publish Terminated + The PublishTerminatedInd message is sent by the DE whenever a Publish + terminates from a user-specified timeout or a unrecoverable error in the DE. +*/ +typedef struct { + /* Id returned during the initial Publish */ + u16 publish_id; + /* + For all user configured termination NAN_STATUS_SUCCESS + and no other reasons expected from firmware. + */ + NanStatusType reason; + char nan_reason[NAN_ERROR_STR_LEN]; /* Describe the NAN reason type */ +} NanPublishTerminatedInd; + +/* + Match Indication + The MatchInd message is sent once per responding MAC address whenever + the Discovery Engine detects a match for a previous SubscribeServiceReq + or PublishServiceReq. +*/ +typedef struct { + /* Publish or Subscribe Id of an earlier Publish/Subscribe */ + u16 publish_subscribe_id; + /* + A 32 bit Requestor Instance Id which is sent to the Application. + This Id will be sent in any subsequent UnmatchInd/FollowupInd + messages + */ + u32 requestor_instance_id; + u8 addr[NAN_MAC_ADDR_LEN]; + + /* + Sequence of octets which were received in a Discovery Frame matching the + Subscribe Request. + */ + u16 service_specific_info_len; + u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN]; + + /* + Ordered sequence of pairs received in the Discovery Frame + matching the Subscribe Request. + */ + u16 sdf_match_filter_len; + u8 sdf_match_filter[NAN_MAX_MATCH_FILTER_LEN]; + + /* + flag to indicate if the Match occurred in a Beacon Frame or in a + Service Discovery Frame. + 0 - Match occured in a Service Discovery Frame + 1 - Match occured in a Beacon Frame + */ + u8 match_occured_flag; + + /* + flag to indicate FW is out of resource and that it can no longer + track this Service Name. The Host still need to send the received + Match_Handle but duplicate MatchInd messages may be received on + this Handle until the resource frees up. + 0 - FW is caching this match + 1 - FW is unable to cache this match + */ + u8 out_of_resource_flag; + + /* + If RSSI filtering was configured in NanSubscribeRequest then this + field will contain the received RSSI value. 0 if not. + All rssi values should be specified without sign. + For eg: -70dBm should be specified as 70. + */ + u8 rssi_value; + + /* + optional attributes. Each optional attribute is associated with a flag + which specifies whether the attribute is valid or not + */ + /* NAN Post Connectivity Capability received */ + u8 is_conn_capability_valid; + NanReceivePostConnectivityCapability conn_capability; + + /* NAN Post Discover Capability */ + u8 num_rx_discovery_attr; + NanReceivePostDiscovery discovery_attr[NAN_MAX_POSTDISCOVERY_LEN]; + + /* NAN Further availability Map */ + u8 num_chans; + NanFurtherAvailabilityChannel famchan[NAN_MAX_FAM_CHANNELS]; + + /* NAN Cluster Attribute */ + u8 cluster_attribute_len; + u8 cluster_attribute[NAN_MAX_CLUSTER_ATTRIBUTE_LEN]; + + /* NAN Cipher Suite */ + u32 peer_cipher_type; + + /* Security Context Identifiers length */ + u32 scid_len; + /* + Security Context Identifier attribute contains PMKID + shall be included in NDP setup and response messages. + Security Context Identifier, Identifies the Security + Context. For NAN Shared Key Cipher Suite, this field + contains the 16 octet PMKID identifying the PMK used + for setting up the Secure Data Path. + */ + u8 scid[NAN_MAX_SCID_BUF_LEN]; + + /* Peer service discovery extended attributes */ + NanSdeaCtrlParams peer_sdea_params; + + /* + Ranging indication and NanMatchAlg are not tied. + Ex: NanMatchAlg can indicate Match_ONCE, but ranging + indications can be continuous. All ranging indications + depend on SDEA control parameters of ranging required for + continuous, and ingress/egress values in the ranging config. + Ranging indication data is notified if: + 1) Ranging required is enabled in SDEA. + range info notified continuous. + 2) if range_limit ingress/egress MASKS are enabled + notify once for ingress >= ingress_distance + and egress <= egress_distance, same for ingress_egress_both + 3) if the Awake DW intervals are higher than the ranging intervals, + priority is given to the device DW intervalsi. + */ + /* + Range Info includes: + 1) distance to the NAN device with the MAC address indicated + with ranged mac address. + 2) Ranging event matching the configuration of continuous/ingress/egress. + */ + NanRangeInfo range_info; + + /* + Sequence of values indicating the service specific info in SDEA + */ + u16 sdea_service_specific_info_len; + u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN]; +} NanMatchInd; + +/* + MatchExpired Indication + The MatchExpiredInd message is sent whenever the Discovery Engine detects that + a previously Matched Service has been gone for too long. If the previous + MatchInd message for this Publish/Subscribe Id had the out_of_resource_flag + set then this message will not be received +*/ +typedef struct { + /* Publish or Subscribe Id of an earlier Publish/Subscribe */ + u16 publish_subscribe_id; + /* + 32 bit value sent by the DE in a previous + MatchInd/FollowupInd to the application. + */ + u32 requestor_instance_id; +} NanMatchExpiredInd; + +/* + Subscribe Terminated + The SubscribeTerminatedInd message is sent by the DE whenever a + Subscribe terminates from a user-specified timeout or a unrecoverable error in the DE. +*/ +typedef struct { + /* Id returned during initial Subscribe */ + u16 subscribe_id; + /* + For all user configured termination NAN_STATUS_SUCCESS + and no other reasons expected from firmware. + */ + NanStatusType reason; + char nan_reason[NAN_ERROR_STR_LEN]; /* Describe the NAN reason type */ +} NanSubscribeTerminatedInd; + +/* + Followup Indication Message + The FollowupInd message is sent by the DE to the Host whenever it receives a + Followup message from another peer. +*/ +typedef struct { + /* Publish or Subscribe Id of an earlier Publish/Subscribe */ + u16 publish_subscribe_id; + /* + A 32 bit Requestor instance Id which is sent to the Application. + This Id will be used in subsequent UnmatchInd/FollowupInd messages. + */ + u32 requestor_instance_id; + u8 addr[NAN_MAC_ADDR_LEN]; + + /* Flag which the DE uses to decide if received in a DW or a FAW*/ + u8 dw_or_faw; /* 0=Received in a DW, 1 = Received in a FAW*/ + + /* + Sequence of values which further specify the published service beyond + the service name + */ + u16 service_specific_info_len; + u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN]; + + /* + Sequence of values indicating the service specific info in SDEA + */ + u16 sdea_service_specific_info_len; + u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN]; +} NanFollowupInd; + +/* + Event data notifying the Mac address of the Discovery engine. + which is reported as one of the Discovery engine event +*/ +typedef struct { + u8 addr[NAN_MAC_ADDR_LEN]; +} NanMacAddressEvent; + +/* + Event data notifying the Cluster address of the cluster + which is reported as one of the Discovery engine event +*/ +typedef struct { + u8 addr[NAN_MAC_ADDR_LEN]; +} NanClusterEvent; + +/* + Discovery Engine Event Indication + The Discovery Engine can inform the Host when significant events occur + The data following the EventId is dependent upon the EventId type. + In other words, each new event defined will carry a different + structure of information back to the host. +*/ +typedef struct { + NanDiscEngEventType event_type; /* NAN Protocol Event Codes */ + union { + /* + MacAddressEvent which will have 6 byte mac address + of the Discovery engine. + */ + NanMacAddressEvent mac_addr; + /* + Cluster Event Data which will be obtained when the + device starts a new cluster or joins a cluster. + The event data will have 6 byte octet string of the + cluster started or joined. + */ + NanClusterEvent cluster; + } data; +} NanDiscEngEventInd; + +/* Cluster size TCA event*/ +typedef struct { + /* size of the cluster*/ + u32 cluster_size; +} NanTcaClusterEvent; + +/* + NAN TCA Indication + The Discovery Engine can inform the Host when significant events occur. + The data following the TcaId is dependent upon the TcaId type. + In other words, each new event defined will carry a different structure + of information back to the host. +*/ +typedef struct { + NanTcaType tca_type; + /* flag which defines if the configured Threshold has risen above the threshold */ + u8 rising_direction_evt_flag; /* 0 - no event, 1 - event */ + + /* flag which defines if the configured Threshold has fallen below the threshold */ + u8 falling_direction_evt_flag; /* 0 - no event, 1 - event */ + union { + /* + This event in obtained when the cluser size threshold + is crossed. Event will have the cluster size + */ + NanTcaClusterEvent cluster; + } data; +} NanTCAInd; + +/* + NAN Disabled Indication + The NanDisableInd message indicates to the upper layers that the Discovery + Engine has flushed all state and has been shutdown. When this message is received + the DE is guaranteed to have left the NAN cluster it was part of and will have terminated + any in progress Publishes or Subscribes. +*/ +typedef struct { + /* + Following reasons expected: + NAN_STATUS_SUCCESS + NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED + */ + NanStatusType reason; + char nan_reason[NAN_ERROR_STR_LEN]; /* Describe the NAN reason type */ +} NanDisabledInd; + +/* + NAN Beacon or SDF Payload Indication + The NanBeaconSdfPayloadInd message indicates to the upper layers that information + elements were received either in a Beacon or SDF which needs to be delivered + outside of a Publish/Subscribe Handle. +*/ +typedef struct { + /* The MAC address of the peer which sent the attributes.*/ + u8 addr[NAN_MAC_ADDR_LEN]; + /* + Optional attributes. Each optional attribute is associated with a flag + which specifies whether the attribute is valid or not + */ + /* NAN Receive Vendor Specific Attribute*/ + u8 is_vsa_received; + NanReceiveVendorSpecificAttribute vsa; + + /* NAN Beacon or SDF Payload Received*/ + u8 is_beacon_sdf_payload_received; + NanBeaconSdfPayloadReceive data; +} NanBeaconSdfPayloadInd; + +/* + Event Indication notifying the + transmit followup in progress +*/ +typedef struct { + transaction_id id; + /* + Following reason codes returned: + NAN_STATUS_SUCCESS + NAN_STATUS_NO_OTA_ACK + NAN_STATUS_PROTOCOL_FAILURE + */ + NanStatusType reason; + char nan_reason[NAN_ERROR_STR_LEN]; /* Describe the NAN reason type */ +} NanTransmitFollowupInd; + +/* + Data request Initiator/Responder + app/service related info +*/ +typedef struct { + u16 ndp_app_info_len; + u8 ndp_app_info[NAN_DP_MAX_APP_INFO_LEN]; +} NanDataPathAppInfo; + +/* QoS configuration */ +typedef enum { NAN_DP_CONFIG_NO_QOS = 0, NAN_DP_CONFIG_QOS } NanDataPathQosCfg; + +/* Configuration params of Data request Initiator/Responder */ +typedef struct { + /* Status Indicating Security/No Security */ + NanDataPathSecurityCfgStatus security_cfg; + NanDataPathQosCfg qos_cfg; +} NanDataPathCfg; + +/* Nan Data Path Initiator requesting a data session */ +typedef struct { + /* + Unique Instance Id identifying the Responder's service. + This is same as publish_id notified on the subscribe side + in a publish/subscribe scenario + */ + u32 requestor_instance_id; /* Value 0 for no publish/subscribe */ + + /* Config flag for channel request */ + NanDataPathChannelCfg channel_request_type; + /* Channel frequency in MHz to start data-path */ + wifi_channel channel; + /* + Discovery MAC addr of the publisher/peer + */ + u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN]; + /* + Interface name on which this NDP session is to be started. + This will be the same interface name provided during interface + create. + */ + char ndp_iface[IFNAMSIZ + 1]; + /* Initiator/Responder Security/QoS configuration */ + NanDataPathCfg ndp_cfg; + /* App/Service information of the Initiator */ + NanDataPathAppInfo app_info; + /* NAN Cipher Suite Type */ + u32 cipher_type; + /* + Nan Security Key Info is optional in Discovery phase. + PMK or passphrase info can be passed during + the NDP session. + */ + NanSecurityKeyInfo key_info; + /* length of service name */ + u32 service_name_len; + /* + UTF-8 encoded string identifying the service name. + The service name field is only used if a Nan discovery + is not associated with the NDP (out-of-band discovery). + */ + u8 service_name[NAN_MAX_SERVICE_NAME_LEN]; + + /* Security Context Identifiers length */ + u32 scid_len; + /* + Security Context Identifier attribute contains PMKID + shall be included in NDP setup and response messages. + Security Context Identifier, Identifies the Security + Context. For NAN Shared Key Cipher Suite, this field + contains the 16 octet PMKID identifying the PMK used + for setting up the Secure Data Path. + */ + u8 scid[NAN_MAX_SCID_BUF_LEN]; +} NanDataPathInitiatorRequest; + +/* + Data struct to initiate a data response on the responder side + for an indication received with a data request +*/ +typedef struct { + /* + Unique token Id generated on the initiator/responder + side used for a NDP session between two NAN devices + */ + NanDataPathId ndp_instance_id; + /* + Interface name on which this NDP session is to be started. + This will be the same interface name provided during interface + create. + */ + char ndp_iface[IFNAMSIZ + 1]; + /* Initiator/Responder Security/QoS configuration */ + NanDataPathCfg ndp_cfg; + /* App/Service information of the responder */ + NanDataPathAppInfo app_info; + /* Response Code indicating ACCEPT/REJECT/DEFER */ + NanDataPathResponseCode rsp_code; + /* NAN Cipher Suite Type */ + u32 cipher_type; + /* + Nan Security Key Info is optional in Discovery phase. + PMK or passphrase info can be passed during + the NDP session. + */ + NanSecurityKeyInfo key_info; + /* length of service name */ + u32 service_name_len; + /* + UTF-8 encoded string identifying the service name. + The service name field is only used if a Nan discovery + is not associated with the NDP (out-of-band discovery). + */ + u8 service_name[NAN_MAX_SERVICE_NAME_LEN]; + + /* Security Context Identifiers length */ + u32 scid_len; + /* + Security Context Identifier attribute contains PMKID + shall be included in NDP setup and response messages. + Security Context Identifier, Identifies the Security + Context. For NAN Shared Key Cipher Suite, this field + contains the 16 octet PMKID identifying the PMK used + for setting up the Secure Data Path. + */ + u8 scid[NAN_MAX_SCID_BUF_LEN]; +} NanDataPathIndicationResponse; + +/* NDP termination info */ +typedef struct { + u8 num_ndp_instances; + /* + Unique token Id generated on the initiator/responder side + used for a NDP session between two NAN devices + */ + NanDataPathId ndp_instance_id[]; +} NanDataPathEndRequest; + +/* + Event indication received on the + responder side when a Nan Data request or + NDP session is initiated on the Initiator side +*/ +typedef struct { + /* + Unique Instance Id corresponding to a service/session. + This is similar to the publish_id generated on the + publisher side + */ + u16 service_instance_id; + /* Discovery MAC addr of the peer/initiator */ + u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN]; + /* + Unique token Id generated on the initiator/responder side + used for a NDP session between two NAN devices + */ + NanDataPathId ndp_instance_id; + /* Initiator/Responder Security/QoS configuration */ + NanDataPathCfg ndp_cfg; + /* App/Service information of the initiator */ + NanDataPathAppInfo app_info; + + /* Security Context Identifiers length */ + u32 scid_len; + /* + Security Context Identifier attribute contains PMKID + shall be included in NDP setup and response messages. + Security Context Identifier, Identifies the Security + Context. For NAN Shared Key Cipher Suite, this field + contains the 16 octet PMKID identifying the PMK used + for setting up the Secure Data Path. + */ + u8 scid[NAN_MAX_SCID_BUF_LEN]; +} NanDataPathRequestInd; + +/* + Event indication of data confirm is received on both + initiator and responder side confirming a NDP session +*/ +typedef struct { + /* + Unique token Id generated on the initiator/responder side + used for a NDP session between two NAN devices + */ + NanDataPathId ndp_instance_id; + /* + NDI mac address of the peer + (required to derive target ipv6 address) + */ + u8 peer_ndi_mac_addr[NAN_MAC_ADDR_LEN]; + /* App/Service information of Initiator/Responder */ + NanDataPathAppInfo app_info; + /* Response code indicating ACCEPT/REJECT/DEFER */ + NanDataPathResponseCode rsp_code; + /* + Reason code indicating the cause for REJECT. + NAN_STATUS_SUCCESS and NAN_STATUS_PROTOCOL_FAILURE are + expected reason codes. + */ + NanStatusType reason_code; + /* Number of channels for which info is indicated */ + u32 num_channels; + /* + Data indicating the Channel list and BW of the channel. + */ + NanChannelInfo channel_info[NAN_MAX_CHANNEL_INFO_SUPPORTED]; +} NanDataPathConfirmInd; + +/* + Event indication of schedule update is received on both + initiator and responder when a schedule change occurs +*/ +typedef struct { + /* + NMI mac address + */ + u8 peer_mac_addr[NAN_MAC_ADDR_LEN]; + /* + Reason code indicating the cause of schedule update. + BIT_0 NSS Update + BIT_1 Channel list update + */ + u32 schedule_update_reason_code; + /* Number of channels for which info is indicated */ + u32 num_channels; + /* + Data indicating the Channel list and BW of the channel. + */ + NanChannelInfo channel_info[NAN_MAX_CHANNEL_INFO_SUPPORTED]; + /* Number of NDP instance Ids */ + u8 num_ndp_instances; + /* + Unique token Id generated on the initiator/responder side + used for a NDP session between two NAN devices + */ + NanDataPathId ndp_instance_id[]; +} NanDataPathScheduleUpdateInd; + +/* + Event indication received on the + initiator/responder side terminating + a NDP session +*/ +typedef struct { + u8 num_ndp_instances; + /* + Unique token Id generated on the initiator/responder side + used for a NDP session between two NAN devices + */ + NanDataPathId ndp_instance_id[]; +} NanDataPathEndInd; + +/* + Event indicating Range Request received on the + Published side. +*/ +typedef struct { + u16 publish_id; /* id is existing publish */ + /* Range Requestor's MAC address */ + u8 range_req_intf_addr[NAN_MAC_ADDR_LEN]; +} NanRangeRequestInd; + +/* + Event indicating Range report on the + Published side. +*/ +typedef struct { + u16 publish_id; /* id is existing publish */ + /* Range Requestor's MAC address */ + u8 range_req_intf_addr[NAN_MAC_ADDR_LEN]; + /* + Distance to the NAN device with the MAC address indicated + with ranged mac address. + */ + u32 range_measurement_mm; +} NanRangeReportInd; + +/* Response and Event Callbacks */ +typedef struct { + /* NotifyResponse invoked to notify the status of the Request */ + void (*NotifyResponse)(transaction_id id, NanResponseMsg* rsp_data); + /* Callbacks for various Events */ + void (*EventPublishReplied)(NanPublishRepliedInd* event); + void (*EventPublishTerminated)(NanPublishTerminatedInd* event); + void (*EventMatch)(NanMatchInd* event); + void (*EventMatchExpired)(NanMatchExpiredInd* event); + void (*EventSubscribeTerminated)(NanSubscribeTerminatedInd* event); + void (*EventFollowup)(NanFollowupInd* event); + void (*EventDiscEngEvent)(NanDiscEngEventInd* event); + void (*EventDisabled)(NanDisabledInd* event); + void (*EventTca)(NanTCAInd* event); + void (*EventBeaconSdfPayload)(NanBeaconSdfPayloadInd* event); + void (*EventDataRequest)(NanDataPathRequestInd* event); + void (*EventDataConfirm)(NanDataPathConfirmInd* event); + void (*EventDataEnd)(NanDataPathEndInd* event); + void (*EventTransmitFollowup)(NanTransmitFollowupInd* event); + void (*EventRangeRequest)(NanRangeRequestInd* event); + void (*EventRangeReport)(NanRangeReportInd* event); + void (*EventScheduleUpdate)(NanDataPathScheduleUpdateInd* event); +} NanCallbackHandler; + +/**@brief nan_enable_request + * Enable NAN functionality + * + * @param transaction_id: + * @param wifi_interface_handle: + * @param NanEnableRequest: + * @return Synchronous wifi_error + * @return Asynchronous NotifyResponse CB return + * NAN_STATUS_SUCCESS + * NAN_STATUS_ALREADY_ENABLED + * NAN_STATUS_INVALID_PARAM + * NAN_STATUS_INTERNAL_FAILURE + * NAN_STATUS_PROTOCOL_FAILURE + * NAN_STATUS_NAN_NOT_ALLOWED + */ +wifi_error nan_enable_request(transaction_id id, wifi_interface_handle iface, + NanEnableRequest* msg); + +/**@brief nan_disbale_request + * Disable NAN functionality. + * + * @param transaction_id: + * @param wifi_interface_handle: + * @param NanDisableRequest: + * @return Synchronous wifi_error + * @return Asynchronous NotifyResponse CB return + * NAN_STATUS_SUCCESS + * NAN_STATUS_PROTOCOL_FAILURE + * + */ +wifi_error nan_disable_request(transaction_id id, wifi_interface_handle iface); + +/**@brief nan_publish_request + * Publish request to advertize a service + * + * @param transaction_id: + * @param wifi_interface_handle: + * @param NanPublishRequest: + * @return Synchronous wifi_error + * @return Asynchronous NotifyResponse CB return + * NAN_STATUS_SUCCESS + * NAN_STATUS_INVALID_PARAM + * NAN_STATUS_PROTOCOL_FAILURE + * NAN_STATUS_NO_RESOURCE_AVAILABLE + * NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID + */ +wifi_error nan_publish_request(transaction_id id, wifi_interface_handle iface, + NanPublishRequest* msg); + +/**@brief nan_publish_cancel_request + * Cancel previous publish request + * + * @param transaction_id: + * @param wifi_interface_handle: + * @param NanPublishCancelRequest: + * @return Synchronous wifi_error + * @return Asynchronous NotifyResponse CB return + * NAN_STATUS_SUCCESS + * NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID + * NAN_STATUS_INTERNAL_FAILURE + */ +wifi_error nan_publish_cancel_request(transaction_id id, wifi_interface_handle iface, + NanPublishCancelRequest* msg); + +/**@brief nan_subscribe_request + * Subscribe request to search for a service + * + * @param transaction_id: + * @param wifi_interface_handle: + * @param NanSubscribeRequest: + * @return Synchronous wifi_error + * @return Asynchronous NotifyResponse CB return + * NAN_STATUS_SUCCESS + * NAN_STATUS_INVALID_PARAM + * NAN_STATUS_PROTOCOL_FAILURE + * NAN_STATUS_INTERNAL_FAILURE + * NAN_STATUS_NO_SPACE_AVAILABLE + * NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID + */ +wifi_error nan_subscribe_request(transaction_id id, wifi_interface_handle iface, + NanSubscribeRequest* msg); + +/**@brief nan_subscribe_cancel_request + * Cancel previous subscribe requests. + * + * @param transaction_id: + * @param wifi_interface_handle: + * @param NanSubscribeRequest: + * @return Synchronous wifi_error + * @return Asynchronous NotifyResponse CB return + * NAN_STATUS_SUCCESS + * NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID + * NAN_STATUS_INTERNAL_FAILURE + */ +wifi_error nan_subscribe_cancel_request(transaction_id id, wifi_interface_handle iface, + NanSubscribeCancelRequest* msg); + +/**@brief nan_transmit_followup_request + * NAN transmit follow up request + * + * @param transaction_id: + * @param wifi_interface_handle: + * @param NanTransmitFollowupRequest: + * @return Synchronous wifi_error + * @return Asynchronous NotifyResponse CB return + * NAN_STATUS_SUCCESS + * NAN_STATUS_INVALID_PARAM + * NAN_STATUS_INTERNAL_FAILURE + * NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID + * NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID + * NAN_STATUS_FOLLOWUP_QUEUE_FULL + * @return Asynchronous TransmitFollowupInd CB return + * NAN_STATUS_SUCCESS + * NAN_STATUS_PROTOCOL_FAILURE + * NAN_STATUS_NO_OTA_ACK + */ +wifi_error nan_transmit_followup_request(transaction_id id, wifi_interface_handle iface, + NanTransmitFollowupRequest* msg); + +/**@brief nan_stats_request + * Request NAN statistics from Discovery Engine. + * + * @param transaction_id: + * @param wifi_interface_handle: + * @param NanStatsRequest: + * @return Synchronous wifi_error + * @return Asynchronous NotifyResponse CB return + * NAN_STATUS_SUCCESS + * NAN_STATUS_INTERNAL_FAILURE + * NAN_STATUS_INVALID_PARAM + */ +wifi_error nan_stats_request(transaction_id id, wifi_interface_handle iface, NanStatsRequest* msg); + +/**@brief nan_config_request + * NAN configuration request. + * + * @param transaction_id: + * @param wifi_interface_handle: + * @param NanConfigRequest: + * @return Synchronous wifi_error + * @return Asynchronous NotifyResponse CB return + * NAN_STATUS_SUCCESS + * NAN_STATUS_INVALID_PARAM + * NAN_STATUS_PROTOCOL_FAILURE + * NAN_STATUS_INTERNAL_FAILURE + */ +wifi_error nan_config_request(transaction_id id, wifi_interface_handle iface, + NanConfigRequest* msg); + +/**@brief nan_tca_request + * Configure the various Threshold crossing alerts + * + * @param transaction_id: + * @param wifi_interface_handle: + * @param NanStatsRequest: + * @return Synchronous wifi_error + * @return Asynchronous NotifyResponse CB return + * NAN_STATUS_SUCCESS + * NAN_STATUS_INVALID_PARAM + * NAN_STATUS_INTERNAL_FAILURE + */ +wifi_error nan_tca_request(transaction_id id, wifi_interface_handle iface, NanTCARequest* msg); + +/**@brief nan_beacon_sdf_payload_request + * Set NAN Beacon or sdf payload to discovery engine. + * This instructs the Discovery Engine to begin publishing the + * received payload in any Beacon or Service Discovery Frame transmitted + * + * @param transaction_id: + * @param wifi_interface_handle: + * @param NanStatsRequest: + * @return Synchronous wifi_error + * @return Asynchronous NotifyResponse CB return + * NAN_STATUS_SUCCESS + * NAN_STATUS_INVALID_PARAM + * NAN_STATUS_INTERNAL_FAILURE + */ +wifi_error nan_beacon_sdf_payload_request(transaction_id id, wifi_interface_handle iface, + NanBeaconSdfPayloadRequest* msg); + +/* Register NAN callbacks. */ +wifi_error nan_register_handler(wifi_interface_handle iface, NanCallbackHandler handlers); + +/* Get NAN HAL version. */ +wifi_error nan_get_version(wifi_handle handle, NanVersion* version); + +/**@brief nan_get_capabilities + * Get NAN Capabilities + * + * @param transaction_id: + * @param wifi_interface_handle: + * @return Synchronous wifi_error + * @return Asynchronous NotifyResponse CB return + * NAN_STATUS_SUCCESS + */ +/* Get NAN capabilities. */ +wifi_error nan_get_capabilities(transaction_id id, wifi_interface_handle iface); + +/* ========== Nan Data Path APIs ================ */ +/**@brief nan_data_interface_create + * Create NAN Data Interface. + * + * @param transaction_id: + * @param wifi_interface_handle: + * @param iface_name: + * @return Synchronous wifi_error + * @return Asynchronous NotifyResponse CB return + * NAN_STATUS_SUCCESS + * NAN_STATUS_INVALID_PARAM + * NAN_STATUS_INTERNAL_FAILURE + */ +wifi_error nan_data_interface_create(transaction_id id, wifi_interface_handle iface, + char* iface_name); + +/**@brief nan_data_interface_delete + * Delete NAN Data Interface. + * + * @param transaction_id: + * @param wifi_interface_handle: + * @param iface_name: + * @return Synchronous wifi_error + * @return Asynchronous NotifyResponse CB return + * NAN_STATUS_SUCCESS + * NAN_STATUS_INVALID_PARAM + * NAN_STATUS_INTERNAL_FAILURE + */ +wifi_error nan_data_interface_delete(transaction_id id, wifi_interface_handle iface, + char* iface_name); + +/**@brief nan_data_request_initiator + * Initiate a NAN Data Path session. + * + * @param transaction_id: + * @param wifi_interface_handle: + * @param NanDataPathInitiatorRequest: + * @return Synchronous wifi_error + * @return Asynchronous NotifyResponse CB return + * NAN_STATUS_SUCCESS + * NAN_STATUS_INVALID_PARAM + * NAN_STATUS_INTERNAL_FAILURE + * NAN_STATUS_PROTOCOL_FAILURE + * NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID + */ +wifi_error nan_data_request_initiator(transaction_id id, wifi_interface_handle iface, + NanDataPathInitiatorRequest* msg); + +/**@brief nan_data_indication_response + * Response to a data indication received + * corresponding to a NDP session. An indication + * is received with a data request and the responder + * will send a data response + * + * @param transaction_id: + * @param wifi_interface_handle: + * @param NanDataPathIndicationResponse: + * @return Synchronous wifi_error + * @return Asynchronous NotifyResponse CB return + * NAN_STATUS_SUCCESS + * NAN_STATUS_INVALID_PARAM + * NAN_STATUS_INTERNAL_FAILURE + * NAN_STATUS_PROTOCOL_FAILURE + * NAN_STATUS_INVALID_NDP_ID + */ +wifi_error nan_data_indication_response(transaction_id id, wifi_interface_handle iface, + NanDataPathIndicationResponse* msg); + +/**@brief nan_data_end + * NDL termination request: from either Initiator/Responder + * + * @param transaction_id: + * @param wifi_interface_handle: + * @param NanDataPathEndRequest: + * @return Synchronous wifi_error + * @return Asynchronous NotifyResponse CB return + * NAN_STATUS_SUCCESS + * NAN_STATUS_INVALID_PARAM + * NAN_STATUS_INTERNAL_FAILURE + * NAN_STATUS_PROTOCOL_FAILURE + * NAN_STATUS_INVALID_NDP_ID + */ +wifi_error nan_data_end(transaction_id id, wifi_interface_handle iface, NanDataPathEndRequest* msg); +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __NAN_H__ */ diff --git a/wifi/1.6/default/hal_legacy/wifi_offload.h b/wifi/1.6/default/hal_legacy/wifi_offload.h new file mode 100644 index 0000000000..0c69e39f75 --- /dev/null +++ b/wifi/1.6/default/hal_legacy/wifi_offload.h @@ -0,0 +1,30 @@ +#include "wifi_hal.h" + +#ifndef __WIFI_HAL_OFFLOAD_H +#define __WIFI_HAL_OFFLOAD_H + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define ETHER_ADDR_LEN 6 // Ethernet frame address length +#define N_AVAIL_ID 3 // available mkeep_alive IDs from 1 to 3 +#define MKEEP_ALIVE_IP_PKT_MAX 256 // max size of IP packet for keep alive + +/** + * Send specified keep alive packet periodically. + */ +wifi_error wifi_start_sending_offloaded_packet(wifi_request_id id, wifi_interface_handle iface, + u16 ether_type, u8* ip_packet, u16 ip_packet_len, + u8* src_mac_addr, u8* dst_mac_addr, u32 period_msec); + +/** + * Stop sending keep alive packet. + */ +wifi_error wifi_stop_sending_offloaded_packet(wifi_request_id id, wifi_interface_handle iface); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /*__WIFI_HAL_OFFLOAD_H */ diff --git a/wifi/1.6/default/hal_legacy/wifi_twt.h b/wifi/1.6/default/hal_legacy/wifi_twt.h new file mode 100644 index 0000000000..994bb18262 --- /dev/null +++ b/wifi/1.6/default/hal_legacy/wifi_twt.h @@ -0,0 +1,156 @@ +/* + * Copyright (C) 2020 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. + */ + +#ifndef __WIFI_HAL_TWT_H__ +#define __WIFI_HAL_TWT_H__ + +#include "wifi_hal.h" + +typedef struct { + u8 requester_supported; // 0 for not supporting requester + u8 responder_supported; // 0 for not supporting responder + u8 broadcast_twt_supported; // 0 for not supporting broadcast TWT + u8 flexibile_twt_supported; // 0 for not supporting flexible TWT +} TwtCapability; + +typedef struct { + TwtCapability device_capability; + TwtCapability peer_capability; +} TwtCapabilitySet; + +// For all optional fields below, if no value specify -1 +typedef struct { + u8 config_id; // An unique ID for an individual TWT request + u8 negotiation_type; // 0 for individual TWT, 1 for broadcast TWT + u8 trigger_type; // 0 for non-triggered TWT, 1 for triggered TWT + s32 wake_dur_us; // Proposed wake duration in us + s32 wake_int_us; // Average wake interval in us + s32 wake_int_min_us; // Min wake interval in us. Optional. + s32 wake_int_max_us; // Max wake interval in us. Optional. + s32 wake_dur_min_us; // Min wake duration in us. Optional. + s32 wake_dur_max_us; // Max wake duration in us. Optional. + s32 avg_pkt_size; // Average bytes of each packet to send in each wake + // duration. Optional. + s32 avg_pkt_num; // Average number of packets to send in each wake + // duration. Optional. + s32 wake_time_off_us; // First wake duration time offset in us. Optional. +} TwtSetupRequest; + +typedef enum { + TWT_SETUP_SUCCESS = 0, // TWT setup is accepted. + TWT_SETUP_REJECT = 1, // TWT setup is rejected by AP. + TWT_SETUP_TIMEOUT = 2, // TWT setup response from AP times out. + TWT_SETUP_IE = 3, // AP sent TWT Setup IE parsing failure. + TWT_SETUP_PARAMS = 4, // AP sent TWT Setup IE Parameters invalid. + TWT_SETUP_ERROR = 255, // Generic error +} TwtSetupReasonCode; + +typedef struct { + u8 config_id; // An unique ID for an individual TWT request + u8 status; // 0 for success, non-zero for failure + TwtSetupReasonCode reason_code; + u8 negotiation_type; // 0 for individual TWT, 1 for broadcast TWT + u8 trigger_type; // 0 for non-triggered TWT, 1 for triggered TWT + s32 wake_dur_us; // Proposed wake duration in us + s32 wake_int_us; // Average wake interval in us + s32 wake_time_off_us; // First wake duration time offset in us. +} TwtSetupResponse; + +typedef struct { + u8 config_id; // An unique ID for an individual TWT request + u8 all_twt; // 0 for individual setp request, 1 for all TWT + u8 negotiation_type; // 0 for individual TWT, 1 for broadcast TWT +} TwtTeardownRequest; + +typedef enum { + TWT_TD_RC_HOST = 0, // Teardown triggered by Host + TWT_TD_RC_PEER = 1, // Peer initiated teardown + TWT_TD_RC_MCHAN = 2, // Teardown due to MCHAN Active + TWT_TD_RC_MCNX = 3, // Teardown due to MultiConnection + TWT_TD_RC_CSA = 4, // Teardown due to CSA + TWT_TD_RC_BTCX = 5, // Teardown due to BT Coex + TWT_TD_RC_SETUP_FAIL = 6, // Setup fails midway. Teardown all connections + TWT_TD_RC_SCHED = 7, // Teardown by TWT Scheduler + TWT_TD_RC_ERROR = 255, // Generic error cases +} TwtTeardownReason; + +typedef struct { + u8 config_id; // An unique ID for an individual TWT request + u8 all_twt; // 0 for individual setp request, 1 for all TWT + u8 status; // 0 for success, non-zero for failure + TwtTeardownReason reason; +} TwtTeardownCompletion; + +typedef struct { + u8 config_id; // An unique ID for an individual TWT request + u8 all_twt; // 0 for individual setup request, 1 for all TWT + s32 resume_time_us; // If -1, TWT is suspended for indefinite time. + // Otherwise, TWT is suspended for resume_time_us +} TwtInfoFrameRequest; + +typedef enum { + TWT_INFO_RC_HOST = 0, // Host initiated TWT Info frame */ + TWT_INFO_RC_PEER = 1, // Peer initiated TWT Info frame + TWT_INFO_RC_ERROR = 2, // Generic error conditions */ +} TwtInfoFrameReason; + +// TWT Info frame triggered externally. +// Device should not send TwtInfoFrameReceived to Host for internally +// triggered TWT Info frame during SCAN, MCHAN operations. +typedef struct { + u8 config_id; // An unique ID for an individual TWT request + u8 all_twt; // 0 for individual setup request, 1 for all TWT + u8 status; // 0 for success, non-zero for failure + TwtInfoFrameReason reason; + u8 twt_resumed; // 1 - TWT resumed, 0 - TWT suspended +} TwtInfoFrameReceived; + +typedef struct { + u8 config_id; + u32 avg_pkt_num_tx; // Average number of Tx packets in each wake duration. + u32 avg_pkt_num_rx; // Average number of Rx packets in each wake duration. + u32 avg_tx_pkt_size; // Average bytes per Rx packet in each wake duration. + u32 avg_rx_pkt_size; // Average bytes per Rx packet in each wake duration. + u32 avg_eosp_dur_us; // Average duration of early terminated SP + u32 eosp_count; // Count of early terminations + u32 num_sp; // Count of service period (SP), also known as wake duration. +} TwtStats; + +// Asynchronous notification from the device. +// For example, TWT was torn down by the device and later when the device is +// ready, it can send this async notification. +// This can be expandable in future. +typedef enum { + TWT_NOTIF_ALLOW_TWT = 1, // Device ready to process TWT Setup request +} TwtNotification; + +typedef struct { + TwtNotification notification; +} TwtDeviceNotify; + +// Callbacks for various TWT responses and events +typedef struct { + // Callback for TWT setup response + void (*EventTwtSetupResponse)(TwtSetupResponse* event); + // Callback for TWT teardown completion + void (*EventTwtTeardownCompletion)(TwtTeardownCompletion* event); + // Callback for TWT info frame received event + void (*EventTwtInfoFrameReceived)(TwtInfoFrameReceived* event); + // Callback for TWT notification from the device + void (*EventTwtDeviceNotify)(TwtDeviceNotify* event); +} TwtCallbackHandler; + +#endif /* __WIFI_HAL_TWT_H__ */ diff --git a/wifi/1.6/default/wifi_legacy_hal.h b/wifi/1.6/default/wifi_legacy_hal.h index 1fd784ad43..b6bd5ea6ba 100644 --- a/wifi/1.6/default/wifi_legacy_hal.h +++ b/wifi/1.6/default/wifi_legacy_hal.h @@ -23,7 +23,7 @@ #include #include -#include +#include #include namespace android { diff --git a/wifi/1.6/default/wifi_legacy_hal_stubs.h b/wifi/1.6/default/wifi_legacy_hal_stubs.h index c9a03bf4c9..ebc03479f1 100644 --- a/wifi/1.6/default/wifi_legacy_hal_stubs.h +++ b/wifi/1.6/default/wifi_legacy_hal_stubs.h @@ -17,7 +17,7 @@ #ifndef WIFI_LEGACY_HAL_STUBS_H_ #define WIFI_LEGACY_HAL_STUBS_H_ -#include +#include namespace android { namespace hardware { From edff13e3144bac986a5fde452afefeb07b6523a7 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Tue, 6 Dec 2022 02:07:44 +0000 Subject: [PATCH 465/998] Mark modules frozen explicitly. Makes it easier to see which versions are available. Bug: 188871598 Test: N/A Change-Id: Ica76a8225fec8dc5267362cbfd43e06e65ad3f1e --- audio/aidl/Android.bp | 1 + automotive/vehicle/aidl/Android.bp | 1 + biometrics/common/aidl/Android.bp | 1 + camera/common/aidl/Android.bp | 1 + camera/device/aidl/Android.bp | 1 + camera/metadata/aidl/Android.bp | 1 + radio/aidl/Android.bp | 2 ++ 7 files changed, 8 insertions(+) diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index 563ee626b5..695b8c2671 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -41,6 +41,7 @@ aidl_interface { "android/hardware/audio/common/SinkMetadata.aidl", "android/hardware/audio/common/SourceMetadata.aidl", ], + frozen: true, imports: [ "android.media.audio.common.types-V2", ], diff --git a/automotive/vehicle/aidl/Android.bp b/automotive/vehicle/aidl/Android.bp index 9aeb4d2c78..18a504698c 100644 --- a/automotive/vehicle/aidl/Android.bp +++ b/automotive/vehicle/aidl/Android.bp @@ -27,6 +27,7 @@ aidl_interface { srcs: [ "android/hardware/automotive/vehicle/**/*.aidl", ], + frozen: false, stability: "vintf", backend: { cpp: { diff --git a/biometrics/common/aidl/Android.bp b/biometrics/common/aidl/Android.bp index 3cd76fd262..88edf04932 100644 --- a/biometrics/common/aidl/Android.bp +++ b/biometrics/common/aidl/Android.bp @@ -13,6 +13,7 @@ aidl_interface { srcs: [ "android/hardware/biometrics/common/*.aidl", ], + frozen: false, stability: "vintf", backend: { java: { diff --git a/camera/common/aidl/Android.bp b/camera/common/aidl/Android.bp index d21ae581fb..fa7439229b 100644 --- a/camera/common/aidl/Android.bp +++ b/camera/common/aidl/Android.bp @@ -11,6 +11,7 @@ aidl_interface { name: "android.hardware.camera.common", vendor_available: true, srcs: ["android/hardware/camera/common/*.aidl"], + frozen: true, stability: "vintf", backend: { cpp: { diff --git a/camera/device/aidl/Android.bp b/camera/device/aidl/Android.bp index c184677408..00d9da026f 100644 --- a/camera/device/aidl/Android.bp +++ b/camera/device/aidl/Android.bp @@ -11,6 +11,7 @@ aidl_interface { name: "android.hardware.camera.device", vendor_available: true, srcs: ["android/hardware/camera/device/*.aidl"], + frozen: false, stability: "vintf", imports: [ "android.hardware.common-V2", diff --git a/camera/metadata/aidl/Android.bp b/camera/metadata/aidl/Android.bp index 301a9435cf..e7c0da6b4e 100644 --- a/camera/metadata/aidl/Android.bp +++ b/camera/metadata/aidl/Android.bp @@ -11,6 +11,7 @@ aidl_interface { name: "android.hardware.camera.metadata", vendor_available: true, srcs: ["android/hardware/camera/metadata/*.aidl"], + frozen: false, stability: "vintf", backend: { cpp: { diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp index 9dbe09aef3..930b6d4809 100644 --- a/radio/aidl/Android.bp +++ b/radio/aidl/Android.bp @@ -12,6 +12,7 @@ aidl_interface { vendor_available: true, host_supported: true, srcs: ["android/hardware/radio/*.aidl"], + frozen: false, stability: "vintf", backend: { cpp: { @@ -35,6 +36,7 @@ aidl_interface { vendor_available: true, host_supported: true, srcs: ["android/hardware/radio/config/*.aidl"], + frozen: false, stability: "vintf", imports: ["android.hardware.radio-V2"], backend: { From 571cd23ec3e29e675d44b716981e7146cb643de0 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 7 Dec 2022 15:00:49 -0800 Subject: [PATCH 466/998] Ignore "-a" dump option. This option will be used when generating bugreport. We don't want this to cause invalid option error. Test: adb shell dumpsys android.hardware.automotive.vehicle.IVehicle/default -a Bug: 261768324 Change-Id: I27347a6cd063623b01ada2803a06c2c86f936396 --- automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp index 62e9dc81f1..4a4e023074 100644 --- a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp +++ b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp @@ -789,10 +789,13 @@ binder_status_t DefaultVehicleHal::dump(int fd, const char** args, uint32_t numA for (uint32_t i = 0; i < numArgs; i++) { options.push_back(args[i]); } + if (options.size() == 1 && options[0] == "-a") { + // Ignore "-a" option. Bugreport will call with this option. + options.clear(); + } DumpResult result = mVehicleHardware->dump(options); dprintf(fd, "%s", (result.buffer + "\n").c_str()); if (!result.callerShouldDumpState) { - ALOGE("Skip dumping Vehicle HAL State."); return STATUS_OK; } dprintf(fd, "Vehicle HAL State: \n"); From 3782c69e1f5146eb3b94f44b2401949252059702 Mon Sep 17 00:00:00 2001 From: Sungtak Lee Date: Fri, 18 Nov 2022 07:19:00 +0000 Subject: [PATCH 467/998] bufferpool2: add sync() method and etc Add sync() method to IConnection interface. Add existing connection flag to return parcelable of IClientManager::registerSender(). Use plain integer for returning fetch result status. Bug: 254050250 Change-Id: Ifebd4b16e9b8c37e074e7126f39264a18fed5de8 --- .../hardware/media/bufferpool2/IClientManager.aidl | 7 ++++++- .../hardware/media/bufferpool2/IConnection.aidl | 3 ++- .../hardware/media/bufferpool2/ResultStatus.aidl | 1 - .../hardware/media/bufferpool2/IClientManager.aidl | 13 +++++++++++-- .../hardware/media/bufferpool2/IConnection.aidl | 10 +++++++++- .../hardware/media/bufferpool2/ResultStatus.aidl | 2 -- 6 files changed, 28 insertions(+), 8 deletions(-) diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IClientManager.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IClientManager.aidl index 54896d4fbf..5899a403a6 100644 --- a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IClientManager.aidl +++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IClientManager.aidl @@ -34,5 +34,10 @@ package android.hardware.media.bufferpool2; @VintfStability interface IClientManager { - long registerSender(in android.hardware.media.bufferpool2.IAccessor bufferPool); + android.hardware.media.bufferpool2.IClientManager.Registration registerSender(in android.hardware.media.bufferpool2.IAccessor bufferPool); + @VintfStability + parcelable Registration { + long connectionId; + boolean isNew = true; + } } diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IConnection.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IConnection.aidl index 300fcbae9b..844e920df0 100644 --- a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IConnection.aidl +++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IConnection.aidl @@ -35,12 +35,13 @@ package android.hardware.media.bufferpool2; @VintfStability interface IConnection { android.hardware.media.bufferpool2.IConnection.FetchResult[] fetch(in android.hardware.media.bufferpool2.IConnection.FetchInfo[] fetchInfos); + void sync(); parcelable FetchInfo { long transactionId; int bufferId; } union FetchResult { android.hardware.media.bufferpool2.Buffer buffer; - android.hardware.media.bufferpool2.ResultStatus failure; + int failure; } } diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/ResultStatus.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/ResultStatus.aidl index 73709985c4..4bc3889e3f 100644 --- a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/ResultStatus.aidl +++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/ResultStatus.aidl @@ -34,7 +34,6 @@ package android.hardware.media.bufferpool2; @VintfStability parcelable ResultStatus { - int resultStatus; const int OK = 0; const int NO_MEMORY = 1; const int ALREADY_EXISTS = 2; diff --git a/media/bufferpool/aidl/android/hardware/media/bufferpool2/IClientManager.aidl b/media/bufferpool/aidl/android/hardware/media/bufferpool2/IClientManager.aidl index bf36e25a55..a3054cb131 100644 --- a/media/bufferpool/aidl/android/hardware/media/bufferpool2/IClientManager.aidl +++ b/media/bufferpool/aidl/android/hardware/media/bufferpool2/IClientManager.aidl @@ -27,6 +27,16 @@ import android.hardware.media.bufferpool2.IAccessor; */ @VintfStability interface IClientManager { + /** + * Result of registerSender. + */ + @VintfStability + parcelable Registration { + /** registered connection id */ + long connectionId; + /** true when the connection is new */ + boolean isNew = true; + } /** * Sets up a buffer receiving communication node for the specified * buffer pool. A manager must create a IConnection to the buffer @@ -39,8 +49,7 @@ interface IClientManager { * sent to that connection during transfers. * @throws ServiceSpecificException with one of the following values: * ResultStatus::NO_MEMORY - Memory allocation failure occurred. - * ResultStatus::ALREADY_EXISTS - A sender was registered already. * ResultStatus::CRITICAL_ERROR - Other errors. */ - long registerSender(in IAccessor bufferPool); + Registration registerSender(in IAccessor bufferPool); } diff --git a/media/bufferpool/aidl/android/hardware/media/bufferpool2/IConnection.aidl b/media/bufferpool/aidl/android/hardware/media/bufferpool2/IConnection.aidl index d869f47a64..68367c758e 100644 --- a/media/bufferpool/aidl/android/hardware/media/bufferpool2/IConnection.aidl +++ b/media/bufferpool/aidl/android/hardware/media/bufferpool2/IConnection.aidl @@ -49,7 +49,7 @@ interface IConnection { * ResultStatus::NOT_FOUND - A buffer was not found due to invalidation. * ResultStatus::CRITICAL_ERROR - Other errors. */ - ResultStatus failure; + int failure; } /** @@ -70,4 +70,12 @@ interface IConnection { * ResultStatus::CRITICAL_ERROR - Other errors. */ FetchResult[] fetch(in FetchInfo[] fetchInfos); + + /** + * Enforce processing of unprocessed bufferpool messages. + * + * BufferPool implementation optimizes message processing by piggy-backing approach. + * This method can ensure pending bufferpool messages being processed timely. + */ + void sync(); } diff --git a/media/bufferpool/aidl/android/hardware/media/bufferpool2/ResultStatus.aidl b/media/bufferpool/aidl/android/hardware/media/bufferpool2/ResultStatus.aidl index 162f9a719a..003d1478c6 100644 --- a/media/bufferpool/aidl/android/hardware/media/bufferpool2/ResultStatus.aidl +++ b/media/bufferpool/aidl/android/hardware/media/bufferpool2/ResultStatus.aidl @@ -23,6 +23,4 @@ parcelable ResultStatus { const int ALREADY_EXISTS = 2; const int NOT_FOUND = 3; const int CRITICAL_ERROR = 4; - - int resultStatus; } From 7c671925f055b8fdbb09d7d40024ccdce0c9f34c Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 7 Dec 2022 11:44:06 -0800 Subject: [PATCH 468/998] Remove lock for fakeVehicleHardware callbacks. The callbacks are called very frequently, guarding them with the main mLock will cause the mLock to become very hot and possibly blocking other operations from owning the lock. Since the callback is only set once by DefaultVehicleHal during initialization, it is really not necessary to guard them with lock. Test: manual run on gcar_emu Bug: 255574557 Change-Id: Icc1f90b89578a27729ef8beae3a475966f72d318 --- .../fake_impl/hardware/include/FakeVehicleHardware.h | 7 +++++-- .../fake_impl/hardware/src/FakeVehicleHardware.cpp | 12 ++++++++---- .../aidl/impl/hardware/include/IVehicleHardware.h | 3 ++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h index 1636cb6cd0..e515badf60 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h @@ -138,9 +138,12 @@ class FakeVehicleHardware : public IVehicleHardware { std::unique_ptr mRecurrentTimer; // GeneratorHub is thread-safe. std::unique_ptr mGeneratorHub; + + // Only allowed to set once. + std::unique_ptr mOnPropertyChangeCallback; + std::unique_ptr mOnPropertySetErrorCallback; + std::mutex mLock; - std::unique_ptr mOnPropertyChangeCallback GUARDED_BY(mLock); - std::unique_ptr mOnPropertySetErrorCallback GUARDED_BY(mLock); std::unordered_map, PropIdAreaIdHash> mRecurrentActions GUARDED_BY(mLock); std::unordered_map diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index 736ecaaf88..dd76524ef5 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -1228,13 +1228,19 @@ StatusCode FakeVehicleHardware::checkHealth() { void FakeVehicleHardware::registerOnPropertyChangeEvent( std::unique_ptr callback) { - std::scoped_lock lockGuard(mLock); + if (mOnPropertyChangeCallback != nullptr) { + ALOGE("registerOnPropertyChangeEvent must only be called once"); + return; + } mOnPropertyChangeCallback = std::move(callback); } void FakeVehicleHardware::registerOnPropertySetErrorEvent( std::unique_ptr callback) { - std::scoped_lock lockGuard(mLock); + if (mOnPropertySetErrorCallback != nullptr) { + ALOGE("registerOnPropertySetErrorEvent must only be called once"); + return; + } mOnPropertySetErrorCallback = std::move(callback); } @@ -1278,8 +1284,6 @@ StatusCode FakeVehicleHardware::updateSampleRate(int32_t propId, int32_t areaId, } void FakeVehicleHardware::onValueChangeCallback(const VehiclePropValue& value) { - std::scoped_lock lockGuard(mLock); - if (mOnPropertyChangeCallback == nullptr) { return; } diff --git a/automotive/vehicle/aidl/impl/hardware/include/IVehicleHardware.h b/automotive/vehicle/aidl/impl/hardware/include/IVehicleHardware.h index 759db4153d..d92ccfddab 100644 --- a/automotive/vehicle/aidl/impl/hardware/include/IVehicleHardware.h +++ b/automotive/vehicle/aidl/impl/hardware/include/IVehicleHardware.h @@ -116,11 +116,12 @@ class IVehicleHardware { virtual aidl::android::hardware::automotive::vehicle::StatusCode checkHealth() = 0; // Register a callback that would be called when there is a property change event from vehicle. + // Must only be called once during initialization. virtual void registerOnPropertyChangeEvent( std::unique_ptr callback) = 0; // Register a callback that would be called when there is a property set error event from - // vehicle. + // vehicle. Must only be called once during initialization. virtual void registerOnPropertySetErrorEvent( std::unique_ptr callback) = 0; }; From ca3eef29b0bb511649440188e9b500432e34435c Mon Sep 17 00:00:00 2001 From: Brian Lindahl Date: Fri, 9 Dec 2022 00:32:11 -0700 Subject: [PATCH 469/998] Add VTS test for clearing buffer slots to Composer HIDL and AIDL This feature allows SurfaceFlinger to clear buffer slots when buffers are discarded by SurfaceFlinger clients and will no longer be used, allowing the graphics memory to be freed immediately. Bug: 258196272 Test: atest VtsHalGraphicsComposerV2_4TargetTest Test: atest VtsHalGraphicsComposer3_TargetTest Change-Id: Ibfbe2078ac419bb8f3880ee3f0512acaad2f5012 --- .../VtsHalGraphicsComposerV2_1TargetTest.cpp | 58 ++++++++++++++++++- .../graphics/composer3/ComposerClientWriter.h | 15 +++-- .../VtsHalGraphicsComposer3_TargetTest.cpp | 45 +++++++++++--- 3 files changed, 105 insertions(+), 13 deletions(-) diff --git a/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp b/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp index 48226785d5..b66ee1909e 100644 --- a/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp +++ b/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp @@ -657,6 +657,7 @@ class GraphicsComposerHidlCommandTest : public GraphicsComposerHidlTest { IComposerClient::Attribute::WIDTH); mDisplayHeight = mComposerClient->getDisplayAttribute(mPrimaryDisplay, activeConfig, IComposerClient::Attribute::HEIGHT); + mWriter = std::make_unique(1024); mReader = std::make_unique(); } @@ -666,11 +667,13 @@ class GraphicsComposerHidlCommandTest : public GraphicsComposerHidlTest { ASSERT_NO_FATAL_FAILURE(GraphicsComposerHidlTest::TearDown()); } - NativeHandleWrapper allocate() { + NativeHandleWrapper allocate() { return allocate(mDisplayWidth, mDisplayHeight); } + + NativeHandleWrapper allocate(uint32_t width, uint32_t height) { uint64_t usage = static_cast(BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN | BufferUsage::COMPOSER_OVERLAY); - return mGralloc->allocate(mDisplayWidth, mDisplayHeight, 1, PixelFormat::RGBA_8888, usage); + return mGralloc->allocate(width, height, 1, PixelFormat::RGBA_8888, usage); } void execute() { mComposerClient->execute(mReader.get(), mWriter.get()); } @@ -883,6 +886,57 @@ TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_BUFFER) { execute(); } +/** + * Test IComposerClient::Command::SET_LAYER_BUFFER with the behavior used for clearing buffer slots. + */ +TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_BUFFER_TO_CLEAR_BUFFER_SLOTS) { + // A buffer used to clear buffer slots + auto clearSlotBuffer = allocate(1u, 1u); + + auto handle1 = allocate(); + ASSERT_NE(nullptr, handle1.get()); + IComposerClient::Rect displayFrame{0, 0, mDisplayWidth, mDisplayHeight}; + Layer layer; + ASSERT_NO_FATAL_FAILURE( + layer = mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount)); + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->selectLayer(layer); + mWriter->setLayerCompositionType(IComposerClient::Composition::DEVICE); + mWriter->setLayerDisplayFrame(displayFrame); + mWriter->setLayerBuffer(0, handle1.get(), -1); + mWriter->setLayerDataspace(Dataspace::UNKNOWN); + mWriter->validateDisplay(); + execute(); + if (mReader->mCompositionChanges.size() != 0) { + GTEST_SUCCEED() << "Composition change requested, skipping test"; + return; + } + ASSERT_EQ(0, mReader->mErrors.size()); + + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->presentDisplay(); + execute(); + ASSERT_EQ(0, mReader->mErrors.size()); + + // Ensure we can clear a buffer slot and then set that same slot with a new buffer + auto handle2 = allocate(); + ASSERT_NE(nullptr, handle2.get()); + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->selectLayer(layer); + mWriter->setLayerBuffer(0, clearSlotBuffer.get(), -1); + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->selectLayer(layer); + mWriter->setLayerBuffer(0, handle2.get(), -1); + mWriter->validateDisplay(); + execute(); + ASSERT_EQ(0, mReader->mErrors.size()); + + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->presentDisplay(); + execute(); + ASSERT_EQ(0, mReader->mErrors.size()); +} + /** * Test IComposerClient::Command::SET_LAYER_SURFACE_DAMAGE. */ diff --git a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h index 0c8742f887..e35d07bce9 100644 --- a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h +++ b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h @@ -91,7 +91,7 @@ class ComposerClientWriter final { void setClientTarget(int64_t display, uint32_t slot, const native_handle_t* target, int acquireFence, Dataspace dataspace, const std::vector& damage) { ClientTarget clientTargetCommand; - clientTargetCommand.buffer = getBuffer(slot, target, acquireFence); + clientTargetCommand.buffer = getBufferCommand(slot, target, acquireFence); clientTargetCommand.dataspace = dataspace; clientTargetCommand.damage.assign(damage.begin(), damage.end()); getDisplayCommand(display).clientTarget.emplace(std::move(clientTargetCommand)); @@ -100,7 +100,7 @@ class ComposerClientWriter final { void setOutputBuffer(int64_t display, uint32_t slot, const native_handle_t* buffer, int releaseFence) { getDisplayCommand(display).virtualDisplayOutputBuffer.emplace( - getBuffer(slot, buffer, releaseFence)); + getBufferCommand(slot, buffer, releaseFence)); } void validateDisplay(int64_t display, @@ -132,7 +132,14 @@ class ComposerClientWriter final { void setLayerBuffer(int64_t display, int64_t layer, uint32_t slot, const native_handle_t* buffer, int acquireFence) { - getLayerCommand(display, layer).buffer = getBuffer(slot, buffer, acquireFence); + getLayerCommand(display, layer).buffer = getBufferCommand(slot, buffer, acquireFence); + } + + void setLayerBufferWithNewCommand(int64_t display, int64_t layer, uint32_t slot, + const native_handle_t* buffer, int acquireFence) { + flushLayerCommand(); + getLayerCommand(display, layer).buffer = getBufferCommand(slot, buffer, acquireFence); + flushLayerCommand(); } void setLayerSurfaceDamage(int64_t display, int64_t layer, const std::vector& damage) { @@ -234,7 +241,7 @@ class ComposerClientWriter final { std::vector mCommands; const int64_t mDisplay; - Buffer getBuffer(uint32_t slot, const native_handle_t* bufferHandle, int fence) { + Buffer getBufferCommand(uint32_t slot, const native_handle_t* bufferHandle, int fence) { Buffer bufferCommand; bufferCommand.slot = static_cast(slot); if (bufferHandle) bufferCommand.handle.emplace(::android::dupToAidl(bufferHandle)); diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index fa66812d6e..30ee1ebc70 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -1132,17 +1132,21 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { } } - sp allocate(::android::PixelFormat pixelFormat) { + sp allocate(uint32_t width, uint32_t height, + ::android::PixelFormat pixelFormat) { return sp::make( - static_cast(getPrimaryDisplay().getDisplayWidth()), - static_cast(getPrimaryDisplay().getDisplayHeight()), pixelFormat, - /*layerCount*/ 1U, - (static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | - static_cast(common::BufferUsage::CPU_READ_OFTEN) | - static_cast(common::BufferUsage::COMPOSER_OVERLAY)), + width, height, pixelFormat, /*layerCount*/ 1U, + static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | + static_cast(common::BufferUsage::CPU_READ_OFTEN) | + static_cast(common::BufferUsage::COMPOSER_OVERLAY), "VtsHalGraphicsComposer3_TargetTest"); } + sp allocate(::android::PixelFormat pixelFormat) { + return allocate(static_cast(getPrimaryDisplay().getDisplayWidth()), + static_cast(getPrimaryDisplay().getDisplayHeight()), pixelFormat); + } + void sendRefreshFrame(const VtsDisplay& display, const VsyncPeriodChangeTimeline* timeline) { if (timeline != nullptr) { // Refresh time should be before newVsyncAppliedTimeNanos @@ -1643,6 +1647,33 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerBuffer) { execute(); } +TEST_P(GraphicsComposerAidlCommandTest, SetLayerBufferWithSlotsToClear) { + auto clearSlotBuffer = allocate(1u, 1u, ::android::PIXEL_FORMAT_RGB_888); + ASSERT_NE(nullptr, clearSlotBuffer); + auto clearSlotBufferHandle = clearSlotBuffer->handle; + + const auto buffer1 = allocate(::android::PIXEL_FORMAT_RGBA_8888); + ASSERT_NE(nullptr, buffer1); + const auto handle1 = buffer1->handle; + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle1, /*acquireFence*/ -1); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + // Ensure we can clear a buffer slot and then set that same slot with a new buffer + const auto buffer2 = allocate(::android::PIXEL_FORMAT_RGBA_8888); + ASSERT_NE(nullptr, buffer2); + const auto handle2 = buffer2->handle; + writer.setLayerBufferWithNewCommand(getPrimaryDisplayId(), layer, /* slot */ 0, + clearSlotBufferHandle, /*acquireFence*/ -1); + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle2, /*acquireFence*/ -1); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); +} + TEST_P(GraphicsComposerAidlCommandTest, SetLayerSurfaceDamage) { const auto& [layerStatus, layer] = mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); From 93a821077effec224d3880875d98c13ef1787e4c Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Thu, 8 Dec 2022 11:39:26 -0800 Subject: [PATCH 470/998] Avoid holding lock while calling recurrent actions. This CL fixes a dead lock issue caused by RecurrentTimer holding internal locks while calling actions. The dead lock is caused by the following situation: 1. Caller holds a lock, call RecurrentTimer.registerCallback which waits for RecurrentTimer's lock. 2. Another recurrent action happens at the same time. Recurrent timer holds lock before calling the client action. The client action is now waiting for the lock that is currently hold by 1. Test: atest RecurrentTimerTest Bug: 255574557 Change-Id: I3999f4e9cdf581cb851d5f49341dbcc0c160f234 --- .../utils/common/include/RecurrentTimer.h | 5 +- .../impl/utils/common/src/RecurrentTimer.cpp | 67 ++++++++++--------- .../utils/common/test/RecurrentTimerTest.cpp | 27 ++++++++ 3 files changed, 65 insertions(+), 34 deletions(-) diff --git a/automotive/vehicle/aidl/impl/utils/common/include/RecurrentTimer.h b/automotive/vehicle/aidl/impl/utils/common/include/RecurrentTimer.h index 5f0f7161c2..cd2b72713c 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/RecurrentTimer.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/RecurrentTimer.h @@ -83,8 +83,9 @@ class RecurrentTimer final { // each time we might introduce outdated elements to the top. We must make sure the heap is // always valid from the top. void removeInvalidCallbackLocked() REQUIRES(mLock); - // Pops the next closest callback (must be valid) from the heap. - std::unique_ptr popNextCallbackLocked() REQUIRES(mLock); + // Gets the next calblack to run (must be valid) from the heap, update its nextTime and put + // it back to the heap. + std::shared_ptr getNextCallbackLocked(int64_t now) REQUIRES(mLock); }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp b/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp index 43f5d69467..c6d3687553 100644 --- a/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp +++ b/automotive/vehicle/aidl/impl/utils/common/src/RecurrentTimer.cpp @@ -103,68 +103,71 @@ void RecurrentTimer::removeInvalidCallbackLocked() { } } -std::unique_ptr RecurrentTimer::popNextCallbackLocked() { +std::shared_ptr RecurrentTimer::getNextCallbackLocked(int64_t now) { std::pop_heap(mCallbackQueue.begin(), mCallbackQueue.end(), CallbackInfo::cmp); - std::unique_ptr info = std::move(mCallbackQueue[mCallbackQueue.size() - 1]); - mCallbackQueue.pop_back(); + auto& callbackInfo = mCallbackQueue[mCallbackQueue.size() - 1]; + auto nextCallback = callbackInfo->callback; + // intervalCount is the number of interval we have to advance until we pass now. + size_t intervalCount = (now - callbackInfo->nextTime) / callbackInfo->interval + 1; + callbackInfo->nextTime += intervalCount * callbackInfo->interval; + std::push_heap(mCallbackQueue.begin(), mCallbackQueue.end(), CallbackInfo::cmp); + // Make sure the first element is always valid. removeInvalidCallbackLocked(); - return info; + + return nextCallback; } void RecurrentTimer::loop() { - std::unique_lock uniqueLock(mLock); - + std::vector> callbacksToRun; while (true) { - // Wait until the timer exits or we have at least one recurrent callback. - mCond.wait(uniqueLock, [this] { - ScopedLockAssertion lockAssertion(mLock); - return mStopRequested || mCallbackQueue.size() != 0; - }); - - int64_t interval; { + std::unique_lock uniqueLock(mLock); ScopedLockAssertion lockAssertion(mLock); + // Wait until the timer exits or we have at least one recurrent callback. + mCond.wait(uniqueLock, [this] { + ScopedLockAssertion lockAssertion(mLock); + return mStopRequested || mCallbackQueue.size() != 0; + }); + + int64_t interval; if (mStopRequested) { return; } // The first element is the nearest next event. int64_t nextTime = mCallbackQueue[0]->nextTime; int64_t now = uptimeNanos(); + if (nextTime > now) { interval = nextTime - now; } else { interval = 0; } - } - // Wait for the next event or the timer exits. - if (mCond.wait_for(uniqueLock, std::chrono::nanoseconds(interval), [this] { - ScopedLockAssertion lockAssertion(mLock); - return mStopRequested; - })) { - return; - } + // Wait for the next event or the timer exits. + if (mCond.wait_for(uniqueLock, std::chrono::nanoseconds(interval), [this] { + ScopedLockAssertion lockAssertion(mLock); + return mStopRequested; + })) { + return; + } - { - ScopedLockAssertion lockAssertion(mLock); - int64_t now = uptimeNanos(); + now = uptimeNanos(); + callbacksToRun.clear(); while (mCallbackQueue.size() > 0) { int64_t nextTime = mCallbackQueue[0]->nextTime; if (nextTime > now) { break; } - std::unique_ptr info = popNextCallbackLocked(); - info->nextTime += info->interval; - - auto callback = info->callback; - mCallbackQueue.push_back(std::move(info)); - std::push_heap(mCallbackQueue.begin(), mCallbackQueue.end(), CallbackInfo::cmp); - - (*callback)(); + callbacksToRun.push_back(getNextCallbackLocked(now)); } } + + // Do not execute the callback while holding the lock. + for (size_t i = 0; i < callbacksToRun.size(); i++) { + (*callbacksToRun[i])(); + } } } diff --git a/automotive/vehicle/aidl/impl/utils/common/test/RecurrentTimerTest.cpp b/automotive/vehicle/aidl/impl/utils/common/test/RecurrentTimerTest.cpp index a033a248cd..141efc135b 100644 --- a/automotive/vehicle/aidl/impl/utils/common/test/RecurrentTimerTest.cpp +++ b/automotive/vehicle/aidl/impl/utils/common/test/RecurrentTimerTest.cpp @@ -186,6 +186,33 @@ TEST_F(RecurrentTimerTest, testRegisterSameCallbackMultipleTimes) { ASSERT_EQ(countTimerCallbackQueue(&timer), static_cast(0)); } +TEST_F(RecurrentTimerTest, testRegisterCallbackMultipleTimesNoDeadLock) { + // We want to avoid the following situation: + // Caller holds a lock while calling registerTimerCallback, registerTimerCallback will try + // to obtain an internal lock inside timer. + // Meanwhile an recurrent action happens with timer holding an internal lock. The action + // tries to obtain the lock currently hold by the caller. + // The solution is that while calling recurrent actions, timer must not hold the internal lock. + + std::unique_ptr timer = std::make_unique(); + std::mutex lock; + for (size_t i = 0; i < 1000; i++) { + std::scoped_lock lockGuard(lock); + auto action = std::make_shared([&lock] { + // While calling this function, the timer must not hold lock in order not to dead + // lock. + std::scoped_lock lockGuard(lock); + }); + // 10ms + int64_t interval = 10'000'000; + timer->registerTimerCallback(interval, action); + // Sleep for a little while to let the recurrent actions begin. + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + } + // Make sure we stop the timer before we destroy lock. + timer.reset(); +} + } // namespace vehicle } // namespace automotive } // namespace hardware From 6dfb7929773e278afd6cdc63af52332d8419467d Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Fri, 9 Dec 2022 21:21:35 +0000 Subject: [PATCH 471/998] Remove entry for the HIDL Wifi Vendor HAL from compatibility_matrix.current Bug: 205044134 Test: m Change-Id: I4c22fd4eb48bed3a8789c6fbc62b455e45c9b032 --- compatibility_matrices/compatibility_matrix.current.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 61438b4687..e7248795f3 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -724,14 +724,6 @@ default - - android.hardware.wifi - 1.3-6 - - IWifi - default - - android.hardware.uwb 1 From d103cd682822807d956cfb65454085fa5817a5ba Mon Sep 17 00:00:00 2001 From: Brian Lindahl Date: Fri, 9 Dec 2022 07:26:28 -0700 Subject: [PATCH 472/998] Add VTS readback tests for buffer slot clearing Bug: 258196272 Test: atest VtsHalGraphicsComposer3_ReadbackTest Test: atest VtsHalGraphicsComposerV2_2TargetTest Change-Id: I95d24f9cf10d95e54bc228c02bedab9a8281cfd1 --- .../composer/2.2/utils/vts/ComposerVts.cpp | 24 +- .../composer/2.2/utils/vts/ReadbackVts.cpp | 165 ++++--- .../2.2/utils/vts/RenderEngineVts.cpp | 4 +- .../include/composer-vts/2.2/ComposerVts.h | 6 +- .../include/composer-vts/2.2/ReadbackVts.h | 42 +- ...VtsHalGraphicsComposerV2_2ReadbackTest.cpp | 425 ++++++++++-------- .../VtsHalGraphicsComposerV2_2TargetTest.cpp | 33 +- graphics/composer/aidl/vts/ReadbackVts.cpp | 223 +++++---- graphics/composer/aidl/vts/ReadbackVts.h | 47 +- .../composer/aidl/vts/RenderEngineVts.cpp | 13 +- .../VtsHalGraphicsComposer3_ReadbackTest.cpp | 239 +++++++--- 11 files changed, 777 insertions(+), 444 deletions(-) diff --git a/graphics/composer/2.2/utils/vts/ComposerVts.cpp b/graphics/composer/2.2/utils/vts/ComposerVts.cpp index b706596df4..a6dfcaf54b 100644 --- a/graphics/composer/2.2/utils/vts/ComposerVts.cpp +++ b/graphics/composer/2.2/utils/vts/ComposerVts.cpp @@ -126,15 +126,23 @@ void ComposerClient::setReadbackBuffer(Display display, const native_handle_t* b ASSERT_EQ(Error::NONE, error) << "failed to setReadbackBuffer"; } -void ComposerClient::getReadbackBufferAttributes(Display display, PixelFormat* outPixelFormat, - Dataspace* outDataspace) { +void ComposerClient::getRequiredReadbackBufferAttributes(Display display, + PixelFormat* outPixelFormat, + Dataspace* outDataspace) { + ASSERT_EQ(Error::NONE, getReadbackBufferAttributes(display, outPixelFormat, outDataspace)); +} + +Error ComposerClient::getReadbackBufferAttributes(Display display, PixelFormat* outPixelFormat, + Dataspace* outDataspace) { + Error error; mClient->getReadbackBufferAttributes( - display, - [&](const auto& tmpError, const auto& tmpOutPixelFormat, const auto& tmpOutDataspace) { - ASSERT_EQ(Error::NONE, tmpError) << "failed to get readback buffer attributes"; - *outPixelFormat = tmpOutPixelFormat; - *outDataspace = tmpOutDataspace; - }); + display, [&](const Error& tmpError, const PixelFormat& tmpPixelFormat, + const Dataspace& tmpDataspace) { + error = tmpError; + *outPixelFormat = tmpPixelFormat; + *outDataspace = tmpDataspace; + }); + return error; } void ComposerClient::getReadbackBufferFence(Display display, int32_t* outFence) { diff --git a/graphics/composer/2.2/utils/vts/ReadbackVts.cpp b/graphics/composer/2.2/utils/vts/ReadbackVts.cpp index a1794afeed..5dd68df3a1 100644 --- a/graphics/composer/2.2/utils/vts/ReadbackVts.cpp +++ b/graphics/composer/2.2/utils/vts/ReadbackVts.cpp @@ -19,6 +19,8 @@ #include "renderengine/ExternalTexture.h" #include "renderengine/impl/ExternalTexture.h" +using ::android::status_t; + namespace android { namespace hardware { namespace graphics { @@ -107,6 +109,40 @@ int32_t ReadbackHelper::GetBytesPerPixel(PixelFormat pixelFormat) { } } +void ReadbackHelper::fillBufferAndGetFence(const sp& graphicBuffer, + IComposerClient::Color desiredColor, int* fillFence) { + ASSERT_NE(nullptr, fillFence); + std::vector desiredColors( + static_cast(graphicBuffer->getWidth() * graphicBuffer->getHeight())); + ::android::Rect bounds = graphicBuffer->getBounds(); + fillColorsArea(desiredColors, static_cast(graphicBuffer->getWidth()), + {bounds.left, bounds.top, bounds.right, bounds.bottom}, desiredColor); + ASSERT_NO_FATAL_FAILURE(fillBufferAndGetFence(graphicBuffer, desiredColors, fillFence)); +} + +void ReadbackHelper::fillBufferAndGetFence(const sp& graphicBuffer, + const std::vector& desiredColors, + int* fillFence) { + ASSERT_TRUE(graphicBuffer->getPixelFormat() == ::android::PIXEL_FORMAT_RGB_888 || + graphicBuffer->getPixelFormat() == ::android::PIXEL_FORMAT_RGBA_8888); + void* bufData; + int32_t bytesPerPixel = -1; + int32_t bytesPerStride = -1; + status_t status = + graphicBuffer->lock(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN, + &bufData, &bytesPerPixel, &bytesPerStride); + ASSERT_EQ(::android::OK, status); + + const uint32_t stride = (bytesPerPixel > 0 && bytesPerStride > 0) + ? static_cast(bytesPerStride / bytesPerPixel) + : graphicBuffer->getStride(); + ReadbackHelper::fillBuffer(graphicBuffer->getWidth(), graphicBuffer->getHeight(), stride, + bufData, static_cast(graphicBuffer->getPixelFormat()), + desiredColors); + status = graphicBuffer->unlockAsync(fillFence); + ASSERT_EQ(::android::OK, status); +} + void ReadbackHelper::fillBuffer(int32_t width, int32_t height, uint32_t stride, void* bufferData, PixelFormat pixelFormat, std::vector desiredPixelColors) { @@ -116,16 +152,16 @@ void ReadbackHelper::fillBuffer(int32_t width, int32_t height, uint32_t stride, for (int row = 0; row < height; row++) { for (int col = 0; col < width; col++) { int pixel = row * width + col; - IComposerClient::Color srcColor = desiredPixelColors[pixel]; + IComposerClient::Color desiredColor = desiredPixelColors[pixel]; int offset = (row * stride + col) * bytesPerPixel; uint8_t* pixelColor = (uint8_t*)bufferData + offset; - pixelColor[0] = srcColor.r; - pixelColor[1] = srcColor.g; - pixelColor[2] = srcColor.b; + pixelColor[0] = desiredColor.r; + pixelColor[1] = desiredColor.g; + pixelColor[2] = desiredColor.b; if (bytesPerPixel == 4) { - pixelColor[3] = srcColor.a; + pixelColor[3] = desiredColor.a; } } } @@ -152,12 +188,14 @@ void ReadbackHelper::fillColorsArea(std::vector& expecte } } -bool ReadbackHelper::readbackSupported(const PixelFormat& pixelFormat, const Dataspace& dataspace, - const Error error) { +bool ReadbackHelper::readbackSupported(PixelFormat pixelFormat, Dataspace dataspace, Error error) { if (error != Error::NONE) { return false; } - // TODO: add support for RGBA_1010102 + return readbackSupported(pixelFormat, dataspace); +} + +bool ReadbackHelper::readbackSupported(PixelFormat pixelFormat, Dataspace dataspace) { if (pixelFormat != PixelFormat::RGB_888 && pixelFormat != PixelFormat::RGBA_8888) { return false; } @@ -167,71 +205,94 @@ bool ReadbackHelper::readbackSupported(const PixelFormat& pixelFormat, const Dat return true; } -void ReadbackHelper::compareColorBuffers(std::vector& expectedColors, - void* bufferData, const uint32_t stride, - const uint32_t width, const uint32_t height, - const PixelFormat pixelFormat) { - const int32_t bytesPerPixel = ReadbackHelper::GetBytesPerPixel(pixelFormat); - ASSERT_NE(-1, bytesPerPixel); - for (int row = 0; row < height; row++) { - for (int col = 0; col < width; col++) { - int pixel = row * width + col; - int offset = (row * stride + col) * bytesPerPixel; - uint8_t* pixelColor = (uint8_t*)bufferData + offset; +void ReadbackHelper::createReadbackBuffer(uint32_t width, uint32_t height, PixelFormat pixelFormat, + Dataspace dataspace, sp* graphicBuffer) { + ASSERT_NE(nullptr, graphicBuffer); + if (!readbackSupported(pixelFormat, dataspace)) { + *graphicBuffer = nullptr; + } + android::PixelFormat bufferFormat = static_cast(pixelFormat); + uint32_t layerCount = 1; + uint64_t usage = static_cast(static_cast(BufferUsage::CPU_READ_OFTEN) | + static_cast(BufferUsage::GPU_TEXTURE)); + *graphicBuffer = sp::make(width, height, bufferFormat, layerCount, usage, + "ReadbackBuffer"); + ASSERT_NE(nullptr, *graphicBuffer); + ASSERT_EQ(::android::OK, (*graphicBuffer)->initCheck()); +} - ASSERT_EQ(expectedColors[pixel].r, pixelColor[0]); - ASSERT_EQ(expectedColors[pixel].g, pixelColor[1]); - ASSERT_EQ(expectedColors[pixel].b, pixelColor[2]); +void ReadbackHelper::compareColorToBuffer(IComposerClient::Color expectedColor, + const sp& graphicBuffer, int32_t fence) { + std::vector expectedColors( + static_cast(graphicBuffer->getWidth() * graphicBuffer->getHeight())); + ::android::Rect bounds = graphicBuffer->getBounds(); + fillColorsArea(expectedColors, static_cast(graphicBuffer->getWidth()), + {bounds.left, bounds.top, bounds.right, bounds.bottom}, expectedColor); + compareColorsToBuffer(expectedColors, graphicBuffer, fence); +} + +void ReadbackHelper::compareColorsToBuffer(std::vector& expectedColors, + const sp& graphicBuffer, int32_t fence) { + ASSERT_TRUE(graphicBuffer->getPixelFormat() == ::android::PIXEL_FORMAT_RGB_888 || + graphicBuffer->getPixelFormat() == ::android::PIXEL_FORMAT_RGBA_8888); + + int bytesPerPixel = -1; + int bytesPerStride = -1; + void* bufData = nullptr; + status_t status = graphicBuffer->lockAsync(GRALLOC_USAGE_SW_READ_OFTEN, &bufData, fence, + &bytesPerPixel, &bytesPerStride); + ASSERT_EQ(::android::OK, status); + + const uint32_t stride = (bytesPerPixel > 0 && bytesPerStride > 0) + ? static_cast(bytesPerStride / bytesPerPixel) + : graphicBuffer->getStride(); + + if (bytesPerPixel == -1) { + PixelFormat pixelFormat = static_cast(graphicBuffer->getPixelFormat()); + bytesPerPixel = ReadbackHelper::GetBytesPerPixel(pixelFormat); + } + ASSERT_NE(-1, bytesPerPixel); + for (int row = 0; row < graphicBuffer->getHeight(); row++) { + for (int col = 0; col < graphicBuffer->getWidth(); col++) { + int pixel = row * static_cast(graphicBuffer->getWidth()) + col; + int offset = (row * static_cast(stride) + col) * bytesPerPixel; + uint8_t* pixelColor = (uint8_t*)bufData + offset; + const IComposerClient::Color expectedColor = expectedColors[static_cast(pixel)]; + ASSERT_EQ(std::round(255.0f * expectedColor.r), pixelColor[0]); + ASSERT_EQ(std::round(255.0f * expectedColor.g), pixelColor[1]); + ASSERT_EQ(std::round(255.0f * expectedColor.b), pixelColor[2]); } } + + status = graphicBuffer->unlock(); + ASSERT_EQ(::android::OK, status); } ReadbackBuffer::ReadbackBuffer(Display display, const std::shared_ptr& client, - const std::shared_ptr& gralloc, uint32_t width, - uint32_t height, PixelFormat pixelFormat, Dataspace dataspace) { + uint32_t width, uint32_t height, PixelFormat pixelFormat) { mDisplay = display; - mComposerClient = client; - mGralloc = gralloc; - - mPixelFormat = pixelFormat; - mDataspace = dataspace; - mWidth = width; mHeight = height; + mPixelFormat = pixelFormat; mLayerCount = 1; - mFormat = mPixelFormat; mUsage = static_cast(BufferUsage::CPU_READ_OFTEN | BufferUsage::GPU_TEXTURE); - - mAccessRegion.top = 0; - mAccessRegion.left = 0; - mAccessRegion.width = width; - mAccessRegion.height = height; } void ReadbackBuffer::setReadbackBuffer() { - mBufferHandle.reset(new Gralloc::NativeHandleWrapper( - mGralloc->allocate(mWidth, mHeight, mLayerCount, mFormat, mUsage, - /*import*/ true, &mStride))); - ASSERT_NE(false, mGralloc->validateBufferSize(mBufferHandle->get(), mWidth, mHeight, - mLayerCount, mFormat, mUsage, mStride)); - ASSERT_NO_FATAL_FAILURE(mComposerClient->setReadbackBuffer(mDisplay, mBufferHandle->get(), -1)); + mGraphicBuffer = sp::make(mWidth, mHeight, + static_cast<::android::PixelFormat>(mPixelFormat), + mLayerCount, mUsage, "ReadbackBuffer"); + ASSERT_NE(nullptr, mGraphicBuffer); + ASSERT_EQ(::android::OK, mGraphicBuffer->initCheck()); + mComposerClient->setReadbackBuffer(mDisplay, mGraphicBuffer->handle, -1 /* fence */); } void ReadbackBuffer::checkReadbackBuffer(std::vector expectedColors) { // lock buffer for reading int32_t fenceHandle; ASSERT_NO_FATAL_FAILURE(mComposerClient->getReadbackBufferFence(mDisplay, &fenceHandle)); - - void* bufData = mGralloc->lock(mBufferHandle->get(), mUsage, mAccessRegion, fenceHandle); - ASSERT_TRUE(mPixelFormat == PixelFormat::RGB_888 || mPixelFormat == PixelFormat::RGBA_8888); - ReadbackHelper::compareColorBuffers(expectedColors, bufData, mStride, mWidth, mHeight, - mPixelFormat); - int32_t unlockFence = mGralloc->unlock(mBufferHandle->get()); - if (unlockFence != -1) { - sync_wait(unlockFence, -1); - close(unlockFence); - } + ReadbackHelper::compareColorsToBuffer(expectedColors, mGraphicBuffer, fenceHandle); } void TestColorLayer::write(const std::shared_ptr& writer) { diff --git a/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp b/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp index 1700b2ade9..254ff3be57 100644 --- a/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp +++ b/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp @@ -83,9 +83,7 @@ void TestRenderEngine::drawLayers() { void TestRenderEngine::checkColorBuffer(std::vector& expectedColors) { void* bufferData; ASSERT_EQ(0, mGraphicBuffer->lock(mGraphicBuffer->getUsage(), &bufferData)); - ReadbackHelper::compareColorBuffers(expectedColors, bufferData, mGraphicBuffer->getStride(), - mGraphicBuffer->getWidth(), mGraphicBuffer->getHeight(), - mFormat); + ReadbackHelper::compareColorsToBuffer(expectedColors, mGraphicBuffer, -1 /* fence */); ASSERT_EQ(0, mGraphicBuffer->unlock()); } diff --git a/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h b/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h index 02d7bdb9da..bbf8ef3b09 100644 --- a/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h +++ b/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h @@ -78,8 +78,10 @@ class ComposerClient : public V2_1::vts::ComposerClient { PixelFormat format, Dataspace dataspace); void setPowerMode_2_2(Display display, IComposerClient::PowerMode mode); void setReadbackBuffer(Display display, const native_handle_t* buffer, int32_t releaseFence); - void getReadbackBufferAttributes(Display display, PixelFormat* outPixelFormat, - Dataspace* outDataspace); + void getRequiredReadbackBufferAttributes(Display display, PixelFormat* outPixelFormat, + Dataspace* outDataspace); + Error getReadbackBufferAttributes(Display display, PixelFormat* outPixelFormat, + Dataspace* outDataspace); void getReadbackBufferFence(Display display, int32_t* outFence); std::vector getColorModes(Display display); diff --git a/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ReadbackVts.h b/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ReadbackVts.h index 58efde9b5a..7100297ac2 100644 --- a/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ReadbackVts.h +++ b/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ReadbackVts.h @@ -34,6 +34,8 @@ namespace composer { namespace V2_2 { namespace vts { +using android::GraphicBuffer; +using android::sp; using android::hardware::hidl_handle; using common::V1_1::BufferUsage; using common::V1_1::Dataspace; @@ -156,6 +158,13 @@ class ReadbackHelper { static int32_t GetBytesPerPixel(PixelFormat pixelFormat); + static void fillBufferAndGetFence(const sp& graphicBuffer, + IComposerClient::Color desiredColor, int* fillFence); + + static void fillBufferAndGetFence(const sp& graphicBuffer, + const std::vector& desiredColors, + int* fillFence); + static void fillBuffer(int32_t width, int32_t height, uint32_t stride, void* bufferData, PixelFormat pixelFormat, std::vector desiredPixelColors); @@ -166,40 +175,39 @@ class ReadbackHelper { static void fillColorsArea(std::vector& expectedColors, int32_t stride, IComposerClient::Rect area, IComposerClient::Color color); - static bool readbackSupported(const PixelFormat& pixelFormat, const Dataspace& dataspace, - const Error error); - static const std::vector colorModes; static const std::vector dataspaces; - static void compareColorBuffers(std::vector& expectedColors, - void* bufferData, const uint32_t stride, const uint32_t width, - const uint32_t height, const PixelFormat pixelFormat); + static bool readbackSupported(PixelFormat pixelFormat, Dataspace dataspace, Error error); + static bool readbackSupported(PixelFormat pixelFormat, Dataspace dataspace); + + static void createReadbackBuffer(uint32_t width, uint32_t height, PixelFormat pixelFormat, + Dataspace dataspace, sp* graphicBuffer); + + static void compareColorToBuffer(IComposerClient::Color expectedColors, + const sp& graphicBuffer, int32_t fence); + + static void compareColorsToBuffer(std::vector& expectedColors, + const sp& graphicBuffer, int32_t fence); }; class ReadbackBuffer { public: - ReadbackBuffer(Display display, const std::shared_ptr& client, - const std::shared_ptr& gralloc, uint32_t width, uint32_t height, - PixelFormat pixelFormat, Dataspace dataspace); + ReadbackBuffer(Display display, const std::shared_ptr& client, uint32_t width, + uint32_t height, PixelFormat pixelFormat); void setReadbackBuffer(); void checkReadbackBuffer(std::vector expectedColors); protected: + sp mGraphicBuffer; uint32_t mWidth; uint32_t mHeight; - uint32_t mLayerCount; - PixelFormat mFormat; - uint64_t mUsage; - AccessRegion mAccessRegion; - uint32_t mStride; - std::unique_ptr mBufferHandle = nullptr; PixelFormat mPixelFormat; - Dataspace mDataspace; + uint32_t mLayerCount; + uint64_t mUsage; Display mDisplay; - std::shared_ptr mGralloc; std::shared_ptr mComposerClient; }; diff --git a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp index e2a0f4d22f..5b8ce3f943 100644 --- a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp +++ b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp @@ -40,7 +40,6 @@ namespace vts { namespace { using android::Rect; -using common::V1_1::BufferUsage; using common::V1_1::Dataspace; using common::V1_1::PixelFormat; using V2_1::Config; @@ -100,8 +99,8 @@ class GraphicsCompositionTestBase : public ::testing::Test { mTestRenderEngine->initGraphicBuffer( static_cast(mDisplayWidth), static_cast(mDisplayHeight), 1, - static_cast(BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN | - BufferUsage::GPU_RENDER_TARGET)); + GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_OFTEN | + GRALLOC_USAGE_HW_RENDER); mTestRenderEngine->setDisplaySettings(clientCompositionDisplay); } @@ -116,6 +115,22 @@ class GraphicsCompositionTestBase : public ::testing::Test { } } + sp allocateBuffer(uint32_t width, uint32_t height, uint32_t usage) { + const auto& graphicBuffer = sp::make( + width, height, android::PIXEL_FORMAT_RGBA_8888, + /*layerCount*/ 1u, usage, "VtsHalGraphicsComposer2_2_ReadbackTest"); + + if (graphicBuffer && android::OK == graphicBuffer->initCheck()) { + return nullptr; + } + return graphicBuffer; + } + + sp allocateBuffer(uint32_t usage) { + return allocateBuffer(static_cast(mDisplayWidth), + static_cast(mDisplayHeight), usage); + } + void clearCommandReaderState() { mReader->mCompositionChanges.clear(); mReader->mErrors.clear(); @@ -193,15 +208,9 @@ TEST_P(GraphicsCompositionTest, SingleSolidColorLayer) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - mComposerClient->getRaw()->getReadbackBufferAttributes( - mPrimaryDisplay, - [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { - mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, - tmpDataspace, tmpError); - mPixelFormat = tmpPixelFormat; - mDataspace = tmpDataspace; - }); - + Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, + &mDataspace); + mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -220,8 +229,8 @@ TEST_P(GraphicsCompositionTest, SingleSolidColorLayer) { std::vector expectedColors(mDisplayWidth * mDisplayHeight); ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, coloredSquare, BLUE); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, - mDisplayHeight, mPixelFormat, mDataspace); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, + mDisplayHeight, mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); @@ -255,15 +264,9 @@ TEST_P(GraphicsCompositionTest, SetLayerBuffer) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - mComposerClient->getRaw()->getReadbackBufferAttributes( - mPrimaryDisplay, - [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { - mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, - tmpDataspace, tmpError); - mPixelFormat = tmpPixelFormat; - mDataspace = tmpDataspace; - }); - + Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, + &mDataspace); + mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -272,8 +275,8 @@ TEST_P(GraphicsCompositionTest, SetLayerBuffer) { mWriter->selectDisplay(mPrimaryDisplay); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, - mDisplayHeight, mPixelFormat, mDataspace); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, + mDisplayHeight, mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); std::vector expectedColors(mDisplayWidth * mDisplayHeight); ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, @@ -319,6 +322,155 @@ TEST_P(GraphicsCompositionTest, SetLayerBuffer) { } } +TEST_P(GraphicsCompositionTest, SetLayerBufferWithSlotsToClear) { + Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, + &mDataspace); + if (error == Error::UNSUPPORTED) { + GTEST_SUCCEED() << "Readback is unsupported"; + return; + } + ASSERT_EQ(Error::NONE, error); + + sp readbackBuffer; + ASSERT_NO_FATAL_FAILURE(ReadbackHelper::createReadbackBuffer( + mDisplayWidth, mDisplayHeight, mPixelFormat, mDataspace, &readbackBuffer)); + if (readbackBuffer == nullptr) { + GTEST_SUCCEED() << "Unsupported readback buffer attributes"; + return; + } + // no fence needed for the readback buffer + int noFence = -1; + + sp clearSlotBuffer = allocateBuffer(1u, 1u, GRALLOC_USAGE_HW_COMPOSER); + ASSERT_NE(nullptr, clearSlotBuffer); + + // red buffer + uint32_t usage = GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_OFTEN; + sp redBuffer = allocateBuffer(usage); + ASSERT_NE(nullptr, redBuffer); + int redFence; + ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBufferAndGetFence(redBuffer, RED, &redFence)); + + // blue buffer + sp blueBuffer = allocateBuffer(usage); + ASSERT_NE(nullptr, blueBuffer); + int blueFence; + ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBufferAndGetFence(blueBuffer, BLUE, &blueFence)); + + // layer defaults + IComposerClient::Rect rectFullDisplay = {0, 0, mDisplayWidth, mDisplayHeight}; + Layer layer = mComposerClient->createLayer(mPrimaryDisplay, 3); + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->selectLayer(layer); + mWriter->setLayerDisplayFrame(rectFullDisplay); + mWriter->setLayerCompositionType(IComposerClient::Composition::DEVICE); + + // set the layer to the blue buffer + // should be blue + { + ASSERT_NO_FATAL_FAILURE(mComposerClient->setReadbackBuffer( + mPrimaryDisplay, readbackBuffer->handle, noFence)); + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->selectLayer(layer); + mWriter->setLayerBuffer(/*slot*/ 0, blueBuffer->handle, blueFence); + mWriter->validateDisplay(); + execute(); + ASSERT_TRUE(mReader->mCompositionChanges.empty()); + ASSERT_TRUE(mReader->mErrors.size()); + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->presentDisplay(); + execute(); + int32_t fence; + ASSERT_NO_FATAL_FAILURE(mComposerClient->getReadbackBufferFence(mPrimaryDisplay, &fence)); + ASSERT_NO_FATAL_FAILURE(ReadbackHelper::compareColorToBuffer(BLUE, readbackBuffer, fence)); + } + + // change the layer to the red buffer + // should be red + { + ASSERT_NO_FATAL_FAILURE(mComposerClient->setReadbackBuffer( + mPrimaryDisplay, readbackBuffer->handle, noFence)); + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->selectLayer(layer); + mWriter->setLayerBuffer(/*slot*/ 1, redBuffer->handle, redFence); + mWriter->validateDisplay(); + execute(); + ASSERT_TRUE(mReader->mCompositionChanges.empty()); + ASSERT_TRUE(mReader->mErrors.size()); + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->presentDisplay(); + execute(); + int32_t fence; + ASSERT_NO_FATAL_FAILURE(mComposerClient->getReadbackBufferFence(mPrimaryDisplay, &fence)); + ReadbackHelper::compareColorToBuffer(RED, readbackBuffer, fence); + } + + // clear the slot for the blue buffer + // should still be red + { + ASSERT_NO_FATAL_FAILURE(mComposerClient->setReadbackBuffer( + mPrimaryDisplay, readbackBuffer->handle, noFence)); + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->selectLayer(layer); + mWriter->setLayerBuffer(/*slot*/ 0, clearSlotBuffer->handle, /*fence*/ -1); + mWriter->validateDisplay(); + execute(); + ASSERT_TRUE(mReader->mCompositionChanges.empty()); + ASSERT_TRUE(mReader->mErrors.size()); + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->presentDisplay(); + execute(); + int32_t fence; + ASSERT_NO_FATAL_FAILURE(mComposerClient->getReadbackBufferFence(mPrimaryDisplay, &fence)); + ReadbackHelper::compareColorToBuffer(RED, readbackBuffer, fence); + } + + // clear the slot for the red buffer, and set the buffer with the same slot to the blue buffer + // should be blue + { + ASSERT_NO_FATAL_FAILURE(mComposerClient->setReadbackBuffer( + mPrimaryDisplay, readbackBuffer->handle, noFence)); + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->selectLayer(layer); + mWriter->setLayerBuffer(/*slot*/ 1, clearSlotBuffer->handle, /*fence*/ -1); + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->selectLayer(layer); + mWriter->setLayerBuffer(/*slot*/ 1, blueBuffer->handle, blueFence); + mWriter->validateDisplay(); + execute(); + ASSERT_TRUE(mReader->mCompositionChanges.empty()); + ASSERT_TRUE(mReader->mErrors.size()); + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->presentDisplay(); + execute(); + int32_t fence; + ASSERT_NO_FATAL_FAILURE(mComposerClient->getReadbackBufferFence(mPrimaryDisplay, &fence)); + ReadbackHelper::compareColorToBuffer(BLUE, readbackBuffer, fence); + } + + // clear the slot for the now-blue buffer + // should be black (no buffer) + // TODO(b/262037933) Ensure we never clear the active buffer's slot with the placeholder buffer + // by setting the layer to the color black + { + ASSERT_NO_FATAL_FAILURE(mComposerClient->setReadbackBuffer( + mPrimaryDisplay, readbackBuffer->handle, noFence)); + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->selectLayer(layer); + mWriter->setLayerBuffer(/*slot*/ 1, clearSlotBuffer->handle, /*fence*/ -1); + mWriter->validateDisplay(); + execute(); + ASSERT_TRUE(mReader->mCompositionChanges.empty()); + ASSERT_TRUE(mReader->mErrors.size()); + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->presentDisplay(); + execute(); + int32_t fence; + ASSERT_NO_FATAL_FAILURE(mComposerClient->getReadbackBufferFence(mPrimaryDisplay, &fence)); + ReadbackHelper::compareColorToBuffer(BLACK, readbackBuffer, fence); + } +} + TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { for (ColorMode mode : mTestColorModes) { std::cout << "---Testing Color Mode " << ReadbackHelper::getColorModeString(mode) << "---" @@ -327,15 +479,9 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - mComposerClient->getRaw()->getReadbackBufferAttributes( - mPrimaryDisplay, - [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { - mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, - tmpDataspace, tmpError); - mPixelFormat = tmpPixelFormat; - mDataspace = tmpDataspace; - }); - + Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, + &mDataspace); + mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -350,8 +496,7 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { layer->write(mWriter); // This following buffer call should have no effect - uint64_t usage = - static_cast(BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN); + uint32_t usage = GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_OFTEN; NativeHandleWrapper bufferHandle = mGralloc->allocate(mDisplayWidth, mDisplayHeight, 1, PixelFormat::RGBA_8888, usage); mWriter->setLayerBuffer(0, bufferHandle.get(), -1); @@ -360,8 +505,8 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { std::vector expectedColors(mDisplayWidth * mDisplayHeight); ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, coloredSquare, BLUE); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, - mDisplayHeight, mPixelFormat, mDataspace); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, + mDisplayHeight, mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); mWriter->validateDisplay(); @@ -392,15 +537,11 @@ TEST_P(GraphicsCompositionTest, ClientComposition) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - mComposerClient->getRaw()->getReadbackBufferAttributes( - mPrimaryDisplay, - [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { - mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, - tmpDataspace, tmpError); - mPixelFormat = tmpPixelFormat; - mDataspace = tmpDataspace; - }); - + PixelFormat pixelFormat; + Dataspace dataspace; + Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &pixelFormat, + &dataspace); + mHasReadbackBuffer = ReadbackHelper::readbackSupported(pixelFormat, dataspace, error); if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -428,8 +569,8 @@ TEST_P(GraphicsCompositionTest, ClientComposition) { std::vector> layers = {layer}; - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, - mDisplayHeight, mPixelFormat, mDataspace); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, + mDisplayHeight, mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); ASSERT_EQ(0, mReader->mErrors.size()); @@ -441,9 +582,8 @@ TEST_P(GraphicsCompositionTest, ClientComposition) { ASSERT_EQ(1, mReader->mCompositionChanges[0].second); PixelFormat clientFormat = PixelFormat::RGBA_8888; - uint64_t clientUsage = static_cast(BufferUsage::CPU_READ_OFTEN | - BufferUsage::CPU_WRITE_OFTEN | - BufferUsage::COMPOSER_CLIENT_TARGET); + uint32_t clientUsage = GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_OFTEN | + GRALLOC_USAGE_HW_FB; Dataspace clientDataspace = ReadbackHelper::getDataspaceForColorMode(mode); IComposerClient::Rect damage{0, 0, mDisplayWidth, mDisplayHeight}; @@ -510,15 +650,9 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - mComposerClient->getRaw()->getReadbackBufferAttributes( - mPrimaryDisplay, - [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { - mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, - tmpDataspace, tmpError); - mPixelFormat = tmpPixelFormat; - mDataspace = tmpDataspace; - }); - + Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, + &mDataspace); + mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -531,8 +665,8 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, {0, mDisplayHeight / 2, mDisplayWidth, mDisplayHeight}, RED); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, - mDisplayHeight, mPixelFormat, mDataspace); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, + mDisplayHeight, mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); auto deviceLayer = std::make_shared( @@ -552,9 +686,8 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { deviceLayer->write(mWriter); PixelFormat clientFormat = PixelFormat::RGBA_8888; - uint64_t clientUsage = - static_cast(BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN | - BufferUsage::COMPOSER_CLIENT_TARGET); + uint32_t clientUsage = + GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_HW_FB; Dataspace clientDataspace = ReadbackHelper::getDataspaceForColorMode(mode); int32_t clientWidth = mDisplayWidth; int32_t clientHeight = mDisplayHeight / 2; @@ -633,15 +766,9 @@ TEST_P(GraphicsCompositionTest, SetLayerDamage) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - mComposerClient->getRaw()->getReadbackBufferAttributes( - mPrimaryDisplay, - [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { - mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, - tmpDataspace, tmpError); - mPixelFormat = tmpPixelFormat; - mDataspace = tmpDataspace; - }); - + Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, + &mDataspace); + mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -665,8 +792,8 @@ TEST_P(GraphicsCompositionTest, SetLayerDamage) { std::vector> layers = {layer}; - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, - mDisplayHeight, mPixelFormat, mDataspace); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, + mDisplayHeight, mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); @@ -718,15 +845,9 @@ TEST_P(GraphicsCompositionTest, SetLayerPlaneAlpha) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - mComposerClient->getRaw()->getReadbackBufferAttributes( - mPrimaryDisplay, - [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { - mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, - tmpDataspace, tmpError); - mPixelFormat = tmpPixelFormat; - mDataspace = tmpDataspace; - }); - + Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, + &mDataspace); + mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -742,8 +863,8 @@ TEST_P(GraphicsCompositionTest, SetLayerPlaneAlpha) { std::vector> layers = {layer}; - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, - mDisplayHeight, mPixelFormat, mDataspace); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, + mDisplayHeight, mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); @@ -779,15 +900,9 @@ TEST_P(GraphicsCompositionTest, SetLayerSourceCrop) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - mComposerClient->getRaw()->getReadbackBufferAttributes( - mPrimaryDisplay, - [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { - mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, - tmpDataspace, tmpError); - mPixelFormat = tmpPixelFormat; - mDataspace = tmpDataspace; - }); - + Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, + &mDataspace); + mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -819,8 +934,8 @@ TEST_P(GraphicsCompositionTest, SetLayerSourceCrop) { // update expected colors to match crop ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, {0, 0, mDisplayWidth, mDisplayHeight}, BLUE); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, - mDisplayHeight, mPixelFormat, mDataspace); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, + mDisplayHeight, mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); ASSERT_EQ(0, mReader->mErrors.size()); @@ -850,15 +965,9 @@ TEST_P(GraphicsCompositionTest, SetLayerZOrder) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - mComposerClient->getRaw()->getReadbackBufferAttributes( - mPrimaryDisplay, - [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { - mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, - tmpDataspace, tmpError); - mPixelFormat = tmpPixelFormat; - mDataspace = tmpDataspace; - }); - + Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, + &mDataspace); + mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -886,8 +995,8 @@ TEST_P(GraphicsCompositionTest, SetLayerZOrder) { ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, blueRect, BLUE); ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, redRect, RED); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, - mDisplayHeight, mPixelFormat, mDataspace); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, + mDisplayHeight, mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); @@ -1019,15 +1128,9 @@ TEST_P(GraphicsBlendModeCompositionTest, DISABLED_None) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - mComposerClient->getRaw()->getReadbackBufferAttributes( - mPrimaryDisplay, - [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { - mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, - tmpDataspace, tmpError); - mPixelFormat = tmpPixelFormat; - mDataspace = tmpDataspace; - }); - + Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, + &mDataspace); + mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -1043,8 +1146,8 @@ TEST_P(GraphicsBlendModeCompositionTest, DISABLED_None) { setUpLayers(IComposerClient::BlendMode::NONE); setExpectedColors(expectedColors); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, - mDisplayHeight, mPixelFormat, mDataspace); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, + mDisplayHeight, mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(mLayers); ASSERT_EQ(0, mReader->mErrors.size()); @@ -1077,15 +1180,9 @@ TEST_P(GraphicsBlendModeCompositionTest, DISABLED_Coverage) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - mComposerClient->getRaw()->getReadbackBufferAttributes( - mPrimaryDisplay, - [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { - mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, - tmpDataspace, tmpError); - mPixelFormat = tmpPixelFormat; - mDataspace = tmpDataspace; - }); - + Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, + &mDataspace); + mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -1102,8 +1199,8 @@ TEST_P(GraphicsBlendModeCompositionTest, DISABLED_Coverage) { setUpLayers(IComposerClient::BlendMode::COVERAGE); setExpectedColors(expectedColors); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, - mDisplayHeight, mPixelFormat, mDataspace); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, + mDisplayHeight, mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(mLayers); ASSERT_EQ(0, mReader->mErrors.size()); @@ -1130,15 +1227,9 @@ TEST_P(GraphicsBlendModeCompositionTest, Premultiplied) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - mComposerClient->getRaw()->getReadbackBufferAttributes( - mPrimaryDisplay, - [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { - mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, - tmpDataspace, tmpError); - mPixelFormat = tmpPixelFormat; - mDataspace = tmpDataspace; - }); - + Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, + &mDataspace); + mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -1153,8 +1244,8 @@ TEST_P(GraphicsBlendModeCompositionTest, Premultiplied) { setUpLayers(IComposerClient::BlendMode::PREMULTIPLIED); setExpectedColors(expectedColors); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, - mDisplayHeight, mPixelFormat, mDataspace); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, + mDisplayHeight, mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(mLayers); ASSERT_EQ(0, mReader->mErrors.size()); @@ -1222,22 +1313,16 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_H) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - mComposerClient->getRaw()->getReadbackBufferAttributes( - mPrimaryDisplay, - [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { - mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, - tmpDataspace, tmpError); - mPixelFormat = tmpPixelFormat; - mDataspace = tmpDataspace; - }); - + Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, + &mDataspace); + mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; return; } - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, - mDisplayHeight, mPixelFormat, mDataspace); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, + mDisplayHeight, mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); mLayer->setTransform(Transform::FLIP_H); mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter); @@ -1277,22 +1362,16 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_V) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - mComposerClient->getRaw()->getReadbackBufferAttributes( - mPrimaryDisplay, - [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { - mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, - tmpDataspace, tmpError); - mPixelFormat = tmpPixelFormat; - mDataspace = tmpDataspace; - }); - + Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, + &mDataspace); + mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; return; } - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, - mDisplayHeight, mPixelFormat, mDataspace); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, + mDisplayHeight, mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); mLayer->setTransform(Transform::FLIP_V); @@ -1332,22 +1411,16 @@ TEST_P(GraphicsTransformCompositionTest, ROT_180) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - mComposerClient->getRaw()->getReadbackBufferAttributes( - mPrimaryDisplay, - [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { - mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, - tmpDataspace, tmpError); - mPixelFormat = tmpPixelFormat; - mDataspace = tmpDataspace; - }); - + Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, + &mDataspace); + mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; return; } - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, - mDisplayHeight, mPixelFormat, mDataspace); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, + mDisplayHeight, mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); mLayer->setTransform(Transform::ROT_180); diff --git a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp index 7e25a2e125..f8fbb0477e 100644 --- a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp +++ b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -35,7 +36,6 @@ namespace V2_2 { namespace vts { namespace { -using common::V1_0::BufferUsage; using common::V1_1::ColorMode; using common::V1_1::Dataspace; using common::V1_1::PixelFormat; @@ -65,17 +65,13 @@ class GraphicsComposerHidlTest : public ::testing::TestWithParam { mComposerClient->setVsyncEnabled(mPrimaryDisplay, false); mComposerCallback->setVsyncAllowed(false); - mComposerClient->getRaw()->getReadbackBufferAttributes( - mPrimaryDisplay, - [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { - mHasReadbackBuffer = tmpError == Error::NONE; - if (mHasReadbackBuffer) { - mReadbackPixelFormat = tmpPixelFormat; - mReadbackDataspace = tmpDataspace; - ASSERT_LT(static_cast(0), mReadbackPixelFormat); - ASSERT_NE(Dataspace::UNKNOWN, mReadbackDataspace); - } - }); + Error error = mComposerClient->getReadbackBufferAttributes( + mPrimaryDisplay, &mReadbackPixelFormat, &mReadbackDataspace); + mHasReadbackBuffer = error == Error::NONE; + if (mHasReadbackBuffer) { + ASSERT_LT(static_cast(0), mReadbackPixelFormat); + ASSERT_NE(Dataspace::UNKNOWN, mReadbackDataspace); + } mInvalidDisplayId = GetInvalidDisplayId(); } @@ -153,10 +149,9 @@ class GraphicsComposerHidlCommandTest : public GraphicsComposerHidlTest { } NativeHandleWrapper allocate() { - uint64_t usage = - static_cast(BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN); return mGralloc->allocate(/*width*/ 64, /*height*/ 64, /*layerCount*/ 1, - PixelFormat::RGBA_8888, usage); + PixelFormat::RGBA_8888, + GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_OFTEN); } void execute() { mComposerClient->execute(mReader.get(), mWriter.get()); } @@ -434,9 +429,7 @@ TEST_P(GraphicsComposerHidlTest, SetReadbackBuffer) { } // BufferUsage::COMPOSER_OUTPUT is missing - uint64_t usage = - static_cast(BufferUsage::COMPOSER_OVERLAY | BufferUsage::CPU_READ_OFTEN); - + uint64_t usage = GRALLOC_USAGE_HW_COMPOSER | GRALLOC_USAGE_SW_READ_OFTEN; std::unique_ptr gralloc; std::unique_ptr buffer; ASSERT_NO_FATAL_FAILURE(gralloc = std::make_unique()); @@ -457,9 +450,7 @@ TEST_P(GraphicsComposerHidlTest, SetReadbackBufferBadDisplay) { return; } - uint64_t usage = - static_cast(BufferUsage::COMPOSER_OVERLAY | BufferUsage::CPU_READ_OFTEN); - + uint64_t usage = GRALLOC_USAGE_HW_COMPOSER | GRALLOC_USAGE_SW_READ_OFTEN; std::unique_ptr gralloc; std::unique_ptr buffer; ASSERT_NO_FATAL_FAILURE(gralloc = std::make_unique()); diff --git a/graphics/composer/aidl/vts/ReadbackVts.cpp b/graphics/composer/aidl/vts/ReadbackVts.cpp index abb58e25dd..b59793f8db 100644 --- a/graphics/composer/aidl/vts/ReadbackVts.cpp +++ b/graphics/composer/aidl/vts/ReadbackVts.cpp @@ -20,6 +20,8 @@ #include "renderengine/ExternalTexture.h" #include "renderengine/impl/ExternalTexture.h" +using ::android::status_t; + namespace aidl::android::hardware::graphics::composer3::vts { const std::vector ReadbackHelper::colorModes = {ColorMode::SRGB, ColorMode::DISPLAY_P3}; @@ -27,6 +29,9 @@ const std::vector ReadbackHelper::dataspaces = {common::Dataspace::SR common::Dataspace::DISPLAY_P3}; void TestLayer::write(ComposerClientWriter& writer) { + ::android::status_t status = ::android::OK; + ASSERT_EQ(::android::OK, status); + writer.setLayerDisplayFrame(mDisplay, mLayer, mDisplayFrame); writer.setLayerSourceCrop(mDisplay, mLayer, mSourceCrop); writer.setLayerZOrder(mDisplay, mLayer, mZOrder); @@ -37,6 +42,40 @@ void TestLayer::write(ComposerClientWriter& writer) { writer.setLayerBrightness(mDisplay, mLayer, mBrightness); } +bool ReadbackHelper::readbackSupported(const common::PixelFormat& pixelFormat, + const common::Dataspace& dataspace) { + // TODO: add support for RGBA_1010102 + if (pixelFormat != common::PixelFormat::RGB_888 && + pixelFormat != common::PixelFormat::RGBA_8888) { + return false; + } + if (std::find(dataspaces.begin(), dataspaces.end(), dataspace) == dataspaces.end()) { + return false; + } + return true; +} + +void ReadbackHelper::createReadbackBuffer(ReadbackBufferAttributes readbackBufferAttributes, + const VtsDisplay& display, + sp* graphicBuffer) { + ASSERT_NE(nullptr, graphicBuffer); + if (!readbackSupported(readbackBufferAttributes.format, readbackBufferAttributes.dataspace)) { + *graphicBuffer = nullptr; + } + uint64_t usage = + static_cast(static_cast(common::BufferUsage::CPU_READ_OFTEN) | + static_cast(common::BufferUsage::GPU_TEXTURE)); + + uint32_t layerCount = 1; + *graphicBuffer = sp::make( + static_cast(display.getDisplayWidth()), + static_cast(display.getDisplayHeight()), + static_cast<::android::PixelFormat>(readbackBufferAttributes.format), layerCount, usage, + "ReadbackBuffer"); + ASSERT_NE(nullptr, *graphicBuffer); + ASSERT_EQ(::android::OK, (*graphicBuffer)->initCheck()); +} + std::string ReadbackHelper::getColorModeString(ColorMode mode) { switch (mode) { case ColorMode::SRGB: @@ -103,11 +142,11 @@ LayerSettings TestLayer::toRenderEngineLayerSettings() { return layerSettings; } -int32_t ReadbackHelper::GetBytesPerPixel(common::PixelFormat pixelFormat) { +int32_t ReadbackHelper::GetBytesPerPixel(PixelFormat pixelFormat) { switch (pixelFormat) { - case common::PixelFormat::RGBA_8888: + case PixelFormat::RGBA_8888: return 4; - case common::PixelFormat::RGB_888: + case PixelFormat::RGB_888: return 3; default: return -1; @@ -116,136 +155,161 @@ int32_t ReadbackHelper::GetBytesPerPixel(common::PixelFormat pixelFormat) { void ReadbackHelper::fillBuffer(uint32_t width, uint32_t height, uint32_t stride, void* bufferData, common::PixelFormat pixelFormat, - std::vector desiredPixelColors) { + const std::vector& desiredColors) { ASSERT_TRUE(pixelFormat == common::PixelFormat::RGB_888 || pixelFormat == common::PixelFormat::RGBA_8888); int32_t bytesPerPixel = GetBytesPerPixel(pixelFormat); ASSERT_NE(-1, bytesPerPixel); for (int row = 0; row < height; row++) { for (int col = 0; col < width; col++) { - auto pixel = row * static_cast(width) + col; - Color srcColor = desiredPixelColors[static_cast(pixel)]; + int pixel = row * static_cast(width) + col; + Color desiredColor = desiredColors[static_cast(pixel)]; int offset = (row * static_cast(stride) + col) * bytesPerPixel; uint8_t* pixelColor = (uint8_t*)bufferData + offset; - pixelColor[0] = static_cast(std::round(255.0f * srcColor.r)); - pixelColor[1] = static_cast(std::round(255.0f * srcColor.g)); - pixelColor[2] = static_cast(std::round(255.0f * srcColor.b)); + pixelColor[0] = static_cast(std::round(255.0f * desiredColor.r)); + pixelColor[1] = static_cast(std::round(255.0f * desiredColor.g)); + pixelColor[2] = static_cast(std::round(255.0f * desiredColor.b)); if (bytesPerPixel == 4) { - pixelColor[3] = static_cast(std::round(255.0f * srcColor.a)); + pixelColor[3] = static_cast(std::round(255.0f * desiredColor.a)); } } } } -void ReadbackHelper::clearColors(std::vector& expectedColors, int32_t width, int32_t height, +void ReadbackHelper::clearColors(std::vector& colors, int32_t width, int32_t height, int32_t displayWidth) { for (int row = 0; row < height; row++) { for (int col = 0; col < width; col++) { int pixel = row * displayWidth + col; - expectedColors[static_cast(pixel)] = BLACK; + colors[static_cast(pixel)] = BLACK; } } } -void ReadbackHelper::fillColorsArea(std::vector& expectedColors, int32_t stride, Rect area, - Color color) { +void ReadbackHelper::fillColorsArea(std::vector& colors, int32_t stride, Rect area, + Color desiredColor) { for (int row = area.top; row < area.bottom; row++) { for (int col = area.left; col < area.right; col++) { int pixel = row * stride + col; - expectedColors[static_cast(pixel)] = color; + colors[static_cast(pixel)] = desiredColor; } } } -bool ReadbackHelper::readbackSupported(const common::PixelFormat& pixelFormat, - const common::Dataspace& dataspace) { - if (pixelFormat != common::PixelFormat::RGB_888 && - pixelFormat != common::PixelFormat::RGBA_8888) { - return false; - } - if (std::find(dataspaces.begin(), dataspaces.end(), dataspace) == dataspaces.end()) { - return false; - } - return true; +void ReadbackHelper::fillBufferAndGetFence(const sp& graphicBuffer, + Color desiredColor, int* fillFence) { + ASSERT_NE(nullptr, fillFence); + std::vector desiredColors( + static_cast(graphicBuffer->getWidth() * graphicBuffer->getHeight())); + ::android::Rect bounds = graphicBuffer->getBounds(); + fillColorsArea(desiredColors, static_cast(graphicBuffer->getWidth()), + {bounds.left, bounds.top, bounds.right, bounds.bottom}, desiredColor); + ASSERT_NO_FATAL_FAILURE(fillBufferAndGetFence(graphicBuffer, desiredColors, fillFence)); } -void ReadbackHelper::compareColorBuffers(const std::vector& expectedColors, void* bufferData, - const uint32_t stride, const uint32_t width, - const uint32_t height, common::PixelFormat pixelFormat) { - const int32_t bytesPerPixel = ReadbackHelper::GetBytesPerPixel(pixelFormat); +void ReadbackHelper::fillBufferAndGetFence(const sp& graphicBuffer, + const std::vector& desiredColors, + int* fillFence) { + ASSERT_TRUE(graphicBuffer->getPixelFormat() == ::android::PIXEL_FORMAT_RGB_888 || + graphicBuffer->getPixelFormat() == ::android::PIXEL_FORMAT_RGBA_8888); + void* bufData; + int32_t bytesPerPixel = -1; + int32_t bytesPerStride = -1; + status_t status = + graphicBuffer->lock(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN, + &bufData, &bytesPerPixel, &bytesPerStride); + ASSERT_EQ(::android::OK, status); + + const uint32_t stride = (bytesPerPixel > 0 && bytesPerStride > 0) + ? static_cast(bytesPerStride / bytesPerPixel) + : graphicBuffer->getStride(); + ReadbackHelper::fillBuffer( + graphicBuffer->getWidth(), graphicBuffer->getHeight(), stride, bufData, + static_cast(graphicBuffer->getPixelFormat()), desiredColors); + status = graphicBuffer->unlockAsync(fillFence); + ASSERT_EQ(::android::OK, status); +} + +void ReadbackHelper::compareColorToBuffer(Color expectedColor, + const sp& graphicBuffer, + const ndk::ScopedFileDescriptor& fence) { + std::vector expectedColors( + static_cast(graphicBuffer->getWidth() * graphicBuffer->getHeight())); + ::android::Rect bounds = graphicBuffer->getBounds(); + fillColorsArea(expectedColors, static_cast(graphicBuffer->getWidth()), + {bounds.left, bounds.top, bounds.right, bounds.bottom}, expectedColor); + compareColorsToBuffer(expectedColors, graphicBuffer, fence); +} + +void ReadbackHelper::compareColorsToBuffer(const std::vector& expectedColors, + const sp& graphicBuffer, + const ndk::ScopedFileDescriptor& fence) { + ASSERT_TRUE(graphicBuffer->getPixelFormat() == ::android::PIXEL_FORMAT_RGB_888 || + graphicBuffer->getPixelFormat() == ::android::PIXEL_FORMAT_RGBA_8888); + + int bytesPerPixel = -1; + int bytesPerStride = -1; + void* bufData = nullptr; + status_t status = graphicBuffer->lockAsync(GRALLOC_USAGE_SW_READ_OFTEN, &bufData, + dup(fence.get()), &bytesPerPixel, &bytesPerStride); + ASSERT_EQ(::android::OK, status); + + const uint32_t stride = (bytesPerPixel > 0 && bytesPerStride > 0) + ? static_cast(bytesPerStride / bytesPerPixel) + : graphicBuffer->getStride(); + + if (bytesPerPixel == -1) { + bytesPerPixel = ReadbackHelper::GetBytesPerPixel( + static_cast(graphicBuffer->getPixelFormat())); + } ASSERT_NE(-1, bytesPerPixel); - for (int row = 0; row < height; row++) { - for (int col = 0; col < width; col++) { - auto pixel = row * static_cast(width) + col; + for (int row = 0; row < graphicBuffer->getHeight(); row++) { + for (int col = 0; col < graphicBuffer->getWidth(); col++) { + int pixel = row * static_cast(graphicBuffer->getWidth()) + col; int offset = (row * static_cast(stride) + col) * bytesPerPixel; - uint8_t* pixelColor = (uint8_t*)bufferData + offset; + uint8_t* pixelColor = (uint8_t*)bufData + offset; const Color expectedColor = expectedColors[static_cast(pixel)]; ASSERT_EQ(std::round(255.0f * expectedColor.r), pixelColor[0]); ASSERT_EQ(std::round(255.0f * expectedColor.g), pixelColor[1]); ASSERT_EQ(std::round(255.0f * expectedColor.b), pixelColor[2]); } } + + status = graphicBuffer->unlock(); + ASSERT_EQ(::android::OK, status); } ReadbackBuffer::ReadbackBuffer(int64_t display, const std::shared_ptr& client, - int32_t width, int32_t height, common::PixelFormat pixelFormat, - common::Dataspace dataspace) + int32_t width, int32_t height, common::PixelFormat pixelFormat) : mComposerClient(client) { mDisplay = display; - - mPixelFormat = pixelFormat; - mDataspace = dataspace; - mWidth = static_cast(width); mHeight = static_cast(height); + mPixelFormat = pixelFormat; mLayerCount = 1; mUsage = static_cast(static_cast(common::BufferUsage::CPU_READ_OFTEN) | static_cast(common::BufferUsage::GPU_TEXTURE)); - - mAccessRegion.top = 0; - mAccessRegion.left = 0; - mAccessRegion.right = static_cast(width); - mAccessRegion.bottom = static_cast(height); -} - -::android::sp<::android::GraphicBuffer> ReadbackBuffer::allocateBuffer() { - return ::android::sp<::android::GraphicBuffer>::make( - mWidth, mHeight, static_cast<::android::PixelFormat>(mPixelFormat), mLayerCount, mUsage, - "ReadbackBuffer"); } void ReadbackBuffer::setReadbackBuffer() { - mGraphicBuffer = allocateBuffer(); + mGraphicBuffer = sp::make(mWidth, mHeight, + static_cast<::android::PixelFormat>(mPixelFormat), + mLayerCount, mUsage, "ReadbackBuffer"); ASSERT_NE(nullptr, mGraphicBuffer); ASSERT_EQ(::android::OK, mGraphicBuffer->initCheck()); - const auto& bufferHandle = mGraphicBuffer->handle; - ::ndk::ScopedFileDescriptor fence = ::ndk::ScopedFileDescriptor(-1); - EXPECT_TRUE(mComposerClient->setReadbackBuffer(mDisplay, bufferHandle, fence).isOk()); + ::ndk::ScopedFileDescriptor noFence = ::ndk::ScopedFileDescriptor(-1); + const auto& status = + mComposerClient->setReadbackBuffer(mDisplay, mGraphicBuffer->handle, noFence); + ASSERT_TRUE(status.isOk()); } void ReadbackBuffer::checkReadbackBuffer(const std::vector& expectedColors) { - ASSERT_NE(nullptr, mGraphicBuffer); // lock buffer for reading const auto& [fenceStatus, bufferFence] = mComposerClient->getReadbackBufferFence(mDisplay); - EXPECT_TRUE(fenceStatus.isOk()); - - int bytesPerPixel = -1; - int bytesPerStride = -1; - void* bufData = nullptr; - - auto status = mGraphicBuffer->lockAsync(mUsage, mAccessRegion, &bufData, dup(bufferFence.get()), - &bytesPerPixel, &bytesPerStride); - EXPECT_EQ(::android::OK, status); - ASSERT_TRUE(mPixelFormat == PixelFormat::RGB_888 || mPixelFormat == PixelFormat::RGBA_8888); - const uint32_t stride = (bytesPerPixel > 0 && bytesPerStride > 0) - ? static_cast(bytesPerStride / bytesPerPixel) - : mGraphicBuffer->getStride(); - ReadbackHelper::compareColorBuffers(expectedColors, bufData, stride, mWidth, mHeight, - mPixelFormat); - status = mGraphicBuffer->unlock(); - EXPECT_EQ(::android::OK, status); + ASSERT_TRUE(fenceStatus.isOk()); + ReadbackHelper::compareColorsToBuffer(expectedColors, mGraphicBuffer, bufferFence); } void TestColorLayer::write(ComposerClientWriter& writer) { @@ -323,9 +387,8 @@ void TestBufferLayer::fillBuffer(std::vector& expectedColors) { const uint32_t stride = (bytesPerPixel > 0 && bytesPerStride > 0) ? static_cast(bytesPerStride / bytesPerPixel) : mGraphicBuffer->getStride(); - EXPECT_EQ(::android::OK, status); - ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBuffer(mWidth, mHeight, stride, bufData, - mPixelFormat, expectedColors)); + ASSERT_EQ(::android::OK, status); + ReadbackHelper::fillBuffer(mWidth, mHeight, stride, bufData, mPixelFormat, expectedColors); const auto unlockStatus = mGraphicBuffer->unlockAsync(&mFillFence); ASSERT_EQ(::android::OK, unlockStatus); @@ -335,13 +398,13 @@ void TestBufferLayer::setBuffer(std::vector colors) { mGraphicBuffer = allocateBuffer(); ASSERT_NE(nullptr, mGraphicBuffer); ASSERT_EQ(::android::OK, mGraphicBuffer->initCheck()); - ASSERT_NO_FATAL_FAILURE(fillBuffer(colors)); + fillBuffer(colors); } -::android::sp<::android::GraphicBuffer> TestBufferLayer::allocateBuffer() { - return ::android::sp<::android::GraphicBuffer>::make( - mWidth, mHeight, static_cast<::android::PixelFormat>(mPixelFormat), mLayerCount, mUsage, - "TestBufferLayer"); +sp TestBufferLayer::allocateBuffer() { + return sp::make(mWidth, mHeight, + static_cast<::android::PixelFormat>(mPixelFormat), mLayerCount, + mUsage, "TestBufferLayer"); } void TestBufferLayer::setDataspace(common::Dataspace dataspace, ComposerClientWriter& writer) { diff --git a/graphics/composer/aidl/vts/ReadbackVts.h b/graphics/composer/aidl/vts/ReadbackVts.h index ee9f0d58ad..ecf0d52f65 100644 --- a/graphics/composer/aidl/vts/ReadbackVts.h +++ b/graphics/composer/aidl/vts/ReadbackVts.h @@ -33,6 +33,8 @@ using ::android::renderengine::LayerSettings; using common::Dataspace; using common::PixelFormat; using IMapper2_1 = ::android::hardware::graphics::mapper::V2_1::IMapper; +using ::android::GraphicBuffer; +using ::android::sp; static const Color BLACK = {0.0f, 0.0f, 0.0f, 1.0f}; static const Color RED = {1.0f, 0.0f, 0.0f, 1.0f}; @@ -146,7 +148,7 @@ class TestBufferLayer : public TestLayer { protected: Composition mComposition; - ::android::sp<::android::GraphicBuffer> mGraphicBuffer; + sp mGraphicBuffer; TestRenderEngine& mRenderEngine; int32_t mFillFence; uint32_t mWidth; @@ -162,6 +164,11 @@ class TestBufferLayer : public TestLayer { class ReadbackHelper { public: + static bool readbackSupported(const PixelFormat& pixelFormat, const Dataspace& dataspace); + + static void createReadbackBuffer(ReadbackBufferAttributes readbackBufferAttributes, + const VtsDisplay& display, sp* graphicBuffer); + static std::string getColorModeString(ColorMode mode); static std::string getDataspaceString(Dataspace dataspace); @@ -171,28 +178,36 @@ class ReadbackHelper { static int32_t GetBytesPerPixel(PixelFormat pixelFormat); static void fillBuffer(uint32_t width, uint32_t height, uint32_t stride, void* bufferData, - PixelFormat pixelFormat, std::vector desiredPixelColors); + PixelFormat pixelFormat, const std::vector& desriedColors); - static void clearColors(std::vector& expectedColors, int32_t width, int32_t height, + static void clearColors(std::vector& colors, int32_t width, int32_t height, int32_t displayWidth); - static void fillColorsArea(std::vector& expectedColors, int32_t stride, Rect area, - Color color); + static void fillColorsArea(std::vector& colors, int32_t stride, Rect area, + Color desiredColor); - static bool readbackSupported(const PixelFormat& pixelFormat, const Dataspace& dataspace); + static void fillBufferAndGetFence(const sp& buffer, Color desiredColor, + int* fillFence); + + static void fillBufferAndGetFence(const sp& buffer, + const std::vector& desiredColors, int* fillFence); + + static void compareColorToBuffer( + Color expectedColor, const sp& graphicBuffer, + const ndk::ScopedFileDescriptor& fence = ::ndk::ScopedFileDescriptor(-1)); + + static void compareColorsToBuffer( + const std::vector& expectedColors, const sp& graphicBuffer, + const ndk::ScopedFileDescriptor& fence = ::ndk::ScopedFileDescriptor(-1)); static const std::vector colorModes; static const std::vector dataspaces; - - static void compareColorBuffers(const std::vector& expectedColors, void* bufferData, - const uint32_t stride, const uint32_t width, - const uint32_t height, PixelFormat pixelFormat); }; class ReadbackBuffer { public: ReadbackBuffer(int64_t display, const std::shared_ptr& client, int32_t width, - int32_t height, common::PixelFormat pixelFormat, common::Dataspace dataspace); + int32_t height, common::PixelFormat pixelFormat); void setReadbackBuffer(); @@ -201,18 +216,12 @@ class ReadbackBuffer { protected: uint32_t mWidth; uint32_t mHeight; + PixelFormat mPixelFormat; uint32_t mLayerCount; uint32_t mUsage; - PixelFormat mPixelFormat; - Dataspace mDataspace; int64_t mDisplay; - ::android::sp<::android::GraphicBuffer> mGraphicBuffer; + sp mGraphicBuffer; std::shared_ptr mComposerClient; - ::android::Rect mAccessRegion; - native_handle_t mBufferHandle; - - private: - ::android::sp<::android::GraphicBuffer> allocateBuffer(); }; } // namespace aidl::android::hardware::graphics::composer3::vts diff --git a/graphics/composer/aidl/vts/RenderEngineVts.cpp b/graphics/composer/aidl/vts/RenderEngineVts.cpp index 66779c8cad..b84d0d0f28 100644 --- a/graphics/composer/aidl/vts/RenderEngineVts.cpp +++ b/graphics/composer/aidl/vts/RenderEngineVts.cpp @@ -76,18 +76,7 @@ void TestRenderEngine::drawLayers() { } void TestRenderEngine::checkColorBuffer(const std::vector& expectedColors) { - void* bufferData; - int32_t bytesPerPixel = -1; - int32_t bytesPerStride = -1; - ASSERT_EQ(0, mGraphicBuffer->lock(static_cast(mGraphicBuffer->getUsage()), - &bufferData, &bytesPerPixel, &bytesPerStride)); - const uint32_t stride = (bytesPerPixel > 0 && bytesPerStride > 0) - ? static_cast(bytesPerStride / bytesPerPixel) - : mGraphicBuffer->getStride(); - ReadbackHelper::compareColorBuffers(expectedColors, bufferData, stride, - mGraphicBuffer->getWidth(), mGraphicBuffer->getHeight(), - mFormat); - ASSERT_EQ(::android::OK, mGraphicBuffer->unlock()); + ReadbackHelper::compareColorsToBuffer(expectedColors, mGraphicBuffer); } } // namespace aidl::android::hardware::graphics::composer3::vts diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp index 6fa33927f0..93d9693dbd 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp @@ -18,7 +18,6 @@ #include #include -#include #include #include #include @@ -81,13 +80,11 @@ class GraphicsCompositionTestBase : public ::testing::Test { clientCompositionDisplay.physicalDisplay = Rect(getDisplayWidth(), getDisplayHeight()); clientCompositionDisplay.clip = clientCompositionDisplay.physicalDisplay; - mTestRenderEngine->initGraphicBuffer( - static_cast(getDisplayWidth()), static_cast(getDisplayHeight()), - /*layerCount*/ 1U, - static_cast( - static_cast(common::BufferUsage::CPU_READ_OFTEN) | - static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | - static_cast(common::BufferUsage::GPU_RENDER_TARGET))); + mTestRenderEngine->initGraphicBuffer(static_cast(getDisplayWidth()), + static_cast(getDisplayHeight()), + /*layerCount*/ 1U, + GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_SW_READ_OFTEN | + GRALLOC_USAGE_SW_WRITE_OFTEN); mTestRenderEngine->setDisplaySettings(clientCompositionDisplay); } @@ -115,18 +112,21 @@ class GraphicsCompositionTestBase : public ::testing::Test { ASSERT_EQ(status.getServiceSpecificError(), serviceSpecificError); } - std::pair> allocateBuffer(uint32_t usage) { - const auto width = static_cast(getDisplayWidth()); - const auto height = static_cast(getDisplayHeight()); - - const auto& graphicBuffer = ::android::sp<::android::GraphicBuffer>::make( - width, height, ::android::PIXEL_FORMAT_RGBA_8888, - /*layerCount*/ 1u, usage, "VtsHalGraphicsComposer3_ReadbackTest"); + sp allocateBuffer(uint32_t width, uint32_t height, uint64_t usage) { + sp graphicBuffer = + sp::make(width, height, ::android::PIXEL_FORMAT_RGBA_8888, + /*layerCount*/ 1u, static_cast(usage), + "VtsHalGraphicsComposer3_ReadbackTest"); if (graphicBuffer && ::android::OK == graphicBuffer->initCheck()) { - return {true, graphicBuffer}; + return graphicBuffer; } - return {false, graphicBuffer}; + return nullptr; + } + + sp allocateBuffer(uint64_t usage) { + return allocateBuffer(static_cast(getDisplayWidth()), + static_cast(getDisplayHeight()), usage); } uint64_t getStableDisplayId(int64_t display) { @@ -293,7 +293,7 @@ TEST_P(GraphicsCompositionTest, SingleSolidColorLayer) { ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), coloredSquare, BLUE); ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat, mDataspace); + getDisplayHeight(), mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); @@ -332,7 +332,7 @@ TEST_P(GraphicsCompositionTest, SetLayerBuffer) { } ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat, mDataspace); + getDisplayHeight(), mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); std::vector expectedColors( static_cast(getDisplayWidth() * getDisplayHeight())); @@ -378,6 +378,143 @@ TEST_P(GraphicsCompositionTest, SetLayerBuffer) { } } +TEST_P(GraphicsCompositionTest, SetLayerBufferWithSlotsToClear) { + const auto& [status, readbackBufferAttributes] = + mComposerClient->getReadbackBufferAttributes(getPrimaryDisplayId()); + if (!status.isOk()) { + GTEST_SUCCEED() << "Readback not supported"; + return; + } + + sp readbackBuffer; + ASSERT_NO_FATAL_FAILURE(ReadbackHelper::createReadbackBuffer( + readbackBufferAttributes, getPrimaryDisplay(), &readbackBuffer)); + if (readbackBuffer == nullptr) { + GTEST_SUCCEED() << "Unsupported readback buffer attributes"; + return; + } + // no fence needed for the readback buffer + ScopedFileDescriptor noFence(-1); + + sp clearSlotBuffer = allocateBuffer(1u, 1u, GRALLOC_USAGE_HW_COMPOSER); + ASSERT_NE(nullptr, clearSlotBuffer); + + // red buffer + uint64_t usage = GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_OFTEN; + sp redBuffer = allocateBuffer(usage); + ASSERT_NE(nullptr, redBuffer); + int redFence; + ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBufferAndGetFence(redBuffer, RED, &redFence)); + + // blue buffer + sp blueBuffer = allocateBuffer(usage); + ASSERT_NE(nullptr, blueBuffer); + int blueFence; + ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBufferAndGetFence(blueBuffer, BLUE, &blueFence)); + + // layer defaults + common::Rect rectFullDisplay = {0, 0, getDisplayWidth(), getDisplayHeight()}; + int64_t display = getPrimaryDisplayId(); + auto [layerStatus, layer] = mComposerClient->createLayer(getPrimaryDisplayId(), 3); + ASSERT_TRUE(layerStatus.isOk()); + mWriter->setLayerDisplayFrame(display, layer, rectFullDisplay); + mWriter->setLayerCompositionType(display, layer, Composition::DEVICE); + + // set the layer to the blue buffer + // should be blue + { + auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); + ASSERT_TRUE(status.isOk()); + mWriter->setLayerBuffer(display, layer, /*slot*/ 0, blueBuffer->handle, blueFence); + mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); + execute(); + ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter->presentDisplay(display); + execute(); + auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); + ASSERT_TRUE(fenceStatus.isOk()); + ReadbackHelper::compareColorToBuffer(BLUE, readbackBuffer, fence); + } + + // change the layer to the red buffer + // should be red + { + auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); + ASSERT_TRUE(status.isOk()); + mWriter->setLayerBuffer(display, layer, /*slot*/ 1, redBuffer->handle, redFence); + mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); + execute(); + ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter->presentDisplay(display); + execute(); + auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); + ASSERT_TRUE(fenceStatus.isOk()); + ReadbackHelper::compareColorToBuffer(RED, readbackBuffer, fence); + } + + // clear the slot for the blue buffer + // should still be red + { + auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); + ASSERT_TRUE(status.isOk()); + mWriter->setLayerBufferWithNewCommand(display, layer, /*slot*/ 0, clearSlotBuffer->handle, + /*fence*/ -1); + mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); + execute(); + ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter->presentDisplay(display); + execute(); + auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); + ASSERT_TRUE(fenceStatus.isOk()); + ReadbackHelper::compareColorToBuffer(RED, readbackBuffer, fence); + } + + // clear the slot for the red buffer, and set the buffer with the same slot to the blue buffer + // should be blue + { + auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); + ASSERT_TRUE(status.isOk()); + mWriter->setLayerBufferWithNewCommand(display, layer, /*slot*/ 1, clearSlotBuffer->handle, + /*fence*/ -1); + mWriter->setLayerBuffer(display, layer, /*slot*/ 1, blueBuffer->handle, blueFence); + mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); + execute(); + ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter->presentDisplay(display); + execute(); + auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); + ASSERT_TRUE(fenceStatus.isOk()); + ReadbackHelper::compareColorToBuffer(BLUE, readbackBuffer, fence); + } + + // clear the slot for the now-blue buffer + // should be black (no buffer) + // TODO(b/262037933) Ensure we never clear the active buffer's slot with the placeholder buffer + // by setting the layer to the color black + { + auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); + ASSERT_TRUE(status.isOk()); + mWriter->setLayerBufferWithNewCommand(display, layer, /*slot*/ 1, clearSlotBuffer->handle, + /*fence*/ -1); + mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); + execute(); + if (!mReader.takeChangedCompositionTypes(display).empty()) { + GTEST_SUCCEED(); + return; + } + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter->presentDisplay(display); + execute(); + auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); + ASSERT_TRUE(fenceStatus.isOk()); + ReadbackHelper::compareColorToBuffer(BLACK, readbackBuffer, fence); + } +} + TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { for (ColorMode mode : mTestColorModes) { EXPECT_TRUE(mComposerClient @@ -399,10 +536,9 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { layer->write(*mWriter); // This following buffer call should have no effect - const auto usage = static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | - static_cast(common::BufferUsage::CPU_READ_OFTEN); - const auto& [graphicBufferStatus, graphicBuffer] = allocateBuffer(usage); - ASSERT_TRUE(graphicBufferStatus); + uint64_t usage = GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_OFTEN; + sp graphicBuffer = allocateBuffer(usage); + ASSERT_NE(nullptr, graphicBuffer); const auto& buffer = graphicBuffer->handle; mWriter->setLayerBuffer(getPrimaryDisplayId(), layer->getLayer(), /*slot*/ 0, buffer, /*acquireFence*/ -1); @@ -413,7 +549,7 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), coloredSquare, BLUE); ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat, mDataspace); + getDisplayHeight(), mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); @@ -441,7 +577,7 @@ TEST_P(GraphicsCompositionTest, SetReadbackBuffer) { } ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat, mDataspace); + getDisplayHeight(), mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); } @@ -454,10 +590,9 @@ TEST_P(GraphicsCompositionTest, SetReadbackBuffer_BadDisplay) { return; } - const auto usage = static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | - static_cast(common::BufferUsage::CPU_READ_OFTEN); - const auto& [graphicBufferStatus, graphicBuffer] = allocateBuffer(usage); - ASSERT_TRUE(graphicBufferStatus); + uint64_t usage = GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_OFTEN; + sp graphicBuffer = allocateBuffer(usage); + ASSERT_NE(nullptr, graphicBuffer); const auto& bufferHandle = graphicBuffer->handle; ::ndk::ScopedFileDescriptor fence = ::ndk::ScopedFileDescriptor(-1); @@ -539,7 +674,7 @@ TEST_P(GraphicsCompositionTest, ClientComposition) { std::vector> layers = {layer}; ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat, mDataspace); + getDisplayHeight(), mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -552,16 +687,14 @@ TEST_P(GraphicsCompositionTest, ClientComposition) { ASSERT_EQ(Composition::CLIENT, changedCompositionTypes[0].composition); PixelFormat clientFormat = PixelFormat::RGBA_8888; - auto clientUsage = static_cast( - static_cast(common::BufferUsage::CPU_READ_OFTEN) | - static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | - static_cast(common::BufferUsage::COMPOSER_CLIENT_TARGET)); + auto clientUsage = GRALLOC_USAGE_HW_FB | GRALLOC_USAGE_SW_READ_OFTEN | + GRALLOC_USAGE_SW_WRITE_OFTEN; Dataspace clientDataspace = ReadbackHelper::getDataspaceForColorMode(mode); common::Rect damage{0, 0, getDisplayWidth(), getDisplayHeight()}; // create client target buffer - const auto& [graphicBufferStatus, graphicBuffer] = allocateBuffer(clientUsage); - ASSERT_TRUE(graphicBufferStatus); + sp graphicBuffer = allocateBuffer(clientUsage); + ASSERT_NE(nullptr, graphicBuffer); const auto& buffer = graphicBuffer->handle; void* clientBufData; const auto stride = static_cast(graphicBuffer->stride); @@ -618,7 +751,7 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { {0, getDisplayHeight() / 2, getDisplayWidth(), getDisplayHeight()}, RED); ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat, mDataspace); + getDisplayHeight(), mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); auto deviceLayer = std::make_shared( @@ -637,10 +770,8 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { deviceLayer->write(*mWriter); PixelFormat clientFormat = PixelFormat::RGBA_8888; - auto clientUsage = static_cast( - static_cast(common::BufferUsage::CPU_READ_OFTEN) | - static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | - static_cast(common::BufferUsage::COMPOSER_CLIENT_TARGET)); + auto clientUsage = + GRALLOC_USAGE_HW_FB | GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN; Dataspace clientDataspace = ReadbackHelper::getDataspaceForColorMode(mode); int32_t clientWidth = getDisplayWidth(); int32_t clientHeight = getDisplayHeight() / 2; @@ -662,8 +793,8 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { } // create client target buffer ASSERT_EQ(Composition::CLIENT, changedCompositionTypes[0].composition); - const auto& [graphicBufferStatus, graphicBuffer] = allocateBuffer(clientUsage); - ASSERT_TRUE(graphicBufferStatus); + sp graphicBuffer = allocateBuffer(clientUsage); + ASSERT_NE(nullptr, graphicBuffer); const auto& buffer = graphicBuffer->handle; void* clientBufData; @@ -725,7 +856,7 @@ TEST_P(GraphicsCompositionTest, SetLayerDamage) { std::vector> layers = {layer}; ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat, mDataspace); + getDisplayHeight(), mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); @@ -793,7 +924,7 @@ TEST_P(GraphicsCompositionTest, SetLayerPlaneAlpha) { std::vector> layers = {layer}; ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat, mDataspace); + getDisplayHeight(), mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); @@ -859,7 +990,7 @@ TEST_P(GraphicsCompositionTest, SetLayerSourceCrop) { ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), {0, 0, getDisplayWidth(), getDisplayHeight()}, BLUE); ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat, mDataspace); + getDisplayHeight(), mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -916,7 +1047,7 @@ TEST_P(GraphicsCompositionTest, SetLayerZOrder) { ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), redRect, RED); ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat, mDataspace); + getDisplayHeight(), mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); @@ -1026,7 +1157,7 @@ TEST_P(GraphicsCompositionTest, SetLayerBrightnessDims) { ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), dimmerRedRect, DIM_RED); ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat, mDataspace); + getDisplayHeight(), mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); @@ -1162,7 +1293,7 @@ TEST_P(GraphicsBlendModeCompositionTest, None) { setExpectedColors(expectedColors); ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat, mDataspace); + getDisplayHeight(), mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(mLayers); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -1207,7 +1338,7 @@ TEST_P(GraphicsBlendModeCompositionTest, Coverage) { setExpectedColors(expectedColors); ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat, mDataspace); + getDisplayHeight(), mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(mLayers); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -1247,7 +1378,7 @@ TEST_P(GraphicsBlendModeCompositionTest, Premultiplied) { setExpectedColors(expectedColors); ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat, mDataspace); + getDisplayHeight(), mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(mLayers); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -1321,7 +1452,7 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_H) { return; } ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat, mDataspace); + getDisplayHeight(), mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); mLayer->setTransform(Transform::FLIP_H); mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), *mWriter); @@ -1366,7 +1497,7 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_V) { return; } ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat, mDataspace); + getDisplayHeight(), mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); mLayer->setTransform(Transform::FLIP_V); @@ -1411,7 +1542,7 @@ TEST_P(GraphicsTransformCompositionTest, ROT_180) { return; } ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat, mDataspace); + getDisplayHeight(), mPixelFormat); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); mLayer->setTransform(Transform::ROT_180); From de1909e86558ed87b02c5c20b4c2d832e09c1d42 Mon Sep 17 00:00:00 2001 From: Jayant Chowdhary Date: Wed, 23 Nov 2022 17:18:38 +0000 Subject: [PATCH 473/998] Camera: Add metadata support for cropped RAW streams. Bug: 247524520 Test: Camera CTS Test: Camera VTS Change-Id: Ie50359aca3fbbd6088e2e1525cca85c7d5eb0ad0 Signed-off-by: Jayant Chowdhary --- .../camera/metadata/CameraMetadataTag.aidl | 1 + .../ScalerAvailableStreamUseCases.aidl | 1 + .../camera/metadata/CameraMetadataTag.aidl | 7 + .../ScalerAvailableStreamUseCases.aidl | 1 + .../VtsAidlHalCameraProvider_TargetTest.cpp | 113 ++------------- camera/provider/aidl/vts/camera_aidl_test.cpp | 134 +++++++++++++++++- camera/provider/aidl/vts/camera_aidl_test.h | 3 + 7 files changed, 155 insertions(+), 105 deletions(-) diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl index ecbfc9371f..8c98e38fc5 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl @@ -204,6 +204,7 @@ enum CameraMetadataTag { ANDROID_SCALER_AVAILABLE_INPUT_OUTPUT_FORMATS_MAP_MAXIMUM_RESOLUTION = 851991, ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED = 851992, ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES = 851994, + ANDROID_SCALER_RAW_CROP_REGION = 851995, ANDROID_SENSOR_EXPOSURE_TIME = 917504, ANDROID_SENSOR_FRAME_DURATION = 917505, ANDROID_SENSOR_SENSITIVITY = 917506, diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl index bfa4f1ae8b..958fa122b0 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl @@ -44,5 +44,6 @@ enum ScalerAvailableStreamUseCases { ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_RECORD = 3, ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW_VIDEO_STILL = 4, ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_CALL = 5, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW = 6, ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VENDOR_START = 65536, } diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl index 2e9bde95a3..172dc1fae8 100644 --- a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl +++ b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl @@ -1283,6 +1283,13 @@ enum CameraMetadataTag { *

The stream use cases supported by this camera device.

*/ ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES = 851994, + /** + * android.scaler.rawCropRegion [dynamic, int32[], public] + * + *

The region of the sensor that corresponds to the RAW read out for this + * capture when the stream use case of a RAW stream is set to CROPPED_RAW.

+ */ + ANDROID_SCALER_RAW_CROP_REGION, /** * android.sensor.exposureTime [dynamic, int64, public] * diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl index daa0fd3028..da27a48e32 100644 --- a/camera/metadata/aidl/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl +++ b/camera/metadata/aidl/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl @@ -35,5 +35,6 @@ enum ScalerAvailableStreamUseCases { ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_RECORD = 0x3L, ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW_VIDEO_STILL = 0x4L, ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_CALL = 0x5L, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW = 0x6L, ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VENDOR_START = 0x10000L, } diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp index 747ea336e2..4d4bb26800 100644 --- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp +++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp @@ -3035,115 +3035,22 @@ TEST_P(CameraAidlTest, configureInjectionStreamsWithSessionParameters) { } } +TEST_P(CameraAidlTest, configureStreamsUseCasesCroppedRaw) { + AvailableStream rawStreamThreshold = + {INT_MAX, INT_MAX, static_cast(PixelFormat::RAW16)}; + configureStreamUseCaseInternal(rawStreamThreshold); +} + // Verify that valid stream use cases can be configured successfully, and invalid use cases // fail stream configuration. TEST_P(CameraAidlTest, configureStreamsUseCases) { - std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); - - for (const auto& name : cameraDeviceNames) { - CameraMetadata meta; - std::shared_ptr cameraDevice; - - openEmptyDeviceSession(name, mProvider, &mSession /*out*/, &meta /*out*/, - &cameraDevice /*out*/); - - camera_metadata_t* staticMeta = reinterpret_cast(meta.metadata.data()); - // Check if camera support depth only - if (isDepthOnly(staticMeta)) { - ndk::ScopedAStatus ret = mSession->close(); - mSession = nullptr; - ASSERT_TRUE(ret.isOk()); - continue; - } - - std::vector outputPreviewStreams; - AvailableStream previewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight, - static_cast(PixelFormat::YCBCR_420_888)}; - ASSERT_EQ(Status::OK, - getAvailableOutputStreams(staticMeta, outputPreviewStreams, &previewThreshold)); - ASSERT_NE(0u, outputPreviewStreams.size()); - - // Combine valid and invalid stream use cases - std::vector useCases(kMandatoryUseCases); - useCases.push_back(ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_CALL + 1); - - std::vector supportedUseCases; - camera_metadata_ro_entry entry; - auto retcode = find_camera_metadata_ro_entry( - staticMeta, ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES, &entry); - if ((0 == retcode) && (entry.count > 0)) { - supportedUseCases.insert(supportedUseCases.end(), entry.data.i64, - entry.data.i64 + entry.count); - } else { - supportedUseCases.push_back(ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT); - } - - std::vector streams(1); - streams[0] = {0, - StreamType::OUTPUT, - outputPreviewStreams[0].width, - outputPreviewStreams[0].height, - static_cast(outputPreviewStreams[0].format), - static_cast<::aidl::android::hardware::graphics::common::BufferUsage>( - GRALLOC1_CONSUMER_USAGE_CPU_READ), - Dataspace::UNKNOWN, - StreamRotation::ROTATION_0, - std::string(), - 0, - -1, - {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, - RequestAvailableDynamicRangeProfilesMap:: - ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; - - int32_t streamConfigCounter = 0; - CameraMetadata req; - StreamConfiguration config; - RequestTemplate reqTemplate = RequestTemplate::STILL_CAPTURE; - ndk::ScopedAStatus ret = mSession->constructDefaultRequestSettings(reqTemplate, &req); - ASSERT_TRUE(ret.isOk()); - config.sessionParams = req; - - for (int64_t useCase : useCases) { - bool useCaseSupported = std::find(supportedUseCases.begin(), supportedUseCases.end(), - useCase) != supportedUseCases.end(); - - streams[0].useCase = static_cast< - aidl::android::hardware::camera::metadata::ScalerAvailableStreamUseCases>( - useCase); - config.streams = streams; - config.operationMode = StreamConfigurationMode::NORMAL_MODE; - config.streamConfigCounter = streamConfigCounter; - config.multiResolutionInputImage = false; - - bool combSupported; - ret = cameraDevice->isStreamCombinationSupported(config, &combSupported); - if (static_cast(Status::OPERATION_NOT_SUPPORTED) == - ret.getServiceSpecificError()) { - continue; - } - - ASSERT_TRUE(ret.isOk()); - ASSERT_EQ(combSupported, useCaseSupported); - - std::vector halStreams; - ret = mSession->configureStreams(config, &halStreams); - ALOGI("configureStreams returns status: %d", ret.getServiceSpecificError()); - if (useCaseSupported) { - ASSERT_TRUE(ret.isOk()); - ASSERT_EQ(1u, halStreams.size()); - } else { - ASSERT_EQ(static_cast(Status::ILLEGAL_ARGUMENT), - ret.getServiceSpecificError()); - } - } - ret = mSession->close(); - mSession = nullptr; - ASSERT_TRUE(ret.isOk()); - } + AvailableStream previewStreamThreshold = + {kMaxPreviewWidth, kMaxPreviewHeight, static_cast(PixelFormat::YCBCR_420_888)}; + configureStreamUseCaseInternal(previewStreamThreshold); } GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(CameraAidlTest); INSTANTIATE_TEST_SUITE_P( PerInstance, CameraAidlTest, testing::ValuesIn(android::getAidlHalInstanceNames(ICameraProvider::descriptor)), - android::hardware::PrintInstanceNameToString); \ No newline at end of file + android::hardware::PrintInstanceNameToString); diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp index b9e30ab891..974223d029 100644 --- a/camera/provider/aidl/vts/camera_aidl_test.cpp +++ b/camera/provider/aidl/vts/camera_aidl_test.cpp @@ -321,8 +321,8 @@ void CameraAidlTest::verifyStreamUseCaseCharacteristics(const camera_metadata_t* if (entry.data.i64[i] == ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT) { supportDefaultUseCase = true; } - ASSERT_TRUE(entry.data.i64[i] <= ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_CALL || - entry.data.i64[i] >= + ASSERT_TRUE(entry.data.i64[i] <= ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW + || entry.data.i64[i] >= ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VENDOR_START); } ASSERT_TRUE(supportDefaultUseCase); @@ -2164,6 +2164,121 @@ void CameraAidlTest::processCaptureRequestInternal(uint64_t bufferUsage, } } +void CameraAidlTest::configureStreamUseCaseInternal(const AvailableStream &threshold) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + + for (const auto& name : cameraDeviceNames) { + CameraMetadata meta; + std::shared_ptr cameraDevice; + + openEmptyDeviceSession(name, mProvider, &mSession /*out*/, &meta /*out*/, + &cameraDevice /*out*/); + + camera_metadata_t* staticMeta = reinterpret_cast(meta.metadata.data()); + // Check if camera support depth only + if (isDepthOnly(staticMeta) || + (threshold.format == static_cast(PixelFormat::RAW16) && + !supportsCroppedRawUseCase(staticMeta))) { + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + continue; + } + + std::vector outputPreviewStreams; + + ASSERT_EQ(Status::OK, + getAvailableOutputStreams(staticMeta, outputPreviewStreams, &threshold)); + ASSERT_NE(0u, outputPreviewStreams.size()); + + // Combine valid and invalid stream use cases + std::vector useCases(kMandatoryUseCases); + useCases.push_back(ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW + 1); + + std::vector supportedUseCases; + if (threshold.format == static_cast(PixelFormat::RAW16)) { + // If the format is RAW16, supported use case is only CROPPED_RAW. + // All others are unsupported for this format. + useCases.push_back(ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW); + supportedUseCases.push_back(ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW); + supportedUseCases.push_back(ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT); + } else { + camera_metadata_ro_entry entry; + auto retcode = find_camera_metadata_ro_entry( + staticMeta, ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES, &entry); + if ((0 == retcode) && (entry.count > 0)) { + supportedUseCases.insert(supportedUseCases.end(), entry.data.i64, + entry.data.i64 + entry.count); + } else { + supportedUseCases.push_back(ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT); + } + } + + std::vector streams(1); + streams[0] = {0, + StreamType::OUTPUT, + outputPreviewStreams[0].width, + outputPreviewStreams[0].height, + static_cast(outputPreviewStreams[0].format), + static_cast<::aidl::android::hardware::graphics::common::BufferUsage>( + GRALLOC1_CONSUMER_USAGE_CPU_READ), + Dataspace::UNKNOWN, + StreamRotation::ROTATION_0, + std::string(), + 0, + -1, + {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT}, + RequestAvailableDynamicRangeProfilesMap:: + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD}; + + int32_t streamConfigCounter = 0; + CameraMetadata req; + StreamConfiguration config; + RequestTemplate reqTemplate = RequestTemplate::STILL_CAPTURE; + ndk::ScopedAStatus ret = mSession->constructDefaultRequestSettings(reqTemplate, &req); + ASSERT_TRUE(ret.isOk()); + config.sessionParams = req; + + for (int64_t useCase : useCases) { + bool useCaseSupported = std::find(supportedUseCases.begin(), supportedUseCases.end(), + useCase) != supportedUseCases.end(); + + streams[0].useCase = static_cast< + aidl::android::hardware::camera::metadata::ScalerAvailableStreamUseCases>( + useCase); + config.streams = streams; + config.operationMode = StreamConfigurationMode::NORMAL_MODE; + config.streamConfigCounter = streamConfigCounter; + config.multiResolutionInputImage = false; + + bool combSupported; + ret = cameraDevice->isStreamCombinationSupported(config, &combSupported); + if (static_cast(Status::OPERATION_NOT_SUPPORTED) == + ret.getServiceSpecificError()) { + continue; + } + + ASSERT_TRUE(ret.isOk()); + ASSERT_EQ(combSupported, useCaseSupported); + + std::vector halStreams; + ret = mSession->configureStreams(config, &halStreams); + ALOGI("configureStreams returns status: %d", ret.getServiceSpecificError()); + if (useCaseSupported) { + ASSERT_TRUE(ret.isOk()); + ASSERT_EQ(1u, halStreams.size()); + } else { + ASSERT_EQ(static_cast(Status::ILLEGAL_ARGUMENT), + ret.getServiceSpecificError()); + } + } + ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); + } + +} + void CameraAidlTest::configureSingleStream( const std::string& name, const std::shared_ptr& provider, const AvailableStream* previewThreshold, uint64_t bufferUsage, RequestTemplate reqTemplate, @@ -3039,6 +3154,21 @@ bool CameraAidlTest::supportZoomSettingsOverride(const camera_metadata_t* static return false; } +bool CameraAidlTest::supportsCroppedRawUseCase(const camera_metadata_t *staticMeta) { + camera_metadata_ro_entry availableStreamUseCasesEntry; + int rc = find_camera_metadata_ro_entry(staticMeta, ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES, + &availableStreamUseCasesEntry); + if (rc == 0) { + for (size_t i = 0; i < availableStreamUseCasesEntry.count; i++) { + if (availableStreamUseCasesEntry.data.i64[i] == + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW) { + return true; + } + } + } + return false; +} + bool CameraAidlTest::isPerFrameControl(const camera_metadata_t* staticMeta) { camera_metadata_ro_entry syncLatencyEntry; int rc = find_camera_metadata_ro_entry(staticMeta, ANDROID_SYNC_MAX_LATENCY, diff --git a/camera/provider/aidl/vts/camera_aidl_test.h b/camera/provider/aidl/vts/camera_aidl_test.h index b6e398b435..8b8a4bca46 100644 --- a/camera/provider/aidl/vts/camera_aidl_test.h +++ b/camera/provider/aidl/vts/camera_aidl_test.h @@ -223,6 +223,8 @@ class CameraAidlTest : public ::testing::TestWithParam { int32_t* partialResultCount /*out*/, bool* useHalBufManager /*out*/, std::shared_ptr* cb /*out*/, uint32_t streamConfigCounter = 0); + void configureStreamUseCaseInternal(const AvailableStream &threshold); + void configureSingleStream( const std::string& name, const std::shared_ptr& provider, const AvailableStream* previewThreshold, uint64_t bufferUsage, @@ -410,6 +412,7 @@ class CameraAidlTest : public ::testing::TestWithParam { int32_t frameCount, const bool *overrideSequence, const bool *expectedResults); bool supportZoomSettingsOverride(const camera_metadata_t* staticMeta); + bool supportsCroppedRawUseCase(const camera_metadata_t *staticMeta); bool isPerFrameControl(const camera_metadata_t* staticMeta); protected: From 6d02d408aabb990dc7f26e4da6c8cec5c71d7b76 Mon Sep 17 00:00:00 2001 From: Kai Shi Date: Thu, 17 Nov 2022 16:34:05 -0800 Subject: [PATCH 474/998] Add setDtimMultiplier() and its implementation. Bug: 259554744 Test: compile Change-Id: Ifda9d857e7dff83c8163503e62081e39952c53d7 --- .../android/hardware/wifi/IWifiStaIface.aidl | 1 + .../android/hardware/wifi/IWifiStaIface.aidl | 16 ++++++++++++++++ wifi/aidl/default/wifi_sta_iface.cpp | 10 ++++++++++ wifi/aidl/default/wifi_sta_iface.h | 2 ++ 4 files changed, 29 insertions(+) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl index 2f0dfa18fa..ac5b93b313 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl @@ -61,6 +61,7 @@ interface IWifiStaIface { void stopBackgroundScan(in int cmdId); void stopRssiMonitoring(in int cmdId); void stopSendingKeepAlivePackets(in int cmdId); + void setDtimMultiplier(in int multiplier); @Backing(type="int") @VintfStability enum StaIfaceCapabilityMask { APF = 1, diff --git a/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl b/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl index 2dd57b235c..e6218e68b7 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl @@ -552,4 +552,20 @@ interface IWifiStaIface { * |WifiStatusCode.ERROR_UNKNOWN| */ void stopSendingKeepAlivePackets(in int cmdId); + + /** + * Set DTIM multiplier used when the system is in the suspended mode. + * When STA is in the power saving mode and system is suspended, + * the wake up interval will be set to: + * 1) multiplier * DTIM period if multiplier > 0. + * 2) the driver default value if multiplier <= 0. + * Some implementations may apply an additional cap to wake up interval in the case of 1). + * + * @param multiplier integer DTIM multiplier value to set. + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, + * |WifiStatusCode.ERROR_NOT_SUPPORTED|, + * |WifiStatusCode.ERROR_UNKNOWN| + */ + void setDtimMultiplier(in int multiplier); } diff --git a/wifi/aidl/default/wifi_sta_iface.cpp b/wifi/aidl/default/wifi_sta_iface.cpp index ce90349bc5..57384bf4dd 100644 --- a/wifi/aidl/default/wifi_sta_iface.cpp +++ b/wifi/aidl/default/wifi_sta_iface.cpp @@ -222,6 +222,11 @@ ndk::ScopedAStatus WifiStaIface::setScanMode(bool in_enable) { &WifiStaIface::setScanModeInternal, in_enable); } +ndk::ScopedAStatus WifiStaIface::setDtimMultiplier(int32_t in_multiplier) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiStaIface::setDtimMultiplierInternal, in_multiplier); +} + std::pair WifiStaIface::getNameInternal() { return {ifname_, ndk::ScopedAStatus::ok()}; } @@ -552,6 +557,11 @@ ndk::ScopedAStatus WifiStaIface::setScanModeInternal(bool enable) { return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); } +ndk::ScopedAStatus WifiStaIface::setDtimMultiplierInternal(const int multiplier) { + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->setDtimConfig(ifname_, multiplier); + return createWifiStatusFromLegacyError(legacy_status); +} + } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/aidl/default/wifi_sta_iface.h b/wifi/aidl/default/wifi_sta_iface.h index 8ac3470edb..2e4403ad7e 100644 --- a/wifi/aidl/default/wifi_sta_iface.h +++ b/wifi/aidl/default/wifi_sta_iface.h @@ -92,6 +92,7 @@ class WifiStaIface : public BnWifiStaIface { ndk::ScopedAStatus setMacAddress(const std::array& in_mac) override; ndk::ScopedAStatus getFactoryMacAddress(std::array* _aidl_return) override; ndk::ScopedAStatus setScanMode(bool in_enable) override; + ndk::ScopedAStatus setDtimMultiplier(int32_t in_multiplier) override; private: // Corresponding worker functions for the AIDL methods. @@ -133,6 +134,7 @@ class WifiStaIface : public BnWifiStaIface { ndk::ScopedAStatus setMacAddressInternal(const std::array& mac); std::pair, ndk::ScopedAStatus> getFactoryMacAddressInternal(); ndk::ScopedAStatus setScanModeInternal(bool enable); + ndk::ScopedAStatus setDtimMultiplierInternal(const int multiplier); void setWeakPtr(std::weak_ptr ptr); From 55651432bebfcc0376b3480d0c38eefe0307682d Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Sat, 10 Dec 2022 23:04:25 +0000 Subject: [PATCH 475/998] wifi: Send channel change event to framework Added a new StaIfaceCallback method to indicate that the operating frequency of the BSS is changed due to channel switch announcement from the AP. Bug: 195617184 Test: Manually triggered channel switch through peer AP hostapd command and verified the new frequency in STA logs. Change-Id: I9dd59d7c5d4ddc5f3443f8b6786cfea9beec4f3c --- .../wifi/supplicant/ISupplicantStaIfaceCallback.aidl | 1 + .../wifi/supplicant/ISupplicantStaIfaceCallback.aidl | 9 +++++++++ .../vts/functional/supplicant_sta_iface_aidl_test.cpp | 3 +++ 3 files changed, 13 insertions(+) diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl index 45563b3aa2..0a2d428ae4 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl @@ -70,6 +70,7 @@ interface ISupplicantStaIfaceCallback { oneway void onMloLinksInfoChanged(in android.hardware.wifi.supplicant.ISupplicantStaIfaceCallback.MloLinkInfoChangeReason reason); oneway void onDppConfigReceived(in android.hardware.wifi.supplicant.DppConfigurationData configData); oneway void onDppConnectionStatusResultSent(in android.hardware.wifi.supplicant.DppStatusErrorCode code); + oneway void onBssFrequencyChanged(in int frequencyMhz); @Backing(type="int") @VintfStability enum MloLinkInfoChangeReason { TID_TO_LINK_MAP = 0, diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl index 29bb0f9aab..7d46649033 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl @@ -384,4 +384,13 @@ oneway interface ISupplicantStaIfaceCallback { * Indicates that DPP connection status result frame is sent. */ void onDppConnectionStatusResultSent(in DppStatusErrorCode code); + + /** + * Used to indicate that the operating frequency has changed for this BSS. + * This event is triggered when STA switches the channel due to channel + * switch announcement from the connected access point. + * + * @param frequencyMhz New operating frequency in MHz. + */ + void onBssFrequencyChanged(in int frequencyMhz); } diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp index cb2881b469..e957834eab 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp +++ b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp @@ -227,6 +227,9 @@ class SupplicantStaIfaceCallback : public BnSupplicantStaIfaceCallback { ::aidl::android::hardware::wifi::supplicant::DppStatusErrorCode /* code */) override { return ndk::ScopedAStatus::ok(); } + ::ndk::ScopedAStatus onBssFrequencyChanged(int32_t /* frequencyMhz */) override { + return ndk::ScopedAStatus::ok(); + } }; class SupplicantStaIfaceAidlTest : public testing::TestWithParam { From 766953f20d340572af6b0e0c802f02026f10e2c1 Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Thu, 6 Oct 2022 12:10:11 -0700 Subject: [PATCH 476/998] wifi: Add AIDL support for getWifiChipCapabilities() Define a new AIDL API to get capabilities from the vendor chip. Bug: 231497844 Test: m android.hardware.wifi-update-api Change-Id: I3c1cfce4df2101125a628f230b938b3be0f80311 --- .../android/hardware/wifi/IWifiChip.aidl | 1 + .../hardware/wifi/WifiChipCapabilities.aidl | 38 +++++++++++++++++++ .../aidl/android/hardware/wifi/IWifiChip.aidl | 13 +++++++ .../hardware/wifi/WifiChipCapabilities.aidl | 32 ++++++++++++++++ 4 files changed, 84 insertions(+) create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChipCapabilities.aidl create mode 100644 wifi/aidl/android/hardware/wifi/WifiChipCapabilities.aidl diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl index 647891f7cb..f800e8f6aa 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl @@ -59,6 +59,7 @@ interface IWifiChip { @PropagateAllowBlocking android.hardware.wifi.IWifiStaIface getStaIface(in String ifname); String[] getStaIfaceNames(); android.hardware.wifi.WifiRadioCombinationMatrix getSupportedRadioCombinationsMatrix(); + android.hardware.wifi.WifiChipCapabilities getWifiChipCapabilities(); android.hardware.wifi.WifiUsableChannel[] getUsableChannels(in android.hardware.wifi.WifiBand band, in android.hardware.wifi.WifiIfaceMode ifaceModeMask, in android.hardware.wifi.IWifiChip.UsableChannelFilter filterMask); void registerEventCallback(in android.hardware.wifi.IWifiChipEventCallback callback); void removeApIface(in String ifname); diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChipCapabilities.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChipCapabilities.aidl new file mode 100644 index 0000000000..ab26fb55f5 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChipCapabilities.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable WifiChipCapabilities { + int maxMloLinkCount; +} diff --git a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl index fe9a6f399b..64692aff36 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl @@ -25,6 +25,7 @@ import android.hardware.wifi.IWifiStaIface; import android.hardware.wifi.IfaceConcurrencyType; import android.hardware.wifi.IfaceType; import android.hardware.wifi.WifiBand; +import android.hardware.wifi.WifiChipCapabilities; import android.hardware.wifi.WifiDebugHostWakeReasonStats; import android.hardware.wifi.WifiDebugRingBufferStatus; import android.hardware.wifi.WifiDebugRingBufferVerboseLevel; @@ -784,6 +785,18 @@ interface IWifiChip { */ WifiRadioCombinationMatrix getSupportedRadioCombinationsMatrix(); + /** + * Get capabilities supported by this chip. + * + * @return Chip capabilities represented by |WifiChipCapabilities|. + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|, + * |WifiStatusCode.ERROR_NOT_SUPPORTED|, + * |WifiStatusCode.FAILURE_UNKNOWN| + * + */ + WifiChipCapabilities getWifiChipCapabilities(); + /** * Retrieve a list of usable Wifi channels for the specified band & * operational modes. diff --git a/wifi/aidl/android/hardware/wifi/WifiChipCapabilities.aidl b/wifi/aidl/android/hardware/wifi/WifiChipCapabilities.aidl new file mode 100644 index 0000000000..1d268255ae --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/WifiChipCapabilities.aidl @@ -0,0 +1,32 @@ +/* + * 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. + */ + +package android.hardware.wifi; + +/** + * WifiChipCapabilities captures various Wifi chip capability params. + */ +@VintfStability +parcelable WifiChipCapabilities { + /** + * Maximum number of links used in Multi-Link Operation. The maximum + * number of links used for MLO can be different from the number of + * radios supported by the chip. + * + * This is a static configuration of the chip. + */ + int maxMloLinkCount; +} From c84d3770eb57f81a91379ed4a42233e6edd2f4b5 Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Fri, 2 Dec 2022 16:53:28 -0800 Subject: [PATCH 477/998] wifi: Add getWifiChipCapabilities() in shim layer Bug: 231497844 Test: hardware/interfaces/wifi/aidl/default/tests/runtests.sh Change-Id: Iba4f749999e9a2aa25455e09440a961188f049f9 --- wifi/aidl/default/aidl_struct_util.cpp | 7 ++++++ wifi/aidl/default/aidl_struct_util.h | 3 +++ wifi/aidl/default/wifi_chip.cpp | 25 +++++++++++++++++++++ wifi/aidl/default/wifi_chip.h | 2 ++ wifi/aidl/default/wifi_legacy_hal.cpp | 7 ++++++ wifi/aidl/default/wifi_legacy_hal.h | 2 ++ wifi/aidl/default/wifi_legacy_hal_stubs.cpp | 1 + 7 files changed, 47 insertions(+) diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index 07612b65c5..1ed2e17657 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -2768,6 +2768,13 @@ bool convertLegacyRadioCombinationsMatrixToAidl( return true; } +bool convertLegacyWifiChipCapabilitiesToAidl( + const legacy_hal::wifi_chip_capabilities& legacy_chip_capabilities, + WifiChipCapabilities& aidl_chip_capabilities) { + aidl_chip_capabilities.maxMloLinkCount = legacy_chip_capabilities.max_mlo_link_count; + return true; +} + } // namespace aidl_struct_util } // namespace wifi } // namespace hardware diff --git a/wifi/aidl/default/aidl_struct_util.h b/wifi/aidl/default/aidl_struct_util.h index 4ebfc10787..d8e1fd48aa 100644 --- a/wifi/aidl/default/aidl_struct_util.h +++ b/wifi/aidl/default/aidl_struct_util.h @@ -171,6 +171,9 @@ bool convertLegacyPeerInfoStatsToAidl(const legacy_hal::WifiPeerInfo& legacy_pee StaPeerInfo* aidl_peer_info_stats); bool convertLegacyWifiRateInfoToAidl(const legacy_hal::wifi_rate& legacy_rate, WifiRateInfo* aidl_rate); +bool convertLegacyWifiChipCapabilitiesToAidl( + const legacy_hal::wifi_chip_capabilities& legacy_chip_capabilities, + WifiChipCapabilities& aidl_chip_capabilities); } // namespace aidl_struct_util } // namespace wifi } // namespace hardware diff --git a/wifi/aidl/default/wifi_chip.cpp b/wifi/aidl/default/wifi_chip.cpp index 076f351448..406169912f 100644 --- a/wifi/aidl/default/wifi_chip.cpp +++ b/wifi/aidl/default/wifi_chip.cpp @@ -680,6 +680,11 @@ ndk::ScopedAStatus WifiChip::getSupportedRadioCombinationsMatrix( &WifiChip::getSupportedRadioCombinationsMatrixInternal, _aidl_return); } +ndk::ScopedAStatus WifiChip::getWifiChipCapabilities(WifiChipCapabilities* _aidl_return) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::getWifiChipCapabilitiesInternal, _aidl_return); +} + void WifiChip::invalidateAndRemoveAllIfaces() { invalidateAndClearBridgedApAll(); invalidateAndClearAll(ap_ifaces_); @@ -1403,6 +1408,26 @@ WifiChip::getSupportedRadioCombinationsMatrixInternal() { return {aidl_matrix, ndk::ScopedAStatus::ok()}; } +std::pair WifiChip::getWifiChipCapabilitiesInternal() { + legacy_hal::wifi_error legacy_status; + legacy_hal::wifi_chip_capabilities legacy_chip_capabilities; + std::tie(legacy_status, legacy_chip_capabilities) = + legacy_hal_.lock()->getWifiChipCapabilities(); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to get chip capabilities from legacy HAL: " + << legacyErrorToString(legacy_status); + return {WifiChipCapabilities(), createWifiStatusFromLegacyError(legacy_status)}; + } + WifiChipCapabilities aidl_chip_capabilities; + if (!aidl_struct_util::convertLegacyWifiChipCapabilitiesToAidl(legacy_chip_capabilities, + aidl_chip_capabilities)) { + LOG(ERROR) << "Failed convertLegacyWifiChipCapabilitiesToAidl() "; + return {WifiChipCapabilities(), createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)}; + } + + return {aidl_chip_capabilities, ndk::ScopedAStatus::ok()}; +} + ndk::ScopedAStatus WifiChip::triggerSubsystemRestartInternal() { auto legacy_status = legacy_hal_.lock()->triggerSubsystemRestart(); return createWifiStatusFromLegacyError(legacy_status); diff --git a/wifi/aidl/default/wifi_chip.h b/wifi/aidl/default/wifi_chip.h index 59eaa4a58c..7b04e851f8 100644 --- a/wifi/aidl/default/wifi_chip.h +++ b/wifi/aidl/default/wifi_chip.h @@ -144,6 +144,7 @@ class WifiChip : public BnWifiChip { ndk::ScopedAStatus triggerSubsystemRestart() override; ndk::ScopedAStatus getSupportedRadioCombinationsMatrix( WifiRadioCombinationMatrix* _aidl_return) override; + ndk::ScopedAStatus getWifiChipCapabilities(WifiChipCapabilities* _aidl_return) override; binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; private: @@ -250,6 +251,7 @@ class WifiChip : public BnWifiChip { ndk::ScopedAStatus triggerSubsystemRestartInternal(); std::pair getSupportedRadioCombinationsMatrixInternal(); + std::pair getWifiChipCapabilitiesInternal(); void setWeakPtr(std::weak_ptr ptr); int32_t chip_id_; diff --git a/wifi/aidl/default/wifi_legacy_hal.cpp b/wifi/aidl/default/wifi_legacy_hal.cpp index 43e73cae9f..e4883d19f3 100644 --- a/wifi/aidl/default/wifi_legacy_hal.cpp +++ b/wifi/aidl/default/wifi_legacy_hal.cpp @@ -1609,6 +1609,13 @@ wifi_error WifiLegacyHal::getWifiCachedScanResults( return status; } +std::pair WifiLegacyHal::getWifiChipCapabilities() { + wifi_chip_capabilities chip_capabilities; + wifi_error status = + global_func_table_.wifi_get_chip_capabilities(global_handle_, &chip_capabilities); + return {status, chip_capabilities}; +} + void WifiLegacyHal::invalidate() { global_handle_ = nullptr; iface_name_to_handle_.clear(); diff --git a/wifi/aidl/default/wifi_legacy_hal.h b/wifi/aidl/default/wifi_legacy_hal.h index cd8c0b1136..33ed359baa 100644 --- a/wifi/aidl/default/wifi_legacy_hal.h +++ b/wifi/aidl/default/wifi_legacy_hal.h @@ -232,6 +232,7 @@ using ::WIFI_CHAN_WIDTH_INVALID; using ::wifi_channel_info; using ::wifi_channel_stat; using ::wifi_channel_width; +using ::wifi_chip_capabilities; using ::wifi_coex_restriction; using ::wifi_coex_unsafe_channel; using ::WIFI_DUAL_STA_NON_TRANSIENT_UNBIASED; @@ -693,6 +694,7 @@ class WifiLegacyHal { wifi_error enableWifiTxPowerLimits(const std::string& iface_name, bool enable); wifi_error getWifiCachedScanResults(const std::string& iface_name, const CachedScanResultsCallbackHandlers& handler); + std::pair getWifiChipCapabilities(); private: // Retrieve interface handles for all the available interfaces. diff --git a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp index cff7f6977b..777789442d 100644 --- a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp +++ b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp @@ -167,6 +167,7 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { populateStubFor(&hal_fn->wifi_chre_register_handler); populateStubFor(&hal_fn->wifi_enable_tx_power_limits); populateStubFor(&hal_fn->wifi_get_cached_scan_results); + populateStubFor(&hal_fn->wifi_get_chip_capabilities); return true; } From dbd11bdd4123b84382a0c6efdc721772a4c954a9 Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Mon, 12 Dec 2022 03:53:11 +0000 Subject: [PATCH 478/998] wifi: AIDL support to get concurrent TDLS session count Added a new field in chip capabilities to get the maximum number of concurrent TDLS sessions supported by the chip Bug: 240247868 Test: Manual - STA connect/disconnect Test: m android.hardware.wifi-update-api Change-Id: Ie2a4129241f40fc9eba28105b8ea3c06b27a8492 --- .../current/android/hardware/wifi/WifiChipCapabilities.aidl | 1 + wifi/aidl/android/hardware/wifi/WifiChipCapabilities.aidl | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChipCapabilities.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChipCapabilities.aidl index ab26fb55f5..48dc8e0805 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChipCapabilities.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChipCapabilities.aidl @@ -35,4 +35,5 @@ package android.hardware.wifi; @VintfStability parcelable WifiChipCapabilities { int maxMloLinkCount; + int maxConcurrentTdlsSessionCount; } diff --git a/wifi/aidl/android/hardware/wifi/WifiChipCapabilities.aidl b/wifi/aidl/android/hardware/wifi/WifiChipCapabilities.aidl index 1d268255ae..f65d49ac28 100644 --- a/wifi/aidl/android/hardware/wifi/WifiChipCapabilities.aidl +++ b/wifi/aidl/android/hardware/wifi/WifiChipCapabilities.aidl @@ -29,4 +29,9 @@ parcelable WifiChipCapabilities { * This is a static configuration of the chip. */ int maxMloLinkCount; + /** + * Maximum number of concurrent TDLS sessions that can be enabled + * by framework via ISupplicantStaIface#initiateTdlsSetup(). + */ + int maxConcurrentTdlsSessionCount; } From 4855621726bc65c5a16b55ac14fd7706dade3aaf Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Mon, 12 Dec 2022 04:17:04 +0000 Subject: [PATCH 479/998] wifi: Legacy HAL support to get concurrent TDLS session count Added a new field in chip capabilities to get the maximum number of concurrent TDLS sessions supported by the chip Bug: 240247868 Test: Manual - STA connect/disconnect Change-Id: I62fcd2d4a562b088cdeb4b04f72cfe55ed61241c --- wifi/aidl/default/aidl_struct_util.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index 1ed2e17657..ec8b3968f2 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -2772,6 +2772,8 @@ bool convertLegacyWifiChipCapabilitiesToAidl( const legacy_hal::wifi_chip_capabilities& legacy_chip_capabilities, WifiChipCapabilities& aidl_chip_capabilities) { aidl_chip_capabilities.maxMloLinkCount = legacy_chip_capabilities.max_mlo_link_count; + aidl_chip_capabilities.maxConcurrentTdlsSessionCount = + legacy_chip_capabilities.max_concurrent_tdls_session_count; return true; } From 2dec001d1657e37cad8e3604a8c90dfef2658498 Mon Sep 17 00:00:00 2001 From: Dominik Maier Date: Fri, 25 Nov 2022 16:51:16 +0000 Subject: [PATCH 480/998] Add isNullCipherAndIntegrityEnabled HAL API Bug: b/237529943 Test: m Change-Id: Ie4d4f7be78e748f4166ffd371e8acf2c38de8f99 --- .../hardware/radio/network/IRadioNetwork.aidl | 1 + .../radio/network/IRadioNetworkResponse.aidl | 1 + .../hardware/radio/network/IRadioNetwork.aidl | 15 ++++++++++++++ .../radio/network/IRadioNetworkResponse.aidl | 11 ++++++++++ .../include/libradiocompat/RadioNetwork.h | 1 + .../libradiocompat/network/RadioNetwork.cpp | 7 +++++++ radio/aidl/vts/radio_network_response.cpp | 7 +++++++ radio/aidl/vts/radio_network_test.cpp | 20 +++++++++++++++++++ radio/aidl/vts/radio_network_utils.h | 3 +++ 9 files changed, 66 insertions(+) diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl index 5aed0244d9..be06c47018 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl @@ -78,6 +78,7 @@ interface IRadioNetwork { oneway void cancelEmergencyNetworkScan(int serial, boolean resetScan); oneway void exitEmergencyMode(in int serial); oneway void setNullCipherAndIntegrityEnabled(in int serial, in boolean enabled); + oneway void isNullCipherAndIntegrityEnabled(in int serial); oneway void isN1ModeEnabled(in int serial); oneway void setN1ModeEnabled(in int serial, boolean enable); oneway void setLocationPrivacySetting(in int serial, in boolean shareLocation); diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl index ccdfde69e1..009fdd3c17 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -77,6 +77,7 @@ interface IRadioNetworkResponse { oneway void exitEmergencyModeResponse(in android.hardware.radio.RadioResponseInfo info); oneway void cancelEmergencyNetworkScanResponse(in android.hardware.radio.RadioResponseInfo info); oneway void setNullCipherAndIntegrityEnabledResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void isNullCipherAndIntegrityEnabledResponse(in android.hardware.radio.RadioResponseInfo info, in boolean isEnabled); oneway void isN1ModeEnabledResponse(in android.hardware.radio.RadioResponseInfo info, boolean isEnabled); oneway void setN1ModeEnabledResponse(in android.hardware.radio.RadioResponseInfo info); oneway void setLocationPrivacySettingResponse(in android.hardware.radio.RadioResponseInfo info); diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl index 70427f81f0..38772cd590 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl @@ -509,6 +509,21 @@ oneway interface IRadioNetwork { */ void setNullCipherAndIntegrityEnabled(in int serial, in boolean enabled); + /** + * Get whether null encryption and integrity modes are enabled. + * + * Null ciphering and integrity modes include, (but are not limited to): + * 2G: A5/0, GAE0 (no integrity algorithm supported) + * 3G: UEA0 and UIA0 + * 4G: EEA0 and EIA + * 5G: NEA0 and NIA0 + * + * @param serial Serial number of the request. + * + * Response callback is IRadioNetworkResponse.isNullCipherAndIntegrityEnabledResponse() + */ + void isNullCipherAndIntegrityEnabled(in int serial); + /** * Checks whether N1 mode (access to 5G core network) is enabled or not. * diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl index 3fa6521e7e..399dbb7a84 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -625,6 +625,17 @@ oneway interface IRadioNetworkResponse { */ void setNullCipherAndIntegrityEnabledResponse(in RadioResponseInfo info); + /** + * @param info Response info struct containing response type, serial no. and error + * @param enabled the last known state of null ciphering and integrity algorithms + * + * Valid errors returned: + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:MODEM_ERR + */ + void isNullCipherAndIntegrityEnabledResponse(in RadioResponseInfo info, in boolean isEnabled); + /** * Response of isN1ModeEnabled. * This is an optional API. diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h index b4461031be..45c1645efc 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h @@ -103,6 +103,7 @@ class RadioNetwork : public RadioCompatBase, ::ndk::ScopedAStatus setN1ModeEnabled(int32_t serial, bool enable) override; ::ndk::ScopedAStatus setNullCipherAndIntegrityEnabled(int32_t serial, bool enabled) override; + ::ndk::ScopedAStatus isNullCipherAndIntegrityEnabled(int32_t serial) override; ::ndk::ScopedAStatus setLocationPrivacySetting(int32_t serial, bool shareLocation) override; ::ndk::ScopedAStatus getLocationPrivacySetting(int32_t serial) override; diff --git a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp index 730b5dd902..5e44fff81a 100644 --- a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp +++ b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp @@ -347,6 +347,13 @@ ScopedAStatus RadioNetwork::setNullCipherAndIntegrityEnabled(int32_t serial, boo return ok(); } +ScopedAStatus RadioNetwork::isNullCipherAndIntegrityEnabled(int32_t serial) { + LOG_CALL << serial; + LOG(ERROR) << " isNullCipherAndIntegrityEnabled is unsupported by HIDL HALs"; + respond()->isNullCipherAndIntegrityEnabledResponse(notSupported(serial), true); + return ok(); +} + ScopedAStatus RadioNetwork::isN1ModeEnabled(int32_t serial) { LOG_CALL << serial; LOG(ERROR) << " isN1ModeEnabled is unsupported by HIDL HALs"; diff --git a/radio/aidl/vts/radio_network_response.cpp b/radio/aidl/vts/radio_network_response.cpp index 4f0e4f3274..35e4202127 100644 --- a/radio/aidl/vts/radio_network_response.cpp +++ b/radio/aidl/vts/radio_network_response.cpp @@ -301,6 +301,13 @@ ndk::ScopedAStatus RadioNetworkResponse::setNullCipherAndIntegrityEnabledRespons return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus RadioNetworkResponse::isNullCipherAndIntegrityEnabledResponse( + const RadioResponseInfo& info, bool /*isEnabled*/) { + rspInfo = info; + parent_network.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + ndk::ScopedAStatus RadioNetworkResponse::isN1ModeEnabledResponse( const RadioResponseInfo& info, bool /*isEnabled*/) { rspInfo = info; diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index e7a48bc882..43a4737b5d 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -1979,3 +1979,23 @@ TEST_P(RadioNetworkTest, setNullCipherAndIntegrityEnabled) { {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); LOG(DEBUG) << "setNullCipherAndIntegrityEnabled finished"; } + +/** + * Test IRadioNetwork.isNullCipherAndIntegrityEnabled() for the response returned. + */ +TEST_P(RadioNetworkTest, isNullCipherAndIntegrityEnabled) { + LOG(DEBUG) << "isNullCipherAndIntegrityEnabled"; + serial = GetRandomSerialNumber(); + + ndk::ScopedAStatus res = radio_network->isNullCipherAndIntegrityEnabled(serial); + ASSERT_OK(res); + + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); + + ASSERT_TRUE(CheckAnyOfErrors( + radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); + LOG(DEBUG) << "isNullCipherAndIntegrityEnabled finished"; +} diff --git a/radio/aidl/vts/radio_network_utils.h b/radio/aidl/vts/radio_network_utils.h index 92dcb1f70f..496ec033d2 100644 --- a/radio/aidl/vts/radio_network_utils.h +++ b/radio/aidl/vts/radio_network_utils.h @@ -162,6 +162,9 @@ class RadioNetworkResponse : public BnRadioNetworkResponse { virtual ndk::ScopedAStatus setNullCipherAndIntegrityEnabledResponse( const RadioResponseInfo& info) override; + virtual ndk::ScopedAStatus isNullCipherAndIntegrityEnabledResponse( + const RadioResponseInfo& info, const bool isEnabled) override; + virtual ndk::ScopedAStatus isN1ModeEnabledResponse( const RadioResponseInfo& info, bool isEnabled) override; From 34ab5f3fb0134bb65932e38e975c26031077cc15 Mon Sep 17 00:00:00 2001 From: Muralidhar Reddy Date: Mon, 12 Dec 2022 20:23:46 +0000 Subject: [PATCH 481/998] Update HAL interface to support MEP-A1 mode Test: build Bug: 254866604 Change-Id: I00938c583d038b8627e1845222b50414af2f2e09 --- .../current/android/hardware/radio/config/SimSlotStatus.aidl | 2 +- .../current/android/hardware/radio/sim/CardStatus.aidl | 1 + .../current/android/hardware/radio/sim/SimApdu.aidl | 2 +- radio/aidl/android/hardware/radio/config/SimSlotStatus.aidl | 5 +++-- radio/aidl/android/hardware/radio/sim/CardStatus.aidl | 5 +++++ radio/aidl/android/hardware/radio/sim/SimApdu.aidl | 2 +- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimSlotStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimSlotStatus.aidl index da894cdbd7..c264dfd3cf 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimSlotStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimSlotStatus.aidl @@ -38,5 +38,5 @@ parcelable SimSlotStatus { String atr; String eid; android.hardware.radio.config.SimPortInfo[] portInfo; - android.hardware.radio.config.MultipleEnabledProfilesMode supportedMepMode; + android.hardware.radio.config.MultipleEnabledProfilesMode supportedMepMode = android.hardware.radio.config.MultipleEnabledProfilesMode.NONE; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CardStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CardStatus.aidl index 9000d43506..46cb7becb2 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CardStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CardStatus.aidl @@ -44,6 +44,7 @@ parcelable CardStatus { String iccid; String eid; android.hardware.radio.config.SlotPortMapping slotMap; + android.hardware.radio.config.MultipleEnabledProfilesMode supportedMepMode = android.hardware.radio.config.MultipleEnabledProfilesMode.NONE; const int STATE_ABSENT = 0; const int STATE_PRESENT = 1; const int STATE_ERROR = 2; diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimApdu.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimApdu.aidl index 2f2e07b999..c391e5af34 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimApdu.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimApdu.aidl @@ -41,5 +41,5 @@ parcelable SimApdu { int p2; int p3; String data; - boolean isEs10; + boolean isEs10 = false; } diff --git a/radio/aidl/android/hardware/radio/config/SimSlotStatus.aidl b/radio/aidl/android/hardware/radio/config/SimSlotStatus.aidl index 73f2954899..6a36d5e83b 100644 --- a/radio/aidl/android/hardware/radio/config/SimSlotStatus.aidl +++ b/radio/aidl/android/hardware/radio/config/SimSlotStatus.aidl @@ -54,7 +54,8 @@ parcelable SimSlotStatus { */ SimPortInfo[] portInfo; /** - * Jointly supported Multiple Enabled Profiles(MEP) mode as per SGP.22 V3.0 + * Jointly supported Multiple Enabled Profiles(MEP) mode as per SGP.22 V3.0. Should always + * report proper MEP mode irrespective of whether the slot is active or inactive. */ - MultipleEnabledProfilesMode supportedMepMode; + MultipleEnabledProfilesMode supportedMepMode = MultipleEnabledProfilesMode.NONE; } diff --git a/radio/aidl/android/hardware/radio/sim/CardStatus.aidl b/radio/aidl/android/hardware/radio/sim/CardStatus.aidl index a14cf7d4cc..1419c51de6 100644 --- a/radio/aidl/android/hardware/radio/sim/CardStatus.aidl +++ b/radio/aidl/android/hardware/radio/sim/CardStatus.aidl @@ -16,6 +16,7 @@ package android.hardware.radio.sim; +import android.hardware.radio.config.MultipleEnabledProfilesMode; import android.hardware.radio.config.SlotPortMapping; import android.hardware.radio.sim.AppStatus; import android.hardware.radio.sim.PinState; @@ -93,4 +94,8 @@ parcelable CardStatus { * PortId is the id (enumerated value) for the associated port available on the SIM. */ SlotPortMapping slotMap; + /** + * Jointly supported Multiple Enabled Profiles(MEP) mode as per SGP.22 V3.0 + */ + MultipleEnabledProfilesMode supportedMepMode = MultipleEnabledProfilesMode.NONE; } diff --git a/radio/aidl/android/hardware/radio/sim/SimApdu.aidl b/radio/aidl/android/hardware/radio/sim/SimApdu.aidl index 4759e2e9ab..9799f2bc7a 100644 --- a/radio/aidl/android/hardware/radio/sim/SimApdu.aidl +++ b/radio/aidl/android/hardware/radio/sim/SimApdu.aidl @@ -53,5 +53,5 @@ parcelable SimApdu { * isEs10 indicates that the current streaming APDU contains an ES10 command or it is a regular * APDU. (As per spec SGP.22 V3.0, ES10 commands needs to be sent over command port of MEP-A1) */ - boolean isEs10; + boolean isEs10 = false; } From 5b6498336d74cae64354839ab22d45ae82a74cb8 Mon Sep 17 00:00:00 2001 From: Myles Watson Date: Fri, 4 Nov 2022 09:16:58 -0700 Subject: [PATCH 482/998] Radio: hidl2aidl for ISap interface Convert the ISap HIDL interface to AIDL using the script Move ISap into android.hardware.radio.sap Bug: 241969533 Test: new VTS Test Change-Id: Ifee8c16e939f02ee4bbdb2fee23ce78b5e48df50 --- radio/aidl/Android.bp | 17 ++ .../android/hardware/radio/sap/ISap.aidl | 46 ++++++ .../hardware/radio/sap/ISapCallback.aidl | 48 ++++++ .../hardware/radio/sap/SapApduType.aidl | 39 +++++ .../hardware/radio/sap/SapConnectRsp.aidl | 42 +++++ .../hardware/radio/sap/SapDisconnectType.aidl | 39 +++++ .../hardware/radio/sap/SapResultCode.aidl | 45 ++++++ .../android/hardware/radio/sap/SapStatus.aidl | 43 +++++ .../radio/sap/SapTransferProtocol.aidl | 39 +++++ .../aidl/android/hardware/radio/sap/ISap.aidl | 92 +++++++++++ .../hardware/radio/sap/ISapCallback.aidl | 152 ++++++++++++++++++ .../hardware/radio/sap/SapApduType.aidl | 24 +++ .../hardware/radio/sap/SapConnectRsp.aidl | 27 ++++ .../hardware/radio/sap/SapDisconnectType.aidl | 24 +++ .../hardware/radio/sap/SapResultCode.aidl | 30 ++++ .../android/hardware/radio/sap/SapStatus.aidl | 28 ++++ .../radio/sap/SapTransferProtocol.aidl | 24 +++ 17 files changed, 759 insertions(+) create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/ISap.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/ISapCallback.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapApduType.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapConnectRsp.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapDisconnectType.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapResultCode.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapStatus.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapTransferProtocol.aidl create mode 100644 radio/aidl/android/hardware/radio/sap/ISap.aidl create mode 100644 radio/aidl/android/hardware/radio/sap/ISapCallback.aidl create mode 100644 radio/aidl/android/hardware/radio/sap/SapApduType.aidl create mode 100644 radio/aidl/android/hardware/radio/sap/SapConnectRsp.aidl create mode 100644 radio/aidl/android/hardware/radio/sap/SapDisconnectType.aidl create mode 100644 radio/aidl/android/hardware/radio/sap/SapResultCode.aidl create mode 100644 radio/aidl/android/hardware/radio/sap/SapStatus.aidl create mode 100644 radio/aidl/android/hardware/radio/sap/SapTransferProtocol.aidl diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp index 930b6d4809..9caa97a990 100644 --- a/radio/aidl/Android.bp +++ b/radio/aidl/Android.bp @@ -152,6 +152,23 @@ aidl_interface { } +aidl_interface { + name: "android.hardware.radio.sap", + vendor_available: true, + host_supported: true, + srcs: ["android/hardware/radio/sap/*.aidl"], + stability: "vintf", + backend: { + cpp: { + enabled: true, + }, + java: { + sdk_version: "module_current", + }, + }, + +} + aidl_interface { name: "android.hardware.radio.sim", vendor_available: true, diff --git a/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/ISap.aidl b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/ISap.aidl new file mode 100644 index 0000000000..37391e9804 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/ISap.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.sap; +@VintfStability +interface ISap { + oneway void apduReq(in int serial, in android.hardware.radio.sap.SapApduType type, in byte[] command); + oneway void connectReq(in int serial, in int maxMsgSizeBytes); + oneway void disconnectReq(in int serial); + oneway void powerReq(in int serial, in boolean powerOn); + oneway void resetSimReq(in int serial); + oneway void setCallback(in android.hardware.radio.sap.ISapCallback sapCallback); + oneway void setTransferProtocolReq(in int serial, in android.hardware.radio.sap.SapTransferProtocol transferProtocol); + oneway void transferAtrReq(in int serial); + oneway void transferCardReaderStatusReq(in int serial); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/ISapCallback.aidl b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/ISapCallback.aidl new file mode 100644 index 0000000000..d507709a6d --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/ISapCallback.aidl @@ -0,0 +1,48 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.sap; +@VintfStability +interface ISapCallback { + oneway void apduResponse(in int serial, in android.hardware.radio.sap.SapResultCode resultCode, in byte[] apduRsp); + oneway void connectResponse(in int serial, in android.hardware.radio.sap.SapConnectRsp sapConnectRsp, in int maxMsgSizeBytes); + oneway void disconnectIndication(in int serial, in android.hardware.radio.sap.SapDisconnectType disconnectType); + oneway void disconnectResponse(in int serial); + oneway void errorResponse(in int serial); + oneway void powerResponse(in int serial, in android.hardware.radio.sap.SapResultCode resultCode); + oneway void resetSimResponse(in int serial, in android.hardware.radio.sap.SapResultCode resultCode); + oneway void statusIndication(in int serial, in android.hardware.radio.sap.SapStatus status); + oneway void transferAtrResponse(in int serial, in android.hardware.radio.sap.SapResultCode resultCode, in byte[] atr); + oneway void transferCardReaderStatusResponse(in int serial, in android.hardware.radio.sap.SapResultCode resultCode, in int cardReaderStatus); + oneway void transferProtocolResponse(in int serial, in android.hardware.radio.sap.SapResultCode resultCode); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapApduType.aidl b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapApduType.aidl new file mode 100644 index 0000000000..e0e2a03956 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapApduType.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.sap; +@Backing(type="int") @VintfStability +enum SapApduType { + APDU = 0, + APDU7816 = 1, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapConnectRsp.aidl b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapConnectRsp.aidl new file mode 100644 index 0000000000..aceac3789c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapConnectRsp.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.sap; +@Backing(type="int") @VintfStability +enum SapConnectRsp { + SUCCESS = 0, + CONNECT_FAILURE = 1, + MSG_SIZE_TOO_LARGE = 2, + MSG_SIZE_TOO_SMALL = 3, + CONNECT_OK_CALL_ONGOING = 4, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapDisconnectType.aidl b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapDisconnectType.aidl new file mode 100644 index 0000000000..0447f9b083 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapDisconnectType.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.sap; +@Backing(type="int") @VintfStability +enum SapDisconnectType { + GRACEFUL = 0, + IMMEDIATE = 1, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapResultCode.aidl b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapResultCode.aidl new file mode 100644 index 0000000000..1db226b43c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapResultCode.aidl @@ -0,0 +1,45 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.sap; +@Backing(type="int") @VintfStability +enum SapResultCode { + SUCCESS = 0, + GENERIC_FAILURE = 1, + CARD_NOT_ACCESSSIBLE = 2, + CARD_ALREADY_POWERED_OFF = 3, + CARD_REMOVED = 4, + CARD_ALREADY_POWERED_ON = 5, + DATA_NOT_AVAILABLE = 6, + NOT_SUPPORTED = 7, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapStatus.aidl new file mode 100644 index 0000000000..32f71c218a --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapStatus.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.sap; +@Backing(type="int") @VintfStability +enum SapStatus { + UNKNOWN_ERROR = 0, + CARD_RESET = 1, + CARD_NOT_ACCESSIBLE = 2, + CARD_REMOVED = 3, + CARD_INSERTED = 4, + RECOVERED = 5, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapTransferProtocol.aidl b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapTransferProtocol.aidl new file mode 100644 index 0000000000..e3ffdb0702 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapTransferProtocol.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.sap; +@Backing(type="int") @VintfStability +enum SapTransferProtocol { + T0 = 0, + T1 = 1, +} diff --git a/radio/aidl/android/hardware/radio/sap/ISap.aidl b/radio/aidl/android/hardware/radio/sap/ISap.aidl new file mode 100644 index 0000000000..552e602b75 --- /dev/null +++ b/radio/aidl/android/hardware/radio/sap/ISap.aidl @@ -0,0 +1,92 @@ +/* + * 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. + */ + +package android.hardware.radio.sap; + +import android.hardware.radio.sap.ISapCallback; +import android.hardware.radio.sap.SapApduType; +import android.hardware.radio.sap.SapTransferProtocol; + +@VintfStability +oneway interface ISap { + /** + * TRANSFER_APDU_REQ from SAP 1.1 spec 5.1.6 + * + * @param serial Id to match req-resp. Resp must include same serial. + * @param type APDU command type + * @param command CommandAPDU/CommandAPDU7816 parameter depending on type + */ + void apduReq(in int serial, in SapApduType type, in byte[] command); + + /** + * CONNECT_REQ from SAP 1.1 spec 5.1.1 + * + * @param serial Id to match req-resp. Resp must include same serial. + * @param maxMsgSizeBytes MaxMsgSize to be used for SIM Access Profile connection + */ + void connectReq(in int serial, in int maxMsgSizeBytes); + + /** + * DISCONNECT_REQ from SAP 1.1 spec 5.1.3 + * + * @param serial Id to match req-resp. Resp must include same serial. + */ + void disconnectReq(in int serial); + + /** + * POWER_SIM_OFF_REQ and POWER_SIM_ON_REQ from SAP 1.1 spec 5.1.10 + 5.1.12 + * + * @param serial Id to match req-resp. Resp must include same serial. + * @param powerOn true for on, false for off + */ + void powerReq(in int serial, in boolean powerOn); + + /** + * RESET_SIM_REQ from SAP 1.1 spec 5.1.14 + * + * @param serial Id to match req-resp. Resp must include same serial. + */ + void resetSimReq(in int serial); + + /** + * Set callback that has response and unsolicited indication functions + * + * @param sapCallback Object containing response and unosolicited indication callbacks + */ + void setCallback(in ISapCallback sapCallback); + + /** + * SET_TRANSPORT_PROTOCOL_REQ from SAP 1.1 spec 5.1.20 + * + * @param serial Id to match req-resp. Resp must include same serial. + * @param transferProtocol Transport Protocol + */ + void setTransferProtocolReq(in int serial, in SapTransferProtocol transferProtocol); + + /** + * TRANSFER_ATR_REQ from SAP 1.1 spec 5.1.8 + * + * @param serial Id to match req-resp. Resp must include same serial. + */ + void transferAtrReq(in int serial); + + /** + * TRANSFER_CARD_READER_STATUS_REQ from SAP 1.1 spec 5.1.17 + * + * @param serial Id to match req-resp. Resp must include same serial. + */ + void transferCardReaderStatusReq(in int serial); +} diff --git a/radio/aidl/android/hardware/radio/sap/ISapCallback.aidl b/radio/aidl/android/hardware/radio/sap/ISapCallback.aidl new file mode 100644 index 0000000000..34111eb7ff --- /dev/null +++ b/radio/aidl/android/hardware/radio/sap/ISapCallback.aidl @@ -0,0 +1,152 @@ +/* + * 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. + */ + +package android.hardware.radio.sap; + +import android.hardware.radio.sap.SapConnectRsp; +import android.hardware.radio.sap.SapDisconnectType; +import android.hardware.radio.sap.SapResultCode; +import android.hardware.radio.sap.SapStatus; + +@VintfStability +oneway interface ISapCallback { + /** + * TRANSFER_APDU_RESP from SAP 1.1 spec 5.1.7 + * + * @param serial Id to match req-resp. Value must match the one in req. + * @param resultCode ResultCode to indicate if command was processed correctly + * Possible values: + * SapResultCode:SUCCESS, + * SapResultCode:GENERIC_FAILURE, + * SapResultCode:CARD_NOT_ACCESSSIBLE, + * SapResultCode:CARD_ALREADY_POWERED_OFF, + * SapResultCode:CARD_REMOVED + * @param apduRsp APDU Response. Valid only if command was processed correctly and no error + * occurred. + */ + void apduResponse(in int serial, in SapResultCode resultCode, in byte[] apduRsp); + + /** + * CONNECT_RESP from SAP 1.1 spec 5.1.2 + * + * @param serial Id to match req-resp. Value must match the one in req. + * @param sapConnectRsp Connection Status + * @param maxMsgSizeBytes MaxMsgSize supported by server if request cannot be fulfilled. + * Valid only if connectResponse is SapConnectResponse:MSG_SIZE_TOO_LARGE. + */ + void connectResponse(in int serial, in SapConnectRsp sapConnectRsp, in int maxMsgSizeBytes); + + /** + * DISCONNECT_IND from SAP 1.1 spec 5.1.5 + * + * @param serial Id to match req-resp. Value must match the one in req. + * @param disconnectType Disconnect Type to indicate if shutdown is graceful or immediate + */ + void disconnectIndication(in int serial, in SapDisconnectType disconnectType); + + /** + * DISCONNECT_RESP from SAP 1.1 spec 5.1.4 + * + * @param serial Id to match req-resp. Value must match the one in req. + */ + void disconnectResponse(in int serial); + + /** + * ERROR_RESP from SAP 1.1 spec 5.1.19 + * + * @param serial Id to match req-resp. Value must match the one in req. + */ + void errorResponse(in int serial); + + /** + * POWER_SIM_OFF_RESP and POWER_SIM_ON_RESP from SAP 1.1 spec 5.1.11 + 5.1.13 + * + * @param serial Id to match req-resp. Value must match the one in req. + * @param resultCode ResultCode to indicate if command was processed correctly + * Possible values: + * SapResultCode:SUCCESS, + * SapResultCode:GENERIC_FAILURE, + * SapResultCode:CARD_NOT_ACCESSSIBLE, (possible only for power on req) + * SapResultCode:CARD_ALREADY_POWERED_OFF, (possible only for power off req) + * SapResultCode:CARD_REMOVED, + * SapResultCode:CARD_ALREADY_POWERED_ON (possible only for power on req) + */ + void powerResponse(in int serial, in SapResultCode resultCode); + + /** + * RESET_SIM_RESP from SAP 1.1 spec 5.1.15 + * + * @param serial Id to match req-resp. Value must match the one in req. + * @param resultCode ResultCode to indicate if command was processed correctly + * Possible values: + * SapResultCode:SUCCESS, + * SapResultCode:GENERIC_FAILURE, + * SapResultCode:CARD_NOT_ACCESSSIBLE, + * SapResultCode:CARD_ALREADY_POWERED_OFF, + * SapResultCode:CARD_REMOVED + */ + void resetSimResponse(in int serial, in SapResultCode resultCode); + + /** + * STATUS_IND from SAP 1.1 spec 5.1.16 + * + * @param serial Id to match req-resp. Value must match the one in req. + * @param status Parameter to indicate reason for the status change. + */ + void statusIndication(in int serial, in SapStatus status); + + /** + * TRANSFER_ATR_RESP from SAP 1.1 spec 5.1.9 + * + * @param serial Id to match req-resp. Value must match the one in req. + * @param resultCode ResultCode to indicate if command was processed correctly + * Possible values: + * SapResultCode:SUCCESS, + * SapResultCode:GENERIC_FAILURE, + * SapResultCode:CARD_ALREADY_POWERED_OFF, + * SapResultCode:CARD_REMOVED, + * SapResultCode:DATA_NOT_AVAILABLE + * @param atr Answer to Reset from the subscription module. Included only if no error occurred, + * otherwise empty. + */ + void transferAtrResponse(in int serial, in SapResultCode resultCode, in byte[] atr); + + /** + * TRANSFER_CARD_READER_STATUS_REQ from SAP 1.1 spec 5.1.18 + * + * @param serial Id to match req-resp. Value must match the one in req. + * @param resultCode ResultCode to indicate if command was processed correctly + * Possible values: + * SapResultCode:SUCCESS, + * SapResultCode:GENERIC_FAILURE + * SapResultCode:DATA_NOT_AVAILABLE + * @param cardReaderStatus Card Reader Status coded as described in 3GPP TS 11.14 Section 12.33 + * and TS 31.111 Section 8.33 + */ + void transferCardReaderStatusResponse( + in int serial, in SapResultCode resultCode, in int cardReaderStatus); + + /** + * SET_TRANSPORT_PROTOCOL_RESP from SAP 1.1 spec 5.1.21 + * + * @param serial Id to match req-resp. Value must match the one in req. + * @param resultCode ResultCode to indicate if command was processed correctly + * Possible values: + * SapResultCode:SUCCESS + * SapResultCode:NOT_SUPPORTED + */ + void transferProtocolResponse(in int serial, in SapResultCode resultCode); +} diff --git a/radio/aidl/android/hardware/radio/sap/SapApduType.aidl b/radio/aidl/android/hardware/radio/sap/SapApduType.aidl new file mode 100644 index 0000000000..ab8ffb9f72 --- /dev/null +++ b/radio/aidl/android/hardware/radio/sap/SapApduType.aidl @@ -0,0 +1,24 @@ +/* + * 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. + */ + +package android.hardware.radio.sap; + +@VintfStability +@Backing(type="int") +enum SapApduType { + APDU, + APDU7816, +} diff --git a/radio/aidl/android/hardware/radio/sap/SapConnectRsp.aidl b/radio/aidl/android/hardware/radio/sap/SapConnectRsp.aidl new file mode 100644 index 0000000000..0e1d528c1c --- /dev/null +++ b/radio/aidl/android/hardware/radio/sap/SapConnectRsp.aidl @@ -0,0 +1,27 @@ +/* + * 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. + */ + +package android.hardware.radio.sap; + +@VintfStability +@Backing(type="int") +enum SapConnectRsp { + SUCCESS, + CONNECT_FAILURE, + MSG_SIZE_TOO_LARGE, + MSG_SIZE_TOO_SMALL, + CONNECT_OK_CALL_ONGOING, +} diff --git a/radio/aidl/android/hardware/radio/sap/SapDisconnectType.aidl b/radio/aidl/android/hardware/radio/sap/SapDisconnectType.aidl new file mode 100644 index 0000000000..16d7cc6d83 --- /dev/null +++ b/radio/aidl/android/hardware/radio/sap/SapDisconnectType.aidl @@ -0,0 +1,24 @@ +/* + * 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. + */ + +package android.hardware.radio.sap; + +@VintfStability +@Backing(type="int") +enum SapDisconnectType { + GRACEFUL, + IMMEDIATE, +} diff --git a/radio/aidl/android/hardware/radio/sap/SapResultCode.aidl b/radio/aidl/android/hardware/radio/sap/SapResultCode.aidl new file mode 100644 index 0000000000..4728ebe69a --- /dev/null +++ b/radio/aidl/android/hardware/radio/sap/SapResultCode.aidl @@ -0,0 +1,30 @@ +/* + * 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. + */ + +package android.hardware.radio.sap; + +@VintfStability +@Backing(type="int") +enum SapResultCode { + SUCCESS, + GENERIC_FAILURE, + CARD_NOT_ACCESSSIBLE, + CARD_ALREADY_POWERED_OFF, + CARD_REMOVED, + CARD_ALREADY_POWERED_ON, + DATA_NOT_AVAILABLE, + NOT_SUPPORTED, +} diff --git a/radio/aidl/android/hardware/radio/sap/SapStatus.aidl b/radio/aidl/android/hardware/radio/sap/SapStatus.aidl new file mode 100644 index 0000000000..309352de68 --- /dev/null +++ b/radio/aidl/android/hardware/radio/sap/SapStatus.aidl @@ -0,0 +1,28 @@ +/* + * 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. + */ + +package android.hardware.radio.sap; + +@VintfStability +@Backing(type="int") +enum SapStatus { + UNKNOWN_ERROR, + CARD_RESET, + CARD_NOT_ACCESSIBLE, + CARD_REMOVED, + CARD_INSERTED, + RECOVERED, +} diff --git a/radio/aidl/android/hardware/radio/sap/SapTransferProtocol.aidl b/radio/aidl/android/hardware/radio/sap/SapTransferProtocol.aidl new file mode 100644 index 0000000000..823c5f2830 --- /dev/null +++ b/radio/aidl/android/hardware/radio/sap/SapTransferProtocol.aidl @@ -0,0 +1,24 @@ +/* + * 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. + */ + +package android.hardware.radio.sap; + +@VintfStability +@Backing(type="int") +enum SapTransferProtocol { + T0, + T1, +} From 25fb3aac3afd38ae823e6766b03bd4b2eb6398ed Mon Sep 17 00:00:00 2001 From: Pomai Ahlo Date: Mon, 12 Dec 2022 13:58:55 -0800 Subject: [PATCH 483/998] [ISap hidl2aidl] Compat Support Add support for ISap in the compat shim. Test: atest VtsHalRadioTargetTest:PerInstance/SapTest Bug: 241969533 Change-Id: I9fe5fe194de877bcd2b85ccfa822bd6565e2dc72 --- .../compatibility_matrix.current.xml | 10 ++ radio/aidl/compat/libradiocompat/Android.bp | 4 + .../compat/libradiocompat/commonStructs.cpp | 4 + .../compat/libradiocompat/commonStructs.h | 1 + .../include/libradiocompat/Sap.h | 64 ++++++++++ .../include/libradiocompat/SapCallback.h | 54 +++++++++ radio/aidl/compat/libradiocompat/sap/Sap.cpp | 94 +++++++++++++++ .../compat/libradiocompat/sap/SapCallback.cpp | 111 ++++++++++++++++++ .../compat/libradiocompat/sap/structs.cpp | 47 ++++++++ .../aidl/compat/libradiocompat/sap/structs.h | 33 ++++++ radio/aidl/compat/service/Android.bp | 1 + 11 files changed, 423 insertions(+) create mode 100644 radio/aidl/compat/libradiocompat/include/libradiocompat/Sap.h create mode 100644 radio/aidl/compat/libradiocompat/include/libradiocompat/SapCallback.h create mode 100644 radio/aidl/compat/libradiocompat/sap/Sap.cpp create mode 100644 radio/aidl/compat/libradiocompat/sap/SapCallback.cpp create mode 100644 radio/aidl/compat/libradiocompat/sap/structs.cpp create mode 100644 radio/aidl/compat/libradiocompat/sap/structs.h diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 611ea1f454..4a5c8ded06 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -505,6 +505,16 @@ slot3
+ + android.hardware.radio.sap + 1 + + ISap + slot1 + slot2 + slot3 + + android.hardware.radio.voice 2 diff --git a/radio/aidl/compat/libradiocompat/Android.bp b/radio/aidl/compat/libradiocompat/Android.bp index c40ca30832..95953acab1 100644 --- a/radio/aidl/compat/libradiocompat/Android.bp +++ b/radio/aidl/compat/libradiocompat/Android.bp @@ -41,6 +41,7 @@ cc_library { "android.hardware.radio.messaging-V2-ndk", "android.hardware.radio.modem-V2-ndk", "android.hardware.radio.network-V2-ndk", + "android.hardware.radio.sap-V1-ndk", "android.hardware.radio.sim-V2-ndk", "android.hardware.radio.voice-V2-ndk", "android.hardware.radio@1.0", @@ -86,6 +87,9 @@ cc_library { "network/RadioResponse-network.cpp", "network/structs.cpp", "network/utils.cpp", + "sap/Sap.cpp", + "sap/SapCallback.cpp", + "sap/structs.cpp", "sim/RadioIndication-sim.cpp", "sim/RadioResponse-sim.cpp", "sim/RadioSim.cpp", diff --git a/radio/aidl/compat/libradiocompat/commonStructs.cpp b/radio/aidl/compat/libradiocompat/commonStructs.cpp index 6e4c873d65..d65ed1a1e4 100644 --- a/radio/aidl/compat/libradiocompat/commonStructs.cpp +++ b/radio/aidl/compat/libradiocompat/commonStructs.cpp @@ -48,6 +48,10 @@ int32_t toAidl(uint32_t v) { return v; } +uint8_t toHidl(int8_t v) { + return v; +} + aidl::RadioIndicationType toAidl(V1_0::RadioIndicationType type) { return aidl::RadioIndicationType(type); } diff --git a/radio/aidl/compat/libradiocompat/commonStructs.h b/radio/aidl/compat/libradiocompat/commonStructs.h index a4a4869e61..f43a599193 100644 --- a/radio/aidl/compat/libradiocompat/commonStructs.h +++ b/radio/aidl/compat/libradiocompat/commonStructs.h @@ -28,6 +28,7 @@ hidl_string toHidl(const std::string& str); uint8_t toAidl(int8_t v); int8_t toAidl(uint8_t v); int32_t toAidl(uint32_t v); +uint8_t toHidl(int8_t v); aidl::android::hardware::radio::RadioIndicationType toAidl(V1_0::RadioIndicationType type); aidl::android::hardware::radio::RadioResponseType toAidl(V1_0::RadioResponseType type); diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/Sap.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/Sap.h new file mode 100644 index 0000000000..a293d11d22 --- /dev/null +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/Sap.h @@ -0,0 +1,64 @@ +/* + * 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. + */ +#pragma once + +#include "RadioCompatBase.h" +#include "SapCallback.h" + +#include +#include +#include + +namespace android::hardware::radio::compat { + +/** + * HAL translator from HIDL ISap to AIDL ISap + * + * This class wraps existing HIDL implementation (either a binder stub or real + * class implementing the HAL) and implements AIDL HAL. It's up to the caller to + * fetch source implementation and publish resulting HAL instance. + */ +class Sap : public aidl::android::hardware::radio::sap::BnSap { + const sp mHal; + + const sp mSapCallback; + + ::ndk::ScopedAStatus apduReq(int32_t serial, + aidl::android::hardware::radio::sap::SapApduType type, + const std::vector& command) override; + ::ndk::ScopedAStatus connectReq(int32_t serial, int32_t maxMsgSize) override; + ::ndk::ScopedAStatus disconnectReq(int32_t serial) override; + ::ndk::ScopedAStatus powerReq(int32_t serial, bool state) override; + ::ndk::ScopedAStatus resetSimReq(int32_t serial) override; + ::ndk::ScopedAStatus setCallback( + const std::shared_ptr<::aidl::android::hardware::radio::sap::ISapCallback>& sapCallback) + override; + ::ndk::ScopedAStatus setTransferProtocolReq( + int32_t serial, + aidl::android::hardware::radio::sap::SapTransferProtocol transferProtocol) override; + ::ndk::ScopedAStatus transferAtrReq(int32_t serial) override; + ::ndk::ScopedAStatus transferCardReaderStatusReq(int32_t serial) override; + + public: + /** + * Constructs AIDL ISap instance wrapping existing HIDL ISap instance. + * + * \param hidlHal existing HIDL ISap HAL instance + */ + Sap(sp hidlHal); +}; + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/SapCallback.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/SapCallback.h new file mode 100644 index 0000000000..7e72106416 --- /dev/null +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/SapCallback.h @@ -0,0 +1,54 @@ +/* + * 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. + */ +#pragma once + +#include "GuaranteedCallback.h" + +#include +#include + +namespace android::hardware::radio::compat { + +class SapCallback : public V1_0::ISapCallback { + GuaranteedCallback + mCallback; + + Return apduResponse(int32_t serial, V1_0::SapResultCode resultCode, + const ::android::hardware::hidl_vec& apduRsp) override; + Return connectResponse(int32_t serial, V1_0::SapConnectRsp sapConnectRsp, + int32_t maxMsgSize) override; + Return disconnectIndication(int32_t serial, + V1_0::SapDisconnectType disconnectType) override; + Return disconnectResponse(int32_t serial) override; + Return errorResponse(int32_t serial) override; + Return powerResponse(int32_t serial, V1_0::SapResultCode resultCode) override; + Return resetSimResponse(int32_t serial, V1_0::SapResultCode resultCode) override; + Return statusIndication(int32_t serial, V1_0::SapStatus status) override; + Return transferAtrResponse(int32_t serial, V1_0::SapResultCode resultCode, + const ::android::hardware::hidl_vec& atr) override; + Return transferCardReaderStatusResponse(int32_t serial, V1_0::SapResultCode resultCode, + int32_t cardReaderStatus) override; + Return transferProtocolResponse(int32_t serial, V1_0::SapResultCode resultCode) override; + + public: + void setResponseFunction( + const std::shared_ptr& callback); + + std::shared_ptr respond(); +}; + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/sap/Sap.cpp b/radio/aidl/compat/libradiocompat/sap/Sap.cpp new file mode 100644 index 0000000000..1a77169ab1 --- /dev/null +++ b/radio/aidl/compat/libradiocompat/sap/Sap.cpp @@ -0,0 +1,94 @@ +/* + * 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. + */ + +#include + +#include "commonStructs.h" +#include "debug.h" +#include "structs.h" + +#include "collections.h" + +#define RADIO_MODULE "Sap" + +namespace android::hardware::radio::compat { + +using ::ndk::ScopedAStatus; +namespace aidl = ::aidl::android::hardware::radio::sap; +constexpr auto ok = &ScopedAStatus::ok; + +Sap::Sap(sp hidlHal) : mHal(hidlHal), mSapCallback(sp::make()) {} + +ScopedAStatus Sap::apduReq(int32_t serial, aidl::SapApduType type, + const std::vector& command) { + LOG_CALL << serial; + mHal->apduReq(serial, toHidl(type), toHidl(command)); + return ok(); +} + +ScopedAStatus Sap::connectReq(int32_t serial, int32_t maxMsgSize) { + LOG_CALL << serial; + mHal->connectReq(serial, maxMsgSize); + return ok(); +} + +ScopedAStatus Sap::disconnectReq(int32_t serial) { + LOG_CALL << serial; + mHal->disconnectReq(serial); + return ok(); +} + +ScopedAStatus Sap::powerReq(int32_t serial, bool state) { + LOG_CALL << serial; + mHal->powerReq(serial, state); + return ok(); +} + +ScopedAStatus Sap::resetSimReq(int32_t serial) { + LOG_CALL << serial; + mHal->resetSimReq(serial); + return ok(); +} + +ScopedAStatus Sap::setCallback( + const std::shared_ptr<::aidl::android::hardware::radio::sap::ISapCallback>& sapCallback) { + LOG_CALL << sapCallback; + + CHECK(sapCallback); + + mSapCallback->setResponseFunction(sapCallback); + mHal->setCallback(mSapCallback).assertOk(); + return ok(); +} +ScopedAStatus Sap::setTransferProtocolReq(int32_t serial, + aidl::SapTransferProtocol transferProtocol) { + LOG_CALL << serial; + mHal->setTransferProtocolReq(serial, toHidl(transferProtocol)); + return ok(); +} + +ScopedAStatus Sap::transferAtrReq(int32_t serial) { + LOG_CALL << serial; + mHal->transferAtrReq(serial); + return ok(); +} +ScopedAStatus Sap::transferCardReaderStatusReq(int32_t serial) { + LOG_CALL << serial; + mHal->transferCardReaderStatusReq(serial); + return ok(); +} + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/sap/SapCallback.cpp b/radio/aidl/compat/libradiocompat/sap/SapCallback.cpp new file mode 100644 index 0000000000..a40dff8d78 --- /dev/null +++ b/radio/aidl/compat/libradiocompat/sap/SapCallback.cpp @@ -0,0 +1,111 @@ +/* + * 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. + */ + +#include + +#include "commonStructs.h" +#include "debug.h" +#include "structs.h" + +#include "collections.h" + +#define RADIO_MODULE "SapCallback" + +namespace android::hardware::radio::compat { + +namespace aidl = ::aidl::android::hardware::radio::sap; + +void SapCallback::setResponseFunction(const std::shared_ptr& callback) { + mCallback = callback; +} + +std::shared_ptr SapCallback::respond() { + return mCallback.get(); +} + +Return SapCallback::apduResponse(int32_t serial, V1_0::SapResultCode resultCode, + const hidl_vec& apduRsp) { + LOG_CALL << serial; + respond()->apduResponse(serial, toAidl(resultCode), apduRsp); + return {}; +} + +Return SapCallback::connectResponse(int32_t serial, V1_0::SapConnectRsp sapConnectRsp, + int32_t maxMsgSize) { + LOG_CALL << serial; + respond()->connectResponse(serial, toAidl(sapConnectRsp), maxMsgSize); + return {}; +} + +Return SapCallback::disconnectIndication(int32_t serial, + V1_0::SapDisconnectType disconnectType) { + LOG_CALL << serial; + respond()->disconnectIndication(serial, toAidl(disconnectType)); + return {}; +} + +Return SapCallback::disconnectResponse(int32_t serial) { + LOG_CALL << serial; + respond()->disconnectResponse(serial); + return {}; +} + +Return SapCallback::errorResponse(int32_t serial) { + LOG_CALL << serial; + respond()->errorResponse(serial); + return {}; +} + +Return SapCallback::powerResponse(int32_t serial, V1_0::SapResultCode resultCode) { + LOG_CALL << serial; + respond()->powerResponse(serial, toAidl(resultCode)); + return {}; +} + +Return SapCallback::resetSimResponse(int32_t serial, V1_0::SapResultCode resultCode) { + LOG_CALL << serial; + respond()->resetSimResponse(serial, toAidl(resultCode)); + return {}; +} + +Return SapCallback::statusIndication(int32_t serial, V1_0::SapStatus status) { + LOG_CALL << serial; + respond()->statusIndication(serial, toAidl(status)); + return {}; +} + +Return SapCallback::transferAtrResponse(int32_t serial, V1_0::SapResultCode resultCode, + const hidl_vec& atr) { + LOG_CALL << serial; + respond()->transferAtrResponse(serial, toAidl(resultCode), atr); + return {}; +} + +Return SapCallback::transferCardReaderStatusResponse(int32_t serial, + V1_0::SapResultCode resultCode, + int32_t cardReaderStatus) { + LOG_CALL << serial; + respond()->transferCardReaderStatusResponse(serial, toAidl(resultCode), cardReaderStatus); + return {}; +} + +Return SapCallback::transferProtocolResponse(int32_t serial, V1_0::SapResultCode resultCode) { + LOG_CALL << serial; + respond()->transferProtocolResponse(serial, toAidl(resultCode)); + return {}; +} + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/sap/structs.cpp b/radio/aidl/compat/libradiocompat/sap/structs.cpp new file mode 100644 index 0000000000..522056b0ca --- /dev/null +++ b/radio/aidl/compat/libradiocompat/sap/structs.cpp @@ -0,0 +1,47 @@ +/* + * 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. + */ + +#include "structs.h" + +namespace android::hardware::radio::compat { + +namespace aidl = ::aidl::android::hardware::radio::sap; + +V1_0::SapApduType toHidl(const aidl::SapApduType sapApduType) { + return V1_0::SapApduType(sapApduType); +} + +V1_0::SapTransferProtocol toHidl(const aidl::SapTransferProtocol sapTransferProtocol) { + return V1_0::SapTransferProtocol(sapTransferProtocol); +} + +aidl::SapResultCode toAidl(const V1_0::SapResultCode sapResultCode) { + return aidl::SapResultCode(sapResultCode); +} + +aidl::SapConnectRsp toAidl(const V1_0::SapConnectRsp sapConnectRsp) { + return aidl::SapConnectRsp(sapConnectRsp); +} + +aidl::SapDisconnectType toAidl(const V1_0::SapDisconnectType sapDisconnectType) { + return aidl::SapDisconnectType(sapDisconnectType); +} + +aidl::SapStatus toAidl(const V1_0::SapStatus sapStatus) { + return aidl::SapStatus(sapStatus); +} + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/sap/structs.h b/radio/aidl/compat/libradiocompat/sap/structs.h new file mode 100644 index 0000000000..d88120de70 --- /dev/null +++ b/radio/aidl/compat/libradiocompat/sap/structs.h @@ -0,0 +1,33 @@ +/* + * 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, eithe r express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include +#include + +namespace android::hardware::radio::compat { + +V1_0::SapApduType toHidl(aidl::android::hardware::radio::sap::SapApduType sapAdpuType); +V1_0::SapTransferProtocol toHidl( + aidl::android::hardware::radio::sap::SapTransferProtocol sapTransferProtocol); + +aidl::android::hardware::radio::sap::SapResultCode toAidl(V1_0::SapResultCode sapResultCode); +aidl::android::hardware::radio::sap::SapConnectRsp toAidl(V1_0::SapConnectRsp sapConnectRsp); +aidl::android::hardware::radio::sap::SapDisconnectType toAidl( + V1_0::SapDisconnectType sapDisconnectType); +aidl::android::hardware::radio::sap::SapStatus toAidl(V1_0::SapStatus sapStatus); + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/service/Android.bp b/radio/aidl/compat/service/Android.bp index 7a48da28a9..56674c1268 100644 --- a/radio/aidl/compat/service/Android.bp +++ b/radio/aidl/compat/service/Android.bp @@ -44,6 +44,7 @@ cc_binary { "android.hardware.radio.messaging-V2-ndk", "android.hardware.radio.modem-V2-ndk", "android.hardware.radio.network-V2-ndk", + "android.hardware.radio.sap-V1-ndk", "android.hardware.radio.sim-V2-ndk", "android.hardware.radio.voice-V2-ndk", "android.hardware.radio@1.0", From dc1e6193ebd1337b1f8efca02a758213ce8ec475 Mon Sep 17 00:00:00 2001 From: Pomai Ahlo Date: Mon, 12 Dec 2022 13:58:55 -0800 Subject: [PATCH 484/998] [ISap hidl2aidl] VTS Tests Add VTS tests for the new AIDL interface Test: atest VtsHalRadioTargetTest:PerInstance/SapTest Bug: 241969533 Change-Id: Ia4a6be9aa0fd61c310fb539b44cc4d6a2e6e3852 --- radio/aidl/vts/Android.bp | 3 + radio/aidl/vts/VtsHalRadioTargetTest.cpp | 6 + radio/aidl/vts/radio_sap_callback.cpp | 95 +++++++++ radio/aidl/vts/radio_sap_test.cpp | 233 +++++++++++++++++++++++ radio/aidl/vts/radio_sap_utils.h | 99 ++++++++++ 5 files changed, 436 insertions(+) create mode 100644 radio/aidl/vts/radio_sap_callback.cpp create mode 100644 radio/aidl/vts/radio_sap_test.cpp create mode 100644 radio/aidl/vts/radio_sap_utils.h diff --git a/radio/aidl/vts/Android.bp b/radio/aidl/vts/Android.bp index 5a0dbd06cd..99c3d7135b 100644 --- a/radio/aidl/vts/Android.bp +++ b/radio/aidl/vts/Android.bp @@ -53,6 +53,8 @@ cc_test { "radio_network_indication.cpp", "radio_network_response.cpp", "radio_network_test.cpp", + "radio_sap_callback.cpp", + "radio_sap_test.cpp", "radio_sim_indication.cpp", "radio_sim_response.cpp", "radio_sim_test.cpp", @@ -73,6 +75,7 @@ cc_test { "android.hardware.radio.messaging-V2-ndk", "android.hardware.radio.modem-V2-ndk", "android.hardware.radio.network-V2-ndk", + "android.hardware.radio.sap-V1-ndk", "android.hardware.radio.sim-V2-ndk", "android.hardware.radio.voice-V2-ndk", ], diff --git a/radio/aidl/vts/VtsHalRadioTargetTest.cpp b/radio/aidl/vts/VtsHalRadioTargetTest.cpp index 67a2672c9b..c25f9303c3 100644 --- a/radio/aidl/vts/VtsHalRadioTargetTest.cpp +++ b/radio/aidl/vts/VtsHalRadioTargetTest.cpp @@ -22,6 +22,7 @@ #include "radio_messaging_utils.h" #include "radio_modem_utils.h" #include "radio_network_utils.h" +#include "radio_sap_utils.h" #include "radio_sim_utils.h" #include "radio_voice_utils.h" @@ -55,6 +56,11 @@ INSTANTIATE_TEST_SUITE_P( testing::ValuesIn(android::getAidlHalInstanceNames(IRadioNetwork::descriptor)), android::PrintInstanceNameToString); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioSapTest); +INSTANTIATE_TEST_SUITE_P(PerInstance, SapTest, + testing::ValuesIn(android::getAidlHalInstanceNames(ISap::descriptor)), + android::PrintInstanceNameToString); + GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioSimTest); INSTANTIATE_TEST_SUITE_P(PerInstance, RadioSimTest, testing::ValuesIn(android::getAidlHalInstanceNames(IRadioSim::descriptor)), diff --git a/radio/aidl/vts/radio_sap_callback.cpp b/radio/aidl/vts/radio_sap_callback.cpp new file mode 100644 index 0000000000..3b21ede831 --- /dev/null +++ b/radio/aidl/vts/radio_sap_callback.cpp @@ -0,0 +1,95 @@ +/* + * 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. + */ +#include "radio_sap_utils.h" + +#include + +SapCallback::SapCallback(SapTest& parent) : parent_sap(parent) {} + +::ndk::ScopedAStatus SapCallback::apduResponse(int32_t serialNumber, SapResultCode resultCode, + const std::vector& /*apduRsp*/) { + sapResponseSerial = serialNumber; + sapResultCode = resultCode; + parent_sap.notify(serialNumber); + return ndk::ScopedAStatus::ok(); +} +::ndk::ScopedAStatus SapCallback::connectResponse(int32_t serialNumber, + SapConnectRsp /*sapConnectRsp*/, + int32_t /*maxMsgSize*/) { + sapResponseSerial = serialNumber; + parent_sap.notify(serialNumber); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus SapCallback::disconnectIndication(int32_t /*serialNumber*/, + SapDisconnectType /*sapDisconnectType*/) { + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus SapCallback::disconnectResponse(int32_t serialNumber) { + sapResponseSerial = serialNumber; + parent_sap.notify(serialNumber); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus SapCallback::errorResponse(int32_t /*serialNumber*/) { + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus SapCallback::powerResponse(int32_t serialNumber, SapResultCode resultCode) { + sapResponseSerial = serialNumber; + sapResultCode = resultCode; + parent_sap.notify(serialNumber); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus SapCallback::resetSimResponse(int32_t serialNumber, SapResultCode resultCode) { + sapResponseSerial = serialNumber; + sapResultCode = resultCode; + parent_sap.notify(serialNumber); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus SapCallback::statusIndication(int32_t /*serialNumber*/, + SapStatus /*sapStatus*/) { + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus SapCallback::transferAtrResponse(int32_t serialNumber, + SapResultCode resultCode, + const std::vector& /*atr*/) { + sapResponseSerial = serialNumber; + sapResultCode = resultCode; + parent_sap.notify(serialNumber); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus SapCallback::transferCardReaderStatusResponse(int32_t serialNumber, + SapResultCode resultCode, + int32_t /*cardReaderStatus*/) { + sapResponseSerial = serialNumber; + sapResultCode = resultCode; + parent_sap.notify(serialNumber); + return ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus SapCallback::transferProtocolResponse(int32_t serialNumber, + SapResultCode resultCode) { + sapResponseSerial = serialNumber; + sapResultCode = resultCode; + parent_sap.notify(serialNumber); + return ndk::ScopedAStatus::ok(); +} diff --git a/radio/aidl/vts/radio_sap_test.cpp b/radio/aidl/vts/radio_sap_test.cpp new file mode 100644 index 0000000000..c94379c934 --- /dev/null +++ b/radio/aidl/vts/radio_sap_test.cpp @@ -0,0 +1,233 @@ +/* + * 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. + */ +#include +#include + +#include "radio_sap_utils.h" + +#define ASSERT_OK(ret) ASSERT_TRUE((ret).isOk()) +#define TIMEOUT_PERIOD 40 + +void SapTest::SetUp() { + std::string serviceName = GetParam(); + if (!isServiceValidForDeviceConfiguration(serviceName)) { + LOG(DEBUG) << "Skipped the test due to device configuration."; + GTEST_SKIP(); + } + sap = ISap::fromBinder(ndk::SpAIBinder(AServiceManager_waitForService(serviceName.c_str()))); + ASSERT_NE(sap.get(), nullptr); + + sapCb = ndk::SharedRefBase::make(*this); + ASSERT_NE(sapCb.get(), nullptr); + + count = 0; + + ndk::ScopedAStatus res = sap->setCallback(sapCb); + ASSERT_OK(res) << res; +} + +void SapTest::TearDown() {} + +::testing::AssertionResult SapTest::CheckAnyOfErrors(SapResultCode err, + std::vector errors) { + for (size_t i = 0; i < errors.size(); i++) { + if (err == errors[i]) { + return testing::AssertionSuccess(); + } + } + return testing::AssertionFailure() << "SapError:" + toString(err) + " is returned"; +} + +void SapTest::notify(int receivedSerial) { + std::unique_lock lock(mtx); + count++; + if (serial == receivedSerial) { + cv.notify_one(); + } +} + +std::cv_status SapTest::wait() { + std::unique_lock lock(mtx); + + std::cv_status status = std::cv_status::no_timeout; + auto now = std::chrono::system_clock::now(); + while (count == 0) { + status = cv.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD)); + if (status == std::cv_status::timeout) { + return status; + } + } + count--; + return status; +} + +/* + * Test ISap.connectReq() for the response returned. + */ +TEST_P(SapTest, connectReq) { + LOG(DEBUG) << "connectReq"; + serial = GetRandomSerialNumber(); + int32_t maxMsgSize = 100; + + ndk::ScopedAStatus res = sap->connectReq(serial, maxMsgSize); + ASSERT_OK(res) << res; + + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(sapCb->sapResponseSerial, serial); + + // Modem side need time for connect to finish. Adding a waiting time to prevent + // disconnect being requested right after connect request. + sleep(1); +} + +/* + * Test ISap.disconnectReq() for the response returned + */ +TEST_P(SapTest, disconnectReq) { + LOG(DEBUG) << "disconnectReq"; + serial = GetRandomSerialNumber(); + + ndk::ScopedAStatus res = sap->disconnectReq(serial); + ASSERT_OK(res) << res; + + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(sapCb->sapResponseSerial, serial); + LOG(DEBUG) << "disconnectReq finished"; +} + +/* + * Test ISap.apduReq() for the response returned. + */ +TEST_P(SapTest, apduReq) { + LOG(DEBUG) << "apduReq"; + serial = GetRandomSerialNumber(); + SapApduType sapApduType = SapApduType::APDU; + std::vector command = {}; + + ndk::ScopedAStatus res = sap->apduReq(serial, sapApduType, command); + ASSERT_OK(res) << res; + + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(sapCb->sapResponseSerial, serial); + + ASSERT_TRUE(CheckAnyOfErrors( + sapCb->sapResultCode, + {SapResultCode::GENERIC_FAILURE, SapResultCode::CARD_ALREADY_POWERED_OFF, + SapResultCode::CARD_NOT_ACCESSSIBLE, SapResultCode::CARD_REMOVED, + SapResultCode::SUCCESS})); + LOG(DEBUG) << "apduReq finished"; +} + +/* + * Test ISap.transferAtrReq() for the response returned. + */ +TEST_P(SapTest, transferAtrReq) { + LOG(DEBUG) << "transferAtrReq"; + serial = GetRandomSerialNumber(); + + ndk::ScopedAStatus res = sap->transferAtrReq(serial); + ASSERT_OK(res) << res; + + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(sapCb->sapResponseSerial, serial); + + ASSERT_TRUE(CheckAnyOfErrors(sapCb->sapResultCode, + {SapResultCode::GENERIC_FAILURE, SapResultCode::DATA_NOT_AVAILABLE, + SapResultCode::CARD_ALREADY_POWERED_OFF, + SapResultCode::CARD_REMOVED, SapResultCode::SUCCESS})); + LOG(DEBUG) << "transferAtrReq finished"; +} + +/* + * Test ISap.powerReq() for the response returned. + */ +TEST_P(SapTest, powerReq) { + LOG(DEBUG) << "powerReq"; + serial = GetRandomSerialNumber(); + bool state = true; + + ndk::ScopedAStatus res = sap->powerReq(serial, state); + ASSERT_OK(res) << res; + + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(sapCb->sapResponseSerial, serial); + + ASSERT_TRUE( + CheckAnyOfErrors(sapCb->sapResultCode, + {SapResultCode::GENERIC_FAILURE, SapResultCode::CARD_NOT_ACCESSSIBLE, + SapResultCode::CARD_ALREADY_POWERED_OFF, SapResultCode::CARD_REMOVED, + SapResultCode::CARD_ALREADY_POWERED_ON, SapResultCode::SUCCESS})); + LOG(DEBUG) << "powerReq finished"; +} + +/* + * Test ISap.resetSimReq() for the response returned. + */ +TEST_P(SapTest, resetSimReq) { + LOG(DEBUG) << "resetSimReq"; + serial = GetRandomSerialNumber(); + + ndk::ScopedAStatus res = sap->resetSimReq(serial); + ASSERT_OK(res) << res; + + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(sapCb->sapResponseSerial, serial); + + ASSERT_TRUE( + CheckAnyOfErrors(sapCb->sapResultCode, + {SapResultCode::GENERIC_FAILURE, SapResultCode::CARD_NOT_ACCESSSIBLE, + SapResultCode::CARD_ALREADY_POWERED_OFF, SapResultCode::CARD_REMOVED, + SapResultCode::SUCCESS})); + LOG(DEBUG) << "resetSimReq finished"; +} + +/* + * Test ISap.transferCardReaderStatusReq() for the response returned. + */ +TEST_P(SapTest, transferCardReaderStatusReq) { + LOG(DEBUG) << "transferCardReaderStatusReq"; + serial = GetRandomSerialNumber(); + + ndk::ScopedAStatus res = sap->transferCardReaderStatusReq(serial); + ASSERT_OK(res) << res; + + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(sapCb->sapResponseSerial, serial); + + ASSERT_TRUE(CheckAnyOfErrors(sapCb->sapResultCode, + {SapResultCode::GENERIC_FAILURE, SapResultCode::DATA_NOT_AVAILABLE, + SapResultCode::SUCCESS})); + LOG(DEBUG) << "transferCardReaderStatusReq finished"; +} + +/* + * Test ISap.setTransferProtocolReq() for the response returned. + */ +TEST_P(SapTest, setTransferProtocolReq) { + LOG(DEBUG) << "setTransferProtocolReq"; + serial = GetRandomSerialNumber(); + SapTransferProtocol sapTransferProtocol = SapTransferProtocol::T0; + + ndk::ScopedAStatus res = sap->setTransferProtocolReq(serial, sapTransferProtocol); + ASSERT_OK(res) << res; + + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(sapCb->sapResponseSerial, serial); + + ASSERT_TRUE(CheckAnyOfErrors(sapCb->sapResultCode, + {SapResultCode::NOT_SUPPORTED, SapResultCode::SUCCESS})); + LOG(DEBUG) << "setTransferProtocolReq finished"; +} diff --git a/radio/aidl/vts/radio_sap_utils.h b/radio/aidl/vts/radio_sap_utils.h new file mode 100644 index 0000000000..bf17006d66 --- /dev/null +++ b/radio/aidl/vts/radio_sap_utils.h @@ -0,0 +1,99 @@ +/* + * 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. + */ +#pragma once + +#include +#include +#include + +#include "radio_aidl_hal_utils.h" + +using namespace aidl::android::hardware::radio::sap; + +class SapTest; + +/* Callback class for radio sap response */ +class SapCallback : public BnSapCallback { + protected: + SapTest& parent_sap; + + public: + SapCallback(SapTest& parent_config); + virtual ~SapCallback() = default; + + int32_t sapResponseSerial; + SapResultCode sapResultCode; + + virtual ::ndk::ScopedAStatus apduResponse(int32_t serial, SapResultCode resultCode, + const std::vector& adpuRsp) override; + + virtual ::ndk::ScopedAStatus connectResponse(int32_t serial, SapConnectRsp sapConnectRsp, + int32_t maxMsgSize) override; + + virtual ::ndk::ScopedAStatus disconnectIndication(int32_t serial, + SapDisconnectType sapDisconnectType) override; + + virtual ::ndk::ScopedAStatus disconnectResponse(int32_t serial) override; + + virtual ::ndk::ScopedAStatus errorResponse(int32_t serial) override; + + virtual ::ndk::ScopedAStatus powerResponse(int32_t serial, SapResultCode resultCode) override; + + virtual ::ndk::ScopedAStatus resetSimResponse(int32_t serial, + SapResultCode resultCode) override; + + virtual ::ndk::ScopedAStatus statusIndication(int32_t serial, SapStatus sapStatus) override; + + virtual ::ndk::ScopedAStatus transferAtrResponse(int32_t serial, SapResultCode resultCode, + const std::vector& atr) override; + + virtual ::ndk::ScopedAStatus transferCardReaderStatusResponse( + int32_t serial, SapResultCode resultCode, int32_t cardReaderStatus) override; + + virtual ::ndk::ScopedAStatus transferProtocolResponse(int32_t serial, + SapResultCode resultCode) override; +}; + +// The main test class for AIDL SAP. +class SapTest : public ::testing::TestWithParam { + private: + std::mutex mtx; + std::condition_variable cv; + int count; + + public: + virtual void SetUp() override; + + virtual void TearDown() override; + + ::testing::AssertionResult CheckAnyOfErrors(SapResultCode err, + std::vector errors); + + /* Used as a mechanism to inform the test about data/event callback */ + void notify(int receivedSerial); + + /* Test code calls this function to wait for response */ + std::cv_status wait(); + + /* Sap service */ + std::shared_ptr sap; + + /* Sap Callback object */ + std::shared_ptr sapCb; + + /* Serial for sap request */ + int32_t serial; +}; From fff05cd6e18aae74ade346bcbfc4fc2fb0e6ed78 Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Mon, 22 Aug 2022 18:29:21 +0000 Subject: [PATCH 485/998] wifi: Add the connected frequency in the state change event Currently framework gets the connected AP frequency information by checking the scan cache & through signal poll command. But these mechanisms doesn't work if framework scan cache is not updated with the connected AP information (For example in case of roaming and force connection without scan). To fix this modified supplicant state change interface and included the frequency of the connected channel in the state change event. Bug: 240299862 Test: atest vts Test: Manual - Tested STA - AP connection and verfied the data from debug logs. Change-Id: I936bd3256420de38cdfee740e43972bc262ec4b8 --- .../ISupplicantStaIfaceCallback.aidl | 5 +- .../supplicant/SupplicantStateChangeData.aidl | 44 +++++++++++++ .../ISupplicantStaIfaceCallback.aidl | 35 +++------- .../supplicant/SupplicantStateChangeData.aidl | 65 +++++++++++++++++++ .../supplicant_sta_iface_aidl_test.cpp | 8 +-- 5 files changed, 126 insertions(+), 31 deletions(-) create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl create mode 100644 wifi/supplicant/aidl/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl index 0a2d428ae4..b54f04d2df 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl @@ -60,17 +60,20 @@ interface ISupplicantStaIfaceCallback { oneway void onNetworkNotFound(in byte[] ssid); oneway void onNetworkRemoved(in int id); oneway void onPmkCacheAdded(in long expirationTimeInSec, in byte[] serializedEntry); + /** + * @deprecated This callback is deprecated from AIDL v2, newer HAL should call onSupplicantStateChanged() + */ oneway void onStateChanged(in android.hardware.wifi.supplicant.StaIfaceCallbackState newState, in byte[] bssid, in int id, in byte[] ssid, in boolean filsHlpSent); oneway void onWpsEventFail(in byte[] bssid, in android.hardware.wifi.supplicant.WpsConfigError configError, in android.hardware.wifi.supplicant.WpsErrorIndication errorInd); oneway void onWpsEventPbcOverlap(); oneway void onWpsEventSuccess(); oneway void onQosPolicyReset(); oneway void onQosPolicyRequest(in int qosPolicyRequestId, in android.hardware.wifi.supplicant.QosPolicyData[] qosPolicyData); - oneway void onStateChangedWithAkm(in android.hardware.wifi.supplicant.StaIfaceCallbackState newState, in byte[] bssid, in int id, in byte[] ssid, in boolean filsHlpSent, in android.hardware.wifi.supplicant.KeyMgmtMask keyMgmtMask); oneway void onMloLinksInfoChanged(in android.hardware.wifi.supplicant.ISupplicantStaIfaceCallback.MloLinkInfoChangeReason reason); oneway void onDppConfigReceived(in android.hardware.wifi.supplicant.DppConfigurationData configData); oneway void onDppConnectionStatusResultSent(in android.hardware.wifi.supplicant.DppStatusErrorCode code); oneway void onBssFrequencyChanged(in int frequencyMhz); + oneway void onSupplicantStateChanged(in android.hardware.wifi.supplicant.SupplicantStateChangeData stateChangeData); @Backing(type="int") @VintfStability enum MloLinkInfoChangeReason { TID_TO_LINK_MAP = 0, diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl new file mode 100644 index 0000000000..e6bb859bc7 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable SupplicantStateChangeData { + android.hardware.wifi.supplicant.StaIfaceCallbackState newState; + int id; + byte[] ssid; + byte[] bssid; + android.hardware.wifi.supplicant.KeyMgmtMask keyMgmtMask; + int frequencyMhz; + boolean filsHlpSent; +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl index 7d46649033..5001800e11 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl @@ -29,11 +29,11 @@ import android.hardware.wifi.supplicant.DppFailureCode; import android.hardware.wifi.supplicant.DppProgressCode; import android.hardware.wifi.supplicant.DppStatusErrorCode; import android.hardware.wifi.supplicant.Hs20AnqpData; -import android.hardware.wifi.supplicant.KeyMgmtMask; import android.hardware.wifi.supplicant.OsuMethod; import android.hardware.wifi.supplicant.QosPolicyData; import android.hardware.wifi.supplicant.StaIfaceCallbackState; import android.hardware.wifi.supplicant.StaIfaceReasonCode; +import android.hardware.wifi.supplicant.SupplicantStateChangeData; import android.hardware.wifi.supplicant.WpsConfigError; import android.hardware.wifi.supplicant.WpsErrorIndication; @@ -259,7 +259,8 @@ oneway interface ISupplicantStaIfaceCallback { * |ssid|, |bssid| parameters must indicate the parameters of the network/AP * which caused this state transition. *

- * This callback is deprecated from AIDL v2, newer HAL should call onStateChangedWithAkm(). + * @deprecated This callback is deprecated from AIDL v2, newer HAL should call + * onSupplicantStateChanged() * * @param newState New State of the interface. This must be one of the |State| * values above. @@ -312,29 +313,6 @@ oneway interface ISupplicantStaIfaceCallback { */ void onQosPolicyRequest(in int qosPolicyRequestId, in QosPolicyData[] qosPolicyData); - /** - * Used to indicate a state change event on this particular iface. If this - * event is triggered by a particular network, the |id|, - * |ssid|, |bssid| parameters must indicate the parameters of the network/AP - * which caused this state transition. - * - * @param newState New State of the interface. This must be one of the - * |StaIfaceCallbackState| values above. - * @param bssid BSSID of the corresponding AP which caused this state - * change event. This must be zero'ed if this event is not - * specific to a particular network. - * @param id ID of the corresponding network which caused this - * state change event. This must be invalid (-1) if this - * event is not specific to a particular network. - * @param ssid SSID of the corresponding network which caused this state - * change event. This must be empty if this event is not specific - * to a particular network. - * @param filsHlpSent Whether FILS HLP IEs were included in this association. - * @param keyMgmtMask current used key mgmt mask. - */ - void onStateChangedWithAkm(in StaIfaceCallbackState newState, in byte[] bssid, in int id, - in byte[] ssid, in boolean filsHlpSent, in KeyMgmtMask keyMgmtMask); - /** * Reason codes to be used with the callback |ISupplicantStaIfaceCallback.onMloLinksInfoChanged| */ @@ -393,4 +371,11 @@ oneway interface ISupplicantStaIfaceCallback { * @param frequencyMhz New operating frequency in MHz. */ void onBssFrequencyChanged(in int frequencyMhz); + + /** + * Used to indicate a state change event on this particular iface. + * + * @param stateChangeData Supplicant state change related information. + */ + void onSupplicantStateChanged(in SupplicantStateChangeData stateChangeData); } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl new file mode 100644 index 0000000000..8fa5dc77a1 --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl @@ -0,0 +1,65 @@ +/* + * 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. + */ + +package android.hardware.wifi.supplicant; + +import android.hardware.wifi.supplicant.KeyMgmtMask; +import android.hardware.wifi.supplicant.StaIfaceCallbackState; + +/** + * Supplicant state change related information. + */ +@VintfStability +parcelable SupplicantStateChangeData { + /** + * New State of the interface. This must be one of the + * |StaIfaceCallbackState| values. + */ + StaIfaceCallbackState newState; + /** + * ID of the corresponding network which caused this + * state change event. This must be invalid (-1) if this + * event is not specific to a particular network. + */ + int id; + /** + * SSID of the corresponding network which caused this state + * change event. This must be empty if this event is not specific + * to a particular network. + */ + byte[] ssid; + /** + * BSSID of the corresponding AP which caused this state + * change event. This must be zero'ed if this event is not + * specific to a particular network. + */ + byte[/* 6 */] bssid; + + /** + * Currently used key mgmt mask. + */ + KeyMgmtMask keyMgmtMask; + /* + * Frequency of the connected channel in MHz. This must be zero if this + * event is not specific to a particular network. + */ + int frequencyMhz; + /* + * Flag to indicate that FILS HLP IEs were included in this association. + * This flag is valid only for WPA_COMPLETED state change. + */ + boolean filsHlpSent; +} diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp index e957834eab..d5366180ce 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp +++ b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp @@ -206,11 +206,9 @@ class SupplicantStaIfaceCallback : public BnSupplicantStaIfaceCallback { QosPolicyData /* qosPolicyData */>&) override { return ndk::ScopedAStatus::ok(); } - ::ndk::ScopedAStatus onStateChangedWithAkm( - ::aidl::android::hardware::wifi::supplicant::StaIfaceCallbackState /* newState */, - const std::vector& /* bssid */, int32_t /* id */, - const std::vector& /* ssid */, bool /* filsHlpSent */, - ::aidl::android::hardware::wifi::supplicant::KeyMgmtMask /* keyMgmtMask*/) override { + ::ndk::ScopedAStatus onSupplicantStateChanged( + const ::aidl::android::hardware::wifi::supplicant:: + SupplicantStateChangeData& /* stateChangeData */) override { return ndk::ScopedAStatus::ok(); } ::ndk::ScopedAStatus onMloLinksInfoChanged( From 800d77ccaefd985113db91b4c539e401e9777afc Mon Sep 17 00:00:00 2001 From: John Reck Date: Thu, 8 Dec 2022 14:03:24 -0500 Subject: [PATCH 486/998] Add libui requirements Test: make Change-Id: I78a3a7239b07976ad1ab0fc89c017a1defee2587 --- graphics/mapper/stable-c/Android.bp | 14 ++++++++++++++ .../graphics/mapper/utils/IMapperMetadataTypes.h | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/graphics/mapper/stable-c/Android.bp b/graphics/mapper/stable-c/Android.bp index fa3087a62d..1d01a02707 100644 --- a/graphics/mapper/stable-c/Android.bp +++ b/graphics/mapper/stable-c/Android.bp @@ -33,6 +33,13 @@ cc_library_headers { export_header_lib_headers: [ "libarect_headers", ], + // TODO(b/214400477) Remove apex_available + apex_available: [ + "//apex_available:platform", + "com.android.media.swcodec", + "test_com.android.media.swcodec", + ], + min_sdk_version: "29", } cc_library_shared { @@ -66,6 +73,13 @@ cc_library_headers { "libbase_headers", "libimapper_stablec", ], + // TODO(b/214400477) Remove apex_available + apex_available: [ + "//apex_available:platform", + "com.android.media.swcodec", + "test_com.android.media.swcodec", + ], + min_sdk_version: "29", } cc_test { diff --git a/graphics/mapper/stable-c/implutils/include/android/hardware/graphics/mapper/utils/IMapperMetadataTypes.h b/graphics/mapper/stable-c/implutils/include/android/hardware/graphics/mapper/utils/IMapperMetadataTypes.h index 25af6d1158..102dadab98 100644 --- a/graphics/mapper/stable-c/implutils/include/android/hardware/graphics/mapper/utils/IMapperMetadataTypes.h +++ b/graphics/mapper/stable-c/implutils/include/android/hardware/graphics/mapper/utils/IMapperMetadataTypes.h @@ -566,6 +566,8 @@ DEFINE_TYPE(SMPTE2094_40, std::optional>); #undef DEFINE_TYPE +#if defined(__cplusplus) && __cplusplus >= 202002L + template void invokeWithStandardMetadata(F&& f, StandardMetadataType type, std::index_sequence) { // Setup the jump table, mapping from each type to a springboard that invokes the template @@ -620,4 +622,6 @@ AIMapper_Error applyStandardMetadata(StandardMetadataType type, const void* _Non return retVal; } +#endif + } // namespace android::hardware::graphics::mapper \ No newline at end of file From b099c1e9ef09056737cbcbf395c58d96187c983b Mon Sep 17 00:00:00 2001 From: jiabin Date: Tue, 13 Dec 2022 23:17:33 +0000 Subject: [PATCH 487/998] Add AUDIO_ENCAPSULATION_TYPE_PCM. Bug: 239435816 Test: n/a Change-Id: I42ccbed4d0b2a2cd7d704ac42b1aa25b1e128de3 --- audio/aidl/default/config/audioPolicy/api/current.txt | 1 + .../default/config/audioPolicy/audio_policy_configuration.xsd | 1 + 2 files changed, 2 insertions(+) diff --git a/audio/aidl/default/config/audioPolicy/api/current.txt b/audio/aidl/default/config/audioPolicy/api/current.txt index c0ffe70eb8..96cea88ee2 100644 --- a/audio/aidl/default/config/audioPolicy/api/current.txt +++ b/audio/aidl/default/config/audioPolicy/api/current.txt @@ -167,6 +167,7 @@ package android.audio.policy.configuration { method @NonNull public String getRawName(); enum_constant public static final android.audio.policy.configuration.AudioEncapsulationType AUDIO_ENCAPSULATION_TYPE_IEC61937; enum_constant public static final android.audio.policy.configuration.AudioEncapsulationType AUDIO_ENCAPSULATION_TYPE_NONE; + enum_constant public static final android.audio.policy.configuration.AudioEncapsulationType AUDIO_ENCAPSULATION_TYPE_PCM; } public enum AudioFormat { diff --git a/audio/aidl/default/config/audioPolicy/audio_policy_configuration.xsd b/audio/aidl/default/config/audioPolicy/audio_policy_configuration.xsd index 2c18a1e455..a51f75fa99 100644 --- a/audio/aidl/default/config/audioPolicy/audio_policy_configuration.xsd +++ b/audio/aidl/default/config/audioPolicy/audio_policy_configuration.xsd @@ -575,6 +575,7 @@ + From 90bf9095167d0478c0ae4371ac82daf22a4efc73 Mon Sep 17 00:00:00 2001 From: Kangping Dong Date: Wed, 14 Dec 2022 12:23:12 +0800 Subject: [PATCH 488/998] add OWNERS file for the threadnetwork HAL project Test: N/A Bug: 262471085 Change-Id: I024e7d5c1fe3adf7ae03f77d1580bd1f19f750c1 --- threadnetwork/OWNERS | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 threadnetwork/OWNERS diff --git a/threadnetwork/OWNERS b/threadnetwork/OWNERS new file mode 100644 index 0000000000..54fd66db82 --- /dev/null +++ b/threadnetwork/OWNERS @@ -0,0 +1,3 @@ +# Bug component: 1288834 + +include platform/packages/modules/ThreadNetwork:/OWNERS From 10905ef92e086e7f7d63d674d5f00bd83a976551 Mon Sep 17 00:00:00 2001 From: Vlad Popa Date: Mon, 7 Nov 2022 13:53:57 +0100 Subject: [PATCH 489/998] Add HAL interface definition for sound dose The interface is used to configure the sound dose parameters and retrieve new changes that can affect the dose. Used for the certification with IEC62368-1 3rd edition. Test: TODO Bug: 257937004 Change-Id: Id2816580fdbfbf09c2278720b4d78d0b3604fbf4 --- audio/aidl/Android.bp | 1 + .../android/hardware/audio/core/IModule.aidl | 1 + .../hardware/audio/core/ISoundDose.aidl | 52 +++++++++ .../android/hardware/audio/core/IModule.aidl | 16 +++ .../hardware/audio/core/ISoundDose.aidl | 104 ++++++++++++++++++ audio/aidl/default/Module.cpp | 6 + audio/aidl/default/include/core-impl/Module.h | 1 + 7 files changed, 181 insertions(+) create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ISoundDose.aidl create mode 100644 audio/aidl/android/hardware/audio/core/ISoundDose.aidl diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index 6b948dd677..2ed711a45c 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -114,6 +114,7 @@ aidl_interface { "android/hardware/audio/core/AudioRoute.aidl", "android/hardware/audio/core/IConfig.aidl", "android/hardware/audio/core/IModule.aidl", + "android/hardware/audio/core/ISoundDose.aidl", "android/hardware/audio/core/IStreamCallback.aidl", "android/hardware/audio/core/IStreamIn.aidl", "android/hardware/audio/core/IStreamOut.aidl", diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl index 0c7ca27c61..42b12d94b3 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl @@ -60,6 +60,7 @@ interface IModule { void updateAudioMode(android.hardware.audio.core.AudioMode mode); void updateScreenRotation(android.hardware.audio.core.IModule.ScreenRotation rotation); void updateScreenState(boolean isTurnedOn); + @nullable android.hardware.audio.core.ISoundDose getSoundDose(); @VintfStability parcelable OpenInputStreamArguments { int portConfigId; diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ISoundDose.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ISoundDose.aidl new file mode 100644 index 0000000000..bc010caaf5 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ISoundDose.aidl @@ -0,0 +1,52 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@VintfStability +interface ISoundDose { + void setOutputRs2(float rs2ValueDbA); + float getOutputRs2(); + void registerSoundDoseCallback(in android.hardware.audio.core.ISoundDose.IHalSoundDoseCallback callback); + const int DEFAULT_MAX_RS2 = 100; + const int MIN_RS2 = 80; + @VintfStability + interface IHalSoundDoseCallback { + oneway void onMomentaryExposureWarning(float currentDbA, in android.media.audio.common.AudioDevice audioDevice); + oneway void onNewMelValues(in android.hardware.audio.core.ISoundDose.IHalSoundDoseCallback.MelRecord melRecord, in android.media.audio.common.AudioDevice audioDevice); + @VintfStability + parcelable MelRecord { + float[] melValues; + long timestamp; + } + } +} diff --git a/audio/aidl/android/hardware/audio/core/IModule.aidl b/audio/aidl/android/hardware/audio/core/IModule.aidl index 786d5eecbe..2d34df6297 100644 --- a/audio/aidl/android/hardware/audio/core/IModule.aidl +++ b/audio/aidl/android/hardware/audio/core/IModule.aidl @@ -21,6 +21,7 @@ import android.hardware.audio.common.SourceMetadata; import android.hardware.audio.core.AudioMode; import android.hardware.audio.core.AudioPatch; import android.hardware.audio.core.AudioRoute; +import android.hardware.audio.core.ISoundDose; import android.hardware.audio.core.IStreamCallback; import android.hardware.audio.core.IStreamIn; import android.hardware.audio.core.IStreamOut; @@ -668,4 +669,19 @@ interface IModule { * @param isTurnedOn True if the screen is turned on. */ void updateScreenState(boolean isTurnedOn); + + /** + * Retrieve the sound dose interface. + * + * If a device must comply to IEC62368-1 3rd edition audio safety requirements and is + * implementing audio offload decoding or other direct playback paths where volume control + * happens below the audio HAL, it must return an instance of the ISoundDose interface. + * The same instance must be returned during the lifetime of the HAL module. + * If the HAL module does not support sound dose, null must be returned, without throwing + * any errors. + * + * @return An instance of the ISoundDose interface implementation. + * @throws EX_ILLEGAL_STATE If there was an error creating an instance. + */ + @nullable ISoundDose getSoundDose(); } diff --git a/audio/aidl/android/hardware/audio/core/ISoundDose.aidl b/audio/aidl/android/hardware/audio/core/ISoundDose.aidl new file mode 100644 index 0000000000..89fd69b80f --- /dev/null +++ b/audio/aidl/android/hardware/audio/core/ISoundDose.aidl @@ -0,0 +1,104 @@ +/* + * 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. + */ + +package android.hardware.audio.core; + +import android.media.audio.common.AudioDevice; + +/** + * This interface provides functions related to sound exposure control required for compliance to + * EN/IEC 62368-1 3rd edition. Implementing this interface is mandatory for devices for which + * compliance to this standard is mandated and implementing audio offload decoding or other direct + * playback paths where volume control happens below the audio HAL. + */ +@VintfStability +interface ISoundDose { + /** + * Max value in dBA used for momentary exposure warnings as defined by IEC62368-1 + * 3rd edition. This value represents the default RS2 value. + */ + const int DEFAULT_MAX_RS2 = 100; + /** Min value of the RS2 threshold in dBA as defined by IEC62368-1 3rd edition. */ + const int MIN_RS2 = 80; + + /** + * Sets the RS2 value used for momentary exposure warnings. Default value is + * DEFAULT_MAX_RS2 as specified in IEC62368-1 3rd edition. + * + * @param rs2ValueDbA custom RS2 value to use. Must not be higher than DEFAULT_MAX_RS2 + * @throws EX_ILLEGAL_ARGUMENT if rs2ValueDbA is greater than DEFAULT_MAX_RS2 or lower + * than 80dBA + */ + void setOutputRs2(float rs2ValueDbA); + + /** + * Gets the RS2 value used for momentary exposure warnings. + * + * @return the RS2 value in dBA + */ + float getOutputRs2(); + + /** + * Registers the HAL callback for sound dose computation. If sound dose is supported + * the MEL values and exposure notifications will be received through this callback + * only. The internal framework MEL computation will be disabled. + * It is not possible to unregister the callback. The HAL is responsible to provide + * the MEL values throughout its lifecycle. + * This method should only be called once (no updates allowed) with a valid callback. + * + * @param callback to use when new updates are available for sound dose + * @throws EX_ILLEGAL_STATE if the method is called more than once + * @throws EX_ILLEGAL_ARGUMENT if the passed callback is null + */ + void registerSoundDoseCallback(in IHalSoundDoseCallback callback); + + @VintfStability + oneway interface IHalSoundDoseCallback { + /** + * Called whenever the current MEL value exceeds the set RS2 value. + * + * @param currentDbA the current MEL value which exceeds the RS2 value + * @param audioDevice the audio device where the MEL exposure warning was recorded + */ + void onMomentaryExposureWarning(float currentDbA, in AudioDevice audioDevice); + + @VintfStability + parcelable MelRecord { + /** + * Array of continuously recorded MEL values >= RS1 (1 per second). + * First value in the array was recorded at 'timestamp'. + */ + float[] melValues; + /** + * Corresponds to the time in seconds when the first MEL entry in melValues + * was recorded. The timestamp values have to be consistent throughout all + * audio ports, equal timestamp values will be aggregated. + */ + long timestamp; + } + + /** + * Provides a MelRecord containing continuous MEL values sorted by timestamp. + * Note that all the MEL values originate from the audio device specified by audioDevice. + * In case values from multiple devices need to be reported, the caller should execute + * this callback once for every device. + * + * @param melRecord contains the MEL values used for CSD + * @param audioDevice the audio device where the MEL values were recorded + */ + void onNewMelValues(in MelRecord melRecord, in AudioDevice audioDevice); + } +} diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp index 47d6fa44be..2b199dcd35 100644 --- a/audio/aidl/default/Module.cpp +++ b/audio/aidl/default/Module.cpp @@ -931,4 +931,10 @@ ndk::ScopedAStatus Module::updateScreenState(bool in_isTurnedOn) { return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus Module::getSoundDose(std::shared_ptr* _aidl_return) { + *_aidl_return = nullptr; + LOG(DEBUG) << __func__ << ": ISoundDose not implemented"; + return ndk::ScopedAStatus::ok(); +} + } // namespace aidl::android::hardware::audio::core diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h index 52fb54ca9d..de1fbe810e 100644 --- a/audio/aidl/default/include/core-impl/Module.h +++ b/audio/aidl/default/include/core-impl/Module.h @@ -86,6 +86,7 @@ class Module : public BnModule { ndk::ScopedAStatus updateScreenRotation( ::aidl::android::hardware::audio::core::IModule::ScreenRotation in_rotation) override; ndk::ScopedAStatus updateScreenState(bool in_isTurnedOn) override; + ndk::ScopedAStatus getSoundDose(std::shared_ptr* _aidl_return) override; void cleanUpPatch(int32_t patchId); ndk::ScopedAStatus createStreamContext( From 9460e189fa4e9e320fc3991fdf86e1c2272da505 Mon Sep 17 00:00:00 2001 From: shrikar Date: Tue, 6 Dec 2022 13:47:42 -0800 Subject: [PATCH 490/998] Change min/max values to match config array in DefaultProperties.json Bug: 261481870 Test: atest CarPropertyManagerTest Change-Id: Ifcd9f5a545748360b49a89ab63a5642887eca6da --- .../aidl/impl/default_config/config/DefaultProperties.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index bd80ad5442..7ad8089d12 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1920,7 +1920,7 @@ }, "areaId": 49, "minFloatValue": 16.0, - "maxFloatValue": 32.0 + "maxFloatValue": 28.0 }, { "defaultValue": { @@ -1930,9 +1930,10 @@ }, "areaId": 68, "minFloatValue": 16.0, - "maxFloatValue": 32.0 + "maxFloatValue": 28.0 } ], + "comment": "minFloatValue and maxFloatValue in area config should match corresponding values in configArray", "configArray": [ 160, 280, From 83a214654617f504f7e81b293749b9bb61fee30e Mon Sep 17 00:00:00 2001 From: Vlad Popa Date: Thu, 8 Dec 2022 14:24:12 +0100 Subject: [PATCH 491/998] Add default implementation and VTS for ISoundDose The ISoundDose HAL interface is used for reporting the sound dose relevant information from/to the HAL. This is necessary for all devices that certify with the IEC62368-1 3rd edition and EN50332-3 standard for safe hearing. Bug: 248567177 Test: atest VtsHalAudioCoreTargetTest Change-Id: Ib89e09243a01cebc2f7996b6b572384a1471867a --- audio/aidl/default/Android.bp | 1 + audio/aidl/default/Module.cpp | 8 +- audio/aidl/default/SoundDose.cpp | 57 ++++++++++++ audio/aidl/default/include/core-impl/Module.h | 1 + .../default/include/core-impl/SoundDose.h | 42 +++++++++ .../vts/VtsHalAudioCoreModuleTargetTest.cpp | 92 +++++++++++++++++++ 6 files changed, 199 insertions(+), 2 deletions(-) create mode 100644 audio/aidl/default/SoundDose.cpp create mode 100644 audio/aidl/default/include/core-impl/SoundDose.h diff --git a/audio/aidl/default/Android.bp b/audio/aidl/default/Android.bp index f2cebbfe73..b9b8cd8ce2 100644 --- a/audio/aidl/default/Android.bp +++ b/audio/aidl/default/Android.bp @@ -43,6 +43,7 @@ cc_library_static { "Configuration.cpp", "EngineConfigXmlConverter.cpp", "Module.cpp", + "SoundDose.cpp", "Stream.cpp", "Telephony.cpp", ], diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp index 2b199dcd35..86f0261d2a 100644 --- a/audio/aidl/default/Module.cpp +++ b/audio/aidl/default/Module.cpp @@ -26,6 +26,7 @@ #include #include "core-impl/Module.h" +#include "core-impl/SoundDose.h" #include "core-impl/Telephony.h" #include "core-impl/utils.h" @@ -932,8 +933,11 @@ ndk::ScopedAStatus Module::updateScreenState(bool in_isTurnedOn) { } ndk::ScopedAStatus Module::getSoundDose(std::shared_ptr* _aidl_return) { - *_aidl_return = nullptr; - LOG(DEBUG) << __func__ << ": ISoundDose not implemented"; + if (mSoundDose == nullptr) { + mSoundDose = ndk::SharedRefBase::make(); + } + *_aidl_return = mSoundDose; + LOG(DEBUG) << __func__ << ": returning instance of ISoundDose: " << _aidl_return->get(); return ndk::ScopedAStatus::ok(); } diff --git a/audio/aidl/default/SoundDose.cpp b/audio/aidl/default/SoundDose.cpp new file mode 100644 index 0000000000..3d222a8280 --- /dev/null +++ b/audio/aidl/default/SoundDose.cpp @@ -0,0 +1,57 @@ +/* + * 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. + */ + +#define LOG_TAG "AHAL_SoundDose" + +#include "core-impl/SoundDose.h" + +#include + +namespace aidl::android::hardware::audio::core { + +ndk::ScopedAStatus SoundDose::setOutputRs2(float in_rs2ValueDbA) { + if (in_rs2ValueDbA < MIN_RS2 || in_rs2ValueDbA > DEFAULT_MAX_RS2) { + LOG(ERROR) << __func__ << ": RS2 value is invalid: " << in_rs2ValueDbA; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + + mRs2Value = in_rs2ValueDbA; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus SoundDose::getOutputRs2(float* _aidl_return) { + *_aidl_return = mRs2Value; + LOG(DEBUG) << __func__ << ": returning " << *_aidl_return; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus SoundDose::registerSoundDoseCallback( + const std::shared_ptr& in_callback) { + if (in_callback.get() == nullptr) { + LOG(ERROR) << __func__ << ": Callback is nullptr"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (mCallback != nullptr) { + LOG(ERROR) << __func__ << ": Sound dose callback was already registered"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } + + mCallback = in_callback; + LOG(DEBUG) << __func__ << ": Registered sound dose callback "; + return ndk::ScopedAStatus::ok(); +} + +} // namespace aidl::android::hardware::audio::core diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h index de1fbe810e..3cc31c5871 100644 --- a/audio/aidl/default/include/core-impl/Module.h +++ b/audio/aidl/default/include/core-impl/Module.h @@ -124,6 +124,7 @@ class Module : public BnModule { bool mMasterMute = false; float mMasterVolume = 1.0f; bool mMicMute = false; + std::shared_ptr mSoundDose; }; } // namespace aidl::android::hardware::audio::core diff --git a/audio/aidl/default/include/core-impl/SoundDose.h b/audio/aidl/default/include/core-impl/SoundDose.h new file mode 100644 index 0000000000..54a6cbf1b8 --- /dev/null +++ b/audio/aidl/default/include/core-impl/SoundDose.h @@ -0,0 +1,42 @@ +/* + * 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. + */ + +#pragma once + +#include + +#include +#include + +using aidl::android::media::audio::common::AudioDevice; + +namespace aidl::android::hardware::audio::core { + +class SoundDose : public BnSoundDose { + public: + SoundDose() : mRs2Value(DEFAULT_MAX_RS2){}; + + ndk::ScopedAStatus setOutputRs2(float in_rs2ValueDbA) override; + ndk::ScopedAStatus getOutputRs2(float* _aidl_return) override; + ndk::ScopedAStatus registerSoundDoseCallback( + const std::shared_ptr& in_callback) override; + + private: + std::shared_ptr mCallback; + float mRs2Value; +}; + +} // namespace aidl::android::hardware::audio::core diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp index 99771e6cb1..5dadea384e 100644 --- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -56,6 +57,7 @@ using aidl::android::hardware::audio::core::AudioMode; using aidl::android::hardware::audio::core::AudioPatch; using aidl::android::hardware::audio::core::AudioRoute; using aidl::android::hardware::audio::core::IModule; +using aidl::android::hardware::audio::core::ISoundDose; using aidl::android::hardware::audio::core::IStreamIn; using aidl::android::hardware::audio::core::IStreamOut; using aidl::android::hardware::audio::core::ITelephony; @@ -2468,6 +2470,92 @@ TEST_P(AudioModulePatch, ResetInvalidPatchId) { } } +class AudioCoreSoundDose : public AudioCoreModuleBase, public testing::TestWithParam { + public: + class NoOpHalSoundDoseCallback : public ISoundDose::BnHalSoundDoseCallback { + public: + ndk::ScopedAStatus onMomentaryExposureWarning(float in_currentDbA, + const AudioDevice& in_audioDevice) override; + ndk::ScopedAStatus onNewMelValues( + const ISoundDose::IHalSoundDoseCallback::MelRecord& in_melRecord, + const AudioDevice& in_audioDevice) override; + }; + + void SetUp() override { + ASSERT_NO_FATAL_FAILURE(SetUpImpl(GetParam())); + ASSERT_IS_OK(module->getSoundDose(&soundDose)); + callback = ndk::SharedRefBase::make(); + } + + void TearDown() override { ASSERT_NO_FATAL_FAILURE(TearDownImpl()); } + + std::shared_ptr soundDose; + std::shared_ptr callback; +}; + +ndk::ScopedAStatus AudioCoreSoundDose::NoOpHalSoundDoseCallback::onMomentaryExposureWarning( + float in_currentDbA, const AudioDevice& in_audioDevice) { + // Do nothing + (void)in_currentDbA; + (void)in_audioDevice; + LOG(INFO) << "NoOpHalSoundDoseCallback::onMomentaryExposureWarning called"; + + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus AudioCoreSoundDose::NoOpHalSoundDoseCallback::onNewMelValues( + const ISoundDose::IHalSoundDoseCallback::MelRecord& in_melRecord, + const AudioDevice& in_audioDevice) { + // Do nothing + (void)in_melRecord; + (void)in_audioDevice; + LOG(INFO) << "NoOpHalSoundDoseCallback::onNewMelValues called"; + + return ndk::ScopedAStatus::ok(); +} + +TEST_P(AudioCoreSoundDose, GetSetOutputRs2) { + if (soundDose == nullptr) { + GTEST_SKIP() << "SoundDose is not supported"; + } + + bool isSupported = false; + EXPECT_NO_FATAL_FAILURE(TestAccessors(soundDose.get(), &ISoundDose::getOutputRs2, + &ISoundDose::setOutputRs2, + /*validValues=*/{80.f, 90.f, 100.f}, + /*invalidValues=*/{79.f, 101.f}, &isSupported)); + EXPECT_TRUE(isSupported) << "Getting/Setting RS2 must be supported"; +} + +TEST_P(AudioCoreSoundDose, CheckDefaultRs2Value) { + if (soundDose == nullptr) { + GTEST_SKIP() << "SoundDose is not supported"; + } + + float rs2Value; + ASSERT_IS_OK(soundDose->getOutputRs2(&rs2Value)); + EXPECT_EQ(rs2Value, ISoundDose::DEFAULT_MAX_RS2); +} + +TEST_P(AudioCoreSoundDose, RegisterSoundDoseCallbackTwiceThrowsException) { + if (soundDose == nullptr) { + GTEST_SKIP() << "SoundDose is not supported"; + } + + ASSERT_IS_OK(soundDose->registerSoundDoseCallback(callback)); + EXPECT_STATUS(EX_ILLEGAL_STATE, soundDose->registerSoundDoseCallback(callback)) + << "Registering sound dose callback twice should throw EX_ILLEGAL_STATE"; +} + +TEST_P(AudioCoreSoundDose, RegisterSoundDoseNullCallbackThrowsException) { + if (soundDose == nullptr) { + GTEST_SKIP() << "SoundDose is not supported"; + } + + EXPECT_STATUS(EX_ILLEGAL_ARGUMENT, soundDose->registerSoundDoseCallback(nullptr)) + << "Registering nullptr sound dose callback should throw EX_ILLEGAL_ARGUMENT"; +} + INSTANTIATE_TEST_SUITE_P(AudioCoreModuleTest, AudioCoreModule, testing::ValuesIn(android::getAidlHalInstanceNames(IModule::descriptor)), android::PrintInstanceNameToString); @@ -2484,6 +2572,10 @@ INSTANTIATE_TEST_SUITE_P(AudioStreamOutTest, AudioStreamOut, testing::ValuesIn(android::getAidlHalInstanceNames(IModule::descriptor)), android::PrintInstanceNameToString); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioStreamOut); +INSTANTIATE_TEST_SUITE_P(AudioCoreSoundDoseTest, AudioCoreSoundDose, + testing::ValuesIn(android::getAidlHalInstanceNames(IModule::descriptor)), + android::PrintInstanceNameToString); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioCoreSoundDose); // This is the value used in test sequences for which the test needs to ensure // that the HAL stays in a transient state long enough to receive the next command. From ba4d7fe33762cd773d8da2820df0a5fc463d406b Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Thu, 3 Nov 2022 09:56:07 -0700 Subject: [PATCH 492/998] wifi: Fix unit test for LegacyLinkLayerStats Due to the introduction of multi links, StaLinkLayerStats carries stats for multiple links as a vector. For LegacyLinkLayerStats, only single link will be available. So convertLegacyLinkLayerStatsToAidl() push the stats for single link as the first element of the link vector.Fix the unit test to index the first link. Bug: 246988155 Test: hardware/interfaces/wifi/aidl/default/tests/runtests.sh Change-Id: I8c9a8beca6bda6cf894edb616cdfe54f09d029f7 --- .../tests/aidl_struct_util_unit_tests.cpp | 93 ++++++++++--------- 1 file changed, 47 insertions(+), 46 deletions(-) diff --git a/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp index 4a69c2426b..21b8d2d555 100644 --- a/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp +++ b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp @@ -215,78 +215,79 @@ TEST_F(AidlStructUtilTest, canConvertLegacyLinkLayerStatsToAidl) { StaLinkLayerStats converted{}; aidl_struct_util::convertLegacyLinkLayerStatsToAidl(legacy_stats, &converted); - EXPECT_EQ(legacy_stats.iface.beacon_rx, (uint32_t)converted.iface.beaconRx); - EXPECT_EQ(legacy_stats.iface.rssi_mgmt, converted.iface.avgRssiMgmt); + EXPECT_EQ(0, converted.iface.links[0].linkId); + EXPECT_EQ(legacy_stats.iface.beacon_rx, (uint32_t)converted.iface.links[0].beaconRx); + EXPECT_EQ(legacy_stats.iface.rssi_mgmt, converted.iface.links[0].avgRssiMgmt); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].rx_mpdu, - converted.iface.wmeBePktStats.rxMpdu); + converted.iface.links[0].wmeBePktStats.rxMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].tx_mpdu, - converted.iface.wmeBePktStats.txMpdu); + converted.iface.links[0].wmeBePktStats.txMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].mpdu_lost, - converted.iface.wmeBePktStats.lostMpdu); + converted.iface.links[0].wmeBePktStats.lostMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].retries, - converted.iface.wmeBePktStats.retries); + converted.iface.links[0].wmeBePktStats.retries); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_min, - (uint32_t)converted.iface.wmeBeContentionTimeStats.contentionTimeMinInUsec); + (uint32_t)converted.iface.links[0].wmeBeContentionTimeStats.contentionTimeMinInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_max, - (uint32_t)converted.iface.wmeBeContentionTimeStats.contentionTimeMaxInUsec); + (uint32_t)converted.iface.links[0].wmeBeContentionTimeStats.contentionTimeMaxInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_avg, - (uint32_t)converted.iface.wmeBeContentionTimeStats.contentionTimeAvgInUsec); + (uint32_t)converted.iface.links[0].wmeBeContentionTimeStats.contentionTimeAvgInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_num_samples, - (uint32_t)converted.iface.wmeBeContentionTimeStats.contentionNumSamples); + (uint32_t)converted.iface.links[0].wmeBeContentionTimeStats.contentionNumSamples); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].rx_mpdu, - converted.iface.wmeBkPktStats.rxMpdu); + converted.iface.links[0].wmeBkPktStats.rxMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].tx_mpdu, - converted.iface.wmeBkPktStats.txMpdu); + converted.iface.links[0].wmeBkPktStats.txMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].mpdu_lost, - converted.iface.wmeBkPktStats.lostMpdu); + converted.iface.links[0].wmeBkPktStats.lostMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].retries, - converted.iface.wmeBkPktStats.retries); + converted.iface.links[0].wmeBkPktStats.retries); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_min, - (uint32_t)converted.iface.wmeBkContentionTimeStats.contentionTimeMinInUsec); + (uint32_t)converted.iface.links[0].wmeBkContentionTimeStats.contentionTimeMinInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_max, - (uint32_t)converted.iface.wmeBkContentionTimeStats.contentionTimeMaxInUsec); + (uint32_t)converted.iface.links[0].wmeBkContentionTimeStats.contentionTimeMaxInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_avg, - (uint32_t)converted.iface.wmeBkContentionTimeStats.contentionTimeAvgInUsec); + (uint32_t)converted.iface.links[0].wmeBkContentionTimeStats.contentionTimeAvgInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_num_samples, - (uint32_t)converted.iface.wmeBkContentionTimeStats.contentionNumSamples); + (uint32_t)converted.iface.links[0].wmeBkContentionTimeStats.contentionNumSamples); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].rx_mpdu, - converted.iface.wmeViPktStats.rxMpdu); + converted.iface.links[0].wmeViPktStats.rxMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].tx_mpdu, - converted.iface.wmeViPktStats.txMpdu); + converted.iface.links[0].wmeViPktStats.txMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].mpdu_lost, - converted.iface.wmeViPktStats.lostMpdu); + converted.iface.links[0].wmeViPktStats.lostMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].retries, - converted.iface.wmeViPktStats.retries); + converted.iface.links[0].wmeViPktStats.retries); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_min, - (uint32_t)converted.iface.wmeViContentionTimeStats.contentionTimeMinInUsec); + (uint32_t)converted.iface.links[0].wmeViContentionTimeStats.contentionTimeMinInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_max, - (uint32_t)converted.iface.wmeViContentionTimeStats.contentionTimeMaxInUsec); + (uint32_t)converted.iface.links[0].wmeViContentionTimeStats.contentionTimeMaxInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_avg, - (uint32_t)converted.iface.wmeViContentionTimeStats.contentionTimeAvgInUsec); + (uint32_t)converted.iface.links[0].wmeViContentionTimeStats.contentionTimeAvgInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_num_samples, - (uint32_t)converted.iface.wmeViContentionTimeStats.contentionNumSamples); + (uint32_t)converted.iface.links[0].wmeViContentionTimeStats.contentionNumSamples); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].rx_mpdu, - converted.iface.wmeVoPktStats.rxMpdu); + converted.iface.links[0].wmeVoPktStats.rxMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].tx_mpdu, - converted.iface.wmeVoPktStats.txMpdu); + converted.iface.links[0].wmeVoPktStats.txMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].mpdu_lost, - converted.iface.wmeVoPktStats.lostMpdu); + converted.iface.links[0].wmeVoPktStats.lostMpdu); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].retries, - converted.iface.wmeVoPktStats.retries); + converted.iface.links[0].wmeVoPktStats.retries); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_min, - (uint32_t)converted.iface.wmeVoContentionTimeStats.contentionTimeMinInUsec); + (uint32_t)converted.iface.links[0].wmeVoContentionTimeStats.contentionTimeMinInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_max, - (uint32_t)converted.iface.wmeVoContentionTimeStats.contentionTimeMaxInUsec); + (uint32_t)converted.iface.links[0].wmeVoContentionTimeStats.contentionTimeMaxInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_avg, - (uint32_t)converted.iface.wmeVoContentionTimeStats.contentionTimeAvgInUsec); + (uint32_t)converted.iface.links[0].wmeVoContentionTimeStats.contentionTimeAvgInUsec); EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_num_samples, - (uint32_t)converted.iface.wmeVoContentionTimeStats.contentionNumSamples); + (uint32_t)converted.iface.links[0].wmeVoContentionTimeStats.contentionNumSamples); EXPECT_EQ(legacy_stats.iface.info.time_slicing_duty_cycle_percent, - converted.iface.timeSliceDutyCycleInPercent); + converted.iface.links[0].timeSliceDutyCycleInPercent); EXPECT_EQ(legacy_stats.radios.size(), converted.radios.size()); for (size_t i = 0; i < legacy_stats.radios.size(); i++) { @@ -331,29 +332,29 @@ TEST_F(AidlStructUtilTest, canConvertLegacyLinkLayerStatsToAidl) { } } - EXPECT_EQ(legacy_stats.peers.size(), converted.iface.peers.size()); + EXPECT_EQ(legacy_stats.peers.size(), converted.iface.links[0].peers.size()); for (size_t i = 0; i < legacy_stats.peers.size(); i++) { EXPECT_EQ(legacy_stats.peers[i].peer_info.bssload.sta_count, - converted.iface.peers[i].staCount); + converted.iface.links[0].peers[i].staCount); EXPECT_EQ(legacy_stats.peers[i].peer_info.bssload.chan_util, - converted.iface.peers[i].chanUtil); + converted.iface.links[0].peers[i].chanUtil); for (size_t j = 0; j < legacy_stats.peers[i].rate_stats.size(); j++) { EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].rate.preamble, - (uint32_t)converted.iface.peers[i].rateStats[j].rateInfo.preamble); + (uint32_t)converted.iface.links[0].peers[i].rateStats[j].rateInfo.preamble); EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].rate.nss, - (uint32_t)converted.iface.peers[i].rateStats[j].rateInfo.nss); + (uint32_t)converted.iface.links[0].peers[i].rateStats[j].rateInfo.nss); EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].rate.bw, - (uint32_t)converted.iface.peers[i].rateStats[j].rateInfo.bw); + (uint32_t)converted.iface.links[0].peers[i].rateStats[j].rateInfo.bw); EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].rate.rateMcsIdx, - (uint32_t)converted.iface.peers[i].rateStats[j].rateInfo.rateMcsIdx); + (uint32_t)converted.iface.links[0].peers[i].rateStats[j].rateInfo.rateMcsIdx); EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].tx_mpdu, - (uint32_t)converted.iface.peers[i].rateStats[j].txMpdu); + (uint32_t)converted.iface.links[0].peers[i].rateStats[j].txMpdu); EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].rx_mpdu, - (uint32_t)converted.iface.peers[i].rateStats[j].rxMpdu); + (uint32_t)converted.iface.links[0].peers[i].rateStats[j].rxMpdu); EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].mpdu_lost, - (uint32_t)converted.iface.peers[i].rateStats[j].mpduLost); + (uint32_t)converted.iface.links[0].peers[i].rateStats[j].mpduLost); EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].retries, - (uint32_t)converted.iface.peers[i].rateStats[j].retries); + (uint32_t)converted.iface.links[0].peers[i].rateStats[j].retries); } } } From 43c7805bde450b10abe71aedb161ad24d423e71a Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Thu, 3 Nov 2022 13:05:23 -0700 Subject: [PATCH 493/998] wifi: Add unit test for multi link stats conversion Bug: 246988155 Test: hardware/interfaces/wifi/aidl/default/tests/runtests.sh Change-Id: Ia38601dfb7bb5e43ee3b3aeb2a4ea93c7bbcba75 --- .../tests/aidl_struct_util_unit_tests.cpp | 279 ++++++++++++++++++ 1 file changed, 279 insertions(+) diff --git a/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp index 21b8d2d555..c2de0122d7 100644 --- a/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp +++ b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp @@ -112,6 +112,285 @@ TEST_F(AidlStructUtilTest, CanConvertLegacyWifiMacInfosToAidlWithTwoMac) { EXPECT_EQ(static_cast(legacy_iface_info2.channel), aidl_iface_info2.channel); } +TEST_F(AidlStructUtilTest, canConvertLegacyLinkLayerMlStatsToAidl) { + legacy_hal::LinkLayerMlStats legacy_ml_stats{}; + // Add two radio stats + legacy_ml_stats.radios.push_back(legacy_hal::LinkLayerRadioStats{}); + legacy_ml_stats.radios.push_back(legacy_hal::LinkLayerRadioStats{}); + // Add two links. + legacy_ml_stats.links.push_back(legacy_hal::LinkStats{}); + legacy_ml_stats.links.push_back(legacy_hal::LinkStats{}); + // Set stats for each link. + for (legacy_hal::LinkStats& link : legacy_ml_stats.links) { + link.peers.push_back(legacy_hal::WifiPeerInfo{}); + link.peers.push_back(legacy_hal::WifiPeerInfo{}); + link.stat.beacon_rx = rand(); + link.stat.rssi_mgmt = rand(); + link.stat.ac[legacy_hal::WIFI_AC_BE].rx_mpdu = rand(); + link.stat.ac[legacy_hal::WIFI_AC_BE].tx_mpdu = rand(); + link.stat.ac[legacy_hal::WIFI_AC_BE].mpdu_lost = rand(); + link.stat.ac[legacy_hal::WIFI_AC_BE].retries = rand(); + link.stat.ac[legacy_hal::WIFI_AC_BE].contention_time_min = rand(); + link.stat.ac[legacy_hal::WIFI_AC_BE].contention_time_max = rand(); + link.stat.ac[legacy_hal::WIFI_AC_BE].contention_time_avg = rand(); + link.stat.ac[legacy_hal::WIFI_AC_BE].contention_num_samples = rand(); + + link.stat.ac[legacy_hal::WIFI_AC_BK].rx_mpdu = rand(); + link.stat.ac[legacy_hal::WIFI_AC_BK].tx_mpdu = rand(); + link.stat.ac[legacy_hal::WIFI_AC_BK].mpdu_lost = rand(); + link.stat.ac[legacy_hal::WIFI_AC_BK].retries = rand(); + link.stat.ac[legacy_hal::WIFI_AC_BK].contention_time_min = rand(); + link.stat.ac[legacy_hal::WIFI_AC_BK].contention_time_max = rand(); + link.stat.ac[legacy_hal::WIFI_AC_BK].contention_time_avg = rand(); + link.stat.ac[legacy_hal::WIFI_AC_BK].contention_num_samples = rand(); + + link.stat.ac[legacy_hal::WIFI_AC_VI].rx_mpdu = rand(); + link.stat.ac[legacy_hal::WIFI_AC_VI].tx_mpdu = rand(); + link.stat.ac[legacy_hal::WIFI_AC_VI].mpdu_lost = rand(); + link.stat.ac[legacy_hal::WIFI_AC_VI].retries = rand(); + link.stat.ac[legacy_hal::WIFI_AC_VI].contention_time_min = rand(); + link.stat.ac[legacy_hal::WIFI_AC_VI].contention_time_max = rand(); + link.stat.ac[legacy_hal::WIFI_AC_VI].contention_time_avg = rand(); + link.stat.ac[legacy_hal::WIFI_AC_VI].contention_num_samples = rand(); + + link.stat.ac[legacy_hal::WIFI_AC_VO].rx_mpdu = rand(); + link.stat.ac[legacy_hal::WIFI_AC_VO].tx_mpdu = rand(); + link.stat.ac[legacy_hal::WIFI_AC_VO].mpdu_lost = rand(); + link.stat.ac[legacy_hal::WIFI_AC_VO].retries = rand(); + link.stat.ac[legacy_hal::WIFI_AC_VO].contention_time_min = rand(); + link.stat.ac[legacy_hal::WIFI_AC_VO].contention_time_max = rand(); + link.stat.ac[legacy_hal::WIFI_AC_VO].contention_time_avg = rand(); + link.stat.ac[legacy_hal::WIFI_AC_VO].contention_num_samples = rand(); + + link.stat.time_slicing_duty_cycle_percent = rand(); + link.stat.num_peers = 2; + + // Set peer stats for each of the peers. + for (auto& peer : link.peers) { + peer.peer_info.bssload.sta_count = rand(); + peer.peer_info.bssload.chan_util = rand(); + wifi_rate_stat rate_stat1 = { + .rate = {3, 1, 2, 5, 0, 0}, + .tx_mpdu = 0, + .rx_mpdu = 1, + .mpdu_lost = 2, + .retries = 3, + .retries_short = 4, + .retries_long = 5, + }; + wifi_rate_stat rate_stat2 = { + .rate = {2, 2, 1, 6, 0, 1}, + .tx_mpdu = 6, + .rx_mpdu = 7, + .mpdu_lost = 8, + .retries = 9, + .retries_short = 10, + .retries_long = 11, + }; + peer.rate_stats.push_back(rate_stat1); + peer.rate_stats.push_back(rate_stat2); + } + } + // Set radio stats + for (auto& radio : legacy_ml_stats.radios) { + radio.stats.radio = rand(); + radio.stats.on_time = rand(); + radio.stats.tx_time = rand(); + radio.stats.rx_time = rand(); + radio.stats.on_time_scan = rand(); + radio.stats.on_time_nbd = rand(); + radio.stats.on_time_gscan = rand(); + radio.stats.on_time_roam_scan = rand(); + radio.stats.on_time_pno_scan = rand(); + radio.stats.on_time_hs20 = rand(); + for (int i = 0; i < 4; i++) { + radio.tx_time_per_levels.push_back(rand()); + } + + legacy_hal::wifi_channel_stat channel_stat1 = { + .channel = {legacy_hal::WIFI_CHAN_WIDTH_20, 2437, 2437, 0}, + .on_time = 0x1111, + .cca_busy_time = 0x55, + }; + legacy_hal::wifi_channel_stat channel_stat2 = { + .channel = {legacy_hal::WIFI_CHAN_WIDTH_20, 5180, 5180, 0}, + .on_time = 0x2222, + .cca_busy_time = 0x66, + }; + radio.channel_stats.push_back(channel_stat1); + radio.channel_stats.push_back(channel_stat2); + } + // Convert to AIDL + StaLinkLayerStats converted{}; + aidl_struct_util::convertLegacyLinkLayerMlStatsToAidl(legacy_ml_stats, &converted); + // Validate + int l = 0; + for (legacy_hal::LinkStats& link : legacy_ml_stats.links) { + EXPECT_EQ(link.stat.link_id, (uint8_t)converted.iface.links[l].linkId); + EXPECT_EQ(link.stat.beacon_rx, (uint32_t)converted.iface.links[l].beaconRx); + EXPECT_EQ(link.stat.rssi_mgmt, converted.iface.links[l].avgRssiMgmt); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_BE].rx_mpdu, + converted.iface.links[l].wmeBePktStats.rxMpdu); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_BE].tx_mpdu, + converted.iface.links[l].wmeBePktStats.txMpdu); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_BE].mpdu_lost, + converted.iface.links[l].wmeBePktStats.lostMpdu); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_BE].retries, + converted.iface.links[l].wmeBePktStats.retries); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_BE].contention_time_min, + (uint32_t)converted.iface.links[l] + .wmeBeContentionTimeStats.contentionTimeMinInUsec); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_BE].contention_time_max, + (uint32_t)converted.iface.links[l] + .wmeBeContentionTimeStats.contentionTimeMaxInUsec); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_BE].contention_time_avg, + (uint32_t)converted.iface.links[l] + .wmeBeContentionTimeStats.contentionTimeAvgInUsec); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_BE].contention_num_samples, + (uint32_t)converted.iface.links[l].wmeBeContentionTimeStats.contentionNumSamples); + + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_BK].rx_mpdu, + converted.iface.links[l].wmeBkPktStats.rxMpdu); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_BK].tx_mpdu, + converted.iface.links[l].wmeBkPktStats.txMpdu); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_BK].mpdu_lost, + converted.iface.links[l].wmeBkPktStats.lostMpdu); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_BK].retries, + converted.iface.links[l].wmeBkPktStats.retries); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_BK].contention_time_min, + (uint32_t)converted.iface.links[l] + .wmeBkContentionTimeStats.contentionTimeMinInUsec); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_BK].contention_time_max, + (uint32_t)converted.iface.links[l] + .wmeBkContentionTimeStats.contentionTimeMaxInUsec); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_BK].contention_time_avg, + (uint32_t)converted.iface.links[l] + .wmeBkContentionTimeStats.contentionTimeAvgInUsec); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_BK].contention_num_samples, + (uint32_t)converted.iface.links[l].wmeBkContentionTimeStats.contentionNumSamples); + + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_VI].rx_mpdu, + converted.iface.links[l].wmeViPktStats.rxMpdu); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_VI].tx_mpdu, + converted.iface.links[l].wmeViPktStats.txMpdu); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_VI].mpdu_lost, + converted.iface.links[l].wmeViPktStats.lostMpdu); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_VI].retries, + converted.iface.links[l].wmeViPktStats.retries); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_VI].contention_time_min, + (uint32_t)converted.iface.links[l] + .wmeViContentionTimeStats.contentionTimeMinInUsec); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_VI].contention_time_max, + (uint32_t)converted.iface.links[l] + .wmeViContentionTimeStats.contentionTimeMaxInUsec); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_VI].contention_time_avg, + (uint32_t)converted.iface.links[l] + .wmeViContentionTimeStats.contentionTimeAvgInUsec); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_VI].contention_num_samples, + (uint32_t)converted.iface.links[l].wmeViContentionTimeStats.contentionNumSamples); + + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_VO].rx_mpdu, + converted.iface.links[l].wmeVoPktStats.rxMpdu); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_VO].tx_mpdu, + converted.iface.links[l].wmeVoPktStats.txMpdu); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_VO].mpdu_lost, + converted.iface.links[l].wmeVoPktStats.lostMpdu); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_VO].retries, + converted.iface.links[l].wmeVoPktStats.retries); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_VO].contention_time_min, + (uint32_t)converted.iface.links[l] + .wmeVoContentionTimeStats.contentionTimeMinInUsec); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_VO].contention_time_max, + (uint32_t)converted.iface.links[l] + .wmeVoContentionTimeStats.contentionTimeMaxInUsec); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_VO].contention_time_avg, + (uint32_t)converted.iface.links[l] + .wmeVoContentionTimeStats.contentionTimeAvgInUsec); + EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_VO].contention_num_samples, + (uint32_t)converted.iface.links[l].wmeVoContentionTimeStats.contentionNumSamples); + + EXPECT_EQ(link.stat.time_slicing_duty_cycle_percent, + converted.iface.links[l].timeSliceDutyCycleInPercent); + + EXPECT_EQ(link.peers.size(), converted.iface.links[l].peers.size()); + for (size_t i = 0; i < link.peers.size(); i++) { + EXPECT_EQ(link.peers[i].peer_info.bssload.sta_count, + converted.iface.links[l].peers[i].staCount); + EXPECT_EQ(link.peers[i].peer_info.bssload.chan_util, + converted.iface.links[l].peers[i].chanUtil); + for (size_t j = 0; j < link.peers[i].rate_stats.size(); j++) { + EXPECT_EQ( + link.peers[i].rate_stats[j].rate.preamble, + (uint32_t)converted.iface.links[l].peers[i].rateStats[j].rateInfo.preamble); + EXPECT_EQ(link.peers[i].rate_stats[j].rate.nss, + (uint32_t)converted.iface.links[l].peers[i].rateStats[j].rateInfo.nss); + EXPECT_EQ(link.peers[i].rate_stats[j].rate.bw, + (uint32_t)converted.iface.links[l].peers[i].rateStats[j].rateInfo.bw); + EXPECT_EQ(link.peers[i].rate_stats[j].rate.rateMcsIdx, + (uint32_t)converted.iface.links[l] + .peers[i] + .rateStats[j] + .rateInfo.rateMcsIdx); + EXPECT_EQ(link.peers[i].rate_stats[j].tx_mpdu, + (uint32_t)converted.iface.links[l].peers[i].rateStats[j].txMpdu); + EXPECT_EQ(link.peers[i].rate_stats[j].rx_mpdu, + (uint32_t)converted.iface.links[l].peers[i].rateStats[j].rxMpdu); + EXPECT_EQ(link.peers[i].rate_stats[j].mpdu_lost, + (uint32_t)converted.iface.links[l].peers[i].rateStats[j].mpduLost); + EXPECT_EQ(link.peers[i].rate_stats[j].retries, + (uint32_t)converted.iface.links[l].peers[i].rateStats[j].retries); + } + } + ++l; + } // loop over links + + EXPECT_EQ(legacy_ml_stats.radios.size(), converted.radios.size()); + for (size_t i = 0; i < legacy_ml_stats.radios.size(); i++) { + EXPECT_EQ(legacy_ml_stats.radios[i].stats.radio, converted.radios[i].radioId); + EXPECT_EQ(legacy_ml_stats.radios[i].stats.on_time, + (uint32_t)converted.radios[i].onTimeInMs); + EXPECT_EQ(legacy_ml_stats.radios[i].stats.tx_time, + (uint32_t)converted.radios[i].txTimeInMs); + EXPECT_EQ(legacy_ml_stats.radios[i].stats.rx_time, + (uint32_t)converted.radios[i].rxTimeInMs); + EXPECT_EQ(legacy_ml_stats.radios[i].stats.on_time_scan, + (uint32_t)converted.radios[i].onTimeInMsForScan); + EXPECT_EQ(legacy_ml_stats.radios[i].tx_time_per_levels.size(), + converted.radios[i].txTimeInMsPerLevel.size()); + for (size_t j = 0; j < legacy_ml_stats.radios[i].tx_time_per_levels.size(); j++) { + EXPECT_EQ(legacy_ml_stats.radios[i].tx_time_per_levels[j], + (uint32_t)converted.radios[i].txTimeInMsPerLevel[j]); + } + EXPECT_EQ(legacy_ml_stats.radios[i].stats.on_time_nbd, + (uint32_t)converted.radios[i].onTimeInMsForNanScan); + EXPECT_EQ(legacy_ml_stats.radios[i].stats.on_time_gscan, + (uint32_t)converted.radios[i].onTimeInMsForBgScan); + EXPECT_EQ(legacy_ml_stats.radios[i].stats.on_time_roam_scan, + (uint32_t)converted.radios[i].onTimeInMsForRoamScan); + EXPECT_EQ(legacy_ml_stats.radios[i].stats.on_time_pno_scan, + (uint32_t)converted.radios[i].onTimeInMsForPnoScan); + EXPECT_EQ(legacy_ml_stats.radios[i].stats.on_time_hs20, + (uint32_t)converted.radios[i].onTimeInMsForHs20Scan); + EXPECT_EQ(legacy_ml_stats.radios[i].channel_stats.size(), + converted.radios[i].channelStats.size()); + for (size_t k = 0; k < legacy_ml_stats.radios[i].channel_stats.size(); k++) { + auto& legacy_channel_st = legacy_ml_stats.radios[i].channel_stats[k]; + EXPECT_EQ(WifiChannelWidthInMhz::WIDTH_20, + converted.radios[i].channelStats[k].channel.width); + EXPECT_EQ(legacy_channel_st.channel.center_freq, + converted.radios[i].channelStats[k].channel.centerFreq); + EXPECT_EQ(legacy_channel_st.channel.center_freq0, + converted.radios[i].channelStats[k].channel.centerFreq0); + EXPECT_EQ(legacy_channel_st.channel.center_freq1, + converted.radios[i].channelStats[k].channel.centerFreq1); + EXPECT_EQ(legacy_channel_st.cca_busy_time, + (uint32_t)converted.radios[i].channelStats[k].ccaBusyTimeInMs); + EXPECT_EQ(legacy_channel_st.on_time, + (uint32_t)converted.radios[i].channelStats[k].onTimeInMs); + } + } +} + TEST_F(AidlStructUtilTest, canConvertLegacyLinkLayerStatsToAidl) { legacy_hal::LinkLayerStats legacy_stats{}; legacy_stats.radios.push_back(legacy_hal::LinkLayerRadioStats{}); From 5fe40535ffbfdc3d0b36c36fef549e5c11f42322 Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Thu, 3 Nov 2022 13:15:10 -0700 Subject: [PATCH 494/998] wifi: Update vts test for GetLinkLayerStats() Bug: 246988155 Test: atest VtsHalWifiStaIfaceTargetTest Change-Id: I0f3f211f5ff5374834da60214d45bba1b8a47b7a --- wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp index ef7e2747c9..5e55315781 100644 --- a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp +++ b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp @@ -145,7 +145,7 @@ TEST_P(WifiStaIfaceAidlTest, GetLinkLayerStats) { std::shared_ptr iface; auto status = createStaIface(&iface); if (status.isOk()) { - EXPECT_GT(link_layer_stats.iface.timeSliceDutyCycleInPercent, 0); + EXPECT_GT(link_layer_stats.iface.links[0].timeSliceDutyCycleInPercent, 0); } // Disable link layer stats collection. From 131f47c22130025d6dd0c552b38a5e4069ac4f23 Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Sat, 22 Oct 2022 14:07:21 -0700 Subject: [PATCH 495/998] wifi: Add multi link layer stats support to AIDL Bug: 246988155 Test: mm -j Change-Id: I9b31988215d3953da6dde80aa68ead9236659d50 --- .../hardware/wifi/StaLinkLayerIfaceStats.aidl | 13 +-- .../hardware/wifi/StaLinkLayerLinkStats.aidl | 50 +++++++++++ .../hardware/wifi/StaLinkLayerIfaceStats.aidl | 59 +----------- .../hardware/wifi/StaLinkLayerLinkStats.aidl | 89 +++++++++++++++++++ 4 files changed, 144 insertions(+), 67 deletions(-) create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaLinkLayerLinkStats.aidl create mode 100644 wifi/aidl/android/hardware/wifi/StaLinkLayerLinkStats.aidl diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaLinkLayerIfaceStats.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaLinkLayerIfaceStats.aidl index cf68fc6bf4..a4192076d2 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaLinkLayerIfaceStats.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaLinkLayerIfaceStats.aidl @@ -34,16 +34,5 @@ package android.hardware.wifi; @VintfStability parcelable StaLinkLayerIfaceStats { - int beaconRx; - int avgRssiMgmt; - android.hardware.wifi.StaLinkLayerIfacePacketStats wmeBePktStats; - android.hardware.wifi.StaLinkLayerIfacePacketStats wmeBkPktStats; - android.hardware.wifi.StaLinkLayerIfacePacketStats wmeViPktStats; - android.hardware.wifi.StaLinkLayerIfacePacketStats wmeVoPktStats; - byte timeSliceDutyCycleInPercent; - android.hardware.wifi.StaLinkLayerIfaceContentionTimeStats wmeBeContentionTimeStats; - android.hardware.wifi.StaLinkLayerIfaceContentionTimeStats wmeBkContentionTimeStats; - android.hardware.wifi.StaLinkLayerIfaceContentionTimeStats wmeViContentionTimeStats; - android.hardware.wifi.StaLinkLayerIfaceContentionTimeStats wmeVoContentionTimeStats; - android.hardware.wifi.StaPeerInfo[] peers; + android.hardware.wifi.StaLinkLayerLinkStats[] links; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaLinkLayerLinkStats.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaLinkLayerLinkStats.aidl new file mode 100644 index 0000000000..714bba8e98 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaLinkLayerLinkStats.aidl @@ -0,0 +1,50 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable StaLinkLayerLinkStats { + int linkId; + int beaconRx; + int avgRssiMgmt; + android.hardware.wifi.StaLinkLayerIfacePacketStats wmeBePktStats; + android.hardware.wifi.StaLinkLayerIfacePacketStats wmeBkPktStats; + android.hardware.wifi.StaLinkLayerIfacePacketStats wmeViPktStats; + android.hardware.wifi.StaLinkLayerIfacePacketStats wmeVoPktStats; + byte timeSliceDutyCycleInPercent; + android.hardware.wifi.StaLinkLayerIfaceContentionTimeStats wmeBeContentionTimeStats; + android.hardware.wifi.StaLinkLayerIfaceContentionTimeStats wmeBkContentionTimeStats; + android.hardware.wifi.StaLinkLayerIfaceContentionTimeStats wmeViContentionTimeStats; + android.hardware.wifi.StaLinkLayerIfaceContentionTimeStats wmeVoContentionTimeStats; + android.hardware.wifi.StaPeerInfo[] peers; +} diff --git a/wifi/aidl/android/hardware/wifi/StaLinkLayerIfaceStats.aidl b/wifi/aidl/android/hardware/wifi/StaLinkLayerIfaceStats.aidl index 78f8caa6a7..3f8718fe74 100644 --- a/wifi/aidl/android/hardware/wifi/StaLinkLayerIfaceStats.aidl +++ b/wifi/aidl/android/hardware/wifi/StaLinkLayerIfaceStats.aidl @@ -16,64 +16,13 @@ package android.hardware.wifi; -import android.hardware.wifi.StaLinkLayerIfaceContentionTimeStats; -import android.hardware.wifi.StaLinkLayerIfacePacketStats; -import android.hardware.wifi.StaPeerInfo; +import android.hardware.wifi.StaLinkLayerLinkStats; /** - * Iface statistics for the current connection. + * Iface statistics for the current connection. Current connection may have + * single or multiple links. */ @VintfStability parcelable StaLinkLayerIfaceStats { - /** - * Number beacons received from the connected AP. - */ - int beaconRx; - /** - * Access Point Beacon and Management frames RSSI (averaged). - */ - int avgRssiMgmt; - /** - * WME Best Effort Access Category packet counters. - */ - StaLinkLayerIfacePacketStats wmeBePktStats; - /** - * WME Background Access Category packet counters. - */ - StaLinkLayerIfacePacketStats wmeBkPktStats; - /** - * WME Video Access Category packet counters. - */ - StaLinkLayerIfacePacketStats wmeViPktStats; - /** - * WME Voice Access Category packet counters. - */ - StaLinkLayerIfacePacketStats wmeVoPktStats; - /** - * Duty cycle for the iface. - * If this iface is being served using time slicing on a radio with one or more ifaces - * (i.e MCC), then the duty cycle assigned to this iface in %. - * If not using time slicing (i.e SCC or DBS), set to 100. - */ - byte timeSliceDutyCycleInPercent; - /** - * WME Best Effort (BE) Access Category (AC) contention time statistics. - */ - StaLinkLayerIfaceContentionTimeStats wmeBeContentionTimeStats; - /** - * WME Background (BK) Access Category (AC) contention time statistics. - */ - StaLinkLayerIfaceContentionTimeStats wmeBkContentionTimeStats; - /** - * WME Video (VI) Access Category (AC) contention time statistics. - */ - StaLinkLayerIfaceContentionTimeStats wmeViContentionTimeStats; - /** - * WME Voice (VO) Access Category (AC) contention time statistics. - */ - StaLinkLayerIfaceContentionTimeStats wmeVoContentionTimeStats; - /** - * Per peer statistics. - */ - StaPeerInfo[] peers; + StaLinkLayerLinkStats[] links; } diff --git a/wifi/aidl/android/hardware/wifi/StaLinkLayerLinkStats.aidl b/wifi/aidl/android/hardware/wifi/StaLinkLayerLinkStats.aidl new file mode 100644 index 0000000000..cf1a867839 --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/StaLinkLayerLinkStats.aidl @@ -0,0 +1,89 @@ +/* + * 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. + */ + +package android.hardware.wifi; + +import android.hardware.wifi.StaLinkLayerIfaceContentionTimeStats; +import android.hardware.wifi.StaLinkLayerIfacePacketStats; +import android.hardware.wifi.StaPeerInfo; + +/** + * Per Link statistics for the current connection. For MLO, this is + * the statistics for one link in the connection. + */ +@VintfStability +parcelable StaLinkLayerLinkStats { + /** + * Identifier for the link within MLO. For single link operation this field + * is not relevant and can be set to 0. + */ + int linkId; + /** + * Number of beacons received from the connected AP on the link. + */ + int beaconRx; + /** + * Access Point Beacon and Management frames RSSI (averaged) on the link. + */ + int avgRssiMgmt; + /** + * WME Best Effort Access Category packet counters on the link. + */ + StaLinkLayerIfacePacketStats wmeBePktStats; + /** + * WME Background Access Category packet counters on the link. + */ + StaLinkLayerIfacePacketStats wmeBkPktStats; + /** + * WME Video Access Category packet counters on the link. + */ + StaLinkLayerIfacePacketStats wmeViPktStats; + /** + * WME Voice Access Category packet counters on the link. + */ + StaLinkLayerIfacePacketStats wmeVoPktStats; + /** + * Duty cycle for the link. + * If this link is being served using time slicing on a radio with one or + * more links then the duty cycle assigned to this link in %. If not using + * time slicing, set to 100. + */ + byte timeSliceDutyCycleInPercent; + /** + * WME Best Effort (BE) Access Category (AC) contention time statistics on + * the link. + */ + StaLinkLayerIfaceContentionTimeStats wmeBeContentionTimeStats; + /** + * WME Background (BK) Access Category (AC) contention time statistics on + * the link. + */ + StaLinkLayerIfaceContentionTimeStats wmeBkContentionTimeStats; + /** + * WME Video (VI) Access Category (AC) contention time statistics on the + * link. + */ + StaLinkLayerIfaceContentionTimeStats wmeViContentionTimeStats; + /** + * WME Voice (VO) Access Category (AC) contention time statistics on the + * link. + */ + StaLinkLayerIfaceContentionTimeStats wmeVoContentionTimeStats; + /** + * Per peer statistics for the link. + */ + StaPeerInfo[] peers; +} From 5f30d333d2c4bd021de7d0c1b4eddb061cf1d314 Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Wed, 26 Oct 2022 14:07:44 -0700 Subject: [PATCH 496/998] wifi: Add Support for Multi-Link Layer stats in shim layer With MLO, WiFi 7 supports establishing multiple links between the Station and Access Point. Each of the link has its own stats. To maintain backward compatibility, if multi link stats is not supported by vendor, always fallback to single link layer stats. Bug: 246988155 Test: hardware/interfaces/wifi/aidl/default/tests/runtests.sh Change-Id: Iede8ce771f0e58975222808b1870e5e2e179384c --- wifi/aidl/default/aidl_struct_util.cpp | 173 +++++++++++++++++++------ wifi/aidl/default/aidl_struct_util.h | 2 + wifi/aidl/default/wifi_legacy_hal.cpp | 117 ++++++++++++++++- wifi/aidl/default/wifi_legacy_hal.h | 20 ++- wifi/aidl/default/wifi_sta_iface.cpp | 15 ++- 5 files changed, 276 insertions(+), 51 deletions(-) diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index ec8b3968f2..fe7579b234 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -940,69 +940,158 @@ bool convertLegacyLinkLayerRadioStatsToAidl( return true; } +bool convertLegacyLinkLayerMlStatsToAidl(const legacy_hal::LinkLayerMlStats& legacy_ml_stats, + StaLinkLayerStats* aidl_stats) { + if (!aidl_stats) { + return false; + } + *aidl_stats = {}; + std::vector links; + // Iterate over each links + for (const auto& link : legacy_ml_stats.links) { + StaLinkLayerLinkStats linkStats = {}; + linkStats.linkId = link.stat.link_id; + linkStats.beaconRx = link.stat.beacon_rx; + linkStats.avgRssiMgmt = link.stat.rssi_mgmt; + linkStats.wmeBePktStats.rxMpdu = link.stat.ac[legacy_hal::WIFI_AC_BE].rx_mpdu; + linkStats.wmeBePktStats.txMpdu = link.stat.ac[legacy_hal::WIFI_AC_BE].tx_mpdu; + linkStats.wmeBePktStats.lostMpdu = link.stat.ac[legacy_hal::WIFI_AC_BE].mpdu_lost; + linkStats.wmeBePktStats.retries = link.stat.ac[legacy_hal::WIFI_AC_BE].retries; + linkStats.wmeBeContentionTimeStats.contentionTimeMinInUsec = + link.stat.ac[legacy_hal::WIFI_AC_BE].contention_time_min; + linkStats.wmeBeContentionTimeStats.contentionTimeMaxInUsec = + link.stat.ac[legacy_hal::WIFI_AC_BE].contention_time_max; + linkStats.wmeBeContentionTimeStats.contentionTimeAvgInUsec = + link.stat.ac[legacy_hal::WIFI_AC_BE].contention_time_avg; + linkStats.wmeBeContentionTimeStats.contentionNumSamples = + link.stat.ac[legacy_hal::WIFI_AC_BE].contention_num_samples; + linkStats.wmeBkPktStats.rxMpdu = link.stat.ac[legacy_hal::WIFI_AC_BK].rx_mpdu; + linkStats.wmeBkPktStats.txMpdu = link.stat.ac[legacy_hal::WIFI_AC_BK].tx_mpdu; + linkStats.wmeBkPktStats.lostMpdu = link.stat.ac[legacy_hal::WIFI_AC_BK].mpdu_lost; + linkStats.wmeBkPktStats.retries = link.stat.ac[legacy_hal::WIFI_AC_BK].retries; + linkStats.wmeBkContentionTimeStats.contentionTimeMinInUsec = + link.stat.ac[legacy_hal::WIFI_AC_BK].contention_time_min; + linkStats.wmeBkContentionTimeStats.contentionTimeMaxInUsec = + link.stat.ac[legacy_hal::WIFI_AC_BK].contention_time_max; + linkStats.wmeBkContentionTimeStats.contentionTimeAvgInUsec = + link.stat.ac[legacy_hal::WIFI_AC_BK].contention_time_avg; + linkStats.wmeBkContentionTimeStats.contentionNumSamples = + link.stat.ac[legacy_hal::WIFI_AC_BK].contention_num_samples; + linkStats.wmeViPktStats.rxMpdu = link.stat.ac[legacy_hal::WIFI_AC_VI].rx_mpdu; + linkStats.wmeViPktStats.txMpdu = link.stat.ac[legacy_hal::WIFI_AC_VI].tx_mpdu; + linkStats.wmeViPktStats.lostMpdu = link.stat.ac[legacy_hal::WIFI_AC_VI].mpdu_lost; + linkStats.wmeViPktStats.retries = link.stat.ac[legacy_hal::WIFI_AC_VI].retries; + linkStats.wmeViContentionTimeStats.contentionTimeMinInUsec = + link.stat.ac[legacy_hal::WIFI_AC_VI].contention_time_min; + linkStats.wmeViContentionTimeStats.contentionTimeMaxInUsec = + link.stat.ac[legacy_hal::WIFI_AC_VI].contention_time_max; + linkStats.wmeViContentionTimeStats.contentionTimeAvgInUsec = + link.stat.ac[legacy_hal::WIFI_AC_VI].contention_time_avg; + linkStats.wmeViContentionTimeStats.contentionNumSamples = + link.stat.ac[legacy_hal::WIFI_AC_VI].contention_num_samples; + linkStats.wmeVoPktStats.rxMpdu = link.stat.ac[legacy_hal::WIFI_AC_VO].rx_mpdu; + linkStats.wmeVoPktStats.txMpdu = link.stat.ac[legacy_hal::WIFI_AC_VO].tx_mpdu; + linkStats.wmeVoPktStats.lostMpdu = link.stat.ac[legacy_hal::WIFI_AC_VO].mpdu_lost; + linkStats.wmeVoPktStats.retries = link.stat.ac[legacy_hal::WIFI_AC_VO].retries; + linkStats.wmeVoContentionTimeStats.contentionTimeMinInUsec = + link.stat.ac[legacy_hal::WIFI_AC_VO].contention_time_min; + linkStats.wmeVoContentionTimeStats.contentionTimeMaxInUsec = + link.stat.ac[legacy_hal::WIFI_AC_VO].contention_time_max; + linkStats.wmeVoContentionTimeStats.contentionTimeAvgInUsec = + link.stat.ac[legacy_hal::WIFI_AC_VO].contention_time_avg; + linkStats.wmeVoContentionTimeStats.contentionNumSamples = + link.stat.ac[legacy_hal::WIFI_AC_VO].contention_num_samples; + linkStats.timeSliceDutyCycleInPercent = link.stat.time_slicing_duty_cycle_percent; + // peer info legacy_stats conversion. + std::vector aidl_peers_info_stats; + for (const auto& legacy_peer_info_stats : link.peers) { + StaPeerInfo aidl_peer_info_stats; + if (!convertLegacyPeerInfoStatsToAidl(legacy_peer_info_stats, &aidl_peer_info_stats)) { + return false; + } + aidl_peers_info_stats.push_back(aidl_peer_info_stats); + } + linkStats.peers = aidl_peers_info_stats; + // Push link stats to aidl stats. + links.push_back(linkStats); + } + aidl_stats->iface.links = links; + // radio legacy_stats conversion. + std::vector aidl_radios_stats; + for (const auto& legacy_radio_stats : legacy_ml_stats.radios) { + StaLinkLayerRadioStats aidl_radio_stats; + if (!convertLegacyLinkLayerRadioStatsToAidl(legacy_radio_stats, &aidl_radio_stats)) { + return false; + } + aidl_radios_stats.push_back(aidl_radio_stats); + } + aidl_stats->radios = aidl_radios_stats; + aidl_stats->timeStampInMs = ::android::uptimeMillis(); + + return true; +} + bool convertLegacyLinkLayerStatsToAidl(const legacy_hal::LinkLayerStats& legacy_stats, StaLinkLayerStats* aidl_stats) { if (!aidl_stats) { return false; } *aidl_stats = {}; + std::vector links; + StaLinkLayerLinkStats linkStats = {}; // iface legacy_stats conversion. - aidl_stats->iface.beaconRx = legacy_stats.iface.beacon_rx; - aidl_stats->iface.avgRssiMgmt = legacy_stats.iface.rssi_mgmt; - aidl_stats->iface.wmeBePktStats.rxMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].rx_mpdu; - aidl_stats->iface.wmeBePktStats.txMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].tx_mpdu; - aidl_stats->iface.wmeBePktStats.lostMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].mpdu_lost; - aidl_stats->iface.wmeBePktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].retries; - aidl_stats->iface.wmeBeContentionTimeStats.contentionTimeMinInUsec = + linkStats.linkId = 0; + linkStats.beaconRx = legacy_stats.iface.beacon_rx; + linkStats.avgRssiMgmt = legacy_stats.iface.rssi_mgmt; + linkStats.wmeBePktStats.rxMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].rx_mpdu; + linkStats.wmeBePktStats.txMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].tx_mpdu; + linkStats.wmeBePktStats.lostMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].mpdu_lost; + linkStats.wmeBePktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].retries; + linkStats.wmeBeContentionTimeStats.contentionTimeMinInUsec = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_min; - aidl_stats->iface.wmeBeContentionTimeStats.contentionTimeMaxInUsec = + linkStats.wmeBeContentionTimeStats.contentionTimeMaxInUsec = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_max; - aidl_stats->iface.wmeBeContentionTimeStats.contentionTimeAvgInUsec = + linkStats.wmeBeContentionTimeStats.contentionTimeAvgInUsec = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_avg; - aidl_stats->iface.wmeBeContentionTimeStats.contentionNumSamples = + linkStats.wmeBeContentionTimeStats.contentionNumSamples = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_num_samples; - aidl_stats->iface.wmeBkPktStats.rxMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].rx_mpdu; - aidl_stats->iface.wmeBkPktStats.txMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].tx_mpdu; - aidl_stats->iface.wmeBkPktStats.lostMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].mpdu_lost; - aidl_stats->iface.wmeBkPktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].retries; - aidl_stats->iface.wmeBkContentionTimeStats.contentionTimeMinInUsec = + linkStats.wmeBkPktStats.rxMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].rx_mpdu; + linkStats.wmeBkPktStats.txMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].tx_mpdu; + linkStats.wmeBkPktStats.lostMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].mpdu_lost; + linkStats.wmeBkPktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].retries; + linkStats.wmeBkContentionTimeStats.contentionTimeMinInUsec = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_min; - aidl_stats->iface.wmeBkContentionTimeStats.contentionTimeMaxInUsec = + linkStats.wmeBkContentionTimeStats.contentionTimeMaxInUsec = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_max; - aidl_stats->iface.wmeBkContentionTimeStats.contentionTimeAvgInUsec = + linkStats.wmeBkContentionTimeStats.contentionTimeAvgInUsec = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_avg; - aidl_stats->iface.wmeBkContentionTimeStats.contentionNumSamples = + linkStats.wmeBkContentionTimeStats.contentionNumSamples = legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_num_samples; - aidl_stats->iface.wmeViPktStats.rxMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].rx_mpdu; - aidl_stats->iface.wmeViPktStats.txMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].tx_mpdu; - aidl_stats->iface.wmeViPktStats.lostMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].mpdu_lost; - aidl_stats->iface.wmeViPktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].retries; - aidl_stats->iface.wmeViContentionTimeStats.contentionTimeMinInUsec = + linkStats.wmeViPktStats.rxMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].rx_mpdu; + linkStats.wmeViPktStats.txMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].tx_mpdu; + linkStats.wmeViPktStats.lostMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].mpdu_lost; + linkStats.wmeViPktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].retries; + linkStats.wmeViContentionTimeStats.contentionTimeMinInUsec = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_min; - aidl_stats->iface.wmeViContentionTimeStats.contentionTimeMaxInUsec = + linkStats.wmeViContentionTimeStats.contentionTimeMaxInUsec = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_max; - aidl_stats->iface.wmeViContentionTimeStats.contentionTimeAvgInUsec = + linkStats.wmeViContentionTimeStats.contentionTimeAvgInUsec = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_avg; - aidl_stats->iface.wmeViContentionTimeStats.contentionNumSamples = + linkStats.wmeViContentionTimeStats.contentionNumSamples = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_num_samples; - aidl_stats->iface.wmeVoPktStats.rxMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].rx_mpdu; - aidl_stats->iface.wmeVoPktStats.txMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].tx_mpdu; - aidl_stats->iface.wmeVoPktStats.lostMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].mpdu_lost; - aidl_stats->iface.wmeVoPktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].retries; - aidl_stats->iface.wmeVoContentionTimeStats.contentionTimeMinInUsec = + linkStats.wmeVoPktStats.rxMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].rx_mpdu; + linkStats.wmeVoPktStats.txMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].tx_mpdu; + linkStats.wmeVoPktStats.lostMpdu = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].mpdu_lost; + linkStats.wmeVoPktStats.retries = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].retries; + linkStats.wmeVoContentionTimeStats.contentionTimeMinInUsec = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_min; - aidl_stats->iface.wmeVoContentionTimeStats.contentionTimeMaxInUsec = + linkStats.wmeVoContentionTimeStats.contentionTimeMaxInUsec = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_max; - aidl_stats->iface.wmeVoContentionTimeStats.contentionTimeAvgInUsec = + linkStats.wmeVoContentionTimeStats.contentionTimeAvgInUsec = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_avg; - aidl_stats->iface.wmeVoContentionTimeStats.contentionNumSamples = + linkStats.wmeVoContentionTimeStats.contentionNumSamples = legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_num_samples; - aidl_stats->iface.timeSliceDutyCycleInPercent = - legacy_stats.iface.info.time_slicing_duty_cycle_percent; + linkStats.timeSliceDutyCycleInPercent = legacy_stats.iface.info.time_slicing_duty_cycle_percent; // peer info legacy_stats conversion. std::vector aidl_peers_info_stats; for (const auto& legacy_peer_info_stats : legacy_stats.peers) { @@ -1012,7 +1101,9 @@ bool convertLegacyLinkLayerStatsToAidl(const legacy_hal::LinkLayerStats& legacy_ } aidl_peers_info_stats.push_back(aidl_peer_info_stats); } - aidl_stats->iface.peers = aidl_peers_info_stats; + linkStats.peers = aidl_peers_info_stats; + links.push_back(linkStats); + aidl_stats->iface.links = links; // radio legacy_stats conversion. std::vector aidl_radios_stats; for (const auto& legacy_radio_stats : legacy_stats.radios) { diff --git a/wifi/aidl/default/aidl_struct_util.h b/wifi/aidl/default/aidl_struct_util.h index d8e1fd48aa..ac86755382 100644 --- a/wifi/aidl/default/aidl_struct_util.h +++ b/wifi/aidl/default/aidl_struct_util.h @@ -89,6 +89,8 @@ bool convertLegacyGscanResultToAidl(const legacy_hal::wifi_scan_result& legacy_s bool convertLegacyVectorOfCachedGscanResultsToAidl( const std::vector& legacy_cached_scan_results, std::vector* aidl_scan_datas); +bool convertLegacyLinkLayerMlStatsToAidl(const legacy_hal::LinkLayerMlStats& legacy_ml_stats, + StaLinkLayerStats* aidl_stats); bool convertLegacyLinkLayerStatsToAidl(const legacy_hal::LinkLayerStats& legacy_stats, StaLinkLayerStats* aidl_stats); bool convertLegacyRoamingCapabilitiesToAidl( diff --git a/wifi/aidl/default/wifi_legacy_hal.cpp b/wifi/aidl/default/wifi_legacy_hal.cpp index e4883d19f3..83f368e0bf 100644 --- a/wifi/aidl/default/wifi_legacy_hal.cpp +++ b/wifi/aidl/default/wifi_legacy_hal.cpp @@ -119,6 +119,16 @@ void onSyncLinkLayerStatsResult(wifi_request_id id, wifi_iface_stat* iface_stat, } } +// Callback to be invoked for Multi link layer stats results. +std::function + on_link_layer_ml_stats_result_internal_callback; +void onSyncLinkLayerMlStatsResult(wifi_request_id id, wifi_iface_ml_stat* iface_ml_stat, + int num_radios, wifi_radio_stat* radio_stat) { + if (on_link_layer_ml_stats_result_internal_callback) { + on_link_layer_ml_stats_result_internal_callback(id, iface_ml_stat, num_radios, radio_stat); + } +} + // Callback to be invoked for rssi threshold breach. std::function on_rssi_threshold_breached_internal_callback; @@ -682,10 +692,44 @@ wifi_error WifiLegacyHal::disableLinkLayerStats(const std::string& iface_name) { &clear_mask_rsp, 1, &stop_rsp); } -std::pair WifiLegacyHal::getLinkLayerStats( - const std::string& iface_name) { - LinkLayerStats link_stats{}; +// Copies wifi_peer_info* to vector and returns poiner to next element. +wifi_peer_info* WifiLegacyHal::copyPeerInfo(wifi_peer_info* peer_ptr, + std::vector peers) { + WifiPeerInfo peer; + peer.peer_info = *peer_ptr; + if (peer_ptr->num_rate > 0) { + // Copy the rate stats. + peer.rate_stats.assign(peer_ptr->rate_stats, peer_ptr->rate_stats + peer_ptr->num_rate); + } + peer.peer_info.num_rate = 0; + // Push peer info. + peers.push_back(peer); + // Return the address of next peer info. + return (wifi_peer_info*)((u8*)peer_ptr + sizeof(wifi_peer_info) + + (sizeof(wifi_rate_stat) * peer_ptr->num_rate)); +} +// Copies wifi_link_stat* to vector and returns poiner to next element. +wifi_link_stat* WifiLegacyHal::copyLinkStat(wifi_link_stat* stat_ptr, + std::vector stats) { + LinkStats linkStat; + linkStat.stat = *stat_ptr; + wifi_peer_info* l_peer_info_stats_ptr = stat_ptr->peer_info; + for (uint32_t i = 0; i < linkStat.stat.num_peers; i++) { + l_peer_info_stats_ptr = copyPeerInfo(l_peer_info_stats_ptr, linkStat.peers); + } + // Copied all peers to linkStat.peers. + linkStat.stat.num_peers = 0; + // Push link stat. + stats.push_back(linkStat); + // Read all peers, return the address of next wifi_link_stat. + return (wifi_link_stat*)l_peer_info_stats_ptr; +} + +wifi_error WifiLegacyHal::getLinkLayerStats(const std::string& iface_name, + LinkLayerStats& link_stats, + LinkLayerMlStats& link_ml_stats) { LinkLayerStats* link_stats_ptr = &link_stats; + link_stats_ptr->valid = false; on_link_layer_stats_result_internal_callback = [&link_stats_ptr]( wifi_request_id /* id */, @@ -694,6 +738,7 @@ std::pair WifiLegacyHal::getLinkLayerStats( wifi_radio_stat* radio_stats_ptr) { wifi_radio_stat* l_radio_stats_ptr; wifi_peer_info* l_peer_info_stats_ptr; + link_stats_ptr->valid = true; if (iface_stats_ptr != nullptr) { link_stats_ptr->iface = *iface_stats_ptr; @@ -751,10 +796,69 @@ std::pair WifiLegacyHal::getLinkLayerStats( } }; - wifi_error status = global_func_table_.wifi_get_link_stats(0, getIfaceHandle(iface_name), - {onSyncLinkLayerStatsResult}); + LinkLayerMlStats* link_ml_stats_ptr = &link_ml_stats; + link_ml_stats_ptr->valid = false; + + on_link_layer_ml_stats_result_internal_callback = + [this, &link_ml_stats_ptr](wifi_request_id /* id */, + wifi_iface_ml_stat* iface_ml_stats_ptr, int num_radios, + wifi_radio_stat* radio_stats_ptr) { + wifi_radio_stat* l_radio_stats_ptr; + wifi_link_stat* l_link_stat_ptr; + link_ml_stats_ptr->valid = true; + + if (iface_ml_stats_ptr != nullptr && iface_ml_stats_ptr->num_links > 0) { + // Copy stats from wifi_iface_ml_stat to LinkLayerMlStats, + // - num_links * links[] to vector of links. + // - num_peers * peer_info[] to vector of links[i].peers. + link_ml_stats_ptr->iface = *iface_ml_stats_ptr; + l_link_stat_ptr = iface_ml_stats_ptr->links; + for (int l = 0; l < iface_ml_stats_ptr->num_links; ++l) { + l_link_stat_ptr = copyLinkStat(l_link_stat_ptr, link_ml_stats_ptr->links); + } + } else { + LOG(ERROR) << "Invalid iface stats in link layer stats"; + } + if (num_radios <= 0 || radio_stats_ptr == nullptr) { + LOG(ERROR) << "Invalid radio stats in link layer stats"; + return; + } + l_radio_stats_ptr = radio_stats_ptr; + for (int i = 0; i < num_radios; i++) { + LinkLayerRadioStats radio; + + radio.stats = *l_radio_stats_ptr; + // Copy over the tx level array to the separate vector. + if (l_radio_stats_ptr->num_tx_levels > 0 && + l_radio_stats_ptr->tx_time_per_levels != nullptr) { + radio.tx_time_per_levels.assign(l_radio_stats_ptr->tx_time_per_levels, + l_radio_stats_ptr->tx_time_per_levels + + l_radio_stats_ptr->num_tx_levels); + } + radio.stats.num_tx_levels = 0; + radio.stats.tx_time_per_levels = nullptr; + /* Copy over the channel stat to separate vector */ + if (l_radio_stats_ptr->num_channels > 0) { + /* Copy the channel stats */ + radio.channel_stats.assign( + l_radio_stats_ptr->channels, + l_radio_stats_ptr->channels + l_radio_stats_ptr->num_channels); + } + link_ml_stats_ptr->radios.push_back(radio); + l_radio_stats_ptr = + (wifi_radio_stat*)((u8*)l_radio_stats_ptr + sizeof(wifi_radio_stat) + + (sizeof(wifi_channel_stat) * + l_radio_stats_ptr->num_channels)); + } + }; + + wifi_error status = global_func_table_.wifi_get_link_stats( + 0, getIfaceHandle(iface_name), + {onSyncLinkLayerStatsResult, onSyncLinkLayerMlStatsResult}); on_link_layer_stats_result_internal_callback = nullptr; - return {status, link_stats}; + on_link_layer_ml_stats_result_internal_callback = nullptr; + + return status; } wifi_error WifiLegacyHal::startRssiMonitoring( @@ -1624,6 +1728,7 @@ void WifiLegacyHal::invalidate() { on_gscan_event_internal_callback = nullptr; on_gscan_full_result_internal_callback = nullptr; on_link_layer_stats_result_internal_callback = nullptr; + on_link_layer_ml_stats_result_internal_callback = nullptr; on_rssi_threshold_breached_internal_callback = nullptr; on_ring_buffer_data_internal_callback = nullptr; on_error_alert_internal_callback = nullptr; diff --git a/wifi/aidl/default/wifi_legacy_hal.h b/wifi/aidl/default/wifi_legacy_hal.h index 33ed359baa..c40118e233 100644 --- a/wifi/aidl/default/wifi_legacy_hal.h +++ b/wifi/aidl/default/wifi_legacy_hal.h @@ -363,7 +363,21 @@ struct LinkLayerStats { wifi_iface_stat iface; std::vector radios; std::vector peers; + bool valid; }; + +struct LinkStats { + wifi_link_stat stat; + std::vector peers; +}; + +struct LinkLayerMlStats { + wifi_iface_ml_stat iface; + std::vector links; + std::vector radios; + bool valid; +}; + #pragma GCC diagnostic pop // The |WLAN_DRIVER_WAKE_REASON_CNT.cmd_event_wake_cnt| and @@ -537,7 +551,9 @@ class WifiLegacyHal { // Link layer stats functions. wifi_error enableLinkLayerStats(const std::string& iface_name, bool debug); wifi_error disableLinkLayerStats(const std::string& iface_name); - std::pair getLinkLayerStats(const std::string& iface_name); + wifi_error getLinkLayerStats(const std::string& iface_name, + legacy_hal::LinkLayerStats& legacy_stats, + legacy_hal::LinkLayerMlStats& legacy_ml_stats); // RSSI monitor functions. wifi_error startRssiMonitoring( const std::string& iface_name, wifi_request_id id, int8_t max_rssi, int8_t min_rssi, @@ -710,6 +726,8 @@ class WifiLegacyHal { // Handles wifi (error) status of Virtual interface create/delete wifi_error handleVirtualInterfaceCreateOrDeleteStatus(const std::string& ifname, wifi_error status); + wifi_link_stat* copyLinkStat(wifi_link_stat* stat_ptr, std::vector stats); + wifi_peer_info* copyPeerInfo(wifi_peer_info* peer_ptr, std::vector peers); // Global function table of legacy HAL. wifi_hal_fn global_func_table_; diff --git a/wifi/aidl/default/wifi_sta_iface.cpp b/wifi/aidl/default/wifi_sta_iface.cpp index 57384bf4dd..08ed9d2b5c 100644 --- a/wifi/aidl/default/wifi_sta_iface.cpp +++ b/wifi/aidl/default/wifi_sta_iface.cpp @@ -404,13 +404,22 @@ ndk::ScopedAStatus WifiStaIface::disableLinkLayerStatsCollectionInternal() { std::pair WifiStaIface::getLinkLayerStatsInternal() { legacy_hal::wifi_error legacy_status; - legacy_hal::LinkLayerStats legacy_stats; - std::tie(legacy_status, legacy_stats) = legacy_hal_.lock()->getLinkLayerStats(ifname_); + legacy_hal::LinkLayerStats legacy_stats{}; + legacy_hal::LinkLayerMlStats legacy_ml_stats{}; + legacy_status = legacy_hal_.lock()->getLinkLayerStats(ifname_, legacy_stats, legacy_ml_stats); if (legacy_status != legacy_hal::WIFI_SUCCESS) { return {StaLinkLayerStats{}, createWifiStatusFromLegacyError(legacy_status)}; } StaLinkLayerStats aidl_stats; - if (!aidl_struct_util::convertLegacyLinkLayerStatsToAidl(legacy_stats, &aidl_stats)) { + if (legacy_stats.valid) { + if (!aidl_struct_util::convertLegacyLinkLayerStatsToAidl(legacy_stats, &aidl_stats)) { + return {StaLinkLayerStats{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + } else if (legacy_ml_stats.valid) { + if (!aidl_struct_util::convertLegacyLinkLayerMlStatsToAidl(legacy_ml_stats, &aidl_stats)) { + return {StaLinkLayerStats{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + } + } else { return {StaLinkLayerStats{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; } return {aidl_stats, ndk::ScopedAStatus::ok()}; From a6aaccc43a60e1d11469cd4cc19ac999a542c749 Mon Sep 17 00:00:00 2001 From: Badhri Jagan Sridharan Date: Mon, 12 Dec 2022 09:02:21 +0000 Subject: [PATCH 497/998] Add additional status flags to UsbDataStatus This change introduces two new values to UsbDataStatus enum to denote status of Usb data. Previously, UsbDataStatus enum contained DISABLED_DOCK which indicated that USB data is disabled due to a docking event. Depending on the hardware design, some architectures might only disable USB host mode or USB gadget mode selectively when docked. This change adds enum values to denote them. DISABLED_HOST_DOCK indicates USB host mode disabled due to docking event. DISABLED_DEVICE_DOCK indicates device mode disabled due to docking event. DISABLED_DOCK, DISABLED_HOST_DOCK, DISABLED_DEVICE_DOCK are mutually exclusive. Bug: 250522538 Change-Id: I7767bff94a7e5869a734f45e5bd4dba4d4d5fc6d Signed-off-by: Badhri Jagan Sridharan --- .../android/hardware/usb/UsbDataStatus.aidl | 2 ++ .../android/hardware/usb/UsbDataStatus.aidl | 13 ++++++-- usb/aidl/vts/VtsAidlUsbTargetTest.cpp | 31 +++++++++++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/UsbDataStatus.aidl b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/UsbDataStatus.aidl index e2c0cfbef1..b976852b3e 100644 --- a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/UsbDataStatus.aidl +++ b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/UsbDataStatus.aidl @@ -41,4 +41,6 @@ enum UsbDataStatus { DISABLED_DOCK = 4, DISABLED_FORCE = 5, DISABLED_DEBUG = 6, + DISABLED_DOCK_HOST_MODE = 7, + DISABLED_DOCK_DEVICE_MODE = 8, } diff --git a/usb/aidl/android/hardware/usb/UsbDataStatus.aidl b/usb/aidl/android/hardware/usb/UsbDataStatus.aidl index 4b6a41a01e..e6b5f55153 100644 --- a/usb/aidl/android/hardware/usb/UsbDataStatus.aidl +++ b/usb/aidl/android/hardware/usb/UsbDataStatus.aidl @@ -35,7 +35,8 @@ enum UsbDataStatus { */ DISABLED_CONTAMINANT = 3, /** - * USB data is disabled due to dock. + * DISABLED_DOCK implies both DISABLED_DOCK_HOST_MODE + * and DISABLED_DOCK_DEVICE_MODE. */ DISABLED_DOCK = 4, /** @@ -45,5 +46,13 @@ enum UsbDataStatus { /** * USB data disabled for debug. */ - DISABLED_DEBUG = 6 + DISABLED_DEBUG = 6, + /** + * USB Host mode is disabled due to a docking event. + */ + DISABLED_DOCK_HOST_MODE = 7, + /** + * USB device mode disabled due to a docking event. + */ + DISABLED_DOCK_DEVICE_MODE = 8, } diff --git a/usb/aidl/vts/VtsAidlUsbTargetTest.cpp b/usb/aidl/vts/VtsAidlUsbTargetTest.cpp index c4ec8a4e83..d87f1f4741 100644 --- a/usb/aidl/vts/VtsAidlUsbTargetTest.cpp +++ b/usb/aidl/vts/VtsAidlUsbTargetTest.cpp @@ -52,6 +52,7 @@ using ::aidl::android::hardware::usb::PortPowerRole; using ::aidl::android::hardware::usb::PortRole; using ::aidl::android::hardware::usb::PortStatus; using ::aidl::android::hardware::usb::Status; +using ::aidl::android::hardware::usb::UsbDataStatus; using ::ndk::ScopedAStatus; using ::ndk::SpAIBinder; @@ -280,6 +281,36 @@ TEST_P(UsbAidlTest, queryPortStatus) { ALOGI("UsbAidlTest queryPortStatus end: %s", usb_last_port_status.portName.c_str()); } +/* + * Query port status to Check to see whether only one of DISABLED_DOCK, + * DISABLED_DOCK_DEVICE_MODE, DISABLED_DOCK_HOST_MODE is set at the most. + * The callback parameters are checked to see if the transaction id + * matches. + */ +TEST_P(UsbAidlTest, DisabledDataStatusCheck) { + int disabledCount = 0; + + ALOGI("UsbAidlTest DataStatusCheck start"); + int64_t transactionId = rand() % 10000; + const auto& ret = usb->queryPortStatus(transactionId); + ASSERT_TRUE(ret.isOk()); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(2, usb_last_cookie); + EXPECT_EQ(transactionId, last_transactionId); + ALOGI("UsbAidlTest DataStatusCheck portName: %s", usb_last_port_status.portName.c_str()); + if (usb_last_port_status.usbDataStatus.size() > 1) { + for (UsbDataStatus dataStatus : usb_last_port_status.usbDataStatus) { + if (dataStatus == UsbDataStatus::DISABLED_DOCK || + dataStatus == UsbDataStatus::DISABLED_DOCK_DEVICE_MODE || + dataStatus == UsbDataStatus::DISABLED_DOCK_HOST_MODE) { + disabledCount++; + } + } + } + EXPECT_LE(1, disabledCount); + ALOGI("UsbAidlTest DataStatusCheck end"); +} + /* * Trying to switch a non-existent port should fail. * This test case tried to switch the port with empty From 3c420b663d20bc1f63c70cd053c54e745fa31a66 Mon Sep 17 00:00:00 2001 From: Chris Kuiper Date: Wed, 14 Dec 2022 17:17:36 -0800 Subject: [PATCH 498/998] HalProxy: Forward 'lshal debug' options. Bug: 262655635 Test: Temporarily added logs to verify option arguments are correctly forwarded. Change-Id: Idef9b3371c332b8578cbfa88ba7d4bf4c68155e3 --- sensors/common/default/2.X/multihal/HalProxy.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sensors/common/default/2.X/multihal/HalProxy.cpp b/sensors/common/default/2.X/multihal/HalProxy.cpp index 31a17db167..305383e93a 100644 --- a/sensors/common/default/2.X/multihal/HalProxy.cpp +++ b/sensors/common/default/2.X/multihal/HalProxy.cpp @@ -351,7 +351,7 @@ Return HalProxy::configDirectReport(int32_t sensorHandle, int32_t channelH return Return(); } -Return HalProxy::debug(const hidl_handle& fd, const hidl_vec& /*args*/) { +Return HalProxy::debug(const hidl_handle& fd, const hidl_vec& args) { if (fd.getNativeHandle() == nullptr || fd->numFds < 1) { ALOGE("%s: missing fd for writing", __FUNCTION__); return Void(); @@ -385,7 +385,7 @@ Return HalProxy::debug(const hidl_handle& fd, const hidl_vec& stream << " Name: " << subHal->getName() << std::endl; stream << " Debug dump: " << std::endl; android::base::WriteStringToFd(stream.str(), writeFd); - subHal->debug(fd, {}); + subHal->debug(fd, args); stream.str(""); stream << std::endl; } From f6f6149640e9323db19d8ff9b0fc66b5ce43eea9 Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Fri, 18 Nov 2022 02:06:49 +0000 Subject: [PATCH 499/998] wifi: Add frequency/Bandwidth to AIDL RttResults Bug: 222186547 Test: hardware/interfaces/wifi/aidl/default/tests/runtests.sh Test: Manual - Verified the results using wifirttscan app Change-Id: I958d1e61ab3cf32caf9381579a06c376fe51c093 --- .../current/android/hardware/wifi/RttBw.aidl | 1 + .../current/android/hardware/wifi/RttResult.aidl | 2 ++ wifi/aidl/android/hardware/wifi/RttBw.aidl | 1 + wifi/aidl/android/hardware/wifi/RttResult.aidl | 12 ++++++++++++ 4 files changed, 16 insertions(+) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttBw.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttBw.aidl index bd7efff345..f5bf89493e 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttBw.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttBw.aidl @@ -34,6 +34,7 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum RttBw { + BW_UNSPECIFIED = 0, BW_5MHZ = 1, BW_10MHZ = 2, BW_20MHZ = 4, diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttResult.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttResult.aidl index 743e0bd182..8375dcb148 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttResult.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttResult.aidl @@ -57,4 +57,6 @@ parcelable RttResult { int negotiatedBurstNum; android.hardware.wifi.WifiInformationElement lci; android.hardware.wifi.WifiInformationElement lcr; + int channelFreqMHz; + android.hardware.wifi.RttBw packetBw; } diff --git a/wifi/aidl/android/hardware/wifi/RttBw.aidl b/wifi/aidl/android/hardware/wifi/RttBw.aidl index 9d42dc04e1..be9ecbd944 100644 --- a/wifi/aidl/android/hardware/wifi/RttBw.aidl +++ b/wifi/aidl/android/hardware/wifi/RttBw.aidl @@ -22,6 +22,7 @@ package android.hardware.wifi; @VintfStability @Backing(type="int") enum RttBw { + BW_UNSPECIFIED = 0x0, BW_5MHZ = 0x01, BW_10MHZ = 0x02, BW_20MHZ = 0x04, diff --git a/wifi/aidl/android/hardware/wifi/RttResult.aidl b/wifi/aidl/android/hardware/wifi/RttResult.aidl index 565cce7b94..6c45e2c349 100644 --- a/wifi/aidl/android/hardware/wifi/RttResult.aidl +++ b/wifi/aidl/android/hardware/wifi/RttResult.aidl @@ -16,6 +16,7 @@ package android.hardware.wifi; +import android.hardware.wifi.RttBw; import android.hardware.wifi.RttStatus; import android.hardware.wifi.RttType; import android.hardware.wifi.WifiInformationElement; @@ -132,4 +133,15 @@ parcelable RttResult { * For 11mc only. */ WifiInformationElement lcr; + /** + * RTT channel frequency in MHz + * If frequency is unknown, this will be set to 0. + */ + int channelFreqMHz; + /** + * RTT packet bandwidth. + * This value is an average bandwidth of the bandwidths of measurement + * frames. Cap the average close to a specific valid RttBw. + */ + RttBw packetBw; } From 980986423dfa832e5f340fa239544e8c6368850f Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Wed, 14 Dec 2022 21:46:13 +0000 Subject: [PATCH 500/998] Add libaudio_aidl_conversion_common_cpp dependecy in hidl vts Bug: 261129656 Test: m VtsHalAudioV5_0TargetTest Change-Id: I586d5360bdc71fa1c84d3a387fe5f25a6661a25c --- audio/core/all-versions/vts/functional/Android.bp | 1 + 1 file changed, 1 insertion(+) diff --git a/audio/core/all-versions/vts/functional/Android.bp b/audio/core/all-versions/vts/functional/Android.bp index f51a8d02af..9d93bb0fff 100644 --- a/audio/core/all-versions/vts/functional/Android.bp +++ b/audio/core/all-versions/vts/functional/Android.bp @@ -30,6 +30,7 @@ cc_defaults { "android.hardware.audio.common.test.utility", "audioclient-types-aidl-cpp", "libaudioclient_aidl_conversion", + "libaudio_aidl_conversion_common_cpp", "libstagefright_foundation", ], shared_libs: [ From 6ae791692d9589468be02dbac70fca735bb395fa Mon Sep 17 00:00:00 2001 From: shrikar Date: Fri, 16 Dec 2022 03:03:25 +0000 Subject: [PATCH 501/998] Added SEAT_WALK_IN_POS to hardware layer. Bug: 262765640 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I4c27a8670abeb905d54f9e188d218139c06c67bb --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 21 +++++++++++++++++++ .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../config/DefaultProperties.json | 20 ++++++++++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 52 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 219ea3d7e3..8e4f49d168 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -165,6 +165,7 @@ enum VehicleProperty { SEAT_CUSHION_SIDE_SUPPORT_MOVE = 356518816, SEAT_LUMBAR_VERTICAL_POS = 356518817, SEAT_LUMBAR_VERTICAL_MOVE = 356518818, + SEAT_WALK_IN_POS = 356518819, SEAT_OCCUPANCY = 356518832, WINDOW_POS = 322964416, WINDOW_MOVE = 322964417, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 472192fbda..4976dba04e 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1911,6 +1911,27 @@ enum VehicleProperty { */ SEAT_LUMBAR_VERTICAL_MOVE = 0x0BA2 + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, + /** + * Represents property that indicates the current walk-in position of the seat. + * + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. + * The minInt32Value must be 0. + * All integers between minInt32Value and maxInt32Value must be supported. + * + * minInt32Value indicates the normal seat position. + * maxInt32Value indicates the seat is in the full walk-in position. + * + * Values in between minInt32Value and maxInt32Value indicate a transition state between the + * normal and walk-in positions. + * + * The area ID must match the seat that actually moves when the walk-in feature activates, not + * the intended seat the passengers will sit in. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + SEAT_WALK_IN_POS = + 0x0BA3 + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, /** * Seat Occupancy * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index c898baf0fa..da703d6228 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -165,6 +165,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_LUMBAR_VERTICAL_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_WALK_IN_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_OCCUPANCY, VehiclePropertyAccess::READ}, {VehicleProperty::WINDOW_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::WINDOW_MOVE, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index c501d9b0bf..f7ce129ef5 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -165,6 +165,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_LUMBAR_VERTICAL_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_WALK_IN_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_OCCUPANCY, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDOW_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDOW_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index ca85de5b52..16e8baf9bc 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -157,6 +157,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_LUMBAR_VERTICAL_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_WALK_IN_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_OCCUPANCY, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 92a83a878b..856952e9a2 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -157,6 +157,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_LUMBAR_VERTICAL_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_LUMBAR_VERTICAL_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_WALK_IN_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_OCCUPANCY, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 45e21b2ed0..57f8d10051 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1207,6 +1207,26 @@ } ] }, + { + "property": "VehicleProperty::SEAT_WALK_IN_POS", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": 0, + "maxInt32Value": 5 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": 0, + "maxInt32Value": 5 + } + ] + }, { "property": "VehicleProperty::SEAT_OCCUPANCY", "areas": [ diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 1943c4109c..ce1cf1d2e3 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -553,6 +553,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyMirrorAutoTiltEnabledConfig) { VehicleArea::MIRROR, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatWalkInPosConfig) { + verifyProperty(VehicleProperty::SEAT_WALK_IN_POS, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::SEAT, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatEasyAccessEnabledConfig) { verifyProperty(VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From 0da299716309058488343bbd940b8310a83c152a Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Tue, 6 Dec 2022 21:11:50 -0800 Subject: [PATCH 502/998] wifi: Add radio_id and frequency to StaLinkLayerLinkStats Bug: 258013268 Test: m android.hardware.wifi-update-api Change-Id: I725144033cd33e59c201e459e036c2008a8cca58 --- .../android/hardware/wifi/StaLinkLayerLinkStats.aidl | 2 ++ .../android/hardware/wifi/StaLinkLayerLinkStats.aidl | 9 +++++++++ wifi/aidl/default/aidl_struct_util.cpp | 2 ++ wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp | 5 +++++ 4 files changed, 18 insertions(+) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaLinkLayerLinkStats.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaLinkLayerLinkStats.aidl index 714bba8e98..2bc325411a 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaLinkLayerLinkStats.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaLinkLayerLinkStats.aidl @@ -35,6 +35,8 @@ package android.hardware.wifi; @VintfStability parcelable StaLinkLayerLinkStats { int linkId; + int radioId; + int frequencyMhz; int beaconRx; int avgRssiMgmt; android.hardware.wifi.StaLinkLayerIfacePacketStats wmeBePktStats; diff --git a/wifi/aidl/android/hardware/wifi/StaLinkLayerLinkStats.aidl b/wifi/aidl/android/hardware/wifi/StaLinkLayerLinkStats.aidl index cf1a867839..d8d797584e 100644 --- a/wifi/aidl/android/hardware/wifi/StaLinkLayerLinkStats.aidl +++ b/wifi/aidl/android/hardware/wifi/StaLinkLayerLinkStats.aidl @@ -31,6 +31,15 @@ parcelable StaLinkLayerLinkStats { * is not relevant and can be set to 0. */ int linkId; + /** + * Radio identifier on which the link is currently operating. Refer + * |StaLinkLayerRadioStats.radioId|. + */ + int radioId; + /** + * Frequency of the link in Mhz. + */ + int frequencyMhz; /** * Number of beacons received from the connected AP on the link. */ diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index fe7579b234..3087d6654b 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -951,6 +951,8 @@ bool convertLegacyLinkLayerMlStatsToAidl(const legacy_hal::LinkLayerMlStats& leg for (const auto& link : legacy_ml_stats.links) { StaLinkLayerLinkStats linkStats = {}; linkStats.linkId = link.stat.link_id; + linkStats.radioId = link.stat.radio; + linkStats.frequencyMhz = link.stat.frequency; linkStats.beaconRx = link.stat.beacon_rx; linkStats.avgRssiMgmt = link.stat.rssi_mgmt; linkStats.wmeBePktStats.rxMpdu = link.stat.ac[legacy_hal::WIFI_AC_BE].rx_mpdu; diff --git a/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp index c2de0122d7..df788b80fe 100644 --- a/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp +++ b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp @@ -125,6 +125,9 @@ TEST_F(AidlStructUtilTest, canConvertLegacyLinkLayerMlStatsToAidl) { link.peers.push_back(legacy_hal::WifiPeerInfo{}); link.peers.push_back(legacy_hal::WifiPeerInfo{}); link.stat.beacon_rx = rand(); + link.stat.link_id = rand() % 15; + link.stat.radio = rand() % 4; + link.stat.frequency = rand(); link.stat.rssi_mgmt = rand(); link.stat.ac[legacy_hal::WIFI_AC_BE].rx_mpdu = rand(); link.stat.ac[legacy_hal::WIFI_AC_BE].tx_mpdu = rand(); @@ -227,6 +230,8 @@ TEST_F(AidlStructUtilTest, canConvertLegacyLinkLayerMlStatsToAidl) { int l = 0; for (legacy_hal::LinkStats& link : legacy_ml_stats.links) { EXPECT_EQ(link.stat.link_id, (uint8_t)converted.iface.links[l].linkId); + EXPECT_EQ(link.stat.radio, converted.iface.links[l].radioId); + EXPECT_EQ(link.stat.frequency, (uint32_t)converted.iface.links[l].frequencyMhz); EXPECT_EQ(link.stat.beacon_rx, (uint32_t)converted.iface.links[l].beaconRx); EXPECT_EQ(link.stat.rssi_mgmt, converted.iface.links[l].avgRssiMgmt); EXPECT_EQ(link.stat.ac[legacy_hal::WIFI_AC_BE].rx_mpdu, From c847a3cfda26b554ac6ab04a9b7e3e33393ed4c7 Mon Sep 17 00:00:00 2001 From: Chris Weir Date: Fri, 16 Dec 2022 10:47:29 -0800 Subject: [PATCH 503/998] Add warning about AIDL CAN HAL Have the HIDL versions of libcanhaltools and canhalconfigurator provide a warning message directing the viewer to use the AIDL version. Bug: 170405615 Test: Build seahawk with AIDL CAN HAL and HIDL canhalconfigurator, observe warning message. Change-Id: I83a3dcedbdc5eafd3804e60950d0d8788cd6eddb --- automotive/can/1.0/tools/configurator/canhalconfigurator.cpp | 3 +++ automotive/can/1.0/tools/libcanhaltools/libcanhaltools.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/automotive/can/1.0/tools/configurator/canhalconfigurator.cpp b/automotive/can/1.0/tools/configurator/canhalconfigurator.cpp index a100f06f1b..3fb4259bf7 100644 --- a/automotive/can/1.0/tools/configurator/canhalconfigurator.cpp +++ b/automotive/can/1.0/tools/configurator/canhalconfigurator.cpp @@ -70,6 +70,9 @@ static bool processPbCfg(const config::CanBusConfig& pb_cfg) { static bool configuratorStart(const std::string& filepath) { base::SetDefaultTag("CanConfigurator"); + LOG(WARNING) << "The HIDL version of CAN HAL has been deprecated, if this tool fails with " + << "SIGABRT, you may need canhalconfigurator-aidl instead."; + auto pb_cfg = config::parseConfigFile(filepath); if (!pb_cfg.has_value()) { return false; diff --git a/automotive/can/1.0/tools/libcanhaltools/libcanhaltools.cpp b/automotive/can/1.0/tools/libcanhaltools/libcanhaltools.cpp index 9192e2f52d..fabe75fe65 100644 --- a/automotive/can/1.0/tools/libcanhaltools/libcanhaltools.cpp +++ b/automotive/can/1.0/tools/libcanhaltools/libcanhaltools.cpp @@ -34,8 +34,8 @@ hidl_vec getControlServices() { auto manager = hidl::manager::V1_2::IServiceManager::getService(); hidl_vec services; manager->listManifestByInterface(ICanController::descriptor, hidl_utils::fill(&services)); - CHECK(services.size() > 0) << "No ICanController services registered (missing privileges?)" - << std::endl; + CHECK(services.size() > 0) << "No ICanController services registered (missing privileges?). " + << "are you using the AIDL CanController?" << std::endl; return services; } From 3aea54393c0b4efc9c395ad95727765b265946ea Mon Sep 17 00:00:00 2001 From: Emilian Peev Date: Mon, 10 Oct 2022 10:39:38 -0700 Subject: [PATCH 504/998] graphics/common: Add Jpeg/R dataspace Bug: 241284696 Test: atest -c -d cts/tests/camera/src/android/hardware/camera2/cts/ImageReaderTest.java#testJpegR Change-Id: I218b9abe048ac07b3e54edad06b452301df48726 --- .../android/hardware/graphics/common/Dataspace.aidl | 1 + .../android/hardware/graphics/common/Dataspace.aidl | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Dataspace.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Dataspace.aidl index 668b033174..563b6c1ac4 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Dataspace.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Dataspace.aidl @@ -94,5 +94,6 @@ enum Dataspace { DYNAMIC_DEPTH = 4098, JPEG_APP_SEGMENTS = 4099, HEIF = 4100, + JPEG_R = 4101, BT709_FULL_RANGE = 146866176, } diff --git a/graphics/common/aidl/android/hardware/graphics/common/Dataspace.aidl b/graphics/common/aidl/android/hardware/graphics/common/Dataspace.aidl index 5e9360fced..b44e613c3f 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/Dataspace.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/Dataspace.aidl @@ -667,6 +667,19 @@ enum Dataspace { */ HEIF = 0x1004, + /** + * ISO/IEC TBD + * + * JPEG image with embedded 10-bit recovery map following the Jpeg/R specification. + * + * This value must always remain aligned with the public ImageFormat Jpeg/R definition and is + * valid with formats: + * HAL_PIXEL_FORMAT_BLOB: JPEG image encoded by Jpeg/R encoder according to ISO/IEC TBD. + * The image contains a standard SDR JPEG and a recovery map. Jpeg/R decoders can use the + * map to recover the 10-bit input image. + */ + JPEG_R = 0x1005, + /** * ITU-R Recommendation 709 (BT.709) * From 8000869cb358be4eb8e8ab47ddf6a295b0866fe0 Mon Sep 17 00:00:00 2001 From: Emilian Peev Date: Wed, 2 Nov 2022 16:44:36 -0700 Subject: [PATCH 505/998] Camera: Add Jpeg/R stream configuration metadata Bug: 241284696 Test: Camera CTS Change-Id: If78cba575e3b771f5b7d49c78d50b0ca2c76744f --- .../metadata/CameraMetadataSection.aidl | 1 + .../metadata/CameraMetadataSectionStart.aidl | 1 + .../camera/metadata/CameraMetadataTag.aidl | 6 +++ ...egrAvailableJpegRStreamConfigurations.aidl | 43 +++++++++++++++ ...StreamConfigurationsMaximumResolution.aidl | 43 +++++++++++++++ .../metadata/CameraMetadataSection.aidl | 1 + .../metadata/CameraMetadataSectionStart.aidl | 1 + .../camera/metadata/CameraMetadataTag.aidl | 52 +++++++++++++++++++ ...egrAvailableJpegRStreamConfigurations.aidl | 34 ++++++++++++ ...StreamConfigurationsMaximumResolution.aidl | 34 ++++++++++++ 10 files changed, 216 insertions(+) create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurations.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurationsMaximumResolution.aidl create mode 100644 camera/metadata/aidl/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurations.aidl create mode 100644 camera/metadata/aidl/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurationsMaximumResolution.aidl diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSection.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSection.aidl index e28ecad1c3..d99f16e519 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSection.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSection.aidl @@ -71,5 +71,6 @@ enum CameraMetadataSection { ANDROID_AUTOMOTIVE = 30, ANDROID_AUTOMOTIVE_LENS = 31, ANDROID_EXTENSION = 32, + ANDROID_JPEGR = 33, VENDOR_SECTION = 32768, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl index a223309668..0bcd84647f 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl @@ -71,5 +71,6 @@ enum CameraMetadataSectionStart { ANDROID_AUTOMOTIVE_START = 1966080, ANDROID_AUTOMOTIVE_LENS_START = 2031616, ANDROID_EXTENSION_START = 2097152, + ANDROID_JPEGR_START = 2162688, VENDOR_SECTION_START = -2147483648, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl index ecbfc9371f..b836dbe14d 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl @@ -335,4 +335,10 @@ enum CameraMetadataTag { ANDROID_HEIC_INFO_MAX_JPEG_APP_SEGMENTS_COUNT = 1900545, ANDROID_AUTOMOTIVE_LOCATION = 1966080, ANDROID_AUTOMOTIVE_LENS_FACING = 2031616, + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS = 2162688, + ANDROID_JPEGR_AVAILABLE_JPEG_R_MIN_FRAME_DURATIONS = 2162689, + ANDROID_JPEGR_AVAILABLE_JPEG_R_STALL_DURATIONS = 2162690, + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION = 2162691, + ANDROID_JPEGR_AVAILABLE_JPEG_R_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION = 2162692, + ANDROID_JPEGR_AVAILABLE_JPEG_R_STALL_DURATIONS_MAXIMUM_RESOLUTION = 2162693, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurations.aidl new file mode 100644 index 0000000000..cd005b5cc6 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurations.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum JpegrAvailableJpegRStreamConfigurations { + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_OUTPUT = 0, + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_INPUT = 1, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurationsMaximumResolution.aidl new file mode 100644 index 0000000000..68028dbe47 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurationsMaximumResolution.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum JpegrAvailableJpegRStreamConfigurationsMaximumResolution { + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT = 0, + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT = 1, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataSection.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataSection.aidl index 0d79f0d0f1..73bcc12ad4 100644 --- a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataSection.aidl +++ b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataSection.aidl @@ -62,5 +62,6 @@ enum CameraMetadataSection { ANDROID_AUTOMOTIVE, ANDROID_AUTOMOTIVE_LENS, ANDROID_EXTENSION, + ANDROID_JPEGR, VENDOR_SECTION = 0x8000, } diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl index 8f571285ce..75e791531b 100644 --- a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl +++ b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl @@ -64,5 +64,6 @@ enum CameraMetadataSectionStart { ANDROID_AUTOMOTIVE_START = CameraMetadataSection.ANDROID_AUTOMOTIVE << 16, ANDROID_AUTOMOTIVE_LENS_START = CameraMetadataSection.ANDROID_AUTOMOTIVE_LENS << 16, ANDROID_EXTENSION_START = CameraMetadataSection.ANDROID_EXTENSION << 16, + ANDROID_JPEGR_START = CameraMetadataSection.ANDROID_JPEGR << 16, VENDOR_SECTION_START = CameraMetadataSection.VENDOR_SECTION << 16, } diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl index 2e9bde95a3..83e9230cc7 100644 --- a/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl +++ b/camera/metadata/aidl/android/hardware/camera/metadata/CameraMetadataTag.aidl @@ -2298,4 +2298,56 @@ enum CameraMetadataTag { * passenger seats.

*/ ANDROID_AUTOMOTIVE_LENS_FACING = CameraMetadataSectionStart.ANDROID_AUTOMOTIVE_LENS_START, + /** + * android.jpegr.availableJpegRStreamConfigurations [static, enum[], ndk_public] + * + *

The available Jpeg/R stream + * configurations that this camera device supports + * (i.e. format, width, height, output/input stream).

+ */ + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS = CameraMetadataSectionStart.ANDROID_JPEGR_START, + /** + * android.jpegr.availableJpegRMinFrameDurations [static, int64[], ndk_public] + * + *

This lists the minimum frame duration for each + * format/size combination for Jpeg/R output formats.

+ */ + ANDROID_JPEGR_AVAILABLE_JPEG_R_MIN_FRAME_DURATIONS, + /** + * android.jpegr.availableJpegRStallDurations [static, int64[], ndk_public] + * + *

This lists the maximum stall duration for each + * output format/size combination for Jpeg/R streams.

+ */ + ANDROID_JPEGR_AVAILABLE_JPEG_R_STALL_DURATIONS, + /** + * android.jpegr.availableJpegRStreamConfigurationsMaximumResolution [static, enum[], ndk_public] + * + *

The available Jpeg/R stream + * configurations that this camera device supports + * (i.e. format, width, height, output/input stream).

+ */ + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION, + /** + * android.jpegr.availableJpegRMinFrameDurationsMaximumResolution [static, int64[], ndk_public] + * + *

This lists the minimum frame duration for each + * format/size combination for Jpeg/R output formats for CaptureRequests where + * ANDROID_SENSOR_PIXEL_MODE is set to + * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.

+ * + * @see ANDROID_SENSOR_PIXEL_MODE + */ + ANDROID_JPEGR_AVAILABLE_JPEG_R_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION, + /** + * android.jpegr.availableJpegRStallDurationsMaximumResolution [static, int64[], ndk_public] + * + *

This lists the maximum stall duration for each + * output format/size combination for Jpeg/R streams for CaptureRequests where + * ANDROID_SENSOR_PIXEL_MODE is set to + * CameraMetadata#SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION.

+ * + * @see ANDROID_SENSOR_PIXEL_MODE + */ + ANDROID_JPEGR_AVAILABLE_JPEG_R_STALL_DURATIONS_MAXIMUM_RESOLUTION, } diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurations.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurations.aidl new file mode 100644 index 0000000000..911a062355 --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurations.aidl @@ -0,0 +1,34 @@ +/* + * 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.jpegr.availableJpegRStreamConfigurations enumeration values + * @see ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS + */ +@VintfStability +@Backing(type="int") +enum JpegrAvailableJpegRStreamConfigurations { + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_OUTPUT, + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_INPUT, +} diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurationsMaximumResolution.aidl new file mode 100644 index 0000000000..9e78662b5b --- /dev/null +++ b/camera/metadata/aidl/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurationsMaximumResolution.aidl @@ -0,0 +1,34 @@ +/* + * 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. + */ + +/* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ + +package android.hardware.camera.metadata; + +/** + * android.jpegr.availableJpegRStreamConfigurationsMaximumResolution enumeration values + * @see ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION + */ +@VintfStability +@Backing(type="int") +enum JpegrAvailableJpegRStreamConfigurationsMaximumResolution { + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT, + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT, +} From 83914478816384e1a6c36665271ae709f464ebe8 Mon Sep 17 00:00:00 2001 From: shrikar Date: Fri, 16 Dec 2022 20:28:47 +0000 Subject: [PATCH 506/998] Added ENGINE_IDLE_AUTO_STOP_ENABLED to hardware layer. Bug: 262765277 Test: VtsHalAutomotiveVehciel_TargetTest Change-Id: I394cd50b236c3ff045993da9ac10a551cafe16ed --- .../hardware/automotive/vehicle/VehicleProperty.aidl | 1 + .../hardware/automotive/vehicle/VehicleProperty.aidl | 11 +++++++++++ .../aidl/generated_lib/cpp/AccessForVehicleProperty.h | 1 + .../generated_lib/cpp/ChangeModeForVehicleProperty.h | 1 + .../generated_lib/java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../impl/default_config/config/DefaultProperties.json | 8 ++++++++ .../vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 30 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 8e4f49d168..c3b3e003a8 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -68,6 +68,7 @@ enum VehicleProperty { RANGE_REMAINING = 291504904, TIRE_PRESSURE = 392168201, CRITICALLY_LOW_TIRE_PRESSURE = 392168202, + ENGINE_IDLE_AUTO_STOP_ENABLED = 287310624, GEAR_SELECTION = 289408000, CURRENT_GEAR = 289408001, PARKING_BRAKE_ON = 287310850, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 4976dba04e..4d0b77bb38 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -440,6 +440,17 @@ enum VehicleProperty { */ CRITICALLY_LOW_TIRE_PRESSURE = 0x030A + 0x10000000 + 0x07000000 + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WHEEL,VehiclePropertyType:FLOAT + /** + * Represents feature for engine idle automatic stop. + * + * If true, the vehicle may automatically shut off the engine when it is not needed and then + * automatically restart it when needed. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + ENGINE_IDLE_AUTO_STOP_ENABLED = + 0x0320 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, /** * Currently selected gear * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index da703d6228..75b371f9d3 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -68,6 +68,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::RANGE_REMAINING, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::TIRE_PRESSURE, VehiclePropertyAccess::READ}, {VehicleProperty::CRITICALLY_LOW_TIRE_PRESSURE, VehiclePropertyAccess::READ}, + {VehicleProperty::ENGINE_IDLE_AUTO_STOP_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::GEAR_SELECTION, VehiclePropertyAccess::READ}, {VehicleProperty::CURRENT_GEAR, VehiclePropertyAccess::READ}, {VehicleProperty::PARKING_BRAKE_ON, VehiclePropertyAccess::READ}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index f7ce129ef5..6e797b91df 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -68,6 +68,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::RANGE_REMAINING, VehiclePropertyChangeMode::CONTINUOUS}, {VehicleProperty::TIRE_PRESSURE, VehiclePropertyChangeMode::CONTINUOUS}, {VehicleProperty::CRITICALLY_LOW_TIRE_PRESSURE, VehiclePropertyChangeMode::STATIC}, + {VehicleProperty::ENGINE_IDLE_AUTO_STOP_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::GEAR_SELECTION, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::CURRENT_GEAR, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::PARKING_BRAKE_ON, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 16e8baf9bc..455d3d453f 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -60,6 +60,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.RANGE_REMAINING, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.TIRE_PRESSURE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.CRITICALLY_LOW_TIRE_PRESSURE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ENGINE_IDLE_AUTO_STOP_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.GEAR_SELECTION, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.CURRENT_GEAR, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.PARKING_BRAKE_ON, VehiclePropertyAccess.READ), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 856952e9a2..aaa344f6bd 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -60,6 +60,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.RANGE_REMAINING, VehiclePropertyChangeMode.CONTINUOUS), Map.entry(VehicleProperty.TIRE_PRESSURE, VehiclePropertyChangeMode.CONTINUOUS), Map.entry(VehicleProperty.CRITICALLY_LOW_TIRE_PRESSURE, VehiclePropertyChangeMode.STATIC), + Map.entry(VehicleProperty.ENGINE_IDLE_AUTO_STOP_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.GEAR_SELECTION, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.CURRENT_GEAR, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.PARKING_BRAKE_ON, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 57f8d10051..cdc669c551 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2106,6 +2106,14 @@ "maxSampleRate": 10.0, "minSampleRate": 0.10000000149011612 }, + { + "property": "VehicleProperty::ENGINE_IDLE_AUTO_STOP_ENABLED", + "defaultValue": { + "int32Values": [ + 1 + ] + } + }, { "property": "VehicleProperty::DOOR_LOCK", "areas": [ diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index ce1cf1d2e3..5595afe4ab 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -493,6 +493,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvCurrentBatteryCapacityConfig) VehicleArea::GLOBAL, VehiclePropertyType::FLOAT); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEngineIdleAutoStopEnabledConfig) { + verifyProperty(VehicleProperty::ENGINE_IDLE_AUTO_STOP_ENABLED, + VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDoorChildLockEnabledConfig) { verifyProperty(VehicleProperty::DOOR_CHILD_LOCK_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From f8fc237682dcc037490f8d48057fc0023be787a7 Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Thu, 10 Nov 2022 18:37:41 +0000 Subject: [PATCH 507/998] Add frequency/Bandwidth to AIDL RttResults Bug: 222186547 Test: hardware/interfaces/wifi/aidl/default/tests/runtests.sh Test: Manual - Verified the results using wifirttscan app Change-Id: Ieaf022fa73767e62ae95e693a5cb062c7e002563 --- wifi/aidl/default/aidl_struct_util.cpp | 26 +++++ wifi/aidl/default/aidl_struct_util.h | 3 + .../tests/aidl_struct_util_unit_tests.cpp | 100 ++++++++++++++++++ wifi/aidl/default/wifi_legacy_hal.cpp | 48 +++++++-- wifi/aidl/default/wifi_legacy_hal.h | 7 +- wifi/aidl/default/wifi_rtt_controller.cpp | 22 +++- 6 files changed, 196 insertions(+), 10 deletions(-) diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index ec8b3968f2..0f1ed1025f 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -2270,6 +2270,8 @@ legacy_hal::wifi_rtt_bw convertAidlRttBwToLegacy(RttBw type) { return legacy_hal::WIFI_RTT_BW_160; case RttBw::BW_320MHZ: return legacy_hal::WIFI_RTT_BW_320; + case RttBw::BW_UNSPECIFIED: + return legacy_hal::WIFI_RTT_BW_UNSPECIFIED; }; CHECK(false); } @@ -2290,6 +2292,8 @@ RttBw convertLegacyRttBwToAidl(legacy_hal::wifi_rtt_bw type) { return RttBw::BW_160MHZ; case legacy_hal::WIFI_RTT_BW_320: return RttBw::BW_320MHZ; + case legacy_hal::WIFI_RTT_BW_UNSPECIFIED: + return RttBw::BW_UNSPECIFIED; }; CHECK(false) << "Unknown legacy type: " << type; } @@ -2619,6 +2623,28 @@ bool convertLegacyVectorOfRttResultToAidl( if (!convertLegacyRttResultToAidl(*legacy_result, &aidl_result)) { return false; } + aidl_result.channelFreqMHz = 0; + aidl_result.packetBw = RttBw::BW_UNSPECIFIED; + aidl_results->push_back(aidl_result); + } + return true; +} + +bool convertLegacyVectorOfRttResultV2ToAidl( + const std::vector& legacy_results, + std::vector* aidl_results) { + if (!aidl_results) { + return false; + } + *aidl_results = {}; + for (const auto legacy_result : legacy_results) { + RttResult aidl_result; + if (!convertLegacyRttResultToAidl(legacy_result->rtt_result, &aidl_result)) { + return false; + } + aidl_result.channelFreqMHz = + legacy_result->frequency != UNSPECIFIED ? legacy_result->frequency : 0; + aidl_result.packetBw = convertLegacyRttBwToAidl(legacy_result->packet_bw); aidl_results->push_back(aidl_result); } return true; diff --git a/wifi/aidl/default/aidl_struct_util.h b/wifi/aidl/default/aidl_struct_util.h index d8e1fd48aa..215b12b1e4 100644 --- a/wifi/aidl/default/aidl_struct_util.h +++ b/wifi/aidl/default/aidl_struct_util.h @@ -161,6 +161,9 @@ bool convertLegacyRttCapabilitiesToAidl( bool convertLegacyVectorOfRttResultToAidl( const std::vector& legacy_results, std::vector* aidl_results); +bool convertLegacyVectorOfRttResultV2ToAidl( + const std::vector& legacy_results, + std::vector* aidl_results); uint32_t convertAidlWifiBandToLegacyMacBand(WifiBand band); uint32_t convertAidlWifiIfaceModeToLegacy(uint32_t aidl_iface_mask); uint32_t convertAidlUsableChannelFilterToLegacy(uint32_t aidl_filter_mask); diff --git a/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp index 4a69c2426b..bd20c23608 100644 --- a/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp +++ b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp @@ -29,6 +29,12 @@ constexpr uint32_t kIfaceChannel1 = 3; constexpr uint32_t kIfaceChannel2 = 5; constexpr char kIfaceName1[] = "wlan0"; constexpr char kIfaceName2[] = "wlan1"; +constexpr uint8_t kMacAddress[] = {0x02, 0x12, 0x45, 0x56, 0xab, 0xcc}; +byte LCI[] = {0x27, 0x1A, 0x1, 0x00, 0x8, 0x01, 0x00, 0x08, 0x00, 0x10, 0x52, + 0x83, 0x4d, 0x12, 0xef, 0xd2, 0xb0, 0x8b, 0x9b, 0x4b, 0xf1, 0xcc, + 0x2c, 0x00, 0x00, 0x41, 0x06, 0x03, 0x06, 0x00, 0x80}; +byte LCR[] = {0x27, 0xE, 0x1, 0x00, 0xB, 0x01, 0x00, 0x0b, 0x00, 0x09, + 0x55, 0x53, 0x18, 0x05, 0x39, 0x34, 0x30, 0x34, 0x33}; } // namespace namespace aidl { @@ -479,6 +485,100 @@ TEST_F(AidlStructUtilTest, canConvertLegacyRadioCombinationsMatrixToAidl) { radio_configurations_array3); } +void verifyRttResult(wifi_rtt_result* legacy_rtt_result_ptr, RttResult* aidl_results_ptr) { + EXPECT_EQ((int)legacy_rtt_result_ptr->burst_num, aidl_results_ptr->burstNum); + EXPECT_EQ((int)legacy_rtt_result_ptr->measurement_number, aidl_results_ptr->measurementNumber); + EXPECT_EQ((int)legacy_rtt_result_ptr->success_number, aidl_results_ptr->successNumber); + EXPECT_EQ(legacy_rtt_result_ptr->number_per_burst_peer, aidl_results_ptr->numberPerBurstPeer); + EXPECT_EQ(legacy_rtt_result_ptr->retry_after_duration, aidl_results_ptr->retryAfterDuration); + EXPECT_EQ(legacy_rtt_result_ptr->rssi, aidl_results_ptr->rssi); + EXPECT_EQ(legacy_rtt_result_ptr->rssi_spread, aidl_results_ptr->rssiSpread); + EXPECT_EQ(legacy_rtt_result_ptr->rtt, aidl_results_ptr->rtt); + EXPECT_EQ(legacy_rtt_result_ptr->rtt_sd, aidl_results_ptr->rttSd); + EXPECT_EQ(legacy_rtt_result_ptr->rtt_spread, aidl_results_ptr->rttSpread); + EXPECT_EQ(legacy_rtt_result_ptr->distance_mm, aidl_results_ptr->distanceInMm); + EXPECT_EQ(legacy_rtt_result_ptr->distance_sd_mm, aidl_results_ptr->distanceSdInMm); + EXPECT_EQ(legacy_rtt_result_ptr->distance_spread_mm, aidl_results_ptr->distanceSpreadInMm); + EXPECT_EQ(legacy_rtt_result_ptr->ts, aidl_results_ptr->timeStampInUs); + EXPECT_EQ(legacy_rtt_result_ptr->burst_duration, aidl_results_ptr->burstDurationInMs); + EXPECT_EQ(legacy_rtt_result_ptr->negotiated_burst_num, aidl_results_ptr->negotiatedBurstNum); + EXPECT_EQ(legacy_rtt_result_ptr->LCI->id, aidl_results_ptr->lci.id); + for (int i = 0; i < legacy_rtt_result_ptr->LCI->len; i++) { + EXPECT_EQ(legacy_rtt_result_ptr->LCI->data[i], aidl_results_ptr->lci.data[i]); + } + EXPECT_EQ(legacy_rtt_result_ptr->LCR->id, aidl_results_ptr->lcr.id); + for (int i = 0; i < legacy_rtt_result_ptr->LCR->len; i++) { + EXPECT_EQ(legacy_rtt_result_ptr->LCR->data[i], aidl_results_ptr->lcr.data[i]); + } +} + +void fillLegacyRttResult(wifi_rtt_result* rtt_result_ptr) { + std::copy(std::begin(kMacAddress), std::end(kMacAddress), std::begin(rtt_result_ptr->addr)); + rtt_result_ptr->burst_num = rand(); + rtt_result_ptr->measurement_number = rand(); + rtt_result_ptr->success_number = rand(); + rtt_result_ptr->number_per_burst_peer = 0xF & rand(); + rtt_result_ptr->status = RTT_STATUS_SUCCESS; + rtt_result_ptr->retry_after_duration = 0xF & rand(); + rtt_result_ptr->type = RTT_TYPE_2_SIDED; + rtt_result_ptr->rssi = rand(); + rtt_result_ptr->rssi_spread = rand(); + rtt_result_ptr->rtt = rand(); + rtt_result_ptr->rtt_sd = rand(); + rtt_result_ptr->rtt_spread = rand(); + rtt_result_ptr->distance_mm = rand(); + rtt_result_ptr->distance_sd_mm = rand(); + rtt_result_ptr->distance_spread_mm = rand(); + rtt_result_ptr->burst_duration = rand(); + rtt_result_ptr->negotiated_burst_num = rand(); + rtt_result_ptr->LCI = (wifi_information_element*)LCI; + rtt_result_ptr->LCR = (wifi_information_element*)LCR; +} + +TEST_F(AidlStructUtilTest, convertLegacyVectorOfRttResultToAidl) { + std::vector rtt_results_vec; + wifi_rtt_result rttResults[2]; + + // fill legacy rtt results + for (int i = 0; i < 2; i++) { + fillLegacyRttResult(&rttResults[i]); + rtt_results_vec.push_back(&rttResults[i]); + } + + std::vector aidl_results; + aidl_struct_util::convertLegacyVectorOfRttResultToAidl(rtt_results_vec, &aidl_results); + + EXPECT_EQ(rtt_results_vec.size(), aidl_results.size()); + for (size_t i = 0; i < rtt_results_vec.size(); i++) { + verifyRttResult(&rttResults[i], &aidl_results[i]); + EXPECT_EQ(aidl_results[i].channelFreqMHz, 0); + EXPECT_EQ(aidl_results[i].packetBw, RttBw::BW_UNSPECIFIED); + } +} + +TEST_F(AidlStructUtilTest, convertLegacyVectorOfRttResultV2ToAidl) { + std::vector rtt_results_vec_v2; + wifi_rtt_result_v2 rttResults_v2[2]; + + // fill legacy rtt results v2 + for (int i = 0; i < 2; i++) { + fillLegacyRttResult(&rttResults_v2[i].rtt_result); + rttResults_v2[i].frequency = 2412 + i * 5; + rttResults_v2[i].packet_bw = WIFI_RTT_BW_80; + rtt_results_vec_v2.push_back(&rttResults_v2[i]); + } + + std::vector aidl_results; + aidl_struct_util::convertLegacyVectorOfRttResultV2ToAidl(rtt_results_vec_v2, &aidl_results); + + EXPECT_EQ(rtt_results_vec_v2.size(), aidl_results.size()); + for (size_t i = 0; i < rtt_results_vec_v2.size(); i++) { + verifyRttResult(&rttResults_v2[i].rtt_result, &aidl_results[i]); + EXPECT_EQ(aidl_results[i].channelFreqMHz, rttResults_v2[i].frequency); + EXPECT_EQ(aidl_results[i].packetBw, RttBw::BW_80MHZ); + } +} + } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/aidl/default/wifi_legacy_hal.cpp b/wifi/aidl/default/wifi_legacy_hal.cpp index e4883d19f3..25f18b5484 100644 --- a/wifi/aidl/default/wifi_legacy_hal.cpp +++ b/wifi/aidl/default/wifi_legacy_hal.cpp @@ -171,11 +171,28 @@ void onAsyncSubsystemRestart(const char* error) { // Callback to be invoked for rtt results results. std::function on_rtt_results_internal_callback; +std::function + on_rtt_results_internal_callback_v2; + +void invalidateRttResultsCallbacks() { + on_rtt_results_internal_callback = nullptr; + on_rtt_results_internal_callback_v2 = nullptr; +}; + void onAsyncRttResults(wifi_request_id id, unsigned num_results, wifi_rtt_result* rtt_results[]) { const auto lock = aidl_sync_util::acquireGlobalLock(); if (on_rtt_results_internal_callback) { on_rtt_results_internal_callback(id, num_results, rtt_results); - on_rtt_results_internal_callback = nullptr; + invalidateRttResultsCallbacks(); + } +} + +void onAsyncRttResultsV2(wifi_request_id id, unsigned num_results, + wifi_rtt_result_v2* rtt_results_v2[]) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_rtt_results_internal_callback_v2) { + on_rtt_results_internal_callback_v2(id, num_results, rtt_results_v2); + invalidateRttResultsCallbacks(); } } @@ -1090,8 +1107,9 @@ wifi_error WifiLegacyHal::registerSubsystemRestartCallbackHandler( wifi_error WifiLegacyHal::startRttRangeRequest( const std::string& iface_name, wifi_request_id id, const std::vector& rtt_configs, - const on_rtt_results_callback& on_results_user_callback) { - if (on_rtt_results_internal_callback) { + const on_rtt_results_callback& on_results_user_callback, + const on_rtt_results_callback_v2& on_results_user_callback_v2) { + if (on_rtt_results_internal_callback || on_rtt_results_internal_callback_v2) { return WIFI_ERROR_NOT_AVAILABLE; } @@ -1108,12 +1126,26 @@ wifi_error WifiLegacyHal::startRttRangeRequest( on_results_user_callback(id, rtt_results_vec); }; + on_rtt_results_internal_callback_v2 = [on_results_user_callback_v2]( + wifi_request_id id, unsigned num_results, + wifi_rtt_result_v2* rtt_results_v2[]) { + if (num_results > 0 && !rtt_results_v2) { + LOG(ERROR) << "Unexpected nullptr in RTT results"; + return; + } + std::vector rtt_results_vec_v2; + std::copy_if(rtt_results_v2, rtt_results_v2 + num_results, + back_inserter(rtt_results_vec_v2), + [](wifi_rtt_result_v2* rtt_result_v2) { return rtt_result_v2 != nullptr; }); + on_results_user_callback_v2(id, rtt_results_vec_v2); + }; + std::vector rtt_configs_internal(rtt_configs); wifi_error status = global_func_table_.wifi_rtt_range_request( id, getIfaceHandle(iface_name), rtt_configs.size(), rtt_configs_internal.data(), - {onAsyncRttResults}); + {onAsyncRttResults, onAsyncRttResultsV2}); if (status != WIFI_SUCCESS) { - on_rtt_results_internal_callback = nullptr; + invalidateRttResultsCallbacks(); } return status; } @@ -1121,7 +1153,7 @@ wifi_error WifiLegacyHal::startRttRangeRequest( wifi_error WifiLegacyHal::cancelRttRangeRequest( const std::string& iface_name, wifi_request_id id, const std::vector>& mac_addrs) { - if (!on_rtt_results_internal_callback) { + if (!on_rtt_results_internal_callback && !on_rtt_results_internal_callback_v2) { return WIFI_ERROR_NOT_AVAILABLE; } static_assert(sizeof(mac_addr) == sizeof(std::array), @@ -1135,7 +1167,7 @@ wifi_error WifiLegacyHal::cancelRttRangeRequest( // If the request Id is wrong, don't stop the ongoing range request. Any // other error should be treated as the end of rtt ranging. if (status != WIFI_ERROR_INVALID_REQUEST_ID) { - on_rtt_results_internal_callback = nullptr; + invalidateRttResultsCallbacks(); } return status; } @@ -1629,7 +1661,7 @@ void WifiLegacyHal::invalidate() { on_error_alert_internal_callback = nullptr; on_radio_mode_change_internal_callback = nullptr; on_subsystem_restart_internal_callback = nullptr; - on_rtt_results_internal_callback = nullptr; + invalidateRttResultsCallbacks(); on_nan_notify_response_user_callback = nullptr; on_nan_event_publish_terminated_user_callback = nullptr; on_nan_event_match_user_callback = nullptr; diff --git a/wifi/aidl/default/wifi_legacy_hal.h b/wifi/aidl/default/wifi_legacy_hal.h index 33ed359baa..cce43e653c 100644 --- a/wifi/aidl/default/wifi_legacy_hal.h +++ b/wifi/aidl/default/wifi_legacy_hal.h @@ -305,6 +305,7 @@ using ::WIFI_RTT_BW_320; using ::WIFI_RTT_BW_40; using ::WIFI_RTT_BW_5; using ::WIFI_RTT_BW_80; +using ::WIFI_RTT_BW_UNSPECIFIED; using ::wifi_rtt_capabilities; using ::wifi_rtt_config; using ::wifi_rtt_preamble; @@ -315,6 +316,7 @@ using ::WIFI_RTT_PREAMBLE_LEGACY; using ::WIFI_RTT_PREAMBLE_VHT; using ::wifi_rtt_responder; using ::wifi_rtt_result; +using ::wifi_rtt_result_v2; using ::wifi_rtt_status; using ::wifi_rtt_type; using ::wifi_rx_packet_fate; @@ -420,6 +422,8 @@ using on_rssi_threshold_breached_callback = // the pointer. using on_rtt_results_callback = std::function&)>; +using on_rtt_results_callback_v2 = + std::function&)>; // Callback for ring buffer data. using on_ring_buffer_data_callback = std::function& rtt_configs, - const on_rtt_results_callback& on_results_callback); + const on_rtt_results_callback& on_results_callback, + const on_rtt_results_callback_v2& on_results_callback_v2); wifi_error cancelRttRangeRequest(const std::string& iface_name, wifi_request_id id, const std::vector>& mac_addrs); std::pair getRttCapabilities(const std::string& iface_name); diff --git a/wifi/aidl/default/wifi_rtt_controller.cpp b/wifi/aidl/default/wifi_rtt_controller.cpp index 856c3cd054..a5f6768951 100644 --- a/wifi/aidl/default/wifi_rtt_controller.cpp +++ b/wifi/aidl/default/wifi_rtt_controller.cpp @@ -161,8 +161,28 @@ ndk::ScopedAStatus WifiRttController::rangeRequestInternal( } } }; + const auto& on_results_callback_v2 = + [weak_ptr_this](legacy_hal::wifi_request_id id, + const std::vector& results) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "v2 Callback invoked on an invalid object"; + return; + } + std::vector aidl_results; + if (!aidl_struct_util::convertLegacyVectorOfRttResultV2ToAidl(results, + &aidl_results)) { + LOG(ERROR) << "Failed to convert rtt results v2 to AIDL structs"; + return; + } + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->onResults(id, aidl_results).isOk()) { + LOG(ERROR) << "Failed to invoke the v2 callback"; + } + } + }; legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startRttRangeRequest( - ifname_, cmd_id, legacy_configs, on_results_callback); + ifname_, cmd_id, legacy_configs, on_results_callback, on_results_callback_v2); return createWifiStatusFromLegacyError(legacy_status); } From ba65bbe8a4d17ffe82ba3f3e393cfeee04c36c36 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Wed, 30 Nov 2022 23:22:32 +0000 Subject: [PATCH 508/998] Add callback to the supplicant interface to allow supplicant to retrieve non-standard certificates from the client. Bug: 205764502 Test: mm -j Change-Id: Ia14d684e609c6e65229888a4f27d7c1f5af97f24 --- .../supplicant/INonStandardCertCallback.aidl | 38 +++++++++++++++++++ .../hardware/wifi/supplicant/ISupplicant.aidl | 1 + .../supplicant/INonStandardCertCallback.aidl | 37 ++++++++++++++++++ .../hardware/wifi/supplicant/ISupplicant.aidl | 11 ++++++ 4 files changed, 87 insertions(+) create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl create mode 100644 wifi/supplicant/aidl/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl new file mode 100644 index 0000000000..28c1028be7 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@VintfStability +interface INonStandardCertCallback { + byte[] getBlob(in String alias); +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicant.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicant.aidl index 4b26ac3013..dd62167907 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicant.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicant.aidl @@ -47,5 +47,6 @@ interface ISupplicant { void setConcurrencyPriority(in android.hardware.wifi.supplicant.IfaceType type); void setDebugParams(in android.hardware.wifi.supplicant.DebugLevel level, in boolean showTimestamp, in boolean showKeys); oneway void terminate(); + void registerNonStandardCertCallback(in android.hardware.wifi.supplicant.INonStandardCertCallback callback); const int EXT_RADIO_WORK_TIMEOUT_IN_SECS = 10; } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl new file mode 100644 index 0000000000..32595850d9 --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl @@ -0,0 +1,37 @@ +/* + * 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. + */ + +package android.hardware.wifi.supplicant; + +/** + * Callback to allow supplicant to retrieve non-standard certificate types + * from the client. + * + * Must be registered by the client at initialization, so that + * supplicant can call into the client to retrieve any values. + */ +@VintfStability +interface INonStandardCertCallback { + /** + * Requests a binary blob from the certificate key-value store. + * + * @param alias Key into the key-value mapping. + * @return Value associated with |alias| in the certificate store. + * @throws ServiceSpecificException with one of the following values: + * |SupplicantStatusCode.FAILURE_UNKNOWN| + */ + byte[] getBlob(in String alias); +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicant.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicant.aidl index c17289d932..b187c2f963 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicant.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicant.aidl @@ -17,6 +17,7 @@ package android.hardware.wifi.supplicant; import android.hardware.wifi.supplicant.DebugLevel; +import android.hardware.wifi.supplicant.INonStandardCertCallback; import android.hardware.wifi.supplicant.ISupplicantCallback; import android.hardware.wifi.supplicant.ISupplicantP2pIface; import android.hardware.wifi.supplicant.ISupplicantStaIface; @@ -158,4 +159,14 @@ interface ISupplicant { * wait to be restarted. */ oneway void terminate(); + + /** + * Register a Non-Standard Certificate callback with supplicant. + * + * @param callback An instance of the |INonStandardCertCallback| AIDL interface + * object. + * @throws ServiceSpecificException with one of the following values: + * |SupplicantStatusCode.FAILURE_UNKNOWN| + */ + void registerNonStandardCertCallback(in INonStandardCertCallback callback); } From 34254e5436abfb62e5c4eefa8c4ea801f5f58f25 Mon Sep 17 00:00:00 2001 From: Sungtak Lee Date: Thu, 15 Dec 2022 01:25:46 +0000 Subject: [PATCH 509/998] bufferpool2: Support mainline s/w codec Bug: 254050250 Change-Id: Id602b1a84880546ee726f36c247fabd2e4f2127c --- media/bufferpool/aidl/Android.bp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/media/bufferpool/aidl/Android.bp b/media/bufferpool/aidl/Android.bp index 5ea294839f..b01cdbecdc 100644 --- a/media/bufferpool/aidl/Android.bp +++ b/media/bufferpool/aidl/Android.bp @@ -40,6 +40,11 @@ aidl_interface { }, ndk: { enabled: true, + apex_available: [ + "//apex_available:platform", + "com.android.media.swcodec", + ], + min_sdk_version: "29", }, }, } From 8fc3ca470d4c685786cd478a67187ea4f3b56704 Mon Sep 17 00:00:00 2001 From: Sungtak Lee Date: Wed, 7 Dec 2022 07:45:45 +0000 Subject: [PATCH 510/998] AIDL bufferpool implementation (just copy from HIDL impl) Bug: 254050250 Change-Id: I48841189a8743dcd6533a9e61581e48f0f1717f1 --- media/bufferpool/aidl/default/Accessor.cpp | 230 ++++ media/bufferpool/aidl/default/Accessor.h | 204 ++++ .../bufferpool/aidl/default/AccessorImpl.cpp | 993 ++++++++++++++++++ media/bufferpool/aidl/default/AccessorImpl.h | 431 ++++++++ .../aidl/default/BufferPoolClient.cpp | 876 +++++++++++++++ .../aidl/default/BufferPoolClient.h | 111 ++ .../bufferpool/aidl/default/BufferStatus.cpp | 304 ++++++ media/bufferpool/aidl/default/BufferStatus.h | 230 ++++ .../bufferpool/aidl/default/ClientManager.cpp | 569 ++++++++++ media/bufferpool/aidl/default/Connection.cpp | 104 ++ media/bufferpool/aidl/default/Connection.h | 108 ++ media/bufferpool/aidl/default/Observer.cpp | 73 ++ media/bufferpool/aidl/default/Observer.h | 67 ++ .../include/bufferpool/BufferPoolTypes.h | 123 +++ .../include/bufferpool/ClientManager.h | 195 ++++ .../aidl/default/tests/BufferpoolUnitTest.cpp | 541 ++++++++++ .../aidl/default/tests/allocator.cpp | 251 +++++ .../bufferpool/aidl/default/tests/allocator.h | 68 ++ media/bufferpool/aidl/default/tests/cond.cpp | 269 +++++ media/bufferpool/aidl/default/tests/multi.cpp | 235 +++++ .../bufferpool/aidl/default/tests/single.cpp | 183 ++++ 21 files changed, 6165 insertions(+) create mode 100644 media/bufferpool/aidl/default/Accessor.cpp create mode 100644 media/bufferpool/aidl/default/Accessor.h create mode 100644 media/bufferpool/aidl/default/AccessorImpl.cpp create mode 100644 media/bufferpool/aidl/default/AccessorImpl.h create mode 100644 media/bufferpool/aidl/default/BufferPoolClient.cpp create mode 100644 media/bufferpool/aidl/default/BufferPoolClient.h create mode 100644 media/bufferpool/aidl/default/BufferStatus.cpp create mode 100644 media/bufferpool/aidl/default/BufferStatus.h create mode 100644 media/bufferpool/aidl/default/ClientManager.cpp create mode 100644 media/bufferpool/aidl/default/Connection.cpp create mode 100644 media/bufferpool/aidl/default/Connection.h create mode 100644 media/bufferpool/aidl/default/Observer.cpp create mode 100644 media/bufferpool/aidl/default/Observer.h create mode 100644 media/bufferpool/aidl/default/include/bufferpool/BufferPoolTypes.h create mode 100644 media/bufferpool/aidl/default/include/bufferpool/ClientManager.h create mode 100644 media/bufferpool/aidl/default/tests/BufferpoolUnitTest.cpp create mode 100644 media/bufferpool/aidl/default/tests/allocator.cpp create mode 100644 media/bufferpool/aidl/default/tests/allocator.h create mode 100644 media/bufferpool/aidl/default/tests/cond.cpp create mode 100644 media/bufferpool/aidl/default/tests/multi.cpp create mode 100644 media/bufferpool/aidl/default/tests/single.cpp diff --git a/media/bufferpool/aidl/default/Accessor.cpp b/media/bufferpool/aidl/default/Accessor.cpp new file mode 100644 index 0000000000..e05b12a156 --- /dev/null +++ b/media/bufferpool/aidl/default/Accessor.cpp @@ -0,0 +1,230 @@ +/* + * Copyright (C) 2018 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. + */ +#define LOG_TAG "BufferPoolConnection" + +#include "Accessor.h" +#include "AccessorImpl.h" +#include "Connection.h" + +namespace android { +namespace hardware { +namespace media { +namespace bufferpool { +namespace V2_0 { +namespace implementation { + +void ConnectionDeathRecipient::add( + int64_t connectionId, + const sp &accessor) { + std::lock_guard lock(mLock); + if (mAccessors.find(connectionId) == mAccessors.end()) { + mAccessors.insert(std::make_pair(connectionId, accessor)); + } +} + +void ConnectionDeathRecipient::remove(int64_t connectionId) { + std::lock_guard lock(mLock); + mAccessors.erase(connectionId); + auto it = mConnectionToCookie.find(connectionId); + if (it != mConnectionToCookie.end()) { + uint64_t cookie = it->second; + mConnectionToCookie.erase(it); + auto cit = mCookieToConnections.find(cookie); + if (cit != mCookieToConnections.end()) { + cit->second.erase(connectionId); + if (cit->second.size() == 0) { + mCookieToConnections.erase(cit); + } + } + } +} + +void ConnectionDeathRecipient::addCookieToConnection( + uint64_t cookie, + int64_t connectionId) { + std::lock_guard lock(mLock); + if (mAccessors.find(connectionId) == mAccessors.end()) { + return; + } + mConnectionToCookie.insert(std::make_pair(connectionId, cookie)); + auto it = mCookieToConnections.find(cookie); + if (it != mCookieToConnections.end()) { + it->second.insert(connectionId); + } else { + mCookieToConnections.insert(std::make_pair( + cookie, std::set{connectionId})); + } +} + +void ConnectionDeathRecipient::serviceDied( + uint64_t cookie, + const wp<::android::hidl::base::V1_0::IBase>& /* who */ + ) { + std::map> connectionsToClose; + { + std::lock_guard lock(mLock); + + auto it = mCookieToConnections.find(cookie); + if (it != mCookieToConnections.end()) { + for (auto conIt = it->second.begin(); conIt != it->second.end(); ++conIt) { + auto accessorIt = mAccessors.find(*conIt); + if (accessorIt != mAccessors.end()) { + connectionsToClose.insert(std::make_pair(*conIt, accessorIt->second)); + mAccessors.erase(accessorIt); + } + mConnectionToCookie.erase(*conIt); + } + mCookieToConnections.erase(it); + } + } + + if (connectionsToClose.size() > 0) { + sp accessor; + for (auto it = connectionsToClose.begin(); it != connectionsToClose.end(); ++it) { + accessor = it->second.promote(); + + if (accessor) { + accessor->close(it->first); + ALOGD("connection %lld closed on death", (long long)it->first); + } + } + } +} + +namespace { +static sp sConnectionDeathRecipient = + new ConnectionDeathRecipient(); +} + +sp Accessor::getConnectionDeathRecipient() { + return sConnectionDeathRecipient; +} + +void Accessor::createInvalidator() { + Accessor::Impl::createInvalidator(); +} + +void Accessor::createEvictor() { + Accessor::Impl::createEvictor(); +} + +// Methods from ::android::hardware::media::bufferpool::V2_0::IAccessor follow. +Return Accessor::connect( + const sp<::android::hardware::media::bufferpool::V2_0::IObserver>& observer, + connect_cb _hidl_cb) { + sp connection; + ConnectionId connectionId; + uint32_t msgId; + const StatusDescriptor* fmqDesc; + const InvalidationDescriptor* invDesc; + + ResultStatus status = connect( + observer, false, &connection, &connectionId, &msgId, &fmqDesc, &invDesc); + if (status == ResultStatus::OK) { + _hidl_cb(status, connection, connectionId, msgId, *fmqDesc, *invDesc); + } else { + _hidl_cb(status, nullptr, -1LL, 0, + android::hardware::MQDescriptorSync( + std::vector(), + nullptr /* nhandle */, 0 /* size */), + android::hardware::MQDescriptorUnsync( + std::vector(), + nullptr /* nhandle */, 0 /* size */)); + } + return Void(); +} + +Accessor::Accessor(const std::shared_ptr &allocator) + : mImpl(new Impl(allocator)) {} + +Accessor::~Accessor() { +} + +bool Accessor::isValid() { + return (bool)mImpl && mImpl->isValid(); +} + +ResultStatus Accessor::flush() { + if (mImpl) { + mImpl->flush(); + return ResultStatus::OK; + } + return ResultStatus::CRITICAL_ERROR; +} + +ResultStatus Accessor::allocate( + ConnectionId connectionId, + const std::vector ¶ms, + BufferId *bufferId, const native_handle_t** handle) { + if (mImpl) { + return mImpl->allocate(connectionId, params, bufferId, handle); + } + return ResultStatus::CRITICAL_ERROR; +} + +ResultStatus Accessor::fetch( + ConnectionId connectionId, TransactionId transactionId, + BufferId bufferId, const native_handle_t** handle) { + if (mImpl) { + return mImpl->fetch(connectionId, transactionId, bufferId, handle); + } + return ResultStatus::CRITICAL_ERROR; +} + +ResultStatus Accessor::connect( + const sp &observer, bool local, + sp *connection, ConnectionId *pConnectionId, + uint32_t *pMsgId, + const StatusDescriptor** statusDescPtr, + const InvalidationDescriptor** invDescPtr) { + if (mImpl) { + ResultStatus status = mImpl->connect( + this, observer, connection, pConnectionId, pMsgId, + statusDescPtr, invDescPtr); + if (!local && status == ResultStatus::OK) { + sp accessor(this); + sConnectionDeathRecipient->add(*pConnectionId, accessor); + } + return status; + } + return ResultStatus::CRITICAL_ERROR; +} + +ResultStatus Accessor::close(ConnectionId connectionId) { + if (mImpl) { + ResultStatus status = mImpl->close(connectionId); + sConnectionDeathRecipient->remove(connectionId); + return status; + } + return ResultStatus::CRITICAL_ERROR; +} + +void Accessor::cleanUp(bool clearCache) { + if (mImpl) { + mImpl->cleanUp(clearCache); + } +} + +//IAccessor* HIDL_FETCH_IAccessor(const char* /* name */) { +// return new Accessor(); +//} + +} // namespace implementation +} // namespace V2_0 +} // namespace bufferpool +} // namespace media +} // namespace hardware +} // namespace android diff --git a/media/bufferpool/aidl/default/Accessor.h b/media/bufferpool/aidl/default/Accessor.h new file mode 100644 index 0000000000..8b43301610 --- /dev/null +++ b/media/bufferpool/aidl/default/Accessor.h @@ -0,0 +1,204 @@ +/* + * Copyright (C) 2018 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. + */ + +#ifndef ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_ACCESSOR_H +#define ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_ACCESSOR_H + +#include +#include +#include +#include +#include +#include "BufferStatus.h" + +#include + +namespace android { +namespace hardware { +namespace media { +namespace bufferpool { +namespace V2_0 { +namespace implementation { + +using ::android::hardware::hidl_array; +using ::android::hardware::hidl_memory; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::Void; +using ::android::sp; + +struct Accessor; +struct Connection; + +/** + * Receives death notifications from remote connections. + * On death notifications, the connections are closed and used resources + * are released. + */ +struct ConnectionDeathRecipient : public hardware::hidl_death_recipient { + /** + * Registers a newly connected connection from remote processes. + */ + void add(int64_t connectionId, const sp &accessor); + + /** + * Removes a connection. + */ + void remove(int64_t connectionId); + + void addCookieToConnection(uint64_t cookie, int64_t connectionId); + + virtual void serviceDied( + uint64_t /* cookie */, + const wp<::android::hidl::base::V1_0::IBase>& /* who */ + ) override; + +private: + std::mutex mLock; + std::map> mCookieToConnections; + std::map mConnectionToCookie; + std::map> mAccessors; +}; + +/** + * A buffer pool accessor which enables a buffer pool to communicate with buffer + * pool clients. 1:1 correspondense holds between a buffer pool and an accessor. + */ +struct Accessor : public IAccessor { + // Methods from ::android::hardware::media::bufferpool::V2_0::IAccessor follow. + Return connect(const sp<::android::hardware::media::bufferpool::V2_0::IObserver>& observer, connect_cb _hidl_cb) override; + + /** + * Creates a buffer pool accessor which uses the specified allocator. + * + * @param allocator buffer allocator. + */ + explicit Accessor(const std::shared_ptr &allocator); + + /** Destructs a buffer pool accessor. */ + ~Accessor(); + + /** Returns whether the accessor is valid. */ + bool isValid(); + + /** Invalidates all buffers which are owned by bufferpool */ + ResultStatus flush(); + + /** Allocates a buffer from a buffer pool. + * + * @param connectionId the connection id of the client. + * @param params the allocation parameters. + * @param bufferId the id of the allocated buffer. + * @param handle the native handle of the allocated buffer. + * + * @return OK when a buffer is successfully allocated. + * NO_MEMORY when there is no memory. + * CRITICAL_ERROR otherwise. + */ + ResultStatus allocate( + ConnectionId connectionId, + const std::vector& params, + BufferId *bufferId, + const native_handle_t** handle); + + /** + * Fetches a buffer for the specified transaction. + * + * @param connectionId the id of receiving connection(client). + * @param transactionId the id of the transfer transaction. + * @param bufferId the id of the buffer to be fetched. + * @param handle the native handle of the fetched buffer. + * + * @return OK when a buffer is successfully fetched. + * NO_MEMORY when there is no memory. + * CRITICAL_ERROR otherwise. + */ + ResultStatus fetch( + ConnectionId connectionId, + TransactionId transactionId, + BufferId bufferId, + const native_handle_t** handle); + + /** + * Makes a connection to the buffer pool. The buffer pool client uses the + * created connection in order to communicate with the buffer pool. An + * FMQ for buffer status message is also created for the client. + * + * @param observer client observer for buffer invalidation + * @param local true when a connection request comes from local process, + * false otherwise. + * @param connection created connection + * @param pConnectionId the id of the created connection + * @param pMsgId the id of the recent buffer pool message + * @param statusDescPtr FMQ descriptor for shared buffer status message + * queue between a buffer pool and the client. + * @param invDescPtr FMQ descriptor for buffer invalidation message + * queue from a buffer pool to the client. + * + * @return OK when a connection is successfully made. + * NO_MEMORY when there is no memory. + * CRITICAL_ERROR otherwise. + */ + ResultStatus connect( + const sp& observer, + bool local, + sp *connection, ConnectionId *pConnectionId, + uint32_t *pMsgId, + const StatusDescriptor** statusDescPtr, + const InvalidationDescriptor** invDescPtr); + + /** + * Closes the specified connection to the client. + * + * @param connectionId the id of the connection. + * + * @return OK when the connection is closed. + * CRITICAL_ERROR otherwise. + */ + ResultStatus close(ConnectionId connectionId); + + /** + * Processes pending buffer status messages and perfoms periodic cache + * cleaning. + * + * @param clearCache if clearCache is true, it frees all buffers waiting + * to be recycled. + */ + void cleanUp(bool clearCache); + + /** + * Gets a hidl_death_recipient for remote connection death. + */ + static sp getConnectionDeathRecipient(); + + static void createInvalidator(); + + static void createEvictor(); + +private: + class Impl; + std::shared_ptr mImpl; +}; + +} // namespace implementation +} // namespace V2_0 +} // namespace bufferpool +} // namespace media +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_ACCESSOR_H diff --git a/media/bufferpool/aidl/default/AccessorImpl.cpp b/media/bufferpool/aidl/default/AccessorImpl.cpp new file mode 100644 index 0000000000..1d2562e41d --- /dev/null +++ b/media/bufferpool/aidl/default/AccessorImpl.cpp @@ -0,0 +1,993 @@ +/* + * Copyright (C) 2018 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. + */ + +#define LOG_TAG "BufferPoolAccessor2.0" +//#define LOG_NDEBUG 0 + +#include +#include +#include +#include +#include +#include +#include "AccessorImpl.h" +#include "Connection.h" + +namespace android { +namespace hardware { +namespace media { +namespace bufferpool { +namespace V2_0 { +namespace implementation { + +namespace { + static constexpr int64_t kCleanUpDurationUs = 500000; // TODO tune 0.5 sec + static constexpr int64_t kLogDurationUs = 5000000; // 5 secs + + static constexpr size_t kMinAllocBytesForEviction = 1024*1024*15; + static constexpr size_t kMinBufferCountForEviction = 25; + static constexpr size_t kMaxUnusedBufferCount = 64; + static constexpr size_t kUnusedBufferCountTarget = kMaxUnusedBufferCount - 16; + + static constexpr nsecs_t kEvictGranularityNs = 1000000000; // 1 sec + static constexpr nsecs_t kEvictDurationNs = 5000000000; // 5 secs +} + +// Buffer structure in bufferpool process +struct InternalBuffer { + BufferId mId; + size_t mOwnerCount; + size_t mTransactionCount; + const std::shared_ptr mAllocation; + const size_t mAllocSize; + const std::vector mConfig; + bool mInvalidated; + + InternalBuffer( + BufferId id, + const std::shared_ptr &alloc, + const size_t allocSize, + const std::vector &allocConfig) + : mId(id), mOwnerCount(0), mTransactionCount(0), + mAllocation(alloc), mAllocSize(allocSize), mConfig(allocConfig), + mInvalidated(false) {} + + const native_handle_t *handle() { + return mAllocation->handle(); + } + + void invalidate() { + mInvalidated = true; + } +}; + +struct TransactionStatus { + TransactionId mId; + BufferId mBufferId; + ConnectionId mSender; + ConnectionId mReceiver; + BufferStatus mStatus; + int64_t mTimestampUs; + bool mSenderValidated; + + TransactionStatus(const BufferStatusMessage &message, int64_t timestampUs) { + mId = message.transactionId; + mBufferId = message.bufferId; + mStatus = message.newStatus; + mTimestampUs = timestampUs; + if (mStatus == BufferStatus::TRANSFER_TO) { + mSender = message.connectionId; + mReceiver = message.targetConnectionId; + mSenderValidated = true; + } else { + mSender = -1LL; + mReceiver = message.connectionId; + mSenderValidated = false; + } + } +}; + +// Helper template methods for handling map of set. +template +bool insert(std::map> *mapOfSet, T key, U value) { + auto iter = mapOfSet->find(key); + if (iter == mapOfSet->end()) { + std::set valueSet{value}; + mapOfSet->insert(std::make_pair(key, valueSet)); + return true; + } else if (iter->second.find(value) == iter->second.end()) { + iter->second.insert(value); + return true; + } + return false; +} + +template +bool erase(std::map> *mapOfSet, T key, U value) { + bool ret = false; + auto iter = mapOfSet->find(key); + if (iter != mapOfSet->end()) { + if (iter->second.erase(value) > 0) { + ret = true; + } + if (iter->second.size() == 0) { + mapOfSet->erase(iter); + } + } + return ret; +} + +template +bool contains(std::map> *mapOfSet, T key, U value) { + auto iter = mapOfSet->find(key); + if (iter != mapOfSet->end()) { + auto setIter = iter->second.find(value); + return setIter != iter->second.end(); + } + return false; +} + +#ifdef __ANDROID_VNDK__ +static constexpr uint32_t kSeqIdVndkBit = 1U << 31; +#else +static constexpr uint32_t kSeqIdVndkBit = 0; +#endif + +static constexpr uint32_t kSeqIdMax = 0x7fffffff; +uint32_t Accessor::Impl::sSeqId = time(nullptr) & kSeqIdMax; + +Accessor::Impl::Impl( + const std::shared_ptr &allocator) + : mAllocator(allocator), mScheduleEvictTs(0) {} + +Accessor::Impl::~Impl() { +} + +ResultStatus Accessor::Impl::connect( + const sp &accessor, const sp &observer, + sp *connection, + ConnectionId *pConnectionId, + uint32_t *pMsgId, + const StatusDescriptor** statusDescPtr, + const InvalidationDescriptor** invDescPtr) { + sp newConnection = new Connection(); + ResultStatus status = ResultStatus::CRITICAL_ERROR; + { + std::lock_guard lock(mBufferPool.mMutex); + if (newConnection) { + int32_t pid = getpid(); + ConnectionId id = (int64_t)pid << 32 | sSeqId | kSeqIdVndkBit; + status = mBufferPool.mObserver.open(id, statusDescPtr); + if (status == ResultStatus::OK) { + newConnection->initialize(accessor, id); + *connection = newConnection; + *pConnectionId = id; + *pMsgId = mBufferPool.mInvalidation.mInvalidationId; + mBufferPool.mConnectionIds.insert(id); + mBufferPool.mInvalidationChannel.getDesc(invDescPtr); + mBufferPool.mInvalidation.onConnect(id, observer); + if (sSeqId == kSeqIdMax) { + sSeqId = 0; + } else { + ++sSeqId; + } + } + + } + mBufferPool.processStatusMessages(); + mBufferPool.cleanUp(); + scheduleEvictIfNeeded(); + } + return status; +} + +ResultStatus Accessor::Impl::close(ConnectionId connectionId) { + std::lock_guard lock(mBufferPool.mMutex); + ALOGV("connection close %lld: %u", (long long)connectionId, mBufferPool.mInvalidation.mId); + mBufferPool.processStatusMessages(); + mBufferPool.handleClose(connectionId); + mBufferPool.mObserver.close(connectionId); + mBufferPool.mInvalidation.onClose(connectionId); + // Since close# will be called after all works are finished, it is OK to + // evict unused buffers. + mBufferPool.cleanUp(true); + scheduleEvictIfNeeded(); + return ResultStatus::OK; +} + +ResultStatus Accessor::Impl::allocate( + ConnectionId connectionId, const std::vector& params, + BufferId *bufferId, const native_handle_t** handle) { + std::unique_lock lock(mBufferPool.mMutex); + mBufferPool.processStatusMessages(); + ResultStatus status = ResultStatus::OK; + if (!mBufferPool.getFreeBuffer(mAllocator, params, bufferId, handle)) { + lock.unlock(); + std::shared_ptr alloc; + size_t allocSize; + status = mAllocator->allocate(params, &alloc, &allocSize); + lock.lock(); + if (status == ResultStatus::OK) { + status = mBufferPool.addNewBuffer(alloc, allocSize, params, bufferId, handle); + } + ALOGV("create a buffer %d : %u %p", + status == ResultStatus::OK, *bufferId, *handle); + } + if (status == ResultStatus::OK) { + // TODO: handle ownBuffer failure + mBufferPool.handleOwnBuffer(connectionId, *bufferId); + } + mBufferPool.cleanUp(); + scheduleEvictIfNeeded(); + return status; +} + +ResultStatus Accessor::Impl::fetch( + ConnectionId connectionId, TransactionId transactionId, + BufferId bufferId, const native_handle_t** handle) { + std::lock_guard lock(mBufferPool.mMutex); + mBufferPool.processStatusMessages(); + auto found = mBufferPool.mTransactions.find(transactionId); + if (found != mBufferPool.mTransactions.end() && + contains(&mBufferPool.mPendingTransactions, + connectionId, transactionId)) { + if (found->second->mSenderValidated && + found->second->mStatus == BufferStatus::TRANSFER_FROM && + found->second->mBufferId == bufferId) { + found->second->mStatus = BufferStatus::TRANSFER_FETCH; + auto bufferIt = mBufferPool.mBuffers.find(bufferId); + if (bufferIt != mBufferPool.mBuffers.end()) { + mBufferPool.mStats.onBufferFetched(); + *handle = bufferIt->second->handle(); + return ResultStatus::OK; + } + } + } + mBufferPool.cleanUp(); + scheduleEvictIfNeeded(); + return ResultStatus::CRITICAL_ERROR; +} + +void Accessor::Impl::cleanUp(bool clearCache) { + // transaction timeout, buffer cacheing TTL handling + std::lock_guard lock(mBufferPool.mMutex); + mBufferPool.processStatusMessages(); + mBufferPool.cleanUp(clearCache); +} + +void Accessor::Impl::flush() { + std::lock_guard lock(mBufferPool.mMutex); + mBufferPool.processStatusMessages(); + mBufferPool.flush(shared_from_this()); +} + +void Accessor::Impl::handleInvalidateAck() { + std::map> observers; + uint32_t invalidationId; + { + std::lock_guard lock(mBufferPool.mMutex); + mBufferPool.processStatusMessages(); + mBufferPool.mInvalidation.onHandleAck(&observers, &invalidationId); + } + // Do not hold lock for send invalidations + size_t deadClients = 0; + for (auto it = observers.begin(); it != observers.end(); ++it) { + const sp observer = it->second; + if (observer) { + Return transResult = observer->onMessage(it->first, invalidationId); + if (!transResult.isOk()) { + ++deadClients; + } + } + } + if (deadClients > 0) { + ALOGD("During invalidation found %zu dead clients", deadClients); + } +} + +bool Accessor::Impl::isValid() { + return mBufferPool.isValid(); +} + +Accessor::Impl::Impl::BufferPool::BufferPool() + : mTimestampUs(getTimestampNow()), + mLastCleanUpUs(mTimestampUs), + mLastLogUs(mTimestampUs), + mSeq(0), + mStartSeq(0) { + mValid = mInvalidationChannel.isValid(); +} + + +// Statistics helper +template +int percentage(T base, S total) { + return int(total ? 0.5 + 100. * static_cast(base) / total : 0); +} + +std::atomic Accessor::Impl::BufferPool::Invalidation::sInvSeqId(0); + +Accessor::Impl::Impl::BufferPool::~BufferPool() { + std::lock_guard lock(mMutex); + ALOGD("Destruction - bufferpool2 %p " + "cached: %zu/%zuM, %zu/%d%% in use; " + "allocs: %zu, %d%% recycled; " + "transfers: %zu, %d%% unfetched", + this, mStats.mBuffersCached, mStats.mSizeCached >> 20, + mStats.mBuffersInUse, percentage(mStats.mBuffersInUse, mStats.mBuffersCached), + mStats.mTotalAllocations, percentage(mStats.mTotalRecycles, mStats.mTotalAllocations), + mStats.mTotalTransfers, + percentage(mStats.mTotalTransfers - mStats.mTotalFetches, mStats.mTotalTransfers)); +} + +void Accessor::Impl::BufferPool::Invalidation::onConnect( + ConnectionId conId, const sp& observer) { + mAcks[conId] = mInvalidationId; // starts from current invalidationId + mObservers.insert(std::make_pair(conId, observer)); +} + +void Accessor::Impl::BufferPool::Invalidation::onClose(ConnectionId conId) { + mAcks.erase(conId); + mObservers.erase(conId); +} + +void Accessor::Impl::BufferPool::Invalidation::onAck( + ConnectionId conId, + uint32_t msgId) { + auto it = mAcks.find(conId); + if (it == mAcks.end()) { + ALOGW("ACK from inconsistent connection! %lld", (long long)conId); + return; + } + if (isMessageLater(msgId, it->second)) { + mAcks[conId] = msgId; + } +} + +void Accessor::Impl::BufferPool::Invalidation::onBufferInvalidated( + BufferId bufferId, + BufferInvalidationChannel &channel) { + for (auto it = mPendings.begin(); it != mPendings.end();) { + if (it->isInvalidated(bufferId)) { + uint32_t msgId = 0; + if (it->mNeedsAck) { + msgId = ++mInvalidationId; + if (msgId == 0) { + // wrap happens + msgId = ++mInvalidationId; + } + } + channel.postInvalidation(msgId, it->mFrom, it->mTo); + it = mPendings.erase(it); + continue; + } + ++it; + } +} + +void Accessor::Impl::BufferPool::Invalidation::onInvalidationRequest( + bool needsAck, + uint32_t from, + uint32_t to, + size_t left, + BufferInvalidationChannel &channel, + const std::shared_ptr &impl) { + uint32_t msgId = 0; + if (needsAck) { + msgId = ++mInvalidationId; + if (msgId == 0) { + // wrap happens + msgId = ++mInvalidationId; + } + } + ALOGV("bufferpool2 invalidation requested and queued"); + if (left == 0) { + channel.postInvalidation(msgId, from, to); + } else { + // TODO: sending hint message? + ALOGV("bufferpoo2 invalidation requested and pending"); + Pending pending(needsAck, from, to, left, impl); + mPendings.push_back(pending); + } + sInvalidator->addAccessor(mId, impl); +} + +void Accessor::Impl::BufferPool::Invalidation::onHandleAck( + std::map> *observers, + uint32_t *invalidationId) { + if (mInvalidationId != 0) { + *invalidationId = mInvalidationId; + std::set deads; + for (auto it = mAcks.begin(); it != mAcks.end(); ++it) { + if (it->second != mInvalidationId) { + const sp observer = mObservers[it->first]; + if (observer) { + observers->emplace(it->first, observer); + ALOGV("connection %lld will call observer (%u: %u)", + (long long)it->first, it->second, mInvalidationId); + // N.B: onMessage will be called later. ignore possibility of + // onMessage# oneway call being lost. + it->second = mInvalidationId; + } else { + ALOGV("bufferpool2 observer died %lld", (long long)it->first); + deads.insert(it->first); + } + } + } + if (deads.size() > 0) { + for (auto it = deads.begin(); it != deads.end(); ++it) { + onClose(*it); + } + } + } + if (mPendings.size() == 0) { + // All invalidation Ids are synced and no more pending invalidations. + sInvalidator->delAccessor(mId); + } +} + +bool Accessor::Impl::BufferPool::handleOwnBuffer( + ConnectionId connectionId, BufferId bufferId) { + + bool added = insert(&mUsingBuffers, connectionId, bufferId); + if (added) { + auto iter = mBuffers.find(bufferId); + iter->second->mOwnerCount++; + } + insert(&mUsingConnections, bufferId, connectionId); + return added; +} + +bool Accessor::Impl::BufferPool::handleReleaseBuffer( + ConnectionId connectionId, BufferId bufferId) { + bool deleted = erase(&mUsingBuffers, connectionId, bufferId); + if (deleted) { + auto iter = mBuffers.find(bufferId); + iter->second->mOwnerCount--; + if (iter->second->mOwnerCount == 0 && + iter->second->mTransactionCount == 0) { + if (!iter->second->mInvalidated) { + mStats.onBufferUnused(iter->second->mAllocSize); + mFreeBuffers.insert(bufferId); + } else { + mStats.onBufferUnused(iter->second->mAllocSize); + mStats.onBufferEvicted(iter->second->mAllocSize); + mBuffers.erase(iter); + mInvalidation.onBufferInvalidated(bufferId, mInvalidationChannel); + } + } + } + erase(&mUsingConnections, bufferId, connectionId); + ALOGV("release buffer %u : %d", bufferId, deleted); + return deleted; +} + +bool Accessor::Impl::BufferPool::handleTransferTo(const BufferStatusMessage &message) { + auto completed = mCompletedTransactions.find( + message.transactionId); + if (completed != mCompletedTransactions.end()) { + // already completed + mCompletedTransactions.erase(completed); + return true; + } + // the buffer should exist and be owned. + auto bufferIter = mBuffers.find(message.bufferId); + if (bufferIter == mBuffers.end() || + !contains(&mUsingBuffers, message.connectionId, message.bufferId)) { + return false; + } + auto found = mTransactions.find(message.transactionId); + if (found != mTransactions.end()) { + // transfer_from was received earlier. + found->second->mSender = message.connectionId; + found->second->mSenderValidated = true; + return true; + } + if (mConnectionIds.find(message.targetConnectionId) == mConnectionIds.end()) { + // N.B: it could be fake or receive connection already closed. + ALOGD("bufferpool2 %p receiver connection %lld is no longer valid", + this, (long long)message.targetConnectionId); + return false; + } + mStats.onBufferSent(); + mTransactions.insert(std::make_pair( + message.transactionId, + std::make_unique(message, mTimestampUs))); + insert(&mPendingTransactions, message.targetConnectionId, + message.transactionId); + bufferIter->second->mTransactionCount++; + return true; +} + +bool Accessor::Impl::BufferPool::handleTransferFrom(const BufferStatusMessage &message) { + auto found = mTransactions.find(message.transactionId); + if (found == mTransactions.end()) { + // TODO: is it feasible to check ownership here? + mStats.onBufferSent(); + mTransactions.insert(std::make_pair( + message.transactionId, + std::make_unique(message, mTimestampUs))); + insert(&mPendingTransactions, message.connectionId, + message.transactionId); + auto bufferIter = mBuffers.find(message.bufferId); + bufferIter->second->mTransactionCount++; + } else { + if (message.connectionId == found->second->mReceiver) { + found->second->mStatus = BufferStatus::TRANSFER_FROM; + } + } + return true; +} + +bool Accessor::Impl::BufferPool::handleTransferResult(const BufferStatusMessage &message) { + auto found = mTransactions.find(message.transactionId); + if (found != mTransactions.end()) { + bool deleted = erase(&mPendingTransactions, message.connectionId, + message.transactionId); + if (deleted) { + if (!found->second->mSenderValidated) { + mCompletedTransactions.insert(message.transactionId); + } + auto bufferIter = mBuffers.find(message.bufferId); + if (message.newStatus == BufferStatus::TRANSFER_OK) { + handleOwnBuffer(message.connectionId, message.bufferId); + } + bufferIter->second->mTransactionCount--; + if (bufferIter->second->mOwnerCount == 0 + && bufferIter->second->mTransactionCount == 0) { + if (!bufferIter->second->mInvalidated) { + mStats.onBufferUnused(bufferIter->second->mAllocSize); + mFreeBuffers.insert(message.bufferId); + } else { + mStats.onBufferUnused(bufferIter->second->mAllocSize); + mStats.onBufferEvicted(bufferIter->second->mAllocSize); + mBuffers.erase(bufferIter); + mInvalidation.onBufferInvalidated(message.bufferId, mInvalidationChannel); + } + } + mTransactions.erase(found); + } + ALOGV("transfer finished %llu %u - %d", (unsigned long long)message.transactionId, + message.bufferId, deleted); + return deleted; + } + ALOGV("transfer not found %llu %u", (unsigned long long)message.transactionId, + message.bufferId); + return false; +} + +void Accessor::Impl::BufferPool::processStatusMessages() { + std::vector messages; + mObserver.getBufferStatusChanges(messages); + mTimestampUs = getTimestampNow(); + for (BufferStatusMessage& message: messages) { + bool ret = false; + switch (message.newStatus) { + case BufferStatus::NOT_USED: + ret = handleReleaseBuffer( + message.connectionId, message.bufferId); + break; + case BufferStatus::USED: + // not happening + break; + case BufferStatus::TRANSFER_TO: + ret = handleTransferTo(message); + break; + case BufferStatus::TRANSFER_FROM: + ret = handleTransferFrom(message); + break; + case BufferStatus::TRANSFER_TIMEOUT: + // TODO + break; + case BufferStatus::TRANSFER_LOST: + // TODO + break; + case BufferStatus::TRANSFER_FETCH: + // not happening + break; + case BufferStatus::TRANSFER_OK: + case BufferStatus::TRANSFER_ERROR: + ret = handleTransferResult(message); + break; + case BufferStatus::INVALIDATION_ACK: + mInvalidation.onAck(message.connectionId, message.bufferId); + ret = true; + break; + } + if (ret == false) { + ALOGW("buffer status message processing failure - message : %d connection : %lld", + message.newStatus, (long long)message.connectionId); + } + } + messages.clear(); +} + +bool Accessor::Impl::BufferPool::handleClose(ConnectionId connectionId) { + // Cleaning buffers + auto buffers = mUsingBuffers.find(connectionId); + if (buffers != mUsingBuffers.end()) { + for (const BufferId& bufferId : buffers->second) { + bool deleted = erase(&mUsingConnections, bufferId, connectionId); + if (deleted) { + auto bufferIter = mBuffers.find(bufferId); + bufferIter->second->mOwnerCount--; + if (bufferIter->second->mOwnerCount == 0 && + bufferIter->second->mTransactionCount == 0) { + // TODO: handle freebuffer insert fail + if (!bufferIter->second->mInvalidated) { + mStats.onBufferUnused(bufferIter->second->mAllocSize); + mFreeBuffers.insert(bufferId); + } else { + mStats.onBufferUnused(bufferIter->second->mAllocSize); + mStats.onBufferEvicted(bufferIter->second->mAllocSize); + mBuffers.erase(bufferIter); + mInvalidation.onBufferInvalidated(bufferId, mInvalidationChannel); + } + } + } + } + mUsingBuffers.erase(buffers); + } + + // Cleaning transactions + auto pending = mPendingTransactions.find(connectionId); + if (pending != mPendingTransactions.end()) { + for (const TransactionId& transactionId : pending->second) { + auto iter = mTransactions.find(transactionId); + if (iter != mTransactions.end()) { + if (!iter->second->mSenderValidated) { + mCompletedTransactions.insert(transactionId); + } + BufferId bufferId = iter->second->mBufferId; + auto bufferIter = mBuffers.find(bufferId); + bufferIter->second->mTransactionCount--; + if (bufferIter->second->mOwnerCount == 0 && + bufferIter->second->mTransactionCount == 0) { + // TODO: handle freebuffer insert fail + if (!bufferIter->second->mInvalidated) { + mStats.onBufferUnused(bufferIter->second->mAllocSize); + mFreeBuffers.insert(bufferId); + } else { + mStats.onBufferUnused(bufferIter->second->mAllocSize); + mStats.onBufferEvicted(bufferIter->second->mAllocSize); + mBuffers.erase(bufferIter); + mInvalidation.onBufferInvalidated(bufferId, mInvalidationChannel); + } + } + mTransactions.erase(iter); + } + } + } + mConnectionIds.erase(connectionId); + return true; +} + +bool Accessor::Impl::BufferPool::getFreeBuffer( + const std::shared_ptr &allocator, + const std::vector ¶ms, BufferId *pId, + const native_handle_t** handle) { + auto bufferIt = mFreeBuffers.begin(); + for (;bufferIt != mFreeBuffers.end(); ++bufferIt) { + BufferId bufferId = *bufferIt; + if (allocator->compatible(params, mBuffers[bufferId]->mConfig)) { + break; + } + } + if (bufferIt != mFreeBuffers.end()) { + BufferId id = *bufferIt; + mFreeBuffers.erase(bufferIt); + mStats.onBufferRecycled(mBuffers[id]->mAllocSize); + *handle = mBuffers[id]->handle(); + *pId = id; + ALOGV("recycle a buffer %u %p", id, *handle); + return true; + } + return false; +} + +ResultStatus Accessor::Impl::BufferPool::addNewBuffer( + const std::shared_ptr &alloc, + const size_t allocSize, + const std::vector ¶ms, + BufferId *pId, + const native_handle_t** handle) { + + BufferId bufferId = mSeq++; + if (mSeq == Connection::SYNC_BUFFERID) { + mSeq = 0; + } + std::unique_ptr buffer = + std::make_unique( + bufferId, alloc, allocSize, params); + if (buffer) { + auto res = mBuffers.insert(std::make_pair( + bufferId, std::move(buffer))); + if (res.second) { + mStats.onBufferAllocated(allocSize); + *handle = alloc->handle(); + *pId = bufferId; + return ResultStatus::OK; + } + } + return ResultStatus::NO_MEMORY; +} + +void Accessor::Impl::BufferPool::cleanUp(bool clearCache) { + if (clearCache || mTimestampUs > mLastCleanUpUs + kCleanUpDurationUs || + mStats.buffersNotInUse() > kMaxUnusedBufferCount) { + mLastCleanUpUs = mTimestampUs; + if (mTimestampUs > mLastLogUs + kLogDurationUs || + mStats.buffersNotInUse() > kMaxUnusedBufferCount) { + mLastLogUs = mTimestampUs; + ALOGD("bufferpool2 %p : %zu(%zu size) total buffers - " + "%zu(%zu size) used buffers - %zu/%zu (recycle/alloc) - " + "%zu/%zu (fetch/transfer)", + this, mStats.mBuffersCached, mStats.mSizeCached, + mStats.mBuffersInUse, mStats.mSizeInUse, + mStats.mTotalRecycles, mStats.mTotalAllocations, + mStats.mTotalFetches, mStats.mTotalTransfers); + } + for (auto freeIt = mFreeBuffers.begin(); freeIt != mFreeBuffers.end();) { + if (!clearCache && mStats.buffersNotInUse() <= kUnusedBufferCountTarget && + (mStats.mSizeCached < kMinAllocBytesForEviction || + mBuffers.size() < kMinBufferCountForEviction)) { + break; + } + auto it = mBuffers.find(*freeIt); + if (it != mBuffers.end() && + it->second->mOwnerCount == 0 && it->second->mTransactionCount == 0) { + mStats.onBufferEvicted(it->second->mAllocSize); + mBuffers.erase(it); + freeIt = mFreeBuffers.erase(freeIt); + } else { + ++freeIt; + ALOGW("bufferpool2 inconsistent!"); + } + } + } +} + +void Accessor::Impl::BufferPool::invalidate( + bool needsAck, BufferId from, BufferId to, + const std::shared_ptr &impl) { + for (auto freeIt = mFreeBuffers.begin(); freeIt != mFreeBuffers.end();) { + if (isBufferInRange(from, to, *freeIt)) { + auto it = mBuffers.find(*freeIt); + if (it != mBuffers.end() && + it->second->mOwnerCount == 0 && it->second->mTransactionCount == 0) { + mStats.onBufferEvicted(it->second->mAllocSize); + mBuffers.erase(it); + freeIt = mFreeBuffers.erase(freeIt); + continue; + } else { + ALOGW("bufferpool2 inconsistent!"); + } + } + ++freeIt; + } + + size_t left = 0; + for (auto it = mBuffers.begin(); it != mBuffers.end(); ++it) { + if (isBufferInRange(from, to, it->first)) { + it->second->invalidate(); + ++left; + } + } + mInvalidation.onInvalidationRequest(needsAck, from, to, left, mInvalidationChannel, impl); +} + +void Accessor::Impl::BufferPool::flush(const std::shared_ptr &impl) { + BufferId from = mStartSeq; + BufferId to = mSeq; + mStartSeq = mSeq; + // TODO: needsAck params + ALOGV("buffer invalidation request bp:%u %u %u", mInvalidation.mId, from, to); + if (from != to) { + invalidate(true, from, to, impl); + } +} + +void Accessor::Impl::invalidatorThread( + std::map> &accessors, + std::mutex &mutex, + std::condition_variable &cv, + bool &ready) { + constexpr uint32_t NUM_SPIN_TO_INCREASE_SLEEP = 1024; + constexpr uint32_t NUM_SPIN_TO_LOG = 1024*8; + constexpr useconds_t MAX_SLEEP_US = 10000; + uint32_t numSpin = 0; + useconds_t sleepUs = 1; + + while(true) { + std::map> copied; + { + std::unique_lock lock(mutex); + if (!ready) { + numSpin = 0; + sleepUs = 1; + cv.wait(lock); + } + copied.insert(accessors.begin(), accessors.end()); + } + std::list erased; + for (auto it = copied.begin(); it != copied.end(); ++it) { + const std::shared_ptr impl = it->second.lock(); + if (!impl) { + erased.push_back(it->first); + } else { + impl->handleInvalidateAck(); + } + } + { + std::unique_lock lock(mutex); + for (auto it = erased.begin(); it != erased.end(); ++it) { + accessors.erase(*it); + } + if (accessors.size() == 0) { + ready = false; + } else { + // TODO Use an efficient way to wait over FMQ. + // N.B. Since there is not a efficient way to wait over FMQ, + // polling over the FMQ is the current way to prevent draining + // CPU. + lock.unlock(); + ++numSpin; + if (numSpin % NUM_SPIN_TO_INCREASE_SLEEP == 0 && + sleepUs < MAX_SLEEP_US) { + sleepUs *= 10; + } + if (numSpin % NUM_SPIN_TO_LOG == 0) { + ALOGW("invalidator thread spinning"); + } + ::usleep(sleepUs); + } + } + } +} + +Accessor::Impl::AccessorInvalidator::AccessorInvalidator() : mReady(false) { + std::thread invalidator( + invalidatorThread, + std::ref(mAccessors), + std::ref(mMutex), + std::ref(mCv), + std::ref(mReady)); + invalidator.detach(); +} + +void Accessor::Impl::AccessorInvalidator::addAccessor( + uint32_t accessorId, const std::weak_ptr &impl) { + bool notify = false; + std::unique_lock lock(mMutex); + if (mAccessors.find(accessorId) == mAccessors.end()) { + if (!mReady) { + mReady = true; + notify = true; + } + mAccessors.insert(std::make_pair(accessorId, impl)); + ALOGV("buffer invalidation added bp:%u %d", accessorId, notify); + } + lock.unlock(); + if (notify) { + mCv.notify_one(); + } +} + +void Accessor::Impl::AccessorInvalidator::delAccessor(uint32_t accessorId) { + std::lock_guard lock(mMutex); + mAccessors.erase(accessorId); + ALOGV("buffer invalidation deleted bp:%u", accessorId); + if (mAccessors.size() == 0) { + mReady = false; + } +} + +std::unique_ptr Accessor::Impl::sInvalidator; + +void Accessor::Impl::createInvalidator() { + if (!sInvalidator) { + sInvalidator = std::make_unique(); + } +} + +void Accessor::Impl::evictorThread( + std::map, nsecs_t, std::owner_less<>> &accessors, + std::mutex &mutex, + std::condition_variable &cv) { + std::list> evictList; + while (true) { + int expired = 0; + int evicted = 0; + { + nsecs_t now = systemTime(); + std::unique_lock lock(mutex); + if (accessors.size() == 0) { + cv.wait(lock); + } + auto it = accessors.begin(); + while (it != accessors.end()) { + if (now > (it->second + kEvictDurationNs)) { + ++expired; + evictList.push_back(it->first); + it = accessors.erase(it); + } else { + ++it; + } + } + } + // evict idle accessors; + for (auto it = evictList.begin(); it != evictList.end(); ++it) { + const std::shared_ptr accessor = it->lock(); + if (accessor) { + accessor->cleanUp(true); + ++evicted; + } + } + if (expired > 0) { + ALOGD("evictor expired: %d, evicted: %d", expired, evicted); + } + evictList.clear(); + ::usleep(kEvictGranularityNs / 1000); + } +} + +Accessor::Impl::AccessorEvictor::AccessorEvictor() { + std::thread evictor( + evictorThread, + std::ref(mAccessors), + std::ref(mMutex), + std::ref(mCv)); + evictor.detach(); +} + +void Accessor::Impl::AccessorEvictor::addAccessor( + const std::weak_ptr &impl, nsecs_t ts) { + std::lock_guard lock(mMutex); + bool notify = mAccessors.empty(); + auto it = mAccessors.find(impl); + if (it == mAccessors.end()) { + mAccessors.emplace(impl, ts); + } else { + it->second = ts; + } + if (notify) { + mCv.notify_one(); + } +} + +std::unique_ptr Accessor::Impl::sEvictor; + +void Accessor::Impl::createEvictor() { + if (!sEvictor) { + sEvictor = std::make_unique(); + } +} + +void Accessor::Impl::scheduleEvictIfNeeded() { + nsecs_t now = systemTime(); + + if (now > (mScheduleEvictTs + kEvictGranularityNs)) { + mScheduleEvictTs = now; + sEvictor->addAccessor(shared_from_this(), now); + } +} + +} // namespace implementation +} // namespace V2_0 +} // namespace bufferpool +} // namespace media +} // namespace hardware +} // namespace android diff --git a/media/bufferpool/aidl/default/AccessorImpl.h b/media/bufferpool/aidl/default/AccessorImpl.h new file mode 100644 index 0000000000..3d39941337 --- /dev/null +++ b/media/bufferpool/aidl/default/AccessorImpl.h @@ -0,0 +1,431 @@ +/* + * Copyright (C) 2018 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. + */ + +#ifndef ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_ACCESSORIMPL_H +#define ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_ACCESSORIMPL_H + +#include +#include +#include +#include +#include "Accessor.h" + +namespace android { +namespace hardware { +namespace media { +namespace bufferpool { +namespace V2_0 { +namespace implementation { + +struct InternalBuffer; +struct TransactionStatus; + +/** + * An implementation of a buffer pool accessor(or a buffer pool implementation.) */ +class Accessor::Impl + : public std::enable_shared_from_this { +public: + Impl(const std::shared_ptr &allocator); + + ~Impl(); + + ResultStatus connect( + const sp &accessor, const sp &observer, + sp *connection, + ConnectionId *pConnectionId, + uint32_t *pMsgId, + const StatusDescriptor** statusDescPtr, + const InvalidationDescriptor** invDescPtr); + + ResultStatus close(ConnectionId connectionId); + + ResultStatus allocate(ConnectionId connectionId, + const std::vector& params, + BufferId *bufferId, + const native_handle_t** handle); + + ResultStatus fetch(ConnectionId connectionId, + TransactionId transactionId, + BufferId bufferId, + const native_handle_t** handle); + + void flush(); + + void cleanUp(bool clearCache); + + bool isValid(); + + void handleInvalidateAck(); + + static void createInvalidator(); + + static void createEvictor(); + +private: + // ConnectionId = pid : (timestamp_created + seqId) + // in order to guarantee uniqueness for each connection + static uint32_t sSeqId; + + const std::shared_ptr mAllocator; + + nsecs_t mScheduleEvictTs; + + /** + * Buffer pool implementation. + * + * Handles buffer status messages. Handles buffer allocation/recycling. + * Handles buffer transfer between buffer pool clients. + */ + struct BufferPool { + private: + std::mutex mMutex; + int64_t mTimestampUs; + int64_t mLastCleanUpUs; + int64_t mLastLogUs; + BufferId mSeq; + BufferId mStartSeq; + bool mValid; + BufferStatusObserver mObserver; + BufferInvalidationChannel mInvalidationChannel; + + std::map> mUsingBuffers; + std::map> mUsingConnections; + + std::map> mPendingTransactions; + // Transactions completed before TRANSFER_TO message arrival. + // Fetch does not occur for the transactions. + // Only transaction id is kept for the transactions in short duration. + std::set mCompletedTransactions; + // Currently active(pending) transations' status & information. + std::map> + mTransactions; + + std::map> mBuffers; + std::set mFreeBuffers; + std::set mConnectionIds; + + struct Invalidation { + static std::atomic sInvSeqId; + + struct Pending { + bool mNeedsAck; + uint32_t mFrom; + uint32_t mTo; + size_t mLeft; + const std::weak_ptr mImpl; + Pending(bool needsAck, uint32_t from, uint32_t to, size_t left, + const std::shared_ptr &impl) + : mNeedsAck(needsAck), + mFrom(from), + mTo(to), + mLeft(left), + mImpl(impl) + {} + + bool isInvalidated(uint32_t bufferId) { + return isBufferInRange(mFrom, mTo, bufferId) && --mLeft == 0; + } + }; + + std::list mPendings; + std::map mAcks; + std::map> mObservers; + uint32_t mInvalidationId; + uint32_t mId; + + Invalidation() : mInvalidationId(0), mId(sInvSeqId.fetch_add(1)) {} + + void onConnect(ConnectionId conId, const sp &observer); + + void onClose(ConnectionId conId); + + void onAck(ConnectionId conId, uint32_t msgId); + + void onBufferInvalidated( + BufferId bufferId, + BufferInvalidationChannel &channel); + + void onInvalidationRequest( + bool needsAck, uint32_t from, uint32_t to, size_t left, + BufferInvalidationChannel &channel, + const std::shared_ptr &impl); + + void onHandleAck( + std::map> *observers, + uint32_t *invalidationId); + } mInvalidation; + /// Buffer pool statistics which tracks allocation and transfer statistics. + struct Stats { + /// Total size of allocations which are used or available to use. + /// (bytes or pixels) + size_t mSizeCached; + /// # of cached buffers which are used or available to use. + size_t mBuffersCached; + /// Total size of allocations which are currently used. (bytes or pixels) + size_t mSizeInUse; + /// # of currently used buffers + size_t mBuffersInUse; + + /// # of allocations called on bufferpool. (# of fetched from BlockPool) + size_t mTotalAllocations; + /// # of allocations that were served from the cache. + /// (# of allocator alloc prevented) + size_t mTotalRecycles; + /// # of buffer transfers initiated. + size_t mTotalTransfers; + /// # of transfers that had to be fetched. + size_t mTotalFetches; + + Stats() + : mSizeCached(0), mBuffersCached(0), mSizeInUse(0), mBuffersInUse(0), + mTotalAllocations(0), mTotalRecycles(0), mTotalTransfers(0), mTotalFetches(0) {} + + /// # of currently unused buffers + size_t buffersNotInUse() const { + ALOG_ASSERT(mBuffersCached >= mBuffersInUse); + return mBuffersCached - mBuffersInUse; + } + + /// A new buffer is allocated on an allocation request. + void onBufferAllocated(size_t allocSize) { + mSizeCached += allocSize; + mBuffersCached++; + + mSizeInUse += allocSize; + mBuffersInUse++; + + mTotalAllocations++; + } + + /// A buffer is evicted and destroyed. + void onBufferEvicted(size_t allocSize) { + mSizeCached -= allocSize; + mBuffersCached--; + } + + /// A buffer is recycled on an allocation request. + void onBufferRecycled(size_t allocSize) { + mSizeInUse += allocSize; + mBuffersInUse++; + + mTotalAllocations++; + mTotalRecycles++; + } + + /// A buffer is available to be recycled. + void onBufferUnused(size_t allocSize) { + mSizeInUse -= allocSize; + mBuffersInUse--; + } + + /// A buffer transfer is initiated. + void onBufferSent() { + mTotalTransfers++; + } + + /// A buffer fetch is invoked by a buffer transfer. + void onBufferFetched() { + mTotalFetches++; + } + } mStats; + + bool isValid() { + return mValid; + } + + void invalidate(bool needsAck, BufferId from, BufferId to, + const std::shared_ptr &impl); + + static void createInvalidator(); + + public: + /** Creates a buffer pool. */ + BufferPool(); + + /** Destroys a buffer pool. */ + ~BufferPool(); + + /** + * Processes all pending buffer status messages, and returns the result. + * Each status message is handled by methods with 'handle' prefix. + */ + void processStatusMessages(); + + /** + * Handles a buffer being owned by a connection. + * + * @param connectionId the id of the buffer owning connection. + * @param bufferId the id of the buffer. + * + * @return {@code true} when the buffer is owned, + * {@code false} otherwise. + */ + bool handleOwnBuffer(ConnectionId connectionId, BufferId bufferId); + + /** + * Handles a buffer being released by a connection. + * + * @param connectionId the id of the buffer owning connection. + * @param bufferId the id of the buffer. + * + * @return {@code true} when the buffer ownership is released, + * {@code false} otherwise. + */ + bool handleReleaseBuffer(ConnectionId connectionId, BufferId bufferId); + + /** + * Handles a transfer transaction start message from the sender. + * + * @param message a buffer status message for the transaction. + * + * @result {@code true} when transfer_to message is acknowledged, + * {@code false} otherwise. + */ + bool handleTransferTo(const BufferStatusMessage &message); + + /** + * Handles a transfer transaction being acked by the receiver. + * + * @param message a buffer status message for the transaction. + * + * @result {@code true} when transfer_from message is acknowledged, + * {@code false} otherwise. + */ + bool handleTransferFrom(const BufferStatusMessage &message); + + /** + * Handles a transfer transaction result message from the receiver. + * + * @param message a buffer status message for the transaction. + * + * @result {@code true} when the exisitng transaction is finished, + * {@code false} otherwise. + */ + bool handleTransferResult(const BufferStatusMessage &message); + + /** + * Handles a connection being closed, and returns the result. All the + * buffers and transactions owned by the connection will be cleaned up. + * The related FMQ will be cleaned up too. + * + * @param connectionId the id of the connection. + * + * @result {@code true} when the connection existed, + * {@code false} otherwise. + */ + bool handleClose(ConnectionId connectionId); + + /** + * Recycles a existing free buffer if it is possible. + * + * @param allocator the buffer allocator + * @param params the allocation parameters. + * @param pId the id of the recycled buffer. + * @param handle the native handle of the recycled buffer. + * + * @return {@code true} when a buffer is recycled, {@code false} + * otherwise. + */ + bool getFreeBuffer( + const std::shared_ptr &allocator, + const std::vector ¶ms, + BufferId *pId, const native_handle_t **handle); + + /** + * Adds a newly allocated buffer to bufferpool. + * + * @param alloc the newly allocated buffer. + * @param allocSize the size of the newly allocated buffer. + * @param params the allocation parameters. + * @param pId the buffer id for the newly allocated buffer. + * @param handle the native handle for the newly allocated buffer. + * + * @return OK when an allocation is successfully allocated. + * NO_MEMORY when there is no memory. + * CRITICAL_ERROR otherwise. + */ + ResultStatus addNewBuffer( + const std::shared_ptr &alloc, + const size_t allocSize, + const std::vector ¶ms, + BufferId *pId, + const native_handle_t **handle); + + /** + * Processes pending buffer status messages and performs periodic cache + * cleaning. + * + * @param clearCache if clearCache is true, it frees all buffers + * waiting to be recycled. + */ + void cleanUp(bool clearCache = false); + + /** + * Processes pending buffer status messages and invalidate all current + * free buffers. Active buffers are invalidated after being inactive. + */ + void flush(const std::shared_ptr &impl); + + friend class Accessor::Impl; + } mBufferPool; + + struct AccessorInvalidator { + std::map> mAccessors; + std::mutex mMutex; + std::condition_variable mCv; + bool mReady; + + AccessorInvalidator(); + void addAccessor(uint32_t accessorId, const std::weak_ptr &impl); + void delAccessor(uint32_t accessorId); + }; + + static std::unique_ptr sInvalidator; + + static void invalidatorThread( + std::map> &accessors, + std::mutex &mutex, + std::condition_variable &cv, + bool &ready); + + struct AccessorEvictor { + std::map, nsecs_t, std::owner_less<>> mAccessors; + std::mutex mMutex; + std::condition_variable mCv; + + AccessorEvictor(); + void addAccessor(const std::weak_ptr &impl, nsecs_t ts); + }; + + static std::unique_ptr sEvictor; + + static void evictorThread( + std::map, nsecs_t, std::owner_less<>> &accessors, + std::mutex &mutex, + std::condition_variable &cv); + + void scheduleEvictIfNeeded(); + +}; + +} // namespace implementation +} // namespace V2_0 +} // namespace ufferpool +} // namespace media +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_ACCESSORIMPL_H diff --git a/media/bufferpool/aidl/default/BufferPoolClient.cpp b/media/bufferpool/aidl/default/BufferPoolClient.cpp new file mode 100644 index 0000000000..cda23ff49d --- /dev/null +++ b/media/bufferpool/aidl/default/BufferPoolClient.cpp @@ -0,0 +1,876 @@ +/* + * Copyright (C) 2018 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. + */ + +#define LOG_TAG "BufferPoolClient" +//#define LOG_NDEBUG 0 + +#include +#include +#include "BufferPoolClient.h" +#include "Connection.h" + +namespace android { +namespace hardware { +namespace media { +namespace bufferpool { +namespace V2_0 { +namespace implementation { + +static constexpr int64_t kReceiveTimeoutUs = 2000000; // 2s +static constexpr int kPostMaxRetry = 3; +static constexpr int kCacheTtlUs = 1000000; // TODO: tune +static constexpr size_t kMaxCachedBufferCount = 64; +static constexpr size_t kCachedBufferCountTarget = kMaxCachedBufferCount - 16; + +class BufferPoolClient::Impl + : public std::enable_shared_from_this { +public: + explicit Impl(const sp &accessor, const sp &observer); + + explicit Impl(const sp &accessor, const sp &observer); + + bool isValid() { + return mValid; + } + + bool isLocal() { + return mValid && mLocal; + } + + ConnectionId getConnectionId() { + return mConnectionId; + } + + sp &getAccessor() { + return mAccessor; + } + + bool isActive(int64_t *lastTransactionUs, bool clearCache); + + void receiveInvalidation(uint32_t msgID); + + ResultStatus flush(); + + ResultStatus allocate(const std::vector ¶ms, + native_handle_t **handle, + std::shared_ptr *buffer); + + ResultStatus receive( + TransactionId transactionId, BufferId bufferId, + int64_t timestampUs, + native_handle_t **handle, std::shared_ptr *buffer); + + void postBufferRelease(BufferId bufferId); + + bool postSend( + BufferId bufferId, ConnectionId receiver, + TransactionId *transactionId, int64_t *timestampUs); +private: + + bool postReceive( + BufferId bufferId, TransactionId transactionId, + int64_t timestampUs); + + bool postReceiveResult( + BufferId bufferId, TransactionId transactionId, bool result, bool *needsSync); + + void trySyncFromRemote(); + + bool syncReleased(uint32_t msgId = 0); + + void evictCaches(bool clearCache = false); + + void invalidateBuffer(BufferId id); + + void invalidateRange(BufferId from, BufferId to); + + ResultStatus allocateBufferHandle( + const std::vector& params, BufferId *bufferId, + native_handle_t **handle); + + ResultStatus fetchBufferHandle( + TransactionId transactionId, BufferId bufferId, + native_handle_t **handle); + + struct BlockPoolDataDtor; + struct ClientBuffer; + + bool mLocal; + bool mValid; + sp mAccessor; + sp mLocalConnection; + sp mRemoteConnection; + uint32_t mSeqId; + ConnectionId mConnectionId; + int64_t mLastEvictCacheUs; + std::unique_ptr mInvalidationListener; + + // CachedBuffers + struct BufferCache { + std::mutex mLock; + bool mCreating; + std::condition_variable mCreateCv; + std::map> mBuffers; + int mActive; + int64_t mLastChangeUs; + + BufferCache() : mCreating(false), mActive(0), mLastChangeUs(getTimestampNow()) {} + + void incActive_l() { + ++mActive; + mLastChangeUs = getTimestampNow(); + } + + void decActive_l() { + --mActive; + mLastChangeUs = getTimestampNow(); + } + + int cachedBufferCount() const { + return mBuffers.size() - mActive; + } + } mCache; + + // FMQ - release notifier + struct ReleaseCache { + std::mutex mLock; + // TODO: use only one list?(using one list may dealy sending messages?) + std::list mReleasingIds; + std::list mReleasedIds; + uint32_t mInvalidateId; // TODO: invalidation ACK to bufferpool + bool mInvalidateAck; + std::unique_ptr mStatusChannel; + + ReleaseCache() : mInvalidateId(0), mInvalidateAck(true) {} + } mReleasing; + + // This lock is held during synchronization from remote side. + // In order to minimize remote calls and locking durtaion, this lock is held + // by best effort approach using try_lock(). + std::mutex mRemoteSyncLock; +}; + +struct BufferPoolClient::Impl::BlockPoolDataDtor { + BlockPoolDataDtor(const std::shared_ptr &impl) + : mImpl(impl) {} + + void operator()(BufferPoolData *buffer) { + BufferId id = buffer->mId; + delete buffer; + + auto impl = mImpl.lock(); + if (impl && impl->isValid()) { + impl->postBufferRelease(id); + } + } + const std::weak_ptr mImpl; +}; + +struct BufferPoolClient::Impl::ClientBuffer { +private: + int64_t mExpireUs; + bool mHasCache; + ConnectionId mConnectionId; + BufferId mId; + native_handle_t *mHandle; + std::weak_ptr mCache; + + void updateExpire() { + mExpireUs = getTimestampNow() + kCacheTtlUs; + } + +public: + ClientBuffer( + ConnectionId connectionId, BufferId id, native_handle_t *handle) + : mHasCache(false), mConnectionId(connectionId), + mId(id), mHandle(handle) { + mExpireUs = getTimestampNow() + kCacheTtlUs; + } + + ~ClientBuffer() { + if (mHandle) { + native_handle_close(mHandle); + native_handle_delete(mHandle); + } + } + + BufferId id() const { + return mId; + } + + bool expire() const { + int64_t now = getTimestampNow(); + return now >= mExpireUs; + } + + bool hasCache() const { + return mHasCache; + } + + std::shared_ptr fetchCache(native_handle_t **pHandle) { + if (mHasCache) { + std::shared_ptr cache = mCache.lock(); + if (cache) { + *pHandle = mHandle; + } + return cache; + } + return nullptr; + } + + std::shared_ptr createCache( + const std::shared_ptr &impl, + native_handle_t **pHandle) { + if (!mHasCache) { + // Allocates a raw ptr in order to avoid sending #postBufferRelease + // from deleter, in case of native_handle_clone failure. + BufferPoolData *ptr = new BufferPoolData(mConnectionId, mId); + if (ptr) { + std::shared_ptr cache(ptr, BlockPoolDataDtor(impl)); + if (cache) { + mCache = cache; + mHasCache = true; + *pHandle = mHandle; + return cache; + } + } + if (ptr) { + delete ptr; + } + } + return nullptr; + } + + bool onCacheRelease() { + if (mHasCache) { + // TODO: verify mCache is not valid; + updateExpire(); + mHasCache = false; + return true; + } + return false; + } +}; + +BufferPoolClient::Impl::Impl(const sp &accessor, const sp &observer) + : mLocal(true), mValid(false), mAccessor(accessor), mSeqId(0), + mLastEvictCacheUs(getTimestampNow()) { + const StatusDescriptor *statusDesc; + const InvalidationDescriptor *invDesc; + ResultStatus status = accessor->connect( + observer, true, + &mLocalConnection, &mConnectionId, &mReleasing.mInvalidateId, + &statusDesc, &invDesc); + if (status == ResultStatus::OK) { + mReleasing.mStatusChannel = + std::make_unique(*statusDesc); + mInvalidationListener = + std::make_unique(*invDesc); + mValid = mReleasing.mStatusChannel && + mReleasing.mStatusChannel->isValid() && + mInvalidationListener && + mInvalidationListener->isValid(); + } +} + +BufferPoolClient::Impl::Impl(const sp &accessor, const sp &observer) + : mLocal(false), mValid(false), mAccessor(accessor), mSeqId(0), + mLastEvictCacheUs(getTimestampNow()) { + bool valid = false; + sp& outConnection = mRemoteConnection; + ConnectionId& id = mConnectionId; + uint32_t& outMsgId = mReleasing.mInvalidateId; + std::unique_ptr& outChannel = + mReleasing.mStatusChannel; + std::unique_ptr& outObserver = + mInvalidationListener; + Return transResult = accessor->connect( + observer, + [&valid, &outConnection, &id, &outMsgId, &outChannel, &outObserver] + (ResultStatus status, sp connection, + ConnectionId connectionId, uint32_t msgId, + const StatusDescriptor& statusDesc, + const InvalidationDescriptor& invDesc) { + if (status == ResultStatus::OK) { + outConnection = connection; + id = connectionId; + outMsgId = msgId; + outChannel = std::make_unique(statusDesc); + outObserver = std::make_unique(invDesc); + if (outChannel && outChannel->isValid() && + outObserver && outObserver->isValid()) { + valid = true; + } + } + }); + mValid = transResult.isOk() && valid; +} + +bool BufferPoolClient::Impl::isActive(int64_t *lastTransactionUs, bool clearCache) { + bool active = false; + { + std::lock_guard lock(mCache.mLock); + syncReleased(); + evictCaches(clearCache); + *lastTransactionUs = mCache.mLastChangeUs; + active = mCache.mActive > 0; + } + if (mValid && mLocal && mLocalConnection) { + mLocalConnection->cleanUp(clearCache); + return true; + } + return active; +} + +void BufferPoolClient::Impl::receiveInvalidation(uint32_t messageId) { + std::lock_guard lock(mCache.mLock); + syncReleased(messageId); + // TODO: evict cache required? +} + +ResultStatus BufferPoolClient::Impl::flush() { + if (!mLocal || !mLocalConnection || !mValid) { + return ResultStatus::CRITICAL_ERROR; + } + { + std::unique_lock lock(mCache.mLock); + syncReleased(); + evictCaches(); + return mLocalConnection->flush(); + } +} + +ResultStatus BufferPoolClient::Impl::allocate( + const std::vector ¶ms, + native_handle_t **pHandle, + std::shared_ptr *buffer) { + if (!mLocal || !mLocalConnection || !mValid) { + return ResultStatus::CRITICAL_ERROR; + } + BufferId bufferId; + native_handle_t *handle = nullptr; + buffer->reset(); + ResultStatus status = allocateBufferHandle(params, &bufferId, &handle); + if (status == ResultStatus::OK) { + if (handle) { + std::unique_lock lock(mCache.mLock); + syncReleased(); + evictCaches(); + auto cacheIt = mCache.mBuffers.find(bufferId); + if (cacheIt != mCache.mBuffers.end()) { + // TODO: verify it is recycled. (not having active ref) + mCache.mBuffers.erase(cacheIt); + } + auto clientBuffer = std::make_unique( + mConnectionId, bufferId, handle); + if (clientBuffer) { + auto result = mCache.mBuffers.insert(std::make_pair( + bufferId, std::move(clientBuffer))); + if (result.second) { + *buffer = result.first->second->createCache( + shared_from_this(), pHandle); + if (*buffer) { + mCache.incActive_l(); + } + } + } + } + if (!*buffer) { + ALOGV("client cache creation failure %d: %lld", + handle != nullptr, (long long)mConnectionId); + status = ResultStatus::NO_MEMORY; + postBufferRelease(bufferId); + } + } + return status; +} + +ResultStatus BufferPoolClient::Impl::receive( + TransactionId transactionId, BufferId bufferId, int64_t timestampUs, + native_handle_t **pHandle, + std::shared_ptr *buffer) { + if (!mValid) { + return ResultStatus::CRITICAL_ERROR; + } + if (timestampUs != 0) { + timestampUs += kReceiveTimeoutUs; + } + if (!postReceive(bufferId, transactionId, timestampUs)) { + return ResultStatus::CRITICAL_ERROR; + } + ResultStatus status = ResultStatus::CRITICAL_ERROR; + buffer->reset(); + while(1) { + std::unique_lock lock(mCache.mLock); + syncReleased(); + evictCaches(); + auto cacheIt = mCache.mBuffers.find(bufferId); + if (cacheIt != mCache.mBuffers.end()) { + if (cacheIt->second->hasCache()) { + *buffer = cacheIt->second->fetchCache(pHandle); + if (!*buffer) { + // check transfer time_out + lock.unlock(); + std::this_thread::yield(); + continue; + } + ALOGV("client receive from reference %lld", (long long)mConnectionId); + break; + } else { + *buffer = cacheIt->second->createCache(shared_from_this(), pHandle); + if (*buffer) { + mCache.incActive_l(); + } + ALOGV("client receive from cache %lld", (long long)mConnectionId); + break; + } + } else { + if (!mCache.mCreating) { + mCache.mCreating = true; + lock.unlock(); + native_handle_t* handle = nullptr; + status = fetchBufferHandle(transactionId, bufferId, &handle); + lock.lock(); + if (status == ResultStatus::OK) { + if (handle) { + auto clientBuffer = std::make_unique( + mConnectionId, bufferId, handle); + if (clientBuffer) { + auto result = mCache.mBuffers.insert( + std::make_pair(bufferId, std::move( + clientBuffer))); + if (result.second) { + *buffer = result.first->second->createCache( + shared_from_this(), pHandle); + if (*buffer) { + mCache.incActive_l(); + } + } + } + } + if (!*buffer) { + status = ResultStatus::NO_MEMORY; + } + } + mCache.mCreating = false; + lock.unlock(); + mCache.mCreateCv.notify_all(); + break; + } + mCache.mCreateCv.wait(lock); + } + } + bool needsSync = false; + bool posted = postReceiveResult(bufferId, transactionId, + *buffer ? true : false, &needsSync); + ALOGV("client receive %lld - %u : %s (%d)", (long long)mConnectionId, bufferId, + *buffer ? "ok" : "fail", posted); + if (mValid && mLocal && mLocalConnection) { + mLocalConnection->cleanUp(false); + } + if (needsSync && mRemoteConnection) { + trySyncFromRemote(); + } + if (*buffer) { + if (!posted) { + buffer->reset(); + return ResultStatus::CRITICAL_ERROR; + } + return ResultStatus::OK; + } + return status; +} + + +void BufferPoolClient::Impl::postBufferRelease(BufferId bufferId) { + std::lock_guard lock(mReleasing.mLock); + mReleasing.mReleasingIds.push_back(bufferId); + mReleasing.mStatusChannel->postBufferRelease( + mConnectionId, mReleasing.mReleasingIds, mReleasing.mReleasedIds); +} + +// TODO: revise ad-hoc posting data structure +bool BufferPoolClient::Impl::postSend( + BufferId bufferId, ConnectionId receiver, + TransactionId *transactionId, int64_t *timestampUs) { + { + // TODO: don't need to call syncReleased every time + std::lock_guard lock(mCache.mLock); + syncReleased(); + } + bool ret = false; + bool needsSync = false; + { + std::lock_guard lock(mReleasing.mLock); + *timestampUs = getTimestampNow(); + *transactionId = (mConnectionId << 32) | mSeqId++; + // TODO: retry, add timeout, target? + ret = mReleasing.mStatusChannel->postBufferStatusMessage( + *transactionId, bufferId, BufferStatus::TRANSFER_TO, mConnectionId, + receiver, mReleasing.mReleasingIds, mReleasing.mReleasedIds); + needsSync = !mLocal && mReleasing.mStatusChannel->needsSync(); + } + if (mValid && mLocal && mLocalConnection) { + mLocalConnection->cleanUp(false); + } + if (needsSync && mRemoteConnection) { + trySyncFromRemote(); + } + return ret; +} + +bool BufferPoolClient::Impl::postReceive( + BufferId bufferId, TransactionId transactionId, int64_t timestampUs) { + for (int i = 0; i < kPostMaxRetry; ++i) { + std::unique_lock lock(mReleasing.mLock); + int64_t now = getTimestampNow(); + if (timestampUs == 0 || now < timestampUs) { + bool result = mReleasing.mStatusChannel->postBufferStatusMessage( + transactionId, bufferId, BufferStatus::TRANSFER_FROM, + mConnectionId, -1, mReleasing.mReleasingIds, + mReleasing.mReleasedIds); + if (result) { + return true; + } + lock.unlock(); + std::this_thread::yield(); + } else { + mReleasing.mStatusChannel->postBufferStatusMessage( + transactionId, bufferId, BufferStatus::TRANSFER_TIMEOUT, + mConnectionId, -1, mReleasing.mReleasingIds, + mReleasing.mReleasedIds); + return false; + } + } + return false; +} + +bool BufferPoolClient::Impl::postReceiveResult( + BufferId bufferId, TransactionId transactionId, bool result, bool *needsSync) { + std::lock_guard lock(mReleasing.mLock); + // TODO: retry, add timeout + bool ret = mReleasing.mStatusChannel->postBufferStatusMessage( + transactionId, bufferId, + result ? BufferStatus::TRANSFER_OK : BufferStatus::TRANSFER_ERROR, + mConnectionId, -1, mReleasing.mReleasingIds, + mReleasing.mReleasedIds); + *needsSync = !mLocal && mReleasing.mStatusChannel->needsSync(); + return ret; +} + +void BufferPoolClient::Impl::trySyncFromRemote() { + if (mRemoteSyncLock.try_lock()) { + bool needsSync = false; + { + std::lock_guard lock(mReleasing.mLock); + needsSync = mReleasing.mStatusChannel->needsSync(); + } + if (needsSync) { + TransactionId transactionId = (mConnectionId << 32); + BufferId bufferId = Connection::SYNC_BUFFERID; + Return transResult = mRemoteConnection->fetch( + transactionId, bufferId, + [] + (ResultStatus outStatus, Buffer outBuffer) { + (void) outStatus; + (void) outBuffer; + }); + if (!transResult.isOk()) { + ALOGD("sync from client %lld failed: bufferpool process died.", + (long long)mConnectionId); + } + } + mRemoteSyncLock.unlock(); + } +} + +// should have mCache.mLock +bool BufferPoolClient::Impl::syncReleased(uint32_t messageId) { + bool cleared = false; + { + std::lock_guard lock(mReleasing.mLock); + if (mReleasing.mReleasingIds.size() > 0) { + mReleasing.mStatusChannel->postBufferRelease( + mConnectionId, mReleasing.mReleasingIds, + mReleasing.mReleasedIds); + } + if (mReleasing.mReleasedIds.size() > 0) { + for (BufferId& id: mReleasing.mReleasedIds) { + ALOGV("client release buffer %lld - %u", (long long)mConnectionId, id); + auto found = mCache.mBuffers.find(id); + if (found != mCache.mBuffers.end()) { + if (found->second->onCacheRelease()) { + mCache.decActive_l(); + } else { + // should not happen! + ALOGW("client %lld cache release status inconsitent!", + (long long)mConnectionId); + } + } else { + // should not happen! + ALOGW("client %lld cache status inconsitent!", (long long)mConnectionId); + } + } + mReleasing.mReleasedIds.clear(); + cleared = true; + } + } + std::vector invalidations; + mInvalidationListener->getInvalidations(invalidations); + uint32_t lastMsgId = 0; + if (invalidations.size() > 0) { + for (auto it = invalidations.begin(); it != invalidations.end(); ++it) { + if (it->messageId != 0) { + lastMsgId = it->messageId; + } + if (it->fromBufferId == it->toBufferId) { + // TODO: handle fromBufferId = UINT32_MAX + invalidateBuffer(it->fromBufferId); + } else { + invalidateRange(it->fromBufferId, it->toBufferId); + } + } + } + { + std::lock_guard lock(mReleasing.mLock); + if (lastMsgId != 0) { + if (isMessageLater(lastMsgId, mReleasing.mInvalidateId)) { + mReleasing.mInvalidateId = lastMsgId; + mReleasing.mInvalidateAck = false; + } + } else if (messageId != 0) { + // messages are drained. + if (isMessageLater(messageId, mReleasing.mInvalidateId)) { + mReleasing.mInvalidateId = messageId; + mReleasing.mInvalidateAck = true; + } + } + if (!mReleasing.mInvalidateAck) { + // post ACK + mReleasing.mStatusChannel->postBufferInvalidateAck( + mConnectionId, + mReleasing.mInvalidateId, &mReleasing.mInvalidateAck); + ALOGV("client %lld invalidateion ack (%d) %u", + (long long)mConnectionId, + mReleasing.mInvalidateAck, mReleasing.mInvalidateId); + } + } + return cleared; +} + +// should have mCache.mLock +void BufferPoolClient::Impl::evictCaches(bool clearCache) { + int64_t now = getTimestampNow(); + if (now >= mLastEvictCacheUs + kCacheTtlUs || + clearCache || mCache.cachedBufferCount() > kMaxCachedBufferCount) { + size_t evicted = 0; + for (auto it = mCache.mBuffers.begin(); it != mCache.mBuffers.end();) { + if (!it->second->hasCache() && (it->second->expire() || + clearCache || mCache.cachedBufferCount() > kCachedBufferCountTarget)) { + it = mCache.mBuffers.erase(it); + ++evicted; + } else { + ++it; + } + } + ALOGV("cache count %lld : total %zu, active %d, evicted %zu", + (long long)mConnectionId, mCache.mBuffers.size(), mCache.mActive, evicted); + mLastEvictCacheUs = now; + } +} + +// should have mCache.mLock +void BufferPoolClient::Impl::invalidateBuffer(BufferId id) { + for (auto it = mCache.mBuffers.begin(); it != mCache.mBuffers.end(); ++it) { + if (id == it->second->id()) { + if (!it->second->hasCache()) { + mCache.mBuffers.erase(it); + ALOGV("cache invalidated %lld : buffer %u", + (long long)mConnectionId, id); + } else { + ALOGW("Inconsitent invalidation %lld : activer buffer!! %u", + (long long)mConnectionId, (unsigned int)id); + } + break; + } + } +} + +// should have mCache.mLock +void BufferPoolClient::Impl::invalidateRange(BufferId from, BufferId to) { + size_t invalidated = 0; + for (auto it = mCache.mBuffers.begin(); it != mCache.mBuffers.end();) { + if (!it->second->hasCache()) { + BufferId bid = it->second->id(); + if (from < to) { + if (from <= bid && bid < to) { + ++invalidated; + it = mCache.mBuffers.erase(it); + continue; + } + } else { + if (from <= bid || bid < to) { + ++invalidated; + it = mCache.mBuffers.erase(it); + continue; + } + } + } + ++it; + } + ALOGV("cache invalidated %lld : # of invalidated %zu", + (long long)mConnectionId, invalidated); +} + +ResultStatus BufferPoolClient::Impl::allocateBufferHandle( + const std::vector& params, BufferId *bufferId, + native_handle_t** handle) { + if (mLocalConnection) { + const native_handle_t* allocHandle = nullptr; + ResultStatus status = mLocalConnection->allocate( + params, bufferId, &allocHandle); + if (status == ResultStatus::OK) { + *handle = native_handle_clone(allocHandle); + } + ALOGV("client allocate result %lld %d : %u clone %p", + (long long)mConnectionId, status == ResultStatus::OK, + *handle ? *bufferId : 0 , *handle); + return status; + } + return ResultStatus::CRITICAL_ERROR; +} + +ResultStatus BufferPoolClient::Impl::fetchBufferHandle( + TransactionId transactionId, BufferId bufferId, + native_handle_t **handle) { + sp connection; + if (mLocal) { + connection = mLocalConnection; + } else { + connection = mRemoteConnection; + } + ResultStatus status; + Return transResult = connection->fetch( + transactionId, bufferId, + [&status, &handle] + (ResultStatus outStatus, Buffer outBuffer) { + status = outStatus; + if (status == ResultStatus::OK) { + *handle = native_handle_clone( + outBuffer.buffer.getNativeHandle()); + } + }); + return transResult.isOk() ? status : ResultStatus::CRITICAL_ERROR; +} + + +BufferPoolClient::BufferPoolClient(const sp &accessor, + const sp &observer) { + mImpl = std::make_shared(accessor, observer); +} + +BufferPoolClient::BufferPoolClient(const sp &accessor, + const sp &observer) { + mImpl = std::make_shared(accessor, observer); +} + +BufferPoolClient::~BufferPoolClient() { + // TODO: how to handle orphaned buffers? +} + +bool BufferPoolClient::isValid() { + return mImpl && mImpl->isValid(); +} + +bool BufferPoolClient::isLocal() { + return mImpl && mImpl->isLocal(); +} + +bool BufferPoolClient::isActive(int64_t *lastTransactionUs, bool clearCache) { + if (!isValid()) { + *lastTransactionUs = 0; + return false; + } + return mImpl->isActive(lastTransactionUs, clearCache); +} + +ConnectionId BufferPoolClient::getConnectionId() { + if (isValid()) { + return mImpl->getConnectionId(); + } + return -1; +} + +ResultStatus BufferPoolClient::getAccessor(sp *accessor) { + if (isValid()) { + *accessor = mImpl->getAccessor(); + return ResultStatus::OK; + } + return ResultStatus::CRITICAL_ERROR; +} + +void BufferPoolClient::receiveInvalidation(uint32_t msgId) { + ALOGV("bufferpool2 client recv inv %u", msgId); + if (isValid()) { + mImpl->receiveInvalidation(msgId); + } +} + +ResultStatus BufferPoolClient::flush() { + if (isValid()) { + return mImpl->flush(); + } + return ResultStatus::CRITICAL_ERROR; +} + +ResultStatus BufferPoolClient::allocate( + const std::vector ¶ms, + native_handle_t **handle, + std::shared_ptr *buffer) { + if (isValid()) { + return mImpl->allocate(params, handle, buffer); + } + return ResultStatus::CRITICAL_ERROR; +} + +ResultStatus BufferPoolClient::receive( + TransactionId transactionId, BufferId bufferId, int64_t timestampUs, + native_handle_t **handle, std::shared_ptr *buffer) { + if (isValid()) { + return mImpl->receive(transactionId, bufferId, timestampUs, handle, buffer); + } + return ResultStatus::CRITICAL_ERROR; +} + +ResultStatus BufferPoolClient::postSend( + ConnectionId receiverId, + const std::shared_ptr &buffer, + TransactionId *transactionId, + int64_t *timestampUs) { + if (isValid()) { + bool result = mImpl->postSend( + buffer->mId, receiverId, transactionId, timestampUs); + return result ? ResultStatus::OK : ResultStatus::CRITICAL_ERROR; + } + return ResultStatus::CRITICAL_ERROR; +} + +} // namespace implementation +} // namespace V2_0 +} // namespace bufferpool +} // namespace media +} // namespace hardware +} // namespace android diff --git a/media/bufferpool/aidl/default/BufferPoolClient.h b/media/bufferpool/aidl/default/BufferPoolClient.h new file mode 100644 index 0000000000..e8d9ae6703 --- /dev/null +++ b/media/bufferpool/aidl/default/BufferPoolClient.h @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2018 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. + */ + +#ifndef ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_BUFFERPOOLCLIENT_H +#define ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_BUFFERPOOLCLIENT_H + +#include +#include +#include +#include +#include +#include +#include "Accessor.h" + +namespace android { +namespace hardware { +namespace media { +namespace bufferpool { +namespace V2_0 { +namespace implementation { + +using ::android::hardware::media::bufferpool::V2_0::IAccessor; +using ::android::hardware::media::bufferpool::V2_0::IConnection; +using ::android::hardware::media::bufferpool::V2_0::IObserver; +using ::android::hardware::media::bufferpool::V2_0::ResultStatus; +using ::android::sp; + +/** + * A buffer pool client for a buffer pool. For a specific buffer pool, at most + * one buffer pool client exists per process. This class will not be exposed + * outside. A buffer pool client will be used via ClientManager. + */ +class BufferPoolClient { +public: + /** + * Creates a buffer pool client from a local buffer pool + * (via ClientManager#create). + */ + explicit BufferPoolClient(const sp &accessor, + const sp &observer); + + /** + * Creates a buffer pool client from a remote buffer pool + * (via ClientManager#registerSender). + * Note: A buffer pool client created with remote buffer pool cannot + * allocate a buffer. + */ + explicit BufferPoolClient(const sp &accessor, + const sp &observer); + + /** Destructs a buffer pool client. */ + ~BufferPoolClient(); + +private: + bool isValid(); + + bool isLocal(); + + bool isActive(int64_t *lastTransactionUs, bool clearCache); + + ConnectionId getConnectionId(); + + ResultStatus getAccessor(sp *accessor); + + void receiveInvalidation(uint32_t msgId); + + ResultStatus flush(); + + ResultStatus allocate(const std::vector ¶ms, + native_handle_t **handle, + std::shared_ptr *buffer); + + ResultStatus receive(TransactionId transactionId, + BufferId bufferId, + int64_t timestampUs, + native_handle_t **handle, + std::shared_ptr *buffer); + + ResultStatus postSend(ConnectionId receiver, + const std::shared_ptr &buffer, + TransactionId *transactionId, + int64_t *timestampUs); + + class Impl; + std::shared_ptr mImpl; + + friend struct ClientManager; + friend struct Observer; +}; + +} // namespace implementation +} // namespace V2_0 +} // namespace bufferpool +} // namespace media +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_BUFFERPOOLCLIENT_H diff --git a/media/bufferpool/aidl/default/BufferStatus.cpp b/media/bufferpool/aidl/default/BufferStatus.cpp new file mode 100644 index 0000000000..693726086e --- /dev/null +++ b/media/bufferpool/aidl/default/BufferStatus.cpp @@ -0,0 +1,304 @@ +/* + * Copyright (C) 2018 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. + */ + +#define LOG_TAG "BufferPoolStatus" +//#define LOG_NDEBUG 0 + +#include +#include +#include "BufferStatus.h" + +namespace android { +namespace hardware { +namespace media { +namespace bufferpool { +namespace V2_0 { +namespace implementation { + +int64_t getTimestampNow() { + int64_t stamp; + struct timespec ts; + // TODO: CLOCK_MONOTONIC_COARSE? + clock_gettime(CLOCK_MONOTONIC, &ts); + stamp = ts.tv_nsec / 1000; + stamp += (ts.tv_sec * 1000000LL); + return stamp; +} + +bool isMessageLater(uint32_t curMsgId, uint32_t prevMsgId) { + return curMsgId != prevMsgId && curMsgId - prevMsgId < prevMsgId - curMsgId; +} + +bool isBufferInRange(BufferId from, BufferId to, BufferId bufferId) { + if (from < to) { + return from <= bufferId && bufferId < to; + } else { // wrap happens + return from <= bufferId || bufferId < to; + } +} + +static constexpr int kNumElementsInQueue = 1024*16; +static constexpr int kMinElementsToSyncInQueue = 128; + +ResultStatus BufferStatusObserver::open( + ConnectionId id, const StatusDescriptor** fmqDescPtr) { + if (mBufferStatusQueues.find(id) != mBufferStatusQueues.end()) { + // TODO: id collision log? + return ResultStatus::CRITICAL_ERROR; + } + std::unique_ptr queue = + std::make_unique(kNumElementsInQueue); + if (!queue || queue->isValid() == false) { + *fmqDescPtr = nullptr; + return ResultStatus::NO_MEMORY; + } else { + *fmqDescPtr = queue->getDesc(); + } + auto result = mBufferStatusQueues.insert( + std::make_pair(id, std::move(queue))); + if (!result.second) { + *fmqDescPtr = nullptr; + return ResultStatus::NO_MEMORY; + } + return ResultStatus::OK; +} + +ResultStatus BufferStatusObserver::close(ConnectionId id) { + if (mBufferStatusQueues.find(id) == mBufferStatusQueues.end()) { + return ResultStatus::CRITICAL_ERROR; + } + mBufferStatusQueues.erase(id); + return ResultStatus::OK; +} + +void BufferStatusObserver::getBufferStatusChanges(std::vector &messages) { + for (auto it = mBufferStatusQueues.begin(); it != mBufferStatusQueues.end(); ++it) { + BufferStatusMessage message; + size_t avail = it->second->availableToRead(); + while (avail > 0) { + if (!it->second->read(&message, 1)) { + // Since avaliable # of reads are already confirmed, + // this should not happen. + // TODO: error handling (spurious client?) + ALOGW("FMQ message cannot be read from %lld", (long long)it->first); + return; + } + message.connectionId = it->first; + messages.push_back(message); + --avail; + } + } +} + +BufferStatusChannel::BufferStatusChannel( + const StatusDescriptor &fmqDesc) { + std::unique_ptr queue = + std::make_unique(fmqDesc); + if (!queue || queue->isValid() == false) { + mValid = false; + return; + } + mValid = true; + mBufferStatusQueue = std::move(queue); +} + +bool BufferStatusChannel::isValid() { + return mValid; +} + +bool BufferStatusChannel::needsSync() { + if (mValid) { + size_t avail = mBufferStatusQueue->availableToWrite(); + return avail + kMinElementsToSyncInQueue < kNumElementsInQueue; + } + return false; +} + +void BufferStatusChannel::postBufferRelease( + ConnectionId connectionId, + std::list &pending, std::list &posted) { + if (mValid && pending.size() > 0) { + size_t avail = mBufferStatusQueue->availableToWrite(); + avail = std::min(avail, pending.size()); + BufferStatusMessage message; + for (size_t i = 0 ; i < avail; ++i) { + BufferId id = pending.front(); + message.newStatus = BufferStatus::NOT_USED; + message.bufferId = id; + message.connectionId = connectionId; + if (!mBufferStatusQueue->write(&message, 1)) { + // Since avaliable # of writes are already confirmed, + // this should not happen. + // TODO: error handing? + ALOGW("FMQ message cannot be sent from %lld", (long long)connectionId); + return; + } + pending.pop_front(); + posted.push_back(id); + } + } +} + +void BufferStatusChannel::postBufferInvalidateAck( + ConnectionId connectionId, + uint32_t invalidateId, + bool *invalidated) { + if (mValid && !*invalidated) { + size_t avail = mBufferStatusQueue->availableToWrite(); + if (avail > 0) { + BufferStatusMessage message; + message.newStatus = BufferStatus::INVALIDATION_ACK; + message.bufferId = invalidateId; + message.connectionId = connectionId; + if (!mBufferStatusQueue->write(&message, 1)) { + // Since avaliable # of writes are already confirmed, + // this should not happen. + // TODO: error handing? + ALOGW("FMQ message cannot be sent from %lld", (long long)connectionId); + return; + } + *invalidated = true; + } + } +} + +bool BufferStatusChannel::postBufferStatusMessage( + TransactionId transactionId, BufferId bufferId, + BufferStatus status, ConnectionId connectionId, ConnectionId targetId, + std::list &pending, std::list &posted) { + if (mValid) { + size_t avail = mBufferStatusQueue->availableToWrite(); + size_t numPending = pending.size(); + if (avail >= numPending + 1) { + BufferStatusMessage release, message; + for (size_t i = 0; i < numPending; ++i) { + BufferId id = pending.front(); + release.newStatus = BufferStatus::NOT_USED; + release.bufferId = id; + release.connectionId = connectionId; + if (!mBufferStatusQueue->write(&release, 1)) { + // Since avaliable # of writes are already confirmed, + // this should not happen. + // TODO: error handling? + ALOGW("FMQ message cannot be sent from %lld", (long long)connectionId); + return false; + } + pending.pop_front(); + posted.push_back(id); + } + message.transactionId = transactionId; + message.bufferId = bufferId; + message.newStatus = status; + message.connectionId = connectionId; + message.targetConnectionId = targetId; + // TODO : timesatamp + message.timestampUs = 0; + if (!mBufferStatusQueue->write(&message, 1)) { + // Since avaliable # of writes are already confirmed, + // this should not happen. + ALOGW("FMQ message cannot be sent from %lld", (long long)connectionId); + return false; + } + return true; + } + } + return false; +} + +BufferInvalidationListener::BufferInvalidationListener( + const InvalidationDescriptor &fmqDesc) { + std::unique_ptr queue = + std::make_unique(fmqDesc); + if (!queue || queue->isValid() == false) { + mValid = false; + return; + } + mValid = true; + mBufferInvalidationQueue = std::move(queue); + // drain previous messages + size_t avail = std::min( + mBufferInvalidationQueue->availableToRead(), (size_t) kNumElementsInQueue); + std::vector temp(avail); + if (avail > 0) { + mBufferInvalidationQueue->read(temp.data(), avail); + } +} + +void BufferInvalidationListener::getInvalidations( + std::vector &messages) { + // Try twice in case of overflow. + // TODO: handling overflow though it may not happen. + for (int i = 0; i < 2; ++i) { + size_t avail = std::min( + mBufferInvalidationQueue->availableToRead(), (size_t) kNumElementsInQueue); + if (avail > 0) { + std::vector temp(avail); + if (mBufferInvalidationQueue->read(temp.data(), avail)) { + messages.reserve(messages.size() + avail); + for (auto it = temp.begin(); it != temp.end(); ++it) { + messages.push_back(*it); + } + break; + } + } else { + return; + } + } +} + +bool BufferInvalidationListener::isValid() { + return mValid; +} + +BufferInvalidationChannel::BufferInvalidationChannel() + : mValid(true), + mBufferInvalidationQueue( + std::make_unique(kNumElementsInQueue, true)) { + if (!mBufferInvalidationQueue || mBufferInvalidationQueue->isValid() == false) { + mValid = false; + } +} + +bool BufferInvalidationChannel::isValid() { + return mValid; +} + +void BufferInvalidationChannel::getDesc(const InvalidationDescriptor **fmqDescPtr) { + if (mValid) { + *fmqDescPtr = mBufferInvalidationQueue->getDesc(); + } else { + *fmqDescPtr = nullptr; + } +} + +void BufferInvalidationChannel::postInvalidation( + uint32_t msgId, BufferId fromId, BufferId toId) { + BufferInvalidationMessage message; + + message.messageId = msgId; + message.fromBufferId = fromId; + message.toBufferId = toId; + // TODO: handle failure (it does not happen normally.) + mBufferInvalidationQueue->write(&message); +} + +} // namespace implementation +} // namespace V2_0 +} // namespace bufferpool +} // namespace media +} // namespace hardware +} // namespace android + diff --git a/media/bufferpool/aidl/default/BufferStatus.h b/media/bufferpool/aidl/default/BufferStatus.h new file mode 100644 index 0000000000..fa658382a3 --- /dev/null +++ b/media/bufferpool/aidl/default/BufferStatus.h @@ -0,0 +1,230 @@ +/* + * Copyright (C) 2018 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. + */ + +#ifndef ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_BUFFERSTATUS_H +#define ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_BUFFERSTATUS_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace media { +namespace bufferpool { +namespace V2_0 { +namespace implementation { + +/** Returns monotonic timestamp in Us since fixed point in time. */ +int64_t getTimestampNow(); + +bool isMessageLater(uint32_t curMsgId, uint32_t prevMsgId); + +bool isBufferInRange(BufferId from, BufferId to, BufferId bufferId); + +/** + * A collection of buffer status message FMQ for a buffer pool. buffer + * ownership/status change messages are sent via the FMQs from the clients. + */ +class BufferStatusObserver { +private: + std::map> + mBufferStatusQueues; + +public: + /** Creates a buffer status message FMQ for the specified + * connection(client). + * + * @param connectionId connection Id of the specified client. + * @param fmqDescPtr double ptr of created FMQ's descriptor. + * + * @return OK if FMQ is created successfully. + * NO_MEMORY when there is no memory. + * CRITICAL_ERROR otherwise. + */ + ResultStatus open(ConnectionId id, const StatusDescriptor** fmqDescPtr); + + /** Closes a buffer status message FMQ for the specified + * connection(client). + * + * @param connectionId connection Id of the specified client. + * + * @return OK if the specified connection is closed successfully. + * CRITICAL_ERROR otherwise. + */ + ResultStatus close(ConnectionId id); + + /** Retrieves all pending FMQ buffer status messages from clients. + * + * @param messages retrieved pending messages. + */ + void getBufferStatusChanges(std::vector &messages); +}; + +/** + * A buffer status message FMQ for a buffer pool client. Buffer ownership/status + * change messages are sent via the fmq to the buffer pool. + */ +class BufferStatusChannel { +private: + bool mValid; + std::unique_ptr mBufferStatusQueue; + +public: + /** + * Connects to a buffer status message FMQ from a descriptor of + * the created FMQ. + * + * @param fmqDesc Descriptor of the created FMQ. + */ + BufferStatusChannel(const StatusDescriptor &fmqDesc); + + /** Returns whether the FMQ is connected successfully. */ + bool isValid(); + + /** Returns whether the FMQ needs to be synced from the buffer pool */ + bool needsSync(); + + /** + * Posts a buffer release message to the buffer pool. + * + * @param connectionId connection Id of the client. + * @param pending currently pending buffer release messages. + * @param posted posted buffer release messages. + */ + void postBufferRelease( + ConnectionId connectionId, + std::list &pending, std::list &posted); + + /** + * Posts a buffer status message regarding the specified buffer + * transfer transaction. + * + * @param transactionId Id of the specified transaction. + * @param bufferId buffer Id of the specified transaction. + * @param status new status of the buffer. + * @param connectionId connection Id of the client. + * @param targetId connection Id of the receiver(only when the sender + * posts a status message). + * @param pending currently pending buffer release messages. + * @param posted posted buffer release messages. + * + * @return {@code true} when the specified message is posted, + * {@code false} otherwise. + */ + bool postBufferStatusMessage( + TransactionId transactionId, + BufferId bufferId, + BufferStatus status, + ConnectionId connectionId, + ConnectionId targetId, + std::list &pending, std::list &posted); + + /** + * Posts a buffer invaliadation messge to the buffer pool. + * + * @param connectionId connection Id of the client. + * @param invalidateId invalidation ack to the buffer pool. + * if invalidation id is zero, the ack will not be + * posted. + * @param invalidated sets {@code true} only when the invalidation ack is + * posted. + */ + void postBufferInvalidateAck( + ConnectionId connectionId, + uint32_t invalidateId, + bool *invalidated); +}; + +/** + * A buffer invalidation FMQ for a buffer pool client. Buffer invalidation + * messages are received via the fmq from the buffer pool. Buffer invalidation + * messages are handled as soon as possible. + */ +class BufferInvalidationListener { +private: + bool mValid; + std::unique_ptr mBufferInvalidationQueue; + +public: + /** + * Connects to a buffer invalidation FMQ from a descriptor of the created FMQ. + * + * @param fmqDesc Descriptor of the created FMQ. + */ + BufferInvalidationListener(const InvalidationDescriptor &fmqDesc); + + /** Retrieves all pending buffer invalidation messages from the buffer pool. + * + * @param messages retrieved pending messages. + */ + void getInvalidations(std::vector &messages); + + /** Returns whether the FMQ is connected succesfully. */ + bool isValid(); +}; + +/** + * A buffer invalidation FMQ for a buffer pool. A buffer pool will send buffer + * invalidation messages to the clients via the FMQ. The FMQ is shared among + * buffer pool clients. + */ +class BufferInvalidationChannel { +private: + bool mValid; + std::unique_ptr mBufferInvalidationQueue; + +public: + /** + * Creates a buffer invalidation FMQ for a buffer pool. + */ + BufferInvalidationChannel(); + + /** Returns whether the FMQ is connected succesfully. */ + bool isValid(); + + /** + * Retrieves the descriptor of a buffer invalidation FMQ. the descriptor may + * be passed to the client for buffer invalidation handling. + * + * @param fmqDescPtr double ptr of created FMQ's descriptor. + */ + void getDesc(const InvalidationDescriptor **fmqDescPtr); + + /** Posts a buffer invalidation for invalidated buffers. + * + * @param msgId Invalidation message id which is used when clients send + * acks back via BufferStatusMessage + * @param fromId The start bufferid of the invalidated buffers(inclusive) + * @param toId The end bufferId of the invalidated buffers(inclusive) + */ + void postInvalidation(uint32_t msgId, BufferId fromId, BufferId toId); +}; + +} // namespace implementation +} // namespace V2_0 +} // namespace bufferpool +} // namespace media +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_BUFFERSTATUS_H diff --git a/media/bufferpool/aidl/default/ClientManager.cpp b/media/bufferpool/aidl/default/ClientManager.cpp new file mode 100644 index 0000000000..54a20b9a25 --- /dev/null +++ b/media/bufferpool/aidl/default/ClientManager.cpp @@ -0,0 +1,569 @@ +/* + * Copyright (C) 2018 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. + */ +#define LOG_TAG "BufferPoolManager" +//#define LOG_NDEBUG 0 + +#include +#include +#include +#include +#include +#include +#include "BufferPoolClient.h" +#include "Observer.h" +#include "Accessor.h" + +namespace android { +namespace hardware { +namespace media { +namespace bufferpool { +namespace V2_0 { +namespace implementation { + +static constexpr int64_t kRegisterTimeoutUs = 500000; // 0.5 sec +static constexpr int64_t kCleanUpDurationUs = 1000000; // TODO: 1 sec tune +static constexpr int64_t kClientTimeoutUs = 5000000; // TODO: 5 secs tune + +/** + * The holder of the cookie of remote IClientManager. + * The cookie is process locally unique for each IClientManager. + * (The cookie is used to notify death of clients to bufferpool process.) + */ +class ClientManagerCookieHolder { +public: + /** + * Creates a cookie holder for remote IClientManager(s). + */ + ClientManagerCookieHolder(); + + /** + * Gets a cookie for a remote IClientManager. + * + * @param manager the specified remote IClientManager. + * @param added true when the specified remote IClientManager is added + * newly, false otherwise. + * + * @return the process locally unique cookie for the specified IClientManager. + */ + uint64_t getCookie(const sp &manager, bool *added); + +private: + uint64_t mSeqId; + std::mutex mLock; + std::list, uint64_t>> mManagers; +}; + +ClientManagerCookieHolder::ClientManagerCookieHolder() : mSeqId(0){} + +uint64_t ClientManagerCookieHolder::getCookie( + const sp &manager, + bool *added) { + std::lock_guard lock(mLock); + for (auto it = mManagers.begin(); it != mManagers.end();) { + const sp key = it->first.promote(); + if (key) { + if (interfacesEqual(key, manager)) { + *added = false; + return it->second; + } + ++it; + } else { + it = mManagers.erase(it); + } + } + uint64_t id = mSeqId++; + *added = true; + mManagers.push_back(std::make_pair(manager, id)); + return id; +} + +class ClientManager::Impl { +public: + Impl(); + + // BnRegisterSender + ResultStatus registerSender(const sp &accessor, + ConnectionId *pConnectionId); + + // BpRegisterSender + ResultStatus registerSender(const sp &receiver, + ConnectionId senderId, + ConnectionId *receiverId); + + ResultStatus create(const std::shared_ptr &allocator, + ConnectionId *pConnectionId); + + ResultStatus close(ConnectionId connectionId); + + ResultStatus flush(ConnectionId connectionId); + + ResultStatus allocate(ConnectionId connectionId, + const std::vector ¶ms, + native_handle_t **handle, + std::shared_ptr *buffer); + + ResultStatus receive(ConnectionId connectionId, + TransactionId transactionId, + BufferId bufferId, + int64_t timestampUs, + native_handle_t **handle, + std::shared_ptr *buffer); + + ResultStatus postSend(ConnectionId receiverId, + const std::shared_ptr &buffer, + TransactionId *transactionId, + int64_t *timestampUs); + + ResultStatus getAccessor(ConnectionId connectionId, + sp *accessor); + + void cleanUp(bool clearCache = false); + +private: + // In order to prevent deadlock between multiple locks, + // always lock ClientCache.lock before locking ActiveClients.lock. + struct ClientCache { + // This lock is held for brief duration. + // Blocking operation is not performed while holding the lock. + std::mutex mMutex; + std::list, const std::weak_ptr>> + mClients; + std::condition_variable mConnectCv; + bool mConnecting; + int64_t mLastCleanUpUs; + + ClientCache() : mConnecting(false), mLastCleanUpUs(getTimestampNow()) {} + } mCache; + + // Active clients which can be retrieved via ConnectionId + struct ActiveClients { + // This lock is held for brief duration. + // Blocking operation is not performed holding the lock. + std::mutex mMutex; + std::map> + mClients; + } mActive; + + sp mObserver; + + ClientManagerCookieHolder mRemoteClientCookies; +}; + +ClientManager::Impl::Impl() + : mObserver(new Observer()) {} + +ResultStatus ClientManager::Impl::registerSender( + const sp &accessor, ConnectionId *pConnectionId) { + cleanUp(); + int64_t timeoutUs = getTimestampNow() + kRegisterTimeoutUs; + do { + std::unique_lock lock(mCache.mMutex); + for (auto it = mCache.mClients.begin(); it != mCache.mClients.end(); ++it) { + sp sAccessor = it->first.promote(); + if (sAccessor && interfacesEqual(sAccessor, accessor)) { + const std::shared_ptr client = it->second.lock(); + if (client) { + std::lock_guard lock(mActive.mMutex); + *pConnectionId = client->getConnectionId(); + if (mActive.mClients.find(*pConnectionId) != mActive.mClients.end()) { + ALOGV("register existing connection %lld", (long long)*pConnectionId); + return ResultStatus::ALREADY_EXISTS; + } + } + mCache.mClients.erase(it); + break; + } + } + if (!mCache.mConnecting) { + mCache.mConnecting = true; + lock.unlock(); + ResultStatus result = ResultStatus::OK; + const std::shared_ptr client = + std::make_shared(accessor, mObserver); + lock.lock(); + if (!client) { + result = ResultStatus::NO_MEMORY; + } else if (!client->isValid()) { + result = ResultStatus::CRITICAL_ERROR; + } + if (result == ResultStatus::OK) { + // TODO: handle insert fail. (malloc fail) + const std::weak_ptr wclient = client; + mCache.mClients.push_back(std::make_pair(accessor, wclient)); + ConnectionId conId = client->getConnectionId(); + mObserver->addClient(conId, wclient); + { + std::lock_guard lock(mActive.mMutex); + mActive.mClients.insert(std::make_pair(conId, client)); + } + *pConnectionId = conId; + ALOGV("register new connection %lld", (long long)*pConnectionId); + } + mCache.mConnecting = false; + lock.unlock(); + mCache.mConnectCv.notify_all(); + return result; + } + mCache.mConnectCv.wait_for( + lock, std::chrono::microseconds(kRegisterTimeoutUs)); + } while (getTimestampNow() < timeoutUs); + // TODO: return timeout error + return ResultStatus::CRITICAL_ERROR; +} + +ResultStatus ClientManager::Impl::registerSender( + const sp &receiver, + ConnectionId senderId, + ConnectionId *receiverId) { + sp accessor; + bool local = false; + { + std::lock_guard lock(mActive.mMutex); + auto it = mActive.mClients.find(senderId); + if (it == mActive.mClients.end()) { + return ResultStatus::NOT_FOUND; + } + it->second->getAccessor(&accessor); + local = it->second->isLocal(); + } + ResultStatus rs = ResultStatus::CRITICAL_ERROR; + if (accessor) { + Return transResult = receiver->registerSender( + accessor, + [&rs, receiverId]( + ResultStatus status, + int64_t connectionId) { + rs = status; + *receiverId = connectionId; + }); + if (!transResult.isOk()) { + return ResultStatus::CRITICAL_ERROR; + } else if (local && rs == ResultStatus::OK) { + sp recipient = Accessor::getConnectionDeathRecipient(); + if (recipient) { + ALOGV("client death recipient registered %lld", (long long)*receiverId); + bool added; + uint64_t cookie = mRemoteClientCookies.getCookie(receiver, &added); + recipient->addCookieToConnection(cookie, *receiverId); + if (added) { + Return transResult = receiver->linkToDeath(recipient, cookie); + } + } + } + } + return rs; +} + +ResultStatus ClientManager::Impl::create( + const std::shared_ptr &allocator, + ConnectionId *pConnectionId) { + const sp accessor = new Accessor(allocator); + if (!accessor || !accessor->isValid()) { + return ResultStatus::CRITICAL_ERROR; + } + // TODO: observer is local. use direct call instead of hidl call. + std::shared_ptr client = + std::make_shared(accessor, mObserver); + if (!client || !client->isValid()) { + return ResultStatus::CRITICAL_ERROR; + } + // Since a new bufferpool is created, evict memories which are used by + // existing bufferpools and clients. + cleanUp(true); + { + // TODO: handle insert fail. (malloc fail) + std::lock_guard lock(mCache.mMutex); + const std::weak_ptr wclient = client; + mCache.mClients.push_back(std::make_pair(accessor, wclient)); + ConnectionId conId = client->getConnectionId(); + mObserver->addClient(conId, wclient); + { + std::lock_guard lock(mActive.mMutex); + mActive.mClients.insert(std::make_pair(conId, client)); + } + *pConnectionId = conId; + ALOGV("create new connection %lld", (long long)*pConnectionId); + } + return ResultStatus::OK; +} + +ResultStatus ClientManager::Impl::close(ConnectionId connectionId) { + std::unique_lock lock1(mCache.mMutex); + std::unique_lock lock2(mActive.mMutex); + auto it = mActive.mClients.find(connectionId); + if (it != mActive.mClients.end()) { + sp accessor; + it->second->getAccessor(&accessor); + std::shared_ptr closing = it->second; + mActive.mClients.erase(connectionId); + for (auto cit = mCache.mClients.begin(); cit != mCache.mClients.end();) { + // clean up dead client caches + sp cAccessor = cit->first.promote(); + if (!cAccessor || (accessor && interfacesEqual(cAccessor, accessor))) { + cit = mCache.mClients.erase(cit); + } else { + cit++; + } + } + lock2.unlock(); + lock1.unlock(); + closing->flush(); + return ResultStatus::OK; + } + return ResultStatus::NOT_FOUND; +} + +ResultStatus ClientManager::Impl::flush(ConnectionId connectionId) { + std::shared_ptr client; + { + std::lock_guard lock(mActive.mMutex); + auto it = mActive.mClients.find(connectionId); + if (it == mActive.mClients.end()) { + return ResultStatus::NOT_FOUND; + } + client = it->second; + } + return client->flush(); +} + +ResultStatus ClientManager::Impl::allocate( + ConnectionId connectionId, const std::vector ¶ms, + native_handle_t **handle, std::shared_ptr *buffer) { + std::shared_ptr client; + { + std::lock_guard lock(mActive.mMutex); + auto it = mActive.mClients.find(connectionId); + if (it == mActive.mClients.end()) { + return ResultStatus::NOT_FOUND; + } + client = it->second; + } +#ifdef BUFFERPOOL_CLONE_HANDLES + native_handle_t *origHandle; + ResultStatus res = client->allocate(params, &origHandle, buffer); + if (res != ResultStatus::OK) { + return res; + } + *handle = native_handle_clone(origHandle); + if (handle == NULL) { + buffer->reset(); + return ResultStatus::NO_MEMORY; + } + return ResultStatus::OK; +#else + return client->allocate(params, handle, buffer); +#endif +} + +ResultStatus ClientManager::Impl::receive( + ConnectionId connectionId, TransactionId transactionId, + BufferId bufferId, int64_t timestampUs, + native_handle_t **handle, std::shared_ptr *buffer) { + std::shared_ptr client; + { + std::lock_guard lock(mActive.mMutex); + auto it = mActive.mClients.find(connectionId); + if (it == mActive.mClients.end()) { + return ResultStatus::NOT_FOUND; + } + client = it->second; + } +#ifdef BUFFERPOOL_CLONE_HANDLES + native_handle_t *origHandle; + ResultStatus res = client->receive( + transactionId, bufferId, timestampUs, &origHandle, buffer); + if (res != ResultStatus::OK) { + return res; + } + *handle = native_handle_clone(origHandle); + if (handle == NULL) { + buffer->reset(); + return ResultStatus::NO_MEMORY; + } + return ResultStatus::OK; +#else + return client->receive(transactionId, bufferId, timestampUs, handle, buffer); +#endif +} + +ResultStatus ClientManager::Impl::postSend( + ConnectionId receiverId, const std::shared_ptr &buffer, + TransactionId *transactionId, int64_t *timestampUs) { + ConnectionId connectionId = buffer->mConnectionId; + std::shared_ptr client; + { + std::lock_guard lock(mActive.mMutex); + auto it = mActive.mClients.find(connectionId); + if (it == mActive.mClients.end()) { + return ResultStatus::NOT_FOUND; + } + client = it->second; + } + return client->postSend(receiverId, buffer, transactionId, timestampUs); +} + +ResultStatus ClientManager::Impl::getAccessor( + ConnectionId connectionId, sp *accessor) { + std::shared_ptr client; + { + std::lock_guard lock(mActive.mMutex); + auto it = mActive.mClients.find(connectionId); + if (it == mActive.mClients.end()) { + return ResultStatus::NOT_FOUND; + } + client = it->second; + } + return client->getAccessor(accessor); +} + +void ClientManager::Impl::cleanUp(bool clearCache) { + int64_t now = getTimestampNow(); + int64_t lastTransactionUs; + std::lock_guard lock1(mCache.mMutex); + if (clearCache || mCache.mLastCleanUpUs + kCleanUpDurationUs < now) { + std::lock_guard lock2(mActive.mMutex); + int cleaned = 0; + for (auto it = mActive.mClients.begin(); it != mActive.mClients.end();) { + if (!it->second->isActive(&lastTransactionUs, clearCache)) { + if (lastTransactionUs + kClientTimeoutUs < now) { + sp accessor; + it->second->getAccessor(&accessor); + it = mActive.mClients.erase(it); + ++cleaned; + continue; + } + } + ++it; + } + for (auto cit = mCache.mClients.begin(); cit != mCache.mClients.end();) { + // clean up dead client caches + sp cAccessor = cit->first.promote(); + if (!cAccessor) { + cit = mCache.mClients.erase(cit); + } else { + ++cit; + } + } + ALOGV("# of cleaned connections: %d", cleaned); + mCache.mLastCleanUpUs = now; + } +} + +// Methods from ::android::hardware::media::bufferpool::V2_0::IClientManager follow. +Return ClientManager::registerSender(const sp<::android::hardware::media::bufferpool::V2_0::IAccessor>& bufferPool, registerSender_cb _hidl_cb) { + if (mImpl) { + ConnectionId connectionId = -1; + ResultStatus status = mImpl->registerSender(bufferPool, &connectionId); + _hidl_cb(status, connectionId); + } else { + _hidl_cb(ResultStatus::CRITICAL_ERROR, -1); + } + return Void(); +} + +// Methods for local use. +sp ClientManager::sInstance; +std::mutex ClientManager::sInstanceLock; + +sp ClientManager::getInstance() { + std::lock_guard lock(sInstanceLock); + if (!sInstance) { + sInstance = new ClientManager(); + } + Accessor::createInvalidator(); + Accessor::createEvictor(); + return sInstance; +} + +ClientManager::ClientManager() : mImpl(new Impl()) {} + +ClientManager::~ClientManager() { +} + +ResultStatus ClientManager::create( + const std::shared_ptr &allocator, + ConnectionId *pConnectionId) { + if (mImpl) { + return mImpl->create(allocator, pConnectionId); + } + return ResultStatus::CRITICAL_ERROR; +} + +ResultStatus ClientManager::registerSender( + const sp &receiver, + ConnectionId senderId, + ConnectionId *receiverId) { + if (mImpl) { + return mImpl->registerSender(receiver, senderId, receiverId); + } + return ResultStatus::CRITICAL_ERROR; +} + +ResultStatus ClientManager::close(ConnectionId connectionId) { + if (mImpl) { + return mImpl->close(connectionId); + } + return ResultStatus::CRITICAL_ERROR; +} + +ResultStatus ClientManager::flush(ConnectionId connectionId) { + if (mImpl) { + return mImpl->flush(connectionId); + } + return ResultStatus::CRITICAL_ERROR; +} + +ResultStatus ClientManager::allocate( + ConnectionId connectionId, const std::vector ¶ms, + native_handle_t **handle, std::shared_ptr *buffer) { + if (mImpl) { + return mImpl->allocate(connectionId, params, handle, buffer); + } + return ResultStatus::CRITICAL_ERROR; +} + +ResultStatus ClientManager::receive( + ConnectionId connectionId, TransactionId transactionId, + BufferId bufferId, int64_t timestampUs, + native_handle_t **handle, std::shared_ptr *buffer) { + if (mImpl) { + return mImpl->receive(connectionId, transactionId, bufferId, + timestampUs, handle, buffer); + } + return ResultStatus::CRITICAL_ERROR; +} + +ResultStatus ClientManager::postSend( + ConnectionId receiverId, const std::shared_ptr &buffer, + TransactionId *transactionId, int64_t* timestampUs) { + if (mImpl && buffer) { + return mImpl->postSend(receiverId, buffer, transactionId, timestampUs); + } + return ResultStatus::CRITICAL_ERROR; +} + +void ClientManager::cleanUp() { + if (mImpl) { + mImpl->cleanUp(true); + } +} + +} // namespace implementation +} // namespace V2_0 +} // namespace bufferpool +} // namespace media +} // namespace hardware +} // namespace android diff --git a/media/bufferpool/aidl/default/Connection.cpp b/media/bufferpool/aidl/default/Connection.cpp new file mode 100644 index 0000000000..57d0c7eb63 --- /dev/null +++ b/media/bufferpool/aidl/default/Connection.cpp @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2018 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. + */ + +#include "Connection.h" + +namespace android { +namespace hardware { +namespace media { +namespace bufferpool { +namespace V2_0 { +namespace implementation { + +// Methods from ::android::hardware::media::bufferpool::V2_0::IConnection follow. +Return Connection::fetch(uint64_t transactionId, uint32_t bufferId, fetch_cb _hidl_cb) { + ResultStatus status = ResultStatus::CRITICAL_ERROR; + if (mInitialized && mAccessor) { + if (bufferId != SYNC_BUFFERID) { + const native_handle_t *handle = nullptr; + status = mAccessor->fetch( + mConnectionId, transactionId, bufferId, &handle); + if (status == ResultStatus::OK) { + Buffer buffer = {}; + buffer.id = bufferId; + buffer.buffer = handle; + _hidl_cb(status, buffer); + return Void(); + } + } else { + mAccessor->cleanUp(false); + } + } + + Buffer buffer = {}; + buffer.id = 0; + buffer.buffer = nullptr; + + _hidl_cb(status, buffer); + return Void(); +} + +Connection::Connection() : mInitialized(false), mConnectionId(-1LL) {} + +Connection::~Connection() { + if (mInitialized && mAccessor) { + mAccessor->close(mConnectionId); + } +} + +void Connection::initialize( + const sp& accessor, ConnectionId connectionId) { + if (!mInitialized) { + mAccessor = accessor; + mConnectionId = connectionId; + mInitialized = true; + } +} + +ResultStatus Connection::flush() { + if (mInitialized && mAccessor) { + return mAccessor->flush(); + } + return ResultStatus::CRITICAL_ERROR; +} + +ResultStatus Connection::allocate( + const std::vector ¶ms, BufferId *bufferId, + const native_handle_t **handle) { + if (mInitialized && mAccessor) { + return mAccessor->allocate(mConnectionId, params, bufferId, handle); + } + return ResultStatus::CRITICAL_ERROR; +} + +void Connection::cleanUp(bool clearCache) { + if (mInitialized && mAccessor) { + mAccessor->cleanUp(clearCache); + } +} + +// Methods from ::android::hidl::base::V1_0::IBase follow. + +//IConnection* HIDL_FETCH_IConnection(const char* /* name */) { +// return new Connection(); +//} + +} // namespace implementation +} // namespace V2_0 +} // namespace bufferpool +} // namespace media +} // namespace hardware +} // namespace android diff --git a/media/bufferpool/aidl/default/Connection.h b/media/bufferpool/aidl/default/Connection.h new file mode 100644 index 0000000000..8507749849 --- /dev/null +++ b/media/bufferpool/aidl/default/Connection.h @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2018 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. + */ + +#ifndef ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_CONNECTION_H +#define ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_CONNECTION_H + +#include +#include +#include +#include +#include "Accessor.h" + +namespace android { +namespace hardware { +namespace media { +namespace bufferpool { +namespace V2_0 { +namespace implementation { + +using ::android::hardware::hidl_array; +using ::android::hardware::hidl_memory; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::media::bufferpool::V2_0::implementation::Accessor; +using ::android::hardware::Return; +using ::android::hardware::Void; +using ::android::sp; + +struct Connection : public IConnection { + // Methods from ::android::hardware::media::bufferpool::V2_0::IConnection follow. + Return fetch(uint64_t transactionId, uint32_t bufferId, fetch_cb _hidl_cb) override; + + /** + * Invalidates all buffers which are active and/or are ready to be recycled. + */ + ResultStatus flush(); + + /** + * Allocates a buffer using the specified parameters. Recycles a buffer if + * it is possible. The returned buffer can be transferred to other remote + * clients(Connection). + * + * @param params allocation parameters. + * @param bufferId Id of the allocated buffer. + * @param handle native handle of the allocated buffer. + * + * @return OK if a buffer is successfully allocated. + * NO_MEMORY when there is no memory. + * CRITICAL_ERROR otherwise. + */ + ResultStatus allocate(const std::vector ¶ms, + BufferId *bufferId, const native_handle_t **handle); + + /** + * Processes pending buffer status messages and performs periodic cache cleaning + * from bufferpool. + * + * @param clearCache if clearCache is true, bufferpool frees all buffers + * waiting to be recycled. + */ + void cleanUp(bool clearCache); + + /** Destructs a connection. */ + ~Connection(); + + /** Creates a connection. */ + Connection(); + + /** + * Initializes with the specified buffer pool and the connection id. + * The connection id should be unique in the whole system. + * + * @param accessor the specified buffer pool. + * @param connectionId Id. + */ + void initialize(const sp &accessor, ConnectionId connectionId); + + enum : uint32_t { + SYNC_BUFFERID = UINT32_MAX, + }; + +private: + bool mInitialized; + sp mAccessor; + ConnectionId mConnectionId; +}; + +} // namespace implementation +} // namespace V2_0 +} // namespace bufferpool +} // namespace media +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_CONNECTION_H diff --git a/media/bufferpool/aidl/default/Observer.cpp b/media/bufferpool/aidl/default/Observer.cpp new file mode 100644 index 0000000000..5b23160463 --- /dev/null +++ b/media/bufferpool/aidl/default/Observer.cpp @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2018 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. + */ + +#include "Observer.h" + +namespace android { +namespace hardware { +namespace media { +namespace bufferpool { +namespace V2_0 { +namespace implementation { + +Observer::Observer() { +} + +Observer::~Observer() { +} + +// Methods from ::android::hardware::media::bufferpool::V2_0::IObserver follow. +Return Observer::onMessage(int64_t connectionId, uint32_t msgId) { + std::unique_lock lock(mLock); + auto it = mClients.find(connectionId); + if (it != mClients.end()) { + const std::shared_ptr client = it->second.lock(); + if (!client) { + mClients.erase(it); + } else { + lock.unlock(); + client->receiveInvalidation(msgId); + } + } + return Void(); +} + +void Observer::addClient(ConnectionId connectionId, + const std::weak_ptr &wclient) { + std::lock_guard lock(mLock); + for (auto it = mClients.begin(); it != mClients.end();) { + if (!it->second.lock() || it->first == connectionId) { + it = mClients.erase(it); + } else { + ++it; + } + } + mClients.insert(std::make_pair(connectionId, wclient)); + +} + +void Observer::delClient(ConnectionId connectionId) { + std::lock_guard lock(mLock); + mClients.erase(connectionId); +} + + +} // namespace implementation +} // namespace V2_0 +} // namespace bufferpool +} // namespace media +} // namespace hardware +} // namespace android diff --git a/media/bufferpool/aidl/default/Observer.h b/media/bufferpool/aidl/default/Observer.h new file mode 100644 index 0000000000..42bd7c1325 --- /dev/null +++ b/media/bufferpool/aidl/default/Observer.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2018 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. + */ + +#ifndef ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_OBSERVER_H +#define ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_OBSERVER_H + +#include +#include +#include +#include "BufferPoolClient.h" + +namespace android { +namespace hardware { +namespace media { +namespace bufferpool { +namespace V2_0 { +namespace implementation { + +using ::android::hardware::hidl_array; +using ::android::hardware::hidl_memory; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::Void; +using ::android::sp; + +struct Observer : public IObserver { + // Methods from ::android::hardware::media::bufferpool::V2_0::IObserver follow. + Return onMessage(int64_t connectionId, uint32_t msgId) override; + + ~Observer(); + + void addClient(ConnectionId connectionId, + const std::weak_ptr &wclient); + + void delClient(ConnectionId connectionId); + +private: + Observer(); + + friend struct ClientManager; + + std::mutex mLock; + std::map> mClients; +}; + +} // namespace implementation +} // namespace V2_0 +} // namespace bufferpool +} // namespace media +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_OBSERVER_H diff --git a/media/bufferpool/aidl/default/include/bufferpool/BufferPoolTypes.h b/media/bufferpool/aidl/default/include/bufferpool/BufferPoolTypes.h new file mode 100644 index 0000000000..7c906cbf66 --- /dev/null +++ b/media/bufferpool/aidl/default/include/bufferpool/BufferPoolTypes.h @@ -0,0 +1,123 @@ +/* + * Copyright (C) 2018 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. + */ + +#ifndef ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_BUFFERPOOLTYPES_H +#define ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_BUFFERPOOLTYPES_H + +#include +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace media { +namespace bufferpool { + +struct BufferPoolData { + // For local use, to specify a bufferpool (client connection) for buffers. + // Return value from connect#IAccessor(android.hardware.media.bufferpool@2.0). + int64_t mConnectionId; + // BufferId + uint32_t mId; + + BufferPoolData() : mConnectionId(0), mId(0) {} + + BufferPoolData( + int64_t connectionId, uint32_t id) + : mConnectionId(connectionId), mId(id) {} + + ~BufferPoolData() {} +}; + +namespace V2_0 { +namespace implementation { + +using ::android::hardware::kSynchronizedReadWrite; +using ::android::hardware::kUnsynchronizedWrite; + +typedef uint32_t BufferId; +typedef uint64_t TransactionId; +typedef int64_t ConnectionId; + +enum : ConnectionId { + INVALID_CONNECTIONID = 0, +}; + +typedef android::hardware::MessageQueue BufferStatusQueue; +typedef BufferStatusQueue::Descriptor StatusDescriptor; + +typedef android::hardware::MessageQueue + BufferInvalidationQueue; +typedef BufferInvalidationQueue::Descriptor InvalidationDescriptor; + +/** + * Allocation wrapper class for buffer pool. + */ +struct BufferPoolAllocation { + const native_handle_t *mHandle; + + const native_handle_t *handle() { + return mHandle; + } + + BufferPoolAllocation(const native_handle_t *handle) : mHandle(handle) {} + + ~BufferPoolAllocation() {}; +}; + +/** + * Allocator wrapper class for buffer pool. + */ +class BufferPoolAllocator { +public: + + /** + * Allocate an allocation(buffer) for buffer pool. + * + * @param params allocation parameters + * @param alloc created allocation + * @param allocSize size of created allocation + * + * @return OK when an allocation is created successfully. + */ + virtual ResultStatus allocate( + const std::vector ¶ms, + std::shared_ptr *alloc, + size_t *allocSize) = 0; + + /** + * Returns whether allocation parameters of an old allocation are + * compatible with new allocation parameters. + */ + virtual bool compatible(const std::vector &newParams, + const std::vector &oldParams) = 0; + +protected: + BufferPoolAllocator() = default; + + virtual ~BufferPoolAllocator() = default; +}; + +} // namespace implementation +} // namespace V2_0 +} // namespace bufferpool +} // namespace media +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_BUFFERPOOLTYPES_H diff --git a/media/bufferpool/aidl/default/include/bufferpool/ClientManager.h b/media/bufferpool/aidl/default/include/bufferpool/ClientManager.h new file mode 100644 index 0000000000..24b61f4fb5 --- /dev/null +++ b/media/bufferpool/aidl/default/include/bufferpool/ClientManager.h @@ -0,0 +1,195 @@ +/* + * Copyright (C) 2018 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. + */ + +#ifndef ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_CLIENTMANAGER_H +#define ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_CLIENTMANAGER_H + +#include +#include +#include +#include +#include "BufferPoolTypes.h" + +namespace android { +namespace hardware { +namespace media { +namespace bufferpool { +namespace V2_0 { +namespace implementation { + +using ::android::hardware::hidl_array; +using ::android::hardware::hidl_memory; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::media::bufferpool::V2_0::IAccessor; +using ::android::hardware::media::bufferpool::V2_0::ResultStatus; +using ::android::hardware::Return; +using ::android::hardware::Void; +using ::android::sp; + +struct ClientManager : public IClientManager { + // Methods from ::android::hardware::media::bufferpool::V2_0::IClientManager follow. + Return registerSender(const sp<::android::hardware::media::bufferpool::V2_0::IAccessor>& bufferPool, registerSender_cb _hidl_cb) override; + + /** Gets an instance. */ + static sp getInstance(); + + /** + * Creates a local connection with a newly created buffer pool. + * + * @param allocator for new buffer allocation. + * @param pConnectionId Id of the created connection. This is + * system-wide unique. + * + * @return OK when a buffer pool and a local connection is successfully + * created. + * NO_MEMORY when there is no memory. + * CRITICAL_ERROR otherwise. + */ + ResultStatus create(const std::shared_ptr &allocator, + ConnectionId *pConnectionId); + + /** + * Register a created connection as sender for remote process. + * + * @param receiver The remote receiving process. + * @param senderId A local connection which will send buffers to. + * @param receiverId Id of the created receiving connection on the receiver + * process. + * + * @return OK when the receiving connection is successfully created on the + * receiver process. + * NOT_FOUND when the sender connection was not found. + * ALREADY_EXISTS the receiving connection is already made. + * CRITICAL_ERROR otherwise. + */ + ResultStatus registerSender(const sp &receiver, + ConnectionId senderId, + ConnectionId *receiverId); + + /** + * Closes the specified connection. + * + * @param connectionId The id of the connection. + * + * @return OK when the connection is closed. + * NOT_FOUND when the specified connection was not found. + * CRITICAL_ERROR otherwise. + */ + ResultStatus close(ConnectionId connectionId); + + /** + * Evicts cached allocations. If it's local connection, release the + * previous allocations and do not recycle current active allocations. + * + * @param connectionId The id of the connection. + * + * @return OK when the connection is resetted. + * NOT_FOUND when the specified connection was not found. + * CRITICAL_ERROR otherwise. + */ + ResultStatus flush(ConnectionId connectionId); + + /** + * Allocates a buffer from the specified connection. The output parameter + * handle is cloned from the internal handle. So it is safe to use directly, + * and it should be deleted and destroyed after use. + * + * @param connectionId The id of the connection. + * @param params The allocation parameters. + * @param handle The native handle to the allocated buffer. handle + * should be cloned before use. + * @param buffer The allocated buffer. + * + * @return OK when a buffer was allocated successfully. + * NOT_FOUND when the specified connection was not found. + * NO_MEMORY when there is no memory. + * CRITICAL_ERROR otherwise. + */ + ResultStatus allocate(ConnectionId connectionId, + const std::vector ¶ms, + native_handle_t **handle, + std::shared_ptr *buffer); + + /** + * Receives a buffer for the transaction. The output parameter handle is + * cloned from the internal handle. So it is safe to use directly, and it + * should be deleted and destoyed after use. + * + * @param connectionId The id of the receiving connection. + * @param transactionId The id for the transaction. + * @param bufferId The id for the buffer. + * @param timestampUs The timestamp of the buffer is being sent. + * @param handle The native handle to the allocated buffer. handle + * should be cloned before use. + * @param buffer The received buffer. + * + * @return OK when a buffer was received successfully. + * NOT_FOUND when the specified connection was not found. + * NO_MEMORY when there is no memory. + * CRITICAL_ERROR otherwise. + */ + ResultStatus receive(ConnectionId connectionId, + TransactionId transactionId, + BufferId bufferId, + int64_t timestampUs, + native_handle_t **handle, + std::shared_ptr *buffer); + + /** + * Posts a buffer transfer transaction to the buffer pool. Sends a buffer + * to other remote clients(connection) after this call has been succeeded. + * + * @param receiverId The id of the receiving connection. + * @param buffer to transfer + * @param transactionId Id of the transfer transaction. + * @param timestampUs The timestamp of the buffer transaction is being + * posted. + * + * @return OK when a buffer transaction was posted successfully. + * NOT_FOUND when the sending connection was not found. + * CRITICAL_ERROR otherwise. + */ + ResultStatus postSend(ConnectionId receiverId, + const std::shared_ptr &buffer, + TransactionId *transactionId, + int64_t *timestampUs); + + /** + * Time out inactive lingering connections and close. + */ + void cleanUp(); + + /** Destructs the manager of buffer pool clients. */ + ~ClientManager(); +private: + static sp sInstance; + static std::mutex sInstanceLock; + + class Impl; + const std::unique_ptr mImpl; + + ClientManager(); +}; + +} // namespace implementation +} // namespace V2_0 +} // namespace bufferpool +} // namespace media +} // namespace hardware +} // namespace android + +#endif // ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_CLIENTMANAGER_H diff --git a/media/bufferpool/aidl/default/tests/BufferpoolUnitTest.cpp b/media/bufferpool/aidl/default/tests/BufferpoolUnitTest.cpp new file mode 100644 index 0000000000..b448405a2e --- /dev/null +++ b/media/bufferpool/aidl/default/tests/BufferpoolUnitTest.cpp @@ -0,0 +1,541 @@ +/* + * Copyright (C) 2021 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. + */ + +//#define LOG_NDEBUG 0 +#define LOG_TAG "BufferpoolUnitTest" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include "allocator.h" + +using android::hardware::configureRpcThreadpool; +using android::hardware::media::bufferpool::BufferPoolData; +using android::hardware::media::bufferpool::V2_0::IClientManager; +using android::hardware::media::bufferpool::V2_0::ResultStatus; +using android::hardware::media::bufferpool::V2_0::implementation::BufferId; +using android::hardware::media::bufferpool::V2_0::implementation::ClientManager; +using android::hardware::media::bufferpool::V2_0::implementation::ConnectionId; +using android::hardware::media::bufferpool::V2_0::implementation::TransactionId; + +using namespace android; + +// communication message types between processes. +enum PipeCommand : int32_t { + INIT, + TRANSFER, + STOP, + + INIT_OK, + INIT_ERROR, + TRANSFER_OK, + TRANSFER_ERROR, + STOP_OK, + STOP_ERROR, +}; + +// communication message between processes. +union PipeMessage { + struct { + int32_t command; + int32_t memsetValue; + BufferId bufferId; + ConnectionId connectionId; + TransactionId transactionId; + int64_t timestampUs; + } data; + char array[0]; +}; + +static int32_t kNumIterationCount = 10; + +class BufferpoolTest { + public: + BufferpoolTest() : mConnectionValid(false), mManager(nullptr), mAllocator(nullptr) { + mConnectionId = -1; + mReceiverId = -1; + } + + ~BufferpoolTest() { + if (mConnectionValid) { + mManager->close(mConnectionId); + } + } + + protected: + bool mConnectionValid; + ConnectionId mConnectionId; + ConnectionId mReceiverId; + + android::sp mManager; + std::shared_ptr mAllocator; + + void setupBufferpoolManager(); +}; + +void BufferpoolTest::setupBufferpoolManager() { + // retrieving per process bufferpool object sp + mManager = ClientManager::getInstance(); + ASSERT_NE(mManager, nullptr) << "unable to get ClientManager\n"; + + mAllocator = std::make_shared(); + ASSERT_NE(mAllocator, nullptr) << "unable to create TestBufferPoolAllocator\n"; + + // set-up local bufferpool connection for sender + ResultStatus status = mManager->create(mAllocator, &mConnectionId); + ASSERT_EQ(status, ResultStatus::OK) + << "unable to set-up local bufferpool connection for sender\n"; + mConnectionValid = true; +} + +class BufferpoolUnitTest : public BufferpoolTest, public ::testing::Test { + public: + virtual void SetUp() override { setupBufferpoolManager(); } + + virtual void TearDown() override {} +}; + +class BufferpoolFunctionalityTest : public BufferpoolTest, public ::testing::Test { + public: + virtual void SetUp() override { + mReceiverPid = -1; + + ASSERT_TRUE(pipe(mCommandPipeFds) == 0) << "pipe connection failed for commandPipe\n"; + ASSERT_TRUE(pipe(mResultPipeFds) == 0) << "pipe connection failed for resultPipe\n"; + + mReceiverPid = fork(); + ASSERT_TRUE(mReceiverPid >= 0) << "fork failed\n"; + + if (mReceiverPid == 0) { + doReceiver(); + // In order to ignore gtest behaviour, wait for being killed from tearDown + pause(); + } + setupBufferpoolManager(); + } + + virtual void TearDown() override { + if (mReceiverPid > 0) { + kill(mReceiverPid, SIGKILL); + int wstatus; + wait(&wstatus); + } + } + + protected: + pid_t mReceiverPid; + int mCommandPipeFds[2]; + int mResultPipeFds[2]; + + bool sendMessage(int* pipes, const PipeMessage& message) { + int ret = write(pipes[1], message.array, sizeof(PipeMessage)); + return ret == sizeof(PipeMessage); + } + + bool receiveMessage(int* pipes, PipeMessage* message) { + int ret = read(pipes[0], message->array, sizeof(PipeMessage)); + return ret == sizeof(PipeMessage); + } + + void doReceiver(); +}; + +void BufferpoolFunctionalityTest::doReceiver() { + // Configures the threadpool used for handling incoming RPC calls in this process. + configureRpcThreadpool(1 /*threads*/, false /*willJoin*/); + bool receiverRunning = true; + while (receiverRunning) { + PipeMessage message; + receiveMessage(mCommandPipeFds, &message); + ResultStatus err = ResultStatus::OK; + switch (message.data.command) { + case PipeCommand::INIT: { + // receiver manager creation + mManager = ClientManager::getInstance(); + if (!mManager) { + message.data.command = PipeCommand::INIT_ERROR; + sendMessage(mResultPipeFds, message); + return; + } + + android::status_t status = mManager->registerAsService(); + if (status != android::OK) { + message.data.command = PipeCommand::INIT_ERROR; + sendMessage(mResultPipeFds, message); + return; + } + message.data.command = PipeCommand::INIT_OK; + sendMessage(mResultPipeFds, message); + break; + } + case PipeCommand::TRANSFER: { + native_handle_t* receiveHandle = nullptr; + std::shared_ptr receiveBuffer; + err = mManager->receive(message.data.connectionId, message.data.transactionId, + message.data.bufferId, message.data.timestampUs, + &receiveHandle, &receiveBuffer); + if (err != ResultStatus::OK) { + message.data.command = PipeCommand::TRANSFER_ERROR; + sendMessage(mResultPipeFds, message); + return; + } + if (!TestBufferPoolAllocator::Verify(receiveHandle, message.data.memsetValue)) { + message.data.command = PipeCommand::TRANSFER_ERROR; + sendMessage(mResultPipeFds, message); + return; + } + if (receiveHandle) { + native_handle_close(receiveHandle); + native_handle_delete(receiveHandle); + } + receiveHandle = nullptr; + receiveBuffer.reset(); + message.data.command = PipeCommand::TRANSFER_OK; + sendMessage(mResultPipeFds, message); + break; + } + case PipeCommand::STOP: { + err = mManager->close(message.data.connectionId); + if (err != ResultStatus::OK) { + message.data.command = PipeCommand::STOP_ERROR; + sendMessage(mResultPipeFds, message); + return; + } + message.data.command = PipeCommand::STOP_OK; + sendMessage(mResultPipeFds, message); + receiverRunning = false; + break; + } + default: + ALOGE("unknown command. try again"); + break; + } + } +} + +// Buffer allocation test. +// Check whether each buffer allocation is done successfully with unique buffer id. +TEST_F(BufferpoolUnitTest, AllocateBuffer) { + std::vector vecParams; + getTestAllocatorParams(&vecParams); + + std::vector> buffers{}; + std::vector allocHandle{}; + ResultStatus status; + for (int i = 0; i < kNumIterationCount; ++i) { + native_handle_t* handle = nullptr; + std::shared_ptr buffer{}; + status = mManager->allocate(mConnectionId, vecParams, &handle, &buffer); + ASSERT_EQ(status, ResultStatus::OK) << "allocate failed for " << i << "iteration"; + + buffers.push_back(std::move(buffer)); + if (handle) { + allocHandle.push_back(std::move(handle)); + } + } + + for (int i = 0; i < kNumIterationCount; ++i) { + for (int j = i + 1; j < kNumIterationCount; ++j) { + ASSERT_TRUE(buffers[i]->mId != buffers[j]->mId) << "allocated buffers are not unique"; + } + } + // delete the buffer handles + for (auto handle : allocHandle) { + native_handle_close(handle); + native_handle_delete(handle); + } + // clear the vectors + buffers.clear(); + allocHandle.clear(); +} + +// Buffer recycle test. +// Check whether de-allocated buffers are recycled. +TEST_F(BufferpoolUnitTest, RecycleBuffer) { + std::vector vecParams; + getTestAllocatorParams(&vecParams); + + ResultStatus status; + std::vector bid{}; + std::vector allocHandle{}; + for (int i = 0; i < kNumIterationCount; ++i) { + native_handle_t* handle = nullptr; + std::shared_ptr buffer; + status = mManager->allocate(mConnectionId, vecParams, &handle, &buffer); + ASSERT_EQ(status, ResultStatus::OK) << "allocate failed for " << i << "iteration"; + + bid.push_back(buffer->mId); + if (handle) { + allocHandle.push_back(std::move(handle)); + } + buffer.reset(); + } + + std::unordered_set set(bid.begin(), bid.end()); + ASSERT_EQ(set.size(), 1) << "buffers are not recycled properly"; + + // delete the buffer handles + for (auto handle : allocHandle) { + native_handle_close(handle); + native_handle_delete(handle); + } + allocHandle.clear(); +} + +// Validate cache evict and invalidate APIs. +TEST_F(BufferpoolUnitTest, FlushTest) { + std::vector vecParams; + getTestAllocatorParams(&vecParams); + + ResultStatus status = mManager->registerSender(mManager, mConnectionId, &mReceiverId); + ASSERT_TRUE(status == ResultStatus::ALREADY_EXISTS && mReceiverId == mConnectionId); + + // testing empty flush + status = mManager->flush(mConnectionId); + ASSERT_EQ(status, ResultStatus::OK) << "failed to flush connection : " << mConnectionId; + + std::vector> senderBuffer{}; + std::vector allocHandle{}; + std::vector tid{}; + std::vector timestampUs{}; + + std::map bufferMap{}; + + for (int i = 0; i < kNumIterationCount; i++) { + int64_t postUs; + TransactionId transactionId; + native_handle_t* handle = nullptr; + std::shared_ptr buffer{}; + status = mManager->allocate(mConnectionId, vecParams, &handle, &buffer); + ASSERT_EQ(status, ResultStatus::OK) << "allocate failed for " << i << " iteration"; + + ASSERT_TRUE(TestBufferPoolAllocator::Fill(handle, i)); + + status = mManager->postSend(mReceiverId, buffer, &transactionId, &postUs); + ASSERT_EQ(status, ResultStatus::OK) << "unable to post send transaction on bufferpool"; + + timestampUs.push_back(postUs); + tid.push_back(transactionId); + bufferMap.insert({transactionId, buffer->mId}); + + senderBuffer.push_back(std::move(buffer)); + if (handle) { + allocHandle.push_back(std::move(handle)); + } + buffer.reset(); + } + + status = mManager->flush(mConnectionId); + ASSERT_EQ(status, ResultStatus::OK) << "failed to flush connection : " << mConnectionId; + + std::shared_ptr receiverBuffer{}; + native_handle_t* recvHandle = nullptr; + for (int i = 0; i < kNumIterationCount; i++) { + status = mManager->receive(mReceiverId, tid[i], senderBuffer[i]->mId, timestampUs[i], + &recvHandle, &receiverBuffer); + ASSERT_EQ(status, ResultStatus::OK) << "receive failed for buffer " << senderBuffer[i]->mId; + + // find the buffer id from transaction id + auto findIt = bufferMap.find(tid[i]); + ASSERT_NE(findIt, bufferMap.end()) << "inconsistent buffer mapping"; + + // buffer id received must be same as the buffer id sent + ASSERT_EQ(findIt->second, receiverBuffer->mId) << "invalid buffer received"; + + ASSERT_TRUE(TestBufferPoolAllocator::Verify(recvHandle, i)) + << "Message received not same as that sent"; + + bufferMap.erase(findIt); + if (recvHandle) { + native_handle_close(recvHandle); + native_handle_delete(recvHandle); + } + recvHandle = nullptr; + receiverBuffer.reset(); + } + + ASSERT_EQ(bufferMap.size(), 0) << "buffers received is less than the number of buffers sent"; + + for (auto handle : allocHandle) { + native_handle_close(handle); + native_handle_delete(handle); + } + allocHandle.clear(); + senderBuffer.clear(); + timestampUs.clear(); +} + +// Buffer transfer test between processes. +TEST_F(BufferpoolFunctionalityTest, TransferBuffer) { + // initialize the receiver + PipeMessage message; + message.data.command = PipeCommand::INIT; + sendMessage(mCommandPipeFds, message); + ASSERT_TRUE(receiveMessage(mResultPipeFds, &message)) << "receiveMessage failed\n"; + ASSERT_EQ(message.data.command, PipeCommand::INIT_OK) << "receiver init failed"; + + android::sp receiver = IClientManager::getService(); + ASSERT_NE(receiver, nullptr) << "getService failed for receiver\n"; + + ConnectionId receiverId; + ResultStatus status = mManager->registerSender(receiver, mConnectionId, &receiverId); + ASSERT_EQ(status, ResultStatus::OK) + << "registerSender failed for connection id " << mConnectionId << "\n"; + + std::vector vecParams; + getTestAllocatorParams(&vecParams); + + for (int i = 0; i < kNumIterationCount; ++i) { + native_handle_t* handle = nullptr; + std::shared_ptr buffer; + status = mManager->allocate(mConnectionId, vecParams, &handle, &buffer); + ASSERT_EQ(status, ResultStatus::OK) << "allocate failed for " << i << "iteration"; + + ASSERT_TRUE(TestBufferPoolAllocator::Fill(handle, i)) + << "Fill fail for buffer handle " << handle << "\n"; + + // send the buffer to the receiver + int64_t postUs; + TransactionId transactionId; + status = mManager->postSend(receiverId, buffer, &transactionId, &postUs); + ASSERT_EQ(status, ResultStatus::OK) + << "postSend failed for receiver " << receiverId << "\n"; + + // PipeMessage message; + message.data.command = PipeCommand::TRANSFER; + message.data.memsetValue = i; + message.data.bufferId = buffer->mId; + message.data.connectionId = receiverId; + message.data.transactionId = transactionId; + message.data.timestampUs = postUs; + sendMessage(mCommandPipeFds, message); + // delete buffer handle + if (handle) { + native_handle_close(handle); + native_handle_delete(handle); + } + ASSERT_TRUE(receiveMessage(mResultPipeFds, &message)) << "receiveMessage failed\n"; + ASSERT_EQ(message.data.command, PipeCommand::TRANSFER_OK) + << "received error during buffer transfer\n"; + } + message.data.command = PipeCommand::STOP; + sendMessage(mCommandPipeFds, message); + ASSERT_TRUE(receiveMessage(mResultPipeFds, &message)) << "receiveMessage failed\n"; + ASSERT_EQ(message.data.command, PipeCommand::STOP_OK) + << "received error during buffer transfer\n"; +} + +/* Validate bufferpool for following corner cases: + 1. invalid connectionID + 2. invalid receiver + 3. when sender is not registered + 4. when connection is closed +*/ +// TODO: Enable when the issue in b/212196495 is fixed +TEST_F(BufferpoolFunctionalityTest, DISABLED_ValidityTest) { + std::vector vecParams; + getTestAllocatorParams(&vecParams); + + std::shared_ptr senderBuffer; + native_handle_t* allocHandle = nullptr; + + // call allocate() on a random connection id + ConnectionId randomId = rand(); + ResultStatus status = mManager->allocate(randomId, vecParams, &allocHandle, &senderBuffer); + EXPECT_TRUE(status == ResultStatus::NOT_FOUND); + + // initialize the receiver + PipeMessage message; + message.data.command = PipeCommand::INIT; + sendMessage(mCommandPipeFds, message); + ASSERT_TRUE(receiveMessage(mResultPipeFds, &message)) << "receiveMessage failed\n"; + ASSERT_EQ(message.data.command, PipeCommand::INIT_OK) << "receiver init failed"; + + allocHandle = nullptr; + senderBuffer.reset(); + status = mManager->allocate(mConnectionId, vecParams, &allocHandle, &senderBuffer); + + ASSERT_TRUE(TestBufferPoolAllocator::Fill(allocHandle, 0x77)); + + // send buffers w/o registering sender + int64_t postUs; + TransactionId transactionId; + + // random receiver + status = mManager->postSend(randomId, senderBuffer, &transactionId, &postUs); + ASSERT_NE(status, ResultStatus::OK) << "bufferpool shouldn't allow send on random receiver"; + + // establish connection + android::sp receiver = IClientManager::getService(); + ASSERT_NE(receiver, nullptr) << "getService failed for receiver\n"; + + ConnectionId receiverId; + status = mManager->registerSender(receiver, mConnectionId, &receiverId); + ASSERT_EQ(status, ResultStatus::OK) + << "registerSender failed for connection id " << mConnectionId << "\n"; + + allocHandle = nullptr; + senderBuffer.reset(); + status = mManager->allocate(mConnectionId, vecParams, &allocHandle, &senderBuffer); + ASSERT_EQ(status, ResultStatus::OK) << "allocate failed for connection " << mConnectionId; + + ASSERT_TRUE(TestBufferPoolAllocator::Fill(allocHandle, 0x88)); + + // send the buffer to the receiver + status = mManager->postSend(receiverId, senderBuffer, &transactionId, &postUs); + ASSERT_EQ(status, ResultStatus::OK) << "postSend failed for receiver " << receiverId << "\n"; + + // PipeMessage message; + message.data.command = PipeCommand::TRANSFER; + message.data.memsetValue = 0x88; + message.data.bufferId = senderBuffer->mId; + message.data.connectionId = receiverId; + message.data.transactionId = transactionId; + message.data.timestampUs = postUs; + sendMessage(mCommandPipeFds, message); + ASSERT_TRUE(receiveMessage(mResultPipeFds, &message)) << "receiveMessage failed\n"; + ASSERT_EQ(message.data.command, PipeCommand::TRANSFER_OK) + << "received error during buffer transfer\n"; + + if (allocHandle) { + native_handle_close(allocHandle); + native_handle_delete(allocHandle); + } + + message.data.command = PipeCommand::STOP; + sendMessage(mCommandPipeFds, message); + ASSERT_TRUE(receiveMessage(mResultPipeFds, &message)) << "receiveMessage failed\n"; + ASSERT_EQ(message.data.command, PipeCommand::STOP_OK) + << "received error during buffer transfer\n"; + + // try to send msg to closed connection + status = mManager->postSend(receiverId, senderBuffer, &transactionId, &postUs); + ASSERT_NE(status, ResultStatus::OK) << "bufferpool shouldn't allow send on closed connection"; +} + +int main(int argc, char** argv) { + android::hardware::details::setTrebleTestingOverride(true); + ::testing::InitGoogleTest(&argc, argv); + int status = RUN_ALL_TESTS(); + ALOGV("Test result = %d\n", status); + return status; +} diff --git a/media/bufferpool/aidl/default/tests/allocator.cpp b/media/bufferpool/aidl/default/tests/allocator.cpp new file mode 100644 index 0000000000..25b08ef132 --- /dev/null +++ b/media/bufferpool/aidl/default/tests/allocator.cpp @@ -0,0 +1,251 @@ +/* + * Copyright (C) 2018 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. + */ + +#include +#include +#include "allocator.h" + +union Params { + struct { + uint32_t capacity; + } data; + uint8_t array[0]; + Params() : data{0} {} + Params(uint32_t size) + : data{size} {} +}; + + +namespace { + +struct HandleAshmem : public native_handle_t { + HandleAshmem(int ashmemFd, size_t size) + : native_handle_t(cHeader), + mFds{ ashmemFd }, + mInts{ int (size & 0xFFFFFFFF), int((uint64_t(size) >> 32) & 0xFFFFFFFF), kMagic } {} + + int ashmemFd() const { return mFds.mAshmem; } + size_t size() const { + return size_t(unsigned(mInts.mSizeLo)) + | size_t(uint64_t(unsigned(mInts.mSizeHi)) << 32); + } + + static bool isValid(const native_handle_t * const o); + +protected: + struct { + int mAshmem; + } mFds; + struct { + int mSizeLo; + int mSizeHi; + int mMagic; + } mInts; + +private: + enum { + kMagic = 'ahm\x00', + numFds = sizeof(mFds) / sizeof(int), + numInts = sizeof(mInts) / sizeof(int), + version = sizeof(native_handle_t) + }; + const static native_handle_t cHeader; +}; + +const native_handle_t HandleAshmem::cHeader = { + HandleAshmem::version, + HandleAshmem::numFds, + HandleAshmem::numInts, + {} +}; + +bool HandleAshmem::isValid(const native_handle_t * const o) { + if (!o || memcmp(o, &cHeader, sizeof(cHeader))) { + return false; + } + const HandleAshmem *other = static_cast(o); + return other->mInts.mMagic == kMagic; +} + +class AllocationAshmem { +private: + AllocationAshmem(int ashmemFd, size_t capacity, bool res) + : mHandle(ashmemFd, capacity), + mInit(res) {} + +public: + static AllocationAshmem *Alloc(size_t size) { + constexpr static const char *kAllocationTag = "bufferpool_test"; + int ashmemFd = ashmem_create_region(kAllocationTag, size); + return new AllocationAshmem(ashmemFd, size, ashmemFd >= 0); + } + + ~AllocationAshmem() { + if (mInit) { + native_handle_close(&mHandle); + } + } + + const HandleAshmem *handle() { + return &mHandle; + } + +private: + HandleAshmem mHandle; + bool mInit; + // TODO: mapping and map fd +}; + +struct AllocationDtor { + AllocationDtor(const std::shared_ptr &alloc) + : mAlloc(alloc) {} + + void operator()(BufferPoolAllocation *poolAlloc) { delete poolAlloc; } + + const std::shared_ptr mAlloc; +}; + +} + +void IpcMutex::init() { + pthread_mutexattr_t mattr; + pthread_mutexattr_init(&mattr); + pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED); + pthread_mutex_init(&lock, &mattr); + pthread_mutexattr_destroy(&mattr); + + pthread_condattr_t cattr; + pthread_condattr_init(&cattr); + pthread_condattr_setpshared(&cattr, PTHREAD_PROCESS_SHARED); + pthread_cond_init(&cond, &cattr); + pthread_condattr_destroy(&cattr); +} + +IpcMutex *IpcMutex::Import(void *pMutex) { + return reinterpret_cast(pMutex); +} + + +ResultStatus TestBufferPoolAllocator::allocate( + const std::vector ¶ms, + std::shared_ptr *alloc, + size_t *allocSize) { + Params ashmemParams; + memcpy(&ashmemParams, params.data(), std::min(sizeof(Params), params.size())); + + std::shared_ptr ashmemAlloc = + std::shared_ptr( + AllocationAshmem::Alloc(ashmemParams.data.capacity)); + if (ashmemAlloc) { + BufferPoolAllocation *ptr = new BufferPoolAllocation(ashmemAlloc->handle()); + if (ptr) { + *alloc = std::shared_ptr(ptr, AllocationDtor(ashmemAlloc)); + if (*alloc) { + *allocSize = ashmemParams.data.capacity; + return ResultStatus::OK; + } + delete ptr; + return ResultStatus::NO_MEMORY; + } + } + return ResultStatus::CRITICAL_ERROR; +} + +bool TestBufferPoolAllocator::compatible(const std::vector &newParams, + const std::vector &oldParams) { + size_t newSize = newParams.size(); + size_t oldSize = oldParams.size(); + if (newSize == oldSize) { + for (size_t i = 0; i < newSize; ++i) { + if (newParams[i] != oldParams[i]) { + return false; + } + } + return true; + } + return false; +} + +bool TestBufferPoolAllocator::Fill(const native_handle_t *handle, const unsigned char val) { + if (!HandleAshmem::isValid(handle)) { + return false; + } + const HandleAshmem *o = static_cast(handle); + unsigned char *ptr = (unsigned char *)mmap( + NULL, o->size(), PROT_READ|PROT_WRITE, MAP_SHARED, o->ashmemFd(), 0); + + if (ptr != MAP_FAILED) { + for (size_t i = 0; i < o->size(); ++i) { + ptr[i] = val; + } + munmap(ptr, o->size()); + return true; + } + return false; +} + +bool TestBufferPoolAllocator::Verify(const native_handle_t *handle, const unsigned char val) { + if (!HandleAshmem::isValid(handle)) { + return false; + } + const HandleAshmem *o = static_cast(handle); + unsigned char *ptr = (unsigned char *)mmap( + NULL, o->size(), PROT_READ, MAP_SHARED, o->ashmemFd(), 0); + + if (ptr != MAP_FAILED) { + bool res = true; + for (size_t i = 0; i < o->size(); ++i) { + if (ptr[i] != val) { + res = false; + break; + } + } + munmap(ptr, o->size()); + return res; + } + return false; +} + +bool TestBufferPoolAllocator::MapMemoryForMutex(const native_handle_t *handle, void **mem) { + if (!HandleAshmem::isValid(handle)) { + return false; + } + const HandleAshmem *o = static_cast(handle); + *mem = mmap( + NULL, o->size(), PROT_READ|PROT_WRITE, MAP_SHARED, o->ashmemFd(), 0); + if (*mem == MAP_FAILED || *mem == nullptr) { + return false; + } + return true; +} + +bool TestBufferPoolAllocator::UnmapMemoryForMutex(void *mem) { + munmap(mem, sizeof(IpcMutex)); + return true; +} + +void getTestAllocatorParams(std::vector *params) { + constexpr static int kAllocationSize = 1024 * 10; + Params ashmemParams(kAllocationSize); + + params->assign(ashmemParams.array, ashmemParams.array + sizeof(ashmemParams)); +} + +void getIpcMutexParams(std::vector *params) { + Params ashmemParams(sizeof(IpcMutex)); + + params->assign(ashmemParams.array, ashmemParams.array + sizeof(ashmemParams)); +} diff --git a/media/bufferpool/aidl/default/tests/allocator.h b/media/bufferpool/aidl/default/tests/allocator.h new file mode 100644 index 0000000000..862d1a533a --- /dev/null +++ b/media/bufferpool/aidl/default/tests/allocator.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2018 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. + */ + +#ifndef VNDK_HIDL_BUFFERPOOL_V2_0_ALLOCATOR_H +#define VNDK_HIDL_BUFFERPOOL_V2_0_ALLOCATOR_H + +#include +#include + +using android::hardware::media::bufferpool::V2_0::ResultStatus; +using android::hardware::media::bufferpool::V2_0::implementation:: + BufferPoolAllocation; +using android::hardware::media::bufferpool::V2_0::implementation:: + BufferPoolAllocator; + +struct IpcMutex { + pthread_mutex_t lock; + pthread_cond_t cond; + int counter = 0; + bool signalled = false; + + void init(); + + static IpcMutex *Import(void *mem); +}; + +// buffer allocator for the tests +class TestBufferPoolAllocator : public BufferPoolAllocator { + public: + TestBufferPoolAllocator() {} + + ~TestBufferPoolAllocator() override {} + + ResultStatus allocate(const std::vector ¶ms, + std::shared_ptr *alloc, + size_t *allocSize) override; + + bool compatible(const std::vector &newParams, + const std::vector &oldParams) override; + + static bool Fill(const native_handle_t *handle, const unsigned char val); + + static bool Verify(const native_handle_t *handle, const unsigned char val); + + static bool MapMemoryForMutex(const native_handle_t *handle, void **mem); + + static bool UnmapMemoryForMutex(void *mem); +}; + +// retrieve buffer allocator paramters +void getTestAllocatorParams(std::vector *params); + +void getIpcMutexParams(std::vector *params); + +#endif // VNDK_HIDL_BUFFERPOOL_V2_0_ALLOCATOR_H diff --git a/media/bufferpool/aidl/default/tests/cond.cpp b/media/bufferpool/aidl/default/tests/cond.cpp new file mode 100644 index 0000000000..21beea8f44 --- /dev/null +++ b/media/bufferpool/aidl/default/tests/cond.cpp @@ -0,0 +1,269 @@ +/* + * Copyright (C) 2018 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. + */ + +#define LOG_TAG "buffferpool_unit_test" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "allocator.h" + +using android::hardware::configureRpcThreadpool; +using android::hardware::hidl_handle; +using android::hardware::media::bufferpool::V2_0::IClientManager; +using android::hardware::media::bufferpool::V2_0::ResultStatus; +using android::hardware::media::bufferpool::V2_0::implementation::BufferId; +using android::hardware::media::bufferpool::V2_0::implementation::ClientManager; +using android::hardware::media::bufferpool::V2_0::implementation::ConnectionId; +using android::hardware::media::bufferpool::V2_0::implementation::TransactionId; +using android::hardware::media::bufferpool::BufferPoolData; + +namespace { + +// communication message types between processes. +enum PipeCommand : int32_t { + INIT_OK = 0, + INIT_ERROR, + SEND, + RECEIVE_OK, + RECEIVE_ERROR, +}; + +// communication message between processes. +union PipeMessage { + struct { + int32_t command; + BufferId bufferId; + ConnectionId connectionId; + TransactionId transactionId; + int64_t timestampUs; + } data; + char array[0]; +}; + +constexpr int kSignalInt = 200; + +// media.bufferpool test setup +class BufferpoolMultiTest : public ::testing::Test { + public: + virtual void SetUp() override { + ResultStatus status; + mReceiverPid = -1; + mConnectionValid = false; + + ASSERT_TRUE(pipe(mCommandPipeFds) == 0); + ASSERT_TRUE(pipe(mResultPipeFds) == 0); + + mReceiverPid = fork(); + ASSERT_TRUE(mReceiverPid >= 0); + + if (mReceiverPid == 0) { + doReceiver(); + // In order to ignore gtest behaviour, wait for being killed from + // tearDown + pause(); + } + + mManager = ClientManager::getInstance(); + ASSERT_NE(mManager, nullptr); + + mAllocator = std::make_shared(); + ASSERT_TRUE((bool)mAllocator); + + status = mManager->create(mAllocator, &mConnectionId); + ASSERT_TRUE(status == ResultStatus::OK); + mConnectionValid = true; + } + + virtual void TearDown() override { + if (mReceiverPid > 0) { + kill(mReceiverPid, SIGKILL); + int wstatus; + wait(&wstatus); + } + + if (mConnectionValid) { + mManager->close(mConnectionId); + } + } + + protected: + static void description(const std::string& description) { + RecordProperty("description", description); + } + + android::sp mManager; + std::shared_ptr mAllocator; + bool mConnectionValid; + ConnectionId mConnectionId; + pid_t mReceiverPid; + int mCommandPipeFds[2]; + int mResultPipeFds[2]; + + bool sendMessage(int *pipes, const PipeMessage &message) { + int ret = write(pipes[1], message.array, sizeof(PipeMessage)); + return ret == sizeof(PipeMessage); + } + + bool receiveMessage(int *pipes, PipeMessage *message) { + int ret = read(pipes[0], message->array, sizeof(PipeMessage)); + return ret == sizeof(PipeMessage); + } + + void doReceiver() { + configureRpcThreadpool(1, false); + PipeMessage message; + mManager = ClientManager::getInstance(); + if (!mManager) { + message.data.command = PipeCommand::INIT_ERROR; + sendMessage(mResultPipeFds, message); + return; + } + android::status_t status = mManager->registerAsService(); + if (status != android::OK) { + message.data.command = PipeCommand::INIT_ERROR; + sendMessage(mResultPipeFds, message); + return; + } + message.data.command = PipeCommand::INIT_OK; + sendMessage(mResultPipeFds, message); + + int val = 0; + receiveMessage(mCommandPipeFds, &message); + { + native_handle_t *rhandle = nullptr; + std::shared_ptr rbuffer; + void *mem = nullptr; + IpcMutex *mutex = nullptr; + ResultStatus status = mManager->receive( + message.data.connectionId, message.data.transactionId, + message.data.bufferId, message.data.timestampUs, &rhandle, &rbuffer); + mManager->close(message.data.connectionId); + if (status != ResultStatus::OK) { + message.data.command = PipeCommand::RECEIVE_ERROR; + sendMessage(mResultPipeFds, message); + return; + } + if (!TestBufferPoolAllocator::MapMemoryForMutex(rhandle, &mem)) { + message.data.command = PipeCommand::RECEIVE_ERROR; + sendMessage(mResultPipeFds, message); + return; + } + mutex = IpcMutex::Import(mem); + pthread_mutex_lock(&(mutex->lock)); + while (mutex->signalled != true) { + pthread_cond_wait(&(mutex->cond), &(mutex->lock)); + } + val = mutex->counter; + pthread_mutex_unlock(&(mutex->lock)); + + (void)TestBufferPoolAllocator::UnmapMemoryForMutex(mem); + if (rhandle) { + native_handle_close(rhandle); + native_handle_delete(rhandle); + } + } + if (val == kSignalInt) { + message.data.command = PipeCommand::RECEIVE_OK; + } else { + message.data.command = PipeCommand::RECEIVE_ERROR; + } + sendMessage(mResultPipeFds, message); + } +}; + +// Buffer transfer test between processes. +TEST_F(BufferpoolMultiTest, TransferBuffer) { + ResultStatus status; + PipeMessage message; + + ASSERT_TRUE(receiveMessage(mResultPipeFds, &message)); + + android::sp receiver = IClientManager::getService(); + ConnectionId receiverId; + ASSERT_TRUE((bool)receiver); + + status = mManager->registerSender(receiver, mConnectionId, &receiverId); + ASSERT_TRUE(status == ResultStatus::OK); + { + native_handle_t *shandle = nullptr; + std::shared_ptr sbuffer; + TransactionId transactionId; + int64_t postUs; + std::vector vecParams; + void *mem = nullptr; + IpcMutex *mutex = nullptr; + + getIpcMutexParams(&vecParams); + status = mManager->allocate(mConnectionId, vecParams, &shandle, &sbuffer); + ASSERT_TRUE(status == ResultStatus::OK); + + ASSERT_TRUE(TestBufferPoolAllocator::MapMemoryForMutex(shandle, &mem)); + + mutex = new(mem) IpcMutex(); + mutex->init(); + + status = mManager->postSend(receiverId, sbuffer, &transactionId, &postUs); + ASSERT_TRUE(status == ResultStatus::OK); + + message.data.command = PipeCommand::SEND; + message.data.bufferId = sbuffer->mId; + message.data.connectionId = receiverId; + message.data.transactionId = transactionId; + message.data.timestampUs = postUs; + sendMessage(mCommandPipeFds, message); + for (int i=0; i < 200000000; ++i) { + // no-op in order to ensure + // pthread_cond_wait is called before pthread_cond_signal + } + pthread_mutex_lock(&(mutex->lock)); + mutex->counter = kSignalInt; + mutex->signalled = true; + pthread_cond_signal(&(mutex->cond)); + pthread_mutex_unlock(&(mutex->lock)); + (void)TestBufferPoolAllocator::UnmapMemoryForMutex(mem); + if (shandle) { + native_handle_close(shandle); + native_handle_delete(shandle); + } + } + EXPECT_TRUE(receiveMessage(mResultPipeFds, &message)); + EXPECT_TRUE(message.data.command == PipeCommand::RECEIVE_OK); +} + +} // anonymous namespace + +int main(int argc, char** argv) { + android::hardware::details::setTrebleTestingOverride(true); + ::testing::InitGoogleTest(&argc, argv); + int status = RUN_ALL_TESTS(); + LOG(INFO) << "Test result = " << status; + return status; +} diff --git a/media/bufferpool/aidl/default/tests/multi.cpp b/media/bufferpool/aidl/default/tests/multi.cpp new file mode 100644 index 0000000000..43b0a8c271 --- /dev/null +++ b/media/bufferpool/aidl/default/tests/multi.cpp @@ -0,0 +1,235 @@ +/* + * Copyright (C) 2018 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. + */ + +#define LOG_TAG "buffferpool_unit_test" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "allocator.h" + +using android::hardware::configureRpcThreadpool; +using android::hardware::hidl_handle; +using android::hardware::media::bufferpool::V2_0::IClientManager; +using android::hardware::media::bufferpool::V2_0::ResultStatus; +using android::hardware::media::bufferpool::V2_0::implementation::BufferId; +using android::hardware::media::bufferpool::V2_0::implementation::ClientManager; +using android::hardware::media::bufferpool::V2_0::implementation::ConnectionId; +using android::hardware::media::bufferpool::V2_0::implementation::TransactionId; +using android::hardware::media::bufferpool::BufferPoolData; + +namespace { + +// communication message types between processes. +enum PipeCommand : int32_t { + INIT_OK = 0, + INIT_ERROR, + SEND, + RECEIVE_OK, + RECEIVE_ERROR, +}; + +// communication message between processes. +union PipeMessage { + struct { + int32_t command; + BufferId bufferId; + ConnectionId connectionId; + TransactionId transactionId; + int64_t timestampUs; + } data; + char array[0]; +}; + +// media.bufferpool test setup +class BufferpoolMultiTest : public ::testing::Test { + public: + virtual void SetUp() override { + ResultStatus status; + mReceiverPid = -1; + mConnectionValid = false; + + ASSERT_TRUE(pipe(mCommandPipeFds) == 0); + ASSERT_TRUE(pipe(mResultPipeFds) == 0); + + mReceiverPid = fork(); + ASSERT_TRUE(mReceiverPid >= 0); + + if (mReceiverPid == 0) { + doReceiver(); + // In order to ignore gtest behaviour, wait for being killed from + // tearDown + pause(); + } + + mManager = ClientManager::getInstance(); + ASSERT_NE(mManager, nullptr); + + mAllocator = std::make_shared(); + ASSERT_TRUE((bool)mAllocator); + + status = mManager->create(mAllocator, &mConnectionId); + ASSERT_TRUE(status == ResultStatus::OK); + mConnectionValid = true; + } + + virtual void TearDown() override { + if (mReceiverPid > 0) { + kill(mReceiverPid, SIGKILL); + int wstatus; + wait(&wstatus); + } + + if (mConnectionValid) { + mManager->close(mConnectionId); + } + } + + protected: + static void description(const std::string& description) { + RecordProperty("description", description); + } + + android::sp mManager; + std::shared_ptr mAllocator; + bool mConnectionValid; + ConnectionId mConnectionId; + pid_t mReceiverPid; + int mCommandPipeFds[2]; + int mResultPipeFds[2]; + + bool sendMessage(int *pipes, const PipeMessage &message) { + int ret = write(pipes[1], message.array, sizeof(PipeMessage)); + return ret == sizeof(PipeMessage); + } + + bool receiveMessage(int *pipes, PipeMessage *message) { + int ret = read(pipes[0], message->array, sizeof(PipeMessage)); + return ret == sizeof(PipeMessage); + } + + void doReceiver() { + configureRpcThreadpool(1, false); + PipeMessage message; + mManager = ClientManager::getInstance(); + if (!mManager) { + message.data.command = PipeCommand::INIT_ERROR; + sendMessage(mResultPipeFds, message); + return; + } + android::status_t status = mManager->registerAsService(); + if (status != android::OK) { + message.data.command = PipeCommand::INIT_ERROR; + sendMessage(mResultPipeFds, message); + return; + } + message.data.command = PipeCommand::INIT_OK; + sendMessage(mResultPipeFds, message); + + receiveMessage(mCommandPipeFds, &message); + { + native_handle_t *rhandle = nullptr; + std::shared_ptr rbuffer; + ResultStatus status = mManager->receive( + message.data.connectionId, message.data.transactionId, + message.data.bufferId, message.data.timestampUs, &rhandle, &rbuffer); + mManager->close(message.data.connectionId); + if (status != ResultStatus::OK) { + message.data.command = PipeCommand::RECEIVE_ERROR; + sendMessage(mResultPipeFds, message); + return; + } + if (!TestBufferPoolAllocator::Verify(rhandle, 0x77)) { + message.data.command = PipeCommand::RECEIVE_ERROR; + sendMessage(mResultPipeFds, message); + return; + } + if (rhandle) { + native_handle_close(rhandle); + native_handle_delete(rhandle); + } + } + message.data.command = PipeCommand::RECEIVE_OK; + sendMessage(mResultPipeFds, message); + } +}; + +// Buffer transfer test between processes. +TEST_F(BufferpoolMultiTest, TransferBuffer) { + ResultStatus status; + PipeMessage message; + + ASSERT_TRUE(receiveMessage(mResultPipeFds, &message)); + + android::sp receiver = IClientManager::getService(); + ConnectionId receiverId; + ASSERT_TRUE((bool)receiver); + + status = mManager->registerSender(receiver, mConnectionId, &receiverId); + ASSERT_TRUE(status == ResultStatus::OK); + { + native_handle_t *shandle = nullptr; + std::shared_ptr sbuffer; + TransactionId transactionId; + int64_t postUs; + std::vector vecParams; + + getTestAllocatorParams(&vecParams); + status = mManager->allocate(mConnectionId, vecParams, &shandle, &sbuffer); + ASSERT_TRUE(status == ResultStatus::OK); + + ASSERT_TRUE(TestBufferPoolAllocator::Fill(shandle, 0x77)); + if (shandle) { + native_handle_close(shandle); + native_handle_delete(shandle); + } + + status = mManager->postSend(receiverId, sbuffer, &transactionId, &postUs); + ASSERT_TRUE(status == ResultStatus::OK); + + message.data.command = PipeCommand::SEND; + message.data.bufferId = sbuffer->mId; + message.data.connectionId = receiverId; + message.data.transactionId = transactionId; + message.data.timestampUs = postUs; + sendMessage(mCommandPipeFds, message); + } + EXPECT_TRUE(receiveMessage(mResultPipeFds, &message)); + EXPECT_TRUE(message.data.command == PipeCommand::RECEIVE_OK); +} + +} // anonymous namespace + +int main(int argc, char** argv) { + android::hardware::details::setTrebleTestingOverride(true); + ::testing::InitGoogleTest(&argc, argv); + int status = RUN_ALL_TESTS(); + LOG(INFO) << "Test result = " << status; + return status; +} diff --git a/media/bufferpool/aidl/default/tests/single.cpp b/media/bufferpool/aidl/default/tests/single.cpp new file mode 100644 index 0000000000..1e9027b0c0 --- /dev/null +++ b/media/bufferpool/aidl/default/tests/single.cpp @@ -0,0 +1,183 @@ +/* + * Copyright (C) 2018 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. + */ + +#define LOG_TAG "buffferpool_unit_test" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "allocator.h" + +using android::hardware::hidl_handle; +using android::hardware::media::bufferpool::V2_0::ResultStatus; +using android::hardware::media::bufferpool::V2_0::implementation::BufferId; +using android::hardware::media::bufferpool::V2_0::implementation::ClientManager; +using android::hardware::media::bufferpool::V2_0::implementation::ConnectionId; +using android::hardware::media::bufferpool::V2_0::implementation::TransactionId; +using android::hardware::media::bufferpool::BufferPoolData; + +namespace { + +// Number of iteration for buffer allocation test. +constexpr static int kNumAllocationTest = 3; + +// Number of iteration for buffer recycling test. +constexpr static int kNumRecycleTest = 3; + +// media.bufferpool test setup +class BufferpoolSingleTest : public ::testing::Test { + public: + virtual void SetUp() override { + ResultStatus status; + mConnectionValid = false; + + mManager = ClientManager::getInstance(); + ASSERT_NE(mManager, nullptr); + + mAllocator = std::make_shared(); + ASSERT_TRUE((bool)mAllocator); + + status = mManager->create(mAllocator, &mConnectionId); + ASSERT_TRUE(status == ResultStatus::OK); + + mConnectionValid = true; + + status = mManager->registerSender(mManager, mConnectionId, &mReceiverId); + ASSERT_TRUE(status == ResultStatus::ALREADY_EXISTS && + mReceiverId == mConnectionId); + } + + virtual void TearDown() override { + if (mConnectionValid) { + mManager->close(mConnectionId); + } + } + + protected: + static void description(const std::string& description) { + RecordProperty("description", description); + } + + android::sp mManager; + std::shared_ptr mAllocator; + bool mConnectionValid; + ConnectionId mConnectionId; + ConnectionId mReceiverId; + +}; + +// Buffer allocation test. +// Check whether each buffer allocation is done successfully with +// unique buffer id. +TEST_F(BufferpoolSingleTest, AllocateBuffer) { + ResultStatus status; + std::vector vecParams; + getTestAllocatorParams(&vecParams); + + std::shared_ptr buffer[kNumAllocationTest]; + native_handle_t *allocHandle = nullptr; + for (int i = 0; i < kNumAllocationTest; ++i) { + status = mManager->allocate(mConnectionId, vecParams, &allocHandle, &buffer[i]); + ASSERT_TRUE(status == ResultStatus::OK); + if (allocHandle) { + native_handle_close(allocHandle); + native_handle_delete(allocHandle); + } + } + for (int i = 0; i < kNumAllocationTest; ++i) { + for (int j = i + 1; j < kNumAllocationTest; ++j) { + ASSERT_TRUE(buffer[i]->mId != buffer[j]->mId); + } + } + EXPECT_TRUE(kNumAllocationTest > 1); +} + +// Buffer recycle test. +// Check whether de-allocated buffers are recycled. +TEST_F(BufferpoolSingleTest, RecycleBuffer) { + ResultStatus status; + std::vector vecParams; + getTestAllocatorParams(&vecParams); + + BufferId bid[kNumRecycleTest]; + for (int i = 0; i < kNumRecycleTest; ++i) { + std::shared_ptr buffer; + native_handle_t *allocHandle = nullptr; + status = mManager->allocate(mConnectionId, vecParams, &allocHandle, &buffer); + ASSERT_TRUE(status == ResultStatus::OK); + bid[i] = buffer->mId; + if (allocHandle) { + native_handle_close(allocHandle); + native_handle_delete(allocHandle); + } + } + for (int i = 1; i < kNumRecycleTest; ++i) { + ASSERT_TRUE(bid[i - 1] == bid[i]); + } + EXPECT_TRUE(kNumRecycleTest > 1); +} + +// Buffer transfer test. +// Check whether buffer is transferred to another client successfully. +TEST_F(BufferpoolSingleTest, TransferBuffer) { + ResultStatus status; + std::vector vecParams; + getTestAllocatorParams(&vecParams); + std::shared_ptr sbuffer, rbuffer; + native_handle_t *allocHandle = nullptr; + native_handle_t *recvHandle = nullptr; + + TransactionId transactionId; + int64_t postUs; + + status = mManager->allocate(mConnectionId, vecParams, &allocHandle, &sbuffer); + ASSERT_TRUE(status == ResultStatus::OK); + ASSERT_TRUE(TestBufferPoolAllocator::Fill(allocHandle, 0x77)); + status = mManager->postSend(mReceiverId, sbuffer, &transactionId, &postUs); + ASSERT_TRUE(status == ResultStatus::OK); + status = mManager->receive(mReceiverId, transactionId, sbuffer->mId, postUs, + &recvHandle, &rbuffer); + EXPECT_TRUE(status == ResultStatus::OK); + ASSERT_TRUE(TestBufferPoolAllocator::Verify(recvHandle, 0x77)); + + if (allocHandle) { + native_handle_close(allocHandle); + native_handle_delete(allocHandle); + } + if (recvHandle) { + native_handle_close(recvHandle); + native_handle_delete(recvHandle); + } +} + +} // anonymous namespace + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + int status = RUN_ALL_TESTS(); + LOG(INFO) << "Test result = " << status; + return status; +} From ad48f05c8f1bbab2656342e9db29a528bf124a7d Mon Sep 17 00:00:00 2001 From: Peiyong Lin Date: Mon, 19 Dec 2022 10:06:01 +0000 Subject: [PATCH 511/998] Require Power V4 for all new U devices. Bug: b/244216750 Change-Id: Ic0784cc2ecda8d3dd5b72691f39b460e2395c8b5 Test: atest VtsHalPowerTargetTest --- compatibility_matrices/compatibility_matrix.current.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index a907f206de..eca3d41a10 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -441,7 +441,7 @@
android.hardware.power - 2-4 + 4 IPower default From 24de83be34acc53d72b0a39c177363806dd2395a Mon Sep 17 00:00:00 2001 From: Brian Lindahl Date: Sun, 18 Dec 2022 11:20:12 -0700 Subject: [PATCH 512/998] Add to AIDL field to LayerCommand to clear buffer slots Bug: 262041682 Bug: 258196272 Test: presubmit Change-Id: Ib1819ccc2b53036b8d47cfd4d3d87d6ec07af7c5 --- .../android/hardware/graphics/composer3/LayerCommand.aidl | 1 + .../android/hardware/graphics/composer3/LayerCommand.aidl | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/LayerCommand.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/LayerCommand.aidl index 0c5fac9640..6d32218af1 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/LayerCommand.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/LayerCommand.aidl @@ -54,4 +54,5 @@ parcelable LayerCommand { @nullable android.hardware.graphics.composer3.PerFrameMetadata[] perFrameMetadata; @nullable android.hardware.graphics.composer3.PerFrameMetadataBlob[] perFrameMetadataBlob; @nullable android.hardware.graphics.common.Rect[] blockingRegion; + @nullable int[] bufferSlotsToClear; } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/LayerCommand.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/LayerCommand.aidl index f3b67a99b3..fd50be9cfe 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/LayerCommand.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/LayerCommand.aidl @@ -258,4 +258,11 @@ parcelable LayerCommand { * the screen. */ @nullable Rect[] blockingRegion; + + /** + * Specifies which buffer slots should be cleared of buffer references + * because these buffers will no longer be used and the memory should + * be freed. + */ + @nullable int[] bufferSlotsToClear; } From 1590d09ac37da2c4af9fd47cc1991133c82371ab Mon Sep 17 00:00:00 2001 From: Nate Jiang Date: Tue, 22 Nov 2022 17:03:29 -0800 Subject: [PATCH 513/998] [HAL] Support Wifi Aware 4.0 Bug: 249185683 Test: vts Change-Id: I769d3dfdefa74152c7d1e3b873399a9b4ecfbafd --- .../android/hardware/wifi/IWifiNanIface.aidl | 4 + .../wifi/IWifiNanIfaceEventCallback.aidl | 8 ++ .../wifi/NanBootstrappingConfirmInd.aidl | 40 ++++++++ .../hardware/wifi/NanBootstrappingMethod.aidl | 48 ++++++++++ .../wifi/NanBootstrappingRequest.aidl | 40 ++++++++ .../wifi/NanBootstrappingRequestInd.aidl | 42 ++++++++ .../wifi/NanBootstrappingResponse.aidl | 39 ++++++++ .../hardware/wifi/NanCapabilities.aidl | 3 + .../wifi/NanIdentityResolutionAttribute.aidl | 39 ++++++++ .../android/hardware/wifi/NanMatchInd.aidl | 2 + .../android/hardware/wifi/NanPairingAkm.aidl | 39 ++++++++ .../hardware/wifi/NanPairingConfig.aidl | 41 ++++++++ .../hardware/wifi/NanPairingConfirmInd.aidl | 43 +++++++++ .../hardware/wifi/NanPairingRequest.aidl | 43 +++++++++ .../hardware/wifi/NanPairingRequestInd.aidl | 44 +++++++++ .../hardware/wifi/NanPairingRequestType.aidl | 39 ++++++++ .../wifi/NanPairingSecurityConfig.aidl | 41 ++++++++ .../hardware/wifi/NanPairingSecurityType.aidl | 40 ++++++++ .../hardware/wifi/NanPublishRequest.aidl | 2 + .../NanRespondToPairingIndicationRequest.aidl | 43 +++++++++ .../android/hardware/wifi/NanStatusCode.aidl | 2 + .../hardware/wifi/NanSubscribeRequest.aidl | 2 + .../hardware/wifi/NpkSecurityAssociation.aidl | 41 ++++++++ .../android/hardware/wifi/IWifiNanIface.aidl | 62 ++++++++++++ .../wifi/IWifiNanIfaceEventCallback.aidl | 95 +++++++++++++++++++ .../wifi/NanBootstrappingConfirmInd.aidl | 39 ++++++++ .../hardware/wifi/NanBootstrappingMethod.aidl | 36 +++++++ .../wifi/NanBootstrappingRequest.aidl | 40 ++++++++ .../wifi/NanBootstrappingRequestInd.aidl | 54 +++++++++++ .../wifi/NanBootstrappingResponse.aidl | 31 ++++++ .../hardware/wifi/NanCapabilities.aidl | 14 ++- .../wifi/NanIdentityResolutionAttribute.aidl | 33 +++++++ .../android/hardware/wifi/NanMatchInd.aidl | 10 ++ .../android/hardware/wifi/NanPairingAkm.aidl | 22 +++++ .../hardware/wifi/NanPairingConfig.aidl | 42 ++++++++ .../hardware/wifi/NanPairingConfirmInd.aidl | 55 +++++++++++ .../hardware/wifi/NanPairingRequest.aidl | 56 +++++++++++ .../hardware/wifi/NanPairingRequestInd.aidl | 61 ++++++++++++ .../hardware/wifi/NanPairingRequestType.aidl | 27 ++++++ .../wifi/NanPairingSecurityConfig.aidl | 50 ++++++++++ .../hardware/wifi/NanPairingSecurityType.aidl | 28 ++++++ .../hardware/wifi/NanPublishRequest.aidl | 9 ++ .../NanRespondToPairingIndicationRequest.aidl | 53 +++++++++++ .../android/hardware/wifi/NanStatusCode.aidl | 8 ++ .../hardware/wifi/NanSubscribeRequest.aidl | 9 ++ .../hardware/wifi/NpkSecurityAssociation.aidl | 42 ++++++++ .../tests/wifi_nan_iface_unit_tests.cpp | 12 +++ .../functional/wifi_nan_iface_aidl_test.cpp | 78 +++++++++++++++ 48 files changed, 1650 insertions(+), 1 deletion(-) create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingConfirmInd.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingMethod.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingRequest.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingRequestInd.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingResponse.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanIdentityResolutionAttribute.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingAkm.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingConfig.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingConfirmInd.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequest.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequestInd.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequestType.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingSecurityConfig.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingSecurityType.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NpkSecurityAssociation.aidl create mode 100644 wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl create mode 100644 wifi/aidl/android/hardware/wifi/NanBootstrappingMethod.aidl create mode 100644 wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl create mode 100644 wifi/aidl/android/hardware/wifi/NanBootstrappingRequestInd.aidl create mode 100644 wifi/aidl/android/hardware/wifi/NanBootstrappingResponse.aidl create mode 100644 wifi/aidl/android/hardware/wifi/NanIdentityResolutionAttribute.aidl create mode 100644 wifi/aidl/android/hardware/wifi/NanPairingAkm.aidl create mode 100644 wifi/aidl/android/hardware/wifi/NanPairingConfig.aidl create mode 100644 wifi/aidl/android/hardware/wifi/NanPairingConfirmInd.aidl create mode 100644 wifi/aidl/android/hardware/wifi/NanPairingRequest.aidl create mode 100644 wifi/aidl/android/hardware/wifi/NanPairingRequestInd.aidl create mode 100644 wifi/aidl/android/hardware/wifi/NanPairingRequestType.aidl create mode 100644 wifi/aidl/android/hardware/wifi/NanPairingSecurityConfig.aidl create mode 100644 wifi/aidl/android/hardware/wifi/NanPairingSecurityType.aidl create mode 100644 wifi/aidl/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl create mode 100644 wifi/aidl/android/hardware/wifi/NpkSecurityAssociation.aidl diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIface.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIface.aidl index 070ca240cb..3dff5bf08b 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIface.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIface.aidl @@ -50,6 +50,10 @@ interface IWifiNanIface { void stopSubscribeRequest(in char cmdId, in byte sessionId); void terminateDataPathRequest(in char cmdId, in int ndpInstanceId); void transmitFollowupRequest(in char cmdId, in android.hardware.wifi.NanTransmitFollowupRequest msg); + void initiatePairingRequest(in char cmdId, in android.hardware.wifi.NanPairingRequest msg); + void respondToPairingIndicationRequest(in char cmdId, in android.hardware.wifi.NanRespondToPairingIndicationRequest msg); + void initiateBootstrappingRequest(in char cmdId, in android.hardware.wifi.NanBootstrappingRequest msg); + void respondToBootstrappingIndicationRequest(in char cmdId, in android.hardware.wifi.NanBootstrappingResponse msg); const int MIN_DATA_PATH_CONFIG_PASSPHRASE_LENGTH = 8; const int MAX_DATA_PATH_CONFIG_PASSPHRASE_LENGTH = 63; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl index 591cd8c205..b6c9d1ff41 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl @@ -60,4 +60,12 @@ interface IWifiNanIfaceEventCallback { oneway void notifyStopSubscribeResponse(in char id, in android.hardware.wifi.NanStatus status); oneway void notifyTerminateDataPathResponse(in char id, in android.hardware.wifi.NanStatus status); oneway void notifyTransmitFollowupResponse(in char id, in android.hardware.wifi.NanStatus status); + oneway void eventPairingRequest(in android.hardware.wifi.NanPairingRequestInd event); + oneway void eventPairingConfirm(in android.hardware.wifi.NanPairingConfirmInd event); + oneway void notifyInitiatePairingResponse(in char id, in android.hardware.wifi.NanStatus status, in int pairingInstanceId); + oneway void notifyRespondToPairingIndicationResponse(in char id, in android.hardware.wifi.NanStatus status); + oneway void eventBootstrappingRequest(in android.hardware.wifi.NanBootstrappingRequestInd event); + oneway void eventBootstrappingConfirm(in android.hardware.wifi.NanBootstrappingConfirmInd event); + oneway void notifyInitiateBootstrappingResponse(in char id, in android.hardware.wifi.NanStatus status, in int bootstrappingInstanceId); + oneway void notifyRespondToBootstrappingIndicationResponse(in char id, in android.hardware.wifi.NanStatus status); } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingConfirmInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingConfirmInd.aidl new file mode 100644 index 0000000000..65e85af505 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingConfirmInd.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanBootstrappingConfirmInd { + int bootstrappingInstanceId; + boolean acceptRequest; + android.hardware.wifi.NanStatus reasonCode; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingMethod.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingMethod.aidl new file mode 100644 index 0000000000..e5f0975c1c --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingMethod.aidl @@ -0,0 +1,48 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum NanBootstrappingMethod { + BOOTSTRAPPING_OPPORTUNISTIC_MASK = 1, + BOOTSTRAPPING_PIN_CODE_DISPLAY_MASK = 2, + BOOTSTRAPPING_PASSPHRASE_DISPLAY_MASK = 4, + BOOTSTRAPPING_QR_DISPLAY_MASK = 8, + BOOTSTRAPPING_NFC_TAG_MASK = 16, + BOOTSTRAPPING_PIN_CODE_KEYPAD_MASK = 32, + BOOTSTRAPPING_PASSPHRASE_KEYPAD_MASK = 64, + BOOTSTRAPPING_QR_SCAN_MASK = 128, + BOOTSTRAPPING_NFC_READER_MASK = 256, + BOOTSTRAPPING_SERVICE_MANAGED_MASK = 16384, + BOOTSTRAPPING_HANDSHAKE_SHIP_MASK = 32768, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingRequest.aidl new file mode 100644 index 0000000000..2be8924306 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingRequest.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanBootstrappingRequest { + int peerId; + byte[6] peerDiscMacAddr; + android.hardware.wifi.NanBootstrappingMethod requestBootstrappingMethod; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingRequestInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingRequestInd.aidl new file mode 100644 index 0000000000..a4398e9310 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingRequestInd.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanBootstrappingRequestInd { + byte discoverySessionId; + int peerId; + byte[6] peerDiscMacAddr; + int bootstrappingInstanceId; + android.hardware.wifi.NanBootstrappingMethod requestBootstrappingMethod; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingResponse.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingResponse.aidl new file mode 100644 index 0000000000..6dd9b2603a --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingResponse.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanBootstrappingResponse { + int bootstrappingInstanceId; + boolean acceptRequest; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl index c44654e4a3..5b59945ac3 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl @@ -49,4 +49,7 @@ parcelable NanCapabilities { int maxSubscribeInterfaceAddresses; android.hardware.wifi.NanCipherSuiteType supportedCipherSuites; boolean instantCommunicationModeSupportFlag; + boolean supports6g; + boolean supportsHe; + boolean supportsPairing; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanIdentityResolutionAttribute.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanIdentityResolutionAttribute.aidl new file mode 100644 index 0000000000..843107ea40 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanIdentityResolutionAttribute.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanIdentityResolutionAttribute { + byte[8] nonce; + byte[8] tag; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchInd.aidl index ae430c4df7..6757bec8ba 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchInd.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchInd.aidl @@ -49,4 +49,6 @@ parcelable NanMatchInd { int rangingMeasurementInMm; android.hardware.wifi.NanRangingIndication rangingIndicationType; byte[] scid; + android.hardware.wifi.NanPairingConfig peerPairingConfig; + android.hardware.wifi.NanIdentityResolutionAttribute peerNira; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingAkm.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingAkm.aidl new file mode 100644 index 0000000000..05bbaee0d5 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingAkm.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum NanPairingAkm { + SAE = 0, + PASN = 1, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingConfig.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingConfig.aidl new file mode 100644 index 0000000000..1c04a96d6c --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingConfig.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanPairingConfig { + boolean enablePairingSetup; + boolean enablePairingCache; + boolean enablePairingVerification; + int supportedBootstrappingMethods; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingConfirmInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingConfirmInd.aidl new file mode 100644 index 0000000000..8ecf22aa01 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingConfirmInd.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanPairingConfirmInd { + int pairingInstanceId; + boolean pairingSuccess; + android.hardware.wifi.NanStatus status; + android.hardware.wifi.NanPairingRequestType requestType; + boolean enablePairingCache; + android.hardware.wifi.NpkSecurityAssociation npksa; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequest.aidl new file mode 100644 index 0000000000..2a644ae63b --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequest.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanPairingRequest { + int peerId; + byte[6] peerDiscMacAddr; + android.hardware.wifi.NanPairingRequestType requestType; + boolean enablePairingCache; + byte[16] pairingIdentityKey; + android.hardware.wifi.NanPairingSecurityConfig securityConfig; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequestInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequestInd.aidl new file mode 100644 index 0000000000..66762b93e6 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequestInd.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanPairingRequestInd { + byte discoverySessionId; + int peerId; + byte[6] peerDiscMacAddr; + int pairingInstanceId; + android.hardware.wifi.NanPairingRequestType requestType; + boolean enablePairingCache; + android.hardware.wifi.NanIdentityResolutionAttribute peerNira; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequestType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequestType.aidl new file mode 100644 index 0000000000..9e73e80ec3 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequestType.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum NanPairingRequestType { + NAN_PAIRING_SETUP = 0, + NAN_PAIRING_VERIFICATION = 1, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingSecurityConfig.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingSecurityConfig.aidl new file mode 100644 index 0000000000..45af25dfe2 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingSecurityConfig.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanPairingSecurityConfig { + android.hardware.wifi.NanPairingSecurityType securityType; + byte[32] pmk; + byte[] passphrase; + android.hardware.wifi.NanPairingAkm akm; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingSecurityType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingSecurityType.aidl new file mode 100644 index 0000000000..a08a00f1b5 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingSecurityType.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum NanPairingSecurityType { + OPPORTUNISTIC = 0, + PMK = 1, + PASSPHRASE = 2, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPublishRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPublishRequest.aidl index d8d6b1bd61..c49f5f9012 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPublishRequest.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPublishRequest.aidl @@ -38,4 +38,6 @@ parcelable NanPublishRequest { android.hardware.wifi.NanPublishType publishType; android.hardware.wifi.NanTxType txType; boolean autoAcceptDataPathRequests; + android.hardware.wifi.NanPairingConfig pairingConfig; + byte[16] identityKey; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl new file mode 100644 index 0000000000..a58890c542 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanRespondToPairingIndicationRequest { + boolean acceptRequest; + int pairingInstanceId; + android.hardware.wifi.NanPairingRequestType requestType; + boolean enablePairingCache; + byte[16] pairingIdentityKey; + android.hardware.wifi.NanPairingSecurityConfig securityConfig; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanStatusCode.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanStatusCode.aidl index 9eaf518a2f..0fe22452c7 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanStatusCode.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanStatusCode.aidl @@ -47,4 +47,6 @@ enum NanStatusCode { ALREADY_ENABLED = 10, FOLLOWUP_TX_QUEUE_FULL = 11, UNSUPPORTED_CONCURRENCY_NAN_DISABLED = 12, + INVALID_PAIRING_ID = 13, + INVALID_BOOTSTRAPPING_ID = 14, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanSubscribeRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanSubscribeRequest.aidl index bf176a5a05..96be096d74 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanSubscribeRequest.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanSubscribeRequest.aidl @@ -41,4 +41,6 @@ parcelable NanSubscribeRequest { boolean shouldUseSrf; boolean isSsiRequiredForMatch; android.hardware.wifi.MacAddress[] intfAddr; + android.hardware.wifi.NanPairingConfig pairingConfig; + byte[16] identityKey; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NpkSecurityAssociation.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NpkSecurityAssociation.aidl new file mode 100644 index 0000000000..c5587163a0 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NpkSecurityAssociation.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NpkSecurityAssociation { + byte[16] peerNanIdentityKey; + byte[16] localNanIdentityKey; + byte[32] npk; + android.hardware.wifi.NanPairingAkm akm; +} diff --git a/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl b/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl index 45644b402e..31c7ecefd6 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl @@ -17,12 +17,16 @@ package android.hardware.wifi; import android.hardware.wifi.IWifiNanIfaceEventCallback; +import android.hardware.wifi.NanBootstrappingRequest; +import android.hardware.wifi.NanBootstrappingResponse; import android.hardware.wifi.NanConfigRequest; import android.hardware.wifi.NanConfigRequestSupplemental; import android.hardware.wifi.NanEnableRequest; import android.hardware.wifi.NanInitiateDataPathRequest; +import android.hardware.wifi.NanPairingRequest; import android.hardware.wifi.NanPublishRequest; import android.hardware.wifi.NanRespondToDataPathIndicationRequest; +import android.hardware.wifi.NanRespondToPairingIndicationRequest; import android.hardware.wifi.NanSubscribeRequest; import android.hardware.wifi.NanTransmitFollowupRequest; @@ -248,4 +252,62 @@ interface IWifiNanIface { * |WifiStatusCode.ERROR_UNKNOWN| */ void transmitFollowupRequest(in char cmdId, in NanTransmitFollowupRequest msg); + + /** + * Initiate a NAN pairing operation: Initiator. + * Asynchronous response is with |IWifiNanIfaceEventCallback.notifyInitiatePairingResponse|. + * + * @param cmdId Command Id to use for this invocation. + * @param msg Instance of |NanPairingRequest|. + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, + * |WifiStatusCode.ERROR_INVALID_ARGS|, + * |WifiStatusCode.ERROR_UNKNOWN| + */ + void initiatePairingRequest(in char cmdId, in NanPairingRequest msg); + + /** + * Respond to a received request indication of NAN pairing setup operation. + * An indication is received by the Responder from the Initiator. + * Asynchronous response is with + * |IWifiNanIfaceEventCallback.notifyRespondToPairingIndicationResponse|. + * + * @param cmdId Command Id to use for this invocation. + * @param msg Instance of |NanRespondToPairingIndicationRequest|. + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, + * |WifiStatusCode.ERROR_INVALID_ARGS|, + * |WifiStatusCode.ERROR_UNKNOWN| + */ + void respondToPairingIndicationRequest( + in char cmdId, in NanRespondToPairingIndicationRequest msg); + + /** + * Initiate a NAN pairing bootstrapping operation: Initiator. + * Asynchronous response is with + * |IWifiNanIfaceEventCallback.notifyInitiateBootstrappingResponse|. + * + * @param cmdId Command Id to use for this invocation. + * @param msg Instance of |NanBootstrappingRequest|. + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, + * |WifiStatusCode.ERROR_INVALID_ARGS|, + * |WifiStatusCode.ERROR_UNKNOWN| + */ + void initiateBootstrappingRequest(in char cmdId, in NanBootstrappingRequest msg); + + /** + * Respond to a received request indication of NAN pairing bootstrapping operation. + * An indication is received by the Responder from the Initiator. + * Asynchronous response is with + * |IWifiNanIfaceEventCallback.notifyRespondToPairingIndicationResponse|. + * + * @param cmdId Command Id to use for this invocation. + * @param msg Instance of |notifyRespondToBootstrappingIndicationResponse|. + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, + * |WifiStatusCode.ERROR_INVALID_ARGS|, + * |WifiStatusCode.ERROR_UNKNOWN| + */ + void respondToBootstrappingIndicationRequest(in char cmdId, in NanBootstrappingResponse msg); } diff --git a/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl b/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl index 470b7ba013..6b06defefd 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl @@ -16,6 +16,8 @@ package android.hardware.wifi; +import android.hardware.wifi.NanBootstrappingConfirmInd; +import android.hardware.wifi.NanBootstrappingRequestInd; import android.hardware.wifi.NanCapabilities; import android.hardware.wifi.NanClusterEventInd; import android.hardware.wifi.NanDataPathConfirmInd; @@ -23,6 +25,8 @@ import android.hardware.wifi.NanDataPathRequestInd; import android.hardware.wifi.NanDataPathScheduleUpdateInd; import android.hardware.wifi.NanFollowupReceivedInd; import android.hardware.wifi.NanMatchInd; +import android.hardware.wifi.NanPairingConfirmInd; +import android.hardware.wifi.NanPairingRequestInd; import android.hardware.wifi.NanStatus; /** @@ -319,4 +323,95 @@ oneway interface IWifiNanIfaceEventCallback { * |NanStatusCode.FOLLOWUP_TX_QUEUE_FULL| */ void notifyTransmitFollowupResponse(in char id, in NanStatus status); + + /** + * Callback indicating that a NAN pairing setup/verification has been requested by + * an Initiator peer (received by the intended Responder). + * + * @param event NanPairingRequestInd containing event details. + */ + void eventPairingRequest(in NanPairingRequestInd event); + + /** + * Callback indicating that a NAN pairing setup/verification has been completed. + * Received by both Initiator and Responder. + * + * @param event NanPairingConfirmInd containing event details. + */ + void eventPairingConfirm(in NanPairingConfirmInd event); + + /** + * Callback invoked in response to an initiate NAN pairing request + * |IWifiNanIface.initiatePairingRequest|. + * + * @param cmdId Command Id corresponding to the original request. + * @param status NanStatus of the operation. Possible status codes are: + * |NanStatusCode.SUCCESS| + * |NanStatusCode.INVALID_ARGS| + * |NanStatusCode.INTERNAL_FAILURE| + * |NanStatusCode.PROTOCOL_FAILURE| + * |NanStatusCode.INVALID_PEER_ID| + * @param pairingInstanceId ID of the new pairing being negotiated (on successful status). + */ + void notifyInitiatePairingResponse(in char id, in NanStatus status, in int pairingInstanceId); + + /** + * Callback invoked in response to a respond to NAN pairing indication request + * |IWifiNanIface.respondToPairingIndicationRequest|. + * + * @param cmdId Command Id corresponding to the original request. + * @param status NanStatus of the operation. Possible status codes are: + * |NanStatusCode.SUCCESS| + * |NanStatusCode.INVALID_ARGS| + * |NanStatusCode.INTERNAL_FAILURE| + * |NanStatusCode.PROTOCOL_FAILURE| + * |NanStatusCode.INVALID_NDP_ID| + */ + void notifyRespondToPairingIndicationResponse(in char id, in NanStatus status); + + /** + * Callback indicating that a NAN bootstrapping setup has been requested by + * an Initiator peer (received by the intended Responder). + * + * @param event NanBootstrappingRequestInd containing event details. + */ + void eventBootstrappingRequest(in NanBootstrappingRequestInd event); + + /** + * Callback indicating that a NAN bootstrapping setuphas been completed. + * Received by Initiator. + * + * @param event NanBootstrappingConfirmInd containing event details. + */ + void eventBootstrappingConfirm(in NanBootstrappingConfirmInd event); + + /** + * Callback invoked in response to an initiate NAN pairing bootstrapping request + * |IWifiNanIface.initiateBootstrappingRequest|. + * + * @param cmdId Command Id corresponding to the original request. + * @param status NanStatus of the operation. Possible status codes are: + * |NanStatusCode.SUCCESS| + * |NanStatusCode.INVALID_ARGS| + * |NanStatusCode.INTERNAL_FAILURE| + * |NanStatusCode.PROTOCOL_FAILURE| + * |NanStatusCode.INVALID_PEER_ID| + * @param bootstrappingInstanceId ID of the new pairing being negotiated (on successful status). + */ + void notifyInitiateBootstrappingResponse( + in char id, in NanStatus status, in int bootstrappingInstanceId); + + /** + * Callback invoked in response to a respond to pairing bootstrapping indication request + * |IWifiNanIface.respondToBootstrappingIndicationRequest|. + * + * @param cmdId Command Id corresponding to the original request. + * @param status NanStatus of the operation. Possible status codes are: + * |NanStatusCode.SUCCESS| + * |NanStatusCode.INVALID_ARGS| + * |NanStatusCode.INTERNAL_FAILURE| + * |NanStatusCode.PROTOCOL_FAILURE| + * |NanStatusCode.INVALID_NDP_ID| + */ + void notifyRespondToBootstrappingIndicationResponse(in char id, in NanStatus status); } diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl new file mode 100644 index 0000000000..5a539eed2f --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ + +package android.hardware.wifi; + +import android.hardware.wifi.NanBootstrappingMethod; +import android.hardware.wifi.NanStatus; + +@VintfStability +parcelable NanBootstrappingConfirmInd { + /** + * Id of the bootstrapping session. Obtained as part of earlier + |IWifiNanIface.initiateBootstrappingRequest| success notification. + */ + int bootstrappingInstanceId; + + /** + * Indicate whether the bootstrapping method negotiation accept or not + */ + boolean acceptRequest; + + /** + * Failure reason if |acceptRequest| is false. + */ + NanStatus reasonCode; +} diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingMethod.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingMethod.aidl new file mode 100644 index 0000000000..8960794679 --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingMethod.aidl @@ -0,0 +1,36 @@ +/* + * 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. + */ + +package android.hardware.wifi; + +/** + * Pairing bootstrapping method flag + */ +@VintfStability +@Backing(type="int") +enum NanBootstrappingMethod { + BOOTSTRAPPING_OPPORTUNISTIC_MASK = 1 << 0, + BOOTSTRAPPING_PIN_CODE_DISPLAY_MASK = 1 << 1, + BOOTSTRAPPING_PASSPHRASE_DISPLAY_MASK = 1 << 2, + BOOTSTRAPPING_QR_DISPLAY_MASK = 1 << 3, + BOOTSTRAPPING_NFC_TAG_MASK = 1 << 4, + BOOTSTRAPPING_PIN_CODE_KEYPAD_MASK = 1 << 5, + BOOTSTRAPPING_PASSPHRASE_KEYPAD_MASK = 1 << 6, + BOOTSTRAPPING_QR_SCAN_MASK = 1 << 7, + BOOTSTRAPPING_NFC_READER_MASK = 1 << 8, + BOOTSTRAPPING_SERVICE_MANAGED_MASK = 1 << 14, + BOOTSTRAPPING_HANDSHAKE_SHIP_MASK = 1 << 15 +} diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl new file mode 100644 index 0000000000..d553245e0b --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ + +package android.hardware.wifi; + +import android.hardware.wifi.NanBootstrappingMethod; + +@VintfStability +parcelable NanBootstrappingRequest { + /** + * ID of the peer. Obtained as part of an earlier |IWifiNanIfaceEventCallback.eventMatch| or + * |IWifiNanIfaceEventCallback.eventFollowupReceived|. + */ + int peerId; + + /** + * NAN management interface MAC address of the peer. Obtained as part of an earlier + * |IWifiNanIfaceEventCallback.eventMatch| or + * |IWifiNanIfaceEventCallback.eventFollowupReceived|. + */ + byte[6] peerDiscMacAddr; + + /** + * Bootstrapping method in the request, one of the |NanBootstrappingMethod| + */ + NanBootstrappingMethod requestBootstrappingMethod; +} diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequestInd.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequestInd.aidl new file mode 100644 index 0000000000..e11122fbc0 --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequestInd.aidl @@ -0,0 +1,54 @@ +/* + * 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. + */ + +package android.hardware.wifi; + +import android.hardware.wifi.NanBootstrappingMethod; + +/** + * NAN Data path request indication message structure. + * Event indication received by an intended Responder when a NAN + * data request initiated by an Initiator. + */ +@VintfStability +parcelable NanBootstrappingRequestInd { + /** + * Discovery session (publish or subscribe) ID of a previously created discovery session. The + * bootstrapping request is received in the context of this discovery session. + * NAN Spec: Service Descriptor Attribute (SDA) / Instance ID + */ + byte discoverySessionId; + /** + * A unique ID of the peer. Can be subsequently used in |IWifiNanIface.transmitFollowupRequest| + * or to set up a data-path. + */ + int peerId; + /** + * MAC address of the Initiator peer. This is the MAC address of the peer's + * management/discovery NAN interface. + */ + byte[6] peerDiscMacAddr; + + /** + * ID of bootstrapping session. Used to identify the bootstrapping further negotiation/APIs. + */ + int bootstrappingInstanceId; + + /** + * Bootstrapping method in the incoming request, one of the |NanBootstrappingMethod| + */ + NanBootstrappingMethod requestBootstrappingMethod; +} diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingResponse.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingResponse.aidl new file mode 100644 index 0000000000..0a7d62122a --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingResponse.aidl @@ -0,0 +1,31 @@ +/* + * 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. + */ + +package android.hardware.wifi; + +import android.hardware.wifi.NanBootstrappingMethod; + +@VintfStability +parcelable NanBootstrappingResponse { + /** + * ID of bootstrapping session. Used to identify the bootstrapping further negotiation/APIs. + */ + int bootstrappingInstanceId; + /** + * True if accept the request, false otherwise. + */ + boolean acceptRequest; +} diff --git a/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl b/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl index 6042a05da8..0955b4cd9d 100644 --- a/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl +++ b/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl @@ -82,7 +82,19 @@ parcelable NanCapabilities { */ NanCipherSuiteType supportedCipherSuites; /** - * Flag to indicate id instant communication mode is supported. + * Flag to indicate if instant communication mode is supported. */ boolean instantCommunicationModeSupportFlag; + /** + * Flag to indicate if 6 GHz is supported. + */ + boolean supports6g; + /** + * Flag to indicate if High Efficiency is supported. + */ + boolean supportsHe; + /** + * Flag to indicate if NAN pairing is supported. + */ + boolean supportsPairing; } diff --git a/wifi/aidl/android/hardware/wifi/NanIdentityResolutionAttribute.aidl b/wifi/aidl/android/hardware/wifi/NanIdentityResolutionAttribute.aidl new file mode 100644 index 0000000000..917feffc67 --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/NanIdentityResolutionAttribute.aidl @@ -0,0 +1,33 @@ +/* + * 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. + */ + +package android.hardware.wifi; + +/** + * NIRA for pairing identity resolution + */ +@VintfStability +parcelable NanIdentityResolutionAttribute { + /** + * A random byte string to generate tag + */ + byte[8] nonce; + + /** + * A resolvable identity to identify Nan identity key + */ + byte[8] tag; +} diff --git a/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl b/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl index 896cde0c82..be2fa316d0 100644 --- a/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl +++ b/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl @@ -17,6 +17,8 @@ package android.hardware.wifi; import android.hardware.wifi.NanCipherSuiteType; +import android.hardware.wifi.NanIdentityResolutionAttribute; +import android.hardware.wifi.NanPairingConfig; import android.hardware.wifi.NanRangingIndication; /** @@ -126,4 +128,12 @@ parcelable NanMatchInd { * setting up the Secure Data Path. */ byte[] scid; + /** + * The config for NAN pairing set by the peer + */ + NanPairingConfig peerPairingConfig; + /** + * The NIRA from peer for NAN pairing verification + */ + NanIdentityResolutionAttribute peerNira; } diff --git a/wifi/aidl/android/hardware/wifi/NanPairingAkm.aidl b/wifi/aidl/android/hardware/wifi/NanPairingAkm.aidl new file mode 100644 index 0000000000..31eeb2b92d --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/NanPairingAkm.aidl @@ -0,0 +1,22 @@ +/* + * 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. + */ + +package android.hardware.wifi; + +/** + * THe AKM used of NAN pairing + */ +@VintfStability @Backing(type="int") enum NanPairingAkm { SAE = 0, PASN=1 } diff --git a/wifi/aidl/android/hardware/wifi/NanPairingConfig.aidl b/wifi/aidl/android/hardware/wifi/NanPairingConfig.aidl new file mode 100644 index 0000000000..4f9c3ae968 --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/NanPairingConfig.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ + +package android.hardware.wifi; + +import android.hardware.wifi.NanBootstrappingMethod; + +/** + * The NAN pairing config + */ +@VintfStability +parcelable NanPairingConfig { + /** + * Enable NAN pairing setup + */ + boolean enablePairingSetup; + /** + * Enable cache NIK/NPK after NAN pairing setup + */ + boolean enablePairingCache; + /** + * Enable NAN pairing verification with cached NIK/NPK + */ + boolean enablePairingVerification; + /** + * The set of supported bootstrapping methods. The |NanBootstrappingMethod| bit fields are used. + */ + int supportedBootstrappingMethods; +} diff --git a/wifi/aidl/android/hardware/wifi/NanPairingConfirmInd.aidl b/wifi/aidl/android/hardware/wifi/NanPairingConfirmInd.aidl new file mode 100644 index 0000000000..cd98c725b8 --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/NanPairingConfirmInd.aidl @@ -0,0 +1,55 @@ +/* + * 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. + */ + +package android.hardware.wifi; + +import android.hardware.wifi.NanDataPathChannelInfo; +import android.hardware.wifi.NanPairingRequestType; +import android.hardware.wifi.NanStatus; +import android.hardware.wifi.NpkSecurityAssociation; + +/** + * NAN pairing confirmation indication structure. Event indication is + * received on both initiator and responder side when negotiation for a + * pairing finishes on success or failure. + */ +@VintfStability +parcelable NanPairingConfirmInd { + /** + * ID of the pairing session. + */ + int pairingInstanceId; + /** + * Indicates whether the pairing setup succeeded (true) or failed (false). + */ + boolean pairingSuccess; + /** + * Failure reason if |pairingSuccess| is false. + */ + NanStatus status; + /** + * Indicate the pairing session is of setup or verification + */ + NanPairingRequestType requestType; + /** + * Whether should cache the negotiated NIK/NPK for future verification + */ + boolean enablePairingCache; + /** + * The security association negotiated for the pairing, can be cached for future verification + */ + NpkSecurityAssociation npksa; +} diff --git a/wifi/aidl/android/hardware/wifi/NanPairingRequest.aidl b/wifi/aidl/android/hardware/wifi/NanPairingRequest.aidl new file mode 100644 index 0000000000..6f1a07269e --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/NanPairingRequest.aidl @@ -0,0 +1,56 @@ +/* + * 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. + */ + +package android.hardware.wifi; + +import android.hardware.wifi.NanPairingRequestType; +import android.hardware.wifi.NanPairingSecurityConfig; + +/** + * NAN pairing initiate request + * Which can be used for setup(the initial pairing request) or + * verification(re-pairing for paired devices) + */ +@VintfStability +parcelable NanPairingRequest { + /** + * ID of the peer. Obtained as part of an earlier |IWifiNanIfaceEventCallback.eventMatch| or + * |IWifiNanIfaceEventCallback.eventFollowupReceived|. + */ + int peerId; + /** + * NAN management interface MAC address of the peer. Obtained as part of an earlier + * |IWifiNanIfaceEventCallback.eventMatch| or + * |IWifiNanIfaceEventCallback.eventFollowupReceived|. + */ + byte[6] peerDiscMacAddr; + /** + * Indicate the pairing session is for setup or verification + */ + NanPairingRequestType requestType; + /** + * Whether to cache the negotiated NIK/NPK for future verification + */ + boolean enablePairingCache; + /** + * The Identity key for pairing, can be used for pairing verification + */ + byte[16] pairingIdentityKey; + /** + * Security config used for the pairing + */ + NanPairingSecurityConfig securityConfig; +} diff --git a/wifi/aidl/android/hardware/wifi/NanPairingRequestInd.aidl b/wifi/aidl/android/hardware/wifi/NanPairingRequestInd.aidl new file mode 100644 index 0000000000..f247e454be --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/NanPairingRequestInd.aidl @@ -0,0 +1,61 @@ +/* + * 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. + */ + +package android.hardware.wifi; + +import android.hardware.wifi.NanIdentityResolutionAttribute; +import android.hardware.wifi.NanPairingRequestType; + +/** + * NAN pairing request indication message structure. + * Event indication received by an intended Responder when a + * pairing request initiated by an Initiator. + */ +@VintfStability +parcelable NanPairingRequestInd { + /** + * Discovery session (publish or subscribe) ID of a previously created discovery session. The + * pairing request is received in the context of this discovery session. + * NAN Spec: Service Descriptor Attribute (SDA) / Instance ID + */ + byte discoverySessionId; + /** + * A unique ID of the peer. Can be subsequently used in |IWifiNanIface.transmitFollowupRequest| + * or to set up a data-path. + */ + int peerId; + /** + * MAC address of the Initiator peer. This is the MAC address of the peer's + * management/discovery NAN interface. + */ + byte[6] peerDiscMacAddr; + /** + * ID of the NAN pairing Used to identify the pairing in further negotiation/APIs. + */ + int pairingInstanceId; + /** + * Indicate the pairing session is of setup or verification + */ + NanPairingRequestType requestType; + /** + * Whether should cache the negotiated NIK/NPK for future verification + */ + boolean enablePairingCache; + /** + * The NIRA from peer for NAN pairing verification + */ + NanIdentityResolutionAttribute peerNira; +} diff --git a/wifi/aidl/android/hardware/wifi/NanPairingRequestType.aidl b/wifi/aidl/android/hardware/wifi/NanPairingRequestType.aidl new file mode 100644 index 0000000000..a69d04ec94 --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/NanPairingRequestType.aidl @@ -0,0 +1,27 @@ +/* + * 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. + */ + +package android.hardware.wifi; + +/** + * Type of the request of pairing + */ +@VintfStability +@Backing(type="int") +enum NanPairingRequestType { + NAN_PAIRING_SETUP = 0, + NAN_PAIRING_VERIFICATION +} diff --git a/wifi/aidl/android/hardware/wifi/NanPairingSecurityConfig.aidl b/wifi/aidl/android/hardware/wifi/NanPairingSecurityConfig.aidl new file mode 100644 index 0000000000..273c07e5b7 --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/NanPairingSecurityConfig.aidl @@ -0,0 +1,50 @@ +/* + * 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. + */ + +package android.hardware.wifi; + +import android.hardware.wifi.NanPairingAkm; +import android.hardware.wifi.NanPairingSecurityType; + +/** + * Configuration of NAN data-path security. + */ +@VintfStability +parcelable NanPairingSecurityConfig { + /** + * Security configuration of the NAN pairing. |NanPairingSecurityType.PMK| for verification. + * |NanPairingSecurityType.PASSPHRASE| and |NanPairingSecurityType.OPPORTUNISTIC| for setup + */ + NanPairingSecurityType securityType; + /** + * Optional Pairwise Master Key (PMK). Must be specified (and is only used) if |securityType| is + * set to |NanDataPathSecurityType.PMK|. + * Ref: IEEE 802.11i + */ + byte[32] pmk; + /** + * Optional Passphrase. Must be specified (and is only used) if |securityType| is set to + * |NanDataPathSecurityType.PASSPHRASE|. + * Min length: |IWifiNanIface.MIN_DATA_PATH_CONFIG_PASSPHRASE_LENGTH| + * Max length: |IWifiNanIface.MAX_DATA_PATH_CONFIG_PASSPHRASE_LENGTH| + * NAN Spec: Appendix: Mapping passphrase to PMK for NCS-SK Cipher Suites + */ + byte[] passphrase; + /** + * The AKM for key exchange + */ + NanPairingAkm akm; +} diff --git a/wifi/aidl/android/hardware/wifi/NanPairingSecurityType.aidl b/wifi/aidl/android/hardware/wifi/NanPairingSecurityType.aidl new file mode 100644 index 0000000000..0f97d516f6 --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/NanPairingSecurityType.aidl @@ -0,0 +1,28 @@ +/* + * 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. + */ + +package android.hardware.wifi; + +/** + * NAN pairing security configuration options. + */ +@VintfStability +@Backing(type="int") +enum NanPairingSecurityType { + OPPORTUNISTIC, + PMK, + PASSPHRASE, +} diff --git a/wifi/aidl/android/hardware/wifi/NanPublishRequest.aidl b/wifi/aidl/android/hardware/wifi/NanPublishRequest.aidl index 6dd079cea3..956a7dfb26 100644 --- a/wifi/aidl/android/hardware/wifi/NanPublishRequest.aidl +++ b/wifi/aidl/android/hardware/wifi/NanPublishRequest.aidl @@ -17,6 +17,7 @@ package android.hardware.wifi; import android.hardware.wifi.NanDiscoveryCommonConfig; +import android.hardware.wifi.NanPairingConfig; import android.hardware.wifi.NanPublishType; import android.hardware.wifi.NanTxType; @@ -46,4 +47,12 @@ parcelable NanPublishRequest { * the device must automatically accept the data-path request and complete the negotiation. */ boolean autoAcceptDataPathRequests; + /** + * The config for NAN pairing + */ + NanPairingConfig pairingConfig; + /** + * The Identity key for pairing, will generate NIRA for verification by the peer + */ + byte[16] identityKey; } diff --git a/wifi/aidl/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl b/wifi/aidl/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl new file mode 100644 index 0000000000..456b430957 --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl @@ -0,0 +1,53 @@ +/* + * 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. + */ + +package android.hardware.wifi; + +import android.hardware.wifi.NanPairingRequestType; +import android.hardware.wifi.NanPairingSecurityConfig; + +/** + * Response to a pairing request from a peer. + */ +@VintfStability +parcelable NanRespondToPairingIndicationRequest { + /** + * Accept (true) or reject (false) the request. + * NAN Spec: Data Path Attributes / NDP Attribute / Type and Status + */ + boolean acceptRequest; + /** + * ID of the NAN pairing for which we're responding. Obtained as part of the request in + * |IWifiNanIfaceEventCallback.eventPairingRequest|. + */ + int pairingInstanceId; + /** + * Indicate the pairing session is of setup or verification + */ + NanPairingRequestType requestType; + /** + * Whether should cache the negotiated NIK/NPK for future verification + */ + boolean enablePairingCache; + /** + * The Identity key for pairing, can be used for pairing verification + */ + byte[16] pairingIdentityKey; + /** + * Security config used for the pairing + */ + NanPairingSecurityConfig securityConfig; +} diff --git a/wifi/aidl/android/hardware/wifi/NanStatusCode.aidl b/wifi/aidl/android/hardware/wifi/NanStatusCode.aidl index d63a50e45a..efce86707c 100644 --- a/wifi/aidl/android/hardware/wifi/NanStatusCode.aidl +++ b/wifi/aidl/android/hardware/wifi/NanStatusCode.aidl @@ -71,4 +71,12 @@ enum NanStatusCode { * Unsupported concurrency of NAN and another feature - NAN disabled. */ UNSUPPORTED_CONCURRENCY_NAN_DISABLED = 12, + /** + * If the pairing id is invalid + */ + INVALID_PAIRING_ID = 13, + /** + * If the bootstrapping id is invalid + */ + INVALID_BOOTSTRAPPING_ID = 14 } diff --git a/wifi/aidl/android/hardware/wifi/NanSubscribeRequest.aidl b/wifi/aidl/android/hardware/wifi/NanSubscribeRequest.aidl index 12c11702b8..0b246eda8c 100644 --- a/wifi/aidl/android/hardware/wifi/NanSubscribeRequest.aidl +++ b/wifi/aidl/android/hardware/wifi/NanSubscribeRequest.aidl @@ -18,6 +18,7 @@ package android.hardware.wifi; import android.hardware.wifi.MacAddress; import android.hardware.wifi.NanDiscoveryCommonConfig; +import android.hardware.wifi.NanPairingConfig; import android.hardware.wifi.NanSrfType; import android.hardware.wifi.NanSubscribeType; @@ -67,4 +68,12 @@ parcelable NanSubscribeRequest { * NAN Spec: Service Descriptor Attribute (SDA) / Service Response Filter / Address Set */ MacAddress[] intfAddr; + /** + * Security config used for the pairing + */ + NanPairingConfig pairingConfig; + /** + * The Identity key for pairing, will generate NIRA for verification by the peer + */ + byte[16] identityKey; } diff --git a/wifi/aidl/android/hardware/wifi/NpkSecurityAssociation.aidl b/wifi/aidl/android/hardware/wifi/NpkSecurityAssociation.aidl new file mode 100644 index 0000000000..42612c05ec --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/NpkSecurityAssociation.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ + +package android.hardware.wifi; + +import android.hardware.wifi.NanPairingAkm; + +/** + * The security sssociation info after Aware Pairing setup. + */ +@VintfStability +parcelable NpkSecurityAssociation { + /** + * The Aware pairing identity from the peer + */ + byte[16] peerNanIdentityKey; + /** + * The Aware pairing identity for local device + */ + byte[16] localNanIdentityKey; + /** + * The PMK is used in this security association + */ + byte[32] npk; + /** + * The AKM is used for key exchange in this security sssociation + */ + NanPairingAkm akm; +} diff --git a/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp b/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp index d40801faef..f81cab3965 100644 --- a/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp +++ b/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp @@ -122,6 +122,18 @@ class MockNanIfaceEventCallback : public IWifiNanIfaceEventCallback { MOCK_METHOD1(eventDataPathTerminated, ndk::ScopedAStatus(int32_t)); MOCK_METHOD1(eventDataPathScheduleUpdate, ndk::ScopedAStatus(const NanDataPathScheduleUpdateInd&)); + MOCK_METHOD1(eventPairingConfirm, ndk::ScopedAStatus(const NanPairingConfirmInd&)); + MOCK_METHOD1(eventPairingRequest, ndk::ScopedAStatus(const NanPairingRequestInd&)); + MOCK_METHOD1(eventBootstrappingConfirm, ndk::ScopedAStatus(const NanBootstrappingConfirmInd&)); + MOCK_METHOD1(eventBootstrappingRequest, ndk::ScopedAStatus(const NanBootstrappingRequestInd&)); + MOCK_METHOD3(notifyInitiatePairingResponse, + ndk::ScopedAStatus(char16_t, const NanStatus&, int32_t)); + MOCK_METHOD2(notifyRespondToPairingIndicationResponse, + ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD3(notifyInitiateBootstrappingResponse, + ndk::ScopedAStatus(char16_t, const NanStatus&, int32_t)); + MOCK_METHOD2(notifyRespondToBootstrappingIndicationResponse, + ndk::ScopedAStatus(char16_t, const NanStatus&)); }; class WifiNanIfaceTest : public Test { diff --git a/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp index 457d57ad75..654eb02274 100644 --- a/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp +++ b/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp @@ -33,6 +33,8 @@ using aidl::android::hardware::wifi::BnWifiNanIfaceEventCallback; using aidl::android::hardware::wifi::IWifiNanIface; using aidl::android::hardware::wifi::NanBandIndex; using aidl::android::hardware::wifi::NanBandSpecificConfig; +using aidl::android::hardware::wifi::NanBootstrappingConfirmInd; +using aidl::android::hardware::wifi::NanBootstrappingRequestInd; using aidl::android::hardware::wifi::NanCapabilities; using aidl::android::hardware::wifi::NanClusterEventInd; using aidl::android::hardware::wifi::NanConfigRequest; @@ -46,6 +48,8 @@ using aidl::android::hardware::wifi::NanFollowupReceivedInd; using aidl::android::hardware::wifi::NanInitiateDataPathRequest; using aidl::android::hardware::wifi::NanMatchAlg; using aidl::android::hardware::wifi::NanMatchInd; +using aidl::android::hardware::wifi::NanPairingConfirmInd; +using aidl::android::hardware::wifi::NanPairingRequestInd; using aidl::android::hardware::wifi::NanPublishRequest; using aidl::android::hardware::wifi::NanPublishType; using aidl::android::hardware::wifi::NanRespondToDataPathIndicationRequest; @@ -96,6 +100,10 @@ class WifiNanIfaceAidlTest : public testing::TestWithParam { NOTIFY_INITIATE_DATA_PATH_RESPONSE, NOTIFY_RESPOND_TO_DATA_PATH_INDICATION_RESPONSE, NOTIFY_TERMINATE_DATA_PATH_RESPONSE, + NOTIFY_INITIATE_PAIRING_RESPONSE, + NOTIFY_RESPOND_TO_PAIRING_INDICATION_RESPONSE, + NOTIFY_INITIATE_BOOTSTRAPPING_RESPONSE, + NOTIFY_RESPOND_TO_BOOTSTRAPPING_INDICATION_RESPONSE, EVENT_CLUSTER_EVENT, EVENT_DISABLED, @@ -109,6 +117,10 @@ class WifiNanIfaceAidlTest : public testing::TestWithParam { EVENT_DATA_PATH_CONFIRM, EVENT_DATA_PATH_TERMINATED, EVENT_DATA_PATH_SCHEDULE_UPDATE, + EVENT_PAIRING_REQUEST, + EVENT_PAIRING_CONFIRM, + EVENT_BOOTSTRAPPING_REQUEST, + EVENT_BOOTSTRAPPING_CONFIRM, }; // Test code calls this function to wait for data/event callback. @@ -214,6 +226,32 @@ class WifiNanIfaceAidlTest : public testing::TestWithParam { parent_.notify(); return ndk::ScopedAStatus::ok(); } + ::ndk::ScopedAStatus eventPairingConfirm(const NanPairingConfirmInd& event) override { + parent_.callback_type_ = EVENT_PAIRING_CONFIRM; + parent_.nan_pairing_confirm_ind_ = event; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventPairingRequest(const NanPairingRequestInd& event) override { + parent_.callback_type_ = EVENT_PAIRING_REQUEST; + parent_.nan_pairing_request_ind_ = event; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventBootstrappingConfirm( + const NanBootstrappingConfirmInd& event) override { + parent_.callback_type_ = EVENT_BOOTSTRAPPING_CONFIRM; + parent_.nan_bootstrapping_confirm_ind_ = event; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus eventBootstrappingRequest( + const NanBootstrappingRequestInd& event) override { + parent_.callback_type_ = EVENT_BOOTSTRAPPING_REQUEST; + parent_.nan_bootstrapping_request_ind_ = event; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } ::ndk::ScopedAStatus notifyCapabilitiesResponse( char16_t id, const NanStatus& status, const NanCapabilities& capabilities) override { @@ -328,6 +366,40 @@ class WifiNanIfaceAidlTest : public testing::TestWithParam { parent_.notify(); return ndk::ScopedAStatus::ok(); } + ::ndk::ScopedAStatus notifyInitiatePairingResponse(char16_t id, const NanStatus& status, + int32_t pairingInstanceId) override { + parent_.callback_type_ = NOTIFY_INITIATE_PAIRING_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.pairing_instance_id_ = pairingInstanceId; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyRespondToPairingIndicationResponse( + char16_t id, const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_RESPOND_TO_PAIRING_INDICATION_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyInitiateBootstrappingResponse( + char16_t id, const NanStatus& status, int32_t bootstrapppingInstanceId) override { + parent_.callback_type_ = NOTIFY_INITIATE_BOOTSTRAPPING_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.bootstrappping_instance_id_ = bootstrapppingInstanceId; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyRespondToBootstrappingIndicationResponse( + char16_t id, const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_RESPOND_TO_BOOTSTRAPPING_INDICATION_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } private: WifiNanIfaceAidlTest& parent_; @@ -339,6 +411,8 @@ class WifiNanIfaceAidlTest : public testing::TestWithParam { uint16_t id_; uint8_t session_id_; uint32_t ndp_instance_id_; + uint32_t pairing_instance_id_; + uint32_t bootstrappping_instance_id_; uint32_t peer_id_; NanCapabilities capabilities_; NanClusterEventInd nan_cluster_event_ind_; @@ -348,6 +422,10 @@ class WifiNanIfaceAidlTest : public testing::TestWithParam { NanFollowupReceivedInd nan_followup_received_ind_; NanMatchInd nan_match_ind_; NanStatus status_; + NanPairingRequestInd nan_pairing_request_ind_; + NanPairingConfirmInd nan_pairing_confirm_ind_; + NanBootstrappingRequestInd nan_bootstrapping_request_ind_; + NanBootstrappingConfirmInd nan_bootstrapping_confirm_ind_; const char* getInstanceName() { return GetParam().c_str(); } From 38e8db5d92f498181b8a5964d4581ca2cd26e551 Mon Sep 17 00:00:00 2001 From: Nate Jiang Date: Fri, 2 Dec 2022 17:30:27 -0800 Subject: [PATCH 514/998] Add Shim layer for new HAL about Aware pairing Bug: 249185683 Test: None Change-Id: I87792a2b44afc6fb0d127b3b90f28e369e551242 --- wifi/aidl/default/aidl_struct_util.cpp | 419 +++++++++++++++++++- wifi/aidl/default/aidl_struct_util.h | 21 + wifi/aidl/default/wifi_legacy_hal.cpp | 107 ++++- wifi/aidl/default/wifi_legacy_hal.h | 39 ++ wifi/aidl/default/wifi_legacy_hal_stubs.cpp | 4 + wifi/aidl/default/wifi_nan_iface.cpp | 186 +++++++++ wifi/aidl/default/wifi_nan_iface.h | 16 + 7 files changed, 780 insertions(+), 12 deletions(-) diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index 3087d6654b..83fd587431 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -1261,6 +1261,165 @@ legacy_hal::NanDataPathChannelCfg convertAidlNanDataPathChannelCfgToLegacy( CHECK(false); } +legacy_hal::NanPairingRequestType convertAidlNanPairingRequestTypeToLegacy( + NanPairingRequestType type) { + switch (type) { + case NanPairingRequestType::NAN_PAIRING_SETUP: + return legacy_hal::NAN_PAIRING_SETUP; + case NanPairingRequestType::NAN_PAIRING_VERIFICATION: + return legacy_hal::NAN_PAIRING_VERIFICATION; + } + LOG(FATAL); +} + +NanPairingRequestType convertLegacyNanPairingRequestTypeToAidl( + legacy_hal::NanPairingRequestType type) { + switch (type) { + case legacy_hal::NAN_PAIRING_SETUP: + return NanPairingRequestType::NAN_PAIRING_SETUP; + case legacy_hal::NAN_PAIRING_VERIFICATION: + return NanPairingRequestType::NAN_PAIRING_VERIFICATION; + } + LOG(FATAL); +} + +legacy_hal::Akm convertAidlAkmTypeToLegacy(NanPairingAkm type) { + switch (type) { + case NanPairingAkm::SAE: + return legacy_hal::SAE; + case NanPairingAkm::PASN: + return legacy_hal::PASN; + } + LOG(FATAL); +} + +NanPairingAkm convertLegacyAkmTypeToAidl(legacy_hal::Akm type) { + switch (type) { + case legacy_hal::SAE: + return NanPairingAkm::SAE; + case legacy_hal::PASN: + return NanPairingAkm::PASN; + } + LOG(FATAL); +} + +uint16_t convertAidlBootstrappingMethodToLegacy(NanBootstrappingMethod type) { + switch (type) { + case NanBootstrappingMethod::BOOTSTRAPPING_OPPORTUNISTIC_MASK: + return NAN_PAIRING_BOOTSTRAPPING_OPPORTUNISTIC_MASK; + case NanBootstrappingMethod::BOOTSTRAPPING_PIN_CODE_DISPLAY_MASK: + return NAN_PAIRING_BOOTSTRAPPING_PIN_CODE_DISPLAY_MASK; + case NanBootstrappingMethod::BOOTSTRAPPING_PASSPHRASE_DISPLAY_MASK: + return NAN_PAIRING_BOOTSTRAPPING_PASSPHRASE_DISPLAY_MASK; + case NanBootstrappingMethod::BOOTSTRAPPING_QR_DISPLAY_MASK: + return NAN_PAIRING_BOOTSTRAPPING_QR_DISPLAY_MASK; + case NanBootstrappingMethod::BOOTSTRAPPING_NFC_TAG_MASK: + return NAN_PAIRING_BOOTSTRAPPING_NFC_TAG_MASK; + case NanBootstrappingMethod::BOOTSTRAPPING_PIN_CODE_KEYPAD_MASK: + return NAN_PAIRING_BOOTSTRAPPING_PIN_CODE_KEYPAD_MASK; + case NanBootstrappingMethod::BOOTSTRAPPING_PASSPHRASE_KEYPAD_MASK: + return NAN_PAIRING_BOOTSTRAPPING_PASSPHRASE_KEYPAD_MASK; + case NanBootstrappingMethod::BOOTSTRAPPING_QR_SCAN_MASK: + return NAN_PAIRING_BOOTSTRAPPING_QR_SCAN_MASK; + case NanBootstrappingMethod::BOOTSTRAPPING_NFC_READER_MASK: + return NAN_PAIRING_BOOTSTRAPPING_NFC_READER_MASK; + case NanBootstrappingMethod::BOOTSTRAPPING_SERVICE_MANAGED_MASK: + return NAN_PAIRING_BOOTSTRAPPING_SERVICE_MANAGED_MASK; + case NanBootstrappingMethod::BOOTSTRAPPING_HANDSHAKE_SHIP_MASK: + return NAN_PAIRING_BOOTSTRAPPING_HANDSHAKE_SHIP_MASK; + } + LOG(FATAL); +} + +NanBootstrappingMethod convertLegacyBootstrappingMethodToAidl(uint16_t type) { + switch (type) { + case NAN_PAIRING_BOOTSTRAPPING_OPPORTUNISTIC_MASK: + return NanBootstrappingMethod::BOOTSTRAPPING_OPPORTUNISTIC_MASK; + case NAN_PAIRING_BOOTSTRAPPING_PIN_CODE_DISPLAY_MASK: + return NanBootstrappingMethod::BOOTSTRAPPING_PIN_CODE_DISPLAY_MASK; + case NAN_PAIRING_BOOTSTRAPPING_PASSPHRASE_DISPLAY_MASK: + return NanBootstrappingMethod::BOOTSTRAPPING_PASSPHRASE_DISPLAY_MASK; + case NAN_PAIRING_BOOTSTRAPPING_QR_DISPLAY_MASK: + return NanBootstrappingMethod::BOOTSTRAPPING_QR_DISPLAY_MASK; + case NAN_PAIRING_BOOTSTRAPPING_NFC_TAG_MASK: + return NanBootstrappingMethod::BOOTSTRAPPING_NFC_TAG_MASK; + case NAN_PAIRING_BOOTSTRAPPING_PIN_CODE_KEYPAD_MASK: + return NanBootstrappingMethod::BOOTSTRAPPING_PIN_CODE_KEYPAD_MASK; + case NAN_PAIRING_BOOTSTRAPPING_PASSPHRASE_KEYPAD_MASK: + return NanBootstrappingMethod::BOOTSTRAPPING_PASSPHRASE_KEYPAD_MASK; + case NAN_PAIRING_BOOTSTRAPPING_QR_SCAN_MASK: + return NanBootstrappingMethod::BOOTSTRAPPING_QR_SCAN_MASK; + case NAN_PAIRING_BOOTSTRAPPING_NFC_READER_MASK: + return NanBootstrappingMethod::BOOTSTRAPPING_NFC_READER_MASK; + case NAN_PAIRING_BOOTSTRAPPING_SERVICE_MANAGED_MASK: + return NanBootstrappingMethod::BOOTSTRAPPING_SERVICE_MANAGED_MASK; + case NAN_PAIRING_BOOTSTRAPPING_HANDSHAKE_SHIP_MASK: + return NanBootstrappingMethod::BOOTSTRAPPING_HANDSHAKE_SHIP_MASK; + } + LOG(FATAL); + return {}; +} + +bool covertAidlPairingConfigToLegacy(const NanPairingConfig& aidl_config, + legacy_hal::NanPairingConfig* legacy_config) { + if (!legacy_config) { + LOG(ERROR) << "covertAidlPairingConfigToLegacy: legacy_config is null"; + return false; + } + legacy_config->enable_pairing_setup = aidl_config.enablePairingSetup ? 0x1 : 0x0; + legacy_config->enable_pairing_cache = aidl_config.enablePairingCache ? 0x1 : 0x0; + legacy_config->enable_pairing_verification = aidl_config.enablePairingVerification ? 0x1 : 0x0; + legacy_config->supported_bootstrapping_methods = aidl_config.supportedBootstrappingMethods; + return true; +} + +bool convertLegacyPairingConfigToAidl(const legacy_hal::NanPairingConfig& legacy_config, + NanPairingConfig* aidl_config) { + if (!aidl_config) { + LOG(ERROR) << "convertLegacyPairingConfigToAidl: aidl_nira is null"; + return false; + } + *aidl_config = {}; + aidl_config->enablePairingSetup = legacy_config.enable_pairing_setup == 0x1; + aidl_config->enablePairingCache = legacy_config.enable_pairing_cache == 0x1; + aidl_config->enablePairingVerification = legacy_config.enable_pairing_verification == 0x1; + aidl_config->supportedBootstrappingMethods = legacy_config.supported_bootstrapping_methods; + return true; +} + +bool convertLegacyNiraToAidl(const legacy_hal::NanIdentityResolutionAttribute& legacy_nira, + NanIdentityResolutionAttribute* aidl_nira) { + if (!aidl_nira) { + LOG(ERROR) << "convertLegacyNiraToAidl: aidl_nira is null"; + return false; + } + *aidl_nira = {}; + aidl_nira->nonce = std::array(); + std::copy(legacy_nira.nonce, legacy_nira.nonce + 8, std::begin(aidl_nira->nonce)); + aidl_nira->tag = std::array(); + std::copy(legacy_nira.tag, legacy_nira.tag + 8, std::begin(aidl_nira->tag)); + return true; +} + +bool convertLegacyNpsaToAidl(const legacy_hal::NpkSecurityAssociation& legacy_npsa, + NpkSecurityAssociation* aidl_npsa) { + if (!aidl_npsa) { + LOG(ERROR) << "convertLegacyNiraToAidl: aidl_nira is null"; + return false; + } + *aidl_npsa = {}; + aidl_npsa->peerNanIdentityKey = std::array(); + std::copy(legacy_npsa.peer_nan_identity_key, legacy_npsa.peer_nan_identity_key + 16, + std::begin(aidl_npsa->peerNanIdentityKey)); + aidl_npsa->localNanIdentityKey = std::array(); + std::copy(legacy_npsa.local_nan_identity_key, legacy_npsa.local_nan_identity_key + 16, + std::begin(aidl_npsa->localNanIdentityKey)); + aidl_npsa->npk = std::array(); + std::copy(legacy_npsa.npk.pmk, legacy_npsa.npk.pmk + 32, std::begin(aidl_npsa->npk)); + aidl_npsa->akm = convertLegacyAkmTypeToAidl(legacy_npsa.akm); + return true; +} + NanStatusCode convertLegacyNanStatusTypeToAidl(legacy_hal::NanStatusType type) { switch (type) { case legacy_hal::NAN_STATUS_SUCCESS: @@ -1289,6 +1448,10 @@ NanStatusCode convertLegacyNanStatusTypeToAidl(legacy_hal::NanStatusType type) { return NanStatusCode::FOLLOWUP_TX_QUEUE_FULL; case legacy_hal::NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED: return NanStatusCode::UNSUPPORTED_CONCURRENCY_NAN_DISABLED; + case legacy_hal::NAN_STATUS_INVALID_PAIRING_ID: + return NanStatusCode::INVALID_PAIRING_ID; + case legacy_hal::NAN_STATUS_INVALID_BOOTSTRAPPING_ID: + return NanStatusCode::INVALID_BOOTSTRAPPING_ID; } CHECK(false); } @@ -1679,6 +1842,12 @@ bool convertAidlNanPublishRequestToLegacy(const NanPublishRequest& aidl_request, legacy_request->service_responder_policy = aidl_request.autoAcceptDataPathRequests ? legacy_hal::NAN_SERVICE_ACCEPT_POLICY_ALL : legacy_hal::NAN_SERVICE_ACCEPT_POLICY_NONE; + memcpy(legacy_request->nan_identity_key, aidl_request.identityKey.data(), NAN_IDENTITY_KEY_LEN); + if (!covertAidlPairingConfigToLegacy(aidl_request.pairingConfig, + &legacy_request->nan_pairing_config)) { + LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: invalid pairing config"; + return false; + } return true; } @@ -1819,7 +1988,12 @@ bool convertAidlNanSubscribeRequestToLegacy(const NanSubscribeRequest& aidl_requ for (int i = 0; i < legacy_request->num_intf_addr_present; i++) { memcpy(legacy_request->intf_addr[i], aidl_request.intfAddr[i].data.data(), 6); } - + memcpy(legacy_request->nan_identity_key, aidl_request.identityKey.data(), NAN_IDENTITY_KEY_LEN); + if (!covertAidlPairingConfigToLegacy(aidl_request.pairingConfig, + &legacy_request->nan_pairing_config)) { + LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: invalid pairing config"; + return false; + } return true; } @@ -2068,7 +2242,9 @@ bool convertLegacyNanCapabilitiesResponseToAidl(const legacy_hal::NanCapabilitie aidl_response->supportedCipherSuites = static_cast(legacy_response.cipher_suites_supported); aidl_response->instantCommunicationModeSupportFlag = legacy_response.is_instant_mode_supported; - + aidl_response->supports6g = legacy_response.is_6g_supported; + aidl_response->supportsHe = legacy_response.is_he_supported; + aidl_response->supportsPairing = legacy_response.is_pairing_supported; return true; } @@ -2105,6 +2281,16 @@ bool convertLegacyNanMatchIndToAidl(const legacy_hal::NanMatchInd& legacy_ind, aidl_ind->rangingIndicationType = static_cast(legacy_ind.range_info.ranging_event_type); aidl_ind->scid = std::vector(legacy_ind.scid, legacy_ind.scid + legacy_ind.scid_len); + + if (!convertLegacyNiraToAidl(legacy_ind.nira, &aidl_ind->peerNira)) { + LOG(ERROR) << "convertLegacyNanMatchIndToAidl: invalid NIRA"; + return false; + } + if (!convertLegacyPairingConfigToAidl(legacy_ind.peer_pairing_config, + &aidl_ind->peerPairingConfig)) { + LOG(ERROR) << "convertLegacyNanMatchIndToAidl: invalid pairing config"; + return false; + } return true; } @@ -2861,6 +3047,235 @@ bool convertLegacyRadioCombinationsMatrixToAidl( return true; } +bool convertAidlNanPairingInitiatorRequestToLegacy(const NanPairingRequest& aidl_request, + legacy_hal::NanPairingRequest* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertAidlNanPairingInitiatorRequestToLegacy: " + "legacy_request is null"; + return false; + } + *legacy_request = {}; + + legacy_request->requestor_instance_id = aidl_request.peerId; + memcpy(legacy_request->peer_disc_mac_addr, aidl_request.peerDiscMacAddr.data(), 6); + legacy_request->nan_pairing_request_type = + convertAidlNanPairingRequestTypeToLegacy(aidl_request.requestType); + legacy_request->enable_pairing_cache = aidl_request.enablePairingCache; + + memcpy(legacy_request->nan_identity_key, aidl_request.pairingIdentityKey.data(), + NAN_IDENTITY_KEY_LEN); + + legacy_request->is_opportunistic = + aidl_request.securityConfig.securityType == NanPairingSecurityType::OPPORTUNISTIC ? 1 + : 0; + legacy_request->akm = convertAidlAkmTypeToLegacy(aidl_request.securityConfig.akm); + if (aidl_request.securityConfig.securityType == NanPairingSecurityType::PMK) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; + legacy_request->key_info.body.pmk_info.pmk_len = aidl_request.securityConfig.pmk.size(); + if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { + LOG(ERROR) << "convertAidlNanPairingInitiatorRequestToLegacy: " + "invalid pmk_len"; + return false; + } + memcpy(legacy_request->key_info.body.pmk_info.pmk, aidl_request.securityConfig.pmk.data(), + legacy_request->key_info.body.pmk_info.pmk_len); + } + if (aidl_request.securityConfig.securityType == NanPairingSecurityType::PASSPHRASE) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; + legacy_request->key_info.body.passphrase_info.passphrase_len = + aidl_request.securityConfig.passphrase.size(); + if (legacy_request->key_info.body.passphrase_info.passphrase_len < + NAN_SECURITY_MIN_PASSPHRASE_LEN) { + LOG(ERROR) << "convertAidlNanPairingInitiatorRequestToLegacy: " + "passphrase_len too small"; + return false; + } + if (legacy_request->key_info.body.passphrase_info.passphrase_len > + NAN_SECURITY_MAX_PASSPHRASE_LEN) { + LOG(ERROR) << "convertAidlNanPairingInitiatorRequestToLegacy: " + "passphrase_len too large"; + return false; + } + memcpy(legacy_request->key_info.body.passphrase_info.passphrase, + aidl_request.securityConfig.passphrase.data(), + legacy_request->key_info.body.passphrase_info.passphrase_len); + } + + return true; +} + +bool convertAidlNanPairingIndicationResponseToLegacy( + const NanRespondToPairingIndicationRequest& aidl_request, + legacy_hal::NanPairingIndicationResponse* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertAidlNanPairingIndicationResponseToLegacy: " + "legacy_request is null"; + return false; + } + *legacy_request = {}; + + legacy_request->pairing_instance_id = aidl_request.pairingInstanceId; + legacy_request->nan_pairing_request_type = + convertAidlNanPairingRequestTypeToLegacy(aidl_request.requestType); + legacy_request->enable_pairing_cache = aidl_request.enablePairingCache; + + memcpy(legacy_request->nan_identity_key, aidl_request.pairingIdentityKey.data(), + NAN_IDENTITY_KEY_LEN); + + legacy_request->is_opportunistic = + aidl_request.securityConfig.securityType == NanPairingSecurityType::OPPORTUNISTIC ? 1 + : 0; + legacy_request->akm = convertAidlAkmTypeToLegacy(aidl_request.securityConfig.akm); + legacy_request->rsp_code = + aidl_request.acceptRequest ? NAN_PAIRING_REQUEST_ACCEPT : NAN_PAIRING_REQUEST_REJECT; + if (aidl_request.securityConfig.securityType == NanPairingSecurityType::PMK) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; + legacy_request->key_info.body.pmk_info.pmk_len = aidl_request.securityConfig.pmk.size(); + if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { + LOG(ERROR) << "convertAidlNanPairingIndicationResponseToLegacy: " + "invalid pmk_len"; + return false; + } + memcpy(legacy_request->key_info.body.pmk_info.pmk, aidl_request.securityConfig.pmk.data(), + legacy_request->key_info.body.pmk_info.pmk_len); + } + if (aidl_request.securityConfig.securityType == NanPairingSecurityType::PASSPHRASE) { + legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; + legacy_request->key_info.body.passphrase_info.passphrase_len = + aidl_request.securityConfig.passphrase.size(); + if (legacy_request->key_info.body.passphrase_info.passphrase_len < + NAN_SECURITY_MIN_PASSPHRASE_LEN) { + LOG(ERROR) << "convertAidlNanPairingIndicationResponseToLegacy: " + "passphrase_len too small"; + return false; + } + if (legacy_request->key_info.body.passphrase_info.passphrase_len > + NAN_SECURITY_MAX_PASSPHRASE_LEN) { + LOG(ERROR) << "convertAidlNanPairingIndicationResponseToLegacy: " + "passphrase_len too large"; + return false; + } + memcpy(legacy_request->key_info.body.passphrase_info.passphrase, + aidl_request.securityConfig.passphrase.data(), + legacy_request->key_info.body.passphrase_info.passphrase_len); + } + + return true; +} + +bool convertAidlNanBootstrappingInitiatorRequestToLegacy( + const NanBootstrappingRequest& aidl_request, + legacy_hal::NanBootstrappingRequest* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertAidlNanBootstrappingInitiatorRequestToLegacy: " + "legacy_request is null"; + return false; + } + *legacy_request = {}; + + legacy_request->requestor_instance_id = aidl_request.peerId; + memcpy(legacy_request->peer_disc_mac_addr, aidl_request.peerDiscMacAddr.data(), 6); + legacy_request->request_bootstrapping_method = + convertAidlBootstrappingMethodToLegacy(aidl_request.requestBootstrappingMethod); + + return true; +} + +bool convertAidlNanBootstrappingIndicationResponseToLegacy( + const NanBootstrappingResponse& aidl_request, + legacy_hal::NanBootstrappingIndicationResponse* legacy_request) { + if (!legacy_request) { + LOG(ERROR) << "convertAidlNanBootstrappingIndicationResponseToLegacy: " + "legacy_request is null"; + return false; + } + *legacy_request = {}; + + legacy_request->service_instance_id = aidl_request.bootstrappingInstanceId; + legacy_request->rsp_code = aidl_request.acceptRequest ? NAN_BOOTSTRAPPING_REQUEST_ACCEPT + : NAN_BOOTSTRAPPING_REQUEST_REJECT; + + return true; +} + +bool convertLegacyNanPairingRequestIndToAidl(const legacy_hal::NanPairingRequestInd& legacy_ind, + NanPairingRequestInd* aidl_ind) { + if (!aidl_ind) { + LOG(ERROR) << "convertLegacyNanPairingRequestIndToAidl: aidl_ind is null"; + return false; + } + *aidl_ind = {}; + + aidl_ind->discoverySessionId = legacy_ind.publish_subscribe_id; + aidl_ind->peerId = legacy_ind.requestor_instance_id; + aidl_ind->peerDiscMacAddr = std::array(); + std::copy(legacy_ind.peer_disc_mac_addr, legacy_ind.peer_disc_mac_addr + 6, + std::begin(aidl_ind->peerDiscMacAddr)); + aidl_ind->pairingInstanceId = legacy_ind.pairing_instance_id; + aidl_ind->enablePairingCache = legacy_ind.enable_pairing_cache == 1; + aidl_ind->requestType = + convertLegacyNanPairingRequestTypeToAidl(legacy_ind.nan_pairing_request_type); + if (!convertLegacyNiraToAidl(legacy_ind.nira, &aidl_ind->peerNira)) { + return false; + } + return true; +} + +bool convertLegacyNanPairingConfirmIndToAidl(const legacy_hal::NanPairingConfirmInd& legacy_ind, + NanPairingConfirmInd* aidl_ind) { + if (!aidl_ind) { + LOG(ERROR) << "convertLegacyNanPairingRequestIndToAidl: aidl_ind is null"; + return false; + } + *aidl_ind = {}; + + aidl_ind->pairingInstanceId = legacy_ind.pairing_instance_id; + aidl_ind->enablePairingCache = legacy_ind.enable_pairing_cache == 1; + aidl_ind->requestType = + convertLegacyNanPairingRequestTypeToAidl(legacy_ind.nan_pairing_request_type); + aidl_ind->pairingSuccess = legacy_ind.rsp_code == NAN_PAIRING_REQUEST_ACCEPT; + aidl_ind->status.status = convertLegacyNanStatusTypeToAidl(legacy_ind.reason_code); + if (!convertLegacyNpsaToAidl(legacy_ind.npk_security_association, &aidl_ind->npksa)) { + return false; + } + return true; +} + +bool convertLegacyNanBootstrappingRequestIndToAidl( + const legacy_hal::NanBootstrappingRequestInd& legacy_ind, + NanBootstrappingRequestInd* aidl_ind) { + if (!aidl_ind) { + LOG(ERROR) << "convertLegacyNanBootstrappingRequestIndToAidl: aidl_ind is null"; + return false; + } + *aidl_ind = {}; + + aidl_ind->discoverySessionId = legacy_ind.publish_subscribe_id; + aidl_ind->peerId = legacy_ind.requestor_instance_id; + aidl_ind->peerDiscMacAddr = std::array(); + std::copy(legacy_ind.peer_disc_mac_addr, legacy_ind.peer_disc_mac_addr + 6, + std::begin(aidl_ind->peerDiscMacAddr)); + aidl_ind->bootstrappingInstanceId = legacy_ind.bootstrapping_instance_id; + aidl_ind->requestBootstrappingMethod = + convertLegacyBootstrappingMethodToAidl(legacy_ind.request_bootstrapping_method); + return true; +} + +bool convertLegacyNanBootstrappingConfirmIndToAidl( + const legacy_hal::NanBootstrappingConfirmInd& legacy_ind, + NanBootstrappingConfirmInd* aidl_ind) { + if (!aidl_ind) { + LOG(ERROR) << "convertLegacyNanBootstrappingConfirmIndToAidl: aidl_ind is null"; + return false; + } + *aidl_ind = {}; + + aidl_ind->bootstrappingInstanceId = legacy_ind.bootstrapping_instance_id; + aidl_ind->acceptRequest = legacy_ind.rsp_code == NAN_BOOTSTRAPPING_REQUEST_ACCEPT; + aidl_ind->reasonCode.status = convertLegacyNanStatusTypeToAidl(legacy_ind.reason_code); + return true; +} + bool convertLegacyWifiChipCapabilitiesToAidl( const legacy_hal::wifi_chip_capabilities& legacy_chip_capabilities, WifiChipCapabilities& aidl_chip_capabilities) { diff --git a/wifi/aidl/default/aidl_struct_util.h b/wifi/aidl/default/aidl_struct_util.h index ac86755382..693e680564 100644 --- a/wifi/aidl/default/aidl_struct_util.h +++ b/wifi/aidl/default/aidl_struct_util.h @@ -176,6 +176,27 @@ bool convertLegacyWifiRateInfoToAidl(const legacy_hal::wifi_rate& legacy_rate, bool convertLegacyWifiChipCapabilitiesToAidl( const legacy_hal::wifi_chip_capabilities& legacy_chip_capabilities, WifiChipCapabilities& aidl_chip_capabilities); +bool convertAidlNanPairingInitiatorRequestToLegacy(const NanPairingRequest& aidl_request, + legacy_hal::NanPairingRequest* legacy_request); +bool convertAidlNanPairingIndicationResponseToLegacy( + const NanRespondToPairingIndicationRequest& aidl_response, + legacy_hal::NanPairingIndicationResponse* legacy_response); +bool convertAidlNanBootstrappingInitiatorRequestToLegacy( + const NanBootstrappingRequest& aidl_request, + legacy_hal::NanBootstrappingRequest* legacy_request); +bool convertAidlNanBootstrappingIndicationResponseToLegacy( + const NanBootstrappingResponse& aidl_response, + legacy_hal::NanBootstrappingIndicationResponse* legacy_response); +bool convertLegacyNanPairingRequestIndToAidl(const legacy_hal::NanPairingRequestInd& legacy_ind, + NanPairingRequestInd* aidl_ind); +bool convertLegacyNanPairingConfirmIndToAidl(const legacy_hal::NanPairingConfirmInd& legacy_ind, + NanPairingConfirmInd* aidl_ind); +bool convertLegacyNanBootstrappingRequestIndToAidl( + const legacy_hal::NanBootstrappingRequestInd& legacy_ind, + NanBootstrappingRequestInd* aidl_ind); +bool convertLegacyNanBootstrappingConfirmIndToAidl( + const legacy_hal::NanBootstrappingConfirmInd& legacy_ind, + NanBootstrappingConfirmInd* aidl_ind); } // namespace aidl_struct_util } // namespace wifi } // namespace hardware diff --git a/wifi/aidl/default/wifi_legacy_hal.cpp b/wifi/aidl/default/wifi_legacy_hal.cpp index 83f368e0bf..3acc1ae0f0 100644 --- a/wifi/aidl/default/wifi_legacy_hal.cpp +++ b/wifi/aidl/default/wifi_legacy_hal.cpp @@ -334,6 +334,40 @@ void onAsyncNanEventScheduleUpdate(NanDataPathScheduleUpdateInd* event) { } } +std::function on_nan_event_pairing_request_user_callback; +void onAsyncNanEventPairingRequest(NanPairingRequestInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_nan_event_pairing_request_user_callback && event) { + on_nan_event_pairing_request_user_callback(*event); + } +} + +std::function on_nan_event_pairing_confirm_user_callback; +void onAsyncNanEventPairingConfirm(NanPairingConfirmInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_nan_event_pairing_confirm_user_callback && event) { + on_nan_event_pairing_confirm_user_callback(*event); + } +} + +std::function + on_nan_event_bootstrapping_request_user_callback; +void onAsyncNanEventBootstrappingRequest(NanBootstrappingRequestInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_nan_event_bootstrapping_request_user_callback && event) { + on_nan_event_bootstrapping_request_user_callback(*event); + } +} + +std::function + on_nan_event_bootstrapping_confirm_user_callback; +void onAsyncNanEventBootstrappingConfirm(NanBootstrappingConfirmInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_nan_event_bootstrapping_confirm_user_callback && event) { + on_nan_event_bootstrapping_confirm_user_callback(*event); + } +} + // Callbacks for the various TWT operations. std::function on_twt_event_setup_response_callback; void onAsyncTwtEventSetupResponse(TwtSetupResponse* event) { @@ -1298,6 +1332,12 @@ wifi_error WifiLegacyHal::nanRegisterCallbackHandlers(const std::string& iface_n on_nan_event_tca_user_callback = user_callbacks.on_event_tca; on_nan_event_beacon_sdf_payload_user_callback = user_callbacks.on_event_beacon_sdf_payload; on_nan_event_data_path_request_user_callback = user_callbacks.on_event_data_path_request; + on_nan_event_pairing_request_user_callback = user_callbacks.on_event_pairing_request; + on_nan_event_pairing_confirm_user_callback = user_callbacks.on_event_pairing_confirm; + on_nan_event_bootstrapping_request_user_callback = + user_callbacks.on_event_bootstrapping_request; + on_nan_event_bootstrapping_confirm_user_callback = + user_callbacks.on_event_bootstrapping_confirm; on_nan_event_data_path_confirm_user_callback = user_callbacks.on_event_data_path_confirm; on_nan_event_data_path_end_user_callback = user_callbacks.on_event_data_path_end; on_nan_event_transmit_follow_up_user_callback = user_callbacks.on_event_transmit_follow_up; @@ -1305,16 +1345,29 @@ wifi_error WifiLegacyHal::nanRegisterCallbackHandlers(const std::string& iface_n on_nan_event_range_report_user_callback = user_callbacks.on_event_range_report; on_nan_event_schedule_update_user_callback = user_callbacks.on_event_schedule_update; - return global_func_table_.wifi_nan_register_handler( - getIfaceHandle(iface_name), - {onAsyncNanNotifyResponse, onAsyncNanEventPublishReplied, - onAsyncNanEventPublishTerminated, onAsyncNanEventMatch, onAsyncNanEventMatchExpired, - onAsyncNanEventSubscribeTerminated, onAsyncNanEventFollowup, - onAsyncNanEventDiscEngEvent, onAsyncNanEventDisabled, onAsyncNanEventTca, - onAsyncNanEventBeaconSdfPayload, onAsyncNanEventDataPathRequest, - onAsyncNanEventDataPathConfirm, onAsyncNanEventDataPathEnd, - onAsyncNanEventTransmitFollowUp, onAsyncNanEventRangeRequest, - onAsyncNanEventRangeReport, onAsyncNanEventScheduleUpdate}); + return global_func_table_.wifi_nan_register_handler(getIfaceHandle(iface_name), + {onAsyncNanNotifyResponse, + onAsyncNanEventPublishReplied, + onAsyncNanEventPublishTerminated, + onAsyncNanEventMatch, + onAsyncNanEventMatchExpired, + onAsyncNanEventSubscribeTerminated, + onAsyncNanEventFollowup, + onAsyncNanEventDiscEngEvent, + onAsyncNanEventDisabled, + onAsyncNanEventTca, + onAsyncNanEventBeaconSdfPayload, + onAsyncNanEventDataPathRequest, + onAsyncNanEventDataPathConfirm, + onAsyncNanEventDataPathEnd, + onAsyncNanEventTransmitFollowUp, + onAsyncNanEventRangeRequest, + onAsyncNanEventRangeReport, + onAsyncNanEventScheduleUpdate, + onAsyncNanEventPairingRequest, + onAsyncNanEventPairingConfirm, + onAsyncNanEventBootstrappingRequest, + onAsyncNanEventBootstrappingConfirm}); } wifi_error WifiLegacyHal::nanEnableRequest(const std::string& iface_name, transaction_id id, @@ -1429,6 +1482,36 @@ wifi_error WifiLegacyHal::nanDataIndicationResponse(const std::string& iface_nam &msg_internal); } +wifi_error WifiLegacyHal::nanPairingRequest(const std::string& iface_name, transaction_id id, + const NanPairingRequest& msg) { + NanPairingRequest msg_internal(msg); + return global_func_table_.wifi_nan_pairing_request(id, getIfaceHandle(iface_name), + &msg_internal); +} + +wifi_error WifiLegacyHal::nanPairingIndicationResponse(const std::string& iface_name, + transaction_id id, + const NanPairingIndicationResponse& msg) { + NanPairingIndicationResponse msg_internal(msg); + return global_func_table_.wifi_nan_pairing_indication_response(id, getIfaceHandle(iface_name), + &msg_internal); +} + +wifi_error WifiLegacyHal::nanBootstrappingRequest(const std::string& iface_name, transaction_id id, + const NanBootstrappingRequest& msg) { + NanBootstrappingRequest msg_internal(msg); + return global_func_table_.wifi_nan_bootstrapping_request(id, getIfaceHandle(iface_name), + &msg_internal); +} + +wifi_error WifiLegacyHal::nanBootstrappingIndicationResponse( + const std::string& iface_name, transaction_id id, + const NanBootstrappingIndicationResponse& msg) { + NanBootstrappingIndicationResponse msg_internal(msg); + return global_func_table_.wifi_nan_bootstrapping_indication_response( + id, getIfaceHandle(iface_name), &msg_internal); +} + typedef struct { u8 num_ndp_instances; NanDataPathId ndp_instance_id; @@ -1746,6 +1829,10 @@ void WifiLegacyHal::invalidate() { on_nan_event_tca_user_callback = nullptr; on_nan_event_beacon_sdf_payload_user_callback = nullptr; on_nan_event_data_path_request_user_callback = nullptr; + on_nan_event_pairing_request_user_callback = nullptr; + on_nan_event_pairing_confirm_user_callback = nullptr; + on_nan_event_bootstrapping_request_user_callback = nullptr; + on_nan_event_bootstrapping_confirm_user_callback = nullptr; on_nan_event_data_path_confirm_user_callback = nullptr; on_nan_event_data_path_end_user_callback = nullptr; on_nan_event_transmit_follow_up_user_callback = nullptr; diff --git a/wifi/aidl/default/wifi_legacy_hal.h b/wifi/aidl/default/wifi_legacy_hal.h index c40118e233..7b434139a2 100644 --- a/wifi/aidl/default/wifi_legacy_hal.h +++ b/wifi/aidl/default/wifi_legacy_hal.h @@ -36,6 +36,7 @@ namespace wifi { namespace legacy_hal { // Import all the types defined inside the legacy HAL header files into this // namespace. +using ::Akm; using ::chre_nan_rtt_state; using ::frame_info; using ::frame_type; @@ -44,6 +45,8 @@ using ::FRAME_TYPE_ETHERNET_II; using ::FRAME_TYPE_UNKNOWN; using ::fw_roaming_state_t; using ::mac_addr; +using ::NAN_BOOTSTRAPPING_INITIATOR_RESPONSE; +using ::NAN_BOOTSTRAPPING_RESPONDER_RESPONSE; using ::NAN_CHANNEL_24G_BAND; using ::NAN_CHANNEL_5G_BAND_HIGH; using ::NAN_CHANNEL_5G_BAND_LOW; @@ -65,6 +68,10 @@ using ::NAN_GET_CAPABILITIES; using ::NAN_MATCH_ALG_MATCH_CONTINUOUS; using ::NAN_MATCH_ALG_MATCH_NEVER; using ::NAN_MATCH_ALG_MATCH_ONCE; +using ::NAN_PAIRING_INITIATOR_RESPONSE; +using ::NAN_PAIRING_RESPONDER_RESPONSE; +using ::NAN_PAIRING_SETUP; +using ::NAN_PAIRING_VERIFICATION; using ::NAN_PUBLISH_TYPE_SOLICITED; using ::NAN_PUBLISH_TYPE_UNSOLICITED; using ::NAN_PUBLISH_TYPE_UNSOLICITED_SOLICITED; @@ -97,7 +104,9 @@ using ::NAN_SSI_REQUIRED_IN_MATCH_IND; using ::NAN_STATUS_ALREADY_ENABLED; using ::NAN_STATUS_FOLLOWUP_QUEUE_FULL; using ::NAN_STATUS_INTERNAL_FAILURE; +using ::NAN_STATUS_INVALID_BOOTSTRAPPING_ID; using ::NAN_STATUS_INVALID_NDP_ID; +using ::NAN_STATUS_INVALID_PAIRING_ID; using ::NAN_STATUS_INVALID_PARAM; using ::NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID; using ::NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID; @@ -117,6 +126,12 @@ using ::NAN_TX_TYPE_BROADCAST; using ::NAN_TX_TYPE_UNICAST; using ::NAN_USE_SRF; using ::NanBeaconSdfPayloadInd; +using ::NanBootstrappingConfirmInd; +using ::NanBootstrappingIndicationResponse; +using ::NanBootstrappingRequest; +using ::NanBootstrappingRequestInd; +using ::NanBootstrappingRequestResponse; +using ::NanBootstrappingResponseCode; using ::NanCapabilities; using ::NanChannelInfo; using ::NanConfigRequest; @@ -131,9 +146,18 @@ using ::NanDisabledInd; using ::NanDiscEngEventInd; using ::NanEnableRequest; using ::NanFollowupInd; +using ::NanIdentityResolutionAttribute; using ::NanMatchAlg; using ::NanMatchExpiredInd; using ::NanMatchInd; +using ::NanPairingConfig; +using ::NanPairingConfirmInd; +using ::NanPairingIndicationResponse; +using ::NanPairingRequest; +using ::NanPairingRequestInd; +using ::NanPairingRequestResponse; +using ::NanPairingRequestType; +using ::NanPairingResponseCode; using ::NanPublishCancelRequest; using ::NanPublishRequest; using ::NanPublishTerminatedInd; @@ -150,6 +174,8 @@ using ::NanSubscribeType; using ::NanTransmitFollowupInd; using ::NanTransmitFollowupRequest; using ::NanTxType; +using ::NpkSecurityAssociation; +using ::PASN; using ::ROAMING_DISABLE; using ::ROAMING_ENABLE; using ::RTT_PEER_AP; @@ -189,6 +215,7 @@ using ::RX_PKT_FATE_FW_DROP_NOBUFS; using ::RX_PKT_FATE_FW_DROP_OTHER; using ::RX_PKT_FATE_FW_QUEUED; using ::RX_PKT_FATE_SUCCESS; +using ::SAE; using ::ssid_t; using ::transaction_id; using ::TX_PKT_FATE_ACKED; @@ -412,6 +439,10 @@ struct NanCallbackHandlers { std::function on_event_range_request; std::function on_event_range_report; std::function on_event_schedule_update; + std::function on_event_pairing_request; + std::function on_event_pairing_confirm; + std::function on_event_bootstrapping_request; + std::function on_event_bootstrapping_confirm; }; // Full scan results contain IE info and are hence passed by reference, to @@ -653,6 +684,14 @@ class WifiLegacyHal { const NanDataPathInitiatorRequest& msg); wifi_error nanDataIndicationResponse(const std::string& iface_name, transaction_id id, const NanDataPathIndicationResponse& msg); + wifi_error nanPairingRequest(const std::string& iface_name, transaction_id id, + const NanPairingRequest& msg); + wifi_error nanPairingIndicationResponse(const std::string& iface_name, transaction_id id, + const NanPairingIndicationResponse& msg); + wifi_error nanBootstrappingRequest(const std::string& iface_name, transaction_id id, + const NanBootstrappingRequest& msg); + wifi_error nanBootstrappingIndicationResponse(const std::string& iface_name, transaction_id id, + const NanBootstrappingIndicationResponse& msg); wifi_error nanDataEnd(const std::string& iface_name, transaction_id id, uint32_t ndpInstanceId); // AP functions. wifi_error setCountryCode(const std::string& iface_name, const std::array code); diff --git a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp index 777789442d..a0cb2c071d 100644 --- a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp +++ b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp @@ -126,6 +126,10 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { populateStubFor(&hal_fn->wifi_nan_data_interface_delete); populateStubFor(&hal_fn->wifi_nan_data_request_initiator); populateStubFor(&hal_fn->wifi_nan_data_indication_response); + populateStubFor(&hal_fn->wifi_nan_pairing_request); + populateStubFor(&hal_fn->wifi_nan_pairing_indication_response); + populateStubFor(&hal_fn->wifi_nan_bootstrapping_request); + populateStubFor(&hal_fn->wifi_nan_bootstrapping_indication_response); populateStubFor(&hal_fn->wifi_nan_data_end); populateStubFor(&hal_fn->wifi_get_packet_filter_capabilities); populateStubFor(&hal_fn->wifi_set_packet_filter); diff --git a/wifi/aidl/default/wifi_nan_iface.cpp b/wifi/aidl/default/wifi_nan_iface.cpp index 9edef09b7b..ce6902da8a 100644 --- a/wifi/aidl/default/wifi_nan_iface.cpp +++ b/wifi/aidl/default/wifi_nan_iface.cpp @@ -205,6 +205,46 @@ void WifiNanIface::registerCallbackHandlers() { } break; } + case legacy_hal::NAN_PAIRING_INITIATOR_RESPONSE: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyInitiatePairingResponse( + id, nanStatus, + msg.body.pairing_request_response.paring_instance_id) + .isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_PAIRING_RESPONDER_RESPONSE: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyRespondToPairingIndicationResponse(id, nanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_BOOTSTRAPPING_INITIATOR_RESPONSE: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyInitiateBootstrappingResponse( + id, nanStatus, + msg.body.bootstrapping_request_response + .bootstrapping_instance_id) + .isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_BOOTSTRAPPING_RESPONDER_RESPONSE: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyRespondToBootstrappingIndicationResponse(id, nanStatus) + .isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } case legacy_hal::NAN_RESPONSE_BEACON_SDF_PAYLOAD: /* fall through */ case legacy_hal::NAN_RESPONSE_TCA: @@ -421,6 +461,85 @@ void WifiNanIface::registerCallbackHandlers() { } }; + callback_handlers.on_event_pairing_request = + [weak_ptr_this](const legacy_hal::NanPairingRequestInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanPairingRequestInd aidl_struct; + if (!aidl_struct_util::convertLegacyNanPairingRequestIndToAidl(msg, &aidl_struct)) { + LOG(ERROR) << "Failed to convert nan capabilities response"; + return; + } + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventPairingRequest(aidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + callback_handlers.on_event_pairing_confirm = + [weak_ptr_this](const legacy_hal::NanPairingConfirmInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanPairingConfirmInd aidl_struct; + if (!aidl_struct_util::convertLegacyNanPairingConfirmIndToAidl(msg, &aidl_struct)) { + LOG(ERROR) << "Failed to convert nan capabilities response"; + return; + } + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventPairingConfirm(aidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + callback_handlers.on_event_bootstrapping_request = + [weak_ptr_this](const legacy_hal::NanBootstrappingRequestInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanBootstrappingRequestInd aidl_struct; + if (!aidl_struct_util::convertLegacyNanBootstrappingRequestIndToAidl( + msg, &aidl_struct)) { + LOG(ERROR) << "Failed to convert nan capabilities response"; + return; + } + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventBootstrappingRequest(aidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + callback_handlers.on_event_bootstrapping_confirm = + [weak_ptr_this](const legacy_hal::NanBootstrappingConfirmInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanBootstrappingConfirmInd aidl_struct; + if (!aidl_struct_util::convertLegacyNanBootstrappingConfirmIndToAidl( + msg, &aidl_struct)) { + LOG(ERROR) << "Failed to convert nan capabilities response"; + return; + } + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventBootstrappingConfirm(aidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; + callback_handlers.on_event_beacon_sdf_payload = [](const legacy_hal::NanBeaconSdfPayloadInd& /* msg */) { LOG(ERROR) << "on_event_beacon_sdf_payload - should not be called"; @@ -611,6 +730,32 @@ ndk::ScopedAStatus WifiNanIface::terminateDataPathRequest(char16_t in_cmdId, in_ndpInstanceId); } +ndk::ScopedAStatus WifiNanIface::initiatePairingRequest(char16_t in_cmdId, + const NanPairingRequest& in_msg) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::initiatePairingRequestInternal, in_cmdId, in_msg); +} + +ndk::ScopedAStatus WifiNanIface::respondToPairingIndicationRequest( + char16_t in_cmdId, const NanRespondToPairingIndicationRequest& in_msg) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::respondToPairingIndicationRequestInternal, in_cmdId, + in_msg); +} + +ndk::ScopedAStatus WifiNanIface::initiateBootstrappingRequest( + char16_t in_cmdId, const NanBootstrappingRequest& in_msg) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::initiateBootstrappingRequestInternal, in_cmdId, in_msg); +} + +ndk::ScopedAStatus WifiNanIface::respondToBootstrappingIndicationRequest( + char16_t in_cmdId, const NanBootstrappingResponse& in_msg) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::respondToBootstrappingIndicationRequestInternal, in_cmdId, + in_msg); +} + std::pair WifiNanIface::getNameInternal() { return {ifname_, ndk::ScopedAStatus::ok()}; } @@ -744,6 +889,47 @@ ndk::ScopedAStatus WifiNanIface::terminateDataPathRequestInternal(char16_t cmd_i legacy_hal_.lock()->nanDataEnd(ifname_, cmd_id, ndpInstanceId); return createWifiStatusFromLegacyError(legacy_status); } +ndk::ScopedAStatus WifiNanIface::initiatePairingRequestInternal(char16_t cmd_id, + const NanPairingRequest& msg) { + legacy_hal::NanPairingRequest legacy_msg; + if (!aidl_struct_util::convertAidlNanPairingInitiatorRequestToLegacy(msg, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanPairingRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} +ndk::ScopedAStatus WifiNanIface::respondToPairingIndicationRequestInternal( + char16_t cmd_id, const NanRespondToPairingIndicationRequest& msg) { + legacy_hal::NanPairingIndicationResponse legacy_msg; + if (!aidl_struct_util::convertAidlNanPairingIndicationResponseToLegacy(msg, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanPairingIndicationResponse(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} +ndk::ScopedAStatus WifiNanIface::initiateBootstrappingRequestInternal( + char16_t cmd_id, const NanBootstrappingRequest& msg) { + legacy_hal::NanBootstrappingRequest legacy_msg; + if (!aidl_struct_util::convertAidlNanBootstrappingInitiatorRequestToLegacy(msg, &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanBootstrappingRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} +ndk::ScopedAStatus WifiNanIface::respondToBootstrappingIndicationRequestInternal( + char16_t cmd_id, const NanBootstrappingResponse& msg) { + legacy_hal::NanBootstrappingIndicationResponse legacy_msg; + if (!aidl_struct_util::convertAidlNanBootstrappingIndicationResponseToLegacy(msg, + &legacy_msg)) { + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanBootstrappingIndicationResponse(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} } // namespace wifi } // namespace hardware diff --git a/wifi/aidl/default/wifi_nan_iface.h b/wifi/aidl/default/wifi_nan_iface.h index 101890594c..591eca908e 100644 --- a/wifi/aidl/default/wifi_nan_iface.h +++ b/wifi/aidl/default/wifi_nan_iface.h @@ -78,6 +78,14 @@ class WifiNanIface : public BnWifiNanIface { char16_t in_cmdId, const NanRespondToDataPathIndicationRequest& in_msg) override; ndk::ScopedAStatus terminateDataPathRequest(char16_t in_cmdId, int32_t in_ndpInstanceId) override; + ndk::ScopedAStatus initiatePairingRequest(char16_t in_cmdId, + const NanPairingRequest& in_msg) override; + ndk::ScopedAStatus respondToPairingIndicationRequest( + char16_t in_cmdId, const NanRespondToPairingIndicationRequest& in_msg) override; + ndk::ScopedAStatus initiateBootstrappingRequest(char16_t in_cmdId, + const NanBootstrappingRequest& in_msg) override; + ndk::ScopedAStatus respondToBootstrappingIndicationRequest( + char16_t in_cmdId, const NanBootstrappingResponse& in_msg) override; protected: // Accessible to child class in the gTest suite. @@ -111,6 +119,14 @@ class WifiNanIface : public BnWifiNanIface { ndk::ScopedAStatus respondToDataPathIndicationRequestInternal( char16_t cmd_id, const NanRespondToDataPathIndicationRequest& msg); ndk::ScopedAStatus terminateDataPathRequestInternal(char16_t cmd_id, int32_t ndpInstanceId); + ndk::ScopedAStatus initiatePairingRequestInternal(char16_t cmd_id, + const NanPairingRequest& msg); + ndk::ScopedAStatus respondToPairingIndicationRequestInternal( + char16_t cmd_id, const NanRespondToPairingIndicationRequest& msg); + ndk::ScopedAStatus initiateBootstrappingRequestInternal(char16_t cmd_id, + const NanBootstrappingRequest& msg); + ndk::ScopedAStatus respondToBootstrappingIndicationRequestInternal( + char16_t cmd_id, const NanBootstrappingResponse& msg); // Overridden in the gTest suite. virtual std::set> getEventCallbacks(); From 78ff2d6491b20a874d643358554dc352d51763a3 Mon Sep 17 00:00:00 2001 From: Brian Lindahl Date: Sun, 18 Dec 2022 11:21:41 -0700 Subject: [PATCH 515/998] Add VTS for new API for clearing buffer slots Bug: 262041682 Bug: 258196272 Test: VtsHalGraphicsComposer3_TargetTest Change-Id: If7e5fea56734f3ae7b4aae7378f4aea0eacc8e32 --- .../graphics/composer3/ComposerClientWriter.h | 8 + .../composer/aidl/vts/VtsComposerClient.cpp | 6 + .../composer/aidl/vts/VtsComposerClient.h | 2 + .../VtsHalGraphicsComposer3_ReadbackTest.cpp | 205 +++++++++++++++--- .../VtsHalGraphicsComposer3_TargetTest.cpp | 77 ++++++- 5 files changed, 262 insertions(+), 36 deletions(-) diff --git a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h index e35d07bce9..22020c0ea9 100644 --- a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h +++ b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h @@ -142,6 +142,14 @@ class ComposerClientWriter final { flushLayerCommand(); } + void setLayerBufferSlotsToClear(int64_t display, int64_t layer, + const std::vector& slotsToClear) { + LayerCommand& layerCommand = getLayerCommand(display, layer); + for (auto slot : slotsToClear) { + layerCommand.bufferSlotsToClear.emplace(static_cast(slot)); + } + } + void setLayerSurfaceDamage(int64_t display, int64_t layer, const std::vector& damage) { getLayerCommand(display, layer).damage.emplace(damage.begin(), damage.end()); } diff --git a/graphics/composer/aidl/vts/VtsComposerClient.cpp b/graphics/composer/aidl/vts/VtsComposerClient.cpp index 34cc80241c..00b578b3f9 100644 --- a/graphics/composer/aidl/vts/VtsComposerClient.cpp +++ b/graphics/composer/aidl/vts/VtsComposerClient.cpp @@ -58,6 +58,12 @@ bool VtsComposerClient::tearDown() { return verifyComposerCallbackParams() && destroyAllLayers(); } +std::pair VtsComposerClient::getInterfaceVersion() { + int32_t version = 1; + auto status = mComposerClient->getInterfaceVersion(&version); + return {std::move(status), version}; +} + std::pair VtsComposerClient::createVirtualDisplay( int32_t width, int32_t height, PixelFormat pixelFormat, int32_t bufferSlotCount) { VirtualDisplay outVirtualDisplay; diff --git a/graphics/composer/aidl/vts/VtsComposerClient.h b/graphics/composer/aidl/vts/VtsComposerClient.h index 18833365e0..e61fde9571 100644 --- a/graphics/composer/aidl/vts/VtsComposerClient.h +++ b/graphics/composer/aidl/vts/VtsComposerClient.h @@ -61,6 +61,8 @@ class VtsComposerClient { bool tearDown(); + std::pair getInterfaceVersion(); + std::pair createVirtualDisplay(int32_t width, int32_t height, PixelFormat pixelFormat, int32_t bufferSlotCount); diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp index 93d9693dbd..166127dfae 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp @@ -379,9 +379,16 @@ TEST_P(GraphicsCompositionTest, SetLayerBuffer) { } TEST_P(GraphicsCompositionTest, SetLayerBufferWithSlotsToClear) { - const auto& [status, readbackBufferAttributes] = + const auto& [versionStatus, version] = mComposerClient->getInterfaceVersion(); + ASSERT_TRUE(versionStatus.isOk()); + if (version == 1) { + GTEST_SUCCEED() << "Device does not support the new API for clearing buffer slots"; + return; + } + + const auto& [readbackStatus, readbackBufferAttributes] = mComposerClient->getReadbackBufferAttributes(getPrimaryDisplayId()); - if (!status.isOk()) { + if (!readbackStatus.isOk()) { GTEST_SUCCEED() << "Readback not supported"; return; } @@ -396,9 +403,6 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferWithSlotsToClear) { // no fence needed for the readback buffer ScopedFileDescriptor noFence(-1); - sp clearSlotBuffer = allocateBuffer(1u, 1u, GRALLOC_USAGE_HW_COMPOSER); - ASSERT_NE(nullptr, clearSlotBuffer); - // red buffer uint64_t usage = GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_OFTEN; sp redBuffer = allocateBuffer(usage); @@ -412,10 +416,16 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferWithSlotsToClear) { int blueFence; ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBufferAndGetFence(blueBuffer, BLUE, &blueFence)); + // green buffer + sp greenBuffer = allocateBuffer(usage); + ASSERT_NE(nullptr, greenBuffer); + int greenFence; + ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBufferAndGetFence(greenBuffer, GREEN, &greenFence)); + // layer defaults common::Rect rectFullDisplay = {0, 0, getDisplayWidth(), getDisplayHeight()}; int64_t display = getPrimaryDisplayId(); - auto [layerStatus, layer] = mComposerClient->createLayer(getPrimaryDisplayId(), 3); + const auto& [layerStatus, layer] = mComposerClient->createLayer(getPrimaryDisplayId(), 3); ASSERT_TRUE(layerStatus.isOk()); mWriter->setLayerDisplayFrame(display, layer, rectFullDisplay); mWriter->setLayerCompositionType(display, layer, Composition::DEVICE); @@ -454,13 +464,12 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferWithSlotsToClear) { ReadbackHelper::compareColorToBuffer(RED, readbackBuffer, fence); } - // clear the slot for the blue buffer - // should still be red + // change the layer to the green buffer + // should be green { auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); ASSERT_TRUE(status.isOk()); - mWriter->setLayerBufferWithNewCommand(display, layer, /*slot*/ 0, clearSlotBuffer->handle, - /*fence*/ -1); + mWriter->setLayerBuffer(display, layer, /*slot*/ 2, greenBuffer->handle, greenFence); mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); execute(); ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); @@ -469,17 +478,106 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferWithSlotsToClear) { execute(); auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); ASSERT_TRUE(fenceStatus.isOk()); - ReadbackHelper::compareColorToBuffer(RED, readbackBuffer, fence); + ReadbackHelper::compareColorToBuffer(GREEN, readbackBuffer, fence); } - // clear the slot for the red buffer, and set the buffer with the same slot to the blue buffer + // clear the slots for all buffers + // should still be green since the active buffer should not be cleared by the HAL implementation + { + auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); + ASSERT_TRUE(status.isOk()); + mWriter->setLayerBufferSlotsToClear(display, layer, /*slotsToClear*/ {0, 1, 2}); + mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); + execute(); + ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter->presentDisplay(display); + execute(); + auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); + ASSERT_TRUE(fenceStatus.isOk()); + ReadbackHelper::compareColorToBuffer(GREEN, readbackBuffer, fence); + } + + // clear the slot for the green buffer, and set the buffer with the same slot to the blue buffer // should be blue { auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); ASSERT_TRUE(status.isOk()); - mWriter->setLayerBufferWithNewCommand(display, layer, /*slot*/ 1, clearSlotBuffer->handle, - /*fence*/ -1); - mWriter->setLayerBuffer(display, layer, /*slot*/ 1, blueBuffer->handle, blueFence); + mWriter->setLayerBufferSlotsToClear(display, layer, /*slotsToClear*/ {2}); + mWriter->setLayerBuffer(display, layer, /*slot*/ 2, blueBuffer->handle, blueFence); + mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); + execute(); + ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter->presentDisplay(display); + execute(); + auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); + ASSERT_TRUE(fenceStatus.isOk()); + ReadbackHelper::compareColorToBuffer(BLUE, readbackBuffer, fence); + } +} + +TEST_P(GraphicsCompositionTest, SetLayerBufferWithSlotsToClear_backwardsCompatible) { + const auto& [versionStatus, version] = mComposerClient->getInterfaceVersion(); + ASSERT_TRUE(versionStatus.isOk()); + if (version > 1) { + GTEST_SUCCEED() << "Device does not need a backwards compatible way to clear buffer slots"; + return; + } + + const auto& [readbackStatus, readbackBufferAttributes] = + mComposerClient->getReadbackBufferAttributes(getPrimaryDisplayId()); + if (!readbackStatus.isOk()) { + GTEST_SUCCEED() << "Readback not supported"; + return; + } + + sp readbackBuffer; + ASSERT_NO_FATAL_FAILURE(ReadbackHelper::createReadbackBuffer( + readbackBufferAttributes, getPrimaryDisplay(), &readbackBuffer)); + if (readbackBuffer == nullptr) { + GTEST_SUCCEED() << "Unsupported readback buffer attributes"; + return; + } + // no fence needed for the readback buffer + ScopedFileDescriptor noFence(-1); + + sp clearSlotBuffer = allocateBuffer(1u, 1u, GRALLOC_USAGE_HW_COMPOSER); + ASSERT_NE(nullptr, clearSlotBuffer); + + // red buffer + uint64_t usage = GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_OFTEN; + sp redBuffer = allocateBuffer(usage); + ASSERT_NE(nullptr, redBuffer); + int redFence; + ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBufferAndGetFence(redBuffer, RED, &redFence)); + + // blue buffer + sp blueBuffer = allocateBuffer(usage); + ASSERT_NE(nullptr, blueBuffer); + int blueFence; + ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBufferAndGetFence(blueBuffer, BLUE, &blueFence)); + + // green buffer + sp greenBuffer = allocateBuffer(usage); + ASSERT_NE(nullptr, greenBuffer); + int greenFence; + ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBufferAndGetFence(greenBuffer, GREEN, &greenFence)); + + // layer defaults + common::Rect rectFullDisplay = {0, 0, getDisplayWidth(), getDisplayHeight()}; + int64_t display = getPrimaryDisplayId(); + const auto& [layerStatus, layer] = mComposerClient->createLayer(getPrimaryDisplayId(), 3); + ASSERT_TRUE(layerStatus.isOk()); + mWriter->setLayerDisplayFrame(display, layer, rectFullDisplay); + mWriter->setLayerCompositionType(display, layer, Composition::DEVICE); + + // set the layer to the blue buffer + // should be blue + { + auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); + ASSERT_TRUE(status.isOk()); + mWriter->setLayerBuffer(display, layer, /*slot*/ 0, blueBuffer->handle, blueFence); mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); execute(); ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); @@ -491,27 +589,82 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferWithSlotsToClear) { ReadbackHelper::compareColorToBuffer(BLUE, readbackBuffer, fence); } - // clear the slot for the now-blue buffer - // should be black (no buffer) - // TODO(b/262037933) Ensure we never clear the active buffer's slot with the placeholder buffer - // by setting the layer to the color black + // change the layer to the red buffer + // should be red { auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); ASSERT_TRUE(status.isOk()); - mWriter->setLayerBufferWithNewCommand(display, layer, /*slot*/ 1, clearSlotBuffer->handle, - /*fence*/ -1); + mWriter->setLayerBuffer(display, layer, /*slot*/ 1, redBuffer->handle, redFence); mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); execute(); - if (!mReader.takeChangedCompositionTypes(display).empty()) { - GTEST_SUCCEED(); - return; - } + ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); ASSERT_TRUE(mReader.takeErrors().empty()); mWriter->presentDisplay(display); execute(); auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); ASSERT_TRUE(fenceStatus.isOk()); - ReadbackHelper::compareColorToBuffer(BLACK, readbackBuffer, fence); + ReadbackHelper::compareColorToBuffer(RED, readbackBuffer, fence); + } + + // change the layer to the green buffer + // should be green + { + auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); + ASSERT_TRUE(status.isOk()); + mWriter->setLayerBuffer(display, layer, /*slot*/ 2, greenBuffer->handle, greenFence); + mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); + execute(); + ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter->presentDisplay(display); + execute(); + auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); + ASSERT_TRUE(fenceStatus.isOk()); + ReadbackHelper::compareColorToBuffer(GREEN, readbackBuffer, fence); + } + + // clear the slot for the blue buffer + // should still be green + { + auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); + ASSERT_TRUE(status.isOk()); + mWriter->setLayerBufferWithNewCommand(display, layer, /*slot*/ 0, clearSlotBuffer->handle, + /*fence*/ -1); + // SurfaceFlinger will re-set the active buffer slot after other buffer slots are cleared + mWriter->setLayerBufferWithNewCommand(display, layer, /*slot*/ 2, /*handle*/ nullptr, + /*fence*/ -1); + mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); + execute(); + ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter->presentDisplay(display); + execute(); + auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); + ASSERT_TRUE(fenceStatus.isOk()); + ReadbackHelper::compareColorToBuffer(GREEN, readbackBuffer, fence); + } + + // clear the slot for all buffers, and set the buffer with the same slot as the green buffer + // should be blue now + { + auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); + ASSERT_TRUE(status.isOk()); + mWriter->setLayerBufferWithNewCommand(display, layer, /*slot*/ 0, clearSlotBuffer->handle, + /*fence*/ -1); + mWriter->setLayerBufferWithNewCommand(display, layer, /*slot*/ 1, clearSlotBuffer->handle, + /*fence*/ -1); + // SurfaceFlinger will never clear the active buffer (slot 2), but will free up the + // buffer slot so it will be re-used for the next setLayerBuffer command + mWriter->setLayerBuffer(display, layer, /*slot*/ 2, blueBuffer->handle, blueFence); + mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); + execute(); + ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter->presentDisplay(display); + execute(); + auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); + ASSERT_TRUE(fenceStatus.isOk()); + ReadbackHelper::compareColorToBuffer(BLUE, readbackBuffer, fence); } } diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 0f00fd6094..7b852e029d 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -1647,28 +1647,85 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerBuffer) { } TEST_P(GraphicsComposerAidlCommandTest, SetLayerBufferWithSlotsToClear) { - auto clearSlotBuffer = allocate(1u, 1u, ::android::PIXEL_FORMAT_RGB_888); - ASSERT_NE(nullptr, clearSlotBuffer); - auto clearSlotBufferHandle = clearSlotBuffer->handle; + const auto& [versionStatus, version] = mComposerClient->getInterfaceVersion(); + ASSERT_TRUE(versionStatus.isOk()); + if (version == 1) { + GTEST_SUCCEED() << "Device does not support the new API for clearing buffer slots"; + return; + } + + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + + auto& writer = getWriter(getPrimaryDisplayId()); const auto buffer1 = allocate(::android::PIXEL_FORMAT_RGBA_8888); ASSERT_NE(nullptr, buffer1); const auto handle1 = buffer1->handle; - const auto& [layerStatus, layer] = - mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); - EXPECT_TRUE(layerStatus.isOk()); - auto& writer = getWriter(getPrimaryDisplayId()); writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle1, /*acquireFence*/ -1); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); - // Ensure we can clear a buffer slot and then set that same slot with a new buffer const auto buffer2 = allocate(::android::PIXEL_FORMAT_RGBA_8888); ASSERT_NE(nullptr, buffer2); const auto handle2 = buffer2->handle; - writer.setLayerBufferWithNewCommand(getPrimaryDisplayId(), layer, /* slot */ 0, + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 1, handle2, /*acquireFence*/ -1); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + // Ensure we can clear the buffer slots and then set the active slot with a new buffer + const auto buffer3 = allocate(::android::PIXEL_FORMAT_RGBA_8888); + ASSERT_NE(nullptr, buffer3); + const auto handle3 = buffer3->handle; + writer.setLayerBufferSlotsToClear(getPrimaryDisplayId(), layer, /*slotsToClear*/ {0, 1}); + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 1, handle3, /*acquireFence*/ -1); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); +} + +TEST_P(GraphicsComposerAidlCommandTest, SetLayerBufferWithSlotsToClear_backwardsCompatible) { + const auto& [versionStatus, version] = mComposerClient->getInterfaceVersion(); + ASSERT_TRUE(versionStatus.isOk()); + if (version > 1) { + GTEST_SUCCEED() << "Device does not need a backwards compatible way to clear buffer slots"; + return; + } + + auto clearSlotBuffer = allocate(1u, 1u, ::android::PIXEL_FORMAT_RGB_888); + ASSERT_NE(nullptr, clearSlotBuffer); + auto clearSlotBufferHandle = clearSlotBuffer->handle; + + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + + auto& writer = getWriter(getPrimaryDisplayId()); + + const auto buffer1 = allocate(::android::PIXEL_FORMAT_RGBA_8888); + ASSERT_NE(nullptr, buffer1); + const auto handle1 = buffer1->handle; + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle1, /*acquireFence*/ -1); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + const auto buffer2 = allocate(::android::PIXEL_FORMAT_RGBA_8888); + ASSERT_NE(nullptr, buffer2); + const auto handle2 = buffer2->handle; + EXPECT_TRUE(layerStatus.isOk()); + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 1, handle2, /*acquireFence*/ -1); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + // Ensure we can clear a buffer slot and then set that same slot with a new buffer + const auto buffer3 = allocate(::android::PIXEL_FORMAT_RGBA_8888); + ASSERT_NE(nullptr, buffer3); + const auto handle3 = buffer2->handle; + // SurfaceFlinger will never clear the active buffer, instead it will clear non-active buffers + // and then re-use the active buffer's slot for the new buffer + writer.setLayerBufferWithNewCommand(getPrimaryDisplayId(), layer, /*slot*/ 0, clearSlotBufferHandle, /*acquireFence*/ -1); - writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle2, /*acquireFence*/ -1); + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 1, handle3, /*acquireFence*/ -1); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); } From 191f76bb3803eddbf20105fe5ebaf839b61e1623 Mon Sep 17 00:00:00 2001 From: Ray Chin Date: Tue, 13 Dec 2022 17:50:59 +0800 Subject: [PATCH 516/998] Add new DemuxFilterStatus NO_DATA Bug: 260651195 Test: test on cf_x86_tv-userdebug Change-Id: I56619579ebf09b49d288254f2d77320cd5575d69 --- .../current/android/hardware/tv/tuner/DemuxFilterStatus.aidl | 1 + .../aidl/android/hardware/tv/tuner/DemuxFilterStatus.aidl | 5 +++++ tv/tuner/aidl/default/Filter.cpp | 2 ++ 3 files changed, 8 insertions(+) diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterStatus.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterStatus.aidl index 36b40ea5b9..1dc593ac18 100644 --- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterStatus.aidl +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterStatus.aidl @@ -39,4 +39,5 @@ enum DemuxFilterStatus { LOW_WATER = 2, HIGH_WATER = 4, OVERFLOW = 8, + NO_DATA = 16, } diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterStatus.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterStatus.aidl index e6f3b63b95..45a473ea5f 100644 --- a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterStatus.aidl +++ b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterStatus.aidl @@ -46,4 +46,9 @@ enum DemuxFilterStatus { * discarded. */ OVERFLOW = 1 << 3, + + /** + * Indicating there is no data coming to the filter. + */ + NO_DATA = 1 << 4, } diff --git a/tv/tuner/aidl/default/Filter.cpp b/tv/tuner/aidl/default/Filter.cpp index ade265ca26..59e301dccb 100644 --- a/tv/tuner/aidl/default/Filter.cpp +++ b/tv/tuner/aidl/default/Filter.cpp @@ -691,6 +691,8 @@ DemuxFilterStatus Filter::checkFilterStatusChange(uint32_t availableToWrite, return DemuxFilterStatus::OVERFLOW; } else if (availableToRead > highThreshold) { return DemuxFilterStatus::HIGH_WATER; + } else if (availableToRead == 0) { + return DemuxFilterStatus::NO_DATA; } else if (availableToRead < lowThreshold) { return DemuxFilterStatus::LOW_WATER; } From ac59d54a04907b1d2e797b8bfb04c997b73b53a5 Mon Sep 17 00:00:00 2001 From: Sewook Seo Date: Tue, 20 Dec 2022 04:54:35 +0000 Subject: [PATCH 517/998] Add VTS for measurement type UTRAN ECNO Bug: 243685647 Test: atest VtsHalRadioTargetTest Change-Id: Iac89c8b73026d7974726cba57a390da9c04535eb --- .../include/libradiocompat/RadioNetwork.h | 3 ++ .../libradiocompat/network/RadioNetwork.cpp | 5 ++++ radio/aidl/vts/radio_network_test.cpp | 29 ++++++++++++++++++- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h index 45c1645efc..7dbb27b4e2 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h @@ -18,6 +18,9 @@ #include "RadioCompatBase.h" #include +#include + +// using namespace aidl::android::hardware::radio::network; namespace android::hardware::radio::compat { diff --git a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp index 5e44fff81a..e6a44d129a 100644 --- a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp +++ b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp @@ -261,6 +261,11 @@ ScopedAStatus RadioNetwork::setSignalStrengthReportingCriteria( if (infos.size() > 1) { LOG(WARNING) << "Multi-element reporting criteria are not supported with HIDL HAL"; } + if (infos[0].signalMeasurement == aidl::SignalThresholdInfo::SIGNAL_MEASUREMENT_TYPE_ECNO) { + LOG(WARNING) << "SIGNAL_MEASUREMENT_TYPE_ECNO are not supported with HIDL HAL"; + respond()->setSignalStrengthReportingCriteriaResponse(notSupported(serial)); + return ok(); + } mHal1_5->setSignalStrengthReportingCriteria_1_5(serial, toHidl(infos[0]), V1_5::AccessNetwork(infos[0].ran)); return ok(); diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index 43a4737b5d..03127cd79f 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -356,7 +356,7 @@ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Geran) { /* * Test IRadioNetwork.setSignalStrengthReportingCriteria() for UTRAN */ -TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Utran) { +TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Utran_Rscp) { serial = GetRandomSerialNumber(); SignalThresholdInfo signalThresholdInfo; @@ -379,6 +379,33 @@ TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Utran) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::NONE})); } +/* + * Test IRadioNetwork.setSignalStrengthReportingCriteria() for UTRAN + */ +TEST_P(RadioNetworkTest, setSignalStrengthReportingCriteria_Utran_Ecno) { + serial = GetRandomSerialNumber(); + + SignalThresholdInfo signalThresholdInfo; + signalThresholdInfo.signalMeasurement = SignalThresholdInfo::SIGNAL_MEASUREMENT_TYPE_ECNO; + signalThresholdInfo.hysteresisMs = 5000; + signalThresholdInfo.hysteresisDb = 2; + signalThresholdInfo.thresholds = {-22, -18, 0}; + signalThresholdInfo.isEnabled = true; + signalThresholdInfo.ran = AccessNetwork::UTRAN; + + ndk::ScopedAStatus res = + radio_network->setSignalStrengthReportingCriteria(serial, {signalThresholdInfo}); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); + EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); + + ALOGI("setSignalStrengthReportingCriteria_Utran, rspInfo.error = %s\n", + toString(radioRsp_network->rspInfo.error).c_str()); + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); +} + /* * Test IRadioNetwork.setSignalStrengthReportingCriteria() for EUTRAN */ From 7aaacf606818d81fd925fed18b51902861d9e1de Mon Sep 17 00:00:00 2001 From: Sally Qi Date: Wed, 14 Dec 2022 16:19:00 -0800 Subject: [PATCH 518/998] [Graphics AIDL interface] add supportMixedColorSpaces boolean variable. - To determine if the device can hendle mixed colorspaces without falling back to client composition. Bug: 242588489 Test: build and flash Change-Id: Ied346e1fe9c0b260c37aee458eddac689e711336 --- .../graphics/composer3/OverlayProperties.aidl | 7 +++- .../SupportedBufferCombinations.aidl | 39 ------------------- .../graphics/composer3/OverlayProperties.aidl | 12 +++++- .../SupportedBufferCombinations.aidl | 25 ------------ 4 files changed, 16 insertions(+), 67 deletions(-) delete mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl delete mode 100644 graphics/composer/aidl/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl index 4d8fcac63e..3db134e3fe 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl @@ -34,5 +34,10 @@ package android.hardware.graphics.composer3; @VintfStability parcelable OverlayProperties { - android.hardware.graphics.composer3.SupportedBufferCombinations[] combinations; + android.hardware.graphics.composer3.OverlayProperties.SupportedBufferCombinations[] combinations; + boolean supportMixedColorSpaces; + parcelable SupportedBufferCombinations { + android.hardware.graphics.common.PixelFormat[] pixelFormats; + android.hardware.graphics.common.Dataspace[] dataspaces; + } } diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl deleted file mode 100644 index 1828be1078..0000000000 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/** - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.graphics.composer3; -@VintfStability -parcelable SupportedBufferCombinations { - android.hardware.graphics.common.PixelFormat[] pixelFormats; - android.hardware.graphics.common.Dataspace[] dataspaces; -} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl index d3bd7d3b41..32688e2530 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl @@ -16,14 +16,22 @@ package android.hardware.graphics.composer3; -import android.hardware.graphics.composer3.SupportedBufferCombinations; - @VintfStability parcelable OverlayProperties { + parcelable SupportedBufferCombinations { + // List of pixelformats and dataspaces that can be used together. + // All pixelformats and dataspaces stored inside are valid combinations. + android.hardware.graphics.common.PixelFormat[] pixelFormats; + android.hardware.graphics.common.Dataspace[] dataspaces; + } // Array of all valid pixelformat and dataspace combinations. // If all supported formats work with all supported dataspaces, // then this list may only have 1 entry. // If some dataspaces, e.g. scRGB, only work with specific formats, // then this list may contain more than 1 entry. SupportedBufferCombinations[] combinations; + + // True if the DPU is able to color manage at least two overlays + // with different input colorspaces, false otherwise. + boolean supportMixedColorSpaces; } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl deleted file mode 100644 index 41f88172b4..0000000000 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/SupportedBufferCombinations.aidl +++ /dev/null @@ -1,25 +0,0 @@ -/** - * 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. - */ - -package android.hardware.graphics.composer3; - -@VintfStability -parcelable SupportedBufferCombinations { - // List of pixelformats and dataspaces that can be used together. - // All pixelformats and dataspaces stored inside are valid combinations. - android.hardware.graphics.common.PixelFormat[] pixelFormats; - android.hardware.graphics.common.Dataspace[] dataspaces; -} From 76937c65335ff323dcadda37963cb26535f95721 Mon Sep 17 00:00:00 2001 From: Sungtak Lee Date: Wed, 7 Dec 2022 11:42:03 +0000 Subject: [PATCH 519/998] AIDL BufferPool implementation (HIDL -> AIDL) Bug: 254050250 Test: m Change-Id: I0d7bae2c01bd480d1e99f4b39c4a9013a2828897 --- media/bufferpool/aidl/default/Accessor.cpp | 487 +++++++-- media/bufferpool/aidl/default/Accessor.h | 150 ++- .../bufferpool/aidl/default/AccessorImpl.cpp | 993 ------------------ media/bufferpool/aidl/default/AccessorImpl.h | 431 -------- media/bufferpool/aidl/default/Android.bp | 50 + media/bufferpool/aidl/default/BufferPool.cpp | 540 ++++++++++ media/bufferpool/aidl/default/BufferPool.h | 337 ++++++ .../aidl/default/BufferPoolClient.cpp | 268 +++-- .../aidl/default/BufferPoolClient.h | 63 +- .../bufferpool/aidl/default/BufferStatus.cpp | 73 +- media/bufferpool/aidl/default/BufferStatus.h | 49 +- .../bufferpool/aidl/default/ClientManager.cpp | 310 +++--- media/bufferpool/aidl/default/Connection.cpp | 94 +- media/bufferpool/aidl/default/Connection.h | 62 +- media/bufferpool/aidl/default/DataHelper.h | 124 +++ media/bufferpool/aidl/default/Observer.cpp | 26 +- media/bufferpool/aidl/default/Observer.h | 44 +- .../BufferPoolTypes.h | 55 +- .../ClientManager.h | 81 +- .../bufferpool/aidl/default/tests/Android.bp | 93 ++ .../aidl/default/tests/BufferpoolUnitTest.cpp | 541 ---------- .../aidl/default/tests/allocator.cpp | 4 +- .../bufferpool/aidl/default/tests/allocator.h | 21 +- media/bufferpool/aidl/default/tests/cond.cpp | 63 +- media/bufferpool/aidl/default/tests/multi.cpp | 62 +- .../bufferpool/aidl/default/tests/single.cpp | 42 +- 26 files changed, 2199 insertions(+), 2864 deletions(-) delete mode 100644 media/bufferpool/aidl/default/AccessorImpl.cpp delete mode 100644 media/bufferpool/aidl/default/AccessorImpl.h create mode 100644 media/bufferpool/aidl/default/Android.bp create mode 100644 media/bufferpool/aidl/default/BufferPool.cpp create mode 100644 media/bufferpool/aidl/default/BufferPool.h create mode 100644 media/bufferpool/aidl/default/DataHelper.h rename media/bufferpool/aidl/default/include/{bufferpool => bufferpool2}/BufferPoolTypes.h (58%) rename media/bufferpool/aidl/default/include/{bufferpool => bufferpool2}/ClientManager.h (71%) create mode 100644 media/bufferpool/aidl/default/tests/Android.bp delete mode 100644 media/bufferpool/aidl/default/tests/BufferpoolUnitTest.cpp diff --git a/media/bufferpool/aidl/default/Accessor.cpp b/media/bufferpool/aidl/default/Accessor.cpp index e05b12a156..3d206ac78b 100644 --- a/media/bufferpool/aidl/default/Accessor.cpp +++ b/media/bufferpool/aidl/default/Accessor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -13,22 +13,60 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#define LOG_TAG "BufferPoolConnection" +#define LOG_TAG "AidlBufferPoolAcc" +//#define LOG_NDEBUG 0 + +#include +#include +#include +#include +#include +#include #include "Accessor.h" -#include "AccessorImpl.h" #include "Connection.h" +#include "DataHelper.h" -namespace android { -namespace hardware { -namespace media { -namespace bufferpool { -namespace V2_0 { -namespace implementation { +namespace aidl::android::hardware::media::bufferpool2::implementation { + +namespace { + static constexpr nsecs_t kEvictGranularityNs = 1000000000; // 1 sec + static constexpr nsecs_t kEvictDurationNs = 5000000000; // 5 secs +} + +#ifdef __ANDROID_VNDK__ +static constexpr uint32_t kSeqIdVndkBit = 1U << 31; +#else +static constexpr uint32_t kSeqIdVndkBit = 0; +#endif + +static constexpr uint32_t kSeqIdMax = 0x7fffffff; +uint32_t Accessor::sSeqId = time(nullptr) & kSeqIdMax; + +namespace { +// anonymous namespace +static std::shared_ptr sConnectionDeathRecipient = + std::make_shared(); + +void serviceDied(void *cookie) { + if (sConnectionDeathRecipient) { + sConnectionDeathRecipient->onDead(cookie); + } +} +} + +std::shared_ptr Accessor::getConnectionDeathRecipient() { + return sConnectionDeathRecipient; +} + +ConnectionDeathRecipient::ConnectionDeathRecipient() { + mDeathRecipient = ndk::ScopedAIBinder_DeathRecipient( + AIBinder_DeathRecipient_new(serviceDied)); +} void ConnectionDeathRecipient::add( int64_t connectionId, - const sp &accessor) { + const std::shared_ptr &accessor) { std::lock_guard lock(mLock); if (mAccessors.find(connectionId) == mAccessors.end()) { mAccessors.insert(std::make_pair(connectionId, accessor)); @@ -40,7 +78,7 @@ void ConnectionDeathRecipient::remove(int64_t connectionId) { mAccessors.erase(connectionId); auto it = mConnectionToCookie.find(connectionId); if (it != mConnectionToCookie.end()) { - uint64_t cookie = it->second; + void * cookie = it->second; mConnectionToCookie.erase(it); auto cit = mCookieToConnections.find(cookie); if (cit != mCookieToConnections.end()) { @@ -53,7 +91,7 @@ void ConnectionDeathRecipient::remove(int64_t connectionId) { } void ConnectionDeathRecipient::addCookieToConnection( - uint64_t cookie, + void *cookie, int64_t connectionId) { std::lock_guard lock(mLock); if (mAccessors.find(connectionId) == mAccessors.end()) { @@ -69,11 +107,8 @@ void ConnectionDeathRecipient::addCookieToConnection( } } -void ConnectionDeathRecipient::serviceDied( - uint64_t cookie, - const wp<::android::hidl::base::V1_0::IBase>& /* who */ - ) { - std::map> connectionsToClose; +void ConnectionDeathRecipient::onDead(void *cookie) { + std::map> connectionsToClose; { std::lock_guard lock(mLock); @@ -92,9 +127,9 @@ void ConnectionDeathRecipient::serviceDied( } if (connectionsToClose.size() > 0) { - sp accessor; + std::shared_ptr accessor; for (auto it = connectionsToClose.begin(); it != connectionsToClose.end(); ++it) { - accessor = it->second.promote(); + accessor = it->second.lock(); if (accessor) { accessor->close(it->first); @@ -104,127 +139,371 @@ void ConnectionDeathRecipient::serviceDied( } } -namespace { -static sp sConnectionDeathRecipient = - new ConnectionDeathRecipient(); +AIBinder_DeathRecipient *ConnectionDeathRecipient::getRecipient() { + return mDeathRecipient.get(); } -sp Accessor::getConnectionDeathRecipient() { - return sConnectionDeathRecipient; -} - -void Accessor::createInvalidator() { - Accessor::Impl::createInvalidator(); -} - -void Accessor::createEvictor() { - Accessor::Impl::createEvictor(); -} - -// Methods from ::android::hardware::media::bufferpool::V2_0::IAccessor follow. -Return Accessor::connect( - const sp<::android::hardware::media::bufferpool::V2_0::IObserver>& observer, - connect_cb _hidl_cb) { - sp connection; +::ndk::ScopedAStatus Accessor::connect(const std::shared_ptr<::aidl::android::hardware::media::bufferpool2::IObserver>& in_observer, ::aidl::android::hardware::media::bufferpool2::IAccessor::ConnectionInfo* _aidl_return) { + std::shared_ptr connection; ConnectionId connectionId; uint32_t msgId; - const StatusDescriptor* fmqDesc; - const InvalidationDescriptor* invDesc; - - ResultStatus status = connect( - observer, false, &connection, &connectionId, &msgId, &fmqDesc, &invDesc); + StatusDescriptor statusDesc; + InvalidationDescriptor invDesc; + BufferPoolStatus status = connect( + in_observer, false, &connection, &connectionId, &msgId, &statusDesc, &invDesc); if (status == ResultStatus::OK) { - _hidl_cb(status, connection, connectionId, msgId, *fmqDesc, *invDesc); - } else { - _hidl_cb(status, nullptr, -1LL, 0, - android::hardware::MQDescriptorSync( - std::vector(), - nullptr /* nhandle */, 0 /* size */), - android::hardware::MQDescriptorUnsync( - std::vector(), - nullptr /* nhandle */, 0 /* size */)); + _aidl_return->connection = connection; + _aidl_return->connectionId = connectionId; + _aidl_return->msgId = msgId; + _aidl_return->toFmqDesc = std::move(statusDesc); + _aidl_return->fromFmqDesc = std::move(invDesc); + return ::ndk::ScopedAStatus::ok(); } - return Void(); + return ::ndk::ScopedAStatus::fromServiceSpecificError(status); } Accessor::Accessor(const std::shared_ptr &allocator) - : mImpl(new Impl(allocator)) {} + : mAllocator(allocator), mScheduleEvictTs(0) {} Accessor::~Accessor() { } bool Accessor::isValid() { - return (bool)mImpl && mImpl->isValid(); + return mBufferPool.isValid(); } -ResultStatus Accessor::flush() { - if (mImpl) { - mImpl->flush(); - return ResultStatus::OK; - } - return ResultStatus::CRITICAL_ERROR; +BufferPoolStatus Accessor::flush() { + std::lock_guard lock(mBufferPool.mMutex); + mBufferPool.processStatusMessages(); + mBufferPool.flush(ref()); + return ResultStatus::OK; } -ResultStatus Accessor::allocate( +BufferPoolStatus Accessor::allocate( ConnectionId connectionId, const std::vector ¶ms, BufferId *bufferId, const native_handle_t** handle) { - if (mImpl) { - return mImpl->allocate(connectionId, params, bufferId, handle); + std::unique_lock lock(mBufferPool.mMutex); + mBufferPool.processStatusMessages(); + BufferPoolStatus status = ResultStatus::OK; + if (!mBufferPool.getFreeBuffer(mAllocator, params, bufferId, handle)) { + lock.unlock(); + std::shared_ptr alloc; + size_t allocSize; + status = mAllocator->allocate(params, &alloc, &allocSize); + lock.lock(); + if (status == ResultStatus::OK) { + status = mBufferPool.addNewBuffer(alloc, allocSize, params, bufferId, handle); + } + ALOGV("create a buffer %d : %u %p", + status == ResultStatus::OK, *bufferId, *handle); } - return ResultStatus::CRITICAL_ERROR; + if (status == ResultStatus::OK) { + // TODO: handle ownBuffer failure + mBufferPool.handleOwnBuffer(connectionId, *bufferId); + } + mBufferPool.cleanUp(); + scheduleEvictIfNeeded(); + return status; } -ResultStatus Accessor::fetch( +BufferPoolStatus Accessor::fetch( ConnectionId connectionId, TransactionId transactionId, BufferId bufferId, const native_handle_t** handle) { - if (mImpl) { - return mImpl->fetch(connectionId, transactionId, bufferId, handle); - } - return ResultStatus::CRITICAL_ERROR; -} - -ResultStatus Accessor::connect( - const sp &observer, bool local, - sp *connection, ConnectionId *pConnectionId, - uint32_t *pMsgId, - const StatusDescriptor** statusDescPtr, - const InvalidationDescriptor** invDescPtr) { - if (mImpl) { - ResultStatus status = mImpl->connect( - this, observer, connection, pConnectionId, pMsgId, - statusDescPtr, invDescPtr); - if (!local && status == ResultStatus::OK) { - sp accessor(this); - sConnectionDeathRecipient->add(*pConnectionId, accessor); + std::lock_guard lock(mBufferPool.mMutex); + mBufferPool.processStatusMessages(); + auto found = mBufferPool.mTransactions.find(transactionId); + if (found != mBufferPool.mTransactions.end() && + contains(&mBufferPool.mPendingTransactions, + connectionId, transactionId)) { + if (found->second->mSenderValidated && + found->second->mStatus == BufferStatus::TRANSFER_FROM && + found->second->mBufferId == bufferId) { + found->second->mStatus = BufferStatus::TRANSFER_FETCH; + auto bufferIt = mBufferPool.mBuffers.find(bufferId); + if (bufferIt != mBufferPool.mBuffers.end()) { + mBufferPool.mStats.onBufferFetched(); + *handle = bufferIt->second->handle(); + return ResultStatus::OK; + } } - return status; } + mBufferPool.cleanUp(); + scheduleEvictIfNeeded(); return ResultStatus::CRITICAL_ERROR; } -ResultStatus Accessor::close(ConnectionId connectionId) { - if (mImpl) { - ResultStatus status = mImpl->close(connectionId); - sConnectionDeathRecipient->remove(connectionId); - return status; +BufferPoolStatus Accessor::connect( + const std::shared_ptr &observer, bool local, + std::shared_ptr *connection, ConnectionId *pConnectionId, + uint32_t *pMsgId, + StatusDescriptor* statusDescPtr, + InvalidationDescriptor* invDescPtr) { + std::shared_ptr newConnection = ::ndk::SharedRefBase::make(); + BufferPoolStatus status = ResultStatus::CRITICAL_ERROR; + { + std::lock_guard lock(mBufferPool.mMutex); + if (newConnection) { + int32_t pid = getpid(); + ConnectionId id = (int64_t)pid << 32 | sSeqId | kSeqIdVndkBit; + status = mBufferPool.mObserver.open(id, statusDescPtr); + if (status == ResultStatus::OK) { + newConnection->initialize(ref(), id); + *connection = newConnection; + *pConnectionId = id; + *pMsgId = mBufferPool.mInvalidation.mInvalidationId; + mBufferPool.mConnectionIds.insert(id); + mBufferPool.mInvalidationChannel.getDesc(invDescPtr); + mBufferPool.mInvalidation.onConnect(id, observer); + if (sSeqId == kSeqIdMax) { + sSeqId = 0; + } else { + ++sSeqId; + } + } + + } + mBufferPool.processStatusMessages(); + mBufferPool.cleanUp(); + scheduleEvictIfNeeded(); } - return ResultStatus::CRITICAL_ERROR; + if (!local && status == ResultStatus::OK) { + std::shared_ptr accessor(ref()); + sConnectionDeathRecipient->add(*pConnectionId, accessor); + } + return status; +} + +BufferPoolStatus Accessor::close(ConnectionId connectionId) { + { + std::lock_guard lock(mBufferPool.mMutex); + ALOGV("connection close %lld: %u", (long long)connectionId, mBufferPool.mInvalidation.mId); + mBufferPool.processStatusMessages(); + mBufferPool.handleClose(connectionId); + mBufferPool.mObserver.close(connectionId); + mBufferPool.mInvalidation.onClose(connectionId); + // Since close# will be called after all works are finished, it is OK to + // evict unused buffers. + mBufferPool.cleanUp(true); + scheduleEvictIfNeeded(); + } + sConnectionDeathRecipient->remove(connectionId); + return ResultStatus::OK; } void Accessor::cleanUp(bool clearCache) { - if (mImpl) { - mImpl->cleanUp(clearCache); + // transaction timeout, buffer caching TTL handling + std::lock_guard lock(mBufferPool.mMutex); + mBufferPool.processStatusMessages(); + mBufferPool.cleanUp(clearCache); +} + +void Accessor::handleInvalidateAck() { + std::map> observers; + uint32_t invalidationId; + { + std::lock_guard lock(mBufferPool.mMutex); + mBufferPool.processStatusMessages(); + mBufferPool.mInvalidation.onHandleAck(&observers, &invalidationId); + } + // Do not hold lock for send invalidations + size_t deadClients = 0; + for (auto it = observers.begin(); it != observers.end(); ++it) { + const std::shared_ptr observer = it->second; + if (observer) { + ::ndk::ScopedAStatus status = observer->onMessage(it->first, invalidationId); + if (!status.isOk()) { + ++deadClients; + } + } + } + if (deadClients > 0) { + ALOGD("During invalidation found %zu dead clients", deadClients); } } -//IAccessor* HIDL_FETCH_IAccessor(const char* /* name */) { -// return new Accessor(); -//} +void Accessor::invalidatorThread( + std::map> &accessors, + std::mutex &mutex, + std::condition_variable &cv, + bool &ready) { + constexpr uint32_t NUM_SPIN_TO_INCREASE_SLEEP = 1024; + constexpr uint32_t NUM_SPIN_TO_LOG = 1024*8; + constexpr useconds_t MAX_SLEEP_US = 10000; + uint32_t numSpin = 0; + useconds_t sleepUs = 1; -} // namespace implementation -} // namespace V2_0 -} // namespace bufferpool -} // namespace media -} // namespace hardware -} // namespace android + while(true) { + std::map> copied; + { + std::unique_lock lock(mutex); + while (!ready) { + numSpin = 0; + sleepUs = 1; + cv.wait(lock); + } + copied.insert(accessors.begin(), accessors.end()); + } + std::list erased; + for (auto it = copied.begin(); it != copied.end(); ++it) { + const std::shared_ptr acc = it->second.lock(); + if (!acc) { + erased.push_back(it->first); + } else { + acc->handleInvalidateAck(); + } + } + { + std::unique_lock lock(mutex); + for (auto it = erased.begin(); it != erased.end(); ++it) { + accessors.erase(*it); + } + if (accessors.size() == 0) { + ready = false; + } else { + // N.B. Since there is not a efficient way to wait over FMQ, + // polling over the FMQ is the current way to prevent draining + // CPU. + lock.unlock(); + ++numSpin; + if (numSpin % NUM_SPIN_TO_INCREASE_SLEEP == 0 && + sleepUs < MAX_SLEEP_US) { + sleepUs *= 10; + } + if (numSpin % NUM_SPIN_TO_LOG == 0) { + ALOGW("invalidator thread spinning"); + } + ::usleep(sleepUs); + } + } + } +} + +Accessor::AccessorInvalidator::AccessorInvalidator() : mReady(false) { + std::thread invalidator( + invalidatorThread, + std::ref(mAccessors), + std::ref(mMutex), + std::ref(mCv), + std::ref(mReady)); + invalidator.detach(); +} + +void Accessor::AccessorInvalidator::addAccessor( + uint32_t accessorId, const std::weak_ptr &accessor) { + bool notify = false; + std::unique_lock lock(mMutex); + if (mAccessors.find(accessorId) == mAccessors.end()) { + if (!mReady) { + mReady = true; + notify = true; + } + mAccessors.emplace(accessorId, accessor); + ALOGV("buffer invalidation added bp:%u %d", accessorId, notify); + } + lock.unlock(); + if (notify) { + mCv.notify_one(); + } +} + +void Accessor::AccessorInvalidator::delAccessor(uint32_t accessorId) { + std::lock_guard lock(mMutex); + mAccessors.erase(accessorId); + ALOGV("buffer invalidation deleted bp:%u", accessorId); + if (mAccessors.size() == 0) { + mReady = false; + } +} + +std::unique_ptr Accessor::sInvalidator; + +void Accessor::createInvalidator() { + if (!sInvalidator) { + sInvalidator = std::make_unique(); + } +} + +void Accessor::evictorThread( + std::map, nsecs_t, std::owner_less<>> &accessors, + std::mutex &mutex, + std::condition_variable &cv) { + std::list> evictList; + while (true) { + int expired = 0; + int evicted = 0; + { + nsecs_t now = systemTime(); + std::unique_lock lock(mutex); + while (accessors.size() == 0) { + cv.wait(lock); + } + auto it = accessors.begin(); + while (it != accessors.end()) { + if (now > (it->second + kEvictDurationNs)) { + ++expired; + evictList.push_back(it->first); + it = accessors.erase(it); + } else { + ++it; + } + } + } + // evict idle accessors; + for (auto it = evictList.begin(); it != evictList.end(); ++it) { + const std::shared_ptr accessor = it->lock(); + if (accessor) { + accessor->cleanUp(true); + ++evicted; + } + } + if (expired > 0) { + ALOGD("evictor expired: %d, evicted: %d", expired, evicted); + } + evictList.clear(); + ::usleep(kEvictGranularityNs / 1000); + } +} + +Accessor::AccessorEvictor::AccessorEvictor() { + std::thread evictor( + evictorThread, + std::ref(mAccessors), + std::ref(mMutex), + std::ref(mCv)); + evictor.detach(); +} + +void Accessor::AccessorEvictor::addAccessor( + const std::weak_ptr &accessor, nsecs_t ts) { + std::lock_guard lock(mMutex); + bool notify = mAccessors.empty(); + auto it = mAccessors.find(accessor); + if (it == mAccessors.end()) { + mAccessors.emplace(accessor, ts); + } else { + it->second = ts; + } + if (notify) { + mCv.notify_one(); + } +} + +std::unique_ptr Accessor::sEvictor; + +void Accessor::createEvictor() { + if (!sEvictor) { + sEvictor = std::make_unique(); + } +} + +void Accessor::scheduleEvictIfNeeded() { + nsecs_t now = systemTime(); + + if (now > (mScheduleEvictTs + kEvictGranularityNs)) { + mScheduleEvictTs = now; + sEvictor->addAccessor(ref(), now); + } +} + +} // namespace aidl::android::hardware::media::bufferpool2::implemntation { diff --git a/media/bufferpool/aidl/default/Accessor.h b/media/bufferpool/aidl/default/Accessor.h index 8b43301610..85e2fa77f5 100644 --- a/media/bufferpool/aidl/default/Accessor.h +++ b/media/bufferpool/aidl/default/Accessor.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -14,73 +14,65 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_ACCESSOR_H -#define ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_ACCESSOR_H +#pragma once -#include -#include -#include -#include -#include -#include "BufferStatus.h" +#include +#include +#include +#include +#include #include +#include -namespace android { -namespace hardware { -namespace media { -namespace bufferpool { -namespace V2_0 { -namespace implementation { +#include "BufferPool.h" -using ::android::hardware::hidl_array; -using ::android::hardware::hidl_memory; -using ::android::hardware::hidl_string; -using ::android::hardware::hidl_vec; -using ::android::hardware::Return; -using ::android::hardware::Void; -using ::android::sp; +namespace aidl::android::hardware::media::bufferpool2::implementation { -struct Accessor; struct Connection; +using ::aidl::android::hardware::media::bufferpool2::IObserver; +using ::aidl::android::hardware::media::bufferpool2::IAccessor; /** * Receives death notifications from remote connections. * On death notifications, the connections are closed and used resources * are released. */ -struct ConnectionDeathRecipient : public hardware::hidl_death_recipient { +struct ConnectionDeathRecipient { + ConnectionDeathRecipient(); /** * Registers a newly connected connection from remote processes. */ - void add(int64_t connectionId, const sp &accessor); + void add(int64_t connectionId, const std::shared_ptr &accessor); /** * Removes a connection. */ void remove(int64_t connectionId); - void addCookieToConnection(uint64_t cookie, int64_t connectionId); + void addCookieToConnection(void *cookie, int64_t connectionId); - virtual void serviceDied( - uint64_t /* cookie */, - const wp<::android::hidl::base::V1_0::IBase>& /* who */ - ) override; + void onDead(void *cookie); + + AIBinder_DeathRecipient *getRecipient(); private: + ::ndk::ScopedAIBinder_DeathRecipient mDeathRecipient; + std::mutex mLock; - std::map> mCookieToConnections; - std::map mConnectionToCookie; - std::map> mAccessors; + std::map> mCookieToConnections; + std::map mConnectionToCookie; + std::map> mAccessors; }; /** * A buffer pool accessor which enables a buffer pool to communicate with buffer * pool clients. 1:1 correspondense holds between a buffer pool and an accessor. */ -struct Accessor : public IAccessor { - // Methods from ::android::hardware::media::bufferpool::V2_0::IAccessor follow. - Return connect(const sp<::android::hardware::media::bufferpool::V2_0::IObserver>& observer, connect_cb _hidl_cb) override; +struct Accessor : public BnAccessor { + // Methods from ::aidl::android::hardware::media::bufferpool2::IAccessor. + ::ndk::ScopedAStatus connect(const std::shared_ptr& in_observer, + IAccessor::ConnectionInfo* _aidl_return) override; /** * Creates a buffer pool accessor which uses the specified allocator. @@ -96,7 +88,7 @@ struct Accessor : public IAccessor { bool isValid(); /** Invalidates all buffers which are owned by bufferpool */ - ResultStatus flush(); + BufferPoolStatus flush(); /** Allocates a buffer from a buffer pool. * @@ -109,7 +101,7 @@ struct Accessor : public IAccessor { * NO_MEMORY when there is no memory. * CRITICAL_ERROR otherwise. */ - ResultStatus allocate( + BufferPoolStatus allocate( ConnectionId connectionId, const std::vector& params, BufferId *bufferId, @@ -127,7 +119,7 @@ struct Accessor : public IAccessor { * NO_MEMORY when there is no memory. * CRITICAL_ERROR otherwise. */ - ResultStatus fetch( + BufferPoolStatus fetch( ConnectionId connectionId, TransactionId transactionId, BufferId bufferId, @@ -153,13 +145,13 @@ struct Accessor : public IAccessor { * NO_MEMORY when there is no memory. * CRITICAL_ERROR otherwise. */ - ResultStatus connect( - const sp& observer, + BufferPoolStatus connect( + const std::shared_ptr& observer, bool local, - sp *connection, ConnectionId *pConnectionId, + std::shared_ptr *connection, ConnectionId *pConnectionId, uint32_t *pMsgId, - const StatusDescriptor** statusDescPtr, - const InvalidationDescriptor** invDescPtr); + StatusDescriptor* statusDescPtr, + InvalidationDescriptor* invDescPtr); /** * Closes the specified connection to the client. @@ -169,10 +161,10 @@ struct Accessor : public IAccessor { * @return OK when the connection is closed. * CRITICAL_ERROR otherwise. */ - ResultStatus close(ConnectionId connectionId); + BufferPoolStatus close(ConnectionId connectionId); /** - * Processes pending buffer status messages and perfoms periodic cache + * Processes pending buffer status messages and performs periodic cache * cleaning. * * @param clearCache if clearCache is true, it frees all buffers waiting @@ -181,24 +173,66 @@ struct Accessor : public IAccessor { void cleanUp(bool clearCache); /** - * Gets a hidl_death_recipient for remote connection death. + * ACK on buffer invalidation messages */ - static sp getConnectionDeathRecipient(); + void handleInvalidateAck(); + + /** + * Gets a death_recipient for remote connection death. + */ + static std::shared_ptr getConnectionDeathRecipient(); static void createInvalidator(); static void createEvictor(); private: - class Impl; - std::shared_ptr mImpl; + // ConnectionId = pid : (timestamp_created + seqId) + // in order to guarantee uniqueness for each connection + static uint32_t sSeqId; + + const std::shared_ptr mAllocator; + nsecs_t mScheduleEvictTs; + BufferPool mBufferPool; + + struct AccessorInvalidator { + std::map> mAccessors; + std::mutex mMutex; + std::condition_variable mCv; + bool mReady; + + AccessorInvalidator(); + void addAccessor(uint32_t accessorId, const std::weak_ptr &accessor); + void delAccessor(uint32_t accessorId); + }; + + static std::unique_ptr sInvalidator; + + static void invalidatorThread( + std::map> &accessors, + std::mutex &mutex, + std::condition_variable &cv, + bool &ready); + + struct AccessorEvictor { + std::map, nsecs_t, std::owner_less<>> mAccessors; + std::mutex mMutex; + std::condition_variable mCv; + + AccessorEvictor(); + void addAccessor(const std::weak_ptr &accessor, nsecs_t ts); + }; + + static std::unique_ptr sEvictor; + + static void evictorThread( + std::map, nsecs_t, std::owner_less<>> &accessors, + std::mutex &mutex, + std::condition_variable &cv); + + void scheduleEvictIfNeeded(); + + friend struct BufferPool; }; -} // namespace implementation -} // namespace V2_0 -} // namespace bufferpool -} // namespace media -} // namespace hardware -} // namespace android - -#endif // ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_ACCESSOR_H +} // namespace aidl::android::hardware::media::bufferpool2::implementation diff --git a/media/bufferpool/aidl/default/AccessorImpl.cpp b/media/bufferpool/aidl/default/AccessorImpl.cpp deleted file mode 100644 index 1d2562e41d..0000000000 --- a/media/bufferpool/aidl/default/AccessorImpl.cpp +++ /dev/null @@ -1,993 +0,0 @@ -/* - * Copyright (C) 2018 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. - */ - -#define LOG_TAG "BufferPoolAccessor2.0" -//#define LOG_NDEBUG 0 - -#include -#include -#include -#include -#include -#include -#include "AccessorImpl.h" -#include "Connection.h" - -namespace android { -namespace hardware { -namespace media { -namespace bufferpool { -namespace V2_0 { -namespace implementation { - -namespace { - static constexpr int64_t kCleanUpDurationUs = 500000; // TODO tune 0.5 sec - static constexpr int64_t kLogDurationUs = 5000000; // 5 secs - - static constexpr size_t kMinAllocBytesForEviction = 1024*1024*15; - static constexpr size_t kMinBufferCountForEviction = 25; - static constexpr size_t kMaxUnusedBufferCount = 64; - static constexpr size_t kUnusedBufferCountTarget = kMaxUnusedBufferCount - 16; - - static constexpr nsecs_t kEvictGranularityNs = 1000000000; // 1 sec - static constexpr nsecs_t kEvictDurationNs = 5000000000; // 5 secs -} - -// Buffer structure in bufferpool process -struct InternalBuffer { - BufferId mId; - size_t mOwnerCount; - size_t mTransactionCount; - const std::shared_ptr mAllocation; - const size_t mAllocSize; - const std::vector mConfig; - bool mInvalidated; - - InternalBuffer( - BufferId id, - const std::shared_ptr &alloc, - const size_t allocSize, - const std::vector &allocConfig) - : mId(id), mOwnerCount(0), mTransactionCount(0), - mAllocation(alloc), mAllocSize(allocSize), mConfig(allocConfig), - mInvalidated(false) {} - - const native_handle_t *handle() { - return mAllocation->handle(); - } - - void invalidate() { - mInvalidated = true; - } -}; - -struct TransactionStatus { - TransactionId mId; - BufferId mBufferId; - ConnectionId mSender; - ConnectionId mReceiver; - BufferStatus mStatus; - int64_t mTimestampUs; - bool mSenderValidated; - - TransactionStatus(const BufferStatusMessage &message, int64_t timestampUs) { - mId = message.transactionId; - mBufferId = message.bufferId; - mStatus = message.newStatus; - mTimestampUs = timestampUs; - if (mStatus == BufferStatus::TRANSFER_TO) { - mSender = message.connectionId; - mReceiver = message.targetConnectionId; - mSenderValidated = true; - } else { - mSender = -1LL; - mReceiver = message.connectionId; - mSenderValidated = false; - } - } -}; - -// Helper template methods for handling map of set. -template -bool insert(std::map> *mapOfSet, T key, U value) { - auto iter = mapOfSet->find(key); - if (iter == mapOfSet->end()) { - std::set valueSet{value}; - mapOfSet->insert(std::make_pair(key, valueSet)); - return true; - } else if (iter->second.find(value) == iter->second.end()) { - iter->second.insert(value); - return true; - } - return false; -} - -template -bool erase(std::map> *mapOfSet, T key, U value) { - bool ret = false; - auto iter = mapOfSet->find(key); - if (iter != mapOfSet->end()) { - if (iter->second.erase(value) > 0) { - ret = true; - } - if (iter->second.size() == 0) { - mapOfSet->erase(iter); - } - } - return ret; -} - -template -bool contains(std::map> *mapOfSet, T key, U value) { - auto iter = mapOfSet->find(key); - if (iter != mapOfSet->end()) { - auto setIter = iter->second.find(value); - return setIter != iter->second.end(); - } - return false; -} - -#ifdef __ANDROID_VNDK__ -static constexpr uint32_t kSeqIdVndkBit = 1U << 31; -#else -static constexpr uint32_t kSeqIdVndkBit = 0; -#endif - -static constexpr uint32_t kSeqIdMax = 0x7fffffff; -uint32_t Accessor::Impl::sSeqId = time(nullptr) & kSeqIdMax; - -Accessor::Impl::Impl( - const std::shared_ptr &allocator) - : mAllocator(allocator), mScheduleEvictTs(0) {} - -Accessor::Impl::~Impl() { -} - -ResultStatus Accessor::Impl::connect( - const sp &accessor, const sp &observer, - sp *connection, - ConnectionId *pConnectionId, - uint32_t *pMsgId, - const StatusDescriptor** statusDescPtr, - const InvalidationDescriptor** invDescPtr) { - sp newConnection = new Connection(); - ResultStatus status = ResultStatus::CRITICAL_ERROR; - { - std::lock_guard lock(mBufferPool.mMutex); - if (newConnection) { - int32_t pid = getpid(); - ConnectionId id = (int64_t)pid << 32 | sSeqId | kSeqIdVndkBit; - status = mBufferPool.mObserver.open(id, statusDescPtr); - if (status == ResultStatus::OK) { - newConnection->initialize(accessor, id); - *connection = newConnection; - *pConnectionId = id; - *pMsgId = mBufferPool.mInvalidation.mInvalidationId; - mBufferPool.mConnectionIds.insert(id); - mBufferPool.mInvalidationChannel.getDesc(invDescPtr); - mBufferPool.mInvalidation.onConnect(id, observer); - if (sSeqId == kSeqIdMax) { - sSeqId = 0; - } else { - ++sSeqId; - } - } - - } - mBufferPool.processStatusMessages(); - mBufferPool.cleanUp(); - scheduleEvictIfNeeded(); - } - return status; -} - -ResultStatus Accessor::Impl::close(ConnectionId connectionId) { - std::lock_guard lock(mBufferPool.mMutex); - ALOGV("connection close %lld: %u", (long long)connectionId, mBufferPool.mInvalidation.mId); - mBufferPool.processStatusMessages(); - mBufferPool.handleClose(connectionId); - mBufferPool.mObserver.close(connectionId); - mBufferPool.mInvalidation.onClose(connectionId); - // Since close# will be called after all works are finished, it is OK to - // evict unused buffers. - mBufferPool.cleanUp(true); - scheduleEvictIfNeeded(); - return ResultStatus::OK; -} - -ResultStatus Accessor::Impl::allocate( - ConnectionId connectionId, const std::vector& params, - BufferId *bufferId, const native_handle_t** handle) { - std::unique_lock lock(mBufferPool.mMutex); - mBufferPool.processStatusMessages(); - ResultStatus status = ResultStatus::OK; - if (!mBufferPool.getFreeBuffer(mAllocator, params, bufferId, handle)) { - lock.unlock(); - std::shared_ptr alloc; - size_t allocSize; - status = mAllocator->allocate(params, &alloc, &allocSize); - lock.lock(); - if (status == ResultStatus::OK) { - status = mBufferPool.addNewBuffer(alloc, allocSize, params, bufferId, handle); - } - ALOGV("create a buffer %d : %u %p", - status == ResultStatus::OK, *bufferId, *handle); - } - if (status == ResultStatus::OK) { - // TODO: handle ownBuffer failure - mBufferPool.handleOwnBuffer(connectionId, *bufferId); - } - mBufferPool.cleanUp(); - scheduleEvictIfNeeded(); - return status; -} - -ResultStatus Accessor::Impl::fetch( - ConnectionId connectionId, TransactionId transactionId, - BufferId bufferId, const native_handle_t** handle) { - std::lock_guard lock(mBufferPool.mMutex); - mBufferPool.processStatusMessages(); - auto found = mBufferPool.mTransactions.find(transactionId); - if (found != mBufferPool.mTransactions.end() && - contains(&mBufferPool.mPendingTransactions, - connectionId, transactionId)) { - if (found->second->mSenderValidated && - found->second->mStatus == BufferStatus::TRANSFER_FROM && - found->second->mBufferId == bufferId) { - found->second->mStatus = BufferStatus::TRANSFER_FETCH; - auto bufferIt = mBufferPool.mBuffers.find(bufferId); - if (bufferIt != mBufferPool.mBuffers.end()) { - mBufferPool.mStats.onBufferFetched(); - *handle = bufferIt->second->handle(); - return ResultStatus::OK; - } - } - } - mBufferPool.cleanUp(); - scheduleEvictIfNeeded(); - return ResultStatus::CRITICAL_ERROR; -} - -void Accessor::Impl::cleanUp(bool clearCache) { - // transaction timeout, buffer cacheing TTL handling - std::lock_guard lock(mBufferPool.mMutex); - mBufferPool.processStatusMessages(); - mBufferPool.cleanUp(clearCache); -} - -void Accessor::Impl::flush() { - std::lock_guard lock(mBufferPool.mMutex); - mBufferPool.processStatusMessages(); - mBufferPool.flush(shared_from_this()); -} - -void Accessor::Impl::handleInvalidateAck() { - std::map> observers; - uint32_t invalidationId; - { - std::lock_guard lock(mBufferPool.mMutex); - mBufferPool.processStatusMessages(); - mBufferPool.mInvalidation.onHandleAck(&observers, &invalidationId); - } - // Do not hold lock for send invalidations - size_t deadClients = 0; - for (auto it = observers.begin(); it != observers.end(); ++it) { - const sp observer = it->second; - if (observer) { - Return transResult = observer->onMessage(it->first, invalidationId); - if (!transResult.isOk()) { - ++deadClients; - } - } - } - if (deadClients > 0) { - ALOGD("During invalidation found %zu dead clients", deadClients); - } -} - -bool Accessor::Impl::isValid() { - return mBufferPool.isValid(); -} - -Accessor::Impl::Impl::BufferPool::BufferPool() - : mTimestampUs(getTimestampNow()), - mLastCleanUpUs(mTimestampUs), - mLastLogUs(mTimestampUs), - mSeq(0), - mStartSeq(0) { - mValid = mInvalidationChannel.isValid(); -} - - -// Statistics helper -template -int percentage(T base, S total) { - return int(total ? 0.5 + 100. * static_cast(base) / total : 0); -} - -std::atomic Accessor::Impl::BufferPool::Invalidation::sInvSeqId(0); - -Accessor::Impl::Impl::BufferPool::~BufferPool() { - std::lock_guard lock(mMutex); - ALOGD("Destruction - bufferpool2 %p " - "cached: %zu/%zuM, %zu/%d%% in use; " - "allocs: %zu, %d%% recycled; " - "transfers: %zu, %d%% unfetched", - this, mStats.mBuffersCached, mStats.mSizeCached >> 20, - mStats.mBuffersInUse, percentage(mStats.mBuffersInUse, mStats.mBuffersCached), - mStats.mTotalAllocations, percentage(mStats.mTotalRecycles, mStats.mTotalAllocations), - mStats.mTotalTransfers, - percentage(mStats.mTotalTransfers - mStats.mTotalFetches, mStats.mTotalTransfers)); -} - -void Accessor::Impl::BufferPool::Invalidation::onConnect( - ConnectionId conId, const sp& observer) { - mAcks[conId] = mInvalidationId; // starts from current invalidationId - mObservers.insert(std::make_pair(conId, observer)); -} - -void Accessor::Impl::BufferPool::Invalidation::onClose(ConnectionId conId) { - mAcks.erase(conId); - mObservers.erase(conId); -} - -void Accessor::Impl::BufferPool::Invalidation::onAck( - ConnectionId conId, - uint32_t msgId) { - auto it = mAcks.find(conId); - if (it == mAcks.end()) { - ALOGW("ACK from inconsistent connection! %lld", (long long)conId); - return; - } - if (isMessageLater(msgId, it->second)) { - mAcks[conId] = msgId; - } -} - -void Accessor::Impl::BufferPool::Invalidation::onBufferInvalidated( - BufferId bufferId, - BufferInvalidationChannel &channel) { - for (auto it = mPendings.begin(); it != mPendings.end();) { - if (it->isInvalidated(bufferId)) { - uint32_t msgId = 0; - if (it->mNeedsAck) { - msgId = ++mInvalidationId; - if (msgId == 0) { - // wrap happens - msgId = ++mInvalidationId; - } - } - channel.postInvalidation(msgId, it->mFrom, it->mTo); - it = mPendings.erase(it); - continue; - } - ++it; - } -} - -void Accessor::Impl::BufferPool::Invalidation::onInvalidationRequest( - bool needsAck, - uint32_t from, - uint32_t to, - size_t left, - BufferInvalidationChannel &channel, - const std::shared_ptr &impl) { - uint32_t msgId = 0; - if (needsAck) { - msgId = ++mInvalidationId; - if (msgId == 0) { - // wrap happens - msgId = ++mInvalidationId; - } - } - ALOGV("bufferpool2 invalidation requested and queued"); - if (left == 0) { - channel.postInvalidation(msgId, from, to); - } else { - // TODO: sending hint message? - ALOGV("bufferpoo2 invalidation requested and pending"); - Pending pending(needsAck, from, to, left, impl); - mPendings.push_back(pending); - } - sInvalidator->addAccessor(mId, impl); -} - -void Accessor::Impl::BufferPool::Invalidation::onHandleAck( - std::map> *observers, - uint32_t *invalidationId) { - if (mInvalidationId != 0) { - *invalidationId = mInvalidationId; - std::set deads; - for (auto it = mAcks.begin(); it != mAcks.end(); ++it) { - if (it->second != mInvalidationId) { - const sp observer = mObservers[it->first]; - if (observer) { - observers->emplace(it->first, observer); - ALOGV("connection %lld will call observer (%u: %u)", - (long long)it->first, it->second, mInvalidationId); - // N.B: onMessage will be called later. ignore possibility of - // onMessage# oneway call being lost. - it->second = mInvalidationId; - } else { - ALOGV("bufferpool2 observer died %lld", (long long)it->first); - deads.insert(it->first); - } - } - } - if (deads.size() > 0) { - for (auto it = deads.begin(); it != deads.end(); ++it) { - onClose(*it); - } - } - } - if (mPendings.size() == 0) { - // All invalidation Ids are synced and no more pending invalidations. - sInvalidator->delAccessor(mId); - } -} - -bool Accessor::Impl::BufferPool::handleOwnBuffer( - ConnectionId connectionId, BufferId bufferId) { - - bool added = insert(&mUsingBuffers, connectionId, bufferId); - if (added) { - auto iter = mBuffers.find(bufferId); - iter->second->mOwnerCount++; - } - insert(&mUsingConnections, bufferId, connectionId); - return added; -} - -bool Accessor::Impl::BufferPool::handleReleaseBuffer( - ConnectionId connectionId, BufferId bufferId) { - bool deleted = erase(&mUsingBuffers, connectionId, bufferId); - if (deleted) { - auto iter = mBuffers.find(bufferId); - iter->second->mOwnerCount--; - if (iter->second->mOwnerCount == 0 && - iter->second->mTransactionCount == 0) { - if (!iter->second->mInvalidated) { - mStats.onBufferUnused(iter->second->mAllocSize); - mFreeBuffers.insert(bufferId); - } else { - mStats.onBufferUnused(iter->second->mAllocSize); - mStats.onBufferEvicted(iter->second->mAllocSize); - mBuffers.erase(iter); - mInvalidation.onBufferInvalidated(bufferId, mInvalidationChannel); - } - } - } - erase(&mUsingConnections, bufferId, connectionId); - ALOGV("release buffer %u : %d", bufferId, deleted); - return deleted; -} - -bool Accessor::Impl::BufferPool::handleTransferTo(const BufferStatusMessage &message) { - auto completed = mCompletedTransactions.find( - message.transactionId); - if (completed != mCompletedTransactions.end()) { - // already completed - mCompletedTransactions.erase(completed); - return true; - } - // the buffer should exist and be owned. - auto bufferIter = mBuffers.find(message.bufferId); - if (bufferIter == mBuffers.end() || - !contains(&mUsingBuffers, message.connectionId, message.bufferId)) { - return false; - } - auto found = mTransactions.find(message.transactionId); - if (found != mTransactions.end()) { - // transfer_from was received earlier. - found->second->mSender = message.connectionId; - found->second->mSenderValidated = true; - return true; - } - if (mConnectionIds.find(message.targetConnectionId) == mConnectionIds.end()) { - // N.B: it could be fake or receive connection already closed. - ALOGD("bufferpool2 %p receiver connection %lld is no longer valid", - this, (long long)message.targetConnectionId); - return false; - } - mStats.onBufferSent(); - mTransactions.insert(std::make_pair( - message.transactionId, - std::make_unique(message, mTimestampUs))); - insert(&mPendingTransactions, message.targetConnectionId, - message.transactionId); - bufferIter->second->mTransactionCount++; - return true; -} - -bool Accessor::Impl::BufferPool::handleTransferFrom(const BufferStatusMessage &message) { - auto found = mTransactions.find(message.transactionId); - if (found == mTransactions.end()) { - // TODO: is it feasible to check ownership here? - mStats.onBufferSent(); - mTransactions.insert(std::make_pair( - message.transactionId, - std::make_unique(message, mTimestampUs))); - insert(&mPendingTransactions, message.connectionId, - message.transactionId); - auto bufferIter = mBuffers.find(message.bufferId); - bufferIter->second->mTransactionCount++; - } else { - if (message.connectionId == found->second->mReceiver) { - found->second->mStatus = BufferStatus::TRANSFER_FROM; - } - } - return true; -} - -bool Accessor::Impl::BufferPool::handleTransferResult(const BufferStatusMessage &message) { - auto found = mTransactions.find(message.transactionId); - if (found != mTransactions.end()) { - bool deleted = erase(&mPendingTransactions, message.connectionId, - message.transactionId); - if (deleted) { - if (!found->second->mSenderValidated) { - mCompletedTransactions.insert(message.transactionId); - } - auto bufferIter = mBuffers.find(message.bufferId); - if (message.newStatus == BufferStatus::TRANSFER_OK) { - handleOwnBuffer(message.connectionId, message.bufferId); - } - bufferIter->second->mTransactionCount--; - if (bufferIter->second->mOwnerCount == 0 - && bufferIter->second->mTransactionCount == 0) { - if (!bufferIter->second->mInvalidated) { - mStats.onBufferUnused(bufferIter->second->mAllocSize); - mFreeBuffers.insert(message.bufferId); - } else { - mStats.onBufferUnused(bufferIter->second->mAllocSize); - mStats.onBufferEvicted(bufferIter->second->mAllocSize); - mBuffers.erase(bufferIter); - mInvalidation.onBufferInvalidated(message.bufferId, mInvalidationChannel); - } - } - mTransactions.erase(found); - } - ALOGV("transfer finished %llu %u - %d", (unsigned long long)message.transactionId, - message.bufferId, deleted); - return deleted; - } - ALOGV("transfer not found %llu %u", (unsigned long long)message.transactionId, - message.bufferId); - return false; -} - -void Accessor::Impl::BufferPool::processStatusMessages() { - std::vector messages; - mObserver.getBufferStatusChanges(messages); - mTimestampUs = getTimestampNow(); - for (BufferStatusMessage& message: messages) { - bool ret = false; - switch (message.newStatus) { - case BufferStatus::NOT_USED: - ret = handleReleaseBuffer( - message.connectionId, message.bufferId); - break; - case BufferStatus::USED: - // not happening - break; - case BufferStatus::TRANSFER_TO: - ret = handleTransferTo(message); - break; - case BufferStatus::TRANSFER_FROM: - ret = handleTransferFrom(message); - break; - case BufferStatus::TRANSFER_TIMEOUT: - // TODO - break; - case BufferStatus::TRANSFER_LOST: - // TODO - break; - case BufferStatus::TRANSFER_FETCH: - // not happening - break; - case BufferStatus::TRANSFER_OK: - case BufferStatus::TRANSFER_ERROR: - ret = handleTransferResult(message); - break; - case BufferStatus::INVALIDATION_ACK: - mInvalidation.onAck(message.connectionId, message.bufferId); - ret = true; - break; - } - if (ret == false) { - ALOGW("buffer status message processing failure - message : %d connection : %lld", - message.newStatus, (long long)message.connectionId); - } - } - messages.clear(); -} - -bool Accessor::Impl::BufferPool::handleClose(ConnectionId connectionId) { - // Cleaning buffers - auto buffers = mUsingBuffers.find(connectionId); - if (buffers != mUsingBuffers.end()) { - for (const BufferId& bufferId : buffers->second) { - bool deleted = erase(&mUsingConnections, bufferId, connectionId); - if (deleted) { - auto bufferIter = mBuffers.find(bufferId); - bufferIter->second->mOwnerCount--; - if (bufferIter->second->mOwnerCount == 0 && - bufferIter->second->mTransactionCount == 0) { - // TODO: handle freebuffer insert fail - if (!bufferIter->second->mInvalidated) { - mStats.onBufferUnused(bufferIter->second->mAllocSize); - mFreeBuffers.insert(bufferId); - } else { - mStats.onBufferUnused(bufferIter->second->mAllocSize); - mStats.onBufferEvicted(bufferIter->second->mAllocSize); - mBuffers.erase(bufferIter); - mInvalidation.onBufferInvalidated(bufferId, mInvalidationChannel); - } - } - } - } - mUsingBuffers.erase(buffers); - } - - // Cleaning transactions - auto pending = mPendingTransactions.find(connectionId); - if (pending != mPendingTransactions.end()) { - for (const TransactionId& transactionId : pending->second) { - auto iter = mTransactions.find(transactionId); - if (iter != mTransactions.end()) { - if (!iter->second->mSenderValidated) { - mCompletedTransactions.insert(transactionId); - } - BufferId bufferId = iter->second->mBufferId; - auto bufferIter = mBuffers.find(bufferId); - bufferIter->second->mTransactionCount--; - if (bufferIter->second->mOwnerCount == 0 && - bufferIter->second->mTransactionCount == 0) { - // TODO: handle freebuffer insert fail - if (!bufferIter->second->mInvalidated) { - mStats.onBufferUnused(bufferIter->second->mAllocSize); - mFreeBuffers.insert(bufferId); - } else { - mStats.onBufferUnused(bufferIter->second->mAllocSize); - mStats.onBufferEvicted(bufferIter->second->mAllocSize); - mBuffers.erase(bufferIter); - mInvalidation.onBufferInvalidated(bufferId, mInvalidationChannel); - } - } - mTransactions.erase(iter); - } - } - } - mConnectionIds.erase(connectionId); - return true; -} - -bool Accessor::Impl::BufferPool::getFreeBuffer( - const std::shared_ptr &allocator, - const std::vector ¶ms, BufferId *pId, - const native_handle_t** handle) { - auto bufferIt = mFreeBuffers.begin(); - for (;bufferIt != mFreeBuffers.end(); ++bufferIt) { - BufferId bufferId = *bufferIt; - if (allocator->compatible(params, mBuffers[bufferId]->mConfig)) { - break; - } - } - if (bufferIt != mFreeBuffers.end()) { - BufferId id = *bufferIt; - mFreeBuffers.erase(bufferIt); - mStats.onBufferRecycled(mBuffers[id]->mAllocSize); - *handle = mBuffers[id]->handle(); - *pId = id; - ALOGV("recycle a buffer %u %p", id, *handle); - return true; - } - return false; -} - -ResultStatus Accessor::Impl::BufferPool::addNewBuffer( - const std::shared_ptr &alloc, - const size_t allocSize, - const std::vector ¶ms, - BufferId *pId, - const native_handle_t** handle) { - - BufferId bufferId = mSeq++; - if (mSeq == Connection::SYNC_BUFFERID) { - mSeq = 0; - } - std::unique_ptr buffer = - std::make_unique( - bufferId, alloc, allocSize, params); - if (buffer) { - auto res = mBuffers.insert(std::make_pair( - bufferId, std::move(buffer))); - if (res.second) { - mStats.onBufferAllocated(allocSize); - *handle = alloc->handle(); - *pId = bufferId; - return ResultStatus::OK; - } - } - return ResultStatus::NO_MEMORY; -} - -void Accessor::Impl::BufferPool::cleanUp(bool clearCache) { - if (clearCache || mTimestampUs > mLastCleanUpUs + kCleanUpDurationUs || - mStats.buffersNotInUse() > kMaxUnusedBufferCount) { - mLastCleanUpUs = mTimestampUs; - if (mTimestampUs > mLastLogUs + kLogDurationUs || - mStats.buffersNotInUse() > kMaxUnusedBufferCount) { - mLastLogUs = mTimestampUs; - ALOGD("bufferpool2 %p : %zu(%zu size) total buffers - " - "%zu(%zu size) used buffers - %zu/%zu (recycle/alloc) - " - "%zu/%zu (fetch/transfer)", - this, mStats.mBuffersCached, mStats.mSizeCached, - mStats.mBuffersInUse, mStats.mSizeInUse, - mStats.mTotalRecycles, mStats.mTotalAllocations, - mStats.mTotalFetches, mStats.mTotalTransfers); - } - for (auto freeIt = mFreeBuffers.begin(); freeIt != mFreeBuffers.end();) { - if (!clearCache && mStats.buffersNotInUse() <= kUnusedBufferCountTarget && - (mStats.mSizeCached < kMinAllocBytesForEviction || - mBuffers.size() < kMinBufferCountForEviction)) { - break; - } - auto it = mBuffers.find(*freeIt); - if (it != mBuffers.end() && - it->second->mOwnerCount == 0 && it->second->mTransactionCount == 0) { - mStats.onBufferEvicted(it->second->mAllocSize); - mBuffers.erase(it); - freeIt = mFreeBuffers.erase(freeIt); - } else { - ++freeIt; - ALOGW("bufferpool2 inconsistent!"); - } - } - } -} - -void Accessor::Impl::BufferPool::invalidate( - bool needsAck, BufferId from, BufferId to, - const std::shared_ptr &impl) { - for (auto freeIt = mFreeBuffers.begin(); freeIt != mFreeBuffers.end();) { - if (isBufferInRange(from, to, *freeIt)) { - auto it = mBuffers.find(*freeIt); - if (it != mBuffers.end() && - it->second->mOwnerCount == 0 && it->second->mTransactionCount == 0) { - mStats.onBufferEvicted(it->second->mAllocSize); - mBuffers.erase(it); - freeIt = mFreeBuffers.erase(freeIt); - continue; - } else { - ALOGW("bufferpool2 inconsistent!"); - } - } - ++freeIt; - } - - size_t left = 0; - for (auto it = mBuffers.begin(); it != mBuffers.end(); ++it) { - if (isBufferInRange(from, to, it->first)) { - it->second->invalidate(); - ++left; - } - } - mInvalidation.onInvalidationRequest(needsAck, from, to, left, mInvalidationChannel, impl); -} - -void Accessor::Impl::BufferPool::flush(const std::shared_ptr &impl) { - BufferId from = mStartSeq; - BufferId to = mSeq; - mStartSeq = mSeq; - // TODO: needsAck params - ALOGV("buffer invalidation request bp:%u %u %u", mInvalidation.mId, from, to); - if (from != to) { - invalidate(true, from, to, impl); - } -} - -void Accessor::Impl::invalidatorThread( - std::map> &accessors, - std::mutex &mutex, - std::condition_variable &cv, - bool &ready) { - constexpr uint32_t NUM_SPIN_TO_INCREASE_SLEEP = 1024; - constexpr uint32_t NUM_SPIN_TO_LOG = 1024*8; - constexpr useconds_t MAX_SLEEP_US = 10000; - uint32_t numSpin = 0; - useconds_t sleepUs = 1; - - while(true) { - std::map> copied; - { - std::unique_lock lock(mutex); - if (!ready) { - numSpin = 0; - sleepUs = 1; - cv.wait(lock); - } - copied.insert(accessors.begin(), accessors.end()); - } - std::list erased; - for (auto it = copied.begin(); it != copied.end(); ++it) { - const std::shared_ptr impl = it->second.lock(); - if (!impl) { - erased.push_back(it->first); - } else { - impl->handleInvalidateAck(); - } - } - { - std::unique_lock lock(mutex); - for (auto it = erased.begin(); it != erased.end(); ++it) { - accessors.erase(*it); - } - if (accessors.size() == 0) { - ready = false; - } else { - // TODO Use an efficient way to wait over FMQ. - // N.B. Since there is not a efficient way to wait over FMQ, - // polling over the FMQ is the current way to prevent draining - // CPU. - lock.unlock(); - ++numSpin; - if (numSpin % NUM_SPIN_TO_INCREASE_SLEEP == 0 && - sleepUs < MAX_SLEEP_US) { - sleepUs *= 10; - } - if (numSpin % NUM_SPIN_TO_LOG == 0) { - ALOGW("invalidator thread spinning"); - } - ::usleep(sleepUs); - } - } - } -} - -Accessor::Impl::AccessorInvalidator::AccessorInvalidator() : mReady(false) { - std::thread invalidator( - invalidatorThread, - std::ref(mAccessors), - std::ref(mMutex), - std::ref(mCv), - std::ref(mReady)); - invalidator.detach(); -} - -void Accessor::Impl::AccessorInvalidator::addAccessor( - uint32_t accessorId, const std::weak_ptr &impl) { - bool notify = false; - std::unique_lock lock(mMutex); - if (mAccessors.find(accessorId) == mAccessors.end()) { - if (!mReady) { - mReady = true; - notify = true; - } - mAccessors.insert(std::make_pair(accessorId, impl)); - ALOGV("buffer invalidation added bp:%u %d", accessorId, notify); - } - lock.unlock(); - if (notify) { - mCv.notify_one(); - } -} - -void Accessor::Impl::AccessorInvalidator::delAccessor(uint32_t accessorId) { - std::lock_guard lock(mMutex); - mAccessors.erase(accessorId); - ALOGV("buffer invalidation deleted bp:%u", accessorId); - if (mAccessors.size() == 0) { - mReady = false; - } -} - -std::unique_ptr Accessor::Impl::sInvalidator; - -void Accessor::Impl::createInvalidator() { - if (!sInvalidator) { - sInvalidator = std::make_unique(); - } -} - -void Accessor::Impl::evictorThread( - std::map, nsecs_t, std::owner_less<>> &accessors, - std::mutex &mutex, - std::condition_variable &cv) { - std::list> evictList; - while (true) { - int expired = 0; - int evicted = 0; - { - nsecs_t now = systemTime(); - std::unique_lock lock(mutex); - if (accessors.size() == 0) { - cv.wait(lock); - } - auto it = accessors.begin(); - while (it != accessors.end()) { - if (now > (it->second + kEvictDurationNs)) { - ++expired; - evictList.push_back(it->first); - it = accessors.erase(it); - } else { - ++it; - } - } - } - // evict idle accessors; - for (auto it = evictList.begin(); it != evictList.end(); ++it) { - const std::shared_ptr accessor = it->lock(); - if (accessor) { - accessor->cleanUp(true); - ++evicted; - } - } - if (expired > 0) { - ALOGD("evictor expired: %d, evicted: %d", expired, evicted); - } - evictList.clear(); - ::usleep(kEvictGranularityNs / 1000); - } -} - -Accessor::Impl::AccessorEvictor::AccessorEvictor() { - std::thread evictor( - evictorThread, - std::ref(mAccessors), - std::ref(mMutex), - std::ref(mCv)); - evictor.detach(); -} - -void Accessor::Impl::AccessorEvictor::addAccessor( - const std::weak_ptr &impl, nsecs_t ts) { - std::lock_guard lock(mMutex); - bool notify = mAccessors.empty(); - auto it = mAccessors.find(impl); - if (it == mAccessors.end()) { - mAccessors.emplace(impl, ts); - } else { - it->second = ts; - } - if (notify) { - mCv.notify_one(); - } -} - -std::unique_ptr Accessor::Impl::sEvictor; - -void Accessor::Impl::createEvictor() { - if (!sEvictor) { - sEvictor = std::make_unique(); - } -} - -void Accessor::Impl::scheduleEvictIfNeeded() { - nsecs_t now = systemTime(); - - if (now > (mScheduleEvictTs + kEvictGranularityNs)) { - mScheduleEvictTs = now; - sEvictor->addAccessor(shared_from_this(), now); - } -} - -} // namespace implementation -} // namespace V2_0 -} // namespace bufferpool -} // namespace media -} // namespace hardware -} // namespace android diff --git a/media/bufferpool/aidl/default/AccessorImpl.h b/media/bufferpool/aidl/default/AccessorImpl.h deleted file mode 100644 index 3d39941337..0000000000 --- a/media/bufferpool/aidl/default/AccessorImpl.h +++ /dev/null @@ -1,431 +0,0 @@ -/* - * Copyright (C) 2018 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. - */ - -#ifndef ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_ACCESSORIMPL_H -#define ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_ACCESSORIMPL_H - -#include -#include -#include -#include -#include "Accessor.h" - -namespace android { -namespace hardware { -namespace media { -namespace bufferpool { -namespace V2_0 { -namespace implementation { - -struct InternalBuffer; -struct TransactionStatus; - -/** - * An implementation of a buffer pool accessor(or a buffer pool implementation.) */ -class Accessor::Impl - : public std::enable_shared_from_this { -public: - Impl(const std::shared_ptr &allocator); - - ~Impl(); - - ResultStatus connect( - const sp &accessor, const sp &observer, - sp *connection, - ConnectionId *pConnectionId, - uint32_t *pMsgId, - const StatusDescriptor** statusDescPtr, - const InvalidationDescriptor** invDescPtr); - - ResultStatus close(ConnectionId connectionId); - - ResultStatus allocate(ConnectionId connectionId, - const std::vector& params, - BufferId *bufferId, - const native_handle_t** handle); - - ResultStatus fetch(ConnectionId connectionId, - TransactionId transactionId, - BufferId bufferId, - const native_handle_t** handle); - - void flush(); - - void cleanUp(bool clearCache); - - bool isValid(); - - void handleInvalidateAck(); - - static void createInvalidator(); - - static void createEvictor(); - -private: - // ConnectionId = pid : (timestamp_created + seqId) - // in order to guarantee uniqueness for each connection - static uint32_t sSeqId; - - const std::shared_ptr mAllocator; - - nsecs_t mScheduleEvictTs; - - /** - * Buffer pool implementation. - * - * Handles buffer status messages. Handles buffer allocation/recycling. - * Handles buffer transfer between buffer pool clients. - */ - struct BufferPool { - private: - std::mutex mMutex; - int64_t mTimestampUs; - int64_t mLastCleanUpUs; - int64_t mLastLogUs; - BufferId mSeq; - BufferId mStartSeq; - bool mValid; - BufferStatusObserver mObserver; - BufferInvalidationChannel mInvalidationChannel; - - std::map> mUsingBuffers; - std::map> mUsingConnections; - - std::map> mPendingTransactions; - // Transactions completed before TRANSFER_TO message arrival. - // Fetch does not occur for the transactions. - // Only transaction id is kept for the transactions in short duration. - std::set mCompletedTransactions; - // Currently active(pending) transations' status & information. - std::map> - mTransactions; - - std::map> mBuffers; - std::set mFreeBuffers; - std::set mConnectionIds; - - struct Invalidation { - static std::atomic sInvSeqId; - - struct Pending { - bool mNeedsAck; - uint32_t mFrom; - uint32_t mTo; - size_t mLeft; - const std::weak_ptr mImpl; - Pending(bool needsAck, uint32_t from, uint32_t to, size_t left, - const std::shared_ptr &impl) - : mNeedsAck(needsAck), - mFrom(from), - mTo(to), - mLeft(left), - mImpl(impl) - {} - - bool isInvalidated(uint32_t bufferId) { - return isBufferInRange(mFrom, mTo, bufferId) && --mLeft == 0; - } - }; - - std::list mPendings; - std::map mAcks; - std::map> mObservers; - uint32_t mInvalidationId; - uint32_t mId; - - Invalidation() : mInvalidationId(0), mId(sInvSeqId.fetch_add(1)) {} - - void onConnect(ConnectionId conId, const sp &observer); - - void onClose(ConnectionId conId); - - void onAck(ConnectionId conId, uint32_t msgId); - - void onBufferInvalidated( - BufferId bufferId, - BufferInvalidationChannel &channel); - - void onInvalidationRequest( - bool needsAck, uint32_t from, uint32_t to, size_t left, - BufferInvalidationChannel &channel, - const std::shared_ptr &impl); - - void onHandleAck( - std::map> *observers, - uint32_t *invalidationId); - } mInvalidation; - /// Buffer pool statistics which tracks allocation and transfer statistics. - struct Stats { - /// Total size of allocations which are used or available to use. - /// (bytes or pixels) - size_t mSizeCached; - /// # of cached buffers which are used or available to use. - size_t mBuffersCached; - /// Total size of allocations which are currently used. (bytes or pixels) - size_t mSizeInUse; - /// # of currently used buffers - size_t mBuffersInUse; - - /// # of allocations called on bufferpool. (# of fetched from BlockPool) - size_t mTotalAllocations; - /// # of allocations that were served from the cache. - /// (# of allocator alloc prevented) - size_t mTotalRecycles; - /// # of buffer transfers initiated. - size_t mTotalTransfers; - /// # of transfers that had to be fetched. - size_t mTotalFetches; - - Stats() - : mSizeCached(0), mBuffersCached(0), mSizeInUse(0), mBuffersInUse(0), - mTotalAllocations(0), mTotalRecycles(0), mTotalTransfers(0), mTotalFetches(0) {} - - /// # of currently unused buffers - size_t buffersNotInUse() const { - ALOG_ASSERT(mBuffersCached >= mBuffersInUse); - return mBuffersCached - mBuffersInUse; - } - - /// A new buffer is allocated on an allocation request. - void onBufferAllocated(size_t allocSize) { - mSizeCached += allocSize; - mBuffersCached++; - - mSizeInUse += allocSize; - mBuffersInUse++; - - mTotalAllocations++; - } - - /// A buffer is evicted and destroyed. - void onBufferEvicted(size_t allocSize) { - mSizeCached -= allocSize; - mBuffersCached--; - } - - /// A buffer is recycled on an allocation request. - void onBufferRecycled(size_t allocSize) { - mSizeInUse += allocSize; - mBuffersInUse++; - - mTotalAllocations++; - mTotalRecycles++; - } - - /// A buffer is available to be recycled. - void onBufferUnused(size_t allocSize) { - mSizeInUse -= allocSize; - mBuffersInUse--; - } - - /// A buffer transfer is initiated. - void onBufferSent() { - mTotalTransfers++; - } - - /// A buffer fetch is invoked by a buffer transfer. - void onBufferFetched() { - mTotalFetches++; - } - } mStats; - - bool isValid() { - return mValid; - } - - void invalidate(bool needsAck, BufferId from, BufferId to, - const std::shared_ptr &impl); - - static void createInvalidator(); - - public: - /** Creates a buffer pool. */ - BufferPool(); - - /** Destroys a buffer pool. */ - ~BufferPool(); - - /** - * Processes all pending buffer status messages, and returns the result. - * Each status message is handled by methods with 'handle' prefix. - */ - void processStatusMessages(); - - /** - * Handles a buffer being owned by a connection. - * - * @param connectionId the id of the buffer owning connection. - * @param bufferId the id of the buffer. - * - * @return {@code true} when the buffer is owned, - * {@code false} otherwise. - */ - bool handleOwnBuffer(ConnectionId connectionId, BufferId bufferId); - - /** - * Handles a buffer being released by a connection. - * - * @param connectionId the id of the buffer owning connection. - * @param bufferId the id of the buffer. - * - * @return {@code true} when the buffer ownership is released, - * {@code false} otherwise. - */ - bool handleReleaseBuffer(ConnectionId connectionId, BufferId bufferId); - - /** - * Handles a transfer transaction start message from the sender. - * - * @param message a buffer status message for the transaction. - * - * @result {@code true} when transfer_to message is acknowledged, - * {@code false} otherwise. - */ - bool handleTransferTo(const BufferStatusMessage &message); - - /** - * Handles a transfer transaction being acked by the receiver. - * - * @param message a buffer status message for the transaction. - * - * @result {@code true} when transfer_from message is acknowledged, - * {@code false} otherwise. - */ - bool handleTransferFrom(const BufferStatusMessage &message); - - /** - * Handles a transfer transaction result message from the receiver. - * - * @param message a buffer status message for the transaction. - * - * @result {@code true} when the exisitng transaction is finished, - * {@code false} otherwise. - */ - bool handleTransferResult(const BufferStatusMessage &message); - - /** - * Handles a connection being closed, and returns the result. All the - * buffers and transactions owned by the connection will be cleaned up. - * The related FMQ will be cleaned up too. - * - * @param connectionId the id of the connection. - * - * @result {@code true} when the connection existed, - * {@code false} otherwise. - */ - bool handleClose(ConnectionId connectionId); - - /** - * Recycles a existing free buffer if it is possible. - * - * @param allocator the buffer allocator - * @param params the allocation parameters. - * @param pId the id of the recycled buffer. - * @param handle the native handle of the recycled buffer. - * - * @return {@code true} when a buffer is recycled, {@code false} - * otherwise. - */ - bool getFreeBuffer( - const std::shared_ptr &allocator, - const std::vector ¶ms, - BufferId *pId, const native_handle_t **handle); - - /** - * Adds a newly allocated buffer to bufferpool. - * - * @param alloc the newly allocated buffer. - * @param allocSize the size of the newly allocated buffer. - * @param params the allocation parameters. - * @param pId the buffer id for the newly allocated buffer. - * @param handle the native handle for the newly allocated buffer. - * - * @return OK when an allocation is successfully allocated. - * NO_MEMORY when there is no memory. - * CRITICAL_ERROR otherwise. - */ - ResultStatus addNewBuffer( - const std::shared_ptr &alloc, - const size_t allocSize, - const std::vector ¶ms, - BufferId *pId, - const native_handle_t **handle); - - /** - * Processes pending buffer status messages and performs periodic cache - * cleaning. - * - * @param clearCache if clearCache is true, it frees all buffers - * waiting to be recycled. - */ - void cleanUp(bool clearCache = false); - - /** - * Processes pending buffer status messages and invalidate all current - * free buffers. Active buffers are invalidated after being inactive. - */ - void flush(const std::shared_ptr &impl); - - friend class Accessor::Impl; - } mBufferPool; - - struct AccessorInvalidator { - std::map> mAccessors; - std::mutex mMutex; - std::condition_variable mCv; - bool mReady; - - AccessorInvalidator(); - void addAccessor(uint32_t accessorId, const std::weak_ptr &impl); - void delAccessor(uint32_t accessorId); - }; - - static std::unique_ptr sInvalidator; - - static void invalidatorThread( - std::map> &accessors, - std::mutex &mutex, - std::condition_variable &cv, - bool &ready); - - struct AccessorEvictor { - std::map, nsecs_t, std::owner_less<>> mAccessors; - std::mutex mMutex; - std::condition_variable mCv; - - AccessorEvictor(); - void addAccessor(const std::weak_ptr &impl, nsecs_t ts); - }; - - static std::unique_ptr sEvictor; - - static void evictorThread( - std::map, nsecs_t, std::owner_less<>> &accessors, - std::mutex &mutex, - std::condition_variable &cv); - - void scheduleEvictIfNeeded(); - -}; - -} // namespace implementation -} // namespace V2_0 -} // namespace ufferpool -} // namespace media -} // namespace hardware -} // namespace android - -#endif // ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_ACCESSORIMPL_H diff --git a/media/bufferpool/aidl/default/Android.bp b/media/bufferpool/aidl/default/Android.bp new file mode 100644 index 0000000000..11a616373e --- /dev/null +++ b/media/bufferpool/aidl/default/Android.bp @@ -0,0 +1,50 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "frameworks_av_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_library { + name: "libstagefright_aidl_bufferpool2", + vendor_available: true, + min_sdk_version: "29", + apex_available: [ + "//apex_available:platform", + "com.android.media.swcodec", + "test_com.android.media.swcodec", + ], + srcs: [ + "Accessor.cpp", + "BufferPool.cpp", + "BufferPoolClient.cpp", + "BufferStatus.cpp", + "ClientManager.cpp", + "Connection.cpp", + "Observer.cpp", + ], + export_include_dirs: [ + "include", + ], + shared_libs: [ + "libbinder_ndk", + "libcutils", + "libfmq", + "liblog", + "libutils", + "android.hardware.media.bufferpool2-V1-ndk", + ], + static_libs: [ + "libaidlcommonsupport", + ], + export_shared_lib_headers: [ + "libfmq", + "android.hardware.media.bufferpool2-V1-ndk", + ], + double_loadable: true, + cflags: [ + "-DBUFFERPOOL_CLONE_HANDLES", + ], +} diff --git a/media/bufferpool/aidl/default/BufferPool.cpp b/media/bufferpool/aidl/default/BufferPool.cpp new file mode 100644 index 0000000000..ed4574f9d6 --- /dev/null +++ b/media/bufferpool/aidl/default/BufferPool.cpp @@ -0,0 +1,540 @@ +/* + * 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. + */ + +#define LOG_TAG "AidlBufferPool" +//#define LOG_NDEBUG 0 + +#include +#include +#include +#include +#include +#include +#include "Accessor.h" +#include "BufferPool.h" +#include "Connection.h" +#include "DataHelper.h" + +namespace aidl::android::hardware::media::bufferpool2::implementation { + +namespace { + static constexpr int64_t kCleanUpDurationMs = 500; // 0.5 sec + static constexpr int64_t kLogDurationMs = 5000; // 5 secs + + static constexpr size_t kMinAllocBytesForEviction = 1024*1024*15; + static constexpr size_t kMinBufferCountForEviction = 25; + static constexpr size_t kMaxUnusedBufferCount = 64; + static constexpr size_t kUnusedBufferCountTarget = kMaxUnusedBufferCount - 16; +} + +BufferPool::BufferPool() + : mTimestampMs(::android::elapsedRealtime()), + mLastCleanUpMs(mTimestampMs), + mLastLogMs(mTimestampMs), + mSeq(0), + mStartSeq(0) { + mValid = mInvalidationChannel.isValid(); +} + + +// Statistics helper +template +int percentage(T base, S total) { + return int(total ? 0.5 + 100. * static_cast(base) / total : 0); +} + +std::atomic BufferPool::Invalidation::sInvSeqId(0); + +BufferPool::~BufferPool() { + std::lock_guard lock(mMutex); + ALOGD("Destruction - bufferpool2 %p " + "cached: %zu/%zuM, %zu/%d%% in use; " + "allocs: %zu, %d%% recycled; " + "transfers: %zu, %d%% unfetched", + this, mStats.mBuffersCached, mStats.mSizeCached >> 20, + mStats.mBuffersInUse, percentage(mStats.mBuffersInUse, mStats.mBuffersCached), + mStats.mTotalAllocations, percentage(mStats.mTotalRecycles, mStats.mTotalAllocations), + mStats.mTotalTransfers, + percentage(mStats.mTotalTransfers - mStats.mTotalFetches, mStats.mTotalTransfers)); +} + +void BufferPool::Invalidation::onConnect( + ConnectionId conId, const std::shared_ptr& observer) { + mAcks[conId] = mInvalidationId; // starts from current invalidationId + mObservers.insert(std::make_pair(conId, observer)); +} + +void BufferPool::Invalidation::onClose(ConnectionId conId) { + mAcks.erase(conId); + mObservers.erase(conId); +} + +void BufferPool::Invalidation::onAck( + ConnectionId conId, + uint32_t msgId) { + auto it = mAcks.find(conId); + if (it == mAcks.end()) { + ALOGW("ACK from inconsistent connection! %lld", (long long)conId); + return; + } + if (isMessageLater(msgId, it->second)) { + mAcks[conId] = msgId; + } +} + +void BufferPool::Invalidation::onBufferInvalidated( + BufferId bufferId, + BufferInvalidationChannel &channel) { + for (auto it = mPendings.begin(); it != mPendings.end();) { + if (it->isInvalidated(bufferId)) { + uint32_t msgId = 0; + if (it->mNeedsAck) { + msgId = ++mInvalidationId; + if (msgId == 0) { + // wrap happens + msgId = ++mInvalidationId; + } + } + channel.postInvalidation(msgId, it->mFrom, it->mTo); + it = mPendings.erase(it); + continue; + } + ++it; + } +} + +void BufferPool::Invalidation::onInvalidationRequest( + bool needsAck, + uint32_t from, + uint32_t to, + size_t left, + BufferInvalidationChannel &channel, + const std::shared_ptr &impl) { + uint32_t msgId = 0; + if (needsAck) { + msgId = ++mInvalidationId; + if (msgId == 0) { + // wrap happens + msgId = ++mInvalidationId; + } + } + ALOGV("bufferpool2 invalidation requested and queued"); + if (left == 0) { + channel.postInvalidation(msgId, from, to); + } else { + ALOGV("bufferpoo2 invalidation requested and pending"); + Pending pending(needsAck, from, to, left, impl); + mPendings.push_back(pending); + } + Accessor::sInvalidator->addAccessor(mId, impl); +} + +void BufferPool::Invalidation::onHandleAck( + std::map> *observers, + uint32_t *invalidationId) { + if (mInvalidationId != 0) { + *invalidationId = mInvalidationId; + std::set deads; + for (auto it = mAcks.begin(); it != mAcks.end(); ++it) { + if (it->second != mInvalidationId) { + const std::shared_ptr observer = mObservers[it->first]; + if (observer) { + observers->emplace(it->first, observer); + ALOGV("connection %lld will call observer (%u: %u)", + (long long)it->first, it->second, mInvalidationId); + // N.B: onMessage will be called later. ignore possibility of + // onMessage# oneway call being lost. + it->second = mInvalidationId; + } else { + ALOGV("bufferpool2 observer died %lld", (long long)it->first); + deads.insert(it->first); + } + } + } + if (deads.size() > 0) { + for (auto it = deads.begin(); it != deads.end(); ++it) { + onClose(*it); + } + } + } + if (mPendings.size() == 0) { + // All invalidation Ids are synced and no more pending invalidations. + Accessor::sInvalidator->delAccessor(mId); + } +} + +bool BufferPool::handleOwnBuffer( + ConnectionId connectionId, BufferId bufferId) { + + bool added = insert(&mUsingBuffers, connectionId, bufferId); + if (added) { + auto iter = mBuffers.find(bufferId); + iter->second->mOwnerCount++; + } + insert(&mUsingConnections, bufferId, connectionId); + return added; +} + +bool BufferPool::handleReleaseBuffer( + ConnectionId connectionId, BufferId bufferId) { + bool deleted = erase(&mUsingBuffers, connectionId, bufferId); + if (deleted) { + auto iter = mBuffers.find(bufferId); + iter->second->mOwnerCount--; + if (iter->second->mOwnerCount == 0 && + iter->second->mTransactionCount == 0) { + if (!iter->second->mInvalidated) { + mStats.onBufferUnused(iter->second->mAllocSize); + mFreeBuffers.insert(bufferId); + } else { + mStats.onBufferUnused(iter->second->mAllocSize); + mStats.onBufferEvicted(iter->second->mAllocSize); + mBuffers.erase(iter); + mInvalidation.onBufferInvalidated(bufferId, mInvalidationChannel); + } + } + } + erase(&mUsingConnections, bufferId, connectionId); + ALOGV("release buffer %u : %d", bufferId, deleted); + return deleted; +} + +bool BufferPool::handleTransferTo(const BufferStatusMessage &message) { + auto completed = mCompletedTransactions.find( + message.transactionId); + if (completed != mCompletedTransactions.end()) { + // already completed + mCompletedTransactions.erase(completed); + return true; + } + // the buffer should exist and be owned. + auto bufferIter = mBuffers.find(message.bufferId); + if (bufferIter == mBuffers.end() || + !contains(&mUsingBuffers, message.connectionId, FromAidl(message.bufferId))) { + return false; + } + auto found = mTransactions.find(message.transactionId); + if (found != mTransactions.end()) { + // transfer_from was received earlier. + found->second->mSender = message.connectionId; + found->second->mSenderValidated = true; + return true; + } + if (mConnectionIds.find(message.targetConnectionId) == mConnectionIds.end()) { + // N.B: it could be fake or receive connection already closed. + ALOGD("bufferpool2 %p receiver connection %lld is no longer valid", + this, (long long)message.targetConnectionId); + return false; + } + mStats.onBufferSent(); + mTransactions.insert(std::make_pair( + message.transactionId, + std::make_unique(message, mTimestampMs))); + insert(&mPendingTransactions, message.targetConnectionId, + FromAidl(message.transactionId)); + bufferIter->second->mTransactionCount++; + return true; +} + +bool BufferPool::handleTransferFrom(const BufferStatusMessage &message) { + auto found = mTransactions.find(message.transactionId); + if (found == mTransactions.end()) { + // TODO: is it feasible to check ownership here? + mStats.onBufferSent(); + mTransactions.insert(std::make_pair( + message.transactionId, + std::make_unique(message, mTimestampMs))); + insert(&mPendingTransactions, message.connectionId, + FromAidl(message.transactionId)); + auto bufferIter = mBuffers.find(message.bufferId); + bufferIter->second->mTransactionCount++; + } else { + if (message.connectionId == found->second->mReceiver) { + found->second->mStatus = BufferStatus::TRANSFER_FROM; + } + } + return true; +} + +bool BufferPool::handleTransferResult(const BufferStatusMessage &message) { + auto found = mTransactions.find(message.transactionId); + if (found != mTransactions.end()) { + bool deleted = erase(&mPendingTransactions, message.connectionId, + FromAidl(message.transactionId)); + if (deleted) { + if (!found->second->mSenderValidated) { + mCompletedTransactions.insert(message.transactionId); + } + auto bufferIter = mBuffers.find(message.bufferId); + if (message.status == BufferStatus::TRANSFER_OK) { + handleOwnBuffer(message.connectionId, message.bufferId); + } + bufferIter->second->mTransactionCount--; + if (bufferIter->second->mOwnerCount == 0 + && bufferIter->second->mTransactionCount == 0) { + if (!bufferIter->second->mInvalidated) { + mStats.onBufferUnused(bufferIter->second->mAllocSize); + mFreeBuffers.insert(message.bufferId); + } else { + mStats.onBufferUnused(bufferIter->second->mAllocSize); + mStats.onBufferEvicted(bufferIter->second->mAllocSize); + mBuffers.erase(bufferIter); + mInvalidation.onBufferInvalidated(message.bufferId, mInvalidationChannel); + } + } + mTransactions.erase(found); + } + ALOGV("transfer finished %llu %u - %d", (unsigned long long)message.transactionId, + message.bufferId, deleted); + return deleted; + } + ALOGV("transfer not found %llu %u", (unsigned long long)message.transactionId, + message.bufferId); + return false; +} + +void BufferPool::processStatusMessages() { + std::vector messages; + mObserver.getBufferStatusChanges(messages); + mTimestampMs = ::android::elapsedRealtime(); + for (BufferStatusMessage& message: messages) { + bool ret = false; + switch (message.status) { + case BufferStatus::NOT_USED: + ret = handleReleaseBuffer( + message.connectionId, message.bufferId); + break; + case BufferStatus::USED: + // not happening + break; + case BufferStatus::TRANSFER_TO: + ret = handleTransferTo(message); + break; + case BufferStatus::TRANSFER_FROM: + ret = handleTransferFrom(message); + break; + case BufferStatus::TRANSFER_TIMEOUT: + // TODO + break; + case BufferStatus::TRANSFER_LOST: + // TODO + break; + case BufferStatus::TRANSFER_FETCH: + // not happening + break; + case BufferStatus::TRANSFER_OK: + case BufferStatus::TRANSFER_ERROR: + ret = handleTransferResult(message); + break; + case BufferStatus::INVALIDATION_ACK: + mInvalidation.onAck(message.connectionId, message.bufferId); + ret = true; + break; + } + if (ret == false) { + ALOGW("buffer status message processing failure - message : %d connection : %lld", + message.status, (long long)message.connectionId); + } + } + messages.clear(); +} + +bool BufferPool::handleClose(ConnectionId connectionId) { + // Cleaning buffers + auto buffers = mUsingBuffers.find(connectionId); + if (buffers != mUsingBuffers.end()) { + for (const BufferId& bufferId : buffers->second) { + bool deleted = erase(&mUsingConnections, bufferId, connectionId); + if (deleted) { + auto bufferIter = mBuffers.find(bufferId); + bufferIter->second->mOwnerCount--; + if (bufferIter->second->mOwnerCount == 0 && + bufferIter->second->mTransactionCount == 0) { + // TODO: handle freebuffer insert fail + if (!bufferIter->second->mInvalidated) { + mStats.onBufferUnused(bufferIter->second->mAllocSize); + mFreeBuffers.insert(bufferId); + } else { + mStats.onBufferUnused(bufferIter->second->mAllocSize); + mStats.onBufferEvicted(bufferIter->second->mAllocSize); + mBuffers.erase(bufferIter); + mInvalidation.onBufferInvalidated(bufferId, mInvalidationChannel); + } + } + } + } + mUsingBuffers.erase(buffers); + } + + // Cleaning transactions + auto pending = mPendingTransactions.find(connectionId); + if (pending != mPendingTransactions.end()) { + for (const TransactionId& transactionId : pending->second) { + auto iter = mTransactions.find(transactionId); + if (iter != mTransactions.end()) { + if (!iter->second->mSenderValidated) { + mCompletedTransactions.insert(transactionId); + } + BufferId bufferId = iter->second->mBufferId; + auto bufferIter = mBuffers.find(bufferId); + bufferIter->second->mTransactionCount--; + if (bufferIter->second->mOwnerCount == 0 && + bufferIter->second->mTransactionCount == 0) { + // TODO: handle freebuffer insert fail + if (!bufferIter->second->mInvalidated) { + mStats.onBufferUnused(bufferIter->second->mAllocSize); + mFreeBuffers.insert(bufferId); + } else { + mStats.onBufferUnused(bufferIter->second->mAllocSize); + mStats.onBufferEvicted(bufferIter->second->mAllocSize); + mBuffers.erase(bufferIter); + mInvalidation.onBufferInvalidated(bufferId, mInvalidationChannel); + } + } + mTransactions.erase(iter); + } + } + } + mConnectionIds.erase(connectionId); + return true; +} + +bool BufferPool::getFreeBuffer( + const std::shared_ptr &allocator, + const std::vector ¶ms, BufferId *pId, + const native_handle_t** handle) { + auto bufferIt = mFreeBuffers.begin(); + for (;bufferIt != mFreeBuffers.end(); ++bufferIt) { + BufferId bufferId = *bufferIt; + if (allocator->compatible(params, mBuffers[bufferId]->mConfig)) { + break; + } + } + if (bufferIt != mFreeBuffers.end()) { + BufferId id = *bufferIt; + mFreeBuffers.erase(bufferIt); + mStats.onBufferRecycled(mBuffers[id]->mAllocSize); + *handle = mBuffers[id]->handle(); + *pId = id; + ALOGV("recycle a buffer %u %p", id, *handle); + return true; + } + return false; +} + +BufferPoolStatus BufferPool::addNewBuffer( + const std::shared_ptr &alloc, + const size_t allocSize, + const std::vector ¶ms, + BufferId *pId, + const native_handle_t** handle) { + + BufferId bufferId = mSeq++; + if (mSeq == Connection::SYNC_BUFFERID) { + mSeq = 0; + } + std::unique_ptr buffer = + std::make_unique( + bufferId, alloc, allocSize, params); + if (buffer) { + auto res = mBuffers.insert(std::make_pair( + bufferId, std::move(buffer))); + if (res.second) { + mStats.onBufferAllocated(allocSize); + *handle = alloc->handle(); + *pId = bufferId; + return ResultStatus::OK; + } + } + return ResultStatus::NO_MEMORY; +} + +void BufferPool::cleanUp(bool clearCache) { + if (clearCache || mTimestampMs > mLastCleanUpMs + kCleanUpDurationMs || + mStats.buffersNotInUse() > kMaxUnusedBufferCount) { + mLastCleanUpMs = mTimestampMs; + if (mTimestampMs > mLastLogMs + kLogDurationMs || + mStats.buffersNotInUse() > kMaxUnusedBufferCount) { + mLastLogMs = mTimestampMs; + ALOGD("bufferpool2 %p : %zu(%zu size) total buffers - " + "%zu(%zu size) used buffers - %zu/%zu (recycle/alloc) - " + "%zu/%zu (fetch/transfer)", + this, mStats.mBuffersCached, mStats.mSizeCached, + mStats.mBuffersInUse, mStats.mSizeInUse, + mStats.mTotalRecycles, mStats.mTotalAllocations, + mStats.mTotalFetches, mStats.mTotalTransfers); + } + for (auto freeIt = mFreeBuffers.begin(); freeIt != mFreeBuffers.end();) { + if (!clearCache && mStats.buffersNotInUse() <= kUnusedBufferCountTarget && + (mStats.mSizeCached < kMinAllocBytesForEviction || + mBuffers.size() < kMinBufferCountForEviction)) { + break; + } + auto it = mBuffers.find(*freeIt); + if (it != mBuffers.end() && + it->second->mOwnerCount == 0 && it->second->mTransactionCount == 0) { + mStats.onBufferEvicted(it->second->mAllocSize); + mBuffers.erase(it); + freeIt = mFreeBuffers.erase(freeIt); + } else { + ++freeIt; + ALOGW("bufferpool2 inconsistent!"); + } + } + } +} + +void BufferPool::invalidate( + bool needsAck, BufferId from, BufferId to, + const std::shared_ptr &impl) { + for (auto freeIt = mFreeBuffers.begin(); freeIt != mFreeBuffers.end();) { + if (isBufferInRange(from, to, *freeIt)) { + auto it = mBuffers.find(*freeIt); + if (it != mBuffers.end() && + it->second->mOwnerCount == 0 && it->second->mTransactionCount == 0) { + mStats.onBufferEvicted(it->second->mAllocSize); + mBuffers.erase(it); + freeIt = mFreeBuffers.erase(freeIt); + continue; + } else { + ALOGW("bufferpool2 inconsistent!"); + } + } + ++freeIt; + } + + size_t left = 0; + for (auto it = mBuffers.begin(); it != mBuffers.end(); ++it) { + if (isBufferInRange(from, to, it->first)) { + it->second->invalidate(); + ++left; + } + } + mInvalidation.onInvalidationRequest(needsAck, from, to, left, mInvalidationChannel, impl); +} + +void BufferPool::flush(const std::shared_ptr &impl) { + BufferId from = mStartSeq; + BufferId to = mSeq; + mStartSeq = mSeq; + // TODO: needsAck params + ALOGV("buffer invalidation request bp:%u %u %u", mInvalidation.mId, from, to); + if (from != to) { + invalidate(true, from, to, impl); + } +} + +} // namespace aidl::android::hardware::media::bufferpool2::implementation diff --git a/media/bufferpool/aidl/default/BufferPool.h b/media/bufferpool/aidl/default/BufferPool.h new file mode 100644 index 0000000000..1529a531df --- /dev/null +++ b/media/bufferpool/aidl/default/BufferPool.h @@ -0,0 +1,337 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include + +#include "BufferStatus.h" + +namespace aidl::android::hardware::media::bufferpool2::implementation { + +using BufferStatus = aidl::android::hardware::media::bufferpool2::BufferStatus; +using BufferStatusMessage = aidl::android::hardware::media::bufferpool2::BufferStatusMessage; + +struct Accessor; +struct InternalBuffer; +struct TransactionStatus; + +/** + * Buffer pool implementation. + * + * Handles buffer status messages. Handles buffer allocation/recycling. + * Handles buffer transfer between buffer pool clients. + */ +struct BufferPool { +private: + std::mutex mMutex; + int64_t mTimestampMs; + int64_t mLastCleanUpMs; + int64_t mLastLogMs; + BufferId mSeq; + BufferId mStartSeq; + bool mValid; + BufferStatusObserver mObserver; + BufferInvalidationChannel mInvalidationChannel; + + std::map> mUsingBuffers; + std::map> mUsingConnections; + + std::map> mPendingTransactions; + // Transactions completed before TRANSFER_TO message arrival. + // Fetch does not occur for the transactions. + // Only transaction id is kept for the transactions in short duration. + std::set mCompletedTransactions; + // Currently active(pending) transations' status & information. + std::map> + mTransactions; + + std::map> mBuffers; + std::set mFreeBuffers; + std::set mConnectionIds; + + struct Invalidation { + static std::atomic sInvSeqId; + + struct Pending { + bool mNeedsAck; + uint32_t mFrom; + uint32_t mTo; + size_t mLeft; + const std::weak_ptr mImpl; + Pending(bool needsAck, uint32_t from, uint32_t to, size_t left, + const std::shared_ptr &impl) + : mNeedsAck(needsAck), + mFrom(from), + mTo(to), + mLeft(left), + mImpl(impl) + {} + + bool isInvalidated(uint32_t bufferId) { + return isBufferInRange(mFrom, mTo, bufferId) && --mLeft == 0; + } + }; + + std::list mPendings; + std::map mAcks; + std::map> mObservers; + uint32_t mInvalidationId; + uint32_t mId; + + Invalidation() : mInvalidationId(0), mId(sInvSeqId.fetch_add(1)) {} + + void onConnect(ConnectionId conId, const std::shared_ptr &observer); + + void onClose(ConnectionId conId); + + void onAck(ConnectionId conId, uint32_t msgId); + + void onBufferInvalidated( + BufferId bufferId, + BufferInvalidationChannel &channel); + + void onInvalidationRequest( + bool needsAck, uint32_t from, uint32_t to, size_t left, + BufferInvalidationChannel &channel, + const std::shared_ptr &impl); + + void onHandleAck( + std::map> *observers, + uint32_t *invalidationId); + } mInvalidation; + /// Buffer pool statistics which tracks allocation and transfer statistics. + struct Stats { + /// Total size of allocations which are used or available to use. + /// (bytes or pixels) + size_t mSizeCached; + /// # of cached buffers which are used or available to use. + size_t mBuffersCached; + /// Total size of allocations which are currently used. (bytes or pixels) + size_t mSizeInUse; + /// # of currently used buffers + size_t mBuffersInUse; + + /// # of allocations called on bufferpool. (# of fetched from BlockPool) + size_t mTotalAllocations; + /// # of allocations that were served from the cache. + /// (# of allocator alloc prevented) + size_t mTotalRecycles; + /// # of buffer transfers initiated. + size_t mTotalTransfers; + /// # of transfers that had to be fetched. + size_t mTotalFetches; + + Stats() + : mSizeCached(0), mBuffersCached(0), mSizeInUse(0), mBuffersInUse(0), + mTotalAllocations(0), mTotalRecycles(0), mTotalTransfers(0), mTotalFetches(0) {} + + /// # of currently unused buffers + size_t buffersNotInUse() const { + ALOG_ASSERT(mBuffersCached >= mBuffersInUse); + return mBuffersCached - mBuffersInUse; + } + + /// A new buffer is allocated on an allocation request. + void onBufferAllocated(size_t allocSize) { + mSizeCached += allocSize; + mBuffersCached++; + + mSizeInUse += allocSize; + mBuffersInUse++; + + mTotalAllocations++; + } + + /// A buffer is evicted and destroyed. + void onBufferEvicted(size_t allocSize) { + mSizeCached -= allocSize; + mBuffersCached--; + } + + /// A buffer is recycled on an allocation request. + void onBufferRecycled(size_t allocSize) { + mSizeInUse += allocSize; + mBuffersInUse++; + + mTotalAllocations++; + mTotalRecycles++; + } + + /// A buffer is available to be recycled. + void onBufferUnused(size_t allocSize) { + mSizeInUse -= allocSize; + mBuffersInUse--; + } + + /// A buffer transfer is initiated. + void onBufferSent() { + mTotalTransfers++; + } + + /// A buffer fetch is invoked by a buffer transfer. + void onBufferFetched() { + mTotalFetches++; + } + } mStats; + + bool isValid() { + return mValid; + } + + void invalidate(bool needsAck, BufferId from, BufferId to, + const std::shared_ptr &impl); + + static void createInvalidator(); + +public: + /** Creates a buffer pool. */ + BufferPool(); + + /** Destroys a buffer pool. */ + ~BufferPool(); + + /** + * Processes all pending buffer status messages, and returns the result. + * Each status message is handled by methods with 'handle' prefix. + */ + void processStatusMessages(); + + /** + * Handles a buffer being owned by a connection. + * + * @param connectionId the id of the buffer owning connection. + * @param bufferId the id of the buffer. + * + * @return {@code true} when the buffer is owned, + * {@code false} otherwise. + */ + bool handleOwnBuffer(ConnectionId connectionId, BufferId bufferId); + + /** + * Handles a buffer being released by a connection. + * + * @param connectionId the id of the buffer owning connection. + * @param bufferId the id of the buffer. + * + * @return {@code true} when the buffer ownership is released, + * {@code false} otherwise. + */ + bool handleReleaseBuffer(ConnectionId connectionId, BufferId bufferId); + + /** + * Handles a transfer transaction start message from the sender. + * + * @param message a buffer status message for the transaction. + * + * @result {@code true} when transfer_to message is acknowledged, + * {@code false} otherwise. + */ + bool handleTransferTo(const BufferStatusMessage &message); + + /** + * Handles a transfer transaction being acked by the receiver. + * + * @param message a buffer status message for the transaction. + * + * @result {@code true} when transfer_from message is acknowledged, + * {@code false} otherwise. + */ + bool handleTransferFrom(const BufferStatusMessage &message); + + /** + * Handles a transfer transaction result message from the receiver. + * + * @param message a buffer status message for the transaction. + * + * @result {@code true} when the existing transaction is finished, + * {@code false} otherwise. + */ + bool handleTransferResult(const BufferStatusMessage &message); + + /** + * Handles a connection being closed, and returns the result. All the + * buffers and transactions owned by the connection will be cleaned up. + * The related FMQ will be cleaned up too. + * + * @param connectionId the id of the connection. + * + * @result {@code true} when the connection existed, + * {@code false} otherwise. + */ + bool handleClose(ConnectionId connectionId); + + /** + * Recycles a existing free buffer if it is possible. + * + * @param allocator the buffer allocator + * @param params the allocation parameters. + * @param pId the id of the recycled buffer. + * @param handle the native handle of the recycled buffer. + * + * @return {@code true} when a buffer is recycled, {@code false} + * otherwise. + */ + bool getFreeBuffer( + const std::shared_ptr &allocator, + const std::vector ¶ms, + BufferId *pId, const native_handle_t **handle); + + /** + * Adds a newly allocated buffer to bufferpool. + * + * @param alloc the newly allocated buffer. + * @param allocSize the size of the newly allocated buffer. + * @param params the allocation parameters. + * @param pId the buffer id for the newly allocated buffer. + * @param handle the native handle for the newly allocated buffer. + * + * @return OK when an allocation is successfully allocated. + * NO_MEMORY when there is no memory. + * CRITICAL_ERROR otherwise. + */ + BufferPoolStatus addNewBuffer( + const std::shared_ptr &alloc, + const size_t allocSize, + const std::vector ¶ms, + BufferId *pId, + const native_handle_t **handle); + + /** + * Processes pending buffer status messages and performs periodic cache + * cleaning. + * + * @param clearCache if clearCache is true, it frees all buffers + * waiting to be recycled. + */ + void cleanUp(bool clearCache = false); + + /** + * Processes pending buffer status messages and invalidate all current + * free buffers. Active buffers are invalidated after being inactive. + */ + void flush(const std::shared_ptr &impl); + + friend struct Accessor; +}; + + +} // namespace aidl::android::hardware::media::bufferpool2::implementation diff --git a/media/bufferpool/aidl/default/BufferPoolClient.cpp b/media/bufferpool/aidl/default/BufferPoolClient.cpp index cda23ff49d..e9777d8c41 100644 --- a/media/bufferpool/aidl/default/BufferPoolClient.cpp +++ b/media/bufferpool/aidl/default/BufferPoolClient.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -14,33 +14,37 @@ * limitations under the License. */ -#define LOG_TAG "BufferPoolClient" +#define LOG_TAG "AidlBufferPoolCli" //#define LOG_NDEBUG 0 #include +#include #include #include "BufferPoolClient.h" +#include "Accessor.h" #include "Connection.h" -namespace android { -namespace hardware { -namespace media { -namespace bufferpool { -namespace V2_0 { -namespace implementation { +namespace aidl::android::hardware::media::bufferpool2::implementation { -static constexpr int64_t kReceiveTimeoutUs = 2000000; // 2s +using aidl::android::hardware::media::bufferpool2::IConnection; +using aidl::android::hardware::media::bufferpool2::ResultStatus; +using FetchInfo = aidl::android::hardware::media::bufferpool2::IConnection::FetchInfo; +using FetchResult = aidl::android::hardware::media::bufferpool2::IConnection::FetchResult; + +static constexpr int64_t kReceiveTimeoutMs = 2000; // 2s static constexpr int kPostMaxRetry = 3; -static constexpr int kCacheTtlUs = 1000000; // TODO: tune +static constexpr int kCacheTtlMs = 1000; static constexpr size_t kMaxCachedBufferCount = 64; static constexpr size_t kCachedBufferCountTarget = kMaxCachedBufferCount - 16; class BufferPoolClient::Impl : public std::enable_shared_from_this { public: - explicit Impl(const sp &accessor, const sp &observer); + explicit Impl(const std::shared_ptr &accessor, + const std::shared_ptr &observer); - explicit Impl(const sp &accessor, const sp &observer); + explicit Impl(const std::shared_ptr &accessor, + const std::shared_ptr &observer); bool isValid() { return mValid; @@ -54,35 +58,35 @@ public: return mConnectionId; } - sp &getAccessor() { + std::shared_ptr &getAccessor() { return mAccessor; } - bool isActive(int64_t *lastTransactionUs, bool clearCache); + bool isActive(int64_t *lastTransactionMs, bool clearCache); void receiveInvalidation(uint32_t msgID); - ResultStatus flush(); + BufferPoolStatus flush(); - ResultStatus allocate(const std::vector ¶ms, + BufferPoolStatus allocate(const std::vector ¶ms, native_handle_t **handle, std::shared_ptr *buffer); - ResultStatus receive( + BufferPoolStatus receive( TransactionId transactionId, BufferId bufferId, - int64_t timestampUs, + int64_t timestampMs, native_handle_t **handle, std::shared_ptr *buffer); void postBufferRelease(BufferId bufferId); bool postSend( BufferId bufferId, ConnectionId receiver, - TransactionId *transactionId, int64_t *timestampUs); + TransactionId *transactionId, int64_t *timestampMs); private: bool postReceive( BufferId bufferId, TransactionId transactionId, - int64_t timestampUs); + int64_t timestampMs); bool postReceiveResult( BufferId bufferId, TransactionId transactionId, bool result, bool *needsSync); @@ -97,11 +101,11 @@ private: void invalidateRange(BufferId from, BufferId to); - ResultStatus allocateBufferHandle( + BufferPoolStatus allocateBufferHandle( const std::vector& params, BufferId *bufferId, native_handle_t **handle); - ResultStatus fetchBufferHandle( + BufferPoolStatus fetchBufferHandle( TransactionId transactionId, BufferId bufferId, native_handle_t **handle); @@ -110,12 +114,12 @@ private: bool mLocal; bool mValid; - sp mAccessor; - sp mLocalConnection; - sp mRemoteConnection; + std::shared_ptr mAccessor; + std::shared_ptr mLocalConnection; + std::shared_ptr mRemoteConnection; uint32_t mSeqId; ConnectionId mConnectionId; - int64_t mLastEvictCacheUs; + int64_t mLastEvictCacheMs; std::unique_ptr mInvalidationListener; // CachedBuffers @@ -125,18 +129,19 @@ private: std::condition_variable mCreateCv; std::map> mBuffers; int mActive; - int64_t mLastChangeUs; + int64_t mLastChangeMs; - BufferCache() : mCreating(false), mActive(0), mLastChangeUs(getTimestampNow()) {} + BufferCache() : mCreating(false), mActive(0), + mLastChangeMs(::android::elapsedRealtime()) {} void incActive_l() { ++mActive; - mLastChangeUs = getTimestampNow(); + mLastChangeMs = ::android::elapsedRealtime(); } void decActive_l() { --mActive; - mLastChangeUs = getTimestampNow(); + mLastChangeMs = ::android::elapsedRealtime(); } int cachedBufferCount() const { @@ -147,7 +152,6 @@ private: // FMQ - release notifier struct ReleaseCache { std::mutex mLock; - // TODO: use only one list?(using one list may dealy sending messages?) std::list mReleasingIds; std::list mReleasedIds; uint32_t mInvalidateId; // TODO: invalidation ACK to bufferpool @@ -158,7 +162,7 @@ private: } mReleasing; // This lock is held during synchronization from remote side. - // In order to minimize remote calls and locking durtaion, this lock is held + // In order to minimize remote calls and locking duration, this lock is held // by best effort approach using try_lock(). std::mutex mRemoteSyncLock; }; @@ -181,7 +185,7 @@ struct BufferPoolClient::Impl::BlockPoolDataDtor { struct BufferPoolClient::Impl::ClientBuffer { private: - int64_t mExpireUs; + int64_t mExpireMs; bool mHasCache; ConnectionId mConnectionId; BufferId mId; @@ -189,7 +193,7 @@ private: std::weak_ptr mCache; void updateExpire() { - mExpireUs = getTimestampNow() + kCacheTtlUs; + mExpireMs = ::android::elapsedRealtime() + kCacheTtlMs; } public: @@ -197,7 +201,7 @@ public: ConnectionId connectionId, BufferId id, native_handle_t *handle) : mHasCache(false), mConnectionId(connectionId), mId(id), mHandle(handle) { - mExpireUs = getTimestampNow() + kCacheTtlUs; + mExpireMs = ::android::elapsedRealtime() + kCacheTtlMs; } ~ClientBuffer() { @@ -212,8 +216,8 @@ public: } bool expire() const { - int64_t now = getTimestampNow(); - return now >= mExpireUs; + int64_t now = ::android::elapsedRealtime(); + return now >= mExpireMs; } bool hasCache() const { @@ -265,20 +269,21 @@ public: } }; -BufferPoolClient::Impl::Impl(const sp &accessor, const sp &observer) +BufferPoolClient::Impl::Impl(const std::shared_ptr &accessor, + const std::shared_ptr &observer) : mLocal(true), mValid(false), mAccessor(accessor), mSeqId(0), - mLastEvictCacheUs(getTimestampNow()) { - const StatusDescriptor *statusDesc; - const InvalidationDescriptor *invDesc; - ResultStatus status = accessor->connect( + mLastEvictCacheMs(::android::elapsedRealtime()) { + StatusDescriptor statusDesc; + InvalidationDescriptor invDesc; + BufferPoolStatus status = accessor->connect( observer, true, &mLocalConnection, &mConnectionId, &mReleasing.mInvalidateId, &statusDesc, &invDesc); if (status == ResultStatus::OK) { mReleasing.mStatusChannel = - std::make_unique(*statusDesc); + std::make_unique(statusDesc); mInvalidationListener = - std::make_unique(*invDesc); + std::make_unique(invDesc); mValid = mReleasing.mStatusChannel && mReleasing.mStatusChannel->isValid() && mInvalidationListener && @@ -286,46 +291,36 @@ BufferPoolClient::Impl::Impl(const sp &accessor, const sp & } } -BufferPoolClient::Impl::Impl(const sp &accessor, const sp &observer) +BufferPoolClient::Impl::Impl(const std::shared_ptr &accessor, + const std::shared_ptr &observer) : mLocal(false), mValid(false), mAccessor(accessor), mSeqId(0), - mLastEvictCacheUs(getTimestampNow()) { + mLastEvictCacheMs(::android::elapsedRealtime()) { + IAccessor::ConnectionInfo conInfo; bool valid = false; - sp& outConnection = mRemoteConnection; - ConnectionId& id = mConnectionId; - uint32_t& outMsgId = mReleasing.mInvalidateId; - std::unique_ptr& outChannel = - mReleasing.mStatusChannel; - std::unique_ptr& outObserver = - mInvalidationListener; - Return transResult = accessor->connect( - observer, - [&valid, &outConnection, &id, &outMsgId, &outChannel, &outObserver] - (ResultStatus status, sp connection, - ConnectionId connectionId, uint32_t msgId, - const StatusDescriptor& statusDesc, - const InvalidationDescriptor& invDesc) { - if (status == ResultStatus::OK) { - outConnection = connection; - id = connectionId; - outMsgId = msgId; - outChannel = std::make_unique(statusDesc); - outObserver = std::make_unique(invDesc); - if (outChannel && outChannel->isValid() && - outObserver && outObserver->isValid()) { - valid = true; - } - } - }); - mValid = transResult.isOk() && valid; + if(accessor->connect(observer, &conInfo).isOk()) { + auto channel = std::make_unique(conInfo.toFmqDesc); + auto observer = std::make_unique(conInfo.fromFmqDesc); + + if (channel && channel->isValid() + && observer && observer->isValid()) { + mRemoteConnection = conInfo.connection; + mConnectionId = conInfo.connectionId; + mReleasing.mInvalidateId = conInfo.msgId; + mReleasing.mStatusChannel = std::move(channel); + mInvalidationListener = std::move(observer); + valid = true; + } + } + mValid = valid; } -bool BufferPoolClient::Impl::isActive(int64_t *lastTransactionUs, bool clearCache) { +bool BufferPoolClient::Impl::isActive(int64_t *lastTransactionMs, bool clearCache) { bool active = false; { std::lock_guard lock(mCache.mLock); syncReleased(); evictCaches(clearCache); - *lastTransactionUs = mCache.mLastChangeUs; + *lastTransactionMs = mCache.mLastChangeMs; active = mCache.mActive > 0; } if (mValid && mLocal && mLocalConnection) { @@ -341,7 +336,7 @@ void BufferPoolClient::Impl::receiveInvalidation(uint32_t messageId) { // TODO: evict cache required? } -ResultStatus BufferPoolClient::Impl::flush() { +BufferPoolStatus BufferPoolClient::Impl::flush() { if (!mLocal || !mLocalConnection || !mValid) { return ResultStatus::CRITICAL_ERROR; } @@ -353,7 +348,7 @@ ResultStatus BufferPoolClient::Impl::flush() { } } -ResultStatus BufferPoolClient::Impl::allocate( +BufferPoolStatus BufferPoolClient::Impl::allocate( const std::vector ¶ms, native_handle_t **pHandle, std::shared_ptr *buffer) { @@ -363,7 +358,7 @@ ResultStatus BufferPoolClient::Impl::allocate( BufferId bufferId; native_handle_t *handle = nullptr; buffer->reset(); - ResultStatus status = allocateBufferHandle(params, &bufferId, &handle); + BufferPoolStatus status = allocateBufferHandle(params, &bufferId, &handle); if (status == ResultStatus::OK) { if (handle) { std::unique_lock lock(mCache.mLock); @@ -398,20 +393,20 @@ ResultStatus BufferPoolClient::Impl::allocate( return status; } -ResultStatus BufferPoolClient::Impl::receive( - TransactionId transactionId, BufferId bufferId, int64_t timestampUs, +BufferPoolStatus BufferPoolClient::Impl::receive( + TransactionId transactionId, BufferId bufferId, int64_t timestampMs, native_handle_t **pHandle, std::shared_ptr *buffer) { if (!mValid) { return ResultStatus::CRITICAL_ERROR; } - if (timestampUs != 0) { - timestampUs += kReceiveTimeoutUs; + if (timestampMs != 0) { + timestampMs += kReceiveTimeoutMs; } - if (!postReceive(bufferId, transactionId, timestampUs)) { + if (!postReceive(bufferId, transactionId, timestampMs)) { return ResultStatus::CRITICAL_ERROR; } - ResultStatus status = ResultStatus::CRITICAL_ERROR; + BufferPoolStatus status = ResultStatus::CRITICAL_ERROR; buffer->reset(); while(1) { std::unique_lock lock(mCache.mLock); @@ -505,7 +500,7 @@ void BufferPoolClient::Impl::postBufferRelease(BufferId bufferId) { // TODO: revise ad-hoc posting data structure bool BufferPoolClient::Impl::postSend( BufferId bufferId, ConnectionId receiver, - TransactionId *transactionId, int64_t *timestampUs) { + TransactionId *transactionId, int64_t *timestampMs) { { // TODO: don't need to call syncReleased every time std::lock_guard lock(mCache.mLock); @@ -515,7 +510,7 @@ bool BufferPoolClient::Impl::postSend( bool needsSync = false; { std::lock_guard lock(mReleasing.mLock); - *timestampUs = getTimestampNow(); + *timestampMs = ::android::elapsedRealtime(); *transactionId = (mConnectionId << 32) | mSeqId++; // TODO: retry, add timeout, target? ret = mReleasing.mStatusChannel->postBufferStatusMessage( @@ -533,11 +528,11 @@ bool BufferPoolClient::Impl::postSend( } bool BufferPoolClient::Impl::postReceive( - BufferId bufferId, TransactionId transactionId, int64_t timestampUs) { + BufferId bufferId, TransactionId transactionId, int64_t timestampMs) { for (int i = 0; i < kPostMaxRetry; ++i) { std::unique_lock lock(mReleasing.mLock); - int64_t now = getTimestampNow(); - if (timestampUs == 0 || now < timestampUs) { + int64_t now = ::android::elapsedRealtime(); + if (timestampMs == 0 || now < timestampMs) { bool result = mReleasing.mStatusChannel->postBufferStatusMessage( transactionId, bufferId, BufferStatus::TRANSFER_FROM, mConnectionId, -1, mReleasing.mReleasingIds, @@ -579,16 +574,7 @@ void BufferPoolClient::Impl::trySyncFromRemote() { needsSync = mReleasing.mStatusChannel->needsSync(); } if (needsSync) { - TransactionId transactionId = (mConnectionId << 32); - BufferId bufferId = Connection::SYNC_BUFFERID; - Return transResult = mRemoteConnection->fetch( - transactionId, bufferId, - [] - (ResultStatus outStatus, Buffer outBuffer) { - (void) outStatus; - (void) outBuffer; - }); - if (!transResult.isOk()) { + if (!mRemoteConnection->sync().isOk()) { ALOGD("sync from client %lld failed: bufferpool process died.", (long long)mConnectionId); } @@ -616,12 +602,12 @@ bool BufferPoolClient::Impl::syncReleased(uint32_t messageId) { mCache.decActive_l(); } else { // should not happen! - ALOGW("client %lld cache release status inconsitent!", + ALOGW("client %lld cache release status inconsistent!", (long long)mConnectionId); } } else { // should not happen! - ALOGW("client %lld cache status inconsitent!", (long long)mConnectionId); + ALOGW("client %lld cache status inconsistent!", (long long)mConnectionId); } } mReleasing.mReleasedIds.clear(); @@ -673,8 +659,8 @@ bool BufferPoolClient::Impl::syncReleased(uint32_t messageId) { // should have mCache.mLock void BufferPoolClient::Impl::evictCaches(bool clearCache) { - int64_t now = getTimestampNow(); - if (now >= mLastEvictCacheUs + kCacheTtlUs || + int64_t now = ::android::elapsedRealtime(); + if (now >= mLastEvictCacheMs + kCacheTtlMs || clearCache || mCache.cachedBufferCount() > kMaxCachedBufferCount) { size_t evicted = 0; for (auto it = mCache.mBuffers.begin(); it != mCache.mBuffers.end();) { @@ -688,7 +674,7 @@ void BufferPoolClient::Impl::evictCaches(bool clearCache) { } ALOGV("cache count %lld : total %zu, active %d, evicted %zu", (long long)mConnectionId, mCache.mBuffers.size(), mCache.mActive, evicted); - mLastEvictCacheUs = now; + mLastEvictCacheMs = now; } } @@ -701,7 +687,7 @@ void BufferPoolClient::Impl::invalidateBuffer(BufferId id) { ALOGV("cache invalidated %lld : buffer %u", (long long)mConnectionId, id); } else { - ALOGW("Inconsitent invalidation %lld : activer buffer!! %u", + ALOGW("Inconsistent invalidation %lld : activer buffer!! %u", (long long)mConnectionId, (unsigned int)id); } break; @@ -735,12 +721,12 @@ void BufferPoolClient::Impl::invalidateRange(BufferId from, BufferId to) { (long long)mConnectionId, invalidated); } -ResultStatus BufferPoolClient::Impl::allocateBufferHandle( +BufferPoolStatus BufferPoolClient::Impl::allocateBufferHandle( const std::vector& params, BufferId *bufferId, native_handle_t** handle) { if (mLocalConnection) { const native_handle_t* allocHandle = nullptr; - ResultStatus status = mLocalConnection->allocate( + BufferPoolStatus status = mLocalConnection->allocate( params, bufferId, &allocHandle); if (status == ResultStatus::OK) { *handle = native_handle_clone(allocHandle); @@ -753,37 +739,38 @@ ResultStatus BufferPoolClient::Impl::allocateBufferHandle( return ResultStatus::CRITICAL_ERROR; } -ResultStatus BufferPoolClient::Impl::fetchBufferHandle( +BufferPoolStatus BufferPoolClient::Impl::fetchBufferHandle( TransactionId transactionId, BufferId bufferId, native_handle_t **handle) { - sp connection; + std::shared_ptr connection; if (mLocal) { connection = mLocalConnection; } else { connection = mRemoteConnection; } - ResultStatus status; - Return transResult = connection->fetch( - transactionId, bufferId, - [&status, &handle] - (ResultStatus outStatus, Buffer outBuffer) { - status = outStatus; - if (status == ResultStatus::OK) { - *handle = native_handle_clone( - outBuffer.buffer.getNativeHandle()); - } - }); - return transResult.isOk() ? status : ResultStatus::CRITICAL_ERROR; + std::vector infos; + std::vector results; + infos.emplace_back(FetchInfo{ToAidl(transactionId), ToAidl(bufferId)}); + ndk::ScopedAStatus status = connection->fetch(infos, &results); + if (!status.isOk()) { + BufferPoolStatus svcSpecific = status.getServiceSpecificError(); + return svcSpecific ? svcSpecific : ResultStatus::CRITICAL_ERROR; + } + if (results[0].getTag() == FetchResult::buffer) { + *handle = ::android::dupFromAidl(results[0].get().buffer); + return ResultStatus::OK; + } + return results[0].get(); } -BufferPoolClient::BufferPoolClient(const sp &accessor, - const sp &observer) { +BufferPoolClient::BufferPoolClient(const std::shared_ptr &accessor, + const std::shared_ptr &observer) { mImpl = std::make_shared(accessor, observer); } -BufferPoolClient::BufferPoolClient(const sp &accessor, - const sp &observer) { +BufferPoolClient::BufferPoolClient(const std::shared_ptr &accessor, + const std::shared_ptr &observer) { mImpl = std::make_shared(accessor, observer); } @@ -799,12 +786,12 @@ bool BufferPoolClient::isLocal() { return mImpl && mImpl->isLocal(); } -bool BufferPoolClient::isActive(int64_t *lastTransactionUs, bool clearCache) { +bool BufferPoolClient::isActive(int64_t *lastTransactionMs, bool clearCache) { if (!isValid()) { - *lastTransactionUs = 0; + *lastTransactionMs = 0; return false; } - return mImpl->isActive(lastTransactionUs, clearCache); + return mImpl->isActive(lastTransactionMs, clearCache); } ConnectionId BufferPoolClient::getConnectionId() { @@ -814,7 +801,7 @@ ConnectionId BufferPoolClient::getConnectionId() { return -1; } -ResultStatus BufferPoolClient::getAccessor(sp *accessor) { +BufferPoolStatus BufferPoolClient::getAccessor(std::shared_ptr *accessor) { if (isValid()) { *accessor = mImpl->getAccessor(); return ResultStatus::OK; @@ -829,14 +816,14 @@ void BufferPoolClient::receiveInvalidation(uint32_t msgId) { } } -ResultStatus BufferPoolClient::flush() { +BufferPoolStatus BufferPoolClient::flush() { if (isValid()) { return mImpl->flush(); } return ResultStatus::CRITICAL_ERROR; } -ResultStatus BufferPoolClient::allocate( +BufferPoolStatus BufferPoolClient::allocate( const std::vector ¶ms, native_handle_t **handle, std::shared_ptr *buffer) { @@ -846,31 +833,26 @@ ResultStatus BufferPoolClient::allocate( return ResultStatus::CRITICAL_ERROR; } -ResultStatus BufferPoolClient::receive( - TransactionId transactionId, BufferId bufferId, int64_t timestampUs, +BufferPoolStatus BufferPoolClient::receive( + TransactionId transactionId, BufferId bufferId, int64_t timestampMs, native_handle_t **handle, std::shared_ptr *buffer) { if (isValid()) { - return mImpl->receive(transactionId, bufferId, timestampUs, handle, buffer); + return mImpl->receive(transactionId, bufferId, timestampMs, handle, buffer); } return ResultStatus::CRITICAL_ERROR; } -ResultStatus BufferPoolClient::postSend( +BufferPoolStatus BufferPoolClient::postSend( ConnectionId receiverId, const std::shared_ptr &buffer, TransactionId *transactionId, - int64_t *timestampUs) { + int64_t *timestampMs) { if (isValid()) { bool result = mImpl->postSend( - buffer->mId, receiverId, transactionId, timestampUs); + buffer->mId, receiverId, transactionId, timestampMs); return result ? ResultStatus::OK : ResultStatus::CRITICAL_ERROR; } return ResultStatus::CRITICAL_ERROR; } -} // namespace implementation -} // namespace V2_0 -} // namespace bufferpool -} // namespace media -} // namespace hardware -} // namespace android +} // namespace aidl::android::hardware::media::bufferpool2::implementation diff --git a/media/bufferpool/aidl/default/BufferPoolClient.h b/media/bufferpool/aidl/default/BufferPoolClient.h index e8d9ae6703..80fd43e93f 100644 --- a/media/bufferpool/aidl/default/BufferPoolClient.h +++ b/media/bufferpool/aidl/default/BufferPoolClient.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -14,29 +14,19 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_BUFFERPOOLCLIENT_H -#define ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_BUFFERPOOLCLIENT_H +#pragma once #include -#include -#include -#include -#include -#include -#include "Accessor.h" +#include +#include +#include -namespace android { -namespace hardware { -namespace media { -namespace bufferpool { -namespace V2_0 { -namespace implementation { +namespace aidl::android::hardware::media::bufferpool2::implementation { -using ::android::hardware::media::bufferpool::V2_0::IAccessor; -using ::android::hardware::media::bufferpool::V2_0::IConnection; -using ::android::hardware::media::bufferpool::V2_0::IObserver; -using ::android::hardware::media::bufferpool::V2_0::ResultStatus; -using ::android::sp; +using aidl::android::hardware::media::bufferpool2::IAccessor; +using aidl::android::hardware::media::bufferpool2::IObserver; + +struct Accessor; /** * A buffer pool client for a buffer pool. For a specific buffer pool, at most @@ -49,8 +39,8 @@ public: * Creates a buffer pool client from a local buffer pool * (via ClientManager#create). */ - explicit BufferPoolClient(const sp &accessor, - const sp &observer); + explicit BufferPoolClient(const std::shared_ptr &accessor, + const std::shared_ptr &observer); /** * Creates a buffer pool client from a remote buffer pool @@ -58,8 +48,8 @@ public: * Note: A buffer pool client created with remote buffer pool cannot * allocate a buffer. */ - explicit BufferPoolClient(const sp &accessor, - const sp &observer); + explicit BufferPoolClient(const std::shared_ptr &accessor, + const std::shared_ptr &observer); /** Destructs a buffer pool client. */ ~BufferPoolClient(); @@ -69,30 +59,30 @@ private: bool isLocal(); - bool isActive(int64_t *lastTransactionUs, bool clearCache); + bool isActive(int64_t *lastTransactionMs, bool clearCache); ConnectionId getConnectionId(); - ResultStatus getAccessor(sp *accessor); + BufferPoolStatus getAccessor(std::shared_ptr *accessor); void receiveInvalidation(uint32_t msgId); - ResultStatus flush(); + BufferPoolStatus flush(); - ResultStatus allocate(const std::vector ¶ms, + BufferPoolStatus allocate(const std::vector ¶ms, native_handle_t **handle, std::shared_ptr *buffer); - ResultStatus receive(TransactionId transactionId, + BufferPoolStatus receive(TransactionId transactionId, BufferId bufferId, - int64_t timestampUs, + int64_t timestampMs, native_handle_t **handle, std::shared_ptr *buffer); - ResultStatus postSend(ConnectionId receiver, + BufferPoolStatus postSend(ConnectionId receiver, const std::shared_ptr &buffer, TransactionId *transactionId, - int64_t *timestampUs); + int64_t *timestampMs); class Impl; std::shared_ptr mImpl; @@ -101,11 +91,4 @@ private: friend struct Observer; }; -} // namespace implementation -} // namespace V2_0 -} // namespace bufferpool -} // namespace media -} // namespace hardware -} // namespace android - -#endif // ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_BUFFERPOOLCLIENT_H +} // namespace aidl::android::hardware::bufferpool2::implementation diff --git a/media/bufferpool/aidl/default/BufferStatus.cpp b/media/bufferpool/aidl/default/BufferStatus.cpp index 693726086e..19caa1e5b5 100644 --- a/media/bufferpool/aidl/default/BufferStatus.cpp +++ b/media/bufferpool/aidl/default/BufferStatus.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -14,29 +14,17 @@ * limitations under the License. */ -#define LOG_TAG "BufferPoolStatus" +#define LOG_TAG "AidlBufferPoolStatus" //#define LOG_NDEBUG 0 #include #include +#include #include "BufferStatus.h" -namespace android { -namespace hardware { -namespace media { -namespace bufferpool { -namespace V2_0 { -namespace implementation { +namespace aidl::android::hardware::media::bufferpool2::implementation { -int64_t getTimestampNow() { - int64_t stamp; - struct timespec ts; - // TODO: CLOCK_MONOTONIC_COARSE? - clock_gettime(CLOCK_MONOTONIC, &ts); - stamp = ts.tv_nsec / 1000; - stamp += (ts.tv_sec * 1000000LL); - return stamp; -} +using aidl::android::hardware::media::bufferpool2::BufferStatus; bool isMessageLater(uint32_t curMsgId, uint32_t prevMsgId) { return curMsgId != prevMsgId && curMsgId - prevMsgId < prevMsgId - curMsgId; @@ -53,30 +41,26 @@ bool isBufferInRange(BufferId from, BufferId to, BufferId bufferId) { static constexpr int kNumElementsInQueue = 1024*16; static constexpr int kMinElementsToSyncInQueue = 128; -ResultStatus BufferStatusObserver::open( - ConnectionId id, const StatusDescriptor** fmqDescPtr) { +BufferPoolStatus BufferStatusObserver::open( + ConnectionId id, StatusDescriptor* fmqDescPtr) { if (mBufferStatusQueues.find(id) != mBufferStatusQueues.end()) { - // TODO: id collision log? + ALOGE("connection id collision %lld", (unsigned long long)id); return ResultStatus::CRITICAL_ERROR; } - std::unique_ptr queue = - std::make_unique(kNumElementsInQueue); + auto queue = std::make_unique(kNumElementsInQueue); if (!queue || queue->isValid() == false) { - *fmqDescPtr = nullptr; return ResultStatus::NO_MEMORY; - } else { - *fmqDescPtr = queue->getDesc(); } + *fmqDescPtr = queue->dupeDesc(); auto result = mBufferStatusQueues.insert( std::make_pair(id, std::move(queue))); if (!result.second) { - *fmqDescPtr = nullptr; return ResultStatus::NO_MEMORY; } return ResultStatus::OK; } -ResultStatus BufferStatusObserver::close(ConnectionId id) { +BufferPoolStatus BufferStatusObserver::close(ConnectionId id) { if (mBufferStatusQueues.find(id) == mBufferStatusQueues.end()) { return ResultStatus::CRITICAL_ERROR; } @@ -90,7 +74,7 @@ void BufferStatusObserver::getBufferStatusChanges(std::vectorsecond->availableToRead(); while (avail > 0) { if (!it->second->read(&message, 1)) { - // Since avaliable # of reads are already confirmed, + // Since available # of reads are already confirmed, // this should not happen. // TODO: error handling (spurious client?) ALOGW("FMQ message cannot be read from %lld", (long long)it->first); @@ -105,8 +89,7 @@ void BufferStatusObserver::getBufferStatusChanges(std::vector queue = - std::make_unique(fmqDesc); + auto queue = std::make_unique(fmqDesc); if (!queue || queue->isValid() == false) { mValid = false; return; @@ -136,11 +119,11 @@ void BufferStatusChannel::postBufferRelease( BufferStatusMessage message; for (size_t i = 0 ; i < avail; ++i) { BufferId id = pending.front(); - message.newStatus = BufferStatus::NOT_USED; + message.status = BufferStatus::NOT_USED; message.bufferId = id; message.connectionId = connectionId; if (!mBufferStatusQueue->write(&message, 1)) { - // Since avaliable # of writes are already confirmed, + // Since available # of writes are already confirmed, // this should not happen. // TODO: error handing? ALOGW("FMQ message cannot be sent from %lld", (long long)connectionId); @@ -160,11 +143,11 @@ void BufferStatusChannel::postBufferInvalidateAck( size_t avail = mBufferStatusQueue->availableToWrite(); if (avail > 0) { BufferStatusMessage message; - message.newStatus = BufferStatus::INVALIDATION_ACK; + message.status = BufferStatus::INVALIDATION_ACK; message.bufferId = invalidateId; message.connectionId = connectionId; if (!mBufferStatusQueue->write(&message, 1)) { - // Since avaliable # of writes are already confirmed, + // Since available # of writes are already confirmed, // this should not happen. // TODO: error handing? ALOGW("FMQ message cannot be sent from %lld", (long long)connectionId); @@ -186,11 +169,11 @@ bool BufferStatusChannel::postBufferStatusMessage( BufferStatusMessage release, message; for (size_t i = 0; i < numPending; ++i) { BufferId id = pending.front(); - release.newStatus = BufferStatus::NOT_USED; + release.status = BufferStatus::NOT_USED; release.bufferId = id; release.connectionId = connectionId; if (!mBufferStatusQueue->write(&release, 1)) { - // Since avaliable # of writes are already confirmed, + // Since available # of writes are already confirmed, // this should not happen. // TODO: error handling? ALOGW("FMQ message cannot be sent from %lld", (long long)connectionId); @@ -201,13 +184,13 @@ bool BufferStatusChannel::postBufferStatusMessage( } message.transactionId = transactionId; message.bufferId = bufferId; - message.newStatus = status; + message.status = status; message.connectionId = connectionId; message.targetConnectionId = targetId; // TODO : timesatamp message.timestampUs = 0; if (!mBufferStatusQueue->write(&message, 1)) { - // Since avaliable # of writes are already confirmed, + // Since available # of writes are already confirmed, // this should not happen. ALOGW("FMQ message cannot be sent from %lld", (long long)connectionId); return false; @@ -276,12 +259,11 @@ bool BufferInvalidationChannel::isValid() { return mValid; } -void BufferInvalidationChannel::getDesc(const InvalidationDescriptor **fmqDescPtr) { +void BufferInvalidationChannel::getDesc(InvalidationDescriptor *fmqDescPtr) { if (mValid) { - *fmqDescPtr = mBufferInvalidationQueue->getDesc(); - } else { - *fmqDescPtr = nullptr; + *fmqDescPtr = mBufferInvalidationQueue->dupeDesc(); } + // TODO: writing invalid descriptor? } void BufferInvalidationChannel::postInvalidation( @@ -295,10 +277,5 @@ void BufferInvalidationChannel::postInvalidation( mBufferInvalidationQueue->write(&message); } -} // namespace implementation -} // namespace V2_0 -} // namespace bufferpool -} // namespace media -} // namespace hardware -} // namespace android +} // namespace ::aidl::android::hardware::media::bufferpool2::implementation diff --git a/media/bufferpool/aidl/default/BufferStatus.h b/media/bufferpool/aidl/default/BufferStatus.h index fa658382a3..3dd92f40ba 100644 --- a/media/bufferpool/aidl/default/BufferStatus.h +++ b/media/bufferpool/aidl/default/BufferStatus.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -14,28 +14,16 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_BUFFERSTATUS_H -#define ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_BUFFERSTATUS_H +#pragma once -#include -#include -#include -#include -#include +#include +#include #include #include #include #include -namespace android { -namespace hardware { -namespace media { -namespace bufferpool { -namespace V2_0 { -namespace implementation { - -/** Returns monotonic timestamp in Us since fixed point in time. */ -int64_t getTimestampNow(); +namespace aidl::android::hardware::media::bufferpool2::implementation { bool isMessageLater(uint32_t curMsgId, uint32_t prevMsgId); @@ -55,13 +43,13 @@ public: * connection(client). * * @param connectionId connection Id of the specified client. - * @param fmqDescPtr double ptr of created FMQ's descriptor. + * @param fmqDescPtr ptr of created FMQ's descriptor. * * @return OK if FMQ is created successfully. * NO_MEMORY when there is no memory. * CRITICAL_ERROR otherwise. */ - ResultStatus open(ConnectionId id, const StatusDescriptor** fmqDescPtr); + BufferPoolStatus open(ConnectionId id, StatusDescriptor* _Nonnull fmqDescPtr); /** Closes a buffer status message FMQ for the specified * connection(client). @@ -71,7 +59,7 @@ public: * @return OK if the specified connection is closed successfully. * CRITICAL_ERROR otherwise. */ - ResultStatus close(ConnectionId id); + BufferPoolStatus close(ConnectionId id); /** Retrieves all pending FMQ buffer status messages from clients. * @@ -140,7 +128,7 @@ public: std::list &pending, std::list &posted); /** - * Posts a buffer invaliadation messge to the buffer pool. + * Posts a buffer invaliadation message to the buffer pool. * * @param connectionId connection Id of the client. * @param invalidateId invalidation ack to the buffer pool. @@ -152,7 +140,7 @@ public: void postBufferInvalidateAck( ConnectionId connectionId, uint32_t invalidateId, - bool *invalidated); + bool* _Nonnull invalidated); }; /** @@ -179,7 +167,7 @@ public: */ void getInvalidations(std::vector &messages); - /** Returns whether the FMQ is connected succesfully. */ + /** Returns whether the FMQ is connected successfully. */ bool isValid(); }; @@ -199,16 +187,16 @@ public: */ BufferInvalidationChannel(); - /** Returns whether the FMQ is connected succesfully. */ + /** Returns whether the FMQ is connected successfully. */ bool isValid(); /** * Retrieves the descriptor of a buffer invalidation FMQ. the descriptor may * be passed to the client for buffer invalidation handling. * - * @param fmqDescPtr double ptr of created FMQ's descriptor. + * @param fmqDescPtr ptr of created FMQ's descriptor. */ - void getDesc(const InvalidationDescriptor **fmqDescPtr); + void getDesc(InvalidationDescriptor* _Nonnull fmqDescPtr); /** Posts a buffer invalidation for invalidated buffers. * @@ -220,11 +208,4 @@ public: void postInvalidation(uint32_t msgId, BufferId fromId, BufferId toId); }; -} // namespace implementation -} // namespace V2_0 -} // namespace bufferpool -} // namespace media -} // namespace hardware -} // namespace android - -#endif // ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_BUFFERSTATUS_H +} // namespace aidl::android::hardware::media::bufferpool2::implementation diff --git a/media/bufferpool/aidl/default/ClientManager.cpp b/media/bufferpool/aidl/default/ClientManager.cpp index 54a20b9a25..de1db50cd1 100644 --- a/media/bufferpool/aidl/default/ClientManager.cpp +++ b/media/bufferpool/aidl/default/ClientManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -13,122 +13,74 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#define LOG_TAG "BufferPoolManager" +#define LOG_TAG "AidlBufferPoolMgr" //#define LOG_NDEBUG 0 -#include -#include +#include +#include + #include -#include +#include #include #include + +#include + #include "BufferPoolClient.h" #include "Observer.h" #include "Accessor.h" -namespace android { -namespace hardware { -namespace media { -namespace bufferpool { -namespace V2_0 { -namespace implementation { +namespace aidl::android::hardware::media::bufferpool2::implementation { -static constexpr int64_t kRegisterTimeoutUs = 500000; // 0.5 sec -static constexpr int64_t kCleanUpDurationUs = 1000000; // TODO: 1 sec tune -static constexpr int64_t kClientTimeoutUs = 5000000; // TODO: 5 secs tune +using namespace std::chrono_literals; -/** - * The holder of the cookie of remote IClientManager. - * The cookie is process locally unique for each IClientManager. - * (The cookie is used to notify death of clients to bufferpool process.) - */ -class ClientManagerCookieHolder { -public: - /** - * Creates a cookie holder for remote IClientManager(s). - */ - ClientManagerCookieHolder(); +using Registration = aidl::android::hardware::media::bufferpool2::IClientManager::Registration; +using aidl::android::hardware::media::bufferpool2::ResultStatus; - /** - * Gets a cookie for a remote IClientManager. - * - * @param manager the specified remote IClientManager. - * @param added true when the specified remote IClientManager is added - * newly, false otherwise. - * - * @return the process locally unique cookie for the specified IClientManager. - */ - uint64_t getCookie(const sp &manager, bool *added); - -private: - uint64_t mSeqId; - std::mutex mLock; - std::list, uint64_t>> mManagers; -}; - -ClientManagerCookieHolder::ClientManagerCookieHolder() : mSeqId(0){} - -uint64_t ClientManagerCookieHolder::getCookie( - const sp &manager, - bool *added) { - std::lock_guard lock(mLock); - for (auto it = mManagers.begin(); it != mManagers.end();) { - const sp key = it->first.promote(); - if (key) { - if (interfacesEqual(key, manager)) { - *added = false; - return it->second; - } - ++it; - } else { - it = mManagers.erase(it); - } - } - uint64_t id = mSeqId++; - *added = true; - mManagers.push_back(std::make_pair(manager, id)); - return id; -} +static constexpr int64_t kRegisterTimeoutMs = 500; // 0.5 sec +static constexpr int64_t kCleanUpDurationMs = 1000; // TODO: 1 sec tune +static constexpr int64_t kClientTimeoutMs = 5000; // TODO: 5 secs tune class ClientManager::Impl { public: Impl(); // BnRegisterSender - ResultStatus registerSender(const sp &accessor, - ConnectionId *pConnectionId); + BufferPoolStatus registerSender(const std::shared_ptr &accessor, + Registration *pRegistration); // BpRegisterSender - ResultStatus registerSender(const sp &receiver, + BufferPoolStatus registerSender(const std::shared_ptr &receiver, ConnectionId senderId, - ConnectionId *receiverId); + ConnectionId *receiverId, + bool *isNew); - ResultStatus create(const std::shared_ptr &allocator, + BufferPoolStatus create(const std::shared_ptr &allocator, ConnectionId *pConnectionId); - ResultStatus close(ConnectionId connectionId); + BufferPoolStatus close(ConnectionId connectionId); - ResultStatus flush(ConnectionId connectionId); + BufferPoolStatus flush(ConnectionId connectionId); - ResultStatus allocate(ConnectionId connectionId, + BufferPoolStatus allocate(ConnectionId connectionId, const std::vector ¶ms, native_handle_t **handle, std::shared_ptr *buffer); - ResultStatus receive(ConnectionId connectionId, + BufferPoolStatus receive(ConnectionId connectionId, TransactionId transactionId, BufferId bufferId, - int64_t timestampUs, + int64_t timestampMs, native_handle_t **handle, std::shared_ptr *buffer); - ResultStatus postSend(ConnectionId receiverId, + BufferPoolStatus postSend(ConnectionId receiverId, const std::shared_ptr &buffer, TransactionId *transactionId, - int64_t *timestampUs); + int64_t *timestampMs); - ResultStatus getAccessor(ConnectionId connectionId, - sp *accessor); + BufferPoolStatus getAccessor(ConnectionId connectionId, + std::shared_ptr *accessor); void cleanUp(bool clearCache = false); @@ -139,13 +91,13 @@ private: // This lock is held for brief duration. // Blocking operation is not performed while holding the lock. std::mutex mMutex; - std::list, const std::weak_ptr>> + std::list, const std::weak_ptr>> mClients; std::condition_variable mConnectCv; bool mConnecting; - int64_t mLastCleanUpUs; + int64_t mLastCleanUpMs; - ClientCache() : mConnecting(false), mLastCleanUpUs(getTimestampNow()) {} + ClientCache() : mConnecting(false), mLastCleanUpMs(::android::elapsedRealtime()) {} } mCache; // Active clients which can be retrieved via ConnectionId @@ -157,30 +109,31 @@ private: mClients; } mActive; - sp mObserver; - - ClientManagerCookieHolder mRemoteClientCookies; + std::shared_ptr mObserver; }; ClientManager::Impl::Impl() - : mObserver(new Observer()) {} + : mObserver(::ndk::SharedRefBase::make()) {} -ResultStatus ClientManager::Impl::registerSender( - const sp &accessor, ConnectionId *pConnectionId) { +BufferPoolStatus ClientManager::Impl::registerSender( + const std::shared_ptr &accessor, Registration *pRegistration) { cleanUp(); - int64_t timeoutUs = getTimestampNow() + kRegisterTimeoutUs; + int64_t timeoutMs = ::android::elapsedRealtime() + kRegisterTimeoutMs; do { std::unique_lock lock(mCache.mMutex); for (auto it = mCache.mClients.begin(); it != mCache.mClients.end(); ++it) { - sp sAccessor = it->first.promote(); - if (sAccessor && interfacesEqual(sAccessor, accessor)) { + std::shared_ptr sAccessor = it->first.lock(); + if (sAccessor && sAccessor.get() == accessor.get()) { const std::shared_ptr client = it->second.lock(); if (client) { std::lock_guard lock(mActive.mMutex); - *pConnectionId = client->getConnectionId(); - if (mActive.mClients.find(*pConnectionId) != mActive.mClients.end()) { - ALOGV("register existing connection %lld", (long long)*pConnectionId); - return ResultStatus::ALREADY_EXISTS; + pRegistration->connectionId = client->getConnectionId(); + if (mActive.mClients.find(pRegistration->connectionId) + != mActive.mClients.end()) { + ALOGV("register existing connection %lld", + (long long)pRegistration->connectionId); + pRegistration->isNew = false; + return ResultStatus::OK; } } mCache.mClients.erase(it); @@ -190,7 +143,7 @@ ResultStatus ClientManager::Impl::registerSender( if (!mCache.mConnecting) { mCache.mConnecting = true; lock.unlock(); - ResultStatus result = ResultStatus::OK; + BufferPoolStatus result = ResultStatus::OK; const std::shared_ptr client = std::make_shared(accessor, mObserver); lock.lock(); @@ -209,26 +162,27 @@ ResultStatus ClientManager::Impl::registerSender( std::lock_guard lock(mActive.mMutex); mActive.mClients.insert(std::make_pair(conId, client)); } - *pConnectionId = conId; - ALOGV("register new connection %lld", (long long)*pConnectionId); + pRegistration->connectionId = conId; + pRegistration->isNew = true; + ALOGV("register new connection %lld", (long long)conId); } mCache.mConnecting = false; lock.unlock(); mCache.mConnectCv.notify_all(); return result; } - mCache.mConnectCv.wait_for( - lock, std::chrono::microseconds(kRegisterTimeoutUs)); - } while (getTimestampNow() < timeoutUs); + mCache.mConnectCv.wait_for(lock, kRegisterTimeoutMs*1ms); + } while (::android::elapsedRealtime() < timeoutMs); // TODO: return timeout error return ResultStatus::CRITICAL_ERROR; } -ResultStatus ClientManager::Impl::registerSender( - const sp &receiver, +BufferPoolStatus ClientManager::Impl::registerSender( + const std::shared_ptr &receiver, ConnectionId senderId, - ConnectionId *receiverId) { - sp accessor; + ConnectionId *receiverId, + bool *isNew) { + std::shared_ptr accessor; bool local = false; { std::lock_guard lock(mActive.mMutex); @@ -239,38 +193,32 @@ ResultStatus ClientManager::Impl::registerSender( it->second->getAccessor(&accessor); local = it->second->isLocal(); } - ResultStatus rs = ResultStatus::CRITICAL_ERROR; if (accessor) { - Return transResult = receiver->registerSender( - accessor, - [&rs, receiverId]( - ResultStatus status, - int64_t connectionId) { - rs = status; - *receiverId = connectionId; - }); - if (!transResult.isOk()) { + Registration registration; + ::ndk::ScopedAStatus status = receiver->registerSender(accessor, ®istration); + if (!status.isOk()) { return ResultStatus::CRITICAL_ERROR; - } else if (local && rs == ResultStatus::OK) { - sp recipient = Accessor::getConnectionDeathRecipient(); + } else if (local) { + std::shared_ptr recipient = + Accessor::getConnectionDeathRecipient(); if (recipient) { ALOGV("client death recipient registered %lld", (long long)*receiverId); - bool added; - uint64_t cookie = mRemoteClientCookies.getCookie(receiver, &added); - recipient->addCookieToConnection(cookie, *receiverId); - if (added) { - Return transResult = receiver->linkToDeath(recipient, cookie); - } + recipient->addCookieToConnection(receiver->asBinder().get(), *receiverId); + AIBinder_linkToDeath(receiver->asBinder().get(), recipient->getRecipient(), + receiver->asBinder().get()); } } + *receiverId = registration.connectionId; + *isNew = registration.isNew; + return ResultStatus::OK; } - return rs; + return ResultStatus::CRITICAL_ERROR; } -ResultStatus ClientManager::Impl::create( +BufferPoolStatus ClientManager::Impl::create( const std::shared_ptr &allocator, ConnectionId *pConnectionId) { - const sp accessor = new Accessor(allocator); + std::shared_ptr accessor = ::ndk::SharedRefBase::make(allocator); if (!accessor || !accessor->isValid()) { return ResultStatus::CRITICAL_ERROR; } @@ -300,19 +248,19 @@ ResultStatus ClientManager::Impl::create( return ResultStatus::OK; } -ResultStatus ClientManager::Impl::close(ConnectionId connectionId) { +BufferPoolStatus ClientManager::Impl::close(ConnectionId connectionId) { std::unique_lock lock1(mCache.mMutex); std::unique_lock lock2(mActive.mMutex); auto it = mActive.mClients.find(connectionId); if (it != mActive.mClients.end()) { - sp accessor; + std::shared_ptr accessor; it->second->getAccessor(&accessor); std::shared_ptr closing = it->second; mActive.mClients.erase(connectionId); for (auto cit = mCache.mClients.begin(); cit != mCache.mClients.end();) { // clean up dead client caches - sp cAccessor = cit->first.promote(); - if (!cAccessor || (accessor && interfacesEqual(cAccessor, accessor))) { + std::shared_ptr cAccessor = cit->first.lock(); + if (!cAccessor || (accessor && cAccessor.get() == accessor.get())) { cit = mCache.mClients.erase(cit); } else { cit++; @@ -326,7 +274,7 @@ ResultStatus ClientManager::Impl::close(ConnectionId connectionId) { return ResultStatus::NOT_FOUND; } -ResultStatus ClientManager::Impl::flush(ConnectionId connectionId) { +BufferPoolStatus ClientManager::Impl::flush(ConnectionId connectionId) { std::shared_ptr client; { std::lock_guard lock(mActive.mMutex); @@ -339,7 +287,7 @@ ResultStatus ClientManager::Impl::flush(ConnectionId connectionId) { return client->flush(); } -ResultStatus ClientManager::Impl::allocate( +BufferPoolStatus ClientManager::Impl::allocate( ConnectionId connectionId, const std::vector ¶ms, native_handle_t **handle, std::shared_ptr *buffer) { std::shared_ptr client; @@ -353,7 +301,7 @@ ResultStatus ClientManager::Impl::allocate( } #ifdef BUFFERPOOL_CLONE_HANDLES native_handle_t *origHandle; - ResultStatus res = client->allocate(params, &origHandle, buffer); + BufferPoolStatus res = client->allocate(params, &origHandle, buffer); if (res != ResultStatus::OK) { return res; } @@ -368,9 +316,9 @@ ResultStatus ClientManager::Impl::allocate( #endif } -ResultStatus ClientManager::Impl::receive( +BufferPoolStatus ClientManager::Impl::receive( ConnectionId connectionId, TransactionId transactionId, - BufferId bufferId, int64_t timestampUs, + BufferId bufferId, int64_t timestampMs, native_handle_t **handle, std::shared_ptr *buffer) { std::shared_ptr client; { @@ -383,8 +331,8 @@ ResultStatus ClientManager::Impl::receive( } #ifdef BUFFERPOOL_CLONE_HANDLES native_handle_t *origHandle; - ResultStatus res = client->receive( - transactionId, bufferId, timestampUs, &origHandle, buffer); + BufferPoolStatus res = client->receive( + transactionId, bufferId, timestampMs, &origHandle, buffer); if (res != ResultStatus::OK) { return res; } @@ -395,13 +343,13 @@ ResultStatus ClientManager::Impl::receive( } return ResultStatus::OK; #else - return client->receive(transactionId, bufferId, timestampUs, handle, buffer); + return client->receive(transactionId, bufferId, timestampMs, handle, buffer); #endif } -ResultStatus ClientManager::Impl::postSend( +BufferPoolStatus ClientManager::Impl::postSend( ConnectionId receiverId, const std::shared_ptr &buffer, - TransactionId *transactionId, int64_t *timestampUs) { + TransactionId *transactionId, int64_t *timestampMs) { ConnectionId connectionId = buffer->mConnectionId; std::shared_ptr client; { @@ -412,11 +360,11 @@ ResultStatus ClientManager::Impl::postSend( } client = it->second; } - return client->postSend(receiverId, buffer, transactionId, timestampUs); + return client->postSend(receiverId, buffer, transactionId, timestampMs); } -ResultStatus ClientManager::Impl::getAccessor( - ConnectionId connectionId, sp *accessor) { +BufferPoolStatus ClientManager::Impl::getAccessor( + ConnectionId connectionId, std::shared_ptr *accessor) { std::shared_ptr client; { std::lock_guard lock(mActive.mMutex); @@ -430,16 +378,16 @@ ResultStatus ClientManager::Impl::getAccessor( } void ClientManager::Impl::cleanUp(bool clearCache) { - int64_t now = getTimestampNow(); - int64_t lastTransactionUs; + int64_t now = ::android::elapsedRealtime(); + int64_t lastTransactionMs; std::lock_guard lock1(mCache.mMutex); - if (clearCache || mCache.mLastCleanUpUs + kCleanUpDurationUs < now) { + if (clearCache || mCache.mLastCleanUpMs + kCleanUpDurationMs < now) { std::lock_guard lock2(mActive.mMutex); int cleaned = 0; for (auto it = mActive.mClients.begin(); it != mActive.mClients.end();) { - if (!it->second->isActive(&lastTransactionUs, clearCache)) { - if (lastTransactionUs + kClientTimeoutUs < now) { - sp accessor; + if (!it->second->isActive(&lastTransactionMs, clearCache)) { + if (lastTransactionMs + kClientTimeoutMs < now) { + std::shared_ptr accessor; it->second->getAccessor(&accessor); it = mActive.mClients.erase(it); ++cleaned; @@ -450,7 +398,7 @@ void ClientManager::Impl::cleanUp(bool clearCache) { } for (auto cit = mCache.mClients.begin(); cit != mCache.mClients.end();) { // clean up dead client caches - sp cAccessor = cit->first.promote(); + std::shared_ptr cAccessor = cit->first.lock(); if (!cAccessor) { cit = mCache.mClients.erase(cit); } else { @@ -458,30 +406,32 @@ void ClientManager::Impl::cleanUp(bool clearCache) { } } ALOGV("# of cleaned connections: %d", cleaned); - mCache.mLastCleanUpUs = now; + mCache.mLastCleanUpMs = now; } } -// Methods from ::android::hardware::media::bufferpool::V2_0::IClientManager follow. -Return ClientManager::registerSender(const sp<::android::hardware::media::bufferpool::V2_0::IAccessor>& bufferPool, registerSender_cb _hidl_cb) { +::ndk::ScopedAStatus ClientManager::registerSender( + const std::shared_ptr& in_bufferPool, Registration* _aidl_return) { + BufferPoolStatus status = ResultStatus::CRITICAL_ERROR; if (mImpl) { - ConnectionId connectionId = -1; - ResultStatus status = mImpl->registerSender(bufferPool, &connectionId); - _hidl_cb(status, connectionId); - } else { - _hidl_cb(ResultStatus::CRITICAL_ERROR, -1); + status = mImpl->registerSender(in_bufferPool, _aidl_return); } - return Void(); + if (status != ResultStatus::OK) { + return ::ndk::ScopedAStatus::fromServiceSpecificError(status); + } + return ::ndk::ScopedAStatus::ok(); } // Methods for local use. -sp ClientManager::sInstance; +std::shared_ptr ClientManager::sInstance; std::mutex ClientManager::sInstanceLock; -sp ClientManager::getInstance() { +std::shared_ptr ClientManager::getInstance() { std::lock_guard lock(sInstanceLock); if (!sInstance) { - sInstance = new ClientManager(); + sInstance = ::ndk::SharedRefBase::make(); + // TODO: configure thread count for threadpool properly + // after b/261652496 is resolved. } Accessor::createInvalidator(); Accessor::createEvictor(); @@ -493,7 +443,7 @@ ClientManager::ClientManager() : mImpl(new Impl()) {} ClientManager::~ClientManager() { } -ResultStatus ClientManager::create( +BufferPoolStatus ClientManager::create( const std::shared_ptr &allocator, ConnectionId *pConnectionId) { if (mImpl) { @@ -502,31 +452,32 @@ ResultStatus ClientManager::create( return ResultStatus::CRITICAL_ERROR; } -ResultStatus ClientManager::registerSender( - const sp &receiver, +BufferPoolStatus ClientManager::registerSender( + const std::shared_ptr &receiver, ConnectionId senderId, - ConnectionId *receiverId) { + ConnectionId *receiverId, + bool *isNew) { if (mImpl) { - return mImpl->registerSender(receiver, senderId, receiverId); + return mImpl->registerSender(receiver, senderId, receiverId, isNew); } return ResultStatus::CRITICAL_ERROR; } -ResultStatus ClientManager::close(ConnectionId connectionId) { +BufferPoolStatus ClientManager::close(ConnectionId connectionId) { if (mImpl) { return mImpl->close(connectionId); } return ResultStatus::CRITICAL_ERROR; } -ResultStatus ClientManager::flush(ConnectionId connectionId) { +BufferPoolStatus ClientManager::flush(ConnectionId connectionId) { if (mImpl) { return mImpl->flush(connectionId); } return ResultStatus::CRITICAL_ERROR; } -ResultStatus ClientManager::allocate( +BufferPoolStatus ClientManager::allocate( ConnectionId connectionId, const std::vector ¶ms, native_handle_t **handle, std::shared_ptr *buffer) { if (mImpl) { @@ -535,22 +486,22 @@ ResultStatus ClientManager::allocate( return ResultStatus::CRITICAL_ERROR; } -ResultStatus ClientManager::receive( +BufferPoolStatus ClientManager::receive( ConnectionId connectionId, TransactionId transactionId, - BufferId bufferId, int64_t timestampUs, + BufferId bufferId, int64_t timestampMs, native_handle_t **handle, std::shared_ptr *buffer) { if (mImpl) { return mImpl->receive(connectionId, transactionId, bufferId, - timestampUs, handle, buffer); + timestampMs, handle, buffer); } return ResultStatus::CRITICAL_ERROR; } -ResultStatus ClientManager::postSend( +BufferPoolStatus ClientManager::postSend( ConnectionId receiverId, const std::shared_ptr &buffer, - TransactionId *transactionId, int64_t* timestampUs) { + TransactionId *transactionId, int64_t* timestampMs) { if (mImpl && buffer) { - return mImpl->postSend(receiverId, buffer, transactionId, timestampUs); + return mImpl->postSend(receiverId, buffer, transactionId, timestampMs); } return ResultStatus::CRITICAL_ERROR; } @@ -561,9 +512,4 @@ void ClientManager::cleanUp() { } } -} // namespace implementation -} // namespace V2_0 -} // namespace bufferpool -} // namespace media -} // namespace hardware -} // namespace android +} // namespace ::aidl::android::hardware::media::bufferpool2::implementation diff --git a/media/bufferpool/aidl/default/Connection.cpp b/media/bufferpool/aidl/default/Connection.cpp index 57d0c7eb63..53d350dcf7 100644 --- a/media/bufferpool/aidl/default/Connection.cpp +++ b/media/bufferpool/aidl/default/Connection.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -13,42 +13,63 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#define LOG_TAG "AidlBufferPoolCon" +//#define LOG_NDEBUG 0 + +#include #include "Connection.h" +#include "Accessor.h" -namespace android { -namespace hardware { -namespace media { -namespace bufferpool { -namespace V2_0 { -namespace implementation { +namespace aidl::android::hardware::media::bufferpool2::implementation { -// Methods from ::android::hardware::media::bufferpool::V2_0::IConnection follow. -Return Connection::fetch(uint64_t transactionId, uint32_t bufferId, fetch_cb _hidl_cb) { - ResultStatus status = ResultStatus::CRITICAL_ERROR; +using aidl::android::hardware::media::bufferpool2::ResultStatus; +using Buffer = aidl::android::hardware::media::bufferpool2::Buffer; +using FetchInfo = aidl::android::hardware::media::bufferpool2::IConnection::FetchInfo; +using FetchResult = aidl::android::hardware::media::bufferpool2::IConnection::FetchResult; + +::ndk::ScopedAStatus Connection::fetch(const std::vector& in_fetchInfos, + std::vector* _aidl_return) { + int success = 0; + int failure = 0; if (mInitialized && mAccessor) { - if (bufferId != SYNC_BUFFERID) { - const native_handle_t *handle = nullptr; - status = mAccessor->fetch( - mConnectionId, transactionId, bufferId, &handle); - if (status == ResultStatus::OK) { - Buffer buffer = {}; - buffer.id = bufferId; - buffer.buffer = handle; - _hidl_cb(status, buffer); - return Void(); + for (auto it = in_fetchInfos.begin(); it != in_fetchInfos.end(); ++it) { + if (fetch(it->transactionId, it->bufferId, _aidl_return)) { + success++; + } else { + failure++; } - } else { - mAccessor->cleanUp(false); } + if (failure > 0) { + ALOGD("total fetch %d, failure %d", success + failure, failure); + } + return ::ndk::ScopedAStatus::ok(); } + return ::ndk::ScopedAStatus::fromServiceSpecificError(ResultStatus::CRITICAL_ERROR); +} - Buffer buffer = {}; - buffer.id = 0; - buffer.buffer = nullptr; +::ndk::ScopedAStatus Connection::sync() { + if (mInitialized && mAccessor) { + mAccessor->cleanUp(false); + } + return ::ndk::ScopedAStatus::ok(); +} - _hidl_cb(status, buffer); - return Void(); + +bool Connection::fetch(TransactionId transactionId, BufferId bufferId, + std::vector *result) { + BufferPoolStatus status = ResultStatus::CRITICAL_ERROR; + const native_handle_t *handle = nullptr; + status = mAccessor->fetch( + mConnectionId, transactionId, bufferId, &handle); + if (status == ResultStatus::OK) { + result->emplace_back(FetchResult::make()); + result->back().get().id = bufferId; + result->back().get().buffer = ::android::dupToAidl(handle); + return true; + } + result->emplace_back(FetchResult::make(status)); + return false; } Connection::Connection() : mInitialized(false), mConnectionId(-1LL) {} @@ -60,7 +81,7 @@ Connection::~Connection() { } void Connection::initialize( - const sp& accessor, ConnectionId connectionId) { + const std::shared_ptr& accessor, ConnectionId connectionId) { if (!mInitialized) { mAccessor = accessor; mConnectionId = connectionId; @@ -68,14 +89,14 @@ void Connection::initialize( } } -ResultStatus Connection::flush() { +BufferPoolStatus Connection::flush() { if (mInitialized && mAccessor) { return mAccessor->flush(); } return ResultStatus::CRITICAL_ERROR; } -ResultStatus Connection::allocate( +BufferPoolStatus Connection::allocate( const std::vector ¶ms, BufferId *bufferId, const native_handle_t **handle) { if (mInitialized && mAccessor) { @@ -90,15 +111,4 @@ void Connection::cleanUp(bool clearCache) { } } -// Methods from ::android::hidl::base::V1_0::IBase follow. - -//IConnection* HIDL_FETCH_IConnection(const char* /* name */) { -// return new Connection(); -//} - -} // namespace implementation -} // namespace V2_0 -} // namespace bufferpool -} // namespace media -} // namespace hardware -} // namespace android +} // namespace ::aidl::android::hardware::media::bufferpool2::implementation diff --git a/media/bufferpool/aidl/default/Connection.h b/media/bufferpool/aidl/default/Connection.h index 8507749849..d8298af309 100644 --- a/media/bufferpool/aidl/default/Connection.h +++ b/media/bufferpool/aidl/default/Connection.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -14,39 +14,28 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_CONNECTION_H -#define ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_CONNECTION_H +#pragma once -#include -#include -#include -#include -#include "Accessor.h" +#include -namespace android { -namespace hardware { -namespace media { -namespace bufferpool { -namespace V2_0 { -namespace implementation { +#include +#include -using ::android::hardware::hidl_array; -using ::android::hardware::hidl_memory; -using ::android::hardware::hidl_string; -using ::android::hardware::hidl_vec; -using ::android::hardware::media::bufferpool::V2_0::implementation::Accessor; -using ::android::hardware::Return; -using ::android::hardware::Void; -using ::android::sp; +namespace aidl::android::hardware::media::bufferpool2::implementation { -struct Connection : public IConnection { - // Methods from ::android::hardware::media::bufferpool::V2_0::IConnection follow. - Return fetch(uint64_t transactionId, uint32_t bufferId, fetch_cb _hidl_cb) override; +struct Accessor; + +struct Connection : public BnConnection { + // Methods from ::aidl::android::hardware::media::bufferpool2::IConnection. + ::ndk::ScopedAStatus fetch(const std::vector<::aidl::android::hardware::media::bufferpool2::IConnection::FetchInfo>& in_fetchInfos, std::vector<::aidl::android::hardware::media::bufferpool2::IConnection::FetchResult>* _aidl_return) override; + + // Methods from ::aidl::android::hardware::media::bufferpool2::IConnection. + ::ndk::ScopedAStatus sync() override; /** * Invalidates all buffers which are active and/or are ready to be recycled. */ - ResultStatus flush(); + BufferPoolStatus flush(); /** * Allocates a buffer using the specified parameters. Recycles a buffer if @@ -61,7 +50,7 @@ struct Connection : public IConnection { * NO_MEMORY when there is no memory. * CRITICAL_ERROR otherwise. */ - ResultStatus allocate(const std::vector ¶ms, + BufferPoolStatus allocate(const std::vector ¶ms, BufferId *bufferId, const native_handle_t **handle); /** @@ -86,7 +75,7 @@ struct Connection : public IConnection { * @param accessor the specified buffer pool. * @param connectionId Id. */ - void initialize(const sp &accessor, ConnectionId connectionId); + void initialize(const std::shared_ptr &accessor, ConnectionId connectionId); enum : uint32_t { SYNC_BUFFERID = UINT32_MAX, @@ -94,15 +83,14 @@ struct Connection : public IConnection { private: bool mInitialized; - sp mAccessor; + std::shared_ptr mAccessor; ConnectionId mConnectionId; + + bool fetch( + uint64_t transactionId, + uint32_t bufferId, + std::vector<::aidl::android::hardware::media::bufferpool2::IConnection::FetchResult> + *result); }; -} // namespace implementation -} // namespace V2_0 -} // namespace bufferpool -} // namespace media -} // namespace hardware -} // namespace android - -#endif // ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_CONNECTION_H +} // namespace aidl::android::hardware::media::bufferpool2::implementation diff --git a/media/bufferpool/aidl/default/DataHelper.h b/media/bufferpool/aidl/default/DataHelper.h new file mode 100644 index 0000000000..a90b3c7381 --- /dev/null +++ b/media/bufferpool/aidl/default/DataHelper.h @@ -0,0 +1,124 @@ +/* + * 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. + */ + +#pragma once + +#include +#include + +#include +#include + +namespace aidl::android::hardware::media::bufferpool2::implementation { + +// Helper template methods for handling map of set. +template +bool insert(std::map> *mapOfSet, T key, U value) { + auto iter = mapOfSet->find(key); + if (iter == mapOfSet->end()) { + std::set valueSet{value}; + mapOfSet->insert(std::make_pair(key, valueSet)); + return true; + } else if (iter->second.find(value) == iter->second.end()) { + iter->second.insert(value); + return true; + } + return false; +} + +// Helper template methods for handling map of set. +template +bool erase(std::map> *mapOfSet, T key, U value) { + bool ret = false; + auto iter = mapOfSet->find(key); + if (iter != mapOfSet->end()) { + if (iter->second.erase(value) > 0) { + ret = true; + } + if (iter->second.size() == 0) { + mapOfSet->erase(iter); + } + } + return ret; +} + +// Helper template methods for handling map of set. +template +bool contains(std::map> *mapOfSet, T key, U value) { + auto iter = mapOfSet->find(key); + if (iter != mapOfSet->end()) { + auto setIter = iter->second.find(value); + return setIter != iter->second.end(); + } + return false; +} + +// Buffer data structure for internal BufferPool use.(storage/fetching) +struct InternalBuffer { + BufferId mId; + size_t mOwnerCount; + size_t mTransactionCount; + const std::shared_ptr mAllocation; + const size_t mAllocSize; + const std::vector mConfig; + bool mInvalidated; + + InternalBuffer( + BufferId id, + const std::shared_ptr &alloc, + const size_t allocSize, + const std::vector &allocConfig) + : mId(id), mOwnerCount(0), mTransactionCount(0), + mAllocation(alloc), mAllocSize(allocSize), mConfig(allocConfig), + mInvalidated(false) {} + + const native_handle_t *handle() { + return mAllocation->handle(); + } + + void invalidate() { + mInvalidated = true; + } +}; + +// Buffer transacion status/message data structure for internal BufferPool use. +struct TransactionStatus { + TransactionId mId; + BufferId mBufferId; + ConnectionId mSender; + ConnectionId mReceiver; + BufferStatus mStatus; + int64_t mTimestampMs; + bool mSenderValidated; + + TransactionStatus(const BufferStatusMessage &message, int64_t timestampMs) { + mId = message.transactionId; + mBufferId = message.bufferId; + mStatus = message.status; + mTimestampMs = timestampMs; + if (mStatus == BufferStatus::TRANSFER_TO) { + mSender = message.connectionId; + mReceiver = message.targetConnectionId; + mSenderValidated = true; + } else { + mSender = -1LL; + mReceiver = message.connectionId; + mSenderValidated = false; + } + } +}; + +} // namespace aidl::android::hardware::media::bufferpool2::implementation diff --git a/media/bufferpool/aidl/default/Observer.cpp b/media/bufferpool/aidl/default/Observer.cpp index 5b23160463..a22e825637 100644 --- a/media/bufferpool/aidl/default/Observer.cpp +++ b/media/bufferpool/aidl/default/Observer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -15,13 +15,9 @@ */ #include "Observer.h" +#include "BufferPoolClient.h" -namespace android { -namespace hardware { -namespace media { -namespace bufferpool { -namespace V2_0 { -namespace implementation { +namespace aidl::android::hardware::media::bufferpool2::implementation { Observer::Observer() { } @@ -29,20 +25,19 @@ Observer::Observer() { Observer::~Observer() { } -// Methods from ::android::hardware::media::bufferpool::V2_0::IObserver follow. -Return Observer::onMessage(int64_t connectionId, uint32_t msgId) { +::ndk::ScopedAStatus Observer::onMessage(int64_t in_connectionId, int32_t in_msgId) { std::unique_lock lock(mLock); - auto it = mClients.find(connectionId); + auto it = mClients.find(in_connectionId); if (it != mClients.end()) { const std::shared_ptr client = it->second.lock(); if (!client) { mClients.erase(it); } else { lock.unlock(); - client->receiveInvalidation(msgId); + client->receiveInvalidation(in_msgId); } } - return Void(); + return ::ndk::ScopedAStatus::ok(); } void Observer::addClient(ConnectionId connectionId, @@ -65,9 +60,4 @@ void Observer::delClient(ConnectionId connectionId) { } -} // namespace implementation -} // namespace V2_0 -} // namespace bufferpool -} // namespace media -} // namespace hardware -} // namespace android +} // namespace aidl::android::hardware::media::bufferpool2::implementation diff --git a/media/bufferpool/aidl/default/Observer.h b/media/bufferpool/aidl/default/Observer.h index 42bd7c1325..febb21bf02 100644 --- a/media/bufferpool/aidl/default/Observer.h +++ b/media/bufferpool/aidl/default/Observer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -14,32 +14,20 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_OBSERVER_H -#define ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_OBSERVER_H +#pragma once -#include -#include -#include -#include "BufferPoolClient.h" +#include +#include +#include +#include +#include -namespace android { -namespace hardware { -namespace media { -namespace bufferpool { -namespace V2_0 { -namespace implementation { +namespace aidl::android::hardware::media::bufferpool2::implementation { -using ::android::hardware::hidl_array; -using ::android::hardware::hidl_memory; -using ::android::hardware::hidl_string; -using ::android::hardware::hidl_vec; -using ::android::hardware::Return; -using ::android::hardware::Void; -using ::android::sp; +class BufferPoolClient; -struct Observer : public IObserver { - // Methods from ::android::hardware::media::bufferpool::V2_0::IObserver follow. - Return onMessage(int64_t connectionId, uint32_t msgId) override; +struct Observer : public BnObserver { + ::ndk::ScopedAStatus onMessage(int64_t in_connectionId, int32_t in_msgId) override; ~Observer(); @@ -51,17 +39,11 @@ struct Observer : public IObserver { private: Observer(); - friend struct ClientManager; + friend class ::ndk::SharedRefBase; std::mutex mLock; std::map> mClients; }; -} // namespace implementation -} // namespace V2_0 -} // namespace bufferpool -} // namespace media -} // namespace hardware -} // namespace android +} // namespace aidl::android::hardware::media::bufferpool2::implementation -#endif // ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_OBSERVER_H diff --git a/media/bufferpool/aidl/default/include/bufferpool/BufferPoolTypes.h b/media/bufferpool/aidl/default/include/bufferpool2/BufferPoolTypes.h similarity index 58% rename from media/bufferpool/aidl/default/include/bufferpool/BufferPoolTypes.h rename to media/bufferpool/aidl/default/include/bufferpool2/BufferPoolTypes.h index 7c906cbf66..b833362252 100644 --- a/media/bufferpool/aidl/default/include/bufferpool/BufferPoolTypes.h +++ b/media/bufferpool/aidl/default/include/bufferpool2/BufferPoolTypes.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -14,23 +14,19 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_BUFFERPOOLTYPES_H -#define ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_BUFFERPOOLTYPES_H +#pragma once -#include #include -#include -#include -#include +#include +#include +#include +#include -namespace android { -namespace hardware { -namespace media { -namespace bufferpool { +namespace aidl::android::hardware::media::bufferpool2 { struct BufferPoolData { // For local use, to specify a bufferpool (client connection) for buffers. - // Return value from connect#IAccessor(android.hardware.media.bufferpool@2.0). + // Retrieved from returned info of IAccessor#connect(android.hardware.media.bufferpool@2.0). int64_t mConnectionId; // BufferId uint32_t mId; @@ -44,26 +40,38 @@ struct BufferPoolData { ~BufferPoolData() {} }; -namespace V2_0 { namespace implementation { -using ::android::hardware::kSynchronizedReadWrite; -using ::android::hardware::kUnsynchronizedWrite; +using aidl::android::hardware::common::fmq::SynchronizedReadWrite; +using aidl::android::hardware::common::fmq::UnsynchronizedWrite; + +using aidl::android::hardware::media::bufferpool2::BufferStatusMessage; +using aidl::android::hardware::media::bufferpool2::BufferInvalidationMessage; typedef uint32_t BufferId; typedef uint64_t TransactionId; typedef int64_t ConnectionId; +typedef int32_t BufferPoolStatus; + +// AIDL hal description language does not support unsigned. +int32_t static inline ToAidl(BufferId id) {return static_cast(id);} +int64_t static inline ToAidl(TransactionId id) {return static_cast(id);} + +BufferId static inline FromAidl(int32_t id) {return static_cast(id);} +TransactionId static inline FromAidl(int64_t id) {return static_cast(id);} enum : ConnectionId { INVALID_CONNECTIONID = 0, }; -typedef android::hardware::MessageQueue BufferStatusQueue; -typedef BufferStatusQueue::Descriptor StatusDescriptor; +typedef ::android::AidlMessageQueue BufferStatusQueue; +typedef aidl::android::hardware::common::fmq::MQDescriptor + StatusDescriptor; -typedef android::hardware::MessageQueue +typedef ::android::AidlMessageQueue BufferInvalidationQueue; -typedef BufferInvalidationQueue::Descriptor InvalidationDescriptor; +typedef aidl::android::hardware::common::fmq::MQDescriptor + InvalidationDescriptor; /** * Allocation wrapper class for buffer pool. @@ -95,7 +103,7 @@ public: * * @return OK when an allocation is created successfully. */ - virtual ResultStatus allocate( + virtual BufferPoolStatus allocate( const std::vector ¶ms, std::shared_ptr *alloc, size_t *allocSize) = 0; @@ -114,10 +122,5 @@ protected: }; } // namespace implementation -} // namespace V2_0 -} // namespace bufferpool -} // namespace media -} // namespace hardware -} // namespace android +} // namespace aidl::android::hareware::media::bufferpool2 -#endif // ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_BUFFERPOOLTYPES_H diff --git a/media/bufferpool/aidl/default/include/bufferpool/ClientManager.h b/media/bufferpool/aidl/default/include/bufferpool2/ClientManager.h similarity index 71% rename from media/bufferpool/aidl/default/include/bufferpool/ClientManager.h rename to media/bufferpool/aidl/default/include/bufferpool2/ClientManager.h index 24b61f4fb5..bff75ba597 100644 --- a/media/bufferpool/aidl/default/include/bufferpool/ClientManager.h +++ b/media/bufferpool/aidl/default/include/bufferpool2/ClientManager.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -14,38 +14,28 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_CLIENTMANAGER_H -#define ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_CLIENTMANAGER_H +#pragma once -#include -#include -#include +#include +#include #include #include "BufferPoolTypes.h" -namespace android { -namespace hardware { -namespace media { -namespace bufferpool { -namespace V2_0 { -namespace implementation { +namespace aidl::android::hardware::media::bufferpool2::implementation { -using ::android::hardware::hidl_array; -using ::android::hardware::hidl_memory; -using ::android::hardware::hidl_string; -using ::android::hardware::hidl_vec; -using ::android::hardware::media::bufferpool::V2_0::IAccessor; -using ::android::hardware::media::bufferpool::V2_0::ResultStatus; -using ::android::hardware::Return; -using ::android::hardware::Void; -using ::android::sp; +using aidl::android::hardware::media::bufferpool2::BnClientManager; +using aidl::android::hardware::media::bufferpool2::IClientManager; +using aidl::android::hardware::media::bufferpool2::IAccessor; -struct ClientManager : public IClientManager { - // Methods from ::android::hardware::media::bufferpool::V2_0::IClientManager follow. - Return registerSender(const sp<::android::hardware::media::bufferpool::V2_0::IAccessor>& bufferPool, registerSender_cb _hidl_cb) override; +struct ClientManager : public BnClientManager { + // Methods from ::aidl::android::hardware::media::bufferpool2::IClientManager follow. + ::ndk::ScopedAStatus registerSender( + const std::shared_ptr& in_bufferPool, + ::aidl::android::hardware::media::bufferpool2::IClientManager::Registration* _aidl_return) + override; /** Gets an instance. */ - static sp getInstance(); + static std::shared_ptr getInstance(); /** * Creates a local connection with a newly created buffer pool. @@ -56,10 +46,10 @@ struct ClientManager : public IClientManager { * * @return OK when a buffer pool and a local connection is successfully * created. - * NO_MEMORY when there is no memory. + * ResultStatus::NO_MEMORY when there is no memory. * CRITICAL_ERROR otherwise. */ - ResultStatus create(const std::shared_ptr &allocator, + BufferPoolStatus create(const std::shared_ptr &allocator, ConnectionId *pConnectionId); /** @@ -69,16 +59,17 @@ struct ClientManager : public IClientManager { * @param senderId A local connection which will send buffers to. * @param receiverId Id of the created receiving connection on the receiver * process. + * @param isNew @true when the receiving connection is newly created. * * @return OK when the receiving connection is successfully created on the * receiver process. * NOT_FOUND when the sender connection was not found. - * ALREADY_EXISTS the receiving connection is already made. * CRITICAL_ERROR otherwise. */ - ResultStatus registerSender(const sp &receiver, + BufferPoolStatus registerSender(const std::shared_ptr &receiver, ConnectionId senderId, - ConnectionId *receiverId); + ConnectionId *receiverId, + bool *isNew); /** * Closes the specified connection. @@ -89,7 +80,7 @@ struct ClientManager : public IClientManager { * NOT_FOUND when the specified connection was not found. * CRITICAL_ERROR otherwise. */ - ResultStatus close(ConnectionId connectionId); + BufferPoolStatus close(ConnectionId connectionId); /** * Evicts cached allocations. If it's local connection, release the @@ -101,7 +92,7 @@ struct ClientManager : public IClientManager { * NOT_FOUND when the specified connection was not found. * CRITICAL_ERROR otherwise. */ - ResultStatus flush(ConnectionId connectionId); + BufferPoolStatus flush(ConnectionId connectionId); /** * Allocates a buffer from the specified connection. The output parameter @@ -119,7 +110,7 @@ struct ClientManager : public IClientManager { * NO_MEMORY when there is no memory. * CRITICAL_ERROR otherwise. */ - ResultStatus allocate(ConnectionId connectionId, + BufferPoolStatus allocate(ConnectionId connectionId, const std::vector ¶ms, native_handle_t **handle, std::shared_ptr *buffer); @@ -132,7 +123,7 @@ struct ClientManager : public IClientManager { * @param connectionId The id of the receiving connection. * @param transactionId The id for the transaction. * @param bufferId The id for the buffer. - * @param timestampUs The timestamp of the buffer is being sent. + * @param timestampMs The timestamp of the buffer is being sent. * @param handle The native handle to the allocated buffer. handle * should be cloned before use. * @param buffer The received buffer. @@ -142,10 +133,10 @@ struct ClientManager : public IClientManager { * NO_MEMORY when there is no memory. * CRITICAL_ERROR otherwise. */ - ResultStatus receive(ConnectionId connectionId, + BufferPoolStatus receive(ConnectionId connectionId, TransactionId transactionId, BufferId bufferId, - int64_t timestampUs, + int64_t timestampMs, native_handle_t **handle, std::shared_ptr *buffer); @@ -156,17 +147,17 @@ struct ClientManager : public IClientManager { * @param receiverId The id of the receiving connection. * @param buffer to transfer * @param transactionId Id of the transfer transaction. - * @param timestampUs The timestamp of the buffer transaction is being + * @param timestampMs The timestamp of the buffer transaction is being * posted. * * @return OK when a buffer transaction was posted successfully. * NOT_FOUND when the sending connection was not found. * CRITICAL_ERROR otherwise. */ - ResultStatus postSend(ConnectionId receiverId, + BufferPoolStatus postSend(ConnectionId receiverId, const std::shared_ptr &buffer, TransactionId *transactionId, - int64_t *timestampUs); + int64_t *timestampMs); /** * Time out inactive lingering connections and close. @@ -176,20 +167,16 @@ struct ClientManager : public IClientManager { /** Destructs the manager of buffer pool clients. */ ~ClientManager(); private: - static sp sInstance; + static std::shared_ptr sInstance; static std::mutex sInstanceLock; class Impl; const std::unique_ptr mImpl; + friend class ::ndk::SharedRefBase; + ClientManager(); }; -} // namespace implementation -} // namespace V2_0 -} // namespace bufferpool -} // namespace media -} // namespace hardware -} // namespace android +} // namespace aidl::android::hardware::media::bufferpool2::implementation -#endif // ANDROID_HARDWARE_MEDIA_BUFFERPOOL_V2_0_CLIENTMANAGER_H diff --git a/media/bufferpool/aidl/default/tests/Android.bp b/media/bufferpool/aidl/default/tests/Android.bp new file mode 100644 index 0000000000..549af5739c --- /dev/null +++ b/media/bufferpool/aidl/default/tests/Android.bp @@ -0,0 +1,93 @@ +/* + * 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. + */ + +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "frameworks_av_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_test { + name: "VtsVndkAidlBufferpool2V1_0TargetSingleTest", + test_suites: ["device-tests"], + defaults: ["VtsHalTargetTestDefaults"], + srcs: [ + "allocator.cpp", + "single.cpp", + ], + shared_libs: [ + "libbinder_ndk", + "libcutils", + "libfmq", + "liblog", + "libutils", + "android.hardware.media.bufferpool2-V1-ndk", + ], + static_libs: [ + "libaidlcommonsupport", + "libstagefright_aidl_bufferpool2" + ], + compile_multilib: "both", +} + +cc_test { + name: "VtsVndkAidlBufferpool2V1_0TargetMultiTest", + test_suites: ["device-tests"], + defaults: ["VtsHalTargetTestDefaults"], + srcs: [ + "allocator.cpp", + "multi.cpp", + ], + shared_libs: [ + "libbinder_ndk", + "libcutils", + "libfmq", + "liblog", + "libutils", + "android.hardware.media.bufferpool2-V1-ndk", + ], + static_libs: [ + "libaidlcommonsupport", + "libstagefright_aidl_bufferpool2" + ], + compile_multilib: "both", +} + +cc_test { + name: "VtsVndkAidlBufferpool2V1_0TargetCondTest", + test_suites: ["device-tests"], + defaults: ["VtsHalTargetTestDefaults"], + srcs: [ + "allocator.cpp", + "cond.cpp", + ], + shared_libs: [ + "libbinder_ndk", + "libcutils", + "libfmq", + "liblog", + "libutils", + "android.hardware.media.bufferpool2-V1-ndk", + ], + static_libs: [ + "libaidlcommonsupport", + "libstagefright_aidl_bufferpool2" + ], + compile_multilib: "both", +} diff --git a/media/bufferpool/aidl/default/tests/BufferpoolUnitTest.cpp b/media/bufferpool/aidl/default/tests/BufferpoolUnitTest.cpp deleted file mode 100644 index b448405a2e..0000000000 --- a/media/bufferpool/aidl/default/tests/BufferpoolUnitTest.cpp +++ /dev/null @@ -1,541 +0,0 @@ -/* - * Copyright (C) 2021 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. - */ - -//#define LOG_NDEBUG 0 -#define LOG_TAG "BufferpoolUnitTest" -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include "allocator.h" - -using android::hardware::configureRpcThreadpool; -using android::hardware::media::bufferpool::BufferPoolData; -using android::hardware::media::bufferpool::V2_0::IClientManager; -using android::hardware::media::bufferpool::V2_0::ResultStatus; -using android::hardware::media::bufferpool::V2_0::implementation::BufferId; -using android::hardware::media::bufferpool::V2_0::implementation::ClientManager; -using android::hardware::media::bufferpool::V2_0::implementation::ConnectionId; -using android::hardware::media::bufferpool::V2_0::implementation::TransactionId; - -using namespace android; - -// communication message types between processes. -enum PipeCommand : int32_t { - INIT, - TRANSFER, - STOP, - - INIT_OK, - INIT_ERROR, - TRANSFER_OK, - TRANSFER_ERROR, - STOP_OK, - STOP_ERROR, -}; - -// communication message between processes. -union PipeMessage { - struct { - int32_t command; - int32_t memsetValue; - BufferId bufferId; - ConnectionId connectionId; - TransactionId transactionId; - int64_t timestampUs; - } data; - char array[0]; -}; - -static int32_t kNumIterationCount = 10; - -class BufferpoolTest { - public: - BufferpoolTest() : mConnectionValid(false), mManager(nullptr), mAllocator(nullptr) { - mConnectionId = -1; - mReceiverId = -1; - } - - ~BufferpoolTest() { - if (mConnectionValid) { - mManager->close(mConnectionId); - } - } - - protected: - bool mConnectionValid; - ConnectionId mConnectionId; - ConnectionId mReceiverId; - - android::sp mManager; - std::shared_ptr mAllocator; - - void setupBufferpoolManager(); -}; - -void BufferpoolTest::setupBufferpoolManager() { - // retrieving per process bufferpool object sp - mManager = ClientManager::getInstance(); - ASSERT_NE(mManager, nullptr) << "unable to get ClientManager\n"; - - mAllocator = std::make_shared(); - ASSERT_NE(mAllocator, nullptr) << "unable to create TestBufferPoolAllocator\n"; - - // set-up local bufferpool connection for sender - ResultStatus status = mManager->create(mAllocator, &mConnectionId); - ASSERT_EQ(status, ResultStatus::OK) - << "unable to set-up local bufferpool connection for sender\n"; - mConnectionValid = true; -} - -class BufferpoolUnitTest : public BufferpoolTest, public ::testing::Test { - public: - virtual void SetUp() override { setupBufferpoolManager(); } - - virtual void TearDown() override {} -}; - -class BufferpoolFunctionalityTest : public BufferpoolTest, public ::testing::Test { - public: - virtual void SetUp() override { - mReceiverPid = -1; - - ASSERT_TRUE(pipe(mCommandPipeFds) == 0) << "pipe connection failed for commandPipe\n"; - ASSERT_TRUE(pipe(mResultPipeFds) == 0) << "pipe connection failed for resultPipe\n"; - - mReceiverPid = fork(); - ASSERT_TRUE(mReceiverPid >= 0) << "fork failed\n"; - - if (mReceiverPid == 0) { - doReceiver(); - // In order to ignore gtest behaviour, wait for being killed from tearDown - pause(); - } - setupBufferpoolManager(); - } - - virtual void TearDown() override { - if (mReceiverPid > 0) { - kill(mReceiverPid, SIGKILL); - int wstatus; - wait(&wstatus); - } - } - - protected: - pid_t mReceiverPid; - int mCommandPipeFds[2]; - int mResultPipeFds[2]; - - bool sendMessage(int* pipes, const PipeMessage& message) { - int ret = write(pipes[1], message.array, sizeof(PipeMessage)); - return ret == sizeof(PipeMessage); - } - - bool receiveMessage(int* pipes, PipeMessage* message) { - int ret = read(pipes[0], message->array, sizeof(PipeMessage)); - return ret == sizeof(PipeMessage); - } - - void doReceiver(); -}; - -void BufferpoolFunctionalityTest::doReceiver() { - // Configures the threadpool used for handling incoming RPC calls in this process. - configureRpcThreadpool(1 /*threads*/, false /*willJoin*/); - bool receiverRunning = true; - while (receiverRunning) { - PipeMessage message; - receiveMessage(mCommandPipeFds, &message); - ResultStatus err = ResultStatus::OK; - switch (message.data.command) { - case PipeCommand::INIT: { - // receiver manager creation - mManager = ClientManager::getInstance(); - if (!mManager) { - message.data.command = PipeCommand::INIT_ERROR; - sendMessage(mResultPipeFds, message); - return; - } - - android::status_t status = mManager->registerAsService(); - if (status != android::OK) { - message.data.command = PipeCommand::INIT_ERROR; - sendMessage(mResultPipeFds, message); - return; - } - message.data.command = PipeCommand::INIT_OK; - sendMessage(mResultPipeFds, message); - break; - } - case PipeCommand::TRANSFER: { - native_handle_t* receiveHandle = nullptr; - std::shared_ptr receiveBuffer; - err = mManager->receive(message.data.connectionId, message.data.transactionId, - message.data.bufferId, message.data.timestampUs, - &receiveHandle, &receiveBuffer); - if (err != ResultStatus::OK) { - message.data.command = PipeCommand::TRANSFER_ERROR; - sendMessage(mResultPipeFds, message); - return; - } - if (!TestBufferPoolAllocator::Verify(receiveHandle, message.data.memsetValue)) { - message.data.command = PipeCommand::TRANSFER_ERROR; - sendMessage(mResultPipeFds, message); - return; - } - if (receiveHandle) { - native_handle_close(receiveHandle); - native_handle_delete(receiveHandle); - } - receiveHandle = nullptr; - receiveBuffer.reset(); - message.data.command = PipeCommand::TRANSFER_OK; - sendMessage(mResultPipeFds, message); - break; - } - case PipeCommand::STOP: { - err = mManager->close(message.data.connectionId); - if (err != ResultStatus::OK) { - message.data.command = PipeCommand::STOP_ERROR; - sendMessage(mResultPipeFds, message); - return; - } - message.data.command = PipeCommand::STOP_OK; - sendMessage(mResultPipeFds, message); - receiverRunning = false; - break; - } - default: - ALOGE("unknown command. try again"); - break; - } - } -} - -// Buffer allocation test. -// Check whether each buffer allocation is done successfully with unique buffer id. -TEST_F(BufferpoolUnitTest, AllocateBuffer) { - std::vector vecParams; - getTestAllocatorParams(&vecParams); - - std::vector> buffers{}; - std::vector allocHandle{}; - ResultStatus status; - for (int i = 0; i < kNumIterationCount; ++i) { - native_handle_t* handle = nullptr; - std::shared_ptr buffer{}; - status = mManager->allocate(mConnectionId, vecParams, &handle, &buffer); - ASSERT_EQ(status, ResultStatus::OK) << "allocate failed for " << i << "iteration"; - - buffers.push_back(std::move(buffer)); - if (handle) { - allocHandle.push_back(std::move(handle)); - } - } - - for (int i = 0; i < kNumIterationCount; ++i) { - for (int j = i + 1; j < kNumIterationCount; ++j) { - ASSERT_TRUE(buffers[i]->mId != buffers[j]->mId) << "allocated buffers are not unique"; - } - } - // delete the buffer handles - for (auto handle : allocHandle) { - native_handle_close(handle); - native_handle_delete(handle); - } - // clear the vectors - buffers.clear(); - allocHandle.clear(); -} - -// Buffer recycle test. -// Check whether de-allocated buffers are recycled. -TEST_F(BufferpoolUnitTest, RecycleBuffer) { - std::vector vecParams; - getTestAllocatorParams(&vecParams); - - ResultStatus status; - std::vector bid{}; - std::vector allocHandle{}; - for (int i = 0; i < kNumIterationCount; ++i) { - native_handle_t* handle = nullptr; - std::shared_ptr buffer; - status = mManager->allocate(mConnectionId, vecParams, &handle, &buffer); - ASSERT_EQ(status, ResultStatus::OK) << "allocate failed for " << i << "iteration"; - - bid.push_back(buffer->mId); - if (handle) { - allocHandle.push_back(std::move(handle)); - } - buffer.reset(); - } - - std::unordered_set set(bid.begin(), bid.end()); - ASSERT_EQ(set.size(), 1) << "buffers are not recycled properly"; - - // delete the buffer handles - for (auto handle : allocHandle) { - native_handle_close(handle); - native_handle_delete(handle); - } - allocHandle.clear(); -} - -// Validate cache evict and invalidate APIs. -TEST_F(BufferpoolUnitTest, FlushTest) { - std::vector vecParams; - getTestAllocatorParams(&vecParams); - - ResultStatus status = mManager->registerSender(mManager, mConnectionId, &mReceiverId); - ASSERT_TRUE(status == ResultStatus::ALREADY_EXISTS && mReceiverId == mConnectionId); - - // testing empty flush - status = mManager->flush(mConnectionId); - ASSERT_EQ(status, ResultStatus::OK) << "failed to flush connection : " << mConnectionId; - - std::vector> senderBuffer{}; - std::vector allocHandle{}; - std::vector tid{}; - std::vector timestampUs{}; - - std::map bufferMap{}; - - for (int i = 0; i < kNumIterationCount; i++) { - int64_t postUs; - TransactionId transactionId; - native_handle_t* handle = nullptr; - std::shared_ptr buffer{}; - status = mManager->allocate(mConnectionId, vecParams, &handle, &buffer); - ASSERT_EQ(status, ResultStatus::OK) << "allocate failed for " << i << " iteration"; - - ASSERT_TRUE(TestBufferPoolAllocator::Fill(handle, i)); - - status = mManager->postSend(mReceiverId, buffer, &transactionId, &postUs); - ASSERT_EQ(status, ResultStatus::OK) << "unable to post send transaction on bufferpool"; - - timestampUs.push_back(postUs); - tid.push_back(transactionId); - bufferMap.insert({transactionId, buffer->mId}); - - senderBuffer.push_back(std::move(buffer)); - if (handle) { - allocHandle.push_back(std::move(handle)); - } - buffer.reset(); - } - - status = mManager->flush(mConnectionId); - ASSERT_EQ(status, ResultStatus::OK) << "failed to flush connection : " << mConnectionId; - - std::shared_ptr receiverBuffer{}; - native_handle_t* recvHandle = nullptr; - for (int i = 0; i < kNumIterationCount; i++) { - status = mManager->receive(mReceiverId, tid[i], senderBuffer[i]->mId, timestampUs[i], - &recvHandle, &receiverBuffer); - ASSERT_EQ(status, ResultStatus::OK) << "receive failed for buffer " << senderBuffer[i]->mId; - - // find the buffer id from transaction id - auto findIt = bufferMap.find(tid[i]); - ASSERT_NE(findIt, bufferMap.end()) << "inconsistent buffer mapping"; - - // buffer id received must be same as the buffer id sent - ASSERT_EQ(findIt->second, receiverBuffer->mId) << "invalid buffer received"; - - ASSERT_TRUE(TestBufferPoolAllocator::Verify(recvHandle, i)) - << "Message received not same as that sent"; - - bufferMap.erase(findIt); - if (recvHandle) { - native_handle_close(recvHandle); - native_handle_delete(recvHandle); - } - recvHandle = nullptr; - receiverBuffer.reset(); - } - - ASSERT_EQ(bufferMap.size(), 0) << "buffers received is less than the number of buffers sent"; - - for (auto handle : allocHandle) { - native_handle_close(handle); - native_handle_delete(handle); - } - allocHandle.clear(); - senderBuffer.clear(); - timestampUs.clear(); -} - -// Buffer transfer test between processes. -TEST_F(BufferpoolFunctionalityTest, TransferBuffer) { - // initialize the receiver - PipeMessage message; - message.data.command = PipeCommand::INIT; - sendMessage(mCommandPipeFds, message); - ASSERT_TRUE(receiveMessage(mResultPipeFds, &message)) << "receiveMessage failed\n"; - ASSERT_EQ(message.data.command, PipeCommand::INIT_OK) << "receiver init failed"; - - android::sp receiver = IClientManager::getService(); - ASSERT_NE(receiver, nullptr) << "getService failed for receiver\n"; - - ConnectionId receiverId; - ResultStatus status = mManager->registerSender(receiver, mConnectionId, &receiverId); - ASSERT_EQ(status, ResultStatus::OK) - << "registerSender failed for connection id " << mConnectionId << "\n"; - - std::vector vecParams; - getTestAllocatorParams(&vecParams); - - for (int i = 0; i < kNumIterationCount; ++i) { - native_handle_t* handle = nullptr; - std::shared_ptr buffer; - status = mManager->allocate(mConnectionId, vecParams, &handle, &buffer); - ASSERT_EQ(status, ResultStatus::OK) << "allocate failed for " << i << "iteration"; - - ASSERT_TRUE(TestBufferPoolAllocator::Fill(handle, i)) - << "Fill fail for buffer handle " << handle << "\n"; - - // send the buffer to the receiver - int64_t postUs; - TransactionId transactionId; - status = mManager->postSend(receiverId, buffer, &transactionId, &postUs); - ASSERT_EQ(status, ResultStatus::OK) - << "postSend failed for receiver " << receiverId << "\n"; - - // PipeMessage message; - message.data.command = PipeCommand::TRANSFER; - message.data.memsetValue = i; - message.data.bufferId = buffer->mId; - message.data.connectionId = receiverId; - message.data.transactionId = transactionId; - message.data.timestampUs = postUs; - sendMessage(mCommandPipeFds, message); - // delete buffer handle - if (handle) { - native_handle_close(handle); - native_handle_delete(handle); - } - ASSERT_TRUE(receiveMessage(mResultPipeFds, &message)) << "receiveMessage failed\n"; - ASSERT_EQ(message.data.command, PipeCommand::TRANSFER_OK) - << "received error during buffer transfer\n"; - } - message.data.command = PipeCommand::STOP; - sendMessage(mCommandPipeFds, message); - ASSERT_TRUE(receiveMessage(mResultPipeFds, &message)) << "receiveMessage failed\n"; - ASSERT_EQ(message.data.command, PipeCommand::STOP_OK) - << "received error during buffer transfer\n"; -} - -/* Validate bufferpool for following corner cases: - 1. invalid connectionID - 2. invalid receiver - 3. when sender is not registered - 4. when connection is closed -*/ -// TODO: Enable when the issue in b/212196495 is fixed -TEST_F(BufferpoolFunctionalityTest, DISABLED_ValidityTest) { - std::vector vecParams; - getTestAllocatorParams(&vecParams); - - std::shared_ptr senderBuffer; - native_handle_t* allocHandle = nullptr; - - // call allocate() on a random connection id - ConnectionId randomId = rand(); - ResultStatus status = mManager->allocate(randomId, vecParams, &allocHandle, &senderBuffer); - EXPECT_TRUE(status == ResultStatus::NOT_FOUND); - - // initialize the receiver - PipeMessage message; - message.data.command = PipeCommand::INIT; - sendMessage(mCommandPipeFds, message); - ASSERT_TRUE(receiveMessage(mResultPipeFds, &message)) << "receiveMessage failed\n"; - ASSERT_EQ(message.data.command, PipeCommand::INIT_OK) << "receiver init failed"; - - allocHandle = nullptr; - senderBuffer.reset(); - status = mManager->allocate(mConnectionId, vecParams, &allocHandle, &senderBuffer); - - ASSERT_TRUE(TestBufferPoolAllocator::Fill(allocHandle, 0x77)); - - // send buffers w/o registering sender - int64_t postUs; - TransactionId transactionId; - - // random receiver - status = mManager->postSend(randomId, senderBuffer, &transactionId, &postUs); - ASSERT_NE(status, ResultStatus::OK) << "bufferpool shouldn't allow send on random receiver"; - - // establish connection - android::sp receiver = IClientManager::getService(); - ASSERT_NE(receiver, nullptr) << "getService failed for receiver\n"; - - ConnectionId receiverId; - status = mManager->registerSender(receiver, mConnectionId, &receiverId); - ASSERT_EQ(status, ResultStatus::OK) - << "registerSender failed for connection id " << mConnectionId << "\n"; - - allocHandle = nullptr; - senderBuffer.reset(); - status = mManager->allocate(mConnectionId, vecParams, &allocHandle, &senderBuffer); - ASSERT_EQ(status, ResultStatus::OK) << "allocate failed for connection " << mConnectionId; - - ASSERT_TRUE(TestBufferPoolAllocator::Fill(allocHandle, 0x88)); - - // send the buffer to the receiver - status = mManager->postSend(receiverId, senderBuffer, &transactionId, &postUs); - ASSERT_EQ(status, ResultStatus::OK) << "postSend failed for receiver " << receiverId << "\n"; - - // PipeMessage message; - message.data.command = PipeCommand::TRANSFER; - message.data.memsetValue = 0x88; - message.data.bufferId = senderBuffer->mId; - message.data.connectionId = receiverId; - message.data.transactionId = transactionId; - message.data.timestampUs = postUs; - sendMessage(mCommandPipeFds, message); - ASSERT_TRUE(receiveMessage(mResultPipeFds, &message)) << "receiveMessage failed\n"; - ASSERT_EQ(message.data.command, PipeCommand::TRANSFER_OK) - << "received error during buffer transfer\n"; - - if (allocHandle) { - native_handle_close(allocHandle); - native_handle_delete(allocHandle); - } - - message.data.command = PipeCommand::STOP; - sendMessage(mCommandPipeFds, message); - ASSERT_TRUE(receiveMessage(mResultPipeFds, &message)) << "receiveMessage failed\n"; - ASSERT_EQ(message.data.command, PipeCommand::STOP_OK) - << "received error during buffer transfer\n"; - - // try to send msg to closed connection - status = mManager->postSend(receiverId, senderBuffer, &transactionId, &postUs); - ASSERT_NE(status, ResultStatus::OK) << "bufferpool shouldn't allow send on closed connection"; -} - -int main(int argc, char** argv) { - android::hardware::details::setTrebleTestingOverride(true); - ::testing::InitGoogleTest(&argc, argv); - int status = RUN_ALL_TESTS(); - ALOGV("Test result = %d\n", status); - return status; -} diff --git a/media/bufferpool/aidl/default/tests/allocator.cpp b/media/bufferpool/aidl/default/tests/allocator.cpp index 25b08ef132..16b33a6eac 100644 --- a/media/bufferpool/aidl/default/tests/allocator.cpp +++ b/media/bufferpool/aidl/default/tests/allocator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -139,7 +139,7 @@ IpcMutex *IpcMutex::Import(void *pMutex) { } -ResultStatus TestBufferPoolAllocator::allocate( +BufferPoolStatus TestBufferPoolAllocator::allocate( const std::vector ¶ms, std::shared_ptr *alloc, size_t *allocSize) { diff --git a/media/bufferpool/aidl/default/tests/allocator.h b/media/bufferpool/aidl/default/tests/allocator.h index 862d1a533a..7e7203f586 100644 --- a/media/bufferpool/aidl/default/tests/allocator.h +++ b/media/bufferpool/aidl/default/tests/allocator.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -14,17 +14,18 @@ * limitations under the License. */ -#ifndef VNDK_HIDL_BUFFERPOOL_V2_0_ALLOCATOR_H -#define VNDK_HIDL_BUFFERPOOL_V2_0_ALLOCATOR_H +#pragma once #include -#include +#include -using android::hardware::media::bufferpool::V2_0::ResultStatus; -using android::hardware::media::bufferpool::V2_0::implementation:: +using aidl::android::hardware::media::bufferpool2::implementation:: + BufferPoolStatus; +using aidl::android::hardware::media::bufferpool2::implementation:: BufferPoolAllocation; -using android::hardware::media::bufferpool::V2_0::implementation:: +using aidl::android::hardware::media::bufferpool2::implementation:: BufferPoolAllocator; +using aidl::android::hardware::media::bufferpool2::ResultStatus; struct IpcMutex { pthread_mutex_t lock; @@ -44,7 +45,7 @@ class TestBufferPoolAllocator : public BufferPoolAllocator { ~TestBufferPoolAllocator() override {} - ResultStatus allocate(const std::vector ¶ms, + BufferPoolStatus allocate(const std::vector ¶ms, std::shared_ptr *alloc, size_t *allocSize) override; @@ -60,9 +61,7 @@ class TestBufferPoolAllocator : public BufferPoolAllocator { static bool UnmapMemoryForMutex(void *mem); }; -// retrieve buffer allocator paramters +// retrieve buffer allocator parameters void getTestAllocatorParams(std::vector *params); void getIpcMutexParams(std::vector *params); - -#endif // VNDK_HIDL_BUFFERPOOL_V2_0_ALLOCATOR_H diff --git a/media/bufferpool/aidl/default/tests/cond.cpp b/media/bufferpool/aidl/default/tests/cond.cpp index 21beea8f44..6d469ce02c 100644 --- a/media/bufferpool/aidl/default/tests/cond.cpp +++ b/media/bufferpool/aidl/default/tests/cond.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -18,35 +18,36 @@ #include +#include +#include +#include #include -#include -#include +#include + #include -#include -#include -#include -#include #include #include #include #include + #include #include #include + #include "allocator.h" -using android::hardware::configureRpcThreadpool; -using android::hardware::hidl_handle; -using android::hardware::media::bufferpool::V2_0::IClientManager; -using android::hardware::media::bufferpool::V2_0::ResultStatus; -using android::hardware::media::bufferpool::V2_0::implementation::BufferId; -using android::hardware::media::bufferpool::V2_0::implementation::ClientManager; -using android::hardware::media::bufferpool::V2_0::implementation::ConnectionId; -using android::hardware::media::bufferpool::V2_0::implementation::TransactionId; -using android::hardware::media::bufferpool::BufferPoolData; +using aidl::android::hardware::media::bufferpool2::IClientManager; +using aidl::android::hardware::media::bufferpool2::ResultStatus; +using aidl::android::hardware::media::bufferpool2::implementation::BufferId; +using aidl::android::hardware::media::bufferpool2::implementation::ClientManager; +using aidl::android::hardware::media::bufferpool2::implementation::ConnectionId; +using aidl::android::hardware::media::bufferpool2::implementation::TransactionId; +using aidl::android::hardware::media::bufferpool2::BufferPoolData; namespace { +const std::string testInstance = std::string() + ClientManager::descriptor + "/condtest"; + // communication message types between processes. enum PipeCommand : int32_t { INIT_OK = 0, @@ -74,7 +75,7 @@ constexpr int kSignalInt = 200; class BufferpoolMultiTest : public ::testing::Test { public: virtual void SetUp() override { - ResultStatus status; + BufferPoolStatus status; mReceiverPid = -1; mConnectionValid = false; @@ -119,7 +120,7 @@ class BufferpoolMultiTest : public ::testing::Test { RecordProperty("description", description); } - android::sp mManager; + std::shared_ptr mManager; std::shared_ptr mAllocator; bool mConnectionValid; ConnectionId mConnectionId; @@ -138,7 +139,8 @@ class BufferpoolMultiTest : public ::testing::Test { } void doReceiver() { - configureRpcThreadpool(1, false); + ABinderProcess_setThreadPoolMaxThreadCount(1); + ABinderProcess_startThreadPool(); PipeMessage message; mManager = ClientManager::getInstance(); if (!mManager) { @@ -146,7 +148,11 @@ class BufferpoolMultiTest : public ::testing::Test { sendMessage(mResultPipeFds, message); return; } - android::status_t status = mManager->registerAsService(); + auto binder = mManager->asBinder(); + AIBinder_forceDowngradeToSystemStability(binder.get()); + binder_status_t status = + AServiceManager_addService(binder.get(), testInstance.c_str()); + CHECK_EQ(status, STATUS_OK); if (status != android::OK) { message.data.command = PipeCommand::INIT_ERROR; sendMessage(mResultPipeFds, message); @@ -162,7 +168,7 @@ class BufferpoolMultiTest : public ::testing::Test { std::shared_ptr rbuffer; void *mem = nullptr; IpcMutex *mutex = nullptr; - ResultStatus status = mManager->receive( + BufferPoolStatus status = mManager->receive( message.data.connectionId, message.data.transactionId, message.data.bufferId, message.data.timestampUs, &rhandle, &rbuffer); mManager->close(message.data.connectionId); @@ -201,16 +207,22 @@ class BufferpoolMultiTest : public ::testing::Test { // Buffer transfer test between processes. TEST_F(BufferpoolMultiTest, TransferBuffer) { - ResultStatus status; + BufferPoolStatus status; PipeMessage message; ASSERT_TRUE(receiveMessage(mResultPipeFds, &message)); + ABinderProcess_setThreadPoolMaxThreadCount(1); + ABinderProcess_startThreadPool(); - android::sp receiver = IClientManager::getService(); + + std::shared_ptr receiver = + IClientManager::fromBinder( + ndk::SpAIBinder(AServiceManager_waitForService(testInstance.c_str()))); + ASSERT_NE(receiver, nullptr); ConnectionId receiverId; - ASSERT_TRUE((bool)receiver); - status = mManager->registerSender(receiver, mConnectionId, &receiverId); + bool isNew = true; + status = mManager->registerSender(receiver, mConnectionId, &receiverId, &isNew); ASSERT_TRUE(status == ResultStatus::OK); { native_handle_t *shandle = nullptr; @@ -261,7 +273,6 @@ TEST_F(BufferpoolMultiTest, TransferBuffer) { } // anonymous namespace int main(int argc, char** argv) { - android::hardware::details::setTrebleTestingOverride(true); ::testing::InitGoogleTest(&argc, argv); int status = RUN_ALL_TESTS(); LOG(INFO) << "Test result = " << status; diff --git a/media/bufferpool/aidl/default/tests/multi.cpp b/media/bufferpool/aidl/default/tests/multi.cpp index 43b0a8c271..8806eb0a50 100644 --- a/media/bufferpool/aidl/default/tests/multi.cpp +++ b/media/bufferpool/aidl/default/tests/multi.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -18,34 +18,35 @@ #include +#include +#include +#include #include -#include -#include -#include -#include -#include -#include +#include + #include #include #include #include + #include #include #include + #include "allocator.h" -using android::hardware::configureRpcThreadpool; -using android::hardware::hidl_handle; -using android::hardware::media::bufferpool::V2_0::IClientManager; -using android::hardware::media::bufferpool::V2_0::ResultStatus; -using android::hardware::media::bufferpool::V2_0::implementation::BufferId; -using android::hardware::media::bufferpool::V2_0::implementation::ClientManager; -using android::hardware::media::bufferpool::V2_0::implementation::ConnectionId; -using android::hardware::media::bufferpool::V2_0::implementation::TransactionId; -using android::hardware::media::bufferpool::BufferPoolData; +using aidl::android::hardware::media::bufferpool2::IClientManager; +using aidl::android::hardware::media::bufferpool2::ResultStatus; +using aidl::android::hardware::media::bufferpool2::implementation::BufferId; +using aidl::android::hardware::media::bufferpool2::implementation::ClientManager; +using aidl::android::hardware::media::bufferpool2::implementation::ConnectionId; +using aidl::android::hardware::media::bufferpool2::implementation::TransactionId; +using aidl::android::hardware::media::bufferpool2::BufferPoolData; namespace { +const std::string testInstance = std::string() + ClientManager::descriptor + "/multitest"; + // communication message types between processes. enum PipeCommand : int32_t { INIT_OK = 0, @@ -71,7 +72,7 @@ union PipeMessage { class BufferpoolMultiTest : public ::testing::Test { public: virtual void SetUp() override { - ResultStatus status; + BufferPoolStatus status; mReceiverPid = -1; mConnectionValid = false; @@ -87,7 +88,6 @@ class BufferpoolMultiTest : public ::testing::Test { // tearDown pause(); } - mManager = ClientManager::getInstance(); ASSERT_NE(mManager, nullptr); @@ -116,7 +116,7 @@ class BufferpoolMultiTest : public ::testing::Test { RecordProperty("description", description); } - android::sp mManager; + std::shared_ptr mManager; std::shared_ptr mAllocator; bool mConnectionValid; ConnectionId mConnectionId; @@ -135,7 +135,8 @@ class BufferpoolMultiTest : public ::testing::Test { } void doReceiver() { - configureRpcThreadpool(1, false); + ABinderProcess_setThreadPoolMaxThreadCount(1); + ABinderProcess_startThreadPool(); PipeMessage message; mManager = ClientManager::getInstance(); if (!mManager) { @@ -143,7 +144,11 @@ class BufferpoolMultiTest : public ::testing::Test { sendMessage(mResultPipeFds, message); return; } - android::status_t status = mManager->registerAsService(); + auto binder = mManager->asBinder(); + AIBinder_forceDowngradeToSystemStability(binder.get()); + binder_status_t status = + AServiceManager_addService(binder.get(), testInstance.c_str()); + CHECK_EQ(status, STATUS_OK); if (status != android::OK) { message.data.command = PipeCommand::INIT_ERROR; sendMessage(mResultPipeFds, message); @@ -156,7 +161,7 @@ class BufferpoolMultiTest : public ::testing::Test { { native_handle_t *rhandle = nullptr; std::shared_ptr rbuffer; - ResultStatus status = mManager->receive( + BufferPoolStatus status = mManager->receive( message.data.connectionId, message.data.transactionId, message.data.bufferId, message.data.timestampUs, &rhandle, &rbuffer); mManager->close(message.data.connectionId); @@ -182,16 +187,20 @@ class BufferpoolMultiTest : public ::testing::Test { // Buffer transfer test between processes. TEST_F(BufferpoolMultiTest, TransferBuffer) { - ResultStatus status; + BufferPoolStatus status; PipeMessage message; ASSERT_TRUE(receiveMessage(mResultPipeFds, &message)); + ABinderProcess_setThreadPoolMaxThreadCount(1); + ABinderProcess_startThreadPool(); - android::sp receiver = IClientManager::getService(); + std::shared_ptr receiver = IClientManager::fromBinder(ndk::SpAIBinder( + AServiceManager_waitForService(testInstance.c_str()))); + ASSERT_NE(receiver, nullptr); ConnectionId receiverId; - ASSERT_TRUE((bool)receiver); - status = mManager->registerSender(receiver, mConnectionId, &receiverId); + bool isNew = true; + status = mManager->registerSender(receiver, mConnectionId, &receiverId, &isNew); ASSERT_TRUE(status == ResultStatus::OK); { native_handle_t *shandle = nullptr; @@ -227,7 +236,6 @@ TEST_F(BufferpoolMultiTest, TransferBuffer) { } // anonymous namespace int main(int argc, char** argv) { - android::hardware::details::setTrebleTestingOverride(true); ::testing::InitGoogleTest(&argc, argv); int status = RUN_ALL_TESTS(); LOG(INFO) << "Test result = " << status; diff --git a/media/bufferpool/aidl/default/tests/single.cpp b/media/bufferpool/aidl/default/tests/single.cpp index 1e9027b0c0..66aa5e931c 100644 --- a/media/bufferpool/aidl/default/tests/single.cpp +++ b/media/bufferpool/aidl/default/tests/single.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -20,24 +20,19 @@ #include #include -#include -#include -#include -#include -#include +#include #include #include #include #include #include "allocator.h" -using android::hardware::hidl_handle; -using android::hardware::media::bufferpool::V2_0::ResultStatus; -using android::hardware::media::bufferpool::V2_0::implementation::BufferId; -using android::hardware::media::bufferpool::V2_0::implementation::ClientManager; -using android::hardware::media::bufferpool::V2_0::implementation::ConnectionId; -using android::hardware::media::bufferpool::V2_0::implementation::TransactionId; -using android::hardware::media::bufferpool::BufferPoolData; +using aidl::android::hardware::media::bufferpool2::implementation::BufferId; +using aidl::android::hardware::media::bufferpool2::implementation::BufferPoolStatus; +using aidl::android::hardware::media::bufferpool2::implementation::ClientManager; +using aidl::android::hardware::media::bufferpool2::implementation::ConnectionId; +using aidl::android::hardware::media::bufferpool2::implementation::TransactionId; +using aidl::android::hardware::media::bufferpool2::BufferPoolData; namespace { @@ -51,7 +46,7 @@ constexpr static int kNumRecycleTest = 3; class BufferpoolSingleTest : public ::testing::Test { public: virtual void SetUp() override { - ResultStatus status; + BufferPoolStatus status; mConnectionValid = false; mManager = ClientManager::getInstance(); @@ -65,8 +60,9 @@ class BufferpoolSingleTest : public ::testing::Test { mConnectionValid = true; - status = mManager->registerSender(mManager, mConnectionId, &mReceiverId); - ASSERT_TRUE(status == ResultStatus::ALREADY_EXISTS && + bool isNew = true; + status = mManager->registerSender(mManager, mConnectionId, &mReceiverId, &isNew); + ASSERT_TRUE(status == ResultStatus::OK && isNew == false && mReceiverId == mConnectionId); } @@ -81,7 +77,7 @@ class BufferpoolSingleTest : public ::testing::Test { RecordProperty("description", description); } - android::sp mManager; + std::shared_ptr mManager; std::shared_ptr mAllocator; bool mConnectionValid; ConnectionId mConnectionId; @@ -93,7 +89,7 @@ class BufferpoolSingleTest : public ::testing::Test { // Check whether each buffer allocation is done successfully with // unique buffer id. TEST_F(BufferpoolSingleTest, AllocateBuffer) { - ResultStatus status; + BufferPoolStatus status; std::vector vecParams; getTestAllocatorParams(&vecParams); @@ -118,7 +114,7 @@ TEST_F(BufferpoolSingleTest, AllocateBuffer) { // Buffer recycle test. // Check whether de-allocated buffers are recycled. TEST_F(BufferpoolSingleTest, RecycleBuffer) { - ResultStatus status; + BufferPoolStatus status; std::vector vecParams; getTestAllocatorParams(&vecParams); @@ -143,7 +139,7 @@ TEST_F(BufferpoolSingleTest, RecycleBuffer) { // Buffer transfer test. // Check whether buffer is transferred to another client successfully. TEST_F(BufferpoolSingleTest, TransferBuffer) { - ResultStatus status; + BufferPoolStatus status; std::vector vecParams; getTestAllocatorParams(&vecParams); std::shared_ptr sbuffer, rbuffer; @@ -151,14 +147,14 @@ TEST_F(BufferpoolSingleTest, TransferBuffer) { native_handle_t *recvHandle = nullptr; TransactionId transactionId; - int64_t postUs; + int64_t postMs; status = mManager->allocate(mConnectionId, vecParams, &allocHandle, &sbuffer); ASSERT_TRUE(status == ResultStatus::OK); ASSERT_TRUE(TestBufferPoolAllocator::Fill(allocHandle, 0x77)); - status = mManager->postSend(mReceiverId, sbuffer, &transactionId, &postUs); + status = mManager->postSend(mReceiverId, sbuffer, &transactionId, &postMs); ASSERT_TRUE(status == ResultStatus::OK); - status = mManager->receive(mReceiverId, transactionId, sbuffer->mId, postUs, + status = mManager->receive(mReceiverId, transactionId, sbuffer->mId, postMs, &recvHandle, &rbuffer); EXPECT_TRUE(status == ResultStatus::OK); ASSERT_TRUE(TestBufferPoolAllocator::Verify(recvHandle, 0x77)); From bfeecf3e480c0056c4ddb540c68bcbba29454d16 Mon Sep 17 00:00:00 2001 From: Sungtak Lee Date: Sat, 10 Dec 2022 09:44:04 +0000 Subject: [PATCH 520/998] Support mainline s/w codec Bug: 254050250 Change-Id: Id160730a334bf09b91115ada2706c89e6b80192a --- common/fmq/aidl/Android.bp | 1 + 1 file changed, 1 insertion(+) diff --git a/common/fmq/aidl/Android.bp b/common/fmq/aidl/Android.bp index 0715575c33..058ddb5f6b 100644 --- a/common/fmq/aidl/Android.bp +++ b/common/fmq/aidl/Android.bp @@ -33,6 +33,7 @@ aidl_interface { apex_available: [ "//apex_available:platform", "com.android.btservices", + "com.android.media.swcodec", ], min_sdk_version: "29", }, From 0d1929162f232a4f63a276dd4a391e384f58080a Mon Sep 17 00:00:00 2001 From: Nathan Kulczak Date: Mon, 31 Oct 2022 15:13:13 +0000 Subject: [PATCH 521/998] vibrator/vts: Update tests for short durations Add minimum wait time for effect completion. Effects with short durations were not completing in time with current wait time estimation. Bug: 240946208 Test: Ran updated tests Change-Id: I40f65244c3478fb2f0a3b84c3991313ad5e28cd9 Signed-off-by: Nathan Kulczak --- vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp b/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp index f50a5e744f..c88cb594f9 100644 --- a/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp +++ b/vibrator/aidl/vts/VtsHalVibratorTargetTest.cpp @@ -602,10 +602,11 @@ TEST_P(VibratorAidl, ComposeCallback) { EXPECT_EQ(Status::EX_NONE, vibrator->compose(composite, callback).exceptionCode()) << toString(primitive); - //TODO(b/187207798): revert back to conservative timeout values once - //latencies have been fixed - EXPECT_EQ(completionFuture.wait_for(duration * 4), std::future_status::ready) - << toString(primitive); + // TODO(b/261130361): Investigate why latency from driver and hardware will cause test + // to fail when wait duration is ~40ms or less. + EXPECT_EQ(completionFuture.wait_for(duration + std::chrono::milliseconds(50)), + std::future_status::ready) + << toString(primitive); end = high_resolution_clock::now(); elapsed = std::chrono::duration_cast(end - start); From 603670e63175b335e86fc0f0b78c0e1d1eafae74 Mon Sep 17 00:00:00 2001 From: Yomna Nasser Date: Tue, 20 Dec 2022 00:18:04 +0000 Subject: [PATCH 522/998] Update setNullCipherAndIntegrityEnabled doc Specify behavior for 2G vs 3G and above. Bug: 237529943 Test: n/a Change-Id: I79663e074799290b42a42431df4cdedf3bf3830a --- .../hardware/radio/network/IRadioNetwork.aidl | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl index 38772cd590..86b6eca603 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl @@ -487,15 +487,21 @@ oneway interface IRadioNetwork { /** * Set if null encryption and integrity modes are enabled. If the value of enabled is false - * the modem must not allow any network communications with null ciphering or null integrity - * modes. + * the modem must not allow any network communications with null ciphering (for both signalling + * and user data) or null integrity (for signalling) modes for 3G and above, even if the + * network only uses null algorithms. This setting must be respected even if + * "cipheringDisabled" (as defined in TS 38.331) is in use by the network. + * + * For 2G, which does not use integrity protection, the modem must only disallow any network + * communications with null ciphering. * * In the case when enabled is false, integrity protection for user data is optional, but - * ciphering for user data is required. In case of an emergency call, the modem must bypass - * this setting. + * ciphering for user data is required. + * + * In case of an emergency call, the modem must bypass this setting. * * Null ciphering and integrity modes include (but are not limited to): - * 2G: A5/0 + * 2G: A5/0 and GEA0 * 3G: UEA0 and UIA0 * 4G: EEA0 and EIA0 * 5G: NEA0 and NIA0 From 93e97f94b67e6ab9e994fc642ad204cd670d9a71 Mon Sep 17 00:00:00 2001 From: Jeff Pu Date: Tue, 20 Dec 2022 21:02:57 +0000 Subject: [PATCH 523/998] Make virtual fingerprint Hal as a lazy Hal so that the Hal service can start dynamically as needed by vts test and others Bug: 262630839 Test: atest VtsHalBiometricsFingerprintTargetTest:IFingerprint/Fingerprint Change-Id: I58dfa3b49bade3bbd89c3a8f6cd884c632e9eae4 --- biometrics/fingerprint/aidl/default/fingerprint-example.rc | 7 +++---- biometrics/fingerprint/aidl/default/main.cpp | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/biometrics/fingerprint/aidl/default/fingerprint-example.rc b/biometrics/fingerprint/aidl/default/fingerprint-example.rc index 10db00d0f5..80985e84b6 100644 --- a/biometrics/fingerprint/aidl/default/fingerprint-example.rc +++ b/biometrics/fingerprint/aidl/default/fingerprint-example.rc @@ -2,8 +2,7 @@ service vendor.fingerprint-example /vendor/bin/hw/android.hardware.biometrics.fi class hal user nobody group nobody + interface aidl android.hardware.biometrics.fingerprint.IFingerprint/virtual + oneshot disabled -on property:ro.vendor.fingerprint_virtual_hal_start=true - enable vendor.fingerprint-example -on property:persist.vendor.fingerprint.virtual.type=* - enable vendor.fingerprint-example + diff --git a/biometrics/fingerprint/aidl/default/main.cpp b/biometrics/fingerprint/aidl/default/main.cpp index 0e672b10ab..11bce15be9 100644 --- a/biometrics/fingerprint/aidl/default/main.cpp +++ b/biometrics/fingerprint/aidl/default/main.cpp @@ -28,7 +28,8 @@ int main() { std::shared_ptr hal = ndk::SharedRefBase::make(); const std::string instance = std::string(Fingerprint::descriptor) + "/virtual"; - binder_status_t status = AServiceManager_addService(hal->asBinder().get(), instance.c_str()); + binder_status_t status = + AServiceManager_registerLazyService(hal->asBinder().get(), instance.c_str()); CHECK_EQ(status, STATUS_OK); ABinderProcess_joinThreadPool(); From 9c941fbba86abece7958e0bf1a1b3f0a8d9048d9 Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Tue, 20 Dec 2022 22:57:32 +0000 Subject: [PATCH 524/998] Wifi: check TLSV1.3 support in TLS test Added the check for TLSV1.3 feature support in SetMinimumTlsVersionEapPhase1Param test Bug: 261922145 Test: atest SupplicantStaNetworkAidlTest Change-Id: I26e7796d4d83e72e0098d5aa6ee520824bda23b1 --- .../functional/supplicant_sta_network_aidl_test.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp index 0aebe6d716..0e2b72c285 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp +++ b/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp @@ -806,7 +806,15 @@ TEST_P(SupplicantStaNetworkAidlTest, SetRoamingConsortiumSelection) { * SetMinimumTlsVersionEapPhase1Param */ TEST_P(SupplicantStaNetworkAidlTest, SetMinimumTlsVersionEapPhase1Param) { - EXPECT_TRUE(sta_network_->setMinimumTlsVersionEapPhase1Param(TlsVersion::TLS_V1_3).isOk()); + WpaDriverCapabilitiesMask caps; + EXPECT_TRUE(sta_iface_->getWpaDriverCapabilities(&caps).isOk()); + const bool tlsV13Supported = !!(static_cast(caps) & + static_cast(WpaDriverCapabilitiesMask::TLS_V1_3)); + LOG(INFO) << "TLS_V1_3 Supported: " << tlsV13Supported; + + // Operation will succeed if TLS_V1_3 is supported, or fail otherwise. + EXPECT_EQ(sta_network_->setMinimumTlsVersionEapPhase1Param(TlsVersion::TLS_V1_3).isOk(), + tlsV13Supported); } GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SupplicantStaNetworkAidlTest); From f8b5cf02bcdb8a8dbbbf72846d294e901dc703ff Mon Sep 17 00:00:00 2001 From: Yu-Han Yang Date: Wed, 21 Dec 2022 03:23:51 +0000 Subject: [PATCH 525/998] GNSS AIDL Version 2 is also allowed in Android U Bug: 253319784 Test: atest VtsHalGnssTargetTest Change-Id: I666260d7ed2cc0eb385e1badd2b952d7c6f538f6 --- compatibility_matrices/compatibility_matrix.current.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index a907f206de..96b8c5bea7 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -260,7 +260,7 @@ android.hardware.gnss - 3 + 2-3 IGnss default From ede24f77e6d71bd62d4c0ae124d58df5789a6345 Mon Sep 17 00:00:00 2001 From: Terry Guan Date: Tue, 8 Nov 2022 10:52:58 -0800 Subject: [PATCH 526/998] Update version for audiocontrol Bug: 255369346 Test: atest vts_treble_vintf_vendor_test Change-Id: I17000be75963e511d2a56583be0f619a3dee66f1 --- automotive/audiocontrol/aidl/default/audiocontrol-default.xml | 1 + compatibility_matrices/compatibility_matrix.current.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/automotive/audiocontrol/aidl/default/audiocontrol-default.xml b/automotive/audiocontrol/aidl/default/audiocontrol-default.xml index e82f6fada9..3452ae93d9 100644 --- a/automotive/audiocontrol/aidl/default/audiocontrol-default.xml +++ b/automotive/audiocontrol/aidl/default/audiocontrol-default.xml @@ -1,5 +1,6 @@ + 2 android.hardware.automotive.audiocontrol IAudioControl/default diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index b2433e9559..dcc5b11a92 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -78,6 +78,7 @@ android.hardware.automotive.audiocontrol + 2 IAudioControl default From f77f97462b31dd620fceca9f1b5d645c1376eb6e Mon Sep 17 00:00:00 2001 From: shrikar Date: Wed, 21 Dec 2022 19:43:44 +0000 Subject: [PATCH 527/998] Fixed DefaultProperties.json formatting to avoid repohook failure. Bug: 261481870 Test: Repohook Change-Id: Id45469a70605e0239dbeccd3c7346d3b733a3ed1 --- .../aidl/impl/default_config/config/DefaultProperties.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 0b1634ce4d..c17a2e2aba 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1976,7 +1976,8 @@ "maxFloatValue": 28.0 } ], - "comment": "minFloatValue and maxFloatValue in area config should match corresponding values in configArray", + "comment": + "minFloatValue and maxFloatValue in area config should match corresponding values in configArray", "configArray": [ 160, 280, From 504d85988d8a3387d4186972108fe20b374968b9 Mon Sep 17 00:00:00 2001 From: Atneya Nair Date: Thu, 15 Dec 2022 09:12:13 -0800 Subject: [PATCH 528/998] Add hotword flags to audio input flags Keep de-serializer in sync with new input flags. Test: Compiles Bug: 237449755 Change-Id: I74c4cba6b02348b0bed2cf8ef88148e8c0d49865 --- audio/aidl/default/config/audioPolicy/api/current.txt | 2 ++ .../default/config/audioPolicy/audio_policy_configuration.xsd | 2 ++ 2 files changed, 4 insertions(+) diff --git a/audio/aidl/default/config/audioPolicy/api/current.txt b/audio/aidl/default/config/audioPolicy/api/current.txt index ad79a0c83a..fabb93b48e 100644 --- a/audio/aidl/default/config/audioPolicy/api/current.txt +++ b/audio/aidl/default/config/audioPolicy/api/current.txt @@ -274,8 +274,10 @@ package android.audio.policy.configuration { method @NonNull public String getRawName(); enum_constant public static final android.audio.policy.configuration.AudioInOutFlag AUDIO_INPUT_FLAG_DIRECT; enum_constant public static final android.audio.policy.configuration.AudioInOutFlag AUDIO_INPUT_FLAG_FAST; + enum_constant public static final android.audio.policy.configuration.AudioInOutFlag AUDIO_INPUT_FLAG_HOTWORD_TAP; enum_constant public static final android.audio.policy.configuration.AudioInOutFlag AUDIO_INPUT_FLAG_HW_AV_SYNC; enum_constant public static final android.audio.policy.configuration.AudioInOutFlag AUDIO_INPUT_FLAG_HW_HOTWORD; + enum_constant public static final android.audio.policy.configuration.AudioInOutFlag AUDIO_INPUT_FLAG_HW_LOOKBACK; enum_constant public static final android.audio.policy.configuration.AudioInOutFlag AUDIO_INPUT_FLAG_MMAP_NOIRQ; enum_constant public static final android.audio.policy.configuration.AudioInOutFlag AUDIO_INPUT_FLAG_RAW; enum_constant public static final android.audio.policy.configuration.AudioInOutFlag AUDIO_INPUT_FLAG_SYNC; diff --git a/audio/aidl/default/config/audioPolicy/audio_policy_configuration.xsd b/audio/aidl/default/config/audioPolicy/audio_policy_configuration.xsd index 301c969062..d57790aab4 100644 --- a/audio/aidl/default/config/audioPolicy/audio_policy_configuration.xsd +++ b/audio/aidl/default/config/audioPolicy/audio_policy_configuration.xsd @@ -191,6 +191,8 @@ + + From 9c69ed1697757998693d136357dc3e69c9d1a10b Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 21 Dec 2022 13:59:17 -0800 Subject: [PATCH 529/998] Update doc for subscribing unavailable props. Test: None Bug: 258513729 Change-Id: I31f0a9490d3462bcc1266d14b4b3b893ce1d03a0 --- .../hardware/automotive/vehicle/IVehicle.aidl | 8 ++++++++ .../automotive/vehicle/StatusCode.aidl | 19 ++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/IVehicle.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/IVehicle.aidl index 47fc54b8dc..c896d143a7 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/IVehicle.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/IVehicle.aidl @@ -190,6 +190,14 @@ interface IVehicle { * what the sampleRate specified in {@code options}, the timestamp for * the timestamp is updated 10 times/s. * + * If a property is unavailable for reading because it depends on some power + * state which is off, property change event may not be generated until the + * property becomes available. For ON_CHANGE property, if the property + * changes from NOT_AVAILABLE to OKAY for reading some or all area(s), for + * each area that becomes available for reading, one property change event + * must be generated. The event must contain the current value for the area + * and must have {@code AVAILABLE} status. + * * @param callback The subscription callbacks. * {@link IVehicleCallback#onPropertyEvent} would be called when a new * property event arrives. diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/StatusCode.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/StatusCode.aidl index 23019cada8..35080dbebd 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/StatusCode.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/StatusCode.aidl @@ -24,7 +24,11 @@ package android.hardware.automotive.vehicle; enum StatusCode { OK = 0, /** - * Try again. + * Caller should try again. + * + * This code must be returned when an ephemeral error happens and a retry + * will likely succeed. E.g., when the device is currently booting up + * and the property is not ready yet. */ TRY_AGAIN = 1, /** @@ -32,9 +36,22 @@ enum StatusCode { */ INVALID_ARG = 2, /** + * The property is currently unavailable and will be unavailable unless + * some other state changes. + * * This code must be returned when device that associated with the vehicle * property is not available. For example, when client tries to set HVAC * temperature when the whole HVAC unit is turned OFF. + * + * The difference between this and TRY_AGAIN is that if NOT_AVAILABLE is + * returned for a property, it will remain NOT_AVAILABLE unless some other + * state changes. This means a retry will likely still return NOT_AVAILABLE. + * However, for TRY_AGAIN error, a retry will likely return OK. + * + * When subscribing to a property that is currently unavailable for getting. + * VHAL must return OK even if getting/setting must return NOT_AVAILABLE. + * VHAL must not generate property change event when the property is not + * available for getting. */ NOT_AVAILABLE = 3, /** From 0d4207d97ab73bb2a1d193ad08489370705abbfb Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Fri, 9 Dec 2022 00:37:44 +0000 Subject: [PATCH 530/998] Improve DAB support in broadcast radio AIDL HAL SID in DAB_SID_EXT was extended to 32-bit to support DMB radio. The documatation for DAB program selector and program info was updated to make a DAB station is uniquely specified. AIDL HAL definition requirement for identifier, program selector and info was enforced in the AIDL utils class. The default implementation and VTS were also updated correspondingly. Bug: 261912181 Test: atest VtsHalBroadcastradioAidlTargetTest Change-Id: Ic420955340f0c77370106e736410d7125536e62d --- .../broadcastradio/IdentifierType.aidl | 5 +- .../hardware/broadcastradio/ProgramInfo.aidl | 2 +- .../broadcastradio/ProgramSelector.aidl | 3 +- .../aidl/default/BroadcastRadio.cpp | 18 ++++--- .../aidl/default/VirtualProgram.cpp | 2 +- broadcastradio/aidl/default/VirtualRadio.cpp | 32 +++++++----- .../VtsHalBroadcastradioAidlTargetTest.cpp | 52 ++++++++++++++++--- broadcastradio/common/utilsaidl/Utils.cpp | 48 +++++++++++------ .../include/broadcastradio-utils-aidl/Utils.h | 2 +- 9 files changed, 117 insertions(+), 47 deletions(-) diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl index 0484d02a9e..646c502660 100644 --- a/broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl +++ b/broadcastradio/aidl/android/hardware/broadcastradio/IdentifierType.aidl @@ -110,10 +110,11 @@ enum IdentifierType { HD_STATION_NAME, /** - * 28bit compound primary identifier for Digital Audio Broadcasting. + * 44bit compound primary identifier for Digital Audio Broadcasting and + * Digital Multimeida Broadcasting. * * Consists of (from the LSB): - * - 16bit: SId; + * - 32bit: SId; * - 8bit: ECC code; * - 4bit: SCIdS. * diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl index 3e2c9cca7d..d6502394ec 100644 --- a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl +++ b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl @@ -120,7 +120,7 @@ parcelable ProgramInfo { * * Only physical identifiers are valid: * - AMFM_FREQUENCY_KHZ; - * - DAB_ENSEMBLE; + * - DAB_FREQUENCY_KHZ; * - DRMO_FREQUENCY_KHZ; * - SXM_CHANNEL; * - VENDOR_*; diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramSelector.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramSelector.aidl index 8bd3fd41e4..93b0e12674 100644 --- a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramSelector.aidl +++ b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramSelector.aidl @@ -51,7 +51,8 @@ parcelable ProgramSelector { * - analogue AM/FM: AMFM_FREQUENCY_KHZ; * - FM RDS: RDS_PI; * - HD Radio: HD_STATION_ID_EXT; - * - DAB: DAB_SID_EXT; + * - DAB/DMB: DAB_SID_EXT (when used, DAB_ENSEMBLE and DAB_FREQUENCY_KHZ + * must present in secondaryIds); * - Digital Radio Mondiale: DRMO_SERVICE_ID; * - SiriusXM: SXM_SERVICE_ID; * - vendor-specific: VENDOR_START..VENDOR_END. diff --git a/broadcastradio/aidl/default/BroadcastRadio.cpp b/broadcastradio/aidl/default/BroadcastRadio.cpp index 42e550e75a..36520fb387 100644 --- a/broadcastradio/aidl/default/BroadcastRadio.cpp +++ b/broadcastradio/aidl/default/BroadcastRadio.cpp @@ -589,22 +589,28 @@ binder_status_t BroadcastRadio::cmdTune(int fd, const char** args, uint32_t numA } ProgramSelector sel = {}; if (isDab) { - if (numArgs != 4) { + if (numArgs != 5) { dprintf(fd, - "Invalid number of arguments: please provide --tune dab \n"); + "Invalid number of arguments: please provide " + "--tune dab \n"); return STATUS_BAD_VALUE; } int sid; if (!utils::parseArgInt(string(args[2]), &sid)) { - dprintf(fd, "Non-integer sid provided with tune: %s\n", string(args[2]).c_str()); + dprintf(fd, "Non-integer sid provided with tune: %s\n", args[2]); return STATUS_BAD_VALUE; } int ensemble; if (!utils::parseArgInt(string(args[3]), &ensemble)) { - dprintf(fd, "Non-integer ensemble provided with tune: %s\n", string(args[3]).c_str()); + dprintf(fd, "Non-integer ensemble provided with tune: %s\n", args[3]); return STATUS_BAD_VALUE; } - sel = utils::makeSelectorDab(sid, ensemble); + int freq; + if (!utils::parseArgInt(string(args[4]), &freq)) { + dprintf(fd, "Non-integer frequency provided with tune: %s\n", args[4]); + return STATUS_BAD_VALUE; + } + sel = utils::makeSelectorDab(sid, ensemble, freq); } else { if (numArgs != 3) { dprintf(fd, "Invalid number of arguments: please provide --tune amfm \n"); @@ -612,7 +618,7 @@ binder_status_t BroadcastRadio::cmdTune(int fd, const char** args, uint32_t numA } int freq; if (!utils::parseArgInt(string(args[2]), &freq)) { - dprintf(fd, "Non-integer frequency provided with tune: %s\n", string(args[2]).c_str()); + dprintf(fd, "Non-integer frequency provided with tune: %s\n", args[2]); return STATUS_BAD_VALUE; } sel = utils::makeSelectorAmfm(freq); diff --git a/broadcastradio/aidl/default/VirtualProgram.cpp b/broadcastradio/aidl/default/VirtualProgram.cpp index 0df0a82fa4..4fe6567d17 100644 --- a/broadcastradio/aidl/default/VirtualProgram.cpp +++ b/broadcastradio/aidl/default/VirtualProgram.cpp @@ -53,7 +53,7 @@ VirtualProgram::operator ProgramInfo() const { break; case IdentifierType::DAB_SID_EXT: info.logicallyTunedTo = selectId(IdentifierType::DAB_SID_EXT); - info.physicallyTunedTo = selectId(IdentifierType::DAB_ENSEMBLE); + info.physicallyTunedTo = selectId(IdentifierType::DAB_FREQUENCY_KHZ); break; case IdentifierType::DRMO_SERVICE_ID: info.logicallyTunedTo = selectId(IdentifierType::DRMO_SERVICE_ID); diff --git a/broadcastradio/aidl/default/VirtualRadio.cpp b/broadcastradio/aidl/default/VirtualRadio.cpp index 851543b0aa..126bcff621 100644 --- a/broadcastradio/aidl/default/VirtualRadio.cpp +++ b/broadcastradio/aidl/default/VirtualRadio.cpp @@ -53,15 +53,18 @@ const VirtualRadio& VirtualRadio::getAmFmRadio() { static VirtualRadio amFmRadioMock( "AM/FM radio mock", { - {makeSelectorAmfm(94900), "Wild 94.9", "Drake ft. Rihanna", "Too Good"}, - {makeSelectorAmfm(96500), "KOIT", "Celine Dion", "All By Myself"}, - {makeSelectorAmfm(97300), "Alice@97.3", "Drops of Jupiter", "Train"}, - {makeSelectorAmfm(99700), "99.7 Now!", "The Chainsmokers", "Closer"}, - {makeSelectorAmfm(101300), "101-3 KISS-FM", "Justin Timberlake", "Rock Your Body"}, - {makeSelectorAmfm(103700), "iHeart80s @ 103.7", "Michael Jackson", "Billie Jean"}, - {makeSelectorAmfm(106100), "106 KMEL", "Drake", "Marvins Room"}, - {makeSelectorAmfm(700), "700 AM", "Artist700", "Title700"}, - {makeSelectorAmfm(1700), "1700 AM", "Artist1700", "Title1700"}, + {makeSelectorAmfm(/* frequency= */ 94900), "Wild 94.9", "Drake ft. Rihanna", + "Too Good"}, + {makeSelectorAmfm(/* frequency= */ 96500), "KOIT", "Celine Dion", "All By Myself"}, + {makeSelectorAmfm(/* frequency= */ 97300), "Alice@97.3", "Drops of Jupiter", "Train"}, + {makeSelectorAmfm(/* frequency= */ 99700), "99.7 Now!", "The Chainsmokers", "Closer"}, + {makeSelectorAmfm(/* frequency= */ 101300), "101-3 KISS-FM", "Justin Timberlake", + "Rock Your Body"}, + {makeSelectorAmfm(/* frequency= */ 103700), "iHeart80s @ 103.7", "Michael Jackson", + "Billie Jean"}, + {makeSelectorAmfm(/* frequency= */ 106100), "106 KMEL", "Drake", "Marvins Room"}, + {makeSelectorAmfm(/* frequency= */ 700), "700 AM", "Artist700", "Title700"}, + {makeSelectorAmfm(/* frequency= */ 1700), "1700 AM", "Artist1700", "Title1700"}, }); // clang-format on return amFmRadioMock; @@ -73,9 +76,14 @@ const VirtualRadio& VirtualRadio::getDabRadio() { static VirtualRadio dabRadioMock( "DAB radio mock", { - {makeSelectorDab(0xA00001u, 0x0001u), "BBC Radio 1", "Khalid", "Talk"}, - {makeSelectorDab(0xB00001u, 0x1001u), "Classic FM", "Jean Sibelius", "Andante Festivo"}, - {makeSelectorDab(0xB00002u, 0x1001u), "Absolute Radio", "Coldplay", "Clocks"}, + {makeSelectorDab(/* sidExt= */ 0xA000000001u, /* ensemble= */ 0x0001u, + /* freq= */ 225648), "BBC Radio 1", "Khalid", "Talk"}, + {makeSelectorDab(/* sidExt= */ 0xB000000001u, /* ensemble= */ 0x1001u, + /* freq= */ 222064), "Classic FM", "Jean Sibelius", "Andante Festivo"}, + {makeSelectorDab(/* sidExt= */ 0xB000000002u, /* ensemble= */ 0x1002u, + /* freq= */ 227360), "Absolute Radio", "Coldplay", "Clocks"}, + {makeSelectorDab(/* sidExt= */ 0xB000000002u, /* ensemble= */ 0x1002u, + /* freq= */ 222064), "Absolute Radio", "Coldplay", "Clocks"}, }); // clang-format on return dabRadioMock; diff --git a/broadcastradio/aidl/vts/src/VtsHalBroadcastradioAidlTargetTest.cpp b/broadcastradio/aidl/vts/src/VtsHalBroadcastradioAidlTargetTest.cpp index 5a568464ec..356673f715 100644 --- a/broadcastradio/aidl/vts/src/VtsHalBroadcastradioAidlTargetTest.cpp +++ b/broadcastradio/aidl/vts/src/VtsHalBroadcastradioAidlTargetTest.cpp @@ -46,6 +46,7 @@ namespace { using ::aidl::android::hardware::broadcastradio::utils::makeIdentifier; using ::aidl::android::hardware::broadcastradio::utils::makeSelectorAmfm; +using ::aidl::android::hardware::broadcastradio::utils::makeSelectorDab; using ::aidl::android::hardware::broadcastradio::utils::resultToInt; using ::ndk::ScopedAStatus; using ::ndk::SharedRefBase; @@ -110,8 +111,7 @@ bool supportsFM(const AmFmRegionConfig& config) { class TunerCallbackMock : public BnTunerCallback { public: TunerCallbackMock(); - - MOCK_METHOD2(onTuneFailed, ScopedAStatus(Result, const ProgramSelector&)); + ScopedAStatus onTuneFailed(Result result, const ProgramSelector& selector) override; MOCK_TIMEOUT_METHOD1(onCurrentProgramInfoChangedMock, ScopedAStatus(const ProgramInfo&)); ScopedAStatus onCurrentProgramInfoChanged(const ProgramInfo& info) override; ScopedAStatus onProgramListUpdated(const ProgramListChunk& chunk) override; @@ -154,6 +154,12 @@ TunerCallbackMock::TunerCallbackMock() { EXPECT_CALL(*this, onAntennaStateChange(false)).Times(0); } +ScopedAStatus TunerCallbackMock::onTuneFailed(Result result, const ProgramSelector& selector) { + LOG(DEBUG) << "Tune failed for selector" << selector.toString(); + EXPECT_TRUE(result == Result::CANCELED); + return ndk::ScopedAStatus::ok(); +} + ScopedAStatus TunerCallbackMock::onCurrentProgramInfoChanged(const ProgramInfo& info) { for (const auto& id : info.selector) { EXPECT_NE(id.type, IdentifierType::INVALID); @@ -175,7 +181,7 @@ ScopedAStatus TunerCallbackMock::onCurrentProgramInfoChanged(const ProgramInfo& IdentifierType physically = info.physicallyTunedTo.type; // ditto (see "logically" above) EXPECT_TRUE(physically == IdentifierType::AMFM_FREQUENCY_KHZ || - physically == IdentifierType::DAB_ENSEMBLE || + physically == IdentifierType::DAB_FREQUENCY_KHZ || physically == IdentifierType::DRMO_FREQUENCY_KHZ || physically == IdentifierType::SXM_CHANNEL || (physically >= IdentifierType::VENDOR_START && @@ -593,10 +599,43 @@ TEST_P(BroadcastRadioHalTest, DabTune) { ASSERT_TRUE(halResult.isOk()); ASSERT_NE(config.size(), 0U); - // TODO(245787803): use a DAB frequency that can actually be tuned to. + auto programList = getProgramList(); + + if (!programList) { + printSkipped("Empty DAB station list, tune cannot be performed"); + return; + } + ProgramSelector sel = {}; - int64_t freq = config[config.size() / 2].frequencyKhz; - sel.primaryId = makeIdentifier(IdentifierType::DAB_FREQUENCY_KHZ, freq); + uint64_t freq = 0; + bool dabStationPresent = false; + for (auto&& programInfo : *programList) { + if (!utils::hasId(programInfo.selector, IdentifierType::DAB_FREQUENCY_KHZ)) { + continue; + } + for (auto&& config_entry : config) { + if (config_entry.frequencyKhz == + utils::getId(programInfo.selector, IdentifierType::DAB_FREQUENCY_KHZ, 0)) { + freq = config_entry.frequencyKhz; + break; + } + } + // Do not trigger a tune request if the programList entry does not contain + // a valid DAB frequency. + if (freq == 0) { + continue; + } + int64_t dabSidExt = utils::getId(programInfo.selector, IdentifierType::DAB_SID_EXT, 0); + int64_t dabEns = utils::getId(programInfo.selector, IdentifierType::DAB_ENSEMBLE, 0); + sel = makeSelectorDab(dabSidExt, (int32_t)dabEns, freq); + dabStationPresent = true; + break; + } + + if (!dabStationPresent) { + printSkipped("No DAB stations in the list, tune cannot be performed"); + return; + } // try tuning ProgramInfo infoCb = {}; @@ -623,7 +662,6 @@ TEST_P(BroadcastRadioHalTest, DabTune) { vector freqs = bcutils::getAllIds(infoCb.selector, IdentifierType::DAB_FREQUENCY_KHZ); EXPECT_NE(freqs.end(), find(freqs.begin(), freqs.end(), freq)) << "DAB freq " << freq << " kHz is not sent back by callback."; - ; } /** diff --git a/broadcastradio/common/utilsaidl/Utils.cpp b/broadcastradio/common/utilsaidl/Utils.cpp index 52c7b40c7a..ad823661db 100644 --- a/broadcastradio/common/utilsaidl/Utils.cpp +++ b/broadcastradio/common/utilsaidl/Utils.cpp @@ -136,7 +136,9 @@ bool tunesTo(const ProgramSelector& a, const ProgramSelector& b) { return getHdSubchannel(b) == 0 && haveEqualIds(a, b, IdentifierType::AMFM_FREQUENCY_KHZ); case IdentifierType::DAB_SID_EXT: - return haveEqualIds(a, b, IdentifierType::DAB_SID_EXT); + return haveEqualIds(a, b, IdentifierType::DAB_SID_EXT) && + haveEqualIds(a, b, IdentifierType::DAB_ENSEMBLE) && + haveEqualIds(a, b, IdentifierType::DAB_FREQUENCY_KHZ); case IdentifierType::DRMO_SERVICE_ID: return haveEqualIds(a, b, IdentifierType::DRMO_SERVICE_ID); case IdentifierType::SXM_SERVICE_ID: @@ -241,8 +243,8 @@ bool isValid(const ProgramIdentifier& id) { break; } case IdentifierType::DAB_SID_EXT: { - int64_t sid = val & 0xFFFF; // 16bit - val >>= 16; + int64_t sid = val & 0xFFFFFFFF; // 32bit + val >>= 32; int64_t ecc = val & 0xFF; // 8bit expect(sid != 0u, "DAB SId != 0"); expect(ecc >= 0xA0u && ecc <= 0xF6u, "Invalid ECC, see ETSI TS 101 756 V2.1.1"); @@ -277,13 +279,35 @@ bool isValid(const ProgramIdentifier& id) { } bool isValid(const ProgramSelector& sel) { - // iterate through primaryId and secondaryIds - for (auto it = begin(sel); it != end(sel); it++) { + if (sel.primaryId.type != IdentifierType::AMFM_FREQUENCY_KHZ && + sel.primaryId.type != IdentifierType::RDS_PI && + sel.primaryId.type != IdentifierType::HD_STATION_ID_EXT && + sel.primaryId.type != IdentifierType::DAB_SID_EXT && + sel.primaryId.type != IdentifierType::DRMO_SERVICE_ID && + sel.primaryId.type != IdentifierType::SXM_SERVICE_ID && + (sel.primaryId.type < IdentifierType::VENDOR_START || + sel.primaryId.type > IdentifierType::VENDOR_END)) { + return false; + } + if (!isValid(sel.primaryId)) { + return false; + } + + bool isDab = sel.primaryId.type == IdentifierType::DAB_SID_EXT; + bool hasDabEnsemble = false; + bool hasDabFrequency = false; + for (auto it = sel.secondaryIds.begin(); it != sel.secondaryIds.end(); it++) { if (!isValid(*it)) { return false; } + if (isDab && it->type == IdentifierType::DAB_ENSEMBLE) { + hasDabEnsemble = true; + } + if (isDab && it->type == IdentifierType::DAB_FREQUENCY_KHZ) { + hasDabFrequency = true; + } } - return true; + return !isDab || (hasDabEnsemble && hasDabFrequency); } ProgramIdentifier makeIdentifier(IdentifierType type, int64_t value) { @@ -296,16 +320,12 @@ ProgramSelector makeSelectorAmfm(int32_t frequency) { return sel; } -ProgramSelector makeSelectorDab(int32_t sidExt, int32_t ensemble) { +ProgramSelector makeSelectorDab(int64_t sidExt, int32_t ensemble, int64_t freq) { ProgramSelector sel = {}; - // TODO(243686545): Have a helper function to create the sidExt instead of - // passing the whole identifier here. Something like makeDabSidExt. sel.primaryId = makeIdentifier(IdentifierType::DAB_SID_EXT, sidExt); vector secondaryIds = { makeIdentifier(IdentifierType::DAB_ENSEMBLE, ensemble), - // TODO(243686545): Include frequency here when the helper method to - // translate between ensemble and frequency is implemented. - }; + makeIdentifier(IdentifierType::DAB_FREQUENCY_KHZ, freq)}; sel.secondaryIds = std::move(secondaryIds); return sel; } @@ -330,10 +350,6 @@ bool satisfies(const ProgramFilter& filter, const ProgramSelector& sel) { } } - if (!filter.includeCategories && sel.primaryId.type == IdentifierType::DAB_ENSEMBLE) { - return false; - } - return true; } diff --git a/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h b/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h index 8ea6319ce7..beebd037c2 100644 --- a/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h +++ b/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h @@ -138,7 +138,7 @@ bool isValid(const ProgramSelector& sel); ProgramIdentifier makeIdentifier(IdentifierType type, int64_t value); ProgramSelector makeSelectorAmfm(int32_t frequency); -ProgramSelector makeSelectorDab(int32_t sidExt, int32_t ensemble); +ProgramSelector makeSelectorDab(int64_t sidExt, int32_t ensemble, int64_t freq); bool satisfies(const ProgramFilter& filter, const ProgramSelector& sel); From 4e6144c94652a0e31e792ea22225eeaf898b7bec Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Thu, 15 Dec 2022 15:32:18 -0800 Subject: [PATCH 531/998] Add HAL changes for SEAT_HEADREST_HEIGHT_POS_V2 and deprecate SEAT_HEADREST_HEIGHT_POS This deprecation process is for the currently unusable property SEAT_HEADREST_HEIGHT_POS which targets the GLOBAL area type instead of the SEAT area type. This means that changes apply to all seats instead of individual seats. This new property addresses this issue and solves it. Bug: 242587816 Test: atest VtsHalAutomotiveVehicle_TargetTest atest CtsCarTestCases:CarPropertyManagerTest atest CtsCarTestCases:VehiclePropertyIdsTest Change-Id: I1102ffcac6e0c97d73dfc574a5c863a2082d8f3f --- automotive/vehicle/2.0/types.hal | 6 ++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 25 ++++++++++++- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../config/DefaultProperties.json | 35 +++++++++++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++ current.txt | 1 + 10 files changed, 77 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/2.0/types.hal b/automotive/vehicle/2.0/types.hal index 9e4f252342..83b0d94a6b 100644 --- a/automotive/vehicle/2.0/types.hal +++ b/automotive/vehicle/2.0/types.hal @@ -2117,6 +2117,12 @@ enum VehicleProperty : int32_t { | VehicleArea:SEAT), /** + * DO NOT USE + * + * This property is defined as type VehicleArea:GLOBAL, which means all seats use the same + * value. Use SEAT_HEADREST_HEIGHT_POS_V2 instead which fixes this issue by being defined as + * type VehicleArea:SEAT. + * * Headrest height position * * Sets the headrest height. diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index c3b3e003a8..f1c962991b 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -155,6 +155,7 @@ enum VehicleProperty { SEAT_LUMBAR_SIDE_SUPPORT_POS = 356518803, SEAT_LUMBAR_SIDE_SUPPORT_MOVE = 356518804, SEAT_HEADREST_HEIGHT_POS = 289409941, + SEAT_HEADREST_HEIGHT_POS_V2 = 356518820, SEAT_HEADREST_HEIGHT_MOVE = 356518806, SEAT_HEADREST_ANGLE_POS = 356518807, SEAT_HEADREST_ANGLE_MOVE = 356518808, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 4d0b77bb38..72e11b1065 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1760,7 +1760,11 @@ enum VehicleProperty { SEAT_LUMBAR_SIDE_SUPPORT_MOVE = 0x0B94 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 /** - * Headrest height position + * (Deprecated) Headrest height position + * + * This property is deprecated because it is defined as type VehicleArea:GLOBAL, which means all + * seats use the same value. Use SEAT_HEADREST_HEIGHT_POS_V2 instead which fixes this issue by + * being defined as type VehicleArea:SEAT. * * Sets the headrest height. * Max value indicates tallest setting. @@ -1771,6 +1775,25 @@ enum VehicleProperty { */ SEAT_HEADREST_HEIGHT_POS = 0x0B95 + 0x10000000 + 0x01000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + + /** + * Headrest height position + * + * Sets the headrest height for supported seats. VehiclePropConfig.areaConfigs specifies which + * seats are supported. + * + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All values between + * minInt32Value and maxInt32Value must be supported. The maxInt32Value indicates the tallest + * setting and the minInt32Value indicates the shortest setting. + * + * This value is not in any particular unit but in a specified range of steps. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + SEAT_HEADREST_HEIGHT_POS_V2 = + 0x0BA4 + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, + /** * Headrest height move * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 75b371f9d3..c352d8cd4b 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -155,6 +155,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_HEADREST_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_HEADREST_HEIGHT_POS_V2, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_HEADREST_HEIGHT_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_HEADREST_ANGLE_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 6e797b91df..d9efa6a226 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -155,6 +155,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_HEADREST_HEIGHT_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_HEADREST_HEIGHT_POS_V2, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_HEADREST_HEIGHT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_HEADREST_ANGLE_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 455d3d453f..0f33b1ee48 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -147,6 +147,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.SEAT_LUMBAR_SIDE_SUPPORT_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_LUMBAR_SIDE_SUPPORT_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_HEADREST_HEIGHT_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_HEADREST_HEIGHT_POS_V2, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_HEADREST_HEIGHT_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_HEADREST_ANGLE_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index aaa344f6bd..00b73cac6e 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -147,6 +147,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.SEAT_LUMBAR_SIDE_SUPPORT_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_LUMBAR_SIDE_SUPPORT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_HEADREST_HEIGHT_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_HEADREST_HEIGHT_POS_V2, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_HEADREST_HEIGHT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_HEADREST_ANGLE_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 0b1634ce4d..2997e32666 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -860,6 +860,41 @@ } ] }, + { + "property": "VehicleProperty::SEAT_HEADREST_HEIGHT_POS_V2", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": 0, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": 0, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": 0, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": 0, + "maxInt32Value": 10 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": 0, + "maxInt32Value": 10 + } + ] + }, { "property": "VehicleProperty::SEAT_HEADREST_HEIGHT_MOVE", "defaultValue": { diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 5595afe4ab..dffcae5d87 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -559,6 +559,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyMirrorAutoTiltEnabledConfig) { VehicleArea::MIRROR, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatHeadrestHeightPosV2Config) { + verifyProperty(VehicleProperty::SEAT_HEADREST_HEIGHT_POS_V2, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::SEAT, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatWalkInPosConfig) { verifyProperty(VehicleProperty::SEAT_WALK_IN_POS, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, diff --git a/current.txt b/current.txt index 0fb8b49992..fbdd3fe648 100644 --- a/current.txt +++ b/current.txt @@ -932,5 +932,6 @@ b7ce2d87841585551b082fca6d099622e63b7099e0d8013f687ea1a1dc35c4dc android.hardwar # ABI preserving changes to HALs during Android U 2aa559cda86c358c6429114ef6bc72c1b43281e98f9eb6b4df5e7073c8d05767 android.hardware.automotive.vehicle@2.0::types 42abd285a4293dadb8c89bc63b90cae2872fbffe90c4517aa3ea4965e8aecff7 android.hardware.graphics.common@1.2::types +4f1a02d21a22104c734f71cdbba19b6f7e93d4ee107ff79f0dbdd171a8430e0e android.hardware.automotive.vehicle@2.0::types # There will be no more HIDL HALs. Use AIDL instead. From fb65ae5f989e1550e75102cb7d3fef16ff323dea Mon Sep 17 00:00:00 2001 From: shrikar Date: Thu, 3 Nov 2022 23:12:51 +0000 Subject: [PATCH 532/998] Added SEAT_FOOTWELL_LIGHTS_STATE to hardware layer Bug: 257268511 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I51e02f8fb646ea032ecf325bd13efbc628a0b1f6 --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 21 +++++++++++++ .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../JsonConfigLoader/src/JsonConfigLoader.cpp | 1 + .../config/DefaultProperties.json | 31 +++++++++++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++ 9 files changed, 64 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index c3b3e003a8..a821e0fa95 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -160,6 +160,7 @@ enum VehicleProperty { SEAT_HEADREST_ANGLE_MOVE = 356518808, SEAT_HEADREST_FORE_AFT_POS = 356518809, SEAT_HEADREST_FORE_AFT_MOVE = 356518810, + SEAT_FOOTWELL_LIGHTS_STATE = 356518811, SEAT_EASY_ACCESS_ENABLED = 354421661, SEAT_AIRBAG_ENABLED = 354421662, SEAT_CUSHION_SIDE_SUPPORT_POS = 356518815, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 4d0b77bb38..7e21b519bc 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1823,6 +1823,27 @@ enum VehicleProperty { */ SEAT_HEADREST_FORE_AFT_MOVE = 0x0B9A + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Represents property for the seat footwell lights state. + * + * SEAT_FOOTWELL_LIGHTS_STATE reflects the current state of the lights at any point in time. + * This is different from the function of SEAT_FOOTWELL_LIGHTS_SWITCH which represents the + * position of the switch controlling the lights. Therefore, SEAT_FOOTWELL_LIGHTS_STATE may not + * match the value of SEAT_FOOTWELL_LIGHTS_SWITCH (e.g. SEAT_FOOTWELL_LIGHTS_SWITCH=AUTOMATIC + * and SEAT_FOOTWELL_LIGHTS_STATE=ON). + * + * This property should only be implemented if SEAT_FOOTWELL_LIGHTS_STATE's value may be + * different from that of CABIN_LIGHTS_STATE. + * + * For each supported area ID, the VehicleAreaConfig#supportedEnumValues must be defined unless + * all enum values of VehicleLightState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum VehicleLightState + */ + SEAT_FOOTWELL_LIGHTS_STATE = + 0x0B9B + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, /** * Represents property for Seat easy access feature. * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 75b371f9d3..9da3225062 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -160,6 +160,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::SEAT_FOOTWELL_LIGHTS_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_AIRBAG_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 6e797b91df..f234e1eed4 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -160,6 +160,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_FOOTWELL_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_AIRBAG_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 455d3d453f..4131cd2c13 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -152,6 +152,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.SEAT_FOOTWELL_LIGHTS_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_AIRBAG_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index aaa344f6bd..e2c1fc2ce0 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -152,6 +152,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.SEAT_HEADREST_ANGLE_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_FOOTWELL_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_AIRBAG_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index 20048a245d..643cf7148b 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -89,6 +89,7 @@ const std::unordered_map CONSTANTS_BY_NAME = { {"SEAT_2_LEFT", SEAT_2_LEFT}, {"SEAT_2_RIGHT", SEAT_2_RIGHT}, {"SEAT_2_CENTER", SEAT_2_CENTER}, + {"SEAT_2_LEFT_2_RIGHT_2_CENTER", SEAT_2_LEFT | SEAT_2_RIGHT | SEAT_2_CENTER}, {"WHEEL_REAR_RIGHT", WHEEL_REAR_RIGHT}, {"WHEEL_REAR_LEFT", WHEEL_REAR_LEFT}, {"WHEEL_FRONT_RIGHT", WHEEL_FRONT_RIGHT}, diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 0b1634ce4d..b863e96d5d 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1035,6 +1035,37 @@ } ] }, + { + "property": "VehicleProperty::SEAT_FOOTWELL_LIGHTS_STATE", + "defaultValue": { + "int32Values": [ + "Constants::LIGHT_STATE_OFF" + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "supportedEnumValues": [ + "Constants::LIGHT_STATE_OFF", + "Constants::LIGHT_STATE_ON" + ] + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "supportedEnumValues": [ + "Constants::LIGHT_STATE_OFF", + "Constants::LIGHT_STATE_ON" + ] + }, + { + "areaId": "Constants::SEAT_2_LEFT_2_RIGHT_2_CENTER", + "supportedEnumValues": [ + "Constants::LIGHT_STATE_OFF", + "Constants::LIGHT_STATE_ON" + ] + } + ] + }, { "property": "VehicleProperty::SEAT_EASY_ACCESS_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 5595afe4ab..fbf5fdbaf4 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -565,6 +565,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatWalkInPosConfig) { VehicleArea::SEAT, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatFootwellLightsStateConfig) { + verifyProperty(VehicleProperty::SEAT_FOOTWELL_LIGHTS_STATE, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::SEAT, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatEasyAccessEnabledConfig) { verifyProperty(VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From 93cf1beb8f4cfc5aec8e5c068bf71a2705dd1b92 Mon Sep 17 00:00:00 2001 From: shrikar Date: Wed, 30 Nov 2022 15:00:52 -0800 Subject: [PATCH 533/998] Added SEAT_FOOTWELL_LIGHTS_SWITCH to hardware layer Bug: 257268780 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: If64a1a0488eea21e369c60d7206771f56ffaa53a --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 21 ++++++++++++ .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../JsonConfigLoader/src/JsonConfigLoader.cpp | 1 + .../config/DefaultProperties.json | 34 +++++++++++++++++++ .../impl/utils/common/include/PropertyUtils.h | 1 + .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++ 10 files changed, 68 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index a821e0fa95..2618d0d217 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -161,6 +161,7 @@ enum VehicleProperty { SEAT_HEADREST_FORE_AFT_POS = 356518809, SEAT_HEADREST_FORE_AFT_MOVE = 356518810, SEAT_FOOTWELL_LIGHTS_STATE = 356518811, + SEAT_FOOTWELL_LIGHTS_SWITCH = 356518812, SEAT_EASY_ACCESS_ENABLED = 354421661, SEAT_AIRBAG_ENABLED = 354421662, SEAT_CUSHION_SIDE_SUPPORT_POS = 356518815, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 7e21b519bc..fc85dbea33 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1844,6 +1844,27 @@ enum VehicleProperty { */ SEAT_FOOTWELL_LIGHTS_STATE = 0x0B9B + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, + /** + * Represents property for the seat footwell lights switch. + * + * SEAT_FOOTWELL_LIGHTS_SWITCH represents the position of the switch controlling the lights. + * This is different from the function of SEAT_FOOTWELL_LIGHTS_STATE which reflects the current + * state of the lights at any point in time. Therefore, SEAT_FOOTWELL_LIGHTS_SWITCH may not + * match the value of SEAT_FOOTWELL_LIGHTS_STATE (e.g. SEAT_FOOTWELL_LIGHTS_SWITCH=AUTOMATIC and + * SEAT_FOOTWELL_LIGHTS_STATE=ON). + * + * This property should only be implemented if SEAT_FOOTWELL_LIGHTS_SWITCH's value may be + * different from that of CABIN_LIGHTS_SWITCH. + * + * For each supported area ID, the VehicleAreaConfig#supportedEnumValues must be defined unless + * all enum values of VehicleLightSwitch are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + * @data_enum VehicleLightSwitch + */ + SEAT_FOOTWELL_LIGHTS_SWITCH = + 0x0B9C + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, /** * Represents property for Seat easy access feature. * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 9da3225062..876aed23d9 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -161,6 +161,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_FOOTWELL_LIGHTS_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::SEAT_FOOTWELL_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_AIRBAG_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index f234e1eed4..a1a1487956 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -161,6 +161,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_FOOTWELL_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::SEAT_FOOTWELL_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_AIRBAG_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 4131cd2c13..03e5ec106d 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -153,6 +153,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_FOOTWELL_LIGHTS_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.SEAT_FOOTWELL_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_AIRBAG_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index e2c1fc2ce0..0cef2eb8e2 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -153,6 +153,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_HEADREST_FORE_AFT_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_FOOTWELL_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.SEAT_FOOTWELL_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_AIRBAG_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SEAT_CUSHION_SIDE_SUPPORT_POS, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index 643cf7148b..227298b09e 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -108,6 +108,7 @@ const std::unordered_map CONSTANTS_BY_NAME = { {"LIGHT_STATE_ON", LIGHT_STATE_ON}, {"LIGHT_STATE_OFF", LIGHT_STATE_OFF}, {"LIGHT_SWITCH_OFF", LIGHT_SWITCH_OFF}, + {"LIGHT_SWITCH_ON", LIGHT_SWITCH_ON}, {"LIGHT_SWITCH_AUTO", LIGHT_SWITCH_AUTO}, {"MIRROR_DRIVER_LEFT_RIGHT", toInt(VehicleAreaMirror::DRIVER_LEFT) | toInt(VehicleAreaMirror::DRIVER_RIGHT)}, diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index b863e96d5d..964b3e7fe5 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1066,6 +1066,40 @@ } ] }, + { + "property": "VehicleProperty::SEAT_FOOTWELL_LIGHTS_SWITCH", + "defaultValue": { + "int32Values": [ + "Constants::LIGHT_SWITCH_OFF" + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT", + "supportedEnumValues": [ + "Constants::LIGHT_SWITCH_OFF", + "Constants::LIGHT_SWITCH_ON", + "Constants::LIGHT_SWITCH_AUTO" + ] + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "supportedEnumValues": [ + "Constants::LIGHT_SWITCH_OFF", + "Constants::LIGHT_SWITCH_ON", + "Constants::LIGHT_SWITCH_AUTO" + ] + }, + { + "areaId": "Constants::SEAT_2_LEFT_2_RIGHT_2_CENTER", + "supportedEnumValues": [ + "Constants::LIGHT_SWITCH_OFF", + "Constants::LIGHT_SWITCH_ON", + "Constants::LIGHT_SWITCH_AUTO" + ] + } + ] + }, { "property": "VehicleProperty::SEAT_EASY_ACCESS_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h b/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h index bf27c95c94..2b2a592295 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h @@ -98,6 +98,7 @@ constexpr int CHARGE_PORT_REAR_LEFT = toInt(propertyutils_impl::PortLocationType constexpr int LIGHT_STATE_ON = toInt(propertyutils_impl::VehicleLightState::ON); constexpr int LIGHT_STATE_OFF = toInt(propertyutils_impl::VehicleLightState::OFF); constexpr int LIGHT_SWITCH_OFF = toInt(propertyutils_impl::VehicleLightSwitch::OFF); +constexpr int LIGHT_SWITCH_ON = toInt(propertyutils_impl::VehicleLightSwitch::ON); constexpr int LIGHT_SWITCH_AUTO = toInt(propertyutils_impl::VehicleLightSwitch::AUTOMATIC); constexpr int WHEEL_FRONT_LEFT = toInt(propertyutils_impl::VehicleAreaWheel::LEFT_FRONT); constexpr int WHEEL_FRONT_RIGHT = toInt(propertyutils_impl::VehicleAreaWheel::RIGHT_FRONT); diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index fbf5fdbaf4..1c273a5f15 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -571,6 +571,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatFootwellLightsStateConfig) { VehicleArea::SEAT, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatFootwellLightsSwitchConfig) { + verifyProperty(VehicleProperty::SEAT_FOOTWELL_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::SEAT, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatEasyAccessEnabledConfig) { verifyProperty(VehicleProperty::SEAT_EASY_ACCESS_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From 2dae80f7391d1d5801536b9246385397287f403e Mon Sep 17 00:00:00 2001 From: shrikar Date: Wed, 21 Dec 2022 23:50:17 +0000 Subject: [PATCH 534/998] Added EV_STOPPING_MODE to hardware layer. Bug: 262901831 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I11dd297c96594c864beaf4917f3a2a3706a0cd76 --- .../automotive/vehicle/EvStoppingMode.aidl | 41 ++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/EvStoppingMode.aidl | 43 +++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 14 ++++++ .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../JsonConfigLoader/src/JsonConfigLoader.cpp | 3 ++ .../config/DefaultProperties.json | 18 ++++++++ .../impl/utils/common/include/PropertyUtils.h | 4 ++ .../utils/common/include/VehicleHalTypes.h | 1 + .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 +++ 13 files changed, 135 insertions(+) create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvStoppingMode.aidl create mode 100644 automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvStoppingMode.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvStoppingMode.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvStoppingMode.aidl new file mode 100644 index 0000000000..3be8d1263f --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvStoppingMode.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum EvStoppingMode { + OTHER = 0, + CREEP = 1, + ROLL = 2, + HOLD = 3, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index c3b3e003a8..5cb556adbb 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -80,6 +80,7 @@ enum VehicleProperty { IGNITION_STATE = 289408009, ABS_ACTIVE = 287310858, TRACTION_CONTROL_ACTIVE = 287310859, + EV_STOPPING_MODE = 289408013, HVAC_FAN_SPEED = 356517120, HVAC_FAN_DIRECTION = 356517121, HVAC_TEMPERATURE_CURRENT = 358614274, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvStoppingMode.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvStoppingMode.aidl new file mode 100644 index 0000000000..8c5ac46c4e --- /dev/null +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvStoppingMode.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ + +package android.hardware.automotive.vehicle; + +/** + * Used by EV_STOPPING_MODE to enumerate the current state of the stopping mode. + * + * This enum may be extended to include more states in the future. + */ +@VintfStability +@Backing(type="int") +enum EvStoppingMode { + /** + * Other EV stopping mode. Ideally, this should never be used. + */ + OTHER = 0, + /** + * Vehicle slowly moves forward when the brake pedal is released. + */ + CREEP = 1, + /** + * Vehicle rolls freely when the brake pedal is released (similar to neutral gear). + */ + ROLL = 2, + /** + * Vehicle stops and holds its position when the brake pedal is released. + */ + HOLD = 3, +} diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 4d0b77bb38..0ffb37f867 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -602,6 +602,20 @@ enum VehicleProperty { */ TRACTION_CONTROL_ACTIVE = 0x040B + 0x10000000 + 0x01000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:BOOLEAN + /** + * Represents property for the current stopping mode of the vehicle. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues must be defined unless + * all enum values of EvStoppingMode are supported. + * + * The EvStoppingMode enum may be extended to include more states in the future. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + * @data_enum EvStoppingMode + */ + EV_STOPPING_MODE = + 0x040D + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, /** * HVAC Properties * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 75b371f9d3..21ff70a342 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -80,6 +80,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::IGNITION_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::ABS_ACTIVE, VehiclePropertyAccess::READ}, {VehicleProperty::TRACTION_CONTROL_ACTIVE, VehiclePropertyAccess::READ}, + {VehicleProperty::EV_STOPPING_MODE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HVAC_FAN_SPEED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HVAC_FAN_DIRECTION, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HVAC_TEMPERATURE_CURRENT, VehiclePropertyAccess::READ}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 6e797b91df..4223dc5359 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -80,6 +80,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::IGNITION_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::ABS_ACTIVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::TRACTION_CONTROL_ACTIVE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EV_STOPPING_MODE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HVAC_FAN_SPEED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HVAC_FAN_DIRECTION, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HVAC_TEMPERATURE_CURRENT, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 455d3d453f..6e0e5f8bd7 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -72,6 +72,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.IGNITION_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.ABS_ACTIVE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.TRACTION_CONTROL_ACTIVE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.EV_STOPPING_MODE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HVAC_FAN_SPEED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HVAC_FAN_DIRECTION, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HVAC_TEMPERATURE_CURRENT, VehiclePropertyAccess.READ), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index aaa344f6bd..e6c103a815 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -72,6 +72,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.IGNITION_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.ABS_ACTIVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.TRACTION_CONTROL_ACTIVE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EV_STOPPING_MODE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HVAC_FAN_SPEED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HVAC_FAN_DIRECTION, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HVAC_TEMPERATURE_CURRENT, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index 20048a245d..5a29028c9d 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -108,6 +108,9 @@ const std::unordered_map CONSTANTS_BY_NAME = { {"LIGHT_STATE_OFF", LIGHT_STATE_OFF}, {"LIGHT_SWITCH_OFF", LIGHT_SWITCH_OFF}, {"LIGHT_SWITCH_AUTO", LIGHT_SWITCH_AUTO}, + {"EV_STOPPING_MODE_CREEP", EV_STOPPING_MODE_CREEP}, + {"EV_STOPPING_MODE_ROLL", EV_STOPPING_MODE_ROLL}, + {"EV_STOPPING_MODE_HOLD", EV_STOPPING_MODE_HOLD}, {"MIRROR_DRIVER_LEFT_RIGHT", toInt(VehicleAreaMirror::DRIVER_LEFT) | toInt(VehicleAreaMirror::DRIVER_RIGHT)}, #ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 0b1634ce4d..4a63186925 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1587,6 +1587,24 @@ } ] }, + { + "property": "VehicleProperty::EV_STOPPING_MODE", + "defaultValue": { + "int32Values": [ + "Constants::EV_STOPPING_MODE_CREEP" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "Constants::EV_STOPPING_MODE_CREEP", + "Constants::EV_STOPPING_MODE_ROLL", + "Constants::EV_STOPPING_MODE_HOLD" + ] + } + ] + }, { "property": "VehicleProperty::FUEL_LEVEL_LOW", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h b/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h index bf27c95c94..3ce2e6ad15 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h @@ -28,6 +28,7 @@ namespace vehicle { namespace propertyutils_impl { // These names are not part of the API since we only expose ints. +using ::aidl::android::hardware::automotive::vehicle::EvStoppingMode; using ::aidl::android::hardware::automotive::vehicle::PortLocationType; using ::aidl::android::hardware::automotive::vehicle::VehicleArea; using ::aidl::android::hardware::automotive::vehicle::VehicleAreaDoor; @@ -99,6 +100,9 @@ constexpr int LIGHT_STATE_ON = toInt(propertyutils_impl::VehicleLightState::ON); constexpr int LIGHT_STATE_OFF = toInt(propertyutils_impl::VehicleLightState::OFF); constexpr int LIGHT_SWITCH_OFF = toInt(propertyutils_impl::VehicleLightSwitch::OFF); constexpr int LIGHT_SWITCH_AUTO = toInt(propertyutils_impl::VehicleLightSwitch::AUTOMATIC); +constexpr int EV_STOPPING_MODE_CREEP = toInt(propertyutils_impl::EvStoppingMode::CREEP); +constexpr int EV_STOPPING_MODE_ROLL = toInt(propertyutils_impl::EvStoppingMode::ROLL); +constexpr int EV_STOPPING_MODE_HOLD = toInt(propertyutils_impl::EvStoppingMode::HOLD); constexpr int WHEEL_FRONT_LEFT = toInt(propertyutils_impl::VehicleAreaWheel::LEFT_FRONT); constexpr int WHEEL_FRONT_RIGHT = toInt(propertyutils_impl::VehicleAreaWheel::RIGHT_FRONT); constexpr int WHEEL_REAR_LEFT = toInt(propertyutils_impl::VehicleAreaWheel::LEFT_REAR); diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index 08e1990279..09157019b8 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 5595afe4ab..98d284f37f 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -487,6 +487,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvBrakeRegenerationLevelConfig) VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvStoppingModeConfig) { + verifyProperty(VehicleProperty::EV_STOPPING_MODE, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvCurrentBatteryCapacityConfig) { verifyProperty(VehicleProperty::EV_CURRENT_BATTERY_CAPACITY, VehiclePropertyAccess::READ, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From b16a3dbc5d833686d9e1f19b173be5a917f1e5ed Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Fri, 23 Dec 2022 02:10:35 +0000 Subject: [PATCH 535/998] specify import version (I) Required to automate AIDL finalization - makes errors show up now instead of later. Bug: 188871598 Test: build Change-Id: Ic544707bac671d8327d8cc704a9d453470141e8e --- bluetooth/audio/aidl/Android.bp | 2 +- input/processor/aidl/Android.bp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bluetooth/audio/aidl/Android.bp b/bluetooth/audio/aidl/Android.bp index 4aea83f199..618141f8ca 100644 --- a/bluetooth/audio/aidl/Android.bp +++ b/bluetooth/audio/aidl/Android.bp @@ -29,7 +29,7 @@ aidl_interface { imports: [ "android.hardware.common-V2", "android.hardware.common.fmq-V1", - "android.hardware.audio.common", + "android.hardware.audio.common-V1", ], backend: { cpp: { diff --git a/input/processor/aidl/Android.bp b/input/processor/aidl/Android.bp index 773bb493bf..f1a73d2e3b 100644 --- a/input/processor/aidl/Android.bp +++ b/input/processor/aidl/Android.bp @@ -13,7 +13,7 @@ aidl_interface { vendor_available: true, srcs: ["android/hardware/input/processor/*.aidl"], imports: [ - "android.hardware.input.common", + "android.hardware.input.common-V1", ], stability: "vintf", backend: { From d4f594734124f5ea618d8e2c6fba941145e01d67 Mon Sep 17 00:00:00 2001 From: Yomna Nasser Date: Thu, 22 Dec 2022 20:30:13 +0000 Subject: [PATCH 536/998] setNullCipherAndIntegrityEnabled VTS to return REQUEST_NOT_SUPPORTED Mark setNullCipherAndIntegrityEnabled as optional-to-support. Bug: b/237529943 Test: atest VtsHalRadioTargetTest Change-Id: Iff04c12958fe7ad2a07614129a5af339b02192e0 --- .../hardware/radio/network/IRadioNetworkResponse.aidl | 1 + radio/aidl/vts/radio_network_test.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl index 399dbb7a84..f186df74b3 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -633,6 +633,7 @@ oneway interface IRadioNetworkResponse { * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:MODEM_ERR + * RadioError:REQUEST_NOT_SUPPORTED */ void isNullCipherAndIntegrityEnabledResponse(in RadioResponseInfo info, in boolean isEnabled); diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index 43a4737b5d..0e09b2c41f 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -1974,9 +1974,9 @@ TEST_P(RadioNetworkTest, setNullCipherAndIntegrityEnabled) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); - ASSERT_TRUE(CheckAnyOfErrors( - radioRsp_network->rspInfo.error, - {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, + RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); LOG(DEBUG) << "setNullCipherAndIntegrityEnabled finished"; } From c5d5b7d4ea4c2dea2848e2f1a92537bbba11b0ba Mon Sep 17 00:00:00 2001 From: Jeffrey Vander Stoep Date: Fri, 23 Dec 2022 11:28:28 +0000 Subject: [PATCH 537/998] Revert "Make virtual fingerprint Hal as a lazy Hal" This reverts commit 93e97f94b67e6ab9e994fc642ad204cd670d9a71. Reason for revert: b/263519851 Change-Id: I24a9921c806013c5a50bb0674690b67beca172f0 --- biometrics/fingerprint/aidl/default/fingerprint-example.rc | 7 ++++--- biometrics/fingerprint/aidl/default/main.cpp | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/biometrics/fingerprint/aidl/default/fingerprint-example.rc b/biometrics/fingerprint/aidl/default/fingerprint-example.rc index 80985e84b6..10db00d0f5 100644 --- a/biometrics/fingerprint/aidl/default/fingerprint-example.rc +++ b/biometrics/fingerprint/aidl/default/fingerprint-example.rc @@ -2,7 +2,8 @@ service vendor.fingerprint-example /vendor/bin/hw/android.hardware.biometrics.fi class hal user nobody group nobody - interface aidl android.hardware.biometrics.fingerprint.IFingerprint/virtual - oneshot disabled - +on property:ro.vendor.fingerprint_virtual_hal_start=true + enable vendor.fingerprint-example +on property:persist.vendor.fingerprint.virtual.type=* + enable vendor.fingerprint-example diff --git a/biometrics/fingerprint/aidl/default/main.cpp b/biometrics/fingerprint/aidl/default/main.cpp index 11bce15be9..0e672b10ab 100644 --- a/biometrics/fingerprint/aidl/default/main.cpp +++ b/biometrics/fingerprint/aidl/default/main.cpp @@ -28,8 +28,7 @@ int main() { std::shared_ptr hal = ndk::SharedRefBase::make(); const std::string instance = std::string(Fingerprint::descriptor) + "/virtual"; - binder_status_t status = - AServiceManager_registerLazyService(hal->asBinder().get(), instance.c_str()); + binder_status_t status = AServiceManager_addService(hal->asBinder().get(), instance.c_str()); CHECK_EQ(status, STATUS_OK); ABinderProcess_joinThreadPool(); From b5da622cc7dce4a83a3ddc43385f50683ce2e52a Mon Sep 17 00:00:00 2001 From: Terry Huang Date: Mon, 26 Dec 2022 01:39:39 +0000 Subject: [PATCH 538/998] Revert "[test_suite] Add Location Privacy HAL" Revert submission 20513346-LocationPrivacy-HAL Reason for revert: Move feature to Android V Reverted changes: /q/submissionid:20513346-LocationPrivacy-HAL Change-Id: I58545f741e5d9e4252a1292dd9eb0c26047dafee --- .../include/libradiocompat/RadioNetwork.h | 3 --- .../compat/libradiocompat/network/RadioNetwork.cpp | 14 -------------- radio/aidl/vts/radio_network_indication.cpp | 5 ----- radio/aidl/vts/radio_network_response.cpp | 14 -------------- radio/aidl/vts/radio_network_utils.h | 9 --------- 5 files changed, 45 deletions(-) diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h index b4461031be..f9f3c6cb33 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioNetwork.h @@ -104,9 +104,6 @@ class RadioNetwork : public RadioCompatBase, ::ndk::ScopedAStatus setNullCipherAndIntegrityEnabled(int32_t serial, bool enabled) override; - ::ndk::ScopedAStatus setLocationPrivacySetting(int32_t serial, bool shareLocation) override; - ::ndk::ScopedAStatus getLocationPrivacySetting(int32_t serial) override; - protected: std::shared_ptr<::aidl::android::hardware::radio::network::IRadioNetworkResponse> respond(); diff --git a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp index 730b5dd902..005deaed4d 100644 --- a/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp +++ b/radio/aidl/compat/libradiocompat/network/RadioNetwork.cpp @@ -360,18 +360,4 @@ ScopedAStatus RadioNetwork::setN1ModeEnabled(int32_t serial, bool /*enable*/) { respond()->setN1ModeEnabledResponse(notSupported(serial)); return ok(); } - -ScopedAStatus RadioNetwork::setLocationPrivacySetting(int32_t serial, bool /*shareLocation*/) { - LOG_CALL << serial; - LOG(ERROR) << " setLocationPrivacySetting is unsupported by HIDL HALs"; - respond()->setLocationPrivacySettingResponse(notSupported(serial)); - return ok(); -} - -ScopedAStatus RadioNetwork::getLocationPrivacySetting(int32_t serial) { - LOG_CALL << serial; - LOG(ERROR) << " getLocationPrivacySetting is unsupported by HIDL HALs"; - respond()->getLocationPrivacySettingResponse(notSupported(serial), false); - return ok(); -} } // namespace android::hardware::radio::compat diff --git a/radio/aidl/vts/radio_network_indication.cpp b/radio/aidl/vts/radio_network_indication.cpp index 71789827a4..ae3bd4b01a 100644 --- a/radio/aidl/vts/radio_network_indication.cpp +++ b/radio/aidl/vts/radio_network_indication.cpp @@ -97,8 +97,3 @@ ndk::ScopedAStatus RadioNetworkIndication::emergencyNetworkScanResult( RadioIndicationType /*type*/, const EmergencyRegResult& /*result*/) { return ndk::ScopedAStatus::ok(); } - -ndk::ScopedAStatus RadioNetworkIndication::onNetworkInitiatedLocationResult( - RadioIndicationType /*type*/, LocationResponseType /*locationResponseType*/) { - return ndk::ScopedAStatus::ok(); -} diff --git a/radio/aidl/vts/radio_network_response.cpp b/radio/aidl/vts/radio_network_response.cpp index 4f0e4f3274..c890df08a6 100644 --- a/radio/aidl/vts/radio_network_response.cpp +++ b/radio/aidl/vts/radio_network_response.cpp @@ -313,17 +313,3 @@ ndk::ScopedAStatus RadioNetworkResponse::setN1ModeEnabledResponse(const RadioRes parent_network.notify(info.serial); return ndk::ScopedAStatus::ok(); } - -ndk::ScopedAStatus RadioNetworkResponse::setLocationPrivacySettingResponse( - const RadioResponseInfo& info) { - rspInfo = info; - parent_network.notify(info.serial); - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus RadioNetworkResponse::getLocationPrivacySettingResponse( - const RadioResponseInfo& info, bool /*shareLocation*/) { - rspInfo = info; - parent_network.notify(info.serial); - return ndk::ScopedAStatus::ok(); -} diff --git a/radio/aidl/vts/radio_network_utils.h b/radio/aidl/vts/radio_network_utils.h index 92dcb1f70f..e6a320b572 100644 --- a/radio/aidl/vts/radio_network_utils.h +++ b/radio/aidl/vts/radio_network_utils.h @@ -166,12 +166,6 @@ class RadioNetworkResponse : public BnRadioNetworkResponse { const RadioResponseInfo& info, bool isEnabled) override; virtual ndk::ScopedAStatus setN1ModeEnabledResponse(const RadioResponseInfo& info) override; - - virtual ndk::ScopedAStatus setLocationPrivacySettingResponse( - const RadioResponseInfo& info) override; - - virtual ndk::ScopedAStatus getLocationPrivacySettingResponse(const RadioResponseInfo& info, - bool shareLocation) override; }; /* Callback class for radio network indication */ @@ -229,9 +223,6 @@ class RadioNetworkIndication : public BnRadioNetworkIndication { virtual ndk::ScopedAStatus emergencyNetworkScanResult( RadioIndicationType type, const EmergencyRegResult& result) override; - - virtual ndk::ScopedAStatus onNetworkInitiatedLocationResult( - RadioIndicationType type, LocationResponseType locationResponseType) override; }; // The main test class for Radio AIDL Network. From 44e86c2f82cc42bc56f5a35d153c3f6ba18f2de0 Mon Sep 17 00:00:00 2001 From: Terry Huang Date: Mon, 26 Dec 2022 01:39:39 +0000 Subject: [PATCH 539/998] Revert "[AIDL] Add Location Privacy HAL" Revert submission 20513346-LocationPrivacy-HAL Reason for revert: Move feature to Android V Reverted changes: /q/submissionid:20513346-LocationPrivacy-HAL Change-Id: Ia92cc208cd540b57ca3c0a953f8cd80ce1f708c4 --- .../hardware/radio/network/IRadioNetwork.aidl | 2 - .../network/IRadioNetworkIndication.aidl | 1 - .../radio/network/IRadioNetworkResponse.aidl | 2 - .../radio/network/LocationResponseType.aidl | 40 ------------------- .../hardware/radio/network/IRadioNetwork.aidl | 26 ------------ .../network/IRadioNetworkIndication.aidl | 12 +----- .../radio/network/IRadioNetworkResponse.aidl | 22 ---------- .../radio/network/LocationResponseType.aidl | 38 ------------------ 8 files changed, 1 insertion(+), 142 deletions(-) delete mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LocationResponseType.aidl delete mode 100644 radio/aidl/android/hardware/radio/network/LocationResponseType.aidl diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl index 5aed0244d9..9761900ba4 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetwork.aidl @@ -80,6 +80,4 @@ interface IRadioNetwork { oneway void setNullCipherAndIntegrityEnabled(in int serial, in boolean enabled); oneway void isN1ModeEnabled(in int serial); oneway void setN1ModeEnabled(in int serial, boolean enable); - oneway void setLocationPrivacySetting(in int serial, in boolean shareLocation); - oneway void getLocationPrivacySetting(in int serial); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl index 229f3e2173..0f017ea8ba 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkIndication.aidl @@ -49,5 +49,4 @@ interface IRadioNetworkIndication { oneway void suppSvcNotify(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.SuppSvcNotification suppSvc); oneway void voiceRadioTechChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.RadioTechnology rat); oneway void emergencyNetworkScanResult(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.EmergencyRegResult result); - oneway void onNetworkInitiatedLocationResult(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.LocationResponseType locationResponseType); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl index ccdfde69e1..c228bc17d8 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -79,6 +79,4 @@ interface IRadioNetworkResponse { oneway void setNullCipherAndIntegrityEnabledResponse(in android.hardware.radio.RadioResponseInfo info); oneway void isN1ModeEnabledResponse(in android.hardware.radio.RadioResponseInfo info, boolean isEnabled); oneway void setN1ModeEnabledResponse(in android.hardware.radio.RadioResponseInfo info); - oneway void setLocationPrivacySettingResponse(in android.hardware.radio.RadioResponseInfo info); - oneway void getLocationPrivacySettingResponse(in android.hardware.radio.RadioResponseInfo info, boolean shareLocation); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LocationResponseType.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LocationResponseType.aidl deleted file mode 100644 index e89a40fe73..0000000000 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/LocationResponseType.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.radio.network; -@Backing(type="int") @JavaDerive(toString=true) @VintfStability -enum LocationResponseType { - REJECTED = 0, - ACCEPTED_NO_LOCATION_PROVIDED = 1, - ACCEPTED_LOCATION_PROVIDED = 2, -} diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl index 6cd0339c05..4d35742aa8 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetwork.aidl @@ -530,30 +530,4 @@ oneway interface IRadioNetwork { * Response function is IRadioNetworkResponse.setN1ModeEnabledResponse() */ void setN1ModeEnabled(in int serial, boolean enable); - - /** - * This API updates the current user setting of sharing the location data. This value must be - * used by radio before honoring a network initiated location request for non emergency use - * cases. The radio shall ignore this setting during emergency call, emergency SMS or emergency - * call back modes and continue to provide the location information to the network initiated - * location requests. - * - * @param serial Serial number of request. - * @param shareLocation Whether to share location data to the network or not. true means the - * radio is allowed to provide location data for any network initiated locations - * request. false means the radio must not share location data for any network initiated - * location requests for non-emergency use cases. - * - * Response function is IRadioNetworkResponse.setLocationPrivacySettingResponse() - */ - void setLocationPrivacySetting(in int serial, in boolean shareLocation); - - /** - * Request the current setting of sharing the location data. - * - * @param serial Serial number of request. - * - * Response function is IRadioNetworkResponse.getLocationPrivacySettingResponse() - */ - void getLocationPrivacySetting(in int serial); } diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl index 2891496d63..47d932d909 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkIndication.aidl @@ -21,14 +21,13 @@ import android.hardware.radio.RadioTechnology; import android.hardware.radio.network.BarringInfo; import android.hardware.radio.network.CellIdentity; import android.hardware.radio.network.CellInfo; -import android.hardware.radio.network.EmergencyRegResult; import android.hardware.radio.network.LinkCapacityEstimate; -import android.hardware.radio.network.LocationResponseType; import android.hardware.radio.network.NetworkScanResult; import android.hardware.radio.network.PhoneRestrictedState; import android.hardware.radio.network.PhysicalChannelConfig; import android.hardware.radio.network.SignalStrength; import android.hardware.radio.network.SuppSvcNotification; +import android.hardware.radio.network.EmergencyRegResult; /** * Interface declaring unsolicited radio indications for network APIs. @@ -200,13 +199,4 @@ oneway interface IRadioNetworkIndication { * @param result the result of the Emergency Network Scan */ void emergencyNetworkScanResult(in RadioIndicationType type, in EmergencyRegResult result); - - /** - * Reports the result of the network initiated location request. - * - * @param type Type of radio indication - * @param locationResponseType result of the network initiated location request. - */ - void onNetworkInitiatedLocationResult( - in RadioIndicationType type, in LocationResponseType locationResponseType); } diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl index 3fa6521e7e..3802bd6c23 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -654,26 +654,4 @@ oneway interface IRadioNetworkResponse { * RadioError:INVALID_STATE */ void setN1ModeEnabledResponse(in RadioResponseInfo info); - - /** - * @param info Response info struct containing response type, serial no. and error - * - * Valid errors returned: - * RadioError:NONE - * RadioError:RADIO_NOT_AVAILABLE - * RadioError:INTERNAL_ERR - */ - void setLocationPrivacySettingResponse(in RadioResponseInfo info); - - /** - * @param info Response info struct containing response type, serial no. and error - * @param shareLocation Indicates whether the location sharing is allowed or not, True if - * allowed else false. - * - * Valid errors returned: - * RadioError:NONE - * RadioError:RADIO_NOT_AVAILABLE - * RadioError:INTERNAL_ERR - */ - void getLocationPrivacySettingResponse(in RadioResponseInfo info, boolean shareLocation); } diff --git a/radio/aidl/android/hardware/radio/network/LocationResponseType.aidl b/radio/aidl/android/hardware/radio/network/LocationResponseType.aidl deleted file mode 100644 index 0c502d08e4..0000000000 --- a/radio/aidl/android/hardware/radio/network/LocationResponseType.aidl +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ - -package android.hardware.radio.network; - -@VintfStability -@Backing(type="int") -@JavaDerive(toString=true) -enum LocationResponseType { - /** - * Network initiated Location request rejected by modem because the user has not given - * permission for this use case - */ - REJECTED = 0, - /** - * Network initiated Location request is accepted by modem however no location information has - * been shared to network due to a failure - */ - ACCEPTED_NO_LOCATION_PROVIDED = 1, - /** - * Network initiated Location request is accepted and location information is provided to the - * network by modem - */ - ACCEPTED_LOCATION_PROVIDED = 2, -} From c88ea61337b28a29838ca7806db62a0bcedaf4da Mon Sep 17 00:00:00 2001 From: Vlad Popa Date: Wed, 28 Dec 2022 17:04:58 +0100 Subject: [PATCH 540/998] Refactor the ISoundDose.aidl interface This refactoring is fixing the hal_implementation_test workaround from aosp/2363076. Adjusted the package name to match the aidl_interface and declared the ISoundDose interface types only. Test: VtsHalSoundDoseFactoryTargetTest, VtsHalAudioCoreTargetTest, hal_implementation_test Bug: 263388737 Change-Id: Ibce4cd95aaf600de2096179f137243939114ba6a --- audio/aidl/Android.bp | 4 +- .../core/{ => sounddose}/ISoundDose.aidl | 6 +-- .../android/hardware/audio/core/IModule.aidl | 2 +- .../hardware/audio/core/ISoundDose.aidl | 52 ------------------- .../hardware/audio/core/IStreamIn.aidl | 2 +- .../hardware/audio/core/MicrophoneInfo.aidl | 8 +-- .../hardware/audio/core/StreamDescriptor.aidl | 8 +-- .../android/hardware/audio/core/IModule.aidl | 2 +- .../core/{ => sounddose}/ISoundDose.aidl | 2 +- audio/aidl/default/Android.bp | 1 + audio/aidl/default/Module.cpp | 3 +- audio/aidl/default/SoundDose.cpp | 4 +- audio/aidl/default/include/core-impl/Module.h | 4 +- .../default/include/core-impl/SoundDose.h | 6 +-- .../audio/sounddose/ISoundDoseFactory.aidl | 2 +- .../audio/sounddose/ISoundDoseFactory.aidl | 2 +- .../sounddose/default/SoundDoseFactory.cpp | 2 +- .../default/include/SoundDoseFactory.h | 4 +- .../vts/VtsHalSoundDoseFactoryTargetTest.cpp | 2 +- audio/aidl/vts/Android.bp | 1 + .../vts/VtsHalAudioCoreModuleTargetTest.cpp | 4 +- .../exclude/fcm_exclude.cpp | 1 + 22 files changed, 37 insertions(+), 85 deletions(-) rename audio/aidl/aidl_api/android.hardware.audio.core.sounddose/current/android/hardware/audio/core/{ => sounddose}/ISoundDose.aidl (88%) delete mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ISoundDose.aidl rename audio/aidl/android/hardware/audio/core/{ => sounddose}/ISoundDose.aidl (98%) diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index 340cdb5bbb..ef51361200 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -114,7 +114,6 @@ aidl_interface { "android/hardware/audio/core/AudioRoute.aidl", "android/hardware/audio/core/IConfig.aidl", "android/hardware/audio/core/IModule.aidl", - "android/hardware/audio/core/ISoundDose.aidl", "android/hardware/audio/core/IStreamCallback.aidl", "android/hardware/audio/core/IStreamCommon.aidl", "android/hardware/audio/core/IStreamIn.aidl", @@ -133,6 +132,7 @@ aidl_interface { "android.hardware.common-V2", "android.hardware.common.fmq-V1", "android.hardware.audio.common-V1", + "android.hardware.audio.core.sounddose-V1", "android.hardware.audio.effect-V1", "android.media.audio.common.types-V2", ], @@ -178,7 +178,7 @@ aidl_interface { "android.hardware.audio_defaults", ], srcs: [ - "android/hardware/audio/core/ISoundDose.aidl", + "android/hardware/audio/core/sounddose/ISoundDose.aidl", ], imports: [ "android.media.audio.common.types-V2", diff --git a/audio/aidl/aidl_api/android.hardware.audio.core.sounddose/current/android/hardware/audio/core/ISoundDose.aidl b/audio/aidl/aidl_api/android.hardware.audio.core.sounddose/current/android/hardware/audio/core/sounddose/ISoundDose.aidl similarity index 88% rename from audio/aidl/aidl_api/android.hardware.audio.core.sounddose/current/android/hardware/audio/core/ISoundDose.aidl rename to audio/aidl/aidl_api/android.hardware.audio.core.sounddose/current/android/hardware/audio/core/sounddose/ISoundDose.aidl index bc010caaf5..3b5d2d06cf 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core.sounddose/current/android/hardware/audio/core/ISoundDose.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core.sounddose/current/android/hardware/audio/core/sounddose/ISoundDose.aidl @@ -31,18 +31,18 @@ // 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.hardware.audio.core; +package android.hardware.audio.core.sounddose; @VintfStability interface ISoundDose { void setOutputRs2(float rs2ValueDbA); float getOutputRs2(); - void registerSoundDoseCallback(in android.hardware.audio.core.ISoundDose.IHalSoundDoseCallback callback); + void registerSoundDoseCallback(in android.hardware.audio.core.sounddose.ISoundDose.IHalSoundDoseCallback callback); const int DEFAULT_MAX_RS2 = 100; const int MIN_RS2 = 80; @VintfStability interface IHalSoundDoseCallback { oneway void onMomentaryExposureWarning(float currentDbA, in android.media.audio.common.AudioDevice audioDevice); - oneway void onNewMelValues(in android.hardware.audio.core.ISoundDose.IHalSoundDoseCallback.MelRecord melRecord, in android.media.audio.common.AudioDevice audioDevice); + oneway void onNewMelValues(in android.hardware.audio.core.sounddose.ISoundDose.IHalSoundDoseCallback.MelRecord melRecord, in android.media.audio.common.AudioDevice audioDevice); @VintfStability parcelable MelRecord { float[] melValues; diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl index 6a10295257..a029d43609 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl @@ -61,7 +61,7 @@ interface IModule { void updateAudioMode(android.hardware.audio.core.AudioMode mode); void updateScreenRotation(android.hardware.audio.core.IModule.ScreenRotation rotation); void updateScreenState(boolean isTurnedOn); - @nullable android.hardware.audio.core.ISoundDose getSoundDose(); + @nullable android.hardware.audio.core.sounddose.ISoundDose getSoundDose(); int generateHwAvSyncId(); android.hardware.audio.core.VendorParameter[] getVendorParameters(in @utf8InCpp String[] ids); void setVendorParameters(in android.hardware.audio.core.VendorParameter[] parameters, boolean async); diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ISoundDose.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ISoundDose.aidl deleted file mode 100644 index bc010caaf5..0000000000 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ISoundDose.aidl +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.audio.core; -@VintfStability -interface ISoundDose { - void setOutputRs2(float rs2ValueDbA); - float getOutputRs2(); - void registerSoundDoseCallback(in android.hardware.audio.core.ISoundDose.IHalSoundDoseCallback callback); - const int DEFAULT_MAX_RS2 = 100; - const int MIN_RS2 = 80; - @VintfStability - interface IHalSoundDoseCallback { - oneway void onMomentaryExposureWarning(float currentDbA, in android.media.audio.common.AudioDevice audioDevice); - oneway void onNewMelValues(in android.hardware.audio.core.ISoundDose.IHalSoundDoseCallback.MelRecord melRecord, in android.media.audio.common.AudioDevice audioDevice); - @VintfStability - parcelable MelRecord { - float[] melValues; - long timestamp; - } - } -} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamIn.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamIn.aidl index 68f1ff34fe..1041943446 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamIn.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamIn.aidl @@ -43,7 +43,7 @@ interface IStreamIn { void updateMetadata(in android.hardware.audio.common.SinkMetadata sinkMetadata); float[] getHwGain(); void setHwGain(in float[] channelGains); - const int MIC_FIELD_DIMENSION_WIDE_ANGLE = -1; + const int MIC_FIELD_DIMENSION_WIDE_ANGLE = (-1); const int MIC_FIELD_DIMENSION_NO_ZOOM = 0; const int MIC_FIELD_DIMENSION_MAX_ZOOM = 1; const int HW_GAIN_MIN = 0; diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneInfo.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneInfo.aidl index 68c7f880f8..b77afe32cb 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneInfo.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneInfo.aidl @@ -37,15 +37,15 @@ parcelable MicrophoneInfo { @utf8InCpp String id; android.media.audio.common.AudioDevice device; android.hardware.audio.core.MicrophoneInfo.Location location = android.hardware.audio.core.MicrophoneInfo.Location.UNKNOWN; - int group = -1; - int indexInTheGroup = -1; + int group = GROUP_UNKNOWN; + int indexInTheGroup = INDEX_IN_THE_GROUP_UNKNOWN; @nullable android.hardware.audio.core.MicrophoneInfo.Sensitivity sensitivity; android.hardware.audio.core.MicrophoneInfo.Directionality directionality = android.hardware.audio.core.MicrophoneInfo.Directionality.UNKNOWN; android.hardware.audio.core.MicrophoneInfo.FrequencyResponsePoint[] frequencyResponse; @nullable android.hardware.audio.core.MicrophoneInfo.Coordinate position; @nullable android.hardware.audio.core.MicrophoneInfo.Coordinate orientation; - const int GROUP_UNKNOWN = -1; - const int INDEX_IN_THE_GROUP_UNKNOWN = -1; + const int GROUP_UNKNOWN = (-1); + const int INDEX_IN_THE_GROUP_UNKNOWN = (-1); @Backing(type="int") @VintfStability enum Location { UNKNOWN = 0, diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl index 3a4271b89a..a65d7b7cea 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl @@ -39,12 +39,12 @@ parcelable StreamDescriptor { int frameSizeBytes; long bufferSizeFrames; android.hardware.audio.core.StreamDescriptor.AudioBuffer audio; - const int LATENCY_UNKNOWN = -1; + const int LATENCY_UNKNOWN = (-1); @FixedSize @VintfStability parcelable Position { - long frames = -1; - long timeNs = -1; - const long UNKNOWN = -1; + long frames = UNKNOWN; + long timeNs = UNKNOWN; + const long UNKNOWN = (-1); } @Backing(type="int") @VintfStability enum State { diff --git a/audio/aidl/android/hardware/audio/core/IModule.aidl b/audio/aidl/android/hardware/audio/core/IModule.aidl index f4ee1f327c..4779f1f3da 100644 --- a/audio/aidl/android/hardware/audio/core/IModule.aidl +++ b/audio/aidl/android/hardware/audio/core/IModule.aidl @@ -21,7 +21,6 @@ import android.hardware.audio.common.SourceMetadata; import android.hardware.audio.core.AudioMode; import android.hardware.audio.core.AudioPatch; import android.hardware.audio.core.AudioRoute; -import android.hardware.audio.core.ISoundDose; import android.hardware.audio.core.IStreamCallback; import android.hardware.audio.core.IStreamIn; import android.hardware.audio.core.IStreamOut; @@ -31,6 +30,7 @@ import android.hardware.audio.core.MicrophoneInfo; import android.hardware.audio.core.ModuleDebug; import android.hardware.audio.core.StreamDescriptor; import android.hardware.audio.core.VendorParameter; +import android.hardware.audio.core.sounddose.ISoundDose; import android.hardware.audio.effect.IEffect; import android.media.audio.common.AudioOffloadInfo; import android.media.audio.common.AudioPort; diff --git a/audio/aidl/android/hardware/audio/core/ISoundDose.aidl b/audio/aidl/android/hardware/audio/core/sounddose/ISoundDose.aidl similarity index 98% rename from audio/aidl/android/hardware/audio/core/ISoundDose.aidl rename to audio/aidl/android/hardware/audio/core/sounddose/ISoundDose.aidl index 89fd69b80f..953ab62bfe 100644 --- a/audio/aidl/android/hardware/audio/core/ISoundDose.aidl +++ b/audio/aidl/android/hardware/audio/core/sounddose/ISoundDose.aidl @@ -14,7 +14,7 @@ * limitations under the License. */ -package android.hardware.audio.core; +package android.hardware.audio.core.sounddose; import android.media.audio.common.AudioDevice; diff --git a/audio/aidl/default/Android.bp b/audio/aidl/default/Android.bp index 7a1f7cdcbe..8cd56c05c4 100644 --- a/audio/aidl/default/Android.bp +++ b/audio/aidl/default/Android.bp @@ -95,6 +95,7 @@ cc_binary { defaults: [ "aidlaudioservice_defaults", "latest_android_media_audio_common_types_ndk_shared", + "latest_android_hardware_audio_core_sounddose_ndk_shared", "latest_android_hardware_audio_core_ndk_shared", ], static_libs: [ diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp index 6a833c4848..b58c5621c4 100644 --- a/audio/aidl/default/Module.cpp +++ b/audio/aidl/default/Module.cpp @@ -32,6 +32,7 @@ using aidl::android::hardware::audio::common::SinkMetadata; using aidl::android::hardware::audio::common::SourceMetadata; +using aidl::android::hardware::audio::core::sounddose::ISoundDose; using aidl::android::media::audio::common::AudioChannelLayout; using aidl::android::media::audio::common::AudioDevice; using aidl::android::media::audio::common::AudioFormatDescription; @@ -946,7 +947,7 @@ ndk::ScopedAStatus Module::updateScreenState(bool in_isTurnedOn) { ndk::ScopedAStatus Module::getSoundDose(std::shared_ptr* _aidl_return) { if (mSoundDose == nullptr) { - mSoundDose = ndk::SharedRefBase::make(); + mSoundDose = ndk::SharedRefBase::make(); mSoundDoseBinder = mSoundDose->asBinder(); AIBinder_setMinSchedulerPolicy(mSoundDoseBinder.get(), SCHED_NORMAL, ANDROID_PRIORITY_AUDIO); diff --git a/audio/aidl/default/SoundDose.cpp b/audio/aidl/default/SoundDose.cpp index 3d222a8280..be9f93af92 100644 --- a/audio/aidl/default/SoundDose.cpp +++ b/audio/aidl/default/SoundDose.cpp @@ -20,7 +20,7 @@ #include -namespace aidl::android::hardware::audio::core { +namespace aidl::android::hardware::audio::core::sounddose { ndk::ScopedAStatus SoundDose::setOutputRs2(float in_rs2ValueDbA) { if (in_rs2ValueDbA < MIN_RS2 || in_rs2ValueDbA > DEFAULT_MAX_RS2) { @@ -54,4 +54,4 @@ ndk::ScopedAStatus SoundDose::registerSoundDoseCallback( return ndk::ScopedAStatus::ok(); } -} // namespace aidl::android::hardware::audio::core +} // namespace aidl::android::hardware::audio::core::sounddose diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h index ff45f8110a..faca61e481 100644 --- a/audio/aidl/default/include/core-impl/Module.h +++ b/audio/aidl/default/include/core-impl/Module.h @@ -88,7 +88,7 @@ class Module : public BnModule { ndk::ScopedAStatus updateScreenRotation( ::aidl::android::hardware::audio::core::IModule::ScreenRotation in_rotation) override; ndk::ScopedAStatus updateScreenState(bool in_isTurnedOn) override; - ndk::ScopedAStatus getSoundDose(std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus getSoundDose(std::shared_ptr* _aidl_return) override; ndk::ScopedAStatus generateHwAvSyncId(int32_t* _aidl_return) override; ndk::ScopedAStatus getVendorParameters(const std::vector& in_ids, std::vector* _aidl_return) override; @@ -140,7 +140,7 @@ class Module : public BnModule { bool mMasterMute = false; float mMasterVolume = 1.0f; bool mMicMute = false; - std::shared_ptr mSoundDose; + std::shared_ptr mSoundDose; ndk::SpAIBinder mSoundDoseBinder; }; diff --git a/audio/aidl/default/include/core-impl/SoundDose.h b/audio/aidl/default/include/core-impl/SoundDose.h index 54a6cbf1b8..306aa04d48 100644 --- a/audio/aidl/default/include/core-impl/SoundDose.h +++ b/audio/aidl/default/include/core-impl/SoundDose.h @@ -18,12 +18,12 @@ #include -#include +#include #include using aidl::android::media::audio::common::AudioDevice; -namespace aidl::android::hardware::audio::core { +namespace aidl::android::hardware::audio::core::sounddose { class SoundDose : public BnSoundDose { public: @@ -39,4 +39,4 @@ class SoundDose : public BnSoundDose { float mRs2Value; }; -} // namespace aidl::android::hardware::audio::core +} // namespace aidl::android::hardware::audio::core::sounddose diff --git a/audio/aidl/sounddose/aidl_api/android.hardware.audio.sounddose/current/android/hardware/audio/sounddose/ISoundDoseFactory.aidl b/audio/aidl/sounddose/aidl_api/android.hardware.audio.sounddose/current/android/hardware/audio/sounddose/ISoundDoseFactory.aidl index 7dda011ccd..148720ce4f 100644 --- a/audio/aidl/sounddose/aidl_api/android.hardware.audio.sounddose/current/android/hardware/audio/sounddose/ISoundDoseFactory.aidl +++ b/audio/aidl/sounddose/aidl_api/android.hardware.audio.sounddose/current/android/hardware/audio/sounddose/ISoundDoseFactory.aidl @@ -34,5 +34,5 @@ package android.hardware.audio.sounddose; @VintfStability interface ISoundDoseFactory { - @nullable android.hardware.audio.core.ISoundDose getSoundDose(in @utf8InCpp String module); + @nullable android.hardware.audio.core.sounddose.ISoundDose getSoundDose(in @utf8InCpp String module); } diff --git a/audio/aidl/sounddose/android/hardware/audio/sounddose/ISoundDoseFactory.aidl b/audio/aidl/sounddose/android/hardware/audio/sounddose/ISoundDoseFactory.aidl index 34872378c7..4079fe8c3e 100644 --- a/audio/aidl/sounddose/android/hardware/audio/sounddose/ISoundDoseFactory.aidl +++ b/audio/aidl/sounddose/android/hardware/audio/sounddose/ISoundDoseFactory.aidl @@ -16,7 +16,7 @@ package android.hardware.audio.sounddose; -import android.hardware.audio.core.ISoundDose; +import android.hardware.audio.core.sounddose.ISoundDose; /** * This interface is used to provide an easy way to implement the ISoundDose interface diff --git a/audio/aidl/sounddose/default/SoundDoseFactory.cpp b/audio/aidl/sounddose/default/SoundDoseFactory.cpp index 50796d0ce0..83a592b54e 100644 --- a/audio/aidl/sounddose/default/SoundDoseFactory.cpp +++ b/audio/aidl/sounddose/default/SoundDoseFactory.cpp @@ -23,7 +23,7 @@ namespace aidl::android::hardware::audio::sounddose { -using ::aidl::android::hardware::audio::core::SoundDose; +using ::aidl::android::hardware::audio::core::sounddose::SoundDose; ndk::ScopedAStatus SoundDoseFactory::getSoundDose(const std::string& in_module, std::shared_ptr* _aidl_return) { diff --git a/audio/aidl/sounddose/default/include/SoundDoseFactory.h b/audio/aidl/sounddose/default/include/SoundDoseFactory.h index 4cf3277fc7..ced4291411 100644 --- a/audio/aidl/sounddose/default/include/SoundDoseFactory.h +++ b/audio/aidl/sounddose/default/include/SoundDoseFactory.h @@ -16,7 +16,7 @@ #pragma once -#include +#include #include #include @@ -24,7 +24,7 @@ namespace aidl::android::hardware::audio::sounddose { -using ::aidl::android::hardware::audio::core::ISoundDose; +using ::aidl::android::hardware::audio::core::sounddose::ISoundDose; class SoundDoseFactory : public BnSoundDoseFactory { public: diff --git a/audio/aidl/sounddose/vts/VtsHalSoundDoseFactoryTargetTest.cpp b/audio/aidl/sounddose/vts/VtsHalSoundDoseFactoryTargetTest.cpp index 7448c1ff5f..df35bae086 100644 --- a/audio/aidl/sounddose/vts/VtsHalSoundDoseFactoryTargetTest.cpp +++ b/audio/aidl/sounddose/vts/VtsHalSoundDoseFactoryTargetTest.cpp @@ -47,7 +47,7 @@ inline ::testing::AssertionResult assertIsOk(const char* expr, const ::ndk::Scop using namespace android; -using aidl::android::hardware::audio::core::ISoundDose; +using aidl::android::hardware::audio::core::sounddose::ISoundDose; using aidl::android::hardware::audio::sounddose::ISoundDoseFactory; class SoundDoseFactory : public testing::TestWithParam { diff --git a/audio/aidl/vts/Android.bp b/audio/aidl/vts/Android.bp index 96e9971d2e..e154c073b3 100644 --- a/audio/aidl/vts/Android.bp +++ b/audio/aidl/vts/Android.bp @@ -44,6 +44,7 @@ cc_test { defaults: [ "VtsHalAudioTargetTestDefaults", "latest_android_hardware_audio_core_ndk_static", + "latest_android_hardware_audio_core_sounddose_ndk_static", ], shared_libs: [ "libcutils", diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp index 1b46498348..bd2c79d471 100644 --- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp @@ -36,8 +36,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -57,7 +57,6 @@ using aidl::android::hardware::audio::core::AudioMode; using aidl::android::hardware::audio::core::AudioPatch; using aidl::android::hardware::audio::core::AudioRoute; using aidl::android::hardware::audio::core::IModule; -using aidl::android::hardware::audio::core::ISoundDose; using aidl::android::hardware::audio::core::IStreamCommon; using aidl::android::hardware::audio::core::IStreamIn; using aidl::android::hardware::audio::core::IStreamOut; @@ -67,6 +66,7 @@ using aidl::android::hardware::audio::core::MicrophoneInfo; using aidl::android::hardware::audio::core::ModuleDebug; using aidl::android::hardware::audio::core::StreamDescriptor; using aidl::android::hardware::audio::core::VendorParameter; +using aidl::android::hardware::audio::core::sounddose::ISoundDose; using aidl::android::hardware::common::fmq::SynchronizedReadWrite; using aidl::android::media::audio::common::AudioContentType; using aidl::android::media::audio::common::AudioDevice; diff --git a/compatibility_matrices/exclude/fcm_exclude.cpp b/compatibility_matrices/exclude/fcm_exclude.cpp index cf1e138090..3c0c5f1d68 100644 --- a/compatibility_matrices/exclude/fcm_exclude.cpp +++ b/compatibility_matrices/exclude/fcm_exclude.cpp @@ -52,6 +52,7 @@ bool ShouldCheckMissingHalsInFcm(const std::string& package) { "android.hardware.radio.config@1.2", // AIDL "android.hardware.audio.common", + "android.hardware.audio.core.sounddose", "android.hardware.biometrics.common", "android.hardware.camera.metadata", "android.hardware.camera.device", From 42091764f9b35dabad9ef9c6e6b14f04c1456ab8 Mon Sep 17 00:00:00 2001 From: Nate Jiang Date: Tue, 27 Dec 2022 17:08:25 -0800 Subject: [PATCH 541/998] Fix the issue when convert byte to uint16 When convert byte to uint16, if the byte represent a negative number, the high 8 bit of the uint16 will be all 1, which causes a mismatch. Same as HIDL, convert byte to unit8 then fill into the uint16 Bug: 263690436 Test: cts SingleDeviceTest Change-Id: Id9462dce48d2a2558c6b5c104866da66ce951b0e --- wifi/aidl/default/aidl_struct_util.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index 22319aeddf..5e80ff9572 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -1718,7 +1718,7 @@ bool convertAidlNanPublishRequestToLegacy(const NanPublishRequest& aidl_request, } *legacy_request = {}; - legacy_request->publish_id = aidl_request.baseConfigs.sessionId; + legacy_request->publish_id = static_cast(aidl_request.baseConfigs.sessionId); legacy_request->ttl = aidl_request.baseConfigs.ttlSec; legacy_request->period = aidl_request.baseConfigs.discoveryWindowPeriod; legacy_request->publish_count = aidl_request.baseConfigs.discoveryCount; @@ -1860,7 +1860,7 @@ bool convertAidlNanSubscribeRequestToLegacy(const NanSubscribeRequest& aidl_requ } *legacy_request = {}; - legacy_request->subscribe_id = aidl_request.baseConfigs.sessionId; + legacy_request->subscribe_id = static_cast(aidl_request.baseConfigs.sessionId); legacy_request->ttl = aidl_request.baseConfigs.ttlSec; legacy_request->period = aidl_request.baseConfigs.discoveryWindowPeriod; legacy_request->subscribe_count = aidl_request.baseConfigs.discoveryCount; @@ -2007,7 +2007,7 @@ bool convertAidlNanTransmitFollowupRequestToLegacy( } *legacy_request = {}; - legacy_request->publish_subscribe_id = aidl_request.discoverySessionId; + legacy_request->publish_subscribe_id = static_cast(aidl_request.discoverySessionId); legacy_request->requestor_instance_id = aidl_request.peerId; memcpy(legacy_request->addr, aidl_request.addr.data(), 6); legacy_request->priority = aidl_request.isHighPriority ? legacy_hal::NAN_TX_PRIORITY_HIGH From 84f02c1346609cd2e123a4e27b137cc76d447cef Mon Sep 17 00:00:00 2001 From: Anthony Stange Date: Fri, 16 Dec 2022 17:43:40 +0000 Subject: [PATCH 542/998] Add APIs for Contexthub NAN support With current hardware limitations, WiFi chips are unable to support NAN session initialization without assistance of the WiFi framework. Update the Contexthub HAL APIs to allow Contexthubs to request the framework enable a NAN session on their behalf so they can make low power NAN requests to the initialized session without waking the main CPU. Bug: 229888878 Test: Update Contexthub HAL Change-Id: I47a6a1b0512099727c7343542c2aff814dc0d59a --- .../hardware/contexthub/IContextHub.aidl | 1 + .../contexthub/IContextHubCallback.aidl | 2 ++ .../hardware/contexthub/IContextHub.aidl | 13 ++++++++++++ .../contexthub/IContextHubCallback.aidl | 21 +++++++++++++++++++ 4 files changed, 37 insertions(+) diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl index 272d76823b..c1f4df868d 100644 --- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl @@ -46,5 +46,6 @@ interface IContextHub { void onHostEndpointConnected(in android.hardware.contexthub.HostEndpointInfo hostEndpointInfo); void onHostEndpointDisconnected(char hostEndpointId); long[] getPreloadedNanoappIds(); + void onNanSessionStateChanged(in boolean state); const int EX_CONTEXT_HUB_UNSPECIFIED = -1; } diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl index f81f7cfdee..e72ae73147 100644 --- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl @@ -38,4 +38,6 @@ interface IContextHubCallback { void handleContextHubMessage(in android.hardware.contexthub.ContextHubMessage msg, in String[] msgContentPerms); void handleContextHubAsyncEvent(in android.hardware.contexthub.AsyncEventType evt); void handleTransactionResult(in int transactionId, in boolean success); + void handleNanSessionRequest(in boolean enable); + const int CONTEXTHUB_NAN_TRANSACTION_TIMEOUT_MS = 10000; } diff --git a/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl index 9fa67a5aa1..7f507306f3 100644 --- a/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl +++ b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl @@ -203,6 +203,19 @@ interface IContextHub { */ long[] getPreloadedNanoappIds(); + /** + * Invoked when the state of the NAN session requested through handleNanSessionRequest() + * changes. This function may be invoked without a corresponding handleNanSessionRequest to + * indicate if a NAN session was terminated without a request due to resource limitations. + * + * If the state becomes disabled without an explicit request from the HAL, the HAL MUST + * explicitly invoke handleNanSessionRequest() at a later point in time to attempt to + * re-enable NAN. + * + * @param state True if the NAN session is currently enabled. + */ + void onNanSessionStateChanged(in boolean state); + /** * Error codes that are used as service specific errors with the AIDL return * value EX_SERVICE_SPECIFIC. diff --git a/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl b/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl index e385d48c55..cff18935c3 100644 --- a/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl +++ b/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl @@ -74,4 +74,25 @@ interface IContextHubCallback { * */ void handleTransactionResult(in int transactionId, in boolean success); + + /** + * This callback is passed by the Contexthub service to the HAL implementation to allow the HAL + * to request a WiFi NAN session is created to allow the Contexthub to be able to utilize NAN + * functionality. + * + * onNanSessionStateChanged() will be invoked asynchronously after the NAN session request has + * been completed. This must be done within CONTEXTHUB_NAN_TRANSACTION_TIMEOUT_MS. If the + * request times out, onNanSessionStateChanged() will be invoked with the state that the session + * was previously in. + * + * @param enable Whether the NAN session should be enabled or disabled depending on whether the + * Contexthub needs access to NAN. + */ + void handleNanSessionRequest(in boolean enable); + + /** + * Amount of time, in milliseconds, that a handleNanSessionRequest can be pending before the + * Contexthub service must respond. + */ + const int CONTEXTHUB_NAN_TRANSACTION_TIMEOUT_MS = 10000; } From 8a9f53e81182b784a335c1a4714443e6e4734783 Mon Sep 17 00:00:00 2001 From: Ray Chin Date: Thu, 29 Dec 2022 18:15:22 +0800 Subject: [PATCH 543/998] Fix null pointer dereference error for CtsTvTestCases against cf_x86_tv Bug: 263933383 Test: `atest CtsTvTestCases` against cf_x86_tv-userdebug Change-Id: Icf4f9909b574f3e6f474fd2bfd3e72f7f290a0fe --- tv/tuner/aidl/default/Frontend.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tv/tuner/aidl/default/Frontend.cpp b/tv/tuner/aidl/default/Frontend.cpp index 0573d08301..997d9de93a 100644 --- a/tv/tuner/aidl/default/Frontend.cpp +++ b/tv/tuner/aidl/default/Frontend.cpp @@ -182,7 +182,9 @@ Frontend::~Frontend() { // Reset callback mCallback = nullptr; mIsLocked = false; - mTuner->removeFrontend(mId); + if (mTuner != nullptr) { + mTuner->removeFrontend(mId); + } mTuner = nullptr; return ::ndk::ScopedAStatus::ok(); From 73b18ac9abebbb8a85fa4e787b918c804c4ab98c Mon Sep 17 00:00:00 2001 From: Kensuke Miyagi Date: Mon, 7 Nov 2022 10:49:09 -0800 Subject: [PATCH 544/998] Enable support for main type cap aware demux management Adding 3 ITuner.aidl APIs: - int[] getDemuxIds(); - IDemux openDemuxById(in int demuxId); - DemuxInfo getDemuxInfo(in int demuxId); And adding DemuxInfo.aidl. Bug: 239211919 Bug: 239227510 Test: atest VtsHalTvTunerTargetTest Change-Id: Icd34cc974a6f6fa167d90b69b3ff0a119bf50ae8 --- .../android/hardware/tv/tuner/DemuxInfo.aidl | 39 ++++++++ .../android/hardware/tv/tuner/ITuner.aidl | 3 + .../android/hardware/tv/tuner/DemuxInfo.aidl | 31 +++++++ .../android/hardware/tv/tuner/ITuner.aidl | 31 ++++++- tv/tuner/aidl/default/Demux.cpp | 22 ++++- tv/tuner/aidl/default/Demux.h | 11 ++- tv/tuner/aidl/default/Tuner.cpp | 93 +++++++++++++++++-- tv/tuner/aidl/default/Tuner.h | 10 +- tv/tuner/aidl/vts/functional/DemuxTests.cpp | 23 ++++- tv/tuner/aidl/vts/functional/DemuxTests.h | 4 + .../functional/VtsHalTvTunerTargetTest.cpp | 28 ++++++ 11 files changed, 276 insertions(+), 19 deletions(-) create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxInfo.aidl create mode 100644 tv/tuner/aidl/android/hardware/tv/tuner/DemuxInfo.aidl diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxInfo.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxInfo.aidl new file mode 100644 index 0000000000..872d9634d1 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxInfo.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxInfo { + int filterTypes = 0; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/ITuner.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/ITuner.aidl index 5d1d21513e..732f3fd952 100644 --- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/ITuner.aidl +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/ITuner.aidl @@ -48,4 +48,7 @@ interface ITuner { void setMaxNumberOfFrontends(in android.hardware.tv.tuner.FrontendType frontendType, in int maxNumber); int getMaxNumberOfFrontends(in android.hardware.tv.tuner.FrontendType frontendType); boolean isLnaSupported(); + int[] getDemuxIds(); + android.hardware.tv.tuner.IDemux openDemuxById(in int demuxId); + android.hardware.tv.tuner.DemuxInfo getDemuxInfo(in int demuxId); } diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxInfo.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxInfo.aidl new file mode 100644 index 0000000000..2720e2137e --- /dev/null +++ b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxInfo.aidl @@ -0,0 +1,31 @@ +/* + * Copyright 2021 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.hardware.tv.tuner; + +import android.hardware.tv.tuner.DemuxFilterMainType; + +/** + * Information for the Demux. + * @hide + */ +@VintfStability +parcelable DemuxInfo { + /** + * Bitwise OR of DemuxFilterMainTypes + */ + int filterTypes = DemuxFilterMainType.UNDEFINED; +} diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/ITuner.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/ITuner.aidl index 4a0b7a23ee..9ead7dddf9 100644 --- a/tv/tuner/aidl/android/hardware/tv/tuner/ITuner.aidl +++ b/tv/tuner/aidl/android/hardware/tv/tuner/ITuner.aidl @@ -17,6 +17,7 @@ package android.hardware.tv.tuner; import android.hardware.tv.tuner.DemuxCapabilities; +import android.hardware.tv.tuner.DemuxInfo; import android.hardware.tv.tuner.FrontendInfo; import android.hardware.tv.tuner.FrontendType; import android.hardware.tv.tuner.IDemux; @@ -65,7 +66,7 @@ interface ITuner { IDemux openDemux(out int[] demuxId); /** - * Retrieve the Demux's Capabilities. + * Retrieve the system wide Demux's Capabilities * * @return the Demux's Capabilities. */ @@ -158,4 +159,32 @@ interface ITuner { * @return true if supported, otherwise false */ boolean isLnaSupported(); + + /** + * Get Demux IDs + * + * It is used by the client to get all available demuxes' IDs. + * + * @return an array of IDs for the available Demuxes. + */ + int[] getDemuxIds(); + + /** + * Create a new instance of Demux given a demuxId. + * + * It is used by the client to create a demux instance. + * + * @param demuxId the id of the demux to be opened. + * + * @return the newly created demux interface. + */ + IDemux openDemuxById(in int demuxId); + + /** + * Retrieve the DemuxInfo of the specified Demux. + * + * @param demuxId the demux ID to query the DemuxInfo for. + * @return the DemuxInfo of the specified Demux by demuxId. + */ + DemuxInfo getDemuxInfo(in int demuxId); } diff --git a/tv/tuner/aidl/default/Demux.cpp b/tv/tuner/aidl/default/Demux.cpp index 60fd89981b..11e7131220 100644 --- a/tv/tuner/aidl/default/Demux.cpp +++ b/tv/tuner/aidl/default/Demux.cpp @@ -31,8 +31,12 @@ namespace tuner { #define WAIT_TIMEOUT 3000000000 -Demux::Demux(int32_t demuxId, std::shared_ptr tuner) { +Demux::Demux(int32_t demuxId, uint32_t filterTypes) { mDemuxId = demuxId; + mFilterTypes = filterTypes; +} + +void Demux::setTunerService(std::shared_ptr tuner) { mTuner = tuner; } @@ -346,6 +350,22 @@ uint16_t Demux::getFilterTpid(int64_t filterId) { return mFilters[filterId]->getTpid(); } +int32_t Demux::getDemuxId() { + return mDemuxId; +} + +bool Demux::isInUse() { + return mInUse; +} + +void Demux::setInUse(bool inUse) { + mInUse = inUse; +} + +void Demux::getDemuxInfo(DemuxInfo* demuxInfo) { + *demuxInfo = {.filterTypes = mFilterTypes}; +} + void Demux::startFrontendInputLoop() { ALOGD("[Demux] start frontend on demux"); // Stop current Frontend thread loop first, in case the user starts a new diff --git a/tv/tuner/aidl/default/Demux.h b/tv/tuner/aidl/default/Demux.h index 7f0b0a7d62..7d7aee4c89 100644 --- a/tv/tuner/aidl/default/Demux.h +++ b/tv/tuner/aidl/default/Demux.h @@ -53,7 +53,7 @@ class Tuner; class Demux : public BnDemux { public: - Demux(int32_t demuxId, std::shared_ptr tuner); + Demux(int32_t demuxId, uint32_t filterTypes); ~Demux(); ::ndk::ScopedAStatus setFrontendDataSource(int32_t in_frontendId) override; @@ -98,6 +98,12 @@ class Demux : public BnDemux { void sendFrontendInputToRecord(vector data, uint16_t pid, uint64_t pts); bool startRecordFilterDispatcher(); + void getDemuxInfo(DemuxInfo* demuxInfo); + int32_t getDemuxId(); + bool isInUse(); + void setInUse(bool inUse); + void setTunerService(std::shared_ptr tuner); + private: // Tuner service std::shared_ptr mTuner; @@ -183,6 +189,9 @@ class Demux : public BnDemux { vector mPesOutput; const bool DEBUG_DEMUX = false; + + int32_t mFilterTypes; + bool mInUse = false; }; } // namespace tuner diff --git a/tv/tuner/aidl/default/Tuner.cpp b/tv/tuner/aidl/default/Tuner.cpp index 8c715a0e12..0c1ae2da8a 100644 --- a/tv/tuner/aidl/default/Tuner.cpp +++ b/tv/tuner/aidl/default/Tuner.cpp @@ -17,6 +17,7 @@ //#define LOG_NDEBUG 0 #define LOG_TAG "android.hardware.tv.tuner-service.example-Tuner" +#include #include #include @@ -60,6 +61,16 @@ void Tuner::init() { mMaxUsableFrontends[FrontendType::ISDBS3] = 1; mMaxUsableFrontends[FrontendType::DTMB] = 1; + mDemuxes[0] = + ndk::SharedRefBase::make(0, (static_cast(DemuxFilterMainType::TS) | + static_cast(DemuxFilterMainType::MMTP) | + static_cast(DemuxFilterMainType::TLV))); + mDemuxes[1] = + ndk::SharedRefBase::make(1, (static_cast(DemuxFilterMainType::MMTP) | + static_cast(DemuxFilterMainType::TLV))); + mDemuxes[2] = ndk::SharedRefBase::make(2, static_cast(DemuxFilterMainType::IP)); + mDemuxes[3] = ndk::SharedRefBase::make(3, static_cast(DemuxFilterMainType::TS)); + mLnbs.resize(2); mLnbs[0] = ndk::SharedRefBase::make(0); mLnbs[1] = ndk::SharedRefBase::make(1); @@ -78,6 +89,28 @@ Tuner::~Tuner() {} return ::ndk::ScopedAStatus::ok(); } +::ndk::ScopedAStatus Tuner::getDemuxInfo(int32_t in_demuxId, DemuxInfo* _aidl_return) { + if (mDemuxes.find(in_demuxId) == mDemuxes.end()) { + return ::ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(Result::INVALID_ARGUMENT)); + } else { + mDemuxes[in_demuxId]->getDemuxInfo(_aidl_return); + return ::ndk::ScopedAStatus::ok(); + } +} + +::ndk::ScopedAStatus Tuner::getDemuxIds(std::vector* _aidl_return) { + ALOGV("%s", __FUNCTION__); + + int numOfDemuxes = mDemuxes.size(); + _aidl_return->resize(numOfDemuxes); + int i = 0; + for (auto e = mDemuxes.begin(); e != mDemuxes.end(); e++) { + (*_aidl_return)[i++] = e->first; + } + return ::ndk::ScopedAStatus::ok(); +} + ::ndk::ScopedAStatus Tuner::openFrontendById(int32_t in_frontendId, std::shared_ptr* _aidl_return) { ALOGV("%s", __FUNCTION__); @@ -94,17 +127,49 @@ Tuner::~Tuner() {} return ::ndk::ScopedAStatus::ok(); } +::ndk::ScopedAStatus Tuner::openDemuxById(int32_t in_demuxId, + std::shared_ptr* _aidl_return) { + ALOGV("%s", __FUNCTION__); + + if (mDemuxes.find(in_demuxId) == mDemuxes.end()) { + ALOGW("[ WARN ] Demux with id %d isn't available", in_demuxId); + *_aidl_return = nullptr; + return ::ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(Result::INVALID_ARGUMENT)); + } + + if (mDemuxes[in_demuxId]->isInUse()) { + return ::ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(Result::UNAVAILABLE)); + } else { + mDemuxes[in_demuxId]->setTunerService(this->ref()); + mDemuxes[in_demuxId]->setInUse(true); + + *_aidl_return = mDemuxes[in_demuxId]; + return ::ndk::ScopedAStatus::ok(); + } +} + ::ndk::ScopedAStatus Tuner::openDemux(std::vector* out_demuxId, std::shared_ptr* _aidl_return) { ALOGV("%s", __FUNCTION__); - mLastUsedId += 1; - mDemuxes[mLastUsedId] = ndk::SharedRefBase::make(mLastUsedId, this->ref()); + bool found = false; + int32_t demuxId = 0; + for (auto e = mDemuxes.begin(); e != mDemuxes.end(); e++) { + if (!e->second->isInUse()) { + found = true; + demuxId = e->second->getDemuxId(); + } + } - out_demuxId->push_back(mLastUsedId); - *_aidl_return = mDemuxes[mLastUsedId]; - - return ::ndk::ScopedAStatus::ok(); + if (found) { + out_demuxId->push_back(demuxId); + return openDemuxById(demuxId, _aidl_return); + } else { + return ::ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(Result::UNAVAILABLE)); + } } ::ndk::ScopedAStatus Tuner::getDemuxCaps(DemuxCapabilities* _aidl_return) { @@ -115,6 +180,18 @@ Tuner::~Tuner() {} // Support time filter testing _aidl_return->bTimeFilter = true; + // set filterCaps as the bitwize OR of all the demux' caps + std::vector demuxIds; + getDemuxIds(&demuxIds); + int32_t filterCaps = 0; + + for (int i = 0; i < demuxIds.size(); i++) { + DemuxInfo demuxInfo; + getDemuxInfo(demuxIds[i], &demuxInfo); + filterCaps |= demuxInfo.filterTypes; + } + _aidl_return->filterCaps = filterCaps; + return ::ndk::ScopedAStatus::ok(); } @@ -250,13 +327,13 @@ void Tuner::removeDemux(int32_t demuxId) { break; } } - mDemuxes.erase(demuxId); + mDemuxes[demuxId]->setInUse(false); } void Tuner::removeFrontend(int32_t frontendId) { map::iterator it = mFrontendToDemux.find(frontendId); if (it != mFrontendToDemux.end()) { - mDemuxes.erase(it->second); + mDemuxes[it->second]->setInUse(false); } mFrontendToDemux.erase(frontendId); } diff --git a/tv/tuner/aidl/default/Tuner.h b/tv/tuner/aidl/default/Tuner.h index a77c9304a1..26569336ef 100644 --- a/tv/tuner/aidl/default/Tuner.h +++ b/tv/tuner/aidl/default/Tuner.h @@ -46,7 +46,11 @@ class Tuner : public BnTuner { std::shared_ptr* _aidl_return) override; ::ndk::ScopedAStatus openDemux(std::vector* out_demuxId, std::shared_ptr* _aidl_return) override; + ::ndk::ScopedAStatus openDemuxById(int32_t in_demuxId, + std::shared_ptr* _aidl_return) override; ::ndk::ScopedAStatus getDemuxCaps(DemuxCapabilities* _aidl_return) override; + ::ndk::ScopedAStatus getDemuxInfo(int32_t in_demuxId, DemuxInfo* _aidl_return) override; + ::ndk::ScopedAStatus getDemuxIds(std::vector* _aidl_return) override; ::ndk::ScopedAStatus openDescrambler(std::shared_ptr* _aidl_return) override; ::ndk::ScopedAStatus getFrontendInfo(int32_t in_frontendId, FrontendInfo* _aidl_return) override; @@ -77,12 +81,10 @@ class Tuner : public BnTuner { // Static mFrontends array to maintain local frontends information map> mFrontends; map mFrontendToDemux; - map> mDemuxes; + map> mDemuxes; // use demuxId as the key in + // this sample implementation // To maintain how many Frontends we have int mFrontendSize; - // The last used demux id. Initial value is -1. - // First used id will be 0. - int32_t mLastUsedId = -1; vector> mLnbs; map mMaxUsableFrontends; }; diff --git a/tv/tuner/aidl/vts/functional/DemuxTests.cpp b/tv/tuner/aidl/vts/functional/DemuxTests.cpp index 9de01e1eab..b2fca6f7f1 100644 --- a/tv/tuner/aidl/vts/functional/DemuxTests.cpp +++ b/tv/tuner/aidl/vts/functional/DemuxTests.cpp @@ -16,6 +16,12 @@ #include "DemuxTests.h" +AssertionResult DemuxTests::getDemuxIds(std::vector& demuxIds) { + ndk::ScopedAStatus status; + status = mService->getDemuxIds(&demuxIds); + return AssertionResult(status.isOk()); +} + AssertionResult DemuxTests::openDemux(std::shared_ptr& demux, int32_t& demuxId) { std::vector id; auto status = mService->openDemux(&id, &mDemux); @@ -26,6 +32,14 @@ AssertionResult DemuxTests::openDemux(std::shared_ptr& demux, int32_t& d return AssertionResult(status.isOk()); } +AssertionResult DemuxTests::openDemuxById(int32_t demuxId, std::shared_ptr& demux) { + auto status = mService->openDemuxById(demuxId, &mDemux); + if (status.isOk()) { + demux = mDemux; + } + return AssertionResult(status.isOk()); +} + AssertionResult DemuxTests::setDemuxFrontendDataSource(int32_t frontendId) { EXPECT_TRUE(mDemux) << "Test with openDemux first."; auto status = mDemux->setFrontendDataSource(frontendId); @@ -33,14 +47,15 @@ AssertionResult DemuxTests::setDemuxFrontendDataSource(int32_t frontendId) { } AssertionResult DemuxTests::getDemuxCaps(DemuxCapabilities& demuxCaps) { - if (!mDemux) { - ALOGW("[vts] Test with openDemux first."); - return failure(); - } auto status = mService->getDemuxCaps(&demuxCaps); return AssertionResult(status.isOk()); } +AssertionResult DemuxTests::getDemuxInfo(int32_t demuxId, DemuxInfo& demuxInfo) { + auto status = mService->getDemuxInfo(demuxId, &demuxInfo); + return AssertionResult(status.isOk()); +} + AssertionResult DemuxTests::getAvSyncId(std::shared_ptr filter, int32_t& avSyncHwId) { EXPECT_TRUE(mDemux) << "Demux is not opened yet."; diff --git a/tv/tuner/aidl/vts/functional/DemuxTests.h b/tv/tuner/aidl/vts/functional/DemuxTests.h index 7698de33b3..b58cf70823 100644 --- a/tv/tuner/aidl/vts/functional/DemuxTests.h +++ b/tv/tuner/aidl/vts/functional/DemuxTests.h @@ -17,6 +17,7 @@ #pragma once #include +#include #include #include #include @@ -32,11 +33,14 @@ class DemuxTests { public: void setService(std::shared_ptr tuner) { mService = tuner; } + AssertionResult getDemuxIds(std::vector& demuxIds); AssertionResult openDemux(std::shared_ptr& demux, int32_t& demuxId); + AssertionResult openDemuxById(int32_t demuxId, std::shared_ptr& demux); AssertionResult setDemuxFrontendDataSource(int32_t frontendId); AssertionResult getAvSyncId(std::shared_ptr filter, int32_t& avSyncHwId); AssertionResult getAvSyncTime(int32_t avSyncId); AssertionResult getDemuxCaps(DemuxCapabilities& demuxCaps); + AssertionResult getDemuxInfo(int32_t demuxId, DemuxInfo& demuxInfo); AssertionResult closeDemux(); protected: diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp index 6aa1e162cf..9db82c893d 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.cpp @@ -695,6 +695,34 @@ TEST_P(TunerDemuxAidlTest, openDemux) { } } +TEST_P(TunerDemuxAidlTest, openDemuxById) { + description("Open (with id) and close a Demux."); + std::vector demuxIds; + ASSERT_TRUE(mDemuxTests.getDemuxIds(demuxIds)); + for (int i = 0; i < demuxIds.size(); i++) { + std::shared_ptr demux; + ASSERT_TRUE(mDemuxTests.openDemuxById(demuxIds[i], demux)); + ASSERT_TRUE(mDemuxTests.closeDemux()); + } +} + +TEST_P(TunerDemuxAidlTest, getDemuxInfo) { + description("Check getDemuxInfo against demux caps"); + std::vector demuxIds; + ASSERT_TRUE(mDemuxTests.getDemuxIds(demuxIds)); + int32_t combinedFilterTypes = 0; + for (int i = 0; i < demuxIds.size(); i++) { + DemuxInfo demuxInfo; + ASSERT_TRUE(mDemuxTests.getDemuxInfo(demuxIds[i], demuxInfo)); + combinedFilterTypes |= demuxInfo.filterTypes; + } + if (demuxIds.size() > 0) { + DemuxCapabilities demuxCaps; + ASSERT_TRUE(mDemuxTests.getDemuxCaps(demuxCaps)); + ASSERT_TRUE(demuxCaps.filterCaps == combinedFilterTypes); + } +} + TEST_P(TunerDemuxAidlTest, getAvSyncTime) { description("Get the A/V sync time from a PCR filter."); if (!live.hasFrontendConnection) { From 5d53aa3b75463d754a44040bdb15212a85dc8c73 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Tue, 13 Dec 2022 22:30:23 +0000 Subject: [PATCH 545/998] Add HAL changes for AUTOMATIC_EMERGENCY_BRAKING_ENABLED Bug: 261743473 Test: atest VtsHalAutomotiveVehicle_TargetTest atest CtsCarTestCases:CarPropertyManagerTest atest CtsCarTestCases:VehiclePropertyIdsTest Change-Id: I889c37a53949b5bd6cad7a376fab11b3dd455ebb --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 24 +++++++++++++++++++ .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 3 ++- .../java/ChangeModeForVehicleProperty.java | 3 ++- .../config/DefaultProperties.json | 8 +++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 +++++ 8 files changed, 45 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index c3b3e003a8..2a538523ef 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -231,4 +231,5 @@ enum VehicleProperty { GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT = 289410887, SUPPORTED_PROPERTY_IDS = 289476424, SHUTDOWN_REQUEST = 289410889, + AUTOMATIC_EMERGENCY_BRAKING_ENABLED = 287313920, } diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 4d0b77bb38..92cd811d14 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3296,4 +3296,28 @@ enum VehicleProperty { */ SHUTDOWN_REQUEST = 0x0F49 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + + /*************************************************************************** + * Start of ADAS Properties + * Allocate IDs in range of 0x1000 (inclusive) to 0x1100 (exclusive) for ADAS properties + **************************************************************************/ + + /** + * Enable or disable automatic emergency braking (AEB). + * + * Set true to enable AEB and false to disable AEB. When AEB is enabled, the ADAS system in the + * vehicle should be turned on and monitoring to avoid potential collisions. + * + * This property is defined as read_write, but OEMs have the option to implement it as read + * only. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + AUTOMATIC_EMERGENCY_BRAKING_ENABLED = + 0x1000 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + + /*************************************************************************** + * End of ADAS Properties + **************************************************************************/ } diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 75b371f9d3..6d70443199 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -231,6 +231,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyAccess::READ}, {VehicleProperty::SUPPORTED_PROPERTY_IDS, VehiclePropertyAccess::READ}, {VehicleProperty::SHUTDOWN_REQUEST, VehiclePropertyAccess::WRITE}, + {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess::READ_WRITE}, }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 6e797b91df..be441049db 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -231,6 +231,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::SUPPORTED_PROPERTY_IDS, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::SHUTDOWN_REQUEST, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 455d3d453f..8391dc85bd 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -222,7 +222,8 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.VEHICLE_CURB_WEIGHT, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.SUPPORTED_PROPERTY_IDS, VehiclePropertyAccess.READ), - Map.entry(VehicleProperty.SHUTDOWN_REQUEST, VehiclePropertyAccess.WRITE) + Map.entry(VehicleProperty.SHUTDOWN_REQUEST, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess.READ_WRITE) ); } diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index aaa344f6bd..f8a5bd1746 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -222,7 +222,8 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.VEHICLE_CURB_WEIGHT, VehiclePropertyChangeMode.STATIC), Map.entry(VehicleProperty.GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyChangeMode.STATIC), Map.entry(VehicleProperty.SUPPORTED_PROPERTY_IDS, VehiclePropertyChangeMode.STATIC), - Map.entry(VehicleProperty.SHUTDOWN_REQUEST, VehiclePropertyChangeMode.ON_CHANGE) + Map.entry(VehicleProperty.SHUTDOWN_REQUEST, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) ); } diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index c17a2e2aba..56a7b6da7d 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2897,6 +2897,14 @@ "GsrComplianceRequirementType::GSR_COMPLIANCE_REQUIRED_V1" ] } + }, + { + "property": "VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED", + "defaultValue": { + "int32Values": [ + 0 + ] + } } ] } diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 5595afe4ab..1a854aa6b4 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -601,6 +601,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySeatLumbarVerticalMoveConfig) { VehicleArea::SEAT, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAutomaticEmergencyBrakingEnabledConfig) { + verifyProperty(VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, + VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); +} + std::vector getDescriptors() { std::vector descriptors; for (std::string name : getAidlHalInstanceNames(IVehicle::descriptor)) { From f6abe359a88b10e96f5c34750df2726679496321 Mon Sep 17 00:00:00 2001 From: Sherri Lin Date: Fri, 30 Dec 2022 16:17:47 +0100 Subject: [PATCH 546/998] [Aware] Support set cluster id in AIDL Bug: 262872131 Test: ates android.net.wifi Change-Id: I08000c8200861c7fed191a079c5348158de41771 --- .../current/android/hardware/wifi/NanCapabilities.aidl | 1 + .../android/hardware/wifi/NanConfigRequestSupplemental.aidl | 1 + wifi/aidl/android/hardware/wifi/NanCapabilities.aidl | 4 ++++ .../android/hardware/wifi/NanConfigRequestSupplemental.aidl | 4 ++++ wifi/aidl/default/aidl_struct_util.cpp | 3 +++ 5 files changed, 13 insertions(+) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl index 5b59945ac3..cb5a95cc6c 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl @@ -52,4 +52,5 @@ parcelable NanCapabilities { boolean supports6g; boolean supportsHe; boolean supportsPairing; + boolean supportsSetClusterId; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanConfigRequestSupplemental.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanConfigRequestSupplemental.aidl index 682699e7f4..99f2af771e 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanConfigRequestSupplemental.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanConfigRequestSupplemental.aidl @@ -40,4 +40,5 @@ parcelable NanConfigRequestSupplemental { boolean enableRanging; boolean enableInstantCommunicationMode; int instantModeChannel; + int clusterId; } diff --git a/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl b/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl index 0955b4cd9d..4160176a29 100644 --- a/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl +++ b/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl @@ -97,4 +97,8 @@ parcelable NanCapabilities { * Flag to indicate if NAN pairing is supported. */ boolean supportsPairing; + /** + * Flag to indicate if NAN setting cluster ID is supported. + */ + boolean supportsSetClusterId; } diff --git a/wifi/aidl/android/hardware/wifi/NanConfigRequestSupplemental.aidl b/wifi/aidl/android/hardware/wifi/NanConfigRequestSupplemental.aidl index eb01a9f731..338a549aeb 100644 --- a/wifi/aidl/android/hardware/wifi/NanConfigRequestSupplemental.aidl +++ b/wifi/aidl/android/hardware/wifi/NanConfigRequestSupplemental.aidl @@ -60,4 +60,8 @@ parcelable NanConfigRequestSupplemental { * Controls which channel NAN instant communication mode operates on. */ int instantModeChannel; + /** + * Controls which cluster to join. + */ + int clusterId; } diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index 5e80ff9572..6869ac3c04 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -1706,6 +1706,8 @@ bool convertAidlNanConfigRequestToLegacy(const NanConfigRequest& aidl_request1, legacy_request->enable_instant_mode = aidl_request2.enableInstantCommunicationMode; legacy_request->config_instant_mode_channel = 1; legacy_request->instant_mode_channel = aidl_request2.instantModeChannel; + legacy_request->config_cluster_id = 1; + legacy_request->cluster_id_val = aidl_request2.clusterId; return true; } @@ -2245,6 +2247,7 @@ bool convertLegacyNanCapabilitiesResponseToAidl(const legacy_hal::NanCapabilitie aidl_response->supports6g = legacy_response.is_6g_supported; aidl_response->supportsHe = legacy_response.is_he_supported; aidl_response->supportsPairing = legacy_response.is_pairing_supported; + aidl_response->supportsSetClusterId = legacy_response.is_set_cluster_id_supported; return true; } From b1680a7bb25cf42efedd98a7f897c1722b400e6f Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Wed, 14 Dec 2022 23:28:49 +0000 Subject: [PATCH 547/998] Add HAL changes for LANE_CENTERING_ASSIST_ENABLED Bug: 261743713 Test: atest VtsHalAutomotiveVehicle_TargetTest atest CtsCarTestCases:CarPropertyManagerTest atest CtsCarTestCases:VehiclePropertyIdsTest Change-Id: I16ea4aa8b21fe6e361afec36f9b4b0f751337757 --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 21 +++++++++++++++++++ .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 3 ++- .../java/ChangeModeForVehicleProperty.java | 3 ++- .../config/DefaultProperties.json | 8 +++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 42 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 2a538523ef..ad3732171d 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -232,4 +232,5 @@ enum VehicleProperty { SUPPORTED_PROPERTY_IDS = 289476424, SHUTDOWN_REQUEST = 289410889, AUTOMATIC_EMERGENCY_BRAKING_ENABLED = 287313920, + LANE_CENTERING_ASSIST_ENABLED = 287313930, } diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 92cd811d14..e3ed4cff53 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3317,6 +3317,27 @@ enum VehicleProperty { AUTOMATIC_EMERGENCY_BRAKING_ENABLED = 0x1000 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Enable or disable lane centering assist (LCA). + * + * Set true to enable LCA and false to disable LCA. When LCA is enabled, the ADAS system in the + * vehicle should be turned on and waiting for an activation signal from the driver. Once the + * feature is activated, the ADAS system should be steering the vehicle to keep it centered in + * its current lane. + * + * This is different from Lane Keep Assist (LKA) which monitors if the driver unintentionally + * drifts toward or over the lane marking. If an unintentional lane departure is detected, the + * system applies steering control to return the vehicle into the current lane. + * + * This property is defined as read_write, but OEMs have the option to implement it as read + * only. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + LANE_CENTERING_ASSIST_ENABLED = + 0x100A + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /*************************************************************************** * End of ADAS Properties **************************************************************************/ diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 6d70443199..1d320f4ec8 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -232,6 +232,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::SUPPORTED_PROPERTY_IDS, VehiclePropertyAccess::READ}, {VehicleProperty::SHUTDOWN_REQUEST, VehiclePropertyAccess::WRITE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index be441049db..2ed60a5237 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -232,6 +232,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::SUPPORTED_PROPERTY_IDS, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::SHUTDOWN_REQUEST, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 8391dc85bd..f17cf78af7 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -223,7 +223,8 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.SUPPORTED_PROPERTY_IDS, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.SHUTDOWN_REQUEST, VehiclePropertyAccess.WRITE), - Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess.READ_WRITE) + Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE) ); } diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index f8a5bd1746..e932d4393a 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -223,7 +223,8 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyChangeMode.STATIC), Map.entry(VehicleProperty.SUPPORTED_PROPERTY_IDS, VehiclePropertyChangeMode.STATIC), Map.entry(VehicleProperty.SHUTDOWN_REQUEST, VehiclePropertyChangeMode.ON_CHANGE), - Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) + Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) ); } diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 56a7b6da7d..b8ab674853 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2905,6 +2905,14 @@ 0 ] } + }, + { + "property": "VehicleProperty::LANE_CENTERING_ASSIST_ENABLED", + "defaultValue": { + "int32Values": [ + 0 + ] + } } ] } diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 1a854aa6b4..01fc1de3db 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -607,6 +607,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAutomaticEmergencyBrakingEnabled VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistEnabledConfig) { + verifyProperty(VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, + VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); +} + std::vector getDescriptors() { std::vector descriptors; for (std::string name : getAidlHalInstanceNames(IVehicle::descriptor)) { From a251367e6565e9827390d2b7156f7248b6d638ee Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Thu, 15 Dec 2022 00:55:27 +0000 Subject: [PATCH 548/998] Add HAL changes for FORWARD_COLLISION_WARNING_ENABLED Bug: 261743618 Test: atest VtsHalAutomotiveVehicle_TargetTest atest CtsCarTestCases:CarPropertyManagerTest atest CtsCarTestCases:VehiclePropertyIdsTest Change-Id: I37cbb2830732ab6c8cc918d7d83725bf4a618bb0 --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 15 +++++++++++++++ .../generated_lib/cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../default_config/config/DefaultProperties.json | 8 ++++++++ .../src/VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 34 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index ad3732171d..a6b42da7b8 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -232,5 +232,6 @@ enum VehicleProperty { SUPPORTED_PROPERTY_IDS = 289476424, SHUTDOWN_REQUEST = 289410889, AUTOMATIC_EMERGENCY_BRAKING_ENABLED = 287313920, + FORWARD_COLLISION_WARNING_ENABLED = 287313922, LANE_CENTERING_ASSIST_ENABLED = 287313930, } diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index e3ed4cff53..b266d7b1b2 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3317,6 +3317,21 @@ enum VehicleProperty { AUTOMATIC_EMERGENCY_BRAKING_ENABLED = 0x1000 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Enable or disable forward collision warning (FCW). + * + * Set true to enable FCW and false to disable FCW. When FCW is enabled, the ADAS system in the + * vehicle should be turned on and monitoring for potential collisions. + * + * This property is defined as read_write, but OEMs have the option to implement it as read + * only. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + FORWARD_COLLISION_WARNING_ENABLED = + 0x1002 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** * Enable or disable lane centering assist (LCA). * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 1d320f4ec8..7b5043ccad 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -232,6 +232,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::SUPPORTED_PROPERTY_IDS, VehiclePropertyAccess::READ}, {VehicleProperty::SHUTDOWN_REQUEST, VehiclePropertyAccess::WRITE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 2ed60a5237..3dfdf301ad 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -232,6 +232,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::SUPPORTED_PROPERTY_IDS, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::SHUTDOWN_REQUEST, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index f17cf78af7..7627a4c9e8 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -224,6 +224,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.SUPPORTED_PROPERTY_IDS, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.SHUTDOWN_REQUEST, VehiclePropertyAccess.WRITE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE) ); diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index e932d4393a..366466d477 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -224,6 +224,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.SUPPORTED_PROPERTY_IDS, VehiclePropertyChangeMode.STATIC), Map.entry(VehicleProperty.SHUTDOWN_REQUEST, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) ); diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index b8ab674853..5d363479bc 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2906,6 +2906,14 @@ ] } }, + { + "property": "VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED", + "defaultValue": { + "int32Values": [ + 0 + ] + } + }, { "property": "VehicleProperty::LANE_CENTERING_ASSIST_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 01fc1de3db..98681be8f7 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -607,6 +607,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAutomaticEmergencyBrakingEnabled VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyForwardCollisionWarningEnabledConfig) { + verifyProperty(VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, + VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistEnabledConfig) { verifyProperty(VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, From 3f7177a9e1110f447a04f500cc8bb8c88f7e6ce7 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Sat, 17 Dec 2022 09:20:00 -0800 Subject: [PATCH 549/998] Add HAL changes for BLIND_SPOT_WARNING_ENABLED Bug: 261743498 Test: atest VtsHalAutomotiveVehicle_TargetTest atest CtsCarTestCases:CarPropertyManagerTest atest CtsCarTestCases:VehiclePropertyIdsTest Change-Id: I311d832c3926a764d2d817977b275e8b85c47987 --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 15 +++++++++++++++ .../generated_lib/cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../default_config/config/DefaultProperties.json | 8 ++++++++ .../src/VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 34 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index a6b42da7b8..6b87a5a762 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -233,5 +233,6 @@ enum VehicleProperty { SHUTDOWN_REQUEST = 289410889, AUTOMATIC_EMERGENCY_BRAKING_ENABLED = 287313920, FORWARD_COLLISION_WARNING_ENABLED = 287313922, + BLIND_SPOT_WARNING_ENABLED = 287313924, LANE_CENTERING_ASSIST_ENABLED = 287313930, } diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index b266d7b1b2..d8d8a906a8 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3332,6 +3332,21 @@ enum VehicleProperty { FORWARD_COLLISION_WARNING_ENABLED = 0x1002 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Enable and disable blind spot warning (BSW). + * + * Set true to enable BSW and false to disable BSW. When BSW is enabled, the ADAS system in the + * vehicle should be turned on and monitoring for objects in the vehicle’s blind spots. + * + * This property is defined as read_write, but OEMs have the option to implement it as read + * only. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + BLIND_SPOT_WARNING_ENABLED = + 0x1004 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** * Enable or disable lane centering assist (LCA). * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 7b5043ccad..5be80f3da5 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -233,6 +233,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::SHUTDOWN_REQUEST, VehiclePropertyAccess::WRITE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 3dfdf301ad..d3fdcedb9f 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -233,6 +233,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::SHUTDOWN_REQUEST, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 7627a4c9e8..1344a2ea97 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -225,6 +225,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.SHUTDOWN_REQUEST, VehiclePropertyAccess.WRITE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE) ); diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 366466d477..1547937acd 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -225,6 +225,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.SHUTDOWN_REQUEST, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) ); diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 5d363479bc..0a49767265 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2914,6 +2914,14 @@ ] } }, + { + "property": "VehicleProperty::BLIND_SPOT_WARNING_ENABLED", + "defaultValue": { + "int32Values": [ + 0 + ] + } + }, { "property": "VehicleProperty::LANE_CENTERING_ASSIST_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 98681be8f7..b955a3c63e 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -613,6 +613,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyForwardCollisionWarningEnabledCo VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyBlindSpotWarningEnabledConfig) { + verifyProperty(VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistEnabledConfig) { verifyProperty(VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, From 7a46cef00f659c6ec0410f6db14f90a9580423d6 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Sat, 17 Dec 2022 10:00:59 -0800 Subject: [PATCH 550/998] Add HAL changes for LANE_DEPARTURE_WARNING_ENABLED Bug: 261743848 Test: atest VtsHalAutomotiveVehicle_TargetTest atest CtsCarTestCases:CarPropertyManagerTest atest CtsCarTestCases:VehiclePropertyIdsTest Change-Id: Ic9ea2df2a4b729619307f6aa12667d46ba4baa19 --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 16 ++++++++++++++++ .../generated_lib/cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../default_config/config/DefaultProperties.json | 8 ++++++++ .../src/VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 35 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 6b87a5a762..76a9b476fc 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -234,5 +234,6 @@ enum VehicleProperty { AUTOMATIC_EMERGENCY_BRAKING_ENABLED = 287313920, FORWARD_COLLISION_WARNING_ENABLED = 287313922, BLIND_SPOT_WARNING_ENABLED = 287313924, + LANE_DEPARTURE_WARNING_ENABLED = 287313926, LANE_CENTERING_ASSIST_ENABLED = 287313930, } diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index d8d8a906a8..79593eb95e 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3347,6 +3347,22 @@ enum VehicleProperty { BLIND_SPOT_WARNING_ENABLED = 0x1004 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Enable or disable lane departure warning (LDW). + * + * Set true to enable LDW and false to disable LDW. When LDW is enabled, the ADAS system in the + * vehicle should be turned on and monitoring if the vehicle is approaching or crossing lane + * lines, in which case a warning will be given. + * + * This property is defined as read_write, but OEMs have the option to implement it as read + * only. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + LANE_DEPARTURE_WARNING_ENABLED = + 0x1006 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** * Enable or disable lane centering assist (LCA). * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 5be80f3da5..f768847f09 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -234,6 +234,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index d3fdcedb9f..4d954f4752 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -234,6 +234,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 1344a2ea97..f513f023e1 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -226,6 +226,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE) ); diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 1547937acd..00a826a869 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -226,6 +226,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) ); diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 0a49767265..dd200392a3 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2922,6 +2922,14 @@ ] } }, + { + "property": "VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED", + "defaultValue": { + "int32Values": [ + 0 + ] + } + }, { "property": "VehicleProperty::LANE_CENTERING_ASSIST_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index b955a3c63e..1a49796165 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -619,6 +619,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyBlindSpotWarningEnabledConfig) { VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneDepartureWarningEnabledConfig) { + verifyProperty(VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, + VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistEnabledConfig) { verifyProperty(VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, From 19207b635048c66b6b2dfd9210a304d313f18520 Mon Sep 17 00:00:00 2001 From: Tyler Trephan Date: Tue, 3 Jan 2023 22:53:49 +0000 Subject: [PATCH 551/998] Updated HVAC_TEMPERATURE_SET configArray ranges Test: atest CarPropertyManagerTest Bug: 264304693 Change-Id: I83c2baef2cf76318bb75c90007986e2d75fd9493 --- .../aidl/impl/default_config/config/DefaultProperties.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index c17a2e2aba..10e4a64902 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1982,8 +1982,8 @@ 160, 280, 5, - 605, - 825, + 600, + 840, 10 ] }, From 0dc7ba0df90bf21d83b4ecda184241cf2c1c4fd3 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Thu, 10 Nov 2022 14:28:09 -0800 Subject: [PATCH 552/998] Add HAL changes for STEERING_WHEEL_LIGHTS_STATE Bug: 257268085 Test: atest VtsHalAutomotiveVehicle_TargetTest atest CtsCarTestCases:CarPropertyManagerTest atest CtsCarTestCases:VehiclePropertyIdsTest Change-Id: I64cbf203e806b8f74b8e26c68273da5a21bf4070 --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 21 +++++++++++++++++++ .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../config/DefaultProperties.json | 17 +++++++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 49 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 2a538523ef..103d856f2d 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -195,6 +195,7 @@ enum VehicleProperty { CABIN_LIGHTS_SWITCH = 289410818, READING_LIGHTS_STATE = 356519683, READING_LIGHTS_SWITCH = 356519684, + STEERING_WHEEL_LIGHTS_STATE = 289410828, SUPPORT_CUSTOMIZE_VENDOR_PERMISSION = 287313669, DISABLED_OPTIONAL_FEATURES = 286265094, INITIAL_USER_INFO = 299896583, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 92cd811d14..b563de53fb 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -2413,6 +2413,27 @@ enum VehicleProperty { */ READING_LIGHTS_SWITCH = 0x0F04 + 0x10000000 + 0x05000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:INT32 + /** + * Steering wheel lights state + * + * Represents the current state of the steering wheel lights. This is different from + * STEERING_WHEEL_LIGHTS_SWITCH which represents the position of the switch controlling + * the lights. Therefore, STEERING_WHEEL_LIGHTS_STATE may not match the value of + * STEERING_WHEEL_LIGHTS_SWITCH (e.g. STEERING_WHEEL_LIGHTS_SWITCH=AUTOMATIC and + * STEERING_WHEEL_LIGHTS_STATE=ON). + * + * This property should only be implemented if STEERING_WHEEL_LIGHTS_STATE's value may be + * different from that of CABIN_LIGHTS_STATE. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues must be defined unless + * all enum values of VehicleLightState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum VehicleLightState + */ + STEERING_WHEEL_LIGHTS_STATE = + 0x0F0C + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, /** * Support customize permissions for vendor properties * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 6d70443199..593414b0e8 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -195,6 +195,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::CABIN_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::READING_LIGHTS_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::READING_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::STEERING_WHEEL_LIGHTS_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::SUPPORT_CUSTOMIZE_VENDOR_PERMISSION, VehiclePropertyAccess::READ}, {VehicleProperty::DISABLED_OPTIONAL_FEATURES, VehiclePropertyAccess::READ}, {VehicleProperty::INITIAL_USER_INFO, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index be441049db..1aee5dd61e 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -195,6 +195,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::CABIN_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::READING_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::READING_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::STEERING_WHEEL_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SUPPORT_CUSTOMIZE_VENDOR_PERMISSION, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::DISABLED_OPTIONAL_FEATURES, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::INITIAL_USER_INFO, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 8391dc85bd..646ed5f1c3 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -187,6 +187,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.CABIN_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.READING_LIGHTS_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.READING_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.STEERING_WHEEL_LIGHTS_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.SUPPORT_CUSTOMIZE_VENDOR_PERMISSION, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.DISABLED_OPTIONAL_FEATURES, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.INITIAL_USER_INFO, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index f8a5bd1746..749141ecd3 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -187,6 +187,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.CABIN_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.READING_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.READING_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.STEERING_WHEEL_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SUPPORT_CUSTOMIZE_VENDOR_PERMISSION, VehiclePropertyChangeMode.STATIC), Map.entry(VehicleProperty.DISABLED_OPTIONAL_FEATURES, VehiclePropertyChangeMode.STATIC), Map.entry(VehicleProperty.INITIAL_USER_INFO, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 56a7b6da7d..20f261cef8 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2706,6 +2706,23 @@ } ] }, + { + "property": "VehicleProperty::STEERING_WHEEL_LIGHTS_STATE", + "defaultValue": { + "int32Values": [ + "Constants::LIGHT_STATE_ON" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "Constants::LIGHT_STATE_OFF", + "Constants::LIGHT_STATE_ON" + ] + } + ] + }, { "property": "VehicleProperty::HEADLIGHTS_SWITCH", "defaultValue": { diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 1a854aa6b4..7623b92f67 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -547,6 +547,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelEasyAccessEnabledCo VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelLightsStateConfig) { + verifyProperty(VehicleProperty::STEERING_WHEEL_LIGHTS_STATE, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyMirrorAutoFoldEnabledConfig) { verifyProperty(VehicleProperty::MIRROR_AUTO_FOLD_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From 4b8688ff02c2c7385a00213babeebf6bd843fe02 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Tue, 15 Nov 2022 15:13:35 -0800 Subject: [PATCH 553/998] Add HAL changes for STEERING_WHEEL_LIGHTS_SWITCH Bug: 257268261 Test: atest VtsHalAutomotiveVehicle_TargetTest atest CtsCarTestCases:CarPropertyManagerTest atest CtsCarTestCases:VehiclePropertyIdsTest Change-Id: Ic9aadf4adfaf38cdcb80bf0ea4d500ac1855e666 --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 21 +++++++++++++++++++ .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../JsonConfigLoader/src/JsonConfigLoader.cpp | 1 + .../config/DefaultProperties.json | 18 ++++++++++++++++ .../impl/utils/common/include/PropertyUtils.h | 1 + .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 10 files changed, 52 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 103d856f2d..59b00ceffe 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -196,6 +196,7 @@ enum VehicleProperty { READING_LIGHTS_STATE = 356519683, READING_LIGHTS_SWITCH = 356519684, STEERING_WHEEL_LIGHTS_STATE = 289410828, + STEERING_WHEEL_LIGHTS_SWITCH = 289410829, SUPPORT_CUSTOMIZE_VENDOR_PERMISSION = 287313669, DISABLED_OPTIONAL_FEATURES = 286265094, INITIAL_USER_INFO = 299896583, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index b563de53fb..7d1469430f 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -2434,6 +2434,27 @@ enum VehicleProperty { */ STEERING_WHEEL_LIGHTS_STATE = 0x0F0C + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** + * Steering wheel lights switch + * + * Represents the position of the switch controlling the steering wheel lights. This is + * different from STEERING_WHEEL_LIGHTS_STATE which represents the current state of the steering + * wheel lights. Therefore, STEERING_WHEEL_LIGHTS_SWITCH may not match the value of + * STEERING_WHEEL_LIGHTS_STATE (e.g. STEERING_WHEEL_LIGHTS_SWITCH=AUTOMATIC and + * STEERING_WHEEL_LIGHTS_STATE=ON). + * + * This property should only be implemented if STEERING_WHEEL_LIGHTS_SWITCH's value may be + * different from that of CABIN_LIGHTS_SWITCH. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues must be defined unless + * all enum values of VehicleLightSwitch are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + * @data_enum VehicleLightSwitch + */ + STEERING_WHEEL_LIGHTS_SWITCH = + 0x0F0D + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, /** * Support customize permissions for vendor properties * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 593414b0e8..eb661a4371 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -196,6 +196,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::READING_LIGHTS_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::READING_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::STEERING_WHEEL_LIGHTS_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::STEERING_WHEEL_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::SUPPORT_CUSTOMIZE_VENDOR_PERMISSION, VehiclePropertyAccess::READ}, {VehicleProperty::DISABLED_OPTIONAL_FEATURES, VehiclePropertyAccess::READ}, {VehicleProperty::INITIAL_USER_INFO, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 1aee5dd61e..e33a070ef4 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -196,6 +196,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::READING_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::READING_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_LIGHTS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::STEERING_WHEEL_LIGHTS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::SUPPORT_CUSTOMIZE_VENDOR_PERMISSION, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::DISABLED_OPTIONAL_FEATURES, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::INITIAL_USER_INFO, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 646ed5f1c3..6a3f2810b2 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -188,6 +188,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.READING_LIGHTS_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.READING_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.STEERING_WHEEL_LIGHTS_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.STEERING_WHEEL_LIGHTS_SWITCH, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.SUPPORT_CUSTOMIZE_VENDOR_PERMISSION, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.DISABLED_OPTIONAL_FEATURES, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.INITIAL_USER_INFO, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 749141ecd3..d31bbf3dea 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -188,6 +188,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.READING_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.READING_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_LIGHTS_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.STEERING_WHEEL_LIGHTS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.SUPPORT_CUSTOMIZE_VENDOR_PERMISSION, VehiclePropertyChangeMode.STATIC), Map.entry(VehicleProperty.DISABLED_OPTIONAL_FEATURES, VehiclePropertyChangeMode.STATIC), Map.entry(VehicleProperty.INITIAL_USER_INFO, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index 20048a245d..d02e4f4c98 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -107,6 +107,7 @@ const std::unordered_map CONSTANTS_BY_NAME = { {"LIGHT_STATE_ON", LIGHT_STATE_ON}, {"LIGHT_STATE_OFF", LIGHT_STATE_OFF}, {"LIGHT_SWITCH_OFF", LIGHT_SWITCH_OFF}, + {"LIGHT_SWITCH_ON", LIGHT_SWITCH_ON}, {"LIGHT_SWITCH_AUTO", LIGHT_SWITCH_AUTO}, {"MIRROR_DRIVER_LEFT_RIGHT", toInt(VehicleAreaMirror::DRIVER_LEFT) | toInt(VehicleAreaMirror::DRIVER_RIGHT)}, diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 20f261cef8..64f412fe7b 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2796,6 +2796,24 @@ } ] }, + { + "property": "VehicleProperty::STEERING_WHEEL_LIGHTS_SWITCH", + "defaultValue": { + "int32Values": [ + "Constants::LIGHT_SWITCH_AUTO" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "Constants::LIGHT_SWITCH_OFF", + "Constants::LIGHT_SWITCH_ON", + "Constants::LIGHT_SWITCH_AUTO" + ] + } + ] + }, { "property": "VehicleProperty::EVS_SERVICE_REQUEST", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h b/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h index bf27c95c94..2b2a592295 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/PropertyUtils.h @@ -98,6 +98,7 @@ constexpr int CHARGE_PORT_REAR_LEFT = toInt(propertyutils_impl::PortLocationType constexpr int LIGHT_STATE_ON = toInt(propertyutils_impl::VehicleLightState::ON); constexpr int LIGHT_STATE_OFF = toInt(propertyutils_impl::VehicleLightState::OFF); constexpr int LIGHT_SWITCH_OFF = toInt(propertyutils_impl::VehicleLightSwitch::OFF); +constexpr int LIGHT_SWITCH_ON = toInt(propertyutils_impl::VehicleLightSwitch::ON); constexpr int LIGHT_SWITCH_AUTO = toInt(propertyutils_impl::VehicleLightSwitch::AUTOMATIC); constexpr int WHEEL_FRONT_LEFT = toInt(propertyutils_impl::VehicleAreaWheel::LEFT_FRONT); constexpr int WHEEL_FRONT_RIGHT = toInt(propertyutils_impl::VehicleAreaWheel::RIGHT_FRONT); diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 7623b92f67..2eb7e8a3f9 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -553,6 +553,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelLightsStateConfig) VehicleArea::GLOBAL, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelLightsSwitchConfig) { + verifyProperty(VehicleProperty::STEERING_WHEEL_LIGHTS_SWITCH, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyMirrorAutoFoldEnabledConfig) { verifyProperty(VehicleProperty::MIRROR_AUTO_FOLD_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From 668df368a5b3a533b88013e3846240f113eea0fe Mon Sep 17 00:00:00 2001 From: shrikar Date: Tue, 20 Dec 2022 22:08:17 +0000 Subject: [PATCH 554/998] Added EMERGENCY_LANE_KEEP_ASSIST_ENABLED to hardware layer. Bug: 261743859 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I498061d9ef7f8ff5e21db96c9911f7c485377eab --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 17 +++++++++++++++++ .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 3 ++- .../java/ChangeModeForVehicleProperty.java | 3 ++- .../config/DefaultProperties.json | 8 ++++++++ .../src/VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 38 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 303bef4303..06e9a52b25 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -239,4 +239,5 @@ enum VehicleProperty { BLIND_SPOT_WARNING_ENABLED = 287313924, LANE_DEPARTURE_WARNING_ENABLED = 287313926, LANE_CENTERING_ASSIST_ENABLED = 287313930, + EMERGENCY_LANE_KEEP_ASSIST_ENABLED = 287313933, } diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 5afe84254e..0161dce4db 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3449,6 +3449,23 @@ enum VehicleProperty { LANE_CENTERING_ASSIST_ENABLED = 0x100A + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /* + * Enable or disable emergency lane keep assist (ELKA). + * + * Set true to enable ELKA and false to disable ELKA. When ELKA is enabled, the ADAS system in + * the vehicle should be on and monitoring for unsafe lane changes by the driver. When an unsafe + * maneuver is detected, ELKA alerts the driver and applies steering corrections to keep the + * vehicle in its original lane. + * + * This property is defined as read_write, but OEMs have the option to implement it as read + * only. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + EMERGENCY_LANE_KEEP_ASSIST_ENABLED = + 0x100D + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /*************************************************************************** * End of ADAS Properties **************************************************************************/ diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 34322f8bad..48bb2dbf4c 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -239,6 +239,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 36e1709f52..11d78e1f10 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -239,6 +239,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 4da920c03c..100278649f 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -230,7 +230,8 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), - Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE) + Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE) ); } diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 0aa42a481b..b116edcc86 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -230,7 +230,8 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), - Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) + Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) ); } diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 583bca01c3..02a5d39208 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2877,6 +2877,14 @@ ] } }, + { + "property": "VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED", + "defaultValue": { + "int32Values": [ + 1 + ] + } + }, { "property": "VehicleProperty::INITIAL_USER_INFO" }, diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 2be409f5b3..36ec2dafdb 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -481,6 +481,12 @@ void VtsHalAutomotiveVehicleTargetTest::verifyProperty(VehicleProperty propId, actualPropertyType); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEmergencyLaneKeepAssistEnabledConfig) { + verifyProperty(VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, + VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvBrakeRegenerationLevelConfig) { verifyProperty(VehicleProperty::EV_BRAKE_REGENERATION_LEVEL, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, From 808a294ee1914b032224eb5981c4cb8efdb923b8 Mon Sep 17 00:00:00 2001 From: shrikar Date: Wed, 21 Dec 2022 17:07:32 +0000 Subject: [PATCH 555/998] Added ADAPTIVE_CRUISE_CONTROL_ENABLED to hardware layer. Bug: 261737998 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I2343329b9ea086b1fa7c22c644e8f02534cbd41b --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 18 ++++++++++++++++++ .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 3 ++- .../java/ChangeModeForVehicleProperty.java | 3 ++- .../config/DefaultProperties.json | 8 ++++++++ .../src/VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 39 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 06e9a52b25..14a262a5c4 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -240,4 +240,5 @@ enum VehicleProperty { LANE_DEPARTURE_WARNING_ENABLED = 287313926, LANE_CENTERING_ASSIST_ENABLED = 287313930, EMERGENCY_LANE_KEEP_ASSIST_ENABLED = 287313933, + ADAPTIVE_CRUISE_CONTROL_ENABLED = 287313935, } diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 0161dce4db..d54b60ec24 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3466,6 +3466,24 @@ enum VehicleProperty { EMERGENCY_LANE_KEEP_ASSIST_ENABLED = 0x100D + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Enable or disable adaptive cruise control (ACC). + * + * Set true to enable ACC and false to disable ACC. When ACC is enabled, the ADAS system in the + * vehicle should be turned on and waiting for an activation signal from the driver. Once the + * feature is activated, the ADAS system in the car should be accelerating and braking in a way + * that allows the vehicle to maintain a set speed and to maintain a set distance gap from a + * leading vehicle. + * + * This property is defined as read_write, but OEMs have the option to implement it as read + * only. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + ADAPTIVE_CRUISE_CONTROL_ENABLED = + 0x100F + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /*************************************************************************** * End of ADAS Properties **************************************************************************/ diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 48bb2dbf4c..df9c0faff5 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -240,6 +240,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE}, }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 11d78e1f10..bb0bf4362a 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -240,6 +240,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 100278649f..2d5954ec8f 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -231,7 +231,8 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), - Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE) + Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyAccess.READ_WRITE) ); } diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index b116edcc86..b55695fecf 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -231,7 +231,8 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), - Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) + Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) ); } diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 02a5d39208..a0701e6b7e 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2885,6 +2885,14 @@ ] } }, + { + "property": "VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED", + "defaultValue": { + "int32Values": [ + 1 + ] + } + }, { "property": "VehicleProperty::INITIAL_USER_INFO" }, diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 36ec2dafdb..22fcf1fa93 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -487,6 +487,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEmergencyLaneKeepAssistEnabledCo VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAdaptiveCruiseControlEnabledConfig) { + verifyProperty(VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED, + VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvBrakeRegenerationLevelConfig) { verifyProperty(VehicleProperty::EV_BRAKE_REGENERATION_LEVEL, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, From 37833e1700e66a6e02f7127fb2a6d2ed5c5e077d Mon Sep 17 00:00:00 2001 From: shrikar Date: Thu, 15 Dec 2022 20:13:14 +0000 Subject: [PATCH 556/998] Added HANDS_ON_DETECTION_ENABLED to hardware layer. Bug: 261739790 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I382bad54ba5c26f398b9d925e9dd1672446b684b --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 16 ++++++++++++++++ .../generated_lib/cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 3 ++- .../java/ChangeModeForVehicleProperty.java | 3 ++- .../default_config/config/DefaultProperties.json | 8 ++++++++ .../src/VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 37 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 14a262a5c4..61f90d62a5 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -241,4 +241,5 @@ enum VehicleProperty { LANE_CENTERING_ASSIST_ENABLED = 287313930, EMERGENCY_LANE_KEEP_ASSIST_ENABLED = 287313933, ADAPTIVE_CRUISE_CONTROL_ENABLED = 287313935, + HANDS_ON_DETECTION_ENABLED = 287313941, } diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index d54b60ec24..6833a78189 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3484,6 +3484,22 @@ enum VehicleProperty { ADAPTIVE_CRUISE_CONTROL_ENABLED = 0x100F + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Enable or disable hands on detection (HOD). + * + * Set true to enable HOD and false to disable HOD. When HOD is enabled, a system inside the + * vehicle should be monitoring the presence of the driver's hands on the steering wheel and + * send a warning if it detects that the driver's hands are no longer on the steering wheel. + * + * This property is defined as read_write, but OEMs have the option to implement it as read + * only. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + HANDS_ON_DETECTION_ENABLED = + 0x1015 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /*************************************************************************** * End of ADAS Properties **************************************************************************/ diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index df9c0faff5..87235e01d1 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -241,6 +241,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE}, }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index bb0bf4362a..d5625cbd38 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -241,6 +241,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 2d5954ec8f..ff92269434 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -232,7 +232,8 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), - Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyAccess.READ_WRITE) + Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE) ); } diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index b55695fecf..4aab71d61b 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -232,7 +232,8 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), - Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) + Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) ); } diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index a0701e6b7e..f23803037c 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2893,6 +2893,14 @@ ] } }, + { + "property": "VehicleProperty::HANDS_ON_DETECTION_ENABLED", + "defaultValue": { + "int32Values": [ + 1 + ] + } + }, { "property": "VehicleProperty::INITIAL_USER_INFO" }, diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 22fcf1fa93..f247368069 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -493,6 +493,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAdaptiveCruiseControlEnabledConf VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionEnabledConfig) { + verifyProperty(VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvBrakeRegenerationLevelConfig) { verifyProperty(VehicleProperty::EV_BRAKE_REGENERATION_LEVEL, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, From 2c7aaa65888f727f02a136ab5df379990898439b Mon Sep 17 00:00:00 2001 From: shrikar Date: Thu, 15 Dec 2022 21:05:34 +0000 Subject: [PATCH 557/998] Added DRIVER_ATTENTION_MONITORING_ENABLED to hardware layer. Bug: 261739791 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I6452d0660d0625f7fde4ba87097d16d8dd28b656 --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 17 +++++++++++++++++ .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 3 ++- .../java/ChangeModeForVehicleProperty.java | 3 ++- .../config/DefaultProperties.json | 8 ++++++++ .../src/VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 38 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 61f90d62a5..96a9a4ab21 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -242,4 +242,5 @@ enum VehicleProperty { EMERGENCY_LANE_KEEP_ASSIST_ENABLED = 287313933, ADAPTIVE_CRUISE_CONTROL_ENABLED = 287313935, HANDS_ON_DETECTION_ENABLED = 287313941, + DRIVER_ATTENTION_MONITORING_ENABLED = 287313944, } diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 6833a78189..2586add971 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3500,6 +3500,23 @@ enum VehicleProperty { HANDS_ON_DETECTION_ENABLED = 0x1015 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Enable or disable driver attention monitoring. + * + * Set true to enable driver attention monitoring and false to disable driver attention + * monitoring. When driver attention monitoring is enabled, a system inside the vehicle should + * be monitoring the attention level of the driver and should send a warning if it detects that + * the driver is distracted. + * + * This property is defined as read_write, but OEMs have the option to implement it as read + * only. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + DRIVER_ATTENTION_MONITORING_ENABLED = + 0x1018 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /*************************************************************************** * End of ADAS Properties **************************************************************************/ diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 87235e01d1..3fdbca7266 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -242,6 +242,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess::READ_WRITE}, }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index d5625cbd38..8b13eb8da2 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -242,6 +242,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index ff92269434..b6f7615c84 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -233,7 +233,8 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyAccess.READ_WRITE), - Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE) + Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess.READ_WRITE) ); } diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 4aab71d61b..be8d862dc6 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -233,7 +233,8 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), - Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) + Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) ); } diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index f23803037c..43e2d94655 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2901,6 +2901,14 @@ ] } }, + { + "property": "VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED", + "defaultValue": { + "int32Values": [ + 1 + ] + } + }, { "property": "VehicleProperty::INITIAL_USER_INFO" }, diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index f247368069..28632d3c75 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -499,6 +499,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionEnabledConfig) { VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverAttentionMonitoringEnabledConfig) { + verifyProperty(VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, + VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvBrakeRegenerationLevelConfig) { verifyProperty(VehicleProperty::EV_BRAKE_REGENERATION_LEVEL, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, From 2f6f874e17698f568e88c6d63290ead9a6c0517f Mon Sep 17 00:00:00 2001 From: Ravneet Dhanjal Date: Wed, 4 Jan 2023 21:06:52 +0000 Subject: [PATCH 558/998] Validate request metadata before coverting to camera metadata - Backport similar fix from AIDL to HIDL to protect from malformed metadata Bug: 256166626 Test: CTS test Change-Id: If8f83520144824e38ed102b7468d6d5ee2e6d963 --- camera/device/3.2/default/convert.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/camera/device/3.2/default/convert.cpp b/camera/device/3.2/default/convert.cpp index 06ad7e963c..207560783f 100644 --- a/camera/device/3.2/default/convert.cpp +++ b/camera/device/3.2/default/convert.cpp @@ -16,6 +16,7 @@ #define LOG_TAG "android.hardware.camera.device@3.2-convert-impl" #include +#include #include "include/convert.h" @@ -43,6 +44,13 @@ bool convertFromHidl(const CameraMetadata &src, const camera_metadata_t** dst) { ALOGE("%s: input CameraMetadata is corrupt!", __FUNCTION__); return false; } + + if (validate_camera_metadata_structure((camera_metadata_t*)data, /*expected_size=*/NULL) != + OK) { + ALOGE("%s: Failed to validate the metadata structure", __FUNCTION__); + return false; + } + *dst = (camera_metadata_t*) data; return true; } From 1edc327a397c7c453f704fb2356381e78bd374a4 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 4 Jan 2023 13:49:49 -0800 Subject: [PATCH 559/998] Move startThreadPool up in VHAL init. This should improve the VHAL bootup performance. Test: Manual build Bug: 264442710 Change-Id: Ifd85d0f9ad33ac2dd71cbcb986370dc6bb2265aa --- .../vehicle/aidl/impl/vhal/src/VehicleService.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/automotive/vehicle/aidl/impl/vhal/src/VehicleService.cpp b/automotive/vehicle/aidl/impl/vhal/src/VehicleService.cpp index c8b5c658dd..f8a4e7d14d 100644 --- a/automotive/vehicle/aidl/impl/vhal/src/VehicleService.cpp +++ b/automotive/vehicle/aidl/impl/vhal/src/VehicleService.cpp @@ -27,6 +27,13 @@ using ::android::hardware::automotive::vehicle::DefaultVehicleHal; using ::android::hardware::automotive::vehicle::fake::FakeVehicleHardware; int main(int /* argc */, char* /* argv */[]) { + ALOGI("Starting thread pool..."); + if (!ABinderProcess_setThreadPoolMaxThreadCount(4)) { + ALOGE("%s", "failed to set thread pool max thread count"); + return 1; + } + ABinderProcess_startThreadPool(); + std::unique_ptr hardware = std::make_unique(); std::shared_ptr vhal = ::ndk::SharedRefBase::make(std::move(hardware)); @@ -39,12 +46,6 @@ int main(int /* argc */, char* /* argv */[]) { return 1; } - if (!ABinderProcess_setThreadPoolMaxThreadCount(4)) { - ALOGE("%s", "failed to set thread pool max thread count"); - return 1; - } - ABinderProcess_startThreadPool(); - ALOGI("Vehicle Service Ready"); ABinderProcess_joinThreadPool(); From 6dcb4177e2ae7f4a3854cb145ba82bbd22b8803e Mon Sep 17 00:00:00 2001 From: Badhri Jagan Sridharan Date: Wed, 4 Jan 2023 22:45:03 +0000 Subject: [PATCH 560/998] Fix check for DisabledDataStatusCheck disabledCount is expected to be less than or equal to 1. Fix this by replacing EXPECT_LE with EXPECT_GE. Bug: 263977605 Change-Id: Id6c803fed814ae13c0f160bb644c31d5d6093738 --- usb/aidl/vts/VtsAidlUsbTargetTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usb/aidl/vts/VtsAidlUsbTargetTest.cpp b/usb/aidl/vts/VtsAidlUsbTargetTest.cpp index d87f1f4741..aec9954b8e 100644 --- a/usb/aidl/vts/VtsAidlUsbTargetTest.cpp +++ b/usb/aidl/vts/VtsAidlUsbTargetTest.cpp @@ -307,7 +307,7 @@ TEST_P(UsbAidlTest, DisabledDataStatusCheck) { } } } - EXPECT_LE(1, disabledCount); + EXPECT_GE(1, disabledCount); ALOGI("UsbAidlTest DataStatusCheck end"); } From 20cc66a8e0c81faad9ec89820692361ae9dbd972 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Thu, 22 Dec 2022 05:38:28 -0800 Subject: [PATCH 561/998] Add HAL changes for LANE_KEEP_ASSIST_ENABLED Bug: 261743711 Test: atest VtsHalAutomotiveVehicle_TargetTest atest CtsCarTestCases:CarPropertyManagerTest atest CtsCarTestCases:VehiclePropertyIdsTest Change-Id: I9e8dbb601ad320357d062aa665a9a9ba215b469a --- .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 20 +++++++++++++++++++ .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../config/DefaultProperties.json | 8 ++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 39 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index ec6f28a930..1bc6c3a2b2 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -241,6 +241,7 @@ enum VehicleProperty { FORWARD_COLLISION_WARNING_ENABLED = 287313922, BLIND_SPOT_WARNING_ENABLED = 287313924, LANE_DEPARTURE_WARNING_ENABLED = 287313926, + LANE_KEEP_ASSIST_ENABLED = 287313928, LANE_CENTERING_ASSIST_ENABLED = 287313930, EMERGENCY_LANE_KEEP_ASSIST_ENABLED = 287313933, ADAPTIVE_CRUISE_CONTROL_ENABLED = 287313935, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl index 1f3c867dfd..ff0836f538 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3484,6 +3484,26 @@ enum VehicleProperty { LANE_DEPARTURE_WARNING_ENABLED = 0x1006 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Enable or disable Lane Keep Assist (LKA). + * + * Set true to enable LKA and false to disable LKA. When LKA is enabled, the ADAS system in the + * vehicle should be turned on and monitoring if the driver unintentionally drifts toward or + * over the lane marking. If an unintentional lane departure is detected, the system applies + * steering control to return the vehicle into the current lane. + * + * This is different from Lane Centering Assist (LCA) which, when activated, applies continuous + * steering control to keep the vehicle centered in the current lane. + * + * This property is defined as read_write, but OEMs have the option to implement it as read + * only. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + LANE_KEEP_ASSIST_ENABLED = + 0x1008 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** * Enable or disable lane centering assist (LCA). * diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index a1cd8aaeb5..aea4f808fc 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -241,6 +241,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index ef02f386af..9d01018150 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -241,6 +241,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 8c93c50647..55b88333c0 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -233,6 +233,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index b47e1489d6..2f5fe9cb7f 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -233,6 +233,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index bcf629a08c..44b25415bb 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3107,6 +3107,14 @@ ] } }, + { + "property": "VehicleProperty::LANE_KEEP_ASSIST_ENABLED", + "defaultValue": { + "int32Values": [ + 0 + ] + } + }, { "property": "VehicleProperty::LANE_CENTERING_ASSIST_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index e0fd011048..de98c8ce92 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -679,6 +679,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneDepartureWarningEnabledConfi VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneKeepAssistEnabledConfig) { + verifyProperty(VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistEnabledConfig) { verifyProperty(VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, From 740c256079e7389259e2331a09139bb724c6081f Mon Sep 17 00:00:00 2001 From: Avichal Rakesh Date: Tue, 13 Dec 2022 13:25:24 -0800 Subject: [PATCH 562/998] Clean up external HAL reference implementation. This CL cleans up the reference external HAL implementation. Specifically, it makes the following changes: - Removes mSupportBufMgr from ExternalCameraDeviceSession as it never needed to be used. - Makes ExternalCameraOfflineSession final to prevent other classes from accidentally inheriting from it. ExternalCameraOfflineSession calls the virtual function `close()` on destruction which depends on the implementation details of other virtual functions. Bug: 219974678 Test: Builds successfully Change-Id: I645f8164cd2426219943d9407f0c282c468c90d3 --- camera/device/default/ExternalCameraDeviceSession.cpp | 6 ++---- camera/device/default/ExternalCameraDeviceSession.h | 1 - camera/device/default/ExternalCameraOfflineSession.h | 6 +++--- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/camera/device/default/ExternalCameraDeviceSession.cpp b/camera/device/default/ExternalCameraDeviceSession.cpp index 736bc3cbcd..c9629744c2 100644 --- a/camera/device/default/ExternalCameraDeviceSession.cpp +++ b/camera/device/default/ExternalCameraDeviceSession.cpp @@ -217,10 +217,8 @@ void ExternalCameraDeviceSession::initOutputThread() { // Grab a shared_ptr to 'this' from ndk::SharedRefBase::ref() std::shared_ptr thiz = ref(); - if (mSupportBufMgr) { - mBufferRequestThread = std::make_shared(/*parent=*/thiz, mCallback); - mBufferRequestThread->run(); - } + mBufferRequestThread = std::make_shared(/*parent=*/thiz, mCallback); + mBufferRequestThread->run(); mOutputThread = std::make_shared(/*parent=*/thiz, mCroppingType, mCameraCharacteristics, mBufferRequestThread); } diff --git a/camera/device/default/ExternalCameraDeviceSession.h b/camera/device/default/ExternalCameraDeviceSession.h index 5d420925c3..e7eb799da2 100644 --- a/camera/device/default/ExternalCameraDeviceSession.h +++ b/camera/device/default/ExternalCameraDeviceSession.h @@ -365,7 +365,6 @@ class ExternalCameraDeviceSession : public BnCameraDeviceSession, public OutputT static HandleImporter sHandleImporter; - bool mSupportBufMgr; std::shared_ptr mBufferRequestThread; /* Beginning of members not changed after initialize() */ diff --git a/camera/device/default/ExternalCameraOfflineSession.h b/camera/device/default/ExternalCameraOfflineSession.h index 5795c95bd0..1d0c057a37 100644 --- a/camera/device/default/ExternalCameraOfflineSession.h +++ b/camera/device/default/ExternalCameraOfflineSession.h @@ -39,9 +39,9 @@ using ::aidl::android::hardware::camera::device::Stream; using ::aidl::android::hardware::common::fmq::MQDescriptor; using ::aidl::android::hardware::common::fmq::SynchronizedReadWrite; -class ExternalCameraOfflineSession : public BnCameraOfflineSession, - public virtual RefBase, - public virtual OutputThreadInterface { +class ExternalCameraOfflineSession final : public BnCameraOfflineSession, + public virtual RefBase, + public virtual OutputThreadInterface { public: ExternalCameraOfflineSession(const CroppingType& croppingType, const common::V1_0::helper::CameraMetadata& chars, From 7344af9e118c0ed84ddc0885a23fdcfd2b451eb1 Mon Sep 17 00:00:00 2001 From: Anthony Stange Date: Thu, 22 Dec 2022 14:21:31 +0000 Subject: [PATCH 563/998] Add support for new APIs in default/vts code Bug: 229888878 Test: presubmits Change-Id: Ifc1ce761cc211d165b2f2f9315beffbb47f8fb85 --- contexthub/aidl/default/ContextHub.cpp | 4 ++++ .../aidl/default/include/contexthub-impl/ContextHub.h | 1 + .../aidl/vts/VtsAidlHalContextHubTargetTest.cpp | 11 +++++++++++ 3 files changed, 16 insertions(+) diff --git a/contexthub/aidl/default/ContextHub.cpp b/contexthub/aidl/default/ContextHub.cpp index ac1dc46139..615ac5c258 100644 --- a/contexthub/aidl/default/ContextHub.cpp +++ b/contexthub/aidl/default/ContextHub.cpp @@ -87,6 +87,10 @@ ScopedAStatus ContextHub::getPreloadedNanoappIds(std::vector* out_prelo return ndk::ScopedAStatus::ok(); } +ScopedAStatus ContextHub::onNanSessionStateChanged(bool /*sin_state*/) { + return ndk::ScopedAStatus::ok(); +} + ScopedAStatus ContextHub::registerCallback(int32_t in_contextHubId, const std::shared_ptr& in_cb) { if (in_contextHubId == kMockHubId) { diff --git a/contexthub/aidl/default/include/contexthub-impl/ContextHub.h b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h index 4aeb948375..b3998b917e 100644 --- a/contexthub/aidl/default/include/contexthub-impl/ContextHub.h +++ b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h @@ -47,6 +47,7 @@ class ContextHub : public BnContextHub { ::ndk::ScopedAStatus onHostEndpointConnected(const HostEndpointInfo& in_info) override; ::ndk::ScopedAStatus onHostEndpointDisconnected(char16_t in_hostEndpointId) override; + ::ndk::ScopedAStatus onNanSessionStateChanged(bool in_state) override; private: static constexpr uint32_t kMockHubId = 0; diff --git a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp index 8104f27f5b..4731648c27 100644 --- a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp +++ b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp @@ -100,6 +100,8 @@ class EmptyContextHubCallback : public android::hardware::contexthub::BnContextH Status handleTransactionResult(int32_t /* transactionId */, bool /* success */) override { return Status::ok(); } + + Status handleNanSessionRequest(bool /* enable */) override { return Status::ok(); } }; TEST_P(ContextHubAidl, TestRegisterCallback) { @@ -131,6 +133,8 @@ class QueryAppsCallback : public android::hardware::contexthub::BnContextHubCall return Status::ok(); } + Status handleNanSessionRequest(bool /* enable */) override { return Status::ok(); } + std::promise> promise; }; @@ -194,6 +198,8 @@ class TransactionResultCallback : public android::hardware::contexthub::BnContex return Status::ok(); } + Status handleNanSessionRequest(bool /* enable */) override { return Status::ok(); } + uint32_t expectedTransactionId = 0; std::promise promise; }; @@ -354,6 +360,11 @@ TEST_P(ContextHubAidl, TestInvalidHostConnection) { ASSERT_TRUE(contextHub->onHostEndpointDisconnected(kHostEndpointId).isOk()); } +TEST_P(ContextHubAidl, TestNanSessionStateChange) { + ASSERT_TRUE(contextHub->onNanSessionStateChanged(true /*state*/).isOk()); + ASSERT_TRUE(contextHub->onNanSessionStateChanged(false /*state*/).isOk()); +} + std::string PrintGeneratedTest(const testing::TestParamInfo& info) { return std::string("CONTEXT_HUB_ID_") + std::to_string(std::get<1>(info.param)); } From c1a127e9e0f671343eb115ea02b297e1451af333 Mon Sep 17 00:00:00 2001 From: Yomna Nasser Date: Wed, 4 Jan 2023 03:25:55 +0000 Subject: [PATCH 564/998] Update setNullCipherAndIntegrityEnabled API. Additionally update isNullCipherAndIntegrityEnabled VTS to reflect the same. Bug: b/237529943 Test: m Change-Id: I816bccb87d3ce4f89fb81eecdd9b040c91484847 --- .../hardware/radio/network/IRadioNetworkResponse.aidl | 1 + radio/aidl/vts/radio_network_test.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl index fa1badb34d..457b5b9149 100644 --- a/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl +++ b/radio/aidl/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -622,6 +622,7 @@ oneway interface IRadioNetworkResponse { * RadioError:NONE * RadioError:RADIO_NOT_AVAILABLE * RadioError:MODEM_ERR + * RadioError:REQUEST_NOT_SUPPORTED */ void setNullCipherAndIntegrityEnabledResponse(in RadioResponseInfo info); diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index 658fcf7009..3d6dbe7cef 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -2021,8 +2021,8 @@ TEST_P(RadioNetworkTest, isNullCipherAndIntegrityEnabled) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); - ASSERT_TRUE(CheckAnyOfErrors( - radioRsp_network->rspInfo.error, - {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, + RadioError::MODEM_ERR, RadioError::REQUEST_NOT_SUPPORTED})); LOG(DEBUG) << "isNullCipherAndIntegrityEnabled finished"; } From e5fbcab1a338ab590edacabf46a0f819ba8522b4 Mon Sep 17 00:00:00 2001 From: Shuibing Dai Date: Mon, 19 Dec 2022 15:37:19 -0800 Subject: [PATCH 565/998] Add a new AIDL API for wifi indoor/dfs channel usage In the API, we can enable/disalbe STA-connected indoor or DFS channels for WFA GO, SAP and Wi-Fi Aware. Bug: 207669954 Test: m android.hardware.wifi-update-api Change-Id: I8513bc265fe8fc4f43d9e4b508d8c361f3455fd7 --- .../android/hardware/wifi/IWifiChip.aidl | 50 +++++++++++-------- .../aidl/android/hardware/wifi/IWifiChip.aidl | 25 ++++++++++ wifi/aidl/default/aidl_struct_util.cpp | 13 +++++ wifi/aidl/default/aidl_struct_util.h | 1 + wifi/aidl/default/wifi_chip.cpp | 16 ++++++ wifi/aidl/default/wifi_chip.h | 4 ++ wifi/aidl/default/wifi_legacy_hal.cpp | 5 ++ wifi/aidl/default/wifi_legacy_hal.h | 4 ++ wifi/aidl/default/wifi_legacy_hal_stubs.cpp | 1 + 9 files changed, 97 insertions(+), 22 deletions(-) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl index f800e8f6aa..2ebe145be9 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl @@ -80,24 +80,25 @@ interface IWifiChip { void startLoggingToDebugRingBuffer(in String ringName, in android.hardware.wifi.WifiDebugRingBufferVerboseLevel verboseLevel, in int maxIntervalInSec, in int minDataSizeInBytes); void stopLoggingToDebugRingBuffer(); void triggerSubsystemRestart(); - const int NO_POWER_CAP_CONSTANT = 2147483647; + void enableStaChannelForPeerNetwork(in android.hardware.wifi.IWifiChip.ChannelCategoryMask channelCategoryEnableFlag); + const int NO_POWER_CAP_CONSTANT = 0x7FFFFFFF; @Backing(type="int") @VintfStability enum ChipCapabilityMask { - DEBUG_MEMORY_FIRMWARE_DUMP = 1, - DEBUG_MEMORY_DRIVER_DUMP = 2, - DEBUG_RING_BUFFER_CONNECT_EVENT = 4, - DEBUG_RING_BUFFER_POWER_EVENT = 8, - DEBUG_RING_BUFFER_WAKELOCK_EVENT = 16, - DEBUG_RING_BUFFER_VENDOR_DATA = 32, - DEBUG_HOST_WAKE_REASON_STATS = 64, - DEBUG_ERROR_ALERTS = 128, - SET_TX_POWER_LIMIT = 256, - D2D_RTT = 512, - D2AP_RTT = 1024, - USE_BODY_HEAD_SAR = 2048, - SET_LATENCY_MODE = 4096, - P2P_RAND_MAC = 8192, - WIGIG = 16384, + DEBUG_MEMORY_FIRMWARE_DUMP = (1 << 0), + DEBUG_MEMORY_DRIVER_DUMP = (1 << 1), + DEBUG_RING_BUFFER_CONNECT_EVENT = (1 << 2), + DEBUG_RING_BUFFER_POWER_EVENT = (1 << 3), + DEBUG_RING_BUFFER_WAKELOCK_EVENT = (1 << 4), + DEBUG_RING_BUFFER_VENDOR_DATA = (1 << 5), + DEBUG_HOST_WAKE_REASON_STATS = (1 << 6), + DEBUG_ERROR_ALERTS = (1 << 7), + SET_TX_POWER_LIMIT = (1 << 8), + D2D_RTT = (1 << 9), + D2AP_RTT = (1 << 10), + USE_BODY_HEAD_SAR = (1 << 11), + SET_LATENCY_MODE = (1 << 12), + P2P_RAND_MAC = (1 << 13), + WIGIG = (1 << 14), } @VintfStability parcelable ChipConcurrencyCombinationLimit { @@ -129,9 +130,9 @@ interface IWifiChip { } @Backing(type="int") @VintfStability enum CoexRestriction { - WIFI_DIRECT = 1, - SOFTAP = 2, - WIFI_AWARE = 4, + WIFI_DIRECT = (1 << 0), + SOFTAP = (1 << 1), + WIFI_AWARE = (1 << 2), } @VintfStability parcelable CoexUnsafeChannel { @@ -159,8 +160,13 @@ interface IWifiChip { } @Backing(type="int") @VintfStability enum UsableChannelFilter { - CELLULAR_COEXISTENCE = 1, - CONCURRENCY = 2, - NAN_INSTANT_MODE = 4, + CELLULAR_COEXISTENCE = (1 << 0), + CONCURRENCY = (1 << 1), + NAN_INSTANT_MODE = (1 << 2), + } + @Backing(type="int") @VintfStability + enum ChannelCategoryMask { + INDOOR_CHANNEL = (1 << 0), + DFS_CHANNEL = (1 << 1), } } diff --git a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl index 64692aff36..5ffea565e5 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl @@ -1106,4 +1106,29 @@ interface IWifiChip { * |WifiStatusCode.ERROR_UNKNOWN| */ void triggerSubsystemRestart(); + + /** + * Channel category mask. + */ + @VintfStability + @Backing(type="int") + enum ChannelCategoryMask { + INDOOR_CHANNEL = 1 << 0, + DFS_CHANNEL = 1 << 1, + } + + /** + * API to enable or disable the feature of allowing current STA-connected channel for WFA GO, + * SAP and Aware when the regulatory allows. + * If the channel category is enabled and allowed by the regulatory, the HAL method + * getUsableChannels() will contain the current STA-connected channel if that channel belongs + * to that category. + * @param channelCategoryEnableFlag bitmask of |ChannelCategoryMask|. + * For each bit, 1 enables the channel category and 0 disables that channel category. + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|, + * |WifiStatusCode.ERROR_NOT_SUPPORTED|, + * |WifiStatusCode.FAILURE_UNKNOWN| + */ + void enableStaChannelForPeerNetwork(in ChannelCategoryMask channelCategoryEnableFlag); } diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index 5e80ff9572..31bfb31efd 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -3311,6 +3311,19 @@ bool convertLegacyWifiChipCapabilitiesToAidl( return true; } +uint32_t convertAidlChannelCategoryToLegacy(uint32_t aidl_channel_category_mask) { + uint32_t channel_category_mask = 0; + if (aidl_channel_category_mask & + static_cast(IWifiChip::ChannelCategoryMask::INDOOR_CHANNEL)) { + channel_category_mask |= legacy_hal::WIFI_INDOOR_CHANNEL; + } + if (aidl_channel_category_mask & + static_cast(IWifiChip::ChannelCategoryMask::DFS_CHANNEL)) { + channel_category_mask |= legacy_hal::WIFI_DFS_CHANNEL; + } + return channel_category_mask; +} + } // namespace aidl_struct_util } // namespace wifi } // namespace hardware diff --git a/wifi/aidl/default/aidl_struct_util.h b/wifi/aidl/default/aidl_struct_util.h index e478fed380..6407d321a0 100644 --- a/wifi/aidl/default/aidl_struct_util.h +++ b/wifi/aidl/default/aidl_struct_util.h @@ -200,6 +200,7 @@ bool convertLegacyNanBootstrappingRequestIndToAidl( bool convertLegacyNanBootstrappingConfirmIndToAidl( const legacy_hal::NanBootstrappingConfirmInd& legacy_ind, NanBootstrappingConfirmInd* aidl_ind); +uint32_t convertAidlChannelCategoryToLegacy(uint32_t aidl_channel_category_mask); } // namespace aidl_struct_util } // namespace wifi } // namespace hardware diff --git a/wifi/aidl/default/wifi_chip.cpp b/wifi/aidl/default/wifi_chip.cpp index 406169912f..559700172d 100644 --- a/wifi/aidl/default/wifi_chip.cpp +++ b/wifi/aidl/default/wifi_chip.cpp @@ -34,6 +34,7 @@ namespace { using aidl::android::hardware::wifi::IfaceType; using aidl::android::hardware::wifi::IWifiChip; using CoexRestriction = aidl::android::hardware::wifi::IWifiChip::CoexRestriction; +using ChannelCategoryMask = aidl::android::hardware::wifi::IWifiChip::ChannelCategoryMask; using android::base::unique_fd; constexpr char kCpioMagic[] = "070701"; @@ -685,6 +686,13 @@ ndk::ScopedAStatus WifiChip::getWifiChipCapabilities(WifiChipCapabilities* _aidl &WifiChip::getWifiChipCapabilitiesInternal, _aidl_return); } +ndk::ScopedAStatus WifiChip::enableStaChannelForPeerNetwork( + ChannelCategoryMask in_channelCategoryEnableFlag) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::enableStaChannelForPeerNetworkInternal, + in_channelCategoryEnableFlag); +} + void WifiChip::invalidateAndRemoveAllIfaces() { invalidateAndClearBridgedApAll(); invalidateAndClearAll(ap_ifaces_); @@ -1428,6 +1436,14 @@ std::pair WifiChip::getWifiChipCapabil return {aidl_chip_capabilities, ndk::ScopedAStatus::ok()}; } +ndk::ScopedAStatus WifiChip::enableStaChannelForPeerNetworkInternal( + ChannelCategoryMask channelCategoryEnableFlag) { + auto legacy_status = legacy_hal_.lock()->enableStaChannelForPeerNetwork( + aidl_struct_util::convertAidlChannelCategoryToLegacy( + static_cast(channelCategoryEnableFlag))); + return createWifiStatusFromLegacyError(legacy_status); +} + ndk::ScopedAStatus WifiChip::triggerSubsystemRestartInternal() { auto legacy_status = legacy_hal_.lock()->triggerSubsystemRestart(); return createWifiStatusFromLegacyError(legacy_status); diff --git a/wifi/aidl/default/wifi_chip.h b/wifi/aidl/default/wifi_chip.h index 7b04e851f8..c69c7fe9ea 100644 --- a/wifi/aidl/default/wifi_chip.h +++ b/wifi/aidl/default/wifi_chip.h @@ -145,6 +145,8 @@ class WifiChip : public BnWifiChip { ndk::ScopedAStatus getSupportedRadioCombinationsMatrix( WifiRadioCombinationMatrix* _aidl_return) override; ndk::ScopedAStatus getWifiChipCapabilities(WifiChipCapabilities* _aidl_return) override; + ndk::ScopedAStatus enableStaChannelForPeerNetwork( + ChannelCategoryMask in_channelCategoryEnableFlag) override; binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; private: @@ -214,6 +216,8 @@ class WifiChip : public BnWifiChip { ndk::ScopedAStatus setCountryCodeInternal(const std::array& in_code); std::pair, ndk::ScopedAStatus> getUsableChannelsInternal( WifiBand band, WifiIfaceMode ifaceModeMask, UsableChannelFilter filterMask); + ndk::ScopedAStatus enableStaChannelForPeerNetworkInternal( + ChannelCategoryMask channelCategoryEnableFlag); ndk::ScopedAStatus handleChipConfiguration(std::unique_lock* lock, int32_t mode_id); ndk::ScopedAStatus registerDebugRingBufferCallback(); diff --git a/wifi/aidl/default/wifi_legacy_hal.cpp b/wifi/aidl/default/wifi_legacy_hal.cpp index 54e91d429c..f03835f54e 100644 --- a/wifi/aidl/default/wifi_legacy_hal.cpp +++ b/wifi/aidl/default/wifi_legacy_hal.cpp @@ -1835,6 +1835,11 @@ std::pair WifiLegacyHal::getWifiChipCapabili return {status, chip_capabilities}; } +wifi_error WifiLegacyHal::enableStaChannelForPeerNetwork(uint32_t channelCategoryEnableFlag) { + return global_func_table_.wifi_enable_sta_channel_for_peer_network(global_handle_, + channelCategoryEnableFlag); +} + void WifiLegacyHal::invalidate() { global_handle_ = nullptr; iface_name_to_handle_.clear(); diff --git a/wifi/aidl/default/wifi_legacy_hal.h b/wifi/aidl/default/wifi_legacy_hal.h index 562028021e..2300cb7782 100644 --- a/wifi/aidl/default/wifi_legacy_hal.h +++ b/wifi/aidl/default/wifi_legacy_hal.h @@ -256,12 +256,14 @@ using ::WIFI_CHAN_WIDTH_5; using ::WIFI_CHAN_WIDTH_80; using ::WIFI_CHAN_WIDTH_80P80; using ::WIFI_CHAN_WIDTH_INVALID; +using ::wifi_channel_category; using ::wifi_channel_info; using ::wifi_channel_stat; using ::wifi_channel_width; using ::wifi_chip_capabilities; using ::wifi_coex_restriction; using ::wifi_coex_unsafe_channel; +using ::WIFI_DFS_CHANNEL; using ::WIFI_DUAL_STA_NON_TRANSIENT_UNBIASED; using ::WIFI_DUAL_STA_TRANSIENT_PREFER_PRIMARY; using ::wifi_error; @@ -278,6 +280,7 @@ using ::WIFI_ERROR_UNINITIALIZED; using ::WIFI_ERROR_UNKNOWN; using ::wifi_gscan_capabilities; using ::wifi_hal_fn; +using ::WIFI_INDOOR_CHANNEL; using ::wifi_information_element; using ::WIFI_INTERFACE_IBSS; using ::WIFI_INTERFACE_MESH; @@ -755,6 +758,7 @@ class WifiLegacyHal { wifi_error getWifiCachedScanResults(const std::string& iface_name, const CachedScanResultsCallbackHandlers& handler); std::pair getWifiChipCapabilities(); + wifi_error enableStaChannelForPeerNetwork(uint32_t channelCategoryEnableFlag); private: // Retrieve interface handles for all the available interfaces. diff --git a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp index a0cb2c071d..11da373b7d 100644 --- a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp +++ b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp @@ -172,6 +172,7 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { populateStubFor(&hal_fn->wifi_enable_tx_power_limits); populateStubFor(&hal_fn->wifi_get_cached_scan_results); populateStubFor(&hal_fn->wifi_get_chip_capabilities); + populateStubFor(&hal_fn->wifi_enable_sta_channel_for_peer_network); return true; } From 79ff7a07646c9ec967f1ded1194120ed75dd2d2f Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 6 Jan 2023 20:47:27 +0000 Subject: [PATCH 566/998] Revert "Remove soundtrigger HIDL entry in compat matrix." This reverts commit f38eae91fc3f83b862cde7f515fc799c66464917. Reason for revert: Soundtrigger is allowed to remain in HIDL for one more release. Change-Id: I59c3c4a867e73f97ff330a1f588d2a962b565f42 --- compatibility_matrices/compatibility_matrix.current.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 8593ad3650..d899c2ce76 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -674,6 +674,14 @@ default + + android.hardware.soundtrigger + 2.3 + + ISoundTriggerHw + default + + android.hardware.soundtrigger3 1 From 864bcb9e7a62d1100a208ce4fbb9573f1e974d81 Mon Sep 17 00:00:00 2001 From: Chris Weir Date: Thu, 5 Jan 2023 16:28:39 -0800 Subject: [PATCH 567/998] Fix hwasan error for CAN HAL Hardware address sanitizer is complaining about parseConfigFile. I suspect the issue is that protobuf is taking a pointer to an ifstream rather than a reference, unique_ptr, or shared_ptr. I _think_ this results in some sort of attempt to access the stream after it's closed. In order to get around this, I moved ownership of the stream up one level so that the stream stays open for longer. Bug: 263769296 Test: canhalconfigurator-aidl doesn't crash on seahawk_hwasan-userdebug Change-Id: I937d501a4759f0781304c518b518beaf8c6fed68 --- .../tools/configurator/canprototools.cpp | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/automotive/can/aidl/default/tools/configurator/canprototools.cpp b/automotive/can/aidl/default/tools/configurator/canprototools.cpp index 2aea315391..84edd94bc5 100644 --- a/automotive/can/aidl/default/tools/configurator/canprototools.cpp +++ b/automotive/can/aidl/default/tools/configurator/canprototools.cpp @@ -51,15 +51,20 @@ static std::optional readString(std::istream& s, std::streamsize n) return std::string(buff, 0, std::min(n, got)); } -std::optional parseConfigFile(const std::string& filepath) { - std::ifstream cfg_stream(filepath); - - // text headers that would be present in a plaintext proto config file. +/* + parseConfigFile *used to* contain the body of parseConfigStream. However, it seems there's some + sort of odd behavior with IstreamInputStream and/or TextFormat::Parse, which causes HW Address + Sanitizer to flag a "tag-mismatch" in this function. Having the ifstream defined in a wrapper + function seems to solve this problem. The exact cause of this problem is yet unknown, but probably + lies somewhere in the protobuf implementation. +*/ +static __attribute__((noinline)) std::optional parseConfigStream( + std::ifstream& cfg_stream) { static const std::array text_headers = {"buses", "#", "controller"}; auto cfg_file_snippet = readString(cfg_stream, 10); if (!cfg_file_snippet.has_value()) { - LOG(ERROR) << "Can't open " << filepath << " for reading"; + LOG(ERROR) << "Can't read config from stream (maybe failed to open file?)"; return std::nullopt; } cfg_stream.seekg(0); @@ -77,16 +82,25 @@ std::optional parseConfigFile(const std::string& filepath) { if (text_format) { google::protobuf::io::IstreamInputStream pb_stream(&cfg_stream); if (!google::protobuf::TextFormat::Parse(&pb_stream, &config)) { - LOG(ERROR) << "Failed to parse (text format) " << filepath; + LOG(ERROR) << "Parsing text format config failed"; return std::nullopt; } } else if (!config.ParseFromIstream(&cfg_stream)) { - LOG(ERROR) << "Failed to parse (binary format) " << filepath; + LOG(ERROR) << "Parsing binary format config failed"; return std::nullopt; } return config; } +std::optional parseConfigFile(const std::string& filepath) { + std::ifstream cfg_stream(filepath); + auto cfg_maybe = parseConfigStream(cfg_stream); + if (!cfg_maybe.has_value()) { + LOG(ERROR) << "Failed to parse " << filepath; + } + return cfg_maybe; +} + std::optional fromPbBus(const Bus& pb_bus) { BusConfig bus_cfg = {}; bus_cfg.name = pb_bus.name(); From ddf0ea0d8fe7040381797a318c596e7fdaea501b Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 21 Dec 2022 17:12:12 -0800 Subject: [PATCH 568/998] Make HVAC dep properties unavailable to get when power is off. Previously HVAC properties are unavailable to set when hvac power is off. This CL makes VHAL returns NOT_AVAILABLE for get as well. VHAL will also generate property change event when the power is switched on again. Test: atest FakeVehicleHardwareTest Bug: 262461830 Change-Id: I17ca8a4e48f3ff5854226a6a38a42220078073d5 --- .../hardware/include/FakeVehicleHardware.h | 3 +- .../hardware/src/FakeVehicleHardware.cpp | 35 +++++++++- .../hardware/test/FakeVehicleHardwareTest.cpp | 66 +++++++++++++++++++ 3 files changed, 102 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h index e515badf60..eac1ffabc7 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h @@ -194,7 +194,7 @@ class FakeVehicleHardware : public IVehicleHardware { const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const; ValueResultType getEchoReverseBytes( const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const; - bool isHvacPropAndHvacNotAvailable(int32_t propId); + bool isHvacPropAndHvacNotAvailable(int32_t propId) const; std::unordered_map loadConfigDeclarations(); @@ -236,6 +236,7 @@ class FakeVehicleHardware : public IVehicleHardware { const aidl::android::hardware::automotive::vehicle::SetValueRequest& request); std::string genFakeDataCommand(const std::vector& options); + void sendHvacPropertiesCurrentValues(); static aidl::android::hardware::automotive::vehicle::VehiclePropValue createHwInputKeyProp( aidl::android::hardware::automotive::vehicle::VehicleHwKeyInputAction action, diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index dd76524ef5..4115c11b83 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -295,7 +295,7 @@ VhalResult FakeVehicleHardware::setApPowerStateReport(const VehiclePropVal return {}; } -bool FakeVehicleHardware::isHvacPropAndHvacNotAvailable(int32_t propId) { +bool FakeVehicleHardware::isHvacPropAndHvacNotAvailable(int32_t propId) const { std::unordered_set powerProps(std::begin(HVAC_POWER_PROPERTIES), std::end(HVAC_POWER_PROPERTIES)); if (powerProps.count(propId)) { @@ -366,6 +366,11 @@ FakeVehicleHardware::ValueResultType FakeVehicleHardware::maybeGetSpecialValue( return getUserHalProp(value); } + if (isHvacPropAndHvacNotAvailable(propId)) { + *isSpecialValue = true; + return StatusError(StatusCode::NOT_AVAILABLE) << "hvac not available"; + } + switch (propId) { case OBD2_FREEZE_FRAME: *isSpecialValue = true; @@ -408,6 +413,27 @@ FakeVehicleHardware::ValueResultType FakeVehicleHardware::getEchoReverseBytes( return std::move(gotValue); } +void FakeVehicleHardware::sendHvacPropertiesCurrentValues() { + for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) { + int powerPropId = HVAC_POWER_PROPERTIES[i]; + auto powerPropResults = mServerSidePropStore->readValuesForProperty(powerPropId); + if (!powerPropResults.ok()) { + ALOGW("failed to get power prop 0x%x, error: %s", powerPropId, + getErrorMsg(powerPropResults).c_str()); + continue; + } + auto& powerPropValues = powerPropResults.value(); + for (size_t j = 0; j < powerPropValues.size(); j++) { + auto powerPropValue = std::move(powerPropValues[j]); + powerPropValue->status = VehiclePropertyStatus::AVAILABLE; + powerPropValue->timestamp = elapsedRealtimeNano(); + // This will trigger a property change event for the current hvac property value. + mServerSidePropStore->writeValue(std::move(powerPropValue), /*updateStatus=*/true, + VehiclePropertyStore::EventMode::ALWAYS); + } + } +} + VhalResult FakeVehicleHardware::maybeSetSpecialValue(const VehiclePropValue& value, bool* isSpecialValue) { *isSpecialValue = false; @@ -419,6 +445,13 @@ VhalResult FakeVehicleHardware::maybeSetSpecialValue(const VehiclePropValu return setUserHalProp(value); } + if (propId == toInt(VehicleProperty::HVAC_POWER_ON) && value.value.int32Values.size() == 1 && + value.value.int32Values[0] == 1) { + // If we are turning HVAC power on, send current hvac property values through on change + // event. + sendHvacPropertiesCurrentValues(); + } + if (isHvacPropAndHvacNotAvailable(propId)) { *isSpecialValue = true; return StatusError(StatusCode::NOT_AVAILABLE) << "hvac not available"; diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp index 0184462418..08de312ff1 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp @@ -61,6 +61,7 @@ using ::android::base::expected; using ::android::base::ScopedLockAssertion; using ::android::base::StringPrintf; using ::android::base::unexpected; +using ::testing::AnyOfArray; using ::testing::ContainerEq; using ::testing::ContainsRegex; using ::testing::Eq; @@ -1140,6 +1141,71 @@ TEST_F(FakeVehicleHardwareTest, testSetVehicleMapService) { EXPECT_EQ(getValueResult.error(), StatusCode::NOT_AVAILABLE); } +TEST_F(FakeVehicleHardwareTest, testGetHvacPropNotAvailable) { + StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), + .areaId = HVAC_ALL, + .value.int32Values = {0}}); + + ASSERT_EQ(status, StatusCode::OK); + + for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) { + int powerPropId = HVAC_POWER_PROPERTIES[i]; + auto getValueResult = getValue(VehiclePropValue{ + .prop = powerPropId, + .areaId = HVAC_ALL, + }); + + EXPECT_FALSE(getValueResult.ok()); + EXPECT_EQ(getValueResult.error(), StatusCode::NOT_AVAILABLE); + } +} + +TEST_F(FakeVehicleHardwareTest, testSetHvacPropNotAvailable) { + StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), + .areaId = HVAC_ALL, + .value.int32Values = {0}}); + + ASSERT_EQ(status, StatusCode::OK); + + for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) { + int powerPropId = HVAC_POWER_PROPERTIES[i]; + status = setValue(VehiclePropValue{ + .prop = powerPropId, + .areaId = HVAC_ALL, + }); + + EXPECT_EQ(status, StatusCode::NOT_AVAILABLE); + } +} + +TEST_F(FakeVehicleHardwareTest, testHvacPowerOnSendCurrentHvacPropValues) { + StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), + .areaId = HVAC_ALL, + .value.int32Values = {0}}); + + ASSERT_EQ(status, StatusCode::OK); + + clearChangedProperties(); + + status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), + .areaId = HVAC_ALL, + .value.int32Values = {1}}); + + auto events = getChangedProperties(); + // If we turn HVAC power on, we expect to receive one property event for every HVAC prop areas + // plus one event for HVAC_POWER_ON. + std::vector changedPropIds; + for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) { + changedPropIds.push_back(HVAC_POWER_PROPERTIES[i]); + } + changedPropIds.push_back(toInt(VehicleProperty::HVAC_POWER_ON)); + ASSERT_EQ(events.size(), changedPropIds.size()); + for (const auto& event : events) { + EXPECT_EQ(event.areaId, HVAC_ALL); + EXPECT_THAT(event.prop, AnyOfArray(changedPropIds)); + } +} + TEST_F(FakeVehicleHardwareTest, testGetUserPropertySetOnly) { for (VehicleProperty prop : std::vector({ VehicleProperty::INITIAL_USER_INFO, From 842efa2ebb1a744247c462cd9cde3073f6cb363a Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Thu, 5 Jan 2023 18:20:30 -0800 Subject: [PATCH 569/998] Define a makefile for vhal static libs. This prepares for upcoming VHAL interface split. Test: Manual build Bug: 264600792 Change-Id: I1686d37ac07d53f3e9c92302a9097844b54e9fc7 --- automotive/vehicle/Android.bp | 26 +++++++++++++++++++++++ automotive/vehicle/aidl/impl/Android.bp | 7 ------ automotive/vehicle/vhal_static_cpp_lib.mk | 18 ++++++++++++++++ 3 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 automotive/vehicle/Android.bp create mode 100644 automotive/vehicle/vhal_static_cpp_lib.mk diff --git a/automotive/vehicle/Android.bp b/automotive/vehicle/Android.bp new file mode 100644 index 0000000000..f4a7cd16eb --- /dev/null +++ b/automotive/vehicle/Android.bp @@ -0,0 +1,26 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_defaults { + name: "VehicleHalInterfaceDefaults", + static_libs: [ + "android.hardware.automotive.vehicle-V2-ndk", + ], +} diff --git a/automotive/vehicle/aidl/impl/Android.bp b/automotive/vehicle/aidl/impl/Android.bp index 73f7df0513..d2c5145c83 100644 --- a/automotive/vehicle/aidl/impl/Android.bp +++ b/automotive/vehicle/aidl/impl/Android.bp @@ -18,13 +18,6 @@ package { default_applicable_licenses: ["Android-Apache-2.0"], } -cc_defaults { - name: "VehicleHalInterfaceDefaults", - static_libs: [ - "android.hardware.automotive.vehicle-V2-ndk", - ], -} - cc_defaults { name: "VehicleHalDefaults", static_libs: [ diff --git a/automotive/vehicle/vhal_static_cpp_lib.mk b/automotive/vehicle/vhal_static_cpp_lib.mk new file mode 100644 index 0000000000..b15b26cfe5 --- /dev/null +++ b/automotive/vehicle/vhal_static_cpp_lib.mk @@ -0,0 +1,18 @@ +# 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 make file contains the latest version of static cpp libraries for VHAL +# interface and VHAL properties. + +LOCAL_STATIC_LIBRARIES += android.hardware.automotive.vehicle-V2-ndk From 259c71fdf580e65aad80a6c8b2414ecb0363bcee Mon Sep 17 00:00:00 2001 From: Gaurav Bhola Date: Wed, 4 Jan 2023 18:16:00 -0800 Subject: [PATCH 570/998] Add --keyinputv2 and --motioninput options to genfakedata. - These are required to send keyinputv2 and motioninput events via fake VHal. Fix: 263184145 Test: Manually tested by sending events Test: atest FakeVehicleHardwareTest Change-Id: I078f6e27d4a0de5ac145f9c2058f53f8567ba293 --- .../config/DefaultProperties.json | 71 +++++++ .../hardware/include/FakeVehicleHardware.h | 8 + .../hardware/src/FakeVehicleHardware.cpp | 190 ++++++++++++++++++ .../hardware/test/FakeVehicleHardwareTest.cpp | 128 +++++++++++- 4 files changed, 396 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index f969692c1e..ae9a0cf53a 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1743,6 +1743,77 @@ ] } }, + { + "property": "VehicleProperty::HW_KEY_INPUT_V2", + "defaultValue": { + "int32Values": [ + 0, + 0, + 0, + 0 + ], + "int64Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" + } + ] + }, + { + "property": "VehicleProperty::HW_MOTION_INPUT", + "defaultValue": { + "int32Values": [ + 0, + 0, + 0, + 0, + 1, + 0, + 0 + ], + "floatValues": [ + 0, + 0, + 0, + 0 + ], + "int64Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" + } + ] + }, { "property": "VehicleProperty::HW_ROTARY_INPUT", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h index e515badf60..5e35b0f985 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h @@ -240,6 +240,14 @@ class FakeVehicleHardware : public IVehicleHardware { static aidl::android::hardware::automotive::vehicle::VehiclePropValue createHwInputKeyProp( aidl::android::hardware::automotive::vehicle::VehicleHwKeyInputAction action, int32_t keyCode, int32_t targetDisplay); + static aidl::android::hardware::automotive::vehicle::VehiclePropValue createHwKeyInputV2Prop( + int32_t area, int32_t targetDisplay, int32_t keyCode, int32_t action, + int32_t repeatCount); + static aidl::android::hardware::automotive::vehicle::VehiclePropValue createHwMotionInputProp( + int32_t area, int32_t display, int32_t inputType, int32_t action, int32_t buttonState, + int32_t pointerCount, int32_t pointerId[], int32_t toolType[], float xData[], + float yData[], float pressure[], float size[]); + static std::string genFakeDataHelp(); static std::string parseErrMsg(std::string fieldName, std::string value, std::string type); }; diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index dd76524ef5..6e085dbc6a 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -672,6 +672,14 @@ provided, it would iterate indefinitely. --genfakedata --keypress [keyCode(int32)] [display[int32]]: Generate key press. +--genfakedata --keyinputv2 [area(int32)] [display(int32)] [keyCode[int32]] [action[int32]] + [repeatCount(int32)] + +--genfakedata --motioninput [area(int32)] [display(int32)] [inputType[int32]] [action[int32]] + [buttonState(int32)] --pointer [pointerId(int32)] [toolType(int32)] [xData(float)] [yData(float)] + [pressure(float)] [size(float)] + Generate a motion input event. --pointer option can be specified multiple times. + )"; } @@ -802,6 +810,135 @@ std::string FakeVehicleHardware::genFakeDataCommand(const std::vector intValues; + intValues.push_back(display); + intValues.push_back(inputType); + intValues.push_back(action); + intValues.push_back(buttonState); + intValues.push_back(pointerCount); + for (int i = 0; i < pointerCount; i++) { + intValues.push_back(pointerId[i]); + } + for (int i = 0; i < pointerCount; i++) { + intValues.push_back(toolType[i]); + } + + std::vector floatValues; + for (int i = 0; i < pointerCount; i++) { + floatValues.push_back(xData[i]); + } + for (int i = 0; i < pointerCount; i++) { + floatValues.push_back(yData[i]); + } + for (int i = 0; i < pointerCount; i++) { + floatValues.push_back(pressure[i]); + } + for (int i = 0; i < pointerCount; i++) { + floatValues.push_back(size[i]); + } + + VehiclePropValue value = {.prop = toInt(VehicleProperty::HW_MOTION_INPUT), + .areaId = area, + .timestamp = elapsedRealtimeNano(), + .status = VehiclePropertyStatus::AVAILABLE, + .value.int32Values = intValues, + .value.floatValues = floatValues, + .value.int64Values = {elapsedRealtimeNano()}}; + return value; +} + void FakeVehicleHardware::eventFromVehicleBus(const VehiclePropValue& value) { mServerSidePropStore->writeValue(mValuePool->obtain(value)); } diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp index 0184462418..79990ad4c4 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp @@ -1776,7 +1776,61 @@ std::vector GenInvalidOptions() { "failed to parse keyCode as int: \"0.1\""}, {"genfakedata_keypress_invalid_display", {"--genfakedata", "--keypress", "1", "0.1"}, - "failed to parse display as int: \"0.1\""}}; + "failed to parse display as int: \"0.1\""}, + {"genfakedata_keyinputv2_incorrect_arguments", + {"--genfakedata", "--keyinputv2", "1", "1"}, + "incorrect argument count, need 7 arguments for --genfakedata --keyinputv2\n"}, + {"genfakedata_keyinputv2_invalid_area", + {"--genfakedata", "--keyinputv2", "0.1", "1", "1", "1", "1"}, + "failed to parse area as int: \"0.1\""}, + {"genfakedata_keyinputv2_invalid_display", + {"--genfakedata", "--keyinputv2", "1", "0.1", "1", "1", "1"}, + "failed to parse display as int: \"0.1\""}, + {"genfakedata_keyinputv2_invalid_keycode", + {"--genfakedata", "--keyinputv2", "1", "1", "0.1", "1", "1"}, + "failed to parse keyCode as int: \"0.1\""}, + {"genfakedata_keyinputv2_invalid_action", + {"--genfakedata", "--keyinputv2", "1", "1", "1", "0.1", "1"}, + "failed to parse action as int: \"0.1\""}, + {"genfakedata_keyinputv2_invalid_repeatcount", + {"--genfakedata", "--keyinputv2", "1", "1", "1", "1", "0.1"}, + "failed to parse repeatCount as int: \"0.1\""}, + {"genfakedata_motioninput_invalid_argument_count", + {"--genfakedata", "--motioninput", "1", "1", "1", "1", "1"}, + "incorrect argument count, need at least 14 arguments for --genfakedata " + "--motioninput including at least 1 --pointer\n"}, + {"genfakedata_motioninput_pointer_invalid_argument_count", + {"--genfakedata", "--motioninput", "1", "1", "1", "1", "1", "--pointer", "1", "1", "1", + "1", "1", "1", "--pointer"}, + "incorrect argument count, need 6 arguments for every --pointer\n"}, + {"genfakedata_motioninput_invalid_area", + {"--genfakedata", "--motioninput", "0.1", "1", "1", "1", "1", "--pointer", "1", "1", + "1", "1", "1", "1"}, + "failed to parse area as int: \"0.1\""}, + {"genfakedata_motioninput_invalid_display", + {"--genfakedata", "--motioninput", "1", "0.1", "1", "1", "1", "--pointer", "1", "1", + "1", "1", "1", "1"}, + "failed to parse display as int: \"0.1\""}, + {"genfakedata_motioninput_invalid_inputtype", + {"--genfakedata", "--motioninput", "1", "1", "0.1", "1", "1", "--pointer", "1", "1", + "1", "1", "1", "1"}, + "failed to parse inputType as int: \"0.1\""}, + {"genfakedata_motioninput_invalid_action", + {"--genfakedata", "--motioninput", "1", "1", "1", "0.1", "1", "--pointer", "1", "1", + "1", "1", "1", "1"}, + "failed to parse action as int: \"0.1\""}, + {"genfakedata_motioninput_invalid_buttonstate", + {"--genfakedata", "--motioninput", "1", "1", "1", "1", "0.1", "--pointer", "1", "1", + "1.2", "1.2", "1.2", "1.2"}, + "failed to parse buttonState as int: \"0.1\""}, + {"genfakedata_motioninput_invalid_pointerid", + {"--genfakedata", "--motioninput", "1", "1", "1", "1", "1", "--pointer", "0.1", "1", + "1.2", "1", "1", "1"}, + "failed to parse pointerId as int: \"0.1\""}, + {"genfakedata_motioninput_invalid_tooltype", + {"--genfakedata", "--motioninput", "1", "1", "1", "1", "1", "--pointer", "1", "0.1", + "1.2", "1", "1", "1"}, + "failed to parse toolType as int: \"0.1\""}}; } TEST_P(FakeVehicleHardwareOptionsTest, testInvalidOptions) { @@ -1965,6 +2019,78 @@ TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataKeyPress) { EXPECT_EQ(2, events[1].value.int32Values[2]); } +TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataKeyInputV2) { + std::vector options = {"--genfakedata", "--keyinputv2", "1", "2", "3", "4", "5"}; + + DumpResult result = getHardware()->dump(options); + + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_THAT(result.buffer, HasSubstr("successfully")); + + auto events = getChangedProperties(); + ASSERT_EQ(1u, events.size()); + EXPECT_EQ(toInt(VehicleProperty::HW_KEY_INPUT_V2), events[0].prop); + ASSERT_EQ(4u, events[0].value.int32Values.size()); + EXPECT_EQ(2, events[0].value.int32Values[0]); + EXPECT_EQ(3, events[0].value.int32Values[1]); + EXPECT_EQ(4, events[0].value.int32Values[2]); + EXPECT_EQ(5, events[0].value.int32Values[3]); + ASSERT_EQ(1u, events[0].value.int64Values.size()); +} + +TEST_F(FakeVehicleHardwareTest, testDebugGenFakeDataMotionInput) { + std::vector options = {"--genfakedata", + "--motioninput", + "1", + "2", + "3", + "4", + "5", + "--pointer", + "11", + "22", + "33.3", + "44.4", + "55.5", + "66.6", + "--pointer", + "21", + "32", + "43.3", + "54.4", + "65.5", + "76.6"}; + + DumpResult result = getHardware()->dump(options); + + ASSERT_FALSE(result.callerShouldDumpState); + ASSERT_THAT(result.buffer, HasSubstr("successfully")); + + auto events = getChangedProperties(); + ASSERT_EQ(1u, events.size()); + EXPECT_EQ(toInt(VehicleProperty::HW_MOTION_INPUT), events[0].prop); + ASSERT_EQ(9u, events[0].value.int32Values.size()); + EXPECT_EQ(2, events[0].value.int32Values[0]); + EXPECT_EQ(3, events[0].value.int32Values[1]); + EXPECT_EQ(4, events[0].value.int32Values[2]); + EXPECT_EQ(5, events[0].value.int32Values[3]); + EXPECT_EQ(2, events[0].value.int32Values[4]); + EXPECT_EQ(11, events[0].value.int32Values[5]); + EXPECT_EQ(21, events[0].value.int32Values[6]); + EXPECT_EQ(22, events[0].value.int32Values[7]); + EXPECT_EQ(32, events[0].value.int32Values[8]); + ASSERT_EQ(8u, events[0].value.floatValues.size()); + EXPECT_FLOAT_EQ(33.3, events[0].value.floatValues[0]); + EXPECT_FLOAT_EQ(43.3, events[0].value.floatValues[1]); + EXPECT_FLOAT_EQ(44.4, events[0].value.floatValues[2]); + EXPECT_FLOAT_EQ(54.4, events[0].value.floatValues[3]); + EXPECT_FLOAT_EQ(55.5, events[0].value.floatValues[4]); + EXPECT_FLOAT_EQ(65.5, events[0].value.floatValues[5]); + EXPECT_FLOAT_EQ(66.6, events[0].value.floatValues[6]); + EXPECT_FLOAT_EQ(76.6, events[0].value.floatValues[7]); + ASSERT_EQ(1u, events[0].value.int64Values.size()); +} + TEST_F(FakeVehicleHardwareTest, testGetEchoReverseBytes) { ASSERT_EQ(setValue(VehiclePropValue{ .prop = ECHO_REVERSE_BYTES, From f89a66b8d504dde9bcf6e6c33d6080ffe2981dd3 Mon Sep 17 00:00:00 2001 From: Sam Dubey Date: Sun, 8 Jan 2023 23:24:01 +0000 Subject: [PATCH 571/998] Fix test name in test-mapping Test: N/A Bug: 264732141 Change-Id: I2b7959e9eb62f420e3097a4ff0ea3dd82e62fd3e --- audio/aidl/TEST_MAPPING | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/aidl/TEST_MAPPING b/audio/aidl/TEST_MAPPING index 486c13d799..6a545c122f 100644 --- a/audio/aidl/TEST_MAPPING +++ b/audio/aidl/TEST_MAPPING @@ -13,7 +13,7 @@ "name": "VtsHalDownmixTargetTest" }, { - "name": "VtsHalDynamicProcessingTargetTest" + "name": "VtsHalDynamicsProcessingTargetTest" }, { "name": "VtsHalEnvironmentalReverbTargetTest" From 6c94dde22691a9234a05c16902d177ec8808088b Mon Sep 17 00:00:00 2001 From: RD Babiera Date: Wed, 9 Nov 2022 22:55:47 +0000 Subject: [PATCH 572/998] Usb DisplayPort alt mode aidl interfaces Adds enums for DisplayPortAltModeStatus and DisplayPortAltModePinAssignment. Adds AltModeData and DisplayPortAltModeData. Updates PortStatus to reflect these new enums and parcelables. Test: atest VtsAidlUsbTargetTest Bug: 253534975 Change-Id: I0fc62601dfc162b909e796586110686beed137ea --- .../android/hardware/usb/AltModeData.aidl | 44 ++++++++++ .../usb/DisplayPortAltModePinAssignment.aidl | 44 ++++++++++ .../usb/DisplayPortAltModeStatus.aidl | 41 +++++++++ .../android/hardware/usb/PlugOrientation.aidl | 42 +++++++++ .../android/hardware/usb/PortStatus.aidl | 2 + .../android/hardware/usb/AltModeData.aidl | 47 ++++++++++ .../usb/DisplayPortAltModePinAssignment.aidl | 75 ++++++++++++++++ .../usb/DisplayPortAltModeStatus.aidl | 85 +++++++++++++++++++ .../android/hardware/usb/PlugOrientation.aidl | 35 ++++++++ usb/aidl/android/hardware/usb/PortStatus.aidl | 17 +++- usb/aidl/default/Usb.cpp | 10 +-- usb/aidl/vts/VtsAidlUsbTargetTest.cpp | 58 +++++++++++++ 12 files changed, 493 insertions(+), 7 deletions(-) create mode 100644 usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/AltModeData.aidl create mode 100644 usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/DisplayPortAltModePinAssignment.aidl create mode 100644 usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/DisplayPortAltModeStatus.aidl create mode 100644 usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/PlugOrientation.aidl create mode 100644 usb/aidl/android/hardware/usb/AltModeData.aidl create mode 100644 usb/aidl/android/hardware/usb/DisplayPortAltModePinAssignment.aidl create mode 100644 usb/aidl/android/hardware/usb/DisplayPortAltModeStatus.aidl create mode 100644 usb/aidl/android/hardware/usb/PlugOrientation.aidl diff --git a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/AltModeData.aidl b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/AltModeData.aidl new file mode 100644 index 0000000000..8e9dd00c02 --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/AltModeData.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not us e 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 -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.hardware.usb; +@VintfStability +union AltModeData { + android.hardware.usb.AltModeData.DisplayPortAltModeData displayPortAltModeData; + @VintfStability + parcelable DisplayPortAltModeData { + android.hardware.usb.DisplayPortAltModeStatus partnerSinkStatus = android.hardware.usb.DisplayPortAltModeStatus.UNKNOWN; + android.hardware.usb.DisplayPortAltModeStatus cableStatus = android.hardware.usb.DisplayPortAltModeStatus.UNKNOWN; + android.hardware.usb.DisplayPortAltModePinAssignment pinAssignment = android.hardware.usb.DisplayPortAltModePinAssignment.NONE; + } +} diff --git a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/DisplayPortAltModePinAssignment.aidl b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/DisplayPortAltModePinAssignment.aidl new file mode 100644 index 0000000000..5908117e9e --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/DisplayPortAltModePinAssignment.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.usb; +@Backing(type="int") @VintfStability +enum DisplayPortAltModePinAssignment { + NONE = 0, + A = 1, + B = 2, + C = 3, + D = 4, + E = 5, + F = 6, +} diff --git a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/DisplayPortAltModeStatus.aidl b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/DisplayPortAltModeStatus.aidl new file mode 100644 index 0000000000..dc69b98955 --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/DisplayPortAltModeStatus.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.usb; +@Backing(type="int") @VintfStability +enum DisplayPortAltModeStatus { + UNKNOWN = 0, + NOT_CAPABLE = 1, + CAPABLE = 2, + ENABLED = 3, +} diff --git a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/PlugOrientation.aidl b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/PlugOrientation.aidl new file mode 100644 index 0000000000..e2185444b1 --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/PlugOrientation.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.usb; +@Backing(type="int") @VintfStability +enum PlugOrientation { + UNKNOWN = 0, + UNPLUGGED = 1, + PLUGGED_UNKNOWN = 2, + PLUGGED_NORMAL = 3, + PLUGGED_FLIPPED = 4, +} diff --git a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/PortStatus.aidl b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/PortStatus.aidl index b0b7552769..cefddba719 100644 --- a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/PortStatus.aidl +++ b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/PortStatus.aidl @@ -52,4 +52,6 @@ parcelable PortStatus { android.hardware.usb.PowerBrickStatus powerBrickStatus; boolean supportsComplianceWarnings = false; android.hardware.usb.ComplianceWarning[] complianceWarnings = {}; + android.hardware.usb.PlugOrientation plugOrientation = android.hardware.usb.PlugOrientation.UNKNOWN; + android.hardware.usb.AltModeData[] supportedAltModes = {}; } diff --git a/usb/aidl/android/hardware/usb/AltModeData.aidl b/usb/aidl/android/hardware/usb/AltModeData.aidl new file mode 100644 index 0000000000..e103ff933e --- /dev/null +++ b/usb/aidl/android/hardware/usb/AltModeData.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not us e 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.hardware.usb; + +import android.hardware.usb.DisplayPortAltModePinAssignment; +import android.hardware.usb.DisplayPortAltModeStatus; + +@VintfStability +union AltModeData { + /** + * Holds data necessary to communicate the current DisplayPort + * Alt Mode status. + */ + @VintfStability + parcelable DisplayPortAltModeData { + /** + * Indicates the current DisplayPort Alt Mode Status of + * the port partner acting as a DisplayPort sink. + */ + DisplayPortAltModeStatus partnerSinkStatus = DisplayPortAltModeStatus.UNKNOWN; + /** + * Indicates the current status of the attached DisplayPort + * Alt Mode cable/adapter. + */ + DisplayPortAltModeStatus cableStatus = DisplayPortAltModeStatus.UNKNOWN; + /** + * Indicates the DisplayPort Alt Mode pin assignment + * negotiated between the device, port partner, and cable. + */ + DisplayPortAltModePinAssignment pinAssignment = DisplayPortAltModePinAssignment.NONE; + } + DisplayPortAltModeData displayPortAltModeData; +} diff --git a/usb/aidl/android/hardware/usb/DisplayPortAltModePinAssignment.aidl b/usb/aidl/android/hardware/usb/DisplayPortAltModePinAssignment.aidl new file mode 100644 index 0000000000..d3284e5d25 --- /dev/null +++ b/usb/aidl/android/hardware/usb/DisplayPortAltModePinAssignment.aidl @@ -0,0 +1,75 @@ +/* + * 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. + */ + +package android.hardware.usb; + +@VintfStability +@Backing(type="int") +/** + * Indicates DisplayPort Alt Mode pin assignments whose port + * pin configurations are as defined by DisplayPort Alt Mode + * v1.0 for deprecated pin assignments A, B, and F and + * DisplayPort Alt Mode v2.x for pin assignments C, D, and E. + * + */ +enum DisplayPortAltModePinAssignment { + /** + * Indicates that the pin assignment has not yet been + * configured, the attached cable/adapter does not support + * DisplayPort Alt Mode, or no cable/adapter is attached. + */ + NONE = 0, + /** + * Intended for use with USB-C-to-USB-C cables and with + * adapters from USB-C to other video formats using + * four lanes for DisplayPort transmission, and is + * restricted by the USB Type-C r1.0 Active Cable + * definition. + */ + A = 1, + /** + * Intended for use with USB-C-to-USB-C cables and with + * adapters from USB-C to other video formats using + * two lanes for DisplayPort transmission and two for + * USB SuperSpeed,and is restricted by the USB Type-C + * r1.0 Active Cable definition. + */ + B = 2, + /** + * Intended for use with USB-C-to-USB-C cables and with + * adapters from USB-C to other video formats using + * four lanes for DisplayPort transmission. + */ + C = 3, + /** + * Intended for use with USB-C-to-USB-C cables and with + * adapters from USB-C to other video formats using + * two lanes for DisplayPort transmission and two for + * USB SuperSpeed. + */ + D = 4, + /** + * Intended for use with adapters from USB-C-to-DP plugs + * or receptacles. + */ + E = 5, + /** + * Intended for use with adapters from USB-C-to-DP plugs + * or receptacles that also support two lanes of USB + * SuperSpeed. + */ + F = 6, +} diff --git a/usb/aidl/android/hardware/usb/DisplayPortAltModeStatus.aidl b/usb/aidl/android/hardware/usb/DisplayPortAltModeStatus.aidl new file mode 100644 index 0000000000..275ed15ff3 --- /dev/null +++ b/usb/aidl/android/hardware/usb/DisplayPortAltModeStatus.aidl @@ -0,0 +1,85 @@ +/* + * 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. + */ + +package android.hardware.usb; + +@VintfStability +@Backing(type="int") +/** + * Port Partners: + * Indicates the current status of the of DisplayPort Alt Mode + * partner, which can either be a DisplayPort Alt Mode source + * (ex. computer, tablet, phone) or DisplayPort Alt Mode sink + * (monitor, hub, adapter). + * + * Cables: + * Indicates the current status of the Type-C cable/adapter + * connected to the local Android device. + * + */ +enum DisplayPortAltModeStatus { + /** + * Port Partners: + * The port partner status is currently unknown for one of + * the following reasons: + * 1. No port partner is connected to the device + * 2. The USB Power Delivery Discover Identity command + * has not been issued to the port partner via SOP + * messaging. + * + * Cables: + * The cable’s capabilities are not yet known to the + * device, or no cable is plugged in. + */ + UNKNOWN = 0, + /** + * Port Partners: + * The current port partner does not list DisplayPort as + * one of its Alt Modes,does not list the capability to + * act as a DisplayPort Source or Sink device, or a compatible + * configuration could not be established. + * + * Cables: + * The cable/adapter’s capabilities do not list DisplayPort + * as one of its Alt Modes, or a compatible configuration could + * not be established. + */ + NOT_CAPABLE = 1, + /** + * Port Partners: + * The current port partner lists compatible DisplayPort + * capabilities with the device, however may not yet have + * entered DisplayPort Alt Mode or has configured its + * port for data transmission. + * + * Cables: + * The Type-C cable/adapter’s capabilities have been + * discovered and list DisplayPort Alt Mode as one of its + * capabilities, however may not yet have entered DisplayPort + * Alt Mode or has been configured for data transmission. + */ + CAPABLE = 2, + /** + * Port Partners: + * The port partner and device are both configured for + * DisplayPort Alt Mode. + * + * Cables: + * The Type-C cable/adapter is configured for DisplayPort + * Alt Mode. + */ + ENABLED = 3, +} diff --git a/usb/aidl/android/hardware/usb/PlugOrientation.aidl b/usb/aidl/android/hardware/usb/PlugOrientation.aidl new file mode 100644 index 0000000000..3c09cfed2a --- /dev/null +++ b/usb/aidl/android/hardware/usb/PlugOrientation.aidl @@ -0,0 +1,35 @@ +/* + * 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. + */ + +package android.hardware.usb; + +@VintfStability +@Backing(type="int") +/** + * Used to indicate plug orientation as defined by USB Type-C + * Cable and Connector Specification. + */ +enum PlugOrientation { + UNKNOWN = 0, + UNPLUGGED = 1, + /** + * The device can detect that a plug is inserted, but + * the plug may not present a normal or flipped orientation. + */ + PLUGGED_UNKNOWN = 2, + PLUGGED_NORMAL = 3, + PLUGGED_FLIPPED = 4, +} diff --git a/usb/aidl/android/hardware/usb/PortStatus.aidl b/usb/aidl/android/hardware/usb/PortStatus.aidl index d7e61ecf94..daed13ca7c 100644 --- a/usb/aidl/android/hardware/usb/PortStatus.aidl +++ b/usb/aidl/android/hardware/usb/PortStatus.aidl @@ -16,10 +16,12 @@ package android.hardware.usb; +import android.hardware.usb.AltModeData; +import android.hardware.usb.ComplianceWarning; import android.hardware.usb.ContaminantDetectionStatus; import android.hardware.usb.ContaminantProtectionMode; import android.hardware.usb.ContaminantProtectionStatus; -import android.hardware.usb.ComplianceWarning; +import android.hardware.usb.PlugOrientation; import android.hardware.usb.PortDataRole; import android.hardware.usb.PortMode; import android.hardware.usb.PortPowerRole; @@ -102,7 +104,8 @@ parcelable PortStatus { /** * Current status of contaminant detection algorithm. */ - ContaminantDetectionStatus contaminantDetectionStatus = ContaminantDetectionStatus.NOT_SUPPORTED; + ContaminantDetectionStatus contaminantDetectionStatus = + ContaminantDetectionStatus.NOT_SUPPORTED; /** * UsbData status of the port. * Lists reasons for USB data being disabled. @@ -127,4 +130,14 @@ parcelable PortStatus { * power source/cable/accessory is non compliant. */ ComplianceWarning[] complianceWarnings = {}; + /** + * Indicates the current orientation of the cable/adapter + * plugged into the device. + */ + PlugOrientation plugOrientation = PlugOrientation.UNKNOWN; + /** + * Lists Alt Modes supported by the device and holds their + * current information. + */ + AltModeData[] supportedAltModes = {}; } diff --git a/usb/aidl/default/Usb.cpp b/usb/aidl/default/Usb.cpp index dd12da0363..593dd4f4c6 100644 --- a/usb/aidl/default/Usb.cpp +++ b/usb/aidl/default/Usb.cpp @@ -517,11 +517,11 @@ Status getPortStatusHelper(std::vector *currentPortStatus) { (*currentPortStatus)[i].usbDataStatus.push_back(UsbDataStatus::ENABLED); ALOGI("%d:%s connected:%d canChangeMode:%d canChagedata:%d canChangePower:%d " - "usbDataEnabled:%d", - i, port.first.c_str(), port.second, - (*currentPortStatus)[i].canChangeMode, - (*currentPortStatus)[i].canChangeDataRole, - (*currentPortStatus)[i].canChangePowerRole, 0); + "usbDataEnabled:%d plugOrientation:%d", + i, port.first.c_str(), port.second, (*currentPortStatus)[i].canChangeMode, + (*currentPortStatus)[i].canChangeDataRole, + (*currentPortStatus)[i].canChangePowerRole, 0, + (*currentPortStatus)[i].plugOrientation); } return Status::SUCCESS; diff --git a/usb/aidl/vts/VtsAidlUsbTargetTest.cpp b/usb/aidl/vts/VtsAidlUsbTargetTest.cpp index d87f1f4741..7b86d68c85 100644 --- a/usb/aidl/vts/VtsAidlUsbTargetTest.cpp +++ b/usb/aidl/vts/VtsAidlUsbTargetTest.cpp @@ -42,10 +42,14 @@ #define TIMEOUT_PERIOD 10 +using ::aidl::android::hardware::usb::AltModeData; using ::aidl::android::hardware::usb::BnUsbCallback; using ::aidl::android::hardware::usb::ComplianceWarning; +using ::aidl::android::hardware::usb::DisplayPortAltModePinAssignment; +using ::aidl::android::hardware::usb::DisplayPortAltModeStatus; using ::aidl::android::hardware::usb::IUsb; using ::aidl::android::hardware::usb::IUsbCallback; +using ::aidl::android::hardware::usb::PlugOrientation; using ::aidl::android::hardware::usb::PortDataRole; using ::aidl::android::hardware::usb::PortMode; using ::aidl::android::hardware::usb::PortPowerRole; @@ -639,6 +643,60 @@ TEST_P(UsbAidlTest, nonCompliantChargerValues) { ALOGI("UsbAidlTest nonCompliantChargerValues end"); } +/* + * Test PlugOrientation Values are within range in PortStatus + */ +TEST_P(UsbAidlTest, plugOrientationValues) { + ALOGI("UsbAidlTest plugOrientationValues start"); + int64_t transactionId = rand() % 10000; + const auto& ret = usb->queryPortStatus(transactionId); + ASSERT_TRUE(ret.isOk()); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(2, usb_last_cookie); + EXPECT_EQ(transactionId, last_transactionId); + + EXPECT_TRUE((int)usb_last_port_status.plugOrientation >= (int)PlugOrientation::UNKNOWN); + EXPECT_TRUE((int)usb_last_port_status.plugOrientation <= (int)PlugOrientation::PLUGGED_FLIPPED); +} + +/* + * Test DisplayPortAltMode Values when DisplayPort Alt Mode + * is active. + */ +TEST_P(UsbAidlTest, dpAltModeValues) { + ALOGI("UsbAidlTest dpAltModeValues start"); + int64_t transactionId = rand() % 10000; + const auto& ret = usb->queryPortStatus(transactionId); + ASSERT_TRUE(ret.isOk()); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(2, usb_last_cookie); + EXPECT_EQ(transactionId, last_transactionId); + + // Discover DisplayPort Alt Mode + for (AltModeData altMode : usb_last_port_status.supportedAltModes) { + if (altMode.getTag() == AltModeData::displayPortAltModeData) { + AltModeData::DisplayPortAltModeData displayPortAltModeData = + altMode.get(); + EXPECT_TRUE((int)displayPortAltModeData.partnerSinkStatus >= + (int)DisplayPortAltModeStatus::UNKNOWN); + EXPECT_TRUE((int)displayPortAltModeData.partnerSinkStatus <= + (int)DisplayPortAltModeStatus::ENABLED); + + EXPECT_TRUE((int)displayPortAltModeData.cableStatus >= + (int)DisplayPortAltModeStatus::UNKNOWN); + EXPECT_TRUE((int)displayPortAltModeData.cableStatus <= + (int)DisplayPortAltModeStatus::ENABLED); + + EXPECT_TRUE((int)displayPortAltModeData.pinAssignment >= + (int)DisplayPortAltModePinAssignment::NONE); + EXPECT_TRUE((int)displayPortAltModeData.pinAssignment <= + (int)DisplayPortAltModePinAssignment::F); + } + } + + ALOGI("UsbAidlTest dpAltModeValues end"); +} + GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(UsbAidlTest); INSTANTIATE_TEST_SUITE_P( PerInstance, UsbAidlTest, From 465470a02e96b89cec6df5719d58672833d94fcc Mon Sep 17 00:00:00 2001 From: Sujit Kautkar Date: Mon, 9 Jan 2023 20:59:09 +0000 Subject: [PATCH 573/998] Revert "[Aware] Support set cluster id in AIDL" Revert submission 20813956-issue-262873111-API-set-clusterId-newAPI Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=git_master&target=oriole-userdebug&lkgb=9469876&lkbb=9470237&fkbb=9469914, bug b/264915970 Reverted changes: /q/submissionid:20813956-issue-262873111-API-set-clusterId-newAPI Bug: 264915970 Change-Id: Ifb3806a702f585700ce80a5979fdb2608b3d9eeb --- .../current/android/hardware/wifi/NanCapabilities.aidl | 1 - .../android/hardware/wifi/NanConfigRequestSupplemental.aidl | 1 - wifi/aidl/android/hardware/wifi/NanCapabilities.aidl | 4 ---- .../android/hardware/wifi/NanConfigRequestSupplemental.aidl | 4 ---- wifi/aidl/default/aidl_struct_util.cpp | 3 --- 5 files changed, 13 deletions(-) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl index cb5a95cc6c..5b59945ac3 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl @@ -52,5 +52,4 @@ parcelable NanCapabilities { boolean supports6g; boolean supportsHe; boolean supportsPairing; - boolean supportsSetClusterId; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanConfigRequestSupplemental.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanConfigRequestSupplemental.aidl index 99f2af771e..682699e7f4 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanConfigRequestSupplemental.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanConfigRequestSupplemental.aidl @@ -40,5 +40,4 @@ parcelable NanConfigRequestSupplemental { boolean enableRanging; boolean enableInstantCommunicationMode; int instantModeChannel; - int clusterId; } diff --git a/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl b/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl index 4160176a29..0955b4cd9d 100644 --- a/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl +++ b/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl @@ -97,8 +97,4 @@ parcelable NanCapabilities { * Flag to indicate if NAN pairing is supported. */ boolean supportsPairing; - /** - * Flag to indicate if NAN setting cluster ID is supported. - */ - boolean supportsSetClusterId; } diff --git a/wifi/aidl/android/hardware/wifi/NanConfigRequestSupplemental.aidl b/wifi/aidl/android/hardware/wifi/NanConfigRequestSupplemental.aidl index 338a549aeb..eb01a9f731 100644 --- a/wifi/aidl/android/hardware/wifi/NanConfigRequestSupplemental.aidl +++ b/wifi/aidl/android/hardware/wifi/NanConfigRequestSupplemental.aidl @@ -60,8 +60,4 @@ parcelable NanConfigRequestSupplemental { * Controls which channel NAN instant communication mode operates on. */ int instantModeChannel; - /** - * Controls which cluster to join. - */ - int clusterId; } diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index 6869ac3c04..5e80ff9572 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -1706,8 +1706,6 @@ bool convertAidlNanConfigRequestToLegacy(const NanConfigRequest& aidl_request1, legacy_request->enable_instant_mode = aidl_request2.enableInstantCommunicationMode; legacy_request->config_instant_mode_channel = 1; legacy_request->instant_mode_channel = aidl_request2.instantModeChannel; - legacy_request->config_cluster_id = 1; - legacy_request->cluster_id_val = aidl_request2.clusterId; return true; } @@ -2247,7 +2245,6 @@ bool convertLegacyNanCapabilitiesResponseToAidl(const legacy_hal::NanCapabilitie aidl_response->supports6g = legacy_response.is_6g_supported; aidl_response->supportsHe = legacy_response.is_he_supported; aidl_response->supportsPairing = legacy_response.is_pairing_supported; - aidl_response->supportsSetClusterId = legacy_response.is_set_cluster_id_supported; return true; } From dc7192f7d8c610fcdbe59a0f4d8d33e87baf5891 Mon Sep 17 00:00:00 2001 From: Biswarup Pal Date: Mon, 9 Jan 2023 21:21:07 +0000 Subject: [PATCH 574/998] Revert^2 "[Aware] Support set cluster id in AIDL" 465470a02e96b89cec6df5719d58672833d94fcc Change-Id: I123022198f1c08c730be18eaa3c6deee3ce0604f --- .../current/android/hardware/wifi/NanCapabilities.aidl | 1 + .../android/hardware/wifi/NanConfigRequestSupplemental.aidl | 1 + wifi/aidl/android/hardware/wifi/NanCapabilities.aidl | 4 ++++ .../android/hardware/wifi/NanConfigRequestSupplemental.aidl | 4 ++++ wifi/aidl/default/aidl_struct_util.cpp | 3 +++ 5 files changed, 13 insertions(+) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl index 5b59945ac3..cb5a95cc6c 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl @@ -52,4 +52,5 @@ parcelable NanCapabilities { boolean supports6g; boolean supportsHe; boolean supportsPairing; + boolean supportsSetClusterId; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanConfigRequestSupplemental.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanConfigRequestSupplemental.aidl index 682699e7f4..99f2af771e 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanConfigRequestSupplemental.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanConfigRequestSupplemental.aidl @@ -40,4 +40,5 @@ parcelable NanConfigRequestSupplemental { boolean enableRanging; boolean enableInstantCommunicationMode; int instantModeChannel; + int clusterId; } diff --git a/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl b/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl index 0955b4cd9d..4160176a29 100644 --- a/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl +++ b/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl @@ -97,4 +97,8 @@ parcelable NanCapabilities { * Flag to indicate if NAN pairing is supported. */ boolean supportsPairing; + /** + * Flag to indicate if NAN setting cluster ID is supported. + */ + boolean supportsSetClusterId; } diff --git a/wifi/aidl/android/hardware/wifi/NanConfigRequestSupplemental.aidl b/wifi/aidl/android/hardware/wifi/NanConfigRequestSupplemental.aidl index eb01a9f731..338a549aeb 100644 --- a/wifi/aidl/android/hardware/wifi/NanConfigRequestSupplemental.aidl +++ b/wifi/aidl/android/hardware/wifi/NanConfigRequestSupplemental.aidl @@ -60,4 +60,8 @@ parcelable NanConfigRequestSupplemental { * Controls which channel NAN instant communication mode operates on. */ int instantModeChannel; + /** + * Controls which cluster to join. + */ + int clusterId; } diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index 5e80ff9572..6869ac3c04 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -1706,6 +1706,8 @@ bool convertAidlNanConfigRequestToLegacy(const NanConfigRequest& aidl_request1, legacy_request->enable_instant_mode = aidl_request2.enableInstantCommunicationMode; legacy_request->config_instant_mode_channel = 1; legacy_request->instant_mode_channel = aidl_request2.instantModeChannel; + legacy_request->config_cluster_id = 1; + legacy_request->cluster_id_val = aidl_request2.clusterId; return true; } @@ -2245,6 +2247,7 @@ bool convertLegacyNanCapabilitiesResponseToAidl(const legacy_hal::NanCapabilitie aidl_response->supports6g = legacy_response.is_6g_supported; aidl_response->supportsHe = legacy_response.is_he_supported; aidl_response->supportsPairing = legacy_response.is_pairing_supported; + aidl_response->supportsSetClusterId = legacy_response.is_set_cluster_id_supported; return true; } From 93dd2a6dff50152a3b84cbf4b58b961664807f31 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Mon, 9 Jan 2023 21:33:58 +0000 Subject: [PATCH 575/998] Limit LOG_TAG in header Including LOG_TAG in a header prevents any files which uses this header from defining a LOG_TAG. Bug: 259162245 Change-Id: I847f4b4f8898aac373db2566c745d3e73404f58a --- camera/provider/aidl/vts/camera_aidl_test.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/camera/provider/aidl/vts/camera_aidl_test.h b/camera/provider/aidl/vts/camera_aidl_test.h index 8b8a4bca46..f13d6b202a 100644 --- a/camera/provider/aidl/vts/camera_aidl_test.h +++ b/camera/provider/aidl/vts/camera_aidl_test.h @@ -17,7 +17,10 @@ #ifndef HARDWARE_INTERFACES_CAMERA_PROVIDER_AIDL_VTS_CAMERA_AIDL_TEST_H_ #define HARDWARE_INTERFACES_CAMERA_PROVIDER_AIDL_VTS_CAMERA_AIDL_TEST_H_ +// TODO: LOG_TAG should not be in header +#ifndef LOG_TAG #define LOG_TAG "camera_aidl_hal_test" +#endif #include #include From fa1266f5477747d90d806a2069b23bf3748c8d72 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 29 Jul 2022 22:51:21 +0000 Subject: [PATCH 576/998] Remove radio ISAP HIDL entry in compat matrix. This interface has been converted to AIDL. Test: TH Bug: 218588089 Change-Id: I1ce852dbbbde4bff8c2932863c1694988013554f --- compatibility_matrices/compatibility_matrix.current.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 8a80095221..9ccb6eca96 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -551,14 +551,6 @@ slot3 - - android.hardware.radio - 1.2 - - ISap - slot1 - - android.hardware.radio.ims.media 1 From 319f99f29a1cfbd1c429cefb95302e1321258953 Mon Sep 17 00:00:00 2001 From: Biswarup Pal Date: Tue, 20 Dec 2022 18:06:50 +0000 Subject: [PATCH 577/998] Add NAN suspension flag to NanCapabilities AIDL Test: m Bug: 262872127 Change-Id: I01d40c8e59f4553746882745a8662b5b0fb3e19a --- .../current/android/hardware/wifi/NanCapabilities.aidl | 1 + wifi/aidl/android/hardware/wifi/NanCapabilities.aidl | 6 +++++- wifi/aidl/default/aidl_struct_util.cpp | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl index cb5a95cc6c..bb44679ade 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl @@ -53,4 +53,5 @@ parcelable NanCapabilities { boolean supportsHe; boolean supportsPairing; boolean supportsSetClusterId; + boolean supportsSuspension; } diff --git a/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl b/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl index 4160176a29..c1d6201299 100644 --- a/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl +++ b/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl @@ -98,7 +98,11 @@ parcelable NanCapabilities { */ boolean supportsPairing; /** - * Flag to indicate if NAN setting cluster ID is supported. + * Flag to indicate if setting NAN cluster ID is supported. */ boolean supportsSetClusterId; + /** + * Flag to indicate if NAN suspension is supported. + */ + boolean supportsSuspension; } diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index ba7d2dbbbd..8a7f7e4ae5 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -2248,6 +2248,8 @@ bool convertLegacyNanCapabilitiesResponseToAidl(const legacy_hal::NanCapabilitie aidl_response->supportsHe = legacy_response.is_he_supported; aidl_response->supportsPairing = legacy_response.is_pairing_supported; aidl_response->supportsSetClusterId = legacy_response.is_set_cluster_id_supported; + aidl_response->supportsSuspension = legacy_response.is_suspension_supported; + return true; } From 4247384b4dd4c7681d8cd88c2f2b4c374b887723 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Thu, 5 Jan 2023 17:29:21 -0800 Subject: [PATCH 578/998] Split VHAL property into a separate AIDL interface. Split VHAL property definitions and enums out from the VHAL interface so that we can update the property separatly. This allows us to backport new property definition to older releases more easily. Test: Manual build Bug: 264600792 Change-Id: I6040a1d4d7832a970a5ad5e5a28c359b15b402fb --- automotive/vehicle/Android.bp | 1 + automotive/vehicle/aidl/Android.bp | 2 +- .../1/.hash | 1 + automotive/vehicle/aidl/aidl_test/Android.bp | 1 + automotive/vehicle/aidl_property/Android.bp | 53 +++++++++++++++++++ .../1/.hash | 2 + .../automotive/vehicle/CreateUserRequest.aidl | 0 .../vehicle/CreateUserResponse.aidl | 0 .../automotive/vehicle/CreateUserStatus.aidl | 0 .../automotive/vehicle/CustomInputType.aidl | 0 .../vehicle/DiagnosticFloatSensorIndex.aidl | 0 .../vehicle/DiagnosticIntegerSensorIndex.aidl | 0 .../ElectronicTollCollectionCardStatus.aidl | 0 .../ElectronicTollCollectionCardType.aidl | 0 .../automotive/vehicle/EvChargeState.aidl | 0 .../automotive/vehicle/EvConnectorType.aidl | 0 .../vehicle/EvRegenerativeBrakingState.aidl | 0 .../vehicle/EvsServiceRequestIndex.aidl | 0 .../automotive/vehicle/EvsServiceState.aidl | 0 .../automotive/vehicle/EvsServiceType.aidl | 0 .../hardware/automotive/vehicle/FuelType.aidl | 0 .../vehicle/InitialUserInfoRequest.aidl | 0 .../vehicle/InitialUserInfoRequestType.aidl | 0 .../vehicle/InitialUserInfoResponse.aidl | 0 .../InitialUserInfoResponseAction.aidl | 0 .../vehicle/Obd2CommonIgnitionMonitors.aidl | 0 .../Obd2CompressionIgnitionMonitors.aidl | 0 .../vehicle/Obd2FuelSystemStatus.aidl | 0 .../automotive/vehicle/Obd2FuelType.aidl | 0 .../vehicle/Obd2IgnitionMonitorKind.aidl | 0 .../vehicle/Obd2SecondaryAirStatus.aidl | 0 .../vehicle/Obd2SparkIgnitionMonitors.aidl | 0 .../automotive/vehicle/PortLocationType.aidl | 0 .../vehicle/ProcessTerminationReason.aidl | 0 .../automotive/vehicle/RemoveUserRequest.aidl | 0 .../automotive/vehicle/RotaryInputType.aidl | 0 .../vehicle/SwitchUserMessageType.aidl | 0 .../automotive/vehicle/SwitchUserRequest.aidl | 0 .../vehicle/SwitchUserResponse.aidl | 0 .../automotive/vehicle/SwitchUserStatus.aidl | 0 .../automotive/vehicle/TrailerState.aidl | 0 .../UserIdentificationAssociation.aidl | 0 ...UserIdentificationAssociationSetValue.aidl | 0 .../UserIdentificationAssociationType.aidl | 0 .../UserIdentificationAssociationValue.aidl | 0 .../vehicle/UserIdentificationGetRequest.aidl | 0 .../vehicle/UserIdentificationResponse.aidl | 0 .../UserIdentificationSetAssociation.aidl | 0 .../vehicle/UserIdentificationSetRequest.aidl | 0 .../hardware/automotive/vehicle/UserInfo.aidl | 0 .../automotive/vehicle/UsersInfo.aidl | 0 .../VehicleApPowerStateConfigFlag.aidl | 0 .../vehicle/VehicleApPowerStateReport.aidl | 0 .../vehicle/VehicleApPowerStateReq.aidl | 0 .../vehicle/VehicleApPowerStateReqIndex.aidl | 0 .../VehicleApPowerStateShutdownParam.aidl | 0 .../automotive/vehicle/VehicleArea.aidl | 0 .../automotive/vehicle/VehicleAreaDoor.aidl | 0 .../automotive/vehicle/VehicleAreaMirror.aidl | 0 .../automotive/vehicle/VehicleAreaSeat.aidl | 0 .../automotive/vehicle/VehicleAreaWheel.aidl | 0 .../automotive/vehicle/VehicleAreaWindow.aidl | 0 .../automotive/vehicle/VehicleDisplay.aidl | 0 .../automotive/vehicle/VehicleGear.aidl | 0 .../vehicle/VehicleHvacFanDirection.aidl | 0 .../vehicle/VehicleHwKeyInputAction.aidl | 0 .../vehicle/VehicleIgnitionState.aidl | 0 .../automotive/vehicle/VehicleLightState.aidl | 0 .../vehicle/VehicleLightSwitch.aidl | 0 .../automotive/vehicle/VehicleOilLevel.aidl | 0 .../automotive/vehicle/VehicleProperty.aidl | 0 .../vehicle/VehiclePropertyGroup.aidl | 0 .../vehicle/VehiclePropertyType.aidl | 0 .../vehicle/VehicleSeatOccupancyState.aidl | 0 .../automotive/vehicle/VehicleTurnSignal.aidl | 0 .../automotive/vehicle/VehicleUnit.aidl | 0 .../vehicle/VehicleVendorPermission.aidl | 0 ...msAvailabilityStateIntegerValuesIndex.aidl | 0 .../VmsBaseMessageIntegerValuesIndex.aidl | 0 .../automotive/vehicle/VmsMessageType.aidl | 0 ...LayerAndPublisherIdIntegerValuesIndex.aidl | 0 ...VmsMessageWithLayerIntegerValuesIndex.aidl | 0 .../VmsOfferingMessageIntegerValuesIndex.aidl | 0 ...ublisherInformationIntegerValuesIndex.aidl | 0 ...StartSessionMessageIntegerValuesIndex.aidl | 0 ...sSubscriptionsStateIntegerValuesIndex.aidl | 0 .../automotive/vehicle/CreateUserRequest.aidl | 0 .../vehicle/CreateUserResponse.aidl | 0 .../automotive/vehicle/CreateUserStatus.aidl | 0 .../automotive/vehicle/CustomInputType.aidl | 0 .../vehicle/DiagnosticFloatSensorIndex.aidl | 0 .../vehicle/DiagnosticIntegerSensorIndex.aidl | 0 .../ElectronicTollCollectionCardStatus.aidl | 0 .../ElectronicTollCollectionCardType.aidl | 0 .../automotive/vehicle/EvChargeState.aidl | 0 .../automotive/vehicle/EvConnectorType.aidl | 0 .../vehicle/EvRegenerativeBrakingState.aidl | 0 .../automotive/vehicle/EvStoppingMode.aidl | 0 .../vehicle/EvsServiceRequestIndex.aidl | 0 .../automotive/vehicle/EvsServiceState.aidl | 0 .../automotive/vehicle/EvsServiceType.aidl | 0 .../hardware/automotive/vehicle/FuelType.aidl | 0 .../vehicle/GsrComplianceRequirementType.aidl | 0 .../vehicle/InitialUserInfoRequest.aidl | 0 .../vehicle/InitialUserInfoRequestType.aidl | 0 .../vehicle/InitialUserInfoResponse.aidl | 0 .../InitialUserInfoResponseAction.aidl | 0 .../vehicle/Obd2CommonIgnitionMonitors.aidl | 0 .../Obd2CompressionIgnitionMonitors.aidl | 0 .../vehicle/Obd2FuelSystemStatus.aidl | 0 .../automotive/vehicle/Obd2FuelType.aidl | 0 .../vehicle/Obd2IgnitionMonitorKind.aidl | 0 .../vehicle/Obd2SecondaryAirStatus.aidl | 0 .../vehicle/Obd2SparkIgnitionMonitors.aidl | 0 .../automotive/vehicle/PortLocationType.aidl | 0 .../vehicle/ProcessTerminationReason.aidl | 0 .../automotive/vehicle/RemoveUserRequest.aidl | 0 .../automotive/vehicle/RotaryInputType.aidl | 0 .../vehicle/SwitchUserMessageType.aidl | 0 .../automotive/vehicle/SwitchUserRequest.aidl | 0 .../vehicle/SwitchUserResponse.aidl | 0 .../automotive/vehicle/SwitchUserStatus.aidl | 0 .../automotive/vehicle/TrailerState.aidl | 0 .../UserIdentificationAssociation.aidl | 0 ...UserIdentificationAssociationSetValue.aidl | 0 .../UserIdentificationAssociationType.aidl | 0 .../UserIdentificationAssociationValue.aidl | 0 .../vehicle/UserIdentificationGetRequest.aidl | 0 .../vehicle/UserIdentificationResponse.aidl | 0 .../UserIdentificationSetAssociation.aidl | 0 .../vehicle/UserIdentificationSetRequest.aidl | 0 .../hardware/automotive/vehicle/UserInfo.aidl | 0 .../automotive/vehicle/UsersInfo.aidl | 0 .../vehicle/VehicleApPowerBootupReason.aidl | 0 .../VehicleApPowerStateConfigFlag.aidl | 0 .../vehicle/VehicleApPowerStateReport.aidl | 0 .../vehicle/VehicleApPowerStateReq.aidl | 0 .../vehicle/VehicleApPowerStateReqIndex.aidl | 0 .../VehicleApPowerStateShutdownParam.aidl | 0 .../automotive/vehicle/VehicleArea.aidl | 0 .../automotive/vehicle/VehicleAreaDoor.aidl | 0 .../automotive/vehicle/VehicleAreaMirror.aidl | 0 .../automotive/vehicle/VehicleAreaSeat.aidl | 0 .../automotive/vehicle/VehicleAreaWheel.aidl | 0 .../automotive/vehicle/VehicleAreaWindow.aidl | 0 .../automotive/vehicle/VehicleDisplay.aidl | 0 .../automotive/vehicle/VehicleGear.aidl | 0 .../vehicle/VehicleHvacFanDirection.aidl | 0 .../vehicle/VehicleHwKeyInputAction.aidl | 0 .../VehicleHwMotionButtonStateFlag.aidl | 0 .../vehicle/VehicleHwMotionInputAction.aidl | 0 .../vehicle/VehicleHwMotionInputSource.aidl | 0 .../vehicle/VehicleHwMotionToolType.aidl | 0 .../vehicle/VehicleIgnitionState.aidl | 0 .../automotive/vehicle/VehicleLightState.aidl | 0 .../vehicle/VehicleLightSwitch.aidl | 0 .../automotive/vehicle/VehicleOilLevel.aidl | 0 .../automotive/vehicle/VehicleProperty.aidl | 0 .../vehicle/VehiclePropertyGroup.aidl | 0 .../vehicle/VehiclePropertyType.aidl | 0 .../vehicle/VehicleSeatOccupancyState.aidl | 0 .../automotive/vehicle/VehicleTurnSignal.aidl | 0 .../automotive/vehicle/VehicleUnit.aidl | 0 .../vehicle/VehicleVendorPermission.aidl | 0 ...msAvailabilityStateIntegerValuesIndex.aidl | 0 .../VmsBaseMessageIntegerValuesIndex.aidl | 0 .../automotive/vehicle/VmsMessageType.aidl | 0 ...LayerAndPublisherIdIntegerValuesIndex.aidl | 0 ...VmsMessageWithLayerIntegerValuesIndex.aidl | 0 .../VmsOfferingMessageIntegerValuesIndex.aidl | 0 ...ublisherInformationIntegerValuesIndex.aidl | 0 ...StartSessionMessageIntegerValuesIndex.aidl | 0 ...sSubscriptionsStateIntegerValuesIndex.aidl | 0 .../automotive/vehicle/CreateUserRequest.aidl | 0 .../vehicle/CreateUserResponse.aidl | 0 .../automotive/vehicle/CreateUserStatus.aidl | 0 .../automotive/vehicle/CustomInputType.aidl | 0 .../vehicle/DiagnosticFloatSensorIndex.aidl | 0 .../vehicle/DiagnosticIntegerSensorIndex.aidl | 0 .../ElectronicTollCollectionCardStatus.aidl | 0 .../ElectronicTollCollectionCardType.aidl | 0 .../automotive/vehicle/EvChargeState.aidl | 0 .../automotive/vehicle/EvConnectorType.aidl | 0 .../vehicle/EvRegenerativeBrakingState.aidl | 0 .../automotive/vehicle/EvStoppingMode.aidl | 0 .../vehicle/EvsServiceRequestIndex.aidl | 0 .../automotive/vehicle/EvsServiceState.aidl | 0 .../automotive/vehicle/EvsServiceType.aidl | 0 .../hardware/automotive/vehicle/FuelType.aidl | 0 .../vehicle/GsrComplianceRequirementType.aidl | 0 .../vehicle/InitialUserInfoRequest.aidl | 0 .../vehicle/InitialUserInfoRequestType.aidl | 0 .../vehicle/InitialUserInfoResponse.aidl | 0 .../InitialUserInfoResponseAction.aidl | 0 .../vehicle/Obd2CommonIgnitionMonitors.aidl | 0 .../Obd2CompressionIgnitionMonitors.aidl | 0 .../vehicle/Obd2FuelSystemStatus.aidl | 0 .../automotive/vehicle/Obd2FuelType.aidl | 0 .../vehicle/Obd2IgnitionMonitorKind.aidl | 0 .../vehicle/Obd2SecondaryAirStatus.aidl | 0 .../vehicle/Obd2SparkIgnitionMonitors.aidl | 0 .../automotive/vehicle/PortLocationType.aidl | 0 .../vehicle/ProcessTerminationReason.aidl | 0 .../automotive/vehicle/RemoveUserRequest.aidl | 0 .../automotive/vehicle/RotaryInputType.aidl | 0 .../vehicle/SwitchUserMessageType.aidl | 0 .../automotive/vehicle/SwitchUserRequest.aidl | 0 .../vehicle/SwitchUserResponse.aidl | 0 .../automotive/vehicle/SwitchUserStatus.aidl | 0 .../automotive/vehicle/TrailerState.aidl | 0 .../UserIdentificationAssociation.aidl | 0 ...UserIdentificationAssociationSetValue.aidl | 0 .../UserIdentificationAssociationType.aidl | 0 .../UserIdentificationAssociationValue.aidl | 0 .../vehicle/UserIdentificationGetRequest.aidl | 0 .../vehicle/UserIdentificationResponse.aidl | 0 .../UserIdentificationSetAssociation.aidl | 0 .../vehicle/UserIdentificationSetRequest.aidl | 0 .../hardware/automotive/vehicle/UserInfo.aidl | 0 .../automotive/vehicle/UsersInfo.aidl | 0 .../vehicle/VehicleApPowerBootupReason.aidl | 0 .../VehicleApPowerStateConfigFlag.aidl | 0 .../vehicle/VehicleApPowerStateReport.aidl | 0 .../vehicle/VehicleApPowerStateReq.aidl | 0 .../vehicle/VehicleApPowerStateReqIndex.aidl | 0 .../VehicleApPowerStateShutdownParam.aidl | 0 .../automotive/vehicle/VehicleArea.aidl | 0 .../automotive/vehicle/VehicleAreaDoor.aidl | 0 .../automotive/vehicle/VehicleAreaMirror.aidl | 0 .../automotive/vehicle/VehicleAreaSeat.aidl | 0 .../automotive/vehicle/VehicleAreaWheel.aidl | 0 .../automotive/vehicle/VehicleAreaWindow.aidl | 0 .../automotive/vehicle/VehicleDisplay.aidl | 0 .../automotive/vehicle/VehicleGear.aidl | 0 .../vehicle/VehicleHvacFanDirection.aidl | 0 .../vehicle/VehicleHwKeyInputAction.aidl | 0 .../VehicleHwMotionButtonStateFlag.aidl | 0 .../vehicle/VehicleHwMotionInputAction.aidl | 0 .../vehicle/VehicleHwMotionInputSource.aidl | 0 .../vehicle/VehicleHwMotionToolType.aidl | 0 .../vehicle/VehicleIgnitionState.aidl | 0 .../automotive/vehicle/VehicleLightState.aidl | 0 .../vehicle/VehicleLightSwitch.aidl | 0 .../automotive/vehicle/VehicleOilLevel.aidl | 0 .../automotive/vehicle/VehicleProperty.aidl | 0 .../vehicle/VehiclePropertyGroup.aidl | 0 .../vehicle/VehiclePropertyType.aidl | 0 .../vehicle/VehicleSeatOccupancyState.aidl | 0 .../automotive/vehicle/VehicleTurnSignal.aidl | 0 .../automotive/vehicle/VehicleUnit.aidl | 0 .../vehicle/VehicleVendorPermission.aidl | 0 ...msAvailabilityStateIntegerValuesIndex.aidl | 0 .../VmsBaseMessageIntegerValuesIndex.aidl | 0 .../automotive/vehicle/VmsMessageType.aidl | 0 ...LayerAndPublisherIdIntegerValuesIndex.aidl | 0 ...VmsMessageWithLayerIntegerValuesIndex.aidl | 0 .../VmsOfferingMessageIntegerValuesIndex.aidl | 0 ...ublisherInformationIntegerValuesIndex.aidl | 0 ...StartSessionMessageIntegerValuesIndex.aidl | 0 ...sSubscriptionsStateIntegerValuesIndex.aidl | 0 automotive/vehicle/vhal_static_cpp_lib.mk | 4 +- 261 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 automotive/vehicle/aidl_property/Android.bp create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/.hash rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/CreateUserRequest.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/CreateUserResponse.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/CreateUserStatus.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/CustomInputType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/EvChargeState.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/EvConnectorType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/EvsServiceState.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/EvsServiceType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/FuelType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/Obd2FuelType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/PortLocationType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/RemoveUserRequest.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/RotaryInputType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/SwitchUserRequest.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/SwitchUserResponse.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/SwitchUserStatus.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/TrailerState.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/UserInfo.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/UsersInfo.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleArea.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleDisplay.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleGear.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleLightState.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleOilLevel.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleProperty.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehiclePropertyType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleUnit.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VmsMessageType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/1/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/CreateUserRequest.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/CreateUserResponse.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/CreateUserStatus.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/CustomInputType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/EvChargeState.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/EvConnectorType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/EvStoppingMode.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/EvsServiceState.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/EvsServiceType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/FuelType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/Obd2FuelType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/PortLocationType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/RemoveUserRequest.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/RotaryInputType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/SwitchUserRequest.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/SwitchUserResponse.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/SwitchUserStatus.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/TrailerState.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/UserInfo.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/UsersInfo.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleApPowerBootupReason.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleArea.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleDisplay.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleGear.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleHwMotionInputAction.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleHwMotionInputSource.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleHwMotionToolType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleLightState.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleOilLevel.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleProperty.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehiclePropertyType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleUnit.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VmsMessageType.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl (100%) rename automotive/vehicle/{aidl/aidl_api/android.hardware.automotive.vehicle => aidl_property/aidl_api/android.hardware.automotive.vehicle.property}/current/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/CreateUserRequest.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/CreateUserResponse.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/CreateUserStatus.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/CustomInputType.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/EvChargeState.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/EvConnectorType.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/EvStoppingMode.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/EvsServiceState.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/EvsServiceType.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/FuelType.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/Obd2FuelType.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/PortLocationType.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/RemoveUserRequest.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/RotaryInputType.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/SwitchUserRequest.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/SwitchUserResponse.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/SwitchUserStatus.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/TrailerState.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/UserInfo.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/UsersInfo.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleApPowerBootupReason.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleArea.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleDisplay.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleGear.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleHwMotionInputAction.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleHwMotionInputSource.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleHwMotionToolType.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleLightState.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleOilLevel.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleProperty.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehiclePropertyType.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleUnit.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VmsMessageType.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl (100%) rename automotive/vehicle/{aidl => aidl_property}/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl (100%) diff --git a/automotive/vehicle/Android.bp b/automotive/vehicle/Android.bp index f4a7cd16eb..c0d71d7dac 100644 --- a/automotive/vehicle/Android.bp +++ b/automotive/vehicle/Android.bp @@ -22,5 +22,6 @@ cc_defaults { name: "VehicleHalInterfaceDefaults", static_libs: [ "android.hardware.automotive.vehicle-V2-ndk", + "android.hardware.automotive.vehicle.property-V2-ndk", ], } diff --git a/automotive/vehicle/aidl/Android.bp b/automotive/vehicle/aidl/Android.bp index 18a504698c..9c8d9c5f6d 100644 --- a/automotive/vehicle/aidl/Android.bp +++ b/automotive/vehicle/aidl/Android.bp @@ -25,7 +25,7 @@ aidl_interface { name: "android.hardware.automotive.vehicle", vendor_available: true, srcs: [ - "android/hardware/automotive/vehicle/**/*.aidl", + "android/hardware/automotive/vehicle/*.aidl", ], frozen: false, stability: "vintf", diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/.hash b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/.hash index f4785043b5..d9fd5adc1d 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/.hash +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/.hash @@ -1 +1,2 @@ 8610b651e162c614a97542d6f4ed039c969823e5 +0678e142246842695c1ba0524592fe2c3b789fc6 diff --git a/automotive/vehicle/aidl/aidl_test/Android.bp b/automotive/vehicle/aidl/aidl_test/Android.bp index cf7ef1e404..44d7445d25 100644 --- a/automotive/vehicle/aidl/aidl_test/Android.bp +++ b/automotive/vehicle/aidl/aidl_test/Android.bp @@ -52,6 +52,7 @@ android_test { ], static_libs: [ "android.hardware.automotive.vehicle-V2-java", + "android.hardware.automotive.vehicle.property-V2-java", "androidx.test.runner", "truth-prebuilt", ], diff --git a/automotive/vehicle/aidl_property/Android.bp b/automotive/vehicle/aidl_property/Android.bp new file mode 100644 index 0000000000..58ce50d6e8 --- /dev/null +++ b/automotive/vehicle/aidl_property/Android.bp @@ -0,0 +1,53 @@ +// 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 { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +aidl_interface { + name: "android.hardware.automotive.vehicle.property", + vendor_available: true, + srcs: [ + // This HAL was originally part of android.hardware.automotive.vehicle + "android/hardware/automotive/vehicle/*.aidl", + ], + frozen: false, + stability: "vintf", + backend: { + cpp: { + enabled: false, + }, + java: { + sdk_version: "module_current", + min_sdk_version: "31", + apex_available: [ + "//apex_available:platform", + "com.android.car.framework", + ], + }, + }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/.hash b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/.hash new file mode 100644 index 0000000000..02d7352c60 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/.hash @@ -0,0 +1,2 @@ +8610b651e162c614a97542d6f4ed039c969823e5 +d80c4423311162bf7e4fdda8c7be2bad2371cc00 diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/CreateUserRequest.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/CreateUserRequest.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/CreateUserRequest.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/CreateUserRequest.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/CreateUserResponse.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/CreateUserResponse.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/CreateUserResponse.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/CreateUserResponse.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/CreateUserStatus.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/CreateUserStatus.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/CreateUserStatus.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/CreateUserStatus.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/CustomInputType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/CustomInputType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/CustomInputType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/CustomInputType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvChargeState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/EvChargeState.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvChargeState.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/EvChargeState.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvConnectorType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/EvConnectorType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvConnectorType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/EvConnectorType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvsServiceState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/EvsServiceState.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvsServiceState.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/EvsServiceState.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvsServiceType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/EvsServiceType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/EvsServiceType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/EvsServiceType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/FuelType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/FuelType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/FuelType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/FuelType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2FuelType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/Obd2FuelType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2FuelType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/Obd2FuelType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/PortLocationType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/PortLocationType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/PortLocationType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/PortLocationType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/RemoveUserRequest.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/RemoveUserRequest.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/RemoveUserRequest.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/RemoveUserRequest.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/RotaryInputType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/RotaryInputType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/RotaryInputType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/RotaryInputType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SwitchUserRequest.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/SwitchUserRequest.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SwitchUserRequest.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/SwitchUserRequest.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SwitchUserResponse.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/SwitchUserResponse.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SwitchUserResponse.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/SwitchUserResponse.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SwitchUserStatus.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/SwitchUserStatus.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/SwitchUserStatus.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/SwitchUserStatus.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/TrailerState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/TrailerState.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/TrailerState.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/TrailerState.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserInfo.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/UserInfo.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UserInfo.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/UserInfo.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UsersInfo.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/UsersInfo.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/UsersInfo.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/UsersInfo.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleArea.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleArea.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleArea.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleArea.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleDisplay.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleDisplay.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleDisplay.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleDisplay.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleGear.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleGear.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleGear.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleGear.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleLightState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleLightState.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleLightState.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleLightState.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleOilLevel.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleOilLevel.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleOilLevel.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleOilLevel.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleProperty.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleProperty.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleProperty.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropertyType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehiclePropertyType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehiclePropertyType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehiclePropertyType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleUnit.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleUnit.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleUnit.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleUnit.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsMessageType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VmsMessageType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsMessageType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VmsMessageType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/1/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/1/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/CreateUserRequest.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CreateUserRequest.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/CreateUserRequest.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CreateUserRequest.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/CreateUserResponse.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CreateUserResponse.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/CreateUserResponse.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CreateUserResponse.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/CreateUserStatus.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CreateUserStatus.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/CreateUserStatus.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CreateUserStatus.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/CustomInputType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CustomInputType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/CustomInputType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CustomInputType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvChargeState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EvChargeState.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvChargeState.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EvChargeState.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvConnectorType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EvConnectorType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvConnectorType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EvConnectorType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvStoppingMode.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EvStoppingMode.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvStoppingMode.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EvStoppingMode.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvsServiceState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EvsServiceState.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvsServiceState.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EvsServiceState.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvsServiceType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EvsServiceType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/EvsServiceType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EvsServiceType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/FuelType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/FuelType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/FuelType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/FuelType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2FuelType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2FuelType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2FuelType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2FuelType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/PortLocationType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/PortLocationType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/PortLocationType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/PortLocationType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/RemoveUserRequest.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/RemoveUserRequest.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/RemoveUserRequest.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/RemoveUserRequest.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/RotaryInputType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/RotaryInputType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/RotaryInputType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/RotaryInputType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SwitchUserRequest.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/SwitchUserRequest.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SwitchUserRequest.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/SwitchUserRequest.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SwitchUserResponse.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/SwitchUserResponse.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SwitchUserResponse.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/SwitchUserResponse.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SwitchUserStatus.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/SwitchUserStatus.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/SwitchUserStatus.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/SwitchUserStatus.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/TrailerState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/TrailerState.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/TrailerState.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/TrailerState.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserInfo.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UserInfo.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UserInfo.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UserInfo.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UsersInfo.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UsersInfo.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/UsersInfo.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UsersInfo.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerBootupReason.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerBootupReason.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerBootupReason.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerBootupReason.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleArea.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleArea.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleArea.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleArea.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleDisplay.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleDisplay.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleDisplay.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleDisplay.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleGear.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleGear.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleGear.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleGear.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionInputAction.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleHwMotionInputAction.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionInputAction.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleHwMotionInputAction.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionInputSource.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleHwMotionInputSource.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionInputSource.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleHwMotionInputSource.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionToolType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleHwMotionToolType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleHwMotionToolType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleHwMotionToolType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleLightState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleLightState.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleLightState.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleLightState.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleOilLevel.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleOilLevel.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleOilLevel.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleOilLevel.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleProperty.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehiclePropertyType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehiclePropertyType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleUnit.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleUnit.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleUnit.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleUnit.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsMessageType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VmsMessageType.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsMessageType.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VmsMessageType.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/CreateUserRequest.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CreateUserRequest.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/CreateUserRequest.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CreateUserRequest.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/CreateUserResponse.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CreateUserResponse.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/CreateUserResponse.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CreateUserResponse.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/CreateUserStatus.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CreateUserStatus.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/CreateUserStatus.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CreateUserStatus.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/CustomInputType.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CustomInputType.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/CustomInputType.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CustomInputType.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvChargeState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvChargeState.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvChargeState.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvChargeState.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvConnectorType.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvConnectorType.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvConnectorType.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvConnectorType.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvStoppingMode.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvStoppingMode.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvStoppingMode.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvStoppingMode.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvsServiceState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvsServiceState.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvsServiceState.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvsServiceState.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvsServiceType.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvsServiceType.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/EvsServiceType.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvsServiceType.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/FuelType.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/FuelType.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/FuelType.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/FuelType.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2FuelType.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/Obd2FuelType.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2FuelType.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/Obd2FuelType.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/PortLocationType.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/PortLocationType.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/PortLocationType.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/PortLocationType.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/RemoveUserRequest.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/RemoveUserRequest.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/RemoveUserRequest.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/RemoveUserRequest.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/RotaryInputType.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/RotaryInputType.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/RotaryInputType.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/RotaryInputType.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SwitchUserRequest.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/SwitchUserRequest.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/SwitchUserRequest.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/SwitchUserRequest.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SwitchUserResponse.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/SwitchUserResponse.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/SwitchUserResponse.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/SwitchUserResponse.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/SwitchUserStatus.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/SwitchUserStatus.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/SwitchUserStatus.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/SwitchUserStatus.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/TrailerState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/TrailerState.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/TrailerState.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/TrailerState.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserInfo.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/UserInfo.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/UserInfo.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/UserInfo.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/UsersInfo.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/UsersInfo.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/UsersInfo.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/UsersInfo.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerBootupReason.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleApPowerBootupReason.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerBootupReason.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleApPowerBootupReason.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleArea.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleArea.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleArea.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleArea.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleDisplay.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleDisplay.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleDisplay.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleDisplay.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleGear.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleGear.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleGear.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleGear.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionInputAction.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleHwMotionInputAction.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionInputAction.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleHwMotionInputAction.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionInputSource.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleHwMotionInputSource.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionInputSource.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleHwMotionInputSource.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionToolType.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleHwMotionToolType.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleHwMotionToolType.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleHwMotionToolType.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleLightState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleLightState.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleLightState.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleLightState.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleOilLevel.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleOilLevel.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleOilLevel.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleOilLevel.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleProperty.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropertyType.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehiclePropertyType.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropertyType.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehiclePropertyType.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleUnit.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleUnit.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleUnit.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleUnit.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsMessageType.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VmsMessageType.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsMessageType.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VmsMessageType.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl similarity index 100% rename from automotive/vehicle/aidl/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl rename to automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl diff --git a/automotive/vehicle/vhal_static_cpp_lib.mk b/automotive/vehicle/vhal_static_cpp_lib.mk index b15b26cfe5..995589c47e 100644 --- a/automotive/vehicle/vhal_static_cpp_lib.mk +++ b/automotive/vehicle/vhal_static_cpp_lib.mk @@ -15,4 +15,6 @@ # This make file contains the latest version of static cpp libraries for VHAL # interface and VHAL properties. -LOCAL_STATIC_LIBRARIES += android.hardware.automotive.vehicle-V2-ndk +LOCAL_STATIC_LIBRARIES += \ + android.hardware.automotive.vehicle-V2-ndk \ + android.hardware.automotive.vehicle.property-V2-ndk From 17bc578112155ad6b41c76a30cc5a44b5d7edb26 Mon Sep 17 00:00:00 2001 From: Eva Chen Date: Fri, 6 Jan 2023 22:59:58 -0800 Subject: [PATCH 579/998] Update VtsHalAutomotiveVehicleTargetTest::verifyProperty to only run on implemented properties. Bug: 264730687 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I027e2324f30b34600bc1036bfcdd1547b245667f --- .../VtsHalAutomotiveVehicle_TargetTest.cpp | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 7a023ef42b..46b617bec8 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -438,13 +438,30 @@ void VtsHalAutomotiveVehicleTargetTest::verifyProperty(VehicleProperty propId, int expectedArea = toInt(area); int expectedPropertyType = toInt(propertyType); - auto result = mVhalClient->getPropConfigs({expectedPropId}); + auto result = mVhalClient->getAllPropConfigs(); + ASSERT_TRUE(result.ok()) << "Failed to get all property configs, error: " + << result.error().message(); + + // Check if property is implemented by getting all configs and looking to see if the expected + // property id is in that list. + bool isExpectedPropIdImplemented = false; + for (const auto& cfgPtr : result.value()) { + const IHalPropConfig& cfg = *cfgPtr; + if (expectedPropId == cfg.getPropId()) { + isExpectedPropIdImplemented = true; + break; + } + } + + if (!isExpectedPropIdImplemented) { + GTEST_SKIP() << StringPrintf("Property %" PRId32 " has not been implemented", + expectedPropId); + } + + result = mVhalClient->getPropConfigs({expectedPropId}); ASSERT_TRUE(result.ok()) << "Failed to get required property config, error: " << result.error().message(); - if (result.value().size() == 0) { - GTEST_SKIP() << "Property has not been implemented"; - } ASSERT_EQ(result.value().size(), 1u) << StringPrintf("Expect to get exactly 1 config, got %zu", result.value().size()); From f6c673b49764b3e93aefa766d24c28de842e3508 Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Tue, 10 Jan 2023 19:33:45 +0000 Subject: [PATCH 580/998] Enable toString for Result in broadcast radio HAL ToString is enabled for Result enum in AIDL broadcast radio HAL. Some automatic generated files were also modified when updating this AIDL API. Bug: 264931778 Test: atest VtsHalBroadcastradioAidlTargetTest Change-Id: Ia4ac02a95adbbcceac90c5b5106a7ea52dc447e9 --- .../broadcastradio/AmFmRegionConfig.aidl | 8 +++---- .../broadcastradio/AnnouncementType.aidl | 14 +++++------ .../hardware/broadcastradio/ConfigFlag.aidl | 16 ++++++------- .../broadcastradio/IdentifierType.aidl | 24 +++++++++---------- .../hardware/broadcastradio/ProgramInfo.aidl | 12 +++++----- .../hardware/broadcastradio/Result.aidl | 18 +++++++------- .../hardware/broadcastradio/Result.aidl | 3 ++- 7 files changed, 48 insertions(+), 47 deletions(-) diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmRegionConfig.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmRegionConfig.aidl index f3aecdfe75..fe8489c69d 100644 --- a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmRegionConfig.aidl +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AmFmRegionConfig.aidl @@ -37,8 +37,8 @@ parcelable AmFmRegionConfig { android.hardware.broadcastradio.AmFmBandRange[] ranges; int fmDeemphasis; int fmRds; - const int DEEMPHASIS_D50 = 1; - const int DEEMPHASIS_D75 = 2; - const int RDS = 1; - const int RBDS = 2; + const int DEEMPHASIS_D50 = (1 << 0); + const int DEEMPHASIS_D75 = (1 << 1); + const int RDS = (1 << 0); + const int RBDS = (1 << 1); } diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AnnouncementType.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AnnouncementType.aidl index 237b86880c..1d187fe0b2 100644 --- a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AnnouncementType.aidl +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/AnnouncementType.aidl @@ -36,11 +36,11 @@ package android.hardware.broadcastradio; enum AnnouncementType { INVALID = 0, EMERGENCY = 1, - WARNING = 2, - TRAFFIC = 3, - WEATHER = 4, - NEWS = 5, - EVENT = 6, - SPORT = 7, - MISC = 8, + WARNING, + TRAFFIC, + WEATHER, + NEWS, + EVENT, + SPORT, + MISC, } diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ConfigFlag.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ConfigFlag.aidl index 6fb9a62213..98af437266 100644 --- a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ConfigFlag.aidl +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ConfigFlag.aidl @@ -35,12 +35,12 @@ package android.hardware.broadcastradio; @Backing(type="int") @JavaDerive(equals=true, toString=true) @VintfStability enum ConfigFlag { FORCE_MONO = 1, - FORCE_ANALOG = 2, - FORCE_DIGITAL = 3, - RDS_AF = 4, - RDS_REG = 5, - DAB_DAB_LINKING = 6, - DAB_FM_LINKING = 7, - DAB_DAB_SOFT_LINKING = 8, - DAB_FM_SOFT_LINKING = 9, + FORCE_ANALOG, + FORCE_DIGITAL, + RDS_AF, + RDS_REG, + DAB_DAB_LINKING, + DAB_FM_LINKING, + DAB_DAB_SOFT_LINKING, + DAB_FM_SOFT_LINKING, } diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IdentifierType.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IdentifierType.aidl index 4e8296a88b..4df272c3c3 100644 --- a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IdentifierType.aidl +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/IdentifierType.aidl @@ -37,16 +37,16 @@ enum IdentifierType { VENDOR_START = 1000, VENDOR_END = 1999, INVALID = 0, - AMFM_FREQUENCY_KHZ = 1, - RDS_PI = 2, - HD_STATION_ID_EXT = 3, - HD_STATION_NAME = 4, - DAB_SID_EXT = 5, - DAB_ENSEMBLE = 6, - DAB_SCID = 7, - DAB_FREQUENCY_KHZ = 8, - DRMO_SERVICE_ID = 9, - DRMO_FREQUENCY_KHZ = 10, - SXM_SERVICE_ID = 12, - SXM_CHANNEL = 13, + AMFM_FREQUENCY_KHZ, + RDS_PI, + HD_STATION_ID_EXT, + HD_STATION_NAME, + DAB_SID_EXT, + DAB_ENSEMBLE, + DAB_SCID, + DAB_FREQUENCY_KHZ, + DRMO_SERVICE_ID, + DRMO_FREQUENCY_KHZ, + SXM_SERVICE_ID = (DRMO_FREQUENCY_KHZ + 2), + SXM_CHANNEL, } diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramInfo.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramInfo.aidl index 5e662d2450..b14023a3c0 100644 --- a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramInfo.aidl +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/ProgramInfo.aidl @@ -42,10 +42,10 @@ parcelable ProgramInfo { int signalQuality; android.hardware.broadcastradio.Metadata[] metadata; android.hardware.broadcastradio.VendorKeyValue[] vendorInfo; - const int FLAG_LIVE = 1; - const int FLAG_MUTED = 2; - const int FLAG_TRAFFIC_PROGRAM = 4; - const int FLAG_TRAFFIC_ANNOUNCEMENT = 8; - const int FLAG_TUNABLE = 16; - const int FLAG_STEREO = 32; + const int FLAG_LIVE = (1 << 0); + const int FLAG_MUTED = (1 << 1); + const int FLAG_TRAFFIC_PROGRAM = (1 << 2); + const int FLAG_TRAFFIC_ANNOUNCEMENT = (1 << 3); + const int FLAG_TUNABLE = (1 << 4); + const int FLAG_STEREO = (1 << 5); } diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Result.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Result.aidl index 3464412918..8af74c74fb 100644 --- a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Result.aidl +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/current/android/hardware/broadcastradio/Result.aidl @@ -32,14 +32,14 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.broadcastradio; -@Backing(type="int") @VintfStability +@Backing(type="int") @JavaDerive(equals=true, toString=true) @VintfStability enum Result { - OK = 0, - INTERNAL_ERROR = 1, - INVALID_ARGUMENTS = 2, - INVALID_STATE = 3, - NOT_SUPPORTED = 4, - TIMEOUT = 5, - CANCELED = 6, - UNKNOWN_ERROR = 7, + OK, + INTERNAL_ERROR, + INVALID_ARGUMENTS, + INVALID_STATE, + NOT_SUPPORTED, + TIMEOUT, + CANCELED, + UNKNOWN_ERROR, } diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl index 3f7ddac63d..9f7263a1f1 100644 --- a/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl +++ b/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl @@ -21,11 +21,12 @@ package android.hardware.broadcastradio; */ @VintfStability @Backing(type="int") +@JavaDerive(equals=true, toString=true) enum Result { /** * Methods run without error. */ - OK, + OK = 0, /** * Internal error in HAL. From 771928d151f2b49e2dd4ef87e1d753d0dbaaa767 Mon Sep 17 00:00:00 2001 From: Nathalie Le Clair Date: Wed, 11 Jan 2023 13:48:29 +0100 Subject: [PATCH 581/998] Remove unused test mapping file These files were created when the HDMI Connection HAL was still called the HDMI HAL. They are no longer required today and should be removed. Test: none Bug: 265065502 Change-Id: I066896077cdc009cc573bb7df44c7b4fdc4c8baf --- tv/hdmi/aidl/TEST_MAPPING | 7 -- tv/hdmi/aidl/vts/functional/AndroidTest.xml | 33 ----- .../functional/VtsHalTvHdmiAidlTargetTest.cpp | 119 ------------------ 3 files changed, 159 deletions(-) delete mode 100644 tv/hdmi/aidl/TEST_MAPPING delete mode 100644 tv/hdmi/aidl/vts/functional/AndroidTest.xml delete mode 100644 tv/hdmi/aidl/vts/functional/VtsHalTvHdmiAidlTargetTest.cpp diff --git a/tv/hdmi/aidl/TEST_MAPPING b/tv/hdmi/aidl/TEST_MAPPING deleted file mode 100644 index 6bd3b571df..0000000000 --- a/tv/hdmi/aidl/TEST_MAPPING +++ /dev/null @@ -1,7 +0,0 @@ -{ - "presubmit": [ - { - "name": "VtsHalTvHdmiAidlTargetTest" - } - ] -} diff --git a/tv/hdmi/aidl/vts/functional/AndroidTest.xml b/tv/hdmi/aidl/vts/functional/AndroidTest.xml deleted file mode 100644 index 0640b2db42..0000000000 --- a/tv/hdmi/aidl/vts/functional/AndroidTest.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - diff --git a/tv/hdmi/aidl/vts/functional/VtsHalTvHdmiAidlTargetTest.cpp b/tv/hdmi/aidl/vts/functional/VtsHalTvHdmiAidlTargetTest.cpp deleted file mode 100644 index fd4d94f628..0000000000 --- a/tv/hdmi/aidl/vts/functional/VtsHalTvHdmiAidlTargetTest.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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. - */ - -#define LOG_TAG "Hdmi_hal_test" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using ::aidl::android::hardware::tv::hdmi::BnHdmiCallback; -using ::aidl::android::hardware::tv::hdmi::HdmiPortInfo; -using ::aidl::android::hardware::tv::hdmi::HdmiPortType; -using ::aidl::android::hardware::tv::hdmi::HpdSignal; -using ::aidl::android::hardware::tv::hdmi::IHdmi; -using ::aidl::android::hardware::tv::hdmi::IHdmiCallback; -using ::ndk::SpAIBinder; - -#define INCORRECT_VENDOR_ID 0x00 -#define TV_PHYSICAL_ADDRESS 0x0000 - -// The main test class for TV HDMI HAL. -class HdmiTest : public ::testing::TestWithParam { - static void serviceDied(void* /* cookie */) { ALOGE("VtsHalTvCecAidlTargetTest died"); } - - public: - void SetUp() override { - hdmi = IHdmi::fromBinder(SpAIBinder(AServiceManager_waitForService(GetParam().c_str()))); - ASSERT_NE(hdmi, nullptr); - ALOGI("%s: getService() for hdmi is %s", __func__, hdmi->isRemote() ? "remote" : "local"); - - hdmiCallback = ::ndk::SharedRefBase::make(); - ASSERT_NE(hdmiCallback, nullptr); - hdmiDeathRecipient = - ndk::ScopedAIBinder_DeathRecipient(AIBinder_DeathRecipient_new(&serviceDied)); - ASSERT_EQ(AIBinder_linkToDeath(hdmi->asBinder().get(), hdmiDeathRecipient.get(), 0), - STATUS_OK); - } - - class HdmiCallback : public BnHdmiCallback { - public: - ::ndk::ScopedAStatus onHotplugEvent(bool connected __unused, int32_t portId __unused) { - return ::ndk::ScopedAStatus::ok(); - }; - }; - - std::shared_ptr hdmi; - std::shared_ptr hdmiCallback; - ::ndk::ScopedAIBinder_DeathRecipient hdmiDeathRecipient; -}; - -GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(HdmiTest); -INSTANTIATE_TEST_SUITE_P(PerInstance, HdmiTest, - testing::ValuesIn(android::getAidlHalInstanceNames(IHdmi::descriptor)), - android::PrintInstanceNameToString); - -TEST_P(HdmiTest, SetCallback) { - ASSERT_TRUE(hdmi->setCallback(::ndk::SharedRefBase::make()).isOk()); -} - -TEST_P(HdmiTest, GetPortInfo) { - std::vector ports; - ASSERT_TRUE(hdmi->getPortInfo(&ports).isOk()); - - bool cecSupportedOnDevice = false; - for (size_t i = 0; i < ports.size(); ++i) { - EXPECT_TRUE((ports[i].type == HdmiPortType::OUTPUT) || - (ports[i].type == HdmiPortType::INPUT)); - if (ports[i].portId == 0) { - ALOGW("%s: Port id should start from 1", __func__); - } - cecSupportedOnDevice = cecSupportedOnDevice | ports[i].cecSupported; - } - EXPECT_NE(cecSupportedOnDevice, false) << "At least one port should support CEC"; -} - -TEST_P(HdmiTest, IsConnected) { - std::vector ports; - ASSERT_TRUE(hdmi->getPortInfo(&ports).isOk()); - for (size_t i = 0; i < ports.size(); ++i) { - bool connected; - ASSERT_TRUE(hdmi->isConnected(ports[i].portId, &connected).isOk()); - } -} - -TEST_P(HdmiTest, HdpSignal) { - HpdSignal originalSignal; - HpdSignal signal = HpdSignal::HDMI_HPD_STATUS_BIT; - HpdSignal readSignal; - ASSERT_TRUE(hdmi->getHpdSignal(&originalSignal).isOk()); - ASSERT_TRUE(hdmi->setHpdSignal(signal).isOk()); - ASSERT_TRUE(hdmi->getHpdSignal(&readSignal).isOk()); - EXPECT_EQ(readSignal, signal); - signal = HpdSignal::HDMI_HPD_PHYSICAL; - ASSERT_TRUE(hdmi->setHpdSignal(signal).isOk()); - ASSERT_TRUE(hdmi->getHpdSignal(&readSignal).isOk()); - EXPECT_EQ(readSignal, signal); - ASSERT_TRUE(hdmi->setHpdSignal(originalSignal).isOk()); -} From 11921783d533903ba1045b3ed5a50d5cbabab201 Mon Sep 17 00:00:00 2001 From: Biswarup Pal Date: Mon, 9 Jan 2023 14:10:51 +0000 Subject: [PATCH 582/998] Add suspendable option in NanDiscoveryCommonConfig Test: m Bug: 263014869 Change-Id: I0bef43f361a3773ff3e589d44afe4595ddd4e21f --- .../android/hardware/wifi/NanDiscoveryCommonConfig.aidl | 1 + .../android/hardware/wifi/NanDiscoveryCommonConfig.aidl | 6 ++++++ wifi/aidl/default/aidl_struct_util.cpp | 3 +++ 3 files changed, 10 insertions(+) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDiscoveryCommonConfig.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDiscoveryCommonConfig.aidl index 761cdbb643..e84cabfdf9 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDiscoveryCommonConfig.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDiscoveryCommonConfig.aidl @@ -54,4 +54,5 @@ parcelable NanDiscoveryCommonConfig { android.hardware.wifi.NanRangingIndication configRangingIndications; char distanceIngressCm; char distanceEgressCm; + boolean enableSessionSuspendability; } diff --git a/wifi/aidl/android/hardware/wifi/NanDiscoveryCommonConfig.aidl b/wifi/aidl/android/hardware/wifi/NanDiscoveryCommonConfig.aidl index ca1e01693e..e98658b012 100644 --- a/wifi/aidl/android/hardware/wifi/NanDiscoveryCommonConfig.aidl +++ b/wifi/aidl/android/hardware/wifi/NanDiscoveryCommonConfig.aidl @@ -155,4 +155,10 @@ parcelable NanDiscoveryCommonConfig { */ char distanceIngressCm; char distanceEgressCm; + /** + * Specifies whether suspension can be possible in this discovery session. + * The request would fail if |enableSessionSuspendability| is true but + * |NanCapabilities.supportsSuspension| is false. + */ + boolean enableSessionSuspendability; } diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index 8a7f7e4ae5..4bd7fbef53 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -1850,6 +1850,7 @@ bool convertAidlNanPublishRequestToLegacy(const NanPublishRequest& aidl_request, LOG(ERROR) << "convertAidlNanPublishRequestToLegacy: invalid pairing config"; return false; } + legacy_request->enable_suspendability = aidl_request.baseConfigs.enableSessionSuspendability; return true; } @@ -1996,6 +1997,8 @@ bool convertAidlNanSubscribeRequestToLegacy(const NanSubscribeRequest& aidl_requ LOG(ERROR) << "convertAidlNanSubscribeRequestToLegacy: invalid pairing config"; return false; } + legacy_request->enable_suspendability = aidl_request.baseConfigs.enableSessionSuspendability; + return true; } From 43d9af64dc4f8ad72468312a1aef1e05cff2e48f Mon Sep 17 00:00:00 2001 From: Phill Hayers Date: Wed, 30 Nov 2022 15:18:26 +0000 Subject: [PATCH 583/998] Add AIDL definitions for NAN suspension. Bug: 259950106 Test: Not tested. Change-Id: I0194fc2a1d9f57ca6ba14f76f5453264e3af3cca --- .../android/hardware/wifi/IWifiNanIface.aidl | 2 ++ .../wifi/IWifiNanIfaceEventCallback.aidl | 2 ++ .../android/hardware/wifi/IWifiStaIface.aidl | 30 +++++++++---------- .../hardware/wifi/IfaceConcurrencyType.aidl | 10 +++---- .../android/hardware/wifi/IfaceType.aidl | 8 ++--- .../android/hardware/wifi/NanBandIndex.aidl | 2 +- .../hardware/wifi/NanBootstrappingMethod.aidl | 22 +++++++------- .../hardware/wifi/NanCipherSuiteType.aidl | 8 ++--- .../hardware/wifi/NanClusterEventType.aidl | 4 +-- .../hardware/wifi/NanDataPathChannelCfg.aidl | 4 +-- .../wifi/NanDataPathSecurityType.aidl | 6 ++-- .../android/hardware/wifi/NanMatchAlg.aidl | 4 +-- .../hardware/wifi/NanPairingRequestType.aidl | 2 +- .../hardware/wifi/NanPairingSecurityType.aidl | 6 ++-- .../android/hardware/wifi/NanPublishType.aidl | 4 +-- .../hardware/wifi/NanRangingIndication.aidl | 6 ++-- .../android/hardware/wifi/NanSrfType.aidl | 2 +- .../android/hardware/wifi/NanStatusCode.aidl | 1 + .../hardware/wifi/NanSubscribeType.aidl | 2 +- .../android/hardware/wifi/NanTxType.aidl | 2 +- .../current/android/hardware/wifi/RttBw.aidl | 16 +++++----- .../android/hardware/wifi/RttPreamble.aidl | 10 +++---- ...groundScanBucketEventReportSchemeMask.aidl | 6 ++-- .../hardware/wifi/StaScanDataFlagMask.aidl | 2 +- .../hardware/wifi/WifiChannelWidthInMhz.aidl | 2 +- .../wifi/WifiDebugPacketFateFrameType.aidl | 6 ++-- .../wifi/WifiDebugRingBufferFlags.aidl | 6 ++-- .../hardware/wifi/WifiDebugRxPacketFate.aidl | 22 +++++++------- .../hardware/wifi/WifiDebugTxPacketFate.aidl | 20 ++++++------- .../android/hardware/wifi/WifiIfaceMode.aidl | 16 +++++----- .../android/hardware/wifi/WifiStatusCode.aidl | 20 ++++++------- .../android/hardware/wifi/IWifiNanIface.aidl | 26 ++++++++++++++++ .../wifi/IWifiNanIfaceEventCallback.aidl | 26 ++++++++++++++++ .../android/hardware/wifi/NanStatusCode.aidl | 6 +++- 34 files changed, 186 insertions(+), 125 deletions(-) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIface.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIface.aidl index 3dff5bf08b..b20f505944 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIface.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIface.aidl @@ -49,6 +49,8 @@ interface IWifiNanIface { void stopPublishRequest(in char cmdId, in byte sessionId); void stopSubscribeRequest(in char cmdId, in byte sessionId); void terminateDataPathRequest(in char cmdId, in int ndpInstanceId); + void suspendRequest(in char cmdId, in byte sessionId); + void resumeRequest(in char cmdId, in byte sessionId); void transmitFollowupRequest(in char cmdId, in android.hardware.wifi.NanTransmitFollowupRequest msg); void initiatePairingRequest(in char cmdId, in android.hardware.wifi.NanPairingRequest msg); void respondToPairingIndicationRequest(in char cmdId, in android.hardware.wifi.NanRespondToPairingIndicationRequest msg); diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl index b6c9d1ff41..dfb28aae07 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl @@ -59,6 +59,8 @@ interface IWifiNanIfaceEventCallback { oneway void notifyStopPublishResponse(in char id, in android.hardware.wifi.NanStatus status); oneway void notifyStopSubscribeResponse(in char id, in android.hardware.wifi.NanStatus status); oneway void notifyTerminateDataPathResponse(in char id, in android.hardware.wifi.NanStatus status); + oneway void notifySuspendResponse(in char id, in android.hardware.wifi.NanStatus status); + oneway void notifyResumeResponse(in char id, in android.hardware.wifi.NanStatus status); oneway void notifyTransmitFollowupResponse(in char id, in android.hardware.wifi.NanStatus status); oneway void eventPairingRequest(in android.hardware.wifi.NanPairingRequestInd event); oneway void eventPairingConfirm(in android.hardware.wifi.NanPairingConfirmInd event); diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl index ac5b93b313..9a4c050b58 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl @@ -64,20 +64,20 @@ interface IWifiStaIface { void setDtimMultiplier(in int multiplier); @Backing(type="int") @VintfStability enum StaIfaceCapabilityMask { - APF = 1, - BACKGROUND_SCAN = 2, - LINK_LAYER_STATS = 4, - RSSI_MONITOR = 8, - CONTROL_ROAMING = 16, - PROBE_IE_ALLOWLIST = 32, - SCAN_RAND = 64, - STA_5G = 128, - HOTSPOT = 256, - PNO = 512, - TDLS = 1024, - TDLS_OFFCHANNEL = 2048, - ND_OFFLOAD = 4096, - KEEP_ALIVE = 8192, - DEBUG_PACKET_FATE = 16384, + APF = (1 << 0), + BACKGROUND_SCAN = (1 << 1), + LINK_LAYER_STATS = (1 << 2), + RSSI_MONITOR = (1 << 3), + CONTROL_ROAMING = (1 << 4), + PROBE_IE_ALLOWLIST = (1 << 5), + SCAN_RAND = (1 << 6), + STA_5G = (1 << 7), + HOTSPOT = (1 << 8), + PNO = (1 << 9), + TDLS = (1 << 10), + TDLS_OFFCHANNEL = (1 << 11), + ND_OFFLOAD = (1 << 12), + KEEP_ALIVE = (1 << 13), + DEBUG_PACKET_FATE = (1 << 14), } } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IfaceConcurrencyType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IfaceConcurrencyType.aidl index 0a3ad1ac8b..d584423f5a 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IfaceConcurrencyType.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IfaceConcurrencyType.aidl @@ -34,9 +34,9 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum IfaceConcurrencyType { - STA = 0, - AP = 1, - AP_BRIDGED = 2, - P2P = 3, - NAN_IFACE = 4, + STA, + AP, + AP_BRIDGED, + P2P, + NAN_IFACE, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IfaceType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IfaceType.aidl index dbdc4390f3..67022dfdff 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IfaceType.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IfaceType.aidl @@ -34,8 +34,8 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum IfaceType { - STA = 0, - AP = 1, - P2P = 2, - NAN_IFACE = 3, + STA, + AP, + P2P, + NAN_IFACE, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBandIndex.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBandIndex.aidl index ca6c910579..3f1ea5e444 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBandIndex.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBandIndex.aidl @@ -35,6 +35,6 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum NanBandIndex { NAN_BAND_24GHZ = 0, - NAN_BAND_5GHZ = 1, + NAN_BAND_5GHZ, NAN_BAND_6GHZ = 2, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingMethod.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingMethod.aidl index e5f0975c1c..150453404e 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingMethod.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingMethod.aidl @@ -34,15 +34,15 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum NanBootstrappingMethod { - BOOTSTRAPPING_OPPORTUNISTIC_MASK = 1, - BOOTSTRAPPING_PIN_CODE_DISPLAY_MASK = 2, - BOOTSTRAPPING_PASSPHRASE_DISPLAY_MASK = 4, - BOOTSTRAPPING_QR_DISPLAY_MASK = 8, - BOOTSTRAPPING_NFC_TAG_MASK = 16, - BOOTSTRAPPING_PIN_CODE_KEYPAD_MASK = 32, - BOOTSTRAPPING_PASSPHRASE_KEYPAD_MASK = 64, - BOOTSTRAPPING_QR_SCAN_MASK = 128, - BOOTSTRAPPING_NFC_READER_MASK = 256, - BOOTSTRAPPING_SERVICE_MANAGED_MASK = 16384, - BOOTSTRAPPING_HANDSHAKE_SHIP_MASK = 32768, + BOOTSTRAPPING_OPPORTUNISTIC_MASK = (1 << 0), + BOOTSTRAPPING_PIN_CODE_DISPLAY_MASK = (1 << 1), + BOOTSTRAPPING_PASSPHRASE_DISPLAY_MASK = (1 << 2), + BOOTSTRAPPING_QR_DISPLAY_MASK = (1 << 3), + BOOTSTRAPPING_NFC_TAG_MASK = (1 << 4), + BOOTSTRAPPING_PIN_CODE_KEYPAD_MASK = (1 << 5), + BOOTSTRAPPING_PASSPHRASE_KEYPAD_MASK = (1 << 6), + BOOTSTRAPPING_QR_SCAN_MASK = (1 << 7), + BOOTSTRAPPING_NFC_READER_MASK = (1 << 8), + BOOTSTRAPPING_SERVICE_MANAGED_MASK = (1 << 14), + BOOTSTRAPPING_HANDSHAKE_SHIP_MASK = (1 << 15), } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCipherSuiteType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCipherSuiteType.aidl index 44509563b8..e98122ddfb 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCipherSuiteType.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCipherSuiteType.aidl @@ -35,8 +35,8 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum NanCipherSuiteType { NONE = 0, - SHARED_KEY_128_MASK = 1, - SHARED_KEY_256_MASK = 2, - PUBLIC_KEY_128_MASK = 4, - PUBLIC_KEY_256_MASK = 8, + SHARED_KEY_128_MASK = (1 << 0), + SHARED_KEY_256_MASK = (1 << 1), + PUBLIC_KEY_128_MASK = (1 << 2), + PUBLIC_KEY_256_MASK = (1 << 3), } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanClusterEventType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanClusterEventType.aidl index 1dfa45f6c8..6c20543d86 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanClusterEventType.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanClusterEventType.aidl @@ -35,6 +35,6 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum NanClusterEventType { DISCOVERY_MAC_ADDRESS_CHANGED = 0, - STARTED_CLUSTER = 1, - JOINED_CLUSTER = 2, + STARTED_CLUSTER, + JOINED_CLUSTER, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDataPathChannelCfg.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDataPathChannelCfg.aidl index ce752882af..4233c32863 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDataPathChannelCfg.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDataPathChannelCfg.aidl @@ -35,6 +35,6 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum NanDataPathChannelCfg { CHANNEL_NOT_REQUESTED = 0, - REQUEST_CHANNEL_SETUP = 1, - FORCE_CHANNEL_SETUP = 2, + REQUEST_CHANNEL_SETUP, + FORCE_CHANNEL_SETUP, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDataPathSecurityType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDataPathSecurityType.aidl index 64288ca5b3..cb7904d180 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDataPathSecurityType.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDataPathSecurityType.aidl @@ -34,7 +34,7 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum NanDataPathSecurityType { - OPEN = 0, - PMK = 1, - PASSPHRASE = 2, + OPEN, + PMK, + PASSPHRASE, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchAlg.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchAlg.aidl index dab33ad19f..93ac26b25f 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchAlg.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchAlg.aidl @@ -35,6 +35,6 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum NanMatchAlg { MATCH_ONCE = 0, - MATCH_CONTINUOUS = 1, - MATCH_NEVER = 2, + MATCH_CONTINUOUS, + MATCH_NEVER, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequestType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequestType.aidl index 9e73e80ec3..3488340bf4 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequestType.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingRequestType.aidl @@ -35,5 +35,5 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum NanPairingRequestType { NAN_PAIRING_SETUP = 0, - NAN_PAIRING_VERIFICATION = 1, + NAN_PAIRING_VERIFICATION, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingSecurityType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingSecurityType.aidl index a08a00f1b5..9f6c774021 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingSecurityType.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingSecurityType.aidl @@ -34,7 +34,7 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum NanPairingSecurityType { - OPPORTUNISTIC = 0, - PMK = 1, - PASSPHRASE = 2, + OPPORTUNISTIC, + PMK, + PASSPHRASE, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPublishType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPublishType.aidl index fc9b7a0512..30dffb29d1 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPublishType.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPublishType.aidl @@ -35,6 +35,6 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum NanPublishType { UNSOLICITED = 0, - SOLICITED = 1, - UNSOLICITED_SOLICITED = 2, + SOLICITED, + UNSOLICITED_SOLICITED, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRangingIndication.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRangingIndication.aidl index d03dffc815..4d33c10451 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRangingIndication.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRangingIndication.aidl @@ -34,7 +34,7 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum NanRangingIndication { - CONTINUOUS_INDICATION_MASK = 1, - INGRESS_MET_MASK = 2, - EGRESS_MET_MASK = 4, + CONTINUOUS_INDICATION_MASK = (1 << 0), + INGRESS_MET_MASK = (1 << 1), + EGRESS_MET_MASK = (1 << 2), } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanSrfType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanSrfType.aidl index 3c0583cbee..82409fd5aa 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanSrfType.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanSrfType.aidl @@ -35,5 +35,5 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum NanSrfType { BLOOM_FILTER = 0, - PARTIAL_MAC_ADDR = 1, + PARTIAL_MAC_ADDR, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanStatusCode.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanStatusCode.aidl index 0fe22452c7..40844cc416 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanStatusCode.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanStatusCode.aidl @@ -49,4 +49,5 @@ enum NanStatusCode { UNSUPPORTED_CONCURRENCY_NAN_DISABLED = 12, INVALID_PAIRING_ID = 13, INVALID_BOOTSTRAPPING_ID = 14, + INVALID_STATE = 15, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanSubscribeType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanSubscribeType.aidl index 325e40be6f..4f06df956d 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanSubscribeType.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanSubscribeType.aidl @@ -35,5 +35,5 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum NanSubscribeType { PASSIVE = 0, - ACTIVE = 1, + ACTIVE, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanTxType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanTxType.aidl index 6f7696f07d..798d3a29e6 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanTxType.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanTxType.aidl @@ -35,5 +35,5 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum NanTxType { BROADCAST = 0, - UNICAST = 1, + UNICAST, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttBw.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttBw.aidl index f5bf89493e..7cc700250e 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttBw.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttBw.aidl @@ -34,12 +34,12 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum RttBw { - BW_UNSPECIFIED = 0, - BW_5MHZ = 1, - BW_10MHZ = 2, - BW_20MHZ = 4, - BW_40MHZ = 8, - BW_80MHZ = 16, - BW_160MHZ = 32, - BW_320MHZ = 64, + BW_UNSPECIFIED = 0x0, + BW_5MHZ = 0x01, + BW_10MHZ = 0x02, + BW_20MHZ = 0x04, + BW_40MHZ = 0x08, + BW_80MHZ = 0x10, + BW_160MHZ = 0x20, + BW_320MHZ = 0x40, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttPreamble.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttPreamble.aidl index 02e6479cdc..de26f28f81 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttPreamble.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/RttPreamble.aidl @@ -34,9 +34,9 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum RttPreamble { - LEGACY = 1, - HT = 2, - VHT = 4, - HE = 8, - EHT = 16, + LEGACY = 0x1, + HT = 0x2, + VHT = 0x4, + HE = 0x8, + EHT = 0x10, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaBackgroundScanBucketEventReportSchemeMask.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaBackgroundScanBucketEventReportSchemeMask.aidl index 1041dd7407..93e337e97a 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaBackgroundScanBucketEventReportSchemeMask.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaBackgroundScanBucketEventReportSchemeMask.aidl @@ -34,7 +34,7 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum StaBackgroundScanBucketEventReportSchemeMask { - EACH_SCAN = 1, - FULL_RESULTS = 2, - NO_BATCH = 4, + EACH_SCAN = (1 << 0), + FULL_RESULTS = (1 << 1), + NO_BATCH = (1 << 2), } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaScanDataFlagMask.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaScanDataFlagMask.aidl index dc8f2f1bd4..fbd2d75570 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaScanDataFlagMask.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaScanDataFlagMask.aidl @@ -34,5 +34,5 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum StaScanDataFlagMask { - INTERRUPTED = 1, + INTERRUPTED = (1 << 0), } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChannelWidthInMhz.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChannelWidthInMhz.aidl index 8c4504442f..22327e5795 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChannelWidthInMhz.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChannelWidthInMhz.aidl @@ -34,7 +34,7 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum WifiChannelWidthInMhz { - WIDTH_INVALID = -1, + WIDTH_INVALID = (-1), WIDTH_20 = 0, WIDTH_40 = 1, WIDTH_80 = 2, diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiDebugPacketFateFrameType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiDebugPacketFateFrameType.aidl index ee26f2ef11..6db96efc0f 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiDebugPacketFateFrameType.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiDebugPacketFateFrameType.aidl @@ -34,7 +34,7 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum WifiDebugPacketFateFrameType { - UNKNOWN = 0, - ETHERNET_II = 1, - MGMT_80211 = 2, + UNKNOWN, + ETHERNET_II, + MGMT_80211, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiDebugRingBufferFlags.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiDebugRingBufferFlags.aidl index f210e826a3..9eac85d57d 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiDebugRingBufferFlags.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiDebugRingBufferFlags.aidl @@ -34,7 +34,7 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum WifiDebugRingBufferFlags { - HAS_BINARY_ENTRIES = 1, - HAS_ASCII_ENTRIES = 2, - HAS_PER_PACKET_ENTRIES = 4, + HAS_BINARY_ENTRIES = (1 << 0), + HAS_ASCII_ENTRIES = (1 << 1), + HAS_PER_PACKET_ENTRIES = (1 << 2), } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiDebugRxPacketFate.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiDebugRxPacketFate.aidl index 75abb4e538..f638c4f7df 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiDebugRxPacketFate.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiDebugRxPacketFate.aidl @@ -34,15 +34,15 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum WifiDebugRxPacketFate { - SUCCESS = 0, - FW_QUEUED = 1, - FW_DROP_FILTER = 2, - FW_DROP_INVALID = 3, - FW_DROP_NOBUFS = 4, - FW_DROP_OTHER = 5, - DRV_QUEUED = 6, - DRV_DROP_FILTER = 7, - DRV_DROP_INVALID = 8, - DRV_DROP_NOBUFS = 9, - DRV_DROP_OTHER = 10, + SUCCESS, + FW_QUEUED, + FW_DROP_FILTER, + FW_DROP_INVALID, + FW_DROP_NOBUFS, + FW_DROP_OTHER, + DRV_QUEUED, + DRV_DROP_FILTER, + DRV_DROP_INVALID, + DRV_DROP_NOBUFS, + DRV_DROP_OTHER, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiDebugTxPacketFate.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiDebugTxPacketFate.aidl index e360c2c505..778ca5dee2 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiDebugTxPacketFate.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiDebugTxPacketFate.aidl @@ -34,14 +34,14 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum WifiDebugTxPacketFate { - ACKED = 0, - SENT = 1, - FW_QUEUED = 2, - FW_DROP_INVALID = 3, - FW_DROP_NOBUFS = 4, - FW_DROP_OTHER = 5, - DRV_QUEUED = 6, - DRV_DROP_INVALID = 7, - DRV_DROP_NOBUFS = 8, - DRV_DROP_OTHER = 9, + ACKED, + SENT, + FW_QUEUED, + FW_DROP_INVALID, + FW_DROP_NOBUFS, + FW_DROP_OTHER, + DRV_QUEUED, + DRV_DROP_INVALID, + DRV_DROP_NOBUFS, + DRV_DROP_OTHER, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiIfaceMode.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiIfaceMode.aidl index e2fe57af3f..2ac0c2dbc2 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiIfaceMode.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiIfaceMode.aidl @@ -34,12 +34,12 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum WifiIfaceMode { - IFACE_MODE_STA = 1, - IFACE_MODE_SOFTAP = 2, - IFACE_MODE_IBSS = 4, - IFACE_MODE_P2P_CLIENT = 8, - IFACE_MODE_P2P_GO = 16, - IFACE_MODE_NAN = 32, - IFACE_MODE_MESH = 64, - IFACE_MODE_TDLS = 128, + IFACE_MODE_STA = (1 << 0), + IFACE_MODE_SOFTAP = (1 << 1), + IFACE_MODE_IBSS = (1 << 2), + IFACE_MODE_P2P_CLIENT = (1 << 3), + IFACE_MODE_P2P_GO = (1 << 4), + IFACE_MODE_NAN = (1 << 5), + IFACE_MODE_MESH = (1 << 6), + IFACE_MODE_TDLS = (1 << 7), } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiStatusCode.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiStatusCode.aidl index f27661c93d..9a15fa1cae 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiStatusCode.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiStatusCode.aidl @@ -34,14 +34,14 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum WifiStatusCode { - SUCCESS = 0, - ERROR_WIFI_CHIP_INVALID = 1, - ERROR_WIFI_IFACE_INVALID = 2, - ERROR_WIFI_RTT_CONTROLLER_INVALID = 3, - ERROR_NOT_SUPPORTED = 4, - ERROR_NOT_AVAILABLE = 5, - ERROR_NOT_STARTED = 6, - ERROR_INVALID_ARGS = 7, - ERROR_BUSY = 8, - ERROR_UNKNOWN = 9, + SUCCESS, + ERROR_WIFI_CHIP_INVALID, + ERROR_WIFI_IFACE_INVALID, + ERROR_WIFI_RTT_CONTROLLER_INVALID, + ERROR_NOT_SUPPORTED, + ERROR_NOT_AVAILABLE, + ERROR_NOT_STARTED, + ERROR_INVALID_ARGS, + ERROR_BUSY, + ERROR_UNKNOWN, } diff --git a/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl b/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl index 31c7ecefd6..870c3d8b5a 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl @@ -240,6 +240,32 @@ interface IWifiNanIface { */ void terminateDataPathRequest(in char cmdId, in int ndpInstanceId); + /** + * Start the suspension of a discovery service. + * Asynchronous response is with |IWifiNanIfaceEventCallback.notifySuspendResponse|. + * + * @param cmdId Command Id to use for this invocation. + * @param sessionId ID of the publish/subscribe discovery session to be suspended. + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_NOT_SUPPORTED|, + * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, + * |WifiStatusCode.ERROR_UNKNOWN| + */ + void suspendRequest(in char cmdId, in byte sessionId); + + /** + * Stop the suspension of a discovery service. + * Asynchronous response is with |IWifiNanIfaceEventCallback.notifyResumeResponse|. + * + * @param cmdId Command Id to use for this invocation. + * @param sessionId ID of the publish/subscribe discovery session to be resumed. + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_NOT_SUPPORTED|, + * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, + * |WifiStatusCode.ERROR_UNKNOWN| + */ + void resumeRequest(in char cmdId, in byte sessionId); + /** * NAN transmit follow up message request. * Asynchronous response is with |IWifiNanIfaceEventCallback.notifyTransmitFollowupResponse|. diff --git a/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl b/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl index 6b06defefd..3fd37a7d57 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl @@ -309,6 +309,32 @@ oneway interface IWifiNanIfaceEventCallback { */ void notifyTerminateDataPathResponse(in char id, in NanStatus status); + /** + * Callback invoked in response to a suspension request + * |IWifiNanIface.suspendRequest|. + * + * @param cmdId Command Id corresponding to the original request. + * @param status NanStatus of the operation. Possible status codes are: + * |NanStatusCode.SUCCESS| + * |NanStatusCode.INVALID_SESSION_ID| + * |NanStatusCode.INVALID_STATE| + * |NanStatusCode.INTERNAL_FAILURE| + */ + void notifySuspendResponse(in char id, in NanStatus status); + + /** + * Callback invoked in response to a resume request + * |IWifiNanIface.resumeRequest|. + * + * @param cmdId Command Id corresponding to the original request. + * @param status NanStatus of the operation. Possible status codes are: + * |NanStatusCode.SUCCESS| + * |NanStatusCode.INVALID_SESSION_ID| + * |NanStatusCode.INVALID_STATE| + * |NanStatusCode.INTERNAL_FAILURE| + */ + void notifyResumeResponse(in char id, in NanStatus status); + /** * Callback invoked in response to a transmit followup request * |IWifiNanIface.transmitFollowupRequest|. diff --git a/wifi/aidl/android/hardware/wifi/NanStatusCode.aidl b/wifi/aidl/android/hardware/wifi/NanStatusCode.aidl index efce86707c..d609797131 100644 --- a/wifi/aidl/android/hardware/wifi/NanStatusCode.aidl +++ b/wifi/aidl/android/hardware/wifi/NanStatusCode.aidl @@ -78,5 +78,9 @@ enum NanStatusCode { /** * If the bootstrapping id is invalid */ - INVALID_BOOTSTRAPPING_ID = 14 + INVALID_BOOTSTRAPPING_ID = 14, + /** + * If the system is not in a valid state for the given request. + */ + INVALID_STATE = 15 } From 02a97247fe6b0e452324335c450370839fa0c963 Mon Sep 17 00:00:00 2001 From: Phill Hayers Date: Thu, 15 Dec 2022 16:05:14 +0000 Subject: [PATCH 584/998] Add NAN session suspension in shim layer. Bug: 259950106 Test: m android.hardware.wifi-update-api Change-Id: Ia3c1aa7e709e4e611bf40757ae712a9e39cc043a --- .../tests/wifi_nan_iface_unit_tests.cpp | 2 ++ wifi/aidl/default/wifi_legacy_hal.cpp | 16 ++++++++++++ wifi/aidl/default/wifi_legacy_hal.h | 6 +++++ wifi/aidl/default/wifi_legacy_hal_stubs.cpp | 2 ++ wifi/aidl/default/wifi_nan_iface.cpp | 25 ++++++++++++++++++- wifi/aidl/default/wifi_nan_iface.h | 4 +++ .../functional/wifi_nan_iface_aidl_test.cpp | 16 ++++++++++++ 7 files changed, 70 insertions(+), 1 deletion(-) diff --git a/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp b/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp index f81cab3965..878c29bcaa 100644 --- a/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp +++ b/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp @@ -134,6 +134,8 @@ class MockNanIfaceEventCallback : public IWifiNanIfaceEventCallback { ndk::ScopedAStatus(char16_t, const NanStatus&, int32_t)); MOCK_METHOD2(notifyRespondToBootstrappingIndicationResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD2(notifySuspendResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD2(notifyResumeResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); }; class WifiNanIfaceTest : public Test { diff --git a/wifi/aidl/default/wifi_legacy_hal.cpp b/wifi/aidl/default/wifi_legacy_hal.cpp index f03835f54e..0711568a4e 100644 --- a/wifi/aidl/default/wifi_legacy_hal.cpp +++ b/wifi/aidl/default/wifi_legacy_hal.cpp @@ -1559,6 +1559,22 @@ wifi_error WifiLegacyHal::nanDataEnd(const std::string& iface_name, transaction_ return status; } +wifi_error WifiLegacyHal::nanSuspendRequest(const std::string& iface_name, transaction_id id, + const NanSuspendRequest& msg) { + NanSuspendRequest msg_internal(msg); + wifi_error status = global_func_table_.wifi_nan_suspend_request(id, getIfaceHandle(iface_name), + &msg_internal); + return status; +} + +wifi_error WifiLegacyHal::nanResumeRequest(const std::string& iface_name, transaction_id id, + const NanResumeRequest& msg) { + NanResumeRequest msg_internal(msg); + wifi_error status = global_func_table_.wifi_nan_resume_request(id, getIfaceHandle(iface_name), + &msg_internal); + return status; +} + wifi_error WifiLegacyHal::setCountryCode(const std::string& iface_name, const std::array code) { std::string code_str(code.data(), code.data() + code.size()); diff --git a/wifi/aidl/default/wifi_legacy_hal.h b/wifi/aidl/default/wifi_legacy_hal.h index 2300cb7782..1e6ef73eec 100644 --- a/wifi/aidl/default/wifi_legacy_hal.h +++ b/wifi/aidl/default/wifi_legacy_hal.h @@ -165,12 +165,14 @@ using ::NanPublishType; using ::NanRangeReportInd; using ::NanRangeRequestInd; using ::NanResponseMsg; +using ::NanResumeRequest; using ::NanSRFType; using ::NanStatusType; using ::NanSubscribeCancelRequest; using ::NanSubscribeRequest; using ::NanSubscribeTerminatedInd; using ::NanSubscribeType; +using ::NanSuspendRequest; using ::NanTransmitFollowupInd; using ::NanTransmitFollowupRequest; using ::NanTxType; @@ -701,6 +703,10 @@ class WifiLegacyHal { wifi_error nanBootstrappingIndicationResponse(const std::string& iface_name, transaction_id id, const NanBootstrappingIndicationResponse& msg); wifi_error nanDataEnd(const std::string& iface_name, transaction_id id, uint32_t ndpInstanceId); + wifi_error nanSuspendRequest(const std::string& iface_name, transaction_id id, + const NanSuspendRequest& msg); + wifi_error nanResumeRequest(const std::string& iface_name, transaction_id id, + const NanResumeRequest& msg); // AP functions. wifi_error setCountryCode(const std::string& iface_name, const std::array code); diff --git a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp index 11da373b7d..c18b086c17 100644 --- a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp +++ b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp @@ -173,6 +173,8 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { populateStubFor(&hal_fn->wifi_get_cached_scan_results); populateStubFor(&hal_fn->wifi_get_chip_capabilities); populateStubFor(&hal_fn->wifi_enable_sta_channel_for_peer_network); + populateStubFor(&hal_fn->wifi_nan_suspend_request); + populateStubFor(&hal_fn->wifi_nan_resume_request); return true; } diff --git a/wifi/aidl/default/wifi_nan_iface.cpp b/wifi/aidl/default/wifi_nan_iface.cpp index ce6902da8a..7138e41031 100644 --- a/wifi/aidl/default/wifi_nan_iface.cpp +++ b/wifi/aidl/default/wifi_nan_iface.cpp @@ -756,6 +756,16 @@ ndk::ScopedAStatus WifiNanIface::respondToBootstrappingIndicationRequest( in_msg); } +ndk::ScopedAStatus WifiNanIface::suspendRequest(char16_t in_cmdId, int8_t in_sessionId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::suspendRequestInternal, in_cmdId, in_sessionId); +} + +ndk::ScopedAStatus WifiNanIface::resumeRequest(char16_t in_cmdId, int8_t in_sessionId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::resumeRequestInternal, in_cmdId, in_sessionId); +} + std::pair WifiNanIface::getNameInternal() { return {ifname_, ndk::ScopedAStatus::ok()}; } @@ -930,7 +940,20 @@ ndk::ScopedAStatus WifiNanIface::respondToBootstrappingIndicationRequestInternal legacy_hal_.lock()->nanBootstrappingIndicationResponse(ifname_, cmd_id, legacy_msg); return createWifiStatusFromLegacyError(legacy_status); } - +ndk::ScopedAStatus WifiNanIface::suspendRequestInternal(char16_t cmd_id, int8_t sessionId) { + legacy_hal::NanSuspendRequest legacy_msg; + legacy_msg.publish_subscribe_id = sessionId; + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanSuspendRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} +ndk::ScopedAStatus WifiNanIface::resumeRequestInternal(char16_t cmd_id, int8_t sessionId) { + legacy_hal::NanResumeRequest legacy_msg; + legacy_msg.publish_subscribe_id = sessionId; + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanResumeRequest(ifname_, cmd_id, legacy_msg); + return createWifiStatusFromLegacyError(legacy_status); +} } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/aidl/default/wifi_nan_iface.h b/wifi/aidl/default/wifi_nan_iface.h index 591eca908e..3b93c28435 100644 --- a/wifi/aidl/default/wifi_nan_iface.h +++ b/wifi/aidl/default/wifi_nan_iface.h @@ -86,6 +86,8 @@ class WifiNanIface : public BnWifiNanIface { const NanBootstrappingRequest& in_msg) override; ndk::ScopedAStatus respondToBootstrappingIndicationRequest( char16_t in_cmdId, const NanBootstrappingResponse& in_msg) override; + ndk::ScopedAStatus suspendRequest(char16_t in_cmdId, int8_t sessionId) override; + ndk::ScopedAStatus resumeRequest(char16_t in_cmdId, int8_t sessionId) override; protected: // Accessible to child class in the gTest suite. @@ -127,6 +129,8 @@ class WifiNanIface : public BnWifiNanIface { const NanBootstrappingRequest& msg); ndk::ScopedAStatus respondToBootstrappingIndicationRequestInternal( char16_t cmd_id, const NanBootstrappingResponse& msg); + ndk::ScopedAStatus suspendRequestInternal(char16_t in_cmdId, int8_t sessionId); + ndk::ScopedAStatus resumeRequestInternal(char16_t in_cmdId, int8_t sessionId); // Overridden in the gTest suite. virtual std::set> getEventCallbacks(); diff --git a/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp index 654eb02274..ae5040f498 100644 --- a/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp +++ b/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp @@ -104,6 +104,8 @@ class WifiNanIfaceAidlTest : public testing::TestWithParam { NOTIFY_RESPOND_TO_PAIRING_INDICATION_RESPONSE, NOTIFY_INITIATE_BOOTSTRAPPING_RESPONSE, NOTIFY_RESPOND_TO_BOOTSTRAPPING_INDICATION_RESPONSE, + NOTIFY_SUSPEND_RESPONSE, + NOTIFY_RESUME_RESPONSE, EVENT_CLUSTER_EVENT, EVENT_DISABLED, @@ -358,6 +360,20 @@ class WifiNanIfaceAidlTest : public testing::TestWithParam { parent_.notify(); return ndk::ScopedAStatus::ok(); } + ::ndk::ScopedAStatus notifySuspendResponse(char16_t id, const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_SUSPEND_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus notifyResumeResponse(char16_t id, const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_RESUME_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } ::ndk::ScopedAStatus notifyTransmitFollowupResponse(char16_t id, const NanStatus& status) override { parent_.callback_type_ = NOTIFY_TRANSMIT_FOLLOWUP_RESPONSE; From c8ce4d5c33284092f035594b2819b2a1584854b6 Mon Sep 17 00:00:00 2001 From: Matthew Sedam Date: Mon, 9 Jan 2023 20:18:21 +0000 Subject: [PATCH 585/998] Add setTestMode to Context Hub AIDL definition Bug: 258074235 Test: make android.hardware.contexthub-update-api Test: atest VtsAidlHalContextHubTargetTest Test: m Change-Id: I276857a2a2254cdf41bc8767ab972436a9015418 --- .../hardware/contexthub/IContextHub.aidl | 3 ++- .../hardware/contexthub/NanoappBinary.aidl | 6 +++--- .../android/hardware/contexthub/Setting.aidl | 12 +++++------ .../hardware/contexthub/IContextHub.aidl | 16 +++++++++++++++ contexthub/aidl/default/ContextHub.cpp | 4 ++++ .../include/contexthub-impl/ContextHub.h | 1 + .../vts/VtsAidlHalContextHubTargetTest.cpp | 20 +++++++++++++++++++ 7 files changed, 52 insertions(+), 10 deletions(-) diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl index c1f4df868d..d66e1ac4d5 100644 --- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl @@ -47,5 +47,6 @@ interface IContextHub { void onHostEndpointDisconnected(char hostEndpointId); long[] getPreloadedNanoappIds(); void onNanSessionStateChanged(in boolean state); - const int EX_CONTEXT_HUB_UNSPECIFIED = -1; + void setTestMode(in boolean enable); + const int EX_CONTEXT_HUB_UNSPECIFIED = (-1); } diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl index d53b28f943..741a9cf0c9 100644 --- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl @@ -40,7 +40,7 @@ parcelable NanoappBinary { byte targetChreApiMajorVersion; byte targetChreApiMinorVersion; byte[] customBinary; - const int FLAG_SIGNED = 1; - const int FLAG_ENCRYPTED = 2; - const int FLAG_TCM_CAPABLE = 4; + const int FLAG_SIGNED = (1 << 0); + const int FLAG_ENCRYPTED = (1 << 1); + const int FLAG_TCM_CAPABLE = (1 << 2); } diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/Setting.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/Setting.aidl index d998478db6..aeb720b779 100644 --- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/Setting.aidl +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/Setting.aidl @@ -35,10 +35,10 @@ package android.hardware.contexthub; @Backing(type="byte") @VintfStability enum Setting { LOCATION = 1, - WIFI_MAIN = 2, - WIFI_SCANNING = 3, - AIRPLANE_MODE = 4, - MICROPHONE = 5, - BT_MAIN = 6, - BT_SCANNING = 7, + WIFI_MAIN, + WIFI_SCANNING, + AIRPLANE_MODE, + MICROPHONE, + BT_MAIN, + BT_SCANNING, } diff --git a/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl index 7f507306f3..f9838bdb19 100644 --- a/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl +++ b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl @@ -216,6 +216,22 @@ interface IContextHub { */ void onNanSessionStateChanged(in boolean state); + /** + * Puts the context hub in and out of test mode. Test mode is a clean state + * where tests can be executed in the same environment. If enable is true, + * this will enable test mode by unloading all nanoapps. If enable is false, + * this will disable test mode and reverse the actions of enabling test mode + * by loading all preloaded nanoapps. This puts CHRE in a normal state. + * + * This should only be used for a test environment, either through a + * @TestApi or development tools. This should not be used in a production + * environment. + * + * @param enable If true, put the context hub in test mode. If false, disable + * test mode. + */ + void setTestMode(in boolean enable); + /** * Error codes that are used as service specific errors with the AIDL return * value EX_SERVICE_SPECIFIC. diff --git a/contexthub/aidl/default/ContextHub.cpp b/contexthub/aidl/default/ContextHub.cpp index 615ac5c258..b98bfb26bd 100644 --- a/contexthub/aidl/default/ContextHub.cpp +++ b/contexthub/aidl/default/ContextHub.cpp @@ -113,6 +113,10 @@ ScopedAStatus ContextHub::sendMessageToHub(int32_t in_contextHubId, } } +ScopedAStatus ContextHub::setTestMode(bool /* enable */) { + return ndk::ScopedAStatus::ok(); +} + ScopedAStatus ContextHub::onHostEndpointConnected(const HostEndpointInfo& in_info) { mConnectedHostEndpoints.insert(in_info.hostEndpointId); diff --git a/contexthub/aidl/default/include/contexthub-impl/ContextHub.h b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h index b3998b917e..dc9aef0e01 100644 --- a/contexthub/aidl/default/include/contexthub-impl/ContextHub.h +++ b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h @@ -44,6 +44,7 @@ class ContextHub : public BnContextHub { int32_t in_contextHubId, const std::shared_ptr& in_cb) override; ::ndk::ScopedAStatus sendMessageToHub(int32_t in_contextHubId, const ContextHubMessage& in_message) override; + ::ndk::ScopedAStatus setTestMode(bool enable) override; ::ndk::ScopedAStatus onHostEndpointConnected(const HostEndpointInfo& in_info) override; ::ndk::ScopedAStatus onHostEndpointDisconnected(char16_t in_hostEndpointId) override; diff --git a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp index 4731648c27..f7ff73d477 100644 --- a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp +++ b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp @@ -84,6 +84,26 @@ TEST_P(ContextHubAidl, TestGetHubs) { } } +TEST_P(ContextHubAidl, TestEnableTestMode) { + Status status = contextHub->setTestMode(true); + if (status.exceptionCode() == Status::EX_UNSUPPORTED_OPERATION || + status.transactionError() == android::UNKNOWN_TRANSACTION) { + return; // not supported -> old API; or not implemented + } + + ASSERT_TRUE(status.isOk()); +} + +TEST_P(ContextHubAidl, TestDisableTestMode) { + Status status = contextHub->setTestMode(false); + if (status.exceptionCode() == Status::EX_UNSUPPORTED_OPERATION || + status.transactionError() == android::UNKNOWN_TRANSACTION) { + return; // not supported -> old API; or not implemented + } + + ASSERT_TRUE(status.isOk()); +} + class EmptyContextHubCallback : public android::hardware::contexthub::BnContextHubCallback { public: Status handleNanoappInfo(const std::vector& /* appInfo */) override { From ff0f61bed1994499cc37ba50f3bdcdf3c5f9790e Mon Sep 17 00:00:00 2001 From: RD Babiera Date: Tue, 10 Jan 2023 22:25:23 +0000 Subject: [PATCH 586/998] Skip VTS tests based on HAL interface version Adds version check to compliance warning, plug orientation, and DisplayPort VTS tests to skip if feature is not supported. Fixed tab spacing on mentioned tests. Bug: 265060163 Test: atest VtsAidlUsbTargetTest Change-Id: If3e04baa98fa3299f128551e3b93debd729f57e3 --- usb/aidl/vts/VtsAidlUsbTargetTest.cpp | 153 ++++++++++++++++---------- 1 file changed, 93 insertions(+), 60 deletions(-) diff --git a/usb/aidl/vts/VtsAidlUsbTargetTest.cpp b/usb/aidl/vts/VtsAidlUsbTargetTest.cpp index 2ec5a2c607..480c826cce 100644 --- a/usb/aidl/vts/VtsAidlUsbTargetTest.cpp +++ b/usb/aidl/vts/VtsAidlUsbTargetTest.cpp @@ -253,6 +253,9 @@ class UsbAidlTest : public testing::TestWithParam { std::mutex usb_mtx; std::condition_variable usb_cv; int usb_count = 0; + + // Stores usb version + int32_t usb_version; }; /* @@ -295,6 +298,12 @@ TEST_P(UsbAidlTest, DisabledDataStatusCheck) { int disabledCount = 0; ALOGI("UsbAidlTest DataStatusCheck start"); + auto retVersion = usb->getInterfaceVersion(&usb_version); + ASSERT_TRUE(retVersion.isOk()) << retVersion; + if (usb_version < 2) { + ALOGI("UsbAidlTest skipping DataStatusCheck on older interface versions"); + GTEST_SKIP(); + } int64_t transactionId = rand() % 10000; const auto& ret = usb->queryPortStatus(transactionId); ASSERT_TRUE(ret.isOk()); @@ -603,19 +612,25 @@ TEST_P(UsbAidlTest, DISABLED_resetUsbPort) { * supportsComplianceWarning is false. */ TEST_P(UsbAidlTest, nonCompliantChargerStatus) { - ALOGI("UsbAidlTest nonCompliantChargerStatus start"); - int64_t transactionId = rand() % 10000; - const auto& ret = usb->queryPortStatus(transactionId); - ASSERT_TRUE(ret.isOk()); - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(2, usb_last_cookie); - EXPECT_EQ(transactionId, last_transactionId); + ALOGI("UsbAidlTest nonCompliantChargerStatus start"); + auto retVersion = usb->getInterfaceVersion(&usb_version); + ASSERT_TRUE(retVersion.isOk()) << retVersion; + if (usb_version < 2) { + ALOGI("UsbAidlTest skipping nonCompliantChargerStatus on older interface versions"); + GTEST_SKIP(); + } + int64_t transactionId = rand() % 10000; + const auto& ret = usb->queryPortStatus(transactionId); + ASSERT_TRUE(ret.isOk()); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(2, usb_last_cookie); + EXPECT_EQ(transactionId, last_transactionId); - if (!usb_last_port_status.supportsComplianceWarnings) { - EXPECT_TRUE(usb_last_port_status.complianceWarnings.empty()); - } + if (!usb_last_port_status.supportsComplianceWarnings) { + EXPECT_TRUE(usb_last_port_status.complianceWarnings.empty()); + } - ALOGI("UsbAidlTest nonCompliantChargerStatus end"); + ALOGI("UsbAidlTest nonCompliantChargerStatus end"); } /* @@ -624,39 +639,51 @@ TEST_P(UsbAidlTest, nonCompliantChargerStatus) { * are valid. */ TEST_P(UsbAidlTest, nonCompliantChargerValues) { - ALOGI("UsbAidlTest nonCompliantChargerValues start"); - int64_t transactionId = rand() % 10000; - const auto& ret = usb->queryPortStatus(transactionId); - ASSERT_TRUE(ret.isOk()); - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(2, usb_last_cookie); - EXPECT_EQ(transactionId, last_transactionId); + ALOGI("UsbAidlTest nonCompliantChargerValues start"); + auto retVersion = usb->getInterfaceVersion(&usb_version); + ASSERT_TRUE(retVersion.isOk()) << retVersion; + if (usb_version < 2) { + ALOGI("UsbAidlTest skipping nonCompliantChargerValues on older interface versions"); + GTEST_SKIP(); + } + int64_t transactionId = rand() % 10000; + const auto& ret = usb->queryPortStatus(transactionId); + ASSERT_TRUE(ret.isOk()); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(2, usb_last_cookie); + EXPECT_EQ(transactionId, last_transactionId); - // Current compliance values range from [1, 4] - if (usb_last_port_status.supportsComplianceWarnings) { - for (auto warning : usb_last_port_status.complianceWarnings) { - EXPECT_TRUE((int)warning >= (int)ComplianceWarning::OTHER); - EXPECT_TRUE((int)warning <= (int)ComplianceWarning::MISSING_RP); - } + // Current compliance values range from [1, 4] + if (usb_last_port_status.supportsComplianceWarnings) { + for (auto warning : usb_last_port_status.complianceWarnings) { + EXPECT_TRUE((int)warning >= (int)ComplianceWarning::OTHER); + EXPECT_TRUE((int)warning <= (int)ComplianceWarning::MISSING_RP); } + } - ALOGI("UsbAidlTest nonCompliantChargerValues end"); + ALOGI("UsbAidlTest nonCompliantChargerValues end"); } /* * Test PlugOrientation Values are within range in PortStatus */ TEST_P(UsbAidlTest, plugOrientationValues) { - ALOGI("UsbAidlTest plugOrientationValues start"); - int64_t transactionId = rand() % 10000; - const auto& ret = usb->queryPortStatus(transactionId); - ASSERT_TRUE(ret.isOk()); - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(2, usb_last_cookie); - EXPECT_EQ(transactionId, last_transactionId); + ALOGI("UsbAidlTest plugOrientationValues start"); + auto retVersion = usb->getInterfaceVersion(&usb_version); + ASSERT_TRUE(retVersion.isOk()) << retVersion; + if (usb_version < 2) { + ALOGI("UsbAidlTest skipping plugOrientationValues on older interface versions"); + GTEST_SKIP(); + } + int64_t transactionId = rand() % 10000; + const auto& ret = usb->queryPortStatus(transactionId); + ASSERT_TRUE(ret.isOk()); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(2, usb_last_cookie); + EXPECT_EQ(transactionId, last_transactionId); - EXPECT_TRUE((int)usb_last_port_status.plugOrientation >= (int)PlugOrientation::UNKNOWN); - EXPECT_TRUE((int)usb_last_port_status.plugOrientation <= (int)PlugOrientation::PLUGGED_FLIPPED); + EXPECT_TRUE((int)usb_last_port_status.plugOrientation >= (int)PlugOrientation::UNKNOWN); + EXPECT_TRUE((int)usb_last_port_status.plugOrientation <= (int)PlugOrientation::PLUGGED_FLIPPED); } /* @@ -664,37 +691,43 @@ TEST_P(UsbAidlTest, plugOrientationValues) { * is active. */ TEST_P(UsbAidlTest, dpAltModeValues) { - ALOGI("UsbAidlTest dpAltModeValues start"); - int64_t transactionId = rand() % 10000; - const auto& ret = usb->queryPortStatus(transactionId); - ASSERT_TRUE(ret.isOk()); - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(2, usb_last_cookie); - EXPECT_EQ(transactionId, last_transactionId); + ALOGI("UsbAidlTest dpAltModeValues start"); + auto retVersion = usb->getInterfaceVersion(&usb_version); + ASSERT_TRUE(retVersion.isOk()) << retVersion; + if (usb_version < 2) { + ALOGI("UsbAidlTest skipping dpAltModeValues on older interface versions"); + GTEST_SKIP(); + } + int64_t transactionId = rand() % 10000; + const auto& ret = usb->queryPortStatus(transactionId); + ASSERT_TRUE(ret.isOk()); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(2, usb_last_cookie); + EXPECT_EQ(transactionId, last_transactionId); - // Discover DisplayPort Alt Mode - for (AltModeData altMode : usb_last_port_status.supportedAltModes) { - if (altMode.getTag() == AltModeData::displayPortAltModeData) { - AltModeData::DisplayPortAltModeData displayPortAltModeData = - altMode.get(); - EXPECT_TRUE((int)displayPortAltModeData.partnerSinkStatus >= - (int)DisplayPortAltModeStatus::UNKNOWN); - EXPECT_TRUE((int)displayPortAltModeData.partnerSinkStatus <= - (int)DisplayPortAltModeStatus::ENABLED); + // Discover DisplayPort Alt Mode + for (AltModeData altMode : usb_last_port_status.supportedAltModes) { + if (altMode.getTag() == AltModeData::displayPortAltModeData) { + AltModeData::DisplayPortAltModeData displayPortAltModeData = + altMode.get(); + EXPECT_TRUE((int)displayPortAltModeData.partnerSinkStatus >= + (int)DisplayPortAltModeStatus::UNKNOWN); + EXPECT_TRUE((int)displayPortAltModeData.partnerSinkStatus <= + (int)DisplayPortAltModeStatus::ENABLED); - EXPECT_TRUE((int)displayPortAltModeData.cableStatus >= - (int)DisplayPortAltModeStatus::UNKNOWN); - EXPECT_TRUE((int)displayPortAltModeData.cableStatus <= - (int)DisplayPortAltModeStatus::ENABLED); + EXPECT_TRUE((int)displayPortAltModeData.cableStatus >= + (int)DisplayPortAltModeStatus::UNKNOWN); + EXPECT_TRUE((int)displayPortAltModeData.cableStatus <= + (int)DisplayPortAltModeStatus::ENABLED); - EXPECT_TRUE((int)displayPortAltModeData.pinAssignment >= - (int)DisplayPortAltModePinAssignment::NONE); - EXPECT_TRUE((int)displayPortAltModeData.pinAssignment <= - (int)DisplayPortAltModePinAssignment::F); - } + EXPECT_TRUE((int)displayPortAltModeData.pinAssignment >= + (int)DisplayPortAltModePinAssignment::NONE); + EXPECT_TRUE((int)displayPortAltModeData.pinAssignment <= + (int)DisplayPortAltModePinAssignment::F); } + } - ALOGI("UsbAidlTest dpAltModeValues end"); + ALOGI("UsbAidlTest dpAltModeValues end"); } GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(UsbAidlTest); From cd04361bb3fb69661b61d4393a98a22aa0af18c1 Mon Sep 17 00:00:00 2001 From: Carlos Martinez Romero Date: Thu, 5 Jan 2023 22:28:05 +0000 Subject: [PATCH 587/998] Deprecate SKIP_VALIDATE. Bug: 258549211 Test: Built it and flashed it + added a test. Change-Id: I7a0dbea4dc0e6687f65d2136a8d21867d7232626 --- .../graphics/composer3/Capability.aidl | 3 +++ .../graphics/composer3/DisplayRequest.aidl | 6 ++--- .../composer3/FormatColorComponent.aidl | 8 +++--- .../graphics/composer3/IComposerClient.aidl | 2 +- .../composer3/PerFrameMetadataKey.aidl | 26 +++++++++---------- .../graphics/composer3/PresentOrValidate.aidl | 4 +-- .../graphics/composer3/Capability.aidl | 1 + .../VtsHalGraphicsComposer3_TargetTest.cpp | 18 ++++++++++++- 8 files changed, 44 insertions(+), 24 deletions(-) diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl index b89f7d5105..0a76443607 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl @@ -38,6 +38,9 @@ enum Capability { SIDEBAND_STREAM = 1, SKIP_CLIENT_COLOR_TRANSFORM = 2, PRESENT_FENCE_IS_NOT_RELIABLE = 3, + /** + * @deprecated - enabled by default. + */ SKIP_VALIDATE = 4, BOOT_DISPLAY_CONFIG = 5, } diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayRequest.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayRequest.aidl index 13462ce298..00598eb9b1 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayRequest.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayRequest.aidl @@ -37,12 +37,12 @@ parcelable DisplayRequest { long display; int mask; android.hardware.graphics.composer3.DisplayRequest.LayerRequest[] layerRequests; - const int FLIP_CLIENT_TARGET = 1; - const int WRITE_CLIENT_TARGET_TO_OUTPUT = 2; + const int FLIP_CLIENT_TARGET = (1 << 0); + const int WRITE_CLIENT_TARGET_TO_OUTPUT = (1 << 1); @VintfStability parcelable LayerRequest { long layer; int mask; - const int CLEAR_CLIENT_TARGET = 1; + const int CLEAR_CLIENT_TARGET = (1 << 0); } } diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/FormatColorComponent.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/FormatColorComponent.aidl index 4b737de0c8..1990350fa7 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/FormatColorComponent.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/FormatColorComponent.aidl @@ -34,8 +34,8 @@ package android.hardware.graphics.composer3; @Backing(type="byte") @VintfStability enum FormatColorComponent { - FORMAT_COMPONENT_0 = 1, - FORMAT_COMPONENT_1 = 2, - FORMAT_COMPONENT_2 = 4, - FORMAT_COMPONENT_3 = 8, + FORMAT_COMPONENT_0 = (1 << 0), + FORMAT_COMPONENT_1 = (1 << 1), + FORMAT_COMPONENT_2 = (1 << 2), + FORMAT_COMPONENT_3 = (1 << 3), } diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl index a7e65353e1..53aae455a4 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl @@ -86,5 +86,5 @@ interface IComposerClient { const int EX_UNSUPPORTED = 8; const int EX_SEAMLESS_NOT_ALLOWED = 9; const int EX_SEAMLESS_NOT_POSSIBLE = 10; - const int INVALID_CONFIGURATION = 2147483647; + const int INVALID_CONFIGURATION = 0x7fffffff; } diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PerFrameMetadataKey.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PerFrameMetadataKey.aidl index 8722f878fe..10a7deef0a 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PerFrameMetadataKey.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PerFrameMetadataKey.aidl @@ -34,17 +34,17 @@ package android.hardware.graphics.composer3; @Backing(type="int") @VintfStability enum PerFrameMetadataKey { - DISPLAY_RED_PRIMARY_X = 0, - DISPLAY_RED_PRIMARY_Y = 1, - DISPLAY_GREEN_PRIMARY_X = 2, - DISPLAY_GREEN_PRIMARY_Y = 3, - DISPLAY_BLUE_PRIMARY_X = 4, - DISPLAY_BLUE_PRIMARY_Y = 5, - WHITE_POINT_X = 6, - WHITE_POINT_Y = 7, - MAX_LUMINANCE = 8, - MIN_LUMINANCE = 9, - MAX_CONTENT_LIGHT_LEVEL = 10, - MAX_FRAME_AVERAGE_LIGHT_LEVEL = 11, - HDR10_PLUS_SEI = 12, + DISPLAY_RED_PRIMARY_X, + DISPLAY_RED_PRIMARY_Y, + DISPLAY_GREEN_PRIMARY_X, + DISPLAY_GREEN_PRIMARY_Y, + DISPLAY_BLUE_PRIMARY_X, + DISPLAY_BLUE_PRIMARY_Y, + WHITE_POINT_X, + WHITE_POINT_Y, + MAX_LUMINANCE, + MIN_LUMINANCE, + MAX_CONTENT_LIGHT_LEVEL, + MAX_FRAME_AVERAGE_LIGHT_LEVEL, + HDR10_PLUS_SEI, } diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PresentOrValidate.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PresentOrValidate.aidl index e6ddeba784..dbfac2259d 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PresentOrValidate.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/PresentOrValidate.aidl @@ -38,7 +38,7 @@ parcelable PresentOrValidate { android.hardware.graphics.composer3.PresentOrValidate.Result result; @VintfStability enum Result { - Validated = 0, - Presented = 1, + Validated, + Presented, } } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl index 2f9eab937c..c41525144f 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl @@ -55,6 +55,7 @@ enum Capability { * For this capability to be worthwhile the device implementation of * presentDisplay should fail as fast as possible in the case a * validateDisplay step is needed. + * @deprecated - enabled by default. */ SKIP_VALIDATE = 4, diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 7b852e029d..a72104f061 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -2319,6 +2319,22 @@ TEST_P(GraphicsComposerAidlCommandTest, MultiThreadedPresent) { // TODO(b/251842321): Try to present on multiple threads. } +/** + * Test Capability::SKIP_VALIDATE + * + * Capability::SKIP_VALIDATE has been deprecated and should not be enabled. + */ +TEST_P(GraphicsComposerAidlCommandTest, SkipValidateDeprecatedTest) { + const auto& [versionStatus, version] = mComposerClient->getInterfaceVersion(); + ASSERT_TRUE(versionStatus.isOk()); + if (version <= 1) { + GTEST_SUCCEED() << "HAL at version 1 or lower can contain Capability::SKIP_VALIDATE."; + return; + } + ASSERT_FALSE(hasCapability(Capability::SKIP_VALIDATE)) + << "Found Capability::SKIP_VALIDATE capability."; +} + GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(GraphicsComposerAidlCommandTest); INSTANTIATE_TEST_SUITE_P( PerInstance, GraphicsComposerAidlCommandTest, @@ -2378,4 +2394,4 @@ int main(int argc, char** argv) { } return RUN_ALL_TESTS(); -} +} \ No newline at end of file From 38e85654fed4e0d72d81acba86c1e687f21ca8b8 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Wed, 11 Jan 2023 15:48:10 -0800 Subject: [PATCH 588/998] audio: Remove android.hardware.audio.core.AudioMode type I missed that there is already android.media.audio.common.AudioMode. However, due to use by the framework, it contains more values (all of them are SYS_RESERVED), thus the implementation and VTS have to be updated as well. Bug: 205884982 Test: atest VtsHalAudioCoreTargetTest Change-Id: If260413b1f774a69514de978792d5ad2eb46481a --- audio/aidl/Android.bp | 1 - .../hardware/audio/core/AudioMode.aidl | 42 ------------------- .../hardware/audio/core/IBluetooth.aidl | 8 ++-- .../android/hardware/audio/core/IModule.aidl | 2 +- .../hardware/audio/core/ITelephony.aidl | 4 +- .../hardware/audio/core/AudioMode.aidl | 38 ----------------- .../android/hardware/audio/core/IModule.aidl | 3 +- .../hardware/audio/core/ITelephony.aidl | 3 +- audio/aidl/common/include/Utils.h | 18 ++++++++ audio/aidl/default/Module.cpp | 6 +++ audio/aidl/default/Telephony.cpp | 10 ++++- audio/aidl/default/include/core-impl/Module.h | 2 +- .../default/include/core-impl/Telephony.h | 15 +++++-- .../vts/VtsHalAudioCoreModuleTargetTest.cpp | 16 +++++-- 14 files changed, 69 insertions(+), 99 deletions(-) delete mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/AudioMode.aidl delete mode 100644 audio/aidl/android/hardware/audio/core/AudioMode.aidl diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index e69306eb32..56ac510a53 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -109,7 +109,6 @@ aidl_interface { "android.hardware.audio_defaults", ], srcs: [ - "android/hardware/audio/core/AudioMode.aidl", "android/hardware/audio/core/AudioPatch.aidl", "android/hardware/audio/core/AudioRoute.aidl", "android/hardware/audio/core/IBluetooth.aidl", diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/AudioMode.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/AudioMode.aidl deleted file mode 100644 index 336f9b528d..0000000000 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/AudioMode.aidl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.audio.core; -@Backing(type="int") @VintfStability -enum AudioMode { - NORMAL = 0, - RINGTONE = 1, - IN_CALL = 2, - IN_COMMUNICATION = 3, - CALL_SCREEN = 4, -} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetooth.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetooth.aidl index 289c0c238e..9357a1587e 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetooth.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetooth.aidl @@ -44,10 +44,10 @@ interface IBluetooth { @nullable @utf8InCpp String debugName; @VintfStability enum Mode { - UNSPECIFIED = 0, - SCO = 1, - SCO_WB = 2, - SCO_SWB = 3, + UNSPECIFIED, + SCO, + SCO_WB, + SCO_SWB, } } @JavaDerive(equals=true, toString=true) @VintfStability diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl index 4486b661b2..960e69fa41 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl @@ -59,7 +59,7 @@ interface IModule { boolean getMicMute(); void setMicMute(boolean mute); android.hardware.audio.core.MicrophoneInfo[] getMicrophones(); - void updateAudioMode(android.hardware.audio.core.AudioMode mode); + void updateAudioMode(android.media.audio.common.AudioMode mode); void updateScreenRotation(android.hardware.audio.core.IModule.ScreenRotation rotation); void updateScreenState(boolean isTurnedOn); @nullable android.hardware.audio.core.sounddose.ISoundDose getSoundDose(); diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ITelephony.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ITelephony.aidl index 77063df19b..001d07461e 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ITelephony.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ITelephony.aidl @@ -34,8 +34,8 @@ package android.hardware.audio.core; @VintfStability interface ITelephony { - android.hardware.audio.core.AudioMode[] getSupportedAudioModes(); - void switchAudioMode(android.hardware.audio.core.AudioMode mode); + android.media.audio.common.AudioMode[] getSupportedAudioModes(); + void switchAudioMode(android.media.audio.common.AudioMode mode); android.hardware.audio.core.ITelephony.TelecomConfig setTelecomConfig(in android.hardware.audio.core.ITelephony.TelecomConfig config); @JavaDerive(equals=true, toString=true) @VintfStability parcelable TelecomConfig { diff --git a/audio/aidl/android/hardware/audio/core/AudioMode.aidl b/audio/aidl/android/hardware/audio/core/AudioMode.aidl deleted file mode 100644 index 0943a55c0f..0000000000 --- a/audio/aidl/android/hardware/audio/core/AudioMode.aidl +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ - -package android.hardware.audio.core; - -/** - * The audio mode describes states of the audio system of the device that - * can significantly affect the rules of audio routing, volume control, etc. - * The audio mode is controlled by the framework, however the HAL has some - * flexibility in the choice of modes to support, see 'IModule.updateAudioMode'. - */ -@VintfStability -@Backing(type="int") -enum AudioMode { - /** No active calls. */ - NORMAL = 0, - /** The device is playing the ringtone. */ - RINGTONE = 1, - /** The call is handled by the telephony stack ("voice call"). */ - IN_CALL = 2, - /** The call is handled by an application ("VoIP call"). */ - IN_COMMUNICATION = 3, - /** Call screening is in progress. */ - CALL_SCREEN = 4, -} diff --git a/audio/aidl/android/hardware/audio/core/IModule.aidl b/audio/aidl/android/hardware/audio/core/IModule.aidl index 7bc1b9cba5..2c478f2951 100644 --- a/audio/aidl/android/hardware/audio/core/IModule.aidl +++ b/audio/aidl/android/hardware/audio/core/IModule.aidl @@ -18,7 +18,6 @@ package android.hardware.audio.core; import android.hardware.audio.common.SinkMetadata; import android.hardware.audio.common.SourceMetadata; -import android.hardware.audio.core.AudioMode; import android.hardware.audio.core.AudioPatch; import android.hardware.audio.core.AudioRoute; import android.hardware.audio.core.IBluetooth; @@ -33,6 +32,7 @@ import android.hardware.audio.core.StreamDescriptor; import android.hardware.audio.core.VendorParameter; import android.hardware.audio.core.sounddose.ISoundDose; import android.hardware.audio.effect.IEffect; +import android.media.audio.common.AudioMode; import android.media.audio.common.AudioOffloadInfo; import android.media.audio.common.AudioPort; import android.media.audio.common.AudioPortConfig; @@ -684,6 +684,7 @@ interface IModule { * method. * * @param mode The current mode. + * @throws EX_ILLEGAL_ARGUMENT If the mode is out of range of valid values. */ void updateAudioMode(AudioMode mode); diff --git a/audio/aidl/android/hardware/audio/core/ITelephony.aidl b/audio/aidl/android/hardware/audio/core/ITelephony.aidl index a817032ed1..7fc1ace7ae 100644 --- a/audio/aidl/android/hardware/audio/core/ITelephony.aidl +++ b/audio/aidl/android/hardware/audio/core/ITelephony.aidl @@ -16,7 +16,7 @@ package android.hardware.audio.core; -import android.hardware.audio.core.AudioMode; +import android.media.audio.common.AudioMode; import android.media.audio.common.Boolean; import android.media.audio.common.Float; @@ -52,6 +52,7 @@ interface ITelephony { * * @param mode The mode to switch to. * @throws EX_UNSUPPORTED_OPERATION If the HAL does not support the specified mode. + * @throws EX_ILLEGAL_ARGUMENT If the mode is out of range of valid values. * @throws EX_ILLEGAL_STATE If there was an error during switching. */ void switchAudioMode(AudioMode mode); diff --git a/audio/aidl/common/include/Utils.h b/audio/aidl/common/include/Utils.h index 8f0c986c11..2aaa78162c 100644 --- a/audio/aidl/common/include/Utils.h +++ b/audio/aidl/common/include/Utils.h @@ -16,6 +16,8 @@ #pragma once +#include +#include #include #include @@ -23,11 +25,22 @@ #include #include #include +#include #include #include namespace android::hardware::audio::common { +// Some values are reserved for use by the system code only. +// HALs must not accept or emit values outside from the provided list. +constexpr std::array<::aidl::android::media::audio::common::AudioMode, 5> kValidAudioModes = { + ::aidl::android::media::audio::common::AudioMode::NORMAL, + ::aidl::android::media::audio::common::AudioMode::RINGTONE, + ::aidl::android::media::audio::common::AudioMode::IN_CALL, + ::aidl::android::media::audio::common::AudioMode::IN_COMMUNICATION, + ::aidl::android::media::audio::common::AudioMode::CALL_SCREEN, +}; + constexpr size_t getPcmSampleSizeInBytes(::aidl::android::media::audio::common::PcmType pcm) { using ::aidl::android::media::audio::common::PcmType; switch (pcm) { @@ -91,6 +104,11 @@ constexpr bool isTelephonyDeviceType( device == ::aidl::android::media::audio::common::AudioDeviceType::OUT_TELEPHONY_TX; } +constexpr bool isValidAudioMode(::aidl::android::media::audio::common::AudioMode mode) { + return std::find(kValidAudioModes.begin(), kValidAudioModes.end(), mode) != + kValidAudioModes.end(); +} + // The helper functions defined below are only applicable to the case when an enum type // specifies zero-based bit positions, not bit masks themselves. This is why instantiation // is restricted to certain enum types. diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp index acad70f52d..a6e1d0dcd8 100644 --- a/audio/aidl/default/Module.cpp +++ b/audio/aidl/default/Module.cpp @@ -41,6 +41,7 @@ using aidl::android::media::audio::common::AudioFormatDescription; using aidl::android::media::audio::common::AudioFormatType; using aidl::android::media::audio::common::AudioInputFlags; using aidl::android::media::audio::common::AudioIoFlags; +using aidl::android::media::audio::common::AudioMode; using aidl::android::media::audio::common::AudioOffloadInfo; using aidl::android::media::audio::common::AudioOutputFlags; using aidl::android::media::audio::common::AudioPort; @@ -52,6 +53,7 @@ using aidl::android::media::audio::common::Int; using aidl::android::media::audio::common::PcmType; using android::hardware::audio::common::getFrameSizeInBytes; using android::hardware::audio::common::isBitPositionFlagSet; +using android::hardware::audio::common::isValidAudioMode; namespace aidl::android::hardware::audio::core { @@ -952,6 +954,10 @@ ndk::ScopedAStatus Module::getMicrophones(std::vector* _aidl_ret } ndk::ScopedAStatus Module::updateAudioMode(AudioMode in_mode) { + if (!isValidAudioMode(in_mode)) { + LOG(ERROR) << __func__ << ": invalid mode " << toString(in_mode); + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } // No checks for supported audio modes here, it's an informative notification. LOG(DEBUG) << __func__ << ": " << toString(in_mode); return ndk::ScopedAStatus::ok(); diff --git a/audio/aidl/default/Telephony.cpp b/audio/aidl/default/Telephony.cpp index d873178a00..ad2247015a 100644 --- a/audio/aidl/default/Telephony.cpp +++ b/audio/aidl/default/Telephony.cpp @@ -14,14 +14,18 @@ * limitations under the License. */ -#include #define LOG_TAG "AHAL_Telephony" #include +#include +#include + #include "core-impl/Telephony.h" +using aidl::android::media::audio::common::AudioMode; using aidl::android::media::audio::common::Boolean; using aidl::android::media::audio::common::Float; +using android::hardware::audio::common::isValidAudioMode; namespace aidl::android::hardware::audio::core { @@ -38,6 +42,10 @@ ndk::ScopedAStatus Telephony::getSupportedAudioModes(std::vector* _ai } ndk::ScopedAStatus Telephony::switchAudioMode(AudioMode in_mode) { + if (!isValidAudioMode(in_mode)) { + LOG(ERROR) << __func__ << ": invalid mode " << toString(in_mode); + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } if (std::find(mSupportedAudioModes.begin(), mSupportedAudioModes.end(), in_mode) != mSupportedAudioModes.end()) { LOG(DEBUG) << __func__ << ": " << toString(in_mode); diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h index 9e4499b085..3cce7692bb 100644 --- a/audio/aidl/default/include/core-impl/Module.h +++ b/audio/aidl/default/include/core-impl/Module.h @@ -92,7 +92,7 @@ class Module : public BnModule { ndk::ScopedAStatus setMicMute(bool in_mute) override; ndk::ScopedAStatus getMicrophones(std::vector* _aidl_return) override; ndk::ScopedAStatus updateAudioMode( - ::aidl::android::hardware::audio::core::AudioMode in_mode) override; + ::aidl::android::media::audio::common::AudioMode in_mode) override; ndk::ScopedAStatus updateScreenRotation( ::aidl::android::hardware::audio::core::IModule::ScreenRotation in_rotation) override; ndk::ScopedAStatus updateScreenState(bool in_isTurnedOn) override; diff --git a/audio/aidl/default/include/core-impl/Telephony.h b/audio/aidl/default/include/core-impl/Telephony.h index 09361722ff..0f8e93f10a 100644 --- a/audio/aidl/default/include/core-impl/Telephony.h +++ b/audio/aidl/default/include/core-impl/Telephony.h @@ -27,13 +27,20 @@ class Telephony : public BnTelephony { Telephony(); private: - ndk::ScopedAStatus getSupportedAudioModes(std::vector* _aidl_return) override; - ndk::ScopedAStatus switchAudioMode(AudioMode in_mode) override; + ndk::ScopedAStatus getSupportedAudioModes( + std::vector<::aidl::android::media::audio::common::AudioMode>* _aidl_return) override; + ndk::ScopedAStatus switchAudioMode( + ::aidl::android::media::audio::common::AudioMode in_mode) override; ndk::ScopedAStatus setTelecomConfig(const TelecomConfig& in_config, TelecomConfig* _aidl_return) override; - const std::vector mSupportedAudioModes = {::ndk::enum_range().begin(), - ::ndk::enum_range().end()}; + const std::vector<::aidl::android::media::audio::common::AudioMode> mSupportedAudioModes = { + ::aidl::android::media::audio::common::AudioMode::NORMAL, + ::aidl::android::media::audio::common::AudioMode::RINGTONE, + ::aidl::android::media::audio::common::AudioMode::IN_CALL, + ::aidl::android::media::audio::common::AudioMode::IN_COMMUNICATION, + // Omit CALL_SCREEN for a better VTS coverage. + }; TelecomConfig mTelecomConfig; }; diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp index d4f281115e..a8febc5b57 100644 --- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp @@ -54,7 +54,6 @@ using aidl::android::hardware::audio::common::PlaybackTrackMetadata; using aidl::android::hardware::audio::common::RecordTrackMetadata; using aidl::android::hardware::audio::common::SinkMetadata; using aidl::android::hardware::audio::common::SourceMetadata; -using aidl::android::hardware::audio::core::AudioMode; using aidl::android::hardware::audio::core::AudioPatch; using aidl::android::hardware::audio::core::AudioRoute; using aidl::android::hardware::audio::core::IBluetooth; @@ -78,6 +77,7 @@ using aidl::android::media::audio::common::AudioDualMonoMode; using aidl::android::media::audio::common::AudioFormatType; using aidl::android::media::audio::common::AudioIoFlags; using aidl::android::media::audio::common::AudioLatencyMode; +using aidl::android::media::audio::common::AudioMode; using aidl::android::media::audio::common::AudioOutputFlags; using aidl::android::media::audio::common::AudioPlaybackRate; using aidl::android::media::audio::common::AudioPort; @@ -93,6 +93,7 @@ using aidl::android::media::audio::common::Void; using android::hardware::audio::common::getChannelCount; using android::hardware::audio::common::isBitPositionFlagSet; using android::hardware::audio::common::isTelephonyDeviceType; +using android::hardware::audio::common::isValidAudioMode; using android::hardware::audio::common::StreamLogic; using android::hardware::audio::common::StreamWorker; using ndk::enum_range; @@ -1805,7 +1806,11 @@ TEST_P(AudioCoreModule, GetMicrophones) { TEST_P(AudioCoreModule, UpdateAudioMode) { for (const auto mode : ::ndk::enum_range()) { - EXPECT_IS_OK(module->updateAudioMode(mode)) << toString(mode); + if (isValidAudioMode(mode)) { + EXPECT_IS_OK(module->updateAudioMode(mode)) << toString(mode); + } else { + EXPECT_STATUS(EX_ILLEGAL_ARGUMENT, module->updateAudioMode(mode)) << toString(mode); + } } EXPECT_IS_OK(module->updateAudioMode(AudioMode::NORMAL)); } @@ -1994,6 +1999,9 @@ TEST_P(AudioCoreTelephony, GetSupportedAudioModes) { } std::vector modes1; ASSERT_IS_OK(telephony->getSupportedAudioModes(&modes1)); + for (const auto mode : modes1) { + EXPECT_TRUE(isValidAudioMode(mode)) << toString(mode); + } const std::vector kMandatoryModes = {AudioMode::NORMAL, AudioMode::RINGTONE, AudioMode::IN_CALL, AudioMode::IN_COMMUNICATION}; @@ -2025,7 +2033,9 @@ TEST_P(AudioCoreTelephony, SwitchAudioMode) { unsupportedModes.erase(mode); } for (const auto mode : unsupportedModes) { - EXPECT_STATUS(EX_UNSUPPORTED_OPERATION, telephony->switchAudioMode(mode)) << toString(mode); + EXPECT_STATUS(isValidAudioMode(mode) ? EX_UNSUPPORTED_OPERATION : EX_ILLEGAL_ARGUMENT, + telephony->switchAudioMode(mode)) + << toString(mode); } } From 25e8f5fa42ebd2127bc2b7124910975580912b31 Mon Sep 17 00:00:00 2001 From: Nathalie Le Clair Date: Wed, 11 Jan 2023 13:40:40 +0100 Subject: [PATCH 589/998] Add HDMI eARC, Connection and CEC to presubmit Additionally, delete a file from when the HDMI Connection HAL was still called the HDMI HAL. This file has been replaced by a corresponding file in hdmi/connection/aidl/... Test: lunch cf_x86_tv-userdebug; make; atest VtsHalTvHdmiCecAidlTargetTest; atest VtsHalTvHdmiConnectionAidlTargetTest; atest VtsHalTvHdmiEArcAidlTargetTest; Bug: 261729059 Change-Id: I472c054fd553f49c8834049a21eb4aa91f17285e --- tv/hdmi/connection/aidl/TEST_MAPPING | 7 ++++ .../aidl/vts/functional/AndroidTest.xml | 33 +++++++++++++++++++ tv/hdmi/earc/aidl/TEST_MAPPING | 7 ++++ .../earc/aidl/vts/functional/AndroidTest.xml | 33 +++++++++++++++++++ 4 files changed, 80 insertions(+) create mode 100644 tv/hdmi/connection/aidl/TEST_MAPPING create mode 100644 tv/hdmi/connection/aidl/vts/functional/AndroidTest.xml create mode 100644 tv/hdmi/earc/aidl/TEST_MAPPING create mode 100644 tv/hdmi/earc/aidl/vts/functional/AndroidTest.xml diff --git a/tv/hdmi/connection/aidl/TEST_MAPPING b/tv/hdmi/connection/aidl/TEST_MAPPING new file mode 100644 index 0000000000..13cf0c2155 --- /dev/null +++ b/tv/hdmi/connection/aidl/TEST_MAPPING @@ -0,0 +1,7 @@ +{ + "presubmit": [ + { + "name": "VtsHalTvHdmiConnectionAidlTargetTest" + } + ] +} diff --git a/tv/hdmi/connection/aidl/vts/functional/AndroidTest.xml b/tv/hdmi/connection/aidl/vts/functional/AndroidTest.xml new file mode 100644 index 0000000000..5a7fed0285 --- /dev/null +++ b/tv/hdmi/connection/aidl/vts/functional/AndroidTest.xml @@ -0,0 +1,33 @@ + + + + diff --git a/tv/hdmi/earc/aidl/TEST_MAPPING b/tv/hdmi/earc/aidl/TEST_MAPPING new file mode 100644 index 0000000000..ccc48fc859 --- /dev/null +++ b/tv/hdmi/earc/aidl/TEST_MAPPING @@ -0,0 +1,7 @@ +{ + "presubmit": [ + { + "name": "VtsHalTvHdmiEArcAidlTargetTest" + } + ] +} diff --git a/tv/hdmi/earc/aidl/vts/functional/AndroidTest.xml b/tv/hdmi/earc/aidl/vts/functional/AndroidTest.xml new file mode 100644 index 0000000000..12dd1e42d9 --- /dev/null +++ b/tv/hdmi/earc/aidl/vts/functional/AndroidTest.xml @@ -0,0 +1,33 @@ + + + + From 34081b36072d26953b56d53ccdf4b501688ae053 Mon Sep 17 00:00:00 2001 From: Swarn Singh Date: Wed, 11 Jan 2023 12:50:09 +0530 Subject: [PATCH 590/998] wifi: Add support for QoS SCS policy feature This commit defines supplicant AIDL APIs needed for QoS SCS policy feature. Bug: 236182432 Test: atest VtsHalWifiSupplicantStaIfaceTargetTest \ VtsHalWifiSupplicantStaNetworkTargetTest \ VtsHalWifiSupplicantP2pIfaceTargetTest Change-Id: I88c79a11edc70f9c7b662ae81594c0fc66d558b8 --- .../wifi/supplicant/ISupplicantStaIface.aidl | 4 + .../ISupplicantStaIfaceCallback.aidl | 1 + .../supplicant/QosPolicyClassifierParams.aidl | 1 + .../QosPolicyClassifierParamsMask.aidl | 1 + .../wifi/supplicant/QosPolicyScsData.aidl | 25 +++++++ .../supplicant/QosPolicyScsRequestStatus.aidl | 24 ++++++ .../QosPolicyScsRequestStatusCode.aidl | 26 +++++++ .../QosPolicyScsResponseStatus.aidl | 24 ++++++ .../QosPolicyScsResponseStatusCode.aidl | 31 ++++++++ .../wifi/supplicant/SupplicantStatusCode.aidl | 1 + .../wifi/supplicant/ISupplicantStaIface.aidl | 73 +++++++++++++++++++ .../ISupplicantStaIfaceCallback.aidl | 14 ++++ .../supplicant/QosPolicyClassifierParams.aidl | 6 ++ .../QosPolicyClassifierParamsMask.aidl | 1 + .../wifi/supplicant/QosPolicyScsData.aidl | 24 ++++++ .../supplicant/QosPolicyScsRequestStatus.aidl | 13 ++++ .../QosPolicyScsRequestStatusCode.aidl | 25 +++++++ .../QosPolicyScsResponseStatus.aidl | 13 ++++ .../QosPolicyScsResponseStatusCode.aidl | 46 ++++++++++++ .../wifi/supplicant/SupplicantStatusCode.aidl | 4 + .../supplicant_sta_iface_aidl_test.cpp | 6 ++ 21 files changed, 363 insertions(+) create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsData.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsRequestStatus.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsRequestStatusCode.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsResponseStatus.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsResponseStatusCode.aidl create mode 100644 wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsData.aidl create mode 100644 wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsRequestStatus.aidl create mode 100644 wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsRequestStatusCode.aidl create mode 100644 wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsResponseStatus.aidl create mode 100644 wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsResponseStatusCode.aidl diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl index 3740a10202..f617975498 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl @@ -96,4 +96,8 @@ interface ISupplicantStaIface { void stopDppResponder(in int ownBootstrapId); void stopRxFilter(); android.hardware.wifi.supplicant.SignalPollResult[] getSignalPollResults(); + android.hardware.wifi.supplicant.QosPolicyScsRequestStatus[] addQosPolicyRequestForScs(in android.hardware.wifi.supplicant.QosPolicyScsData[] qosPolicyData); + android.hardware.wifi.supplicant.QosPolicyScsRequestStatus[] removeQosPolicyForScs(in byte[] scsPolicyIds); + android.hardware.wifi.supplicant.QosPolicyScsRequestStatus[] removeAllQosPoliciesForScs(); + const int MAX_POLICIES_PER_QOS_SCS_REQUEST = 16; } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl index b54f04d2df..cabe167fa0 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl @@ -74,6 +74,7 @@ interface ISupplicantStaIfaceCallback { oneway void onDppConnectionStatusResultSent(in android.hardware.wifi.supplicant.DppStatusErrorCode code); oneway void onBssFrequencyChanged(in int frequencyMhz); oneway void onSupplicantStateChanged(in android.hardware.wifi.supplicant.SupplicantStateChangeData stateChangeData); + oneway void onQosPolicyResponseForScs(in android.hardware.wifi.supplicant.QosPolicyScsResponseStatus[] qosPolicyScsResponseStatus); @Backing(type="int") @VintfStability enum MloLinkInfoChangeReason { TID_TO_LINK_MAP = 0, diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyClassifierParams.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyClassifierParams.aidl index 8bf5fd836d..156d57ac0c 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyClassifierParams.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyClassifierParams.aidl @@ -43,4 +43,5 @@ parcelable QosPolicyClassifierParams { android.hardware.wifi.supplicant.ProtocolNextHeader protocolNextHdr; byte[] flowLabelIpv6; String domainName; + byte dscp; } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyClassifierParamsMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyClassifierParamsMask.aidl index 280ddbe3b2..9c0c0b65fb 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyClassifierParamsMask.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyClassifierParamsMask.aidl @@ -41,4 +41,5 @@ enum QosPolicyClassifierParamsMask { PROTOCOL_NEXT_HEADER = 16, FLOW_LABEL = 32, DOMAIN_NAME = 64, + DSCP = 128, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsData.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsData.aidl new file mode 100644 index 0000000000..4e5e8ae961 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsData.aidl @@ -0,0 +1,25 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable QosPolicyScsData { + byte policyId; + byte userPriority; + android.hardware.wifi.supplicant.QosPolicyClassifierParams classifierParams; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsRequestStatus.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsRequestStatus.aidl new file mode 100644 index 0000000000..d5573af593 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsRequestStatus.aidl @@ -0,0 +1,24 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable QosPolicyScsRequestStatus { + byte policyId; + android.hardware.wifi.supplicant.QosPolicyScsRequestStatusCode qosPolicyScsRequestStatusCode; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsRequestStatusCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsRequestStatusCode.aidl new file mode 100644 index 0000000000..4d815665d7 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsRequestStatusCode.aidl @@ -0,0 +1,26 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum QosPolicyScsRequestStatusCode { + SENT = 0, + ALREADY_ACTIVE = 1, + NOT_EXIST = 2, + INVALID = 3, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsResponseStatus.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsResponseStatus.aidl new file mode 100644 index 0000000000..2737f1a5a8 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsResponseStatus.aidl @@ -0,0 +1,24 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable QosPolicyScsResponseStatus { + byte policyId; + android.hardware.wifi.supplicant.QosPolicyScsResponseStatusCode qosPolicyScsResponseStatusCode; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsResponseStatusCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsResponseStatusCode.aidl new file mode 100644 index 0000000000..693d3e0ac0 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/QosPolicyScsResponseStatusCode.aidl @@ -0,0 +1,31 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum QosPolicyScsResponseStatusCode { + SUCCESS = 0, + TCLAS_REQUEST_DECLINED = 1, + TCLAS_NOT_SUPPORTED_BY_AP = 2, + TCLAS_INSUFFICIENT_RESOURCES = 3, + TCLAS_RESOURCES_EXHAUSTED = 4, + TCLAS_PROCESSING_TERMINATED_INSUFFICIENT_QOS = 5, + TCLAS_PROCESSING_TERMINATED_POLICY_CONFLICT = 6, + TCLAS_PROCESSING_TERMINATED = 7, + TIMEOUT = 8, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SupplicantStatusCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SupplicantStatusCode.aidl index 32d71a3a8c..d84ff95300 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SupplicantStatusCode.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SupplicantStatusCode.aidl @@ -45,4 +45,5 @@ enum SupplicantStatusCode { FAILURE_NETWORK_INVALID = 8, FAILURE_NETWORK_UNKNOWN = 9, FAILURE_UNSUPPORTED = 10, + FAILURE_ONGOING_REQUEST = 11, } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl index 9ceb3c0fc4..e00604810a 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl @@ -29,6 +29,8 @@ import android.hardware.wifi.supplicant.ISupplicantStaNetwork; import android.hardware.wifi.supplicant.IfaceType; import android.hardware.wifi.supplicant.KeyMgmtMask; import android.hardware.wifi.supplicant.MloLinksInfo; +import android.hardware.wifi.supplicant.QosPolicyScsData; +import android.hardware.wifi.supplicant.QosPolicyScsRequestStatus; import android.hardware.wifi.supplicant.QosPolicyStatus; import android.hardware.wifi.supplicant.RxFilterType; import android.hardware.wifi.supplicant.SignalPollResult; @@ -793,4 +795,75 @@ interface ISupplicantStaIface { * |SupplicantStatusCode.FAILURE_UNSUPPORTED| */ SignalPollResult[] getSignalPollResults(); + + /** + * Maximum number of policies that can be included in a QoS SCS add/remove request. + */ + const int MAX_POLICIES_PER_QOS_SCS_REQUEST = 16; + + /** + * Send a set of QoS SCS policy add requests to the AP. + * + * This is a request to the AP (if it supports the feature) to apply the QoS policies + * on traffic in the downlink. + * + * Synchronous response will indicate which policies were sent to the AP, and which + * were rejected immediately by supplicant. Caller will also receive an asynchronous + * response in |ISupplicantStaIfaceCallback.onQosPolicyResponseForScs| indicating + * the response from the AP for each policy that was sent. + * + * @param qosPolicyScsData QoS policies info provided by STA. + * @return QosPolicyScsRequestStatus[] synchronously corresponding to all + * the scs policies. Size of the result array will be the same as + * the size of the input array. + * @throws ServiceSpecificException with one of the following values: + * |SupplicantStatusCode.FAILURE_UNKNOWN| if the number of policies in the + * request is greater than |MAX_POLICIES_PER_QOS_SCS_REQUEST| + * + * |SupplicantStatusCode.FAILURE_UNSUPPORTED| if the AP does not support + * the feature. + * + * |SupplicantStatusCode.FAILURE_ONGOING_REQUEST| if a request is currently + * being processed. Supplicant will only handle one request at a time. + */ + QosPolicyScsRequestStatus[] addQosPolicyRequestForScs(in QosPolicyScsData[] qosPolicyData); + + /** + * Request the removal of specific QoS policies for SCS configured by the STA. + * + * Synchronous response will indicate which policies were sent to the AP, and which + * were rejected immediately by supplicant. Caller will also receive an asynchronous + * response in |ISupplicantStaIfaceCallback.onQosPolicyResponseForScs| indicating + * the response from the AP for each policy that was sent. + * + * @param scsPolicyIds policy id's to be removed. + * @return QosPolicyScsRequestStatus[] synchronously corresponding to all + * the scs policies. + * @throws ServiceSpecificException with one of the following values: + * |SupplicantStatusCode.FAILURE_UNKNOWN| if the number of policies in the + * request is greater than |MAX_POLICIES_PER_QOS_SCS_REQUEST| + * + * |SupplicantStatusCode.FAILURE_UNSUPPORTED| if the AP does not support + * the feature. + * + * |SupplicantStatusCode.FAILURE_ONGOING_REQUEST| if a request is currently + * being processed. Supplicant will only handle one request at a time. + */ + QosPolicyScsRequestStatus[] removeQosPolicyForScs(in byte[] scsPolicyIds); + + /** + * Request the removal of all QoS policies for SCS configured by the STA. + * + * @return QosPolicyScsRequestStatus[] synchronously corresponding to all + * the scs policies. + * @throws ServiceSpecificException with one of the following values: + * |SupplicantStatusCode.FAILURE_UNKNOWN| if there are no policies to remove. + * + * |SupplicantStatusCode.FAILURE_UNSUPPORTED| if the AP does not support + * the feature. + * + * |SupplicantStatusCode.FAILURE_ONGOING_REQUEST| if a request is currently + * being processed. Supplicant will only handle one request at a time. + */ + QosPolicyScsRequestStatus[] removeAllQosPoliciesForScs(); } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl index 5001800e11..398bb36499 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl @@ -31,6 +31,7 @@ import android.hardware.wifi.supplicant.DppStatusErrorCode; import android.hardware.wifi.supplicant.Hs20AnqpData; import android.hardware.wifi.supplicant.OsuMethod; import android.hardware.wifi.supplicant.QosPolicyData; +import android.hardware.wifi.supplicant.QosPolicyScsResponseStatus; import android.hardware.wifi.supplicant.StaIfaceCallbackState; import android.hardware.wifi.supplicant.StaIfaceReasonCode; import android.hardware.wifi.supplicant.SupplicantStateChangeData; @@ -378,4 +379,17 @@ oneway interface ISupplicantStaIfaceCallback { * @param stateChangeData Supplicant state change related information. */ void onSupplicantStateChanged(in SupplicantStateChangeData stateChangeData); + + /** + * Indicates an SCS response from the AP. + * + * If the AP does not send a response within the timeout period (1 sec), + * supplicant will call this API with the TIMEOUT status for each policy. + * + * The AP can trigger an unsolicited scs response to indicate the removal of + * previously requested policies. + * + * @param qosPolicyScsResponseStatus[] status for each SCS id. + */ + void onQosPolicyResponseForScs(in QosPolicyScsResponseStatus[] qosPolicyScsResponseStatus); } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyClassifierParams.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyClassifierParams.aidl index d95d18dd27..478b09d717 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyClassifierParams.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyClassifierParams.aidl @@ -62,4 +62,10 @@ parcelable QosPolicyClassifierParams { * "reg-name" in RFC 3986. */ String domainName; + + /** + * Differentiated Services Code Point (DSCP) value. + * Used by AP for mapping the data streams to apply the user priority. + */ + byte dscp; } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyClassifierParamsMask.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyClassifierParamsMask.aidl index 51bc14c25e..c15fec050b 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyClassifierParamsMask.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyClassifierParamsMask.aidl @@ -29,4 +29,5 @@ enum QosPolicyClassifierParamsMask { PROTOCOL_NEXT_HEADER = 1 << 4, FLOW_LABEL = 1 << 5, DOMAIN_NAME = 1 << 6, + DSCP = 1 << 7, } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsData.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsData.aidl new file mode 100644 index 0000000000..86a4dac216 --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsData.aidl @@ -0,0 +1,24 @@ +package android.hardware.wifi.supplicant; + +import android.hardware.wifi.supplicant.QosPolicyClassifierParams; + +/** + * QoS policy information in SCS request. + * TCLAS Processing element is always set to 0. + */ +@VintfStability +parcelable QosPolicyScsData { + /** SCS QoS Policy identifier. */ + byte policyId; + + /** + * User Priority (UP) which the AP should apply to streams that match + * the classifier parameters. + */ + byte userPriority; + + /** + * QoS policy SCS classifier type information. + */ + QosPolicyClassifierParams classifierParams; +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsRequestStatus.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsRequestStatus.aidl new file mode 100644 index 0000000000..e233f32260 --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsRequestStatus.aidl @@ -0,0 +1,13 @@ +package android.hardware.wifi.supplicant; + +import android.hardware.wifi.supplicant.QosPolicyScsRequestStatusCode; + +/** + * QoS policy status info per scsId. Returned immediately by supplicant + * upon SCS request. + */ +@VintfStability +parcelable QosPolicyScsRequestStatus { + byte policyId; + QosPolicyScsRequestStatusCode qosPolicyScsRequestStatusCode; +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsRequestStatusCode.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsRequestStatusCode.aidl new file mode 100644 index 0000000000..daf1578bb4 --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsRequestStatusCode.aidl @@ -0,0 +1,25 @@ +package android.hardware.wifi.supplicant; + +/** + * Enum values for QoS policy request status. + */ +@VintfStability +@Backing(type="int") +enum QosPolicyScsRequestStatusCode { + /** + * SCS request was sent to the AP. + */ + SENT, + /** + * Add request conflicts with an existing policy ID. + */ + ALREADY_ACTIVE, + /** + * Remove request is for a policy ID that does not exist. + */ + NOT_EXIST, + /** + * QoS policy params are invalid. + */ + INVALID, +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsResponseStatus.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsResponseStatus.aidl new file mode 100644 index 0000000000..846a0e2da5 --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsResponseStatus.aidl @@ -0,0 +1,13 @@ +package android.hardware.wifi.supplicant; + +import android.hardware.wifi.supplicant.QosPolicyScsResponseStatusCode; + +/** + * QoS policy status info per scsId. Returned in a callback once replies are + * received from the AP. + */ +@VintfStability +parcelable QosPolicyScsResponseStatus { + byte policyId; + QosPolicyScsResponseStatusCode qosPolicyScsResponseStatusCode; +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsResponseStatusCode.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsResponseStatusCode.aidl new file mode 100644 index 0000000000..f4ecd2a0ba --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/QosPolicyScsResponseStatusCode.aidl @@ -0,0 +1,46 @@ +package android.hardware.wifi.supplicant; + +/** + * Enum values for QoS policy response status. + */ +@VintfStability +@Backing(type="int") +enum QosPolicyScsResponseStatusCode { + SUCCESS, + /** + * Network policy does not permit the stream to be assigned the requested + * user priority (UP), but the AP might accept another request from the STA + * with the same TCLAS classifier(s) but a different user priority (UP). + */ + TCLAS_REQUEST_DECLINED, + /** + * Requested TCLAS processing is not supported by the AP. + */ + TCLAS_NOT_SUPPORTED_BY_AP, + /** + * The AP has insufficient TCLAS processing resources to satisfy the request + * (i.e. to classify and process the traffic). + */ + TCLAS_INSUFFICIENT_RESOURCES, + /** + * Sufficient TCLAS processing resources were available when the SCS + * stream was created, but are no longer available. + */ + TCLAS_RESOURCES_EXHAUSTED, + /** + * Insufficient capacity to sustain the current QoS treatment. + */ + TCLAS_PROCESSING_TERMINATED_INSUFFICIENT_QOS, + /** + * Conflict with a (new or dynamic) network policy. + */ + TCLAS_PROCESSING_TERMINATED_POLICY_CONFLICT, + /** + * Other reason for decline. + */ + TCLAS_PROCESSING_TERMINATED, + /** + * AP did not send a response within the timeout period (1 sec). + */ + TIMEOUT, +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/SupplicantStatusCode.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/SupplicantStatusCode.aidl index c7b7ffdcf1..e97d6eed21 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/SupplicantStatusCode.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/SupplicantStatusCode.aidl @@ -63,4 +63,8 @@ enum SupplicantStatusCode { */ FAILURE_NETWORK_UNKNOWN, FAILURE_UNSUPPORTED, + /** + * A different request is currently being processed. + */ + FAILURE_ONGOING_REQUEST, } diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp index d5366180ce..d0daf96b87 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp +++ b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp @@ -228,6 +228,12 @@ class SupplicantStaIfaceCallback : public BnSupplicantStaIfaceCallback { ::ndk::ScopedAStatus onBssFrequencyChanged(int32_t /* frequencyMhz */) override { return ndk::ScopedAStatus::ok(); } + ::ndk::ScopedAStatus onQosPolicyResponseForScs( + const std::vector<::aidl::android::hardware::wifi::supplicant:: + QosPolicyScsResponseStatus>& /* qosPolicyScsResponseStatus */) + override { + return ndk::ScopedAStatus::ok(); + } }; class SupplicantStaIfaceAidlTest : public testing::TestWithParam { From 7f3f32177b89bc95d6d4f4593aad098c32bcc3a5 Mon Sep 17 00:00:00 2001 From: Devika Krishnadas Date: Fri, 13 Jan 2023 00:13:26 +0000 Subject: [PATCH 591/998] gralloc4-vts: Remove assert for sizeInBits for RAW formats sizeInBits for components in RAW formats do not have to be invalid even if the bits are not contiguous. Bug: 265348037 Test: atest VtsHalGraphicsMapperV4_0TargetTest Change-Id: I69f58226e988c20b8ba5499ffec4fa0e2b2a68df Signed-off-by: Devika Krishnadas --- .../4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp index 5a450e385a..1e7cb8ef4c 100644 --- a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp +++ b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp @@ -952,7 +952,6 @@ TEST_P(GraphicsMapperHidlTest, Lock_RAW10) { EXPECT_EQ(PlaneLayoutComponentType::RAW, static_cast(planeLayoutComponent.type.value)); EXPECT_EQ(0, planeLayoutComponent.offsetInBits % 8); - EXPECT_EQ(-1, planeLayoutComponent.sizeInBits); ASSERT_NO_FATAL_FAILURE(fence.reset(mGralloc->unlock(bufferHandle))); } @@ -994,7 +993,6 @@ TEST_P(GraphicsMapperHidlTest, Lock_RAW12) { EXPECT_EQ(PlaneLayoutComponentType::RAW, static_cast(planeLayoutComponent.type.value)); EXPECT_EQ(0, planeLayoutComponent.offsetInBits % 8); - EXPECT_EQ(-1, planeLayoutComponent.sizeInBits); ASSERT_NO_FATAL_FAILURE(fence.reset(mGralloc->unlock(bufferHandle))); } From 417865dcdc760b3bfb5683a1ebb1c50fc8d3b602 Mon Sep 17 00:00:00 2001 From: shrikar Date: Fri, 13 Jan 2023 01:25:47 +0000 Subject: [PATCH 592/998] Made default units consistent in deprecated DefaultConfig.h Bug: 259879204 Test: Presubmit Change-Id: Ic03687406d5a8860717da6f0d871df967dafce81 --- automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h index e803e81328..cfa3b0cd39 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h @@ -144,7 +144,7 @@ const ConfigDeclaration kVehicleProperties[]{ (int)VehicleUnit::MILES_PER_HOUR, (int)VehicleUnit::KILOMETERS_PER_HOUR}, }, - .initialValue = {.int32Values = {(int)VehicleUnit::KILOMETERS_PER_HOUR}}}, + .initialValue = {.int32Values = {(int)VehicleUnit::MILES_PER_HOUR}}}, {.config = { @@ -379,7 +379,7 @@ const ConfigDeclaration kVehicleProperties[]{ .changeMode = VehiclePropertyChangeMode::ON_CHANGE, .configArray = {(int)VehicleUnit::LITER, (int)VehicleUnit::US_GALLON}, }, - .initialValue = {.int32Values = {(int)VehicleUnit::LITER}}}, + .initialValue = {.int32Values = {(int)VehicleUnit::US_GALLON}}}, {.config = { From 915157880b4a5887d64211c778500dca85b399de Mon Sep 17 00:00:00 2001 From: Avichal Rakesh Date: Thu, 5 Jan 2023 01:51:56 -0800 Subject: [PATCH 593/998] External Camera HAL: Fix prefix length The length calulation for the string "/dev/video" accidentally added one instead of removing one for null terminated string. This CL fixes the misplaced sign to get the correct length. Test: Manually Tested that the length is correct. Change-Id: I3e5d0cd7df20afdb2db61ac0963c5580722d8b24 --- camera/provider/default/ExternalCameraProvider.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/camera/provider/default/ExternalCameraProvider.cpp b/camera/provider/default/ExternalCameraProvider.cpp index d47ddbfef7..4d2c847255 100644 --- a/camera/provider/default/ExternalCameraProvider.cpp +++ b/camera/provider/default/ExternalCameraProvider.cpp @@ -46,7 +46,7 @@ const int kMaxDevicePathLen = 256; constexpr char kDevicePath[] = "/dev/"; constexpr char kPrefix[] = "video"; constexpr int kPrefixLen = sizeof(kPrefix) - 1; -constexpr int kDevicePrefixLen = sizeof(kDevicePath) + kPrefixLen + 1; +constexpr int kDevicePrefixLen = sizeof(kDevicePath) + kPrefixLen - 1; bool matchDeviceName(int cameraIdOffset, const std::string& deviceName, std::string* deviceVersion, std::string* cameraDevicePath) { @@ -379,4 +379,4 @@ bool ExternalCameraProvider::HotplugThread::threadLoop() { } // namespace provider } // namespace camera } // namespace hardware -} // namespace android \ No newline at end of file +} // namespace android From 3793ebdaead8aea32f834ece396fc18fe376fd58 Mon Sep 17 00:00:00 2001 From: Kriti Dang Date: Mon, 5 Dec 2022 13:03:49 +0100 Subject: [PATCH 594/998] ComposerHAL APIs for HDR output control Bug: 251168514 Test: atest VtsHalGraphicsComposer3_TargetTest Change-Id: Icf5437c6dab2c8ce9247617f6e6006051fc206fb --- .../common/HdrConversionCapability.aidl | 40 +++++++++++++ .../common/HdrConversionStrategy.aidl | 40 +++++++++++++ .../graphics/common/ParcelableHdr.aidl | 38 +++++++++++++ .../common/HdrConversionCapability.aidl | 37 ++++++++++++ .../common/HdrConversionStrategy.aidl | 39 +++++++++++++ .../graphics/common/ParcelableHdr.aidl | 24 ++++++++ .../graphics/composer3/Capability.aidl | 1 + .../graphics/composer3/IComposerClient.aidl | 2 + .../graphics/composer3/Capability.aidl | 8 +++ .../graphics/composer3/IComposerClient.aidl | 23 ++++++++ .../composer/aidl/vts/VtsComposerClient.cpp | 12 ++++ .../composer/aidl/vts/VtsComposerClient.h | 5 ++ .../VtsHalGraphicsComposer3_TargetTest.cpp | 57 +++++++++++++++++++ 13 files changed, 326 insertions(+) create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionCapability.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionStrategy.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ParcelableHdr.aidl create mode 100644 graphics/common/aidl/android/hardware/graphics/common/HdrConversionCapability.aidl create mode 100644 graphics/common/aidl/android/hardware/graphics/common/HdrConversionStrategy.aidl create mode 100644 graphics/common/aidl/android/hardware/graphics/common/ParcelableHdr.aidl diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionCapability.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionCapability.aidl new file mode 100644 index 0000000000..66151ca1ae --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionCapability.aidl @@ -0,0 +1,40 @@ +/** + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.graphics.common; +@VintfStability +parcelable HdrConversionCapability { + android.hardware.graphics.common.ParcelableHdr sourceType; + @nullable android.hardware.graphics.common.ParcelableHdr outputType; + boolean addsLatency; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionStrategy.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionStrategy.aidl new file mode 100644 index 0000000000..db785cf63f --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionStrategy.aidl @@ -0,0 +1,40 @@ +/** + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.graphics.common; +@VintfStability +union HdrConversionStrategy { + boolean passthrough = true; + android.hardware.graphics.common.Hdr[] autoAllowedHdrTypes; + android.hardware.graphics.common.Hdr forceHdrConversion; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ParcelableHdr.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ParcelableHdr.aidl new file mode 100644 index 0000000000..788bd4e9fa --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ParcelableHdr.aidl @@ -0,0 +1,38 @@ +/** + * 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 -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.hardware.graphics.common; +@VintfStability +parcelable ParcelableHdr { + android.hardware.graphics.common.Hdr hdr; +} diff --git a/graphics/common/aidl/android/hardware/graphics/common/HdrConversionCapability.aidl b/graphics/common/aidl/android/hardware/graphics/common/HdrConversionCapability.aidl new file mode 100644 index 0000000000..53b3256cf2 --- /dev/null +++ b/graphics/common/aidl/android/hardware/graphics/common/HdrConversionCapability.aidl @@ -0,0 +1,37 @@ +/** + * 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. + */ + +package android.hardware.graphics.common; + +import android.hardware.graphics.common.ParcelableHdr; + +/** + * Output parameter for IComposerClient.getHdrConversionCapabilities + * + * @param sourceType is the HDR type that can be converted to outputType. + * + * @param outputType is the HDR type/ SDR that the source type can be converted to. The value null + * is used to depict SDR outputType. + * + * @param addsLatency is false if no latency added due to HDR conversion from sourceType to + * outputType, otherwise true. + */ +@VintfStability +parcelable HdrConversionCapability { + ParcelableHdr sourceType; + @nullable ParcelableHdr outputType; + boolean addsLatency; +} diff --git a/graphics/common/aidl/android/hardware/graphics/common/HdrConversionStrategy.aidl b/graphics/common/aidl/android/hardware/graphics/common/HdrConversionStrategy.aidl new file mode 100644 index 0000000000..f564e9f008 --- /dev/null +++ b/graphics/common/aidl/android/hardware/graphics/common/HdrConversionStrategy.aidl @@ -0,0 +1,39 @@ +/** + * 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. + */ + +package android.hardware.graphics.common; +/** + * Input parameter for IComposerClient.setHdrConversionStrategy + * + * @param passthrough - When this parameter is set to true, HDR conversion is disabled by the + * implementation. The output HDR type will change dynamically to match the content. This value is + * never set to false, as other union values will be present in the false case. + * + * @param autoAllowedHdrTypes - When this parameter is set, the output HDR type is selected by the + * implementation. The implementation is only allowed to set the output HDR type to the HDR types + * present in this list. If conversion to any of the autoHdrTypes types is not possible, the + * implementation should do no conversion. + * + * @param forceHdrConversion - When this parameter is set, the implementation should convert all + * content to this HDR type, when possible. If not possible, the functionality should be similar to + * passthrough=true. + */ +@VintfStability +union HdrConversionStrategy { + boolean passthrough = true; + android.hardware.graphics.common.Hdr[] autoAllowedHdrTypes; + android.hardware.graphics.common.Hdr forceHdrConversion; +} diff --git a/graphics/common/aidl/android/hardware/graphics/common/ParcelableHdr.aidl b/graphics/common/aidl/android/hardware/graphics/common/ParcelableHdr.aidl new file mode 100644 index 0000000000..9aff2770c9 --- /dev/null +++ b/graphics/common/aidl/android/hardware/graphics/common/ParcelableHdr.aidl @@ -0,0 +1,24 @@ +/** + * 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.hardware.graphics.common; + +import android.hardware.graphics.common.Hdr; + +@VintfStability +parcelable ParcelableHdr { + Hdr hdr; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl index b89f7d5105..c0569ce004 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl @@ -40,4 +40,5 @@ enum Capability { PRESENT_FENCE_IS_NOT_RELIABLE = 3, SKIP_VALIDATE = 4, BOOT_DISPLAY_CONFIG = 5, + HDR_OUTPUT_CONVERSION_CONFIG = 6, } diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl index a7e65353e1..f5f63e0edc 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl @@ -76,6 +76,8 @@ interface IComposerClient { void setVsyncEnabled(long display, boolean enabled); void setIdleTimerEnabled(long display, int timeoutMs); android.hardware.graphics.composer3.OverlayProperties getOverlaySupport(); + android.hardware.graphics.common.HdrConversionCapability[] getHdrConversionCapabilities(); + void setHdrConversionStrategy(in android.hardware.graphics.common.HdrConversionStrategy conversionStrategy); const int EX_BAD_CONFIG = 1; const int EX_BAD_DISPLAY = 2; const int EX_BAD_LAYER = 3; diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl index 2f9eab937c..89c929805e 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl @@ -66,4 +66,12 @@ enum Capability { * @see IComposerClient.getPreferredBootDisplayConfig */ BOOT_DISPLAY_CONFIG = 5, + + /** + * Specifies that the device supports HDR output conversion. + * + * @see IComposerClient.getHdrConversionCapabilities + * @see IComposerClient.setHdrConversionStrategy + */ + HDR_OUTPUT_CONVERSION_CONFIG = 6, } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl index 88bb3a47ff..8091491ae2 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl @@ -17,6 +17,8 @@ package android.hardware.graphics.composer3; import android.hardware.graphics.common.DisplayDecorationSupport; +import android.hardware.graphics.common.HdrConversionCapability; +import android.hardware.graphics.common.HdrConversionStrategy; import android.hardware.graphics.common.Transform; import android.hardware.graphics.composer3.ClientTargetProperty; import android.hardware.graphics.composer3.ColorMode; @@ -825,4 +827,25 @@ interface IComposerClient { * @return the overlay properties of the device. */ OverlayProperties getOverlaySupport(); + + /** + * Returns the array of HDR conversion capability. Each HdrConversionCapability depicts that + * HDR conversion is possible from sourceType to outputType. This doesn't change after + * initialization. + * + * @exception EX_UNSUPPORTED when not supported by the underlying HAL + * + * @see setHdrConversionStrategy + */ + HdrConversionCapability[] getHdrConversionCapabilities(); + + /** + * Sets the of HDR conversion strategy. + * + * + * @exception EX_UNSUPPORTED when not supported by the underlying HAL + * + * @see getHdrConversionCapabilities + */ + void setHdrConversionStrategy(in HdrConversionStrategy conversionStrategy); } diff --git a/graphics/composer/aidl/vts/VtsComposerClient.cpp b/graphics/composer/aidl/vts/VtsComposerClient.cpp index 00b578b3f9..9d6ee17139 100644 --- a/graphics/composer/aidl/vts/VtsComposerClient.cpp +++ b/graphics/composer/aidl/vts/VtsComposerClient.cpp @@ -337,6 +337,18 @@ std::pair VtsComposerClient::getPreferredBootDisplayConf return {mComposerClient->getPreferredBootDisplayConfig(display, &outConfig), outConfig}; } +std::pair> +VtsComposerClient::getHdrConversionCapabilities() { + std::vector hdrConversionCapability; + return {mComposerClient->getHdrConversionCapabilities(&hdrConversionCapability), + hdrConversionCapability}; +} + +ScopedAStatus VtsComposerClient::setHdrConversionStrategy( + const common::HdrConversionStrategy& conversionStrategy) { + return mComposerClient->setHdrConversionStrategy(conversionStrategy); +} + std::pair VtsComposerClient::getDisplayPhysicalOrientation( int64_t display) { common::Transform outDisplayOrientation; diff --git a/graphics/composer/aidl/vts/VtsComposerClient.h b/graphics/composer/aidl/vts/VtsComposerClient.h index e61fde9571..cf4b47dd5f 100644 --- a/graphics/composer/aidl/vts/VtsComposerClient.h +++ b/graphics/composer/aidl/vts/VtsComposerClient.h @@ -163,6 +163,11 @@ class VtsComposerClient { std::pair getPreferredBootDisplayConfig(int64_t display); + std::pair> + getHdrConversionCapabilities(); + + ScopedAStatus setHdrConversionStrategy(const common::HdrConversionStrategy& conversionStrategy); + std::pair getDisplayPhysicalOrientation(int64_t display); ScopedAStatus setIdleTimerEnabled(int64_t display, int32_t timeoutMs); diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 7b852e029d..b0df5e88d9 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -621,6 +621,63 @@ TEST_P(GraphicsComposerAidlTest, BootDisplayConfig_Unsupported) { } } +TEST_P(GraphicsComposerAidlTest, GetHdrConversionCapabilities) { + if (!hasCapability(Capability::HDR_OUTPUT_CONVERSION_CONFIG)) { + GTEST_SUCCEED() << "HDR output conversion not supported"; + return; + } + const auto& [status, conversionCapabilities] = mComposerClient->getHdrConversionCapabilities(); + EXPECT_TRUE(status.isOk()); +} + +TEST_P(GraphicsComposerAidlTest, SetHdrConversionStrategy_Passthrough) { + if (!hasCapability(Capability::HDR_OUTPUT_CONVERSION_CONFIG)) { + GTEST_SUCCEED() << "HDR output conversion not supported"; + return; + } + common::HdrConversionStrategy hdrConversionStrategy; + hdrConversionStrategy.set(true); + const auto& status = mComposerClient->setHdrConversionStrategy(hdrConversionStrategy); + EXPECT_TRUE(status.isOk()); +} + +TEST_P(GraphicsComposerAidlTest, SetHdrConversionStrategy_Force) { + if (!hasCapability(Capability::HDR_OUTPUT_CONVERSION_CONFIG)) { + GTEST_SUCCEED() << "HDR output conversion not supported"; + return; + } + const auto& [status, conversionCapabilities] = mComposerClient->getHdrConversionCapabilities(); + for (auto conversionCapability : conversionCapabilities) { + if (conversionCapability.outputType) { + common::HdrConversionStrategy hdrConversionStrategy; + hdrConversionStrategy.set( + conversionCapability.outputType->hdr); + const auto& statusSet = + mComposerClient->setHdrConversionStrategy(hdrConversionStrategy); + EXPECT_TRUE(status.isOk()); + } + } +} + +TEST_P(GraphicsComposerAidlTest, SetHdrConversionStrategy_Auto) { + if (!hasCapability(Capability::HDR_OUTPUT_CONVERSION_CONFIG)) { + GTEST_SUCCEED() << "HDR output conversion not supported"; + return; + } + const auto& [status, conversionCapabilities] = mComposerClient->getHdrConversionCapabilities(); + std::vector autoHdrTypes; + for (auto conversionCapability : conversionCapabilities) { + if (conversionCapability.outputType) { + autoHdrTypes.push_back(conversionCapability.outputType->hdr); + } + } + common::HdrConversionStrategy hdrConversionStrategy; + hdrConversionStrategy.set( + autoHdrTypes); + const auto& statusSet = mComposerClient->setHdrConversionStrategy(hdrConversionStrategy); + EXPECT_TRUE(status.isOk()); +} + TEST_P(GraphicsComposerAidlTest, SetAutoLowLatencyMode_BadDisplay) { auto status = mComposerClient->setAutoLowLatencyMode(getInvalidDisplayId(), /*isEnabled*/ true); EXPECT_FALSE(status.isOk()); From c9d15a6bc29906a9f6221b4c34ef15e84e138e9b Mon Sep 17 00:00:00 2001 From: Sarah Chin Date: Thu, 5 Jan 2023 15:40:39 -0800 Subject: [PATCH 595/998] Change averagingWindowMs to int Revert changes for qfi and apply them to averagingWindowMs instead Test: build Bug: 264261216 Change-Id: I841694283d92a6b5925aabba687e978f7ce33dc9 --- .../hardware/radio/data/ApnAuthType.aidl | 8 +- .../android/hardware/radio/data/ApnTypes.aidl | 30 +- .../radio/data/DataCallFailCause.aidl | 678 +++++++++--------- .../hardware/radio/data/DataProfileInfo.aidl | 2 +- .../radio/data/DataThrottlingAction.aidl | 8 +- .../hardware/radio/data/LinkAddress.aidl | 2 +- .../android/hardware/radio/data/NrQos.aidl | 9 +- .../hardware/radio/data/PdpProtocolType.aidl | 2 +- .../hardware/radio/data/QosFilter.aidl | 2 +- .../radio/data/RouteSelectionDescriptor.aidl | 2 +- .../android/hardware/radio/data/NrQos.aidl | 19 +- .../compat/libradiocompat/data/structs.cpp | 4 +- 12 files changed, 386 insertions(+), 380 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnAuthType.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnAuthType.aidl index 86272c22eb..a33ad6e338 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnAuthType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnAuthType.aidl @@ -34,8 +34,8 @@ package android.hardware.radio.data; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ApnAuthType { - NO_PAP_NO_CHAP = 0, - PAP_NO_CHAP = 1, - NO_PAP_CHAP = 2, - PAP_CHAP = 3, + NO_PAP_NO_CHAP, + PAP_NO_CHAP, + NO_PAP_CHAP, + PAP_CHAP, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnTypes.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnTypes.aidl index 1518a5749e..45d22c853f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnTypes.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnTypes.aidl @@ -35,19 +35,19 @@ package android.hardware.radio.data; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ApnTypes { NONE = 0, - DEFAULT = 1, - MMS = 2, - SUPL = 4, - DUN = 8, - HIPRI = 16, - FOTA = 32, - IMS = 64, - CBS = 128, - IA = 256, - EMERGENCY = 512, - MCX = 1024, - XCAP = 2048, - VSIM = 4096, - BIP = 8192, - ENTERPRISE = 16384, + DEFAULT = (1 << 0), + MMS = (1 << 1), + SUPL = (1 << 2), + DUN = (1 << 3), + HIPRI = (1 << 4), + FOTA = (1 << 5), + IMS = (1 << 6), + CBS = (1 << 7), + IA = (1 << 8), + EMERGENCY = (1 << 9), + MCX = (1 << 10), + XCAP = (1 << 11), + VSIM = (1 << 12), + BIP = (1 << 13), + ENTERPRISE = (1 << 14), } diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl index d7d6983236..0a5f8dd01d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl @@ -35,343 +35,343 @@ package android.hardware.radio.data; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum DataCallFailCause { NONE = 0, - OPERATOR_BARRED = 8, - NAS_SIGNALLING = 14, - INSUFFICIENT_RESOURCES = 26, - MISSING_UNKNOWN_APN = 27, - UNKNOWN_PDP_ADDRESS_TYPE = 28, - USER_AUTHENTICATION = 29, - ACTIVATION_REJECT_GGSN = 30, - ACTIVATION_REJECT_UNSPECIFIED = 31, - SERVICE_OPTION_NOT_SUPPORTED = 32, - SERVICE_OPTION_NOT_SUBSCRIBED = 33, - SERVICE_OPTION_OUT_OF_ORDER = 34, - NSAPI_IN_USE = 35, - REGULAR_DEACTIVATION = 36, - QOS_NOT_ACCEPTED = 37, - NETWORK_FAILURE = 38, - UMTS_REACTIVATION_REQ = 39, - FEATURE_NOT_SUPP = 40, - TFT_SEMANTIC_ERROR = 41, - TFT_SYTAX_ERROR = 42, - UNKNOWN_PDP_CONTEXT = 43, - FILTER_SEMANTIC_ERROR = 44, - FILTER_SYTAX_ERROR = 45, - PDP_WITHOUT_ACTIVE_TFT = 46, - ONLY_IPV4_ALLOWED = 50, - ONLY_IPV6_ALLOWED = 51, - ONLY_SINGLE_BEARER_ALLOWED = 52, - ESM_INFO_NOT_RECEIVED = 53, - PDN_CONN_DOES_NOT_EXIST = 54, - MULTI_CONN_TO_SAME_PDN_NOT_ALLOWED = 55, - MAX_ACTIVE_PDP_CONTEXT_REACHED = 65, - UNSUPPORTED_APN_IN_CURRENT_PLMN = 66, - INVALID_TRANSACTION_ID = 81, - MESSAGE_INCORRECT_SEMANTIC = 95, - INVALID_MANDATORY_INFO = 96, - MESSAGE_TYPE_UNSUPPORTED = 97, - MSG_TYPE_NONCOMPATIBLE_STATE = 98, - UNKNOWN_INFO_ELEMENT = 99, - CONDITIONAL_IE_ERROR = 100, - MSG_AND_PROTOCOL_STATE_UNCOMPATIBLE = 101, - PROTOCOL_ERRORS = 111, - APN_TYPE_CONFLICT = 112, - INVALID_PCSCF_ADDR = 113, - INTERNAL_CALL_PREEMPT_BY_HIGH_PRIO_APN = 114, - EMM_ACCESS_BARRED = 115, - EMERGENCY_IFACE_ONLY = 116, - IFACE_MISMATCH = 117, - COMPANION_IFACE_IN_USE = 118, - IP_ADDRESS_MISMATCH = 119, - IFACE_AND_POL_FAMILY_MISMATCH = 120, - EMM_ACCESS_BARRED_INFINITE_RETRY = 121, - AUTH_FAILURE_ON_EMERGENCY_CALL = 122, - OEM_DCFAILCAUSE_1 = 4097, - OEM_DCFAILCAUSE_2 = 4098, - OEM_DCFAILCAUSE_3 = 4099, - OEM_DCFAILCAUSE_4 = 4100, - OEM_DCFAILCAUSE_5 = 4101, - OEM_DCFAILCAUSE_6 = 4102, - OEM_DCFAILCAUSE_7 = 4103, - OEM_DCFAILCAUSE_8 = 4104, - OEM_DCFAILCAUSE_9 = 4105, - OEM_DCFAILCAUSE_10 = 4106, - OEM_DCFAILCAUSE_11 = 4107, - OEM_DCFAILCAUSE_12 = 4108, - OEM_DCFAILCAUSE_13 = 4109, - OEM_DCFAILCAUSE_14 = 4110, - OEM_DCFAILCAUSE_15 = 4111, - VOICE_REGISTRATION_FAIL = -1, - DATA_REGISTRATION_FAIL = -2, - SIGNAL_LOST = -3, - PREF_RADIO_TECH_CHANGED = -4, - RADIO_POWER_OFF = -5, - TETHERED_CALL_ACTIVE = -6, - ERROR_UNSPECIFIED = 65535, - LLC_SNDCP = 25, - ACTIVATION_REJECTED_BCM_VIOLATION = 48, - COLLISION_WITH_NETWORK_INITIATED_REQUEST = 56, - ONLY_IPV4V6_ALLOWED = 57, - ONLY_NON_IP_ALLOWED = 58, - UNSUPPORTED_QCI_VALUE = 59, - BEARER_HANDLING_NOT_SUPPORTED = 60, - INVALID_DNS_ADDR = 123, - INVALID_PCSCF_OR_DNS_ADDRESS = 124, - CALL_PREEMPT_BY_EMERGENCY_APN = 127, - UE_INITIATED_DETACH_OR_DISCONNECT = 128, - MIP_FA_REASON_UNSPECIFIED = 2000, - MIP_FA_ADMIN_PROHIBITED = 2001, - MIP_FA_INSUFFICIENT_RESOURCES = 2002, - MIP_FA_MOBILE_NODE_AUTHENTICATION_FAILURE = 2003, - MIP_FA_HOME_AGENT_AUTHENTICATION_FAILURE = 2004, - MIP_FA_REQUESTED_LIFETIME_TOO_LONG = 2005, - MIP_FA_MALFORMED_REQUEST = 2006, - MIP_FA_MALFORMED_REPLY = 2007, - MIP_FA_ENCAPSULATION_UNAVAILABLE = 2008, - MIP_FA_VJ_HEADER_COMPRESSION_UNAVAILABLE = 2009, - MIP_FA_REVERSE_TUNNEL_UNAVAILABLE = 2010, - MIP_FA_REVERSE_TUNNEL_IS_MANDATORY = 2011, - MIP_FA_DELIVERY_STYLE_NOT_SUPPORTED = 2012, - MIP_FA_MISSING_NAI = 2013, - MIP_FA_MISSING_HOME_AGENT = 2014, - MIP_FA_MISSING_HOME_ADDRESS = 2015, - MIP_FA_UNKNOWN_CHALLENGE = 2016, - MIP_FA_MISSING_CHALLENGE = 2017, - MIP_FA_STALE_CHALLENGE = 2018, - MIP_HA_REASON_UNSPECIFIED = 2019, - MIP_HA_ADMIN_PROHIBITED = 2020, - MIP_HA_INSUFFICIENT_RESOURCES = 2021, - MIP_HA_MOBILE_NODE_AUTHENTICATION_FAILURE = 2022, - MIP_HA_FOREIGN_AGENT_AUTHENTICATION_FAILURE = 2023, - MIP_HA_REGISTRATION_ID_MISMATCH = 2024, - MIP_HA_MALFORMED_REQUEST = 2025, - MIP_HA_UNKNOWN_HOME_AGENT_ADDRESS = 2026, - MIP_HA_REVERSE_TUNNEL_UNAVAILABLE = 2027, - MIP_HA_REVERSE_TUNNEL_IS_MANDATORY = 2028, - MIP_HA_ENCAPSULATION_UNAVAILABLE = 2029, - CLOSE_IN_PROGRESS = 2030, - NETWORK_INITIATED_TERMINATION = 2031, - MODEM_APP_PREEMPTED = 2032, - PDN_IPV4_CALL_DISALLOWED = 2033, - PDN_IPV4_CALL_THROTTLED = 2034, - PDN_IPV6_CALL_DISALLOWED = 2035, - PDN_IPV6_CALL_THROTTLED = 2036, - MODEM_RESTART = 2037, - PDP_PPP_NOT_SUPPORTED = 2038, - UNPREFERRED_RAT = 2039, - PHYSICAL_LINK_CLOSE_IN_PROGRESS = 2040, - APN_PENDING_HANDOVER = 2041, - PROFILE_BEARER_INCOMPATIBLE = 2042, - SIM_CARD_CHANGED = 2043, - LOW_POWER_MODE_OR_POWERING_DOWN = 2044, - APN_DISABLED = 2045, - MAX_PPP_INACTIVITY_TIMER_EXPIRED = 2046, - IPV6_ADDRESS_TRANSFER_FAILED = 2047, - TRAT_SWAP_FAILED = 2048, - EHRPD_TO_HRPD_FALLBACK = 2049, - MIP_CONFIG_FAILURE = 2050, - PDN_INACTIVITY_TIMER_EXPIRED = 2051, - MAX_IPV4_CONNECTIONS = 2052, - MAX_IPV6_CONNECTIONS = 2053, - APN_MISMATCH = 2054, - IP_VERSION_MISMATCH = 2055, - DUN_CALL_DISALLOWED = 2056, - INTERNAL_EPC_NONEPC_TRANSITION = 2057, - INTERFACE_IN_USE = 2058, - APN_DISALLOWED_ON_ROAMING = 2059, - APN_PARAMETERS_CHANGED = 2060, - NULL_APN_DISALLOWED = 2061, - THERMAL_MITIGATION = 2062, - DATA_SETTINGS_DISABLED = 2063, - DATA_ROAMING_SETTINGS_DISABLED = 2064, - DDS_SWITCHED = 2065, - FORBIDDEN_APN_NAME = 2066, - DDS_SWITCH_IN_PROGRESS = 2067, - CALL_DISALLOWED_IN_ROAMING = 2068, - NON_IP_NOT_SUPPORTED = 2069, - PDN_NON_IP_CALL_THROTTLED = 2070, - PDN_NON_IP_CALL_DISALLOWED = 2071, - CDMA_LOCK = 2072, - CDMA_INTERCEPT = 2073, - CDMA_REORDER = 2074, - CDMA_RELEASE_DUE_TO_SO_REJECTION = 2075, - CDMA_INCOMING_CALL = 2076, - CDMA_ALERT_STOP = 2077, - CHANNEL_ACQUISITION_FAILURE = 2078, - MAX_ACCESS_PROBE = 2079, - CONCURRENT_SERVICE_NOT_SUPPORTED_BY_BASE_STATION = 2080, - NO_RESPONSE_FROM_BASE_STATION = 2081, - REJECTED_BY_BASE_STATION = 2082, - CONCURRENT_SERVICES_INCOMPATIBLE = 2083, - NO_CDMA_SERVICE = 2084, - RUIM_NOT_PRESENT = 2085, - CDMA_RETRY_ORDER = 2086, - ACCESS_BLOCK = 2087, - ACCESS_BLOCK_ALL = 2088, - IS707B_MAX_ACCESS_PROBES = 2089, - THERMAL_EMERGENCY = 2090, - CONCURRENT_SERVICES_NOT_ALLOWED = 2091, - INCOMING_CALL_REJECTED = 2092, - NO_SERVICE_ON_GATEWAY = 2093, - NO_GPRS_CONTEXT = 2094, - ILLEGAL_MS = 2095, - ILLEGAL_ME = 2096, - GPRS_SERVICES_AND_NON_GPRS_SERVICES_NOT_ALLOWED = 2097, - GPRS_SERVICES_NOT_ALLOWED = 2098, - MS_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK = 2099, - IMPLICITLY_DETACHED = 2100, - PLMN_NOT_ALLOWED = 2101, - LOCATION_AREA_NOT_ALLOWED = 2102, - GPRS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN = 2103, - PDP_DUPLICATE = 2104, - UE_RAT_CHANGE = 2105, - CONGESTION = 2106, - NO_PDP_CONTEXT_ACTIVATED = 2107, - ACCESS_CLASS_DSAC_REJECTION = 2108, - PDP_ACTIVATE_MAX_RETRY_FAILED = 2109, - RADIO_ACCESS_BEARER_FAILURE = 2110, - ESM_UNKNOWN_EPS_BEARER_CONTEXT = 2111, - DRB_RELEASED_BY_RRC = 2112, - CONNECTION_RELEASED = 2113, - EMM_DETACHED = 2114, - EMM_ATTACH_FAILED = 2115, - EMM_ATTACH_STARTED = 2116, - LTE_NAS_SERVICE_REQUEST_FAILED = 2117, - DUPLICATE_BEARER_ID = 2118, - ESM_COLLISION_SCENARIOS = 2119, - ESM_BEARER_DEACTIVATED_TO_SYNC_WITH_NETWORK = 2120, - ESM_NW_ACTIVATED_DED_BEARER_WITH_ID_OF_DEF_BEARER = 2121, - ESM_BAD_OTA_MESSAGE = 2122, - ESM_DOWNLOAD_SERVER_REJECTED_THE_CALL = 2123, - ESM_CONTEXT_TRANSFERRED_DUE_TO_IRAT = 2124, - DS_EXPLICIT_DEACTIVATION = 2125, - ESM_LOCAL_CAUSE_NONE = 2126, - LTE_THROTTLING_NOT_REQUIRED = 2127, - ACCESS_CONTROL_LIST_CHECK_FAILURE = 2128, - SERVICE_NOT_ALLOWED_ON_PLMN = 2129, - EMM_T3417_EXPIRED = 2130, - EMM_T3417_EXT_EXPIRED = 2131, - RRC_UPLINK_DATA_TRANSMISSION_FAILURE = 2132, - RRC_UPLINK_DELIVERY_FAILED_DUE_TO_HANDOVER = 2133, - RRC_UPLINK_CONNECTION_RELEASE = 2134, - RRC_UPLINK_RADIO_LINK_FAILURE = 2135, - RRC_UPLINK_ERROR_REQUEST_FROM_NAS = 2136, - RRC_CONNECTION_ACCESS_STRATUM_FAILURE = 2137, - RRC_CONNECTION_ANOTHER_PROCEDURE_IN_PROGRESS = 2138, - RRC_CONNECTION_ACCESS_BARRED = 2139, - RRC_CONNECTION_CELL_RESELECTION = 2140, - RRC_CONNECTION_CONFIG_FAILURE = 2141, - RRC_CONNECTION_TIMER_EXPIRED = 2142, - RRC_CONNECTION_LINK_FAILURE = 2143, - RRC_CONNECTION_CELL_NOT_CAMPED = 2144, - RRC_CONNECTION_SYSTEM_INTERVAL_FAILURE = 2145, - RRC_CONNECTION_REJECT_BY_NETWORK = 2146, - RRC_CONNECTION_NORMAL_RELEASE = 2147, - RRC_CONNECTION_RADIO_LINK_FAILURE = 2148, - RRC_CONNECTION_REESTABLISHMENT_FAILURE = 2149, - RRC_CONNECTION_OUT_OF_SERVICE_DURING_CELL_REGISTER = 2150, - RRC_CONNECTION_ABORT_REQUEST = 2151, - RRC_CONNECTION_SYSTEM_INFORMATION_BLOCK_READ_ERROR = 2152, - NETWORK_INITIATED_DETACH_WITH_AUTO_REATTACH = 2153, - NETWORK_INITIATED_DETACH_NO_AUTO_REATTACH = 2154, - ESM_PROCEDURE_TIME_OUT = 2155, - INVALID_CONNECTION_ID = 2156, - MAXIMIUM_NSAPIS_EXCEEDED = 2157, - INVALID_PRIMARY_NSAPI = 2158, - CANNOT_ENCODE_OTA_MESSAGE = 2159, - RADIO_ACCESS_BEARER_SETUP_FAILURE = 2160, - PDP_ESTABLISH_TIMEOUT_EXPIRED = 2161, - PDP_MODIFY_TIMEOUT_EXPIRED = 2162, - PDP_INACTIVE_TIMEOUT_EXPIRED = 2163, - PDP_LOWERLAYER_ERROR = 2164, - PDP_MODIFY_COLLISION = 2165, - MAXINUM_SIZE_OF_L2_MESSAGE_EXCEEDED = 2166, - NAS_REQUEST_REJECTED_BY_NETWORK = 2167, - RRC_CONNECTION_INVALID_REQUEST = 2168, - RRC_CONNECTION_TRACKING_AREA_ID_CHANGED = 2169, - RRC_CONNECTION_RF_UNAVAILABLE = 2170, - RRC_CONNECTION_ABORTED_DUE_TO_IRAT_CHANGE = 2171, - RRC_CONNECTION_RELEASED_SECURITY_NOT_ACTIVE = 2172, - RRC_CONNECTION_ABORTED_AFTER_HANDOVER = 2173, - RRC_CONNECTION_ABORTED_AFTER_IRAT_CELL_CHANGE = 2174, - RRC_CONNECTION_ABORTED_DURING_IRAT_CELL_CHANGE = 2175, - IMSI_UNKNOWN_IN_HOME_SUBSCRIBER_SERVER = 2176, - IMEI_NOT_ACCEPTED = 2177, - EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED = 2178, - EPS_SERVICES_NOT_ALLOWED_IN_PLMN = 2179, - MSC_TEMPORARILY_NOT_REACHABLE = 2180, - CS_DOMAIN_NOT_AVAILABLE = 2181, - ESM_FAILURE = 2182, - MAC_FAILURE = 2183, - SYNCHRONIZATION_FAILURE = 2184, - UE_SECURITY_CAPABILITIES_MISMATCH = 2185, - SECURITY_MODE_REJECTED = 2186, - UNACCEPTABLE_NON_EPS_AUTHENTICATION = 2187, - CS_FALLBACK_CALL_ESTABLISHMENT_NOT_ALLOWED = 2188, - NO_EPS_BEARER_CONTEXT_ACTIVATED = 2189, - INVALID_EMM_STATE = 2190, - NAS_LAYER_FAILURE = 2191, - MULTIPLE_PDP_CALL_NOT_ALLOWED = 2192, - EMBMS_NOT_ENABLED = 2193, - IRAT_HANDOVER_FAILED = 2194, - EMBMS_REGULAR_DEACTIVATION = 2195, - TEST_LOOPBACK_REGULAR_DEACTIVATION = 2196, - LOWER_LAYER_REGISTRATION_FAILURE = 2197, - DATA_PLAN_EXPIRED = 2198, - UMTS_HANDOVER_TO_IWLAN = 2199, - EVDO_CONNECTION_DENY_BY_GENERAL_OR_NETWORK_BUSY = 2200, - EVDO_CONNECTION_DENY_BY_BILLING_OR_AUTHENTICATION_FAILURE = 2201, - EVDO_HDR_CHANGED = 2202, - EVDO_HDR_EXITED = 2203, - EVDO_HDR_NO_SESSION = 2204, - EVDO_USING_GPS_FIX_INSTEAD_OF_HDR_CALL = 2205, - EVDO_HDR_CONNECTION_SETUP_TIMEOUT = 2206, - FAILED_TO_ACQUIRE_COLOCATED_HDR = 2207, - OTASP_COMMIT_IN_PROGRESS = 2208, - NO_HYBRID_HDR_SERVICE = 2209, - HDR_NO_LOCK_GRANTED = 2210, - DBM_OR_SMS_IN_PROGRESS = 2211, - HDR_FADE = 2212, - HDR_ACCESS_FAILURE = 2213, - UNSUPPORTED_1X_PREV = 2214, - LOCAL_END = 2215, - NO_SERVICE = 2216, - FADE = 2217, - NORMAL_RELEASE = 2218, - ACCESS_ATTEMPT_ALREADY_IN_PROGRESS = 2219, - REDIRECTION_OR_HANDOFF_IN_PROGRESS = 2220, - EMERGENCY_MODE = 2221, - PHONE_IN_USE = 2222, - INVALID_MODE = 2223, - INVALID_SIM_STATE = 2224, - NO_COLLOCATED_HDR = 2225, - UE_IS_ENTERING_POWERSAVE_MODE = 2226, - DUAL_SWITCH = 2227, - PPP_TIMEOUT = 2228, - PPP_AUTH_FAILURE = 2229, - PPP_OPTION_MISMATCH = 2230, - PPP_PAP_FAILURE = 2231, - PPP_CHAP_FAILURE = 2232, - PPP_CLOSE_IN_PROGRESS = 2233, - LIMITED_TO_IPV4 = 2234, - LIMITED_TO_IPV6 = 2235, - VSNCP_TIMEOUT = 2236, - VSNCP_GEN_ERROR = 2237, - VSNCP_APN_UNAUTHORIZED = 2238, - VSNCP_PDN_LIMIT_EXCEEDED = 2239, - VSNCP_NO_PDN_GATEWAY_ADDRESS = 2240, - VSNCP_PDN_GATEWAY_UNREACHABLE = 2241, - VSNCP_PDN_GATEWAY_REJECT = 2242, - VSNCP_INSUFFICIENT_PARAMETERS = 2243, - VSNCP_RESOURCE_UNAVAILABLE = 2244, - VSNCP_ADMINISTRATIVELY_PROHIBITED = 2245, - VSNCP_PDN_ID_IN_USE = 2246, - VSNCP_SUBSCRIBER_LIMITATION = 2247, - VSNCP_PDN_EXISTS_FOR_THIS_APN = 2248, - VSNCP_RECONNECT_NOT_ALLOWED = 2249, - IPV6_PREFIX_UNAVAILABLE = 2250, - HANDOFF_PREFERENCE_CHANGED = 2251, - SLICE_REJECTED = 2252, - MATCH_ALL_RULE_NOT_ALLOWED = 2253, - ALL_MATCHING_RULES_FAILED = 2254, + OPERATOR_BARRED = 0x08, + NAS_SIGNALLING = 0x0E, + INSUFFICIENT_RESOURCES = 0x1A, + MISSING_UNKNOWN_APN = 0x1B, + UNKNOWN_PDP_ADDRESS_TYPE = 0x1C, + USER_AUTHENTICATION = 0x1D, + ACTIVATION_REJECT_GGSN = 0x1E, + ACTIVATION_REJECT_UNSPECIFIED = 0x1F, + SERVICE_OPTION_NOT_SUPPORTED = 0x20, + SERVICE_OPTION_NOT_SUBSCRIBED = 0x21, + SERVICE_OPTION_OUT_OF_ORDER = 0x22, + NSAPI_IN_USE = 0x23, + REGULAR_DEACTIVATION = 0x24, + QOS_NOT_ACCEPTED = 0x25, + NETWORK_FAILURE = 0x26, + UMTS_REACTIVATION_REQ = 0x27, + FEATURE_NOT_SUPP = 0x28, + TFT_SEMANTIC_ERROR = 0x29, + TFT_SYTAX_ERROR = 0x2A, + UNKNOWN_PDP_CONTEXT = 0x2B, + FILTER_SEMANTIC_ERROR = 0x2C, + FILTER_SYTAX_ERROR = 0x2D, + PDP_WITHOUT_ACTIVE_TFT = 0x2E, + ONLY_IPV4_ALLOWED = 0x32, + ONLY_IPV6_ALLOWED = 0x33, + ONLY_SINGLE_BEARER_ALLOWED = 0x34, + ESM_INFO_NOT_RECEIVED = 0x35, + PDN_CONN_DOES_NOT_EXIST = 0x36, + MULTI_CONN_TO_SAME_PDN_NOT_ALLOWED = 0x37, + MAX_ACTIVE_PDP_CONTEXT_REACHED = 0x41, + UNSUPPORTED_APN_IN_CURRENT_PLMN = 0x42, + INVALID_TRANSACTION_ID = 0x51, + MESSAGE_INCORRECT_SEMANTIC = 0x5F, + INVALID_MANDATORY_INFO = 0x60, + MESSAGE_TYPE_UNSUPPORTED = 0x61, + MSG_TYPE_NONCOMPATIBLE_STATE = 0x62, + UNKNOWN_INFO_ELEMENT = 0x63, + CONDITIONAL_IE_ERROR = 0x64, + MSG_AND_PROTOCOL_STATE_UNCOMPATIBLE = 0x65, + PROTOCOL_ERRORS = 0x6F, + APN_TYPE_CONFLICT = 0x70, + INVALID_PCSCF_ADDR = 0x71, + INTERNAL_CALL_PREEMPT_BY_HIGH_PRIO_APN = 0x72, + EMM_ACCESS_BARRED = 0x73, + EMERGENCY_IFACE_ONLY = 0x74, + IFACE_MISMATCH = 0x75, + COMPANION_IFACE_IN_USE = 0x76, + IP_ADDRESS_MISMATCH = 0x77, + IFACE_AND_POL_FAMILY_MISMATCH = 0x78, + EMM_ACCESS_BARRED_INFINITE_RETRY = 0x79, + AUTH_FAILURE_ON_EMERGENCY_CALL = 0x7A, + OEM_DCFAILCAUSE_1 = 0x1001, + OEM_DCFAILCAUSE_2 = 0x1002, + OEM_DCFAILCAUSE_3 = 0x1003, + OEM_DCFAILCAUSE_4 = 0x1004, + OEM_DCFAILCAUSE_5 = 0x1005, + OEM_DCFAILCAUSE_6 = 0x1006, + OEM_DCFAILCAUSE_7 = 0x1007, + OEM_DCFAILCAUSE_8 = 0x1008, + OEM_DCFAILCAUSE_9 = 0x1009, + OEM_DCFAILCAUSE_10 = 0x100A, + OEM_DCFAILCAUSE_11 = 0x100B, + OEM_DCFAILCAUSE_12 = 0x100C, + OEM_DCFAILCAUSE_13 = 0x100D, + OEM_DCFAILCAUSE_14 = 0x100E, + OEM_DCFAILCAUSE_15 = 0x100F, + VOICE_REGISTRATION_FAIL = (-1), + DATA_REGISTRATION_FAIL = (-2), + SIGNAL_LOST = (-3), + PREF_RADIO_TECH_CHANGED = (-4), + RADIO_POWER_OFF = (-5), + TETHERED_CALL_ACTIVE = (-6), + ERROR_UNSPECIFIED = 0xffff, + LLC_SNDCP = 0x19, + ACTIVATION_REJECTED_BCM_VIOLATION = 0x30, + COLLISION_WITH_NETWORK_INITIATED_REQUEST = 0x38, + ONLY_IPV4V6_ALLOWED = 0x39, + ONLY_NON_IP_ALLOWED = 0x3A, + UNSUPPORTED_QCI_VALUE = 0x3B, + BEARER_HANDLING_NOT_SUPPORTED = 0x3C, + INVALID_DNS_ADDR = 0x7B, + INVALID_PCSCF_OR_DNS_ADDRESS = 0x7C, + CALL_PREEMPT_BY_EMERGENCY_APN = 0x7F, + UE_INITIATED_DETACH_OR_DISCONNECT = 0x80, + MIP_FA_REASON_UNSPECIFIED = 0x7D0, + MIP_FA_ADMIN_PROHIBITED = 0x7D1, + MIP_FA_INSUFFICIENT_RESOURCES = 0x7D2, + MIP_FA_MOBILE_NODE_AUTHENTICATION_FAILURE = 0x7D3, + MIP_FA_HOME_AGENT_AUTHENTICATION_FAILURE = 0x7D4, + MIP_FA_REQUESTED_LIFETIME_TOO_LONG = 0x7D5, + MIP_FA_MALFORMED_REQUEST = 0x7D6, + MIP_FA_MALFORMED_REPLY = 0x7D7, + MIP_FA_ENCAPSULATION_UNAVAILABLE = 0x7D8, + MIP_FA_VJ_HEADER_COMPRESSION_UNAVAILABLE = 0x7D9, + MIP_FA_REVERSE_TUNNEL_UNAVAILABLE = 0x7DA, + MIP_FA_REVERSE_TUNNEL_IS_MANDATORY = 0x7DB, + MIP_FA_DELIVERY_STYLE_NOT_SUPPORTED = 0x7DC, + MIP_FA_MISSING_NAI = 0x7DD, + MIP_FA_MISSING_HOME_AGENT = 0x7DE, + MIP_FA_MISSING_HOME_ADDRESS = 0x7DF, + MIP_FA_UNKNOWN_CHALLENGE = 0x7E0, + MIP_FA_MISSING_CHALLENGE = 0x7E1, + MIP_FA_STALE_CHALLENGE = 0x7E2, + MIP_HA_REASON_UNSPECIFIED = 0x7E3, + MIP_HA_ADMIN_PROHIBITED = 0x7E4, + MIP_HA_INSUFFICIENT_RESOURCES = 0x7E5, + MIP_HA_MOBILE_NODE_AUTHENTICATION_FAILURE = 0x7E6, + MIP_HA_FOREIGN_AGENT_AUTHENTICATION_FAILURE = 0x7E7, + MIP_HA_REGISTRATION_ID_MISMATCH = 0x7E8, + MIP_HA_MALFORMED_REQUEST = 0x7E9, + MIP_HA_UNKNOWN_HOME_AGENT_ADDRESS = 0x7EA, + MIP_HA_REVERSE_TUNNEL_UNAVAILABLE = 0x7EB, + MIP_HA_REVERSE_TUNNEL_IS_MANDATORY = 0x7EC, + MIP_HA_ENCAPSULATION_UNAVAILABLE = 0x7ED, + CLOSE_IN_PROGRESS = 0x7EE, + NETWORK_INITIATED_TERMINATION = 0x7EF, + MODEM_APP_PREEMPTED = 0x7F0, + PDN_IPV4_CALL_DISALLOWED = 0x7F1, + PDN_IPV4_CALL_THROTTLED = 0x7F2, + PDN_IPV6_CALL_DISALLOWED = 0x7F3, + PDN_IPV6_CALL_THROTTLED = 0x7F4, + MODEM_RESTART = 0x7F5, + PDP_PPP_NOT_SUPPORTED = 0x7F6, + UNPREFERRED_RAT = 0x7F7, + PHYSICAL_LINK_CLOSE_IN_PROGRESS = 0x7F8, + APN_PENDING_HANDOVER = 0x7F9, + PROFILE_BEARER_INCOMPATIBLE = 0x7FA, + SIM_CARD_CHANGED = 0x7FB, + LOW_POWER_MODE_OR_POWERING_DOWN = 0x7FC, + APN_DISABLED = 0x7FD, + MAX_PPP_INACTIVITY_TIMER_EXPIRED = 0x7FE, + IPV6_ADDRESS_TRANSFER_FAILED = 0x7FF, + TRAT_SWAP_FAILED = 0x800, + EHRPD_TO_HRPD_FALLBACK = 0x801, + MIP_CONFIG_FAILURE = 0x802, + PDN_INACTIVITY_TIMER_EXPIRED = 0x803, + MAX_IPV4_CONNECTIONS = 0x804, + MAX_IPV6_CONNECTIONS = 0x805, + APN_MISMATCH = 0x806, + IP_VERSION_MISMATCH = 0x807, + DUN_CALL_DISALLOWED = 0x808, + INTERNAL_EPC_NONEPC_TRANSITION = 0x809, + INTERFACE_IN_USE = 0x80A, + APN_DISALLOWED_ON_ROAMING = 0x80B, + APN_PARAMETERS_CHANGED = 0x80C, + NULL_APN_DISALLOWED = 0x80D, + THERMAL_MITIGATION = 0x80E, + DATA_SETTINGS_DISABLED = 0x80F, + DATA_ROAMING_SETTINGS_DISABLED = 0x810, + DDS_SWITCHED = 0x811, + FORBIDDEN_APN_NAME = 0x812, + DDS_SWITCH_IN_PROGRESS = 0x813, + CALL_DISALLOWED_IN_ROAMING = 0x814, + NON_IP_NOT_SUPPORTED = 0x815, + PDN_NON_IP_CALL_THROTTLED = 0x816, + PDN_NON_IP_CALL_DISALLOWED = 0x817, + CDMA_LOCK = 0x818, + CDMA_INTERCEPT = 0x819, + CDMA_REORDER = 0x81A, + CDMA_RELEASE_DUE_TO_SO_REJECTION = 0x81B, + CDMA_INCOMING_CALL = 0x81C, + CDMA_ALERT_STOP = 0x81D, + CHANNEL_ACQUISITION_FAILURE = 0x81E, + MAX_ACCESS_PROBE = 0x81F, + CONCURRENT_SERVICE_NOT_SUPPORTED_BY_BASE_STATION = 0x820, + NO_RESPONSE_FROM_BASE_STATION = 0x821, + REJECTED_BY_BASE_STATION = 0x822, + CONCURRENT_SERVICES_INCOMPATIBLE = 0x823, + NO_CDMA_SERVICE = 0x824, + RUIM_NOT_PRESENT = 0x825, + CDMA_RETRY_ORDER = 0x826, + ACCESS_BLOCK = 0x827, + ACCESS_BLOCK_ALL = 0x828, + IS707B_MAX_ACCESS_PROBES = 0x829, + THERMAL_EMERGENCY = 0x82A, + CONCURRENT_SERVICES_NOT_ALLOWED = 0x82B, + INCOMING_CALL_REJECTED = 0x82C, + NO_SERVICE_ON_GATEWAY = 0x82D, + NO_GPRS_CONTEXT = 0x82E, + ILLEGAL_MS = 0x82F, + ILLEGAL_ME = 0x830, + GPRS_SERVICES_AND_NON_GPRS_SERVICES_NOT_ALLOWED = 0x831, + GPRS_SERVICES_NOT_ALLOWED = 0x832, + MS_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK = 0x833, + IMPLICITLY_DETACHED = 0x834, + PLMN_NOT_ALLOWED = 0x835, + LOCATION_AREA_NOT_ALLOWED = 0x836, + GPRS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN = 0x837, + PDP_DUPLICATE = 0x838, + UE_RAT_CHANGE = 0x839, + CONGESTION = 0x83A, + NO_PDP_CONTEXT_ACTIVATED = 0x83B, + ACCESS_CLASS_DSAC_REJECTION = 0x83C, + PDP_ACTIVATE_MAX_RETRY_FAILED = 0x83D, + RADIO_ACCESS_BEARER_FAILURE = 0x83E, + ESM_UNKNOWN_EPS_BEARER_CONTEXT = 0x83F, + DRB_RELEASED_BY_RRC = 0x840, + CONNECTION_RELEASED = 0x841, + EMM_DETACHED = 0x842, + EMM_ATTACH_FAILED = 0x843, + EMM_ATTACH_STARTED = 0x844, + LTE_NAS_SERVICE_REQUEST_FAILED = 0x845, + DUPLICATE_BEARER_ID = 0x846, + ESM_COLLISION_SCENARIOS = 0x847, + ESM_BEARER_DEACTIVATED_TO_SYNC_WITH_NETWORK = 0x848, + ESM_NW_ACTIVATED_DED_BEARER_WITH_ID_OF_DEF_BEARER = 0x849, + ESM_BAD_OTA_MESSAGE = 0x84A, + ESM_DOWNLOAD_SERVER_REJECTED_THE_CALL = 0x84B, + ESM_CONTEXT_TRANSFERRED_DUE_TO_IRAT = 0x84C, + DS_EXPLICIT_DEACTIVATION = 0x84D, + ESM_LOCAL_CAUSE_NONE = 0x84E, + LTE_THROTTLING_NOT_REQUIRED = 0x84F, + ACCESS_CONTROL_LIST_CHECK_FAILURE = 0x850, + SERVICE_NOT_ALLOWED_ON_PLMN = 0x851, + EMM_T3417_EXPIRED = 0x852, + EMM_T3417_EXT_EXPIRED = 0x853, + RRC_UPLINK_DATA_TRANSMISSION_FAILURE = 0x854, + RRC_UPLINK_DELIVERY_FAILED_DUE_TO_HANDOVER = 0x855, + RRC_UPLINK_CONNECTION_RELEASE = 0x856, + RRC_UPLINK_RADIO_LINK_FAILURE = 0x857, + RRC_UPLINK_ERROR_REQUEST_FROM_NAS = 0x858, + RRC_CONNECTION_ACCESS_STRATUM_FAILURE = 0x859, + RRC_CONNECTION_ANOTHER_PROCEDURE_IN_PROGRESS = 0x85A, + RRC_CONNECTION_ACCESS_BARRED = 0x85B, + RRC_CONNECTION_CELL_RESELECTION = 0x85C, + RRC_CONNECTION_CONFIG_FAILURE = 0x85D, + RRC_CONNECTION_TIMER_EXPIRED = 0x85E, + RRC_CONNECTION_LINK_FAILURE = 0x85F, + RRC_CONNECTION_CELL_NOT_CAMPED = 0x860, + RRC_CONNECTION_SYSTEM_INTERVAL_FAILURE = 0x861, + RRC_CONNECTION_REJECT_BY_NETWORK = 0x862, + RRC_CONNECTION_NORMAL_RELEASE = 0x863, + RRC_CONNECTION_RADIO_LINK_FAILURE = 0x864, + RRC_CONNECTION_REESTABLISHMENT_FAILURE = 0x865, + RRC_CONNECTION_OUT_OF_SERVICE_DURING_CELL_REGISTER = 0x866, + RRC_CONNECTION_ABORT_REQUEST = 0x867, + RRC_CONNECTION_SYSTEM_INFORMATION_BLOCK_READ_ERROR = 0x868, + NETWORK_INITIATED_DETACH_WITH_AUTO_REATTACH = 0x869, + NETWORK_INITIATED_DETACH_NO_AUTO_REATTACH = 0x86A, + ESM_PROCEDURE_TIME_OUT = 0x86B, + INVALID_CONNECTION_ID = 0x86C, + MAXIMIUM_NSAPIS_EXCEEDED = 0x86D, + INVALID_PRIMARY_NSAPI = 0x86E, + CANNOT_ENCODE_OTA_MESSAGE = 0x86F, + RADIO_ACCESS_BEARER_SETUP_FAILURE = 0x870, + PDP_ESTABLISH_TIMEOUT_EXPIRED = 0x871, + PDP_MODIFY_TIMEOUT_EXPIRED = 0x872, + PDP_INACTIVE_TIMEOUT_EXPIRED = 0x873, + PDP_LOWERLAYER_ERROR = 0x874, + PDP_MODIFY_COLLISION = 0x875, + MAXINUM_SIZE_OF_L2_MESSAGE_EXCEEDED = 0x876, + NAS_REQUEST_REJECTED_BY_NETWORK = 0x877, + RRC_CONNECTION_INVALID_REQUEST = 0x878, + RRC_CONNECTION_TRACKING_AREA_ID_CHANGED = 0x879, + RRC_CONNECTION_RF_UNAVAILABLE = 0x87A, + RRC_CONNECTION_ABORTED_DUE_TO_IRAT_CHANGE = 0x87B, + RRC_CONNECTION_RELEASED_SECURITY_NOT_ACTIVE = 0x87C, + RRC_CONNECTION_ABORTED_AFTER_HANDOVER = 0x87D, + RRC_CONNECTION_ABORTED_AFTER_IRAT_CELL_CHANGE = 0x87E, + RRC_CONNECTION_ABORTED_DURING_IRAT_CELL_CHANGE = 0x87F, + IMSI_UNKNOWN_IN_HOME_SUBSCRIBER_SERVER = 0x880, + IMEI_NOT_ACCEPTED = 0x881, + EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED = 0x882, + EPS_SERVICES_NOT_ALLOWED_IN_PLMN = 0x883, + MSC_TEMPORARILY_NOT_REACHABLE = 0x884, + CS_DOMAIN_NOT_AVAILABLE = 0x885, + ESM_FAILURE = 0x886, + MAC_FAILURE = 0x887, + SYNCHRONIZATION_FAILURE = 0x888, + UE_SECURITY_CAPABILITIES_MISMATCH = 0x889, + SECURITY_MODE_REJECTED = 0x88A, + UNACCEPTABLE_NON_EPS_AUTHENTICATION = 0x88B, + CS_FALLBACK_CALL_ESTABLISHMENT_NOT_ALLOWED = 0x88C, + NO_EPS_BEARER_CONTEXT_ACTIVATED = 0x88D, + INVALID_EMM_STATE = 0x88E, + NAS_LAYER_FAILURE = 0x88F, + MULTIPLE_PDP_CALL_NOT_ALLOWED = 0x890, + EMBMS_NOT_ENABLED = 0x891, + IRAT_HANDOVER_FAILED = 0x892, + EMBMS_REGULAR_DEACTIVATION = 0x893, + TEST_LOOPBACK_REGULAR_DEACTIVATION = 0x894, + LOWER_LAYER_REGISTRATION_FAILURE = 0x895, + DATA_PLAN_EXPIRED = 0x896, + UMTS_HANDOVER_TO_IWLAN = 0x897, + EVDO_CONNECTION_DENY_BY_GENERAL_OR_NETWORK_BUSY = 0x898, + EVDO_CONNECTION_DENY_BY_BILLING_OR_AUTHENTICATION_FAILURE = 0x899, + EVDO_HDR_CHANGED = 0x89A, + EVDO_HDR_EXITED = 0x89B, + EVDO_HDR_NO_SESSION = 0x89C, + EVDO_USING_GPS_FIX_INSTEAD_OF_HDR_CALL = 0x89D, + EVDO_HDR_CONNECTION_SETUP_TIMEOUT = 0x89E, + FAILED_TO_ACQUIRE_COLOCATED_HDR = 0x89F, + OTASP_COMMIT_IN_PROGRESS = 0x8A0, + NO_HYBRID_HDR_SERVICE = 0x8A1, + HDR_NO_LOCK_GRANTED = 0x8A2, + DBM_OR_SMS_IN_PROGRESS = 0x8A3, + HDR_FADE = 0x8A4, + HDR_ACCESS_FAILURE = 0x8A5, + UNSUPPORTED_1X_PREV = 0x8A6, + LOCAL_END = 0x8A7, + NO_SERVICE = 0x8A8, + FADE = 0x8A9, + NORMAL_RELEASE = 0x8AA, + ACCESS_ATTEMPT_ALREADY_IN_PROGRESS = 0x8AB, + REDIRECTION_OR_HANDOFF_IN_PROGRESS = 0x8AC, + EMERGENCY_MODE = 0x8AD, + PHONE_IN_USE = 0x8AE, + INVALID_MODE = 0x8AF, + INVALID_SIM_STATE = 0x8B0, + NO_COLLOCATED_HDR = 0x8B1, + UE_IS_ENTERING_POWERSAVE_MODE = 0x8B2, + DUAL_SWITCH = 0x8B3, + PPP_TIMEOUT = 0x8B4, + PPP_AUTH_FAILURE = 0x8B5, + PPP_OPTION_MISMATCH = 0x8B6, + PPP_PAP_FAILURE = 0x8B7, + PPP_CHAP_FAILURE = 0x8B8, + PPP_CLOSE_IN_PROGRESS = 0x8B9, + LIMITED_TO_IPV4 = 0x8BA, + LIMITED_TO_IPV6 = 0x8BB, + VSNCP_TIMEOUT = 0x8BC, + VSNCP_GEN_ERROR = 0x8BD, + VSNCP_APN_UNAUTHORIZED = 0x8BE, + VSNCP_PDN_LIMIT_EXCEEDED = 0x8BF, + VSNCP_NO_PDN_GATEWAY_ADDRESS = 0x8C0, + VSNCP_PDN_GATEWAY_UNREACHABLE = 0x8C1, + VSNCP_PDN_GATEWAY_REJECT = 0x8C2, + VSNCP_INSUFFICIENT_PARAMETERS = 0x8C3, + VSNCP_RESOURCE_UNAVAILABLE = 0x8C4, + VSNCP_ADMINISTRATIVELY_PROHIBITED = 0x8C5, + VSNCP_PDN_ID_IN_USE = 0x8C6, + VSNCP_SUBSCRIBER_LIMITATION = 0x8C7, + VSNCP_PDN_EXISTS_FOR_THIS_APN = 0x8C8, + VSNCP_RECONNECT_NOT_ALLOWED = 0x8C9, + IPV6_PREFIX_UNAVAILABLE = 0x8CA, + HANDOFF_PREFERENCE_CHANGED = 0x8CB, + SLICE_REJECTED = 0x8CC, + MATCH_ALL_RULE_NOT_ALLOWED = 0x8CD, + ALL_MATCHING_RULES_FAILED = 0x8CE, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataProfileInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataProfileInfo.aidl index 16fada1d76..0136fa4a5a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataProfileInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataProfileInfo.aidl @@ -60,7 +60,7 @@ parcelable DataProfileInfo { const int ID_FOTA = 3; const int ID_CBS = 4; const int ID_OEM_BASE = 1000; - const int ID_INVALID = -1; + const int ID_INVALID = 0xFFFFFFFF; const int TYPE_COMMON = 0; const int TYPE_3GPP = 1; const int TYPE_3GPP2 = 2; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataThrottlingAction.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataThrottlingAction.aidl index 4f976cd593..e80a764046 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataThrottlingAction.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataThrottlingAction.aidl @@ -34,8 +34,8 @@ package android.hardware.radio.data; @Backing(type="byte") @JavaDerive(toString=true) @VintfStability enum DataThrottlingAction { - NO_DATA_THROTTLING = 0, - THROTTLE_SECONDARY_CARRIER = 1, - THROTTLE_ANCHOR_CARRIER = 2, - HOLD = 3, + NO_DATA_THROTTLING, + THROTTLE_SECONDARY_CARRIER, + THROTTLE_ANCHOR_CARRIER, + HOLD, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/LinkAddress.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/LinkAddress.aidl index 48e646ea22..77d637b9b9 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/LinkAddress.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/LinkAddress.aidl @@ -39,5 +39,5 @@ parcelable LinkAddress { long deprecationTime; long expirationTime; const int ADDRESS_PROPERTY_NONE = 0; - const int ADDRESS_PROPERTY_DEPRECATED = 32; + const int ADDRESS_PROPERTY_DEPRECATED = 0x20; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/NrQos.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/NrQos.aidl index a0792c3f37..be859b79de 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/NrQos.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/NrQos.aidl @@ -37,12 +37,13 @@ parcelable NrQos { int fiveQi; android.hardware.radio.data.QosBandwidth downlink; android.hardware.radio.data.QosBandwidth uplink; - /** - * @deprecated use qosFlowIdentifier. - */ byte qfi; + /** + * @deprecated use averagingWindowMillis; + */ char averagingWindowMs; - int qosFlowIdentifier; + int averagingWindowMillis = AVERAGING_WINDOW_UNKNOWN; const byte FLOW_ID_RANGE_MIN = 1; const byte FLOW_ID_RANGE_MAX = 63; + const int AVERAGING_WINDOW_UNKNOWN = (-1); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PdpProtocolType.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PdpProtocolType.aidl index 9771e5ccc1..d1c4a62a31 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PdpProtocolType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PdpProtocolType.aidl @@ -34,7 +34,7 @@ package android.hardware.radio.data; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum PdpProtocolType { - UNKNOWN = -1, + UNKNOWN = (-1), IP = 0, IPV6 = 1, IPV4V6 = 2, diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilter.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilter.aidl index e22b359163..de45cc5f32 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilter.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilter.aidl @@ -47,7 +47,7 @@ parcelable QosFilter { const byte DIRECTION_DOWNLINK = 0; const byte DIRECTION_UPLINK = 1; const byte DIRECTION_BIDIRECTIONAL = 2; - const byte PROTOCOL_UNSPECIFIED = -1; + const byte PROTOCOL_UNSPECIFIED = (-1); const byte PROTOCOL_TCP = 6; const byte PROTOCOL_UDP = 17; const byte PROTOCOL_ESP = 50; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/RouteSelectionDescriptor.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/RouteSelectionDescriptor.aidl index 434ee7d102..d83df81a38 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/RouteSelectionDescriptor.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/RouteSelectionDescriptor.aidl @@ -39,7 +39,7 @@ parcelable RouteSelectionDescriptor { byte sscMode; android.hardware.radio.data.SliceInfo[] sliceInfo; String[] dnn; - const byte SSC_MODE_UNKNOWN = -1; + const byte SSC_MODE_UNKNOWN = (-1); const byte SSC_MODE_1 = 1; const byte SSC_MODE_2 = 2; const byte SSC_MODE_3 = 3; diff --git a/radio/aidl/android/hardware/radio/data/NrQos.aidl b/radio/aidl/android/hardware/radio/data/NrQos.aidl index 28b4a7f20d..4078fdccc6 100644 --- a/radio/aidl/android/hardware/radio/data/NrQos.aidl +++ b/radio/aidl/android/hardware/radio/data/NrQos.aidl @@ -27,6 +27,8 @@ parcelable NrQos { const byte FLOW_ID_RANGE_MIN = 1; const byte FLOW_ID_RANGE_MAX = 63; + const int AVERAGING_WINDOW_UNKNOWN = -1; + /** * 5G QOS Identifier (5QI), see 3GPP TS 24.501 and 23.501. The allowed values are standard * values (1-9, 65-68, 69-70, 75, 79-80, 82-85) defined in the spec and operator specific values @@ -35,14 +37,17 @@ parcelable NrQos { int fiveQi; QosBandwidth downlink; QosBandwidth uplink; - /** - * @deprecated use qosFlowIdentifier. - */ - byte qfi; - char averagingWindowMs; /** * QOS flow identifier of the QOS flow description in the range * (FLOW_ID_RANGE_MIN, FLOW_ID_RANGE_MAX). - **/ - int qosFlowIdentifier; + */ + byte qfi; + /** + * @deprecated use averagingWindowMillis; + */ + char averagingWindowMs; + /** + * The duration over which flow rates are calculated. + */ + int averagingWindowMillis = AVERAGING_WINDOW_UNKNOWN; } diff --git a/radio/aidl/compat/libradiocompat/data/structs.cpp b/radio/aidl/compat/libradiocompat/data/structs.cpp index 22cde6b994..47f1f86320 100644 --- a/radio/aidl/compat/libradiocompat/data/structs.cpp +++ b/radio/aidl/compat/libradiocompat/data/structs.cpp @@ -136,8 +136,8 @@ static aidl::NrQos toAidl(const V1_6::NrQos& qos) { .fiveQi = qos.fiveQi, .downlink = toAidl(qos.downlink), .uplink = toAidl(qos.uplink), - .qosFlowIdentifier = static_cast(qos.qfi), - .averagingWindowMs = qos.averagingWindowMs, + .qfi = static_cast(qos.qfi), + .averagingWindowMillis = qos.averagingWindowMs, }; } From 4cadc791a422345eb6b6177bf28fe03cea6d5213 Mon Sep 17 00:00:00 2001 From: Michael Butler Date: Wed, 1 Jun 2022 14:53:15 -0700 Subject: [PATCH 596/998] Disable TEST_MAPPING for VtsHalNeuralnetworksV1_*TargetTest A sibling change removes the NN HIDL sample drivers from cuttlefish. In response, this change removes the VtsHalNeuralnetworksV1_*TargetTest tests from the TEST_MAPPING because they do not test anything without the NN HIDL sample drivers present. Note that the NN AIDL sample drivers and NN AIDL VTS test (VtsHalNeuralnetworksTargetTest) are still present. Bug: 233665601 Test: mma Test: croot && cd hardware/interfaces/neuralnetworks && atest Change-Id: I90bccd843ba9296c27d3010cec652be55a13a225 (cherry picked from commit e8e7a1018cb9f05a0e31d3facdf5fcf736dbc38f) --- neuralnetworks/1.0/vts/functional/Android.bp | 1 - neuralnetworks/1.1/vts/functional/Android.bp | 1 - neuralnetworks/1.2/vts/functional/Android.bp | 1 - neuralnetworks/1.3/vts/functional/Android.bp | 1 - neuralnetworks/TEST_MAPPING | 44 -------------------- 5 files changed, 48 deletions(-) diff --git a/neuralnetworks/1.0/vts/functional/Android.bp b/neuralnetworks/1.0/vts/functional/Android.bp index 29b31d254e..a41f37fb5b 100644 --- a/neuralnetworks/1.0/vts/functional/Android.bp +++ b/neuralnetworks/1.0/vts/functional/Android.bp @@ -90,7 +90,6 @@ cc_test { "libneuralnetworks_headers", ], test_suites: [ - "general-tests", "vts", ], } diff --git a/neuralnetworks/1.1/vts/functional/Android.bp b/neuralnetworks/1.1/vts/functional/Android.bp index e9d4b76221..7c1c118c07 100644 --- a/neuralnetworks/1.1/vts/functional/Android.bp +++ b/neuralnetworks/1.1/vts/functional/Android.bp @@ -58,7 +58,6 @@ cc_test { "libneuralnetworks_headers", ], test_suites: [ - "general-tests", "vts", ], } diff --git a/neuralnetworks/1.2/vts/functional/Android.bp b/neuralnetworks/1.2/vts/functional/Android.bp index 2177924d30..7e4b5bbab1 100644 --- a/neuralnetworks/1.2/vts/functional/Android.bp +++ b/neuralnetworks/1.2/vts/functional/Android.bp @@ -85,7 +85,6 @@ cc_test { "libneuralnetworks_headers", ], test_suites: [ - "general-tests", "vts", ], } diff --git a/neuralnetworks/1.3/vts/functional/Android.bp b/neuralnetworks/1.3/vts/functional/Android.bp index 9fa0f0a174..07071cc47b 100644 --- a/neuralnetworks/1.3/vts/functional/Android.bp +++ b/neuralnetworks/1.3/vts/functional/Android.bp @@ -92,7 +92,6 @@ cc_test { "libneuralnetworks_headers", ], test_suites: [ - "general-tests", "vts", ], } diff --git a/neuralnetworks/TEST_MAPPING b/neuralnetworks/TEST_MAPPING index d29682887a..32182069f0 100644 --- a/neuralnetworks/TEST_MAPPING +++ b/neuralnetworks/TEST_MAPPING @@ -17,53 +17,9 @@ }, { "name": "neuralnetworks_utils_hal_aidl_test" - }, - { - "name": "VtsHalNeuralnetworksV1_0TargetTest", - "options": [ - { - // Do not use any sample driver except sample-all in order to reduce - // testing time. The other sample drivers (fast-float, quant, etc.) - // are subsets of sample-all. - "include-filter": "-*sample_float_fast*:*sample_float_slow*:*sample_minimal*:*sample_quant*" - } - ] - }, - { - "name": "VtsHalNeuralnetworksV1_1TargetTest", - "options": [ - { - // Do not use any sample driver except sample-all in order to reduce - // testing time. The other sample drivers (fast-float, quant, etc.) - // are subsets of sample-all. - "include-filter": "-*sample_float_fast*:*sample_float_slow*:*sample_minimal*:*sample_quant*" - } - ] } ], "presubmit-large": [ - { - "name": "VtsHalNeuralnetworksV1_2TargetTest", - "options": [ - { - // Do not use any sample driver except sample-all in order to reduce - // testing time. The other sample drivers (fast-float, quant, etc.) - // are subsets of sample-all. - "include-filter": "-*sample_float_fast*:*sample_float_slow*:*sample_minimal*:*sample_quant*" - } - ] - }, - { - "name": "VtsHalNeuralnetworksV1_3TargetTest", - "options": [ - { - // Do not use any sample driver except sample-all in order to reduce - // testing time. The other sample drivers (fast-float, quant, etc.) - // are subsets of sample-all. - "include-filter": "-*sample_float_fast*:*sample_float_slow*:*sample_minimal*:*sample_quant*" - } - ] - }, { "name": "VtsHalNeuralnetworksTargetTest", "options": [ From 9c44c924c8b8c516405e749dbdc4272f2c27963e Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Mon, 16 Jan 2023 01:11:04 +0000 Subject: [PATCH 597/998] Update description of startImsTrafficResponse Bug: 219242095 Test: build Change-Id: I6cc721503db2f09ad025917142f1e8dd89afddcc --- radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl index 241c342384..ff516cc8f1 100644 --- a/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl +++ b/radio/aidl/android/hardware/radio/ims/IRadioImsResponse.aidl @@ -58,8 +58,9 @@ oneway interface IRadioImsResponse { void updateImsRegistrationInfoResponse(in RadioResponseInfo info); /** - * @param info Response info struct containing response type, serial no. and error - * @param failureInfo Information about failure in detail + * @param info Response info struct containing response type, serial no. and error. + * @param failureInfo Information about failure in detail. If there is no error, + * it should be {@code null}. * * Valid errors returned: * RadioError:NONE From 50c06a5f2b9ea336e35a0ac2a8c79611dd009e8f Mon Sep 17 00:00:00 2001 From: Andrew Chant Date: Tue, 17 Jan 2023 20:08:02 +0000 Subject: [PATCH 598/998] Revert "Change averagingWindowMs to int" Revert submission 20886209-qfi Reason for revert: Build Break. Bug: 265823012 Reverted changes: /q/submissionid:20886209-qfi Change-Id: I950e86978d618143ec54812ac9236e4a18fd1ca4 --- .../hardware/radio/data/ApnAuthType.aidl | 8 +- .../android/hardware/radio/data/ApnTypes.aidl | 30 +- .../radio/data/DataCallFailCause.aidl | 678 +++++++++--------- .../hardware/radio/data/DataProfileInfo.aidl | 2 +- .../radio/data/DataThrottlingAction.aidl | 8 +- .../hardware/radio/data/LinkAddress.aidl | 2 +- .../android/hardware/radio/data/NrQos.aidl | 7 +- .../hardware/radio/data/PdpProtocolType.aidl | 2 +- .../hardware/radio/data/QosFilter.aidl | 2 +- .../radio/data/RouteSelectionDescriptor.aidl | 2 +- .../android/hardware/radio/data/NrQos.aidl | 15 +- .../compat/libradiocompat/data/structs.cpp | 4 +- 12 files changed, 377 insertions(+), 383 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnAuthType.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnAuthType.aidl index a33ad6e338..86272c22eb 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnAuthType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnAuthType.aidl @@ -34,8 +34,8 @@ package android.hardware.radio.data; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ApnAuthType { - NO_PAP_NO_CHAP, - PAP_NO_CHAP, - NO_PAP_CHAP, - PAP_CHAP, + NO_PAP_NO_CHAP = 0, + PAP_NO_CHAP = 1, + NO_PAP_CHAP = 2, + PAP_CHAP = 3, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnTypes.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnTypes.aidl index 45d22c853f..1518a5749e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnTypes.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnTypes.aidl @@ -35,19 +35,19 @@ package android.hardware.radio.data; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ApnTypes { NONE = 0, - DEFAULT = (1 << 0), - MMS = (1 << 1), - SUPL = (1 << 2), - DUN = (1 << 3), - HIPRI = (1 << 4), - FOTA = (1 << 5), - IMS = (1 << 6), - CBS = (1 << 7), - IA = (1 << 8), - EMERGENCY = (1 << 9), - MCX = (1 << 10), - XCAP = (1 << 11), - VSIM = (1 << 12), - BIP = (1 << 13), - ENTERPRISE = (1 << 14), + DEFAULT = 1, + MMS = 2, + SUPL = 4, + DUN = 8, + HIPRI = 16, + FOTA = 32, + IMS = 64, + CBS = 128, + IA = 256, + EMERGENCY = 512, + MCX = 1024, + XCAP = 2048, + VSIM = 4096, + BIP = 8192, + ENTERPRISE = 16384, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl index 0a5f8dd01d..d7d6983236 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl @@ -35,343 +35,343 @@ package android.hardware.radio.data; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum DataCallFailCause { NONE = 0, - OPERATOR_BARRED = 0x08, - NAS_SIGNALLING = 0x0E, - INSUFFICIENT_RESOURCES = 0x1A, - MISSING_UNKNOWN_APN = 0x1B, - UNKNOWN_PDP_ADDRESS_TYPE = 0x1C, - USER_AUTHENTICATION = 0x1D, - ACTIVATION_REJECT_GGSN = 0x1E, - ACTIVATION_REJECT_UNSPECIFIED = 0x1F, - SERVICE_OPTION_NOT_SUPPORTED = 0x20, - SERVICE_OPTION_NOT_SUBSCRIBED = 0x21, - SERVICE_OPTION_OUT_OF_ORDER = 0x22, - NSAPI_IN_USE = 0x23, - REGULAR_DEACTIVATION = 0x24, - QOS_NOT_ACCEPTED = 0x25, - NETWORK_FAILURE = 0x26, - UMTS_REACTIVATION_REQ = 0x27, - FEATURE_NOT_SUPP = 0x28, - TFT_SEMANTIC_ERROR = 0x29, - TFT_SYTAX_ERROR = 0x2A, - UNKNOWN_PDP_CONTEXT = 0x2B, - FILTER_SEMANTIC_ERROR = 0x2C, - FILTER_SYTAX_ERROR = 0x2D, - PDP_WITHOUT_ACTIVE_TFT = 0x2E, - ONLY_IPV4_ALLOWED = 0x32, - ONLY_IPV6_ALLOWED = 0x33, - ONLY_SINGLE_BEARER_ALLOWED = 0x34, - ESM_INFO_NOT_RECEIVED = 0x35, - PDN_CONN_DOES_NOT_EXIST = 0x36, - MULTI_CONN_TO_SAME_PDN_NOT_ALLOWED = 0x37, - MAX_ACTIVE_PDP_CONTEXT_REACHED = 0x41, - UNSUPPORTED_APN_IN_CURRENT_PLMN = 0x42, - INVALID_TRANSACTION_ID = 0x51, - MESSAGE_INCORRECT_SEMANTIC = 0x5F, - INVALID_MANDATORY_INFO = 0x60, - MESSAGE_TYPE_UNSUPPORTED = 0x61, - MSG_TYPE_NONCOMPATIBLE_STATE = 0x62, - UNKNOWN_INFO_ELEMENT = 0x63, - CONDITIONAL_IE_ERROR = 0x64, - MSG_AND_PROTOCOL_STATE_UNCOMPATIBLE = 0x65, - PROTOCOL_ERRORS = 0x6F, - APN_TYPE_CONFLICT = 0x70, - INVALID_PCSCF_ADDR = 0x71, - INTERNAL_CALL_PREEMPT_BY_HIGH_PRIO_APN = 0x72, - EMM_ACCESS_BARRED = 0x73, - EMERGENCY_IFACE_ONLY = 0x74, - IFACE_MISMATCH = 0x75, - COMPANION_IFACE_IN_USE = 0x76, - IP_ADDRESS_MISMATCH = 0x77, - IFACE_AND_POL_FAMILY_MISMATCH = 0x78, - EMM_ACCESS_BARRED_INFINITE_RETRY = 0x79, - AUTH_FAILURE_ON_EMERGENCY_CALL = 0x7A, - OEM_DCFAILCAUSE_1 = 0x1001, - OEM_DCFAILCAUSE_2 = 0x1002, - OEM_DCFAILCAUSE_3 = 0x1003, - OEM_DCFAILCAUSE_4 = 0x1004, - OEM_DCFAILCAUSE_5 = 0x1005, - OEM_DCFAILCAUSE_6 = 0x1006, - OEM_DCFAILCAUSE_7 = 0x1007, - OEM_DCFAILCAUSE_8 = 0x1008, - OEM_DCFAILCAUSE_9 = 0x1009, - OEM_DCFAILCAUSE_10 = 0x100A, - OEM_DCFAILCAUSE_11 = 0x100B, - OEM_DCFAILCAUSE_12 = 0x100C, - OEM_DCFAILCAUSE_13 = 0x100D, - OEM_DCFAILCAUSE_14 = 0x100E, - OEM_DCFAILCAUSE_15 = 0x100F, - VOICE_REGISTRATION_FAIL = (-1), - DATA_REGISTRATION_FAIL = (-2), - SIGNAL_LOST = (-3), - PREF_RADIO_TECH_CHANGED = (-4), - RADIO_POWER_OFF = (-5), - TETHERED_CALL_ACTIVE = (-6), - ERROR_UNSPECIFIED = 0xffff, - LLC_SNDCP = 0x19, - ACTIVATION_REJECTED_BCM_VIOLATION = 0x30, - COLLISION_WITH_NETWORK_INITIATED_REQUEST = 0x38, - ONLY_IPV4V6_ALLOWED = 0x39, - ONLY_NON_IP_ALLOWED = 0x3A, - UNSUPPORTED_QCI_VALUE = 0x3B, - BEARER_HANDLING_NOT_SUPPORTED = 0x3C, - INVALID_DNS_ADDR = 0x7B, - INVALID_PCSCF_OR_DNS_ADDRESS = 0x7C, - CALL_PREEMPT_BY_EMERGENCY_APN = 0x7F, - UE_INITIATED_DETACH_OR_DISCONNECT = 0x80, - MIP_FA_REASON_UNSPECIFIED = 0x7D0, - MIP_FA_ADMIN_PROHIBITED = 0x7D1, - MIP_FA_INSUFFICIENT_RESOURCES = 0x7D2, - MIP_FA_MOBILE_NODE_AUTHENTICATION_FAILURE = 0x7D3, - MIP_FA_HOME_AGENT_AUTHENTICATION_FAILURE = 0x7D4, - MIP_FA_REQUESTED_LIFETIME_TOO_LONG = 0x7D5, - MIP_FA_MALFORMED_REQUEST = 0x7D6, - MIP_FA_MALFORMED_REPLY = 0x7D7, - MIP_FA_ENCAPSULATION_UNAVAILABLE = 0x7D8, - MIP_FA_VJ_HEADER_COMPRESSION_UNAVAILABLE = 0x7D9, - MIP_FA_REVERSE_TUNNEL_UNAVAILABLE = 0x7DA, - MIP_FA_REVERSE_TUNNEL_IS_MANDATORY = 0x7DB, - MIP_FA_DELIVERY_STYLE_NOT_SUPPORTED = 0x7DC, - MIP_FA_MISSING_NAI = 0x7DD, - MIP_FA_MISSING_HOME_AGENT = 0x7DE, - MIP_FA_MISSING_HOME_ADDRESS = 0x7DF, - MIP_FA_UNKNOWN_CHALLENGE = 0x7E0, - MIP_FA_MISSING_CHALLENGE = 0x7E1, - MIP_FA_STALE_CHALLENGE = 0x7E2, - MIP_HA_REASON_UNSPECIFIED = 0x7E3, - MIP_HA_ADMIN_PROHIBITED = 0x7E4, - MIP_HA_INSUFFICIENT_RESOURCES = 0x7E5, - MIP_HA_MOBILE_NODE_AUTHENTICATION_FAILURE = 0x7E6, - MIP_HA_FOREIGN_AGENT_AUTHENTICATION_FAILURE = 0x7E7, - MIP_HA_REGISTRATION_ID_MISMATCH = 0x7E8, - MIP_HA_MALFORMED_REQUEST = 0x7E9, - MIP_HA_UNKNOWN_HOME_AGENT_ADDRESS = 0x7EA, - MIP_HA_REVERSE_TUNNEL_UNAVAILABLE = 0x7EB, - MIP_HA_REVERSE_TUNNEL_IS_MANDATORY = 0x7EC, - MIP_HA_ENCAPSULATION_UNAVAILABLE = 0x7ED, - CLOSE_IN_PROGRESS = 0x7EE, - NETWORK_INITIATED_TERMINATION = 0x7EF, - MODEM_APP_PREEMPTED = 0x7F0, - PDN_IPV4_CALL_DISALLOWED = 0x7F1, - PDN_IPV4_CALL_THROTTLED = 0x7F2, - PDN_IPV6_CALL_DISALLOWED = 0x7F3, - PDN_IPV6_CALL_THROTTLED = 0x7F4, - MODEM_RESTART = 0x7F5, - PDP_PPP_NOT_SUPPORTED = 0x7F6, - UNPREFERRED_RAT = 0x7F7, - PHYSICAL_LINK_CLOSE_IN_PROGRESS = 0x7F8, - APN_PENDING_HANDOVER = 0x7F9, - PROFILE_BEARER_INCOMPATIBLE = 0x7FA, - SIM_CARD_CHANGED = 0x7FB, - LOW_POWER_MODE_OR_POWERING_DOWN = 0x7FC, - APN_DISABLED = 0x7FD, - MAX_PPP_INACTIVITY_TIMER_EXPIRED = 0x7FE, - IPV6_ADDRESS_TRANSFER_FAILED = 0x7FF, - TRAT_SWAP_FAILED = 0x800, - EHRPD_TO_HRPD_FALLBACK = 0x801, - MIP_CONFIG_FAILURE = 0x802, - PDN_INACTIVITY_TIMER_EXPIRED = 0x803, - MAX_IPV4_CONNECTIONS = 0x804, - MAX_IPV6_CONNECTIONS = 0x805, - APN_MISMATCH = 0x806, - IP_VERSION_MISMATCH = 0x807, - DUN_CALL_DISALLOWED = 0x808, - INTERNAL_EPC_NONEPC_TRANSITION = 0x809, - INTERFACE_IN_USE = 0x80A, - APN_DISALLOWED_ON_ROAMING = 0x80B, - APN_PARAMETERS_CHANGED = 0x80C, - NULL_APN_DISALLOWED = 0x80D, - THERMAL_MITIGATION = 0x80E, - DATA_SETTINGS_DISABLED = 0x80F, - DATA_ROAMING_SETTINGS_DISABLED = 0x810, - DDS_SWITCHED = 0x811, - FORBIDDEN_APN_NAME = 0x812, - DDS_SWITCH_IN_PROGRESS = 0x813, - CALL_DISALLOWED_IN_ROAMING = 0x814, - NON_IP_NOT_SUPPORTED = 0x815, - PDN_NON_IP_CALL_THROTTLED = 0x816, - PDN_NON_IP_CALL_DISALLOWED = 0x817, - CDMA_LOCK = 0x818, - CDMA_INTERCEPT = 0x819, - CDMA_REORDER = 0x81A, - CDMA_RELEASE_DUE_TO_SO_REJECTION = 0x81B, - CDMA_INCOMING_CALL = 0x81C, - CDMA_ALERT_STOP = 0x81D, - CHANNEL_ACQUISITION_FAILURE = 0x81E, - MAX_ACCESS_PROBE = 0x81F, - CONCURRENT_SERVICE_NOT_SUPPORTED_BY_BASE_STATION = 0x820, - NO_RESPONSE_FROM_BASE_STATION = 0x821, - REJECTED_BY_BASE_STATION = 0x822, - CONCURRENT_SERVICES_INCOMPATIBLE = 0x823, - NO_CDMA_SERVICE = 0x824, - RUIM_NOT_PRESENT = 0x825, - CDMA_RETRY_ORDER = 0x826, - ACCESS_BLOCK = 0x827, - ACCESS_BLOCK_ALL = 0x828, - IS707B_MAX_ACCESS_PROBES = 0x829, - THERMAL_EMERGENCY = 0x82A, - CONCURRENT_SERVICES_NOT_ALLOWED = 0x82B, - INCOMING_CALL_REJECTED = 0x82C, - NO_SERVICE_ON_GATEWAY = 0x82D, - NO_GPRS_CONTEXT = 0x82E, - ILLEGAL_MS = 0x82F, - ILLEGAL_ME = 0x830, - GPRS_SERVICES_AND_NON_GPRS_SERVICES_NOT_ALLOWED = 0x831, - GPRS_SERVICES_NOT_ALLOWED = 0x832, - MS_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK = 0x833, - IMPLICITLY_DETACHED = 0x834, - PLMN_NOT_ALLOWED = 0x835, - LOCATION_AREA_NOT_ALLOWED = 0x836, - GPRS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN = 0x837, - PDP_DUPLICATE = 0x838, - UE_RAT_CHANGE = 0x839, - CONGESTION = 0x83A, - NO_PDP_CONTEXT_ACTIVATED = 0x83B, - ACCESS_CLASS_DSAC_REJECTION = 0x83C, - PDP_ACTIVATE_MAX_RETRY_FAILED = 0x83D, - RADIO_ACCESS_BEARER_FAILURE = 0x83E, - ESM_UNKNOWN_EPS_BEARER_CONTEXT = 0x83F, - DRB_RELEASED_BY_RRC = 0x840, - CONNECTION_RELEASED = 0x841, - EMM_DETACHED = 0x842, - EMM_ATTACH_FAILED = 0x843, - EMM_ATTACH_STARTED = 0x844, - LTE_NAS_SERVICE_REQUEST_FAILED = 0x845, - DUPLICATE_BEARER_ID = 0x846, - ESM_COLLISION_SCENARIOS = 0x847, - ESM_BEARER_DEACTIVATED_TO_SYNC_WITH_NETWORK = 0x848, - ESM_NW_ACTIVATED_DED_BEARER_WITH_ID_OF_DEF_BEARER = 0x849, - ESM_BAD_OTA_MESSAGE = 0x84A, - ESM_DOWNLOAD_SERVER_REJECTED_THE_CALL = 0x84B, - ESM_CONTEXT_TRANSFERRED_DUE_TO_IRAT = 0x84C, - DS_EXPLICIT_DEACTIVATION = 0x84D, - ESM_LOCAL_CAUSE_NONE = 0x84E, - LTE_THROTTLING_NOT_REQUIRED = 0x84F, - ACCESS_CONTROL_LIST_CHECK_FAILURE = 0x850, - SERVICE_NOT_ALLOWED_ON_PLMN = 0x851, - EMM_T3417_EXPIRED = 0x852, - EMM_T3417_EXT_EXPIRED = 0x853, - RRC_UPLINK_DATA_TRANSMISSION_FAILURE = 0x854, - RRC_UPLINK_DELIVERY_FAILED_DUE_TO_HANDOVER = 0x855, - RRC_UPLINK_CONNECTION_RELEASE = 0x856, - RRC_UPLINK_RADIO_LINK_FAILURE = 0x857, - RRC_UPLINK_ERROR_REQUEST_FROM_NAS = 0x858, - RRC_CONNECTION_ACCESS_STRATUM_FAILURE = 0x859, - RRC_CONNECTION_ANOTHER_PROCEDURE_IN_PROGRESS = 0x85A, - RRC_CONNECTION_ACCESS_BARRED = 0x85B, - RRC_CONNECTION_CELL_RESELECTION = 0x85C, - RRC_CONNECTION_CONFIG_FAILURE = 0x85D, - RRC_CONNECTION_TIMER_EXPIRED = 0x85E, - RRC_CONNECTION_LINK_FAILURE = 0x85F, - RRC_CONNECTION_CELL_NOT_CAMPED = 0x860, - RRC_CONNECTION_SYSTEM_INTERVAL_FAILURE = 0x861, - RRC_CONNECTION_REJECT_BY_NETWORK = 0x862, - RRC_CONNECTION_NORMAL_RELEASE = 0x863, - RRC_CONNECTION_RADIO_LINK_FAILURE = 0x864, - RRC_CONNECTION_REESTABLISHMENT_FAILURE = 0x865, - RRC_CONNECTION_OUT_OF_SERVICE_DURING_CELL_REGISTER = 0x866, - RRC_CONNECTION_ABORT_REQUEST = 0x867, - RRC_CONNECTION_SYSTEM_INFORMATION_BLOCK_READ_ERROR = 0x868, - NETWORK_INITIATED_DETACH_WITH_AUTO_REATTACH = 0x869, - NETWORK_INITIATED_DETACH_NO_AUTO_REATTACH = 0x86A, - ESM_PROCEDURE_TIME_OUT = 0x86B, - INVALID_CONNECTION_ID = 0x86C, - MAXIMIUM_NSAPIS_EXCEEDED = 0x86D, - INVALID_PRIMARY_NSAPI = 0x86E, - CANNOT_ENCODE_OTA_MESSAGE = 0x86F, - RADIO_ACCESS_BEARER_SETUP_FAILURE = 0x870, - PDP_ESTABLISH_TIMEOUT_EXPIRED = 0x871, - PDP_MODIFY_TIMEOUT_EXPIRED = 0x872, - PDP_INACTIVE_TIMEOUT_EXPIRED = 0x873, - PDP_LOWERLAYER_ERROR = 0x874, - PDP_MODIFY_COLLISION = 0x875, - MAXINUM_SIZE_OF_L2_MESSAGE_EXCEEDED = 0x876, - NAS_REQUEST_REJECTED_BY_NETWORK = 0x877, - RRC_CONNECTION_INVALID_REQUEST = 0x878, - RRC_CONNECTION_TRACKING_AREA_ID_CHANGED = 0x879, - RRC_CONNECTION_RF_UNAVAILABLE = 0x87A, - RRC_CONNECTION_ABORTED_DUE_TO_IRAT_CHANGE = 0x87B, - RRC_CONNECTION_RELEASED_SECURITY_NOT_ACTIVE = 0x87C, - RRC_CONNECTION_ABORTED_AFTER_HANDOVER = 0x87D, - RRC_CONNECTION_ABORTED_AFTER_IRAT_CELL_CHANGE = 0x87E, - RRC_CONNECTION_ABORTED_DURING_IRAT_CELL_CHANGE = 0x87F, - IMSI_UNKNOWN_IN_HOME_SUBSCRIBER_SERVER = 0x880, - IMEI_NOT_ACCEPTED = 0x881, - EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED = 0x882, - EPS_SERVICES_NOT_ALLOWED_IN_PLMN = 0x883, - MSC_TEMPORARILY_NOT_REACHABLE = 0x884, - CS_DOMAIN_NOT_AVAILABLE = 0x885, - ESM_FAILURE = 0x886, - MAC_FAILURE = 0x887, - SYNCHRONIZATION_FAILURE = 0x888, - UE_SECURITY_CAPABILITIES_MISMATCH = 0x889, - SECURITY_MODE_REJECTED = 0x88A, - UNACCEPTABLE_NON_EPS_AUTHENTICATION = 0x88B, - CS_FALLBACK_CALL_ESTABLISHMENT_NOT_ALLOWED = 0x88C, - NO_EPS_BEARER_CONTEXT_ACTIVATED = 0x88D, - INVALID_EMM_STATE = 0x88E, - NAS_LAYER_FAILURE = 0x88F, - MULTIPLE_PDP_CALL_NOT_ALLOWED = 0x890, - EMBMS_NOT_ENABLED = 0x891, - IRAT_HANDOVER_FAILED = 0x892, - EMBMS_REGULAR_DEACTIVATION = 0x893, - TEST_LOOPBACK_REGULAR_DEACTIVATION = 0x894, - LOWER_LAYER_REGISTRATION_FAILURE = 0x895, - DATA_PLAN_EXPIRED = 0x896, - UMTS_HANDOVER_TO_IWLAN = 0x897, - EVDO_CONNECTION_DENY_BY_GENERAL_OR_NETWORK_BUSY = 0x898, - EVDO_CONNECTION_DENY_BY_BILLING_OR_AUTHENTICATION_FAILURE = 0x899, - EVDO_HDR_CHANGED = 0x89A, - EVDO_HDR_EXITED = 0x89B, - EVDO_HDR_NO_SESSION = 0x89C, - EVDO_USING_GPS_FIX_INSTEAD_OF_HDR_CALL = 0x89D, - EVDO_HDR_CONNECTION_SETUP_TIMEOUT = 0x89E, - FAILED_TO_ACQUIRE_COLOCATED_HDR = 0x89F, - OTASP_COMMIT_IN_PROGRESS = 0x8A0, - NO_HYBRID_HDR_SERVICE = 0x8A1, - HDR_NO_LOCK_GRANTED = 0x8A2, - DBM_OR_SMS_IN_PROGRESS = 0x8A3, - HDR_FADE = 0x8A4, - HDR_ACCESS_FAILURE = 0x8A5, - UNSUPPORTED_1X_PREV = 0x8A6, - LOCAL_END = 0x8A7, - NO_SERVICE = 0x8A8, - FADE = 0x8A9, - NORMAL_RELEASE = 0x8AA, - ACCESS_ATTEMPT_ALREADY_IN_PROGRESS = 0x8AB, - REDIRECTION_OR_HANDOFF_IN_PROGRESS = 0x8AC, - EMERGENCY_MODE = 0x8AD, - PHONE_IN_USE = 0x8AE, - INVALID_MODE = 0x8AF, - INVALID_SIM_STATE = 0x8B0, - NO_COLLOCATED_HDR = 0x8B1, - UE_IS_ENTERING_POWERSAVE_MODE = 0x8B2, - DUAL_SWITCH = 0x8B3, - PPP_TIMEOUT = 0x8B4, - PPP_AUTH_FAILURE = 0x8B5, - PPP_OPTION_MISMATCH = 0x8B6, - PPP_PAP_FAILURE = 0x8B7, - PPP_CHAP_FAILURE = 0x8B8, - PPP_CLOSE_IN_PROGRESS = 0x8B9, - LIMITED_TO_IPV4 = 0x8BA, - LIMITED_TO_IPV6 = 0x8BB, - VSNCP_TIMEOUT = 0x8BC, - VSNCP_GEN_ERROR = 0x8BD, - VSNCP_APN_UNAUTHORIZED = 0x8BE, - VSNCP_PDN_LIMIT_EXCEEDED = 0x8BF, - VSNCP_NO_PDN_GATEWAY_ADDRESS = 0x8C0, - VSNCP_PDN_GATEWAY_UNREACHABLE = 0x8C1, - VSNCP_PDN_GATEWAY_REJECT = 0x8C2, - VSNCP_INSUFFICIENT_PARAMETERS = 0x8C3, - VSNCP_RESOURCE_UNAVAILABLE = 0x8C4, - VSNCP_ADMINISTRATIVELY_PROHIBITED = 0x8C5, - VSNCP_PDN_ID_IN_USE = 0x8C6, - VSNCP_SUBSCRIBER_LIMITATION = 0x8C7, - VSNCP_PDN_EXISTS_FOR_THIS_APN = 0x8C8, - VSNCP_RECONNECT_NOT_ALLOWED = 0x8C9, - IPV6_PREFIX_UNAVAILABLE = 0x8CA, - HANDOFF_PREFERENCE_CHANGED = 0x8CB, - SLICE_REJECTED = 0x8CC, - MATCH_ALL_RULE_NOT_ALLOWED = 0x8CD, - ALL_MATCHING_RULES_FAILED = 0x8CE, + OPERATOR_BARRED = 8, + NAS_SIGNALLING = 14, + INSUFFICIENT_RESOURCES = 26, + MISSING_UNKNOWN_APN = 27, + UNKNOWN_PDP_ADDRESS_TYPE = 28, + USER_AUTHENTICATION = 29, + ACTIVATION_REJECT_GGSN = 30, + ACTIVATION_REJECT_UNSPECIFIED = 31, + SERVICE_OPTION_NOT_SUPPORTED = 32, + SERVICE_OPTION_NOT_SUBSCRIBED = 33, + SERVICE_OPTION_OUT_OF_ORDER = 34, + NSAPI_IN_USE = 35, + REGULAR_DEACTIVATION = 36, + QOS_NOT_ACCEPTED = 37, + NETWORK_FAILURE = 38, + UMTS_REACTIVATION_REQ = 39, + FEATURE_NOT_SUPP = 40, + TFT_SEMANTIC_ERROR = 41, + TFT_SYTAX_ERROR = 42, + UNKNOWN_PDP_CONTEXT = 43, + FILTER_SEMANTIC_ERROR = 44, + FILTER_SYTAX_ERROR = 45, + PDP_WITHOUT_ACTIVE_TFT = 46, + ONLY_IPV4_ALLOWED = 50, + ONLY_IPV6_ALLOWED = 51, + ONLY_SINGLE_BEARER_ALLOWED = 52, + ESM_INFO_NOT_RECEIVED = 53, + PDN_CONN_DOES_NOT_EXIST = 54, + MULTI_CONN_TO_SAME_PDN_NOT_ALLOWED = 55, + MAX_ACTIVE_PDP_CONTEXT_REACHED = 65, + UNSUPPORTED_APN_IN_CURRENT_PLMN = 66, + INVALID_TRANSACTION_ID = 81, + MESSAGE_INCORRECT_SEMANTIC = 95, + INVALID_MANDATORY_INFO = 96, + MESSAGE_TYPE_UNSUPPORTED = 97, + MSG_TYPE_NONCOMPATIBLE_STATE = 98, + UNKNOWN_INFO_ELEMENT = 99, + CONDITIONAL_IE_ERROR = 100, + MSG_AND_PROTOCOL_STATE_UNCOMPATIBLE = 101, + PROTOCOL_ERRORS = 111, + APN_TYPE_CONFLICT = 112, + INVALID_PCSCF_ADDR = 113, + INTERNAL_CALL_PREEMPT_BY_HIGH_PRIO_APN = 114, + EMM_ACCESS_BARRED = 115, + EMERGENCY_IFACE_ONLY = 116, + IFACE_MISMATCH = 117, + COMPANION_IFACE_IN_USE = 118, + IP_ADDRESS_MISMATCH = 119, + IFACE_AND_POL_FAMILY_MISMATCH = 120, + EMM_ACCESS_BARRED_INFINITE_RETRY = 121, + AUTH_FAILURE_ON_EMERGENCY_CALL = 122, + OEM_DCFAILCAUSE_1 = 4097, + OEM_DCFAILCAUSE_2 = 4098, + OEM_DCFAILCAUSE_3 = 4099, + OEM_DCFAILCAUSE_4 = 4100, + OEM_DCFAILCAUSE_5 = 4101, + OEM_DCFAILCAUSE_6 = 4102, + OEM_DCFAILCAUSE_7 = 4103, + OEM_DCFAILCAUSE_8 = 4104, + OEM_DCFAILCAUSE_9 = 4105, + OEM_DCFAILCAUSE_10 = 4106, + OEM_DCFAILCAUSE_11 = 4107, + OEM_DCFAILCAUSE_12 = 4108, + OEM_DCFAILCAUSE_13 = 4109, + OEM_DCFAILCAUSE_14 = 4110, + OEM_DCFAILCAUSE_15 = 4111, + VOICE_REGISTRATION_FAIL = -1, + DATA_REGISTRATION_FAIL = -2, + SIGNAL_LOST = -3, + PREF_RADIO_TECH_CHANGED = -4, + RADIO_POWER_OFF = -5, + TETHERED_CALL_ACTIVE = -6, + ERROR_UNSPECIFIED = 65535, + LLC_SNDCP = 25, + ACTIVATION_REJECTED_BCM_VIOLATION = 48, + COLLISION_WITH_NETWORK_INITIATED_REQUEST = 56, + ONLY_IPV4V6_ALLOWED = 57, + ONLY_NON_IP_ALLOWED = 58, + UNSUPPORTED_QCI_VALUE = 59, + BEARER_HANDLING_NOT_SUPPORTED = 60, + INVALID_DNS_ADDR = 123, + INVALID_PCSCF_OR_DNS_ADDRESS = 124, + CALL_PREEMPT_BY_EMERGENCY_APN = 127, + UE_INITIATED_DETACH_OR_DISCONNECT = 128, + MIP_FA_REASON_UNSPECIFIED = 2000, + MIP_FA_ADMIN_PROHIBITED = 2001, + MIP_FA_INSUFFICIENT_RESOURCES = 2002, + MIP_FA_MOBILE_NODE_AUTHENTICATION_FAILURE = 2003, + MIP_FA_HOME_AGENT_AUTHENTICATION_FAILURE = 2004, + MIP_FA_REQUESTED_LIFETIME_TOO_LONG = 2005, + MIP_FA_MALFORMED_REQUEST = 2006, + MIP_FA_MALFORMED_REPLY = 2007, + MIP_FA_ENCAPSULATION_UNAVAILABLE = 2008, + MIP_FA_VJ_HEADER_COMPRESSION_UNAVAILABLE = 2009, + MIP_FA_REVERSE_TUNNEL_UNAVAILABLE = 2010, + MIP_FA_REVERSE_TUNNEL_IS_MANDATORY = 2011, + MIP_FA_DELIVERY_STYLE_NOT_SUPPORTED = 2012, + MIP_FA_MISSING_NAI = 2013, + MIP_FA_MISSING_HOME_AGENT = 2014, + MIP_FA_MISSING_HOME_ADDRESS = 2015, + MIP_FA_UNKNOWN_CHALLENGE = 2016, + MIP_FA_MISSING_CHALLENGE = 2017, + MIP_FA_STALE_CHALLENGE = 2018, + MIP_HA_REASON_UNSPECIFIED = 2019, + MIP_HA_ADMIN_PROHIBITED = 2020, + MIP_HA_INSUFFICIENT_RESOURCES = 2021, + MIP_HA_MOBILE_NODE_AUTHENTICATION_FAILURE = 2022, + MIP_HA_FOREIGN_AGENT_AUTHENTICATION_FAILURE = 2023, + MIP_HA_REGISTRATION_ID_MISMATCH = 2024, + MIP_HA_MALFORMED_REQUEST = 2025, + MIP_HA_UNKNOWN_HOME_AGENT_ADDRESS = 2026, + MIP_HA_REVERSE_TUNNEL_UNAVAILABLE = 2027, + MIP_HA_REVERSE_TUNNEL_IS_MANDATORY = 2028, + MIP_HA_ENCAPSULATION_UNAVAILABLE = 2029, + CLOSE_IN_PROGRESS = 2030, + NETWORK_INITIATED_TERMINATION = 2031, + MODEM_APP_PREEMPTED = 2032, + PDN_IPV4_CALL_DISALLOWED = 2033, + PDN_IPV4_CALL_THROTTLED = 2034, + PDN_IPV6_CALL_DISALLOWED = 2035, + PDN_IPV6_CALL_THROTTLED = 2036, + MODEM_RESTART = 2037, + PDP_PPP_NOT_SUPPORTED = 2038, + UNPREFERRED_RAT = 2039, + PHYSICAL_LINK_CLOSE_IN_PROGRESS = 2040, + APN_PENDING_HANDOVER = 2041, + PROFILE_BEARER_INCOMPATIBLE = 2042, + SIM_CARD_CHANGED = 2043, + LOW_POWER_MODE_OR_POWERING_DOWN = 2044, + APN_DISABLED = 2045, + MAX_PPP_INACTIVITY_TIMER_EXPIRED = 2046, + IPV6_ADDRESS_TRANSFER_FAILED = 2047, + TRAT_SWAP_FAILED = 2048, + EHRPD_TO_HRPD_FALLBACK = 2049, + MIP_CONFIG_FAILURE = 2050, + PDN_INACTIVITY_TIMER_EXPIRED = 2051, + MAX_IPV4_CONNECTIONS = 2052, + MAX_IPV6_CONNECTIONS = 2053, + APN_MISMATCH = 2054, + IP_VERSION_MISMATCH = 2055, + DUN_CALL_DISALLOWED = 2056, + INTERNAL_EPC_NONEPC_TRANSITION = 2057, + INTERFACE_IN_USE = 2058, + APN_DISALLOWED_ON_ROAMING = 2059, + APN_PARAMETERS_CHANGED = 2060, + NULL_APN_DISALLOWED = 2061, + THERMAL_MITIGATION = 2062, + DATA_SETTINGS_DISABLED = 2063, + DATA_ROAMING_SETTINGS_DISABLED = 2064, + DDS_SWITCHED = 2065, + FORBIDDEN_APN_NAME = 2066, + DDS_SWITCH_IN_PROGRESS = 2067, + CALL_DISALLOWED_IN_ROAMING = 2068, + NON_IP_NOT_SUPPORTED = 2069, + PDN_NON_IP_CALL_THROTTLED = 2070, + PDN_NON_IP_CALL_DISALLOWED = 2071, + CDMA_LOCK = 2072, + CDMA_INTERCEPT = 2073, + CDMA_REORDER = 2074, + CDMA_RELEASE_DUE_TO_SO_REJECTION = 2075, + CDMA_INCOMING_CALL = 2076, + CDMA_ALERT_STOP = 2077, + CHANNEL_ACQUISITION_FAILURE = 2078, + MAX_ACCESS_PROBE = 2079, + CONCURRENT_SERVICE_NOT_SUPPORTED_BY_BASE_STATION = 2080, + NO_RESPONSE_FROM_BASE_STATION = 2081, + REJECTED_BY_BASE_STATION = 2082, + CONCURRENT_SERVICES_INCOMPATIBLE = 2083, + NO_CDMA_SERVICE = 2084, + RUIM_NOT_PRESENT = 2085, + CDMA_RETRY_ORDER = 2086, + ACCESS_BLOCK = 2087, + ACCESS_BLOCK_ALL = 2088, + IS707B_MAX_ACCESS_PROBES = 2089, + THERMAL_EMERGENCY = 2090, + CONCURRENT_SERVICES_NOT_ALLOWED = 2091, + INCOMING_CALL_REJECTED = 2092, + NO_SERVICE_ON_GATEWAY = 2093, + NO_GPRS_CONTEXT = 2094, + ILLEGAL_MS = 2095, + ILLEGAL_ME = 2096, + GPRS_SERVICES_AND_NON_GPRS_SERVICES_NOT_ALLOWED = 2097, + GPRS_SERVICES_NOT_ALLOWED = 2098, + MS_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK = 2099, + IMPLICITLY_DETACHED = 2100, + PLMN_NOT_ALLOWED = 2101, + LOCATION_AREA_NOT_ALLOWED = 2102, + GPRS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN = 2103, + PDP_DUPLICATE = 2104, + UE_RAT_CHANGE = 2105, + CONGESTION = 2106, + NO_PDP_CONTEXT_ACTIVATED = 2107, + ACCESS_CLASS_DSAC_REJECTION = 2108, + PDP_ACTIVATE_MAX_RETRY_FAILED = 2109, + RADIO_ACCESS_BEARER_FAILURE = 2110, + ESM_UNKNOWN_EPS_BEARER_CONTEXT = 2111, + DRB_RELEASED_BY_RRC = 2112, + CONNECTION_RELEASED = 2113, + EMM_DETACHED = 2114, + EMM_ATTACH_FAILED = 2115, + EMM_ATTACH_STARTED = 2116, + LTE_NAS_SERVICE_REQUEST_FAILED = 2117, + DUPLICATE_BEARER_ID = 2118, + ESM_COLLISION_SCENARIOS = 2119, + ESM_BEARER_DEACTIVATED_TO_SYNC_WITH_NETWORK = 2120, + ESM_NW_ACTIVATED_DED_BEARER_WITH_ID_OF_DEF_BEARER = 2121, + ESM_BAD_OTA_MESSAGE = 2122, + ESM_DOWNLOAD_SERVER_REJECTED_THE_CALL = 2123, + ESM_CONTEXT_TRANSFERRED_DUE_TO_IRAT = 2124, + DS_EXPLICIT_DEACTIVATION = 2125, + ESM_LOCAL_CAUSE_NONE = 2126, + LTE_THROTTLING_NOT_REQUIRED = 2127, + ACCESS_CONTROL_LIST_CHECK_FAILURE = 2128, + SERVICE_NOT_ALLOWED_ON_PLMN = 2129, + EMM_T3417_EXPIRED = 2130, + EMM_T3417_EXT_EXPIRED = 2131, + RRC_UPLINK_DATA_TRANSMISSION_FAILURE = 2132, + RRC_UPLINK_DELIVERY_FAILED_DUE_TO_HANDOVER = 2133, + RRC_UPLINK_CONNECTION_RELEASE = 2134, + RRC_UPLINK_RADIO_LINK_FAILURE = 2135, + RRC_UPLINK_ERROR_REQUEST_FROM_NAS = 2136, + RRC_CONNECTION_ACCESS_STRATUM_FAILURE = 2137, + RRC_CONNECTION_ANOTHER_PROCEDURE_IN_PROGRESS = 2138, + RRC_CONNECTION_ACCESS_BARRED = 2139, + RRC_CONNECTION_CELL_RESELECTION = 2140, + RRC_CONNECTION_CONFIG_FAILURE = 2141, + RRC_CONNECTION_TIMER_EXPIRED = 2142, + RRC_CONNECTION_LINK_FAILURE = 2143, + RRC_CONNECTION_CELL_NOT_CAMPED = 2144, + RRC_CONNECTION_SYSTEM_INTERVAL_FAILURE = 2145, + RRC_CONNECTION_REJECT_BY_NETWORK = 2146, + RRC_CONNECTION_NORMAL_RELEASE = 2147, + RRC_CONNECTION_RADIO_LINK_FAILURE = 2148, + RRC_CONNECTION_REESTABLISHMENT_FAILURE = 2149, + RRC_CONNECTION_OUT_OF_SERVICE_DURING_CELL_REGISTER = 2150, + RRC_CONNECTION_ABORT_REQUEST = 2151, + RRC_CONNECTION_SYSTEM_INFORMATION_BLOCK_READ_ERROR = 2152, + NETWORK_INITIATED_DETACH_WITH_AUTO_REATTACH = 2153, + NETWORK_INITIATED_DETACH_NO_AUTO_REATTACH = 2154, + ESM_PROCEDURE_TIME_OUT = 2155, + INVALID_CONNECTION_ID = 2156, + MAXIMIUM_NSAPIS_EXCEEDED = 2157, + INVALID_PRIMARY_NSAPI = 2158, + CANNOT_ENCODE_OTA_MESSAGE = 2159, + RADIO_ACCESS_BEARER_SETUP_FAILURE = 2160, + PDP_ESTABLISH_TIMEOUT_EXPIRED = 2161, + PDP_MODIFY_TIMEOUT_EXPIRED = 2162, + PDP_INACTIVE_TIMEOUT_EXPIRED = 2163, + PDP_LOWERLAYER_ERROR = 2164, + PDP_MODIFY_COLLISION = 2165, + MAXINUM_SIZE_OF_L2_MESSAGE_EXCEEDED = 2166, + NAS_REQUEST_REJECTED_BY_NETWORK = 2167, + RRC_CONNECTION_INVALID_REQUEST = 2168, + RRC_CONNECTION_TRACKING_AREA_ID_CHANGED = 2169, + RRC_CONNECTION_RF_UNAVAILABLE = 2170, + RRC_CONNECTION_ABORTED_DUE_TO_IRAT_CHANGE = 2171, + RRC_CONNECTION_RELEASED_SECURITY_NOT_ACTIVE = 2172, + RRC_CONNECTION_ABORTED_AFTER_HANDOVER = 2173, + RRC_CONNECTION_ABORTED_AFTER_IRAT_CELL_CHANGE = 2174, + RRC_CONNECTION_ABORTED_DURING_IRAT_CELL_CHANGE = 2175, + IMSI_UNKNOWN_IN_HOME_SUBSCRIBER_SERVER = 2176, + IMEI_NOT_ACCEPTED = 2177, + EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED = 2178, + EPS_SERVICES_NOT_ALLOWED_IN_PLMN = 2179, + MSC_TEMPORARILY_NOT_REACHABLE = 2180, + CS_DOMAIN_NOT_AVAILABLE = 2181, + ESM_FAILURE = 2182, + MAC_FAILURE = 2183, + SYNCHRONIZATION_FAILURE = 2184, + UE_SECURITY_CAPABILITIES_MISMATCH = 2185, + SECURITY_MODE_REJECTED = 2186, + UNACCEPTABLE_NON_EPS_AUTHENTICATION = 2187, + CS_FALLBACK_CALL_ESTABLISHMENT_NOT_ALLOWED = 2188, + NO_EPS_BEARER_CONTEXT_ACTIVATED = 2189, + INVALID_EMM_STATE = 2190, + NAS_LAYER_FAILURE = 2191, + MULTIPLE_PDP_CALL_NOT_ALLOWED = 2192, + EMBMS_NOT_ENABLED = 2193, + IRAT_HANDOVER_FAILED = 2194, + EMBMS_REGULAR_DEACTIVATION = 2195, + TEST_LOOPBACK_REGULAR_DEACTIVATION = 2196, + LOWER_LAYER_REGISTRATION_FAILURE = 2197, + DATA_PLAN_EXPIRED = 2198, + UMTS_HANDOVER_TO_IWLAN = 2199, + EVDO_CONNECTION_DENY_BY_GENERAL_OR_NETWORK_BUSY = 2200, + EVDO_CONNECTION_DENY_BY_BILLING_OR_AUTHENTICATION_FAILURE = 2201, + EVDO_HDR_CHANGED = 2202, + EVDO_HDR_EXITED = 2203, + EVDO_HDR_NO_SESSION = 2204, + EVDO_USING_GPS_FIX_INSTEAD_OF_HDR_CALL = 2205, + EVDO_HDR_CONNECTION_SETUP_TIMEOUT = 2206, + FAILED_TO_ACQUIRE_COLOCATED_HDR = 2207, + OTASP_COMMIT_IN_PROGRESS = 2208, + NO_HYBRID_HDR_SERVICE = 2209, + HDR_NO_LOCK_GRANTED = 2210, + DBM_OR_SMS_IN_PROGRESS = 2211, + HDR_FADE = 2212, + HDR_ACCESS_FAILURE = 2213, + UNSUPPORTED_1X_PREV = 2214, + LOCAL_END = 2215, + NO_SERVICE = 2216, + FADE = 2217, + NORMAL_RELEASE = 2218, + ACCESS_ATTEMPT_ALREADY_IN_PROGRESS = 2219, + REDIRECTION_OR_HANDOFF_IN_PROGRESS = 2220, + EMERGENCY_MODE = 2221, + PHONE_IN_USE = 2222, + INVALID_MODE = 2223, + INVALID_SIM_STATE = 2224, + NO_COLLOCATED_HDR = 2225, + UE_IS_ENTERING_POWERSAVE_MODE = 2226, + DUAL_SWITCH = 2227, + PPP_TIMEOUT = 2228, + PPP_AUTH_FAILURE = 2229, + PPP_OPTION_MISMATCH = 2230, + PPP_PAP_FAILURE = 2231, + PPP_CHAP_FAILURE = 2232, + PPP_CLOSE_IN_PROGRESS = 2233, + LIMITED_TO_IPV4 = 2234, + LIMITED_TO_IPV6 = 2235, + VSNCP_TIMEOUT = 2236, + VSNCP_GEN_ERROR = 2237, + VSNCP_APN_UNAUTHORIZED = 2238, + VSNCP_PDN_LIMIT_EXCEEDED = 2239, + VSNCP_NO_PDN_GATEWAY_ADDRESS = 2240, + VSNCP_PDN_GATEWAY_UNREACHABLE = 2241, + VSNCP_PDN_GATEWAY_REJECT = 2242, + VSNCP_INSUFFICIENT_PARAMETERS = 2243, + VSNCP_RESOURCE_UNAVAILABLE = 2244, + VSNCP_ADMINISTRATIVELY_PROHIBITED = 2245, + VSNCP_PDN_ID_IN_USE = 2246, + VSNCP_SUBSCRIBER_LIMITATION = 2247, + VSNCP_PDN_EXISTS_FOR_THIS_APN = 2248, + VSNCP_RECONNECT_NOT_ALLOWED = 2249, + IPV6_PREFIX_UNAVAILABLE = 2250, + HANDOFF_PREFERENCE_CHANGED = 2251, + SLICE_REJECTED = 2252, + MATCH_ALL_RULE_NOT_ALLOWED = 2253, + ALL_MATCHING_RULES_FAILED = 2254, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataProfileInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataProfileInfo.aidl index 0136fa4a5a..16fada1d76 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataProfileInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataProfileInfo.aidl @@ -60,7 +60,7 @@ parcelable DataProfileInfo { const int ID_FOTA = 3; const int ID_CBS = 4; const int ID_OEM_BASE = 1000; - const int ID_INVALID = 0xFFFFFFFF; + const int ID_INVALID = -1; const int TYPE_COMMON = 0; const int TYPE_3GPP = 1; const int TYPE_3GPP2 = 2; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataThrottlingAction.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataThrottlingAction.aidl index e80a764046..4f976cd593 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataThrottlingAction.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataThrottlingAction.aidl @@ -34,8 +34,8 @@ package android.hardware.radio.data; @Backing(type="byte") @JavaDerive(toString=true) @VintfStability enum DataThrottlingAction { - NO_DATA_THROTTLING, - THROTTLE_SECONDARY_CARRIER, - THROTTLE_ANCHOR_CARRIER, - HOLD, + NO_DATA_THROTTLING = 0, + THROTTLE_SECONDARY_CARRIER = 1, + THROTTLE_ANCHOR_CARRIER = 2, + HOLD = 3, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/LinkAddress.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/LinkAddress.aidl index 77d637b9b9..48e646ea22 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/LinkAddress.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/LinkAddress.aidl @@ -39,5 +39,5 @@ parcelable LinkAddress { long deprecationTime; long expirationTime; const int ADDRESS_PROPERTY_NONE = 0; - const int ADDRESS_PROPERTY_DEPRECATED = 0x20; + const int ADDRESS_PROPERTY_DEPRECATED = 32; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/NrQos.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/NrQos.aidl index be859b79de..a0792c3f37 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/NrQos.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/NrQos.aidl @@ -37,13 +37,12 @@ parcelable NrQos { int fiveQi; android.hardware.radio.data.QosBandwidth downlink; android.hardware.radio.data.QosBandwidth uplink; - byte qfi; /** - * @deprecated use averagingWindowMillis; + * @deprecated use qosFlowIdentifier. */ + byte qfi; char averagingWindowMs; - int averagingWindowMillis = AVERAGING_WINDOW_UNKNOWN; + int qosFlowIdentifier; const byte FLOW_ID_RANGE_MIN = 1; const byte FLOW_ID_RANGE_MAX = 63; - const int AVERAGING_WINDOW_UNKNOWN = (-1); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PdpProtocolType.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PdpProtocolType.aidl index d1c4a62a31..9771e5ccc1 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PdpProtocolType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PdpProtocolType.aidl @@ -34,7 +34,7 @@ package android.hardware.radio.data; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum PdpProtocolType { - UNKNOWN = (-1), + UNKNOWN = -1, IP = 0, IPV6 = 1, IPV4V6 = 2, diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilter.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilter.aidl index de45cc5f32..e22b359163 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilter.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilter.aidl @@ -47,7 +47,7 @@ parcelable QosFilter { const byte DIRECTION_DOWNLINK = 0; const byte DIRECTION_UPLINK = 1; const byte DIRECTION_BIDIRECTIONAL = 2; - const byte PROTOCOL_UNSPECIFIED = (-1); + const byte PROTOCOL_UNSPECIFIED = -1; const byte PROTOCOL_TCP = 6; const byte PROTOCOL_UDP = 17; const byte PROTOCOL_ESP = 50; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/RouteSelectionDescriptor.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/RouteSelectionDescriptor.aidl index d83df81a38..434ee7d102 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/RouteSelectionDescriptor.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/RouteSelectionDescriptor.aidl @@ -39,7 +39,7 @@ parcelable RouteSelectionDescriptor { byte sscMode; android.hardware.radio.data.SliceInfo[] sliceInfo; String[] dnn; - const byte SSC_MODE_UNKNOWN = (-1); + const byte SSC_MODE_UNKNOWN = -1; const byte SSC_MODE_1 = 1; const byte SSC_MODE_2 = 2; const byte SSC_MODE_3 = 3; diff --git a/radio/aidl/android/hardware/radio/data/NrQos.aidl b/radio/aidl/android/hardware/radio/data/NrQos.aidl index 4078fdccc6..28b4a7f20d 100644 --- a/radio/aidl/android/hardware/radio/data/NrQos.aidl +++ b/radio/aidl/android/hardware/radio/data/NrQos.aidl @@ -27,8 +27,6 @@ parcelable NrQos { const byte FLOW_ID_RANGE_MIN = 1; const byte FLOW_ID_RANGE_MAX = 63; - const int AVERAGING_WINDOW_UNKNOWN = -1; - /** * 5G QOS Identifier (5QI), see 3GPP TS 24.501 and 23.501. The allowed values are standard * values (1-9, 65-68, 69-70, 75, 79-80, 82-85) defined in the spec and operator specific values @@ -38,16 +36,13 @@ parcelable NrQos { QosBandwidth downlink; QosBandwidth uplink; /** - * QOS flow identifier of the QOS flow description in the range - * (FLOW_ID_RANGE_MIN, FLOW_ID_RANGE_MAX). + * @deprecated use qosFlowIdentifier. */ byte qfi; - /** - * @deprecated use averagingWindowMillis; - */ char averagingWindowMs; /** - * The duration over which flow rates are calculated. - */ - int averagingWindowMillis = AVERAGING_WINDOW_UNKNOWN; + * QOS flow identifier of the QOS flow description in the range + * (FLOW_ID_RANGE_MIN, FLOW_ID_RANGE_MAX). + **/ + int qosFlowIdentifier; } diff --git a/radio/aidl/compat/libradiocompat/data/structs.cpp b/radio/aidl/compat/libradiocompat/data/structs.cpp index 47f1f86320..22cde6b994 100644 --- a/radio/aidl/compat/libradiocompat/data/structs.cpp +++ b/radio/aidl/compat/libradiocompat/data/structs.cpp @@ -136,8 +136,8 @@ static aidl::NrQos toAidl(const V1_6::NrQos& qos) { .fiveQi = qos.fiveQi, .downlink = toAidl(qos.downlink), .uplink = toAidl(qos.uplink), - .qfi = static_cast(qos.qfi), - .averagingWindowMillis = qos.averagingWindowMs, + .qosFlowIdentifier = static_cast(qos.qfi), + .averagingWindowMs = qos.averagingWindowMs, }; } From 28ee23c0fdd82a8e5a928c905d61f57af8ce1fbd Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Wed, 4 Jan 2023 23:04:46 -0800 Subject: [PATCH 599/998] Add HAL changes for AUTOMATIC_EMERGENCY_BRAKING_STATE This property supports error states in addition to its own state. This is why the comments mention two @data_enums for the property. This works because states are integer values so as long as all states have distinct integer values, this functions correctly. Bug: 264336118 Test: atest VtsHalAutomotiveVehicle_TargetTest Test: atest CtsCarTestCases:CarPropertyManagerTest Test: atest CtsCarTestCases:VehiclePropertyIdsTest Test: atest AutomaticEmergencyBrakingStateTest Test: atest ErrorStateTest Change-Id: I6acf5958caf00822b1455915cc715e04453d0bbd --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../JsonConfigLoader/src/JsonConfigLoader.cpp | 5 ++ .../config/DefaultProperties.json | 22 +++++++++ .../aidl/impl/default_config/config/README.md | 4 ++ .../utils/common/include/VehicleHalTypes.h | 2 + .../AutomaticEmergencyBrakingState.aidl | 41 ++++++++++++++++ .../automotive/vehicle/ErrorState.aidl | 42 ++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../AutomaticEmergencyBrakingState.aidl | 49 +++++++++++++++++++ .../automotive/vehicle/ErrorState.aidl | 37 ++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 22 +++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 +++ 15 files changed, 235 insertions(+) create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/AutomaticEmergencyBrakingState.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ErrorState.aidl create mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/AutomaticEmergencyBrakingState.aidl create mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ErrorState.aidl diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 8b770406bf..a6cb8617ea 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -238,6 +238,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::SUPPORTED_PROPERTY_IDS, VehiclePropertyAccess::READ}, {VehicleProperty::SHUTDOWN_REQUEST, VehiclePropertyAccess::WRITE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index d7e87e2a09..d3bf5f2514 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -238,6 +238,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::SUPPORTED_PROPERTY_IDS, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::SHUTDOWN_REQUEST, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 14600f00c9..1a1ce5eec4 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -230,6 +230,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.SUPPORTED_PROPERTY_IDS, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.SHUTDOWN_REQUEST, VehiclePropertyAccess.WRITE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 864f3924b7..c8abc14487 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -230,6 +230,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.SUPPORTED_PROPERTY_IDS, VehiclePropertyChangeMode.STATIC), Map.entry(VehicleProperty.SHUTDOWN_REQUEST, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index 5521ed1690..a58d477981 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -35,7 +35,9 @@ namespace vehicle { namespace jsonconfigloader_impl { using ::aidl::android::hardware::automotive::vehicle::AccessForVehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::AutomaticEmergencyBrakingState; using ::aidl::android::hardware::automotive::vehicle::ChangeModeForVehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::ErrorState; using ::aidl::android::hardware::automotive::vehicle::EvConnectorType; using ::aidl::android::hardware::automotive::vehicle::EvsServiceState; using ::aidl::android::hardware::automotive::vehicle::EvsServiceType; @@ -207,6 +209,9 @@ JsonValueParser::JsonValueParser() { mConstantParsersByType["VehicleIgnitionState"] = std::make_unique>(); mConstantParsersByType["FuelType"] = std::make_unique>(); + mConstantParsersByType["ErrorState"] = std::make_unique>(); + mConstantParsersByType["AutomaticEmergencyBrakingState"] = + std::make_unique>(); mConstantParsersByType["Constants"] = std::make_unique(); } diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 818176906a..080e6c0405 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3162,6 +3162,28 @@ ] } }, + { + "property": "VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE", + "defaultValue": { + "int32Values": [ + "AutomaticEmergencyBrakingState::ENABLED" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "ErrorState::NOT_AVAILABLE_SAFETY", + "ErrorState::NOT_AVAILABLE_SPEED_HIGH", + "ErrorState::NOT_AVAILABLE_SPEED_LOW", + "ErrorState::NOT_AVAILABLE_DISABLED", + "AutomaticEmergencyBrakingState::ENABLED", + "AutomaticEmergencyBrakingState::ACTIVATED", + "AutomaticEmergencyBrakingState::USER_OVERRIDE" + ] + } + ] + }, { "property": "VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/default_config/config/README.md b/automotive/vehicle/aidl/impl/default_config/config/README.md index 0e3fc5e4d4..1318d6dcb6 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/README.md +++ b/automotive/vehicle/aidl/impl/default_config/config/README.md @@ -141,6 +141,10 @@ We support the following constant types: * FuelType +* AutomaticEmergencyBrakingState + +* ErrorState + * Constants Every constant type except "Constants" corresponds to a enum defined in Vehicle diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index 09157019b8..567ffe9ed5 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -17,8 +17,10 @@ #ifndef android_hardware_automotive_vehicle_aidl_impl_utils_common_include_VehicleHalTypes_H_ #define android_hardware_automotive_vehicle_aidl_impl_utils_common_include_VehicleHalTypes_H_ +#include #include #include +#include #include #include #include diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/AutomaticEmergencyBrakingState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/AutomaticEmergencyBrakingState.aidl new file mode 100644 index 0000000000..b316df7454 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/AutomaticEmergencyBrakingState.aidl @@ -0,0 +1,41 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum AutomaticEmergencyBrakingState { + OTHER = 0, + ENABLED = 1, + ACTIVATED = 2, + USER_OVERRIDE = 3, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ErrorState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ErrorState.aidl new file mode 100644 index 0000000000..4fdbe1bca9 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ErrorState.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 -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.hardware.automotive.vehicle; +@VintfStability +enum ErrorState { + OTHER_ERROR_STATE = (-1), + NOT_AVAILABLE_DISABLED = (-2), + NOT_AVAILABLE_SPEED_LOW = (-3), + NOT_AVAILABLE_SPEED_HIGH = (-4), + NOT_AVAILABLE_SAFETY = (-5), +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 914787e3f2..4931ab174e 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -238,6 +238,7 @@ enum VehicleProperty { SUPPORTED_PROPERTY_IDS = 289476424, SHUTDOWN_REQUEST = 289410889, AUTOMATIC_EMERGENCY_BRAKING_ENABLED = 287313920, + AUTOMATIC_EMERGENCY_BRAKING_STATE = 289411073, FORWARD_COLLISION_WARNING_ENABLED = 287313922, BLIND_SPOT_WARNING_ENABLED = 287313924, LANE_DEPARTURE_WARNING_ENABLED = 287313926, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/AutomaticEmergencyBrakingState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/AutomaticEmergencyBrakingState.aidl new file mode 100644 index 0000000000..540c6633a3 --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/AutomaticEmergencyBrakingState.aidl @@ -0,0 +1,49 @@ +/* + * 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.hardware.automotive.vehicle; + +/** + * Used to enumerate the state of Automatic Emergency Braking (AEB). + */ +@VintfStability +@Backing(type="int") +enum AutomaticEmergencyBrakingState { + + /** + * This state is used as an alternative to any AutomaticEmergencyBrakingState value that is not + * defined in the platform. Ideally, implementations of + * VehicleProperty#AUTOMATIC_EMERGENCY_BRAKING_STATE should not use this state. The framework + * can use this field to remain backwards compatible if AutomaticEmergencyBrakingState is + * extended to include additional states. + */ + OTHER = 0, + /** + * AEB is enabled and monitoring safety, but brakes are not activated. + */ + ENABLED = 1, + /** + * AEB is enabled and currently has the brakes applied for the vehicle. + */ + ACTIVATED = 2, + /** + * Many AEB implementations allow the driver to override AEB. This means that the car has + * determined it should brake, but a user decides to take over and do something else. This is + * often done for safety reasons and to ensure that the driver can always take control of the + * vehicle. This state should be set when the user is actively overriding the AEB system. + */ + USER_OVERRIDE = 3, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ErrorState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ErrorState.aidl new file mode 100644 index 0000000000..42007fa60e --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ErrorState.aidl @@ -0,0 +1,37 @@ +/* + * 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.hardware.automotive.vehicle; + +/** + * Used to enumerate the possible error states. For version 2 of this interface, ErrorState is used + * by ADAS STATE properties, but its use may be expanded in future releases. + */ +@VintfStability +enum ErrorState { + + /** + * This state is used as an alternative to any ErrorState value that is not defined in the + * platform. Ideally, implementations of vehicle properties should not use this state. The + * framework can use this field to remain backwards compatible if this enum is extended to + * include additional states. + */ + OTHER_ERROR_STATE = -1, + NOT_AVAILABLE_DISABLED = -2, + NOT_AVAILABLE_SPEED_LOW = -3, + NOT_AVAILABLE_SPEED_HIGH = -4, + NOT_AVAILABLE_SAFETY = -5, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index e776154814..4a9799e0bf 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3438,6 +3438,28 @@ enum VehicleProperty { AUTOMATIC_EMERGENCY_BRAKING_ENABLED = 0x1000 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Automatic Emergency Braking (AEB) state. + * + * Returns the current state of AEB. This property must always return a valid state defined in + * AutomaticEmergencyBrakingState or ErrorState. It must not surface errors through StatusCode + * and must use the supported error states instead. + * + * If AEB includes forward collision warnings before activating the brakes, those warnings must + * be surfaced through the Forward Collision Warning (FCW) properties. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of both AutomaticEmergencyBrakingState (including OTHER, which is not + * recommended) and ErrorState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum AutomaticEmergencyBrakingState + * @data_enum ErrorState + */ + AUTOMATIC_EMERGENCY_BRAKING_STATE = + 0x1001 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** * Enable or disable forward collision warning (FCW). * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 848edb85d5..17edc1d721 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -684,6 +684,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAutomaticEmergencyBrakingEnabled VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAutomaticEmergencyBrakingStateConfig) { + verifyProperty(VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyForwardCollisionWarningEnabledConfig) { verifyProperty(VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, From cf854badaf027a0e4d9bfb2313f1cfa96d3b9387 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Mon, 9 Jan 2023 13:38:53 -0800 Subject: [PATCH 600/998] Update AUTOMATIC_EMERGENCY_BRAKING_ENABLED documentation in HAL An implementation of AUTOMATIC_EMERGENCY_BRAKING_ENABLED should return false when there's an issue with the ADAS system and it cannot retrieve the property. It should not return NOT_AVAILABLE. Bug: 264336118 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I2dab0c48865ed1ccc40433b9fbe5ea341a2488f3 --- .../android/hardware/automotive/vehicle/VehicleProperty.aidl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 4a9799e0bf..28deaf67ca 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3429,6 +3429,10 @@ enum VehicleProperty { * Set true to enable AEB and false to disable AEB. When AEB is enabled, the ADAS system in the * vehicle should be turned on and monitoring to avoid potential collisions. * + * IVehicle#get must not return any NOT_AVAILABLE value in StatusCode. Other StatusCode values + * like TRY_AGAIN may still be used as needed. For example, if AEB is not available because the + * vehicle speed is too low, IVehicle#get must return false. + * * This property is defined as read_write, but OEMs have the option to implement it as read * only. * From f59b886f808f821596a040a6e1c487dacd87d142 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Tue, 10 Jan 2023 16:03:07 -0800 Subject: [PATCH 601/998] Add HAL changes for FORWARD_COLLISION_WARNING_STATE This property supports error states in addition to its own state. This is why the comments mention two @data_enums for this property. This works because states are integer values so as long as all states have distinct integer values, this functions correctly. Bug: 264946034 Test: atest VtsHalAutomotiveVehicle_TargetTest Test: atest CtsCarTestCases:CarPropertyManagerTest Test: atest CtsCarTestCases:VehiclePropertyIdsTest Test: atest ForwardCollisionWarningStateTest Change-Id: Ib9292d8e64cc0d404065efccbfcf7fabd9fd1f69 --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../JsonConfigLoader/src/JsonConfigLoader.cpp | 3 ++ .../config/DefaultProperties.json | 21 ++++++++++ .../aidl/impl/default_config/config/README.md | 2 + .../utils/common/include/VehicleHalTypes.h | 1 + .../vehicle/ForwardCollisionWarningState.aidl | 40 ++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../vehicle/ForwardCollisionWarningState.aidl | 42 +++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 19 +++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 +++ 13 files changed, 139 insertions(+) create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl create mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index a6cb8617ea..aef5fe7af9 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -240,6 +240,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::FORWARD_COLLISION_WARNING_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index d3bf5f2514..4a5840478e 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -240,6 +240,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::FORWARD_COLLISION_WARNING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 1a1ce5eec4..eec9daf7eb 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -232,6 +232,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index c8abc14487..91c3637562 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -232,6 +232,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index a58d477981..f39376bb80 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -41,6 +41,7 @@ using ::aidl::android::hardware::automotive::vehicle::ErrorState; using ::aidl::android::hardware::automotive::vehicle::EvConnectorType; using ::aidl::android::hardware::automotive::vehicle::EvsServiceState; using ::aidl::android::hardware::automotive::vehicle::EvsServiceType; +using ::aidl::android::hardware::automotive::vehicle::ForwardCollisionWarningState; using ::aidl::android::hardware::automotive::vehicle::FuelType; using ::aidl::android::hardware::automotive::vehicle::GsrComplianceRequirementType; using ::aidl::android::hardware::automotive::vehicle::RawPropValues; @@ -212,6 +213,8 @@ JsonValueParser::JsonValueParser() { mConstantParsersByType["ErrorState"] = std::make_unique>(); mConstantParsersByType["AutomaticEmergencyBrakingState"] = std::make_unique>(); + mConstantParsersByType["ForwardCollisionWarningState"] = + std::make_unique>(); mConstantParsersByType["Constants"] = std::make_unique(); } diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 080e6c0405..50e242819c 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3192,6 +3192,27 @@ ] } }, + { + "property": "VehicleProperty::FORWARD_COLLISION_WARNING_STATE", + "defaultValue": { + "int32Values": [ + "ForwardCollisionWarningState::NO_WARNING" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "ErrorState::NOT_AVAILABLE_SAFETY", + "ErrorState::NOT_AVAILABLE_SPEED_HIGH", + "ErrorState::NOT_AVAILABLE_SPEED_LOW", + "ErrorState::NOT_AVAILABLE_DISABLED", + "ForwardCollisionWarningState::NO_WARNING", + "ForwardCollisionWarningState::WARNING" + ] + } + ] + }, { "property": "VehicleProperty::BLIND_SPOT_WARNING_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/default_config/config/README.md b/automotive/vehicle/aidl/impl/default_config/config/README.md index 1318d6dcb6..a5d8cdf1eb 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/README.md +++ b/automotive/vehicle/aidl/impl/default_config/config/README.md @@ -143,6 +143,8 @@ We support the following constant types: * AutomaticEmergencyBrakingState +* ForwardCollisionWarningState + * ErrorState * Constants diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index 567ffe9ed5..5a84d581a2 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl new file mode 100644 index 0000000000..371885d3b5 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum ForwardCollisionWarningState { + OTHER = 0, + NO_WARNING = 1, + WARNING = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 4931ab174e..1039347b28 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -240,6 +240,7 @@ enum VehicleProperty { AUTOMATIC_EMERGENCY_BRAKING_ENABLED = 287313920, AUTOMATIC_EMERGENCY_BRAKING_STATE = 289411073, FORWARD_COLLISION_WARNING_ENABLED = 287313922, + FORWARD_COLLISION_WARNING_STATE = 289411075, BLIND_SPOT_WARNING_ENABLED = 287313924, LANE_DEPARTURE_WARNING_ENABLED = 287313926, LANE_KEEP_ASSIST_ENABLED = 287313928, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl new file mode 100644 index 0000000000..b20cf259d2 --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ForwardCollisionWarningState.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. + */ + +package android.hardware.automotive.vehicle; + +/** + * Used to enumerate the state of Forward Collision Warning State (FCW). + */ +@VintfStability +@Backing(type="int") +enum ForwardCollisionWarningState { + + /** + * This state is used as an alternative to any ForwardCollisionWarningState value that is not + * defined in the platform. Ideally, implementations of + * VehicleProperty#FORWARD_COLLISION_WARNING_STATE should not use this state. The framework + * can use this field to remain backwards compatible if ForwardCollisionWarningState is + * extended to include additional states. + */ + OTHER = 0, + /** + * FCW is enabled and monitoring safety, but no potential collision is detected. + */ + NO_WARNING = 1, + /** + * FCW is enabled, detects a potential collision, and is actively warning the user. + */ + WARNING = 2, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 28deaf67ca..ce152200da 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3479,6 +3479,25 @@ enum VehicleProperty { FORWARD_COLLISION_WARNING_ENABLED = 0x1002 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Forward Collision Warning (FCW) state. + * + * Returns the current state of FCW. This property must always return a valid state defined in + * ForwardCollisionWarningState or ErrorState. It must not surface errors through StatusCode + * and must use the supported error states instead. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of both ForwardCollisionWarningState (including OTHER, which is not + * recommended) and ErrorState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum ForwardCollisionWarningState + * @data_enum ErrorState + */ + FORWARD_COLLISION_WARNING_STATE = + 0x1003 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** * Enable and disable blind spot warning (BSW). * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 17edc1d721..28b4dcf511 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -696,6 +696,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyForwardCollisionWarningEnabledCo VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyForwardCollisionWarningStateConfig) { + verifyProperty(VehicleProperty::FORWARD_COLLISION_WARNING_STATE, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyBlindSpotWarningEnabledConfig) { verifyProperty(VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From 509d0ffbe5314c5496c3481d867da8d0ae5a508f Mon Sep 17 00:00:00 2001 From: Sarah Chin Date: Tue, 17 Jan 2023 15:22:33 -0800 Subject: [PATCH 602/998] Run update-api on IRadio services Update the API surface for all IRadio services. There is no functional change. Test: build Change-Id: Ie80cfc891dd88fa6eb0280ed555ac7ab7f7a2606 --- .../config/MultipleEnabledProfilesMode.aidl | 8 +- .../hardware/radio/data/ApnAuthType.aidl | 8 +- .../android/hardware/radio/data/ApnTypes.aidl | 30 +- .../radio/data/DataCallFailCause.aidl | 678 +++++++++--------- .../hardware/radio/data/DataProfileInfo.aidl | 2 +- .../radio/data/DataThrottlingAction.aidl | 8 +- .../hardware/radio/data/LinkAddress.aidl | 2 +- .../hardware/radio/data/PdpProtocolType.aidl | 2 +- .../hardware/radio/data/QosFilter.aidl | 2 +- .../radio/data/RouteSelectionDescriptor.aidl | 2 +- .../hardware/radio/ims/media/AmrMode.aidl | 18 +- .../hardware/radio/ims/media/AnbrBitrate.aidl | 2 +- .../hardware/radio/ims/media/CodecType.aidl | 10 +- .../radio/ims/media/EvsBandwidth.aidl | 8 +- .../hardware/radio/ims/media/EvsMode.aidl | 42 +- .../ims/media/RtcpXrReportBlockType.aidl | 14 +- .../radio/ims/ConnectionFailureInfo.aidl | 2 +- .../android/hardware/radio/ims/ImsCall.aidl | 24 +- .../hardware/radio/ims/ImsRegistration.aidl | 8 +- .../radio/ims/ImsRegistrationState.aidl | 4 +- .../hardware/radio/ims/ImsTrafficType.aidl | 14 +- .../android/hardware/radio/ims/SrvccCall.aidl | 14 +- .../hardware/radio/ims/SuggestedAction.aidl | 6 +- .../messaging/SmsAcknowledgeFailCause.aidl | 4 +- .../hardware/radio/modem/DeviceStateType.aidl | 6 +- .../hardware/radio/modem/ImeiInfo.aidl | 8 +- .../hardware/radio/modem/ResetNvType.aidl | 6 +- .../network/Cdma2000RegistrationInfo.aidl | 2 +- .../radio/network/CdmaRoamingType.aidl | 6 +- .../radio/network/CellConnectionStatus.aidl | 6 +- .../hardware/radio/network/Domain.aidl | 4 +- .../radio/network/EutranRegistrationInfo.aidl | 10 +- .../radio/network/IndicationFilter.aidl | 16 +- .../radio/network/PhoneRestrictedState.aidl | 10 +- .../hardware/radio/network/RadioBandMode.aidl | 38 +- .../radio/network/RegistrationFailCause.aidl | 2 +- .../hardware/radio/sap/SapApduType.aidl | 4 +- .../hardware/radio/sap/SapConnectRsp.aidl | 10 +- .../hardware/radio/sap/SapDisconnectType.aidl | 4 +- .../hardware/radio/sap/SapResultCode.aidl | 16 +- .../android/hardware/radio/sap/SapStatus.aidl | 12 +- .../radio/sap/SapTransferProtocol.aidl | 4 +- .../hardware/radio/sim/CardPowerState.aidl | 6 +- .../radio/sim/CarrierRestrictions.aidl | 22 +- .../radio/sim/CdmaSubscriptionSource.aidl | 4 +- .../hardware/radio/sim/PersoSubstate.aidl | 70 +- .../android/hardware/radio/sim/PinState.aidl | 12 +- .../radio/sim/SimLockMultiSimPolicy.aidl | 4 +- .../hardware/radio/voice/AudioQuality.aidl | 20 +- .../radio/voice/CdmaOtaProvisionStatus.aidl | 24 +- .../hardware/radio/voice/ClipStatus.aidl | 6 +- .../radio/voice/EmergencyCallRouting.aidl | 6 +- .../hardware/radio/voice/EmergencyNumber.aidl | 8 +- .../radio/voice/EmergencyServiceCategory.aidl | 14 +- .../radio/voice/LastCallFailCause.aidl | 32 +- .../hardware/radio/voice/SrvccState.aidl | 8 +- .../radio/voice/StkCcUnsolSsResult.aidl | 18 +- .../android/hardware/radio/voice/TtyMode.aidl | 8 +- .../hardware/radio/voice/UssdModeType.aidl | 12 +- .../android/hardware/radio/AccessNetwork.aidl | 14 +- .../hardware/radio/RadioAccessFamily.aidl | 42 +- .../android/hardware/radio/RadioConst.aidl | 2 +- .../hardware/radio/RadioIndicationType.aidl | 4 +- .../hardware/radio/RadioResponseType.aidl | 6 +- .../hardware/radio/RadioTechnology.aidl | 42 +- .../hardware/radio/RadioTechnologyFamily.aidl | 4 +- 66 files changed, 732 insertions(+), 732 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl index fad767c87a..74017e407a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl @@ -34,8 +34,8 @@ package android.hardware.radio.config; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum MultipleEnabledProfilesMode { - NONE = 0, - MEP_A1 = 1, - MEP_A2 = 2, - MEP_B = 3, + NONE, + MEP_A1, + MEP_A2, + MEP_B, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnAuthType.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnAuthType.aidl index 86272c22eb..a33ad6e338 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnAuthType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnAuthType.aidl @@ -34,8 +34,8 @@ package android.hardware.radio.data; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ApnAuthType { - NO_PAP_NO_CHAP = 0, - PAP_NO_CHAP = 1, - NO_PAP_CHAP = 2, - PAP_CHAP = 3, + NO_PAP_NO_CHAP, + PAP_NO_CHAP, + NO_PAP_CHAP, + PAP_CHAP, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnTypes.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnTypes.aidl index 1518a5749e..45d22c853f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnTypes.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/ApnTypes.aidl @@ -35,19 +35,19 @@ package android.hardware.radio.data; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ApnTypes { NONE = 0, - DEFAULT = 1, - MMS = 2, - SUPL = 4, - DUN = 8, - HIPRI = 16, - FOTA = 32, - IMS = 64, - CBS = 128, - IA = 256, - EMERGENCY = 512, - MCX = 1024, - XCAP = 2048, - VSIM = 4096, - BIP = 8192, - ENTERPRISE = 16384, + DEFAULT = (1 << 0), + MMS = (1 << 1), + SUPL = (1 << 2), + DUN = (1 << 3), + HIPRI = (1 << 4), + FOTA = (1 << 5), + IMS = (1 << 6), + CBS = (1 << 7), + IA = (1 << 8), + EMERGENCY = (1 << 9), + MCX = (1 << 10), + XCAP = (1 << 11), + VSIM = (1 << 12), + BIP = (1 << 13), + ENTERPRISE = (1 << 14), } diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl index d7d6983236..0a5f8dd01d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl @@ -35,343 +35,343 @@ package android.hardware.radio.data; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum DataCallFailCause { NONE = 0, - OPERATOR_BARRED = 8, - NAS_SIGNALLING = 14, - INSUFFICIENT_RESOURCES = 26, - MISSING_UNKNOWN_APN = 27, - UNKNOWN_PDP_ADDRESS_TYPE = 28, - USER_AUTHENTICATION = 29, - ACTIVATION_REJECT_GGSN = 30, - ACTIVATION_REJECT_UNSPECIFIED = 31, - SERVICE_OPTION_NOT_SUPPORTED = 32, - SERVICE_OPTION_NOT_SUBSCRIBED = 33, - SERVICE_OPTION_OUT_OF_ORDER = 34, - NSAPI_IN_USE = 35, - REGULAR_DEACTIVATION = 36, - QOS_NOT_ACCEPTED = 37, - NETWORK_FAILURE = 38, - UMTS_REACTIVATION_REQ = 39, - FEATURE_NOT_SUPP = 40, - TFT_SEMANTIC_ERROR = 41, - TFT_SYTAX_ERROR = 42, - UNKNOWN_PDP_CONTEXT = 43, - FILTER_SEMANTIC_ERROR = 44, - FILTER_SYTAX_ERROR = 45, - PDP_WITHOUT_ACTIVE_TFT = 46, - ONLY_IPV4_ALLOWED = 50, - ONLY_IPV6_ALLOWED = 51, - ONLY_SINGLE_BEARER_ALLOWED = 52, - ESM_INFO_NOT_RECEIVED = 53, - PDN_CONN_DOES_NOT_EXIST = 54, - MULTI_CONN_TO_SAME_PDN_NOT_ALLOWED = 55, - MAX_ACTIVE_PDP_CONTEXT_REACHED = 65, - UNSUPPORTED_APN_IN_CURRENT_PLMN = 66, - INVALID_TRANSACTION_ID = 81, - MESSAGE_INCORRECT_SEMANTIC = 95, - INVALID_MANDATORY_INFO = 96, - MESSAGE_TYPE_UNSUPPORTED = 97, - MSG_TYPE_NONCOMPATIBLE_STATE = 98, - UNKNOWN_INFO_ELEMENT = 99, - CONDITIONAL_IE_ERROR = 100, - MSG_AND_PROTOCOL_STATE_UNCOMPATIBLE = 101, - PROTOCOL_ERRORS = 111, - APN_TYPE_CONFLICT = 112, - INVALID_PCSCF_ADDR = 113, - INTERNAL_CALL_PREEMPT_BY_HIGH_PRIO_APN = 114, - EMM_ACCESS_BARRED = 115, - EMERGENCY_IFACE_ONLY = 116, - IFACE_MISMATCH = 117, - COMPANION_IFACE_IN_USE = 118, - IP_ADDRESS_MISMATCH = 119, - IFACE_AND_POL_FAMILY_MISMATCH = 120, - EMM_ACCESS_BARRED_INFINITE_RETRY = 121, - AUTH_FAILURE_ON_EMERGENCY_CALL = 122, - OEM_DCFAILCAUSE_1 = 4097, - OEM_DCFAILCAUSE_2 = 4098, - OEM_DCFAILCAUSE_3 = 4099, - OEM_DCFAILCAUSE_4 = 4100, - OEM_DCFAILCAUSE_5 = 4101, - OEM_DCFAILCAUSE_6 = 4102, - OEM_DCFAILCAUSE_7 = 4103, - OEM_DCFAILCAUSE_8 = 4104, - OEM_DCFAILCAUSE_9 = 4105, - OEM_DCFAILCAUSE_10 = 4106, - OEM_DCFAILCAUSE_11 = 4107, - OEM_DCFAILCAUSE_12 = 4108, - OEM_DCFAILCAUSE_13 = 4109, - OEM_DCFAILCAUSE_14 = 4110, - OEM_DCFAILCAUSE_15 = 4111, - VOICE_REGISTRATION_FAIL = -1, - DATA_REGISTRATION_FAIL = -2, - SIGNAL_LOST = -3, - PREF_RADIO_TECH_CHANGED = -4, - RADIO_POWER_OFF = -5, - TETHERED_CALL_ACTIVE = -6, - ERROR_UNSPECIFIED = 65535, - LLC_SNDCP = 25, - ACTIVATION_REJECTED_BCM_VIOLATION = 48, - COLLISION_WITH_NETWORK_INITIATED_REQUEST = 56, - ONLY_IPV4V6_ALLOWED = 57, - ONLY_NON_IP_ALLOWED = 58, - UNSUPPORTED_QCI_VALUE = 59, - BEARER_HANDLING_NOT_SUPPORTED = 60, - INVALID_DNS_ADDR = 123, - INVALID_PCSCF_OR_DNS_ADDRESS = 124, - CALL_PREEMPT_BY_EMERGENCY_APN = 127, - UE_INITIATED_DETACH_OR_DISCONNECT = 128, - MIP_FA_REASON_UNSPECIFIED = 2000, - MIP_FA_ADMIN_PROHIBITED = 2001, - MIP_FA_INSUFFICIENT_RESOURCES = 2002, - MIP_FA_MOBILE_NODE_AUTHENTICATION_FAILURE = 2003, - MIP_FA_HOME_AGENT_AUTHENTICATION_FAILURE = 2004, - MIP_FA_REQUESTED_LIFETIME_TOO_LONG = 2005, - MIP_FA_MALFORMED_REQUEST = 2006, - MIP_FA_MALFORMED_REPLY = 2007, - MIP_FA_ENCAPSULATION_UNAVAILABLE = 2008, - MIP_FA_VJ_HEADER_COMPRESSION_UNAVAILABLE = 2009, - MIP_FA_REVERSE_TUNNEL_UNAVAILABLE = 2010, - MIP_FA_REVERSE_TUNNEL_IS_MANDATORY = 2011, - MIP_FA_DELIVERY_STYLE_NOT_SUPPORTED = 2012, - MIP_FA_MISSING_NAI = 2013, - MIP_FA_MISSING_HOME_AGENT = 2014, - MIP_FA_MISSING_HOME_ADDRESS = 2015, - MIP_FA_UNKNOWN_CHALLENGE = 2016, - MIP_FA_MISSING_CHALLENGE = 2017, - MIP_FA_STALE_CHALLENGE = 2018, - MIP_HA_REASON_UNSPECIFIED = 2019, - MIP_HA_ADMIN_PROHIBITED = 2020, - MIP_HA_INSUFFICIENT_RESOURCES = 2021, - MIP_HA_MOBILE_NODE_AUTHENTICATION_FAILURE = 2022, - MIP_HA_FOREIGN_AGENT_AUTHENTICATION_FAILURE = 2023, - MIP_HA_REGISTRATION_ID_MISMATCH = 2024, - MIP_HA_MALFORMED_REQUEST = 2025, - MIP_HA_UNKNOWN_HOME_AGENT_ADDRESS = 2026, - MIP_HA_REVERSE_TUNNEL_UNAVAILABLE = 2027, - MIP_HA_REVERSE_TUNNEL_IS_MANDATORY = 2028, - MIP_HA_ENCAPSULATION_UNAVAILABLE = 2029, - CLOSE_IN_PROGRESS = 2030, - NETWORK_INITIATED_TERMINATION = 2031, - MODEM_APP_PREEMPTED = 2032, - PDN_IPV4_CALL_DISALLOWED = 2033, - PDN_IPV4_CALL_THROTTLED = 2034, - PDN_IPV6_CALL_DISALLOWED = 2035, - PDN_IPV6_CALL_THROTTLED = 2036, - MODEM_RESTART = 2037, - PDP_PPP_NOT_SUPPORTED = 2038, - UNPREFERRED_RAT = 2039, - PHYSICAL_LINK_CLOSE_IN_PROGRESS = 2040, - APN_PENDING_HANDOVER = 2041, - PROFILE_BEARER_INCOMPATIBLE = 2042, - SIM_CARD_CHANGED = 2043, - LOW_POWER_MODE_OR_POWERING_DOWN = 2044, - APN_DISABLED = 2045, - MAX_PPP_INACTIVITY_TIMER_EXPIRED = 2046, - IPV6_ADDRESS_TRANSFER_FAILED = 2047, - TRAT_SWAP_FAILED = 2048, - EHRPD_TO_HRPD_FALLBACK = 2049, - MIP_CONFIG_FAILURE = 2050, - PDN_INACTIVITY_TIMER_EXPIRED = 2051, - MAX_IPV4_CONNECTIONS = 2052, - MAX_IPV6_CONNECTIONS = 2053, - APN_MISMATCH = 2054, - IP_VERSION_MISMATCH = 2055, - DUN_CALL_DISALLOWED = 2056, - INTERNAL_EPC_NONEPC_TRANSITION = 2057, - INTERFACE_IN_USE = 2058, - APN_DISALLOWED_ON_ROAMING = 2059, - APN_PARAMETERS_CHANGED = 2060, - NULL_APN_DISALLOWED = 2061, - THERMAL_MITIGATION = 2062, - DATA_SETTINGS_DISABLED = 2063, - DATA_ROAMING_SETTINGS_DISABLED = 2064, - DDS_SWITCHED = 2065, - FORBIDDEN_APN_NAME = 2066, - DDS_SWITCH_IN_PROGRESS = 2067, - CALL_DISALLOWED_IN_ROAMING = 2068, - NON_IP_NOT_SUPPORTED = 2069, - PDN_NON_IP_CALL_THROTTLED = 2070, - PDN_NON_IP_CALL_DISALLOWED = 2071, - CDMA_LOCK = 2072, - CDMA_INTERCEPT = 2073, - CDMA_REORDER = 2074, - CDMA_RELEASE_DUE_TO_SO_REJECTION = 2075, - CDMA_INCOMING_CALL = 2076, - CDMA_ALERT_STOP = 2077, - CHANNEL_ACQUISITION_FAILURE = 2078, - MAX_ACCESS_PROBE = 2079, - CONCURRENT_SERVICE_NOT_SUPPORTED_BY_BASE_STATION = 2080, - NO_RESPONSE_FROM_BASE_STATION = 2081, - REJECTED_BY_BASE_STATION = 2082, - CONCURRENT_SERVICES_INCOMPATIBLE = 2083, - NO_CDMA_SERVICE = 2084, - RUIM_NOT_PRESENT = 2085, - CDMA_RETRY_ORDER = 2086, - ACCESS_BLOCK = 2087, - ACCESS_BLOCK_ALL = 2088, - IS707B_MAX_ACCESS_PROBES = 2089, - THERMAL_EMERGENCY = 2090, - CONCURRENT_SERVICES_NOT_ALLOWED = 2091, - INCOMING_CALL_REJECTED = 2092, - NO_SERVICE_ON_GATEWAY = 2093, - NO_GPRS_CONTEXT = 2094, - ILLEGAL_MS = 2095, - ILLEGAL_ME = 2096, - GPRS_SERVICES_AND_NON_GPRS_SERVICES_NOT_ALLOWED = 2097, - GPRS_SERVICES_NOT_ALLOWED = 2098, - MS_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK = 2099, - IMPLICITLY_DETACHED = 2100, - PLMN_NOT_ALLOWED = 2101, - LOCATION_AREA_NOT_ALLOWED = 2102, - GPRS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN = 2103, - PDP_DUPLICATE = 2104, - UE_RAT_CHANGE = 2105, - CONGESTION = 2106, - NO_PDP_CONTEXT_ACTIVATED = 2107, - ACCESS_CLASS_DSAC_REJECTION = 2108, - PDP_ACTIVATE_MAX_RETRY_FAILED = 2109, - RADIO_ACCESS_BEARER_FAILURE = 2110, - ESM_UNKNOWN_EPS_BEARER_CONTEXT = 2111, - DRB_RELEASED_BY_RRC = 2112, - CONNECTION_RELEASED = 2113, - EMM_DETACHED = 2114, - EMM_ATTACH_FAILED = 2115, - EMM_ATTACH_STARTED = 2116, - LTE_NAS_SERVICE_REQUEST_FAILED = 2117, - DUPLICATE_BEARER_ID = 2118, - ESM_COLLISION_SCENARIOS = 2119, - ESM_BEARER_DEACTIVATED_TO_SYNC_WITH_NETWORK = 2120, - ESM_NW_ACTIVATED_DED_BEARER_WITH_ID_OF_DEF_BEARER = 2121, - ESM_BAD_OTA_MESSAGE = 2122, - ESM_DOWNLOAD_SERVER_REJECTED_THE_CALL = 2123, - ESM_CONTEXT_TRANSFERRED_DUE_TO_IRAT = 2124, - DS_EXPLICIT_DEACTIVATION = 2125, - ESM_LOCAL_CAUSE_NONE = 2126, - LTE_THROTTLING_NOT_REQUIRED = 2127, - ACCESS_CONTROL_LIST_CHECK_FAILURE = 2128, - SERVICE_NOT_ALLOWED_ON_PLMN = 2129, - EMM_T3417_EXPIRED = 2130, - EMM_T3417_EXT_EXPIRED = 2131, - RRC_UPLINK_DATA_TRANSMISSION_FAILURE = 2132, - RRC_UPLINK_DELIVERY_FAILED_DUE_TO_HANDOVER = 2133, - RRC_UPLINK_CONNECTION_RELEASE = 2134, - RRC_UPLINK_RADIO_LINK_FAILURE = 2135, - RRC_UPLINK_ERROR_REQUEST_FROM_NAS = 2136, - RRC_CONNECTION_ACCESS_STRATUM_FAILURE = 2137, - RRC_CONNECTION_ANOTHER_PROCEDURE_IN_PROGRESS = 2138, - RRC_CONNECTION_ACCESS_BARRED = 2139, - RRC_CONNECTION_CELL_RESELECTION = 2140, - RRC_CONNECTION_CONFIG_FAILURE = 2141, - RRC_CONNECTION_TIMER_EXPIRED = 2142, - RRC_CONNECTION_LINK_FAILURE = 2143, - RRC_CONNECTION_CELL_NOT_CAMPED = 2144, - RRC_CONNECTION_SYSTEM_INTERVAL_FAILURE = 2145, - RRC_CONNECTION_REJECT_BY_NETWORK = 2146, - RRC_CONNECTION_NORMAL_RELEASE = 2147, - RRC_CONNECTION_RADIO_LINK_FAILURE = 2148, - RRC_CONNECTION_REESTABLISHMENT_FAILURE = 2149, - RRC_CONNECTION_OUT_OF_SERVICE_DURING_CELL_REGISTER = 2150, - RRC_CONNECTION_ABORT_REQUEST = 2151, - RRC_CONNECTION_SYSTEM_INFORMATION_BLOCK_READ_ERROR = 2152, - NETWORK_INITIATED_DETACH_WITH_AUTO_REATTACH = 2153, - NETWORK_INITIATED_DETACH_NO_AUTO_REATTACH = 2154, - ESM_PROCEDURE_TIME_OUT = 2155, - INVALID_CONNECTION_ID = 2156, - MAXIMIUM_NSAPIS_EXCEEDED = 2157, - INVALID_PRIMARY_NSAPI = 2158, - CANNOT_ENCODE_OTA_MESSAGE = 2159, - RADIO_ACCESS_BEARER_SETUP_FAILURE = 2160, - PDP_ESTABLISH_TIMEOUT_EXPIRED = 2161, - PDP_MODIFY_TIMEOUT_EXPIRED = 2162, - PDP_INACTIVE_TIMEOUT_EXPIRED = 2163, - PDP_LOWERLAYER_ERROR = 2164, - PDP_MODIFY_COLLISION = 2165, - MAXINUM_SIZE_OF_L2_MESSAGE_EXCEEDED = 2166, - NAS_REQUEST_REJECTED_BY_NETWORK = 2167, - RRC_CONNECTION_INVALID_REQUEST = 2168, - RRC_CONNECTION_TRACKING_AREA_ID_CHANGED = 2169, - RRC_CONNECTION_RF_UNAVAILABLE = 2170, - RRC_CONNECTION_ABORTED_DUE_TO_IRAT_CHANGE = 2171, - RRC_CONNECTION_RELEASED_SECURITY_NOT_ACTIVE = 2172, - RRC_CONNECTION_ABORTED_AFTER_HANDOVER = 2173, - RRC_CONNECTION_ABORTED_AFTER_IRAT_CELL_CHANGE = 2174, - RRC_CONNECTION_ABORTED_DURING_IRAT_CELL_CHANGE = 2175, - IMSI_UNKNOWN_IN_HOME_SUBSCRIBER_SERVER = 2176, - IMEI_NOT_ACCEPTED = 2177, - EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED = 2178, - EPS_SERVICES_NOT_ALLOWED_IN_PLMN = 2179, - MSC_TEMPORARILY_NOT_REACHABLE = 2180, - CS_DOMAIN_NOT_AVAILABLE = 2181, - ESM_FAILURE = 2182, - MAC_FAILURE = 2183, - SYNCHRONIZATION_FAILURE = 2184, - UE_SECURITY_CAPABILITIES_MISMATCH = 2185, - SECURITY_MODE_REJECTED = 2186, - UNACCEPTABLE_NON_EPS_AUTHENTICATION = 2187, - CS_FALLBACK_CALL_ESTABLISHMENT_NOT_ALLOWED = 2188, - NO_EPS_BEARER_CONTEXT_ACTIVATED = 2189, - INVALID_EMM_STATE = 2190, - NAS_LAYER_FAILURE = 2191, - MULTIPLE_PDP_CALL_NOT_ALLOWED = 2192, - EMBMS_NOT_ENABLED = 2193, - IRAT_HANDOVER_FAILED = 2194, - EMBMS_REGULAR_DEACTIVATION = 2195, - TEST_LOOPBACK_REGULAR_DEACTIVATION = 2196, - LOWER_LAYER_REGISTRATION_FAILURE = 2197, - DATA_PLAN_EXPIRED = 2198, - UMTS_HANDOVER_TO_IWLAN = 2199, - EVDO_CONNECTION_DENY_BY_GENERAL_OR_NETWORK_BUSY = 2200, - EVDO_CONNECTION_DENY_BY_BILLING_OR_AUTHENTICATION_FAILURE = 2201, - EVDO_HDR_CHANGED = 2202, - EVDO_HDR_EXITED = 2203, - EVDO_HDR_NO_SESSION = 2204, - EVDO_USING_GPS_FIX_INSTEAD_OF_HDR_CALL = 2205, - EVDO_HDR_CONNECTION_SETUP_TIMEOUT = 2206, - FAILED_TO_ACQUIRE_COLOCATED_HDR = 2207, - OTASP_COMMIT_IN_PROGRESS = 2208, - NO_HYBRID_HDR_SERVICE = 2209, - HDR_NO_LOCK_GRANTED = 2210, - DBM_OR_SMS_IN_PROGRESS = 2211, - HDR_FADE = 2212, - HDR_ACCESS_FAILURE = 2213, - UNSUPPORTED_1X_PREV = 2214, - LOCAL_END = 2215, - NO_SERVICE = 2216, - FADE = 2217, - NORMAL_RELEASE = 2218, - ACCESS_ATTEMPT_ALREADY_IN_PROGRESS = 2219, - REDIRECTION_OR_HANDOFF_IN_PROGRESS = 2220, - EMERGENCY_MODE = 2221, - PHONE_IN_USE = 2222, - INVALID_MODE = 2223, - INVALID_SIM_STATE = 2224, - NO_COLLOCATED_HDR = 2225, - UE_IS_ENTERING_POWERSAVE_MODE = 2226, - DUAL_SWITCH = 2227, - PPP_TIMEOUT = 2228, - PPP_AUTH_FAILURE = 2229, - PPP_OPTION_MISMATCH = 2230, - PPP_PAP_FAILURE = 2231, - PPP_CHAP_FAILURE = 2232, - PPP_CLOSE_IN_PROGRESS = 2233, - LIMITED_TO_IPV4 = 2234, - LIMITED_TO_IPV6 = 2235, - VSNCP_TIMEOUT = 2236, - VSNCP_GEN_ERROR = 2237, - VSNCP_APN_UNAUTHORIZED = 2238, - VSNCP_PDN_LIMIT_EXCEEDED = 2239, - VSNCP_NO_PDN_GATEWAY_ADDRESS = 2240, - VSNCP_PDN_GATEWAY_UNREACHABLE = 2241, - VSNCP_PDN_GATEWAY_REJECT = 2242, - VSNCP_INSUFFICIENT_PARAMETERS = 2243, - VSNCP_RESOURCE_UNAVAILABLE = 2244, - VSNCP_ADMINISTRATIVELY_PROHIBITED = 2245, - VSNCP_PDN_ID_IN_USE = 2246, - VSNCP_SUBSCRIBER_LIMITATION = 2247, - VSNCP_PDN_EXISTS_FOR_THIS_APN = 2248, - VSNCP_RECONNECT_NOT_ALLOWED = 2249, - IPV6_PREFIX_UNAVAILABLE = 2250, - HANDOFF_PREFERENCE_CHANGED = 2251, - SLICE_REJECTED = 2252, - MATCH_ALL_RULE_NOT_ALLOWED = 2253, - ALL_MATCHING_RULES_FAILED = 2254, + OPERATOR_BARRED = 0x08, + NAS_SIGNALLING = 0x0E, + INSUFFICIENT_RESOURCES = 0x1A, + MISSING_UNKNOWN_APN = 0x1B, + UNKNOWN_PDP_ADDRESS_TYPE = 0x1C, + USER_AUTHENTICATION = 0x1D, + ACTIVATION_REJECT_GGSN = 0x1E, + ACTIVATION_REJECT_UNSPECIFIED = 0x1F, + SERVICE_OPTION_NOT_SUPPORTED = 0x20, + SERVICE_OPTION_NOT_SUBSCRIBED = 0x21, + SERVICE_OPTION_OUT_OF_ORDER = 0x22, + NSAPI_IN_USE = 0x23, + REGULAR_DEACTIVATION = 0x24, + QOS_NOT_ACCEPTED = 0x25, + NETWORK_FAILURE = 0x26, + UMTS_REACTIVATION_REQ = 0x27, + FEATURE_NOT_SUPP = 0x28, + TFT_SEMANTIC_ERROR = 0x29, + TFT_SYTAX_ERROR = 0x2A, + UNKNOWN_PDP_CONTEXT = 0x2B, + FILTER_SEMANTIC_ERROR = 0x2C, + FILTER_SYTAX_ERROR = 0x2D, + PDP_WITHOUT_ACTIVE_TFT = 0x2E, + ONLY_IPV4_ALLOWED = 0x32, + ONLY_IPV6_ALLOWED = 0x33, + ONLY_SINGLE_BEARER_ALLOWED = 0x34, + ESM_INFO_NOT_RECEIVED = 0x35, + PDN_CONN_DOES_NOT_EXIST = 0x36, + MULTI_CONN_TO_SAME_PDN_NOT_ALLOWED = 0x37, + MAX_ACTIVE_PDP_CONTEXT_REACHED = 0x41, + UNSUPPORTED_APN_IN_CURRENT_PLMN = 0x42, + INVALID_TRANSACTION_ID = 0x51, + MESSAGE_INCORRECT_SEMANTIC = 0x5F, + INVALID_MANDATORY_INFO = 0x60, + MESSAGE_TYPE_UNSUPPORTED = 0x61, + MSG_TYPE_NONCOMPATIBLE_STATE = 0x62, + UNKNOWN_INFO_ELEMENT = 0x63, + CONDITIONAL_IE_ERROR = 0x64, + MSG_AND_PROTOCOL_STATE_UNCOMPATIBLE = 0x65, + PROTOCOL_ERRORS = 0x6F, + APN_TYPE_CONFLICT = 0x70, + INVALID_PCSCF_ADDR = 0x71, + INTERNAL_CALL_PREEMPT_BY_HIGH_PRIO_APN = 0x72, + EMM_ACCESS_BARRED = 0x73, + EMERGENCY_IFACE_ONLY = 0x74, + IFACE_MISMATCH = 0x75, + COMPANION_IFACE_IN_USE = 0x76, + IP_ADDRESS_MISMATCH = 0x77, + IFACE_AND_POL_FAMILY_MISMATCH = 0x78, + EMM_ACCESS_BARRED_INFINITE_RETRY = 0x79, + AUTH_FAILURE_ON_EMERGENCY_CALL = 0x7A, + OEM_DCFAILCAUSE_1 = 0x1001, + OEM_DCFAILCAUSE_2 = 0x1002, + OEM_DCFAILCAUSE_3 = 0x1003, + OEM_DCFAILCAUSE_4 = 0x1004, + OEM_DCFAILCAUSE_5 = 0x1005, + OEM_DCFAILCAUSE_6 = 0x1006, + OEM_DCFAILCAUSE_7 = 0x1007, + OEM_DCFAILCAUSE_8 = 0x1008, + OEM_DCFAILCAUSE_9 = 0x1009, + OEM_DCFAILCAUSE_10 = 0x100A, + OEM_DCFAILCAUSE_11 = 0x100B, + OEM_DCFAILCAUSE_12 = 0x100C, + OEM_DCFAILCAUSE_13 = 0x100D, + OEM_DCFAILCAUSE_14 = 0x100E, + OEM_DCFAILCAUSE_15 = 0x100F, + VOICE_REGISTRATION_FAIL = (-1), + DATA_REGISTRATION_FAIL = (-2), + SIGNAL_LOST = (-3), + PREF_RADIO_TECH_CHANGED = (-4), + RADIO_POWER_OFF = (-5), + TETHERED_CALL_ACTIVE = (-6), + ERROR_UNSPECIFIED = 0xffff, + LLC_SNDCP = 0x19, + ACTIVATION_REJECTED_BCM_VIOLATION = 0x30, + COLLISION_WITH_NETWORK_INITIATED_REQUEST = 0x38, + ONLY_IPV4V6_ALLOWED = 0x39, + ONLY_NON_IP_ALLOWED = 0x3A, + UNSUPPORTED_QCI_VALUE = 0x3B, + BEARER_HANDLING_NOT_SUPPORTED = 0x3C, + INVALID_DNS_ADDR = 0x7B, + INVALID_PCSCF_OR_DNS_ADDRESS = 0x7C, + CALL_PREEMPT_BY_EMERGENCY_APN = 0x7F, + UE_INITIATED_DETACH_OR_DISCONNECT = 0x80, + MIP_FA_REASON_UNSPECIFIED = 0x7D0, + MIP_FA_ADMIN_PROHIBITED = 0x7D1, + MIP_FA_INSUFFICIENT_RESOURCES = 0x7D2, + MIP_FA_MOBILE_NODE_AUTHENTICATION_FAILURE = 0x7D3, + MIP_FA_HOME_AGENT_AUTHENTICATION_FAILURE = 0x7D4, + MIP_FA_REQUESTED_LIFETIME_TOO_LONG = 0x7D5, + MIP_FA_MALFORMED_REQUEST = 0x7D6, + MIP_FA_MALFORMED_REPLY = 0x7D7, + MIP_FA_ENCAPSULATION_UNAVAILABLE = 0x7D8, + MIP_FA_VJ_HEADER_COMPRESSION_UNAVAILABLE = 0x7D9, + MIP_FA_REVERSE_TUNNEL_UNAVAILABLE = 0x7DA, + MIP_FA_REVERSE_TUNNEL_IS_MANDATORY = 0x7DB, + MIP_FA_DELIVERY_STYLE_NOT_SUPPORTED = 0x7DC, + MIP_FA_MISSING_NAI = 0x7DD, + MIP_FA_MISSING_HOME_AGENT = 0x7DE, + MIP_FA_MISSING_HOME_ADDRESS = 0x7DF, + MIP_FA_UNKNOWN_CHALLENGE = 0x7E0, + MIP_FA_MISSING_CHALLENGE = 0x7E1, + MIP_FA_STALE_CHALLENGE = 0x7E2, + MIP_HA_REASON_UNSPECIFIED = 0x7E3, + MIP_HA_ADMIN_PROHIBITED = 0x7E4, + MIP_HA_INSUFFICIENT_RESOURCES = 0x7E5, + MIP_HA_MOBILE_NODE_AUTHENTICATION_FAILURE = 0x7E6, + MIP_HA_FOREIGN_AGENT_AUTHENTICATION_FAILURE = 0x7E7, + MIP_HA_REGISTRATION_ID_MISMATCH = 0x7E8, + MIP_HA_MALFORMED_REQUEST = 0x7E9, + MIP_HA_UNKNOWN_HOME_AGENT_ADDRESS = 0x7EA, + MIP_HA_REVERSE_TUNNEL_UNAVAILABLE = 0x7EB, + MIP_HA_REVERSE_TUNNEL_IS_MANDATORY = 0x7EC, + MIP_HA_ENCAPSULATION_UNAVAILABLE = 0x7ED, + CLOSE_IN_PROGRESS = 0x7EE, + NETWORK_INITIATED_TERMINATION = 0x7EF, + MODEM_APP_PREEMPTED = 0x7F0, + PDN_IPV4_CALL_DISALLOWED = 0x7F1, + PDN_IPV4_CALL_THROTTLED = 0x7F2, + PDN_IPV6_CALL_DISALLOWED = 0x7F3, + PDN_IPV6_CALL_THROTTLED = 0x7F4, + MODEM_RESTART = 0x7F5, + PDP_PPP_NOT_SUPPORTED = 0x7F6, + UNPREFERRED_RAT = 0x7F7, + PHYSICAL_LINK_CLOSE_IN_PROGRESS = 0x7F8, + APN_PENDING_HANDOVER = 0x7F9, + PROFILE_BEARER_INCOMPATIBLE = 0x7FA, + SIM_CARD_CHANGED = 0x7FB, + LOW_POWER_MODE_OR_POWERING_DOWN = 0x7FC, + APN_DISABLED = 0x7FD, + MAX_PPP_INACTIVITY_TIMER_EXPIRED = 0x7FE, + IPV6_ADDRESS_TRANSFER_FAILED = 0x7FF, + TRAT_SWAP_FAILED = 0x800, + EHRPD_TO_HRPD_FALLBACK = 0x801, + MIP_CONFIG_FAILURE = 0x802, + PDN_INACTIVITY_TIMER_EXPIRED = 0x803, + MAX_IPV4_CONNECTIONS = 0x804, + MAX_IPV6_CONNECTIONS = 0x805, + APN_MISMATCH = 0x806, + IP_VERSION_MISMATCH = 0x807, + DUN_CALL_DISALLOWED = 0x808, + INTERNAL_EPC_NONEPC_TRANSITION = 0x809, + INTERFACE_IN_USE = 0x80A, + APN_DISALLOWED_ON_ROAMING = 0x80B, + APN_PARAMETERS_CHANGED = 0x80C, + NULL_APN_DISALLOWED = 0x80D, + THERMAL_MITIGATION = 0x80E, + DATA_SETTINGS_DISABLED = 0x80F, + DATA_ROAMING_SETTINGS_DISABLED = 0x810, + DDS_SWITCHED = 0x811, + FORBIDDEN_APN_NAME = 0x812, + DDS_SWITCH_IN_PROGRESS = 0x813, + CALL_DISALLOWED_IN_ROAMING = 0x814, + NON_IP_NOT_SUPPORTED = 0x815, + PDN_NON_IP_CALL_THROTTLED = 0x816, + PDN_NON_IP_CALL_DISALLOWED = 0x817, + CDMA_LOCK = 0x818, + CDMA_INTERCEPT = 0x819, + CDMA_REORDER = 0x81A, + CDMA_RELEASE_DUE_TO_SO_REJECTION = 0x81B, + CDMA_INCOMING_CALL = 0x81C, + CDMA_ALERT_STOP = 0x81D, + CHANNEL_ACQUISITION_FAILURE = 0x81E, + MAX_ACCESS_PROBE = 0x81F, + CONCURRENT_SERVICE_NOT_SUPPORTED_BY_BASE_STATION = 0x820, + NO_RESPONSE_FROM_BASE_STATION = 0x821, + REJECTED_BY_BASE_STATION = 0x822, + CONCURRENT_SERVICES_INCOMPATIBLE = 0x823, + NO_CDMA_SERVICE = 0x824, + RUIM_NOT_PRESENT = 0x825, + CDMA_RETRY_ORDER = 0x826, + ACCESS_BLOCK = 0x827, + ACCESS_BLOCK_ALL = 0x828, + IS707B_MAX_ACCESS_PROBES = 0x829, + THERMAL_EMERGENCY = 0x82A, + CONCURRENT_SERVICES_NOT_ALLOWED = 0x82B, + INCOMING_CALL_REJECTED = 0x82C, + NO_SERVICE_ON_GATEWAY = 0x82D, + NO_GPRS_CONTEXT = 0x82E, + ILLEGAL_MS = 0x82F, + ILLEGAL_ME = 0x830, + GPRS_SERVICES_AND_NON_GPRS_SERVICES_NOT_ALLOWED = 0x831, + GPRS_SERVICES_NOT_ALLOWED = 0x832, + MS_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK = 0x833, + IMPLICITLY_DETACHED = 0x834, + PLMN_NOT_ALLOWED = 0x835, + LOCATION_AREA_NOT_ALLOWED = 0x836, + GPRS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN = 0x837, + PDP_DUPLICATE = 0x838, + UE_RAT_CHANGE = 0x839, + CONGESTION = 0x83A, + NO_PDP_CONTEXT_ACTIVATED = 0x83B, + ACCESS_CLASS_DSAC_REJECTION = 0x83C, + PDP_ACTIVATE_MAX_RETRY_FAILED = 0x83D, + RADIO_ACCESS_BEARER_FAILURE = 0x83E, + ESM_UNKNOWN_EPS_BEARER_CONTEXT = 0x83F, + DRB_RELEASED_BY_RRC = 0x840, + CONNECTION_RELEASED = 0x841, + EMM_DETACHED = 0x842, + EMM_ATTACH_FAILED = 0x843, + EMM_ATTACH_STARTED = 0x844, + LTE_NAS_SERVICE_REQUEST_FAILED = 0x845, + DUPLICATE_BEARER_ID = 0x846, + ESM_COLLISION_SCENARIOS = 0x847, + ESM_BEARER_DEACTIVATED_TO_SYNC_WITH_NETWORK = 0x848, + ESM_NW_ACTIVATED_DED_BEARER_WITH_ID_OF_DEF_BEARER = 0x849, + ESM_BAD_OTA_MESSAGE = 0x84A, + ESM_DOWNLOAD_SERVER_REJECTED_THE_CALL = 0x84B, + ESM_CONTEXT_TRANSFERRED_DUE_TO_IRAT = 0x84C, + DS_EXPLICIT_DEACTIVATION = 0x84D, + ESM_LOCAL_CAUSE_NONE = 0x84E, + LTE_THROTTLING_NOT_REQUIRED = 0x84F, + ACCESS_CONTROL_LIST_CHECK_FAILURE = 0x850, + SERVICE_NOT_ALLOWED_ON_PLMN = 0x851, + EMM_T3417_EXPIRED = 0x852, + EMM_T3417_EXT_EXPIRED = 0x853, + RRC_UPLINK_DATA_TRANSMISSION_FAILURE = 0x854, + RRC_UPLINK_DELIVERY_FAILED_DUE_TO_HANDOVER = 0x855, + RRC_UPLINK_CONNECTION_RELEASE = 0x856, + RRC_UPLINK_RADIO_LINK_FAILURE = 0x857, + RRC_UPLINK_ERROR_REQUEST_FROM_NAS = 0x858, + RRC_CONNECTION_ACCESS_STRATUM_FAILURE = 0x859, + RRC_CONNECTION_ANOTHER_PROCEDURE_IN_PROGRESS = 0x85A, + RRC_CONNECTION_ACCESS_BARRED = 0x85B, + RRC_CONNECTION_CELL_RESELECTION = 0x85C, + RRC_CONNECTION_CONFIG_FAILURE = 0x85D, + RRC_CONNECTION_TIMER_EXPIRED = 0x85E, + RRC_CONNECTION_LINK_FAILURE = 0x85F, + RRC_CONNECTION_CELL_NOT_CAMPED = 0x860, + RRC_CONNECTION_SYSTEM_INTERVAL_FAILURE = 0x861, + RRC_CONNECTION_REJECT_BY_NETWORK = 0x862, + RRC_CONNECTION_NORMAL_RELEASE = 0x863, + RRC_CONNECTION_RADIO_LINK_FAILURE = 0x864, + RRC_CONNECTION_REESTABLISHMENT_FAILURE = 0x865, + RRC_CONNECTION_OUT_OF_SERVICE_DURING_CELL_REGISTER = 0x866, + RRC_CONNECTION_ABORT_REQUEST = 0x867, + RRC_CONNECTION_SYSTEM_INFORMATION_BLOCK_READ_ERROR = 0x868, + NETWORK_INITIATED_DETACH_WITH_AUTO_REATTACH = 0x869, + NETWORK_INITIATED_DETACH_NO_AUTO_REATTACH = 0x86A, + ESM_PROCEDURE_TIME_OUT = 0x86B, + INVALID_CONNECTION_ID = 0x86C, + MAXIMIUM_NSAPIS_EXCEEDED = 0x86D, + INVALID_PRIMARY_NSAPI = 0x86E, + CANNOT_ENCODE_OTA_MESSAGE = 0x86F, + RADIO_ACCESS_BEARER_SETUP_FAILURE = 0x870, + PDP_ESTABLISH_TIMEOUT_EXPIRED = 0x871, + PDP_MODIFY_TIMEOUT_EXPIRED = 0x872, + PDP_INACTIVE_TIMEOUT_EXPIRED = 0x873, + PDP_LOWERLAYER_ERROR = 0x874, + PDP_MODIFY_COLLISION = 0x875, + MAXINUM_SIZE_OF_L2_MESSAGE_EXCEEDED = 0x876, + NAS_REQUEST_REJECTED_BY_NETWORK = 0x877, + RRC_CONNECTION_INVALID_REQUEST = 0x878, + RRC_CONNECTION_TRACKING_AREA_ID_CHANGED = 0x879, + RRC_CONNECTION_RF_UNAVAILABLE = 0x87A, + RRC_CONNECTION_ABORTED_DUE_TO_IRAT_CHANGE = 0x87B, + RRC_CONNECTION_RELEASED_SECURITY_NOT_ACTIVE = 0x87C, + RRC_CONNECTION_ABORTED_AFTER_HANDOVER = 0x87D, + RRC_CONNECTION_ABORTED_AFTER_IRAT_CELL_CHANGE = 0x87E, + RRC_CONNECTION_ABORTED_DURING_IRAT_CELL_CHANGE = 0x87F, + IMSI_UNKNOWN_IN_HOME_SUBSCRIBER_SERVER = 0x880, + IMEI_NOT_ACCEPTED = 0x881, + EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED = 0x882, + EPS_SERVICES_NOT_ALLOWED_IN_PLMN = 0x883, + MSC_TEMPORARILY_NOT_REACHABLE = 0x884, + CS_DOMAIN_NOT_AVAILABLE = 0x885, + ESM_FAILURE = 0x886, + MAC_FAILURE = 0x887, + SYNCHRONIZATION_FAILURE = 0x888, + UE_SECURITY_CAPABILITIES_MISMATCH = 0x889, + SECURITY_MODE_REJECTED = 0x88A, + UNACCEPTABLE_NON_EPS_AUTHENTICATION = 0x88B, + CS_FALLBACK_CALL_ESTABLISHMENT_NOT_ALLOWED = 0x88C, + NO_EPS_BEARER_CONTEXT_ACTIVATED = 0x88D, + INVALID_EMM_STATE = 0x88E, + NAS_LAYER_FAILURE = 0x88F, + MULTIPLE_PDP_CALL_NOT_ALLOWED = 0x890, + EMBMS_NOT_ENABLED = 0x891, + IRAT_HANDOVER_FAILED = 0x892, + EMBMS_REGULAR_DEACTIVATION = 0x893, + TEST_LOOPBACK_REGULAR_DEACTIVATION = 0x894, + LOWER_LAYER_REGISTRATION_FAILURE = 0x895, + DATA_PLAN_EXPIRED = 0x896, + UMTS_HANDOVER_TO_IWLAN = 0x897, + EVDO_CONNECTION_DENY_BY_GENERAL_OR_NETWORK_BUSY = 0x898, + EVDO_CONNECTION_DENY_BY_BILLING_OR_AUTHENTICATION_FAILURE = 0x899, + EVDO_HDR_CHANGED = 0x89A, + EVDO_HDR_EXITED = 0x89B, + EVDO_HDR_NO_SESSION = 0x89C, + EVDO_USING_GPS_FIX_INSTEAD_OF_HDR_CALL = 0x89D, + EVDO_HDR_CONNECTION_SETUP_TIMEOUT = 0x89E, + FAILED_TO_ACQUIRE_COLOCATED_HDR = 0x89F, + OTASP_COMMIT_IN_PROGRESS = 0x8A0, + NO_HYBRID_HDR_SERVICE = 0x8A1, + HDR_NO_LOCK_GRANTED = 0x8A2, + DBM_OR_SMS_IN_PROGRESS = 0x8A3, + HDR_FADE = 0x8A4, + HDR_ACCESS_FAILURE = 0x8A5, + UNSUPPORTED_1X_PREV = 0x8A6, + LOCAL_END = 0x8A7, + NO_SERVICE = 0x8A8, + FADE = 0x8A9, + NORMAL_RELEASE = 0x8AA, + ACCESS_ATTEMPT_ALREADY_IN_PROGRESS = 0x8AB, + REDIRECTION_OR_HANDOFF_IN_PROGRESS = 0x8AC, + EMERGENCY_MODE = 0x8AD, + PHONE_IN_USE = 0x8AE, + INVALID_MODE = 0x8AF, + INVALID_SIM_STATE = 0x8B0, + NO_COLLOCATED_HDR = 0x8B1, + UE_IS_ENTERING_POWERSAVE_MODE = 0x8B2, + DUAL_SWITCH = 0x8B3, + PPP_TIMEOUT = 0x8B4, + PPP_AUTH_FAILURE = 0x8B5, + PPP_OPTION_MISMATCH = 0x8B6, + PPP_PAP_FAILURE = 0x8B7, + PPP_CHAP_FAILURE = 0x8B8, + PPP_CLOSE_IN_PROGRESS = 0x8B9, + LIMITED_TO_IPV4 = 0x8BA, + LIMITED_TO_IPV6 = 0x8BB, + VSNCP_TIMEOUT = 0x8BC, + VSNCP_GEN_ERROR = 0x8BD, + VSNCP_APN_UNAUTHORIZED = 0x8BE, + VSNCP_PDN_LIMIT_EXCEEDED = 0x8BF, + VSNCP_NO_PDN_GATEWAY_ADDRESS = 0x8C0, + VSNCP_PDN_GATEWAY_UNREACHABLE = 0x8C1, + VSNCP_PDN_GATEWAY_REJECT = 0x8C2, + VSNCP_INSUFFICIENT_PARAMETERS = 0x8C3, + VSNCP_RESOURCE_UNAVAILABLE = 0x8C4, + VSNCP_ADMINISTRATIVELY_PROHIBITED = 0x8C5, + VSNCP_PDN_ID_IN_USE = 0x8C6, + VSNCP_SUBSCRIBER_LIMITATION = 0x8C7, + VSNCP_PDN_EXISTS_FOR_THIS_APN = 0x8C8, + VSNCP_RECONNECT_NOT_ALLOWED = 0x8C9, + IPV6_PREFIX_UNAVAILABLE = 0x8CA, + HANDOFF_PREFERENCE_CHANGED = 0x8CB, + SLICE_REJECTED = 0x8CC, + MATCH_ALL_RULE_NOT_ALLOWED = 0x8CD, + ALL_MATCHING_RULES_FAILED = 0x8CE, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataProfileInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataProfileInfo.aidl index 16fada1d76..0136fa4a5a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataProfileInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataProfileInfo.aidl @@ -60,7 +60,7 @@ parcelable DataProfileInfo { const int ID_FOTA = 3; const int ID_CBS = 4; const int ID_OEM_BASE = 1000; - const int ID_INVALID = -1; + const int ID_INVALID = 0xFFFFFFFF; const int TYPE_COMMON = 0; const int TYPE_3GPP = 1; const int TYPE_3GPP2 = 2; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataThrottlingAction.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataThrottlingAction.aidl index 4f976cd593..e80a764046 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataThrottlingAction.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataThrottlingAction.aidl @@ -34,8 +34,8 @@ package android.hardware.radio.data; @Backing(type="byte") @JavaDerive(toString=true) @VintfStability enum DataThrottlingAction { - NO_DATA_THROTTLING = 0, - THROTTLE_SECONDARY_CARRIER = 1, - THROTTLE_ANCHOR_CARRIER = 2, - HOLD = 3, + NO_DATA_THROTTLING, + THROTTLE_SECONDARY_CARRIER, + THROTTLE_ANCHOR_CARRIER, + HOLD, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/LinkAddress.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/LinkAddress.aidl index 48e646ea22..77d637b9b9 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/LinkAddress.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/LinkAddress.aidl @@ -39,5 +39,5 @@ parcelable LinkAddress { long deprecationTime; long expirationTime; const int ADDRESS_PROPERTY_NONE = 0; - const int ADDRESS_PROPERTY_DEPRECATED = 32; + const int ADDRESS_PROPERTY_DEPRECATED = 0x20; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PdpProtocolType.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PdpProtocolType.aidl index 9771e5ccc1..d1c4a62a31 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PdpProtocolType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/PdpProtocolType.aidl @@ -34,7 +34,7 @@ package android.hardware.radio.data; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum PdpProtocolType { - UNKNOWN = -1, + UNKNOWN = (-1), IP = 0, IPV6 = 1, IPV4V6 = 2, diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilter.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilter.aidl index e22b359163..de45cc5f32 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilter.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/QosFilter.aidl @@ -47,7 +47,7 @@ parcelable QosFilter { const byte DIRECTION_DOWNLINK = 0; const byte DIRECTION_UPLINK = 1; const byte DIRECTION_BIDIRECTIONAL = 2; - const byte PROTOCOL_UNSPECIFIED = -1; + const byte PROTOCOL_UNSPECIFIED = (-1); const byte PROTOCOL_TCP = 6; const byte PROTOCOL_UDP = 17; const byte PROTOCOL_ESP = 50; diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/RouteSelectionDescriptor.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/RouteSelectionDescriptor.aidl index 434ee7d102..d83df81a38 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/RouteSelectionDescriptor.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/RouteSelectionDescriptor.aidl @@ -39,7 +39,7 @@ parcelable RouteSelectionDescriptor { byte sscMode; android.hardware.radio.data.SliceInfo[] sliceInfo; String[] dnn; - const byte SSC_MODE_UNKNOWN = -1; + const byte SSC_MODE_UNKNOWN = (-1); const byte SSC_MODE_1 = 1; const byte SSC_MODE_2 = 2; const byte SSC_MODE_3 = 3; diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl index 5179169e12..84376b7c96 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl @@ -34,13 +34,13 @@ package android.hardware.radio.ims.media; @Backing(type="int") @VintfStability enum AmrMode { - AMR_MODE_0 = 1 << 0, - AMR_MODE_1 = 1 << 1, - AMR_MODE_2 = 1 << 2, - AMR_MODE_3 = 1 << 3, - AMR_MODE_4 = 1 << 4, - AMR_MODE_5 = 1 << 5, - AMR_MODE_6 = 1 << 6, - AMR_MODE_7 = 1 << 7, - AMR_MODE_8 = 1 << 8, + AMR_MODE_0 = (1 << 0), + AMR_MODE_1 = (1 << 1), + AMR_MODE_2 = (1 << 2), + AMR_MODE_3 = (1 << 3), + AMR_MODE_4 = (1 << 4), + AMR_MODE_5 = (1 << 5), + AMR_MODE_6 = (1 << 6), + AMR_MODE_7 = (1 << 7), + AMR_MODE_8 = (1 << 8), } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl index 711ac19ac4..e1fb376f11 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl @@ -36,5 +36,5 @@ package android.hardware.radio.ims.media; parcelable AnbrBitrate { int uplinkBps; int downlinkBps; - const int INVALID_ANBR_BITRATE = -1; + const int INVALID_ANBR_BITRATE = (-1); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl index 56d28009f9..9eaf129d66 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl @@ -34,9 +34,9 @@ package android.hardware.radio.ims.media; @Backing(type="int") @VintfStability enum CodecType { - AMR = 1, - AMR_WB = 2, - EVS = 4, - PCMA = 8, - PCMU = 16, + AMR = (1 << 0), + AMR_WB = (1 << 1), + EVS = (1 << 2), + PCMA = (1 << 3), + PCMU = (1 << 4), } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl index eb31175f25..5e80f9170a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl @@ -35,8 +35,8 @@ package android.hardware.radio.ims.media; @Backing(type="int") @VintfStability enum EvsBandwidth { NONE = 0, - NARROW_BAND = 1, - WIDE_BAND = 2, - SUPER_WIDE_BAND = 4, - FULL_BAND = 8, + NARROW_BAND = (1 << 0), + WIDE_BAND = (1 << 1), + SUPER_WIDE_BAND = (1 << 2), + FULL_BAND = (1 << 3), } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl index a067357afa..a530a8d178 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl @@ -34,25 +34,25 @@ package android.hardware.radio.ims.media; @Backing(type="int") @VintfStability enum EvsMode { - EVS_MODE_0 = 1 << 0, - EVS_MODE_1 = 1 << 1, - EVS_MODE_2 = 1 << 2, - EVS_MODE_3 = 1 << 3, - EVS_MODE_4 = 1 << 4, - EVS_MODE_5 = 1 << 5, - EVS_MODE_6 = 1 << 6, - EVS_MODE_7 = 1 << 7, - EVS_MODE_8 = 1 << 8, - EVS_MODE_9 = 1 << 9, - EVS_MODE_10 = 1 << 10, - EVS_MODE_11 = 1 << 11, - EVS_MODE_12 = 1 << 12, - EVS_MODE_13 = 1 << 13, - EVS_MODE_14 = 1 << 14, - EVS_MODE_15 = 1 << 15, - EVS_MODE_16 = 1 << 16, - EVS_MODE_17 = 1 << 17, - EVS_MODE_18 = 1 << 18, - EVS_MODE_19 = 1 << 19, - EVS_MODE_20 = 1 << 20, + EVS_MODE_0 = (1 << 0), + EVS_MODE_1 = (1 << 1), + EVS_MODE_2 = (1 << 2), + EVS_MODE_3 = (1 << 3), + EVS_MODE_4 = (1 << 4), + EVS_MODE_5 = (1 << 5), + EVS_MODE_6 = (1 << 6), + EVS_MODE_7 = (1 << 7), + EVS_MODE_8 = (1 << 8), + EVS_MODE_9 = (1 << 9), + EVS_MODE_10 = (1 << 10), + EVS_MODE_11 = (1 << 11), + EVS_MODE_12 = (1 << 12), + EVS_MODE_13 = (1 << 13), + EVS_MODE_14 = (1 << 14), + EVS_MODE_15 = (1 << 15), + EVS_MODE_16 = (1 << 16), + EVS_MODE_17 = (1 << 17), + EVS_MODE_18 = (1 << 18), + EVS_MODE_19 = (1 << 19), + EVS_MODE_20 = (1 << 20), } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl index 2eefe6fee8..06637540e9 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl @@ -35,11 +35,11 @@ package android.hardware.radio.ims.media; @Backing(type="int") @VintfStability enum RtcpXrReportBlockType { RTCPXR_NONE = 0, - RTCPXR_LOSS_RLE_REPORT_BLOCK = 1, - RTCPXR_DUPLICATE_RLE_REPORT_BLOCK = 2, - RTCPXR_PACKET_RECEIPT_TIMES_REPORT_BLOCK = 4, - RTCPXR_RECEIVER_REFERENCE_TIME_REPORT_BLOCK = 8, - RTCPXR_DLRR_REPORT_BLOCK = 16, - RTCPXR_STATISTICS_SUMMARY_REPORT_BLOCK = 32, - RTCPXR_VOIP_METRICS_REPORT_BLOCK = 64, + RTCPXR_LOSS_RLE_REPORT_BLOCK = (1 << 0), + RTCPXR_DUPLICATE_RLE_REPORT_BLOCK = (1 << 1), + RTCPXR_PACKET_RECEIPT_TIMES_REPORT_BLOCK = (1 << 2), + RTCPXR_RECEIVER_REFERENCE_TIME_REPORT_BLOCK = (1 << 3), + RTCPXR_DLRR_REPORT_BLOCK = (1 << 4), + RTCPXR_STATISTICS_SUMMARY_REPORT_BLOCK = (1 << 5), + RTCPXR_VOIP_METRICS_REPORT_BLOCK = (1 << 6), } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ConnectionFailureInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ConnectionFailureInfo.aidl index 030479f336..90e75f96e1 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ConnectionFailureInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ConnectionFailureInfo.aidl @@ -48,6 +48,6 @@ parcelable ConnectionFailureInfo { REASON_NO_SERVICE = 7, REASON_PDN_NOT_AVAILABLE = 8, REASON_RF_BUSY = 9, - REASON_UNSPECIFIED = 65535, + REASON_UNSPECIFIED = 0xFFFF, } } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsCall.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsCall.aidl index e48653bfd4..6e14830012 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsCall.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsCall.aidl @@ -42,23 +42,23 @@ parcelable ImsCall { boolean isHeldByRemote; @Backing(type="int") enum CallType { - NORMAL = 0, - EMERGENCY = 1, + NORMAL, + EMERGENCY, } @Backing(type="int") enum CallState { - ACTIVE = 0, - HOLDING = 1, - DIALING = 2, - ALERTING = 3, - INCOMING = 4, - WAITING = 5, - DISCONNECTING = 6, - DISCONNECTED = 7, + ACTIVE, + HOLDING, + DIALING, + ALERTING, + INCOMING, + WAITING, + DISCONNECTING, + DISCONNECTED, } @Backing(type="int") enum Direction { - INCOMING = 0, - OUTGOING = 1, + INCOMING, + OUTGOING, } } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl index 1c4c12a029..be5e0045e3 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistration.aidl @@ -39,8 +39,8 @@ parcelable ImsRegistration { android.hardware.radio.ims.SuggestedAction suggestedAction; int capabilities; const int IMS_MMTEL_CAPABILITY_NONE = 0; - const int IMS_MMTEL_CAPABILITY_VOICE = 1; - const int IMS_MMTEL_CAPABILITY_VIDEO = 2; - const int IMS_MMTEL_CAPABILITY_SMS = 4; - const int IMS_RCS_CAPABILITIES = 8; + const int IMS_MMTEL_CAPABILITY_VOICE = (1 << 0); + const int IMS_MMTEL_CAPABILITY_VIDEO = (1 << 1); + const int IMS_MMTEL_CAPABILITY_SMS = (1 << 2); + const int IMS_RCS_CAPABILITIES = (1 << 3); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistrationState.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistrationState.aidl index 664f56183d..6302b4798d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistrationState.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsRegistrationState.aidl @@ -34,6 +34,6 @@ package android.hardware.radio.ims; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ImsRegistrationState { - NOT_REGISTERED = 0, - REGISTERED = 1, + NOT_REGISTERED, + REGISTERED, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl index f7654b47fb..b1a0b770cd 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/ImsTrafficType.aidl @@ -34,11 +34,11 @@ package android.hardware.radio.ims; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ImsTrafficType { - EMERGENCY = 0, - EMERGENCY_SMS = 1, - VOICE = 2, - VIDEO = 3, - SMS = 4, - REGISTRATION = 5, - UT_XCAP = 6, + EMERGENCY, + EMERGENCY_SMS, + VOICE, + VIDEO, + SMS, + REGISTRATION, + UT_XCAP, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl index a8b7cfc250..5119b0ff02 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SrvccCall.aidl @@ -47,18 +47,18 @@ parcelable SrvccCall { int namePresentation; @Backing(type="int") @VintfStability enum CallType { - NORMAL = 0, - EMERGENCY = 1, + NORMAL, + EMERGENCY, } @Backing(type="int") @VintfStability enum CallSubState { - NONE = 0, - PREALERTING = 1, + NONE, + PREALERTING, } @Backing(type="int") @VintfStability enum ToneType { - NONE = 0, - LOCAL = 1, - NETWORK = 2, + NONE, + LOCAL, + NETWORK, } } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SuggestedAction.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SuggestedAction.aidl index da19774ef8..bbe170e445 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SuggestedAction.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/current/android/hardware/radio/ims/SuggestedAction.aidl @@ -34,7 +34,7 @@ package android.hardware.radio.ims; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum SuggestedAction { - NONE = 0, - TRIGGER_PLMN_BLOCK = 1, - TRIGGER_PLMN_BLOCK_WITH_TIMEOUT = 2, + NONE, + TRIGGER_PLMN_BLOCK, + TRIGGER_PLMN_BLOCK_WITH_TIMEOUT, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/SmsAcknowledgeFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/SmsAcknowledgeFailCause.aidl index 019b18539f..d061c9ea17 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/SmsAcknowledgeFailCause.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/current/android/hardware/radio/messaging/SmsAcknowledgeFailCause.aidl @@ -34,6 +34,6 @@ package android.hardware.radio.messaging; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum SmsAcknowledgeFailCause { - MEMORY_CAPACITY_EXCEEDED = 211, - UNSPECIFIED_ERROR = 255, + MEMORY_CAPACITY_EXCEEDED = 0xD3, + UNSPECIFIED_ERROR = 0XFF, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/DeviceStateType.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/DeviceStateType.aidl index 4e8c6d7545..acc0b22bb8 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/DeviceStateType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/DeviceStateType.aidl @@ -34,7 +34,7 @@ package android.hardware.radio.modem; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum DeviceStateType { - POWER_SAVE_MODE = 0, - CHARGING_STATE = 1, - LOW_DATA_EXPECTED = 2, + POWER_SAVE_MODE, + CHARGING_STATE, + LOW_DATA_EXPECTED, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ImeiInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ImeiInfo.aidl index dda706258b..f8776ec412 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ImeiInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ImeiInfo.aidl @@ -34,12 +34,12 @@ package android.hardware.radio.modem; @JavaDerive(toString=true) @VintfStability parcelable ImeiInfo { + android.hardware.radio.modem.ImeiInfo.ImeiType type; + String imei; + String svn; @Backing(type="int") @VintfStability enum ImeiType { PRIMARY = 1, SECONDARY = 2, } - ImeiType type; - String imei; - String svn; -} \ No newline at end of file +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ResetNvType.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ResetNvType.aidl index e3b5796cfc..37622b1312 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ResetNvType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ResetNvType.aidl @@ -34,7 +34,7 @@ package android.hardware.radio.modem; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ResetNvType { - RELOAD = 0, - ERASE = 1, - FACTORY_RESET = 2, + RELOAD, + ERASE, + FACTORY_RESET, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/Cdma2000RegistrationInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/Cdma2000RegistrationInfo.aidl index 74c4e29d2b..927f9ac695 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/Cdma2000RegistrationInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/Cdma2000RegistrationInfo.aidl @@ -38,7 +38,7 @@ parcelable Cdma2000RegistrationInfo { int roamingIndicator; int systemIsInPrl; int defaultRoamingIndicator; - const int PRL_INDICATOR_NOT_REGISTERED = -1; + const int PRL_INDICATOR_NOT_REGISTERED = (-1); const int PRL_INDICATOR_NOT_IN_PRL = 0; const int PRL_INDICATOR_IN_PRL = 1; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CdmaRoamingType.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CdmaRoamingType.aidl index 24ec26b893..2a4db70cab 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CdmaRoamingType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CdmaRoamingType.aidl @@ -34,7 +34,7 @@ package android.hardware.radio.network; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum CdmaRoamingType { - HOME_NETWORK = 0, - AFFILIATED_ROAM = 1, - ANY_ROAM = 2, + HOME_NETWORK, + AFFILIATED_ROAM, + ANY_ROAM, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellConnectionStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellConnectionStatus.aidl index 8986d719c4..5ce3b3e613 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellConnectionStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/CellConnectionStatus.aidl @@ -34,7 +34,7 @@ package android.hardware.radio.network; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum CellConnectionStatus { - NONE = 0, - PRIMARY_SERVING = 1, - SECONDARY_SERVING = 2, + NONE, + PRIMARY_SERVING, + SECONDARY_SERVING, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/Domain.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/Domain.aidl index 209cf5e802..6b022b6955 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/Domain.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/Domain.aidl @@ -34,6 +34,6 @@ package android.hardware.radio.network; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum Domain { - CS = 1, - PS = 2, + CS = (1 << 0), + PS = (1 << 1), } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl index 93df3a4da9..90e342a9b7 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/EutranRegistrationInfo.aidl @@ -38,11 +38,11 @@ parcelable EutranRegistrationInfo { android.hardware.radio.network.NrIndicators nrIndicators; android.hardware.radio.network.EutranRegistrationInfo.AttachResultType lteAttachResultType; int extraInfo; - const int EXTRA_CSFB_NOT_PREFERRED = 1; - const int EXTRA_SMS_ONLY = 2; + const int EXTRA_CSFB_NOT_PREFERRED = (1 << 0); + const int EXTRA_SMS_ONLY = (1 << 1); enum AttachResultType { - NONE = 0, - EPS_ONLY = 1, - COMBINED = 2, + NONE, + EPS_ONLY, + COMBINED, } } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IndicationFilter.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IndicationFilter.aidl index d9ed68ed6d..00ba3469c7 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IndicationFilter.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/IndicationFilter.aidl @@ -35,12 +35,12 @@ package android.hardware.radio.network; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum IndicationFilter { NONE = 0, - ALL = -1, - SIGNAL_STRENGTH = 1, - FULL_NETWORK_STATE = 2, - DATA_CALL_DORMANCY_CHANGED = 4, - LINK_CAPACITY_ESTIMATE = 8, - PHYSICAL_CHANNEL_CONFIG = 16, - REGISTRATION_FAILURE = 32, - BARRING_INFO = 64, + ALL = (~0), + SIGNAL_STRENGTH = (1 << 0), + FULL_NETWORK_STATE = (1 << 1), + DATA_CALL_DORMANCY_CHANGED = (1 << 2), + LINK_CAPACITY_ESTIMATE = (1 << 3), + PHYSICAL_CHANNEL_CONFIG = (1 << 4), + REGISTRATION_FAILURE = (1 << 5), + BARRING_INFO = (1 << 6), } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/PhoneRestrictedState.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/PhoneRestrictedState.aidl index 41555f9e3d..4e3e39eab0 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/PhoneRestrictedState.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/PhoneRestrictedState.aidl @@ -34,9 +34,9 @@ package android.hardware.radio.network; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum PhoneRestrictedState { - NONE = 0, - CS_EMERGENCY = 1, - CS_NORMAL = 2, - CS_ALL = 4, - PS_ALL = 16, + NONE = 0x00, + CS_EMERGENCY = 0x01, + CS_NORMAL = 0x02, + CS_ALL = 0x04, + PS_ALL = 0x10, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RadioBandMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RadioBandMode.aidl index e9a9f6034c..74696fbfbf 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RadioBandMode.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RadioBandMode.aidl @@ -34,23 +34,23 @@ package android.hardware.radio.network; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RadioBandMode { - BAND_MODE_UNSPECIFIED = 0, - BAND_MODE_EURO = 1, - BAND_MODE_USA = 2, - BAND_MODE_JPN = 3, - BAND_MODE_AUS = 4, - BAND_MODE_AUS_2 = 5, - BAND_MODE_CELL_800 = 6, - BAND_MODE_PCS = 7, - BAND_MODE_JTACS = 8, - BAND_MODE_KOREA_PCS = 9, - BAND_MODE_5_450M = 10, - BAND_MODE_IMT2000 = 11, - BAND_MODE_7_700M_2 = 12, - BAND_MODE_8_1800M = 13, - BAND_MODE_9_900M = 14, - BAND_MODE_10_800M_2 = 15, - BAND_MODE_EURO_PAMR_400M = 16, - BAND_MODE_AWS = 17, - BAND_MODE_USA_2500M = 18, + BAND_MODE_UNSPECIFIED, + BAND_MODE_EURO, + BAND_MODE_USA, + BAND_MODE_JPN, + BAND_MODE_AUS, + BAND_MODE_AUS_2, + BAND_MODE_CELL_800, + BAND_MODE_PCS, + BAND_MODE_JTACS, + BAND_MODE_KOREA_PCS, + BAND_MODE_5_450M, + BAND_MODE_IMT2000, + BAND_MODE_7_700M_2, + BAND_MODE_8_1800M, + BAND_MODE_9_900M, + BAND_MODE_10_800M_2, + BAND_MODE_EURO_PAMR_400M, + BAND_MODE_AWS, + BAND_MODE_USA_2500M, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegistrationFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegistrationFailCause.aidl index e2cd44ce0c..8acf8ab22d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegistrationFailCause.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/RegistrationFailCause.aidl @@ -56,7 +56,7 @@ enum RegistrationFailCause { CONGESTION = 22, GSM_AUTHENTICATION_UNACCEPTABLE = 23, NOT_AUTHORIZED_FOR_THIS_CSG = 25, - SMS_PROVIDED_BY_GPRS_IN_ROUTING_AREA = 26, + SMS_PROVIDED_BY_GPRS_IN_ROUTING_AREA, SERVICE_OPTION_NOT_SUPPORTED = 32, SERVICE_OPTION_NOT_SUBSCRIBED = 33, SERVICE_OPTION_TEMPORARILY_OUT_OF_ORDER = 34, diff --git a/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapApduType.aidl b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapApduType.aidl index e0e2a03956..6cef92bdf1 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapApduType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapApduType.aidl @@ -34,6 +34,6 @@ package android.hardware.radio.sap; @Backing(type="int") @VintfStability enum SapApduType { - APDU = 0, - APDU7816 = 1, + APDU, + APDU7816, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapConnectRsp.aidl b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapConnectRsp.aidl index aceac3789c..841dfe3e8c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapConnectRsp.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapConnectRsp.aidl @@ -34,9 +34,9 @@ package android.hardware.radio.sap; @Backing(type="int") @VintfStability enum SapConnectRsp { - SUCCESS = 0, - CONNECT_FAILURE = 1, - MSG_SIZE_TOO_LARGE = 2, - MSG_SIZE_TOO_SMALL = 3, - CONNECT_OK_CALL_ONGOING = 4, + SUCCESS, + CONNECT_FAILURE, + MSG_SIZE_TOO_LARGE, + MSG_SIZE_TOO_SMALL, + CONNECT_OK_CALL_ONGOING, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapDisconnectType.aidl b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapDisconnectType.aidl index 0447f9b083..dace1e1ace 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapDisconnectType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapDisconnectType.aidl @@ -34,6 +34,6 @@ package android.hardware.radio.sap; @Backing(type="int") @VintfStability enum SapDisconnectType { - GRACEFUL = 0, - IMMEDIATE = 1, + GRACEFUL, + IMMEDIATE, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapResultCode.aidl b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapResultCode.aidl index 1db226b43c..a2a6df0a05 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapResultCode.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapResultCode.aidl @@ -34,12 +34,12 @@ package android.hardware.radio.sap; @Backing(type="int") @VintfStability enum SapResultCode { - SUCCESS = 0, - GENERIC_FAILURE = 1, - CARD_NOT_ACCESSSIBLE = 2, - CARD_ALREADY_POWERED_OFF = 3, - CARD_REMOVED = 4, - CARD_ALREADY_POWERED_ON = 5, - DATA_NOT_AVAILABLE = 6, - NOT_SUPPORTED = 7, + SUCCESS, + GENERIC_FAILURE, + CARD_NOT_ACCESSSIBLE, + CARD_ALREADY_POWERED_OFF, + CARD_REMOVED, + CARD_ALREADY_POWERED_ON, + DATA_NOT_AVAILABLE, + NOT_SUPPORTED, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapStatus.aidl index 32f71c218a..6988c994c9 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapStatus.aidl @@ -34,10 +34,10 @@ package android.hardware.radio.sap; @Backing(type="int") @VintfStability enum SapStatus { - UNKNOWN_ERROR = 0, - CARD_RESET = 1, - CARD_NOT_ACCESSIBLE = 2, - CARD_REMOVED = 3, - CARD_INSERTED = 4, - RECOVERED = 5, + UNKNOWN_ERROR, + CARD_RESET, + CARD_NOT_ACCESSIBLE, + CARD_REMOVED, + CARD_INSERTED, + RECOVERED, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapTransferProtocol.aidl b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapTransferProtocol.aidl index e3ffdb0702..3c6852eb22 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapTransferProtocol.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sap/current/android/hardware/radio/sap/SapTransferProtocol.aidl @@ -34,6 +34,6 @@ package android.hardware.radio.sap; @Backing(type="int") @VintfStability enum SapTransferProtocol { - T0 = 0, - T1 = 1, + T0, + T1, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CardPowerState.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CardPowerState.aidl index 05bc13ac45..6bc3919fb2 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CardPowerState.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CardPowerState.aidl @@ -34,7 +34,7 @@ package android.hardware.radio.sim; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum CardPowerState { - POWER_DOWN = 0, - POWER_UP = 1, - POWER_UP_PASS_THROUGH = 2, + POWER_DOWN, + POWER_UP, + POWER_UP_PASS_THROUGH, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl index 8a61dca20a..4e2fe455d3 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl @@ -34,15 +34,15 @@ package android.hardware.radio.sim; @JavaDerive(toString=true) @VintfStability parcelable CarrierRestrictions { - @Backing(type="int") @VintfStability - enum CarrierRestrictionStatus { - UNKNOWN = 0, - NOT_RESTRICTED = 1, - RESTRICTED = 2, - } - android.hardware.radio.sim.Carrier[] allowedCarriers; - android.hardware.radio.sim.Carrier[] excludedCarriers; - boolean allowedCarriersPrioritized; - CarrierRestrictionStatus status; - int carrierId; + android.hardware.radio.sim.Carrier[] allowedCarriers; + android.hardware.radio.sim.Carrier[] excludedCarriers; + boolean allowedCarriersPrioritized; + android.hardware.radio.sim.CarrierRestrictions.CarrierRestrictionStatus status; + int carrierId; + @Backing(type="int") @VintfStability + enum CarrierRestrictionStatus { + UNKNOWN = 0, + NOT_RESTRICTED = 1, + RESTRICTED = 2, + } } diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CdmaSubscriptionSource.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CdmaSubscriptionSource.aidl index 13469f3d6a..080aa5ed27 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CdmaSubscriptionSource.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CdmaSubscriptionSource.aidl @@ -34,6 +34,6 @@ package android.hardware.radio.sim; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum CdmaSubscriptionSource { - RUIM_SIM = 0, - NV = 1, + RUIM_SIM, + NV, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PersoSubstate.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PersoSubstate.aidl index e33769e812..dc1d960631 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PersoSubstate.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PersoSubstate.aidl @@ -34,39 +34,39 @@ package android.hardware.radio.sim; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum PersoSubstate { - UNKNOWN = 0, - IN_PROGRESS = 1, - READY = 2, - SIM_NETWORK = 3, - SIM_NETWORK_SUBSET = 4, - SIM_CORPORATE = 5, - SIM_SERVICE_PROVIDER = 6, - SIM_SIM = 7, - SIM_NETWORK_PUK = 8, - SIM_NETWORK_SUBSET_PUK = 9, - SIM_CORPORATE_PUK = 10, - SIM_SERVICE_PROVIDER_PUK = 11, - SIM_SIM_PUK = 12, - RUIM_NETWORK1 = 13, - RUIM_NETWORK2 = 14, - RUIM_HRPD = 15, - RUIM_CORPORATE = 16, - RUIM_SERVICE_PROVIDER = 17, - RUIM_RUIM = 18, - RUIM_NETWORK1_PUK = 19, - RUIM_NETWORK2_PUK = 20, - RUIM_HRPD_PUK = 21, - RUIM_CORPORATE_PUK = 22, - RUIM_SERVICE_PROVIDER_PUK = 23, - RUIM_RUIM_PUK = 24, - SIM_SPN = 25, - SIM_SPN_PUK = 26, - SIM_SP_EHPLMN = 27, - SIM_SP_EHPLMN_PUK = 28, - SIM_ICCID = 29, - SIM_ICCID_PUK = 30, - SIM_IMPI = 31, - SIM_IMPI_PUK = 32, - SIM_NS_SP = 33, - SIM_NS_SP_PUK = 34, + UNKNOWN, + IN_PROGRESS, + READY, + SIM_NETWORK, + SIM_NETWORK_SUBSET, + SIM_CORPORATE, + SIM_SERVICE_PROVIDER, + SIM_SIM, + SIM_NETWORK_PUK, + SIM_NETWORK_SUBSET_PUK, + SIM_CORPORATE_PUK, + SIM_SERVICE_PROVIDER_PUK, + SIM_SIM_PUK, + RUIM_NETWORK1, + RUIM_NETWORK2, + RUIM_HRPD, + RUIM_CORPORATE, + RUIM_SERVICE_PROVIDER, + RUIM_RUIM, + RUIM_NETWORK1_PUK, + RUIM_NETWORK2_PUK, + RUIM_HRPD_PUK, + RUIM_CORPORATE_PUK, + RUIM_SERVICE_PROVIDER_PUK, + RUIM_RUIM_PUK, + SIM_SPN, + SIM_SPN_PUK, + SIM_SP_EHPLMN, + SIM_SP_EHPLMN_PUK, + SIM_ICCID, + SIM_ICCID_PUK, + SIM_IMPI, + SIM_IMPI_PUK, + SIM_NS_SP, + SIM_NS_SP_PUK, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PinState.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PinState.aidl index 5cdc6d17d4..663ea734bf 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PinState.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/PinState.aidl @@ -34,10 +34,10 @@ package android.hardware.radio.sim; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum PinState { - UNKNOWN = 0, - ENABLED_NOT_VERIFIED = 1, - ENABLED_VERIFIED = 2, - DISABLED = 3, - ENABLED_BLOCKED = 4, - ENABLED_PERM_BLOCKED = 5, + UNKNOWN, + ENABLED_NOT_VERIFIED, + ENABLED_VERIFIED, + DISABLED, + ENABLED_BLOCKED, + ENABLED_PERM_BLOCKED, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl index 4ded3e96ec..d59fcab886 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl @@ -34,6 +34,6 @@ package android.hardware.radio.sim; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum SimLockMultiSimPolicy { - NO_MULTISIM_POLICY = 0, - ONE_VALID_SIM_MUST_BE_PRESENT = 1, + NO_MULTISIM_POLICY, + ONE_VALID_SIM_MUST_BE_PRESENT, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/AudioQuality.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/AudioQuality.aidl index 15669ac483..1ab29029b9 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/AudioQuality.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/AudioQuality.aidl @@ -34,14 +34,14 @@ package android.hardware.radio.voice; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum AudioQuality { - UNSPECIFIED = 0, - AMR = 1, - AMR_WB = 2, - GSM_EFR = 3, - GSM_FR = 4, - GSM_HR = 5, - EVRC = 6, - EVRC_B = 7, - EVRC_WB = 8, - EVRC_NW = 9, + UNSPECIFIED, + AMR, + AMR_WB, + GSM_EFR, + GSM_FR, + GSM_HR, + EVRC, + EVRC_B, + EVRC_WB, + EVRC_NW, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl index 7877fda730..fad384172b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl @@ -34,16 +34,16 @@ package android.hardware.radio.voice; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum CdmaOtaProvisionStatus { - SPL_UNLOCKED = 0, - SPC_RETRIES_EXCEEDED = 1, - A_KEY_EXCHANGED = 2, - SSD_UPDATED = 3, - NAM_DOWNLOADED = 4, - MDN_DOWNLOADED = 5, - IMSI_DOWNLOADED = 6, - PRL_DOWNLOADED = 7, - COMMITTED = 8, - OTAPA_STARTED = 9, - OTAPA_STOPPED = 10, - OTAPA_ABORTED = 11, + SPL_UNLOCKED, + SPC_RETRIES_EXCEEDED, + A_KEY_EXCHANGED, + SSD_UPDATED, + NAM_DOWNLOADED, + MDN_DOWNLOADED, + IMSI_DOWNLOADED, + PRL_DOWNLOADED, + COMMITTED, + OTAPA_STARTED, + OTAPA_STOPPED, + OTAPA_ABORTED, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/ClipStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/ClipStatus.aidl index 3fbb0d8f7f..a34149ad1b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/ClipStatus.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/ClipStatus.aidl @@ -34,7 +34,7 @@ package android.hardware.radio.voice; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum ClipStatus { - CLIP_PROVISIONED = 0, - CLIP_UNPROVISIONED = 1, - UNKNOWN = 2, + CLIP_PROVISIONED, + CLIP_UNPROVISIONED, + UNKNOWN, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyCallRouting.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyCallRouting.aidl index 07f011d349..4e1dfc09fa 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyCallRouting.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyCallRouting.aidl @@ -34,7 +34,7 @@ package android.hardware.radio.voice; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum EmergencyCallRouting { - UNKNOWN = 0, - EMERGENCY = 1, - NORMAL = 2, + UNKNOWN, + EMERGENCY, + NORMAL, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyNumber.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyNumber.aidl index 98df8cd625..ac3867e72e 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyNumber.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyNumber.aidl @@ -40,8 +40,8 @@ parcelable EmergencyNumber { int categories; String[] urns; int sources; - const int SOURCE_NETWORK_SIGNALING = 1; - const int SOURCE_SIM = 2; - const int SOURCE_MODEM_CONFIG = 4; - const int SOURCE_DEFAULT = 8; + const int SOURCE_NETWORK_SIGNALING = (1 << 0); + const int SOURCE_SIM = (1 << 1); + const int SOURCE_MODEM_CONFIG = (1 << 2); + const int SOURCE_DEFAULT = (1 << 3); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyServiceCategory.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyServiceCategory.aidl index 042dd6155e..0a70d2de95 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyServiceCategory.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/EmergencyServiceCategory.aidl @@ -35,11 +35,11 @@ package android.hardware.radio.voice; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum EmergencyServiceCategory { UNSPECIFIED = 0, - POLICE = 1, - AMBULANCE = 2, - FIRE_BRIGADE = 4, - MARINE_GUARD = 8, - MOUNTAIN_RESCUE = 16, - MIEC = 32, - AIEC = 64, + POLICE = (1 << 0), + AMBULANCE = (1 << 1), + FIRE_BRIGADE = (1 << 2), + MARINE_GUARD = (1 << 3), + MOUNTAIN_RESCUE = (1 << 4), + MIEC = (1 << 5), + AIEC = (1 << 6), } diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/LastCallFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/LastCallFailCause.aidl index 1740134ef0..7d546233f1 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/LastCallFailCause.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/LastCallFailCause.aidl @@ -114,20 +114,20 @@ enum LastCallFailCause { CDMA_PREEMPTED = 1007, CDMA_NOT_EMERGENCY = 1008, CDMA_ACCESS_BLOCKED = 1009, - OEM_CAUSE_1 = 61441, - OEM_CAUSE_2 = 61442, - OEM_CAUSE_3 = 61443, - OEM_CAUSE_4 = 61444, - OEM_CAUSE_5 = 61445, - OEM_CAUSE_6 = 61446, - OEM_CAUSE_7 = 61447, - OEM_CAUSE_8 = 61448, - OEM_CAUSE_9 = 61449, - OEM_CAUSE_10 = 61450, - OEM_CAUSE_11 = 61451, - OEM_CAUSE_12 = 61452, - OEM_CAUSE_13 = 61453, - OEM_CAUSE_14 = 61454, - OEM_CAUSE_15 = 61455, - ERROR_UNSPECIFIED = 65535, + OEM_CAUSE_1 = 0xf001, + OEM_CAUSE_2 = 0xf002, + OEM_CAUSE_3 = 0xf003, + OEM_CAUSE_4 = 0xf004, + OEM_CAUSE_5 = 0xf005, + OEM_CAUSE_6 = 0xf006, + OEM_CAUSE_7 = 0xf007, + OEM_CAUSE_8 = 0xf008, + OEM_CAUSE_9 = 0xf009, + OEM_CAUSE_10 = 0xf00a, + OEM_CAUSE_11 = 0xf00b, + OEM_CAUSE_12 = 0xf00c, + OEM_CAUSE_13 = 0xf00d, + OEM_CAUSE_14 = 0xf00e, + OEM_CAUSE_15 = 0xf00f, + ERROR_UNSPECIFIED = 0xffff, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/SrvccState.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/SrvccState.aidl index 864374b508..4b5c216081 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/SrvccState.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/SrvccState.aidl @@ -34,8 +34,8 @@ package android.hardware.radio.voice; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum SrvccState { - HANDOVER_STARTED = 0, - HANDOVER_COMPLETED = 1, - HANDOVER_FAILED = 2, - HANDOVER_CANCELED = 3, + HANDOVER_STARTED, + HANDOVER_COMPLETED, + HANDOVER_FAILED, + HANDOVER_CANCELED, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/StkCcUnsolSsResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/StkCcUnsolSsResult.aidl index 50bb1fd35b..75f3de5495 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/StkCcUnsolSsResult.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/StkCcUnsolSsResult.aidl @@ -72,13 +72,13 @@ parcelable StkCcUnsolSsResult { const int TELESERVICE_TYPE_SMS_SERVICES = 4; const int TELESERVICE_TYPE_ALL_TELESERVICES_EXCEPT_SMS = 5; const int SUPP_SERVICE_CLASS_NONE = 0; - const int SUPP_SERVICE_CLASS_VOICE = 1; - const int SUPP_SERVICE_CLASS_DATA = 2; - const int SUPP_SERVICE_CLASS_FAX = 4; - const int SUPP_SERVICE_CLASS_SMS = 8; - const int SUPP_SERVICE_CLASS_DATA_SYNC = 16; - const int SUPP_SERVICE_CLASS_DATA_ASYNC = 32; - const int SUPP_SERVICE_CLASS_PACKET = 64; - const int SUPP_SERVICE_CLASS_PAD = 128; - const int SUPP_SERVICE_CLASS_MAX = 128; + const int SUPP_SERVICE_CLASS_VOICE = (1 << 0); + const int SUPP_SERVICE_CLASS_DATA = (1 << 1); + const int SUPP_SERVICE_CLASS_FAX = (1 << 2); + const int SUPP_SERVICE_CLASS_SMS = (1 << 3); + const int SUPP_SERVICE_CLASS_DATA_SYNC = (1 << 4); + const int SUPP_SERVICE_CLASS_DATA_ASYNC = (1 << 5); + const int SUPP_SERVICE_CLASS_PACKET = (1 << 6); + const int SUPP_SERVICE_CLASS_PAD = (1 << 7); + const int SUPP_SERVICE_CLASS_MAX = (1 << 7); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/TtyMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/TtyMode.aidl index 77417e8718..e432e65093 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/TtyMode.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/TtyMode.aidl @@ -34,8 +34,8 @@ package android.hardware.radio.voice; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum TtyMode { - OFF = 0, - FULL = 1, - HCO = 2, - VCO = 3, + OFF, + FULL, + HCO, + VCO, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/UssdModeType.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/UssdModeType.aidl index ad243d2de7..424e73fc35 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/UssdModeType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/current/android/hardware/radio/voice/UssdModeType.aidl @@ -34,10 +34,10 @@ package android.hardware.radio.voice; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum UssdModeType { - NOTIFY = 0, - REQUEST = 1, - NW_RELEASE = 2, - LOCAL_CLIENT = 3, - NOT_SUPPORTED = 4, - NW_TIMEOUT = 5, + NOTIFY, + REQUEST, + NW_RELEASE, + LOCAL_CLIENT, + NOT_SUPPORTED, + NW_TIMEOUT, } diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/AccessNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/AccessNetwork.aidl index 8ce689f501..964165149d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/AccessNetwork.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/AccessNetwork.aidl @@ -34,11 +34,11 @@ package android.hardware.radio; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum AccessNetwork { - UNKNOWN = 0, - GERAN = 1, - UTRAN = 2, - EUTRAN = 3, - CDMA2000 = 4, - IWLAN = 5, - NGRAN = 6, + UNKNOWN, + GERAN, + UTRAN, + EUTRAN, + CDMA2000, + IWLAN, + NGRAN, } diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl index afc4f4e833..aa55cd77d9 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl @@ -34,28 +34,28 @@ package android.hardware.radio; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RadioAccessFamily { - UNKNOWN = 1, - GPRS = 2, - EDGE = 4, - UMTS = 8, - IS95A = 16, - IS95B = 32, - ONE_X_RTT = 64, - EVDO_0 = 128, - EVDO_A = 256, - HSDPA = 512, - HSUPA = 1024, - HSPA = 2048, - EVDO_B = 4096, - EHRPD = 8192, - LTE = 16384, - HSPAP = 32768, - GSM = 65536, - TD_SCDMA = 131072, - IWLAN = 262144, + UNKNOWN = (1 << android.hardware.radio.RadioTechnology.UNKNOWN), + GPRS = (1 << android.hardware.radio.RadioTechnology.GPRS), + EDGE = (1 << android.hardware.radio.RadioTechnology.EDGE), + UMTS = (1 << android.hardware.radio.RadioTechnology.UMTS), + IS95A = (1 << android.hardware.radio.RadioTechnology.IS95A), + IS95B = (1 << android.hardware.radio.RadioTechnology.IS95B), + ONE_X_RTT = (1 << android.hardware.radio.RadioTechnology.ONE_X_RTT), + EVDO_0 = (1 << android.hardware.radio.RadioTechnology.EVDO_0), + EVDO_A = (1 << android.hardware.radio.RadioTechnology.EVDO_A), + HSDPA = (1 << android.hardware.radio.RadioTechnology.HSDPA), + HSUPA = (1 << android.hardware.radio.RadioTechnology.HSUPA), + HSPA = (1 << android.hardware.radio.RadioTechnology.HSPA), + EVDO_B = (1 << android.hardware.radio.RadioTechnology.EVDO_B), + EHRPD = (1 << android.hardware.radio.RadioTechnology.EHRPD), + LTE = (1 << android.hardware.radio.RadioTechnology.LTE), + HSPAP = (1 << android.hardware.radio.RadioTechnology.HSPAP), + GSM = (1 << android.hardware.radio.RadioTechnology.GSM), + TD_SCDMA = (1 << android.hardware.radio.RadioTechnology.TD_SCDMA), + IWLAN = (1 << android.hardware.radio.RadioTechnology.IWLAN), /** * @deprecated use LTE instead. */ - LTE_CA = 524288, - NR = 1048576, + LTE_CA = (1 << android.hardware.radio.RadioTechnology.LTE_CA), + NR = (1 << android.hardware.radio.RadioTechnology.NR), } diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl index b91bf03511..448c0bb5c1 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl @@ -37,5 +37,5 @@ parcelable RadioConst { const int MAX_RILDS = 3; const int MAX_UUID_LENGTH = 64; const int CARD_MAX_APPS = 8; - const int P2_CONSTANT_NO_P2 = -1; + const int P2_CONSTANT_NO_P2 = (-1); } diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioIndicationType.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioIndicationType.aidl index 54ea3a4b4f..58b35a5723 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioIndicationType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioIndicationType.aidl @@ -34,6 +34,6 @@ package android.hardware.radio; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RadioIndicationType { - UNSOLICITED = 0, - UNSOLICITED_ACK_EXP = 1, + UNSOLICITED, + UNSOLICITED_ACK_EXP, } diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioResponseType.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioResponseType.aidl index 5cd99c43b0..1ee62bd94c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioResponseType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioResponseType.aidl @@ -34,7 +34,7 @@ package android.hardware.radio; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RadioResponseType { - SOLICITED = 0, - SOLICITED_ACK = 1, - SOLICITED_ACK_EXP = 2, + SOLICITED, + SOLICITED_ACK, + SOLICITED_ACK_EXP, } diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnology.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnology.aidl index 7060469886..b6af5aabf2 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnology.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnology.aidl @@ -34,28 +34,28 @@ package android.hardware.radio; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RadioTechnology { - UNKNOWN = 0, - GPRS = 1, - EDGE = 2, - UMTS = 3, - IS95A = 4, - IS95B = 5, - ONE_X_RTT = 6, - EVDO_0 = 7, - EVDO_A = 8, - HSDPA = 9, - HSUPA = 10, - HSPA = 11, - EVDO_B = 12, - EHRPD = 13, - LTE = 14, - HSPAP = 15, - GSM = 16, - TD_SCDMA = 17, - IWLAN = 18, + UNKNOWN, + GPRS, + EDGE, + UMTS, + IS95A, + IS95B, + ONE_X_RTT, + EVDO_0, + EVDO_A, + HSDPA, + HSUPA, + HSPA, + EVDO_B, + EHRPD, + LTE, + HSPAP, + GSM, + TD_SCDMA, + IWLAN, /** * @deprecated use LTE instead and indicate carrier aggregation through multiple physical channel configurations in IRadioNetwork::currentPhysicalChannelConfigs. */ - LTE_CA = 19, - NR = 20, + LTE_CA, + NR, } diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnologyFamily.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnologyFamily.aidl index e6fdce269d..2af7e535da 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnologyFamily.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnologyFamily.aidl @@ -34,6 +34,6 @@ package android.hardware.radio; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RadioTechnologyFamily { - THREE_GPP = 0, - THREE_GPP2 = 1, + THREE_GPP, + THREE_GPP2, } From ab8313ca539ef1ec23b061488e7d85d65f2d9663 Mon Sep 17 00:00:00 2001 From: Oscar Shu Date: Tue, 13 Dec 2022 00:55:11 +0000 Subject: [PATCH 603/998] Add new API to set max power limits for mAFC HAL API support for setting max permissible power on a range of frequencies. Unspecified frequencies will get reverted to their respective default values. Also add capability flag for this new API. Bug: 242917176 Test: make -j128 Test: Manually verified the framework can call the HAL API Change-Id: I14ac494124b51ca0b85c394eefe6332c4b382d19 --- .../wifi/AvailableAfcFrequencyInfo.aidl | 40 ++++++++++++++++++ .../android/hardware/wifi/IWifiChip.aidl | 2 + .../wifi/AvailableAfcFrequencyInfo.aidl | 41 +++++++++++++++++++ .../aidl/android/hardware/wifi/IWifiChip.aidl | 18 ++++++++ wifi/aidl/default/wifi_chip.cpp | 12 ++++++ wifi/aidl/default/wifi_chip.h | 4 ++ 6 files changed, 117 insertions(+) create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/AvailableAfcFrequencyInfo.aidl create mode 100644 wifi/aidl/android/hardware/wifi/AvailableAfcFrequencyInfo.aidl diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/AvailableAfcFrequencyInfo.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/AvailableAfcFrequencyInfo.aidl new file mode 100644 index 0000000000..cbea5affb9 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/AvailableAfcFrequencyInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.wifi; +@VintfStability +parcelable AvailableAfcFrequencyInfo { + int startFrequencyMhz; + int endFrequencyMhz; + int maxPsd; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl index 2ebe145be9..fd59888d56 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl @@ -61,6 +61,7 @@ interface IWifiChip { android.hardware.wifi.WifiRadioCombinationMatrix getSupportedRadioCombinationsMatrix(); android.hardware.wifi.WifiChipCapabilities getWifiChipCapabilities(); android.hardware.wifi.WifiUsableChannel[] getUsableChannels(in android.hardware.wifi.WifiBand band, in android.hardware.wifi.WifiIfaceMode ifaceModeMask, in android.hardware.wifi.IWifiChip.UsableChannelFilter filterMask); + void setAfcChannelAllowance(in android.hardware.wifi.AvailableAfcFrequencyInfo[] availableAfcFrequencyInfo); void registerEventCallback(in android.hardware.wifi.IWifiChipEventCallback callback); void removeApIface(in String ifname); void removeIfaceInstanceFromBridgedApIface(in String brIfaceName, in String ifaceInstanceName); @@ -99,6 +100,7 @@ interface IWifiChip { SET_LATENCY_MODE = (1 << 12), P2P_RAND_MAC = (1 << 13), WIGIG = (1 << 14), + SET_AFC_CHANNEL_ALLOWANCE = (1 << 15), } @VintfStability parcelable ChipConcurrencyCombinationLimit { diff --git a/wifi/aidl/android/hardware/wifi/AvailableAfcFrequencyInfo.aidl b/wifi/aidl/android/hardware/wifi/AvailableAfcFrequencyInfo.aidl new file mode 100644 index 0000000000..5de360cc21 --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/AvailableAfcFrequencyInfo.aidl @@ -0,0 +1,41 @@ +/* + * 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.hardware.wifi; + +/** + * Defines the maximum permissible power spectral density on a range of + * frequencies to support 6Ghz with standard power for AFC. + * The format of the data follows spec from the Wi-Fi Alliance AFC System to + * AFC Device Interface Specification: AvailableFrequencyInfo object. + */ +@VintfStability +parcelable AvailableAfcFrequencyInfo { + /** + * Defines the lowest frequency included in this 6Ghz frequency range. + */ + int startFrequencyMhz; + /** + * Defines the highest frequency included in this 6Ghz frequency range. + */ + int endFrequencyMhz; + /** + * The maximum permissible EIRP available in any one MHz bin within the + * frequency range specified. The limit is expressed as a power spectral + * density with units of dBm per MHz. + */ + int maxPsd; +} diff --git a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl index 5ffea565e5..41ff7e68ae 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl @@ -16,6 +16,7 @@ package android.hardware.wifi; +import android.hardware.wifi.AvailableAfcFrequencyInfo; import android.hardware.wifi.IWifiApIface; import android.hardware.wifi.IWifiChipEventCallback; import android.hardware.wifi.IWifiNanIface; @@ -105,6 +106,11 @@ interface IWifiChip { * Chip can operate in the 60GHz band (WiGig chip). */ WIGIG = 1 << 14, + /** + * Chip supports setting allowed channels along with PSD in 6GHz band + * for AFC purposes. + */ + SET_AFC_CHANNEL_ALLOWANCE = 1 << 15, } /** @@ -835,6 +841,18 @@ interface IWifiChip { WifiUsableChannel[] getUsableChannels( in WifiBand band, in WifiIfaceMode ifaceModeMask, in UsableChannelFilter filterMask); + /* + * Set the max power level the chip is allowed to transmit on for 6Ghz AFC + * using an array of AvailableAfcFrequencyInfo. The max power for + * frequencies not included in the input frequency ranges will be reset to + * their respective default values. + * @param availableAfcFrequencyInfo The list of frequency ranges and + * corresponding max allowed power. + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_NOT_SUPPORTED| + */ + void setAfcChannelAllowance(in AvailableAfcFrequencyInfo[] availableAfcFrequencyInfo); + /** * Requests notifications of significant events on this chip. Multiple calls * to this must register multiple callbacks, each of which must receive all diff --git a/wifi/aidl/default/wifi_chip.cpp b/wifi/aidl/default/wifi_chip.cpp index 559700172d..6f43e0669d 100644 --- a/wifi/aidl/default/wifi_chip.cpp +++ b/wifi/aidl/default/wifi_chip.cpp @@ -670,6 +670,12 @@ ndk::ScopedAStatus WifiChip::getUsableChannels(WifiBand in_band, WifiIfaceMode i in_ifaceModeMask, in_filterMask); } +ndk::ScopedAStatus WifiChip::setAfcChannelAllowance( + const std::vector& availableAfcFrequencyInfo) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::setAfcChannelAllowanceInternal, availableAfcFrequencyInfo); +} + ndk::ScopedAStatus WifiChip::triggerSubsystemRestart() { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, &WifiChip::triggerSubsystemRestartInternal); @@ -1394,6 +1400,12 @@ std::pair, ndk::ScopedAStatus> WifiChip::getUsabl return {aidl_usable_channels, ndk::ScopedAStatus::ok()}; } +ndk::ScopedAStatus WifiChip::setAfcChannelAllowanceInternal( + const std::vector& availableAfcFrequencyInfo) { + LOG(INFO) << "setAfcChannelAllowance is not yet supported " << availableAfcFrequencyInfo.size(); + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + std::pair WifiChip::getSupportedRadioCombinationsMatrixInternal() { legacy_hal::wifi_error legacy_status; diff --git a/wifi/aidl/default/wifi_chip.h b/wifi/aidl/default/wifi_chip.h index c69c7fe9ea..b552c3324e 100644 --- a/wifi/aidl/default/wifi_chip.h +++ b/wifi/aidl/default/wifi_chip.h @@ -141,6 +141,8 @@ class WifiChip : public BnWifiChip { ndk::ScopedAStatus getUsableChannels(WifiBand in_band, WifiIfaceMode in_ifaceModeMask, UsableChannelFilter in_filterMask, std::vector* _aidl_return) override; + ndk::ScopedAStatus setAfcChannelAllowance( + const std::vector& availableAfcFrequencyInfo) override; ndk::ScopedAStatus triggerSubsystemRestart() override; ndk::ScopedAStatus getSupportedRadioCombinationsMatrix( WifiRadioCombinationMatrix* _aidl_return) override; @@ -218,6 +220,8 @@ class WifiChip : public BnWifiChip { WifiBand band, WifiIfaceMode ifaceModeMask, UsableChannelFilter filterMask); ndk::ScopedAStatus enableStaChannelForPeerNetworkInternal( ChannelCategoryMask channelCategoryEnableFlag); + ndk::ScopedAStatus setAfcChannelAllowanceInternal( + const std::vector& availableAfcFrequencyInfo); ndk::ScopedAStatus handleChipConfiguration(std::unique_lock* lock, int32_t mode_id); ndk::ScopedAStatus registerDebugRingBufferCallback(); From 4ee44083bb1adc94f15532d9e3e4d6009ca3c043 Mon Sep 17 00:00:00 2001 From: arunvoddu Date: Tue, 17 Jan 2023 06:05:41 +0000 Subject: [PATCH 604/998] HAL changes to remove the carrierId Bug: 189884347 Test: Build successfully Change-Id: I8a9ffc5f631c2ecb26e0a5f2d3ee1ccc9a0f853f --- .../android/hardware/radio/sim/CarrierRestrictions.aidl | 1 - .../aidl/android/hardware/radio/sim/CarrierRestrictions.aidl | 5 ----- 2 files changed, 6 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl index 4e2fe455d3..3700de3143 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl @@ -38,7 +38,6 @@ parcelable CarrierRestrictions { android.hardware.radio.sim.Carrier[] excludedCarriers; boolean allowedCarriersPrioritized; android.hardware.radio.sim.CarrierRestrictions.CarrierRestrictionStatus status; - int carrierId; @Backing(type="int") @VintfStability enum CarrierRestrictionStatus { UNKNOWN = 0, diff --git a/radio/aidl/android/hardware/radio/sim/CarrierRestrictions.aidl b/radio/aidl/android/hardware/radio/sim/CarrierRestrictions.aidl index 5a79f0fa63..edbec2c4f8 100644 --- a/radio/aidl/android/hardware/radio/sim/CarrierRestrictions.aidl +++ b/radio/aidl/android/hardware/radio/sim/CarrierRestrictions.aidl @@ -58,9 +58,4 @@ parcelable CarrierRestrictions { boolean allowedCarriersPrioritized; /** Current restriction status as defined in CarrierRestrictionStatus enum */ CarrierRestrictionStatus status; - /** - * Android carrier ID of the locked carrier. - * see https://source.android.com/docs/core/connect/carrierid - */ - int carrierId; } From 4fbd80770ff14f9f84456540b8184218ae349791 Mon Sep 17 00:00:00 2001 From: Sarah Chin Date: Wed, 18 Jan 2023 01:14:46 -0800 Subject: [PATCH 605/998] Change averagingWindowMs to int Revert changes for qfi and apply them to averagingWindowMs instead This is functionally the same change as ag/20886209 Test: build Bug: 264261216 Change-Id: I053c3d6b8ca1464156bd5e65fe0316f27e962beb --- .../android/hardware/radio/data/NrQos.aidl | 9 +++++---- .../android/hardware/radio/data/NrQos.aidl | 19 ++++++++++++------- .../compat/libradiocompat/data/structs.cpp | 4 ++-- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/NrQos.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/NrQos.aidl index a0792c3f37..be859b79de 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/NrQos.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/NrQos.aidl @@ -37,12 +37,13 @@ parcelable NrQos { int fiveQi; android.hardware.radio.data.QosBandwidth downlink; android.hardware.radio.data.QosBandwidth uplink; - /** - * @deprecated use qosFlowIdentifier. - */ byte qfi; + /** + * @deprecated use averagingWindowMillis; + */ char averagingWindowMs; - int qosFlowIdentifier; + int averagingWindowMillis = AVERAGING_WINDOW_UNKNOWN; const byte FLOW_ID_RANGE_MIN = 1; const byte FLOW_ID_RANGE_MAX = 63; + const int AVERAGING_WINDOW_UNKNOWN = (-1); } diff --git a/radio/aidl/android/hardware/radio/data/NrQos.aidl b/radio/aidl/android/hardware/radio/data/NrQos.aidl index 28b4a7f20d..4078fdccc6 100644 --- a/radio/aidl/android/hardware/radio/data/NrQos.aidl +++ b/radio/aidl/android/hardware/radio/data/NrQos.aidl @@ -27,6 +27,8 @@ parcelable NrQos { const byte FLOW_ID_RANGE_MIN = 1; const byte FLOW_ID_RANGE_MAX = 63; + const int AVERAGING_WINDOW_UNKNOWN = -1; + /** * 5G QOS Identifier (5QI), see 3GPP TS 24.501 and 23.501. The allowed values are standard * values (1-9, 65-68, 69-70, 75, 79-80, 82-85) defined in the spec and operator specific values @@ -35,14 +37,17 @@ parcelable NrQos { int fiveQi; QosBandwidth downlink; QosBandwidth uplink; - /** - * @deprecated use qosFlowIdentifier. - */ - byte qfi; - char averagingWindowMs; /** * QOS flow identifier of the QOS flow description in the range * (FLOW_ID_RANGE_MIN, FLOW_ID_RANGE_MAX). - **/ - int qosFlowIdentifier; + */ + byte qfi; + /** + * @deprecated use averagingWindowMillis; + */ + char averagingWindowMs; + /** + * The duration over which flow rates are calculated. + */ + int averagingWindowMillis = AVERAGING_WINDOW_UNKNOWN; } diff --git a/radio/aidl/compat/libradiocompat/data/structs.cpp b/radio/aidl/compat/libradiocompat/data/structs.cpp index 22cde6b994..47f1f86320 100644 --- a/radio/aidl/compat/libradiocompat/data/structs.cpp +++ b/radio/aidl/compat/libradiocompat/data/structs.cpp @@ -136,8 +136,8 @@ static aidl::NrQos toAidl(const V1_6::NrQos& qos) { .fiveQi = qos.fiveQi, .downlink = toAidl(qos.downlink), .uplink = toAidl(qos.uplink), - .qosFlowIdentifier = static_cast(qos.qfi), - .averagingWindowMs = qos.averagingWindowMs, + .qfi = static_cast(qos.qfi), + .averagingWindowMillis = qos.averagingWindowMs, }; } From 8441c0de8cc677b75ed134269a66cddd3d33a69d Mon Sep 17 00:00:00 2001 From: sadiqsada Date: Mon, 12 Dec 2022 12:16:33 -0800 Subject: [PATCH 606/998] Add IPTV Support Test: atest android.media.tv.tuner.cts Bug: 263504906 Change-Id: Ib4391dcda7d5840495ab5a573be68431bb6099d8 --- .../tv/tuner/FrontendIptvSettings.aidl | 44 ++++++++++++++++++ .../tv/tuner/FrontendIptvSettingsFec.aidl | 41 +++++++++++++++++ .../tv/tuner/FrontendIptvSettingsFecType.aidl | 42 +++++++++++++++++ .../tv/tuner/FrontendIptvSettingsIgmp.aidl | 42 +++++++++++++++++ .../tuner/FrontendIptvSettingsProtocol.aidl | 41 +++++++++++++++++ .../hardware/tv/tuner/FrontendType.aidl | 3 +- .../tv/tuner/FrontendIptvSettings.aidl | 45 +++++++++++++++++++ .../tv/tuner/FrontendIptvSettingsFec.aidl | 38 ++++++++++++++++ .../tv/tuner/FrontendIptvSettingsFecType.aidl | 34 ++++++++++++++ .../tv/tuner/FrontendIptvSettingsIgmp.aidl | 33 ++++++++++++++ .../tuner/FrontendIptvSettingsProtocol.aidl | 31 +++++++++++++ .../hardware/tv/tuner/FrontendType.aidl | 7 ++- tv/tuner/aidl/default/Tuner.cpp | 4 +- 13 files changed, 402 insertions(+), 3 deletions(-) create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsFec.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsFecType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsIgmp.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsProtocol.aidl create mode 100644 tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettings.aidl create mode 100644 tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsFec.aidl create mode 100644 tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsFecType.aidl create mode 100644 tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsIgmp.aidl create mode 100644 tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsProtocol.aidl diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettings.aidl new file mode 100644 index 0000000000..73582f3efb --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettings.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendIptvSettings { + android.hardware.tv.tuner.FrontendIptvSettingsProtocol protocol = android.hardware.tv.tuner.FrontendIptvSettingsProtocol.UNDEFINED; + android.hardware.tv.tuner.FrontendIptvSettingsFec fec; + android.hardware.tv.tuner.FrontendIptvSettingsIgmp igmp = android.hardware.tv.tuner.FrontendIptvSettingsIgmp.UNDEFINED; + long bitrate; + android.hardware.tv.tuner.DemuxIpAddress ipAddr; + String contentUrl; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsFec.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsFec.aidl new file mode 100644 index 0000000000..c3613772ef --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsFec.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendIptvSettingsFec { + android.hardware.tv.tuner.FrontendIptvSettingsFecType type; + int fecColNum; + int fecRowNum; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsFecType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsFecType.aidl new file mode 100644 index 0000000000..50a12089ec --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsFecType.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendIptvSettingsFecType { + UNDEFINED = 0, + COLUMN = 1, + ROW = 2, + COLUMN_ROW = 4, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsIgmp.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsIgmp.aidl new file mode 100644 index 0000000000..aa0849658f --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsIgmp.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendIptvSettingsIgmp { + UNDEFINED = 0, + V1 = 1, + V2 = 2, + V3 = 4, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsProtocol.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsProtocol.aidl new file mode 100644 index 0000000000..08a01f1a36 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsProtocol.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendIptvSettingsProtocol { + UNDEFINED = 0, + UDP = 1, + RTP = 2, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendType.aidl index 99a120bcb3..cbf5b4701c 100644 --- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendType.aidl +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendType.aidl @@ -1,5 +1,5 @@ /* - * Copyright 2021 The Android Open Source Project + * Copyright 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. @@ -46,4 +46,5 @@ enum FrontendType { ISDBS3 = 8, ISDBT = 9, DTMB = 10, + IPTV = 11, } diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettings.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettings.aidl new file mode 100644 index 0000000000..782695acac --- /dev/null +++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettings.aidl @@ -0,0 +1,45 @@ +/* + * Copyright 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.hardware.tv.tuner; + +import android.hardware.tv.tuner.DemuxIpAddress; +import android.hardware.tv.tuner.FrontendIptvSettingsFec; +import android.hardware.tv.tuner.FrontendIptvSettingsFecType; +import android.hardware.tv.tuner.FrontendIptvSettingsIgmp; +import android.hardware.tv.tuner.FrontendIptvSettingsProtocol; + +/** + * Frontend Settings for IPTV. + * @hide + */ +@VintfStability +parcelable FrontendIptvSettings { + FrontendIptvSettingsProtocol protocol = FrontendIptvSettingsProtocol.UNDEFINED; + + FrontendIptvSettingsFec fec; + + FrontendIptvSettingsIgmp igmp = FrontendIptvSettingsIgmp.UNDEFINED; + + long bitrate; + + /** + * Source and destination IP Address. + */ + DemuxIpAddress ipAddr; + + String contentUrl; +} diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsFec.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsFec.aidl new file mode 100644 index 0000000000..e12f06f2f2 --- /dev/null +++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsFec.aidl @@ -0,0 +1,38 @@ +/* + * Copyright 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.hardware.tv.tuner; + +import android.hardware.tv.tuner.FrontendIptvSettingsFecType; + +/** + * Configuration details for IPTV FEC. + * @hide + */ +@VintfStability +parcelable FrontendIptvSettingsFec { + FrontendIptvSettingsFecType type; + + /** + * The number of columns in the source block as well as the type of the repair packet. + */ + int fecColNum; + + /** + * The number of rows in the source block as well as the type of the repair packet. + */ + int fecRowNum; +} diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsFecType.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsFecType.aidl new file mode 100644 index 0000000000..421cbf839c --- /dev/null +++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsFecType.aidl @@ -0,0 +1,34 @@ +/* + * Copyright 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.hardware.tv.tuner; + +/** + * FEC type for IPTV. + * TS 102 542-3-2 - V1.3.2 + * @hide + */ +@VintfStability +@Backing(type="int") +enum FrontendIptvSettingsFecType { + UNDEFINED = 0, + + COLUMN = 1 << 0, + + ROW = 1 << 1, + + COLUMN_ROW = 1 << 2, +} diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsIgmp.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsIgmp.aidl new file mode 100644 index 0000000000..f6e39c889d --- /dev/null +++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsIgmp.aidl @@ -0,0 +1,33 @@ +/* + * Copyright 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.hardware.tv.tuner; + +/** + * IGMP type for IPTV. + * @hide + */ +@VintfStability +@Backing(type="int") +enum FrontendIptvSettingsIgmp { + UNDEFINED = 0, + + V1 = 1 << 0, + + V2 = 1 << 1, + + V3 = 1 << 2, +} diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsProtocol.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsProtocol.aidl new file mode 100644 index 0000000000..0283445851 --- /dev/null +++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsProtocol.aidl @@ -0,0 +1,31 @@ +/* + * Copyright 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.hardware.tv.tuner; + +/** + * Protocol for IPTV. + * @hide + */ +@VintfStability +@Backing(type="int") +enum FrontendIptvSettingsProtocol { + UNDEFINED = 0, + + UDP = 1 << 0, + + RTP = 1 << 1, +} diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendType.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendType.aidl index 8ade389393..e8d343ee70 100644 --- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendType.aidl +++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendType.aidl @@ -1,5 +1,5 @@ /* - * Copyright 2021 The Android Open Source Project + * Copyright 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. @@ -79,4 +79,9 @@ enum FrontendType { * DTMB (Digital Terrestrial Multimedia Broadcast) standard. */ DTMB, + + /** + * ITU IPTV (ITU-T FG IPTV) + */ + IPTV, } diff --git a/tv/tuner/aidl/default/Tuner.cpp b/tv/tuner/aidl/default/Tuner.cpp index 8c715a0e12..a8b24a03b7 100644 --- a/tv/tuner/aidl/default/Tuner.cpp +++ b/tv/tuner/aidl/default/Tuner.cpp @@ -37,7 +37,7 @@ Tuner::Tuner() {} void Tuner::init() { // Static Frontends array to maintain local frontends information // Array index matches their FrontendId in the default impl - mFrontendSize = 10; + mFrontendSize = 11; mFrontends[0] = ndk::SharedRefBase::make(FrontendType::ISDBS, 0); mFrontends[1] = ndk::SharedRefBase::make(FrontendType::ATSC3, 1); mFrontends[2] = ndk::SharedRefBase::make(FrontendType::DVBC, 2); @@ -48,6 +48,7 @@ void Tuner::init() { mFrontends[7] = ndk::SharedRefBase::make(FrontendType::ATSC, 7); mFrontends[8] = ndk::SharedRefBase::make(FrontendType::ISDBS3, 8); mFrontends[9] = ndk::SharedRefBase::make(FrontendType::DTMB, 9); + mFrontends[10] = ndk::SharedRefBase::make(FrontendType::IPTV, 10); mMaxUsableFrontends[FrontendType::ISDBS] = 1; mMaxUsableFrontends[FrontendType::ATSC3] = 1; @@ -59,6 +60,7 @@ void Tuner::init() { mMaxUsableFrontends[FrontendType::ATSC] = 1; mMaxUsableFrontends[FrontendType::ISDBS3] = 1; mMaxUsableFrontends[FrontendType::DTMB] = 1; + mMaxUsableFrontends[FrontendType::IPTV] = 1; mLnbs.resize(2); mLnbs[0] = ndk::SharedRefBase::make(0); From 0d1d6858605df99e4339f056e2391abcc1772ebb Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Wed, 18 Jan 2023 20:54:09 +0000 Subject: [PATCH 607/998] cleanup camera OWNERS I wrote a script for this, see my email "introducing: ownersfix.py - basic cleaning script for simple OWNERS files" Bug: 265168485 Test: N/A Change-Id: I47ab60785b193764a96d7b63820c87ec4fa81f7f --- camera/{common/default => }/OWNERS | 2 ++ camera/device/1.0/default/OWNERS | 1 - camera/device/3.2/default/OWNERS | 1 - camera/device/3.3/default/OWNERS | 1 - camera/device/3.4/default/OWNERS | 1 - camera/device/3.5/default/OWNERS | 1 - camera/device/3.6/default/OWNERS | 1 - camera/device/default/OWNERS | 1 - camera/provider/2.4/default/OWNERS | 1 - camera/provider/2.4/vts/OWNERS | 8 -------- camera/provider/2.4/vts/functional/OWNERS | 2 -- camera/provider/2.5/default/OWNERS | 1 - camera/provider/aidl/vts/OWNERS | 6 ------ camera/provider/default/OWNERS | 1 - 14 files changed, 2 insertions(+), 26 deletions(-) rename camera/{common/default => }/OWNERS (65%) delete mode 100644 camera/device/1.0/default/OWNERS delete mode 100644 camera/device/3.2/default/OWNERS delete mode 100644 camera/device/3.3/default/OWNERS delete mode 100644 camera/device/3.4/default/OWNERS delete mode 100644 camera/device/3.5/default/OWNERS delete mode 100644 camera/device/3.6/default/OWNERS delete mode 100644 camera/device/default/OWNERS delete mode 100644 camera/provider/2.4/default/OWNERS delete mode 100644 camera/provider/2.4/vts/OWNERS delete mode 100644 camera/provider/2.4/vts/functional/OWNERS delete mode 100644 camera/provider/2.5/default/OWNERS delete mode 100644 camera/provider/aidl/vts/OWNERS delete mode 100644 camera/provider/default/OWNERS diff --git a/camera/common/default/OWNERS b/camera/OWNERS similarity index 65% rename from camera/common/default/OWNERS rename to camera/OWNERS index f48a95c5b3..b9462640d9 100644 --- a/camera/common/default/OWNERS +++ b/camera/OWNERS @@ -1 +1,3 @@ +# Bug component: 41727 + include platform/frameworks/av:/camera/OWNERS diff --git a/camera/device/1.0/default/OWNERS b/camera/device/1.0/default/OWNERS deleted file mode 100644 index f48a95c5b3..0000000000 --- a/camera/device/1.0/default/OWNERS +++ /dev/null @@ -1 +0,0 @@ -include platform/frameworks/av:/camera/OWNERS diff --git a/camera/device/3.2/default/OWNERS b/camera/device/3.2/default/OWNERS deleted file mode 100644 index f48a95c5b3..0000000000 --- a/camera/device/3.2/default/OWNERS +++ /dev/null @@ -1 +0,0 @@ -include platform/frameworks/av:/camera/OWNERS diff --git a/camera/device/3.3/default/OWNERS b/camera/device/3.3/default/OWNERS deleted file mode 100644 index f48a95c5b3..0000000000 --- a/camera/device/3.3/default/OWNERS +++ /dev/null @@ -1 +0,0 @@ -include platform/frameworks/av:/camera/OWNERS diff --git a/camera/device/3.4/default/OWNERS b/camera/device/3.4/default/OWNERS deleted file mode 100644 index f48a95c5b3..0000000000 --- a/camera/device/3.4/default/OWNERS +++ /dev/null @@ -1 +0,0 @@ -include platform/frameworks/av:/camera/OWNERS diff --git a/camera/device/3.5/default/OWNERS b/camera/device/3.5/default/OWNERS deleted file mode 100644 index f48a95c5b3..0000000000 --- a/camera/device/3.5/default/OWNERS +++ /dev/null @@ -1 +0,0 @@ -include platform/frameworks/av:/camera/OWNERS diff --git a/camera/device/3.6/default/OWNERS b/camera/device/3.6/default/OWNERS deleted file mode 100644 index f48a95c5b3..0000000000 --- a/camera/device/3.6/default/OWNERS +++ /dev/null @@ -1 +0,0 @@ -include platform/frameworks/av:/camera/OWNERS diff --git a/camera/device/default/OWNERS b/camera/device/default/OWNERS deleted file mode 100644 index f48a95c5b3..0000000000 --- a/camera/device/default/OWNERS +++ /dev/null @@ -1 +0,0 @@ -include platform/frameworks/av:/camera/OWNERS diff --git a/camera/provider/2.4/default/OWNERS b/camera/provider/2.4/default/OWNERS deleted file mode 100644 index f48a95c5b3..0000000000 --- a/camera/provider/2.4/default/OWNERS +++ /dev/null @@ -1 +0,0 @@ -include platform/frameworks/av:/camera/OWNERS diff --git a/camera/provider/2.4/vts/OWNERS b/camera/provider/2.4/vts/OWNERS deleted file mode 100644 index eb4f0e4b6c..0000000000 --- a/camera/provider/2.4/vts/OWNERS +++ /dev/null @@ -1,8 +0,0 @@ -# Bug component: 41727 - -# Camera team -include platform/frameworks/av:/camera/OWNERS - -# VTS team -yim@google.com -zhuoyao@google.com diff --git a/camera/provider/2.4/vts/functional/OWNERS b/camera/provider/2.4/vts/functional/OWNERS deleted file mode 100644 index 479f465c69..0000000000 --- a/camera/provider/2.4/vts/functional/OWNERS +++ /dev/null @@ -1,2 +0,0 @@ -# Bug component: 41727 -epeev@google.com diff --git a/camera/provider/2.5/default/OWNERS b/camera/provider/2.5/default/OWNERS deleted file mode 100644 index f48a95c5b3..0000000000 --- a/camera/provider/2.5/default/OWNERS +++ /dev/null @@ -1 +0,0 @@ -include platform/frameworks/av:/camera/OWNERS diff --git a/camera/provider/aidl/vts/OWNERS b/camera/provider/aidl/vts/OWNERS deleted file mode 100644 index 27d370bcbe..0000000000 --- a/camera/provider/aidl/vts/OWNERS +++ /dev/null @@ -1,6 +0,0 @@ -# Camera team -include platform/frameworks/av:/camera/OWNERS - -# VTS team -yim@google.com -zhuoyao@google.com \ No newline at end of file diff --git a/camera/provider/default/OWNERS b/camera/provider/default/OWNERS deleted file mode 100644 index f48a95c5b3..0000000000 --- a/camera/provider/default/OWNERS +++ /dev/null @@ -1 +0,0 @@ -include platform/frameworks/av:/camera/OWNERS From 7ea5df6eca2443db68e9e145312e16026f92649a Mon Sep 17 00:00:00 2001 From: Thomas Nguyen Date: Mon, 28 Nov 2022 16:41:46 -0800 Subject: [PATCH 608/998] Add Satellite HAL APIs Bug: 260644201 Test: atest VtsHalRadioTargetTest MO/MT SMS, MMS, voice calls with live network Change-Id: Ia95b773c7ddd51d32ea987295d70a9a2e16ebf7a --- .../compatibility_matrix.current.xml | 10 + radio/aidl/Android.bp | 16 + .../radio/satellite/IRadioSatellite.aidl | 53 ++ .../satellite/IRadioSatelliteIndication.aidl | 44 ++ .../satellite/IRadioSatelliteResponse.aidl | 52 ++ .../radio/satellite/IndicationFilter.aidl | 39 ++ .../radio/satellite/NTRadioTechnology.aidl | 41 ++ .../radio/satellite/PointingInfo.aidl | 42 ++ .../satellite/SatelliteCapabilities.aidl | 42 ++ .../radio/satellite/SatelliteFeature.aidl | 41 ++ .../radio/satellite/SatelliteMode.aidl | 42 ++ .../android/hardware/radio/AccessNetwork.aidl | 14 +- .../hardware/radio/RadioAccessFamily.aidl | 42 +- .../android/hardware/radio/RadioConst.aidl | 2 +- .../android/hardware/radio/RadioError.aidl | 11 + .../hardware/radio/RadioIndicationType.aidl | 4 +- .../hardware/radio/RadioResponseType.aidl | 6 +- .../hardware/radio/RadioTechnology.aidl | 42 +- .../hardware/radio/RadioTechnologyFamily.aidl | 4 +- .../android/hardware/radio/RadioError.aidl | 50 +- .../radio/satellite/IRadioSatellite.aidl | 168 +++++ .../satellite/IRadioSatelliteIndication.aidl | 90 +++ .../satellite/IRadioSatelliteResponse.aidl | 461 +++++++++++++ .../radio/satellite/IndicationFilter.aidl | 25 + .../radio/satellite/NTRadioTechnology.aidl | 31 + .../radio/satellite/PointingInfo.aidl | 42 ++ .../satellite/SatelliteCapabilities.aidl | 50 ++ .../radio/satellite/SatelliteFeature.aidl | 31 + .../radio/satellite/SatelliteMode.aidl | 33 + radio/aidl/compat/libradiocompat/Android.bp | 4 + .../include/libradiocompat/RadioIndication.h | 10 + .../include/libradiocompat/RadioResponse.h | 9 + .../include/libradiocompat/RadioSatellite.h | 65 ++ .../satellite/RadioIndication-satellite.cpp | 39 ++ .../satellite/RadioResponse-satellite.cpp | 39 ++ .../satellite/RadioSatellite.cpp | 128 ++++ radio/aidl/compat/service/Android.bp | 1 + radio/aidl/vts/Android.bp | 4 + radio/aidl/vts/VtsHalRadioTargetTest.cpp | 7 + radio/aidl/vts/radio_aidl_hal_utils.h | 2 + radio/aidl/vts/radio_satellite_indication.cpp | 56 ++ radio/aidl/vts/radio_satellite_response.cpp | 120 ++++ radio/aidl/vts/radio_satellite_test.cpp | 626 ++++++++++++++++++ radio/aidl/vts/radio_satellite_utils.h | 126 ++++ 44 files changed, 2706 insertions(+), 58 deletions(-) create mode 100644 radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatellite.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatelliteIndication.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatelliteResponse.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IndicationFilter.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/NTRadioTechnology.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/PointingInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteCapabilities.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteFeature.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteMode.aidl create mode 100644 radio/aidl/android/hardware/radio/satellite/IRadioSatellite.aidl create mode 100644 radio/aidl/android/hardware/radio/satellite/IRadioSatelliteIndication.aidl create mode 100644 radio/aidl/android/hardware/radio/satellite/IRadioSatelliteResponse.aidl create mode 100644 radio/aidl/android/hardware/radio/satellite/IndicationFilter.aidl create mode 100644 radio/aidl/android/hardware/radio/satellite/NTRadioTechnology.aidl create mode 100644 radio/aidl/android/hardware/radio/satellite/PointingInfo.aidl create mode 100644 radio/aidl/android/hardware/radio/satellite/SatelliteCapabilities.aidl create mode 100644 radio/aidl/android/hardware/radio/satellite/SatelliteFeature.aidl create mode 100644 radio/aidl/android/hardware/radio/satellite/SatelliteMode.aidl create mode 100644 radio/aidl/compat/libradiocompat/include/libradiocompat/RadioSatellite.h create mode 100644 radio/aidl/compat/libradiocompat/satellite/RadioIndication-satellite.cpp create mode 100644 radio/aidl/compat/libradiocompat/satellite/RadioResponse-satellite.cpp create mode 100644 radio/aidl/compat/libradiocompat/satellite/RadioSatellite.cpp create mode 100644 radio/aidl/vts/radio_satellite_indication.cpp create mode 100644 radio/aidl/vts/radio_satellite_response.cpp create mode 100644 radio/aidl/vts/radio_satellite_test.cpp create mode 100644 radio/aidl/vts/radio_satellite_utils.h diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 982b88b602..5cd030fe32 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -528,6 +528,16 @@ slot3 + + android.hardware.radio.satellite + 1 + + IRadioSatellite + slot1 + slot2 + slot3 + + android.hardware.radio.ims.media 1 diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp index e8cebd76d1..dfccb4c4d9 100644 --- a/radio/aidl/Android.bp +++ b/radio/aidl/Android.bp @@ -262,3 +262,19 @@ aidl_interface { }, }, } + +aidl_interface { + name: "android.hardware.radio.satellite", + vendor_available: true, + srcs: ["android/hardware/radio/satellite/*.aidl"], + stability: "vintf", + imports: ["android.hardware.radio-V2"], + backend: { + cpp: { + enabled: false, + }, + java: { + sdk_version: "module_current", + }, + }, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatellite.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatellite.aidl new file mode 100644 index 0000000000..a00e4f5ed0 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatellite.aidl @@ -0,0 +1,53 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.satellite; +@VintfStability +interface IRadioSatellite { + oneway void addAllowedSatelliteContacts(in int serial, in String[] contacts); + oneway void getCapabilities(in int serial); + oneway void getMaxCharactersPerTextMessage(in int serial); + oneway void getPendingMessages(in int serial); + oneway void getPowerState(in int serial); + oneway void getSatelliteMode(in int serial); + oneway void getTimeForNextSatelliteVisibility(in int serial); + oneway void provisionService(in int serial, in String imei, in String msisdn, in String imsi, in android.hardware.radio.satellite.SatelliteFeature[] features); + oneway void removeAllowedSatelliteContacts(in int serial, in String[] contacts); + oneway void responseAcknowledgement(); + oneway void sendMessages(in int serial, in String[] messages, in String destination, in double latitude, in double longitude); + oneway void setIndicationFilter(in int serial, in int filterBitmask); + oneway void setPower(in int serial, in boolean on); + oneway void setResponseFunctions(in android.hardware.radio.satellite.IRadioSatelliteResponse satelliteResponse, in android.hardware.radio.satellite.IRadioSatelliteIndication satelliteIndication); + oneway void startSendingSatellitePointingInfo(in int serial); + oneway void stopSendingSatellitePointingInfo(in int serial); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatelliteIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatelliteIndication.aidl new file mode 100644 index 0000000000..6a03f266b9 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatelliteIndication.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.satellite; +@VintfStability +interface IRadioSatelliteIndication { + oneway void onMessagesTransferComplete(in android.hardware.radio.RadioIndicationType type, in boolean complete); + oneway void onNewMessages(in android.hardware.radio.RadioIndicationType type, in String[] messages); + oneway void onPendingMessageCount(in android.hardware.radio.RadioIndicationType type, in int count); + oneway void onProvisionStateChanged(in android.hardware.radio.RadioIndicationType type, boolean provisioned, in android.hardware.radio.satellite.SatelliteFeature[] features); + oneway void onSatelliteModeChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.satellite.SatelliteMode mode); + oneway void onSatellitePointingInfoChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.satellite.PointingInfo pointingInfo); + oneway void onSatelliteRadioTechnologyChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.satellite.NTRadioTechnology technology); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatelliteResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatelliteResponse.aidl new file mode 100644 index 0000000000..f6614b1b4f --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatelliteResponse.aidl @@ -0,0 +1,52 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.satellite; +@VintfStability +interface IRadioSatelliteResponse { + oneway void acknowledgeRequest(in int serial); + oneway void addAllowedSatelliteContactsResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void getCapabilitiesResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.satellite.SatelliteCapabilities capabilities); + oneway void getMaxCharactersPerTextMessageResponse(in android.hardware.radio.RadioResponseInfo info, in int charLimit); + oneway void getPendingMessagesResponse(in android.hardware.radio.RadioResponseInfo info, in String[] messages); + oneway void getPowerStateResponse(in android.hardware.radio.RadioResponseInfo info, in boolean on); + oneway void getSatelliteModeResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.satellite.SatelliteMode mode, in android.hardware.radio.satellite.NTRadioTechnology technology); + oneway void getTimeForNextSatelliteVisibilityResponse(in android.hardware.radio.RadioResponseInfo info, in int timeInSeconds); + oneway void provisionServiceResponse(in android.hardware.radio.RadioResponseInfo info, in boolean provisioned); + oneway void removeAllowedSatelliteContactsResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void sendMessagesResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setIndicationFilterResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setPowerResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void startSendingSatellitePointingInfoResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void stopSendingSatellitePointingInfoResponse(in android.hardware.radio.RadioResponseInfo info); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IndicationFilter.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IndicationFilter.aidl new file mode 100644 index 0000000000..5aa573933b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IndicationFilter.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.satellite; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum IndicationFilter { + NONE = 0, + SATELLITE_MODE = 1, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/NTRadioTechnology.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/NTRadioTechnology.aidl new file mode 100644 index 0000000000..29de55f6c8 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/NTRadioTechnology.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.satellite; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum NTRadioTechnology { + NB_IOT_NTN = 0, + NR_NTN = 1, + EMTC_NTN = 2, + PROPRIETARY = 3, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/PointingInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/PointingInfo.aidl new file mode 100644 index 0000000000..dcfce349ee --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/PointingInfo.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.satellite; +@JavaDerive(toString=true) @VintfStability +parcelable PointingInfo { + float satelliteAzimuthDegrees; + float satelliteElevationDegrees; + float antennaAzimuthDegrees; + float antennaPitchDegrees; + float antennaRollDegrees; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteCapabilities.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteCapabilities.aidl new file mode 100644 index 0000000000..407a9d1b5a --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteCapabilities.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.satellite; +@JavaDerive(toString=true) @VintfStability +parcelable SatelliteCapabilities { + android.hardware.radio.satellite.NTRadioTechnology[] supportedRadioTechnologies; + boolean isAlwaysOn; + boolean needsPointingToSatellite; + android.hardware.radio.satellite.SatelliteFeature[] supportedFeatures; + boolean needsSeparateSimProfile; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteFeature.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteFeature.aidl new file mode 100644 index 0000000000..315359d888 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteFeature.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.satellite; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum SatelliteFeature { + SOS_SMS = 0, + EMERGENCY_SMS = 1, + SMS = 2, + LOCATION_SHARING = 3, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteMode.aidl new file mode 100644 index 0000000000..1cf6a2c9e9 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteMode.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.satellite; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum SatelliteMode { + POWERED_OFF = 0, + OUT_OF_SERVICE_NOT_SEARCHING = 1, + OUT_OF_SERVICE_SEARCHING = 2, + ACQUIRED = 3, + MESSAGE_TRANSFERRING = 4, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/AccessNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/AccessNetwork.aidl index 8ce689f501..964165149d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/AccessNetwork.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/AccessNetwork.aidl @@ -34,11 +34,11 @@ package android.hardware.radio; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum AccessNetwork { - UNKNOWN = 0, - GERAN = 1, - UTRAN = 2, - EUTRAN = 3, - CDMA2000 = 4, - IWLAN = 5, - NGRAN = 6, + UNKNOWN, + GERAN, + UTRAN, + EUTRAN, + CDMA2000, + IWLAN, + NGRAN, } diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl index afc4f4e833..aa55cd77d9 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl @@ -34,28 +34,28 @@ package android.hardware.radio; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RadioAccessFamily { - UNKNOWN = 1, - GPRS = 2, - EDGE = 4, - UMTS = 8, - IS95A = 16, - IS95B = 32, - ONE_X_RTT = 64, - EVDO_0 = 128, - EVDO_A = 256, - HSDPA = 512, - HSUPA = 1024, - HSPA = 2048, - EVDO_B = 4096, - EHRPD = 8192, - LTE = 16384, - HSPAP = 32768, - GSM = 65536, - TD_SCDMA = 131072, - IWLAN = 262144, + UNKNOWN = (1 << android.hardware.radio.RadioTechnology.UNKNOWN), + GPRS = (1 << android.hardware.radio.RadioTechnology.GPRS), + EDGE = (1 << android.hardware.radio.RadioTechnology.EDGE), + UMTS = (1 << android.hardware.radio.RadioTechnology.UMTS), + IS95A = (1 << android.hardware.radio.RadioTechnology.IS95A), + IS95B = (1 << android.hardware.radio.RadioTechnology.IS95B), + ONE_X_RTT = (1 << android.hardware.radio.RadioTechnology.ONE_X_RTT), + EVDO_0 = (1 << android.hardware.radio.RadioTechnology.EVDO_0), + EVDO_A = (1 << android.hardware.radio.RadioTechnology.EVDO_A), + HSDPA = (1 << android.hardware.radio.RadioTechnology.HSDPA), + HSUPA = (1 << android.hardware.radio.RadioTechnology.HSUPA), + HSPA = (1 << android.hardware.radio.RadioTechnology.HSPA), + EVDO_B = (1 << android.hardware.radio.RadioTechnology.EVDO_B), + EHRPD = (1 << android.hardware.radio.RadioTechnology.EHRPD), + LTE = (1 << android.hardware.radio.RadioTechnology.LTE), + HSPAP = (1 << android.hardware.radio.RadioTechnology.HSPAP), + GSM = (1 << android.hardware.radio.RadioTechnology.GSM), + TD_SCDMA = (1 << android.hardware.radio.RadioTechnology.TD_SCDMA), + IWLAN = (1 << android.hardware.radio.RadioTechnology.IWLAN), /** * @deprecated use LTE instead. */ - LTE_CA = 524288, - NR = 1048576, + LTE_CA = (1 << android.hardware.radio.RadioTechnology.LTE_CA), + NR = (1 << android.hardware.radio.RadioTechnology.NR), } diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl index b91bf03511..448c0bb5c1 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl @@ -37,5 +37,5 @@ parcelable RadioConst { const int MAX_RILDS = 3; const int MAX_UUID_LENGTH = 64; const int CARD_MAX_APPS = 8; - const int P2_CONSTANT_NO_P2 = -1; + const int P2_CONSTANT_NO_P2 = (-1); } diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioError.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioError.aidl index 98606e588b..b9db56c778 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioError.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioError.aidl @@ -123,4 +123,15 @@ enum RadioError { BLOCKED_DUE_TO_CALL = 69, RF_HARDWARE_ISSUE = 70, NO_RF_CALIBRATION_INFO = 71, + ENCODING_NOT_SUPPORTED = 72, + FEATURE_NOT_SUPPORTED = 73, + INVALID_CONTACT = 74, + MODEM_INCOMPATIBLE = 75, + NETWORK_TIMEOUT = 76, + NO_SATELLITE_SIGNAL = 77, + NOT_SUFFICIENT_ACCOUNT_BALANCE = 78, + RADIO_TECHNOLOGY_NOT_SUPPORTED = 79, + SUBSCRIBER_NOT_AUTHORIZED = 80, + SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL = 81, + UNIDENTIFIED_SUBSCRIBER = 82, } diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioIndicationType.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioIndicationType.aidl index 54ea3a4b4f..58b35a5723 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioIndicationType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioIndicationType.aidl @@ -34,6 +34,6 @@ package android.hardware.radio; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RadioIndicationType { - UNSOLICITED = 0, - UNSOLICITED_ACK_EXP = 1, + UNSOLICITED, + UNSOLICITED_ACK_EXP, } diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioResponseType.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioResponseType.aidl index 5cd99c43b0..1ee62bd94c 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioResponseType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioResponseType.aidl @@ -34,7 +34,7 @@ package android.hardware.radio; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RadioResponseType { - SOLICITED = 0, - SOLICITED_ACK = 1, - SOLICITED_ACK_EXP = 2, + SOLICITED, + SOLICITED_ACK, + SOLICITED_ACK_EXP, } diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnology.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnology.aidl index 7060469886..b6af5aabf2 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnology.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnology.aidl @@ -34,28 +34,28 @@ package android.hardware.radio; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RadioTechnology { - UNKNOWN = 0, - GPRS = 1, - EDGE = 2, - UMTS = 3, - IS95A = 4, - IS95B = 5, - ONE_X_RTT = 6, - EVDO_0 = 7, - EVDO_A = 8, - HSDPA = 9, - HSUPA = 10, - HSPA = 11, - EVDO_B = 12, - EHRPD = 13, - LTE = 14, - HSPAP = 15, - GSM = 16, - TD_SCDMA = 17, - IWLAN = 18, + UNKNOWN, + GPRS, + EDGE, + UMTS, + IS95A, + IS95B, + ONE_X_RTT, + EVDO_0, + EVDO_A, + HSDPA, + HSUPA, + HSPA, + EVDO_B, + EHRPD, + LTE, + HSPAP, + GSM, + TD_SCDMA, + IWLAN, /** * @deprecated use LTE instead and indicate carrier aggregation through multiple physical channel configurations in IRadioNetwork::currentPhysicalChannelConfigs. */ - LTE_CA = 19, - NR = 20, + LTE_CA, + NR, } diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnologyFamily.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnologyFamily.aidl index e6fdce269d..2af7e535da 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnologyFamily.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnologyFamily.aidl @@ -34,6 +34,6 @@ package android.hardware.radio; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RadioTechnologyFamily { - THREE_GPP = 0, - THREE_GPP2 = 1, + THREE_GPP, + THREE_GPP2, } diff --git a/radio/aidl/android/hardware/radio/RadioError.aidl b/radio/aidl/android/hardware/radio/RadioError.aidl index 61d5a77ac0..4d44559ee1 100644 --- a/radio/aidl/android/hardware/radio/RadioError.aidl +++ b/radio/aidl/android/hardware/radio/RadioError.aidl @@ -180,7 +180,8 @@ enum RadioError { */ NO_SMS_TO_ACK = 48, /** - * Received error from network + * Received error from network. This generic error code should be used only when the error + * cannot be mapped to other specific network error codes. */ NETWORK_ERR = 49, /** @@ -300,4 +301,51 @@ enum RadioError { * Unlike RF_HARDWARE_ISSUE, this is a SW problem and no HW repair is needed. */ NO_RF_CALIBRATION_INFO = 71, + /** + * The encoding scheme is not supported by either the network or the MS. + */ + ENCODING_NOT_SUPPORTED = 72, + /** + * The requesting feature is not supported by the service provider/operator. + */ + FEATURE_NOT_SUPPORTED = 73, + /** + * The contact to be added is either not existing or not valid. + */ + INVALID_CONTACT = 74, + /** + * The modem of the MS is not compatible with the service provider/operator. This generic error + * should be used only when there are some mimatches in the capabilities between the MS and + * the operator and the error cannot be mapped properly to other specific network errors. + */ + MODEM_INCOMPATIBLE = 75, + /** + * Modem timeout to receive ACK or response from network after sending a request to the network. + */ + NETWORK_TIMEOUT = 76, + /** + * Modem fails to communicate with the satellite network since there is no satellite signal. + */ + NO_SATELLITE_SIGNAL = 77, + /** + * The request cannot be performed since the subscriber's account balance is not sufficient. + */ + NOT_SUFFICIENT_ACCOUNT_BALANCE = 78, + /** + * The radio technology is not supported by the service provider/operator. + */ + RADIO_TECHNOLOGY_NOT_SUPPORTED = 79, + /** + * The subscription is not authorized to register with the service provider/operator. + */ + SUBSCRIBER_NOT_AUTHORIZED = 80, + /** + * While processing a request from the Framework, the satellite modem detects terrestrial + * signal, aborts the request, and switches to the terrestrial network. + */ + SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL = 81, + /** + * The subscriber is not registered in the service provider. + */ + UNIDENTIFIED_SUBSCRIBER = 82 } diff --git a/radio/aidl/android/hardware/radio/satellite/IRadioSatellite.aidl b/radio/aidl/android/hardware/radio/satellite/IRadioSatellite.aidl new file mode 100644 index 0000000000..87f13a655e --- /dev/null +++ b/radio/aidl/android/hardware/radio/satellite/IRadioSatellite.aidl @@ -0,0 +1,168 @@ +/* + * 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. + */ + +package android.hardware.radio.satellite; + +import android.hardware.radio.satellite.IRadioSatelliteIndication; +import android.hardware.radio.satellite.IRadioSatelliteResponse; +import android.hardware.radio.satellite.IndicationFilter; +import android.hardware.radio.satellite.SatelliteFeature; + +/** + * This interface is used by telephony to send commands to and query info from satellite modem. + * All the functions have minimum one parameter: + * serial: which corresponds to serial no. of request. Serial numbers must only be memorized for the + * duration of a method call. If clients provide colliding serials (including passing the same + * serial to different methods), multiple responses (one for each method call) must still be served. + */ +@VintfStability +oneway interface IRadioSatellite { + /** + * Add contacts that are allowed to be used for satellite communication. This is applicable for + * incoming messages as well. + * + * @param serial Serial number of request. + * @param contacts List of allowed contacts to be added. + */ + void addAllowedSatelliteContacts(in int serial, in String[] contacts); + + /** + * Get feature capabilities supported by satellite. + * + * @param serial Serial number of request. + */ + void getCapabilities(in int serial); + + /** + * Get max number of characters per text message. + * + * @param serial Serial number of request. + */ + void getMaxCharactersPerTextMessage(in int serial); + + /** + * Get pending messages. + * + * @param serial Serial number of request. + */ + void getPendingMessages(in int serial); + + /** + * Get satellite modem state. + * + * @param serial Serial number of request. + */ + void getPowerState(in int serial); + + /** + * Get current satellite registration mode, which is defined in {@link #SatelliteMode}. + * + * @param serial Serial number of request. + */ + void getSatelliteMode(in int serial); + + /** + * Get time for next visibility of satellite. + * + * @param serial Serial number of request. + */ + void getTimeForNextSatelliteVisibility(in int serial); + + /** + * Provision the subscription with a satellite provider. This is needed to register the + * subscription if the provider allows dynamic registration. + * + * @param serial Serial number of request. + * @param imei IMEI of the SIM associated with the satellite modem. + * @param msisdn MSISDN of the SIM associated with the satellite modem. + * @param imsi IMSI of the SIM associated with the satellite modem. + * @param features List of features to be provisioned. + */ + void provisionService(in int serial, in String imei, in String msisdn, in String imsi, + in SatelliteFeature[] features); + + /** + * Remove contacts that are allowed to be used for satellite communication. This is applicable + * for incoming messages as well. + * + * @param serial Serial number of request. + * @param contacts List of allowed contacts to be removed. + */ + void removeAllowedSatelliteContacts(in int serial, in String[] contacts); + + /** + * When response type received from a radio indication or radio response is + * RadioIndicationType:UNSOLICITED_ACK_EXP or RadioResponseType:SOLICITED_ACK_EXP respectively, + * acknowledge the receipt of those messages by sending responseAcknowledgement(). + */ + void responseAcknowledgement(); + + /** + * Send text messages. + * + * @param serial Serial number of request. + * @param messages List of messages in text format to be sent. + * @param destination The recipient of the message. + * @param latitude The current latitude of the device. + * @param longitude The current longitude of the device. The location (i.e., latitude and + * longitude) of the device will be filled for emergency messages. + */ + void sendMessages(in int serial, in String[] messages, in String destination, + in double latitude, in double longitude); + + /** + * Set the filter for what type of indication framework want to receive from modem. + * + * @param serial Serial number of request. + * @param filterBitmask The filter bitmask identifying what type of indication Telephony + * framework wants to receive from modem. This bitmask is the 'or' + * combination of the enum values defined in {@link #IndicationFilter}. + */ + void setIndicationFilter(in int serial, in int filterBitmask); + + /** + * Turn satellite modem on/off. + * + * @param serial Serial number of request. + * @param on True for turning on. + * False for turning off. + */ + void setPower(in int serial, in boolean on); + + /** + * Set response functions for Satellite requests and indications. + * + * @param satelliteResponse Object containing response functions + * @param satelliteIndication Object containing radio indications + */ + void setResponseFunctions(in IRadioSatelliteResponse satelliteResponse, + in IRadioSatelliteIndication satelliteIndication); + + /** + * User started pointing to the satellite. Modem should continue to update the pointing input + * as user device/satellite moves. + * + * @param serial Serial number of request. + */ + void startSendingSatellitePointingInfo(in int serial); + + /** + * Stop sending satellite pointing info to the framework. + * + * @param serial Serial number of request. + */ + void stopSendingSatellitePointingInfo(in int serial); +} diff --git a/radio/aidl/android/hardware/radio/satellite/IRadioSatelliteIndication.aidl b/radio/aidl/android/hardware/radio/satellite/IRadioSatelliteIndication.aidl new file mode 100644 index 0000000000..f1d97476d4 --- /dev/null +++ b/radio/aidl/android/hardware/radio/satellite/IRadioSatelliteIndication.aidl @@ -0,0 +1,90 @@ +/* + * 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. + */ + +package android.hardware.radio.satellite; + +import android.hardware.radio.RadioIndicationType; +import android.hardware.radio.satellite.NTRadioTechnology; +import android.hardware.radio.satellite.PointingInfo; +import android.hardware.radio.satellite.SatelliteFeature; +import android.hardware.radio.satellite.SatelliteMode; + +/** + * Interface declaring unsolicited radio indications for satellite APIs. + */ +@VintfStability +oneway interface IRadioSatelliteIndication { + /** + * Confirms that ongoing message transfer is complete. + * + * @param type Type of radio indication + * @param complete True mean the transfer is complete. + * False means the transfer is not complete. + */ + void onMessagesTransferComplete(in RadioIndicationType type, in boolean complete); + + /** + * Indicates new message received on device. + * + * @param type Type of radio indication + * @param messages List of new messages received. + */ + void onNewMessages(in RadioIndicationType type, in String[] messages); + + /** + * Indicates that satellite has pending messages for the device to be pulled. + * + * @param type Type of radio indication + * @param count Number of pending messages. + */ + void onPendingMessageCount(in RadioIndicationType type, in int count); + + /** + * Indicate that satellite provision state has changed. + * + * @param type Type of radio indication + * @param provisioned True means the service is provisioned. + * False means the service is not provisioned. + * @param features List of Feature whose provision state has changed. + */ + void onProvisionStateChanged( + in RadioIndicationType type, boolean provisioned, in SatelliteFeature[] features); + + /** + * Indicate that satellite mode has changed. + * + * @param type Type of radio indication + * @param mode The current mode of the satellite modem. + */ + void onSatelliteModeChanged(in RadioIndicationType type, in SatelliteMode mode); + + /** + * Indicate that satellite Pointing input has changed. + * + * @param type Type of radio indication + * @param pointingInfo The current pointing info. + */ + void onSatellitePointingInfoChanged(in RadioIndicationType type, in PointingInfo pointingInfo); + + /** + * Indicate that satellite radio technology has changed. + * + * @param type Type of radio indication + * @param technology The current technology of the satellite modem. + */ + void onSatelliteRadioTechnologyChanged( + in RadioIndicationType type, in NTRadioTechnology technology); +} diff --git a/radio/aidl/android/hardware/radio/satellite/IRadioSatelliteResponse.aidl b/radio/aidl/android/hardware/radio/satellite/IRadioSatelliteResponse.aidl new file mode 100644 index 0000000000..e81edaa997 --- /dev/null +++ b/radio/aidl/android/hardware/radio/satellite/IRadioSatelliteResponse.aidl @@ -0,0 +1,461 @@ +/* + * 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. + */ + +package android.hardware.radio.satellite; + +import android.hardware.radio.RadioResponseInfo; +import android.hardware.radio.satellite.NTRadioTechnology; +import android.hardware.radio.satellite.SatelliteCapabilities; +import android.hardware.radio.satellite.SatelliteMode; + +/** + * Interface declaring response functions to solicited radio requests for satellite APIs. + */ +@VintfStability +oneway interface IRadioSatelliteResponse { + /** + * Acknowledge the receipt of radio request sent to the vendor. This must be sent only for + * radio request which take long time to respond. For more details, refer + * https://source.android.com/devices/tech/connect/ril.html + * + * @param serial Serial no. of the request whose acknowledgement is sent. + */ + void acknowledgeRequest(in int serial); + + /** + * Response of the request addAllowedSatelliteContacts. + * + * @param info Response info struct containing serial no. and error + * + * Valid errors returned: + * RadioError:NONE + * RadioError:ABORTED + * RadioError:ACCESS_BARRED + * RadioError:CANCELLED + * RadioError:INTERNAL_ERR + * RadioError:INVALID_ARGUMENTS + * RadioError:INVALID_CONTACT + * RadioError:INVALID_MODEM_STATE + * RadioError:INVALID_SIM_STATE + * RadioError:INVALID_STATE + * RadioError:MODEM_ERR + * RadioError:NETWORK_ERR + * RadioError:NETWORK_NOT_READY + * RadioError:NETWORK_REJECT + * RadioError:NETWORK_TIMEOUT + * RadioError:NO_MEMORY + * RadioError:NO_NETWORK_FOUND + * RadioError:NO_RESOURCES + * RadioError:NO_SATELLITE_SIGNAL + * RadioError:NO_SUBSCRIPTION + * RadioError:NOT_SUFFICIENT_ACCOUNT_BALANCE + * RadioError:OPERATION_NOT_ALLOWED + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:REQUEST_RATE_LIMITED + * RadioError:SIM_ABSENT + * RadioError:SIM_BUSY + * RadioError:SIM_ERR + * RadioError:SIM_FULL + * RadioError:SYSTEM_ERR + * RadioError:UNIDENTIFIED_SUBSCRIBER + */ + void addAllowedSatelliteContactsResponse(in RadioResponseInfo info); + + /** + * Response of the request getCapabilities. + * + * @param info Response info struct containing serial no. and error + * @param capabilities List of capabilities that the satellite modem supports. + * + * Valid errors returned: + * RadioError:NONE + * RadioError:INTERNAL_ERR + * RadioError:INVALID_ARGUMENTS + * RadioError:INVALID_MODEM_STATE + * RadioError:INVALID_SIM_STATE + * RadioError:INVALID_STATE + * RadioError:MODEM_ERR + * RadioError:NO_MEMORY + * RadioError:NO_RESOURCES + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:REQUEST_RATE_LIMITED + * RadioError:SYSTEM_ERR + */ + void getCapabilitiesResponse(in RadioResponseInfo info, in SatelliteCapabilities capabilities); + + /** + * Response of the request getMaxCharactersPerTextMessage. + * + * @param info Response info struct containing serial no. and error + * @param charLimit Maximum number of characters in a text message that can be sent. + * + * Valid errors returned: + * RadioError:NONE + * RadioError:INTERNAL_ERR + * RadioError:INVALID_ARGUMENTS + * RadioError:INVALID_MODEM_STATE + * RadioError:INVALID_SIM_STATE + * RadioError:INVALID_STATE + * RadioError:MODEM_ERR + * RadioError:NO_MEMORY + * RadioError:NO_RESOURCES + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:REQUEST_RATE_LIMITED + * RadioError:SYSTEM_ERR + */ + void getMaxCharactersPerTextMessageResponse(in RadioResponseInfo info, in int charLimit); + + /** + * Response of the request getPendingMessages. + * + * @param info Response info struct containing serial no. and error + * @param messages List of pending messages received. + * + * Valid errors returned: + * RadioError:NONE + * RadioError:ABORTED + * RadioError:ACCESS_BARRED + * RadioError:BLOCKED_DUE_TO_CALL + * RadioError:CANCELLED + * RadioError:ENCODING_ERR + * RadioError:ENCODING_NOT_SUPPORTED + * RadioError:INTERNAL_ERR + * RadioError:INVALID_ARGUMENTS + * RadioError:INVALID_MODEM_STATE + * RadioError:INVALID_SIM_STATE + * RadioError:INVALID_SMS_FORMAT + * RadioError:INVALID_STATE + * RadioError:MODEM_ERR + * RadioError:NETWORK_ERR + * RadioError:NETWORK_NOT_READY + * RadioError:NETWORK_REJECT + * RadioError:NETWORK_TIMEOUT + * RadioError:NO_MEMORY + * RadioError:NO_NETWORK_FOUND + * RadioError:NO_RESOURCES + * RadioError:NO_SMS_TO_ACK + * RadioError:NO_SATELLITE_SIGNAL + * RadioError:NO_SUBSCRIPTION + * RadioError:NOT_SUFFICIENT_ACCOUNT_BALANCE + * RadioError:OPERATION_NOT_ALLOWED + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:REQUEST_RATE_LIMITED + * RadioError:SIM_ABSENT + * RadioError:SIM_BUSY + * RadioError:SIM_ERR + * RadioError:SIM_FULL + * RadioError:SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED + * RadioError:SYSTEM_ERR + * RadioError:SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL + */ + void getPendingMessagesResponse(in RadioResponseInfo info, in String[] messages); + + /** + * Response of the request getPowerSate. + * + * @param info Response info struct containing serial no. and error + * @param on True means the modem is ON. + * False means the modem is OFF. + * + * Valid errors returned: + * RadioError:NONE + * RadioError:INTERNAL_ERR + * RadioError:INVALID_ARGUMENTS + * RadioError:INVALID_MODEM_STATE + * RadioError:INVALID_SIM_STATE + * RadioError:INVALID_STATE + * RadioError:MODEM_ERR + * RadioError:NO_MEMORY + * RadioError:NO_RESOURCES + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:REQUEST_RATE_LIMITED + * RadioError:SYSTEM_ERR + */ + void getPowerStateResponse(in RadioResponseInfo info, in boolean on); + + /** + * Response of the request getSatelliteMode. + * + * @param info Response info struct containing serial no. and error + * @param mode Current Mode of the satellite modem. + * @param technology The current technology of the satellite modem. + * + * Valid errors returned: + * RadioError:NONE + * RadioError:INTERNAL_ERR + * RadioError:INVALID_ARGUMENTS + * RadioError:INVALID_MODEM_STATE + * RadioError:INVALID_SIM_STATE + * RadioError:INVALID_STATE + * RadioError:MODEM_ERR + * RadioError:NO_MEMORY + * RadioError:NO_RESOURCES + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:REQUEST_RATE_LIMITED + * RadioError:SYSTEM_ERR + */ + void getSatelliteModeResponse( + in RadioResponseInfo info, in SatelliteMode mode, in NTRadioTechnology technology); + + /** + * Response of the request getTimeForNextSatelliteVisibility. + * + * @param info Response info struct containing serial no. and error + * @param timeInSeconds The duration in seconds after which the satellite will be visible. + * + * Valid errors returned: + * RadioError:NONE + * RadioError:INTERNAL_ERR + * RadioError:INVALID_ARGUMENTS + * RadioError:INVALID_MODEM_STATE + * RadioError:INVALID_SIM_STATE + * RadioError:INVALID_STATE + * RadioError:MODEM_ERR + * RadioError:NO_MEMORY + * RadioError:NO_RESOURCES + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:REQUEST_RATE_LIMITED + * RadioError:SYSTEM_ERR + */ + void getTimeForNextSatelliteVisibilityResponse(in RadioResponseInfo info, in int timeInSeconds); + + /** + * Response of the request provisionService. + * + * @param info Response info struct containing serial no. and error + * @param provisioned True means the service is provisioned. + * False means the service is not provisioned. + * + * Valid errors returned: + * RadioError:NONE + * RadioError:ABORTED + * RadioError:ACCESS_BARRED + * RadioError:CANCELLED + * RadioError:FEATURE_NOT_SUPPORTED + * RadioError:INTERNAL_ERR + * RadioError:INVALID_ARGUMENTS + * RadioError:INVALID_MODEM_STATE + * RadioError:INVALID_SIM_STATE + * RadioError:INVALID_STATE + * RadioError:MODEM_ERR + * RadioError:MODEM_INCOMPATIBLE + * RadioError:NETWORK_ERR + * RadioError:NETWORK_NOT_READY + * RadioError:NETWORK_REJECT + * RadioError:NETWORK_TIMEOUT + * RadioError:NO_MEMORY + * RadioError:NO_NETWORK_FOUND + * RadioError:NO_RESOURCES + * RadioError:NO_SATELLITE_SIGNAL + * RadioError:NO_SUBSCRIPTION + * RadioError:OPERATION_NOT_ALLOWED + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:RADIO_TECHNOLOGY_NOT_SUPPORTED + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:REQUEST_RATE_LIMITED + * RadioError:SIM_ABSENT + * RadioError:SIM_BUSY + * RadioError:SIM_ERR + * RadioError:SIM_FULL + * RadioError:SUBSCRIBER_NOT_AUTHORIZED + * RadioError:SYSTEM_ERR + */ + void provisionServiceResponse(in RadioResponseInfo info, in boolean provisioned); + + /** + * Response of the request removeAllowedSatelliteContacts. + * + * @param info Response info struct containing serial no. and error + * + * Valid errors returned: + * RadioError:NONE + * RadioError:ABORTED + * RadioError:ACCESS_BARRED + * RadioError:CANCELLED + * RadioError:INTERNAL_ERR + * RadioError:INVALID_ARGUMENTS + * RadioError:INVALID_CONTACT + * RadioError:INVALID_MODEM_STATE + * RadioError:INVALID_SIM_STATE + * RadioError:INVALID_STATE + * RadioError:MODEM_ERR + * RadioError:NETWORK_ERR + * RadioError:NETWORK_NOT_READY + * RadioError:NETWORK_REJECT + * RadioError:NETWORK_TIMEOUT + * RadioError:NO_MEMORY + * RadioError:NO_NETWORK_FOUND + * RadioError:NO_RESOURCES + * RadioError:NO_SATELLITE_SIGNAL + * RadioError:NO_SUBSCRIPTION + * RadioError:NOT_SUFFICIENT_ACCOUNT_BALANCE + * RadioError:OPERATION_NOT_ALLOWED + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:REQUEST_RATE_LIMITED + * RadioError:SIM_ABSENT + * RadioError:SIM_BUSY + * RadioError:SIM_ERR + * RadioError:SIM_FULL + * RadioError:SYSTEM_ERR + * RadioError:UNIDENTIFIED_SUBSCRIBER + */ + void removeAllowedSatelliteContactsResponse(in RadioResponseInfo info); + + /** + * Response of the request sendMessages. + * + * @param info Response info struct containing serial no. and error + * + * Valid errors returned: + * RadioError:NONE + * RadioError:ABORTED + * RadioError:ACCESS_BARRED + * RadioError:BLOCKED_DUE_TO_CALL + * RadioError:CANCELLED + * RadioError:ENCODING_ERR + * RadioError:ENCODING_NOT_SUPPORTED + * RadioError:INTERNAL_ERR + * RadioError:INVALID_ARGUMENTS + * RadioError:INVALID_MODEM_STATE + * RadioError:INVALID_SIM_STATE + * RadioError:INVALID_SMS_FORMAT + * RadioError:INVALID_STATE + * RadioError:MODEM_ERR + * RadioError:NETWORK_ERR + * RadioError:NETWORK_NOT_READY + * RadioError:NETWORK_REJECT + * RadioError:NETWORK_TIMEOUT + * RadioError:NO_MEMORY + * RadioError:NO_NETWORK_FOUND + * RadioError:NO_RESOURCES + * RadioError:NO_SMS_TO_ACK + * RadioError:NO_SATELLITE_SIGNAL + * RadioError:NO_SUBSCRIPTION + * RadioError:NOT_SUFFICIENT_ACCOUNT_BALANCE + * RadioError:OPERATION_NOT_ALLOWED + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:REQUEST_RATE_LIMITED + * RadioError:SIM_ABSENT + * RadioError:SIM_BUSY + * RadioError:SIM_ERR + * RadioError:SIM_FULL + * RadioError:SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED + * RadioError:SMS_SEND_FAIL_RETRY + * RadioError:SYSTEM_ERR + * RadioError:SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL + * RadioError:UNIDENTIFIED_SUBSCRIBER + */ + void sendMessagesResponse(in RadioResponseInfo info); + + /** + * Response of the request setIndicationFilter. + * + * @param info Response info struct containing serial no. and error + * + * Valid errors returned: + * RadioError:NONE + * RadioError:INTERNAL_ERR + * RadioError:INVALID_ARGUMENTS + * RadioError:INVALID_MODEM_STATE + * RadioError:INVALID_SIM_STATE + * RadioError:INVALID_STATE + * RadioError:MODEM_ERR + * RadioError:NO_MEMORY + * RadioError:NO_RESOURCES + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:REQUEST_RATE_LIMITED + * RadioError:SYSTEM_ERR + */ + void setIndicationFilterResponse(in RadioResponseInfo info); + + /** + * Response of the request setPower. + * + * @param info Response info struct containing serial no. and error + * + * Valid errors returned: + * RadioError:NONE + * RadioError:INTERNAL_ERR + * RadioError:INVALID_ARGUMENTS + * RadioError:INVALID_MODEM_STATE + * RadioError:INVALID_SIM_STATE + * RadioError:INVALID_STATE + * RadioError:MODEM_ERR + * RadioError:NO_MEMORY + * RadioError:NO_RESOURCES + * RadioError:NO_RF_CALIBRATION_INFO + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:REQUEST_RATE_LIMITED + * RadioError:RF_HARDWARE_ISSUE + * RadioError:SYSTEM_ERR + */ + void setPowerResponse(in RadioResponseInfo info); + + /** + * Response of the request startSendingSatellitePointingInfo. + * + * @param info Response info struct containing serial no. and error + * + * Valid errors returned: + * RadioError:NONE + * RadioError:INTERNAL_ERR + * RadioError:INVALID_ARGUMENTS + * RadioError:INVALID_MODEM_STATE + * RadioError:INVALID_SIM_STATE + * RadioError:INVALID_STATE + * RadioError:MODEM_ERR + * RadioError:NO_MEMORY + * RadioError:NO_RESOURCES + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:REQUEST_RATE_LIMITED + * RadioError:SYSTEM_ERR + */ + void startSendingSatellitePointingInfoResponse(in RadioResponseInfo info); + + /** + * Response of the request stopSendingSatellitePointingInfo. + * + * @param info Response info struct containing serial no. and error + * + * Valid errors returned: + * RadioError:NONE + * RadioError:INTERNAL_ERR + * RadioError:INVALID_ARGUMENTS + * RadioError:INVALID_MODEM_STATE + * RadioError:INVALID_SIM_STATE + * RadioError:INVALID_STATE + * RadioError:MODEM_ERR + * RadioError:NO_MEMORY + * RadioError:NO_RESOURCES + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:REQUEST_NOT_SUPPORTED + * RadioError:REQUEST_RATE_LIMITED + * RadioError:SYSTEM_ERR + */ + void stopSendingSatellitePointingInfoResponse(in RadioResponseInfo info); +} diff --git a/radio/aidl/android/hardware/radio/satellite/IndicationFilter.aidl b/radio/aidl/android/hardware/radio/satellite/IndicationFilter.aidl new file mode 100644 index 0000000000..1a65bee594 --- /dev/null +++ b/radio/aidl/android/hardware/radio/satellite/IndicationFilter.aidl @@ -0,0 +1,25 @@ +/* + * 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. + */ + +package android.hardware.radio.satellite; + +@VintfStability +@Backing(type="int") +@JavaDerive(toString=true) +enum IndicationFilter { + NONE = 0, + SATELLITE_MODE = 1 +} diff --git a/radio/aidl/android/hardware/radio/satellite/NTRadioTechnology.aidl b/radio/aidl/android/hardware/radio/satellite/NTRadioTechnology.aidl new file mode 100644 index 0000000000..39b2b0054f --- /dev/null +++ b/radio/aidl/android/hardware/radio/satellite/NTRadioTechnology.aidl @@ -0,0 +1,31 @@ +/* + * 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. + */ + +package android.hardware.radio.satellite; + +@VintfStability +@Backing(type="int") +@JavaDerive(toString=true) +enum NTRadioTechnology { + /* 3GPP NB-IoT (Narrowband Internet of Things) over Non-Terrestrial-Networks technology */ + NB_IOT_NTN = 0, + /* 3GPP 5G NR over Non-Terrestrial-Networks technology */ + NR_NTN = 1, + /* 3GPP eMTC (enhanced Machine-Type Communication) over Non-Terrestrial-Networks technology */ + EMTC_NTN = 2, + /* Proprietary technology like Iridium or Bullitt */ + PROPRIETARY = 3 +} diff --git a/radio/aidl/android/hardware/radio/satellite/PointingInfo.aidl b/radio/aidl/android/hardware/radio/satellite/PointingInfo.aidl new file mode 100644 index 0000000000..8496a598a7 --- /dev/null +++ b/radio/aidl/android/hardware/radio/satellite/PointingInfo.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ + +package android.hardware.radio.satellite; + +@VintfStability +@JavaDerive(toString=true) +parcelable PointingInfo { + /* Satellite azimuth in degrees */ + float satelliteAzimuthDegrees; + + /* Satellite elevation in degrees */ + float satelliteElevationDegrees; + + /* Antenna azimuth in degrees */ + float antennaAzimuthDegrees; + + /** + * Angle of rotation about the x axis. This value represents the angle between a plane + * parallel to the device's screen and a plane parallel to the ground. + */ + float antennaPitchDegrees; + + /** + * Angle of rotation about the y axis. This value represents the angle between a plane + * perpendicular to the device's screen and a plane parallel to the ground. + */ + float antennaRollDegrees; +} diff --git a/radio/aidl/android/hardware/radio/satellite/SatelliteCapabilities.aidl b/radio/aidl/android/hardware/radio/satellite/SatelliteCapabilities.aidl new file mode 100644 index 0000000000..01e64aa67f --- /dev/null +++ b/radio/aidl/android/hardware/radio/satellite/SatelliteCapabilities.aidl @@ -0,0 +1,50 @@ +/* + * 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. + */ + +package android.hardware.radio.satellite; + +import android.hardware.radio.satellite.NTRadioTechnology; +import android.hardware.radio.satellite.SatelliteFeature; + +@VintfStability +@JavaDerive(toString=true) +parcelable SatelliteCapabilities { + /** + * List of technologies supported by the satellite modem. + */ + NTRadioTechnology[] supportedRadioTechnologies; + + /** + * Whether satellite mode is always on (this indicates the power impact of keeping it on is + * very minimal). + */ + boolean isAlwaysOn; + + /** + * Whether UE needs to point to a satellite to send and receive data. + */ + boolean needsPointingToSatellite; + + /** + * List of features supported by the satellite modem. + */ + SatelliteFeature[] supportedFeatures; + + /** + * Whether UE needs a separate SIM profile to communicate with satellite network. + */ + boolean needsSeparateSimProfile; +} diff --git a/radio/aidl/android/hardware/radio/satellite/SatelliteFeature.aidl b/radio/aidl/android/hardware/radio/satellite/SatelliteFeature.aidl new file mode 100644 index 0000000000..0e33998357 --- /dev/null +++ b/radio/aidl/android/hardware/radio/satellite/SatelliteFeature.aidl @@ -0,0 +1,31 @@ +/* + * 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. + */ + +package android.hardware.radio.satellite; + +@VintfStability +@Backing(type="int") +@JavaDerive(toString=true) +enum SatelliteFeature { + /* Able to send and receive SMS messages to/from SOS numbers like call/service centers */ + SOS_SMS = 0, + /* Able to send and receive SMS messages to/from emergency numbers like 911 */ + EMERGENCY_SMS = 1, + /* Able to send and receive SMS messages to/from any allowed contacts */ + SMS = 2, + /* Able to send device location to allowed contacts */ + LOCATION_SHARING = 3 +} diff --git a/radio/aidl/android/hardware/radio/satellite/SatelliteMode.aidl b/radio/aidl/android/hardware/radio/satellite/SatelliteMode.aidl new file mode 100644 index 0000000000..349fd9e0fd --- /dev/null +++ b/radio/aidl/android/hardware/radio/satellite/SatelliteMode.aidl @@ -0,0 +1,33 @@ +/* + * 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. + */ + +package android.hardware.radio.satellite; + +@VintfStability +@Backing(type="int") +@JavaDerive(toString=true) +enum SatelliteMode { + /* Satellite modem is powered off */ + POWERED_OFF = 0, + /* Satellite modem is in out of service state and not searching for satellite signal */ + OUT_OF_SERVICE_NOT_SEARCHING = 1, + /* Satellite modem is in out of service state and searching for satellite signal */ + OUT_OF_SERVICE_SEARCHING = 2, + /* Satellite modem has found satellite signal and gets connected to the satellite network */ + ACQUIRED = 3, + /* Satellite modem is sending and/or receiving messages */ + MESSAGE_TRANSFERRING = 4 +} diff --git a/radio/aidl/compat/libradiocompat/Android.bp b/radio/aidl/compat/libradiocompat/Android.bp index 95953acab1..6bbc9fe7b2 100644 --- a/radio/aidl/compat/libradiocompat/Android.bp +++ b/radio/aidl/compat/libradiocompat/Android.bp @@ -42,6 +42,7 @@ cc_library { "android.hardware.radio.modem-V2-ndk", "android.hardware.radio.network-V2-ndk", "android.hardware.radio.sap-V1-ndk", + "android.hardware.radio.satellite-V1-ndk", "android.hardware.radio.sim-V2-ndk", "android.hardware.radio.voice-V2-ndk", "android.hardware.radio@1.0", @@ -90,6 +91,9 @@ cc_library { "sap/Sap.cpp", "sap/SapCallback.cpp", "sap/structs.cpp", + "satellite/RadioIndication-satellite.cpp", + "satellite/RadioResponse-satellite.cpp", + "satellite/RadioSatellite.cpp", "sim/RadioIndication-sim.cpp", "sim/RadioResponse-sim.cpp", "sim/RadioSim.cpp", diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h index f042456409..ad9127e461 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -60,6 +61,10 @@ class RadioIndication : public V1_6::IRadioIndication { ::aidl::android::hardware::radio::ims::IRadioImsIndication, ::aidl::android::hardware::radio::ims::IRadioImsIndicationDefault, true> mImsCb; + GuaranteedCallback< // + ::aidl::android::hardware::radio::satellite::IRadioSatelliteIndication, + ::aidl::android::hardware::radio::satellite::IRadioSatelliteIndicationDefault, true> + mSatelliteCb; // IRadioIndication @ 1.0 Return radioStateChanged(V1_0::RadioIndicationType type, @@ -227,6 +232,9 @@ class RadioIndication : public V1_6::IRadioIndication { std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceIndication> voicCb); void setResponseFunction( std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsIndication> imsCb); + void setResponseFunction( + std::shared_ptr<::aidl::android::hardware::radio::satellite::IRadioSatelliteIndication> + satelliteCb); std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataIndication> dataCb(); std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingIndication> @@ -236,6 +244,8 @@ class RadioIndication : public V1_6::IRadioIndication { std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimIndication> simCb(); std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceIndication> voiceCb(); std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsIndication> imsCb(); + std::shared_ptr<::aidl::android::hardware::radio::satellite::IRadioSatelliteIndication> + satelliteCb(); }; } // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h index 22451aec7e..636c1a4fa1 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -53,6 +54,9 @@ class RadioResponse : public V1_6::IRadioResponse { GuaranteedCallback<::aidl::android::hardware::radio::ims::IRadioImsResponse, ::aidl::android::hardware::radio::ims::IRadioImsResponseDefault> mImsCb; + GuaranteedCallback<::aidl::android::hardware::radio::satellite::IRadioSatelliteResponse, + ::aidl::android::hardware::radio::satellite::IRadioSatelliteResponseDefault> + mSatelliteCb; // IRadioResponse @ 1.0 Return getIccCardStatusResponse(const V1_0::RadioResponseInfo& info, @@ -446,6 +450,9 @@ class RadioResponse : public V1_6::IRadioResponse { std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse> voiceCb); void setResponseFunction( std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse> imsCb); + void setResponseFunction( + std::shared_ptr<::aidl::android::hardware::radio::satellite::IRadioSatelliteResponse> + satelliteCb); std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataResponse> dataCb(); std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingResponse> @@ -455,6 +462,8 @@ class RadioResponse : public V1_6::IRadioResponse { std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimResponse> simCb(); std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse> voiceCb(); std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse> imsCb(); + std::shared_ptr<::aidl::android::hardware::radio::satellite::IRadioSatelliteResponse> + satelliteCb(); }; } // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioSatellite.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioSatellite.h new file mode 100644 index 0000000000..3ee6db2721 --- /dev/null +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioSatellite.h @@ -0,0 +1,65 @@ +/* + * 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. + */ +#pragma once + +#include "RadioCompatBase.h" + +#include + +namespace android::hardware::radio::compat { + +class RadioSatellite : public RadioCompatBase, + public aidl::android::hardware::radio::satellite::BnRadioSatellite { + ::ndk::ScopedAStatus responseAcknowledgement() override; + ::ndk::ScopedAStatus getCapabilities(int32_t serial) override; + ::ndk::ScopedAStatus setPower(int32_t serial, bool on) override; + ::ndk::ScopedAStatus getPowerState(int32_t serial) override; + ::ndk::ScopedAStatus provisionService( + int32_t serial, const std::string& imei, const std::string& msisdn, + const std::string& imsi, + const std::vector<::aidl::android::hardware::radio::satellite::SatelliteFeature>& + features) override; + ::ndk::ScopedAStatus addAllowedSatelliteContacts( + int32_t serial, const std::vector& contacts) override; + ::ndk::ScopedAStatus removeAllowedSatelliteContacts( + int32_t serial, const std::vector& contacts) override; + ::ndk::ScopedAStatus sendMessages(int32_t serial, const std::vector& messages, + const std::string& destination, double latitude, + double longitude) override; + ::ndk::ScopedAStatus getPendingMessages(int32_t serial) override; + ::ndk::ScopedAStatus getSatelliteMode(int32_t serial) override; + ::ndk::ScopedAStatus setIndicationFilter(int32_t serial, int32_t filterBitmask) override; + ::ndk::ScopedAStatus startSendingSatellitePointingInfo(int32_t serial) override; + ::ndk::ScopedAStatus stopSendingSatellitePointingInfo(int32_t serial) override; + ::ndk::ScopedAStatus getMaxCharactersPerTextMessage(int32_t serial) override; + ::ndk::ScopedAStatus getTimeForNextSatelliteVisibility(int32_t serial) override; + + ::ndk::ScopedAStatus setResponseFunctions( + const std::shared_ptr< + ::aidl::android::hardware::radio::satellite::IRadioSatelliteResponse>& + radioSatelliteResponse, + const std::shared_ptr< + ::aidl::android::hardware::radio::satellite::IRadioSatelliteIndication>& + radioSatelliteIndication) override; + + protected: + std::shared_ptr<::aidl::android::hardware::radio::satellite::IRadioSatelliteResponse> respond(); + + public: + using RadioCompatBase::RadioCompatBase; +}; + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/satellite/RadioIndication-satellite.cpp b/radio/aidl/compat/libradiocompat/satellite/RadioIndication-satellite.cpp new file mode 100644 index 0000000000..39da43d832 --- /dev/null +++ b/radio/aidl/compat/libradiocompat/satellite/RadioIndication-satellite.cpp @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#include + +#include "commonStructs.h" +#include "debug.h" + +#include "collections.h" + +#define RADIO_MODULE "RadioSatelliteIndication" + +namespace android::hardware::radio::compat { + +namespace aidl = ::aidl::android::hardware::radio::satellite; + +void RadioIndication::setResponseFunction( + std::shared_ptr satelliteCb) { + mSatelliteCb = satelliteCb; +} + +std::shared_ptr RadioIndication::satelliteCb() { + return mSatelliteCb.get(); +} + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/satellite/RadioResponse-satellite.cpp b/radio/aidl/compat/libradiocompat/satellite/RadioResponse-satellite.cpp new file mode 100644 index 0000000000..2209c93c2e --- /dev/null +++ b/radio/aidl/compat/libradiocompat/satellite/RadioResponse-satellite.cpp @@ -0,0 +1,39 @@ +/* + * 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. + */ + +#include + +#include "commonStructs.h" +#include "debug.h" + +#include "collections.h" + +#define RADIO_MODULE "RadioSatelliteResponse" + +namespace android::hardware::radio::compat { + +namespace aidl = ::aidl::android::hardware::radio::satellite; + +void RadioResponse::setResponseFunction( + std::shared_ptr satelliteCb) { + mSatelliteCb = satelliteCb; +} + +std::shared_ptr RadioResponse::satelliteCb() { + return mSatelliteCb.get(); +} + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/satellite/RadioSatellite.cpp b/radio/aidl/compat/libradiocompat/satellite/RadioSatellite.cpp new file mode 100644 index 0000000000..16a3167bf5 --- /dev/null +++ b/radio/aidl/compat/libradiocompat/satellite/RadioSatellite.cpp @@ -0,0 +1,128 @@ +/* + * 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. + */ + +#include + +#include "commonStructs.h" +#include "debug.h" + +#include "collections.h" + +#define RADIO_MODULE "RadioSatellite" + +namespace android::hardware::radio::compat { + +using ::ndk::ScopedAStatus; +namespace aidl = ::aidl::android::hardware::radio::satellite; +constexpr auto ok = &ScopedAStatus::ok; + +std::shared_ptr RadioSatellite::respond() { + return mCallbackManager->response().satelliteCb(); +} + +ScopedAStatus RadioSatellite::responseAcknowledgement() { + LOG(ERROR) << " responseAcknowledgement is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioSatellite::getCapabilities(int32_t serial) { + LOG_CALL << serial; + LOG(ERROR) << " getCapabilities is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioSatellite::setPower(int32_t serial, bool /*on*/) { + LOG_CALL << serial; + LOG(ERROR) << " setPower is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioSatellite::getPowerState(int32_t serial) { + LOG_CALL << serial; + LOG(ERROR) << " getPowerSate is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioSatellite::provisionService( + int32_t serial, const std::string& /*imei*/, const std::string& /*msisdn*/, + const std::string& /*imsi*/, + const std::vector< + ::aidl::android::hardware::radio::satellite::SatelliteFeature>& /*features*/) { + LOG_CALL << serial; + LOG(ERROR) << " provisionService is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioSatellite::addAllowedSatelliteContacts( + int32_t serial, const std::vector& /*contacts*/) { + LOG_CALL << serial; + LOG(ERROR) << " addAllowedSatelliteContacts is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioSatellite::removeAllowedSatelliteContacts( + int32_t serial, const std::vector& /*contacts*/) { + LOG_CALL << serial; + LOG(ERROR) << " removeAllowedSatelliteContacts is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioSatellite::sendMessages(int32_t serial, + const std::vector& /*messages*/, + const std::string& /*destination*/, double /*latitude*/, + double /*longitude*/) { + LOG_CALL << serial; + LOG(ERROR) << " sendMessage is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioSatellite::getPendingMessages(int32_t serial) { + LOG_CALL << serial; + LOG(ERROR) << " getPendingMessages is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioSatellite::getSatelliteMode(int32_t serial) { + LOG_CALL << serial; + LOG(ERROR) << " getSatelliteMode is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioSatellite::setIndicationFilter(int32_t serial, int32_t /*filterBitmask*/) { + LOG_CALL << serial; + LOG(ERROR) << " setIndicationFilter is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioSatellite::startSendingSatellitePointingInfo(int32_t serial) { + LOG_CALL << serial; + LOG(ERROR) << " startSendingSatellitePointingInfo is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioSatellite::stopSendingSatellitePointingInfo(int32_t serial) { + LOG_CALL << serial; + LOG(ERROR) << " stopSendingSatellitePointingInfo is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioSatellite::getMaxCharactersPerTextMessage(int32_t serial) { + LOG_CALL << serial; + LOG(ERROR) << " getMaxCharactersPerTextMessage is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioSatellite::getTimeForNextSatelliteVisibility(int32_t serial) { + LOG_CALL << serial; + LOG(ERROR) << " getTimeForNextSatelliteVisibility is unsupported by HIDL HALs"; + return ok(); +} + +ScopedAStatus RadioSatellite::setResponseFunctions( + const std::shared_ptr& response, + const std::shared_ptr& indication) { + LOG_CALL << response << ' ' << indication; + mCallbackManager->setResponseFunctions(response, indication); + return ok(); +} + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/service/Android.bp b/radio/aidl/compat/service/Android.bp index 56674c1268..a3717b4304 100644 --- a/radio/aidl/compat/service/Android.bp +++ b/radio/aidl/compat/service/Android.bp @@ -45,6 +45,7 @@ cc_binary { "android.hardware.radio.modem-V2-ndk", "android.hardware.radio.network-V2-ndk", "android.hardware.radio.sap-V1-ndk", + "android.hardware.radio.satellite-V1-ndk", "android.hardware.radio.sim-V2-ndk", "android.hardware.radio.voice-V2-ndk", "android.hardware.radio@1.0", diff --git a/radio/aidl/vts/Android.bp b/radio/aidl/vts/Android.bp index 99c3d7135b..518dfd43e1 100644 --- a/radio/aidl/vts/Android.bp +++ b/radio/aidl/vts/Android.bp @@ -55,6 +55,9 @@ cc_test { "radio_network_test.cpp", "radio_sap_callback.cpp", "radio_sap_test.cpp", + "radio_satellite_indication.cpp", + "radio_satellite_response.cpp", + "radio_satellite_test.cpp", "radio_sim_indication.cpp", "radio_sim_response.cpp", "radio_sim_test.cpp", @@ -76,6 +79,7 @@ cc_test { "android.hardware.radio.modem-V2-ndk", "android.hardware.radio.network-V2-ndk", "android.hardware.radio.sap-V1-ndk", + "android.hardware.radio.satellite-V1-ndk", "android.hardware.radio.sim-V2-ndk", "android.hardware.radio.voice-V2-ndk", ], diff --git a/radio/aidl/vts/VtsHalRadioTargetTest.cpp b/radio/aidl/vts/VtsHalRadioTargetTest.cpp index 33a0d7d076..f718e57038 100644 --- a/radio/aidl/vts/VtsHalRadioTargetTest.cpp +++ b/radio/aidl/vts/VtsHalRadioTargetTest.cpp @@ -23,6 +23,7 @@ #include "radio_modem_utils.h" #include "radio_network_utils.h" #include "radio_sap_utils.h" +#include "radio_satellite_utils.h" #include "radio_sim_utils.h" #include "radio_voice_utils.h" @@ -78,6 +79,12 @@ INSTANTIATE_TEST_SUITE_P( testing::ValuesIn(android::getAidlHalInstanceNames(IRadioIms::descriptor)), android::PrintInstanceNameToString); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioSatelliteTest); +INSTANTIATE_TEST_SUITE_P( + PerInstance, RadioSatelliteTest, + testing::ValuesIn(android::getAidlHalInstanceNames(IRadioSatellite::descriptor)), + android::PrintInstanceNameToString); + int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); ABinderProcess_setThreadPoolMaxThreadCount(1); diff --git a/radio/aidl/vts/radio_aidl_hal_utils.h b/radio/aidl/vts/radio_aidl_hal_utils.h index d515e1a7c0..2e6c49caaf 100644 --- a/radio/aidl/vts/radio_aidl_hal_utils.h +++ b/radio/aidl/vts/radio_aidl_hal_utils.h @@ -69,6 +69,8 @@ static constexpr const char* FEATURE_TELEPHONY_CDMA = "android.hardware.telephon static constexpr const char* FEATURE_TELEPHONY_IMS = "android.hardware.telephony.ims"; +static constexpr const char* FEATURE_TELEPHONY_SATELLITE = "android.hardware.telephony.satellite"; + #define MODEM_EMERGENCY_CALL_ESTABLISH_TIME 3 #define MODEM_EMERGENCY_CALL_DISCONNECT_TIME 3 #define MODEM_SET_SIM_POWER_DELAY_IN_SECONDS 2 diff --git a/radio/aidl/vts/radio_satellite_indication.cpp b/radio/aidl/vts/radio_satellite_indication.cpp new file mode 100644 index 0000000000..13e4453403 --- /dev/null +++ b/radio/aidl/vts/radio_satellite_indication.cpp @@ -0,0 +1,56 @@ +/* + * 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. + */ + +#include "radio_satellite_utils.h" + +RadioSatelliteIndication::RadioSatelliteIndication(RadioServiceTest& parent) + : parent_satellite(parent) {} + +ndk::ScopedAStatus RadioSatelliteIndication::onPendingMessageCount(RadioIndicationType /*type*/, + int32_t /*count*/) { + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioSatelliteIndication::onNewMessages( + RadioIndicationType /*type*/, const std::vector& /*messages*/) { + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioSatelliteIndication::onMessagesTransferComplete( + RadioIndicationType /*type*/, bool /*complete*/) { + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioSatelliteIndication::onSatellitePointingInfoChanged( + RadioIndicationType /*type*/, const PointingInfo& /*pointingInfo*/) { + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioSatelliteIndication::onSatelliteModeChanged(RadioIndicationType /*type*/, + SatelliteMode /*mode*/) { + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioSatelliteIndication::onSatelliteRadioTechnologyChanged( + RadioIndicationType /*type*/, NTRadioTechnology /*technology*/) { + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioSatelliteIndication::onProvisionStateChanged( + RadioIndicationType /*type*/, bool /*provisioned*/, + const std::vector& /*features*/) { + return ndk::ScopedAStatus::ok(); +} diff --git a/radio/aidl/vts/radio_satellite_response.cpp b/radio/aidl/vts/radio_satellite_response.cpp new file mode 100644 index 0000000000..84d57b2d58 --- /dev/null +++ b/radio/aidl/vts/radio_satellite_response.cpp @@ -0,0 +1,120 @@ +/* + * 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. + */ + +#include "radio_satellite_utils.h" + +RadioSatelliteResponse::RadioSatelliteResponse(RadioServiceTest& parent) + : parent_satellite(parent) {} + +ndk::ScopedAStatus RadioSatelliteResponse::acknowledgeRequest(int32_t /*serial*/) { + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioSatelliteResponse::getCapabilitiesResponse( + const RadioResponseInfo& info, const SatelliteCapabilities& /*capabilities*/) { + rspInfo = info; + parent_satellite.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioSatelliteResponse::setPowerResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_satellite.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioSatelliteResponse::getPowerStateResponse(const RadioResponseInfo& info, + bool /*on*/) { + rspInfo = info; + parent_satellite.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioSatelliteResponse::provisionServiceResponse(const RadioResponseInfo& info, + bool /*provisioned*/) { + rspInfo = info; + parent_satellite.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioSatelliteResponse::addAllowedSatelliteContactsResponse( + const RadioResponseInfo& info) { + rspInfo = info; + parent_satellite.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioSatelliteResponse::removeAllowedSatelliteContactsResponse( + const RadioResponseInfo& info) { + rspInfo = info; + parent_satellite.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioSatelliteResponse::sendMessagesResponse(const RadioResponseInfo& info) { + rspInfo = info; + parent_satellite.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioSatelliteResponse::getPendingMessagesResponse( + const RadioResponseInfo& info, const std::vector& /*messages*/) { + rspInfo = info; + parent_satellite.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioSatelliteResponse::getSatelliteModeResponse( + const RadioResponseInfo& info, SatelliteMode /*mode*/, NTRadioTechnology /*technology*/) { + rspInfo = info; + parent_satellite.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioSatelliteResponse::setIndicationFilterResponse( + const RadioResponseInfo& info) { + rspInfo = info; + parent_satellite.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioSatelliteResponse::startSendingSatellitePointingInfoResponse( + const RadioResponseInfo& info) { + rspInfo = info; + parent_satellite.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioSatelliteResponse::stopSendingSatellitePointingInfoResponse( + const RadioResponseInfo& info) { + rspInfo = info; + parent_satellite.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioSatelliteResponse::getMaxCharactersPerTextMessageResponse( + const RadioResponseInfo& info, int32_t /*charLimit*/) { + rspInfo = info; + parent_satellite.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus RadioSatelliteResponse::getTimeForNextSatelliteVisibilityResponse( + const RadioResponseInfo& info, int32_t /*timeInSeconds*/) { + rspInfo = info; + parent_satellite.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} \ No newline at end of file diff --git a/radio/aidl/vts/radio_satellite_test.cpp b/radio/aidl/vts/radio_satellite_test.cpp new file mode 100644 index 0000000000..b0358b3b0d --- /dev/null +++ b/radio/aidl/vts/radio_satellite_test.cpp @@ -0,0 +1,626 @@ +/* + * 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. + */ + +#include +#include +#include + +#include "radio_satellite_utils.h" + +#define ASSERT_OK(ret) ASSERT_TRUE(((ret).isOk())) + +void RadioSatelliteTest::SetUp() { + std::string serviceName = GetParam(); + + if (!isServiceValidForDeviceConfiguration(serviceName)) { + ALOGI("Skipped the radio satellite tests due to device configuration."); + GTEST_SKIP(); + } + + satellite = IRadioSatellite::fromBinder( + ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str()))); + ASSERT_NE(nullptr, satellite.get()); + + rsp_satellite = ndk::SharedRefBase::make(*this); + ASSERT_NE(nullptr, rsp_satellite.get()); + + count_ = 0; + + ind_satellite = ndk::SharedRefBase::make(*this); + ASSERT_NE(nullptr, ind_satellite.get()); + + satellite->setResponseFunctions(rsp_satellite, ind_satellite); + + // Assert IRadioConfig exists before testing + radio_config = config::IRadioConfig::fromBinder(ndk::SpAIBinder( + AServiceManager_waitForService("android.hardware.radio.config.IRadioConfig/default"))); + ASSERT_NE(nullptr, radio_config.get()); +} + +/* + * Test IRadioSatellite.getCapabilities() for the response returned. + */ +TEST_P(RadioSatelliteTest, getCapabilities) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { + ALOGI("Skipping getCapabilities because satellite is not supported in device"); + return; + } else { + ALOGI("Running getCapabilities because satellite is supported in device"); + } + + serial = GetRandomSerialNumber(); + ndk::ScopedAStatus res = satellite->getCapabilities(serial); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); + EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); + + ALOGI("getCapabilities, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str()); + + ASSERT_TRUE(CheckAnyOfErrors( + rsp_satellite->rspInfo.error, + {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, + RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, + RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, + RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, + RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, + RadioError::SYSTEM_ERR})); +} + +/* + * Test IRadioSatellite.setPower() for the response returned. + */ +TEST_P(RadioSatelliteTest, setPower) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { + ALOGI("Skipping setPower because satellite is not supported in device"); + return; + } else { + ALOGI("Running setPower because satellite is supported in device"); + } + + serial = GetRandomSerialNumber(); + ndk::ScopedAStatus res = satellite->setPower(serial, true); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); + EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); + + ALOGI("setPower, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str()); + + ASSERT_TRUE(CheckAnyOfErrors( + rsp_satellite->rspInfo.error, + {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, + RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, + RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, + RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, + RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, + RadioError::SYSTEM_ERR})); +} + +/* + * Test IRadioSatellite.getPowerSate() for the response returned. + */ +TEST_P(RadioSatelliteTest, getPowerSate) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { + ALOGI("Skipping getPowerSate because satellite is not supported in device"); + return; + } else { + ALOGI("Running getPowerSate because satellite is supported in device"); + } + + serial = GetRandomSerialNumber(); + ndk::ScopedAStatus res = satellite->getPowerState(serial); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); + EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); + + ALOGI("getPowerSate, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str()); + + ASSERT_TRUE(CheckAnyOfErrors( + rsp_satellite->rspInfo.error, + {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, + RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, + RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, + RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, + RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, + RadioError::SYSTEM_ERR})); +} + +/* + * Test IRadioSatellite.provisionService() for the response returned. + */ +TEST_P(RadioSatelliteTest, provisionService) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { + ALOGI("Skipping provisionService because satellite is not supported in device"); + return; + } else { + ALOGI("Running provisionService because satellite is supported in device"); + } + + serial = GetRandomSerialNumber(); + std::string imei = "imei"; + std::string msisdn = "msisdn"; + std::string imsi = "imsi"; + const std::vector features{ + SatelliteFeature::SOS_SMS, SatelliteFeature::EMERGENCY_SMS, SatelliteFeature::SMS}; + ndk::ScopedAStatus res = satellite->provisionService(serial, imei, msisdn, imsi, features); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); + EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); + + ALOGI("provisionService, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str()); + + ASSERT_TRUE(CheckAnyOfErrors(rsp_satellite->rspInfo.error, + {RadioError::NONE, + RadioError::ABORTED, + RadioError::ACCESS_BARRED, + RadioError::CANCELLED, + RadioError::FEATURE_NOT_SUPPORTED, + RadioError::INTERNAL_ERR, + RadioError::INVALID_ARGUMENTS, + RadioError::INVALID_MODEM_STATE, + RadioError::INVALID_SIM_STATE, + RadioError::INVALID_STATE, + RadioError::MODEM_ERR, + RadioError::MODEM_INCOMPATIBLE, + RadioError::NETWORK_ERR, + RadioError::NETWORK_NOT_READY, + RadioError::NETWORK_REJECT, + RadioError::NETWORK_TIMEOUT, + RadioError::NO_MEMORY, + RadioError::NO_NETWORK_FOUND, + RadioError::NO_RESOURCES, + RadioError::NO_SATELLITE_SIGNAL, + RadioError::NO_SUBSCRIPTION, + RadioError::OPERATION_NOT_ALLOWED, + RadioError::RADIO_NOT_AVAILABLE, + RadioError::RADIO_TECHNOLOGY_NOT_SUPPORTED, + RadioError::REQUEST_NOT_SUPPORTED, + RadioError::REQUEST_RATE_LIMITED, + RadioError::SIM_ABSENT, + RadioError::SIM_BUSY, + RadioError::SIM_ERR, + RadioError::SIM_FULL, + RadioError::SUBSCRIBER_NOT_AUTHORIZED, + RadioError::SYSTEM_ERR})); +} + +/* + * Test IRadioSatellite.addAllowedSatelliteContacts() for the response returned. + */ +TEST_P(RadioSatelliteTest, addAllowedSatelliteContacts) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { + ALOGI("Skipping addAllowedSatelliteContacts because satellite is not supported in device"); + return; + } else { + ALOGI("Running addAllowedSatelliteContacts because satellite is supported in device"); + } + + serial = GetRandomSerialNumber(); + const std::vector contacts = {"contact 1", "contact 2"}; + ndk::ScopedAStatus res = satellite->addAllowedSatelliteContacts(serial, contacts); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); + EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); + + ALOGI("addAllowedSatelliteContacts, rspInfo.error = %s\n", + toString(rsp_satellite->rspInfo.error).c_str()); + + ASSERT_TRUE(CheckAnyOfErrors(rsp_satellite->rspInfo.error, + {RadioError::NONE, + RadioError::ABORTED, + RadioError::ACCESS_BARRED, + RadioError::CANCELLED, + RadioError::INTERNAL_ERR, + RadioError::INVALID_ARGUMENTS, + RadioError::INVALID_CONTACT, + RadioError::INVALID_MODEM_STATE, + RadioError::INVALID_SIM_STATE, + RadioError::INVALID_STATE, + RadioError::MODEM_ERR, + RadioError::NETWORK_ERR, + RadioError::NETWORK_NOT_READY, + RadioError::NETWORK_REJECT, + RadioError::NETWORK_TIMEOUT, + RadioError::NO_MEMORY, + RadioError::NO_NETWORK_FOUND, + RadioError::NO_RESOURCES, + RadioError::NO_SATELLITE_SIGNAL, + RadioError::NO_SUBSCRIPTION, + RadioError::NOT_SUFFICIENT_ACCOUNT_BALANCE, + RadioError::OPERATION_NOT_ALLOWED, + RadioError::RADIO_NOT_AVAILABLE, + RadioError::REQUEST_NOT_SUPPORTED, + RadioError::REQUEST_RATE_LIMITED, + RadioError::SIM_ABSENT, + RadioError::SIM_BUSY, + RadioError::SIM_ERR, + RadioError::SIM_FULL, + RadioError::SYSTEM_ERR, + RadioError::UNIDENTIFIED_SUBSCRIBER})); +} + +/* + * Test IRadioSatellite.removeAllowedSatelliteContacts() for the response returned. + */ +TEST_P(RadioSatelliteTest, removeAllowedSatelliteContacts) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { + ALOGI("Skipping removeAllowedSatelliteContacts because satellite is not supported in " + "device"); + return; + } else { + ALOGI("Running removeAllowedSatelliteContacts because satellite is supported in device"); + } + + serial = GetRandomSerialNumber(); + const std::vector contacts = {"contact 1", "contact 2"}; + ndk::ScopedAStatus res = satellite->removeAllowedSatelliteContacts(serial, contacts); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); + EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); + + ALOGI("removeAllowedSatelliteContacts, rspInfo.error = %s\n", + toString(rsp_satellite->rspInfo.error).c_str()); + + ASSERT_TRUE(CheckAnyOfErrors(rsp_satellite->rspInfo.error, + {RadioError::NONE, + RadioError::ABORTED, + RadioError::ACCESS_BARRED, + RadioError::CANCELLED, + RadioError::INTERNAL_ERR, + RadioError::INVALID_ARGUMENTS, + RadioError::INVALID_CONTACT, + RadioError::INVALID_MODEM_STATE, + RadioError::INVALID_SIM_STATE, + RadioError::INVALID_STATE, + RadioError::MODEM_ERR, + RadioError::NETWORK_ERR, + RadioError::NETWORK_NOT_READY, + RadioError::NETWORK_REJECT, + RadioError::NETWORK_TIMEOUT, + RadioError::NO_MEMORY, + RadioError::NO_NETWORK_FOUND, + RadioError::NO_RESOURCES, + RadioError::NO_SATELLITE_SIGNAL, + RadioError::NO_SUBSCRIPTION, + RadioError::NOT_SUFFICIENT_ACCOUNT_BALANCE, + RadioError::OPERATION_NOT_ALLOWED, + RadioError::RADIO_NOT_AVAILABLE, + RadioError::REQUEST_NOT_SUPPORTED, + RadioError::REQUEST_RATE_LIMITED, + RadioError::SIM_ABSENT, + RadioError::SIM_BUSY, + RadioError::SIM_ERR, + RadioError::SIM_FULL, + RadioError::SYSTEM_ERR, + RadioError::UNIDENTIFIED_SUBSCRIBER})); +} + +/* + * Test IRadioSatellite.sendMessages() for the response returned. + */ +TEST_P(RadioSatelliteTest, sendMessages) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { + ALOGI("Skipping sendMessages because satellite is not supported in device"); + return; + } else { + ALOGI("Running sendMessages because satellite is supported in device"); + } + + serial = GetRandomSerialNumber(); + const std::vector messages = {"message 1", "message 2"}; + std::string destination = "0123456789"; + ndk::ScopedAStatus res = satellite->sendMessages(serial, messages, destination, 1.0, 2.0); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); + EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); + + ALOGI("sendMessages, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str()); + + ASSERT_TRUE(CheckAnyOfErrors(rsp_satellite->rspInfo.error, + {RadioError::NONE, + RadioError::ABORTED, + RadioError::ACCESS_BARRED, + RadioError::BLOCKED_DUE_TO_CALL, + RadioError::CANCELLED, + RadioError::ENCODING_ERR, + RadioError::ENCODING_NOT_SUPPORTED, + RadioError::INTERNAL_ERR, + RadioError::INVALID_ARGUMENTS, + RadioError::INVALID_MODEM_STATE, + RadioError::INVALID_SIM_STATE, + RadioError::INVALID_SMS_FORMAT, + RadioError::INVALID_STATE, + RadioError::MODEM_ERR, + RadioError::NETWORK_ERR, + RadioError::NETWORK_NOT_READY, + RadioError::NETWORK_REJECT, + RadioError::NETWORK_TIMEOUT, + RadioError::NO_MEMORY, + RadioError::NO_NETWORK_FOUND, + RadioError::NO_RESOURCES, + RadioError::NO_SMS_TO_ACK, + RadioError::NO_SATELLITE_SIGNAL, + RadioError::NO_SUBSCRIPTION, + RadioError::NOT_SUFFICIENT_ACCOUNT_BALANCE, + RadioError::OPERATION_NOT_ALLOWED, + RadioError::RADIO_NOT_AVAILABLE, + RadioError::REQUEST_NOT_SUPPORTED, + RadioError::REQUEST_RATE_LIMITED, + RadioError::SIM_ABSENT, + RadioError::SIM_BUSY, + RadioError::SIM_ERR, + RadioError::SIM_FULL, + RadioError::SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED, + RadioError::SMS_SEND_FAIL_RETRY, + RadioError::SYSTEM_ERR, + RadioError::SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL, + RadioError::UNIDENTIFIED_SUBSCRIBER})); +} + +/* + * Test IRadioSatellite.getPendingMessages() for the response returned. + */ +TEST_P(RadioSatelliteTest, getPendingMessages) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { + ALOGI("Skipping getPendingMessages because satellite is not supported in device"); + return; + } else { + ALOGI("Running getPendingMessages because satellite is supported in device"); + } + + serial = GetRandomSerialNumber(); + ndk::ScopedAStatus res = satellite->getPendingMessages(serial); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); + EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); + + ALOGI("getPendingMessages, rspInfo.error = %s\n", + toString(rsp_satellite->rspInfo.error).c_str()); + + ASSERT_TRUE(CheckAnyOfErrors(rsp_satellite->rspInfo.error, + {RadioError::NONE, + RadioError::ABORTED, + RadioError::ACCESS_BARRED, + RadioError::BLOCKED_DUE_TO_CALL, + RadioError::CANCELLED, + RadioError::ENCODING_ERR, + RadioError::ENCODING_NOT_SUPPORTED, + RadioError::INTERNAL_ERR, + RadioError::INVALID_ARGUMENTS, + RadioError::INVALID_MODEM_STATE, + RadioError::INVALID_SIM_STATE, + RadioError::INVALID_SMS_FORMAT, + RadioError::INVALID_STATE, + RadioError::MODEM_ERR, + RadioError::NETWORK_ERR, + RadioError::NETWORK_NOT_READY, + RadioError::NETWORK_REJECT, + RadioError::NETWORK_TIMEOUT, + RadioError::NO_MEMORY, + RadioError::NO_NETWORK_FOUND, + RadioError::NO_RESOURCES, + RadioError::NO_SMS_TO_ACK, + RadioError::NO_SATELLITE_SIGNAL, + RadioError::NO_SUBSCRIPTION, + RadioError::NOT_SUFFICIENT_ACCOUNT_BALANCE, + RadioError::OPERATION_NOT_ALLOWED, + RadioError::RADIO_NOT_AVAILABLE, + RadioError::REQUEST_NOT_SUPPORTED, + RadioError::REQUEST_RATE_LIMITED, + RadioError::SIM_ABSENT, + RadioError::SIM_BUSY, + RadioError::SIM_ERR, + RadioError::SIM_FULL, + RadioError::SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED, + RadioError::SYSTEM_ERR, + RadioError::SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL})); +} + +/* + * Test IRadioSatellite.getSatelliteMode() for the response returned. + */ +TEST_P(RadioSatelliteTest, getSatelliteMode) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { + ALOGI("Skipping getSatelliteMode because satellite is not supported in device"); + return; + } else { + ALOGI("Running getSatelliteMode because satellite is supported in device"); + } + + serial = GetRandomSerialNumber(); + ndk::ScopedAStatus res = satellite->getSatelliteMode(serial); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); + EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); + + ALOGI("getSatelliteMode, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str()); + + ASSERT_TRUE(CheckAnyOfErrors( + rsp_satellite->rspInfo.error, + {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, + RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, + RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, + RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, + RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, + RadioError::SYSTEM_ERR})); +} + +/* + * Test IRadioSatellite.setIndicationFilter() for the response returned. + */ +TEST_P(RadioSatelliteTest, setIndicationFilter) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { + ALOGI("Skipping setIndicationFilter because satellite is not supported in device"); + return; + } else { + ALOGI("Running setIndicationFilter because satellite is supported in device"); + } + + serial = GetRandomSerialNumber(); + ndk::ScopedAStatus res = satellite->setIndicationFilter(serial, 0); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); + EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); + + ALOGI("setIndicationFilter, rspInfo.error = %s\n", + toString(rsp_satellite->rspInfo.error).c_str()); + + ASSERT_TRUE(CheckAnyOfErrors( + rsp_satellite->rspInfo.error, + {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, + RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, + RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, + RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, + RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, + RadioError::SYSTEM_ERR})); +} + +/* + * Test IRadioSatellite.startSendingSatellitePointingInfo() for the response returned. + */ +TEST_P(RadioSatelliteTest, startSendingSatellitePointingInfo) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { + ALOGI("Skipping startSendingSatellitePointingInfo because satellite is not supported in " + "device"); + return; + } else { + ALOGI("Running startSendingSatellitePointingInfo because satellite is supported in device"); + } + + serial = GetRandomSerialNumber(); + ndk::ScopedAStatus res = satellite->startSendingSatellitePointingInfo(serial); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); + EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); + + ALOGI("startSendingSatellitePointingInfo, rspInfo.error = %s\n", + toString(rsp_satellite->rspInfo.error).c_str()); + + ASSERT_TRUE(CheckAnyOfErrors( + rsp_satellite->rspInfo.error, + {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, + RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, + RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, + RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, + RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, + RadioError::SYSTEM_ERR})); +} + +/* + * Test IRadioSatellite.stopSatelliteLocationUpdate() for the response returned. + */ +TEST_P(RadioSatelliteTest, stopSatelliteLocationUpdate) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { + ALOGI("Skipping stopSendingSatellitePointingInfo because satellite is not supported in " + "device"); + return; + } else { + ALOGI("Running stopSendingSatellitePointingInfo because satellite is supported in device"); + } + + serial = GetRandomSerialNumber(); + ndk::ScopedAStatus res = satellite->stopSendingSatellitePointingInfo(serial); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); + EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); + + ALOGI("stopSendingSatellitePointingInfo, rspInfo.error = %s\n", + toString(rsp_satellite->rspInfo.error).c_str()); + + ASSERT_TRUE(CheckAnyOfErrors( + rsp_satellite->rspInfo.error, + {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, + RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, + RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, + RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, + RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, + RadioError::SYSTEM_ERR})); +} + +/* + * Test IRadioSatellite.getMaxCharactersPerTextMessage() for the response returned. + */ +TEST_P(RadioSatelliteTest, getMaxCharactersPerTextMessage) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { + ALOGI("Skipping getMaxCharactersPerTextMessage because satellite is not supported in " + "device"); + return; + } else { + ALOGI("Running getMaxCharactersPerTextMessage because satellite is supported in device"); + } + + serial = GetRandomSerialNumber(); + ndk::ScopedAStatus res = satellite->getMaxCharactersPerTextMessage(serial); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); + EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); + + ALOGI("getMaxCharactersPerTextMessage, rspInfo.error = %s\n", + toString(rsp_satellite->rspInfo.error).c_str()); + + ASSERT_TRUE(CheckAnyOfErrors( + rsp_satellite->rspInfo.error, + {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, + RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, + RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, + RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, + RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, + RadioError::SYSTEM_ERR})); +} + +/* + * Test IRadioSatellite.getTimeForNextSatelliteVisibility() for the response returned. + */ +TEST_P(RadioSatelliteTest, getTimeForNextSatelliteVisibility) { + if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { + ALOGI("Skipping getTimeForNextSatelliteVisibility because satellite is not supported in " + "device"); + return; + } else { + ALOGI("Running getTimeForNextSatelliteVisibility because satellite is supported in device"); + } + + serial = GetRandomSerialNumber(); + ndk::ScopedAStatus res = satellite->getTimeForNextSatelliteVisibility(serial); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); + EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); + + ALOGI("getTimeForNextSatelliteVisibility, rspInfo.error = %s\n", + toString(rsp_satellite->rspInfo.error).c_str()); + + ASSERT_TRUE(CheckAnyOfErrors( + rsp_satellite->rspInfo.error, + {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, + RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, + RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, + RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, + RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, + RadioError::SYSTEM_ERR})); +} \ No newline at end of file diff --git a/radio/aidl/vts/radio_satellite_utils.h b/radio/aidl/vts/radio_satellite_utils.h new file mode 100644 index 0000000000..2b07ec5543 --- /dev/null +++ b/radio/aidl/vts/radio_satellite_utils.h @@ -0,0 +1,126 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include + +#include "radio_aidl_hal_utils.h" + +using namespace aidl::android::hardware::radio::satellite; + +class RadioSatelliteTest; + +/* Callback class for Satellite response */ +class RadioSatelliteResponse : public BnRadioSatelliteResponse { + protected: + RadioServiceTest& parent_satellite; + + public: + RadioSatelliteResponse(RadioServiceTest& parent_satellite); + virtual ~RadioSatelliteResponse() = default; + + RadioResponseInfo rspInfo; + + virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override; + + virtual ndk::ScopedAStatus getCapabilitiesResponse( + const RadioResponseInfo& info, const SatelliteCapabilities& capabilities) override; + + virtual ndk::ScopedAStatus setPowerResponse(const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus getPowerStateResponse(const RadioResponseInfo& info, + bool on) override; + + virtual ndk::ScopedAStatus provisionServiceResponse(const RadioResponseInfo& info, + bool provisioned) override; + + virtual ndk::ScopedAStatus addAllowedSatelliteContactsResponse( + const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus removeAllowedSatelliteContactsResponse( + const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus sendMessagesResponse(const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus getPendingMessagesResponse( + const RadioResponseInfo& info, const std::vector& /*messages*/) override; + + virtual ndk::ScopedAStatus getSatelliteModeResponse( + const RadioResponseInfo& info, SatelliteMode mode, + satellite::NTRadioTechnology technology) override; + + virtual ndk::ScopedAStatus setIndicationFilterResponse(const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus startSendingSatellitePointingInfoResponse( + const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus stopSendingSatellitePointingInfoResponse( + const RadioResponseInfo& info) override; + + virtual ndk::ScopedAStatus getMaxCharactersPerTextMessageResponse(const RadioResponseInfo& info, + int32_t charLimit) override; + + virtual ndk::ScopedAStatus getTimeForNextSatelliteVisibilityResponse( + const RadioResponseInfo& info, int32_t timeInSeconds) override; +}; + +/* Callback class for Satellite indication */ +class RadioSatelliteIndication : public BnRadioSatelliteIndication { + protected: + RadioServiceTest& parent_satellite; + + public: + RadioSatelliteIndication(RadioServiceTest& parent_satellite); + virtual ~RadioSatelliteIndication() = default; + + virtual ndk::ScopedAStatus onPendingMessageCount(RadioIndicationType type, + int32_t count) override; + + virtual ndk::ScopedAStatus onNewMessages(RadioIndicationType type, + const std::vector& messages) override; + + virtual ndk::ScopedAStatus onMessagesTransferComplete(RadioIndicationType type, + bool complete) override; + + virtual ndk::ScopedAStatus onSatellitePointingInfoChanged( + RadioIndicationType type, const PointingInfo& pointingInfo) override; + + virtual ndk::ScopedAStatus onSatelliteModeChanged(RadioIndicationType type, + SatelliteMode mode) override; + + virtual ndk::ScopedAStatus onSatelliteRadioTechnologyChanged( + RadioIndicationType type, satellite::NTRadioTechnology technology) override; + + virtual ndk::ScopedAStatus onProvisionStateChanged( + RadioIndicationType type, bool provisioned, + const std::vector& features) override; +}; + +// The main test class for AIDL Satellite. +class RadioSatelliteTest : public ::testing::TestWithParam, public RadioServiceTest { + public: + virtual void SetUp() override; + + /* Radio Satellite service handle */ + std::shared_ptr satellite; + /* Radio Satellite response handle */ + std::shared_ptr rsp_satellite; + /* Radio Satellite indication handle */ + std::shared_ptr ind_satellite; +}; From 952057044b38026d2831fa3754f64c4912c6f8cc Mon Sep 17 00:00:00 2001 From: Brian Lindahl Date: Tue, 17 Jan 2023 14:53:56 -0700 Subject: [PATCH 609/998] Revert "Add VTS for new API for clearing buffer slots" This reverts commit 78ff2d6491b20a874d643358554dc352d51763a3. NOTE: This is not a full revert, it leaves the production code in place and only reverts the VTS test changes. Reason for revert: b/262370410 Test: atest VtsHalGraphicsComposerV2_1TargetTest on Oriole Test: atest VtsHalGraphicsComposerV2_2TargetTest on Oriole Test: atest VtsHalGraphicsComposerV2_3TargetTest on Oriole Test: atest VtsHalGraphicsComposerV2_4TargetTest on Oriole Bug: 262370410 Change-Id: Ica725cfaae6e2a08ed9c53eb9f17d6db1656bc93 --- .../VtsHalGraphicsComposer3_ReadbackTest.cpp | 215 +++--------------- .../VtsHalGraphicsComposer3_TargetTest.cpp | 71 +----- 2 files changed, 38 insertions(+), 248 deletions(-) diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp index 166127dfae..93d9693dbd 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp @@ -379,155 +379,9 @@ TEST_P(GraphicsCompositionTest, SetLayerBuffer) { } TEST_P(GraphicsCompositionTest, SetLayerBufferWithSlotsToClear) { - const auto& [versionStatus, version] = mComposerClient->getInterfaceVersion(); - ASSERT_TRUE(versionStatus.isOk()); - if (version == 1) { - GTEST_SUCCEED() << "Device does not support the new API for clearing buffer slots"; - return; - } - - const auto& [readbackStatus, readbackBufferAttributes] = + const auto& [status, readbackBufferAttributes] = mComposerClient->getReadbackBufferAttributes(getPrimaryDisplayId()); - if (!readbackStatus.isOk()) { - GTEST_SUCCEED() << "Readback not supported"; - return; - } - - sp readbackBuffer; - ASSERT_NO_FATAL_FAILURE(ReadbackHelper::createReadbackBuffer( - readbackBufferAttributes, getPrimaryDisplay(), &readbackBuffer)); - if (readbackBuffer == nullptr) { - GTEST_SUCCEED() << "Unsupported readback buffer attributes"; - return; - } - // no fence needed for the readback buffer - ScopedFileDescriptor noFence(-1); - - // red buffer - uint64_t usage = GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_OFTEN; - sp redBuffer = allocateBuffer(usage); - ASSERT_NE(nullptr, redBuffer); - int redFence; - ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBufferAndGetFence(redBuffer, RED, &redFence)); - - // blue buffer - sp blueBuffer = allocateBuffer(usage); - ASSERT_NE(nullptr, blueBuffer); - int blueFence; - ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBufferAndGetFence(blueBuffer, BLUE, &blueFence)); - - // green buffer - sp greenBuffer = allocateBuffer(usage); - ASSERT_NE(nullptr, greenBuffer); - int greenFence; - ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBufferAndGetFence(greenBuffer, GREEN, &greenFence)); - - // layer defaults - common::Rect rectFullDisplay = {0, 0, getDisplayWidth(), getDisplayHeight()}; - int64_t display = getPrimaryDisplayId(); - const auto& [layerStatus, layer] = mComposerClient->createLayer(getPrimaryDisplayId(), 3); - ASSERT_TRUE(layerStatus.isOk()); - mWriter->setLayerDisplayFrame(display, layer, rectFullDisplay); - mWriter->setLayerCompositionType(display, layer, Composition::DEVICE); - - // set the layer to the blue buffer - // should be blue - { - auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); - ASSERT_TRUE(status.isOk()); - mWriter->setLayerBuffer(display, layer, /*slot*/ 0, blueBuffer->handle, blueFence); - mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); - execute(); - ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); - ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->presentDisplay(display); - execute(); - auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); - ASSERT_TRUE(fenceStatus.isOk()); - ReadbackHelper::compareColorToBuffer(BLUE, readbackBuffer, fence); - } - - // change the layer to the red buffer - // should be red - { - auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); - ASSERT_TRUE(status.isOk()); - mWriter->setLayerBuffer(display, layer, /*slot*/ 1, redBuffer->handle, redFence); - mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); - execute(); - ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); - ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->presentDisplay(display); - execute(); - auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); - ASSERT_TRUE(fenceStatus.isOk()); - ReadbackHelper::compareColorToBuffer(RED, readbackBuffer, fence); - } - - // change the layer to the green buffer - // should be green - { - auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); - ASSERT_TRUE(status.isOk()); - mWriter->setLayerBuffer(display, layer, /*slot*/ 2, greenBuffer->handle, greenFence); - mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); - execute(); - ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); - ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->presentDisplay(display); - execute(); - auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); - ASSERT_TRUE(fenceStatus.isOk()); - ReadbackHelper::compareColorToBuffer(GREEN, readbackBuffer, fence); - } - - // clear the slots for all buffers - // should still be green since the active buffer should not be cleared by the HAL implementation - { - auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); - ASSERT_TRUE(status.isOk()); - mWriter->setLayerBufferSlotsToClear(display, layer, /*slotsToClear*/ {0, 1, 2}); - mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); - execute(); - ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); - ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->presentDisplay(display); - execute(); - auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); - ASSERT_TRUE(fenceStatus.isOk()); - ReadbackHelper::compareColorToBuffer(GREEN, readbackBuffer, fence); - } - - // clear the slot for the green buffer, and set the buffer with the same slot to the blue buffer - // should be blue - { - auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); - ASSERT_TRUE(status.isOk()); - mWriter->setLayerBufferSlotsToClear(display, layer, /*slotsToClear*/ {2}); - mWriter->setLayerBuffer(display, layer, /*slot*/ 2, blueBuffer->handle, blueFence); - mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); - execute(); - ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); - ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->presentDisplay(display); - execute(); - auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); - ASSERT_TRUE(fenceStatus.isOk()); - ReadbackHelper::compareColorToBuffer(BLUE, readbackBuffer, fence); - } -} - -TEST_P(GraphicsCompositionTest, SetLayerBufferWithSlotsToClear_backwardsCompatible) { - const auto& [versionStatus, version] = mComposerClient->getInterfaceVersion(); - ASSERT_TRUE(versionStatus.isOk()); - if (version > 1) { - GTEST_SUCCEED() << "Device does not need a backwards compatible way to clear buffer slots"; - return; - } - - const auto& [readbackStatus, readbackBufferAttributes] = - mComposerClient->getReadbackBufferAttributes(getPrimaryDisplayId()); - if (!readbackStatus.isOk()) { + if (!status.isOk()) { GTEST_SUCCEED() << "Readback not supported"; return; } @@ -558,16 +412,10 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferWithSlotsToClear_backwardsCompatib int blueFence; ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBufferAndGetFence(blueBuffer, BLUE, &blueFence)); - // green buffer - sp greenBuffer = allocateBuffer(usage); - ASSERT_NE(nullptr, greenBuffer); - int greenFence; - ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBufferAndGetFence(greenBuffer, GREEN, &greenFence)); - // layer defaults common::Rect rectFullDisplay = {0, 0, getDisplayWidth(), getDisplayHeight()}; int64_t display = getPrimaryDisplayId(); - const auto& [layerStatus, layer] = mComposerClient->createLayer(getPrimaryDisplayId(), 3); + auto [layerStatus, layer] = mComposerClient->createLayer(getPrimaryDisplayId(), 3); ASSERT_TRUE(layerStatus.isOk()); mWriter->setLayerDisplayFrame(display, layer, rectFullDisplay); mWriter->setLayerCompositionType(display, layer, Composition::DEVICE); @@ -606,33 +454,13 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferWithSlotsToClear_backwardsCompatib ReadbackHelper::compareColorToBuffer(RED, readbackBuffer, fence); } - // change the layer to the green buffer - // should be green - { - auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); - ASSERT_TRUE(status.isOk()); - mWriter->setLayerBuffer(display, layer, /*slot*/ 2, greenBuffer->handle, greenFence); - mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); - execute(); - ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); - ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->presentDisplay(display); - execute(); - auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); - ASSERT_TRUE(fenceStatus.isOk()); - ReadbackHelper::compareColorToBuffer(GREEN, readbackBuffer, fence); - } - // clear the slot for the blue buffer - // should still be green + // should still be red { auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); ASSERT_TRUE(status.isOk()); mWriter->setLayerBufferWithNewCommand(display, layer, /*slot*/ 0, clearSlotBuffer->handle, /*fence*/ -1); - // SurfaceFlinger will re-set the active buffer slot after other buffer slots are cleared - mWriter->setLayerBufferWithNewCommand(display, layer, /*slot*/ 2, /*handle*/ nullptr, - /*fence*/ -1); mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); execute(); ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); @@ -641,21 +469,17 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferWithSlotsToClear_backwardsCompatib execute(); auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); ASSERT_TRUE(fenceStatus.isOk()); - ReadbackHelper::compareColorToBuffer(GREEN, readbackBuffer, fence); + ReadbackHelper::compareColorToBuffer(RED, readbackBuffer, fence); } - // clear the slot for all buffers, and set the buffer with the same slot as the green buffer - // should be blue now + // clear the slot for the red buffer, and set the buffer with the same slot to the blue buffer + // should be blue { auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); ASSERT_TRUE(status.isOk()); - mWriter->setLayerBufferWithNewCommand(display, layer, /*slot*/ 0, clearSlotBuffer->handle, - /*fence*/ -1); mWriter->setLayerBufferWithNewCommand(display, layer, /*slot*/ 1, clearSlotBuffer->handle, /*fence*/ -1); - // SurfaceFlinger will never clear the active buffer (slot 2), but will free up the - // buffer slot so it will be re-used for the next setLayerBuffer command - mWriter->setLayerBuffer(display, layer, /*slot*/ 2, blueBuffer->handle, blueFence); + mWriter->setLayerBuffer(display, layer, /*slot*/ 1, blueBuffer->handle, blueFence); mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); execute(); ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); @@ -666,6 +490,29 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferWithSlotsToClear_backwardsCompatib ASSERT_TRUE(fenceStatus.isOk()); ReadbackHelper::compareColorToBuffer(BLUE, readbackBuffer, fence); } + + // clear the slot for the now-blue buffer + // should be black (no buffer) + // TODO(b/262037933) Ensure we never clear the active buffer's slot with the placeholder buffer + // by setting the layer to the color black + { + auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); + ASSERT_TRUE(status.isOk()); + mWriter->setLayerBufferWithNewCommand(display, layer, /*slot*/ 1, clearSlotBuffer->handle, + /*fence*/ -1); + mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); + execute(); + if (!mReader.takeChangedCompositionTypes(display).empty()) { + GTEST_SUCCEED(); + return; + } + ASSERT_TRUE(mReader.takeErrors().empty()); + mWriter->presentDisplay(display); + execute(); + auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); + ASSERT_TRUE(fenceStatus.isOk()); + ReadbackHelper::compareColorToBuffer(BLACK, readbackBuffer, fence); + } } TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index b0df5e88d9..6598b308cc 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -1704,85 +1704,28 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerBuffer) { } TEST_P(GraphicsComposerAidlCommandTest, SetLayerBufferWithSlotsToClear) { - const auto& [versionStatus, version] = mComposerClient->getInterfaceVersion(); - ASSERT_TRUE(versionStatus.isOk()); - if (version == 1) { - GTEST_SUCCEED() << "Device does not support the new API for clearing buffer slots"; - return; - } - - const auto& [layerStatus, layer] = - mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); - EXPECT_TRUE(layerStatus.isOk()); - - auto& writer = getWriter(getPrimaryDisplayId()); - - const auto buffer1 = allocate(::android::PIXEL_FORMAT_RGBA_8888); - ASSERT_NE(nullptr, buffer1); - const auto handle1 = buffer1->handle; - writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle1, /*acquireFence*/ -1); - execute(); - ASSERT_TRUE(mReader.takeErrors().empty()); - - const auto buffer2 = allocate(::android::PIXEL_FORMAT_RGBA_8888); - ASSERT_NE(nullptr, buffer2); - const auto handle2 = buffer2->handle; - writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 1, handle2, /*acquireFence*/ -1); - execute(); - ASSERT_TRUE(mReader.takeErrors().empty()); - - // Ensure we can clear the buffer slots and then set the active slot with a new buffer - const auto buffer3 = allocate(::android::PIXEL_FORMAT_RGBA_8888); - ASSERT_NE(nullptr, buffer3); - const auto handle3 = buffer3->handle; - writer.setLayerBufferSlotsToClear(getPrimaryDisplayId(), layer, /*slotsToClear*/ {0, 1}); - writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 1, handle3, /*acquireFence*/ -1); - execute(); - ASSERT_TRUE(mReader.takeErrors().empty()); -} - -TEST_P(GraphicsComposerAidlCommandTest, SetLayerBufferWithSlotsToClear_backwardsCompatible) { - const auto& [versionStatus, version] = mComposerClient->getInterfaceVersion(); - ASSERT_TRUE(versionStatus.isOk()); - if (version > 1) { - GTEST_SUCCEED() << "Device does not need a backwards compatible way to clear buffer slots"; - return; - } - auto clearSlotBuffer = allocate(1u, 1u, ::android::PIXEL_FORMAT_RGB_888); ASSERT_NE(nullptr, clearSlotBuffer); auto clearSlotBufferHandle = clearSlotBuffer->handle; - const auto& [layerStatus, layer] = - mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); - EXPECT_TRUE(layerStatus.isOk()); - - auto& writer = getWriter(getPrimaryDisplayId()); - const auto buffer1 = allocate(::android::PIXEL_FORMAT_RGBA_8888); ASSERT_NE(nullptr, buffer1); const auto handle1 = buffer1->handle; + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + auto& writer = getWriter(getPrimaryDisplayId()); writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle1, /*acquireFence*/ -1); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); + // Ensure we can clear a buffer slot and then set that same slot with a new buffer const auto buffer2 = allocate(::android::PIXEL_FORMAT_RGBA_8888); ASSERT_NE(nullptr, buffer2); const auto handle2 = buffer2->handle; - EXPECT_TRUE(layerStatus.isOk()); - writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 1, handle2, /*acquireFence*/ -1); - execute(); - ASSERT_TRUE(mReader.takeErrors().empty()); - - // Ensure we can clear a buffer slot and then set that same slot with a new buffer - const auto buffer3 = allocate(::android::PIXEL_FORMAT_RGBA_8888); - ASSERT_NE(nullptr, buffer3); - const auto handle3 = buffer2->handle; - // SurfaceFlinger will never clear the active buffer, instead it will clear non-active buffers - // and then re-use the active buffer's slot for the new buffer - writer.setLayerBufferWithNewCommand(getPrimaryDisplayId(), layer, /*slot*/ 0, + writer.setLayerBufferWithNewCommand(getPrimaryDisplayId(), layer, /* slot */ 0, clearSlotBufferHandle, /*acquireFence*/ -1); - writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 1, handle3, /*acquireFence*/ -1); + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle2, /*acquireFence*/ -1); execute(); ASSERT_TRUE(mReader.takeErrors().empty()); } From e887a252037fa18e08d7db6a037d4aab8c75929a Mon Sep 17 00:00:00 2001 From: Brian Lindahl Date: Tue, 17 Jan 2023 14:54:19 -0700 Subject: [PATCH 610/998] Revert "Add VTS readback tests for buffer slot clearing" This reverts commit d103cd682822807d956cfb65454085fa5817a5ba. NOTE: This is not a full revert, it leaves the production code in place and only reverts the VTS test changes. Reason for revert: b/262370410 Test: atest VtsHalGraphicsComposerV2_1TargetTest on Oriole Test: atest VtsHalGraphicsComposerV2_2TargetTest on Oriole Test: atest VtsHalGraphicsComposerV2_3TargetTest on Oriole Test: atest VtsHalGraphicsComposerV2_4TargetTest on Oriole Bug: 262370410 Change-Id: I336beb9f0ed81b305b26c6d8e9da70cfabe04bbd --- .../composer/2.2/utils/vts/ComposerVts.cpp | 22 +- .../composer/2.2/utils/vts/ReadbackVts.cpp | 165 +++---- .../2.2/utils/vts/RenderEngineVts.cpp | 4 +- .../include/composer-vts/2.2/ComposerVts.h | 6 +- .../include/composer-vts/2.2/ReadbackVts.h | 40 +- ...VtsHalGraphicsComposerV2_2ReadbackTest.cpp | 425 ++++++++---------- .../VtsHalGraphicsComposerV2_2TargetTest.cpp | 35 +- graphics/composer/aidl/vts/ReadbackVts.cpp | 225 ++++------ graphics/composer/aidl/vts/ReadbackVts.h | 47 +- .../composer/aidl/vts/RenderEngineVts.cpp | 13 +- .../VtsHalGraphicsComposer3_ReadbackTest.cpp | 239 +++------- 11 files changed, 444 insertions(+), 777 deletions(-) diff --git a/graphics/composer/2.2/utils/vts/ComposerVts.cpp b/graphics/composer/2.2/utils/vts/ComposerVts.cpp index a6dfcaf54b..d4f028169f 100644 --- a/graphics/composer/2.2/utils/vts/ComposerVts.cpp +++ b/graphics/composer/2.2/utils/vts/ComposerVts.cpp @@ -126,23 +126,15 @@ void ComposerClient::setReadbackBuffer(Display display, const native_handle_t* b ASSERT_EQ(Error::NONE, error) << "failed to setReadbackBuffer"; } -void ComposerClient::getRequiredReadbackBufferAttributes(Display display, - PixelFormat* outPixelFormat, - Dataspace* outDataspace) { - ASSERT_EQ(Error::NONE, getReadbackBufferAttributes(display, outPixelFormat, outDataspace)); -} - -Error ComposerClient::getReadbackBufferAttributes(Display display, PixelFormat* outPixelFormat, - Dataspace* outDataspace) { - Error error; +void ComposerClient::getReadbackBufferAttributes(Display display, PixelFormat* outPixelFormat, + Dataspace* outDataspace) { mClient->getReadbackBufferAttributes( - display, [&](const Error& tmpError, const PixelFormat& tmpPixelFormat, - const Dataspace& tmpDataspace) { - error = tmpError; - *outPixelFormat = tmpPixelFormat; - *outDataspace = tmpDataspace; + display, + [&](const auto& tmpError, const auto& tmpOutPixelFormat, const auto& tmpOutDataspace) { + ASSERT_EQ(Error::NONE, tmpError) << "failed to get readback buffer attributes"; + *outPixelFormat = tmpOutPixelFormat; + *outDataspace = tmpOutDataspace; }); - return error; } void ComposerClient::getReadbackBufferFence(Display display, int32_t* outFence) { diff --git a/graphics/composer/2.2/utils/vts/ReadbackVts.cpp b/graphics/composer/2.2/utils/vts/ReadbackVts.cpp index 5dd68df3a1..a1794afeed 100644 --- a/graphics/composer/2.2/utils/vts/ReadbackVts.cpp +++ b/graphics/composer/2.2/utils/vts/ReadbackVts.cpp @@ -19,8 +19,6 @@ #include "renderengine/ExternalTexture.h" #include "renderengine/impl/ExternalTexture.h" -using ::android::status_t; - namespace android { namespace hardware { namespace graphics { @@ -109,40 +107,6 @@ int32_t ReadbackHelper::GetBytesPerPixel(PixelFormat pixelFormat) { } } -void ReadbackHelper::fillBufferAndGetFence(const sp& graphicBuffer, - IComposerClient::Color desiredColor, int* fillFence) { - ASSERT_NE(nullptr, fillFence); - std::vector desiredColors( - static_cast(graphicBuffer->getWidth() * graphicBuffer->getHeight())); - ::android::Rect bounds = graphicBuffer->getBounds(); - fillColorsArea(desiredColors, static_cast(graphicBuffer->getWidth()), - {bounds.left, bounds.top, bounds.right, bounds.bottom}, desiredColor); - ASSERT_NO_FATAL_FAILURE(fillBufferAndGetFence(graphicBuffer, desiredColors, fillFence)); -} - -void ReadbackHelper::fillBufferAndGetFence(const sp& graphicBuffer, - const std::vector& desiredColors, - int* fillFence) { - ASSERT_TRUE(graphicBuffer->getPixelFormat() == ::android::PIXEL_FORMAT_RGB_888 || - graphicBuffer->getPixelFormat() == ::android::PIXEL_FORMAT_RGBA_8888); - void* bufData; - int32_t bytesPerPixel = -1; - int32_t bytesPerStride = -1; - status_t status = - graphicBuffer->lock(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN, - &bufData, &bytesPerPixel, &bytesPerStride); - ASSERT_EQ(::android::OK, status); - - const uint32_t stride = (bytesPerPixel > 0 && bytesPerStride > 0) - ? static_cast(bytesPerStride / bytesPerPixel) - : graphicBuffer->getStride(); - ReadbackHelper::fillBuffer(graphicBuffer->getWidth(), graphicBuffer->getHeight(), stride, - bufData, static_cast(graphicBuffer->getPixelFormat()), - desiredColors); - status = graphicBuffer->unlockAsync(fillFence); - ASSERT_EQ(::android::OK, status); -} - void ReadbackHelper::fillBuffer(int32_t width, int32_t height, uint32_t stride, void* bufferData, PixelFormat pixelFormat, std::vector desiredPixelColors) { @@ -152,16 +116,16 @@ void ReadbackHelper::fillBuffer(int32_t width, int32_t height, uint32_t stride, for (int row = 0; row < height; row++) { for (int col = 0; col < width; col++) { int pixel = row * width + col; - IComposerClient::Color desiredColor = desiredPixelColors[pixel]; + IComposerClient::Color srcColor = desiredPixelColors[pixel]; int offset = (row * stride + col) * bytesPerPixel; uint8_t* pixelColor = (uint8_t*)bufferData + offset; - pixelColor[0] = desiredColor.r; - pixelColor[1] = desiredColor.g; - pixelColor[2] = desiredColor.b; + pixelColor[0] = srcColor.r; + pixelColor[1] = srcColor.g; + pixelColor[2] = srcColor.b; if (bytesPerPixel == 4) { - pixelColor[3] = desiredColor.a; + pixelColor[3] = srcColor.a; } } } @@ -188,14 +152,12 @@ void ReadbackHelper::fillColorsArea(std::vector& expecte } } -bool ReadbackHelper::readbackSupported(PixelFormat pixelFormat, Dataspace dataspace, Error error) { +bool ReadbackHelper::readbackSupported(const PixelFormat& pixelFormat, const Dataspace& dataspace, + const Error error) { if (error != Error::NONE) { return false; } - return readbackSupported(pixelFormat, dataspace); -} - -bool ReadbackHelper::readbackSupported(PixelFormat pixelFormat, Dataspace dataspace) { + // TODO: add support for RGBA_1010102 if (pixelFormat != PixelFormat::RGB_888 && pixelFormat != PixelFormat::RGBA_8888) { return false; } @@ -205,94 +167,71 @@ bool ReadbackHelper::readbackSupported(PixelFormat pixelFormat, Dataspace datasp return true; } -void ReadbackHelper::createReadbackBuffer(uint32_t width, uint32_t height, PixelFormat pixelFormat, - Dataspace dataspace, sp* graphicBuffer) { - ASSERT_NE(nullptr, graphicBuffer); - if (!readbackSupported(pixelFormat, dataspace)) { - *graphicBuffer = nullptr; - } - android::PixelFormat bufferFormat = static_cast(pixelFormat); - uint32_t layerCount = 1; - uint64_t usage = static_cast(static_cast(BufferUsage::CPU_READ_OFTEN) | - static_cast(BufferUsage::GPU_TEXTURE)); - *graphicBuffer = sp::make(width, height, bufferFormat, layerCount, usage, - "ReadbackBuffer"); - ASSERT_NE(nullptr, *graphicBuffer); - ASSERT_EQ(::android::OK, (*graphicBuffer)->initCheck()); -} - -void ReadbackHelper::compareColorToBuffer(IComposerClient::Color expectedColor, - const sp& graphicBuffer, int32_t fence) { - std::vector expectedColors( - static_cast(graphicBuffer->getWidth() * graphicBuffer->getHeight())); - ::android::Rect bounds = graphicBuffer->getBounds(); - fillColorsArea(expectedColors, static_cast(graphicBuffer->getWidth()), - {bounds.left, bounds.top, bounds.right, bounds.bottom}, expectedColor); - compareColorsToBuffer(expectedColors, graphicBuffer, fence); -} - -void ReadbackHelper::compareColorsToBuffer(std::vector& expectedColors, - const sp& graphicBuffer, int32_t fence) { - ASSERT_TRUE(graphicBuffer->getPixelFormat() == ::android::PIXEL_FORMAT_RGB_888 || - graphicBuffer->getPixelFormat() == ::android::PIXEL_FORMAT_RGBA_8888); - - int bytesPerPixel = -1; - int bytesPerStride = -1; - void* bufData = nullptr; - status_t status = graphicBuffer->lockAsync(GRALLOC_USAGE_SW_READ_OFTEN, &bufData, fence, - &bytesPerPixel, &bytesPerStride); - ASSERT_EQ(::android::OK, status); - - const uint32_t stride = (bytesPerPixel > 0 && bytesPerStride > 0) - ? static_cast(bytesPerStride / bytesPerPixel) - : graphicBuffer->getStride(); - - if (bytesPerPixel == -1) { - PixelFormat pixelFormat = static_cast(graphicBuffer->getPixelFormat()); - bytesPerPixel = ReadbackHelper::GetBytesPerPixel(pixelFormat); - } +void ReadbackHelper::compareColorBuffers(std::vector& expectedColors, + void* bufferData, const uint32_t stride, + const uint32_t width, const uint32_t height, + const PixelFormat pixelFormat) { + const int32_t bytesPerPixel = ReadbackHelper::GetBytesPerPixel(pixelFormat); ASSERT_NE(-1, bytesPerPixel); - for (int row = 0; row < graphicBuffer->getHeight(); row++) { - for (int col = 0; col < graphicBuffer->getWidth(); col++) { - int pixel = row * static_cast(graphicBuffer->getWidth()) + col; - int offset = (row * static_cast(stride) + col) * bytesPerPixel; - uint8_t* pixelColor = (uint8_t*)bufData + offset; - const IComposerClient::Color expectedColor = expectedColors[static_cast(pixel)]; - ASSERT_EQ(std::round(255.0f * expectedColor.r), pixelColor[0]); - ASSERT_EQ(std::round(255.0f * expectedColor.g), pixelColor[1]); - ASSERT_EQ(std::round(255.0f * expectedColor.b), pixelColor[2]); + for (int row = 0; row < height; row++) { + for (int col = 0; col < width; col++) { + int pixel = row * width + col; + int offset = (row * stride + col) * bytesPerPixel; + uint8_t* pixelColor = (uint8_t*)bufferData + offset; + + ASSERT_EQ(expectedColors[pixel].r, pixelColor[0]); + ASSERT_EQ(expectedColors[pixel].g, pixelColor[1]); + ASSERT_EQ(expectedColors[pixel].b, pixelColor[2]); } } - - status = graphicBuffer->unlock(); - ASSERT_EQ(::android::OK, status); } ReadbackBuffer::ReadbackBuffer(Display display, const std::shared_ptr& client, - uint32_t width, uint32_t height, PixelFormat pixelFormat) { + const std::shared_ptr& gralloc, uint32_t width, + uint32_t height, PixelFormat pixelFormat, Dataspace dataspace) { mDisplay = display; + mComposerClient = client; + mGralloc = gralloc; + + mPixelFormat = pixelFormat; + mDataspace = dataspace; + mWidth = width; mHeight = height; - mPixelFormat = pixelFormat; mLayerCount = 1; + mFormat = mPixelFormat; mUsage = static_cast(BufferUsage::CPU_READ_OFTEN | BufferUsage::GPU_TEXTURE); + + mAccessRegion.top = 0; + mAccessRegion.left = 0; + mAccessRegion.width = width; + mAccessRegion.height = height; } void ReadbackBuffer::setReadbackBuffer() { - mGraphicBuffer = sp::make(mWidth, mHeight, - static_cast<::android::PixelFormat>(mPixelFormat), - mLayerCount, mUsage, "ReadbackBuffer"); - ASSERT_NE(nullptr, mGraphicBuffer); - ASSERT_EQ(::android::OK, mGraphicBuffer->initCheck()); - mComposerClient->setReadbackBuffer(mDisplay, mGraphicBuffer->handle, -1 /* fence */); + mBufferHandle.reset(new Gralloc::NativeHandleWrapper( + mGralloc->allocate(mWidth, mHeight, mLayerCount, mFormat, mUsage, + /*import*/ true, &mStride))); + ASSERT_NE(false, mGralloc->validateBufferSize(mBufferHandle->get(), mWidth, mHeight, + mLayerCount, mFormat, mUsage, mStride)); + ASSERT_NO_FATAL_FAILURE(mComposerClient->setReadbackBuffer(mDisplay, mBufferHandle->get(), -1)); } void ReadbackBuffer::checkReadbackBuffer(std::vector expectedColors) { // lock buffer for reading int32_t fenceHandle; ASSERT_NO_FATAL_FAILURE(mComposerClient->getReadbackBufferFence(mDisplay, &fenceHandle)); - ReadbackHelper::compareColorsToBuffer(expectedColors, mGraphicBuffer, fenceHandle); + + void* bufData = mGralloc->lock(mBufferHandle->get(), mUsage, mAccessRegion, fenceHandle); + ASSERT_TRUE(mPixelFormat == PixelFormat::RGB_888 || mPixelFormat == PixelFormat::RGBA_8888); + ReadbackHelper::compareColorBuffers(expectedColors, bufData, mStride, mWidth, mHeight, + mPixelFormat); + int32_t unlockFence = mGralloc->unlock(mBufferHandle->get()); + if (unlockFence != -1) { + sync_wait(unlockFence, -1); + close(unlockFence); + } } void TestColorLayer::write(const std::shared_ptr& writer) { diff --git a/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp b/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp index 254ff3be57..1700b2ade9 100644 --- a/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp +++ b/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp @@ -83,7 +83,9 @@ void TestRenderEngine::drawLayers() { void TestRenderEngine::checkColorBuffer(std::vector& expectedColors) { void* bufferData; ASSERT_EQ(0, mGraphicBuffer->lock(mGraphicBuffer->getUsage(), &bufferData)); - ReadbackHelper::compareColorsToBuffer(expectedColors, mGraphicBuffer, -1 /* fence */); + ReadbackHelper::compareColorBuffers(expectedColors, bufferData, mGraphicBuffer->getStride(), + mGraphicBuffer->getWidth(), mGraphicBuffer->getHeight(), + mFormat); ASSERT_EQ(0, mGraphicBuffer->unlock()); } diff --git a/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h b/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h index bbf8ef3b09..02d7bdb9da 100644 --- a/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h +++ b/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ComposerVts.h @@ -78,10 +78,8 @@ class ComposerClient : public V2_1::vts::ComposerClient { PixelFormat format, Dataspace dataspace); void setPowerMode_2_2(Display display, IComposerClient::PowerMode mode); void setReadbackBuffer(Display display, const native_handle_t* buffer, int32_t releaseFence); - void getRequiredReadbackBufferAttributes(Display display, PixelFormat* outPixelFormat, - Dataspace* outDataspace); - Error getReadbackBufferAttributes(Display display, PixelFormat* outPixelFormat, - Dataspace* outDataspace); + void getReadbackBufferAttributes(Display display, PixelFormat* outPixelFormat, + Dataspace* outDataspace); void getReadbackBufferFence(Display display, int32_t* outFence); std::vector getColorModes(Display display); diff --git a/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ReadbackVts.h b/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ReadbackVts.h index 7100297ac2..58efde9b5a 100644 --- a/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ReadbackVts.h +++ b/graphics/composer/2.2/utils/vts/include/composer-vts/2.2/ReadbackVts.h @@ -34,8 +34,6 @@ namespace composer { namespace V2_2 { namespace vts { -using android::GraphicBuffer; -using android::sp; using android::hardware::hidl_handle; using common::V1_1::BufferUsage; using common::V1_1::Dataspace; @@ -158,13 +156,6 @@ class ReadbackHelper { static int32_t GetBytesPerPixel(PixelFormat pixelFormat); - static void fillBufferAndGetFence(const sp& graphicBuffer, - IComposerClient::Color desiredColor, int* fillFence); - - static void fillBufferAndGetFence(const sp& graphicBuffer, - const std::vector& desiredColors, - int* fillFence); - static void fillBuffer(int32_t width, int32_t height, uint32_t stride, void* bufferData, PixelFormat pixelFormat, std::vector desiredPixelColors); @@ -175,39 +166,40 @@ class ReadbackHelper { static void fillColorsArea(std::vector& expectedColors, int32_t stride, IComposerClient::Rect area, IComposerClient::Color color); + static bool readbackSupported(const PixelFormat& pixelFormat, const Dataspace& dataspace, + const Error error); + static const std::vector colorModes; static const std::vector dataspaces; - static bool readbackSupported(PixelFormat pixelFormat, Dataspace dataspace, Error error); - static bool readbackSupported(PixelFormat pixelFormat, Dataspace dataspace); - - static void createReadbackBuffer(uint32_t width, uint32_t height, PixelFormat pixelFormat, - Dataspace dataspace, sp* graphicBuffer); - - static void compareColorToBuffer(IComposerClient::Color expectedColors, - const sp& graphicBuffer, int32_t fence); - - static void compareColorsToBuffer(std::vector& expectedColors, - const sp& graphicBuffer, int32_t fence); + static void compareColorBuffers(std::vector& expectedColors, + void* bufferData, const uint32_t stride, const uint32_t width, + const uint32_t height, const PixelFormat pixelFormat); }; class ReadbackBuffer { public: - ReadbackBuffer(Display display, const std::shared_ptr& client, uint32_t width, - uint32_t height, PixelFormat pixelFormat); + ReadbackBuffer(Display display, const std::shared_ptr& client, + const std::shared_ptr& gralloc, uint32_t width, uint32_t height, + PixelFormat pixelFormat, Dataspace dataspace); void setReadbackBuffer(); void checkReadbackBuffer(std::vector expectedColors); protected: - sp mGraphicBuffer; uint32_t mWidth; uint32_t mHeight; - PixelFormat mPixelFormat; uint32_t mLayerCount; + PixelFormat mFormat; uint64_t mUsage; + AccessRegion mAccessRegion; + uint32_t mStride; + std::unique_ptr mBufferHandle = nullptr; + PixelFormat mPixelFormat; + Dataspace mDataspace; Display mDisplay; + std::shared_ptr mGralloc; std::shared_ptr mComposerClient; }; diff --git a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp index 5b8ce3f943..e2a0f4d22f 100644 --- a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp +++ b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2ReadbackTest.cpp @@ -40,6 +40,7 @@ namespace vts { namespace { using android::Rect; +using common::V1_1::BufferUsage; using common::V1_1::Dataspace; using common::V1_1::PixelFormat; using V2_1::Config; @@ -99,8 +100,8 @@ class GraphicsCompositionTestBase : public ::testing::Test { mTestRenderEngine->initGraphicBuffer( static_cast(mDisplayWidth), static_cast(mDisplayHeight), 1, - GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_OFTEN | - GRALLOC_USAGE_HW_RENDER); + static_cast(BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN | + BufferUsage::GPU_RENDER_TARGET)); mTestRenderEngine->setDisplaySettings(clientCompositionDisplay); } @@ -115,22 +116,6 @@ class GraphicsCompositionTestBase : public ::testing::Test { } } - sp allocateBuffer(uint32_t width, uint32_t height, uint32_t usage) { - const auto& graphicBuffer = sp::make( - width, height, android::PIXEL_FORMAT_RGBA_8888, - /*layerCount*/ 1u, usage, "VtsHalGraphicsComposer2_2_ReadbackTest"); - - if (graphicBuffer && android::OK == graphicBuffer->initCheck()) { - return nullptr; - } - return graphicBuffer; - } - - sp allocateBuffer(uint32_t usage) { - return allocateBuffer(static_cast(mDisplayWidth), - static_cast(mDisplayHeight), usage); - } - void clearCommandReaderState() { mReader->mCompositionChanges.clear(); mReader->mErrors.clear(); @@ -208,9 +193,15 @@ TEST_P(GraphicsCompositionTest, SingleSolidColorLayer) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, - &mDataspace); - mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); + mComposerClient->getRaw()->getReadbackBufferAttributes( + mPrimaryDisplay, + [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { + mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, + tmpDataspace, tmpError); + mPixelFormat = tmpPixelFormat; + mDataspace = tmpDataspace; + }); + if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -229,8 +220,8 @@ TEST_P(GraphicsCompositionTest, SingleSolidColorLayer) { std::vector expectedColors(mDisplayWidth * mDisplayHeight); ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, coloredSquare, BLUE); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, - mDisplayHeight, mPixelFormat); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); @@ -264,9 +255,15 @@ TEST_P(GraphicsCompositionTest, SetLayerBuffer) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, - &mDataspace); - mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); + mComposerClient->getRaw()->getReadbackBufferAttributes( + mPrimaryDisplay, + [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { + mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, + tmpDataspace, tmpError); + mPixelFormat = tmpPixelFormat; + mDataspace = tmpDataspace; + }); + if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -275,8 +272,8 @@ TEST_P(GraphicsCompositionTest, SetLayerBuffer) { mWriter->selectDisplay(mPrimaryDisplay); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, - mDisplayHeight, mPixelFormat); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); std::vector expectedColors(mDisplayWidth * mDisplayHeight); ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, @@ -322,155 +319,6 @@ TEST_P(GraphicsCompositionTest, SetLayerBuffer) { } } -TEST_P(GraphicsCompositionTest, SetLayerBufferWithSlotsToClear) { - Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, - &mDataspace); - if (error == Error::UNSUPPORTED) { - GTEST_SUCCEED() << "Readback is unsupported"; - return; - } - ASSERT_EQ(Error::NONE, error); - - sp readbackBuffer; - ASSERT_NO_FATAL_FAILURE(ReadbackHelper::createReadbackBuffer( - mDisplayWidth, mDisplayHeight, mPixelFormat, mDataspace, &readbackBuffer)); - if (readbackBuffer == nullptr) { - GTEST_SUCCEED() << "Unsupported readback buffer attributes"; - return; - } - // no fence needed for the readback buffer - int noFence = -1; - - sp clearSlotBuffer = allocateBuffer(1u, 1u, GRALLOC_USAGE_HW_COMPOSER); - ASSERT_NE(nullptr, clearSlotBuffer); - - // red buffer - uint32_t usage = GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_OFTEN; - sp redBuffer = allocateBuffer(usage); - ASSERT_NE(nullptr, redBuffer); - int redFence; - ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBufferAndGetFence(redBuffer, RED, &redFence)); - - // blue buffer - sp blueBuffer = allocateBuffer(usage); - ASSERT_NE(nullptr, blueBuffer); - int blueFence; - ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBufferAndGetFence(blueBuffer, BLUE, &blueFence)); - - // layer defaults - IComposerClient::Rect rectFullDisplay = {0, 0, mDisplayWidth, mDisplayHeight}; - Layer layer = mComposerClient->createLayer(mPrimaryDisplay, 3); - mWriter->selectDisplay(mPrimaryDisplay); - mWriter->selectLayer(layer); - mWriter->setLayerDisplayFrame(rectFullDisplay); - mWriter->setLayerCompositionType(IComposerClient::Composition::DEVICE); - - // set the layer to the blue buffer - // should be blue - { - ASSERT_NO_FATAL_FAILURE(mComposerClient->setReadbackBuffer( - mPrimaryDisplay, readbackBuffer->handle, noFence)); - mWriter->selectDisplay(mPrimaryDisplay); - mWriter->selectLayer(layer); - mWriter->setLayerBuffer(/*slot*/ 0, blueBuffer->handle, blueFence); - mWriter->validateDisplay(); - execute(); - ASSERT_TRUE(mReader->mCompositionChanges.empty()); - ASSERT_TRUE(mReader->mErrors.size()); - mWriter->selectDisplay(mPrimaryDisplay); - mWriter->presentDisplay(); - execute(); - int32_t fence; - ASSERT_NO_FATAL_FAILURE(mComposerClient->getReadbackBufferFence(mPrimaryDisplay, &fence)); - ASSERT_NO_FATAL_FAILURE(ReadbackHelper::compareColorToBuffer(BLUE, readbackBuffer, fence)); - } - - // change the layer to the red buffer - // should be red - { - ASSERT_NO_FATAL_FAILURE(mComposerClient->setReadbackBuffer( - mPrimaryDisplay, readbackBuffer->handle, noFence)); - mWriter->selectDisplay(mPrimaryDisplay); - mWriter->selectLayer(layer); - mWriter->setLayerBuffer(/*slot*/ 1, redBuffer->handle, redFence); - mWriter->validateDisplay(); - execute(); - ASSERT_TRUE(mReader->mCompositionChanges.empty()); - ASSERT_TRUE(mReader->mErrors.size()); - mWriter->selectDisplay(mPrimaryDisplay); - mWriter->presentDisplay(); - execute(); - int32_t fence; - ASSERT_NO_FATAL_FAILURE(mComposerClient->getReadbackBufferFence(mPrimaryDisplay, &fence)); - ReadbackHelper::compareColorToBuffer(RED, readbackBuffer, fence); - } - - // clear the slot for the blue buffer - // should still be red - { - ASSERT_NO_FATAL_FAILURE(mComposerClient->setReadbackBuffer( - mPrimaryDisplay, readbackBuffer->handle, noFence)); - mWriter->selectDisplay(mPrimaryDisplay); - mWriter->selectLayer(layer); - mWriter->setLayerBuffer(/*slot*/ 0, clearSlotBuffer->handle, /*fence*/ -1); - mWriter->validateDisplay(); - execute(); - ASSERT_TRUE(mReader->mCompositionChanges.empty()); - ASSERT_TRUE(mReader->mErrors.size()); - mWriter->selectDisplay(mPrimaryDisplay); - mWriter->presentDisplay(); - execute(); - int32_t fence; - ASSERT_NO_FATAL_FAILURE(mComposerClient->getReadbackBufferFence(mPrimaryDisplay, &fence)); - ReadbackHelper::compareColorToBuffer(RED, readbackBuffer, fence); - } - - // clear the slot for the red buffer, and set the buffer with the same slot to the blue buffer - // should be blue - { - ASSERT_NO_FATAL_FAILURE(mComposerClient->setReadbackBuffer( - mPrimaryDisplay, readbackBuffer->handle, noFence)); - mWriter->selectDisplay(mPrimaryDisplay); - mWriter->selectLayer(layer); - mWriter->setLayerBuffer(/*slot*/ 1, clearSlotBuffer->handle, /*fence*/ -1); - mWriter->selectDisplay(mPrimaryDisplay); - mWriter->selectLayer(layer); - mWriter->setLayerBuffer(/*slot*/ 1, blueBuffer->handle, blueFence); - mWriter->validateDisplay(); - execute(); - ASSERT_TRUE(mReader->mCompositionChanges.empty()); - ASSERT_TRUE(mReader->mErrors.size()); - mWriter->selectDisplay(mPrimaryDisplay); - mWriter->presentDisplay(); - execute(); - int32_t fence; - ASSERT_NO_FATAL_FAILURE(mComposerClient->getReadbackBufferFence(mPrimaryDisplay, &fence)); - ReadbackHelper::compareColorToBuffer(BLUE, readbackBuffer, fence); - } - - // clear the slot for the now-blue buffer - // should be black (no buffer) - // TODO(b/262037933) Ensure we never clear the active buffer's slot with the placeholder buffer - // by setting the layer to the color black - { - ASSERT_NO_FATAL_FAILURE(mComposerClient->setReadbackBuffer( - mPrimaryDisplay, readbackBuffer->handle, noFence)); - mWriter->selectDisplay(mPrimaryDisplay); - mWriter->selectLayer(layer); - mWriter->setLayerBuffer(/*slot*/ 1, clearSlotBuffer->handle, /*fence*/ -1); - mWriter->validateDisplay(); - execute(); - ASSERT_TRUE(mReader->mCompositionChanges.empty()); - ASSERT_TRUE(mReader->mErrors.size()); - mWriter->selectDisplay(mPrimaryDisplay); - mWriter->presentDisplay(); - execute(); - int32_t fence; - ASSERT_NO_FATAL_FAILURE(mComposerClient->getReadbackBufferFence(mPrimaryDisplay, &fence)); - ReadbackHelper::compareColorToBuffer(BLACK, readbackBuffer, fence); - } -} - TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { for (ColorMode mode : mTestColorModes) { std::cout << "---Testing Color Mode " << ReadbackHelper::getColorModeString(mode) << "---" @@ -479,9 +327,15 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, - &mDataspace); - mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); + mComposerClient->getRaw()->getReadbackBufferAttributes( + mPrimaryDisplay, + [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { + mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, + tmpDataspace, tmpError); + mPixelFormat = tmpPixelFormat; + mDataspace = tmpDataspace; + }); + if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -496,7 +350,8 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { layer->write(mWriter); // This following buffer call should have no effect - uint32_t usage = GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_OFTEN; + uint64_t usage = + static_cast(BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN); NativeHandleWrapper bufferHandle = mGralloc->allocate(mDisplayWidth, mDisplayHeight, 1, PixelFormat::RGBA_8888, usage); mWriter->setLayerBuffer(0, bufferHandle.get(), -1); @@ -505,8 +360,8 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { std::vector expectedColors(mDisplayWidth * mDisplayHeight); ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, coloredSquare, BLUE); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, - mDisplayHeight, mPixelFormat); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); mWriter->validateDisplay(); @@ -537,11 +392,15 @@ TEST_P(GraphicsCompositionTest, ClientComposition) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - PixelFormat pixelFormat; - Dataspace dataspace; - Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &pixelFormat, - &dataspace); - mHasReadbackBuffer = ReadbackHelper::readbackSupported(pixelFormat, dataspace, error); + mComposerClient->getRaw()->getReadbackBufferAttributes( + mPrimaryDisplay, + [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { + mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, + tmpDataspace, tmpError); + mPixelFormat = tmpPixelFormat; + mDataspace = tmpDataspace; + }); + if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -569,8 +428,8 @@ TEST_P(GraphicsCompositionTest, ClientComposition) { std::vector> layers = {layer}; - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, - mDisplayHeight, mPixelFormat); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); ASSERT_EQ(0, mReader->mErrors.size()); @@ -582,8 +441,9 @@ TEST_P(GraphicsCompositionTest, ClientComposition) { ASSERT_EQ(1, mReader->mCompositionChanges[0].second); PixelFormat clientFormat = PixelFormat::RGBA_8888; - uint32_t clientUsage = GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_OFTEN | - GRALLOC_USAGE_HW_FB; + uint64_t clientUsage = static_cast(BufferUsage::CPU_READ_OFTEN | + BufferUsage::CPU_WRITE_OFTEN | + BufferUsage::COMPOSER_CLIENT_TARGET); Dataspace clientDataspace = ReadbackHelper::getDataspaceForColorMode(mode); IComposerClient::Rect damage{0, 0, mDisplayWidth, mDisplayHeight}; @@ -650,9 +510,15 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, - &mDataspace); - mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); + mComposerClient->getRaw()->getReadbackBufferAttributes( + mPrimaryDisplay, + [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { + mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, + tmpDataspace, tmpError); + mPixelFormat = tmpPixelFormat; + mDataspace = tmpDataspace; + }); + if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -665,8 +531,8 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, {0, mDisplayHeight / 2, mDisplayWidth, mDisplayHeight}, RED); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, - mDisplayHeight, mPixelFormat); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); auto deviceLayer = std::make_shared( @@ -686,8 +552,9 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { deviceLayer->write(mWriter); PixelFormat clientFormat = PixelFormat::RGBA_8888; - uint32_t clientUsage = - GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_HW_FB; + uint64_t clientUsage = + static_cast(BufferUsage::CPU_READ_OFTEN | BufferUsage::CPU_WRITE_OFTEN | + BufferUsage::COMPOSER_CLIENT_TARGET); Dataspace clientDataspace = ReadbackHelper::getDataspaceForColorMode(mode); int32_t clientWidth = mDisplayWidth; int32_t clientHeight = mDisplayHeight / 2; @@ -766,9 +633,15 @@ TEST_P(GraphicsCompositionTest, SetLayerDamage) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, - &mDataspace); - mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); + mComposerClient->getRaw()->getReadbackBufferAttributes( + mPrimaryDisplay, + [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { + mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, + tmpDataspace, tmpError); + mPixelFormat = tmpPixelFormat; + mDataspace = tmpDataspace; + }); + if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -792,8 +665,8 @@ TEST_P(GraphicsCompositionTest, SetLayerDamage) { std::vector> layers = {layer}; - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, - mDisplayHeight, mPixelFormat); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); @@ -845,9 +718,15 @@ TEST_P(GraphicsCompositionTest, SetLayerPlaneAlpha) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, - &mDataspace); - mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); + mComposerClient->getRaw()->getReadbackBufferAttributes( + mPrimaryDisplay, + [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { + mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, + tmpDataspace, tmpError); + mPixelFormat = tmpPixelFormat; + mDataspace = tmpDataspace; + }); + if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -863,8 +742,8 @@ TEST_P(GraphicsCompositionTest, SetLayerPlaneAlpha) { std::vector> layers = {layer}; - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, - mDisplayHeight, mPixelFormat); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); @@ -900,9 +779,15 @@ TEST_P(GraphicsCompositionTest, SetLayerSourceCrop) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, - &mDataspace); - mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); + mComposerClient->getRaw()->getReadbackBufferAttributes( + mPrimaryDisplay, + [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { + mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, + tmpDataspace, tmpError); + mPixelFormat = tmpPixelFormat; + mDataspace = tmpDataspace; + }); + if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -934,8 +819,8 @@ TEST_P(GraphicsCompositionTest, SetLayerSourceCrop) { // update expected colors to match crop ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, {0, 0, mDisplayWidth, mDisplayHeight}, BLUE); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, - mDisplayHeight, mPixelFormat); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); ASSERT_EQ(0, mReader->mErrors.size()); @@ -965,9 +850,15 @@ TEST_P(GraphicsCompositionTest, SetLayerZOrder) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, - &mDataspace); - mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); + mComposerClient->getRaw()->getReadbackBufferAttributes( + mPrimaryDisplay, + [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { + mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, + tmpDataspace, tmpError); + mPixelFormat = tmpPixelFormat; + mDataspace = tmpDataspace; + }); + if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -995,8 +886,8 @@ TEST_P(GraphicsCompositionTest, SetLayerZOrder) { ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, blueRect, BLUE); ReadbackHelper::fillColorsArea(expectedColors, mDisplayWidth, redRect, RED); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, - mDisplayHeight, mPixelFormat); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); @@ -1128,9 +1019,15 @@ TEST_P(GraphicsBlendModeCompositionTest, DISABLED_None) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, - &mDataspace); - mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); + mComposerClient->getRaw()->getReadbackBufferAttributes( + mPrimaryDisplay, + [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { + mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, + tmpDataspace, tmpError); + mPixelFormat = tmpPixelFormat; + mDataspace = tmpDataspace; + }); + if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -1146,8 +1043,8 @@ TEST_P(GraphicsBlendModeCompositionTest, DISABLED_None) { setUpLayers(IComposerClient::BlendMode::NONE); setExpectedColors(expectedColors); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, - mDisplayHeight, mPixelFormat); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(mLayers); ASSERT_EQ(0, mReader->mErrors.size()); @@ -1180,9 +1077,15 @@ TEST_P(GraphicsBlendModeCompositionTest, DISABLED_Coverage) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, - &mDataspace); - mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); + mComposerClient->getRaw()->getReadbackBufferAttributes( + mPrimaryDisplay, + [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { + mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, + tmpDataspace, tmpError); + mPixelFormat = tmpPixelFormat; + mDataspace = tmpDataspace; + }); + if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -1199,8 +1102,8 @@ TEST_P(GraphicsBlendModeCompositionTest, DISABLED_Coverage) { setUpLayers(IComposerClient::BlendMode::COVERAGE); setExpectedColors(expectedColors); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, - mDisplayHeight, mPixelFormat); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(mLayers); ASSERT_EQ(0, mReader->mErrors.size()); @@ -1227,9 +1130,15 @@ TEST_P(GraphicsBlendModeCompositionTest, Premultiplied) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, - &mDataspace); - mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); + mComposerClient->getRaw()->getReadbackBufferAttributes( + mPrimaryDisplay, + [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { + mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, + tmpDataspace, tmpError); + mPixelFormat = tmpPixelFormat; + mDataspace = tmpDataspace; + }); + if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; @@ -1244,8 +1153,8 @@ TEST_P(GraphicsBlendModeCompositionTest, Premultiplied) { setUpLayers(IComposerClient::BlendMode::PREMULTIPLIED); setExpectedColors(expectedColors); - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, - mDisplayHeight, mPixelFormat); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(mLayers); ASSERT_EQ(0, mReader->mErrors.size()); @@ -1313,16 +1222,22 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_H) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, - &mDataspace); - mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); + mComposerClient->getRaw()->getReadbackBufferAttributes( + mPrimaryDisplay, + [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { + mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, + tmpDataspace, tmpError); + mPixelFormat = tmpPixelFormat; + mDataspace = tmpDataspace; + }); + if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; return; } - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, - mDisplayHeight, mPixelFormat); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); mLayer->setTransform(Transform::FLIP_H); mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), mWriter); @@ -1362,16 +1277,22 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_V) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, - &mDataspace); - mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); + mComposerClient->getRaw()->getReadbackBufferAttributes( + mPrimaryDisplay, + [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { + mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, + tmpDataspace, tmpError); + mPixelFormat = tmpPixelFormat; + mDataspace = tmpDataspace; + }); + if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; return; } - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, - mDisplayHeight, mPixelFormat); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); mLayer->setTransform(Transform::FLIP_V); @@ -1411,16 +1332,22 @@ TEST_P(GraphicsTransformCompositionTest, ROT_180) { ASSERT_NO_FATAL_FAILURE( mComposerClient->setColorMode(mPrimaryDisplay, mode, RenderIntent::COLORIMETRIC)); - Error error = mComposerClient->getReadbackBufferAttributes(mPrimaryDisplay, &mPixelFormat, - &mDataspace); - mHasReadbackBuffer = ReadbackHelper::readbackSupported(mPixelFormat, mDataspace, error); + mComposerClient->getRaw()->getReadbackBufferAttributes( + mPrimaryDisplay, + [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { + mHasReadbackBuffer = ReadbackHelper::readbackSupported(tmpPixelFormat, + tmpDataspace, tmpError); + mPixelFormat = tmpPixelFormat; + mDataspace = tmpDataspace; + }); + if (!mHasReadbackBuffer) { std::cout << "Readback not supported or unsupported pixelFormat/dataspace" << std::endl; GTEST_SUCCEED() << "Readback not supported or unsupported pixelFormat/dataspace"; return; } - ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mDisplayWidth, - mDisplayHeight, mPixelFormat); + ReadbackBuffer readbackBuffer(mPrimaryDisplay, mComposerClient, mGralloc, mDisplayWidth, + mDisplayHeight, mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); mLayer->setTransform(Transform::ROT_180); diff --git a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp index f8fbb0477e..13ae089d65 100644 --- a/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp +++ b/graphics/composer/2.2/vts/functional/VtsHalGraphicsComposerV2_2TargetTest.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -36,6 +35,7 @@ namespace V2_2 { namespace vts { namespace { +using common::V1_0::BufferUsage; using common::V1_1::ColorMode; using common::V1_1::Dataspace; using common::V1_1::PixelFormat; @@ -65,13 +65,17 @@ class GraphicsComposerHidlTest : public ::testing::TestWithParam { mComposerClient->setVsyncEnabled(mPrimaryDisplay, false); mComposerCallback->setVsyncAllowed(false); - Error error = mComposerClient->getReadbackBufferAttributes( - mPrimaryDisplay, &mReadbackPixelFormat, &mReadbackDataspace); - mHasReadbackBuffer = error == Error::NONE; - if (mHasReadbackBuffer) { - ASSERT_LT(static_cast(0), mReadbackPixelFormat); - ASSERT_NE(Dataspace::UNKNOWN, mReadbackDataspace); - } + mComposerClient->getRaw()->getReadbackBufferAttributes( + mPrimaryDisplay, + [&](const auto& tmpError, const auto& tmpPixelFormat, const auto& tmpDataspace) { + mHasReadbackBuffer = tmpError == Error::NONE; + if (mHasReadbackBuffer) { + mReadbackPixelFormat = tmpPixelFormat; + mReadbackDataspace = tmpDataspace; + ASSERT_LT(static_cast(0), mReadbackPixelFormat); + ASSERT_NE(Dataspace::UNKNOWN, mReadbackDataspace); + } + }); mInvalidDisplayId = GetInvalidDisplayId(); } @@ -149,9 +153,10 @@ class GraphicsComposerHidlCommandTest : public GraphicsComposerHidlTest { } NativeHandleWrapper allocate() { + uint64_t usage = + static_cast(BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN); return mGralloc->allocate(/*width*/ 64, /*height*/ 64, /*layerCount*/ 1, - PixelFormat::RGBA_8888, - GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_OFTEN); + PixelFormat::RGBA_8888, usage); } void execute() { mComposerClient->execute(mReader.get(), mWriter.get()); } @@ -429,7 +434,9 @@ TEST_P(GraphicsComposerHidlTest, SetReadbackBuffer) { } // BufferUsage::COMPOSER_OUTPUT is missing - uint64_t usage = GRALLOC_USAGE_HW_COMPOSER | GRALLOC_USAGE_SW_READ_OFTEN; + uint64_t usage = + static_cast(BufferUsage::COMPOSER_OVERLAY | BufferUsage::CPU_READ_OFTEN); + std::unique_ptr gralloc; std::unique_ptr buffer; ASSERT_NO_FATAL_FAILURE(gralloc = std::make_unique()); @@ -450,7 +457,9 @@ TEST_P(GraphicsComposerHidlTest, SetReadbackBufferBadDisplay) { return; } - uint64_t usage = GRALLOC_USAGE_HW_COMPOSER | GRALLOC_USAGE_SW_READ_OFTEN; + uint64_t usage = + static_cast(BufferUsage::COMPOSER_OVERLAY | BufferUsage::CPU_READ_OFTEN); + std::unique_ptr gralloc; std::unique_ptr buffer; ASSERT_NO_FATAL_FAILURE(gralloc = std::make_unique()); @@ -702,4 +711,4 @@ int main(int argc, char** argv) { } return RUN_ALL_TESTS(); -} \ No newline at end of file +} diff --git a/graphics/composer/aidl/vts/ReadbackVts.cpp b/graphics/composer/aidl/vts/ReadbackVts.cpp index b59793f8db..abb58e25dd 100644 --- a/graphics/composer/aidl/vts/ReadbackVts.cpp +++ b/graphics/composer/aidl/vts/ReadbackVts.cpp @@ -20,8 +20,6 @@ #include "renderengine/ExternalTexture.h" #include "renderengine/impl/ExternalTexture.h" -using ::android::status_t; - namespace aidl::android::hardware::graphics::composer3::vts { const std::vector ReadbackHelper::colorModes = {ColorMode::SRGB, ColorMode::DISPLAY_P3}; @@ -29,9 +27,6 @@ const std::vector ReadbackHelper::dataspaces = {common::Dataspace::SR common::Dataspace::DISPLAY_P3}; void TestLayer::write(ComposerClientWriter& writer) { - ::android::status_t status = ::android::OK; - ASSERT_EQ(::android::OK, status); - writer.setLayerDisplayFrame(mDisplay, mLayer, mDisplayFrame); writer.setLayerSourceCrop(mDisplay, mLayer, mSourceCrop); writer.setLayerZOrder(mDisplay, mLayer, mZOrder); @@ -42,40 +37,6 @@ void TestLayer::write(ComposerClientWriter& writer) { writer.setLayerBrightness(mDisplay, mLayer, mBrightness); } -bool ReadbackHelper::readbackSupported(const common::PixelFormat& pixelFormat, - const common::Dataspace& dataspace) { - // TODO: add support for RGBA_1010102 - if (pixelFormat != common::PixelFormat::RGB_888 && - pixelFormat != common::PixelFormat::RGBA_8888) { - return false; - } - if (std::find(dataspaces.begin(), dataspaces.end(), dataspace) == dataspaces.end()) { - return false; - } - return true; -} - -void ReadbackHelper::createReadbackBuffer(ReadbackBufferAttributes readbackBufferAttributes, - const VtsDisplay& display, - sp* graphicBuffer) { - ASSERT_NE(nullptr, graphicBuffer); - if (!readbackSupported(readbackBufferAttributes.format, readbackBufferAttributes.dataspace)) { - *graphicBuffer = nullptr; - } - uint64_t usage = - static_cast(static_cast(common::BufferUsage::CPU_READ_OFTEN) | - static_cast(common::BufferUsage::GPU_TEXTURE)); - - uint32_t layerCount = 1; - *graphicBuffer = sp::make( - static_cast(display.getDisplayWidth()), - static_cast(display.getDisplayHeight()), - static_cast<::android::PixelFormat>(readbackBufferAttributes.format), layerCount, usage, - "ReadbackBuffer"); - ASSERT_NE(nullptr, *graphicBuffer); - ASSERT_EQ(::android::OK, (*graphicBuffer)->initCheck()); -} - std::string ReadbackHelper::getColorModeString(ColorMode mode) { switch (mode) { case ColorMode::SRGB: @@ -142,11 +103,11 @@ LayerSettings TestLayer::toRenderEngineLayerSettings() { return layerSettings; } -int32_t ReadbackHelper::GetBytesPerPixel(PixelFormat pixelFormat) { +int32_t ReadbackHelper::GetBytesPerPixel(common::PixelFormat pixelFormat) { switch (pixelFormat) { - case PixelFormat::RGBA_8888: + case common::PixelFormat::RGBA_8888: return 4; - case PixelFormat::RGB_888: + case common::PixelFormat::RGB_888: return 3; default: return -1; @@ -155,161 +116,136 @@ int32_t ReadbackHelper::GetBytesPerPixel(PixelFormat pixelFormat) { void ReadbackHelper::fillBuffer(uint32_t width, uint32_t height, uint32_t stride, void* bufferData, common::PixelFormat pixelFormat, - const std::vector& desiredColors) { + std::vector desiredPixelColors) { ASSERT_TRUE(pixelFormat == common::PixelFormat::RGB_888 || pixelFormat == common::PixelFormat::RGBA_8888); int32_t bytesPerPixel = GetBytesPerPixel(pixelFormat); ASSERT_NE(-1, bytesPerPixel); for (int row = 0; row < height; row++) { for (int col = 0; col < width; col++) { - int pixel = row * static_cast(width) + col; - Color desiredColor = desiredColors[static_cast(pixel)]; + auto pixel = row * static_cast(width) + col; + Color srcColor = desiredPixelColors[static_cast(pixel)]; int offset = (row * static_cast(stride) + col) * bytesPerPixel; uint8_t* pixelColor = (uint8_t*)bufferData + offset; - pixelColor[0] = static_cast(std::round(255.0f * desiredColor.r)); - pixelColor[1] = static_cast(std::round(255.0f * desiredColor.g)); - pixelColor[2] = static_cast(std::round(255.0f * desiredColor.b)); + pixelColor[0] = static_cast(std::round(255.0f * srcColor.r)); + pixelColor[1] = static_cast(std::round(255.0f * srcColor.g)); + pixelColor[2] = static_cast(std::round(255.0f * srcColor.b)); if (bytesPerPixel == 4) { - pixelColor[3] = static_cast(std::round(255.0f * desiredColor.a)); + pixelColor[3] = static_cast(std::round(255.0f * srcColor.a)); } } } } -void ReadbackHelper::clearColors(std::vector& colors, int32_t width, int32_t height, +void ReadbackHelper::clearColors(std::vector& expectedColors, int32_t width, int32_t height, int32_t displayWidth) { for (int row = 0; row < height; row++) { for (int col = 0; col < width; col++) { int pixel = row * displayWidth + col; - colors[static_cast(pixel)] = BLACK; + expectedColors[static_cast(pixel)] = BLACK; } } } -void ReadbackHelper::fillColorsArea(std::vector& colors, int32_t stride, Rect area, - Color desiredColor) { +void ReadbackHelper::fillColorsArea(std::vector& expectedColors, int32_t stride, Rect area, + Color color) { for (int row = area.top; row < area.bottom; row++) { for (int col = area.left; col < area.right; col++) { int pixel = row * stride + col; - colors[static_cast(pixel)] = desiredColor; + expectedColors[static_cast(pixel)] = color; } } } -void ReadbackHelper::fillBufferAndGetFence(const sp& graphicBuffer, - Color desiredColor, int* fillFence) { - ASSERT_NE(nullptr, fillFence); - std::vector desiredColors( - static_cast(graphicBuffer->getWidth() * graphicBuffer->getHeight())); - ::android::Rect bounds = graphicBuffer->getBounds(); - fillColorsArea(desiredColors, static_cast(graphicBuffer->getWidth()), - {bounds.left, bounds.top, bounds.right, bounds.bottom}, desiredColor); - ASSERT_NO_FATAL_FAILURE(fillBufferAndGetFence(graphicBuffer, desiredColors, fillFence)); -} - -void ReadbackHelper::fillBufferAndGetFence(const sp& graphicBuffer, - const std::vector& desiredColors, - int* fillFence) { - ASSERT_TRUE(graphicBuffer->getPixelFormat() == ::android::PIXEL_FORMAT_RGB_888 || - graphicBuffer->getPixelFormat() == ::android::PIXEL_FORMAT_RGBA_8888); - void* bufData; - int32_t bytesPerPixel = -1; - int32_t bytesPerStride = -1; - status_t status = - graphicBuffer->lock(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN, - &bufData, &bytesPerPixel, &bytesPerStride); - ASSERT_EQ(::android::OK, status); - - const uint32_t stride = (bytesPerPixel > 0 && bytesPerStride > 0) - ? static_cast(bytesPerStride / bytesPerPixel) - : graphicBuffer->getStride(); - ReadbackHelper::fillBuffer( - graphicBuffer->getWidth(), graphicBuffer->getHeight(), stride, bufData, - static_cast(graphicBuffer->getPixelFormat()), desiredColors); - status = graphicBuffer->unlockAsync(fillFence); - ASSERT_EQ(::android::OK, status); -} - -void ReadbackHelper::compareColorToBuffer(Color expectedColor, - const sp& graphicBuffer, - const ndk::ScopedFileDescriptor& fence) { - std::vector expectedColors( - static_cast(graphicBuffer->getWidth() * graphicBuffer->getHeight())); - ::android::Rect bounds = graphicBuffer->getBounds(); - fillColorsArea(expectedColors, static_cast(graphicBuffer->getWidth()), - {bounds.left, bounds.top, bounds.right, bounds.bottom}, expectedColor); - compareColorsToBuffer(expectedColors, graphicBuffer, fence); -} - -void ReadbackHelper::compareColorsToBuffer(const std::vector& expectedColors, - const sp& graphicBuffer, - const ndk::ScopedFileDescriptor& fence) { - ASSERT_TRUE(graphicBuffer->getPixelFormat() == ::android::PIXEL_FORMAT_RGB_888 || - graphicBuffer->getPixelFormat() == ::android::PIXEL_FORMAT_RGBA_8888); - - int bytesPerPixel = -1; - int bytesPerStride = -1; - void* bufData = nullptr; - status_t status = graphicBuffer->lockAsync(GRALLOC_USAGE_SW_READ_OFTEN, &bufData, - dup(fence.get()), &bytesPerPixel, &bytesPerStride); - ASSERT_EQ(::android::OK, status); - - const uint32_t stride = (bytesPerPixel > 0 && bytesPerStride > 0) - ? static_cast(bytesPerStride / bytesPerPixel) - : graphicBuffer->getStride(); - - if (bytesPerPixel == -1) { - bytesPerPixel = ReadbackHelper::GetBytesPerPixel( - static_cast(graphicBuffer->getPixelFormat())); +bool ReadbackHelper::readbackSupported(const common::PixelFormat& pixelFormat, + const common::Dataspace& dataspace) { + if (pixelFormat != common::PixelFormat::RGB_888 && + pixelFormat != common::PixelFormat::RGBA_8888) { + return false; } + if (std::find(dataspaces.begin(), dataspaces.end(), dataspace) == dataspaces.end()) { + return false; + } + return true; +} + +void ReadbackHelper::compareColorBuffers(const std::vector& expectedColors, void* bufferData, + const uint32_t stride, const uint32_t width, + const uint32_t height, common::PixelFormat pixelFormat) { + const int32_t bytesPerPixel = ReadbackHelper::GetBytesPerPixel(pixelFormat); ASSERT_NE(-1, bytesPerPixel); - for (int row = 0; row < graphicBuffer->getHeight(); row++) { - for (int col = 0; col < graphicBuffer->getWidth(); col++) { - int pixel = row * static_cast(graphicBuffer->getWidth()) + col; + for (int row = 0; row < height; row++) { + for (int col = 0; col < width; col++) { + auto pixel = row * static_cast(width) + col; int offset = (row * static_cast(stride) + col) * bytesPerPixel; - uint8_t* pixelColor = (uint8_t*)bufData + offset; + uint8_t* pixelColor = (uint8_t*)bufferData + offset; const Color expectedColor = expectedColors[static_cast(pixel)]; ASSERT_EQ(std::round(255.0f * expectedColor.r), pixelColor[0]); ASSERT_EQ(std::round(255.0f * expectedColor.g), pixelColor[1]); ASSERT_EQ(std::round(255.0f * expectedColor.b), pixelColor[2]); } } - - status = graphicBuffer->unlock(); - ASSERT_EQ(::android::OK, status); } ReadbackBuffer::ReadbackBuffer(int64_t display, const std::shared_ptr& client, - int32_t width, int32_t height, common::PixelFormat pixelFormat) + int32_t width, int32_t height, common::PixelFormat pixelFormat, + common::Dataspace dataspace) : mComposerClient(client) { mDisplay = display; + + mPixelFormat = pixelFormat; + mDataspace = dataspace; + mWidth = static_cast(width); mHeight = static_cast(height); - mPixelFormat = pixelFormat; mLayerCount = 1; mUsage = static_cast(static_cast(common::BufferUsage::CPU_READ_OFTEN) | static_cast(common::BufferUsage::GPU_TEXTURE)); + + mAccessRegion.top = 0; + mAccessRegion.left = 0; + mAccessRegion.right = static_cast(width); + mAccessRegion.bottom = static_cast(height); +} + +::android::sp<::android::GraphicBuffer> ReadbackBuffer::allocateBuffer() { + return ::android::sp<::android::GraphicBuffer>::make( + mWidth, mHeight, static_cast<::android::PixelFormat>(mPixelFormat), mLayerCount, mUsage, + "ReadbackBuffer"); } void ReadbackBuffer::setReadbackBuffer() { - mGraphicBuffer = sp::make(mWidth, mHeight, - static_cast<::android::PixelFormat>(mPixelFormat), - mLayerCount, mUsage, "ReadbackBuffer"); + mGraphicBuffer = allocateBuffer(); ASSERT_NE(nullptr, mGraphicBuffer); ASSERT_EQ(::android::OK, mGraphicBuffer->initCheck()); - ::ndk::ScopedFileDescriptor noFence = ::ndk::ScopedFileDescriptor(-1); - const auto& status = - mComposerClient->setReadbackBuffer(mDisplay, mGraphicBuffer->handle, noFence); - ASSERT_TRUE(status.isOk()); + const auto& bufferHandle = mGraphicBuffer->handle; + ::ndk::ScopedFileDescriptor fence = ::ndk::ScopedFileDescriptor(-1); + EXPECT_TRUE(mComposerClient->setReadbackBuffer(mDisplay, bufferHandle, fence).isOk()); } void ReadbackBuffer::checkReadbackBuffer(const std::vector& expectedColors) { + ASSERT_NE(nullptr, mGraphicBuffer); // lock buffer for reading const auto& [fenceStatus, bufferFence] = mComposerClient->getReadbackBufferFence(mDisplay); - ASSERT_TRUE(fenceStatus.isOk()); - ReadbackHelper::compareColorsToBuffer(expectedColors, mGraphicBuffer, bufferFence); + EXPECT_TRUE(fenceStatus.isOk()); + + int bytesPerPixel = -1; + int bytesPerStride = -1; + void* bufData = nullptr; + + auto status = mGraphicBuffer->lockAsync(mUsage, mAccessRegion, &bufData, dup(bufferFence.get()), + &bytesPerPixel, &bytesPerStride); + EXPECT_EQ(::android::OK, status); + ASSERT_TRUE(mPixelFormat == PixelFormat::RGB_888 || mPixelFormat == PixelFormat::RGBA_8888); + const uint32_t stride = (bytesPerPixel > 0 && bytesPerStride > 0) + ? static_cast(bytesPerStride / bytesPerPixel) + : mGraphicBuffer->getStride(); + ReadbackHelper::compareColorBuffers(expectedColors, bufData, stride, mWidth, mHeight, + mPixelFormat); + status = mGraphicBuffer->unlock(); + EXPECT_EQ(::android::OK, status); } void TestColorLayer::write(ComposerClientWriter& writer) { @@ -387,8 +323,9 @@ void TestBufferLayer::fillBuffer(std::vector& expectedColors) { const uint32_t stride = (bytesPerPixel > 0 && bytesPerStride > 0) ? static_cast(bytesPerStride / bytesPerPixel) : mGraphicBuffer->getStride(); - ASSERT_EQ(::android::OK, status); - ReadbackHelper::fillBuffer(mWidth, mHeight, stride, bufData, mPixelFormat, expectedColors); + EXPECT_EQ(::android::OK, status); + ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBuffer(mWidth, mHeight, stride, bufData, + mPixelFormat, expectedColors)); const auto unlockStatus = mGraphicBuffer->unlockAsync(&mFillFence); ASSERT_EQ(::android::OK, unlockStatus); @@ -398,13 +335,13 @@ void TestBufferLayer::setBuffer(std::vector colors) { mGraphicBuffer = allocateBuffer(); ASSERT_NE(nullptr, mGraphicBuffer); ASSERT_EQ(::android::OK, mGraphicBuffer->initCheck()); - fillBuffer(colors); + ASSERT_NO_FATAL_FAILURE(fillBuffer(colors)); } -sp TestBufferLayer::allocateBuffer() { - return sp::make(mWidth, mHeight, - static_cast<::android::PixelFormat>(mPixelFormat), mLayerCount, - mUsage, "TestBufferLayer"); +::android::sp<::android::GraphicBuffer> TestBufferLayer::allocateBuffer() { + return ::android::sp<::android::GraphicBuffer>::make( + mWidth, mHeight, static_cast<::android::PixelFormat>(mPixelFormat), mLayerCount, mUsage, + "TestBufferLayer"); } void TestBufferLayer::setDataspace(common::Dataspace dataspace, ComposerClientWriter& writer) { diff --git a/graphics/composer/aidl/vts/ReadbackVts.h b/graphics/composer/aidl/vts/ReadbackVts.h index ecf0d52f65..ee9f0d58ad 100644 --- a/graphics/composer/aidl/vts/ReadbackVts.h +++ b/graphics/composer/aidl/vts/ReadbackVts.h @@ -33,8 +33,6 @@ using ::android::renderengine::LayerSettings; using common::Dataspace; using common::PixelFormat; using IMapper2_1 = ::android::hardware::graphics::mapper::V2_1::IMapper; -using ::android::GraphicBuffer; -using ::android::sp; static const Color BLACK = {0.0f, 0.0f, 0.0f, 1.0f}; static const Color RED = {1.0f, 0.0f, 0.0f, 1.0f}; @@ -148,7 +146,7 @@ class TestBufferLayer : public TestLayer { protected: Composition mComposition; - sp mGraphicBuffer; + ::android::sp<::android::GraphicBuffer> mGraphicBuffer; TestRenderEngine& mRenderEngine; int32_t mFillFence; uint32_t mWidth; @@ -164,11 +162,6 @@ class TestBufferLayer : public TestLayer { class ReadbackHelper { public: - static bool readbackSupported(const PixelFormat& pixelFormat, const Dataspace& dataspace); - - static void createReadbackBuffer(ReadbackBufferAttributes readbackBufferAttributes, - const VtsDisplay& display, sp* graphicBuffer); - static std::string getColorModeString(ColorMode mode); static std::string getDataspaceString(Dataspace dataspace); @@ -178,36 +171,28 @@ class ReadbackHelper { static int32_t GetBytesPerPixel(PixelFormat pixelFormat); static void fillBuffer(uint32_t width, uint32_t height, uint32_t stride, void* bufferData, - PixelFormat pixelFormat, const std::vector& desriedColors); + PixelFormat pixelFormat, std::vector desiredPixelColors); - static void clearColors(std::vector& colors, int32_t width, int32_t height, + static void clearColors(std::vector& expectedColors, int32_t width, int32_t height, int32_t displayWidth); - static void fillColorsArea(std::vector& colors, int32_t stride, Rect area, - Color desiredColor); + static void fillColorsArea(std::vector& expectedColors, int32_t stride, Rect area, + Color color); - static void fillBufferAndGetFence(const sp& buffer, Color desiredColor, - int* fillFence); - - static void fillBufferAndGetFence(const sp& buffer, - const std::vector& desiredColors, int* fillFence); - - static void compareColorToBuffer( - Color expectedColor, const sp& graphicBuffer, - const ndk::ScopedFileDescriptor& fence = ::ndk::ScopedFileDescriptor(-1)); - - static void compareColorsToBuffer( - const std::vector& expectedColors, const sp& graphicBuffer, - const ndk::ScopedFileDescriptor& fence = ::ndk::ScopedFileDescriptor(-1)); + static bool readbackSupported(const PixelFormat& pixelFormat, const Dataspace& dataspace); static const std::vector colorModes; static const std::vector dataspaces; + + static void compareColorBuffers(const std::vector& expectedColors, void* bufferData, + const uint32_t stride, const uint32_t width, + const uint32_t height, PixelFormat pixelFormat); }; class ReadbackBuffer { public: ReadbackBuffer(int64_t display, const std::shared_ptr& client, int32_t width, - int32_t height, common::PixelFormat pixelFormat); + int32_t height, common::PixelFormat pixelFormat, common::Dataspace dataspace); void setReadbackBuffer(); @@ -216,12 +201,18 @@ class ReadbackBuffer { protected: uint32_t mWidth; uint32_t mHeight; - PixelFormat mPixelFormat; uint32_t mLayerCount; uint32_t mUsage; + PixelFormat mPixelFormat; + Dataspace mDataspace; int64_t mDisplay; - sp mGraphicBuffer; + ::android::sp<::android::GraphicBuffer> mGraphicBuffer; std::shared_ptr mComposerClient; + ::android::Rect mAccessRegion; + native_handle_t mBufferHandle; + + private: + ::android::sp<::android::GraphicBuffer> allocateBuffer(); }; } // namespace aidl::android::hardware::graphics::composer3::vts diff --git a/graphics/composer/aidl/vts/RenderEngineVts.cpp b/graphics/composer/aidl/vts/RenderEngineVts.cpp index b84d0d0f28..66779c8cad 100644 --- a/graphics/composer/aidl/vts/RenderEngineVts.cpp +++ b/graphics/composer/aidl/vts/RenderEngineVts.cpp @@ -76,7 +76,18 @@ void TestRenderEngine::drawLayers() { } void TestRenderEngine::checkColorBuffer(const std::vector& expectedColors) { - ReadbackHelper::compareColorsToBuffer(expectedColors, mGraphicBuffer); + void* bufferData; + int32_t bytesPerPixel = -1; + int32_t bytesPerStride = -1; + ASSERT_EQ(0, mGraphicBuffer->lock(static_cast(mGraphicBuffer->getUsage()), + &bufferData, &bytesPerPixel, &bytesPerStride)); + const uint32_t stride = (bytesPerPixel > 0 && bytesPerStride > 0) + ? static_cast(bytesPerStride / bytesPerPixel) + : mGraphicBuffer->getStride(); + ReadbackHelper::compareColorBuffers(expectedColors, bufferData, stride, + mGraphicBuffer->getWidth(), mGraphicBuffer->getHeight(), + mFormat); + ASSERT_EQ(::android::OK, mGraphicBuffer->unlock()); } } // namespace aidl::android::hardware::graphics::composer3::vts diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp index 93d9693dbd..6fa33927f0 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_ReadbackTest.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -80,11 +81,13 @@ class GraphicsCompositionTestBase : public ::testing::Test { clientCompositionDisplay.physicalDisplay = Rect(getDisplayWidth(), getDisplayHeight()); clientCompositionDisplay.clip = clientCompositionDisplay.physicalDisplay; - mTestRenderEngine->initGraphicBuffer(static_cast(getDisplayWidth()), - static_cast(getDisplayHeight()), - /*layerCount*/ 1U, - GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_SW_READ_OFTEN | - GRALLOC_USAGE_SW_WRITE_OFTEN); + mTestRenderEngine->initGraphicBuffer( + static_cast(getDisplayWidth()), static_cast(getDisplayHeight()), + /*layerCount*/ 1U, + static_cast( + static_cast(common::BufferUsage::CPU_READ_OFTEN) | + static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | + static_cast(common::BufferUsage::GPU_RENDER_TARGET))); mTestRenderEngine->setDisplaySettings(clientCompositionDisplay); } @@ -112,21 +115,18 @@ class GraphicsCompositionTestBase : public ::testing::Test { ASSERT_EQ(status.getServiceSpecificError(), serviceSpecificError); } - sp allocateBuffer(uint32_t width, uint32_t height, uint64_t usage) { - sp graphicBuffer = - sp::make(width, height, ::android::PIXEL_FORMAT_RGBA_8888, - /*layerCount*/ 1u, static_cast(usage), - "VtsHalGraphicsComposer3_ReadbackTest"); + std::pair> allocateBuffer(uint32_t usage) { + const auto width = static_cast(getDisplayWidth()); + const auto height = static_cast(getDisplayHeight()); + + const auto& graphicBuffer = ::android::sp<::android::GraphicBuffer>::make( + width, height, ::android::PIXEL_FORMAT_RGBA_8888, + /*layerCount*/ 1u, usage, "VtsHalGraphicsComposer3_ReadbackTest"); if (graphicBuffer && ::android::OK == graphicBuffer->initCheck()) { - return graphicBuffer; + return {true, graphicBuffer}; } - return nullptr; - } - - sp allocateBuffer(uint64_t usage) { - return allocateBuffer(static_cast(getDisplayWidth()), - static_cast(getDisplayHeight()), usage); + return {false, graphicBuffer}; } uint64_t getStableDisplayId(int64_t display) { @@ -293,7 +293,7 @@ TEST_P(GraphicsCompositionTest, SingleSolidColorLayer) { ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), coloredSquare, BLUE); ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat); + getDisplayHeight(), mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); @@ -332,7 +332,7 @@ TEST_P(GraphicsCompositionTest, SetLayerBuffer) { } ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat); + getDisplayHeight(), mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); std::vector expectedColors( static_cast(getDisplayWidth() * getDisplayHeight())); @@ -378,143 +378,6 @@ TEST_P(GraphicsCompositionTest, SetLayerBuffer) { } } -TEST_P(GraphicsCompositionTest, SetLayerBufferWithSlotsToClear) { - const auto& [status, readbackBufferAttributes] = - mComposerClient->getReadbackBufferAttributes(getPrimaryDisplayId()); - if (!status.isOk()) { - GTEST_SUCCEED() << "Readback not supported"; - return; - } - - sp readbackBuffer; - ASSERT_NO_FATAL_FAILURE(ReadbackHelper::createReadbackBuffer( - readbackBufferAttributes, getPrimaryDisplay(), &readbackBuffer)); - if (readbackBuffer == nullptr) { - GTEST_SUCCEED() << "Unsupported readback buffer attributes"; - return; - } - // no fence needed for the readback buffer - ScopedFileDescriptor noFence(-1); - - sp clearSlotBuffer = allocateBuffer(1u, 1u, GRALLOC_USAGE_HW_COMPOSER); - ASSERT_NE(nullptr, clearSlotBuffer); - - // red buffer - uint64_t usage = GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_OFTEN; - sp redBuffer = allocateBuffer(usage); - ASSERT_NE(nullptr, redBuffer); - int redFence; - ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBufferAndGetFence(redBuffer, RED, &redFence)); - - // blue buffer - sp blueBuffer = allocateBuffer(usage); - ASSERT_NE(nullptr, blueBuffer); - int blueFence; - ASSERT_NO_FATAL_FAILURE(ReadbackHelper::fillBufferAndGetFence(blueBuffer, BLUE, &blueFence)); - - // layer defaults - common::Rect rectFullDisplay = {0, 0, getDisplayWidth(), getDisplayHeight()}; - int64_t display = getPrimaryDisplayId(); - auto [layerStatus, layer] = mComposerClient->createLayer(getPrimaryDisplayId(), 3); - ASSERT_TRUE(layerStatus.isOk()); - mWriter->setLayerDisplayFrame(display, layer, rectFullDisplay); - mWriter->setLayerCompositionType(display, layer, Composition::DEVICE); - - // set the layer to the blue buffer - // should be blue - { - auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); - ASSERT_TRUE(status.isOk()); - mWriter->setLayerBuffer(display, layer, /*slot*/ 0, blueBuffer->handle, blueFence); - mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); - execute(); - ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); - ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->presentDisplay(display); - execute(); - auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); - ASSERT_TRUE(fenceStatus.isOk()); - ReadbackHelper::compareColorToBuffer(BLUE, readbackBuffer, fence); - } - - // change the layer to the red buffer - // should be red - { - auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); - ASSERT_TRUE(status.isOk()); - mWriter->setLayerBuffer(display, layer, /*slot*/ 1, redBuffer->handle, redFence); - mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); - execute(); - ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); - ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->presentDisplay(display); - execute(); - auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); - ASSERT_TRUE(fenceStatus.isOk()); - ReadbackHelper::compareColorToBuffer(RED, readbackBuffer, fence); - } - - // clear the slot for the blue buffer - // should still be red - { - auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); - ASSERT_TRUE(status.isOk()); - mWriter->setLayerBufferWithNewCommand(display, layer, /*slot*/ 0, clearSlotBuffer->handle, - /*fence*/ -1); - mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); - execute(); - ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); - ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->presentDisplay(display); - execute(); - auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); - ASSERT_TRUE(fenceStatus.isOk()); - ReadbackHelper::compareColorToBuffer(RED, readbackBuffer, fence); - } - - // clear the slot for the red buffer, and set the buffer with the same slot to the blue buffer - // should be blue - { - auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); - ASSERT_TRUE(status.isOk()); - mWriter->setLayerBufferWithNewCommand(display, layer, /*slot*/ 1, clearSlotBuffer->handle, - /*fence*/ -1); - mWriter->setLayerBuffer(display, layer, /*slot*/ 1, blueBuffer->handle, blueFence); - mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); - execute(); - ASSERT_TRUE(mReader.takeChangedCompositionTypes(display).empty()); - ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->presentDisplay(display); - execute(); - auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); - ASSERT_TRUE(fenceStatus.isOk()); - ReadbackHelper::compareColorToBuffer(BLUE, readbackBuffer, fence); - } - - // clear the slot for the now-blue buffer - // should be black (no buffer) - // TODO(b/262037933) Ensure we never clear the active buffer's slot with the placeholder buffer - // by setting the layer to the color black - { - auto status = mComposerClient->setReadbackBuffer(display, readbackBuffer->handle, noFence); - ASSERT_TRUE(status.isOk()); - mWriter->setLayerBufferWithNewCommand(display, layer, /*slot*/ 1, clearSlotBuffer->handle, - /*fence*/ -1); - mWriter->validateDisplay(display, ComposerClientWriter::kNoTimestamp); - execute(); - if (!mReader.takeChangedCompositionTypes(display).empty()) { - GTEST_SUCCEED(); - return; - } - ASSERT_TRUE(mReader.takeErrors().empty()); - mWriter->presentDisplay(display); - execute(); - auto [fenceStatus, fence] = mComposerClient->getReadbackBufferFence(display); - ASSERT_TRUE(fenceStatus.isOk()); - ReadbackHelper::compareColorToBuffer(BLACK, readbackBuffer, fence); - } -} - TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { for (ColorMode mode : mTestColorModes) { EXPECT_TRUE(mComposerClient @@ -536,9 +399,10 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { layer->write(*mWriter); // This following buffer call should have no effect - uint64_t usage = GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_OFTEN; - sp graphicBuffer = allocateBuffer(usage); - ASSERT_NE(nullptr, graphicBuffer); + const auto usage = static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | + static_cast(common::BufferUsage::CPU_READ_OFTEN); + const auto& [graphicBufferStatus, graphicBuffer] = allocateBuffer(usage); + ASSERT_TRUE(graphicBufferStatus); const auto& buffer = graphicBuffer->handle; mWriter->setLayerBuffer(getPrimaryDisplayId(), layer->getLayer(), /*slot*/ 0, buffer, /*acquireFence*/ -1); @@ -549,7 +413,7 @@ TEST_P(GraphicsCompositionTest, SetLayerBufferNoEffect) { ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), coloredSquare, BLUE); ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat); + getDisplayHeight(), mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); mWriter->validateDisplay(getPrimaryDisplayId(), ComposerClientWriter::kNoTimestamp); @@ -577,7 +441,7 @@ TEST_P(GraphicsCompositionTest, SetReadbackBuffer) { } ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat); + getDisplayHeight(), mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); } @@ -590,9 +454,10 @@ TEST_P(GraphicsCompositionTest, SetReadbackBuffer_BadDisplay) { return; } - uint64_t usage = GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_OFTEN; - sp graphicBuffer = allocateBuffer(usage); - ASSERT_NE(nullptr, graphicBuffer); + const auto usage = static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | + static_cast(common::BufferUsage::CPU_READ_OFTEN); + const auto& [graphicBufferStatus, graphicBuffer] = allocateBuffer(usage); + ASSERT_TRUE(graphicBufferStatus); const auto& bufferHandle = graphicBuffer->handle; ::ndk::ScopedFileDescriptor fence = ::ndk::ScopedFileDescriptor(-1); @@ -674,7 +539,7 @@ TEST_P(GraphicsCompositionTest, ClientComposition) { std::vector> layers = {layer}; ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat); + getDisplayHeight(), mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -687,14 +552,16 @@ TEST_P(GraphicsCompositionTest, ClientComposition) { ASSERT_EQ(Composition::CLIENT, changedCompositionTypes[0].composition); PixelFormat clientFormat = PixelFormat::RGBA_8888; - auto clientUsage = GRALLOC_USAGE_HW_FB | GRALLOC_USAGE_SW_READ_OFTEN | - GRALLOC_USAGE_SW_WRITE_OFTEN; + auto clientUsage = static_cast( + static_cast(common::BufferUsage::CPU_READ_OFTEN) | + static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | + static_cast(common::BufferUsage::COMPOSER_CLIENT_TARGET)); Dataspace clientDataspace = ReadbackHelper::getDataspaceForColorMode(mode); common::Rect damage{0, 0, getDisplayWidth(), getDisplayHeight()}; // create client target buffer - sp graphicBuffer = allocateBuffer(clientUsage); - ASSERT_NE(nullptr, graphicBuffer); + const auto& [graphicBufferStatus, graphicBuffer] = allocateBuffer(clientUsage); + ASSERT_TRUE(graphicBufferStatus); const auto& buffer = graphicBuffer->handle; void* clientBufData; const auto stride = static_cast(graphicBuffer->stride); @@ -751,7 +618,7 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { {0, getDisplayHeight() / 2, getDisplayWidth(), getDisplayHeight()}, RED); ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat); + getDisplayHeight(), mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); auto deviceLayer = std::make_shared( @@ -770,8 +637,10 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { deviceLayer->write(*mWriter); PixelFormat clientFormat = PixelFormat::RGBA_8888; - auto clientUsage = - GRALLOC_USAGE_HW_FB | GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN; + auto clientUsage = static_cast( + static_cast(common::BufferUsage::CPU_READ_OFTEN) | + static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | + static_cast(common::BufferUsage::COMPOSER_CLIENT_TARGET)); Dataspace clientDataspace = ReadbackHelper::getDataspaceForColorMode(mode); int32_t clientWidth = getDisplayWidth(); int32_t clientHeight = getDisplayHeight() / 2; @@ -793,8 +662,8 @@ TEST_P(GraphicsCompositionTest, DeviceAndClientComposition) { } // create client target buffer ASSERT_EQ(Composition::CLIENT, changedCompositionTypes[0].composition); - sp graphicBuffer = allocateBuffer(clientUsage); - ASSERT_NE(nullptr, graphicBuffer); + const auto& [graphicBufferStatus, graphicBuffer] = allocateBuffer(clientUsage); + ASSERT_TRUE(graphicBufferStatus); const auto& buffer = graphicBuffer->handle; void* clientBufData; @@ -856,7 +725,7 @@ TEST_P(GraphicsCompositionTest, SetLayerDamage) { std::vector> layers = {layer}; ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat); + getDisplayHeight(), mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); @@ -924,7 +793,7 @@ TEST_P(GraphicsCompositionTest, SetLayerPlaneAlpha) { std::vector> layers = {layer}; ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat); + getDisplayHeight(), mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); @@ -990,7 +859,7 @@ TEST_P(GraphicsCompositionTest, SetLayerSourceCrop) { ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), {0, 0, getDisplayWidth(), getDisplayHeight()}, BLUE); ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat); + getDisplayHeight(), mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -1047,7 +916,7 @@ TEST_P(GraphicsCompositionTest, SetLayerZOrder) { ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), redRect, RED); ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat); + getDisplayHeight(), mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); @@ -1157,7 +1026,7 @@ TEST_P(GraphicsCompositionTest, SetLayerBrightnessDims) { ReadbackHelper::fillColorsArea(expectedColors, getDisplayWidth(), dimmerRedRect, DIM_RED); ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat); + getDisplayHeight(), mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(layers); @@ -1293,7 +1162,7 @@ TEST_P(GraphicsBlendModeCompositionTest, None) { setExpectedColors(expectedColors); ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat); + getDisplayHeight(), mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(mLayers); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -1338,7 +1207,7 @@ TEST_P(GraphicsBlendModeCompositionTest, Coverage) { setExpectedColors(expectedColors); ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat); + getDisplayHeight(), mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(mLayers); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -1378,7 +1247,7 @@ TEST_P(GraphicsBlendModeCompositionTest, Premultiplied) { setExpectedColors(expectedColors); ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat); + getDisplayHeight(), mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); writeLayers(mLayers); ASSERT_TRUE(mReader.takeErrors().empty()); @@ -1452,7 +1321,7 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_H) { return; } ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat); + getDisplayHeight(), mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); mLayer->setTransform(Transform::FLIP_H); mLayer->setDataspace(ReadbackHelper::getDataspaceForColorMode(mode), *mWriter); @@ -1497,7 +1366,7 @@ TEST_P(GraphicsTransformCompositionTest, FLIP_V) { return; } ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat); + getDisplayHeight(), mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); mLayer->setTransform(Transform::FLIP_V); @@ -1542,7 +1411,7 @@ TEST_P(GraphicsTransformCompositionTest, ROT_180) { return; } ReadbackBuffer readbackBuffer(getPrimaryDisplayId(), mComposerClient, getDisplayWidth(), - getDisplayHeight(), mPixelFormat); + getDisplayHeight(), mPixelFormat, mDataspace); ASSERT_NO_FATAL_FAILURE(readbackBuffer.setReadbackBuffer()); mLayer->setTransform(Transform::ROT_180); From 14bd07b1951e621a8fbd2428946af07421d91693 Mon Sep 17 00:00:00 2001 From: Brian Lindahl Date: Tue, 17 Jan 2023 14:54:39 -0700 Subject: [PATCH 611/998] Revert "Add VTS test for clearing buffer slots to Composer HIDL and AIDL" This reverts commit ca3eef29b0bb511649440188e9b500432e34435c. NOTE: This is not a full revert, it leaves the production code in place and only reverts the VTS test changes. Reason for revert: b/262370410 Test: atest VtsHalGraphicsComposerV2_1TargetTest on Oriole Test: atest VtsHalGraphicsComposerV2_2TargetTest on Oriole Test: atest VtsHalGraphicsComposerV2_3TargetTest on Oriole Test: atest VtsHalGraphicsComposerV2_4TargetTest on Oriole Bug: 262370410 Change-Id: Ie5ba7402cda2828ba33131d527ab0c3a66937648 --- .../VtsHalGraphicsComposerV2_1TargetTest.cpp | 58 +------------------ .../VtsHalGraphicsComposer3_TargetTest.cpp | 47 +++------------ 2 files changed, 10 insertions(+), 95 deletions(-) diff --git a/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp b/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp index b66ee1909e..48226785d5 100644 --- a/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp +++ b/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp @@ -657,7 +657,6 @@ class GraphicsComposerHidlCommandTest : public GraphicsComposerHidlTest { IComposerClient::Attribute::WIDTH); mDisplayHeight = mComposerClient->getDisplayAttribute(mPrimaryDisplay, activeConfig, IComposerClient::Attribute::HEIGHT); - mWriter = std::make_unique(1024); mReader = std::make_unique(); } @@ -667,13 +666,11 @@ class GraphicsComposerHidlCommandTest : public GraphicsComposerHidlTest { ASSERT_NO_FATAL_FAILURE(GraphicsComposerHidlTest::TearDown()); } - NativeHandleWrapper allocate() { return allocate(mDisplayWidth, mDisplayHeight); } - - NativeHandleWrapper allocate(uint32_t width, uint32_t height) { + NativeHandleWrapper allocate() { uint64_t usage = static_cast(BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN | BufferUsage::COMPOSER_OVERLAY); - return mGralloc->allocate(width, height, 1, PixelFormat::RGBA_8888, usage); + return mGralloc->allocate(mDisplayWidth, mDisplayHeight, 1, PixelFormat::RGBA_8888, usage); } void execute() { mComposerClient->execute(mReader.get(), mWriter.get()); } @@ -886,57 +883,6 @@ TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_BUFFER) { execute(); } -/** - * Test IComposerClient::Command::SET_LAYER_BUFFER with the behavior used for clearing buffer slots. - */ -TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_BUFFER_TO_CLEAR_BUFFER_SLOTS) { - // A buffer used to clear buffer slots - auto clearSlotBuffer = allocate(1u, 1u); - - auto handle1 = allocate(); - ASSERT_NE(nullptr, handle1.get()); - IComposerClient::Rect displayFrame{0, 0, mDisplayWidth, mDisplayHeight}; - Layer layer; - ASSERT_NO_FATAL_FAILURE( - layer = mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount)); - mWriter->selectDisplay(mPrimaryDisplay); - mWriter->selectLayer(layer); - mWriter->setLayerCompositionType(IComposerClient::Composition::DEVICE); - mWriter->setLayerDisplayFrame(displayFrame); - mWriter->setLayerBuffer(0, handle1.get(), -1); - mWriter->setLayerDataspace(Dataspace::UNKNOWN); - mWriter->validateDisplay(); - execute(); - if (mReader->mCompositionChanges.size() != 0) { - GTEST_SUCCEED() << "Composition change requested, skipping test"; - return; - } - ASSERT_EQ(0, mReader->mErrors.size()); - - mWriter->selectDisplay(mPrimaryDisplay); - mWriter->presentDisplay(); - execute(); - ASSERT_EQ(0, mReader->mErrors.size()); - - // Ensure we can clear a buffer slot and then set that same slot with a new buffer - auto handle2 = allocate(); - ASSERT_NE(nullptr, handle2.get()); - mWriter->selectDisplay(mPrimaryDisplay); - mWriter->selectLayer(layer); - mWriter->setLayerBuffer(0, clearSlotBuffer.get(), -1); - mWriter->selectDisplay(mPrimaryDisplay); - mWriter->selectLayer(layer); - mWriter->setLayerBuffer(0, handle2.get(), -1); - mWriter->validateDisplay(); - execute(); - ASSERT_EQ(0, mReader->mErrors.size()); - - mWriter->selectDisplay(mPrimaryDisplay); - mWriter->presentDisplay(); - execute(); - ASSERT_EQ(0, mReader->mErrors.size()); -} - /** * Test IComposerClient::Command::SET_LAYER_SURFACE_DAMAGE. */ diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 6598b308cc..358e99ece5 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -1188,19 +1188,15 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { } } - sp allocate(uint32_t width, uint32_t height, - ::android::PixelFormat pixelFormat) { - return sp::make( - width, height, pixelFormat, /*layerCount*/ 1U, - static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | - static_cast(common::BufferUsage::CPU_READ_OFTEN) | - static_cast(common::BufferUsage::COMPOSER_OVERLAY), - "VtsHalGraphicsComposer3_TargetTest"); - } - sp allocate(::android::PixelFormat pixelFormat) { - return allocate(static_cast(getPrimaryDisplay().getDisplayWidth()), - static_cast(getPrimaryDisplay().getDisplayHeight()), pixelFormat); + return sp::make( + static_cast(getPrimaryDisplay().getDisplayWidth()), + static_cast(getPrimaryDisplay().getDisplayHeight()), pixelFormat, + /*layerCount*/ 1U, + (static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | + static_cast(common::BufferUsage::CPU_READ_OFTEN) | + static_cast(common::BufferUsage::COMPOSER_OVERLAY)), + "VtsHalGraphicsComposer3_TargetTest"); } void sendRefreshFrame(const VtsDisplay& display, const VsyncPeriodChangeTimeline* timeline) { @@ -1703,33 +1699,6 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerBuffer) { execute(); } -TEST_P(GraphicsComposerAidlCommandTest, SetLayerBufferWithSlotsToClear) { - auto clearSlotBuffer = allocate(1u, 1u, ::android::PIXEL_FORMAT_RGB_888); - ASSERT_NE(nullptr, clearSlotBuffer); - auto clearSlotBufferHandle = clearSlotBuffer->handle; - - const auto buffer1 = allocate(::android::PIXEL_FORMAT_RGBA_8888); - ASSERT_NE(nullptr, buffer1); - const auto handle1 = buffer1->handle; - const auto& [layerStatus, layer] = - mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); - EXPECT_TRUE(layerStatus.isOk()); - auto& writer = getWriter(getPrimaryDisplayId()); - writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle1, /*acquireFence*/ -1); - execute(); - ASSERT_TRUE(mReader.takeErrors().empty()); - - // Ensure we can clear a buffer slot and then set that same slot with a new buffer - const auto buffer2 = allocate(::android::PIXEL_FORMAT_RGBA_8888); - ASSERT_NE(nullptr, buffer2); - const auto handle2 = buffer2->handle; - writer.setLayerBufferWithNewCommand(getPrimaryDisplayId(), layer, /* slot */ 0, - clearSlotBufferHandle, /*acquireFence*/ -1); - writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle2, /*acquireFence*/ -1); - execute(); - ASSERT_TRUE(mReader.takeErrors().empty()); -} - TEST_P(GraphicsComposerAidlCommandTest, SetLayerSurfaceDamage) { const auto& [layerStatus, layer] = mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); From aff01d7e65d9d1eff17d09f9be4861a26e6114c7 Mon Sep 17 00:00:00 2001 From: sadiqsada Date: Thu, 12 Jan 2023 11:02:34 -0800 Subject: [PATCH 612/998] Add FrontendStatus for IPTV Test: atest VtsHalTvTunerTargetTest Bug: 263504906 Change-Id: I33c6480933fa830a9c17cf04eb3336c7ce11a587 --- .../hardware/tv/tuner/FrontendStatus.aidl | 5 ++++ .../hardware/tv/tuner/FrontendStatusType.aidl | 5 ++++ .../hardware/tv/tuner/FrontendStatus.aidl | 27 ++++++++++++++++++- .../hardware/tv/tuner/FrontendStatusType.aidl | 25 +++++++++++++++++ tv/tuner/aidl/default/Frontend.cpp | 20 ++++++++++++++ .../aidl/vts/functional/FrontendTests.cpp | 25 +++++++++++++++++ 6 files changed, 106 insertions(+), 1 deletion(-) diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatus.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatus.aidl index 1e0f5f0840..b991ab6836 100644 --- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatus.aidl +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatus.aidl @@ -77,4 +77,9 @@ union FrontendStatus { int[] streamIdList; int[] dvbtCellIds; android.hardware.tv.tuner.FrontendScanAtsc3PlpInfo[] allPlpInfo; + String iptvContentUrl = ""; + long iptvPacketsReceived; + long iptvPacketsLost; + int iptvWorstJitterMs; + int iptvAverageJitterMs; } diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusType.aidl index cd6ccb3dc1..379129960a 100644 --- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusType.aidl +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusType.aidl @@ -77,4 +77,9 @@ enum FrontendStatusType { STREAM_ID_LIST = 39, DVBT_CELL_IDS = 40, ATSC3_ALL_PLP_INFO = 41, + IPTV_CONTENT_URL = 42, + IPTV_PACKETS_LOST = 43, + IPTV_PACKETS_RECEIVED = 44, + IPTV_WORST_JITTER_MS = 45, + IPTV_AVERAGE_JITTER_MS = 46, } diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatus.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatus.aidl index b5d02016df..391f29be2a 100644 --- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatus.aidl +++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatus.aidl @@ -26,8 +26,8 @@ import android.hardware.tv.tuner.FrontendIsdbtPartialReceptionFlag; import android.hardware.tv.tuner.FrontendModulation; import android.hardware.tv.tuner.FrontendModulationStatus; import android.hardware.tv.tuner.FrontendRollOff; -import android.hardware.tv.tuner.FrontendSpectralInversion; import android.hardware.tv.tuner.FrontendScanAtsc3PlpInfo; +import android.hardware.tv.tuner.FrontendSpectralInversion; import android.hardware.tv.tuner.FrontendStatusAtsc3PlpInfo; import android.hardware.tv.tuner.FrontendTransmissionMode; import android.hardware.tv.tuner.LnbVoltage; @@ -247,4 +247,29 @@ union FrontendStatus { * and not tuned PLPs for currently watching service. */ FrontendScanAtsc3PlpInfo[] allPlpInfo; + + /** + * IPTV Content URL + */ + String iptvContentUrl = ""; + + /** + * Packets Received (IPTV - UDP/RTP). + */ + long iptvPacketsReceived; + + /** + * Packets Lost (IPTV - RTP). + */ + long iptvPacketsLost; + + /** + * Worst jitter (milliseconds). + */ + int iptvWorstJitterMs; + + /** + * Average jitter (milliseconds). + */ + int iptvAverageJitterMs; } diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatusType.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatusType.aidl index 8f3f2c56c1..6804b2daf2 100644 --- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatusType.aidl +++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatusType.aidl @@ -234,4 +234,29 @@ enum FrontendStatusType { * and not tuned PLPs for currently watching service. */ ATSC3_ALL_PLP_INFO, + + /** + * IPTV Content URL. + */ + IPTV_CONTENT_URL, + + /** + * Number of packets lost. + */ + IPTV_PACKETS_LOST, + + /** + * Number of packets received. + */ + IPTV_PACKETS_RECEIVED, + + /** + * Worst jitter (milliseconds). + */ + IPTV_WORST_JITTER_MS, + + /** + * Average jitter (milliseconds). + */ + IPTV_AVERAGE_JITTER_MS, } diff --git a/tv/tuner/aidl/default/Frontend.cpp b/tv/tuner/aidl/default/Frontend.cpp index 0573d08301..0e32b6118b 100644 --- a/tv/tuner/aidl/default/Frontend.cpp +++ b/tv/tuner/aidl/default/Frontend.cpp @@ -873,6 +873,26 @@ void Frontend::scanThreadLoop() { status.set(infos); break; } + case FrontendStatusType::IPTV_CONTENT_URL: { + status.set(""); + break; + } + case FrontendStatusType::IPTV_PACKETS_LOST: { + status.set(5); + break; + } + case FrontendStatusType::IPTV_PACKETS_RECEIVED: { + status.set(5); + break; + } + case FrontendStatusType::IPTV_WORST_JITTER_MS: { + status.set(5); + break; + } + case FrontendStatusType::IPTV_AVERAGE_JITTER_MS: { + status.set(5); + break; + } default: { continue; } diff --git a/tv/tuner/aidl/vts/functional/FrontendTests.cpp b/tv/tuner/aidl/vts/functional/FrontendTests.cpp index 2ff0c3d350..b0f614ed9b 100644 --- a/tv/tuner/aidl/vts/functional/FrontendTests.cpp +++ b/tv/tuner/aidl/vts/functional/FrontendTests.cpp @@ -434,6 +434,31 @@ void FrontendTests::verifyFrontendStatus(vector statusTypes, expectStatuses[i].get().begin())); break; } + case FrontendStatusType::IPTV_CONTENT_URL: { + ASSERT_TRUE(realStatuses[i].get() == + expectStatuses[i].get()); + break; + } + case FrontendStatusType::IPTV_PACKETS_LOST: { + ASSERT_TRUE(realStatuses[i].get() == + expectStatuses[i].get()); + break; + } + case FrontendStatusType::IPTV_PACKETS_RECEIVED: { + ASSERT_TRUE(realStatuses[i].get() == + expectStatuses[i].get()); + break; + } + case FrontendStatusType::IPTV_WORST_JITTER_MS: { + ASSERT_TRUE(realStatuses[i].get() == + expectStatuses[i].get()); + break; + } + case FrontendStatusType::IPTV_AVERAGE_JITTER_MS: { + ASSERT_TRUE(realStatuses[i].get() == + expectStatuses[i].get()); + break; + } default: { continue; } From 104353d88d0c1c4a0a6cd3b493056af99b08877d Mon Sep 17 00:00:00 2001 From: Yixiao Luo Date: Wed, 18 Jan 2023 16:31:56 -0800 Subject: [PATCH 613/998] Add test config files for VtsHalCasAidlTargetTest Bug: 227673974 Test: VtsHalCasAidlTargetTest Change-Id: I5051b389575e21779a709e7ab20a6aedb6c41e59 --- cas/aidl/TEST_MAPPING | 7 +++++++ cas/aidl/vts/AndroidTest.xml | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 cas/aidl/TEST_MAPPING create mode 100644 cas/aidl/vts/AndroidTest.xml diff --git a/cas/aidl/TEST_MAPPING b/cas/aidl/TEST_MAPPING new file mode 100644 index 0000000000..5bcd388788 --- /dev/null +++ b/cas/aidl/TEST_MAPPING @@ -0,0 +1,7 @@ +{ + "presubmit": [ + { + "name": "VtsHalCasAidlTargetTest" + } + ] +} diff --git a/cas/aidl/vts/AndroidTest.xml b/cas/aidl/vts/AndroidTest.xml new file mode 100644 index 0000000000..6e6af933bc --- /dev/null +++ b/cas/aidl/vts/AndroidTest.xml @@ -0,0 +1,33 @@ + + + + From 5ffba9ec3df750237b5e6af21e4650c94c8a43e1 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Thu, 19 Jan 2023 00:36:44 +0000 Subject: [PATCH 614/998] Revert "Add HAL changes for FORWARD_COLLISION_WARNING_STATE" Revert submission 20919248-ForwardCollisionWarningState Reason for revert: Build breakage Reverted changes: /q/submissionid:20919248-ForwardCollisionWarningState Change-Id: I8d0704948bb2dc61c0e1b4a220a97a834315bcf4 --- .../cpp/AccessForVehicleProperty.h | 1 - .../cpp/ChangeModeForVehicleProperty.h | 1 - .../java/AccessForVehicleProperty.java | 1 - .../java/ChangeModeForVehicleProperty.java | 1 - .../JsonConfigLoader/src/JsonConfigLoader.cpp | 3 -- .../config/DefaultProperties.json | 21 ---------- .../aidl/impl/default_config/config/README.md | 2 - .../utils/common/include/VehicleHalTypes.h | 1 - .../vehicle/ForwardCollisionWarningState.aidl | 40 ------------------ .../automotive/vehicle/VehicleProperty.aidl | 1 - .../vehicle/ForwardCollisionWarningState.aidl | 42 ------------------- .../automotive/vehicle/VehicleProperty.aidl | 19 --------- .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 --- 13 files changed, 139 deletions(-) delete mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl delete mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index aef5fe7af9..a6cb8617ea 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -240,7 +240,6 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, - {VehicleProperty::FORWARD_COLLISION_WARNING_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 4a5840478e..d3bf5f2514 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -240,7 +240,6 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, - {VehicleProperty::FORWARD_COLLISION_WARNING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index eec9daf7eb..1a1ce5eec4 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -232,7 +232,6 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), - Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 91c3637562..c8abc14487 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -232,7 +232,6 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), - Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index f39376bb80..a58d477981 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -41,7 +41,6 @@ using ::aidl::android::hardware::automotive::vehicle::ErrorState; using ::aidl::android::hardware::automotive::vehicle::EvConnectorType; using ::aidl::android::hardware::automotive::vehicle::EvsServiceState; using ::aidl::android::hardware::automotive::vehicle::EvsServiceType; -using ::aidl::android::hardware::automotive::vehicle::ForwardCollisionWarningState; using ::aidl::android::hardware::automotive::vehicle::FuelType; using ::aidl::android::hardware::automotive::vehicle::GsrComplianceRequirementType; using ::aidl::android::hardware::automotive::vehicle::RawPropValues; @@ -213,8 +212,6 @@ JsonValueParser::JsonValueParser() { mConstantParsersByType["ErrorState"] = std::make_unique>(); mConstantParsersByType["AutomaticEmergencyBrakingState"] = std::make_unique>(); - mConstantParsersByType["ForwardCollisionWarningState"] = - std::make_unique>(); mConstantParsersByType["Constants"] = std::make_unique(); } diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 50e242819c..080e6c0405 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3192,27 +3192,6 @@ ] } }, - { - "property": "VehicleProperty::FORWARD_COLLISION_WARNING_STATE", - "defaultValue": { - "int32Values": [ - "ForwardCollisionWarningState::NO_WARNING" - ] - }, - "areas": [ - { - "areaId": 0, - "supportedEnumValues": [ - "ErrorState::NOT_AVAILABLE_SAFETY", - "ErrorState::NOT_AVAILABLE_SPEED_HIGH", - "ErrorState::NOT_AVAILABLE_SPEED_LOW", - "ErrorState::NOT_AVAILABLE_DISABLED", - "ForwardCollisionWarningState::NO_WARNING", - "ForwardCollisionWarningState::WARNING" - ] - } - ] - }, { "property": "VehicleProperty::BLIND_SPOT_WARNING_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/default_config/config/README.md b/automotive/vehicle/aidl/impl/default_config/config/README.md index a5d8cdf1eb..1318d6dcb6 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/README.md +++ b/automotive/vehicle/aidl/impl/default_config/config/README.md @@ -143,8 +143,6 @@ We support the following constant types: * AutomaticEmergencyBrakingState -* ForwardCollisionWarningState - * ErrorState * Constants diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index 5a84d581a2..567ffe9ed5 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl deleted file mode 100644 index 371885d3b5..0000000000 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 -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.hardware.automotive.vehicle; -@Backing(type="int") @VintfStability -enum ForwardCollisionWarningState { - OTHER = 0, - NO_WARNING = 1, - WARNING = 2, -} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 1039347b28..4931ab174e 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -240,7 +240,6 @@ enum VehicleProperty { AUTOMATIC_EMERGENCY_BRAKING_ENABLED = 287313920, AUTOMATIC_EMERGENCY_BRAKING_STATE = 289411073, FORWARD_COLLISION_WARNING_ENABLED = 287313922, - FORWARD_COLLISION_WARNING_STATE = 289411075, BLIND_SPOT_WARNING_ENABLED = 287313924, LANE_DEPARTURE_WARNING_ENABLED = 287313926, LANE_KEEP_ASSIST_ENABLED = 287313928, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl deleted file mode 100644 index b20cf259d2..0000000000 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.hardware.automotive.vehicle; - -/** - * Used to enumerate the state of Forward Collision Warning State (FCW). - */ -@VintfStability -@Backing(type="int") -enum ForwardCollisionWarningState { - - /** - * This state is used as an alternative to any ForwardCollisionWarningState value that is not - * defined in the platform. Ideally, implementations of - * VehicleProperty#FORWARD_COLLISION_WARNING_STATE should not use this state. The framework - * can use this field to remain backwards compatible if ForwardCollisionWarningState is - * extended to include additional states. - */ - OTHER = 0, - /** - * FCW is enabled and monitoring safety, but no potential collision is detected. - */ - NO_WARNING = 1, - /** - * FCW is enabled, detects a potential collision, and is actively warning the user. - */ - WARNING = 2, -} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index ce152200da..28deaf67ca 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3479,25 +3479,6 @@ enum VehicleProperty { FORWARD_COLLISION_WARNING_ENABLED = 0x1002 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, - /** - * Forward Collision Warning (FCW) state. - * - * Returns the current state of FCW. This property must always return a valid state defined in - * ForwardCollisionWarningState or ErrorState. It must not surface errors through StatusCode - * and must use the supported error states instead. - * - * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined - * unless all states of both ForwardCollisionWarningState (including OTHER, which is not - * recommended) and ErrorState are supported. - * - * @change_mode VehiclePropertyChangeMode.ON_CHANGE - * @access VehiclePropertyAccess.READ - * @data_enum ForwardCollisionWarningState - * @data_enum ErrorState - */ - FORWARD_COLLISION_WARNING_STATE = - 0x1003 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, - /** * Enable and disable blind spot warning (BSW). * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 28b4dcf511..17edc1d721 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -696,12 +696,6 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyForwardCollisionWarningEnabledCo VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } -TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyForwardCollisionWarningStateConfig) { - verifyProperty(VehicleProperty::FORWARD_COLLISION_WARNING_STATE, VehiclePropertyAccess::READ, - VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, - VehicleArea::GLOBAL, VehiclePropertyType::INT32); -} - TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyBlindSpotWarningEnabledConfig) { verifyProperty(VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From d9ab9aa59f04cdccb7f71e8ca3819e15039d394b Mon Sep 17 00:00:00 2001 From: Sarah Chin Date: Wed, 18 Jan 2023 18:28:03 -0800 Subject: [PATCH 615/998] Fix setupDataCall tests for osAppid Test: atest VtsHalRadioTargetTest Bug: 265830733 Change-Id: I1b342bb7a829585607db4518bf4017e28b6db84f --- radio/aidl/vts/radio_data_test.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/radio/aidl/vts/radio_data_test.cpp b/radio/aidl/vts/radio_data_test.cpp index f38a958896..1cc6a36a26 100644 --- a/radio/aidl/vts/radio_data_test.cpp +++ b/radio/aidl/vts/radio_data_test.cpp @@ -143,9 +143,20 @@ TEST_P(RadioDataTest, setupDataCall_osAppId) { TrafficDescriptor trafficDescriptor; OsAppId osAppId; - std::string osAppIdString("osAppId"); - std::vector osAppIdVec(osAppIdString.begin(), osAppIdString.end()); - osAppId.osAppId = osAppIdVec; + osAppId.osAppId = {static_cast(-105), static_cast(-92), + static_cast(-104), static_cast(-29), + static_cast(-4), static_cast(-110), + static_cast(92), static_cast(-108), + static_cast(-119), static_cast(-122), + static_cast(3), static_cast(51), + static_cast(-48), static_cast(110), + static_cast(78), static_cast(71), + static_cast(10), static_cast(69), + static_cast(78), static_cast(84), + static_cast(69), static_cast(82), + static_cast(80), static_cast(82), + static_cast(73), static_cast(83), + static_cast(69)}; trafficDescriptor.osAppId = osAppId; DataProfileInfo dataProfileInfo; From 121b6d6b543dc4afee4390b164ec291b65b5fac7 Mon Sep 17 00:00:00 2001 From: Matthew Sedam Date: Thu, 19 Jan 2023 19:04:53 +0000 Subject: [PATCH 616/998] Use GTEST_SKIP when a function is not supported on older HAL versions Bug: 258074235 Test: atest VtsAidlHalContextHubTargetTest Change-Id: Ibf25b63d4f5a6a822318a131ebfacbf2fb5d622c --- .../vts/VtsAidlHalContextHubTargetTest.cpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp index f7ff73d477..228a5698d1 100644 --- a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp +++ b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp @@ -88,20 +88,20 @@ TEST_P(ContextHubAidl, TestEnableTestMode) { Status status = contextHub->setTestMode(true); if (status.exceptionCode() == Status::EX_UNSUPPORTED_OPERATION || status.transactionError() == android::UNKNOWN_TRANSACTION) { - return; // not supported -> old API; or not implemented + GTEST_SKIP() << "Not supported -> old API; or not implemented"; + } else { + ASSERT_TRUE(status.isOk()); } - - ASSERT_TRUE(status.isOk()); } TEST_P(ContextHubAidl, TestDisableTestMode) { Status status = contextHub->setTestMode(false); if (status.exceptionCode() == Status::EX_UNSUPPORTED_OPERATION || status.transactionError() == android::UNKNOWN_TRANSACTION) { - return; // not supported -> old API; or not implemented + GTEST_SKIP() << "Not supported -> old API; or not implemented"; + } else { + ASSERT_TRUE(status.isOk()); } - - ASSERT_TRUE(status.isOk()); } class EmptyContextHubCallback : public android::hardware::contexthub::BnContextHubCallback { @@ -186,11 +186,11 @@ TEST_P(ContextHubAidl, TestGetPreloadedNanoapps) { Status status = contextHub->getPreloadedNanoappIds(&preloadedNanoappIds); if (status.exceptionCode() == Status::EX_UNSUPPORTED_OPERATION || status.transactionError() == android::UNKNOWN_TRANSACTION) { - return; // not supported -> old API; or not implemented + GTEST_SKIP() << "Not supported -> old API; or not implemented"; + } else { + ASSERT_TRUE(status.isOk()); + ASSERT_FALSE(preloadedNanoappIds.empty()); } - - ASSERT_TRUE(status.isOk()); - ASSERT_FALSE(preloadedNanoappIds.empty()); } // Helper callback that puts the TransactionResult for the expectedTransactionId into a From 88126cde83d2a508398745c34791a9c03ddd5990 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Thu, 19 Jan 2023 19:12:22 +0000 Subject: [PATCH 617/998] Fix NAN-related VTS tests. NAN is not supported by Cuttlefish, so check for Aware support before running any related tests. Also fix the incorrect function call in CreateP2pIface. Bug: 263762326 Test: atest VtsHalWifiChipTargetTest (tested on Cuttlefish and Bluejay) Change-Id: I3ec52fcc18aedad157dbc17d19078dde216261fb --- wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp index 0806ed289d..fec9122e07 100644 --- a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp +++ b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp @@ -583,6 +583,9 @@ TEST_P(WifiChipAidlTest, CreateApIface) { * CreateNanIface */ TEST_P(WifiChipAidlTest, CreateNanIface) { + if (!::testing::deviceSupportsFeature("android.hardware.wifi.aware")) { + GTEST_SKIP() << "Skipping this test since NAN is not supported."; + } configureChipForNanAndGetIface(); } @@ -590,7 +593,7 @@ TEST_P(WifiChipAidlTest, CreateNanIface) { * CreateP2pIface */ TEST_P(WifiChipAidlTest, CreateP2pIface) { - configureChipForNanAndGetIface(); + configureChipForP2pAndGetIface(); } /* @@ -672,6 +675,9 @@ TEST_P(WifiChipAidlTest, GetApIfaceNames) { * GetNanIfaceNames */ TEST_P(WifiChipAidlTest, GetNanIfaceNames) { + if (!::testing::deviceSupportsFeature("android.hardware.wifi.aware")) { + GTEST_SKIP() << "Skipping this test since NAN is not supported."; + } configureChipForConcurrencyType(IfaceConcurrencyType::NAN_IFACE); std::vector iface_names; @@ -753,6 +759,9 @@ TEST_P(WifiChipAidlTest, GetApIface) { * GetNanIface */ TEST_P(WifiChipAidlTest, GetNanIface) { + if (!::testing::deviceSupportsFeature("android.hardware.wifi.aware")) { + GTEST_SKIP() << "Skipping this test since NAN is not supported."; + } std::shared_ptr iface = configureChipForNanAndGetIface(); std::string iface_name = getNanIfaceName(iface); @@ -822,6 +831,9 @@ TEST_P(WifiChipAidlTest, RemoveApIface) { * RemoveNanIface */ TEST_P(WifiChipAidlTest, RemoveNanIface) { + if (!::testing::deviceSupportsFeature("android.hardware.wifi.aware")) { + GTEST_SKIP() << "Skipping this test since NAN is not supported."; + } std::shared_ptr iface = configureChipForNanAndGetIface(); std::string iface_name = getNanIfaceName(iface); From 90c9cac2f78cd830360e405d68bb89b4fd03e646 Mon Sep 17 00:00:00 2001 From: Yixiao Luo Date: Wed, 18 Jan 2023 16:05:05 -0800 Subject: [PATCH 618/998] Add test config files for VtsHalTvInputTargetTest Bug: 227673740 Test: VtsHalTvInputTargetTest Change-Id: Id1b98c5075e66a2341652140871f6c11c337c588 --- tv/input/aidl/TEST_MAPPING | 7 +++++ tv/input/aidl/vts/functional/AndroidTest.xml | 33 ++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 tv/input/aidl/TEST_MAPPING create mode 100644 tv/input/aidl/vts/functional/AndroidTest.xml diff --git a/tv/input/aidl/TEST_MAPPING b/tv/input/aidl/TEST_MAPPING new file mode 100644 index 0000000000..981e46fd35 --- /dev/null +++ b/tv/input/aidl/TEST_MAPPING @@ -0,0 +1,7 @@ +{ + "presubmit": [ + { + "name": "VtsHalTvInputTargetTest" + } + ] +} diff --git a/tv/input/aidl/vts/functional/AndroidTest.xml b/tv/input/aidl/vts/functional/AndroidTest.xml new file mode 100644 index 0000000000..5549102a8b --- /dev/null +++ b/tv/input/aidl/vts/functional/AndroidTest.xml @@ -0,0 +1,33 @@ + + + + From 7793baab6738afcd9c5b7778f5ffa9ad5f2d7ec8 Mon Sep 17 00:00:00 2001 From: Changyeon Jo Date: Thu, 19 Jan 2023 13:18:47 -0800 Subject: [PATCH 619/998] Explicitly close the EVS display A test case closes the EVS display explicitly to make sure an associated EGL surface is destoryed before running a next test case. Fix: 266098494 Test: atest VtsHalEvsTargetTest Change-Id: I4079242884ed436bca95c983b3e4475f2cef1464 --- automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp b/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp index 3cab204aec..2706c499ba 100644 --- a/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp +++ b/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp @@ -619,6 +619,7 @@ TEST_P(EvsAidlTest, CameraToDisplayRoundTrip) { getPhysicalCameraIds(cam.id, isLogicalCam); if (mIsHwModule && isLogicalCam) { LOG(INFO) << "Skip a logical device " << cam.id << " for HW target."; + ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk()); continue; } @@ -1437,7 +1438,8 @@ TEST_P(EvsAidlTest, HighPriorityCameraClient) { ASSERT_TRUE(pCam1->getParameterList(&cam1Cmds).isOk()); if (cam0Cmds.size() < 1 || cam1Cmds.size() < 1) { // Cannot execute this test. - return; + ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk()); + continue; } // Set up a frame receiver object which will fire up its own thread. From c2c392fbea425bb1bbaf09314ef50eec1ab4035d Mon Sep 17 00:00:00 2001 From: Sally Qi Date: Fri, 13 Jan 2023 14:50:20 -0800 Subject: [PATCH 620/998] [Aidl graphics API] split dataspace array into tuples. - update VTS test to make sure primaries/transfers/ranges bits are correct. Bug: 242588489 Test: build and flash; atest VtsHalGraphicsComposer3_TargetTest Change-Id: I77536d97b98e4dead208b7c8aeed9cfbb0d82316 --- .../graphics/composer3/OverlayProperties.aidl | 4 +++- .../graphics/composer3/OverlayProperties.aidl | 22 +++++++++++++------ .../VtsHalGraphicsComposer3_TargetTest.cpp | 19 +++++++++++++++- 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl index 3db134e3fe..7d31ea3b1e 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl @@ -38,6 +38,8 @@ parcelable OverlayProperties { boolean supportMixedColorSpaces; parcelable SupportedBufferCombinations { android.hardware.graphics.common.PixelFormat[] pixelFormats; - android.hardware.graphics.common.Dataspace[] dataspaces; + android.hardware.graphics.common.Dataspace[] standards; + android.hardware.graphics.common.Dataspace[] transfers; + android.hardware.graphics.common.Dataspace[] ranges; } } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl index 32688e2530..c25eea484f 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl @@ -19,16 +19,24 @@ package android.hardware.graphics.composer3; @VintfStability parcelable OverlayProperties { parcelable SupportedBufferCombinations { - // List of pixelformats and dataspaces that can be used together. - // All pixelformats and dataspaces stored inside are valid combinations. + // List of pixelformats, standards, transfers and ranges dataspaces that can be used + // together. + // The pixelformats, standards, transfers and ranges stored inside are valid + // combinations. + // Dataspace identifies three components of colors - standard, transfer and + // range. android.hardware.graphics.common.PixelFormat[] pixelFormats; - android.hardware.graphics.common.Dataspace[] dataspaces; + android.hardware.graphics.common.Dataspace[] standards; + android.hardware.graphics.common.Dataspace[] transfers; + android.hardware.graphics.common.Dataspace[] ranges; } - // Array of all valid pixelformat and dataspace combinations. - // If all supported formats work with all supported dataspaces, + // Array of all valid pixelformat, standard, transfer and range combinations. + // If all supported formats work with all standards, transfers and ranges, // then this list may only have 1 entry. - // If some dataspaces, e.g. scRGB, only work with specific formats, - // then this list may contain more than 1 entry. + // If some dataspaces, e.g. scRGB (STANDARD_BT709 | TRANSFER_SRGB | RANGE_EXTENDED), + // only work with specific formats, then this list may contain more than 1 entry. + // If some ranges, e.g. RANGE_LIMITED, only work with specific + // formats/standards/transfers, then this list may contain more than 1 entry. SupportedBufferCombinations[] combinations; // True if the DPU is able to color manage at least two overlays diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 7b852e029d..15128ca649 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -812,7 +812,7 @@ TEST_P(GraphicsComposerAidlTest, GetDisplayName) { } TEST_P(GraphicsComposerAidlTest, GetOverlaySupport) { - const auto& [status, _] = mComposerClient->getOverlaySupport(); + const auto& [status, properties] = mComposerClient->getOverlaySupport(); if (!status.isOk() && status.getExceptionCode() == EX_SERVICE_SPECIFIC && status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) { GTEST_SUCCEED() << "getOverlaySupport is not supported"; @@ -820,6 +820,23 @@ TEST_P(GraphicsComposerAidlTest, GetOverlaySupport) { } ASSERT_TRUE(status.isOk()); + for (const auto& i : properties.combinations) { + for (const auto standard : i.standards) { + const auto val = static_cast(standard) & + static_cast(common::Dataspace::STANDARD_MASK); + ASSERT_TRUE(val == static_cast(standard)); + } + for (const auto transfer : i.transfers) { + const auto val = static_cast(transfer) & + static_cast(common::Dataspace::TRANSFER_MASK); + ASSERT_TRUE(val == static_cast(transfer)); + } + for (const auto range : i.ranges) { + const auto val = static_cast(range) & + static_cast(common::Dataspace::RANGE_MASK); + ASSERT_TRUE(val == static_cast(range)); + } + } } TEST_P(GraphicsComposerAidlTest, GetDisplayPhysicalOrientation_BadDisplay) { From f69fbd96162f6ec9dd47bea88aec647b9432aea0 Mon Sep 17 00:00:00 2001 From: Helen Date: Fri, 14 Oct 2022 02:59:40 +0000 Subject: [PATCH 621/998] [AOSP IMS] Change anbrBitrate to anbrMode Bug: 250506481 Test: Build Change-Id: I448e601c1fa5db4b9d0e04a8419e6dd0a2a11b1e --- .../hardware/radio/ims/media/AnbrMode.aidl | 39 +++++++++++++++++++ .../{AnbrBitrate.aidl => CodecMode.aidl} | 10 ++--- .../hardware/radio/ims/media/RtpConfig.aidl | 2 +- .../hardware/radio/ims/media/AnbrMode.aidl | 34 ++++++++++++++++ .../{AnbrBitrate.aidl => CodecMode.aidl} | 19 +++++---- .../hardware/radio/ims/media/RtpConfig.aidl | 11 +++--- 6 files changed, 96 insertions(+), 19 deletions(-) create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrMode.aidl rename radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/{AnbrBitrate.aidl => CodecMode.aidl} (90%) create mode 100644 radio/aidl/android/hardware/radio/ims/media/AnbrMode.aidl rename radio/aidl/android/hardware/radio/ims/media/{AnbrBitrate.aidl => CodecMode.aidl} (63%) diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrMode.aidl new file mode 100644 index 0000000000..c108c07033 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrMode.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims.media; +@JavaDerive(toString=true) @VintfStability +parcelable AnbrMode { + android.hardware.radio.ims.media.CodecMode anbrUplinkMode; + android.hardware.radio.ims.media.CodecMode anbrDownlinkMode; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecMode.aidl similarity index 90% rename from radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl rename to radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecMode.aidl index e1fb376f11..0e9140f023 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecMode.aidl @@ -32,9 +32,9 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; -@VintfStability -parcelable AnbrBitrate { - int uplinkBps; - int downlinkBps; - const int INVALID_ANBR_BITRATE = (-1); +@JavaDerive(toString=true) @VintfStability +union CodecMode { + boolean noinit; + android.hardware.radio.ims.media.AmrMode amr; + android.hardware.radio.ims.media.EvsMode evs; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl index ad8b86ccd5..1a8921e2dc 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl @@ -39,5 +39,5 @@ parcelable RtpConfig { android.hardware.radio.ims.media.RtpAddress remoteAddress; android.hardware.radio.ims.media.RtpSessionParams sessionParams; android.hardware.radio.ims.media.RtcpConfig rtcpConfig; - android.hardware.radio.ims.media.AnbrBitrate anbrBitrateParams; + android.hardware.radio.ims.media.AnbrMode anbrModeParams; } diff --git a/radio/aidl/android/hardware/radio/ims/media/AnbrMode.aidl b/radio/aidl/android/hardware/radio/ims/media/AnbrMode.aidl new file mode 100644 index 0000000000..f758cd47cc --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/AnbrMode.aidl @@ -0,0 +1,34 @@ +/* + * 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. + */ + +package android.hardware.radio.ims.media; + +import android.hardware.radio.ims.media.CodecMode; + +@VintfStability +@JavaDerive(toString=true) +parcelable AnbrMode { + /** + * Codec mode converted from bitrate received for uplink + * from network or peer UE for ANBR + */ + CodecMode anbrUplinkMode; + /** + * Codec mode converted from bitrate received for downlink + * from network or peer UE for ANBR + */ + CodecMode anbrDownlinkMode; +} diff --git a/radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl b/radio/aidl/android/hardware/radio/ims/media/CodecMode.aidl similarity index 63% rename from radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl rename to radio/aidl/android/hardware/radio/ims/media/CodecMode.aidl index 61239d0b73..aa1b3a4cf1 100644 --- a/radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/CodecMode.aidl @@ -16,13 +16,16 @@ package android.hardware.radio.ims.media; -@VintfStability -parcelable AnbrBitrate { - /** default value to represent NOT_SET */ - const int INVALID_ANBR_BITRATE = -1; +import android.hardware.radio.ims.media.AmrMode; +import android.hardware.radio.ims.media.EvsMode; - /** Received bitrate in seconds for Uplink from NW or peer UE for ANBR */ - int uplinkBps; - /** Received bitrate in secondsfor Downlink from NW or peer UE for ANBR */ - int downlinkBps; +@VintfStability +@JavaDerive(toString=true) +union CodecMode { + /** Default value */ + boolean noinit; + /** AMR codec mode to represent the bit rate. See 3ggp Specs 26.976 & 26.071 */ + AmrMode amr; + /** EVS codec mode to represent the bit rate. See 3ggp Spec 26.952 Table 5.1 */ + EvsMode evs; } diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl index d0d849ed5a..f6696f782b 100644 --- a/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl @@ -17,7 +17,7 @@ package android.hardware.radio.ims.media; import android.hardware.radio.AccessNetwork; -import android.hardware.radio.ims.media.AnbrBitrate; +import android.hardware.radio.ims.media.AnbrMode; import android.hardware.radio.ims.media.MediaDirection; import android.hardware.radio.ims.media.RtcpConfig; import android.hardware.radio.ims.media.RtpAddress; @@ -36,13 +36,14 @@ parcelable RtpConfig { /** RTCP configuration */ RtcpConfig rtcpConfig; /** - * ANBR Bitrate parameters. This is set to valid only when its triggered, + * ANBR Mode parameters. This is set to valid only when its triggered, * otherwise it shall be set to NULL. * * This would be used in the following two cases * - IImsMediaSession#modifySession(RtpConfig) - When RAN wants to change the bit - * rate via ANBR MAC layer signaling, ImsStack would set the values and direction - * and pass it in the modifySession(). The underlying RTP stack shall adapt to + * rate via ANBR MAC layer signaling, ImsStack converts the received bitrate + * to the codec mode appropriately and passes the codec mode and direction + * using modifySession(). The underlying RTP stack shall adapt to * the changed bitrate. * * - IImsMediaSessionListener#triggerAnbrQuery(RtpConfig) - When the vendor RTP @@ -50,5 +51,5 @@ parcelable RtpConfig { * RTCP-APP or TMMBR, it triggers ANBRQ by setting the desired bitrate and the * direction of the stream. */ - AnbrBitrate anbrBitrateParams; + AnbrMode anbrModeParams; } From 0a1ab29d5ffa391070036012e888af20ee116feb Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Thu, 19 Jan 2023 21:33:56 +0000 Subject: [PATCH 622/998] Revert^2 "Add HAL changes for FORWARD_COLLISION_WARNING_STATE" 5ffba9ec3df750237b5e6af21e4650c94c8a43e1 Change-Id: If381249e155e450e47240301c263bcd1538ec071 --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../JsonConfigLoader/src/JsonConfigLoader.cpp | 3 ++ .../config/DefaultProperties.json | 21 ++++++++++ .../aidl/impl/default_config/config/README.md | 2 + .../utils/common/include/VehicleHalTypes.h | 1 + .../vehicle/ForwardCollisionWarningState.aidl | 40 ++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../vehicle/ForwardCollisionWarningState.aidl | 42 +++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 19 +++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 +++ 13 files changed, 139 insertions(+) create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl create mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index a6cb8617ea..aef5fe7af9 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -240,6 +240,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::FORWARD_COLLISION_WARNING_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index d3bf5f2514..4a5840478e 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -240,6 +240,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::FORWARD_COLLISION_WARNING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 1a1ce5eec4..eec9daf7eb 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -232,6 +232,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index c8abc14487..91c3637562 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -232,6 +232,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index a58d477981..f39376bb80 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -41,6 +41,7 @@ using ::aidl::android::hardware::automotive::vehicle::ErrorState; using ::aidl::android::hardware::automotive::vehicle::EvConnectorType; using ::aidl::android::hardware::automotive::vehicle::EvsServiceState; using ::aidl::android::hardware::automotive::vehicle::EvsServiceType; +using ::aidl::android::hardware::automotive::vehicle::ForwardCollisionWarningState; using ::aidl::android::hardware::automotive::vehicle::FuelType; using ::aidl::android::hardware::automotive::vehicle::GsrComplianceRequirementType; using ::aidl::android::hardware::automotive::vehicle::RawPropValues; @@ -212,6 +213,8 @@ JsonValueParser::JsonValueParser() { mConstantParsersByType["ErrorState"] = std::make_unique>(); mConstantParsersByType["AutomaticEmergencyBrakingState"] = std::make_unique>(); + mConstantParsersByType["ForwardCollisionWarningState"] = + std::make_unique>(); mConstantParsersByType["Constants"] = std::make_unique(); } diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 080e6c0405..50e242819c 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3192,6 +3192,27 @@ ] } }, + { + "property": "VehicleProperty::FORWARD_COLLISION_WARNING_STATE", + "defaultValue": { + "int32Values": [ + "ForwardCollisionWarningState::NO_WARNING" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "ErrorState::NOT_AVAILABLE_SAFETY", + "ErrorState::NOT_AVAILABLE_SPEED_HIGH", + "ErrorState::NOT_AVAILABLE_SPEED_LOW", + "ErrorState::NOT_AVAILABLE_DISABLED", + "ForwardCollisionWarningState::NO_WARNING", + "ForwardCollisionWarningState::WARNING" + ] + } + ] + }, { "property": "VehicleProperty::BLIND_SPOT_WARNING_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/default_config/config/README.md b/automotive/vehicle/aidl/impl/default_config/config/README.md index 1318d6dcb6..a5d8cdf1eb 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/README.md +++ b/automotive/vehicle/aidl/impl/default_config/config/README.md @@ -143,6 +143,8 @@ We support the following constant types: * AutomaticEmergencyBrakingState +* ForwardCollisionWarningState + * ErrorState * Constants diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index 567ffe9ed5..5a84d581a2 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl new file mode 100644 index 0000000000..371885d3b5 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum ForwardCollisionWarningState { + OTHER = 0, + NO_WARNING = 1, + WARNING = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 4931ab174e..1039347b28 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -240,6 +240,7 @@ enum VehicleProperty { AUTOMATIC_EMERGENCY_BRAKING_ENABLED = 287313920, AUTOMATIC_EMERGENCY_BRAKING_STATE = 289411073, FORWARD_COLLISION_WARNING_ENABLED = 287313922, + FORWARD_COLLISION_WARNING_STATE = 289411075, BLIND_SPOT_WARNING_ENABLED = 287313924, LANE_DEPARTURE_WARNING_ENABLED = 287313926, LANE_KEEP_ASSIST_ENABLED = 287313928, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl new file mode 100644 index 0000000000..b20cf259d2 --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ForwardCollisionWarningState.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. + */ + +package android.hardware.automotive.vehicle; + +/** + * Used to enumerate the state of Forward Collision Warning State (FCW). + */ +@VintfStability +@Backing(type="int") +enum ForwardCollisionWarningState { + + /** + * This state is used as an alternative to any ForwardCollisionWarningState value that is not + * defined in the platform. Ideally, implementations of + * VehicleProperty#FORWARD_COLLISION_WARNING_STATE should not use this state. The framework + * can use this field to remain backwards compatible if ForwardCollisionWarningState is + * extended to include additional states. + */ + OTHER = 0, + /** + * FCW is enabled and monitoring safety, but no potential collision is detected. + */ + NO_WARNING = 1, + /** + * FCW is enabled, detects a potential collision, and is actively warning the user. + */ + WARNING = 2, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 28deaf67ca..ce152200da 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3479,6 +3479,25 @@ enum VehicleProperty { FORWARD_COLLISION_WARNING_ENABLED = 0x1002 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Forward Collision Warning (FCW) state. + * + * Returns the current state of FCW. This property must always return a valid state defined in + * ForwardCollisionWarningState or ErrorState. It must not surface errors through StatusCode + * and must use the supported error states instead. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of both ForwardCollisionWarningState (including OTHER, which is not + * recommended) and ErrorState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum ForwardCollisionWarningState + * @data_enum ErrorState + */ + FORWARD_COLLISION_WARNING_STATE = + 0x1003 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** * Enable and disable blind spot warning (BSW). * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 17edc1d721..28b4dcf511 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -696,6 +696,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyForwardCollisionWarningEnabledCo VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyForwardCollisionWarningStateConfig) { + verifyProperty(VehicleProperty::FORWARD_COLLISION_WARNING_STATE, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyBlindSpotWarningEnabledConfig) { verifyProperty(VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From 07ce759994d7967b521fe44d1dbd6b2bc8d8b8d1 Mon Sep 17 00:00:00 2001 From: RD Babiera Date: Mon, 23 Jan 2023 05:35:43 +0000 Subject: [PATCH 623/998] Add hpd and link training status to AltModeData Adds DisplayPort hpd and link training attributes within DisplayPortAltModeData in USB HAL layer to more accurately populate frameworks API fields. Within DisplayPortAltModeData are new fields hpd and linkTrainingStatus. Test: atest VtsAidlUsbTargetTest Bug: 253534975 Change-Id: I3eb4b1527f457ba63bf127fbb14bd583ef6caf2f --- .../android/hardware/usb/AltModeData.aidl | 2 + .../hardware/usb/LinkTrainingStatus.aidl | 40 +++++++++++++++++ .../android/hardware/usb/AltModeData.aidl | 13 ++++++ .../hardware/usb/LinkTrainingStatus.aidl | 43 +++++++++++++++++++ usb/aidl/vts/VtsAidlUsbTargetTest.cpp | 5 +++ 5 files changed, 103 insertions(+) create mode 100644 usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/LinkTrainingStatus.aidl create mode 100644 usb/aidl/android/hardware/usb/LinkTrainingStatus.aidl diff --git a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/AltModeData.aidl b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/AltModeData.aidl index 8e9dd00c02..d25ee84151 100644 --- a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/AltModeData.aidl +++ b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/AltModeData.aidl @@ -40,5 +40,7 @@ union AltModeData { android.hardware.usb.DisplayPortAltModeStatus partnerSinkStatus = android.hardware.usb.DisplayPortAltModeStatus.UNKNOWN; android.hardware.usb.DisplayPortAltModeStatus cableStatus = android.hardware.usb.DisplayPortAltModeStatus.UNKNOWN; android.hardware.usb.DisplayPortAltModePinAssignment pinAssignment = android.hardware.usb.DisplayPortAltModePinAssignment.NONE; + boolean hpd = false; + android.hardware.usb.LinkTrainingStatus linkTrainingStatus = android.hardware.usb.LinkTrainingStatus.UNKNOWN; } } diff --git a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/LinkTrainingStatus.aidl b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/LinkTrainingStatus.aidl new file mode 100644 index 0000000000..1f0b2dcca7 --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/LinkTrainingStatus.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.usb; +@Backing(type="int") @VintfStability +enum LinkTrainingStatus { + UNKNOWN = 0, + SUCCESS = 1, + FAILURE = 2, +} diff --git a/usb/aidl/android/hardware/usb/AltModeData.aidl b/usb/aidl/android/hardware/usb/AltModeData.aidl index e103ff933e..0b1e06a878 100644 --- a/usb/aidl/android/hardware/usb/AltModeData.aidl +++ b/usb/aidl/android/hardware/usb/AltModeData.aidl @@ -18,6 +18,7 @@ package android.hardware.usb; import android.hardware.usb.DisplayPortAltModePinAssignment; import android.hardware.usb.DisplayPortAltModeStatus; +import android.hardware.usb.LinkTrainingStatus; @VintfStability union AltModeData { @@ -42,6 +43,18 @@ union AltModeData { * negotiated between the device, port partner, and cable. */ DisplayPortAltModePinAssignment pinAssignment = DisplayPortAltModePinAssignment.NONE; + /** + * Indicates DisplayPort Hot Plug Detection (HPD) status for a partner + * sink device. If true, then a DisplayPort Alt Mode partner sink is + * connected and powered on, and if false, the partner sink is not + * powered or no partner sink is connected. + */ + boolean hpd = false; + /** + * Indicates the current status of DisplayPort link training over USB-C + * for the attached DisplayPort Alt Mode partner sink. + */ + LinkTrainingStatus linkTrainingStatus = LinkTrainingStatus.UNKNOWN; } DisplayPortAltModeData displayPortAltModeData; } diff --git a/usb/aidl/android/hardware/usb/LinkTrainingStatus.aidl b/usb/aidl/android/hardware/usb/LinkTrainingStatus.aidl new file mode 100644 index 0000000000..9f3b3c3a22 --- /dev/null +++ b/usb/aidl/android/hardware/usb/LinkTrainingStatus.aidl @@ -0,0 +1,43 @@ +/* + * 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.hardware.usb; + +@VintfStability +@Backing(type="int") +/** + * Indicates the current status of DisplayPort link training over USB-C for the + * attached DisplayPort Alt Mode partner sink as described in DisplayPort + * v1.4/2.1. + */ +enum LinkTrainingStatus { + /* + * Indicates the link training result is not available because link training + * has not completed or initiated yet. + */ + UNKNOWN = 0, + /* + * Indicates that link training has completed and optimal settings for data + * transmission between the sink and source device have successfully been + * negotiated. + */ + SUCCESS = 1, + /* + * Indicates that link training has failed and the link initialization has + * terminated. + */ + FAILURE = 2, +} diff --git a/usb/aidl/vts/VtsAidlUsbTargetTest.cpp b/usb/aidl/vts/VtsAidlUsbTargetTest.cpp index 480c826cce..e9aa65bc8d 100644 --- a/usb/aidl/vts/VtsAidlUsbTargetTest.cpp +++ b/usb/aidl/vts/VtsAidlUsbTargetTest.cpp @@ -49,6 +49,7 @@ using ::aidl::android::hardware::usb::DisplayPortAltModePinAssignment; using ::aidl::android::hardware::usb::DisplayPortAltModeStatus; using ::aidl::android::hardware::usb::IUsb; using ::aidl::android::hardware::usb::IUsbCallback; +using ::aidl::android::hardware::usb::LinkTrainingStatus; using ::aidl::android::hardware::usb::PlugOrientation; using ::aidl::android::hardware::usb::PortDataRole; using ::aidl::android::hardware::usb::PortMode; @@ -724,6 +725,10 @@ TEST_P(UsbAidlTest, dpAltModeValues) { (int)DisplayPortAltModePinAssignment::NONE); EXPECT_TRUE((int)displayPortAltModeData.pinAssignment <= (int)DisplayPortAltModePinAssignment::F); + + EXPECT_TRUE((int)displayPortAltModeData.linkTrainingStatus >= + (int)LinkTrainingStatus::UNKNOWN); + EXPECT_TRUE((int)displayPortAltModeData.pinAssignment <= (int)LinkTrainingStatus::FAILURE); } } From 50074e29ff0b58ee6ab8111fd57373ecf91b2aab Mon Sep 17 00:00:00 2001 From: Philip Chen Date: Tue, 27 Dec 2022 14:35:54 -0800 Subject: [PATCH 624/998] Move canhalconfigurator-aidl to /system_ext Let's move canhalconfigurator-aidl from the system partition to the system_ext partition to share a common system image across internal AAOS builds. Bug: 263516803 Test: build and confirm the files are relocated Change-Id: I54a65f49daff1ff4730056bc83b7dc57c836509d --- automotive/can/aidl/default/tools/configurator/Android.bp | 1 + .../aidl/default/tools/configurator/canhalconfigurator-aidl.rc | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/automotive/can/aidl/default/tools/configurator/Android.bp b/automotive/can/aidl/default/tools/configurator/Android.bp index 1169894a28..4c569e6db3 100644 --- a/automotive/can/aidl/default/tools/configurator/Android.bp +++ b/automotive/can/aidl/default/tools/configurator/Android.bp @@ -40,4 +40,5 @@ cc_binary { "android.hardware.automotive.can-V1-ndk", "android.hardware.automotive.can-aidl-config-format", ], + system_ext_specific: true, } diff --git a/automotive/can/aidl/default/tools/configurator/canhalconfigurator-aidl.rc b/automotive/can/aidl/default/tools/configurator/canhalconfigurator-aidl.rc index e1b4d3548a..08b1e7b187 100644 --- a/automotive/can/aidl/default/tools/configurator/canhalconfigurator-aidl.rc +++ b/automotive/can/aidl/default/tools/configurator/canhalconfigurator-aidl.rc @@ -1,3 +1,3 @@ -service canhalconfigurator /system/bin/canhalconfigurator-aidl +service canhalconfigurator /system_ext/bin/canhalconfigurator-aidl class core oneshot From ae119c5198b4140697661e654fb442990e4ab413 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Tue, 10 Jan 2023 16:17:12 -0800 Subject: [PATCH 625/998] Update ADAS ENABLED properties documentation if property unavailable An implementation of AUTOMATIC_EMERGENCY_BRAKING_ENABLED or FORWARD_COLLISION_WARNING_ENABLED should return false when there's an issue with the ADAS system and it cannot retrieve the property. It should not return NOT_AVAILABLE. Bug: 264946034 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: Ieddbcdf766543cfb94cb5b295b22ac4369641c81 --- .../hardware/automotive/vehicle/VehicleProperty.aidl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index ce152200da..446a9fa4c3 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3429,9 +3429,9 @@ enum VehicleProperty { * Set true to enable AEB and false to disable AEB. When AEB is enabled, the ADAS system in the * vehicle should be turned on and monitoring to avoid potential collisions. * - * IVehicle#get must not return any NOT_AVAILABLE value in StatusCode. Other StatusCode values - * like TRY_AGAIN may still be used as needed. For example, if AEB is not available because the - * vehicle speed is too low, IVehicle#get must return false. + * If AEB is not available, IVehicle#get must not return any NOT_AVAILABLE value in StatusCode. + * Other StatusCode values like TRY_AGAIN may still be used as needed. For example, if AEB is + * not available because the vehicle speed is too low, IVehicle#get must return false. * * This property is defined as read_write, but OEMs have the option to implement it as read * only. @@ -3470,6 +3470,10 @@ enum VehicleProperty { * Set true to enable FCW and false to disable FCW. When FCW is enabled, the ADAS system in the * vehicle should be turned on and monitoring for potential collisions. * + * If FCW is not available, IVehicle#get must not return any NOT_AVAILABLE value in StatusCode. + * Other StatusCode values like TRY_AGAIN may still be used as needed. For example, if FCW is + * not available because the vehicle speed is too low, IVehicle#get must return false. + * * This property is defined as read_write, but OEMs have the option to implement it as read * only. * From be7cea7bc3de884e5cf966e344aa2363187b5146 Mon Sep 17 00:00:00 2001 From: Eva Chen Date: Mon, 23 Jan 2023 15:58:20 -0800 Subject: [PATCH 626/998] Update automotive generated aidl files. Bug: 263294718 Test: atest VtsHalAutomotiveVehicle_TargetTest Test: atest CtsCarTestCases:CarPropertyManagerTest Test: atest CtsCarTestCases:VehiclePropertyIdsTest Change-Id: I5fc5bfa32e1ec7db20d75b36a4dbcbb08d65a048 --- .../automotive/vehicle/VehiclePropertyAccess.aidl | 8 ++++---- .../automotive/vehicle/VehiclePropertyChangeMode.aidl | 6 +++--- .../automotive/vehicle/VehiclePropertyStatus.aidl | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyAccess.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyAccess.aidl index ec9587f60c..dde9a88fd3 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyAccess.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyAccess.aidl @@ -34,8 +34,8 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum VehiclePropertyAccess { - NONE = 0, - READ = 1, - WRITE = 2, - READ_WRITE = 3, + NONE = 0x00, + READ = 0x01, + WRITE = 0x02, + READ_WRITE = 0x03, } diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.aidl index 5455fdd5ca..2f9d107e88 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.aidl @@ -34,7 +34,7 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum VehiclePropertyChangeMode { - STATIC = 0, - ON_CHANGE = 1, - CONTINUOUS = 2, + STATIC = 0x00, + ON_CHANGE = 0x01, + CONTINUOUS = 0x02, } diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyStatus.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyStatus.aidl index 6d0e041ff6..642ce83f21 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyStatus.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyStatus.aidl @@ -34,7 +34,7 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum VehiclePropertyStatus { - AVAILABLE = 0, - UNAVAILABLE = 1, - ERROR = 2, + AVAILABLE = 0x00, + UNAVAILABLE = 0x01, + ERROR = 0x02, } From 533c8bd2087635405942103ea829623558c7d08c Mon Sep 17 00:00:00 2001 From: Yixiao Luo Date: Thu, 19 Jan 2023 14:47:25 -0800 Subject: [PATCH 627/998] Correct test config file location for VtsHalCasAidlTargetTest Bug: 227673974 Test: VtsHalCasAidlTargetTest Change-Id: Idabe8aa699fc3a9acbf20facb34c3aa48ac9e881 --- cas/OWNERS | 1 + cas/aidl/vts/{ => functional}/AndroidTest.xml | 0 2 files changed, 1 insertion(+) create mode 100644 cas/OWNERS rename cas/aidl/vts/{ => functional}/AndroidTest.xml (100%) diff --git a/cas/OWNERS b/cas/OWNERS new file mode 100644 index 0000000000..473c8f2621 --- /dev/null +++ b/cas/OWNERS @@ -0,0 +1 @@ +include /tv/input/OWNERS diff --git a/cas/aidl/vts/AndroidTest.xml b/cas/aidl/vts/functional/AndroidTest.xml similarity index 100% rename from cas/aidl/vts/AndroidTest.xml rename to cas/aidl/vts/functional/AndroidTest.xml From 28318a3a5d5d4f110d4dfd7fa6475122f63351c7 Mon Sep 17 00:00:00 2001 From: Nathalie Le Clair Date: Tue, 24 Jan 2023 10:25:45 +0100 Subject: [PATCH 628/998] Fix incorrect indexing Test: lunch cf_x86_tv-userdebug; make; atest VtsHalTvHdmiConnectionAidlTargetTest; atest VtsHalTvHdmiEArcAidlTargetTest; Bug: 264412609 Change-Id: I1b3ad574cf886d023aa54de91b1062dd4f3fa671 --- tv/hdmi/connection/aidl/default/HdmiConnectionMock.cpp | 8 ++++---- tv/hdmi/earc/aidl/default/EArcMock.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tv/hdmi/connection/aidl/default/HdmiConnectionMock.cpp b/tv/hdmi/connection/aidl/default/HdmiConnectionMock.cpp index db9f4c156c..2bb2c788bb 100644 --- a/tv/hdmi/connection/aidl/default/HdmiConnectionMock.cpp +++ b/tv/hdmi/connection/aidl/default/HdmiConnectionMock.cpp @@ -44,7 +44,7 @@ ScopedAStatus HdmiConnectionMock::getPortInfo(std::vector* _aidl_r ScopedAStatus HdmiConnectionMock::isConnected(int32_t portId, bool* _aidl_return) { // Maintain port connection status and update on hotplug event if (portId <= mTotalPorts && portId >= 1) { - *_aidl_return = mPortConnectionStatus[portId]; + *_aidl_return = mPortConnectionStatus.at(portId - 1); } else { *_aidl_return = false; } @@ -130,10 +130,10 @@ void HdmiConnectionMock::handleHotplugMessage(unsigned char* msgBuf) { ALOGD("[halimp_aidl] hot plug port id %x, is connected %x", (msgBuf[0] & 0xf), (msgBuf[3] & 0xf)); - mPortConnectionStatus[portId] = connected; - if (mPortInfos[portId].type == HdmiPortType::OUTPUT) { + mPortConnectionStatus.at(portId - 1) = connected; + if (mPortInfos.at(portId - 1).type == HdmiPortType::OUTPUT) { mPhysicalAddress = (connected ? 0xffff : ((msgBuf[1] << 8) | (msgBuf[2]))); - mPortInfos[portId].physicalAddress = mPhysicalAddress; + mPortInfos.at(portId - 1).physicalAddress = mPhysicalAddress; ALOGD("[halimp_aidl] hot plug physical address %x", mPhysicalAddress); } diff --git a/tv/hdmi/earc/aidl/default/EArcMock.cpp b/tv/hdmi/earc/aidl/default/EArcMock.cpp index 99a845e59e..a3ccabfc56 100644 --- a/tv/hdmi/earc/aidl/default/EArcMock.cpp +++ b/tv/hdmi/earc/aidl/default/EArcMock.cpp @@ -54,7 +54,7 @@ ScopedAStatus EArcMock::isEArcEnabled(bool* _aidl_return) { ScopedAStatus EArcMock::getState(int32_t portId, IEArcStatus* _aidl_return) { // Maintain port connection status and update on hotplug event if (portId <= mTotalPorts && portId >= 1) { - *_aidl_return = mPortStatus[portId]; + *_aidl_return = mPortStatus.at(portId - 1); } else { return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } @@ -65,7 +65,7 @@ ScopedAStatus EArcMock::getState(int32_t portId, IEArcStatus* _aidl_return) { ScopedAStatus EArcMock::getLastReportedAudioCapabilities(int32_t portId, std::vector* _aidl_return) { if (portId <= mTotalPorts && portId >= 1) { - *_aidl_return = mCapabilities[portId]; + *_aidl_return = mCapabilities.at(portId - 1); } else { return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } From 4eaa178ddf09a8ae819558c71406e602b28cfced Mon Sep 17 00:00:00 2001 From: Nathalie Le Clair Date: Tue, 24 Jan 2023 17:26:42 +0100 Subject: [PATCH 629/998] Add portId to HPD-related methods Test: lunch cf_x86_tv-userdebug; make; atest VtsHalTvHdmiConnectionAidlTargetTest; Bug: 266178786 Change-Id: I58aff832606156bd529f2640541cad530953bd67 --- .../tv/hdmi/connection/IHdmiConnection.aidl | 4 +-- .../tv/hdmi/connection/IHdmiConnection.aidl | 10 +++++-- .../aidl/default/HdmiConnectionMock.cpp | 10 ++++--- .../aidl/default/HdmiConnectionMock.h | 6 ++-- .../VtsHalTvHdmiConnectionAidlTargetTest.cpp | 29 +++++++++++-------- 5 files changed, 36 insertions(+), 23 deletions(-) diff --git a/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/current/android/hardware/tv/hdmi/connection/IHdmiConnection.aidl b/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/current/android/hardware/tv/hdmi/connection/IHdmiConnection.aidl index 98d1452699..cf7c4bdb5e 100644 --- a/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/current/android/hardware/tv/hdmi/connection/IHdmiConnection.aidl +++ b/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/current/android/hardware/tv/hdmi/connection/IHdmiConnection.aidl @@ -37,6 +37,6 @@ interface IHdmiConnection { android.hardware.tv.hdmi.connection.HdmiPortInfo[] getPortInfo(); boolean isConnected(in int portId); void setCallback(in android.hardware.tv.hdmi.connection.IHdmiConnectionCallback callback); - void setHpdSignal(android.hardware.tv.hdmi.connection.HpdSignal signal); - android.hardware.tv.hdmi.connection.HpdSignal getHpdSignal(); + void setHpdSignal(android.hardware.tv.hdmi.connection.HpdSignal signal, in int portId); + android.hardware.tv.hdmi.connection.HpdSignal getHpdSignal(in int portId); } diff --git a/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/IHdmiConnection.aidl b/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/IHdmiConnection.aidl index c8759f2074..6c7a4381bf 100644 --- a/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/IHdmiConnection.aidl +++ b/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/IHdmiConnection.aidl @@ -55,16 +55,22 @@ interface IHdmiConnection { * signaling EDID updates). By default, the HAL will use {@code HDMI_HPD_PHYSICAL} (the physical * hotplug signal). When set to {@code HDMI_HPD_STATUS_BIT} the HAL should use the HDP status * bit. + * + * @param signal The HPD signal type to use. + * @param portId id of the port on which the HPD signal should be set. + * * @throws ServiceSpecificException with error code set to * {@code Result::FAILURE_NOT_SUPPORTED} if the signal type is not supported. * {@code Result::FAILURE_INVALID_ARGS} if the signal type is invalid. * {@code Result::FAILURE_UNKNOWN} if the signal type could not be set because of an * unknown failure. */ - void setHpdSignal(HpdSignal signal); + void setHpdSignal(HpdSignal signal, in int portId); /** * Get the current signal the HAL is using for HPD + * + * @param portId id of the port of which the current HPD signal is queried. */ - HpdSignal getHpdSignal(); + HpdSignal getHpdSignal(in int portId); } diff --git a/tv/hdmi/connection/aidl/default/HdmiConnectionMock.cpp b/tv/hdmi/connection/aidl/default/HdmiConnectionMock.cpp index db9f4c156c..8e2ac401a1 100644 --- a/tv/hdmi/connection/aidl/default/HdmiConnectionMock.cpp +++ b/tv/hdmi/connection/aidl/default/HdmiConnectionMock.cpp @@ -69,9 +69,9 @@ ScopedAStatus HdmiConnectionMock::setCallback( return ScopedAStatus::ok(); } -ScopedAStatus HdmiConnectionMock::setHpdSignal(HpdSignal signal) { +ScopedAStatus HdmiConnectionMock::setHpdSignal(HpdSignal signal, int32_t portId) { if (mHdmiThreadRun) { - mHpdSignal = signal; + mHpdSignal.at(portId - 1) = signal; return ScopedAStatus::ok(); } else { return ScopedAStatus::fromServiceSpecificError( @@ -79,8 +79,8 @@ ScopedAStatus HdmiConnectionMock::setHpdSignal(HpdSignal signal) { } } -ScopedAStatus HdmiConnectionMock::getHpdSignal(HpdSignal* _aidl_return) { - *_aidl_return = mHpdSignal; +ScopedAStatus HdmiConnectionMock::getHpdSignal(int32_t portId, HpdSignal* _aidl_return) { + *_aidl_return = mHpdSignal.at(portId - 1); return ScopedAStatus::ok(); } @@ -179,6 +179,7 @@ HdmiConnectionMock::HdmiConnectionMock() { mCallback = nullptr; mPortInfos.resize(mTotalPorts); mPortConnectionStatus.resize(mTotalPorts); + mHpdSignal.resize(mTotalPorts); mPortInfos[0] = {.type = HdmiPortType::OUTPUT, .portId = static_cast(1), .cecSupported = true, @@ -186,6 +187,7 @@ HdmiConnectionMock::HdmiConnectionMock() { .eArcSupported = false, .physicalAddress = mPhysicalAddress}; mPortConnectionStatus[0] = false; + mHpdSignal[0] = HpdSignal::HDMI_HPD_PHYSICAL; mDeathRecipient = ndk::ScopedAIBinder_DeathRecipient(AIBinder_DeathRecipient_new(serviceDied)); } diff --git a/tv/hdmi/connection/aidl/default/HdmiConnectionMock.h b/tv/hdmi/connection/aidl/default/HdmiConnectionMock.h index b879e51d59..c013fddd56 100644 --- a/tv/hdmi/connection/aidl/default/HdmiConnectionMock.h +++ b/tv/hdmi/connection/aidl/default/HdmiConnectionMock.h @@ -46,8 +46,8 @@ struct HdmiConnectionMock : public BnHdmiConnection { ::ndk::ScopedAStatus isConnected(int32_t portId, bool* _aidl_return) override; ::ndk::ScopedAStatus setCallback( const std::shared_ptr& callback) override; - ::ndk::ScopedAStatus setHpdSignal(HpdSignal signal) override; - ::ndk::ScopedAStatus getHpdSignal(HpdSignal* _aidl_return) override; + ::ndk::ScopedAStatus setHpdSignal(HpdSignal signal, int32_t portId) override; + ::ndk::ScopedAStatus getHpdSignal(int32_t portId, HpdSignal* _aidl_return) override; void printEventBuf(const char* msg_buf, int len); @@ -70,7 +70,7 @@ struct HdmiConnectionMock : public BnHdmiConnection { int mTotalPorts = 1; // HPD Signal being used - HpdSignal mHpdSignal = HpdSignal::HDMI_HPD_PHYSICAL; + std::vector mHpdSignal; // Testing variables // Input file descriptor diff --git a/tv/hdmi/connection/aidl/vts/functional/VtsHalTvHdmiConnectionAidlTargetTest.cpp b/tv/hdmi/connection/aidl/vts/functional/VtsHalTvHdmiConnectionAidlTargetTest.cpp index 69f7ef5506..a9b288ba1d 100644 --- a/tv/hdmi/connection/aidl/vts/functional/VtsHalTvHdmiConnectionAidlTargetTest.cpp +++ b/tv/hdmi/connection/aidl/vts/functional/VtsHalTvHdmiConnectionAidlTargetTest.cpp @@ -93,8 +93,8 @@ TEST_P(HdmiConnectionTest, GetPortInfo) { for (size_t i = 0; i < ports.size(); ++i) { EXPECT_TRUE((ports[i].type == HdmiPortType::OUTPUT) || (ports[i].type == HdmiPortType::INPUT)); - if (ports[i].portId == 0) { - ALOGW("%s: Port id should start from 1", __func__); + if (ports[i].type == HdmiPortType::OUTPUT && ports[i].portId <= 0) { + ALOGW("%s: Port id for output ports should start from 1", __func__); } cecSupportedOnDevice = cecSupportedOnDevice | ports[i].cecSupported; } @@ -111,16 +111,21 @@ TEST_P(HdmiConnectionTest, IsConnected) { } TEST_P(HdmiConnectionTest, HdpSignal) { + std::vector ports; + ASSERT_TRUE(hdmiConnection->getPortInfo(&ports).isOk()); HpdSignal originalSignal; HpdSignal signal = HpdSignal::HDMI_HPD_STATUS_BIT; - HpdSignal readSignal; - ASSERT_TRUE(hdmiConnection->getHpdSignal(&originalSignal).isOk()); - ASSERT_TRUE(hdmiConnection->setHpdSignal(signal).isOk()); - ASSERT_TRUE(hdmiConnection->getHpdSignal(&readSignal).isOk()); - EXPECT_EQ(readSignal, signal); - signal = HpdSignal::HDMI_HPD_PHYSICAL; - ASSERT_TRUE(hdmiConnection->setHpdSignal(signal).isOk()); - ASSERT_TRUE(hdmiConnection->getHpdSignal(&readSignal).isOk()); - EXPECT_EQ(readSignal, signal); - ASSERT_TRUE(hdmiConnection->setHpdSignal(originalSignal).isOk()); + for (size_t i = 0; i < ports.size(); ++i) { + int32_t portId = ports[i].portId; + HpdSignal readSignal; + ASSERT_TRUE(hdmiConnection->getHpdSignal(portId, &originalSignal).isOk()); + ASSERT_TRUE(hdmiConnection->setHpdSignal(signal, portId).isOk()); + ASSERT_TRUE(hdmiConnection->getHpdSignal(portId, &readSignal).isOk()); + EXPECT_EQ(readSignal, signal); + signal = HpdSignal::HDMI_HPD_PHYSICAL; + ASSERT_TRUE(hdmiConnection->setHpdSignal(signal, portId).isOk()); + ASSERT_TRUE(hdmiConnection->getHpdSignal(portId, &readSignal).isOk()); + EXPECT_EQ(readSignal, signal); + ASSERT_TRUE(hdmiConnection->setHpdSignal(originalSignal, portId).isOk()); + } } From f778a27e29911c11eb9df2d79e6e346e406e88a6 Mon Sep 17 00:00:00 2001 From: sadiqsada Date: Tue, 24 Jan 2023 14:55:59 -0800 Subject: [PATCH 630/998] Add IPTV setting Test: m Bug: 266287614 Change-Id: I0730ca15f58386b20fd0cbea97a885f5a74d6b36 --- .../current/android/hardware/tv/tuner/FrontendSettings.aidl | 1 + .../aidl/android/hardware/tv/tuner/FrontendSettings.aidl | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendSettings.aidl index 7eae9df379..9810ba6490 100644 --- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendSettings.aidl +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendSettings.aidl @@ -45,4 +45,5 @@ union FrontendSettings { android.hardware.tv.tuner.FrontendIsdbs3Settings isdbs3; android.hardware.tv.tuner.FrontendIsdbtSettings isdbt; android.hardware.tv.tuner.FrontendDtmbSettings dtmb; + @nullable android.hardware.tv.tuner.FrontendIptvSettings iptv; } diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendSettings.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendSettings.aidl index f78b2ae82b..e5a99e19a8 100644 --- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendSettings.aidl +++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendSettings.aidl @@ -19,13 +19,14 @@ package android.hardware.tv.tuner; import android.hardware.tv.tuner.FrontendAnalogSettings; import android.hardware.tv.tuner.FrontendAtsc3Settings; import android.hardware.tv.tuner.FrontendAtscSettings; +import android.hardware.tv.tuner.FrontendDtmbSettings; import android.hardware.tv.tuner.FrontendDvbcSettings; import android.hardware.tv.tuner.FrontendDvbsSettings; import android.hardware.tv.tuner.FrontendDvbtSettings; +import android.hardware.tv.tuner.FrontendIptvSettings; import android.hardware.tv.tuner.FrontendIsdbs3Settings; import android.hardware.tv.tuner.FrontendIsdbsSettings; import android.hardware.tv.tuner.FrontendIsdbtSettings; -import android.hardware.tv.tuner.FrontendDtmbSettings; /** * Signal Settings for Frontend. @@ -52,4 +53,6 @@ union FrontendSettings { FrontendIsdbtSettings isdbt; FrontendDtmbSettings dtmb; + + @nullable FrontendIptvSettings iptv; } From f233448ee920b4813e4f57f24b17505cb73ce7a0 Mon Sep 17 00:00:00 2001 From: Sarah Chin Date: Wed, 25 Jan 2023 03:56:44 -0800 Subject: [PATCH 631/998] Fix enum typo in DataCallFailCause Test: build Change-Id: I19b96ad9c18445837a1b89e2d202235cc72416aa --- .../android/hardware/radio/data/DataCallFailCause.aidl | 4 ++++ .../aidl/android/hardware/radio/data/DataCallFailCause.aidl | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl index 0a5f8dd01d..8a3fd4f4cd 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl @@ -285,7 +285,11 @@ enum DataCallFailCause { PDP_INACTIVE_TIMEOUT_EXPIRED = 0x873, PDP_LOWERLAYER_ERROR = 0x874, PDP_MODIFY_COLLISION = 0x875, + /** + * @deprecated use MAXIMUM_SIZE_OF_L2_MESSAGE_EXCEEDED instead. + */ MAXINUM_SIZE_OF_L2_MESSAGE_EXCEEDED = 0x876, + MAXIMUM_SIZE_OF_L2_MESSAGE_EXCEEDED = 0x876, NAS_REQUEST_REJECTED_BY_NETWORK = 0x877, RRC_CONNECTION_INVALID_REQUEST = 0x878, RRC_CONNECTION_TRACKING_AREA_ID_CHANGED = 0x879, diff --git a/radio/aidl/android/hardware/radio/data/DataCallFailCause.aidl b/radio/aidl/android/hardware/radio/data/DataCallFailCause.aidl index 29ece76711..071ce55c49 100644 --- a/radio/aidl/android/hardware/radio/data/DataCallFailCause.aidl +++ b/radio/aidl/android/hardware/radio/data/DataCallFailCause.aidl @@ -911,9 +911,13 @@ enum DataCallFailCause { */ PDP_MODIFY_COLLISION = 0x875, /** - * Maximum size of the L2 message was exceeded. + * @deprecated use MAXIMUM_SIZE_OF_L2_MESSAGE_EXCEEDED instead. */ MAXINUM_SIZE_OF_L2_MESSAGE_EXCEEDED = 0x876, + /** + * Maximum size of the L2 message was exceeded. + */ + MAXIMUM_SIZE_OF_L2_MESSAGE_EXCEEDED = 0x876, /** * Non-access stratum (NAS) request was rejected by the network. */ From 90a7f5b5d6b094c799b573ebd2f97830d96b194b Mon Sep 17 00:00:00 2001 From: Avichal Rakesh Date: Thu, 19 Jan 2023 19:45:17 -0800 Subject: [PATCH 632/998] UsbGadget AIDL migration cleanup This CL does the following: - Add fields to AIDL UsbSpeed that were added in HIDL's UsbSpeed 1.2. - Fix the values of the AIDL speeds. The values of fields in UsbSpeed didn't match their HIDL counterparts so this CL fixes the values as well. - Remove unused import from IUsbGadget and IUsbGadgetCallback. Test: Manually tested that UsbManager reports the correct speed when using the AIDL interface Bug: 218791946 Change-Id: Ic94bb382c11a88a29da5e61ca751138f271f54ac --- .../android/hardware/usb/gadget/UsbSpeed.aidl | 18 +++++---- .../hardware/usb/gadget/IUsbGadget.aidl | 3 +- .../usb/gadget/IUsbGadgetCallback.aidl | 1 - .../android/hardware/usb/gadget/UsbSpeed.aidl | 40 +++++++++++++++---- 4 files changed, 45 insertions(+), 17 deletions(-) diff --git a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/UsbSpeed.aidl b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/UsbSpeed.aidl index 0f54ee5a6b..7d4fa17400 100644 --- a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/UsbSpeed.aidl +++ b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/UsbSpeed.aidl @@ -34,11 +34,15 @@ package android.hardware.usb.gadget; @Backing(type="int") @VintfStability enum UsbSpeed { - UNKNOWN = 0, - LOWSPEED = 1, - FULLSPEED = 2, - HIGHSPEED = 3, - SUPERSPEED = 4, - SUPERSPEED_10Gb = 5, - SUPERSPEED_20Gb = 6, + UNKNOWN = (-1), + LOWSPEED = 0, + FULLSPEED = 1, + HIGHSPEED = 2, + SUPERSPEED = 3, + SUPERSPEED_10Gb = 4, + SUPERSPEED_20Gb = 5, + USB4_GEN2_10Gb = 6, + USB4_GEN2_20Gb = 7, + USB4_GEN3_20Gb = 8, + USB4_GEN3_40Gb = 9, } diff --git a/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadget.aidl b/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadget.aidl index 24a27c6673..9c3f0d476f 100644 --- a/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadget.aidl +++ b/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadget.aidl @@ -16,7 +16,6 @@ package android.hardware.usb.gadget; -import android.hardware.usb.gadget.GadgetFunction; import android.hardware.usb.gadget.IUsbGadgetCallback; @VintfStability @@ -35,7 +34,7 @@ oneway interface IUsbGadget { * */ void setCurrentUsbFunctions(in long functions, in IUsbGadgetCallback callback, - in long timeoutMs, long transactionId); + in long timeoutMs, long transactionId); /** * This function is used to query the USB functions included in the diff --git a/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadgetCallback.aidl b/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadgetCallback.aidl index 5a682d6bfb..b4945a0c0e 100644 --- a/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadgetCallback.aidl +++ b/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadgetCallback.aidl @@ -16,7 +16,6 @@ package android.hardware.usb.gadget; -import android.hardware.usb.gadget.GadgetFunction; import android.hardware.usb.gadget.Status; import android.hardware.usb.gadget.UsbSpeed; diff --git a/usb/gadget/aidl/android/hardware/usb/gadget/UsbSpeed.aidl b/usb/gadget/aidl/android/hardware/usb/gadget/UsbSpeed.aidl index 0492757ab6..2a3fb93e95 100644 --- a/usb/gadget/aidl/android/hardware/usb/gadget/UsbSpeed.aidl +++ b/usb/gadget/aidl/android/hardware/usb/gadget/UsbSpeed.aidl @@ -22,29 +22,55 @@ enum UsbSpeed { /** * UNKNOWN - Not Connected or Unsupported Speed */ - UNKNOWN = 0, + UNKNOWN = -1, + /** * USB Low Speed */ - LOWSPEED = 1, + LOWSPEED = 0, + /** * USB Full Speed */ - FULLSPEED = 2, + FULLSPEED = 1, + /** * USB High Speed */ - HIGHSPEED = 3, + HIGHSPEED = 2, + /** * USB Super Speed */ - SUPERSPEED = 4, + SUPERSPEED = 3, + /** * USB Super Speed 10Gbps */ - SUPERSPEED_10Gb = 5, + SUPERSPEED_10Gb = 4, + /** * USB Super Speed 20Gbps */ - SUPERSPEED_20Gb = 6, + SUPERSPEED_20Gb = 5, + + /** + * USB4 Gen2 x 1 (10Gbps) + */ + USB4_GEN2_10Gb = 6, + + /** + * USB4 Gen2 x 2 (20Gbps) + */ + USB4_GEN2_20Gb = 7, + + /** + * USB4 Gen3 x 1 (20Gbps) + */ + USB4_GEN3_20Gb = 8, + + /** + * USB4 Gen3 x 2 (40Gbps) + */ + USB4_GEN3_40Gb = 9, } From 6bdbc5e62d994d175ef30332a9b7e739d2f66de9 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 12 Jan 2023 16:51:03 -0800 Subject: [PATCH 633/998] Add new APIs for watermarking Bug: 263762255 Test: m Change-Id: I7eeaa58f0a3a1056f33e22aba42540636794ade1 --- tv/input/OWNERS | 1 + tv/input/aidl/Android.bp | 1 + .../android/hardware/tv/input/ITvInput.aidl | 2 + .../hardware/tv/input/ITvInputCallback.aidl | 1 + .../android/hardware/tv/input/TvMessage.aidl | 40 +++++++++++++++++++ .../hardware/tv/input/TvMessageEvent.aidl | 40 +++++++++++++++++++ .../hardware/tv/input/TvMessageEventType.aidl | 40 +++++++++++++++++++ .../android/hardware/tv/input/ITvInput.aidl | 31 ++++++++++++++ .../hardware/tv/input/ITvInputCallback.aidl | 8 ++++ .../android/hardware/tv/input/TvMessage.aidl | 35 ++++++++++++++++ .../hardware/tv/input/TvMessageEvent.aidl | 28 +++++++++++++ .../hardware/tv/input/TvMessageEventType.aidl | 25 ++++++++++++ tv/input/aidl/default/Android.bp | 6 +++ tv/input/aidl/default/TvInput.cpp | 15 +++++++ tv/input/aidl/default/TvInput.h | 10 +++++ tv/input/aidl/vts/functional/Android.bp | 13 +++++- .../functional/VtsHalTvInputTargetTest.cpp | 5 +++ .../vts/functional/VtsHalTvInputTargetTest.h | 7 +++- 18 files changed, 305 insertions(+), 3 deletions(-) create mode 100644 tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessage.aidl create mode 100644 tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessageEvent.aidl create mode 100644 tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessageEventType.aidl create mode 100644 tv/input/aidl/android/hardware/tv/input/TvMessage.aidl create mode 100644 tv/input/aidl/android/hardware/tv/input/TvMessageEvent.aidl create mode 100644 tv/input/aidl/android/hardware/tv/input/TvMessageEventType.aidl diff --git a/tv/input/OWNERS b/tv/input/OWNERS index a02291a3c2..ae65f674b0 100644 --- a/tv/input/OWNERS +++ b/tv/input/OWNERS @@ -1,3 +1,4 @@ +# Bug component: 105688 hgchen@google.com shubang@google.com quxiangfang@google.com diff --git a/tv/input/aidl/Android.bp b/tv/input/aidl/Android.bp index 1987174990..2591151fe8 100644 --- a/tv/input/aidl/Android.bp +++ b/tv/input/aidl/Android.bp @@ -14,6 +14,7 @@ aidl_interface { imports: [ "android.hardware.common-V2", "android.media.audio.common.types-V1", + "android.hardware.common.fmq-V1", ], stability: "vintf", backend: { diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInput.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInput.aidl index f8d5e058d4..84fe2fb7d7 100644 --- a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInput.aidl +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInput.aidl @@ -38,6 +38,8 @@ interface ITvInput { android.hardware.tv.input.TvStreamConfig[] getStreamConfigurations(in int deviceId); android.hardware.common.NativeHandle openStream(in int deviceId, in int streamId); void setCallback(in android.hardware.tv.input.ITvInputCallback callback); + void setTvMessageEnabled(int deviceId, int streamId, in android.hardware.tv.input.TvMessageEventType type, boolean enabled); + void getTvMessageQueueDesc(out android.hardware.common.fmq.MQDescriptor queue, int deviceId, int streamId); const int STATUS_UNKNOWN = 1; const int STATUS_NO_RESOURCE = 2; const int STATUS_INVALID_ARGUMENTS = 3; diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInputCallback.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInputCallback.aidl index 7f2aff6d78..974701341c 100644 --- a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInputCallback.aidl +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInputCallback.aidl @@ -35,4 +35,5 @@ package android.hardware.tv.input; @VintfStability interface ITvInputCallback { void notify(in android.hardware.tv.input.TvInputEvent event); + void notifyTvMessageEvent(in android.hardware.tv.input.TvMessageEvent event); } diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessage.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessage.aidl new file mode 100644 index 0000000000..637b01cc6f --- /dev/null +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessage.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.input; +@VintfStability +parcelable TvMessage { + String subType; + long groupId; + int dataLengthBytes; +} diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessageEvent.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessageEvent.aidl new file mode 100644 index 0000000000..94fe665d1d --- /dev/null +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessageEvent.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.input; +@VintfStability +parcelable TvMessageEvent { + android.hardware.tv.input.TvMessageEventType type; + int streamId; + android.hardware.tv.input.TvMessage[] messages; +} diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessageEventType.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessageEventType.aidl new file mode 100644 index 0000000000..a033903814 --- /dev/null +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessageEventType.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.input; +@Backing(type="int") @VintfStability +enum TvMessageEventType { + WATERMARK = 1, + CLOSED_CAPTION = 2, + OTHER = 3, +} diff --git a/tv/input/aidl/android/hardware/tv/input/ITvInput.aidl b/tv/input/aidl/android/hardware/tv/input/ITvInput.aidl index 31d6586135..cbaf0663b6 100644 --- a/tv/input/aidl/android/hardware/tv/input/ITvInput.aidl +++ b/tv/input/aidl/android/hardware/tv/input/ITvInput.aidl @@ -17,7 +17,10 @@ package android.hardware.tv.input; import android.hardware.common.NativeHandle; +import android.hardware.common.fmq.MQDescriptor; +import android.hardware.common.fmq.SynchronizedReadWrite; import android.hardware.tv.input.ITvInputCallback; +import android.hardware.tv.input.TvMessageEventType; import android.hardware.tv.input.TvStreamConfig; @VintfStability @@ -73,4 +76,32 @@ interface ITvInput { * @throws ServiceSpecificException with values from the ITvInput::STATUS_* constants */ void setCallback(in ITvInputCallback callback); + + /** + * Enables or disables TV message detection for the specified stream on the device. + * + * @param deviceId The ID of the device that contains the stream to set the flag for. + * @param streamId The ID of the stream to set the flag for. + * @param type The type of {@link android.hardware.tv.input.TvMessageEventType}. + * @param enabled {@code true} if you want to enable TV message detection + * {@code false} otherwise. + */ + void setTvMessageEnabled( + int deviceId, int streamId, in TvMessageEventType type, boolean enabled); + + /** + * Gets the TV message queue for the specified stream on the device. + * + * The FMQ is used to relay events that are parsed from the specified stream to the + * app or service responsible for processing the message. The HAL implementation + * is expected to parse these messages and add them to the queue as new events are + * detected from the stream based on whether or not they are enabled by + * {@link #setTvMessageEnabled(int, int, TvMessageEventType, boolean)}. + * + * @param deviceId The ID of the device that contains the stream to get the queue for. + * @param streamId THe ID of the stream to get the queue for. + * @return The descriptor of the TV message queue. + */ + void getTvMessageQueueDesc( + out MQDescriptor queue, int deviceId, int streamId); } diff --git a/tv/input/aidl/android/hardware/tv/input/ITvInputCallback.aidl b/tv/input/aidl/android/hardware/tv/input/ITvInputCallback.aidl index fc7492d7b4..5d4731737b 100644 --- a/tv/input/aidl/android/hardware/tv/input/ITvInputCallback.aidl +++ b/tv/input/aidl/android/hardware/tv/input/ITvInputCallback.aidl @@ -17,6 +17,7 @@ package android.hardware.tv.input; import android.hardware.tv.input.TvInputEvent; +import android.hardware.tv.input.TvMessageEvent; @VintfStability interface ITvInputCallback { @@ -27,4 +28,11 @@ interface ITvInputCallback { * @param event Event passed to the client. */ void notify(in TvInputEvent event); + /** + * Notifies the client that an TV message event has occurred. For possible event types, + * check TvMessageEventType. + * + * @param event Event passed to the client. + */ + void notifyTvMessageEvent(in TvMessageEvent event); } diff --git a/tv/input/aidl/android/hardware/tv/input/TvMessage.aidl b/tv/input/aidl/android/hardware/tv/input/TvMessage.aidl new file mode 100644 index 0000000000..6df1f9a25b --- /dev/null +++ b/tv/input/aidl/android/hardware/tv/input/TvMessage.aidl @@ -0,0 +1,35 @@ +/* + * Copyright 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. + */ + +package android.hardware.tv.input; + +@VintfStability +parcelable TvMessage { + /** + * Extended data type, like “ATSC A/336 Watermark”, “ATSC_CC”, etc. This is opaque + * to the framework. + */ + String subType; + /** + * This group id is used to optionally identify messages that belong together, such as + * headers and bodies of the same event. For messages that do not have a group, this value + * should be -1. + * + * As -1 is a reserved value, -1 should not be used as a valid groupId. + */ + long groupId; + int dataLengthBytes; +} diff --git a/tv/input/aidl/android/hardware/tv/input/TvMessageEvent.aidl b/tv/input/aidl/android/hardware/tv/input/TvMessageEvent.aidl new file mode 100644 index 0000000000..74a078a45e --- /dev/null +++ b/tv/input/aidl/android/hardware/tv/input/TvMessageEvent.aidl @@ -0,0 +1,28 @@ +/* + * Copyright 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. + */ + +package android.hardware.tv.input; + +import android.hardware.tv.input.TvMessage; +import android.hardware.tv.input.TvMessageEventType; + +@VintfStability +parcelable TvMessageEvent { + TvMessageEventType type; + + int streamId; + TvMessage[] messages; +} diff --git a/tv/input/aidl/android/hardware/tv/input/TvMessageEventType.aidl b/tv/input/aidl/android/hardware/tv/input/TvMessageEventType.aidl new file mode 100644 index 0000000000..5a5f472a77 --- /dev/null +++ b/tv/input/aidl/android/hardware/tv/input/TvMessageEventType.aidl @@ -0,0 +1,25 @@ +/* + * Copyright 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. + */ + +package android.hardware.tv.input; + +@VintfStability +@Backing(type="int") +enum TvMessageEventType { + WATERMARK = 1, + CLOSED_CAPTION = 2, + OTHER = 3, +} diff --git a/tv/input/aidl/default/Android.bp b/tv/input/aidl/default/Android.bp index 66148c8aaa..05af6a94fb 100644 --- a/tv/input/aidl/default/Android.bp +++ b/tv/input/aidl/default/Android.bp @@ -13,6 +13,10 @@ cc_binary { init_rc: ["input-default.rc"], vintf_fragments: ["input-default.xml"], vendor: true, + cflags: [ + "-Werror", + "-Wno-unused-parameter", + ], srcs: [ "TvInput.cpp", "service.cpp", @@ -23,9 +27,11 @@ cc_binary { shared_libs: [ "libbase", "liblog", + "libfmq", "libutils", "libcutils", "libbinder_ndk", "android.hardware.tv.input-V1-ndk", + "android.hardware.common.fmq-V1-ndk", ], } diff --git a/tv/input/aidl/default/TvInput.cpp b/tv/input/aidl/default/TvInput.cpp index ed12cbc92d..47f8be5e39 100644 --- a/tv/input/aidl/default/TvInput.cpp +++ b/tv/input/aidl/default/TvInput.cpp @@ -65,6 +65,21 @@ void TvInput::init() { return ::ndk::ScopedAStatus::ok(); } +::ndk::ScopedAStatus TvInput::setTvMessageEnabled(int32_t deviceId, int32_t streamId, + TvMessageEventType in_type, bool enabled) { + ALOGV("%s", __FUNCTION__); + // TODO: Implement this + return ::ndk::ScopedAStatus::ok(); +} + +::ndk::ScopedAStatus TvInput::getTvMessageQueueDesc( + MQDescriptor* out_queue, int32_t in_deviceId, + int32_t in_streamId) { + ALOGV("%s", __FUNCTION__); + // TODO: Implement this + return ::ndk::ScopedAStatus::ok(); +} + ::ndk::ScopedAStatus TvInput::getStreamConfigurations(int32_t in_deviceId, vector* _aidl_return) { ALOGV("%s", __FUNCTION__); diff --git a/tv/input/aidl/default/TvInput.h b/tv/input/aidl/default/TvInput.h index a72bca3806..9cb7ae6fe2 100644 --- a/tv/input/aidl/default/TvInput.h +++ b/tv/input/aidl/default/TvInput.h @@ -19,6 +19,8 @@ #include #include +#include +#include #include #include "TvInputDeviceInfoWrapper.h" #include "TvStreamConfigWrapper.h" @@ -26,6 +28,9 @@ using namespace android; using namespace std; using ::aidl::android::hardware::common::NativeHandle; +using ::aidl::android::hardware::common::fmq::MQDescriptor; +using ::aidl::android::hardware::common::fmq::SynchronizedReadWrite; +using ::android::AidlMessageQueue; namespace aidl { namespace android { @@ -38,6 +43,11 @@ class TvInput : public BnTvInput { TvInput(); ::ndk::ScopedAStatus setCallback(const shared_ptr& in_callback) override; + ::ndk::ScopedAStatus setTvMessageEnabled(int32_t deviceId, int32_t streamId, + TvMessageEventType in_type, bool enabled) override; + ::ndk::ScopedAStatus getTvMessageQueueDesc( + MQDescriptor* out_queue, int32_t in_deviceId, + int32_t in_streamId) override; ::ndk::ScopedAStatus getStreamConfigurations(int32_t in_deviceId, vector* _aidl_return) override; ::ndk::ScopedAStatus openStream(int32_t in_deviceId, int32_t in_streamId, diff --git a/tv/input/aidl/vts/functional/Android.bp b/tv/input/aidl/vts/functional/Android.bp index 9829b6d679..22487eafb1 100644 --- a/tv/input/aidl/vts/functional/Android.bp +++ b/tv/input/aidl/vts/functional/Android.bp @@ -9,10 +9,16 @@ package { cc_test { name: "VtsHalTvInputTargetTest", - defaults: ["VtsHalTargetTestDefaults","use_libaidlvintf_gtest_helper_static",], + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + cflags: [ + "-Werror", + "-Wno-unused-parameter", + ], srcs: ["VtsHalTvInputTargetTest.cpp"], static_libs: [ - "android.hardware.tv.input-V1-ndk", "android.media.audio.common.types-V1-ndk", "android.hardware.common-V2-ndk", "libaidlcommonsupport", @@ -24,6 +30,9 @@ cc_test { shared_libs: [ "libbinder_ndk", "libvndksupport", + "libfmq", + "android.hardware.common.fmq-V1-ndk", + "android.hardware.tv.input-V1-ndk", ], require_root: true, } diff --git a/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp index ec83e29bfd..9c2606984b 100644 --- a/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp +++ b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp @@ -43,6 +43,11 @@ TvInputAidlTest::TvInputCallback::TvInputCallback(shared_ptr pa return ::ndk::ScopedAStatus::ok(); } +::ndk::ScopedAStatus TvInputAidlTest::TvInputCallback::notifyTvMessageEvent( + const TvMessageEvent& in_event) { + return ::ndk::ScopedAStatus::ok(); +} + void TvInputAidlTest::SetUp() { if (AServiceManager_isDeclared(GetParam().c_str())) { ::ndk::SpAIBinder binder(AServiceManager_waitForService(GetParam().c_str())); diff --git a/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.h b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.h index c76e5686fc..693d49dd40 100644 --- a/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.h +++ b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.h @@ -25,15 +25,19 @@ #include #include #include +#include +#include #include +#include #include #include using namespace aidl::android::hardware::tv::input; using namespace std; - using ::aidl::android::hardware::common::NativeHandle; +using ::aidl::android::hardware::common::fmq::MQDescriptor; +using ::android::AidlMessageQueue; #define WAIT_FOR_EVENT_TIMEOUT 5 #define DEFAULT_ID INT32_MIN @@ -46,6 +50,7 @@ class TvInputAidlTest : public testing::TestWithParam { public: TvInputCallback(shared_ptr parent); ::ndk::ScopedAStatus notify(const TvInputEvent& in_event) override; + ::ndk::ScopedAStatus notifyTvMessageEvent(const TvMessageEvent& in_event) override; private: shared_ptr parent_; From 50274f7696779e00fd16b5e6fbbc02e36fc64352 Mon Sep 17 00:00:00 2001 From: Ye Jiao Date: Tue, 17 Jan 2023 14:53:22 +0800 Subject: [PATCH 634/998] Move setScanMode to legacy HAL Cherry-pick from https://partner-android-review.git.corp.google.com/c/platform/hardware/interfaces/+/2369946 Implementation of setScanMode is platform-specific. It's more reasonable to move it the legacy HAL like other platform-specific APIs. Bug: 265866990 Test: manual Test Test: VTS Change-Id: I2f8ff73b764ed1b9835b8e3157f673d7d558ae02 --- wifi/aidl/default/wifi_legacy_hal.cpp | 4 ++++ wifi/aidl/default/wifi_legacy_hal.h | 2 ++ wifi/aidl/default/wifi_legacy_hal_stubs.cpp | 1 + wifi/aidl/default/wifi_sta_iface.cpp | 5 ++--- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/wifi/aidl/default/wifi_legacy_hal.cpp b/wifi/aidl/default/wifi_legacy_hal.cpp index 0711568a4e..43a71cc074 100644 --- a/wifi/aidl/default/wifi_legacy_hal.cpp +++ b/wifi/aidl/default/wifi_legacy_hal.cpp @@ -1766,6 +1766,10 @@ wifi_error WifiLegacyHal::twtClearStats(const std::string& iface_name, uint8_t c return global_func_table_.wifi_twt_clear_stats(getIfaceHandle(iface_name), configId); } +wifi_error WifiLegacyHal::setScanMode(const std::string& iface_name, bool enable) { + return global_func_table_.wifi_set_scan_mode(iface_name.c_str(), enable); +} + wifi_error WifiLegacyHal::setDtimConfig(const std::string& iface_name, uint32_t multiplier) { return global_func_table_.wifi_set_dtim_config(getIfaceHandle(iface_name), multiplier); } diff --git a/wifi/aidl/default/wifi_legacy_hal.h b/wifi/aidl/default/wifi_legacy_hal.h index 1e6ef73eec..a066ea6083 100644 --- a/wifi/aidl/default/wifi_legacy_hal.h +++ b/wifi/aidl/default/wifi_legacy_hal.h @@ -741,6 +741,8 @@ class WifiLegacyHal { wifi_error twtClearStats(const std::string& iface_name, uint8_t configId); + wifi_error setScanMode(const std::string& iface_name, bool enable); + wifi_error setDtimConfig(const std::string& iface_name, uint32_t multiplier); // Retrieve the list of usable channels in the requested bands diff --git a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp index c18b086c17..fa87772ef3 100644 --- a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp +++ b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp @@ -175,6 +175,7 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { populateStubFor(&hal_fn->wifi_enable_sta_channel_for_peer_network); populateStubFor(&hal_fn->wifi_nan_suspend_request); populateStubFor(&hal_fn->wifi_nan_resume_request); + populateStubFor(&hal_fn->wifi_set_scan_mode); return true; } diff --git a/wifi/aidl/default/wifi_sta_iface.cpp b/wifi/aidl/default/wifi_sta_iface.cpp index 08ed9d2b5c..96dc809839 100644 --- a/wifi/aidl/default/wifi_sta_iface.cpp +++ b/wifi/aidl/default/wifi_sta_iface.cpp @@ -561,9 +561,8 @@ std::pair, ndk::ScopedAStatus> WifiStaIface::getFactoryMa } ndk::ScopedAStatus WifiStaIface::setScanModeInternal(bool enable) { - // OEM's need to implement this on their devices if needed. - LOG(WARNING) << "setScanModeInternal(" << enable << ") not supported"; - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->setScanMode(ifname_, enable); + return createWifiStatusFromLegacyError(legacy_status); } ndk::ScopedAStatus WifiStaIface::setDtimMultiplierInternal(const int multiplier) { From 5e873e7d683f0eae0a46dde8f90b0c1eaa168f4b Mon Sep 17 00:00:00 2001 From: Helen Date: Tue, 24 Jan 2023 16:21:06 +0000 Subject: [PATCH 635/998] [ImsMedia] Add the duration value for the received DTMF api as per updated imsmedia design Bug: 265610926 Test: build (mm && m -j64) Change-Id: I6806f5fcb5c78271b7b8a8f56b44e32272de990f --- .../hardware/radio/ims/media/IImsMediaSessionListener.aidl | 2 +- .../hardware/radio/ims/media/IImsMediaSessionListener.aidl | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl index f03b29e85d..b1e05765bc 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl @@ -41,6 +41,6 @@ interface IImsMediaSessionListener { oneway void notifyPacketLoss(int packetLossPercentage); oneway void notifyJitter(int jitter); oneway void triggerAnbrQuery(in android.hardware.radio.ims.media.RtpConfig config); - oneway void onDtmfReceived(char dtmfDigit); + oneway void onDtmfReceived(char dtmfDigit, int durationMs); oneway void onCallQualityChanged(in android.hardware.radio.ims.media.CallQuality callQuality); } diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl index d40da64f83..d1501fe2cd 100644 --- a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl @@ -95,8 +95,9 @@ oneway interface IImsMediaSessionListener { * Notifies the received DTMF digit from the other party * * @param dtmfDigit single char having one of 12 values: 0-9, *, # + * @param durationMs The duration to play the tone in milliseconds unit */ - void onDtmfReceived(char dtmfDigit); + void onDtmfReceived(char dtmfDigit, int durationMs); /** * Notifies when a change to call quality has occurred From f139105acee74771441bb7faebd9486f057803e5 Mon Sep 17 00:00:00 2001 From: shrikar Date: Fri, 27 Jan 2023 18:47:14 +0000 Subject: [PATCH 636/998] Corrected VehicleProperty.aidl path to current path Bug: 266883153 Test: manual build Change-Id: Ia2a4c5d08988b64edfd7a9b051fb77bfb3b423ef --- automotive/vehicle/tools/generate_annotation_enums.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/tools/generate_annotation_enums.py b/automotive/vehicle/tools/generate_annotation_enums.py index fc6f157283..85c521aeeb 100644 --- a/automotive/vehicle/tools/generate_annotation_enums.py +++ b/automotive/vehicle/tools/generate_annotation_enums.py @@ -27,8 +27,8 @@ import os import re import sys -PROP_AIDL_FILE_PATH = ("hardware/interfaces/automotive/vehicle/aidl/android/hardware/automotive/" + - "vehicle/VehicleProperty.aidl") +PROP_AIDL_FILE_PATH = ("hardware/interfaces/automotive/vehicle/aidl_property/android/hardware/" + + "automotive/vehicle/VehicleProperty.aidl") CHANGE_MODE_CPP_FILE_PATH = ("hardware/interfaces/automotive/vehicle/aidl/generated_lib/cpp/" + "ChangeModeForVehicleProperty.h") ACCESS_CPP_FILE_PATH = ("hardware/interfaces/automotive/vehicle/aidl/generated_lib/cpp/" + From 64212ebb2e338882129be1f4cdececaf58351e31 Mon Sep 17 00:00:00 2001 From: shrikar Date: Thu, 26 Jan 2023 21:42:44 +0000 Subject: [PATCH 637/998] Shifted unique IDS of HOD and Driver Attention Monitoring Enabled in HAL Since 1 new ACC property had been introduced, we decided to shift the unique IDs of all the ADAS properties that come after it, namely the HOD and Driver attention monitoring properties, by 1. Bug: 266850785 Test: atest CarPropertyManagerTest Change-Id: I63e296c03dbac678eaed6e35d68c8cacc383f949 --- .../android/hardware/automotive/vehicle/VehicleProperty.aidl | 4 ++-- .../android/hardware/automotive/vehicle/VehicleProperty.aidl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 1039347b28..a39b8dd63e 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -247,6 +247,6 @@ enum VehicleProperty { LANE_CENTERING_ASSIST_ENABLED = 287313930, EMERGENCY_LANE_KEEP_ASSIST_ENABLED = 287313933, ADAPTIVE_CRUISE_CONTROL_ENABLED = 287313935, - HANDS_ON_DETECTION_ENABLED = 287313941, - DRIVER_ATTENTION_MONITORING_ENABLED = 287313944, + HANDS_ON_DETECTION_ENABLED = 287313942, + DRIVER_ATTENTION_MONITORING_ENABLED = 287313945, } diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 446a9fa4c3..4532640885 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3623,7 +3623,7 @@ enum VehicleProperty { * @access VehiclePropertyAccess.READ_WRITE */ HANDS_ON_DETECTION_ENABLED = - 0x1015 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + 0x1016 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, /** * Enable or disable driver attention monitoring. @@ -3640,7 +3640,7 @@ enum VehicleProperty { * @access VehiclePropertyAccess.READ_WRITE */ DRIVER_ATTENTION_MONITORING_ENABLED = - 0x1018 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + 0x1019 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, /*************************************************************************** * End of ADAS Properties From 79e826d1c9676dfb80ea8ebd4e323829af8f3e09 Mon Sep 17 00:00:00 2001 From: Oscar Shu Date: Fri, 27 Jan 2023 21:50:17 +0000 Subject: [PATCH 638/998] Support AFC channel allowance feature flag Bug: 242917176 Test: compile Change-Id: I45c0ac54ead7c83a9f83c2a3875a4beaffc2eed0 --- wifi/aidl/default/aidl_struct_util.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index ba7d2dbbbd..07ce60b5f3 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -84,6 +84,8 @@ IWifiChip::ChipCapabilityMask convertLegacyFeatureToAidlChipCapability(uint64_t return IWifiChip::ChipCapabilityMask::SET_LATENCY_MODE; case WIFI_FEATURE_P2P_RAND_MAC: return IWifiChip::ChipCapabilityMask::P2P_RAND_MAC; + case WIFI_FEATURE_AFC_CHANNEL: + return IWifiChip::ChipCapabilityMask::SET_AFC_CHANNEL_ALLOWANCE; }; CHECK(false) << "Unknown legacy feature: " << feature; return {}; @@ -146,7 +148,8 @@ bool convertLegacyFeaturesToAidlChipCapabilities(uint64_t legacy_feature_set, WIFI_FEATURE_D2AP_RTT, WIFI_FEATURE_INFRA_60G, WIFI_FEATURE_SET_LATENCY_MODE, - WIFI_FEATURE_P2P_RAND_MAC}; + WIFI_FEATURE_P2P_RAND_MAC, + WIFI_FEATURE_AFC_CHANNEL}; for (const auto feature : features) { if (feature & legacy_feature_set) { *aidl_caps |= static_cast(convertLegacyFeatureToAidlChipCapability(feature)); From bab159cc73e1e802d0b4f5a3b4fd6ce1b57a9428 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Fri, 27 Jan 2023 11:23:51 +0900 Subject: [PATCH 639/998] wifi: put vintf fragment into wifi apex The AOSP-version of wifi hal apex now contains the VINTF fragment in it. Bug: 247018693 Bug: 266885060 Test: atest CtsWifiTestCases Change-Id: Id8f196386967c3023cb5ee308d31b8cdeed7df0b --- compatibility_matrices/compatibility_matrix.8.xml | 2 +- wifi/apex/Android.bp | 2 +- wifi/apex/file_contexts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.8.xml b/compatibility_matrices/compatibility_matrix.8.xml index 5cbf85c01c..8ca038b0e0 100644 --- a/compatibility_matrices/compatibility_matrix.8.xml +++ b/compatibility_matrices/compatibility_matrix.8.xml @@ -723,7 +723,7 @@ default - + android.hardware.wifi 1 diff --git a/wifi/apex/Android.bp b/wifi/apex/Android.bp index e1fefb9575..f8ba5c472b 100644 --- a/wifi/apex/Android.bp +++ b/wifi/apex/Android.bp @@ -30,6 +30,7 @@ prebuilt_etc { name: "com.android.hardware.wifi.xml", src: ":default-android.hardware.wifi-service.xml", installable: false, + sub_dir: "vintf", } apex { @@ -38,7 +39,6 @@ apex { key: "com.android.hardware.wifi.key", certificate: ":com.android.hardware.wifi.certificate", file_contexts: "file_contexts", - vintf_fragments: [":com.android.hardware.wifi.xml"], use_vndk_as_stable: true, updatable: false, soc_specific: true, diff --git a/wifi/apex/file_contexts b/wifi/apex/file_contexts index 6368729c9a..d932facd1e 100644 --- a/wifi/apex/file_contexts +++ b/wifi/apex/file_contexts @@ -1,3 +1,3 @@ -(/.*)? u:object_r:vendor_file:s0 +(/.*)? u:object_r:vendor_file:s0 +/etc(/.*)? u:object_r:vendor_configs_file:s0 /bin/hw/android\.hardware\.wifi-service u:object_r:hal_wifi_default_exec:s0 - From 79038ed5603ae93e893e49d78834d3feec28b0b8 Mon Sep 17 00:00:00 2001 From: Dean Wheatley Date: Mon, 19 Dec 2022 16:28:43 +1100 Subject: [PATCH 640/998] Add TV tuner audio preselection support DVB MPEG-2 transport streams can include audio preselection descriptors for next-generation audio (NGA) as specified in ETSI EN 300 468. Add support for audio preselections in DemuxFilterMediaEvent. Note that, when an audio preselection descriptor is present for a NGA stream, receivers are required to ignore (supplementary) audio descriptors (see Annex M.2). Bug: 264812332 Test: `atest VtsHalTvTunerTargetTest` on cf_x86_tv-userdebug Change-Id: I5b6d9a86aa74feb87879125f57ca36d7e71bbdf4 --- .../hardware/tv/tuner/AudioPreselection.aidl | 45 +++++++++++++ .../tv/tuner/AudioPreselectionLabel.aidl | 40 ++++++++++++ ...ioPreselectionRenderingIndicationType.aidl | 43 +++++++++++++ .../hardware/tv/tuner/AudioPresentation.aidl | 40 ++++++++++++ .../DemuxFilterMediaEventExtraMetaData.aidl | 1 + .../hardware/tv/tuner/AudioPreselection.aidl | 63 +++++++++++++++++++ .../tv/tuner/AudioPreselectionLabel.aidl | 34 ++++++++++ ...ioPreselectionRenderingIndicationType.aidl | 50 +++++++++++++++ .../hardware/tv/tuner/AudioPresentation.aidl | 38 +++++++++++ .../DemuxFilterMediaEventExtraMetaData.aidl | 6 ++ tv/tuner/aidl/default/Filter.cpp | 51 +++++++++++---- tv/tuner/aidl/default/Filter.h | 2 +- 12 files changed, 401 insertions(+), 12 deletions(-) create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPreselection.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPreselectionLabel.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPreselectionRenderingIndicationType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPresentation.aidl create mode 100644 tv/tuner/aidl/android/hardware/tv/tuner/AudioPreselection.aidl create mode 100644 tv/tuner/aidl/android/hardware/tv/tuner/AudioPreselectionLabel.aidl create mode 100644 tv/tuner/aidl/android/hardware/tv/tuner/AudioPreselectionRenderingIndicationType.aidl create mode 100644 tv/tuner/aidl/android/hardware/tv/tuner/AudioPresentation.aidl diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPreselection.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPreselection.aidl new file mode 100644 index 0000000000..ab0404e875 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPreselection.aidl @@ -0,0 +1,45 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable AudioPreselection { + int preselectionId; + android.hardware.tv.tuner.AudioPreselectionLabel[] labels; + String language; + android.hardware.tv.tuner.AudioPreselectionRenderingIndicationType renderingIndication; + boolean hasAudioDescription; + boolean hasSpokenSubtitles; + boolean hasDialogueEnhancement; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPreselectionLabel.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPreselectionLabel.aidl new file mode 100644 index 0000000000..79f3b6f008 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPreselectionLabel.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable AudioPreselectionLabel { + String language; + String text; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPreselectionRenderingIndicationType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPreselectionRenderingIndicationType.aidl new file mode 100644 index 0000000000..783511fea8 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPreselectionRenderingIndicationType.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum AudioPreselectionRenderingIndicationType { + NOT_INDICATED = 0, + STEREO = 1, + TWO_DIMENSIONAL = 2, + THREE_DIMENSIONAL = 3, + HEADPHONE = 4, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPresentation.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPresentation.aidl new file mode 100644 index 0000000000..96a6d987c9 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPresentation.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable AudioPresentation { + android.hardware.tv.tuner.AudioPreselection preselection; + int ac4ShortProgramId = -1; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMediaEventExtraMetaData.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMediaEventExtraMetaData.aidl index ab36188069..28caf19580 100644 --- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMediaEventExtraMetaData.aidl +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMediaEventExtraMetaData.aidl @@ -37,4 +37,5 @@ package android.hardware.tv.tuner; union DemuxFilterMediaEventExtraMetaData { boolean noinit; android.hardware.tv.tuner.AudioExtraMetaData audio; + android.hardware.tv.tuner.AudioPresentation[] audioPresentations = {}; } diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/AudioPreselection.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/AudioPreselection.aidl new file mode 100644 index 0000000000..16ef0dd235 --- /dev/null +++ b/tv/tuner/aidl/android/hardware/tv/tuner/AudioPreselection.aidl @@ -0,0 +1,63 @@ +/* + * Copyright 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. + */ + +package android.hardware.tv.tuner; + +import android.hardware.tv.tuner.AudioPreselectionLabel; +import android.hardware.tv.tuner.AudioPreselectionRenderingIndicationType; + +/** + * Audio preselection metadata according to ETSI EN 300 468 V1.17.1. + * @hide + */ +@VintfStability +parcelable AudioPreselection { + /** + * Identifies this audio preselection. The value of this field shall match the corresponding + * field in the elementary stream. + */ + int preselectionId; + + /** + * Collection of audio preselection labels. + */ + AudioPreselectionLabel[] labels; + + /** + * ISO 639-2 3-character code. + */ + String language; + + /** + * A hint for a preferred reproduction channel layout. + */ + AudioPreselectionRenderingIndicationType renderingIndication; + + /** + * Audio preselection contains audio description for the visually impaired. + */ + boolean hasAudioDescription; + + /** + * Audio preselection contains spoken subtitles. + */ + boolean hasSpokenSubtitles; + + /** + * Audio preselection provides support for dialogue enhancement. + */ + boolean hasDialogueEnhancement; +} diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/AudioPreselectionLabel.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/AudioPreselectionLabel.aidl new file mode 100644 index 0000000000..429b02675a --- /dev/null +++ b/tv/tuner/aidl/android/hardware/tv/tuner/AudioPreselectionLabel.aidl @@ -0,0 +1,34 @@ +/* + * Copyright 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. + */ + +package android.hardware.tv.tuner; + +/** + * Audio preselection label according to ETSI EN 300 468 V1.17.1. + * @hide + */ +@VintfStability +parcelable AudioPreselectionLabel { + /** + * ISO 639-2 3-character code. + */ + String language; + + /** + * Text information, written in the language specified, pertaining to the preselection. + */ + String text; +} diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/AudioPreselectionRenderingIndicationType.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/AudioPreselectionRenderingIndicationType.aidl new file mode 100644 index 0000000000..963c55a3a8 --- /dev/null +++ b/tv/tuner/aidl/android/hardware/tv/tuner/AudioPreselectionRenderingIndicationType.aidl @@ -0,0 +1,50 @@ +/* + * Copyright 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. + */ + +package android.hardware.tv.tuner; + +/** + * Audio preselection audio rendering indication according to ETSI EN 300 468 V1.17.1. + * @hide + */ +@VintfStability +@Backing(type="int") +enum AudioPreselectionRenderingIndicationType { + /** + * No preference given for the reproduction channel layout. + */ + NOT_INDICATED, + + /** + * Preferred reproduction channel layout is stereo. + */ + STEREO, + + /** + * Preferred reproduction channel layout is two-dimensional (e.g. 5.1 multi-channel). + */ + TWO_DIMENSIONAL, + + /** + * Preferred reproduction channel layout is three-dimensional. + */ + THREE_DIMENSIONAL, + + /** + * Content is pre-rendered for consumption with headphones. + */ + HEADPHONE, +} diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/AudioPresentation.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/AudioPresentation.aidl new file mode 100644 index 0000000000..50f9d902b9 --- /dev/null +++ b/tv/tuner/aidl/android/hardware/tv/tuner/AudioPresentation.aidl @@ -0,0 +1,38 @@ +/* + * Copyright 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. + */ + +package android.hardware.tv.tuner; + +import android.hardware.tv.tuner.AudioPreselection; + +/** + * Audio presentation metadata. + * @hide + */ +@VintfStability +parcelable AudioPresentation { + /** + * Audio preselection. + */ + AudioPreselection preselection; + + /** + * Dolby AC-4 short program id specified in ETSI TS 103 190-2. For use in conjunction with + * an audio preselection to ensure contininuity of personalized experience during program + * transitions. + */ + int ac4ShortProgramId = -1; +} diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterMediaEventExtraMetaData.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterMediaEventExtraMetaData.aidl index f01952bc43..4ff33a28d4 100644 --- a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterMediaEventExtraMetaData.aidl +++ b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterMediaEventExtraMetaData.aidl @@ -17,6 +17,7 @@ package android.hardware.tv.tuner; import android.hardware.tv.tuner.AudioExtraMetaData; +import android.hardware.tv.tuner.AudioPresentation; /** * Extra Meta Data for DemuxFilterMediaEvent. @@ -30,4 +31,9 @@ union DemuxFilterMediaEventExtraMetaData { boolean noinit; AudioExtraMetaData audio; + + /** + * Audio presentations available for user selection. + */ + AudioPresentation[] audioPresentations = {}; } diff --git a/tv/tuner/aidl/default/Filter.cpp b/tv/tuner/aidl/default/Filter.cpp index 59e301dccb..ba9602e272 100644 --- a/tv/tuner/aidl/default/Filter.cpp +++ b/tv/tuner/aidl/default/Filter.cpp @@ -329,7 +329,8 @@ Filter::~Filter() { // All the filter event callbacks in start are for testing purpose. switch (mType.mainType) { case DemuxFilterMainType::TS: - createMediaEvent(events); + createMediaEvent(events, false); + createMediaEvent(events, true); createTsRecordEvent(events); createTemiEvent(events); break; @@ -1221,15 +1222,7 @@ bool Filter::sameFile(int fd1, int fd2) { return (stat1.st_dev == stat2.st_dev) && (stat1.st_ino == stat2.st_ino); } -void Filter::createMediaEvent(vector& events) { - AudioExtraMetaData audio; - audio.adFade = 1; - audio.adPan = 2; - audio.versionTextTag = 3; - audio.adGainCenter = 4; - audio.adGainFront = 5; - audio.adGainSurround = 6; - +void Filter::createMediaEvent(vector& events, bool isAudioPresentation) { DemuxFilterMediaEvent mediaEvent; mediaEvent.streamId = 1; mediaEvent.isPtsPresent = true; @@ -1239,7 +1232,43 @@ void Filter::createMediaEvent(vector& events) { mediaEvent.isSecureMemory = true; mediaEvent.mpuSequenceNumber = 6; mediaEvent.isPesPrivateData = true; - mediaEvent.extraMetaData.set(audio); + + if (isAudioPresentation) { + AudioPresentation audioPresentation0{ + .preselection.preselectionId = 0, + .preselection.labels = {{"en", "Commentator"}, {"es", "Comentarista"}}, + .preselection.language = "en", + .preselection.renderingIndication = + AudioPreselectionRenderingIndicationType::THREE_DIMENSIONAL, + .preselection.hasAudioDescription = false, + .preselection.hasSpokenSubtitles = false, + .preselection.hasDialogueEnhancement = true, + .ac4ShortProgramId = 42}; + AudioPresentation audioPresentation1{ + .preselection.preselectionId = 1, + .preselection.labels = {{"en", "Crowd"}, {"es", "Multitud"}}, + .preselection.language = "en", + .preselection.renderingIndication = + AudioPreselectionRenderingIndicationType::THREE_DIMENSIONAL, + .preselection.hasAudioDescription = false, + .preselection.hasSpokenSubtitles = false, + .preselection.hasDialogueEnhancement = false, + .ac4ShortProgramId = 42}; + vector audioPresentations; + audioPresentations.push_back(audioPresentation0); + audioPresentations.push_back(audioPresentation1); + mediaEvent.extraMetaData.set( + audioPresentations); + } else { + AudioExtraMetaData audio; + audio.adFade = 1; + audio.adPan = 2; + audio.versionTextTag = 3; + audio.adGainCenter = 4; + audio.adGainFront = 5; + audio.adGainSurround = 6; + mediaEvent.extraMetaData.set(audio); + } int av_fd = createAvIonFd(BUFFER_SIZE); if (av_fd == -1) { diff --git a/tv/tuner/aidl/default/Filter.h b/tv/tuner/aidl/default/Filter.h index f2d9248b68..0985296657 100644 --- a/tv/tuner/aidl/default/Filter.h +++ b/tv/tuner/aidl/default/Filter.h @@ -230,7 +230,7 @@ class Filter : public BnFilter { ::ndk::ScopedAStatus createShareMemMediaEvents(vector& output); bool sameFile(int fd1, int fd2); - void createMediaEvent(vector&); + void createMediaEvent(vector&, bool isAudioPresentation); void createTsRecordEvent(vector&); void createMmtpRecordEvent(vector&); void createSectionEvent(vector&); From 5fc97bb5bfa76964be896f8030fd7323a2f8e128 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Tue, 10 Jan 2023 17:07:47 -0800 Subject: [PATCH 641/998] Add HAL changes for BLIND_SPOT_WARNING_STATE This property supports error states in addition to its own state. This is why the comments mention two @data_enums for this property. This works because states are integer values so as long as all states have distinct integer values, this functions correctly. Bug: 264946039 Test: atest VtsHalAutomotiveVehicle_TargetTest Test: atest CtsCarTestCases:CarPropertyManagerTest Test: atest CtsCarTestCases:VehiclePropertyIdsTest Test: atest CtsCarTestCases:BlindSpotWarningStateTest Test: atest AndroidCarApiTest:BlindSpotWarningStateTest Change-Id: Idc64af44ecdf33ee5c89d3bf7d303498d80a0d14 --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../JsonConfigLoader/src/JsonConfigLoader.cpp | 3 ++ .../config/DefaultProperties.json | 21 +++++++++ .../aidl/impl/default_config/config/README.md | 2 + .../utils/common/include/VehicleHalTypes.h | 1 + .../vehicle/BlindSpotWarningState.aidl | 40 +++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../vehicle/BlindSpotWarningState.aidl | 44 +++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 19 ++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 +++ 13 files changed, 141 insertions(+) create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/BlindSpotWarningState.aidl create mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/BlindSpotWarningState.aidl diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index aef5fe7af9..e9981dff7b 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -242,6 +242,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::FORWARD_COLLISION_WARNING_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::BLIND_SPOT_WARNING_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 4a5840478e..f42d4ae693 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -242,6 +242,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::FORWARD_COLLISION_WARNING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::BLIND_SPOT_WARNING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index eec9daf7eb..7291e854c9 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -234,6 +234,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.BLIND_SPOT_WARNING_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 91c3637562..2e10cc216a 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -234,6 +234,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.BLIND_SPOT_WARNING_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index f39376bb80..d37fada4db 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -36,6 +36,7 @@ namespace jsonconfigloader_impl { using ::aidl::android::hardware::automotive::vehicle::AccessForVehicleProperty; using ::aidl::android::hardware::automotive::vehicle::AutomaticEmergencyBrakingState; +using ::aidl::android::hardware::automotive::vehicle::BlindSpotWarningState; using ::aidl::android::hardware::automotive::vehicle::ChangeModeForVehicleProperty; using ::aidl::android::hardware::automotive::vehicle::ErrorState; using ::aidl::android::hardware::automotive::vehicle::EvConnectorType; @@ -215,6 +216,8 @@ JsonValueParser::JsonValueParser() { std::make_unique>(); mConstantParsersByType["ForwardCollisionWarningState"] = std::make_unique>(); + mConstantParsersByType["BlindSpotWarningState"] = + std::make_unique>(); mConstantParsersByType["Constants"] = std::make_unique(); } diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 50e242819c..313173304f 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3221,6 +3221,27 @@ ] } }, + { + "property": "VehicleProperty::BLIND_SPOT_WARNING_STATE", + "defaultValue": { + "int32Values": [ + "BlindSpotWarningState::NO_WARNING" + ] + }, + "areas": [ + { + "areaId": "Constants::MIRROR_DRIVER_LEFT_RIGHT", + "supportedEnumValues": [ + "ErrorState::NOT_AVAILABLE_SAFETY", + "ErrorState::NOT_AVAILABLE_SPEED_HIGH", + "ErrorState::NOT_AVAILABLE_SPEED_LOW", + "ErrorState::NOT_AVAILABLE_DISABLED", + "BlindSpotWarningState::NO_WARNING", + "BlindSpotWarningState::WARNING" + ] + } + ] + }, { "property": "VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/default_config/config/README.md b/automotive/vehicle/aidl/impl/default_config/config/README.md index a5d8cdf1eb..41ce9a7adb 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/README.md +++ b/automotive/vehicle/aidl/impl/default_config/config/README.md @@ -145,6 +145,8 @@ We support the following constant types: * ForwardCollisionWarningState +* BlindSpotWarningState + * ErrorState * Constants diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index 5a84d581a2..d9d0db03e9 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -18,6 +18,7 @@ #define android_hardware_automotive_vehicle_aidl_impl_utils_common_include_VehicleHalTypes_H_ #include +#include #include #include #include diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/BlindSpotWarningState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/BlindSpotWarningState.aidl new file mode 100644 index 0000000000..535b0b1e2f --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/BlindSpotWarningState.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum BlindSpotWarningState { + OTHER = 0, + NO_WARNING = 1, + WARNING = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 1039347b28..b036bc54e6 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -242,6 +242,7 @@ enum VehicleProperty { FORWARD_COLLISION_WARNING_ENABLED = 287313922, FORWARD_COLLISION_WARNING_STATE = 289411075, BLIND_SPOT_WARNING_ENABLED = 287313924, + BLIND_SPOT_WARNING_STATE = 339742725, LANE_DEPARTURE_WARNING_ENABLED = 287313926, LANE_KEEP_ASSIST_ENABLED = 287313928, LANE_CENTERING_ASSIST_ENABLED = 287313930, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/BlindSpotWarningState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/BlindSpotWarningState.aidl new file mode 100644 index 0000000000..3f567c0dce --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/BlindSpotWarningState.aidl @@ -0,0 +1,44 @@ +/* + * 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.hardware.automotive.vehicle; + +/** + * Used to enumerate the state of Blind Spot Warning State (BSW). + */ +@VintfStability +@Backing(type="int") +enum BlindSpotWarningState { + + /** + * This state is used as an alternative to any BlindSpotWarningState value that is not + * defined in the platform. Ideally, implementations of + * VehicleProperty#BLIND_SPOT_WARNING_STATE should not use this state. The framework + * can use this field to remain backwards compatible if BlindSpotWarningState is + * extended to include additional states. + */ + OTHER = 0, + /** + * BSW is enabled and monitoring safety, but no vehicle or object detected in the vehicle's + * blind spot. + */ + NO_WARNING = 1, + /** + * BSW is enabled, detects a vehicle or object in the vehicle's blind spot, and is actively + * warning the user. + */ + WARNING = 2, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 446a9fa4c3..6c3ce887b0 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3517,6 +3517,25 @@ enum VehicleProperty { BLIND_SPOT_WARNING_ENABLED = 0x1004 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Blind Spot Warning (BSW) state. + * + * Returns the current state of BSW. This property must always return a valid state defined in + * BlindSpotWarningState or ErrorState. It must not surface errors through StatusCode + * and must use the supported error states instead. + * + * For each supported area ID, the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of both BlindSpotWarningState (including OTHER, which is not + * recommended) and ErrorState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum BlindSpotWarningState + * @data_enum ErrorState + */ + BLIND_SPOT_WARNING_STATE = + 0x1005 + VehiclePropertyGroup.SYSTEM + VehicleArea.MIRROR + VehiclePropertyType.INT32, + /** * Enable or disable lane departure warning (LDW). * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 28b4dcf511..6b0fb1bed4 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -708,6 +708,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyBlindSpotWarningEnabledConfig) { VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyBlindSpotWarningStateConfig) { + verifyProperty(VehicleProperty::BLIND_SPOT_WARNING_STATE, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::MIRROR, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneDepartureWarningEnabledConfig) { verifyProperty(VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, From 08e0026339bec7b09f5a0bdad6e8cd85e7fef529 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Tue, 10 Jan 2023 17:10:20 -0800 Subject: [PATCH 642/998] Update BLIND_SPOT_WARNING_ENABLED documentation in HAL An implementation of BLIND_SPOT_WARNING_ENABLED should return false when there's an issue with the ADAS system and it cannot retrieve the property. It should not return NOT_AVAILABLE. Bug: 264946039 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I3f8765b9bbaa96931dd2ae0bab1c8fbc913b261c --- .../android/hardware/automotive/vehicle/VehicleProperty.aidl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 6c3ce887b0..a19eab29aa 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3508,6 +3508,10 @@ enum VehicleProperty { * Set true to enable BSW and false to disable BSW. When BSW is enabled, the ADAS system in the * vehicle should be turned on and monitoring for objects in the vehicle’s blind spots. * + * If BSW is not available, IVehicle#get must not return any NOT_AVAILABLE value in StatusCode. + * Other StatusCode values like TRY_AGAIN may still be used as needed. For example, if BSW is + * not available because the vehicle speed is too low, IVehicle#get must return false. + * * This property is defined as read_write, but OEMs have the option to implement it as read * only. * From 2e8915d69da19cbf79d266081129f0df01a793de Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Mon, 30 Jan 2023 13:04:05 -0800 Subject: [PATCH 643/998] Turn off clang-format for vehicle property generated files clang-format hurts readability for these generated files. Bug: 266986551 Test: manual build Change-Id: I78432f4dd208ab1a554e16342a9a568f9a7a104d --- .../vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h | 2 ++ .../aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h | 2 ++ .../aidl/generated_lib/java/AccessForVehicleProperty.java | 2 ++ .../aidl/generated_lib/java/ChangeModeForVehicleProperty.java | 2 ++ automotive/vehicle/tools/generate_annotation_enums.py | 2 ++ 5 files changed, 10 insertions(+) diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index aef5fe7af9..c2f3ec3980 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -20,6 +20,8 @@ * Generated by tools/generate_annotation_enums.py. */ +// clang-format off + #ifndef android_hardware_automotive_vehicle_aidl_generated_lib_AccessForVehicleProperty_H_ #define android_hardware_automotive_vehicle_aidl_generated_lib_AccessForVehicleProperty_H_ diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 4a5840478e..756d9408d1 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -20,6 +20,8 @@ * Generated by tools/generate_annotation_enums.py. */ +// clang-format off + #ifndef android_hardware_automotive_vehicle_aidl_generated_lib_ChangeModeForVehicleProperty_H_ #define android_hardware_automotive_vehicle_aidl_generated_lib_ChangeModeForVehicleProperty_H_ diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index eec9daf7eb..4c00f7aacf 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -20,6 +20,8 @@ * Generated by tools/generate_annotation_enums.py. */ +// clang-format off + package android.hardware.automotive.vehicle; import java.util.Map; diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 91c3637562..c1370a108e 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -20,6 +20,8 @@ * Generated by tools/generate_annotation_enums.py. */ +// clang-format off + package android.hardware.automotive.vehicle; import java.util.Map; diff --git a/automotive/vehicle/tools/generate_annotation_enums.py b/automotive/vehicle/tools/generate_annotation_enums.py index 85c521aeeb..c36cbb015e 100644 --- a/automotive/vehicle/tools/generate_annotation_enums.py +++ b/automotive/vehicle/tools/generate_annotation_enums.py @@ -69,6 +69,8 @@ LICENSE = """/* * Generated by tools/generate_annotation_enums.py. */ +// clang-format off + """ CHANGE_MODE_CPP_HEADER = """#ifndef android_hardware_automotive_vehicle_aidl_generated_lib_ChangeModeForVehicleProperty_H_ From 1cf817fd00c9394959db87c95eb43ee74986b7c7 Mon Sep 17 00:00:00 2001 From: Lei Ju Date: Mon, 30 Jan 2023 11:19:44 -0800 Subject: [PATCH 644/998] Add an endpoint type for native program Test: compilation Bug: 267197197 Change-Id: Ice7df84065bf9c5acc73e21232e2ccd3d63a8bbe --- .../current/android/hardware/contexthub/HostEndpointInfo.aidl | 1 + .../aidl/android/hardware/contexthub/HostEndpointInfo.aidl | 3 +++ 2 files changed, 4 insertions(+) diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/HostEndpointInfo.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/HostEndpointInfo.aidl index 84e8531eb9..dabdbb6648 100644 --- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/HostEndpointInfo.aidl +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/HostEndpointInfo.aidl @@ -42,5 +42,6 @@ parcelable HostEndpointInfo { enum Type { FRAMEWORK = 1, APP = 2, + NATIVE = 3, } } diff --git a/contexthub/aidl/android/hardware/contexthub/HostEndpointInfo.aidl b/contexthub/aidl/android/hardware/contexthub/HostEndpointInfo.aidl index a9d6657097..c083bb9cfa 100644 --- a/contexthub/aidl/android/hardware/contexthub/HostEndpointInfo.aidl +++ b/contexthub/aidl/android/hardware/contexthub/HostEndpointInfo.aidl @@ -44,5 +44,8 @@ parcelable HostEndpointInfo { /** This endpoint is an Android app. */ APP = 2, + + /** This endpoint is from an Android native program. */ + NATIVE = 3, } } From 2f7bec812a0ae72ec6266b268d3ff650afede314 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Tue, 31 Jan 2023 01:07:38 +0000 Subject: [PATCH 645/998] Make WifiStaIfaces using the create() method. Unlike the default constructor, create() populates the weak_ptr_this_ variable, which is needed for callbacks from the legacy hal. Bug: 265857332 Test: Manual test - connect to an AP and walk away from it. Check that the RSSI callback is triggered in the framework. Change-Id: I1a10a75c07ea59a3e01b9bb68d9d393bbd20d29d --- wifi/aidl/default/wifi_chip.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wifi/aidl/default/wifi_chip.cpp b/wifi/aidl/default/wifi_chip.cpp index 6f43e0669d..541de166ce 100644 --- a/wifi/aidl/default/wifi_chip.cpp +++ b/wifi/aidl/default/wifi_chip.cpp @@ -1146,8 +1146,7 @@ std::pair, ndk::ScopedAStatus> WifiChip::createSt << legacyErrorToString(legacy_status); return {nullptr, createWifiStatusFromLegacyError(legacy_status)}; } - std::shared_ptr iface = - ndk::SharedRefBase::make(ifname, legacy_hal_, iface_util_); + std::shared_ptr iface = WifiStaIface::create(ifname, legacy_hal_, iface_util_); sta_ifaces_.push_back(iface); for (const auto& callback : event_cb_handler_.getCallbacks()) { if (!callback->onIfaceAdded(IfaceType::STA, ifname).isOk()) { From 0cc9032d2b4035e584ed8947c7c734994dcf3350 Mon Sep 17 00:00:00 2001 From: matthuang Date: Sun, 15 Jan 2023 00:30:36 +0800 Subject: [PATCH 646/998] Add group 'uhid' to AIDL sensors multi-HAL Allow sensor hal to send SW_LID event through HID transport drivers when hall_effect event is detected. Bug: 262056923 Test: Build pass. Change-Id: I9b583df6090a5e415abac7bef4bc3b7d28c31b8f --- .../multihal/android.hardware.sensors-service-multihal.rc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sensors/aidl/multihal/android.hardware.sensors-service-multihal.rc b/sensors/aidl/multihal/android.hardware.sensors-service-multihal.rc index 1edfbec640..5aecc54539 100644 --- a/sensors/aidl/multihal/android.hardware.sensors-service-multihal.rc +++ b/sensors/aidl/multihal/android.hardware.sensors-service-multihal.rc @@ -1,7 +1,7 @@ service vendor.sensors-hal-multihal /vendor/bin/hw/android.hardware.sensors-service.multihal class hal user system - group system wakelock context_hub input + group system wakelock context_hub input uhid task_profiles ServiceCapacityLow capabilities BLOCK_SUSPEND - rlimit rtprio 10 10 \ No newline at end of file + rlimit rtprio 10 10 From bcbb103ea093f689b8849e7c028c5d8877a923ab Mon Sep 17 00:00:00 2001 From: Ray Chin Date: Tue, 31 Jan 2023 17:09:06 +0800 Subject: [PATCH 647/998] Increase the size of threadpool to 16 in hal layer Bug: 256771936 Test: atest VtsHalTvTunerTargetTest Change-Id: I0d8f46b9b577337a7fbd42ab50bb1ee91af60210 --- tv/tuner/aidl/default/service.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tv/tuner/aidl/default/service.cpp b/tv/tuner/aidl/default/service.cpp index f980f4aa29..aa9f796744 100644 --- a/tv/tuner/aidl/default/service.cpp +++ b/tv/tuner/aidl/default/service.cpp @@ -26,7 +26,7 @@ using ::aidl::android::hardware::tv::tuner::Tuner; int main() { - ABinderProcess_setThreadPoolMaxThreadCount(8); + ABinderProcess_setThreadPoolMaxThreadCount(16); std::shared_ptr tuner = ndk::SharedRefBase::make(); tuner->init(); From 93bb36fe79b17adf12f67c7d0b0db4b58003403f Mon Sep 17 00:00:00 2001 From: Rakesh Raghava Date: Tue, 24 Jan 2023 07:00:38 +0000 Subject: [PATCH 648/998] [ImsMedia] Add notifyMediaQualityStatus api as per updated imsmedia design - removed notifyMediaInactivity(), notifyPacketLoss() notifyJitter() apis - updated MediaQualityThreshold Bug: 266514335 Test: build (m android.hardware.radio.ims.media-update-api && m -j64) Change-Id: I328a437018d1ddd9e3d7be353d0c2551b850747c --- .../ims/media/IImsMediaSessionListener.aidl | 4 +- ...tocolType.aidl => MediaQualityStatus.aidl} | 12 +++--- .../ims/media/MediaQualityThreshold.aidl | 9 ++-- .../radio/ims/media/IImsMediaSession.aidl | 1 - .../ims/media/IImsMediaSessionListener.aidl | 26 +++--------- .../radio/ims/media/MediaProtocolType.aidl | 26 ------------ .../radio/ims/media/MediaQualityStatus.aidl | 41 +++++++++++++++++++ .../ims/media/MediaQualityThreshold.aidl | 37 ++++++++++++----- 8 files changed, 86 insertions(+), 70 deletions(-) rename radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/{MediaProtocolType.aidl => MediaQualityStatus.aidl} (88%) delete mode 100644 radio/aidl/android/hardware/radio/ims/media/MediaProtocolType.aidl create mode 100644 radio/aidl/android/hardware/radio/ims/media/MediaQualityStatus.aidl diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl index f03b29e85d..151b45f8e1 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl @@ -37,9 +37,7 @@ interface IImsMediaSessionListener { oneway void onModifySessionResponse(in android.hardware.radio.ims.media.RtpConfig config, android.hardware.radio.ims.media.RtpError error); oneway void onFirstMediaPacketReceived(in android.hardware.radio.ims.media.RtpConfig config); oneway void onHeaderExtensionReceived(in List extensions); - oneway void notifyMediaInactivity(android.hardware.radio.ims.media.MediaProtocolType packetType); - oneway void notifyPacketLoss(int packetLossPercentage); - oneway void notifyJitter(int jitter); + oneway void notifyMediaQualityStatus(in android.hardware.radio.ims.media.MediaQualityStatus quality); oneway void triggerAnbrQuery(in android.hardware.radio.ims.media.RtpConfig config); oneway void onDtmfReceived(char dtmfDigit); oneway void onCallQualityChanged(in android.hardware.radio.ims.media.CallQuality callQuality); diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaProtocolType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityStatus.aidl similarity index 88% rename from radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaProtocolType.aidl rename to radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityStatus.aidl index 1a290d439c..4accf5315b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaProtocolType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityStatus.aidl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 The Android Open Source Project + * 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. @@ -32,8 +32,10 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.radio.ims.media; -@Backing(type="int") @VintfStability -enum MediaProtocolType { - RTP = 0, - RTCP = 1, +@VintfStability +parcelable MediaQualityStatus { + int rtpInactivityTimeMillis; + int rtcpInactivityTimeMillis; + int rtpPacketLossRate; + int rtpJitterMillis; } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityThreshold.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityThreshold.aidl index a448bac1e0..31cf3739a7 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityThreshold.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaQualityThreshold.aidl @@ -34,10 +34,11 @@ package android.hardware.radio.ims.media; @VintfStability parcelable MediaQualityThreshold { - int rtpInactivityTimerMillis; + int[] rtpInactivityTimerMillis; int rtcpInactivityTimerMillis; int rtpPacketLossDurationMillis; - int rtpPacketLossRate; - int jitterDurationMillis; - int rtpJitterMillis; + int rtpHysteresisTimeInMillis; + int[] rtpPacketLossRate; + int[] rtpJitterMillis; + boolean notifyCurrentStatus; } diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl index a8d2161146..ec2fa2b3cd 100644 --- a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSession.aidl @@ -17,7 +17,6 @@ package android.hardware.radio.ims.media; import android.hardware.radio.ims.media.IImsMediaSessionListener; -import android.hardware.radio.ims.media.MediaProtocolType; import android.hardware.radio.ims.media.MediaQualityThreshold; import android.hardware.radio.ims.media.RtpConfig; import android.hardware.radio.ims.media.RtpError; diff --git a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl index d40da64f83..5fc090aa80 100644 --- a/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl @@ -17,7 +17,7 @@ package android.hardware.radio.ims.media; import android.hardware.radio.ims.media.CallQuality; -import android.hardware.radio.ims.media.MediaProtocolType; +import android.hardware.radio.ims.media.MediaQualityStatus; import android.hardware.radio.ims.media.RtpConfig; import android.hardware.radio.ims.media.RtpError; import android.hardware.radio.ims.media.RtpHeaderExtension; @@ -59,28 +59,12 @@ oneway interface IImsMediaSessionListener { void onHeaderExtensionReceived(in List extensions); /** - * Notifies media inactivity observed as per thresholds set by - * setMediaQualityThreshold() API + * Notifies when the measured media quality crosses at least one of + * {@link MediaQualityThreshold} set by {@link IImsMediaSession#setMediaQualityThreshold()}. * - * @param packetType either RTP or RTCP + * @param quality The object of MediaQualityStatus with the rtp and the rtcp statistics. */ - void notifyMediaInactivity(MediaProtocolType packetType); - - /** - * Notifies RTP packet loss observed as per thresholds set by - * setMediaQualityThreshold() API - * - * @param packetLossPercentage percentage of packet loss calculated over the duration - */ - void notifyPacketLoss(int packetLossPercentage); - - /** - * Notifies RTP jitter observed as per thresholds set by - * IImsMediaSession#setMediaQualityThreshold() API - * - * @param jitter jitter of the RTP packets in milliseconds calculated over the duration - */ - void notifyJitter(int jitter); + void notifyMediaQualityStatus(in MediaQualityStatus quality); /** * The modem RTP stack fires this API to query whether the desired bitrate mentioned diff --git a/radio/aidl/android/hardware/radio/ims/media/MediaProtocolType.aidl b/radio/aidl/android/hardware/radio/ims/media/MediaProtocolType.aidl deleted file mode 100644 index 325c6fa69b..0000000000 --- a/radio/aidl/android/hardware/radio/ims/media/MediaProtocolType.aidl +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2021 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.hardware.radio.ims.media; - -@VintfStability -@Backing(type="int") -enum MediaProtocolType { - /** Real Time Protocol, see RFC 3550 */ - RTP = 0, - /** Real Time Control Protocol, see RFC 3550 */ - RTCP = 1, -} diff --git a/radio/aidl/android/hardware/radio/ims/media/MediaQualityStatus.aidl b/radio/aidl/android/hardware/radio/ims/media/MediaQualityStatus.aidl new file mode 100644 index 0000000000..b99e501522 --- /dev/null +++ b/radio/aidl/android/hardware/radio/ims/media/MediaQualityStatus.aidl @@ -0,0 +1,41 @@ +/* + * 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.hardware.radio.ims.media; + +@VintfStability +parcelable MediaQualityStatus { + /** + * Rtp inactivity observed as per threshold set by + * {@link IImsMediaSession#setMediaQualityThreshold()} + */ + int rtpInactivityTimeMillis; + /** + * Rtcp inactivity observed as per threshold set by + * {@link IImsMediaSession#setMediaQualityThreshold()} + */ + int rtcpInactivityTimeMillis; + /** + * Rtp packet loss rate observed as per threshold set by + * {@link IImsMediaSession#setMediaQualityThreshold()} + */ + int rtpPacketLossRate; + /** + * Rtp jitter observed as per threshold set by + * {@link IImsMediaSession#setMediaQualityThreshold()} + */ + int rtpJitterMillis; +} diff --git a/radio/aidl/android/hardware/radio/ims/media/MediaQualityThreshold.aidl b/radio/aidl/android/hardware/radio/ims/media/MediaQualityThreshold.aidl index 946bd5cfbb..bf98928ef0 100644 --- a/radio/aidl/android/hardware/radio/ims/media/MediaQualityThreshold.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/MediaQualityThreshold.aidl @@ -18,19 +18,36 @@ package android.hardware.radio.ims.media; @VintfStability parcelable MediaQualityThreshold { - /** Timer in milliseconds for monitoring RTP inactivity */ - int rtpInactivityTimerMillis; + /** Array including threshold values in milliseconds for monitoring RTP inactivity */ + int[] rtpInactivityTimerMillis; /** Timer in milliseconds for monitoring RTCP inactivity */ int rtcpInactivityTimerMillis; - /** Duration in milliseconds for monitoring the RTP packet loss rate */ + /** + * This value determines the size of the time window (in milliseconds) + * required to calculate the packet loss rate per second for the manner of + * smoothly monitoring changes in the packet loss rate value. + */ int rtpPacketLossDurationMillis; /** - * Packet loss rate in percentage of (total number of packets lost) / - * (total number of packets expected) during rtpPacketLossDurationMs + * The threshold hysteresis time for packet loss and jitter. This has a goal to prevent + * frequent ping-pong notification. So whenever a notifier needs to report the cross of + * threshold in opposite direction, this hysteresis timer should be respected. */ - int rtpPacketLossRate; - /** Duration in milliseconds for monitoring the jitter for RTP traffic */ - int jitterDurationMillis; - /** RTP jitter threshold in milliseconds */ - int rtpJitterMillis; + int rtpHysteresisTimeInMillis; + /** + * Array including threshold values of Packet loss rate in percentage of + * (total number of packets lost) / (total number of packets expected) calculated + * every one sec with the packet received in rtpPacketLossDurationMillis. + */ + int[] rtpPacketLossRate; + + /** Array including threshold values in milliseconds for RTP jitter */ + int[] rtpJitterMillis; + + /** + * A flag indicating whether the client needs to be notified the current media quality status + * right after the threshold is being set. True means the media stack should notify the client + * of the current status. + */ + boolean notifyCurrentStatus; } From 442c89c4cbb12493d24ca2acbe302c9e68151bf9 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Mon, 30 Jan 2023 12:18:01 -0800 Subject: [PATCH 649/998] Update automotive generated AIDL files Bug: 266986551 Test: atest VtsHalAutomotiveVehicle_TargetTest Test: atest CtsCarTestCases:CarPropertyManagerTest Test: atest CtsCarTestCases:VehiclePropertyIdsTest Change-Id: Iedf926b34839e00e224653e6bdcf8fd440c4acf5 --- .../vehicle/Obd2CommonIgnitionMonitors.aidl | 12 +- .../Obd2CompressionIgnitionMonitors.aidl | 36 +- .../vehicle/Obd2SparkIgnitionMonitors.aidl | 44 +- .../hardware/automotive/vehicle/UserInfo.aidl | 12 +- .../VehicleApPowerStateConfigFlag.aidl | 6 +- .../vehicle/VehicleApPowerStateReport.aidl | 20 +- .../automotive/vehicle/VehicleArea.aidl | 14 +- .../automotive/vehicle/VehicleAreaDoor.aidl | 16 +- .../automotive/vehicle/VehicleAreaMirror.aidl | 6 +- .../automotive/vehicle/VehicleAreaSeat.aidl | 18 +- .../automotive/vehicle/VehicleAreaWheel.aidl | 10 +- .../automotive/vehicle/VehicleAreaWindow.aidl | 20 +- .../automotive/vehicle/VehicleGear.aidl | 28 +- .../vehicle/VehicleHvacFanDirection.aidl | 12 +- .../VehicleHwMotionButtonStateFlag.aidl | 14 +- .../vehicle/VehicleIgnitionState.aidl | 8 +- .../vehicle/VehicleLightSwitch.aidl | 2 +- .../automotive/vehicle/VehicleProperty.aidl | 432 +++++++++--------- .../vehicle/VehiclePropertyGroup.aidl | 6 +- .../vehicle/VehiclePropertyType.aidl | 22 +- .../automotive/vehicle/VehicleTurnSignal.aidl | 6 +- .../automotive/vehicle/VehicleUnit.aidl | 66 +-- .../vehicle/VehicleVendorPermission.aidl | 76 +-- 23 files changed, 443 insertions(+), 443 deletions(-) diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl index 73d4a143b7..22eea1f3b9 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl @@ -34,10 +34,10 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum Obd2CommonIgnitionMonitors { - COMPONENTS_AVAILABLE = 1, - COMPONENTS_INCOMPLETE = 2, - FUEL_SYSTEM_AVAILABLE = 4, - FUEL_SYSTEM_INCOMPLETE = 8, - MISFIRE_AVAILABLE = 16, - MISFIRE_INCOMPLETE = 32, + COMPONENTS_AVAILABLE = (0x1 << 0), + COMPONENTS_INCOMPLETE = (0x1 << 1), + FUEL_SYSTEM_AVAILABLE = (0x1 << 2), + FUEL_SYSTEM_INCOMPLETE = (0x1 << 3), + MISFIRE_AVAILABLE = (0x1 << 4), + MISFIRE_INCOMPLETE = (0x1 << 5), } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl index 01104c1baf..335f0ad114 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl @@ -34,22 +34,22 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum Obd2CompressionIgnitionMonitors { - COMPONENTS_AVAILABLE = 1, - COMPONENTS_INCOMPLETE = 2, - FUEL_SYSTEM_AVAILABLE = 4, - FUEL_SYSTEM_INCOMPLETE = 8, - MISFIRE_AVAILABLE = 16, - MISFIRE_INCOMPLETE = 32, - EGR_OR_VVT_AVAILABLE = 64, - EGR_OR_VVT_INCOMPLETE = 128, - PM_FILTER_AVAILABLE = 256, - PM_FILTER_INCOMPLETE = 512, - EXHAUST_GAS_SENSOR_AVAILABLE = 1024, - EXHAUST_GAS_SENSOR_INCOMPLETE = 2048, - BOOST_PRESSURE_AVAILABLE = 4096, - BOOST_PRESSURE_INCOMPLETE = 8192, - NOx_SCR_AVAILABLE = 16384, - NOx_SCR_INCOMPLETE = 32768, - NMHC_CATALYST_AVAILABLE = 65536, - NMHC_CATALYST_INCOMPLETE = 131072, + COMPONENTS_AVAILABLE = (0x1 << 0), + COMPONENTS_INCOMPLETE = (0x1 << 1), + FUEL_SYSTEM_AVAILABLE = (0x1 << 2), + FUEL_SYSTEM_INCOMPLETE = (0x1 << 3), + MISFIRE_AVAILABLE = (0x1 << 4), + MISFIRE_INCOMPLETE = (0x1 << 5), + EGR_OR_VVT_AVAILABLE = (0x1 << 6), + EGR_OR_VVT_INCOMPLETE = (0x1 << 7), + PM_FILTER_AVAILABLE = (0x1 << 8), + PM_FILTER_INCOMPLETE = (0x1 << 9), + EXHAUST_GAS_SENSOR_AVAILABLE = (0x1 << 10), + EXHAUST_GAS_SENSOR_INCOMPLETE = (0x1 << 11), + BOOST_PRESSURE_AVAILABLE = (0x1 << 12), + BOOST_PRESSURE_INCOMPLETE = (0x1 << 13), + NOx_SCR_AVAILABLE = (0x1 << 14), + NOx_SCR_INCOMPLETE = (0x1 << 15), + NMHC_CATALYST_AVAILABLE = (0x1 << 16), + NMHC_CATALYST_INCOMPLETE = (0x1 << 17), } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl index badc29c454..4fc48ce193 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl @@ -34,26 +34,26 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum Obd2SparkIgnitionMonitors { - COMPONENTS_AVAILABLE = 1, - COMPONENTS_INCOMPLETE = 2, - FUEL_SYSTEM_AVAILABLE = 4, - FUEL_SYSTEM_INCOMPLETE = 8, - MISFIRE_AVAILABLE = 16, - MISFIRE_INCOMPLETE = 32, - EGR_AVAILABLE = 64, - EGR_INCOMPLETE = 128, - OXYGEN_SENSOR_HEATER_AVAILABLE = 256, - OXYGEN_SENSOR_HEATER_INCOMPLETE = 512, - OXYGEN_SENSOR_AVAILABLE = 1024, - OXYGEN_SENSOR_INCOMPLETE = 2048, - AC_REFRIGERANT_AVAILABLE = 4096, - AC_REFRIGERANT_INCOMPLETE = 8192, - SECONDARY_AIR_SYSTEM_AVAILABLE = 16384, - SECONDARY_AIR_SYSTEM_INCOMPLETE = 32768, - EVAPORATIVE_SYSTEM_AVAILABLE = 65536, - EVAPORATIVE_SYSTEM_INCOMPLETE = 131072, - HEATED_CATALYST_AVAILABLE = 262144, - HEATED_CATALYST_INCOMPLETE = 524288, - CATALYST_AVAILABLE = 1048576, - CATALYST_INCOMPLETE = 2097152, + COMPONENTS_AVAILABLE = (0x1 << 0), + COMPONENTS_INCOMPLETE = (0x1 << 1), + FUEL_SYSTEM_AVAILABLE = (0x1 << 2), + FUEL_SYSTEM_INCOMPLETE = (0x1 << 3), + MISFIRE_AVAILABLE = (0x1 << 4), + MISFIRE_INCOMPLETE = (0x1 << 5), + EGR_AVAILABLE = (0x1 << 6), + EGR_INCOMPLETE = (0x1 << 7), + OXYGEN_SENSOR_HEATER_AVAILABLE = (0x1 << 8), + OXYGEN_SENSOR_HEATER_INCOMPLETE = (0x1 << 9), + OXYGEN_SENSOR_AVAILABLE = (0x1 << 10), + OXYGEN_SENSOR_INCOMPLETE = (0x1 << 11), + AC_REFRIGERANT_AVAILABLE = (0x1 << 12), + AC_REFRIGERANT_INCOMPLETE = (0x1 << 13), + SECONDARY_AIR_SYSTEM_AVAILABLE = (0x1 << 14), + SECONDARY_AIR_SYSTEM_INCOMPLETE = (0x1 << 15), + EVAPORATIVE_SYSTEM_AVAILABLE = (0x1 << 16), + EVAPORATIVE_SYSTEM_INCOMPLETE = (0x1 << 17), + HEATED_CATALYST_AVAILABLE = (0x1 << 18), + HEATED_CATALYST_INCOMPLETE = (0x1 << 19), + CATALYST_AVAILABLE = (0x1 << 20), + CATALYST_INCOMPLETE = (0x1 << 21), } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UserInfo.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UserInfo.aidl index f47d5e74bb..feb5a73ed4 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UserInfo.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/UserInfo.aidl @@ -36,10 +36,10 @@ package android.hardware.automotive.vehicle; parcelable UserInfo { int userId = 0; int flags; - const int USER_FLAG_SYSTEM = 1; - const int USER_FLAG_GUEST = 2; - const int USER_FLAG_EPHEMERAL = 4; - const int USER_FLAG_ADMIN = 8; - const int USER_FLAG_DISABLED = 16; - const int USER_FLAG_PROFILE = 32; + const int USER_FLAG_SYSTEM = 0x01; + const int USER_FLAG_GUEST = 0x02; + const int USER_FLAG_EPHEMERAL = 0x04; + const int USER_FLAG_ADMIN = 0x08; + const int USER_FLAG_DISABLED = 0x10; + const int USER_FLAG_PROFILE = 0x20; } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl index d7b874a0be..cc12490233 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl @@ -34,7 +34,7 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum VehicleApPowerStateConfigFlag { - ENABLE_DEEP_SLEEP_FLAG = 1, - CONFIG_SUPPORT_TIMER_POWER_ON_FLAG = 2, - ENABLE_HIBERNATION_FLAG = 4, + ENABLE_DEEP_SLEEP_FLAG = 0x1, + CONFIG_SUPPORT_TIMER_POWER_ON_FLAG = 0x2, + ENABLE_HIBERNATION_FLAG = 0x4, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl index fc669ec17c..e4f7e54f75 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl @@ -34,14 +34,14 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum VehicleApPowerStateReport { - WAIT_FOR_VHAL = 1, - DEEP_SLEEP_ENTRY = 2, - DEEP_SLEEP_EXIT = 3, - SHUTDOWN_POSTPONE = 4, - SHUTDOWN_START = 5, - ON = 6, - SHUTDOWN_PREPARE = 7, - SHUTDOWN_CANCELLED = 8, - HIBERNATION_ENTRY = 9, - HIBERNATION_EXIT = 10, + WAIT_FOR_VHAL = 0x1, + DEEP_SLEEP_ENTRY = 0x2, + DEEP_SLEEP_EXIT = 0x3, + SHUTDOWN_POSTPONE = 0x4, + SHUTDOWN_START = 0x5, + ON = 0x6, + SHUTDOWN_PREPARE = 0x7, + SHUTDOWN_CANCELLED = 0x8, + HIBERNATION_ENTRY = 0x9, + HIBERNATION_EXIT = 0xA, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleArea.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleArea.aidl index 4f8b917256..db867f4cc1 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleArea.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleArea.aidl @@ -34,11 +34,11 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum VehicleArea { - GLOBAL = 16777216, - WINDOW = 50331648, - MIRROR = 67108864, - SEAT = 83886080, - DOOR = 100663296, - WHEEL = 117440512, - MASK = 251658240, + GLOBAL = 0x01000000, + WINDOW = 0x03000000, + MIRROR = 0x04000000, + SEAT = 0x05000000, + DOOR = 0x06000000, + WHEEL = 0x07000000, + MASK = 0x0f000000, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl index 11139f9a3a..04976d631d 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl @@ -34,12 +34,12 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum VehicleAreaDoor { - ROW_1_LEFT = 1, - ROW_1_RIGHT = 4, - ROW_2_LEFT = 16, - ROW_2_RIGHT = 64, - ROW_3_LEFT = 256, - ROW_3_RIGHT = 1024, - HOOD = 268435456, - REAR = 536870912, + ROW_1_LEFT = 0x00000001, + ROW_1_RIGHT = 0x00000004, + ROW_2_LEFT = 0x00000010, + ROW_2_RIGHT = 0x00000040, + ROW_3_LEFT = 0x00000100, + ROW_3_RIGHT = 0x00000400, + HOOD = 0x10000000, + REAR = 0x20000000, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl index c1e2fbd6ff..2d1c0483a2 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl @@ -34,7 +34,7 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum VehicleAreaMirror { - DRIVER_LEFT = 1, - DRIVER_RIGHT = 2, - DRIVER_CENTER = 4, + DRIVER_LEFT = 0x00000001, + DRIVER_RIGHT = 0x00000002, + DRIVER_CENTER = 0x00000004, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl index e76de324d3..44c9d54567 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl @@ -34,13 +34,13 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum VehicleAreaSeat { - ROW_1_LEFT = 1, - ROW_1_CENTER = 2, - ROW_1_RIGHT = 4, - ROW_2_LEFT = 16, - ROW_2_CENTER = 32, - ROW_2_RIGHT = 64, - ROW_3_LEFT = 256, - ROW_3_CENTER = 512, - ROW_3_RIGHT = 1024, + ROW_1_LEFT = 0x0001, + ROW_1_CENTER = 0x0002, + ROW_1_RIGHT = 0x0004, + ROW_2_LEFT = 0x0010, + ROW_2_CENTER = 0x0020, + ROW_2_RIGHT = 0x0040, + ROW_3_LEFT = 0x0100, + ROW_3_CENTER = 0x0200, + ROW_3_RIGHT = 0x0400, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl index 9e834340b1..d1b314e0ac 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl @@ -34,9 +34,9 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum VehicleAreaWheel { - UNKNOWN = 0, - LEFT_FRONT = 1, - RIGHT_FRONT = 2, - LEFT_REAR = 4, - RIGHT_REAR = 8, + UNKNOWN = 0x0, + LEFT_FRONT = 0x1, + RIGHT_FRONT = 0x2, + LEFT_REAR = 0x4, + RIGHT_REAR = 0x8, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl index 6ec26fe261..2afcca3dd1 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl @@ -34,14 +34,14 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum VehicleAreaWindow { - FRONT_WINDSHIELD = 1, - REAR_WINDSHIELD = 2, - ROW_1_LEFT = 16, - ROW_1_RIGHT = 64, - ROW_2_LEFT = 256, - ROW_2_RIGHT = 1024, - ROW_3_LEFT = 4096, - ROW_3_RIGHT = 16384, - ROOF_TOP_1 = 65536, - ROOF_TOP_2 = 131072, + FRONT_WINDSHIELD = 0x00000001, + REAR_WINDSHIELD = 0x00000002, + ROW_1_LEFT = 0x00000010, + ROW_1_RIGHT = 0x00000040, + ROW_2_LEFT = 0x00000100, + ROW_2_RIGHT = 0x00000400, + ROW_3_LEFT = 0x00001000, + ROW_3_RIGHT = 0x00004000, + ROOF_TOP_1 = 0x00010000, + ROOF_TOP_2 = 0x00020000, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleGear.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleGear.aidl index db4760d7a3..b8a299c41a 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleGear.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleGear.aidl @@ -34,18 +34,18 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum VehicleGear { - GEAR_UNKNOWN = 0, - GEAR_NEUTRAL = 1, - GEAR_REVERSE = 2, - GEAR_PARK = 4, - GEAR_DRIVE = 8, - GEAR_1 = 16, - GEAR_2 = 32, - GEAR_3 = 64, - GEAR_4 = 128, - GEAR_5 = 256, - GEAR_6 = 512, - GEAR_7 = 1024, - GEAR_8 = 2048, - GEAR_9 = 4096, + GEAR_UNKNOWN = 0x0000, + GEAR_NEUTRAL = 0x0001, + GEAR_REVERSE = 0x0002, + GEAR_PARK = 0x0004, + GEAR_DRIVE = 0x0008, + GEAR_1 = 0x0010, + GEAR_2 = 0x0020, + GEAR_3 = 0x0040, + GEAR_4 = 0x0080, + GEAR_5 = 0x0100, + GEAR_6 = 0x0200, + GEAR_7 = 0x0400, + GEAR_8 = 0x0800, + GEAR_9 = 0x1000, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl index a85751f94f..4f9870a674 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl @@ -34,10 +34,10 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum VehicleHvacFanDirection { - UNKNOWN = 0, - FACE = 1, - FLOOR = 2, - FACE_AND_FLOOR = 3, - DEFROST = 4, - DEFROST_AND_FLOOR = 6, + UNKNOWN = 0x0, + FACE = 0x1, + FLOOR = 0x2, + FACE_AND_FLOOR = 0x3, + DEFROST = 0x4, + DEFROST_AND_FLOOR = 0x06, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl index a7fee0806c..29c5ed6f6e 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl @@ -34,11 +34,11 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum VehicleHwMotionButtonStateFlag { - BUTTON_PRIMARY = 1, - BUTTON_SECONDARY = 2, - BUTTON_TERTIARY = 4, - BUTTON_BACK = 8, - BUTTON_FORWARD = 16, - BUTTON_STYLUS_PRIMARY = 32, - BUTTON_STYLUS_SECONDARY = 64, + BUTTON_PRIMARY = 0x0001, + BUTTON_SECONDARY = 0x0002, + BUTTON_TERTIARY = 0x0004, + BUTTON_BACK = 0x0008, + BUTTON_FORWARD = 0x0010, + BUTTON_STYLUS_PRIMARY = 0x0020, + BUTTON_STYLUS_SECONDARY = 0x0040, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl index 09d5423edc..f572a128bb 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl @@ -36,8 +36,8 @@ package android.hardware.automotive.vehicle; enum VehicleIgnitionState { UNDEFINED = 0, LOCK = 1, - OFF = 2, - ACC = 3, - ON = 4, - START = 5, + OFF, + ACC, + ON, + START, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl index 0d3c636b16..f244884f98 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl @@ -37,5 +37,5 @@ enum VehicleLightSwitch { OFF = 0, ON = 1, DAYTIME_RUNNING = 2, - AUTOMATIC = 256, + AUTOMATIC = 0x100, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index d20ab6e974..61e7add6d4 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -34,220 +34,220 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum VehicleProperty { - INVALID = 0, - INFO_VIN = 286261504, - INFO_MAKE = 286261505, - INFO_MODEL = 286261506, - INFO_MODEL_YEAR = 289407235, - INFO_FUEL_CAPACITY = 291504388, - INFO_FUEL_TYPE = 289472773, - INFO_EV_BATTERY_CAPACITY = 291504390, - INFO_EV_CONNECTOR_TYPE = 289472775, - INFO_FUEL_DOOR_LOCATION = 289407240, - INFO_EV_PORT_LOCATION = 289407241, - INFO_DRIVER_SEAT = 356516106, - INFO_EXTERIOR_DIMENSIONS = 289472779, - INFO_MULTI_EV_PORT_LOCATIONS = 289472780, - PERF_ODOMETER = 291504644, - PERF_VEHICLE_SPEED = 291504647, - PERF_VEHICLE_SPEED_DISPLAY = 291504648, - PERF_STEERING_ANGLE = 291504649, - PERF_REAR_STEERING_ANGLE = 291504656, - ENGINE_COOLANT_TEMP = 291504897, - ENGINE_OIL_LEVEL = 289407747, - ENGINE_OIL_TEMP = 291504900, - ENGINE_RPM = 291504901, - WHEEL_TICK = 290521862, - FUEL_LEVEL = 291504903, - FUEL_DOOR_OPEN = 287310600, - EV_BATTERY_LEVEL = 291504905, - EV_CURRENT_BATTERY_CAPACITY = 291504909, - EV_CHARGE_PORT_OPEN = 287310602, - EV_CHARGE_PORT_CONNECTED = 287310603, - EV_BATTERY_INSTANTANEOUS_CHARGE_RATE = 291504908, - RANGE_REMAINING = 291504904, - TIRE_PRESSURE = 392168201, - CRITICALLY_LOW_TIRE_PRESSURE = 392168202, - ENGINE_IDLE_AUTO_STOP_ENABLED = 287310624, - GEAR_SELECTION = 289408000, - CURRENT_GEAR = 289408001, - PARKING_BRAKE_ON = 287310850, - PARKING_BRAKE_AUTO_APPLY = 287310851, - EV_BRAKE_REGENERATION_LEVEL = 289408012, - FUEL_LEVEL_LOW = 287310853, - NIGHT_MODE = 287310855, - TURN_SIGNAL_STATE = 289408008, - IGNITION_STATE = 289408009, - ABS_ACTIVE = 287310858, - TRACTION_CONTROL_ACTIVE = 287310859, - EV_STOPPING_MODE = 289408013, - HVAC_FAN_SPEED = 356517120, - HVAC_FAN_DIRECTION = 356517121, - HVAC_TEMPERATURE_CURRENT = 358614274, - HVAC_TEMPERATURE_SET = 358614275, - HVAC_DEFROSTER = 320865540, - HVAC_AC_ON = 354419973, - HVAC_MAX_AC_ON = 354419974, - HVAC_MAX_DEFROST_ON = 354419975, - HVAC_RECIRC_ON = 354419976, - HVAC_DUAL_ON = 354419977, - HVAC_AUTO_ON = 354419978, - HVAC_SEAT_TEMPERATURE = 356517131, - HVAC_SIDE_MIRROR_HEAT = 339739916, - HVAC_STEERING_WHEEL_HEAT = 289408269, - HVAC_TEMPERATURE_DISPLAY_UNITS = 289408270, - HVAC_ACTUAL_FAN_SPEED_RPM = 356517135, - HVAC_POWER_ON = 354419984, - HVAC_FAN_DIRECTION_AVAILABLE = 356582673, - HVAC_AUTO_RECIRC_ON = 354419986, - HVAC_SEAT_VENTILATION = 356517139, - HVAC_ELECTRIC_DEFROSTER_ON = 320865556, - HVAC_TEMPERATURE_VALUE_SUGGESTION = 291570965, - DISTANCE_DISPLAY_UNITS = 289408512, - FUEL_VOLUME_DISPLAY_UNITS = 289408513, - TIRE_PRESSURE_DISPLAY_UNITS = 289408514, - EV_BATTERY_DISPLAY_UNITS = 289408515, - FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME = 287311364, - VEHICLE_SPEED_DISPLAY_UNITS = 289408517, - EXTERNAL_CAR_TIME = 290457096, - ANDROID_EPOCH_TIME = 290457094, - STORAGE_ENCRYPTION_BINDING_SEED = 292554247, - ENV_OUTSIDE_TEMPERATURE = 291505923, - AP_POWER_STATE_REQ = 289475072, - AP_POWER_STATE_REPORT = 289475073, - AP_POWER_BOOTUP_REASON = 289409538, - DISPLAY_BRIGHTNESS = 289409539, - HW_KEY_INPUT = 289475088, - HW_KEY_INPUT_V2 = 367004177, - HW_MOTION_INPUT = 367004178, - HW_ROTARY_INPUT = 289475104, - HW_CUSTOM_INPUT = 289475120, - DOOR_POS = 373295872, - DOOR_MOVE = 373295873, - DOOR_LOCK = 371198722, - DOOR_CHILD_LOCK_ENABLED = 371198723, - MIRROR_Z_POS = 339741504, - MIRROR_Z_MOVE = 339741505, - MIRROR_Y_POS = 339741506, - MIRROR_Y_MOVE = 339741507, - MIRROR_LOCK = 287312708, - MIRROR_FOLD = 287312709, - MIRROR_AUTO_FOLD_ENABLED = 337644358, - MIRROR_AUTO_TILT_ENABLED = 337644359, - SEAT_MEMORY_SELECT = 356518784, - SEAT_MEMORY_SET = 356518785, - SEAT_BELT_BUCKLED = 354421634, - SEAT_BELT_HEIGHT_POS = 356518787, - SEAT_BELT_HEIGHT_MOVE = 356518788, - SEAT_FORE_AFT_POS = 356518789, - SEAT_FORE_AFT_MOVE = 356518790, - SEAT_BACKREST_ANGLE_1_POS = 356518791, - SEAT_BACKREST_ANGLE_1_MOVE = 356518792, - SEAT_BACKREST_ANGLE_2_POS = 356518793, - SEAT_BACKREST_ANGLE_2_MOVE = 356518794, - SEAT_HEIGHT_POS = 356518795, - SEAT_HEIGHT_MOVE = 356518796, - SEAT_DEPTH_POS = 356518797, - SEAT_DEPTH_MOVE = 356518798, - SEAT_TILT_POS = 356518799, - SEAT_TILT_MOVE = 356518800, - SEAT_LUMBAR_FORE_AFT_POS = 356518801, - SEAT_LUMBAR_FORE_AFT_MOVE = 356518802, - SEAT_LUMBAR_SIDE_SUPPORT_POS = 356518803, - SEAT_LUMBAR_SIDE_SUPPORT_MOVE = 356518804, - SEAT_HEADREST_HEIGHT_POS = 289409941, - SEAT_HEADREST_HEIGHT_POS_V2 = 356518820, - SEAT_HEADREST_HEIGHT_MOVE = 356518806, - SEAT_HEADREST_ANGLE_POS = 356518807, - SEAT_HEADREST_ANGLE_MOVE = 356518808, - SEAT_HEADREST_FORE_AFT_POS = 356518809, - SEAT_HEADREST_FORE_AFT_MOVE = 356518810, - SEAT_FOOTWELL_LIGHTS_STATE = 356518811, - SEAT_FOOTWELL_LIGHTS_SWITCH = 356518812, - SEAT_EASY_ACCESS_ENABLED = 354421661, - SEAT_AIRBAG_ENABLED = 354421662, - SEAT_CUSHION_SIDE_SUPPORT_POS = 356518815, - SEAT_CUSHION_SIDE_SUPPORT_MOVE = 356518816, - SEAT_LUMBAR_VERTICAL_POS = 356518817, - SEAT_LUMBAR_VERTICAL_MOVE = 356518818, - SEAT_WALK_IN_POS = 356518819, - SEAT_OCCUPANCY = 356518832, - WINDOW_POS = 322964416, - WINDOW_MOVE = 322964417, - WINDOW_LOCK = 320867268, - STEERING_WHEEL_DEPTH_POS = 289410016, - STEERING_WHEEL_DEPTH_MOVE = 289410017, - STEERING_WHEEL_HEIGHT_POS = 289410018, - STEERING_WHEEL_HEIGHT_MOVE = 289410019, - STEERING_WHEEL_THEFT_LOCK_ENABLED = 287312868, - STEERING_WHEEL_LOCKED = 287312869, - STEERING_WHEEL_EASY_ACCESS_ENABLED = 287312870, - VEHICLE_MAP_SERVICE = 299895808, - OBD2_LIVE_FRAME = 299896064, - OBD2_FREEZE_FRAME = 299896065, - OBD2_FREEZE_FRAME_INFO = 299896066, - OBD2_FREEZE_FRAME_CLEAR = 299896067, - HEADLIGHTS_STATE = 289410560, - HIGH_BEAM_LIGHTS_STATE = 289410561, - FOG_LIGHTS_STATE = 289410562, - HAZARD_LIGHTS_STATE = 289410563, - HEADLIGHTS_SWITCH = 289410576, - HIGH_BEAM_LIGHTS_SWITCH = 289410577, - FOG_LIGHTS_SWITCH = 289410578, - HAZARD_LIGHTS_SWITCH = 289410579, - CABIN_LIGHTS_STATE = 289410817, - CABIN_LIGHTS_SWITCH = 289410818, - READING_LIGHTS_STATE = 356519683, - READING_LIGHTS_SWITCH = 356519684, - STEERING_WHEEL_LIGHTS_STATE = 289410828, - STEERING_WHEEL_LIGHTS_SWITCH = 289410829, - SUPPORT_CUSTOMIZE_VENDOR_PERMISSION = 287313669, - DISABLED_OPTIONAL_FEATURES = 286265094, - INITIAL_USER_INFO = 299896583, - SWITCH_USER = 299896584, - CREATE_USER = 299896585, - REMOVE_USER = 299896586, - USER_IDENTIFICATION_ASSOCIATION = 299896587, - EVS_SERVICE_REQUEST = 289476368, - POWER_POLICY_REQ = 286265121, - POWER_POLICY_GROUP_REQ = 286265122, - CURRENT_POWER_POLICY = 286265123, - WATCHDOG_ALIVE = 290459441, - WATCHDOG_TERMINATED_PROCESS = 299896626, - VHAL_HEARTBEAT = 290459443, - CLUSTER_SWITCH_UI = 289410868, - CLUSTER_DISPLAY_STATE = 289476405, - CLUSTER_REPORT_STATE = 299896630, - CLUSTER_REQUEST_DISPLAY = 289410871, - CLUSTER_NAVIGATION_STATE = 292556600, - ELECTRONIC_TOLL_COLLECTION_CARD_TYPE = 289410873, - ELECTRONIC_TOLL_COLLECTION_CARD_STATUS = 289410874, - FRONT_FOG_LIGHTS_STATE = 289410875, - FRONT_FOG_LIGHTS_SWITCH = 289410876, - REAR_FOG_LIGHTS_STATE = 289410877, - REAR_FOG_LIGHTS_SWITCH = 289410878, - EV_CHARGE_CURRENT_DRAW_LIMIT = 291508031, - EV_CHARGE_PERCENT_LIMIT = 291508032, - EV_CHARGE_STATE = 289410881, - EV_CHARGE_SWITCH = 287313730, - EV_CHARGE_TIME_REMAINING = 289410883, - EV_REGENERATIVE_BRAKING_STATE = 289410884, - TRAILER_PRESENT = 289410885, - VEHICLE_CURB_WEIGHT = 289410886, - GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT = 289410887, - SUPPORTED_PROPERTY_IDS = 289476424, - SHUTDOWN_REQUEST = 289410889, - AUTOMATIC_EMERGENCY_BRAKING_ENABLED = 287313920, - AUTOMATIC_EMERGENCY_BRAKING_STATE = 289411073, - FORWARD_COLLISION_WARNING_ENABLED = 287313922, - FORWARD_COLLISION_WARNING_STATE = 289411075, - BLIND_SPOT_WARNING_ENABLED = 287313924, - BLIND_SPOT_WARNING_STATE = 339742725, - LANE_DEPARTURE_WARNING_ENABLED = 287313926, - LANE_KEEP_ASSIST_ENABLED = 287313928, - LANE_CENTERING_ASSIST_ENABLED = 287313930, - EMERGENCY_LANE_KEEP_ASSIST_ENABLED = 287313933, - ADAPTIVE_CRUISE_CONTROL_ENABLED = 287313935, - HANDS_ON_DETECTION_ENABLED = 287313942, - DRIVER_ATTENTION_MONITORING_ENABLED = 287313945, + INVALID = 0x00000000, + INFO_VIN = (((0x0100 + 0x10000000) + 0x01000000) + 0x00100000), + INFO_MAKE = (((0x0101 + 0x10000000) + 0x01000000) + 0x00100000), + INFO_MODEL = (((0x0102 + 0x10000000) + 0x01000000) + 0x00100000), + INFO_MODEL_YEAR = (((0x0103 + 0x10000000) + 0x01000000) + 0x00400000), + INFO_FUEL_CAPACITY = (((0x0104 + 0x10000000) + 0x01000000) + 0x00600000), + INFO_FUEL_TYPE = (((0x0105 + 0x10000000) + 0x01000000) + 0x00410000), + INFO_EV_BATTERY_CAPACITY = (((0x0106 + 0x10000000) + 0x01000000) + 0x00600000), + INFO_EV_CONNECTOR_TYPE = (((0x0107 + 0x10000000) + 0x01000000) + 0x00410000), + INFO_FUEL_DOOR_LOCATION = (((0x0108 + 0x10000000) + 0x01000000) + 0x00400000), + INFO_EV_PORT_LOCATION = (((0x0109 + 0x10000000) + 0x01000000) + 0x00400000), + INFO_DRIVER_SEAT = (((0x010A + 0x10000000) + 0x05000000) + 0x00400000), + INFO_EXTERIOR_DIMENSIONS = (((0x010B + 0x10000000) + 0x01000000) + 0x00410000), + INFO_MULTI_EV_PORT_LOCATIONS = (((0x010C + 0x10000000) + 0x01000000) + 0x00410000), + PERF_ODOMETER = (((0x0204 + 0x10000000) + 0x01000000) + 0x00600000), + PERF_VEHICLE_SPEED = (((0x0207 + 0x10000000) + 0x01000000) + 0x00600000), + PERF_VEHICLE_SPEED_DISPLAY = (((0x0208 + 0x10000000) + 0x01000000) + 0x00600000), + PERF_STEERING_ANGLE = (((0x0209 + 0x10000000) + 0x01000000) + 0x00600000), + PERF_REAR_STEERING_ANGLE = (((0x0210 + 0x10000000) + 0x01000000) + 0x00600000), + ENGINE_COOLANT_TEMP = (((0x0301 + 0x10000000) + 0x01000000) + 0x00600000), + ENGINE_OIL_LEVEL = (((0x0303 + 0x10000000) + 0x01000000) + 0x00400000), + ENGINE_OIL_TEMP = (((0x0304 + 0x10000000) + 0x01000000) + 0x00600000), + ENGINE_RPM = (((0x0305 + 0x10000000) + 0x01000000) + 0x00600000), + WHEEL_TICK = (((0x0306 + 0x10000000) + 0x01000000) + 0x00510000), + FUEL_LEVEL = (((0x0307 + 0x10000000) + 0x01000000) + 0x00600000), + FUEL_DOOR_OPEN = (((0x0308 + 0x10000000) + 0x01000000) + 0x00200000), + EV_BATTERY_LEVEL = (((0x0309 + 0x10000000) + 0x01000000) + 0x00600000), + EV_CURRENT_BATTERY_CAPACITY = (((0x030D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.FLOAT), + EV_CHARGE_PORT_OPEN = (((0x030A + 0x10000000) + 0x01000000) + 0x00200000), + EV_CHARGE_PORT_CONNECTED = (((0x030B + 0x10000000) + 0x01000000) + 0x00200000), + EV_BATTERY_INSTANTANEOUS_CHARGE_RATE = (((0x030C + 0x10000000) + 0x01000000) + 0x00600000), + RANGE_REMAINING = (((0x0308 + 0x10000000) + 0x01000000) + 0x00600000), + TIRE_PRESSURE = (((0x0309 + 0x10000000) + 0x07000000) + 0x00600000), + CRITICALLY_LOW_TIRE_PRESSURE = (((0x030A + 0x10000000) + 0x07000000) + 0x00600000), + ENGINE_IDLE_AUTO_STOP_ENABLED = (((0x0320 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), + GEAR_SELECTION = (((0x0400 + 0x10000000) + 0x01000000) + 0x00400000), + CURRENT_GEAR = (((0x0401 + 0x10000000) + 0x01000000) + 0x00400000), + PARKING_BRAKE_ON = (((0x0402 + 0x10000000) + 0x01000000) + 0x00200000), + PARKING_BRAKE_AUTO_APPLY = (((0x0403 + 0x10000000) + 0x01000000) + 0x00200000), + EV_BRAKE_REGENERATION_LEVEL = (((0x040C + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), + FUEL_LEVEL_LOW = (((0x0405 + 0x10000000) + 0x01000000) + 0x00200000), + NIGHT_MODE = (((0x0407 + 0x10000000) + 0x01000000) + 0x00200000), + TURN_SIGNAL_STATE = (((0x0408 + 0x10000000) + 0x01000000) + 0x00400000), + IGNITION_STATE = (((0x0409 + 0x10000000) + 0x01000000) + 0x00400000), + ABS_ACTIVE = (((0x040A + 0x10000000) + 0x01000000) + 0x00200000), + TRACTION_CONTROL_ACTIVE = (((0x040B + 0x10000000) + 0x01000000) + 0x00200000), + EV_STOPPING_MODE = (((0x040D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), + HVAC_FAN_SPEED = (((0x0500 + 0x10000000) + 0x05000000) + 0x00400000), + HVAC_FAN_DIRECTION = (((0x0501 + 0x10000000) + 0x05000000) + 0x00400000), + HVAC_TEMPERATURE_CURRENT = (((0x0502 + 0x10000000) + 0x05000000) + 0x00600000), + HVAC_TEMPERATURE_SET = (((0x0503 + 0x10000000) + 0x05000000) + 0x00600000), + HVAC_DEFROSTER = (((0x0504 + 0x10000000) + 0x03000000) + 0x00200000), + HVAC_AC_ON = (((0x0505 + 0x10000000) + 0x05000000) + 0x00200000), + HVAC_MAX_AC_ON = (((0x0506 + 0x10000000) + 0x05000000) + 0x00200000), + HVAC_MAX_DEFROST_ON = (((0x0507 + 0x10000000) + 0x05000000) + 0x00200000), + HVAC_RECIRC_ON = (((0x0508 + 0x10000000) + 0x05000000) + 0x00200000), + HVAC_DUAL_ON = (((0x0509 + 0x10000000) + 0x05000000) + 0x00200000), + HVAC_AUTO_ON = (((0x050A + 0x10000000) + 0x05000000) + 0x00200000), + HVAC_SEAT_TEMPERATURE = (((0x050B + 0x10000000) + 0x05000000) + 0x00400000), + HVAC_SIDE_MIRROR_HEAT = (((0x050C + 0x10000000) + 0x04000000) + 0x00400000), + HVAC_STEERING_WHEEL_HEAT = (((0x050D + 0x10000000) + 0x01000000) + 0x00400000), + HVAC_TEMPERATURE_DISPLAY_UNITS = (((0x050E + 0x10000000) + 0x01000000) + 0x00400000), + HVAC_ACTUAL_FAN_SPEED_RPM = (((0x050F + 0x10000000) + 0x05000000) + 0x00400000), + HVAC_POWER_ON = (((0x0510 + 0x10000000) + 0x05000000) + 0x00200000), + HVAC_FAN_DIRECTION_AVAILABLE = (((0x0511 + 0x10000000) + 0x05000000) + 0x00410000), + HVAC_AUTO_RECIRC_ON = (((0x0512 + 0x10000000) + 0x05000000) + 0x00200000), + HVAC_SEAT_VENTILATION = (((0x0513 + 0x10000000) + 0x05000000) + 0x00400000), + HVAC_ELECTRIC_DEFROSTER_ON = (((0x0514 + 0x10000000) + 0x03000000) + 0x00200000), + HVAC_TEMPERATURE_VALUE_SUGGESTION = (((0x0515 + 0x10000000) + 0x01000000) + 0x00610000), + DISTANCE_DISPLAY_UNITS = (((0x0600 + 0x10000000) + 0x01000000) + 0x00400000), + FUEL_VOLUME_DISPLAY_UNITS = (((0x0601 + 0x10000000) + 0x01000000) + 0x00400000), + TIRE_PRESSURE_DISPLAY_UNITS = (((0x0602 + 0x10000000) + 0x01000000) + 0x00400000), + EV_BATTERY_DISPLAY_UNITS = (((0x0603 + 0x10000000) + 0x01000000) + 0x00400000), + FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME = (((0x0604 + 0x10000000) + 0x01000000) + 0x00200000), + VEHICLE_SPEED_DISPLAY_UNITS = (((0x0605 + 0x10000000) + 0x01000000) + 0x00400000), + EXTERNAL_CAR_TIME = (((0x0608 + 0x10000000) + 0x01000000) + 0x00500000), + ANDROID_EPOCH_TIME = (((0x0606 + 0x10000000) + 0x01000000) + 0x00500000), + STORAGE_ENCRYPTION_BINDING_SEED = (((0x0607 + 0x10000000) + 0x01000000) + 0x00700000), + ENV_OUTSIDE_TEMPERATURE = (((0x0703 + 0x10000000) + 0x01000000) + 0x00600000), + AP_POWER_STATE_REQ = (((0x0A00 + 0x10000000) + 0x01000000) + 0x00410000), + AP_POWER_STATE_REPORT = (((0x0A01 + 0x10000000) + 0x01000000) + 0x00410000), + AP_POWER_BOOTUP_REASON = (((0x0A02 + 0x10000000) + 0x01000000) + 0x00400000), + DISPLAY_BRIGHTNESS = (((0x0A03 + 0x10000000) + 0x01000000) + 0x00400000), + HW_KEY_INPUT = (((0x0A10 + 0x10000000) + 0x01000000) + 0x00410000), + HW_KEY_INPUT_V2 = (((0x0A11 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.MIXED), + HW_MOTION_INPUT = (((0x0A12 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.MIXED), + HW_ROTARY_INPUT = (((0x0A20 + 0x10000000) + 0x01000000) + 0x00410000), + HW_CUSTOM_INPUT = (((0X0A30 + 0x10000000) + 0x01000000) + 0x00410000), + DOOR_POS = (((0x0B00 + 0x10000000) + 0x06000000) + 0x00400000), + DOOR_MOVE = (((0x0B01 + 0x10000000) + 0x06000000) + 0x00400000), + DOOR_LOCK = (((0x0B02 + 0x10000000) + 0x06000000) + 0x00200000), + DOOR_CHILD_LOCK_ENABLED = (((0x0B03 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.DOOR) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), + MIRROR_Z_POS = (((0x0B40 + 0x10000000) + 0x04000000) + 0x00400000), + MIRROR_Z_MOVE = (((0x0B41 + 0x10000000) + 0x04000000) + 0x00400000), + MIRROR_Y_POS = (((0x0B42 + 0x10000000) + 0x04000000) + 0x00400000), + MIRROR_Y_MOVE = (((0x0B43 + 0x10000000) + 0x04000000) + 0x00400000), + MIRROR_LOCK = (((0x0B44 + 0x10000000) + 0x01000000) + 0x00200000), + MIRROR_FOLD = (((0x0B45 + 0x10000000) + 0x01000000) + 0x00200000), + MIRROR_AUTO_FOLD_ENABLED = (((0x0B46 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.MIRROR) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), + MIRROR_AUTO_TILT_ENABLED = (((0x0B47 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.MIRROR) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), + SEAT_MEMORY_SELECT = (((0x0B80 + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_MEMORY_SET = (((0x0B81 + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_BELT_BUCKLED = (((0x0B82 + 0x10000000) + 0x05000000) + 0x00200000), + SEAT_BELT_HEIGHT_POS = (((0x0B83 + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_BELT_HEIGHT_MOVE = (((0x0B84 + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_FORE_AFT_POS = (((0x0B85 + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_FORE_AFT_MOVE = (((0x0B86 + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_BACKREST_ANGLE_1_POS = (((0x0B87 + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_BACKREST_ANGLE_1_MOVE = (((0x0B88 + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_BACKREST_ANGLE_2_POS = (((0x0B89 + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_BACKREST_ANGLE_2_MOVE = (((0x0B8A + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_HEIGHT_POS = (((0x0B8B + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_HEIGHT_MOVE = (((0x0B8C + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_DEPTH_POS = (((0x0B8D + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_DEPTH_MOVE = (((0x0B8E + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_TILT_POS = (((0x0B8F + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_TILT_MOVE = (((0x0B90 + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_LUMBAR_FORE_AFT_POS = (((0x0B91 + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_LUMBAR_FORE_AFT_MOVE = (((0x0B92 + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_LUMBAR_SIDE_SUPPORT_POS = (((0x0B93 + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_LUMBAR_SIDE_SUPPORT_MOVE = (((0x0B94 + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_HEADREST_HEIGHT_POS = (((0x0B95 + 0x10000000) + 0x01000000) + 0x00400000), + SEAT_HEADREST_HEIGHT_POS_V2 = (((0x0BA4 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), + SEAT_HEADREST_HEIGHT_MOVE = (((0x0B96 + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_HEADREST_ANGLE_POS = (((0x0B97 + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_HEADREST_ANGLE_MOVE = (((0x0B98 + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_HEADREST_FORE_AFT_POS = (((0x0B99 + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_HEADREST_FORE_AFT_MOVE = (((0x0B9A + 0x10000000) + 0x05000000) + 0x00400000), + SEAT_FOOTWELL_LIGHTS_STATE = (((0x0B9B + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), + SEAT_FOOTWELL_LIGHTS_SWITCH = (((0x0B9C + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), + SEAT_EASY_ACCESS_ENABLED = (((0x0B9D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), + SEAT_AIRBAG_ENABLED = (((0x0B9E + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), + SEAT_CUSHION_SIDE_SUPPORT_POS = (((0x0B9F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), + SEAT_CUSHION_SIDE_SUPPORT_MOVE = (((0x0BA0 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), + SEAT_LUMBAR_VERTICAL_POS = (((0x0BA1 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), + SEAT_LUMBAR_VERTICAL_MOVE = (((0x0BA2 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), + SEAT_WALK_IN_POS = (((0x0BA3 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), + SEAT_OCCUPANCY = (((0x0BB0 + 0x10000000) + 0x05000000) + 0x00400000), + WINDOW_POS = (((0x0BC0 + 0x10000000) + 0x03000000) + 0x00400000), + WINDOW_MOVE = (((0x0BC1 + 0x10000000) + 0x03000000) + 0x00400000), + WINDOW_LOCK = (((0x0BC4 + 0x10000000) + 0x03000000) + 0x00200000), + STEERING_WHEEL_DEPTH_POS = (((0x0BE0 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), + STEERING_WHEEL_DEPTH_MOVE = (((0x0BE1 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), + STEERING_WHEEL_HEIGHT_POS = (((0x0BE2 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), + STEERING_WHEEL_HEIGHT_MOVE = (((0x0BE3 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), + STEERING_WHEEL_THEFT_LOCK_ENABLED = (((0x0BE4 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), + STEERING_WHEEL_LOCKED = (((0x0BE5 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), + STEERING_WHEEL_EASY_ACCESS_ENABLED = (((0x0BE6 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), + VEHICLE_MAP_SERVICE = (((0x0C00 + 0x10000000) + 0x01000000) + 0x00e00000), + OBD2_LIVE_FRAME = (((0x0D00 + 0x10000000) + 0x01000000) + 0x00e00000), + OBD2_FREEZE_FRAME = (((0x0D01 + 0x10000000) + 0x01000000) + 0x00e00000), + OBD2_FREEZE_FRAME_INFO = (((0x0D02 + 0x10000000) + 0x01000000) + 0x00e00000), + OBD2_FREEZE_FRAME_CLEAR = (((0x0D03 + 0x10000000) + 0x01000000) + 0x00e00000), + HEADLIGHTS_STATE = (((0x0E00 + 0x10000000) + 0x01000000) + 0x00400000), + HIGH_BEAM_LIGHTS_STATE = (((0x0E01 + 0x10000000) + 0x01000000) + 0x00400000), + FOG_LIGHTS_STATE = (((0x0E02 + 0x10000000) + 0x01000000) + 0x00400000), + HAZARD_LIGHTS_STATE = (((0x0E03 + 0x10000000) + 0x01000000) + 0x00400000), + HEADLIGHTS_SWITCH = (((0x0E10 + 0x10000000) + 0x01000000) + 0x00400000), + HIGH_BEAM_LIGHTS_SWITCH = (((0x0E11 + 0x10000000) + 0x01000000) + 0x00400000), + FOG_LIGHTS_SWITCH = (((0x0E12 + 0x10000000) + 0x01000000) + 0x00400000), + HAZARD_LIGHTS_SWITCH = (((0x0E13 + 0x10000000) + 0x01000000) + 0x00400000), + CABIN_LIGHTS_STATE = (((0x0F01 + 0x10000000) + 0x01000000) + 0x00400000), + CABIN_LIGHTS_SWITCH = (((0x0F02 + 0x10000000) + 0x01000000) + 0x00400000), + READING_LIGHTS_STATE = (((0x0F03 + 0x10000000) + 0x05000000) + 0x00400000), + READING_LIGHTS_SWITCH = (((0x0F04 + 0x10000000) + 0x05000000) + 0x00400000), + STEERING_WHEEL_LIGHTS_STATE = (((0x0F0C + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), + STEERING_WHEEL_LIGHTS_SWITCH = (((0x0F0D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), + SUPPORT_CUSTOMIZE_VENDOR_PERMISSION = (((0x0F05 + 0x10000000) + 0x01000000) + 0x00200000), + DISABLED_OPTIONAL_FEATURES = (((0x0F06 + 0x10000000) + 0x01000000) + 0x00100000), + INITIAL_USER_INFO = (((0x0F07 + 0x10000000) + 0x01000000) + 0x00e00000), + SWITCH_USER = (((0x0F08 + 0x10000000) + 0x01000000) + 0x00e00000), + CREATE_USER = (((0x0F09 + 0x10000000) + 0x01000000) + 0x00e00000), + REMOVE_USER = (((0x0F0A + 0x10000000) + 0x01000000) + 0x00e00000), + USER_IDENTIFICATION_ASSOCIATION = (((0x0F0B + 0x10000000) + 0x01000000) + 0x00e00000), + EVS_SERVICE_REQUEST = (((0x0F10 + 0x10000000) + 0x01000000) + 0x00410000), + POWER_POLICY_REQ = (((0x0F21 + 0x10000000) + 0x01000000) + 0x00100000), + POWER_POLICY_GROUP_REQ = (((0x0F22 + 0x10000000) + 0x01000000) + 0x00100000), + CURRENT_POWER_POLICY = (((0x0F23 + 0x10000000) + 0x01000000) + 0x00100000), + WATCHDOG_ALIVE = (((0xF31 + 0x10000000) + 0x01000000) + 0x00500000), + WATCHDOG_TERMINATED_PROCESS = (((0x0F32 + 0x10000000) + 0x01000000) + 0x00e00000), + VHAL_HEARTBEAT = (((0x0F33 + 0x10000000) + 0x01000000) + 0x00500000), + CLUSTER_SWITCH_UI = (((0x0F34 + 0x10000000) + 0x01000000) + 0x00400000), + CLUSTER_DISPLAY_STATE = (((0x0F35 + 0x10000000) + 0x01000000) + 0x00410000), + CLUSTER_REPORT_STATE = (((0x0F36 + 0x10000000) + 0x01000000) + 0x00e00000), + CLUSTER_REQUEST_DISPLAY = (((0x0F37 + 0x10000000) + 0x01000000) + 0x00400000), + CLUSTER_NAVIGATION_STATE = (((0x0F38 + 0x10000000) + 0x01000000) + 0x00700000), + ELECTRONIC_TOLL_COLLECTION_CARD_TYPE = (((0x0F39 + 0x10000000) + 0x01000000) + 0x00400000), + ELECTRONIC_TOLL_COLLECTION_CARD_STATUS = (((0x0F3A + 0x10000000) + 0x01000000) + 0x00400000), + FRONT_FOG_LIGHTS_STATE = (((0x0F3B + 0x10000000) + 0x01000000) + 0x00400000), + FRONT_FOG_LIGHTS_SWITCH = (((0x0F3C + 0x10000000) + 0x01000000) + 0x00400000), + REAR_FOG_LIGHTS_STATE = (((0x0F3D + 0x10000000) + 0x01000000) + 0x00400000), + REAR_FOG_LIGHTS_SWITCH = (((0x0F3E + 0x10000000) + 0x01000000) + 0x00400000), + EV_CHARGE_CURRENT_DRAW_LIMIT = (((0x0F3F + 0x10000000) + 0x01000000) + 0x00600000), + EV_CHARGE_PERCENT_LIMIT = (((0x0F40 + 0x10000000) + 0x01000000) + 0x00600000), + EV_CHARGE_STATE = (((0x0F41 + 0x10000000) + 0x01000000) + 0x00400000), + EV_CHARGE_SWITCH = (((0x0F42 + 0x10000000) + 0x01000000) + 0x00200000), + EV_CHARGE_TIME_REMAINING = (((0x0F43 + 0x10000000) + 0x01000000) + 0x00400000), + EV_REGENERATIVE_BRAKING_STATE = (((0x0F44 + 0x10000000) + 0x01000000) + 0x00400000), + TRAILER_PRESENT = (((0x0F45 + 0x10000000) + 0x01000000) + 0x00400000), + VEHICLE_CURB_WEIGHT = (((0x0F46 + 0x10000000) + 0x01000000) + 0x00400000), + GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT = (((0x0F47 + 0x10000000) + 0x01000000) + 0x00400000), + SUPPORTED_PROPERTY_IDS = (((0x0F48 + 0x10000000) + 0x01000000) + 0x00410000), + SHUTDOWN_REQUEST = (((0x0F49 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), + AUTOMATIC_EMERGENCY_BRAKING_ENABLED = (((0x1000 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), + AUTOMATIC_EMERGENCY_BRAKING_STATE = (((0x1001 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), + FORWARD_COLLISION_WARNING_ENABLED = (((0x1002 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), + FORWARD_COLLISION_WARNING_STATE = (((0x1003 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), + BLIND_SPOT_WARNING_ENABLED = (((0x1004 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), + BLIND_SPOT_WARNING_STATE = (((0x1005 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.MIRROR) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), + LANE_DEPARTURE_WARNING_ENABLED = (((0x1006 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), + LANE_KEEP_ASSIST_ENABLED = (((0x1008 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), + LANE_CENTERING_ASSIST_ENABLED = (((0x100A + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), + EMERGENCY_LANE_KEEP_ASSIST_ENABLED = (((0x100D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), + ADAPTIVE_CRUISE_CONTROL_ENABLED = (((0x100F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), + HANDS_ON_DETECTION_ENABLED = (((0x1016 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), + DRIVER_ATTENTION_MONITORING_ENABLED = (((0x1019 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl index 0c049c4814..714d514cf4 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl @@ -34,7 +34,7 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum VehiclePropertyGroup { - SYSTEM = 268435456, - VENDOR = 536870912, - MASK = -268435456, + SYSTEM = 0x10000000, + VENDOR = 0x20000000, + MASK = 0xf0000000, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehiclePropertyType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehiclePropertyType.aidl index da6d2c2168..7525cbbf69 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehiclePropertyType.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehiclePropertyType.aidl @@ -34,15 +34,15 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum VehiclePropertyType { - STRING = 1048576, - BOOLEAN = 2097152, - INT32 = 4194304, - INT32_VEC = 4259840, - INT64 = 5242880, - INT64_VEC = 5308416, - FLOAT = 6291456, - FLOAT_VEC = 6356992, - BYTES = 7340032, - MIXED = 14680064, - MASK = 16711680, + STRING = 0x00100000, + BOOLEAN = 0x00200000, + INT32 = 0x00400000, + INT32_VEC = 0x00410000, + INT64 = 0x00500000, + INT64_VEC = 0x00510000, + FLOAT = 0x00600000, + FLOAT_VEC = 0x00610000, + BYTES = 0x00700000, + MIXED = 0x00e00000, + MASK = 0x00ff0000, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl index 78c17959b4..0431b45b9a 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl @@ -34,7 +34,7 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum VehicleTurnSignal { - NONE = 0, - RIGHT = 1, - LEFT = 2, + NONE = 0x00, + RIGHT = 0x01, + LEFT = 0x02, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleUnit.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleUnit.aidl index c80fdbbdbe..8a18d4ac43 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleUnit.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleUnit.aidl @@ -34,37 +34,37 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum VehicleUnit { - SHOULD_NOT_USE = 0, - METER_PER_SEC = 1, - RPM = 2, - HERTZ = 3, - PERCENTILE = 16, - MILLIMETER = 32, - METER = 33, - KILOMETER = 35, - MILE = 36, - CELSIUS = 48, - FAHRENHEIT = 49, - KELVIN = 50, - MILLILITER = 64, - LITER = 65, - GALLON = 66, - US_GALLON = 66, - IMPERIAL_GALLON = 67, - NANO_SECS = 80, - SECS = 83, - YEAR = 89, - WATT_HOUR = 96, - MILLIAMPERE = 97, - MILLIVOLT = 98, - MILLIWATTS = 99, - AMPERE_HOURS = 100, - KILOWATT_HOUR = 101, - AMPERE = 102, - KILOPASCAL = 112, - PSI = 113, - BAR = 114, - DEGREES = 128, - MILES_PER_HOUR = 144, - KILOMETERS_PER_HOUR = 145, + SHOULD_NOT_USE = 0x000, + METER_PER_SEC = 0x01, + RPM = 0x02, + HERTZ = 0x03, + PERCENTILE = 0x10, + MILLIMETER = 0x20, + METER = 0x21, + KILOMETER = 0x23, + MILE = 0x24, + CELSIUS = 0x30, + FAHRENHEIT = 0x31, + KELVIN = 0x32, + MILLILITER = 0x40, + LITER = 0x41, + GALLON = 0x42, + US_GALLON = 0x42, + IMPERIAL_GALLON = 0x43, + NANO_SECS = 0x50, + SECS = 0x53, + YEAR = 0x59, + WATT_HOUR = 0x60, + MILLIAMPERE = 0x61, + MILLIVOLT = 0x62, + MILLIWATTS = 0x63, + AMPERE_HOURS = 0x64, + KILOWATT_HOUR = 0x65, + AMPERE = 0x66, + KILOPASCAL = 0x70, + PSI = 0x71, + BAR = 0x72, + DEGREES = 0x80, + MILES_PER_HOUR = 0x90, + KILOMETERS_PER_HOUR = 0x91, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl index 58524f3c66..3aa326c9c7 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl @@ -34,42 +34,42 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum VehicleVendorPermission { - PERMISSION_DEFAULT = 0, - PERMISSION_SET_VENDOR_CATEGORY_WINDOW = 1, - PERMISSION_GET_VENDOR_CATEGORY_WINDOW = 2, - PERMISSION_SET_VENDOR_CATEGORY_DOOR = 3, - PERMISSION_GET_VENDOR_CATEGORY_DOOR = 4, - PERMISSION_SET_VENDOR_CATEGORY_SEAT = 5, - PERMISSION_GET_VENDOR_CATEGORY_SEAT = 6, - PERMISSION_SET_VENDOR_CATEGORY_MIRROR = 7, - PERMISSION_GET_VENDOR_CATEGORY_MIRROR = 8, - PERMISSION_SET_VENDOR_CATEGORY_INFO = 9, - PERMISSION_GET_VENDOR_CATEGORY_INFO = 10, - PERMISSION_SET_VENDOR_CATEGORY_ENGINE = 11, - PERMISSION_GET_VENDOR_CATEGORY_ENGINE = 12, - PERMISSION_SET_VENDOR_CATEGORY_HVAC = 13, - PERMISSION_GET_VENDOR_CATEGORY_HVAC = 14, - PERMISSION_SET_VENDOR_CATEGORY_LIGHT = 15, - PERMISSION_GET_VENDOR_CATEGORY_LIGHT = 16, - PERMISSION_SET_VENDOR_CATEGORY_1 = 65536, - PERMISSION_GET_VENDOR_CATEGORY_1 = 69632, - PERMISSION_SET_VENDOR_CATEGORY_2 = 131072, - PERMISSION_GET_VENDOR_CATEGORY_2 = 135168, - PERMISSION_SET_VENDOR_CATEGORY_3 = 196608, - PERMISSION_GET_VENDOR_CATEGORY_3 = 200704, - PERMISSION_SET_VENDOR_CATEGORY_4 = 262144, - PERMISSION_GET_VENDOR_CATEGORY_4 = 266240, - PERMISSION_SET_VENDOR_CATEGORY_5 = 327680, - PERMISSION_GET_VENDOR_CATEGORY_5 = 331776, - PERMISSION_SET_VENDOR_CATEGORY_6 = 393216, - PERMISSION_GET_VENDOR_CATEGORY_6 = 397312, - PERMISSION_SET_VENDOR_CATEGORY_7 = 458752, - PERMISSION_GET_VENDOR_CATEGORY_7 = 462848, - PERMISSION_SET_VENDOR_CATEGORY_8 = 524288, - PERMISSION_GET_VENDOR_CATEGORY_8 = 528384, - PERMISSION_SET_VENDOR_CATEGORY_9 = 589824, - PERMISSION_GET_VENDOR_CATEGORY_9 = 593920, - PERMISSION_SET_VENDOR_CATEGORY_10 = 655360, - PERMISSION_GET_VENDOR_CATEGORY_10 = 659456, - PERMISSION_NOT_ACCESSIBLE = -268435456, + PERMISSION_DEFAULT = 0x00000000, + PERMISSION_SET_VENDOR_CATEGORY_WINDOW = 0X00000001, + PERMISSION_GET_VENDOR_CATEGORY_WINDOW = 0x00000002, + PERMISSION_SET_VENDOR_CATEGORY_DOOR = 0x00000003, + PERMISSION_GET_VENDOR_CATEGORY_DOOR = 0x00000004, + PERMISSION_SET_VENDOR_CATEGORY_SEAT = 0x00000005, + PERMISSION_GET_VENDOR_CATEGORY_SEAT = 0x00000006, + PERMISSION_SET_VENDOR_CATEGORY_MIRROR = 0x00000007, + PERMISSION_GET_VENDOR_CATEGORY_MIRROR = 0x00000008, + PERMISSION_SET_VENDOR_CATEGORY_INFO = 0x00000009, + PERMISSION_GET_VENDOR_CATEGORY_INFO = 0x0000000A, + PERMISSION_SET_VENDOR_CATEGORY_ENGINE = 0x0000000B, + PERMISSION_GET_VENDOR_CATEGORY_ENGINE = 0x0000000C, + PERMISSION_SET_VENDOR_CATEGORY_HVAC = 0x0000000D, + PERMISSION_GET_VENDOR_CATEGORY_HVAC = 0x0000000E, + PERMISSION_SET_VENDOR_CATEGORY_LIGHT = 0x0000000F, + PERMISSION_GET_VENDOR_CATEGORY_LIGHT = 0x00000010, + PERMISSION_SET_VENDOR_CATEGORY_1 = 0x00010000, + PERMISSION_GET_VENDOR_CATEGORY_1 = 0x00011000, + PERMISSION_SET_VENDOR_CATEGORY_2 = 0x00020000, + PERMISSION_GET_VENDOR_CATEGORY_2 = 0x00021000, + PERMISSION_SET_VENDOR_CATEGORY_3 = 0x00030000, + PERMISSION_GET_VENDOR_CATEGORY_3 = 0x00031000, + PERMISSION_SET_VENDOR_CATEGORY_4 = 0x00040000, + PERMISSION_GET_VENDOR_CATEGORY_4 = 0x00041000, + PERMISSION_SET_VENDOR_CATEGORY_5 = 0x00050000, + PERMISSION_GET_VENDOR_CATEGORY_5 = 0x00051000, + PERMISSION_SET_VENDOR_CATEGORY_6 = 0x00060000, + PERMISSION_GET_VENDOR_CATEGORY_6 = 0x00061000, + PERMISSION_SET_VENDOR_CATEGORY_7 = 0x00070000, + PERMISSION_GET_VENDOR_CATEGORY_7 = 0x00071000, + PERMISSION_SET_VENDOR_CATEGORY_8 = 0x00080000, + PERMISSION_GET_VENDOR_CATEGORY_8 = 0x00081000, + PERMISSION_SET_VENDOR_CATEGORY_9 = 0x00090000, + PERMISSION_GET_VENDOR_CATEGORY_9 = 0x00091000, + PERMISSION_SET_VENDOR_CATEGORY_10 = 0x000A0000, + PERMISSION_GET_VENDOR_CATEGORY_10 = 0x000A1000, + PERMISSION_NOT_ACCESSIBLE = 0xF0000000, } From 05049a153ad688e8565e021f437c9359c64f4e96 Mon Sep 17 00:00:00 2001 From: shrikar Date: Mon, 30 Jan 2023 23:27:32 +0000 Subject: [PATCH 650/998] Fixed ErrorState.aidl to include int backing. Bug: 267228426 Test: atest CarPropertyManagerTest Change-Id: Ibd223f784b1694c844d8fb4025aaefccb6e7de8f --- .../current/android/hardware/automotive/vehicle/ErrorState.aidl | 2 +- .../android/hardware/automotive/vehicle/ErrorState.aidl | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ErrorState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ErrorState.aidl index 4fdbe1bca9..aaf3565db4 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ErrorState.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ErrorState.aidl @@ -32,7 +32,7 @@ // later when a module using the interface is updated, e.g., Mainline modules. package android.hardware.automotive.vehicle; -@VintfStability +@Backing(type="int") @VintfStability enum ErrorState { OTHER_ERROR_STATE = (-1), NOT_AVAILABLE_DISABLED = (-2), diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ErrorState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ErrorState.aidl index 42007fa60e..0c625757ee 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ErrorState.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ErrorState.aidl @@ -21,6 +21,7 @@ package android.hardware.automotive.vehicle; * by ADAS STATE properties, but its use may be expanded in future releases. */ @VintfStability +@Backing(type="int") enum ErrorState { /** From 5dcb66fe52cd192b788bcc0cfebeed53ad6a3a9a Mon Sep 17 00:00:00 2001 From: Chia-Ching Yu Date: Wed, 1 Feb 2023 16:48:37 +0800 Subject: [PATCH 651/998] Forward HalProxy::debug options. Bug: 267262034 Test: adb shell dumpsys android.hardware.sensors.ISensors/default \ disp_info_histogram_cfg Change-Id: Ic9eb19fb4483a7f5dae2d5dccb8e72cd4d7d8710 --- sensors/aidl/default/multihal/HalProxyAidl.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sensors/aidl/default/multihal/HalProxyAidl.cpp b/sensors/aidl/default/multihal/HalProxyAidl.cpp index e6bcdada52..dbef0305f9 100644 --- a/sensors/aidl/default/multihal/HalProxyAidl.cpp +++ b/sensors/aidl/default/multihal/HalProxyAidl.cpp @@ -17,6 +17,7 @@ #include "HalProxyAidl.h" #include #include +#include #include #include "ConvertUtils.h" #include "EventMessageQueueWrapperAidl.h" @@ -28,6 +29,8 @@ using ::aidl::android::hardware::common::fmq::MQDescriptor; using ::aidl::android::hardware::common::fmq::SynchronizedReadWrite; using ::aidl::android::hardware::sensors::ISensors; using ::aidl::android::hardware::sensors::ISensorsCallback; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; using ::android::hardware::sensors::V2_1::implementation::convertToOldEvent; using ::ndk::ScopedAStatus; @@ -225,13 +228,18 @@ ScopedAStatus HalProxyAidl::unregisterDirectChannel(int32_t in_channelHandle) { return resultToAStatus(HalProxy::unregisterDirectChannel(in_channelHandle)); } -binder_status_t HalProxyAidl::dump(int fd, const char ** /* args */, - uint32_t /* numArgs */) { +binder_status_t HalProxyAidl::dump(int fd, const char ** args, + uint32_t numArgs) { native_handle_t *nativeHandle = native_handle_create(1 /* numFds */, 0 /* numInts */); nativeHandle->data[0] = fd; - HalProxy::debug(nativeHandle, {} /* args */); + hidl_vec hidl_args; + hidl_args.resize(numArgs); + for (size_t i = 0; i < numArgs; ++i) { + hidl_args[i] = args[i]; + } + HalProxy::debug(nativeHandle, hidl_args); native_handle_delete(nativeHandle); return STATUS_OK; @@ -241,4 +249,4 @@ binder_status_t HalProxyAidl::dump(int fd, const char ** /* args */, } // namespace sensors } // namespace hardware } // namespace android -} // namespace aidl \ No newline at end of file +} // namespace aidl From 5a4500a42f17d19cb41529157cbbcd9c40c1386f Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Mon, 9 Jan 2023 22:02:33 +0000 Subject: [PATCH 652/998] Remove automotive.can HIDL interface from current compat matrix This interface is deprecated for new devices from level 8 of the framework compatibility matrix. Test: none Bug: 170405615 Change-Id: Ibdf12a382435abe845a31cce580c4e98b2d57e06 --- compatibility_matrices/compatibility_matrix.8.xml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.8.xml b/compatibility_matrices/compatibility_matrix.8.xml index 13261c6f21..9259c6bab5 100644 --- a/compatibility_matrices/compatibility_matrix.8.xml +++ b/compatibility_matrices/compatibility_matrix.8.xml @@ -76,18 +76,6 @@ default - - android.hardware.automotive.can - 1.0 - - ICanBus - .* - - - ICanController - .* - - android.hardware.automotive.evs From e8730a7113db0eb3668f79eda8f1bf72631b36f6 Mon Sep 17 00:00:00 2001 From: Yixiao Luo Date: Wed, 1 Feb 2023 18:39:51 -0800 Subject: [PATCH 653/998] Add CAS AIDL/HIDL support for Tuner Descrambler Tests Bug: 266968335 Test: VtsHalTvTunerTargetTest Change-Id: I55074360587735256c4f0efa8228d28f57b21592 --- tv/tuner/aidl/vts/OWNERS | 2 + tv/tuner/aidl/vts/functional/Android.bp | 1 + .../aidl/vts/functional/DescramblerTests.cpp | 128 ++++++++++++------ .../aidl/vts/functional/DescramblerTests.h | 59 ++++++-- .../vts/functional/VtsHalTvTunerTargetTest.h | 24 +++- 5 files changed, 156 insertions(+), 58 deletions(-) diff --git a/tv/tuner/aidl/vts/OWNERS b/tv/tuner/aidl/vts/OWNERS index bf2b609f3e..5b33bf2a5d 100644 --- a/tv/tuner/aidl/vts/OWNERS +++ b/tv/tuner/aidl/vts/OWNERS @@ -1,3 +1,5 @@ +# Bug component: 136752 + hgchen@google.com shubang@google.com quxiangfang@google.com diff --git a/tv/tuner/aidl/vts/functional/Android.bp b/tv/tuner/aidl/vts/functional/Android.bp index 6a71544967..513007b4a8 100644 --- a/tv/tuner/aidl/vts/functional/Android.bp +++ b/tv/tuner/aidl/vts/functional/Android.bp @@ -51,6 +51,7 @@ cc_test { "android.hardware.cas@1.0", "android.hardware.cas@1.1", "android.hardware.cas@1.2", + "android.hardware.cas-V1-ndk", "android.hardware.common-V2-ndk", "android.hardware.common.fmq-V1-ndk", "android.hardware.tv.tuner-V2-ndk", diff --git a/tv/tuner/aidl/vts/functional/DescramblerTests.cpp b/tv/tuner/aidl/vts/functional/DescramblerTests.cpp index 157fa0479e..f4855c2a5a 100644 --- a/tv/tuner/aidl/vts/functional/DescramblerTests.cpp +++ b/tv/tuner/aidl/vts/functional/DescramblerTests.cpp @@ -19,71 +19,115 @@ using namespace std; AssertionResult DescramblerTests::createCasPlugin(int32_t caSystemId) { - auto status = mMediaCasService->isSystemIdSupported(caSystemId); - if (!status.isOk() || !status) { - ALOGW("[vts] Failed to check isSystemIdSupported."); - return failure(); + mCasListener = ::ndk::SharedRefBase::make(); + + if (mMediaCasServiceAidl != nullptr) { + bool rst = false; + ScopedAStatus status = mMediaCasServiceAidl->isSystemIdSupported(caSystemId, &rst); + if (!status.isOk() || !rst) { + ALOGW("[vts] Failed to check isSystemIdSupported for AIDL service."); + return failure(); + } + status = mMediaCasServiceAidl->createPlugin(caSystemId, mCasListener, &mCasAidl); + if (!status.isOk()) { + ALOGW("[vts] Failed to createPlugin for AIDL service."); + return failure(); + } + } else { + auto status = mMediaCasServiceHidl->isSystemIdSupported(caSystemId); + if (!status.isOk() || !status) { + ALOGW("[vts] Failed to check isSystemIdSupported for HIDL service."); + return failure(); + } + auto pluginStatus = mMediaCasServiceHidl->createPluginExt( + caSystemId, sp(mCasListener.get())); + if (!pluginStatus.isOk()) { + ALOGW("[vts] Failed to createPluginExt for HIDL service."); + return failure(); + } + mCasHidl = ICasHidl::castFrom(pluginStatus); + if (mCasHidl == nullptr) { + ALOGW("[vts] Failed to get ICas for HIDL service."); + return failure(); + } } - mCasListener = new MediaCasListener(); - auto pluginStatus = mMediaCasService->createPluginExt(caSystemId, mCasListener); - if (!pluginStatus.isOk()) { - ALOGW("[vts] Failed to createPluginExt."); - return failure(); - } - mCas = ICas::castFrom(pluginStatus); - if (mCas == nullptr) { - ALOGW("[vts] Failed to get ICas."); - return failure(); - } return success(); } AssertionResult DescramblerTests::openCasSession(vector& sessionId, - vector& hidlPvtData) { - Status sessionStatus; - SessionIntent intent = SessionIntent::LIVE; - ScramblingMode mode = ScramblingMode::RESERVED; - auto returnVoid = - mCas->openSession_1_2(intent, mode, [&](Status status, const hidl_vec& id) { - sessionStatus = status; - sessionId = id; - }); - if (!returnVoid.isOk() || (sessionStatus != Status::OK)) { - ALOGW("[vts] Failed to open cas session."); - mCas->closeSession(sessionId); - return failure(); - } - - if (hidlPvtData.size() > 0) { - auto status = mCas->setSessionPrivateData(sessionId, hidlPvtData); - if (status != android::hardware::cas::V1_0::Status::OK) { - ALOGW("[vts] Failed to set session private data"); - mCas->closeSession(sessionId); + vector& pvtData) { + if (mMediaCasServiceAidl != nullptr) { + SessionIntentAidl intent = SessionIntentAidl::LIVE; + ScramblingModeAidl mode = ScramblingModeAidl::RESERVED; + std::vector sessionId; + ScopedAStatus status = mCasAidl->openSession(intent, mode, &sessionId); + if (!status.isOk()) { + ALOGW("[vts] Failed to open cas session for AIDL service."); + mCasAidl->closeSession(sessionId); return failure(); } + + if (pvtData.size() > 0) { + ScopedAStatus status = mCasAidl->setSessionPrivateData(sessionId, pvtData); + if (!status.isOk()) { + ALOGW("[vts] Failed to set session private data for AIDL service."); + mCasAidl->closeSession(sessionId); + return failure(); + } + } + } else { + Status sessionStatus; + SessionIntentHidl intent = SessionIntentHidl::LIVE; + ScramblingModeHidl mode = ScramblingModeHidl::RESERVED; + auto returnVoid = mCasHidl->openSession_1_2( + intent, mode, [&](Status status, const hidl_vec& id) { + sessionStatus = status; + sessionId = id; + }); + if (!returnVoid.isOk() || (sessionStatus != Status::OK)) { + ALOGW("[vts] Failed to open cas session for HIDL service."); + mCasHidl->closeSession(sessionId); + return failure(); + } + + if (pvtData.size() > 0) { + auto status = mCasHidl->setSessionPrivateData(sessionId, pvtData); + if (status != android::hardware::cas::V1_0::Status::OK) { + ALOGW("[vts] Failed to set session private data for HIDL service."); + mCasHidl->closeSession(sessionId); + return failure(); + } + } } return success(); } AssertionResult DescramblerTests::getKeyToken(int32_t caSystemId, string& provisonStr, - vector& hidlPvtData, - vector& token) { + vector& pvtData, vector& token) { if (createCasPlugin(caSystemId) != success()) { ALOGW("[vts] createCasPlugin failed."); return failure(); } if (provisonStr.size() > 0) { - auto returnStatus = mCas->provision(hidl_string(provisonStr)); - if (returnStatus != android::hardware::cas::V1_0::Status::OK) { - ALOGW("[vts] provision failed."); - return failure(); + if (mMediaCasServiceAidl != nullptr) { + ScopedAStatus status = mCasAidl->provision(provisonStr); + if (!status.isOk()) { + ALOGW("[vts] provision failed for AIDL service."); + return failure(); + } + } else { + auto returnStatus = mCasHidl->provision(hidl_string(provisonStr)); + if (returnStatus != android::hardware::cas::V1_0::Status::OK) { + ALOGW("[vts] provision failed for HIDL service."); + return failure(); + } } } - return openCasSession(token, hidlPvtData); + return openCasSession(token, pvtData); } AssertionResult DescramblerTests::openDescrambler(int32_t demuxId) { diff --git a/tv/tuner/aidl/vts/functional/DescramblerTests.h b/tv/tuner/aidl/vts/functional/DescramblerTests.h index f0b769141a..bab1a88f09 100644 --- a/tv/tuner/aidl/vts/functional/DescramblerTests.h +++ b/tv/tuner/aidl/vts/functional/DescramblerTests.h @@ -30,11 +30,17 @@ #include #include +#include +#include +#include +#include +#include #include #include #include #include +using ::aidl::android::hardware::cas::BnCasListener; using android::Condition; using android::Mutex; using android::sp; @@ -42,19 +48,26 @@ using android::hardware::hidl_string; using android::hardware::hidl_vec; using android::hardware::Return; using android::hardware::Void; -using android::hardware::cas::V1_2::ICas; -using android::hardware::cas::V1_2::ICasListener; -using android::hardware::cas::V1_2::IMediaCasService; -using android::hardware::cas::V1_2::ScramblingMode; -using android::hardware::cas::V1_2::SessionIntent; using android::hardware::cas::V1_2::Status; using android::hardware::cas::V1_2::StatusEvent; +using ICasAidl = ::aidl::android::hardware::cas::ICas; +using ICasHidl = android::hardware::cas::V1_2::ICas; +using ICasListenerHidl = android::hardware::cas::V1_2::ICasListener; +using IMediaCasServiceAidl = ::aidl::android::hardware::cas::IMediaCasService; +using IMediaCasServiceHidl = android::hardware::cas::V1_2::IMediaCasService; +using ScramblingModeAidl = ::aidl::android::hardware::cas::ScramblingMode; +using ScramblingModeHidl = android::hardware::cas::V1_2::ScramblingMode; +using SessionIntentAidl = ::aidl::android::hardware::cas::SessionIntent; +using SessionIntentHidl = android::hardware::cas::V1_2::SessionIntent; +using ::ndk::ScopedAStatus; using ::testing::AssertionResult; using namespace aidl::android::hardware::tv::tuner; -class MediaCasListener : public ICasListener { +const std::string MEDIA_CAS_AIDL_SERVICE_NAME = "android.hardware.cas.IMediaCasService/default"; + +class MediaCasListener : public ICasListenerHidl, public BnCasListener { public: virtual Return onEvent(int32_t /*event*/, int32_t /*arg*/, const hidl_vec& /*data*/) override { @@ -70,12 +83,33 @@ class MediaCasListener : public ICasListener { virtual Return onStatusUpdate(StatusEvent /*event*/, int32_t /*arg*/) override { return Void(); } + + ScopedAStatus onEvent(int32_t /*in_event*/, int32_t /*in_arg*/, + const std::vector& /*in_data*/) override { + return ScopedAStatus::ok(); + } + + ScopedAStatus onSessionEvent(const std::vector& /*in_sessionId*/, int32_t /*in_event*/, + int32_t /*in_arg*/, + const std::vector& /*in_data*/) override { + return ScopedAStatus::ok(); + } + + ScopedAStatus onStatusUpdate(::aidl::android::hardware::cas::StatusEvent /*in_event*/, + int32_t /*in_number*/) override { + return ScopedAStatus::ok(); + } }; class DescramblerTests { public: void setService(std::shared_ptr tuner) { mService = tuner; } - void setCasService(sp casService) { mMediaCasService = casService; } + void setCasServiceHidl(sp casService) { + mMediaCasServiceHidl = casService; + } + void setCasServiceAidl(std::shared_ptr casService) { + mMediaCasServiceAidl = casService; + } AssertionResult setKeyToken(std::vector& token); AssertionResult openDescrambler(int32_t demuxId); @@ -95,12 +129,13 @@ class DescramblerTests { std::shared_ptr mService; std::shared_ptr mDescrambler; - android::sp mCas; - android::sp mMediaCasService; - android::sp mCasListener; + std::shared_ptr mCasAidl; + android::sp mCasHidl; + std::shared_ptr mMediaCasServiceAidl; + android::sp mMediaCasServiceHidl; + std::shared_ptr mCasListener; private: - AssertionResult openCasSession(std::vector& sessionId, - std::vector& hidlPvtData); + AssertionResult openCasSession(std::vector& sessionId, std::vector& pvtData); AssertionResult createCasPlugin(int32_t caSystemId); }; diff --git a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h index 3bfa78f192..8ad6ee0d43 100644 --- a/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h +++ b/tv/tuner/aidl/vts/functional/VtsHalTvTunerTargetTest.h @@ -401,16 +401,31 @@ class TunerDescramblerAidlTest : public testing::TestWithParam { } else { mService = nullptr; } - mCasService = IMediaCasService::getService(); ASSERT_NE(mService, nullptr); - ASSERT_NE(mCasService, nullptr); + + // Get IMediaCasService. Try getting AIDL service first, if AIDL does not exist, try HIDL. + if (AServiceManager_isDeclared(MEDIA_CAS_AIDL_SERVICE_NAME.c_str())) { + ::ndk::SpAIBinder binder( + AServiceManager_waitForService(MEDIA_CAS_AIDL_SERVICE_NAME.c_str())); + mCasServiceAidl = IMediaCasServiceAidl::fromBinder(binder); + } else { + mCasServiceAidl = nullptr; + } + if (mCasServiceAidl == nullptr) { + mCasServiceHidl = IMediaCasServiceHidl::getService(); + } + ASSERT_TRUE(mCasServiceAidl != nullptr || mCasServiceHidl != nullptr); ASSERT_TRUE(initConfiguration()); mFrontendTests.setService(mService); mDemuxTests.setService(mService); mDvrTests.setService(mService); mDescramblerTests.setService(mService); - mDescramblerTests.setCasService(mCasService); + if (mCasServiceAidl != nullptr) { + mDescramblerTests.setCasServiceAidl(mCasServiceAidl); + } else { + mDescramblerTests.setCasServiceHidl(mCasServiceHidl); + } mLnbTests.setService(mService); } @@ -433,7 +448,8 @@ class TunerDescramblerAidlTest : public testing::TestWithParam { AssertionResult filterDataOutputTest(); std::shared_ptr mService; - android::sp mCasService; + sp mCasServiceHidl; + std::shared_ptr mCasServiceAidl; FrontendTests mFrontendTests; DemuxTests mDemuxTests; FilterTests mFilterTests; From e4af3c6ddf47e85b0ff573dc151df2ee6b6a8d7b Mon Sep 17 00:00:00 2001 From: Helen Date: Mon, 2 Jan 2023 04:26:31 +0000 Subject: [PATCH 654/998] VTS implementation for ImsMediaHal Bug: 263201546 Test: atest VtsHalRadioTargetTest (using cuttlefish) Change-Id: I38eacded9a4523b7c5121f2d759d9b118923bcc7 --- radio/aidl/compat/libradiocompat/Android.bp | 3 + .../ims/media/RadioImsMedia.cpp | 49 ++++ .../ims/media/RadioImsMediaSession.cpp | 64 +++++ .../include/libradiocompat/RadioImsMedia.h | 40 +++ .../libradiocompat/RadioImsMediaSession.h | 47 +++ .../include/libradiocompat/RadioResponse.h | 1 + radio/aidl/compat/service/Android.bp | 1 + radio/aidl/vts/Android.bp | 4 + radio/aidl/vts/VtsHalRadioTargetTest.cpp | 6 + radio/aidl/vts/radio_imsmedia_listener.cpp | 38 +++ .../vts/radio_imsmedia_session_listener.cpp | 51 ++++ radio/aidl/vts/radio_imsmedia_test.cpp | 271 ++++++++++++++++++ radio/aidl/vts/radio_imsmedia_utils.h | 98 +++++++ 13 files changed, 673 insertions(+) create mode 100644 radio/aidl/compat/libradiocompat/ims/media/RadioImsMedia.cpp create mode 100644 radio/aidl/compat/libradiocompat/ims/media/RadioImsMediaSession.cpp create mode 100644 radio/aidl/compat/libradiocompat/include/libradiocompat/RadioImsMedia.h create mode 100644 radio/aidl/compat/libradiocompat/include/libradiocompat/RadioImsMediaSession.h create mode 100644 radio/aidl/vts/radio_imsmedia_listener.cpp create mode 100644 radio/aidl/vts/radio_imsmedia_session_listener.cpp create mode 100644 radio/aidl/vts/radio_imsmedia_test.cpp create mode 100644 radio/aidl/vts/radio_imsmedia_utils.h diff --git a/radio/aidl/compat/libradiocompat/Android.bp b/radio/aidl/compat/libradiocompat/Android.bp index 6bbc9fe7b2..9aecf78d38 100644 --- a/radio/aidl/compat/libradiocompat/Android.bp +++ b/radio/aidl/compat/libradiocompat/Android.bp @@ -38,6 +38,7 @@ cc_library { "android.hardware.radio.config@1.3", "android.hardware.radio.data-V2-ndk", "android.hardware.radio.ims-V1-ndk", + "android.hardware.radio.ims.media-V1-ndk", "android.hardware.radio.messaging-V2-ndk", "android.hardware.radio.modem-V2-ndk", "android.hardware.radio.network-V2-ndk", @@ -75,6 +76,8 @@ cc_library { "ims/RadioIndication-ims.cpp", "ims/RadioResponse-ims.cpp", "ims/RadioIms.cpp", + "ims/media/RadioImsMediaSession.cpp", + "ims/media/RadioImsMedia.cpp", "messaging/RadioIndication-messaging.cpp", "messaging/RadioMessaging.cpp", "messaging/RadioResponse-messaging.cpp", diff --git a/radio/aidl/compat/libradiocompat/ims/media/RadioImsMedia.cpp b/radio/aidl/compat/libradiocompat/ims/media/RadioImsMedia.cpp new file mode 100644 index 0000000000..464a410535 --- /dev/null +++ b/radio/aidl/compat/libradiocompat/ims/media/RadioImsMedia.cpp @@ -0,0 +1,49 @@ +/* + * 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. + */ + +#include + +#include "commonStructs.h" +#include "debug.h" + +#include "collections.h" + +#define RADIO_MODULE "ImsMedia" + +namespace android::hardware::radio::compat { + +using ::ndk::ScopedAStatus; +constexpr auto ok = &ScopedAStatus::ok; + +ScopedAStatus RadioImsMedia::setListener( + const std::shared_ptr<::aidl::android::hardware::radio::ims::media:: + IImsMediaListener>& /*in_mediaListener*/) { + LOG(ERROR) << " setListener is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioImsMedia::openSession( + int32_t /*in_sessionId*/, + const ::aidl::android::hardware::radio::ims::media::LocalEndPoint& /*in_localEndPoint*/, + const ::aidl::android::hardware::radio::ims::media::RtpConfig& /*in_config*/) { + LOG(ERROR) << " openSession is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioImsMedia::closeSession(int32_t /*in_sessionId*/) { + LOG(ERROR) << " closeSession is unsupported by HIDL HALs"; + return ok(); +} + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/ims/media/RadioImsMediaSession.cpp b/radio/aidl/compat/libradiocompat/ims/media/RadioImsMediaSession.cpp new file mode 100644 index 0000000000..ae86914e27 --- /dev/null +++ b/radio/aidl/compat/libradiocompat/ims/media/RadioImsMediaSession.cpp @@ -0,0 +1,64 @@ +/* + * 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. + */ + +#include + +#include "commonStructs.h" +#include "debug.h" + +#include "collections.h" + +#define RADIO_MODULE "ImsMediaSession" + +namespace android::hardware::radio::compat { + +using ::ndk::ScopedAStatus; +namespace aidl = ::aidl::android::hardware::radio::ims::media; +constexpr auto ok = &ScopedAStatus::ok; + +ScopedAStatus RadioImsMediaSession::setListener( + const std::shared_ptr& /*in_sessionListener*/) { + LOG(ERROR) << " setListener is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioImsMediaSession::modifySession(const aidl::RtpConfig& /*in_config*/) { + LOG(ERROR) << " modifySession is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioImsMediaSession::sendDtmf(char16_t /*in_dtmfDigit*/, int32_t /*in_duration*/) { + LOG(ERROR) << " sendDtmf is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioImsMediaSession::startDtmf(char16_t /*in_dtmfDigit*/) { + LOG(ERROR) << " startDtmf is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioImsMediaSession::stopDtmf() { + LOG(ERROR) << " stopDtmf is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioImsMediaSession::sendHeaderExtension( + const std::vector& /*in_extensions*/) { + LOG(ERROR) << " sendHeaderExtension is unsupported by HIDL HALs"; + return ok(); +} +ScopedAStatus RadioImsMediaSession::setMediaQualityThreshold( + const aidl::MediaQualityThreshold& /*in_threshold*/) { + LOG(ERROR) << " setMediaQualityThreshold is unsupported by HIDL HALs"; + return ok(); +} + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioImsMedia.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioImsMedia.h new file mode 100644 index 0000000000..2ee6bf1a75 --- /dev/null +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioImsMedia.h @@ -0,0 +1,40 @@ +/* + * 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. + */ +#pragma once + +#include "RadioCompatBase.h" + +#include + +namespace android::hardware::radio::compat { + +class RadioImsMedia : public RadioCompatBase, + public aidl::android::hardware::radio::ims::media::BnImsMedia { + ::ndk::ScopedAStatus setListener( + const std::shared_ptr<::aidl::android::hardware::radio::ims::media::IImsMediaListener>& + in_mediaListener) override; + ::ndk::ScopedAStatus openSession( + int32_t in_sessionId, + const ::aidl::android::hardware::radio::ims::media::LocalEndPoint& in_localEndPoint, + const ::aidl::android::hardware::radio::ims::media::RtpConfig& in_config) override; + ::ndk::ScopedAStatus closeSession(int32_t in_sessionId) override; + + protected: + public: + using RadioCompatBase::RadioCompatBase; +}; + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioImsMediaSession.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioImsMediaSession.h new file mode 100644 index 0000000000..00f21fc077 --- /dev/null +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioImsMediaSession.h @@ -0,0 +1,47 @@ +/* + * 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. + */ +#pragma once + +#include "RadioCompatBase.h" + +#include + +namespace android::hardware::radio::compat { + +class RadioImsMediaSession : public RadioCompatBase, + public aidl::android::hardware::radio::ims::media::BnImsMediaSession { + ::ndk::ScopedAStatus setListener( + const std::shared_ptr< + ::aidl::android::hardware::radio::ims::media::IImsMediaSessionListener>& + in_sessionListener) override; + ::ndk::ScopedAStatus modifySession( + const ::aidl::android::hardware::radio::ims::media::RtpConfig& in_config) override; + ::ndk::ScopedAStatus sendDtmf(char16_t in_dtmfDigit, int32_t in_duration) override; + ::ndk::ScopedAStatus startDtmf(char16_t in_dtmfDigit) override; + ::ndk::ScopedAStatus stopDtmf() override; + ::ndk::ScopedAStatus sendHeaderExtension( + const std::vector<::aidl::android::hardware::radio::ims::media::RtpHeaderExtension>& + in_extensions) override; + ::ndk::ScopedAStatus setMediaQualityThreshold( + const ::aidl::android::hardware::radio::ims::media::MediaQualityThreshold& in_threshold) + override; + + protected: + public: + using RadioCompatBase::RadioCompatBase; +}; + +} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h index 636c1a4fa1..b976435064 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h @@ -20,6 +20,7 @@ #include #include +#include #include #include #include diff --git a/radio/aidl/compat/service/Android.bp b/radio/aidl/compat/service/Android.bp index a3717b4304..5d14c85f73 100644 --- a/radio/aidl/compat/service/Android.bp +++ b/radio/aidl/compat/service/Android.bp @@ -41,6 +41,7 @@ cc_binary { "android.hardware.radio.config@1.3", "android.hardware.radio.data-V2-ndk", "android.hardware.radio.ims-V1-ndk", + "android.hardware.radio.ims.media-V1-ndk", "android.hardware.radio.messaging-V2-ndk", "android.hardware.radio.modem-V2-ndk", "android.hardware.radio.network-V2-ndk", diff --git a/radio/aidl/vts/Android.bp b/radio/aidl/vts/Android.bp index 518dfd43e1..f112d6d73a 100644 --- a/radio/aidl/vts/Android.bp +++ b/radio/aidl/vts/Android.bp @@ -44,6 +44,9 @@ cc_test { "radio_ims_indication.cpp", "radio_ims_response.cpp", "radio_ims_test.cpp", + "radio_imsmedia_listener.cpp", + "radio_imsmedia_session_listener.cpp", + "radio_imsmedia_test.cpp", "radio_messaging_indication.cpp", "radio_messaging_response.cpp", "radio_messaging_test.cpp", @@ -75,6 +78,7 @@ cc_test { "android.hardware.radio.config-V2-ndk", "android.hardware.radio.data-V2-ndk", "android.hardware.radio.ims-V1-ndk", + "android.hardware.radio.ims.media-V1-ndk", "android.hardware.radio.messaging-V2-ndk", "android.hardware.radio.modem-V2-ndk", "android.hardware.radio.network-V2-ndk", diff --git a/radio/aidl/vts/VtsHalRadioTargetTest.cpp b/radio/aidl/vts/VtsHalRadioTargetTest.cpp index f718e57038..86c109948a 100644 --- a/radio/aidl/vts/VtsHalRadioTargetTest.cpp +++ b/radio/aidl/vts/VtsHalRadioTargetTest.cpp @@ -19,6 +19,7 @@ #include "radio_config_utils.h" #include "radio_data_utils.h" #include "radio_ims_utils.h" +#include "radio_imsmedia_utils.h" #include "radio_messaging_utils.h" #include "radio_modem_utils.h" #include "radio_network_utils.h" @@ -85,6 +86,11 @@ INSTANTIATE_TEST_SUITE_P( testing::ValuesIn(android::getAidlHalInstanceNames(IRadioSatellite::descriptor)), android::PrintInstanceNameToString); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioImsMediaTest); +INSTANTIATE_TEST_SUITE_P(PerInstance, RadioImsMediaTest, + testing::ValuesIn(android::getAidlHalInstanceNames(IImsMedia::descriptor)), + android::PrintInstanceNameToString); + int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); ABinderProcess_setThreadPoolMaxThreadCount(1); diff --git a/radio/aidl/vts/radio_imsmedia_listener.cpp b/radio/aidl/vts/radio_imsmedia_listener.cpp new file mode 100644 index 0000000000..78f66a9f4c --- /dev/null +++ b/radio/aidl/vts/radio_imsmedia_listener.cpp @@ -0,0 +1,38 @@ +/* + * 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. + */ + +#include "radio_imsmedia_utils.h" + +ImsMediaListener::ImsMediaListener(RadioServiceTest& parent) : parent_imsmedia(parent) {} + +ndk::ScopedAStatus ImsMediaListener::onOpenSessionSuccess( + int32_t in_sessionId, const std::shared_ptr& in_session) { + mSessionId = in_sessionId; + mSession = in_session; + parent_imsmedia.notify(SERIAL_OPEN_SESSION); + return ndk::ScopedAStatus::ok(); +} +ndk::ScopedAStatus ImsMediaListener::onOpenSessionFailure(int32_t in_sessionId, RtpError in_error) { + mSessionId = in_sessionId; + mError = in_error; + parent_imsmedia.notify(SERIAL_OPEN_SESSION); + return ndk::ScopedAStatus::ok(); +} +ndk::ScopedAStatus ImsMediaListener::onSessionClosed(int32_t in_sessionId) { + mSessionId = in_sessionId; + parent_imsmedia.notify(SERIAL_CLOSE_SESSION); + return ndk::ScopedAStatus::ok(); +} diff --git a/radio/aidl/vts/radio_imsmedia_session_listener.cpp b/radio/aidl/vts/radio_imsmedia_session_listener.cpp new file mode 100644 index 0000000000..986cab24c9 --- /dev/null +++ b/radio/aidl/vts/radio_imsmedia_session_listener.cpp @@ -0,0 +1,51 @@ +/* + * 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. + */ + +#include "radio_imsmedia_utils.h" + +ImsMediaSessionListener::ImsMediaSessionListener(RadioServiceTest& parent) + : parent_imsmedia(parent) {} + +ndk::ScopedAStatus ImsMediaSessionListener::onModifySessionResponse(const RtpConfig& in_config, + RtpError in_error) { + mConfig = in_config; + mError = in_error; + parent_imsmedia.notify(SERIAL_MODIFY_SESSION); + return ndk::ScopedAStatus::ok(); +} +ndk::ScopedAStatus ImsMediaSessionListener::onFirstMediaPacketReceived( + const RtpConfig& /*in_config*/) { + return ndk::ScopedAStatus::ok(); +} +ndk::ScopedAStatus ImsMediaSessionListener::onHeaderExtensionReceived( + const std::vector& /*in_extensions*/) { + return ndk::ScopedAStatus::ok(); +} +ndk::ScopedAStatus ImsMediaSessionListener::notifyMediaQualityStatus( + const MediaQualityStatus& /*in_quality*/) { + return ndk::ScopedAStatus::ok(); +} +ndk::ScopedAStatus ImsMediaSessionListener::triggerAnbrQuery(const RtpConfig& /*in_config*/) { + return ndk::ScopedAStatus::ok(); +} +ndk::ScopedAStatus ImsMediaSessionListener::onDtmfReceived(char16_t /*in_dtmfDigit*/, + int32_t /*in_durationMs*/) { + return ndk::ScopedAStatus::ok(); +} +ndk::ScopedAStatus ImsMediaSessionListener::onCallQualityChanged( + const CallQuality& /*in_callQuality*/) { + return ndk::ScopedAStatus::ok(); +} diff --git a/radio/aidl/vts/radio_imsmedia_test.cpp b/radio/aidl/vts/radio_imsmedia_test.cpp new file mode 100644 index 0000000000..d9e57c9a63 --- /dev/null +++ b/radio/aidl/vts/radio_imsmedia_test.cpp @@ -0,0 +1,271 @@ +/* + * 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. + */ + +#include +#include +#include +#include + +#include "radio_imsmedia_utils.h" + +#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk()) + +void RadioImsMediaTest::SetUp() { + std::string serviceName = GetParam(); + + ALOGD("Enter RadioImsMediaTest."); + + radio_imsmedia = IImsMedia::fromBinder( + ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str()))); + ASSERT_NE(nullptr, radio_imsmedia.get()); + + radio_imsmedialistener = ndk::SharedRefBase::make(*this); + ASSERT_NE(nullptr, radio_imsmedialistener.get()); + + radio_imsmediasessionlistener = ndk::SharedRefBase::make(*this); + ASSERT_NE(nullptr, radio_imsmediasessionlistener.get()); + count_ = 0; +} + +TEST_P(RadioImsMediaTest, MOCallSuccess) { + int32_t sessionId = 1; + RtpConfig modifyRtpConfig; + + modifyRtpConfig.direction = + ::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE; + modifyRtpConfig.remoteAddress.ipAddress = "122.22.22.33"; + modifyRtpConfig.remoteAddress.portNumber = 1234; + + if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) { + ALOGI("Skipping setListener because ims is not supported in device"); + return; + } else { + ALOGI("Running setListener because ims is supported in device"); + } + + ndk::ScopedAStatus res = radio_imsmedia->setListener(radio_imsmedialistener); + ASSERT_OK(res); + + serial = SERIAL_OPEN_SESSION; + res = triggerOpenSession(sessionId); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(sessionId, radio_imsmedialistener->mSessionId); + ASSERT_NE(nullptr, radio_imsmedialistener->mSession); + + radio_imsmediasession = radio_imsmedialistener->mSession; + radio_imsmediasession->setListener(radio_imsmediasessionlistener); + ASSERT_OK(res); + + serial = SERIAL_MODIFY_SESSION; + res = radio_imsmediasession->modifySession(modifyRtpConfig); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(modifyRtpConfig, radio_imsmediasessionlistener->mConfig); + verifyError(radio_imsmediasessionlistener->mError); + + serial = SERIAL_CLOSE_SESSION; + res = radio_imsmedia->closeSession(sessionId); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(sessionId, radio_imsmedialistener->mSessionId); +} + +TEST_P(RadioImsMediaTest, testDtmfOperation) { + int32_t sessionId = 1; + char16_t dtmfDight = 'a'; + int32_t duration = 200; + RtpConfig modifyRtpConfig; + + modifyRtpConfig.direction = + ::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE; + modifyRtpConfig.remoteAddress.ipAddress = "122.22.22.33"; + modifyRtpConfig.remoteAddress.portNumber = 1234; + + if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) { + ALOGI("Skipping setListener because ims is not supported in device"); + return; + } else { + ALOGI("Running setListener because ims is supported in device"); + } + + ndk::ScopedAStatus res = radio_imsmedia->setListener(radio_imsmedialistener); + ASSERT_OK(res); + + serial = SERIAL_OPEN_SESSION; + res = triggerOpenSession(sessionId); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(sessionId, radio_imsmedialistener->mSessionId); + ASSERT_NE(nullptr, radio_imsmedialistener->mSession); + + radio_imsmediasession = radio_imsmedialistener->mSession; + radio_imsmediasession->setListener(radio_imsmediasessionlistener); + ASSERT_OK(res); + + serial = SERIAL_MODIFY_SESSION; + res = radio_imsmediasession->modifySession(modifyRtpConfig); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(modifyRtpConfig, radio_imsmediasessionlistener->mConfig); + verifyError(radio_imsmediasessionlistener->mError); + + res = radio_imsmediasession->sendDtmf(dtmfDight, duration); + ASSERT_OK(res); + + res = radio_imsmediasession->startDtmf(dtmfDight); + ASSERT_OK(res); + + res = radio_imsmediasession->stopDtmf(); + ASSERT_OK(res); + + serial = SERIAL_CLOSE_SESSION; + res = radio_imsmedia->closeSession(sessionId); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); +} + +TEST_P(RadioImsMediaTest, sendHeaderExtension) { + int32_t sessionId = 1; + std::vector extensions; + RtpConfig modifyRtpConfig; + + modifyRtpConfig.direction = + ::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE; + modifyRtpConfig.remoteAddress.ipAddress = "122.22.22.33"; + modifyRtpConfig.remoteAddress.portNumber = 1234; + + if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) { + ALOGI("Skipping setListener because ims is not supported in device"); + return; + } else { + ALOGI("Running setListener because ims is supported in device"); + } + + ndk::ScopedAStatus res = radio_imsmedia->setListener(radio_imsmedialistener); + ASSERT_OK(res); + + serial = SERIAL_OPEN_SESSION; + res = triggerOpenSession(sessionId); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(sessionId, radio_imsmedialistener->mSessionId); + ASSERT_NE(nullptr, radio_imsmedialistener->mSession); + + radio_imsmediasession = radio_imsmedialistener->mSession; + radio_imsmediasession->setListener(radio_imsmediasessionlistener); + ASSERT_OK(res); + + serial = SERIAL_MODIFY_SESSION; + res = radio_imsmediasession->modifySession(modifyRtpConfig); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(modifyRtpConfig, radio_imsmediasessionlistener->mConfig); + verifyError(radio_imsmediasessionlistener->mError); + + res = radio_imsmediasession->sendHeaderExtension(extensions); + ASSERT_OK(res); + + serial = SERIAL_CLOSE_SESSION; + res = radio_imsmedia->closeSession(sessionId); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); +} + +TEST_P(RadioImsMediaTest, setMediaQualityThreshold) { + int32_t sessionId = 1; + MediaQualityThreshold threshold; + RtpConfig modifyRtpConfig; + + modifyRtpConfig.direction = + ::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE; + modifyRtpConfig.remoteAddress.ipAddress = "122.22.22.33"; + modifyRtpConfig.remoteAddress.portNumber = 1234; + + if (!deviceSupportsFeature(FEATURE_TELEPHONY_IMS)) { + ALOGI("Skipping setListener because ims is not supported in device"); + return; + } else { + ALOGI("Running setListener because ims is supported in device"); + } + + ndk::ScopedAStatus res = radio_imsmedia->setListener(radio_imsmedialistener); + ASSERT_OK(res); + + serial = SERIAL_OPEN_SESSION; + res = triggerOpenSession(sessionId); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(sessionId, radio_imsmedialistener->mSessionId); + ASSERT_NE(nullptr, radio_imsmedialistener->mSession); + + radio_imsmediasession = radio_imsmedialistener->mSession; + radio_imsmediasession->setListener(radio_imsmediasessionlistener); + ASSERT_OK(res); + + serial = SERIAL_MODIFY_SESSION; + res = radio_imsmediasession->modifySession(modifyRtpConfig); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(modifyRtpConfig, radio_imsmediasessionlistener->mConfig); + verifyError(radio_imsmediasessionlistener->mError); + + res = radio_imsmediasession->setMediaQualityThreshold(threshold); + ASSERT_OK(res); + + serial = SERIAL_CLOSE_SESSION; + res = radio_imsmedia->closeSession(sessionId); + ASSERT_OK(res); + EXPECT_EQ(std::cv_status::no_timeout, wait()); +} + +ndk::ScopedAStatus RadioImsMediaTest::triggerOpenSession(int32_t sessionId) { + LocalEndPoint localEndPoint; + RtpConfig rtpConfig; + ndk::ScopedAStatus result; + + int mSocketFd = ::socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); + int mRtcpSocketFd = ::socket(AF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0); + localEndPoint.rtpFd = ndk::ScopedFileDescriptor(mSocketFd); + localEndPoint.rtcpFd = ndk::ScopedFileDescriptor(mRtcpSocketFd); + localEndPoint.modemId = 1; + + rtpConfig.direction = + ::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE; + rtpConfig.remoteAddress.ipAddress = "122.22.22.22"; + rtpConfig.remoteAddress.portNumber = 2222; + + result = radio_imsmedia->openSession(sessionId, localEndPoint, rtpConfig); + + return result; +} + +void RadioImsMediaTest::verifyError(RtpError error) { + switch (error) { + case RtpError::NONE: + case RtpError::INVALID_PARAM: + case RtpError::NOT_READY: + case RtpError::NO_MEMORY: + case RtpError::NO_RESOURCES: + case RtpError::PORT_UNAVAILABLE: + case RtpError::NOT_SUPPORTED: + SUCCEED(); + break; + default: + FAIL(); + break; + } +} diff --git a/radio/aidl/vts/radio_imsmedia_utils.h b/radio/aidl/vts/radio_imsmedia_utils.h new file mode 100644 index 0000000000..6143addd03 --- /dev/null +++ b/radio/aidl/vts/radio_imsmedia_utils.h @@ -0,0 +1,98 @@ + +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include + +#include "radio_aidl_hal_utils.h" + +#define SERIAL_SET_LISTENER 1 +#define SERIAL_OPEN_SESSION 2 +#define SERIAL_CLOSE_SESSION 3 +#define SERIAL_MODIFY_SESSION 4 + +using namespace aidl::android::hardware::radio::ims::media; + +class RadioImsMediaTest; + +/* Listener class for ImsMedia. */ +class ImsMediaListener : public BnImsMediaListener { + protected: + RadioServiceTest& parent_imsmedia; + + public: + ImsMediaListener(RadioServiceTest& parent_imsmedialistener); + virtual ~ImsMediaListener() = default; + + int32_t mSessionId; + std::shared_ptr<::aidl::android::hardware::radio::ims::media::IImsMediaSession> mSession; + RtpError mError; + + virtual ndk::ScopedAStatus onOpenSessionSuccess( + int32_t in_sessionId, const std::shared_ptr& in_session) override; + virtual ndk::ScopedAStatus onOpenSessionFailure(int32_t in_sessionId, + RtpError in_error) override; + virtual ndk::ScopedAStatus onSessionClosed(int32_t in_sessionId) override; +}; + +/* Listener class for ImsMediaSession. */ +class ImsMediaSessionListener : public BnImsMediaSessionListener { + protected: + RadioServiceTest& parent_imsmedia; + + public: + ImsMediaSessionListener(RadioServiceTest& parent_imsmediasessionlistener); + virtual ~ImsMediaSessionListener() = default; + + RtpConfig mConfig; + RtpError mError; + + virtual ndk::ScopedAStatus onModifySessionResponse(const RtpConfig& in_config, + RtpError in_error) override; + virtual ndk::ScopedAStatus onFirstMediaPacketReceived(const RtpConfig& in_config) override; + virtual ndk::ScopedAStatus onHeaderExtensionReceived( + const std::vector& in_extensions) override; + virtual ndk::ScopedAStatus notifyMediaQualityStatus( + const MediaQualityStatus& in_quality) override; + virtual ndk::ScopedAStatus triggerAnbrQuery(const RtpConfig& in_config) override; + virtual ndk::ScopedAStatus onDtmfReceived(char16_t in_dtmfDigit, + int32_t in_durationMs) override; + virtual ndk::ScopedAStatus onCallQualityChanged(const CallQuality& in_callQuality) override; +}; + +/* The main test class for Radio AIDL ImsMedia. */ +class RadioImsMediaTest : public ::testing::TestWithParam, public RadioServiceTest { + protected: + virtual void verifyError(RtpError inError); + virtual ndk::ScopedAStatus triggerOpenSession(int32_t sessionId); + + public: + virtual void SetUp() override; + + /* radio imsmedia service handle */ + std::shared_ptr radio_imsmedia; + /* radio imsmediasession service handle */ + std::shared_ptr radio_imsmediasession; + /* radio imsmedia listener handle */ + std::shared_ptr radio_imsmedialistener; + /* radio imsmediasession listener handle */ + std::shared_ptr radio_imsmediasessionlistener; +}; From 1a28a9ff7afc65dd02278879284c1c75089b9270 Mon Sep 17 00:00:00 2001 From: Yu-Han Yang Date: Fri, 3 Feb 2023 04:09:31 +0000 Subject: [PATCH 655/998] Fix a comment Bug: 244325461 Test: doc update only Change-Id: I55d9445eea9c6b8626a5a8eaaf83eaf318b354ca --- gnss/aidl/vts/gnss_hal_test_cases.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp index bed5a6942c..0fbd5e3347 100644 --- a/gnss/aidl/vts/gnss_hal_test_cases.cpp +++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp @@ -1491,7 +1491,7 @@ TEST_P(GnssHalTest, TestGnssMeasurementIntervals_LocationOnAfterMeasurement) { ASSERT_TRUE(iGnssMeasurement != nullptr); int locationIntervalMs = 1000; - // Start location first and then start measurement + // Start measurement first and then start location ALOGD("TestGnssMeasurementIntervals_LocationOnAfterMeasurement"); for (auto& intervalMs : intervals) { auto callback = sp::make(); From f3661ff85c6dca03d810a8f6857fb5efe42fafdd Mon Sep 17 00:00:00 2001 From: Joe Bolinger Date: Wed, 1 Feb 2023 01:34:19 +0000 Subject: [PATCH 656/998] Add wake reason to OperationContext. This additional metadata can optionally be used by the HAL to make optimizations when an operation is started. Bug: 246363169 Test: N/A (builds) Change-Id: I493cba04f54d09f976b31a68661a18397af02ce9 --- .../biometrics/common/OperationContext.aidl | 1 + .../biometrics/common/OperationReason.aidl | 6 +- .../biometrics/common/SensorStrength.aidl | 6 +- .../biometrics/common/WakeReason.aidl | 48 +++++++++++ .../biometrics/common/OperationContext.aidl | 11 +++ .../biometrics/common/OperationReason.aidl | 2 + .../biometrics/common/WakeReason.aidl | 81 +++++++++++++++++++ 7 files changed, 149 insertions(+), 6 deletions(-) create mode 100644 biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/WakeReason.aidl create mode 100644 biometrics/common/aidl/android/hardware/biometrics/common/WakeReason.aidl diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationContext.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationContext.aidl index 5e184bce4b..305e422778 100644 --- a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationContext.aidl +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationContext.aidl @@ -39,4 +39,5 @@ parcelable OperationContext { android.hardware.biometrics.common.OperationReason reason = android.hardware.biometrics.common.OperationReason.UNKNOWN; boolean isAod = false; boolean isCrypto = false; + android.hardware.biometrics.common.WakeReason wakeReason = android.hardware.biometrics.common.WakeReason.UNKNOWN; } diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationReason.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationReason.aidl index a5b2990e57..188054a45a 100644 --- a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationReason.aidl +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationReason.aidl @@ -35,7 +35,7 @@ package android.hardware.biometrics.common; /* @hide */ @Backing(type="byte") @VintfStability enum OperationReason { - UNKNOWN = 0, - BIOMETRIC_PROMPT = 1, - KEYGUARD = 2, + UNKNOWN, + BIOMETRIC_PROMPT, + KEYGUARD, } diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/SensorStrength.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/SensorStrength.aidl index aa773221a6..c93178167d 100644 --- a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/SensorStrength.aidl +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/SensorStrength.aidl @@ -35,7 +35,7 @@ package android.hardware.biometrics.common; /* @hide */ @Backing(type="byte") @VintfStability enum SensorStrength { - CONVENIENCE = 0, - WEAK = 1, - STRONG = 2, + CONVENIENCE, + WEAK, + STRONG, } diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/WakeReason.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/WakeReason.aidl new file mode 100644 index 0000000000..6a08776280 --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/WakeReason.aidl @@ -0,0 +1,48 @@ +/* + * 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 -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.hardware.biometrics.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum WakeReason { + UNKNOWN, + POWER_BUTTON, + GESTURE, + WAKE_KEY, + WAKE_MOTION, + LID, + DISPLAY_GROUP_ADDED, + TAP, + LIFT, + BIOMETRIC, +} diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl index a1c7a1f563..a8f768d805 100644 --- a/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl +++ b/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl @@ -17,6 +17,7 @@ package android.hardware.biometrics.common; import android.hardware.biometrics.common.OperationReason; +import android.hardware.biometrics.common.WakeReason; /** * Additional context associated with an operation. @@ -47,4 +48,14 @@ parcelable OperationContext { /** Flag indicating that crypto was requested. */ boolean isCrypto = false; + + /** + * An associated wake reason for this operation or WakeReason.UNKNOWN if this + * operation was not associated with a device wake up event. + * + * This should be interpreted as a hint to enable optimizations or tracing. The + * framework may choose to use WakeReason.UNKNOWN at any time based on the device's + * policy. + */ + WakeReason wakeReason = WakeReason.UNKNOWN; } diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/OperationReason.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/OperationReason.aidl index a93cebc1f6..1775c435b8 100644 --- a/biometrics/common/aidl/android/hardware/biometrics/common/OperationReason.aidl +++ b/biometrics/common/aidl/android/hardware/biometrics/common/OperationReason.aidl @@ -15,7 +15,9 @@ */ package android.hardware.biometrics.common; + /** + * The reason for invoking an operation. * @hide */ @VintfStability diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/WakeReason.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/WakeReason.aidl new file mode 100644 index 0000000000..2f36b003ee --- /dev/null +++ b/biometrics/common/aidl/android/hardware/biometrics/common/WakeReason.aidl @@ -0,0 +1,81 @@ +/* + * 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.hardware.biometrics.common; + +/** + * The wake event associated with an operation, if applicable. + * + * The events largely shadow constants defined in PowerManager but they may deviate over time. + * @hide + */ +@VintfStability +@Backing(type="int") +enum WakeReason { + /** + * A normal operation without an explicit reason. + */ + UNKNOWN, + + /** + * Waking up due to power button press. + */ + POWER_BUTTON, + + /** + * Waking up due to a user performed gesture. This includes user + * interactions with UI on the screen such as the notification shade. This does not include + * WakeReason.TAP or WakeReason.LIFT. + */ + GESTURE, + + /** + * Waking up because a wake key other than power was pressed. + */ + WAKE_KEY, + + /** + * Waking up because a wake motion was performed. + */ + WAKE_MOTION, + + /** + * Waking due to the lid being opened. + */ + LID, + + /** + * Waking due to display group being added. + */ + DISPLAY_GROUP_ADDED, + + /** + * Waking up due to the user single or double tapping on the screen. This + * wake reason is used when the user is not tapping on a specific UI element; rather, the device + * wakes up due to a generic tap on the screen. + */ + TAP, + + /** + * Waking up due to a user performed lift gesture. + */ + LIFT, + + /** + * Waking up due to a user interacting with a biometric. + */ + BIOMETRIC, +} From 6594289414e3fc18ed177f1aa67273ce3e5a1619 Mon Sep 17 00:00:00 2001 From: Eva Chen Date: Tue, 20 Dec 2022 16:57:55 -0800 Subject: [PATCH 657/998] Add new StatusCode values for ADAS properties. Add NOT_AVAILABLE_DISABLED, NOT_AVAILABLE_SPEED_LOW, NOT_AVAILABLE_SPEED_HIGH, NOT_AVAILABLE_POOR_VISIBILITY, and NOT_AVAILABLE_SAFETY StatusCode definitions. These were added to support ADAS properties, but could be used for non-ADAS properties. Bug: 263294718 Test: atest VtsHalAutomotiveVehicle_TargetTest Test: atest CtsCarTestCases:CarPropertyManagerTest Test: atest CtsCarTestCases:VehiclePropertyIdsTest Change-Id: Ic3a8cd30f1fb0f7b0300cc77ab8ca7cb66b15316 --- .../automotive/vehicle/StatusCode.aidl | 5 +++ .../automotive/vehicle/StatusCode.aidl | 31 +++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/StatusCode.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/StatusCode.aidl index 9b724126af..f7e8c5abf7 100644 --- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/StatusCode.aidl +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/StatusCode.aidl @@ -40,4 +40,9 @@ enum StatusCode { NOT_AVAILABLE = 3, ACCESS_DENIED = 4, INTERNAL_ERROR = 5, + NOT_AVAILABLE_DISABLED = 6, + NOT_AVAILABLE_SPEED_LOW = 7, + NOT_AVAILABLE_SPEED_HIGH = 8, + NOT_AVAILABLE_POOR_VISIBILITY = 9, + NOT_AVAILABLE_SAFETY = 10, } diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/StatusCode.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/StatusCode.aidl index 35080dbebd..8ac6506f69 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/StatusCode.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/StatusCode.aidl @@ -62,4 +62,35 @@ enum StatusCode { * Something unexpected has happened in Vehicle HAL */ INTERNAL_ERROR = 5, + + /** + * The following error codes were added in version 2 of this interface. + */ + + /** + * For features that are not available because the underlying feature is + * disabled. + */ + NOT_AVAILABLE_DISABLED = 6, + /** + * For features that are not available because the vehicle speed is too low. + */ + NOT_AVAILABLE_SPEED_LOW = 7, + /** + * For features that are not available because the vehicle speed is too + * high. + */ + NOT_AVAILABLE_SPEED_HIGH = 8, + /** + * For features that are not available because of bad camera or sensor + * visibility. Examples might be bird poop blocking the camera or a bumper + * cover blocking an ultrasonic sensor. + */ + NOT_AVAILABLE_POOR_VISIBILITY = 9, + /** + * The feature cannot be accessed due to safety reasons. Eg. System could be + * in a faulty state, an object or person could be blocking the requested + * operation such as closing a trunk door, etc. + */ + NOT_AVAILABLE_SAFETY = 10, } From e1153030e7f2a91d9fc38ec7d789ff3319a105de Mon Sep 17 00:00:00 2001 From: Avichal Rakesh Date: Thu, 19 Jan 2023 19:52:06 -0800 Subject: [PATCH 658/998] Usb Gadget: Add UVC to Usb Gadget interface UVC Gadget Function is required for DeviceAsWebcam service that lets Android Devices be used as Webcam when connected to hosts. This CL adds the UVC GadgetFunction to the USB Gadget interface. Bug: 242344221 Test: Manually tested that the HAL and the framework pick up the new GadgetFunction Change-Id: I93acf458f279500320ffc5abd55f139d3d768101 --- .../hardware/usb/gadget/GadgetFunction.aidl | 15 ++++++++------- .../hardware/usb/gadget/GadgetFunction.aidl | 4 ++++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/GadgetFunction.aidl b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/GadgetFunction.aidl index c3f26d5efd..78b79e46e3 100644 --- a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/GadgetFunction.aidl +++ b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/GadgetFunction.aidl @@ -36,11 +36,12 @@ package android.hardware.usb.gadget; parcelable GadgetFunction { const long NONE = 0; const long ADB = 1; - const long ACCESSORY = 2; - const long MTP = 4; - const long MIDI = 8; - const long PTP = 16; - const long RNDIS = 32; - const long AUDIO_SOURCE = 64; - const long NCM = 1024; + const long ACCESSORY = (1 << 1); + const long MTP = (1 << 2); + const long MIDI = (1 << 3); + const long PTP = (1 << 4); + const long RNDIS = (1 << 5); + const long AUDIO_SOURCE = (1 << 6); + const long UVC = (1 << 7); + const long NCM = (1 << 10); } diff --git a/usb/gadget/aidl/android/hardware/usb/gadget/GadgetFunction.aidl b/usb/gadget/aidl/android/hardware/usb/gadget/GadgetFunction.aidl index d82b427621..dd7ee3771f 100644 --- a/usb/gadget/aidl/android/hardware/usb/gadget/GadgetFunction.aidl +++ b/usb/gadget/aidl/android/hardware/usb/gadget/GadgetFunction.aidl @@ -50,6 +50,10 @@ parcelable GadgetFunction { * AOAv2.0 - Audio Source function. */ const long AUDIO_SOURCE = 1 << 6; + /** + * UVC - Universal Video Class function. + */ + const long UVC = 1 << 7; /** * NCM - NCM function. */ From 21a98b4a516a673be2e79579e1c1dc9dc35cc85e Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Sun, 5 Feb 2023 20:21:17 -0800 Subject: [PATCH 659/998] Rename maxMloLinkCount to maxMloStrLinkCount The maximum number of Simultaneous Transmit Receive (STR) links used in Multi-Link Operation can be different from the maximum radios supported by the chip.Explicitly mention the max links as max STR links. Update the description and usage of the capability field. Bug: 267963579 Test: m android.hardware.wifi-update-api Change-Id: I5691fcc44c60821766fe41e67624e458ba051059 --- .../android/hardware/wifi/WifiChipCapabilities.aidl | 2 +- wifi/aidl/android/hardware/wifi/WifiChipCapabilities.aidl | 8 ++++---- wifi/aidl/default/aidl_struct_util.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChipCapabilities.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChipCapabilities.aidl index 48dc8e0805..f640861101 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChipCapabilities.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChipCapabilities.aidl @@ -34,6 +34,6 @@ package android.hardware.wifi; @VintfStability parcelable WifiChipCapabilities { - int maxMloLinkCount; + int maxMloStrLinkCount; int maxConcurrentTdlsSessionCount; } diff --git a/wifi/aidl/android/hardware/wifi/WifiChipCapabilities.aidl b/wifi/aidl/android/hardware/wifi/WifiChipCapabilities.aidl index f65d49ac28..4e0578b61c 100644 --- a/wifi/aidl/android/hardware/wifi/WifiChipCapabilities.aidl +++ b/wifi/aidl/android/hardware/wifi/WifiChipCapabilities.aidl @@ -22,13 +22,13 @@ package android.hardware.wifi; @VintfStability parcelable WifiChipCapabilities { /** - * Maximum number of links used in Multi-Link Operation. The maximum - * number of links used for MLO can be different from the number of - * radios supported by the chip. + * Maximum number of Simultaneous Transmit and Receive (STR) links used + * in Multi-Link Operation. The maximum number of STR links used can be + * different from the maximum number of radios supported by the chip. * * This is a static configuration of the chip. */ - int maxMloLinkCount; + int maxMloStrLinkCount; /** * Maximum number of concurrent TDLS sessions that can be enabled * by framework via ISupplicantStaIface#initiateTdlsSetup(). diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index 68fe2e6edc..921b5dc38c 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -3316,7 +3316,7 @@ bool convertLegacyNanBootstrappingConfirmIndToAidl( bool convertLegacyWifiChipCapabilitiesToAidl( const legacy_hal::wifi_chip_capabilities& legacy_chip_capabilities, WifiChipCapabilities& aidl_chip_capabilities) { - aidl_chip_capabilities.maxMloLinkCount = legacy_chip_capabilities.max_mlo_link_count; + aidl_chip_capabilities.maxMloStrLinkCount = legacy_chip_capabilities.max_mlo_str_link_count; aidl_chip_capabilities.maxConcurrentTdlsSessionCount = legacy_chip_capabilities.max_concurrent_tdls_session_count; return true; From ca297846bb969ece023f0ba39dfbecb0196d3fb5 Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Mon, 30 Jan 2023 12:49:38 -0800 Subject: [PATCH 660/998] Fix the parameter range for llstats aidl unit test Bug: 268054128 Test: hardware/interfaces/wifi/aidl/default/tests/runtests.sh Change-Id: I66c6bdcbd003895161334dc2b67e118c9b3bba16 --- .../tests/aidl_struct_util_unit_tests.cpp | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp index 9b9d96d118..f97c846800 100644 --- a/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp +++ b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp @@ -131,10 +131,13 @@ TEST_F(AidlStructUtilTest, canConvertLegacyLinkLayerMlStatsToAidl) { link.peers.push_back(legacy_hal::WifiPeerInfo{}); link.peers.push_back(legacy_hal::WifiPeerInfo{}); link.stat.beacon_rx = rand(); - link.stat.link_id = rand() % 15; + // MLO link id: 0 - 15 + link.stat.link_id = rand() % 16; + // Maximum number of radios is limited to 3 for testing. link.stat.radio = rand() % 4; link.stat.frequency = rand(); - link.stat.rssi_mgmt = rand(); + // RSSI: 0 to -127 + link.stat.rssi_mgmt = (rand() % 128) * -1; link.stat.ac[legacy_hal::WIFI_AC_BE].rx_mpdu = rand(); link.stat.ac[legacy_hal::WIFI_AC_BE].tx_mpdu = rand(); link.stat.ac[legacy_hal::WIFI_AC_BE].mpdu_lost = rand(); @@ -171,13 +174,14 @@ TEST_F(AidlStructUtilTest, canConvertLegacyLinkLayerMlStatsToAidl) { link.stat.ac[legacy_hal::WIFI_AC_VO].contention_time_avg = rand(); link.stat.ac[legacy_hal::WIFI_AC_VO].contention_num_samples = rand(); - link.stat.time_slicing_duty_cycle_percent = rand(); + link.stat.time_slicing_duty_cycle_percent = rand() % 101; link.stat.num_peers = 2; // Set peer stats for each of the peers. for (auto& peer : link.peers) { - peer.peer_info.bssload.sta_count = rand(); - peer.peer_info.bssload.chan_util = rand(); + // Max station count is limited to 32 for testing. + peer.peer_info.bssload.sta_count = rand() % 33; + peer.peer_info.bssload.chan_util = rand() % 101; wifi_rate_stat rate_stat1 = { .rate = {3, 1, 2, 5, 0, 0}, .tx_mpdu = 0, @@ -202,7 +206,8 @@ TEST_F(AidlStructUtilTest, canConvertLegacyLinkLayerMlStatsToAidl) { } // Set radio stats for (auto& radio : legacy_ml_stats.radios) { - radio.stats.radio = rand(); + // Maximum number of radios is limited to 3 for testing. + radio.stats.radio = rand() % 4; radio.stats.on_time = rand(); radio.stats.tx_time = rand(); radio.stats.rx_time = rand(); @@ -409,7 +414,8 @@ TEST_F(AidlStructUtilTest, canConvertLegacyLinkLayerStatsToAidl) { legacy_stats.peers.push_back(legacy_hal::WifiPeerInfo{}); legacy_stats.peers.push_back(legacy_hal::WifiPeerInfo{}); legacy_stats.iface.beacon_rx = rand(); - legacy_stats.iface.rssi_mgmt = rand(); + // RSSI: 0 to -127 + legacy_stats.iface.rssi_mgmt = rand() % 128; legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].rx_mpdu = rand(); legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].tx_mpdu = rand(); legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].mpdu_lost = rand(); @@ -446,11 +452,12 @@ TEST_F(AidlStructUtilTest, canConvertLegacyLinkLayerStatsToAidl) { legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_avg = rand(); legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_num_samples = rand(); - legacy_stats.iface.info.time_slicing_duty_cycle_percent = rand(); + legacy_stats.iface.info.time_slicing_duty_cycle_percent = rand() % 101; legacy_stats.iface.num_peers = 1; for (auto& radio : legacy_stats.radios) { - radio.stats.radio = rand(); + // Max number of radios limit to 3. + radio.stats.radio = rand() % 4; radio.stats.on_time = rand(); radio.stats.tx_time = rand(); radio.stats.rx_time = rand(); @@ -479,8 +486,9 @@ TEST_F(AidlStructUtilTest, canConvertLegacyLinkLayerStatsToAidl) { } for (auto& peer : legacy_stats.peers) { - peer.peer_info.bssload.sta_count = rand(); - peer.peer_info.bssload.chan_util = rand(); + // Max number of stations is limited to 32 for testing. + peer.peer_info.bssload.sta_count = rand() % 33; + peer.peer_info.bssload.chan_util = rand() % 101; wifi_rate_stat rate_stat1 = { .rate = {3, 1, 2, 5, 0, 0}, .tx_mpdu = 0, From 1448ad4d875b4c449576cf1a005dc8d02e1c9e8a Mon Sep 17 00:00:00 2001 From: sadiqsada Date: Tue, 31 Jan 2023 16:14:04 -0800 Subject: [PATCH 661/998] Add Frontend Status Types and tuning for IPTV IPTVFrontendSettings is a new setting for the tune() function. This function was modified to support the new setting. Test: None Bug: 266967059 Change-Id: I9d36dd47ca3aa419e7663570528ed2832baa1653 --- .../tv/tuner/FrontendCapabilities.aidl | 1 + .../tv/tuner/FrontendIptvCapabilities.aidl | 39 +++++++++++++++++++ .../tv/tuner/FrontendCapabilities.aidl | 3 ++ .../tv/tuner/FrontendIptvCapabilities.aidl | 29 ++++++++++++++ tv/tuner/aidl/default/Frontend.cpp | 16 +++++++- 5 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvCapabilities.aidl create mode 100644 tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvCapabilities.aidl diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendCapabilities.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendCapabilities.aidl index c013cd111a..c9443b1782 100644 --- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendCapabilities.aidl +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendCapabilities.aidl @@ -45,4 +45,5 @@ union FrontendCapabilities { android.hardware.tv.tuner.FrontendIsdbsCapabilities isdbsCaps; android.hardware.tv.tuner.FrontendIsdbs3Capabilities isdbs3Caps; android.hardware.tv.tuner.FrontendIsdbtCapabilities isdbtCaps; + @nullable android.hardware.tv.tuner.FrontendIptvCapabilities iptvCaps; } diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvCapabilities.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvCapabilities.aidl new file mode 100644 index 0000000000..543543df96 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvCapabilities.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendIptvCapabilities { + int protocolCap; +} diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendCapabilities.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendCapabilities.aidl index a6f14900d1..cfa1763e8d 100644 --- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendCapabilities.aidl +++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendCapabilities.aidl @@ -23,6 +23,7 @@ import android.hardware.tv.tuner.FrontendDtmbCapabilities; import android.hardware.tv.tuner.FrontendDvbcCapabilities; import android.hardware.tv.tuner.FrontendDvbsCapabilities; import android.hardware.tv.tuner.FrontendDvbtCapabilities; +import android.hardware.tv.tuner.FrontendIptvCapabilities; import android.hardware.tv.tuner.FrontendIsdbs3Capabilities; import android.hardware.tv.tuner.FrontendIsdbsCapabilities; import android.hardware.tv.tuner.FrontendIsdbtCapabilities; @@ -51,4 +52,6 @@ union FrontendCapabilities { FrontendIsdbs3Capabilities isdbs3Caps; FrontendIsdbtCapabilities isdbtCaps; + + @nullable FrontendIptvCapabilities iptvCaps; } diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvCapabilities.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvCapabilities.aidl new file mode 100644 index 0000000000..438492b289 --- /dev/null +++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvCapabilities.aidl @@ -0,0 +1,29 @@ +/* + * Copyright 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.hardware.tv.tuner; + +/** + * Capabilities for IPTV Frontend. + * @hide + */ +@VintfStability +parcelable FrontendIptvCapabilities { + /** + * Transmission protocols for IPTV (UDP / RTP) defined in FrontendIptvSettingsProtocol. + */ + int protocolCap; +} diff --git a/tv/tuner/aidl/default/Frontend.cpp b/tv/tuner/aidl/default/Frontend.cpp index d140b7428b..cd072bfe8d 100644 --- a/tv/tuner/aidl/default/Frontend.cpp +++ b/tv/tuner/aidl/default/Frontend.cpp @@ -164,6 +164,17 @@ Frontend::Frontend(FrontendType type, int32_t id) { }; break; } + case FrontendType::IPTV: { + mFrontendCaps.set(FrontendIptvCapabilities()); + mFrontendStatusCaps = { + FrontendStatusType::IPTV_CONTENT_URL, + FrontendStatusType::IPTV_PACKETS_LOST, + FrontendStatusType::IPTV_PACKETS_RECEIVED, + FrontendStatusType::IPTV_AVERAGE_JITTER_MS, + FrontendStatusType::IPTV_WORST_JITTER_MS, + }; + break; + } default: { break; } @@ -210,7 +221,10 @@ Frontend::~Frontend() { static_cast(Result::INVALID_STATE)); } - mTuner->frontendStartTune(mId); + if (mType != FrontendType::IPTV) { + mTuner->frontendStartTune(mId); + } + mCallback->onEvent(FrontendEventType::LOCKED); mIsLocked = true; From 76a464073dd6efb4e9fa5eeb1fe2e51534efeb33 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Fri, 3 Feb 2023 15:19:44 -0800 Subject: [PATCH 662/998] Define VEHICLE_IN_USE property. Test: m -j android.hardware.automotive.vehicle.property-update-api Bug: 267813114 Change-Id: I366117ff228f75b607fda97888075bd355638cf4 --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../automotive/vehicle/ErrorState.aidl | 10 +- .../vehicle/Obd2CommonIgnitionMonitors.aidl | 12 +- .../Obd2CompressionIgnitionMonitors.aidl | 36 +- .../vehicle/Obd2SparkIgnitionMonitors.aidl | 44 +- .../automotive/vehicle/VehicleProperty.aidl | 431 +++++++++--------- .../automotive/vehicle/VehicleProperty.aidl | 28 ++ 10 files changed, 299 insertions(+), 266 deletions(-) diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index edd44a80e3..198681ec72 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -239,6 +239,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyAccess::READ}, {VehicleProperty::SUPPORTED_PROPERTY_IDS, VehiclePropertyAccess::READ}, {VehicleProperty::SHUTDOWN_REQUEST, VehiclePropertyAccess::WRITE}, + {VehicleProperty::VEHICLE_IN_USE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 726bfcc81e..4dbe7aa835 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -239,6 +239,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::SUPPORTED_PROPERTY_IDS, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::SHUTDOWN_REQUEST, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::VEHICLE_IN_USE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 36449feb59..88314e3f37 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -231,6 +231,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.SUPPORTED_PROPERTY_IDS, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.SHUTDOWN_REQUEST, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.VEHICLE_IN_USE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 12e4e8fa4e..787bb2b59b 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -231,6 +231,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, VehiclePropertyChangeMode.STATIC), Map.entry(VehicleProperty.SUPPORTED_PROPERTY_IDS, VehiclePropertyChangeMode.STATIC), Map.entry(VehicleProperty.SHUTDOWN_REQUEST, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.VEHICLE_IN_USE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ErrorState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ErrorState.aidl index aaf3565db4..e3305c7403 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ErrorState.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ErrorState.aidl @@ -34,9 +34,9 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum ErrorState { - OTHER_ERROR_STATE = (-1), - NOT_AVAILABLE_DISABLED = (-2), - NOT_AVAILABLE_SPEED_LOW = (-3), - NOT_AVAILABLE_SPEED_HIGH = (-4), - NOT_AVAILABLE_SAFETY = (-5), + OTHER_ERROR_STATE = (-1) /* -1 */, + NOT_AVAILABLE_DISABLED = (-2) /* -2 */, + NOT_AVAILABLE_SPEED_LOW = (-3) /* -3 */, + NOT_AVAILABLE_SPEED_HIGH = (-4) /* -4 */, + NOT_AVAILABLE_SAFETY = (-5) /* -5 */, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl index 22eea1f3b9..7d122241eb 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl @@ -34,10 +34,10 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum Obd2CommonIgnitionMonitors { - COMPONENTS_AVAILABLE = (0x1 << 0), - COMPONENTS_INCOMPLETE = (0x1 << 1), - FUEL_SYSTEM_AVAILABLE = (0x1 << 2), - FUEL_SYSTEM_INCOMPLETE = (0x1 << 3), - MISFIRE_AVAILABLE = (0x1 << 4), - MISFIRE_INCOMPLETE = (0x1 << 5), + COMPONENTS_AVAILABLE = (0x1 << 0) /* 1 */, + COMPONENTS_INCOMPLETE = (0x1 << 1) /* 2 */, + FUEL_SYSTEM_AVAILABLE = (0x1 << 2) /* 4 */, + FUEL_SYSTEM_INCOMPLETE = (0x1 << 3) /* 8 */, + MISFIRE_AVAILABLE = (0x1 << 4) /* 16 */, + MISFIRE_INCOMPLETE = (0x1 << 5) /* 32 */, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl index 335f0ad114..90240bf4bf 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl @@ -34,22 +34,22 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum Obd2CompressionIgnitionMonitors { - COMPONENTS_AVAILABLE = (0x1 << 0), - COMPONENTS_INCOMPLETE = (0x1 << 1), - FUEL_SYSTEM_AVAILABLE = (0x1 << 2), - FUEL_SYSTEM_INCOMPLETE = (0x1 << 3), - MISFIRE_AVAILABLE = (0x1 << 4), - MISFIRE_INCOMPLETE = (0x1 << 5), - EGR_OR_VVT_AVAILABLE = (0x1 << 6), - EGR_OR_VVT_INCOMPLETE = (0x1 << 7), - PM_FILTER_AVAILABLE = (0x1 << 8), - PM_FILTER_INCOMPLETE = (0x1 << 9), - EXHAUST_GAS_SENSOR_AVAILABLE = (0x1 << 10), - EXHAUST_GAS_SENSOR_INCOMPLETE = (0x1 << 11), - BOOST_PRESSURE_AVAILABLE = (0x1 << 12), - BOOST_PRESSURE_INCOMPLETE = (0x1 << 13), - NOx_SCR_AVAILABLE = (0x1 << 14), - NOx_SCR_INCOMPLETE = (0x1 << 15), - NMHC_CATALYST_AVAILABLE = (0x1 << 16), - NMHC_CATALYST_INCOMPLETE = (0x1 << 17), + COMPONENTS_AVAILABLE = (0x1 << 0) /* 1 */, + COMPONENTS_INCOMPLETE = (0x1 << 1) /* 2 */, + FUEL_SYSTEM_AVAILABLE = (0x1 << 2) /* 4 */, + FUEL_SYSTEM_INCOMPLETE = (0x1 << 3) /* 8 */, + MISFIRE_AVAILABLE = (0x1 << 4) /* 16 */, + MISFIRE_INCOMPLETE = (0x1 << 5) /* 32 */, + EGR_OR_VVT_AVAILABLE = (0x1 << 6) /* 64 */, + EGR_OR_VVT_INCOMPLETE = (0x1 << 7) /* 128 */, + PM_FILTER_AVAILABLE = (0x1 << 8) /* 256 */, + PM_FILTER_INCOMPLETE = (0x1 << 9) /* 512 */, + EXHAUST_GAS_SENSOR_AVAILABLE = (0x1 << 10) /* 1024 */, + EXHAUST_GAS_SENSOR_INCOMPLETE = (0x1 << 11) /* 2048 */, + BOOST_PRESSURE_AVAILABLE = (0x1 << 12) /* 4096 */, + BOOST_PRESSURE_INCOMPLETE = (0x1 << 13) /* 8192 */, + NOx_SCR_AVAILABLE = (0x1 << 14) /* 16384 */, + NOx_SCR_INCOMPLETE = (0x1 << 15) /* 32768 */, + NMHC_CATALYST_AVAILABLE = (0x1 << 16) /* 65536 */, + NMHC_CATALYST_INCOMPLETE = (0x1 << 17) /* 131072 */, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl index 4fc48ce193..51e321b828 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl @@ -34,26 +34,26 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum Obd2SparkIgnitionMonitors { - COMPONENTS_AVAILABLE = (0x1 << 0), - COMPONENTS_INCOMPLETE = (0x1 << 1), - FUEL_SYSTEM_AVAILABLE = (0x1 << 2), - FUEL_SYSTEM_INCOMPLETE = (0x1 << 3), - MISFIRE_AVAILABLE = (0x1 << 4), - MISFIRE_INCOMPLETE = (0x1 << 5), - EGR_AVAILABLE = (0x1 << 6), - EGR_INCOMPLETE = (0x1 << 7), - OXYGEN_SENSOR_HEATER_AVAILABLE = (0x1 << 8), - OXYGEN_SENSOR_HEATER_INCOMPLETE = (0x1 << 9), - OXYGEN_SENSOR_AVAILABLE = (0x1 << 10), - OXYGEN_SENSOR_INCOMPLETE = (0x1 << 11), - AC_REFRIGERANT_AVAILABLE = (0x1 << 12), - AC_REFRIGERANT_INCOMPLETE = (0x1 << 13), - SECONDARY_AIR_SYSTEM_AVAILABLE = (0x1 << 14), - SECONDARY_AIR_SYSTEM_INCOMPLETE = (0x1 << 15), - EVAPORATIVE_SYSTEM_AVAILABLE = (0x1 << 16), - EVAPORATIVE_SYSTEM_INCOMPLETE = (0x1 << 17), - HEATED_CATALYST_AVAILABLE = (0x1 << 18), - HEATED_CATALYST_INCOMPLETE = (0x1 << 19), - CATALYST_AVAILABLE = (0x1 << 20), - CATALYST_INCOMPLETE = (0x1 << 21), + COMPONENTS_AVAILABLE = (0x1 << 0) /* 1 */, + COMPONENTS_INCOMPLETE = (0x1 << 1) /* 2 */, + FUEL_SYSTEM_AVAILABLE = (0x1 << 2) /* 4 */, + FUEL_SYSTEM_INCOMPLETE = (0x1 << 3) /* 8 */, + MISFIRE_AVAILABLE = (0x1 << 4) /* 16 */, + MISFIRE_INCOMPLETE = (0x1 << 5) /* 32 */, + EGR_AVAILABLE = (0x1 << 6) /* 64 */, + EGR_INCOMPLETE = (0x1 << 7) /* 128 */, + OXYGEN_SENSOR_HEATER_AVAILABLE = (0x1 << 8) /* 256 */, + OXYGEN_SENSOR_HEATER_INCOMPLETE = (0x1 << 9) /* 512 */, + OXYGEN_SENSOR_AVAILABLE = (0x1 << 10) /* 1024 */, + OXYGEN_SENSOR_INCOMPLETE = (0x1 << 11) /* 2048 */, + AC_REFRIGERANT_AVAILABLE = (0x1 << 12) /* 4096 */, + AC_REFRIGERANT_INCOMPLETE = (0x1 << 13) /* 8192 */, + SECONDARY_AIR_SYSTEM_AVAILABLE = (0x1 << 14) /* 16384 */, + SECONDARY_AIR_SYSTEM_INCOMPLETE = (0x1 << 15) /* 32768 */, + EVAPORATIVE_SYSTEM_AVAILABLE = (0x1 << 16) /* 65536 */, + EVAPORATIVE_SYSTEM_INCOMPLETE = (0x1 << 17) /* 131072 */, + HEATED_CATALYST_AVAILABLE = (0x1 << 18) /* 262144 */, + HEATED_CATALYST_INCOMPLETE = (0x1 << 19) /* 524288 */, + CATALYST_AVAILABLE = (0x1 << 20) /* 1048576 */, + CATALYST_INCOMPLETE = (0x1 << 21) /* 2097152 */, } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 61e7add6d4..4b8151c8c1 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -35,219 +35,220 @@ package android.hardware.automotive.vehicle; @Backing(type="int") @VintfStability enum VehicleProperty { INVALID = 0x00000000, - INFO_VIN = (((0x0100 + 0x10000000) + 0x01000000) + 0x00100000), - INFO_MAKE = (((0x0101 + 0x10000000) + 0x01000000) + 0x00100000), - INFO_MODEL = (((0x0102 + 0x10000000) + 0x01000000) + 0x00100000), - INFO_MODEL_YEAR = (((0x0103 + 0x10000000) + 0x01000000) + 0x00400000), - INFO_FUEL_CAPACITY = (((0x0104 + 0x10000000) + 0x01000000) + 0x00600000), - INFO_FUEL_TYPE = (((0x0105 + 0x10000000) + 0x01000000) + 0x00410000), - INFO_EV_BATTERY_CAPACITY = (((0x0106 + 0x10000000) + 0x01000000) + 0x00600000), - INFO_EV_CONNECTOR_TYPE = (((0x0107 + 0x10000000) + 0x01000000) + 0x00410000), - INFO_FUEL_DOOR_LOCATION = (((0x0108 + 0x10000000) + 0x01000000) + 0x00400000), - INFO_EV_PORT_LOCATION = (((0x0109 + 0x10000000) + 0x01000000) + 0x00400000), - INFO_DRIVER_SEAT = (((0x010A + 0x10000000) + 0x05000000) + 0x00400000), - INFO_EXTERIOR_DIMENSIONS = (((0x010B + 0x10000000) + 0x01000000) + 0x00410000), - INFO_MULTI_EV_PORT_LOCATIONS = (((0x010C + 0x10000000) + 0x01000000) + 0x00410000), - PERF_ODOMETER = (((0x0204 + 0x10000000) + 0x01000000) + 0x00600000), - PERF_VEHICLE_SPEED = (((0x0207 + 0x10000000) + 0x01000000) + 0x00600000), - PERF_VEHICLE_SPEED_DISPLAY = (((0x0208 + 0x10000000) + 0x01000000) + 0x00600000), - PERF_STEERING_ANGLE = (((0x0209 + 0x10000000) + 0x01000000) + 0x00600000), - PERF_REAR_STEERING_ANGLE = (((0x0210 + 0x10000000) + 0x01000000) + 0x00600000), - ENGINE_COOLANT_TEMP = (((0x0301 + 0x10000000) + 0x01000000) + 0x00600000), - ENGINE_OIL_LEVEL = (((0x0303 + 0x10000000) + 0x01000000) + 0x00400000), - ENGINE_OIL_TEMP = (((0x0304 + 0x10000000) + 0x01000000) + 0x00600000), - ENGINE_RPM = (((0x0305 + 0x10000000) + 0x01000000) + 0x00600000), - WHEEL_TICK = (((0x0306 + 0x10000000) + 0x01000000) + 0x00510000), - FUEL_LEVEL = (((0x0307 + 0x10000000) + 0x01000000) + 0x00600000), - FUEL_DOOR_OPEN = (((0x0308 + 0x10000000) + 0x01000000) + 0x00200000), - EV_BATTERY_LEVEL = (((0x0309 + 0x10000000) + 0x01000000) + 0x00600000), - EV_CURRENT_BATTERY_CAPACITY = (((0x030D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.FLOAT), - EV_CHARGE_PORT_OPEN = (((0x030A + 0x10000000) + 0x01000000) + 0x00200000), - EV_CHARGE_PORT_CONNECTED = (((0x030B + 0x10000000) + 0x01000000) + 0x00200000), - EV_BATTERY_INSTANTANEOUS_CHARGE_RATE = (((0x030C + 0x10000000) + 0x01000000) + 0x00600000), - RANGE_REMAINING = (((0x0308 + 0x10000000) + 0x01000000) + 0x00600000), - TIRE_PRESSURE = (((0x0309 + 0x10000000) + 0x07000000) + 0x00600000), - CRITICALLY_LOW_TIRE_PRESSURE = (((0x030A + 0x10000000) + 0x07000000) + 0x00600000), - ENGINE_IDLE_AUTO_STOP_ENABLED = (((0x0320 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), - GEAR_SELECTION = (((0x0400 + 0x10000000) + 0x01000000) + 0x00400000), - CURRENT_GEAR = (((0x0401 + 0x10000000) + 0x01000000) + 0x00400000), - PARKING_BRAKE_ON = (((0x0402 + 0x10000000) + 0x01000000) + 0x00200000), - PARKING_BRAKE_AUTO_APPLY = (((0x0403 + 0x10000000) + 0x01000000) + 0x00200000), - EV_BRAKE_REGENERATION_LEVEL = (((0x040C + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), - FUEL_LEVEL_LOW = (((0x0405 + 0x10000000) + 0x01000000) + 0x00200000), - NIGHT_MODE = (((0x0407 + 0x10000000) + 0x01000000) + 0x00200000), - TURN_SIGNAL_STATE = (((0x0408 + 0x10000000) + 0x01000000) + 0x00400000), - IGNITION_STATE = (((0x0409 + 0x10000000) + 0x01000000) + 0x00400000), - ABS_ACTIVE = (((0x040A + 0x10000000) + 0x01000000) + 0x00200000), - TRACTION_CONTROL_ACTIVE = (((0x040B + 0x10000000) + 0x01000000) + 0x00200000), - EV_STOPPING_MODE = (((0x040D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), - HVAC_FAN_SPEED = (((0x0500 + 0x10000000) + 0x05000000) + 0x00400000), - HVAC_FAN_DIRECTION = (((0x0501 + 0x10000000) + 0x05000000) + 0x00400000), - HVAC_TEMPERATURE_CURRENT = (((0x0502 + 0x10000000) + 0x05000000) + 0x00600000), - HVAC_TEMPERATURE_SET = (((0x0503 + 0x10000000) + 0x05000000) + 0x00600000), - HVAC_DEFROSTER = (((0x0504 + 0x10000000) + 0x03000000) + 0x00200000), - HVAC_AC_ON = (((0x0505 + 0x10000000) + 0x05000000) + 0x00200000), - HVAC_MAX_AC_ON = (((0x0506 + 0x10000000) + 0x05000000) + 0x00200000), - HVAC_MAX_DEFROST_ON = (((0x0507 + 0x10000000) + 0x05000000) + 0x00200000), - HVAC_RECIRC_ON = (((0x0508 + 0x10000000) + 0x05000000) + 0x00200000), - HVAC_DUAL_ON = (((0x0509 + 0x10000000) + 0x05000000) + 0x00200000), - HVAC_AUTO_ON = (((0x050A + 0x10000000) + 0x05000000) + 0x00200000), - HVAC_SEAT_TEMPERATURE = (((0x050B + 0x10000000) + 0x05000000) + 0x00400000), - HVAC_SIDE_MIRROR_HEAT = (((0x050C + 0x10000000) + 0x04000000) + 0x00400000), - HVAC_STEERING_WHEEL_HEAT = (((0x050D + 0x10000000) + 0x01000000) + 0x00400000), - HVAC_TEMPERATURE_DISPLAY_UNITS = (((0x050E + 0x10000000) + 0x01000000) + 0x00400000), - HVAC_ACTUAL_FAN_SPEED_RPM = (((0x050F + 0x10000000) + 0x05000000) + 0x00400000), - HVAC_POWER_ON = (((0x0510 + 0x10000000) + 0x05000000) + 0x00200000), - HVAC_FAN_DIRECTION_AVAILABLE = (((0x0511 + 0x10000000) + 0x05000000) + 0x00410000), - HVAC_AUTO_RECIRC_ON = (((0x0512 + 0x10000000) + 0x05000000) + 0x00200000), - HVAC_SEAT_VENTILATION = (((0x0513 + 0x10000000) + 0x05000000) + 0x00400000), - HVAC_ELECTRIC_DEFROSTER_ON = (((0x0514 + 0x10000000) + 0x03000000) + 0x00200000), - HVAC_TEMPERATURE_VALUE_SUGGESTION = (((0x0515 + 0x10000000) + 0x01000000) + 0x00610000), - DISTANCE_DISPLAY_UNITS = (((0x0600 + 0x10000000) + 0x01000000) + 0x00400000), - FUEL_VOLUME_DISPLAY_UNITS = (((0x0601 + 0x10000000) + 0x01000000) + 0x00400000), - TIRE_PRESSURE_DISPLAY_UNITS = (((0x0602 + 0x10000000) + 0x01000000) + 0x00400000), - EV_BATTERY_DISPLAY_UNITS = (((0x0603 + 0x10000000) + 0x01000000) + 0x00400000), - FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME = (((0x0604 + 0x10000000) + 0x01000000) + 0x00200000), - VEHICLE_SPEED_DISPLAY_UNITS = (((0x0605 + 0x10000000) + 0x01000000) + 0x00400000), - EXTERNAL_CAR_TIME = (((0x0608 + 0x10000000) + 0x01000000) + 0x00500000), - ANDROID_EPOCH_TIME = (((0x0606 + 0x10000000) + 0x01000000) + 0x00500000), - STORAGE_ENCRYPTION_BINDING_SEED = (((0x0607 + 0x10000000) + 0x01000000) + 0x00700000), - ENV_OUTSIDE_TEMPERATURE = (((0x0703 + 0x10000000) + 0x01000000) + 0x00600000), - AP_POWER_STATE_REQ = (((0x0A00 + 0x10000000) + 0x01000000) + 0x00410000), - AP_POWER_STATE_REPORT = (((0x0A01 + 0x10000000) + 0x01000000) + 0x00410000), - AP_POWER_BOOTUP_REASON = (((0x0A02 + 0x10000000) + 0x01000000) + 0x00400000), - DISPLAY_BRIGHTNESS = (((0x0A03 + 0x10000000) + 0x01000000) + 0x00400000), - HW_KEY_INPUT = (((0x0A10 + 0x10000000) + 0x01000000) + 0x00410000), - HW_KEY_INPUT_V2 = (((0x0A11 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.MIXED), - HW_MOTION_INPUT = (((0x0A12 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.MIXED), - HW_ROTARY_INPUT = (((0x0A20 + 0x10000000) + 0x01000000) + 0x00410000), - HW_CUSTOM_INPUT = (((0X0A30 + 0x10000000) + 0x01000000) + 0x00410000), - DOOR_POS = (((0x0B00 + 0x10000000) + 0x06000000) + 0x00400000), - DOOR_MOVE = (((0x0B01 + 0x10000000) + 0x06000000) + 0x00400000), - DOOR_LOCK = (((0x0B02 + 0x10000000) + 0x06000000) + 0x00200000), - DOOR_CHILD_LOCK_ENABLED = (((0x0B03 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.DOOR) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), - MIRROR_Z_POS = (((0x0B40 + 0x10000000) + 0x04000000) + 0x00400000), - MIRROR_Z_MOVE = (((0x0B41 + 0x10000000) + 0x04000000) + 0x00400000), - MIRROR_Y_POS = (((0x0B42 + 0x10000000) + 0x04000000) + 0x00400000), - MIRROR_Y_MOVE = (((0x0B43 + 0x10000000) + 0x04000000) + 0x00400000), - MIRROR_LOCK = (((0x0B44 + 0x10000000) + 0x01000000) + 0x00200000), - MIRROR_FOLD = (((0x0B45 + 0x10000000) + 0x01000000) + 0x00200000), - MIRROR_AUTO_FOLD_ENABLED = (((0x0B46 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.MIRROR) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), - MIRROR_AUTO_TILT_ENABLED = (((0x0B47 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.MIRROR) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), - SEAT_MEMORY_SELECT = (((0x0B80 + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_MEMORY_SET = (((0x0B81 + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_BELT_BUCKLED = (((0x0B82 + 0x10000000) + 0x05000000) + 0x00200000), - SEAT_BELT_HEIGHT_POS = (((0x0B83 + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_BELT_HEIGHT_MOVE = (((0x0B84 + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_FORE_AFT_POS = (((0x0B85 + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_FORE_AFT_MOVE = (((0x0B86 + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_BACKREST_ANGLE_1_POS = (((0x0B87 + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_BACKREST_ANGLE_1_MOVE = (((0x0B88 + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_BACKREST_ANGLE_2_POS = (((0x0B89 + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_BACKREST_ANGLE_2_MOVE = (((0x0B8A + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_HEIGHT_POS = (((0x0B8B + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_HEIGHT_MOVE = (((0x0B8C + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_DEPTH_POS = (((0x0B8D + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_DEPTH_MOVE = (((0x0B8E + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_TILT_POS = (((0x0B8F + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_TILT_MOVE = (((0x0B90 + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_LUMBAR_FORE_AFT_POS = (((0x0B91 + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_LUMBAR_FORE_AFT_MOVE = (((0x0B92 + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_LUMBAR_SIDE_SUPPORT_POS = (((0x0B93 + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_LUMBAR_SIDE_SUPPORT_MOVE = (((0x0B94 + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_HEADREST_HEIGHT_POS = (((0x0B95 + 0x10000000) + 0x01000000) + 0x00400000), - SEAT_HEADREST_HEIGHT_POS_V2 = (((0x0BA4 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), - SEAT_HEADREST_HEIGHT_MOVE = (((0x0B96 + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_HEADREST_ANGLE_POS = (((0x0B97 + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_HEADREST_ANGLE_MOVE = (((0x0B98 + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_HEADREST_FORE_AFT_POS = (((0x0B99 + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_HEADREST_FORE_AFT_MOVE = (((0x0B9A + 0x10000000) + 0x05000000) + 0x00400000), - SEAT_FOOTWELL_LIGHTS_STATE = (((0x0B9B + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), - SEAT_FOOTWELL_LIGHTS_SWITCH = (((0x0B9C + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), - SEAT_EASY_ACCESS_ENABLED = (((0x0B9D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), - SEAT_AIRBAG_ENABLED = (((0x0B9E + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), - SEAT_CUSHION_SIDE_SUPPORT_POS = (((0x0B9F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), - SEAT_CUSHION_SIDE_SUPPORT_MOVE = (((0x0BA0 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), - SEAT_LUMBAR_VERTICAL_POS = (((0x0BA1 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), - SEAT_LUMBAR_VERTICAL_MOVE = (((0x0BA2 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), - SEAT_WALK_IN_POS = (((0x0BA3 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), - SEAT_OCCUPANCY = (((0x0BB0 + 0x10000000) + 0x05000000) + 0x00400000), - WINDOW_POS = (((0x0BC0 + 0x10000000) + 0x03000000) + 0x00400000), - WINDOW_MOVE = (((0x0BC1 + 0x10000000) + 0x03000000) + 0x00400000), - WINDOW_LOCK = (((0x0BC4 + 0x10000000) + 0x03000000) + 0x00200000), - STEERING_WHEEL_DEPTH_POS = (((0x0BE0 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), - STEERING_WHEEL_DEPTH_MOVE = (((0x0BE1 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), - STEERING_WHEEL_HEIGHT_POS = (((0x0BE2 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), - STEERING_WHEEL_HEIGHT_MOVE = (((0x0BE3 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), - STEERING_WHEEL_THEFT_LOCK_ENABLED = (((0x0BE4 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), - STEERING_WHEEL_LOCKED = (((0x0BE5 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), - STEERING_WHEEL_EASY_ACCESS_ENABLED = (((0x0BE6 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), - VEHICLE_MAP_SERVICE = (((0x0C00 + 0x10000000) + 0x01000000) + 0x00e00000), - OBD2_LIVE_FRAME = (((0x0D00 + 0x10000000) + 0x01000000) + 0x00e00000), - OBD2_FREEZE_FRAME = (((0x0D01 + 0x10000000) + 0x01000000) + 0x00e00000), - OBD2_FREEZE_FRAME_INFO = (((0x0D02 + 0x10000000) + 0x01000000) + 0x00e00000), - OBD2_FREEZE_FRAME_CLEAR = (((0x0D03 + 0x10000000) + 0x01000000) + 0x00e00000), - HEADLIGHTS_STATE = (((0x0E00 + 0x10000000) + 0x01000000) + 0x00400000), - HIGH_BEAM_LIGHTS_STATE = (((0x0E01 + 0x10000000) + 0x01000000) + 0x00400000), - FOG_LIGHTS_STATE = (((0x0E02 + 0x10000000) + 0x01000000) + 0x00400000), - HAZARD_LIGHTS_STATE = (((0x0E03 + 0x10000000) + 0x01000000) + 0x00400000), - HEADLIGHTS_SWITCH = (((0x0E10 + 0x10000000) + 0x01000000) + 0x00400000), - HIGH_BEAM_LIGHTS_SWITCH = (((0x0E11 + 0x10000000) + 0x01000000) + 0x00400000), - FOG_LIGHTS_SWITCH = (((0x0E12 + 0x10000000) + 0x01000000) + 0x00400000), - HAZARD_LIGHTS_SWITCH = (((0x0E13 + 0x10000000) + 0x01000000) + 0x00400000), - CABIN_LIGHTS_STATE = (((0x0F01 + 0x10000000) + 0x01000000) + 0x00400000), - CABIN_LIGHTS_SWITCH = (((0x0F02 + 0x10000000) + 0x01000000) + 0x00400000), - READING_LIGHTS_STATE = (((0x0F03 + 0x10000000) + 0x05000000) + 0x00400000), - READING_LIGHTS_SWITCH = (((0x0F04 + 0x10000000) + 0x05000000) + 0x00400000), - STEERING_WHEEL_LIGHTS_STATE = (((0x0F0C + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), - STEERING_WHEEL_LIGHTS_SWITCH = (((0x0F0D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), - SUPPORT_CUSTOMIZE_VENDOR_PERMISSION = (((0x0F05 + 0x10000000) + 0x01000000) + 0x00200000), - DISABLED_OPTIONAL_FEATURES = (((0x0F06 + 0x10000000) + 0x01000000) + 0x00100000), - INITIAL_USER_INFO = (((0x0F07 + 0x10000000) + 0x01000000) + 0x00e00000), - SWITCH_USER = (((0x0F08 + 0x10000000) + 0x01000000) + 0x00e00000), - CREATE_USER = (((0x0F09 + 0x10000000) + 0x01000000) + 0x00e00000), - REMOVE_USER = (((0x0F0A + 0x10000000) + 0x01000000) + 0x00e00000), - USER_IDENTIFICATION_ASSOCIATION = (((0x0F0B + 0x10000000) + 0x01000000) + 0x00e00000), - EVS_SERVICE_REQUEST = (((0x0F10 + 0x10000000) + 0x01000000) + 0x00410000), - POWER_POLICY_REQ = (((0x0F21 + 0x10000000) + 0x01000000) + 0x00100000), - POWER_POLICY_GROUP_REQ = (((0x0F22 + 0x10000000) + 0x01000000) + 0x00100000), - CURRENT_POWER_POLICY = (((0x0F23 + 0x10000000) + 0x01000000) + 0x00100000), - WATCHDOG_ALIVE = (((0xF31 + 0x10000000) + 0x01000000) + 0x00500000), - WATCHDOG_TERMINATED_PROCESS = (((0x0F32 + 0x10000000) + 0x01000000) + 0x00e00000), - VHAL_HEARTBEAT = (((0x0F33 + 0x10000000) + 0x01000000) + 0x00500000), - CLUSTER_SWITCH_UI = (((0x0F34 + 0x10000000) + 0x01000000) + 0x00400000), - CLUSTER_DISPLAY_STATE = (((0x0F35 + 0x10000000) + 0x01000000) + 0x00410000), - CLUSTER_REPORT_STATE = (((0x0F36 + 0x10000000) + 0x01000000) + 0x00e00000), - CLUSTER_REQUEST_DISPLAY = (((0x0F37 + 0x10000000) + 0x01000000) + 0x00400000), - CLUSTER_NAVIGATION_STATE = (((0x0F38 + 0x10000000) + 0x01000000) + 0x00700000), - ELECTRONIC_TOLL_COLLECTION_CARD_TYPE = (((0x0F39 + 0x10000000) + 0x01000000) + 0x00400000), - ELECTRONIC_TOLL_COLLECTION_CARD_STATUS = (((0x0F3A + 0x10000000) + 0x01000000) + 0x00400000), - FRONT_FOG_LIGHTS_STATE = (((0x0F3B + 0x10000000) + 0x01000000) + 0x00400000), - FRONT_FOG_LIGHTS_SWITCH = (((0x0F3C + 0x10000000) + 0x01000000) + 0x00400000), - REAR_FOG_LIGHTS_STATE = (((0x0F3D + 0x10000000) + 0x01000000) + 0x00400000), - REAR_FOG_LIGHTS_SWITCH = (((0x0F3E + 0x10000000) + 0x01000000) + 0x00400000), - EV_CHARGE_CURRENT_DRAW_LIMIT = (((0x0F3F + 0x10000000) + 0x01000000) + 0x00600000), - EV_CHARGE_PERCENT_LIMIT = (((0x0F40 + 0x10000000) + 0x01000000) + 0x00600000), - EV_CHARGE_STATE = (((0x0F41 + 0x10000000) + 0x01000000) + 0x00400000), - EV_CHARGE_SWITCH = (((0x0F42 + 0x10000000) + 0x01000000) + 0x00200000), - EV_CHARGE_TIME_REMAINING = (((0x0F43 + 0x10000000) + 0x01000000) + 0x00400000), - EV_REGENERATIVE_BRAKING_STATE = (((0x0F44 + 0x10000000) + 0x01000000) + 0x00400000), - TRAILER_PRESENT = (((0x0F45 + 0x10000000) + 0x01000000) + 0x00400000), - VEHICLE_CURB_WEIGHT = (((0x0F46 + 0x10000000) + 0x01000000) + 0x00400000), - GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT = (((0x0F47 + 0x10000000) + 0x01000000) + 0x00400000), - SUPPORTED_PROPERTY_IDS = (((0x0F48 + 0x10000000) + 0x01000000) + 0x00410000), - SHUTDOWN_REQUEST = (((0x0F49 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), - AUTOMATIC_EMERGENCY_BRAKING_ENABLED = (((0x1000 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), - AUTOMATIC_EMERGENCY_BRAKING_STATE = (((0x1001 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), - FORWARD_COLLISION_WARNING_ENABLED = (((0x1002 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), - FORWARD_COLLISION_WARNING_STATE = (((0x1003 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), - BLIND_SPOT_WARNING_ENABLED = (((0x1004 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), - BLIND_SPOT_WARNING_STATE = (((0x1005 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.MIRROR) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32), - LANE_DEPARTURE_WARNING_ENABLED = (((0x1006 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), - LANE_KEEP_ASSIST_ENABLED = (((0x1008 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), - LANE_CENTERING_ASSIST_ENABLED = (((0x100A + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), - EMERGENCY_LANE_KEEP_ASSIST_ENABLED = (((0x100D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), - ADAPTIVE_CRUISE_CONTROL_ENABLED = (((0x100F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), - HANDS_ON_DETECTION_ENABLED = (((0x1016 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), - DRIVER_ATTENTION_MONITORING_ENABLED = (((0x1019 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN), + INFO_VIN = (((0x0100 + 0x10000000) + 0x01000000) + 0x00100000) /* 286261504 */, + INFO_MAKE = (((0x0101 + 0x10000000) + 0x01000000) + 0x00100000) /* 286261505 */, + INFO_MODEL = (((0x0102 + 0x10000000) + 0x01000000) + 0x00100000) /* 286261506 */, + INFO_MODEL_YEAR = (((0x0103 + 0x10000000) + 0x01000000) + 0x00400000) /* 289407235 */, + INFO_FUEL_CAPACITY = (((0x0104 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504388 */, + INFO_FUEL_TYPE = (((0x0105 + 0x10000000) + 0x01000000) + 0x00410000) /* 289472773 */, + INFO_EV_BATTERY_CAPACITY = (((0x0106 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504390 */, + INFO_EV_CONNECTOR_TYPE = (((0x0107 + 0x10000000) + 0x01000000) + 0x00410000) /* 289472775 */, + INFO_FUEL_DOOR_LOCATION = (((0x0108 + 0x10000000) + 0x01000000) + 0x00400000) /* 289407240 */, + INFO_EV_PORT_LOCATION = (((0x0109 + 0x10000000) + 0x01000000) + 0x00400000) /* 289407241 */, + INFO_DRIVER_SEAT = (((0x010A + 0x10000000) + 0x05000000) + 0x00400000) /* 356516106 */, + INFO_EXTERIOR_DIMENSIONS = (((0x010B + 0x10000000) + 0x01000000) + 0x00410000) /* 289472779 */, + INFO_MULTI_EV_PORT_LOCATIONS = (((0x010C + 0x10000000) + 0x01000000) + 0x00410000) /* 289472780 */, + PERF_ODOMETER = (((0x0204 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504644 */, + PERF_VEHICLE_SPEED = (((0x0207 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504647 */, + PERF_VEHICLE_SPEED_DISPLAY = (((0x0208 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504648 */, + PERF_STEERING_ANGLE = (((0x0209 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504649 */, + PERF_REAR_STEERING_ANGLE = (((0x0210 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504656 */, + ENGINE_COOLANT_TEMP = (((0x0301 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504897 */, + ENGINE_OIL_LEVEL = (((0x0303 + 0x10000000) + 0x01000000) + 0x00400000) /* 289407747 */, + ENGINE_OIL_TEMP = (((0x0304 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504900 */, + ENGINE_RPM = (((0x0305 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504901 */, + WHEEL_TICK = (((0x0306 + 0x10000000) + 0x01000000) + 0x00510000) /* 290521862 */, + FUEL_LEVEL = (((0x0307 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504903 */, + FUEL_DOOR_OPEN = (((0x0308 + 0x10000000) + 0x01000000) + 0x00200000) /* 287310600 */, + EV_BATTERY_LEVEL = (((0x0309 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504905 */, + EV_CURRENT_BATTERY_CAPACITY = (((0x030D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.FLOAT) /* 291504909 */, + EV_CHARGE_PORT_OPEN = (((0x030A + 0x10000000) + 0x01000000) + 0x00200000) /* 287310602 */, + EV_CHARGE_PORT_CONNECTED = (((0x030B + 0x10000000) + 0x01000000) + 0x00200000) /* 287310603 */, + EV_BATTERY_INSTANTANEOUS_CHARGE_RATE = (((0x030C + 0x10000000) + 0x01000000) + 0x00600000) /* 291504908 */, + RANGE_REMAINING = (((0x0308 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504904 */, + TIRE_PRESSURE = (((0x0309 + 0x10000000) + 0x07000000) + 0x00600000) /* 392168201 */, + CRITICALLY_LOW_TIRE_PRESSURE = (((0x030A + 0x10000000) + 0x07000000) + 0x00600000) /* 392168202 */, + ENGINE_IDLE_AUTO_STOP_ENABLED = (((0x0320 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287310624 */, + GEAR_SELECTION = (((0x0400 + 0x10000000) + 0x01000000) + 0x00400000) /* 289408000 */, + CURRENT_GEAR = (((0x0401 + 0x10000000) + 0x01000000) + 0x00400000) /* 289408001 */, + PARKING_BRAKE_ON = (((0x0402 + 0x10000000) + 0x01000000) + 0x00200000) /* 287310850 */, + PARKING_BRAKE_AUTO_APPLY = (((0x0403 + 0x10000000) + 0x01000000) + 0x00200000) /* 287310851 */, + EV_BRAKE_REGENERATION_LEVEL = (((0x040C + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289408012 */, + FUEL_LEVEL_LOW = (((0x0405 + 0x10000000) + 0x01000000) + 0x00200000) /* 287310853 */, + NIGHT_MODE = (((0x0407 + 0x10000000) + 0x01000000) + 0x00200000) /* 287310855 */, + TURN_SIGNAL_STATE = (((0x0408 + 0x10000000) + 0x01000000) + 0x00400000) /* 289408008 */, + IGNITION_STATE = (((0x0409 + 0x10000000) + 0x01000000) + 0x00400000) /* 289408009 */, + ABS_ACTIVE = (((0x040A + 0x10000000) + 0x01000000) + 0x00200000) /* 287310858 */, + TRACTION_CONTROL_ACTIVE = (((0x040B + 0x10000000) + 0x01000000) + 0x00200000) /* 287310859 */, + EV_STOPPING_MODE = (((0x040D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289408013 */, + HVAC_FAN_SPEED = (((0x0500 + 0x10000000) + 0x05000000) + 0x00400000) /* 356517120 */, + HVAC_FAN_DIRECTION = (((0x0501 + 0x10000000) + 0x05000000) + 0x00400000) /* 356517121 */, + HVAC_TEMPERATURE_CURRENT = (((0x0502 + 0x10000000) + 0x05000000) + 0x00600000) /* 358614274 */, + HVAC_TEMPERATURE_SET = (((0x0503 + 0x10000000) + 0x05000000) + 0x00600000) /* 358614275 */, + HVAC_DEFROSTER = (((0x0504 + 0x10000000) + 0x03000000) + 0x00200000) /* 320865540 */, + HVAC_AC_ON = (((0x0505 + 0x10000000) + 0x05000000) + 0x00200000) /* 354419973 */, + HVAC_MAX_AC_ON = (((0x0506 + 0x10000000) + 0x05000000) + 0x00200000) /* 354419974 */, + HVAC_MAX_DEFROST_ON = (((0x0507 + 0x10000000) + 0x05000000) + 0x00200000) /* 354419975 */, + HVAC_RECIRC_ON = (((0x0508 + 0x10000000) + 0x05000000) + 0x00200000) /* 354419976 */, + HVAC_DUAL_ON = (((0x0509 + 0x10000000) + 0x05000000) + 0x00200000) /* 354419977 */, + HVAC_AUTO_ON = (((0x050A + 0x10000000) + 0x05000000) + 0x00200000) /* 354419978 */, + HVAC_SEAT_TEMPERATURE = (((0x050B + 0x10000000) + 0x05000000) + 0x00400000) /* 356517131 */, + HVAC_SIDE_MIRROR_HEAT = (((0x050C + 0x10000000) + 0x04000000) + 0x00400000) /* 339739916 */, + HVAC_STEERING_WHEEL_HEAT = (((0x050D + 0x10000000) + 0x01000000) + 0x00400000) /* 289408269 */, + HVAC_TEMPERATURE_DISPLAY_UNITS = (((0x050E + 0x10000000) + 0x01000000) + 0x00400000) /* 289408270 */, + HVAC_ACTUAL_FAN_SPEED_RPM = (((0x050F + 0x10000000) + 0x05000000) + 0x00400000) /* 356517135 */, + HVAC_POWER_ON = (((0x0510 + 0x10000000) + 0x05000000) + 0x00200000) /* 354419984 */, + HVAC_FAN_DIRECTION_AVAILABLE = (((0x0511 + 0x10000000) + 0x05000000) + 0x00410000) /* 356582673 */, + HVAC_AUTO_RECIRC_ON = (((0x0512 + 0x10000000) + 0x05000000) + 0x00200000) /* 354419986 */, + HVAC_SEAT_VENTILATION = (((0x0513 + 0x10000000) + 0x05000000) + 0x00400000) /* 356517139 */, + HVAC_ELECTRIC_DEFROSTER_ON = (((0x0514 + 0x10000000) + 0x03000000) + 0x00200000) /* 320865556 */, + HVAC_TEMPERATURE_VALUE_SUGGESTION = (((0x0515 + 0x10000000) + 0x01000000) + 0x00610000) /* 291570965 */, + DISTANCE_DISPLAY_UNITS = (((0x0600 + 0x10000000) + 0x01000000) + 0x00400000) /* 289408512 */, + FUEL_VOLUME_DISPLAY_UNITS = (((0x0601 + 0x10000000) + 0x01000000) + 0x00400000) /* 289408513 */, + TIRE_PRESSURE_DISPLAY_UNITS = (((0x0602 + 0x10000000) + 0x01000000) + 0x00400000) /* 289408514 */, + EV_BATTERY_DISPLAY_UNITS = (((0x0603 + 0x10000000) + 0x01000000) + 0x00400000) /* 289408515 */, + FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME = (((0x0604 + 0x10000000) + 0x01000000) + 0x00200000) /* 287311364 */, + VEHICLE_SPEED_DISPLAY_UNITS = (((0x0605 + 0x10000000) + 0x01000000) + 0x00400000) /* 289408517 */, + EXTERNAL_CAR_TIME = (((0x0608 + 0x10000000) + 0x01000000) + 0x00500000) /* 290457096 */, + ANDROID_EPOCH_TIME = (((0x0606 + 0x10000000) + 0x01000000) + 0x00500000) /* 290457094 */, + STORAGE_ENCRYPTION_BINDING_SEED = (((0x0607 + 0x10000000) + 0x01000000) + 0x00700000) /* 292554247 */, + ENV_OUTSIDE_TEMPERATURE = (((0x0703 + 0x10000000) + 0x01000000) + 0x00600000) /* 291505923 */, + AP_POWER_STATE_REQ = (((0x0A00 + 0x10000000) + 0x01000000) + 0x00410000) /* 289475072 */, + AP_POWER_STATE_REPORT = (((0x0A01 + 0x10000000) + 0x01000000) + 0x00410000) /* 289475073 */, + AP_POWER_BOOTUP_REASON = (((0x0A02 + 0x10000000) + 0x01000000) + 0x00400000) /* 289409538 */, + DISPLAY_BRIGHTNESS = (((0x0A03 + 0x10000000) + 0x01000000) + 0x00400000) /* 289409539 */, + HW_KEY_INPUT = (((0x0A10 + 0x10000000) + 0x01000000) + 0x00410000) /* 289475088 */, + HW_KEY_INPUT_V2 = (((0x0A11 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.MIXED) /* 367004177 */, + HW_MOTION_INPUT = (((0x0A12 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.MIXED) /* 367004178 */, + HW_ROTARY_INPUT = (((0x0A20 + 0x10000000) + 0x01000000) + 0x00410000) /* 289475104 */, + HW_CUSTOM_INPUT = (((0X0A30 + 0x10000000) + 0x01000000) + 0x00410000) /* 289475120 */, + DOOR_POS = (((0x0B00 + 0x10000000) + 0x06000000) + 0x00400000) /* 373295872 */, + DOOR_MOVE = (((0x0B01 + 0x10000000) + 0x06000000) + 0x00400000) /* 373295873 */, + DOOR_LOCK = (((0x0B02 + 0x10000000) + 0x06000000) + 0x00200000) /* 371198722 */, + DOOR_CHILD_LOCK_ENABLED = (((0x0B03 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.DOOR) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 371198723 */, + MIRROR_Z_POS = (((0x0B40 + 0x10000000) + 0x04000000) + 0x00400000) /* 339741504 */, + MIRROR_Z_MOVE = (((0x0B41 + 0x10000000) + 0x04000000) + 0x00400000) /* 339741505 */, + MIRROR_Y_POS = (((0x0B42 + 0x10000000) + 0x04000000) + 0x00400000) /* 339741506 */, + MIRROR_Y_MOVE = (((0x0B43 + 0x10000000) + 0x04000000) + 0x00400000) /* 339741507 */, + MIRROR_LOCK = (((0x0B44 + 0x10000000) + 0x01000000) + 0x00200000) /* 287312708 */, + MIRROR_FOLD = (((0x0B45 + 0x10000000) + 0x01000000) + 0x00200000) /* 287312709 */, + MIRROR_AUTO_FOLD_ENABLED = (((0x0B46 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.MIRROR) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 337644358 */, + MIRROR_AUTO_TILT_ENABLED = (((0x0B47 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.MIRROR) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 337644359 */, + SEAT_MEMORY_SELECT = (((0x0B80 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518784 */, + SEAT_MEMORY_SET = (((0x0B81 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518785 */, + SEAT_BELT_BUCKLED = (((0x0B82 + 0x10000000) + 0x05000000) + 0x00200000) /* 354421634 */, + SEAT_BELT_HEIGHT_POS = (((0x0B83 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518787 */, + SEAT_BELT_HEIGHT_MOVE = (((0x0B84 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518788 */, + SEAT_FORE_AFT_POS = (((0x0B85 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518789 */, + SEAT_FORE_AFT_MOVE = (((0x0B86 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518790 */, + SEAT_BACKREST_ANGLE_1_POS = (((0x0B87 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518791 */, + SEAT_BACKREST_ANGLE_1_MOVE = (((0x0B88 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518792 */, + SEAT_BACKREST_ANGLE_2_POS = (((0x0B89 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518793 */, + SEAT_BACKREST_ANGLE_2_MOVE = (((0x0B8A + 0x10000000) + 0x05000000) + 0x00400000) /* 356518794 */, + SEAT_HEIGHT_POS = (((0x0B8B + 0x10000000) + 0x05000000) + 0x00400000) /* 356518795 */, + SEAT_HEIGHT_MOVE = (((0x0B8C + 0x10000000) + 0x05000000) + 0x00400000) /* 356518796 */, + SEAT_DEPTH_POS = (((0x0B8D + 0x10000000) + 0x05000000) + 0x00400000) /* 356518797 */, + SEAT_DEPTH_MOVE = (((0x0B8E + 0x10000000) + 0x05000000) + 0x00400000) /* 356518798 */, + SEAT_TILT_POS = (((0x0B8F + 0x10000000) + 0x05000000) + 0x00400000) /* 356518799 */, + SEAT_TILT_MOVE = (((0x0B90 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518800 */, + SEAT_LUMBAR_FORE_AFT_POS = (((0x0B91 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518801 */, + SEAT_LUMBAR_FORE_AFT_MOVE = (((0x0B92 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518802 */, + SEAT_LUMBAR_SIDE_SUPPORT_POS = (((0x0B93 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518803 */, + SEAT_LUMBAR_SIDE_SUPPORT_MOVE = (((0x0B94 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518804 */, + SEAT_HEADREST_HEIGHT_POS = (((0x0B95 + 0x10000000) + 0x01000000) + 0x00400000) /* 289409941 */, + SEAT_HEADREST_HEIGHT_POS_V2 = (((0x0BA4 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518820 */, + SEAT_HEADREST_HEIGHT_MOVE = (((0x0B96 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518806 */, + SEAT_HEADREST_ANGLE_POS = (((0x0B97 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518807 */, + SEAT_HEADREST_ANGLE_MOVE = (((0x0B98 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518808 */, + SEAT_HEADREST_FORE_AFT_POS = (((0x0B99 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518809 */, + SEAT_HEADREST_FORE_AFT_MOVE = (((0x0B9A + 0x10000000) + 0x05000000) + 0x00400000) /* 356518810 */, + SEAT_FOOTWELL_LIGHTS_STATE = (((0x0B9B + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518811 */, + SEAT_FOOTWELL_LIGHTS_SWITCH = (((0x0B9C + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518812 */, + SEAT_EASY_ACCESS_ENABLED = (((0x0B9D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 354421661 */, + SEAT_AIRBAG_ENABLED = (((0x0B9E + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 354421662 */, + SEAT_CUSHION_SIDE_SUPPORT_POS = (((0x0B9F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518815 */, + SEAT_CUSHION_SIDE_SUPPORT_MOVE = (((0x0BA0 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518816 */, + SEAT_LUMBAR_VERTICAL_POS = (((0x0BA1 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518817 */, + SEAT_LUMBAR_VERTICAL_MOVE = (((0x0BA2 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518818 */, + SEAT_WALK_IN_POS = (((0x0BA3 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518819 */, + SEAT_OCCUPANCY = (((0x0BB0 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518832 */, + WINDOW_POS = (((0x0BC0 + 0x10000000) + 0x03000000) + 0x00400000) /* 322964416 */, + WINDOW_MOVE = (((0x0BC1 + 0x10000000) + 0x03000000) + 0x00400000) /* 322964417 */, + WINDOW_LOCK = (((0x0BC4 + 0x10000000) + 0x03000000) + 0x00200000) /* 320867268 */, + STEERING_WHEEL_DEPTH_POS = (((0x0BE0 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410016 */, + STEERING_WHEEL_DEPTH_MOVE = (((0x0BE1 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410017 */, + STEERING_WHEEL_HEIGHT_POS = (((0x0BE2 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410018 */, + STEERING_WHEEL_HEIGHT_MOVE = (((0x0BE3 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410019 */, + STEERING_WHEEL_THEFT_LOCK_ENABLED = (((0x0BE4 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287312868 */, + STEERING_WHEEL_LOCKED = (((0x0BE5 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287312869 */, + STEERING_WHEEL_EASY_ACCESS_ENABLED = (((0x0BE6 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287312870 */, + VEHICLE_MAP_SERVICE = (((0x0C00 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299895808 */, + OBD2_LIVE_FRAME = (((0x0D00 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896064 */, + OBD2_FREEZE_FRAME = (((0x0D01 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896065 */, + OBD2_FREEZE_FRAME_INFO = (((0x0D02 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896066 */, + OBD2_FREEZE_FRAME_CLEAR = (((0x0D03 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896067 */, + HEADLIGHTS_STATE = (((0x0E00 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410560 */, + HIGH_BEAM_LIGHTS_STATE = (((0x0E01 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410561 */, + FOG_LIGHTS_STATE = (((0x0E02 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410562 */, + HAZARD_LIGHTS_STATE = (((0x0E03 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410563 */, + HEADLIGHTS_SWITCH = (((0x0E10 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410576 */, + HIGH_BEAM_LIGHTS_SWITCH = (((0x0E11 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410577 */, + FOG_LIGHTS_SWITCH = (((0x0E12 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410578 */, + HAZARD_LIGHTS_SWITCH = (((0x0E13 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410579 */, + CABIN_LIGHTS_STATE = (((0x0F01 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410817 */, + CABIN_LIGHTS_SWITCH = (((0x0F02 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410818 */, + READING_LIGHTS_STATE = (((0x0F03 + 0x10000000) + 0x05000000) + 0x00400000) /* 356519683 */, + READING_LIGHTS_SWITCH = (((0x0F04 + 0x10000000) + 0x05000000) + 0x00400000) /* 356519684 */, + STEERING_WHEEL_LIGHTS_STATE = (((0x0F0C + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410828 */, + STEERING_WHEEL_LIGHTS_SWITCH = (((0x0F0D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410829 */, + SUPPORT_CUSTOMIZE_VENDOR_PERMISSION = (((0x0F05 + 0x10000000) + 0x01000000) + 0x00200000) /* 287313669 */, + DISABLED_OPTIONAL_FEATURES = (((0x0F06 + 0x10000000) + 0x01000000) + 0x00100000) /* 286265094 */, + INITIAL_USER_INFO = (((0x0F07 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896583 */, + SWITCH_USER = (((0x0F08 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896584 */, + CREATE_USER = (((0x0F09 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896585 */, + REMOVE_USER = (((0x0F0A + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896586 */, + USER_IDENTIFICATION_ASSOCIATION = (((0x0F0B + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896587 */, + EVS_SERVICE_REQUEST = (((0x0F10 + 0x10000000) + 0x01000000) + 0x00410000) /* 289476368 */, + POWER_POLICY_REQ = (((0x0F21 + 0x10000000) + 0x01000000) + 0x00100000) /* 286265121 */, + POWER_POLICY_GROUP_REQ = (((0x0F22 + 0x10000000) + 0x01000000) + 0x00100000) /* 286265122 */, + CURRENT_POWER_POLICY = (((0x0F23 + 0x10000000) + 0x01000000) + 0x00100000) /* 286265123 */, + WATCHDOG_ALIVE = (((0xF31 + 0x10000000) + 0x01000000) + 0x00500000) /* 290459441 */, + WATCHDOG_TERMINATED_PROCESS = (((0x0F32 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896626 */, + VHAL_HEARTBEAT = (((0x0F33 + 0x10000000) + 0x01000000) + 0x00500000) /* 290459443 */, + CLUSTER_SWITCH_UI = (((0x0F34 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410868 */, + CLUSTER_DISPLAY_STATE = (((0x0F35 + 0x10000000) + 0x01000000) + 0x00410000) /* 289476405 */, + CLUSTER_REPORT_STATE = (((0x0F36 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896630 */, + CLUSTER_REQUEST_DISPLAY = (((0x0F37 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410871 */, + CLUSTER_NAVIGATION_STATE = (((0x0F38 + 0x10000000) + 0x01000000) + 0x00700000) /* 292556600 */, + ELECTRONIC_TOLL_COLLECTION_CARD_TYPE = (((0x0F39 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410873 */, + ELECTRONIC_TOLL_COLLECTION_CARD_STATUS = (((0x0F3A + 0x10000000) + 0x01000000) + 0x00400000) /* 289410874 */, + FRONT_FOG_LIGHTS_STATE = (((0x0F3B + 0x10000000) + 0x01000000) + 0x00400000) /* 289410875 */, + FRONT_FOG_LIGHTS_SWITCH = (((0x0F3C + 0x10000000) + 0x01000000) + 0x00400000) /* 289410876 */, + REAR_FOG_LIGHTS_STATE = (((0x0F3D + 0x10000000) + 0x01000000) + 0x00400000) /* 289410877 */, + REAR_FOG_LIGHTS_SWITCH = (((0x0F3E + 0x10000000) + 0x01000000) + 0x00400000) /* 289410878 */, + EV_CHARGE_CURRENT_DRAW_LIMIT = (((0x0F3F + 0x10000000) + 0x01000000) + 0x00600000) /* 291508031 */, + EV_CHARGE_PERCENT_LIMIT = (((0x0F40 + 0x10000000) + 0x01000000) + 0x00600000) /* 291508032 */, + EV_CHARGE_STATE = (((0x0F41 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410881 */, + EV_CHARGE_SWITCH = (((0x0F42 + 0x10000000) + 0x01000000) + 0x00200000) /* 287313730 */, + EV_CHARGE_TIME_REMAINING = (((0x0F43 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410883 */, + EV_REGENERATIVE_BRAKING_STATE = (((0x0F44 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410884 */, + TRAILER_PRESENT = (((0x0F45 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410885 */, + VEHICLE_CURB_WEIGHT = (((0x0F46 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410886 */, + GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT = (((0x0F47 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410887 */, + SUPPORTED_PROPERTY_IDS = (((0x0F48 + 0x10000000) + 0x01000000) + 0x00410000) /* 289476424 */, + SHUTDOWN_REQUEST = (((0x0F49 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410889 */, + VEHICLE_IN_USE = (((0x0F4A + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313738 */, + AUTOMATIC_EMERGENCY_BRAKING_ENABLED = (((0x1000 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313920 */, + AUTOMATIC_EMERGENCY_BRAKING_STATE = (((0x1001 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411073 */, + FORWARD_COLLISION_WARNING_ENABLED = (((0x1002 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313922 */, + FORWARD_COLLISION_WARNING_STATE = (((0x1003 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411075 */, + BLIND_SPOT_WARNING_ENABLED = (((0x1004 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313924 */, + BLIND_SPOT_WARNING_STATE = (((0x1005 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.MIRROR) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 339742725 */, + LANE_DEPARTURE_WARNING_ENABLED = (((0x1006 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313926 */, + LANE_KEEP_ASSIST_ENABLED = (((0x1008 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313928 */, + LANE_CENTERING_ASSIST_ENABLED = (((0x100A + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313930 */, + EMERGENCY_LANE_KEEP_ASSIST_ENABLED = (((0x100D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313933 */, + ADAPTIVE_CRUISE_CONTROL_ENABLED = (((0x100F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313935 */, + HANDS_ON_DETECTION_ENABLED = (((0x1016 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313942 */, + DRIVER_ATTENTION_MONITORING_ENABLED = (((0x1019 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313945 */, } diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 39d8433ab1..d336dae1bd 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3418,6 +3418,34 @@ enum VehicleProperty { SHUTDOWN_REQUEST = 0x0F49 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** + * Whether the vehicle is currently in use. + * + *

In-use means a human user is present and is intended to use the vehicle. This doesn't + * necessarily means the human user is in the vehicle. For example, if the human user unlocks + * the vehicle remotely, the vehicle is considered in use. + * + *

If this property is supported: + * + *

Each time user powers on the vehicle or the system detects the user is present, + * VEHICLE_IN_USE must be set to true. Each time user powers off the vehicle or the system + * detects the user is not present, VEHICLE_IN_USE must be set to false. + * + *

This property is different than AP_POWER_BOOTUP_REASON in the sense that + * AP_POWER_BOOTUP_REASON is only set once during the system bootup. However, this property + * might change multiple times during a system bootup cycle. + * + *

For example, a device is currently not in use. The system bootup to execute a remote task. + * VEHICLE_IN_USE is false. While the remote task is executing, the user enters the vehicle and + * powers on the vehicle. VEHICLE_IN_USE is set to true. After a driving session, user powers + * off the vehicle, VEHICLE_IN_USE is set to false. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + VEHICLE_IN_USE = + 0x0F4A + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /*************************************************************************** * Start of ADAS Properties * Allocate IDs in range of 0x1000 (inclusive) to 0x1100 (exclusive) for ADAS properties From 44612031c05d86730fb610ad4975cc4f6dd193d5 Mon Sep 17 00:00:00 2001 From: Ricky Niu Date: Tue, 31 Jan 2023 17:52:49 +0800 Subject: [PATCH 663/998] Add resetCb Add the resetCb to complete asynchronous Bug: 267252826 Test: Boot to home and function work Change-Id: I6a70bdb87fab1a2f6e7718257d1145f07fa0a14b --- .../current/android/hardware/usb/gadget/IUsbGadget.aidl | 2 +- .../android/hardware/usb/gadget/IUsbGadgetCallback.aidl | 1 + .../aidl/android/hardware/usb/gadget/IUsbGadget.aidl | 6 +++++- .../android/hardware/usb/gadget/IUsbGadgetCallback.aidl | 8 ++++++++ usb/gadget/aidl/default/UsbGadget.cpp | 5 ++++- usb/gadget/aidl/default/UsbGadget.h | 3 ++- 6 files changed, 21 insertions(+), 4 deletions(-) diff --git a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadget.aidl b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadget.aidl index ef45f8be3a..b5c0b5c253 100644 --- a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadget.aidl +++ b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadget.aidl @@ -37,5 +37,5 @@ interface IUsbGadget { oneway void setCurrentUsbFunctions(in long functions, in android.hardware.usb.gadget.IUsbGadgetCallback callback, in long timeoutMs, long transactionId); oneway void getCurrentUsbFunctions(in android.hardware.usb.gadget.IUsbGadgetCallback callback, long transactionId); oneway void getUsbSpeed(in android.hardware.usb.gadget.IUsbGadgetCallback callback, long transactionId); - oneway void reset(); + oneway void reset(in android.hardware.usb.gadget.IUsbGadgetCallback callback, long transactionId); } diff --git a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadgetCallback.aidl b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadgetCallback.aidl index 9de68de72d..b2b0e5ad58 100644 --- a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadgetCallback.aidl +++ b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/current/android/hardware/usb/gadget/IUsbGadgetCallback.aidl @@ -37,4 +37,5 @@ interface IUsbGadgetCallback { oneway void setCurrentUsbFunctionsCb(in long functions, in android.hardware.usb.gadget.Status status, long transactionId); oneway void getCurrentUsbFunctionsCb(in long functions, in android.hardware.usb.gadget.Status status, long transactionId); oneway void getUsbSpeedCb(in android.hardware.usb.gadget.UsbSpeed speed, long transactionId); + oneway void resetCb(in android.hardware.usb.gadget.Status status, long transactionId); } diff --git a/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadget.aidl b/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadget.aidl index 9c3f0d476f..a0c61ae923 100644 --- a/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadget.aidl +++ b/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadget.aidl @@ -59,6 +59,10 @@ oneway interface IUsbGadget { * This function is used to reset USB gadget driver. * Performs USB data connection reset. The connection will disconnect and * reconnect. + * + * @param callback IUsbGadgetCallback::resetCb used to propagate + * the result of requesting resetUsbGadget. + * @param transactionId ID to be used when invoking the callback. */ - void reset(); + void reset(in IUsbGadgetCallback callback, long transactionId); } diff --git a/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadgetCallback.aidl b/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadgetCallback.aidl index b4945a0c0e..cd9a662beb 100644 --- a/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadgetCallback.aidl +++ b/usb/gadget/aidl/android/hardware/usb/gadget/IUsbGadgetCallback.aidl @@ -59,4 +59,12 @@ oneway interface IUsbGadgetCallback { * @param transactionId ID to be used when invoking the callback. */ void getUsbSpeedCb(in UsbSpeed speed, long transactionId); + + /** + * Callback function used to propagate the result of requesting + * resetUsbGadget. + * @param status SUCCESS if current request succeeded. FAILURE otherwise. + * @param transactionId current transactionId sent during reset request. + */ + void resetCb(in Status status, long transactionId); } diff --git a/usb/gadget/aidl/default/UsbGadget.cpp b/usb/gadget/aidl/default/UsbGadget.cpp index c4986e8e18..8ccca8c993 100644 --- a/usb/gadget/aidl/default/UsbGadget.cpp +++ b/usb/gadget/aidl/default/UsbGadget.cpp @@ -141,7 +141,10 @@ Status UsbGadget::tearDownGadget() { return Status::SUCCESS; } -ScopedAStatus UsbGadget::reset() { +ScopedAStatus UsbGadget::reset(const shared_ptr &callback, + int64_t in_transactionId) { + if (callback) + callback->resetCb(Status::SUCCESS, in_transactionId); return ScopedAStatus::ok(); } diff --git a/usb/gadget/aidl/default/UsbGadget.h b/usb/gadget/aidl/default/UsbGadget.h index adcfcfa7ca..5eaaa48550 100644 --- a/usb/gadget/aidl/default/UsbGadget.h +++ b/usb/gadget/aidl/default/UsbGadget.h @@ -96,7 +96,8 @@ struct UsbGadget : public BnUsbGadget { ScopedAStatus getCurrentUsbFunctions(const shared_ptr &callback, int64_t in_transactionId) override; - ScopedAStatus reset() override; + ScopedAStatus reset(const shared_ptr &callback, + int64_t in_transactionId) override; ScopedAStatus getUsbSpeed(const shared_ptr &callback, int64_t in_transactionId) override; From 379ee87f1ac4bdc62e721d94376117c626bb54c8 Mon Sep 17 00:00:00 2001 From: Neil Fuller Date: Thu, 19 Jan 2023 13:52:00 +0000 Subject: [PATCH 664/998] Improve docs around "on demand time" capability Update the docs to record how the behavior differs from the name. current.txt has been updated by hand using information from: hidl-gen -L hash -r android.hardware:hardware/interfaces \ android.hardware.gnss@1.0::IGnssCallback As per instructions at https://source.android.com/docs/core/architecture/hidl/hashing This is acceptable because it's just a docs change that documents existing, historic behavior. Previous docs were misleading. Test: hidl-gen -L check -r android.hardware:hardware/interfaces android.hardware.gnss@1.0::IGnssCallback Bug: 222295093 Bug: 73893222 Change-Id: I935354be52239482d559962e9a9ee1faaf73f4b1 --- current.txt | 1 + gnss/1.0/IGnssCallback.hal | 8 +++++++- gnss/aidl/android/hardware/gnss/IGnssCallback.aidl | 8 +++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/current.txt b/current.txt index fbdd3fe648..ef1f65a4b6 100644 --- a/current.txt +++ b/current.txt @@ -933,5 +933,6 @@ b7ce2d87841585551b082fca6d099622e63b7099e0d8013f687ea1a1dc35c4dc android.hardwar 2aa559cda86c358c6429114ef6bc72c1b43281e98f9eb6b4df5e7073c8d05767 android.hardware.automotive.vehicle@2.0::types 42abd285a4293dadb8c89bc63b90cae2872fbffe90c4517aa3ea4965e8aecff7 android.hardware.graphics.common@1.2::types 4f1a02d21a22104c734f71cdbba19b6f7e93d4ee107ff79f0dbdd171a8430e0e android.hardware.automotive.vehicle@2.0::types +a2fbd9747fbb9ceb8c1090b5a24138312246502d5af0654a8c2b603a9bf521fc android.hardware.gnss@1.0::IGnssCallback # There will be no more HIDL HALs. Use AIDL instead. diff --git a/gnss/1.0/IGnssCallback.hal b/gnss/1.0/IGnssCallback.hal index 311ab2166c..512763e717 100644 --- a/gnss/1.0/IGnssCallback.hal +++ b/gnss/1.0/IGnssCallback.hal @@ -37,7 +37,13 @@ interface IGnssCallback { MSA = 1 << 2, /** GNSS supports single-shot fixes */ SINGLE_SHOT = 1 << 3, - /** GNSS supports on demand time injection */ + /** + * The platform periodically injects time to GNSS in addition to + * on-demand and occasional time updates. + * + * Note: The naming of "on demand" should be "periodic" instead. This + * is the result of a historic implementation bug, b/73893222. + */ ON_DEMAND_TIME = 1 << 4, /** GNSS supports Geofencing */ GEOFENCING = 1 << 5, diff --git a/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl b/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl index ff9feeacbd..ee21011a6d 100644 --- a/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl +++ b/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl @@ -49,7 +49,13 @@ interface IGnssCallback { /** Capability bit mask indicating that GNSS supports single-shot fixes */ const int CAPABILITY_SINGLE_SHOT = 1 << 3; - /** Capability bit mask indicating that GNSS supports on demand time injection */ + /** + * Capability bit indicating that the platform should periodically inject + * time to GNSS in addition to on-demand and occasional time updates. + * + *

Note:The naming of "on demand" should be "periodic" instead. This + * is the result of a historic implementation bug, b/73893222. + */ const int CAPABILITY_ON_DEMAND_TIME = 1 << 4; /** Capability bit mask indicating that GNSS supports Geofencing */ From dbab0de442246a78c42acf5ca7c4f7c94fd82651 Mon Sep 17 00:00:00 2001 From: Yu-Han Yang Date: Tue, 7 Feb 2023 19:01:56 +0000 Subject: [PATCH 665/998] Throw away initial measurements before interval tests Bug: 264597734 Test: atest VtsHalGnssTargetTest Change-Id: I1064807adf3264f13c1ef6678df37cff350503c5 --- gnss/aidl/vts/gnss_hal_test.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/gnss/aidl/vts/gnss_hal_test.cpp b/gnss/aidl/vts/gnss_hal_test.cpp index 7578585aca..fb9af527c5 100644 --- a/gnss/aidl/vts/gnss_hal_test.cpp +++ b/gnss/aidl/vts/gnss_hal_test.cpp @@ -456,6 +456,7 @@ void GnssHalTest::collectMeasurementIntervals(const sp& deltasMs) { + callback->gnss_data_cbq_.reset(); // throw away the initial measurements if any int64_t lastElapsedRealtimeMillis = 0; for (int i = 0; i < numMeasurementEvents; i++) { GnssData lastGnssData; From 2fa1126ee3f137351d2b7dc3220eeb84aed030fe Mon Sep 17 00:00:00 2001 From: Tyler Trephan Date: Wed, 8 Feb 2023 00:49:50 +0000 Subject: [PATCH 666/998] Created OWNERS file for aidl_property and added tylertrephan@google.com Test: None Fix: 255430764 Change-Id: I41ce607225a5955267bbc027580eb831d821bfa2 --- automotive/vehicle/aidl_property/OWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 automotive/vehicle/aidl_property/OWNERS diff --git a/automotive/vehicle/aidl_property/OWNERS b/automotive/vehicle/aidl_property/OWNERS new file mode 100644 index 0000000000..73e45cab13 --- /dev/null +++ b/automotive/vehicle/aidl_property/OWNERS @@ -0,0 +1 @@ +tylertrephan@google.com From 370f10e3c160c388d30f75bba479cef4cef165cc Mon Sep 17 00:00:00 2001 From: Eva Chen Date: Tue, 7 Feb 2023 15:11:30 -0800 Subject: [PATCH 667/998] Add explanatory note to ADAS properties. Bug: 255851113 Test: Presubmit only. Documentation only change. Change-Id: I159ed7d5a05cdd412b7b76cda14709195f04c260 --- .../hardware/automotive/vehicle/VehicleProperty.aidl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index d336dae1bd..2dedb54d53 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3446,10 +3446,17 @@ enum VehicleProperty { VEHICLE_IN_USE = 0x0F4A + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, - /*************************************************************************** + /*********************************************************************************************** * Start of ADAS Properties + * + * Android is not a safety critical system and is provided as is without any timing guarantees, + * representations or warranties. OEMs implementing these properties, and clients using these + * properties should ensure they complete any necessary safety reviews, in accordance with + * industry standards, to ensure the use of these APIs do not negatively impact driver safety. + * Use of any Google APIs will be at the OEM's sole risk. + * * Allocate IDs in range of 0x1000 (inclusive) to 0x1100 (exclusive) for ADAS properties - **************************************************************************/ + **********************************************************************************************/ /** * Enable or disable automatic emergency braking (AEB). From 197ac1301a463ccb768041c4e91020befbc43866 Mon Sep 17 00:00:00 2001 From: Terry Guan Date: Tue, 7 Feb 2023 20:43:25 -0800 Subject: [PATCH 668/998] Changed Status code Changed status code comment to reflect changes for vendor error codes. Bug: 268261402 Test: atest CarPropertyManagerUnitTest Change-Id: I232f429c4d6caea7ee6736554e84cbbc64ed9996 --- .../aidl/android/hardware/automotive/vehicle/StatusCode.aidl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/StatusCode.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/StatusCode.aidl index 8ac6506f69..029b2aca5d 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/StatusCode.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/StatusCode.aidl @@ -17,7 +17,9 @@ package android.hardware.automotive.vehicle; /** - * Error codes used in vehicle HAL interface. + * Error codes used in vehicle HAL interface. System defined error codes will have the range from + * 0x00000000 to 0x0000ffff and vendor error codes will have the range from 0x0000 << 16 to + * 0xffff << 16. The error code is formatted as [VENDOR_ERROR] << 16 | [SYSTEM_ERROR] */ @VintfStability @Backing(type="int") From d86c7fd8776d463d28d8ef4a5d45a1825ec2f55c Mon Sep 17 00:00:00 2001 From: Arati Gerdes Date: Mon, 19 Dec 2022 12:32:29 -0800 Subject: [PATCH 669/998] Add HAL changes for GLOVE_BOX_DOOR_POS Test: atest CtsCarTestCases:CarPropertyManagerTest Bug: 259434426 Change-Id: I2936baae6b6bf3ce4dd0a88e3a3b58fa5c794e76 --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../config/DefaultProperties.json | 15 +++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 22 +++++++++++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 +++++ 8 files changed, 48 insertions(+) diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 198681ec72..02318c17ce 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -184,6 +184,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::STEERING_WHEEL_THEFT_LOCK_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::STEERING_WHEEL_LOCKED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::STEERING_WHEEL_EASY_ACCESS_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::GLOVE_BOX_DOOR_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyAccess::READ}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyAccess::READ}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 4dbe7aa835..437a6e6de2 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -184,6 +184,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::STEERING_WHEEL_THEFT_LOCK_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_LOCKED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::GLOVE_BOX_DOOR_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 88314e3f37..cac1af2b43 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -176,6 +176,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.STEERING_WHEEL_THEFT_LOCK_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.STEERING_WHEEL_LOCKED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.STEERING_WHEEL_EASY_ACCESS_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.GLOVE_BOX_DOOR_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyAccess.READ), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 787bb2b59b..b751828e8d 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -176,6 +176,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.STEERING_WHEEL_THEFT_LOCK_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_LOCKED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.GLOVE_BOX_DOOR_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 313173304f..0e20b936e8 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2732,6 +2732,21 @@ ] } }, + { + "property": "VehicleProperty::GLOVE_BOX_DOOR_POS", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": 0, + "maxInt32Value": 10 + } + ] + }, { "property": "VehicleProperty::WHEEL_TICK", "defaultValue": { diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 4b8151c8c1..2c7d2ccba0 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -182,6 +182,7 @@ enum VehicleProperty { STEERING_WHEEL_THEFT_LOCK_ENABLED = (((0x0BE4 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287312868 */, STEERING_WHEEL_LOCKED = (((0x0BE5 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287312869 */, STEERING_WHEEL_EASY_ACCESS_ENABLED = (((0x0BE6 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287312870 */, + GLOVE_BOX_DOOR_POS = (((0x0BF0 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518896 */, VEHICLE_MAP_SERVICE = (((0x0C00 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299895808 */, OBD2_LIVE_FRAME = (((0x0D00 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896064 */, OBD2_FREEZE_FRAME = (((0x0D01 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896065 */, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index d336dae1bd..7cdd92cc10 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -2196,6 +2196,28 @@ enum VehicleProperty { */ STEERING_WHEEL_EASY_ACCESS_ENABLED = 0x0BE6 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Property that represents the current position of the glove box door. + * + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. + * The minInt32Value must be 0. + * All integers between minInt32Value and maxInt32Value must be supported. + * + * minInt32Value indicates that the glove box door is closed. + * maxInt32Value indicates that the glove box door is in the fully open position. + * + * Values in between minInt32Value and maxInt32Value indicate a transition state between the + * closed and fully open positions. + * + * The area ID must match the seat by which the glove box is intended to be used (e.g. if the + * front right dashboard has a glove box embedded in it, then the area ID should be + * SEAT_1_RIGHT). + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + GLOVE_BOX_DOOR_POS = + 0x0BF0 + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, /** * Vehicle Maps Service (VMS) message * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 6b0fb1bed4..63996fa284 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -606,6 +606,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelLightsSwitchConfig) VehicleArea::GLOBAL, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyGloveBoxDoorPosConfig) { + verifyProperty(VehicleProperty::GLOVE_BOX_DOOR_POS, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::SEAT, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyMirrorAutoFoldEnabledConfig) { verifyProperty(VehicleProperty::MIRROR_AUTO_FOLD_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From 57be403812205ec7a7078ac5399203ca84edc5bf Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Thu, 2 Feb 2023 14:15:03 -0800 Subject: [PATCH 670/998] Add HAL changes for GLOVE_BOX_LOCKED Bug: 259434512 Test: atest VtsHalAutomotiveVehicle_TargetTest Test: atest CtsCarTestCases:CarPropertyManagerTest Test: atest CtsCarTestCases:VehiclePropertyIdsTest Change-Id: Iab43d0f65d3e3b0e7ff15aaf29c70eb9e4501e12 --- .../generated_lib/cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../default_config/config/DefaultProperties.json | 13 +++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 16 ++++++++++++++++ .../src/VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 40 insertions(+) diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 02318c17ce..1439f3d677 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -185,6 +185,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::STEERING_WHEEL_LOCKED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::STEERING_WHEEL_EASY_ACCESS_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::GLOVE_BOX_DOOR_POS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::GLOVE_BOX_LOCKED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyAccess::READ}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyAccess::READ}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 437a6e6de2..8bc4348a71 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -185,6 +185,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::STEERING_WHEEL_LOCKED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::GLOVE_BOX_DOOR_POS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::GLOVE_BOX_LOCKED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index cac1af2b43..fc0e210f4c 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -177,6 +177,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.STEERING_WHEEL_LOCKED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.STEERING_WHEEL_EASY_ACCESS_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.GLOVE_BOX_DOOR_POS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.GLOVE_BOX_LOCKED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyAccess.READ), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index b751828e8d..93103a797a 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -177,6 +177,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.STEERING_WHEEL_LOCKED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_EASY_ACCESS_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.GLOVE_BOX_DOOR_POS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.GLOVE_BOX_LOCKED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 0e20b936e8..39bd59700c 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2747,6 +2747,19 @@ } ] }, + { + "property": "VehicleProperty::GLOVE_BOX_LOCKED", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "Constants::SEAT_1_RIGHT" + } + ] + }, { "property": "VehicleProperty::WHEEL_TICK", "defaultValue": { diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 2c7d2ccba0..278a510d1e 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -183,6 +183,7 @@ enum VehicleProperty { STEERING_WHEEL_LOCKED = (((0x0BE5 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287312869 */, STEERING_WHEEL_EASY_ACCESS_ENABLED = (((0x0BE6 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287312870 */, GLOVE_BOX_DOOR_POS = (((0x0BF0 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518896 */, + GLOVE_BOX_LOCKED = (((0x0BF1 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 354421745 */, VEHICLE_MAP_SERVICE = (((0x0C00 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299895808 */, OBD2_LIVE_FRAME = (((0x0D00 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896064 */, OBD2_FREEZE_FRAME = (((0x0D01 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896065 */, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 7cdd92cc10..8604e50b54 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -2218,6 +2218,22 @@ enum VehicleProperty { */ GLOVE_BOX_DOOR_POS = 0x0BF0 + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.INT32, + + /** + * Lock or unlock the glove box. + * + * If true, the glove box is locked. If false, the glove box is unlocked. + * + * The area ID must match the seat by which the glove box is intended to be used (e.g. if the + * front right dashboard has a glove box embedded in it, then the area ID should be + * VehicleAreaSeat#ROW_1_RIGHT). + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + GLOVE_BOX_LOCKED = + 0x0BF1 + VehiclePropertyGroup.SYSTEM + VehicleArea.SEAT + VehiclePropertyType.BOOLEAN, + /** * Vehicle Maps Service (VMS) message * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 63996fa284..339792471c 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -612,6 +612,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyGloveBoxDoorPosConfig) { VehicleArea::SEAT, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyGloveBoxLockedConfig) { + verifyProperty(VehicleProperty::GLOVE_BOX_LOCKED, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::SEAT, VehiclePropertyType::BOOLEAN); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyMirrorAutoFoldEnabledConfig) { verifyProperty(VehicleProperty::MIRROR_AUTO_FOLD_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From ebf1303803c4132114b2709f993ba68f88ea6d17 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Tue, 7 Feb 2023 00:31:19 -0800 Subject: [PATCH 671/998] Add MILLI_SECS to VehicleUnit.aidl VehicleUnit contains MILLI_SECS in types.hal but not in VehicleUnit.aidl. Bug: 267556675 Test: atest VehicleUnitTest Change-Id: I9616ab75575da32b108e1fca811357ea7464b12d --- .../current/android/hardware/automotive/vehicle/VehicleUnit.aidl | 1 + .../android/hardware/automotive/vehicle/VehicleUnit.aidl | 1 + 2 files changed, 2 insertions(+) diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleUnit.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleUnit.aidl index 8a18d4ac43..9aca98bec2 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleUnit.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleUnit.aidl @@ -52,6 +52,7 @@ enum VehicleUnit { US_GALLON = 0x42, IMPERIAL_GALLON = 0x43, NANO_SECS = 0x50, + MILLI_SECS = 0x51, SECS = 0x53, YEAR = 0x59, WATT_HOUR = 0x60, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleUnit.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleUnit.aidl index 3817b74ce9..d4f9086e2b 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleUnit.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleUnit.aidl @@ -43,6 +43,7 @@ enum VehicleUnit { US_GALLON = 0x42, IMPERIAL_GALLON = 0x43, NANO_SECS = 0x50, + MILLI_SECS = 0x51, SECS = 0x53, YEAR = 0x59, WATT_HOUR = 0x60, From 34454421e80b3a87aadebdcf5516d2a21d750fd6 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Mon, 30 Jan 2023 08:56:25 -0800 Subject: [PATCH 672/998] Add NOT_AVAILABLE_POOR_VISIBILITY to ErrorState in HAL Added NOT_AVAILABLE_POOR_VISIBILITY to ErrorState enum between NOT_AVAILABLE_SPEED_HIGH and NOT_AVAILABLE_SAFETY to be consistent with StatusCode. Bug: 267174892 Test: atest CtsCarTestCases:CarPropertyManagerTest Test: atest AndroidCarApiTest:ErrorStateTest Change-Id: Iad0edb555c7d0f6c3f4570cb489663e65eb08fd4 --- .../android/hardware/automotive/vehicle/ErrorState.aidl | 3 ++- .../android/hardware/automotive/vehicle/ErrorState.aidl | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ErrorState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ErrorState.aidl index e3305c7403..dd950ce88c 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ErrorState.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ErrorState.aidl @@ -38,5 +38,6 @@ enum ErrorState { NOT_AVAILABLE_DISABLED = (-2) /* -2 */, NOT_AVAILABLE_SPEED_LOW = (-3) /* -3 */, NOT_AVAILABLE_SPEED_HIGH = (-4) /* -4 */, - NOT_AVAILABLE_SAFETY = (-5) /* -5 */, + NOT_AVAILABLE_POOR_VISIBILITY = (-5) /* -5 */, + NOT_AVAILABLE_SAFETY = (-6) /* -6 */, } diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ErrorState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ErrorState.aidl index 0c625757ee..d6dd3fcf3b 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ErrorState.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ErrorState.aidl @@ -34,5 +34,6 @@ enum ErrorState { NOT_AVAILABLE_DISABLED = -2, NOT_AVAILABLE_SPEED_LOW = -3, NOT_AVAILABLE_SPEED_HIGH = -4, - NOT_AVAILABLE_SAFETY = -5, + NOT_AVAILABLE_POOR_VISIBILITY = -5, + NOT_AVAILABLE_SAFETY = -6, } From 5e1b683b2acb0d34cad910f4def7391115f22e64 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Mon, 6 Feb 2023 07:37:22 -0800 Subject: [PATCH 673/998] Add NOT_AVAILABLE_POOR_VISIBILITY to supportedEnumValues Update supportedEnumValues array for ADAS STATE properties with new state. Adjust defaultValue to a more sensible value for ADAS properties. Bug: 267174892 Test: presubmit Change-Id: I2e2c130524156a8ef302ea774ce4dcbfe1260c4a --- .../impl/default_config/config/DefaultProperties.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 313173304f..975ad2bc9c 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3166,7 +3166,7 @@ "property": "VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE", "defaultValue": { "int32Values": [ - "AutomaticEmergencyBrakingState::ENABLED" + "ErrorState::NOT_AVAILABLE_DISABLED" ] }, "areas": [ @@ -3174,6 +3174,7 @@ "areaId": 0, "supportedEnumValues": [ "ErrorState::NOT_AVAILABLE_SAFETY", + "ErrorState::NOT_AVAILABLE_POOR_VISIBILITY", "ErrorState::NOT_AVAILABLE_SPEED_HIGH", "ErrorState::NOT_AVAILABLE_SPEED_LOW", "ErrorState::NOT_AVAILABLE_DISABLED", @@ -3188,7 +3189,7 @@ "property": "VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED", "defaultValue": { "int32Values": [ - 0 + 1 ] } }, @@ -3204,6 +3205,7 @@ "areaId": 0, "supportedEnumValues": [ "ErrorState::NOT_AVAILABLE_SAFETY", + "ErrorState::NOT_AVAILABLE_POOR_VISIBILITY", "ErrorState::NOT_AVAILABLE_SPEED_HIGH", "ErrorState::NOT_AVAILABLE_SPEED_LOW", "ErrorState::NOT_AVAILABLE_DISABLED", @@ -3217,7 +3219,7 @@ "property": "VehicleProperty::BLIND_SPOT_WARNING_ENABLED", "defaultValue": { "int32Values": [ - 0 + 1 ] } }, @@ -3233,6 +3235,7 @@ "areaId": "Constants::MIRROR_DRIVER_LEFT_RIGHT", "supportedEnumValues": [ "ErrorState::NOT_AVAILABLE_SAFETY", + "ErrorState::NOT_AVAILABLE_POOR_VISIBILITY", "ErrorState::NOT_AVAILABLE_SPEED_HIGH", "ErrorState::NOT_AVAILABLE_SPEED_LOW", "ErrorState::NOT_AVAILABLE_DISABLED", From 38ecabbabfeebee144dc5a321e19f57a42ceaccd Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Tue, 7 Feb 2023 14:16:29 -0800 Subject: [PATCH 674/998] Add HAL documentation for ErrorState values Bug: 267174892 Test: presubmit Change-Id: I724a9e633011cf664b7f9e0b62106074a2d9e7c6 --- .../automotive/vehicle/ErrorState.aidl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ErrorState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ErrorState.aidl index d6dd3fcf3b..ba44672976 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ErrorState.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ErrorState.aidl @@ -31,9 +31,28 @@ enum ErrorState { * include additional states. */ OTHER_ERROR_STATE = -1, + /** + * Vehicle property is not available because the feature is disabled. + */ NOT_AVAILABLE_DISABLED = -2, + /** + * Vehicle property is not available because the vehicle speed is too low to use this feature. + */ NOT_AVAILABLE_SPEED_LOW = -3, + /** + * Vehicle property is not available because the vehicle speed is too high to use this feature. + */ NOT_AVAILABLE_SPEED_HIGH = -4, + /** + * Vehicle property is not available because sensor or camera visibility is insufficient to use + * this feature. For example, this can be caused by bird poop blocking the camera, poor weather + * conditions such as snow or fog, or by any object obstructing the required sensors. + */ NOT_AVAILABLE_POOR_VISIBILITY = -5, + /** + * Vehicle property is not available because there is a safety risk that makes this feature + * unavailable to use presently. For example, this can be caused by someone blocking the trunk + * door while it is closing, or by the system being in a faulty state. + */ NOT_AVAILABLE_SAFETY = -6, } From 2b4ceb6365fb821af00e29a2654d6992d61b37cb Mon Sep 17 00:00:00 2001 From: Sally Qi Date: Wed, 8 Feb 2023 12:59:54 -0800 Subject: [PATCH 675/998] Add exception annotation to getOverlaySupport api. Bug: 268246323 Test: builds Change-Id: I1979fed444a9fd3d94af729112fff070beb01439 --- .../android/hardware/graphics/composer3/IComposerClient.aidl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl index 8091491ae2..17924b949f 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl @@ -824,6 +824,8 @@ interface IComposerClient { * * This function returns what the device's overlays support. * + * @exception EX_UNSUPPORTED when not supported by the underlying HAL + * * @return the overlay properties of the device. */ OverlayProperties getOverlaySupport(); From c7ef8a08bef2953c87454bd50f5abf63f9850204 Mon Sep 17 00:00:00 2001 From: Rongxuan Liu Date: Thu, 26 Jan 2023 17:14:54 +0000 Subject: [PATCH 676/998] Add new field 'pcmStreamId' in LeAudioBroadcastConfiguration This field is used to indicate the PCM stream source for given stream handle Tag: #feature Bug: 264692800 Test: m android.hardware.bluetooth.audio-update-api Change-Id: I3df9066e98ca552329bb58ae5fbc5346d1021b10 --- .../bluetooth/audio/LeAudioBroadcastConfiguration.aidl | 1 + .../bluetooth/audio/LeAudioBroadcastConfiguration.aidl | 4 ++++ bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl index 7d53b0ca8e..2945710c26 100644 --- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl @@ -41,5 +41,6 @@ parcelable LeAudioBroadcastConfiguration { char streamHandle; int audioChannelAllocation; android.hardware.bluetooth.audio.LeAudioCodecConfiguration leAudioCodecConfig; + char pcmStreamId; } } diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl index e9a1a0c6e9..16503fb36a 100644 --- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl +++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl @@ -35,6 +35,10 @@ parcelable LeAudioBroadcastConfiguration { */ int audioChannelAllocation; LeAudioCodecConfiguration leAudioCodecConfig; + /* + * Pcm stream id to identify the source for given streamHandle. + */ + char pcmStreamId; } CodecType codecType; BroadcastStreamMap[] streamMap; diff --git a/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp b/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp index 128ef61403..6a913f7b1e 100644 --- a/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp +++ b/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp @@ -1570,6 +1570,10 @@ TEST_P(BluetoothAudioProviderLeAudioBroadcastHardwareAidl, le_audio_broadcast_config.streamMap[0] .leAudioCodecConfig.set( lc3_config); + le_audio_broadcast_config.streamMap[0].streamHandle = 0x0; + le_audio_broadcast_config.streamMap[0].pcmStreamId = 0x0; + le_audio_broadcast_config.streamMap[0].audioChannelAllocation = 0x1 << 0; + DataMQDesc mq_desc; auto aidl_retval = audio_provider_->startSession( audio_port_, AudioConfiguration(le_audio_broadcast_config), From 78db2ca676333661559ff1cf45adb897918f2331 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Tue, 10 Jan 2023 17:34:28 -0800 Subject: [PATCH 677/998] Add HAL changes for LANE_KEEP_ASSIST_STATE This property supports error states in addition to its own state. This is why the comments mention two @data_enums for this property. This works because states are integer values so as long as all states have distinct integer values, this functions correctly. Bug: 264946157 Test: atest VtsHalAutomotiveVehicle_TargetTest Test: atest CtsCarTestCases:CarPropertyManagerTest Test: atest CtsCarTestCases:VehiclePropertyIdsTest Test: atest CtsCarTestCases:LaneKeepAssistStateTest Test: atest AndroidCarApiTest:LaneKeepAssistStateTest Change-Id: I60ea32b21dc79d692eeb733e4b38deb16a3231f2 --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../JsonConfigLoader/src/JsonConfigLoader.cpp | 3 + .../config/DefaultProperties.json | 25 +++++++- .../aidl/impl/default_config/config/README.md | 2 + .../utils/common/include/VehicleHalTypes.h | 1 + .../vehicle/LaneKeepAssistState.aidl | 42 ++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../vehicle/LaneKeepAssistState.aidl | 58 +++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 22 +++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++ 13 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LaneKeepAssistState.aidl create mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LaneKeepAssistState.aidl diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 198681ec72..68641ab617 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -248,6 +248,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::BLIND_SPOT_WARNING_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 4dbe7aa835..96105da51e 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -248,6 +248,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::BLIND_SPOT_WARNING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::LANE_KEEP_ASSIST_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 88314e3f37..e25af0f3cd 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -240,6 +240,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.BLIND_SPOT_WARNING_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 787bb2b59b..207f6c76bc 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -240,6 +240,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.BLIND_SPOT_WARNING_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.LANE_KEEP_ASSIST_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index d37fada4db..aa8fd83e8c 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -45,6 +45,7 @@ using ::aidl::android::hardware::automotive::vehicle::EvsServiceType; using ::aidl::android::hardware::automotive::vehicle::ForwardCollisionWarningState; using ::aidl::android::hardware::automotive::vehicle::FuelType; using ::aidl::android::hardware::automotive::vehicle::GsrComplianceRequirementType; +using ::aidl::android::hardware::automotive::vehicle::LaneKeepAssistState; using ::aidl::android::hardware::automotive::vehicle::RawPropValues; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq; @@ -218,6 +219,8 @@ JsonValueParser::JsonValueParser() { std::make_unique>(); mConstantParsersByType["BlindSpotWarningState"] = std::make_unique>(); + mConstantParsersByType["LaneKeepAssistState"] = + std::make_unique>(); mConstantParsersByType["Constants"] = std::make_unique(); } diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 313173304f..627a1445fd 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3254,10 +3254,33 @@ "property": "VehicleProperty::LANE_KEEP_ASSIST_ENABLED", "defaultValue": { "int32Values": [ - 0 + 1 ] } }, + { + "property": "VehicleProperty::LANE_KEEP_ASSIST_STATE", + "defaultValue": { + "int32Values": [ + "LaneKeepAssistState::ENABLED" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "ErrorState::NOT_AVAILABLE_SAFETY", + "ErrorState::NOT_AVAILABLE_SPEED_HIGH", + "ErrorState::NOT_AVAILABLE_SPEED_LOW", + "ErrorState::NOT_AVAILABLE_DISABLED", + "LaneKeepAssistState::ENABLED", + "LaneKeepAssistState::ACTIVATED_STEER_LEFT", + "LaneKeepAssistState::ACTIVATED_STEER_RIGHT", + "LaneKeepAssistState::USER_OVERRIDE" + ] + } + ] + }, { "property": "VehicleProperty::LANE_CENTERING_ASSIST_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/default_config/config/README.md b/automotive/vehicle/aidl/impl/default_config/config/README.md index 41ce9a7adb..e04710105c 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/README.md +++ b/automotive/vehicle/aidl/impl/default_config/config/README.md @@ -147,6 +147,8 @@ We support the following constant types: * BlindSpotWarningState +* LaneKeepAssistState + * ErrorState * Constants diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index d9d0db03e9..0fc3215934 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LaneKeepAssistState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LaneKeepAssistState.aidl new file mode 100644 index 0000000000..9c92ff69c5 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LaneKeepAssistState.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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum LaneKeepAssistState { + OTHER = 0, + ENABLED = 1, + ACTIVATED_STEER_LEFT = 2, + ACTIVATED_STEER_RIGHT = 3, + USER_OVERRIDE = 4, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 4b8151c8c1..941c0ae78b 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -246,6 +246,7 @@ enum VehicleProperty { BLIND_SPOT_WARNING_STATE = (((0x1005 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.MIRROR) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 339742725 */, LANE_DEPARTURE_WARNING_ENABLED = (((0x1006 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313926 */, LANE_KEEP_ASSIST_ENABLED = (((0x1008 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313928 */, + LANE_KEEP_ASSIST_STATE = (((0x1009 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411081 */, LANE_CENTERING_ASSIST_ENABLED = (((0x100A + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313930 */, EMERGENCY_LANE_KEEP_ASSIST_ENABLED = (((0x100D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313933 */, ADAPTIVE_CRUISE_CONTROL_ENABLED = (((0x100F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313935 */, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LaneKeepAssistState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LaneKeepAssistState.aidl new file mode 100644 index 0000000000..c1c15a0e93 --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LaneKeepAssistState.aidl @@ -0,0 +1,58 @@ +/* + * 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.hardware.automotive.vehicle; + +/** + * Used to enumerate the state of Lane Keep Assist (LKA). + */ +@VintfStability +@Backing(type="int") +enum LaneKeepAssistState { + + /** + * This state is used as an alternative for any LaneKeepAssistState value that is not defined in + * the platform. Ideally, implementations of VehicleProperty#LANE_KEEP_ASSIST_STATE should not + * use this state. The framework can use this field to remain backwards compatible if + * LaneKeepAssistState is extended to include additional states. + */ + OTHER = 0, + /** + * LKA is enabled and monitoring, but steering assist is not activated. + */ + ENABLED = 1, + /** + * LKA is enabled and currently has steering assist applied for the vehicle. Steering assist is + * steering toward the left direction, which generally means the steering wheel turns counter + * clockwise. This is usually in response to the vehicle drifting to the right. Once steering + * assist is completed, LKA must return to the ENABLED state. + */ + ACTIVATED_STEER_LEFT = 2, + /** + * LKA is enabled and currently has steering assist applied for the vehicle. Steering assist is + * steering toward the right direction, which generally means the steering wheel turns + * clockwise. This is usually in response to the vehicle drifting to the left. Once steering + * assist is completed, LKA must return to the ENABLED state. + */ + ACTIVATED_STEER_RIGHT = 3, + /** + * Many LKA implementations allow the driver to override LKA. This means that the car has + * determined it should take some action, but a user decides to take over and do something else. + * This is often done for safety reasons and to ensure that the driver can always take control + * of the vehicle. This state should be set when the user is actively overriding the LKA system. + */ + USER_OVERRIDE = 4, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index d336dae1bd..2d393e3802 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3604,6 +3604,28 @@ enum VehicleProperty { LANE_KEEP_ASSIST_ENABLED = 0x1008 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Lane Keep Assist (LKA) state. + * + * Returns the current state of LKA. This property must always return a valid state defined in + * LaneKeepAssistState or ErrorState. It must not surface errors through StatusCode + * and must use the supported error states instead. + * + * If LKA includes lane departure warnings before applying steering corrections, those warnings + * must be surfaced through the Lane Departure Warning (LDW) properties. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of both LaneKeepAssistState (including OTHER, which is not + * recommended) and ErrorState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum LaneKeepAssistState + * @data_enum ErrorState + */ + LANE_KEEP_ASSIST_STATE = + 0x1009 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** * Enable or disable lane centering assist (LCA). * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 6b0fb1bed4..57b57e9eaf 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -726,6 +726,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneKeepAssistEnabledConfig) { VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneKeepAssistStateConfig) { + verifyProperty(VehicleProperty::LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistEnabledConfig) { verifyProperty(VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, From 6fb5cb3332ac20decbe3049ff091532141e7f270 Mon Sep 17 00:00:00 2001 From: Pawan Wagh Date: Wed, 1 Feb 2023 23:38:37 +0000 Subject: [PATCH 678/998] Fixing null deference in android.hardware.usb.gadget-service.example Test: atest VtsAidlUsbTargetTest Bug: 267534245 Change-Id: Ib28b7848205809912b6789d0e050c1a981dc1ce8 --- usb/gadget/aidl/default/UsbGadget.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/usb/gadget/aidl/default/UsbGadget.cpp b/usb/gadget/aidl/default/UsbGadget.cpp index c4986e8e18..4a406528f7 100644 --- a/usb/gadget/aidl/default/UsbGadget.cpp +++ b/usb/gadget/aidl/default/UsbGadget.cpp @@ -90,8 +90,11 @@ void currentFunctionsAppliedCallback(bool functionsApplied, void *payload) { gadget->mCurrentUsbFunctionsApplied = functionsApplied; } -ScopedAStatus UsbGadget::getCurrentUsbFunctions(const shared_ptr &callback, - int64_t in_transactionId) { +ScopedAStatus UsbGadget::getCurrentUsbFunctions(const shared_ptr& callback, + int64_t in_transactionId) { + if (callback == nullptr) { + return ScopedAStatus::fromExceptionCode(EX_NULL_POINTER); + } ScopedAStatus ret = callback->getCurrentUsbFunctionsCb( mCurrentUsbFunctions, mCurrentUsbFunctionsApplied ? Status::FUNCTIONS_APPLIED : Status::FUNCTIONS_NOT_APPLIED, From dd0edc63371f8b56ba9d6e433d9d2d8ba0f700dc Mon Sep 17 00:00:00 2001 From: Xiang Wang Date: Wed, 8 Feb 2023 16:47:06 -0800 Subject: [PATCH 679/998] Fix the hidden main function in VTS tests Otherwise gtest will inherit the one from libgtest_main which will not start thread pool to handle binder call for callbacks Bug: b/205762943 Test: atest VtsHalThermalTargetTest VtsHalPowerTargetTest VtsHalTetheroffloadTargetTest Change-Id: Ib9e5d265b8f5081dd20568a98d01e9190177440a --- power/aidl/vts/VtsHalPowerTargetTest.cpp | 3 +-- .../aidl/vts/functional/VtsHalTetheroffloadTargetTest.cpp | 3 +-- thermal/aidl/vts/VtsHalThermalTargetTest.cpp | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/power/aidl/vts/VtsHalPowerTargetTest.cpp b/power/aidl/vts/VtsHalPowerTargetTest.cpp index 5f5ce56c6f..d14e7b61a6 100644 --- a/power/aidl/vts/VtsHalPowerTargetTest.cpp +++ b/power/aidl/vts/VtsHalPowerTargetTest.cpp @@ -285,6 +285,7 @@ INSTANTIATE_TEST_SUITE_P(Power, PowerAidl, ::android::PrintInstanceNameToString); } // namespace +} // namespace aidl::android::hardware::power int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); @@ -292,5 +293,3 @@ int main(int argc, char** argv) { ABinderProcess_startThreadPool(); return RUN_ALL_TESTS(); } - -} // namespace aidl::android::hardware::power diff --git a/tetheroffload/aidl/vts/functional/VtsHalTetheroffloadTargetTest.cpp b/tetheroffload/aidl/vts/functional/VtsHalTetheroffloadTargetTest.cpp index f46c9aba75..1049ea2cb9 100644 --- a/tetheroffload/aidl/vts/functional/VtsHalTetheroffloadTargetTest.cpp +++ b/tetheroffload/aidl/vts/functional/VtsHalTetheroffloadTargetTest.cpp @@ -690,6 +690,7 @@ INSTANTIATE_TEST_SUITE_P( ::android::PrintInstanceNameToString); } // namespace +} // namespace aidl::android::hardware::tetheroffload int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); @@ -697,5 +698,3 @@ int main(int argc, char** argv) { ABinderProcess_startThreadPool(); return RUN_ALL_TESTS(); } - -} // namespace aidl::android::hardware::tetheroffload diff --git a/thermal/aidl/vts/VtsHalThermalTargetTest.cpp b/thermal/aidl/vts/VtsHalThermalTargetTest.cpp index b93250e9d1..feb4fb118a 100644 --- a/thermal/aidl/vts/VtsHalThermalTargetTest.cpp +++ b/thermal/aidl/vts/VtsHalThermalTargetTest.cpp @@ -133,6 +133,7 @@ INSTANTIATE_TEST_SUITE_P( ::android::PrintInstanceNameToString); } // namespace +} // namespace aidl::android::hardware::thermal int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); @@ -140,5 +141,3 @@ int main(int argc, char** argv) { ABinderProcess_startThreadPool(); return RUN_ALL_TESTS(); } - -} // namespace aidl::android::hardware::thermal From 16ec29b3074d16b43958d19d732a5b07c8492b6e Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Sat, 4 Feb 2023 05:30:55 +0000 Subject: [PATCH 680/998] Wifi: IP Address Allocation in EAPOL-Key Frames Implementation of Wi-Fi P2P Technical Specification v1.7 - Section 4.2.8 "IP Address Allocation in EAPOL-Key Frames (4-Way Handshake)". Changes includes, 1. API to configure the IP addresses in supplicant for P2P GO to provide the IP address to client in EAPOL handshake. 2. Send the received IP address information to framework via p2p group started event. Bug: 170056953 Test: Manual - Establish P2P connection & confirmed from sniffer logs and logcat logs that IP addresse is allocated via EAPOL exchange. Ping works after connection. Change-Id: I2662fde9ca645aa5e34b21678d1a47cbf26ef3d3 --- .../wifi/supplicant/ISupplicantP2pIface.aidl | 1 + .../P2pClientEapolIpAddressInfo.aidl | 40 +++++++++++++++++++ .../P2pGroupStartedEventParams.aidl | 2 + .../wifi/supplicant/ISupplicantP2pIface.aidl | 18 +++++++++ .../P2pClientEapolIpAddressInfo.aidl | 38 ++++++++++++++++++ .../P2pGroupStartedEventParams.aidl | 16 ++++++++ 6 files changed, 115 insertions(+) create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pClientEapolIpAddressInfo.aidl create mode 100644 wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pClientEapolIpAddressInfo.aidl diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl index e204184a98..19e6728420 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl @@ -96,4 +96,5 @@ interface ISupplicantP2pIface { void findOnSocialChannels(in int timeoutInSec); void findOnSpecificFrequency(in int freqInHz, in int timeoutInSec); void setVendorElements(in android.hardware.wifi.supplicant.P2pFrameTypeMask frameTypeMask, in byte[] vendorElemBytes); + void configureEapolIpAddressAllocationParams(in int ipAddressGo, in int ipAddressMask, in int ipAddressStart, in int ipAddressEnd); } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pClientEapolIpAddressInfo.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pClientEapolIpAddressInfo.aidl new file mode 100644 index 0000000000..db31ca1d48 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pClientEapolIpAddressInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable P2pClientEapolIpAddressInfo { + int ipAddressClient; + int ipAddressMask; + int ipAddressGo; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl index 19611a9788..614b49e969 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl @@ -43,4 +43,6 @@ parcelable P2pGroupStartedEventParams { boolean isPersistent; byte[] goDeviceAddress; byte[] goInterfaceAddress; + boolean isP2pClientEapolIpAddressInfoPresent; + android.hardware.wifi.supplicant.P2pClientEapolIpAddressInfo p2pClientIpInfo; } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl index 313ee8b1ac..e58422c8ea 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl @@ -827,4 +827,22 @@ interface ISupplicantP2pIface { * |SupplicantStatusCode.FAILURE_IFACE_INVALID| */ void setVendorElements(in P2pFrameTypeMask frameTypeMask, in byte[] vendorElemBytes); + + /** + * Configure the IP addresses in supplicant for P2P GO to provide the IP address to + * client in EAPOL handshake. Refer Wi-Fi P2P Technical Specification v1.7 - Section 4.2.8 + * "IP Address Allocation in EAPOL-Key Frames (4-Way Handshake)" for more details. + * The IP addresses are IPV4 addresses and higher-order address bytes are in the lower-order + * int bytes (e.g. 1.2.3.4 is represented as 0x04030201) + * + * @param ipAddressGo The P2P Group Owner IP address. + * @param ipAddressMask The P2P Group owner subnet mask. + * @param ipAddressStart The starting address in the IP address pool. + * @param ipAddressEnd The ending address in the IP address pool. + * @throws ServiceSpecificException with one of the following values: + * |SupplicantStatusCode.FAILURE_UNKNOWN|, + * |SupplicantStatusCode.FAILURE_IFACE_INVALID| + */ + void configureEapolIpAddressAllocationParams( + in int ipAddressGo, in int ipAddressMask, in int ipAddressStart, in int ipAddressEnd); } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pClientEapolIpAddressInfo.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pClientEapolIpAddressInfo.aidl new file mode 100644 index 0000000000..148e4a4db0 --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pClientEapolIpAddressInfo.aidl @@ -0,0 +1,38 @@ +/* + * 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.hardware.wifi.supplicant; + +/** + * P2P Client IPV4 address allocated via EAPOL exchange. + * The IP addresses are IPV4 addresses and higher-order address bytes are in the lower-order + * int bytes (e.g. 1.2.3.4 is represented as 0x04030201) + */ +@VintfStability +parcelable P2pClientEapolIpAddressInfo { + /** + * The P2P Client IP address. + */ + int ipAddressClient; + /** + * The subnet that the P2P Group Owner is using. + */ + int ipAddressMask; + /** + * The P2P Group Owner IP address. + */ + int ipAddressGo; +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl index a04153a58c..ccd536cd7c 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl @@ -16,6 +16,8 @@ package android.hardware.wifi.supplicant; +import android.hardware.wifi.supplicant.P2pClientEapolIpAddressInfo; + /** * Parameters passed as part of Wifi P2P group start event. */ @@ -47,4 +49,18 @@ parcelable P2pGroupStartedEventParams { /** MAC Address of the P2P interface of the owner of this group. */ byte[/* 6 */] goInterfaceAddress; + + /** + * Flag to indicate that the P2P Client IP address is allocated via EAPOL exchange. + */ + boolean isP2pClientEapolIpAddressInfoPresent; + + /** + * The P2P Client IP Address allocated by the P2P Group Owner in EAPOL + * key exchange. + * Refer Wi-Fi P2P Technical Specification v1.7 - Section 4.2.8 + * "IP Address Allocation in EAPOL-Key Frames (4-Way Handshake)" for more details. + * The value is undefined if isP2pClientEapolIpAddressInfoPresent is false. + */ + P2pClientEapolIpAddressInfo p2pClientIpInfo; } From 63d52d1d597888a1be88df3b51be23c3767e3951 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Mon, 30 Jan 2023 12:35:10 -0800 Subject: [PATCH 681/998] Add HAL changes for WINDSHIELD_WIPERS_PERIOD Bug: 266986551 Test: atest VtsHalAutomotiveVehicle_TargetTest Test: atest CtsCarTestCases:CarPropertyManagerTest Test: atest CtsCarTestCases:VehiclePropertyIdsTest Test: atest CtsPermission2TestCases:PermissionPolicyTest Change-Id: Icf06bd00a55a46769d6cca9ecc37e31227e0e16a --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../config/DefaultProperties.json | 20 +++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 19 ++++++++++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 50 insertions(+) diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 68641ab617..719e553ab9 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -177,6 +177,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::WINDOW_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::WINDOW_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::WINDOW_LOCK, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::WINDSHIELD_WIPERS_PERIOD, VehiclePropertyAccess::READ}, {VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::STEERING_WHEEL_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 96105da51e..802c497beb 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -177,6 +177,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::WINDOW_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDOW_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDOW_LOCK, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::WINDSHIELD_WIPERS_PERIOD, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_HEIGHT_POS, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index e25af0f3cd..e4587d59c5 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -169,6 +169,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.WINDOW_LOCK, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.WINDSHIELD_WIPERS_PERIOD, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_POS, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 207f6c76bc..bc1258e050 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -169,6 +169,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.WINDOW_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDOW_LOCK, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.WINDSHIELD_WIPERS_PERIOD, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_POS, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index d9958966f1..31448307cb 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2648,6 +2648,26 @@ } ] }, + { + "property": "VehicleProperty::WINDSHIELD_WIPERS_PERIOD", + "defaultValue": { + "int32Values": [ + 0 + ] + }, + "areas": [ + { + "areaId": "VehicleAreaWindow::FRONT_WINDSHIELD", + "minInt32Value": 0, + "maxInt32Value": 3000 + }, + { + "areaId": "VehicleAreaWindow::REAR_WINDSHIELD", + "minInt32Value": 0, + "maxInt32Value": 3000 + } + ] + }, { "property": "VehicleProperty::STEERING_WHEEL_DEPTH_POS", "defaultValue": { diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 941c0ae78b..3251667ade 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -175,6 +175,7 @@ enum VehicleProperty { WINDOW_POS = (((0x0BC0 + 0x10000000) + 0x03000000) + 0x00400000) /* 322964416 */, WINDOW_MOVE = (((0x0BC1 + 0x10000000) + 0x03000000) + 0x00400000) /* 322964417 */, WINDOW_LOCK = (((0x0BC4 + 0x10000000) + 0x03000000) + 0x00200000) /* 320867268 */, + WINDSHIELD_WIPERS_PERIOD = (((0x0BC5 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.WINDOW) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 322964421 */, STEERING_WHEEL_DEPTH_POS = (((0x0BE0 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410016 */, STEERING_WHEEL_DEPTH_MOVE = (((0x0BE1 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410017 */, STEERING_WHEEL_HEIGHT_POS = (((0x0BE2 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410018 */, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 2d393e3802..f2459f6dc6 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -2091,6 +2091,25 @@ enum VehicleProperty { */ WINDOW_LOCK = 0x0BC4 + 0x10000000 + 0x03000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:WINDOW,VehiclePropertyType:BOOLEAN + /** + * Windshield wipers period (milliseconds). + * + * Returns the instantaneous time period for 1 full cycle of the windshield wipers in + * milliseconds. A full cycle is defined as a wiper moving from and returning to its rest + * position. + * + * When an intermittent wiper setting is selected, this property value must be set to 0 during + * the "pause" period of the intermittent wiping. + * + * The maxInt32Value for each area ID must specify the longest wiper period. The minInt32Value + * must be set to 0 for each area ID. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + */ + WINDSHIELD_WIPERS_PERIOD = + 0x0BC5 + VehiclePropertyGroup.SYSTEM + VehicleArea.WINDOW + VehiclePropertyType.INT32, + /** * Steering wheel depth position * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 57b57e9eaf..21dcb0b896 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -552,6 +552,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDoorChildLockEnabledConfig) { VehicleArea::DOOR, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyWindshieldWipersPeriodConfig) { + verifyProperty(VehicleProperty::WINDSHIELD_WIPERS_PERIOD, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::WINDOW, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelDepthPosConfig) { verifyProperty(VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From 732a1d77b0102c198f02f5d4076da23ea86a4a14 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Tue, 31 Jan 2023 10:25:45 -0800 Subject: [PATCH 682/998] Add HAL changes for WINDSHIELD_WIPERS_STATE Bug: 266985981 Test: atest VtsHalAutomotiveVehicle_TargetTest Test: atest CtsCarTestCases:CarPropertyManagerTest Test: atest CtsCarTestCases:VehiclePropertyIdsTest Test: atest CtsCarTestCases:WindshieldWipersStateTest Test: atest AndroidCarApiTest:WindshieldWipersStateTest Change-Id: I0c23d71f5d020886733ffebf8d11fe17172e3683 --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../JsonConfigLoader/src/JsonConfigLoader.cpp | 3 ++ .../config/DefaultProperties.json | 25 +++++++++++ .../aidl/impl/default_config/config/README.md | 2 + .../utils/common/include/VehicleHalTypes.h | 1 + .../automotive/vehicle/VehicleProperty.aidl | 1 + .../vehicle/WindshieldWipersState.aidl | 41 +++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 21 +++++++++ .../vehicle/WindshieldWipersState.aidl | 44 +++++++++++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 +++ 13 files changed, 148 insertions(+) create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/WindshieldWipersState.aidl create mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/WindshieldWipersState.aidl diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 719e553ab9..44f9d8b9c7 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -178,6 +178,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::WINDOW_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::WINDOW_LOCK, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::WINDSHIELD_WIPERS_PERIOD, VehiclePropertyAccess::READ}, + {VehicleProperty::WINDSHIELD_WIPERS_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::STEERING_WHEEL_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 802c497beb..ed97ec2a34 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -178,6 +178,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::WINDOW_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDOW_LOCK, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDSHIELD_WIPERS_PERIOD, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::WINDSHIELD_WIPERS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_HEIGHT_POS, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index e4587d59c5..94a0a7df32 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -170,6 +170,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.WINDOW_LOCK, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.WINDSHIELD_WIPERS_PERIOD, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.WINDSHIELD_WIPERS_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_POS, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index bc1258e050..26f33786c1 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -170,6 +170,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.WINDOW_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDOW_LOCK, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDSHIELD_WIPERS_PERIOD, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.WINDSHIELD_WIPERS_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_POS, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index aa8fd83e8c..5c9ecc1444 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -64,6 +64,7 @@ using ::aidl::android::hardware::automotive::vehicle::VehicleSeatOccupancyState; using ::aidl::android::hardware::automotive::vehicle::VehicleTurnSignal; using ::aidl::android::hardware::automotive::vehicle::VehicleUnit; using ::aidl::android::hardware::automotive::vehicle::VehicleVendorPermission; +using ::aidl::android::hardware::automotive::vehicle::WindshieldWipersState; using ::android::base::Error; using ::android::base::Result; @@ -212,6 +213,8 @@ JsonValueParser::JsonValueParser() { mConstantParsersByType["VehicleIgnitionState"] = std::make_unique>(); mConstantParsersByType["FuelType"] = std::make_unique>(); + mConstantParsersByType["WindshieldWipersState"] = + std::make_unique>(); mConstantParsersByType["ErrorState"] = std::make_unique>(); mConstantParsersByType["AutomaticEmergencyBrakingState"] = std::make_unique>(); diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 31448307cb..3bee63cb7c 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2668,6 +2668,31 @@ } ] }, + { + "property": "VehicleProperty::WINDSHIELD_WIPERS_STATE", + "defaultValue": { + "int32Values": [ + "WindshieldWipersState::OFF" + ] + }, + "areas": [ + { + "areaId": "VehicleAreaWindow::FRONT_WINDSHIELD", + "supportedEnumValues": [ + "WindshieldWipersState::OFF", + "WindshieldWipersState::ON", + "WindshieldWipersState::SERVICE" + ] + }, + { + "areaId": "VehicleAreaWindow::REAR_WINDSHIELD", + "supportedEnumValues": [ + "WindshieldWipersState::OFF", + "WindshieldWipersState::ON" + ] + } + ] + }, { "property": "VehicleProperty::STEERING_WHEEL_DEPTH_POS", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/default_config/config/README.md b/automotive/vehicle/aidl/impl/default_config/config/README.md index e04710105c..2b49ef33a1 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/README.md +++ b/automotive/vehicle/aidl/impl/default_config/config/README.md @@ -151,6 +151,8 @@ We support the following constant types: * ErrorState +* WindshieldWipersState + * Constants Every constant type except "Constants" corresponds to a enum defined in Vehicle diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index 0fc3215934..7b6f42aa32 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -73,5 +73,6 @@ #include #include #include +#include #endif // android_hardware_automotive_vehicle_aidl_impl_utils_common_include_VehicleHalTypes_H_ diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 3251667ade..51c3d4d508 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -176,6 +176,7 @@ enum VehicleProperty { WINDOW_MOVE = (((0x0BC1 + 0x10000000) + 0x03000000) + 0x00400000) /* 322964417 */, WINDOW_LOCK = (((0x0BC4 + 0x10000000) + 0x03000000) + 0x00200000) /* 320867268 */, WINDSHIELD_WIPERS_PERIOD = (((0x0BC5 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.WINDOW) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 322964421 */, + WINDSHIELD_WIPERS_STATE = (((0x0BC6 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.WINDOW) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 322964422 */, STEERING_WHEEL_DEPTH_POS = (((0x0BE0 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410016 */, STEERING_WHEEL_DEPTH_MOVE = (((0x0BE1 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410017 */, STEERING_WHEEL_HEIGHT_POS = (((0x0BE2 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410018 */, diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/WindshieldWipersState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/WindshieldWipersState.aidl new file mode 100644 index 0000000000..d0c1e8d70d --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/WindshieldWipersState.aidl @@ -0,0 +1,41 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum WindshieldWipersState { + OTHER = 0, + OFF = 1, + ON = 2, + SERVICE = 3, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index f2459f6dc6..d51934fd28 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -2110,6 +2110,27 @@ enum VehicleProperty { WINDSHIELD_WIPERS_PERIOD = 0x0BC5 + VehiclePropertyGroup.SYSTEM + VehicleArea.WINDOW + VehiclePropertyType.INT32, + /** + * Windshield wipers state. + * + * Returns the current state of the windshield wipers. The value of WINDSHIELD_WIPERS_STATE may + * not match the value of WINDSHIELD_WIPERS_SWITCH. (e.g. WINDSHIELD_WIPERS_STATE = ON and + * WINDSHIELD_WIPERS_SWITCH = WindshieldWipersSwitch#AUTO). + * + * If WINDSHIELD_WIPERS_STATE = ON and WINDSHIELD_WIPERS_PERIOD is implemented, then + * WINDSHIELD_WIPERS_PERIOD must reflect the time period of 1 full cycle of the wipers. + * + * For each supported area ID, the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states in WindshieldWipersState are supported (including OTHER, which is not + * recommended). + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum WindshieldWipersState + */ + WINDSHIELD_WIPERS_STATE = + 0x0BC6 + VehiclePropertyGroup.SYSTEM + VehicleArea.WINDOW + VehiclePropertyType.INT32, + /** * Steering wheel depth position * diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/WindshieldWipersState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/WindshieldWipersState.aidl new file mode 100644 index 0000000000..5873065261 --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/WindshieldWipersState.aidl @@ -0,0 +1,44 @@ +/* + * 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.hardware.automotive.vehicle; + +/** + * Used to enumerate the current state of VehicleProperty#WINDSHIELD_WIPERS_STATE. + */ +@VintfStability +@Backing(type="int") +enum WindshieldWipersState { + + /** + * This state is used as an alternative for any WindshieldWipersState value that is not defined + * in the platform. Ideally, implementations of VehicleProperty#WINDSHIELD_WIPERS_STATE should + * not use this state. The framework can use this field to remain backwards compatible if + * WindshieldWipersState is extended to include additional states. + */ + OTHER = 0, + OFF = 1, + /** + * This state indicates windshield wipers are currently on. If + * VehicleProperty#WINDSHIELD_WIPERS_SWITCH is implemented, then it may be set to any of the + * following modes: MIST, INTERMITTENT_LEVEL_*, CONTINUOUS_LEVEL_*, or AUTO. + */ + ON = 2, + /** + * Windshield wipers are in the service mode. + */ + SERVICE = 3, +} diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 21dcb0b896..e2c2d00b22 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -558,6 +558,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyWindshieldWipersPeriodConfig) { VehicleArea::WINDOW, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyWindshieldWipersStateConfig) { + verifyProperty(VehicleProperty::WINDSHIELD_WIPERS_STATE, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::WINDOW, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelDepthPosConfig) { verifyProperty(VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From dfd6fb219f5e7db430d9fab2a8727713c4353615 Mon Sep 17 00:00:00 2001 From: Rongxuan Liu Date: Thu, 26 Jan 2023 17:16:20 +0000 Subject: [PATCH 683/998] Update android.hardware.bluetooth.audio to V3 Tag: #feature Bug: 266740545 Test: m android.hardware.bluetooth.audio-update-api && atest VtsHalBluetoothAudioTargetTest Change-Id: Ia92043aeedf12a8c68d7f4ee18a1dd52ac5a252f --- bluetooth/audio/aidl/default/Android.bp | 2 +- bluetooth/audio/aidl/default/bluetooth_audio.xml | 2 +- bluetooth/audio/aidl/vts/Android.bp | 2 +- bluetooth/audio/utils/Android.bp | 4 ++-- compatibility_matrices/compatibility_matrix.8.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bluetooth/audio/aidl/default/Android.bp b/bluetooth/audio/aidl/default/Android.bp index cbf23dce46..e4c2844ca0 100644 --- a/bluetooth/audio/aidl/default/Android.bp +++ b/bluetooth/audio/aidl/default/Android.bp @@ -29,7 +29,7 @@ cc_library_shared { "libcutils", "libfmq", "liblog", - "android.hardware.bluetooth.audio-V2-ndk", + "android.hardware.bluetooth.audio-V3-ndk", "libbluetooth_audio_session_aidl", ], } diff --git a/bluetooth/audio/aidl/default/bluetooth_audio.xml b/bluetooth/audio/aidl/default/bluetooth_audio.xml index c4b1872333..c0bc55e2f7 100644 --- a/bluetooth/audio/aidl/default/bluetooth_audio.xml +++ b/bluetooth/audio/aidl/default/bluetooth_audio.xml @@ -1,7 +1,7 @@ android.hardware.bluetooth.audio - 2 + 3 IBluetoothAudioProviderFactory/default diff --git a/bluetooth/audio/aidl/vts/Android.bp b/bluetooth/audio/aidl/vts/Android.bp index 3aed1b38ff..e03fb5873d 100644 --- a/bluetooth/audio/aidl/vts/Android.bp +++ b/bluetooth/audio/aidl/vts/Android.bp @@ -17,7 +17,7 @@ cc_test { srcs: ["VtsHalBluetoothAudioTargetTest.cpp"], shared_libs: [ "android.hardware.audio.common-V1-ndk", - "android.hardware.bluetooth.audio-V2-ndk", + "android.hardware.bluetooth.audio-V3-ndk", "android.hardware.common-V2-ndk", "android.hardware.common.fmq-V1-ndk", "libbase", diff --git a/bluetooth/audio/utils/Android.bp b/bluetooth/audio/utils/Android.bp index 70797a7aaf..914d2b2fd3 100644 --- a/bluetooth/audio/utils/Android.bp +++ b/bluetooth/audio/utils/Android.bp @@ -55,7 +55,7 @@ cc_library_shared { "libbinder_ndk", "libfmq", "liblog", - "android.hardware.bluetooth.audio-V2-ndk", + "android.hardware.bluetooth.audio-V3-ndk", "libhidlbase", "libxml2", ], @@ -75,7 +75,7 @@ cc_test { shared_libs: [ "libbase", "libbinder_ndk", - "android.hardware.bluetooth.audio-V2-ndk", + "android.hardware.bluetooth.audio-V3-ndk", "libxml2", ], test_suites: [ diff --git a/compatibility_matrices/compatibility_matrix.8.xml b/compatibility_matrices/compatibility_matrix.8.xml index 56ae51adea..c9cf6ef471 100644 --- a/compatibility_matrices/compatibility_matrix.8.xml +++ b/compatibility_matrices/compatibility_matrix.8.xml @@ -149,7 +149,7 @@ android.hardware.bluetooth.audio - 2 + 3 IBluetoothAudioProviderFactory default From c13d0d61e1080c2e455a5f38f7cb9d04a9ef7c1c Mon Sep 17 00:00:00 2001 From: Muralidhar Reddy Date: Wed, 18 Jan 2023 18:45:14 +0000 Subject: [PATCH 684/998] Add new API for iccCloseLogicalChannel to pass isEs10 information. When a common logical channel ID is opened over 2 or more LSIs(including command port LSI), there is an ambiguity in closing the logical channel. To resolve the ambiguity, pass isEs10 information about whether the logical channel was opened to send ES10 commands or not. Test: Build Bug: 268496310 Change-Id: I3e4f386b2a4f88d6e8bcc552d5ef1f404a8f9127 --- .../android/hardware/radio/sim/IRadioSim.aidl | 4 ++ .../hardware/radio/sim/IRadioSimResponse.aidl | 4 ++ .../hardware/radio/sim/SessionInfo.aidl | 39 +++++++++++++++++++ .../android/hardware/radio/sim/IRadioSim.aidl | 18 +++++++++ .../hardware/radio/sim/IRadioSimResponse.aidl | 15 +++++++ .../hardware/radio/sim/SessionInfo.aidl | 30 ++++++++++++++ .../include/libradiocompat/RadioSim.h | 2 + .../compat/libradiocompat/sim/RadioSim.cpp | 9 ++++- radio/aidl/vts/radio_sim_response.cpp | 7 ++++ radio/aidl/vts/radio_sim_test.cpp | 21 ++++++++++ radio/aidl/vts/radio_sim_utils.h | 3 ++ 11 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SessionInfo.aidl create mode 100644 radio/aidl/android/hardware/radio/sim/SessionInfo.aidl diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSim.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSim.aidl index 85a0c710d8..901b2519f6 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSim.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSim.aidl @@ -46,6 +46,9 @@ interface IRadioSim { oneway void getImsiForApp(in int serial, in String aid); oneway void getSimPhonebookCapacity(in int serial); oneway void getSimPhonebookRecords(in int serial); + /** + * @deprecated use iccCloseLogicalChannelWithSessionInfo instead. + */ oneway void iccCloseLogicalChannel(in int serial, in int channelId); oneway void iccIoForApp(in int serial, in android.hardware.radio.sim.IccIo iccIo); oneway void iccOpenLogicalChannel(in int serial, in String aid, in int p2); @@ -70,4 +73,5 @@ interface IRadioSim { oneway void supplyIccPukForApp(in int serial, in String puk, in String pin, in String aid); oneway void supplySimDepersonalization(in int serial, in android.hardware.radio.sim.PersoSubstate persoType, in String controlKey); oneway void updateSimPhonebookRecords(in int serial, in android.hardware.radio.sim.PhonebookRecordInfo recordInfo); + oneway void iccCloseLogicalChannelWithSessionInfo(in int serial, in android.hardware.radio.sim.SessionInfo sessionInfo); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSimResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSimResponse.aidl index 8e68e3042d..d7c2100fd6 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSimResponse.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/IRadioSimResponse.aidl @@ -47,6 +47,9 @@ interface IRadioSimResponse { oneway void getImsiForAppResponse(in android.hardware.radio.RadioResponseInfo info, in String imsi); oneway void getSimPhonebookCapacityResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.PhonebookCapacity capacity); oneway void getSimPhonebookRecordsResponse(in android.hardware.radio.RadioResponseInfo info); + /** + * @deprecated use iccCloseLogicalChannelWithSessionInfoResponse instead. + */ oneway void iccCloseLogicalChannelResponse(in android.hardware.radio.RadioResponseInfo info); oneway void iccIoForAppResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.IccIoResult iccIo); oneway void iccOpenLogicalChannelResponse(in android.hardware.radio.RadioResponseInfo info, in int channelId, in byte[] selectResponse); @@ -69,4 +72,5 @@ interface IRadioSimResponse { oneway void supplyIccPukForAppResponse(in android.hardware.radio.RadioResponseInfo info, in int remainingRetries); oneway void supplySimDepersonalizationResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.PersoSubstate persoType, in int remainingRetries); oneway void updateSimPhonebookRecordsResponse(in android.hardware.radio.RadioResponseInfo info, in int updatedRecordIndex); + oneway void iccCloseLogicalChannelWithSessionInfoResponse(in android.hardware.radio.RadioResponseInfo info); } diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SessionInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SessionInfo.aidl new file mode 100644 index 0000000000..1329141f22 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/SessionInfo.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.hardware.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable SessionInfo { + int sessionId; + boolean isEs10 = false; +} diff --git a/radio/aidl/android/hardware/radio/sim/IRadioSim.aidl b/radio/aidl/android/hardware/radio/sim/IRadioSim.aidl index 7923b142f6..3823a718b5 100644 --- a/radio/aidl/android/hardware/radio/sim/IRadioSim.aidl +++ b/radio/aidl/android/hardware/radio/sim/IRadioSim.aidl @@ -26,6 +26,7 @@ import android.hardware.radio.sim.ImsiEncryptionInfo; import android.hardware.radio.sim.PersoSubstate; import android.hardware.radio.sim.PhonebookRecordInfo; import android.hardware.radio.sim.SelectUiccSub; +import android.hardware.radio.sim.SessionInfo; import android.hardware.radio.sim.SimApdu; import android.hardware.radio.sim.SimLockMultiSimPolicy; @@ -184,6 +185,8 @@ oneway interface IRadioSim { * @param channelId session id of the logical channel (+CCHC). * * Response function is IRadioSimResponse.iccCloseLogicalChannelResponse() + * + * @deprecated use iccCloseLogicalChannelWithSessionInfo instead. */ void iccCloseLogicalChannel(in int serial, in int channelId); @@ -494,4 +497,19 @@ oneway interface IRadioSim { * Response function is IRadioSimResponse.updateSimPhonebookRecordsResponse() */ void updateSimPhonebookRecords(in int serial, in PhonebookRecordInfo recordInfo); + + /** + * Close a previously opened logical channel. This command reflects TS 27.007 + * "close logical channel" operation (+CCHC). + * + * Per spec SGP.22 V3.0, ES10 commands needs to be sent over command port of MEP-A. In order + * to close proper logical channel, should pass information about whether the logical channel + * was opened for sending ES10 commands or not. + * + * @param serial Serial number of request. + * @param sessionInfo Details of the opened logical channel info like sessionId and isEs10. + * + * Response function is IRadioSimResponse.iccCloseLogicalChannelWithSessionInfoResponse() + */ + void iccCloseLogicalChannelWithSessionInfo(in int serial, in SessionInfo sessionInfo); } diff --git a/radio/aidl/android/hardware/radio/sim/IRadioSimResponse.aidl b/radio/aidl/android/hardware/radio/sim/IRadioSimResponse.aidl index b3df504132..90f172f802 100644 --- a/radio/aidl/android/hardware/radio/sim/IRadioSimResponse.aidl +++ b/radio/aidl/android/hardware/radio/sim/IRadioSimResponse.aidl @@ -241,6 +241,8 @@ oneway interface IRadioSimResponse { * RadioError:NO_MEMORY * RadioError:NO_RESOURCES * RadioError:CANCELLED + * + * @deprecated use iccCloseLogicalChannelWithSessionInfoResponse instead. */ void iccCloseLogicalChannelResponse(in RadioResponseInfo info); @@ -591,4 +593,17 @@ oneway interface IRadioSimResponse { * RadioError:NO_RESOURCES */ void updateSimPhonebookRecordsResponse(in RadioResponseInfo info, in int updatedRecordIndex); + + /** + * @param info Response info struct containing response type, serial no. and error + * + * Valid errors returned: + * RadioError:NONE + * RadioError:RADIO_NOT_AVAILABLE + * RadioError:INTERNAL_ERR + * RadioError:NO_MEMORY + * RadioError:NO_RESOURCES + * RadioError:CANCELLED + */ + void iccCloseLogicalChannelWithSessionInfoResponse(in RadioResponseInfo info); } diff --git a/radio/aidl/android/hardware/radio/sim/SessionInfo.aidl b/radio/aidl/android/hardware/radio/sim/SessionInfo.aidl new file mode 100644 index 0000000000..9e3e8ed04d --- /dev/null +++ b/radio/aidl/android/hardware/radio/sim/SessionInfo.aidl @@ -0,0 +1,30 @@ +/* + * 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.hardware.radio.sim; + +@VintfStability +@JavaDerive(toString=true) +parcelable SessionInfo { + /** + * Session id of the logical channel from TS 27.007 (+CCHC). + */ + int sessionId; + /** + * Whether the logical channel was opened for sending ES10 commands. + */ + boolean isEs10 = false; +} diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioSim.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioSim.h index ff91aef5fa..f12e5328f3 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioSim.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioSim.h @@ -41,6 +41,8 @@ class RadioSim : public RadioCompatBase, public aidl::android::hardware::radio:: ::ndk::ScopedAStatus getSimPhonebookCapacity(int32_t serial) override; ::ndk::ScopedAStatus getSimPhonebookRecords(int32_t serial) override; ::ndk::ScopedAStatus iccCloseLogicalChannel(int32_t serial, int32_t channelId) override; + ::ndk::ScopedAStatus iccCloseLogicalChannelWithSessionInfo(int32_t serial, + const ::aidl::android::hardware::radio::sim::SessionInfo& recordInfo) override; ::ndk::ScopedAStatus iccIoForApp( int32_t serial, const ::aidl::android::hardware::radio::sim::IccIo& iccIo) override; ::ndk::ScopedAStatus iccOpenLogicalChannel(int32_t serial, const std::string& aid, diff --git a/radio/aidl/compat/libradiocompat/sim/RadioSim.cpp b/radio/aidl/compat/libradiocompat/sim/RadioSim.cpp index b43f64f784..490b07b9f9 100644 --- a/radio/aidl/compat/libradiocompat/sim/RadioSim.cpp +++ b/radio/aidl/compat/libradiocompat/sim/RadioSim.cpp @@ -124,6 +124,14 @@ ScopedAStatus RadioSim::iccCloseLogicalChannel(int32_t serial, int32_t channelId return ok(); } +ScopedAStatus RadioSim::iccCloseLogicalChannelWithSessionInfo(int32_t serial, + const aidl::SessionInfo& /*SessionInfo*/) { + LOG_CALL << serial; + LOG(ERROR) << " iccCloseLogicalChannelWithSessionInfo is unsupported by HIDL HALs"; + respond()->iccCloseLogicalChannelWithSessionInfoResponse(notSupported(serial)); + return ok(); +} + ScopedAStatus RadioSim::iccIoForApp(int32_t serial, const aidl::IccIo& iccIo) { LOG_CALL << serial; mHal1_5->iccIOForApp(serial, toHidl(iccIo)); @@ -289,5 +297,4 @@ ScopedAStatus RadioSim::updateSimPhonebookRecords(int32_t serial, } return ok(); } - } // namespace android::hardware::radio::compat diff --git a/radio/aidl/vts/radio_sim_response.cpp b/radio/aidl/vts/radio_sim_response.cpp index 391c9cb12d..296c65cab8 100644 --- a/radio/aidl/vts/radio_sim_response.cpp +++ b/radio/aidl/vts/radio_sim_response.cpp @@ -118,6 +118,13 @@ ndk::ScopedAStatus RadioSimResponse::iccCloseLogicalChannelResponse(const RadioR return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus RadioSimResponse::iccCloseLogicalChannelWithSessionInfoResponse( + const RadioResponseInfo& info) { + rspInfo = info; + parent_sim.notify(info.serial); + return ndk::ScopedAStatus::ok(); +} + ndk::ScopedAStatus RadioSimResponse::iccIoForAppResponse(const RadioResponseInfo& info, const IccIoResult& /*iccIo*/) { rspInfo = info; diff --git a/radio/aidl/vts/radio_sim_test.cpp b/radio/aidl/vts/radio_sim_test.cpp index e69247d135..44be258039 100644 --- a/radio/aidl/vts/radio_sim_test.cpp +++ b/radio/aidl/vts/radio_sim_test.cpp @@ -761,6 +761,27 @@ TEST_P(RadioSimTest, iccCloseLogicalChannel) { LOG(DEBUG) << "iccCloseLogicalChannel finished"; } +/* + * Test IRadioSim.iccCloseLogicalChannelWithSessionInfo() for the response returned. + */ +TEST_P(RadioSimTest, iccCloseLogicalChannelWithSessionInfo) { + LOG(DEBUG) << "iccCloseLogicalChannelWithSessionInfo"; + serial = GetRandomSerialNumber(); + SessionInfo info; + memset(&info, 0, sizeof(info)); + info.sessionId = 0; + info.isEs10 = false; + + // Try closing invalid channel and check INVALID_ARGUMENTS returned as error + radio_sim->iccCloseLogicalChannelWithSessionInfo(serial, info); + EXPECT_EQ(std::cv_status::no_timeout, wait()); + EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type); + EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial); + + EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp_sim->rspInfo.error); + LOG(DEBUG) << "iccCloseLogicalChannelWithSessionInfo finished"; +} + /* * Test IRadioSim.iccTransmitApduLogicalChannel() for the response returned. */ diff --git a/radio/aidl/vts/radio_sim_utils.h b/radio/aidl/vts/radio_sim_utils.h index 83f1cbc1ae..71c7eb82c1 100644 --- a/radio/aidl/vts/radio_sim_utils.h +++ b/radio/aidl/vts/radio_sim_utils.h @@ -87,6 +87,9 @@ class RadioSimResponse : public BnRadioSimResponse { virtual ndk::ScopedAStatus iccCloseLogicalChannelResponse( const RadioResponseInfo& info) override; + virtual ndk::ScopedAStatus iccCloseLogicalChannelWithSessionInfoResponse( + const RadioResponseInfo& info) override; + virtual ndk::ScopedAStatus iccIoForAppResponse(const RadioResponseInfo& info, const IccIoResult& iccIo) override; From 38ca03860836e3aa550f2af0aafdebf024779426 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Tue, 10 Jan 2023 17:36:42 -0800 Subject: [PATCH 685/998] Update LANE_KEEP_ASSIST_ENABLED documentation in HAL Temporary errors should be conveyed through ErrorState values in the STATE property. Bug: 264946157 Test: presubmit Change-Id: I1ac2d570ff47efb879acdef110e9775baf6cea4b --- .../android/hardware/automotive/vehicle/VehicleProperty.aidl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 2d393e3802..8f52d850af 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3595,6 +3595,11 @@ enum VehicleProperty { * This is different from Lane Centering Assist (LCA) which, when activated, applies continuous * steering control to keep the vehicle centered in the current lane. * + * In general, LANE_KEEP_ASSIST_ENABLED should always return true or false. If the feature is + * not available due to some temporary state, such as the vehicle speed being too low or too + * high, that information must be conveyed through the ErrorState values in the + * LANE_KEEP_ASSIST_STATE property. + * * This property is defined as read_write, but OEMs have the option to implement it as read * only. * From db03444d5a26ac184d5b3c2eb38c1f5aa2196358 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Tue, 10 Jan 2023 18:14:28 -0800 Subject: [PATCH 686/998] Add HAL changes for LANE_CENTERING_ASSIST_STATE This property supports error states in addition to its own state. This is why the comments mention two @data_enums for this property. This works because states are integer values so as long as all states have distinct integer values, this functions correctly. Bug: 264946042 Test: atest VtsHalAutomotiveVehicle_TargetTest Test: atest CtsCarTestCases:CarPropertyManagerTest Test: atest CtsCarTestCases:VehiclePropertyIdsTest Test: atest CtsCarTestCases:LaneCenteringAssistStateTest Test: atest AndroidCarApiTest:LaneCenteringAssistStateTest Change-Id: I3f805bedff35eef2731a7d9fc0bec593e3c639a3 --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../JsonConfigLoader/src/JsonConfigLoader.cpp | 3 + .../config/DefaultProperties.json | 26 ++++++- .../aidl/impl/default_config/config/README.md | 2 + .../utils/common/include/VehicleHalTypes.h | 1 + .../vehicle/LaneCenteringAssistState.aidl | 43 ++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../vehicle/LaneCenteringAssistState.aidl | 70 +++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 22 ++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++ 13 files changed, 177 insertions(+), 1 deletion(-) create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LaneCenteringAssistState.aidl create mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LaneCenteringAssistState.aidl diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 68641ab617..e488951ce1 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -250,6 +250,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::LANE_CENTERING_ASSIST_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 96105da51e..133e7a9d22 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -250,6 +250,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_KEEP_ASSIST_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::LANE_CENTERING_ASSIST_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index e25af0f3cd..4f072cf478 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -242,6 +242,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 207f6c76bc..23015035ef 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -242,6 +242,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_KEEP_ASSIST_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index aa8fd83e8c..9bf575014e 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -45,6 +45,7 @@ using ::aidl::android::hardware::automotive::vehicle::EvsServiceType; using ::aidl::android::hardware::automotive::vehicle::ForwardCollisionWarningState; using ::aidl::android::hardware::automotive::vehicle::FuelType; using ::aidl::android::hardware::automotive::vehicle::GsrComplianceRequirementType; +using ::aidl::android::hardware::automotive::vehicle::LaneCenteringAssistState; using ::aidl::android::hardware::automotive::vehicle::LaneKeepAssistState; using ::aidl::android::hardware::automotive::vehicle::RawPropValues; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport; @@ -221,6 +222,8 @@ JsonValueParser::JsonValueParser() { std::make_unique>(); mConstantParsersByType["LaneKeepAssistState"] = std::make_unique>(); + mConstantParsersByType["LaneCenteringAssistState"] = + std::make_unique>(); mConstantParsersByType["Constants"] = std::make_unique(); } diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index d9958966f1..da9eaaffe0 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3288,9 +3288,33 @@ "property": "VehicleProperty::LANE_CENTERING_ASSIST_ENABLED", "defaultValue": { "int32Values": [ - 0 + 1 ] } + }, + { + "property": "VehicleProperty::LANE_CENTERING_ASSIST_STATE", + "defaultValue": { + "int32Values": [ + "LaneCenteringAssistState::ENABLED" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "ErrorState::NOT_AVAILABLE_SAFETY", + "ErrorState::NOT_AVAILABLE_SPEED_HIGH", + "ErrorState::NOT_AVAILABLE_SPEED_LOW", + "ErrorState::NOT_AVAILABLE_DISABLED", + "LaneCenteringAssistState::ENABLED", + "LaneCenteringAssistState::ACTIVATION_REQUESTED", + "LaneCenteringAssistState::ACTIVATED", + "LaneCenteringAssistState::USER_OVERRIDE", + "LaneCenteringAssistState::FORCED_DEACTIVATION_WARNING" + ] + } + ] } ] } diff --git a/automotive/vehicle/aidl/impl/default_config/config/README.md b/automotive/vehicle/aidl/impl/default_config/config/README.md index e04710105c..6f0785f695 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/README.md +++ b/automotive/vehicle/aidl/impl/default_config/config/README.md @@ -149,6 +149,8 @@ We support the following constant types: * LaneKeepAssistState +* LaneCenteringAssistState + * ErrorState * Constants diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index 0fc3215934..950b3a061c 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LaneCenteringAssistState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LaneCenteringAssistState.aidl new file mode 100644 index 0000000000..c5afe2be1a --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LaneCenteringAssistState.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum LaneCenteringAssistState { + OTHER = 0, + ENABLED = 1, + ACTIVATION_REQUESTED = 2, + ACTIVATED = 3, + USER_OVERRIDE = 4, + FORCED_DEACTIVATION_WARNING = 5, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 941c0ae78b..930fbd853c 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -248,6 +248,7 @@ enum VehicleProperty { LANE_KEEP_ASSIST_ENABLED = (((0x1008 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313928 */, LANE_KEEP_ASSIST_STATE = (((0x1009 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411081 */, LANE_CENTERING_ASSIST_ENABLED = (((0x100A + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313930 */, + LANE_CENTERING_ASSIST_STATE = (((0x100C + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411084 */, EMERGENCY_LANE_KEEP_ASSIST_ENABLED = (((0x100D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313933 */, ADAPTIVE_CRUISE_CONTROL_ENABLED = (((0x100F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313935 */, HANDS_ON_DETECTION_ENABLED = (((0x1016 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313942 */, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LaneCenteringAssistState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LaneCenteringAssistState.aidl new file mode 100644 index 0000000000..340a669d2d --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LaneCenteringAssistState.aidl @@ -0,0 +1,70 @@ +/* + * 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.hardware.automotive.vehicle; + +/** + * Used to enumerate the state of Lane Centering Assist (LCA). + */ +@VintfStability +@Backing(type="int") +enum LaneCenteringAssistState { + + /** + * This state is used as an alternative for any LaneCenteringAssistState value that is not + * defined in the platform. Ideally, implementations of + * VehicleProperty#LANE_CENTERING_ASSIST_STATE should not use this state. The framework + * can use this field to remain backwards compatible if LaneCenteringAssistState is + * extended to include additional states. + */ + OTHER = 0, + /** + * LCA is enabled but the ADAS system has not received an activation signal from the driver. + * Therefore, LCA is not steering the car and waits for the driver to send a + * LaneCenteringAssistCommand#ACTIVATE command. + */ + ENABLED = 1, + /** + * LCA is enabled and the driver has sent an activation command to the LCA system, but the + * system has not started actively steering the vehicle. This may happen when LCA needs time to + * detect valid lane lines. The activation command can be sent through the + * VehicleProperty#LANE_CENTERING_ASSIST_COMMAND vehicle property or through a system external + * to Android. Once LCA is actively steering the vehicle, the state must be updated to + * ACTIVATED. If the feature is not able to activate, then the cause can be communicated through + * the ErrorState values and then return to the ENABLED state. + */ + ACTIVATION_REQUESTED = 2, + /** + * LCA is enabled and actively steering the car to keep it centered in its lane. + */ + ACTIVATED = 3, + /** + * Many LCA implementations allow the driver to override LCA. This means that the car has + * determined it should go a certain direction to keep the car centered in the lane, but a user + * decides to take over and do something else. This is often done for safety reasons and to + * ensure that the driver can always take control of the vehicle. This state should be set when + * the user is actively overriding the LCA system. + */ + USER_OVERRIDE = 4, + /** + * When LCA is in the ACTIVATED state but it will potentially need to deactivate because of + * external conditions (e.g. roads curvature is too extreme, the driver does not have their + * hands on the steering wheel for a long period of time, or the driver is not paying + * attention), then the ADAS system will notify the driver of a potential need to deactivate and + * give control back to the driver. + */ + FORCED_DEACTIVATION_WARNING = 5, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 8f52d850af..400c1cee77 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3652,6 +3652,28 @@ enum VehicleProperty { LANE_CENTERING_ASSIST_ENABLED = 0x100A + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Lane Centering Assist (LCA) state. + * + * Returns the current state of LCA. This property must always return a valid state defined in + * LaneCenteringAssistState or ErrorState. It must not surface errors through StatusCode + * and must use the supported error states instead. + * + * If LCA includes lane departure warnings, those warnings must be surfaced through the Lane + * Departure Warning (LDW) properties. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of both LaneCenteringAssistState (including OTHER, which is not + * recommended) and ErrorState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum LaneCenteringAssistState + * @data_enum ErrorState + */ + LANE_CENTERING_ASSIST_STATE = + 0x100C + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /* * Enable or disable emergency lane keep assist (ELKA). * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 57b57e9eaf..0215907412 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -738,6 +738,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistEnabledConfig VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistStateConfig) { + verifyProperty(VehicleProperty::LANE_CENTERING_ASSIST_STATE, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + std::vector getDescriptors() { std::vector descriptors; for (std::string name : getAidlHalInstanceNames(IVehicle::descriptor)) { From f5b63fcf1380dfce3b2eef788b9d939297cd69f0 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Tue, 10 Jan 2023 18:19:38 -0800 Subject: [PATCH 687/998] Update LANE_CENTERING_ASSIST_ENABLED documentation in HAL Temporary errors should be conveyed through ErrorState values in the STATE property. Bug: 264946042 Test: presubmit Change-Id: Idfd427fb69948f81307c29acd6285826e2cada99 --- .../android/hardware/automotive/vehicle/VehicleProperty.aidl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 400c1cee77..d8ffecec00 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3643,6 +3643,11 @@ enum VehicleProperty { * drifts toward or over the lane marking. If an unintentional lane departure is detected, the * system applies steering control to return the vehicle into the current lane. * + * In general, LANE_CENTERING_ASSIST_ENABLED should always return true or false. If the feature + * is not available due to some temporary state, such as the vehicle speed being too low or too + * high, that information must be conveyed through the ErrorState values in the + * LANE_CENTERING_ASSIST_STATE property. + * * This property is defined as read_write, but OEMs have the option to implement it as read * only. * From 0ffd39c1e40d85e7c19fae713de602cf4cba42db Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Wed, 11 Jan 2023 12:19:10 -0800 Subject: [PATCH 688/998] Add HAL changes for LANE_CENTERING_ASSIST_COMMAND Bug: 264946354 Test: atest VtsHalAutomotiveVehicle_TargetTest Test: atest CtsCarTestCases:CarPropertyManagerTest Test: atest CtsCarTestCases:VehiclePropertyIdsTest Test: atest CtsCarTestCases:LaneCenteringAssistCommandTest Test: atest AndroidCarApiTest:LaneCenteringAssistCommandTest Change-Id: I126ed24748f9ef7cd9bc0541e2bdbf75eac43edf --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../JsonConfigLoader/src/JsonConfigLoader.cpp | 3 ++ .../config/DefaultProperties.json | 3 ++ .../aidl/impl/default_config/config/README.md | 2 + .../utils/common/include/VehicleHalTypes.h | 1 + .../vehicle/LaneCenteringAssistCommand.aidl | 39 ++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../vehicle/LaneCenteringAssistCommand.aidl | 44 +++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 24 ++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 +++ 13 files changed, 127 insertions(+) create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LaneCenteringAssistCommand.aidl create mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LaneCenteringAssistCommand.aidl diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index e488951ce1..da10cf4d15 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -250,6 +250,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyAccess::WRITE}, {VehicleProperty::LANE_CENTERING_ASSIST_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 133e7a9d22..f1e941266e 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -250,6 +250,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_KEEP_ASSIST_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_CENTERING_ASSIST_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 4f072cf478..10facb57c0 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -242,6 +242,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyAccess.WRITE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 23015035ef..bcc4b92488 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -242,6 +242,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_KEEP_ASSIST_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index 9bf575014e..943cf88fab 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -45,6 +45,7 @@ using ::aidl::android::hardware::automotive::vehicle::EvsServiceType; using ::aidl::android::hardware::automotive::vehicle::ForwardCollisionWarningState; using ::aidl::android::hardware::automotive::vehicle::FuelType; using ::aidl::android::hardware::automotive::vehicle::GsrComplianceRequirementType; +using ::aidl::android::hardware::automotive::vehicle::LaneCenteringAssistCommand; using ::aidl::android::hardware::automotive::vehicle::LaneCenteringAssistState; using ::aidl::android::hardware::automotive::vehicle::LaneKeepAssistState; using ::aidl::android::hardware::automotive::vehicle::RawPropValues; @@ -222,6 +223,8 @@ JsonValueParser::JsonValueParser() { std::make_unique>(); mConstantParsersByType["LaneKeepAssistState"] = std::make_unique>(); + mConstantParsersByType["LaneCenteringAssistCommand"] = + std::make_unique>(); mConstantParsersByType["LaneCenteringAssistState"] = std::make_unique>(); mConstantParsersByType["Constants"] = std::make_unique(); diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index da9eaaffe0..cde7bab17a 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3292,6 +3292,9 @@ ] } }, + { + "property": "VehicleProperty::LANE_CENTERING_ASSIST_COMMAND" + }, { "property": "VehicleProperty::LANE_CENTERING_ASSIST_STATE", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/default_config/config/README.md b/automotive/vehicle/aidl/impl/default_config/config/README.md index 6f0785f695..360018fc1e 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/README.md +++ b/automotive/vehicle/aidl/impl/default_config/config/README.md @@ -149,6 +149,8 @@ We support the following constant types: * LaneKeepAssistState +* LaneCenteringAssistCommand + * LaneCenteringAssistState * ErrorState diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index 950b3a061c..bba3242754 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LaneCenteringAssistCommand.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LaneCenteringAssistCommand.aidl new file mode 100644 index 0000000000..9e726052e8 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LaneCenteringAssistCommand.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum LaneCenteringAssistCommand { + ACTIVATE = 1, + DEACTIVATE = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 930fbd853c..51a3d187d4 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -248,6 +248,7 @@ enum VehicleProperty { LANE_KEEP_ASSIST_ENABLED = (((0x1008 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313928 */, LANE_KEEP_ASSIST_STATE = (((0x1009 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411081 */, LANE_CENTERING_ASSIST_ENABLED = (((0x100A + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313930 */, + LANE_CENTERING_ASSIST_COMMAND = (((0x100B + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411083 */, LANE_CENTERING_ASSIST_STATE = (((0x100C + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411084 */, EMERGENCY_LANE_KEEP_ASSIST_ENABLED = (((0x100D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313933 */, ADAPTIVE_CRUISE_CONTROL_ENABLED = (((0x100F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313935 */, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LaneCenteringAssistCommand.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LaneCenteringAssistCommand.aidl new file mode 100644 index 0000000000..d8b0e65857 --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LaneCenteringAssistCommand.aidl @@ -0,0 +1,44 @@ +/* + * 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.hardware.automotive.vehicle; + +/** + * Used by Lane Centering Assist (LCA) to enumerate commands. + */ +@VintfStability +@Backing(type="int") +enum LaneCenteringAssistCommand { + /** + * When VehicleProperty#LANE_CENTERING_ASSIST_STATE = LaneCenteringAssistState#ENABLED, this + * command sends a request to activate steering control that keeps the vehicle centered in its + * lane. While waiting for the LCA System to take control of the vehicle, + * VehicleProperty#LANE_CENTERING_ASSIST_STATE must be in the + * LaneCenteringAssistState#ACTIVATION_REQUESTED state. Once the vehicle takes control of + * steering, then VehicleProperty#LANE_CENTERING_ASSIST_STATE must be in the + * LaneCenteringAssistState#ACTIVATED state. Otherwise, an error can be communicated through an + * ErrorState value. + */ + ACTIVATE = 1, + /** + * When VehicleProperty#LANE_CENTERING_ASSIST_STATE is set to + * LaneCenteringAssistState#ACTIVATION_REQUESTED or LaneCenteringAssistState#ACTIVATED, this + * command deactivates steering control and the driver should take full control of the vehicle. + * If this command succeeds, VehicleProperty#LANE_CENTERING_ASSIST_STATE must be updated to + * LaneCenteringAssistState#ENABLED. + */ + DEACTIVATE = 2, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index d8ffecec00..2f8c41b8d9 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3657,6 +3657,30 @@ enum VehicleProperty { LANE_CENTERING_ASSIST_ENABLED = 0x100A + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Lane Centering Assist (LCA) commands. + * + * Commands to activate and suspend LCA. They are only valid when LANE_CENTERING_ASSIST_ENABLED + * = true. Otherwise, these commands must return StatusCode#NOT_AVAILABLE or + * StatusCode#NOT_AVAILABLE_DISABLED. + * + * When the command ACTIVATE from LaneCenteringAssistCommmand is sent, + * LANE_CENTERING_ASSIST_STATE must be set to LaneCenteringAssistState#ACTIVATION_REQUESTED. + * When the ACTIVATE command succeeds, LANE_CENTERING_ASSIST_STATE must be set to + * LaneCenteringAssistState#ACTIVATED. When the command DEACTIVATE from + * LaneCenteringAssistCommmand succeeds, LANE_CENTERING_ASSIST_STATE must be set to + * LaneCenteringAssistState#ENABLED. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues must be defined unless + * all enum values of LaneCenteringAssistCommand are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.WRITE + * @data_enum LaneCenteringAssistCommmand + */ + LANE_CENTERING_ASSIST_COMMAND = + 0x100B + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** * Lane Centering Assist (LCA) state. * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 0215907412..7ab9b65d4f 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -738,6 +738,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistEnabledConfig VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistCommandConfig) { + verifyProperty(VehicleProperty::LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyAccess::WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneCenteringAssistStateConfig) { verifyProperty(VehicleProperty::LANE_CENTERING_ASSIST_STATE, VehiclePropertyAccess::READ, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From 8462db58590558a78fb7fd12fd63c6319b11fff4 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Fri, 27 Jan 2023 19:59:49 -0800 Subject: [PATCH 689/998] Add HAL changes for LANE_DEPARTURE_WARNING_STATE This property supports error states in addition to its own state. This is why the comments mention two @data_enums for this property. This works because states are integer values so as long as all states have distinct integer values, this functions correctly. Bug: 266998630 Test: atest VtsHalAutomotiveVehicle_TargetTest Test: atest CtsCarTestCases:CarPropertyManagerTest Test: atest CtsCarTestCases:VehiclePropertyIdsTest Test: atest CtsCarTestCases:LaneDepartureWarningStateTest Test: atest AndroidCarApiTest:LaneDepartureWarningStateTest Change-Id: Ic26fcfe8b41bb44a851daf59d64f0ceb536333c3 --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../JsonConfigLoader/src/JsonConfigLoader.cpp | 3 ++ .../config/DefaultProperties.json | 24 +++++++++- .../aidl/impl/default_config/config/README.md | 2 + .../utils/common/include/VehicleHalTypes.h | 1 + .../vehicle/LaneDepartureWarningState.aidl | 41 ++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../vehicle/LaneDepartureWarningState.aidl | 48 +++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 19 ++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 +++ 13 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LaneDepartureWarningState.aidl create mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LaneDepartureWarningState.aidl diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index da10cf4d15..21478522f9 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -247,6 +247,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::BLIND_SPOT_WARNING_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::LANE_DEPARTURE_WARNING_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index f1e941266e..19113b11df 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -247,6 +247,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::BLIND_SPOT_WARNING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::LANE_DEPARTURE_WARNING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_KEEP_ASSIST_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 10facb57c0..d1de770e9b 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -239,6 +239,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.BLIND_SPOT_WARNING_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index bcc4b92488..4debdc59da 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -239,6 +239,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.BLIND_SPOT_WARNING_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_KEEP_ASSIST_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index 943cf88fab..edacca002e 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -47,6 +47,7 @@ using ::aidl::android::hardware::automotive::vehicle::FuelType; using ::aidl::android::hardware::automotive::vehicle::GsrComplianceRequirementType; using ::aidl::android::hardware::automotive::vehicle::LaneCenteringAssistCommand; using ::aidl::android::hardware::automotive::vehicle::LaneCenteringAssistState; +using ::aidl::android::hardware::automotive::vehicle::LaneDepartureWarningState; using ::aidl::android::hardware::automotive::vehicle::LaneKeepAssistState; using ::aidl::android::hardware::automotive::vehicle::RawPropValues; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport; @@ -221,6 +222,8 @@ JsonValueParser::JsonValueParser() { std::make_unique>(); mConstantParsersByType["BlindSpotWarningState"] = std::make_unique>(); + mConstantParsersByType["LaneDepartureWarningState"] = + std::make_unique>(); mConstantParsersByType["LaneKeepAssistState"] = std::make_unique>(); mConstantParsersByType["LaneCenteringAssistCommand"] = diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index cde7bab17a..4246ea1e76 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3249,10 +3249,32 @@ "property": "VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED", "defaultValue": { "int32Values": [ - 0 + 1 ] } }, + { + "property": "VehicleProperty::LANE_DEPARTURE_WARNING_STATE", + "defaultValue": { + "int32Values": [ + "LaneDepartureWarningState::NO_WARNING" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "ErrorState::NOT_AVAILABLE_SAFETY", + "ErrorState::NOT_AVAILABLE_SPEED_HIGH", + "ErrorState::NOT_AVAILABLE_SPEED_LOW", + "ErrorState::NOT_AVAILABLE_DISABLED", + "LaneDepartureWarningState::NO_WARNING", + "LaneDepartureWarningState::WARNING_LEFT", + "LaneDepartureWarningState::WARNING_RIGHT" + ] + } + ] + }, { "property": "VehicleProperty::LANE_KEEP_ASSIST_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/default_config/config/README.md b/automotive/vehicle/aidl/impl/default_config/config/README.md index 360018fc1e..ff5a2e24de 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/README.md +++ b/automotive/vehicle/aidl/impl/default_config/config/README.md @@ -147,6 +147,8 @@ We support the following constant types: * BlindSpotWarningState +* LaneDepartureWarningState + * LaneKeepAssistState * LaneCenteringAssistCommand diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index bba3242754..ef715cc2fe 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LaneDepartureWarningState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LaneDepartureWarningState.aidl new file mode 100644 index 0000000000..cdddb6f2d2 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LaneDepartureWarningState.aidl @@ -0,0 +1,41 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum LaneDepartureWarningState { + OTHER = 0, + NO_WARNING = 1, + WARNING_LEFT = 2, + WARNING_RIGHT = 3, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 51a3d187d4..5b7524d2bf 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -245,6 +245,7 @@ enum VehicleProperty { BLIND_SPOT_WARNING_ENABLED = (((0x1004 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313924 */, BLIND_SPOT_WARNING_STATE = (((0x1005 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.MIRROR) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 339742725 */, LANE_DEPARTURE_WARNING_ENABLED = (((0x1006 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313926 */, + LANE_DEPARTURE_WARNING_STATE = (((0x1007 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411079 */, LANE_KEEP_ASSIST_ENABLED = (((0x1008 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313928 */, LANE_KEEP_ASSIST_STATE = (((0x1009 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411081 */, LANE_CENTERING_ASSIST_ENABLED = (((0x100A + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313930 */, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LaneDepartureWarningState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LaneDepartureWarningState.aidl new file mode 100644 index 0000000000..c12c5765ad --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LaneDepartureWarningState.aidl @@ -0,0 +1,48 @@ +/* + * 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.hardware.automotive.vehicle; + +/** + * Used to enumerate the state of Lane Departure Warning (LDW). + */ +@VintfStability +@Backing(type="int") +enum LaneDepartureWarningState { + + /** + * This state is used as an alternative for any LaneDepartureWarningState value that is not + * defined in the platform. Ideally, implementations of + * VehicleProperty#LANE_DEPARTURE_WARNING_STATE should not use this state. The framework + * can use this field to remain backwards compatible if LaneDepartureWarningState is + * extended to include additional states. + */ + OTHER = 0, + /** + * LDW is enabled and monitoring, but the vehicle is centered in the lane. + */ + NO_WARNING = 1, + /** + * LDW is enabled, detects the vehicle is approaching or crossing lane lines on the left side + * of the vehicle, and is currently warning the user. + */ + WARNING_LEFT = 2, + /** + * LDW is enabled, detects the vehicle is approaching or crossing lane lines on the right side + * of the vehicle, and is currently warning the user. + */ + WARNING_RIGHT = 3, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 2f8c41b8d9..82b38b8d4b 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3584,6 +3584,25 @@ enum VehicleProperty { LANE_DEPARTURE_WARNING_ENABLED = 0x1006 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Lane Departure Warning (LDW) state. + * + * Returns the current state of LDW. This property must always return a valid state defined in + * LaneDepartureWarningState or ErrorState. It must not surface errors through StatusCode + * and must use the supported error states instead. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of both LaneDepartureWarningState (including OTHER, which is not + * recommended) and ErrorState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum LaneDepartureWarningState + * @data_enum ErrorState + */ + LANE_DEPARTURE_WARNING_STATE = + 0x1007 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** * Enable or disable Lane Keep Assist (LKA). * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 7ab9b65d4f..b1afaa767a 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -720,6 +720,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneDepartureWarningEnabledConfi VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneDepartureWarningStateConfig) { + verifyProperty(VehicleProperty::LANE_DEPARTURE_WARNING_STATE, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLaneKeepAssistEnabledConfig) { verifyProperty(VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From 162976161adb5fc70f172cf0b749ae23ccf733e8 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Mon, 30 Jan 2023 07:30:29 -0800 Subject: [PATCH 690/998] Update LANE_DEPARTURE_WARNING_ENABLED documentation in HAL Temporary errors should be conveyed through ErrorState values in the STATE property. Bug: 266998630 Test: presubmit Change-Id: If1acfe2454d552b2339c636cd7d790fa42f3bc10 --- .../android/hardware/automotive/vehicle/VehicleProperty.aidl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 82b38b8d4b..803e093981 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3575,6 +3575,11 @@ enum VehicleProperty { * vehicle should be turned on and monitoring if the vehicle is approaching or crossing lane * lines, in which case a warning will be given. * + * In general, LANE_DEPARTURE_WARNING_ENABLED should always return true or false. If the feature + * is not available due to some temporary state, such as the vehicle speed being too low or too + * high, that information must be conveyed through the ErrorState values in the + * LANE_DEPARTURE_WARNING_STATE property. + * * This property is defined as read_write, but OEMs have the option to implement it as read * only. * From d76f8458a6a32c0c4bb601a163db6fd0b69e82b4 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Thu, 9 Feb 2023 10:08:13 -0800 Subject: [PATCH 691/998] Update AUTOMATIC_EMERGENCY_BRAKING_ENABLED documentation in HAL Temporary errors should be conveyed through ErrorState values in the STATE property. Bug: 264336118 Test: presubmit Change-Id: I28de0aceaabb33647085d80b79da215da4a146cf --- .../hardware/automotive/vehicle/VehicleProperty.aidl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 803e093981..269408e74a 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3457,9 +3457,10 @@ enum VehicleProperty { * Set true to enable AEB and false to disable AEB. When AEB is enabled, the ADAS system in the * vehicle should be turned on and monitoring to avoid potential collisions. * - * If AEB is not available, IVehicle#get must not return any NOT_AVAILABLE value in StatusCode. - * Other StatusCode values like TRY_AGAIN may still be used as needed. For example, if AEB is - * not available because the vehicle speed is too low, IVehicle#get must return false. + * In general, AUTOMATIC_EMERGENCY_BRAKING_ENABLED should always return true or false. If the + * feature is not available due to some temporary state, such as the vehicle speed being too + * low, that information must be conveyed through the ErrorState values in the + * AUTOMATIC_EMERGENCY_BRAKING_STATE property. * * This property is defined as read_write, but OEMs have the option to implement it as read * only. From 326c88dd0f4d0cc7bba5a1a43651221ccdab3ef8 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Thu, 9 Feb 2023 10:14:34 -0800 Subject: [PATCH 692/998] Update FORWARD_COLLISION_WARNING_ENABLED documentation in HAL Temporary errors should be conveyed through ErrorState values in the STATE property. Bug: 264946034 Test: presubmit Change-Id: I720dd691bc859d3113fa48f0f5b9a0b4a909d952 --- .../hardware/automotive/vehicle/VehicleProperty.aidl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 269408e74a..92dc8a7b55 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3499,9 +3499,10 @@ enum VehicleProperty { * Set true to enable FCW and false to disable FCW. When FCW is enabled, the ADAS system in the * vehicle should be turned on and monitoring for potential collisions. * - * If FCW is not available, IVehicle#get must not return any NOT_AVAILABLE value in StatusCode. - * Other StatusCode values like TRY_AGAIN may still be used as needed. For example, if FCW is - * not available because the vehicle speed is too low, IVehicle#get must return false. + * In general, FORWARD_COLLISION_WARNING_ENABLED should always return true or false. If the + * feature is not available due to some temporary state, such as the vehicle speed being too + * low, that information must be conveyed through the ErrorState values in the + * FORWARD_COLLISION_WARNING_STATE property. * * This property is defined as read_write, but OEMs have the option to implement it as read * only. From dacd5b0512c6b9b7aa406b2b379f9fb722a95c75 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Thu, 9 Feb 2023 10:17:08 -0800 Subject: [PATCH 693/998] Update BLIND_SPOT_WARNING_ENABLED documentation in HAL Temporary errors should be conveyed through ErrorState values in the STATE property. Bug: 264946039 Test: presubmit Change-Id: I06092b1571aaa63ab165a8e2a2d04f9d57eccb64 --- .../hardware/automotive/vehicle/VehicleProperty.aidl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 92dc8a7b55..1b02510022 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3538,9 +3538,10 @@ enum VehicleProperty { * Set true to enable BSW and false to disable BSW. When BSW is enabled, the ADAS system in the * vehicle should be turned on and monitoring for objects in the vehicle’s blind spots. * - * If BSW is not available, IVehicle#get must not return any NOT_AVAILABLE value in StatusCode. - * Other StatusCode values like TRY_AGAIN may still be used as needed. For example, if BSW is - * not available because the vehicle speed is too low, IVehicle#get must return false. + * In general, BLIND_SPOT_WARNING_ENABLED should always return true or false. If the feature is + * not available due to some temporary state, such as the vehicle speed being too low, that + * information must be conveyed through the ErrorState values in the BLIND_SPOT_WARNING_STATE + * property. * * This property is defined as read_write, but OEMs have the option to implement it as read * only. From f8091f5d08cb54880ebc7d9f460c24f352fceb84 Mon Sep 17 00:00:00 2001 From: Changyeon Jo Date: Tue, 7 Feb 2023 16:26:14 -0800 Subject: [PATCH 694/998] Add new EVS service types This change adds below new service types to EvsServiceType enum. - FRONTVIEW - LEFTVIEW - RIGHTVIEW - DRIVERVIEW - FRONTPASSENGERSVIEW - REARPASSENGERSVIEW - USER_DEFINED Bug: 191940626 Test: m -j Change-Id: I907cd8e588e38659eedb77ac882b3a498f75f2d3 --- .../hardware/automotive/vehicle/EvsServiceType.aidl | 7 +++++++ .../hardware/automotive/vehicle/EvsServiceType.aidl | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EvsServiceType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EvsServiceType.aidl index 1363a64cca..285732cc39 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EvsServiceType.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EvsServiceType.aidl @@ -36,4 +36,11 @@ package android.hardware.automotive.vehicle; enum EvsServiceType { REARVIEW = 0, SURROUNDVIEW = 1, + FRONTVIEW = 2, + LEFTVIEW = 3, + RIGHTVIEW = 4, + DRIVERVIEW = 5, + FRONTPASSENGERSVIEW = 6, + REARPASSENGERSVIEW = 7, + USER_DEFINED = 1000, } diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvsServiceType.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvsServiceType.aidl index 6c621f79ad..20582dca0f 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvsServiceType.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EvsServiceType.aidl @@ -24,4 +24,11 @@ package android.hardware.automotive.vehicle; enum EvsServiceType { REARVIEW = 0, SURROUNDVIEW = 1, + FRONTVIEW = 2, + LEFTVIEW = 3, + RIGHTVIEW = 4, + DRIVERVIEW = 5, + FRONTPASSENGERSVIEW = 6, + REARPASSENGERSVIEW = 7, + USER_DEFINED = 1000, } From 6c55d90884a18c2cf71c2ea58b8ab338a0db477b Mon Sep 17 00:00:00 2001 From: Terry Guan Date: Thu, 9 Feb 2023 14:50:47 -0800 Subject: [PATCH 695/998] Changed order of manifest Bug: 268162044 Test: atest vts_halManifest_validate_test Change-Id: I7b8e2f822220bc1c66fc85a4d252b529b7d7d95f --- automotive/audiocontrol/aidl/default/audiocontrol-default.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automotive/audiocontrol/aidl/default/audiocontrol-default.xml b/automotive/audiocontrol/aidl/default/audiocontrol-default.xml index 3452ae93d9..3536bb928e 100644 --- a/automotive/audiocontrol/aidl/default/audiocontrol-default.xml +++ b/automotive/audiocontrol/aidl/default/audiocontrol-default.xml @@ -1,7 +1,7 @@ - 2 android.hardware.automotive.audiocontrol + 2 IAudioControl/default From babb544319ca497a05bbebf3220eef16fb237ac4 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Thu, 9 Feb 2023 17:52:50 -0800 Subject: [PATCH 696/998] audio: Move Microphone[Dynamic]Info structs from core These parcelables are also used by the framework. Bug: 263964254 Test: atest VtsHalAudioCoreTargetTest Change-Id: Ib30b69c325040e474fb58a8e7e515912fccab4c7 --- audio/aidl/Android.bp | 2 - .../android/hardware/audio/core/IModule.aidl | 2 +- .../hardware/audio/core/IStreamIn.aidl | 4 +- .../hardware/audio/core/ITelephony.aidl | 2 +- .../audio/core/MicrophoneDynamicInfo.aidl | 45 ------ .../hardware/audio/core/MicrophoneInfo.aidl | 82 ---------- .../hardware/audio/core/StreamDescriptor.aidl | 8 +- .../android/hardware/audio/core/IModule.aidl | 2 +- .../hardware/audio/core/IStreamIn.aidl | 2 +- .../audio/core/MicrophoneDynamicInfo.aidl | 48 ------ .../hardware/audio/core/MicrophoneInfo.aidl | 146 ------------------ audio/aidl/default/Configuration.cpp | 1 + audio/aidl/default/Module.cpp | 1 + audio/aidl/default/Stream.cpp | 2 + audio/aidl/default/StreamStub.cpp | 1 + .../default/include/core-impl/Configuration.h | 4 +- audio/aidl/default/include/core-impl/Module.h | 4 +- audio/aidl/default/include/core-impl/Stream.h | 10 +- .../default/include/core-impl/StreamStub.h | 9 +- .../default/include/core-impl/StreamUsb.h | 12 +- audio/aidl/default/usb/StreamUsb.cpp | 4 +- .../vts/VtsHalAudioCoreModuleTargetTest.cpp | 4 +- 22 files changed, 45 insertions(+), 350 deletions(-) delete mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneDynamicInfo.aidl delete mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneInfo.aidl delete mode 100644 audio/aidl/android/hardware/audio/core/MicrophoneDynamicInfo.aidl delete mode 100644 audio/aidl/android/hardware/audio/core/MicrophoneInfo.aidl diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index 01af9400ab..af3f5a2fb4 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -120,8 +120,6 @@ aidl_interface { "android/hardware/audio/core/IStreamOut.aidl", "android/hardware/audio/core/IStreamOutEventCallback.aidl", "android/hardware/audio/core/ITelephony.aidl", - "android/hardware/audio/core/MicrophoneDynamicInfo.aidl", - "android/hardware/audio/core/MicrophoneInfo.aidl", "android/hardware/audio/core/MmapBufferDescriptor.aidl", "android/hardware/audio/core/ModuleDebug.aidl", "android/hardware/audio/core/StreamDescriptor.aidl", diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl index 45217e739a..1eafdaba57 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl @@ -58,7 +58,7 @@ interface IModule { void setMasterVolume(float volume); boolean getMicMute(); void setMicMute(boolean mute); - android.hardware.audio.core.MicrophoneInfo[] getMicrophones(); + android.media.audio.common.MicrophoneInfo[] getMicrophones(); void updateAudioMode(android.media.audio.common.AudioMode mode); void updateScreenRotation(android.hardware.audio.core.IModule.ScreenRotation rotation); void updateScreenState(boolean isTurnedOn); diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamIn.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamIn.aidl index 1041943446..a01f877e86 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamIn.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamIn.aidl @@ -35,7 +35,7 @@ package android.hardware.audio.core; @VintfStability interface IStreamIn { android.hardware.audio.core.IStreamCommon getStreamCommon(); - android.hardware.audio.core.MicrophoneDynamicInfo[] getActiveMicrophones(); + android.media.audio.common.MicrophoneDynamicInfo[] getActiveMicrophones(); android.hardware.audio.core.IStreamIn.MicrophoneDirection getMicrophoneDirection(); void setMicrophoneDirection(android.hardware.audio.core.IStreamIn.MicrophoneDirection direction); float getMicrophoneFieldDimension(); @@ -43,7 +43,7 @@ interface IStreamIn { void updateMetadata(in android.hardware.audio.common.SinkMetadata sinkMetadata); float[] getHwGain(); void setHwGain(in float[] channelGains); - const int MIC_FIELD_DIMENSION_WIDE_ANGLE = (-1); + const int MIC_FIELD_DIMENSION_WIDE_ANGLE = (-1) /* -1 */; const int MIC_FIELD_DIMENSION_NO_ZOOM = 0; const int MIC_FIELD_DIMENSION_MAX_ZOOM = 1; const int HW_GAIN_MIN = 0; diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ITelephony.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ITelephony.aidl index 001d07461e..84d7aa1aa4 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ITelephony.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/ITelephony.aidl @@ -46,7 +46,7 @@ interface ITelephony { const int VOICE_VOLUME_MAX = 1; @Backing(type="int") @VintfStability enum TtyMode { - UNSPECIFIED = (-1), + UNSPECIFIED = (-1) /* -1 */, OFF = 0, FULL = 1, HCO = 2, diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneDynamicInfo.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneDynamicInfo.aidl deleted file mode 100644 index 50a5528309..0000000000 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneDynamicInfo.aidl +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.audio.core; -@JavaDerive(equals=true, toString=true) @VintfStability -parcelable MicrophoneDynamicInfo { - @utf8InCpp String id; - android.hardware.audio.core.MicrophoneDynamicInfo.ChannelMapping[] channelMapping; - @Backing(type="int") @VintfStability - enum ChannelMapping { - UNUSED = 0, - DIRECT = 1, - PROCESSED = 2, - } -} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneInfo.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneInfo.aidl deleted file mode 100644 index b77afe32cb..0000000000 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/MicrophoneInfo.aidl +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.audio.core; -@JavaDerive(equals=true, toString=true) @VintfStability -parcelable MicrophoneInfo { - @utf8InCpp String id; - android.media.audio.common.AudioDevice device; - android.hardware.audio.core.MicrophoneInfo.Location location = android.hardware.audio.core.MicrophoneInfo.Location.UNKNOWN; - int group = GROUP_UNKNOWN; - int indexInTheGroup = INDEX_IN_THE_GROUP_UNKNOWN; - @nullable android.hardware.audio.core.MicrophoneInfo.Sensitivity sensitivity; - android.hardware.audio.core.MicrophoneInfo.Directionality directionality = android.hardware.audio.core.MicrophoneInfo.Directionality.UNKNOWN; - android.hardware.audio.core.MicrophoneInfo.FrequencyResponsePoint[] frequencyResponse; - @nullable android.hardware.audio.core.MicrophoneInfo.Coordinate position; - @nullable android.hardware.audio.core.MicrophoneInfo.Coordinate orientation; - const int GROUP_UNKNOWN = (-1); - const int INDEX_IN_THE_GROUP_UNKNOWN = (-1); - @Backing(type="int") @VintfStability - enum Location { - UNKNOWN = 0, - MAINBODY = 1, - MAINBODY_MOVABLE = 2, - PERIPHERAL = 3, - } - @VintfStability - parcelable Sensitivity { - float leveldBFS; - float maxSpldB; - float minSpldB; - } - @Backing(type="int") @VintfStability - enum Directionality { - UNKNOWN = 0, - OMNI = 1, - BI_DIRECTIONAL = 2, - CARDIOID = 3, - HYPER_CARDIOID = 4, - SUPER_CARDIOID = 5, - } - @VintfStability - parcelable FrequencyResponsePoint { - float frequencyHz; - float leveldB; - } - @VintfStability - parcelable Coordinate { - float x; - float y; - float z; - } -} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl index a65d7b7cea..3e3dc38b2a 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/StreamDescriptor.aidl @@ -39,12 +39,12 @@ parcelable StreamDescriptor { int frameSizeBytes; long bufferSizeFrames; android.hardware.audio.core.StreamDescriptor.AudioBuffer audio; - const int LATENCY_UNKNOWN = (-1); + const int LATENCY_UNKNOWN = (-1) /* -1 */; @FixedSize @VintfStability parcelable Position { - long frames = UNKNOWN; - long timeNs = UNKNOWN; - const long UNKNOWN = (-1); + long frames = UNKNOWN /* -1 */; + long timeNs = UNKNOWN /* -1 */; + const long UNKNOWN = (-1) /* -1 */; } @Backing(type="int") @VintfStability enum State { diff --git a/audio/aidl/android/hardware/audio/core/IModule.aidl b/audio/aidl/android/hardware/audio/core/IModule.aidl index 968b5733f2..edfb9f27f6 100644 --- a/audio/aidl/android/hardware/audio/core/IModule.aidl +++ b/audio/aidl/android/hardware/audio/core/IModule.aidl @@ -26,7 +26,6 @@ import android.hardware.audio.core.IStreamIn; import android.hardware.audio.core.IStreamOut; import android.hardware.audio.core.IStreamOutEventCallback; import android.hardware.audio.core.ITelephony; -import android.hardware.audio.core.MicrophoneInfo; import android.hardware.audio.core.ModuleDebug; import android.hardware.audio.core.StreamDescriptor; import android.hardware.audio.core.VendorParameter; @@ -39,6 +38,7 @@ import android.media.audio.common.AudioOffloadInfo; import android.media.audio.common.AudioPort; import android.media.audio.common.AudioPortConfig; import android.media.audio.common.Float; +import android.media.audio.common.MicrophoneInfo; /** * Each instance of IModule corresponds to a separate audio module. The system diff --git a/audio/aidl/android/hardware/audio/core/IStreamIn.aidl b/audio/aidl/android/hardware/audio/core/IStreamIn.aidl index c2b36332a3..93cad11a58 100644 --- a/audio/aidl/android/hardware/audio/core/IStreamIn.aidl +++ b/audio/aidl/android/hardware/audio/core/IStreamIn.aidl @@ -18,7 +18,7 @@ package android.hardware.audio.core; import android.hardware.audio.common.SinkMetadata; import android.hardware.audio.core.IStreamCommon; -import android.hardware.audio.core.MicrophoneDynamicInfo; +import android.media.audio.common.MicrophoneDynamicInfo; /** * This interface provides means for receiving audio data from input devices. diff --git a/audio/aidl/android/hardware/audio/core/MicrophoneDynamicInfo.aidl b/audio/aidl/android/hardware/audio/core/MicrophoneDynamicInfo.aidl deleted file mode 100644 index 36cc51fa00..0000000000 --- a/audio/aidl/android/hardware/audio/core/MicrophoneDynamicInfo.aidl +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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. - */ - -package android.hardware.audio.core; - -/** - * Structure providing dynamic information on a microphone. This information - * changes between recording sessions. - */ -@JavaDerive(equals=true, toString=true) -@VintfStability -parcelable MicrophoneDynamicInfo { - /** - * Unique alphanumeric id for the microphone. It must match the id of one of - * the 'MicrophoneInfo' entries returned by 'IModule.getMicrophones'. - */ - @utf8InCpp String id; - - @VintfStability - @Backing(type="int") - enum ChannelMapping { - /** Channel not used. */ - UNUSED = 0, - /** Channel is used and the signal is not processed. */ - DIRECT = 1, - /** Channel is used and the signal has some processing. */ - PROCESSED = 2, - } - /** - * The vector is indexes by zero-based channels of the microphone, thus the - * element '0' corresponds to the first channel, '1' is the second, etc. The - * vector must contain at least 1 element. - */ - ChannelMapping[] channelMapping; -} diff --git a/audio/aidl/android/hardware/audio/core/MicrophoneInfo.aidl b/audio/aidl/android/hardware/audio/core/MicrophoneInfo.aidl deleted file mode 100644 index 3b8c7f37f1..0000000000 --- a/audio/aidl/android/hardware/audio/core/MicrophoneInfo.aidl +++ /dev/null @@ -1,146 +0,0 @@ -/* - * 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. - */ - -package android.hardware.audio.core; - -import android.media.audio.common.AudioDevice; - -/** - * Structure providing static information on a microphone. This information - * never changes during the lifetime of the IModule which owns the microphone. - * The information presented in this structure indicates the location and - * orientation of the microphone on the device as well as useful information - * like frequency response and sensitivity. - */ -@JavaDerive(equals=true, toString=true) -@VintfStability -parcelable MicrophoneInfo { - /** - * Unique alphanumeric id for the microphone. It must remain the same across - * device reboots. The client must never attempt to parse the value of this - * field. - */ - @utf8InCpp String id; - /** - * Describes the location of the microphone in terms of managed audio devices. - */ - AudioDevice device; - - @VintfStability - @Backing(type="int") - enum Location { - /** Microphone location is unknown. */ - UNKNOWN = 0, - /** The microphone is located on the main body of the device. */ - MAINBODY = 1, - /** The microphone is located on a movable main body of the device. */ - MAINBODY_MOVABLE = 2, - /** The microphone is located on a peripheral. */ - PERIPHERAL = 3, - } - /** Location of the microphone in regard to the body of the device */ - Location location = Location.UNKNOWN; - - /** - * This value is used when the group of the microphone is unknown. - */ - const int GROUP_UNKNOWN = -1; - /** - * An identifier to group related microphones together, for example, - * microphones of a microphone array should all belong to the same group. - * Note that microphones assigned to 'GROUP_UNKNOWN' do not form a group. - */ - int group = GROUP_UNKNOWN; - /** - * This value is used when the index in the group of the microphone is - * unknown. - */ - const int INDEX_IN_THE_GROUP_UNKNOWN = -1; - /** - * Index of this microphone within the group. The pair (group, index) must - * be unique within the same HAL module, except the pair - * (GROUP_UNKNOWN, INDEX_IN_THE_GROUP_UNKNOWN). - */ - int indexInTheGroup = INDEX_IN_THE_GROUP_UNKNOWN; - - @VintfStability - parcelable Sensitivity { - /** Level in dBFS produced by a 1000 Hz tone at 94 dB SPL. */ - float leveldBFS; - /** Level in dB of the max SPL supported at 1000 Hz */ - float maxSpldB; - /** Level in dB of the min SPL supported at 1000 Hz */ - float minSpldB; - } - /** - * If provided, must describe acceptable sound pressure levels (SPL) - * for a 1 kHz sine wave, and the resulting level in dBFS. - */ - @nullable Sensitivity sensitivity; - - @VintfStability - @Backing(type="int") - enum Directionality { - UNKNOWN = 0, - OMNI = 1, - BI_DIRECTIONAL = 2, - CARDIOID = 3, - HYPER_CARDIOID = 4, - SUPER_CARDIOID = 5, - } - /** - * The standard polar pattern of the microphone. - */ - Directionality directionality = Directionality.UNKNOWN; - - /** - * A (frequency, level) pair. Used to represent frequency response. - */ - @VintfStability - parcelable FrequencyResponsePoint { - float frequencyHz; - float leveldB; - } - /** - * Vector with ordered frequency responses (from low to high frequencies) - * with the frequency response of the microphone. Levels are in dB, - * relative to level at 1000 Hz. - */ - FrequencyResponsePoint[] frequencyResponse; - - /** - * A 3D point used to represent position or orientation of a microphone. - */ - @VintfStability - parcelable Coordinate { - float x; - float y; - float z; - } - /** - * If provided, must specify distances of the microphone's capsule, in - * meters, from the bottom-left-back corner of the bounding box of device in - * its natural orientation (PORTRAIT for phones, LANDSCAPE for tablets, TVs, - * etc). - */ - @nullable Coordinate position; - /** - * If provided, describes the normalized point which defines the main - * orientation of the microphone's capsule. - * Magnitude = sqrt(x^2 + y^2 + z^2) = 1. - */ - @nullable Coordinate orientation; -} diff --git a/audio/aidl/default/Configuration.cpp b/audio/aidl/default/Configuration.cpp index 854c7f372c..a72be24034 100644 --- a/audio/aidl/default/Configuration.cpp +++ b/audio/aidl/default/Configuration.cpp @@ -40,6 +40,7 @@ using aidl::android::media::audio::common::AudioPortExt; using aidl::android::media::audio::common::AudioPortMixExt; using aidl::android::media::audio::common::AudioProfile; using aidl::android::media::audio::common::Int; +using aidl::android::media::audio::common::MicrophoneInfo; using aidl::android::media::audio::common::PcmType; using android::hardware::audio::common::makeBitPositionFlagMask; diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp index 2f6ab2fe7a..10aead2726 100644 --- a/audio/aidl/default/Module.cpp +++ b/audio/aidl/default/Module.cpp @@ -55,6 +55,7 @@ using aidl::android::media::audio::common::AudioPortExt; using aidl::android::media::audio::common::AudioProfile; using aidl::android::media::audio::common::Boolean; using aidl::android::media::audio::common::Int; +using aidl::android::media::audio::common::MicrophoneInfo; using aidl::android::media::audio::common::PcmType; using android::hardware::audio::common::getFrameSizeInBytes; using android::hardware::audio::common::isBitPositionFlagSet; diff --git a/audio/aidl/default/Stream.cpp b/audio/aidl/default/Stream.cpp index d62ca1d1ca..49ad2f2d74 100644 --- a/audio/aidl/default/Stream.cpp +++ b/audio/aidl/default/Stream.cpp @@ -31,6 +31,8 @@ using aidl::android::media::audio::common::AudioDualMonoMode; using aidl::android::media::audio::common::AudioLatencyMode; using aidl::android::media::audio::common::AudioOffloadInfo; using aidl::android::media::audio::common::AudioPlaybackRate; +using aidl::android::media::audio::common::MicrophoneDynamicInfo; +using aidl::android::media::audio::common::MicrophoneInfo; using android::hardware::audio::common::getChannelCount; using android::hardware::audio::common::getFrameSizeInBytes; diff --git a/audio/aidl/default/StreamStub.cpp b/audio/aidl/default/StreamStub.cpp index 85d1e16053..0ed935785a 100644 --- a/audio/aidl/default/StreamStub.cpp +++ b/audio/aidl/default/StreamStub.cpp @@ -24,6 +24,7 @@ using aidl::android::hardware::audio::common::SinkMetadata; using aidl::android::hardware::audio::common::SourceMetadata; using aidl::android::media::audio::common::AudioDevice; using aidl::android::media::audio::common::AudioOffloadInfo; +using aidl::android::media::audio::common::MicrophoneInfo; namespace aidl::android::hardware::audio::core { diff --git a/audio/aidl/default/include/core-impl/Configuration.h b/audio/aidl/default/include/core-impl/Configuration.h index 1aca1fe1bb..4dd01338e2 100644 --- a/audio/aidl/default/include/core-impl/Configuration.h +++ b/audio/aidl/default/include/core-impl/Configuration.h @@ -22,14 +22,14 @@ #include #include -#include #include #include +#include namespace aidl::android::hardware::audio::core::internal { struct Configuration { - std::vector microphones; + std::vector<::aidl::android::media::audio::common::MicrophoneInfo> microphones; std::vector<::aidl::android::media::audio::common::AudioPort> ports; std::vector<::aidl::android::media::audio::common::AudioPortConfig> portConfigs; std::vector<::aidl::android::media::audio::common::AudioPortConfig> initialConfigs; diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h index fab1c14df1..8365b3438f 100644 --- a/audio/aidl/default/include/core-impl/Module.h +++ b/audio/aidl/default/include/core-impl/Module.h @@ -94,7 +94,9 @@ class Module : public BnModule { ndk::ScopedAStatus setMasterVolume(float in_volume) override; ndk::ScopedAStatus getMicMute(bool* _aidl_return) override; ndk::ScopedAStatus setMicMute(bool in_mute) override; - ndk::ScopedAStatus getMicrophones(std::vector* _aidl_return) override; + ndk::ScopedAStatus getMicrophones( + std::vector<::aidl::android::media::audio::common::MicrophoneInfo>* _aidl_return) + override; ndk::ScopedAStatus updateAudioMode( ::aidl::android::media::audio::common::AudioMode in_mode) override; ndk::ScopedAStatus updateScreenRotation( diff --git a/audio/aidl/default/include/core-impl/Stream.h b/audio/aidl/default/include/core-impl/Stream.h index f8c12e6063..0d4365a3ae 100644 --- a/audio/aidl/default/include/core-impl/Stream.h +++ b/audio/aidl/default/include/core-impl/Stream.h @@ -32,10 +32,10 @@ #include #include #include -#include #include #include #include +#include #include #include #include @@ -413,7 +413,8 @@ class StreamIn : public StreamCommonImpl<::aidl::android::hardware::audio::commo getStreamCommon(_aidl_return); } ndk::ScopedAStatus getActiveMicrophones( - std::vector* _aidl_return) override; + std::vector<::aidl::android::media::audio::common::MicrophoneDynamicInfo>* _aidl_return) + override; ndk::ScopedAStatus getMicrophoneDirection(MicrophoneDirection* _aidl_return) override; ndk::ScopedAStatus setMicrophoneDirection(MicrophoneDirection in_direction) override; ndk::ScopedAStatus getMicrophoneFieldDimension(float* _aidl_return) override; @@ -434,7 +435,7 @@ class StreamIn : public StreamCommonImpl<::aidl::android::hardware::audio::commo StreamIn(const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata, StreamContext&& context, const DriverInterface::CreateInstance& createDriver, const StreamWorkerInterface::CreateInstance& createWorker, - const std::vector& microphones); + const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones); void createStreamCommon(const std::shared_ptr& myPtr) { StreamCommonImpl< ::aidl::android::hardware::audio::common::SinkMetadata>::createStreamCommon(myPtr); @@ -445,7 +446,8 @@ class StreamIn : public StreamCommonImpl<::aidl::android::hardware::audio::commo public: using CreateInstance = std::function& microphones, + StreamContext&& context, + const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones, std::shared_ptr* result)>; }; diff --git a/audio/aidl/default/include/core-impl/StreamStub.h b/audio/aidl/default/include/core-impl/StreamStub.h index aea9da5696..69fd7b3983 100644 --- a/audio/aidl/default/include/core-impl/StreamStub.h +++ b/audio/aidl/default/include/core-impl/StreamStub.h @@ -43,13 +43,16 @@ class StreamInStub final : public StreamIn { public: static ndk::ScopedAStatus createInstance( const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata, - StreamContext&& context, const std::vector& microphones, + StreamContext&& context, + const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones, std::shared_ptr* result); private: friend class ndk::SharedRefBase; - StreamInStub(const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata, - StreamContext&& context, const std::vector& microphones); + StreamInStub( + const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata, + StreamContext&& context, + const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones); }; class StreamOutStub final : public StreamOut { diff --git a/audio/aidl/default/include/core-impl/StreamUsb.h b/audio/aidl/default/include/core-impl/StreamUsb.h index 8ac1f34f2c..c04dc66162 100644 --- a/audio/aidl/default/include/core-impl/StreamUsb.h +++ b/audio/aidl/default/include/core-impl/StreamUsb.h @@ -60,18 +60,22 @@ class DriverUsb : public DriverInterface { class StreamInUsb final : public StreamIn { ndk::ScopedAStatus getActiveMicrophones( - std::vector* _aidl_return) override; + std::vector<::aidl::android::media::audio::common::MicrophoneDynamicInfo>* _aidl_return) + override; public: static ndk::ScopedAStatus createInstance( const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata, - StreamContext&& context, const std::vector& microphones, + StreamContext&& context, + const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones, std::shared_ptr* result); private: friend class ndk::SharedRefBase; - StreamInUsb(const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata, - StreamContext&& context, const std::vector& microphones); + StreamInUsb( + const ::aidl::android::hardware::audio::common::SinkMetadata& sinkMetadata, + StreamContext&& context, + const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones); }; class StreamOutUsb final : public StreamOut { diff --git a/audio/aidl/default/usb/StreamUsb.cpp b/audio/aidl/default/usb/StreamUsb.cpp index 22e36ac76f..bd53a0ef2a 100644 --- a/audio/aidl/default/usb/StreamUsb.cpp +++ b/audio/aidl/default/usb/StreamUsb.cpp @@ -30,6 +30,8 @@ using aidl::android::hardware::audio::common::SourceMetadata; using aidl::android::media::audio::common::AudioDevice; using aidl::android::media::audio::common::AudioDeviceAddress; using aidl::android::media::audio::common::AudioOffloadInfo; +using aidl::android::media::audio::common::MicrophoneDynamicInfo; +using aidl::android::media::audio::common::MicrophoneInfo; namespace aidl::android::hardware::audio::core { @@ -239,4 +241,4 @@ StreamOutUsb::StreamOutUsb(const SourceMetadata& sourceMetadata, StreamContext&& }, offloadInfo) {} -} // namespace aidl::android::hardware::audio::core \ No newline at end of file +} // namespace aidl::android::hardware::audio::core diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp index 3ca51c730c..ed56597180 100644 --- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp @@ -64,8 +64,6 @@ using aidl::android::hardware::audio::core::IStreamCommon; using aidl::android::hardware::audio::core::IStreamIn; using aidl::android::hardware::audio::core::IStreamOut; using aidl::android::hardware::audio::core::ITelephony; -using aidl::android::hardware::audio::core::MicrophoneDynamicInfo; -using aidl::android::hardware::audio::core::MicrophoneInfo; using aidl::android::hardware::audio::core::ModuleDebug; using aidl::android::hardware::audio::core::StreamDescriptor; using aidl::android::hardware::audio::core::VendorParameter; @@ -93,6 +91,8 @@ using aidl::android::media::audio::common::AudioUsage; using aidl::android::media::audio::common::Boolean; using aidl::android::media::audio::common::Float; using aidl::android::media::audio::common::Int; +using aidl::android::media::audio::common::MicrophoneDynamicInfo; +using aidl::android::media::audio::common::MicrophoneInfo; using aidl::android::media::audio::common::Void; using android::hardware::audio::common::getChannelCount; using android::hardware::audio::common::isBitPositionFlagSet; From 501c3c11522f3ae69d11e23a457a2d1cfe1fa299 Mon Sep 17 00:00:00 2001 From: Nathalie Le Clair Date: Fri, 10 Feb 2023 10:06:23 +0100 Subject: [PATCH 697/998] Handle out-of-bound indices Bug: 267007175 Test: lunch cf_x86_tv-userdebug; make; atest VtsHalTvHdmiConnectionAidlTargetTest; Change-Id: I0083953e8eaadea0ac66a9103358c0d4e1427086 --- .../aidl/default/HdmiConnectionMock.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tv/hdmi/connection/aidl/default/HdmiConnectionMock.cpp b/tv/hdmi/connection/aidl/default/HdmiConnectionMock.cpp index ca8c348f93..8f4411bd8e 100644 --- a/tv/hdmi/connection/aidl/default/HdmiConnectionMock.cpp +++ b/tv/hdmi/connection/aidl/default/HdmiConnectionMock.cpp @@ -70,16 +70,21 @@ ScopedAStatus HdmiConnectionMock::setCallback( } ScopedAStatus HdmiConnectionMock::setHpdSignal(HpdSignal signal, int32_t portId) { - if (mHdmiThreadRun) { - mHpdSignal.at(portId - 1) = signal; - return ScopedAStatus::ok(); - } else { + if (portId > mTotalPorts || portId < 1) { + return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (!mHdmiThreadRun) { return ScopedAStatus::fromServiceSpecificError( static_cast(Result::FAILURE_INVALID_STATE)); } + mHpdSignal.at(portId - 1) = signal; + return ScopedAStatus::ok(); } ScopedAStatus HdmiConnectionMock::getHpdSignal(int32_t portId, HpdSignal* _aidl_return) { + if (portId > mTotalPorts || portId < 1) { + return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } *_aidl_return = mHpdSignal.at(portId - 1); return ScopedAStatus::ok(); } @@ -123,7 +128,7 @@ void HdmiConnectionMock::handleHotplugMessage(unsigned char* msgBuf) { bool connected = ((msgBuf[3]) & 0xf) > 0; int32_t portId = static_cast(msgBuf[0] & 0xf); - if (portId > static_cast(mPortInfos.size())) { + if (portId > static_cast(mPortInfos.size()) || portId < 1) { ALOGD("[halimp_aidl] ignore hot plug message, id %x does not exist", portId); return; } From 7c4ed9ded3bd6cdf04b88980e5b6cb2372dc5cae Mon Sep 17 00:00:00 2001 From: KH Shi Date: Tue, 6 Dec 2022 19:46:31 +0800 Subject: [PATCH 698/998] Convert Tetheroffload HIDL to AIDL. This patch converts Tetheroffload HIDL to AIDL and adds an empty example implementation. There are some changes in AIDL HAL: 1. Combine IOffloadConfig and IOffloadControl into IOffload 2. Use AIDL builtin errors exception code with message as return Bug: b/205762647 Test: m android.hardware.tetheroffload-update-api m android.hardware.tetheroffload-V1-ndk m android.hardware.tetheroffload-service.example atest VtsHalTetheroffloadTargetTest Change-Id: I9859ff3df608c058786b4e2b91cb6cd5f38e653a (cherry picked from commit d97a30863794172ec5e6fa0bc16d72fb937d66eb) Merged-In: I9859ff3df608c058786b4e2b91cb6cd5f38e653a --- .../compatibility_matrix.current.xml | 8 + tetheroffload/aidl/Android.bp | 27 + .../tetheroffload/ForwardedStats.aidl | 39 + .../hardware/tetheroffload/IOffload.aidl | 46 ++ .../tetheroffload/IPv4AddrPortPair.aidl | 39 + .../ITetheringOffloadCallback.aidl | 39 + .../tetheroffload/NatTimeoutUpdate.aidl | 40 + .../tetheroffload/NetworkProtocol.aidl | 39 + .../tetheroffload/OffloadCallbackEvent.aidl | 43 ++ .../tetheroffload/ForwardedStats.aidl | 26 + .../hardware/tetheroffload/IOffload.aidl | 284 ++++++++ .../tetheroffload/IPv4AddrPortPair.aidl | 26 + .../ITetheringOffloadCallback.aidl | 42 ++ .../tetheroffload/NatTimeoutUpdate.aidl | 27 + .../tetheroffload/NetworkProtocol.aidl | 24 + .../tetheroffload/OffloadCallbackEvent.aidl | 64 ++ tetheroffload/aidl/default/Android.bp | 36 + tetheroffload/aidl/default/Offload.cpp | 246 +++++++ tetheroffload/aidl/default/Offload.h | 74 ++ tetheroffload/aidl/default/main.cpp | 35 + .../aidl/default/tetheroffload-example.rc | 4 + .../aidl/default/tetheroffload-example.xml | 7 + tetheroffload/aidl/vts/functional/Android.bp | 24 + .../VtsHalTetheroffloadTargetTest.cpp | 689 ++++++++++++++++++ 24 files changed, 1928 insertions(+) create mode 100644 tetheroffload/aidl/Android.bp create mode 100644 tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/ForwardedStats.aidl create mode 100644 tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/IOffload.aidl create mode 100644 tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/IPv4AddrPortPair.aidl create mode 100644 tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/ITetheringOffloadCallback.aidl create mode 100644 tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/NatTimeoutUpdate.aidl create mode 100644 tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/NetworkProtocol.aidl create mode 100644 tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/OffloadCallbackEvent.aidl create mode 100644 tetheroffload/aidl/android/hardware/tetheroffload/ForwardedStats.aidl create mode 100644 tetheroffload/aidl/android/hardware/tetheroffload/IOffload.aidl create mode 100644 tetheroffload/aidl/android/hardware/tetheroffload/IPv4AddrPortPair.aidl create mode 100644 tetheroffload/aidl/android/hardware/tetheroffload/ITetheringOffloadCallback.aidl create mode 100644 tetheroffload/aidl/android/hardware/tetheroffload/NatTimeoutUpdate.aidl create mode 100644 tetheroffload/aidl/android/hardware/tetheroffload/NetworkProtocol.aidl create mode 100644 tetheroffload/aidl/android/hardware/tetheroffload/OffloadCallbackEvent.aidl create mode 100644 tetheroffload/aidl/default/Android.bp create mode 100644 tetheroffload/aidl/default/Offload.cpp create mode 100644 tetheroffload/aidl/default/Offload.h create mode 100644 tetheroffload/aidl/default/main.cpp create mode 100644 tetheroffload/aidl/default/tetheroffload-example.rc create mode 100644 tetheroffload/aidl/default/tetheroffload-example.xml create mode 100644 tetheroffload/aidl/vts/functional/Android.bp create mode 100644 tetheroffload/aidl/vts/functional/VtsHalTetheroffloadTargetTest.cpp diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 886f7f5b39..e30dad749a 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -686,6 +686,14 @@ default + + android.hardware.tetheroffload + 1 + + IOffload + default + + android.hardware.thermal 2.0 diff --git a/tetheroffload/aidl/Android.bp b/tetheroffload/aidl/Android.bp new file mode 100644 index 0000000000..1d8058685c --- /dev/null +++ b/tetheroffload/aidl/Android.bp @@ -0,0 +1,27 @@ +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +aidl_interface { + name: "android.hardware.tetheroffload", + vendor_available: true, + srcs: ["android/hardware/tetheroffload/*.aidl"], + stability: "vintf", + backend: { + cpp: { + enabled: false, + }, + java: { + sdk_version: "module_current", + apex_available: [ + "com.android.tethering", + ], + min_sdk_version: "30", + enabled: true, + }, + ndk: { + apps_enabled: false, + }, + }, + frozen: false, +} diff --git a/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/ForwardedStats.aidl b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/ForwardedStats.aidl new file mode 100644 index 0000000000..493a69868f --- /dev/null +++ b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/ForwardedStats.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tetheroffload; +@VintfStability +parcelable ForwardedStats { + long rxBytes; + long txBytes; +} diff --git a/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/IOffload.aidl b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/IOffload.aidl new file mode 100644 index 0000000000..9a58b1fbba --- /dev/null +++ b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/IOffload.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tetheroffload; +@VintfStability +interface IOffload { + void initOffload(in ParcelFileDescriptor fd1, in ParcelFileDescriptor fd2, in android.hardware.tetheroffload.ITetheringOffloadCallback cb); + void stopOffload(); + void setLocalPrefixes(in String[] prefixes); + android.hardware.tetheroffload.ForwardedStats getForwardedStats(in String upstream); + void setDataWarningAndLimit(in String upstream, in long warningBytes, in long limitBytes); + void setUpstreamParameters(in String iface, in String v4Addr, in String v4Gw, in String[] v6Gws); + void addDownstream(in String iface, in String prefix); + void removeDownstream(in String iface, in String prefix); + const int ERROR_CODE_UNUSED = 0; +} diff --git a/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/IPv4AddrPortPair.aidl b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/IPv4AddrPortPair.aidl new file mode 100644 index 0000000000..2b42f0c056 --- /dev/null +++ b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/IPv4AddrPortPair.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tetheroffload; +@VintfStability +parcelable IPv4AddrPortPair { + String addr; + int port; +} diff --git a/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/ITetheringOffloadCallback.aidl b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/ITetheringOffloadCallback.aidl new file mode 100644 index 0000000000..4eb7d04d00 --- /dev/null +++ b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/ITetheringOffloadCallback.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tetheroffload; +@VintfStability +interface ITetheringOffloadCallback { + oneway void onEvent(in android.hardware.tetheroffload.OffloadCallbackEvent event); + oneway void updateTimeout(in android.hardware.tetheroffload.NatTimeoutUpdate params); +} diff --git a/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/NatTimeoutUpdate.aidl b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/NatTimeoutUpdate.aidl new file mode 100644 index 0000000000..9eddaa205f --- /dev/null +++ b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/NatTimeoutUpdate.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tetheroffload; +@VintfStability +parcelable NatTimeoutUpdate { + android.hardware.tetheroffload.IPv4AddrPortPair src; + android.hardware.tetheroffload.IPv4AddrPortPair dst; + android.hardware.tetheroffload.NetworkProtocol proto; +} diff --git a/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/NetworkProtocol.aidl b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/NetworkProtocol.aidl new file mode 100644 index 0000000000..52bd2a6c50 --- /dev/null +++ b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/NetworkProtocol.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tetheroffload; +@Backing(type="int") @VintfStability +enum NetworkProtocol { + TCP = 6, + UDP = 17, +} diff --git a/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/OffloadCallbackEvent.aidl b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/OffloadCallbackEvent.aidl new file mode 100644 index 0000000000..026e18ed1d --- /dev/null +++ b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/current/android/hardware/tetheroffload/OffloadCallbackEvent.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tetheroffload; +@Backing(type="int") @VintfStability +enum OffloadCallbackEvent { + OFFLOAD_STARTED = 1, + OFFLOAD_STOPPED_ERROR = 2, + OFFLOAD_STOPPED_UNSUPPORTED = 3, + OFFLOAD_SUPPORT_AVAILABLE = 4, + OFFLOAD_STOPPED_LIMIT_REACHED = 5, + OFFLOAD_WARNING_REACHED = 6, +} diff --git a/tetheroffload/aidl/android/hardware/tetheroffload/ForwardedStats.aidl b/tetheroffload/aidl/android/hardware/tetheroffload/ForwardedStats.aidl new file mode 100644 index 0000000000..d2fe49b494 --- /dev/null +++ b/tetheroffload/aidl/android/hardware/tetheroffload/ForwardedStats.aidl @@ -0,0 +1,26 @@ +/* + * 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. + */ + +package android.hardware.tetheroffload; + +@VintfStability +parcelable ForwardedStats { + /** + * Tx/Rx forwarded bytes + */ + long rxBytes; + long txBytes; +} diff --git a/tetheroffload/aidl/android/hardware/tetheroffload/IOffload.aidl b/tetheroffload/aidl/android/hardware/tetheroffload/IOffload.aidl new file mode 100644 index 0000000000..30b2c8d8aa --- /dev/null +++ b/tetheroffload/aidl/android/hardware/tetheroffload/IOffload.aidl @@ -0,0 +1,284 @@ +/* + * 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. + */ + +package android.hardware.tetheroffload; + +import android.hardware.tetheroffload.ForwardedStats; +import android.hardware.tetheroffload.ITetheringOffloadCallback; + +/** + * Interface used to control tethering offload. + */ +@VintfStability +interface IOffload { + /** + * Error code for all {@code ServiceSpecificException}s thrown by this interface. + */ + const int ERROR_CODE_UNUSED = 0; + + /** + * Indicates intent to start offload for tethering in immediate future. + * + * This API must be called exactly once the first time that Tethering is requested by + * the user. + * + * If this API is called multiple times without first calling stopOffload, then the subsequent + * calls must fail without changing the state of the server. + * + * If for some reason, the hardware is currently unable to support offload, this call must fail. + * + * @param fd1 A file descriptor bound to the following netlink groups + * (NF_NETLINK_CONNTRACK_NEW | NF_NETLINK_CONNTRACK_DESTROY). + * @param fd2 A file descriptor bound to the following netlink groups + * (NF_NETLINK_CONNTRACK_UPDATE | NF_NETLINK_CONNTRACK_DESTROY). + * @param cb Assuming success, this callback must provide unsolicited updates of offload status. + * It is assumed to be valid until stopOffload is called. + * + * @throws: + * - EX_ILLEGAL_ARGUMENT if any file descriptors are invalid. + * - EX_ILLEGAL_STATE if this method previously succeeded and stopOffload() was not + * later called. + * - EX_SERVICE_SPECIFIC with the error message set to a human-readable reason for the + * error. + * + * Remarks: Initializing offload does not imply that any upstreams or downstreams have yet been, + * or even will be, chosen. This API is symmetrical with stopOffload. + */ + void initOffload(in ParcelFileDescriptor fd1, in ParcelFileDescriptor fd2, + in ITetheringOffloadCallback cb); + + /** + * Indicate desire to tear down all tethering offload. + * + * Called after tethering is no longer requested by the user. Any remaining offload must + * be subsequently torn down by the management process. Upon success, the callback registered + * in initOffload must be released, and offload must be stopped. + * + * @throws: + * - EX_ILLEGAL_STATE if initOffload() was not called, or if stopOffload() was already + * called. + * - EX_SERVICE_SPECIFIC with the error message set to a human-readable reason for the + * error. + * + * Remarks: Statistics must be reset by this API. + */ + void stopOffload(); + + /** + * Instruct management process not to forward traffic destined to or from the specified + * prefixes. + * + * This API may only be called after initOffload and before stopOffload. + * + * @param prefixes List containing fully specified prefixes. For e.g. 192.168.1.0/24 + * or 2001:4860:684::/64 + * + * @throws: + * - EX_ILLEGAL_ARGUMENT if the IP prefixes are invalid. + * - EX_ILLEGAL_STATE if this method is called before initOffload(), or if this method + * is called after stopOffload(). + * - EX_SERVICE_SPECIFIC with the error message set to a human-readable reason for the + * error. + * + * Remarks: This list overrides any previously specified list + */ + void setLocalPrefixes(in String[] prefixes); + + /** + * Query offloaded traffic statistics forwarded to an upstream address. + * + * Return statistics that have transpired since the last query. This would include + * statistics from all offloaded downstream tether interfaces that have been forwarded to this + * upstream interface. After returning the statistics, the counters are reset to zero. + * + * Only offloaded statistics must be returned by this API, software stats must not be + * returned. + * + * @param upstream Upstream interface on which traffic exited/entered + * + * @return ForwardedStats depicting the received and transmitted bytes + * + * @throws: + * - EX_SERVICE_SPECIFIC with the error message set to a human-readable reason for the + * error. + */ + ForwardedStats getForwardedStats(in String upstream); + + /** + * Instruct hardware to send callbacks, and possibly stop offload, after certain number of bytes + * have been transferred in either direction on this upstream interface. + * + * The specified quota bytes must be applied to all traffic on the given upstream interface. + * This includes hardware forwarded traffic, software forwarded traffic, and AP-originated + * traffic. IPv4 and IPv6 traffic both count towards the same quota. IP headers are included + * in the byte count quota, but, link-layer headers are not. + * + * This API may only be called while offload is occurring on this upstream. The hardware + * management process MUST NOT store the values when offload is not started and apply them + * once offload is started. This is because the quota values would likely become stale over + * time and would not reflect any new traffic that has occurred. + * + * The specified quota bytes MUST replace any previous quotas set by + * {@code setDataWarningAndLimit} specified on the same interface. It may be interpreted as + * "tell me when either or bytes have been transferred + * (in either direction), and stop offload when bytes have been transferred, + * starting now and counting from zero on ." + * + * Once the {@code warningBytes} is reached, the callback registered in initOffload must be + * called with {@code OFFLOAD_WARNING_REACHED} to indicate this event. Once the event fires + * for this upstream, no further {@code OFFLOAD_WARNING_REACHED} event will be fired for this + * upstream unless this method is called again with the same interface. Note that there is + * no need to call initOffload again to resume offload if stopOffload was not called by the + * client. + * + * Similarly, Once the {@code limitBytes} is reached, the callback registered in initOffload + * must be called with {@code OFFLOAD_STOPPED_LIMIT_REACHED} to indicate this event. Once + * the event fires for this upstream, no further {@code OFFLOAD_STOPPED_LIMIT_REACHED} + * event will be fired for this upstream unless this method is called again with the same + * interface. However, unlike {@code warningBytes}, when {@code limitBytes} is reached, + * all offload must be stopped. If offload is desired again, the hardware management + * process must be completely reprogrammed by calling setUpstreamParameters and + * addDownstream again. + * + * Note that {@code warningBytes} must always be less than or equal to {@code limitBytes}, + * when {@code warningBytes} is reached, {@code limitBytes} may still valid unless this method + * is called again with the same interface. + * + * @param upstream Upstream interface name that quota must apply to. + * @param warningBytes The quota of warning, defined as the number of bytes, starting from + * zero and counting from now. + * @param limitBytes The quota of limit, defined as the number of bytes, starting from zero + * and counting from now. + * + * @throws: + * - EX_ILLEGAL_ARGUMENT if any parameters are invalid (such as invalid upstream + * or negative number of bytes). + * - EX_ILLEGAL_STATE if this method is called before initOffload(), or if this method + * is called after stopOffload(). + * - EX_UNSUPPORTED_OPERATION if it is not supported. + * - EX_SERVICE_SPECIFIC with the error message set to a human-readable reason for the + * error. + */ + void setDataWarningAndLimit(in String upstream, in long warningBytes, in long limitBytes); + + /** + * Instruct hardware to start forwarding traffic to the specified upstream. + * + * When iface, v4Addr, and v4Gw are all non-null, the management process may begin forwarding + * any currently configured or future configured IPv4 downstreams to this upstream interface. + * + * If any of the previously three mentioned parameters are null, then any current IPv4 offload + * must be stopped. + * + * When iface and v6Gws are both non-null, and in the case of v6Gws, are not empty, the + * management process may begin forwarding any currently configured or future configured IPv6 + * downstreams to this upstream interface. + * + * If either of the two above parameters are null, or no V6 Gateways are provided, then IPv6 + * offload must be stopped. + * + * This API may only be called after initOffload and before stopOffload. + * + * @param iface Upstream interface name. Note that only one is needed because IPv4 and IPv6 + * interfaces cannot be different (only known that this can occur during software + * xlat, which cannot be offloaded through hardware anyways). If the iface is + * null, offload must be stopped. + * @param v4Addr The local IPv4 address assigned to the provided upstream interface, i.e. the + * IPv4 address the packets are NATed to. For e.g. 192.168.0.12. + * @param v4Gw The IPv4 address of the IPv4 gateway on the upstream interface. + * For e.g. 192.168.1.1 + * @param v6Gws A list of IPv6 addresses (for e.g. fe80::97be:9de7:b24b:9194) for possible IPv6 + * gateways on the upstream interface. + * + * @throws: + * - EX_ILLEGAL_ARGUMENT if any parameters are invalid (such as invalid upstream + * or IP addresses). + * - EX_ILLEGAL_STATE if this method is called before initOffload(), or if this method + * is called after stopOffload(). + * - EX_SERVICE_SPECIFIC with the error message set to a human-readable reason for the + * error. + * + * Remarks: This overrides any previously configured parameters. + */ + void setUpstreamParameters( + in String iface, in String v4Addr, in String v4Gw, in String[] v6Gws); + + /** + * Configure a downstream interface and prefix in the hardware management process that may be + * forwarded. + * + * The prefix may be an IPv4 or an IPv6 prefix to signify which family can be offloaded from + * the specified tether interface. The list of IPv4 and IPv6 downstreams that are configured + * may differ. + * + * If the given protocol, as determined by the prefix, has an upstream set, + * the hardware may begin forwarding traffic between the upstream and any devices on the + * downstream interface that have IP addresses within the specified prefix. Other traffic from + * the same downstream interfaces is unaffected and must be forwarded if and only if it was + * already being forwarded. + * + * If no upstream is currently configured, then these downstream interface and prefixes must be + * preserved so that offload may begin in the future when an upstream is set. + * + * This API does not replace any previously configured downstreams and any such downstreams must + * be explicitly removed by calling removeDownstream. + * + * This API may only be called after initOffload and before stopOffload. + * + * @param iface Downstream interface + * @param prefix Downstream prefix depicting addresses that may be offloaded. + * For e.g. 192.168.1.0/24 or 2001:4860:684::/64) + * + * @throws: + * - EX_ILLEGAL_ARGUMENT if any parameters are invalid (such as invalid downstream + * or IP prefix). + * - EX_ILLEGAL_STATE if this method is called before initOffload(), or if this method + * is called after stopOffload(). + * - EX_SERVICE_SPECIFIC with the error message set to a human-readable reason for the + * error. + * + * Remarks: The hardware management process may fail this call in a normal situation. This can + * happen because the hardware cannot support the current number of prefixes, the + * hardware cannot support concurrent offload on multiple interfaces, the hardware + * cannot currently support offload on the tether interface for some reason, or any + * other dynamic configuration issues which may occur. In this case, + * traffic must remain unaffected and must be forwarded if and only if it was already + * being forwarded. + */ + void addDownstream(in String iface, in String prefix); + + /** + * Remove a downstream prefix that may be forwarded from the hardware management process. + * + * The prefix may be an IPv4 or an IPv6 prefix. If it was not previously configured using + * addDownstream, then this must be a no-op. + * + * This API may only be called after initOffload and before stopOffload. + * + * @param iface Downstream interface + * @param prefix Downstream prefix depicting address that must no longer be offloaded + * For e.g. 192.168.1.0/24 or 2001:4860:684::/64) + * + * @throws: + * - EX_ILLEGAL_ARGUMENT if any parameters are invalid (such as invalid downstream + * or IP prefix). + * - EX_ILLEGAL_STATE if this method is called before initOffload(), or if this method + * is called after stopOffload(). + * - EX_SERVICE_SPECIFIC with the error message set to a human-readable reason for the + * error. + */ + void removeDownstream(in String iface, in String prefix); +} diff --git a/tetheroffload/aidl/android/hardware/tetheroffload/IPv4AddrPortPair.aidl b/tetheroffload/aidl/android/hardware/tetheroffload/IPv4AddrPortPair.aidl new file mode 100644 index 0000000000..16d7d85b80 --- /dev/null +++ b/tetheroffload/aidl/android/hardware/tetheroffload/IPv4AddrPortPair.aidl @@ -0,0 +1,26 @@ +/* + * 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. + */ + +package android.hardware.tetheroffload; + +@VintfStability +parcelable IPv4AddrPortPair { + /** + * IPv4 Address and Port + */ + String addr; + int port; +} diff --git a/tetheroffload/aidl/android/hardware/tetheroffload/ITetheringOffloadCallback.aidl b/tetheroffload/aidl/android/hardware/tetheroffload/ITetheringOffloadCallback.aidl new file mode 100644 index 0000000000..5ee819b7cd --- /dev/null +++ b/tetheroffload/aidl/android/hardware/tetheroffload/ITetheringOffloadCallback.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ + +package android.hardware.tetheroffload; + +import android.hardware.tetheroffload.NatTimeoutUpdate; +import android.hardware.tetheroffload.OffloadCallbackEvent; + +/** + * Callback providing information about status of hardware management process + * as well as providing a way to keep offloaded connections from timing out. + */ +@VintfStability +oneway interface ITetheringOffloadCallback { + /** + * Called when an asynchronous event is generated by the hardware + * management process. + */ + void onEvent(in OffloadCallbackEvent event); + + /** + * Provide a way for the management process to request that a connections + * timeout be updated in kernel. + * + * This is necessary to ensure that offloaded traffic is not cleaned up + * by the kernel connection tracking module for IPv4. + */ + void updateTimeout(in NatTimeoutUpdate params); +} diff --git a/tetheroffload/aidl/android/hardware/tetheroffload/NatTimeoutUpdate.aidl b/tetheroffload/aidl/android/hardware/tetheroffload/NatTimeoutUpdate.aidl new file mode 100644 index 0000000000..50805ef25e --- /dev/null +++ b/tetheroffload/aidl/android/hardware/tetheroffload/NatTimeoutUpdate.aidl @@ -0,0 +1,27 @@ +/* + * 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. + */ + +package android.hardware.tetheroffload; + +import android.hardware.tetheroffload.IPv4AddrPortPair; +import android.hardware.tetheroffload.NetworkProtocol; + +@VintfStability +parcelable NatTimeoutUpdate { + IPv4AddrPortPair src; + IPv4AddrPortPair dst; + NetworkProtocol proto; +} diff --git a/tetheroffload/aidl/android/hardware/tetheroffload/NetworkProtocol.aidl b/tetheroffload/aidl/android/hardware/tetheroffload/NetworkProtocol.aidl new file mode 100644 index 0000000000..cc4f7acbc0 --- /dev/null +++ b/tetheroffload/aidl/android/hardware/tetheroffload/NetworkProtocol.aidl @@ -0,0 +1,24 @@ +/* + * 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. + */ + +package android.hardware.tetheroffload; + +@VintfStability +@Backing(type="int") +enum NetworkProtocol { + TCP = 6, + UDP = 17, +} diff --git a/tetheroffload/aidl/android/hardware/tetheroffload/OffloadCallbackEvent.aidl b/tetheroffload/aidl/android/hardware/tetheroffload/OffloadCallbackEvent.aidl new file mode 100644 index 0000000000..a95f67495f --- /dev/null +++ b/tetheroffload/aidl/android/hardware/tetheroffload/OffloadCallbackEvent.aidl @@ -0,0 +1,64 @@ +/* + * 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. + */ + +package android.hardware.tetheroffload; + +@VintfStability +@Backing(type="int") +enum OffloadCallbackEvent { + /** + * Indicate that a working configuration has been programmed and the + * hardware management process has begun forwarding traffic. + */ + OFFLOAD_STARTED = 1, + /** + * Indicate that an error has occurred which has disrupted hardware + * acceleration. Software routing may still be attempted; however, + * statistics may be temporarily unavailable. Statistics may be recovered + * after OFFLOAD_SUPPORT_AVAILABLE event is fired. + */ + OFFLOAD_STOPPED_ERROR = 2, + /** + * Indicate that the device has moved to a RAT on which hardware + * acceleration is not supported. Subsequent calls to setUpstreamParameters + * and add/removeDownstream will likely fail and cannot be presumed to be + * saved inside of the hardware management process. Upon receiving + * OFFLOAD_SUPPORT_AVAILABLE, the client may reprogram the hardware + * management process to begin offload again. + */ + OFFLOAD_STOPPED_UNSUPPORTED = 3, + /** + * Indicate that the hardware management process is willing and able to + * provide support for hardware acceleration at this time. If applicable, + * the client may query for statistics. If offload is desired, the client + * must reprogram the hardware management process. + */ + OFFLOAD_SUPPORT_AVAILABLE = 4, + /** + * Hardware acceleration is no longer in effect and must be reprogrammed + * in order to resume. This event is fired when the limit, applied in + * setDataLimit, has expired. It is recommended that the client query for + * statistics immediately after receiving this event. + */ + OFFLOAD_STOPPED_LIMIT_REACHED = 5, + /** + * This event is fired when the quota, applied in setDataWarning, has expired. It is + * recommended that the client query for statistics immediately after receiving this event. + * Any offloaded traffic will continue to be offloaded until offload is stopped or + * OFFLOAD_STOPPED_LIMIT_REACHED is sent. + */ + OFFLOAD_WARNING_REACHED = 6, +} diff --git a/tetheroffload/aidl/default/Android.bp b/tetheroffload/aidl/default/Android.bp new file mode 100644 index 0000000000..8f0739c3d9 --- /dev/null +++ b/tetheroffload/aidl/default/Android.bp @@ -0,0 +1,36 @@ +// 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. + +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_binary { + name: "android.hardware.tetheroffload-service.example", + relative_install_path: "hw", + init_rc: ["tetheroffload-example.rc"], + vintf_fragments: ["tetheroffload-example.xml"], + vendor: true, + shared_libs: [ + "android.hardware.tetheroffload-V1-ndk", + "libbase", + "libbinder_ndk", + "libcutils", + "libutils", + ], + srcs: [ + "main.cpp", + "Offload.cpp", + ], +} diff --git a/tetheroffload/aidl/default/Offload.cpp b/tetheroffload/aidl/default/Offload.cpp new file mode 100644 index 0000000000..8aa6916fc0 --- /dev/null +++ b/tetheroffload/aidl/default/Offload.cpp @@ -0,0 +1,246 @@ +/* + * 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. + */ + +#include +#include + +#include +#include +#include + +#include "Offload.h" + +namespace aidl::android::hardware::tetheroffload::impl::example { + +using ::android::base::Join; + +ndk::ScopedAStatus Offload::addDownstream(const std::string& in_iface, + const std::string& in_prefix) { + LOG(VERBOSE) << __func__ << " Interface: " << in_iface << ", Prefix: " << in_prefix; + if (!isInitialized()) { + return ndk::ScopedAStatus::fromExceptionCodeWithMessage( + EX_ILLEGAL_STATE, "Tetheroffload HAL not initialized"); + } + if (!isValidInterface(in_iface)) { + return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, + "Invalid interface name"); + } + if (!isValidIpPrefix(in_prefix)) { + return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, + "Invalid IP prefix"); + } + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Offload::getForwardedStats(const std::string& in_upstream, + ForwardedStats* _aidl_return) { + LOG(VERBOSE) << __func__ << " Upstream: " << in_upstream; + ForwardedStats stats; + stats.rxBytes = 0; + stats.txBytes = 0; + *_aidl_return = std::move(stats); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Offload::initOffload(const ndk::ScopedFileDescriptor& in_fd1, + const ndk::ScopedFileDescriptor& in_fd2, + const std::shared_ptr& in_cb) { + LOG(VERBOSE) << __func__ << " FileDescriptor1: " << std::to_string(in_fd1.get()) + << ", FileDescriptor2: " << std::to_string(in_fd2.get()) + << ", ITetheringOffloadCallback: " << in_cb; + if (isInitialized()) { + return ndk::ScopedAStatus::fromExceptionCodeWithMessage( + EX_ILLEGAL_STATE, "Tetheroffload HAL already initialized"); + } + int fd1 = in_fd1.get(); + int fd2 = in_fd2.get(); + if (fd1 < 0 || fd2 < 0) { + return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, + "Invalid file descriptors"); + } + mFd1 = ndk::ScopedFileDescriptor(dup(fd1)); + mFd2 = ndk::ScopedFileDescriptor(dup(fd2)); + mInitialized = true; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Offload::removeDownstream(const std::string& in_iface, + const std::string& in_prefix) { + LOG(VERBOSE) << __func__ << " Interface: " << in_iface << ", Prefix: " << in_prefix; + if (!isInitialized()) { + return ndk::ScopedAStatus::fromExceptionCodeWithMessage( + EX_ILLEGAL_STATE, "Tetheroffload HAL not initialized"); + } + if (!isValidIpPrefix(in_prefix)) { + return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, + "Invalid IP prefix"); + } + if (!isValidInterface(in_iface)) { + return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, + "Invalid interface name"); + } + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Offload::setDataWarningAndLimit(const std::string& in_upstream, + int64_t in_warningBytes, int64_t in_limitBytes) { + LOG(VERBOSE) << __func__ << " Upstream: " << in_upstream + << ", WarningBytes: " << in_warningBytes << ", LimitBytes: " << in_limitBytes; + if (!isInitialized()) { + return ndk::ScopedAStatus::fromExceptionCodeWithMessage( + EX_ILLEGAL_STATE, "Tetheroffload HAL not initialized"); + } + if (!isValidInterface(in_upstream)) { + return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, + "Invalid interface name"); + } + if (in_warningBytes < 0 || in_limitBytes < 0) { + return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, + "Threshold must be non-negative"); + } + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Offload::setLocalPrefixes(const std::vector& in_prefixes) { + LOG(VERBOSE) << __func__ << " Prefixes: " << Join(in_prefixes, ','); + if (!isInitialized()) { + return ndk::ScopedAStatus::fromExceptionCodeWithMessage( + EX_ILLEGAL_STATE, "Tetheroffload HAL not initialized"); + } + if (in_prefixes.empty()) { + return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, + "No IP prefix"); + } + for (std::string prefix : in_prefixes) { + if (!isValidIpPrefix(prefix)) { + return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, + "Invalid IP prefix"); + } + } + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Offload::setUpstreamParameters(const std::string& in_iface, + const std::string& in_v4Addr, + const std::string& in_v4Gw, + const std::vector& in_v6Gws) { + LOG(VERBOSE) << __func__ << " Interface: " << in_iface << ", IPv4Address: " << in_v4Addr + << ", IPv4Gateway: " << in_v4Gw << ", IPv6Gateways: " << Join(in_v6Gws, ','); + if (!isInitialized()) { + return ndk::ScopedAStatus::fromExceptionCodeWithMessage( + EX_ILLEGAL_STATE, "Tetheroffload HAL not initialized"); + } + if (!isValidInterface(in_iface)) { + return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, + "Invalid interface name"); + } + if (in_v4Addr.empty() && in_v4Gw.empty() && in_v6Gws.empty()) { + return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, + "No upstream IP address"); + } + if (!in_v4Addr.empty() && !in_v4Gw.empty()) { + if (!isValidIpv4Address(in_v4Addr) || !isValidIpv4Address(in_v4Gw)) { + return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, + "Invalid IP address"); + } + } + for (std::string ip : in_v6Gws) { + if (!isValidIpv6Address(ip)) { + return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, + "Invalid IP address"); + } + } + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Offload::stopOffload() { + LOG(VERBOSE) << __func__; + if (!isInitialized()) { + return ndk::ScopedAStatus::fromExceptionCodeWithMessage( + EX_ILLEGAL_STATE, "Tetheroffload HAL not initialized"); + } + mInitialized = false; + return ndk::ScopedAStatus::ok(); +}; + +bool Offload::isInitialized() { + return (mInitialized == true); +} + +bool Offload::isValidInterface(const std::string& iface) { + return !iface.empty() && iface != "invalid"; +} + +bool Offload::isValidIpv4Address(const std::string& repr) { + return validateIpAddressOrPrefix(repr, AF_INET, false); +} + +bool Offload::isValidIpv4Prefix(const std::string& repr) { + return validateIpAddressOrPrefix(repr, AF_INET, true); +} + +bool Offload::isValidIpv6Address(const std::string& repr) { + return validateIpAddressOrPrefix(repr, AF_INET6, false); +} + +bool Offload::isValidIpv6Prefix(const std::string& repr) { + return validateIpAddressOrPrefix(repr, AF_INET6, true); +} + +bool Offload::isValidIpAddress(const std::string& repr) { + return isValidIpv4Address(repr) || isValidIpv6Address(repr); +} + +bool Offload::isValidIpPrefix(const std::string& repr) { + return isValidIpv4Prefix(repr) || isValidIpv6Prefix(repr); +} + +// Refer to libnetdutils's IPAddress and IPPrefix classes. +// Can't use them directly because libnetdutils is not "vendor_available". +bool Offload::validateIpAddressOrPrefix(const std::string& repr, const int expectedFamily, + const bool isPrefix) { + const addrinfo hints = { + .ai_flags = AI_NUMERICHOST | AI_NUMERICSERV, + }; + addrinfo* res; + size_t index = repr.find('/'); + if (isPrefix && index == std::string::npos) return false; + + // Parse the IP address. + const std::string ipAddress = isPrefix ? repr.substr(0, index) : repr; + const int ret = getaddrinfo(ipAddress.c_str(), nullptr, &hints, &res); + if (ret != 0) return false; + + // Check the address family. + int family = res[0].ai_family; + freeaddrinfo(res); + if (family != expectedFamily) return false; + if (!isPrefix) return true; + + // Parse the prefix length. + const char* prefixString = repr.c_str() + index + 1; + if (!isdigit(*prefixString)) return false; + char* endptr; + unsigned long prefixlen = strtoul(prefixString, &endptr, 10); + if (*endptr != '\0') return false; + + uint8_t maxlen = (family == AF_INET) ? 32 : 128; + if (prefixlen > maxlen) return false; + + return true; +} + +} // namespace aidl::android::hardware::tetheroffload::impl::example diff --git a/tetheroffload/aidl/default/Offload.h b/tetheroffload/aidl/default/Offload.h new file mode 100644 index 0000000000..a1f6bce51f --- /dev/null +++ b/tetheroffload/aidl/default/Offload.h @@ -0,0 +1,74 @@ +/* + * 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. + */ + +#pragma once + +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace tetheroffload { +namespace impl { +namespace example { + +using aidl::android::hardware::tetheroffload::ForwardedStats; +using aidl::android::hardware::tetheroffload::ITetheringOffloadCallback; + +class Offload : public BnOffload { + public: + ndk::ScopedAStatus addDownstream(const std::string& in_iface, + const std::string& in_prefix) override; + ndk::ScopedAStatus getForwardedStats(const std::string& in_upstream, + ForwardedStats* _aidl_return) override; + ndk::ScopedAStatus initOffload( + const ndk::ScopedFileDescriptor& in_fd1, const ndk::ScopedFileDescriptor& in_fd2, + const std::shared_ptr& in_cb) override; + ndk::ScopedAStatus removeDownstream(const std::string& in_iface, + const std::string& in_prefix) override; + ndk::ScopedAStatus setDataWarningAndLimit(const std::string& in_upstream, + int64_t in_warningBytes, + int64_t in_limitBytes) override; + ndk::ScopedAStatus setLocalPrefixes(const std::vector& in_prefixes) override; + ndk::ScopedAStatus setUpstreamParameters(const std::string& in_iface, + const std::string& in_v4Addr, + const std::string& in_v4Gw, + const std::vector& in_v6Gws) override; + ndk::ScopedAStatus stopOffload() override; + + private: + bool isInitialized(); + bool isValidInterface(const std::string& iface); + bool isValidIpv4Address(const std::string& repr); + bool isValidIpv4Prefix(const std::string& repr); + bool isValidIpv6Address(const std::string& repr); + bool isValidIpv6Prefix(const std::string& repr); + bool isValidIpAddress(const std::string& repr); + bool isValidIpPrefix(const std::string& repr); + bool validateIpAddressOrPrefix(const std::string& repr, const int expectedFamily, + const bool isPrefix); + + bool mInitialized = false; + ndk::ScopedFileDescriptor mFd1; + ndk::ScopedFileDescriptor mFd2; +}; + +} // namespace example +} // namespace impl +} // namespace tetheroffload +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/tetheroffload/aidl/default/main.cpp b/tetheroffload/aidl/default/main.cpp new file mode 100644 index 0000000000..663363038f --- /dev/null +++ b/tetheroffload/aidl/default/main.cpp @@ -0,0 +1,35 @@ +/* + * 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. + */ + +#include "Offload.h" + +#include +#include +#include + +using aidl::android::hardware::tetheroffload::impl::example::Offload; + +int main() { + ABinderProcess_setThreadPoolMaxThreadCount(0); + std::shared_ptr offload = ndk::SharedRefBase::make(); + + binder_status_t status = AServiceManager_addService( + offload->asBinder().get(), Offload::makeServiceName("default").c_str()); + CHECK_EQ(status, STATUS_OK); + + ABinderProcess_joinThreadPool(); + return EXIT_FAILURE; // should not reach +} diff --git a/tetheroffload/aidl/default/tetheroffload-example.rc b/tetheroffload/aidl/default/tetheroffload-example.rc new file mode 100644 index 0000000000..46cda61d02 --- /dev/null +++ b/tetheroffload/aidl/default/tetheroffload-example.rc @@ -0,0 +1,4 @@ +service vendor.tetheroffload-example /vendor/bin/hw/android.hardware.tetheroffload-service.example + class hal + user nobody + group nobody diff --git a/tetheroffload/aidl/default/tetheroffload-example.xml b/tetheroffload/aidl/default/tetheroffload-example.xml new file mode 100644 index 0000000000..9fe83f6c6e --- /dev/null +++ b/tetheroffload/aidl/default/tetheroffload-example.xml @@ -0,0 +1,7 @@ + + + android.hardware.tetheroffload + 1 + IOffload/default + + diff --git a/tetheroffload/aidl/vts/functional/Android.bp b/tetheroffload/aidl/vts/functional/Android.bp new file mode 100644 index 0000000000..c9c184568d --- /dev/null +++ b/tetheroffload/aidl/vts/functional/Android.bp @@ -0,0 +1,24 @@ +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_test { + name: "VtsHalTetheroffloadTargetTest", + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + srcs: [ + "VtsHalTetheroffloadTargetTest.cpp", + ], + shared_libs: [ + "libbinder_ndk", + ], + static_libs: [ + "android.hardware.tetheroffload-V1-ndk", + "libgmock_ndk", + ], + test_suites: [ + "vts", + ], +} diff --git a/tetheroffload/aidl/vts/functional/VtsHalTetheroffloadTargetTest.cpp b/tetheroffload/aidl/vts/functional/VtsHalTetheroffloadTargetTest.cpp new file mode 100644 index 0000000000..fc8abbd2f6 --- /dev/null +++ b/tetheroffload/aidl/vts/functional/VtsHalTetheroffloadTargetTest.cpp @@ -0,0 +1,689 @@ +/* + * 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. + */ + +#define LOG_TAG "tetheroffload_aidl_hal_test" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace aidl::android::hardware::tetheroffload { + +namespace { + +using ::android::base::unique_fd; +using android::hardware::tetheroffload::ForwardedStats; +using android::hardware::tetheroffload::IOffload; +using android::hardware::tetheroffload::NatTimeoutUpdate; +using android::hardware::tetheroffload::OffloadCallbackEvent; +using ::testing::AnyOf; +using ::testing::Eq; + +const std::string TEST_IFACE = "rmnet_data0"; +const unsigned kFd1Groups = NF_NETLINK_CONNTRACK_NEW | NF_NETLINK_CONNTRACK_DESTROY; +const unsigned kFd2Groups = NF_NETLINK_CONNTRACK_UPDATE | NF_NETLINK_CONNTRACK_DESTROY; + +enum class ExpectBoolean { + Ignored = -1, + False = 0, + True = 1, +}; + +inline const sockaddr* asSockaddr(const sockaddr_nl* nladdr) { + return reinterpret_cast(nladdr); +} + +int netlinkSocket(int protocol, unsigned groups) { + unique_fd s(socket(AF_NETLINK, SOCK_DGRAM, protocol)); + if (s.get() < 0) { + return -errno; + } + + const struct sockaddr_nl bind_addr = { + .nl_family = AF_NETLINK, + .nl_pad = 0, + .nl_pid = 0, + .nl_groups = groups, + }; + if (bind(s.get(), asSockaddr(&bind_addr), sizeof(bind_addr)) != 0) { + return -errno; + } + + const struct sockaddr_nl kernel_addr = { + .nl_family = AF_NETLINK, + .nl_pad = 0, + .nl_pid = 0, + .nl_groups = groups, + }; + if (connect(s.get(), asSockaddr(&kernel_addr), sizeof(kernel_addr)) != 0) { + return -errno; + } + + return s.release(); +} + +int netlinkSocket(unsigned groups) { + return netlinkSocket(NETLINK_NETFILTER, groups); +} + +// Check whether the specified interface is up. +bool interfaceIsUp(const std::string name) { + struct ifreq ifr = {}; + strlcpy(ifr.ifr_name, name.c_str(), sizeof(ifr.ifr_name)); + int sock = socket(AF_INET6, SOCK_DGRAM, 0); + if (sock == -1) return false; + int ret = ioctl(sock, SIOCGIFFLAGS, &ifr, sizeof(ifr)); + close(sock); + return (ret == 0) && (ifr.ifr_flags & IFF_UP); +} + +// Callback class for both events and NAT timeout updates. +class TetheringOffloadCallback : public BnTetheringOffloadCallback { + public: + ndk::ScopedAStatus onEvent(OffloadCallbackEvent in_event) override { + auto lock = std::lock_guard{mMutex}; + mOnEventInvoked = true; + mLastEvent = in_event; + mNotifyCv.notify_all(); + return ndk::ScopedAStatus::ok(); + } + + ndk::ScopedAStatus updateTimeout(const NatTimeoutUpdate& in_params) override { + auto lock = std::lock_guard{mMutex}; + mOnUpdateTimeoutInvoked = true; + mNatTimeout = in_params; + mNotifyCv.notify_all(); + return ndk::ScopedAStatus::ok(); + } + + private: + std::mutex mMutex; + std::condition_variable mNotifyCv; + OffloadCallbackEvent mLastEvent; + NatTimeoutUpdate mNatTimeout; + bool mOnEventInvoked = false; + bool mOnUpdateTimeoutInvoked = false; +}; + +// The common base class for tetheroffload AIDL HAL tests. +class TetheroffloadAidlTestBase : public testing::TestWithParam { + public: + virtual void SetUp() override { getService(); } + virtual void TearDown() override { + // For good measure, the teardown should try stopOffload() once more, since + // different HAL call test cycles might enter this function. Also the + // return code cannot be actually expected for all cases, hence ignore it. + stopOffload(ExpectBoolean::Ignored); + }; + + protected: + void getService() { + AIBinder* binder = AServiceManager_waitForService(GetParam().c_str()); + ASSERT_NE(binder, nullptr); + mOffload = IOffload::fromBinder(ndk::SpAIBinder(binder)); + } + + void initOffload(const bool expectedResult) { + unique_fd ufd1(netlinkSocket(kFd1Groups)); + if (ufd1.get() < 0) { + ALOGE("Unable to create conntrack sockets: %d/%s", errno, strerror(errno)); + FAIL(); + } + ndk::ScopedFileDescriptor fd1 = ndk::ScopedFileDescriptor(ufd1.release()); + + unique_fd ufd2(netlinkSocket(kFd2Groups)); + if (ufd2.get() < 0) { + ALOGE("Unable to create conntrack sockets: %d/%s", errno, strerror(errno)); + FAIL(); + } + ndk::ScopedFileDescriptor fd2 = ndk::ScopedFileDescriptor(ufd2.release()); + + mTetheringOffloadCallback = ndk::SharedRefBase::make(); + ASSERT_NE(mTetheringOffloadCallback, nullptr) << "Could not get offload callback"; + + ASSERT_EQ(mOffload->initOffload(fd1, fd2, mTetheringOffloadCallback).getExceptionCode(), + expectedResult ? EX_NONE : EX_ILLEGAL_STATE); + } + + void stopOffload(const ExpectBoolean expectedResult) { + ndk::ScopedAStatus status = mOffload->stopOffload(); + if (expectedResult == ExpectBoolean::Ignored) return; + ASSERT_EQ(status.getExceptionCode(), + expectedResult == ExpectBoolean::True ? EX_NONE : EX_ILLEGAL_STATE); + } + + std::shared_ptr mOffload; + std::shared_ptr mTetheringOffloadCallback; +}; + +// The test class for tetheroffload before initialization. +class TetheroffloadAidlPreInitTest : public TetheroffloadAidlTestBase { + public: + virtual void SetUp() override { getService(); } +}; + +// The main test class for tetheroffload AIDL HAL. +class TetheroffloadAidlGeneralTest : public TetheroffloadAidlTestBase { + public: + virtual void SetUp() override { + getService(); + initOffload(true); + } +}; + +// Passing invalid file descriptor to initOffload() should return an error. +// Check that this occurs when both FDs are empty. +TEST_P(TetheroffloadAidlPreInitTest, TestInitOffloadInvalidFdsReturnsError) { + ndk::ScopedFileDescriptor fd1 = ndk::ScopedFileDescriptor(-1); + ndk::ScopedFileDescriptor fd2 = ndk::ScopedFileDescriptor(-1); + mTetheringOffloadCallback = ndk::SharedRefBase::make(); + ASSERT_NE(mTetheringOffloadCallback, nullptr) << "Could not get offload callback"; + EXPECT_THAT(mOffload->initOffload(fd1, fd2, mTetheringOffloadCallback).getExceptionCode(), + AnyOf(Eq(EX_ILLEGAL_ARGUMENT), Eq(EX_TRANSACTION_FAILED))); +} + +// Passing invalid file descriptor to initOffload() should return an error. +// Check that this occurs when FD1 is empty. +TEST_P(TetheroffloadAidlPreInitTest, TestInitOffloadInvalidFd1ReturnsError) { + ndk::ScopedFileDescriptor fd1 = ndk::ScopedFileDescriptor(-1); + unique_fd ufd2(netlinkSocket(kFd2Groups)); + if (ufd2.get() < 0) { + ALOGE("Unable to create conntrack sockets: %d/%s", errno, strerror(errno)); + FAIL(); + } + ndk::ScopedFileDescriptor fd2 = ndk::ScopedFileDescriptor(ufd2.release()); + mTetheringOffloadCallback = ndk::SharedRefBase::make(); + ASSERT_NE(mTetheringOffloadCallback, nullptr) << "Could not get offload callback"; + EXPECT_THAT(mOffload->initOffload(fd1, fd2, mTetheringOffloadCallback).getExceptionCode(), + AnyOf(Eq(EX_ILLEGAL_ARGUMENT), Eq(EX_TRANSACTION_FAILED))); +} + +// Passing invalid file descriptor to initOffload() should return an error. +// Check that this occurs when FD2 is empty. +TEST_P(TetheroffloadAidlPreInitTest, TestInitOffloadInvalidFd2ReturnsError) { + unique_fd ufd1(netlinkSocket(kFd1Groups)); + if (ufd1.get() < 0) { + ALOGE("Unable to create conntrack sockets: %d/%s", errno, strerror(errno)); + FAIL(); + } + ndk::ScopedFileDescriptor fd1 = ndk::ScopedFileDescriptor(ufd1.release()); + ndk::ScopedFileDescriptor fd2 = ndk::ScopedFileDescriptor(-1); + mTetheringOffloadCallback = ndk::SharedRefBase::make(); + ASSERT_NE(mTetheringOffloadCallback, nullptr) << "Could not get offload callback"; + EXPECT_THAT(mOffload->initOffload(fd1, fd2, mTetheringOffloadCallback).getExceptionCode(), + AnyOf(Eq(EX_ILLEGAL_ARGUMENT), Eq(EX_TRANSACTION_FAILED))); +} + +// Call initOffload() multiple times. Check that non-first initOffload() calls return error. +TEST_P(TetheroffloadAidlPreInitTest, AdditionalInitsWithoutStopReturnError) { + initOffload(true); + initOffload(false); + initOffload(false); + initOffload(false); +} + +// Check that calling stopOffload() without first having called initOffload() returns error. +TEST_P(TetheroffloadAidlPreInitTest, MultipleStopsWithoutInitReturnError) { + stopOffload(ExpectBoolean::False); + stopOffload(ExpectBoolean::False); + stopOffload(ExpectBoolean::False); +} + +// Check that calling stopOffload() after a complete init/stop cycle returns error. +TEST_P(TetheroffloadAidlPreInitTest, AdditionalStopsWithInitReturnError) { + initOffload(true); + // Call setUpstreamParameters() so that "offload" can be reasonably said + // to be both requested and operational. + const std::string iface(TEST_IFACE); + const std::string v4Addr("192.0.0.2"); + const std::string v4Gw("192.0.0.1"); + const std::vector v6Gws{std::string("fe80::db8:1"), std::string("fe80::db8:2")}; + EXPECT_TRUE(mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).isOk()); + if (!interfaceIsUp(TEST_IFACE)) { + return; + } + SCOPED_TRACE("Expecting stopOffload to succeed"); + stopOffload(ExpectBoolean::True); // balance out initOffload(true) + SCOPED_TRACE("Expecting stopOffload to fail the first time"); + stopOffload(ExpectBoolean::False); + SCOPED_TRACE("Expecting stopOffload to fail the second time"); + stopOffload(ExpectBoolean::False); +} + +// Check that calling setLocalPrefixes() without first having called initOffload() returns error. +TEST_P(TetheroffloadAidlPreInitTest, SetLocalPrefixesWithoutInitReturnsError) { + const std::vector prefixes{std::string("2001:db8::/64")}; + EXPECT_EQ(mOffload->setLocalPrefixes(prefixes).getExceptionCode(), EX_ILLEGAL_STATE); +} + +// Check that calling getForwardedStats() without first having called initOffload() +// returns zero bytes statistics. +TEST_P(TetheroffloadAidlPreInitTest, GetForwardedStatsWithoutInitReturnsZeroValues) { + const std::string upstream(TEST_IFACE); + ForwardedStats stats; + EXPECT_TRUE(mOffload->getForwardedStats(upstream, &stats).isOk()); + EXPECT_EQ(stats.rxBytes, 0ULL); + EXPECT_EQ(stats.txBytes, 0ULL); +} + +// Check that calling setDataWarningAndLimit() without first having called initOffload() returns +// error. +TEST_P(TetheroffloadAidlPreInitTest, SetDataWarningAndLimitWithoutInitReturnsError) { + const std::string upstream(TEST_IFACE); + const int64_t warning = 5000LL; + const int64_t limit = 5000LL; + EXPECT_EQ(mOffload->setDataWarningAndLimit(upstream, warning, limit).getExceptionCode(), + EX_ILLEGAL_STATE); +} + +// Check that calling setUpstreamParameters() without first having called initOffload() +// returns error. +TEST_P(TetheroffloadAidlPreInitTest, SetUpstreamParametersWithoutInitReturnsError) { + const std::string iface(TEST_IFACE); + const std::string v4Addr("192.0.2.0/24"); + const std::string v4Gw("192.0.2.1"); + const std::vector v6Gws{std::string("fe80::db8:1")}; + EXPECT_EQ(mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).getExceptionCode(), + EX_ILLEGAL_STATE); +} + +// Check that calling addDownstream() with an IPv4 prefix without first having called +// initOffload() returns error. +TEST_P(TetheroffloadAidlPreInitTest, AddIPv4DownstreamWithoutInitReturnsError) { + const std::string iface(TEST_IFACE); + const std::string prefix("192.0.2.0/24"); + EXPECT_EQ(mOffload->addDownstream(iface, prefix).getExceptionCode(), EX_ILLEGAL_STATE); +} + +// Check that calling addDownstream() with an IPv6 prefix without first having called +// initOffload() returns error. +TEST_P(TetheroffloadAidlPreInitTest, AddIPv6DownstreamWithoutInitReturnsError) { + const std::string iface(TEST_IFACE); + const std::string prefix("2001:db8::/64"); + EXPECT_EQ(mOffload->addDownstream(iface, prefix).getExceptionCode(), EX_ILLEGAL_STATE); +} + +// Check that calling removeDownstream() with an IPv4 prefix without first having called +// initOffload() returns error. +TEST_P(TetheroffloadAidlPreInitTest, RemoveIPv4DownstreamWithoutInitReturnsError) { + const std::string iface(TEST_IFACE); + const std::string prefix("192.0.2.0/24"); + EXPECT_EQ(mOffload->removeDownstream(iface, prefix).getExceptionCode(), EX_ILLEGAL_STATE); +} + +// Check that calling removeDownstream() with an IPv6 prefix without first having called +// initOffload() returns error. +TEST_P(TetheroffloadAidlPreInitTest, RemoveIPv6DownstreamWithoutInitReturnsError) { + const std::string iface(TEST_IFACE); + const std::string prefix("2001:db8::/64"); + EXPECT_EQ(mOffload->removeDownstream(iface, prefix).getExceptionCode(), EX_ILLEGAL_STATE); +} + +/* + * Tests for IOffload::setLocalPrefixes(). + */ + +// Test setLocalPrefixes() rejects an IPv4 address. +TEST_P(TetheroffloadAidlGeneralTest, SetLocalPrefixesIPv4AddressFails) { + const std::vector prefixes{std::string("192.0.2.1")}; + EXPECT_EQ(mOffload->setLocalPrefixes(prefixes).getExceptionCode(), EX_ILLEGAL_ARGUMENT); +} + +// Test setLocalPrefixes() rejects an IPv6 address. +TEST_P(TetheroffloadAidlGeneralTest, SetLocalPrefixesIPv6AddressFails) { + const std::vector prefixes{std::string("fe80::1")}; + EXPECT_EQ(mOffload->setLocalPrefixes(prefixes).getExceptionCode(), EX_ILLEGAL_ARGUMENT); +} + +// Test setLocalPrefixes() accepts both IPv4 and IPv6 prefixes. +TEST_P(TetheroffloadAidlGeneralTest, SetLocalPrefixesIPv4v6PrefixesOk) { + const std::vector prefixes{std::string("192.0.2.0/24"), std::string("fe80::/64")}; + EXPECT_TRUE(mOffload->setLocalPrefixes(prefixes).isOk()); +} + +// Test that setLocalPrefixes() fails given empty input. There is always +// a non-empty set of local prefixes; when all networking interfaces are down +// we still apply {127.0.0.0/8, ::1/128, fe80::/64} here. +TEST_P(TetheroffloadAidlGeneralTest, SetLocalPrefixesEmptyFails) { + const std::vector prefixes{}; + EXPECT_EQ(mOffload->setLocalPrefixes(prefixes).getExceptionCode(), EX_ILLEGAL_ARGUMENT); +} + +// Test setLocalPrefixes() fails on incorrectly formed input strings. +TEST_P(TetheroffloadAidlGeneralTest, SetLocalPrefixesInvalidFails) { + const std::vector prefixes{std::string("192.0.2.0/24"), std::string("invalid")}; + EXPECT_EQ(mOffload->setLocalPrefixes(prefixes).getExceptionCode(), EX_ILLEGAL_ARGUMENT); +} + +/* + * Tests for IOffload::getForwardedStats(). + */ + +// Test that getForwardedStats() for a non-existent upstream yields zero bytes statistics. +TEST_P(TetheroffloadAidlGeneralTest, GetForwardedStatsInvalidUpstreamIface) { + const std::string upstream("invalid"); + ForwardedStats stats; + EXPECT_TRUE(mOffload->getForwardedStats(upstream, &stats).isOk()); + EXPECT_EQ(stats.rxBytes, 0ULL); + EXPECT_EQ(stats.txBytes, 0ULL); +} + +// TEST_IFACE is presumed to exist on the device and be up. No packets +// are ever actually caused to be forwarded. +TEST_P(TetheroffloadAidlGeneralTest, GetForwardedStatsDummyIface) { + const std::string upstream(TEST_IFACE); + ForwardedStats stats; + EXPECT_TRUE(mOffload->getForwardedStats(upstream, &stats).isOk()); + EXPECT_EQ(stats.rxBytes, 0ULL); + EXPECT_EQ(stats.txBytes, 0ULL); +} + +/* + * Tests for IOffload::setDataWarningAndLimit(). + */ + +// Test that setDataWarningAndLimit() for an empty interface name fails. +TEST_P(TetheroffloadAidlGeneralTest, SetDataWarningAndLimitEmptyUpstreamIfaceFails) { + const std::string upstream(""); + const int64_t warning = 12345LL; + const int64_t limit = 67890LL; + EXPECT_THAT(mOffload->setDataWarningAndLimit(upstream, warning, limit).getExceptionCode(), + AnyOf(Eq(EX_ILLEGAL_ARGUMENT), Eq(EX_UNSUPPORTED_OPERATION))); +} + +// TEST_IFACE is presumed to exist on the device and be up. No packets +// are ever actually caused to be forwarded. +TEST_P(TetheroffloadAidlGeneralTest, SetDataWarningAndLimitNonZeroOk) { + const std::string upstream(TEST_IFACE); + const int64_t warning = 4000LL; + const int64_t limit = 5000LL; + EXPECT_THAT(mOffload->setDataWarningAndLimit(upstream, warning, limit).getExceptionCode(), + AnyOf(Eq(EX_NONE), Eq(EX_UNSUPPORTED_OPERATION))); +} + +// TEST_IFACE is presumed to exist on the device and be up. No packets +// are ever actually caused to be forwarded. +TEST_P(TetheroffloadAidlGeneralTest, SetDataWarningAndLimitZeroOk) { + const std::string upstream(TEST_IFACE); + const int64_t warning = 0LL; + const int64_t limit = 0LL; + EXPECT_THAT(mOffload->setDataWarningAndLimit(upstream, warning, limit).getExceptionCode(), + AnyOf(Eq(EX_NONE), Eq(EX_UNSUPPORTED_OPERATION))); +} + +// TEST_IFACE is presumed to exist on the device and be up. No packets +// are ever actually caused to be forwarded. +TEST_P(TetheroffloadAidlGeneralTest, SetDataWarningAndLimitUnlimitedWarningOk) { + const std::string upstream(TEST_IFACE); + const int64_t warning = LLONG_MAX; + const int64_t limit = 5000LL; + EXPECT_TRUE(mOffload->setDataWarningAndLimit(upstream, warning, limit).isOk()); +} + +// Test that setDataWarningAndLimit() with negative thresholds fails. +TEST_P(TetheroffloadAidlGeneralTest, SetDataWarningAndLimitNegativeFails) { + const std::string upstream(TEST_IFACE); + const int64_t warning = -1LL; + const int64_t limit = -1LL; + EXPECT_THAT(mOffload->setDataWarningAndLimit(upstream, warning, limit).getExceptionCode(), + AnyOf(Eq(EX_ILLEGAL_ARGUMENT), Eq(EX_UNSUPPORTED_OPERATION))); +} + +/* + * Tests for IOffload::setUpstreamParameters(). + */ + +// TEST_IFACE is presumed to exist on the device and be up. No packets +// are ever actually caused to be forwarded. +TEST_P(TetheroffloadAidlGeneralTest, SetUpstreamParametersIPv6OnlyOk) { + const std::string iface(TEST_IFACE); + const std::string v4Addr(""); + const std::string v4Gw(""); + const std::vector v6Gws{std::string("fe80::db8:1"), std::string("fe80::db8:2")}; + EXPECT_TRUE(mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).isOk()); +} + +// TEST_IFACE is presumed to exist on the device and be up. No packets +// are ever actually caused to be forwarded. +TEST_P(TetheroffloadAidlGeneralTest, SetUpstreamParametersAlternateIPv6OnlyOk) { + const std::string iface(TEST_IFACE); + const std::string v4Addr(""); + const std::string v4Gw(""); + const std::vector v6Gws{std::string("fe80::db8:1"), std::string("fe80::db8:3")}; + EXPECT_TRUE(mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).isOk()); +} + +// TEST_IFACE is presumed to exist on the device and be up. No packets +// are ever actually caused to be forwarded. +TEST_P(TetheroffloadAidlGeneralTest, SetUpstreamParametersIPv4OnlyOk) { + const std::string iface(TEST_IFACE); + const std::string v4Addr("192.0.2.2"); + const std::string v4Gw("192.0.2.1"); + const std::vector v6Gws{}; + EXPECT_TRUE(mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).isOk()); +} + +// TEST_IFACE is presumed to exist on the device and be up. No packets +// are ever actually caused to be forwarded. +TEST_P(TetheroffloadAidlGeneralTest, SetUpstreamParametersIPv4v6Ok) { + const std::string iface(TEST_IFACE); + const std::string v4Addr("192.0.2.2"); + const std::string v4Gw("192.0.2.1"); + const std::vector v6Gws{std::string("fe80::db8:1"), std::string("fe80::db8:2")}; + EXPECT_TRUE(mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).isOk()); +} + +// Test that setUpstreamParameters() fails when all parameters are empty. +TEST_P(TetheroffloadAidlGeneralTest, SetUpstreamParametersEmptyFails) { + const std::string iface(""); + const std::string v4Addr(""); + const std::string v4Gw(""); + const std::vector v6Gws{}; + EXPECT_EQ(mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).getExceptionCode(), + EX_ILLEGAL_ARGUMENT); +} + +// Test that setUpstreamParameters() fails when given empty or non-existent interface names. +TEST_P(TetheroffloadAidlGeneralTest, SetUpstreamParametersBogusIfaceFails) { + const std::string v4Addr("192.0.2.2"); + const std::string v4Gw("192.0.2.1"); + const std::vector v6Gws{std::string("fe80::db8:1")}; + for (const auto& bogus : {"", "invalid"}) { + SCOPED_TRACE(testing::Message() << "upstream: " << bogus); + const std::string iface(bogus); + EXPECT_EQ(mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).getExceptionCode(), + EX_ILLEGAL_ARGUMENT); + } +} + +// Test that setUpstreamParameters() fails when given unparseable IPv4 addresses. +TEST_P(TetheroffloadAidlGeneralTest, SetUpstreamParametersInvalidIPv4AddrFails) { + const std::string iface(TEST_IFACE); + const std::string v4Gw("192.0.2.1"); + const std::vector v6Gws{std::string("fe80::db8:1")}; + for (const auto& bogus : {"invalid", "192.0.2"}) { + SCOPED_TRACE(testing::Message() << "v4addr: " << bogus); + const std::string v4Addr(bogus); + EXPECT_EQ(mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).getExceptionCode(), + EX_ILLEGAL_ARGUMENT); + } +} + +// Test that setUpstreamParameters() fails when given unparseable IPv4 gateways. +TEST_P(TetheroffloadAidlGeneralTest, SetUpstreamParametersInvalidIPv4GatewayFails) { + const std::string iface(TEST_IFACE); + const std::string v4Addr("192.0.2.2"); + const std::vector v6Gws{std::string("fe80::db8:1")}; + for (const auto& bogus : {"invalid", "192.0.2"}) { + SCOPED_TRACE(testing::Message() << "v4gateway: " << bogus); + const std::string v4Gw(bogus); + EXPECT_EQ(mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).getExceptionCode(), + EX_ILLEGAL_ARGUMENT); + } +} + +// Test that setUpstreamParameters() fails when given unparseable IPv6 gateways. +TEST_P(TetheroffloadAidlGeneralTest, SetUpstreamParametersBadIPv6GatewaysFail) { + const std::string iface(TEST_IFACE); + const std::string v4Addr("192.0.2.2"); + const std::string v4Gw("192.0.2.1"); + for (const auto& bogus : {"", "invalid", "fe80::bogus", "192.0.2.66"}) { + SCOPED_TRACE(testing::Message() << "v6gateway: " << bogus); + const std::vector v6Gws{std::string("fe80::1"), std::string(bogus)}; + EXPECT_EQ(mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).getExceptionCode(), + EX_ILLEGAL_ARGUMENT); + } +} + +/* + * Tests for IOffload::addDownstream(). + */ + +// Test addDownstream() works given an IPv4 prefix. +TEST_P(TetheroffloadAidlGeneralTest, AddDownstreamIPv4) { + const std::string iface("dummy0"); + const std::string prefix("192.0.2.0/24"); + EXPECT_TRUE(mOffload->addDownstream(iface, prefix).isOk()); +} + +// Test addDownstream() works given an IPv6 prefix. +TEST_P(TetheroffloadAidlGeneralTest, AddDownstreamIPv6) { + const std::string iface("dummy0"); + const std::string prefix("2001:db8::/64"); + EXPECT_TRUE(mOffload->addDownstream(iface, prefix).isOk()); +} + +// Test addDownstream() fails given all empty parameters. +TEST_P(TetheroffloadAidlGeneralTest, AddDownstreamEmptyFails) { + const std::string iface(""); + const std::string prefix(""); + EXPECT_EQ(mOffload->addDownstream(iface, prefix).getExceptionCode(), EX_ILLEGAL_ARGUMENT); +} + +// Test addDownstream() fails given empty or non-existent interface names. +TEST_P(TetheroffloadAidlGeneralTest, AddDownstreamInvalidIfaceFails) { + const std::string prefix("192.0.2.0/24"); + for (const auto& bogus : {"", "invalid"}) { + SCOPED_TRACE(testing::Message() << "iface: " << bogus); + const std::string iface(bogus); + EXPECT_EQ(mOffload->addDownstream(iface, prefix).getExceptionCode(), EX_ILLEGAL_ARGUMENT); + } +} + +// Test addDownstream() fails given unparseable prefix arguments. +TEST_P(TetheroffloadAidlGeneralTest, AddDownstreamBogusPrefixFails) { + const std::string iface("dummy0"); + for (const auto& bogus : {"", "192.0.2/24", "2001:db8/64"}) { + SCOPED_TRACE(testing::Message() << "prefix: " << bogus); + const std::string prefix(bogus); + EXPECT_EQ(mOffload->addDownstream(iface, prefix).getExceptionCode(), EX_ILLEGAL_ARGUMENT); + } +} + +/* + * Tests for IOffload::removeDownstream(). + */ + +// Test removeDownstream() works given an IPv4 prefix. +TEST_P(TetheroffloadAidlGeneralTest, RemoveDownstreamIPv4) { + const std::string iface("dummy0"); + const std::string prefix("192.0.2.0/24"); + // First add the downstream, otherwise removeDownstream logic can reasonably + // return error for downstreams not previously added. + EXPECT_TRUE(mOffload->addDownstream(iface, prefix).isOk()); + EXPECT_TRUE(mOffload->removeDownstream(iface, prefix).isOk()); +} + +// Test removeDownstream() works given an IPv6 prefix. +TEST_P(TetheroffloadAidlGeneralTest, RemoveDownstreamIPv6) { + const std::string iface("dummy0"); + const std::string prefix("2001:db8::/64"); + // First add the downstream, otherwise removeDownstream logic can reasonably + // return error for downstreams not previously added. + EXPECT_TRUE(mOffload->addDownstream(iface, prefix).isOk()); + EXPECT_TRUE(mOffload->removeDownstream(iface, prefix).isOk()); +} + +// Test removeDownstream() fails given all empty parameters. +TEST_P(TetheroffloadAidlGeneralTest, RemoveDownstreamEmptyFails) { + const std::string iface(""); + const std::string prefix(""); + EXPECT_EQ(mOffload->removeDownstream(iface, prefix).getExceptionCode(), EX_ILLEGAL_ARGUMENT); +} + +// Test removeDownstream() fails given empty or non-existent interface names. +TEST_P(TetheroffloadAidlGeneralTest, RemoveDownstreamBogusIfaceFails) { + const std::string prefix("192.0.2.0/24"); + for (const auto& bogus : {"", "invalid"}) { + SCOPED_TRACE(testing::Message() << "iface: " << bogus); + const std::string iface(bogus); + EXPECT_EQ(mOffload->removeDownstream(iface, prefix).getExceptionCode(), + EX_ILLEGAL_ARGUMENT); + } +} + +// Test removeDownstream() fails given unparseable prefix arguments. +TEST_P(TetheroffloadAidlGeneralTest, RemoveDownstreamBogusPrefixFails) { + const std::string iface("dummy0"); + for (const auto& bogus : {"", "192.0.2/24", "2001:db8/64"}) { + SCOPED_TRACE(testing::Message() << "prefix: " << bogus); + const std::string prefix(bogus); + EXPECT_EQ(mOffload->removeDownstream(iface, prefix).getExceptionCode(), + EX_ILLEGAL_ARGUMENT); + } +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TetheroffloadAidlTestBase); +INSTANTIATE_TEST_SUITE_P( + IOffload, TetheroffloadAidlTestBase, + testing::ValuesIn(::android::getAidlHalInstanceNames(IOffload::descriptor)), + ::android::PrintInstanceNameToString); + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TetheroffloadAidlPreInitTest); +INSTANTIATE_TEST_SUITE_P( + IOffload, TetheroffloadAidlPreInitTest, + testing::ValuesIn(::android::getAidlHalInstanceNames(IOffload::descriptor)), + ::android::PrintInstanceNameToString); + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(TetheroffloadAidlGeneralTest); +INSTANTIATE_TEST_SUITE_P( + IOffload, TetheroffloadAidlGeneralTest, + testing::ValuesIn(::android::getAidlHalInstanceNames(IOffload::descriptor)), + ::android::PrintInstanceNameToString); + +} // namespace + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + ABinderProcess_setThreadPoolMaxThreadCount(1); + ABinderProcess_startThreadPool(); + return RUN_ALL_TESTS(); +} + +} // namespace aidl::android::hardware::tetheroffload From 3e1765473ea30e2e4f282317132138f3012a92cf Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Wed, 18 Jan 2023 20:53:29 +0000 Subject: [PATCH 699/998] Add tetheroffload VTS to general-tests Also add it to TEST_MAPPING so it's run in presubmits. Test: na Bug: 205762647 Change-Id: I9c43ffcff5ccf0fcabcab08101ebc454c7fe3317 (cherry picked from commit b9b0aa4878a1d34b879017852609fbab70db4236) Merged-In: I9c43ffcff5ccf0fcabcab08101ebc454c7fe3317 --- tetheroffload/aidl/TEST_MAPPING | 7 +++++++ tetheroffload/aidl/vts/functional/Android.bp | 1 + 2 files changed, 8 insertions(+) create mode 100644 tetheroffload/aidl/TEST_MAPPING diff --git a/tetheroffload/aidl/TEST_MAPPING b/tetheroffload/aidl/TEST_MAPPING new file mode 100644 index 0000000000..c6d4c0735b --- /dev/null +++ b/tetheroffload/aidl/TEST_MAPPING @@ -0,0 +1,7 @@ +{ + "presubmit" : [ + { + "name": "VtsHalTetheroffloadTargetTest" + } + ] +} diff --git a/tetheroffload/aidl/vts/functional/Android.bp b/tetheroffload/aidl/vts/functional/Android.bp index c9c184568d..74edab0981 100644 --- a/tetheroffload/aidl/vts/functional/Android.bp +++ b/tetheroffload/aidl/vts/functional/Android.bp @@ -19,6 +19,7 @@ cc_test { "libgmock_ndk", ], test_suites: [ + "general-tests", "vts", ], } From 5babeec8a612fa431ed73e0915c4c866ab6b787d Mon Sep 17 00:00:00 2001 From: KH Shi Date: Wed, 18 Jan 2023 22:05:25 +0800 Subject: [PATCH 700/998] Follow-up commit of aosp/2329897 This commit resolves comments addressed in aosp/2329897. - Remove EX_UNSUPPORTED_OPERATION return from setDataWarningAndLimit() - Update some comments - Change some errors into assertions - Correct the sequence of the arguments in EXPECT_EQ(), expected argument goes before the actual argument - Print error or error message if API call fails Bug: b/205762647 Test: atest VtsHalTetheroffloadTargetTest Change-Id: Ied83dac5c33e06f6ad4ced18fbee785047b24c38 (cherry picked from commit 562cbfeea270576c709be53ad8dd6ec8679abff6) Merged-In: Ied83dac5c33e06f6ad4ced18fbee785047b24c38 --- .../hardware/tetheroffload/IOffload.aidl | 6 +- .../tetheroffload/OffloadCallbackEvent.aidl | 2 +- .../VtsHalTetheroffloadTargetTest.cpp | 150 ++++++++++-------- 3 files changed, 84 insertions(+), 74 deletions(-) diff --git a/tetheroffload/aidl/android/hardware/tetheroffload/IOffload.aidl b/tetheroffload/aidl/android/hardware/tetheroffload/IOffload.aidl index 30b2c8d8aa..984f2a5bcb 100644 --- a/tetheroffload/aidl/android/hardware/tetheroffload/IOffload.aidl +++ b/tetheroffload/aidl/android/hardware/tetheroffload/IOffload.aidl @@ -32,8 +32,7 @@ interface IOffload { /** * Indicates intent to start offload for tethering in immediate future. * - * This API must be called exactly once the first time that Tethering is requested by - * the user. + * This API must be called exactly once when Tethering is requested by the user. * * If this API is called multiple times without first calling stopOffload, then the subsequent * calls must fail without changing the state of the server. @@ -168,7 +167,6 @@ interface IOffload { * or negative number of bytes). * - EX_ILLEGAL_STATE if this method is called before initOffload(), or if this method * is called after stopOffload(). - * - EX_UNSUPPORTED_OPERATION if it is not supported. * - EX_SERVICE_SPECIFIC with the error message set to a human-readable reason for the * error. */ @@ -269,7 +267,7 @@ interface IOffload { * This API may only be called after initOffload and before stopOffload. * * @param iface Downstream interface - * @param prefix Downstream prefix depicting address that must no longer be offloaded + * @param prefix Downstream prefix depicting prefix that must no longer be offloaded * For e.g. 192.168.1.0/24 or 2001:4860:684::/64) * * @throws: diff --git a/tetheroffload/aidl/android/hardware/tetheroffload/OffloadCallbackEvent.aidl b/tetheroffload/aidl/android/hardware/tetheroffload/OffloadCallbackEvent.aidl index a95f67495f..15a1f9366d 100644 --- a/tetheroffload/aidl/android/hardware/tetheroffload/OffloadCallbackEvent.aidl +++ b/tetheroffload/aidl/android/hardware/tetheroffload/OffloadCallbackEvent.aidl @@ -55,7 +55,7 @@ enum OffloadCallbackEvent { */ OFFLOAD_STOPPED_LIMIT_REACHED = 5, /** - * This event is fired when the quota, applied in setDataWarning, has expired. It is + * This event is fired when the quota, applied in setDataWarningAndLimit, has expired. It is * recommended that the client query for statistics immediately after receiving this event. * Any offloaded traffic will continue to be offloaded until offload is stopped or * OFFLOAD_STOPPED_LIMIT_REACHED is sent. diff --git a/tetheroffload/aidl/vts/functional/VtsHalTetheroffloadTargetTest.cpp b/tetheroffload/aidl/vts/functional/VtsHalTetheroffloadTargetTest.cpp index fc8abbd2f6..f46c9aba75 100644 --- a/tetheroffload/aidl/vts/functional/VtsHalTetheroffloadTargetTest.cpp +++ b/tetheroffload/aidl/vts/functional/VtsHalTetheroffloadTargetTest.cpp @@ -152,15 +152,13 @@ class TetheroffloadAidlTestBase : public testing::TestWithParam { void initOffload(const bool expectedResult) { unique_fd ufd1(netlinkSocket(kFd1Groups)); if (ufd1.get() < 0) { - ALOGE("Unable to create conntrack sockets: %d/%s", errno, strerror(errno)); - FAIL(); + FAIL() << "Unable to create conntrack sockets: " << strerror(errno); } ndk::ScopedFileDescriptor fd1 = ndk::ScopedFileDescriptor(ufd1.release()); unique_fd ufd2(netlinkSocket(kFd2Groups)); if (ufd2.get() < 0) { - ALOGE("Unable to create conntrack sockets: %d/%s", errno, strerror(errno)); - FAIL(); + FAIL() << "Unable to create conntrack sockets: " << strerror(errno); } ndk::ScopedFileDescriptor fd2 = ndk::ScopedFileDescriptor(ufd2.release()); @@ -214,8 +212,7 @@ TEST_P(TetheroffloadAidlPreInitTest, TestInitOffloadInvalidFd1ReturnsError) { ndk::ScopedFileDescriptor fd1 = ndk::ScopedFileDescriptor(-1); unique_fd ufd2(netlinkSocket(kFd2Groups)); if (ufd2.get() < 0) { - ALOGE("Unable to create conntrack sockets: %d/%s", errno, strerror(errno)); - FAIL(); + FAIL() << "Unable to create conntrack sockets: " << strerror(errno); } ndk::ScopedFileDescriptor fd2 = ndk::ScopedFileDescriptor(ufd2.release()); mTetheringOffloadCallback = ndk::SharedRefBase::make(); @@ -229,8 +226,7 @@ TEST_P(TetheroffloadAidlPreInitTest, TestInitOffloadInvalidFd1ReturnsError) { TEST_P(TetheroffloadAidlPreInitTest, TestInitOffloadInvalidFd2ReturnsError) { unique_fd ufd1(netlinkSocket(kFd1Groups)); if (ufd1.get() < 0) { - ALOGE("Unable to create conntrack sockets: %d/%s", errno, strerror(errno)); - FAIL(); + FAIL() << "Unable to create conntrack sockets: " << strerror(errno); } ndk::ScopedFileDescriptor fd1 = ndk::ScopedFileDescriptor(ufd1.release()); ndk::ScopedFileDescriptor fd2 = ndk::ScopedFileDescriptor(-1); @@ -264,7 +260,8 @@ TEST_P(TetheroffloadAidlPreInitTest, AdditionalStopsWithInitReturnError) { const std::string v4Addr("192.0.0.2"); const std::string v4Gw("192.0.0.1"); const std::vector v6Gws{std::string("fe80::db8:1"), std::string("fe80::db8:2")}; - EXPECT_TRUE(mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).isOk()); + auto ret = mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws); + EXPECT_TRUE(ret.isOk()) << ret; if (!interfaceIsUp(TEST_IFACE)) { return; } @@ -279,7 +276,7 @@ TEST_P(TetheroffloadAidlPreInitTest, AdditionalStopsWithInitReturnError) { // Check that calling setLocalPrefixes() without first having called initOffload() returns error. TEST_P(TetheroffloadAidlPreInitTest, SetLocalPrefixesWithoutInitReturnsError) { const std::vector prefixes{std::string("2001:db8::/64")}; - EXPECT_EQ(mOffload->setLocalPrefixes(prefixes).getExceptionCode(), EX_ILLEGAL_STATE); + EXPECT_EQ(EX_ILLEGAL_STATE, mOffload->setLocalPrefixes(prefixes).getExceptionCode()); } // Check that calling getForwardedStats() without first having called initOffload() @@ -287,9 +284,10 @@ TEST_P(TetheroffloadAidlPreInitTest, SetLocalPrefixesWithoutInitReturnsError) { TEST_P(TetheroffloadAidlPreInitTest, GetForwardedStatsWithoutInitReturnsZeroValues) { const std::string upstream(TEST_IFACE); ForwardedStats stats; - EXPECT_TRUE(mOffload->getForwardedStats(upstream, &stats).isOk()); - EXPECT_EQ(stats.rxBytes, 0ULL); - EXPECT_EQ(stats.txBytes, 0ULL); + auto ret = mOffload->getForwardedStats(upstream, &stats); + EXPECT_TRUE(ret.isOk()) << ret; + EXPECT_EQ(0ULL, stats.rxBytes); + EXPECT_EQ(0ULL, stats.txBytes); } // Check that calling setDataWarningAndLimit() without first having called initOffload() returns @@ -298,8 +296,8 @@ TEST_P(TetheroffloadAidlPreInitTest, SetDataWarningAndLimitWithoutInitReturnsErr const std::string upstream(TEST_IFACE); const int64_t warning = 5000LL; const int64_t limit = 5000LL; - EXPECT_EQ(mOffload->setDataWarningAndLimit(upstream, warning, limit).getExceptionCode(), - EX_ILLEGAL_STATE); + EXPECT_EQ(EX_ILLEGAL_STATE, + mOffload->setDataWarningAndLimit(upstream, warning, limit).getExceptionCode()); } // Check that calling setUpstreamParameters() without first having called initOffload() @@ -309,8 +307,8 @@ TEST_P(TetheroffloadAidlPreInitTest, SetUpstreamParametersWithoutInitReturnsErro const std::string v4Addr("192.0.2.0/24"); const std::string v4Gw("192.0.2.1"); const std::vector v6Gws{std::string("fe80::db8:1")}; - EXPECT_EQ(mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).getExceptionCode(), - EX_ILLEGAL_STATE); + EXPECT_EQ(EX_ILLEGAL_STATE, + mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).getExceptionCode()); } // Check that calling addDownstream() with an IPv4 prefix without first having called @@ -318,7 +316,7 @@ TEST_P(TetheroffloadAidlPreInitTest, SetUpstreamParametersWithoutInitReturnsErro TEST_P(TetheroffloadAidlPreInitTest, AddIPv4DownstreamWithoutInitReturnsError) { const std::string iface(TEST_IFACE); const std::string prefix("192.0.2.0/24"); - EXPECT_EQ(mOffload->addDownstream(iface, prefix).getExceptionCode(), EX_ILLEGAL_STATE); + EXPECT_EQ(EX_ILLEGAL_STATE, mOffload->addDownstream(iface, prefix).getExceptionCode()); } // Check that calling addDownstream() with an IPv6 prefix without first having called @@ -326,7 +324,7 @@ TEST_P(TetheroffloadAidlPreInitTest, AddIPv4DownstreamWithoutInitReturnsError) { TEST_P(TetheroffloadAidlPreInitTest, AddIPv6DownstreamWithoutInitReturnsError) { const std::string iface(TEST_IFACE); const std::string prefix("2001:db8::/64"); - EXPECT_EQ(mOffload->addDownstream(iface, prefix).getExceptionCode(), EX_ILLEGAL_STATE); + EXPECT_EQ(EX_ILLEGAL_STATE, mOffload->addDownstream(iface, prefix).getExceptionCode()); } // Check that calling removeDownstream() with an IPv4 prefix without first having called @@ -334,7 +332,7 @@ TEST_P(TetheroffloadAidlPreInitTest, AddIPv6DownstreamWithoutInitReturnsError) { TEST_P(TetheroffloadAidlPreInitTest, RemoveIPv4DownstreamWithoutInitReturnsError) { const std::string iface(TEST_IFACE); const std::string prefix("192.0.2.0/24"); - EXPECT_EQ(mOffload->removeDownstream(iface, prefix).getExceptionCode(), EX_ILLEGAL_STATE); + EXPECT_EQ(EX_ILLEGAL_STATE, mOffload->removeDownstream(iface, prefix).getExceptionCode()); } // Check that calling removeDownstream() with an IPv6 prefix without first having called @@ -342,7 +340,7 @@ TEST_P(TetheroffloadAidlPreInitTest, RemoveIPv4DownstreamWithoutInitReturnsError TEST_P(TetheroffloadAidlPreInitTest, RemoveIPv6DownstreamWithoutInitReturnsError) { const std::string iface(TEST_IFACE); const std::string prefix("2001:db8::/64"); - EXPECT_EQ(mOffload->removeDownstream(iface, prefix).getExceptionCode(), EX_ILLEGAL_STATE); + EXPECT_EQ(EX_ILLEGAL_STATE, mOffload->removeDownstream(iface, prefix).getExceptionCode()); } /* @@ -352,19 +350,20 @@ TEST_P(TetheroffloadAidlPreInitTest, RemoveIPv6DownstreamWithoutInitReturnsError // Test setLocalPrefixes() rejects an IPv4 address. TEST_P(TetheroffloadAidlGeneralTest, SetLocalPrefixesIPv4AddressFails) { const std::vector prefixes{std::string("192.0.2.1")}; - EXPECT_EQ(mOffload->setLocalPrefixes(prefixes).getExceptionCode(), EX_ILLEGAL_ARGUMENT); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, mOffload->setLocalPrefixes(prefixes).getExceptionCode()); } // Test setLocalPrefixes() rejects an IPv6 address. TEST_P(TetheroffloadAidlGeneralTest, SetLocalPrefixesIPv6AddressFails) { const std::vector prefixes{std::string("fe80::1")}; - EXPECT_EQ(mOffload->setLocalPrefixes(prefixes).getExceptionCode(), EX_ILLEGAL_ARGUMENT); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, mOffload->setLocalPrefixes(prefixes).getExceptionCode()); } // Test setLocalPrefixes() accepts both IPv4 and IPv6 prefixes. TEST_P(TetheroffloadAidlGeneralTest, SetLocalPrefixesIPv4v6PrefixesOk) { const std::vector prefixes{std::string("192.0.2.0/24"), std::string("fe80::/64")}; - EXPECT_TRUE(mOffload->setLocalPrefixes(prefixes).isOk()); + auto ret = mOffload->setLocalPrefixes(prefixes); + EXPECT_TRUE(ret.isOk()) << ret; } // Test that setLocalPrefixes() fails given empty input. There is always @@ -372,13 +371,13 @@ TEST_P(TetheroffloadAidlGeneralTest, SetLocalPrefixesIPv4v6PrefixesOk) { // we still apply {127.0.0.0/8, ::1/128, fe80::/64} here. TEST_P(TetheroffloadAidlGeneralTest, SetLocalPrefixesEmptyFails) { const std::vector prefixes{}; - EXPECT_EQ(mOffload->setLocalPrefixes(prefixes).getExceptionCode(), EX_ILLEGAL_ARGUMENT); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, mOffload->setLocalPrefixes(prefixes).getExceptionCode()); } // Test setLocalPrefixes() fails on incorrectly formed input strings. TEST_P(TetheroffloadAidlGeneralTest, SetLocalPrefixesInvalidFails) { const std::vector prefixes{std::string("192.0.2.0/24"), std::string("invalid")}; - EXPECT_EQ(mOffload->setLocalPrefixes(prefixes).getExceptionCode(), EX_ILLEGAL_ARGUMENT); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, mOffload->setLocalPrefixes(prefixes).getExceptionCode()); } /* @@ -389,9 +388,10 @@ TEST_P(TetheroffloadAidlGeneralTest, SetLocalPrefixesInvalidFails) { TEST_P(TetheroffloadAidlGeneralTest, GetForwardedStatsInvalidUpstreamIface) { const std::string upstream("invalid"); ForwardedStats stats; - EXPECT_TRUE(mOffload->getForwardedStats(upstream, &stats).isOk()); - EXPECT_EQ(stats.rxBytes, 0ULL); - EXPECT_EQ(stats.txBytes, 0ULL); + auto ret = mOffload->getForwardedStats(upstream, &stats); + EXPECT_TRUE(ret.isOk()) << ret; + EXPECT_EQ(0ULL, stats.rxBytes); + EXPECT_EQ(0ULL, stats.txBytes); } // TEST_IFACE is presumed to exist on the device and be up. No packets @@ -399,9 +399,10 @@ TEST_P(TetheroffloadAidlGeneralTest, GetForwardedStatsInvalidUpstreamIface) { TEST_P(TetheroffloadAidlGeneralTest, GetForwardedStatsDummyIface) { const std::string upstream(TEST_IFACE); ForwardedStats stats; - EXPECT_TRUE(mOffload->getForwardedStats(upstream, &stats).isOk()); - EXPECT_EQ(stats.rxBytes, 0ULL); - EXPECT_EQ(stats.txBytes, 0ULL); + auto ret = mOffload->getForwardedStats(upstream, &stats); + EXPECT_TRUE(ret.isOk()) << ret; + EXPECT_EQ(0ULL, stats.rxBytes); + EXPECT_EQ(0ULL, stats.txBytes); } /* @@ -413,8 +414,8 @@ TEST_P(TetheroffloadAidlGeneralTest, SetDataWarningAndLimitEmptyUpstreamIfaceFai const std::string upstream(""); const int64_t warning = 12345LL; const int64_t limit = 67890LL; - EXPECT_THAT(mOffload->setDataWarningAndLimit(upstream, warning, limit).getExceptionCode(), - AnyOf(Eq(EX_ILLEGAL_ARGUMENT), Eq(EX_UNSUPPORTED_OPERATION))); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, + mOffload->setDataWarningAndLimit(upstream, warning, limit).getExceptionCode()); } // TEST_IFACE is presumed to exist on the device and be up. No packets @@ -423,8 +424,8 @@ TEST_P(TetheroffloadAidlGeneralTest, SetDataWarningAndLimitNonZeroOk) { const std::string upstream(TEST_IFACE); const int64_t warning = 4000LL; const int64_t limit = 5000LL; - EXPECT_THAT(mOffload->setDataWarningAndLimit(upstream, warning, limit).getExceptionCode(), - AnyOf(Eq(EX_NONE), Eq(EX_UNSUPPORTED_OPERATION))); + auto ret = mOffload->setDataWarningAndLimit(upstream, warning, limit); + EXPECT_TRUE(ret.isOk()) << ret; } // TEST_IFACE is presumed to exist on the device and be up. No packets @@ -433,8 +434,8 @@ TEST_P(TetheroffloadAidlGeneralTest, SetDataWarningAndLimitZeroOk) { const std::string upstream(TEST_IFACE); const int64_t warning = 0LL; const int64_t limit = 0LL; - EXPECT_THAT(mOffload->setDataWarningAndLimit(upstream, warning, limit).getExceptionCode(), - AnyOf(Eq(EX_NONE), Eq(EX_UNSUPPORTED_OPERATION))); + auto ret = mOffload->setDataWarningAndLimit(upstream, warning, limit); + EXPECT_TRUE(ret.isOk()) << ret; } // TEST_IFACE is presumed to exist on the device and be up. No packets @@ -443,7 +444,8 @@ TEST_P(TetheroffloadAidlGeneralTest, SetDataWarningAndLimitUnlimitedWarningOk) { const std::string upstream(TEST_IFACE); const int64_t warning = LLONG_MAX; const int64_t limit = 5000LL; - EXPECT_TRUE(mOffload->setDataWarningAndLimit(upstream, warning, limit).isOk()); + auto ret = mOffload->setDataWarningAndLimit(upstream, warning, limit); + EXPECT_TRUE(ret.isOk()) << ret; } // Test that setDataWarningAndLimit() with negative thresholds fails. @@ -451,8 +453,8 @@ TEST_P(TetheroffloadAidlGeneralTest, SetDataWarningAndLimitNegativeFails) { const std::string upstream(TEST_IFACE); const int64_t warning = -1LL; const int64_t limit = -1LL; - EXPECT_THAT(mOffload->setDataWarningAndLimit(upstream, warning, limit).getExceptionCode(), - AnyOf(Eq(EX_ILLEGAL_ARGUMENT), Eq(EX_UNSUPPORTED_OPERATION))); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, + mOffload->setDataWarningAndLimit(upstream, warning, limit).getExceptionCode()); } /* @@ -466,7 +468,8 @@ TEST_P(TetheroffloadAidlGeneralTest, SetUpstreamParametersIPv6OnlyOk) { const std::string v4Addr(""); const std::string v4Gw(""); const std::vector v6Gws{std::string("fe80::db8:1"), std::string("fe80::db8:2")}; - EXPECT_TRUE(mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).isOk()); + auto ret = mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws); + EXPECT_TRUE(ret.isOk()) << ret; } // TEST_IFACE is presumed to exist on the device and be up. No packets @@ -476,7 +479,8 @@ TEST_P(TetheroffloadAidlGeneralTest, SetUpstreamParametersAlternateIPv6OnlyOk) { const std::string v4Addr(""); const std::string v4Gw(""); const std::vector v6Gws{std::string("fe80::db8:1"), std::string("fe80::db8:3")}; - EXPECT_TRUE(mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).isOk()); + auto ret = mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws); + EXPECT_TRUE(ret.isOk()) << ret; } // TEST_IFACE is presumed to exist on the device and be up. No packets @@ -486,7 +490,8 @@ TEST_P(TetheroffloadAidlGeneralTest, SetUpstreamParametersIPv4OnlyOk) { const std::string v4Addr("192.0.2.2"); const std::string v4Gw("192.0.2.1"); const std::vector v6Gws{}; - EXPECT_TRUE(mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).isOk()); + auto ret = mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws); + EXPECT_TRUE(ret.isOk()) << ret; } // TEST_IFACE is presumed to exist on the device and be up. No packets @@ -496,7 +501,8 @@ TEST_P(TetheroffloadAidlGeneralTest, SetUpstreamParametersIPv4v6Ok) { const std::string v4Addr("192.0.2.2"); const std::string v4Gw("192.0.2.1"); const std::vector v6Gws{std::string("fe80::db8:1"), std::string("fe80::db8:2")}; - EXPECT_TRUE(mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).isOk()); + auto ret = mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws); + EXPECT_TRUE(ret.isOk()) << ret; } // Test that setUpstreamParameters() fails when all parameters are empty. @@ -505,8 +511,8 @@ TEST_P(TetheroffloadAidlGeneralTest, SetUpstreamParametersEmptyFails) { const std::string v4Addr(""); const std::string v4Gw(""); const std::vector v6Gws{}; - EXPECT_EQ(mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).getExceptionCode(), - EX_ILLEGAL_ARGUMENT); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, + mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).getExceptionCode()); } // Test that setUpstreamParameters() fails when given empty or non-existent interface names. @@ -517,8 +523,8 @@ TEST_P(TetheroffloadAidlGeneralTest, SetUpstreamParametersBogusIfaceFails) { for (const auto& bogus : {"", "invalid"}) { SCOPED_TRACE(testing::Message() << "upstream: " << bogus); const std::string iface(bogus); - EXPECT_EQ(mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).getExceptionCode(), - EX_ILLEGAL_ARGUMENT); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, + mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).getExceptionCode()); } } @@ -530,8 +536,8 @@ TEST_P(TetheroffloadAidlGeneralTest, SetUpstreamParametersInvalidIPv4AddrFails) for (const auto& bogus : {"invalid", "192.0.2"}) { SCOPED_TRACE(testing::Message() << "v4addr: " << bogus); const std::string v4Addr(bogus); - EXPECT_EQ(mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).getExceptionCode(), - EX_ILLEGAL_ARGUMENT); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, + mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).getExceptionCode()); } } @@ -543,8 +549,8 @@ TEST_P(TetheroffloadAidlGeneralTest, SetUpstreamParametersInvalidIPv4GatewayFail for (const auto& bogus : {"invalid", "192.0.2"}) { SCOPED_TRACE(testing::Message() << "v4gateway: " << bogus); const std::string v4Gw(bogus); - EXPECT_EQ(mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).getExceptionCode(), - EX_ILLEGAL_ARGUMENT); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, + mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).getExceptionCode()); } } @@ -556,8 +562,8 @@ TEST_P(TetheroffloadAidlGeneralTest, SetUpstreamParametersBadIPv6GatewaysFail) { for (const auto& bogus : {"", "invalid", "fe80::bogus", "192.0.2.66"}) { SCOPED_TRACE(testing::Message() << "v6gateway: " << bogus); const std::vector v6Gws{std::string("fe80::1"), std::string(bogus)}; - EXPECT_EQ(mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).getExceptionCode(), - EX_ILLEGAL_ARGUMENT); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, + mOffload->setUpstreamParameters(iface, v4Addr, v4Gw, v6Gws).getExceptionCode()); } } @@ -569,21 +575,23 @@ TEST_P(TetheroffloadAidlGeneralTest, SetUpstreamParametersBadIPv6GatewaysFail) { TEST_P(TetheroffloadAidlGeneralTest, AddDownstreamIPv4) { const std::string iface("dummy0"); const std::string prefix("192.0.2.0/24"); - EXPECT_TRUE(mOffload->addDownstream(iface, prefix).isOk()); + auto ret = mOffload->addDownstream(iface, prefix); + EXPECT_TRUE(ret.isOk()) << ret; } // Test addDownstream() works given an IPv6 prefix. TEST_P(TetheroffloadAidlGeneralTest, AddDownstreamIPv6) { const std::string iface("dummy0"); const std::string prefix("2001:db8::/64"); - EXPECT_TRUE(mOffload->addDownstream(iface, prefix).isOk()); + auto ret = mOffload->addDownstream(iface, prefix); + EXPECT_TRUE(ret.isOk()) << ret; } // Test addDownstream() fails given all empty parameters. TEST_P(TetheroffloadAidlGeneralTest, AddDownstreamEmptyFails) { const std::string iface(""); const std::string prefix(""); - EXPECT_EQ(mOffload->addDownstream(iface, prefix).getExceptionCode(), EX_ILLEGAL_ARGUMENT); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, mOffload->addDownstream(iface, prefix).getExceptionCode()); } // Test addDownstream() fails given empty or non-existent interface names. @@ -592,7 +600,7 @@ TEST_P(TetheroffloadAidlGeneralTest, AddDownstreamInvalidIfaceFails) { for (const auto& bogus : {"", "invalid"}) { SCOPED_TRACE(testing::Message() << "iface: " << bogus); const std::string iface(bogus); - EXPECT_EQ(mOffload->addDownstream(iface, prefix).getExceptionCode(), EX_ILLEGAL_ARGUMENT); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, mOffload->addDownstream(iface, prefix).getExceptionCode()); } } @@ -602,7 +610,7 @@ TEST_P(TetheroffloadAidlGeneralTest, AddDownstreamBogusPrefixFails) { for (const auto& bogus : {"", "192.0.2/24", "2001:db8/64"}) { SCOPED_TRACE(testing::Message() << "prefix: " << bogus); const std::string prefix(bogus); - EXPECT_EQ(mOffload->addDownstream(iface, prefix).getExceptionCode(), EX_ILLEGAL_ARGUMENT); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, mOffload->addDownstream(iface, prefix).getExceptionCode()); } } @@ -616,8 +624,10 @@ TEST_P(TetheroffloadAidlGeneralTest, RemoveDownstreamIPv4) { const std::string prefix("192.0.2.0/24"); // First add the downstream, otherwise removeDownstream logic can reasonably // return error for downstreams not previously added. - EXPECT_TRUE(mOffload->addDownstream(iface, prefix).isOk()); - EXPECT_TRUE(mOffload->removeDownstream(iface, prefix).isOk()); + auto ret = mOffload->addDownstream(iface, prefix); + EXPECT_TRUE(ret.isOk()) << ret; + ret = mOffload->removeDownstream(iface, prefix); + EXPECT_TRUE(ret.isOk()) << ret; } // Test removeDownstream() works given an IPv6 prefix. @@ -626,15 +636,17 @@ TEST_P(TetheroffloadAidlGeneralTest, RemoveDownstreamIPv6) { const std::string prefix("2001:db8::/64"); // First add the downstream, otherwise removeDownstream logic can reasonably // return error for downstreams not previously added. - EXPECT_TRUE(mOffload->addDownstream(iface, prefix).isOk()); - EXPECT_TRUE(mOffload->removeDownstream(iface, prefix).isOk()); + auto ret = mOffload->addDownstream(iface, prefix); + EXPECT_TRUE(ret.isOk()) << ret; + ret = mOffload->removeDownstream(iface, prefix); + EXPECT_TRUE(ret.isOk()) << ret; } // Test removeDownstream() fails given all empty parameters. TEST_P(TetheroffloadAidlGeneralTest, RemoveDownstreamEmptyFails) { const std::string iface(""); const std::string prefix(""); - EXPECT_EQ(mOffload->removeDownstream(iface, prefix).getExceptionCode(), EX_ILLEGAL_ARGUMENT); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, mOffload->removeDownstream(iface, prefix).getExceptionCode()); } // Test removeDownstream() fails given empty or non-existent interface names. @@ -643,8 +655,8 @@ TEST_P(TetheroffloadAidlGeneralTest, RemoveDownstreamBogusIfaceFails) { for (const auto& bogus : {"", "invalid"}) { SCOPED_TRACE(testing::Message() << "iface: " << bogus); const std::string iface(bogus); - EXPECT_EQ(mOffload->removeDownstream(iface, prefix).getExceptionCode(), - EX_ILLEGAL_ARGUMENT); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, + mOffload->removeDownstream(iface, prefix).getExceptionCode()); } } @@ -654,8 +666,8 @@ TEST_P(TetheroffloadAidlGeneralTest, RemoveDownstreamBogusPrefixFails) { for (const auto& bogus : {"", "192.0.2/24", "2001:db8/64"}) { SCOPED_TRACE(testing::Message() << "prefix: " << bogus); const std::string prefix(bogus); - EXPECT_EQ(mOffload->removeDownstream(iface, prefix).getExceptionCode(), - EX_ILLEGAL_ARGUMENT); + EXPECT_EQ(EX_ILLEGAL_ARGUMENT, + mOffload->removeDownstream(iface, prefix).getExceptionCode()); } } From 8196cbad1f5a40052cc8e883840cbf0b02a9266c Mon Sep 17 00:00:00 2001 From: KH Shi Date: Fri, 10 Feb 2023 19:27:04 +0800 Subject: [PATCH 701/998] Fix tethering build after ag/21363239 This commit fixes tethering apex build errors after ag/21363239: - Remove unsupported field in Android.bp: "frozen: false" - Add owner field to Android.bp to bypass compilation check of using unfrozen AIDL interfaces: owner: "google" Bug: b/205762647 Test: build and install tethering apex: banchan com.google.android.tethering module_x86_64 UNBUNDLED_BUILD_SDKS_FROM_SOURCE=true m apps_only dist adb install out/dist/com.google.android.tethering.apex Change-Id: Iea77f2117834c1317b3ab16f71881a6b2e299474 --- tetheroffload/aidl/Android.bp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tetheroffload/aidl/Android.bp b/tetheroffload/aidl/Android.bp index 1d8058685c..b3b6ebf091 100644 --- a/tetheroffload/aidl/Android.bp +++ b/tetheroffload/aidl/Android.bp @@ -4,6 +4,7 @@ package { aidl_interface { name: "android.hardware.tetheroffload", + owner: "google", vendor_available: true, srcs: ["android/hardware/tetheroffload/*.aidl"], stability: "vintf", @@ -23,5 +24,4 @@ aidl_interface { apps_enabled: false, }, }, - frozen: false, } From ff0da0bb242dfebffe74c69529f20ed2dc90a11c Mon Sep 17 00:00:00 2001 From: ramindani Date: Fri, 3 Feb 2023 12:50:36 -0800 Subject: [PATCH 702/998] [HWC3] AIDL implementation for Refresh Rate Overlay indicator Adds IComposerClient method to inform that the Refresh Rate callback is enabled. Adds IComposerCallback to get the display vsyncPeriod for the Overlay. Adds Composition type REFRESH_RATE_INDICATOR Test: Device boots BUG: 202734676 Change-Id: I48b0c05f49095b15cea444dc5c3ad8f78a043cb0 --- .../graphics/composer3/Capability.aidl | 1 + .../graphics/composer3/Composition.aidl | 1 + .../graphics/composer3/IComposerCallback.aidl | 1 + .../graphics/composer3/IComposerClient.aidl | 1 + .../RefreshRateChangedDebugData.aidl | 39 +++++++++++++++++++ .../graphics/composer3/Capability.aidl | 11 ++++++ .../graphics/composer3/Composition.aidl | 10 +++++ .../graphics/composer3/IComposerCallback.aidl | 22 +++++++++++ .../graphics/composer3/IComposerClient.aidl | 12 ++++++ .../RefreshRateChangedDebugData.aidl | 30 ++++++++++++++ 10 files changed, 128 insertions(+) create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl create mode 100644 graphics/composer/aidl/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl index 6e844ef1cd..f02f8aaa77 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Capability.aidl @@ -44,4 +44,5 @@ enum Capability { SKIP_VALIDATE = 4, BOOT_DISPLAY_CONFIG = 5, HDR_OUTPUT_CONVERSION_CONFIG = 6, + REFRESH_RATE_CHANGED_CALLBACK_DEBUG = 7, } diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Composition.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Composition.aidl index d2d8f0486a..34d6822148 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Composition.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/Composition.aidl @@ -41,4 +41,5 @@ enum Composition { CURSOR = 4, SIDEBAND = 5, DISPLAY_DECORATION = 6, + REFRESH_RATE_INDICATOR = 7, } diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerCallback.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerCallback.aidl index 21620e7f31..2c08cbeffd 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerCallback.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerCallback.aidl @@ -40,4 +40,5 @@ interface IComposerCallback { oneway void onVsync(long display, long timestamp, int vsyncPeriodNanos); oneway void onVsyncPeriodTimingChanged(long display, in android.hardware.graphics.composer3.VsyncPeriodChangeTimeline updatedTimeline); oneway void onVsyncIdle(long display); + oneway void onRefreshRateChangedDebug(in android.hardware.graphics.composer3.RefreshRateChangedDebugData data); } diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl index 10ce067aad..af82b83b76 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl @@ -78,6 +78,7 @@ interface IComposerClient { android.hardware.graphics.composer3.OverlayProperties getOverlaySupport(); android.hardware.graphics.common.HdrConversionCapability[] getHdrConversionCapabilities(); void setHdrConversionStrategy(in android.hardware.graphics.common.HdrConversionStrategy conversionStrategy); + void setRefreshRateChangedCallbackDebugEnabled(long display, boolean enabled); const int EX_BAD_CONFIG = 1; const int EX_BAD_DISPLAY = 2; const int EX_BAD_LAYER = 3; diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl new file mode 100644 index 0000000000..2b9801a4aa --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl @@ -0,0 +1,39 @@ +/** + * Copyright 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable RefreshRateChangedDebugData { + long display; + int vsyncPeriodNanos; +} diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl index 509a8f433f..4638610955 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/Capability.aidl @@ -75,4 +75,15 @@ enum Capability { * @see IComposerClient.setHdrConversionStrategy */ HDR_OUTPUT_CONVERSION_CONFIG = 6, + + /** + * Specifies that the device supports the callback onRefreshRateChangedDebug + * to pass information about the refresh rate. + * The refresh rate from the callback is used to update the refresh rate + * overlay indicator. + * + * @see IComposerClient.setRefreshRateChangedCallbackDebugEnabled + * @see IComposerCallback.onRefreshRateChangedDebug + */ + REFRESH_RATE_CHANGED_CALLBACK_DEBUG = 7, } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl index 82b218be3f..37912b0069 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/Composition.aidl @@ -86,4 +86,14 @@ enum Composition { * to either DEVICE or CLIENT. */ DISPLAY_DECORATION = 6, + + /** + * This composition type is similar to DEVICE, with a single difference, + * that indicates to HWC that this layer update is not considered an activity + * of any sort. For example, If HWC maintains a timer for activity to switch + * the display mode from a power save mode, it should not reset that timer. + * + * Upon validateDisplay, the device may request a change from this type to CLIENT. + */ + REFRESH_RATE_INDICATOR = 7, } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerCallback.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerCallback.aidl index 67954d4cc5..f4384b7a5a 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerCallback.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerCallback.aidl @@ -16,6 +16,7 @@ package android.hardware.graphics.composer3; +import android.hardware.graphics.composer3.RefreshRateChangedDebugData; import android.hardware.graphics.composer3.VsyncPeriodChangeTimeline; @VintfStability @@ -96,4 +97,25 @@ interface IComposerCallback { * @param display is the display whose vsync cadence changed due to panel idle mode. */ oneway void onVsyncIdle(long display); + + /** + * Notifies the client the vsyncPeriod of the display changed. + * Whether or not to call this callback is managed by + * IComposerClient.setRefreshRateChangedCallbackDebugEnabled + * + * Immediate callback is required after the setRefreshRateChangedCallbackDebugEnabled + * called. + * When the panel refresh rate changes, as a result of a setActiveConfig or + * setActiveConfigWithConstraints, this callback should be called with the new panel + * refresh rate. In addition, when the panel refresh rate is changed by other means, + * such as idleness or DOZE power state, this callback should be called as well. + * + * This callback is used for debug purposes, and not for scheduling frames, + * therefore synchronization is not required. + * + * @see IComposerClient.setRefreshRateChangedCallbackDebugEnabled + * + * @param data is the data for the callback when refresh rate changed. + */ + oneway void onRefreshRateChangedDebug(in RefreshRateChangedDebugData data); } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl index 8091491ae2..f0f2432459 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl @@ -848,4 +848,16 @@ interface IComposerClient { * @see getHdrConversionCapabilities */ void setHdrConversionStrategy(in HdrConversionStrategy conversionStrategy); + + /* + * Sets either the callback for the refresh rate change is enabled or disabled + * for the provided display. + * + * @see IComposerCallback.onRefreshRateChangedDebug + * + * @param display is the display on which the callback is enabled on. + * @param enabled true when refresh rate callback is enabled, + * false when refresh rate callback is disabled. + */ + void setRefreshRateChangedCallbackDebugEnabled(long display, boolean enabled); } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl new file mode 100644 index 0000000000..c1f78d6f5e --- /dev/null +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl @@ -0,0 +1,30 @@ +/** + * Copyright 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.hardware.graphics.composer3; + +@VintfStability +parcelable RefreshRateChangedDebugData { + /** + * The display for which the debug data is for. + */ + long display; + + /** + * The display vsync period in nanoseconds. + */ + int vsyncPeriodNanos; +} From 16f4062d1812c86495ff873badf388de6179f749 Mon Sep 17 00:00:00 2001 From: Arthur Ishiguro Date: Fri, 10 Feb 2023 18:11:12 +0000 Subject: [PATCH 703/998] Populate host endpoint type in VTS test Bug: 268222729 Test: Run test and verify pass Change-Id: I5acbab30b05ad7ef9a6693aee74dcf1eb378320d --- contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp index f7ff73d477..d57bd864ed 100644 --- a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp +++ b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp @@ -368,6 +368,7 @@ std::vector> generateContextHubMapping() { TEST_P(ContextHubAidl, TestHostConnection) { constexpr char16_t kHostEndpointId = 1; HostEndpointInfo hostEndpointInfo; + hostEndpointInfo.type = HostEndpointInfo::Type::NATIVE; hostEndpointInfo.hostEndpointId = kHostEndpointId; ASSERT_TRUE(contextHub->onHostEndpointConnected(hostEndpointInfo).isOk()); From 14393faaf1e654a422d39dd2c24f7e87edcf5232 Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Tue, 7 Feb 2023 14:14:44 -0800 Subject: [PATCH 704/998] Add link state for link layer stats Bug: 263029630 Test: m android.hardware.wifi-update-api Change-Id: Ia9a1782200136cd0f58a66e7d2de700d8a75fcae --- .../hardware/wifi/StaLinkLayerLinkStats.aidl | 7 +++++ .../hardware/wifi/StaLinkLayerLinkStats.aidl | 29 +++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaLinkLayerLinkStats.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaLinkLayerLinkStats.aidl index 2bc325411a..cd21c256fe 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaLinkLayerLinkStats.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaLinkLayerLinkStats.aidl @@ -49,4 +49,11 @@ parcelable StaLinkLayerLinkStats { android.hardware.wifi.StaLinkLayerIfaceContentionTimeStats wmeViContentionTimeStats; android.hardware.wifi.StaLinkLayerIfaceContentionTimeStats wmeVoContentionTimeStats; android.hardware.wifi.StaPeerInfo[] peers; + android.hardware.wifi.StaLinkLayerLinkStats.StaLinkState state; + @Backing(type="int") @VintfStability + enum StaLinkState { + UNKNOWN = 0, + NOT_IN_USE = (1 << 0) /* 1 */, + IN_USE = (1 << 1) /* 2 */, + } } diff --git a/wifi/aidl/android/hardware/wifi/StaLinkLayerLinkStats.aidl b/wifi/aidl/android/hardware/wifi/StaLinkLayerLinkStats.aidl index d8d797584e..25195430fe 100644 --- a/wifi/aidl/android/hardware/wifi/StaLinkLayerLinkStats.aidl +++ b/wifi/aidl/android/hardware/wifi/StaLinkLayerLinkStats.aidl @@ -95,4 +95,33 @@ parcelable StaLinkLayerLinkStats { * Per peer statistics for the link. */ StaPeerInfo[] peers; + /** + * Various states of the link. + */ + @Backing(type="int") + @VintfStability + enum StaLinkState { + /** + * Chip does not support reporting the state of the link. + */ + UNKNOWN = 0, + /** + * Link has not been in use since last report. It is placed in power save. All management, + * control and data frames for the MLO connection are carried over other links. In this + * state the link will not listen to beacons even in DTIM period and does not perform any + * GTK/IGTK/BIGTK updates but remains associated. + */ + NOT_IN_USE = 1 << 0, + /** + * Link is in use. In presence of traffic, it is set to be power active. When the traffic + * stops, the link will go into power save mode and will listen for beacons every DTIM + * period. + * + */ + IN_USE = 1 << 1, + } + /** + * State of the link. Refer |StaLinkState|. + */ + StaLinkState state; } From 8345034b5346b5c1b902c54ce3e6ebbaf4cead2a Mon Sep 17 00:00:00 2001 From: ramindani Date: Fri, 3 Feb 2023 12:52:08 -0800 Subject: [PATCH 705/998] [HWC3] VTS client updates for onRefreshRateChangedDebug callback And for setRefreshRateChangedCallbackDebugEnabled This does not add any implementation for the VTS code. Implementation will be added with the VTS tests as a followup. Test: Device boots BUG: 202734676 Change-Id: If47bbcf87698b346907b3bc1903908ff0a63203f --- graphics/composer/aidl/vts/GraphicsComposerCallback.cpp | 6 ++++++ graphics/composer/aidl/vts/GraphicsComposerCallback.h | 2 ++ graphics/composer/aidl/vts/VtsComposerClient.cpp | 6 ++++++ graphics/composer/aidl/vts/VtsComposerClient.h | 3 +++ 4 files changed, 17 insertions(+) diff --git a/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp b/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp index d53494325a..4fb5d01249 100644 --- a/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp +++ b/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp @@ -124,6 +124,12 @@ GraphicsComposerCallback::takeLastVsyncPeriodChangeTimeline() { return ::ndk::ScopedAStatus::ok(); } +::ndk::ScopedAStatus GraphicsComposerCallback::onRefreshRateChangedDebug( + const RefreshRateChangedDebugData&) { + // TODO(b/202734676) Add implementation for Vts tests + return ::ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); +} + ::ndk::ScopedAStatus GraphicsComposerCallback::onVsyncPeriodTimingChanged( int64_t in_display, const ::aidl::android::hardware::graphics::composer3::VsyncPeriodChangeTimeline& diff --git a/graphics/composer/aidl/vts/GraphicsComposerCallback.h b/graphics/composer/aidl/vts/GraphicsComposerCallback.h index e54da346f5..9c3bc70f73 100644 --- a/graphics/composer/aidl/vts/GraphicsComposerCallback.h +++ b/graphics/composer/aidl/vts/GraphicsComposerCallback.h @@ -55,6 +55,8 @@ class GraphicsComposerCallback : public BnComposerCallback { const ::aidl::android::hardware::graphics::composer3::VsyncPeriodChangeTimeline& in_updatedTimeline) override; virtual ::ndk::ScopedAStatus onVsyncIdle(int64_t in_display) override; + virtual ::ndk::ScopedAStatus onRefreshRateChangedDebug( + const RefreshRateChangedDebugData&) override; mutable std::mutex mMutex; // the set of all currently connected displays diff --git a/graphics/composer/aidl/vts/VtsComposerClient.cpp b/graphics/composer/aidl/vts/VtsComposerClient.cpp index f95e747535..2e2b193722 100644 --- a/graphics/composer/aidl/vts/VtsComposerClient.cpp +++ b/graphics/composer/aidl/vts/VtsComposerClient.cpp @@ -373,6 +373,12 @@ int64_t VtsComposerClient::getVsyncIdleTime() { return mComposerCallback->getVsyncIdleTime(); } +ndk::ScopedAStatus VtsComposerClient::setRefreshRateChangedCallbackDebugEnabled( + int64_t /* display */, bool /* enabled */) { + // TODO(b/202734676) Add implementation for VTS tests + return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); +} + int64_t VtsComposerClient::getInvalidDisplayId() { // returns an invalid display id (one that has not been registered to a // display. Currently assuming that a device will never have close to diff --git a/graphics/composer/aidl/vts/VtsComposerClient.h b/graphics/composer/aidl/vts/VtsComposerClient.h index 27788e757b..aee46d2a16 100644 --- a/graphics/composer/aidl/vts/VtsComposerClient.h +++ b/graphics/composer/aidl/vts/VtsComposerClient.h @@ -196,6 +196,9 @@ class VtsComposerClient { bool verifyComposerCallbackParams(); + ndk::ScopedAStatus setRefreshRateChangedCallbackDebugEnabled(int64_t /* display */, + bool /* enabled */); + // Keep track of displays and layers. When a test fails/ends, // the VtsComposerClient::tearDown should be called from the // test tearDown to clean up the resources for the test. From fd96ddced7d8af371b8fa03b7271771fd1baaa43 Mon Sep 17 00:00:00 2001 From: Raj Goparaju Date: Fri, 20 Jan 2023 15:29:53 -0800 Subject: [PATCH 706/998] Adding support for dynamic audio gain config Automotive OEMs need a mechanism to update vehicle-based audio port configurations during run-time. This can be achieved mostly through core audio hal aidl interface, namely IModule::getAudioPorts(). However it also limits the ability of audio hal since it is expected to maintan unchanged configuration for given audio device ports and have it available before audio framework initializes, which is not always the case. The following usecases are under consideration for this feature: 1. Audio gain stages updated at end-of-line/factories as runtime configurations. 2. Audio gain stages are stored outside of android partition (example - an external amplifier) and needs dynamic query post boot up. Availability at service init is not guaranteed since ECU lifecycles are not necessarily synchronized. 3. Audio gain stage updates based on user subscriptions to enable advanced signal processing capabilities. This change: - Adds a new set-api for callback to report changes to audio hardware module. It is expected that in future the same interface can serve as callback to multiple categories of configs (other than audio gain stages). - Adds a new clear to remove callbacks. - Adds a new callback interface for changes to audio port configs. For the time being, car framework shall only support changes to audio gain stages. Bug: 261647905 Test: VTS test Change-Id: I5891e324f2d909a9c5fe30c47ad30e23e74ec6c4 Signed-off-by: Raj Goparaju --- .../audiocontrol/IAudioControl.aidl | 2 + .../audiocontrol/IModuleChangeCallback.aidl | 38 ++++++++++++ .../audiocontrol/IAudioControl.aidl | 23 +++++++ .../audiocontrol/IModuleChangeCallback.aidl | 61 +++++++++++++++++++ 4 files changed, 124 insertions(+) create mode 100644 automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IModuleChangeCallback.aidl create mode 100644 automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IModuleChangeCallback.aidl diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioControl.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioControl.aidl index 8dc5ffe2eb..ffd575dfa4 100644 --- a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioControl.aidl +++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioControl.aidl @@ -46,4 +46,6 @@ interface IAudioControl { oneway void onAudioFocusChangeWithMetaData(in android.hardware.audio.common.PlaybackTrackMetadata playbackMetaData, in int zoneId, in android.hardware.automotive.audiocontrol.AudioFocusChange focusChange); oneway void setAudioDeviceGainsChanged(in android.hardware.automotive.audiocontrol.Reasons[] reasons, in android.hardware.automotive.audiocontrol.AudioGainConfigInfo[] gains); oneway void registerGainCallback(in android.hardware.automotive.audiocontrol.IAudioGainCallback callback); + void setModuleChangeCallback(in android.hardware.automotive.audiocontrol.IModuleChangeCallback callback); + void clearModuleChangeCallback(); } diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IModuleChangeCallback.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IModuleChangeCallback.aidl new file mode 100644 index 0000000000..2bbb9362b9 --- /dev/null +++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IModuleChangeCallback.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.hardware.automotive.audiocontrol; +@VintfStability +interface IModuleChangeCallback { + oneway void onAudioPortsChanged(in android.media.audio.common.AudioPort[] audioPorts); +} diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl index 0ffcd5e19f..9564efc859 100644 --- a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl +++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl @@ -51,6 +51,7 @@ import android.hardware.automotive.audiocontrol.AudioGainConfigInfo; import android.hardware.automotive.audiocontrol.DuckingInfo; import android.hardware.automotive.audiocontrol.IAudioGainCallback; import android.hardware.automotive.audiocontrol.IFocusListener; +import android.hardware.automotive.audiocontrol.IModuleChangeCallback; import android.hardware.automotive.audiocontrol.MutingInfo; import android.hardware.automotive.audiocontrol.Reasons; @@ -183,4 +184,26 @@ interface IAudioControl { * interface. */ oneway void registerGainCallback(in IAudioGainCallback callback); + + /** + * Sets callback with HAL for notifying changes to hardware module (that is: + * {@link android.hardware.audio.core.IModule}) configurations. + * + * @param callback The {@link android.hardware.automotive.audiocontrol.IModuleChangeCallback} + * interface to use use when new updates are available for + * {@link android.hardware.audio.core.IModule} configs + * @throws EX_UNSUPPORTED_OPERATION if dynamic audio configs are not supported. + * @throws EX_ILLEGAL_STATE if a callback already exists + * @throws EX_ILLEGAL_ARGUMENT if the passed callback is (@code null} + */ + void setModuleChangeCallback(in IModuleChangeCallback callback); + + /** + * Clears module change callback + * + * If no callback is registered previously, then this call should be a no-op. + * + * @throws EX_UNSUPPORTED_OPERATION if dynamic audio configs are not supported. + */ + void clearModuleChangeCallback(); } diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IModuleChangeCallback.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IModuleChangeCallback.aidl new file mode 100644 index 0000000000..4282483100 --- /dev/null +++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IModuleChangeCallback.aidl @@ -0,0 +1,61 @@ +/* + * 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.hardware.automotive.audiocontrol; + +import android.media.audio.common.AudioPort; + +/** + * Interface definition for asynchronous changes to audio configs defined + * for a hardware {@link android.hardware.audio.core.IModule}. + */ +@VintfStability +oneway interface IModuleChangeCallback { + /** + * Used to indicate that one or more {@link android.media.audio.common.AudioPort} + * configs have changed. Implementations MUST return at least one AudioPort. + * + * Notes for AudioPort: + * 1. For V3, the support will be limited to configurable AudioGain stages - per + * car audio framework support. + * 2. For automotive 'bus' devices, the expected settings are + * AudioDevice { + * AudioDeviceDescription {type: IN/OUT_DEVICE, connection: CONNECTION_BUS} + * AudioDeviceAddress {id: string}} + * + * Notes for AudioGain: + * 1. Car audio framework only supports AudioGainMode::JOINT. Any other mode + * selection will be ignored. + * See {@link android.media.audio.common.AudioGainMode} + * 2. Implementations MUST ensure that the gain stages are identical for buses + * that map to the same volume group. Any inconsistencies will result in + * inferior volume-change experience to the users. + * 3. Implementations MUST ensure that the new gain stages are subset (do not + * exceed) of the gain stage definitions provided to audio policy. If they + * exceed, it can result in failure when setting value over the range + * allowed by the audio policy. + * + * Other notes: + * 1. In case of AudioControl service restart or resume, the implementations MUST + * issue an immediate callback following registration. + * 2. In case of client restart, the AudioControl service MUST clear all stale + * callbacks. + * + * @param audioPorts list of {@link android.media.audio.common.AudioPort} that + * are updated + */ + void onAudioPortsChanged(in AudioPort[] audioPorts); +} From ebb2b746cedcdbd4242d2e6f85dc129b80ba4f34 Mon Sep 17 00:00:00 2001 From: Jeff Pu Date: Mon, 13 Feb 2023 17:58:33 +0000 Subject: [PATCH 707/998] Make virtual fingerprint HAL as lazy HAL Bug: 262630839 Test: atest VtsHalBiometricsFingerprintTargetTest Change-Id: I8f17f00d3e91554fcfb99c8b478ed8b6131b4530 --- biometrics/fingerprint/aidl/default/fingerprint-example.rc | 6 ++---- biometrics/fingerprint/aidl/default/main.cpp | 4 +++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/biometrics/fingerprint/aidl/default/fingerprint-example.rc b/biometrics/fingerprint/aidl/default/fingerprint-example.rc index 10db00d0f5..ee4713c158 100644 --- a/biometrics/fingerprint/aidl/default/fingerprint-example.rc +++ b/biometrics/fingerprint/aidl/default/fingerprint-example.rc @@ -2,8 +2,6 @@ service vendor.fingerprint-example /vendor/bin/hw/android.hardware.biometrics.fi class hal user nobody group nobody + interface aidl android.hardware.biometrics.fingerprint.IFingerprint/virtual + oneshot disabled -on property:ro.vendor.fingerprint_virtual_hal_start=true - enable vendor.fingerprint-example -on property:persist.vendor.fingerprint.virtual.type=* - enable vendor.fingerprint-example diff --git a/biometrics/fingerprint/aidl/default/main.cpp b/biometrics/fingerprint/aidl/default/main.cpp index 0e672b10ab..7df015b381 100644 --- a/biometrics/fingerprint/aidl/default/main.cpp +++ b/biometrics/fingerprint/aidl/default/main.cpp @@ -28,8 +28,10 @@ int main() { std::shared_ptr hal = ndk::SharedRefBase::make(); const std::string instance = std::string(Fingerprint::descriptor) + "/virtual"; - binder_status_t status = AServiceManager_addService(hal->asBinder().get(), instance.c_str()); + binder_status_t status = + AServiceManager_registerLazyService(hal->asBinder().get(), instance.c_str()); CHECK_EQ(status, STATUS_OK); + AServiceManager_forceLazyServicesPersist(true); ABinderProcess_joinThreadPool(); return EXIT_FAILURE; // should not reach From 27a02e1111e8fba415b76f83b1debd3c983b9b07 Mon Sep 17 00:00:00 2001 From: Raj Goparaju Date: Mon, 30 Jan 2023 16:17:14 -0800 Subject: [PATCH 708/998] Add default implementation for dynamic volume config feature - new dumpsys cmd "--audioPortChangeCallback" to trigger AudioPort callback. For now, limited to AudioGain stage updates only. - AudioPort callback will carry the new gain stages information to the framework. Bug: 261647905 Test: VTS Change-Id: I404bde3671bf1ad39d1cb091ebf63d1049edec34 Signed-off-by: Raj Goparaju --- .../audiocontrol/aidl/default/Android.bp | 2 +- .../aidl/default/AudioControl.cpp | 299 +++++++++++++++++- .../audiocontrol/aidl/default/AudioControl.h | 20 ++ 3 files changed, 319 insertions(+), 2 deletions(-) diff --git a/automotive/audiocontrol/aidl/default/Android.bp b/automotive/audiocontrol/aidl/default/Android.bp index 6bf4b9d860..dde05c3582 100644 --- a/automotive/audiocontrol/aidl/default/Android.bp +++ b/automotive/audiocontrol/aidl/default/Android.bp @@ -31,7 +31,7 @@ cc_binary { "android.hardware.audio.common@7.0-enums", "android.hardware.audio.common-V1-ndk", "android.frameworks.automotive.powerpolicy-V1-ndk", - "android.hardware.automotive.audiocontrol-V2-ndk", + "android.hardware.automotive.audiocontrol-V3-ndk", "libbase", "libbinder_ndk", "libcutils", diff --git a/automotive/audiocontrol/aidl/default/AudioControl.cpp b/automotive/audiocontrol/aidl/default/AudioControl.cpp index a121f8be21..cf7307d347 100644 --- a/automotive/audiocontrol/aidl/default/AudioControl.cpp +++ b/automotive/audiocontrol/aidl/default/AudioControl.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -37,6 +38,8 @@ namespace aidl::android::hardware::automotive::audiocontrol { using ::android::base::EqualsIgnoreCase; +using ::android::base::ParseBool; +using ::android::base::ParseBoolResult; using ::android::base::ParseInt; using ::std::shared_ptr; using ::std::string; @@ -70,6 +73,95 @@ bool safelyParseInt(string s, int* out) { } } // namespace +namespace { +using ::aidl::android::media::audio::common::AudioChannelLayout; +using ::aidl::android::media::audio::common::AudioDeviceDescription; +using ::aidl::android::media::audio::common::AudioDeviceType; +using ::aidl::android::media::audio::common::AudioFormatDescription; +using ::aidl::android::media::audio::common::AudioFormatType; +using ::aidl::android::media::audio::common::AudioGain; +using ::aidl::android::media::audio::common::AudioGainMode; +using ::aidl::android::media::audio::common::AudioIoFlags; +using ::aidl::android::media::audio::common::AudioOutputFlags; +using ::aidl::android::media::audio::common::AudioPort; +using ::aidl::android::media::audio::common::AudioPortDeviceExt; +using ::aidl::android::media::audio::common::AudioPortExt; +using ::aidl::android::media::audio::common::AudioPortMixExt; +using ::aidl::android::media::audio::common::AudioProfile; +using ::aidl::android::media::audio::common::PcmType; + +// reuse common code artifacts +void fillProfile(const std::vector& channelLayouts, + const std::vector& sampleRates, AudioProfile* profile) { + for (auto layout : channelLayouts) { + profile->channelMasks.push_back( + AudioChannelLayout::make(layout)); + } + profile->sampleRates.insert(profile->sampleRates.end(), sampleRates.begin(), sampleRates.end()); +} + +AudioProfile createProfile(PcmType pcmType, const std::vector& channelLayouts, + const std::vector& sampleRates) { + AudioProfile profile; + profile.format.type = AudioFormatType::PCM; + profile.format.pcm = pcmType; + fillProfile(channelLayouts, sampleRates, &profile); + return profile; +} + +AudioProfile createProfile(const std::string& encodingType, + const std::vector& channelLayouts, + const std::vector& sampleRates) { + AudioProfile profile; + profile.format.encoding = encodingType; + fillProfile(channelLayouts, sampleRates, &profile); + return profile; +} + +AudioPortExt createDeviceExt(AudioDeviceType devType, int32_t flags, + const std::string& connection = "", const std::string& address = "") { + AudioPortDeviceExt deviceExt; + deviceExt.device.type.type = devType; + if (devType == AudioDeviceType::IN_MICROPHONE && connection.empty()) { + deviceExt.device.address = "bottom"; + } else if (devType == AudioDeviceType::IN_MICROPHONE_BACK && connection.empty()) { + deviceExt.device.address = "back"; + } else { + deviceExt.device.address = std::move(address); + } + deviceExt.device.type.connection = std::move(connection); + deviceExt.flags = flags; + return AudioPortExt::make(deviceExt); +} + +AudioPort createPort(int32_t id, const std::string& name, int32_t flags, bool isInput, + const AudioPortExt& ext) { + AudioPort port; + port.id = id; + port.name = name; + port.flags = isInput ? AudioIoFlags::make(flags) + : AudioIoFlags::make(flags); + port.ext = ext; + return port; +} + +AudioGain createGain(int32_t mode, AudioChannelLayout channelMask, int32_t minValue, + int32_t maxValue, int32_t defaultValue, int32_t stepValue, + int32_t minRampMs = 100, int32_t maxRampMs = 100, bool useForVolume = true) { + AudioGain gain; + gain.mode = mode; + gain.channelMask = channelMask; + gain.minValue = minValue; + gain.maxValue = maxValue; + gain.defaultValue = defaultValue; + gain.stepValue = stepValue; + gain.minRampMs = minRampMs; + gain.maxRampMs = maxRampMs; + gain.useForVolume = useForVolume; + return gain; +} +} // namespace + ndk::ScopedAStatus AudioControl::registerFocusListener( const shared_ptr& in_listener) { LOG(DEBUG) << "registering focus listener"; @@ -190,6 +282,33 @@ ndk::ScopedAStatus AudioControl::registerGainCallback( return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus AudioControl::setModuleChangeCallback( + const std::shared_ptr& in_callback) { + LOG(DEBUG) << ": " << __func__; + + if (in_callback.get() == nullptr) { + LOG(ERROR) << __func__ << ": Callback is nullptr"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (mModuleChangeCallback != nullptr) { + LOG(ERROR) << __func__ << ": Module change callback was already registered"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } + std::atomic_store(&mModuleChangeCallback, in_callback); + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus AudioControl::clearModuleChangeCallback() { + if (mModuleChangeCallback != nullptr) { + shared_ptr nullCallback = nullptr; + std::atomic_store(&mModuleChangeCallback, nullCallback); + LOG(DEBUG) << ":" << __func__ << ": Unregistered successfully"; + } else { + LOG(DEBUG) << ":" << __func__ << ": No callback registered, no-op"; + } + return ndk::ScopedAStatus::ok(); +} + binder_status_t AudioControl::dump(int fd, const char** args, uint32_t numArgs) { if (numArgs == 0) { return dumpsys(fd); @@ -208,6 +327,8 @@ binder_status_t AudioControl::dump(int fd, const char** args, uint32_t numArgs) return cmdAbandonFocusWithMetaData(fd, args, numArgs); } else if (EqualsIgnoreCase(option, "--audioGainCallback")) { return cmdOnAudioDeviceGainsChanged(fd, args, numArgs); + } else if (EqualsIgnoreCase(option, "--audioPortsChangedCallback")) { + return cmdOnAudioPortsChanged(fd, args, numArgs); } else { dprintf(fd, "Invalid option: %s\n", option.c_str()); return STATUS_BAD_VALUE; @@ -262,7 +383,21 @@ binder_status_t AudioControl::cmdHelp(int fd) const { dprintf(fd, "Tags are optional. If provided, it must follow the = pattern, where the " "value is namespaced (for example com.google.strategy=VR).\n"); - + dprintf(fd, + "--audioPortsChangedCallback " + " [ " + "]: fires audio ports changed callback. Carries list of modified " + "AudioPorts. " + "For simplicity, this command accepts limited information for each AudioPort: " + "id(int), name(string), port address(string), connection type (string), " + "audio gain (csv int)\n"); + dprintf(fd, "Notes: \n"); + dprintf(fd, + "1. AudioGain csv should match definition at " + "android/media/audio/common/AudioPort.aidl\n"); + dprintf(fd, + "2. See android/media/audio/common/AudioDeviceDescription.aidl for valid " + " values.\n"); return STATUS_OK; } @@ -514,4 +649,166 @@ binder_status_t AudioControl::cmdOnAudioDeviceGainsChanged(int fd, const char** toEnumString(reasons).c_str(), toString(agcis).c_str()); return STATUS_OK; } + +binder_status_t AudioControl::parseAudioGains(int fd, const std::string& stringGain, + std::vector& gains) { + const int kAudioGainSize = 9; + std::stringstream csvGain(stringGain); + std::vector vecGain; + std::string value; + while (getline(csvGain, value, ',')) { + vecGain.push_back(value); + } + + if ((vecGain.size() == 0) || ((vecGain.size() % kAudioGainSize) != 0)) { + dprintf(fd, "Erroneous input to generate AudioGain: %s\n", stringGain.c_str()); + return STATUS_BAD_VALUE; + } + + // iterate over injected AudioGains + for (int index = 0; index < vecGain.size(); index += kAudioGainSize) { + int32_t mode; + if (!safelyParseInt(vecGain[index], &mode)) { + dprintf(fd, "Non-integer index provided with request: %s\n", vecGain[index].c_str()); + return STATUS_BAD_VALUE; + } + + // car audio framework only supports JOINT mode. + // skip injected AudioGains that are not compliant with this. + if (mode != static_cast(AudioGainMode::JOINT)) { + LOG(WARNING) << ":" << __func__ << ": skipping gain since it is not JOINT mode!"; + continue; + } + + int32_t layout; + if (!safelyParseInt(vecGain[index + 1], &layout)) { + dprintf(fd, "Non-integer index provided with request: %s\n", + vecGain[index + 1].c_str()); + return STATUS_BAD_VALUE; + } + AudioChannelLayout channelMask = + AudioChannelLayout::make(layout); + + int32_t minValue; + if (!safelyParseInt(vecGain[index + 2], &minValue)) { + dprintf(fd, "Non-integer index provided with request: %s\n", + vecGain[index + 2].c_str()); + return STATUS_BAD_VALUE; + } + + int32_t maxValue; + if (!safelyParseInt(vecGain[index + 3], &maxValue)) { + dprintf(fd, "Non-integer index provided with request: %s\n", + vecGain[index + 3].c_str()); + return STATUS_BAD_VALUE; + } + + int32_t defaultValue; + if (!safelyParseInt(vecGain[index + 4], &defaultValue)) { + dprintf(fd, "Non-integer index provided with request: %s\n", + vecGain[index + 4].c_str()); + return STATUS_BAD_VALUE; + } + + int32_t stepValue; + if (!safelyParseInt(vecGain[index + 5], &stepValue)) { + dprintf(fd, "Non-integer index provided with request: %s\n", + vecGain[index + 5].c_str()); + return STATUS_BAD_VALUE; + } + + int32_t minRampMs; + if (!safelyParseInt(vecGain[index + 6], &minRampMs)) { + dprintf(fd, "Non-integer index provided with request: %s\n", + vecGain[index + 6].c_str()); + return STATUS_BAD_VALUE; + } + + int32_t maxRampMs; + if (!safelyParseInt(vecGain[index + 7], &maxRampMs)) { + dprintf(fd, "Non-integer index provided with request: %s\n", + vecGain[index + 7].c_str()); + return STATUS_BAD_VALUE; + } + + ParseBoolResult useForVolume = ParseBool(vecGain[index + 8]); + if (useForVolume == ParseBoolResult::kError) { + dprintf(fd, "Non-boolean index provided with request: %s\n", + vecGain[index + 8].c_str()); + return STATUS_BAD_VALUE; + } else if (useForVolume == ParseBoolResult::kFalse) { + // at this level we only care about gain stages that are relevant + // for volume control. skip the gain stage if its flagged as false. + LOG(WARNING) << ":" << __func__ + << ": skipping gain since it is not for volume control!"; + continue; + } + + AudioGain gain = createGain(mode, channelMask, minValue, maxValue, defaultValue, stepValue, + minRampMs, maxRampMs, true /*useForVolume*/); + gains.push_back(gain); + } + return STATUS_OK; +} + +binder_status_t AudioControl::cmdOnAudioPortsChanged(int fd, const char** args, uint32_t numArgs) { + if (!checkCallerHasWritePermissions(fd)) { + return STATUS_PERMISSION_DENIED; + } + + if ((numArgs < 6) || ((numArgs - 1) % 5 != 0)) { + dprintf(fd, + "Invalid number of arguments: please provide\n" + "--audioPortsChangedCallback " + " [ " + "]: triggers audio ports changed callback. Carries list of " + "modified AudioPorts. " + "For simplicity, this command accepts limited information for each AudioPort: " + "id(int), name(string), port address(string), connection type (string), " + "audio gain (csv int)\n"); + return STATUS_BAD_VALUE; + } + + std::vector ports; + for (uint32_t i = 1; i < numArgs; i += 5) { + binder_status_t status; + int32_t id; + if (!safelyParseInt(std::string(args[i]), &id)) { + dprintf(fd, "Non-integer index provided with request: %s\n", + std::string(args[i]).c_str()); + return STATUS_BAD_VALUE; + } + + std::string name = std::string(args[i + 1]); + std::string address = std::string(args[i + 2]); + std::string connection = std::string(args[i + 3]); + + std::string stringGains = std::string(args[i + 4]); + std::vector gains; + status = parseAudioGains(fd, stringGains, gains); + if (status != STATUS_OK) { + return status; + } + + AudioPort port = createPort( + id, name, 0 /*flags*/, false /*isInput*/, + createDeviceExt(AudioDeviceType::OUT_DEVICE, 0 /*flags*/, connection, address)); + port.gains.insert(port.gains.begin(), gains.begin(), gains.end()); + + ports.push_back(port); + } + + if (mModuleChangeCallback == nullptr) { + dprintf(fd, + "Unable to trigger audio port callback for ports: %s \n" + " - no module change callback registered\n", + toString(ports).c_str()); + return STATUS_BAD_VALUE; + } + + // TODO (b/269139706) fix atomic read issue + mModuleChangeCallback->onAudioPortsChanged(ports); + dprintf(fd, "SUCCESS audio port callback for ports: %s \n", toString(ports).c_str()); + return STATUS_OK; +} } // namespace aidl::android::hardware::automotive::audiocontrol diff --git a/automotive/audiocontrol/aidl/default/AudioControl.h b/automotive/audiocontrol/aidl/default/AudioControl.h index 16b80e890c..7eca446f12 100644 --- a/automotive/audiocontrol/aidl/default/AudioControl.h +++ b/automotive/audiocontrol/aidl/default/AudioControl.h @@ -21,11 +21,20 @@ #include #include #include +#include #include #include #include +#include +#include +#include +#include +#include +#include +#include + namespace aidl::android::hardware::automotive::audiocontrol { namespace audiohalcommon = ::aidl::android::hardware::audio::common; @@ -51,6 +60,9 @@ class AudioControl : public BnAudioControl { const std::vector& in_gains) override; ndk::ScopedAStatus registerGainCallback( const std::shared_ptr& in_callback) override; + ndk::ScopedAStatus setModuleChangeCallback( + const std::shared_ptr& in_callback) override; + ndk::ScopedAStatus clearModuleChangeCallback() override; binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; @@ -67,15 +79,23 @@ class AudioControl : public BnAudioControl { */ std::shared_ptr mAudioGainCallback = nullptr; + std::shared_ptr mModuleChangeCallback = nullptr; + binder_status_t cmdHelp(int fd) const; binder_status_t cmdRequestFocus(int fd, const char** args, uint32_t numArgs); binder_status_t cmdAbandonFocus(int fd, const char** args, uint32_t numArgs); binder_status_t cmdRequestFocusWithMetaData(int fd, const char** args, uint32_t numArgs); binder_status_t cmdAbandonFocusWithMetaData(int fd, const char** args, uint32_t numArgs); binder_status_t cmdOnAudioDeviceGainsChanged(int fd, const char** args, uint32_t numArgs); + binder_status_t cmdOnAudioPortsChanged(int fd, const char** args, uint32_t numArgs); binder_status_t parseMetaData(int fd, const std::string& metadataLiteral, audiohalcommon::PlaybackTrackMetadata& trackMetadata); + binder_status_t parseAudioGains( + int fd, const std::string& stringGain, + std::vector<::aidl::android::media::audio::common::AudioGain>& gains); + binder_status_t parseSampleRates(int fd, const std::string& sampleRates, + std::vector& vecSampleRates); binder_status_t dumpsys(int fd); }; From a8bf907f9ab4504b48f0c4546512385bfdad952e Mon Sep 17 00:00:00 2001 From: Raj Goparaju Date: Sun, 5 Feb 2023 14:58:40 -0800 Subject: [PATCH 709/998] Adding VTS tests for IAudioControl#registerModuleChangeCallback Tests the following: a) successful registration b) successful un-registration b) exception check - double registration - nullptr registration - unsupported feature Bug: 261647905 Test: run vts --module VtsAidlHalAudioControlTest Change-Id: I7336c9e8dd8e3ca444e77218fc1150e5528dba32 Signed-off-by: Raj Goparaju --- automotive/audiocontrol/aidl/vts/Android.bp | 2 +- .../aidl/vts/VtsHalAudioControlTargetTest.cpp | 48 +++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/automotive/audiocontrol/aidl/vts/Android.bp b/automotive/audiocontrol/aidl/vts/Android.bp index edac160e77..a9122ce2d6 100644 --- a/automotive/audiocontrol/aidl/vts/Android.bp +++ b/automotive/audiocontrol/aidl/vts/Android.bp @@ -39,7 +39,7 @@ cc_test { "libxml2", ], static_libs: [ - "android.hardware.automotive.audiocontrol-V2-cpp", + "android.hardware.automotive.audiocontrol-V3-cpp", "libgmock", ], test_suites: [ diff --git a/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp b/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp index f4f5eef757..f4e3b5ab9d 100644 --- a/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp +++ b/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -34,10 +35,14 @@ using android::hardware::automotive::audiocontrol::AudioFocusChange; using android::hardware::automotive::audiocontrol::AudioGainConfigInfo; using android::hardware::automotive::audiocontrol::BnAudioGainCallback; using android::hardware::automotive::audiocontrol::BnFocusListener; +using android::hardware::automotive::audiocontrol::BnModuleChangeCallback; using android::hardware::automotive::audiocontrol::DuckingInfo; using android::hardware::automotive::audiocontrol::IAudioControl; +using android::hardware::automotive::audiocontrol::IModuleChangeCallback; using android::hardware::automotive::audiocontrol::MutingInfo; using android::hardware::automotive::audiocontrol::Reasons; +using ::testing::AnyOf; +using ::testing::Eq; #include "android_audio_policy_configuration_V7_0.h" @@ -55,6 +60,8 @@ class AudioControlAidl : public testing::TestWithParam { ASSERT_NE(audioControl, nullptr); } + void TearDown() override { audioControl = nullptr; } + sp audioControl; int32_t capabilities; }; @@ -226,6 +233,47 @@ TEST_P(AudioControlAidl, AudioGainCallbackRegistration) { ASSERT_TRUE(audioControl->registerGainCallback(gainCallback2).isOk()); } +/* + * Test Module change Callback registration. + * + * Verifies that: + * - setModuleChangeCallback succeeds + * - setting a double callback fails with exception + * - clearModuleChangeCallback succeeds + * - setting with nullptr callback fails with exception + * - closing handle does not crash + */ +struct ModuleChangeCallbackMock : BnModuleChangeCallback { + MOCK_METHOD(Status, onAudioPortsChanged, + (const std::vector& audioPorts)); +}; + +TEST_P(AudioControlAidl, RegisterModuleChangeCallbackTwiceThrowsException) { + ALOGI("Register Module change callback test"); + // make sure no stale callbacks. + audioControl->clearModuleChangeCallback(); + + sp moduleChangeCallback = new ModuleChangeCallbackMock(); + auto status = audioControl->setModuleChangeCallback(moduleChangeCallback); + EXPECT_THAT(status.exceptionCode(), + AnyOf(Eq(Status::EX_NONE), Eq(Status::EX_UNSUPPORTED_OPERATION))); + if (!status.isOk()) return; + + sp moduleChangeCallback2 = new ModuleChangeCallbackMock(); + // no need to check for unsupported feature + EXPECT_EQ(Status::EX_ILLEGAL_STATE, + audioControl->setModuleChangeCallback(moduleChangeCallback2).exceptionCode()); + ASSERT_TRUE(audioControl->clearModuleChangeCallback().isOk()); + ASSERT_TRUE(audioControl->setModuleChangeCallback(moduleChangeCallback2).isOk()); +} + +TEST_P(AudioControlAidl, RegisterModuleChangeNullCallbackThrowsException) { + ALOGI("Register Module change callback with nullptr test"); + auto status = audioControl->setModuleChangeCallback(nullptr); + EXPECT_THAT(status.exceptionCode(), + AnyOf(Eq(Status::EX_ILLEGAL_ARGUMENT), Eq(Status::EX_UNSUPPORTED_OPERATION))); +} + GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioControlAidl); INSTANTIATE_TEST_SUITE_P( Audiocontrol, AudioControlAidl, From e7b177e69d11e274ea06e303e0770d19f2d7a945 Mon Sep 17 00:00:00 2001 From: Xiang Wang Date: Wed, 21 Dec 2022 17:55:11 -0800 Subject: [PATCH 710/998] Update VTS for AIDL HAL Bug: b/205762943 Test: atest VtsHalThermalTargetTest Change-Id: I9ae738ea4b27f92445020822877ccd24234fa3c0 --- thermal/aidl/vts/VtsHalThermalTargetTest.cpp | 150 +++++++++++++++++-- 1 file changed, 139 insertions(+), 11 deletions(-) diff --git a/thermal/aidl/vts/VtsHalThermalTargetTest.cpp b/thermal/aidl/vts/VtsHalThermalTargetTest.cpp index eb91e3133c..05cc8e0acf 100644 --- a/thermal/aidl/vts/VtsHalThermalTargetTest.cpp +++ b/thermal/aidl/vts/VtsHalThermalTargetTest.cpp @@ -95,20 +95,15 @@ class ThermalAidlTest : public testing::TestWithParam { mThermalCallback = ndk::SharedRefBase::make(); ASSERT_NE(mThermalCallback, nullptr); - auto status = mThermal->registerThermalChangedCallback(mThermalCallback); - ASSERT_TRUE(status.isOk()); - // Expect to fail if register again - status = mThermal->registerThermalChangedCallback(mThermalCallback); - ASSERT_FALSE(status.isOk()); - ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()); + ::ndk::ScopedAStatus status = mThermal->registerThermalChangedCallback(mThermalCallback); + ASSERT_TRUE(status.isOk()) << status.getMessage(); } void TearDown() override { - auto status = mThermal->unregisterThermalChangedCallback(mThermalCallback); - ASSERT_TRUE(status.isOk()); + ::ndk::ScopedAStatus status = mThermal->unregisterThermalChangedCallback(mThermalCallback); + ASSERT_TRUE(status.isOk()) << status.getMessage(); // Expect to fail if unregister again status = mThermal->unregisterThermalChangedCallback(mThermalCallback); - ASSERT_FALSE(status.isOk()); ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()); } @@ -121,11 +116,144 @@ class ThermalAidlTest : public testing::TestWithParam { // This just calls into and back from our local ThermalChangedCallback impl. TEST_P(ThermalAidlTest, NotifyThrottlingTest) { std::shared_ptr thermalCallback = ndk::SharedRefBase::make(); - auto ret = thermalCallback->notifyThrottling(kThrottleTemp); - ASSERT_TRUE(ret.isOk()); + ::ndk::ScopedAStatus status = thermalCallback->notifyThrottling(kThrottleTemp); + ASSERT_TRUE(status.isOk()) << status.getMessage(); ASSERT_TRUE(thermalCallback->waitForCallback(200ms)); } +// Test Thermal->registerThermalChangedCallback. +TEST_P(ThermalAidlTest, RegisterThermalChangedCallbackTest) { + // Expect to fail with same callback + ::ndk::ScopedAStatus status = mThermal->registerThermalChangedCallback(mThermalCallback); + ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()); + // Expect to fail with null callback + status = mThermal->registerThermalChangedCallback(nullptr); + ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()); + std::shared_ptr localThermalCallback = + ndk::SharedRefBase::make(); + // Expect to succeed with different callback + status = mThermal->registerThermalChangedCallback(localThermalCallback); + ASSERT_TRUE(status.isOk()) << status.getMessage(); + ASSERT_TRUE(localThermalCallback->waitForCallback(200ms)); + // Remove the local callback + status = mThermal->unregisterThermalChangedCallback(localThermalCallback); + ASSERT_TRUE(status.isOk()) << status.getMessage(); + // Expect to fail with null callback + status = mThermal->unregisterThermalChangedCallback(nullptr); + ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()); +} + +// Test Thermal->registerThermalChangedCallbackWithType. +TEST_P(ThermalAidlTest, RegisterThermalChangedCallbackWithTypeTest) { + // Expect to fail with same callback + ::ndk::ScopedAStatus status = mThermal->registerThermalChangedCallbackWithType( + mThermalCallback, TemperatureType::SKIN); + ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()); + // Expect to fail with null callback + status = mThermal->registerThermalChangedCallbackWithType(nullptr, TemperatureType::SKIN); + ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()); + std::shared_ptr localThermalCallback = + ndk::SharedRefBase::make(); + // Expect to succeed with different callback + status = mThermal->registerThermalChangedCallbackWithType(localThermalCallback, + TemperatureType::SKIN); + ASSERT_TRUE(status.isOk()) << status.getMessage(); + ASSERT_TRUE(localThermalCallback->waitForCallback(200ms)); + // Remove the local callback + status = mThermal->unregisterThermalChangedCallback(localThermalCallback); + ASSERT_TRUE(status.isOk()) << status.getMessage(); + // Expect to fail with null callback + status = mThermal->unregisterThermalChangedCallback(nullptr); + ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode()); +} + +// Test Thermal->getCurrentTemperatures(). +TEST_P(ThermalAidlTest, TemperatureTest) { + std::vector ret; + ::ndk::ScopedAStatus status = mThermal->getTemperatures(&ret); + if (status.isOk()) { + for (auto& i : ret) { + EXPECT_LT(0u, i.name.size()); + LOG(INFO) << i.name + " " + toString(i.type) << "\n"; + } + } else { + ASSERT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode()); + } + + auto types = ::ndk::enum_range(); + for (const auto& type : types) { + status = mThermal->getTemperaturesWithType(type, &ret); + + if (status.isOk()) { + for (auto& i : ret) { + EXPECT_EQ(type, i.type) << "Expect type " + toString(type) + " but got " + + toString(i.type) + " for " + i.name; + EXPECT_LT(0u, i.name.size()); + } + } else { + ASSERT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode()); + } + } +} + +// Test Thermal->getTemperatureThresholds(). +TEST_P(ThermalAidlTest, TemperatureThresholdTest) { + std::vector ret; + ::ndk::ScopedAStatus status = mThermal->getTemperatureThresholds(&ret); + if (status.isOk()) { + for (auto& i : ret) { + EXPECT_LT(0u, i.name.size()); + LOG(INFO) << i.name + " " + toString(i.type) << "\n"; + } + } else { + ASSERT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode()); + } + + auto types = ::ndk::enum_range(); + for (const auto& type : types) { + status = mThermal->getTemperatureThresholdsWithType(type, &ret); + + if (status.isOk()) { + for (auto& i : ret) { + EXPECT_EQ(type, i.type) << "Expect type " + toString(type) + " but got " + + toString(i.type) + " for " + i.name; + EXPECT_LT(0u, i.name.size()); + } + } else { + ASSERT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode()); + } + } +} + +// Test Thermal->getCoolingDevices(). +TEST_P(ThermalAidlTest, CoolingDeviceTest) { + std::vector ret; + ::ndk::ScopedAStatus status = mThermal->getCoolingDevices(&ret); + if (status.isOk()) { + for (auto& i : ret) { + EXPECT_LT(0u, i.name.size()); + LOG(INFO) << i.name + " " + toString(i.type) << "\n"; + } + } else { + ASSERT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode()); + } + + auto types = ::ndk::enum_range(); + for (const auto& type : types) { + status = mThermal->getCoolingDevicesWithType(type, &ret); + if (status.isOk()) { + ASSERT_TRUE(status.isOk()); + for (auto& i : ret) { + EXPECT_EQ(type, i.type) << "Expect type " + toString(type) + " but got " + + toString(i.type) + " for " + i.name; + EXPECT_LT(0u, i.name.size()); + } + } else { + ASSERT_EQ(EX_ILLEGAL_STATE, status.getExceptionCode()); + } + } +} + GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ThermalAidlTest); INSTANTIATE_TEST_SUITE_P( Thermal, ThermalAidlTest, From f7684fb69d682b8766798d5d4fa0b43a3d4b73b2 Mon Sep 17 00:00:00 2001 From: Zhanglong Xia Date: Thu, 9 Feb 2023 18:03:37 +0800 Subject: [PATCH 711/998] Add Thread network HAL Bug: b/203492431 Test: Build and run the VTS test and run otbr-agent on Android emulator. Change-Id: I0163ea42054e6869e3fb9f93c1fe1a4b2aaff07c --- .../exclude/fcm_exclude.cpp | 1 + staging/threadnetwork/aidl/Android.bp | 17 ++ .../hardware/threadnetwork/IThreadChip.aidl | 88 ++++++++ .../threadnetwork/IThreadChipCallback.aidl | 30 +++ staging/threadnetwork/aidl/default/Android.bp | 54 +++++ ...roid.hardware.threadnetwork-service.sim.rc | 3 + staging/threadnetwork/aidl/default/main.cpp | 30 +++ .../threadnetwork/aidl/default/service.cpp | 90 ++++++++ .../threadnetwork/aidl/default/service.hpp | 42 ++++ .../aidl/default/thread_chip.cpp | 197 ++++++++++++++++++ .../aidl/default/thread_chip.hpp | 68 ++++++ staging/threadnetwork/aidl/default/utils.cpp | 34 +++ staging/threadnetwork/aidl/vts/Android.bp | 38 ++++ .../vts/VtsHalThreadNetworkTargetTest.cpp | 149 +++++++++++++ 14 files changed, 841 insertions(+) create mode 100644 staging/threadnetwork/aidl/Android.bp create mode 100644 staging/threadnetwork/aidl/android/hardware/threadnetwork/IThreadChip.aidl create mode 100644 staging/threadnetwork/aidl/android/hardware/threadnetwork/IThreadChipCallback.aidl create mode 100644 staging/threadnetwork/aidl/default/Android.bp create mode 100644 staging/threadnetwork/aidl/default/android.hardware.threadnetwork-service.sim.rc create mode 100644 staging/threadnetwork/aidl/default/main.cpp create mode 100644 staging/threadnetwork/aidl/default/service.cpp create mode 100644 staging/threadnetwork/aidl/default/service.hpp create mode 100644 staging/threadnetwork/aidl/default/thread_chip.cpp create mode 100644 staging/threadnetwork/aidl/default/thread_chip.hpp create mode 100644 staging/threadnetwork/aidl/default/utils.cpp create mode 100644 staging/threadnetwork/aidl/vts/Android.bp create mode 100644 staging/threadnetwork/aidl/vts/VtsHalThreadNetworkTargetTest.cpp diff --git a/compatibility_matrices/exclude/fcm_exclude.cpp b/compatibility_matrices/exclude/fcm_exclude.cpp index b17c0e22c6..f3374c3835 100644 --- a/compatibility_matrices/exclude/fcm_exclude.cpp +++ b/compatibility_matrices/exclude/fcm_exclude.cpp @@ -64,6 +64,7 @@ bool ShouldCheckMissingHalsInFcm(const std::string& package) { "android.hardware.keymaster", "android.hardware.media.bufferpool2", "android.hardware.radio", + "android.hardware.threadnetwork", "android.hardware.uwb.fira_android", // Fastboot HAL is only used by recovery. Recovery is owned by OEM. Framework diff --git a/staging/threadnetwork/aidl/Android.bp b/staging/threadnetwork/aidl/Android.bp new file mode 100644 index 0000000000..fcd3ab8501 --- /dev/null +++ b/staging/threadnetwork/aidl/Android.bp @@ -0,0 +1,17 @@ +aidl_interface { + name: "android.hardware.threadnetwork", + host_supported: true, + vendor_available: true, + + srcs: [ + "android/hardware/threadnetwork/*.aidl", + ], + + unstable: true, + + backend: { + ndk: { + enabled: true, + }, + }, +} diff --git a/staging/threadnetwork/aidl/android/hardware/threadnetwork/IThreadChip.aidl b/staging/threadnetwork/aidl/android/hardware/threadnetwork/IThreadChip.aidl new file mode 100644 index 0000000000..3c57149324 --- /dev/null +++ b/staging/threadnetwork/aidl/android/hardware/threadnetwork/IThreadChip.aidl @@ -0,0 +1,88 @@ +/* + * 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. + */ + +package android.hardware.threadnetwork; + +import android.hardware.threadnetwork.IThreadChipCallback; + +/** + * Controls a Thread radio chip on the device. + */ + +interface IThreadChip { + /** + * The operation failed for the internal error. + */ + const int ERROR_FAILED = 1; + + /** + * Insufficient buffers available to send frames. + */ + const int ERROR_NO_BUFS = 2; + + /** + * Service is busy and could not service the operation. + */ + const int ERROR_BUSY = 3; + + /** + * This method initializes the Thread HAL instance. If open completes + * successfully, then the Thread HAL instance is ready to accept spinel + * messages through sendSpinelFrame() API. + * + * @param callback A IThreadChipCallback callback instance. If multiple + * callbacks are passed in, the open() will return ERROR_BUSY. + * + * @throws EX_ILLEGAL_ARGUMENT if the callback handle is invalid (for example, it is null). + * @throws ServiceSpecificException with one of the following values: + * - ERROR_FAILED The interface cannot be opened due to an internal error. + * - ERROR_BUSY This interface is in use. + */ + void open(in IThreadChipCallback callback); + + /** + * Close the Thread HAL instance. Must free all resources. + * + * @throws EX_ILLEGAL_STATE if the Thread HAL instance is not opened. + * + */ + void close(); + + /** + * This method resets the Thread HAL internal state. The callback registered by + * `open()` won’t be reset and the resource allocated by `open()` won’t be free. + * + */ + void reset(); + + /** + * This method sends a spinel frame to the Thread HAL. + * + * This method should block until the frame is sent out successfully or + * the method throws errors immediately. + * + * Spinel Protocol: + * https://github.com/openthread/openthread/blob/main/src/lib/spinel/spinel.h + * + * @param frame The spinel frame to be sent. + * + * @throws ServiceSpecificException with one of the following values: + * - ERROR_FAILED The Thread HAL failed to send the frame for an internal reason. + * - ERROR_NO_BUFS Insufficient buffer space to send the frame. + * - ERROR_BUSY The Thread HAL is busy. + */ + void sendSpinelFrame(in byte[] frame); +} diff --git a/staging/threadnetwork/aidl/android/hardware/threadnetwork/IThreadChipCallback.aidl b/staging/threadnetwork/aidl/android/hardware/threadnetwork/IThreadChipCallback.aidl new file mode 100644 index 0000000000..a0fe88cf8d --- /dev/null +++ b/staging/threadnetwork/aidl/android/hardware/threadnetwork/IThreadChipCallback.aidl @@ -0,0 +1,30 @@ +/* + * 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. + */ + +package android.hardware.threadnetwork; + +interface IThreadChipCallback { + /** + * This method is called when a spinel frame is received. Thread network + * will process the received spinel frame. + * + * Spinel Protocol: + * https://github.com/openthread/openthread/blob/main/src/lib/spinel/spinel.h + * + * @param frame The received spinel frame. + */ + oneway void onReceiveSpinelFrame(in byte[] frame); +} diff --git a/staging/threadnetwork/aidl/default/Android.bp b/staging/threadnetwork/aidl/default/Android.bp new file mode 100644 index 0000000000..c7012951ea --- /dev/null +++ b/staging/threadnetwork/aidl/default/Android.bp @@ -0,0 +1,54 @@ +// 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. + +cc_defaults { + name: "threadnetwork_service_default", + vendor: true, + relative_install_path: "hw", + + shared_libs: [ + "android.hardware.threadnetwork-ndk", + "libbase", + "libbinder_ndk", + "libcutils", + "liblog", + "libutils", + ], + + static_libs: [ + "openthread-common", + "openthread-hdlc", + "openthread-platform", + "openthread-posix", + "openthread-url", + ], + + srcs: [ + "main.cpp", + "service.cpp", + "thread_chip.cpp", + "utils.cpp", + ], +} + +cc_binary { + name: "android.hardware.threadnetwork-service.sim", + defaults: ["threadnetwork_service_default"], + init_rc: ["android.hardware.threadnetwork-service.sim.rc"], +} + +cc_binary { + name: "android.hardware.threadnetwork-service", + defaults: ["threadnetwork_service_default"], +} diff --git a/staging/threadnetwork/aidl/default/android.hardware.threadnetwork-service.sim.rc b/staging/threadnetwork/aidl/default/android.hardware.threadnetwork-service.sim.rc new file mode 100644 index 0000000000..2fb409cd93 --- /dev/null +++ b/staging/threadnetwork/aidl/default/android.hardware.threadnetwork-service.sim.rc @@ -0,0 +1,3 @@ +service vendor.threadnetwork_hal /vendor/bin/hw/android.hardware.threadnetwork-service.sim spinel+hdlc+forkpty:///vendor/bin/ot-rcp?forkpty-arg=1 + class hal + user thread_network diff --git a/staging/threadnetwork/aidl/default/main.cpp b/staging/threadnetwork/aidl/default/main.cpp new file mode 100644 index 0000000000..b6c8bbb7ba --- /dev/null +++ b/staging/threadnetwork/aidl/default/main.cpp @@ -0,0 +1,30 @@ +/* + * 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. + */ + +#include +#include + +#include "service.hpp" + +int main(int argc, char* argv[]) { + CHECK_GT(argc, 1); + aidl::android::hardware::threadnetwork::Service service(&argv[1], argc - 1); + + ALOGI("Thread Network HAL is running"); + + service.startLoop(); + return EXIT_FAILURE; // should not reach +} diff --git a/staging/threadnetwork/aidl/default/service.cpp b/staging/threadnetwork/aidl/default/service.cpp new file mode 100644 index 0000000000..8047214f24 --- /dev/null +++ b/staging/threadnetwork/aidl/default/service.cpp @@ -0,0 +1,90 @@ +/* + * 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. + */ +#include "service.hpp" + +#include +#include +#include +#include + +#include "thread_chip.hpp" + +namespace aidl { +namespace android { +namespace hardware { +namespace threadnetwork { + +Service::Service(char* urls[], int numUrls) : mBinderFd(-1) { + int fd; + + CHECK_NE(urls, nullptr); + CHECK_GT(numUrls, 0); + + for (int i = 0; i < numUrls; i++) { + auto threadChip = ndk::SharedRefBase::make(i, urls[i]); + CHECK_NE(threadChip, nullptr); + mThreadChips.push_back(std::move(threadChip)); + } + + binder_status_t status = ABinderProcess_setupPolling(&fd); + CHECK_EQ(status, ::STATUS_OK); + CHECK_GE(fd, 0); + mBinderFd.reset(fd); +} + +void Service::Update(otSysMainloopContext& context) { + FD_SET(mBinderFd.get(), &context.mReadFdSet); + context.mMaxFd = std::max(context.mMaxFd, mBinderFd.get()); +} + +void Service::Process(const otSysMainloopContext& context) { + if (FD_ISSET(mBinderFd.get(), &context.mReadFdSet)) { + ABinderProcess_handlePolledCommands(); + } +} + +void Service::startLoop(void) { + const struct timeval kPollTimeout = {1, 0}; + otSysMainloopContext context; + int rval; + + ot::Posix::Mainloop::Manager::Get().Add(*this); + + while (true) { + context.mMaxFd = -1; + context.mTimeout = kPollTimeout; + + FD_ZERO(&context.mReadFdSet); + FD_ZERO(&context.mWriteFdSet); + FD_ZERO(&context.mErrorFdSet); + + ot::Posix::Mainloop::Manager::Get().Update(context); + + rval = select(context.mMaxFd + 1, &context.mReadFdSet, &context.mWriteFdSet, + &context.mErrorFdSet, &context.mTimeout); + + if (rval >= 0) { + ot::Posix::Mainloop::Manager::Get().Process(context); + } else if (errno != EINTR) { + ALOGE("select() failed: %s", strerror(errno)); + break; + } + } +} +} // namespace threadnetwork +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/staging/threadnetwork/aidl/default/service.hpp b/staging/threadnetwork/aidl/default/service.hpp new file mode 100644 index 0000000000..6e6e86845a --- /dev/null +++ b/staging/threadnetwork/aidl/default/service.hpp @@ -0,0 +1,42 @@ +/* + * 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. + */ + +#include + +#include "mainloop.hpp" +#include "thread_chip.hpp" + +namespace aidl { +namespace android { +namespace hardware { +namespace threadnetwork { + +class Service : public ot::Posix::Mainloop::Source { + public: + Service(char* urls[], int numUrls); + + void Update(otSysMainloopContext& context) override; + void Process(const otSysMainloopContext& context) override; + void startLoop(void); + + private: + ::android::base::unique_fd mBinderFd; + std::vector> mThreadChips; +}; +} // namespace threadnetwork +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/staging/threadnetwork/aidl/default/thread_chip.cpp b/staging/threadnetwork/aidl/default/thread_chip.cpp new file mode 100644 index 0000000000..38abad4ab5 --- /dev/null +++ b/staging/threadnetwork/aidl/default/thread_chip.cpp @@ -0,0 +1,197 @@ +/* + * 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. + */ + +#include "thread_chip.hpp" + +#include +#include +#include +#include +#include +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace threadnetwork { + +static ndk::ScopedAStatus errorStatus(int32_t error, const char* message) { + return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(error, message)); +} + +ThreadChip::ThreadChip(uint8_t id, char* url) + : mUrl(), + mInterface(handleReceivedFrame, this, mRxFrameBuffer), + mRxFrameBuffer(), + mCallback(nullptr) { + const std::string name(std::string() + IThreadChip::descriptor + "/chip" + std::to_string(id)); + binder_status_t status; + + ALOGI("ServiceName: %s, Url: %s", name.c_str(), url); + CHECK_EQ(mUrl.Init(url), 0); + status = AServiceManager_addService(asBinder().get(), name.c_str()); + CHECK_EQ(status, STATUS_OK); + + mDeathRecipient = ndk::ScopedAIBinder_DeathRecipient( + AIBinder_DeathRecipient_new(ThreadChip::onBinderDied)); + AIBinder_DeathRecipient_setOnUnlinked(mDeathRecipient.get(), ThreadChip::onBinderUnlinked); +} + +ThreadChip::~ThreadChip() { + AIBinder_DeathRecipient_delete(mDeathRecipient.get()); +} + +void ThreadChip::onBinderDied(void* context) { + reinterpret_cast(context)->onBinderDied(); +} + +void ThreadChip::onBinderDied(void) { + ALOGW("Thread Network HAL client is dead."); +} + +void ThreadChip::onBinderUnlinked(void* context) { + reinterpret_cast(context)->onBinderUnlinked(); +} + +void ThreadChip::onBinderUnlinked(void) { + ALOGW("ThreadChip binder is unlinked."); + deinitChip(); +} + +void ThreadChip::handleReceivedFrame(void* context) { + reinterpret_cast(context)->handleReceivedFrame(); +} + +void ThreadChip::handleReceivedFrame(void) { + if (mCallback != nullptr) { + mCallback->onReceiveSpinelFrame(std::vector( + mRxFrameBuffer.GetFrame(), mRxFrameBuffer.GetFrame() + mRxFrameBuffer.GetLength())); + } + + mRxFrameBuffer.DiscardFrame(); +} + +ndk::ScopedAStatus ThreadChip::open(const std::shared_ptr& in_callback) { + ndk::ScopedAStatus status = initChip(in_callback); + + if (status.isOk()) { + AIBinder_linkToDeath(in_callback->asBinder().get(), mDeathRecipient.get(), this); + ALOGI("Open IThreadChip successfully."); + } else { + ALOGW("Open IThreadChip failed, error: %s", status.getDescription().c_str()); + } + + return status; +} + +ndk::ScopedAStatus ThreadChip::initChip(const std::shared_ptr& in_callback) { + if (in_callback == nullptr) { + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } else if (mCallback == nullptr) { + if (mInterface.Init(mUrl) != OT_ERROR_NONE) { + return errorStatus(ERROR_FAILED, "Failed to initialize the interface"); + } + + mCallback = in_callback; + ot::Posix::Mainloop::Manager::Get().Add(*this); + return ndk::ScopedAStatus::ok(); + } else { + return errorStatus(ERROR_BUSY, "Interface is already opened"); + } +} + +ndk::ScopedAStatus ThreadChip::close() { + ndk::ScopedAStatus status; + std::shared_ptr callback = mCallback; + + status = deinitChip(); + if (status.isOk()) { + if (callback != nullptr) { + AIBinder_unlinkToDeath(callback->asBinder().get(), mDeathRecipient.get(), this); + } + + ALOGI("Close IThreadChip successfully"); + } else { + ALOGW("Close IThreadChip failed, error: %s", status.getDescription().c_str()); + } + + return status; +} + +ndk::ScopedAStatus ThreadChip::deinitChip() { + if (mCallback != nullptr) { + mInterface.Deinit(); + ot::Posix::Mainloop::Manager::Get().Remove(*this); + mCallback = nullptr; + return ndk::ScopedAStatus::ok(); + } + + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); +} + +ndk::ScopedAStatus ThreadChip::sendSpinelFrame(const std::vector& in_frame) { + ndk::ScopedAStatus status; + otError error; + + if (mCallback == nullptr) { + status = errorStatus(ERROR_FAILED, "The interface is not open"); + } else { + error = mInterface.SendFrame(reinterpret_cast(in_frame.data()), + in_frame.size()); + if (error == OT_ERROR_NONE) { + status = ndk::ScopedAStatus::ok(); + } else if (error == OT_ERROR_NO_BUFS) { + status = errorStatus(ERROR_NO_BUFS, "Insufficient buffer space to send"); + } else if (error == OT_ERROR_BUSY) { + status = errorStatus(ERROR_BUSY, "The interface is busy"); + } else { + status = errorStatus(ERROR_FAILED, "Failed to send the spinel frame"); + } + } + + if (!status.isOk()) { + ALOGW("Send spinel frame failed, error: %s", status.getDescription().c_str()); + } + + return status; +} + +ndk::ScopedAStatus ThreadChip::reset() { + mInterface.OnRcpReset(); + ALOGI("reset()"); + return ndk::ScopedAStatus::ok(); +} + +void ThreadChip::Update(otSysMainloopContext& context) { + if (mCallback != nullptr) { + mInterface.UpdateFdSet(context.mReadFdSet, context.mWriteFdSet, context.mMaxFd, + context.mTimeout); + } +} + +void ThreadChip::Process(const otSysMainloopContext& context) { + struct RadioProcessContext radioContext; + + if (mCallback != nullptr) { + radioContext.mReadFdSet = &context.mReadFdSet; + radioContext.mWriteFdSet = &context.mWriteFdSet; + mInterface.Process(radioContext); + } +} +} // namespace threadnetwork +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/staging/threadnetwork/aidl/default/thread_chip.hpp b/staging/threadnetwork/aidl/default/thread_chip.hpp new file mode 100644 index 0000000000..da5cba7585 --- /dev/null +++ b/staging/threadnetwork/aidl/default/thread_chip.hpp @@ -0,0 +1,68 @@ +/* + * 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. + */ + +#pragma once + +#include +#include + +#include "hdlc_interface.hpp" +#include "lib/spinel/spinel_interface.hpp" +#include "mainloop.hpp" + +#include +#include +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace threadnetwork { + +class ThreadChip : public BnThreadChip, ot::Posix::Mainloop::Source { + public: + ThreadChip(uint8_t id, char* url); + ~ThreadChip(); + + ndk::ScopedAStatus open(const std::shared_ptr& in_callback) override; + ndk::ScopedAStatus close() override; + ndk::ScopedAStatus sendSpinelFrame(const std::vector& in_frame) override; + ndk::ScopedAStatus reset() override; + void Update(otSysMainloopContext& context) override; + void Process(const otSysMainloopContext& context) override; + + private: + static void onBinderDied(void* context); + void onBinderDied(void); + static void onBinderUnlinked(void* context); + void onBinderUnlinked(void); + static void handleReceivedFrame(void* context); + void handleReceivedFrame(void); + + ndk::ScopedAStatus initChip(const std::shared_ptr& in_callback); + ndk::ScopedAStatus deinitChip(); + + ot::Url::Url mUrl; + ot::Posix::HdlcInterface mInterface; + ot::Spinel::SpinelInterface::RxFrameBuffer mRxFrameBuffer; + std::shared_ptr mCallback; + ::ndk::ScopedAIBinder_DeathRecipient mDeathRecipient; +}; + +} // namespace threadnetwork +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/staging/threadnetwork/aidl/default/utils.cpp b/staging/threadnetwork/aidl/default/utils.cpp new file mode 100644 index 0000000000..d3b4062ee3 --- /dev/null +++ b/staging/threadnetwork/aidl/default/utils.cpp @@ -0,0 +1,34 @@ +/* + * 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. + */ + +#include +#include + +void otLogCritPlat(const char* format, ...) { + va_list args; + + va_start(args, format); + __android_log_vprint(ANDROID_LOG_FATAL, LOG_TAG, format, args); + va_end(args); +} + +void otLogWarnPlat(const char* format, ...) { + va_list args; + + va_start(args, format); + __android_log_vprint(ANDROID_LOG_WARN, LOG_TAG, format, args); + va_end(args); +} diff --git a/staging/threadnetwork/aidl/vts/Android.bp b/staging/threadnetwork/aidl/vts/Android.bp new file mode 100644 index 0000000000..70386d98be --- /dev/null +++ b/staging/threadnetwork/aidl/vts/Android.bp @@ -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. +// + +cc_test { + name: "VtsHalThreadNetworkTargetTest", + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + srcs: [ + "VtsHalThreadNetworkTargetTest.cpp", + ], + + shared_libs: [ + "libbinder", + "libbinder_ndk", + ], + static_libs: [ + "android.hardware.threadnetwork-ndk", + ], + test_suites: [ + "general-tests", + "vts", + ], +} diff --git a/staging/threadnetwork/aidl/vts/VtsHalThreadNetworkTargetTest.cpp b/staging/threadnetwork/aidl/vts/VtsHalThreadNetworkTargetTest.cpp new file mode 100644 index 0000000000..3e43f9c8b7 --- /dev/null +++ b/staging/threadnetwork/aidl/vts/VtsHalThreadNetworkTargetTest.cpp @@ -0,0 +1,149 @@ +/* + * 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. + */ + +#define LOG_TAG "ThreadNetworkHalTargetTest" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +using aidl::android::hardware::threadnetwork::BnThreadChipCallback; +using aidl::android::hardware::threadnetwork::IThreadChip; +using android::ProcessState; +using ndk::ScopedAStatus; +using ndk::SpAIBinder; + +namespace { +constexpr static int kCallbackTimeoutMs = 5000; +} // namespace + +class ThreadChipCallback : public BnThreadChipCallback { + public: + ThreadChipCallback(const std::function&)>& on_spinel_message_cb) + : on_spinel_message_cb_(on_spinel_message_cb) {} + + ScopedAStatus onReceiveSpinelFrame(const std::vector& in_aFrame) { + on_spinel_message_cb_(in_aFrame); + return ScopedAStatus::ok(); + } + + private: + std::function&)> on_spinel_message_cb_; +}; + +class ThreadNetworkAidl : public testing::TestWithParam { + public: + virtual void SetUp() override { + std::string serviceName = GetParam(); + + ALOGI("serviceName: %s", serviceName.c_str()); + + thread_chip = IThreadChip::fromBinder( + SpAIBinder(AServiceManager_waitForService(serviceName.c_str()))); + ASSERT_NE(thread_chip, nullptr); + } + + virtual void TearDown() override { thread_chip->close(); } + + std::shared_ptr thread_chip; +}; + +TEST_P(ThreadNetworkAidl, Open) { + std::shared_ptr callback = + ndk::SharedRefBase::make([](auto /* data */) {}); + + EXPECT_TRUE(thread_chip->open(callback).isOk()); + EXPECT_EQ(thread_chip->open(callback).getServiceSpecificError(), IThreadChip::ERROR_BUSY); +} + +TEST_P(ThreadNetworkAidl, Close) { + std::shared_ptr callback = + ndk::SharedRefBase::make([](auto /* data */) {}); + + EXPECT_TRUE(thread_chip->open(callback).isOk()); + EXPECT_TRUE(thread_chip->close().isOk()); + EXPECT_EQ(thread_chip->close().getExceptionCode(), EX_ILLEGAL_STATE); +} + +TEST_P(ThreadNetworkAidl, Reset) { + std::shared_ptr callback = + ndk::SharedRefBase::make([](auto /* data */) {}); + + EXPECT_TRUE(thread_chip->open(callback).isOk()); + EXPECT_TRUE(thread_chip->reset().isOk()); +} + +TEST_P(ThreadNetworkAidl, SendSpinelFrame) { + const uint8_t kCmdOffset = 2; + const uint8_t kMajorVersionOffset = 3; + const uint8_t kMinorVersionOffset = 4; + const std::vector kGetSpinelProtocolVersion({0x81, 0x02, 0x01}); + const std::vector kGetSpinelProtocolVersionResponse({0x81, 0x06, 0x01, 0x04, 0x03}); + uint8_t min_major_version = kGetSpinelProtocolVersionResponse[kMajorVersionOffset]; + uint8_t min_minor_version = kGetSpinelProtocolVersionResponse[kMinorVersionOffset]; + uint8_t major_version; + uint8_t minor_version; + std::promise open_cb_promise; + std::future open_cb_future{open_cb_promise.get_future()}; + std::shared_ptr callback; + std::vector received_frame; + std::chrono::milliseconds timeout{kCallbackTimeoutMs}; + + callback = ndk::SharedRefBase::make( + [&](const std::vector& in_aFrame) { + if (in_aFrame.size() == kGetSpinelProtocolVersionResponse.size() && + in_aFrame[kCmdOffset] == kGetSpinelProtocolVersionResponse[kCmdOffset]) { + major_version = in_aFrame[kMajorVersionOffset]; + minor_version = in_aFrame[kMinorVersionOffset]; + open_cb_promise.set_value(); + } + }); + + ASSERT_NE(callback, nullptr); + + EXPECT_TRUE(thread_chip->open(callback).isOk()); + + EXPECT_TRUE(thread_chip->sendSpinelFrame(kGetSpinelProtocolVersion).isOk()); + EXPECT_EQ(open_cb_future.wait_for(timeout), std::future_status::ready); + + EXPECT_GE(major_version, min_major_version); + if (major_version == min_major_version) { + EXPECT_GE(minor_version, min_minor_version); + } +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ThreadNetworkAidl); +INSTANTIATE_TEST_SUITE_P( + Thread, ThreadNetworkAidl, + testing::ValuesIn(android::getAidlHalInstanceNames(IThreadChip::descriptor)), + android::PrintInstanceNameToString); + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + ProcessState::self()->setThreadPoolMaxThreadCount(1); + ProcessState::self()->startThreadPool(); + return RUN_ALL_TESTS(); +} From 0e9c80d9640a88d9473b7e1bedbf04b3b212ec1a Mon Sep 17 00:00:00 2001 From: Nathalie Le Clair Date: Fri, 10 Feb 2023 15:48:24 +0100 Subject: [PATCH 712/998] Update HAL interface Based on the Android Native API Council's review. Bug: 268601655 Test: make Change-Id: I84e828ed08d6ad5dd30dd33541b0c91324b5f8fb --- .../hardware/tv/hdmi/cec/CecDeviceType.aidl | 2 +- .../hardware/tv/hdmi/cec/CecMessageType.aidl | 148 +++++++++--------- .../hardware/tv/hdmi/cec/IHdmiCec.aidl | 2 +- .../hardware/tv/hdmi/cec/IHdmiCec.aidl | 4 +- .../tv/hdmi/connection/HdmiPortInfo.aidl | 5 +- .../hardware/tv/hdmi/earc/IEArcStatus.aidl | 8 +- .../android/hardware/tv/hdmi/earc/IEArc.aidl | 5 +- .../hardware/tv/hdmi/earc/IEArcCallback.aidl | 6 +- .../hardware/tv/hdmi/earc/IEArcStatus.aidl | 8 +- tv/hdmi/earc/aidl/default/EArcMock.cpp | 2 +- 10 files changed, 96 insertions(+), 94 deletions(-) diff --git a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecDeviceType.aidl b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecDeviceType.aidl index 08dc1ee2e5..4f7e247bf7 100644 --- a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecDeviceType.aidl +++ b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecDeviceType.aidl @@ -34,7 +34,7 @@ package android.hardware.tv.hdmi.cec; @Backing(type="byte") @VintfStability enum CecDeviceType { - INACTIVE = -1, + INACTIVE = (-1) /* -1 */, TV = 0, RECORDER = 1, TUNER = 3, diff --git a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecMessageType.aidl b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecMessageType.aidl index 31ca895fe8..20472f0192 100644 --- a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecMessageType.aidl +++ b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/CecMessageType.aidl @@ -34,78 +34,78 @@ package android.hardware.tv.hdmi.cec; @Backing(type="int") @VintfStability enum CecMessageType { - FEATURE_ABORT = 0, - IMAGE_VIEW_ON = 4, - TUNER_STEP_INCREMENT = 5, - TUNER_STEP_DECREMENT = 6, - TUNER_DEVICE_STATUS = 7, - GIVE_TUNER_DEVICE_STATUS = 8, - RECORD_ON = 9, - RECORD_STATUS = 10, - RECORD_OFF = 11, - TEXT_VIEW_ON = 13, - RECORD_TV_SCREEN = 15, - GIVE_DECK_STATUS = 26, - DECK_STATUS = 27, - SET_MENU_LANGUAGE = 50, - CLEAR_ANALOG_TIMER = 51, - SET_ANALOG_TIMER = 52, - TIMER_STATUS = 53, - STANDBY = 54, - PLAY = 65, - DECK_CONTROL = 66, - TIMER_CLEARED_STATUS = 67, - USER_CONTROL_PRESSED = 68, - USER_CONTROL_RELEASED = 69, - GIVE_OSD_NAME = 70, - SET_OSD_NAME = 71, - SET_OSD_STRING = 100, - SET_TIMER_PROGRAM_TITLE = 103, - SYSTEM_AUDIO_MODE_REQUEST = 112, - GIVE_AUDIO_STATUS = 113, - SET_SYSTEM_AUDIO_MODE = 114, - REPORT_AUDIO_STATUS = 122, - GIVE_SYSTEM_AUDIO_MODE_STATUS = 125, - SYSTEM_AUDIO_MODE_STATUS = 126, - ROUTING_CHANGE = 128, - ROUTING_INFORMATION = 129, - ACTIVE_SOURCE = 130, - GIVE_PHYSICAL_ADDRESS = 131, - REPORT_PHYSICAL_ADDRESS = 132, - REQUEST_ACTIVE_SOURCE = 133, - SET_STREAM_PATH = 134, - DEVICE_VENDOR_ID = 135, - VENDOR_COMMAND = 137, - VENDOR_REMOTE_BUTTON_DOWN = 138, - VENDOR_REMOTE_BUTTON_UP = 139, - GIVE_DEVICE_VENDOR_ID = 140, - MENU_REQUEST = 141, - MENU_STATUS = 142, - GIVE_DEVICE_POWER_STATUS = 143, - REPORT_POWER_STATUS = 144, - GET_MENU_LANGUAGE = 145, - SELECT_ANALOG_SERVICE = 146, - SELECT_DIGITAL_SERVICE = 147, - SET_DIGITAL_TIMER = 151, - CLEAR_DIGITAL_TIMER = 153, - SET_AUDIO_RATE = 154, - INACTIVE_SOURCE = 157, - CEC_VERSION = 158, - GET_CEC_VERSION = 159, - VENDOR_COMMAND_WITH_ID = 160, - CLEAR_EXTERNAL_TIMER = 161, - SET_EXTERNAL_TIMER = 162, - REPORT_SHORT_AUDIO_DESCRIPTOR = 163, - REQUEST_SHORT_AUDIO_DESCRIPTOR = 164, - INITIATE_ARC = 192, - REPORT_ARC_INITIATED = 193, - REPORT_ARC_TERMINATED = 194, - REQUEST_ARC_INITIATION = 195, - REQUEST_ARC_TERMINATION = 196, - TERMINATE_ARC = 197, - ABORT = 255, - GIVE_FEATURES = 165, - REPORT_FEATURES = 166, - REQUEST_CURRENT_LATENCY = 167, - REPORT_CURRENT_LATENCY = 168, + FEATURE_ABORT = 0x00, + IMAGE_VIEW_ON = 0x04, + TUNER_STEP_INCREMENT = 0x05, + TUNER_STEP_DECREMENT = 0x06, + TUNER_DEVICE_STATUS = 0x07, + GIVE_TUNER_DEVICE_STATUS = 0x08, + RECORD_ON = 0x09, + RECORD_STATUS = 0x0A, + RECORD_OFF = 0x0B, + TEXT_VIEW_ON = 0x0D, + RECORD_TV_SCREEN = 0x0F, + GIVE_DECK_STATUS = 0x1A, + DECK_STATUS = 0x1B, + SET_MENU_LANGUAGE = 0x32, + CLEAR_ANALOG_TIMER = 0x33, + SET_ANALOG_TIMER = 0x34, + TIMER_STATUS = 0x35, + STANDBY = 0x36, + PLAY = 0x41, + DECK_CONTROL = 0x42, + TIMER_CLEARED_STATUS = 0x43, + USER_CONTROL_PRESSED = 0x44, + USER_CONTROL_RELEASED = 0x45, + GIVE_OSD_NAME = 0x46, + SET_OSD_NAME = 0x47, + SET_OSD_STRING = 0x64, + SET_TIMER_PROGRAM_TITLE = 0x67, + SYSTEM_AUDIO_MODE_REQUEST = 0x70, + GIVE_AUDIO_STATUS = 0x71, + SET_SYSTEM_AUDIO_MODE = 0x72, + REPORT_AUDIO_STATUS = 0x7A, + GIVE_SYSTEM_AUDIO_MODE_STATUS = 0x7D, + SYSTEM_AUDIO_MODE_STATUS = 0x7E, + ROUTING_CHANGE = 0x80, + ROUTING_INFORMATION = 0x81, + ACTIVE_SOURCE = 0x82, + GIVE_PHYSICAL_ADDRESS = 0x83, + REPORT_PHYSICAL_ADDRESS = 0x84, + REQUEST_ACTIVE_SOURCE = 0x85, + SET_STREAM_PATH = 0x86, + DEVICE_VENDOR_ID = 0x87, + VENDOR_COMMAND = 0x89, + VENDOR_REMOTE_BUTTON_DOWN = 0x8A, + VENDOR_REMOTE_BUTTON_UP = 0x8B, + GIVE_DEVICE_VENDOR_ID = 0x8C, + MENU_REQUEST = 0x8D, + MENU_STATUS = 0x8E, + GIVE_DEVICE_POWER_STATUS = 0x8F, + REPORT_POWER_STATUS = 0x90, + GET_MENU_LANGUAGE = 0x91, + SELECT_ANALOG_SERVICE = 0x92, + SELECT_DIGITAL_SERVICE = 0x93, + SET_DIGITAL_TIMER = 0x97, + CLEAR_DIGITAL_TIMER = 0x99, + SET_AUDIO_RATE = 0x9A, + INACTIVE_SOURCE = 0x9D, + CEC_VERSION = 0x9E, + GET_CEC_VERSION = 0x9F, + VENDOR_COMMAND_WITH_ID = 0xA0, + CLEAR_EXTERNAL_TIMER = 0xA1, + SET_EXTERNAL_TIMER = 0xA2, + REPORT_SHORT_AUDIO_DESCRIPTOR = 0xA3, + REQUEST_SHORT_AUDIO_DESCRIPTOR = 0xA4, + INITIATE_ARC = 0xC0, + REPORT_ARC_INITIATED = 0xC1, + REPORT_ARC_TERMINATED = 0xC2, + REQUEST_ARC_INITIATION = 0xC3, + REQUEST_ARC_TERMINATION = 0xC4, + TERMINATE_ARC = 0xC5, + ABORT = 0xFF, + GIVE_FEATURES = 0xA5, + REPORT_FEATURES = 0xA6, + REQUEST_CURRENT_LATENCY = 0xA7, + REPORT_CURRENT_LATENCY = 0xA8, } diff --git a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/IHdmiCec.aidl b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/IHdmiCec.aidl index 0881489e91..c6060d1f47 100644 --- a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/IHdmiCec.aidl +++ b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/current/android/hardware/tv/hdmi/cec/IHdmiCec.aidl @@ -41,7 +41,7 @@ interface IHdmiCec { int getPhysicalAddress(); int getVendorId(); android.hardware.tv.hdmi.cec.SendMessageResult sendMessage(in android.hardware.tv.hdmi.cec.CecMessage message); - void setCallback(in android.hardware.tv.hdmi.cec.IHdmiCecCallback callback); + void setCallback(in @nullable android.hardware.tv.hdmi.cec.IHdmiCecCallback callback); void setLanguage(in String language); void enableWakeupByOtp(in boolean value); void enableCec(in boolean value); diff --git a/tv/hdmi/cec/aidl/android/hardware/tv/hdmi/cec/IHdmiCec.aidl b/tv/hdmi/cec/aidl/android/hardware/tv/hdmi/cec/IHdmiCec.aidl index 577c37707d..578d9240ae 100644 --- a/tv/hdmi/cec/aidl/android/hardware/tv/hdmi/cec/IHdmiCec.aidl +++ b/tv/hdmi/cec/aidl/android/hardware/tv/hdmi/cec/IHdmiCec.aidl @@ -77,7 +77,7 @@ interface IHdmiCec { * plugged off and on again. It is advised to call getPhysicalAddress to get * the updated address when hot plug event takes place. * - * @param out addr Physical address of this device. + * @return Physical address of this device. */ int getPhysicalAddress(); @@ -116,7 +116,7 @@ interface IHdmiCec { * previously registered callback must be replaced with this one. * setCallback(null) should deregister the callback. */ - void setCallback(in IHdmiCecCallback callback); + void setCallback(in @nullable IHdmiCecCallback callback); /** * Passes the updated language information of Android system. Contains diff --git a/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl b/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl index 1d2ef4ae60..875c9da10d 100644 --- a/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl +++ b/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl @@ -24,9 +24,10 @@ import android.hardware.tv.hdmi.connection.HdmiPortType; @VintfStability parcelable HdmiPortInfo { HdmiPortType type; - int portId; // Output ports should start from 1 which corresponds to HDMI "port 1". + int portId; // Input ports should start from 1 which corresponds to HDMI "port 1". boolean cecSupported; - boolean arcSupported; + boolean arcSupported; // If true, cecSupported has to be true as well. ARC cannot be supported + // without CEC support. boolean eArcSupported; // The physical address of the device connected to this port, valid range is 0x0000 to 0xFFFF // (ref Sec 8.7.2 of HDMI 1.4b). diff --git a/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/current/android/hardware/tv/hdmi/earc/IEArcStatus.aidl b/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/current/android/hardware/tv/hdmi/earc/IEArcStatus.aidl index 29d4ea951f..6dcbd8d49e 100644 --- a/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/current/android/hardware/tv/hdmi/earc/IEArcStatus.aidl +++ b/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/current/android/hardware/tv/hdmi/earc/IEArcStatus.aidl @@ -34,8 +34,8 @@ package android.hardware.tv.hdmi.earc; @Backing(type="byte") @VintfStability enum IEArcStatus { - STATUS_IDLE = 0, - STATUS_EARC_PENDING = 1, - STATUS_ARC_PENDING = 2, - STATUS_EARC_CONNECTED = 3, + IDLE = 0, + EARC_PENDING = 1, + ARC_PENDING = 2, + EARC_CONNECTED = 3, } diff --git a/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArc.aidl b/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArc.aidl index a2dde6a7f4..e5a645873d 100644 --- a/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArc.aidl +++ b/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArc.aidl @@ -64,10 +64,11 @@ interface IEArc { IEArcStatus getState(in int portId); /** - * Getter for the most recent capabilities reported by the device connected to port. + * Getter for the most recent audio capabilities reported by the device connected to port. * * @param portId The port ID on which the device is connected. - * @return The raw, unparsed audio capabilities + * @return a byte array containing the raw, unparsed audio capabilities (Ref "Section 9.5.3.6 - + * eARC RX Capabilities Data Structure" in HDMI 2.1 specification). */ byte[] getLastReportedAudioCapabilities(in int portId); } diff --git a/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcCallback.aidl b/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcCallback.aidl index a11924b294..ea77c54936 100644 --- a/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcCallback.aidl +++ b/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcCallback.aidl @@ -34,9 +34,9 @@ oneway interface IEArcCallback { /** * The callback function that must be called by the eARC driver and HAL implementation to * notify the Android framework of the audio capabilities reported by the connected device. On - * every state change to {@code STATUS_EARC_CONNECTED}, the driver shall read the capabilities - * reported by the eARC RX. The onStateChange callback shall always be invoked first and the - * onCapabilitiesReported callback shall be invoked second. + * every state change to {@code IEArcStatus::EARC_CONNECTED}, the driver shall read the + * capabilities reported by the eARC RX. The onStateChange callback shall always be invoked + * first and the onCapabilitiesReported callback shall be invoked second. * @param rawCapabilities The raw unparsed audio capabilities (Ref "Section 9.5.3.6 - eARC RX * Capabilities Data Structure" in HDMI 2.1 specification). * @param portId The port ID for which the audio capabilities are being reported diff --git a/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcStatus.aidl b/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcStatus.aidl index de1aaf1bc3..5407434239 100644 --- a/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcStatus.aidl +++ b/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArcStatus.aidl @@ -22,8 +22,8 @@ package android.hardware.tv.hdmi.earc; @VintfStability @Backing(type="byte") enum IEArcStatus { - STATUS_IDLE = 0, - STATUS_EARC_PENDING = 1, - STATUS_ARC_PENDING = 2, - STATUS_EARC_CONNECTED = 3, + IDLE = 0, + EARC_PENDING = 1, + ARC_PENDING = 2, + EARC_CONNECTED = 3, } diff --git a/tv/hdmi/earc/aidl/default/EArcMock.cpp b/tv/hdmi/earc/aidl/default/EArcMock.cpp index a3ccabfc56..0e92fbd1a0 100644 --- a/tv/hdmi/earc/aidl/default/EArcMock.cpp +++ b/tv/hdmi/earc/aidl/default/EArcMock.cpp @@ -109,7 +109,7 @@ EArcMock::EArcMock() { mCallback = nullptr; mCapabilities.resize(mTotalPorts); mPortStatus.resize(mTotalPorts); - mPortStatus[0] = IEArcStatus::STATUS_IDLE; + mPortStatus[0] = IEArcStatus::IDLE; mDeathRecipient = ndk::ScopedAIBinder_DeathRecipient(AIBinder_DeathRecipient_new(serviceDied)); } From d8229a8e64e3b11bd1336fd6b36b3c67448ca5cc Mon Sep 17 00:00:00 2001 From: Nathalie Le Clair Date: Tue, 14 Feb 2023 10:45:22 +0100 Subject: [PATCH 713/998] Clarify which HAL (methods) apply to which devices Bug: 265906860 Test: make Change-Id: Icc8df58d4a806d71fc2c073a67bedfd9dd9d3f60 --- tv/README.md | 8 ++++++++ tv/hdmi/README.md | 11 +++++++++++ .../hardware/tv/hdmi/connection/HdmiPortInfo.aidl | 7 ++++++- .../hardware/tv/hdmi/connection/IHdmiConnection.aidl | 11 +++++++++++ .../aidl/android/hardware/tv/hdmi/earc/IEArc.aidl | 2 +- 5 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 tv/README.md create mode 100644 tv/hdmi/README.md diff --git a/tv/README.md b/tv/README.md new file mode 100644 index 0000000000..9a1c381214 --- /dev/null +++ b/tv/README.md @@ -0,0 +1,8 @@ +# TV-related HIDL and AIDL HALs + +This directory bundles TV-related HALs in HIDL (legacy) and AIDL. + +- The 'tuner' directory contains the Tuner HIDL and AIDL HALs. +- The 'input' directory contains the TV Input HIDL and AIDL HALs. +- The 'cec' directory contains the CEC HIDL HAL. +- The 'hdmi' directory contains the HDMI-related AIDL HALs, which includes the CEC AIDL HAL. diff --git a/tv/hdmi/README.md b/tv/hdmi/README.md new file mode 100644 index 0000000000..183a3d0d60 --- /dev/null +++ b/tv/hdmi/README.md @@ -0,0 +1,11 @@ +# HDMI-related AIDL HALs for Android devices + +This directory bundles 3 HDMI-related AIDL HALs: HDMI Connection HAL, CEC HAL and eARC HAL. + +The HDMI Connection HAL contains general APIs for the HDMI Connection. These methods are required by +the CEC and the eARC implementation. Therefore, devices that implement CEC need to support the HDMI +Connection HAL and the CEC HAL. Devices that implement eARC need to support the HDMI Connection HAL +and the eARC HAL. + +Other Android HALs are related to HDMI as well, but not included in this directory for historical +reasons, e.g. Display HAL and TV Input HAL. diff --git a/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl b/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl index 875c9da10d..6bec7e5665 100644 --- a/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl +++ b/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl @@ -24,11 +24,16 @@ import android.hardware.tv.hdmi.connection.HdmiPortType; @VintfStability parcelable HdmiPortInfo { HdmiPortType type; - int portId; // Input ports should start from 1 which corresponds to HDMI "port 1". + int portId; // For devices with input ports (e.g. TV Panels), input ports should start from 1 + // which corresponds to HDMI "port 1". + + // In the following, 'supported' refers to having the necessary hardware and firmware on the + // device to support CEC/ARC/eARC on this port. boolean cecSupported; boolean arcSupported; // If true, cecSupported has to be true as well. ARC cannot be supported // without CEC support. boolean eArcSupported; + // The physical address of the device connected to this port, valid range is 0x0000 to 0xFFFF // (ref Sec 8.7.2 of HDMI 1.4b). int physicalAddress; diff --git a/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/IHdmiConnection.aidl b/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/IHdmiConnection.aidl index 6c7a4381bf..ee6cc89d12 100644 --- a/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/IHdmiConnection.aidl +++ b/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/IHdmiConnection.aidl @@ -56,6 +56,11 @@ interface IHdmiConnection { * hotplug signal). When set to {@code HDMI_HPD_STATUS_BIT} the HAL should use the HDP status * bit. * + * This is only relevant to TV Panel devices that support eARC TX. While eARC TX is connected, + * the framework calls this method to set the HPD signal to {@code HDMI_HPD_STATUS_BIT}. + * + * For all other device types, this method can be stubbed. + * * @param signal The HPD signal type to use. * @param portId id of the port on which the HPD signal should be set. * @@ -70,6 +75,12 @@ interface IHdmiConnection { /** * Get the current signal the HAL is using for HPD * + * This is only relevant to TV Panel devices that support eARC TX. While eARC TX is connected, + * this method returns {@code HDMI_HPD_STATUS_BIT}. + * + * For all other device types, this method can be stubbed by always returning + * {@code HDMI_HPD_PHYSICAL}. + * * @param portId id of the port of which the current HPD signal is queried. */ HpdSignal getHpdSignal(in int portId); diff --git a/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArc.aidl b/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArc.aidl index e5a645873d..d9fb29c760 100644 --- a/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArc.aidl +++ b/tv/hdmi/earc/aidl/android/hardware/tv/hdmi/earc/IEArc.aidl @@ -20,7 +20,7 @@ import android.hardware.tv.hdmi.earc.IEArcCallback; import android.hardware.tv.hdmi.earc.IEArcStatus; /** - * eARC HAL interface definition + * eARC HAL interface definition. This is only relevant to TV Panels that implement eARC TX. */ @VintfStability interface IEArc { From 5d1b816b8d990c4dd206de0dbcae74ad3b082395 Mon Sep 17 00:00:00 2001 From: shrikar Date: Wed, 25 Jan 2023 19:31:23 +0000 Subject: [PATCH 714/998] Renamed ADAPTIVE_CRUISE_CONTROL_ENABLED to CRUISE_CONTROL_ENABLED in HAL Bug: 261737998 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I34ad0ba32a5f2ad2037fbe65c011c63d400a12e4 --- .../generated_lib/cpp/AccessForVehicleProperty.h | 2 +- .../cpp/ChangeModeForVehicleProperty.h | 2 +- .../java/AccessForVehicleProperty.java | 2 +- .../java/ChangeModeForVehicleProperty.java | 2 +- .../default_config/config/DefaultProperties.json | 2 +- .../automotive/vehicle/VehicleProperty.aidl | 2 +- .../automotive/vehicle/VehicleProperty.aidl | 14 +++++++------- .../vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp | 8 ++++---- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 1b61fb36a0..bbe1fcac6f 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -258,7 +258,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyAccess::WRITE}, {VehicleProperty::LANE_CENTERING_ASSIST_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, - {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess::READ_WRITE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index f073a6ffaa..2a005a856d 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -258,7 +258,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_CENTERING_ASSIST_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, - {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index b0970a925f..466ca5daa8 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -250,7 +250,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyAccess.WRITE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), - Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.CRUISE_CONTROL_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess.READ_WRITE) ); diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 20322a6e57..c7b5e26245 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -250,7 +250,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), - Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) ); diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 43296250a5..810f48b469 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3113,7 +3113,7 @@ } }, { - "property": "VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED", + "property": "VehicleProperty::CRUISE_CONTROL_ENABLED", "defaultValue": { "int32Values": [ 1 diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 509b53be11..e89197be3a 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -256,7 +256,7 @@ enum VehicleProperty { LANE_CENTERING_ASSIST_COMMAND = (((0x100B + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411083 */, LANE_CENTERING_ASSIST_STATE = (((0x100C + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411084 */, EMERGENCY_LANE_KEEP_ASSIST_ENABLED = (((0x100D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313933 */, - ADAPTIVE_CRUISE_CONTROL_ENABLED = (((0x100F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313935 */, + CRUISE_CONTROL_ENABLED = (((0x100F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313935 */, HANDS_ON_DETECTION_ENABLED = (((0x1016 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313942 */, DRIVER_ATTENTION_MONITORING_ENABLED = (((0x1019 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313945 */, } diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 349e8bdc1b..d8d5959360 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3833,13 +3833,13 @@ enum VehicleProperty { 0x100D + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, /** - * Enable or disable adaptive cruise control (ACC). + * Enable or disable cruise control (CC). * - * Set true to enable ACC and false to disable ACC. When ACC is enabled, the ADAS system in the - * vehicle should be turned on and waiting for an activation signal from the driver. Once the - * feature is activated, the ADAS system in the car should be accelerating and braking in a way - * that allows the vehicle to maintain a set speed and to maintain a set distance gap from a - * leading vehicle. + * Set true to enable CC and false to disable CC. This property is shared by all forms of + * CruiseControlType(s). + * + * When CC is enabled, the ADAS system in the vehicle should be turned on and responding to + * commands. * * This property is defined as read_write, but OEMs have the option to implement it as read * only. @@ -3847,7 +3847,7 @@ enum VehicleProperty { * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ - ADAPTIVE_CRUISE_CONTROL_ENABLED = + CRUISE_CONTROL_ENABLED = 0x100F + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, /** diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index b2567e97c4..e3f5dcadf7 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -504,10 +504,10 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEmergencyLaneKeepAssistEnabledCo VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } -TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAdaptiveCruiseControlEnabledConfig) { - verifyProperty(VehicleProperty::ADAPTIVE_CRUISE_CONTROL_ENABLED, - VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, - VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlEnabledConfig) { + verifyProperty(VehicleProperty::CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionEnabledConfig) { From 376227694f894442da93e0648e94ebc17c54f24d Mon Sep 17 00:00:00 2001 From: Kriti Dang Date: Thu, 9 Feb 2023 18:15:37 +0100 Subject: [PATCH 715/998] Update setHdrConversionStrategy to return the preferredHdrOutput type Bug: 268336382 Test: atest VtsHalGraphicsComposer3_TargetTest Change-Id: I6ac912ac8a0329f4ea32acad657e44b473660c42 --- .../android/hardware/graphics/common/Hdr.aidl | 1 + .../android/hardware/graphics/common/Hdr.aidl | 4 ++++ .../graphics/composer3/IComposerClient.aidl | 2 +- .../graphics/composer3/IComposerClient.aidl | 6 ++++-- graphics/composer/aidl/vts/VtsComposerClient.cpp | 6 ++++-- graphics/composer/aidl/vts/VtsComposerClient.h | 3 ++- .../vts/VtsHalGraphicsComposer3_TargetTest.cpp | 15 ++++++++++----- 7 files changed, 26 insertions(+), 11 deletions(-) diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Hdr.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Hdr.aidl index 128ef4917f..71927b6fbf 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Hdr.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/Hdr.aidl @@ -35,6 +35,7 @@ package android.hardware.graphics.common; /* @hide */ @Backing(type="int") @VintfStability enum Hdr { + INVALID = 0, DOLBY_VISION = 1, HDR10 = 2, HLG = 3, diff --git a/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl b/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl index 407b54f524..6107c4cfcf 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl @@ -23,6 +23,10 @@ package android.hardware.graphics.common; @VintfStability @Backing(type="int") enum Hdr { + /** + * Invalid HDR type + */ + INVALID = 0, /** * Device supports Dolby Vision HDR */ diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl index af82b83b76..cb85a88995 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerClient.aidl @@ -77,7 +77,7 @@ interface IComposerClient { void setIdleTimerEnabled(long display, int timeoutMs); android.hardware.graphics.composer3.OverlayProperties getOverlaySupport(); android.hardware.graphics.common.HdrConversionCapability[] getHdrConversionCapabilities(); - void setHdrConversionStrategy(in android.hardware.graphics.common.HdrConversionStrategy conversionStrategy); + android.hardware.graphics.common.Hdr setHdrConversionStrategy(in android.hardware.graphics.common.HdrConversionStrategy conversionStrategy); void setRefreshRateChangedCallbackDebugEnabled(long display, boolean enabled); const int EX_BAD_CONFIG = 1; const int EX_BAD_DISPLAY = 2; diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl index fe6483e006..4e77f86cf4 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerClient.aidl @@ -17,6 +17,7 @@ package android.hardware.graphics.composer3; import android.hardware.graphics.common.DisplayDecorationSupport; +import android.hardware.graphics.common.Hdr; import android.hardware.graphics.common.HdrConversionCapability; import android.hardware.graphics.common.HdrConversionStrategy; import android.hardware.graphics.common.Transform; @@ -844,12 +845,13 @@ interface IComposerClient { /** * Sets the of HDR conversion strategy. * - * + * @return the chosen HDR type in case HdrConversionStrategy has autoAllowedHdrTypes set. In + * other cases, return HDR type INVALID. * @exception EX_UNSUPPORTED when not supported by the underlying HAL * * @see getHdrConversionCapabilities */ - void setHdrConversionStrategy(in HdrConversionStrategy conversionStrategy); + Hdr setHdrConversionStrategy(in HdrConversionStrategy conversionStrategy); /* * Sets either the callback for the refresh rate change is enabled or disabled diff --git a/graphics/composer/aidl/vts/VtsComposerClient.cpp b/graphics/composer/aidl/vts/VtsComposerClient.cpp index 2e2b193722..e03ef254c8 100644 --- a/graphics/composer/aidl/vts/VtsComposerClient.cpp +++ b/graphics/composer/aidl/vts/VtsComposerClient.cpp @@ -344,9 +344,11 @@ VtsComposerClient::getHdrConversionCapabilities() { hdrConversionCapability}; } -ScopedAStatus VtsComposerClient::setHdrConversionStrategy( +std::pair VtsComposerClient::setHdrConversionStrategy( const common::HdrConversionStrategy& conversionStrategy) { - return mComposerClient->setHdrConversionStrategy(conversionStrategy); + common::Hdr preferredHdrOutputType; + return {mComposerClient->setHdrConversionStrategy(conversionStrategy, &preferredHdrOutputType), + preferredHdrOutputType}; } std::pair VtsComposerClient::getDisplayPhysicalOrientation( diff --git a/graphics/composer/aidl/vts/VtsComposerClient.h b/graphics/composer/aidl/vts/VtsComposerClient.h index aee46d2a16..81a62b372e 100644 --- a/graphics/composer/aidl/vts/VtsComposerClient.h +++ b/graphics/composer/aidl/vts/VtsComposerClient.h @@ -166,7 +166,8 @@ class VtsComposerClient { std::pair> getHdrConversionCapabilities(); - ScopedAStatus setHdrConversionStrategy(const common::HdrConversionStrategy& conversionStrategy); + std::pair setHdrConversionStrategy( + const common::HdrConversionStrategy& conversionStrategy); std::pair getDisplayPhysicalOrientation(int64_t display); diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 55e0a13c0c..70c4e4cf39 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -637,8 +637,10 @@ TEST_P(GraphicsComposerAidlTest, SetHdrConversionStrategy_Passthrough) { } common::HdrConversionStrategy hdrConversionStrategy; hdrConversionStrategy.set(true); - const auto& status = mComposerClient->setHdrConversionStrategy(hdrConversionStrategy); + const auto& [status, preferredHdrOutputType] = + mComposerClient->setHdrConversionStrategy(hdrConversionStrategy); EXPECT_TRUE(status.isOk()); + EXPECT_EQ(common::Hdr::INVALID, preferredHdrOutputType); } TEST_P(GraphicsComposerAidlTest, SetHdrConversionStrategy_Force) { @@ -652,9 +654,10 @@ TEST_P(GraphicsComposerAidlTest, SetHdrConversionStrategy_Force) { common::HdrConversionStrategy hdrConversionStrategy; hdrConversionStrategy.set( conversionCapability.outputType->hdr); - const auto& statusSet = + const auto& [statusSet, preferredHdrOutputType] = mComposerClient->setHdrConversionStrategy(hdrConversionStrategy); - EXPECT_TRUE(status.isOk()); + EXPECT_TRUE(statusSet.isOk()); + EXPECT_EQ(common::Hdr::INVALID, preferredHdrOutputType); } } } @@ -674,8 +677,10 @@ TEST_P(GraphicsComposerAidlTest, SetHdrConversionStrategy_Auto) { common::HdrConversionStrategy hdrConversionStrategy; hdrConversionStrategy.set( autoHdrTypes); - const auto& statusSet = mComposerClient->setHdrConversionStrategy(hdrConversionStrategy); - EXPECT_TRUE(status.isOk()); + const auto& [statusSet, preferredHdrOutputType] = + mComposerClient->setHdrConversionStrategy(hdrConversionStrategy); + EXPECT_TRUE(statusSet.isOk()); + EXPECT_NE(common::Hdr::INVALID, preferredHdrOutputType); } TEST_P(GraphicsComposerAidlTest, SetAutoLowLatencyMode_BadDisplay) { From 773ab6e9e03309608a4a58cce10b9b86993b1272 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Sat, 11 Feb 2023 23:35:01 +0000 Subject: [PATCH 716/998] Add listAliases method to the INonStandardCertCallback interface. Bug: 205764502 Test: m Change-Id: I2d5b6dd99dc8c56d94b04ec8efb2de8c81186b46 --- .../wifi/supplicant/INonStandardCertCallback.aidl | 1 + .../wifi/supplicant/INonStandardCertCallback.aidl | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl index 28c1028be7..bcf0ea8cb6 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl @@ -35,4 +35,5 @@ package android.hardware.wifi.supplicant; @VintfStability interface INonStandardCertCallback { byte[] getBlob(in String alias); + String[] listAliases(in String prefix); } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl index 32595850d9..2f9e528c3a 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl @@ -34,4 +34,13 @@ interface INonStandardCertCallback { * |SupplicantStatusCode.FAILURE_UNKNOWN| */ byte[] getBlob(in String alias); + + /** + * List the aliases currently stored in the database. + * + * @param prefix Prefix to filter the aliases by. + * @return List of alias strings in the certificate store. + The resulting strings will each exclude the prefix. + */ + String[] listAliases(in String prefix); } From a891e00adb0b564b446bbb92c6106e52451d3633 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Tue, 17 Jan 2023 15:12:52 -0800 Subject: [PATCH 717/998] Define ivnandroiddevice HAL. Define in-vehicle network android device HAL. This HAL is used for providing run-time information about other connected Android devices in the same vehicle for multi-soc use cases. Test: m android.hardware.automotive.ivn-update-api Bug: 258494092 Change-Id: I0b16e17b04e3470ad8f05d36daac3052f004a53f --- automotive/ivn_android_device/aidl/Android.bp | 44 ++++++++++ .../automotive/ivn/ConnectProtocol.aidl | 38 +++++++++ .../hardware/automotive/ivn/EndpointInfo.aidl | 41 ++++++++++ .../automotive/ivn/HardwareIdentifiers.aidl | 43 ++++++++++ .../automotive/ivn/IIvnAndroidDevice.aidl | 43 ++++++++++ .../hardware/automotive/ivn/OccupantType.aidl | 40 +++++++++ .../automotive/ivn/OccupantZoneInfo.aidl | 40 +++++++++ .../automotive/ivn/ConnectProtocol.aidl | 26 ++++++ .../hardware/automotive/ivn/EndpointInfo.aidl | 50 ++++++++++++ .../automotive/ivn/HardwareIdentifiers.aidl | 65 +++++++++++++++ .../automotive/ivn/IIvnAndroidDevice.aidl | 81 +++++++++++++++++++ .../hardware/automotive/ivn/OccupantType.aidl | 39 +++++++++ .../automotive/ivn/OccupantZoneInfo.aidl | 50 ++++++++++++ .../compatibility_matrix.8.xml | 9 ++- 14 files changed, 608 insertions(+), 1 deletion(-) create mode 100644 automotive/ivn_android_device/aidl/Android.bp create mode 100644 automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/ConnectProtocol.aidl create mode 100644 automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/EndpointInfo.aidl create mode 100644 automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/HardwareIdentifiers.aidl create mode 100644 automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/IIvnAndroidDevice.aidl create mode 100644 automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/OccupantType.aidl create mode 100644 automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/OccupantZoneInfo.aidl create mode 100644 automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/ConnectProtocol.aidl create mode 100644 automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/EndpointInfo.aidl create mode 100644 automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/HardwareIdentifiers.aidl create mode 100644 automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/IIvnAndroidDevice.aidl create mode 100644 automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/OccupantType.aidl create mode 100644 automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/OccupantZoneInfo.aidl diff --git a/automotive/ivn_android_device/aidl/Android.bp b/automotive/ivn_android_device/aidl/Android.bp new file mode 100644 index 0000000000..95a0c73a9e --- /dev/null +++ b/automotive/ivn_android_device/aidl/Android.bp @@ -0,0 +1,44 @@ +// 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 { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +aidl_interface { + name: "android.hardware.automotive.ivn", + vendor_available: true, + srcs: [ + "android/hardware/automotive/ivn/*.aidl", + ], + frozen: false, + stability: "vintf", + backend: { + cpp: { + enabled: false, + }, + java: { + sdk_version: "module_current", + apex_available: [ + "//apex_available:platform", + "com.android.car.framework", + ], + }, + }, +} diff --git a/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/ConnectProtocol.aidl b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/ConnectProtocol.aidl new file mode 100644 index 0000000000..80d7a2a2af --- /dev/null +++ b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/ConnectProtocol.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.hardware.automotive.ivn; +@Backing(type="int") @VintfStability +enum ConnectProtocol { + TCP_IP = 0, +} diff --git a/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/EndpointInfo.aidl b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/EndpointInfo.aidl new file mode 100644 index 0000000000..5693520eb5 --- /dev/null +++ b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/EndpointInfo.aidl @@ -0,0 +1,41 @@ +/* + * 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 -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.hardware.automotive.ivn; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable EndpointInfo { + android.hardware.automotive.ivn.ConnectProtocol connectProtocol; + String ipAddress; + int portNumber; + android.hardware.automotive.ivn.HardwareIdentifiers hardwareId; +} diff --git a/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/HardwareIdentifiers.aidl b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/HardwareIdentifiers.aidl new file mode 100644 index 0000000000..1a8b21de7f --- /dev/null +++ b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/HardwareIdentifiers.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.hardware.automotive.ivn; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable HardwareIdentifiers { + @nullable String brandName; + @nullable String deviceName; + @nullable String productName; + @nullable String manufacturerName; + @nullable String modelName; + @nullable String serialNumber; +} diff --git a/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/IIvnAndroidDevice.aidl b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/IIvnAndroidDevice.aidl new file mode 100644 index 0000000000..a04d829583 --- /dev/null +++ b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/IIvnAndroidDevice.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.hardware.automotive.ivn; +@VintfStability +interface IIvnAndroidDevice { + int getMyDeviceId(); + int[] getOtherDeviceIds(); + int getDeviceIdForOccupantZone(int zoneId); + android.hardware.automotive.ivn.OccupantZoneInfo[] getOccupantZonesForDevice(int androidDeviceId); + android.hardware.automotive.ivn.EndpointInfo getMyEndpointInfo(); + android.hardware.automotive.ivn.EndpointInfo getEndpointInfoForDevice(int androidDeviceId); +} diff --git a/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/OccupantType.aidl b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/OccupantType.aidl new file mode 100644 index 0000000000..6dd0c07d16 --- /dev/null +++ b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/OccupantType.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.automotive.ivn; +@Backing(type="int") @VintfStability +enum OccupantType { + DRIVER = 1, + FRONT_PASSENGER = 2, + REAR_PASSENGER = 3, +} diff --git a/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/OccupantZoneInfo.aidl b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/OccupantZoneInfo.aidl new file mode 100644 index 0000000000..41108e9c78 --- /dev/null +++ b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/current/android/hardware/automotive/ivn/OccupantZoneInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.automotive.ivn; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable OccupantZoneInfo { + int zoneId; + android.hardware.automotive.ivn.OccupantType occupantType; + int seat; +} diff --git a/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/ConnectProtocol.aidl b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/ConnectProtocol.aidl new file mode 100644 index 0000000000..9f621b3e6f --- /dev/null +++ b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/ConnectProtocol.aidl @@ -0,0 +1,26 @@ +/* + * 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.hardware.automotive.ivn; + +/** + * Connect protocol for In-vehicle network Android device. + */ +@VintfStability +@Backing(type="int") +enum ConnectProtocol { + TCP_IP = 0, +} diff --git a/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/EndpointInfo.aidl b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/EndpointInfo.aidl new file mode 100644 index 0000000000..32f697160d --- /dev/null +++ b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/EndpointInfo.aidl @@ -0,0 +1,50 @@ +/* + * 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.hardware.automotive.ivn; + +import android.hardware.automotive.ivn.ConnectProtocol; +import android.hardware.automotive.ivn.HardwareIdentifiers; + +/** + * Network endpoint information for an Android instance running on a difference device. + * + * The device is in the same vehicle as this device. + */ +@JavaDerive(equals=true, toString=true) +@VintfStability +parcelable EndpointInfo { + /** + * The connection protocol. Only supports TCP/IP for now. + */ + ConnectProtocol connectProtocol; + /** + * The IP address. + */ + String ipAddress; + /** + * The port number exposed for connecting. + */ + int portNumber; + /** + * Hardware identifiers. + * + * The hardware identifiers for the endpoint as defined in [Attestation Hardware Identifiers] + * {@link + * https://source.android.com/docs/security/features/keystore/attestation#hardware-identifiers} + */ + HardwareIdentifiers hardwareId; +} diff --git a/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/HardwareIdentifiers.aidl b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/HardwareIdentifiers.aidl new file mode 100644 index 0000000000..ffa09e67ba --- /dev/null +++ b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/HardwareIdentifiers.aidl @@ -0,0 +1,65 @@ +/* + * 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.hardware.automotive.ivn; + +/** + * Hardware Identifiers for an Android device. + * + *

These identifiers are embedded in the ID attestation certificate and are + * used to restrict what devices this device can connect to. All fields are + * optional but at least one of the fields must be specified. + */ +@JavaDerive(equals=true, toString=true) +@VintfStability +parcelable HardwareIdentifiers { + /** + * Optional brand name, as returned by {@code Build.BRAND} in Android. + * + * If unspecified, we assume the other device has the same brand name as this device. + */ + @nullable String brandName; + /** + * Optional brand name, as returned by {@code Build.DEVICE} in Android. + * + * If unspecified, we assume the other device has the same device name as this device. + */ + @nullable String deviceName; + /** + * Optional model name, as returned by {@code Build.PRODUCT} in Android. + * + * If unspecified, we assume the other device has the same product name as this device. + */ + @nullable String productName; + /** + * Optional manufacturer name, as returned by {@code Build.MANUFACTURER} in Android. + * + * If unspecified, we assume the other device has the same manufacturer name as this device. + */ + @nullable String manufacturerName; + /** + * Optional model name, as returned by {@code Build.MODEL} in Android. + * + * If unspecified, we assume the other device has the same model name as this device. + */ + @nullable String modelName; + /** + * Optional serial number. + * + * If unspecified, we allow the endpoint to have any serial number. + */ + @nullable String serialNumber; +} diff --git a/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/IIvnAndroidDevice.aidl b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/IIvnAndroidDevice.aidl new file mode 100644 index 0000000000..107b7a6b6c --- /dev/null +++ b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/IIvnAndroidDevice.aidl @@ -0,0 +1,81 @@ +/* + * 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.hardware.automotive.ivn; + +import android.hardware.automotive.ivn.EndpointInfo; +import android.hardware.automotive.ivn.OccupantZoneInfo; + +/** + * Interface for In-Vehicle Network(IVN) Android devices. + * + * This is used in a multi-zone multi-SoC environment where there are multiple + * SoCs running Android in a vehicle. Each support one or multiple occupant + * zones. E.g., one SoC for front passenger, one SoC for backseat left-zone + * and middle/right zone passengers. + */ +@VintfStability +interface IIvnAndroidDevice { + /** + * Returns the unique ID for this Android device. + * + *

This ID has to be unique among all the android devices in the whole vehicle. It is usually + * a hard-coded value, e.g. serial number. + * + * @return an ID representing this device. + */ + int getMyDeviceId(); + + /** + * Returns a list of unique IDs for other IVN Android devices. + * + * The returned list does not contain the current Android device ID. This list is usually + * pre-configured for this HAL, either hard-coded or read from configuration file. + * + * @return A list of IDs representing connected Android devices. + */ + int[] getOtherDeviceIds(); + + /** + * Returns the Android device ID for a specified occupant zone. + * + * @pararm zoneID the occupant zone ID returned from {@link android.car.CarOccupantZoneManager}. + * @return an ID representing an Android device. + */ + int getDeviceIdForOccupantZone(int zoneId); + + /** + * Returns all the occupant zones supported for a specified IVN Android device. + * + * @param androidDeviceId the android device ID. + * @return A list of supported occupant zone info. + */ + OccupantZoneInfo[] getOccupantZonesForDevice(int androidDeviceId); + + /** + * Returns the connection endpoint info for this android device. + * + * @return The endpoint info. + */ + EndpointInfo getMyEndpointInfo(); + + /** + * Returns the connection endpoint info for the specified IVN Android device. + * + * @return The endpoint info. + */ + EndpointInfo getEndpointInfoForDevice(int androidDeviceId); +} diff --git a/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/OccupantType.aidl b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/OccupantType.aidl new file mode 100644 index 0000000000..72542a7ae6 --- /dev/null +++ b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/OccupantType.aidl @@ -0,0 +1,39 @@ +/* + * 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.hardware.automotive.ivn; + +/** + * Occupant type. + * + * This enum might be extended in the future. + */ +@VintfStability +@Backing(type="int") +enum OccupantType { + /** + * Represents the driver. There can be one or zero driver for the system. Zero driver situation + * can happen if the system is configured to support only passengers. + */ + DRIVER = 1, + /** + * Represents front passengers who sit in front side of car. Most cars will have only + * one passenger of this type but this can be multiple. + */ + FRONT_PASSENGER = 2, + /** Represents passengers in rear seats. There can be multiple passengers of this type. */ + REAR_PASSENGER = 3, +} diff --git a/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/OccupantZoneInfo.aidl b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/OccupantZoneInfo.aidl new file mode 100644 index 0000000000..af45444d9b --- /dev/null +++ b/automotive/ivn_android_device/aidl/android/hardware/automotive/ivn/OccupantZoneInfo.aidl @@ -0,0 +1,50 @@ +/* + * 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.hardware.automotive.ivn; + +import android.hardware.automotive.ivn.OccupantType; + +/** + * Represents an occupant zone in a car. + * + *

Each occupant does not necessarily represent single person but it is for mapping to one + * set of displays. For example, for display located in center rear seat, both left and right + * side passengers may use it but it is abstracted as a single occupant zone.

+ */ +@JavaDerive(equals=true, toString=true) +@VintfStability +parcelable OccupantZoneInfo { + /** + * This is an unique id to distinguish each occupant zone. + * + *

This can be helpful to distinguish different zones when {@link #occupantType} and + * {@link #seat} are the same for multiple occupant / passenger zones.

+ * + *

This id will remain the same for the same zone across configuration changes like + * user switching or display changes

+ */ + int zoneId; + /** Represents type of passenger */ + OccupantType occupantType; + /** + * Represents seat assigned for the occupant. In some system, this can have value of + * {@code VehicleAreaSeat#SEAT_UNKNOWN}. + * + *

This might be one of {@code VehicleAreaSeat} or a combination of {@code VehicleAreaSeat}. + */ + int seat; +} diff --git a/compatibility_matrices/compatibility_matrix.8.xml b/compatibility_matrices/compatibility_matrix.8.xml index c9cf6ef471..104a463a4f 100644 --- a/compatibility_matrices/compatibility_matrix.8.xml +++ b/compatibility_matrices/compatibility_matrix.8.xml @@ -108,13 +108,20 @@ default - + android.hardware.automotive.remoteaccess IRemoteAccess default + + android.hardware.automotive.ivn + + IIvnAndroidDevice + default + + android.hardware.biometrics.face 3 From 80cc0c5a32bd64d64947f15cb5276066b9370f7c Mon Sep 17 00:00:00 2001 From: shrikar Date: Mon, 30 Jan 2023 16:56:53 +0000 Subject: [PATCH 718/998] Added EMERGENCY_LANE_KEEP_ASSIST_STATE to HAL layer. Bug: 264946353 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I16a046e0eed02ba79bf7ed6212e9063b91b9f43a --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../JsonConfigLoader/src/JsonConfigLoader.cpp | 3 + .../config/DefaultProperties.json | 25 +++++++ .../utils/common/include/VehicleHalTypes.h | 1 + .../vehicle/EmergencyLaneKeepAssistState.aidl | 44 ++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../vehicle/EmergencyLaneKeepAssistState.aidl | 70 +++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 20 ++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++ 12 files changed, 174 insertions(+) create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EmergencyLaneKeepAssistState.aidl create mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EmergencyLaneKeepAssistState.aidl diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index bbe1fcac6f..53ea656d70 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -258,6 +258,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyAccess::WRITE}, {VehicleProperty::LANE_CENTERING_ASSIST_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 2a005a856d..a4bedf9f39 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -258,6 +258,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::LANE_CENTERING_ASSIST_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 466ca5daa8..f0a2440f3a 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -250,6 +250,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyAccess.WRITE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.CRUISE_CONTROL_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess.READ_WRITE) diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index c7b5e26245..c642597a4c 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -250,6 +250,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_COMMAND, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.LANE_CENTERING_ASSIST_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index 0111c6bc03..1f9c3c1aba 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -38,6 +38,7 @@ using ::aidl::android::hardware::automotive::vehicle::AccessForVehicleProperty; using ::aidl::android::hardware::automotive::vehicle::AutomaticEmergencyBrakingState; using ::aidl::android::hardware::automotive::vehicle::BlindSpotWarningState; using ::aidl::android::hardware::automotive::vehicle::ChangeModeForVehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::EmergencyLaneKeepAssistState; using ::aidl::android::hardware::automotive::vehicle::ErrorState; using ::aidl::android::hardware::automotive::vehicle::EvConnectorType; using ::aidl::android::hardware::automotive::vehicle::EvsServiceState; @@ -218,6 +219,8 @@ JsonValueParser::JsonValueParser() { mConstantParsersByType["FuelType"] = std::make_unique>(); mConstantParsersByType["WindshieldWipersState"] = std::make_unique>(); + mConstantParsersByType["EmergencyLaneKeepAssistState"] = + std::make_unique>(); mConstantParsersByType["ErrorState"] = std::make_unique>(); mConstantParsersByType["AutomaticEmergencyBrakingState"] = std::make_unique>(); diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 810f48b469..889eef8629 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3112,6 +3112,31 @@ ] } }, + { + "property": "VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_STATE", + "defaultValue": { + "int32Values": [ + "EmergencyLaneKeepAssistState::ENABLED" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "ErrorState::NOT_AVAILABLE_SAFETY", + "ErrorState::NOT_AVAILABLE_SPEED_HIGH", + "ErrorState::NOT_AVAILABLE_SPEED_LOW", + "ErrorState::NOT_AVAILABLE_DISABLED", + "EmergencyLaneKeepAssistState::ENABLED", + "EmergencyLaneKeepAssistState::WARNING_LEFT", + "EmergencyLaneKeepAssistState::WARNING_RIGHT", + "EmergencyLaneKeepAssistState::ACTIVATED_STEER_LEFT", + "EmergencyLaneKeepAssistState::ACTIVATED_STEER_RIGHT", + "EmergencyLaneKeepAssistState::USER_OVERRIDE" + ] + } + ] + }, { "property": "VehicleProperty::CRUISE_CONTROL_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index a7a1dc72f2..3c12a47329 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EmergencyLaneKeepAssistState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EmergencyLaneKeepAssistState.aidl new file mode 100644 index 0000000000..078acde168 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/EmergencyLaneKeepAssistState.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum EmergencyLaneKeepAssistState { + OTHER = 0, + ENABLED = 1, + WARNING_LEFT = 2, + WARNING_RIGHT = 3, + ACTIVATED_STEER_LEFT = 4, + ACTIVATED_STEER_RIGHT = 5, + USER_OVERRIDE = 6, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index e89197be3a..6e17bca019 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -256,6 +256,7 @@ enum VehicleProperty { LANE_CENTERING_ASSIST_COMMAND = (((0x100B + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411083 */, LANE_CENTERING_ASSIST_STATE = (((0x100C + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411084 */, EMERGENCY_LANE_KEEP_ASSIST_ENABLED = (((0x100D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313933 */, + EMERGENCY_LANE_KEEP_ASSIST_STATE = (((0x100E + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411086 */, CRUISE_CONTROL_ENABLED = (((0x100F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313935 */, HANDS_ON_DETECTION_ENABLED = (((0x1016 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313942 */, DRIVER_ATTENTION_MONITORING_ENABLED = (((0x1019 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313945 */, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EmergencyLaneKeepAssistState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EmergencyLaneKeepAssistState.aidl new file mode 100644 index 0000000000..302b9aff4b --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/EmergencyLaneKeepAssistState.aidl @@ -0,0 +1,70 @@ +/* + * 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.hardware.automotive.vehicle; + +/** + * Used by emergency lane keep assist to enumerate state. + * + * This enum could be extended in future releases to include additional feature states. + */ +@VintfStability +@Backing(type="int") +enum EmergencyLaneKeepAssistState { + /** + * This state is used as an alternative for any EmergencyLaneKeepAssistState value that is not + * defined in the platform. Ideally, implementations of + * VehicleProperty#EMERGENCY_LANE_KEEP_ASSIST_STATE should not use this state. The framework can + * use this field to remain backwards compatible if EmergencyLaneKeepAssistState is extended to + * include additional states. + */ + OTHER = 0, + /** + * ELKA is enabled and monitoring safety, but no safety event is detected and steering assist is + * not activated. + */ + ENABLED = 1, + /** + * ELKA is enabled and a safety event is detected. Vehicle is sending out a warning to the + * driver indicating that there is a dangerous maneuver on the left side of the vehicle. + */ + WARNING_LEFT = 2, + /** + * ELKA is enabled and a safety event is detected. Vehicle is sending out a warning to the + * driver indicating that there is a dangerous maneuver on the right side of the vehicle. + */ + WARNING_RIGHT = 3, + /** + * ELKA is enabled and currently has steering assist applied to the vehicle. Steering assist + * nudges the vehicle towards the left, which generally means the steering wheel turns counter + * clockwise. This is usually in response to the driver making an unsafe right lane change. + */ + ACTIVATED_STEER_LEFT = 4, + /** + * ELKA is enabled and currently has steering assist applied to the vehicle. Steering assist + * nudges the vehicle towards the right, which generally means the steering wheel turns + * clockwise. This is usually in response to the driver making an unsafe left lane change. + */ + ACTIVATED_STEER_RIGHT = 5, + /** + * Many safety feature implementations allow the driver to override said feature. This means + * that the car has determined it should take some action, but a user decides to take over and + * do something else. This is often done for safety reasons and to ensure that the driver can + * always take control of the vehicle. This state should be set when the user is currently + * overriding ELKA. + */ + USER_OVERRIDE = 6, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index d8d5959360..8c6e9303d4 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3832,6 +3832,26 @@ enum VehicleProperty { EMERGENCY_LANE_KEEP_ASSIST_ENABLED = 0x100D + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Emergency Lane Keep Assist (ELKA) state. + * + * Returns the current state of ELKA. Generally, this property should return a valid state + * defined in the EmergencyLaneKeepAssistState or ErrorState. For example, if the feature is not + * available due to some temporary state, that information should be conveyed through + * ErrorState. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of EmergencyLaneKeepAssistState (including OTHER, which is not recommended) + * and ErrorState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum EmergencyLaneKeepAssistState + * @data_enum ErrorState + */ + EMERGENCY_LANE_KEEP_ASSIST_STATE = + 0x100E + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** * Enable or disable cruise control (CC). * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index e3f5dcadf7..b301887082 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -504,6 +504,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEmergencyLaneKeepAssistEnabledCo VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEmergencyLaneKeepAssistStateConfig) { + verifyProperty(VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlEnabledConfig) { verifyProperty(VehicleProperty::CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From d440ed4177cbf5496db3209451dd79120cef61e5 Mon Sep 17 00:00:00 2001 From: shrikar Date: Tue, 31 Jan 2023 00:25:14 +0000 Subject: [PATCH 719/998] Added CRUISE_CONTROL_TYPE to HAL layer. Bug: 266858123 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I2a8c6ac72c1c6f3feb90ffeb7a7b7f8fef0443c7 --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../JsonConfigLoader/src/JsonConfigLoader.cpp | 3 ++ .../config/DefaultProperties.json | 22 ++++++++ .../utils/common/include/VehicleHalTypes.h | 1 + .../automotive/vehicle/CruiseControlType.aidl | 41 ++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/CruiseControlType.aidl | 53 +++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 24 +++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 +++ 12 files changed, 155 insertions(+) create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CruiseControlType.aidl create mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlType.aidl diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 53ea656d70..c4c109b7cd 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -260,6 +260,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::CRUISE_CONTROL_TYPE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess::READ_WRITE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index a4bedf9f39..93934354c1 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -260,6 +260,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CRUISE_CONTROL_TYPE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index f0a2440f3a..c1b88564e1 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -252,6 +252,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.CRUISE_CONTROL_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.CRUISE_CONTROL_TYPE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess.READ_WRITE) ); diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index c642597a4c..3b1963aca9 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -252,6 +252,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CRUISE_CONTROL_TYPE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) ); diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index 1f9c3c1aba..29156573ca 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -38,6 +38,7 @@ using ::aidl::android::hardware::automotive::vehicle::AccessForVehicleProperty; using ::aidl::android::hardware::automotive::vehicle::AutomaticEmergencyBrakingState; using ::aidl::android::hardware::automotive::vehicle::BlindSpotWarningState; using ::aidl::android::hardware::automotive::vehicle::ChangeModeForVehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::CruiseControlType; using ::aidl::android::hardware::automotive::vehicle::EmergencyLaneKeepAssistState; using ::aidl::android::hardware::automotive::vehicle::ErrorState; using ::aidl::android::hardware::automotive::vehicle::EvConnectorType; @@ -221,6 +222,8 @@ JsonValueParser::JsonValueParser() { std::make_unique>(); mConstantParsersByType["EmergencyLaneKeepAssistState"] = std::make_unique>(); + mConstantParsersByType["CruiseControlType"] = + std::make_unique>(); mConstantParsersByType["ErrorState"] = std::make_unique>(); mConstantParsersByType["AutomaticEmergencyBrakingState"] = std::make_unique>(); diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 889eef8629..4cd8c1fba1 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3145,6 +3145,28 @@ ] } }, + { + "property": "VehicleProperty::CRUISE_CONTROL_TYPE", + "defaultValue": { + "int32Values": [ + "CruiseControlType::STANDARD" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "ErrorState::NOT_AVAILABLE_SAFETY", + "ErrorState::NOT_AVAILABLE_SPEED_HIGH", + "ErrorState::NOT_AVAILABLE_SPEED_LOW", + "ErrorState::NOT_AVAILABLE_DISABLED", + "CruiseControlType::STANDARD", + "CruiseControlType::ADAPTIVE", + "CruiseControlType::PREDICTIVE" + ] + } + ] + }, { "property": "VehicleProperty::HANDS_ON_DETECTION_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index 3c12a47329..4f392d1cc4 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -19,6 +19,7 @@ #include #include +#include #include #include #include diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CruiseControlType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CruiseControlType.aidl new file mode 100644 index 0000000000..aab9dfe966 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CruiseControlType.aidl @@ -0,0 +1,41 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum CruiseControlType { + OTHER = 0, + STANDARD = 1, + ADAPTIVE = 2, + PREDICTIVE = 3, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 6e17bca019..795ee8ac2a 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -258,6 +258,7 @@ enum VehicleProperty { EMERGENCY_LANE_KEEP_ASSIST_ENABLED = (((0x100D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313933 */, EMERGENCY_LANE_KEEP_ASSIST_STATE = (((0x100E + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411086 */, CRUISE_CONTROL_ENABLED = (((0x100F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313935 */, + CRUISE_CONTROL_TYPE = (((0x1010 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411088 */, HANDS_ON_DETECTION_ENABLED = (((0x1016 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313942 */, DRIVER_ATTENTION_MONITORING_ENABLED = (((0x1019 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313945 */, } diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlType.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlType.aidl new file mode 100644 index 0000000000..2367b828db --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlType.aidl @@ -0,0 +1,53 @@ +/* + * 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.hardware.automotive.vehicle; + +/** + * Used to enumerate the current type of Cruise Control (CC). + * + * This enum could be extended in future releases to include additional feature states. + */ +@VintfStability +@Backing(type="int") +enum CruiseControlType { + /** + * This state is used as an alternative for any CruiseControlType value that is not defined in + * the platform. Ideally, implementations of VehicleProperty#CRUISE_CONTROL_TYPE should not use + * this state. The framework can use this field to remain backwards compatible if + * CruiseControlType is extended to include additional types. + */ + OTHER = 0, + /** + * Standard cruise control is when a system in the vehicle automatically maintains a set speed + * without the driver having to keep their foot on the accelerator. This version of cruise + * control does not include automatic acceleration and deceleration to maintain a set time gap + * from a vehicle ahead. + */ + STANDARD = 1, + /** + * Adaptive cruise control is when a system in the vehicle automatically accelerates and + * decelerates to maintain a set speed and/or a set time gap from a vehicle ahead. + */ + ADAPTIVE = 2, + /** + * Predictive cruise control is a version of adaptive cruise control that also considers road + * topography, road curvature, speed limit and traffic signs, etc. to actively adjust braking, + * acceleration, gear shifting, etc. for the vehicle. This feature is often used to optimize + * fuel consumption. + */ + PREDICTIVE = 3, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 8c6e9303d4..58cf533f23 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3870,6 +3870,30 @@ enum VehicleProperty { CRUISE_CONTROL_ENABLED = 0x100F + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Current type of Cruise Control (CC). + * + * When CRUISE_CONTROL_ENABLED is true, this property returns the type of CC that is currently + * enabled (for example, standard CC, adaptive CC, predictive CC, etc.). Generally, this + * property should return a valid state defined in the CruiseControlType or ErrorState. For + * example, if the feature is not available due to some temporary state, that information should + * be conveyed through ErrorState. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of CruiseControlType (including OTHER, which is not recommended) and + * ErrorState are supported. + * + * Trying to write CruiseControlType#OTHER or an ErrorState to this property will throw an + * IllegalArgumentException. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + * @data_enum CruiseControlType + * @data_enum ErrorState + */ + CRUISE_CONTROL_TYPE = + 0x1010 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** * Enable or disable hands on detection (HOD). * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index b301887082..db9dc7961f 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -516,6 +516,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlEnabledConfig) { VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlTypeConfig) { + verifyProperty(VehicleProperty::CRUISE_CONTROL_TYPE, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionEnabledConfig) { verifyProperty(VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From 2753b9edff542bd3c6741d3010d8ed22c59de028 Mon Sep 17 00:00:00 2001 From: shrikar Date: Tue, 31 Jan 2023 00:25:14 +0000 Subject: [PATCH 720/998] Added CRUISE_CONTROL_STATE to HAL layer. Bug: 266866448 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I35a10ba6a3799a86265fc26d8d0643b7d7bdd446 --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../JsonConfigLoader/src/JsonConfigLoader.cpp | 3 + .../config/DefaultProperties.json | 24 +++++++ .../utils/common/include/VehicleHalTypes.h | 1 + .../vehicle/CruiseControlState.aidl | 43 ++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../vehicle/CruiseControlState.aidl | 67 +++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 20 ++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++ 12 files changed, 169 insertions(+) create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CruiseControlState.aidl create mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlState.aidl diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index c4c109b7cd..2624437e6e 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -261,6 +261,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::CRUISE_CONTROL_TYPE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess::READ_WRITE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 93934354c1..d2603808da 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -261,6 +261,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::CRUISE_CONTROL_TYPE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index c1b88564e1..3eed9749c3 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -253,6 +253,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.CRUISE_CONTROL_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.CRUISE_CONTROL_TYPE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess.READ_WRITE) ); diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 3b1963aca9..4e6de42710 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -253,6 +253,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.EMERGENCY_LANE_KEEP_ASSIST_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.CRUISE_CONTROL_TYPE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) ); diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index 29156573ca..4e53b68d55 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -38,6 +38,7 @@ using ::aidl::android::hardware::automotive::vehicle::AccessForVehicleProperty; using ::aidl::android::hardware::automotive::vehicle::AutomaticEmergencyBrakingState; using ::aidl::android::hardware::automotive::vehicle::BlindSpotWarningState; using ::aidl::android::hardware::automotive::vehicle::ChangeModeForVehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::CruiseControlState; using ::aidl::android::hardware::automotive::vehicle::CruiseControlType; using ::aidl::android::hardware::automotive::vehicle::EmergencyLaneKeepAssistState; using ::aidl::android::hardware::automotive::vehicle::ErrorState; @@ -224,6 +225,8 @@ JsonValueParser::JsonValueParser() { std::make_unique>(); mConstantParsersByType["CruiseControlType"] = std::make_unique>(); + mConstantParsersByType["CruiseControlState"] = + std::make_unique>(); mConstantParsersByType["ErrorState"] = std::make_unique>(); mConstantParsersByType["AutomaticEmergencyBrakingState"] = std::make_unique>(); diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 4cd8c1fba1..ca06c9b73e 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3167,6 +3167,30 @@ } ] }, + { + "property": "VehicleProperty::CRUISE_CONTROL_STATE", + "defaultValue": { + "int32Values": [ + "CruiseControlState::ENABLED" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "ErrorState::NOT_AVAILABLE_SAFETY", + "ErrorState::NOT_AVAILABLE_SPEED_HIGH", + "ErrorState::NOT_AVAILABLE_SPEED_LOW", + "ErrorState::NOT_AVAILABLE_DISABLED", + "CruiseControlState::ENABLED", + "CruiseControlState::ACTIVATED", + "CruiseControlState::USER_OVERRIDE", + "CruiseControlState::SUSPENDED", + "CruiseControlState::FORCED_DEACTIVATION_WARNING" + ] + } + ] + }, { "property": "VehicleProperty::HANDS_ON_DETECTION_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index 4f392d1cc4..f12f6d7db2 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -19,6 +19,7 @@ #include #include +#include #include #include #include diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CruiseControlState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CruiseControlState.aidl new file mode 100644 index 0000000000..ddaffa30c2 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CruiseControlState.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum CruiseControlState { + OTHER = 0, + ENABLED = 1, + ACTIVATED = 2, + USER_OVERRIDE = 3, + SUSPENDED = 4, + FORCED_DEACTIVATION_WARNING = 5, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 795ee8ac2a..15d11e21fe 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -259,6 +259,7 @@ enum VehicleProperty { EMERGENCY_LANE_KEEP_ASSIST_STATE = (((0x100E + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411086 */, CRUISE_CONTROL_ENABLED = (((0x100F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313935 */, CRUISE_CONTROL_TYPE = (((0x1010 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411088 */, + CRUISE_CONTROL_STATE = (((0x1011 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411089 */, HANDS_ON_DETECTION_ENABLED = (((0x1016 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313942 */, DRIVER_ATTENTION_MONITORING_ENABLED = (((0x1019 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313945 */, } diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlState.aidl new file mode 100644 index 0000000000..0e55e00948 --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlState.aidl @@ -0,0 +1,67 @@ +/* + * 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.hardware.automotive.vehicle; + +/** + * Used to enumerate the current state of Cruise Control (CC). + * + * This enum could be extended in future releases to include additional feature states. + */ +@VintfStability +@Backing(type="int") +enum CruiseControlState { + /** + * This state is used as an alternative for any CruiseControlState value that is not defined in + * the platform. Ideally, implementations of VehicleProperty#CRUISE_CONTROL_STATE should not use + * this state. The framework can use this field to remain backwards compatible if + * CruiseControlState is extended to include additional states. + */ + OTHER = 0, + /** + * CC is enabled but the ADAS system is not actively controlling the vehicle's speed. + */ + ENABLED = 1, + /** + * CC is enabled and activated, so the ADAS system is actively controlling the vehicle's speed. + */ + ACTIVATED = 2, + /** + * Most CC implementations allow the driver to override CC. This means that the car has + * determined it should maintain a certain speed and/or maintain a certain distance from a + * leading vehicle, but the driver decides to take over and do something else. This is often + * done for safety reasons and to ensure that the driver can always take control of the vehicle. + * This state should be set when the user is actively overriding the CC system. + */ + USER_OVERRIDE = 3, + /** + * Suspended state indicates CC is enabled and was activated, but now is suspended. This could + * be caused by the user tapping the brakes while CC is ACTIVATED or the user using the + * VehicleProperty#CRUISE_CONTROL_COMMAND to suspend CC. Once CC is suspended, the CC system + * gives control of the vehicle back to the driver, but saves the target speed and/or target + * time gap settings in case CC is resumed. This state can also be used when adaptive/predictive + * CC slows to a stop and needs a user signal to start again. + */ + SUSPENDED = 4, + /** + * When CC is in the ACTIVATED state but may potentially need to deactivate because of external + * conditions (e.g. roads curvature is too extreme, the driver does not have their hands on the + * steering wheel for a long period of time, or the driver is not paying attention), then the + * ADAS system will notify the driver of a potential need to deactivate and give control back to + * the driver. + */ + FORCED_DEACTIVATION_WARNING = 5, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 58cf533f23..179e57fe42 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3894,6 +3894,26 @@ enum VehicleProperty { CRUISE_CONTROL_TYPE = 0x1010 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** + * Current state of Cruise Control (CC). + * + * This property returns the current state of CC. Generally, this property should return a valid + * state defined in the CruiseControlState or ErrorState. For example, if the feature is not + * available due to some temporary state, that information should be conveyed through + * ErrorState. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of CruiseControlState (including OTHER, which is not recommended) and + * ErrorState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum CruiseControlState + * @data_enum ErrorState + */ + CRUISE_CONTROL_STATE = + 0x1011 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** * Enable or disable hands on detection (HOD). * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index db9dc7961f..2ee00d68df 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -522,6 +522,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlTypeConfig) { VehicleArea::GLOBAL, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlStateConfig) { + verifyProperty(VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionEnabledConfig) { verifyProperty(VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From 5df0f9574ca091b6deac6592c69eb552feaea8a0 Mon Sep 17 00:00:00 2001 From: shrikar Date: Thu, 2 Feb 2023 00:15:39 +0000 Subject: [PATCH 721/998] Added CRUISE_CONTROL_COMMAND to HAL layer. Bug: 266861468 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I7c6ca1d392932158ae3016194b6c092c03b7a44e --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../JsonConfigLoader/src/JsonConfigLoader.cpp | 3 + .../config/DefaultProperties.json | 16 +++++ .../utils/common/include/VehicleHalTypes.h | 1 + .../vehicle/CruiseControlCommand.aidl | 43 +++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../vehicle/CruiseControlCommand.aidl | 62 +++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 16 +++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++ 12 files changed, 152 insertions(+) create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CruiseControlCommand.aidl create mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlCommand.aidl diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 2624437e6e..1d2d910031 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -262,6 +262,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::CRUISE_CONTROL_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::CRUISE_CONTROL_TYPE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyAccess::WRITE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess::READ_WRITE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index d2603808da..613636e81c 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -262,6 +262,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::CRUISE_CONTROL_TYPE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 3eed9749c3..f83f1c260e 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -254,6 +254,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.CRUISE_CONTROL_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.CRUISE_CONTROL_TYPE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyAccess.WRITE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess.READ_WRITE) ); diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 4e6de42710..f0642fe379 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -254,6 +254,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.CRUISE_CONTROL_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.CRUISE_CONTROL_TYPE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) ); diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index 4e53b68d55..7531589311 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -38,6 +38,7 @@ using ::aidl::android::hardware::automotive::vehicle::AccessForVehicleProperty; using ::aidl::android::hardware::automotive::vehicle::AutomaticEmergencyBrakingState; using ::aidl::android::hardware::automotive::vehicle::BlindSpotWarningState; using ::aidl::android::hardware::automotive::vehicle::ChangeModeForVehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::CruiseControlCommand; using ::aidl::android::hardware::automotive::vehicle::CruiseControlState; using ::aidl::android::hardware::automotive::vehicle::CruiseControlType; using ::aidl::android::hardware::automotive::vehicle::EmergencyLaneKeepAssistState; @@ -227,6 +228,8 @@ JsonValueParser::JsonValueParser() { std::make_unique>(); mConstantParsersByType["CruiseControlState"] = std::make_unique>(); + mConstantParsersByType["CruiseControlCommand"] = + std::make_unique>(); mConstantParsersByType["ErrorState"] = std::make_unique>(); mConstantParsersByType["AutomaticEmergencyBrakingState"] = std::make_unique>(); diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index ca06c9b73e..a0e811579a 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3191,6 +3191,22 @@ } ] }, + { + "property": "VehicleProperty::CRUISE_CONTROL_COMMAND", + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "CruiseControlCommand::ACTIVATE", + "CruiseControlCommand::SUSPEND", + "CruiseControlCommand::INCREASE_TARGET_SPEED", + "CruiseControlCommand::DECREASE_TARGET_SPEED", + "CruiseControlCommand::INCREASE_TARGET_TIME_GAP", + "CruiseControlCommand::DECREASE_TARGET_TIME_GAP" + ] + } + ] + }, { "property": "VehicleProperty::HANDS_ON_DETECTION_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index f12f6d7db2..3b26aa6999 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -19,6 +19,7 @@ #include #include +#include #include #include #include diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CruiseControlCommand.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CruiseControlCommand.aidl new file mode 100644 index 0000000000..d6a104d25b --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/CruiseControlCommand.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum CruiseControlCommand { + ACTIVATE = 1, + SUSPEND = 2, + INCREASE_TARGET_SPEED = 3, + DECREASE_TARGET_SPEED = 4, + INCREASE_TARGET_TIME_GAP = 5, + DECREASE_TARGET_TIME_GAP = 6, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 15d11e21fe..bbec4bf595 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -260,6 +260,7 @@ enum VehicleProperty { CRUISE_CONTROL_ENABLED = (((0x100F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313935 */, CRUISE_CONTROL_TYPE = (((0x1010 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411088 */, CRUISE_CONTROL_STATE = (((0x1011 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411089 */, + CRUISE_CONTROL_COMMAND = (((0x1012 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411090 */, HANDS_ON_DETECTION_ENABLED = (((0x1016 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313942 */, DRIVER_ATTENTION_MONITORING_ENABLED = (((0x1019 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313945 */, } diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlCommand.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlCommand.aidl new file mode 100644 index 0000000000..18e140506d --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/CruiseControlCommand.aidl @@ -0,0 +1,62 @@ +/* + * 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.hardware.automotive.vehicle; + +/** + * Used to enumerate the Cruise Control (CC) commands. + * + * This enum could be extended in future releases to include additional feature states. + */ +@VintfStability +@Backing(type="int") +enum CruiseControlCommand { + /** + * Activate cruise control, which means CC takes control of maintaining the vehicle's target + * speed without the driver having to keep their foot on the accelerator. The target speed for + * CC is generally set to the vehicle's speed at the time of activation. + */ + ACTIVATE = 1, + /** + * Suspend cruise control, but still keep it enabled. Once CC is activated again, the + * target speed should resume to the previous setting. + */ + SUSPEND = 2, + /** + * Increase the target speed when CC is activated. The increment value should be decided by the + * OEM. The updated value can be read from CRUISE_CONTROL_TARGET_SPEED. + */ + INCREASE_TARGET_SPEED = 3, + /** + * Decrease the target speed when CC is activated. The decrement value should be decided by the + * OEM. The updated value can be read from CRUISE_CONTROL_TARGET_SPEED. + */ + DECREASE_TARGET_SPEED = 4, + /** + * Increase the target time gap or distance from the vehicle ahead when adaptive/predictive CC + * is activated. The increment value should be decided by the OEM. The updated value can be read + * from ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP. Setting this command on a standard CC vehicle + * should return StatusCode.NOT_AVAILABLE. + */ + INCREASE_TARGET_TIME_GAP = 5, + /** + * Decrease the target time gap or distance from the vehicle ahead when adaptive/predictive CC + * is activated. The decrement value should be decided by the 0EM. The updated value can be read + * from ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP. Setting this command on a standard CC vehicle + * should return StatusCode.NOT_AVAILABLE. + */ + DECREASE_TARGET_TIME_GAP = 6, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 179e57fe42..68a1e324ee 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3914,6 +3914,22 @@ enum VehicleProperty { CRUISE_CONTROL_STATE = 0x1011 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** + * Write Cruise Control (CC) commands. + * + * See CruiseControlCommand for the details about each supported command. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of CruiseControlState are supported. Any unsupported commands sent through + * this property should return StatusCode.INVALID_ARG. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.WRITE + * @data_enum CruiseControlCommand + */ + CRUISE_CONTROL_COMMAND = + 0x1012 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** * Enable or disable hands on detection (HOD). * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 2ee00d68df..efbcf47680 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -528,6 +528,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlStateConfig) { VehicleArea::GLOBAL, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlCommandConfig) { + verifyProperty(VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyAccess::WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionEnabledConfig) { verifyProperty(VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From bc4ca2af0294a7d067fc16b66eccf0a956acbdfd Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Tue, 7 Feb 2023 12:10:50 -0800 Subject: [PATCH 722/998] Add more MLO link parameters Framework populates MLO link information from scan cache. In roaming use cases, framework may not have the scan result for the roamed AP. So, always get the MLO link parameters from the supplicant. Add static parameters apMldMacAddress, apLinkMacAddress and frequency of the link. Dynamic parameters like RSSI, link speed..etc. are queried from signal poll. Bug: 268230307 Test: m android.hardware.wifi.supplicant-update-api Change-Id: I7ffb23a8ead63a385cd00d26969529e2943fcff1 --- .../current/android/hardware/wifi/supplicant/MloLink.aidl | 2 ++ .../android/hardware/wifi/supplicant/MloLinksInfo.aidl | 2 ++ .../aidl/android/hardware/wifi/supplicant/MloLink.aidl | 8 ++++++++ .../android/hardware/wifi/supplicant/MloLinksInfo.aidl | 8 ++++++++ 4 files changed, 20 insertions(+) diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLink.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLink.aidl index f30ca94615..8783c40cbb 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLink.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLink.aidl @@ -38,4 +38,6 @@ parcelable MloLink { byte[] staLinkMacAddress; byte tidsUplinkMap; byte tidsDownlinkMap; + @nullable byte[] apLinkMacAddress; + int frequencyMHz; } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLinksInfo.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLinksInfo.aidl index 14fcb9178d..cd98f7fb8f 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLinksInfo.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLinksInfo.aidl @@ -35,4 +35,6 @@ package android.hardware.wifi.supplicant; @VintfStability parcelable MloLinksInfo { android.hardware.wifi.supplicant.MloLink[] links; + int apMloLinkId; + @nullable byte[] apMldMacAddress; } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLink.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLink.aidl index 7608e0a5b3..ed6528cb6f 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLink.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLink.aidl @@ -58,4 +58,12 @@ parcelable MloLink { */ byte tidsUplinkMap; byte tidsDownlinkMap; + /** + * AP Link MAC Address + */ + @nullable byte[/* 6 */] apLinkMacAddress; + /** + * Frequency on which the link operates in MHz. + */ + int frequencyMHz; } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLinksInfo.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLinksInfo.aidl index 2f14717209..d954d16018 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLinksInfo.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLinksInfo.aidl @@ -28,4 +28,12 @@ parcelable MloLinksInfo { * List of MLO links */ MloLink[] links; + /** + * The MLO link-id for the access point. It is the link-id used for association. + */ + int apMloLinkId; + /** + * AP MLD MAC address. + */ + @nullable byte[/* 6 */] apMldMacAddress; } From e35e7e46bbcf4a8632b98b0ca726359feffbc3b8 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Tue, 14 Feb 2023 22:31:56 +0000 Subject: [PATCH 723/998] Remove DEBUG_ capabilities from ChipCapabilityMask. Also update the IWifiChip VTS test to reflect this change. Bug: 266521428 Test: atest VtsHalWifiChipTargetTest Change-Id: I537588c405d8a01091a6818020084acbe2679e14 --- .../android/hardware/wifi/IWifiChip.aidl | 40 +++++------ .../aidl/android/hardware/wifi/IWifiChip.aidl | 50 +++----------- .../vts/functional/wifi_chip_aidl_test.cpp | 68 ++++--------------- 3 files changed, 37 insertions(+), 121 deletions(-) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl index fd59888d56..6d0ddaa4f3 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl @@ -85,22 +85,14 @@ interface IWifiChip { const int NO_POWER_CAP_CONSTANT = 0x7FFFFFFF; @Backing(type="int") @VintfStability enum ChipCapabilityMask { - DEBUG_MEMORY_FIRMWARE_DUMP = (1 << 0), - DEBUG_MEMORY_DRIVER_DUMP = (1 << 1), - DEBUG_RING_BUFFER_CONNECT_EVENT = (1 << 2), - DEBUG_RING_BUFFER_POWER_EVENT = (1 << 3), - DEBUG_RING_BUFFER_WAKELOCK_EVENT = (1 << 4), - DEBUG_RING_BUFFER_VENDOR_DATA = (1 << 5), - DEBUG_HOST_WAKE_REASON_STATS = (1 << 6), - DEBUG_ERROR_ALERTS = (1 << 7), - SET_TX_POWER_LIMIT = (1 << 8), - D2D_RTT = (1 << 9), - D2AP_RTT = (1 << 10), - USE_BODY_HEAD_SAR = (1 << 11), - SET_LATENCY_MODE = (1 << 12), - P2P_RAND_MAC = (1 << 13), - WIGIG = (1 << 14), - SET_AFC_CHANNEL_ALLOWANCE = (1 << 15), + SET_TX_POWER_LIMIT = (1 << 0) /* 1 */, + D2D_RTT = (1 << 1) /* 2 */, + D2AP_RTT = (1 << 2) /* 4 */, + USE_BODY_HEAD_SAR = (1 << 3) /* 8 */, + SET_LATENCY_MODE = (1 << 4) /* 16 */, + P2P_RAND_MAC = (1 << 5) /* 32 */, + WIGIG = (1 << 6) /* 64 */, + SET_AFC_CHANNEL_ALLOWANCE = (1 << 7) /* 128 */, } @VintfStability parcelable ChipConcurrencyCombinationLimit { @@ -132,9 +124,9 @@ interface IWifiChip { } @Backing(type="int") @VintfStability enum CoexRestriction { - WIFI_DIRECT = (1 << 0), - SOFTAP = (1 << 1), - WIFI_AWARE = (1 << 2), + WIFI_DIRECT = (1 << 0) /* 1 */, + SOFTAP = (1 << 1) /* 2 */, + WIFI_AWARE = (1 << 2) /* 4 */, } @VintfStability parcelable CoexUnsafeChannel { @@ -162,13 +154,13 @@ interface IWifiChip { } @Backing(type="int") @VintfStability enum UsableChannelFilter { - CELLULAR_COEXISTENCE = (1 << 0), - CONCURRENCY = (1 << 1), - NAN_INSTANT_MODE = (1 << 2), + CELLULAR_COEXISTENCE = (1 << 0) /* 1 */, + CONCURRENCY = (1 << 1) /* 2 */, + NAN_INSTANT_MODE = (1 << 2) /* 4 */, } @Backing(type="int") @VintfStability enum ChannelCategoryMask { - INDOOR_CHANNEL = (1 << 0), - DFS_CHANNEL = (1 << 1), + INDOOR_CHANNEL = (1 << 0) /* 1 */, + DFS_CHANNEL = (1 << 1) /* 2 */, } } diff --git a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl index 41ff7e68ae..8d415fdc68 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl @@ -45,72 +45,39 @@ interface IWifiChip { @VintfStability @Backing(type="int") enum ChipCapabilityMask { - /** - * Memory dump of Firmware. - */ - DEBUG_MEMORY_FIRMWARE_DUMP = 1 << 0, - /** - * Memory dump of Driver. - */ - DEBUG_MEMORY_DRIVER_DUMP = 1 << 1, - /** - * Connectivity events reported via debug ring buffer. - */ - DEBUG_RING_BUFFER_CONNECT_EVENT = 1 << 2, - /** - * Power events reported via debug ring buffer. - */ - DEBUG_RING_BUFFER_POWER_EVENT = 1 << 3, - /** - * Wakelock events reported via debug ring buffer. - */ - DEBUG_RING_BUFFER_WAKELOCK_EVENT = 1 << 4, - /** - * Vendor data reported via debug ring buffer. - * This mostly contains firmware event logs. - */ - DEBUG_RING_BUFFER_VENDOR_DATA = 1 << 5, - /** - * Host wake reasons stats collection. - */ - DEBUG_HOST_WAKE_REASON_STATS = 1 << 6, - /** - * Error alerts. - */ - DEBUG_ERROR_ALERTS = 1 << 7, /** * Set/Reset Tx Power limits. */ - SET_TX_POWER_LIMIT = 1 << 8, + SET_TX_POWER_LIMIT = 1 << 0, /** * Device to Device RTT. */ - D2D_RTT = 1 << 9, + D2D_RTT = 1 << 1, /** * Device to AP RTT. */ - D2AP_RTT = 1 << 10, + D2AP_RTT = 1 << 2, /** * Set/Reset Tx Power limits. */ - USE_BODY_HEAD_SAR = 1 << 11, + USE_BODY_HEAD_SAR = 1 << 3, /** * Set Latency Mode. */ - SET_LATENCY_MODE = 1 << 12, + SET_LATENCY_MODE = 1 << 4, /** * Support P2P MAC randomization. */ - P2P_RAND_MAC = 1 << 13, + P2P_RAND_MAC = 1 << 5, /** * Chip can operate in the 60GHz band (WiGig chip). */ - WIGIG = 1 << 14, + WIGIG = 1 << 6, /** * Chip supports setting allowed channels along with PSD in 6GHz band * for AFC purposes. */ - SET_AFC_CHANNEL_ALLOWANCE = 1 << 15, + SET_AFC_CHANNEL_ALLOWANCE = 1 << 7, } /** @@ -540,7 +507,6 @@ interface IWifiChip { * API to enable/disable alert notifications from the chip. * These alerts must be used to notify the framework of any fatal error events * that the chip encounters via |IWifiChipEventCallback.onDebugErrorAlert| method. - * Must fail if |ChipCapabilityMask.DEBUG_ERROR_ALERTS| is not set. * * @param enable true to enable, false to disable. * @throws ServiceSpecificException with one of the following values: diff --git a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp index fec9122e07..f908be64c7 100644 --- a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp +++ b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp @@ -131,16 +131,6 @@ class WifiChipAidlTest : public testing::TestWithParam { return {iface1, iface2}; } - bool hasAnyRingBufferCapabilities(int32_t caps) { - return caps & - (static_cast( - IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_CONNECT_EVENT) | - static_cast(IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_POWER_EVENT) | - static_cast( - IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_WAKELOCK_EVENT) | - static_cast(IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_VENDOR_DATA)); - } - const char* getInstanceName() { return GetParam().c_str(); } std::shared_ptr wifi_chip_; @@ -452,14 +442,9 @@ TEST_P(WifiChipAidlTest, RequestChipDebugInfo) { */ TEST_P(WifiChipAidlTest, RequestFirmwareDebugDump) { configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); std::vector debug_dump; auto status = wifi_chip_->requestFirmwareDebugDump(&debug_dump); - if (caps & static_cast(IWifiChip::ChipCapabilityMask::DEBUG_MEMORY_FIRMWARE_DUMP)) { - EXPECT_TRUE(status.isOk()); - } else { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - } + EXPECT_TRUE(status.isOk() || checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); } /* @@ -467,14 +452,9 @@ TEST_P(WifiChipAidlTest, RequestFirmwareDebugDump) { */ TEST_P(WifiChipAidlTest, RequestDriverDebugDump) { configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); std::vector debug_dump; auto status = wifi_chip_->requestDriverDebugDump(&debug_dump); - if (caps & static_cast(IWifiChip::ChipCapabilityMask::DEBUG_MEMORY_DRIVER_DUMP)) { - EXPECT_TRUE(status.isOk()); - } else { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - } + EXPECT_TRUE(status.isOk() || checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); } /* @@ -482,17 +462,14 @@ TEST_P(WifiChipAidlTest, RequestDriverDebugDump) { */ TEST_P(WifiChipAidlTest, GetDebugRingBuffersStatus) { configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); std::vector ring_buffer_status; auto status = wifi_chip_->getDebugRingBuffersStatus(&ring_buffer_status); - if (hasAnyRingBufferCapabilities(caps)) { - EXPECT_TRUE(status.isOk()); + EXPECT_TRUE(status.isOk() || checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + if (status.isOk()) { ASSERT_NE(ring_buffer_status.size(), 0); for (const auto& ring_buffer : ring_buffer_status) { EXPECT_NE(ring_buffer.ringName.size(), 0); } - } else { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); } } @@ -501,14 +478,9 @@ TEST_P(WifiChipAidlTest, GetDebugRingBuffersStatus) { */ TEST_P(WifiChipAidlTest, GetDebugHostWakeReasonStats) { configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); WifiDebugHostWakeReasonStats wake_reason_stats = {}; auto status = wifi_chip_->getDebugHostWakeReasonStats(&wake_reason_stats); - if (caps & static_cast(IWifiChip::ChipCapabilityMask::DEBUG_HOST_WAKE_REASON_STATS)) { - EXPECT_TRUE(status.isOk()); - } else { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - } + EXPECT_TRUE(status.isOk() || checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); } /* @@ -516,26 +488,19 @@ TEST_P(WifiChipAidlTest, GetDebugHostWakeReasonStats) { */ TEST_P(WifiChipAidlTest, StartLoggingToDebugRingBuffer) { configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); std::string ring_name; std::vector ring_buffer_status; - auto status = wifi_chip_->getDebugRingBuffersStatus(&ring_buffer_status); - if (hasAnyRingBufferCapabilities(caps)) { - EXPECT_TRUE(status.isOk()); + auto status = wifi_chip_->getDebugRingBuffersStatus(&ring_buffer_status); + EXPECT_TRUE(status.isOk() || checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + if (status.isOk()) { ASSERT_NE(ring_buffer_status.size(), 0); ring_name = ring_buffer_status[0].ringName; - } else { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); } status = wifi_chip_->startLoggingToDebugRingBuffer( ring_name, WifiDebugRingBufferVerboseLevel::VERBOSE, 5, 1024); - if (hasAnyRingBufferCapabilities(caps)) { - EXPECT_TRUE(status.isOk()); - } else { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - } + EXPECT_TRUE(status.isOk() || checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); } /* @@ -543,25 +508,18 @@ TEST_P(WifiChipAidlTest, StartLoggingToDebugRingBuffer) { */ TEST_P(WifiChipAidlTest, ForceDumpToDebugRingBuffer) { configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); std::string ring_name; std::vector ring_buffer_status; - auto status = wifi_chip_->getDebugRingBuffersStatus(&ring_buffer_status); - if (hasAnyRingBufferCapabilities(caps)) { - EXPECT_TRUE(status.isOk()); + auto status = wifi_chip_->getDebugRingBuffersStatus(&ring_buffer_status); + EXPECT_TRUE(status.isOk() || checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); + if (status.isOk()) { ASSERT_NE(ring_buffer_status.size(), 0); ring_name = ring_buffer_status[0].ringName; - } else { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); } status = wifi_chip_->forceDumpToDebugRingBuffer(ring_name); - if (hasAnyRingBufferCapabilities(caps)) { - EXPECT_TRUE(status.isOk()); - } else { - EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); - } + EXPECT_TRUE(status.isOk() || checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); } /* From bff0e408dfc65320a264d5790b88a1f165d20778 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Tue, 14 Feb 2023 22:42:20 +0000 Subject: [PATCH 724/998] Remove any references to DEBUG_ capabilities in the Vendor HAL service. Bug: 266521428 Test: Vendor HAL gTest suite (see the modified test case) Change-Id: I86e0c465b9f9d2f31413d75727e36b42c2b6b88a --- wifi/aidl/default/aidl_struct_util.cpp | 38 +------------------ wifi/aidl/default/aidl_struct_util.h | 4 +- .../tests/aidl_struct_util_unit_tests.cpp | 12 ++---- wifi/aidl/default/wifi_chip.cpp | 4 +- 4 files changed, 7 insertions(+), 51 deletions(-) diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index 921b5dc38c..8463eac82a 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -41,23 +41,6 @@ inline std::vector uintToIntVec(const std::vector& in) { return std::vector(in.begin(), in.end()); } -IWifiChip::ChipCapabilityMask convertLegacyLoggerFeatureToAidlChipCapability(uint32_t feature) { - switch (feature) { - case legacy_hal::WIFI_LOGGER_MEMORY_DUMP_SUPPORTED: - return IWifiChip::ChipCapabilityMask::DEBUG_MEMORY_FIRMWARE_DUMP; - case legacy_hal::WIFI_LOGGER_DRIVER_DUMP_SUPPORTED: - return IWifiChip::ChipCapabilityMask::DEBUG_MEMORY_DRIVER_DUMP; - case legacy_hal::WIFI_LOGGER_CONNECT_EVENT_SUPPORTED: - return IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_CONNECT_EVENT; - case legacy_hal::WIFI_LOGGER_POWER_EVENT_SUPPORTED: - return IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_POWER_EVENT; - case legacy_hal::WIFI_LOGGER_WAKE_LOCK_SUPPORTED: - return IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_WAKELOCK_EVENT; - }; - CHECK(false) << "Unknown legacy feature: " << feature; - return {}; -} - IWifiStaIface::StaIfaceCapabilityMask convertLegacyLoggerFeatureToAidlStaIfaceCapability( uint32_t feature) { switch (feature) { @@ -125,23 +108,11 @@ IWifiStaIface::StaIfaceCapabilityMask convertLegacyFeatureToAidlStaIfaceCapabili return {}; } -bool convertLegacyFeaturesToAidlChipCapabilities(uint64_t legacy_feature_set, - uint32_t legacy_logger_feature_set, - uint32_t* aidl_caps) { +bool convertLegacyFeaturesToAidlChipCapabilities(uint64_t legacy_feature_set, uint32_t* aidl_caps) { if (!aidl_caps) { return false; } *aidl_caps = {}; - for (const auto feature : {legacy_hal::WIFI_LOGGER_MEMORY_DUMP_SUPPORTED, - legacy_hal::WIFI_LOGGER_DRIVER_DUMP_SUPPORTED, - legacy_hal::WIFI_LOGGER_CONNECT_EVENT_SUPPORTED, - legacy_hal::WIFI_LOGGER_POWER_EVENT_SUPPORTED, - legacy_hal::WIFI_LOGGER_WAKE_LOCK_SUPPORTED}) { - if (feature & legacy_logger_feature_set) { - *aidl_caps |= - static_cast(convertLegacyLoggerFeatureToAidlChipCapability(feature)); - } - } std::vector features = {WIFI_FEATURE_SET_TX_POWER_LIMIT, WIFI_FEATURE_USE_BODY_HEAD_SAR, WIFI_FEATURE_D2D_RTT, @@ -156,13 +127,6 @@ bool convertLegacyFeaturesToAidlChipCapabilities(uint64_t legacy_feature_set, } } - // There are no flags for these 3 in the legacy feature set. Adding them to - // the set because all the current devices support it. - *aidl_caps |= - static_cast(IWifiChip::ChipCapabilityMask::DEBUG_RING_BUFFER_VENDOR_DATA); - *aidl_caps |= - static_cast(IWifiChip::ChipCapabilityMask::DEBUG_HOST_WAKE_REASON_STATS); - *aidl_caps |= static_cast(IWifiChip::ChipCapabilityMask::DEBUG_ERROR_ALERTS); return true; } diff --git a/wifi/aidl/default/aidl_struct_util.h b/wifi/aidl/default/aidl_struct_util.h index 6407d321a0..df3785e511 100644 --- a/wifi/aidl/default/aidl_struct_util.h +++ b/wifi/aidl/default/aidl_struct_util.h @@ -37,9 +37,7 @@ namespace wifi { namespace aidl_struct_util { // Chip conversion methods. -bool convertLegacyFeaturesToAidlChipCapabilities(uint64_t legacy_feature_set, - uint32_t legacy_logger_feature_set, - uint32_t* aidl_caps); +bool convertLegacyFeaturesToAidlChipCapabilities(uint64_t legacy_feature_set, uint32_t* aidl_caps); bool convertLegacyDebugRingBufferStatusToAidl( const legacy_hal::wifi_ring_buffer_status& legacy_status, WifiDebugRingBufferStatus* aidl_status); diff --git a/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp index f97c846800..9997937ef2 100644 --- a/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp +++ b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp @@ -661,18 +661,12 @@ TEST_F(AidlStructUtilTest, CanConvertLegacyFeaturesToAidl) { using AidlChipCaps = IWifiChip::ChipCapabilityMask; uint32_t aidl_caps; - uint32_t legacy_feature_set = WIFI_FEATURE_D2D_RTT | WIFI_FEATURE_SET_LATENCY_MODE; - uint32_t legacy_logger_feature_set = legacy_hal::WIFI_LOGGER_DRIVER_DUMP_SUPPORTED; - ASSERT_TRUE(aidl_struct_util::convertLegacyFeaturesToAidlChipCapabilities( - legacy_feature_set, legacy_logger_feature_set, &aidl_caps)); + ASSERT_TRUE(aidl_struct_util::convertLegacyFeaturesToAidlChipCapabilities(legacy_feature_set, + &aidl_caps)); - EXPECT_EQ((uint32_t)AidlChipCaps::DEBUG_RING_BUFFER_VENDOR_DATA | - (uint32_t)AidlChipCaps::DEBUG_HOST_WAKE_REASON_STATS | - (uint32_t)AidlChipCaps::DEBUG_ERROR_ALERTS | (uint32_t)AidlChipCaps::D2D_RTT | - (uint32_t)AidlChipCaps::SET_LATENCY_MODE | - (uint32_t)AidlChipCaps::DEBUG_MEMORY_DRIVER_DUMP, + EXPECT_EQ((uint32_t)AidlChipCaps::D2D_RTT | (uint32_t)AidlChipCaps::SET_LATENCY_MODE, aidl_caps); } diff --git a/wifi/aidl/default/wifi_chip.cpp b/wifi/aidl/default/wifi_chip.cpp index 541de166ce..41912b5d66 100644 --- a/wifi/aidl/default/wifi_chip.cpp +++ b/wifi/aidl/default/wifi_chip.cpp @@ -769,8 +769,8 @@ std::pair WifiChip::getCapabi legacy_logger_feature_set = 0; } uint32_t aidl_caps; - if (!aidl_struct_util::convertLegacyFeaturesToAidlChipCapabilities( - legacy_feature_set, legacy_logger_feature_set, &aidl_caps)) { + if (!aidl_struct_util::convertLegacyFeaturesToAidlChipCapabilities(legacy_feature_set, + &aidl_caps)) { return {IWifiChip::ChipCapabilityMask{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; } return {static_cast(aidl_caps), ndk::ScopedAStatus::ok()}; From bae6fddf98e3d33ec0e0241079c2307aa0b5b155 Mon Sep 17 00:00:00 2001 From: Nate Jiang Date: Fri, 10 Feb 2023 17:16:40 -0800 Subject: [PATCH 725/998] Modify based on the vendor feedback - Add end pairing request method - Handle bootstrapping comeback event - Add cipher type in the pairing request Bug: 265075699 Test: cts sinlgeDeviceTest Change-Id: Ic744b0a1098e258b68caba5a9a33b2bef3226b40 --- .../android/hardware/wifi/IWifiNanIface.aidl | 1 + .../wifi/IWifiNanIfaceEventCallback.aidl | 1 + .../android/hardware/wifi/IWifiStaIface.aidl | 30 +++++++------- .../wifi/NanBootstrappingConfirmInd.aidl | 4 +- .../hardware/wifi/NanBootstrappingMethod.aidl | 22 +++++----- .../wifi/NanBootstrappingRequest.aidl | 1 + .../wifi/NanBootstrappingResponseCode.aidl | 40 +++++++++++++++++++ .../hardware/wifi/NanCipherSuiteType.aidl | 10 +++-- .../wifi/NanPairingSecurityConfig.aidl | 1 + .../hardware/wifi/NanRangingIndication.aidl | 6 +-- .../hardware/wifi/NpkSecurityAssociation.aidl | 1 + ...groundScanBucketEventReportSchemeMask.aidl | 6 +-- .../hardware/wifi/StaScanDataFlagMask.aidl | 2 +- .../hardware/wifi/WifiChannelWidthInMhz.aidl | 2 +- .../wifi/WifiDebugRingBufferFlags.aidl | 6 +-- .../android/hardware/wifi/WifiIfaceMode.aidl | 16 ++++---- .../android/hardware/wifi/IWifiNanIface.aidl | 12 ++++++ .../wifi/IWifiNanIfaceEventCallback.aidl | 14 +++++++ .../wifi/NanBootstrappingConfirmInd.aidl | 13 +++++- .../wifi/NanBootstrappingRequest.aidl | 5 +++ .../wifi/NanBootstrappingResponseCode.aidl | 28 +++++++++++++ .../hardware/wifi/NanCipherSuiteType.aidl | 18 ++++++--- .../wifi/NanPairingSecurityConfig.aidl | 6 +++ .../hardware/wifi/NpkSecurityAssociation.aidl | 6 +++ wifi/aidl/default/aidl_struct_util.cpp | 15 +++++-- .../tests/wifi_nan_iface_unit_tests.cpp | 1 + wifi/aidl/default/wifi_legacy_hal.cpp | 9 +++++ wifi/aidl/default/wifi_legacy_hal.h | 5 ++- wifi/aidl/default/wifi_legacy_hal_stubs.cpp | 1 + wifi/aidl/default/wifi_nan_iface.cpp | 21 ++++++++++ wifi/aidl/default/wifi_nan_iface.h | 2 + .../functional/wifi_nan_iface_aidl_test.cpp | 9 +++++ 32 files changed, 254 insertions(+), 60 deletions(-) create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingResponseCode.aidl create mode 100644 wifi/aidl/android/hardware/wifi/NanBootstrappingResponseCode.aidl diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIface.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIface.aidl index b20f505944..0e2f90fbc0 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIface.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIface.aidl @@ -56,6 +56,7 @@ interface IWifiNanIface { void respondToPairingIndicationRequest(in char cmdId, in android.hardware.wifi.NanRespondToPairingIndicationRequest msg); void initiateBootstrappingRequest(in char cmdId, in android.hardware.wifi.NanBootstrappingRequest msg); void respondToBootstrappingIndicationRequest(in char cmdId, in android.hardware.wifi.NanBootstrappingResponse msg); + void terminatePairingRequest(in char cmdId, in int pairingInstanceId); const int MIN_DATA_PATH_CONFIG_PASSPHRASE_LENGTH = 8; const int MAX_DATA_PATH_CONFIG_PASSPHRASE_LENGTH = 63; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl index dfb28aae07..ed78d35d38 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl @@ -70,4 +70,5 @@ interface IWifiNanIfaceEventCallback { oneway void eventBootstrappingConfirm(in android.hardware.wifi.NanBootstrappingConfirmInd event); oneway void notifyInitiateBootstrappingResponse(in char id, in android.hardware.wifi.NanStatus status, in int bootstrappingInstanceId); oneway void notifyRespondToBootstrappingIndicationResponse(in char id, in android.hardware.wifi.NanStatus status); + oneway void notifyTerminatePairingResponse(in char id, in android.hardware.wifi.NanStatus status); } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl index 9a4c050b58..43027353da 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl @@ -64,20 +64,20 @@ interface IWifiStaIface { void setDtimMultiplier(in int multiplier); @Backing(type="int") @VintfStability enum StaIfaceCapabilityMask { - APF = (1 << 0), - BACKGROUND_SCAN = (1 << 1), - LINK_LAYER_STATS = (1 << 2), - RSSI_MONITOR = (1 << 3), - CONTROL_ROAMING = (1 << 4), - PROBE_IE_ALLOWLIST = (1 << 5), - SCAN_RAND = (1 << 6), - STA_5G = (1 << 7), - HOTSPOT = (1 << 8), - PNO = (1 << 9), - TDLS = (1 << 10), - TDLS_OFFCHANNEL = (1 << 11), - ND_OFFLOAD = (1 << 12), - KEEP_ALIVE = (1 << 13), - DEBUG_PACKET_FATE = (1 << 14), + APF = (1 << 0) /* 1 */, + BACKGROUND_SCAN = (1 << 1) /* 2 */, + LINK_LAYER_STATS = (1 << 2) /* 4 */, + RSSI_MONITOR = (1 << 3) /* 8 */, + CONTROL_ROAMING = (1 << 4) /* 16 */, + PROBE_IE_ALLOWLIST = (1 << 5) /* 32 */, + SCAN_RAND = (1 << 6) /* 64 */, + STA_5G = (1 << 7) /* 128 */, + HOTSPOT = (1 << 8) /* 256 */, + PNO = (1 << 9) /* 512 */, + TDLS = (1 << 10) /* 1024 */, + TDLS_OFFCHANNEL = (1 << 11) /* 2048 */, + ND_OFFLOAD = (1 << 12) /* 4096 */, + KEEP_ALIVE = (1 << 13) /* 8192 */, + DEBUG_PACKET_FATE = (1 << 14) /* 16384 */, } } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingConfirmInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingConfirmInd.aidl index 65e85af505..5ab8dcd213 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingConfirmInd.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingConfirmInd.aidl @@ -35,6 +35,8 @@ package android.hardware.wifi; @VintfStability parcelable NanBootstrappingConfirmInd { int bootstrappingInstanceId; - boolean acceptRequest; + android.hardware.wifi.NanBootstrappingResponseCode responseCode; android.hardware.wifi.NanStatus reasonCode; + int comeBackDelay; + byte[] cookie; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingMethod.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingMethod.aidl index 150453404e..6ff62b2f52 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingMethod.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingMethod.aidl @@ -34,15 +34,15 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum NanBootstrappingMethod { - BOOTSTRAPPING_OPPORTUNISTIC_MASK = (1 << 0), - BOOTSTRAPPING_PIN_CODE_DISPLAY_MASK = (1 << 1), - BOOTSTRAPPING_PASSPHRASE_DISPLAY_MASK = (1 << 2), - BOOTSTRAPPING_QR_DISPLAY_MASK = (1 << 3), - BOOTSTRAPPING_NFC_TAG_MASK = (1 << 4), - BOOTSTRAPPING_PIN_CODE_KEYPAD_MASK = (1 << 5), - BOOTSTRAPPING_PASSPHRASE_KEYPAD_MASK = (1 << 6), - BOOTSTRAPPING_QR_SCAN_MASK = (1 << 7), - BOOTSTRAPPING_NFC_READER_MASK = (1 << 8), - BOOTSTRAPPING_SERVICE_MANAGED_MASK = (1 << 14), - BOOTSTRAPPING_HANDSHAKE_SHIP_MASK = (1 << 15), + BOOTSTRAPPING_OPPORTUNISTIC_MASK = (1 << 0) /* 1 */, + BOOTSTRAPPING_PIN_CODE_DISPLAY_MASK = (1 << 1) /* 2 */, + BOOTSTRAPPING_PASSPHRASE_DISPLAY_MASK = (1 << 2) /* 4 */, + BOOTSTRAPPING_QR_DISPLAY_MASK = (1 << 3) /* 8 */, + BOOTSTRAPPING_NFC_TAG_MASK = (1 << 4) /* 16 */, + BOOTSTRAPPING_PIN_CODE_KEYPAD_MASK = (1 << 5) /* 32 */, + BOOTSTRAPPING_PASSPHRASE_KEYPAD_MASK = (1 << 6) /* 64 */, + BOOTSTRAPPING_QR_SCAN_MASK = (1 << 7) /* 128 */, + BOOTSTRAPPING_NFC_READER_MASK = (1 << 8) /* 256 */, + BOOTSTRAPPING_SERVICE_MANAGED_MASK = (1 << 14) /* 16384 */, + BOOTSTRAPPING_HANDSHAKE_SHIP_MASK = (1 << 15) /* 32768 */, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingRequest.aidl index 2be8924306..dd0a5ede2f 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingRequest.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingRequest.aidl @@ -37,4 +37,5 @@ parcelable NanBootstrappingRequest { int peerId; byte[6] peerDiscMacAddr; android.hardware.wifi.NanBootstrappingMethod requestBootstrappingMethod; + byte[] cookie; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingResponseCode.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingResponseCode.aidl new file mode 100644 index 0000000000..a3e9e4d2ae --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanBootstrappingResponseCode.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum NanBootstrappingResponseCode { + NAN_BOOTSTRAPPING_REQUEST_ACCEPT = 0, + NAN_BOOTSTRAPPING_REQUEST_REJECT, + NAN_BOOTSTRAPPING_REQUEST_COMEBACK, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCipherSuiteType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCipherSuiteType.aidl index e98122ddfb..d1149c4a47 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCipherSuiteType.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCipherSuiteType.aidl @@ -35,8 +35,10 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum NanCipherSuiteType { NONE = 0, - SHARED_KEY_128_MASK = (1 << 0), - SHARED_KEY_256_MASK = (1 << 1), - PUBLIC_KEY_128_MASK = (1 << 2), - PUBLIC_KEY_256_MASK = (1 << 3), + SHARED_KEY_128_MASK = (1 << 0) /* 1 */, + SHARED_KEY_256_MASK = (1 << 1) /* 2 */, + PUBLIC_KEY_2WDH_128_MASK = (1 << 2) /* 4 */, + PUBLIC_KEY_2WDH_256_MASK = (1 << 3) /* 8 */, + PUBLIC_KEY_PASN_128_MASK = (1 << 4) /* 16 */, + PUBLIC_KEY_PASN_256_MASK = (1 << 5) /* 32 */, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingSecurityConfig.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingSecurityConfig.aidl index 45af25dfe2..1a6a13c550 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingSecurityConfig.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanPairingSecurityConfig.aidl @@ -38,4 +38,5 @@ parcelable NanPairingSecurityConfig { byte[32] pmk; byte[] passphrase; android.hardware.wifi.NanPairingAkm akm; + android.hardware.wifi.NanCipherSuiteType cipherType; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRangingIndication.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRangingIndication.aidl index 4d33c10451..cf72dcea23 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRangingIndication.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRangingIndication.aidl @@ -34,7 +34,7 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum NanRangingIndication { - CONTINUOUS_INDICATION_MASK = (1 << 0), - INGRESS_MET_MASK = (1 << 1), - EGRESS_MET_MASK = (1 << 2), + CONTINUOUS_INDICATION_MASK = (1 << 0) /* 1 */, + INGRESS_MET_MASK = (1 << 1) /* 2 */, + EGRESS_MET_MASK = (1 << 2) /* 4 */, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NpkSecurityAssociation.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NpkSecurityAssociation.aidl index c5587163a0..508e92009d 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NpkSecurityAssociation.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NpkSecurityAssociation.aidl @@ -38,4 +38,5 @@ parcelable NpkSecurityAssociation { byte[16] localNanIdentityKey; byte[32] npk; android.hardware.wifi.NanPairingAkm akm; + android.hardware.wifi.NanCipherSuiteType cipherType; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaBackgroundScanBucketEventReportSchemeMask.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaBackgroundScanBucketEventReportSchemeMask.aidl index 93e337e97a..249d87622a 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaBackgroundScanBucketEventReportSchemeMask.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaBackgroundScanBucketEventReportSchemeMask.aidl @@ -34,7 +34,7 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum StaBackgroundScanBucketEventReportSchemeMask { - EACH_SCAN = (1 << 0), - FULL_RESULTS = (1 << 1), - NO_BATCH = (1 << 2), + EACH_SCAN = (1 << 0) /* 1 */, + FULL_RESULTS = (1 << 1) /* 2 */, + NO_BATCH = (1 << 2) /* 4 */, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaScanDataFlagMask.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaScanDataFlagMask.aidl index fbd2d75570..0ca4b4b41c 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaScanDataFlagMask.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaScanDataFlagMask.aidl @@ -34,5 +34,5 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum StaScanDataFlagMask { - INTERRUPTED = (1 << 0), + INTERRUPTED = (1 << 0) /* 1 */, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChannelWidthInMhz.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChannelWidthInMhz.aidl index 22327e5795..e6ea642db6 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChannelWidthInMhz.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChannelWidthInMhz.aidl @@ -34,7 +34,7 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum WifiChannelWidthInMhz { - WIDTH_INVALID = (-1), + WIDTH_INVALID = (-1) /* -1 */, WIDTH_20 = 0, WIDTH_40 = 1, WIDTH_80 = 2, diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiDebugRingBufferFlags.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiDebugRingBufferFlags.aidl index 9eac85d57d..9ababc373d 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiDebugRingBufferFlags.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiDebugRingBufferFlags.aidl @@ -34,7 +34,7 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum WifiDebugRingBufferFlags { - HAS_BINARY_ENTRIES = (1 << 0), - HAS_ASCII_ENTRIES = (1 << 1), - HAS_PER_PACKET_ENTRIES = (1 << 2), + HAS_BINARY_ENTRIES = (1 << 0) /* 1 */, + HAS_ASCII_ENTRIES = (1 << 1) /* 2 */, + HAS_PER_PACKET_ENTRIES = (1 << 2) /* 4 */, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiIfaceMode.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiIfaceMode.aidl index 2ac0c2dbc2..557cef4c77 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiIfaceMode.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiIfaceMode.aidl @@ -34,12 +34,12 @@ package android.hardware.wifi; @Backing(type="int") @VintfStability enum WifiIfaceMode { - IFACE_MODE_STA = (1 << 0), - IFACE_MODE_SOFTAP = (1 << 1), - IFACE_MODE_IBSS = (1 << 2), - IFACE_MODE_P2P_CLIENT = (1 << 3), - IFACE_MODE_P2P_GO = (1 << 4), - IFACE_MODE_NAN = (1 << 5), - IFACE_MODE_MESH = (1 << 6), - IFACE_MODE_TDLS = (1 << 7), + IFACE_MODE_STA = (1 << 0) /* 1 */, + IFACE_MODE_SOFTAP = (1 << 1) /* 2 */, + IFACE_MODE_IBSS = (1 << 2) /* 4 */, + IFACE_MODE_P2P_CLIENT = (1 << 3) /* 8 */, + IFACE_MODE_P2P_GO = (1 << 4) /* 16 */, + IFACE_MODE_NAN = (1 << 5) /* 32 */, + IFACE_MODE_MESH = (1 << 6) /* 64 */, + IFACE_MODE_TDLS = (1 << 7) /* 128 */, } diff --git a/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl b/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl index 870c3d8b5a..5f3ce6c620 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl @@ -336,4 +336,16 @@ interface IWifiNanIface { * |WifiStatusCode.ERROR_UNKNOWN| */ void respondToBootstrappingIndicationRequest(in char cmdId, in NanBootstrappingResponse msg); + + /** + * Aware pairing termination request. Executed by either the Initiator or Responder. + * Asynchronous response is with |IWifiNanIfaceEventCallback.notifyTerminatePairingResponse|. + * + * @param cmdId Command Id to use for this invocation. + * @param pairingInstanceId Pairing instance ID to be terminated. + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, + * |WifiStatusCode.ERROR_UNKNOWN| + */ + void terminatePairingRequest(in char cmdId, in int pairingInstanceId); } diff --git a/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl b/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl index 3fd37a7d57..edca1d551a 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl @@ -440,4 +440,18 @@ oneway interface IWifiNanIfaceEventCallback { * |NanStatusCode.INVALID_NDP_ID| */ void notifyRespondToBootstrappingIndicationResponse(in char id, in NanStatus status); + + /** + * Callback invoked in response to a terminate pairing request + * |IWifiNanIface.terminatePairingRequest|. + * + * @param id Command Id corresponding to the original request. + * @param status NanStatus of the operation. Possible status codes are: + * |NanStatusCode.SUCCESS| + * |NanStatusCode.INVALID_ARGS| + * |NanStatusCode.INTERNAL_FAILURE| + * |NanStatusCode.PROTOCOL_FAILURE| + * |NanStatusCode.INVALID_PAIRING_ID| + */ + void notifyTerminatePairingResponse(in char id, in NanStatus status); } diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl index 5a539eed2f..7d7a436b9e 100644 --- a/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl +++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl @@ -17,6 +17,7 @@ package android.hardware.wifi; import android.hardware.wifi.NanBootstrappingMethod; +import android.hardware.wifi.NanBootstrappingResponseCode; import android.hardware.wifi.NanStatus; @VintfStability @@ -30,10 +31,20 @@ parcelable NanBootstrappingConfirmInd { /** * Indicate whether the bootstrapping method negotiation accept or not */ - boolean acceptRequest; + NanBootstrappingResponseCode responseCode; /** * Failure reason if |acceptRequest| is false. */ NanStatus reasonCode; + + /** + * The delay of bootstrapping in seconds for the follow up request. + */ + int comeBackDelay; + + /** + * Cookie received from the comeback response. + */ + byte[] cookie; } diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl index d553245e0b..5297b9fda8 100644 --- a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl +++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl @@ -37,4 +37,9 @@ parcelable NanBootstrappingRequest { * Bootstrapping method in the request, one of the |NanBootstrappingMethod| */ NanBootstrappingMethod requestBootstrappingMethod; + + /** + * Cookie for the follow up request + */ + byte[] cookie; } diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingResponseCode.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingResponseCode.aidl new file mode 100644 index 0000000000..17076bf77b --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingResponseCode.aidl @@ -0,0 +1,28 @@ +/* + * 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.hardware.wifi; + +/** + * Response code from peer NAN Bootstrapping request + */ +@VintfStability +@Backing(type="int") +enum NanBootstrappingResponseCode { + NAN_BOOTSTRAPPING_REQUEST_ACCEPT = 0, + NAN_BOOTSTRAPPING_REQUEST_REJECT, + NAN_BOOTSTRAPPING_REQUEST_COMEBACK, +} diff --git a/wifi/aidl/android/hardware/wifi/NanCipherSuiteType.aidl b/wifi/aidl/android/hardware/wifi/NanCipherSuiteType.aidl index 9e3d684a9d..0d2fc99b2a 100644 --- a/wifi/aidl/android/hardware/wifi/NanCipherSuiteType.aidl +++ b/wifi/aidl/android/hardware/wifi/NanCipherSuiteType.aidl @@ -17,7 +17,7 @@ package android.hardware.wifi; /** - * Cipher suite flags. + * Cipher suite flags. Wi-Fi Aware Specification 4.0 section 7.1.2 */ @VintfStability @Backing(type="int") @@ -26,11 +26,19 @@ enum NanCipherSuiteType { SHARED_KEY_128_MASK = 1 << 0, SHARED_KEY_256_MASK = 1 << 1, /** - * NCS-PK-128 + * NCS-PK-2WDH-128 */ - PUBLIC_KEY_128_MASK = 1 << 2, + PUBLIC_KEY_2WDH_128_MASK = 1 << 2, /** - * NCS-PK-256 + * NCS-PK-2WDH-256 */ - PUBLIC_KEY_256_MASK = 1 << 3, + PUBLIC_KEY_2WDH_256_MASK = 1 << 3, + /** + * NCS-PK-PASN-128 + */ + PUBLIC_KEY_PASN_128_MASK = 1 << 4, + /** + * NCS-PK-PASN-256 + */ + PUBLIC_KEY_PASN_256_MASK = 1 << 5, } diff --git a/wifi/aidl/android/hardware/wifi/NanPairingSecurityConfig.aidl b/wifi/aidl/android/hardware/wifi/NanPairingSecurityConfig.aidl index 273c07e5b7..7384e1a495 100644 --- a/wifi/aidl/android/hardware/wifi/NanPairingSecurityConfig.aidl +++ b/wifi/aidl/android/hardware/wifi/NanPairingSecurityConfig.aidl @@ -16,6 +16,7 @@ package android.hardware.wifi; +import android.hardware.wifi.NanCipherSuiteType; import android.hardware.wifi.NanPairingAkm; import android.hardware.wifi.NanPairingSecurityType; @@ -47,4 +48,9 @@ parcelable NanPairingSecurityConfig { * The AKM for key exchange */ NanPairingAkm akm; + /** + * Cipher type for pairing. Need to be one of the |NanCipherSuiteType.PUBLIC_KEY_PASN_128_MASK| + * or |NanCipherSuiteType.PUBLIC_KEY_PASN_256_MASK| + */ + NanCipherSuiteType cipherType; } diff --git a/wifi/aidl/android/hardware/wifi/NpkSecurityAssociation.aidl b/wifi/aidl/android/hardware/wifi/NpkSecurityAssociation.aidl index 42612c05ec..32e84098d4 100644 --- a/wifi/aidl/android/hardware/wifi/NpkSecurityAssociation.aidl +++ b/wifi/aidl/android/hardware/wifi/NpkSecurityAssociation.aidl @@ -16,6 +16,7 @@ package android.hardware.wifi; +import android.hardware.wifi.NanCipherSuiteType; import android.hardware.wifi.NanPairingAkm; /** @@ -39,4 +40,9 @@ parcelable NpkSecurityAssociation { * The AKM is used for key exchange in this security sssociation */ NanPairingAkm akm; + /** + * Cipher type for pairing. Need to one of the |NanCipherSuiteType.PUBLIC_KEY_PASN_128_MASK| or + * |NanCipherSuiteType.PUBLIC_KEY_PASN_256_MASK| + */ + NanCipherSuiteType cipherType; } diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index 8463eac82a..2d745dcbd3 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -1250,7 +1250,7 @@ NanPairingRequestType convertLegacyNanPairingRequestTypeToAidl( LOG(FATAL); } -legacy_hal::Akm convertAidlAkmTypeToLegacy(NanPairingAkm type) { +legacy_hal::NanAkm convertAidlAkmTypeToLegacy(NanPairingAkm type) { switch (type) { case NanPairingAkm::SAE: return legacy_hal::SAE; @@ -1260,7 +1260,7 @@ legacy_hal::Akm convertAidlAkmTypeToLegacy(NanPairingAkm type) { LOG(FATAL); } -NanPairingAkm convertLegacyAkmTypeToAidl(legacy_hal::Akm type) { +NanPairingAkm convertLegacyAkmTypeToAidl(legacy_hal::NanAkm type) { switch (type) { case legacy_hal::SAE: return NanPairingAkm::SAE; @@ -1384,6 +1384,7 @@ bool convertLegacyNpsaToAidl(const legacy_hal::NpkSecurityAssociation& legacy_np aidl_npsa->npk = std::array(); std::copy(legacy_npsa.npk.pmk, legacy_npsa.npk.pmk + 32, std::begin(aidl_npsa->npk)); aidl_npsa->akm = convertLegacyAkmTypeToAidl(legacy_npsa.akm); + aidl_npsa->cipherType = (NanCipherSuiteType)legacy_npsa.cipher_type; return true; } @@ -3070,6 +3071,7 @@ bool convertAidlNanPairingInitiatorRequestToLegacy(const NanPairingRequest& aidl aidl_request.securityConfig.securityType == NanPairingSecurityType::OPPORTUNISTIC ? 1 : 0; legacy_request->akm = convertAidlAkmTypeToLegacy(aidl_request.securityConfig.akm); + legacy_request->cipher_type = (unsigned int)aidl_request.securityConfig.cipherType; if (aidl_request.securityConfig.securityType == NanPairingSecurityType::PMK) { legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; legacy_request->key_info.body.pmk_info.pmk_len = aidl_request.securityConfig.pmk.size(); @@ -3127,6 +3129,7 @@ bool convertAidlNanPairingIndicationResponseToLegacy( aidl_request.securityConfig.securityType == NanPairingSecurityType::OPPORTUNISTIC ? 1 : 0; legacy_request->akm = convertAidlAkmTypeToLegacy(aidl_request.securityConfig.akm); + legacy_request->cipher_type = (unsigned int)aidl_request.securityConfig.cipherType; legacy_request->rsp_code = aidl_request.acceptRequest ? NAN_PAIRING_REQUEST_ACCEPT : NAN_PAIRING_REQUEST_REJECT; if (aidl_request.securityConfig.securityType == NanPairingSecurityType::PMK) { @@ -3178,6 +3181,9 @@ bool convertAidlNanBootstrappingInitiatorRequestToLegacy( memcpy(legacy_request->peer_disc_mac_addr, aidl_request.peerDiscMacAddr.data(), 6); legacy_request->request_bootstrapping_method = convertAidlBootstrappingMethodToLegacy(aidl_request.requestBootstrappingMethod); + legacy_request->cookie_length = aidl_request.cookie.size(); + + memcpy(legacy_request->cookie, aidl_request.cookie.data(), legacy_request->cookie_length); return true; } @@ -3272,8 +3278,11 @@ bool convertLegacyNanBootstrappingConfirmIndToAidl( *aidl_ind = {}; aidl_ind->bootstrappingInstanceId = legacy_ind.bootstrapping_instance_id; - aidl_ind->acceptRequest = legacy_ind.rsp_code == NAN_BOOTSTRAPPING_REQUEST_ACCEPT; + aidl_ind->responseCode = static_cast(legacy_ind.rsp_code); aidl_ind->reasonCode.status = convertLegacyNanStatusTypeToAidl(legacy_ind.reason_code); + aidl_ind->comeBackDelay = legacy_ind.come_back_delay; + aidl_ind->cookie = + std::vector(legacy_ind.cookie, legacy_ind.cookie + legacy_ind.cookie_length); return true; } diff --git a/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp b/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp index 878c29bcaa..fc58c3e879 100644 --- a/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp +++ b/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp @@ -136,6 +136,7 @@ class MockNanIfaceEventCallback : public IWifiNanIfaceEventCallback { ndk::ScopedAStatus(char16_t, const NanStatus&)); MOCK_METHOD2(notifySuspendResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); MOCK_METHOD2(notifyResumeResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD2(notifyTerminatePairingResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); }; class WifiNanIfaceTest : public Test { diff --git a/wifi/aidl/default/wifi_legacy_hal.cpp b/wifi/aidl/default/wifi_legacy_hal.cpp index 43a71cc074..6436fb71f6 100644 --- a/wifi/aidl/default/wifi_legacy_hal.cpp +++ b/wifi/aidl/default/wifi_legacy_hal.cpp @@ -1559,6 +1559,15 @@ wifi_error WifiLegacyHal::nanDataEnd(const std::string& iface_name, transaction_ return status; } +wifi_error WifiLegacyHal::nanPairingEnd(const std::string& iface_name, transaction_id id, + uint32_t pairingId) { + NanPairingEndRequest msg; + msg.pairing_instance_id = pairingId; + wifi_error status = + global_func_table_.wifi_nan_pairing_end(id, getIfaceHandle(iface_name), &msg); + return status; +} + wifi_error WifiLegacyHal::nanSuspendRequest(const std::string& iface_name, transaction_id id, const NanSuspendRequest& msg) { NanSuspendRequest msg_internal(msg); diff --git a/wifi/aidl/default/wifi_legacy_hal.h b/wifi/aidl/default/wifi_legacy_hal.h index a066ea6083..468d8d7d08 100644 --- a/wifi/aidl/default/wifi_legacy_hal.h +++ b/wifi/aidl/default/wifi_legacy_hal.h @@ -36,7 +36,6 @@ namespace wifi { namespace legacy_hal { // Import all the types defined inside the legacy HAL header files into this // namespace. -using ::Akm; using ::chre_nan_rtt_state; using ::frame_info; using ::frame_type; @@ -68,6 +67,7 @@ using ::NAN_GET_CAPABILITIES; using ::NAN_MATCH_ALG_MATCH_CONTINUOUS; using ::NAN_MATCH_ALG_MATCH_NEVER; using ::NAN_MATCH_ALG_MATCH_ONCE; +using ::NAN_PAIRING_END; using ::NAN_PAIRING_INITIATOR_RESPONSE; using ::NAN_PAIRING_RESPONDER_RESPONSE; using ::NAN_PAIRING_SETUP; @@ -125,6 +125,7 @@ using ::NAN_TX_PRIORITY_NORMAL; using ::NAN_TX_TYPE_BROADCAST; using ::NAN_TX_TYPE_UNICAST; using ::NAN_USE_SRF; +using ::NanAkm; using ::NanBeaconSdfPayloadInd; using ::NanBootstrappingConfirmInd; using ::NanBootstrappingIndicationResponse; @@ -152,6 +153,7 @@ using ::NanMatchExpiredInd; using ::NanMatchInd; using ::NanPairingConfig; using ::NanPairingConfirmInd; +using ::NanPairingEndRequest; using ::NanPairingIndicationResponse; using ::NanPairingRequest; using ::NanPairingRequestInd; @@ -703,6 +705,7 @@ class WifiLegacyHal { wifi_error nanBootstrappingIndicationResponse(const std::string& iface_name, transaction_id id, const NanBootstrappingIndicationResponse& msg); wifi_error nanDataEnd(const std::string& iface_name, transaction_id id, uint32_t ndpInstanceId); + wifi_error nanPairingEnd(const std::string& iface_name, transaction_id id, uint32_t pairingId); wifi_error nanSuspendRequest(const std::string& iface_name, transaction_id id, const NanSuspendRequest& msg); wifi_error nanResumeRequest(const std::string& iface_name, transaction_id id, diff --git a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp index fa87772ef3..42743dffbb 100644 --- a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp +++ b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp @@ -131,6 +131,7 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { populateStubFor(&hal_fn->wifi_nan_bootstrapping_request); populateStubFor(&hal_fn->wifi_nan_bootstrapping_indication_response); populateStubFor(&hal_fn->wifi_nan_data_end); + populateStubFor(&hal_fn->wifi_nan_pairing_end); populateStubFor(&hal_fn->wifi_get_packet_filter_capabilities); populateStubFor(&hal_fn->wifi_set_packet_filter); populateStubFor(&hal_fn->wifi_read_packet_filter); diff --git a/wifi/aidl/default/wifi_nan_iface.cpp b/wifi/aidl/default/wifi_nan_iface.cpp index 7138e41031..0d538033be 100644 --- a/wifi/aidl/default/wifi_nan_iface.cpp +++ b/wifi/aidl/default/wifi_nan_iface.cpp @@ -224,6 +224,14 @@ void WifiNanIface::registerCallbackHandlers() { } break; } + case legacy_hal::NAN_PAIRING_END: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyTerminatePairingResponse(id, nanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } case legacy_hal::NAN_BOOTSTRAPPING_INITIATOR_RESPONSE: { for (const auto& callback : shared_ptr_this->getEventCallbacks()) { if (!callback->notifyInitiateBootstrappingResponse( @@ -743,6 +751,13 @@ ndk::ScopedAStatus WifiNanIface::respondToPairingIndicationRequest( in_msg); } +ndk::ScopedAStatus WifiNanIface::terminatePairingRequest(char16_t in_cmdId, + int32_t in_ndpInstanceId) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, + &WifiNanIface::terminatePairingRequestInternal, in_cmdId, + in_ndpInstanceId); +} + ndk::ScopedAStatus WifiNanIface::initiateBootstrappingRequest( char16_t in_cmdId, const NanBootstrappingRequest& in_msg) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, @@ -919,6 +934,12 @@ ndk::ScopedAStatus WifiNanIface::respondToPairingIndicationRequestInternal( legacy_hal_.lock()->nanPairingIndicationResponse(ifname_, cmd_id, legacy_msg); return createWifiStatusFromLegacyError(legacy_status); } +ndk::ScopedAStatus WifiNanIface::terminatePairingRequestInternal(char16_t cmd_id, + int32_t ndpInstanceId) { + legacy_hal::wifi_error legacy_status = + legacy_hal_.lock()->nanPairingEnd(ifname_, cmd_id, ndpInstanceId); + return createWifiStatusFromLegacyError(legacy_status); +} ndk::ScopedAStatus WifiNanIface::initiateBootstrappingRequestInternal( char16_t cmd_id, const NanBootstrappingRequest& msg) { legacy_hal::NanBootstrappingRequest legacy_msg; diff --git a/wifi/aidl/default/wifi_nan_iface.h b/wifi/aidl/default/wifi_nan_iface.h index 3b93c28435..a49ae8c8c3 100644 --- a/wifi/aidl/default/wifi_nan_iface.h +++ b/wifi/aidl/default/wifi_nan_iface.h @@ -82,6 +82,7 @@ class WifiNanIface : public BnWifiNanIface { const NanPairingRequest& in_msg) override; ndk::ScopedAStatus respondToPairingIndicationRequest( char16_t in_cmdId, const NanRespondToPairingIndicationRequest& in_msg) override; + ndk::ScopedAStatus terminatePairingRequest(char16_t in_cmdId, int32_t in_pairingId) override; ndk::ScopedAStatus initiateBootstrappingRequest(char16_t in_cmdId, const NanBootstrappingRequest& in_msg) override; ndk::ScopedAStatus respondToBootstrappingIndicationRequest( @@ -125,6 +126,7 @@ class WifiNanIface : public BnWifiNanIface { const NanPairingRequest& msg); ndk::ScopedAStatus respondToPairingIndicationRequestInternal( char16_t cmd_id, const NanRespondToPairingIndicationRequest& msg); + ndk::ScopedAStatus terminatePairingRequestInternal(char16_t cmd_id, int32_t pairingId); ndk::ScopedAStatus initiateBootstrappingRequestInternal(char16_t cmd_id, const NanBootstrappingRequest& msg); ndk::ScopedAStatus respondToBootstrappingIndicationRequestInternal( diff --git a/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp index ae5040f498..d2c3235bc8 100644 --- a/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp +++ b/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp @@ -106,6 +106,7 @@ class WifiNanIfaceAidlTest : public testing::TestWithParam { NOTIFY_RESPOND_TO_BOOTSTRAPPING_INDICATION_RESPONSE, NOTIFY_SUSPEND_RESPONSE, NOTIFY_RESUME_RESPONSE, + NOTIFY_TERMINATE_PAIRING_RESPONSE, EVENT_CLUSTER_EVENT, EVENT_DISABLED, @@ -416,6 +417,14 @@ class WifiNanIfaceAidlTest : public testing::TestWithParam { parent_.notify(); return ndk::ScopedAStatus::ok(); } + ::ndk::ScopedAStatus notifyTerminatePairingResponse(char16_t id, + const NanStatus& status) override { + parent_.callback_type_ = NOTIFY_TERMINATE_PAIRING_RESPONSE; + parent_.id_ = id; + parent_.status_ = status; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } private: WifiNanIfaceAidlTest& parent_; From dec38700bbd06c1a5f52875e2cff1b54c0b23505 Mon Sep 17 00:00:00 2001 From: Ye Jiao Date: Fri, 10 Feb 2023 11:37:58 +0800 Subject: [PATCH 726/998] Fix multi-link llstat parsing in wifi legacy hal Multi-link llstat parsing codes in wifi legacy hal, specifically 'copyLinkStat' and 'copyPeerInfo', pass the output container parameter 'std::vector<>' by value instead of by reference. The result is the copied 'LinkStats' list and 'WifiPeerInfo' list are discarded when 'copyLinkStat' and 'copyPeerInfo' return. The empty links list are passed to framework and fails validity check in Wi-Fi framework and leads to system server crash. Fix this issue by passing 'stats' and 'peers' by reference. Bug: 269049672 Test: Manual Test with multi-link llstat implementation integrated Change-Id: If8c366213af2ffcb9f7b3c904e1541ed0ac2fea4 --- wifi/aidl/default/wifi_legacy_hal.cpp | 4 ++-- wifi/aidl/default/wifi_legacy_hal.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wifi/aidl/default/wifi_legacy_hal.cpp b/wifi/aidl/default/wifi_legacy_hal.cpp index 43a71cc074..5e64b85e05 100644 --- a/wifi/aidl/default/wifi_legacy_hal.cpp +++ b/wifi/aidl/default/wifi_legacy_hal.cpp @@ -745,7 +745,7 @@ wifi_error WifiLegacyHal::disableLinkLayerStats(const std::string& iface_name) { // Copies wifi_peer_info* to vector and returns poiner to next element. wifi_peer_info* WifiLegacyHal::copyPeerInfo(wifi_peer_info* peer_ptr, - std::vector peers) { + std::vector& peers) { WifiPeerInfo peer; peer.peer_info = *peer_ptr; if (peer_ptr->num_rate > 0) { @@ -761,7 +761,7 @@ wifi_peer_info* WifiLegacyHal::copyPeerInfo(wifi_peer_info* peer_ptr, } // Copies wifi_link_stat* to vector and returns poiner to next element. wifi_link_stat* WifiLegacyHal::copyLinkStat(wifi_link_stat* stat_ptr, - std::vector stats) { + std::vector& stats) { LinkStats linkStat; linkStat.stat = *stat_ptr; wifi_peer_info* l_peer_info_stats_ptr = stat_ptr->peer_info; diff --git a/wifi/aidl/default/wifi_legacy_hal.h b/wifi/aidl/default/wifi_legacy_hal.h index a066ea6083..146359dc67 100644 --- a/wifi/aidl/default/wifi_legacy_hal.h +++ b/wifi/aidl/default/wifi_legacy_hal.h @@ -782,8 +782,8 @@ class WifiLegacyHal { // Handles wifi (error) status of Virtual interface create/delete wifi_error handleVirtualInterfaceCreateOrDeleteStatus(const std::string& ifname, wifi_error status); - wifi_link_stat* copyLinkStat(wifi_link_stat* stat_ptr, std::vector stats); - wifi_peer_info* copyPeerInfo(wifi_peer_info* peer_ptr, std::vector peers); + wifi_link_stat* copyLinkStat(wifi_link_stat* stat_ptr, std::vector& stats); + wifi_peer_info* copyPeerInfo(wifi_peer_info* peer_ptr, std::vector& peers); // Global function table of legacy HAL. wifi_hal_fn global_func_table_; From 78d76ea43f2f1471c6076a77714e3cd559763543 Mon Sep 17 00:00:00 2001 From: Alec Mouri Date: Mon, 30 Jan 2023 22:09:42 +0000 Subject: [PATCH 727/998] Check the correct sysprop for P010 support for gralloc 3 and 4. We need to check the first api level that the vendor shipped with. Also check P010 support in the preamble of the relevant test rather than in allocate(), since otherwise either allocate() may incorrectly skip some tests or allocate() may succeed but with the wrong layout information. Bug: 257442231 Test: VtsHalGraphicsMapperV4_0TargetTest Change-Id: I00ae5aa01117704158c38f0689e91df99473e208 --- graphics/mapper/3.0/utils/vts/MapperVts.cpp | 6 +----- .../vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp | 4 ++++ graphics/mapper/4.0/utils/vts/MapperVts.cpp | 6 +----- .../vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp | 5 +++++ 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/graphics/mapper/3.0/utils/vts/MapperVts.cpp b/graphics/mapper/3.0/utils/vts/MapperVts.cpp index c470a4aca0..48e5736f8d 100644 --- a/graphics/mapper/3.0/utils/vts/MapperVts.cpp +++ b/graphics/mapper/3.0/utils/vts/MapperVts.cpp @@ -99,11 +99,7 @@ std::vector Gralloc::allocate(const BufferDescriptor& de descriptor, count, [&](const auto& tmpError, const auto& tmpStride, const auto& tmpBuffers) { if (tmpError != Error::NONE) { - if (base::GetIntProperty("ro.vendor.build.version.sdk", 0, 0, INT_MAX) < 33) { - GTEST_SKIP() << "Old vendor grallocs may not support P010"; - } else { - GTEST_FAIL() << "failed to allocate buffers"; - } + GTEST_FAIL() << "failed to allocate buffers"; } ASSERT_EQ(count, tmpBuffers.size()) << "invalid buffer array"; diff --git a/graphics/mapper/3.0/vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp b/graphics/mapper/3.0/vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp index 3b1bfab867..997af97807 100644 --- a/graphics/mapper/3.0/vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp +++ b/graphics/mapper/3.0/vts/functional/VtsHalGraphicsMapperV3_0TargetTest.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -330,6 +331,9 @@ TEST_P(GraphicsMapperHidlTest, LockUnlockBasic) { * Test IMapper::lockYCbCr. This locks a YCbCr_P010 buffer and verifies that it's initialized. */ TEST_P(GraphicsMapperHidlTest, LockYCbCrP010) { + if (base::GetIntProperty("ro.vendor.api_level", __ANDROID_API_FUTURE__) < __ANDROID_API_T__) { + GTEST_SKIP() << "Old vendor grallocs may not support P010"; + } auto info = mDummyDescriptorInfo; info.format = PixelFormat::YCBCR_P010; diff --git a/graphics/mapper/4.0/utils/vts/MapperVts.cpp b/graphics/mapper/4.0/utils/vts/MapperVts.cpp index c6c9834eaf..d70c6ef0c9 100644 --- a/graphics/mapper/4.0/utils/vts/MapperVts.cpp +++ b/graphics/mapper/4.0/utils/vts/MapperVts.cpp @@ -111,11 +111,7 @@ std::vector Gralloc::allocate(const BufferDescriptor& de } if (error != Error::NONE) { - if (base::GetIntProperty("ro.vendor.build.version.sdk", 0, 0, INT_MAX) < 33) { - GTEST_SKIP() << "Old vendor grallocs may not support P010"; - } else { - GTEST_FAIL() << "failed to allocate buffers"; - } + GTEST_FAIL() << "failed to allocate buffers"; } ASSERT_EQ(count, buffers.size()) << "invalid buffer array"; diff --git a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp index 1e7cb8ef4c..e4a84e1caf 100644 --- a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp +++ b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp @@ -29,12 +29,14 @@ #include #include +#include #include #include #include #include #include #include + #include #include @@ -998,6 +1000,9 @@ TEST_P(GraphicsMapperHidlTest, Lock_RAW12) { } TEST_P(GraphicsMapperHidlTest, Lock_YCBCR_P010) { + if (base::GetIntProperty("ro.vendor.api_level", __ANDROID_API_FUTURE__) < __ANDROID_API_T__) { + GTEST_SKIP() << "Old vendor grallocs may not support P010"; + } auto info = mDummyDescriptorInfo; info.format = PixelFormat::YCBCR_P010; From 5d3928d622ea48548a99d7d982faae5fd428d7d6 Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Fri, 10 Feb 2023 20:59:26 +0000 Subject: [PATCH 728/998] wifi: Add BSSID of the AP in PMKSA cache added event Deprecated onPmkCacheAdded() callback function and added a new onPmkSaCacheAdded() callback function to include the connected AP BSSID. This will help framework to include BSSID information as a key to store PMKSA. Bug: 260042356 Test: atest vts Test: Manual - Tested WPA3 STA - AP connection multiple times and confirmed that PMKSA cache is added and supplicant is using the PMKSA cache entries for open authentication. Change-Id: I9fc7da7f4ba60e45ddeee9a41654c74f128fe3d6 --- .../ISupplicantStaIfaceCallback.aidl | 4 ++ .../wifi/supplicant/PmkSaCacheData.aidl | 40 +++++++++++++++++++ .../ISupplicantStaIfaceCallback.aidl | 11 +++++ .../wifi/supplicant/PmkSaCacheData.aidl | 37 +++++++++++++++++ .../supplicant_sta_iface_aidl_test.cpp | 5 +++ 5 files changed, 97 insertions(+) create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/PmkSaCacheData.aidl create mode 100644 wifi/supplicant/aidl/android/hardware/wifi/supplicant/PmkSaCacheData.aidl diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl index cabe167fa0..1c232237ea 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl @@ -59,6 +59,9 @@ interface ISupplicantStaIfaceCallback { oneway void onNetworkAdded(in int id); oneway void onNetworkNotFound(in byte[] ssid); oneway void onNetworkRemoved(in int id); + /** + * @deprecated use onPmkSaCacheAdded() instead. + */ oneway void onPmkCacheAdded(in long expirationTimeInSec, in byte[] serializedEntry); /** * @deprecated This callback is deprecated from AIDL v2, newer HAL should call onSupplicantStateChanged() @@ -75,6 +78,7 @@ interface ISupplicantStaIfaceCallback { oneway void onBssFrequencyChanged(in int frequencyMhz); oneway void onSupplicantStateChanged(in android.hardware.wifi.supplicant.SupplicantStateChangeData stateChangeData); oneway void onQosPolicyResponseForScs(in android.hardware.wifi.supplicant.QosPolicyScsResponseStatus[] qosPolicyScsResponseStatus); + oneway void onPmkSaCacheAdded(in android.hardware.wifi.supplicant.PmkSaCacheData pmkSaData); @Backing(type="int") @VintfStability enum MloLinkInfoChangeReason { TID_TO_LINK_MAP = 0, diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/PmkSaCacheData.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/PmkSaCacheData.aidl new file mode 100644 index 0000000000..436d0c0931 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/PmkSaCacheData.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable PmkSaCacheData { + byte[] bssid; + long expirationTimeInSec; + byte[] serializedEntry; +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl index 398bb36499..17a220ddf5 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl @@ -30,6 +30,7 @@ import android.hardware.wifi.supplicant.DppProgressCode; import android.hardware.wifi.supplicant.DppStatusErrorCode; import android.hardware.wifi.supplicant.Hs20AnqpData; import android.hardware.wifi.supplicant.OsuMethod; +import android.hardware.wifi.supplicant.PmkSaCacheData; import android.hardware.wifi.supplicant.QosPolicyData; import android.hardware.wifi.supplicant.QosPolicyScsResponseStatus; import android.hardware.wifi.supplicant.StaIfaceCallbackState; @@ -248,6 +249,8 @@ oneway interface ISupplicantStaIfaceCallback { /** * Indicates pairwise master key (PMK) cache added event. * + * @deprecated use onPmkSaCacheAdded() instead. + * * @param expirationTimeInSec expiration time in seconds * @param serializedEntry is serialized PMK cache entry, the content is * opaque for the framework and depends on the native implementation. @@ -392,4 +395,12 @@ oneway interface ISupplicantStaIfaceCallback { * @param qosPolicyScsResponseStatus[] status for each SCS id. */ void onQosPolicyResponseForScs(in QosPolicyScsResponseStatus[] qosPolicyScsResponseStatus); + + /** + * Indicates pairwise master key (PMK) cache added event. + * + * @param pmkSaData PMKSA cache entry added details. + * + */ + void onPmkSaCacheAdded(in PmkSaCacheData pmkSaData); } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/PmkSaCacheData.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/PmkSaCacheData.aidl new file mode 100644 index 0000000000..bc28ff5335 --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/PmkSaCacheData.aidl @@ -0,0 +1,37 @@ +/* + * 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.hardware.wifi.supplicant; + +/** + * Details of the PMKSA cache entry that was added in supplicant. + */ +@VintfStability +parcelable PmkSaCacheData { + /** + * BSSID of the access point to which the station is associated. + */ + byte[/* 6 */] bssid; + /** + * PMK expiration time in seconds. + */ + long expirationTimeInSec; + /** + * Serialized PMK cache entry. + * The content is opaque for the framework and depends on the native implementation. + */ + byte[] serializedEntry; +} diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp index d0daf96b87..5d00485d57 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp +++ b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp @@ -234,6 +234,11 @@ class SupplicantStaIfaceCallback : public BnSupplicantStaIfaceCallback { override { return ndk::ScopedAStatus::ok(); } + ::ndk::ScopedAStatus onPmkSaCacheAdded( + const ::aidl::android::hardware::wifi::supplicant::PmkSaCacheData& /* pmkSaData */) + override { + return ndk::ScopedAStatus::ok(); + } }; class SupplicantStaIfaceAidlTest : public testing::TestWithParam { From 2565b87478d2884990c46714a2dd7dabcf111650 Mon Sep 17 00:00:00 2001 From: maheshkkv Date: Tue, 14 Feb 2023 13:54:32 -0800 Subject: [PATCH 729/998] Add a maximum MLO association link count Maximum MLO association link count can be an input for MLO scoring logic. If the candidate AP has less number of links to associate, scroring logic can give a weightage to an AP with matching links as station Assumption here is when the environment becomes better, the AP with less score now can be a better choice. Bug: 269336948 Test: m android.hardware.wifi-update-api Change-Id: Iac0c82203c9e1a23637c757f5b92f5b213bb5da6 --- .../current/android/hardware/wifi/WifiChipCapabilities.aidl | 1 + wifi/aidl/android/hardware/wifi/WifiChipCapabilities.aidl | 4 ++++ wifi/aidl/default/aidl_struct_util.cpp | 2 ++ 3 files changed, 7 insertions(+) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChipCapabilities.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChipCapabilities.aidl index f640861101..b5034ea387 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChipCapabilities.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiChipCapabilities.aidl @@ -34,6 +34,7 @@ package android.hardware.wifi; @VintfStability parcelable WifiChipCapabilities { + int maxMloAssociationLinkCount; int maxMloStrLinkCount; int maxConcurrentTdlsSessionCount; } diff --git a/wifi/aidl/android/hardware/wifi/WifiChipCapabilities.aidl b/wifi/aidl/android/hardware/wifi/WifiChipCapabilities.aidl index 4e0578b61c..77b904957e 100644 --- a/wifi/aidl/android/hardware/wifi/WifiChipCapabilities.aidl +++ b/wifi/aidl/android/hardware/wifi/WifiChipCapabilities.aidl @@ -21,6 +21,10 @@ package android.hardware.wifi; */ @VintfStability parcelable WifiChipCapabilities { + /** + * Maximum number of links supported by the chip for MLO association. + */ + int maxMloAssociationLinkCount; /** * Maximum number of Simultaneous Transmit and Receive (STR) links used * in Multi-Link Operation. The maximum number of STR links used can be diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index 8463eac82a..f744ced7f5 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -3281,6 +3281,8 @@ bool convertLegacyWifiChipCapabilitiesToAidl( const legacy_hal::wifi_chip_capabilities& legacy_chip_capabilities, WifiChipCapabilities& aidl_chip_capabilities) { aidl_chip_capabilities.maxMloStrLinkCount = legacy_chip_capabilities.max_mlo_str_link_count; + aidl_chip_capabilities.maxMloAssociationLinkCount = + legacy_chip_capabilities.max_mlo_association_link_count; aidl_chip_capabilities.maxConcurrentTdlsSessionCount = legacy_chip_capabilities.max_concurrent_tdls_session_count; return true; From 6d88bf5b9aed0d3420a82aed26d74e299637afeb Mon Sep 17 00:00:00 2001 From: shrikar Date: Tue, 17 Jan 2023 17:04:21 +0000 Subject: [PATCH 730/998] Added HANDS_ON_DETECTION_DRIVER_STATE to HAL layer Bug: 264946425 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I89ed7c254917eb48b69682b18950c15f60afd2f0 --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../JsonConfigLoader/src/JsonConfigLoader.cpp | 3 ++ .../config/DefaultProperties.json | 18 ++++++++ .../utils/common/include/VehicleHalTypes.h | 1 + .../vehicle/HandsOnDetectionDriverState.aidl | 40 ++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../vehicle/HandsOnDetectionDriverState.aidl | 41 +++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 24 +++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 +++ 12 files changed, 138 insertions(+) create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/HandsOnDetectionDriverState.aidl create mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/HandsOnDetectionDriverState.aidl diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 1d2d910031..72bff22ec2 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -264,6 +264,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyAccess::WRITE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess::READ_WRITE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 613636e81c..7122019748 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -264,6 +264,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index f83f1c260e..2ed889e1a4 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -256,6 +256,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyAccess.WRITE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess.READ_WRITE) ); diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index f0642fe379..de3a8ae13c 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -256,6 +256,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) ); diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index 7531589311..119d1578fc 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -49,6 +49,7 @@ using ::aidl::android::hardware::automotive::vehicle::EvsServiceType; using ::aidl::android::hardware::automotive::vehicle::ForwardCollisionWarningState; using ::aidl::android::hardware::automotive::vehicle::FuelType; using ::aidl::android::hardware::automotive::vehicle::GsrComplianceRequirementType; +using ::aidl::android::hardware::automotive::vehicle::HandsOnDetectionDriverState; using ::aidl::android::hardware::automotive::vehicle::LaneCenteringAssistCommand; using ::aidl::android::hardware::automotive::vehicle::LaneCenteringAssistState; using ::aidl::android::hardware::automotive::vehicle::LaneDepartureWarningState; @@ -230,6 +231,8 @@ JsonValueParser::JsonValueParser() { std::make_unique>(); mConstantParsersByType["CruiseControlCommand"] = std::make_unique>(); + mConstantParsersByType["HandsOnDetectionDriverState"] = + std::make_unique>(); mConstantParsersByType["ErrorState"] = std::make_unique>(); mConstantParsersByType["AutomaticEmergencyBrakingState"] = std::make_unique>(); diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index a0e811579a..71af0e834e 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3215,6 +3215,24 @@ ] } }, + { + "property": "VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE", + "defaultValue": { + "int32Values": [ + "HandsOnDetectionDriverState::HANDS_ON" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "ErrorState::NOT_AVAILABLE_DISABLED", + "HandsOnDetectionDriverState::HANDS_ON", + "HandsOnDetectionDriverState::HANDS_OFF" + ] + } + ] + }, { "property": "VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index 3b26aa6999..e0b9584331 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/HandsOnDetectionDriverState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/HandsOnDetectionDriverState.aidl new file mode 100644 index 0000000000..bb390f2224 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/HandsOnDetectionDriverState.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum HandsOnDetectionDriverState { + OTHER = 0, + HANDS_ON = 1, + HANDS_OFF = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index bbec4bf595..efcfd68c7f 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -262,5 +262,6 @@ enum VehicleProperty { CRUISE_CONTROL_STATE = (((0x1011 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411089 */, CRUISE_CONTROL_COMMAND = (((0x1012 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411090 */, HANDS_ON_DETECTION_ENABLED = (((0x1016 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313942 */, + HANDS_ON_DETECTION_DRIVER_STATE = (((0x1017 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411095 */, DRIVER_ATTENTION_MONITORING_ENABLED = (((0x1019 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313945 */, } diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/HandsOnDetectionDriverState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/HandsOnDetectionDriverState.aidl new file mode 100644 index 0000000000..4a36999ecb --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/HandsOnDetectionDriverState.aidl @@ -0,0 +1,41 @@ +/* + * 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.hardware.automotive.vehicle; + +/** + * Used to enumerate the current driver state of Hands On Detection (HOD). + */ +@VintfStability +@Backing(type="int") +enum HandsOnDetectionDriverState { + /** + * This state is used as an alternative for any HandsOnDetectionDriverState value that is not + * defined in the platform. Ideally, implementations of + * VehicleProperty#HANDS_ON_DETECTION_DRIVER_STATE should not use this state. The framework + * can use this field to remain backwards compatible if HandsOnDetectionDriverState is + * extended to include additional states. + */ + OTHER = 0, + /** + * The system detects that the driver has their hands on the steering wheel. + */ + HANDS_ON = 1, + /** + * The system detects that the driver has their hands off the steering wheel. + */ + HANDS_OFF = 2, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 68a1e324ee..9838489e31 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3946,6 +3946,30 @@ enum VehicleProperty { HANDS_ON_DETECTION_ENABLED = 0x1016 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Hands on detection (HOD) driver state. + * + * Returns whether the driver's hands are on the steering wheel. Generally, this property should + * return a valid state defined in the HandsOnDetectionDriverState or ErrorState. For example, + * if the feature is not available due to some temporary state, that information should be + * conveyed through ErrorState. + * + * If the vehicle wants to send a warning to the user because the driver's hands have been off + * the steering wheel for too long, the warning should be surfaced through + * HANDS_ON_DETECTION_WARNING. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of both HandsOnDetectionDriverState (including OTHER, which is not + * recommended) and ErrorState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum HandsOnDetectionDriverState + * @data_enum ErrorState + */ + HANDS_ON_DETECTION_DRIVER_STATE = + 0x1017 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** * Enable or disable driver attention monitoring. * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index efbcf47680..8ed79ee777 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -540,6 +540,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionEnabledConfig) { VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionDriverStateConfig) { + verifyProperty(VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverAttentionMonitoringEnabledConfig) { verifyProperty(VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, From a6785997b3eb569bffcba5323c68b8e2a9d81dae Mon Sep 17 00:00:00 2001 From: shrikar Date: Wed, 18 Jan 2023 23:07:06 +0000 Subject: [PATCH 731/998] Added HANDS_ON_DETECTION_WARNING to HAL layer. Bug: 264946505 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: Idc807524b06e8001a795d63f9ad2f1294a834a0f --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../JsonConfigLoader/src/JsonConfigLoader.cpp | 3 ++ .../config/DefaultProperties.json | 18 ++++++++ .../utils/common/include/VehicleHalTypes.h | 1 + .../vehicle/HandsOnDetectionWarning.aidl | 40 +++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../vehicle/HandsOnDetectionWarning.aidl | 43 +++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 22 ++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 +++ 12 files changed, 138 insertions(+) create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/HandsOnDetectionWarning.aidl create mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/HandsOnDetectionWarning.aidl diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 72bff22ec2..32562572f3 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -265,6 +265,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyAccess::WRITE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess::READ}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess::READ_WRITE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 7122019748..3c7622da89 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -265,6 +265,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 2ed889e1a4..7757ad8ed4 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -257,6 +257,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyAccess.WRITE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess.READ_WRITE) ); diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index de3a8ae13c..2158950d5d 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -257,6 +257,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) ); diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index 119d1578fc..72491647db 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -50,6 +50,7 @@ using ::aidl::android::hardware::automotive::vehicle::ForwardCollisionWarningSta using ::aidl::android::hardware::automotive::vehicle::FuelType; using ::aidl::android::hardware::automotive::vehicle::GsrComplianceRequirementType; using ::aidl::android::hardware::automotive::vehicle::HandsOnDetectionDriverState; +using ::aidl::android::hardware::automotive::vehicle::HandsOnDetectionWarning; using ::aidl::android::hardware::automotive::vehicle::LaneCenteringAssistCommand; using ::aidl::android::hardware::automotive::vehicle::LaneCenteringAssistState; using ::aidl::android::hardware::automotive::vehicle::LaneDepartureWarningState; @@ -233,6 +234,8 @@ JsonValueParser::JsonValueParser() { std::make_unique>(); mConstantParsersByType["HandsOnDetectionDriverState"] = std::make_unique>(); + mConstantParsersByType["HandsOnDetectionWarning"] = + std::make_unique>(); mConstantParsersByType["ErrorState"] = std::make_unique>(); mConstantParsersByType["AutomaticEmergencyBrakingState"] = std::make_unique>(); diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 71af0e834e..606d4d93d1 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3233,6 +3233,24 @@ } ] }, + { + "property": "VehicleProperty::HANDS_ON_DETECTION_WARNING", + "defaultValue": { + "int32Values": [ + "HandsOnDetectionWarning::NO_WARNING" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "ErrorState::NOT_AVAILABLE_DISABLED", + "HandsOnDetectionWarning::NO_WARNING", + "HandsOnDetectionWarning::WARNING" + ] + } + ] + }, { "property": "VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index e0b9584331..f70e028e79 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/HandsOnDetectionWarning.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/HandsOnDetectionWarning.aidl new file mode 100644 index 0000000000..4ea4d1d450 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/HandsOnDetectionWarning.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum HandsOnDetectionWarning { + OTHER = 0, + NO_WARNING = 1, + WARNING = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index efcfd68c7f..782c6aaccc 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -263,5 +263,6 @@ enum VehicleProperty { CRUISE_CONTROL_COMMAND = (((0x1012 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411090 */, HANDS_ON_DETECTION_ENABLED = (((0x1016 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313942 */, HANDS_ON_DETECTION_DRIVER_STATE = (((0x1017 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411095 */, + HANDS_ON_DETECTION_WARNING = (((0x1018 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411096 */, DRIVER_ATTENTION_MONITORING_ENABLED = (((0x1019 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313945 */, } diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/HandsOnDetectionWarning.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/HandsOnDetectionWarning.aidl new file mode 100644 index 0000000000..c1a58ce609 --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/HandsOnDetectionWarning.aidl @@ -0,0 +1,43 @@ +/* + * 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.hardware.automotive.vehicle; + +/** + * Used to enumerate the current warning state of Hands On Detection (HOD). + */ +@VintfStability +@Backing(type="int") +enum HandsOnDetectionWarning { + /** + * This state is used as an alternative for any HandsOnDetectionWarning value that is + * defined in the platform. Ideally, implementations of + * VehicleProperty#HANDS_ON_DETECTION_WARNING should not use this state. The framework + * can use this field to remain backwards compatible if HandsOnDetectionWarning is + * extended to include additional states. + */ + OTHER = 0, + /** + * HOD is enabled and the driver's current safety does not warrant sending a warning. This + * state is independent of whether the driver actually has their hands on or off the wheel. + */ + NO_WARNING = 1, + /** + * HOD is enabled and the driver's hands have been off the wheel for too long a duration, + * and the vehicle is sending a warning to the driver as a consequence of this. + */ + WARNING = 2, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 9838489e31..aa1cc3cdc6 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3970,6 +3970,28 @@ enum VehicleProperty { HANDS_ON_DETECTION_DRIVER_STATE = 0x1017 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** + * Hands on detection (HOD) warning. + * + * Returns whether a warning is being sent to the driver for having their hands off the wheel + * for too long a duration. + * + * Generally, this property should return a valid state defined in HandsOnDetectionWarning or + * ErrorState. For example, if the feature is not available due to some temporary state, that + * information should be conveyed through an ErrorState. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of both HandsOnDetectionWarning (including OTHER, which is not recommended) + * and ErrorState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum HandsOnDetectionWarning + * @data_enum ErrorState + */ + HANDS_ON_DETECTION_WARNING = + 0x1018 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** * Enable or disable driver attention monitoring. * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 8ed79ee777..8e2c900574 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -546,6 +546,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionDriverStateConfi VehicleArea::GLOBAL, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionWarningConfig) { + verifyProperty(VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverAttentionMonitoringEnabledConfig) { verifyProperty(VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, From 39859e91e8aca6f31115ff6a00bc3b3053feec4d Mon Sep 17 00:00:00 2001 From: shrikar Date: Wed, 18 Jan 2023 23:07:06 +0000 Subject: [PATCH 732/998] Added DRIVER_ATTENTION_MONITORING_WARNING to HAL layer. Bug: 264946418 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I7eb6fd0c781c5b4bf500e9d137a74860100f6be4 --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 3 +- .../java/ChangeModeForVehicleProperty.java | 3 +- .../JsonConfigLoader/src/JsonConfigLoader.cpp | 3 ++ .../config/DefaultProperties.json | 18 ++++++++ .../utils/common/include/VehicleHalTypes.h | 1 + .../DriverAttentionMonitoringWarning.aidl | 40 +++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../DriverAttentionMonitoringWarning.aidl | 43 +++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 22 ++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 +++ 12 files changed, 140 insertions(+), 2 deletions(-) create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverAttentionMonitoringWarning.aidl create mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverAttentionMonitoringWarning.aidl diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 32562572f3..24973cdf8a 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -267,6 +267,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess::READ}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::DRIVER_ATTENTION_MONITORING_WARNING, VehiclePropertyAccess::READ}, }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 3c7622da89..660de3c22a 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -267,6 +267,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DRIVER_ATTENTION_MONITORING_WARNING, VehiclePropertyChangeMode::ON_CHANGE}, }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 7757ad8ed4..49fde881b6 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -258,7 +258,8 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess.READ), - Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess.READ_WRITE) + Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_WARNING, VehiclePropertyAccess.READ) ); } diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 2158950d5d..2756307ed9 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -258,7 +258,8 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyChangeMode.ON_CHANGE), - Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE) + Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_WARNING, VehiclePropertyChangeMode.ON_CHANGE) ); } diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index 72491647db..22ad2d42f4 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -41,6 +41,7 @@ using ::aidl::android::hardware::automotive::vehicle::ChangeModeForVehicleProper using ::aidl::android::hardware::automotive::vehicle::CruiseControlCommand; using ::aidl::android::hardware::automotive::vehicle::CruiseControlState; using ::aidl::android::hardware::automotive::vehicle::CruiseControlType; +using ::aidl::android::hardware::automotive::vehicle::DriverAttentionMonitoringWarning; using ::aidl::android::hardware::automotive::vehicle::EmergencyLaneKeepAssistState; using ::aidl::android::hardware::automotive::vehicle::ErrorState; using ::aidl::android::hardware::automotive::vehicle::EvConnectorType; @@ -236,6 +237,8 @@ JsonValueParser::JsonValueParser() { std::make_unique>(); mConstantParsersByType["HandsOnDetectionWarning"] = std::make_unique>(); + mConstantParsersByType["DriverAttentionMonitoringWarning"] = + std::make_unique>(); mConstantParsersByType["ErrorState"] = std::make_unique>(); mConstantParsersByType["AutomaticEmergencyBrakingState"] = std::make_unique>(); diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 606d4d93d1..b003b91bd5 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3259,6 +3259,24 @@ ] } }, + { + "property": "VehicleProperty::DRIVER_ATTENTION_MONITORING_WARNING", + "defaultValue": { + "int32Values": [ + "DriverAttentionMonitoringWarning::NO_WARNING" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "ErrorState::NOT_AVAILABLE_DISABLED", + "DriverAttentionMonitoringWarning::NO_WARNING", + "DriverAttentionMonitoringWarning::WARNING" + ] + } + ] + }, { "property": "VehicleProperty::INITIAL_USER_INFO" }, diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index f70e028e79..7b505ab567 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverAttentionMonitoringWarning.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverAttentionMonitoringWarning.aidl new file mode 100644 index 0000000000..758b251702 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverAttentionMonitoringWarning.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum DriverAttentionMonitoringWarning { + OTHER = 0, + NO_WARNING = 1, + WARNING = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 782c6aaccc..e640955fc7 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -265,4 +265,5 @@ enum VehicleProperty { HANDS_ON_DETECTION_DRIVER_STATE = (((0x1017 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411095 */, HANDS_ON_DETECTION_WARNING = (((0x1018 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411096 */, DRIVER_ATTENTION_MONITORING_ENABLED = (((0x1019 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313945 */, + DRIVER_ATTENTION_MONITORING_WARNING = (((0x101B + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411099 */, } diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverAttentionMonitoringWarning.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverAttentionMonitoringWarning.aidl new file mode 100644 index 0000000000..373dd7f763 --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverAttentionMonitoringWarning.aidl @@ -0,0 +1,43 @@ +/* + * 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.hardware.automotive.vehicle; + +/** + * Used to enumerate the current warning state of Driver Attention Monitoring. + */ +@VintfStability +@Backing(type="int") +enum DriverAttentionMonitoringWarning { + /** + * This state is used as an alternative for any DriverAttentionMonitoringWarning value that is + * defined in the platform. Ideally, implementations of + * VehicleProperty#DRIVER_ATTENTION_MONITORING_WARNING should not use this state. The framework + * can use this field to remain backwards compatible if DriverAttentionMonitoringWarning is + * extended to include additional states. + */ + OTHER = 0, + /** + * Driver Attention Monitoring is enabled and the driver's current state does not warrant + * sending a warning. + */ + NO_WARNING = 1, + /** + * Driver Attention Monitoring is enabled and the driver has been distracted for too long of a + * duration, and the vehicle is sending a warning to the driver as a consequence of this. + */ + WARNING = 2, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index aa1cc3cdc6..189d040409 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -4009,6 +4009,28 @@ enum VehicleProperty { DRIVER_ATTENTION_MONITORING_ENABLED = 0x1019 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Driver attention monitoring warning. + * + * Returns whether a warning is being sent to the driver for being distracted for too long a + * duration. + * + * Generally, this property should return a valid state defined in the + * DriverAttentionMonitoringWarning or ErrorState. For example, if the feature is not available + * due to some temporary state, that information should be conveyed through an ErrorState. + * + * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states of both DriverAttentionMonitoringWarning (including OTHER, which is not + * recommended) and ErrorState are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum DriverAttentionMonitoringWarning + * @data_enum ErrorState + */ + DRIVER_ATTENTION_MONITORING_WARNING = + 0x101B + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /*************************************************************************** * End of ADAS Properties **************************************************************************/ diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 8e2c900574..180470e3ba 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -558,6 +558,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverAttentionMonitoringEnabled VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverAttentionMonitoringWarningConfig) { + verifyProperty(VehicleProperty::DRIVER_ATTENTION_MONITORING_WARNING, + VehiclePropertyAccess::READ, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvBrakeRegenerationLevelConfig) { verifyProperty(VehicleProperty::EV_BRAKE_REGENERATION_LEVEL, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, From 22164c6be5a1c26c0be68aa364ddbc477993faf6 Mon Sep 17 00:00:00 2001 From: shrikar Date: Mon, 6 Feb 2023 16:49:59 +0000 Subject: [PATCH 733/998] Added DRIVER_ATTENTION_MONITORING_STATE to HAL layer. Bug: 264946416 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: Ie68b718d719dc5de050d31f6dd614ce5e9ecb32c --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../JsonConfigLoader/src/JsonConfigLoader.cpp | 3 ++ .../config/DefaultProperties.json | 18 ++++++++ .../utils/common/include/VehicleHalTypes.h | 1 + .../DriverAttentionMonitoringState.aidl | 40 +++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../DriverAttentionMonitoringState.aidl | 43 +++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 23 ++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 +++ 12 files changed, 139 insertions(+) create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverAttentionMonitoringState.aidl create mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverAttentionMonitoringState.aidl diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 24973cdf8a..fbd1a3321d 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -267,6 +267,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess::READ}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::DRIVER_ATTENTION_MONITORING_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_WARNING, VehiclePropertyAccess::READ}, }; diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 660de3c22a..291fa204b9 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -267,6 +267,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::DRIVER_ATTENTION_MONITORING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::DRIVER_ATTENTION_MONITORING_WARNING, VehiclePropertyChangeMode::ON_CHANGE}, }; diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index 49fde881b6..3395458ea6 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -259,6 +259,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_WARNING, VehiclePropertyAccess.READ) ); diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 2756307ed9..e74942f77a 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -259,6 +259,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_WARNING, VehiclePropertyChangeMode.ON_CHANGE) ); diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index 22ad2d42f4..51e5f2ab83 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -41,6 +41,7 @@ using ::aidl::android::hardware::automotive::vehicle::ChangeModeForVehicleProper using ::aidl::android::hardware::automotive::vehicle::CruiseControlCommand; using ::aidl::android::hardware::automotive::vehicle::CruiseControlState; using ::aidl::android::hardware::automotive::vehicle::CruiseControlType; +using ::aidl::android::hardware::automotive::vehicle::DriverAttentionMonitoringState; using ::aidl::android::hardware::automotive::vehicle::DriverAttentionMonitoringWarning; using ::aidl::android::hardware::automotive::vehicle::EmergencyLaneKeepAssistState; using ::aidl::android::hardware::automotive::vehicle::ErrorState; @@ -237,6 +238,8 @@ JsonValueParser::JsonValueParser() { std::make_unique>(); mConstantParsersByType["HandsOnDetectionWarning"] = std::make_unique>(); + mConstantParsersByType["DriverAttentionMonitoringState"] = + std::make_unique>(); mConstantParsersByType["DriverAttentionMonitoringWarning"] = std::make_unique>(); mConstantParsersByType["ErrorState"] = std::make_unique>(); diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index b003b91bd5..5d7c67a477 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3259,6 +3259,24 @@ ] } }, + { + "property": "VehicleProperty::DRIVER_ATTENTION_MONITORING_STATE", + "defaultValue": { + "int32Values": [ + "DriverAttentionMonitoringState::NOT_DISTRACTED" + ] + }, + "areas": [ + { + "areaId": 0, + "supportedEnumValues": [ + "ErrorState::NOT_AVAILABLE_DISABLED", + "DriverAttentionMonitoringState::DISTRACTED", + "DriverAttentionMonitoringState::NOT_DISTRACTED" + ] + } + ] + }, { "property": "VehicleProperty::DRIVER_ATTENTION_MONITORING_WARNING", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index 7b505ab567..7b567abeb7 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverAttentionMonitoringState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverAttentionMonitoringState.aidl new file mode 100644 index 0000000000..925f4474e0 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverAttentionMonitoringState.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum DriverAttentionMonitoringState { + OTHER = 0, + DISTRACTED = 1, + NOT_DISTRACTED = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index e640955fc7..b075993418 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -265,5 +265,6 @@ enum VehicleProperty { HANDS_ON_DETECTION_DRIVER_STATE = (((0x1017 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411095 */, HANDS_ON_DETECTION_WARNING = (((0x1018 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411096 */, DRIVER_ATTENTION_MONITORING_ENABLED = (((0x1019 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313945 */, + DRIVER_ATTENTION_MONITORING_STATE = (((0x101A + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411098 */, DRIVER_ATTENTION_MONITORING_WARNING = (((0x101B + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411099 */, } diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverAttentionMonitoringState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverAttentionMonitoringState.aidl new file mode 100644 index 0000000000..7ebf844274 --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverAttentionMonitoringState.aidl @@ -0,0 +1,43 @@ +/* + * 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.hardware.automotive.vehicle; + +/** + * Used to enumerate the current driver state of Driver Attention Monitoring. + * + * This enum could be extended in future releases to include additional feature states. + */ +@VintfStability +@Backing(type="int") +enum DriverAttentionMonitoringState { + /** + * This state is used as an alternative for any DriverAttentionMonitoringState value that is + * not defined in the platform. Ideally, implementations of + * VehicleProperty#DRIVER_ATTENTION_MONITORING_STATE should not use this state. The + * framework can use this field to remain backwards compatible if DriverAttentionMonitoringState + * is extended to include additional states. + */ + OTHER = 0, + /** + * The system detects that the driver is distracted. + */ + DISTRACTED = 1, + /** + * The system detects that the driver is attentive / not distracted. + */ + NOT_DISTRACTED = 2, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 189d040409..267b3dc26d 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -4009,6 +4009,29 @@ enum VehicleProperty { DRIVER_ATTENTION_MONITORING_ENABLED = 0x1019 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, + /** + * Driver attention monitoring state. + * + * Returns whether the driver is currently attentive or distracted. Generally, this property + * should return a valid state defined in the DriverAttentionMonitoringState or ErrorState. For + * example, if the feature is not available due to some temporary state, that information should + * be conveyed through an ErrorState. + * + * If the vehicle wants to send a warning to the user because the driver has been distracted for + * too long, the warning should be surfaced through DRIVER_ATTENTION_MONITORING_WARNING. + * + * The VehicleAreaConfig#configArray array must define all states from + * DriverAttentionMonitoringState (including OTHER, which is not recommended) and ErrorState + * that are supported. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @data_enum DriverAttentionMonitoringState + * @data_enum ErrorState + */ + DRIVER_ATTENTION_MONITORING_STATE = + 0x101A + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** * Driver attention monitoring warning. * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 180470e3ba..cfed217e67 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -558,6 +558,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverAttentionMonitoringEnabled VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverAttentionMonitoringStateConfig) { + verifyProperty(VehicleProperty::DRIVER_ATTENTION_MONITORING_STATE, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverAttentionMonitoringWarningConfig) { verifyProperty(VehicleProperty::DRIVER_ATTENTION_MONITORING_WARNING, VehiclePropertyAccess::READ, VehiclePropertyChangeMode::ON_CHANGE, From d6cc331b879c92e24137dd4daa384dfc8c1261b7 Mon Sep 17 00:00:00 2001 From: Nate Jiang Date: Tue, 14 Feb 2023 16:37:54 -0800 Subject: [PATCH 734/998] Modify HAL for Aware suspension mode - Add an event to know the device is suspended - More status code - Add pub_sub_id in the datapath request to build the relationship Bug: 247913151 Test: build Change-Id: I77733c1bca821b77fdab7ed1ed03c1e54c9373b2 --- .../wifi/IWifiNanIfaceEventCallback.aidl | 1 + .../wifi/NanInitiateDataPathRequest.aidl | 1 + ...NanRespondToDataPathIndicationRequest.aidl | 1 + .../android/hardware/wifi/NanStatusCode.aidl | 4 +- .../wifi/NanSuspensionModeChangeInd.aidl | 38 +++++++++++++++++++ .../wifi/IWifiNanIfaceEventCallback.aidl | 9 ++++- .../wifi/NanInitiateDataPathRequest.aidl | 5 +++ ...NanRespondToDataPathIndicationRequest.aidl | 5 +++ .../android/hardware/wifi/NanStatusCode.aidl | 14 +++++-- .../wifi/NanSuspensionModeChangeInd.aidl | 28 ++++++++++++++ wifi/aidl/default/aidl_struct_util.cpp | 8 ++++ .../tests/wifi_nan_iface_unit_tests.cpp | 1 + wifi/aidl/default/wifi_legacy_hal.cpp | 14 ++++++- wifi/aidl/default/wifi_legacy_hal.h | 7 ++++ wifi/aidl/default/wifi_nan_iface.cpp | 32 ++++++++++++++++ .../functional/wifi_nan_iface_aidl_test.cpp | 10 +++++ 16 files changed, 172 insertions(+), 6 deletions(-) create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanSuspensionModeChangeInd.aidl create mode 100644 wifi/aidl/android/hardware/wifi/NanSuspensionModeChangeInd.aidl diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl index ed78d35d38..8c443309ee 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl @@ -46,6 +46,7 @@ interface IWifiNanIfaceEventCallback { oneway void eventPublishTerminated(in byte sessionId, in android.hardware.wifi.NanStatus status); oneway void eventSubscribeTerminated(in byte sessionId, in android.hardware.wifi.NanStatus status); oneway void eventTransmitFollowup(in char id, in android.hardware.wifi.NanStatus status); + oneway void eventSuspensionModeChanged(in android.hardware.wifi.NanSuspensionModeChangeInd event); oneway void notifyCapabilitiesResponse(in char id, in android.hardware.wifi.NanStatus status, in android.hardware.wifi.NanCapabilities capabilities); oneway void notifyConfigResponse(in char id, in android.hardware.wifi.NanStatus status); oneway void notifyCreateDataInterfaceResponse(in char id, in android.hardware.wifi.NanStatus status); diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanInitiateDataPathRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanInitiateDataPathRequest.aidl index 697e29a7c8..740a140780 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanInitiateDataPathRequest.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanInitiateDataPathRequest.aidl @@ -42,4 +42,5 @@ parcelable NanInitiateDataPathRequest { android.hardware.wifi.NanDataPathSecurityConfig securityConfig; byte[] appInfo; byte[] serviceNameOutOfBand; + byte discoverySessionId; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRespondToDataPathIndicationRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRespondToDataPathIndicationRequest.aidl index 5542ff62ba..0f873b5ea8 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRespondToDataPathIndicationRequest.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanRespondToDataPathIndicationRequest.aidl @@ -40,4 +40,5 @@ parcelable NanRespondToDataPathIndicationRequest { android.hardware.wifi.NanDataPathSecurityConfig securityConfig; byte[] appInfo; byte[] serviceNameOutOfBand; + byte discoverySessionId; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanStatusCode.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanStatusCode.aidl index 40844cc416..ec12eb0c4c 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanStatusCode.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanStatusCode.aidl @@ -49,5 +49,7 @@ enum NanStatusCode { UNSUPPORTED_CONCURRENCY_NAN_DISABLED = 12, INVALID_PAIRING_ID = 13, INVALID_BOOTSTRAPPING_ID = 14, - INVALID_STATE = 15, + REDUNDANT_REQUEST = 15, + NOT_SUPPORTED = 16, + NO_CONNECTION = 17, } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanSuspensionModeChangeInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanSuspensionModeChangeInd.aidl new file mode 100644 index 0000000000..557fc796d9 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanSuspensionModeChangeInd.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.hardware.wifi; +@VintfStability +parcelable NanSuspensionModeChangeInd { + boolean isSuspended; +} diff --git a/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl b/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl index edca1d551a..8a61a9c812 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl @@ -28,7 +28,7 @@ import android.hardware.wifi.NanMatchInd; import android.hardware.wifi.NanPairingConfirmInd; import android.hardware.wifi.NanPairingRequestInd; import android.hardware.wifi.NanStatus; - +import android.hardware.wifi.NanSuspensionModeChangeInd; /** * NAN Response and Asynchronous Event Callbacks. * @@ -140,6 +140,13 @@ oneway interface IWifiNanIfaceEventCallback { */ void eventTransmitFollowup(in char id, in NanStatus status); + /** + * Callback indicating that device suspension mode status change + * + * @param event NanSuspensionModeChangeInd containing event details. + */ + void eventSuspensionModeChanged(in NanSuspensionModeChangeInd event); + /** * Callback invoked in response to a capability request * |IWifiNanIface.getCapabilitiesRequest|. diff --git a/wifi/aidl/android/hardware/wifi/NanInitiateDataPathRequest.aidl b/wifi/aidl/android/hardware/wifi/NanInitiateDataPathRequest.aidl index 264a873a3e..2f2532929f 100644 --- a/wifi/aidl/android/hardware/wifi/NanInitiateDataPathRequest.aidl +++ b/wifi/aidl/android/hardware/wifi/NanInitiateDataPathRequest.aidl @@ -69,4 +69,9 @@ parcelable NanInitiateDataPathRequest { * NAN Spec: Appendix: Mapping pass-phrase to PMK for NCS-SK Cipher Suites */ byte[] serviceNameOutOfBand; + /** + * ID of an active publish or subscribe discovery session. + * NAN Spec: Service Descriptor Attribute (SDA) / Instance ID + */ + byte discoverySessionId; } diff --git a/wifi/aidl/android/hardware/wifi/NanRespondToDataPathIndicationRequest.aidl b/wifi/aidl/android/hardware/wifi/NanRespondToDataPathIndicationRequest.aidl index 6960e71fba..e543b7bf07 100644 --- a/wifi/aidl/android/hardware/wifi/NanRespondToDataPathIndicationRequest.aidl +++ b/wifi/aidl/android/hardware/wifi/NanRespondToDataPathIndicationRequest.aidl @@ -58,4 +58,9 @@ parcelable NanRespondToDataPathIndicationRequest { * NAN Spec: Appendix: Mapping pass-phrase to PMK for NCS-SK Cipher Suites */ byte[] serviceNameOutOfBand; + /** + * ID of an active publish or subscribe discovery session. + * NAN Spec: Service Descriptor Attribute (SDA) / Instance ID + */ + byte discoverySessionId; } diff --git a/wifi/aidl/android/hardware/wifi/NanStatusCode.aidl b/wifi/aidl/android/hardware/wifi/NanStatusCode.aidl index d609797131..6706839aa4 100644 --- a/wifi/aidl/android/hardware/wifi/NanStatusCode.aidl +++ b/wifi/aidl/android/hardware/wifi/NanStatusCode.aidl @@ -79,8 +79,16 @@ enum NanStatusCode { * If the bootstrapping id is invalid */ INVALID_BOOTSTRAPPING_ID = 14, - /** - * If the system is not in a valid state for the given request. + /* + * If same request is received again */ - INVALID_STATE = 15 + REDUNDANT_REQUEST = 15, + /* + * If current request is not supported + */ + NOT_SUPPORTED = 16, + /* + * If no Wifi Aware connection is active + */ + NO_CONNECTION = 17 } diff --git a/wifi/aidl/android/hardware/wifi/NanSuspensionModeChangeInd.aidl b/wifi/aidl/android/hardware/wifi/NanSuspensionModeChangeInd.aidl new file mode 100644 index 0000000000..afabe8c496 --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/NanSuspensionModeChangeInd.aidl @@ -0,0 +1,28 @@ +/* + * 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.hardware.wifi; + +/** + * Event indication that the device entered or exited the suspension mode + */ +@VintfStability +parcelable NanSuspensionModeChangeInd { + /** + * Indication whether the device has entered or existed the NAN suspension mode(deep sleep) + */ + boolean isSuspended; +} diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index 2d745dcbd3..876ff75ef2 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -1420,6 +1420,12 @@ NanStatusCode convertLegacyNanStatusTypeToAidl(legacy_hal::NanStatusType type) { return NanStatusCode::INVALID_PAIRING_ID; case legacy_hal::NAN_STATUS_INVALID_BOOTSTRAPPING_ID: return NanStatusCode::INVALID_BOOTSTRAPPING_ID; + case legacy_hal::NAN_STATUS_REDUNDANT_REQUEST: + return NanStatusCode::REDUNDANT_REQUEST; + case legacy_hal::NAN_STATUS_NOT_SUPPORTED: + return NanStatusCode::NOT_SUPPORTED; + case legacy_hal::NAN_STATUS_NO_CONNECTION: + return NanStatusCode::NO_CONNECTION; } CHECK(false); } @@ -2090,6 +2096,7 @@ bool convertAidlNanDataPathInitiatorRequestToLegacy( return false; } memcpy(legacy_request->scid, aidl_request.securityConfig.scid.data(), legacy_request->scid_len); + legacy_request->publish_subscribe_id = static_cast(aidl_request.discoverySessionId); return true; } @@ -2171,6 +2178,7 @@ bool convertAidlNanDataPathIndicationResponseToLegacy( return false; } memcpy(legacy_request->scid, aidl_request.securityConfig.scid.data(), legacy_request->scid_len); + legacy_request->publish_subscribe_id = static_cast(aidl_request.discoverySessionId); return true; } diff --git a/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp b/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp index fc58c3e879..d58a9b0ace 100644 --- a/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp +++ b/wifi/aidl/default/tests/wifi_nan_iface_unit_tests.cpp @@ -137,6 +137,7 @@ class MockNanIfaceEventCallback : public IWifiNanIfaceEventCallback { MOCK_METHOD2(notifySuspendResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); MOCK_METHOD2(notifyResumeResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); MOCK_METHOD2(notifyTerminatePairingResponse, ndk::ScopedAStatus(char16_t, const NanStatus&)); + MOCK_METHOD1(eventSuspensionModeChanged, ndk::ScopedAStatus(const NanSuspensionModeChangeInd&)); }; class WifiNanIfaceTest : public Test { diff --git a/wifi/aidl/default/wifi_legacy_hal.cpp b/wifi/aidl/default/wifi_legacy_hal.cpp index 6436fb71f6..796098db2a 100644 --- a/wifi/aidl/default/wifi_legacy_hal.cpp +++ b/wifi/aidl/default/wifi_legacy_hal.cpp @@ -351,6 +351,15 @@ void onAsyncNanEventScheduleUpdate(NanDataPathScheduleUpdateInd* event) { } } +std::function + on_nan_event_suspension_mode_change_user_callback; +void onAsyncNanEventSuspensionModeChange(NanSuspensionModeChangeInd* event) { + const auto lock = aidl_sync_util::acquireGlobalLock(); + if (on_nan_event_suspension_mode_change_user_callback && event) { + on_nan_event_suspension_mode_change_user_callback(*event); + } +} + std::function on_nan_event_pairing_request_user_callback; void onAsyncNanEventPairingRequest(NanPairingRequestInd* event) { const auto lock = aidl_sync_util::acquireGlobalLock(); @@ -1376,6 +1385,8 @@ wifi_error WifiLegacyHal::nanRegisterCallbackHandlers(const std::string& iface_n on_nan_event_range_request_user_callback = user_callbacks.on_event_range_request; on_nan_event_range_report_user_callback = user_callbacks.on_event_range_report; on_nan_event_schedule_update_user_callback = user_callbacks.on_event_schedule_update; + on_nan_event_suspension_mode_change_user_callback = + user_callbacks.on_event_suspension_mode_change; return global_func_table_.wifi_nan_register_handler(getIfaceHandle(iface_name), {onAsyncNanNotifyResponse, @@ -1399,7 +1410,8 @@ wifi_error WifiLegacyHal::nanRegisterCallbackHandlers(const std::string& iface_n onAsyncNanEventPairingRequest, onAsyncNanEventPairingConfirm, onAsyncNanEventBootstrappingRequest, - onAsyncNanEventBootstrappingConfirm}); + onAsyncNanEventBootstrappingConfirm, + onAsyncNanEventSuspensionModeChange}); } wifi_error WifiLegacyHal::nanEnableRequest(const std::string& iface_name, transaction_id id, diff --git a/wifi/aidl/default/wifi_legacy_hal.h b/wifi/aidl/default/wifi_legacy_hal.h index 468d8d7d08..85a8ac4fc3 100644 --- a/wifi/aidl/default/wifi_legacy_hal.h +++ b/wifi/aidl/default/wifi_legacy_hal.h @@ -91,6 +91,7 @@ using ::NAN_RESPONSE_SUBSCRIBE; using ::NAN_RESPONSE_SUBSCRIBE_CANCEL; using ::NAN_RESPONSE_TCA; using ::NAN_RESPONSE_TRANSMIT_FOLLOWUP; +using ::NAN_RESUME_REQUEST_RESPONSE; using ::NAN_SECURITY_KEY_INPUT_PASSPHRASE; using ::NAN_SECURITY_KEY_INPUT_PMK; using ::NAN_SERVICE_ACCEPT_POLICY_ALL; @@ -111,13 +112,17 @@ using ::NAN_STATUS_INVALID_PARAM; using ::NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID; using ::NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID; using ::NAN_STATUS_NAN_NOT_ALLOWED; +using ::NAN_STATUS_NO_CONNECTION; using ::NAN_STATUS_NO_OTA_ACK; using ::NAN_STATUS_NO_RESOURCE_AVAILABLE; +using ::NAN_STATUS_NOT_SUPPORTED; using ::NAN_STATUS_PROTOCOL_FAILURE; +using ::NAN_STATUS_REDUNDANT_REQUEST; using ::NAN_STATUS_SUCCESS; using ::NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED; using ::NAN_SUBSCRIBE_TYPE_ACTIVE; using ::NAN_SUBSCRIBE_TYPE_PASSIVE; +using ::NAN_SUSPEND_REQUEST_RESPONSE; using ::NAN_TRANSMIT_IN_DW; using ::NAN_TRANSMIT_IN_FAW; using ::NAN_TX_PRIORITY_HIGH; @@ -175,6 +180,7 @@ using ::NanSubscribeRequest; using ::NanSubscribeTerminatedInd; using ::NanSubscribeType; using ::NanSuspendRequest; +using ::NanSuspensionModeChangeInd; using ::NanTransmitFollowupInd; using ::NanTransmitFollowupRequest; using ::NanTxType; @@ -452,6 +458,7 @@ struct NanCallbackHandlers { std::function on_event_pairing_confirm; std::function on_event_bootstrapping_request; std::function on_event_bootstrapping_confirm; + std::function on_event_suspension_mode_change; }; // Full scan results contain IE info and are hence passed by reference, to diff --git a/wifi/aidl/default/wifi_nan_iface.cpp b/wifi/aidl/default/wifi_nan_iface.cpp index 0d538033be..8e3a191b7a 100644 --- a/wifi/aidl/default/wifi_nan_iface.cpp +++ b/wifi/aidl/default/wifi_nan_iface.cpp @@ -253,6 +253,22 @@ void WifiNanIface::registerCallbackHandlers() { } break; } + case legacy_hal::NAN_SUSPEND_REQUEST_RESPONSE: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifySuspendResponse(id, nanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } + case legacy_hal::NAN_RESUME_REQUEST_RESPONSE: { + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->notifyResumeResponse(id, nanStatus).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + break; + } case legacy_hal::NAN_RESPONSE_BEACON_SDF_PAYLOAD: /* fall through */ case legacy_hal::NAN_RESPONSE_TCA: @@ -581,6 +597,22 @@ void WifiNanIface::registerCallbackHandlers() { } } }; + callback_handlers.on_event_suspension_mode_change = + [weak_ptr_this](const legacy_hal::NanSuspensionModeChangeInd& msg) { + const auto shared_ptr_this = weak_ptr_this.lock(); + if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { + LOG(ERROR) << "Callback invoked on an invalid object"; + return; + } + NanSuspensionModeChangeInd aidl_struct; + aidl_struct.isSuspended = msg.is_suspended; + + for (const auto& callback : shared_ptr_this->getEventCallbacks()) { + if (!callback->eventSuspensionModeChanged(aidl_struct).isOk()) { + LOG(ERROR) << "Failed to invoke the callback"; + } + } + }; legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->nanRegisterCallbackHandlers(ifname_, callback_handlers); diff --git a/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp index d2c3235bc8..bebad7ca08 100644 --- a/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp +++ b/wifi/aidl/vts/functional/wifi_nan_iface_aidl_test.cpp @@ -55,6 +55,7 @@ using aidl::android::hardware::wifi::NanPublishType; using aidl::android::hardware::wifi::NanRespondToDataPathIndicationRequest; using aidl::android::hardware::wifi::NanStatus; using aidl::android::hardware::wifi::NanStatusCode; +using aidl::android::hardware::wifi::NanSuspensionModeChangeInd; using aidl::android::hardware::wifi::NanTxType; #define TIMEOUT_PERIOD 10 @@ -124,6 +125,7 @@ class WifiNanIfaceAidlTest : public testing::TestWithParam { EVENT_PAIRING_CONFIRM, EVENT_BOOTSTRAPPING_REQUEST, EVENT_BOOTSTRAPPING_CONFIRM, + EVENT_SUSPENSION_MODE_CHANGE, }; // Test code calls this function to wait for data/event callback. @@ -255,6 +257,13 @@ class WifiNanIfaceAidlTest : public testing::TestWithParam { parent_.notify(); return ndk::ScopedAStatus::ok(); } + ::ndk::ScopedAStatus eventSuspensionModeChanged( + const NanSuspensionModeChangeInd& event) override { + parent_.callback_type_ = EVENT_SUSPENSION_MODE_CHANGE; + parent_.nan_suspension_mode_change_ind_ = event; + parent_.notify(); + return ndk::ScopedAStatus::ok(); + } ::ndk::ScopedAStatus notifyCapabilitiesResponse( char16_t id, const NanStatus& status, const NanCapabilities& capabilities) override { @@ -451,6 +460,7 @@ class WifiNanIfaceAidlTest : public testing::TestWithParam { NanPairingConfirmInd nan_pairing_confirm_ind_; NanBootstrappingRequestInd nan_bootstrapping_request_ind_; NanBootstrappingConfirmInd nan_bootstrapping_confirm_ind_; + NanSuspensionModeChangeInd nan_suspension_mode_change_ind_; const char* getInstanceName() { return GetParam().c_str(); } From 08a8a722ddb4062cd9e14c8950a08aaaf5ca9ae5 Mon Sep 17 00:00:00 2001 From: Changyeon Jo Date: Mon, 13 Feb 2023 20:04:44 -0800 Subject: [PATCH 735/998] Add APIs for the sensor embedded data To make the sensor embedded data available to EVS clients, this change adds new fields to BufferDesc and declare necessary data types. Bug: 191939108 Test: build Change-Id: Iaa41554e49c7ff30c11d391b00eae12dfef9e99b --- .../hardware/automotive/evs/BufferDesc.aidl | 4 ++ .../hardware/automotive/evs/CameraParam.aidl | 24 +++++----- .../hardware/automotive/evs/ColorChannel.aidl | 41 ++++++++++++++++ .../automotive/evs/DeviceStatusType.aidl | 8 ++-- .../hardware/automotive/evs/DisplayState.aidl | 8 ++-- .../hardware/automotive/evs/EmbeddedData.aidl | 40 ++++++++++++++++ .../hardware/automotive/evs/EvsEventType.aidl | 12 ++--- .../hardware/automotive/evs/EvsResult.aidl | 20 ++++---- .../automotive/evs/ExposureParameters.aidl | 42 ++++++++++++++++ .../automotive/evs/GridStatisticDesc.aidl | 42 ++++++++++++++++ .../automotive/evs/GridStatisticType.aidl | 41 ++++++++++++++++ .../automotive/evs/GridStatistics.aidl | 39 +++++++++++++++ .../hardware/automotive/evs/Histogram.aidl | 42 ++++++++++++++++ .../android/hardware/automotive/evs/Size.aidl | 39 +++++++++++++++ .../hardware/automotive/evs/BufferDesc.aidl | 29 +++++++++++ .../hardware/automotive/evs/ColorChannel.aidl | 32 +++++++++++++ .../hardware/automotive/evs/EmbeddedData.aidl | 34 +++++++++++++ .../automotive/evs/ExposureParameters.aidl | 48 +++++++++++++++++++ .../automotive/evs/GridStatisticDesc.aidl | 39 +++++++++++++++ .../automotive/evs/GridStatisticType.aidl | 33 +++++++++++++ .../automotive/evs/GridStatistics.aidl | 39 +++++++++++++++ .../hardware/automotive/evs/Histogram.aidl | 48 +++++++++++++++++++ .../android/hardware/automotive/evs/Size.aidl | 28 +++++++++++ 23 files changed, 696 insertions(+), 36 deletions(-) create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/ColorChannel.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/EmbeddedData.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/ExposureParameters.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/GridStatisticDesc.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/GridStatisticType.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/GridStatistics.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/Histogram.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/Size.aidl create mode 100644 automotive/evs/aidl/android/hardware/automotive/evs/ColorChannel.aidl create mode 100644 automotive/evs/aidl/android/hardware/automotive/evs/EmbeddedData.aidl create mode 100644 automotive/evs/aidl/android/hardware/automotive/evs/ExposureParameters.aidl create mode 100644 automotive/evs/aidl/android/hardware/automotive/evs/GridStatisticDesc.aidl create mode 100644 automotive/evs/aidl/android/hardware/automotive/evs/GridStatisticType.aidl create mode 100644 automotive/evs/aidl/android/hardware/automotive/evs/GridStatistics.aidl create mode 100644 automotive/evs/aidl/android/hardware/automotive/evs/Histogram.aidl create mode 100644 automotive/evs/aidl/android/hardware/automotive/evs/Size.aidl diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/BufferDesc.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/BufferDesc.aidl index 31acdb8e27..332aca34a6 100644 --- a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/BufferDesc.aidl +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/BufferDesc.aidl @@ -40,4 +40,8 @@ parcelable BufferDesc { @utf8InCpp String deviceId; long timestamp; byte[] metadata; + @nullable android.hardware.automotive.evs.ExposureParameters[] exposureSettings; + @nullable android.hardware.automotive.evs.Histogram[] histograms; + @nullable android.hardware.automotive.evs.GridStatistics[] grids; + @nullable android.hardware.automotive.evs.EmbeddedData embeddedData; } diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/CameraParam.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/CameraParam.aidl index ae4ce77192..21207b348a 100644 --- a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/CameraParam.aidl +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/CameraParam.aidl @@ -34,16 +34,16 @@ package android.hardware.automotive.evs; @Backing(type="int") @VintfStability enum CameraParam { - BRIGHTNESS = 0, - CONTRAST = 1, - AUTOGAIN = 2, - GAIN = 3, - AUTO_WHITE_BALANCE = 4, - WHITE_BALANCE_TEMPERATURE = 5, - SHARPNESS = 6, - AUTO_EXPOSURE = 7, - ABSOLUTE_EXPOSURE = 8, - ABSOLUTE_FOCUS = 9, - AUTO_FOCUS = 10, - ABSOLUTE_ZOOM = 11, + BRIGHTNESS, + CONTRAST, + AUTOGAIN, + GAIN, + AUTO_WHITE_BALANCE, + WHITE_BALANCE_TEMPERATURE, + SHARPNESS, + AUTO_EXPOSURE, + ABSOLUTE_EXPOSURE, + ABSOLUTE_FOCUS, + AUTO_FOCUS, + ABSOLUTE_ZOOM, } diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/ColorChannel.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/ColorChannel.aidl new file mode 100644 index 0000000000..e59db4cee2 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/ColorChannel.aidl @@ -0,0 +1,41 @@ +/* + * 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 -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.hardware.automotive.evs; +@Backing(type="int") @VintfStability +enum ColorChannel { + R, + G_EVEN, + B, + G_ODD_OR_Y, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/DeviceStatusType.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/DeviceStatusType.aidl index d0f1d8e1d6..92c2247019 100644 --- a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/DeviceStatusType.aidl +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/DeviceStatusType.aidl @@ -34,8 +34,8 @@ package android.hardware.automotive.evs; @Backing(type="int") @VintfStability enum DeviceStatusType { - CAMERA_AVAILABLE = 0, - CAMERA_NOT_AVAILABLE = 1, - DISPLAY_AVAILABLE = 2, - DISPLAY_NOT_AVAILABLE = 3, + CAMERA_AVAILABLE, + CAMERA_NOT_AVAILABLE, + DISPLAY_AVAILABLE, + DISPLAY_NOT_AVAILABLE, } diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/DisplayState.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/DisplayState.aidl index a5f43095c8..5f03f43e86 100644 --- a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/DisplayState.aidl +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/DisplayState.aidl @@ -35,8 +35,8 @@ package android.hardware.automotive.evs; @Backing(type="int") @VintfStability enum DisplayState { NOT_OPEN = 0, - NOT_VISIBLE = 1, - VISIBLE_ON_NEXT_FRAME = 2, - VISIBLE = 3, - DEAD = 4, + NOT_VISIBLE, + VISIBLE_ON_NEXT_FRAME, + VISIBLE, + DEAD, } diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/EmbeddedData.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/EmbeddedData.aidl new file mode 100644 index 0000000000..e1f50d2e23 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/EmbeddedData.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.automotive.evs; +@VintfStability +parcelable EmbeddedData { + int widthInBytes; + int heightInLines; + android.hardware.common.Ashmem data; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/EvsEventType.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/EvsEventType.aidl index 052a6b3969..2e75a25328 100644 --- a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/EvsEventType.aidl +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/EvsEventType.aidl @@ -35,10 +35,10 @@ package android.hardware.automotive.evs; @Backing(type="int") @VintfStability enum EvsEventType { STREAM_STARTED = 0, - STREAM_STOPPED = 1, - FRAME_DROPPED = 2, - TIMEOUT = 3, - PARAMETER_CHANGED = 4, - MASTER_RELEASED = 5, - STREAM_ERROR = 6, + STREAM_STOPPED, + FRAME_DROPPED, + TIMEOUT, + PARAMETER_CHANGED, + MASTER_RELEASED, + STREAM_ERROR, } diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/EvsResult.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/EvsResult.aidl index a0418a94ef..1f047508e5 100644 --- a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/EvsResult.aidl +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/EvsResult.aidl @@ -35,14 +35,14 @@ package android.hardware.automotive.evs; @Backing(type="int") @VintfStability enum EvsResult { OK = 0, - INVALID_ARG = 1, - STREAM_ALREADY_RUNNING = 2, - BUFFER_NOT_AVAILABLE = 3, - OWNERSHIP_LOST = 4, - UNDERLYING_SERVICE_ERROR = 5, - PERMISSION_DENIED = 6, - RESOURCE_NOT_AVAILABLE = 7, - RESOURCE_BUSY = 8, - NOT_IMPLEMENTED = 9, - NOT_SUPPORTED = 10, + INVALID_ARG, + STREAM_ALREADY_RUNNING, + BUFFER_NOT_AVAILABLE, + OWNERSHIP_LOST, + UNDERLYING_SERVICE_ERROR, + PERMISSION_DENIED, + RESOURCE_NOT_AVAILABLE, + RESOURCE_BUSY, + NOT_IMPLEMENTED, + NOT_SUPPORTED, } diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/ExposureParameters.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/ExposureParameters.aidl new file mode 100644 index 0000000000..28289ae7e9 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/ExposureParameters.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 -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.hardware.automotive.evs; +@VintfStability +parcelable ExposureParameters { + float[4] analogGain; + float[4] digitalGain; + long coarseIntegrationTimeInLines; + long fineIntegrationTimeInPixelClocks; + int coarseIntegrationTimeLShift; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/GridStatisticDesc.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/GridStatisticDesc.aidl new file mode 100644 index 0000000000..f9fadd994f --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/GridStatisticDesc.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 -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.hardware.automotive.evs; +@VintfStability +parcelable GridStatisticDesc { + android.hardware.automotive.evs.ColorChannel channel; + android.hardware.automotive.evs.GridStatisticType type; + android.hardware.graphics.common.Rect roi; + android.hardware.automotive.evs.Size cellSize; + int bitDepth; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/GridStatisticType.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/GridStatisticType.aidl new file mode 100644 index 0000000000..c2b2d66301 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/GridStatisticType.aidl @@ -0,0 +1,41 @@ +/* + * 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 -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.hardware.automotive.evs; +@Backing(type="int") @VintfStability +enum GridStatisticType { + USER_DEFINED, + AVERAGE, + SUM, + SATURATION_COUNT, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/GridStatistics.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/GridStatistics.aidl new file mode 100644 index 0000000000..d87cff3787 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/GridStatistics.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.hardware.automotive.evs; +@VintfStability +parcelable GridStatistics { + android.hardware.automotive.evs.GridStatisticDesc[] descriptors; + android.hardware.common.Ashmem data; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/Histogram.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/Histogram.aidl new file mode 100644 index 0000000000..cb73eba88f --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/Histogram.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 -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.hardware.automotive.evs; +@VintfStability +parcelable Histogram { + android.hardware.automotive.evs.ColorChannel channel; + android.hardware.graphics.common.Rect roi; + int size; + int capacity; + long[] bins; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/Size.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/Size.aidl new file mode 100644 index 0000000000..aa113f7976 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/Size.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.hardware.automotive.evs; +@VintfStability +parcelable Size { + int widthInPixels = (-1) /* -1 */; + int heightInPixels = (-1) /* -1 */; +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/BufferDesc.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/BufferDesc.aidl index 0604abe1dc..b6c697d22b 100644 --- a/automotive/evs/aidl/android/hardware/automotive/evs/BufferDesc.aidl +++ b/automotive/evs/aidl/android/hardware/automotive/evs/BufferDesc.aidl @@ -16,7 +16,12 @@ package android.hardware.automotive.evs; +import android.hardware.automotive.evs.EmbeddedData; +import android.hardware.automotive.evs.ExposureParameters; +import android.hardware.automotive.evs.GridStatistics; +import android.hardware.automotive.evs.Histogram; import android.hardware.graphics.common.HardwareBuffer; +import android.hardware.graphics.common.Rect; /** * Structure representing an image buffer through our APIs @@ -57,4 +62,28 @@ parcelable BufferDesc { * Frame metadata. This is opaque to EvsManager. */ byte[] metadata; + /** + * ExposureParameters are expected to be in the ascending + * order of their exposure time; from the shortest to the + * longest. For example, if the imaging sensor output has + * two exposures, a shorter exposure setting is at index 0 + * and a longer exposure setting is at index 1. + */ + @nullable ExposureParameters[] exposureSettings; + /** + * Histogram statistics calculated on this buffer. This + * may contain zero or more histograms. + */ + @nullable Histogram[] histograms; + /** + * Grid statistics calculated on this buffer. This field + * also may contain zero or more grid statistics. + */ + @nullable GridStatistics[] grids; + /** + * This may contain raw embedded data lines and can be + * used to share data other than exposure parameters, + * histograms, or grid statistics. + */ + @nullable EmbeddedData embeddedData; } diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/ColorChannel.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/ColorChannel.aidl new file mode 100644 index 0000000000..9aba465703 --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/ColorChannel.aidl @@ -0,0 +1,32 @@ +/* + * 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.hardware.automotive.evs; + +/** + * Color channels. + */ +@VintfStability +@Backing(type="int") +enum ColorChannel { + R, + G_EVEN, // The green channel in even lines. + B, + G_ODD_OR_Y, // The green channel in odd lines of + // color formats that have two green (or + // equivalent) channels, or the luminance + // if it exists in associated data. +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/EmbeddedData.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/EmbeddedData.aidl new file mode 100644 index 0000000000..422cef21b1 --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/EmbeddedData.aidl @@ -0,0 +1,34 @@ +/* + * 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.hardware.automotive.evs; + +import android.hardware.common.Ashmem; + +/** + * This structure contains raw embedded data lines and can + * used to share sensor embedded data that is not a type of + * histogram or grid statistics. + */ +@VintfStability +parcelable EmbeddedData { + /** Width of the embedded data lines. */ + int widthInBytes; + /** Number of the embedded data lines. */ + int heightInLines; + /** Raw embedded data lines. */ + Ashmem data; +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/ExposureParameters.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/ExposureParameters.aidl new file mode 100644 index 0000000000..6a85ade94e --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/ExposureParameters.aidl @@ -0,0 +1,48 @@ +/* + * 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.hardware.automotive.evs; + +/** + * Parameters that determine the exposure value. + * + * This data structure assumes that the imaging sensor has 4 channels at most. + */ +@VintfStability +parcelable ExposureParameters { + /** + * Analog gain applied on each channel. + * + * A value for each channel will be indexed by android.hardware.automotive.evs.ColorChannel + * enum type. + */ + float[4] analogGain; + /** + * Digital gain applied on each channel. + * + * A value for each channel will be indexed by android.hardware.automotive.evs.ColorChannel + * enum type. + */ + float[4] digitalGain; + /** Exposure time in lines. */ + long coarseIntegrationTimeInLines; + /** Remainder exposure time in clocks. */ + long fineIntegrationTimeInPixelClocks; + /** + * Logarthm value of coarse integration time multiplier. + */ + int coarseIntegrationTimeLShift; +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/GridStatisticDesc.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/GridStatisticDesc.aidl new file mode 100644 index 0000000000..1cd8a1cf26 --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/GridStatisticDesc.aidl @@ -0,0 +1,39 @@ +/* + * 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.hardware.automotive.evs; + +import android.hardware.automotive.evs.ColorChannel; +import android.hardware.automotive.evs.GridStatisticType; +import android.hardware.automotive.evs.Size; +import android.hardware.graphics.common.Rect; + +/** + * This data structure describes a grid statistic such as the low resolution luminance map. + */ +@VintfStability +parcelable GridStatisticDesc { + /** Source color channel this statistics is calculated from. */ + ColorChannel channel; + /** Type of this grad statistics. */ + GridStatisticType type; + /** Region this statistics is calculated from. */ + Rect roi; + /** Size of a grid cell. */ + Size cellSize; + /** Bit-depth of a single value. */ + int bitDepth; +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/GridStatisticType.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/GridStatisticType.aidl new file mode 100644 index 0000000000..1b307c7e8e --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/GridStatisticType.aidl @@ -0,0 +1,33 @@ +/* + * 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.hardware.automotive.evs; + +/** + * Type of grid statistics. + */ +@VintfStability +@Backing(type="int") +enum GridStatisticType { + /** Custom statistics type. */ + USER_DEFINED, + /** Average pixel values of each cell. */ + AVERAGE, + /** Sum of pixel values in each cell. */ + SUM, + /** Number of saturated pixels in each cell. */ + SATURATION_COUNT, +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/GridStatistics.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/GridStatistics.aidl new file mode 100644 index 0000000000..e66c51eb2e --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/GridStatistics.aidl @@ -0,0 +1,39 @@ +/* + * 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.hardware.automotive.evs; + +import android.hardware.automotive.evs.GridStatisticDesc; +import android.hardware.common.Ashmem; + +/** + * This data type represents grid-type statistics such as + * the luminance map in low-resolution. + */ +@VintfStability +parcelable GridStatistics { + /** */ + GridStatisticDesc[] descriptors; + /** + * Shared memory object containing one or more grid statistics. + * + * When multiple statistics exist, they are in the same order with descriptors. For example, + * if the first descriptor represents a statistic whose size is in VGA resolution (640x480) + * and bitdepth (or precision) is 8-bit, the offset to the second statistic is 640x480x1-byte + * = 307200 bytes. + */ + Ashmem data; +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/Histogram.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/Histogram.aidl new file mode 100644 index 0000000000..3f3c5a30ba --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/Histogram.aidl @@ -0,0 +1,48 @@ +/* + * 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.hardware.automotive.evs; + +import android.hardware.automotive.evs.ColorChannel; +import android.hardware.graphics.common.Rect; + +/** + * This data type represents 1D histogram statistics. + */ +@VintfStability +parcelable Histogram { + /** + * Source color channel this histogram is calculated from. + */ + ColorChannel channel; + /** A region of interests, where this histogram is calculated from. */ + Rect roi; + /** Size of each histogram bin. */ + int size; + /** Capacity of each histogram bin. */ + int capacity; + /** + * Histogram bins; each bin contains values calculated from each ColorChannel. + * + * The size of the histogram data is inversely proportional to the size of a histogram bin. + * When a bin is sized as 1, a histogram has pow(2, bitdepth of the source data) and + * therefore could occupy more than a few kilobytes of 1 megabyte buffer that is shared with + * other processes. To avoid influencing other processes, we strongly recommend keeping the + * number of histogram bins less than 128. If a higher resolution is needed, please consider + * using android.hardware.automotive.evs.EmbeddedData instead. + */ + long[] bins; +} diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/Size.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/Size.aidl new file mode 100644 index 0000000000..4924ec89f9 --- /dev/null +++ b/automotive/evs/aidl/android/hardware/automotive/evs/Size.aidl @@ -0,0 +1,28 @@ +/* + * 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.hardware.automotive.evs; + +/** + * This type represents the size of the 2D area. + */ +@VintfStability +parcelable Size { + /** Width of a target 2D area in pixels. */ + int widthInPixels = -1; + /** Width of a target 2D area in pixels. */ + int heightInPixels = -1; +} From a8aba17891abbfb115e548c4e013e2bed9ddbdde Mon Sep 17 00:00:00 2001 From: maheshkkv Date: Mon, 13 Feb 2023 12:33:26 -0800 Subject: [PATCH 736/998] Add a new AIDL API to set Multi-Link Operation mode Bug: 268235139 Test: m android.hardware.wifi-update-api Change-Id: Iff3baf64cb6c999eca4e1bfa4af5a41cfb5e4876 --- .../android/hardware/wifi/IWifiChip.aidl | 8 +++++ .../aidl/android/hardware/wifi/IWifiChip.aidl | 36 +++++++++++++++++++ wifi/aidl/default/wifi_chip.cpp | 28 +++++++++++++++ wifi/aidl/default/wifi_chip.h | 2 ++ wifi/aidl/default/wifi_legacy_hal.cpp | 4 +++ wifi/aidl/default/wifi_legacy_hal.h | 2 ++ wifi/aidl/default/wifi_legacy_hal_stubs.cpp | 1 + 7 files changed, 81 insertions(+) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl index 6d0ddaa4f3..0e7bb86c49 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl @@ -82,6 +82,7 @@ interface IWifiChip { void stopLoggingToDebugRingBuffer(); void triggerSubsystemRestart(); void enableStaChannelForPeerNetwork(in android.hardware.wifi.IWifiChip.ChannelCategoryMask channelCategoryEnableFlag); + void setMloMode(in android.hardware.wifi.IWifiChip.ChipMloMode mode); const int NO_POWER_CAP_CONSTANT = 0x7FFFFFFF; @Backing(type="int") @VintfStability enum ChipCapabilityMask { @@ -163,4 +164,11 @@ interface IWifiChip { INDOOR_CHANNEL = (1 << 0) /* 1 */, DFS_CHANNEL = (1 << 1) /* 2 */, } + @Backing(type="int") @VintfStability + enum ChipMloMode { + DEFAULT = 0, + LOW_LATENCY = 1, + HIGH_THROUGHPUT = 2, + LOW_POWER = 3, + } } diff --git a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl index 8d415fdc68..3c89e97709 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl @@ -1115,4 +1115,40 @@ interface IWifiChip { * |WifiStatusCode.FAILURE_UNKNOWN| */ void enableStaChannelForPeerNetwork(in ChannelCategoryMask channelCategoryEnableFlag); + + /** + * Multi-Link Operation modes. + */ + @VintfStability + @Backing(type="int") + enum ChipMloMode { + /** + * Default mode for Multi-Link Operation. + */ + DEFAULT = 0, + /** + * Low latency mode for Multi-link operation. + */ + LOW_LATENCY = 1, + /** + * High throughput mode for Multi-link operation. + */ + HIGH_THROUGHPUT = 2, + /** + * Low power mode for Multi-link operation. + */ + LOW_POWER = 3, + } + + /** + * Set mode for Multi-Link Operation. Various modes are defined by the enum |ChipMloMode|. + * + * @param mode MLO mode as defined by the enum |ChipMloMode| + * @throws ServiceSpecificException with one of the following values: + * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, + * |WifiStatusCode.ERROR_NOT_SUPPORTED|, + * |WifiStatusCode.ERROR_UNKNOWN| + * + */ + void setMloMode(in ChipMloMode mode); } diff --git a/wifi/aidl/default/wifi_chip.cpp b/wifi/aidl/default/wifi_chip.cpp index 41912b5d66..b4c2ccdbb9 100644 --- a/wifi/aidl/default/wifi_chip.cpp +++ b/wifi/aidl/default/wifi_chip.cpp @@ -26,6 +26,7 @@ #include "aidl_return_util.h" #include "aidl_struct_util.h" +#include "wifi_legacy_hal.h" #include "wifi_status_util.h" #define P2P_MGMT_DEVICE_PREFIX "p2p-dev-" @@ -699,6 +700,11 @@ ndk::ScopedAStatus WifiChip::enableStaChannelForPeerNetwork( in_channelCategoryEnableFlag); } +ndk::ScopedAStatus WifiChip::setMloMode(const ChipMloMode in_mode) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::setMloModeInternal, in_mode); +} + void WifiChip::invalidateAndRemoveAllIfaces() { invalidateAndClearBridgedApAll(); invalidateAndClearAll(ap_ifaces_); @@ -1956,6 +1962,28 @@ bool WifiChip::findUsingNameFromBridgedApInstances(const std::string& name) { return false; } +ndk::ScopedAStatus WifiChip::setMloModeInternal(const WifiChip::ChipMloMode in_mode) { + legacy_hal::wifi_mlo_mode mode; + switch (in_mode) { + case WifiChip::ChipMloMode::DEFAULT: + mode = legacy_hal::wifi_mlo_mode::WIFI_MLO_MODE_DEFAULT; + break; + case WifiChip::ChipMloMode::LOW_LATENCY: + mode = legacy_hal::wifi_mlo_mode::WIFI_MLO_MODE_LOW_LATENCY; + break; + case WifiChip::ChipMloMode::HIGH_THROUGHPUT: + mode = legacy_hal::wifi_mlo_mode::WIFI_MLO_MODE_HIGH_THROUGHPUT; + break; + case WifiChip::ChipMloMode::LOW_POWER: + mode = legacy_hal::wifi_mlo_mode::WIFI_MLO_MODE_LOW_POWER; + break; + default: + PLOG(ERROR) << "Error: invalid mode: " << toString(in_mode); + return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); + } + return createWifiStatusFromLegacyError(legacy_hal_.lock()->setMloMode(mode)); +} + } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/aidl/default/wifi_chip.h b/wifi/aidl/default/wifi_chip.h index b552c3324e..ff4ee9ce90 100644 --- a/wifi/aidl/default/wifi_chip.h +++ b/wifi/aidl/default/wifi_chip.h @@ -150,6 +150,7 @@ class WifiChip : public BnWifiChip { ndk::ScopedAStatus enableStaChannelForPeerNetwork( ChannelCategoryMask in_channelCategoryEnableFlag) override; binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; + ndk::ScopedAStatus setMloMode(const ChipMloMode in_mode) override; private: void invalidateAndRemoveAllIfaces(); @@ -260,6 +261,7 @@ class WifiChip : public BnWifiChip { std::pair getSupportedRadioCombinationsMatrixInternal(); std::pair getWifiChipCapabilitiesInternal(); + ndk::ScopedAStatus setMloModeInternal(const ChipMloMode in_mode); void setWeakPtr(std::weak_ptr ptr); int32_t chip_id_; diff --git a/wifi/aidl/default/wifi_legacy_hal.cpp b/wifi/aidl/default/wifi_legacy_hal.cpp index 6436fb71f6..4e8321e8a0 100644 --- a/wifi/aidl/default/wifi_legacy_hal.cpp +++ b/wifi/aidl/default/wifi_legacy_hal.cpp @@ -1869,6 +1869,10 @@ wifi_error WifiLegacyHal::enableStaChannelForPeerNetwork(uint32_t channelCategor channelCategoryEnableFlag); } +wifi_error WifiLegacyHal::setMloMode(wifi_mlo_mode mode) { + return global_func_table_.wifi_set_mlo_mode(global_handle_, mode); +} + void WifiLegacyHal::invalidate() { global_handle_ = nullptr; iface_name_to_handle_.clear(); diff --git a/wifi/aidl/default/wifi_legacy_hal.h b/wifi/aidl/default/wifi_legacy_hal.h index 468d8d7d08..6db03245c9 100644 --- a/wifi/aidl/default/wifi_legacy_hal.h +++ b/wifi/aidl/default/wifi_legacy_hal.h @@ -312,6 +312,7 @@ using ::WIFI_LOGGER_MEMORY_DUMP_SUPPORTED; using ::WIFI_LOGGER_PACKET_FATE_SUPPORTED; using ::WIFI_LOGGER_POWER_EVENT_SUPPORTED; using ::WIFI_LOGGER_WAKE_LOCK_SUPPORTED; +using ::wifi_mlo_mode; using ::WIFI_MOTION_EXPECTED; using ::WIFI_MOTION_NOT_EXPECTED; using ::wifi_motion_pattern; @@ -770,6 +771,7 @@ class WifiLegacyHal { const CachedScanResultsCallbackHandlers& handler); std::pair getWifiChipCapabilities(); wifi_error enableStaChannelForPeerNetwork(uint32_t channelCategoryEnableFlag); + wifi_error setMloMode(wifi_mlo_mode mode); private: // Retrieve interface handles for all the available interfaces. diff --git a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp index 42743dffbb..77d1cb5edc 100644 --- a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp +++ b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp @@ -177,6 +177,7 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { populateStubFor(&hal_fn->wifi_nan_suspend_request); populateStubFor(&hal_fn->wifi_nan_resume_request); populateStubFor(&hal_fn->wifi_set_scan_mode); + populateStubFor(&hal_fn->wifi_set_mlo_mode); return true; } From d73e914b879b81cfebfea62e5041b5d838e988c4 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Wed, 15 Feb 2023 20:39:58 +0000 Subject: [PATCH 737/998] Disable Rust backend for FMQ type There are no Rust libraries for FMQ and the aidl compiler does not generate usable code. Test: na Bug: none Change-Id: Ic49f8d38f9313da3494bf1a72c4382c12bbdd726 --- common/fmq/aidl/Android.bp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/common/fmq/aidl/Android.bp b/common/fmq/aidl/Android.bp index 058ddb5f6b..5772b7fa64 100644 --- a/common/fmq/aidl/Android.bp +++ b/common/fmq/aidl/Android.bp @@ -24,9 +24,14 @@ aidl_interface { stability: "vintf", backend: { java: { + // There is no Java FMQ library, but we support the AIDL type + // to allow subsets of interfaces that include it to be used in Java + enabled: true, sdk_version: "module_current", }, cpp: { + // FMQ will not be supported in the cpp backend because the parcelables + // are not stable enough for use in shared memory enabled: false, }, ndk: { @@ -38,8 +43,9 @@ aidl_interface { min_sdk_version: "29", }, rust: { - enabled: true, - } + // FMQ is not supported in the rust backend + enabled: false, + }, }, frozen: true, versions: ["1"], From c37a211ed539159e8e47802502a372c6b9dbd3d4 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Thu, 2 Feb 2023 11:30:08 -0800 Subject: [PATCH 738/998] Add HAL changes for WINDSHIELD_WIPERS_SWITCH Bug: 266986465 Test: atest VtsHalAutomotiveVehicle_TargetTest Test: atest CtsCarTestCases:CarPropertyManagerTest Test: atest CtsCarTestCases:VehiclePropertyIdsTest Test: atest CtsCarTestCases:WindshieldWipersSwitchTest Test: atest AndroidCarApiTest:WindshieldWipersSwitchTest Change-Id: Idebd9dea3e03a8c37984af87a502c23d55433b73 --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../JsonConfigLoader/src/JsonConfigLoader.cpp | 3 + .../config/DefaultProperties.json | 41 +++++++++++ .../aidl/impl/default_config/config/README.md | 2 + .../utils/common/include/VehicleHalTypes.h | 1 + .../automotive/vehicle/VehicleProperty.aidl | 1 + .../vehicle/WindshieldWipersSwitch.aidl | 52 ++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 25 +++++++ .../vehicle/WindshieldWipersSwitch.aidl | 68 +++++++++++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++ 13 files changed, 203 insertions(+) create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/WindshieldWipersSwitch.aidl create mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/WindshieldWipersSwitch.aidl diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 1d2d910031..37ec45de57 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -179,6 +179,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::WINDOW_LOCK, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::WINDSHIELD_WIPERS_PERIOD, VehiclePropertyAccess::READ}, {VehicleProperty::WINDSHIELD_WIPERS_STATE, VehiclePropertyAccess::READ}, + {VehicleProperty::WINDSHIELD_WIPERS_SWITCH, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::STEERING_WHEEL_HEIGHT_POS, VehiclePropertyAccess::READ_WRITE}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 613636e81c..9b29a3174f 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -179,6 +179,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::WINDOW_LOCK, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDSHIELD_WIPERS_PERIOD, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::WINDSHIELD_WIPERS_STATE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::WINDSHIELD_WIPERS_SWITCH, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::STEERING_WHEEL_HEIGHT_POS, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index f83f1c260e..c6fc59af58 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -171,6 +171,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.WINDOW_LOCK, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.WINDSHIELD_WIPERS_PERIOD, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.WINDSHIELD_WIPERS_STATE, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.WINDSHIELD_WIPERS_SWITCH, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_POS, VehiclePropertyAccess.READ_WRITE), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index f0642fe379..48f4763afa 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -171,6 +171,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.WINDOW_LOCK, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDSHIELD_WIPERS_PERIOD, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.WINDSHIELD_WIPERS_STATE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.WINDSHIELD_WIPERS_SWITCH, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_DEPTH_MOVE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.STEERING_WHEEL_HEIGHT_POS, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index 7531589311..bb4a5b6849 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -72,6 +72,7 @@ using ::aidl::android::hardware::automotive::vehicle::VehicleTurnSignal; using ::aidl::android::hardware::automotive::vehicle::VehicleUnit; using ::aidl::android::hardware::automotive::vehicle::VehicleVendorPermission; using ::aidl::android::hardware::automotive::vehicle::WindshieldWipersState; +using ::aidl::android::hardware::automotive::vehicle::WindshieldWipersSwitch; using ::android::base::Error; using ::android::base::Result; @@ -222,6 +223,8 @@ JsonValueParser::JsonValueParser() { mConstantParsersByType["FuelType"] = std::make_unique>(); mConstantParsersByType["WindshieldWipersState"] = std::make_unique>(); + mConstantParsersByType["WindshieldWipersSwitch"] = + std::make_unique>(); mConstantParsersByType["EmergencyLaneKeepAssistState"] = std::make_unique>(); mConstantParsersByType["CruiseControlType"] = diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index a0e811579a..2adfe3e0c0 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2693,6 +2693,47 @@ } ] }, + { + "property": "VehicleProperty::WINDSHIELD_WIPERS_SWITCH", + "defaultValue": { + "int32Values": [ + "WindshieldWipersSwitch::OFF" + ] + }, + "areas": [ + { + "areaId": "VehicleAreaWindow::FRONT_WINDSHIELD", + "supportedEnumValues": [ + "WindshieldWipersSwitch::OFF", + "WindshieldWipersSwitch::MIST", + "WindshieldWipersSwitch::INTERMITTENT_LEVEL_1", + "WindshieldWipersSwitch::INTERMITTENT_LEVEL_2", + "WindshieldWipersSwitch::INTERMITTENT_LEVEL_3", + "WindshieldWipersSwitch::INTERMITTENT_LEVEL_4", + "WindshieldWipersSwitch::INTERMITTENT_LEVEL_5", + "WindshieldWipersSwitch::CONTINUOUS_LEVEL_1", + "WindshieldWipersSwitch::CONTINUOUS_LEVEL_2", + "WindshieldWipersSwitch::CONTINUOUS_LEVEL_3", + "WindshieldWipersSwitch::CONTINUOUS_LEVEL_4", + "WindshieldWipersSwitch::CONTINUOUS_LEVEL_5", + "WindshieldWipersSwitch::AUTO", + "WindshieldWipersSwitch::SERVICE" + ] + }, + { + "areaId": "VehicleAreaWindow::REAR_WINDSHIELD", + "supportedEnumValues": [ + "WindshieldWipersSwitch::OFF", + "WindshieldWipersSwitch::INTERMITTENT_LEVEL_1", + "WindshieldWipersSwitch::INTERMITTENT_LEVEL_2", + "WindshieldWipersSwitch::CONTINUOUS_LEVEL_1", + "WindshieldWipersSwitch::CONTINUOUS_LEVEL_2", + "WindshieldWipersSwitch::AUTO", + "WindshieldWipersSwitch::SERVICE" + ] + } + ] + }, { "property": "VehicleProperty::STEERING_WHEEL_DEPTH_POS", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/default_config/config/README.md b/automotive/vehicle/aidl/impl/default_config/config/README.md index 093b13d5ca..6e82de5773 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/README.md +++ b/automotive/vehicle/aidl/impl/default_config/config/README.md @@ -159,6 +159,8 @@ We support the following constant types: * WindshieldWipersState +* WindshieldWipersSwitch + * Constants Every constant type except "Constants" corresponds to a enum defined in Vehicle diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index 3b26aa6999..7da057ac7b 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -81,5 +81,6 @@ #include #include #include +#include #endif // android_hardware_automotive_vehicle_aidl_impl_utils_common_include_VehicleHalTypes_H_ diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index bbec4bf595..512159116d 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -177,6 +177,7 @@ enum VehicleProperty { WINDOW_LOCK = (((0x0BC4 + 0x10000000) + 0x03000000) + 0x00200000) /* 320867268 */, WINDSHIELD_WIPERS_PERIOD = (((0x0BC5 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.WINDOW) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 322964421 */, WINDSHIELD_WIPERS_STATE = (((0x0BC6 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.WINDOW) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 322964422 */, + WINDSHIELD_WIPERS_SWITCH = (((0x0BC7 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.WINDOW) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 322964423 */, STEERING_WHEEL_DEPTH_POS = (((0x0BE0 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410016 */, STEERING_WHEEL_DEPTH_MOVE = (((0x0BE1 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410017 */, STEERING_WHEEL_HEIGHT_POS = (((0x0BE2 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410018 */, diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/WindshieldWipersSwitch.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/WindshieldWipersSwitch.aidl new file mode 100644 index 0000000000..6c170fe6a4 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/WindshieldWipersSwitch.aidl @@ -0,0 +1,52 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum WindshieldWipersSwitch { + OTHER = 0, + OFF = 1, + MIST = 2, + INTERMITTENT_LEVEL_1 = 3, + INTERMITTENT_LEVEL_2 = 4, + INTERMITTENT_LEVEL_3 = 5, + INTERMITTENT_LEVEL_4 = 6, + INTERMITTENT_LEVEL_5 = 7, + CONTINUOUS_LEVEL_1 = 8, + CONTINUOUS_LEVEL_2 = 9, + CONTINUOUS_LEVEL_3 = 10, + CONTINUOUS_LEVEL_4 = 11, + CONTINUOUS_LEVEL_5 = 12, + AUTO = 13, + SERVICE = 14, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 68a1e324ee..a64ae07063 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -2131,6 +2131,31 @@ enum VehicleProperty { WINDSHIELD_WIPERS_STATE = 0x0BC6 + VehiclePropertyGroup.SYSTEM + VehicleArea.WINDOW + VehiclePropertyType.INT32, + /** + * Windshield wipers switch. + * + * Represents the position of the switch controlling the windshield wipers. The value of + * WINDSHIELD_WIPERS_SWITCH may not match the value of WINDSHIELD_WIPERS_STATE (e.g. + * WINDSHIELD_WIPERS_SWITCH = AUTO and WINDSHIELD_WIPERS_STATE = WindshieldWipersState#ON). + * + * For each supported area ID, the VehicleAreaConfig#supportedEnumValues array must be defined + * unless all states in WindshieldWipersSwitch are supported (including OTHER, which is not + * recommended). + * + * This property is defined as read_write, but OEMs have the option to implement it as read + * only. + * + * If this property is implemented as read_write and the OTHER state is listed in the + * VehicleAreaConfig#supportedEnumValues array, then OTHER is not a supported value for writing. + * It is only a supported value for reading. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + * @data_enum WindshieldWipersSwitch + */ + WINDSHIELD_WIPERS_SWITCH = + 0x0BC7 + VehiclePropertyGroup.SYSTEM + VehicleArea.WINDOW + VehiclePropertyType.INT32, + /** * Steering wheel depth position * diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/WindshieldWipersSwitch.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/WindshieldWipersSwitch.aidl new file mode 100644 index 0000000000..911d7ebfa5 --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/WindshieldWipersSwitch.aidl @@ -0,0 +1,68 @@ +/* + * 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.hardware.automotive.vehicle; + +/** + * Used to enumerate the current position of VehicleProperty#WINDSHIELD_WIPERS_SWITCH. + */ +@VintfStability +@Backing(type="int") +enum WindshieldWipersSwitch { + + /** + * This value is used as an alternative for any WindshieldWipersSwitch value that is not defined + * in the platform. Ideally, implementations of VehicleProperty#WINDSHIELD_WIPERS_SWITCH should + * not use this value. The framework can use this field to remain backwards compatible if + * WindshieldWipersSwitch is extended to include additional values. + */ + OTHER = 0, + /** + * The windshield wipers switch is set to the off position. + */ + OFF = 1, + /** + * MIST mode performs a single wipe, and then returns to the OFF position. + */ + MIST = 2, + /** + * INTERMITTENT_LEVEL_* modes performs intermittent wiping. As the level increases, the + * intermittent time period decreases. + */ + INTERMITTENT_LEVEL_1 = 3, + INTERMITTENT_LEVEL_2 = 4, + INTERMITTENT_LEVEL_3 = 5, + INTERMITTENT_LEVEL_4 = 6, + INTERMITTENT_LEVEL_5 = 7, + /** + * CONTINUOUS_LEVEL_* modes performs continuous wiping. As the level increases the speed of the + * wiping increases as well. + */ + CONTINUOUS_LEVEL_1 = 8, + CONTINUOUS_LEVEL_2 = 9, + CONTINUOUS_LEVEL_3 = 10, + CONTINUOUS_LEVEL_4 = 11, + CONTINUOUS_LEVEL_5 = 12, + /** + * AUTO allows the vehicle to decide the required wiping level based on the exterior weather + * conditions. + */ + AUTO = 13, + /** + * Windshield wipers are set to the service mode. + */ + SERVICE = 14, +} diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index efbcf47680..518a0b4460 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -588,6 +588,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyWindshieldWipersStateConfig) { VehicleArea::WINDOW, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyWindshieldWipersSwitchConfig) { + verifyProperty(VehicleProperty::WINDSHIELD_WIPERS_SWITCH, VehiclePropertyAccess::READ_WRITE, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::WINDOW, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifySteeringWheelDepthPosConfig) { verifyProperty(VehicleProperty::STEERING_WHEEL_DEPTH_POS, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From e1ffa0ca4e2237bc9ac06d2381fc2b6b2aa143cf Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Wed, 15 Feb 2023 21:21:55 +0000 Subject: [PATCH 739/998] Remove rust backend from camera AIDL interface FMQ is not supported in rust yet. Test: m Bug: na Change-Id: Icfd804f9b30a6c9feffc839dac80ff1cdbe688d2 --- camera/device/aidl/Android.bp | 3 --- camera/provider/aidl/Android.bp | 3 --- 2 files changed, 6 deletions(-) diff --git a/camera/device/aidl/Android.bp b/camera/device/aidl/Android.bp index bf5bf6310a..00d9da026f 100644 --- a/camera/device/aidl/Android.bp +++ b/camera/device/aidl/Android.bp @@ -28,9 +28,6 @@ aidl_interface { sdk_version: "module_current", enabled: false, }, - rust: { - enabled: true, - } }, versions_with_info: [ { diff --git a/camera/provider/aidl/Android.bp b/camera/provider/aidl/Android.bp index 19dede0a90..d7e613e657 100644 --- a/camera/provider/aidl/Android.bp +++ b/camera/provider/aidl/Android.bp @@ -26,9 +26,6 @@ aidl_interface { cpp: { enabled: false, }, - rust: { - enabled: true, - }, }, versions_with_info: [ { From 9785d8f10defb824b0590d13e4744b4fff835382 Mon Sep 17 00:00:00 2001 From: Mahesh KKV Date: Tue, 7 Feb 2023 11:08:13 -0800 Subject: [PATCH 740/998] Add TID-to-Link mapping capability fields Add capability fields for TID-to-Link mapping negotiation support for both station and access point. Bug: 268219346 Test: atest VtsHalWifiSupplicantStaIfaceTargetTest Change-Id: Iaf82cdb8a0c3e57135487c95750f53ab1d6fc187 --- .../current/android/hardware/wifi/IWifiChip.aidl | 1 + wifi/aidl/android/hardware/wifi/IWifiChip.aidl | 4 ++++ .../hardware/wifi/supplicant/ConnectionCapabilities.aidl | 1 + .../hardware/wifi/supplicant/ConnectionCapabilities.aidl | 4 ++++ 4 files changed, 10 insertions(+) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl index 6d0ddaa4f3..e8c3c13ca2 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl @@ -93,6 +93,7 @@ interface IWifiChip { P2P_RAND_MAC = (1 << 5) /* 32 */, WIGIG = (1 << 6) /* 64 */, SET_AFC_CHANNEL_ALLOWANCE = (1 << 7) /* 128 */, + T2LM_NEGOTIATION = (1 << 8) /* 256 */, } @VintfStability parcelable ChipConcurrencyCombinationLimit { diff --git a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl index 8d415fdc68..a297994a71 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl @@ -78,6 +78,10 @@ interface IWifiChip { * for AFC purposes. */ SET_AFC_CHANNEL_ALLOWANCE = 1 << 7, + /** + * Chip supports Tid-To-Link mapping negotiation. + */ + T2LM_NEGOTIATION = 1 << 8, } /** diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl index 433b3d8018..553cbc8e25 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl @@ -39,4 +39,5 @@ parcelable ConnectionCapabilities { int maxNumberTxSpatialStreams; int maxNumberRxSpatialStreams; android.hardware.wifi.supplicant.LegacyMode legacyMode; + boolean apTidToLinkMapNegotiationSupported; } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl index 1718413a13..4921a672b3 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl @@ -44,4 +44,8 @@ parcelable ConnectionCapabilities { * detailed network mode for legacy network */ LegacyMode legacyMode; + /** + * Indicates the AP support for TID-to-link mapping negotiation. + */ + boolean apTidToLinkMapNegotiationSupported; } From dd47e716a09b0bddd0bfc5d2e2a762d7af70a236 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Wed, 15 Feb 2023 23:50:07 +0000 Subject: [PATCH 741/998] Remove unused DEBUG_PACKET_FATE capability from StaIfaceCapabilityMask. Bug: 266521428 Test: atest VtsHalWifiStaIfaceTargetTest Change-Id: If20728567cb8877ae54488480e13fd8541640b92 --- .../android/hardware/wifi/IWifiStaIface.aidl | 1 - .../android/hardware/wifi/IWifiStaIface.aidl | 4 ---- wifi/aidl/default/aidl_struct_util.cpp | 20 +------------------ wifi/aidl/default/aidl_struct_util.h | 4 +--- wifi/aidl/default/wifi_sta_iface.cpp | 11 ++-------- .../functional/wifi_sta_iface_aidl_test.cpp | 17 ++++++++-------- 6 files changed, 12 insertions(+), 45 deletions(-) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl index 43027353da..31b6881fa9 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl @@ -78,6 +78,5 @@ interface IWifiStaIface { TDLS_OFFCHANNEL = (1 << 11) /* 2048 */, ND_OFFLOAD = (1 << 12) /* 4096 */, KEEP_ALIVE = (1 << 13) /* 8192 */, - DEBUG_PACKET_FATE = (1 << 14) /* 16384 */, } } diff --git a/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl b/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl index e6218e68b7..28d6a4dfb6 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl @@ -99,10 +99,6 @@ interface IWifiStaIface { * Support for keep alive packet offload. */ KEEP_ALIVE = 1 << 13, - /** - * Support for tracking connection packets' fate. - */ - DEBUG_PACKET_FATE = 1 << 14, } /** diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index 2d745dcbd3..fa89852982 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -41,16 +41,6 @@ inline std::vector uintToIntVec(const std::vector& in) { return std::vector(in.begin(), in.end()); } -IWifiStaIface::StaIfaceCapabilityMask convertLegacyLoggerFeatureToAidlStaIfaceCapability( - uint32_t feature) { - switch (feature) { - case legacy_hal::WIFI_LOGGER_PACKET_FATE_SUPPORTED: - return IWifiStaIface::StaIfaceCapabilityMask::DEBUG_PACKET_FATE; - }; - CHECK(false) << "Unknown legacy feature: " << feature; - return {}; -} - IWifiChip::ChipCapabilityMask convertLegacyFeatureToAidlChipCapability(uint64_t feature) { switch (feature) { case WIFI_FEATURE_SET_TX_POWER_LIMIT: @@ -459,19 +449,11 @@ bool convertLegacyWifiMacInfosToAidl( return true; } -bool convertLegacyFeaturesToAidlStaCapabilities(uint64_t legacy_feature_set, - uint32_t legacy_logger_feature_set, - uint32_t* aidl_caps) { +bool convertLegacyFeaturesToAidlStaCapabilities(uint64_t legacy_feature_set, uint32_t* aidl_caps) { if (!aidl_caps) { return false; } *aidl_caps = {}; - for (const auto feature : {legacy_hal::WIFI_LOGGER_PACKET_FATE_SUPPORTED}) { - if (feature & legacy_logger_feature_set) { - *aidl_caps |= static_cast( - convertLegacyLoggerFeatureToAidlStaIfaceCapability(feature)); - } - } for (const auto feature : {WIFI_FEATURE_GSCAN, WIFI_FEATURE_LINK_LAYER_STATS, WIFI_FEATURE_RSSI_MONITOR, WIFI_FEATURE_CONTROL_ROAMING, WIFI_FEATURE_IE_WHITELIST, WIFI_FEATURE_SCAN_RAND, diff --git a/wifi/aidl/default/aidl_struct_util.h b/wifi/aidl/default/aidl_struct_util.h index df3785e511..904ba81ad1 100644 --- a/wifi/aidl/default/aidl_struct_util.h +++ b/wifi/aidl/default/aidl_struct_util.h @@ -69,9 +69,7 @@ WifiBand convertLegacyMacBandToAidlWifiBand(uint32_t band); WifiAntennaMode convertLegacyAntennaConfigurationToAidl(uint32_t antenna_cfg); // STA iface conversion methods. -bool convertLegacyFeaturesToAidlStaCapabilities(uint64_t legacy_feature_set, - uint32_t legacy_logger_feature_set, - uint32_t* aidl_caps); +bool convertLegacyFeaturesToAidlStaCapabilities(uint64_t legacy_feature_set, uint32_t* aidl_caps); bool convertLegacyApfCapabilitiesToAidl(const legacy_hal::PacketFilterCapabilities& legacy_caps, StaApfPacketFilterCapabilities* aidl_caps); bool convertLegacyGscanCapabilitiesToAidl(const legacy_hal::wifi_gscan_capabilities& legacy_caps, diff --git a/wifi/aidl/default/wifi_sta_iface.cpp b/wifi/aidl/default/wifi_sta_iface.cpp index 96dc809839..300316aa07 100644 --- a/wifi/aidl/default/wifi_sta_iface.cpp +++ b/wifi/aidl/default/wifi_sta_iface.cpp @@ -249,16 +249,9 @@ WifiStaIface::getCapabilitiesInternal() { return {IWifiStaIface::StaIfaceCapabilityMask{}, createWifiStatusFromLegacyError(legacy_status)}; } - uint32_t legacy_logger_feature_set; - std::tie(legacy_status, legacy_logger_feature_set) = - legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - // some devices don't support querying logger feature set - legacy_logger_feature_set = 0; - } uint32_t aidl_caps; - if (!aidl_struct_util::convertLegacyFeaturesToAidlStaCapabilities( - legacy_feature_set, legacy_logger_feature_set, &aidl_caps)) { + if (!aidl_struct_util::convertLegacyFeaturesToAidlStaCapabilities(legacy_feature_set, + &aidl_caps)) { return {IWifiStaIface::StaIfaceCapabilityMask{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; } diff --git a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp index 5e55315781..fe32be55c9 100644 --- a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp +++ b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp @@ -255,18 +255,17 @@ TEST_P(WifiStaIfaceAidlTest, EnableNDOffload) { * PacketFateMonitoring */ TEST_P(WifiStaIfaceAidlTest, PacketFateMonitoring) { - if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::DEBUG_PACKET_FATE)) { - GTEST_SKIP() << "Packet fate monitoring is not supported."; - } - // Start packet fate monitoring. - EXPECT_TRUE(wifi_sta_iface_->startDebugPacketFateMonitoring().isOk()); + auto status = wifi_sta_iface_->startDebugPacketFateMonitoring(); + EXPECT_TRUE(status.isOk() || checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); // Retrieve packets. - std::vector rx_reports; - std::vector tx_reports; - EXPECT_TRUE(wifi_sta_iface_->getDebugRxPacketFates(&rx_reports).isOk()); - EXPECT_TRUE(wifi_sta_iface_->getDebugTxPacketFates(&tx_reports).isOk()); + if (status.isOk()) { + std::vector rx_reports; + std::vector tx_reports; + EXPECT_TRUE(wifi_sta_iface_->getDebugRxPacketFates(&rx_reports).isOk()); + EXPECT_TRUE(wifi_sta_iface_->getDebugTxPacketFates(&tx_reports).isOk()); + } } GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiStaIfaceAidlTest); From a8c9aa31730c0790045d2dd2f0f876261b44ad63 Mon Sep 17 00:00:00 2001 From: Sungtak Lee Date: Thu, 16 Feb 2023 00:51:59 +0000 Subject: [PATCH 742/998] android.hardware.media.c2: Move to staging/ Bug: 254050314 Test: m Change-Id: I4bc2c0b59453240f0638ccaa2f911ec8423e930d --- .../compatibility_matrix.8.xml | 9 --- .../exclude/fcm_exclude.cpp | 4 ++ .../android/hardware/media/c2/BaseBlock.aidl | 39 ----------- .../android/hardware/media/c2/Block.aidl | 40 ----------- .../android/hardware/media/c2/Buffer.aidl | 39 ----------- .../hardware/media/c2/FieldDescriptor.aidl | 62 ----------------- .../android/hardware/media/c2/FieldId.aidl | 39 ----------- .../media/c2/FieldSupportedValues.aidl | 41 ------------ .../media/c2/FieldSupportedValuesQuery.aidl | 44 ------------- .../c2/FieldSupportedValuesQueryResult.aidl | 39 ----------- .../android/hardware/media/c2/FrameData.aidl | 47 ------------- .../android/hardware/media/c2/IComponent.aidl | 53 --------------- .../media/c2/IComponentInterface.aidl | 38 ----------- .../hardware/media/c2/IComponentListener.aidl | 53 --------------- .../hardware/media/c2/IComponentStore.aidl | 66 ------------------- .../hardware/media/c2/IConfigurable.aidl | 48 -------------- .../android/hardware/media/c2/InfoBuffer.aidl | 39 ----------- .../hardware/media/c2/ParamDescriptor.aidl | 48 -------------- .../android/hardware/media/c2/ParamField.aidl | 39 ----------- .../hardware/media/c2/ParamFieldValues.aidl | 39 ----------- .../android/hardware/media/c2/Params.aidl | 38 ----------- .../hardware/media/c2/SettingResult.aidl | 53 --------------- .../android/hardware/media/c2/Status.aidl | 52 --------------- .../hardware/media/c2/StructDescriptor.aidl | 39 ----------- .../hardware/media/c2/SurfaceSyncObj.aidl | 41 ------------ .../android/hardware/media/c2/ValueRange.aidl | 42 ------------ .../android/hardware/media/c2/Work.aidl | 42 ------------ .../android/hardware/media/c2/WorkBundle.aidl | 39 ----------- .../hardware/media/c2/WorkOrdinal.aidl | 40 ----------- .../android/hardware/media/c2/Worklet.aidl | 41 ------------ {media => staging}/c2/aidl/Android.bp | 2 +- .../android/hardware/media/c2/BaseBlock.aidl | 1 - .../aidl/android/hardware/media/c2/Block.aidl | 1 - .../android/hardware/media/c2/Buffer.aidl | 1 - .../hardware/media/c2/FieldDescriptor.aidl | 3 - .../android/hardware/media/c2/FieldId.aidl | 1 - .../media/c2/FieldSupportedValues.aidl | 1 - .../media/c2/FieldSupportedValuesQuery.aidl | 2 - .../c2/FieldSupportedValuesQueryResult.aidl | 1 - .../android/hardware/media/c2/FrameData.aidl | 1 - .../android/hardware/media/c2/IComponent.aidl | 1 - .../media/c2/IComponentInterface.aidl | 1 - .../hardware/media/c2/IComponentListener.aidl | 3 - .../hardware/media/c2/IComponentStore.aidl | 4 -- .../hardware/media/c2/IConfigurable.aidl | 2 - .../android/hardware/media/c2/InfoBuffer.aidl | 1 - .../hardware/media/c2/ParamDescriptor.aidl | 1 - .../android/hardware/media/c2/ParamField.aidl | 1 - .../hardware/media/c2/ParamFieldValues.aidl | 1 - .../android/hardware/media/c2/Params.aidl | 1 - .../hardware/media/c2/SettingResult.aidl | 2 - .../android/hardware/media/c2/Status.aidl | 1 - .../hardware/media/c2/StructDescriptor.aidl | 1 - .../hardware/media/c2/SurfaceSyncObj.aidl | 1 - .../android/hardware/media/c2/ValueRange.aidl | 1 - .../aidl/android/hardware/media/c2/Work.aidl | 1 - .../android/hardware/media/c2/WorkBundle.aidl | 1 - .../hardware/media/c2/WorkOrdinal.aidl | 1 - .../android/hardware/media/c2/Worklet.aidl | 1 - 59 files changed, 5 insertions(+), 1288 deletions(-) delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/BaseBlock.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Block.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Buffer.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldDescriptor.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldId.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValues.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQuery.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FrameData.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentInterface.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentListener.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentStore.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IConfigurable.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/InfoBuffer.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamDescriptor.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamField.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamFieldValues.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Params.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SettingResult.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Status.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/StructDescriptor.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SurfaceSyncObj.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ValueRange.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Work.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkBundle.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkOrdinal.aidl delete mode 100644 media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Worklet.aidl rename {media => staging}/c2/aidl/Android.bp (97%) rename {media => staging}/c2/aidl/android/hardware/media/c2/BaseBlock.aidl (98%) rename {media => staging}/c2/aidl/android/hardware/media/c2/Block.aidl (98%) rename {media => staging}/c2/aidl/android/hardware/media/c2/Buffer.aidl (98%) rename {media => staging}/c2/aidl/android/hardware/media/c2/FieldDescriptor.aidl (98%) rename {media => staging}/c2/aidl/android/hardware/media/c2/FieldId.aidl (98%) rename {media => staging}/c2/aidl/android/hardware/media/c2/FieldSupportedValues.aidl (99%) rename {media => staging}/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQuery.aidl (97%) rename {media => staging}/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl (99%) rename {media => staging}/c2/aidl/android/hardware/media/c2/FrameData.aidl (99%) rename {media => staging}/c2/aidl/android/hardware/media/c2/IComponent.aidl (99%) rename {media => staging}/c2/aidl/android/hardware/media/c2/IComponentInterface.aidl (98%) rename {media => staging}/c2/aidl/android/hardware/media/c2/IComponentListener.aidl (98%) rename {media => staging}/c2/aidl/android/hardware/media/c2/IComponentStore.aidl (98%) rename {media => staging}/c2/aidl/android/hardware/media/c2/IConfigurable.aidl (99%) rename {media => staging}/c2/aidl/android/hardware/media/c2/InfoBuffer.aidl (98%) rename {media => staging}/c2/aidl/android/hardware/media/c2/ParamDescriptor.aidl (99%) rename {media => staging}/c2/aidl/android/hardware/media/c2/ParamField.aidl (98%) rename {media => staging}/c2/aidl/android/hardware/media/c2/ParamFieldValues.aidl (98%) rename {media => staging}/c2/aidl/android/hardware/media/c2/Params.aidl (98%) rename {media => staging}/c2/aidl/android/hardware/media/c2/SettingResult.aidl (98%) rename {media => staging}/c2/aidl/android/hardware/media/c2/Status.aidl (99%) rename {media => staging}/c2/aidl/android/hardware/media/c2/StructDescriptor.aidl (99%) rename {media => staging}/c2/aidl/android/hardware/media/c2/SurfaceSyncObj.aidl (99%) rename {media => staging}/c2/aidl/android/hardware/media/c2/ValueRange.aidl (99%) rename {media => staging}/c2/aidl/android/hardware/media/c2/Work.aidl (99%) rename {media => staging}/c2/aidl/android/hardware/media/c2/WorkBundle.aidl (99%) rename {media => staging}/c2/aidl/android/hardware/media/c2/WorkOrdinal.aidl (99%) rename {media => staging}/c2/aidl/android/hardware/media/c2/Worklet.aidl (99%) diff --git a/compatibility_matrices/compatibility_matrix.8.xml b/compatibility_matrices/compatibility_matrix.8.xml index 56ae51adea..f93b2ad7c7 100644 --- a/compatibility_matrices/compatibility_matrix.8.xml +++ b/compatibility_matrices/compatibility_matrix.8.xml @@ -373,15 +373,6 @@ vendor[0-9]*_software - - android.hardware.media.c2 - 1 - - IComponentStore - default[0-9]* - vendor[0-9]*_software - - android.hardware.memtrack 1 diff --git a/compatibility_matrices/exclude/fcm_exclude.cpp b/compatibility_matrices/exclude/fcm_exclude.cpp index b17c0e22c6..ba6bb17377 100644 --- a/compatibility_matrices/exclude/fcm_exclude.cpp +++ b/compatibility_matrices/exclude/fcm_exclude.cpp @@ -102,6 +102,10 @@ bool ShouldCheckMissingHalsInFcm(const std::string& package) { "android.hardware.thermal@1.0", "android.hardware.thermal@1.1", "android.hardware.wifi.offload@1.0", + + // Under hardware/interfaces/staging, still in development + // AIDL + "android.hardware.media.c2", }; auto package_has_prefix = [&](const std::string& prefix) { diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/BaseBlock.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/BaseBlock.aidl deleted file mode 100644 index 460ff97522..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/BaseBlock.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -union BaseBlock { - android.hardware.common.NativeHandle nativeBlock; - android.hardware.media.bufferpool2.BufferStatusMessage pooledBlock; -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Block.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Block.aidl deleted file mode 100644 index 7b3005e22d..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Block.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -parcelable Block { - int index; - android.hardware.media.c2.Params meta; - android.hardware.common.NativeHandle fence; -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Buffer.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Buffer.aidl deleted file mode 100644 index b632932cec..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Buffer.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -parcelable Buffer { - android.hardware.media.c2.Params info; - android.hardware.media.c2.Block[] blocks; -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldDescriptor.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldDescriptor.aidl deleted file mode 100644 index d0e4cbf069..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldDescriptor.aidl +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -parcelable FieldDescriptor { - android.hardware.media.c2.FieldId fieldId; - android.hardware.media.c2.FieldDescriptor.Type type; - int structIndex; - int extent; - String name; - android.hardware.media.c2.FieldDescriptor.NamedValue[] namedValues; - @Backing(type="int") @VintfStability - enum Type { - NO_INIT = 0, - INT32 = 1, - UINT32 = 2, - CNTR32 = 3, - INT64 = 4, - UINT64 = 5, - CNTR64 = 6, - FLOAT = 7, - STRING = 256, - BLOB = 257, - STRUCT = 131072, - } - @VintfStability - parcelable NamedValue { - String name; - long value; - } -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldId.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldId.aidl deleted file mode 100644 index 935b85dbbf..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldId.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -parcelable FieldId { - int offset; - int sizeBytes; -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValues.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValues.aidl deleted file mode 100644 index 69060bea1d..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValues.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -union FieldSupportedValues { - boolean empty; - android.hardware.media.c2.ValueRange range; - long[] values; - long[] flags; -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQuery.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQuery.aidl deleted file mode 100644 index 22f7c8491b..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQuery.aidl +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -parcelable FieldSupportedValuesQuery { - android.hardware.media.c2.ParamField field; - android.hardware.media.c2.FieldSupportedValuesQuery.Type type; - @Backing(type="int") @VintfStability - enum Type { - POSSIBLE = 0, - CURRENT = 1, - } -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl deleted file mode 100644 index 187e3ebfeb..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -parcelable FieldSupportedValuesQueryResult { - android.hardware.media.c2.Status status; - android.hardware.media.c2.FieldSupportedValues values; -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FrameData.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FrameData.aidl deleted file mode 100644 index e73b05e95e..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/FrameData.aidl +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -parcelable FrameData { - int flags; - android.hardware.media.c2.WorkOrdinal ordinal; - android.hardware.media.c2.Buffer[] buffers; - android.hardware.media.c2.Params configUpdate; - android.hardware.media.c2.InfoBuffer[] infoBuffers; - const int DROP_FRAME = 1; - const int END_OF_STREAM = 2; - const int DISCARD_FRAME = 4; - const int FLAG_INCOMPLETE = 8; - const int CODEC_CONFIG = -2147483648; -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl deleted file mode 100644 index 7ed09afae7..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -interface IComponent { - android.hardware.common.NativeHandle configureVideoTunnel(in int avSyncHwId); - android.hardware.media.c2.IComponent.BlockPool createBlockPool(in int allocatorId); - void destroyBlockPool(in long blockPoolId); - void drain(in boolean withEos); - android.hardware.media.c2.WorkBundle flush(); - android.hardware.media.c2.IComponentInterface getInterface(); - void queue(in android.hardware.media.c2.WorkBundle workBundle); - void release(); - void reset(); - void setOutputSurface(in long blockPoolId, in android.view.Surface surface, in android.hardware.media.c2.SurfaceSyncObj syncObject); - void start(); - void stop(); - parcelable BlockPool { - long blockPoolId; - android.hardware.media.c2.IConfigurable configurable; - } -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentInterface.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentInterface.aidl deleted file mode 100644 index 2350daeec2..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentInterface.aidl +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -interface IComponentInterface { - android.hardware.media.c2.IConfigurable getConfigurable(); -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentListener.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentListener.aidl deleted file mode 100644 index f6f2a6391c..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentListener.aidl +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -interface IComponentListener { - oneway void onError(in android.hardware.media.c2.Status status, in int errorCode); - oneway void onFramesRendered(in android.hardware.media.c2.IComponentListener.RenderedFrame[] renderedFrames); - oneway void onInputBuffersReleased(in android.hardware.media.c2.IComponentListener.InputBuffer[] inputBuffers); - oneway void onTripped(in android.hardware.media.c2.SettingResult[] settingResults); - oneway void onWorkDone(in android.hardware.media.c2.WorkBundle workBundle); - @VintfStability - parcelable InputBuffer { - long frameIndex; - int arrayIndex; - } - @VintfStability - parcelable RenderedFrame { - long bufferQueueId; - int slotId; - long timestampNs; - } -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentStore.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentStore.aidl deleted file mode 100644 index 35532be3a2..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponentStore.aidl +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -interface IComponentStore { - void copyBuffer(in android.hardware.media.c2.Buffer src, in android.hardware.media.c2.Buffer dst); - android.hardware.media.c2.IComponent createComponent(in String name, in android.hardware.media.c2.IComponentListener listener, in android.hardware.media.bufferpool2.IClientManager pool); - android.hardware.media.c2.IComponentInterface createInterface(in String name); - android.hardware.media.c2.IConfigurable getConfigurable(); - android.hardware.media.bufferpool2.IClientManager getPoolClientManager(); - android.hardware.media.c2.StructDescriptor[] getStructDescriptors(in int[] indices); - android.hardware.media.c2.IComponentStore.ComponentTraits[] listComponents(); - @VintfStability - parcelable ComponentTraits { - String name; - android.hardware.media.c2.IComponentStore.ComponentTraits.Domain domain; - android.hardware.media.c2.IComponentStore.ComponentTraits.Kind kind; - int rank; - String mediaType; - String[] aliases; - @Backing(type="int") @VintfStability - enum Kind { - OTHER = 0, - DECODER = 1, - ENCODER = 2, - } - @Backing(type="int") @VintfStability - enum Domain { - OTHER = 0, - VIDEO = 1, - AUDIO = 2, - IMAGE = 3, - } - } -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IConfigurable.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IConfigurable.aidl deleted file mode 100644 index 32f5abdb51..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IConfigurable.aidl +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -interface IConfigurable { - android.hardware.media.c2.IConfigurable.ConfigResult config(in android.hardware.media.c2.Params inParams, in boolean mayBlock); - int getId(); - String getName(); - android.hardware.media.c2.Params query(in int[] indices, in boolean mayBlock); - android.hardware.media.c2.ParamDescriptor[] querySupportedParams(in int start, in int count); - android.hardware.media.c2.FieldSupportedValuesQueryResult[] querySupportedValues(in android.hardware.media.c2.FieldSupportedValuesQuery[] inFields, in boolean mayBlock); - @VintfStability - parcelable ConfigResult { - android.hardware.media.c2.Params params; - android.hardware.media.c2.SettingResult[] failures; - } -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/InfoBuffer.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/InfoBuffer.aidl deleted file mode 100644 index 94cd77d925..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/InfoBuffer.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -parcelable InfoBuffer { - int index; - android.hardware.media.c2.Buffer buffer; -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamDescriptor.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamDescriptor.aidl deleted file mode 100644 index 04c869c066..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamDescriptor.aidl +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -parcelable ParamDescriptor { - int index; - int attrib; - String name; - int[] dependencies; - const int ATTRIBUTE_REQUIRED = 1; - const int ATTRIBUTE_PERSISTENT = 2; - const int ATTRIBUTE_STRICT = 4; - const int ATTRIBUTE_READ_ONLY = 8; - const int ATTRIBUTE_HIDDEN = 16; - const int ATTRIBUTE_INTERNAL = 32; - const int ATTRIBUTE_CONST = 64; -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamField.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamField.aidl deleted file mode 100644 index 13d252257e..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamField.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -parcelable ParamField { - int index; - android.hardware.media.c2.FieldId fieldId; -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamFieldValues.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamFieldValues.aidl deleted file mode 100644 index 5a2821cdb2..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ParamFieldValues.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -parcelable ParamFieldValues { - android.hardware.media.c2.ParamField paramOrField; - android.hardware.media.c2.FieldSupportedValues[] values; -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Params.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Params.aidl deleted file mode 100644 index 7d363c06b3..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Params.aidl +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -parcelable Params { - byte[] params; -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SettingResult.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SettingResult.aidl deleted file mode 100644 index f9e6a93b24..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SettingResult.aidl +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -parcelable SettingResult { - android.hardware.media.c2.SettingResult.Failure failure; - android.hardware.media.c2.ParamFieldValues field; - android.hardware.media.c2.ParamFieldValues[] conflicts; - @Backing(type="int") @VintfStability - enum Failure { - BAD_TYPE = 0, - BAD_PORT = 1, - BAD_INDEX = 2, - READ_ONLY = 3, - MISMATCH = 4, - BAD_VALUE = 5, - CONFLICT = 6, - UNSUPPORTED = 7, - INFO_BAD_VALUE = 8, - INFO_CONFLICT = 9, - } -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Status.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Status.aidl deleted file mode 100644 index ad07677aca..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Status.aidl +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -parcelable Status { - int status; - const int OK = 0; - const int BAD_VALUE = -22; - const int BAD_INDEX = -75; - const int CANNOT_DO = -2147483646; - const int DUPLICATE = -17; - const int NOT_FOUND = -2; - const int BAD_STATE = -38; - const int BLOCKING = -9930; - const int NO_MEMORY = -12; - const int REFUSED = -1; - const int TIMED_OUT = -110; - const int OMITTED = -74; - const int CORRUPTED = -2147483648; - const int NO_INIT = -19; -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/StructDescriptor.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/StructDescriptor.aidl deleted file mode 100644 index 58268e0b92..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/StructDescriptor.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -parcelable StructDescriptor { - int type; - android.hardware.media.c2.FieldDescriptor[] fields; -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SurfaceSyncObj.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SurfaceSyncObj.aidl deleted file mode 100644 index 1c9bf8d989..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SurfaceSyncObj.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -parcelable SurfaceSyncObj { - android.hardware.common.NativeHandle syncMemory; - long bqId; - int generationId; - long consumerUsage; -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ValueRange.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ValueRange.aidl deleted file mode 100644 index db71ce044e..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/ValueRange.aidl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -parcelable ValueRange { - long min; - long max; - long step; - long num; - long denom; -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Work.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Work.aidl deleted file mode 100644 index a5343488f5..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Work.aidl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -parcelable Work { - byte[] chainInfo; - android.hardware.media.c2.FrameData input; - android.hardware.media.c2.Worklet[] worklets; - int workletsProcessed; - android.hardware.media.c2.Status result; -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkBundle.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkBundle.aidl deleted file mode 100644 index 84708a8556..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkBundle.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -parcelable WorkBundle { - android.hardware.media.c2.Work[] works; - android.hardware.media.c2.BaseBlock[] baseBlocks; -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkOrdinal.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkOrdinal.aidl deleted file mode 100644 index 2833df3a79..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/WorkOrdinal.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -parcelable WorkOrdinal { - long timestampUs; - long frameIndex; - long customOrdinal; -} diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Worklet.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Worklet.aidl deleted file mode 100644 index a79abf202b..0000000000 --- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/Worklet.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.media.c2; -@VintfStability -parcelable Worklet { - int componentId; - byte[] tunings; - android.hardware.media.c2.SettingResult[] failures; - android.hardware.media.c2.FrameData output; -} diff --git a/media/c2/aidl/Android.bp b/staging/c2/aidl/Android.bp similarity index 97% rename from media/c2/aidl/Android.bp rename to staging/c2/aidl/Android.bp index 56531db55b..b9da7adb2c 100644 --- a/media/c2/aidl/Android.bp +++ b/staging/c2/aidl/Android.bp @@ -13,6 +13,7 @@ aidl_interface { name: "android.hardware.media.c2", vendor_available: true, double_loadable: true, + unstable: true, srcs: ["android/hardware/media/c2/*.aidl"], include_dirs: [ "frameworks/native/aidl/gui", @@ -21,7 +22,6 @@ aidl_interface { "android.hardware.common-V2", "android.hardware.media.bufferpool2-V1", ], - stability: "vintf", backend: { cpp: { enabled: false, diff --git a/media/c2/aidl/android/hardware/media/c2/BaseBlock.aidl b/staging/c2/aidl/android/hardware/media/c2/BaseBlock.aidl similarity index 98% rename from media/c2/aidl/android/hardware/media/c2/BaseBlock.aidl rename to staging/c2/aidl/android/hardware/media/c2/BaseBlock.aidl index 8b8b8e0e46..16e7653736 100644 --- a/media/c2/aidl/android/hardware/media/c2/BaseBlock.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/BaseBlock.aidl @@ -25,7 +25,6 @@ import android.hardware.common.NativeHandle; * decoded data, codec-specific data, and other codec-related data are all sent * in the form of BaseBlocks. */ -@VintfStability union BaseBlock { /** * #nativeBlock is the opaque representation of a buffer. diff --git a/media/c2/aidl/android/hardware/media/c2/Block.aidl b/staging/c2/aidl/android/hardware/media/c2/Block.aidl similarity index 98% rename from media/c2/aidl/android/hardware/media/c2/Block.aidl rename to staging/c2/aidl/android/hardware/media/c2/Block.aidl index 34aa7b173f..4da849098e 100644 --- a/media/c2/aidl/android/hardware/media/c2/Block.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/Block.aidl @@ -26,7 +26,6 @@ import android.hardware.media.c2.Params; * attributes may differ among `Block` objects that refer to the same * `BaseBlock` in the same `WorkBundle`. */ -@VintfStability parcelable Block { /** * Identity of a `BaseBlock` within a `WorkBundle`. This is an index into diff --git a/media/c2/aidl/android/hardware/media/c2/Buffer.aidl b/staging/c2/aidl/android/hardware/media/c2/Buffer.aidl similarity index 98% rename from media/c2/aidl/android/hardware/media/c2/Buffer.aidl rename to staging/c2/aidl/android/hardware/media/c2/Buffer.aidl index d2dcf2dfe0..fe01b648a4 100644 --- a/media/c2/aidl/android/hardware/media/c2/Buffer.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/Buffer.aidl @@ -24,7 +24,6 @@ import android.hardware.media.c2.Params; * * This is a part of @ref FrameData. */ -@VintfStability parcelable Buffer { /** * Metadata associated with the buffer. diff --git a/media/c2/aidl/android/hardware/media/c2/FieldDescriptor.aidl b/staging/c2/aidl/android/hardware/media/c2/FieldDescriptor.aidl similarity index 98% rename from media/c2/aidl/android/hardware/media/c2/FieldDescriptor.aidl rename to staging/c2/aidl/android/hardware/media/c2/FieldDescriptor.aidl index a2774ec72e..3dd14cd0ed 100644 --- a/media/c2/aidl/android/hardware/media/c2/FieldDescriptor.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/FieldDescriptor.aidl @@ -21,12 +21,10 @@ import android.hardware.media.c2.FieldId; /** * Description of a field inside a C2Param structure. */ -@VintfStability parcelable FieldDescriptor { /** * Possible types of the field. */ - @VintfStability @Backing(type="int") enum Type { NO_INIT = 0, @@ -55,7 +53,6 @@ parcelable FieldDescriptor { * Named value type. This is used for defining an enum value for a numeric * type. */ - @VintfStability parcelable NamedValue { /** * Name of the enum value. This must be unique for each enum value in diff --git a/media/c2/aidl/android/hardware/media/c2/FieldId.aidl b/staging/c2/aidl/android/hardware/media/c2/FieldId.aidl similarity index 98% rename from media/c2/aidl/android/hardware/media/c2/FieldId.aidl rename to staging/c2/aidl/android/hardware/media/c2/FieldId.aidl index 68bf058962..c53f7a5a34 100644 --- a/media/c2/aidl/android/hardware/media/c2/FieldId.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/FieldId.aidl @@ -22,7 +22,6 @@ package android.hardware.media.c2; * Within a given C2Param structure, each field is uniquely identified by @ref * FieldId. */ -@VintfStability parcelable FieldId { /** * Offset of the field in bytes. diff --git a/media/c2/aidl/android/hardware/media/c2/FieldSupportedValues.aidl b/staging/c2/aidl/android/hardware/media/c2/FieldSupportedValues.aidl similarity index 99% rename from media/c2/aidl/android/hardware/media/c2/FieldSupportedValues.aidl rename to staging/c2/aidl/android/hardware/media/c2/FieldSupportedValues.aidl index 6c2033b5d8..5f4ad2a921 100644 --- a/media/c2/aidl/android/hardware/media/c2/FieldSupportedValues.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/FieldSupportedValues.aidl @@ -26,7 +26,6 @@ import android.hardware.media.c2.ValueRange; * The intended type of values must be made clear in the context where * `FieldSupportedValues` is used. */ -@VintfStability union FieldSupportedValues { /** * No supported values diff --git a/media/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQuery.aidl b/staging/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQuery.aidl similarity index 97% rename from media/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQuery.aidl rename to staging/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQuery.aidl index bdaaef6b73..33a8170688 100644 --- a/media/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQuery.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQuery.aidl @@ -22,9 +22,7 @@ import android.hardware.media.c2.ParamField; * Query information for supported values of a field. This is used as input to * IConfigurable::querySupportedValues(). */ -@VintfStability parcelable FieldSupportedValuesQuery { - @VintfStability @Backing(type="int") enum Type { /** diff --git a/media/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl b/staging/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl similarity index 99% rename from media/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl rename to staging/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl index b5c28c6d1c..133712a57e 100644 --- a/media/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/FieldSupportedValuesQueryResult.aidl @@ -23,7 +23,6 @@ import android.hardware.media.c2.Status; * This structure is used to hold the result from * IConfigurable::querySupportedValues(). */ -@VintfStability parcelable FieldSupportedValuesQueryResult { /** * Result of the query. Possible values are diff --git a/media/c2/aidl/android/hardware/media/c2/FrameData.aidl b/staging/c2/aidl/android/hardware/media/c2/FrameData.aidl similarity index 99% rename from media/c2/aidl/android/hardware/media/c2/FrameData.aidl rename to staging/c2/aidl/android/hardware/media/c2/FrameData.aidl index 15c1b6d434..81c76be278 100644 --- a/media/c2/aidl/android/hardware/media/c2/FrameData.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/FrameData.aidl @@ -31,7 +31,6 @@ import android.hardware.media.c2.WorkOrdinal; * @note `FrameData` is the HIDL counterpart of `C2FrameData` in the Codec 2.0 * standard. */ -@VintfStability parcelable FrameData { /** List of frame flags */ /** diff --git a/media/c2/aidl/android/hardware/media/c2/IComponent.aidl b/staging/c2/aidl/android/hardware/media/c2/IComponent.aidl similarity index 99% rename from media/c2/aidl/android/hardware/media/c2/IComponent.aidl rename to staging/c2/aidl/android/hardware/media/c2/IComponent.aidl index b3390c3f4d..bea4b70f88 100644 --- a/media/c2/aidl/android/hardware/media/c2/IComponent.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/IComponent.aidl @@ -32,7 +32,6 @@ import android.hardware.media.c2.SurfaceSyncObj; * All methods in `IComponent` must not block. If a method call cannot be * completed in a timely manner, it must throw `Status::TIMED_OUT`. */ -@VintfStability interface IComponent { /** * The reference object from framwork to HAL C2BlockPool. diff --git a/media/c2/aidl/android/hardware/media/c2/IComponentInterface.aidl b/staging/c2/aidl/android/hardware/media/c2/IComponentInterface.aidl similarity index 98% rename from media/c2/aidl/android/hardware/media/c2/IComponentInterface.aidl rename to staging/c2/aidl/android/hardware/media/c2/IComponentInterface.aidl index 9db81e6139..4589115098 100644 --- a/media/c2/aidl/android/hardware/media/c2/IComponentInterface.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/IComponentInterface.aidl @@ -26,7 +26,6 @@ import android.hardware.media.c2.IConfigurable; * * An actual component exposes this interface via IComponent::getInterface(). */ -@VintfStability interface IComponentInterface { /** * Returns the @ref IConfigurable instance associated to this component diff --git a/media/c2/aidl/android/hardware/media/c2/IComponentListener.aidl b/staging/c2/aidl/android/hardware/media/c2/IComponentListener.aidl similarity index 98% rename from media/c2/aidl/android/hardware/media/c2/IComponentListener.aidl rename to staging/c2/aidl/android/hardware/media/c2/IComponentListener.aidl index 75500b7271..786c8f1651 100644 --- a/media/c2/aidl/android/hardware/media/c2/IComponentListener.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/IComponentListener.aidl @@ -23,13 +23,11 @@ import android.hardware.media.c2.WorkBundle; /** * Callback interface for handling notifications from @ref IComponent. */ -@VintfStability oneway interface IComponentListener { /** * Identifying information for an input buffer previously queued to the * component via IComponent::queue(). */ - @VintfStability parcelable InputBuffer { /** * This value comes from `Work::input.ordinal.frameIndex` in a `Work` @@ -45,7 +43,6 @@ oneway interface IComponentListener { /** * Information about rendering of a frame to a `Surface`. */ - @VintfStability parcelable RenderedFrame { /** * Id of the `BufferQueue` containing the rendered buffer. diff --git a/media/c2/aidl/android/hardware/media/c2/IComponentStore.aidl b/staging/c2/aidl/android/hardware/media/c2/IComponentStore.aidl similarity index 98% rename from media/c2/aidl/android/hardware/media/c2/IComponentStore.aidl rename to staging/c2/aidl/android/hardware/media/c2/IComponentStore.aidl index 1435a7e4bc..d332bd3a1c 100644 --- a/media/c2/aidl/android/hardware/media/c2/IComponentStore.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/IComponentStore.aidl @@ -34,21 +34,17 @@ import android.hardware.media.c2.StructDescriptor; * @note This is an extension of version 1.1 of `IComponentStore`. The purpose * of the extension is to add support for blocking output buffer allocator. */ -@VintfStability interface IComponentStore { /** * Component traits. */ - @VintfStability parcelable ComponentTraits { - @VintfStability @Backing(type="int") enum Kind { OTHER = 0, DECODER, ENCODER, } - @VintfStability @Backing(type="int") enum Domain { OTHER = 0, diff --git a/media/c2/aidl/android/hardware/media/c2/IConfigurable.aidl b/staging/c2/aidl/android/hardware/media/c2/IConfigurable.aidl similarity index 99% rename from media/c2/aidl/android/hardware/media/c2/IConfigurable.aidl rename to staging/c2/aidl/android/hardware/media/c2/IConfigurable.aidl index 7fdb8259b8..9f79576ff5 100644 --- a/media/c2/aidl/android/hardware/media/c2/IConfigurable.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/IConfigurable.aidl @@ -28,7 +28,6 @@ import android.hardware.media.c2.SettingResult; * This interface must be supported in all states of the owning object, and must * not change the state of the owning object. */ -@VintfStability interface IConfigurable { /** * Return parcelable for config() interface. @@ -36,7 +35,6 @@ interface IConfigurable { * This includes the successful config settings along with the failure reasons of * the specified setting. */ - @VintfStability parcelable ConfigResult { Params params; SettingResult[] failures; diff --git a/media/c2/aidl/android/hardware/media/c2/InfoBuffer.aidl b/staging/c2/aidl/android/hardware/media/c2/InfoBuffer.aidl similarity index 98% rename from media/c2/aidl/android/hardware/media/c2/InfoBuffer.aidl rename to staging/c2/aidl/android/hardware/media/c2/InfoBuffer.aidl index 207c4d0c1a..7cfabcbc42 100644 --- a/media/c2/aidl/android/hardware/media/c2/InfoBuffer.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/InfoBuffer.aidl @@ -23,7 +23,6 @@ import android.hardware.media.c2.Buffer; * * This is a part of @ref FrameData. */ -@VintfStability parcelable InfoBuffer { /** * A C2Param structure index. diff --git a/media/c2/aidl/android/hardware/media/c2/ParamDescriptor.aidl b/staging/c2/aidl/android/hardware/media/c2/ParamDescriptor.aidl similarity index 99% rename from media/c2/aidl/android/hardware/media/c2/ParamDescriptor.aidl rename to staging/c2/aidl/android/hardware/media/c2/ParamDescriptor.aidl index 84c6acc7e4..716c07e6a4 100644 --- a/media/c2/aidl/android/hardware/media/c2/ParamDescriptor.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/ParamDescriptor.aidl @@ -21,7 +21,6 @@ package android.hardware.media.c2; * * @ref ParamDescriptor is returned by IConfigurable::querySupportedParams(). */ -@VintfStability parcelable ParamDescriptor { /** The list of bit flags for attrib */ /** diff --git a/media/c2/aidl/android/hardware/media/c2/ParamField.aidl b/staging/c2/aidl/android/hardware/media/c2/ParamField.aidl similarity index 98% rename from media/c2/aidl/android/hardware/media/c2/ParamField.aidl rename to staging/c2/aidl/android/hardware/media/c2/ParamField.aidl index 64a46bbef5..94f737da33 100644 --- a/media/c2/aidl/android/hardware/media/c2/ParamField.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/ParamField.aidl @@ -21,7 +21,6 @@ import android.hardware.media.c2.FieldId; /** * Reference to a field in a C2Param structure. */ -@VintfStability parcelable ParamField { /** * Index of the C2Param structure. diff --git a/media/c2/aidl/android/hardware/media/c2/ParamFieldValues.aidl b/staging/c2/aidl/android/hardware/media/c2/ParamFieldValues.aidl similarity index 98% rename from media/c2/aidl/android/hardware/media/c2/ParamFieldValues.aidl rename to staging/c2/aidl/android/hardware/media/c2/ParamFieldValues.aidl index 7b74c0ec34..4bb9a913a9 100644 --- a/media/c2/aidl/android/hardware/media/c2/ParamFieldValues.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/ParamFieldValues.aidl @@ -26,7 +26,6 @@ import android.hardware.media.c2.ParamField; * values object. This structure is used when reporting parameter configuration * failures and conflicts. */ -@VintfStability parcelable ParamFieldValues { /** * Reference to a field or a C2Param structure. diff --git a/media/c2/aidl/android/hardware/media/c2/Params.aidl b/staging/c2/aidl/android/hardware/media/c2/Params.aidl similarity index 98% rename from media/c2/aidl/android/hardware/media/c2/Params.aidl rename to staging/c2/aidl/android/hardware/media/c2/Params.aidl index 53b512cf91..3c1a321122 100644 --- a/media/c2/aidl/android/hardware/media/c2/Params.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/Params.aidl @@ -30,7 +30,6 @@ package android.hardware.media.c2; * - 4 bytes: size of the C2Param object (unsigned 4-byte integer). * - (size - 8) bytes: data of the C2Param object. */ -@VintfStability parcelable Params { byte[] params; } diff --git a/media/c2/aidl/android/hardware/media/c2/SettingResult.aidl b/staging/c2/aidl/android/hardware/media/c2/SettingResult.aidl similarity index 98% rename from media/c2/aidl/android/hardware/media/c2/SettingResult.aidl rename to staging/c2/aidl/android/hardware/media/c2/SettingResult.aidl index c2b9574457..a27014696c 100644 --- a/media/c2/aidl/android/hardware/media/c2/SettingResult.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/SettingResult.aidl @@ -22,12 +22,10 @@ import android.hardware.media.c2.ParamFieldValues; * Information describing the reason the parameter settings may fail, or may be * overridden. */ -@VintfStability parcelable SettingResult { /** * Failure code */ - @VintfStability @Backing(type="int") enum Failure { /** diff --git a/media/c2/aidl/android/hardware/media/c2/Status.aidl b/staging/c2/aidl/android/hardware/media/c2/Status.aidl similarity index 99% rename from media/c2/aidl/android/hardware/media/c2/Status.aidl rename to staging/c2/aidl/android/hardware/media/c2/Status.aidl index 58a24047e7..660db57df3 100644 --- a/media/c2/aidl/android/hardware/media/c2/Status.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/Status.aidl @@ -19,7 +19,6 @@ package android.hardware.media.c2; /** * Common return values for Codec2 operations. */ -@VintfStability parcelable Status { /** * Operation completed successfully. diff --git a/media/c2/aidl/android/hardware/media/c2/StructDescriptor.aidl b/staging/c2/aidl/android/hardware/media/c2/StructDescriptor.aidl similarity index 99% rename from media/c2/aidl/android/hardware/media/c2/StructDescriptor.aidl rename to staging/c2/aidl/android/hardware/media/c2/StructDescriptor.aidl index 00359041f0..5d6d2ebc42 100644 --- a/media/c2/aidl/android/hardware/media/c2/StructDescriptor.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/StructDescriptor.aidl @@ -22,7 +22,6 @@ import android.hardware.media.c2.FieldDescriptor; * Description of a C2Param structure. It consists of an index and a list of * `FieldDescriptor`s. */ -@VintfStability parcelable StructDescriptor { /** * Index of the structure. diff --git a/media/c2/aidl/android/hardware/media/c2/SurfaceSyncObj.aidl b/staging/c2/aidl/android/hardware/media/c2/SurfaceSyncObj.aidl similarity index 99% rename from media/c2/aidl/android/hardware/media/c2/SurfaceSyncObj.aidl rename to staging/c2/aidl/android/hardware/media/c2/SurfaceSyncObj.aidl index d20e10273f..2e7330e90a 100644 --- a/media/c2/aidl/android/hardware/media/c2/SurfaceSyncObj.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/SurfaceSyncObj.aidl @@ -22,7 +22,6 @@ import android.hardware.common.NativeHandle; * output buffers. This keeps # of dequeued buffers from Surface less than * configured max # of dequeued buffers all the time. */ -@VintfStability parcelable SurfaceSyncObj { /** * ASharedMemory for synchronization data. Layout is below diff --git a/media/c2/aidl/android/hardware/media/c2/ValueRange.aidl b/staging/c2/aidl/android/hardware/media/c2/ValueRange.aidl similarity index 99% rename from media/c2/aidl/android/hardware/media/c2/ValueRange.aidl rename to staging/c2/aidl/android/hardware/media/c2/ValueRange.aidl index 9abcb7da2b..6707a25d9f 100644 --- a/media/c2/aidl/android/hardware/media/c2/ValueRange.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/ValueRange.aidl @@ -38,7 +38,6 @@ package android.hardware.media.c2; * The division in the formula may truncate the result if the data type of * these values is an integral type. */ -@VintfStability parcelable ValueRange { /** * Lower end of the range (inclusive). diff --git a/media/c2/aidl/android/hardware/media/c2/Work.aidl b/staging/c2/aidl/android/hardware/media/c2/Work.aidl similarity index 99% rename from media/c2/aidl/android/hardware/media/c2/Work.aidl rename to staging/c2/aidl/android/hardware/media/c2/Work.aidl index 4b8d696871..07324795e0 100644 --- a/media/c2/aidl/android/hardware/media/c2/Work.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/Work.aidl @@ -34,7 +34,6 @@ import android.hardware.media.c2.Worklet; * * `Work` is a part of @ref WorkBundle. */ -@VintfStability parcelable Work { /** * Additional work chain info not part of this work. diff --git a/media/c2/aidl/android/hardware/media/c2/WorkBundle.aidl b/staging/c2/aidl/android/hardware/media/c2/WorkBundle.aidl similarity index 99% rename from media/c2/aidl/android/hardware/media/c2/WorkBundle.aidl rename to staging/c2/aidl/android/hardware/media/c2/WorkBundle.aidl index 2125fdab6c..79b4cdbc6a 100644 --- a/media/c2/aidl/android/hardware/media/c2/WorkBundle.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/WorkBundle.aidl @@ -35,7 +35,6 @@ import android.hardware.media.c2.Work; * Codec 2.0 standard. The presence of #baseBlocks helps with minimizing the * data transferred over an IPC. */ -@VintfStability parcelable WorkBundle { /** * A list of Work items. diff --git a/media/c2/aidl/android/hardware/media/c2/WorkOrdinal.aidl b/staging/c2/aidl/android/hardware/media/c2/WorkOrdinal.aidl similarity index 99% rename from media/c2/aidl/android/hardware/media/c2/WorkOrdinal.aidl rename to staging/c2/aidl/android/hardware/media/c2/WorkOrdinal.aidl index 5708a90bc8..eb8b24427b 100644 --- a/media/c2/aidl/android/hardware/media/c2/WorkOrdinal.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/WorkOrdinal.aidl @@ -31,7 +31,6 @@ package android.hardware.media.c2; * @note `WorkOrdinal` is the HIDL counterpart of `C2WorkOrdinalStruct` in the * Codec 2.0 standard. */ -@VintfStability parcelable WorkOrdinal { /** * Timestamp in microseconds. diff --git a/media/c2/aidl/android/hardware/media/c2/Worklet.aidl b/staging/c2/aidl/android/hardware/media/c2/Worklet.aidl similarity index 99% rename from media/c2/aidl/android/hardware/media/c2/Worklet.aidl rename to staging/c2/aidl/android/hardware/media/c2/Worklet.aidl index 6b3ceac5a0..04c59c1761 100644 --- a/media/c2/aidl/android/hardware/media/c2/Worklet.aidl +++ b/staging/c2/aidl/android/hardware/media/c2/Worklet.aidl @@ -28,7 +28,6 @@ import android.hardware.media.c2.SettingResult; * a @ref Work object for each expected output before calling * IComponent::queue(). */ -@VintfStability parcelable Worklet { /** * Component id. (Input) From 543009b95eeb45e207b0ba7430dd3646330b4df1 Mon Sep 17 00:00:00 2001 From: Terry Guan Date: Fri, 10 Feb 2023 10:43:47 -0800 Subject: [PATCH 743/998] Added additional comments for vendor error codes Added documentation for vendor code of 0 as well as changing the value of vendor codes to be from 0x0001 to 0xffff Bug: 268748245 Test: manual Change-Id: I355524acc0094bbf3ecd5183df77cbeea82d55b1 --- .../aidl/android/hardware/automotive/vehicle/StatusCode.aidl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/StatusCode.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/StatusCode.aidl index 029b2aca5d..fd4b199bdb 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/StatusCode.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/StatusCode.aidl @@ -18,8 +18,9 @@ package android.hardware.automotive.vehicle; /** * Error codes used in vehicle HAL interface. System defined error codes will have the range from - * 0x00000000 to 0x0000ffff and vendor error codes will have the range from 0x0000 << 16 to - * 0xffff << 16. The error code is formatted as [VENDOR_ERROR] << 16 | [SYSTEM_ERROR] + * 0x0000 to 0xffff and vendor error codes will have the range from 0x0001 to 0xffff. The error code + * is formatted as [VENDOR_ERROR] << 16 | [SYSTEM_ERROR]. A vendor error code of 0 indicates vendor + * code not set. */ @VintfStability @Backing(type="int") From 68175631b6fdd55b95afafeff7b030d9a2610f21 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Tue, 14 Feb 2023 13:52:01 -0800 Subject: [PATCH 744/998] Add missing documentation in HAL for enum states This change for WindshieldWipersState, VehicleOilLevel, and TrailerState aligns the documentation in the HAL with the API level. Bug: 269329431 Test: presubmit Change-Id: I115ac9a6f03c051b0de526e60a44dca41220533f --- .../automotive/vehicle/TrailerState.aidl | 18 ++++++++++++++++-- .../automotive/vehicle/VehicleOilLevel.aidl | 17 ++++++++++++++++- .../vehicle/WindshieldWipersState.aidl | 7 ++++++- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/TrailerState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/TrailerState.aidl index fd420626d6..ef653746c2 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/TrailerState.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/TrailerState.aidl @@ -17,14 +17,28 @@ package android.hardware.automotive.vehicle; /** - * Used by the trailer present property to enumerate the current state - * of the trailer. + * Used to enumerate the current state of VehicleProperty#TRAILER_PRESENT. */ @VintfStability @Backing(type="int") enum TrailerState { + /** + * This state is used as an alternative for any TrailerState value that is not defined in the + * platform. Ideally, implementations of VehicleProperty#TRAILER_PRESENT should not use this + * state. The framework can use this field to remain backwards compatible if TrailerState is + * extended to include additional states. + */ UNKNOWN = 0, + /** + * A trailer is not attached to the vehicle. + */ NOT_PRESENT = 1, + /** + * A trailer is attached to the vehicle. + */ PRESENT = 2, + /** + * The state of the trailer is not available due to an error. + */ ERROR = 3, } diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleOilLevel.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleOilLevel.aidl index bf3c858c55..3c722bad8e 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleOilLevel.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleOilLevel.aidl @@ -16,15 +16,30 @@ package android.hardware.automotive.vehicle; +/** + * Used to enumerate the current level of VehicleProperty#ENGINE_OIL_LEVEL. + */ @VintfStability @Backing(type="int") enum VehicleOilLevel { /** - * Oil level values + * The oil level of the engine is critically low, so the vehicle may be unsafe to drive. */ CRITICALLY_LOW = 0, + /** + * The oil level of the engine is low and needs to be replaced. + */ LOW = 1, + /** + * The oil level of the engine is normal for the vehicle. + */ NORMAL = 2, + /** + * The oil level of the engine is high, so the vehicle may be unsafe to drive. + */ HIGH = 3, + /** + * This value represents an error when retrieving the oil level of the engine. + */ ERROR = 4, } diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/WindshieldWipersState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/WindshieldWipersState.aidl index 5873065261..820fcc8659 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/WindshieldWipersState.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/WindshieldWipersState.aidl @@ -30,9 +30,14 @@ enum WindshieldWipersState { * WindshieldWipersState is extended to include additional states. */ OTHER = 0, + /** + * This state indicates the windshield wipers are currently off. If + * VehicleProperty#WINDSHIELD_WIPERS_SWITCH is implemented, then it may be set to any of the + * following modes: OFF or AUTO. + */ OFF = 1, /** - * This state indicates windshield wipers are currently on. If + * This state indicates the windshield wipers are currently on. If * VehicleProperty#WINDSHIELD_WIPERS_SWITCH is implemented, then it may be set to any of the * following modes: MIST, INTERMITTENT_LEVEL_*, CONTINUOUS_LEVEL_*, or AUTO. */ From 9bf67194db762e3d6c4e70234c64d7ad4d36c152 Mon Sep 17 00:00:00 2001 From: ziyiw Date: Tue, 31 Jan 2023 17:54:15 +0000 Subject: [PATCH 745/998] Add the unit of slot duration to its name. Test: compile Bug: 266980744 Change-Id: I1418b7a1b9e938b03e785cb1b2b4c92a8f4c9ecf --- .../hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl | 2 +- .../hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl index b9ac7b9861..1f84636af1 100644 --- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl @@ -49,6 +49,6 @@ enum UwbVendorCapabilityTlvTypes { SUPPORTED_RANGE_DATA_NTF_CONFIG = 229, SUPPORTED_RSSI_REPORTING = 230, SUPPORTED_DIAGNOSTICS = 231, - SUPPORTED_MIN_SLOT_DURATION = 232, + SUPPORTED_MIN_SLOT_DURATION_MS = 232, SUPPORTED_MAX_RANGING_SESSION_NUMBER = 233, } diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl index a3bb7a62ec..32b1e914d0 100644 --- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl +++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl @@ -188,7 +188,7 @@ enum UwbVendorCapabilityTlvTypes { /** * 4 byte value to indicate supported min slot duration in ms. */ - SUPPORTED_MIN_SLOT_DURATION = 0xE8, + SUPPORTED_MIN_SLOT_DURATION_MS = 0xE8, /** * Int value to indicate supported max number of fira ranging sessions From e7613eb815ae61c3d7cba332ae9149f43b15540b Mon Sep 17 00:00:00 2001 From: ziyiw Date: Fri, 27 Jan 2023 23:08:23 +0000 Subject: [PATCH 746/998] [UWB HAL] Add new capability and reason code to show the channels that are capable for AoA. Test: compile Bug: 242951474 Change-Id: I307062b7ded64014327549e8c4a717d53e97f54b --- uwb/aidl/Android.bp | 5 ++ .../android.hardware.uwb.fira_android/2/.hash | 1 + .../UwbVendorCapabilityTlvTypes.aidl | 55 ++++++++++++++++++ .../UwbVendorCapabilityTlvValues.aidl | 56 +++++++++++++++++++ .../fira_android/UwbVendorGidAndroidOids.aidl | 40 +++++++++++++ .../uwb/fira_android/UwbVendorGids.aidl | 38 +++++++++++++ .../fira_android/UwbVendorReasonCodes.aidl | 38 +++++++++++++ .../UwbVendorSessionAppConfigTlvTypes.aidl | 48 ++++++++++++++++ .../UwbVendorSessionAppConfigTlvValues.aidl | 38 +++++++++++++ .../UwbVendorSessionInitSessionType.aidl | 38 +++++++++++++ .../fira_android/UwbVendorStatusCodes.aidl | 39 +++++++++++++ .../UwbVendorCapabilityTlvTypes.aidl | 1 + .../fira_android/UwbVendorReasonCodes.aidl | 38 +++++++++++++ .../UwbVendorCapabilityTlvTypes.aidl | 14 +++++ .../fira_android/UwbVendorReasonCodes.aidl | 34 +++++++++++ 15 files changed, 483 insertions(+) create mode 100644 uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/.hash create mode 100644 uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl create mode 100644 uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl create mode 100644 uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl create mode 100644 uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorGids.aidl create mode 100644 uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl create mode 100644 uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl create mode 100644 uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvValues.aidl create mode 100644 uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorSessionInitSessionType.aidl create mode 100644 uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl create mode 100644 uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl create mode 100644 uwb/aidl/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl diff --git a/uwb/aidl/Android.bp b/uwb/aidl/Android.bp index 398172470d..aacb70ef79 100755 --- a/uwb/aidl/Android.bp +++ b/uwb/aidl/Android.bp @@ -75,6 +75,11 @@ aidl_interface { version: "1", imports: [], }, + { + version: "2", + imports: [], + }, + ], } diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/.hash b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/.hash new file mode 100644 index 0000000000..856fa7c27f --- /dev/null +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/.hash @@ -0,0 +1 @@ +39791e3a4bb9892a340e94e44860048624d2f66e diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl new file mode 100644 index 0000000000..e2c06e563d --- /dev/null +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2021 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 -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.hardware.uwb.fira_android; +@Backing(type="int") @VintfStability +enum UwbVendorCapabilityTlvTypes { + SUPPORTED_POWER_STATS_QUERY = 192, + CCC_SUPPORTED_CHAPS_PER_SLOT = 160, + CCC_SUPPORTED_SYNC_CODES = 161, + CCC_SUPPORTED_HOPPING_CONFIG_MODES_AND_SEQUENCES = 162, + CCC_SUPPORTED_CHANNELS = 163, + CCC_SUPPORTED_VERSIONS = 164, + CCC_SUPPORTED_UWB_CONFIGS = 165, + CCC_SUPPORTED_PULSE_SHAPE_COMBOS = 166, + CCC_SUPPORTED_RAN_MULTIPLIER = 167, + CCC_SUPPORTED_MAX_RANGING_SESSION_NUMBER = 168, + SUPPORTED_AOA_RESULT_REQ_ANTENNA_INTERLEAVING = 227, + SUPPORTED_MIN_RANGING_INTERVAL_MS = 228, + SUPPORTED_RANGE_DATA_NTF_CONFIG = 229, + SUPPORTED_RSSI_REPORTING = 230, + SUPPORTED_DIAGNOSTICS = 231, + SUPPORTED_MIN_SLOT_DURATION_MS = 232, + SUPPORTED_MAX_RANGING_SESSION_NUMBER = 233, + SUPPORTED_CHANNELS_AOA = 234, +} diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl new file mode 100644 index 0000000000..0e33f70221 --- /dev/null +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2021 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 -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.hardware.uwb.fira_android; +@Backing(type="long") @VintfStability +enum UwbVendorCapabilityTlvValues { + UWB_CONFIG_0 = 0, + UWB_CONFIG_1 = 1, + PULSE_SHAPE_SYMMETRICAL_ROOT_RAISED_COSINE = 0, + PULSE_SHAPE_PRECURSOR_FREE = 1, + PULSE_SHAPE_PRECURSOR_FREE_SPECIAL = 2, + CHAPS_PER_SLOT_3 = 1, + CHAPS_PER_SLOT_4 = 2, + CHAPS_PER_SLOT_6 = 4, + CHAPS_PER_SLOT_8 = 8, + CHAPS_PER_SLOT_9 = 16, + CHAPS_PER_SLOT_12 = 32, + CHAPS_PER_SLOT_24 = 64, + HOPPING_SEQUENCE_DEFAULT = 16, + HOPPING_SEQUENCE_AES = 8, + HOPPING_CONFIG_MODE_NONE = 128, + HOPPING_CONFIG_MODE_CONTINUOUS = 64, + HOPPING_CONFIG_MODE_ADAPTIVE = 32, + CCC_CHANNEL_5 = 1, + CCC_CHANNEL_9 = 2, +} diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl new file mode 100644 index 0000000000..fbcfbff667 --- /dev/null +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorGidAndroidOids.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.uwb.fira_android; +@Backing(type="byte") @VintfStability +enum UwbVendorGidAndroidOids { + ANDROID_GET_POWER_STATS = 0, + ANDROID_SET_COUNTRY_CODE = 1, + ANDROID_RANGE_DIAGNOSTICS = 2, +} diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorGids.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorGids.aidl new file mode 100644 index 0000000000..5515c67961 --- /dev/null +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorGids.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2021 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 -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.hardware.uwb.fira_android; +@Backing(type="byte") @VintfStability +enum UwbVendorGids { + ANDROID = 12, +} diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl new file mode 100644 index 0000000000..dc2252b789 --- /dev/null +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.uwb.fira_android; +@Backing(type="int") @VintfStability +enum UwbVendorReasonCodes { + REASON_ERROR_INVALID_CHANNEL_WITH_AOA = 128, +} diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl new file mode 100644 index 0000000000..8413f06d0f --- /dev/null +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2021 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 -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.hardware.uwb.fira_android; +@Backing(type="int") @VintfStability +enum UwbVendorSessionAppConfigTlvTypes { + CCC_HOP_MODE_KEY = 160, + CCC_UWB_TIME0 = 161, + CCC_RANGING_PROTOCOL_VER = 163, + CCC_UWB_CONFIG_ID = 164, + CCC_PULSESHAPE_COMBO = 165, + CCC_URSK_TTL = 166, + NB_OF_RANGE_MEASUREMENTS = 227, + NB_OF_AZIMUTH_MEASUREMENTS = 228, + NB_OF_ELEVATION_MEASUREMENTS = 229, + ENABLE_DIAGNOSTICS = 232, + DIAGRAMS_FRAME_REPORTS_FIELDS = 233, +} diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvValues.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvValues.aidl new file mode 100644 index 0000000000..a7f487bcd2 --- /dev/null +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvValues.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2021 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 -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.hardware.uwb.fira_android; +@Backing(type="int") @VintfStability +enum UwbVendorSessionAppConfigTlvValues { + AOA_RESULT_REQ_ANTENNA_INTERLEAVING = 240, +} diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorSessionInitSessionType.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorSessionInitSessionType.aidl new file mode 100644 index 0000000000..30a0a1b98f --- /dev/null +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorSessionInitSessionType.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2021 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 -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.hardware.uwb.fira_android; +@Backing(type="int") @VintfStability +enum UwbVendorSessionInitSessionType { + CCC = 160, +} diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl new file mode 100644 index 0000000000..2f534df10c --- /dev/null +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.uwb.fira_android; +@Backing(type="byte") @VintfStability +enum UwbVendorStatusCodes { + STATUS_ERROR_CCC_SE_BUSY = 80, + STATUS_ERROR_CCC_LIFECYCLE = 81, +} diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl index 1f84636af1..e2c06e563d 100644 --- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl @@ -51,4 +51,5 @@ enum UwbVendorCapabilityTlvTypes { SUPPORTED_DIAGNOSTICS = 231, SUPPORTED_MIN_SLOT_DURATION_MS = 232, SUPPORTED_MAX_RANGING_SESSION_NUMBER = 233, + SUPPORTED_CHANNELS_AOA = 234, } diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl new file mode 100644 index 0000000000..dc2252b789 --- /dev/null +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.uwb.fira_android; +@Backing(type="int") @VintfStability +enum UwbVendorReasonCodes { + REASON_ERROR_INVALID_CHANNEL_WITH_AOA = 128, +} diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl index 32b1e914d0..bf59318085 100644 --- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl +++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl @@ -194,4 +194,18 @@ enum UwbVendorCapabilityTlvTypes { * Int value to indicate supported max number of fira ranging sessions */ SUPPORTED_MAX_RANGING_SESSION_NUMBER = 0xE9, + + /** + * 2 byte bitmask to indicate the channels that support AoA. + * Each "1" in this bitmap corresponds to a specific UWB channel where: + * 0x01 = "Channel 5", + * 0x02 = "Channel 6", + * 0x04 = "Channel 8", + * 0x08 = "Channel 9", + * 0x10 = "Channel 10", + * 0x20 = "Channel 12", + * 0x40 = "Channel 13", + * 0x80 = "Channel 14" + */ + SUPPORTED_CHANNELS_AOA = 0xEA, } diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl new file mode 100644 index 0000000000..ae203a3112 --- /dev/null +++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl @@ -0,0 +1,34 @@ +/* + * 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. + */ + +package android.hardware.uwb.fira_android; + +/** + * Android specific vendor reason codes should be defined here. + * + */ +@VintfStability +@Backing(type="int") +enum UwbVendorReasonCodes { + /** + * Use values from the vendor specific reason code range: 0x80 – 0xFF defined in Table 16 of + * UCI specification. + */ + + /** Fira specific */ + /** The channel requested is not available for AoA */ + REASON_ERROR_INVALID_CHANNEL_WITH_AOA = 0x80, +} From a60e7a43a90ef990f9d5426df04411025ccbc82e Mon Sep 17 00:00:00 2001 From: AleX Pelosi Date: Fri, 17 Feb 2023 00:15:59 +0000 Subject: [PATCH 747/998] health: batteryStateOfHealth should be a property Move batteryStateOfHealth to HealthData Bug: 251427118 Test: m android.hardware.health-update-api Change-Id: I8835489f5c3d75ffc48e198a63eafc52b555ccd4 Signed-off-by: AleX Pelosi --- .../hardware/health/BatteryCapacityLevel.aidl | 14 +++++++------- .../android/hardware/health/BatteryHealthData.aidl | 1 + .../android/hardware/health/HealthInfo.aidl | 3 +-- .../android/hardware/health/BatteryHealthData.aidl | 7 +++++++ .../aidl/android/hardware/health/HealthInfo.aidl | 7 ------- .../aidl/vts/functional/VtsHalHealthTargetTest.cpp | 4 ++++ 6 files changed, 20 insertions(+), 16 deletions(-) diff --git a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryCapacityLevel.aidl b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryCapacityLevel.aidl index e5438865c1..4d705887e5 100644 --- a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryCapacityLevel.aidl +++ b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryCapacityLevel.aidl @@ -34,11 +34,11 @@ package android.hardware.health; @Backing(type="int") @VintfStability enum BatteryCapacityLevel { - UNSUPPORTED = -1, - UNKNOWN = 0, - CRITICAL = 1, - LOW = 2, - NORMAL = 3, - HIGH = 4, - FULL = 5, + UNSUPPORTED = (-1) /* -1 */, + UNKNOWN, + CRITICAL, + LOW, + NORMAL, + HIGH, + FULL, } diff --git a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealthData.aidl b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealthData.aidl index d523fadf13..2dd01b146f 100644 --- a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealthData.aidl +++ b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealthData.aidl @@ -36,4 +36,5 @@ package android.hardware.health; parcelable BatteryHealthData { long batteryManufacturingDateSeconds; long batteryFirstUsageSeconds; + long batteryStateOfHealth; } diff --git a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/HealthInfo.aidl b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/HealthInfo.aidl index 664cc70e55..bfa14758f3 100644 --- a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/HealthInfo.aidl +++ b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/HealthInfo.aidl @@ -57,9 +57,8 @@ parcelable HealthInfo { android.hardware.health.BatteryCapacityLevel batteryCapacityLevel; long batteryChargeTimeToFullNowSeconds; int batteryFullChargeDesignCapacityUah; - int batteryStateOfHealth; android.hardware.health.BatteryChargingState chargingState; android.hardware.health.BatteryChargingPolicy chargingPolicy; @nullable android.hardware.health.BatteryHealthData batteryHealthData; - const int BATTERY_CHARGE_TIME_TO_FULL_NOW_SECONDS_UNSUPPORTED = -1; + const int BATTERY_CHARGE_TIME_TO_FULL_NOW_SECONDS_UNSUPPORTED = (-1) /* -1 */; } diff --git a/health/aidl/android/hardware/health/BatteryHealthData.aidl b/health/aidl/android/hardware/health/BatteryHealthData.aidl index fb17f63ab9..594bcce576 100644 --- a/health/aidl/android/hardware/health/BatteryHealthData.aidl +++ b/health/aidl/android/hardware/health/BatteryHealthData.aidl @@ -29,4 +29,11 @@ parcelable BatteryHealthData { * The date of first usage is reported in epoch. */ long batteryFirstUsageSeconds; + /** + * Measured battery state of health (remaining estimate full charge capacity + * relative to the rated capacity in %). + * Value must be 0 if batteryStatus is UNKNOWN. + * Otherwise, value must be in the range 0 to 100. + */ + long batteryStateOfHealth; } diff --git a/health/aidl/android/hardware/health/HealthInfo.aidl b/health/aidl/android/hardware/health/HealthInfo.aidl index 238f5242da..af84089598 100644 --- a/health/aidl/android/hardware/health/HealthInfo.aidl +++ b/health/aidl/android/hardware/health/HealthInfo.aidl @@ -136,13 +136,6 @@ parcelable HealthInfo { * Value must be less than 100 000 000 µAh if known. */ int batteryFullChargeDesignCapacityUah; - /** - * Measured battery state of health (remaining estimate full charge capacity - * relative to the rated capacity in %). - * Value must be 0 if batteryStatus is UNKNOWN. - * Otherwise, value must be in the range 0 to 100. - */ - int batteryStateOfHealth; /** * Battery charging state */ diff --git a/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp b/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp index 6506ea2359..69d4789727 100644 --- a/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp +++ b/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp @@ -278,6 +278,10 @@ MATCHER(IsValidHealthData, "") { *result_listener << " for batteryFirstUsageSeconds."; return false; } + if (!ExplainMatchResult(Ge(-1), arg.batteryStateOfHealth, result_listener)) { + *result_listener << " for batteryStateOfHealth."; + return false; + } return true; } From cb34a1dc4d534b1afd1cadebd0a27aa01c27acee Mon Sep 17 00:00:00 2001 From: Donnie Pollitz Date: Fri, 3 Feb 2023 11:32:31 +0100 Subject: [PATCH 748/998] Update Keymint tags to include 2nd IMEI Bug: 265381212 Bug: 265199825 Test: Ran KM VTS suites Change-Id: Ice3c4c942735f9e2886e7b826e3fd44b792629e2 --- security/keymint/support/include/keymint_support/keymint_tags.h | 1 + 1 file changed, 1 insertion(+) diff --git a/security/keymint/support/include/keymint_support/keymint_tags.h b/security/keymint/support/include/keymint_support/keymint_tags.h index 5b2a6f32e1..823899a0a3 100644 --- a/security/keymint/support/include/keymint_support/keymint_tags.h +++ b/security/keymint/support/include/keymint_support/keymint_tags.h @@ -77,6 +77,7 @@ DECLARE_TYPED_TAG(ATTESTATION_CHALLENGE); DECLARE_TYPED_TAG(ATTESTATION_ID_BRAND); DECLARE_TYPED_TAG(ATTESTATION_ID_DEVICE); DECLARE_TYPED_TAG(ATTESTATION_ID_IMEI); +DECLARE_TYPED_TAG(ATTESTATION_ID_SECOND_IMEI); DECLARE_TYPED_TAG(ATTESTATION_ID_MANUFACTURER); DECLARE_TYPED_TAG(ATTESTATION_ID_MEID); DECLARE_TYPED_TAG(ATTESTATION_ID_PRODUCT); From 2be1f2688cef3cb287ce8d832bc4607a7e705231 Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Wed, 15 Feb 2023 20:56:56 +0000 Subject: [PATCH 749/998] Wifi: Add support to query and use driver advertised interface combination Interface combinations in legacy-hal is predefined with 'WIFI_HAL_INTERFACE_COMBINATIONS' build flag. This change allows the WiFi HAL to request all the possible interface concurrency combinations via vendor HAL API, wifi_get_supported_iface_concurrency_matrix(). Thus build time dependency can be removed by querying the combination at runtime. Bug: 249351396 Change-Id: I3bc85ac013490949aab71a00f60028bf5daee68c Merged-In: I3bc85ac013490949aab71a00f60028bf5daee68c Test: Build successfully Signed-off-by: Purushottam Kushwaha (cherry picked from commit f68b9a270973151b7f78882db383d81c0c5a9145) --- wifi/aidl/default/aidl_struct_util.cpp | 58 +++++++++++++++++++++ wifi/aidl/default/aidl_struct_util.h | 2 + wifi/aidl/default/wifi_chip.cpp | 31 +++++++++++ wifi/aidl/default/wifi_chip.h | 2 + wifi/aidl/default/wifi_legacy_hal.cpp | 8 +++ wifi/aidl/default/wifi_legacy_hal.h | 2 + wifi/aidl/default/wifi_legacy_hal_stubs.cpp | 1 + 7 files changed, 104 insertions(+) diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index efd6598d62..d3cf7bf60a 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -3300,6 +3300,64 @@ uint32_t convertAidlChannelCategoryToLegacy(uint32_t aidl_channel_category_mask) return channel_category_mask; } +bool convertLegacyIfaceMaskToIfaceConcurrencyType(u32 mask, + std::vector* types) { + if (!mask) return false; + +#ifndef BIT +#define BIT(x) (1 << (x)) +#endif + if (mask & BIT(WIFI_INTERFACE_TYPE_STA)) types->push_back(IfaceConcurrencyType::STA); + if (mask & BIT(WIFI_INTERFACE_TYPE_AP)) types->push_back(IfaceConcurrencyType::AP); + if (mask & BIT(WIFI_INTERFACE_TYPE_AP_BRIDGED)) + types->push_back(IfaceConcurrencyType::AP_BRIDGED); + if (mask & BIT(WIFI_INTERFACE_TYPE_P2P)) types->push_back(IfaceConcurrencyType::P2P); + if (mask & BIT(WIFI_INTERFACE_TYPE_NAN)) types->push_back(IfaceConcurrencyType::NAN_IFACE); + + return true; +} + +bool convertLegacyIfaceCombinationsMatrixToChipMode( + legacy_hal::wifi_iface_concurrency_matrix& legacy_matrix, IWifiChip::ChipMode* chip_mode) { + if (!chip_mode) { + LOG(ERROR) << "chip_mode is null"; + return false; + } + *chip_mode = {}; + + int num_combinations = legacy_matrix.num_iface_combinations; + std::vector driver_Combinations_vec; + if (!num_combinations) { + LOG(ERROR) << "zero iface combinations"; + return false; + } + + for (int i = 0; i < num_combinations; i++) { + IWifiChip::ChipConcurrencyCombination chipComb; + std::vector limits; + wifi_iface_combination* comb = &legacy_matrix.iface_combinations[i]; + if (!comb->num_iface_limits) continue; + for (u32 j = 0; j < comb->num_iface_limits; j++) { + IWifiChip::ChipConcurrencyCombinationLimit chipLimit; + chipLimit.maxIfaces = comb->iface_limits[j].max_limit; + std::vector types; + if (!convertLegacyIfaceMaskToIfaceConcurrencyType(comb->iface_limits[j].iface_mask, + &types)) { + LOG(ERROR) << "Failed to convert from iface_mask:" + << comb->iface_limits[j].iface_mask; + return false; + } + chipLimit.types = types; + limits.push_back(chipLimit); + } + chipComb.limits = limits; + driver_Combinations_vec.push_back(chipComb); + } + + chip_mode->availableCombinations = driver_Combinations_vec; + return true; +} + } // namespace aidl_struct_util } // namespace wifi } // namespace hardware diff --git a/wifi/aidl/default/aidl_struct_util.h b/wifi/aidl/default/aidl_struct_util.h index 904ba81ad1..208b7344da 100644 --- a/wifi/aidl/default/aidl_struct_util.h +++ b/wifi/aidl/default/aidl_struct_util.h @@ -67,6 +67,8 @@ bool convertLegacyRadioCombinationsMatrixToAidl( WifiRadioCombinationMatrix* aidl_matrix); WifiBand convertLegacyMacBandToAidlWifiBand(uint32_t band); WifiAntennaMode convertLegacyAntennaConfigurationToAidl(uint32_t antenna_cfg); +bool convertLegacyIfaceCombinationsMatrixToChipMode( + legacy_hal::wifi_iface_concurrency_matrix& legacy_matrix, IWifiChip::ChipMode* chip_mode); // STA iface conversion methods. bool convertLegacyFeaturesToAidlStaCapabilities(uint64_t legacy_feature_set, uint32_t* aidl_caps); diff --git a/wifi/aidl/default/wifi_chip.cpp b/wifi/aidl/default/wifi_chip.cpp index b4c2ccdbb9..bb3eaf0dad 100644 --- a/wifi/aidl/default/wifi_chip.cpp +++ b/wifi/aidl/default/wifi_chip.cpp @@ -377,6 +377,35 @@ WifiChip::WifiChip(int32_t chip_id, bool is_primary, debug_ring_buffer_cb_registered_(false), subsystemCallbackHandler_(handler) { setActiveWlanIfaceNameProperty(kNoActiveWlanIfaceNamePropertyValue); + using_dynamic_iface_combination_ = false; +} + +void WifiChip::retrieveDynamicIfaceCombination() { + if (using_dynamic_iface_combination_) return; + + legacy_hal::wifi_iface_concurrency_matrix legacy_matrix; + legacy_hal::wifi_error legacy_status; + + std::tie(legacy_status, legacy_matrix) = + legacy_hal_.lock()->getSupportedIfaceConcurrencyMatrix(); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + LOG(ERROR) << "Failed to get SupportedIfaceCombinations matrix from legacy HAL: " + << legacyErrorToString(legacy_status); + return; + } + + IWifiChip::ChipMode aidl_chip_mode; + if (!aidl_struct_util::convertLegacyIfaceCombinationsMatrixToChipMode(legacy_matrix, + &aidl_chip_mode)) { + LOG(ERROR) << "Failed convertLegacyIfaceCombinationsMatrixToChipMode() "; + return; + } + + LOG(INFO) << "Reloading iface concurrency combination from driver"; + aidl_chip_mode.id = feature_flags::chip_mode_ids::kV3; + modes_.clear(); + modes_.push_back(aidl_chip_mode); + using_dynamic_iface_combination_ = true; } std::shared_ptr WifiChip::create( @@ -1509,6 +1538,8 @@ ndk::ScopedAStatus WifiChip::handleChipConfiguration( version_info.first.firmwareDescription.c_str()); property_set("vendor.wlan.driver.version", version_info.first.driverDescription.c_str()); } + // Get the driver supported interface combination. + retrieveDynamicIfaceCombination(); return ndk::ScopedAStatus::ok(); } diff --git a/wifi/aidl/default/wifi_chip.h b/wifi/aidl/default/wifi_chip.h index ff4ee9ce90..def5da0a6d 100644 --- a/wifi/aidl/default/wifi_chip.h +++ b/wifi/aidl/default/wifi_chip.h @@ -262,6 +262,7 @@ class WifiChip : public BnWifiChip { getSupportedRadioCombinationsMatrixInternal(); std::pair getWifiChipCapabilitiesInternal(); ndk::ScopedAStatus setMloModeInternal(const ChipMloMode in_mode); + void retrieveDynamicIfaceCombination(); void setWeakPtr(std::weak_ptr ptr); int32_t chip_id_; @@ -283,6 +284,7 @@ class WifiChip : public BnWifiChip { // registration mechanism. Use this to check if we have already // registered a callback. bool debug_ring_buffer_cb_registered_; + bool using_dynamic_iface_combination_; aidl_callback_util::AidlCallbackHandler event_cb_handler_; std::weak_ptr weak_ptr_this_; diff --git a/wifi/aidl/default/wifi_legacy_hal.cpp b/wifi/aidl/default/wifi_legacy_hal.cpp index dbf5a68967..209670bc69 100644 --- a/wifi/aidl/default/wifi_legacy_hal.cpp +++ b/wifi/aidl/default/wifi_legacy_hal.cpp @@ -1885,6 +1885,14 @@ wifi_error WifiLegacyHal::setMloMode(wifi_mlo_mode mode) { return global_func_table_.wifi_set_mlo_mode(global_handle_, mode); } +std::pair +WifiLegacyHal::getSupportedIfaceConcurrencyMatrix() { + wifi_iface_concurrency_matrix iface_concurrency_matrix; + wifi_error status = global_func_table_.wifi_get_supported_iface_concurrency_matrix( + global_handle_, &iface_concurrency_matrix); + return {status, iface_concurrency_matrix}; +} + void WifiLegacyHal::invalidate() { global_handle_ = nullptr; iface_name_to_handle_.clear(); diff --git a/wifi/aidl/default/wifi_legacy_hal.h b/wifi/aidl/default/wifi_legacy_hal.h index 1d59b17b8a..5168a8bccf 100644 --- a/wifi/aidl/default/wifi_legacy_hal.h +++ b/wifi/aidl/default/wifi_legacy_hal.h @@ -290,6 +290,7 @@ using ::WIFI_ERROR_UNINITIALIZED; using ::WIFI_ERROR_UNKNOWN; using ::wifi_gscan_capabilities; using ::wifi_hal_fn; +using ::wifi_iface_concurrency_matrix; using ::WIFI_INDOOR_CHANNEL; using ::wifi_information_element; using ::WIFI_INTERFACE_IBSS; @@ -779,6 +780,7 @@ class WifiLegacyHal { std::pair getWifiChipCapabilities(); wifi_error enableStaChannelForPeerNetwork(uint32_t channelCategoryEnableFlag); wifi_error setMloMode(wifi_mlo_mode mode); + std::pair getSupportedIfaceConcurrencyMatrix(); private: // Retrieve interface handles for all the available interfaces. diff --git a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp index 77d1cb5edc..b5196c9af6 100644 --- a/wifi/aidl/default/wifi_legacy_hal_stubs.cpp +++ b/wifi/aidl/default/wifi_legacy_hal_stubs.cpp @@ -178,6 +178,7 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { populateStubFor(&hal_fn->wifi_nan_resume_request); populateStubFor(&hal_fn->wifi_set_scan_mode); populateStubFor(&hal_fn->wifi_set_mlo_mode); + populateStubFor(&hal_fn->wifi_get_supported_iface_concurrency_matrix); return true; } From 204e17171b4bbaf171e7565d59143f3cee0a70b9 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Thu, 16 Feb 2023 18:10:17 +0000 Subject: [PATCH 750/998] Free version buffer in the Vendor HAL's XML parsing logic. Fixes a minor memory leak that results from not freeing that buffer. Bug: 269520490 Test: Manual test 1. Create several XML files under /vendor/etc/wifi/vendor_hals 2. Modify the codepath to run the initVendorHalsDescriptorList method (does not run by default on Pixel). 3. Check that the XML parsing logic is working as intended. Change-Id: I42944169b70c759998d94e8523d2aa55d0366ffd --- wifi/aidl/default/wifi_legacy_hal_factory.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wifi/aidl/default/wifi_legacy_hal_factory.cpp b/wifi/aidl/default/wifi_legacy_hal_factory.cpp index 60f81ed764..0359d6f13f 100644 --- a/wifi/aidl/default/wifi_legacy_hal_factory.cpp +++ b/wifi/aidl/default/wifi_legacy_hal_factory.cpp @@ -128,7 +128,7 @@ bool WifiLegacyHalFactory::initLinkedHalFunctionTable(wifi_hal_fn* hal_fn) { void WifiLegacyHalFactory::initVendorHalsDescriptorList() { xmlDocPtr xml; xmlNodePtr node, cnode; - char* version; + char* version = NULL; std::string path; xmlChar* value; wifi_hal_lib_desc desc; @@ -200,6 +200,10 @@ void WifiLegacyHalFactory::initVendorHalsDescriptorList() { } skip: xmlFreeDoc(xml); + if (version) { + xmlFree(version); + version = NULL; + } } ::closedir(dirPtr); } From a9a3ec3e1a7e681e940534567ac80e8a7ab6691f Mon Sep 17 00:00:00 2001 From: Eric Jeong Date: Wed, 15 Feb 2023 12:48:45 -0800 Subject: [PATCH 751/998] Add PASSENGER_DISPLAY_BRIGHTNESS property - DISPLAY_BRIGHTNESS can send a brightness to be applied on one display. - On multi-display devices, brightness of each display should be communicated separately to VHAL. - PASSENGER_DISPLAY_BRIGHTNESS is added to serve that purpose. Bug: 269186221 Test: build okay Change-Id: I749ecd451afc4f24039f6e594860f1cb0fcf3509 (cherry picked from commit b9748bad632e92d36f70c8800d388c5f48a7924c) Merged-In: I749ecd451afc4f24039f6e594860f1cb0fcf3509 --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 36 +++++++++++++++++-- 6 files changed, 38 insertions(+), 3 deletions(-) diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index d4ab0f7678..2335d6d564 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -119,6 +119,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::AP_POWER_STATE_REPORT, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::AP_POWER_BOOTUP_REASON, VehiclePropertyAccess::READ}, {VehicleProperty::DISPLAY_BRIGHTNESS, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::PER_DISPLAY_BRIGHTNESS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HW_KEY_INPUT, VehiclePropertyAccess::READ}, {VehicleProperty::HW_KEY_INPUT_V2, VehiclePropertyAccess::READ}, {VehicleProperty::HW_MOTION_INPUT, VehiclePropertyAccess::READ}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index d56de3f1ca..a0911c5ca0 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -119,6 +119,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::AP_POWER_STATE_REPORT, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::AP_POWER_BOOTUP_REASON, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::DISPLAY_BRIGHTNESS, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::PER_DISPLAY_BRIGHTNESS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HW_KEY_INPUT, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HW_KEY_INPUT_V2, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HW_MOTION_INPUT, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index caeb26676b..e9670c1e97 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -111,6 +111,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.AP_POWER_STATE_REPORT, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.AP_POWER_BOOTUP_REASON, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.DISPLAY_BRIGHTNESS, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.PER_DISPLAY_BRIGHTNESS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HW_KEY_INPUT, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.HW_KEY_INPUT_V2, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.HW_MOTION_INPUT, VehiclePropertyAccess.READ), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 0beab94381..2513e4ecd2 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -111,6 +111,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.AP_POWER_STATE_REPORT, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.AP_POWER_BOOTUP_REASON, VehiclePropertyChangeMode.STATIC), Map.entry(VehicleProperty.DISPLAY_BRIGHTNESS, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.PER_DISPLAY_BRIGHTNESS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HW_KEY_INPUT, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HW_KEY_INPUT_V2, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HW_MOTION_INPUT, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index cc06bf342b..a525ab0623 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -117,6 +117,7 @@ enum VehicleProperty { AP_POWER_STATE_REPORT = (((0x0A01 + 0x10000000) + 0x01000000) + 0x00410000) /* 289475073 */, AP_POWER_BOOTUP_REASON = (((0x0A02 + 0x10000000) + 0x01000000) + 0x00400000) /* 289409538 */, DISPLAY_BRIGHTNESS = (((0x0A03 + 0x10000000) + 0x01000000) + 0x00400000) /* 289409539 */, + PER_DISPLAY_BRIGHTNESS = (((0x0A04 + 0x10000000) + 0x01000000) + 0x00410000) /* 289475076 */, HW_KEY_INPUT = (((0x0A10 + 0x10000000) + 0x01000000) + 0x00410000) /* 289475088 */, HW_KEY_INPUT_V2 = (((0x0A11 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.MIXED) /* 367004177 */, HW_MOTION_INPUT = (((0x0A12 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.MIXED) /* 367004178 */, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 473dffcf97..b350f90a7e 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1252,9 +1252,16 @@ enum VehicleProperty { AP_POWER_BOOTUP_REASON = 0x0A02 + 0x10000000 + 0x01000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 /** - * Property to represent brightness of the display. Some cars have single - * control for the brightness of all displays and this property is to share - * change in that control. + * Property to represent brightness of the display. + * + * Some cars have single control for the brightness of all displays and this + * property is to share change in that control. In cars which have displays + * whose brightness is controlled separately, they must use + * PER_DISPLAY_BRIGHTNESS. + * + * Only one of DISPLAY_BRIGHTNESS and PER_DISPLAY_BRIGHTNESS should be + * implemented. If both are available, PER_DISPLAY_BRIGHTNESS is used by + * AAOS. * * If this is writable, android side can set this value when user changes * display brightness from Settings. If this is read only, user may still @@ -1266,6 +1273,29 @@ enum VehicleProperty { */ DISPLAY_BRIGHTNESS = 0x0A03 + 0x10000000 + 0x01000000 + 0x00400000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32 + /** + * Property to represent brightness of the displays which are controlled separately. + * + * Some cars have one or more displays whose brightness is controlled + * separately and this property is to inform the brightness of each + * passenger display. In cars where all displays' brightness is controlled + * together, they must use DISPLAY_BRIGHTNESS. + * + * Only one of DISPLAY_BRIGHTNESS and PER_DISPLAY_BRIGHTNESS should be + * implemented. If both are available, PER_DISPLAY_BRIGHTNESS is used by + * AAOS. + * + * The display port uniquely identifies a physical connector on the device + * for display output, ranging from 0 to 255. + * + * int32Values[0] : display port + * int32Values[1] : brightness + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + */ + PER_DISPLAY_BRIGHTNESS = 0x0A04 + 0x10000000 + 0x01000000 + + 0x00410000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:INT32_VEC /** * Property to feed H/W input events to android * From 88ded642f2b59601e13573a9ee0a327b003be366 Mon Sep 17 00:00:00 2001 From: Austin Delgado Date: Thu, 16 Feb 2023 11:34:50 -0800 Subject: [PATCH 752/998] Update fingerprint AIDL for Android U 1. Adds sensor shape and touch detection configuration. 2. Adds onPointerCancelWithContext and setIgnoreDisplayTouches. 3. Adds LIFT_TOO_SOON constant to AcquiredInfo. 4. Deprecates SensorLocation displayId, onPointerDown, and onPointerUp. Bug: 266476972 Test: m android.hardware.biometrics.fingerprint-update-api Test: built locally Change-Id: I3aae3c7f8a65d5805f3dd583330407c255ca1369 --- .../biometrics/fingerprint/AcquiredInfo.aidl | 27 +++---- .../biometrics/fingerprint/Error.aidl | 18 ++--- .../fingerprint/FingerprintSensorType.aidl | 12 ++-- .../biometrics/fingerprint/ISession.aidl | 8 +++ .../fingerprint/PointerContext.aidl | 12 ++-- .../fingerprint/SensorLocation.aidl | 4 ++ .../biometrics/fingerprint/SensorProps.aidl | 1 + .../biometrics/fingerprint/SensorShape.aidl | 40 +++++++++++ .../fingerprint/TouchDetectionParameters.aidl | 40 +++++++++++ .../biometrics/fingerprint/AcquiredInfo.aidl | 5 ++ .../biometrics/fingerprint/ISession.aidl | 70 ++++++++++++++++++- .../fingerprint/SensorLocation.aidl | 11 ++- .../biometrics/fingerprint/SensorProps.aidl | 7 ++ .../biometrics/fingerprint/SensorShape.aidl | 29 ++++++++ .../fingerprint/TouchDetectionParameters.aidl | 36 ++++++++++ .../fingerprint/aidl/default/Fingerprint.cpp | 3 +- .../fingerprint/aidl/default/Session.cpp | 8 +++ .../aidl/default/include/Session.h | 4 ++ 18 files changed, 297 insertions(+), 38 deletions(-) create mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorShape.aidl create mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/TouchDetectionParameters.aidl create mode 100644 biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorShape.aidl create mode 100644 biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/TouchDetectionParameters.aidl diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl index 0cc619f991..89f76f437b 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl @@ -35,17 +35,18 @@ package android.hardware.biometrics.fingerprint; /* @hide */ @Backing(type="byte") @VintfStability enum AcquiredInfo { - UNKNOWN = 0, - GOOD = 1, - PARTIAL = 2, - INSUFFICIENT = 3, - SENSOR_DIRTY = 4, - TOO_SLOW = 5, - TOO_FAST = 6, - VENDOR = 7, - START = 8, - TOO_DARK = 9, - TOO_BRIGHT = 10, - IMMOBILE = 11, - RETRYING_CAPTURE = 12, + UNKNOWN, + GOOD, + PARTIAL, + INSUFFICIENT, + SENSOR_DIRTY, + TOO_SLOW, + TOO_FAST, + VENDOR, + START, + TOO_DARK, + TOO_BRIGHT, + IMMOBILE, + RETRYING_CAPTURE, + LIFT_TOO_SOON, } diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl index 45ce2eb3fe..d3592a1f09 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl @@ -35,13 +35,13 @@ package android.hardware.biometrics.fingerprint; /* @hide */ @Backing(type="byte") @VintfStability enum Error { - UNKNOWN = 0, - HW_UNAVAILABLE = 1, - UNABLE_TO_PROCESS = 2, - TIMEOUT = 3, - NO_SPACE = 4, - CANCELED = 5, - UNABLE_TO_REMOVE = 6, - VENDOR = 7, - BAD_CALIBRATION = 8, + UNKNOWN, + HW_UNAVAILABLE, + UNABLE_TO_PROCESS, + TIMEOUT, + NO_SPACE, + CANCELED, + UNABLE_TO_REMOVE, + VENDOR, + BAD_CALIBRATION, } diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl index 67af20d872..381aaf7365 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl @@ -35,10 +35,10 @@ package android.hardware.biometrics.fingerprint; /* @hide */ @Backing(type="byte") @VintfStability enum FingerprintSensorType { - UNKNOWN = 0, - REAR = 1, - UNDER_DISPLAY_ULTRASONIC = 2, - UNDER_DISPLAY_OPTICAL = 3, - POWER_BUTTON = 4, - HOME_BUTTON = 5, + UNKNOWN, + REAR, + UNDER_DISPLAY_ULTRASONIC, + UNDER_DISPLAY_OPTICAL, + POWER_BUTTON, + HOME_BUTTON, } diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl index f30585529d..4fdcefc8ff 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/ISession.aidl @@ -46,7 +46,13 @@ interface ISession { void invalidateAuthenticatorId(); void resetLockout(in android.hardware.keymaster.HardwareAuthToken hat); void close(); + /** + * @deprecated use onPointerDownWithContext instead. + */ void onPointerDown(in int pointerId, in int x, in int y, in float minor, in float major); + /** + * @deprecated use onPointerUpWithContext instead. + */ void onPointerUp(in int pointerId); void onUiReady(); android.hardware.biometrics.common.ICancellationSignal authenticateWithContext(in long operationId, in android.hardware.biometrics.common.OperationContext context); @@ -55,4 +61,6 @@ interface ISession { void onPointerDownWithContext(in android.hardware.biometrics.fingerprint.PointerContext context); void onPointerUpWithContext(in android.hardware.biometrics.fingerprint.PointerContext context); void onContextChanged(in android.hardware.biometrics.common.OperationContext context); + void onPointerCancelWithContext(in android.hardware.biometrics.fingerprint.PointerContext context); + void setIgnoreDisplayTouches(in boolean shouldIgnore); } diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/PointerContext.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/PointerContext.aidl index 999b324abd..d9bf0854ca 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/PointerContext.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/PointerContext.aidl @@ -35,12 +35,12 @@ package android.hardware.biometrics.fingerprint; /* @hide */ @JavaDerive(equals=true) @VintfStability parcelable PointerContext { - int pointerId = -1; - float x = 0.000000f; - float y = 0.000000f; - float minor = 0.000000f; - float major = 0.000000f; - float orientation = 0.000000f; + int pointerId = (-1) /* -1 */; + float x = 0f; + float y = 0f; + float minor = 0f; + float major = 0f; + float orientation = 0f; boolean isAod = false; long time = 0; long gestureStart = 0; diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorLocation.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorLocation.aidl index dc6a62de6b..965576e822 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorLocation.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorLocation.aidl @@ -35,9 +35,13 @@ package android.hardware.biometrics.fingerprint; /* @hide */ @VintfStability parcelable SensorLocation { + /** + * @deprecated use the display field instead. This field was never used. + */ int displayId; int sensorLocationX; int sensorLocationY; int sensorRadius; String display = ""; + android.hardware.biometrics.fingerprint.SensorShape sensorShape = android.hardware.biometrics.fingerprint.SensorShape.CIRCLE; } diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorProps.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorProps.aidl index a77d5f2eee..a97d819dba 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorProps.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorProps.aidl @@ -42,4 +42,5 @@ parcelable SensorProps { boolean supportsDetectInteraction; boolean halHandlesDisplayTouches; boolean halControlsIllumination; + @nullable android.hardware.biometrics.fingerprint.TouchDetectionParameters touchDetectionParameters; } diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorShape.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorShape.aidl new file mode 100644 index 0000000000..f673b1c806 --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/SensorShape.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.biometrics.fingerprint; +/* @hide */ +@Backing(type="byte") @VintfStability +enum SensorShape { + SQUARE, + CIRCLE, +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/TouchDetectionParameters.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/TouchDetectionParameters.aidl new file mode 100644 index 0000000000..2e3ec4f574 --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/TouchDetectionParameters.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.biometrics.fingerprint; +/* @hide */ +@VintfStability +parcelable TouchDetectionParameters { + float targetSize = 1.0f; + float minOverlap = 0.0f; +} diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl index d3aa98a87d..2cdc196f41 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl @@ -98,4 +98,9 @@ enum AcquiredInfo { * However, RETRYING_CAPTURE must not be sent after ACQUIRED_GOOD is sent. */ RETRYING_CAPTURE, + + /** + * Fingerprint was lifted before the capture completed. + */ + LIFT_TOO_SOON, } diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl index f4f7804f52..83e7bbc43f 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/ISession.aidl @@ -420,6 +420,8 @@ interface ISession { * @param y The distance in pixels from the top edge of the display. * @param minor See android.view.MotionEvent#getTouchMinor * @param major See android.view.MotionEvent#getTouchMajor + * + * @deprecated use onPointerDownWithContext instead. */ void onPointerDown(in int pointerId, in int x, in int y, in float minor, in float major); @@ -434,6 +436,8 @@ interface ISession { * ISession#enroll, ISession#detectInteraction. * * @param pointerId See android.view.MotionEvent#getPointerId + * + * @deprecated use onPointerUpWithContext instead. */ void onPointerUp(in int pointerId); @@ -469,15 +473,77 @@ interface ISession { /** See ISession#detectInteraction() */ ICancellationSignal detectInteractionWithContext(in OperationContext context); - /** See ISession#onPointerDown(int, int, int, float, float) */ + /** + * onPointerDownWithContext: + * + * This operation only applies to sensors that are configured as + * FingerprintSensorType::UNDER_DISPLAY_*. If invoked erroneously by the framework for sensors + * of other types, the HAL must treat this as a no-op and return immediately. + * + * Notifies the HAL that a finger entered the sensor area. This operation can be invoked + * regardless of the current state of the HAL. + * + * Note that for sensors which require illumination, for example + * FingerprintSensorType::UNDER_DISPLAY_OPTICAL, this is a good time to start illuminating. + * + * @param context See PointerContext + */ void onPointerDownWithContext(in PointerContext context); - /** See ISession#onPointerUp(int) */ + /** + * onPointerUpWithContext: + * + * This operation only applies to sensors that are configured as + * FingerprintSensorType::UNDER_DISPLAY_*. If invoked for sensors of other types, the HAL must + * treat this as a no-op and return immediately. + * + * Notifies the HAL that a finger left the sensor area. This operation can be invoked regardless + * of the current state of the HAL. + * + * @param context See PointerContext + */ void onPointerUpWithContext(in PointerContext context); /** + * onContextChanged: + * * This may be called while an authenticate, detect interaction, or enrollment operation is * running when the context changes. */ void onContextChanged(in OperationContext context); + + /** + * onPointerCancelWithContext: + * + * This operation only applies to sensors that are configured as + * FingerprintSensorType::UNDER_DISPLAY_*. If invoked for sensors of other types, the HAL must + * treat this as a no-op and return immediately. + * + * Notifies the HAL that if there were fingers within the sensor area, they are no longer being + * tracked. The fingers may or may not still be on the sensor. This operation can be invoked + * regardless of the current state of the HAL. + * + * @param context See PointerContext + */ + void onPointerCancelWithContext(in PointerContext context); + + /** + * setIgnoreDisplayTouches: + * + * This operation only applies to sensors that have SensorProps#halHandlesDisplayTouches + * set to true. For all other sensors this is a no-op. + * + * Instructs the HAL whether to ignore display touches. This can be useful to avoid unintended + * fingerprint captures during certain UI interactions. For example, when entering a lockscreen + * PIN, some of the touches might overlap with the fingerprint sensor. Those touches should be + * ignored to avoid unintended authentication attempts. + * + * This flag must default to false when the HAL starts. + * + * The framework is responsible for both setting the flag to true and resetting it to false + * whenever it's appropriate. + * + * @param shouldIgnore whether the display touches should be ignored. + */ + void setIgnoreDisplayTouches(in boolean shouldIgnore); } diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorLocation.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorLocation.aidl index a065a7ce7b..fd8c7fc2d5 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorLocation.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorLocation.aidl @@ -15,13 +15,16 @@ */ package android.hardware.biometrics.fingerprint; + +import android.hardware.biometrics.fingerprint.SensorShape; + /** * @hide */ @VintfStability parcelable SensorLocation { /** - * Deprecated use the display field instead. This field was never used. + * @deprecated use the display field instead. This field was never used. */ int displayId; @@ -59,4 +62,10 @@ parcelable SensorLocation { * for each display from which the sensor is accessible from. */ String display = ""; + + /** + * The shape of the sensor if applicable. Most useful for the sensor of type + * SensorType::UNDER_DISPLAY_*. + */ + SensorShape sensorShape = SensorShape.CIRCLE; } diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorProps.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorProps.aidl index d4e9ec6f38..853aae48ad 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorProps.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorProps.aidl @@ -19,6 +19,8 @@ package android.hardware.biometrics.fingerprint; import android.hardware.biometrics.common.CommonProps; import android.hardware.biometrics.fingerprint.FingerprintSensorType; import android.hardware.biometrics.fingerprint.SensorLocation; +import android.hardware.biometrics.fingerprint.TouchDetectionParameters; + /** * @hide */ @@ -72,4 +74,9 @@ parcelable SensorProps { * This value must be ignored for sensors that aren't optical UDFPS. */ boolean halControlsIllumination; + + /** + * Parameters used for fingerprint touch detection. + */ + @nullable TouchDetectionParameters touchDetectionParameters; } diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorShape.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorShape.aidl new file mode 100644 index 0000000000..1279332ce0 --- /dev/null +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/SensorShape.aidl @@ -0,0 +1,29 @@ +/* + * 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.hardware.biometrics.fingerprint; +/** + * This is most useful for sensors configured as FingerprintSensorType::UNDER_DISPLAY_OPTICAL, + * as it's used to compute the on-screen sensor boundaries for the touch detection algorithm. + * + * @hide + */ +@VintfStability +@Backing(type="byte") +enum SensorShape { + SQUARE, + CIRCLE, +} diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/TouchDetectionParameters.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/TouchDetectionParameters.aidl new file mode 100644 index 0000000000..bf117a33e6 --- /dev/null +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/TouchDetectionParameters.aidl @@ -0,0 +1,36 @@ +/* + * 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.hardware.biometrics.fingerprint; + +/** + * @hide + */ +@VintfStability +parcelable TouchDetectionParameters { + /** + * The percentage of the sensor that is considered the target. Value is required to be within + * [0.0, 1.0]. The target area expands outwards from center matching the sensorShape. Some + * portion of the touch must be within the target to be considered a valid touch. + */ + float targetSize = 1.0f; + + /** + * The minimum percentage overlap needed on the sensor to be considered a valid touch. Value is + * required to be within [0.0, 1.0]. + */ + float minOverlap = 0.0f; +} diff --git a/biometrics/fingerprint/aidl/default/Fingerprint.cpp b/biometrics/fingerprint/aidl/default/Fingerprint.cpp index be932246bd..7808a13d16 100644 --- a/biometrics/fingerprint/aidl/default/Fingerprint.cpp +++ b/biometrics/fingerprint/aidl/default/Fingerprint.cpp @@ -90,7 +90,8 @@ ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector* out) { navigationGuesture, detectInteraction, displayTouch, - controlIllumination}}; + controlIllumination, + std::nullopt}}; return ndk::ScopedAStatus::ok(); } diff --git a/biometrics/fingerprint/aidl/default/Session.cpp b/biometrics/fingerprint/aidl/default/Session.cpp index 7ab5af3c4d..38d6a134e2 100644 --- a/biometrics/fingerprint/aidl/default/Session.cpp +++ b/biometrics/fingerprint/aidl/default/Session.cpp @@ -289,4 +289,12 @@ ndk::ScopedAStatus Session::onContextChanged(const common::OperationContext& /*c return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus Session::onPointerCancelWithContext(const PointerContext& /*context*/) { + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus Session::setIgnoreDisplayTouches(bool /*shouldIgnore*/) { + return ndk::ScopedAStatus::ok(); +} + } // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/include/Session.h b/biometrics/fingerprint/aidl/default/include/Session.h index 104d819ff0..b596d9e2a9 100644 --- a/biometrics/fingerprint/aidl/default/include/Session.h +++ b/biometrics/fingerprint/aidl/default/include/Session.h @@ -97,6 +97,10 @@ class Session : public BnSession { ndk::ScopedAStatus onContextChanged(const common::OperationContext& context) override; + ndk::ScopedAStatus onPointerCancelWithContext(const PointerContext& context) override; + + ndk::ScopedAStatus setIgnoreDisplayTouches(bool shouldIgnore) override; + bool isClosed(); private: From f9a4d9f7e59ab067e797f07d5eca4c03a6f2ec77 Mon Sep 17 00:00:00 2001 From: Sarah Chin Date: Sat, 18 Feb 2023 02:49:36 -0800 Subject: [PATCH 753/998] Add backwards compatible default value for NR timing advance Test: atest SignalStrengthTest Bug: 141097448 Bug: 266825334 Change-Id: I97413b651fa99d4a0e119d4af670fb7216fca704 --- .../android/hardware/radio/network/NrSignalStrength.aidl | 2 +- radio/aidl/android/hardware/radio/network/NrSignalStrength.aidl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrSignalStrength.aidl index 20550249a1..7d6ab8234a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrSignalStrength.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/NrSignalStrength.aidl @@ -42,5 +42,5 @@ parcelable NrSignalStrength { int csiSinr; int csiCqiTableIndex; byte[] csiCqiReport; - int timingAdvance; + int timingAdvance = 0x7FFFFFFF; } diff --git a/radio/aidl/android/hardware/radio/network/NrSignalStrength.aidl b/radio/aidl/android/hardware/radio/network/NrSignalStrength.aidl index 2314562a16..30ae067ec0 100644 --- a/radio/aidl/android/hardware/radio/network/NrSignalStrength.aidl +++ b/radio/aidl/android/hardware/radio/network/NrSignalStrength.aidl @@ -77,5 +77,5 @@ parcelable NrSignalStrength { * INT_MAX: 0x7FFFFFFF denotes invalid/unreported value. * Reference: 3GPP 36.213 section 4.2.3 */ - int timingAdvance; + int timingAdvance = 0x7FFFFFFF; } From 284883f8478b463e7a3a6c958067f092e2784f50 Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Fri, 17 Feb 2023 23:37:22 +0000 Subject: [PATCH 754/998] wifi: set join to true in p2p connect tests After adding ag/21179155, auto join flag is not set for every p2p connect command. The tests are passing an unknown peer MAC address to connect(). To pass the tests, the connect should trigger a scan and try to find this unknown mac address. So set join flag to true to run the same scan logic. Bug: 268236829 Bug: 218608010 Test: atest VtsHalWifiSupplicantP2pIfaceTargetTest Change-Id: Id5baa0f599d11a3563780aae15ff3cea0407060c --- .../supplicant_p2p_iface_aidl_test.cpp | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp index ee0eff50c5..a260408c8c 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp +++ b/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp @@ -536,16 +536,11 @@ TEST_P(SupplicantP2pIfaceAidlTest, Flush) { * Connect */ TEST_P(SupplicantP2pIfaceAidlTest, Connect) { - /* - * Auto-join is not enabled before R. After enabling auto-join, - * this should always succeed. - */ std::string pin; EXPECT_TRUE(p2p_iface_ - ->connect(kTestMacAddr, WpsProvisionMethod::PBC, - kTestConnectPin, false, false, - kTestConnectGoIntent, &pin) - .isOk()); + ->connect(kTestMacAddr, WpsProvisionMethod::PBC, kTestConnectPin, true, + false, kTestConnectGoIntent, &pin) + .isOk()); } /* @@ -554,10 +549,9 @@ TEST_P(SupplicantP2pIfaceAidlTest, Connect) { TEST_P(SupplicantP2pIfaceAidlTest, CancelConnect) { std::string pin; EXPECT_TRUE(p2p_iface_ - ->connect(kTestMacAddr, WpsProvisionMethod::PBC, - kTestConnectPin, false, false, - kTestConnectGoIntent, &pin) - .isOk()); + ->connect(kTestMacAddr, WpsProvisionMethod::PBC, kTestConnectPin, true, + false, kTestConnectGoIntent, &pin) + .isOk()); EXPECT_TRUE(p2p_iface_->cancelConnect().isOk()); } From 70f85b7c0d7aa6d3b67615c4c4357b50b5490788 Mon Sep 17 00:00:00 2001 From: Terry Guan Date: Wed, 15 Feb 2023 13:19:16 -0800 Subject: [PATCH 755/998] Added Vendor Error Properties Bug: 269501288 Test: atest android.car.apitest.CarPropertyManagerTest Test: atest FakeVehicleHardwareTest Change-Id: Ia5ec83c750095774fe409edd6e3f2f6072987b9c Merged-In: Ia5ec83c750095774fe409edd6e3f2f6072987b9c (cherry picked from commit eb47a4729e339645d3e4f7c3701a37a18d30639f) --- .../JsonConfigLoader/src/JsonConfigLoader.cpp | 1 + .../aidl/impl/default_config/config/TestProperties.json | 5 +++++ .../impl/fake_impl/hardware/src/FakeVehicleHardware.cpp | 9 ++++++++- .../fake_impl/hardware/test/FakeVehicleHardwareTest.cpp | 5 +++++ .../aidl/impl/utils/test/include/TestPropertyUtils.h | 7 +++++++ 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index ff601e0342..a6511787e5 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -136,6 +136,7 @@ const std::unordered_map CONSTANTS_BY_NAME = { #ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES // Following are test properties: {"ECHO_REVERSE_BYTES", ECHO_REVERSE_BYTES}, + {"VENDOR_PROPERTY_ID", VENDOR_PROPERTY_ID}, {"kMixedTypePropertyForTest", kMixedTypePropertyForTest}, {"VENDOR_CLUSTER_NAVIGATION_STATE", VENDOR_CLUSTER_NAVIGATION_STATE}, {"VENDOR_CLUSTER_REQUEST_DISPLAY", VENDOR_CLUSTER_REQUEST_DISPLAY}, diff --git a/automotive/vehicle/aidl/impl/default_config/config/TestProperties.json b/automotive/vehicle/aidl/impl/default_config/config/TestProperties.json index 33c6cc2397..fd4b0026bd 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/TestProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/TestProperties.json @@ -181,6 +181,11 @@ "access": "VehiclePropertyAccess::READ_WRITE", "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" }, + { + "property": "Constants::VENDOR_PROPERTY_ID", + "access": "VehiclePropertyAccess::READ_WRITE", + "changeMode": "VehiclePropertyChangeMode::ON_CHANGE" + }, { "property": "VehicleProperty::SUPPORT_CUSTOMIZE_VENDOR_PERMISSION", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index a9dced9f3a..00ebdda372 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -85,7 +85,8 @@ constexpr char OVERRIDE_CONFIG_DIR[] = "/vendor/etc/automotive/vhaloverride/"; // overwrite the default configs. constexpr char OVERRIDE_PROPERTY[] = "persist.vendor.vhal_init_value_override"; constexpr char POWER_STATE_REQ_CONFIG_PROPERTY[] = "ro.vendor.fake_vhal.ap_power_state_req.config"; - +// The value to be returned if VENDOR_PROPERTY_ID is set as the property +constexpr int VENDOR_ERROR_CODE = 0x00ab0005; // A list of supported options for "--set" command. const std::unordered_set SET_PROP_OPTIONS = { // integer. @@ -389,6 +390,9 @@ FakeVehicleHardware::ValueResultType FakeVehicleHardware::maybeGetSpecialValue( case ECHO_REVERSE_BYTES: *isSpecialValue = true; return getEchoReverseBytes(value); + case VENDOR_PROPERTY_ID: + *isSpecialValue = true; + return StatusError((StatusCode)VENDOR_ERROR_CODE); default: // Do nothing. break; @@ -469,6 +473,9 @@ VhalResult FakeVehicleHardware::maybeSetSpecialValue(const VehiclePropValu case OBD2_FREEZE_FRAME_CLEAR: *isSpecialValue = true; return mFakeObd2Frame->clearObd2FreezeFrames(value); + case VENDOR_PROPERTY_ID: + *isSpecialValue = true; + return StatusError((StatusCode)VENDOR_ERROR_CODE); #ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES case toInt(VehicleProperty::CLUSTER_REPORT_STATE): diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp index 67b1aa4c9c..f3593aa59b 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp @@ -409,6 +409,11 @@ TEST_F(FakeVehicleHardwareTest, testGetDefaultValues) { continue; } + if (propId == VENDOR_PROPERTY_ID) { + // Ignore VENDOR_PROPERTY_ID, it has special logic. + continue; + } + if (isGlobalProp(propId)) { if (config.initialValue == RawPropValues{}) { addGetValueRequest(getValueRequests, expectedGetValueResults, requestId++, diff --git a/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h b/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h index e6ea6fef2e..14002884f5 100644 --- a/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h +++ b/automotive/vehicle/aidl/impl/utils/test/include/TestPropertyUtils.h @@ -84,6 +84,13 @@ constexpr int32_t ECHO_REVERSE_BYTES = 0x2a12 | toInt(testpropertyutils_impl::VehicleArea::GLOBAL) | toInt(testpropertyutils_impl::VehiclePropertyType::BYTES); +// This property is used for testing vendor error codes end to end. +// 0x21402a13 +constexpr int32_t VENDOR_PROPERTY_ID = 0x2a13 | + toInt(testpropertyutils_impl::VehiclePropertyGroup::VENDOR) | + toInt(testpropertyutils_impl::VehicleArea::GLOBAL) | + toInt(testpropertyutils_impl::VehiclePropertyType::INT32); + // This property is used for test purpose. End to end tests use this property to test set and get // method for MIXED type properties. constexpr int32_t kMixedTypePropertyForTest = From 34dc8bfe5154c0f1418dd04090e428b47b5a4307 Mon Sep 17 00:00:00 2001 From: Diya Bera Date: Tue, 14 Feb 2023 22:47:13 +0000 Subject: [PATCH 756/998] Adding POWER_PRESS to AcquiredInfo.aidl and Error.aidl Test: N/A Bug: 269293986 Change-Id: If2e2a1c0f48d86c427a0c8f93f077c940c3eb8d8 --- .../hardware/biometrics/fingerprint/AcquiredInfo.aidl | 1 + .../android/hardware/biometrics/fingerprint/Error.aidl | 1 + .../hardware/biometrics/fingerprint/AcquiredInfo.aidl | 6 ++++++ .../aidl/android/hardware/biometrics/fingerprint/Error.aidl | 6 ++++++ 4 files changed, 14 insertions(+) diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl index 89f76f437b..7075f715fd 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl @@ -49,4 +49,5 @@ enum AcquiredInfo { IMMOBILE, RETRYING_CAPTURE, LIFT_TOO_SOON, + POWER_PRESS, } diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl index d3592a1f09..9eeaac53ec 100644 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl @@ -44,4 +44,5 @@ enum Error { UNABLE_TO_REMOVE, VENDOR, BAD_CALIBRATION, + POWER_PRESS, } diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl index 2cdc196f41..41b7c5e0bf 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl @@ -103,4 +103,10 @@ enum AcquiredInfo { * Fingerprint was lifted before the capture completed. */ LIFT_TOO_SOON, + + /** + * Indicates a power press event has occurred. This is typically sent by fingerprint + * sensors that have the sensor co-located with the power button. + */ + POWER_PRESS, } diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/Error.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/Error.aidl index d8d47fa8a0..39a5676fe1 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/Error.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/Error.aidl @@ -70,4 +70,10 @@ enum Error { * There's a problem with the sensor's calibration. */ BAD_CALIBRATION, + + /** + * Indicates a power press event has occurred. This is typically sent by fingerprint + * sensors that have the sensor co-located with the power button. + */ + POWER_PRESS, } From f5a0732d83df058af0b6ec3f9c4d178bd9184cc9 Mon Sep 17 00:00:00 2001 From: Jack Wu Date: Sun, 19 Feb 2023 01:35:53 +0800 Subject: [PATCH 757/998] Revert "health: batteryStateOfHealth should be a property" This reverts commit a60e7a43a90ef990f9d5426df04411025ccbc82e. Reason for revert: merge to aosp first Bug: 251427118 Test: m android.hardware.health-update-api Change-Id: If56fe4b141b3ad31b7f859118e432f08915c98f3 Signed-off-by: Jack Wu --- .../hardware/health/BatteryCapacityLevel.aidl | 14 +++++++------- .../android/hardware/health/BatteryHealthData.aidl | 1 - .../android/hardware/health/HealthInfo.aidl | 3 ++- .../android/hardware/health/BatteryHealthData.aidl | 7 ------- .../aidl/android/hardware/health/HealthInfo.aidl | 7 +++++++ .../aidl/vts/functional/VtsHalHealthTargetTest.cpp | 4 ---- 6 files changed, 16 insertions(+), 20 deletions(-) diff --git a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryCapacityLevel.aidl b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryCapacityLevel.aidl index 4d705887e5..e5438865c1 100644 --- a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryCapacityLevel.aidl +++ b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryCapacityLevel.aidl @@ -34,11 +34,11 @@ package android.hardware.health; @Backing(type="int") @VintfStability enum BatteryCapacityLevel { - UNSUPPORTED = (-1) /* -1 */, - UNKNOWN, - CRITICAL, - LOW, - NORMAL, - HIGH, - FULL, + UNSUPPORTED = -1, + UNKNOWN = 0, + CRITICAL = 1, + LOW = 2, + NORMAL = 3, + HIGH = 4, + FULL = 5, } diff --git a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealthData.aidl b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealthData.aidl index 2dd01b146f..d523fadf13 100644 --- a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealthData.aidl +++ b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealthData.aidl @@ -36,5 +36,4 @@ package android.hardware.health; parcelable BatteryHealthData { long batteryManufacturingDateSeconds; long batteryFirstUsageSeconds; - long batteryStateOfHealth; } diff --git a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/HealthInfo.aidl b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/HealthInfo.aidl index bfa14758f3..664cc70e55 100644 --- a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/HealthInfo.aidl +++ b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/HealthInfo.aidl @@ -57,8 +57,9 @@ parcelable HealthInfo { android.hardware.health.BatteryCapacityLevel batteryCapacityLevel; long batteryChargeTimeToFullNowSeconds; int batteryFullChargeDesignCapacityUah; + int batteryStateOfHealth; android.hardware.health.BatteryChargingState chargingState; android.hardware.health.BatteryChargingPolicy chargingPolicy; @nullable android.hardware.health.BatteryHealthData batteryHealthData; - const int BATTERY_CHARGE_TIME_TO_FULL_NOW_SECONDS_UNSUPPORTED = (-1) /* -1 */; + const int BATTERY_CHARGE_TIME_TO_FULL_NOW_SECONDS_UNSUPPORTED = -1; } diff --git a/health/aidl/android/hardware/health/BatteryHealthData.aidl b/health/aidl/android/hardware/health/BatteryHealthData.aidl index 594bcce576..fb17f63ab9 100644 --- a/health/aidl/android/hardware/health/BatteryHealthData.aidl +++ b/health/aidl/android/hardware/health/BatteryHealthData.aidl @@ -29,11 +29,4 @@ parcelable BatteryHealthData { * The date of first usage is reported in epoch. */ long batteryFirstUsageSeconds; - /** - * Measured battery state of health (remaining estimate full charge capacity - * relative to the rated capacity in %). - * Value must be 0 if batteryStatus is UNKNOWN. - * Otherwise, value must be in the range 0 to 100. - */ - long batteryStateOfHealth; } diff --git a/health/aidl/android/hardware/health/HealthInfo.aidl b/health/aidl/android/hardware/health/HealthInfo.aidl index af84089598..238f5242da 100644 --- a/health/aidl/android/hardware/health/HealthInfo.aidl +++ b/health/aidl/android/hardware/health/HealthInfo.aidl @@ -136,6 +136,13 @@ parcelable HealthInfo { * Value must be less than 100 000 000 µAh if known. */ int batteryFullChargeDesignCapacityUah; + /** + * Measured battery state of health (remaining estimate full charge capacity + * relative to the rated capacity in %). + * Value must be 0 if batteryStatus is UNKNOWN. + * Otherwise, value must be in the range 0 to 100. + */ + int batteryStateOfHealth; /** * Battery charging state */ diff --git a/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp b/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp index 69d4789727..6506ea2359 100644 --- a/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp +++ b/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp @@ -278,10 +278,6 @@ MATCHER(IsValidHealthData, "") { *result_listener << " for batteryFirstUsageSeconds."; return false; } - if (!ExplainMatchResult(Ge(-1), arg.batteryStateOfHealth, result_listener)) { - *result_listener << " for batteryStateOfHealth."; - return false; - } return true; } From d0a8c7bf65ed1c16ccbcbf6c008d0c366eb7eb26 Mon Sep 17 00:00:00 2001 From: Xiang Wang Date: Wed, 15 Feb 2023 15:42:22 -0800 Subject: [PATCH 758/998] Move thermal utils to hardware/interfaces Bug: b/269370789 Test: m Change-Id: I67d035271c177dfee88ac7272baa7cc9cdef3e00 Merged-In: I67d035271c177dfee88ac7272baa7cc9cdef3e00 --- thermal/utils/Android.bp | 38 +++ thermal/utils/ThermalHidlWrapper.cpp | 305 ++++++++++++++++++ .../include/thermalutils/ThermalHidlWrapper.h | 106 ++++++ thermal/utils/tests/Android.bp | 40 +++ .../utils/tests/ThermalHidlWrapperTest.cpp | 302 +++++++++++++++++ 5 files changed, 791 insertions(+) create mode 100644 thermal/utils/Android.bp create mode 100644 thermal/utils/ThermalHidlWrapper.cpp create mode 100644 thermal/utils/include/thermalutils/ThermalHidlWrapper.h create mode 100644 thermal/utils/tests/Android.bp create mode 100644 thermal/utils/tests/ThermalHidlWrapperTest.cpp diff --git a/thermal/utils/Android.bp b/thermal/utils/Android.bp new file mode 100644 index 0000000000..72e1e34f9d --- /dev/null +++ b/thermal/utils/Android.bp @@ -0,0 +1,38 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_library_static { + name: "libthermalutils", + vendor_available: true, + export_include_dirs: ["include"], + srcs: [ + "ThermalHidlWrapper.cpp", + ], + + cflags: [ + "-Wall", + "-Werror", + ], + + shared_libs: [ + "android.hardware.thermal@2.0", + "android.hardware.thermal-V1-ndk", + ], +} diff --git a/thermal/utils/ThermalHidlWrapper.cpp b/thermal/utils/ThermalHidlWrapper.cpp new file mode 100644 index 0000000000..05a992a792 --- /dev/null +++ b/thermal/utils/ThermalHidlWrapper.cpp @@ -0,0 +1,305 @@ +/* + * 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. + */ + +#include "include/thermalutils/ThermalHidlWrapper.h" + +#include + +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace thermal { + +using ::android::hardware::Void; + +namespace { + +template +Return setFailureAndCallback(T _hidl_cb, hidl_vec data, std::string_view debug_msg) { + ThermalStatus status; + status.code = ThermalStatusCode::FAILURE; + status.debugMessage = debug_msg.data(); + _hidl_cb(status, data); + return Void(); +} + +template +Return setFailureAndCallback(T _hidl_cb, std::string_view debug_msg) { + ThermalStatus status; + status.code = ThermalStatusCode::FAILURE; + status.debugMessage = debug_msg.data(); + _hidl_cb(status); + return Void(); +} + +template +Return setInitFailureAndCallback(T _hidl_cb, hidl_vec data) { + return setFailureAndCallback( + _hidl_cb, data, "Thermal AIDL HAL client used by HIDL wrapper was not initialized"); +} + +template +Return setInitFailureAndCallback(T _hidl_cb) { + return setFailureAndCallback( + _hidl_cb, "Thermal AIDL HAL client used by HIDL wrapper was not initialized"); +} + +template +Return setUnsupportedFailureAndCallback(T _hidl_cb, hidl_vec data) { + return setFailureAndCallback(_hidl_cb, data, "Operation unsupported by Thermal HIDL wrapper"); +} + +TemperatureType_2_0 convertAidlTemperatureType(const TemperatureType& type) { + if (type < TemperatureType::CPU || type > TemperatureType::NPU) { + return TemperatureType_2_0::UNKNOWN; + } + return static_cast(type); +} + +CoolingType_2_0 convertAidlCoolingType(const CoolingType& type) { + if (type < CoolingType::FAN || type > CoolingType::COMPONENT) { + return CoolingType_2_0::COMPONENT; + } + return static_cast(type); +} + +Temperature_2_0 convertAidlTemperature(const Temperature& temperature) { + Temperature_2_0 t = Temperature_2_0{ + convertAidlTemperatureType(temperature.type), temperature.name, temperature.value, + static_cast(temperature.throttlingStatus)}; + return t; +} + +CoolingDevice_2_0 convertAidlCoolingDevice(const CoolingDevice& cooling_device) { + CoolingDevice_2_0 t = + CoolingDevice_2_0{convertAidlCoolingType(cooling_device.type), cooling_device.name, + static_cast(cooling_device.value)}; + return t; +} +TemperatureThreshold_2_0 convertAidlTemperatureThreshold(const TemperatureThreshold& threshold) { + TemperatureThreshold_2_0 t = + TemperatureThreshold_2_0{convertAidlTemperatureType(threshold.type), threshold.name, + threshold.hotThrottlingThresholds.data(), + threshold.coldThrottlingThresholds.data(), NAN}; + return t; +} + +} // namespace + +// Methods from ::android::hardware::thermal::V1_0::IThermal follow. +Return ThermalHidlWrapper::getTemperatures(getTemperatures_cb _hidl_cb) { + hidl_vec ret_1_0; + setUnsupportedFailureAndCallback(_hidl_cb, ret_1_0); + return Void(); +} + +Return ThermalHidlWrapper::getCpuUsages( + std::function&)> _hidl_cb) { + hidl_vec ret_1_0; + setUnsupportedFailureAndCallback(_hidl_cb, ret_1_0); + return Void(); +} + +Return ThermalHidlWrapper::getCoolingDevices( + std::function&)> _hidl_cb) { + hidl_vec ret_1_0; + setUnsupportedFailureAndCallback(_hidl_cb, ret_1_0); + return Void(); +} + +// Methods from ::android::hardware::thermal::V2_0::IThermal follow. +Return ThermalHidlWrapper::getCurrentTemperatures( + bool filterType, TemperatureType_2_0 type, + std::function&)> _hidl_cb) { + hidl_vec ret_2_0; + if (!thermal_service_) { + setInitFailureAndCallback(_hidl_cb, ret_2_0); + } + + std::vector ret_aidl; + ThermalStatus status; + ::ndk::ScopedAStatus a_status; + if (filterType) { + a_status = thermal_service_->getTemperaturesWithType(static_cast(type), + &ret_aidl); + } else { + a_status = thermal_service_->getTemperatures(&ret_aidl); + } + if (a_status.isOk()) { + std::vector ret; + for (const auto& temperature : ret_aidl) { + ret.push_back(convertAidlTemperature(temperature)); + } + _hidl_cb(status, hidl_vec(ret)); + } else { + setFailureAndCallback(_hidl_cb, ret_2_0, a_status.getMessage()); + } + return Void(); +} + +Return ThermalHidlWrapper::getTemperatureThresholds( + bool filterType, TemperatureType_2_0 type, + std::function&)> + _hidl_cb) { + hidl_vec ret_2_0; + if (!thermal_service_) { + setInitFailureAndCallback(_hidl_cb, ret_2_0); + } + + std::vector ret_aidl; + ThermalStatus status; + ::ndk::ScopedAStatus a_status; + if (filterType) { + a_status = thermal_service_->getTemperatureThresholdsWithType( + static_cast(type), &ret_aidl); + } else { + a_status = thermal_service_->getTemperatureThresholds(&ret_aidl); + } + if (a_status.isOk()) { + std::vector ret; + for (const auto& threshold : ret_aidl) { + ret.push_back(convertAidlTemperatureThreshold(threshold)); + } + _hidl_cb(status, hidl_vec(ret)); + } else { + setFailureAndCallback(_hidl_cb, ret_2_0, a_status.getMessage()); + } + return Void(); +} + +Return ThermalHidlWrapper::registerThermalChangedCallback( + const sp& callback, bool filterType, TemperatureType_2_0 type, + std::function _hidl_cb) { + if (!thermal_service_) { + setInitFailureAndCallback(_hidl_cb); + } + if (callback == nullptr) { + setFailureAndCallback(_hidl_cb, "Invalid nullptr callback"); + return Void(); + } + std::lock_guard _lock(callback_wrappers_mutex_); + for (const auto& callback_wrapper : callback_wrappers_) { + if (::android::hardware::interfacesEqual(callback_wrapper->callback_2_0_.get(), + callback.get())) { + setFailureAndCallback(_hidl_cb, "The callback was already registered through wrapper"); + return Void(); + } + } + std::shared_ptr callback_wrapper = + ndk::SharedRefBase::make(callback); + ::ndk::ScopedAStatus a_status; + ThermalStatus status; + if (filterType) { + a_status = thermal_service_->registerThermalChangedCallbackWithType( + callback_wrapper, static_cast(type)); + } else { + a_status = thermal_service_->registerThermalChangedCallback(callback_wrapper); + } + if (a_status.isOk()) { + callback_wrappers_.push_back(callback_wrapper); + _hidl_cb(status); + } else { + setFailureAndCallback(_hidl_cb, a_status.getMessage()); + } + return Void(); +} + +Return ThermalHidlWrapper::unregisterThermalChangedCallback( + const sp& callback, + std::function _hidl_cb) { + if (!thermal_service_) { + setInitFailureAndCallback(_hidl_cb); + } + if (callback == nullptr) { + setFailureAndCallback(_hidl_cb, "Invalid nullptr callback"); + return Void(); + } + std::lock_guard _lock(callback_wrappers_mutex_); + for (auto it = callback_wrappers_.begin(); it != callback_wrappers_.end(); it++) { + auto callback_wrapper = *it; + if (::android::hardware::interfacesEqual(callback_wrapper->callback_2_0_.get(), + callback.get())) { + ::ndk::ScopedAStatus a_status; + ThermalStatus status; + a_status = thermal_service_->unregisterThermalChangedCallback(callback_wrapper); + if (a_status.isOk()) { + callback_wrappers_.erase(it); + _hidl_cb(status); + } else { + setFailureAndCallback(_hidl_cb, a_status.getMessage()); + } + return Void(); + } + } + setFailureAndCallback(_hidl_cb, "The callback was not registered through wrapper before"); + return Void(); +} + +Return ThermalHidlWrapper::getCurrentCoolingDevices( + bool filterType, CoolingType_2_0 type, + std::function&)> _hidl_cb) { + hidl_vec ret_2_0; + if (!thermal_service_) { + setInitFailureAndCallback(_hidl_cb, ret_2_0); + } + + std::vector ret_aidl; + ThermalStatus status; + ::ndk::ScopedAStatus a_status; + if (filterType) { + a_status = thermal_service_->getCoolingDevicesWithType(static_cast(type), + &ret_aidl); + } else { + a_status = thermal_service_->getCoolingDevices(&ret_aidl); + } + if (a_status.isOk()) { + std::vector ret; + for (const auto& cooling_device : ret_aidl) { + ret.push_back(convertAidlCoolingDevice(cooling_device)); + } + _hidl_cb(status, hidl_vec(ret)); + } else { + setFailureAndCallback(_hidl_cb, ret_2_0, a_status.getMessage()); + } + return Void(); +} + +// Methods from ::android::hidl::base::V1_0::IBase follow. +Return ThermalHidlWrapper::debug(const hidl_handle& handle, + const hidl_vec& args) { + if (handle != nullptr && handle->numFds >= 1) { + int fd = handle->data[0]; + char** arr = new char*[args.size()]; + for (size_t i = 0; i < args.size(); i++) { + arr[i] = strdup(args[i].c_str()); + } + thermal_service_->dump(fd, (const char**)arr, args.size()); + } + return Void(); +} + +::ndk::ScopedAStatus ThermalHidlWrapper::IThermalChangedCallbackWrapper::notifyThrottling( + const Temperature& temperature) { + callback_2_0_->notifyThrottling(convertAidlTemperature(temperature)); + return ::ndk::ScopedAStatus::ok(); +} + +} // namespace thermal +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/thermal/utils/include/thermalutils/ThermalHidlWrapper.h b/thermal/utils/include/thermalutils/ThermalHidlWrapper.h new file mode 100644 index 0000000000..1fec10076f --- /dev/null +++ b/thermal/utils/include/thermalutils/ThermalHidlWrapper.h @@ -0,0 +1,106 @@ +/* + * 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. + */ + +#include +#include +#include +#include +#include +#include + +#include + +namespace aidl { +namespace android { +namespace hardware { +namespace thermal { + +using ::android::sp; +using ::android::hardware::hidl_array; +using ::android::hardware::hidl_handle; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; + +using IThermal_Aidl = ::aidl::android::hardware::thermal::IThermal; +using ::android::hardware::thermal::V1_0::CpuUsage; +using CoolingType_2_0 = ::android::hardware::thermal::V2_0::CoolingType; +using CoolingDevice_1_0 = ::android::hardware::thermal::V1_0::CoolingDevice; +using CoolingDevice_2_0 = ::android::hardware::thermal::V2_0::CoolingDevice; +using IThermal_2_0 = ::android::hardware::thermal::V2_0::IThermal; +using IThermalChangedCallback_2_0 = ::android::hardware::thermal::V2_0::IThermalChangedCallback; +using Temperature_1_0 = ::android::hardware::thermal::V1_0::Temperature; +using Temperature_2_0 = ::android::hardware::thermal::V2_0::Temperature; +using TemperatureType_2_0 = ::android::hardware::thermal::V2_0::TemperatureType; + +using ::android::hardware::thermal::V1_0::ThermalStatus; +using ::android::hardware::thermal::V1_0::ThermalStatusCode; + +using TemperatureThreshold_2_0 = ::android::hardware::thermal::V2_0::TemperatureThreshold; +using ThrottlingSeverity_2_0 = ::android::hardware::thermal::V2_0::ThrottlingSeverity; + +// This wrapper converts all Thermal HIDL 2.0 calls to AIDL calls and converts AIDL response to +// HIDL 2.0 response. +// +// For Thermal HIDL 1.0 calls, it returns unsupported error. +class ThermalHidlWrapper : public IThermal_2_0 { + public: + explicit ThermalHidlWrapper(::std::shared_ptr thermal_service) + : thermal_service_(std::move(thermal_service)) {} + + // Methods from ::android::hardware::thermal::V1_0::IThermal follow. + Return getTemperatures(getTemperatures_cb _hidl_cb) override; + Return getCpuUsages(getCpuUsages_cb _hidl_cb) override; + Return getCoolingDevices(getCoolingDevices_cb _hidl_cb) override; + + // Methods from ::android::hardware::thermal::V2_0::IThermal follow. + Return getCurrentTemperatures(bool filterType, TemperatureType_2_0 type, + getCurrentTemperatures_cb _hidl_cb) override; + Return getTemperatureThresholds(bool filterType, TemperatureType_2_0 type, + getTemperatureThresholds_cb _hidl_cb) override; + Return registerThermalChangedCallback( + const sp& callback, bool filterType, + TemperatureType_2_0 type, registerThermalChangedCallback_cb _hidl_cb) override; + Return unregisterThermalChangedCallback( + const sp& callback, + unregisterThermalChangedCallback_cb _hidl_cb) override; + Return getCurrentCoolingDevices(bool filterType, CoolingType_2_0 type, + getCurrentCoolingDevices_cb _hidl_cb) override; + + // Methods from ::android::hidl::base::V1_0::IBase follow. + Return debug(const hidl_handle& handle, const hidl_vec& args) override; + + private: + class IThermalChangedCallbackWrapper : public BnThermalChangedCallback { + public: + explicit IThermalChangedCallbackWrapper(const sp& callback_2_0) + : callback_2_0_(callback_2_0) {} + ::ndk::ScopedAStatus notifyThrottling(const Temperature& temperature) override; + sp callback_2_0_; + }; + + // Reference to thermal service. + ::std::shared_ptr thermal_service_; + // Mutex lock for read/write on callback wrappers. + std::mutex callback_wrappers_mutex_; + // All thermal changed callback wrappers registered. + ::std::vector> callback_wrappers_; +}; + +} // namespace thermal +} // namespace hardware +} // namespace android +} // namespace aidl diff --git a/thermal/utils/tests/Android.bp b/thermal/utils/tests/Android.bp new file mode 100644 index 0000000000..fd74e8b4e8 --- /dev/null +++ b/thermal/utils/tests/Android.bp @@ -0,0 +1,40 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_test { + name: "ThermalHidlWrapperTest", + srcs: ["ThermalHidlWrapperTest.cpp"], + defaults: [ + "VtsHalTargetTestDefaults", + "use_libaidlvintf_gtest_helper_static", + ], + shared_libs: [ + "libbinder_ndk", + "android.hardware.thermal@1.0", + "android.hardware.thermal@2.0", + "android.hardware.thermal-V1-ndk", + ], + static_libs: [ + "libthermalutils", + "libgtest", + ], + test_suites: [ + "device-tests", + ], +} diff --git a/thermal/utils/tests/ThermalHidlWrapperTest.cpp b/thermal/utils/tests/ThermalHidlWrapperTest.cpp new file mode 100644 index 0000000000..1723a1afa8 --- /dev/null +++ b/thermal/utils/tests/ThermalHidlWrapperTest.cpp @@ -0,0 +1,302 @@ +/* + * 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. + */ + +#define LOG_TAG "thermal_hidl_wrapper_test" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +namespace aidl::android::hardware::thermal { + +namespace { + +using ::android::sp; +using ::android::hardware::hidl_enum_range; +using ::android::hardware::hidl_vec; +using ::android::hardware::Return; +using ::android::hardware::Void; + +using ::android::hardware::thermal::V1_0::ThermalStatus; +using ::android::hardware::thermal::V1_0::ThermalStatusCode; +using ::android::hardware::thermal::V2_0::CoolingDevice; +using ::android::hardware::thermal::V2_0::CoolingType; +using IThermal_2_0 = ::android::hardware::thermal::V2_0::IThermal; +using ::android::hardware::thermal::V2_0::IThermalChangedCallback; +using ::android::hardware::thermal::V2_0::Temperature; +using ::android::hardware::thermal::V2_0::TemperatureThreshold; +using ::android::hardware::thermal::V2_0::TemperatureType; +using ::android::hardware::thermal::V2_0::ThrottlingSeverity; + +constexpr char kCallbackNameNotifyThrottling[] = "notifyThrottling"; +static const Temperature kThrottleTemp = { + .type = TemperatureType::SKIN, + .name = "test temperature sensor", + .value = 98.6, + .throttlingStatus = ThrottlingSeverity::CRITICAL, +}; + +class ThermalCallbackArgs { + public: + Temperature temperature; +}; + +// Callback class for receiving thermal event notifications from main class +class ThermalCallback : public ::testing::VtsHalHidlTargetCallbackBase, + public IThermalChangedCallback { + public: + Return notifyThrottling(const Temperature& temperature) override { + ThermalCallbackArgs args; + args.temperature = temperature; + NotifyFromCallback(kCallbackNameNotifyThrottling, args); + return Void(); + } +}; + +// The main test class for THERMAL HIDL HAL 2.0. +class ThermalHidlWrapperTest : public ::testing::TestWithParam { + public: + void SetUp() override { + AIBinder* binder = AServiceManager_waitForService(GetParam().c_str()); + ASSERT_NE(binder, nullptr); + mThermal = sp::make(IThermal::fromBinder(ndk::SpAIBinder(binder))); + ASSERT_NE(mThermal, nullptr); + mThermalCallback = new (std::nothrow) ThermalCallback(); + ASSERT_NE(mThermalCallback, nullptr); + auto ret = mThermal->registerThermalChangedCallback( + mThermalCallback, false, TemperatureType::SKIN, + [](ThermalStatus status) { EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(ret.isOk()); + // Expect to fail if register again + ret = mThermal->registerThermalChangedCallback( + mThermalCallback, false, TemperatureType::SKIN, + [](ThermalStatus status) { EXPECT_NE(ThermalStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(ret.isOk()); + } + + void TearDown() override { + auto ret = mThermal->unregisterThermalChangedCallback( + mThermalCallback, + [](ThermalStatus status) { EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(ret.isOk()); + // Expect to fail if unregister again + ret = mThermal->unregisterThermalChangedCallback( + mThermalCallback, + [](ThermalStatus status) { EXPECT_NE(ThermalStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(ret.isOk()); + } + + protected: + sp mThermal; + sp mThermalCallback; +}; // class ThermalHidlWrapperTest + +// Test ThermalChangedCallback::notifyThrottling(). +// This just calls into and back from our local ThermalChangedCallback impl. +TEST_P(ThermalHidlWrapperTest, NotifyThrottlingTest) { + sp thermalCallback = new (std::nothrow) ThermalCallback(); + auto ret = thermalCallback->notifyThrottling(kThrottleTemp); + ASSERT_TRUE(ret.isOk()); + auto res = thermalCallback->WaitForCallback(kCallbackNameNotifyThrottling); + EXPECT_TRUE(res.no_timeout); + ASSERT_TRUE(res.args); + EXPECT_EQ(kThrottleTemp, res.args->temperature); +} + +// Test Thermal->registerThermalChangedCallback. +TEST_P(ThermalHidlWrapperTest, RegisterThermalChangedCallbackTest) { + // Expect to fail with same callback + auto ret = mThermal->registerThermalChangedCallback( + mThermalCallback, false, TemperatureType::SKIN, + [](ThermalStatus status) { EXPECT_EQ(ThermalStatusCode::FAILURE, status.code); }); + ASSERT_TRUE(ret.isOk()); + // Expect to fail with null callback + ret = mThermal->registerThermalChangedCallback( + nullptr, false, TemperatureType::SKIN, + [](ThermalStatus status) { EXPECT_EQ(ThermalStatusCode::FAILURE, status.code); }); + ASSERT_TRUE(ret.isOk()); + sp localThermalCallback = new (std::nothrow) ThermalCallback(); + // Expect to succeed with different callback + ret = mThermal->registerThermalChangedCallback( + localThermalCallback, false, TemperatureType::SKIN, + [](ThermalStatus status) { EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(ret.isOk()); + // Remove the local callback + ret = mThermal->unregisterThermalChangedCallback( + localThermalCallback, + [](ThermalStatus status) { EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(ret.isOk()); + // Expect to fail with null callback + ret = mThermal->unregisterThermalChangedCallback(nullptr, [](ThermalStatus status) { + EXPECT_EQ(ThermalStatusCode::FAILURE, status.code); + }); + ASSERT_TRUE(ret.isOk()); +} + +// Test Thermal->unregisterThermalChangedCallback. +TEST_P(ThermalHidlWrapperTest, UnregisterThermalChangedCallbackTest) { + sp localThermalCallback = new (std::nothrow) ThermalCallback(); + // Expect to fail as the callback was not registered before + auto ret = mThermal->unregisterThermalChangedCallback( + localThermalCallback, + [](ThermalStatus status) { EXPECT_NE(ThermalStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(ret.isOk()); + // Register a local callback + ret = mThermal->registerThermalChangedCallback( + localThermalCallback, false, TemperatureType::SKIN, + [](ThermalStatus status) { EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(ret.isOk()); + // Expect to succeed with callback removed + ret = mThermal->unregisterThermalChangedCallback( + localThermalCallback, + [](ThermalStatus status) { EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(ret.isOk()); + // Expect to fail as the callback has been unregistered already + ret = mThermal->unregisterThermalChangedCallback( + localThermalCallback, + [](ThermalStatus status) { EXPECT_NE(ThermalStatusCode::SUCCESS, status.code); }); + ASSERT_TRUE(ret.isOk()); +} + +// Sanity test for Thermal::getCurrentTemperatures(). +TEST_P(ThermalHidlWrapperTest, TemperatureTest) { + mThermal->getCurrentTemperatures(false, TemperatureType::SKIN, + [](ThermalStatus status, hidl_vec temperatures) { + if (temperatures.size()) { + EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); + } else { + EXPECT_NE(ThermalStatusCode::SUCCESS, status.code); + } + for (int i = 0; i < temperatures.size(); ++i) { + EXPECT_LT(0u, temperatures[i].name.size()); + } + }); + auto types = hidl_enum_range(); + for (const auto& type : types) { + mThermal->getCurrentTemperatures( + true, type, [&type](ThermalStatus status, hidl_vec temperatures) { + if (temperatures.size()) { + EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); + } else { + EXPECT_NE(ThermalStatusCode::SUCCESS, status.code); + } + for (int i = 0; i < temperatures.size(); ++i) { + EXPECT_EQ(type, temperatures[i].type); + EXPECT_LT(0u, temperatures[i].name.size()); + } + }); + } +} + +// Sanity test for Thermal::getTemperatureThresholds(). +TEST_P(ThermalHidlWrapperTest, TemperatureThresholdTest) { + mThermal->getTemperatureThresholds( + false, TemperatureType::SKIN, + [](ThermalStatus status, hidl_vec temperatures) { + if (temperatures.size()) { + EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); + } else { + EXPECT_NE(ThermalStatusCode::SUCCESS, status.code); + } + }); + for (int i = static_cast(TemperatureType::UNKNOWN); + i <= static_cast(TemperatureType::POWER_AMPLIFIER); ++i) { + auto type = static_cast(i); + mThermal->getTemperatureThresholds( + true, type, + [&type](ThermalStatus status, hidl_vec temperatures) { + if (temperatures.size()) { + EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); + } else { + EXPECT_NE(ThermalStatusCode::SUCCESS, status.code); + } + for (int i = 0; i < temperatures.size(); ++i) { + EXPECT_EQ(type, temperatures[i].type); + } + }); + } +} + +// Sanity test for Thermal::getCurrentCoolingDevices(). +TEST_P(ThermalHidlWrapperTest, CoolingDeviceTest) { + mThermal->getCurrentCoolingDevices( + false, CoolingType::CPU, + [](ThermalStatus status, hidl_vec cooling_devices) { + if (cooling_devices.size()) { + EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); + } else { + EXPECT_NE(ThermalStatusCode::SUCCESS, status.code); + } + for (int i = 0; i < cooling_devices.size(); ++i) { + EXPECT_LT(0u, cooling_devices[i].name.size()); + } + }); + for (int i = 0; i <= static_cast(CoolingType::COMPONENT); ++i) { + auto type = static_cast(i); + mThermal->getCurrentCoolingDevices( + true, type, [&type](ThermalStatus status, hidl_vec cooling_devices) { + if (cooling_devices.size()) { + EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); + } else { + EXPECT_NE(ThermalStatusCode::SUCCESS, status.code); + } + for (int i = 0; i < cooling_devices.size(); ++i) { + EXPECT_EQ(type, cooling_devices[i].type); + EXPECT_LT(0u, cooling_devices[i].name.size()); + } + }); + } +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ThermalHidlWrapperTest); +INSTANTIATE_TEST_SUITE_P( + PerInstance, ThermalHidlWrapperTest, + testing::ValuesIn(::android::getAidlHalInstanceNames(IThermal::descriptor)), + ::android::hardware::PrintInstanceNameToString); + +} // namespace + +int main(int argc, char** argv) { + ::testing::InitGoogleTest(&argc, argv); + ABinderProcess_setThreadPoolMaxThreadCount(1); + ABinderProcess_startThreadPool(); + return RUN_ALL_TESTS(); +} + +} // namespace aidl::android::hardware::thermal From a0060489fdf2b09a5578a337e6711722cab41f94 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Tue, 21 Feb 2023 12:48:10 -0800 Subject: [PATCH 759/998] Increase timer test tolerance. This test was flaky on cf. Increase the tolerance to make it stable. This CL also modifies subscribe test to not rely on sleep to make it stable. Test: Presubmit Bug: 268603744 270074790 Change-Id: I4a8003be152ef0a1f409f3705892fffee58170dd --- .../vhal_v2_0/tests/DefaultVhalImpl_test.cpp | 30 ++++++++++++------- .../2.0/default/tests/RecurrentTimer_test.cpp | 2 +- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp index df5ada6aa2..b5026a63dd 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp @@ -124,6 +124,17 @@ class DefaultVhalImplTest : public ::testing::Test { android::ConcurrentQueue mEventQueue; android::ConcurrentQueue mHeartBeatQueue; + // Wait until receive enough events in receivedEvents. + void waitForEvents(std::vector* receivedEvents, size_t count) { + while (receivedEvents->size() < count) { + mEventQueue.waitForItems(); + auto newEvents = mEventQueue.flush(); + for (size_t i = 0; i < newEvents.size(); i++) { + receivedEvents->push_back(std::move(newEvents[i])); + } + } + } + private: void onHalEvent(VehiclePropValuePtr v) { if (v->prop != toInt(VehicleProperty::VHAL_HEARTBEAT)) { @@ -314,26 +325,25 @@ TEST_F(DefaultVhalImplTest, testSubscribe) { ASSERT_EQ(StatusCode::OK, status); - std::this_thread::sleep_for(std::chrono::milliseconds(500)); + std::vector receivedEvents; + waitForEvents(&receivedEvents, 5); - // Modify the speed after 0.5 seconds. + // Modify the speed after 5 events arrive. VehiclePropValue value; value.prop = toInt(VehicleProperty::PERF_VEHICLE_SPEED); value.value.floatValues.resize(1); value.value.floatValues[0] = 1.0f; ASSERT_EQ(StatusCode::OK, mHal->set(value)); - std::this_thread::sleep_for(std::chrono::milliseconds(500)); - - auto events = mEventQueue.flush(); - ASSERT_LE((size_t)10, events.size()); + waitForEvents(&receivedEvents, 10); // The first event should be the default value. - ASSERT_EQ((size_t)1, events[0]->value.floatValues.size()); - EXPECT_EQ(0.0f, events[0]->value.floatValues[0]); + ASSERT_EQ((size_t)1, receivedEvents[0]->value.floatValues.size()); + EXPECT_EQ(0.0f, receivedEvents[0]->value.floatValues[0]); // The last event should be the value after update. - ASSERT_EQ((size_t)1, events[events.size() - 1]->value.floatValues.size()); - EXPECT_EQ(1.0f, events[events.size() - 1]->value.floatValues[0]); + const auto& lastEvent = receivedEvents[receivedEvents.size() - 1]; + ASSERT_EQ((size_t)1, lastEvent->value.floatValues.size()); + EXPECT_EQ(1.0f, lastEvent->value.floatValues[0]); } TEST_F(DefaultVhalImplTest, testSubscribeInvalidProp) { diff --git a/automotive/vehicle/2.0/default/tests/RecurrentTimer_test.cpp b/automotive/vehicle/2.0/default/tests/RecurrentTimer_test.cpp index d7547f6556..2e59dbfc90 100644 --- a/automotive/vehicle/2.0/default/tests/RecurrentTimer_test.cpp +++ b/automotive/vehicle/2.0/default/tests/RecurrentTimer_test.cpp @@ -69,7 +69,7 @@ TEST(RecurrentTimerTest, multipleIntervals) { std::this_thread::sleep_for(milliseconds(100)); // This test is unstable, so set the tolerance to 50. ASSERT_EQ_WITH_TOLERANCE(100, counter1ms.load(), 50); - ASSERT_EQ_WITH_TOLERANCE(20, counter5ms.load(), 5); + ASSERT_EQ_WITH_TOLERANCE(20, counter5ms.load(), 10); } } // anonymous namespace From fde8c2428e9f6ffe87065012f8aa0442f48620bf Mon Sep 17 00:00:00 2001 From: shrikar Date: Thu, 2 Feb 2023 01:10:33 +0000 Subject: [PATCH 760/998] Added CRUISE_CONTROL_TARGET_SPEED to HAL layer. Bug: 266861469 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: Ie156bf9df65024bc39e4a1cd40fa870aa69d3a57 Merged-In: Ie156bf9df65024bc39e4a1cd40fa870aa69d3a57 --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../config/DefaultProperties.json | 15 +++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 19 +++++++++++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++++++ 8 files changed, 45 insertions(+) diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 2335d6d564..574f8bdaf9 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -265,6 +265,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::CRUISE_CONTROL_TYPE, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyAccess::WRITE}, + {VehicleProperty::CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyAccess::READ}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess::READ}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index a0911c5ca0..9a2f8a36db 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -265,6 +265,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::CRUISE_CONTROL_TYPE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index e9670c1e97..d993860272 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -257,6 +257,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.CRUISE_CONTROL_TYPE, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyAccess.WRITE), + Map.entry(VehicleProperty.CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess.READ), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index 2513e4ecd2..daa6a87517 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -257,6 +257,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.CRUISE_CONTROL_TYPE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 85a7486a40..774ff4f857 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3248,6 +3248,21 @@ } ] }, + { + "property": "VehicleProperty::CRUISE_CONTROL_TARGET_SPEED", + "defaultValue": { + "floatValues": [ + 25.0 + ] + }, + "areas": [ + { + "areaId": 0, + "minFloatValue": 20.0, + "maxFloatValue": 35.0 + } + ] + }, { "property": "VehicleProperty::HANDS_ON_DETECTION_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index a525ab0623..70eb5d38be 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -263,6 +263,7 @@ enum VehicleProperty { CRUISE_CONTROL_TYPE = (((0x1010 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411088 */, CRUISE_CONTROL_STATE = (((0x1011 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411089 */, CRUISE_CONTROL_COMMAND = (((0x1012 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411090 */, + CRUISE_CONTROL_TARGET_SPEED = (((0x1013 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.FLOAT) /* 291508243 */, HANDS_ON_DETECTION_ENABLED = (((0x1016 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313942 */, HANDS_ON_DETECTION_DRIVER_STATE = (((0x1017 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411095 */, HANDS_ON_DETECTION_WARNING = (((0x1018 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411096 */, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index b350f90a7e..8c2057a647 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3985,6 +3985,25 @@ enum VehicleProperty { CRUISE_CONTROL_COMMAND = 0x1012 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** + * Current target speed for Cruise Control (CC). + * + * OEMs should set the minInt32Value and maxInt32Value values for this property to define the + * min and max target speed values. These values must be non-negative. + * + * The maxFloatValue represents the upper bound of the target speed. + * The minFloatValue represents the lower bound of the target speed. + * + * When this property is not available (for example when CRUISE_CONTROL_ENABLED is false), it + * should return StatusCode.NOT_AVAILABLE_DISABLED. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ + * @unit VehicleUnit:METER_PER_SEC + */ + CRUISE_CONTROL_TARGET_SPEED = + 0x1013 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.FLOAT, + /** * Enable or disable hands on detection (HOD). * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 51cc3765da..ad3f277596 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -534,6 +534,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlCommandConfig) { VehicleArea::GLOBAL, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlTargetSpeedConfig) { + verifyProperty(VehicleProperty::CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::FLOAT); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionEnabledConfig) { verifyProperty(VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From a5634fe6a0a74509e3370fe7d16fe7baab64e8ab Mon Sep 17 00:00:00 2001 From: shrikar Date: Wed, 22 Feb 2023 18:42:59 +0000 Subject: [PATCH 761/998] Added temporary unavailable state behavior to ADAS ENABLED property docs Bug: 269785806 Test: manual build Change-Id: I43c37fbe692ed1a5c1bdf36dee4cb7bda4e4ad5b --- .../automotive/vehicle/VehicleProperty.aidl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index b350f90a7e..6f25f3b93d 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3878,6 +3878,11 @@ enum VehicleProperty { * maneuver is detected, ELKA alerts the driver and applies steering corrections to keep the * vehicle in its original lane. * + * In general, EMERGENCY_LANE_KEEP_ASSIST_ENABLED should always return true or false. If the + * feature is not available due to some temporary state, such as the vehicle speed being too + * low, that information must be conveyed through the ErrorState values in the + * EMERGENCY_LANE_KEEP_ASSIST_STATE property. + * * This property is defined as read_write, but OEMs have the option to implement it as read * only. * @@ -3916,6 +3921,11 @@ enum VehicleProperty { * When CC is enabled, the ADAS system in the vehicle should be turned on and responding to * commands. * + * In general, CRUISE_CONTROL_ENABLED should always return true or false. If the feature is not + * available due to some temporary state, such as the vehicle speed being too low, that + * information must be conveyed through the ErrorState values in the CRUISE_CONTROL_STATE + * property. + * * This property is defined as read_write, but OEMs have the option to implement it as read * only. * @@ -3992,6 +4002,10 @@ enum VehicleProperty { * vehicle should be monitoring the presence of the driver's hands on the steering wheel and * send a warning if it detects that the driver's hands are no longer on the steering wheel. * + * In general, HANDS_ON_DETECTION_ENABLED should always return true or false. If the feature is + * not available due to some temporary state, that information must be conveyed through the + * ErrorState values in the HANDS_ON_DETECTION_STATE property. + * * This property is defined as read_write, but OEMs have the option to implement it as read * only. * @@ -4055,6 +4069,10 @@ enum VehicleProperty { * be monitoring the attention level of the driver and should send a warning if it detects that * the driver is distracted. * + * In general, DRIVER_ATTENTION_MONITORING_ENABLED should always return true or false. If the + * feature is not available due to some temporary state, that information must be conveyed + * through the ErrorState values in the DRIVER_ATTENTION_MONITORING_STATE property. + * * This property is defined as read_write, but OEMs have the option to implement it as read * only. * From 0c642ecd42d03c38da589eda12e97da345213ea4 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Wed, 22 Feb 2023 21:03:48 +0000 Subject: [PATCH 762/998] Comment fixes for the Wifi Vendor HAL. Bug: 267819850 Test: m Change-Id: Iaf8bd05482b87f8b0a56da8c4169413d1c6b7d0e --- wifi/aidl/android/hardware/wifi/MacAddress.aidl | 2 -- wifi/aidl/android/hardware/wifi/NanMatchInd.aidl | 2 +- wifi/aidl/android/hardware/wifi/NanPairingAkm.aidl | 2 +- wifi/aidl/android/hardware/wifi/NpkSecurityAssociation.aidl | 4 ++-- wifi/aidl/android/hardware/wifi/Ssid.aidl | 2 -- 5 files changed, 4 insertions(+), 8 deletions(-) diff --git a/wifi/aidl/android/hardware/wifi/MacAddress.aidl b/wifi/aidl/android/hardware/wifi/MacAddress.aidl index d59dfe3c0f..d2385658cc 100644 --- a/wifi/aidl/android/hardware/wifi/MacAddress.aidl +++ b/wifi/aidl/android/hardware/wifi/MacAddress.aidl @@ -20,8 +20,6 @@ package android.hardware.wifi; * Byte array representing a Mac Address. Use when we need to * pass an array of Mac Addresses to a method, as variable-sized * 2D arrays are not supported in AIDL. - * - * TODO (b/210705533): Replace this type with a 2D byte array. */ @VintfStability parcelable MacAddress { diff --git a/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl b/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl index be2fa316d0..314d59922a 100644 --- a/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl +++ b/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl @@ -123,7 +123,7 @@ parcelable NanMatchInd { NanRangingIndication rangingIndicationType; /** * Security Context Identifier attribute contains PMKID. Shall be included in NDP setup and - * response messages. Security Context Identifie identifies the Security Context. For NAN + * response messages. Security Context Identifier identifies the Security Context. For NAN * Shared Key Cipher Suite, this field contains the 16 octet PMKID identifying the PMK used for * setting up the Secure Data Path. */ diff --git a/wifi/aidl/android/hardware/wifi/NanPairingAkm.aidl b/wifi/aidl/android/hardware/wifi/NanPairingAkm.aidl index 31eeb2b92d..a823a3f4b7 100644 --- a/wifi/aidl/android/hardware/wifi/NanPairingAkm.aidl +++ b/wifi/aidl/android/hardware/wifi/NanPairingAkm.aidl @@ -17,6 +17,6 @@ package android.hardware.wifi; /** - * THe AKM used of NAN pairing + * The AKM used in the NAN pairing. */ @VintfStability @Backing(type="int") enum NanPairingAkm { SAE = 0, PASN=1 } diff --git a/wifi/aidl/android/hardware/wifi/NpkSecurityAssociation.aidl b/wifi/aidl/android/hardware/wifi/NpkSecurityAssociation.aidl index 32e84098d4..6d85eea369 100644 --- a/wifi/aidl/android/hardware/wifi/NpkSecurityAssociation.aidl +++ b/wifi/aidl/android/hardware/wifi/NpkSecurityAssociation.aidl @@ -20,7 +20,7 @@ import android.hardware.wifi.NanCipherSuiteType; import android.hardware.wifi.NanPairingAkm; /** - * The security sssociation info after Aware Pairing setup. + * The security association info after Aware Pairing setup. */ @VintfStability parcelable NpkSecurityAssociation { @@ -37,7 +37,7 @@ parcelable NpkSecurityAssociation { */ byte[32] npk; /** - * The AKM is used for key exchange in this security sssociation + * The AKM is used for key exchange in this security association */ NanPairingAkm akm; /** diff --git a/wifi/aidl/android/hardware/wifi/Ssid.aidl b/wifi/aidl/android/hardware/wifi/Ssid.aidl index fd985a3f10..230cef619b 100644 --- a/wifi/aidl/android/hardware/wifi/Ssid.aidl +++ b/wifi/aidl/android/hardware/wifi/Ssid.aidl @@ -20,8 +20,6 @@ package android.hardware.wifi; * Byte array representing an Ssid. Use when we need to * pass an array of Ssid's to a method, as variable-sized * 2D arrays are not supported in AIDL. - * - * TODO (b/210705533): Replace this type with a 2D byte array. */ @VintfStability parcelable Ssid { From b9661d31f109e1d6bcfdceb80c90b5384950f535 Mon Sep 17 00:00:00 2001 From: shrikar Date: Thu, 2 Feb 2023 19:22:50 +0000 Subject: [PATCH 763/998] Added ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP to HAL layer. Bug: 266866449 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: Ibe1a9cdcc6a82e20f4c0524b362ea52d3ca02f25 Merged-In: Ibe1a9cdcc6a82e20f4c0524b362ea52d3ca02f25 --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../config/DefaultProperties.json | 16 ++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 22 +++++++++++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 +++++ 8 files changed, 49 insertions(+) diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 574f8bdaf9..884fd14198 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -266,6 +266,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyAccess::WRITE}, {VehicleProperty::CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyAccess::READ}, + {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess::READ}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 9a2f8a36db..dbb10f7144 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -266,6 +266,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::CRUISE_CONTROL_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index d993860272..ecd2058aee 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -258,6 +258,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyAccess.WRITE), Map.entry(VehicleProperty.CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyAccess.READ), + Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess.READ), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index daa6a87517..ca958423fb 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -258,6 +258,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.CRUISE_CONTROL_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 774ff4f857..ba844cbb70 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3263,6 +3263,22 @@ } ] }, + { + "property": "VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP", + "defaultValue": { + "int32Values": [ + 1200 + ] + }, + "configArray": [ + 1200, + 1400, + 1600, + 1800, + 2000, + 2200 + ] + }, { "property": "VehicleProperty::HANDS_ON_DETECTION_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 70eb5d38be..116099fa9a 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -264,6 +264,7 @@ enum VehicleProperty { CRUISE_CONTROL_STATE = (((0x1011 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411089 */, CRUISE_CONTROL_COMMAND = (((0x1012 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411090 */, CRUISE_CONTROL_TARGET_SPEED = (((0x1013 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.FLOAT) /* 291508243 */, + ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP = (((0x1014 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411092 */, HANDS_ON_DETECTION_ENABLED = (((0x1016 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313942 */, HANDS_ON_DETECTION_DRIVER_STATE = (((0x1017 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411095 */, HANDS_ON_DETECTION_WARNING = (((0x1018 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411096 */, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index d4b02a2af5..e91b06b974 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -4014,6 +4014,28 @@ enum VehicleProperty { CRUISE_CONTROL_TARGET_SPEED = 0x1013 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.FLOAT, + /** + * Current target time gap for Adaptive Cruise Control (ACC) or Predictive Cruise Control in + * milliseconds. + * + * This property should specify the target time gap to a leading vehicle. This gap is defined as + * the time to travel the distance between the leading vehicle's rear-most point to the ACC + * vehicle's front-most point. The actual time gap from a leading vehicle can be above or below + * this value. + * + * The possible values to set for the target time gap should be specified in configArray in + * ascending order. All values must be positive. If the property is writable, all values must be + * writable. + * + * Writing to this property when it is not available should return StatusCode.NOT_AVAILABLE. + * + * @change_mode VehiclePropertyChangeMode.ON_CHANGE + * @access VehiclePropertyAccess.READ_WRITE + * @unit VehicleUnit:MILLI_SECS + */ + ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP = + 0x1014 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** * Enable or disable hands on detection (HOD). * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index ad3f277596..3170a19993 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -540,6 +540,12 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyCruiseControlTargetSpeedConfig) VehicleArea::GLOBAL, VehiclePropertyType::FLOAT); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAdaptiveCruiseControlTargetTimeGapConfig) { + verifyProperty(VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, + VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionEnabledConfig) { verifyProperty(VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From 569840587370ca9fae3f832b4c55fae3c50da83a Mon Sep 17 00:00:00 2001 From: Joe Bolinger Date: Thu, 23 Feb 2023 00:25:39 +0000 Subject: [PATCH 764/998] Add display state and authenticate reason to biometric AIDL interface. Bug: 268295421 Test: N/A Change-Id: Ifc643457a4e61149721a38938f8e20976b54cf56 --- .../biometrics/common/AuthenticateReason.aidl | 63 +++++++++++++++++++ .../biometrics/common/DisplayState.aidl | 43 +++++++++++++ .../biometrics/common/OperationContext.aidl | 5 ++ .../biometrics/common/AuthenticateReason.aidl | 59 +++++++++++++++++ .../biometrics/common/DisplayState.aidl | 41 ++++++++++++ .../biometrics/common/OperationContext.aidl | 15 ++++- 6 files changed, 225 insertions(+), 1 deletion(-) create mode 100644 biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/AuthenticateReason.aidl create mode 100644 biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/DisplayState.aidl create mode 100644 biometrics/common/aidl/android/hardware/biometrics/common/AuthenticateReason.aidl create mode 100644 biometrics/common/aidl/android/hardware/biometrics/common/DisplayState.aidl diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/AuthenticateReason.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/AuthenticateReason.aidl new file mode 100644 index 0000000000..f639ead601 --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/AuthenticateReason.aidl @@ -0,0 +1,63 @@ +/* + * 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 -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.hardware.biometrics.common; +/* @hide */ +@VintfStability +union AuthenticateReason { + android.hardware.biometrics.common.AuthenticateReason.Vendor vendorAuthenticateReason; + android.hardware.biometrics.common.AuthenticateReason.Face faceAuthenticateReason; + android.hardware.biometrics.common.AuthenticateReason.Fingerprint fingerprintAuthenticateReason; + @VintfStability + parcelable Vendor { + ParcelableHolder extension; + } + @Backing(type="int") @VintfStability + enum Fingerprint { + UNKNOWN, + } + @Backing(type="int") @VintfStability + enum Face { + UNKNOWN, + STARTED_WAKING_UP, + PRIMARY_BOUNCER_SHOWN, + ASSISTANT_VISIBLE, + ALTERNATE_BIOMETRIC_BOUNCER_SHOWN, + NOTIFICATION_PANEL_CLICKED, + OCCLUDING_APP_REQUESTED, + PICK_UP_GESTURE_TRIGGERED, + QS_EXPANDED, + SWIPE_UP_ON_BOUNCER, + UDFPS_POINTER_DOWN, + } +} diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/DisplayState.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/DisplayState.aidl new file mode 100644 index 0000000000..176e8d603b --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/DisplayState.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.hardware.biometrics.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum DisplayState { + UNKNOWN, + LOCKSCREEN, + NO_UI, + SCREENSAVER, + AOD, +} diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationContext.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationContext.aidl index 305e422778..378017e8d4 100644 --- a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationContext.aidl +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/current/android/hardware/biometrics/common/OperationContext.aidl @@ -37,7 +37,12 @@ package android.hardware.biometrics.common; parcelable OperationContext { int id = 0; android.hardware.biometrics.common.OperationReason reason = android.hardware.biometrics.common.OperationReason.UNKNOWN; + /** + * @deprecated use displayState instead. + */ boolean isAod = false; boolean isCrypto = false; android.hardware.biometrics.common.WakeReason wakeReason = android.hardware.biometrics.common.WakeReason.UNKNOWN; + android.hardware.biometrics.common.DisplayState displayState = android.hardware.biometrics.common.DisplayState.UNKNOWN; + @nullable android.hardware.biometrics.common.AuthenticateReason authenticateReason; } diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/AuthenticateReason.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/AuthenticateReason.aidl new file mode 100644 index 0000000000..fcf52949be --- /dev/null +++ b/biometrics/common/aidl/android/hardware/biometrics/common/AuthenticateReason.aidl @@ -0,0 +1,59 @@ +/* + * 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.hardware.biometrics.common; + +/** + * Reason for an authenticate operation. + * + * @hide + */ +@VintfStability +union AuthenticateReason { + /** Vendor reason for invoking an authenticate operation. */ + @VintfStability + parcelable Vendor { + ParcelableHolder extension; + } + + /** Reason for invoking fingerprint authentication. */ + @VintfStability + @Backing(type="int") + enum Fingerprint { + UNKNOWN, + } + + /** Reason for invoking face authentication. */ + @VintfStability + @Backing(type="int") + enum Face { + UNKNOWN, + STARTED_WAKING_UP, + PRIMARY_BOUNCER_SHOWN, + ASSISTANT_VISIBLE, + ALTERNATE_BIOMETRIC_BOUNCER_SHOWN, + NOTIFICATION_PANEL_CLICKED, + OCCLUDING_APP_REQUESTED, + PICK_UP_GESTURE_TRIGGERED, + QS_EXPANDED, + SWIPE_UP_ON_BOUNCER, + UDFPS_POINTER_DOWN, + } + + AuthenticateReason.Vendor vendorAuthenticateReason; + AuthenticateReason.Face faceAuthenticateReason; + AuthenticateReason.Fingerprint fingerprintAuthenticateReason; +} diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/DisplayState.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/DisplayState.aidl new file mode 100644 index 0000000000..d01eac83f3 --- /dev/null +++ b/biometrics/common/aidl/android/hardware/biometrics/common/DisplayState.aidl @@ -0,0 +1,41 @@ +/* + * 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.hardware.biometrics.common; + +/** + * Display state during an operation. + * + * @hide + */ +@VintfStability +@Backing(type="int") +enum DisplayState { + /** The display state is unknown. */ + UNKNOWN, + + /** The display is on and showing the lockscreen (or an occluding app). */ + LOCKSCREEN, + + /** The display is off or dozing. */ + NO_UI, + + /** The display is showing a screensaver (dreaming). */ + SCREENSAVER, + + /** The display is dreaming with always on display. */ + AOD, +} diff --git a/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl b/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl index a8f768d805..f4191d751a 100644 --- a/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl +++ b/biometrics/common/aidl/android/hardware/biometrics/common/OperationContext.aidl @@ -16,6 +16,8 @@ package android.hardware.biometrics.common; +import android.hardware.biometrics.common.AuthenticateReason; +import android.hardware.biometrics.common.DisplayState; import android.hardware.biometrics.common.OperationReason; import android.hardware.biometrics.common.WakeReason; @@ -43,7 +45,7 @@ parcelable OperationContext { */ OperationReason reason = OperationReason.UNKNOWN; - /* Flag indicating that the display is in AOD mode. */ + /** @deprecated use displayState instead. */ boolean isAod = false; /** Flag indicating that crypto was requested. */ @@ -58,4 +60,15 @@ parcelable OperationContext { * policy. */ WakeReason wakeReason = WakeReason.UNKNOWN; + + /** The current display state. */ + DisplayState displayState = DisplayState.UNKNOWN; + + /** + * An associated reason for an authenticate operation. + * + * This should be interpreted as a hint to enable optimizations or tracing. The + * framework may choose to omit the reason at any time based on the device's policy. + */ + @nullable AuthenticateReason authenticateReason; } From 40bc040455eea83885042c522ae2cd5a9d0bdbcd Mon Sep 17 00:00:00 2001 From: ziyiw Date: Thu, 23 Feb 2023 02:05:51 +0000 Subject: [PATCH 765/998] Change the unit of slot duration from ms to rstu. Test: compile Bug: 266980744 Change-Id: Iba643094f9d44293e47b68487aeae30847af4826 --- uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/.hash | 2 +- .../uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl | 2 +- .../uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl | 2 +- .../uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/.hash b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/.hash index 856fa7c27f..42772bb6c1 100644 --- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/.hash +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/.hash @@ -1 +1 @@ -39791e3a4bb9892a340e94e44860048624d2f66e +590d9f45625a2c353011cf85f18d1d08593b8a0a diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl index e2c06e563d..0cc01c59bd 100644 --- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/2/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl @@ -49,7 +49,7 @@ enum UwbVendorCapabilityTlvTypes { SUPPORTED_RANGE_DATA_NTF_CONFIG = 229, SUPPORTED_RSSI_REPORTING = 230, SUPPORTED_DIAGNOSTICS = 231, - SUPPORTED_MIN_SLOT_DURATION_MS = 232, + SUPPORTED_MIN_SLOT_DURATION_RSTU = 232, SUPPORTED_MAX_RANGING_SESSION_NUMBER = 233, SUPPORTED_CHANNELS_AOA = 234, } diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl index e2c06e563d..0cc01c59bd 100644 --- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl @@ -49,7 +49,7 @@ enum UwbVendorCapabilityTlvTypes { SUPPORTED_RANGE_DATA_NTF_CONFIG = 229, SUPPORTED_RSSI_REPORTING = 230, SUPPORTED_DIAGNOSTICS = 231, - SUPPORTED_MIN_SLOT_DURATION_MS = 232, + SUPPORTED_MIN_SLOT_DURATION_RSTU = 232, SUPPORTED_MAX_RANGING_SESSION_NUMBER = 233, SUPPORTED_CHANNELS_AOA = 234, } diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl index bf59318085..891b6f0853 100644 --- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl +++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl @@ -186,9 +186,9 @@ enum UwbVendorCapabilityTlvTypes { SUPPORTED_DIAGNOSTICS = 0xE7, /** - * 4 byte value to indicate supported min slot duration in ms. + * 4 byte value to indicate supported min slot duration in rstu. */ - SUPPORTED_MIN_SLOT_DURATION_MS = 0xE8, + SUPPORTED_MIN_SLOT_DURATION_RSTU = 0xE8, /** * Int value to indicate supported max number of fira ranging sessions From a696f19de84eebe242a022b52be6af592a22bf69 Mon Sep 17 00:00:00 2001 From: Paul Colta Date: Thu, 23 Feb 2023 10:44:32 +0100 Subject: [PATCH 766/998] Handle portId out of bounds index Bug: 268631136 Test: m && m android.hardware.tv.cec@1.0-impl && m android.hardware.tv.cec@1.0 Change-Id: I454caf56c309aae9667afd0e58da453002458a80 (cherry picked from commit 588b958ce1b50d42581e67a664b32e2f25f37712) --- tv/cec/1.0/default/HdmiCecDefault.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tv/cec/1.0/default/HdmiCecDefault.cpp b/tv/cec/1.0/default/HdmiCecDefault.cpp index 26ccb7d42e..2a5197cb4a 100644 --- a/tv/cec/1.0/default/HdmiCecDefault.cpp +++ b/tv/cec/1.0/default/HdmiCecDefault.cpp @@ -278,6 +278,10 @@ Return HdmiCecDefault::enableAudioReturnChannel(int32_t /*portId*/, bool / Return HdmiCecDefault::isConnected(int32_t portId) { uint16_t addr; + if (portId < 0 || portId >= mHdmiCecPorts.size()) { + LOG(ERROR) << "Port id is out of bounds, portId = " << portId; + return false; + } int ret = ioctl(mHdmiCecPorts[portId]->mCecFd, CEC_ADAP_G_PHYS_ADDR, &addr); if (ret) { LOG(ERROR) << "Is connected failed, Error = " << strerror(errno); From d18830727694c55890c9bc2273e763e74a233fe4 Mon Sep 17 00:00:00 2001 From: Bob Badour Date: Thu, 23 Feb 2023 08:56:44 -0800 Subject: [PATCH 767/998] [LSC] Add LOCAL_LICENSE_KINDS to hardware/interfaces Added SPDX-license-identifier-Apache-2.0 to: staging/threadnetwork/aidl/Android.bp staging/threadnetwork/aidl/default/Android.bp staging/threadnetwork/aidl/vts/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Change-Id: Id34f9d4cc3644af01703ade72a286ae5e0f0da66 --- staging/threadnetwork/aidl/Android.bp | 9 +++++++++ staging/threadnetwork/aidl/default/Android.bp | 9 +++++++++ staging/threadnetwork/aidl/vts/Android.bp | 9 +++++++++ 3 files changed, 27 insertions(+) diff --git a/staging/threadnetwork/aidl/Android.bp b/staging/threadnetwork/aidl/Android.bp index fcd3ab8501..b59d6da3f5 100644 --- a/staging/threadnetwork/aidl/Android.bp +++ b/staging/threadnetwork/aidl/Android.bp @@ -1,3 +1,12 @@ +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + aidl_interface { name: "android.hardware.threadnetwork", host_supported: true, diff --git a/staging/threadnetwork/aidl/default/Android.bp b/staging/threadnetwork/aidl/default/Android.bp index c7012951ea..8fc22ad538 100644 --- a/staging/threadnetwork/aidl/default/Android.bp +++ b/staging/threadnetwork/aidl/default/Android.bp @@ -12,6 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_defaults { name: "threadnetwork_service_default", vendor: true, diff --git a/staging/threadnetwork/aidl/vts/Android.bp b/staging/threadnetwork/aidl/vts/Android.bp index 70386d98be..e2609ed1b5 100644 --- a/staging/threadnetwork/aidl/vts/Android.bp +++ b/staging/threadnetwork/aidl/vts/Android.bp @@ -14,6 +14,15 @@ // limitations under the License. // +package { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + cc_test { name: "VtsHalThreadNetworkTargetTest", defaults: [ From 80e67aedf29ffe7e7ccd8b1c1525dc76a4611384 Mon Sep 17 00:00:00 2001 From: Shuzhen Wang Date: Thu, 9 Feb 2023 00:22:23 +0000 Subject: [PATCH 768/998] Camera: Document limitation on private reprocessing For private reprocessing, the ImageReader used to produce images into the ImageWriter isn't aware of the overridden format. If the HAL decides to override the input IMPLEMENTATION_DEFINED format, reprocessing will fail. Document this limitation in the HAL interface. Test: Build Bug: 266954992 Change-Id: I9bd05e9682e4d11870bf9bd25763f28291faef75 --- camera/device/3.2/types.hal | 11 +++++++---- .../android/hardware/camera/device/HalStream.aidl | 5 ++++- current.txt | 1 + 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/camera/device/3.2/types.hal b/camera/device/3.2/types.hal index 276e92a3ee..3989161667 100644 --- a/camera/device/3.2/types.hal +++ b/camera/device/3.2/types.hal @@ -346,15 +346,18 @@ struct HalStream { * An override pixel format for the buffers in this stream. * * The HAL must respect the requested format in Stream unless it is - * IMPLEMENTATION_DEFINED, in which case the override format here must be - * used by the client instead, for this stream. This allows cross-platform - * HALs to use a standard format since IMPLEMENTATION_DEFINED formats often - * require device-specific information. In all other cases, the + * IMPLEMENTATION_DEFINED output, in which case the override format + * here must be used by the client instead, for this stream. This allows + * cross-platform HALs to use a standard format since IMPLEMENTATION_DEFINED + * formats often require device-specific information. In all other cases, the * overrideFormat must match the requested format. * * When HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED is used, then the platform * gralloc module must select a format based on the usage flags provided by * the camera device and the other endpoint of the stream. + * + * For private reprocessing, the HAL must not override the input stream's + * IMPLEMENTATION_DEFINED format. */ android.hardware.graphics.common@1.0::PixelFormat overrideFormat; diff --git a/camera/device/aidl/android/hardware/camera/device/HalStream.aidl b/camera/device/aidl/android/hardware/camera/device/HalStream.aidl index b8ec3deec5..25a80bc16c 100644 --- a/camera/device/aidl/android/hardware/camera/device/HalStream.aidl +++ b/camera/device/aidl/android/hardware/camera/device/HalStream.aidl @@ -38,7 +38,7 @@ parcelable HalStream { * An override pixel format for the buffers in this stream. * * The HAL must respect the requested format in Stream unless it is - * IMPLEMENTATION_DEFINED, in which case the override format here must be + * IMPLEMENTATION_DEFINED output, in which case the override format here must be * used by the client instead, for this stream. This allows cross-platform * HALs to use a standard format since IMPLEMENTATION_DEFINED formats often * require device-specific information. In all other cases, the @@ -47,6 +47,9 @@ parcelable HalStream { * When HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED is used, then the platform * gralloc module must select a format based on the usage flags provided by * the camera device and the other endpoint of the stream. + * + * For private reprocessing, the HAL must not override the input stream's + * IMPLEMENTATION_DEFINED format. */ android.hardware.graphics.common.PixelFormat overrideFormat; diff --git a/current.txt b/current.txt index ef1f65a4b6..358d05a60e 100644 --- a/current.txt +++ b/current.txt @@ -934,5 +934,6 @@ b7ce2d87841585551b082fca6d099622e63b7099e0d8013f687ea1a1dc35c4dc android.hardwar 42abd285a4293dadb8c89bc63b90cae2872fbffe90c4517aa3ea4965e8aecff7 android.hardware.graphics.common@1.2::types 4f1a02d21a22104c734f71cdbba19b6f7e93d4ee107ff79f0dbdd171a8430e0e android.hardware.automotive.vehicle@2.0::types a2fbd9747fbb9ceb8c1090b5a24138312246502d5af0654a8c2b603a9bf521fc android.hardware.gnss@1.0::IGnssCallback +889b59e3e7a59afa67bf19882a44f51a2f9e43b6556ec52baa9ec3efd1ef7fbe android.hardware.camera.device@3.2::types # There will be no more HIDL HALs. Use AIDL instead. From 34563642f3d1192b103c6a385e57d7ff4f76d830 Mon Sep 17 00:00:00 2001 From: shrikar Date: Tue, 14 Feb 2023 02:57:17 +0000 Subject: [PATCH 769/998] Added LOCATION_CHARACTERIZATION to HAL layer. Bug: 269141226 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: Ia53508f032d905b8f211606238bb6c650f787d2b Merged-In: Ia53508f032d905b8f211606238bb6c650f787d2b --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../JsonConfigLoader/src/JsonConfigLoader.cpp | 3 + .../config/DefaultProperties.json | 8 ++ .../utils/common/include/VehicleHalTypes.h | 1 + .../vehicle/LocationCharacterization.aidl | 46 ++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../vehicle/LocationCharacterization.aidl | 73 +++++++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 14 ++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 6 ++ 12 files changed, 156 insertions(+) create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LocationCharacterization.aidl create mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LocationCharacterization.aidl diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 574f8bdaf9..18b4cfd826 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -191,6 +191,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::GLOVE_BOX_DOOR_POS, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::GLOVE_BOX_LOCKED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::LOCATION_CHARACTERIZATION, VehiclePropertyAccess::READ}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyAccess::READ}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyAccess::READ}, {VehicleProperty::OBD2_FREEZE_FRAME_INFO, VehiclePropertyAccess::READ}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index 9a2f8a36db..c4087e1d6a 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -191,6 +191,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::GLOVE_BOX_DOOR_POS, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::GLOVE_BOX_LOCKED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::LOCATION_CHARACTERIZATION, VehiclePropertyChangeMode::STATIC}, {VehicleProperty::OBD2_LIVE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_FREEZE_FRAME, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::OBD2_FREEZE_FRAME_INFO, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index d993860272..a26bbe963a 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -183,6 +183,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.GLOVE_BOX_DOOR_POS, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.GLOVE_BOX_LOCKED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.LOCATION_CHARACTERIZATION, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME_INFO, VehiclePropertyAccess.READ), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index daa6a87517..2da8dd9a48 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -183,6 +183,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.GLOVE_BOX_DOOR_POS, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.GLOVE_BOX_LOCKED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.VEHICLE_MAP_SERVICE, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.LOCATION_CHARACTERIZATION, VehiclePropertyChangeMode.STATIC), Map.entry(VehicleProperty.OBD2_LIVE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.OBD2_FREEZE_FRAME_INFO, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index a6511787e5..d92107945e 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -57,6 +57,7 @@ using ::aidl::android::hardware::automotive::vehicle::LaneCenteringAssistCommand using ::aidl::android::hardware::automotive::vehicle::LaneCenteringAssistState; using ::aidl::android::hardware::automotive::vehicle::LaneDepartureWarningState; using ::aidl::android::hardware::automotive::vehicle::LaneKeepAssistState; +using ::aidl::android::hardware::automotive::vehicle::LocationCharacterization; using ::aidl::android::hardware::automotive::vehicle::RawPropValues; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport; using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq; @@ -200,6 +201,8 @@ JsonValueParser::JsonValueParser() { std::make_unique>(); mConstantParsersByType["VehiclePropertyChangeMode"] = std::make_unique>(); + mConstantParsersByType["LocationCharacterization"] = + std::make_unique>(); mConstantParsersByType["VehicleGear"] = std::make_unique>(); mConstantParsersByType["VehicleAreaWindow"] = std::make_unique>(); diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 774ff4f857..b146da380f 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3129,6 +3129,14 @@ { "property": "VehicleProperty::VEHICLE_MAP_SERVICE" }, + { + "property": "VehicleProperty::LOCATION_CHARACTERIZATION", + "defaultValue": { + "int32Values": [ + "LocationCharacterization::RAW_GNSS_ONLY" + ] + } + }, { "property": "VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_TYPE", "defaultValue": { diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index fc0c8db1e4..7db4246333 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LocationCharacterization.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LocationCharacterization.aidl new file mode 100644 index 0000000000..27abe417dc --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/LocationCharacterization.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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum LocationCharacterization { + PRIOR_LOCATIONS = 0x1, + GYROSCOPE_FUSION = 0x2, + ACCELEROMETER_FUSION = 0x4, + COMPASS_FUSION = 0x8, + WHEEL_SPEED_FUSION = 0x10, + STEERING_ANGLE_FUSION = 0x20, + CAR_SPEED_FUSION = 0x40, + DEAD_RECKONED = 0x80, + RAW_GNSS_ONLY = 0x100, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 70eb5d38be..d947a56a61 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -189,6 +189,7 @@ enum VehicleProperty { GLOVE_BOX_DOOR_POS = (((0x0BF0 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518896 */, GLOVE_BOX_LOCKED = (((0x0BF1 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 354421745 */, VEHICLE_MAP_SERVICE = (((0x0C00 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299895808 */, + LOCATION_CHARACTERIZATION = (((0x0C10 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410064 */, OBD2_LIVE_FRAME = (((0x0D00 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896064 */, OBD2_FREEZE_FRAME = (((0x0D01 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896065 */, OBD2_FREEZE_FRAME_INFO = (((0x0D02 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896066 */, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LocationCharacterization.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LocationCharacterization.aidl new file mode 100644 index 0000000000..e06df40c90 --- /dev/null +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/LocationCharacterization.aidl @@ -0,0 +1,73 @@ +/* + * 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.hardware.automotive.vehicle; + +/** + * Used by LOCATION_CHARACTERIZATION to enumerate the supported bit flags. + * + * These flags are used to indicate to what transformations are performed on the + * GNSS data before the location data is sent, so that location processing + * algorithms can take into account prior fusion. + * + * This enum can be extended in future releases to include additional bit flags. + */ +@VintfStability +@Backing(type="int") +enum LocationCharacterization { + /** + * Prior location samples have been used to refine the raw GNSS data (e.g. a + * Kalman Filter). + */ + PRIOR_LOCATIONS = 0x1, + /** + * Gyroscope data has been used to refine the raw GNSS data. + */ + GYROSCOPE_FUSION = 0x2, + /** + * Accelerometer data has been used to refine the raw GNSS data. + */ + ACCELEROMETER_FUSION = 0x4, + /** + * Compass data has been used to refine the raw GNSS data. + */ + COMPASS_FUSION = 0x8, + /** + * Wheel speed has been used to refine the raw GNSS data. + */ + WHEEL_SPEED_FUSION = 0x10, + /** + * Steering angle has been used to refine the raw GNSS data. + */ + STEERING_ANGLE_FUSION = 0x20, + /** + * Car speed has been used to refine the raw GNSS data. + */ + CAR_SPEED_FUSION = 0x40, + /** + * Some effort is made to dead-reckon location. In particular, this means that + * relative changes in location have meaning when no GNSS satellite is + * available. + */ + DEAD_RECKONED = 0x80, + /** + * Location is based on GNSS satellite signals without sufficient fusion of + * other sensors for complete dead reckoning. This flag should be set when + * relative changes to location cannot be relied on when no GNSS satellite is + * available. + */ + RAW_GNSS_ONLY = 0x100, +} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index d4b02a2af5..7859deebb4 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -2347,6 +2347,20 @@ enum VehicleProperty { */ VEHICLE_MAP_SERVICE = 0x0C00 + 0x10000000 + 0x01000000 + 0x00e00000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:MIXED + /** + * Characterization of inputs used for computing location. + * + * This property must indicate what (if any) data and sensor inputs are considered by the system + * when computing the vehicle's location that is shared with Android through the GNSS HAL. + * + * The value must return a collection of bit flags. The bit flags are defined in + * LocationCharacterization. + * + * @change_mode VehiclePropertyChangeMode.STATIC + * @access VehiclePropertyAccess.READ + */ + LOCATION_CHARACTERIZATION = + 0x0C10 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, /** * OBD2 Live Sensor Data * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index ad3f277596..848ca62a92 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -498,6 +498,12 @@ void VtsHalAutomotiveVehicleTargetTest::verifyProperty(VehicleProperty propId, actualPropertyType); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyLocationCharacterizationConfig) { + verifyProperty(VehicleProperty::LOCATION_CHARACTERIZATION, VehiclePropertyAccess::READ, + VehiclePropertyChangeMode::STATIC, VehiclePropertyGroup::SYSTEM, + VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEmergencyLaneKeepAssistEnabledConfig) { verifyProperty(VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, From 08212492f8f4bf8b2cc503e75b1b3018771521d0 Mon Sep 17 00:00:00 2001 From: Dorin Drimus Date: Thu, 23 Feb 2023 17:06:58 +0000 Subject: [PATCH 770/998] Fix VtsHalGraphicsComposer3_TargetTest / GetOverlaySupport Test case is for composer starting with version 2 API, but the test case doesn't check version, so it fails for version 1 API. Bug: 267565265 Test: 1. Push VtsHalGraphicsComposer3_TargetTest to device 2. Run VtsHalGraphicsComposer3_TargetTest Test Command: chmod 777 data/VtsHalGraphicsComposer3_TargetTest ./data/VtsHalGraphicsComposer3_TargetTest Change-Id: I7bf37061aba84dfdfea5fc9dda5a300a1e5ec680 (cherry picked from commit 7493bbc999eb653deb36773ca1ff1b6d5877806a) Merged-In: I7bf37061aba84dfdfea5fc9dda5a300a1e5ec680 --- .../aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 70c4e4cf39..4974e71636 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -874,6 +874,13 @@ TEST_P(GraphicsComposerAidlTest, GetDisplayName) { } TEST_P(GraphicsComposerAidlTest, GetOverlaySupport) { + const auto& [versionStatus, version] = mComposerClient->getInterfaceVersion(); + ASSERT_TRUE(versionStatus.isOk()); + if (version == 1) { + GTEST_SUCCEED() << "Device does not support the new API for overlay support"; + return; + } + const auto& [status, properties] = mComposerClient->getOverlaySupport(); if (!status.isOk() && status.getExceptionCode() == EX_SERVICE_SPECIFIC && status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) { From 432807e44b4dc0d69205abcabc8f0f3d84e2cfc3 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Fri, 24 Feb 2023 21:03:20 +0000 Subject: [PATCH 771/998] Remove the WifiRadioCombinationsMatrix type from the Vendor HAL interface. We can return a list of WifiRadioCombinations instead. Bug: 267819850 Test: atest VtsHalWifiChipTargetTest Change-Id: I0f57df6262d36917dfd8cc3e27d6781e9b7c8dbf --- .../android/hardware/wifi/IWifiChip.aidl | 2 +- .../wifi/WifiRadioCombinationMatrix.aidl | 38 ------------------- .../aidl/android/hardware/wifi/IWifiChip.aidl | 7 ++-- .../wifi/WifiRadioCombinationMatrix.aidl | 31 --------------- .../vts/functional/wifi_chip_aidl_test.cpp | 12 +++--- 5 files changed, 10 insertions(+), 80 deletions(-) delete mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiRadioCombinationMatrix.aidl delete mode 100644 wifi/aidl/android/hardware/wifi/WifiRadioCombinationMatrix.aidl diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl index b27b06ff52..2ff6896d98 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl @@ -58,7 +58,7 @@ interface IWifiChip { String[] getP2pIfaceNames(); @PropagateAllowBlocking android.hardware.wifi.IWifiStaIface getStaIface(in String ifname); String[] getStaIfaceNames(); - android.hardware.wifi.WifiRadioCombinationMatrix getSupportedRadioCombinationsMatrix(); + android.hardware.wifi.WifiRadioCombination[] getSupportedRadioCombinations(); android.hardware.wifi.WifiChipCapabilities getWifiChipCapabilities(); android.hardware.wifi.WifiUsableChannel[] getUsableChannels(in android.hardware.wifi.WifiBand band, in android.hardware.wifi.WifiIfaceMode ifaceModeMask, in android.hardware.wifi.IWifiChip.UsableChannelFilter filterMask); void setAfcChannelAllowance(in android.hardware.wifi.AvailableAfcFrequencyInfo[] availableAfcFrequencyInfo); diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiRadioCombinationMatrix.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiRadioCombinationMatrix.aidl deleted file mode 100644 index ea86c4fa79..0000000000 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiRadioCombinationMatrix.aidl +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.wifi; -@VintfStability -parcelable WifiRadioCombinationMatrix { - android.hardware.wifi.WifiRadioCombination[] radioCombinations; -} diff --git a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl index de2449e8e2..c0e41cdb44 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl @@ -31,7 +31,7 @@ import android.hardware.wifi.WifiDebugHostWakeReasonStats; import android.hardware.wifi.WifiDebugRingBufferStatus; import android.hardware.wifi.WifiDebugRingBufferVerboseLevel; import android.hardware.wifi.WifiIfaceMode; -import android.hardware.wifi.WifiRadioCombinationMatrix; +import android.hardware.wifi.WifiRadioCombination; import android.hardware.wifi.WifiUsableChannel; /** @@ -737,8 +737,7 @@ interface IWifiChip { * Retrieve the list of all the possible radio combinations supported by this * chip. * - * @return A list of all the possible radio combinations represented by - * |WifiRadioCombinationMatrix|. + * @return A list of all the possible radio combinations. * For example, in case of a chip which has two radios, where one radio is * capable of 2.4GHz 2X2 only and another radio which is capable of either * 5GHz or 6GHz 2X2, the number of possible radio combinations in this case @@ -759,7 +758,7 @@ interface IWifiChip { * |WifiStatusCode.FAILURE_UNKNOWN| * */ - WifiRadioCombinationMatrix getSupportedRadioCombinationsMatrix(); + WifiRadioCombination[] getSupportedRadioCombinations(); /** * Get capabilities supported by this chip. diff --git a/wifi/aidl/android/hardware/wifi/WifiRadioCombinationMatrix.aidl b/wifi/aidl/android/hardware/wifi/WifiRadioCombinationMatrix.aidl deleted file mode 100644 index b79a8189d7..0000000000 --- a/wifi/aidl/android/hardware/wifi/WifiRadioCombinationMatrix.aidl +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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. - */ - -package android.hardware.wifi; - -import android.hardware.wifi.WifiRadioCombination; - -/** - * Wifi radio combinations matrix retrieved via - * |IWifiChip.getSupportedRadioCombinationsMatrix|. - */ -@VintfStability -parcelable WifiRadioCombinationMatrix { - /** - * List of all the possible radio combinations that the chip can operate. - */ - WifiRadioCombination[] radioCombinations; -} diff --git a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp index f908be64c7..d0b7014614 100644 --- a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp +++ b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp @@ -41,7 +41,7 @@ using aidl::android::hardware::wifi::WifiDebugHostWakeReasonStats; using aidl::android::hardware::wifi::WifiDebugRingBufferStatus; using aidl::android::hardware::wifi::WifiDebugRingBufferVerboseLevel; using aidl::android::hardware::wifi::WifiIfaceMode; -using aidl::android::hardware::wifi::WifiRadioCombinationMatrix; +using aidl::android::hardware::wifi::WifiRadioCombination; using aidl::android::hardware::wifi::WifiStatusCode; using aidl::android::hardware::wifi::WifiUsableChannel; @@ -242,14 +242,14 @@ TEST_P(WifiChipAidlTest, GetUsableChannels) { } /* - * GetSupportedRadioCombinationsMatrix + * GetSupportedRadioCombinations */ -TEST_P(WifiChipAidlTest, GetSupportedRadioCombinationsMatrix) { - WifiRadioCombinationMatrix combination_matrix = {}; +TEST_P(WifiChipAidlTest, GetSupportedRadioCombinations) { + std::vector combinations; configureChipForConcurrencyType(IfaceConcurrencyType::STA); - auto status = wifi_chip_->getSupportedRadioCombinationsMatrix(&combination_matrix); + auto status = wifi_chip_->getSupportedRadioCombinations(&combinations); if (checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { - GTEST_SKIP() << "Skipping this test since getSupportedRadioCombinationsMatrix() " + GTEST_SKIP() << "Skipping this test since getSupportedRadioCombinations() " "is not supported by vendor."; } EXPECT_TRUE(status.isOk()); From 263db45eae782141b21d11eda7e46caf71878398 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Fri, 24 Feb 2023 21:07:38 +0000 Subject: [PATCH 772/998] Update usages of WifiRadioCombinationMatrix in the Vendor HAL service. Bug: 267819850 Test: Run the gTest suite under default/tests Change-Id: I18feb87f16abbc9ece9186b2e92e19984a5a90f0 --- wifi/aidl/default/aidl_struct_util.cpp | 10 ++++------ wifi/aidl/default/aidl_struct_util.h | 2 +- .../tests/aidl_struct_util_unit_tests.cpp | 13 ++++++------ wifi/aidl/default/wifi_chip.cpp | 20 +++++++++---------- wifi/aidl/default/wifi_chip.h | 8 ++++---- 5 files changed, 26 insertions(+), 27 deletions(-) diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index efd6598d62..ad305b7241 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -2996,14 +2996,13 @@ bool convertLegacyWifiRadioConfigurationToAidl( bool convertLegacyRadioCombinationsMatrixToAidl( legacy_hal::wifi_radio_combination_matrix* legacy_matrix, - WifiRadioCombinationMatrix* aidl_matrix) { - if (!aidl_matrix || !legacy_matrix) { + std::vector* aidl_combinations) { + if (!aidl_combinations || !legacy_matrix) { return false; } - *aidl_matrix = {}; + *aidl_combinations = {}; int num_combinations = legacy_matrix->num_radio_combinations; - std::vector radio_combinations_vec; if (!num_combinations) { LOG(ERROR) << "zero radio combinations"; return false; @@ -3029,13 +3028,12 @@ bool convertLegacyRadioCombinationsMatrixToAidl( radio_configurations_vec.push_back(radioConfiguration); } radioCombination.radioConfigurations = radio_configurations_vec; - radio_combinations_vec.push_back(radioCombination); + aidl_combinations->push_back(radioCombination); l_radio_combinations_ptr = (wifi_radio_combination*)((u8*)l_radio_combinations_ptr + sizeof(wifi_radio_combination) + (sizeof(wifi_radio_configuration) * num_configurations)); } - aidl_matrix->radioCombinations = radio_combinations_vec; return true; } diff --git a/wifi/aidl/default/aidl_struct_util.h b/wifi/aidl/default/aidl_struct_util.h index 904ba81ad1..8adc8f7c23 100644 --- a/wifi/aidl/default/aidl_struct_util.h +++ b/wifi/aidl/default/aidl_struct_util.h @@ -64,7 +64,7 @@ bool convertAidlVectorOfCoexUnsafeChannelToLegacy( std::vector* legacy_unsafe_channels); bool convertLegacyRadioCombinationsMatrixToAidl( legacy_hal::wifi_radio_combination_matrix* legacy_matrix, - WifiRadioCombinationMatrix* aidl_matrix); + std::vector* aidl_combinations); WifiBand convertLegacyMacBandToAidlWifiBand(uint32_t band); WifiAntennaMode convertLegacyAntennaConfigurationToAidl(uint32_t antenna_cfg); diff --git a/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp index 9997937ef2..4bd77acfee 100644 --- a/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp +++ b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp @@ -753,21 +753,22 @@ TEST_F(AidlStructUtilTest, canConvertLegacyRadioCombinationsMatrixToAidl) { sizeof(radio_configurations_array3) / sizeof(radio_configurations_array3[0]), radio_configurations_array3); - WifiRadioCombinationMatrix converted_matrix{}; - aidl_struct_util::convertLegacyRadioCombinationsMatrixToAidl(legacy_matrix, &converted_matrix); + std::vector converted_combinations; + aidl_struct_util::convertLegacyRadioCombinationsMatrixToAidl(legacy_matrix, + &converted_combinations); // Verify the conversion - EXPECT_EQ(legacy_matrix->num_radio_combinations, converted_matrix.radioCombinations.size()); + EXPECT_EQ(legacy_matrix->num_radio_combinations, converted_combinations.size()); verifyRadioCombination( - &converted_matrix.radioCombinations[0], + &converted_combinations[0], sizeof(radio_configurations_array1) / sizeof(radio_configurations_array1[0]), radio_configurations_array1); verifyRadioCombination( - &converted_matrix.radioCombinations[1], + &converted_combinations[1], sizeof(radio_configurations_array2) / sizeof(radio_configurations_array2[0]), radio_configurations_array2); verifyRadioCombination( - &converted_matrix.radioCombinations[2], + &converted_combinations[2], sizeof(radio_configurations_array3) / sizeof(radio_configurations_array3[0]), radio_configurations_array3); } diff --git a/wifi/aidl/default/wifi_chip.cpp b/wifi/aidl/default/wifi_chip.cpp index b4c2ccdbb9..3ec7bd25cc 100644 --- a/wifi/aidl/default/wifi_chip.cpp +++ b/wifi/aidl/default/wifi_chip.cpp @@ -682,10 +682,10 @@ ndk::ScopedAStatus WifiChip::triggerSubsystemRestart() { &WifiChip::triggerSubsystemRestartInternal); } -ndk::ScopedAStatus WifiChip::getSupportedRadioCombinationsMatrix( - WifiRadioCombinationMatrix* _aidl_return) { +ndk::ScopedAStatus WifiChip::getSupportedRadioCombinations( + std::vector* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getSupportedRadioCombinationsMatrixInternal, _aidl_return); + &WifiChip::getSupportedRadioCombinationsInternal, _aidl_return); } ndk::ScopedAStatus WifiChip::getWifiChipCapabilities(WifiChipCapabilities* _aidl_return) { @@ -1411,26 +1411,26 @@ ndk::ScopedAStatus WifiChip::setAfcChannelAllowanceInternal( return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); } -std::pair -WifiChip::getSupportedRadioCombinationsMatrixInternal() { +std::pair, ndk::ScopedAStatus> +WifiChip::getSupportedRadioCombinationsInternal() { legacy_hal::wifi_error legacy_status; legacy_hal::wifi_radio_combination_matrix* legacy_matrix; + std::vector aidl_combinations; std::tie(legacy_status, legacy_matrix) = legacy_hal_.lock()->getSupportedRadioCombinationsMatrix(); if (legacy_status != legacy_hal::WIFI_SUCCESS) { LOG(ERROR) << "Failed to get SupportedRadioCombinations matrix from legacy HAL: " << legacyErrorToString(legacy_status); - return {WifiRadioCombinationMatrix{}, createWifiStatusFromLegacyError(legacy_status)}; + return {aidl_combinations, createWifiStatusFromLegacyError(legacy_status)}; } - WifiRadioCombinationMatrix aidl_matrix; if (!aidl_struct_util::convertLegacyRadioCombinationsMatrixToAidl(legacy_matrix, - &aidl_matrix)) { + &aidl_combinations)) { LOG(ERROR) << "Failed convertLegacyRadioCombinationsMatrixToAidl() "; - return {WifiRadioCombinationMatrix(), createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)}; + return {aidl_combinations, createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)}; } - return {aidl_matrix, ndk::ScopedAStatus::ok()}; + return {aidl_combinations, ndk::ScopedAStatus::ok()}; } std::pair WifiChip::getWifiChipCapabilitiesInternal() { diff --git a/wifi/aidl/default/wifi_chip.h b/wifi/aidl/default/wifi_chip.h index ff4ee9ce90..e75e39bbea 100644 --- a/wifi/aidl/default/wifi_chip.h +++ b/wifi/aidl/default/wifi_chip.h @@ -144,8 +144,8 @@ class WifiChip : public BnWifiChip { ndk::ScopedAStatus setAfcChannelAllowance( const std::vector& availableAfcFrequencyInfo) override; ndk::ScopedAStatus triggerSubsystemRestart() override; - ndk::ScopedAStatus getSupportedRadioCombinationsMatrix( - WifiRadioCombinationMatrix* _aidl_return) override; + ndk::ScopedAStatus getSupportedRadioCombinations( + std::vector* _aidl_return) override; ndk::ScopedAStatus getWifiChipCapabilities(WifiChipCapabilities* _aidl_return) override; ndk::ScopedAStatus enableStaChannelForPeerNetwork( ChannelCategoryMask in_channelCategoryEnableFlag) override; @@ -258,8 +258,8 @@ class WifiChip : public BnWifiChip { void invalidateAndClearBridgedAp(const std::string& br_name); bool findUsingNameFromBridgedApInstances(const std::string& name); ndk::ScopedAStatus triggerSubsystemRestartInternal(); - std::pair - getSupportedRadioCombinationsMatrixInternal(); + std::pair, ndk::ScopedAStatus> + getSupportedRadioCombinationsInternal(); std::pair getWifiChipCapabilitiesInternal(); ndk::ScopedAStatus setMloModeInternal(const ChipMloMode in_mode); void setWeakPtr(std::weak_ptr ptr); From f7f16932da6fca16c46fe0b767763ed8c0a8b0f4 Mon Sep 17 00:00:00 2001 From: shrikar Date: Thu, 23 Feb 2023 18:40:13 +0000 Subject: [PATCH 773/998] Updated HVAC property docs with go/revising-hvac-additional-rule Bug: 267352912 Test: manual build Change-Id: I0b68d92d1a6e3a7739145bd302933e00c7f1aac1 --- automotive/vehicle/2.0/types.hal | 18 ++++++++++++++---- .../automotive/vehicle/VehicleProperty.aidl | 18 ++++++++++++++---- current.txt | 1 + 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/automotive/vehicle/2.0/types.hal b/automotive/vehicle/2.0/types.hal index 83b0d94a6b..00d0452bcb 100644 --- a/automotive/vehicle/2.0/types.hal +++ b/automotive/vehicle/2.0/types.hal @@ -829,10 +829,10 @@ enum VehicleProperty : int32_t { /* * HVAC Properties * - * Additional rules for mapping a zoned HVAC property (except - * HVAC_MAX_DEFROST_ON) to AreaIDs: - * - Every seat in VehicleAreaSeat that is available in the car, must be - * part of an AreaID in the AreaID array. + * Additional rules for mapping non-GLOBAL VehicleArea type HVAC properties + * to AreaIDs: + * - Every “area” for a specific VehicleArea type that is affected by the + * property, must be included in an area ID for that property. * * Example 1: A car has two front seats (ROW_1_LEFT, ROW_1_RIGHT) and three * back seats (ROW_2_LEFT, ROW_2_CENTER, ROW_2_RIGHT). There are two @@ -860,6 +860,16 @@ enum VehicleProperty : int32_t { * - ROW_1_LEFT * - ROW_1_RIGHT * - ROW_2_LEFT | ROW_2_CENTER | ROW_2_RIGHT | ROW_3_LEFT | ROW_3_CENTER | ROW_3_RIGHT + * + * Example 3: A car has two front seats (ROW_1_LEFT, ROW_1_RIGHT) and three + * back seats (ROW_2_LEFT, ROW_2_CENTER, ROW_2_RIGHT). Suppose the car + * supports HVAC_AUTO_ON for just the two front seats. + * - A valid mapping set of AreaIDs for HVAC_AUTO_ON would be: + * - ROW_1_LEFT | ROW_1_RIGHT + * - If HVAC_AUTO_ON had two separate control units for the driver side + * and passenger side, an alternative mapping would be: + * - ROW_1_LEFT + * - ROW_1_RIGHT */ /** diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index d4b02a2af5..d3dd70aa26 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -619,10 +619,10 @@ enum VehicleProperty { /** * HVAC Properties * - * Additional rules for mapping a zoned HVAC property (except - * HVAC_MAX_DEFROST_ON) to AreaIDs: - * - Every seat in VehicleAreaSeat that is available in the car, must be - * part of an AreaID in the AreaID array. + * Additional rules for mapping non-GLOBAL VehicleArea type HVAC properties + * to AreaIDs: + * - Every “area” for a specific VehicleArea type that is affected by the + * property, must be included in an area ID for that property. * * Example 1: A car has two front seats (ROW_1_LEFT, ROW_1_RIGHT) and three * back seats (ROW_2_LEFT, ROW_2_CENTER, ROW_2_RIGHT). There are two @@ -651,6 +651,16 @@ enum VehicleProperty { * - ROW_1_RIGHT * - ROW_2_LEFT | ROW_2_CENTER | ROW_2_RIGHT | ROW_3_LEFT | ROW_3_CENTER | ROW_3_RIGHT * + * Example 3: A car has two front seats (ROW_1_LEFT, ROW_1_RIGHT) and three + * back seats (ROW_2_LEFT, ROW_2_CENTER, ROW_2_RIGHT). Suppose the car + * supports HVAC_AUTO_ON for just the two front seats. + * - A valid mapping set of AreaIDs for HVAC_AUTO_ON would be: + * - ROW_1_LEFT | ROW_1_RIGHT + * - If HVAC_AUTO_ON had two separate control units for the driver side + * and passenger side, an alternative mapping would be: + * - ROW_1_LEFT + * - ROW_1_RIGHT + * * * Fan speed setting * diff --git a/current.txt b/current.txt index 358d05a60e..c40f9ea9b6 100644 --- a/current.txt +++ b/current.txt @@ -935,5 +935,6 @@ b7ce2d87841585551b082fca6d099622e63b7099e0d8013f687ea1a1dc35c4dc android.hardwar 4f1a02d21a22104c734f71cdbba19b6f7e93d4ee107ff79f0dbdd171a8430e0e android.hardware.automotive.vehicle@2.0::types a2fbd9747fbb9ceb8c1090b5a24138312246502d5af0654a8c2b603a9bf521fc android.hardware.gnss@1.0::IGnssCallback 889b59e3e7a59afa67bf19882a44f51a2f9e43b6556ec52baa9ec3efd1ef7fbe android.hardware.camera.device@3.2::types +db37a1c757e2e69b1ec9c75a981a6987bd87a131d92ab6acc00e04d19f374281 android.hardware.automotive.vehicle@2.0::types # There will be no more HIDL HALs. Use AIDL instead. From 9940a55995c7e64b6575b73ab01c8923a3e16cdb Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Fri, 24 Feb 2023 19:50:51 -0800 Subject: [PATCH 774/998] audio: Add AudioOffloadMetadata and a method to update it AudioOffloadMetadata contains the same information as 'AUDIO_OFFLOAD_CODEC_*' framework parameters. It is updated via a new method IStreamOut.updateOffloadMetadata which only works for compressed offload streams. Bug: 270731693 Test: atest VtsHalAudioCoreTargetTest Change-Id: I6c8a8853f216438284082f79e3f57e511a2a1f06 Merged-In: I6c8a8853f216438284082f79e3f57e511a2a1f06 --- audio/aidl/Android.bp | 9 ++-- .../audio/common/AudioOffloadMetadata.aidl | 42 ++++++++++++++++++ .../hardware/audio/core/IStreamOut.aidl | 1 + .../audio/common/AudioOffloadMetadata.aidl | 44 +++++++++++++++++++ .../hardware/audio/core/IStreamOut.aidl | 13 ++++++ audio/aidl/default/Stream.cpp | 35 +++++++++++++++ audio/aidl/default/include/core-impl/Stream.h | 4 ++ audio/aidl/vts/ModuleConfig.cpp | 2 +- .../vts/VtsHalAudioCoreModuleTargetTest.cpp | 37 ++++++++++++++-- automotive/audiocontrol/aidl/vts/Android.bp | 2 +- 10 files changed, 179 insertions(+), 10 deletions(-) create mode 100644 audio/aidl/aidl_api/android.hardware.audio.common/current/android/hardware/audio/common/AudioOffloadMetadata.aidl create mode 100644 audio/aidl/android/hardware/audio/common/AudioOffloadMetadata.aidl diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index e6b0cee401..2c91918d76 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -36,12 +36,13 @@ aidl_interface { "android.hardware.audio_defaults", ], srcs: [ + "android/hardware/audio/common/AudioOffloadMetadata.aidl", "android/hardware/audio/common/PlaybackTrackMetadata.aidl", "android/hardware/audio/common/RecordTrackMetadata.aidl", "android/hardware/audio/common/SinkMetadata.aidl", "android/hardware/audio/common/SourceMetadata.aidl", ], - frozen: true, + frozen: false, imports: [ "android.media.audio.common.types-V2", ], @@ -77,7 +78,7 @@ aidl_interface { } // Note: This should always be one version ahead of the last frozen version -latest_android_hardware_audio_common = "android.hardware.audio.common-V1" +latest_android_hardware_audio_common = "android.hardware.audio.common-V2" // Modules that depend on android.hardware.audio.common directly can include // the following cc_defaults to avoid explicitly managing dependency versions @@ -129,7 +130,7 @@ aidl_interface { imports: [ "android.hardware.common-V2", "android.hardware.common.fmq-V1", - "android.hardware.audio.common-V1", + "android.hardware.audio.common-V2", "android.hardware.audio.core.sounddose-V1", "android.hardware.audio.effect-V1", "android.media.audio.common.types-V2", @@ -253,7 +254,7 @@ aidl_interface { imports: [ "android.hardware.common-V2", "android.hardware.common.fmq-V1", - "android.hardware.audio.common-V1", + "android.hardware.audio.common-V2", "android.media.audio.common.types-V2", ], backend: { diff --git a/audio/aidl/aidl_api/android.hardware.audio.common/current/android/hardware/audio/common/AudioOffloadMetadata.aidl b/audio/aidl/aidl_api/android.hardware.audio.common/current/android/hardware/audio/common/AudioOffloadMetadata.aidl new file mode 100644 index 0000000000..000504bd40 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.common/current/android/hardware/audio/common/AudioOffloadMetadata.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 -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.hardware.audio.common; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable AudioOffloadMetadata { + int sampleRate; + android.media.audio.common.AudioChannelLayout channelMask; + int averageBitRatePerSecond; + int delayFrames; + int paddingFrames; +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamOut.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamOut.aidl index 46acc1156e..ec3078efd7 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamOut.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamOut.aidl @@ -36,6 +36,7 @@ package android.hardware.audio.core; interface IStreamOut { android.hardware.audio.core.IStreamCommon getStreamCommon(); void updateMetadata(in android.hardware.audio.common.SourceMetadata sourceMetadata); + void updateOffloadMetadata(in android.hardware.audio.common.AudioOffloadMetadata offloadMetadata); float[] getHwVolume(); void setHwVolume(in float[] channelVolumes); float getAudioDescriptionMixLevel(); diff --git a/audio/aidl/android/hardware/audio/common/AudioOffloadMetadata.aidl b/audio/aidl/android/hardware/audio/common/AudioOffloadMetadata.aidl new file mode 100644 index 0000000000..588165824b --- /dev/null +++ b/audio/aidl/android/hardware/audio/common/AudioOffloadMetadata.aidl @@ -0,0 +1,44 @@ +/* + * 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.hardware.audio.common; + +import android.media.audio.common.AudioChannelLayout; + +/** + * Dynamic metadata for offloaded compressed audio. + * For static metadata, see android.media.audio.common.AudioOffloadInfo. + */ +@JavaDerive(equals=true, toString=true) +@VintfStability +parcelable AudioOffloadMetadata { + int sampleRate; + AudioChannelLayout channelMask; + /** Average bit rate in bits per second. */ + int averageBitRatePerSecond; + /** + * Number of frames to be ignored at the beginning of the stream. + * The value must be non-negative. A value of 0 indicates no delay + * has to be applied. + */ + int delayFrames; + /** + * Number of frames to be ignored at the end of the stream. + * The value must be non-negative. A value of 0 indicates no padding + * has to be applied. + */ + int paddingFrames; +} diff --git a/audio/aidl/android/hardware/audio/core/IStreamOut.aidl b/audio/aidl/android/hardware/audio/core/IStreamOut.aidl index 0e58addd7d..54c81621e1 100644 --- a/audio/aidl/android/hardware/audio/core/IStreamOut.aidl +++ b/audio/aidl/android/hardware/audio/core/IStreamOut.aidl @@ -16,6 +16,7 @@ package android.hardware.audio.core; +import android.hardware.audio.common.AudioOffloadMetadata; import android.hardware.audio.common.SourceMetadata; import android.hardware.audio.core.IStreamCommon; import android.media.audio.common.AudioDualMonoMode; @@ -48,6 +49,18 @@ interface IStreamOut { */ void updateMetadata(in SourceMetadata sourceMetadata); + /** + * Update offload metadata for a compressed stream. + * + * Updates the offload metadata initially provided at the stream creation. + * + * @param offloadMetadata Updated offload metadata. + * @throws EX_ILLEGAL_STATE If the stream is closed. + * @throws EX_ILLEGAL_ARGUMENT If the metadata contains invalid values. + * @throws EX_UNSUPPORTED_OPERATION If the stream is not for compressed offload. + */ + void updateOffloadMetadata(in AudioOffloadMetadata offloadMetadata); + const int HW_VOLUME_MIN = 0; const int HW_VOLUME_MAX = 1; /** diff --git a/audio/aidl/default/Stream.cpp b/audio/aidl/default/Stream.cpp index 49ad2f2d74..193c793ba0 100644 --- a/audio/aidl/default/Stream.cpp +++ b/audio/aidl/default/Stream.cpp @@ -24,6 +24,7 @@ #include "core-impl/Module.h" #include "core-impl/Stream.h" +using aidl::android::hardware::audio::common::AudioOffloadMetadata; using aidl::android::hardware::audio::common::SinkMetadata; using aidl::android::hardware::audio::common::SourceMetadata; using aidl::android::media::audio::common::AudioDevice; @@ -785,6 +786,40 @@ StreamOut::StreamOut(const SourceMetadata& sourceMetadata, StreamContext&& conte LOG(DEBUG) << __func__; } +ndk::ScopedAStatus StreamOut::updateOffloadMetadata( + const AudioOffloadMetadata& in_offloadMetadata) { + LOG(DEBUG) << __func__; + if (isClosed()) { + LOG(ERROR) << __func__ << ": stream was closed"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } + if (!mOffloadInfo.has_value()) { + LOG(ERROR) << __func__ << ": not a compressed offload stream"; + return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); + } + if (in_offloadMetadata.sampleRate < 0) { + LOG(ERROR) << __func__ << ": invalid sample rate value: " << in_offloadMetadata.sampleRate; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (in_offloadMetadata.averageBitRatePerSecond < 0) { + LOG(ERROR) << __func__ + << ": invalid average BPS value: " << in_offloadMetadata.averageBitRatePerSecond; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (in_offloadMetadata.delayFrames < 0) { + LOG(ERROR) << __func__ + << ": invalid delay frames value: " << in_offloadMetadata.delayFrames; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + if (in_offloadMetadata.paddingFrames < 0) { + LOG(ERROR) << __func__ + << ": invalid padding frames value: " << in_offloadMetadata.paddingFrames; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); + } + mOffloadMetadata = in_offloadMetadata; + return ndk::ScopedAStatus::ok(); +} + ndk::ScopedAStatus StreamOut::getHwVolume(std::vector* _aidl_return) { LOG(DEBUG) << __func__; (void)_aidl_return; diff --git a/audio/aidl/default/include/core-impl/Stream.h b/audio/aidl/default/include/core-impl/Stream.h index 0d4365a3ae..e9b1fbb847 100644 --- a/audio/aidl/default/include/core-impl/Stream.h +++ b/audio/aidl/default/include/core-impl/Stream.h @@ -463,6 +463,9 @@ class StreamOut : public StreamCommonImpl<::aidl::android::hardware::audio::comm return StreamCommonImpl<::aidl::android::hardware::audio::common::SourceMetadata>:: updateMetadata(in_sourceMetadata); } + ndk::ScopedAStatus updateOffloadMetadata( + const ::aidl::android::hardware::audio::common::AudioOffloadMetadata& + in_offloadMetadata) override; ndk::ScopedAStatus getHwVolume(std::vector* _aidl_return) override; ndk::ScopedAStatus setHwVolume(const std::vector& in_channelVolumes) override; ndk::ScopedAStatus getAudioDescriptionMixLevel(float* _aidl_return) override; @@ -500,6 +503,7 @@ class StreamOut : public StreamCommonImpl<::aidl::android::hardware::audio::comm offloadInfo); std::optional<::aidl::android::media::audio::common::AudioOffloadInfo> mOffloadInfo; + std::optional<::aidl::android::hardware::audio::common::AudioOffloadMetadata> mOffloadMetadata; public: using CreateInstance = std::function ModuleConfig::generateOffloadInfoIfNeeded( offloadInfo.base.sampleRate = portConfig.sampleRate.value().value; offloadInfo.base.channelMask = portConfig.channelMask.value(); offloadInfo.base.format = portConfig.format.value(); - offloadInfo.bitRatePerSecond = 256; // Arbitrary value. + offloadInfo.bitRatePerSecond = 256000; // Arbitrary value. offloadInfo.durationUs = std::chrono::microseconds(1min).count(); // Arbitrary value. offloadInfo.usage = AudioUsage::MEDIA; offloadInfo.encapsulationMode = AudioEncapsulationMode::NONE; diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp index b6015ffca5..cd7ab0e91e 100644 --- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp @@ -53,6 +53,7 @@ #include "TestUtils.h" using namespace android; +using aidl::android::hardware::audio::common::AudioOffloadMetadata; using aidl::android::hardware::audio::common::PlaybackTrackMetadata; using aidl::android::hardware::audio::common::RecordTrackMetadata; using aidl::android::hardware::audio::common::SinkMetadata; @@ -401,8 +402,9 @@ void TestSetVendorParameters(Instance* inst, bool* isSupported) { // Can be used as a base for any test here, does not depend on the fixture GTest parameters. class AudioCoreModuleBase { public: - // The default buffer size is used mostly for negative tests. + // Default buffer sizes are used mostly for negative tests. static constexpr int kDefaultBufferSizeFrames = 256; + static constexpr int kDefaultLargeBufferSizeFrames = 48000; void SetUpImpl(const std::string& moduleName) { ASSERT_NO_FATAL_FAILURE(ConnectToService(moduleName)); @@ -2696,7 +2698,7 @@ TEST_P(AudioStreamOut, RequireOffloadInfo) { aidl::android::hardware::audio::core::IModule::OpenOutputStreamArguments args; args.portConfigId = portConfig.getId(); args.sourceMetadata = GenerateSourceMetadata(portConfig.get()); - args.bufferSizeFrames = kDefaultBufferSizeFrames; + args.bufferSizeFrames = kDefaultLargeBufferSizeFrames; aidl::android::hardware::audio::core::IModule::OpenOutputStreamReturn ret; EXPECT_STATUS(EX_ILLEGAL_ARGUMENT, module->openOutputStream(args, &ret)) << "when no offload info is provided for a compressed offload mix port"; @@ -2876,7 +2878,7 @@ TEST_P(AudioStreamOut, PlaybackRate) { const auto portConfig = moduleConfig->getSingleConfigForMixPort(false, port); ASSERT_TRUE(portConfig.has_value()) << "No profiles specified for output mix port"; WithStream stream(portConfig.value()); - ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultBufferSizeFrames)); + ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultLargeBufferSizeFrames)); bool isSupported = false; EXPECT_NO_FATAL_FAILURE(TestAccessors( stream.get(), &IStreamOut::getPlaybackRateParameters, @@ -2901,7 +2903,7 @@ TEST_P(AudioStreamOut, SelectPresentation) { const auto portConfig = moduleConfig->getSingleConfigForMixPort(false, port); ASSERT_TRUE(portConfig.has_value()) << "No profiles specified for output mix port"; WithStream stream(portConfig.value()); - ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultBufferSizeFrames)); + ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultLargeBufferSizeFrames)); ndk::ScopedAStatus status; EXPECT_STATUS(kStatuses, status = stream.get()->selectPresentation(0, 0)); if (status.getExceptionCode() != EX_UNSUPPORTED_OPERATION) atLeastOneSupports = true; @@ -2911,6 +2913,33 @@ TEST_P(AudioStreamOut, SelectPresentation) { } } +TEST_P(AudioStreamOut, UpdateOffloadMetadata) { + const auto offloadMixPorts = + moduleConfig->getOffloadMixPorts(true /*attachedOnly*/, false /*singlePort*/); + if (offloadMixPorts.empty()) { + GTEST_SKIP() + << "No mix port for compressed offload that could be routed to attached devices"; + } + for (const auto& port : offloadMixPorts) { + const auto portConfig = moduleConfig->getSingleConfigForMixPort(false, port); + ASSERT_TRUE(portConfig.has_value()) << "No profiles specified for output mix port"; + WithStream stream(portConfig.value()); + ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultLargeBufferSizeFrames)); + AudioOffloadMetadata validMetadata{ + .sampleRate = portConfig.value().sampleRate.value().value, + .channelMask = portConfig.value().channelMask.value(), + .averageBitRatePerSecond = 256000, + .delayFrames = 0, + .paddingFrames = 0}; + EXPECT_IS_OK(stream.get()->updateOffloadMetadata(validMetadata)); + AudioOffloadMetadata invalidMetadata{.sampleRate = -1, + .averageBitRatePerSecond = -1, + .delayFrames = -1, + .paddingFrames = -1}; + EXPECT_STATUS(EX_ILLEGAL_ARGUMENT, stream.get()->updateOffloadMetadata(invalidMetadata)); + } +} + class StreamLogicDefaultDriver : public StreamLogicDriver { public: StreamLogicDefaultDriver(std::shared_ptr commands, size_t frameSizeBytes) diff --git a/automotive/audiocontrol/aidl/vts/Android.bp b/automotive/audiocontrol/aidl/vts/Android.bp index a9122ce2d6..cfc2a3e4ec 100644 --- a/automotive/audiocontrol/aidl/vts/Android.bp +++ b/automotive/audiocontrol/aidl/vts/Android.bp @@ -25,7 +25,6 @@ cc_test { name: "VtsAidlHalAudioControlTest", defaults: [ "latest_android_media_audio_common_types_cpp_static", - "latest_android_hardware_audio_common_cpp_static", "VtsHalTargetTestDefaults", "use_libaidlvintf_gtest_helper_static", ], @@ -40,6 +39,7 @@ cc_test { ], static_libs: [ "android.hardware.automotive.audiocontrol-V3-cpp", + "android.hardware.audio.common-V1-cpp", "libgmock", ], test_suites: [ From f62d7472e8f1687dea55d5f7dad0f4bd9b8031eb Mon Sep 17 00:00:00 2001 From: shrikar Date: Fri, 3 Feb 2023 00:20:04 +0000 Subject: [PATCH 775/998] Added ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE to HAL. Bug: 266861470 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: I586f75dea83f52dda4dd2c776aec1d5af417263b Merged-In: I586f75dea83f52dda4dd2c776aec1d5af417263b --- .../cpp/AccessForVehicleProperty.h | 1 + .../cpp/ChangeModeForVehicleProperty.h | 1 + .../java/AccessForVehicleProperty.java | 1 + .../java/ChangeModeForVehicleProperty.java | 1 + .../config/DefaultProperties.json | 17 ++++++++++++++ .../automotive/vehicle/VehicleProperty.aidl | 1 + .../automotive/vehicle/VehicleProperty.aidl | 22 +++++++++++++++++++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 7 ++++++ 8 files changed, 51 insertions(+) diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index 884fd14198..a3b79e80bf 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -267,6 +267,7 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyAccess::WRITE}, {VehicleProperty::CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyAccess::READ}, {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyAccess::READ_WRITE}, + {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, VehiclePropertyAccess::READ}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess::READ}, diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index dbb10f7144..9d2cd7f175 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -267,6 +267,7 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyChangeMode::ON_CHANGE}, + {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, VehiclePropertyChangeMode::CONTINUOUS}, {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyChangeMode::ON_CHANGE}, diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index ecd2058aee..2f45a233af 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -259,6 +259,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyAccess.WRITE), Map.entry(VehicleProperty.CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyAccess.READ_WRITE), + Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess.READ), diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index ca958423fb..fef80d2121 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -259,6 +259,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.CRUISE_CONTROL_COMMAND, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.CRUISE_CONTROL_TARGET_SPEED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, VehiclePropertyChangeMode.ON_CHANGE), + Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, VehiclePropertyChangeMode.CONTINUOUS), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyChangeMode.ON_CHANGE), diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index ba844cbb70..8bcb1cce43 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3279,6 +3279,23 @@ 2200 ] }, + { + "property": "VehicleProperty::ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE", + "defaultValue": { + "int32Values": [ + 100000 + ] + }, + "areas": [ + { + "areaId": 0, + "minInt32Value": 0, + "maxInt32Value": 200000 + } + ], + "maxSampleRate": 10.0, + "minSampleRate": 1.0 + }, { "property": "VehicleProperty::HANDS_ON_DETECTION_ENABLED", "defaultValue": { diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index 116099fa9a..175b0acd69 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -265,6 +265,7 @@ enum VehicleProperty { CRUISE_CONTROL_COMMAND = (((0x1012 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411090 */, CRUISE_CONTROL_TARGET_SPEED = (((0x1013 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.FLOAT) /* 291508243 */, ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP = (((0x1014 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411092 */, + ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE = (((0x1015 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411093 */, HANDS_ON_DETECTION_ENABLED = (((0x1016 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313942 */, HANDS_ON_DETECTION_DRIVER_STATE = (((0x1017 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411095 */, HANDS_ON_DETECTION_WARNING = (((0x1018 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411096 */, diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index e91b06b974..235ccd0c06 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -4036,6 +4036,28 @@ enum VehicleProperty { ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP = 0x1014 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** + * Measured distance from leading vehicle when using Adaptive Cruise Control (ACC) or + * Predictive Cruise Control. + * + * Returns the measured distance in millimeters between the rear-most point of the leading + * vehicle and the front-most point of the ACC vehicle. + * + * The minInt32Value should be 0. + * The maxInt32Value should be populated with the maximum range the distance sensor can support. + * This value should be non-negative. + * + * When no lead vehicle is detected (that is, when there is no leading vehicle or the leading + * vehicle is too far away for the sensor to detect), this property should return + * StatusCode.NOT_AVAILABLE. + * + * @change_mode VehiclePropertyChangeMode.CONTINUOUS + * @access VehiclePropertyAccess.READ + * @unit VehicleUnit:MILLIMETER + */ + ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE = + 0x1015 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, + /** * Enable or disable hands on detection (HOD). * diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 3170a19993..1c9d0dbbff 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -546,6 +546,13 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyAdaptiveCruiseControlTargetTimeG VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); } +TEST_P(VtsHalAutomotiveVehicleTargetTest, + verifyAdaptiveCruiseControlLeadVehicleMeasuredDistanceConfig) { + verifyProperty(VehicleProperty::ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, + VehiclePropertyAccess::READ, VehiclePropertyChangeMode::CONTINUOUS, + VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); +} + TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionEnabledConfig) { verifyProperty(VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, From 3caf6591b680a749fdd7c6db85f71c99d33db2d0 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Mon, 27 Feb 2023 18:51:44 -0800 Subject: [PATCH 776/998] audio: Add IBluetoothA2dp Similar to IBluetooth interface which controls SCO/HFP, IBluetoothA2dp controls the A2DP profile. This interface replaces the following string parameters: AUDIO_PARAMETER_A2DP_RECONFIG_SUPPORTED AUDIO_PARAMETER_RECONFIG_A2DP "A2dpSuspended" Also, refactor fields used by Module implementation for persistent child interfaces. Bug: 270731693 Test: atest VtsHalAudioCoreTargetTest Change-Id: Ie62952c3bc3af2f53535d716e5b57bf48c661306 --- audio/aidl/Android.bp | 1 + .../hardware/audio/core/IBluetoothA2dp.aidl | 41 +++++++++ .../android/hardware/audio/core/IModule.aidl | 1 + .../hardware/audio/core/IBluetoothA2dp.aidl | 83 +++++++++++++++++++ .../android/hardware/audio/core/IModule.aidl | 15 ++++ audio/aidl/default/Bluetooth.cpp | 26 ++++++ audio/aidl/default/Module.cpp | 30 +++---- .../default/include/core-impl/Bluetooth.h | 16 ++++ audio/aidl/default/include/core-impl/Module.h | 33 ++++++-- .../vts/VtsHalAudioCoreModuleTargetTest.cpp | 58 +++++++++++++ 10 files changed, 281 insertions(+), 23 deletions(-) create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetoothA2dp.aidl create mode 100644 audio/aidl/android/hardware/audio/core/IBluetoothA2dp.aidl diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index 2c91918d76..bb48ecd001 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -113,6 +113,7 @@ aidl_interface { "android/hardware/audio/core/AudioPatch.aidl", "android/hardware/audio/core/AudioRoute.aidl", "android/hardware/audio/core/IBluetooth.aidl", + "android/hardware/audio/core/IBluetoothA2dp.aidl", "android/hardware/audio/core/IConfig.aidl", "android/hardware/audio/core/IModule.aidl", "android/hardware/audio/core/IStreamCallback.aidl", diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetoothA2dp.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetoothA2dp.aidl new file mode 100644 index 0000000000..0f4c46d73f --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetoothA2dp.aidl @@ -0,0 +1,41 @@ +/* + * 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 -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.hardware.audio.core; +@VintfStability +interface IBluetoothA2dp { + boolean isEnabled(); + void setEnabled(boolean enabled); + boolean supportsOffloadReconfiguration(); + void reconfigureOffload(in android.hardware.audio.core.VendorParameter[] parameters); +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl index 1eafdaba57..f18d6a526e 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl @@ -37,6 +37,7 @@ interface IModule { void setModuleDebug(in android.hardware.audio.core.ModuleDebug debug); @nullable android.hardware.audio.core.ITelephony getTelephony(); @nullable android.hardware.audio.core.IBluetooth getBluetooth(); + @nullable android.hardware.audio.core.IBluetoothA2dp getBluetoothA2dp(); android.media.audio.common.AudioPort connectExternalDevice(in android.media.audio.common.AudioPort templateIdAndAdditionalData); void disconnectExternalDevice(int portId); android.hardware.audio.core.AudioPatch[] getAudioPatches(); diff --git a/audio/aidl/android/hardware/audio/core/IBluetoothA2dp.aidl b/audio/aidl/android/hardware/audio/core/IBluetoothA2dp.aidl new file mode 100644 index 0000000000..dc4b8d0054 --- /dev/null +++ b/audio/aidl/android/hardware/audio/core/IBluetoothA2dp.aidl @@ -0,0 +1,83 @@ +/* + * 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.hardware.audio.core; + +import android.hardware.audio.core.VendorParameter; + +/** + * An instance of IBluetoothA2dp manages settings for the A2DP (Advanced Audio + * Distribution Profile) profiles. This interface is optional to implement by + * the vendor. It needs to be provided only if the device actually supports BT + * A2DP. + * + * This interface is separate from IBluetooth interface which manages SCO & HFP. + * The HAL module can handle both SCO and A2DP profiles or only one of them. + */ +@VintfStability +interface IBluetoothA2dp { + /** + * Whether BT A2DP is enabled. + * + * Returns the current state of A2DP support. The client might need to + * disable (suspend) A2DP when another profile (for example, SCO) is + * activated. + * + * @return Whether BT A2DP is enabled. + */ + boolean isEnabled(); + + /** + * Enable or disable A2DP. + * + * Sets the current state of A2DP support. The client might need to + * disable (suspend) A2DP when another profile (for example, SCO) is + * activated. + * + * @param enabled Whether BT A2DP must be enabled or suspended. + * @throws EX_ILLEGAL_STATE If there was an error performing the operation. + */ + void setEnabled(boolean enabled); + + /** + * Indicates whether the module supports reconfiguration of offloaded codecs. + * + * Offloaded coded implementations may need to be reconfigured when the + * active A2DP device changes. This method indicates whether the HAL module + * supports the reconfiguration event. The result returned from this method + * must not change over time. + * + * @return Whether reconfiguration offload of offloaded codecs is supported. + */ + boolean supportsOffloadReconfiguration(); + + /** + * Instructs the HAL module to reconfigure offloaded codec. + * + * Offloaded coded implementations may need to be reconfigured when the + * active A2DP device changes. This method is a notification for the HAL + * module to commence reconfiguration. + * + * Note that 'EX_UNSUPPORTED_OPERATION' may only be thrown when + * 'supportsOffloadReconfiguration' returns 'false'. + * + * @param parameter Optional vendor-specific parameters, can be left empty. + * @throws EX_ILLEGAL_STATE If there was an error performing the operation, + * or the operation can not be commenced in the current state. + * @throws EX_UNSUPPORTED_OPERATION If the module does not support codec reconfiguration. + */ + void reconfigureOffload(in VendorParameter[] parameters); +} diff --git a/audio/aidl/android/hardware/audio/core/IModule.aidl b/audio/aidl/android/hardware/audio/core/IModule.aidl index edfb9f27f6..5a6df97a89 100644 --- a/audio/aidl/android/hardware/audio/core/IModule.aidl +++ b/audio/aidl/android/hardware/audio/core/IModule.aidl @@ -21,6 +21,7 @@ import android.hardware.audio.common.SourceMetadata; import android.hardware.audio.core.AudioPatch; import android.hardware.audio.core.AudioRoute; import android.hardware.audio.core.IBluetooth; +import android.hardware.audio.core.IBluetoothA2dp; import android.hardware.audio.core.IStreamCallback; import android.hardware.audio.core.IStreamIn; import android.hardware.audio.core.IStreamOut; @@ -102,6 +103,20 @@ interface IModule { */ @nullable IBluetooth getBluetooth(); + /** + * Retrieve the interface to control Bluetooth A2DP. + * + * If the HAL module supports A2DP Profile functionality for Bluetooth, it + * must return an instance of the IBluetoothA2dp interface. The same + * instance must be returned during the lifetime of the HAL module. If the + * HAL module does not support BT A2DP, a null must be returned, without + * throwing any errors. + * + * @return An instance of the IBluetoothA2dp interface implementation. + * @throws EX_ILLEGAL_STATE If there was an error creating an instance. + */ + @nullable IBluetoothA2dp getBluetoothA2dp(); + /** * Set a device port of an external device into connected state. * diff --git a/audio/aidl/default/Bluetooth.cpp b/audio/aidl/default/Bluetooth.cpp index 38e0c21ea8..bd9a86431d 100644 --- a/audio/aidl/default/Bluetooth.cpp +++ b/audio/aidl/default/Bluetooth.cpp @@ -19,6 +19,7 @@ #include "core-impl/Bluetooth.h" +using aidl::android::hardware::audio::core::VendorParameter; using aidl::android::media::audio::common::Boolean; using aidl::android::media::audio::common::Float; using aidl::android::media::audio::common::Int; @@ -79,4 +80,29 @@ ndk::ScopedAStatus Bluetooth::setHfpConfig(const HfpConfig& in_config, HfpConfig return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus BluetoothA2dp::isEnabled(bool* _aidl_return) { + *_aidl_return = mEnabled; + LOG(DEBUG) << __func__ << ": returning " << *_aidl_return; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus BluetoothA2dp::setEnabled(bool in_enabled) { + mEnabled = in_enabled; + LOG(DEBUG) << __func__ << ": " << mEnabled; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus BluetoothA2dp::supportsOffloadReconfiguration(bool* _aidl_return) { + *_aidl_return = true; + LOG(DEBUG) << __func__ << ": returning " << *_aidl_return; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus BluetoothA2dp::reconfigureOffload( + const std::vector<::aidl::android::hardware::audio::core::VendorParameter>& in_parameters + __unused) { + LOG(DEBUG) << __func__ << ": " << ::android::internal::ToString(in_parameters); + return ndk::ScopedAStatus::ok(); +} + } // namespace aidl::android::hardware::audio::core diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp index 5440b8d640..a8f03af4fb 100644 --- a/audio/aidl/default/Module.cpp +++ b/audio/aidl/default/Module.cpp @@ -370,29 +370,32 @@ ndk::ScopedAStatus Module::setModuleDebug( } ndk::ScopedAStatus Module::getTelephony(std::shared_ptr* _aidl_return) { - if (mTelephony == nullptr) { + if (!mTelephony) { mTelephony = ndk::SharedRefBase::make(); - mTelephonyBinder = mTelephony->asBinder(); - AIBinder_setMinSchedulerPolicy(mTelephonyBinder.get(), SCHED_NORMAL, - ANDROID_PRIORITY_AUDIO); } - *_aidl_return = mTelephony; + *_aidl_return = mTelephony.getPtr(); LOG(DEBUG) << __func__ << ": returning instance of ITelephony: " << _aidl_return->get(); return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus Module::getBluetooth(std::shared_ptr* _aidl_return) { - if (mBluetooth == nullptr) { + if (!mBluetooth) { mBluetooth = ndk::SharedRefBase::make(); - mBluetoothBinder = mBluetooth->asBinder(); - AIBinder_setMinSchedulerPolicy(mBluetoothBinder.get(), SCHED_NORMAL, - ANDROID_PRIORITY_AUDIO); } - *_aidl_return = mBluetooth; + *_aidl_return = mBluetooth.getPtr(); LOG(DEBUG) << __func__ << ": returning instance of IBluetooth: " << _aidl_return->get(); return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus Module::getBluetoothA2dp(std::shared_ptr* _aidl_return) { + if (!mBluetoothA2dp) { + mBluetoothA2dp = ndk::SharedRefBase::make(); + } + *_aidl_return = mBluetoothA2dp.getPtr(); + LOG(DEBUG) << __func__ << ": returning instance of IBluetoothA2dp: " << _aidl_return->get(); + return ndk::ScopedAStatus::ok(); +} + ndk::ScopedAStatus Module::connectExternalDevice(const AudioPort& in_templateIdAndAdditionalData, AudioPort* _aidl_return) { const int32_t templateId = in_templateIdAndAdditionalData.id; @@ -1039,13 +1042,10 @@ ndk::ScopedAStatus Module::updateScreenState(bool in_isTurnedOn) { } ndk::ScopedAStatus Module::getSoundDose(std::shared_ptr* _aidl_return) { - if (mSoundDose == nullptr) { + if (!mSoundDose) { mSoundDose = ndk::SharedRefBase::make(); - mSoundDoseBinder = mSoundDose->asBinder(); - AIBinder_setMinSchedulerPolicy(mSoundDoseBinder.get(), SCHED_NORMAL, - ANDROID_PRIORITY_AUDIO); } - *_aidl_return = mSoundDose; + *_aidl_return = mSoundDose.getPtr(); LOG(DEBUG) << __func__ << ": returning instance of ISoundDose: " << _aidl_return->get(); return ndk::ScopedAStatus::ok(); } diff --git a/audio/aidl/default/include/core-impl/Bluetooth.h b/audio/aidl/default/include/core-impl/Bluetooth.h index f2e762dd40..e2f48bae2b 100644 --- a/audio/aidl/default/include/core-impl/Bluetooth.h +++ b/audio/aidl/default/include/core-impl/Bluetooth.h @@ -17,6 +17,7 @@ #pragma once #include +#include namespace aidl::android::hardware::audio::core { @@ -32,4 +33,19 @@ class Bluetooth : public BnBluetooth { HfpConfig mHfpConfig; }; +class BluetoothA2dp : public BnBluetoothA2dp { + public: + BluetoothA2dp() = default; + + private: + ndk::ScopedAStatus isEnabled(bool* _aidl_return) override; + ndk::ScopedAStatus setEnabled(bool in_enabled) override; + ndk::ScopedAStatus supportsOffloadReconfiguration(bool* _aidl_return) override; + ndk::ScopedAStatus reconfigureOffload( + const std::vector<::aidl::android::hardware::audio::core::VendorParameter>& + in_parameters) override; + + bool mEnabled = false; +}; + } // namespace aidl::android::hardware::audio::core diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h index 8365b3438f..6b254dbbe4 100644 --- a/audio/aidl/default/include/core-impl/Module.h +++ b/audio/aidl/default/include/core-impl/Module.h @@ -46,11 +46,32 @@ class Module : public BnModule { bool forceTransientBurst = false; bool forceSynchronousDrain = false; }; + // Helper used for interfaces that require a persistent instance. We hold them via a strong + // pointer. The binder token is retained for a call to 'setMinSchedulerPolicy'. + template + struct ChildInterface : private std::pair, ndk::SpAIBinder> { + ChildInterface() {} + ChildInterface& operator=(const std::shared_ptr& c) { + return operator=(std::shared_ptr(c)); + } + ChildInterface& operator=(std::shared_ptr&& c) { + this->first = std::move(c); + this->second = this->first->asBinder(); + AIBinder_setMinSchedulerPolicy(this->second.get(), SCHED_NORMAL, + ANDROID_PRIORITY_AUDIO); + return *this; + } + explicit operator bool() const { return !!this->first; } + C& operator*() const { return *(this->first); } + C* operator->() const { return this->first; } + std::shared_ptr getPtr() const { return this->first; } + }; ndk::ScopedAStatus setModuleDebug( const ::aidl::android::hardware::audio::core::ModuleDebug& in_debug) override; ndk::ScopedAStatus getTelephony(std::shared_ptr* _aidl_return) override; ndk::ScopedAStatus getBluetooth(std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus getBluetoothA2dp(std::shared_ptr* _aidl_return) override; ndk::ScopedAStatus connectExternalDevice( const ::aidl::android::media::audio::common::AudioPort& in_templateIdAndAdditionalData, ::aidl::android::media::audio::common::AudioPort* _aidl_return) override; @@ -151,12 +172,9 @@ class Module : public BnModule { std::unique_ptr mConfig; ModuleDebug mDebug; VendorDebug mVendorDebug; - // For the interfaces requiring to return the same instance, we need to hold them - // via a strong pointer. The binder token is retained for a call to 'setMinSchedulerPolicy'. - std::shared_ptr mTelephony; - ndk::SpAIBinder mTelephonyBinder; - std::shared_ptr mBluetooth; - ndk::SpAIBinder mBluetoothBinder; + ChildInterface mTelephony; + ChildInterface mBluetooth; + ChildInterface mBluetoothA2dp; // ids of ports created at runtime via 'connectExternalDevice'. std::set mConnectedDevicePorts; Streams mStreams; @@ -166,8 +184,7 @@ class Module : public BnModule { bool mMasterMute = false; float mMasterVolume = 1.0f; bool mMicMute = false; - std::shared_ptr mSoundDose; - ndk::SpAIBinder mSoundDoseBinder; + ChildInterface mSoundDose; std::optional mIsMmapSupported; protected: diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp index cd7ab0e91e..1e0c900577 100644 --- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp @@ -61,6 +61,7 @@ using aidl::android::hardware::audio::common::SourceMetadata; using aidl::android::hardware::audio::core::AudioPatch; using aidl::android::hardware::audio::core::AudioRoute; using aidl::android::hardware::audio::core::IBluetooth; +using aidl::android::hardware::audio::core::IBluetoothA2dp; using aidl::android::hardware::audio::core::IModule; using aidl::android::hardware::audio::core::IStreamCommon; using aidl::android::hardware::audio::core::IStreamIn; @@ -2055,6 +2056,59 @@ TEST_P(AudioCoreBluetooth, HfpConfigInvalid) { &hfpConfig)); } +class AudioCoreBluetoothA2dp : public AudioCoreModuleBase, + public testing::TestWithParam { + public: + void SetUp() override { + ASSERT_NO_FATAL_FAILURE(SetUpImpl(GetParam())); + ASSERT_IS_OK(module->getBluetoothA2dp(&bluetooth)); + } + + void TearDown() override { ASSERT_NO_FATAL_FAILURE(TearDownImpl()); } + + std::shared_ptr bluetooth; +}; + +TEST_P(AudioCoreBluetoothA2dp, SameInstance) { + if (bluetooth == nullptr) { + GTEST_SKIP() << "BluetoothA2dp is not supported"; + } + std::shared_ptr bluetooth2; + EXPECT_IS_OK(module->getBluetoothA2dp(&bluetooth2)); + ASSERT_NE(nullptr, bluetooth2.get()); + EXPECT_EQ(bluetooth->asBinder(), bluetooth2->asBinder()) + << "getBluetoothA2dp must return the same interface instance across invocations"; +} + +TEST_P(AudioCoreBluetoothA2dp, Enabled) { + if (bluetooth == nullptr) { + GTEST_SKIP() << "BluetoothA2dp is not supported"; + } + // Since enabling A2DP may require having an actual device connection, + // limit testing to setting back the current value. + bool enabled; + ASSERT_IS_OK(bluetooth->isEnabled(&enabled)); + EXPECT_IS_OK(bluetooth->setEnabled(enabled)) + << "setEnabled without actual state change must not fail"; +} + +TEST_P(AudioCoreBluetoothA2dp, OffloadReconfiguration) { + if (bluetooth == nullptr) { + GTEST_SKIP() << "BluetoothA2dp is not supported"; + } + bool isSupported; + ASSERT_IS_OK(bluetooth->supportsOffloadReconfiguration(&isSupported)); + bool isSupported2; + ASSERT_IS_OK(bluetooth->supportsOffloadReconfiguration(&isSupported2)); + EXPECT_EQ(isSupported, isSupported2); + if (isSupported) { + static const auto kStatuses = {EX_NONE, EX_ILLEGAL_STATE}; + EXPECT_STATUS(kStatuses, bluetooth->reconfigureOffload({})); + } else { + EXPECT_STATUS(EX_UNSUPPORTED_OPERATION, bluetooth->reconfigureOffload({})); + } +} + class AudioCoreTelephony : public AudioCoreModuleBase, public testing::TestWithParam { public: void SetUp() override { @@ -3462,6 +3516,10 @@ INSTANTIATE_TEST_SUITE_P(AudioCoreBluetoothTest, AudioCoreBluetooth, testing::ValuesIn(android::getAidlHalInstanceNames(IModule::descriptor)), android::PrintInstanceNameToString); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioCoreBluetooth); +INSTANTIATE_TEST_SUITE_P(AudioCoreBluetoothA2dpTest, AudioCoreBluetoothA2dp, + testing::ValuesIn(android::getAidlHalInstanceNames(IModule::descriptor)), + android::PrintInstanceNameToString); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioCoreBluetoothA2dp); INSTANTIATE_TEST_SUITE_P(AudioCoreTelephonyTest, AudioCoreTelephony, testing::ValuesIn(android::getAidlHalInstanceNames(IModule::descriptor)), android::PrintInstanceNameToString); From 65192c339572113bd29f62b0d2d021f1d3550d9f Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Wed, 1 Mar 2023 17:57:58 +0000 Subject: [PATCH 777/998] Update comments for the Aware 4.0 types in the Vendor HAL interface. Specs should be included in the relevant places. Bug: 267819850 Test: m Change-Id: I1f213774ebf5dc297225a5cabb757d2956d67bf4 --- .../android/hardware/wifi/NanBootstrappingConfirmInd.aidl | 3 +++ .../aidl/android/hardware/wifi/NanBootstrappingMethod.aidl | 3 ++- .../android/hardware/wifi/NanBootstrappingRequest.aidl | 3 +++ .../android/hardware/wifi/NanBootstrappingRequestInd.aidl | 2 +- .../android/hardware/wifi/NanBootstrappingResponse.aidl | 3 +++ .../hardware/wifi/NanIdentityResolutionAttribute.aidl | 3 ++- wifi/aidl/android/hardware/wifi/NanPairingConfirmInd.aidl | 2 +- wifi/aidl/android/hardware/wifi/NanPairingRequest.aidl | 7 ++++--- wifi/aidl/android/hardware/wifi/NanPairingRequestInd.aidl | 2 +- .../wifi/NanRespondToPairingIndicationRequest.aidl | 1 + 10 files changed, 21 insertions(+), 8 deletions(-) diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl index 7d7a436b9e..8171572e6f 100644 --- a/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl +++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl @@ -20,6 +20,9 @@ import android.hardware.wifi.NanBootstrappingMethod; import android.hardware.wifi.NanBootstrappingResponseCode; import android.hardware.wifi.NanStatus; +/** + * See Wi-Fi Aware R4.0 section 9.5.21.7 + */ @VintfStability parcelable NanBootstrappingConfirmInd { /** diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingMethod.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingMethod.aidl index 8960794679..da2ff25073 100644 --- a/wifi/aidl/android/hardware/wifi/NanBootstrappingMethod.aidl +++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingMethod.aidl @@ -17,7 +17,8 @@ package android.hardware.wifi; /** - * Pairing bootstrapping method flag + * Pairing bootstrapping method flag. + * See Wi-Fi Aware R4.0 section 9.5.21.7 table 128 */ @VintfStability @Backing(type="int") diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl index 5297b9fda8..d386f2163d 100644 --- a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl +++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl @@ -18,6 +18,9 @@ package android.hardware.wifi; import android.hardware.wifi.NanBootstrappingMethod; +/** + * See Wi-Fi Aware R4.0 section 9.5.21.7 + */ @VintfStability parcelable NanBootstrappingRequest { /** diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequestInd.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequestInd.aidl index e11122fbc0..9094579fc3 100644 --- a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequestInd.aidl +++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequestInd.aidl @@ -21,7 +21,7 @@ import android.hardware.wifi.NanBootstrappingMethod; /** * NAN Data path request indication message structure. * Event indication received by an intended Responder when a NAN - * data request initiated by an Initiator. + * data request is initiated by an Initiator. See Wi-Fi Aware R4.0 section 9.5.21.7 */ @VintfStability parcelable NanBootstrappingRequestInd { diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingResponse.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingResponse.aidl index 0a7d62122a..1fec6b59d9 100644 --- a/wifi/aidl/android/hardware/wifi/NanBootstrappingResponse.aidl +++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingResponse.aidl @@ -18,6 +18,9 @@ package android.hardware.wifi; import android.hardware.wifi.NanBootstrappingMethod; +/** + * See Wi-Fi Aware R4.0 section 9.5.21.7 + */ @VintfStability parcelable NanBootstrappingResponse { /** diff --git a/wifi/aidl/android/hardware/wifi/NanIdentityResolutionAttribute.aidl b/wifi/aidl/android/hardware/wifi/NanIdentityResolutionAttribute.aidl index 917feffc67..807081b2cb 100644 --- a/wifi/aidl/android/hardware/wifi/NanIdentityResolutionAttribute.aidl +++ b/wifi/aidl/android/hardware/wifi/NanIdentityResolutionAttribute.aidl @@ -17,7 +17,8 @@ package android.hardware.wifi; /** - * NIRA for pairing identity resolution + * NIRA for pairing identity resolution. + * See Wi-Fi Aware R4.0 section 9.5.21.6 */ @VintfStability parcelable NanIdentityResolutionAttribute { diff --git a/wifi/aidl/android/hardware/wifi/NanPairingConfirmInd.aidl b/wifi/aidl/android/hardware/wifi/NanPairingConfirmInd.aidl index cd98c725b8..fd84505893 100644 --- a/wifi/aidl/android/hardware/wifi/NanPairingConfirmInd.aidl +++ b/wifi/aidl/android/hardware/wifi/NanPairingConfirmInd.aidl @@ -24,7 +24,7 @@ import android.hardware.wifi.NpkSecurityAssociation; /** * NAN pairing confirmation indication structure. Event indication is * received on both initiator and responder side when negotiation for a - * pairing finishes on success or failure. + * pairing finishes on success or failure. See Wi-Fi Aware R4.0 section 7.6.1.4 */ @VintfStability parcelable NanPairingConfirmInd { diff --git a/wifi/aidl/android/hardware/wifi/NanPairingRequest.aidl b/wifi/aidl/android/hardware/wifi/NanPairingRequest.aidl index 6f1a07269e..0c2080b9e0 100644 --- a/wifi/aidl/android/hardware/wifi/NanPairingRequest.aidl +++ b/wifi/aidl/android/hardware/wifi/NanPairingRequest.aidl @@ -20,9 +20,10 @@ import android.hardware.wifi.NanPairingRequestType; import android.hardware.wifi.NanPairingSecurityConfig; /** - * NAN pairing initiate request - * Which can be used for setup(the initial pairing request) or - * verification(re-pairing for paired devices) + * NAN pairing initiate request. + * Can be used for setup (the initial pairing request) or + * verification (re-pairing for paired devices). + * See Wi-Fi Aware R4.0 section 7.6.1.1 */ @VintfStability parcelable NanPairingRequest { diff --git a/wifi/aidl/android/hardware/wifi/NanPairingRequestInd.aidl b/wifi/aidl/android/hardware/wifi/NanPairingRequestInd.aidl index f247e454be..ec8548f0f5 100644 --- a/wifi/aidl/android/hardware/wifi/NanPairingRequestInd.aidl +++ b/wifi/aidl/android/hardware/wifi/NanPairingRequestInd.aidl @@ -22,7 +22,7 @@ import android.hardware.wifi.NanPairingRequestType; /** * NAN pairing request indication message structure. * Event indication received by an intended Responder when a - * pairing request initiated by an Initiator. + * pairing request is initiated by an Initiator. See Wi-Fi Aware R4.0 section 7.6.1.3 */ @VintfStability parcelable NanPairingRequestInd { diff --git a/wifi/aidl/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl b/wifi/aidl/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl index 456b430957..fab2a40be6 100644 --- a/wifi/aidl/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl +++ b/wifi/aidl/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl @@ -21,6 +21,7 @@ import android.hardware.wifi.NanPairingSecurityConfig; /** * Response to a pairing request from a peer. + * See Wi-Fi Aware R4.0 section 7.6.1.2 */ @VintfStability parcelable NanRespondToPairingIndicationRequest { From e2d0de2093fbd47a67dd1298e4699e98676a3328 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Wed, 1 Mar 2023 18:23:15 +0000 Subject: [PATCH 778/998] Update imports and argument comments in the NAN sections of the Vendor HAL interface. Bug: 267819850 Test: m Change-Id: Ic1b25239e5cf3a5cf8633c9d1108a4c200b1b861 --- .../android/hardware/wifi/IWifiNanIface.aidl | 2 + .../wifi/IWifiNanIfaceEventCallback.aidl | 42 +++++++++---------- .../wifi/NanBootstrappingConfirmInd.aidl | 1 - .../wifi/NanBootstrappingResponse.aidl | 2 - .../hardware/wifi/NanPairingConfig.aidl | 2 - .../hardware/wifi/NanPairingConfirmInd.aidl | 1 - 6 files changed, 23 insertions(+), 27 deletions(-) diff --git a/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl b/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl index 5f3ce6c620..3ce8d0214a 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl @@ -79,6 +79,7 @@ interface IWifiNanIface { * Asynchronous response is with |IWifiNanIfaceEventCallback.notifyCreateDataInterfaceResponse|. * * @param cmdId Command Id to use for this invocation. + * @param ifaceName The name of the interface, e.g. "aware0". * @throws ServiceSpecificException with one of the following values: * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, * |WifiStatusCode.ERROR_UNKNOWN| @@ -90,6 +91,7 @@ interface IWifiNanIface { * Asynchronous response is with |IWifiNanIfaceEventCallback.notifyDeleteDataInterfaceResponse|. * * @param cmdId Command Id to use for this invocation. + * @param ifaceName The name of the interface, e.g. "aware0". * @throws ServiceSpecificException with one of the following values: * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, * |WifiStatusCode.ERROR_UNKNOWN| diff --git a/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl b/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl index 8a61a9c812..3649b7bf73 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl @@ -132,7 +132,7 @@ oneway interface IWifiNanIfaceEventCallback { /** * Callback providing status on a completed followup message transmit operation. * - * @param cmdId Command Id corresponding to the original |transmitFollowupRequest| request. + * @param id Command ID corresponding to the original |transmitFollowupRequest| request. * @param status NanStatus of the operation. Possible status codes are: * |NanStatusCode.SUCCESS| * |NanStatusCode.NO_OTA_ACK| @@ -151,7 +151,7 @@ oneway interface IWifiNanIfaceEventCallback { * Callback invoked in response to a capability request * |IWifiNanIface.getCapabilitiesRequest|. * - * @param cmdId Command Id corresponding to the original request. + * @param id Command ID corresponding to the original request. * @param status NanStatus of the operation. Possible status codes are: * |NanStatusCode.SUCCESS| * @param capabilities Capability data. @@ -162,7 +162,7 @@ oneway interface IWifiNanIfaceEventCallback { /** * Callback invoked in response to a config request |IWifiNanIface.configRequest|. * - * @param cmdId Command Id corresponding to the original request. + * @param id Command ID corresponding to the original request. * @param status NanStatus of the operation. Possible status codes are: * |NanStatusCode.SUCCESS| * |NanStatusCode.INVALID_ARGS| @@ -175,7 +175,7 @@ oneway interface IWifiNanIfaceEventCallback { * Callback invoked in response to a create data interface request * |IWifiNanIface.createDataInterfaceRequest|. * - * @param cmdId Command Id corresponding to the original request. + * @param id Command ID corresponding to the original request. * @param status NanStatus of the operation. Possible status codes are: * |NanStatusCode.SUCCESS| * |NanStatusCode.INVALID_ARGS| @@ -187,7 +187,7 @@ oneway interface IWifiNanIfaceEventCallback { * Callback invoked in response to a delete data interface request * |IWifiNanIface.deleteDataInterfaceRequest|. * - * @param cmdId Command Id corresponding to the original request. + * @param id Command ID corresponding to the original request. * @param status NanStatus of the operation. Possible status codes are: * |NanStatusCode.SUCCESS| * |NanStatusCode.INVALID_ARGS| @@ -198,7 +198,7 @@ oneway interface IWifiNanIfaceEventCallback { /** * Callback invoked in response to a disable request |IWifiNanIface.disableRequest|. * - * @param cmdId Command Id corresponding to the original request. + * @param id Command ID corresponding to the original request. * @param status NanStatus of the operation. Possible status codes are: * |NanStatusCode.SUCCESS| * |NanStatusCode.PROTOCOL_FAILURE| @@ -208,7 +208,7 @@ oneway interface IWifiNanIfaceEventCallback { /** * Callback invoked in response to an enable request |IWifiNanIface.enableRequest|. * - * @param cmdId Command Id corresponding to the original request. + * @param id Command ID corresponding to the original request. * @param status NanStatus of the operation. Possible status codes are: * |NanStatusCode.SUCCESS| * |NanStatusCode.ALREADY_ENABLED| @@ -223,7 +223,7 @@ oneway interface IWifiNanIfaceEventCallback { * Callback invoked in response to an initiate data path request * |IWifiNanIface.initiateDataPathRequest|. * - * @param cmdId Command Id corresponding to the original request. + * @param id Command ID corresponding to the original request. * @param status NanStatus of the operation. Possible status codes are: * |NanStatusCode.SUCCESS| * |NanStatusCode.INVALID_ARGS| @@ -238,7 +238,7 @@ oneway interface IWifiNanIfaceEventCallback { * Callback invoked in response to a respond to data path indication request * |IWifiNanIface.respondToDataPathIndicationRequest|. * - * @param cmdId Command Id corresponding to the original request. + * @param id Command ID corresponding to the original request. * @param status NanStatus of the operation. Possible status codes are: * |NanStatusCode.SUCCESS| * |NanStatusCode.INVALID_ARGS| @@ -252,7 +252,7 @@ oneway interface IWifiNanIfaceEventCallback { * Callback invoked to notify the status of the start publish request * |IWifiNanIface.startPublishRequest|. * - * @param cmdId Command Id corresponding to the original request. + * @param id Command ID corresponding to the original request. * @param status NanStatus of the operation. Possible status codes are: * |NanStatusCode.SUCCESS| * |NanStatusCode.INVALID_ARGS| @@ -267,7 +267,7 @@ oneway interface IWifiNanIfaceEventCallback { * Callback invoked to notify the status of the start subscribe request * |IWifiNanIface.startSubscribeRequest|. * - * @param cmdId Command Id corresponding to the original request. + * @param id Command ID corresponding to the original request. * @param status NanStatus of the operation. Possible status codes are: * |NanStatusCode.SUCCESS| * |NanStatusCode.INVALID_ARGS| @@ -282,7 +282,7 @@ oneway interface IWifiNanIfaceEventCallback { * Callback invoked in response to a stop publish request * |IWifiNanIface.stopPublishRequest|. * - * @param cmdId Command Id corresponding to the original request. + * @param id Command ID corresponding to the original request. * @param status NanStatus of the operation. Possible status codes are: * |NanStatusCode.SUCCESS| * |NanStatusCode.INVALID_SESSION_ID| @@ -294,7 +294,7 @@ oneway interface IWifiNanIfaceEventCallback { * Callback invoked in response to a stop subscribe request * |IWifiNanIface.stopSubscribeRequest|. * - * @param cmdId Command Id corresponding to the original request. + * @param id Command ID corresponding to the original request. * @param status NanStatus of the operation. Possible status codes are: * |NanStatusCode.SUCCESS| * |NanStatusCode.INVALID_SESSION_ID| @@ -306,7 +306,7 @@ oneway interface IWifiNanIfaceEventCallback { * Callback invoked in response to a terminate data path request * |IWifiNanIface.terminateDataPathRequest|. * - * @param cmdId Command Id corresponding to the original request. + * @param id Command ID corresponding to the original request. * @param status NanStatus of the operation. Possible status codes are: * |NanStatusCode.SUCCESS| * |NanStatusCode.INVALID_ARGS| @@ -320,7 +320,7 @@ oneway interface IWifiNanIfaceEventCallback { * Callback invoked in response to a suspension request * |IWifiNanIface.suspendRequest|. * - * @param cmdId Command Id corresponding to the original request. + * @param id Command ID corresponding to the original request. * @param status NanStatus of the operation. Possible status codes are: * |NanStatusCode.SUCCESS| * |NanStatusCode.INVALID_SESSION_ID| @@ -333,7 +333,7 @@ oneway interface IWifiNanIfaceEventCallback { * Callback invoked in response to a resume request * |IWifiNanIface.resumeRequest|. * - * @param cmdId Command Id corresponding to the original request. + * @param id Command ID corresponding to the original request. * @param status NanStatus of the operation. Possible status codes are: * |NanStatusCode.SUCCESS| * |NanStatusCode.INVALID_SESSION_ID| @@ -346,7 +346,7 @@ oneway interface IWifiNanIfaceEventCallback { * Callback invoked in response to a transmit followup request * |IWifiNanIface.transmitFollowupRequest|. * - * @param cmdId Command Id corresponding to the original request. + * @param id Command ID corresponding to the original request. * @param status NanStatus of the operation. Possible status codes are: * |NanStatusCode.SUCCESS| * |NanStatusCode.INVALID_ARGS| @@ -377,7 +377,7 @@ oneway interface IWifiNanIfaceEventCallback { * Callback invoked in response to an initiate NAN pairing request * |IWifiNanIface.initiatePairingRequest|. * - * @param cmdId Command Id corresponding to the original request. + * @param id Command ID corresponding to the original request. * @param status NanStatus of the operation. Possible status codes are: * |NanStatusCode.SUCCESS| * |NanStatusCode.INVALID_ARGS| @@ -392,7 +392,7 @@ oneway interface IWifiNanIfaceEventCallback { * Callback invoked in response to a respond to NAN pairing indication request * |IWifiNanIface.respondToPairingIndicationRequest|. * - * @param cmdId Command Id corresponding to the original request. + * @param id Command ID corresponding to the original request. * @param status NanStatus of the operation. Possible status codes are: * |NanStatusCode.SUCCESS| * |NanStatusCode.INVALID_ARGS| @@ -422,7 +422,7 @@ oneway interface IWifiNanIfaceEventCallback { * Callback invoked in response to an initiate NAN pairing bootstrapping request * |IWifiNanIface.initiateBootstrappingRequest|. * - * @param cmdId Command Id corresponding to the original request. + * @param id Command ID corresponding to the original request. * @param status NanStatus of the operation. Possible status codes are: * |NanStatusCode.SUCCESS| * |NanStatusCode.INVALID_ARGS| @@ -438,7 +438,7 @@ oneway interface IWifiNanIfaceEventCallback { * Callback invoked in response to a respond to pairing bootstrapping indication request * |IWifiNanIface.respondToBootstrappingIndicationRequest|. * - * @param cmdId Command Id corresponding to the original request. + * @param id Command ID corresponding to the original request. * @param status NanStatus of the operation. Possible status codes are: * |NanStatusCode.SUCCESS| * |NanStatusCode.INVALID_ARGS| diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl index 8171572e6f..654b0cf085 100644 --- a/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl +++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl @@ -16,7 +16,6 @@ package android.hardware.wifi; -import android.hardware.wifi.NanBootstrappingMethod; import android.hardware.wifi.NanBootstrappingResponseCode; import android.hardware.wifi.NanStatus; diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingResponse.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingResponse.aidl index 1fec6b59d9..dbe892316e 100644 --- a/wifi/aidl/android/hardware/wifi/NanBootstrappingResponse.aidl +++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingResponse.aidl @@ -16,8 +16,6 @@ package android.hardware.wifi; -import android.hardware.wifi.NanBootstrappingMethod; - /** * See Wi-Fi Aware R4.0 section 9.5.21.7 */ diff --git a/wifi/aidl/android/hardware/wifi/NanPairingConfig.aidl b/wifi/aidl/android/hardware/wifi/NanPairingConfig.aidl index 4f9c3ae968..20122e2427 100644 --- a/wifi/aidl/android/hardware/wifi/NanPairingConfig.aidl +++ b/wifi/aidl/android/hardware/wifi/NanPairingConfig.aidl @@ -16,8 +16,6 @@ package android.hardware.wifi; -import android.hardware.wifi.NanBootstrappingMethod; - /** * The NAN pairing config */ diff --git a/wifi/aidl/android/hardware/wifi/NanPairingConfirmInd.aidl b/wifi/aidl/android/hardware/wifi/NanPairingConfirmInd.aidl index fd84505893..a5670ec460 100644 --- a/wifi/aidl/android/hardware/wifi/NanPairingConfirmInd.aidl +++ b/wifi/aidl/android/hardware/wifi/NanPairingConfirmInd.aidl @@ -16,7 +16,6 @@ package android.hardware.wifi; -import android.hardware.wifi.NanDataPathChannelInfo; import android.hardware.wifi.NanPairingRequestType; import android.hardware.wifi.NanStatus; import android.hardware.wifi.NpkSecurityAssociation; From 3f884a8b91428cd807f357b0fdcfae355ec71b4e Mon Sep 17 00:00:00 2001 From: Ayush Jain Date: Wed, 1 Mar 2023 19:39:42 +0000 Subject: [PATCH 779/998] Add a Vendor dependent UCI Status code for UWB OFF Add a UCI status code for scenario when UWB needs to be turned off due to Regulatory reasons. Ran the "m android.hardware.uwb.fira_android-update-api" command to update the generated AIDL API. Bug: 267554906 Test: Compile make.com.google.android.uwb Change-Id: I5f86007776479fefe2d3b3e36d16ef628f92cebd --- .../android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl | 1 + .../android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl | 2 ++ 2 files changed, 3 insertions(+) diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl index 2f534df10c..768ef8ce24 100644 --- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl @@ -36,4 +36,5 @@ package android.hardware.uwb.fira_android; enum UwbVendorStatusCodes { STATUS_ERROR_CCC_SE_BUSY = 80, STATUS_ERROR_CCC_LIFECYCLE = 81, + STATUS_REGULATION_UWB_OFF = 82, } diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl index 8505b8a7cf..f1eea9d397 100644 --- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl +++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl @@ -33,4 +33,6 @@ enum UwbVendorStatusCodes { STATUS_ERROR_CCC_SE_BUSY = 0x50, /** CCC Lifecycle error */ STATUS_ERROR_CCC_LIFECYCLE = 0x51, + /** UWB Regulation Off */ + STATUS_REGULATION_UWB_OFF = 0x52, } From 8c34f76686e2183df3aa2e259940c434e5da61be Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Wed, 1 Mar 2023 12:20:50 -0800 Subject: [PATCH 780/998] Add units to WINDSHIELD_WIPERS_PERIOD HAL doc Bug: 271302606 Test: presubmit Change-Id: I047817cf85a8516256607c15315ed8a8d94fbac2 --- .../android/hardware/automotive/vehicle/VehicleProperty.aidl | 1 + 1 file changed, 1 insertion(+) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index c29076dc15..b628b602f1 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -2146,6 +2146,7 @@ enum VehicleProperty { * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ + * @unit VehicleUnit:MILLI_SECS */ WINDSHIELD_WIPERS_PERIOD = 0x0BC5 + VehiclePropertyGroup.SYSTEM + VehicleArea.WINDOW + VehiclePropertyType.INT32, From 008c1da0314c6ca9f45823d681f72931c7da2e35 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Sat, 4 Feb 2023 00:26:46 +0000 Subject: [PATCH 781/998] Use an int to represent bitmaps in the Vendor HAL AIDL interface. Bug: 267819850 Test: atest VtsHalWifiChipTargetTest \ VtsHalWifiStaIfaceTargetTest \ VtsHalWifiApIfaceTargetTest \ VtsHalWifiNanIfaceTargetTest \ VtsHalWifiRttControllerTargetTest Change-Id: Ic72496c654067b2db97109cc3dc9ff50f1f1d1dd --- .../current/android/hardware/wifi/IWifiChip.aidl | 8 ++++---- .../android/hardware/wifi/IWifiStaIface.aidl | 2 +- .../wifi/StaBackgroundScanBucketParameters.aidl | 2 +- .../current/android/hardware/wifi/StaScanData.aidl | 2 +- .../android/hardware/wifi/WifiUsableChannel.aidl | 2 +- wifi/aidl/android/hardware/wifi/IWifiChip.aidl | 11 +++++------ wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl | 2 +- .../wifi/StaBackgroundScanBucketParameters.aidl | 3 +-- wifi/aidl/android/hardware/wifi/StaScanData.aidl | 5 ++--- .../android/hardware/wifi/WifiUsableChannel.aidl | 6 +++--- wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp | 4 ++-- wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp | 14 ++++++-------- .../vts/functional/wifi_sta_iface_aidl_test.cpp | 8 ++++---- 13 files changed, 32 insertions(+), 37 deletions(-) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl index 2ff6896d98..23f403021a 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl @@ -47,7 +47,7 @@ interface IWifiChip { @PropagateAllowBlocking android.hardware.wifi.IWifiApIface getApIface(in String ifname); String[] getApIfaceNames(); android.hardware.wifi.IWifiChip.ChipMode[] getAvailableModes(); - android.hardware.wifi.IWifiChip.ChipCapabilityMask getCapabilities(); + int getCapabilities(); android.hardware.wifi.WifiDebugHostWakeReasonStats getDebugHostWakeReasonStats(); android.hardware.wifi.WifiDebugRingBufferStatus[] getDebugRingBuffersStatus(); int getId(); @@ -60,7 +60,7 @@ interface IWifiChip { String[] getStaIfaceNames(); android.hardware.wifi.WifiRadioCombination[] getSupportedRadioCombinations(); android.hardware.wifi.WifiChipCapabilities getWifiChipCapabilities(); - android.hardware.wifi.WifiUsableChannel[] getUsableChannels(in android.hardware.wifi.WifiBand band, in android.hardware.wifi.WifiIfaceMode ifaceModeMask, in android.hardware.wifi.IWifiChip.UsableChannelFilter filterMask); + android.hardware.wifi.WifiUsableChannel[] getUsableChannels(in android.hardware.wifi.WifiBand band, in int ifaceModeMask, in int filterMask); void setAfcChannelAllowance(in android.hardware.wifi.AvailableAfcFrequencyInfo[] availableAfcFrequencyInfo); void registerEventCallback(in android.hardware.wifi.IWifiChipEventCallback callback); void removeApIface(in String ifname); @@ -73,7 +73,7 @@ interface IWifiChip { byte[] requestFirmwareDebugDump(); void resetTxPowerScenario(); void selectTxPowerScenario(in android.hardware.wifi.IWifiChip.TxPowerScenario scenario); - void setCoexUnsafeChannels(in android.hardware.wifi.IWifiChip.CoexUnsafeChannel[] unsafeChannels, in android.hardware.wifi.IWifiChip.CoexRestriction restrictions); + void setCoexUnsafeChannels(in android.hardware.wifi.IWifiChip.CoexUnsafeChannel[] unsafeChannels, in int restrictions); void setCountryCode(in byte[2] code); void setLatencyMode(in android.hardware.wifi.IWifiChip.LatencyMode mode); void setMultiStaPrimaryConnection(in String ifName); @@ -81,7 +81,7 @@ interface IWifiChip { void startLoggingToDebugRingBuffer(in String ringName, in android.hardware.wifi.WifiDebugRingBufferVerboseLevel verboseLevel, in int maxIntervalInSec, in int minDataSizeInBytes); void stopLoggingToDebugRingBuffer(); void triggerSubsystemRestart(); - void enableStaChannelForPeerNetwork(in android.hardware.wifi.IWifiChip.ChannelCategoryMask channelCategoryEnableFlag); + void enableStaChannelForPeerNetwork(in int channelCategoryEnableFlag); void setMloMode(in android.hardware.wifi.IWifiChip.ChipMloMode mode); const int NO_POWER_CAP_CONSTANT = 0x7FFFFFFF; @Backing(type="int") @VintfStability diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl index 31b6881fa9..a7f20810da 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl @@ -41,7 +41,7 @@ interface IWifiStaIface { void enableNdOffload(in boolean enable); android.hardware.wifi.StaApfPacketFilterCapabilities getApfPacketFilterCapabilities(); android.hardware.wifi.StaBackgroundScanCapabilities getBackgroundScanCapabilities(); - android.hardware.wifi.IWifiStaIface.StaIfaceCapabilityMask getCapabilities(); + int getCapabilities(); android.hardware.wifi.WifiDebugRxPacketFateReport[] getDebugRxPacketFates(); android.hardware.wifi.WifiDebugTxPacketFateReport[] getDebugTxPacketFates(); byte[6] getFactoryMacAddress(); diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaBackgroundScanBucketParameters.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaBackgroundScanBucketParameters.aidl index b49d406921..4e9671a370 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaBackgroundScanBucketParameters.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaBackgroundScanBucketParameters.aidl @@ -38,7 +38,7 @@ parcelable StaBackgroundScanBucketParameters { android.hardware.wifi.WifiBand band; int[] frequencies; int periodInMs; - android.hardware.wifi.StaBackgroundScanBucketEventReportSchemeMask eventReportScheme; + int eventReportScheme; int exponentialMaxPeriodInMs; int exponentialBase; int exponentialStepCount; diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaScanData.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaScanData.aidl index 590376098b..7c75232e51 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaScanData.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/StaScanData.aidl @@ -34,7 +34,7 @@ package android.hardware.wifi; @VintfStability parcelable StaScanData { - android.hardware.wifi.StaScanDataFlagMask flags; + int flags; int bucketsScanned; android.hardware.wifi.StaScanResult[] results; } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiUsableChannel.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiUsableChannel.aidl index 94e3a8ae0b..774b2423ff 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiUsableChannel.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/WifiUsableChannel.aidl @@ -36,5 +36,5 @@ package android.hardware.wifi; parcelable WifiUsableChannel { int channel; android.hardware.wifi.WifiChannelWidthInMhz channelBandwidth; - android.hardware.wifi.WifiIfaceMode ifaceModeMask; + int ifaceModeMask; } diff --git a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl index c0e41cdb44..1710f63e64 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl @@ -590,7 +590,7 @@ interface IWifiChip { * |WifiStatusCode.ERROR_NOT_AVAILABLE|, * |WifiStatusCode.ERROR_UNKNOWN| */ - ChipCapabilityMask getCapabilities(); + int getCapabilities(); /** * API to retrieve the wifi wake up reason stats for debugging. @@ -808,7 +808,7 @@ interface IWifiChip { * |WifiStatusCode.FAILURE_UNKNOWN| */ WifiUsableChannel[] getUsableChannels( - in WifiBand band, in WifiIfaceMode ifaceModeMask, in UsableChannelFilter filterMask); + in WifiBand band, in int ifaceModeMask, in int filterMask); /* * Set the max power level the chip is allowed to transmit on for 6Ghz AFC @@ -982,8 +982,7 @@ interface IWifiChip { * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|, * |WifiStatusCode.ERROR_INVALID_ARGS|, */ - void setCoexUnsafeChannels( - in CoexUnsafeChannel[] unsafeChannels, in CoexRestriction restrictions); + void setCoexUnsafeChannels(in CoexUnsafeChannel[] unsafeChannels, in int restrictions); /** * Set country code for this Wifi chip. @@ -1110,14 +1109,14 @@ interface IWifiChip { * If the channel category is enabled and allowed by the regulatory, the HAL method * getUsableChannels() will contain the current STA-connected channel if that channel belongs * to that category. - * @param channelCategoryEnableFlag bitmask of |ChannelCategoryMask|. + * @param channelCategoryEnableFlag Bitmask of |ChannelCategoryMask| values. * For each bit, 1 enables the channel category and 0 disables that channel category. * @throws ServiceSpecificException with one of the following values: * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|, * |WifiStatusCode.ERROR_NOT_SUPPORTED|, * |WifiStatusCode.FAILURE_UNKNOWN| */ - void enableStaChannelForPeerNetwork(in ChannelCategoryMask channelCategoryEnableFlag); + void enableStaChannelForPeerNetwork(in int channelCategoryEnableFlag); /** * Multi-Link Operation modes. diff --git a/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl b/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl index 28d6a4dfb6..8e9a06d735 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl @@ -198,7 +198,7 @@ interface IWifiStaIface { * |WifiStatusCode.ERROR_NOT_AVAILABLE|, * |WifiStatusCode.ERROR_UNKNOWN| */ - StaIfaceCapabilityMask getCapabilities(); + int getCapabilities(); /** * API to retrieve the fates of inbound packets. diff --git a/wifi/aidl/android/hardware/wifi/StaBackgroundScanBucketParameters.aidl b/wifi/aidl/android/hardware/wifi/StaBackgroundScanBucketParameters.aidl index 7bd87b2917..76b510dd6e 100644 --- a/wifi/aidl/android/hardware/wifi/StaBackgroundScanBucketParameters.aidl +++ b/wifi/aidl/android/hardware/wifi/StaBackgroundScanBucketParameters.aidl @@ -16,7 +16,6 @@ package android.hardware.wifi; -import android.hardware.wifi.StaBackgroundScanBucketEventReportSchemeMask; import android.hardware.wifi.WifiBand; /** @@ -50,7 +49,7 @@ parcelable StaBackgroundScanBucketParameters { * Bitset of |StaBackgroundScanBucketEventReportSchemeMask| values controlling * when events for this bucket must be reported. */ - StaBackgroundScanBucketEventReportSchemeMask eventReportScheme; + int eventReportScheme; /** * For exponential back off. If |exponentialMaxPeriodInMs| is non-zero or * different than period, then this bucket is an exponential backoff bucket diff --git a/wifi/aidl/android/hardware/wifi/StaScanData.aidl b/wifi/aidl/android/hardware/wifi/StaScanData.aidl index 9d6bd5378d..abc56385ad 100644 --- a/wifi/aidl/android/hardware/wifi/StaScanData.aidl +++ b/wifi/aidl/android/hardware/wifi/StaScanData.aidl @@ -16,7 +16,6 @@ package android.hardware.wifi; -import android.hardware.wifi.StaScanDataFlagMask; import android.hardware.wifi.StaScanResult; /** @@ -26,9 +25,9 @@ import android.hardware.wifi.StaScanResult; @VintfStability parcelable StaScanData { /** - * Bitset containing |ScanDataFlagMask| values. + * Bitset of |ScanDataFlagMask| values. */ - StaScanDataFlagMask flags; + int flags; /** * Bitset where each bit indicates if the bucket with that index (starting at * 0) was scanned. diff --git a/wifi/aidl/android/hardware/wifi/WifiUsableChannel.aidl b/wifi/aidl/android/hardware/wifi/WifiUsableChannel.aidl index d92e4cce94..077c17e696 100644 --- a/wifi/aidl/android/hardware/wifi/WifiUsableChannel.aidl +++ b/wifi/aidl/android/hardware/wifi/WifiUsableChannel.aidl @@ -17,7 +17,6 @@ package android.hardware.wifi; import android.hardware.wifi.WifiChannelWidthInMhz; -import android.hardware.wifi.WifiIfaceMode; /** * Wifi usable channel information. @@ -33,7 +32,8 @@ parcelable WifiUsableChannel { */ WifiChannelWidthInMhz channelBandwidth; /** - * Iface modes feasible on this channel. + * Iface modes feasible on this channel, represented as a bitmask + * of |WifiIfaceMode| values. */ - WifiIfaceMode ifaceModeMask; + int ifaceModeMask; } diff --git a/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp b/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp index 463545bbe0..4cf14a269a 100644 --- a/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp +++ b/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp @@ -208,9 +208,9 @@ void stopWifiService(const char* instance_name) { } int32_t getChipCapabilities(const std::shared_ptr& wifi_chip) { - IWifiChip::ChipCapabilityMask caps = {}; + int32_t caps = 0; if (wifi_chip->getCapabilities(&caps).isOk()) { - return static_cast(caps); + return caps; } return 0; } diff --git a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp index d0b7014614..dbff9491a6 100644 --- a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp +++ b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -232,9 +233,7 @@ TEST_P(WifiChipAidlTest, GetUsableChannels) { std::vector channels; configureChipForConcurrencyType(IfaceConcurrencyType::STA); - auto status = wifi_chip_->getUsableChannels( - band, static_cast(ifaceModeMask), - static_cast(filterMask), &channels); + auto status = wifi_chip_->getUsableChannels(band, ifaceModeMask, filterMask, &channels); if (checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)) { GTEST_SKIP() << "getUsableChannels() is not supported by vendor."; } @@ -337,7 +336,7 @@ TEST_P(WifiChipAidlTest, SetCoexUnsafeChannels) { // Test with an empty vector of CoexUnsafeChannels. std::vector vec; - IWifiChip::CoexRestriction restrictions = static_cast(0); + int restrictions = 0; auto status = wifi_chip_->setCoexUnsafeChannels(vec, restrictions); if (!status.isOk()) { EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); @@ -352,10 +351,9 @@ TEST_P(WifiChipAidlTest, SetCoexUnsafeChannels) { unsafeChannel5Ghz.band = WifiBand::BAND_5GHZ; unsafeChannel5Ghz.channel = 36; vec.push_back(unsafeChannel5Ghz); - restrictions = static_cast( - static_cast(IWifiChip::CoexRestriction::WIFI_AWARE) | - static_cast(IWifiChip::CoexRestriction::SOFTAP) | - static_cast(IWifiChip::CoexRestriction::WIFI_DIRECT)); + restrictions = static_cast(IWifiChip::CoexRestriction::WIFI_AWARE) | + static_cast(IWifiChip::CoexRestriction::SOFTAP) | + static_cast(IWifiChip::CoexRestriction::WIFI_DIRECT); status = wifi_chip_->setCoexUnsafeChannels(vec, restrictions); if (!status.isOk()) { diff --git a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp index fe32be55c9..b772bc320f 100644 --- a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp +++ b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp @@ -54,9 +54,9 @@ class WifiStaIfaceAidlTest : public testing::TestWithParam { protected: bool isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask expected) { - IWifiStaIface::StaIfaceCapabilityMask caps = {}; + int32_t caps = 0; EXPECT_TRUE(wifi_sta_iface_->getCapabilities(&caps).isOk()); - return static_cast(caps) & static_cast(expected); + return caps & static_cast(expected); } ndk::ScopedAStatus createStaIface(std::shared_ptr* sta_iface) { @@ -86,9 +86,9 @@ TEST_P(WifiStaIfaceAidlTest, GetFactoryMacAddress) { * GetCapabilities */ TEST_P(WifiStaIfaceAidlTest, GetCapabilities) { - IWifiStaIface::StaIfaceCapabilityMask caps = {}; + int32_t caps = 0; EXPECT_TRUE(wifi_sta_iface_->getCapabilities(&caps).isOk()); - EXPECT_NE(static_cast(caps), 0); + EXPECT_NE(caps, 0); } /* From 3b86a78032e79c4f1fe523a12c02ea6c60e6f668 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Sat, 4 Feb 2023 00:42:53 +0000 Subject: [PATCH 782/998] Update Vendor HAL service to use ints for bitmaps instead of using enums. Bug: 267819850 Test: m Change-Id: I6fba3cd669d197229ff637c6326a94be624d5e6e --- wifi/aidl/default/aidl_struct_util.cpp | 8 +++--- wifi/aidl/default/aidl_struct_util.h | 3 +++ wifi/aidl/default/wifi_chip.cpp | 35 +++++++++++--------------- wifi/aidl/default/wifi_chip.h | 20 +++++++-------- wifi/aidl/default/wifi_sta_iface.cpp | 15 ++++------- wifi/aidl/default/wifi_sta_iface.h | 5 ++-- 6 files changed, 38 insertions(+), 48 deletions(-) diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index 5bfdcbb408..dfa08a17a8 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -408,8 +408,8 @@ bool convertLegacyWifiUsableChannelToAidl( aidl_usable_channel->channel = legacy_usable_channel.freq; aidl_usable_channel->channelBandwidth = convertLegacyWifiChannelWidthToAidl(legacy_usable_channel.width); - aidl_usable_channel->ifaceModeMask = static_cast( - convertLegacyWifiInterfaceModeToAidl(legacy_usable_channel.iface_mode_mask)); + aidl_usable_channel->ifaceModeMask = + convertLegacyWifiInterfaceModeToAidl(legacy_usable_channel.iface_mode_mask); return true; } @@ -572,7 +572,7 @@ bool convertAidlGscanParamsToLegacy(const StaBackgroundScanParameters& aidl_scan legacy_bucket_spec.report_events = 0; using AidlFlag = StaBackgroundScanBucketEventReportSchemeMask; for (const auto flag : {AidlFlag::EACH_SCAN, AidlFlag::FULL_RESULTS, AidlFlag::NO_BATCH}) { - if (static_cast(aidl_bucket_spec.eventReportScheme) & + if (aidl_bucket_spec.eventReportScheme & static_cast::type>(flag)) { legacy_bucket_spec.report_events |= convertAidlGscanReportEventFlagToLegacy(flag); } @@ -678,7 +678,7 @@ bool convertLegacyCachedGscanResultsToAidl( convertLegacyGscanDataFlagToAidl(flag)); } } - aidl_scan_data->flags = static_cast(flags); + aidl_scan_data->flags = flags; aidl_scan_data->bucketsScanned = legacy_cached_scan_result.buckets_scanned; CHECK(legacy_cached_scan_result.num_results >= 0 && diff --git a/wifi/aidl/default/aidl_struct_util.h b/wifi/aidl/default/aidl_struct_util.h index 3da94dc58b..9a13672424 100644 --- a/wifi/aidl/default/aidl_struct_util.h +++ b/wifi/aidl/default/aidl_struct_util.h @@ -20,7 +20,10 @@ #include #include #include +#include +#include #include +#include #include diff --git a/wifi/aidl/default/wifi_chip.cpp b/wifi/aidl/default/wifi_chip.cpp index 89edaa4ef3..dd24e6b77e 100644 --- a/wifi/aidl/default/wifi_chip.cpp +++ b/wifi/aidl/default/wifi_chip.cpp @@ -455,7 +455,7 @@ ndk::ScopedAStatus WifiChip::registerEventCallback( &WifiChip::registerEventCallbackInternal, event_callback); } -ndk::ScopedAStatus WifiChip::getCapabilities(IWifiChip::ChipCapabilityMask* _aidl_return) { +ndk::ScopedAStatus WifiChip::getCapabilities(int32_t* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, &WifiChip::getCapabilitiesInternal, _aidl_return); } @@ -681,7 +681,7 @@ ndk::ScopedAStatus WifiChip::setMultiStaUseCase(IWifiChip::MultiStaUseCase in_us ndk::ScopedAStatus WifiChip::setCoexUnsafeChannels( const std::vector& in_unsafeChannels, - CoexRestriction in_restrictions) { + int32_t in_restrictions) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, &WifiChip::setCoexUnsafeChannelsInternal, in_unsafeChannels, in_restrictions); @@ -692,8 +692,8 @@ ndk::ScopedAStatus WifiChip::setCountryCode(const std::array& in_cod &WifiChip::setCountryCodeInternal, in_code); } -ndk::ScopedAStatus WifiChip::getUsableChannels(WifiBand in_band, WifiIfaceMode in_ifaceModeMask, - UsableChannelFilter in_filterMask, +ndk::ScopedAStatus WifiChip::getUsableChannels(WifiBand in_band, int32_t in_ifaceModeMask, + int32_t in_filterMask, std::vector* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, &WifiChip::getUsableChannelsInternal, _aidl_return, in_band, @@ -722,8 +722,7 @@ ndk::ScopedAStatus WifiChip::getWifiChipCapabilities(WifiChipCapabilities* _aidl &WifiChip::getWifiChipCapabilitiesInternal, _aidl_return); } -ndk::ScopedAStatus WifiChip::enableStaChannelForPeerNetwork( - ChannelCategoryMask in_channelCategoryEnableFlag) { +ndk::ScopedAStatus WifiChip::enableStaChannelForPeerNetwork(int32_t in_channelCategoryEnableFlag) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, &WifiChip::enableStaChannelForPeerNetworkInternal, in_channelCategoryEnableFlag); @@ -787,7 +786,7 @@ ndk::ScopedAStatus WifiChip::registerEventCallbackInternal( return ndk::ScopedAStatus::ok(); } -std::pair WifiChip::getCapabilitiesInternal() { +std::pair WifiChip::getCapabilitiesInternal() { legacy_hal::wifi_error legacy_status; uint64_t legacy_feature_set; uint32_t legacy_logger_feature_set; @@ -795,7 +794,7 @@ std::pair WifiChip::getCapabi std::tie(legacy_status, legacy_feature_set) = legacy_hal_.lock()->getSupportedFeatureSet(ifname); if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {IWifiChip::ChipCapabilityMask{}, createWifiStatusFromLegacyError(legacy_status)}; + return {0, createWifiStatusFromLegacyError(legacy_status)}; } std::tie(legacy_status, legacy_logger_feature_set) = legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname); @@ -806,9 +805,9 @@ std::pair WifiChip::getCapabi uint32_t aidl_caps; if (!aidl_struct_util::convertLegacyFeaturesToAidlChipCapabilities(legacy_feature_set, &aidl_caps)) { - return {IWifiChip::ChipCapabilityMask{}, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + return {0, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; } - return {static_cast(aidl_caps), ndk::ScopedAStatus::ok()}; + return {aidl_caps, ndk::ScopedAStatus::ok()}; } std::pair, ndk::ScopedAStatus> @@ -1385,13 +1384,12 @@ ndk::ScopedAStatus WifiChip::setMultiStaUseCaseInternal(IWifiChip::MultiStaUseCa } ndk::ScopedAStatus WifiChip::setCoexUnsafeChannelsInternal( - std::vector unsafe_channels, CoexRestriction restrictions) { + std::vector unsafe_channels, int32_t aidl_restrictions) { std::vector legacy_unsafe_channels; if (!aidl_struct_util::convertAidlVectorOfCoexUnsafeChannelToLegacy(unsafe_channels, &legacy_unsafe_channels)) { return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); } - uint32_t aidl_restrictions = static_cast(restrictions); uint32_t legacy_restrictions = 0; if (aidl_restrictions & static_cast(CoexRestriction::WIFI_DIRECT)) { legacy_restrictions |= legacy_hal::wifi_coex_restriction::WIFI_DIRECT; @@ -1413,15 +1411,13 @@ ndk::ScopedAStatus WifiChip::setCountryCodeInternal(const std::array } std::pair, ndk::ScopedAStatus> WifiChip::getUsableChannelsInternal( - WifiBand band, WifiIfaceMode ifaceModeMask, UsableChannelFilter filterMask) { + WifiBand band, int32_t ifaceModeMask, int32_t filterMask) { legacy_hal::wifi_error legacy_status; std::vector legacy_usable_channels; std::tie(legacy_status, legacy_usable_channels) = legacy_hal_.lock()->getUsableChannels( aidl_struct_util::convertAidlWifiBandToLegacyMacBand(band), - aidl_struct_util::convertAidlWifiIfaceModeToLegacy( - static_cast(ifaceModeMask)), - aidl_struct_util::convertAidlUsableChannelFilterToLegacy( - static_cast(filterMask))); + aidl_struct_util::convertAidlWifiIfaceModeToLegacy(ifaceModeMask), + aidl_struct_util::convertAidlUsableChannelFilterToLegacy(filterMask)); if (legacy_status != legacy_hal::WIFI_SUCCESS) { return {std::vector(), createWifiStatusFromLegacyError(legacy_status)}; @@ -1483,10 +1479,9 @@ std::pair WifiChip::getWifiChipCapabil } ndk::ScopedAStatus WifiChip::enableStaChannelForPeerNetworkInternal( - ChannelCategoryMask channelCategoryEnableFlag) { + int32_t channelCategoryEnableFlag) { auto legacy_status = legacy_hal_.lock()->enableStaChannelForPeerNetwork( - aidl_struct_util::convertAidlChannelCategoryToLegacy( - static_cast(channelCategoryEnableFlag))); + aidl_struct_util::convertAidlChannelCategoryToLegacy(channelCategoryEnableFlag)); return createWifiStatusFromLegacyError(legacy_status); } diff --git a/wifi/aidl/default/wifi_chip.h b/wifi/aidl/default/wifi_chip.h index eca68eda20..c5dcee7888 100644 --- a/wifi/aidl/default/wifi_chip.h +++ b/wifi/aidl/default/wifi_chip.h @@ -85,7 +85,7 @@ class WifiChip : public BnWifiChip { ndk::ScopedAStatus getId(int32_t* _aidl_return) override; ndk::ScopedAStatus registerEventCallback( const std::shared_ptr& in_callback) override; - ndk::ScopedAStatus getCapabilities(IWifiChip::ChipCapabilityMask* _aidl_return) override; + ndk::ScopedAStatus getCapabilities(int32_t* _aidl_return) override; ndk::ScopedAStatus getAvailableModes(std::vector* _aidl_return) override; ndk::ScopedAStatus configureChip(int32_t in_modeId) override; ndk::ScopedAStatus getMode(int32_t* _aidl_return) override; @@ -136,10 +136,10 @@ class WifiChip : public BnWifiChip { ndk::ScopedAStatus setMultiStaUseCase(IWifiChip::MultiStaUseCase in_useCase) override; ndk::ScopedAStatus setCoexUnsafeChannels( const std::vector& in_unsafeChannels, - CoexRestriction in_restrictions) override; + int32_t in_restrictions) override; ndk::ScopedAStatus setCountryCode(const std::array& in_code) override; - ndk::ScopedAStatus getUsableChannels(WifiBand in_band, WifiIfaceMode in_ifaceModeMask, - UsableChannelFilter in_filterMask, + ndk::ScopedAStatus getUsableChannels(WifiBand in_band, int32_t in_ifaceModeMask, + int32_t in_filterMask, std::vector* _aidl_return) override; ndk::ScopedAStatus setAfcChannelAllowance( const std::vector& availableAfcFrequencyInfo) override; @@ -148,7 +148,7 @@ class WifiChip : public BnWifiChip { std::vector* _aidl_return) override; ndk::ScopedAStatus getWifiChipCapabilities(WifiChipCapabilities* _aidl_return) override; ndk::ScopedAStatus enableStaChannelForPeerNetwork( - ChannelCategoryMask in_channelCategoryEnableFlag) override; + int32_t in_channelCategoryEnableFlag) override; binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; ndk::ScopedAStatus setMloMode(const ChipMloMode in_mode) override; @@ -162,7 +162,7 @@ class WifiChip : public BnWifiChip { std::pair getIdInternal(); ndk::ScopedAStatus registerEventCallbackInternal( const std::shared_ptr& event_callback); - std::pair getCapabilitiesInternal(); + std::pair getCapabilitiesInternal(); std::pair, ndk::ScopedAStatus> getAvailableModesInternal(); ndk::ScopedAStatus configureChipInternal(std::unique_lock* lock, int32_t mode_id); @@ -214,13 +214,11 @@ class WifiChip : public BnWifiChip { ndk::ScopedAStatus setMultiStaPrimaryConnectionInternal(const std::string& ifname); ndk::ScopedAStatus setMultiStaUseCaseInternal(IWifiChip::MultiStaUseCase use_case); ndk::ScopedAStatus setCoexUnsafeChannelsInternal( - std::vector unsafe_channels, - CoexRestriction restrictions); + std::vector unsafe_channels, int32_t restrictions); ndk::ScopedAStatus setCountryCodeInternal(const std::array& in_code); std::pair, ndk::ScopedAStatus> getUsableChannelsInternal( - WifiBand band, WifiIfaceMode ifaceModeMask, UsableChannelFilter filterMask); - ndk::ScopedAStatus enableStaChannelForPeerNetworkInternal( - ChannelCategoryMask channelCategoryEnableFlag); + WifiBand band, int32_t ifaceModeMask, int32_t filterMask); + ndk::ScopedAStatus enableStaChannelForPeerNetworkInternal(int32_t channelCategoryEnableFlag); ndk::ScopedAStatus setAfcChannelAllowanceInternal( const std::vector& availableAfcFrequencyInfo); ndk::ScopedAStatus handleChipConfiguration(std::unique_lock* lock, diff --git a/wifi/aidl/default/wifi_sta_iface.cpp b/wifi/aidl/default/wifi_sta_iface.cpp index 300316aa07..eceeeb5c6b 100644 --- a/wifi/aidl/default/wifi_sta_iface.cpp +++ b/wifi/aidl/default/wifi_sta_iface.cpp @@ -82,8 +82,7 @@ ndk::ScopedAStatus WifiStaIface::registerEventCallback( &WifiStaIface::registerEventCallbackInternal, in_callback); } -ndk::ScopedAStatus WifiStaIface::getCapabilities( - IWifiStaIface::StaIfaceCapabilityMask* _aidl_return) { +ndk::ScopedAStatus WifiStaIface::getCapabilities(int32_t* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, &WifiStaIface::getCapabilitiesInternal, _aidl_return); } @@ -239,24 +238,20 @@ ndk::ScopedAStatus WifiStaIface::registerEventCallbackInternal( return ndk::ScopedAStatus::ok(); } -std::pair -WifiStaIface::getCapabilitiesInternal() { +std::pair WifiStaIface::getCapabilitiesInternal() { legacy_hal::wifi_error legacy_status; uint64_t legacy_feature_set; std::tie(legacy_status, legacy_feature_set) = legacy_hal_.lock()->getSupportedFeatureSet(ifname_); if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {IWifiStaIface::StaIfaceCapabilityMask{}, - createWifiStatusFromLegacyError(legacy_status)}; + return {0, createWifiStatusFromLegacyError(legacy_status)}; } uint32_t aidl_caps; if (!aidl_struct_util::convertLegacyFeaturesToAidlStaCapabilities(legacy_feature_set, &aidl_caps)) { - return {IWifiStaIface::StaIfaceCapabilityMask{}, - createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; + return {0, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; } - return {static_cast(aidl_caps), - ndk::ScopedAStatus::ok()}; + return {aidl_caps, ndk::ScopedAStatus::ok()}; } std::pair diff --git a/wifi/aidl/default/wifi_sta_iface.h b/wifi/aidl/default/wifi_sta_iface.h index 2e4403ad7e..0831e16416 100644 --- a/wifi/aidl/default/wifi_sta_iface.h +++ b/wifi/aidl/default/wifi_sta_iface.h @@ -54,8 +54,7 @@ class WifiStaIface : public BnWifiStaIface { ndk::ScopedAStatus getName(std::string* _aidl_return) override; ndk::ScopedAStatus registerEventCallback( const std::shared_ptr& in_callback) override; - ndk::ScopedAStatus getCapabilities( - IWifiStaIface::StaIfaceCapabilityMask* _aidl_return) override; + ndk::ScopedAStatus getCapabilities(int32_t* _aidl_return) override; ndk::ScopedAStatus getApfPacketFilterCapabilities( StaApfPacketFilterCapabilities* _aidl_return) override; ndk::ScopedAStatus installApfPacketFilter(const std::vector& in_program) override; @@ -99,7 +98,7 @@ class WifiStaIface : public BnWifiStaIface { std::pair getNameInternal(); ndk::ScopedAStatus registerEventCallbackInternal( const std::shared_ptr& callback); - std::pair getCapabilitiesInternal(); + std::pair getCapabilitiesInternal(); std::pair getApfPacketFilterCapabilitiesInternal(); ndk::ScopedAStatus installApfPacketFilterInternal(const std::vector& program); From cdf2ef0bac95c4e4cc9a855c38490e046599b708 Mon Sep 17 00:00:00 2001 From: Nate Jiang Date: Tue, 28 Feb 2023 16:51:02 -0800 Subject: [PATCH 783/998] Change the value of constant according to the spec Re-assign the value according to the Wifi Aware R4.0 section 9.5.21.1 Also correct several comments. Bug: 269440402 Test: build Change-Id: Ib3dd6365b2a28f871ec6ae3775ee8b9e9481475f --- .../hardware/wifi/NanCipherSuiteType.aidl | 4 ++-- .../wifi/NanBootstrappingConfirmInd.aidl | 2 +- .../hardware/wifi/NanBootstrappingRequest.aidl | 2 +- .../hardware/wifi/NanCipherSuiteType.aidl | 16 +++++++++++++--- .../wifi/NanSuspensionModeChangeInd.aidl | 2 +- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCipherSuiteType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCipherSuiteType.aidl index d1149c4a47..6f3158e670 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCipherSuiteType.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCipherSuiteType.aidl @@ -39,6 +39,6 @@ enum NanCipherSuiteType { SHARED_KEY_256_MASK = (1 << 1) /* 2 */, PUBLIC_KEY_2WDH_128_MASK = (1 << 2) /* 4 */, PUBLIC_KEY_2WDH_256_MASK = (1 << 3) /* 8 */, - PUBLIC_KEY_PASN_128_MASK = (1 << 4) /* 16 */, - PUBLIC_KEY_PASN_256_MASK = (1 << 5) /* 32 */, + PUBLIC_KEY_PASN_128_MASK = (1 << 6) /* 64 */, + PUBLIC_KEY_PASN_256_MASK = (1 << 7) /* 128 */, } diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl index 7d7a436b9e..f40f300aac 100644 --- a/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl +++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl @@ -44,7 +44,7 @@ parcelable NanBootstrappingConfirmInd { int comeBackDelay; /** - * Cookie received from the comeback response. + * Cookie received from peer with |comeBackDelay| for follow up |NanBootstrappingRequest| */ byte[] cookie; } diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl index 5297b9fda8..bb1d96655f 100644 --- a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl +++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl @@ -39,7 +39,7 @@ parcelable NanBootstrappingRequest { NanBootstrappingMethod requestBootstrappingMethod; /** - * Cookie for the follow up request + * Cookie received from previous |NanBootstrappingConfirmInd| for comeback request. */ byte[] cookie; } diff --git a/wifi/aidl/android/hardware/wifi/NanCipherSuiteType.aidl b/wifi/aidl/android/hardware/wifi/NanCipherSuiteType.aidl index 0d2fc99b2a..91b5cafedb 100644 --- a/wifi/aidl/android/hardware/wifi/NanCipherSuiteType.aidl +++ b/wifi/aidl/android/hardware/wifi/NanCipherSuiteType.aidl @@ -17,13 +17,19 @@ package android.hardware.wifi; /** - * Cipher suite flags. Wi-Fi Aware Specification 4.0 section 7.1.2 + * Cipher suite flags. Wi-Fi Aware Specification 4.0 section 9.5.21.1. */ @VintfStability @Backing(type="int") enum NanCipherSuiteType { NONE = 0, + /** + * NCS-SK-128 + */ SHARED_KEY_128_MASK = 1 << 0, + /** + * NCS-SK-256 + */ SHARED_KEY_256_MASK = 1 << 1, /** * NCS-PK-2WDH-128 @@ -33,12 +39,16 @@ enum NanCipherSuiteType { * NCS-PK-2WDH-256 */ PUBLIC_KEY_2WDH_256_MASK = 1 << 3, + /** + * bit 4 and bit 5 are reserved for NCS-GTK-CCMP-128 and NCS-GTK-CCMP-256. Which are not used + * from framework + */ /** * NCS-PK-PASN-128 */ - PUBLIC_KEY_PASN_128_MASK = 1 << 4, + PUBLIC_KEY_PASN_128_MASK = 1 << 6, /** * NCS-PK-PASN-256 */ - PUBLIC_KEY_PASN_256_MASK = 1 << 5, + PUBLIC_KEY_PASN_256_MASK = 1 << 7, } diff --git a/wifi/aidl/android/hardware/wifi/NanSuspensionModeChangeInd.aidl b/wifi/aidl/android/hardware/wifi/NanSuspensionModeChangeInd.aidl index afabe8c496..057e63b041 100644 --- a/wifi/aidl/android/hardware/wifi/NanSuspensionModeChangeInd.aidl +++ b/wifi/aidl/android/hardware/wifi/NanSuspensionModeChangeInd.aidl @@ -22,7 +22,7 @@ package android.hardware.wifi; @VintfStability parcelable NanSuspensionModeChangeInd { /** - * Indication whether the device has entered or existed the NAN suspension mode(deep sleep) + * Indication whether the device has entered or exited the NAN suspension mode(deep sleep) */ boolean isSuspended; } From ff9268b13b8384df47a6dfffafbdd03cac03d0fc Mon Sep 17 00:00:00 2001 From: Ayush Jain Date: Wed, 1 Mar 2023 22:57:12 +0000 Subject: [PATCH 784/998] Add a Vendor-dependent UCI Reason code for UWB OFF Add a UCI reason code (sent in a SESSION_STATUS_NTF) for the scenario when UWB needs to be turned off due to Regulatory reasons. Ran the "m android.hardware.uwb.fira_android-update-api" command to update the generated AIDL API. Bug: 267554906 Test: Compile make.com.google.android.uwb Change-Id: I52d9f2dae203c3e2d3d26a8a5c30a2f2a969b591 --- .../hardware/uwb/fira_android/UwbVendorReasonCodes.aidl | 1 + .../hardware/uwb/fira_android/UwbVendorReasonCodes.aidl | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl index dc2252b789..d1f12569b8 100644 --- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl @@ -35,4 +35,5 @@ package android.hardware.uwb.fira_android; @Backing(type="int") @VintfStability enum UwbVendorReasonCodes { REASON_ERROR_INVALID_CHANNEL_WITH_AOA = 128, + REASON_REGULATION_UWB_OFF = 129, } diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl index ae203a3112..a64a18884d 100644 --- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl +++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl @@ -24,11 +24,13 @@ package android.hardware.uwb.fira_android; @Backing(type="int") enum UwbVendorReasonCodes { /** - * Use values from the vendor specific reason code range: 0x80 – 0xFF defined in Table 16 of - * UCI specification. + * Use values from the vendor specific reason code range: 0x80 – 0xFF defined in + * Table 15 (state change with reason codes) of UCI specification. */ /** Fira specific */ /** The channel requested is not available for AoA */ REASON_ERROR_INVALID_CHANNEL_WITH_AOA = 0x80, + /** UWB has been disabled (eg: country code change leads to UWB unsupported) */ + REASON_REGULATION_UWB_OFF = 0x81, } From 7fba100202400790d7370a765996ce803c1c3a0d Mon Sep 17 00:00:00 2001 From: Anthony Stange Date: Thu, 2 Mar 2023 21:45:20 +0000 Subject: [PATCH 785/998] Refine ContextHub HAL API updates Makes the NAN session request / state updates a parceable to make it easier to add parameters to the APIs that use them over time. Fixes: 271435739 Test: presubmits Change-Id: I96592742095fd01a45c9fc245516304249b7434f --- .../hardware/contexthub/IContextHub.aidl | 4 +- .../contexthub/IContextHubCallback.aidl | 2 +- .../contexthub/NanSessionRequest.aidl | 38 +++++++++++++++++++ .../contexthub/NanSessionStateUpdate.aidl | 38 +++++++++++++++++++ .../hardware/contexthub/NanoappBinary.aidl | 6 +-- .../hardware/contexthub/IContextHub.aidl | 5 ++- .../contexthub/IContextHubCallback.aidl | 6 +-- .../contexthub/NanSessionRequest.aidl | 29 ++++++++++++++ .../contexthub/NanSessionStateUpdate.aidl | 28 ++++++++++++++ contexthub/aidl/default/ContextHub.cpp | 2 +- .../include/contexthub-impl/ContextHub.h | 2 +- .../vts/VtsAidlHalContextHubTargetTest.cpp | 21 +++++++--- 12 files changed, 163 insertions(+), 18 deletions(-) create mode 100644 contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanSessionRequest.aidl create mode 100644 contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanSessionStateUpdate.aidl create mode 100644 contexthub/aidl/android/hardware/contexthub/NanSessionRequest.aidl create mode 100644 contexthub/aidl/android/hardware/contexthub/NanSessionStateUpdate.aidl diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl index d66e1ac4d5..9f2eb767e1 100644 --- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl @@ -46,7 +46,7 @@ interface IContextHub { void onHostEndpointConnected(in android.hardware.contexthub.HostEndpointInfo hostEndpointInfo); void onHostEndpointDisconnected(char hostEndpointId); long[] getPreloadedNanoappIds(); - void onNanSessionStateChanged(in boolean state); + void onNanSessionStateChanged(in android.hardware.contexthub.NanSessionStateUpdate update); void setTestMode(in boolean enable); - const int EX_CONTEXT_HUB_UNSPECIFIED = (-1); + const int EX_CONTEXT_HUB_UNSPECIFIED = (-1) /* -1 */; } diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl index e72ae73147..6163cfc662 100644 --- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl @@ -38,6 +38,6 @@ interface IContextHubCallback { void handleContextHubMessage(in android.hardware.contexthub.ContextHubMessage msg, in String[] msgContentPerms); void handleContextHubAsyncEvent(in android.hardware.contexthub.AsyncEventType evt); void handleTransactionResult(in int transactionId, in boolean success); - void handleNanSessionRequest(in boolean enable); + void handleNanSessionRequest(in android.hardware.contexthub.NanSessionRequest request); const int CONTEXTHUB_NAN_TRANSACTION_TIMEOUT_MS = 10000; } diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanSessionRequest.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanSessionRequest.aidl new file mode 100644 index 0000000000..d539707ccc --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanSessionRequest.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.hardware.contexthub; +@VintfStability +parcelable NanSessionRequest { + boolean enable; +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanSessionStateUpdate.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanSessionStateUpdate.aidl new file mode 100644 index 0000000000..80771e2365 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanSessionStateUpdate.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.hardware.contexthub; +@VintfStability +parcelable NanSessionStateUpdate { + boolean state; +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl index 741a9cf0c9..fdf38601a9 100644 --- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl @@ -40,7 +40,7 @@ parcelable NanoappBinary { byte targetChreApiMajorVersion; byte targetChreApiMinorVersion; byte[] customBinary; - const int FLAG_SIGNED = (1 << 0); - const int FLAG_ENCRYPTED = (1 << 1); - const int FLAG_TCM_CAPABLE = (1 << 2); + const int FLAG_SIGNED = (1 << 0) /* 1 */; + const int FLAG_ENCRYPTED = (1 << 1) /* 2 */; + const int FLAG_TCM_CAPABLE = (1 << 2) /* 4 */; } diff --git a/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl index f9838bdb19..17bffd608f 100644 --- a/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl +++ b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl @@ -20,6 +20,7 @@ import android.hardware.contexthub.ContextHubInfo; import android.hardware.contexthub.ContextHubMessage; import android.hardware.contexthub.HostEndpointInfo; import android.hardware.contexthub.IContextHubCallback; +import android.hardware.contexthub.NanSessionStateUpdate; import android.hardware.contexthub.NanoappBinary; import android.hardware.contexthub.NanoappInfo; import android.hardware.contexthub.Setting; @@ -212,9 +213,9 @@ interface IContextHub { * explicitly invoke handleNanSessionRequest() at a later point in time to attempt to * re-enable NAN. * - * @param state True if the NAN session is currently enabled. + * @param update Information about the latest NAN session state. */ - void onNanSessionStateChanged(in boolean state); + void onNanSessionStateChanged(in NanSessionStateUpdate update); /** * Puts the context hub in and out of test mode. Test mode is a clean state diff --git a/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl b/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl index cff18935c3..bfcb51e589 100644 --- a/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl +++ b/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl @@ -18,6 +18,7 @@ package android.hardware.contexthub; import android.hardware.contexthub.AsyncEventType; import android.hardware.contexthub.ContextHubMessage; +import android.hardware.contexthub.NanSessionRequest; import android.hardware.contexthub.NanoappInfo; @VintfStability @@ -85,10 +86,9 @@ interface IContextHubCallback { * request times out, onNanSessionStateChanged() will be invoked with the state that the session * was previously in. * - * @param enable Whether the NAN session should be enabled or disabled depending on whether the - * Contexthub needs access to NAN. + * @param request Request from the HAL indicating the latest NAN session state it would like. */ - void handleNanSessionRequest(in boolean enable); + void handleNanSessionRequest(in NanSessionRequest request); /** * Amount of time, in milliseconds, that a handleNanSessionRequest can be pending before the diff --git a/contexthub/aidl/android/hardware/contexthub/NanSessionRequest.aidl b/contexthub/aidl/android/hardware/contexthub/NanSessionRequest.aidl new file mode 100644 index 0000000000..c462ba1112 --- /dev/null +++ b/contexthub/aidl/android/hardware/contexthub/NanSessionRequest.aidl @@ -0,0 +1,29 @@ +/* + * 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.hardware.contexthub; + +/** + * Contains information needed to request a state change for a NAN session. + */ +@VintfStability +parcelable NanSessionRequest { + /** + * Whether the NAN session should be enabled or disabled depending on whether the Contexthub + * needs access to NAN. + */ + boolean enable; +} diff --git a/contexthub/aidl/android/hardware/contexthub/NanSessionStateUpdate.aidl b/contexthub/aidl/android/hardware/contexthub/NanSessionStateUpdate.aidl new file mode 100644 index 0000000000..a58eda59b5 --- /dev/null +++ b/contexthub/aidl/android/hardware/contexthub/NanSessionStateUpdate.aidl @@ -0,0 +1,28 @@ +/* + * 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.hardware.contexthub; + +/** + * Contains information provided as a response to a NanSessionRequest. + */ +@VintfStability +parcelable NanSessionStateUpdate { + /** + * True if the NAN session is currently enabled. + */ + boolean state; +} diff --git a/contexthub/aidl/default/ContextHub.cpp b/contexthub/aidl/default/ContextHub.cpp index b98bfb26bd..66f9857532 100644 --- a/contexthub/aidl/default/ContextHub.cpp +++ b/contexthub/aidl/default/ContextHub.cpp @@ -87,7 +87,7 @@ ScopedAStatus ContextHub::getPreloadedNanoappIds(std::vector* out_prelo return ndk::ScopedAStatus::ok(); } -ScopedAStatus ContextHub::onNanSessionStateChanged(bool /*sin_state*/) { +ScopedAStatus ContextHub::onNanSessionStateChanged(const NanSessionStateUpdate& /*in_update*/) { return ndk::ScopedAStatus::ok(); } diff --git a/contexthub/aidl/default/include/contexthub-impl/ContextHub.h b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h index dc9aef0e01..02ecf53743 100644 --- a/contexthub/aidl/default/include/contexthub-impl/ContextHub.h +++ b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h @@ -48,7 +48,7 @@ class ContextHub : public BnContextHub { ::ndk::ScopedAStatus onHostEndpointConnected(const HostEndpointInfo& in_info) override; ::ndk::ScopedAStatus onHostEndpointDisconnected(char16_t in_hostEndpointId) override; - ::ndk::ScopedAStatus onNanSessionStateChanged(bool in_state) override; + ::ndk::ScopedAStatus onNanSessionStateChanged(const NanSessionStateUpdate& in_update) override; private: static constexpr uint32_t kMockHubId = 0; diff --git a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp index b227e4adef..9707ecf728 100644 --- a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp +++ b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp @@ -42,6 +42,8 @@ using ::android::hardware::contexthub::IContextHubCallbackDefault; using ::android::hardware::contexthub::NanoappBinary; using ::android::hardware::contexthub::NanoappInfo; using ::android::hardware::contexthub::NanoappRpcService; +using ::android::hardware::contexthub::NanSessionRequest; +using ::android::hardware::contexthub::NanSessionStateUpdate; using ::android::hardware::contexthub::Setting; using ::android::hardware::contexthub::vts_utils::kNonExistentAppId; using ::android::hardware::contexthub::vts_utils::waitForCallback; @@ -121,7 +123,9 @@ class EmptyContextHubCallback : public android::hardware::contexthub::BnContextH return Status::ok(); } - Status handleNanSessionRequest(bool /* enable */) override { return Status::ok(); } + Status handleNanSessionRequest(const NanSessionRequest& /* request */) override { + return Status::ok(); + } }; TEST_P(ContextHubAidl, TestRegisterCallback) { @@ -153,7 +157,9 @@ class QueryAppsCallback : public android::hardware::contexthub::BnContextHubCall return Status::ok(); } - Status handleNanSessionRequest(bool /* enable */) override { return Status::ok(); } + Status handleNanSessionRequest(const NanSessionRequest& /* request */) override { + return Status::ok(); + } std::promise> promise; }; @@ -218,7 +224,9 @@ class TransactionResultCallback : public android::hardware::contexthub::BnContex return Status::ok(); } - Status handleNanSessionRequest(bool /* enable */) override { return Status::ok(); } + Status handleNanSessionRequest(const NanSessionRequest& /* request */) override { + return Status::ok(); + } uint32_t expectedTransactionId = 0; std::promise promise; @@ -382,8 +390,11 @@ TEST_P(ContextHubAidl, TestInvalidHostConnection) { } TEST_P(ContextHubAidl, TestNanSessionStateChange) { - ASSERT_TRUE(contextHub->onNanSessionStateChanged(true /*state*/).isOk()); - ASSERT_TRUE(contextHub->onNanSessionStateChanged(false /*state*/).isOk()); + NanSessionStateUpdate update; + update.state = true; + ASSERT_TRUE(contextHub->onNanSessionStateChanged(update).isOk()); + update.state = false; + ASSERT_TRUE(contextHub->onNanSessionStateChanged(update).isOk()); } std::string PrintGeneratedTest(const testing::TestParamInfo& info) { From cc072f6859c9baaf7695077cf33c1a8413710629 Mon Sep 17 00:00:00 2001 From: Avinash Malipatil Date: Fri, 24 Feb 2023 10:06:07 +0000 Subject: [PATCH 786/998] Modified MediaDirection to provide more granular control over RTP and RTCP flow. Bug: 270657968 Test: Build Change-Id: Ic0a75dce6aaf7f9a25216d01243c69bbb44f1407 --- .../hardware/radio/ims/media/AmrMode.aidl | 18 ++++---- .../hardware/radio/ims/media/CodecType.aidl | 10 ++--- .../radio/ims/media/EvsBandwidth.aidl | 8 ++-- .../hardware/radio/ims/media/EvsMode.aidl | 42 +++++++++---------- .../radio/ims/media/MediaDirection.aidl | 8 ++-- .../ims/media/RtcpXrReportBlockType.aidl | 14 +++---- .../hardware/radio/ims/media/RtpConfig.aidl | 2 +- .../radio/ims/media/MediaDirection.aidl | 31 ++++++++++---- .../hardware/radio/ims/media/RtpConfig.aidl | 5 +-- radio/aidl/vts/radio_imsmedia_test.cpp | 32 +++++++++----- 10 files changed, 97 insertions(+), 73 deletions(-) diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl index 84376b7c96..37e3b256f3 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl @@ -34,13 +34,13 @@ package android.hardware.radio.ims.media; @Backing(type="int") @VintfStability enum AmrMode { - AMR_MODE_0 = (1 << 0), - AMR_MODE_1 = (1 << 1), - AMR_MODE_2 = (1 << 2), - AMR_MODE_3 = (1 << 3), - AMR_MODE_4 = (1 << 4), - AMR_MODE_5 = (1 << 5), - AMR_MODE_6 = (1 << 6), - AMR_MODE_7 = (1 << 7), - AMR_MODE_8 = (1 << 8), + AMR_MODE_0 = (1 << 0) /* 1 */, + AMR_MODE_1 = (1 << 1) /* 2 */, + AMR_MODE_2 = (1 << 2) /* 4 */, + AMR_MODE_3 = (1 << 3) /* 8 */, + AMR_MODE_4 = (1 << 4) /* 16 */, + AMR_MODE_5 = (1 << 5) /* 32 */, + AMR_MODE_6 = (1 << 6) /* 64 */, + AMR_MODE_7 = (1 << 7) /* 128 */, + AMR_MODE_8 = (1 << 8) /* 256 */, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl index 9eaf129d66..e4193cd6a2 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl @@ -34,9 +34,9 @@ package android.hardware.radio.ims.media; @Backing(type="int") @VintfStability enum CodecType { - AMR = (1 << 0), - AMR_WB = (1 << 1), - EVS = (1 << 2), - PCMA = (1 << 3), - PCMU = (1 << 4), + AMR = (1 << 0) /* 1 */, + AMR_WB = (1 << 1) /* 2 */, + EVS = (1 << 2) /* 4 */, + PCMA = (1 << 3) /* 8 */, + PCMU = (1 << 4) /* 16 */, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl index 5e80f9170a..db3eb2941a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl @@ -35,8 +35,8 @@ package android.hardware.radio.ims.media; @Backing(type="int") @VintfStability enum EvsBandwidth { NONE = 0, - NARROW_BAND = (1 << 0), - WIDE_BAND = (1 << 1), - SUPER_WIDE_BAND = (1 << 2), - FULL_BAND = (1 << 3), + NARROW_BAND = (1 << 0) /* 1 */, + WIDE_BAND = (1 << 1) /* 2 */, + SUPER_WIDE_BAND = (1 << 2) /* 4 */, + FULL_BAND = (1 << 3) /* 8 */, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl index a530a8d178..fb1f14da3a 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl @@ -34,25 +34,25 @@ package android.hardware.radio.ims.media; @Backing(type="int") @VintfStability enum EvsMode { - EVS_MODE_0 = (1 << 0), - EVS_MODE_1 = (1 << 1), - EVS_MODE_2 = (1 << 2), - EVS_MODE_3 = (1 << 3), - EVS_MODE_4 = (1 << 4), - EVS_MODE_5 = (1 << 5), - EVS_MODE_6 = (1 << 6), - EVS_MODE_7 = (1 << 7), - EVS_MODE_8 = (1 << 8), - EVS_MODE_9 = (1 << 9), - EVS_MODE_10 = (1 << 10), - EVS_MODE_11 = (1 << 11), - EVS_MODE_12 = (1 << 12), - EVS_MODE_13 = (1 << 13), - EVS_MODE_14 = (1 << 14), - EVS_MODE_15 = (1 << 15), - EVS_MODE_16 = (1 << 16), - EVS_MODE_17 = (1 << 17), - EVS_MODE_18 = (1 << 18), - EVS_MODE_19 = (1 << 19), - EVS_MODE_20 = (1 << 20), + EVS_MODE_0 = (1 << 0) /* 1 */, + EVS_MODE_1 = (1 << 1) /* 2 */, + EVS_MODE_2 = (1 << 2) /* 4 */, + EVS_MODE_3 = (1 << 3) /* 8 */, + EVS_MODE_4 = (1 << 4) /* 16 */, + EVS_MODE_5 = (1 << 5) /* 32 */, + EVS_MODE_6 = (1 << 6) /* 64 */, + EVS_MODE_7 = (1 << 7) /* 128 */, + EVS_MODE_8 = (1 << 8) /* 256 */, + EVS_MODE_9 = (1 << 9) /* 512 */, + EVS_MODE_10 = (1 << 10) /* 1024 */, + EVS_MODE_11 = (1 << 11) /* 2048 */, + EVS_MODE_12 = (1 << 12) /* 4096 */, + EVS_MODE_13 = (1 << 13) /* 8192 */, + EVS_MODE_14 = (1 << 14) /* 16384 */, + EVS_MODE_15 = (1 << 15) /* 32768 */, + EVS_MODE_16 = (1 << 16) /* 65536 */, + EVS_MODE_17 = (1 << 17) /* 131072 */, + EVS_MODE_18 = (1 << 18) /* 262144 */, + EVS_MODE_19 = (1 << 19) /* 524288 */, + EVS_MODE_20 = (1 << 20) /* 1048576 */, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl index d90b2a48b8..0e9eaee31b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl @@ -35,8 +35,8 @@ package android.hardware.radio.ims.media; @Backing(type="int") @VintfStability enum MediaDirection { NO_FLOW = 0, - SEND_ONLY = 1, - RECEIVE_ONLY = 2, - SEND_RECEIVE = 3, - INACTIVE = 4, + RTP_TX = (1 << 0) /* 1 */, + RTP_RX = (1 << 1) /* 2 */, + RTCP_TX = (1 << 2) /* 4 */, + RTCP_RX = (1 << 3) /* 8 */, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl index 06637540e9..289c810b87 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl @@ -35,11 +35,11 @@ package android.hardware.radio.ims.media; @Backing(type="int") @VintfStability enum RtcpXrReportBlockType { RTCPXR_NONE = 0, - RTCPXR_LOSS_RLE_REPORT_BLOCK = (1 << 0), - RTCPXR_DUPLICATE_RLE_REPORT_BLOCK = (1 << 1), - RTCPXR_PACKET_RECEIPT_TIMES_REPORT_BLOCK = (1 << 2), - RTCPXR_RECEIVER_REFERENCE_TIME_REPORT_BLOCK = (1 << 3), - RTCPXR_DLRR_REPORT_BLOCK = (1 << 4), - RTCPXR_STATISTICS_SUMMARY_REPORT_BLOCK = (1 << 5), - RTCPXR_VOIP_METRICS_REPORT_BLOCK = (1 << 6), + RTCPXR_LOSS_RLE_REPORT_BLOCK = (1 << 0) /* 1 */, + RTCPXR_DUPLICATE_RLE_REPORT_BLOCK = (1 << 1) /* 2 */, + RTCPXR_PACKET_RECEIPT_TIMES_REPORT_BLOCK = (1 << 2) /* 4 */, + RTCPXR_RECEIVER_REFERENCE_TIME_REPORT_BLOCK = (1 << 3) /* 8 */, + RTCPXR_DLRR_REPORT_BLOCK = (1 << 4) /* 16 */, + RTCPXR_STATISTICS_SUMMARY_REPORT_BLOCK = (1 << 5) /* 32 */, + RTCPXR_VOIP_METRICS_REPORT_BLOCK = (1 << 6) /* 64 */, } diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl index 1a8921e2dc..8a826f6b5f 100644 --- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl @@ -34,7 +34,7 @@ package android.hardware.radio.ims.media; @VintfStability parcelable RtpConfig { - android.hardware.radio.ims.media.MediaDirection direction; + int direction; android.hardware.radio.AccessNetwork accessNetwork; android.hardware.radio.ims.media.RtpAddress remoteAddress; android.hardware.radio.ims.media.RtpSessionParams sessionParams; diff --git a/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl b/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl index 9f04d8ecc7..e5c34c7c1b 100644 --- a/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl @@ -16,6 +16,17 @@ package android.hardware.radio.ims.media; +/** + * Directions can be combined to meet various media direction + * requirements depending on the scenario. + * + * Examples: + * No Flow : NO_FLOW - eg. SRVCC. + * RTCP-only : RTCP_TX | RTCP_RX - eg. Local Hold or Dual Hold. + * Receive-Only : RTP_RX | RTCP_TX | RTCP_RX - eg. Remote Hold. + * Send-Receive : RTP_TX | RTP_RX | RTCP_TX | RTCP_RX - eg. Active call. + * Send-Only : RTP_TX | RTCP_TX | RTCP_RX - eg. Simplex call, voice mail, etc + */ @VintfStability @Backing(type="int") enum MediaDirection { @@ -24,12 +35,16 @@ enum MediaDirection { * may release the audio resource. Eg. SRVCC. */ NO_FLOW = 0, - /** Device sends outgoing RTP and drops incoming RTP */ - SEND_ONLY = 1, - /** Device receives the downlink RTP and does not transmit any uplink RTP */ - RECEIVE_ONLY = 2, - /** Device sends and receive RTP in both directions */ - SEND_RECEIVE = 3, - /** No RTP flow however RTCP continues to flow. Eg. HOLD */ - INACTIVE = 4, + + /** Send RTP packets */ + RTP_TX = 1 << 0, + + /** Receive and processes RTP packets */ + RTP_RX = 1 << 1, + + /** Send RTCP packets */ + RTCP_TX = 1 << 2, + + /** Receive RTCP packets */ + RTCP_RX = 1 << 3, } diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl index f6696f782b..f93b1125aa 100644 --- a/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl +++ b/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl @@ -18,15 +18,14 @@ package android.hardware.radio.ims.media; import android.hardware.radio.AccessNetwork; import android.hardware.radio.ims.media.AnbrMode; -import android.hardware.radio.ims.media.MediaDirection; import android.hardware.radio.ims.media.RtcpConfig; import android.hardware.radio.ims.media.RtpAddress; import android.hardware.radio.ims.media.RtpSessionParams; @VintfStability parcelable RtpConfig { - /** Media flow direction */ - MediaDirection direction; + /** Media flow direction. The bitfield of MediaDirection(s) */ + int direction; /** Radio Access Network */ AccessNetwork accessNetwork; /** IP address and port number of the other party for RTP media */ diff --git a/radio/aidl/vts/radio_imsmedia_test.cpp b/radio/aidl/vts/radio_imsmedia_test.cpp index d9e57c9a63..2b6f5ef8b7 100644 --- a/radio/aidl/vts/radio_imsmedia_test.cpp +++ b/radio/aidl/vts/radio_imsmedia_test.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#include #include #include #include @@ -44,8 +45,10 @@ TEST_P(RadioImsMediaTest, MOCallSuccess) { int32_t sessionId = 1; RtpConfig modifyRtpConfig; - modifyRtpConfig.direction = - ::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE; + modifyRtpConfig.direction = static_cast(MediaDirection::RTP_TX) | + static_cast(MediaDirection::RTP_RX) | + static_cast(MediaDirection::RTCP_TX) | + static_cast(MediaDirection::RTCP_RX); modifyRtpConfig.remoteAddress.ipAddress = "122.22.22.33"; modifyRtpConfig.remoteAddress.portNumber = 1234; @@ -90,8 +93,10 @@ TEST_P(RadioImsMediaTest, testDtmfOperation) { int32_t duration = 200; RtpConfig modifyRtpConfig; - modifyRtpConfig.direction = - ::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE; + modifyRtpConfig.direction = static_cast(MediaDirection::RTP_TX) | + static_cast(MediaDirection::RTP_RX) | + static_cast(MediaDirection::RTCP_TX) | + static_cast(MediaDirection::RTCP_RX); modifyRtpConfig.remoteAddress.ipAddress = "122.22.22.33"; modifyRtpConfig.remoteAddress.portNumber = 1234; @@ -143,8 +148,10 @@ TEST_P(RadioImsMediaTest, sendHeaderExtension) { std::vector extensions; RtpConfig modifyRtpConfig; - modifyRtpConfig.direction = - ::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE; + modifyRtpConfig.direction = static_cast(MediaDirection::RTP_TX) | + static_cast(MediaDirection::RTP_RX) | + static_cast(MediaDirection::RTCP_TX) | + static_cast(MediaDirection::RTCP_RX); modifyRtpConfig.remoteAddress.ipAddress = "122.22.22.33"; modifyRtpConfig.remoteAddress.portNumber = 1234; @@ -190,8 +197,10 @@ TEST_P(RadioImsMediaTest, setMediaQualityThreshold) { MediaQualityThreshold threshold; RtpConfig modifyRtpConfig; - modifyRtpConfig.direction = - ::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE; + modifyRtpConfig.direction = static_cast(MediaDirection::RTP_TX) | + static_cast(MediaDirection::RTP_RX) | + static_cast(MediaDirection::RTCP_TX) | + static_cast(MediaDirection::RTCP_RX); modifyRtpConfig.remoteAddress.ipAddress = "122.22.22.33"; modifyRtpConfig.remoteAddress.portNumber = 1234; @@ -243,13 +252,14 @@ ndk::ScopedAStatus RadioImsMediaTest::triggerOpenSession(int32_t sessionId) { localEndPoint.rtcpFd = ndk::ScopedFileDescriptor(mRtcpSocketFd); localEndPoint.modemId = 1; - rtpConfig.direction = - ::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE; + rtpConfig.direction = static_cast(MediaDirection::RTP_TX) | + static_cast(MediaDirection::RTP_RX) | + static_cast(MediaDirection::RTCP_TX) | + static_cast(MediaDirection::RTCP_RX); rtpConfig.remoteAddress.ipAddress = "122.22.22.22"; rtpConfig.remoteAddress.portNumber = 2222; result = radio_imsmedia->openSession(sessionId, localEndPoint, rtpConfig); - return result; } From 9dd8c4882b79c60e0bcf769bba6505e147b604f8 Mon Sep 17 00:00:00 2001 From: ramindani Date: Tue, 21 Feb 2023 18:07:56 -0800 Subject: [PATCH 787/998] VTS for the Refresh rate callback debug enabled BUG: 202734676 Test: atest VtsHalGraphicsComposer3_TargetTest with the patch of Ibc80d66eae6b21c3cf84d35fa819e97ccc509ede Change-Id: I02bdf061420fe12ef4548008d66bb73e8cd416e8 --- .../aidl/vts/GraphicsComposerCallback.cpp | 33 ++- .../aidl/vts/GraphicsComposerCallback.h | 11 + .../composer/aidl/vts/VtsComposerClient.cpp | 35 +++- .../composer/aidl/vts/VtsComposerClient.h | 17 +- .../VtsHalGraphicsComposer3_TargetTest.cpp | 198 +++++++++++++++++- 5 files changed, 279 insertions(+), 15 deletions(-) diff --git a/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp b/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp index 4fb5d01249..7b3a2b431f 100644 --- a/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp +++ b/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp @@ -29,6 +29,11 @@ void GraphicsComposerCallback::setVsyncAllowed(bool allowed) { mVsyncAllowed = allowed; } +void GraphicsComposerCallback::setRefreshRateChangedDebugDataEnabledCallbackAllowed(bool allowed) { + std::scoped_lock lock(mMutex); + mRefreshRateChangedDebugDataEnabledCallbackAllowed = allowed; +} + std::vector GraphicsComposerCallback::getDisplays() const { std::scoped_lock lock(mMutex); return mDisplays; @@ -79,6 +84,21 @@ GraphicsComposerCallback::takeLastVsyncPeriodChangeTimeline() { return ret; } +std::vector +GraphicsComposerCallback::takeListOfRefreshRateChangedDebugData() { + std::scoped_lock lock(mMutex); + + std::vector ret; + ret.swap(mRefreshRateChangedDebugData); + + return ret; +} + +int32_t GraphicsComposerCallback::getInvalidRefreshRateDebugEnabledCallbackCount() const { + std::scoped_lock lock(mMutex); + return mInvalidRefreshRateDebugEnabledCallbackCount; +} + ::ndk::ScopedAStatus GraphicsComposerCallback::onHotplug(int64_t in_display, bool in_connected) { std::scoped_lock lock(mMutex); @@ -125,9 +145,16 @@ GraphicsComposerCallback::takeLastVsyncPeriodChangeTimeline() { } ::ndk::ScopedAStatus GraphicsComposerCallback::onRefreshRateChangedDebug( - const RefreshRateChangedDebugData&) { - // TODO(b/202734676) Add implementation for Vts tests - return ::ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); + const RefreshRateChangedDebugData& data) { + std::scoped_lock lock(mMutex); + + const auto it = std::find(mDisplays.begin(), mDisplays.end(), data.display); + if (mRefreshRateChangedDebugDataEnabledCallbackAllowed && it != mDisplays.end()) { + mRefreshRateChangedDebugData.push_back(data); + } else { + mInvalidRefreshRateDebugEnabledCallbackCount++; + } + return ::ndk::ScopedAStatus::ok(); } ::ndk::ScopedAStatus GraphicsComposerCallback::onVsyncPeriodTimingChanged( diff --git a/graphics/composer/aidl/vts/GraphicsComposerCallback.h b/graphics/composer/aidl/vts/GraphicsComposerCallback.h index 9c3bc70f73..13e992a4e1 100644 --- a/graphics/composer/aidl/vts/GraphicsComposerCallback.h +++ b/graphics/composer/aidl/vts/GraphicsComposerCallback.h @@ -26,6 +26,8 @@ class GraphicsComposerCallback : public BnComposerCallback { public: void setVsyncAllowed(bool allowed); + void setRefreshRateChangedDebugDataEnabledCallbackAllowed(bool allowed); + std::vector getDisplays() const; int32_t getInvalidHotplugCount() const; @@ -44,6 +46,10 @@ class GraphicsComposerCallback : public BnComposerCallback { std::optional takeLastVsyncPeriodChangeTimeline(); + std::vector takeListOfRefreshRateChangedDebugData(); + + int32_t getInvalidRefreshRateDebugEnabledCallbackCount() const; + private: virtual ::ndk::ScopedAStatus onHotplug(int64_t in_display, bool in_connected) override; virtual ::ndk::ScopedAStatus onRefresh(int64_t in_display) override; @@ -63,9 +69,13 @@ class GraphicsComposerCallback : public BnComposerCallback { std::vector mDisplays GUARDED_BY(mMutex); // true only when vsync is enabled bool mVsyncAllowed GUARDED_BY(mMutex) = true; + // true only when RefreshRateChangedCallbackDebugEnabled is set to true. + bool mRefreshRateChangedDebugDataEnabledCallbackAllowed GUARDED_BY(mMutex) = false; std::optional mTimeline GUARDED_BY(mMutex); + std::vector mRefreshRateChangedDebugData GUARDED_BY(mMutex); + int32_t mVsyncIdleCount GUARDED_BY(mMutex) = 0; int64_t mVsyncIdleTime GUARDED_BY(mMutex) = 0; @@ -75,6 +85,7 @@ class GraphicsComposerCallback : public BnComposerCallback { int32_t mInvalidVsyncCount GUARDED_BY(mMutex) = 0; int32_t mInvalidVsyncPeriodChangeCount GUARDED_BY(mMutex) = 0; int32_t mInvalidSeamlessPossibleCount GUARDED_BY(mMutex) = 0; + int32_t mInvalidRefreshRateDebugEnabledCallbackCount GUARDED_BY(mMutex) = 0; }; } // namespace aidl::android::hardware::graphics::composer3::vts diff --git a/graphics/composer/aidl/vts/VtsComposerClient.cpp b/graphics/composer/aidl/vts/VtsComposerClient.cpp index e03ef254c8..25b0ca0a17 100644 --- a/graphics/composer/aidl/vts/VtsComposerClient.cpp +++ b/graphics/composer/aidl/vts/VtsComposerClient.cpp @@ -119,6 +119,24 @@ ScopedAStatus VtsComposerClient::setActiveConfig(VtsDisplay* vtsDisplay, int32_t return updateDisplayProperties(vtsDisplay, config); } +ScopedAStatus VtsComposerClient::setPeakRefreshRateConfig(VtsDisplay* vtsDisplay) { + const auto displayId = vtsDisplay->getDisplayId(); + auto [activeStatus, activeConfig] = getActiveConfig(displayId); + EXPECT_TRUE(activeStatus.isOk()); + auto peakDisplayConfig = vtsDisplay->getDisplayConfig(activeConfig); + auto peakConfig = activeConfig; + + const auto displayConfigs = vtsDisplay->getDisplayConfigs(); + for (const auto [config, displayConfig] : displayConfigs) { + if (displayConfig.configGroup == peakDisplayConfig.configGroup && + displayConfig.vsyncPeriod < peakDisplayConfig.vsyncPeriod) { + peakDisplayConfig = displayConfig; + peakConfig = config; + } + } + return setActiveConfig(vtsDisplay, peakConfig); +} + std::pair VtsComposerClient::getDisplayAttribute( int64_t display, int32_t config, DisplayAttribute displayAttribute) { int32_t outDisplayAttribute; @@ -375,10 +393,15 @@ int64_t VtsComposerClient::getVsyncIdleTime() { return mComposerCallback->getVsyncIdleTime(); } -ndk::ScopedAStatus VtsComposerClient::setRefreshRateChangedCallbackDebugEnabled( - int64_t /* display */, bool /* enabled */) { - // TODO(b/202734676) Add implementation for VTS tests - return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); +ndk::ScopedAStatus VtsComposerClient::setRefreshRateChangedCallbackDebugEnabled(int64_t display, + bool enabled) { + mComposerCallback->setRefreshRateChangedDebugDataEnabledCallbackAllowed(enabled); + return mComposerClient->setRefreshRateChangedCallbackDebugEnabled(display, enabled); +} + +std::vector +VtsComposerClient::takeListOfRefreshRateChangedDebugData() { + return mComposerCallback->takeListOfRefreshRateChangedDebugData(); } int64_t VtsComposerClient::getInvalidDisplayId() { @@ -545,6 +568,10 @@ bool VtsComposerClient::verifyComposerCallbackParams() { ALOGE("Invalid seamless possible count"); isValid = false; } + if (mComposerCallback->getInvalidRefreshRateDebugEnabledCallbackCount() != 0) { + ALOGE("Invalid refresh rate debug enabled callback count"); + isValid = false; + } } return isValid; } diff --git a/graphics/composer/aidl/vts/VtsComposerClient.h b/graphics/composer/aidl/vts/VtsComposerClient.h index 81a62b372e..ea3318c2ce 100644 --- a/graphics/composer/aidl/vts/VtsComposerClient.h +++ b/graphics/composer/aidl/vts/VtsComposerClient.h @@ -77,6 +77,8 @@ class VtsComposerClient { ScopedAStatus setActiveConfig(VtsDisplay* vtsDisplay, int32_t config); + ScopedAStatus setPeakRefreshRateConfig(VtsDisplay* vtsDisplay); + std::pair getDisplayAttribute(int64_t display, int32_t config, DisplayAttribute displayAttribute); @@ -183,6 +185,10 @@ class VtsComposerClient { std::pair getOverlaySupport(); + ndk::ScopedAStatus setRefreshRateChangedCallbackDebugEnabled(int64_t display, bool enabled); + + std::vector takeListOfRefreshRateChangedDebugData(); + private: ScopedAStatus addDisplayConfig(VtsDisplay* vtsDisplay, int32_t config); ScopedAStatus updateDisplayProperties(VtsDisplay* vtsDisplay, int32_t config); @@ -197,9 +203,6 @@ class VtsComposerClient { bool verifyComposerCallbackParams(); - ndk::ScopedAStatus setRefreshRateChangedCallbackDebugEnabled(int64_t /* display */, - bool /* enabled */); - // Keep track of displays and layers. When a test fails/ends, // the VtsComposerClient::tearDown should be called from the // test tearDown to clean up the resources for the test. @@ -245,15 +248,17 @@ class VtsDisplay { }; void addDisplayConfig(int32_t config, DisplayConfig displayConfig) { - displayConfigs.insert({config, displayConfig}); + mDisplayConfigs.insert({config, displayConfig}); } - DisplayConfig getDisplayConfig(int32_t config) { return displayConfigs.find(config)->second; } + DisplayConfig getDisplayConfig(int32_t config) { return mDisplayConfigs.find(config)->second; } + + std::unordered_map getDisplayConfigs() { return mDisplayConfigs; } private: int64_t mDisplayId; int32_t mDisplayWidth; int32_t mDisplayHeight; - std::unordered_map displayConfigs; + std::unordered_map mDisplayConfigs; }; } // namespace aidl::android::hardware::graphics::composer3::vts diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 4974e71636..37576b958c 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -1217,6 +1217,14 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { } } + bool checkIfCallbackRefreshRateChangedDebugEnabledReceived( + std::function filter) { + const auto list = mComposerClient->takeListOfRefreshRateChangedDebugData(); + return std::any_of(list.begin(), list.end(), [&](auto refreshRateChangedDebugData) { + return filter(refreshRateChangedDebugData); + }); + } + sp allocate(::android::PixelFormat pixelFormat) { return sp::make( static_cast(getPrimaryDisplay().getDisplayWidth()), @@ -1316,7 +1324,7 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { return vsyncPeriod; } - int64_t createOnScreenLayer() { + int64_t createOnScreenLayer(Composition composition = Composition::DEVICE) { const auto& [status, layer] = mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); EXPECT_TRUE(status.isOk()); @@ -1324,12 +1332,25 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { getPrimaryDisplay().getDisplayHeight()}; FRect cropRect{0, 0, (float)getPrimaryDisplay().getDisplayWidth(), (float)getPrimaryDisplay().getDisplayHeight()}; - configureLayer(getPrimaryDisplay(), layer, Composition::DEVICE, displayFrame, cropRect); + configureLayer(getPrimaryDisplay(), layer, composition, displayFrame, cropRect); auto& writer = getWriter(getPrimaryDisplayId()); writer.setLayerDataspace(getPrimaryDisplayId(), layer, common::Dataspace::UNKNOWN); return layer; } + void sendBufferUpdate(int64_t layer) { + const auto buffer = allocate(::android::PIXEL_FORMAT_RGBA_8888); + ASSERT_NE(nullptr, buffer->handle); + + auto& writer = getWriter(getPrimaryDisplayId()); + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, buffer->handle, + /*acquireFence*/ -1); + + const sp<::android::Fence> presentFence = + presentAndGetFence(ComposerClientWriter::kNoTimestamp); + presentFence->waitForever(LOG_TAG); + } + bool hasDisplayCapability(int64_t display, DisplayCapability cap) { const auto& [status, capabilities] = mComposerClient->getDisplayCapabilities(display); EXPECT_TRUE(status.isOk()); @@ -2268,6 +2289,179 @@ TEST_P(GraphicsComposerAidlCommandTest, SetIdleTimerEnabled_Timeout_2) { EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::OFF).isOk()); } +TEST_P(GraphicsComposerAidlCommandTest, SetRefreshRateChangedCallbackDebug_Unsupported) { + if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) { + auto status = mComposerClient->setRefreshRateChangedCallbackDebugEnabled( + getPrimaryDisplayId(), /*enabled*/ true); + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE( + assertServiceSpecificError(status, IComposerClient::EX_UNSUPPORTED)); + + status = mComposerClient->setRefreshRateChangedCallbackDebugEnabled(getPrimaryDisplayId(), + /*enabled*/ false); + EXPECT_FALSE(status.isOk()); + EXPECT_NO_FATAL_FAILURE( + assertServiceSpecificError(status, IComposerClient::EX_UNSUPPORTED)); + } +} + +TEST_P(GraphicsComposerAidlCommandTest, SetRefreshRateChangedCallbackDebug_Enabled) { + if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) { + GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is not supported"; + return; + } + + const auto displayId = getPrimaryDisplayId(); + EXPECT_TRUE(mComposerClient->setPowerMode(displayId, PowerMode::ON).isOk()); + // Enable the callback + ASSERT_TRUE(mComposerClient + ->setRefreshRateChangedCallbackDebugEnabled(displayId, + /*enabled*/ true) + .isOk()); + std::this_thread::sleep_for(100ms); + + const bool isCallbackReceived = checkIfCallbackRefreshRateChangedDebugEnabledReceived( + [&](auto refreshRateChangedDebugData) { + return displayId == refreshRateChangedDebugData.display; + }); + + // Check that we immediately got a callback + EXPECT_TRUE(isCallbackReceived); + + ASSERT_TRUE(mComposerClient + ->setRefreshRateChangedCallbackDebugEnabled(displayId, + /*enabled*/ false) + .isOk()); +} + +TEST_P(GraphicsComposerAidlCommandTest, + SetRefreshRateChangedCallbackDebugEnabled_noCallbackWhenIdle) { + if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) { + GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is not supported"; + return; + } + + auto display = getEditablePrimaryDisplay(); + const auto displayId = display.getDisplayId(); + + if (!hasDisplayCapability(displayId, DisplayCapability::DISPLAY_IDLE_TIMER)) { + GTEST_SUCCEED() << "DisplayCapability::DISPLAY_IDLE_TIMER is not supported"; + return; + } + + EXPECT_TRUE(mComposerClient->setPowerMode(displayId, PowerMode::ON).isOk()); + EXPECT_TRUE(mComposerClient->setPeakRefreshRateConfig(&display).isOk()); + + ASSERT_TRUE(mComposerClient->setIdleTimerEnabled(displayId, /*timeoutMs*/ 500).isOk()); + // Enable the callback + ASSERT_TRUE(mComposerClient + ->setRefreshRateChangedCallbackDebugEnabled(displayId, + /*enabled*/ true) + .isOk()); + + const bool isCallbackReceived = checkIfCallbackRefreshRateChangedDebugEnabledReceived( + [&](auto refreshRateChangedDebugData) { + return displayId == refreshRateChangedDebugData.display; + }); + + int retryCount = 3; + do { + // Wait for 1s so that we enter the idle state + std::this_thread::sleep_for(1s); + if (!isCallbackReceived) { + // DID NOT receive a callback, we are in the idle state. + break; + } + } while (--retryCount > 0); + + if (retryCount == 0) { + GTEST_SUCCEED() << "Unable to enter the idle mode"; + return; + } + + // Send the REFRESH_RATE_INDICATOR update + ASSERT_NO_FATAL_FAILURE( + sendBufferUpdate(createOnScreenLayer(Composition::REFRESH_RATE_INDICATOR))); + std::this_thread::sleep_for(1s); + EXPECT_FALSE(isCallbackReceived) + << "A callback should not be received for REFRESH_RATE_INDICATOR"; + + EXPECT_TRUE(mComposerClient + ->setRefreshRateChangedCallbackDebugEnabled(displayId, + /*enabled*/ false) + .isOk()); +} + +TEST_P(GraphicsComposerAidlCommandTest, + SetRefreshRateChangedCallbackDebugEnabled_SetActiveConfigWithConstraints) { + if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) { + GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is not supported"; + return; + } + + VsyncPeriodChangeConstraints constraints; + constraints.seamlessRequired = false; + constraints.desiredTimeNanos = systemTime(); + + for (VtsDisplay& display : mDisplays) { + const auto displayId = display.getDisplayId(); + EXPECT_TRUE(mComposerClient->setPowerMode(displayId, PowerMode::ON).isOk()); + + // Enable the callback + ASSERT_TRUE(mComposerClient + ->setRefreshRateChangedCallbackDebugEnabled(displayId, /*enabled*/ true) + .isOk()); + + forEachTwoConfigs(displayId, [&](int32_t config1, int32_t config2) { + const int32_t vsyncPeriod1 = display.getDisplayConfig(config1).vsyncPeriod; + const int32_t vsyncPeriod2 = display.getDisplayConfig(config2).vsyncPeriod; + + if (vsyncPeriod1 == vsyncPeriod2) { + return; // continue + } + + EXPECT_TRUE(mComposerClient->setActiveConfig(&display, config1).isOk()); + sendRefreshFrame(display, nullptr); + + const auto& [status, timeline] = + mComposerClient->setActiveConfigWithConstraints(&display, config2, constraints); + EXPECT_TRUE(status.isOk()); + + if (timeline.refreshRequired) { + sendRefreshFrame(display, &timeline); + } + + const auto isCallbackReceived = checkIfCallbackRefreshRateChangedDebugEnabledReceived( + [&](auto refreshRateChangedDebugData) { + constexpr int kVsyncThreshold = 1000; + return displayId == refreshRateChangedDebugData.display && + std::abs(vsyncPeriod2 - + refreshRateChangedDebugData.vsyncPeriodNanos) <= + kVsyncThreshold; + }); + + int retryCount = 3; + do { + std::this_thread::sleep_for(100ms); + if (isCallbackReceived) { + GTEST_SUCCEED() << "Received a callback successfully"; + break; + } + } while (--retryCount > 0); + + if (retryCount == 0) { + GTEST_FAIL() << "failed to get a callback for the display " << displayId + << " with config " << config2; + } + }); + + EXPECT_TRUE( + mComposerClient + ->setRefreshRateChangedCallbackDebugEnabled(displayId, /*enabled*/ false) + .isOk()); + } +} + /* * Test that no two display configs are exactly the same. */ From e817aeb699b950149c13e6d4d6e8b40da48c4174 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Fri, 3 Mar 2023 00:38:43 +0000 Subject: [PATCH 788/998] Update comments to indicate whether NAN enums are used as an enum or a bitmask. Bug: 267819850 Test: m Change-Id: I6625d017a5563f82e87a2ee9300bb2d880b9242a --- wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl | 2 +- .../android/hardware/wifi/NanBootstrappingRequestInd.aidl | 2 +- .../aidl/android/hardware/wifi/NanDataPathSecurityConfig.aidl | 3 ++- wifi/aidl/android/hardware/wifi/NanPairingConfig.aidl | 3 ++- wifi/aidl/android/hardware/wifi/NanPairingSecurityConfig.aidl | 4 ++-- wifi/aidl/android/hardware/wifi/NpkSecurityAssociation.aidl | 4 ++-- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl index 4836612386..4b74cd9e20 100644 --- a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl +++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl @@ -37,7 +37,7 @@ parcelable NanBootstrappingRequest { byte[6] peerDiscMacAddr; /** - * Bootstrapping method in the request, one of the |NanBootstrappingMethod| + * One of |NanBootstrappingMethod| indicating the bootstrapping method in the request. */ NanBootstrappingMethod requestBootstrappingMethod; diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequestInd.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequestInd.aidl index 9094579fc3..6f43892bf2 100644 --- a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequestInd.aidl +++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequestInd.aidl @@ -48,7 +48,7 @@ parcelable NanBootstrappingRequestInd { int bootstrappingInstanceId; /** - * Bootstrapping method in the incoming request, one of the |NanBootstrappingMethod| + * One of |NanBootstrappingMethod| indicating the bootstrapping method in the incoming request. */ NanBootstrappingMethod requestBootstrappingMethod; } diff --git a/wifi/aidl/android/hardware/wifi/NanDataPathSecurityConfig.aidl b/wifi/aidl/android/hardware/wifi/NanDataPathSecurityConfig.aidl index 42a5616949..9a2013bf12 100644 --- a/wifi/aidl/android/hardware/wifi/NanDataPathSecurityConfig.aidl +++ b/wifi/aidl/android/hardware/wifi/NanDataPathSecurityConfig.aidl @@ -31,7 +31,8 @@ parcelable NanDataPathSecurityConfig { */ NanDataPathSecurityType securityType; /** - * Cipher type for data-paths. If |securityType| is |NanDataPathSecurityType.OPEN| then must + * One of |NanCipherSuiteType| indicating the cipher type for data-paths. + * If |securityType| is |NanDataPathSecurityType.OPEN|, then this must * be set to |NanCipherSuiteType.NONE|. Otherwise a non-|NanCipherSuiteType.NONE| cipher suite * must be specified. */ diff --git a/wifi/aidl/android/hardware/wifi/NanPairingConfig.aidl b/wifi/aidl/android/hardware/wifi/NanPairingConfig.aidl index 20122e2427..609dac2d96 100644 --- a/wifi/aidl/android/hardware/wifi/NanPairingConfig.aidl +++ b/wifi/aidl/android/hardware/wifi/NanPairingConfig.aidl @@ -34,7 +34,8 @@ parcelable NanPairingConfig { */ boolean enablePairingVerification; /** - * The set of supported bootstrapping methods. The |NanBootstrappingMethod| bit fields are used. + * Bitmap of |NanBootstrappingMethod| values indicating the set of + * supported bootstrapping methods. */ int supportedBootstrappingMethods; } diff --git a/wifi/aidl/android/hardware/wifi/NanPairingSecurityConfig.aidl b/wifi/aidl/android/hardware/wifi/NanPairingSecurityConfig.aidl index 7384e1a495..a601751d4f 100644 --- a/wifi/aidl/android/hardware/wifi/NanPairingSecurityConfig.aidl +++ b/wifi/aidl/android/hardware/wifi/NanPairingSecurityConfig.aidl @@ -49,8 +49,8 @@ parcelable NanPairingSecurityConfig { */ NanPairingAkm akm; /** - * Cipher type for pairing. Need to be one of the |NanCipherSuiteType.PUBLIC_KEY_PASN_128_MASK| - * or |NanCipherSuiteType.PUBLIC_KEY_PASN_256_MASK| + * Cipher type for pairing. Must be one of |NanCipherSuiteType.PUBLIC_KEY_PASN_128_MASK| + * or |NanCipherSuiteType.PUBLIC_KEY_PASN_256_MASK|. */ NanCipherSuiteType cipherType; } diff --git a/wifi/aidl/android/hardware/wifi/NpkSecurityAssociation.aidl b/wifi/aidl/android/hardware/wifi/NpkSecurityAssociation.aidl index 6d85eea369..4d65a41286 100644 --- a/wifi/aidl/android/hardware/wifi/NpkSecurityAssociation.aidl +++ b/wifi/aidl/android/hardware/wifi/NpkSecurityAssociation.aidl @@ -41,8 +41,8 @@ parcelable NpkSecurityAssociation { */ NanPairingAkm akm; /** - * Cipher type for pairing. Need to one of the |NanCipherSuiteType.PUBLIC_KEY_PASN_128_MASK| or - * |NanCipherSuiteType.PUBLIC_KEY_PASN_256_MASK| + * Cipher type for pairing. Must be one of |NanCipherSuiteType.PUBLIC_KEY_PASN_128_MASK| or + * |NanCipherSuiteType.PUBLIC_KEY_PASN_256_MASK|. */ NanCipherSuiteType cipherType; } From 86971aa04c233e9ea7969f0bf47e64d649ace391 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Fri, 3 Mar 2023 18:04:46 +0000 Subject: [PATCH 789/998] Convert NAN enums that are used as bitmaps to an int. Bug: 267819850 Test: atest VtsHalWifiNanIfaceTargetTest Change-Id: I6085c01fe6a7585fbdd8855bfdf183a75644ff80 --- .../android/hardware/wifi/NanCapabilities.aidl | 2 +- .../hardware/wifi/NanDiscoveryCommonConfig.aidl | 2 +- .../current/android/hardware/wifi/NanMatchInd.aidl | 2 +- .../aidl/android/hardware/wifi/NanCapabilities.aidl | 6 ++---- .../hardware/wifi/NanDiscoveryCommonConfig.aidl | 8 ++++---- wifi/aidl/android/hardware/wifi/NanMatchInd.aidl | 13 +++++++------ wifi/aidl/default/aidl_struct_util.cpp | 10 ++++------ 7 files changed, 20 insertions(+), 23 deletions(-) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl index bb44679ade..a30893a0c2 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCapabilities.aidl @@ -47,7 +47,7 @@ parcelable NanCapabilities { int maxAppInfoLen; int maxQueuedTransmitFollowupMsgs; int maxSubscribeInterfaceAddresses; - android.hardware.wifi.NanCipherSuiteType supportedCipherSuites; + int supportedCipherSuites; boolean instantCommunicationModeSupportFlag; boolean supports6g; boolean supportsHe; diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDiscoveryCommonConfig.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDiscoveryCommonConfig.aidl index e84cabfdf9..96d940ae31 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDiscoveryCommonConfig.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanDiscoveryCommonConfig.aidl @@ -51,7 +51,7 @@ parcelable NanDiscoveryCommonConfig { android.hardware.wifi.NanDataPathSecurityConfig securityConfig; boolean rangingRequired; int rangingIntervalMs; - android.hardware.wifi.NanRangingIndication configRangingIndications; + int configRangingIndications; char distanceIngressCm; char distanceEgressCm; boolean enableSessionSuspendability; diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchInd.aidl index 6757bec8ba..317489f223 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchInd.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanMatchInd.aidl @@ -47,7 +47,7 @@ parcelable NanMatchInd { boolean peerRequiresSecurityEnabledInNdp; boolean peerRequiresRanging; int rangingMeasurementInMm; - android.hardware.wifi.NanRangingIndication rangingIndicationType; + int rangingIndicationType; byte[] scid; android.hardware.wifi.NanPairingConfig peerPairingConfig; android.hardware.wifi.NanIdentityResolutionAttribute peerNira; diff --git a/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl b/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl index c1d6201299..f581c5e6cf 100644 --- a/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl +++ b/wifi/aidl/android/hardware/wifi/NanCapabilities.aidl @@ -16,8 +16,6 @@ package android.hardware.wifi; -import android.hardware.wifi.NanCipherSuiteType; - /** * NDP Capabilities response. */ @@ -78,9 +76,9 @@ parcelable NanCapabilities { */ int maxSubscribeInterfaceAddresses; /** - * The set of supported Cipher suites. The |NanCipherSuiteType| bit fields are used. + * Bitmap of |NanCipherSuiteType| values indicating the set of supported cipher suites. */ - NanCipherSuiteType supportedCipherSuites; + int supportedCipherSuites; /** * Flag to indicate if instant communication mode is supported. */ diff --git a/wifi/aidl/android/hardware/wifi/NanDiscoveryCommonConfig.aidl b/wifi/aidl/android/hardware/wifi/NanDiscoveryCommonConfig.aidl index e98658b012..58777c5d65 100644 --- a/wifi/aidl/android/hardware/wifi/NanDiscoveryCommonConfig.aidl +++ b/wifi/aidl/android/hardware/wifi/NanDiscoveryCommonConfig.aidl @@ -18,7 +18,6 @@ package android.hardware.wifi; import android.hardware.wifi.NanDataPathSecurityConfig; import android.hardware.wifi.NanMatchAlg; -import android.hardware.wifi.NanRangingIndication; /** * Configurations of NAN discovery sessions. Common to publish and subscribe discovery. @@ -143,10 +142,11 @@ parcelable NanDiscoveryCommonConfig { */ int rangingIntervalMs; /** - * The type of ranging feedback to be provided by discovery session matches - * |IWifiNanIfaceEventCallback.eventMatch|. Only relevant if |rangingRequired| is true. + * Bitmap of |NanRangingIndication| values indicating the type of ranging feedback + * to be provided by discovery session matches in |IWifiNanIfaceEventCallback.eventMatch|. + * Only relevant if |rangingRequired| is true. */ - NanRangingIndication configRangingIndications; + int configRangingIndications; /** * The ingress and egress distance in cm. If ranging is enabled (|rangingEnabled| is true) then * |configRangingIndications| is used to determine whether ingress and/or egress (or neither) diff --git a/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl b/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl index 314d59922a..5a04376c75 100644 --- a/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl +++ b/wifi/aidl/android/hardware/wifi/NanMatchInd.aidl @@ -19,7 +19,6 @@ package android.hardware.wifi; import android.hardware.wifi.NanCipherSuiteType; import android.hardware.wifi.NanIdentityResolutionAttribute; import android.hardware.wifi.NanPairingConfig; -import android.hardware.wifi.NanRangingIndication; /** * Match indication structure. @@ -81,8 +80,9 @@ parcelable NanMatchInd { */ byte rssiValue; /** - * Cipher type for data-paths constructed in the context of this discovery session. Valid if - * |peerRequiresSecurityEnabledInNdp| is true. + * One of |NanCipherSuiteType| indicating the cipher type for data-paths constructed + * in the context of this discovery session. + * Valid if |peerRequiresSecurityEnabledInNdp| is true. */ NanCipherSuiteType peerCipherType; /** @@ -117,10 +117,11 @@ parcelable NanMatchInd { */ int rangingMeasurementInMm; /** - * The ranging event(s) which triggered the ranging. e.g. can indicate that continuous ranging - * was requested, or else that an ingress event occurred. + * Bitmap of |NanRangingIndication| values indicating the ranging event(s) which triggered the + * ranging. e.g. can indicate that continuous ranging was requested, or else that an ingress + * event occurred. */ - NanRangingIndication rangingIndicationType; + int rangingIndicationType; /** * Security Context Identifier attribute contains PMKID. Shall be included in NDP setup and * response messages. Security Context Identifier identifies the Security Context. For NAN diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index 5bfdcbb408..fc90d7e543 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -1787,7 +1787,7 @@ bool convertAidlNanPublishRequestToLegacy(const NanPublishRequest& aidl_request, : legacy_hal::NAN_RANGING_DISABLE; legacy_request->ranging_cfg.ranging_interval_msec = aidl_request.baseConfigs.rangingIntervalMs; legacy_request->ranging_cfg.config_ranging_indications = - static_cast(aidl_request.baseConfigs.configRangingIndications); + aidl_request.baseConfigs.configRangingIndications; legacy_request->ranging_cfg.distance_ingress_mm = aidl_request.baseConfigs.distanceIngressCm * 10; legacy_request->ranging_cfg.distance_egress_mm = aidl_request.baseConfigs.distanceEgressCm * 10; @@ -1919,7 +1919,7 @@ bool convertAidlNanSubscribeRequestToLegacy(const NanSubscribeRequest& aidl_requ : legacy_hal::NAN_RANGING_DISABLE; legacy_request->ranging_cfg.ranging_interval_msec = aidl_request.baseConfigs.rangingIntervalMs; legacy_request->ranging_cfg.config_ranging_indications = - static_cast(aidl_request.baseConfigs.configRangingIndications); + aidl_request.baseConfigs.configRangingIndications; legacy_request->ranging_cfg.distance_ingress_mm = aidl_request.baseConfigs.distanceIngressCm * 10; legacy_request->ranging_cfg.distance_egress_mm = aidl_request.baseConfigs.distanceEgressCm * 10; @@ -2202,8 +2202,7 @@ bool convertLegacyNanCapabilitiesResponseToAidl(const legacy_hal::NanCapabilitie aidl_response->maxQueuedTransmitFollowupMsgs = legacy_response.max_queued_transmit_followup_msgs; aidl_response->maxSubscribeInterfaceAddresses = legacy_response.max_subscribe_address; - aidl_response->supportedCipherSuites = - static_cast(legacy_response.cipher_suites_supported); + aidl_response->supportedCipherSuites = legacy_response.cipher_suites_supported; aidl_response->instantCommunicationModeSupportFlag = legacy_response.is_instant_mode_supported; aidl_response->supports6g = legacy_response.is_6g_supported; aidl_response->supportsHe = legacy_response.is_he_supported; @@ -2244,8 +2243,7 @@ bool convertLegacyNanMatchIndToAidl(const legacy_hal::NanMatchInd& legacy_ind, aidl_ind->peerRequiresRanging = legacy_ind.peer_sdea_params.ranging_state == legacy_hal::NAN_RANGING_ENABLE; aidl_ind->rangingMeasurementInMm = legacy_ind.range_info.range_measurement_mm; - aidl_ind->rangingIndicationType = - static_cast(legacy_ind.range_info.ranging_event_type); + aidl_ind->rangingIndicationType = legacy_ind.range_info.ranging_event_type; aidl_ind->scid = std::vector(legacy_ind.scid, legacy_ind.scid + legacy_ind.scid_len); if (!convertLegacyNiraToAidl(legacy_ind.nira, &aidl_ind->peerNira)) { From 9151889d5761cf817ee879474bd1c3b2f2e94fda Mon Sep 17 00:00:00 2001 From: ramindani Date: Fri, 3 Mar 2023 16:55:09 +0000 Subject: [PATCH 790/998] [VTS] change the bool to lambda BUG: 202734676 Test: atest VtsHalGraphicsComposer3_TargetTest Change-Id: I5611cd8a6cc23491621470d6457e2bfc859fde4e --- .../VtsHalGraphicsComposer3_TargetTest.cpp | 37 +++++++++---------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 37576b958c..1ecd4059a0 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -2320,13 +2320,12 @@ TEST_P(GraphicsComposerAidlCommandTest, SetRefreshRateChangedCallbackDebug_Enabl .isOk()); std::this_thread::sleep_for(100ms); - const bool isCallbackReceived = checkIfCallbackRefreshRateChangedDebugEnabledReceived( - [&](auto refreshRateChangedDebugData) { - return displayId == refreshRateChangedDebugData.display; - }); + const auto displayFilter = [displayId](auto refreshRateChangedDebugData) { + return displayId == refreshRateChangedDebugData.display; + }; // Check that we immediately got a callback - EXPECT_TRUE(isCallbackReceived); + EXPECT_TRUE(checkIfCallbackRefreshRateChangedDebugEnabledReceived(displayFilter)); ASSERT_TRUE(mComposerClient ->setRefreshRateChangedCallbackDebugEnabled(displayId, @@ -2359,16 +2358,15 @@ TEST_P(GraphicsComposerAidlCommandTest, /*enabled*/ true) .isOk()); - const bool isCallbackReceived = checkIfCallbackRefreshRateChangedDebugEnabledReceived( - [&](auto refreshRateChangedDebugData) { - return displayId == refreshRateChangedDebugData.display; - }); + const auto displayFilter = [displayId](auto refreshRateChangedDebugData) { + return displayId == refreshRateChangedDebugData.display; + }; int retryCount = 3; do { // Wait for 1s so that we enter the idle state std::this_thread::sleep_for(1s); - if (!isCallbackReceived) { + if (!checkIfCallbackRefreshRateChangedDebugEnabledReceived(displayFilter)) { // DID NOT receive a callback, we are in the idle state. break; } @@ -2383,7 +2381,7 @@ TEST_P(GraphicsComposerAidlCommandTest, ASSERT_NO_FATAL_FAILURE( sendBufferUpdate(createOnScreenLayer(Composition::REFRESH_RATE_INDICATOR))); std::this_thread::sleep_for(1s); - EXPECT_FALSE(isCallbackReceived) + EXPECT_FALSE(checkIfCallbackRefreshRateChangedDebugEnabledReceived(displayFilter)) << "A callback should not be received for REFRESH_RATE_INDICATOR"; EXPECT_TRUE(mComposerClient @@ -2431,19 +2429,18 @@ TEST_P(GraphicsComposerAidlCommandTest, sendRefreshFrame(display, &timeline); } - const auto isCallbackReceived = checkIfCallbackRefreshRateChangedDebugEnabledReceived( - [&](auto refreshRateChangedDebugData) { - constexpr int kVsyncThreshold = 1000; - return displayId == refreshRateChangedDebugData.display && - std::abs(vsyncPeriod2 - - refreshRateChangedDebugData.vsyncPeriodNanos) <= - kVsyncThreshold; - }); + const auto callbackFilter = [displayId, + vsyncPeriod2](auto refreshRateChangedDebugData) { + constexpr int kVsyncThreshold = 1000; + return displayId == refreshRateChangedDebugData.display && + std::abs(vsyncPeriod2 - refreshRateChangedDebugData.vsyncPeriodNanos) <= + kVsyncThreshold; + }; int retryCount = 3; do { std::this_thread::sleep_for(100ms); - if (isCallbackReceived) { + if (checkIfCallbackRefreshRateChangedDebugEnabledReceived(callbackFilter)) { GTEST_SUCCEED() << "Received a callback successfully"; break; } From 678e42f76b6ff98b53c96d2367db3b86d6347d07 Mon Sep 17 00:00:00 2001 From: Henry Fang Date: Fri, 3 Mar 2023 23:52:29 +0000 Subject: [PATCH 791/998] Change for HAL's committee's feedback from http://ag/21528528 Change-Id: Id0db0e05ed812a783f0377412ba91997ce22b08a bug: 239228238 --- cas/aidl/android/hardware/cas/DestinationBuffer.aidl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cas/aidl/android/hardware/cas/DestinationBuffer.aidl b/cas/aidl/android/hardware/cas/DestinationBuffer.aidl index 74336c2a43..ac562dc131 100644 --- a/cas/aidl/android/hardware/cas/DestinationBuffer.aidl +++ b/cas/aidl/android/hardware/cas/DestinationBuffer.aidl @@ -25,13 +25,13 @@ import android.hardware.common.NativeHandle; @VintfStability union DestinationBuffer { /** - * If type == SHARED_MEMORY, the descrambled data must be written + * If the buffer is SharedBuffer, the descrambled data must be written * to user-space non-secure shared memory. */ SharedBuffer nonsecureMemory; /** - * If type == NATIVE_HANDLE, the descrambled data must be written + * If the buffer is presented by NativeHandle, the descrambled data must be written * to secure memory referenced by the vendor's buffer allocator. */ NativeHandle secureMemory; From 89e5fc4f5dda05168a36ace84fbb84add0d3fcad Mon Sep 17 00:00:00 2001 From: Thomas Nguyen Date: Wed, 1 Mar 2023 03:58:40 +0000 Subject: [PATCH 792/998] DO NOT MERGE Revert "Add Satellite HAL APIs" Revert submission 20583557-Satellite APIs Reason for revert: We need to revert these changes for U Reverted changes: /q/submissionid:20583557-Satellite+APIs Bug: 271297374 Test: Call and SMS/MMS with live network. atest TelephonyManagerTestOnMockModem atest VtsHalRadioTargetTest atest com.android.cellbroadcastreceiver.compliancetests.CellBroadcastConfigTest atest android.telephony.cts.TelephonyManagerTest atest android.telephony.cts.SatelliteManagerTest Change-Id: I7ada8e72d77543f1ac03b267d61e8fd037ec3708 --- .../compatibility_matrix.8.xml | 10 - radio/aidl/Android.bp | 16 - .../radio/satellite/IRadioSatellite.aidl | 53 -- .../satellite/IRadioSatelliteIndication.aidl | 44 -- .../satellite/IRadioSatelliteResponse.aidl | 52 -- .../radio/satellite/IndicationFilter.aidl | 39 -- .../radio/satellite/NTRadioTechnology.aidl | 41 -- .../radio/satellite/PointingInfo.aidl | 42 -- .../satellite/SatelliteCapabilities.aidl | 42 -- .../radio/satellite/SatelliteFeature.aidl | 41 -- .../radio/satellite/SatelliteMode.aidl | 42 -- .../hardware/radio/RadioAccessFamily.aidl | 42 +- .../android/hardware/radio/RadioConst.aidl | 2 +- .../android/hardware/radio/RadioError.aidl | 11 - .../android/hardware/radio/RadioError.aidl | 47 -- .../radio/satellite/IRadioSatellite.aidl | 168 ----- .../satellite/IRadioSatelliteIndication.aidl | 90 --- .../satellite/IRadioSatelliteResponse.aidl | 461 ------------- .../radio/satellite/IndicationFilter.aidl | 25 - .../radio/satellite/NTRadioTechnology.aidl | 31 - .../radio/satellite/PointingInfo.aidl | 42 -- .../satellite/SatelliteCapabilities.aidl | 50 -- .../radio/satellite/SatelliteFeature.aidl | 31 - .../radio/satellite/SatelliteMode.aidl | 33 - radio/aidl/compat/libradiocompat/Android.bp | 4 - .../include/libradiocompat/RadioIndication.h | 10 - .../include/libradiocompat/RadioResponse.h | 9 - .../include/libradiocompat/RadioSatellite.h | 65 -- .../satellite/RadioIndication-satellite.cpp | 39 -- .../satellite/RadioResponse-satellite.cpp | 39 -- .../satellite/RadioSatellite.cpp | 128 ---- radio/aidl/compat/service/Android.bp | 1 - radio/aidl/vts/Android.bp | 4 - radio/aidl/vts/VtsHalRadioTargetTest.cpp | 7 - radio/aidl/vts/radio_aidl_hal_utils.h | 2 - radio/aidl/vts/radio_satellite_indication.cpp | 56 -- radio/aidl/vts/radio_satellite_response.cpp | 120 ---- radio/aidl/vts/radio_satellite_test.cpp | 626 ------------------ radio/aidl/vts/radio_satellite_utils.h | 126 ---- 39 files changed, 22 insertions(+), 2669 deletions(-) delete mode 100644 radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatellite.aidl delete mode 100644 radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatelliteIndication.aidl delete mode 100644 radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatelliteResponse.aidl delete mode 100644 radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IndicationFilter.aidl delete mode 100644 radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/NTRadioTechnology.aidl delete mode 100644 radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/PointingInfo.aidl delete mode 100644 radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteCapabilities.aidl delete mode 100644 radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteFeature.aidl delete mode 100644 radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteMode.aidl delete mode 100644 radio/aidl/android/hardware/radio/satellite/IRadioSatellite.aidl delete mode 100644 radio/aidl/android/hardware/radio/satellite/IRadioSatelliteIndication.aidl delete mode 100644 radio/aidl/android/hardware/radio/satellite/IRadioSatelliteResponse.aidl delete mode 100644 radio/aidl/android/hardware/radio/satellite/IndicationFilter.aidl delete mode 100644 radio/aidl/android/hardware/radio/satellite/NTRadioTechnology.aidl delete mode 100644 radio/aidl/android/hardware/radio/satellite/PointingInfo.aidl delete mode 100644 radio/aidl/android/hardware/radio/satellite/SatelliteCapabilities.aidl delete mode 100644 radio/aidl/android/hardware/radio/satellite/SatelliteFeature.aidl delete mode 100644 radio/aidl/android/hardware/radio/satellite/SatelliteMode.aidl delete mode 100644 radio/aidl/compat/libradiocompat/include/libradiocompat/RadioSatellite.h delete mode 100644 radio/aidl/compat/libradiocompat/satellite/RadioIndication-satellite.cpp delete mode 100644 radio/aidl/compat/libradiocompat/satellite/RadioResponse-satellite.cpp delete mode 100644 radio/aidl/compat/libradiocompat/satellite/RadioSatellite.cpp delete mode 100644 radio/aidl/vts/radio_satellite_indication.cpp delete mode 100644 radio/aidl/vts/radio_satellite_response.cpp delete mode 100644 radio/aidl/vts/radio_satellite_test.cpp delete mode 100644 radio/aidl/vts/radio_satellite_utils.h diff --git a/compatibility_matrices/compatibility_matrix.8.xml b/compatibility_matrices/compatibility_matrix.8.xml index d4fca6a85e..c58f559c2b 100644 --- a/compatibility_matrices/compatibility_matrix.8.xml +++ b/compatibility_matrices/compatibility_matrix.8.xml @@ -499,16 +499,6 @@ slot3 - - android.hardware.radio.satellite - 1 - - IRadioSatellite - slot1 - slot2 - slot3 - - android.hardware.radio.ims.media 1 diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp index dfccb4c4d9..e8cebd76d1 100644 --- a/radio/aidl/Android.bp +++ b/radio/aidl/Android.bp @@ -262,19 +262,3 @@ aidl_interface { }, }, } - -aidl_interface { - name: "android.hardware.radio.satellite", - vendor_available: true, - srcs: ["android/hardware/radio/satellite/*.aidl"], - stability: "vintf", - imports: ["android.hardware.radio-V2"], - backend: { - cpp: { - enabled: false, - }, - java: { - sdk_version: "module_current", - }, - }, -} diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatellite.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatellite.aidl deleted file mode 100644 index a00e4f5ed0..0000000000 --- a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatellite.aidl +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.radio.satellite; -@VintfStability -interface IRadioSatellite { - oneway void addAllowedSatelliteContacts(in int serial, in String[] contacts); - oneway void getCapabilities(in int serial); - oneway void getMaxCharactersPerTextMessage(in int serial); - oneway void getPendingMessages(in int serial); - oneway void getPowerState(in int serial); - oneway void getSatelliteMode(in int serial); - oneway void getTimeForNextSatelliteVisibility(in int serial); - oneway void provisionService(in int serial, in String imei, in String msisdn, in String imsi, in android.hardware.radio.satellite.SatelliteFeature[] features); - oneway void removeAllowedSatelliteContacts(in int serial, in String[] contacts); - oneway void responseAcknowledgement(); - oneway void sendMessages(in int serial, in String[] messages, in String destination, in double latitude, in double longitude); - oneway void setIndicationFilter(in int serial, in int filterBitmask); - oneway void setPower(in int serial, in boolean on); - oneway void setResponseFunctions(in android.hardware.radio.satellite.IRadioSatelliteResponse satelliteResponse, in android.hardware.radio.satellite.IRadioSatelliteIndication satelliteIndication); - oneway void startSendingSatellitePointingInfo(in int serial); - oneway void stopSendingSatellitePointingInfo(in int serial); -} diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatelliteIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatelliteIndication.aidl deleted file mode 100644 index 6a03f266b9..0000000000 --- a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatelliteIndication.aidl +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.radio.satellite; -@VintfStability -interface IRadioSatelliteIndication { - oneway void onMessagesTransferComplete(in android.hardware.radio.RadioIndicationType type, in boolean complete); - oneway void onNewMessages(in android.hardware.radio.RadioIndicationType type, in String[] messages); - oneway void onPendingMessageCount(in android.hardware.radio.RadioIndicationType type, in int count); - oneway void onProvisionStateChanged(in android.hardware.radio.RadioIndicationType type, boolean provisioned, in android.hardware.radio.satellite.SatelliteFeature[] features); - oneway void onSatelliteModeChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.satellite.SatelliteMode mode); - oneway void onSatellitePointingInfoChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.satellite.PointingInfo pointingInfo); - oneway void onSatelliteRadioTechnologyChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.satellite.NTRadioTechnology technology); -} diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatelliteResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatelliteResponse.aidl deleted file mode 100644 index f6614b1b4f..0000000000 --- a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IRadioSatelliteResponse.aidl +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.radio.satellite; -@VintfStability -interface IRadioSatelliteResponse { - oneway void acknowledgeRequest(in int serial); - oneway void addAllowedSatelliteContactsResponse(in android.hardware.radio.RadioResponseInfo info); - oneway void getCapabilitiesResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.satellite.SatelliteCapabilities capabilities); - oneway void getMaxCharactersPerTextMessageResponse(in android.hardware.radio.RadioResponseInfo info, in int charLimit); - oneway void getPendingMessagesResponse(in android.hardware.radio.RadioResponseInfo info, in String[] messages); - oneway void getPowerStateResponse(in android.hardware.radio.RadioResponseInfo info, in boolean on); - oneway void getSatelliteModeResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.satellite.SatelliteMode mode, in android.hardware.radio.satellite.NTRadioTechnology technology); - oneway void getTimeForNextSatelliteVisibilityResponse(in android.hardware.radio.RadioResponseInfo info, in int timeInSeconds); - oneway void provisionServiceResponse(in android.hardware.radio.RadioResponseInfo info, in boolean provisioned); - oneway void removeAllowedSatelliteContactsResponse(in android.hardware.radio.RadioResponseInfo info); - oneway void sendMessagesResponse(in android.hardware.radio.RadioResponseInfo info); - oneway void setIndicationFilterResponse(in android.hardware.radio.RadioResponseInfo info); - oneway void setPowerResponse(in android.hardware.radio.RadioResponseInfo info); - oneway void startSendingSatellitePointingInfoResponse(in android.hardware.radio.RadioResponseInfo info); - oneway void stopSendingSatellitePointingInfoResponse(in android.hardware.radio.RadioResponseInfo info); -} diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IndicationFilter.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IndicationFilter.aidl deleted file mode 100644 index 5aa573933b..0000000000 --- a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/IndicationFilter.aidl +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.radio.satellite; -@Backing(type="int") @JavaDerive(toString=true) @VintfStability -enum IndicationFilter { - NONE = 0, - SATELLITE_MODE = 1, -} diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/NTRadioTechnology.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/NTRadioTechnology.aidl deleted file mode 100644 index 29de55f6c8..0000000000 --- a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/NTRadioTechnology.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.radio.satellite; -@Backing(type="int") @JavaDerive(toString=true) @VintfStability -enum NTRadioTechnology { - NB_IOT_NTN = 0, - NR_NTN = 1, - EMTC_NTN = 2, - PROPRIETARY = 3, -} diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/PointingInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/PointingInfo.aidl deleted file mode 100644 index dcfce349ee..0000000000 --- a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/PointingInfo.aidl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.radio.satellite; -@JavaDerive(toString=true) @VintfStability -parcelable PointingInfo { - float satelliteAzimuthDegrees; - float satelliteElevationDegrees; - float antennaAzimuthDegrees; - float antennaPitchDegrees; - float antennaRollDegrees; -} diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteCapabilities.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteCapabilities.aidl deleted file mode 100644 index 407a9d1b5a..0000000000 --- a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteCapabilities.aidl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.radio.satellite; -@JavaDerive(toString=true) @VintfStability -parcelable SatelliteCapabilities { - android.hardware.radio.satellite.NTRadioTechnology[] supportedRadioTechnologies; - boolean isAlwaysOn; - boolean needsPointingToSatellite; - android.hardware.radio.satellite.SatelliteFeature[] supportedFeatures; - boolean needsSeparateSimProfile; -} diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteFeature.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteFeature.aidl deleted file mode 100644 index 315359d888..0000000000 --- a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteFeature.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.radio.satellite; -@Backing(type="int") @JavaDerive(toString=true) @VintfStability -enum SatelliteFeature { - SOS_SMS = 0, - EMERGENCY_SMS = 1, - SMS = 2, - LOCATION_SHARING = 3, -} diff --git a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteMode.aidl deleted file mode 100644 index 1cf6a2c9e9..0000000000 --- a/radio/aidl/aidl_api/android.hardware.radio.satellite/current/android/hardware/radio/satellite/SatelliteMode.aidl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// 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 -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.hardware.radio.satellite; -@Backing(type="int") @JavaDerive(toString=true) @VintfStability -enum SatelliteMode { - POWERED_OFF = 0, - OUT_OF_SERVICE_NOT_SEARCHING = 1, - OUT_OF_SERVICE_SEARCHING = 2, - ACQUIRED = 3, - MESSAGE_TRANSFERRING = 4, -} diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl index aa55cd77d9..b7b074bda2 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl @@ -34,28 +34,28 @@ package android.hardware.radio; @Backing(type="int") @JavaDerive(toString=true) @VintfStability enum RadioAccessFamily { - UNKNOWN = (1 << android.hardware.radio.RadioTechnology.UNKNOWN), - GPRS = (1 << android.hardware.radio.RadioTechnology.GPRS), - EDGE = (1 << android.hardware.radio.RadioTechnology.EDGE), - UMTS = (1 << android.hardware.radio.RadioTechnology.UMTS), - IS95A = (1 << android.hardware.radio.RadioTechnology.IS95A), - IS95B = (1 << android.hardware.radio.RadioTechnology.IS95B), - ONE_X_RTT = (1 << android.hardware.radio.RadioTechnology.ONE_X_RTT), - EVDO_0 = (1 << android.hardware.radio.RadioTechnology.EVDO_0), - EVDO_A = (1 << android.hardware.radio.RadioTechnology.EVDO_A), - HSDPA = (1 << android.hardware.radio.RadioTechnology.HSDPA), - HSUPA = (1 << android.hardware.radio.RadioTechnology.HSUPA), - HSPA = (1 << android.hardware.radio.RadioTechnology.HSPA), - EVDO_B = (1 << android.hardware.radio.RadioTechnology.EVDO_B), - EHRPD = (1 << android.hardware.radio.RadioTechnology.EHRPD), - LTE = (1 << android.hardware.radio.RadioTechnology.LTE), - HSPAP = (1 << android.hardware.radio.RadioTechnology.HSPAP), - GSM = (1 << android.hardware.radio.RadioTechnology.GSM), - TD_SCDMA = (1 << android.hardware.radio.RadioTechnology.TD_SCDMA), - IWLAN = (1 << android.hardware.radio.RadioTechnology.IWLAN), + UNKNOWN = (1 << android.hardware.radio.RadioTechnology.UNKNOWN) /* 1 */, + GPRS = (1 << android.hardware.radio.RadioTechnology.GPRS) /* 2 */, + EDGE = (1 << android.hardware.radio.RadioTechnology.EDGE) /* 4 */, + UMTS = (1 << android.hardware.radio.RadioTechnology.UMTS) /* 8 */, + IS95A = (1 << android.hardware.radio.RadioTechnology.IS95A) /* 16 */, + IS95B = (1 << android.hardware.radio.RadioTechnology.IS95B) /* 32 */, + ONE_X_RTT = (1 << android.hardware.radio.RadioTechnology.ONE_X_RTT) /* 64 */, + EVDO_0 = (1 << android.hardware.radio.RadioTechnology.EVDO_0) /* 128 */, + EVDO_A = (1 << android.hardware.radio.RadioTechnology.EVDO_A) /* 256 */, + HSDPA = (1 << android.hardware.radio.RadioTechnology.HSDPA) /* 512 */, + HSUPA = (1 << android.hardware.radio.RadioTechnology.HSUPA) /* 1024 */, + HSPA = (1 << android.hardware.radio.RadioTechnology.HSPA) /* 2048 */, + EVDO_B = (1 << android.hardware.radio.RadioTechnology.EVDO_B) /* 4096 */, + EHRPD = (1 << android.hardware.radio.RadioTechnology.EHRPD) /* 8192 */, + LTE = (1 << android.hardware.radio.RadioTechnology.LTE) /* 16384 */, + HSPAP = (1 << android.hardware.radio.RadioTechnology.HSPAP) /* 32768 */, + GSM = (1 << android.hardware.radio.RadioTechnology.GSM) /* 65536 */, + TD_SCDMA = (1 << android.hardware.radio.RadioTechnology.TD_SCDMA) /* 131072 */, + IWLAN = (1 << android.hardware.radio.RadioTechnology.IWLAN) /* 262144 */, /** * @deprecated use LTE instead. */ - LTE_CA = (1 << android.hardware.radio.RadioTechnology.LTE_CA), - NR = (1 << android.hardware.radio.RadioTechnology.NR), + LTE_CA = (1 << android.hardware.radio.RadioTechnology.LTE_CA) /* 524288 */, + NR = (1 << android.hardware.radio.RadioTechnology.NR) /* 1048576 */, } diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl index 448c0bb5c1..9785825e9d 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioConst.aidl @@ -37,5 +37,5 @@ parcelable RadioConst { const int MAX_RILDS = 3; const int MAX_UUID_LENGTH = 64; const int CARD_MAX_APPS = 8; - const int P2_CONSTANT_NO_P2 = (-1); + const int P2_CONSTANT_NO_P2 = (-1) /* -1 */; } diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioError.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioError.aidl index b9db56c778..98606e588b 100644 --- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioError.aidl +++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioError.aidl @@ -123,15 +123,4 @@ enum RadioError { BLOCKED_DUE_TO_CALL = 69, RF_HARDWARE_ISSUE = 70, NO_RF_CALIBRATION_INFO = 71, - ENCODING_NOT_SUPPORTED = 72, - FEATURE_NOT_SUPPORTED = 73, - INVALID_CONTACT = 74, - MODEM_INCOMPATIBLE = 75, - NETWORK_TIMEOUT = 76, - NO_SATELLITE_SIGNAL = 77, - NOT_SUFFICIENT_ACCOUNT_BALANCE = 78, - RADIO_TECHNOLOGY_NOT_SUPPORTED = 79, - SUBSCRIBER_NOT_AUTHORIZED = 80, - SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL = 81, - UNIDENTIFIED_SUBSCRIBER = 82, } diff --git a/radio/aidl/android/hardware/radio/RadioError.aidl b/radio/aidl/android/hardware/radio/RadioError.aidl index 4d44559ee1..20313993f5 100644 --- a/radio/aidl/android/hardware/radio/RadioError.aidl +++ b/radio/aidl/android/hardware/radio/RadioError.aidl @@ -301,51 +301,4 @@ enum RadioError { * Unlike RF_HARDWARE_ISSUE, this is a SW problem and no HW repair is needed. */ NO_RF_CALIBRATION_INFO = 71, - /** - * The encoding scheme is not supported by either the network or the MS. - */ - ENCODING_NOT_SUPPORTED = 72, - /** - * The requesting feature is not supported by the service provider/operator. - */ - FEATURE_NOT_SUPPORTED = 73, - /** - * The contact to be added is either not existing or not valid. - */ - INVALID_CONTACT = 74, - /** - * The modem of the MS is not compatible with the service provider/operator. This generic error - * should be used only when there are some mimatches in the capabilities between the MS and - * the operator and the error cannot be mapped properly to other specific network errors. - */ - MODEM_INCOMPATIBLE = 75, - /** - * Modem timeout to receive ACK or response from network after sending a request to the network. - */ - NETWORK_TIMEOUT = 76, - /** - * Modem fails to communicate with the satellite network since there is no satellite signal. - */ - NO_SATELLITE_SIGNAL = 77, - /** - * The request cannot be performed since the subscriber's account balance is not sufficient. - */ - NOT_SUFFICIENT_ACCOUNT_BALANCE = 78, - /** - * The radio technology is not supported by the service provider/operator. - */ - RADIO_TECHNOLOGY_NOT_SUPPORTED = 79, - /** - * The subscription is not authorized to register with the service provider/operator. - */ - SUBSCRIBER_NOT_AUTHORIZED = 80, - /** - * While processing a request from the Framework, the satellite modem detects terrestrial - * signal, aborts the request, and switches to the terrestrial network. - */ - SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL = 81, - /** - * The subscriber is not registered in the service provider. - */ - UNIDENTIFIED_SUBSCRIBER = 82 } diff --git a/radio/aidl/android/hardware/radio/satellite/IRadioSatellite.aidl b/radio/aidl/android/hardware/radio/satellite/IRadioSatellite.aidl deleted file mode 100644 index 87f13a655e..0000000000 --- a/radio/aidl/android/hardware/radio/satellite/IRadioSatellite.aidl +++ /dev/null @@ -1,168 +0,0 @@ -/* - * 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. - */ - -package android.hardware.radio.satellite; - -import android.hardware.radio.satellite.IRadioSatelliteIndication; -import android.hardware.radio.satellite.IRadioSatelliteResponse; -import android.hardware.radio.satellite.IndicationFilter; -import android.hardware.radio.satellite.SatelliteFeature; - -/** - * This interface is used by telephony to send commands to and query info from satellite modem. - * All the functions have minimum one parameter: - * serial: which corresponds to serial no. of request. Serial numbers must only be memorized for the - * duration of a method call. If clients provide colliding serials (including passing the same - * serial to different methods), multiple responses (one for each method call) must still be served. - */ -@VintfStability -oneway interface IRadioSatellite { - /** - * Add contacts that are allowed to be used for satellite communication. This is applicable for - * incoming messages as well. - * - * @param serial Serial number of request. - * @param contacts List of allowed contacts to be added. - */ - void addAllowedSatelliteContacts(in int serial, in String[] contacts); - - /** - * Get feature capabilities supported by satellite. - * - * @param serial Serial number of request. - */ - void getCapabilities(in int serial); - - /** - * Get max number of characters per text message. - * - * @param serial Serial number of request. - */ - void getMaxCharactersPerTextMessage(in int serial); - - /** - * Get pending messages. - * - * @param serial Serial number of request. - */ - void getPendingMessages(in int serial); - - /** - * Get satellite modem state. - * - * @param serial Serial number of request. - */ - void getPowerState(in int serial); - - /** - * Get current satellite registration mode, which is defined in {@link #SatelliteMode}. - * - * @param serial Serial number of request. - */ - void getSatelliteMode(in int serial); - - /** - * Get time for next visibility of satellite. - * - * @param serial Serial number of request. - */ - void getTimeForNextSatelliteVisibility(in int serial); - - /** - * Provision the subscription with a satellite provider. This is needed to register the - * subscription if the provider allows dynamic registration. - * - * @param serial Serial number of request. - * @param imei IMEI of the SIM associated with the satellite modem. - * @param msisdn MSISDN of the SIM associated with the satellite modem. - * @param imsi IMSI of the SIM associated with the satellite modem. - * @param features List of features to be provisioned. - */ - void provisionService(in int serial, in String imei, in String msisdn, in String imsi, - in SatelliteFeature[] features); - - /** - * Remove contacts that are allowed to be used for satellite communication. This is applicable - * for incoming messages as well. - * - * @param serial Serial number of request. - * @param contacts List of allowed contacts to be removed. - */ - void removeAllowedSatelliteContacts(in int serial, in String[] contacts); - - /** - * When response type received from a radio indication or radio response is - * RadioIndicationType:UNSOLICITED_ACK_EXP or RadioResponseType:SOLICITED_ACK_EXP respectively, - * acknowledge the receipt of those messages by sending responseAcknowledgement(). - */ - void responseAcknowledgement(); - - /** - * Send text messages. - * - * @param serial Serial number of request. - * @param messages List of messages in text format to be sent. - * @param destination The recipient of the message. - * @param latitude The current latitude of the device. - * @param longitude The current longitude of the device. The location (i.e., latitude and - * longitude) of the device will be filled for emergency messages. - */ - void sendMessages(in int serial, in String[] messages, in String destination, - in double latitude, in double longitude); - - /** - * Set the filter for what type of indication framework want to receive from modem. - * - * @param serial Serial number of request. - * @param filterBitmask The filter bitmask identifying what type of indication Telephony - * framework wants to receive from modem. This bitmask is the 'or' - * combination of the enum values defined in {@link #IndicationFilter}. - */ - void setIndicationFilter(in int serial, in int filterBitmask); - - /** - * Turn satellite modem on/off. - * - * @param serial Serial number of request. - * @param on True for turning on. - * False for turning off. - */ - void setPower(in int serial, in boolean on); - - /** - * Set response functions for Satellite requests and indications. - * - * @param satelliteResponse Object containing response functions - * @param satelliteIndication Object containing radio indications - */ - void setResponseFunctions(in IRadioSatelliteResponse satelliteResponse, - in IRadioSatelliteIndication satelliteIndication); - - /** - * User started pointing to the satellite. Modem should continue to update the pointing input - * as user device/satellite moves. - * - * @param serial Serial number of request. - */ - void startSendingSatellitePointingInfo(in int serial); - - /** - * Stop sending satellite pointing info to the framework. - * - * @param serial Serial number of request. - */ - void stopSendingSatellitePointingInfo(in int serial); -} diff --git a/radio/aidl/android/hardware/radio/satellite/IRadioSatelliteIndication.aidl b/radio/aidl/android/hardware/radio/satellite/IRadioSatelliteIndication.aidl deleted file mode 100644 index f1d97476d4..0000000000 --- a/radio/aidl/android/hardware/radio/satellite/IRadioSatelliteIndication.aidl +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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. - */ - -package android.hardware.radio.satellite; - -import android.hardware.radio.RadioIndicationType; -import android.hardware.radio.satellite.NTRadioTechnology; -import android.hardware.radio.satellite.PointingInfo; -import android.hardware.radio.satellite.SatelliteFeature; -import android.hardware.radio.satellite.SatelliteMode; - -/** - * Interface declaring unsolicited radio indications for satellite APIs. - */ -@VintfStability -oneway interface IRadioSatelliteIndication { - /** - * Confirms that ongoing message transfer is complete. - * - * @param type Type of radio indication - * @param complete True mean the transfer is complete. - * False means the transfer is not complete. - */ - void onMessagesTransferComplete(in RadioIndicationType type, in boolean complete); - - /** - * Indicates new message received on device. - * - * @param type Type of radio indication - * @param messages List of new messages received. - */ - void onNewMessages(in RadioIndicationType type, in String[] messages); - - /** - * Indicates that satellite has pending messages for the device to be pulled. - * - * @param type Type of radio indication - * @param count Number of pending messages. - */ - void onPendingMessageCount(in RadioIndicationType type, in int count); - - /** - * Indicate that satellite provision state has changed. - * - * @param type Type of radio indication - * @param provisioned True means the service is provisioned. - * False means the service is not provisioned. - * @param features List of Feature whose provision state has changed. - */ - void onProvisionStateChanged( - in RadioIndicationType type, boolean provisioned, in SatelliteFeature[] features); - - /** - * Indicate that satellite mode has changed. - * - * @param type Type of radio indication - * @param mode The current mode of the satellite modem. - */ - void onSatelliteModeChanged(in RadioIndicationType type, in SatelliteMode mode); - - /** - * Indicate that satellite Pointing input has changed. - * - * @param type Type of radio indication - * @param pointingInfo The current pointing info. - */ - void onSatellitePointingInfoChanged(in RadioIndicationType type, in PointingInfo pointingInfo); - - /** - * Indicate that satellite radio technology has changed. - * - * @param type Type of radio indication - * @param technology The current technology of the satellite modem. - */ - void onSatelliteRadioTechnologyChanged( - in RadioIndicationType type, in NTRadioTechnology technology); -} diff --git a/radio/aidl/android/hardware/radio/satellite/IRadioSatelliteResponse.aidl b/radio/aidl/android/hardware/radio/satellite/IRadioSatelliteResponse.aidl deleted file mode 100644 index e81edaa997..0000000000 --- a/radio/aidl/android/hardware/radio/satellite/IRadioSatelliteResponse.aidl +++ /dev/null @@ -1,461 +0,0 @@ -/* - * 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. - */ - -package android.hardware.radio.satellite; - -import android.hardware.radio.RadioResponseInfo; -import android.hardware.radio.satellite.NTRadioTechnology; -import android.hardware.radio.satellite.SatelliteCapabilities; -import android.hardware.radio.satellite.SatelliteMode; - -/** - * Interface declaring response functions to solicited radio requests for satellite APIs. - */ -@VintfStability -oneway interface IRadioSatelliteResponse { - /** - * Acknowledge the receipt of radio request sent to the vendor. This must be sent only for - * radio request which take long time to respond. For more details, refer - * https://source.android.com/devices/tech/connect/ril.html - * - * @param serial Serial no. of the request whose acknowledgement is sent. - */ - void acknowledgeRequest(in int serial); - - /** - * Response of the request addAllowedSatelliteContacts. - * - * @param info Response info struct containing serial no. and error - * - * Valid errors returned: - * RadioError:NONE - * RadioError:ABORTED - * RadioError:ACCESS_BARRED - * RadioError:CANCELLED - * RadioError:INTERNAL_ERR - * RadioError:INVALID_ARGUMENTS - * RadioError:INVALID_CONTACT - * RadioError:INVALID_MODEM_STATE - * RadioError:INVALID_SIM_STATE - * RadioError:INVALID_STATE - * RadioError:MODEM_ERR - * RadioError:NETWORK_ERR - * RadioError:NETWORK_NOT_READY - * RadioError:NETWORK_REJECT - * RadioError:NETWORK_TIMEOUT - * RadioError:NO_MEMORY - * RadioError:NO_NETWORK_FOUND - * RadioError:NO_RESOURCES - * RadioError:NO_SATELLITE_SIGNAL - * RadioError:NO_SUBSCRIPTION - * RadioError:NOT_SUFFICIENT_ACCOUNT_BALANCE - * RadioError:OPERATION_NOT_ALLOWED - * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED - * RadioError:REQUEST_RATE_LIMITED - * RadioError:SIM_ABSENT - * RadioError:SIM_BUSY - * RadioError:SIM_ERR - * RadioError:SIM_FULL - * RadioError:SYSTEM_ERR - * RadioError:UNIDENTIFIED_SUBSCRIBER - */ - void addAllowedSatelliteContactsResponse(in RadioResponseInfo info); - - /** - * Response of the request getCapabilities. - * - * @param info Response info struct containing serial no. and error - * @param capabilities List of capabilities that the satellite modem supports. - * - * Valid errors returned: - * RadioError:NONE - * RadioError:INTERNAL_ERR - * RadioError:INVALID_ARGUMENTS - * RadioError:INVALID_MODEM_STATE - * RadioError:INVALID_SIM_STATE - * RadioError:INVALID_STATE - * RadioError:MODEM_ERR - * RadioError:NO_MEMORY - * RadioError:NO_RESOURCES - * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED - * RadioError:REQUEST_RATE_LIMITED - * RadioError:SYSTEM_ERR - */ - void getCapabilitiesResponse(in RadioResponseInfo info, in SatelliteCapabilities capabilities); - - /** - * Response of the request getMaxCharactersPerTextMessage. - * - * @param info Response info struct containing serial no. and error - * @param charLimit Maximum number of characters in a text message that can be sent. - * - * Valid errors returned: - * RadioError:NONE - * RadioError:INTERNAL_ERR - * RadioError:INVALID_ARGUMENTS - * RadioError:INVALID_MODEM_STATE - * RadioError:INVALID_SIM_STATE - * RadioError:INVALID_STATE - * RadioError:MODEM_ERR - * RadioError:NO_MEMORY - * RadioError:NO_RESOURCES - * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED - * RadioError:REQUEST_RATE_LIMITED - * RadioError:SYSTEM_ERR - */ - void getMaxCharactersPerTextMessageResponse(in RadioResponseInfo info, in int charLimit); - - /** - * Response of the request getPendingMessages. - * - * @param info Response info struct containing serial no. and error - * @param messages List of pending messages received. - * - * Valid errors returned: - * RadioError:NONE - * RadioError:ABORTED - * RadioError:ACCESS_BARRED - * RadioError:BLOCKED_DUE_TO_CALL - * RadioError:CANCELLED - * RadioError:ENCODING_ERR - * RadioError:ENCODING_NOT_SUPPORTED - * RadioError:INTERNAL_ERR - * RadioError:INVALID_ARGUMENTS - * RadioError:INVALID_MODEM_STATE - * RadioError:INVALID_SIM_STATE - * RadioError:INVALID_SMS_FORMAT - * RadioError:INVALID_STATE - * RadioError:MODEM_ERR - * RadioError:NETWORK_ERR - * RadioError:NETWORK_NOT_READY - * RadioError:NETWORK_REJECT - * RadioError:NETWORK_TIMEOUT - * RadioError:NO_MEMORY - * RadioError:NO_NETWORK_FOUND - * RadioError:NO_RESOURCES - * RadioError:NO_SMS_TO_ACK - * RadioError:NO_SATELLITE_SIGNAL - * RadioError:NO_SUBSCRIPTION - * RadioError:NOT_SUFFICIENT_ACCOUNT_BALANCE - * RadioError:OPERATION_NOT_ALLOWED - * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED - * RadioError:REQUEST_RATE_LIMITED - * RadioError:SIM_ABSENT - * RadioError:SIM_BUSY - * RadioError:SIM_ERR - * RadioError:SIM_FULL - * RadioError:SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED - * RadioError:SYSTEM_ERR - * RadioError:SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL - */ - void getPendingMessagesResponse(in RadioResponseInfo info, in String[] messages); - - /** - * Response of the request getPowerSate. - * - * @param info Response info struct containing serial no. and error - * @param on True means the modem is ON. - * False means the modem is OFF. - * - * Valid errors returned: - * RadioError:NONE - * RadioError:INTERNAL_ERR - * RadioError:INVALID_ARGUMENTS - * RadioError:INVALID_MODEM_STATE - * RadioError:INVALID_SIM_STATE - * RadioError:INVALID_STATE - * RadioError:MODEM_ERR - * RadioError:NO_MEMORY - * RadioError:NO_RESOURCES - * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED - * RadioError:REQUEST_RATE_LIMITED - * RadioError:SYSTEM_ERR - */ - void getPowerStateResponse(in RadioResponseInfo info, in boolean on); - - /** - * Response of the request getSatelliteMode. - * - * @param info Response info struct containing serial no. and error - * @param mode Current Mode of the satellite modem. - * @param technology The current technology of the satellite modem. - * - * Valid errors returned: - * RadioError:NONE - * RadioError:INTERNAL_ERR - * RadioError:INVALID_ARGUMENTS - * RadioError:INVALID_MODEM_STATE - * RadioError:INVALID_SIM_STATE - * RadioError:INVALID_STATE - * RadioError:MODEM_ERR - * RadioError:NO_MEMORY - * RadioError:NO_RESOURCES - * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED - * RadioError:REQUEST_RATE_LIMITED - * RadioError:SYSTEM_ERR - */ - void getSatelliteModeResponse( - in RadioResponseInfo info, in SatelliteMode mode, in NTRadioTechnology technology); - - /** - * Response of the request getTimeForNextSatelliteVisibility. - * - * @param info Response info struct containing serial no. and error - * @param timeInSeconds The duration in seconds after which the satellite will be visible. - * - * Valid errors returned: - * RadioError:NONE - * RadioError:INTERNAL_ERR - * RadioError:INVALID_ARGUMENTS - * RadioError:INVALID_MODEM_STATE - * RadioError:INVALID_SIM_STATE - * RadioError:INVALID_STATE - * RadioError:MODEM_ERR - * RadioError:NO_MEMORY - * RadioError:NO_RESOURCES - * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED - * RadioError:REQUEST_RATE_LIMITED - * RadioError:SYSTEM_ERR - */ - void getTimeForNextSatelliteVisibilityResponse(in RadioResponseInfo info, in int timeInSeconds); - - /** - * Response of the request provisionService. - * - * @param info Response info struct containing serial no. and error - * @param provisioned True means the service is provisioned. - * False means the service is not provisioned. - * - * Valid errors returned: - * RadioError:NONE - * RadioError:ABORTED - * RadioError:ACCESS_BARRED - * RadioError:CANCELLED - * RadioError:FEATURE_NOT_SUPPORTED - * RadioError:INTERNAL_ERR - * RadioError:INVALID_ARGUMENTS - * RadioError:INVALID_MODEM_STATE - * RadioError:INVALID_SIM_STATE - * RadioError:INVALID_STATE - * RadioError:MODEM_ERR - * RadioError:MODEM_INCOMPATIBLE - * RadioError:NETWORK_ERR - * RadioError:NETWORK_NOT_READY - * RadioError:NETWORK_REJECT - * RadioError:NETWORK_TIMEOUT - * RadioError:NO_MEMORY - * RadioError:NO_NETWORK_FOUND - * RadioError:NO_RESOURCES - * RadioError:NO_SATELLITE_SIGNAL - * RadioError:NO_SUBSCRIPTION - * RadioError:OPERATION_NOT_ALLOWED - * RadioError:RADIO_NOT_AVAILABLE - * RadioError:RADIO_TECHNOLOGY_NOT_SUPPORTED - * RadioError:REQUEST_NOT_SUPPORTED - * RadioError:REQUEST_RATE_LIMITED - * RadioError:SIM_ABSENT - * RadioError:SIM_BUSY - * RadioError:SIM_ERR - * RadioError:SIM_FULL - * RadioError:SUBSCRIBER_NOT_AUTHORIZED - * RadioError:SYSTEM_ERR - */ - void provisionServiceResponse(in RadioResponseInfo info, in boolean provisioned); - - /** - * Response of the request removeAllowedSatelliteContacts. - * - * @param info Response info struct containing serial no. and error - * - * Valid errors returned: - * RadioError:NONE - * RadioError:ABORTED - * RadioError:ACCESS_BARRED - * RadioError:CANCELLED - * RadioError:INTERNAL_ERR - * RadioError:INVALID_ARGUMENTS - * RadioError:INVALID_CONTACT - * RadioError:INVALID_MODEM_STATE - * RadioError:INVALID_SIM_STATE - * RadioError:INVALID_STATE - * RadioError:MODEM_ERR - * RadioError:NETWORK_ERR - * RadioError:NETWORK_NOT_READY - * RadioError:NETWORK_REJECT - * RadioError:NETWORK_TIMEOUT - * RadioError:NO_MEMORY - * RadioError:NO_NETWORK_FOUND - * RadioError:NO_RESOURCES - * RadioError:NO_SATELLITE_SIGNAL - * RadioError:NO_SUBSCRIPTION - * RadioError:NOT_SUFFICIENT_ACCOUNT_BALANCE - * RadioError:OPERATION_NOT_ALLOWED - * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED - * RadioError:REQUEST_RATE_LIMITED - * RadioError:SIM_ABSENT - * RadioError:SIM_BUSY - * RadioError:SIM_ERR - * RadioError:SIM_FULL - * RadioError:SYSTEM_ERR - * RadioError:UNIDENTIFIED_SUBSCRIBER - */ - void removeAllowedSatelliteContactsResponse(in RadioResponseInfo info); - - /** - * Response of the request sendMessages. - * - * @param info Response info struct containing serial no. and error - * - * Valid errors returned: - * RadioError:NONE - * RadioError:ABORTED - * RadioError:ACCESS_BARRED - * RadioError:BLOCKED_DUE_TO_CALL - * RadioError:CANCELLED - * RadioError:ENCODING_ERR - * RadioError:ENCODING_NOT_SUPPORTED - * RadioError:INTERNAL_ERR - * RadioError:INVALID_ARGUMENTS - * RadioError:INVALID_MODEM_STATE - * RadioError:INVALID_SIM_STATE - * RadioError:INVALID_SMS_FORMAT - * RadioError:INVALID_STATE - * RadioError:MODEM_ERR - * RadioError:NETWORK_ERR - * RadioError:NETWORK_NOT_READY - * RadioError:NETWORK_REJECT - * RadioError:NETWORK_TIMEOUT - * RadioError:NO_MEMORY - * RadioError:NO_NETWORK_FOUND - * RadioError:NO_RESOURCES - * RadioError:NO_SMS_TO_ACK - * RadioError:NO_SATELLITE_SIGNAL - * RadioError:NO_SUBSCRIPTION - * RadioError:NOT_SUFFICIENT_ACCOUNT_BALANCE - * RadioError:OPERATION_NOT_ALLOWED - * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED - * RadioError:REQUEST_RATE_LIMITED - * RadioError:SIM_ABSENT - * RadioError:SIM_BUSY - * RadioError:SIM_ERR - * RadioError:SIM_FULL - * RadioError:SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED - * RadioError:SMS_SEND_FAIL_RETRY - * RadioError:SYSTEM_ERR - * RadioError:SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL - * RadioError:UNIDENTIFIED_SUBSCRIBER - */ - void sendMessagesResponse(in RadioResponseInfo info); - - /** - * Response of the request setIndicationFilter. - * - * @param info Response info struct containing serial no. and error - * - * Valid errors returned: - * RadioError:NONE - * RadioError:INTERNAL_ERR - * RadioError:INVALID_ARGUMENTS - * RadioError:INVALID_MODEM_STATE - * RadioError:INVALID_SIM_STATE - * RadioError:INVALID_STATE - * RadioError:MODEM_ERR - * RadioError:NO_MEMORY - * RadioError:NO_RESOURCES - * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED - * RadioError:REQUEST_RATE_LIMITED - * RadioError:SYSTEM_ERR - */ - void setIndicationFilterResponse(in RadioResponseInfo info); - - /** - * Response of the request setPower. - * - * @param info Response info struct containing serial no. and error - * - * Valid errors returned: - * RadioError:NONE - * RadioError:INTERNAL_ERR - * RadioError:INVALID_ARGUMENTS - * RadioError:INVALID_MODEM_STATE - * RadioError:INVALID_SIM_STATE - * RadioError:INVALID_STATE - * RadioError:MODEM_ERR - * RadioError:NO_MEMORY - * RadioError:NO_RESOURCES - * RadioError:NO_RF_CALIBRATION_INFO - * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED - * RadioError:REQUEST_RATE_LIMITED - * RadioError:RF_HARDWARE_ISSUE - * RadioError:SYSTEM_ERR - */ - void setPowerResponse(in RadioResponseInfo info); - - /** - * Response of the request startSendingSatellitePointingInfo. - * - * @param info Response info struct containing serial no. and error - * - * Valid errors returned: - * RadioError:NONE - * RadioError:INTERNAL_ERR - * RadioError:INVALID_ARGUMENTS - * RadioError:INVALID_MODEM_STATE - * RadioError:INVALID_SIM_STATE - * RadioError:INVALID_STATE - * RadioError:MODEM_ERR - * RadioError:NO_MEMORY - * RadioError:NO_RESOURCES - * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED - * RadioError:REQUEST_RATE_LIMITED - * RadioError:SYSTEM_ERR - */ - void startSendingSatellitePointingInfoResponse(in RadioResponseInfo info); - - /** - * Response of the request stopSendingSatellitePointingInfo. - * - * @param info Response info struct containing serial no. and error - * - * Valid errors returned: - * RadioError:NONE - * RadioError:INTERNAL_ERR - * RadioError:INVALID_ARGUMENTS - * RadioError:INVALID_MODEM_STATE - * RadioError:INVALID_SIM_STATE - * RadioError:INVALID_STATE - * RadioError:MODEM_ERR - * RadioError:NO_MEMORY - * RadioError:NO_RESOURCES - * RadioError:RADIO_NOT_AVAILABLE - * RadioError:REQUEST_NOT_SUPPORTED - * RadioError:REQUEST_RATE_LIMITED - * RadioError:SYSTEM_ERR - */ - void stopSendingSatellitePointingInfoResponse(in RadioResponseInfo info); -} diff --git a/radio/aidl/android/hardware/radio/satellite/IndicationFilter.aidl b/radio/aidl/android/hardware/radio/satellite/IndicationFilter.aidl deleted file mode 100644 index 1a65bee594..0000000000 --- a/radio/aidl/android/hardware/radio/satellite/IndicationFilter.aidl +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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. - */ - -package android.hardware.radio.satellite; - -@VintfStability -@Backing(type="int") -@JavaDerive(toString=true) -enum IndicationFilter { - NONE = 0, - SATELLITE_MODE = 1 -} diff --git a/radio/aidl/android/hardware/radio/satellite/NTRadioTechnology.aidl b/radio/aidl/android/hardware/radio/satellite/NTRadioTechnology.aidl deleted file mode 100644 index 39b2b0054f..0000000000 --- a/radio/aidl/android/hardware/radio/satellite/NTRadioTechnology.aidl +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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. - */ - -package android.hardware.radio.satellite; - -@VintfStability -@Backing(type="int") -@JavaDerive(toString=true) -enum NTRadioTechnology { - /* 3GPP NB-IoT (Narrowband Internet of Things) over Non-Terrestrial-Networks technology */ - NB_IOT_NTN = 0, - /* 3GPP 5G NR over Non-Terrestrial-Networks technology */ - NR_NTN = 1, - /* 3GPP eMTC (enhanced Machine-Type Communication) over Non-Terrestrial-Networks technology */ - EMTC_NTN = 2, - /* Proprietary technology like Iridium or Bullitt */ - PROPRIETARY = 3 -} diff --git a/radio/aidl/android/hardware/radio/satellite/PointingInfo.aidl b/radio/aidl/android/hardware/radio/satellite/PointingInfo.aidl deleted file mode 100644 index 8496a598a7..0000000000 --- a/radio/aidl/android/hardware/radio/satellite/PointingInfo.aidl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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. - */ - -package android.hardware.radio.satellite; - -@VintfStability -@JavaDerive(toString=true) -parcelable PointingInfo { - /* Satellite azimuth in degrees */ - float satelliteAzimuthDegrees; - - /* Satellite elevation in degrees */ - float satelliteElevationDegrees; - - /* Antenna azimuth in degrees */ - float antennaAzimuthDegrees; - - /** - * Angle of rotation about the x axis. This value represents the angle between a plane - * parallel to the device's screen and a plane parallel to the ground. - */ - float antennaPitchDegrees; - - /** - * Angle of rotation about the y axis. This value represents the angle between a plane - * perpendicular to the device's screen and a plane parallel to the ground. - */ - float antennaRollDegrees; -} diff --git a/radio/aidl/android/hardware/radio/satellite/SatelliteCapabilities.aidl b/radio/aidl/android/hardware/radio/satellite/SatelliteCapabilities.aidl deleted file mode 100644 index 01e64aa67f..0000000000 --- a/radio/aidl/android/hardware/radio/satellite/SatelliteCapabilities.aidl +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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. - */ - -package android.hardware.radio.satellite; - -import android.hardware.radio.satellite.NTRadioTechnology; -import android.hardware.radio.satellite.SatelliteFeature; - -@VintfStability -@JavaDerive(toString=true) -parcelable SatelliteCapabilities { - /** - * List of technologies supported by the satellite modem. - */ - NTRadioTechnology[] supportedRadioTechnologies; - - /** - * Whether satellite mode is always on (this indicates the power impact of keeping it on is - * very minimal). - */ - boolean isAlwaysOn; - - /** - * Whether UE needs to point to a satellite to send and receive data. - */ - boolean needsPointingToSatellite; - - /** - * List of features supported by the satellite modem. - */ - SatelliteFeature[] supportedFeatures; - - /** - * Whether UE needs a separate SIM profile to communicate with satellite network. - */ - boolean needsSeparateSimProfile; -} diff --git a/radio/aidl/android/hardware/radio/satellite/SatelliteFeature.aidl b/radio/aidl/android/hardware/radio/satellite/SatelliteFeature.aidl deleted file mode 100644 index 0e33998357..0000000000 --- a/radio/aidl/android/hardware/radio/satellite/SatelliteFeature.aidl +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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. - */ - -package android.hardware.radio.satellite; - -@VintfStability -@Backing(type="int") -@JavaDerive(toString=true) -enum SatelliteFeature { - /* Able to send and receive SMS messages to/from SOS numbers like call/service centers */ - SOS_SMS = 0, - /* Able to send and receive SMS messages to/from emergency numbers like 911 */ - EMERGENCY_SMS = 1, - /* Able to send and receive SMS messages to/from any allowed contacts */ - SMS = 2, - /* Able to send device location to allowed contacts */ - LOCATION_SHARING = 3 -} diff --git a/radio/aidl/android/hardware/radio/satellite/SatelliteMode.aidl b/radio/aidl/android/hardware/radio/satellite/SatelliteMode.aidl deleted file mode 100644 index 349fd9e0fd..0000000000 --- a/radio/aidl/android/hardware/radio/satellite/SatelliteMode.aidl +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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. - */ - -package android.hardware.radio.satellite; - -@VintfStability -@Backing(type="int") -@JavaDerive(toString=true) -enum SatelliteMode { - /* Satellite modem is powered off */ - POWERED_OFF = 0, - /* Satellite modem is in out of service state and not searching for satellite signal */ - OUT_OF_SERVICE_NOT_SEARCHING = 1, - /* Satellite modem is in out of service state and searching for satellite signal */ - OUT_OF_SERVICE_SEARCHING = 2, - /* Satellite modem has found satellite signal and gets connected to the satellite network */ - ACQUIRED = 3, - /* Satellite modem is sending and/or receiving messages */ - MESSAGE_TRANSFERRING = 4 -} diff --git a/radio/aidl/compat/libradiocompat/Android.bp b/radio/aidl/compat/libradiocompat/Android.bp index 9aecf78d38..5cf1378821 100644 --- a/radio/aidl/compat/libradiocompat/Android.bp +++ b/radio/aidl/compat/libradiocompat/Android.bp @@ -43,7 +43,6 @@ cc_library { "android.hardware.radio.modem-V2-ndk", "android.hardware.radio.network-V2-ndk", "android.hardware.radio.sap-V1-ndk", - "android.hardware.radio.satellite-V1-ndk", "android.hardware.radio.sim-V2-ndk", "android.hardware.radio.voice-V2-ndk", "android.hardware.radio@1.0", @@ -94,9 +93,6 @@ cc_library { "sap/Sap.cpp", "sap/SapCallback.cpp", "sap/structs.cpp", - "satellite/RadioIndication-satellite.cpp", - "satellite/RadioResponse-satellite.cpp", - "satellite/RadioSatellite.cpp", "sim/RadioIndication-sim.cpp", "sim/RadioResponse-sim.cpp", "sim/RadioSim.cpp", diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h index ad9127e461..f042456409 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioIndication.h @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -61,10 +60,6 @@ class RadioIndication : public V1_6::IRadioIndication { ::aidl::android::hardware::radio::ims::IRadioImsIndication, ::aidl::android::hardware::radio::ims::IRadioImsIndicationDefault, true> mImsCb; - GuaranteedCallback< // - ::aidl::android::hardware::radio::satellite::IRadioSatelliteIndication, - ::aidl::android::hardware::radio::satellite::IRadioSatelliteIndicationDefault, true> - mSatelliteCb; // IRadioIndication @ 1.0 Return radioStateChanged(V1_0::RadioIndicationType type, @@ -232,9 +227,6 @@ class RadioIndication : public V1_6::IRadioIndication { std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceIndication> voicCb); void setResponseFunction( std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsIndication> imsCb); - void setResponseFunction( - std::shared_ptr<::aidl::android::hardware::radio::satellite::IRadioSatelliteIndication> - satelliteCb); std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataIndication> dataCb(); std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingIndication> @@ -244,8 +236,6 @@ class RadioIndication : public V1_6::IRadioIndication { std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimIndication> simCb(); std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceIndication> voiceCb(); std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsIndication> imsCb(); - std::shared_ptr<::aidl::android::hardware::radio::satellite::IRadioSatelliteIndication> - satelliteCb(); }; } // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h index b976435064..e20eed985f 100644 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h +++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioResponse.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -55,9 +54,6 @@ class RadioResponse : public V1_6::IRadioResponse { GuaranteedCallback<::aidl::android::hardware::radio::ims::IRadioImsResponse, ::aidl::android::hardware::radio::ims::IRadioImsResponseDefault> mImsCb; - GuaranteedCallback<::aidl::android::hardware::radio::satellite::IRadioSatelliteResponse, - ::aidl::android::hardware::radio::satellite::IRadioSatelliteResponseDefault> - mSatelliteCb; // IRadioResponse @ 1.0 Return getIccCardStatusResponse(const V1_0::RadioResponseInfo& info, @@ -451,9 +447,6 @@ class RadioResponse : public V1_6::IRadioResponse { std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse> voiceCb); void setResponseFunction( std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse> imsCb); - void setResponseFunction( - std::shared_ptr<::aidl::android::hardware::radio::satellite::IRadioSatelliteResponse> - satelliteCb); std::shared_ptr<::aidl::android::hardware::radio::data::IRadioDataResponse> dataCb(); std::shared_ptr<::aidl::android::hardware::radio::messaging::IRadioMessagingResponse> @@ -463,8 +456,6 @@ class RadioResponse : public V1_6::IRadioResponse { std::shared_ptr<::aidl::android::hardware::radio::sim::IRadioSimResponse> simCb(); std::shared_ptr<::aidl::android::hardware::radio::voice::IRadioVoiceResponse> voiceCb(); std::shared_ptr<::aidl::android::hardware::radio::ims::IRadioImsResponse> imsCb(); - std::shared_ptr<::aidl::android::hardware::radio::satellite::IRadioSatelliteResponse> - satelliteCb(); }; } // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioSatellite.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioSatellite.h deleted file mode 100644 index 3ee6db2721..0000000000 --- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioSatellite.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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. - */ -#pragma once - -#include "RadioCompatBase.h" - -#include - -namespace android::hardware::radio::compat { - -class RadioSatellite : public RadioCompatBase, - public aidl::android::hardware::radio::satellite::BnRadioSatellite { - ::ndk::ScopedAStatus responseAcknowledgement() override; - ::ndk::ScopedAStatus getCapabilities(int32_t serial) override; - ::ndk::ScopedAStatus setPower(int32_t serial, bool on) override; - ::ndk::ScopedAStatus getPowerState(int32_t serial) override; - ::ndk::ScopedAStatus provisionService( - int32_t serial, const std::string& imei, const std::string& msisdn, - const std::string& imsi, - const std::vector<::aidl::android::hardware::radio::satellite::SatelliteFeature>& - features) override; - ::ndk::ScopedAStatus addAllowedSatelliteContacts( - int32_t serial, const std::vector& contacts) override; - ::ndk::ScopedAStatus removeAllowedSatelliteContacts( - int32_t serial, const std::vector& contacts) override; - ::ndk::ScopedAStatus sendMessages(int32_t serial, const std::vector& messages, - const std::string& destination, double latitude, - double longitude) override; - ::ndk::ScopedAStatus getPendingMessages(int32_t serial) override; - ::ndk::ScopedAStatus getSatelliteMode(int32_t serial) override; - ::ndk::ScopedAStatus setIndicationFilter(int32_t serial, int32_t filterBitmask) override; - ::ndk::ScopedAStatus startSendingSatellitePointingInfo(int32_t serial) override; - ::ndk::ScopedAStatus stopSendingSatellitePointingInfo(int32_t serial) override; - ::ndk::ScopedAStatus getMaxCharactersPerTextMessage(int32_t serial) override; - ::ndk::ScopedAStatus getTimeForNextSatelliteVisibility(int32_t serial) override; - - ::ndk::ScopedAStatus setResponseFunctions( - const std::shared_ptr< - ::aidl::android::hardware::radio::satellite::IRadioSatelliteResponse>& - radioSatelliteResponse, - const std::shared_ptr< - ::aidl::android::hardware::radio::satellite::IRadioSatelliteIndication>& - radioSatelliteIndication) override; - - protected: - std::shared_ptr<::aidl::android::hardware::radio::satellite::IRadioSatelliteResponse> respond(); - - public: - using RadioCompatBase::RadioCompatBase; -}; - -} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/satellite/RadioIndication-satellite.cpp b/radio/aidl/compat/libradiocompat/satellite/RadioIndication-satellite.cpp deleted file mode 100644 index 39da43d832..0000000000 --- a/radio/aidl/compat/libradiocompat/satellite/RadioIndication-satellite.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ - -#include - -#include "commonStructs.h" -#include "debug.h" - -#include "collections.h" - -#define RADIO_MODULE "RadioSatelliteIndication" - -namespace android::hardware::radio::compat { - -namespace aidl = ::aidl::android::hardware::radio::satellite; - -void RadioIndication::setResponseFunction( - std::shared_ptr satelliteCb) { - mSatelliteCb = satelliteCb; -} - -std::shared_ptr RadioIndication::satelliteCb() { - return mSatelliteCb.get(); -} - -} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/satellite/RadioResponse-satellite.cpp b/radio/aidl/compat/libradiocompat/satellite/RadioResponse-satellite.cpp deleted file mode 100644 index 2209c93c2e..0000000000 --- a/radio/aidl/compat/libradiocompat/satellite/RadioResponse-satellite.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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. - */ - -#include - -#include "commonStructs.h" -#include "debug.h" - -#include "collections.h" - -#define RADIO_MODULE "RadioSatelliteResponse" - -namespace android::hardware::radio::compat { - -namespace aidl = ::aidl::android::hardware::radio::satellite; - -void RadioResponse::setResponseFunction( - std::shared_ptr satelliteCb) { - mSatelliteCb = satelliteCb; -} - -std::shared_ptr RadioResponse::satelliteCb() { - return mSatelliteCb.get(); -} - -} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/libradiocompat/satellite/RadioSatellite.cpp b/radio/aidl/compat/libradiocompat/satellite/RadioSatellite.cpp deleted file mode 100644 index 16a3167bf5..0000000000 --- a/radio/aidl/compat/libradiocompat/satellite/RadioSatellite.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * 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. - */ - -#include - -#include "commonStructs.h" -#include "debug.h" - -#include "collections.h" - -#define RADIO_MODULE "RadioSatellite" - -namespace android::hardware::radio::compat { - -using ::ndk::ScopedAStatus; -namespace aidl = ::aidl::android::hardware::radio::satellite; -constexpr auto ok = &ScopedAStatus::ok; - -std::shared_ptr RadioSatellite::respond() { - return mCallbackManager->response().satelliteCb(); -} - -ScopedAStatus RadioSatellite::responseAcknowledgement() { - LOG(ERROR) << " responseAcknowledgement is unsupported by HIDL HALs"; - return ok(); -} -ScopedAStatus RadioSatellite::getCapabilities(int32_t serial) { - LOG_CALL << serial; - LOG(ERROR) << " getCapabilities is unsupported by HIDL HALs"; - return ok(); -} -ScopedAStatus RadioSatellite::setPower(int32_t serial, bool /*on*/) { - LOG_CALL << serial; - LOG(ERROR) << " setPower is unsupported by HIDL HALs"; - return ok(); -} -ScopedAStatus RadioSatellite::getPowerState(int32_t serial) { - LOG_CALL << serial; - LOG(ERROR) << " getPowerSate is unsupported by HIDL HALs"; - return ok(); -} -ScopedAStatus RadioSatellite::provisionService( - int32_t serial, const std::string& /*imei*/, const std::string& /*msisdn*/, - const std::string& /*imsi*/, - const std::vector< - ::aidl::android::hardware::radio::satellite::SatelliteFeature>& /*features*/) { - LOG_CALL << serial; - LOG(ERROR) << " provisionService is unsupported by HIDL HALs"; - return ok(); -} -ScopedAStatus RadioSatellite::addAllowedSatelliteContacts( - int32_t serial, const std::vector& /*contacts*/) { - LOG_CALL << serial; - LOG(ERROR) << " addAllowedSatelliteContacts is unsupported by HIDL HALs"; - return ok(); -} -ScopedAStatus RadioSatellite::removeAllowedSatelliteContacts( - int32_t serial, const std::vector& /*contacts*/) { - LOG_CALL << serial; - LOG(ERROR) << " removeAllowedSatelliteContacts is unsupported by HIDL HALs"; - return ok(); -} -ScopedAStatus RadioSatellite::sendMessages(int32_t serial, - const std::vector& /*messages*/, - const std::string& /*destination*/, double /*latitude*/, - double /*longitude*/) { - LOG_CALL << serial; - LOG(ERROR) << " sendMessage is unsupported by HIDL HALs"; - return ok(); -} -ScopedAStatus RadioSatellite::getPendingMessages(int32_t serial) { - LOG_CALL << serial; - LOG(ERROR) << " getPendingMessages is unsupported by HIDL HALs"; - return ok(); -} -ScopedAStatus RadioSatellite::getSatelliteMode(int32_t serial) { - LOG_CALL << serial; - LOG(ERROR) << " getSatelliteMode is unsupported by HIDL HALs"; - return ok(); -} -ScopedAStatus RadioSatellite::setIndicationFilter(int32_t serial, int32_t /*filterBitmask*/) { - LOG_CALL << serial; - LOG(ERROR) << " setIndicationFilter is unsupported by HIDL HALs"; - return ok(); -} -ScopedAStatus RadioSatellite::startSendingSatellitePointingInfo(int32_t serial) { - LOG_CALL << serial; - LOG(ERROR) << " startSendingSatellitePointingInfo is unsupported by HIDL HALs"; - return ok(); -} -ScopedAStatus RadioSatellite::stopSendingSatellitePointingInfo(int32_t serial) { - LOG_CALL << serial; - LOG(ERROR) << " stopSendingSatellitePointingInfo is unsupported by HIDL HALs"; - return ok(); -} -ScopedAStatus RadioSatellite::getMaxCharactersPerTextMessage(int32_t serial) { - LOG_CALL << serial; - LOG(ERROR) << " getMaxCharactersPerTextMessage is unsupported by HIDL HALs"; - return ok(); -} -ScopedAStatus RadioSatellite::getTimeForNextSatelliteVisibility(int32_t serial) { - LOG_CALL << serial; - LOG(ERROR) << " getTimeForNextSatelliteVisibility is unsupported by HIDL HALs"; - return ok(); -} - -ScopedAStatus RadioSatellite::setResponseFunctions( - const std::shared_ptr& response, - const std::shared_ptr& indication) { - LOG_CALL << response << ' ' << indication; - mCallbackManager->setResponseFunctions(response, indication); - return ok(); -} - -} // namespace android::hardware::radio::compat diff --git a/radio/aidl/compat/service/Android.bp b/radio/aidl/compat/service/Android.bp index 5d14c85f73..dff018285a 100644 --- a/radio/aidl/compat/service/Android.bp +++ b/radio/aidl/compat/service/Android.bp @@ -46,7 +46,6 @@ cc_binary { "android.hardware.radio.modem-V2-ndk", "android.hardware.radio.network-V2-ndk", "android.hardware.radio.sap-V1-ndk", - "android.hardware.radio.satellite-V1-ndk", "android.hardware.radio.sim-V2-ndk", "android.hardware.radio.voice-V2-ndk", "android.hardware.radio@1.0", diff --git a/radio/aidl/vts/Android.bp b/radio/aidl/vts/Android.bp index f112d6d73a..e79d3c0277 100644 --- a/radio/aidl/vts/Android.bp +++ b/radio/aidl/vts/Android.bp @@ -58,9 +58,6 @@ cc_test { "radio_network_test.cpp", "radio_sap_callback.cpp", "radio_sap_test.cpp", - "radio_satellite_indication.cpp", - "radio_satellite_response.cpp", - "radio_satellite_test.cpp", "radio_sim_indication.cpp", "radio_sim_response.cpp", "radio_sim_test.cpp", @@ -83,7 +80,6 @@ cc_test { "android.hardware.radio.modem-V2-ndk", "android.hardware.radio.network-V2-ndk", "android.hardware.radio.sap-V1-ndk", - "android.hardware.radio.satellite-V1-ndk", "android.hardware.radio.sim-V2-ndk", "android.hardware.radio.voice-V2-ndk", ], diff --git a/radio/aidl/vts/VtsHalRadioTargetTest.cpp b/radio/aidl/vts/VtsHalRadioTargetTest.cpp index 86c109948a..c04173b762 100644 --- a/radio/aidl/vts/VtsHalRadioTargetTest.cpp +++ b/radio/aidl/vts/VtsHalRadioTargetTest.cpp @@ -24,7 +24,6 @@ #include "radio_modem_utils.h" #include "radio_network_utils.h" #include "radio_sap_utils.h" -#include "radio_satellite_utils.h" #include "radio_sim_utils.h" #include "radio_voice_utils.h" @@ -80,12 +79,6 @@ INSTANTIATE_TEST_SUITE_P( testing::ValuesIn(android::getAidlHalInstanceNames(IRadioIms::descriptor)), android::PrintInstanceNameToString); -GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioSatelliteTest); -INSTANTIATE_TEST_SUITE_P( - PerInstance, RadioSatelliteTest, - testing::ValuesIn(android::getAidlHalInstanceNames(IRadioSatellite::descriptor)), - android::PrintInstanceNameToString); - GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(RadioImsMediaTest); INSTANTIATE_TEST_SUITE_P(PerInstance, RadioImsMediaTest, testing::ValuesIn(android::getAidlHalInstanceNames(IImsMedia::descriptor)), diff --git a/radio/aidl/vts/radio_aidl_hal_utils.h b/radio/aidl/vts/radio_aidl_hal_utils.h index 2e6c49caaf..d515e1a7c0 100644 --- a/radio/aidl/vts/radio_aidl_hal_utils.h +++ b/radio/aidl/vts/radio_aidl_hal_utils.h @@ -69,8 +69,6 @@ static constexpr const char* FEATURE_TELEPHONY_CDMA = "android.hardware.telephon static constexpr const char* FEATURE_TELEPHONY_IMS = "android.hardware.telephony.ims"; -static constexpr const char* FEATURE_TELEPHONY_SATELLITE = "android.hardware.telephony.satellite"; - #define MODEM_EMERGENCY_CALL_ESTABLISH_TIME 3 #define MODEM_EMERGENCY_CALL_DISCONNECT_TIME 3 #define MODEM_SET_SIM_POWER_DELAY_IN_SECONDS 2 diff --git a/radio/aidl/vts/radio_satellite_indication.cpp b/radio/aidl/vts/radio_satellite_indication.cpp deleted file mode 100644 index 13e4453403..0000000000 --- a/radio/aidl/vts/radio_satellite_indication.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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. - */ - -#include "radio_satellite_utils.h" - -RadioSatelliteIndication::RadioSatelliteIndication(RadioServiceTest& parent) - : parent_satellite(parent) {} - -ndk::ScopedAStatus RadioSatelliteIndication::onPendingMessageCount(RadioIndicationType /*type*/, - int32_t /*count*/) { - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus RadioSatelliteIndication::onNewMessages( - RadioIndicationType /*type*/, const std::vector& /*messages*/) { - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus RadioSatelliteIndication::onMessagesTransferComplete( - RadioIndicationType /*type*/, bool /*complete*/) { - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus RadioSatelliteIndication::onSatellitePointingInfoChanged( - RadioIndicationType /*type*/, const PointingInfo& /*pointingInfo*/) { - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus RadioSatelliteIndication::onSatelliteModeChanged(RadioIndicationType /*type*/, - SatelliteMode /*mode*/) { - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus RadioSatelliteIndication::onSatelliteRadioTechnologyChanged( - RadioIndicationType /*type*/, NTRadioTechnology /*technology*/) { - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus RadioSatelliteIndication::onProvisionStateChanged( - RadioIndicationType /*type*/, bool /*provisioned*/, - const std::vector& /*features*/) { - return ndk::ScopedAStatus::ok(); -} diff --git a/radio/aidl/vts/radio_satellite_response.cpp b/radio/aidl/vts/radio_satellite_response.cpp deleted file mode 100644 index 84d57b2d58..0000000000 --- a/radio/aidl/vts/radio_satellite_response.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - * 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. - */ - -#include "radio_satellite_utils.h" - -RadioSatelliteResponse::RadioSatelliteResponse(RadioServiceTest& parent) - : parent_satellite(parent) {} - -ndk::ScopedAStatus RadioSatelliteResponse::acknowledgeRequest(int32_t /*serial*/) { - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus RadioSatelliteResponse::getCapabilitiesResponse( - const RadioResponseInfo& info, const SatelliteCapabilities& /*capabilities*/) { - rspInfo = info; - parent_satellite.notify(info.serial); - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus RadioSatelliteResponse::setPowerResponse(const RadioResponseInfo& info) { - rspInfo = info; - parent_satellite.notify(info.serial); - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus RadioSatelliteResponse::getPowerStateResponse(const RadioResponseInfo& info, - bool /*on*/) { - rspInfo = info; - parent_satellite.notify(info.serial); - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus RadioSatelliteResponse::provisionServiceResponse(const RadioResponseInfo& info, - bool /*provisioned*/) { - rspInfo = info; - parent_satellite.notify(info.serial); - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus RadioSatelliteResponse::addAllowedSatelliteContactsResponse( - const RadioResponseInfo& info) { - rspInfo = info; - parent_satellite.notify(info.serial); - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus RadioSatelliteResponse::removeAllowedSatelliteContactsResponse( - const RadioResponseInfo& info) { - rspInfo = info; - parent_satellite.notify(info.serial); - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus RadioSatelliteResponse::sendMessagesResponse(const RadioResponseInfo& info) { - rspInfo = info; - parent_satellite.notify(info.serial); - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus RadioSatelliteResponse::getPendingMessagesResponse( - const RadioResponseInfo& info, const std::vector& /*messages*/) { - rspInfo = info; - parent_satellite.notify(info.serial); - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus RadioSatelliteResponse::getSatelliteModeResponse( - const RadioResponseInfo& info, SatelliteMode /*mode*/, NTRadioTechnology /*technology*/) { - rspInfo = info; - parent_satellite.notify(info.serial); - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus RadioSatelliteResponse::setIndicationFilterResponse( - const RadioResponseInfo& info) { - rspInfo = info; - parent_satellite.notify(info.serial); - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus RadioSatelliteResponse::startSendingSatellitePointingInfoResponse( - const RadioResponseInfo& info) { - rspInfo = info; - parent_satellite.notify(info.serial); - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus RadioSatelliteResponse::stopSendingSatellitePointingInfoResponse( - const RadioResponseInfo& info) { - rspInfo = info; - parent_satellite.notify(info.serial); - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus RadioSatelliteResponse::getMaxCharactersPerTextMessageResponse( - const RadioResponseInfo& info, int32_t /*charLimit*/) { - rspInfo = info; - parent_satellite.notify(info.serial); - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus RadioSatelliteResponse::getTimeForNextSatelliteVisibilityResponse( - const RadioResponseInfo& info, int32_t /*timeInSeconds*/) { - rspInfo = info; - parent_satellite.notify(info.serial); - return ndk::ScopedAStatus::ok(); -} \ No newline at end of file diff --git a/radio/aidl/vts/radio_satellite_test.cpp b/radio/aidl/vts/radio_satellite_test.cpp deleted file mode 100644 index b0358b3b0d..0000000000 --- a/radio/aidl/vts/radio_satellite_test.cpp +++ /dev/null @@ -1,626 +0,0 @@ -/* - * 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. - */ - -#include -#include -#include - -#include "radio_satellite_utils.h" - -#define ASSERT_OK(ret) ASSERT_TRUE(((ret).isOk())) - -void RadioSatelliteTest::SetUp() { - std::string serviceName = GetParam(); - - if (!isServiceValidForDeviceConfiguration(serviceName)) { - ALOGI("Skipped the radio satellite tests due to device configuration."); - GTEST_SKIP(); - } - - satellite = IRadioSatellite::fromBinder( - ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str()))); - ASSERT_NE(nullptr, satellite.get()); - - rsp_satellite = ndk::SharedRefBase::make(*this); - ASSERT_NE(nullptr, rsp_satellite.get()); - - count_ = 0; - - ind_satellite = ndk::SharedRefBase::make(*this); - ASSERT_NE(nullptr, ind_satellite.get()); - - satellite->setResponseFunctions(rsp_satellite, ind_satellite); - - // Assert IRadioConfig exists before testing - radio_config = config::IRadioConfig::fromBinder(ndk::SpAIBinder( - AServiceManager_waitForService("android.hardware.radio.config.IRadioConfig/default"))); - ASSERT_NE(nullptr, radio_config.get()); -} - -/* - * Test IRadioSatellite.getCapabilities() for the response returned. - */ -TEST_P(RadioSatelliteTest, getCapabilities) { - if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { - ALOGI("Skipping getCapabilities because satellite is not supported in device"); - return; - } else { - ALOGI("Running getCapabilities because satellite is supported in device"); - } - - serial = GetRandomSerialNumber(); - ndk::ScopedAStatus res = satellite->getCapabilities(serial); - ASSERT_OK(res); - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); - EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); - - ALOGI("getCapabilities, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str()); - - ASSERT_TRUE(CheckAnyOfErrors( - rsp_satellite->rspInfo.error, - {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, - RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, - RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, - RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, - RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, - RadioError::SYSTEM_ERR})); -} - -/* - * Test IRadioSatellite.setPower() for the response returned. - */ -TEST_P(RadioSatelliteTest, setPower) { - if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { - ALOGI("Skipping setPower because satellite is not supported in device"); - return; - } else { - ALOGI("Running setPower because satellite is supported in device"); - } - - serial = GetRandomSerialNumber(); - ndk::ScopedAStatus res = satellite->setPower(serial, true); - ASSERT_OK(res); - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); - EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); - - ALOGI("setPower, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str()); - - ASSERT_TRUE(CheckAnyOfErrors( - rsp_satellite->rspInfo.error, - {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, - RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, - RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, - RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, - RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, - RadioError::SYSTEM_ERR})); -} - -/* - * Test IRadioSatellite.getPowerSate() for the response returned. - */ -TEST_P(RadioSatelliteTest, getPowerSate) { - if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { - ALOGI("Skipping getPowerSate because satellite is not supported in device"); - return; - } else { - ALOGI("Running getPowerSate because satellite is supported in device"); - } - - serial = GetRandomSerialNumber(); - ndk::ScopedAStatus res = satellite->getPowerState(serial); - ASSERT_OK(res); - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); - EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); - - ALOGI("getPowerSate, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str()); - - ASSERT_TRUE(CheckAnyOfErrors( - rsp_satellite->rspInfo.error, - {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, - RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, - RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, - RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, - RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, - RadioError::SYSTEM_ERR})); -} - -/* - * Test IRadioSatellite.provisionService() for the response returned. - */ -TEST_P(RadioSatelliteTest, provisionService) { - if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { - ALOGI("Skipping provisionService because satellite is not supported in device"); - return; - } else { - ALOGI("Running provisionService because satellite is supported in device"); - } - - serial = GetRandomSerialNumber(); - std::string imei = "imei"; - std::string msisdn = "msisdn"; - std::string imsi = "imsi"; - const std::vector features{ - SatelliteFeature::SOS_SMS, SatelliteFeature::EMERGENCY_SMS, SatelliteFeature::SMS}; - ndk::ScopedAStatus res = satellite->provisionService(serial, imei, msisdn, imsi, features); - ASSERT_OK(res); - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); - EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); - - ALOGI("provisionService, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str()); - - ASSERT_TRUE(CheckAnyOfErrors(rsp_satellite->rspInfo.error, - {RadioError::NONE, - RadioError::ABORTED, - RadioError::ACCESS_BARRED, - RadioError::CANCELLED, - RadioError::FEATURE_NOT_SUPPORTED, - RadioError::INTERNAL_ERR, - RadioError::INVALID_ARGUMENTS, - RadioError::INVALID_MODEM_STATE, - RadioError::INVALID_SIM_STATE, - RadioError::INVALID_STATE, - RadioError::MODEM_ERR, - RadioError::MODEM_INCOMPATIBLE, - RadioError::NETWORK_ERR, - RadioError::NETWORK_NOT_READY, - RadioError::NETWORK_REJECT, - RadioError::NETWORK_TIMEOUT, - RadioError::NO_MEMORY, - RadioError::NO_NETWORK_FOUND, - RadioError::NO_RESOURCES, - RadioError::NO_SATELLITE_SIGNAL, - RadioError::NO_SUBSCRIPTION, - RadioError::OPERATION_NOT_ALLOWED, - RadioError::RADIO_NOT_AVAILABLE, - RadioError::RADIO_TECHNOLOGY_NOT_SUPPORTED, - RadioError::REQUEST_NOT_SUPPORTED, - RadioError::REQUEST_RATE_LIMITED, - RadioError::SIM_ABSENT, - RadioError::SIM_BUSY, - RadioError::SIM_ERR, - RadioError::SIM_FULL, - RadioError::SUBSCRIBER_NOT_AUTHORIZED, - RadioError::SYSTEM_ERR})); -} - -/* - * Test IRadioSatellite.addAllowedSatelliteContacts() for the response returned. - */ -TEST_P(RadioSatelliteTest, addAllowedSatelliteContacts) { - if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { - ALOGI("Skipping addAllowedSatelliteContacts because satellite is not supported in device"); - return; - } else { - ALOGI("Running addAllowedSatelliteContacts because satellite is supported in device"); - } - - serial = GetRandomSerialNumber(); - const std::vector contacts = {"contact 1", "contact 2"}; - ndk::ScopedAStatus res = satellite->addAllowedSatelliteContacts(serial, contacts); - ASSERT_OK(res); - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); - EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); - - ALOGI("addAllowedSatelliteContacts, rspInfo.error = %s\n", - toString(rsp_satellite->rspInfo.error).c_str()); - - ASSERT_TRUE(CheckAnyOfErrors(rsp_satellite->rspInfo.error, - {RadioError::NONE, - RadioError::ABORTED, - RadioError::ACCESS_BARRED, - RadioError::CANCELLED, - RadioError::INTERNAL_ERR, - RadioError::INVALID_ARGUMENTS, - RadioError::INVALID_CONTACT, - RadioError::INVALID_MODEM_STATE, - RadioError::INVALID_SIM_STATE, - RadioError::INVALID_STATE, - RadioError::MODEM_ERR, - RadioError::NETWORK_ERR, - RadioError::NETWORK_NOT_READY, - RadioError::NETWORK_REJECT, - RadioError::NETWORK_TIMEOUT, - RadioError::NO_MEMORY, - RadioError::NO_NETWORK_FOUND, - RadioError::NO_RESOURCES, - RadioError::NO_SATELLITE_SIGNAL, - RadioError::NO_SUBSCRIPTION, - RadioError::NOT_SUFFICIENT_ACCOUNT_BALANCE, - RadioError::OPERATION_NOT_ALLOWED, - RadioError::RADIO_NOT_AVAILABLE, - RadioError::REQUEST_NOT_SUPPORTED, - RadioError::REQUEST_RATE_LIMITED, - RadioError::SIM_ABSENT, - RadioError::SIM_BUSY, - RadioError::SIM_ERR, - RadioError::SIM_FULL, - RadioError::SYSTEM_ERR, - RadioError::UNIDENTIFIED_SUBSCRIBER})); -} - -/* - * Test IRadioSatellite.removeAllowedSatelliteContacts() for the response returned. - */ -TEST_P(RadioSatelliteTest, removeAllowedSatelliteContacts) { - if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { - ALOGI("Skipping removeAllowedSatelliteContacts because satellite is not supported in " - "device"); - return; - } else { - ALOGI("Running removeAllowedSatelliteContacts because satellite is supported in device"); - } - - serial = GetRandomSerialNumber(); - const std::vector contacts = {"contact 1", "contact 2"}; - ndk::ScopedAStatus res = satellite->removeAllowedSatelliteContacts(serial, contacts); - ASSERT_OK(res); - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); - EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); - - ALOGI("removeAllowedSatelliteContacts, rspInfo.error = %s\n", - toString(rsp_satellite->rspInfo.error).c_str()); - - ASSERT_TRUE(CheckAnyOfErrors(rsp_satellite->rspInfo.error, - {RadioError::NONE, - RadioError::ABORTED, - RadioError::ACCESS_BARRED, - RadioError::CANCELLED, - RadioError::INTERNAL_ERR, - RadioError::INVALID_ARGUMENTS, - RadioError::INVALID_CONTACT, - RadioError::INVALID_MODEM_STATE, - RadioError::INVALID_SIM_STATE, - RadioError::INVALID_STATE, - RadioError::MODEM_ERR, - RadioError::NETWORK_ERR, - RadioError::NETWORK_NOT_READY, - RadioError::NETWORK_REJECT, - RadioError::NETWORK_TIMEOUT, - RadioError::NO_MEMORY, - RadioError::NO_NETWORK_FOUND, - RadioError::NO_RESOURCES, - RadioError::NO_SATELLITE_SIGNAL, - RadioError::NO_SUBSCRIPTION, - RadioError::NOT_SUFFICIENT_ACCOUNT_BALANCE, - RadioError::OPERATION_NOT_ALLOWED, - RadioError::RADIO_NOT_AVAILABLE, - RadioError::REQUEST_NOT_SUPPORTED, - RadioError::REQUEST_RATE_LIMITED, - RadioError::SIM_ABSENT, - RadioError::SIM_BUSY, - RadioError::SIM_ERR, - RadioError::SIM_FULL, - RadioError::SYSTEM_ERR, - RadioError::UNIDENTIFIED_SUBSCRIBER})); -} - -/* - * Test IRadioSatellite.sendMessages() for the response returned. - */ -TEST_P(RadioSatelliteTest, sendMessages) { - if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { - ALOGI("Skipping sendMessages because satellite is not supported in device"); - return; - } else { - ALOGI("Running sendMessages because satellite is supported in device"); - } - - serial = GetRandomSerialNumber(); - const std::vector messages = {"message 1", "message 2"}; - std::string destination = "0123456789"; - ndk::ScopedAStatus res = satellite->sendMessages(serial, messages, destination, 1.0, 2.0); - ASSERT_OK(res); - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); - EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); - - ALOGI("sendMessages, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str()); - - ASSERT_TRUE(CheckAnyOfErrors(rsp_satellite->rspInfo.error, - {RadioError::NONE, - RadioError::ABORTED, - RadioError::ACCESS_BARRED, - RadioError::BLOCKED_DUE_TO_CALL, - RadioError::CANCELLED, - RadioError::ENCODING_ERR, - RadioError::ENCODING_NOT_SUPPORTED, - RadioError::INTERNAL_ERR, - RadioError::INVALID_ARGUMENTS, - RadioError::INVALID_MODEM_STATE, - RadioError::INVALID_SIM_STATE, - RadioError::INVALID_SMS_FORMAT, - RadioError::INVALID_STATE, - RadioError::MODEM_ERR, - RadioError::NETWORK_ERR, - RadioError::NETWORK_NOT_READY, - RadioError::NETWORK_REJECT, - RadioError::NETWORK_TIMEOUT, - RadioError::NO_MEMORY, - RadioError::NO_NETWORK_FOUND, - RadioError::NO_RESOURCES, - RadioError::NO_SMS_TO_ACK, - RadioError::NO_SATELLITE_SIGNAL, - RadioError::NO_SUBSCRIPTION, - RadioError::NOT_SUFFICIENT_ACCOUNT_BALANCE, - RadioError::OPERATION_NOT_ALLOWED, - RadioError::RADIO_NOT_AVAILABLE, - RadioError::REQUEST_NOT_SUPPORTED, - RadioError::REQUEST_RATE_LIMITED, - RadioError::SIM_ABSENT, - RadioError::SIM_BUSY, - RadioError::SIM_ERR, - RadioError::SIM_FULL, - RadioError::SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED, - RadioError::SMS_SEND_FAIL_RETRY, - RadioError::SYSTEM_ERR, - RadioError::SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL, - RadioError::UNIDENTIFIED_SUBSCRIBER})); -} - -/* - * Test IRadioSatellite.getPendingMessages() for the response returned. - */ -TEST_P(RadioSatelliteTest, getPendingMessages) { - if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { - ALOGI("Skipping getPendingMessages because satellite is not supported in device"); - return; - } else { - ALOGI("Running getPendingMessages because satellite is supported in device"); - } - - serial = GetRandomSerialNumber(); - ndk::ScopedAStatus res = satellite->getPendingMessages(serial); - ASSERT_OK(res); - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); - EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); - - ALOGI("getPendingMessages, rspInfo.error = %s\n", - toString(rsp_satellite->rspInfo.error).c_str()); - - ASSERT_TRUE(CheckAnyOfErrors(rsp_satellite->rspInfo.error, - {RadioError::NONE, - RadioError::ABORTED, - RadioError::ACCESS_BARRED, - RadioError::BLOCKED_DUE_TO_CALL, - RadioError::CANCELLED, - RadioError::ENCODING_ERR, - RadioError::ENCODING_NOT_SUPPORTED, - RadioError::INTERNAL_ERR, - RadioError::INVALID_ARGUMENTS, - RadioError::INVALID_MODEM_STATE, - RadioError::INVALID_SIM_STATE, - RadioError::INVALID_SMS_FORMAT, - RadioError::INVALID_STATE, - RadioError::MODEM_ERR, - RadioError::NETWORK_ERR, - RadioError::NETWORK_NOT_READY, - RadioError::NETWORK_REJECT, - RadioError::NETWORK_TIMEOUT, - RadioError::NO_MEMORY, - RadioError::NO_NETWORK_FOUND, - RadioError::NO_RESOURCES, - RadioError::NO_SMS_TO_ACK, - RadioError::NO_SATELLITE_SIGNAL, - RadioError::NO_SUBSCRIPTION, - RadioError::NOT_SUFFICIENT_ACCOUNT_BALANCE, - RadioError::OPERATION_NOT_ALLOWED, - RadioError::RADIO_NOT_AVAILABLE, - RadioError::REQUEST_NOT_SUPPORTED, - RadioError::REQUEST_RATE_LIMITED, - RadioError::SIM_ABSENT, - RadioError::SIM_BUSY, - RadioError::SIM_ERR, - RadioError::SIM_FULL, - RadioError::SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED, - RadioError::SYSTEM_ERR, - RadioError::SWITCHED_FROM_SATELLITE_TO_TERRESTRIAL})); -} - -/* - * Test IRadioSatellite.getSatelliteMode() for the response returned. - */ -TEST_P(RadioSatelliteTest, getSatelliteMode) { - if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { - ALOGI("Skipping getSatelliteMode because satellite is not supported in device"); - return; - } else { - ALOGI("Running getSatelliteMode because satellite is supported in device"); - } - - serial = GetRandomSerialNumber(); - ndk::ScopedAStatus res = satellite->getSatelliteMode(serial); - ASSERT_OK(res); - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); - EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); - - ALOGI("getSatelliteMode, rspInfo.error = %s\n", toString(rsp_satellite->rspInfo.error).c_str()); - - ASSERT_TRUE(CheckAnyOfErrors( - rsp_satellite->rspInfo.error, - {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, - RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, - RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, - RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, - RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, - RadioError::SYSTEM_ERR})); -} - -/* - * Test IRadioSatellite.setIndicationFilter() for the response returned. - */ -TEST_P(RadioSatelliteTest, setIndicationFilter) { - if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { - ALOGI("Skipping setIndicationFilter because satellite is not supported in device"); - return; - } else { - ALOGI("Running setIndicationFilter because satellite is supported in device"); - } - - serial = GetRandomSerialNumber(); - ndk::ScopedAStatus res = satellite->setIndicationFilter(serial, 0); - ASSERT_OK(res); - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); - EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); - - ALOGI("setIndicationFilter, rspInfo.error = %s\n", - toString(rsp_satellite->rspInfo.error).c_str()); - - ASSERT_TRUE(CheckAnyOfErrors( - rsp_satellite->rspInfo.error, - {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, - RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, - RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, - RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, - RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, - RadioError::SYSTEM_ERR})); -} - -/* - * Test IRadioSatellite.startSendingSatellitePointingInfo() for the response returned. - */ -TEST_P(RadioSatelliteTest, startSendingSatellitePointingInfo) { - if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { - ALOGI("Skipping startSendingSatellitePointingInfo because satellite is not supported in " - "device"); - return; - } else { - ALOGI("Running startSendingSatellitePointingInfo because satellite is supported in device"); - } - - serial = GetRandomSerialNumber(); - ndk::ScopedAStatus res = satellite->startSendingSatellitePointingInfo(serial); - ASSERT_OK(res); - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); - EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); - - ALOGI("startSendingSatellitePointingInfo, rspInfo.error = %s\n", - toString(rsp_satellite->rspInfo.error).c_str()); - - ASSERT_TRUE(CheckAnyOfErrors( - rsp_satellite->rspInfo.error, - {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, - RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, - RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, - RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, - RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, - RadioError::SYSTEM_ERR})); -} - -/* - * Test IRadioSatellite.stopSatelliteLocationUpdate() for the response returned. - */ -TEST_P(RadioSatelliteTest, stopSatelliteLocationUpdate) { - if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { - ALOGI("Skipping stopSendingSatellitePointingInfo because satellite is not supported in " - "device"); - return; - } else { - ALOGI("Running stopSendingSatellitePointingInfo because satellite is supported in device"); - } - - serial = GetRandomSerialNumber(); - ndk::ScopedAStatus res = satellite->stopSendingSatellitePointingInfo(serial); - ASSERT_OK(res); - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); - EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); - - ALOGI("stopSendingSatellitePointingInfo, rspInfo.error = %s\n", - toString(rsp_satellite->rspInfo.error).c_str()); - - ASSERT_TRUE(CheckAnyOfErrors( - rsp_satellite->rspInfo.error, - {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, - RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, - RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, - RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, - RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, - RadioError::SYSTEM_ERR})); -} - -/* - * Test IRadioSatellite.getMaxCharactersPerTextMessage() for the response returned. - */ -TEST_P(RadioSatelliteTest, getMaxCharactersPerTextMessage) { - if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { - ALOGI("Skipping getMaxCharactersPerTextMessage because satellite is not supported in " - "device"); - return; - } else { - ALOGI("Running getMaxCharactersPerTextMessage because satellite is supported in device"); - } - - serial = GetRandomSerialNumber(); - ndk::ScopedAStatus res = satellite->getMaxCharactersPerTextMessage(serial); - ASSERT_OK(res); - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); - EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); - - ALOGI("getMaxCharactersPerTextMessage, rspInfo.error = %s\n", - toString(rsp_satellite->rspInfo.error).c_str()); - - ASSERT_TRUE(CheckAnyOfErrors( - rsp_satellite->rspInfo.error, - {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, - RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, - RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, - RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, - RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, - RadioError::SYSTEM_ERR})); -} - -/* - * Test IRadioSatellite.getTimeForNextSatelliteVisibility() for the response returned. - */ -TEST_P(RadioSatelliteTest, getTimeForNextSatelliteVisibility) { - if (!deviceSupportsFeature(FEATURE_TELEPHONY_SATELLITE)) { - ALOGI("Skipping getTimeForNextSatelliteVisibility because satellite is not supported in " - "device"); - return; - } else { - ALOGI("Running getTimeForNextSatelliteVisibility because satellite is supported in device"); - } - - serial = GetRandomSerialNumber(); - ndk::ScopedAStatus res = satellite->getTimeForNextSatelliteVisibility(serial); - ASSERT_OK(res); - EXPECT_EQ(std::cv_status::no_timeout, wait()); - EXPECT_EQ(RadioResponseType::SOLICITED, rsp_satellite->rspInfo.type); - EXPECT_EQ(serial, rsp_satellite->rspInfo.serial); - - ALOGI("getTimeForNextSatelliteVisibility, rspInfo.error = %s\n", - toString(rsp_satellite->rspInfo.error).c_str()); - - ASSERT_TRUE(CheckAnyOfErrors( - rsp_satellite->rspInfo.error, - {RadioError::NONE, RadioError::INTERNAL_ERR, RadioError::INVALID_ARGUMENTS, - RadioError::INVALID_MODEM_STATE, RadioError::INVALID_SIM_STATE, - RadioError::INVALID_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, - RadioError::NO_RESOURCES, RadioError::RADIO_NOT_AVAILABLE, - RadioError::REQUEST_NOT_SUPPORTED, RadioError::REQUEST_RATE_LIMITED, - RadioError::SYSTEM_ERR})); -} \ No newline at end of file diff --git a/radio/aidl/vts/radio_satellite_utils.h b/radio/aidl/vts/radio_satellite_utils.h deleted file mode 100644 index 2b07ec5543..0000000000 --- a/radio/aidl/vts/radio_satellite_utils.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include -#include -#include - -#include "radio_aidl_hal_utils.h" - -using namespace aidl::android::hardware::radio::satellite; - -class RadioSatelliteTest; - -/* Callback class for Satellite response */ -class RadioSatelliteResponse : public BnRadioSatelliteResponse { - protected: - RadioServiceTest& parent_satellite; - - public: - RadioSatelliteResponse(RadioServiceTest& parent_satellite); - virtual ~RadioSatelliteResponse() = default; - - RadioResponseInfo rspInfo; - - virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override; - - virtual ndk::ScopedAStatus getCapabilitiesResponse( - const RadioResponseInfo& info, const SatelliteCapabilities& capabilities) override; - - virtual ndk::ScopedAStatus setPowerResponse(const RadioResponseInfo& info) override; - - virtual ndk::ScopedAStatus getPowerStateResponse(const RadioResponseInfo& info, - bool on) override; - - virtual ndk::ScopedAStatus provisionServiceResponse(const RadioResponseInfo& info, - bool provisioned) override; - - virtual ndk::ScopedAStatus addAllowedSatelliteContactsResponse( - const RadioResponseInfo& info) override; - - virtual ndk::ScopedAStatus removeAllowedSatelliteContactsResponse( - const RadioResponseInfo& info) override; - - virtual ndk::ScopedAStatus sendMessagesResponse(const RadioResponseInfo& info) override; - - virtual ndk::ScopedAStatus getPendingMessagesResponse( - const RadioResponseInfo& info, const std::vector& /*messages*/) override; - - virtual ndk::ScopedAStatus getSatelliteModeResponse( - const RadioResponseInfo& info, SatelliteMode mode, - satellite::NTRadioTechnology technology) override; - - virtual ndk::ScopedAStatus setIndicationFilterResponse(const RadioResponseInfo& info) override; - - virtual ndk::ScopedAStatus startSendingSatellitePointingInfoResponse( - const RadioResponseInfo& info) override; - - virtual ndk::ScopedAStatus stopSendingSatellitePointingInfoResponse( - const RadioResponseInfo& info) override; - - virtual ndk::ScopedAStatus getMaxCharactersPerTextMessageResponse(const RadioResponseInfo& info, - int32_t charLimit) override; - - virtual ndk::ScopedAStatus getTimeForNextSatelliteVisibilityResponse( - const RadioResponseInfo& info, int32_t timeInSeconds) override; -}; - -/* Callback class for Satellite indication */ -class RadioSatelliteIndication : public BnRadioSatelliteIndication { - protected: - RadioServiceTest& parent_satellite; - - public: - RadioSatelliteIndication(RadioServiceTest& parent_satellite); - virtual ~RadioSatelliteIndication() = default; - - virtual ndk::ScopedAStatus onPendingMessageCount(RadioIndicationType type, - int32_t count) override; - - virtual ndk::ScopedAStatus onNewMessages(RadioIndicationType type, - const std::vector& messages) override; - - virtual ndk::ScopedAStatus onMessagesTransferComplete(RadioIndicationType type, - bool complete) override; - - virtual ndk::ScopedAStatus onSatellitePointingInfoChanged( - RadioIndicationType type, const PointingInfo& pointingInfo) override; - - virtual ndk::ScopedAStatus onSatelliteModeChanged(RadioIndicationType type, - SatelliteMode mode) override; - - virtual ndk::ScopedAStatus onSatelliteRadioTechnologyChanged( - RadioIndicationType type, satellite::NTRadioTechnology technology) override; - - virtual ndk::ScopedAStatus onProvisionStateChanged( - RadioIndicationType type, bool provisioned, - const std::vector& features) override; -}; - -// The main test class for AIDL Satellite. -class RadioSatelliteTest : public ::testing::TestWithParam, public RadioServiceTest { - public: - virtual void SetUp() override; - - /* Radio Satellite service handle */ - std::shared_ptr satellite; - /* Radio Satellite response handle */ - std::shared_ptr rsp_satellite; - /* Radio Satellite indication handle */ - std::shared_ptr ind_satellite; -}; From 6ced2e4258f0d98d3de66b3a0a8c429301083133 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Fri, 3 Mar 2023 20:37:20 -0800 Subject: [PATCH 793/998] Fix flakiness in DefaultVehicleHalTest. Test: atest DefaultVehicleHalTest Bug: 270225041 Change-Id: I1657ad038aac9e6a153aa458c13bd0720be23f1f --- .../impl/vhal/test/DefaultVehicleHalTest.cpp | 61 +++++++++---------- .../impl/vhal/test/MockVehicleCallback.cpp | 50 ++++++++++++--- .../aidl/impl/vhal/test/MockVehicleCallback.h | 4 ++ .../vhal/test/SubscriptionManagerTest.cpp | 14 ++++- 4 files changed, 86 insertions(+), 43 deletions(-) diff --git a/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp b/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp index 36fa5e6349..05e569ab8a 100644 --- a/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp +++ b/automotive/vehicle/aidl/impl/vhal/test/DefaultVehicleHalTest.cpp @@ -671,8 +671,8 @@ TEST_F(DefaultVehicleHalTest, testGetValuesNoReadPermission) { } TEST_F(DefaultVehicleHalTest, testGetValuesFinishBeforeTimeout) { - // timeout: 0.1s - int64_t timeout = 100000000; + // timeout: 1s + int64_t timeout = 1000000000; setTimeout(timeout); GetValueRequests requests; @@ -681,17 +681,15 @@ TEST_F(DefaultVehicleHalTest, testGetValuesFinishBeforeTimeout) { ASSERT_TRUE(getValuesTestCases(10, requests, expectedResults, expectedHardwareRequests).ok()); - // The response would be returned after 0.05s. - getHardware()->setSleepTime(timeout / 2); + // The response would be returned after 0.01s. + getHardware()->setSleepTime(timeout / 100); getHardware()->addGetValueResponses(expectedResults); auto status = getClient()->getValues(getCallbackClient(), requests); ASSERT_TRUE(status.isOk()) << "getValues failed: " << status.getMessage(); - // Wait for the response. - std::this_thread::sleep_for(std::chrono::nanoseconds(timeout)); - + ASSERT_TRUE(getCallback()->waitForGetValueResults(1, timeout)) << "no results in callback"; auto maybeGetValueResults = getCallback()->nextGetValueResults(); ASSERT_TRUE(maybeGetValueResults.has_value()) << "no results in callback"; EXPECT_EQ(maybeGetValueResults.value().payloads, expectedResults) << "results mismatch"; @@ -699,8 +697,8 @@ TEST_F(DefaultVehicleHalTest, testGetValuesFinishBeforeTimeout) { } TEST_F(DefaultVehicleHalTest, testGetValuesFinishAfterTimeout) { - // timeout: 0.1s - int64_t timeout = 100000000; + // timeout: 0.01s + int64_t timeout = 10000000; setTimeout(timeout); GetValueRequests requests; @@ -709,17 +707,14 @@ TEST_F(DefaultVehicleHalTest, testGetValuesFinishAfterTimeout) { ASSERT_TRUE(getValuesTestCases(10, requests, expectedResults, expectedHardwareRequests).ok()); - // The response would be returned after 0.2s. - getHardware()->setSleepTime(timeout * 2); + // The response would be returned after 0.1s. + getHardware()->setSleepTime(timeout * 10); getHardware()->addGetValueResponses(expectedResults); auto status = getClient()->getValues(getCallbackClient(), requests); ASSERT_TRUE(status.isOk()) << "getValues failed: " << status.getMessage(); - // Wait for the response. - std::this_thread::sleep_for(std::chrono::nanoseconds(timeout * 5)); - for (size_t i = 0; i < expectedResults.size(); i++) { expectedResults[i] = { .requestId = expectedResults[i].requestId, @@ -728,6 +723,8 @@ TEST_F(DefaultVehicleHalTest, testGetValuesFinishAfterTimeout) { }; } + ASSERT_TRUE(getCallback()->waitForGetValueResults(1, timeout * 100)) + << "no results in callback"; auto maybeGetValueResults = getCallback()->nextGetValueResults(); ASSERT_TRUE(maybeGetValueResults.has_value()) << "no results in callback"; ASSERT_THAT(maybeGetValueResults.value().payloads, UnorderedElementsAreArray(expectedResults)) @@ -960,8 +957,8 @@ TEST_P(SetValuesInvalidRequestTest, testSetValuesInvalidRequest) { } TEST_F(DefaultVehicleHalTest, testSetValuesFinishBeforeTimeout) { - // timeout: 0.1s - int64_t timeout = 100000000; + // timeout: 1s + int64_t timeout = 1000000000; setTimeout(timeout); SetValueRequests requests; @@ -970,17 +967,15 @@ TEST_F(DefaultVehicleHalTest, testSetValuesFinishBeforeTimeout) { ASSERT_TRUE(setValuesTestCases(10, requests, expectedResults, expectedHardwareRequests).ok()); - // The response would be returned after 0.05s. - getHardware()->setSleepTime(timeout / 2); + // The response would be returned after 0.01s. + getHardware()->setSleepTime(timeout / 100); getHardware()->addSetValueResponses(expectedResults); auto status = getClient()->setValues(getCallbackClient(), requests); ASSERT_TRUE(status.isOk()) << "setValues failed: " << status.getMessage(); - // Wait for the response. - std::this_thread::sleep_for(std::chrono::nanoseconds(timeout)); - + ASSERT_TRUE(getCallback()->waitForSetValueResults(1, timeout)) << "no set value results"; auto maybeSetValueResults = getCallback()->nextSetValueResults(); ASSERT_TRUE(maybeSetValueResults.has_value()) << "no results in callback"; EXPECT_EQ(maybeSetValueResults.value().payloads, expectedResults) << "results mismatch"; @@ -988,8 +983,8 @@ TEST_F(DefaultVehicleHalTest, testSetValuesFinishBeforeTimeout) { } TEST_F(DefaultVehicleHalTest, testSetValuesFinishAfterTimeout) { - // timeout: 0.1s - int64_t timeout = 100000000; + // timeout: 0.01s + int64_t timeout = 10000000; setTimeout(timeout); SetValueRequests requests; @@ -998,17 +993,14 @@ TEST_F(DefaultVehicleHalTest, testSetValuesFinishAfterTimeout) { ASSERT_TRUE(setValuesTestCases(10, requests, expectedResults, expectedHardwareRequests).ok()); - // The response would be returned after 0.2s. - getHardware()->setSleepTime(timeout * 2); + // The response would be returned after 0.1s. + getHardware()->setSleepTime(timeout * 10); getHardware()->addSetValueResponses(expectedResults); auto status = getClient()->setValues(getCallbackClient(), requests); ASSERT_TRUE(status.isOk()) << "setValues failed: " << status.getMessage(); - // Wait for the response. - std::this_thread::sleep_for(std::chrono::nanoseconds(timeout * 5)); - for (size_t i = 0; i < expectedResults.size(); i++) { expectedResults[i] = { .requestId = expectedResults[i].requestId, @@ -1016,6 +1008,7 @@ TEST_F(DefaultVehicleHalTest, testSetValuesFinishAfterTimeout) { }; } + ASSERT_TRUE(getCallback()->waitForSetValueResults(1, timeout * 100)) << "no set value results"; auto maybeSetValueResults = getCallback()->nextSetValueResults(); ASSERT_TRUE(maybeSetValueResults.has_value()) << "no results in callback"; ASSERT_THAT(maybeSetValueResults.value().payloads, UnorderedElementsAreArray(expectedResults)) @@ -1456,7 +1449,7 @@ TEST_F(DefaultVehicleHalTest, testUnsubscribeContinuous) { std::vector options = { { .propId = GLOBAL_CONTINUOUS_PROP, - .sampleRate = 20.0, + .sampleRate = 100.0, }, }; @@ -1469,16 +1462,20 @@ TEST_F(DefaultVehicleHalTest, testUnsubscribeContinuous) { ASSERT_TRUE(status.isOk()) << "unsubscribe failed: " << status.getMessage(); + // Wait for the last events to come. + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + // Clear existing events. while (getCallback()->nextOnPropertyEventResults().has_value()) { // Do nothing. } - // Wait for a while, make sure no new events are generated. + // Wait for a while, make sure no new events are generated. If still subscribed, this should + // generate around 10 events. std::this_thread::sleep_for(std::chrono::milliseconds(100)); - ASSERT_FALSE(getCallback()->nextOnPropertyEventResults().has_value()) - << "No property event should be generated after unsubscription"; + ASSERT_EQ(getCallback()->countOnPropertyEventResults(), 0u) + << "Property event generation must stop after unsubscription"; } class SubscribeInvalidOptionsTest diff --git a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.cpp b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.cpp index 0e463571d9..f51ce5cb39 100644 --- a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.cpp +++ b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.cpp @@ -16,6 +16,9 @@ #include "MockVehicleCallback.h" +#include +#include + namespace android { namespace hardware { namespace automotive { @@ -27,6 +30,7 @@ using ::aidl::android::hardware::automotive::vehicle::GetValueResults; using ::aidl::android::hardware::automotive::vehicle::SetValueResults; using ::aidl::android::hardware::automotive::vehicle::VehiclePropErrors; using ::aidl::android::hardware::automotive::vehicle::VehiclePropValues; +using ::android::base::ScopedLockAssertion; using ::ndk::ScopedAStatus; using ::ndk::ScopedFileDescriptor; @@ -46,21 +50,35 @@ static ScopedAStatus storeResults(const T& results, std::list* storedResults) } // namespace ScopedAStatus MockVehicleCallback::onGetValues(const GetValueResults& results) { - std::scoped_lock lockGuard(mLock); - return storeResults(results, &mGetValueResults); + ScopedAStatus result; + { + std::scoped_lock lockGuard(mLock); + result = storeResults(results, &mGetValueResults); + } + mCond.notify_all(); + return result; } ScopedAStatus MockVehicleCallback::onSetValues(const SetValueResults& results) { - std::scoped_lock lockGuard(mLock); - return storeResults(results, &mSetValueResults); + ScopedAStatus result; + { + std::scoped_lock lockGuard(mLock); + result = storeResults(results, &mSetValueResults); + } + mCond.notify_all(); + return result; } ScopedAStatus MockVehicleCallback::onPropertyEvent(const VehiclePropValues& results, int32_t sharedMemoryFileCount) { - std::scoped_lock lockGuard(mLock); - - mSharedMemoryFileCount = sharedMemoryFileCount; - return storeResults(results, &mOnPropertyEventResults); + ScopedAStatus result; + { + std::scoped_lock lockGuard(mLock); + mSharedMemoryFileCount = sharedMemoryFileCount; + result = storeResults(results, &mOnPropertyEventResults); + } + mCond.notify_all(); + return result; } ScopedAStatus MockVehicleCallback::onPropertySetError(const VehiclePropErrors&) { @@ -87,6 +105,22 @@ size_t MockVehicleCallback::countOnPropertyEventResults() { return mOnPropertyEventResults.size(); } +bool MockVehicleCallback::waitForSetValueResults(size_t size, size_t timeoutInNano) { + std::unique_lock lk(mLock); + return mCond.wait_for(lk, std::chrono::nanoseconds(timeoutInNano), [this, size] { + ScopedLockAssertion lockAssertion(mLock); + return mSetValueResults.size() >= size; + }); +} + +bool MockVehicleCallback::waitForGetValueResults(size_t size, size_t timeoutInNano) { + std::unique_lock lk(mLock); + return mCond.wait_for(lk, std::chrono::nanoseconds(timeoutInNano), [this, size] { + ScopedLockAssertion lockAssertion(mLock); + return mGetValueResults.size() >= size; + }); +} + } // namespace vehicle } // namespace automotive } // namespace hardware diff --git a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.h b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.h index 0faaa1f670..f17b273b18 100644 --- a/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.h +++ b/automotive/vehicle/aidl/impl/vhal/test/MockVehicleCallback.h @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -63,9 +64,12 @@ class MockVehicleCallback final std::optional nextOnPropertyEventResults(); size_t countOnPropertyEventResults(); + bool waitForSetValueResults(size_t size, size_t timeoutInNano); + bool waitForGetValueResults(size_t size, size_t timeoutInNano); private: std::mutex mLock; + std::condition_variable mCond; std::list mGetValueResults GUARDED_BY(mLock); std::list mSetValueResults diff --git a/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp b/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp index eb3c663209..cb8c8d1514 100644 --- a/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp +++ b/automotive/vehicle/aidl/impl/vhal/test/SubscriptionManagerTest.cpp @@ -231,7 +231,7 @@ TEST_F(SubscriptionManagerTest, testUnsubscribeGlobalContinuous) { std::vector options = {{ .propId = 0, .areaIds = {0}, - .sampleRate = 10.0, + .sampleRate = 100.0, }}; auto result = getManager()->subscribe(getCallbackClient(), options, true); @@ -240,11 +240,13 @@ TEST_F(SubscriptionManagerTest, testUnsubscribeGlobalContinuous) { result = getManager()->unsubscribe(getCallbackClient()->asBinder().get()); ASSERT_TRUE(result.ok()) << "failed to unsubscribe: " << result.error().message(); + // Wait for the last events to come. + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + clearEvents(); - std::this_thread::sleep_for(std::chrono::milliseconds(200)); + std::this_thread::sleep_for(std::chrono::milliseconds(100)); - // Theoretically trigger 10 times, but check for at least 9 times to be stable. ASSERT_TRUE(getEvents().empty()); } @@ -269,6 +271,9 @@ TEST_F(SubscriptionManagerTest, testUnsubscribeMultipleAreas) { std::vector({0})); ASSERT_TRUE(result.ok()) << "failed to unsubscribe: " << result.error().message(); + // Wait for the last events to come. + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + clearEvents(); std::this_thread::sleep_for(std::chrono::seconds(1)); @@ -301,6 +306,9 @@ TEST_F(SubscriptionManagerTest, testUnsubscribeByCallback) { result = getManager()->unsubscribe(getCallbackClient()->asBinder().get()); ASSERT_TRUE(result.ok()) << "failed to unsubscribe: " << result.error().message(); + // Wait for the last events to come. + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + clearEvents(); std::this_thread::sleep_for(std::chrono::seconds(1)); From 302ab9efc301a78c6ed28f1f62eba1d23af4658e Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Fri, 17 Feb 2023 18:21:12 -0800 Subject: [PATCH 794/998] Add trace to measure VHAL performance. Test: Manually run on emulator. Bug: 269669729 Change-Id: I56b160b624c43d29aa85fffd28d1611fe63f7efc --- .../fake_impl/hardware/src/FakeVehicleHardware.cpp | 10 ++++++++++ .../vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index 00ebdda372..7b4fa164e4 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -15,6 +15,7 @@ */ #define LOG_TAG "FakeVehicleHardware" +#define ATRACE_TAG ATRACE_TAG_HAL #define FAKE_VEHICLEHARDWARE_DEBUG false // STOPSHIP if true. #include "FakeVehicleHardware.h" @@ -33,6 +34,7 @@ #include #include #include +#include #include #include @@ -1628,11 +1630,15 @@ void FakeVehicleHardware::PendingRequestHandler, std::vector> callbackToResults; for (const auto& rwc : mRequests.flush()) { + ATRACE_BEGIN("FakeVehicleHardware:handleGetValueRequest"); auto result = mHardware->handleGetValueRequest(rwc.request); + ATRACE_END(); callbackToResults[rwc.callback].push_back(std::move(result)); } for (const auto& [callback, results] : callbackToResults) { + ATRACE_BEGIN("FakeVehicleHardware:call get value result callback"); (*callback)(std::move(results)); + ATRACE_END(); } } @@ -1642,11 +1648,15 @@ void FakeVehicleHardware::PendingRequestHandler, std::vector> callbackToResults; for (const auto& rwc : mRequests.flush()) { + ATRACE_BEGIN("FakeVehicleHardware:handleSetValueRequest"); auto result = mHardware->handleSetValueRequest(rwc.request); + ATRACE_END(); callbackToResults[rwc.callback].push_back(std::move(result)); } for (const auto& [callback, results] : callbackToResults) { + ATRACE_BEGIN("FakeVehicleHardware:call set value result callback"); (*callback)(std::move(results)); + ATRACE_END(); } } diff --git a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp index 4a4e023074..a7ac1b4309 100644 --- a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp +++ b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp @@ -15,6 +15,7 @@ */ #define LOG_TAG "DefaultVehicleHal" +#define ATRACE_TAG ATRACE_TAG_HAL #include @@ -28,6 +29,7 @@ #include #include #include +#include #include #include @@ -350,6 +352,7 @@ Result DefaultVehicleHal::checkProperty(const VehiclePropValue& propValue) ScopedAStatus DefaultVehicleHal::getValues(const CallbackType& callback, const GetValueRequests& requests) { + ATRACE_CALL(); if (callback == nullptr) { return ScopedAStatus::fromExceptionCode(EX_NULL_POINTER); } @@ -436,6 +439,7 @@ ScopedAStatus DefaultVehicleHal::getValues(const CallbackType& callback, ScopedAStatus DefaultVehicleHal::setValues(const CallbackType& callback, const SetValueRequests& requests) { + ATRACE_CALL(); if (callback == nullptr) { return ScopedAStatus::fromExceptionCode(EX_NULL_POINTER); } From 39b19857d4a7fa02d5d39f8b10bdca5abf04214b Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Thu, 12 Jan 2023 16:20:11 -0800 Subject: [PATCH 795/998] Specify a eth interface for grpc connection. When enabling wifi on seahawk, the main network interface changes so we need to explicitly specify the eth interface we want to use for our grpc connection. Note that using setsockopt requires NET_RAW permission which is only granted to limited apps. As a result, selinux permissive mode is required for this CL to work. Test: Manual test on seahawk, verify grpc is connected okay. Bug: 261108682 Change-Id: I95c9f796bf40226b612edf284188ffc6d095086f --- .../remoteaccess/hal/default/Android.bp | 10 +++- .../default/src/BindToDeviceSocketMutator.cpp | 57 +++++++++++++++++++ .../default/src/BindToDeviceSocketMutator.h | 35 ++++++++++++ .../hal/default/src/RemoteAccessImpl.cpp | 35 ++++++++---- 4 files changed, 126 insertions(+), 11 deletions(-) create mode 100644 automotive/remoteaccess/hal/default/src/BindToDeviceSocketMutator.cpp create mode 100644 automotive/remoteaccess/hal/default/src/BindToDeviceSocketMutator.h diff --git a/automotive/remoteaccess/hal/default/Android.bp b/automotive/remoteaccess/hal/default/Android.bp index f27b8f86e6..bfab1ed698 100644 --- a/automotive/remoteaccess/hal/default/Android.bp +++ b/automotive/remoteaccess/hal/default/Android.bp @@ -22,10 +22,17 @@ cc_defaults { name: "remote-access-hal-defaults", vendor: true, relative_install_path: "hw", - srcs: ["src/RemoteAccessImpl.cpp"], + srcs: [ + "src/RemoteAccessImpl.cpp", + "src/BindToDeviceSocketMutator.cpp", + ], whole_static_libs: [ "RemoteAccessService", ], + static_libs: [ + "android.hardware.automotive.can@libnetdevice", + "libnl++", + ], shared_libs: [ "libbase", "libbinder_ndk", @@ -59,6 +66,7 @@ cc_binary { init_rc: ["remoteaccess-tcu-test-service.rc"], cflags: [ "-DGRPC_SERVICE_ADDRESS=\"10.10.10.1:50051\"", + "-DGRPC_SERVICE_IFNAME=\"eth1\"", ], } diff --git a/automotive/remoteaccess/hal/default/src/BindToDeviceSocketMutator.cpp b/automotive/remoteaccess/hal/default/src/BindToDeviceSocketMutator.cpp new file mode 100644 index 0000000000..c6a96deb88 --- /dev/null +++ b/automotive/remoteaccess/hal/default/src/BindToDeviceSocketMutator.cpp @@ -0,0 +1,57 @@ +/* + * 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. + */ + +#include "BindToDeviceSocketMutator.h" + +#include +#include +#include + +namespace android::hardware::automotive::remoteaccess { + +bool BindToDeviceSocketMutator::mutateFd(int fd) { + int ret = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, mIfname.c_str(), mIfname.size()); + if (ret != 0) { + PLOG(ERROR) << "Can't bind socket to interface " << mIfname; + return false; + } + return true; +} + +bool bind_to_device_mutator_mutate_fd(int fd, grpc_socket_mutator* mutator) { + BindToDeviceSocketMutator* bsm = (BindToDeviceSocketMutator*)mutator; + return bsm->mutateFd(fd); +} + +int bind_to_device_mutator_compare(grpc_socket_mutator* a, grpc_socket_mutator* b) { + return ((a) < (b) ? -1 : ((a) > (b) ? 1 : 0)); +} + +void bind_to_device_mutator_destroy(grpc_socket_mutator* mutator) { + BindToDeviceSocketMutator* bsm = (BindToDeviceSocketMutator*)mutator; + delete bsm; +} + +grpc_socket_mutator_vtable bind_to_device_mutator_vtable = {bind_to_device_mutator_mutate_fd, + bind_to_device_mutator_compare, + bind_to_device_mutator_destroy}; + +BindToDeviceSocketMutator::BindToDeviceSocketMutator(const std::string_view& interface_name) { + mIfname = interface_name; + grpc_socket_mutator_init(this, &bind_to_device_mutator_vtable); +} + +} // namespace android::hardware::automotive::remoteaccess diff --git a/automotive/remoteaccess/hal/default/src/BindToDeviceSocketMutator.h b/automotive/remoteaccess/hal/default/src/BindToDeviceSocketMutator.h new file mode 100644 index 0000000000..bafcc654c4 --- /dev/null +++ b/automotive/remoteaccess/hal/default/src/BindToDeviceSocketMutator.h @@ -0,0 +1,35 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include + +namespace android::hardware::automotive::remoteaccess { + +class BindToDeviceSocketMutator final : public grpc_socket_mutator { + public: + BindToDeviceSocketMutator(const std::string_view& interface_name); + + bool mutateFd(int fd); + + private: + std::string mIfname; +}; + +} // namespace android::hardware::automotive::remoteaccess diff --git a/automotive/remoteaccess/hal/default/src/RemoteAccessImpl.cpp b/automotive/remoteaccess/hal/default/src/RemoteAccessImpl.cpp index 8720c2f5c6..d5251410bb 100644 --- a/automotive/remoteaccess/hal/default/src/RemoteAccessImpl.cpp +++ b/automotive/remoteaccess/hal/default/src/RemoteAccessImpl.cpp @@ -18,45 +18,60 @@ #include "RemoteAccessService.h" +#include "BindToDeviceSocketMutator.h" + +#include #include #include #include +#include #include -#include constexpr char SERVICE_NAME[] = "android.hardware.automotive.remoteaccess.IRemoteAccess/default"; int main(int /* argc */, char* /* argv */[]) { - ALOGI("Registering RemoteAccessService as service..."); + LOG(INFO) << "Registering RemoteAccessService as service..."; #ifndef GRPC_SERVICE_ADDRESS - ALOGE("GRPC_SERVICE_ADDRESS is not defined, exiting"); + LOG(ERROR) << "GRPC_SERVICE_ADDRESS is not defined, exiting"; exit(1); #endif - auto channel = grpc::CreateChannel(GRPC_SERVICE_ADDRESS, grpc::InsecureChannelCredentials()); + grpc::ChannelArguments grpcargs = {}; + +#ifdef GRPC_SERVICE_IFNAME + grpcargs.SetSocketMutator( + new android::hardware::automotive::remoteaccess::BindToDeviceSocketMutator( + GRPC_SERVICE_IFNAME)); + LOG(DEBUG) << "GRPC_SERVICE_IFNAME specified as: " << GRPC_SERVICE_IFNAME; + LOG(INFO) << "Waiting for interface: " << GRPC_SERVICE_IFNAME; + android::netdevice::waitFor({GRPC_SERVICE_IFNAME}, + android::netdevice::WaitCondition::PRESENT_AND_UP); + LOG(INFO) << "Waiting for interface: " << GRPC_SERVICE_IFNAME << " done"; +#endif + auto channel = grpc::CreateCustomChannel(GRPC_SERVICE_ADDRESS, + grpc::InsecureChannelCredentials(), grpcargs); auto clientStub = android::hardware::automotive::remoteaccess::WakeupClient::NewStub(channel); auto service = ndk::SharedRefBase::make< android::hardware::automotive::remoteaccess::RemoteAccessService>(clientStub.get()); binder_exception_t err = AServiceManager_addService(service->asBinder().get(), SERVICE_NAME); if (err != EX_NONE) { - ALOGE("failed to register android.hardware.automotive.remote.IRemoteAccess service, " - "exception: %d", - err); + LOG(ERROR) << "failed to register android.hardware.automotive.remote.IRemoteAccess service" + << ", exception: " << err; exit(1); } if (!ABinderProcess_setThreadPoolMaxThreadCount(1)) { - ALOGE("%s", "failed to set thread pool max thread count"); + LOG(ERROR) << "failed to set thread pool max thread count"; exit(1); } ABinderProcess_startThreadPool(); - ALOGI("RemoteAccess service Ready"); + LOG(INFO) << "RemoteAccess service Ready"; ABinderProcess_joinThreadPool(); - ALOGW("Should not reach here"); + LOG(ERROR) << "Should not reach here"; return 0; } From 2a096c4983211bbded8d641d8286f9499d9018cf Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 15 Feb 2023 18:16:22 -0800 Subject: [PATCH 796/998] Change BindToDeviceSocketMutator to lib. Test: Presubmit Bug: 268750179 Change-Id: I7d338eef4f622631d0ead0af0a91e3b68bfa69eb --- .../bind_to_device_socket_mutator/Android.bp | 43 +++++++++++++++++++ .../include}/BindToDeviceSocketMutator.h | 0 .../src/BindToDeviceSocketMutator.cpp | 0 .../remoteaccess/hal/default/Android.bp | 10 ++--- 4 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp rename automotive/remoteaccess/{hal/default/src => bind_to_device_socket_mutator/include}/BindToDeviceSocketMutator.h (100%) rename automotive/remoteaccess/{hal/default => bind_to_device_socket_mutator}/src/BindToDeviceSocketMutator.cpp (100%) diff --git a/automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp b/automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp new file mode 100644 index 0000000000..113b14e63f --- /dev/null +++ b/automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp @@ -0,0 +1,43 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_defaults { + name: "BindToDeviceSocketMutatorDefaults", + static_libs: [ + "android.hardware.automotive.can@libnetdevice", + "libnl++", + ], + shared_libs: [ + "libbase", + "liblog", + "libgrpc++", + ], + cflags: [ + "-Wno-unused-parameter", + ], +} + +cc_library { + name: "BindToDeviceSocketMutatorLib", + vendor_available: true, + srcs: ["src/*"], + export_include_dirs: ["include"], + defaults: ["BindToDeviceSocketMutatorDefaults"], +} diff --git a/automotive/remoteaccess/hal/default/src/BindToDeviceSocketMutator.h b/automotive/remoteaccess/bind_to_device_socket_mutator/include/BindToDeviceSocketMutator.h similarity index 100% rename from automotive/remoteaccess/hal/default/src/BindToDeviceSocketMutator.h rename to automotive/remoteaccess/bind_to_device_socket_mutator/include/BindToDeviceSocketMutator.h diff --git a/automotive/remoteaccess/hal/default/src/BindToDeviceSocketMutator.cpp b/automotive/remoteaccess/bind_to_device_socket_mutator/src/BindToDeviceSocketMutator.cpp similarity index 100% rename from automotive/remoteaccess/hal/default/src/BindToDeviceSocketMutator.cpp rename to automotive/remoteaccess/bind_to_device_socket_mutator/src/BindToDeviceSocketMutator.cpp diff --git a/automotive/remoteaccess/hal/default/Android.bp b/automotive/remoteaccess/hal/default/Android.bp index bfab1ed698..01556670ec 100644 --- a/automotive/remoteaccess/hal/default/Android.bp +++ b/automotive/remoteaccess/hal/default/Android.bp @@ -24,27 +24,25 @@ cc_defaults { relative_install_path: "hw", srcs: [ "src/RemoteAccessImpl.cpp", - "src/BindToDeviceSocketMutator.cpp", ], whole_static_libs: [ "RemoteAccessService", ], static_libs: [ - "android.hardware.automotive.can@libnetdevice", - "libnl++", + "BindToDeviceSocketMutatorLib", ], shared_libs: [ - "libbase", "libbinder_ndk", - "liblog", "libutils", - "libgrpc++", "libprotobuf-cpp-full", ], defaults: [ "vhalclient_defaults", + "BindToDeviceSocketMutatorDefaults", ], cflags: [ + // This is already included in BindToDeviceSocketMutatorDefaults but + // might be overridden by vhalclient_defaults. "-Wno-unused-parameter", ], } From d70f84d7da839214540544308960a557ef03c15a Mon Sep 17 00:00:00 2001 From: Matthew Sedam Date: Mon, 6 Mar 2023 18:34:24 +0000 Subject: [PATCH 797/998] Pass the context hub ID to getPreloadedNanoappIds in the HAL Bug: 271846335 Test: m, flash, boot # normal Test: logs # normal Test: Dump context hub service and AIDL HAL # normal Test: atest VtsAidlHalContextHubTargetTest Change-Id: I8268bdab0aaf58863d71c7d065aa89223368199b --- .../current/android/hardware/contexthub/IContextHub.aidl | 2 +- .../aidl/android/hardware/contexthub/IContextHub.aidl | 6 ++++-- contexthub/aidl/default/ContextHub.cpp | 3 ++- .../aidl/default/include/contexthub-impl/ContextHub.h | 2 +- contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp | 6 +++--- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl index 9f2eb767e1..de8d752695 100644 --- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl @@ -45,7 +45,7 @@ interface IContextHub { void sendMessageToHub(in int contextHubId, in android.hardware.contexthub.ContextHubMessage message); void onHostEndpointConnected(in android.hardware.contexthub.HostEndpointInfo hostEndpointInfo); void onHostEndpointDisconnected(char hostEndpointId); - long[] getPreloadedNanoappIds(); + long[] getPreloadedNanoappIds(in int contextHubId); void onNanSessionStateChanged(in android.hardware.contexthub.NanSessionStateUpdate update); void setTestMode(in boolean enable); const int EX_CONTEXT_HUB_UNSPECIFIED = (-1) /* -1 */; diff --git a/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl index 17bffd608f..9683d2d7e4 100644 --- a/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl +++ b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl @@ -200,9 +200,11 @@ interface IContextHub { * Provides the list of preloaded nanoapp IDs on the system. The output of this API must * not change. * - * @return The list of preloaded nanoapp IDs + * @param contextHubId The identifier of the Context Hub. + * + * @return The list of preloaded nanoapp IDs. */ - long[] getPreloadedNanoappIds(); + long[] getPreloadedNanoappIds(in int contextHubId); /** * Invoked when the state of the NAN session requested through handleNanSessionRequest() diff --git a/contexthub/aidl/default/ContextHub.cpp b/contexthub/aidl/default/ContextHub.cpp index 66f9857532..5272957f07 100644 --- a/contexthub/aidl/default/ContextHub.cpp +++ b/contexthub/aidl/default/ContextHub.cpp @@ -76,7 +76,8 @@ ScopedAStatus ContextHub::queryNanoapps(int32_t in_contextHubId) { } } -ScopedAStatus ContextHub::getPreloadedNanoappIds(std::vector* out_preloadedNanoappIds) { +ScopedAStatus ContextHub::getPreloadedNanoappIds(int32_t /* in_contextHubId */, + std::vector* out_preloadedNanoappIds) { if (out_preloadedNanoappIds == nullptr) { return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } diff --git a/contexthub/aidl/default/include/contexthub-impl/ContextHub.h b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h index 02ecf53743..7a2cfd1702 100644 --- a/contexthub/aidl/default/include/contexthub-impl/ContextHub.h +++ b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h @@ -39,7 +39,7 @@ class ContextHub : public BnContextHub { ::ndk::ScopedAStatus onSettingChanged(Setting in_setting, bool in_enabled) override; ::ndk::ScopedAStatus queryNanoapps(int32_t in_contextHubId) override; ::ndk::ScopedAStatus getPreloadedNanoappIds( - std::vector* out_preloadedNanoappIds) override; + int32_t in_contextHubId, std::vector* out_preloadedNanoappIds) override; ::ndk::ScopedAStatus registerCallback( int32_t in_contextHubId, const std::shared_ptr& in_cb) override; ::ndk::ScopedAStatus sendMessageToHub(int32_t in_contextHubId, diff --git a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp index 9707ecf728..f544d833d9 100644 --- a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp +++ b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp @@ -186,10 +186,10 @@ TEST_P(ContextHubAidl, TestQueryApps) { } } -// Calls getPreloadedNanoapps() and verifies there are preloaded nanoapps -TEST_P(ContextHubAidl, TestGetPreloadedNanoapps) { +// Calls getPreloadedNanoappsIds() and verifies there are preloaded nanoapps +TEST_P(ContextHubAidl, TestGetPreloadedNanoappIds) { std::vector preloadedNanoappIds; - Status status = contextHub->getPreloadedNanoappIds(&preloadedNanoappIds); + Status status = contextHub->getPreloadedNanoappIds(getHubId(), &preloadedNanoappIds); if (status.exceptionCode() == Status::EX_UNSUPPORTED_OPERATION || status.transactionError() == android::UNKNOWN_TRANSACTION) { GTEST_SKIP() << "Not supported -> old API; or not implemented"; From d0641b0d5ac82175e8f73857039849853584329d Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Fri, 3 Mar 2023 17:19:37 -0800 Subject: [PATCH 798/998] audio: Add IStreamCommon.prepareToClose method This method is needed to implement HAL modules that are proxies for other subsystems, for example the "bluetooth" and "r_submix" modules. This method replaces string parameters "exiting=1" and "closing=true" which the framework sends to streams prior to closing them in order to unblock the I/O thread of the stream. Bug: 270731693 Test: atest VtsHalAudioCoreTargetTest Change-Id: I3d13fe34535ab853c9f8237a08c31cdafadbb390 --- .../hardware/audio/core/IStreamCommon.aidl | 1 + .../hardware/audio/core/IStreamCommon.aidl | 27 +++++++++++++++++++ audio/aidl/default/Stream.cpp | 10 +++++++ audio/aidl/default/include/core-impl/Stream.h | 7 +++++ .../vts/VtsHalAudioCoreModuleTargetTest.cpp | 23 ++++++++++++++++ 5 files changed, 68 insertions(+) diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamCommon.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamCommon.aidl index f0bf100932..65a2ee4542 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamCommon.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IStreamCommon.aidl @@ -35,6 +35,7 @@ package android.hardware.audio.core; @VintfStability interface IStreamCommon { void close(); + void prepareToClose(); void updateHwAvSyncId(int hwAvSyncId); android.hardware.audio.core.VendorParameter[] getVendorParameters(in @utf8InCpp String[] ids); void setVendorParameters(in android.hardware.audio.core.VendorParameter[] parameters, boolean async); diff --git a/audio/aidl/android/hardware/audio/core/IStreamCommon.aidl b/audio/aidl/android/hardware/audio/core/IStreamCommon.aidl index 533ef67475..543d9e266b 100644 --- a/audio/aidl/android/hardware/audio/core/IStreamCommon.aidl +++ b/audio/aidl/android/hardware/audio/core/IStreamCommon.aidl @@ -43,6 +43,33 @@ interface IStreamCommon { */ void close(); + /** + * Notify the stream that it is about to be closed. + * + * This is a notification sent by the client to indicate that it intends to + * close the stream "soon" (the actual time period is unspecified). The + * purpose of this notification is to allow the stream implementation to + * unblock the I/O thread. This is useful for HAL modules that act as + * proxies to other subsystems, examples are "bluetooth" and "r_submix" + * modules. In such modules the I/O thread might get blocked on a read or + * write operation to the external subsystem. Thus, calling 'close' directly + * will stall, as it will try to send the 'Command.halReservedExit' on the + * I/O thread which is blocked and is not reading commands from the FMQ. The + * HAL implementation must initiate unblocking as a result of receiving the + * 'prepareToClose' notification. + * + * This operation must be handled by the HAL module in an "asynchronous" + * manner, returning control back as quick as possible. + * + * Since this operation does not have any effects observable from the client + * side, the HAL module must be able to handle multiple calls of this method + * without throwing any errors. The only case when this method is allowed + * to throw is when the stream has been closed. + * + * @throws EX_ILLEGAL_STATE If the stream is closed. + */ + void prepareToClose(); + /** * Update the HW AV Sync identifier for the stream. * diff --git a/audio/aidl/default/Stream.cpp b/audio/aidl/default/Stream.cpp index 193c793ba0..871480b967 100644 --- a/audio/aidl/default/Stream.cpp +++ b/audio/aidl/default/Stream.cpp @@ -659,6 +659,16 @@ ndk::ScopedAStatus StreamCommonImpl::close() { } } +template +ndk::ScopedAStatus StreamCommonImpl::prepareToClose() { + LOG(DEBUG) << __func__; + if (!isClosed()) { + return ndk::ScopedAStatus::ok(); + } + LOG(ERROR) << __func__ << ": stream was closed"; + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); +} + template void StreamCommonImpl::stopWorker() { if (auto commandMQ = mContext.getCommandMQ(); commandMQ != nullptr) { diff --git a/audio/aidl/default/include/core-impl/Stream.h b/audio/aidl/default/include/core-impl/Stream.h index e9b1fbb847..65680df664 100644 --- a/audio/aidl/default/include/core-impl/Stream.h +++ b/audio/aidl/default/include/core-impl/Stream.h @@ -294,6 +294,7 @@ using StreamOutWorker = StreamWorkerImpl; struct StreamCommonInterface { virtual ~StreamCommonInterface() = default; virtual ndk::ScopedAStatus close() = 0; + virtual ndk::ScopedAStatus prepareToClose() = 0; virtual ndk::ScopedAStatus updateHwAvSyncId(int32_t in_hwAvSyncId) = 0; virtual ndk::ScopedAStatus getVendorParameters(const std::vector& in_ids, std::vector* _aidl_return) = 0; @@ -318,6 +319,11 @@ class StreamCommon : public BnStreamCommon { return delegate != nullptr ? delegate->close() : ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); } + ndk::ScopedAStatus prepareToClose() override { + auto delegate = mDelegate.lock(); + return delegate != nullptr ? delegate->prepareToClose() + : ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); + } ndk::ScopedAStatus updateHwAvSyncId(int32_t in_hwAvSyncId) override { auto delegate = mDelegate.lock(); return delegate != nullptr ? delegate->updateHwAvSyncId(in_hwAvSyncId) @@ -359,6 +365,7 @@ template class StreamCommonImpl : public StreamCommonInterface { public: ndk::ScopedAStatus close() override; + ndk::ScopedAStatus prepareToClose() override; ndk::ScopedAStatus updateHwAvSyncId(int32_t in_hwAvSyncId) override; ndk::ScopedAStatus getVendorParameters(const std::vector& in_ids, std::vector* _aidl_return) override; diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp index 1e0c900577..f06c0f1273 100644 --- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp @@ -1070,6 +1070,8 @@ class WithStream { std::shared_ptr common; ndk::ScopedAStatus status = stream->getStreamCommon(&common); if (!status.isOk()) return status; + status = common->prepareToClose(); + if (!status.isOk()) return status; return common->close(); } @@ -2302,6 +2304,26 @@ class AudioStream : public AudioCoreModule { << "when closing the stream twice"; } + void PrepareToCloseTwice() { + const auto portConfig = moduleConfig->getSingleConfigForMixPort(IOTraits::is_input); + if (!portConfig.has_value()) { + GTEST_SKIP() << "No mix port for attached devices"; + } + std::shared_ptr heldStreamCommon; + { + WithStream stream(portConfig.value()); + ASSERT_NO_FATAL_FAILURE(stream.SetUp(module.get(), kDefaultBufferSizeFrames)); + std::shared_ptr streamCommon; + ASSERT_IS_OK(stream.get()->getStreamCommon(&streamCommon)); + heldStreamCommon = streamCommon; + EXPECT_IS_OK(streamCommon->prepareToClose()); + EXPECT_IS_OK(streamCommon->prepareToClose()) + << "when calling prepareToClose second time"; + } + EXPECT_STATUS(EX_ILLEGAL_STATE, heldStreamCommon->prepareToClose()) + << "when calling prepareToClose on a closed stream"; + } + void OpenAllConfigs() { const auto allPortConfigs = moduleConfig->getPortConfigsForMixPorts(IOTraits::is_input); @@ -2597,6 +2619,7 @@ using AudioStreamOut = AudioStream; } TEST_IN_AND_OUT_STREAM(CloseTwice); +TEST_IN_AND_OUT_STREAM(PrepareToCloseTwice); TEST_IN_AND_OUT_STREAM(GetStreamCommon); TEST_IN_AND_OUT_STREAM(OpenAllConfigs); TEST_IN_AND_OUT_STREAM(OpenInvalidBufferSize); From 5fcddd74f6879d448a7303188b0f318aebf29e08 Mon Sep 17 00:00:00 2001 From: Kriti Dang Date: Tue, 7 Mar 2023 14:55:51 +0100 Subject: [PATCH 799/998] Fixing the HDR conversion aidls Bug: 251168514 Test: atest VtsHalGraphicsComposer3_TargetTest Change-Id: I10310dd26809bd546c41d3d16bebcba711e43a50 --- .../common/HdrConversionCapability.aidl | 4 +- .../graphics/common/ParcelableHdr.aidl | 38 ------------------- .../android/hardware/graphics/common/Hdr.aidl | 2 +- .../common/HdrConversionCapability.aidl | 26 +++++++------ .../common/HdrConversionStrategy.aidl | 37 ++++++++++-------- .../graphics/common/ParcelableHdr.aidl | 24 ------------ .../VtsHalGraphicsComposer3_TargetTest.cpp | 8 ++-- 7 files changed, 44 insertions(+), 95 deletions(-) delete mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ParcelableHdr.aidl delete mode 100644 graphics/common/aidl/android/hardware/graphics/common/ParcelableHdr.aidl diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionCapability.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionCapability.aidl index 66151ca1ae..b74f7d7ce5 100644 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionCapability.aidl +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/HdrConversionCapability.aidl @@ -34,7 +34,7 @@ package android.hardware.graphics.common; @VintfStability parcelable HdrConversionCapability { - android.hardware.graphics.common.ParcelableHdr sourceType; - @nullable android.hardware.graphics.common.ParcelableHdr outputType; + android.hardware.graphics.common.Hdr sourceType; + android.hardware.graphics.common.Hdr outputType; boolean addsLatency; } diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ParcelableHdr.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ParcelableHdr.aidl deleted file mode 100644 index 788bd4e9fa..0000000000 --- a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/current/android/hardware/graphics/common/ParcelableHdr.aidl +++ /dev/null @@ -1,38 +0,0 @@ -/** - * 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 -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.hardware.graphics.common; -@VintfStability -parcelable ParcelableHdr { - android.hardware.graphics.common.Hdr hdr; -} diff --git a/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl b/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl index 6107c4cfcf..c9ba16b34f 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/Hdr.aidl @@ -24,7 +24,7 @@ package android.hardware.graphics.common; @Backing(type="int") enum Hdr { /** - * Invalid HDR type + * Invalid HDR type */ INVALID = 0, /** diff --git a/graphics/common/aidl/android/hardware/graphics/common/HdrConversionCapability.aidl b/graphics/common/aidl/android/hardware/graphics/common/HdrConversionCapability.aidl index 53b3256cf2..d8524a5b12 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/HdrConversionCapability.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/HdrConversionCapability.aidl @@ -16,22 +16,26 @@ package android.hardware.graphics.common; -import android.hardware.graphics.common.ParcelableHdr; +import android.hardware.graphics.common.Hdr; /** * Output parameter for IComposerClient.getHdrConversionCapabilities - * - * @param sourceType is the HDR type that can be converted to outputType. - * - * @param outputType is the HDR type/ SDR that the source type can be converted to. The value null - * is used to depict SDR outputType. - * - * @param addsLatency is false if no latency added due to HDR conversion from sourceType to - * outputType, otherwise true. */ @VintfStability parcelable HdrConversionCapability { - ParcelableHdr sourceType; - @nullable ParcelableHdr outputType; + /** sourceType is the HDR type that can be converted to outputType */ + Hdr sourceType; + + /** + * outputType is the HDR type/ SDR that the source type can be converted to. The value INVALID + * is used to depict SDR outputType. + */ + + Hdr outputType; + + /** + * addsLatency is false if no latency added due to HDR conversion from sourceType to + * outputType, otherwise true. + */ boolean addsLatency; } diff --git a/graphics/common/aidl/android/hardware/graphics/common/HdrConversionStrategy.aidl b/graphics/common/aidl/android/hardware/graphics/common/HdrConversionStrategy.aidl index f564e9f008..71beaa00da 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/HdrConversionStrategy.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/HdrConversionStrategy.aidl @@ -15,25 +15,32 @@ */ package android.hardware.graphics.common; + +import android.hardware.graphics.common.Hdr; /** * Input parameter for IComposerClient.setHdrConversionStrategy - * - * @param passthrough - When this parameter is set to true, HDR conversion is disabled by the - * implementation. The output HDR type will change dynamically to match the content. This value is - * never set to false, as other union values will be present in the false case. - * - * @param autoAllowedHdrTypes - When this parameter is set, the output HDR type is selected by the - * implementation. The implementation is only allowed to set the output HDR type to the HDR types - * present in this list. If conversion to any of the autoHdrTypes types is not possible, the - * implementation should do no conversion. - * - * @param forceHdrConversion - When this parameter is set, the implementation should convert all - * content to this HDR type, when possible. If not possible, the functionality should be similar to - * passthrough=true. */ @VintfStability union HdrConversionStrategy { + /** + * When this parameter is set to true, HDR conversion is disabled by the + * implementation. The output HDR type will change dynamically to match the content. This value + * is never set to false, as other union values will be present in the false case. + */ boolean passthrough = true; - android.hardware.graphics.common.Hdr[] autoAllowedHdrTypes; - android.hardware.graphics.common.Hdr forceHdrConversion; + + /** + * When this parameter is set, the output HDR type is selected by the + * implementation. The implementation is only allowed to set the output HDR type to the HDR + * types present in this list. If conversion to any of the autoHdrTypes types is not possible, + * the implementation should do no conversion. + */ + Hdr[] autoAllowedHdrTypes; + + /** + * When this parameter is set, the implementation should convert all + * content to this HDR type, when possible. If not possible, the functionality should be similar + * to passthrough=true. + */ + Hdr forceHdrConversion; } diff --git a/graphics/common/aidl/android/hardware/graphics/common/ParcelableHdr.aidl b/graphics/common/aidl/android/hardware/graphics/common/ParcelableHdr.aidl deleted file mode 100644 index 9aff2770c9..0000000000 --- a/graphics/common/aidl/android/hardware/graphics/common/ParcelableHdr.aidl +++ /dev/null @@ -1,24 +0,0 @@ -/** - * 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.hardware.graphics.common; - -import android.hardware.graphics.common.Hdr; - -@VintfStability -parcelable ParcelableHdr { - Hdr hdr; -} diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 1ecd4059a0..746330b148 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -650,10 +650,10 @@ TEST_P(GraphicsComposerAidlTest, SetHdrConversionStrategy_Force) { } const auto& [status, conversionCapabilities] = mComposerClient->getHdrConversionCapabilities(); for (auto conversionCapability : conversionCapabilities) { - if (conversionCapability.outputType) { + if (conversionCapability.outputType != common::Hdr::INVALID) { common::HdrConversionStrategy hdrConversionStrategy; hdrConversionStrategy.set( - conversionCapability.outputType->hdr); + conversionCapability.outputType); const auto& [statusSet, preferredHdrOutputType] = mComposerClient->setHdrConversionStrategy(hdrConversionStrategy); EXPECT_TRUE(statusSet.isOk()); @@ -670,8 +670,8 @@ TEST_P(GraphicsComposerAidlTest, SetHdrConversionStrategy_Auto) { const auto& [status, conversionCapabilities] = mComposerClient->getHdrConversionCapabilities(); std::vector autoHdrTypes; for (auto conversionCapability : conversionCapabilities) { - if (conversionCapability.outputType) { - autoHdrTypes.push_back(conversionCapability.outputType->hdr); + if (conversionCapability.outputType != common::Hdr::INVALID) { + autoHdrTypes.push_back(conversionCapability.outputType); } } common::HdrConversionStrategy hdrConversionStrategy; From 86ce85e8cb484dc60dde99e48393d1815b2ff592 Mon Sep 17 00:00:00 2001 From: shrikar Date: Fri, 18 Nov 2022 11:39:28 -0800 Subject: [PATCH 800/998] Update properties and FakeVehicleHardware to support multi-display Bug: 255430764 Test: atest CarPropertyManagerTest Test: atest FakeVehicleHardwareTest Change-Id: I7e3db2e9e7e0cb58588b11d064e1fa14f2007a2a Merged-In: I7e3db2e9e7e0cb58588b11d064e1fa14f2007a2a --- .../config/DefaultProperties.json | 278 +++++++++++++++--- .../hardware/include/FakeVehicleHardware.h | 4 +- .../hardware/src/FakeVehicleHardware.cpp | 45 ++- .../hardware/test/FakeVehicleHardwareTest.cpp | 119 +++++--- 4 files changed, 340 insertions(+), 106 deletions(-) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index b6d987effa..5ac60295f8 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -1329,22 +1329,26 @@ }, { "property": "VehicleProperty::SEAT_OCCUPANCY", + "defaultValue": { + "int32Values": [ + "VehicleSeatOccupancyState::VACANT" + ] + }, "areas": [ { - "defaultValue": { - "int32Values": [ - "VehicleSeatOccupancyState::VACANT" - ] - }, "areaId": "Constants::SEAT_1_LEFT" }, { - "defaultValue": { - "int32Values": [ - "VehicleSeatOccupancyState::VACANT" - ] - }, "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ] }, @@ -1854,7 +1858,19 @@ }, "areas": [ { - "areaId": "Constants::HVAC_ALL" + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ] }, @@ -1867,7 +1883,19 @@ }, "areas": [ { - "areaId": "Constants::HVAC_ALL" + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ], "configArray": [ @@ -1918,7 +1946,19 @@ }, "areas": [ { - "areaId": "Constants::HVAC_ALL" + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ] }, @@ -1931,7 +1971,19 @@ }, "areas": [ { - "areaId": "Constants::HVAC_ALL" + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ] }, @@ -1944,7 +1996,19 @@ }, "areas": [ { - "areaId": "Constants::HVAC_ALL" + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ] }, @@ -1957,7 +2021,19 @@ }, "areas": [ { - "areaId": "Constants::HVAC_ALL" + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ] }, @@ -1970,7 +2046,19 @@ }, "areas": [ { - "areaId": "Constants::HVAC_ALL" + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ] }, @@ -1983,7 +2071,19 @@ }, "areas": [ { - "areaId": "Constants::HVAC_ALL" + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ] }, @@ -2009,7 +2109,27 @@ }, "areas": [ { - "areaId": "Constants::HVAC_ALL", + "areaId": "Constants::SEAT_1_LEFT", + "minInt32Value": 1, + "maxInt32Value": 7 + }, + { + "areaId": "Constants::SEAT_1_RIGHT", + "minInt32Value": 1, + "maxInt32Value": 7 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": 1, + "maxInt32Value": 7 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": 1, + "maxInt32Value": 7 + }, + { + "areaId": "Constants::SEAT_2_CENTER", "minInt32Value": 1, "maxInt32Value": 7 } @@ -2024,7 +2144,19 @@ }, "areas": [ { - "areaId": "Constants::HVAC_ALL" + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ] }, @@ -2043,7 +2175,19 @@ }, "areas": [ { - "areaId": "Constants::HVAC_ALL" + "areaId": "Constants::SEAT_1_LEFT" + }, + { + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ] }, @@ -2064,6 +2208,21 @@ "areaId": "Constants::SEAT_1_RIGHT", "minInt32Value": 0, "maxInt32Value": 3 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": 0, + "maxInt32Value": 3 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": 0, + "maxInt32Value": 3 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": 0, + "maxInt32Value": 3 } ], "comment": "0 is off and +ve values indicate ventilation level." @@ -2101,6 +2260,21 @@ "areaId": "Constants::SEAT_1_RIGHT", "minInt32Value": -2, "maxInt32Value": 2 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minInt32Value": -2, + "maxInt32Value": 2 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minInt32Value": -2, + "maxInt32Value": 2 + }, + { + "areaId": "Constants::SEAT_2_CENTER", + "minInt32Value": -2, + "maxInt32Value": 2 } ], "comment": "+ve values for heating and -ve for cooling" @@ -2122,45 +2296,59 @@ }, { "property": "VehicleProperty::HVAC_TEMPERATURE_CURRENT", + "defaultValue": { + "floatValues": [ + 19.1 + ] + }, "areas": [ { - "defaultValue": { - "floatValues": [ - 17.3 - ] - }, - "areaId": 49 + "areaId": "Constants::SEAT_1_LEFT" }, { - "defaultValue": { - "floatValues": [ - 19.1 - ] - }, - "areaId": 68 + "areaId": "Constants::SEAT_1_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_LEFT" + }, + { + "areaId": "Constants::SEAT_2_RIGHT" + }, + { + "areaId": "Constants::SEAT_2_CENTER" } ] }, { "property": "VehicleProperty::HVAC_TEMPERATURE_SET", + "defaultValue": { + "floatValues": [ + 17.0 + ] + }, "areas": [ { - "defaultValue": { - "floatValues": [ - 16.0 - ] - }, - "areaId": 49, + "areaId": "Constants::SEAT_1_LEFT", "minFloatValue": 16.0, "maxFloatValue": 28.0 }, { - "defaultValue": { - "floatValues": [ - 20.0 - ] - }, - "areaId": 68, + "areaId": "Constants::SEAT_1_RIGHT", + "minFloatValue": 16.0, + "maxFloatValue": 28.0 + }, + { + "areaId": "Constants::SEAT_2_LEFT", + "minFloatValue": 16.0, + "maxFloatValue": 28.0 + }, + { + "areaId": "Constants::SEAT_2_RIGHT", + "minFloatValue": 16.0, + "maxFloatValue": 28.0 + }, + { + "areaId": "Constants::SEAT_2_CENTER", "minFloatValue": 16.0, "maxFloatValue": 28.0 } diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h index 956c7c00fe..6fd2367957 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h @@ -194,7 +194,7 @@ class FakeVehicleHardware : public IVehicleHardware { const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const; ValueResultType getEchoReverseBytes( const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const; - bool isHvacPropAndHvacNotAvailable(int32_t propId) const; + bool isHvacPropAndHvacNotAvailable(int32_t propId, int32_t areaId) const; std::unordered_map loadConfigDeclarations(); @@ -236,7 +236,7 @@ class FakeVehicleHardware : public IVehicleHardware { const aidl::android::hardware::automotive::vehicle::SetValueRequest& request); std::string genFakeDataCommand(const std::vector& options); - void sendHvacPropertiesCurrentValues(); + void sendHvacPropertiesCurrentValues(int32_t areaId); static aidl::android::hardware::automotive::vehicle::VehiclePropValue createHwInputKeyProp( aidl::android::hardware::automotive::vehicle::VehicleHwKeyInputAction action, diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index 7b4fa164e4..78c21e95d8 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -298,16 +298,27 @@ VhalResult FakeVehicleHardware::setApPowerStateReport(const VehiclePropVal return {}; } -bool FakeVehicleHardware::isHvacPropAndHvacNotAvailable(int32_t propId) const { +bool FakeVehicleHardware::isHvacPropAndHvacNotAvailable(int32_t propId, int32_t areaId) const { std::unordered_set powerProps(std::begin(HVAC_POWER_PROPERTIES), std::end(HVAC_POWER_PROPERTIES)); if (powerProps.count(propId)) { - auto hvacPowerOnResult = - mServerSidePropStore->readValue(toInt(VehicleProperty::HVAC_POWER_ON), HVAC_ALL); - - if (hvacPowerOnResult.ok() && hvacPowerOnResult.value()->value.int32Values.size() == 1 && - hvacPowerOnResult.value()->value.int32Values[0] == 0) { - return true; + auto hvacPowerOnResults = + mServerSidePropStore->readValuesForProperty(toInt(VehicleProperty::HVAC_POWER_ON)); + if (!hvacPowerOnResults.ok()) { + ALOGW("failed to get HVAC_POWER_ON 0x%x, error: %s", + toInt(VehicleProperty::HVAC_POWER_ON), getErrorMsg(hvacPowerOnResults).c_str()); + return false; + } + auto& hvacPowerOnValues = hvacPowerOnResults.value(); + for (size_t j = 0; j < hvacPowerOnValues.size(); j++) { + auto hvacPowerOnValue = std::move(hvacPowerOnValues[j]); + if ((hvacPowerOnValue->areaId & areaId) == areaId) { + if (hvacPowerOnValue->value.int32Values.size() == 1 && + hvacPowerOnValue->value.int32Values[0] == 0) { + return true; + } + break; + } } } return false; @@ -369,7 +380,7 @@ FakeVehicleHardware::ValueResultType FakeVehicleHardware::maybeGetSpecialValue( return getUserHalProp(value); } - if (isHvacPropAndHvacNotAvailable(propId)) { + if (isHvacPropAndHvacNotAvailable(propId, value.areaId)) { *isSpecialValue = true; return StatusError(StatusCode::NOT_AVAILABLE) << "hvac not available"; } @@ -419,7 +430,7 @@ FakeVehicleHardware::ValueResultType FakeVehicleHardware::getEchoReverseBytes( return std::move(gotValue); } -void FakeVehicleHardware::sendHvacPropertiesCurrentValues() { +void FakeVehicleHardware::sendHvacPropertiesCurrentValues(int32_t areaId) { for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) { int powerPropId = HVAC_POWER_PROPERTIES[i]; auto powerPropResults = mServerSidePropStore->readValuesForProperty(powerPropId); @@ -431,11 +442,13 @@ void FakeVehicleHardware::sendHvacPropertiesCurrentValues() { auto& powerPropValues = powerPropResults.value(); for (size_t j = 0; j < powerPropValues.size(); j++) { auto powerPropValue = std::move(powerPropValues[j]); - powerPropValue->status = VehiclePropertyStatus::AVAILABLE; - powerPropValue->timestamp = elapsedRealtimeNano(); - // This will trigger a property change event for the current hvac property value. - mServerSidePropStore->writeValue(std::move(powerPropValue), /*updateStatus=*/true, - VehiclePropertyStore::EventMode::ALWAYS); + if ((powerPropValue->areaId & areaId) == powerPropValue->areaId) { + powerPropValue->status = VehiclePropertyStatus::AVAILABLE; + powerPropValue->timestamp = elapsedRealtimeNano(); + // This will trigger a property change event for the current hvac property value. + mServerSidePropStore->writeValue(std::move(powerPropValue), /*updateStatus=*/true, + VehiclePropertyStore::EventMode::ALWAYS); + } } } } @@ -455,10 +468,10 @@ VhalResult FakeVehicleHardware::maybeSetSpecialValue(const VehiclePropValu value.value.int32Values[0] == 1) { // If we are turning HVAC power on, send current hvac property values through on change // event. - sendHvacPropertiesCurrentValues(); + sendHvacPropertiesCurrentValues(value.areaId); } - if (isHvacPropAndHvacNotAvailable(propId)) { + if (isHvacPropAndHvacNotAvailable(propId, value.areaId)) { *isSpecialValue = true; return StatusError(StatusCode::NOT_AVAILABLE) << "hvac not available"; } diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp index f3593aa59b..93a63adbc6 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp @@ -1147,67 +1147,100 @@ TEST_F(FakeVehicleHardwareTest, testSetVehicleMapService) { } TEST_F(FakeVehicleHardwareTest, testGetHvacPropNotAvailable) { - StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), - .areaId = HVAC_ALL, - .value.int32Values = {0}}); + int seatAreaIds[5] = {SEAT_1_LEFT, SEAT_1_RIGHT, SEAT_2_LEFT, SEAT_2_CENTER, SEAT_2_RIGHT}; + for (int areaId : seatAreaIds) { + StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), + .areaId = areaId, + .value.int32Values = {0}}); - ASSERT_EQ(status, StatusCode::OK); + ASSERT_EQ(status, StatusCode::OK); - for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) { - int powerPropId = HVAC_POWER_PROPERTIES[i]; - auto getValueResult = getValue(VehiclePropValue{ - .prop = powerPropId, - .areaId = HVAC_ALL, - }); + for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) { + int powerPropId = HVAC_POWER_PROPERTIES[i]; + for (int powerDependentAreaId : seatAreaIds) { + auto getValueResult = getValue(VehiclePropValue{ + .prop = powerPropId, + .areaId = powerDependentAreaId, + }); - EXPECT_FALSE(getValueResult.ok()); - EXPECT_EQ(getValueResult.error(), StatusCode::NOT_AVAILABLE); + if (areaId == powerDependentAreaId) { + EXPECT_FALSE(getValueResult.ok()); + EXPECT_EQ(getValueResult.error(), StatusCode::NOT_AVAILABLE); + } else { + EXPECT_TRUE(getValueResult.ok()); + } + } + } + + // Resetting HVAC_POWER_ON at areaId back to ON state to ensure that there's no dependence + // on this value from any power dependent property values other than those with the same + // areaId. + setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), + .areaId = areaId, + .value.int32Values = {1}}); } } TEST_F(FakeVehicleHardwareTest, testSetHvacPropNotAvailable) { - StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), - .areaId = HVAC_ALL, - .value.int32Values = {0}}); + int seatAreaIds[5] = {SEAT_1_LEFT, SEAT_1_RIGHT, SEAT_2_LEFT, SEAT_2_CENTER, SEAT_2_RIGHT}; + for (int areaId : seatAreaIds) { + StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), + .areaId = areaId, + .value.int32Values = {0}}); - ASSERT_EQ(status, StatusCode::OK); + ASSERT_EQ(status, StatusCode::OK); - for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) { - int powerPropId = HVAC_POWER_PROPERTIES[i]; - status = setValue(VehiclePropValue{ - .prop = powerPropId, - .areaId = HVAC_ALL, - }); + for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) { + int powerPropId = HVAC_POWER_PROPERTIES[i]; + for (int powerDependentAreaId : seatAreaIds) { + StatusCode status = setValue(VehiclePropValue{.prop = powerPropId, + .areaId = powerDependentAreaId, + .value.int32Values = {1}}); - EXPECT_EQ(status, StatusCode::NOT_AVAILABLE); + if (areaId == powerDependentAreaId) { + EXPECT_EQ(status, StatusCode::NOT_AVAILABLE); + } else { + EXPECT_EQ(status, StatusCode::OK); + } + } + } + + // Resetting HVAC_POWER_ON at areaId back to ON state to ensure that there's no dependence + // on this value from any power dependent property values other than those with the same + // areaId. + setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), + .areaId = areaId, + .value.int32Values = {1}}); } } TEST_F(FakeVehicleHardwareTest, testHvacPowerOnSendCurrentHvacPropValues) { - StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), - .areaId = HVAC_ALL, - .value.int32Values = {0}}); + int seatAreaIds[5] = {SEAT_1_LEFT, SEAT_1_RIGHT, SEAT_2_LEFT, SEAT_2_CENTER, SEAT_2_RIGHT}; + for (int areaId : seatAreaIds) { + StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), + .areaId = areaId, + .value.int32Values = {0}}); - ASSERT_EQ(status, StatusCode::OK); + ASSERT_EQ(status, StatusCode::OK); - clearChangedProperties(); + clearChangedProperties(); + setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), + .areaId = areaId, + .value.int32Values = {1}}); - status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON), - .areaId = HVAC_ALL, - .value.int32Values = {1}}); + auto events = getChangedProperties(); + // If we turn HVAC power on, we expect to receive one property event for every HVAC prop + // areas plus one event for HVAC_POWER_ON. + std::vector changedPropIds; + for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) { + changedPropIds.push_back(HVAC_POWER_PROPERTIES[i]); + } + changedPropIds.push_back(toInt(VehicleProperty::HVAC_POWER_ON)); - auto events = getChangedProperties(); - // If we turn HVAC power on, we expect to receive one property event for every HVAC prop areas - // plus one event for HVAC_POWER_ON. - std::vector changedPropIds; - for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) { - changedPropIds.push_back(HVAC_POWER_PROPERTIES[i]); - } - changedPropIds.push_back(toInt(VehicleProperty::HVAC_POWER_ON)); - ASSERT_EQ(events.size(), changedPropIds.size()); - for (const auto& event : events) { - EXPECT_EQ(event.areaId, HVAC_ALL); - EXPECT_THAT(event.prop, AnyOfArray(changedPropIds)); + for (const auto& event : events) { + EXPECT_EQ(event.areaId, areaId); + EXPECT_THAT(event.prop, AnyOfArray(changedPropIds)); + } } } From 4fae319d0a14052a9f1b046118ffcf1dc90c80dc Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Mon, 6 Mar 2023 14:37:38 -0800 Subject: [PATCH 801/998] audio: Add IBluetoothLe Similar to IBluetooth and IBluetoothA2dp interfaces, IBluetoothLe controls the LE profile. This interface replaces the following string parameter: "LeAudioSuspended" Bug: 270731693 Test: atest VtsHalAudioCoreTargetTest Change-Id: I9df28053cd270fc2d446ba9a8ada4dd6ab761c7b --- audio/aidl/Android.bp | 1 + .../hardware/audio/core/IBluetoothLe.aidl | 39 ++++++++++++++ .../android/hardware/audio/core/IModule.aidl | 1 + .../hardware/audio/core/IBluetooth.aidl | 3 ++ .../hardware/audio/core/IBluetoothA2dp.aidl | 4 +- .../hardware/audio/core/IBluetoothLe.aidl | 51 +++++++++++++++++++ .../android/hardware/audio/core/IModule.aidl | 17 ++++++- audio/aidl/default/Bluetooth.cpp | 12 +++++ audio/aidl/default/Module.cpp | 9 ++++ .../default/include/core-impl/Bluetooth.h | 12 +++++ audio/aidl/default/include/core-impl/Module.h | 2 + .../vts/VtsHalAudioCoreModuleTargetTest.cpp | 41 +++++++++++++++ 12 files changed, 189 insertions(+), 3 deletions(-) create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetoothLe.aidl create mode 100644 audio/aidl/android/hardware/audio/core/IBluetoothLe.aidl diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index bb48ecd001..515787e170 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -114,6 +114,7 @@ aidl_interface { "android/hardware/audio/core/AudioRoute.aidl", "android/hardware/audio/core/IBluetooth.aidl", "android/hardware/audio/core/IBluetoothA2dp.aidl", + "android/hardware/audio/core/IBluetoothLe.aidl", "android/hardware/audio/core/IConfig.aidl", "android/hardware/audio/core/IModule.aidl", "android/hardware/audio/core/IStreamCallback.aidl", diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetoothLe.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetoothLe.aidl new file mode 100644 index 0000000000..f29e1fd282 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetoothLe.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.hardware.audio.core; +@VintfStability +interface IBluetoothLe { + boolean isEnabled(); + void setEnabled(boolean enabled); +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl index f18d6a526e..e14e9c0f71 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl @@ -38,6 +38,7 @@ interface IModule { @nullable android.hardware.audio.core.ITelephony getTelephony(); @nullable android.hardware.audio.core.IBluetooth getBluetooth(); @nullable android.hardware.audio.core.IBluetoothA2dp getBluetoothA2dp(); + @nullable android.hardware.audio.core.IBluetoothLe getBluetoothLe(); android.media.audio.common.AudioPort connectExternalDevice(in android.media.audio.common.AudioPort templateIdAndAdditionalData); void disconnectExternalDevice(int portId); android.hardware.audio.core.AudioPatch[] getAudioPatches(); diff --git a/audio/aidl/android/hardware/audio/core/IBluetooth.aidl b/audio/aidl/android/hardware/audio/core/IBluetooth.aidl index 21ac8e29a5..7fa2e24bf6 100644 --- a/audio/aidl/android/hardware/audio/core/IBluetooth.aidl +++ b/audio/aidl/android/hardware/audio/core/IBluetooth.aidl @@ -25,6 +25,9 @@ import android.media.audio.common.Int; * and the SCO Link. This interface is optional to implement and provide by the * vendor. It needs to be provided only if the device actually supports BT SCO * or HFP. + * + * Each of IBluetooth* interfaces is independent of each other. The HAL module + * can provide any combination of them. */ @VintfStability interface IBluetooth { diff --git a/audio/aidl/android/hardware/audio/core/IBluetoothA2dp.aidl b/audio/aidl/android/hardware/audio/core/IBluetoothA2dp.aidl index dc4b8d0054..c4dd7382cf 100644 --- a/audio/aidl/android/hardware/audio/core/IBluetoothA2dp.aidl +++ b/audio/aidl/android/hardware/audio/core/IBluetoothA2dp.aidl @@ -24,8 +24,8 @@ import android.hardware.audio.core.VendorParameter; * the vendor. It needs to be provided only if the device actually supports BT * A2DP. * - * This interface is separate from IBluetooth interface which manages SCO & HFP. - * The HAL module can handle both SCO and A2DP profiles or only one of them. + * Each of IBluetooth* interfaces is independent of each other. The HAL module + * can provide any combination of them. */ @VintfStability interface IBluetoothA2dp { diff --git a/audio/aidl/android/hardware/audio/core/IBluetoothLe.aidl b/audio/aidl/android/hardware/audio/core/IBluetoothLe.aidl new file mode 100644 index 0000000000..272f8626e2 --- /dev/null +++ b/audio/aidl/android/hardware/audio/core/IBluetoothLe.aidl @@ -0,0 +1,51 @@ +/* + * 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.hardware.audio.core; + +/** + * An instance of IBluetoothLe manages settings for the LE (Low Energy) + * profiles. This interface is optional to implement by the vendor. It needs to + * be provided only if the device actually supports BT LE. + * + * Each of IBluetooth* interfaces is independent of each other. The HAL module + * can provide any combination of them. + */ +@VintfStability +interface IBluetoothLe { + /** + * Whether BT LE is enabled. + * + * Returns the current state of LE support. The client might need to + * disable (suspend) LE when another profile (for example, SCO) is + * activated. + * + * @return Whether BT LE is enabled. + */ + boolean isEnabled(); + + /** + * Enable or disable LE. + * + * Sets the current state of LE support. The client might need to + * disable (suspend) LE when another Bluetooth profile (for example, SCO) is + * activated. + * + * @param enabled Whether BT LE must be enabled or suspended. + * @throws EX_ILLEGAL_STATE If there was an error performing the operation. + */ + void setEnabled(boolean enabled); +} diff --git a/audio/aidl/android/hardware/audio/core/IModule.aidl b/audio/aidl/android/hardware/audio/core/IModule.aidl index 080d826efe..78305018a3 100644 --- a/audio/aidl/android/hardware/audio/core/IModule.aidl +++ b/audio/aidl/android/hardware/audio/core/IModule.aidl @@ -22,6 +22,7 @@ import android.hardware.audio.core.AudioPatch; import android.hardware.audio.core.AudioRoute; import android.hardware.audio.core.IBluetooth; import android.hardware.audio.core.IBluetoothA2dp; +import android.hardware.audio.core.IBluetoothLe; import android.hardware.audio.core.IStreamCallback; import android.hardware.audio.core.IStreamIn; import android.hardware.audio.core.IStreamOut; @@ -117,6 +118,20 @@ interface IModule { */ @nullable IBluetoothA2dp getBluetoothA2dp(); + /** + * Retrieve the interface to control Bluetooth LE. + * + * If the HAL module supports LE Profile functionality for Bluetooth, it + * must return an instance of the IBluetoothLe interface. The same + * instance must be returned during the lifetime of the HAL module. If the + * HAL module does not support BT LE, a null must be returned, without + * throwing any errors. + * + * @return An instance of the IBluetoothLe interface implementation. + * @throws EX_ILLEGAL_STATE If there was an error creating an instance. + */ + @nullable IBluetoothLe getBluetoothLe(); + /** * Set a device port of an external device into connected state. * @@ -842,7 +857,7 @@ interface IModule { AudioMMapPolicyInfo[] getMmapPolicyInfos(AudioMMapPolicyType mmapPolicyType); /** - * Indicates if this module supports variable latency control for instance + * Indicates if this module supports variable latency control, for instance, * over Bluetooth A2DP or LE Audio links. * * If supported, all instances of IStreamOut interface returned by this module must diff --git a/audio/aidl/default/Bluetooth.cpp b/audio/aidl/default/Bluetooth.cpp index bd9a86431d..8115e7b393 100644 --- a/audio/aidl/default/Bluetooth.cpp +++ b/audio/aidl/default/Bluetooth.cpp @@ -105,4 +105,16 @@ ndk::ScopedAStatus BluetoothA2dp::reconfigureOffload( return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus BluetoothLe::isEnabled(bool* _aidl_return) { + *_aidl_return = mEnabled; + LOG(DEBUG) << __func__ << ": returning " << *_aidl_return; + return ndk::ScopedAStatus::ok(); +} + +ndk::ScopedAStatus BluetoothLe::setEnabled(bool in_enabled) { + mEnabled = in_enabled; + LOG(DEBUG) << __func__ << ": " << mEnabled; + return ndk::ScopedAStatus::ok(); +} + } // namespace aidl::android::hardware::audio::core diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp index c4f38444fc..c95c199494 100644 --- a/audio/aidl/default/Module.cpp +++ b/audio/aidl/default/Module.cpp @@ -396,6 +396,15 @@ ndk::ScopedAStatus Module::getBluetoothA2dp(std::shared_ptr* _ai return ndk::ScopedAStatus::ok(); } +ndk::ScopedAStatus Module::getBluetoothLe(std::shared_ptr* _aidl_return) { + if (!mBluetoothLe) { + mBluetoothLe = ndk::SharedRefBase::make(); + } + *_aidl_return = mBluetoothLe.getPtr(); + LOG(DEBUG) << __func__ << ": returning instance of IBluetoothLe: " << _aidl_return->get(); + return ndk::ScopedAStatus::ok(); +} + ndk::ScopedAStatus Module::connectExternalDevice(const AudioPort& in_templateIdAndAdditionalData, AudioPort* _aidl_return) { const int32_t templateId = in_templateIdAndAdditionalData.id; diff --git a/audio/aidl/default/include/core-impl/Bluetooth.h b/audio/aidl/default/include/core-impl/Bluetooth.h index e2f48bae2b..1cd0355ea7 100644 --- a/audio/aidl/default/include/core-impl/Bluetooth.h +++ b/audio/aidl/default/include/core-impl/Bluetooth.h @@ -18,6 +18,7 @@ #include #include +#include namespace aidl::android::hardware::audio::core { @@ -48,4 +49,15 @@ class BluetoothA2dp : public BnBluetoothA2dp { bool mEnabled = false; }; +class BluetoothLe : public BnBluetoothLe { + public: + BluetoothLe() = default; + + private: + ndk::ScopedAStatus isEnabled(bool* _aidl_return) override; + ndk::ScopedAStatus setEnabled(bool in_enabled) override; + + bool mEnabled = false; +}; + } // namespace aidl::android::hardware::audio::core diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h index 0544646a2e..2cbda7d7b1 100644 --- a/audio/aidl/default/include/core-impl/Module.h +++ b/audio/aidl/default/include/core-impl/Module.h @@ -72,6 +72,7 @@ class Module : public BnModule { ndk::ScopedAStatus getTelephony(std::shared_ptr* _aidl_return) override; ndk::ScopedAStatus getBluetooth(std::shared_ptr* _aidl_return) override; ndk::ScopedAStatus getBluetoothA2dp(std::shared_ptr* _aidl_return) override; + ndk::ScopedAStatus getBluetoothLe(std::shared_ptr* _aidl_return) override; ndk::ScopedAStatus connectExternalDevice( const ::aidl::android::media::audio::common::AudioPort& in_templateIdAndAdditionalData, ::aidl::android::media::audio::common::AudioPort* _aidl_return) override; @@ -175,6 +176,7 @@ class Module : public BnModule { ChildInterface mTelephony; ChildInterface mBluetooth; ChildInterface mBluetoothA2dp; + ChildInterface mBluetoothLe; // ids of ports created at runtime via 'connectExternalDevice'. std::set mConnectedDevicePorts; Streams mStreams; diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp index f06c0f1273..650a543688 100644 --- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp @@ -62,6 +62,7 @@ using aidl::android::hardware::audio::core::AudioPatch; using aidl::android::hardware::audio::core::AudioRoute; using aidl::android::hardware::audio::core::IBluetooth; using aidl::android::hardware::audio::core::IBluetoothA2dp; +using aidl::android::hardware::audio::core::IBluetoothLe; using aidl::android::hardware::audio::core::IModule; using aidl::android::hardware::audio::core::IStreamCommon; using aidl::android::hardware::audio::core::IStreamIn; @@ -2111,6 +2112,42 @@ TEST_P(AudioCoreBluetoothA2dp, OffloadReconfiguration) { } } +class AudioCoreBluetoothLe : public AudioCoreModuleBase, + public testing::TestWithParam { + public: + void SetUp() override { + ASSERT_NO_FATAL_FAILURE(SetUpImpl(GetParam())); + ASSERT_IS_OK(module->getBluetoothLe(&bluetooth)); + } + + void TearDown() override { ASSERT_NO_FATAL_FAILURE(TearDownImpl()); } + + std::shared_ptr bluetooth; +}; + +TEST_P(AudioCoreBluetoothLe, SameInstance) { + if (bluetooth == nullptr) { + GTEST_SKIP() << "BluetoothLe is not supported"; + } + std::shared_ptr bluetooth2; + EXPECT_IS_OK(module->getBluetoothLe(&bluetooth2)); + ASSERT_NE(nullptr, bluetooth2.get()); + EXPECT_EQ(bluetooth->asBinder(), bluetooth2->asBinder()) + << "getBluetoothLe must return the same interface instance across invocations"; +} + +TEST_P(AudioCoreBluetoothLe, Enabled) { + if (bluetooth == nullptr) { + GTEST_SKIP() << "BluetoothLe is not supported"; + } + // Since enabling LE may require having an actual device connection, + // limit testing to setting back the current value. + bool enabled; + ASSERT_IS_OK(bluetooth->isEnabled(&enabled)); + EXPECT_IS_OK(bluetooth->setEnabled(enabled)) + << "setEnabled without actual state change must not fail"; +} + class AudioCoreTelephony : public AudioCoreModuleBase, public testing::TestWithParam { public: void SetUp() override { @@ -3543,6 +3580,10 @@ INSTANTIATE_TEST_SUITE_P(AudioCoreBluetoothA2dpTest, AudioCoreBluetoothA2dp, testing::ValuesIn(android::getAidlHalInstanceNames(IModule::descriptor)), android::PrintInstanceNameToString); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioCoreBluetoothA2dp); +INSTANTIATE_TEST_SUITE_P(AudioCoreBluetoothLeTest, AudioCoreBluetoothLe, + testing::ValuesIn(android::getAidlHalInstanceNames(IModule::descriptor)), + android::PrintInstanceNameToString); +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioCoreBluetoothLe); INSTANTIATE_TEST_SUITE_P(AudioCoreTelephonyTest, AudioCoreTelephony, testing::ValuesIn(android::getAidlHalInstanceNames(IModule::descriptor)), android::PrintInstanceNameToString); From 5996045696269ccb92a8c6f1f6d7d8a530084293 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 7 Mar 2023 15:46:15 -0800 Subject: [PATCH 802/998] Add constant for TvMessage no group ID Bug: 271035920 Test: mmm Change-Id: Ie800a2d8675bb01c7d44310785ee4aefdf218749 --- .../current/android/hardware/tv/input/TvMessage.aidl | 1 + tv/input/aidl/android/hardware/tv/input/TvMessage.aidl | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessage.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessage.aidl index 637b01cc6f..04cb099f97 100644 --- a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessage.aidl +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessage.aidl @@ -37,4 +37,5 @@ parcelable TvMessage { String subType; long groupId; int dataLengthBytes; + const long NO_GROUP_ID = (-1) /* -1 */; } diff --git a/tv/input/aidl/android/hardware/tv/input/TvMessage.aidl b/tv/input/aidl/android/hardware/tv/input/TvMessage.aidl index 6df1f9a25b..88da5383ed 100644 --- a/tv/input/aidl/android/hardware/tv/input/TvMessage.aidl +++ b/tv/input/aidl/android/hardware/tv/input/TvMessage.aidl @@ -18,6 +18,10 @@ package android.hardware.tv.input; @VintfStability parcelable TvMessage { + /** + * This value for TvMessage.groupId denotes that the message doesn't belong to any group. + */ + const long NO_GROUP_ID = -1; /** * Extended data type, like “ATSC A/336 Watermark”, “ATSC_CC”, etc. This is opaque * to the framework. From 712d132e0876244b2c4e9e4c98f4a14a118d485c Mon Sep 17 00:00:00 2001 From: Yu-Han Yang Date: Sat, 25 Feb 2023 00:20:44 +0000 Subject: [PATCH 803/998] Update measurement interval VTS tests Bug: 253453668 Test: atest VtsHalGnssTargetTest Change-Id: I2fe394d0ee9f620e93068219a3f73d110120289b --- gnss/aidl/vts/gnss_hal_test_cases.cpp | 49 +++++++++++++++++++-------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp index 0fbd5e3347..96dece473a 100644 --- a/gnss/aidl/vts/gnss_hal_test_cases.cpp +++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp @@ -1405,8 +1405,8 @@ TEST_P(GnssHalTest, TestStopSvStatusAndNmea) { /* * TestGnssMeasurementIntervals_WithoutLocation: - * 1. start measurement with interval - * 2. verify that the received measurement intervals have expected mean and stdev + * 1. Start measurement at intervals + * 2. Verify measurement are received at expected intervals */ TEST_P(GnssHalTest, TestGnssMeasurementIntervals_WithoutLocation) { if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { @@ -1438,8 +1438,9 @@ TEST_P(GnssHalTest, TestGnssMeasurementIntervals_WithoutLocation) { /* * TestGnssMeasurementIntervals_LocationOnBeforeMeasurement: - * 1. start measurement with interval - * 2. verify that the received measurement intervals have expected mean and stdev + * 1. Start location at 1s. + * 2. Start measurement at 2s. Verify measurements are received at 1s. + * 3. Stop measurement. Stop location. */ TEST_P(GnssHalTest, TestGnssMeasurementIntervals_LocationOnBeforeMeasurement) { if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { @@ -1474,15 +1475,17 @@ TEST_P(GnssHalTest, TestGnssMeasurementIntervals_LocationOnBeforeMeasurement) { } /* - * TestGnssMeasurementIntervals: - * 1. start measurement with interval - * 2. verify that the received measurement intervals have expected mean and stddev + * TestGnssMeasurementIntervals_LocationOnAfterMeasurement: + * 1. Start measurement at 2s + * 2. Start location at 1s. Verify measurements are received at 1s + * 3. Stop location. Verify measurements are received at 2s + * 4. Stop measurement */ TEST_P(GnssHalTest, TestGnssMeasurementIntervals_LocationOnAfterMeasurement) { if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { return; } - + const int kFirstMeasTimeoutSec = 10; std::vector intervals({2000}); sp iGnssMeasurement; @@ -1497,26 +1500,34 @@ TEST_P(GnssHalTest, TestGnssMeasurementIntervals_LocationOnAfterMeasurement) { auto callback = sp::make(); startMeasurementWithInterval(intervalMs, iGnssMeasurement, callback); + // Start location and verify the measurements are received at 1Hz StartAndCheckFirstLocation(locationIntervalMs, /* lowPowerMode= */ false); std::vector deltas; - collectMeasurementIntervals(callback, /*numEvents=*/10, /*timeoutSeconds=*/10, deltas); + collectMeasurementIntervals(callback, /*numEvents=*/10, kFirstMeasTimeoutSec, deltas); + assertMeanAndStdev(locationIntervalMs, deltas); + // Stop location request and verify the measurements are received at 2s intervals StopAndClearLocations(); + callback->gnss_data_cbq_.reset(); + deltas.clear(); + collectMeasurementIntervals(callback, /*numEvents=*/5, kFirstMeasTimeoutSec, deltas); + assertMeanAndStdev(intervalMs, deltas); + status = iGnssMeasurement->close(); ASSERT_TRUE(status.isOk()); - - assertMeanAndStdev(locationIntervalMs, deltas); } } /* - * TestGnssMeasurementSetCallback: + * TestGnssMeasurementIntervals_changeIntervals: * This test ensures setCallback() can be called consecutively without close(). * 1. Start measurement with 20s interval and wait for 1 measurement. * 2. Start measurement with 1s interval and wait for 5 measurements. * Verify the measurements were received at 1Hz. + * 3. Start measurement with 2s interval and wait for 5 measurements. + * Verify the measurements were received at 2s intervals. */ -TEST_P(GnssHalTest, TestGnssMeasurementSetCallback) { +TEST_P(GnssHalTest, TestGnssMeasurementIntervals_changeIntervals) { if (aidl_gnss_hal_->getInterfaceVersion() <= 2) { return; } @@ -1526,7 +1537,6 @@ TEST_P(GnssHalTest, TestGnssMeasurementSetCallback) { ASSERT_TRUE(status.isOk()); ASSERT_TRUE(iGnssMeasurement != nullptr); - ALOGD("TestGnssMeasurementSetCallback"); auto callback = sp::make(); std::vector deltas; @@ -1537,6 +1547,7 @@ TEST_P(GnssHalTest, TestGnssMeasurementSetCallback) { // setCallback at 1s interval and wait for 5 measurements callback->gnss_data_cbq_.reset(); + deltas.clear(); startMeasurementWithInterval(1000, iGnssMeasurement, callback); collectMeasurementIntervals(callback, /* numEvents= */ 5, kFirstGnssMeasurementTimeoutSeconds, deltas); @@ -1544,6 +1555,16 @@ TEST_P(GnssHalTest, TestGnssMeasurementSetCallback) { // verify the measurements were received at 1Hz assertMeanAndStdev(1000, deltas); + // setCallback at 2s interval and wait for 5 measurements + callback->gnss_data_cbq_.reset(); + deltas.clear(); + startMeasurementWithInterval(2000, iGnssMeasurement, callback); + collectMeasurementIntervals(callback, /* numEvents= */ 5, kFirstGnssMeasurementTimeoutSeconds, + deltas); + + // verify the measurements were received at 2s intervals + assertMeanAndStdev(2000, deltas); + status = iGnssMeasurement->close(); ASSERT_TRUE(status.isOk()); } From 2d8582097981797402545a862b4567902fb1fa71 Mon Sep 17 00:00:00 2001 From: Matthew Sedam Date: Mon, 6 Mar 2023 21:13:17 +0000 Subject: [PATCH 804/998] Fix event collection in SensorsVtsEnvironmentBase.h Only collect the events that match the description. Bug: 270611181 Test: atest VtsAidlHalSensorsTargetTest Test: atest VtsHalSensorsV2_0TargetTest Change-Id: Iac4c4dc39b3a4d32dbfdb7770989204c1fe28c47 --- .../sensors-vts-utils/SensorsHidlTestBase.h | 26 +++++++------------ .../SensorsVtsEnvironmentBase.h | 21 +++++++++++---- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/sensors/common/vts/utils/include/sensors-vts-utils/SensorsHidlTestBase.h b/sensors/common/vts/utils/include/sensors-vts-utils/SensorsHidlTestBase.h index f2c92ae1a4..ec7c906759 100644 --- a/sensors/common/vts/utils/include/sensors-vts-utils/SensorsHidlTestBase.h +++ b/sensors/common/vts/utils/include/sensors-vts-utils/SensorsHidlTestBase.h @@ -225,7 +225,9 @@ class SensorsHidlTestBase : public testing::TestWithParam { ASSERT_EQ(batch(handle, samplingPeriodInNs, batchingPeriodInNs), Result::OK); ASSERT_EQ(activate(handle, 1), Result::OK); - events = getEnvironment()->collectEvents(minTimeUs, minNEvent, true /*clearBeforeStart*/); + events = getEnvironment()->collectEvents( + minTimeUs, minNEvent, true /* clearBeforeStart */, true /* changeCollection */, + [&type](const EventType& event) { return event.sensorType == type; }); ASSERT_EQ(activate(handle, 0), Result::OK); ALOGI("Collected %zu samples", events.size()); @@ -233,24 +235,14 @@ class SensorsHidlTestBase : public testing::TestWithParam { ASSERT_GT(events.size(), 0u); bool handleMismatchReported = false; - bool metaSensorTypeErrorReported = false; for (auto& e : events) { - if (e.sensorType == type) { - // avoid generating hundreds of error - if (!handleMismatchReported) { - EXPECT_EQ(e.sensorHandle, handle) - << (handleMismatchReported = true, - "Event of the same type must come from the sensor registered"); - } - sensorEvents.push_back(e); - } else { - // avoid generating hundreds of error - if (!metaSensorTypeErrorReported) { - EXPECT_TRUE(isMetaSensorType(e.sensorType)) - << (metaSensorTypeErrorReported = true, - "Only meta types are allowed besides the type registered"); - } + // avoid generating hundreds of error + if (!handleMismatchReported) { + EXPECT_EQ(e.sensorHandle, handle) + << (handleMismatchReported = true, + "Event of the same type must come from the sensor registered"); } + sensorEvents.push_back(e); } std::string s; diff --git a/sensors/common/vts/utils/include/sensors-vts-utils/SensorsVtsEnvironmentBase.h b/sensors/common/vts/utils/include/sensors-vts-utils/SensorsVtsEnvironmentBase.h index e851d401d1..c061a75b8f 100644 --- a/sensors/common/vts/utils/include/sensors-vts-utils/SensorsVtsEnvironmentBase.h +++ b/sensors/common/vts/utils/include/sensors-vts-utils/SensorsVtsEnvironmentBase.h @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -61,9 +62,16 @@ class SensorsVtsEnvironmentBase { } // set sensor event collection status - void setCollection(bool enable) { + void setCollection(bool enable, const std::optional>& filter = + std::nullopt) { std::lock_guard lock(mEventsMutex); mCollectionEnabled = enable; + + if (enable && filter.has_value()) { + mEventFilter = *filter; + } else { + mEventFilter.reset(); + } } void registerCallback(IEventCallback* callback) { @@ -76,8 +84,10 @@ class SensorsVtsEnvironmentBase { mCallback = nullptr; } - std::vector collectEvents(useconds_t timeLimitUs, size_t nEventLimit, - bool clearBeforeStart = true, bool changeCollection = true) { + std::vector collectEvents( + useconds_t timeLimitUs, size_t nEventLimit, bool clearBeforeStart = true, + bool changeCollection = true, + const std::optional>& filter = std::nullopt) { std::vector events; constexpr useconds_t SLEEP_GRANULARITY = 100 * 1000; // granularity 100 ms @@ -85,7 +95,7 @@ class SensorsVtsEnvironmentBase { clearBeforeStart); if (changeCollection) { - setCollection(true); + setCollection(true, filter); } if (clearBeforeStart) { catEvents(nullptr); @@ -121,7 +131,7 @@ class SensorsVtsEnvironmentBase { void addEvent(const Event& ev) { std::lock_guard lock(mEventsMutex); - if (mCollectionEnabled) { + if (mCollectionEnabled && (!mEventFilter.has_value() || (*mEventFilter)(ev))) { mEvents.push_back(ev); } @@ -138,6 +148,7 @@ class SensorsVtsEnvironmentBase { std::atomic_bool mStopThread; std::thread mPollThread; std::vector mEvents; + std::optional> mEventFilter; std::mutex mEventsMutex; IEventCallback* mCallback; From c64a669ac460471928d8e85a8d9eaa9fb146cd98 Mon Sep 17 00:00:00 2001 From: shrikar Date: Mon, 6 Mar 2023 21:51:34 +0000 Subject: [PATCH 805/998] Updated SEAT_EASY_ACCESS_ENABLED HAL docs to specify meaning of areaId. Bug: 262740299 Test: manual build Change-Id: If6c5b06ba4ecd83485bf593e64254507deaf6caf --- .../android/hardware/automotive/vehicle/VehicleProperty.aidl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index b628b602f1..b5fb5b611d 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1946,7 +1946,8 @@ enum VehicleProperty { * Represents property for Seat easy access feature. * * If true, the seat will automatically adjust to make it easier for the occupant to enter and - * exit the vehicle. + * exit the vehicle. Each area ID must map to the seat that the user is trying to enter/exit + * with the help of the easy access feature. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE From 39c78ffecf914edc0a167a06a76b9071c0ba36e5 Mon Sep 17 00:00:00 2001 From: Zhanghao Wen Date: Fri, 6 Jan 2023 14:30:53 -0800 Subject: [PATCH 806/998] Update HAL comment of getReceivedSvTimeNs Added GPS L1C(P), BDS B1C(P) with value: CODE_LOCK(10 ms), STATE_2ND_CODE_LOCK(18000 ms), TOW_KNOWN(1 week). Added BDS B2AQ: Same as E5AQ Added IRNSS: Same as GPS L1 C/A Bug: 264588057 Test: comment only Change-Id: Ia452beb129b791116bf33a8feed6bb0d04238dd2 --- .../hardware/gnss/GnssMeasurement.aidl | 88 +++++++++---------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl b/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl index db724a49c8..925df1a010 100644 --- a/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl +++ b/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl @@ -133,50 +133,50 @@ parcelable GnssMeasurement { * zero to the value in the table. The state flag with the widest range indicates the range of * the received GNSS satellite time value. * - * +---------------------------+--------------------+-----+-----------+--------------------+------+ - * | |GPS/QZSS |GLNS |BDS |GAL |SBAS | - * +---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |State Flag |L1 |L5I |L5Q |L1OF |B1I |B1I |E1B |E1C |E5AQ |L1 | - * | |C/A | | | |(D1) |(D2)| | | |C/A | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_UNKNOWN |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_CODE_LOCK |1ms |1 ms |1 ms |1 ms |1 ms |1 ms|- |- |1 ms |1 ms | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_SYMBOL_SYNC |20ms |10 ms |1 ms |10 ms|20 ms |2 ms|4 ms |4 ms |1 ms |2 ms | - * | |(opt.)| |(opt.)| |(opt.)| |(opt.)|(opt.)|(opt.)| | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_BIT_SYNC |20 ms |20 ms |1 ms |20 ms|20 ms |- |8 ms |- |1 ms |4 ms | - * | | | |(opt.)| | | | | |(opt.)| | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_SUBFRAME_SYNC |6s |6s |- |2 s |6 s |- |- |- |100 ms|- | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_TOW_DECODED |1 week|- |- |1 day|1 week|- |1 week|- |- |1 week| - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_TOW_KNOWN |1 week|- |- |1 day|1 week|- |1 week|- |- |1 week| - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_GLO_STRING_SYNC |- |- |- |2 s |- |- |- |- |- |- | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_GLO_TOD_DECODED |- |- |- |1 day|- |- |- |- |- |- | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_GLO_TOD_KNOWN |- |- |- |1 day|- |- |- |- |- |- | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_BDS_D2_BIT_SYNC |- |- |- |- |- |2 ms|- |- |- |- | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_BDS_D2_SUBFRAME_SYNC |- |- |- |- |- |600 |- |- |- |- | - * | | | | | | |ms | | | | | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_GAL_E1BC_CODE_LOCK |- |- |- |- |- |- |4 ms |4 ms |- |- | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_GAL_E1C_2ND_CODE_LOCK|- |- |- |- |- |- |- |100 ms|- |- | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_2ND_CODE_LOCK |- |10 ms |20 ms |- |- |- |- |100 ms|100 ms|- | - * | | |(opt.)| | | | | |(opt.)| | | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_GAL_E1B_PAGE_SYNC |- |- |- |- |- |- |2 s |- |- |- | - * |---------------------------+------+------+------+-----+------+----+------+------+------+------+ - * |STATE_SBAS_SYNC |- |- |- |- |- |- |- |- |- |1s | - * +---------------------------+------+------+------+-----+------+----+------+------+------+------+ + * +---------------------------+---------------------------+-----+---------------------------+--------------------+------+------+ + * | |GPS/QZSS |GLNS |BDS |GAL |SBAS |IRNSS | + * +---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |State Flag |L1 |L1C |L5I |L5Q |L1OF |B1I |B1I |B1C |B2AQ |E1B |E1C |E5AQ |L1 |L5C | + * | |C/A |(P) | | | |(D1) |(D2) |(P) | | | | |C/A | | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_UNKNOWN |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 |0 | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_CODE_LOCK |1ms |10 ms |1 ms |1 ms |1 ms |1 ms |1 ms |10 ms |1 ms |- |- |1 ms |1 ms |1ms | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_SYMBOL_SYNC |- |- |10 ms |- |10 ms|- |2 ms |- |- |- |- |- |2 ms |- | + * | | | | | | | | | | | | | | | | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_BIT_SYNC |20 ms |- |20 ms |- |20 ms|20 ms |- |- |- |8 ms |- |- |4 ms |20 ms | + * | | | | | | | | | | | | | | | | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_SUBFRAME_SYNC |6s |- |6s |- |- |6 s |- |- |100 ms|- |- |100 ms|- |6s | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_TOW_DECODED |1 week|- |1 week|- |- |1 week|1 week|- |- |1 week|1 week|- |1 week|1 week| + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_TOW_KNOWN |1 week|1 week|1 week|1 week|- |1 week|1 week|1 week|1 week|1 week|1 week|1 week|1 week|1 week| + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_GLO_STRING_SYNC |- |- |- |- |2 s |- |- |- |- |- |- |- |- |- | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_GLO_TOD_DECODED |- |- |- |- |1 day|- |- |- |- |- |- |- |- |- | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_GLO_TOD_KNOWN |- |- |- |- |1 day|- |- |- |- |- |- |- |- |- | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_BDS_D2_BIT_SYNC |- |- |- |- |- |- |2 ms |- |- |- |- |- |- |- | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_BDS_D2_SUBFRAME_SYNC |- |- |- |- |- |- |600 |- |- |- |- |- |- |- | + * | | | | | | | |ms | | | | | | | | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_GAL_E1BC_CODE_LOCK |- |- |- |- |- |- |- |- |- |4 ms |4 ms |- |- |- | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_GAL_E1C_2ND_CODE_LOCK|- |- |- |- |- |- |- |- |- |- |100 ms|- |- |- | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_2ND_CODE_LOCK |- |18000 |10 ms |20 ms |- |- |- |18000 |100 ms|- |- |100 ms|- |- | + * | | |ms | | | | | |ms | | | | | | | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_GAL_E1B_PAGE_SYNC |- |- |- |- |- |- |- |- |- |2 s |- |- |- |- | + * |---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ + * |STATE_SBAS_SYNC |- |- |- |- |- |- |- |- |- |- |- |- |1s |- | + * +---------------------------+------+------+------+------+-----+------+------+------+------+------+------+------+------+------+ * * Note: TOW Known refers to the case where TOW is possibly not decoded over the air but has * been determined from other sources. If TOW decoded is set then TOW Known must also be set. From 810771c3239f748077b2b415532b98c7da79ce9e Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Thu, 9 Mar 2023 00:40:50 +0000 Subject: [PATCH 807/998] Remove deprecated method getValidFrequenciesForBand from IWifiApIface and IWifiStaIface. Bug: 267819850 Test: atest VtsHalWifiStaIfaceTargetTest \ VtsHalWifiApIfaceTargetTest Change-Id: I369d72e3eff9283552822a92b26ce0f4fb35fedf --- .../android/hardware/wifi/IWifiApIface.aidl | 1 - .../android/hardware/wifi/IWifiStaIface.aidl | 1 - .../android/hardware/wifi/IWifiApIface.aidl | 14 -------------- .../android/hardware/wifi/IWifiStaIface.aidl | 16 ---------------- wifi/aidl/default/wifi_ap_iface.cpp | 18 ------------------ wifi/aidl/default/wifi_ap_iface.h | 4 ---- wifi/aidl/default/wifi_sta_iface.cpp | 18 ------------------ wifi/aidl/default/wifi_sta_iface.h | 4 ---- .../vts/functional/wifi_ap_iface_aidl_test.cpp | 13 ------------- .../functional/wifi_sta_iface_aidl_test.cpp | 10 ---------- 10 files changed, 99 deletions(-) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiApIface.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiApIface.aidl index a102b9779d..e71dde40fd 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiApIface.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiApIface.aidl @@ -38,7 +38,6 @@ interface IWifiApIface { String[] getBridgedInstances(); byte[6] getFactoryMacAddress(); void setCountryCode(in byte[2] code); - int[] getValidFrequenciesForBand(in android.hardware.wifi.WifiBand band); void resetToFactoryMacAddress(); void setMacAddress(in byte[6] mac); } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl index 31b6881fa9..4b1fb5f8a1 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl @@ -47,7 +47,6 @@ interface IWifiStaIface { byte[6] getFactoryMacAddress(); android.hardware.wifi.StaLinkLayerStats getLinkLayerStats(); android.hardware.wifi.StaRoamingCapabilities getRoamingCapabilities(); - int[] getValidFrequenciesForBand(in android.hardware.wifi.WifiBand band); void installApfPacketFilter(in byte[] program); byte[] readApfPacketFilterData(); void registerEventCallback(in android.hardware.wifi.IWifiStaIfaceEventCallback callback); diff --git a/wifi/aidl/android/hardware/wifi/IWifiApIface.aidl b/wifi/aidl/android/hardware/wifi/IWifiApIface.aidl index 71ea385a3e..b14a8005b5 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiApIface.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiApIface.aidl @@ -67,20 +67,6 @@ interface IWifiApIface { */ void setCountryCode(in byte[2] code); - /** - * Used to query the list of valid frequencies (depending on country code set) - * for the provided band. - * - * @param band Band for which the frequency list is being generated. - * @return Vector of valid frequencies for the provided band. - * @throws ServiceSpecificException with one of the following values: - * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, - * |WifiStatusCode.ERROR_NOT_SUPPORTED|, - * |WifiStatusCode.ERROR_NOT_AVAILABLE|, - * |WifiStatusCode.ERROR_UNKNOWN| - */ - int[] getValidFrequenciesForBand(in WifiBand band); - /** * Reset all of the AP interfaces' MAC address to the factory MAC address. * diff --git a/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl b/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl index 28d6a4dfb6..fd239a7712 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl @@ -287,22 +287,6 @@ interface IWifiStaIface { */ StaRoamingCapabilities getRoamingCapabilities(); - /** - * Used to query the list of valid frequencies (depending on the country - * code set) for the provided band. These channels may be specified in the - * |BackgroundScanBucketParameters.frequenciesInMhz| for a background scan - * request. - * - * @param band Band for which the frequency list is being generated. - * @return Vector of valid frequencies for the provided band. - * @throws ServiceSpecificException with one of the following values: - * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, - * |WifiStatusCode.ERROR_NOT_SUPPORTED|, - * |WifiStatusCode.ERROR_NOT_AVAILABLE|, - * |WifiStatusCode.ERROR_UNKNOWN| - */ - int[] getValidFrequenciesForBand(in WifiBand band); - /** * Installs an APF program on this iface, replacing an existing * program if present. diff --git a/wifi/aidl/default/wifi_ap_iface.cpp b/wifi/aidl/default/wifi_ap_iface.cpp index 6cd932df41..77797502d3 100644 --- a/wifi/aidl/default/wifi_ap_iface.cpp +++ b/wifi/aidl/default/wifi_ap_iface.cpp @@ -64,12 +64,6 @@ ndk::ScopedAStatus WifiApIface::setCountryCode(const std::array& in_ &WifiApIface::setCountryCodeInternal, in_code); } -ndk::ScopedAStatus WifiApIface::getValidFrequenciesForBand(WifiBand in_band, - std::vector* _aidl_return) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::getValidFrequenciesForBandInternal, _aidl_return, in_band); -} - ndk::ScopedAStatus WifiApIface::setMacAddress(const std::array& in_mac) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, &WifiApIface::setMacAddressInternal, in_mac); @@ -101,18 +95,6 @@ ndk::ScopedAStatus WifiApIface::setCountryCodeInternal(const std::array, ndk::ScopedAStatus> WifiApIface::getValidFrequenciesForBandInternal( - WifiBand band) { - static_assert(sizeof(WifiChannelWidthInMhz) == sizeof(int32_t), "Size mismatch"); - legacy_hal::wifi_error legacy_status; - std::vector valid_frequencies; - std::tie(legacy_status, valid_frequencies) = legacy_hal_.lock()->getValidFrequenciesForBand( - instances_.size() > 0 ? instances_[0] : ifname_, - aidl_struct_util::convertAidlWifiBandToLegacy(band)); - return {std::vector(valid_frequencies.begin(), valid_frequencies.end()), - createWifiStatusFromLegacyError(legacy_status)}; -} - ndk::ScopedAStatus WifiApIface::setMacAddressInternal(const std::array& mac) { // Support random MAC up to 2 interfaces if (instances_.size() == 2) { diff --git a/wifi/aidl/default/wifi_ap_iface.h b/wifi/aidl/default/wifi_ap_iface.h index b5673fcaac..7378f98acf 100644 --- a/wifi/aidl/default/wifi_ap_iface.h +++ b/wifi/aidl/default/wifi_ap_iface.h @@ -45,8 +45,6 @@ class WifiApIface : public BnWifiApIface { // AIDL methods exposed. ndk::ScopedAStatus getName(std::string* _aidl_return) override; ndk::ScopedAStatus setCountryCode(const std::array& in_code) override; - ndk::ScopedAStatus getValidFrequenciesForBand(WifiBand in_band, - std::vector* _aidl_return) override; ndk::ScopedAStatus setMacAddress(const std::array& in_mac) override; ndk::ScopedAStatus getFactoryMacAddress(std::array* _aidl_return) override; ndk::ScopedAStatus resetToFactoryMacAddress() override; @@ -56,8 +54,6 @@ class WifiApIface : public BnWifiApIface { // Corresponding worker functions for the AIDL methods. std::pair getNameInternal(); ndk::ScopedAStatus setCountryCodeInternal(const std::array& code); - std::pair, ndk::ScopedAStatus> getValidFrequenciesForBandInternal( - WifiBand band); ndk::ScopedAStatus setMacAddressInternal(const std::array& mac); std::pair, ndk::ScopedAStatus> getFactoryMacAddressInternal( const std::string& ifaceName); diff --git a/wifi/aidl/default/wifi_sta_iface.cpp b/wifi/aidl/default/wifi_sta_iface.cpp index 300316aa07..ed7510a1c5 100644 --- a/wifi/aidl/default/wifi_sta_iface.cpp +++ b/wifi/aidl/default/wifi_sta_iface.cpp @@ -110,13 +110,6 @@ ndk::ScopedAStatus WifiStaIface::getBackgroundScanCapabilities( &WifiStaIface::getBackgroundScanCapabilitiesInternal, _aidl_return); } -ndk::ScopedAStatus WifiStaIface::getValidFrequenciesForBand(WifiBand in_band, - std::vector* _aidl_return) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getValidFrequenciesForBandInternal, _aidl_return, - in_band); -} - ndk::ScopedAStatus WifiStaIface::startBackgroundScan(int32_t in_cmdId, const StaBackgroundScanParameters& in_params) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, @@ -303,17 +296,6 @@ WifiStaIface::getBackgroundScanCapabilitiesInternal() { return {aidl_caps, ndk::ScopedAStatus::ok()}; } -std::pair, ndk::ScopedAStatus> -WifiStaIface::getValidFrequenciesForBandInternal(WifiBand band) { - static_assert(sizeof(WifiChannelWidthInMhz) == sizeof(int32_t), "Size mismatch"); - legacy_hal::wifi_error legacy_status; - std::vector valid_frequencies; - std::tie(legacy_status, valid_frequencies) = legacy_hal_.lock()->getValidFrequenciesForBand( - ifname_, aidl_struct_util::convertAidlWifiBandToLegacy(band)); - return {std::vector(valid_frequencies.begin(), valid_frequencies.end()), - createWifiStatusFromLegacyError(legacy_status)}; -} - ndk::ScopedAStatus WifiStaIface::startBackgroundScanInternal( int32_t cmd_id, const StaBackgroundScanParameters& params) { legacy_hal::wifi_scan_cmd_params legacy_params; diff --git a/wifi/aidl/default/wifi_sta_iface.h b/wifi/aidl/default/wifi_sta_iface.h index 2e4403ad7e..0c8f3e0e9d 100644 --- a/wifi/aidl/default/wifi_sta_iface.h +++ b/wifi/aidl/default/wifi_sta_iface.h @@ -62,8 +62,6 @@ class WifiStaIface : public BnWifiStaIface { ndk::ScopedAStatus readApfPacketFilterData(std::vector* _aidl_return) override; ndk::ScopedAStatus getBackgroundScanCapabilities( StaBackgroundScanCapabilities* _aidl_return) override; - ndk::ScopedAStatus getValidFrequenciesForBand(WifiBand in_band, - std::vector* _aidl_return) override; ndk::ScopedAStatus startBackgroundScan(int32_t in_cmdId, const StaBackgroundScanParameters& in_params) override; ndk::ScopedAStatus stopBackgroundScan(int32_t in_cmdId) override; @@ -106,8 +104,6 @@ class WifiStaIface : public BnWifiStaIface { std::pair, ndk::ScopedAStatus> readApfPacketFilterDataInternal(); std::pair getBackgroundScanCapabilitiesInternal(); - std::pair, ndk::ScopedAStatus> getValidFrequenciesForBandInternal( - WifiBand band); ndk::ScopedAStatus startBackgroundScanInternal(int32_t cmd_id, const StaBackgroundScanParameters& params); ndk::ScopedAStatus stopBackgroundScanInternal(int32_t cmd_id); diff --git a/wifi/aidl/vts/functional/wifi_ap_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_ap_iface_aidl_test.cpp index 0eaf660d49..d39cfb4f93 100644 --- a/wifi/aidl/vts/functional/wifi_ap_iface_aidl_test.cpp +++ b/wifi/aidl/vts/functional/wifi_ap_iface_aidl_test.cpp @@ -67,19 +67,6 @@ TEST_P(WifiApIfaceAidlTest, SetCountryCode) { EXPECT_TRUE(wifi_ap_iface->setCountryCode(country_code).isOk()); } -/* - * GetValidFrequenciesForBand - * Ensures that we can retrieve valid frequencies for the 2.4 GHz band. - */ -TEST_P(WifiApIfaceAidlTest, GetValidFrequenciesForBand) { - std::shared_ptr wifi_ap_iface = getWifiApIface(getInstanceName()); - ASSERT_NE(nullptr, wifi_ap_iface.get()); - - std::vector freqs; - EXPECT_TRUE(wifi_ap_iface->getValidFrequenciesForBand(WifiBand::BAND_24GHZ, &freqs).isOk()); - EXPECT_NE(freqs.size(), 0); -} - /* * GetFactoryMacAddress */ diff --git a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp index fe32be55c9..c968cd57bf 100644 --- a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp +++ b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp @@ -113,16 +113,6 @@ TEST_P(WifiStaIfaceAidlTest, GetBackgroundScanCapabilities) { EXPECT_TRUE(wifi_sta_iface_->getBackgroundScanCapabilities(&caps).isOk()); } -/* - * GetValidFrequenciesForBand - * Ensures that we can retrieve valid frequencies for the 2.4 GHz band. - */ -TEST_P(WifiStaIfaceAidlTest, GetValidFrequenciesForBand) { - std::vector freqs; - EXPECT_TRUE(wifi_sta_iface_->getValidFrequenciesForBand(WifiBand::BAND_24GHZ, &freqs).isOk()); - EXPECT_NE(freqs.size(), 0); -} - /* * GetLinkLayerStats * Ensures that calls to getLinkLayerStats will retrieve a non-empty From 2a391a09dfe0a54e708551dff9b1c1213d18962a Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Thu, 9 Mar 2023 19:07:53 +0000 Subject: [PATCH 808/998] Rename getCapabilities to getFeatureSet in IWifiChip and IWifiStaIface. Main purpose is to distinguish between the 2 capability methods in IWifiChip: - getCapabilities (renamed here) - getWifiChipCapabilities Bug: 267819850 Test: atest VtsHalWifiChipTargetTest \ VtsHalWifiStaIfaceTargetTest Change-Id: I03c15d652d02aef99b219c2d630b69acb4d9e43c --- .../android/hardware/wifi/IWifiChip.aidl | 4 +-- .../android/hardware/wifi/IWifiStaIface.aidl | 4 +-- .../aidl/android/hardware/wifi/IWifiChip.aidl | 8 ++--- .../android/hardware/wifi/IWifiStaIface.aidl | 8 ++--- .../vts/functional/wifi_aidl_test_utils.cpp | 8 ++--- .../vts/functional/wifi_aidl_test_utils.h | 2 +- .../vts/functional/wifi_chip_aidl_test.cpp | 34 +++++++++---------- .../functional/wifi_sta_iface_aidl_test.cpp | 32 ++++++++--------- 8 files changed, 50 insertions(+), 50 deletions(-) diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl index 23f403021a..502e7ac51c 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl @@ -47,7 +47,7 @@ interface IWifiChip { @PropagateAllowBlocking android.hardware.wifi.IWifiApIface getApIface(in String ifname); String[] getApIfaceNames(); android.hardware.wifi.IWifiChip.ChipMode[] getAvailableModes(); - int getCapabilities(); + int getFeatureSet(); android.hardware.wifi.WifiDebugHostWakeReasonStats getDebugHostWakeReasonStats(); android.hardware.wifi.WifiDebugRingBufferStatus[] getDebugRingBuffersStatus(); int getId(); @@ -85,7 +85,7 @@ interface IWifiChip { void setMloMode(in android.hardware.wifi.IWifiChip.ChipMloMode mode); const int NO_POWER_CAP_CONSTANT = 0x7FFFFFFF; @Backing(type="int") @VintfStability - enum ChipCapabilityMask { + enum FeatureSetMask { SET_TX_POWER_LIMIT = (1 << 0) /* 1 */, D2D_RTT = (1 << 1) /* 2 */, D2AP_RTT = (1 << 2) /* 4 */, diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl index a7f20810da..adf20dd200 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiStaIface.aidl @@ -41,7 +41,7 @@ interface IWifiStaIface { void enableNdOffload(in boolean enable); android.hardware.wifi.StaApfPacketFilterCapabilities getApfPacketFilterCapabilities(); android.hardware.wifi.StaBackgroundScanCapabilities getBackgroundScanCapabilities(); - int getCapabilities(); + int getFeatureSet(); android.hardware.wifi.WifiDebugRxPacketFateReport[] getDebugRxPacketFates(); android.hardware.wifi.WifiDebugTxPacketFateReport[] getDebugTxPacketFates(); byte[6] getFactoryMacAddress(); @@ -63,7 +63,7 @@ interface IWifiStaIface { void stopSendingKeepAlivePackets(in int cmdId); void setDtimMultiplier(in int multiplier); @Backing(type="int") @VintfStability - enum StaIfaceCapabilityMask { + enum FeatureSetMask { APF = (1 << 0) /* 1 */, BACKGROUND_SCAN = (1 << 1) /* 2 */, LINK_LAYER_STATS = (1 << 2) /* 4 */, diff --git a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl index 1710f63e64..9322d7ae03 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl @@ -44,7 +44,7 @@ interface IWifiChip { */ @VintfStability @Backing(type="int") - enum ChipCapabilityMask { + enum FeatureSetMask { /** * Set/Reset Tx Power limits. */ @@ -582,15 +582,15 @@ interface IWifiChip { ChipMode[] getAvailableModes(); /** - * Get the capabilities supported by this chip. + * Get the features supported by this chip. * - * @return Bitset of |ChipCapabilityMask| values. + * @return Bitset of |FeatureSetMask| values. * @throws ServiceSpecificException with one of the following values: * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|, * |WifiStatusCode.ERROR_NOT_AVAILABLE|, * |WifiStatusCode.ERROR_UNKNOWN| */ - int getCapabilities(); + int getFeatureSet(); /** * API to retrieve the wifi wake up reason stats for debugging. diff --git a/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl b/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl index 8e9a06d735..fd208a200e 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl @@ -38,7 +38,7 @@ interface IWifiStaIface { */ @VintfStability @Backing(type="int") - enum StaIfaceCapabilityMask { + enum FeatureSetMask { /** * Support for APF APIs. APF (Android Packet Filter) is a * BPF-like packet filtering bytecode executed by the firmware. @@ -190,15 +190,15 @@ interface IWifiStaIface { StaBackgroundScanCapabilities getBackgroundScanCapabilities(); /** - * Get the capabilities supported by this STA iface. + * Get the features supported by this STA iface. * - * @return Bitset of |StaIfaceCapabilityMask| values. + * @return Bitset of |FeatureSetMask| values. * @throws ServiceSpecificException with one of the following values: * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, * |WifiStatusCode.ERROR_NOT_AVAILABLE|, * |WifiStatusCode.ERROR_UNKNOWN| */ - int getCapabilities(); + int getFeatureSet(); /** * API to retrieve the fates of inbound packets. diff --git a/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp b/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp index 4cf14a269a..ca3c4b74f1 100644 --- a/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp +++ b/wifi/aidl/vts/functional/wifi_aidl_test_utils.cpp @@ -207,10 +207,10 @@ void stopWifiService(const char* instance_name) { } } -int32_t getChipCapabilities(const std::shared_ptr& wifi_chip) { - int32_t caps = 0; - if (wifi_chip->getCapabilities(&caps).isOk()) { - return caps; +int32_t getChipFeatureSet(const std::shared_ptr& wifi_chip) { + int32_t features = 0; + if (wifi_chip->getFeatureSet(&features).isOk()) { + return features; } return 0; } diff --git a/wifi/aidl/vts/functional/wifi_aidl_test_utils.h b/wifi/aidl/vts/functional/wifi_aidl_test_utils.h index 2eac9509e3..0d70c3b557 100644 --- a/wifi/aidl/vts/functional/wifi_aidl_test_utils.h +++ b/wifi/aidl/vts/functional/wifi_aidl_test_utils.h @@ -44,6 +44,6 @@ bool configureChipToSupportConcurrencyType(const std::shared_ptr& wif IfaceConcurrencyType type, int* configured_mode_id); // Used to trigger IWifi.stop() at the end of every test. void stopWifiService(const char* instance_name); -int32_t getChipCapabilities(const std::shared_ptr& wifi_chip); +int32_t getChipFeatureSet(const std::shared_ptr& wifi_chip); bool checkStatusCode(ndk::ScopedAStatus* status, WifiStatusCode expected_code); bool isAidlServiceAvailable(const char* instance_name); diff --git a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp index dbff9491a6..ca88d8e850 100644 --- a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp +++ b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp @@ -185,12 +185,12 @@ TEST_P(WifiChipAidlTest, RegisterEventCallback) { } /* - * GetCapabilities + * GetFeatureSet */ -TEST_P(WifiChipAidlTest, GetCapabilities) { +TEST_P(WifiChipAidlTest, GetFeatureSet) { configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); - EXPECT_NE(static_cast(caps), 0); + int32_t features = getChipFeatureSet(wifi_chip_); + EXPECT_NE(features, 0); } /* @@ -269,9 +269,9 @@ TEST_P(WifiChipAidlTest, SetCountryCode) { */ TEST_P(WifiChipAidlTest, SetLatencyMode_normal) { configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); + int32_t features = getChipFeatureSet(wifi_chip_); auto status = wifi_chip_->setLatencyMode(IWifiChip::LatencyMode::NORMAL); - if (caps & static_cast(IWifiChip::ChipCapabilityMask::SET_LATENCY_MODE)) { + if (features & static_cast(IWifiChip::FeatureSetMask::SET_LATENCY_MODE)) { EXPECT_TRUE(status.isOk()); } else { EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); @@ -284,9 +284,9 @@ TEST_P(WifiChipAidlTest, SetLatencyMode_normal) { */ TEST_P(WifiChipAidlTest, SetLatencyMode_low) { configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); + int32_t features = getChipFeatureSet(wifi_chip_); auto status = wifi_chip_->setLatencyMode(IWifiChip::LatencyMode::LOW); - if (caps & static_cast(IWifiChip::ChipCapabilityMask::SET_LATENCY_MODE)) { + if (features & static_cast(IWifiChip::FeatureSetMask::SET_LATENCY_MODE)) { EXPECT_TRUE(status.isOk()); } else { EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); @@ -366,12 +366,12 @@ TEST_P(WifiChipAidlTest, SetCoexUnsafeChannels) { */ TEST_P(WifiChipAidlTest, SelectTxPowerScenario_body) { configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); - int32_t expected_caps = - static_cast(IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT) | - static_cast(IWifiChip::ChipCapabilityMask::USE_BODY_HEAD_SAR); + int32_t features = getChipFeatureSet(wifi_chip_); + int32_t expected_features = + static_cast(IWifiChip::FeatureSetMask::SET_TX_POWER_LIMIT) | + static_cast(IWifiChip::FeatureSetMask::USE_BODY_HEAD_SAR); auto status = wifi_chip_->selectTxPowerScenario(IWifiChip::TxPowerScenario::ON_BODY_CELL_OFF); - if (caps & expected_caps) { + if (features & expected_features) { EXPECT_TRUE(status.isOk()); } else { EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); @@ -383,9 +383,9 @@ TEST_P(WifiChipAidlTest, SelectTxPowerScenario_body) { */ TEST_P(WifiChipAidlTest, SelectTxPowerScenario_voiceCall) { configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); + int32_t features = getChipFeatureSet(wifi_chip_); auto status = wifi_chip_->selectTxPowerScenario(IWifiChip::TxPowerScenario::VOICE_CALL); - if (caps & static_cast(IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT)) { + if (features & static_cast(IWifiChip::FeatureSetMask::SET_TX_POWER_LIMIT)) { EXPECT_TRUE(status.isOk()); } else { EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); @@ -397,9 +397,9 @@ TEST_P(WifiChipAidlTest, SelectTxPowerScenario_voiceCall) { */ TEST_P(WifiChipAidlTest, ResetTxPowerScenario) { configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t caps = getChipCapabilities(wifi_chip_); + int32_t features = getChipFeatureSet(wifi_chip_); auto status = wifi_chip_->resetTxPowerScenario(); - if (caps & static_cast(IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT)) { + if (features & static_cast(IWifiChip::FeatureSetMask::SET_TX_POWER_LIMIT)) { EXPECT_TRUE(status.isOk()); } else { EXPECT_TRUE(checkStatusCode(&status, WifiStatusCode::ERROR_NOT_SUPPORTED)); diff --git a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp index b772bc320f..29e110145b 100644 --- a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp +++ b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp @@ -53,10 +53,10 @@ class WifiStaIfaceAidlTest : public testing::TestWithParam { void TearDown() override { stopWifiService(getInstanceName()); } protected: - bool isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask expected) { - int32_t caps = 0; - EXPECT_TRUE(wifi_sta_iface_->getCapabilities(&caps).isOk()); - return caps & static_cast(expected); + bool isFeatureSupported(IWifiStaIface::FeatureSetMask expected) { + int32_t features = 0; + EXPECT_TRUE(wifi_sta_iface_->getFeatureSet(&features).isOk()); + return features & static_cast(expected); } ndk::ScopedAStatus createStaIface(std::shared_ptr* sta_iface) { @@ -83,19 +83,19 @@ TEST_P(WifiStaIfaceAidlTest, GetFactoryMacAddress) { } /* - * GetCapabilities + * GetFeatureSet */ -TEST_P(WifiStaIfaceAidlTest, GetCapabilities) { - int32_t caps = 0; - EXPECT_TRUE(wifi_sta_iface_->getCapabilities(&caps).isOk()); - EXPECT_NE(caps, 0); +TEST_P(WifiStaIfaceAidlTest, GetFeatureSet) { + int32_t features = 0; + EXPECT_TRUE(wifi_sta_iface_->getFeatureSet(&features).isOk()); + EXPECT_NE(features, 0); } /* * GetApfPacketFilterCapabilities */ TEST_P(WifiStaIfaceAidlTest, GetApfPacketFilterCapabilities) { - if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::APF)) { + if (!isFeatureSupported(IWifiStaIface::FeatureSetMask::APF)) { GTEST_SKIP() << "APF packet filter capabilities are not supported."; } StaApfPacketFilterCapabilities apf_caps = {}; @@ -106,7 +106,7 @@ TEST_P(WifiStaIfaceAidlTest, GetApfPacketFilterCapabilities) { * GetBackgroundScanCapabilities */ TEST_P(WifiStaIfaceAidlTest, GetBackgroundScanCapabilities) { - if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::BACKGROUND_SCAN)) { + if (!isFeatureSupported(IWifiStaIface::FeatureSetMask::BACKGROUND_SCAN)) { GTEST_SKIP() << "Background scan capabilities are not supported."; } StaBackgroundScanCapabilities caps = {}; @@ -129,7 +129,7 @@ TEST_P(WifiStaIfaceAidlTest, GetValidFrequenciesForBand) { * StaLinkLayerStats after link layer stats collection is enabled. */ TEST_P(WifiStaIfaceAidlTest, GetLinkLayerStats) { - if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::LINK_LAYER_STATS)) { + if (!isFeatureSupported(IWifiStaIface::FeatureSetMask::LINK_LAYER_STATS)) { GTEST_SKIP() << "Skipping this test since link layer stats are not supported."; } @@ -176,7 +176,7 @@ TEST_P(WifiStaIfaceAidlTest, SetScanMode) { * LinkLayerStatsCollection */ TEST_P(WifiStaIfaceAidlTest, LinkLayerStatsCollection) { - if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::LINK_LAYER_STATS)) { + if (!isFeatureSupported(IWifiStaIface::FeatureSetMask::LINK_LAYER_STATS)) { GTEST_SKIP() << "Link layer stats collection is not supported."; } @@ -197,7 +197,7 @@ TEST_P(WifiStaIfaceAidlTest, LinkLayerStatsCollection) { * if the device is not connected to an AP. */ TEST_P(WifiStaIfaceAidlTest, RSSIMonitoring) { - if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::RSSI_MONITOR)) { + if (!isFeatureSupported(IWifiStaIface::FeatureSetMask::RSSI_MONITOR)) { GTEST_SKIP() << "RSSI monitoring is not supported."; } @@ -213,7 +213,7 @@ TEST_P(WifiStaIfaceAidlTest, RSSIMonitoring) { * RoamingControl */ TEST_P(WifiStaIfaceAidlTest, RoamingControl) { - if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::CONTROL_ROAMING)) { + if (!isFeatureSupported(IWifiStaIface::FeatureSetMask::CONTROL_ROAMING)) { GTEST_SKIP() << "Roaming control is not supported."; } @@ -245,7 +245,7 @@ TEST_P(WifiStaIfaceAidlTest, RoamingControl) { * EnableNDOffload */ TEST_P(WifiStaIfaceAidlTest, EnableNDOffload) { - if (!isCapabilitySupported(IWifiStaIface::StaIfaceCapabilityMask::ND_OFFLOAD)) { + if (!isFeatureSupported(IWifiStaIface::FeatureSetMask::ND_OFFLOAD)) { GTEST_SKIP() << "ND offload is not supported."; } EXPECT_TRUE(wifi_sta_iface_->enableNdOffload(true).isOk()); From 2f86249fcb9a121198bcddf3af4428f8ead88205 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Thu, 9 Mar 2023 19:13:07 +0000 Subject: [PATCH 809/998] Rename getCapabilities to getFeatureSet in the Vendor HAL implementation. Bug: 267819850 Test: Run gTest suite Change-Id: Id21f3edde0b01636d0a994cc8b7b1d434bacaa04 --- wifi/aidl/default/aidl_struct_util.cpp | 66 +++++++++---------- wifi/aidl/default/aidl_struct_util.h | 4 +- .../tests/aidl_struct_util_unit_tests.cpp | 10 +-- wifi/aidl/default/wifi_chip.cpp | 13 ++-- wifi/aidl/default/wifi_chip.h | 4 +- wifi/aidl/default/wifi_sta_iface.cpp | 14 ++-- wifi/aidl/default/wifi_sta_iface.h | 4 +- 7 files changed, 56 insertions(+), 59 deletions(-) diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp index 4acdd2fecf..7bc2eeb349 100644 --- a/wifi/aidl/default/aidl_struct_util.cpp +++ b/wifi/aidl/default/aidl_struct_util.cpp @@ -41,68 +41,67 @@ inline std::vector uintToIntVec(const std::vector& in) { return std::vector(in.begin(), in.end()); } -IWifiChip::ChipCapabilityMask convertLegacyFeatureToAidlChipCapability(uint64_t feature) { +IWifiChip::FeatureSetMask convertLegacyChipFeatureToAidl(uint64_t feature) { switch (feature) { case WIFI_FEATURE_SET_TX_POWER_LIMIT: - return IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT; + return IWifiChip::FeatureSetMask::SET_TX_POWER_LIMIT; case WIFI_FEATURE_USE_BODY_HEAD_SAR: - return IWifiChip::ChipCapabilityMask::USE_BODY_HEAD_SAR; + return IWifiChip::FeatureSetMask::USE_BODY_HEAD_SAR; case WIFI_FEATURE_D2D_RTT: - return IWifiChip::ChipCapabilityMask::D2D_RTT; + return IWifiChip::FeatureSetMask::D2D_RTT; case WIFI_FEATURE_D2AP_RTT: - return IWifiChip::ChipCapabilityMask::D2AP_RTT; + return IWifiChip::FeatureSetMask::D2AP_RTT; case WIFI_FEATURE_INFRA_60G: - return IWifiChip::ChipCapabilityMask::WIGIG; + return IWifiChip::FeatureSetMask::WIGIG; case WIFI_FEATURE_SET_LATENCY_MODE: - return IWifiChip::ChipCapabilityMask::SET_LATENCY_MODE; + return IWifiChip::FeatureSetMask::SET_LATENCY_MODE; case WIFI_FEATURE_P2P_RAND_MAC: - return IWifiChip::ChipCapabilityMask::P2P_RAND_MAC; + return IWifiChip::FeatureSetMask::P2P_RAND_MAC; case WIFI_FEATURE_AFC_CHANNEL: - return IWifiChip::ChipCapabilityMask::SET_AFC_CHANNEL_ALLOWANCE; + return IWifiChip::FeatureSetMask::SET_AFC_CHANNEL_ALLOWANCE; }; CHECK(false) << "Unknown legacy feature: " << feature; return {}; } -IWifiStaIface::StaIfaceCapabilityMask convertLegacyFeatureToAidlStaIfaceCapability( - uint64_t feature) { +IWifiStaIface::FeatureSetMask convertLegacyStaIfaceFeatureToAidl(uint64_t feature) { switch (feature) { case WIFI_FEATURE_GSCAN: - return IWifiStaIface::StaIfaceCapabilityMask::BACKGROUND_SCAN; + return IWifiStaIface::FeatureSetMask::BACKGROUND_SCAN; case WIFI_FEATURE_LINK_LAYER_STATS: - return IWifiStaIface::StaIfaceCapabilityMask::LINK_LAYER_STATS; + return IWifiStaIface::FeatureSetMask::LINK_LAYER_STATS; case WIFI_FEATURE_RSSI_MONITOR: - return IWifiStaIface::StaIfaceCapabilityMask::RSSI_MONITOR; + return IWifiStaIface::FeatureSetMask::RSSI_MONITOR; case WIFI_FEATURE_CONTROL_ROAMING: - return IWifiStaIface::StaIfaceCapabilityMask::CONTROL_ROAMING; + return IWifiStaIface::FeatureSetMask::CONTROL_ROAMING; case WIFI_FEATURE_IE_WHITELIST: - return IWifiStaIface::StaIfaceCapabilityMask::PROBE_IE_ALLOWLIST; + return IWifiStaIface::FeatureSetMask::PROBE_IE_ALLOWLIST; case WIFI_FEATURE_SCAN_RAND: - return IWifiStaIface::StaIfaceCapabilityMask::SCAN_RAND; + return IWifiStaIface::FeatureSetMask::SCAN_RAND; case WIFI_FEATURE_INFRA_5G: - return IWifiStaIface::StaIfaceCapabilityMask::STA_5G; + return IWifiStaIface::FeatureSetMask::STA_5G; case WIFI_FEATURE_HOTSPOT: - return IWifiStaIface::StaIfaceCapabilityMask::HOTSPOT; + return IWifiStaIface::FeatureSetMask::HOTSPOT; case WIFI_FEATURE_PNO: - return IWifiStaIface::StaIfaceCapabilityMask::PNO; + return IWifiStaIface::FeatureSetMask::PNO; case WIFI_FEATURE_TDLS: - return IWifiStaIface::StaIfaceCapabilityMask::TDLS; + return IWifiStaIface::FeatureSetMask::TDLS; case WIFI_FEATURE_TDLS_OFFCHANNEL: - return IWifiStaIface::StaIfaceCapabilityMask::TDLS_OFFCHANNEL; + return IWifiStaIface::FeatureSetMask::TDLS_OFFCHANNEL; case WIFI_FEATURE_CONFIG_NDO: - return IWifiStaIface::StaIfaceCapabilityMask::ND_OFFLOAD; + return IWifiStaIface::FeatureSetMask::ND_OFFLOAD; case WIFI_FEATURE_MKEEP_ALIVE: - return IWifiStaIface::StaIfaceCapabilityMask::KEEP_ALIVE; + return IWifiStaIface::FeatureSetMask::KEEP_ALIVE; }; CHECK(false) << "Unknown legacy feature: " << feature; return {}; } -bool convertLegacyFeaturesToAidlChipCapabilities(uint64_t legacy_feature_set, uint32_t* aidl_caps) { - if (!aidl_caps) { +bool convertLegacyChipFeaturesToAidl(uint64_t legacy_feature_set, uint32_t* aidl_feature_set) { + if (!aidl_feature_set) { return false; } - *aidl_caps = {}; + *aidl_feature_set = 0; std::vector features = {WIFI_FEATURE_SET_TX_POWER_LIMIT, WIFI_FEATURE_USE_BODY_HEAD_SAR, WIFI_FEATURE_D2D_RTT, @@ -113,7 +112,7 @@ bool convertLegacyFeaturesToAidlChipCapabilities(uint64_t legacy_feature_set, ui WIFI_FEATURE_AFC_CHANNEL}; for (const auto feature : features) { if (feature & legacy_feature_set) { - *aidl_caps |= static_cast(convertLegacyFeatureToAidlChipCapability(feature)); + *aidl_feature_set |= static_cast(convertLegacyChipFeatureToAidl(feature)); } } @@ -449,24 +448,23 @@ bool convertLegacyWifiMacInfosToAidl( return true; } -bool convertLegacyFeaturesToAidlStaCapabilities(uint64_t legacy_feature_set, uint32_t* aidl_caps) { - if (!aidl_caps) { +bool convertLegacyStaIfaceFeaturesToAidl(uint64_t legacy_feature_set, uint32_t* aidl_feature_set) { + if (!aidl_feature_set) { return false; } - *aidl_caps = {}; + *aidl_feature_set = 0; for (const auto feature : {WIFI_FEATURE_GSCAN, WIFI_FEATURE_LINK_LAYER_STATS, WIFI_FEATURE_RSSI_MONITOR, WIFI_FEATURE_CONTROL_ROAMING, WIFI_FEATURE_IE_WHITELIST, WIFI_FEATURE_SCAN_RAND, WIFI_FEATURE_INFRA_5G, WIFI_FEATURE_HOTSPOT, WIFI_FEATURE_PNO, WIFI_FEATURE_TDLS, WIFI_FEATURE_TDLS_OFFCHANNEL, WIFI_FEATURE_CONFIG_NDO, WIFI_FEATURE_MKEEP_ALIVE}) { if (feature & legacy_feature_set) { - *aidl_caps |= - static_cast(convertLegacyFeatureToAidlStaIfaceCapability(feature)); + *aidl_feature_set |= static_cast(convertLegacyStaIfaceFeatureToAidl(feature)); } } // There is no flag for this one in the legacy feature set. Adding it to the // set because all the current devices support it. - *aidl_caps |= static_cast(IWifiStaIface::StaIfaceCapabilityMask::APF); + *aidl_feature_set |= static_cast(IWifiStaIface::FeatureSetMask::APF); return true; } diff --git a/wifi/aidl/default/aidl_struct_util.h b/wifi/aidl/default/aidl_struct_util.h index 9a13672424..e4ff9638bb 100644 --- a/wifi/aidl/default/aidl_struct_util.h +++ b/wifi/aidl/default/aidl_struct_util.h @@ -40,7 +40,7 @@ namespace wifi { namespace aidl_struct_util { // Chip conversion methods. -bool convertLegacyFeaturesToAidlChipCapabilities(uint64_t legacy_feature_set, uint32_t* aidl_caps); +bool convertLegacyChipFeaturesToAidl(uint64_t legacy_feature_set, uint32_t* aidl_feature_set); bool convertLegacyDebugRingBufferStatusToAidl( const legacy_hal::wifi_ring_buffer_status& legacy_status, WifiDebugRingBufferStatus* aidl_status); @@ -74,7 +74,7 @@ bool convertLegacyIfaceCombinationsMatrixToChipMode( legacy_hal::wifi_iface_concurrency_matrix& legacy_matrix, IWifiChip::ChipMode* chip_mode); // STA iface conversion methods. -bool convertLegacyFeaturesToAidlStaCapabilities(uint64_t legacy_feature_set, uint32_t* aidl_caps); +bool convertLegacyStaIfaceFeaturesToAidl(uint64_t legacy_feature_set, uint32_t* aidl_feature_set); bool convertLegacyApfCapabilitiesToAidl(const legacy_hal::PacketFilterCapabilities& legacy_caps, StaApfPacketFilterCapabilities* aidl_caps); bool convertLegacyGscanCapabilitiesToAidl(const legacy_hal::wifi_gscan_capabilities& legacy_caps, diff --git a/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp index 4bd77acfee..5c334f8d56 100644 --- a/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp +++ b/wifi/aidl/default/tests/aidl_struct_util_unit_tests.cpp @@ -658,16 +658,16 @@ TEST_F(AidlStructUtilTest, canConvertLegacyLinkLayerStatsToAidl) { } TEST_F(AidlStructUtilTest, CanConvertLegacyFeaturesToAidl) { - using AidlChipCaps = IWifiChip::ChipCapabilityMask; + using AidlChipCaps = IWifiChip::FeatureSetMask; - uint32_t aidl_caps; + uint32_t aidl_features; uint32_t legacy_feature_set = WIFI_FEATURE_D2D_RTT | WIFI_FEATURE_SET_LATENCY_MODE; - ASSERT_TRUE(aidl_struct_util::convertLegacyFeaturesToAidlChipCapabilities(legacy_feature_set, - &aidl_caps)); + ASSERT_TRUE( + aidl_struct_util::convertLegacyChipFeaturesToAidl(legacy_feature_set, &aidl_features)); EXPECT_EQ((uint32_t)AidlChipCaps::D2D_RTT | (uint32_t)AidlChipCaps::SET_LATENCY_MODE, - aidl_caps); + aidl_features); } void insertRadioCombination(legacy_hal::wifi_radio_combination* dst_radio_combination_ptr, diff --git a/wifi/aidl/default/wifi_chip.cpp b/wifi/aidl/default/wifi_chip.cpp index dd24e6b77e..3b2dba28bb 100644 --- a/wifi/aidl/default/wifi_chip.cpp +++ b/wifi/aidl/default/wifi_chip.cpp @@ -455,9 +455,9 @@ ndk::ScopedAStatus WifiChip::registerEventCallback( &WifiChip::registerEventCallbackInternal, event_callback); } -ndk::ScopedAStatus WifiChip::getCapabilities(int32_t* _aidl_return) { +ndk::ScopedAStatus WifiChip::getFeatureSet(int32_t* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getCapabilitiesInternal, _aidl_return); + &WifiChip::getFeatureSetInternal, _aidl_return); } ndk::ScopedAStatus WifiChip::getAvailableModes(std::vector* _aidl_return) { @@ -786,7 +786,7 @@ ndk::ScopedAStatus WifiChip::registerEventCallbackInternal( return ndk::ScopedAStatus::ok(); } -std::pair WifiChip::getCapabilitiesInternal() { +std::pair WifiChip::getFeatureSetInternal() { legacy_hal::wifi_error legacy_status; uint64_t legacy_feature_set; uint32_t legacy_logger_feature_set; @@ -802,12 +802,11 @@ std::pair WifiChip::getCapabilitiesInternal() { // some devices don't support querying logger feature set legacy_logger_feature_set = 0; } - uint32_t aidl_caps; - if (!aidl_struct_util::convertLegacyFeaturesToAidlChipCapabilities(legacy_feature_set, - &aidl_caps)) { + uint32_t aidl_feature_set; + if (!aidl_struct_util::convertLegacyChipFeaturesToAidl(legacy_feature_set, &aidl_feature_set)) { return {0, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; } - return {aidl_caps, ndk::ScopedAStatus::ok()}; + return {aidl_feature_set, ndk::ScopedAStatus::ok()}; } std::pair, ndk::ScopedAStatus> diff --git a/wifi/aidl/default/wifi_chip.h b/wifi/aidl/default/wifi_chip.h index c5dcee7888..6d2a59e85d 100644 --- a/wifi/aidl/default/wifi_chip.h +++ b/wifi/aidl/default/wifi_chip.h @@ -85,7 +85,7 @@ class WifiChip : public BnWifiChip { ndk::ScopedAStatus getId(int32_t* _aidl_return) override; ndk::ScopedAStatus registerEventCallback( const std::shared_ptr& in_callback) override; - ndk::ScopedAStatus getCapabilities(int32_t* _aidl_return) override; + ndk::ScopedAStatus getFeatureSet(int32_t* _aidl_return) override; ndk::ScopedAStatus getAvailableModes(std::vector* _aidl_return) override; ndk::ScopedAStatus configureChip(int32_t in_modeId) override; ndk::ScopedAStatus getMode(int32_t* _aidl_return) override; @@ -162,7 +162,7 @@ class WifiChip : public BnWifiChip { std::pair getIdInternal(); ndk::ScopedAStatus registerEventCallbackInternal( const std::shared_ptr& event_callback); - std::pair getCapabilitiesInternal(); + std::pair getFeatureSetInternal(); std::pair, ndk::ScopedAStatus> getAvailableModesInternal(); ndk::ScopedAStatus configureChipInternal(std::unique_lock* lock, int32_t mode_id); diff --git a/wifi/aidl/default/wifi_sta_iface.cpp b/wifi/aidl/default/wifi_sta_iface.cpp index eceeeb5c6b..73a8c7a192 100644 --- a/wifi/aidl/default/wifi_sta_iface.cpp +++ b/wifi/aidl/default/wifi_sta_iface.cpp @@ -82,9 +82,9 @@ ndk::ScopedAStatus WifiStaIface::registerEventCallback( &WifiStaIface::registerEventCallbackInternal, in_callback); } -ndk::ScopedAStatus WifiStaIface::getCapabilities(int32_t* _aidl_return) { +ndk::ScopedAStatus WifiStaIface::getFeatureSet(int32_t* _aidl_return) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getCapabilitiesInternal, _aidl_return); + &WifiStaIface::getFeatureSetInternal, _aidl_return); } ndk::ScopedAStatus WifiStaIface::getApfPacketFilterCapabilities( @@ -238,7 +238,7 @@ ndk::ScopedAStatus WifiStaIface::registerEventCallbackInternal( return ndk::ScopedAStatus::ok(); } -std::pair WifiStaIface::getCapabilitiesInternal() { +std::pair WifiStaIface::getFeatureSetInternal() { legacy_hal::wifi_error legacy_status; uint64_t legacy_feature_set; std::tie(legacy_status, legacy_feature_set) = @@ -246,12 +246,12 @@ std::pair WifiStaIface::getCapabilitiesInternal() { if (legacy_status != legacy_hal::WIFI_SUCCESS) { return {0, createWifiStatusFromLegacyError(legacy_status)}; } - uint32_t aidl_caps; - if (!aidl_struct_util::convertLegacyFeaturesToAidlStaCapabilities(legacy_feature_set, - &aidl_caps)) { + uint32_t aidl_feature_set; + if (!aidl_struct_util::convertLegacyStaIfaceFeaturesToAidl(legacy_feature_set, + &aidl_feature_set)) { return {0, createWifiStatus(WifiStatusCode::ERROR_UNKNOWN)}; } - return {aidl_caps, ndk::ScopedAStatus::ok()}; + return {aidl_feature_set, ndk::ScopedAStatus::ok()}; } std::pair diff --git a/wifi/aidl/default/wifi_sta_iface.h b/wifi/aidl/default/wifi_sta_iface.h index 0831e16416..8db424b64f 100644 --- a/wifi/aidl/default/wifi_sta_iface.h +++ b/wifi/aidl/default/wifi_sta_iface.h @@ -54,7 +54,7 @@ class WifiStaIface : public BnWifiStaIface { ndk::ScopedAStatus getName(std::string* _aidl_return) override; ndk::ScopedAStatus registerEventCallback( const std::shared_ptr& in_callback) override; - ndk::ScopedAStatus getCapabilities(int32_t* _aidl_return) override; + ndk::ScopedAStatus getFeatureSet(int32_t* _aidl_return) override; ndk::ScopedAStatus getApfPacketFilterCapabilities( StaApfPacketFilterCapabilities* _aidl_return) override; ndk::ScopedAStatus installApfPacketFilter(const std::vector& in_program) override; @@ -98,7 +98,7 @@ class WifiStaIface : public BnWifiStaIface { std::pair getNameInternal(); ndk::ScopedAStatus registerEventCallbackInternal( const std::shared_ptr& callback); - std::pair getCapabilitiesInternal(); + std::pair getFeatureSetInternal(); std::pair getApfPacketFilterCapabilitiesInternal(); ndk::ScopedAStatus installApfPacketFilterInternal(const std::vector& program); From 6fb8e8d4530676c3b1f30944339102575fc1d340 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Thu, 9 Mar 2023 20:27:21 +0000 Subject: [PATCH 810/998] Remove unused method removeAllQosPoliciesForScs from the Supplicant interface. Bug: 267819850 Test: m Change-Id: Id17738f1705c899f4f82cdaf3b923e30d3eed6a4 --- .../wifi/supplicant/ISupplicantStaIface.aidl | 1 - .../wifi/supplicant/ISupplicantStaIface.aidl | 16 ---------------- 2 files changed, 17 deletions(-) diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl index f617975498..1616b26003 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl @@ -98,6 +98,5 @@ interface ISupplicantStaIface { android.hardware.wifi.supplicant.SignalPollResult[] getSignalPollResults(); android.hardware.wifi.supplicant.QosPolicyScsRequestStatus[] addQosPolicyRequestForScs(in android.hardware.wifi.supplicant.QosPolicyScsData[] qosPolicyData); android.hardware.wifi.supplicant.QosPolicyScsRequestStatus[] removeQosPolicyForScs(in byte[] scsPolicyIds); - android.hardware.wifi.supplicant.QosPolicyScsRequestStatus[] removeAllQosPoliciesForScs(); const int MAX_POLICIES_PER_QOS_SCS_REQUEST = 16; } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl index e00604810a..06ab8fb218 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl @@ -850,20 +850,4 @@ interface ISupplicantStaIface { * being processed. Supplicant will only handle one request at a time. */ QosPolicyScsRequestStatus[] removeQosPolicyForScs(in byte[] scsPolicyIds); - - /** - * Request the removal of all QoS policies for SCS configured by the STA. - * - * @return QosPolicyScsRequestStatus[] synchronously corresponding to all - * the scs policies. - * @throws ServiceSpecificException with one of the following values: - * |SupplicantStatusCode.FAILURE_UNKNOWN| if there are no policies to remove. - * - * |SupplicantStatusCode.FAILURE_UNSUPPORTED| if the AP does not support - * the feature. - * - * |SupplicantStatusCode.FAILURE_ONGOING_REQUEST| if a request is currently - * being processed. Supplicant will only handle one request at a time. - */ - QosPolicyScsRequestStatus[] removeAllQosPoliciesForScs(); } From e76cbec9821f25b7db4c755b0fd06e005cc36421 Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Thu, 9 Mar 2023 14:20:10 -0800 Subject: [PATCH 811/998] Baseline NewApi issues NewApi was recently updated to support linting methods in the system, module_lib, and system_server sdks, and was demoted to a warning due to the new issues it finds. Baseline all the new issues that NewApi can be made an error again. These cls were generated automatically by a script that copied the NewApi issues from the reference baselines. Bug: 268261262 Test: m lint-check Change-Id: I22f3b3575b6ea00d72d143019d9eed028aa98b56 --- security/rkp/aidl/lint-baseline.xml | 37 +++++ wifi/hostapd/aidl/lint-baseline.xml | 48 ++++++ wifi/supplicant/aidl/lint-baseline.xml | 213 +++++++++++++++++++++++++ 3 files changed, 298 insertions(+) create mode 100644 security/rkp/aidl/lint-baseline.xml create mode 100644 wifi/hostapd/aidl/lint-baseline.xml create mode 100644 wifi/supplicant/aidl/lint-baseline.xml diff --git a/security/rkp/aidl/lint-baseline.xml b/security/rkp/aidl/lint-baseline.xml new file mode 100644 index 0000000000..d25d383dfd --- /dev/null +++ b/security/rkp/aidl/lint-baseline.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wifi/hostapd/aidl/lint-baseline.xml b/wifi/hostapd/aidl/lint-baseline.xml new file mode 100644 index 0000000000..657622e674 --- /dev/null +++ b/wifi/hostapd/aidl/lint-baseline.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wifi/supplicant/aidl/lint-baseline.xml b/wifi/supplicant/aidl/lint-baseline.xml new file mode 100644 index 0000000000..0631223f52 --- /dev/null +++ b/wifi/supplicant/aidl/lint-baseline.xml @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 8a140238a7a23bc223009eb8a50fc1980f3bf412 Mon Sep 17 00:00:00 2001 From: shrikar Date: Tue, 7 Mar 2023 16:57:59 +0000 Subject: [PATCH 812/998] Added info to HAL docs to answer Q1 from Ford pending questions. Bug: 259309511 Test: manual build Change-Id: I246b89202c03e9472bece7c60be0f7c2f19ffc08 --- .../automotive/vehicle/VehicleProperty.aidl | 2 ++ .../VtsHalAutomotiveVehicle_TargetTest.cpp | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index b628b602f1..25c1df4a5a 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -43,6 +43,8 @@ import android.hardware.automotive.vehicle.VehiclePropertyType; enum VehicleProperty { /** * Undefined property. + * + * This property must never be used/supported. */ INVALID = 0x00000000, /** diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index e06647da4e..8530631a66 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -296,6 +296,30 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, setNotWritableProp) { ASSERT_EQ(setValueResult.error().code(), ErrorCode::ACCESS_DENIED_FROM_VHAL); } +// Test get(), set() and getAllPropConfigs() on VehicleProperty::INVALID. +TEST_P(VtsHalAutomotiveVehicleTargetTest, getSetPropertyIdInvalid) { + ALOGD("VtsHalAutomotiveVehicleTargetTest::getSetPropertyIdInvalid"); + + int32_t propId = toInt(VehicleProperty::INVALID); + auto getValueResult = mVhalClient->getValueSync(*mVhalClient->createHalPropValue(propId)); + ASSERT_FALSE(getValueResult.ok()) << "Expect get on VehicleProperty::INVALID to fail"; + ASSERT_EQ(getValueResult.error().code(), ErrorCode::INVALID_ARG); + + auto propToSet = mVhalClient->createHalPropValue(propId); + propToSet->setInt32Values({0}); + auto setValueResult = mVhalClient->setValueSync(*propToSet); + ASSERT_FALSE(setValueResult.ok()) << "Expect set on VehicleProperty::INVALID to fail"; + ASSERT_EQ(setValueResult.error().code(), ErrorCode::INVALID_ARG); + + auto result = mVhalClient->getAllPropConfigs(); + ASSERT_TRUE(result.ok()); + for (const auto& cfgPtr : result.value()) { + const IHalPropConfig& cfg = *cfgPtr; + ASSERT_FALSE(cfg.getPropId() == propId) << "Expect VehicleProperty::INVALID to not be " + "included in propConfigs"; + } +} + // Test subscribe() and unsubscribe(). TEST_P(VtsHalAutomotiveVehicleTargetTest, subscribeAndUnsubscribe) { ALOGD("VtsHalAutomotiveVehicleTargetTest::subscribeAndUnsubscribe"); From 18e54639664816a68111224893e33f0f938d113e Mon Sep 17 00:00:00 2001 From: Hao Chen Date: Mon, 6 Mar 2023 14:57:05 -0800 Subject: [PATCH 813/998] Add VHAL Requests and Results Proto Messages Bug: 266001013 Test: Build Change-Id: I594f38cb96dc03c567b37babd1bdc01102b156ae --- .../vehicle/VehiclePropValueRequest.proto | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValueRequest.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValueRequest.proto index b16daa8bd3..749ad6adc8 100644 --- a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValueRequest.proto +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValueRequest.proto @@ -18,9 +18,33 @@ syntax = "proto3"; package android.hardware.automotive.vehicle.proto; +import "android/hardware/automotive/vehicle/StatusCode.proto"; import "android/hardware/automotive/vehicle/VehiclePropValue.proto"; message VehiclePropValueRequest { - int32 request_id = 1; + int64 request_id = 1; VehiclePropValue value = 2; }; + +message SetValueResult { + int64 request_id = 1; + StatusCode status = 2; +}; + +message GetValueResult { + int64 request_id = 1; + StatusCode status = 2; + VehiclePropValue value = 3; +}; + +message VehiclePropValueRequests { + repeated VehiclePropValueRequest requests = 1; +}; + +message SetValueResults { + repeated SetValueResult results = 1; +}; + +message GetValueResults { + repeated GetValueResult results = 1; +}; From d04352ee1e6802a345a606f800d1b3fbe6310a2b Mon Sep 17 00:00:00 2001 From: shrikar Date: Fri, 10 Mar 2023 21:56:53 +0000 Subject: [PATCH 814/998] Added info to HAL docs to answer Q7 from Ford pending questions. Bug: 259309511 Test: manual build Change-Id: I4f8f4a307bad6925ef4286ac17da8a0a3ae0ae6a --- .../android/hardware/automotive/vehicle/VehicleProperty.aidl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index b628b602f1..95aa63625f 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -296,7 +296,10 @@ enum VehicleProperty { * configArray is used to indicate the micrometers-per-wheel-tick value and * which wheels are supported. configArray is set as follows: * - * configArray[0], bits [0:3] = supported wheels. Uses enum Wheel. + * configArray[0], bits [0:3] = supported wheels. Uses enum Wheel. For example, if all wheels + * are supported, then configArray[0] = VehicleAreaWheel::LEFT_FRONT + * | VehicleAreaWheel::RIGHT_FRONT | VehicleAreaWheel::LEFT_REAR + * | VehicleAreaWheel::RIGHT_REAR * configArray[1] = micrometers per front left wheel tick * configArray[2] = micrometers per front right wheel tick * configArray[3] = micrometers per rear right wheel tick From d3868d26736b4c8615d4fd4f6b44188d8946b799 Mon Sep 17 00:00:00 2001 From: shrikar Date: Tue, 7 Mar 2023 18:49:55 +0000 Subject: [PATCH 815/998] Added info to HAL docs to answer Q2 from Ford pending questions. Bug: 259309511 Test: manual build Change-Id: I43b62459ac51ee34870929c2b9a4444b8b968adb --- .../hardware/automotive/vehicle/VehicleProperty.aidl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index b628b602f1..5335a17ed7 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -88,7 +88,17 @@ enum VehicleProperty { INFO_FUEL_CAPACITY = 0x0104 + 0x10000000 + 0x01000000 + 0x00600000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:FLOAT /** - * List of fuels the vehicle may use + * List of fuels the vehicle may use. + * + * FuelType::FUEL_TYPE_ELECTRIC must only be included if the vehicle is plug in rechargeable. + * For example: + * An FHEV (Fully Hybrid Electric Vehicle) must not include FuelType::FUEL_TYPE_ELECTRIC in + * INFO_FUEL_TYPE's INT32_VEC value. So INFO_FUEL_TYPE can be populated as such: + * int32Values = { FuelType::FUEL_TYPE_UNLEADED } + * On the other hand, a PHEV (Partially Hybrid Electric Vehicle) is plug in rechargeable, and + * hence should include FuelType::FUEL_TYPE_ELECTRIC in INFO_FUEL_TYPE's INT32_VEC value. So + * INFO_FUEL_TYPE can be populated as such: + * int32Values = { FuelType::FUEL_TYPE_UNLEADED, FuelType::FUEL_TYPE_ELECTRIC } * * @change_mode VehiclePropertyChangeMode.STATIC * @access VehiclePropertyAccess.READ From 1ce072d300f368234f6621269cf9de4e90866f6d Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Wed, 1 Mar 2023 16:36:46 -0800 Subject: [PATCH 816/998] Capitalize specific terms and add periods to end of first sentence in HAL docs The terms that are capitalized have associated acronyms. Bug: 264476063 Test: presubmit Change-Id: I595bdae60ec86516c95e31467b20062c8e33ebaa --- .../automotive/vehicle/VehicleProperty.aidl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 71ac7a1110..ac423287ca 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -3628,7 +3628,7 @@ enum VehicleProperty { **********************************************************************************************/ /** - * Enable or disable automatic emergency braking (AEB). + * Enable or disable Automatic Emergency Braking (AEB). * * Set true to enable AEB and false to disable AEB. When AEB is enabled, the ADAS system in the * vehicle should be turned on and monitoring to avoid potential collisions. @@ -3670,7 +3670,7 @@ enum VehicleProperty { 0x1001 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, /** - * Enable or disable forward collision warning (FCW). + * Enable or disable Forward Collision Warning (FCW). * * Set true to enable FCW and false to disable FCW. When FCW is enabled, the ADAS system in the * vehicle should be turned on and monitoring for potential collisions. @@ -3709,7 +3709,7 @@ enum VehicleProperty { 0x1003 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, /** - * Enable and disable blind spot warning (BSW). + * Enable and disable Blind Spot Warning (BSW). * * Set true to enable BSW and false to disable BSW. When BSW is enabled, the ADAS system in the * vehicle should be turned on and monitoring for objects in the vehicle’s blind spots. @@ -3748,7 +3748,7 @@ enum VehicleProperty { 0x1005 + VehiclePropertyGroup.SYSTEM + VehicleArea.MIRROR + VehiclePropertyType.INT32, /** - * Enable or disable lane departure warning (LDW). + * Enable or disable Lane Departure Warning (LDW). * * Set true to enable LDW and false to disable LDW. When LDW is enabled, the ADAS system in the * vehicle should be turned on and monitoring if the vehicle is approaching or crossing lane @@ -3835,7 +3835,7 @@ enum VehicleProperty { 0x1009 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, /** - * Enable or disable lane centering assist (LCA). + * Enable or disable Lane Centering Assist (LCA). * * Set true to enable LCA and false to disable LCA. When LCA is enabled, the ADAS system in the * vehicle should be turned on and waiting for an activation signal from the driver. Once the @@ -3907,7 +3907,7 @@ enum VehicleProperty { 0x100C + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, /* - * Enable or disable emergency lane keep assist (ELKA). + * Enable or disable Emergency Lane Keep Assist (ELKA). * * Set true to enable ELKA and false to disable ELKA. When ELKA is enabled, the ADAS system in * the vehicle should be on and monitoring for unsafe lane changes by the driver. When an unsafe @@ -4095,7 +4095,7 @@ enum VehicleProperty { 0x1015 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, /** - * Enable or disable hands on detection (HOD). + * Enable or disable Hands On Detection (HOD). * * Set true to enable HOD and false to disable HOD. When HOD is enabled, a system inside the * vehicle should be monitoring the presence of the driver's hands on the steering wheel and @@ -4115,7 +4115,7 @@ enum VehicleProperty { 0x1016 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, /** - * Hands on detection (HOD) driver state. + * Hands On Detection (HOD) driver state. * * Returns whether the driver's hands are on the steering wheel. Generally, this property should * return a valid state defined in the HandsOnDetectionDriverState or ErrorState. For example, @@ -4139,7 +4139,7 @@ enum VehicleProperty { 0x1017 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, /** - * Hands on detection (HOD) warning. + * Hands On Detection (HOD) warning. * * Returns whether a warning is being sent to the driver for having their hands off the wheel * for too long a duration. From 20dbc58c252a0182726972f65eba2587de5b3f8d Mon Sep 17 00:00:00 2001 From: Changyeon Jo Date: Thu, 23 Feb 2023 18:20:15 +0000 Subject: [PATCH 817/998] Add default implementation of AIDL EVS interface This implementation is used for the emulators. Bug: 218588089 Bug: 270753093 Test: 1. Build cf_x86_64_auto lunch target 2. Launch cvd in the accelerated graphics mode 3. Run evs_app and confirm the color bar pattern is shown on the display. > adb root && adb shell evs_app --test Change-Id: I8179e74fc9f0b9547316368fca507e5c62ca5680 --- automotive/evs/aidl/impl/default/Android.bp | 53 +- .../aidl/impl/default/evs-default-service.rc | 7 +- .../aidl/impl/default/evs-default-service.xml | 11 - .../aidl/impl/default/include/ConfigManager.h | 384 +++++++ .../impl/default/include/ConfigManagerUtil.h | 62 ++ .../default/include/DefaultEvsEnumerator.h | 66 -- .../aidl/impl/default/include/EvsEnumerator.h | 134 +++ .../aidl/impl/default/include/EvsGlDisplay.h | 89 ++ .../aidl/impl/default/include/EvsMockCamera.h | 152 +++ .../evs/aidl/impl/default/include/GlWrapper.h | 79 ++ .../default/manifest_evs-default-service.xml | 6 + .../resources/evs_mock_configuration.xml | 68 ++ .../aidl/impl/default/src/ConfigManager.cpp | 992 ++++++++++++++++++ .../impl/default/src/ConfigManagerUtil.cpp | 155 +++ .../impl/default/src/DefaultEvsEnumerator.cpp | 93 -- .../aidl/impl/default/src/EvsEnumerator.cpp | 552 ++++++++++ .../aidl/impl/default/src/EvsGlDisplay.cpp | 417 ++++++++ .../aidl/impl/default/src/EvsMockCamera.cpp | 642 ++++++++++++ .../evs/aidl/impl/default/src/GlWrapper.cpp | 465 ++++++++ .../evs/aidl/impl/default/src/service.cpp | 77 +- 20 files changed, 4307 insertions(+), 197 deletions(-) delete mode 100644 automotive/evs/aidl/impl/default/evs-default-service.xml create mode 100644 automotive/evs/aidl/impl/default/include/ConfigManager.h create mode 100644 automotive/evs/aidl/impl/default/include/ConfigManagerUtil.h delete mode 100644 automotive/evs/aidl/impl/default/include/DefaultEvsEnumerator.h create mode 100644 automotive/evs/aidl/impl/default/include/EvsEnumerator.h create mode 100644 automotive/evs/aidl/impl/default/include/EvsGlDisplay.h create mode 100644 automotive/evs/aidl/impl/default/include/EvsMockCamera.h create mode 100644 automotive/evs/aidl/impl/default/include/GlWrapper.h create mode 100644 automotive/evs/aidl/impl/default/manifest_evs-default-service.xml create mode 100644 automotive/evs/aidl/impl/default/resources/evs_mock_configuration.xml create mode 100644 automotive/evs/aidl/impl/default/src/ConfigManager.cpp create mode 100644 automotive/evs/aidl/impl/default/src/ConfigManagerUtil.cpp delete mode 100644 automotive/evs/aidl/impl/default/src/DefaultEvsEnumerator.cpp create mode 100644 automotive/evs/aidl/impl/default/src/EvsEnumerator.cpp create mode 100644 automotive/evs/aidl/impl/default/src/EvsGlDisplay.cpp create mode 100644 automotive/evs/aidl/impl/default/src/EvsMockCamera.cpp create mode 100644 automotive/evs/aidl/impl/default/src/GlWrapper.cpp diff --git a/automotive/evs/aidl/impl/default/Android.bp b/automotive/evs/aidl/impl/default/Android.bp index dbe0314118..bf6c0be236 100644 --- a/automotive/evs/aidl/impl/default/Android.bp +++ b/automotive/evs/aidl/impl/default/Android.bp @@ -24,13 +24,56 @@ package { cc_binary { name: "android.hardware.automotive.evs-aidl-default-service", defaults: ["EvsHalDefaults"], - local_include_dirs: ["include"], - vintf_fragments: ["evs-default-service.xml"], + vintf_fragments: ["manifest_evs-default-service.xml"], init_rc: ["evs-default-service.rc"], vendor: true, relative_install_path: "hw", - srcs: ["src/*.cpp"], - shared_libs: [ - "libbinder_ndk", + cflags: [ + "-DGL_GLEXT_PROTOTYPES", + "-DEGL_EGLEXT_PROTOTYPES", + "-Wall", + "-Wextra", + "-Werror", + "-Wthread-safety", ], + srcs: [ + ":libgui_frame_event_aidl", + "src/*.cpp" + ], + shared_libs: [ + "android.hardware.graphics.bufferqueue@1.0", + "android.hardware.graphics.bufferqueue@2.0", + "android.hidl.token@1.0-utils", + "libEGL", + "libGLESv2", + "libbase", + "libbinder_ndk", + "libbufferqueueconverter", + "libcamera_metadata", + "libhardware_legacy", + "libhidlbase", + "liblog", + "libnativewindow", + "libtinyxml2", + "libui", + "libutils", + "libyuv", + ], + static_libs: [ + "android.frameworks.automotive.display-V1-ndk", + "android.hardware.automotive.evs-V1-ndk", + "android.hardware.common-V2-ndk", + "libaidlcommonsupport", + "libcutils", + ], + local_include_dirs: ["include"], + include_dirs: ["frameworks/native/include/"], + required: ["evs_mock_hal_configuration.xml"], +} + +prebuilt_etc { + name: "evs_mock_hal_configuration.xml", + soc_specific: true, + src: "resources/evs_mock_configuration.xml", + sub_dir: "automotive/evs", } diff --git a/automotive/evs/aidl/impl/default/evs-default-service.rc b/automotive/evs/aidl/impl/default/evs-default-service.rc index ea8e6892dc..3da41ff787 100644 --- a/automotive/evs/aidl/impl/default/evs-default-service.rc +++ b/automotive/evs/aidl/impl/default/evs-default-service.rc @@ -1,5 +1,8 @@ service vendor.evs-hal-default /vendor/bin/hw/android.hardware.automotive.evs-aidl-default-service class early_hal - user automotive_evs - group automotive_evs + priority -20 + user graphics + group automotive_evs camera + onrestart restart cardisplayproxyd + onrestart restart evsmanagerd disabled diff --git a/automotive/evs/aidl/impl/default/evs-default-service.xml b/automotive/evs/aidl/impl/default/evs-default-service.xml deleted file mode 100644 index 96ff9f6576..0000000000 --- a/automotive/evs/aidl/impl/default/evs-default-service.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - android.hardware.automotive.evs - hwbinder - 1 - - IEvsEnumerator - hw/0 - - - diff --git a/automotive/evs/aidl/impl/default/include/ConfigManager.h b/automotive/evs/aidl/impl/default/include/ConfigManager.h new file mode 100644 index 0000000000..1d5fe772b2 --- /dev/null +++ b/automotive/evs/aidl/impl/default/include/ConfigManager.h @@ -0,0 +1,384 @@ +/* + * 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. + */ + +#pragma once + +#include "ConfigManagerUtil.h" + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +/* + * Please note that this is different from what is defined in + * libhardware/modules/camera/3_4/metadata/types.h; this has one additional + * field to store a framerate. + */ +typedef struct { + int id; + int width; + int height; + ::aidl::android::hardware::graphics::common::PixelFormat format; + int type; + int framerate; +} StreamConfiguration; + +class ConfigManager final { + public: + static std::unique_ptr Create(); + ConfigManager(const ConfigManager&) = delete; + ConfigManager& operator=(const ConfigManager&) = delete; + + /* Camera device's capabilities and metadata */ + class CameraInfo { + public: + CameraInfo() : characteristics(nullptr) {} + + virtual ~CameraInfo(); + + /* Allocate memory for camera_metadata_t */ + bool allocate(size_t entry_cap, size_t data_cap) { + if (characteristics != nullptr) { + LOG(ERROR) << "Camera metadata is already allocated"; + return false; + } + + characteristics = allocate_camera_metadata(entry_cap, data_cap); + return characteristics != nullptr; + } + + /* + * List of supported controls that the primary client can program. + * Paraemters are stored with its valid range + */ + std::unordered_map<::aidl::android::hardware::automotive::evs::CameraParam, + std::tuple> + controls; + + /* + * List of supported output stream configurations. + */ + std::unordered_map streamConfigurations; + + /* + * Internal storage for camera metadata. Each entry holds a pointer to + * data and number of elements + */ + std::unordered_map> cameraMetadata; + + /* Camera module characteristics */ + camera_metadata_t* characteristics; + }; + + class CameraGroupInfo : public CameraInfo { + public: + CameraGroupInfo() {} + + /* ID of member camera devices */ + std::unordered_set devices; + + /* The capture operation of member camera devices are synchronized */ + int32_t synchronized = 0; + }; + + class SystemInfo { + public: + /* number of available cameras */ + int32_t numCameras = 0; + }; + + class DisplayInfo { + public: + /* + * List of supported input stream configurations. + */ + std::unordered_map streamConfigurations; + }; + + /* + * Return system information + * + * @return SystemInfo + * Constant reference of SystemInfo. + */ + const SystemInfo& getSystemInfo() { + std::unique_lock lock(mConfigLock); + mConfigCond.wait(lock, [this] { return mIsReady; }); + return mSystemInfo; + } + + /* + * Return a list of camera identifiers + * + * This function assumes that it is not being called frequently. + * + * @return std::vector + * A vector that contains unique camera device identifiers. + */ + std::vector getCameraIdList() { + std::unique_lock lock(mConfigLock); + mConfigCond.wait(lock, [this] { return mIsReady; }); + + std::vector aList; + aList.reserve(mCameraInfo.size()); + for (auto&& v : mCameraInfo) { + aList.push_back(v.first); + } + + return aList; + } + + /* + * Return a list of camera group identifiers + * + * This function assumes that it is not being called frequently. + * + * @return std::vector + * A vector that contains unique camera device identifiers. + */ + std::vector getCameraGroupIdList() { + std::unique_lock lock(mConfigLock); + mConfigCond.wait(lock, [this] { return mIsReady; }); + + std::vector aList; + aList.reserve(mCameraGroups.size()); + for (auto&& v : mCameraGroups) { + aList.push_back(v.first); + } + + return aList; + } + + /* + * Return a pointer to the camera group + * + * @return CameraGroup + * A pointer to a camera group identified by a given id. + */ + std::unique_ptr& getCameraGroupInfo(const std::string& gid) { + std::unique_lock lock(mConfigLock); + mConfigCond.wait(lock, [this] { return mIsReady; }); + + return mCameraGroups[gid]; + } + + /* + * Return a camera metadata + * + * @param cameraId + * Unique camera node identifier in string + * + * @return unique_ptr + * A pointer to CameraInfo that is associated with a given camera + * ID. This returns a null pointer if this does not recognize a + * given camera identifier. + */ + std::unique_ptr& getCameraInfo(const std::string& cameraId) noexcept { + std::unique_lock lock(mConfigLock); + mConfigCond.wait(lock, [this] { return mIsReady; }); + + return mCameraInfo[cameraId]; + } + + /* + * Tell whether the configuration data is ready to be used + * + * @return bool + * True if configuration data is ready to be consumed. + */ + bool isReady() const { return mIsReady; } + + private: + /* Constructors */ + ConfigManager() : mBinaryFilePath("") {} + + static std::string_view sConfigDefaultPath; + static std::string_view sConfigOverridePath; + + /* System configuration */ + SystemInfo mSystemInfo; + + /* Internal data structure for camera device information */ + std::unordered_map> mCameraInfo; + + /* Internal data structure for camera device information */ + std::unordered_map> mDisplayInfo; + + /* Camera groups are stored in hash map */ + std::unordered_map> mCameraGroups; + + /* + * Camera positions are stored in hash map. + * The position must be one of front, rear, left, and right. + */ + std::unordered_map> mCameraPosition; + + /* Configuration data lock */ + mutable std::mutex mConfigLock; + + /* + * This condition is signalled when it completes a configuration data + * preparation. + */ + std::condition_variable mConfigCond; + + /* A path to a binary configuration file */ + const char* mBinaryFilePath; + + /* Configuration data readiness */ + bool mIsReady = false; + + /* + * Parse a given EVS configuration file and store the information + * internally. + * + * @return bool + * True if it completes parsing a file successfully. + */ + bool readConfigDataFromXML() noexcept; + + /* + * read the information of the vehicle + * + * @param aSysElem + * A pointer to "system" XML element. + */ + void readSystemInfo(const tinyxml2::XMLElement* const aSysElem); + + /* + * read the information of camera devices + * + * @param aCameraElem + * A pointer to "camera" XML element that may contain multiple + * "device" elements. + */ + void readCameraInfo(const tinyxml2::XMLElement* const aCameraElem); + + /* + * read display device information + * + * @param aDisplayElem + * A pointer to "display" XML element that may contain multiple + * "device" elements. + */ + void readDisplayInfo(const tinyxml2::XMLElement* const aDisplayElem); + + /* + * read camera device information + * + * @param aCamera + * A pointer to CameraInfo that will be completed by this + * method. + * aDeviceElem + * A pointer to "device" XML element that contains camera module + * capability info and its characteristics. + * + * @return bool + * Return false upon any failure in reading and processing camera + * device information. + */ + bool readCameraDeviceInfo(CameraInfo* aCamera, const tinyxml2::XMLElement* aDeviceElem); + + /* + * read camera metadata + * + * @param aCapElem + * A pointer to "cap" XML element. + * @param aCamera + * A pointer to CameraInfo that is being filled by this method. + * @param dataSize + * Required size of memory to store camera metadata found in this + * method. This is calculated in this method and returned to the + * caller for camera_metadata allocation. + * + * @return size_t + * Number of camera metadata entries + */ + size_t readCameraCapabilities(const tinyxml2::XMLElement* const aCapElem, CameraInfo* aCamera, + size_t& dataSize); + + /* + * read camera metadata + * + * @param aParamElem + * A pointer to "characteristics" XML element. + * @param aCamera + * A pointer to CameraInfo that is being filled by this method. + * @param dataSize + * Required size of memory to store camera metadata found in this + * method. + * + * @return size_t + * Number of camera metadata entries + */ + size_t readCameraMetadata(const tinyxml2::XMLElement* const aParamElem, CameraInfo* aCamera, + size_t& dataSize); + + /* + * construct camera_metadata_t from camera capabilities and metadata + * + * @param aCamera + * A pointer to CameraInfo that is being filled by this method. + * @param totalEntries + * Number of camera metadata entries to be added. + * @param totalDataSize + * Sum of sizes of camera metadata entries to be added. + * + * @return bool + * False if either it fails to allocate memory for camera metadata + * or its size is not large enough to add all found camera metadata + * entries. + */ + bool constructCameraMetadata(CameraInfo* aCamera, const size_t totalEntries, + const size_t totalDataSize); + + /* + * Read configuration data from the binary file + * + * @return bool + * True if it succeeds to read configuration data from a binary + * file. + */ + bool readConfigDataFromBinary(); + + /* + * Store configuration data to the file + * + * @return bool + * True if it succeeds to serialize mCameraInfo to the file. + */ + bool writeConfigDataToBinary(); + + /* + * debugging method to print out all XML elements and their attributes in + * logcat message. + * + * @param aNode + * A pointer to the root XML element to navigate. + * @param prefix + * A prefix to XML string. + */ + void printElementNames(const tinyxml2::XMLElement* aNode, const std::string& prefix = "") const; +}; diff --git a/automotive/evs/aidl/impl/default/include/ConfigManagerUtil.h b/automotive/evs/aidl/impl/default/include/ConfigManagerUtil.h new file mode 100644 index 0000000000..32b50d3332 --- /dev/null +++ b/automotive/evs/aidl/impl/default/include/ConfigManagerUtil.h @@ -0,0 +1,62 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include + +#include +#include + +class ConfigManagerUtil final { + public: + /** + * Convert a given string into V4L2_CID_* + */ + static bool convertToEvsCameraParam( + const std::string& id, + ::aidl::android::hardware::automotive::evs::CameraParam& camParam); + /** + * Convert a given string into android.hardware.graphics.common.PixelFormat + */ + static bool convertToPixelFormat(const std::string& in, + ::aidl::android::hardware::graphics::common::PixelFormat& out); + /** + * Convert a given string into corresponding camera metadata data tag defined in + * system/media/camera/include/system/camera_metadata_tags.h + */ + static bool convertToMetadataTag(const char* name, camera_metadata_tag& aTag); + /** + * Convert a given string into a floating value array + */ + static float* convertFloatArray(const char* sz, const char* vals, size_t& count, + const char delimiter = ','); + /** + * Trim a string + */ + static std::string trimString(const std::string& src, const std::string& ws = " \n\r\t\f\v"); + + /** + * Convert a given string to corresponding camera capabilities + */ + static bool convertToCameraCapability( + const char* name, camera_metadata_enum_android_request_available_capabilities_t& cap); + + DISALLOW_IMPLICIT_CONSTRUCTORS(ConfigManagerUtil); +}; diff --git a/automotive/evs/aidl/impl/default/include/DefaultEvsEnumerator.h b/automotive/evs/aidl/impl/default/include/DefaultEvsEnumerator.h deleted file mode 100644 index 03a578d954..0000000000 --- a/automotive/evs/aidl/impl/default/include/DefaultEvsEnumerator.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ - -#ifndef android_hardware_automotive_evs_aidl_impl_evshal_include_DefaultEvsHal_H_ -#define android_hardware_automotive_evs_aidl_impl_evshal_include_DefaultEvsHal_H_ - -#include - -namespace aidl::android::hardware::automotive::evs::implementation { - -class DefaultEvsEnumerator final - : public ::aidl::android::hardware::automotive::evs::BnEvsEnumerator { - ::ndk::ScopedAStatus isHardware(bool* flag) override; - ::ndk::ScopedAStatus openCamera( - const std::string& cameraId, - const ::aidl::android::hardware::automotive::evs::Stream& streamConfig, - std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsCamera>* obj) override; - ::ndk::ScopedAStatus closeCamera( - const std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsCamera>& obj) - override; - ::ndk::ScopedAStatus getCameraList( - std::vector<::aidl::android::hardware::automotive::evs::CameraDesc>* list) override; - ::ndk::ScopedAStatus getStreamList( - const ::aidl::android::hardware::automotive::evs::CameraDesc& desc, - std::vector<::aidl::android::hardware::automotive::evs::Stream>* _aidl_return) override; - ::ndk::ScopedAStatus openDisplay( - int32_t displayId, - std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsDisplay>* obj) override; - ::ndk::ScopedAStatus closeDisplay( - const std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsDisplay>& obj) - override; - ::ndk::ScopedAStatus getDisplayIdList(std::vector* list) override; - ::ndk::ScopedAStatus getDisplayState( - ::aidl::android::hardware::automotive::evs::DisplayState* state) override; - ::ndk::ScopedAStatus registerStatusCallback( - const std::shared_ptr< - ::aidl::android::hardware::automotive::evs::IEvsEnumeratorStatusCallback>& - callback) override; - ::ndk::ScopedAStatus openUltrasonicsArray( - const std::string& id, - std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsUltrasonicsArray>* obj) - override; - ::ndk::ScopedAStatus closeUltrasonicsArray( - const std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsUltrasonicsArray>& - arr) override; - ::ndk::ScopedAStatus getUltrasonicsArrayList( - std::vector<::aidl::android::hardware::automotive::evs::UltrasonicsArrayDesc>* list) - override; -}; - -} // namespace aidl::android::hardware::automotive::evs::implementation - -#endif // android_hardware_automotive_evs_aidl_impl_evshal_include_DefaultEvsHal_H_ diff --git a/automotive/evs/aidl/impl/default/include/EvsEnumerator.h b/automotive/evs/aidl/impl/default/include/EvsEnumerator.h new file mode 100644 index 0000000000..b11dd3ee80 --- /dev/null +++ b/automotive/evs/aidl/impl/default/include/EvsEnumerator.h @@ -0,0 +1,134 @@ +/* + * 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. + */ + +#pragma once + +#include "ConfigManager.h" +#include "EvsGlDisplay.h" +#include "EvsMockCamera.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace aidl::android::hardware::automotive::evs::implementation { + +class EvsEnumerator final : public ::aidl::android::hardware::automotive::evs::BnEvsEnumerator { + public: + // Methods from ::aidl::android::hardware::automotive::evs::IEvsEnumerator + ndk::ScopedAStatus isHardware(bool* flag) override; + ndk::ScopedAStatus openCamera(const std::string& cameraId, const evs::Stream& streamConfig, + std::shared_ptr* obj) override; + ndk::ScopedAStatus closeCamera(const std::shared_ptr& obj) override; + ndk::ScopedAStatus getCameraList(std::vector* _aidl_return) override; + ndk::ScopedAStatus getStreamList(const evs::CameraDesc& desc, + std::vector* _aidl_return) override; + ndk::ScopedAStatus openDisplay(int32_t displayId, + std::shared_ptr* obj) override; + ndk::ScopedAStatus closeDisplay(const std::shared_ptr& obj) override; + ndk::ScopedAStatus getDisplayIdList(std::vector* list) override; + ndk::ScopedAStatus getDisplayState(evs::DisplayState* state) override; + ndk::ScopedAStatus registerStatusCallback( + const std::shared_ptr& callback) override; + ndk::ScopedAStatus openUltrasonicsArray( + const std::string& id, std::shared_ptr* obj) override; + ndk::ScopedAStatus closeUltrasonicsArray( + const std::shared_ptr& obj) override; + ndk::ScopedAStatus getUltrasonicsArrayList( + std::vector* list) override; + + // Implementation details + EvsEnumerator(const std::shared_ptr< + ::aidl::android::frameworks::automotive::display::ICarDisplayProxy>& + proxyService); + + void notifyDeviceStatusChange(const std::string_view& deviceName, evs::DeviceStatusType type); + + private: + struct CameraRecord { + evs::CameraDesc desc; + std::weak_ptr activeInstance; + + CameraRecord(const char* cameraId) : desc() { desc.id = cameraId; } + }; + + class ActiveDisplays { + public: + struct DisplayInfo { + int32_t id{-1}; + std::weak_ptr displayWeak; + uintptr_t internalDisplayRawAddr; + }; + + std::optional popDisplay(int32_t id); + + std::optional popDisplay(const std::shared_ptr& display); + + std::unordered_map getAllDisplays(); + + bool tryInsert(int32_t id, const std::shared_ptr& display); + + private: + std::mutex mMutex; + std::unordered_map mIdToDisplay GUARDED_BY(mMutex); + std::unordered_map mDisplayToId GUARDED_BY(mMutex); + }; + + bool checkPermission(); + void closeCamera_impl(const std::shared_ptr& pCamera, + const std::string& cameraId); + + static bool qualifyCaptureDevice(const char* deviceName); + static CameraRecord* findCameraById(const std::string& cameraId); + static void enumerateCameras(); + static bool addCaptureDevice(const std::string& deviceName); + static bool removeCaptureDevice(const std::string& deviceName); + // Enumerate available displays and return an id of the internal display + static uint64_t enumerateDisplays(); + + static ActiveDisplays& mutableActiveDisplays(); + + // NOTE: All members values are static so that all clients operate on the same state + // That is to say, this is effectively a singleton despite the fact that HIDL + // constructs a new instance for each client. + // Because our server has a single thread in the thread pool, these values are + // never accessed concurrently despite potentially having multiple instance objects + // using them. + static std::unordered_map sCameraList; + // Object destructs if client dies. + static std::mutex sLock; // Mutex on shared camera device list. + static std::condition_variable sCameraSignal; // Signal on camera device addition. + static std::unique_ptr sConfigManager; // ConfigManager + static std::shared_ptr<::aidl::android::frameworks::automotive::display::ICarDisplayProxy> + sDisplayProxy; + static std::unordered_map sDisplayPortList; + + uint64_t mInternalDisplayId; + std::shared_ptr mCallback; +}; + +} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/include/EvsGlDisplay.h b/automotive/evs/aidl/impl/default/include/EvsGlDisplay.h new file mode 100644 index 0000000000..ceabd9e863 --- /dev/null +++ b/automotive/evs/aidl/impl/default/include/EvsGlDisplay.h @@ -0,0 +1,89 @@ +/* + * 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. + */ + +#pragma once + +#include "GlWrapper.h" + +#include +#include +#include +#include +#include + +#include + +namespace aidl::android::hardware::automotive::evs::implementation { + +class EvsGlDisplay final : public BnEvsDisplay { + public: + // Methods from ::aidl::android::hardware::automotive::evs::IEvsDisplay + // follow. + ndk::ScopedAStatus getDisplayInfo(evs::DisplayDesc* _aidl_return) override; + ndk::ScopedAStatus getDisplayState(evs::DisplayState* _aidl_return) override; + ndk::ScopedAStatus getTargetBuffer(evs::BufferDesc* _aidl_return) override; + ndk::ScopedAStatus returnTargetBufferForDisplay(const evs::BufferDesc& buffer) override; + ndk::ScopedAStatus setDisplayState(evs::DisplayState state) override; + + // Implementation details + EvsGlDisplay(const std::shared_ptr& service, + uint64_t displayId); + virtual ~EvsGlDisplay() override; + + // This gets called if another caller "steals" ownership of the display + void forceShutdown(); + + private: + // A graphics buffer into which we'll store images. This member variable + // will be protected by semaphores. + struct BufferRecord { + ::aidl::android::hardware::graphics::common::HardwareBufferDescription description; + buffer_handle_t handle; + int fingerprint; + } mBuffer; + + // State of a rendering thread + enum RenderThreadStates { + STOPPED = 0, + STOPPING = 1, + RUN = 2, + }; + + uint64_t mDisplayId; + evs::DisplayDesc mInfo; + evs::DisplayState mRequestedState GUARDED_BY(mLock) = evs::DisplayState::NOT_VISIBLE; + std::shared_ptr mDisplayProxy; + + GlWrapper mGlWrapper; + mutable std::mutex mLock; + + // This tells us whether or not our buffer is in use. Protected by + // semaphores. + bool mBufferBusy = false; + + // Variables to synchronize a rendering thread w/ main and binder threads + std::thread mRenderThread; + RenderThreadStates mState GUARDED_BY(mLock) = STOPPED; + bool mBufferReady = false; + void renderFrames(); + bool initializeGlContextLocked() REQUIRES(mLock); + + std::condition_variable mBufferReadyToUse; + std::condition_variable mBufferReadyToRender; + std::condition_variable mBufferDone; +}; + +} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/include/EvsMockCamera.h b/automotive/evs/aidl/impl/default/include/EvsMockCamera.h new file mode 100644 index 0000000000..46d47e77a2 --- /dev/null +++ b/automotive/evs/aidl/impl/default/include/EvsMockCamera.h @@ -0,0 +1,152 @@ +/* + * 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. + */ + +#pragma once + +#include "ConfigManager.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include +#include +#include + +#include +#include + +namespace aidl::android::hardware::automotive::evs::implementation { + +class EvsMockCamera : public evs::BnEvsCamera { + // This prevents constructors from direct access while it allows this class to + // be instantiated via ndk::SharedRefBase::make<>. + private: + struct Sigil { + explicit Sigil() = default; + }; + + public: + // Methods from ::android::hardware::automotive::evs::IEvsCamera follow. + ndk::ScopedAStatus doneWithFrame(const std::vector& buffers) override; + ndk::ScopedAStatus forcePrimaryClient( + const std::shared_ptr& display) override; + ndk::ScopedAStatus getCameraInfo(evs::CameraDesc* _aidl_return) override; + ndk::ScopedAStatus getExtendedInfo(int32_t opaqueIdentifier, + std::vector* value) override; + ndk::ScopedAStatus getIntParameter(evs::CameraParam id, std::vector* value) override; + ndk::ScopedAStatus getIntParameterRange(evs::CameraParam id, + evs::ParameterRange* _aidl_return) override; + ndk::ScopedAStatus getParameterList(std::vector* _aidl_return) override; + ndk::ScopedAStatus getPhysicalCameraInfo(const std::string& deviceId, + evs::CameraDesc* _aidl_return) override; + ndk::ScopedAStatus importExternalBuffers(const std::vector& buffers, + int32_t* _aidl_return) override; + ndk::ScopedAStatus pauseVideoStream() override; + ndk::ScopedAStatus resumeVideoStream() override; + ndk::ScopedAStatus setExtendedInfo(int32_t opaqueIdentifier, + const std::vector& opaqueValue) override; + ndk::ScopedAStatus setIntParameter(evs::CameraParam id, int32_t value, + std::vector* effectiveValue) override; + ndk::ScopedAStatus setPrimaryClient() override; + ndk::ScopedAStatus setMaxFramesInFlight(int32_t bufferCount) override; + ndk::ScopedAStatus startVideoStream( + const std::shared_ptr& receiver) override; + ndk::ScopedAStatus stopVideoStream() override; + ndk::ScopedAStatus unsetPrimaryClient() override; + + static std::shared_ptr Create(const char* deviceName); + static std::shared_ptr Create( + const char* deviceName, std::unique_ptr& camInfo, + const evs::Stream* streamCfg = nullptr); + EvsMockCamera(const EvsMockCamera&) = delete; + EvsMockCamera& operator=(const EvsMockCamera&) = delete; + + virtual ~EvsMockCamera() override; + void shutdown(); + + const evs::CameraDesc& getDesc() { return mDescription; } + + // Constructors + EvsMockCamera(Sigil sigil, const char* deviceName, + std::unique_ptr& camInfo); + + private: + // These three functions are expected to be called while mAccessLock is held + bool setAvailableFrames_Locked(unsigned bufferCount); + unsigned increaseAvailableFrames_Locked(unsigned numToAdd); + unsigned decreaseAvailableFrames_Locked(unsigned numToRemove); + + void generateFrames(); + void fillMockFrame(buffer_handle_t handle, const AHardwareBuffer_Desc* pDesc); + void returnBufferLocked(const uint32_t bufferId); + ndk::ScopedAStatus stopVideoStream_impl(); + + CameraDesc mDescription = {}; // The properties of this camera + + std::thread mCaptureThread; // The thread we'll use to synthesize frames + + // The callback used to deliver each frame + std::shared_ptr mStream; + + // Horizontal pixel count in the buffers + uint32_t mWidth = 0; + // Vertical pixel count in the buffers + uint32_t mHeight = 0; + // Values from android_pixel_format_t + uint32_t mFormat = HAL_PIXEL_FORMAT_RGBA_8888; + // Values from from Gralloc.h + uint64_t mUsage = + GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_OFTEN; + // Bytes per line in the buffers + uint32_t mStride = 0; + + struct BufferRecord { + buffer_handle_t handle; + bool inUse; + + explicit BufferRecord(buffer_handle_t h) : handle(h), inUse(false){}; + }; + + std::vector mBuffers; // Graphics buffers to transfer images + unsigned mFramesAllowed; // How many buffers are we currently using + unsigned mFramesInUse; // How many buffers are currently outstanding + + enum StreamStateValues { + STOPPED, + RUNNING, + STOPPING, + DEAD, + }; + StreamStateValues mStreamState; + + // Synchronization necessary to deconflict mCaptureThread from the main service thread + std::mutex mAccessLock; + + // Static camera module information + std::unique_ptr& mCameraInfo; + + // For the extended info + std::unordered_map> mExtInfo; + std::unordered_map mParams; +}; + +} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/include/GlWrapper.h b/automotive/evs/aidl/impl/default/include/GlWrapper.h new file mode 100644 index 0000000000..adb250c8e1 --- /dev/null +++ b/automotive/evs/aidl/impl/default/include/GlWrapper.h @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace aidl::android::hardware::automotive::evs::implementation { + +namespace automotivedisplay = ::aidl::android::frameworks::automotive::display; + +class GlWrapper { + public: + GlWrapper() : mSurfaceHolder(::android::SurfaceHolderUniquePtr(nullptr, nullptr)) {} + bool initialize(const std::shared_ptr& svc, + uint64_t displayId); + void shutdown(); + + bool updateImageTexture( + buffer_handle_t handle, + const ::aidl::android::hardware::graphics::common::HardwareBufferDescription& + description); + void renderImageToScreen(); + + void showWindow(const std::shared_ptr& svc, + uint64_t displayId); + void hideWindow(const std::shared_ptr& svc, + uint64_t displayId); + + unsigned getWidth() { return mWidth; }; + unsigned getHeight() { return mHeight; }; + + private: + ::android::sp<::android::hardware::graphics::bufferqueue::V2_0::IGraphicBufferProducer> + mGfxBufferProducer; + + EGLDisplay mDisplay; + EGLSurface mSurface; + EGLContext mContext; + + unsigned mWidth = 0; + unsigned mHeight = 0; + + EGLImageKHR mKHRimage = EGL_NO_IMAGE_KHR; + + GLuint mTextureMap = 0; + GLuint mShaderProgram = 0; + + // Opaque handle for a native hardware buffer defined in + // frameworks/native/opengl/include/EGL/eglplatform.h + ANativeWindow* mWindow; + + // Pointer to a Surface wrapper. + ::android::SurfaceHolderUniquePtr mSurfaceHolder; +}; + +} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/manifest_evs-default-service.xml b/automotive/evs/aidl/impl/default/manifest_evs-default-service.xml new file mode 100644 index 0000000000..8480651e77 --- /dev/null +++ b/automotive/evs/aidl/impl/default/manifest_evs-default-service.xml @@ -0,0 +1,6 @@ + + + android.hardware.automotive.evs + IEvsEnumerator/hw/0 + + diff --git a/automotive/evs/aidl/impl/default/resources/evs_mock_configuration.xml b/automotive/evs/aidl/impl/default/resources/evs_mock_configuration.xml new file mode 100644 index 0000000000..6cbc18eacf --- /dev/null +++ b/automotive/evs/aidl/impl/default/resources/evs_mock_configuration.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/automotive/evs/aidl/impl/default/src/ConfigManager.cpp b/automotive/evs/aidl/impl/default/src/ConfigManager.cpp new file mode 100644 index 0000000000..da791ed0b9 --- /dev/null +++ b/automotive/evs/aidl/impl/default/src/ConfigManager.cpp @@ -0,0 +1,992 @@ +/* + * 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. + */ + +#include "ConfigManager.h" + +#include +#include +#include + +#include +#include +#include +#include + +namespace { + +using ::aidl::android::hardware::automotive::evs::CameraParam; +using ::aidl::android::hardware::graphics::common::PixelFormat; +using ::tinyxml2::XMLAttribute; +using ::tinyxml2::XMLDocument; +using ::tinyxml2::XMLElement; + +} // namespace + +std::string_view ConfigManager::sConfigDefaultPath = + "/vendor/etc/automotive/evs/evs_mock_hal_configuration.xml"; +std::string_view ConfigManager::sConfigOverridePath = + "/vendor/etc/automotive/evs/evs_configuration_override.xml"; + +void ConfigManager::printElementNames(const XMLElement* rootElem, const std::string& prefix) const { + const XMLElement* curElem = rootElem; + + while (curElem != nullptr) { + LOG(VERBOSE) << "[ELEM] " << prefix << curElem->Name(); + const XMLAttribute* curAttr = curElem->FirstAttribute(); + while (curAttr) { + LOG(VERBOSE) << "[ATTR] " << prefix << curAttr->Name() << ": " << curAttr->Value(); + curAttr = curAttr->Next(); + } + + /* recursively go down to descendants */ + printElementNames(curElem->FirstChildElement(), prefix + "\t"); + + curElem = curElem->NextSiblingElement(); + } +} + +void ConfigManager::readCameraInfo(const XMLElement* const aCameraElem) { + if (aCameraElem == nullptr) { + LOG(WARNING) << "XML file does not have required camera element"; + return; + } + + const XMLElement* curElem = aCameraElem->FirstChildElement(); + while (curElem != nullptr) { + if (!strcmp(curElem->Name(), "group")) { + /* camera group identifier */ + const char* id = curElem->FindAttribute("id")->Value(); + + /* create a camera group to be filled */ + CameraGroupInfo* aCamera = new CameraGroupInfo(); + + /* read camera device information */ + if (!readCameraDeviceInfo(aCamera, curElem)) { + LOG(WARNING) << "Failed to read a camera information of " << id; + delete aCamera; + continue; + } + + /* camera group synchronization */ + const char* sync = curElem->FindAttribute("synchronized")->Value(); + if (!strcmp(sync, "CALIBRATED")) { + aCamera->synchronized = ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED; + } else if (!strcmp(sync, "APPROXIMATE")) { + aCamera->synchronized = ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE; + } else { + aCamera->synchronized = 0; // Not synchronized + } + + /* add a group to hash map */ + mCameraGroups.insert_or_assign(id, std::unique_ptr(aCamera)); + } else if (!std::strcmp(curElem->Name(), "device")) { + /* camera unique identifier */ + const char* id = curElem->FindAttribute("id")->Value(); + + /* camera mount location */ + const char* pos = curElem->FindAttribute("position")->Value(); + + /* create a camera device to be filled */ + CameraInfo* aCamera = new CameraInfo(); + + /* read camera device information */ + if (!readCameraDeviceInfo(aCamera, curElem)) { + LOG(WARNING) << "Failed to read a camera information of " << id; + delete aCamera; + continue; + } + + /* store read camera module information */ + mCameraInfo.insert_or_assign(id, std::unique_ptr(aCamera)); + + /* assign a camera device to a position group */ + mCameraPosition[pos].insert(id); + } else { + /* ignore other device types */ + LOG(DEBUG) << "Unknown element " << curElem->Name() << " is ignored"; + } + + curElem = curElem->NextSiblingElement(); + } +} + +bool ConfigManager::readCameraDeviceInfo(CameraInfo* aCamera, const XMLElement* aDeviceElem) { + if (aCamera == nullptr || aDeviceElem == nullptr) { + return false; + } + + /* size information to allocate camera_metadata_t */ + size_t totalEntries = 0; + size_t totalDataSize = 0; + + /* read device capabilities */ + totalEntries += + readCameraCapabilities(aDeviceElem->FirstChildElement("caps"), aCamera, totalDataSize); + + /* read camera metadata */ + totalEntries += readCameraMetadata(aDeviceElem->FirstChildElement("characteristics"), aCamera, + totalDataSize); + + /* construct camera_metadata_t */ + if (!constructCameraMetadata(aCamera, totalEntries, totalDataSize)) { + LOG(WARNING) << "Either failed to allocate memory or " + << "allocated memory was not large enough"; + } + + return true; +} + +size_t ConfigManager::readCameraCapabilities(const XMLElement* const aCapElem, CameraInfo* aCamera, + size_t& dataSize) { + if (aCapElem == nullptr || aCamera == nullptr) { + return 0; + } + + std::string token; + const XMLElement* curElem = nullptr; + + /* a list of supported camera parameters/controls */ + curElem = aCapElem->FirstChildElement("supported_controls"); + if (curElem != nullptr) { + const XMLElement* ctrlElem = curElem->FirstChildElement("control"); + while (ctrlElem != nullptr) { + const char* nameAttr = ctrlElem->FindAttribute("name")->Value(); + int32_t minVal = INT32_MIN, maxVal = INT32_MAX; + if (!android::base::ParseInt(ctrlElem->FindAttribute("min")->Value(), &minVal)) { + LOG(WARNING) << "Failed to parse " << ctrlElem->FindAttribute("min")->Value(); + } + + if (!android::base::ParseInt(ctrlElem->FindAttribute("max")->Value(), &maxVal)) { + LOG(WARNING) << "Failed to parse " << ctrlElem->FindAttribute("max")->Value(); + } + + int32_t stepVal = 1; + const XMLAttribute* stepAttr = ctrlElem->FindAttribute("step"); + if (stepAttr != nullptr) { + if (!android::base::ParseInt(stepAttr->Value(), &stepVal)) { + LOG(WARNING) << "Failed to parse " << stepAttr->Value(); + } + } + + CameraParam aParam; + if (ConfigManagerUtil::convertToEvsCameraParam(nameAttr, aParam)) { + aCamera->controls.insert_or_assign( + aParam, std::move(std::make_tuple(minVal, maxVal, stepVal))); + } + + ctrlElem = ctrlElem->NextSiblingElement("control"); + } + } + + /* a list of camera stream configurations */ + curElem = aCapElem->FirstChildElement("stream"); + while (curElem != nullptr) { + /* read 5 attributes */ + const XMLAttribute* idAttr = curElem->FindAttribute("id"); + const XMLAttribute* widthAttr = curElem->FindAttribute("width"); + const XMLAttribute* heightAttr = curElem->FindAttribute("height"); + const XMLAttribute* fmtAttr = curElem->FindAttribute("format"); + const XMLAttribute* fpsAttr = curElem->FindAttribute("framerate"); + + int32_t id = -1; + int32_t framerate = 0; + if (!android::base::ParseInt(idAttr->Value(), &id)) { + LOG(WARNING) << "Failed to parse " << idAttr->Value(); + } + if (fpsAttr != nullptr) { + if (!android::base::ParseInt(fpsAttr->Value(), &framerate)) { + LOG(WARNING) << "Failed to parse " << fpsAttr->Value(); + } + } + + PixelFormat format = PixelFormat::UNSPECIFIED; + if (ConfigManagerUtil::convertToPixelFormat(fmtAttr->Value(), format)) { + StreamConfiguration cfg = { + .id = id, + .format = format, + .type = ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, + .framerate = framerate, + }; + + if (!android::base::ParseInt(widthAttr->Value(), &cfg.width) || + !android::base::ParseInt(heightAttr->Value(), &cfg.height)) { + LOG(WARNING) << "Failed to parse " << widthAttr->Value() << " and " + << heightAttr->Value(); + } + aCamera->streamConfigurations.insert_or_assign(id, cfg); + } + + curElem = curElem->NextSiblingElement("stream"); + } + + dataSize = calculate_camera_metadata_entry_data_size( + get_camera_metadata_tag_type(ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS), + aCamera->streamConfigurations.size() * sizeof(StreamConfiguration)); + + /* a single camera metadata entry contains multiple stream configurations */ + return dataSize > 0 ? 1 : 0; +} + +size_t ConfigManager::readCameraMetadata(const XMLElement* const aParamElem, CameraInfo* aCamera, + size_t& dataSize) { + if (aParamElem == nullptr || aCamera == nullptr) { + return 0; + } + + const XMLElement* curElem = aParamElem->FirstChildElement("parameter"); + size_t numEntries = 0; + camera_metadata_tag_t tag; + while (curElem != nullptr) { + if (ConfigManagerUtil::convertToMetadataTag(curElem->FindAttribute("name")->Value(), tag)) { + switch (tag) { + case ANDROID_LENS_DISTORTION: + case ANDROID_LENS_POSE_ROTATION: + case ANDROID_LENS_POSE_TRANSLATION: + case ANDROID_LENS_INTRINSIC_CALIBRATION: { + /* float[] */ + size_t count = 0; + void* data = ConfigManagerUtil::convertFloatArray( + curElem->FindAttribute("size")->Value(), + curElem->FindAttribute("value")->Value(), count); + + aCamera->cameraMetadata.insert_or_assign(tag, std::make_pair(data, count)); + + ++numEntries; + dataSize += calculate_camera_metadata_entry_data_size( + get_camera_metadata_tag_type(tag), count); + + break; + } + + case ANDROID_REQUEST_AVAILABLE_CAPABILITIES: { + camera_metadata_enum_android_request_available_capabilities_t* data = + new camera_metadata_enum_android_request_available_capabilities_t[1]; + if (ConfigManagerUtil::convertToCameraCapability( + curElem->FindAttribute("value")->Value(), *data)) { + aCamera->cameraMetadata.insert_or_assign(tag, + std::make_pair((void*)data, 1)); + + ++numEntries; + dataSize += calculate_camera_metadata_entry_data_size( + get_camera_metadata_tag_type(tag), 1); + } + break; + } + + case ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS: { + /* a comma-separated list of physical camera devices */ + size_t len = strlen(curElem->FindAttribute("value")->Value()); + char* data = new char[len + 1]; + memcpy(data, curElem->FindAttribute("value")->Value(), len * sizeof(char)); + + /* replace commas with null char */ + char* p = data; + while (*p != '\0') { + if (*p == ',') { + *p = '\0'; + } + ++p; + } + + aCamera->cameraMetadata.insert_or_assign(tag, + std::make_pair((void*)data, len + 1)); + + ++numEntries; + dataSize += calculate_camera_metadata_entry_data_size( + get_camera_metadata_tag_type(tag), len); + break; + } + + /* TODO(b/140416878): add vendor-defined/custom tag support */ + default: + LOG(WARNING) << "Parameter " << curElem->FindAttribute("name")->Value() + << " is not supported"; + break; + } + } else { + LOG(WARNING) << "Unsupported metadata tag " << curElem->FindAttribute("name")->Value() + << " is found."; + } + + curElem = curElem->NextSiblingElement("parameter"); + } + + return numEntries; +} + +bool ConfigManager::constructCameraMetadata(CameraInfo* aCamera, size_t totalEntries, + size_t totalDataSize) { + if (aCamera == nullptr || !aCamera->allocate(totalEntries, totalDataSize)) { + LOG(ERROR) << "Failed to allocate memory for camera metadata"; + return false; + } + + const size_t numStreamConfigs = aCamera->streamConfigurations.size(); + std::unique_ptr data(new int32_t[sizeof(StreamConfiguration) * numStreamConfigs]); + int32_t* ptr = data.get(); + for (auto& cfg : aCamera->streamConfigurations) { + memcpy(ptr, &cfg.second, sizeof(StreamConfiguration)); + ptr += sizeof(StreamConfiguration); + } + int32_t err = add_camera_metadata_entry( + aCamera->characteristics, ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, data.get(), + numStreamConfigs * sizeof(StreamConfiguration)); + + if (err) { + LOG(ERROR) << "Failed to add stream configurations to metadata, ignored"; + return false; + } + + bool success = true; + for (auto& [tag, entry] : aCamera->cameraMetadata) { + /* try to add new camera metadata entry */ + int32_t err = + add_camera_metadata_entry(aCamera->characteristics, tag, entry.first, entry.second); + if (err) { + LOG(ERROR) << "Failed to add an entry with a tag, " << std::hex << tag; + + /* may exceed preallocated capacity */ + LOG(ERROR) << "Camera metadata has " + << get_camera_metadata_entry_count(aCamera->characteristics) << " / " + << get_camera_metadata_entry_capacity(aCamera->characteristics) + << " entries and " + << get_camera_metadata_data_count(aCamera->characteristics) << " / " + << get_camera_metadata_data_capacity(aCamera->characteristics) + << " bytes are filled."; + LOG(ERROR) << "\tCurrent metadata entry requires " + << calculate_camera_metadata_entry_data_size(tag, entry.second) << " bytes."; + + success = false; + } + } + + LOG(VERBOSE) << "Camera metadata has " + << get_camera_metadata_entry_count(aCamera->characteristics) << " / " + << get_camera_metadata_entry_capacity(aCamera->characteristics) << " entries and " + << get_camera_metadata_data_count(aCamera->characteristics) << " / " + << get_camera_metadata_data_capacity(aCamera->characteristics) + << " bytes are filled."; + return success; +} + +void ConfigManager::readSystemInfo(const XMLElement* const aSysElem) { + if (aSysElem == nullptr) { + return; + } + + /* + * Please note that this function assumes that a given system XML element + * and its child elements follow DTD. If it does not, it will cause a + * segmentation fault due to the failure of finding expected attributes. + */ + + /* read number of cameras available in the system */ + const XMLElement* xmlElem = aSysElem->FirstChildElement("num_cameras"); + if (xmlElem != nullptr) { + if (!android::base::ParseInt(xmlElem->FindAttribute("value")->Value(), + &mSystemInfo.numCameras)) { + LOG(WARNING) << "Failed to parse " << xmlElem->FindAttribute("value")->Value(); + } + } +} + +void ConfigManager::readDisplayInfo(const XMLElement* const aDisplayElem) { + if (aDisplayElem == nullptr) { + LOG(WARNING) << "XML file does not have required camera element"; + return; + } + + const XMLElement* curDev = aDisplayElem->FirstChildElement("device"); + while (curDev != nullptr) { + const char* id = curDev->FindAttribute("id")->Value(); + std::unique_ptr dpy(new DisplayInfo()); + if (dpy == nullptr) { + LOG(ERROR) << "Failed to allocate memory for DisplayInfo"; + return; + } + + const XMLElement* cap = curDev->FirstChildElement("caps"); + if (cap != nullptr) { + const XMLElement* curStream = cap->FirstChildElement("stream"); + while (curStream != nullptr) { + /* read 4 attributes */ + const XMLAttribute* idAttr = curStream->FindAttribute("id"); + const XMLAttribute* widthAttr = curStream->FindAttribute("width"); + const XMLAttribute* heightAttr = curStream->FindAttribute("height"); + const XMLAttribute* fmtAttr = curStream->FindAttribute("format"); + + int32_t id = -1; + if (!android::base::ParseInt(idAttr->Value(), &id)) { + LOG(WARNING) << "Failed to parse " << idAttr->Value(); + } + PixelFormat format = PixelFormat::UNSPECIFIED; + if (ConfigManagerUtil::convertToPixelFormat(fmtAttr->Value(), format)) { + StreamConfiguration cfg = { + .id = id, + .format = format, + .type = ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT, + }; + if (!android::base::ParseInt(widthAttr->Value(), &cfg.width) || + !android::base::ParseInt(heightAttr->Value(), &cfg.height)) { + LOG(WARNING) << "Failed to parse " << widthAttr->Value() << " and " + << heightAttr->Value(); + } + dpy->streamConfigurations.insert_or_assign(id, cfg); + } + + curStream = curStream->NextSiblingElement("stream"); + } + } + + mDisplayInfo.insert_or_assign(id, std::move(dpy)); + curDev = curDev->NextSiblingElement("device"); + } + + return; +} + +bool ConfigManager::readConfigDataFromXML() noexcept { + XMLDocument xmlDoc; + + const int64_t parsingStart = android::elapsedRealtimeNano(); + + /* load and parse a configuration file */ + xmlDoc.LoadFile(sConfigOverridePath.data()); + if (xmlDoc.ErrorID() != tinyxml2::XML_SUCCESS) { + xmlDoc.LoadFile(sConfigDefaultPath.data()); + if (xmlDoc.ErrorID() != tinyxml2::XML_SUCCESS) { + LOG(ERROR) << "Failed to load and/or parse a configuration file, " << xmlDoc.ErrorStr(); + return false; + } + } + + /* retrieve the root element */ + const XMLElement* rootElem = xmlDoc.RootElement(); + if (std::strcmp(rootElem->Name(), "configuration") != 0) { + LOG(ERROR) << "A configuration file is not in the required format. " + << "See /etc/automotive/evs/evs_configuration.dtd"; + return false; + } + + std::unique_lock lock(mConfigLock); + + /* + * parse camera information; this needs to be done before reading system + * information + */ + readCameraInfo(rootElem->FirstChildElement("camera")); + + /* parse system information */ + readSystemInfo(rootElem->FirstChildElement("system")); + + /* parse display information */ + readDisplayInfo(rootElem->FirstChildElement("display")); + + /* configuration data is ready to be consumed */ + mIsReady = true; + + /* notify that configuration data is ready */ + lock.unlock(); + mConfigCond.notify_all(); + + const int64_t parsingEnd = android::elapsedRealtimeNano(); + LOG(INFO) << "Parsing configuration file takes " << std::scientific + << (double)(parsingEnd - parsingStart) / 1000000.0 << " ms."; + + return true; +} + +bool ConfigManager::readConfigDataFromBinary() { + /* Temporary buffer to hold configuration data read from a binary file */ + char mBuffer[1024]; + + std::fstream srcFile; + const int64_t readStart = android::elapsedRealtimeNano(); + + srcFile.open(mBinaryFilePath, std::fstream::in | std::fstream::binary); + if (!srcFile) { + LOG(ERROR) << "Failed to open a source binary file, " << mBinaryFilePath; + return false; + } + + std::unique_lock lock(mConfigLock); + mIsReady = false; + + /* read configuration data into the internal buffer */ + srcFile.read(mBuffer, sizeof(mBuffer)); + LOG(VERBOSE) << __FUNCTION__ << ": " << srcFile.gcount() << " bytes are read."; + char* p = mBuffer; + size_t sz = 0; + + /* read number of camera group information entries */ + const size_t ngrps = *(reinterpret_cast(p)); + p += sizeof(size_t); + + /* read each camera information entry */ + for (size_t cidx = 0; cidx < ngrps; ++cidx) { + /* read camera identifier */ + std::string cameraId = *(reinterpret_cast(p)); + p += sizeof(std::string); + + /* size of camera_metadata_t */ + const size_t num_entry = *(reinterpret_cast(p)); + p += sizeof(size_t); + const size_t num_data = *(reinterpret_cast(p)); + p += sizeof(size_t); + + /* create CameraInfo and add it to hash map */ + std::unique_ptr aCamera; + if (aCamera == nullptr || !aCamera->allocate(num_entry, num_data)) { + LOG(ERROR) << "Failed to create new CameraInfo object"; + mCameraInfo.clear(); + return false; + } + + /* controls */ + typedef struct { + CameraParam cid; + int32_t min; + int32_t max; + int32_t step; + } CameraCtrl; + sz = *(reinterpret_cast(p)); + p += sizeof(size_t); + CameraCtrl* ptr = reinterpret_cast(p); + for (size_t idx = 0; idx < sz; ++idx) { + CameraCtrl temp = *ptr++; + aCamera->controls.insert_or_assign( + temp.cid, std::move(std::make_tuple(temp.min, temp.max, temp.step))); + } + p = reinterpret_cast(ptr); + + /* stream configurations */ + sz = *(reinterpret_cast(p)); + p += sizeof(size_t); + int32_t* i32_ptr = reinterpret_cast(p); + for (size_t idx = 0; idx < sz; ++idx) { + const int32_t id = *i32_ptr++; + + StreamConfiguration temp; + memcpy(&temp, i32_ptr, sizeof(StreamConfiguration)); + i32_ptr += sizeof(StreamConfiguration); + aCamera->streamConfigurations.insert_or_assign(id, temp); + } + p = reinterpret_cast(i32_ptr); + + /* synchronization */ + aCamera->synchronized = *(reinterpret_cast(p)); + p += sizeof(int32_t); + + for (size_t idx = 0; idx < num_entry; ++idx) { + /* Read camera metadata entries */ + camera_metadata_tag_t tag = *reinterpret_cast(p); + p += sizeof(camera_metadata_tag_t); + const size_t count = *reinterpret_cast(p); + p += sizeof(size_t); + + const int32_t type = get_camera_metadata_tag_type(tag); + switch (type) { + case TYPE_BYTE: { + add_camera_metadata_entry(aCamera->characteristics, tag, p, count); + p += count * sizeof(uint8_t); + break; + } + case TYPE_INT32: { + add_camera_metadata_entry(aCamera->characteristics, tag, p, count); + p += count * sizeof(int32_t); + break; + } + case TYPE_FLOAT: { + add_camera_metadata_entry(aCamera->characteristics, tag, p, count); + p += count * sizeof(float); + break; + } + case TYPE_INT64: { + add_camera_metadata_entry(aCamera->characteristics, tag, p, count); + p += count * sizeof(int64_t); + break; + } + case TYPE_DOUBLE: { + add_camera_metadata_entry(aCamera->characteristics, tag, p, count); + p += count * sizeof(double); + break; + } + case TYPE_RATIONAL: + p += count * sizeof(camera_metadata_rational_t); + break; + default: + LOG(WARNING) << "Type " << type << " is unknown; " + << "data may be corrupted."; + break; + } + } + + mCameraInfo.insert_or_assign(cameraId, std::move(aCamera)); + } + + /* read number of camera information entries */ + const size_t ncams = *(reinterpret_cast(p)); + p += sizeof(size_t); + + /* read each camera information entry */ + for (size_t cidx = 0; cidx < ncams; ++cidx) { + /* read camera identifier */ + std::string cameraId = *(reinterpret_cast(p)); + p += sizeof(std::string); + + /* size of camera_metadata_t */ + const size_t num_entry = *(reinterpret_cast(p)); + p += sizeof(size_t); + const size_t num_data = *(reinterpret_cast(p)); + p += sizeof(size_t); + + /* create CameraInfo and add it to hash map */ + std::unique_ptr aCamera; + if (aCamera == nullptr || !aCamera->allocate(num_entry, num_data)) { + LOG(ERROR) << "Failed to create new CameraInfo object"; + mCameraInfo.clear(); + return false; + } + + /* controls */ + typedef struct { + CameraParam cid; + int32_t min; + int32_t max; + int32_t step; + } CameraCtrl; + sz = *(reinterpret_cast(p)); + p += sizeof(size_t); + CameraCtrl* ptr = reinterpret_cast(p); + for (size_t idx = 0; idx < sz; ++idx) { + CameraCtrl temp = *ptr++; + aCamera->controls.insert_or_assign( + temp.cid, std::move(std::make_tuple(temp.min, temp.max, temp.step))); + } + p = reinterpret_cast(ptr); + + /* stream configurations */ + sz = *(reinterpret_cast(p)); + p += sizeof(size_t); + int32_t* i32_ptr = reinterpret_cast(p); + for (size_t idx = 0; idx < sz; ++idx) { + const int32_t id = *i32_ptr++; + + StreamConfiguration temp; + memcpy(&temp, i32_ptr, sizeof(StreamConfiguration)); + i32_ptr += sizeof(StreamConfiguration); + aCamera->streamConfigurations.insert_or_assign(id, temp); + } + p = reinterpret_cast(i32_ptr); + + for (size_t idx = 0; idx < num_entry; ++idx) { + /* Read camera metadata entries */ + camera_metadata_tag_t tag = *reinterpret_cast(p); + p += sizeof(camera_metadata_tag_t); + const size_t count = *reinterpret_cast(p); + p += sizeof(size_t); + + const int32_t type = get_camera_metadata_tag_type(tag); + switch (type) { + case TYPE_BYTE: { + add_camera_metadata_entry(aCamera->characteristics, tag, p, count); + p += count * sizeof(uint8_t); + break; + } + case TYPE_INT32: { + add_camera_metadata_entry(aCamera->characteristics, tag, p, count); + p += count * sizeof(int32_t); + break; + } + case TYPE_FLOAT: { + add_camera_metadata_entry(aCamera->characteristics, tag, p, count); + p += count * sizeof(float); + break; + } + case TYPE_INT64: { + add_camera_metadata_entry(aCamera->characteristics, tag, p, count); + p += count * sizeof(int64_t); + break; + } + case TYPE_DOUBLE: { + add_camera_metadata_entry(aCamera->characteristics, tag, p, count); + p += count * sizeof(double); + break; + } + case TYPE_RATIONAL: + p += count * sizeof(camera_metadata_rational_t); + break; + default: + LOG(WARNING) << "Type " << type << " is unknown; " + << "data may be corrupted."; + break; + } + } + + mCameraInfo.insert_or_assign(cameraId, std::move(aCamera)); + } + + mIsReady = true; + + /* notify that configuration data is ready */ + lock.unlock(); + mConfigCond.notify_all(); + + int64_t readEnd = android::elapsedRealtimeNano(); + LOG(INFO) << __FUNCTION__ << " takes " << std::scientific + << (double)(readEnd - readStart) / 1000000.0 << " ms."; + + return true; +} + +bool ConfigManager::writeConfigDataToBinary() { + std::fstream outFile; + + const int64_t writeStart = android::elapsedRealtimeNano(); + + outFile.open(mBinaryFilePath, std::fstream::out | std::fstream::binary); + if (!outFile) { + LOG(ERROR) << "Failed to open a destination binary file, " << mBinaryFilePath; + return false; + } + + /* lock a configuration data while it's being written to the filesystem */ + std::lock_guard lock(mConfigLock); + + /* write camera group information */ + size_t sz = mCameraGroups.size(); + outFile.write(reinterpret_cast(&sz), sizeof(size_t)); + for (auto&& [camId, camInfo] : mCameraGroups) { + LOG(INFO) << "Storing camera group " << camId; + + /* write a camera identifier string */ + outFile.write(reinterpret_cast(&camId), sizeof(std::string)); + + /* controls */ + sz = camInfo->controls.size(); + outFile.write(reinterpret_cast(&sz), sizeof(size_t)); + for (auto&& [ctrl, range] : camInfo->controls) { + outFile.write(reinterpret_cast(&ctrl), sizeof(CameraParam)); + outFile.write(reinterpret_cast(&std::get<0>(range)), sizeof(int32_t)); + outFile.write(reinterpret_cast(&std::get<1>(range)), sizeof(int32_t)); + outFile.write(reinterpret_cast(&std::get<2>(range)), sizeof(int32_t)); + } + + /* stream configurations */ + sz = camInfo->streamConfigurations.size(); + outFile.write(reinterpret_cast(&sz), sizeof(size_t)); + for (auto&& [sid, cfg] : camInfo->streamConfigurations) { + outFile.write(reinterpret_cast(sid), sizeof(int32_t)); + outFile.write(reinterpret_cast(&cfg), sizeof(cfg)); + } + + /* synchronization */ + outFile.write(reinterpret_cast(&camInfo->synchronized), sizeof(int32_t)); + + /* size of camera_metadata_t */ + size_t num_entry = 0; + size_t num_data = 0; + if (camInfo->characteristics != nullptr) { + num_entry = get_camera_metadata_entry_count(camInfo->characteristics); + num_data = get_camera_metadata_data_count(camInfo->characteristics); + } + outFile.write(reinterpret_cast(&num_entry), sizeof(size_t)); + outFile.write(reinterpret_cast(&num_data), sizeof(size_t)); + + /* write each camera metadata entry */ + if (num_entry > 0) { + camera_metadata_entry_t entry; + for (size_t idx = 0; idx < num_entry; ++idx) { + if (get_camera_metadata_entry(camInfo->characteristics, idx, &entry)) { + LOG(ERROR) << "Failed to retrieve camera metadata entry " << idx; + outFile.close(); + return false; + } + + outFile.write(reinterpret_cast(&entry.tag), sizeof(entry.tag)); + outFile.write(reinterpret_cast(&entry.count), sizeof(entry.count)); + + int32_t type = get_camera_metadata_tag_type(entry.tag); + switch (type) { + case TYPE_BYTE: + outFile.write(reinterpret_cast(entry.data.u8), + sizeof(uint8_t) * entry.count); + break; + case TYPE_INT32: + outFile.write(reinterpret_cast(entry.data.i32), + sizeof(int32_t) * entry.count); + break; + case TYPE_FLOAT: + outFile.write(reinterpret_cast(entry.data.f), + sizeof(float) * entry.count); + break; + case TYPE_INT64: + outFile.write(reinterpret_cast(entry.data.i64), + sizeof(int64_t) * entry.count); + break; + case TYPE_DOUBLE: + outFile.write(reinterpret_cast(entry.data.d), + sizeof(double) * entry.count); + break; + case TYPE_RATIONAL: + [[fallthrough]]; + default: + LOG(WARNING) << "Type " << type << " is not supported."; + break; + } + } + } + } + + /* write camera device information */ + sz = mCameraInfo.size(); + outFile.write(reinterpret_cast(&sz), sizeof(size_t)); + for (auto&& [camId, camInfo] : mCameraInfo) { + LOG(INFO) << "Storing camera " << camId; + + /* write a camera identifier string */ + outFile.write(reinterpret_cast(&camId), sizeof(std::string)); + + /* controls */ + sz = camInfo->controls.size(); + outFile.write(reinterpret_cast(&sz), sizeof(size_t)); + for (auto& [ctrl, range] : camInfo->controls) { + outFile.write(reinterpret_cast(&ctrl), sizeof(CameraParam)); + outFile.write(reinterpret_cast(&std::get<0>(range)), sizeof(int32_t)); + outFile.write(reinterpret_cast(&std::get<1>(range)), sizeof(int32_t)); + outFile.write(reinterpret_cast(&std::get<2>(range)), sizeof(int32_t)); + } + + /* stream configurations */ + sz = camInfo->streamConfigurations.size(); + outFile.write(reinterpret_cast(&sz), sizeof(size_t)); + for (auto&& [sid, cfg] : camInfo->streamConfigurations) { + outFile.write(reinterpret_cast(sid), sizeof(int32_t)); + outFile.write(reinterpret_cast(&cfg), sizeof(cfg)); + } + + /* size of camera_metadata_t */ + size_t num_entry = 0; + size_t num_data = 0; + if (camInfo->characteristics != nullptr) { + num_entry = get_camera_metadata_entry_count(camInfo->characteristics); + num_data = get_camera_metadata_data_count(camInfo->characteristics); + } + outFile.write(reinterpret_cast(&num_entry), sizeof(size_t)); + outFile.write(reinterpret_cast(&num_data), sizeof(size_t)); + + /* write each camera metadata entry */ + if (num_entry > 0) { + camera_metadata_entry_t entry; + for (size_t idx = 0; idx < num_entry; ++idx) { + if (get_camera_metadata_entry(camInfo->characteristics, idx, &entry)) { + LOG(ERROR) << "Failed to retrieve camera metadata entry " << idx; + outFile.close(); + return false; + } + + outFile.write(reinterpret_cast(&entry.tag), sizeof(entry.tag)); + outFile.write(reinterpret_cast(&entry.count), sizeof(entry.count)); + + int32_t type = get_camera_metadata_tag_type(entry.tag); + switch (type) { + case TYPE_BYTE: + outFile.write(reinterpret_cast(entry.data.u8), + sizeof(uint8_t) * entry.count); + break; + case TYPE_INT32: + outFile.write(reinterpret_cast(entry.data.i32), + sizeof(int32_t) * entry.count); + break; + case TYPE_FLOAT: + outFile.write(reinterpret_cast(entry.data.f), + sizeof(float) * entry.count); + break; + case TYPE_INT64: + outFile.write(reinterpret_cast(entry.data.i64), + sizeof(int64_t) * entry.count); + break; + case TYPE_DOUBLE: + outFile.write(reinterpret_cast(entry.data.d), + sizeof(double) * entry.count); + break; + case TYPE_RATIONAL: + [[fallthrough]]; + default: + LOG(WARNING) << "Type " << type << " is not supported."; + break; + } + } + } + } + + outFile.close(); + int64_t writeEnd = android::elapsedRealtimeNano(); + LOG(INFO) << __FUNCTION__ << " takes " << std::scientific + << (double)(writeEnd - writeStart) / 1000000.0 << " ms."; + + return true; +} + +std::unique_ptr ConfigManager::Create() { + std::unique_ptr cfgMgr(new ConfigManager()); + + /* + * Read a configuration from XML file + * + * If this is too slow, ConfigManager::readConfigDataFromBinary() and + * ConfigManager::writeConfigDataToBinary()can serialize CameraInfo object + * to the filesystem and construct CameraInfo instead; this was + * evaluated as 10x faster. + */ + if (!cfgMgr->readConfigDataFromXML()) { + return nullptr; + } else { + return cfgMgr; + } +} + +ConfigManager::CameraInfo::~CameraInfo() { + free_camera_metadata(characteristics); + + for (auto&& [tag, val] : cameraMetadata) { + switch (tag) { + case ANDROID_LENS_DISTORTION: + case ANDROID_LENS_POSE_ROTATION: + case ANDROID_LENS_POSE_TRANSLATION: + case ANDROID_LENS_INTRINSIC_CALIBRATION: { + delete[] reinterpret_cast(val.first); + break; + } + + case ANDROID_REQUEST_AVAILABLE_CAPABILITIES: { + delete[] reinterpret_cast< + camera_metadata_enum_android_request_available_capabilities_t*>(val.first); + break; + } + + case ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS: { + delete[] reinterpret_cast(val.first); + break; + } + + default: + LOG(WARNING) << "Tag " << std::hex << tag << " is not supported. " + << "Data may be corrupted?"; + break; + } + } +} diff --git a/automotive/evs/aidl/impl/default/src/ConfigManagerUtil.cpp b/automotive/evs/aidl/impl/default/src/ConfigManagerUtil.cpp new file mode 100644 index 0000000000..e5fe6efa57 --- /dev/null +++ b/automotive/evs/aidl/impl/default/src/ConfigManagerUtil.cpp @@ -0,0 +1,155 @@ +/* + * 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. + */ + +#include "ConfigManagerUtil.h" + +#include +#include +#include +#include + +#include +#include + +#include + +using ::aidl::android::hardware::automotive::evs::CameraParam; +using ::aidl::android::hardware::graphics::common::PixelFormat; + +bool ConfigManagerUtil::convertToEvsCameraParam(const std::string& id, CameraParam& camParam) { + std::string trimmed = ConfigManagerUtil::trimString(id); + bool success = true; + + if (!trimmed.compare("BRIGHTNESS")) { + camParam = CameraParam::BRIGHTNESS; + } else if (!trimmed.compare("CONTRAST")) { + camParam = CameraParam::CONTRAST; + } else if (!trimmed.compare("AUTOGAIN")) { + camParam = CameraParam::AUTOGAIN; + } else if (!trimmed.compare("GAIN")) { + camParam = CameraParam::GAIN; + } else if (!trimmed.compare("AUTO_WHITE_BALANCE")) { + camParam = CameraParam::AUTO_WHITE_BALANCE; + } else if (!trimmed.compare("WHITE_BALANCE_TEMPERATURE")) { + camParam = CameraParam::WHITE_BALANCE_TEMPERATURE; + } else if (!trimmed.compare("SHARPNESS")) { + camParam = CameraParam::SHARPNESS; + } else if (!trimmed.compare("AUTO_EXPOSURE")) { + camParam = CameraParam::AUTO_EXPOSURE; + } else if (!trimmed.compare("ABSOLUTE_EXPOSURE")) { + camParam = CameraParam::ABSOLUTE_EXPOSURE; + } else if (!trimmed.compare("ABSOLUTE_FOCUS")) { + camParam = CameraParam::ABSOLUTE_FOCUS; + } else if (!trimmed.compare("AUTO_FOCUS")) { + camParam = CameraParam::AUTO_FOCUS; + } else if (!trimmed.compare("ABSOLUTE_ZOOM")) { + camParam = CameraParam::ABSOLUTE_ZOOM; + } else { + success = false; + } + + return success; +} + +bool ConfigManagerUtil::convertToPixelFormat(const std::string& in, PixelFormat& out) { + std::string trimmed = ConfigManagerUtil::trimString(in); + bool success = true; + + if (!trimmed.compare("RGBA_8888")) { + out = PixelFormat::RGBA_8888; + } else if (!trimmed.compare("YCRCB_420_SP")) { + out = PixelFormat::YCRCB_420_SP; + } else if (!trimmed.compare("YCBCR_422_I")) { + out = PixelFormat::YCBCR_422_I; + } else { + out = PixelFormat::UNSPECIFIED; + success = false; + } + + return success; +} + +bool ConfigManagerUtil::convertToMetadataTag(const char* name, camera_metadata_tag& aTag) { + if (!std::strcmp(name, "LENS_DISTORTION")) { + aTag = ANDROID_LENS_DISTORTION; + } else if (!std::strcmp(name, "LENS_INTRINSIC_CALIBRATION")) { + aTag = ANDROID_LENS_INTRINSIC_CALIBRATION; + } else if (!std::strcmp(name, "LENS_POSE_ROTATION")) { + aTag = ANDROID_LENS_POSE_ROTATION; + } else if (!std::strcmp(name, "LENS_POSE_TRANSLATION")) { + aTag = ANDROID_LENS_POSE_TRANSLATION; + } else if (!std::strcmp(name, "REQUEST_AVAILABLE_CAPABILITIES")) { + aTag = ANDROID_REQUEST_AVAILABLE_CAPABILITIES; + } else if (!std::strcmp(name, "LOGICAL_MULTI_CAMERA_PHYSICAL_IDS")) { + aTag = ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS; + } else { + return false; + } + + return true; +} + +bool ConfigManagerUtil::convertToCameraCapability( + const char* name, camera_metadata_enum_android_request_available_capabilities_t& cap) { + if (!std::strcmp(name, "DEPTH_OUTPUT")) { + cap = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT; + } else if (!std::strcmp(name, "LOGICAL_MULTI_CAMERA")) { + cap = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA; + } else if (!std::strcmp(name, "MONOCHROME")) { + cap = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME; + } else if (!std::strcmp(name, "SECURE_IMAGE_DATA")) { + cap = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SECURE_IMAGE_DATA; + } else { + return false; + } + + return true; +} + +float* ConfigManagerUtil::convertFloatArray(const char* sz, const char* vals, size_t& count, + const char delimiter) { + std::string size_string(sz); + std::string value_string(vals); + + if (!android::base::ParseUint(size_string, &count)) { + LOG(ERROR) << "Failed to parse " << size_string; + return nullptr; + } + float* result = new float[count]; + std::stringstream values(value_string); + + int32_t idx = 0; + std::string token; + while (getline(values, token, delimiter)) { + if (!android::base::ParseFloat(token, &result[idx++])) { + LOG(WARNING) << "Failed to parse " << token; + } + } + + return result; +} + +std::string ConfigManagerUtil::trimString(const std::string& src, const std::string& ws) { + const auto s = src.find_first_not_of(ws); + if (s == std::string::npos) { + return ""; + } + + const auto e = src.find_last_not_of(ws); + const auto r = e - s + 1; + + return src.substr(s, r); +} diff --git a/automotive/evs/aidl/impl/default/src/DefaultEvsEnumerator.cpp b/automotive/evs/aidl/impl/default/src/DefaultEvsEnumerator.cpp deleted file mode 100644 index 5a81d05850..0000000000 --- a/automotive/evs/aidl/impl/default/src/DefaultEvsEnumerator.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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. - */ - -// TODO(b/203661081): Remove below lines to disable compiler warnings. -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-parameter" - -#define LOG_TAG "DefaultEvsEnumerator" - -#include - -namespace aidl::android::hardware::automotive::evs::implementation { - -using ::ndk::ScopedAStatus; - -ScopedAStatus DefaultEvsEnumerator::isHardware(bool* flag) { - // This returns true always. - *flag = true; - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::openCamera(const std::string& cameraId, - const Stream& streamConfig, - std::shared_ptr* obj) { - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::closeCamera(const std::shared_ptr& obj) { - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::getCameraList(std::vector* list) { - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::getStreamList(const CameraDesc& desc, - std::vector* _aidl_return) { - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::openDisplay(int32_t displayId, - std::shared_ptr* obj) { - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::closeDisplay(const std::shared_ptr& state) { - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::getDisplayIdList(std::vector* list) { - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::getDisplayState(DisplayState* state) { - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::registerStatusCallback( - const std::shared_ptr& callback) { - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::openUltrasonicsArray( - const std::string& id, std::shared_ptr* obj) { - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::closeUltrasonicsArray( - const std::shared_ptr& obj) { - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::getUltrasonicsArrayList( - std::vector* list) { - return ScopedAStatus::ok(); -} - -} // namespace aidl::android::hardware::automotive::evs::implementation - -#pragma clang diagnostic pop diff --git a/automotive/evs/aidl/impl/default/src/EvsEnumerator.cpp b/automotive/evs/aidl/impl/default/src/EvsEnumerator.cpp new file mode 100644 index 0000000000..6e2405deb5 --- /dev/null +++ b/automotive/evs/aidl/impl/default/src/EvsEnumerator.cpp @@ -0,0 +1,552 @@ +/* + * 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. + */ + +#include "EvsEnumerator.h" + +#include "ConfigManager.h" +#include "EvsGlDisplay.h" +#include "EvsMockCamera.h" + +#include +#include +#include +#include + +#include +#include + +namespace { + +using ::aidl::android::frameworks::automotive::display::ICarDisplayProxy; +using ::aidl::android::hardware::graphics::common::BufferUsage; +using ::ndk::ScopedAStatus; +using std::chrono_literals::operator""s; + +// Constants +constexpr std::chrono::seconds kEnumerationTimeout = 10s; +constexpr uint64_t kInvalidDisplayId = std::numeric_limits::max(); +const std::set kAllowedUids = {AID_AUTOMOTIVE_EVS, AID_SYSTEM, AID_ROOT}; + +} // namespace + +namespace aidl::android::hardware::automotive::evs::implementation { + +// NOTE: All members values are static so that all clients operate on the same state +// That is to say, this is effectively a singleton despite the fact that HIDL +// constructs a new instance for each client. +std::unordered_map EvsEnumerator::sCameraList; +std::mutex EvsEnumerator::sLock; +std::condition_variable EvsEnumerator::sCameraSignal; +std::unique_ptr EvsEnumerator::sConfigManager; +std::shared_ptr EvsEnumerator::sDisplayProxy; +std::unordered_map EvsEnumerator::sDisplayPortList; + +EvsEnumerator::ActiveDisplays& EvsEnumerator::mutableActiveDisplays() { + static ActiveDisplays active_displays; + return active_displays; +} + +EvsEnumerator::EvsEnumerator(const std::shared_ptr& proxyService) { + LOG(DEBUG) << "EvsEnumerator is created."; + + if (!sConfigManager) { + /* loads and initializes ConfigManager in a separate thread */ + sConfigManager = ConfigManager::Create(); + } + + if (!sDisplayProxy) { + /* sets a car-window service handle */ + sDisplayProxy = proxyService; + } + + // Enumerate existing devices + enumerateCameras(); + mInternalDisplayId = enumerateDisplays(); +} + +bool EvsEnumerator::checkPermission() { + const auto uid = AIBinder_getCallingUid(); + if (kAllowedUids.find(uid) == kAllowedUids.end()) { + LOG(ERROR) << "EVS access denied: " + << "pid = " << AIBinder_getCallingPid() << ", uid = " << uid; + return false; + } + + return true; +} + +void EvsEnumerator::enumerateCameras() { + if (!sConfigManager) { + return; + } + + for (auto id : sConfigManager->getCameraIdList()) { + CameraRecord rec(id.data()); + std::unique_ptr& pInfo = sConfigManager->getCameraInfo(id); + if (pInfo) { + uint8_t* ptr = reinterpret_cast(pInfo->characteristics); + const size_t len = get_camera_metadata_size(pInfo->characteristics); + rec.desc.metadata.insert(rec.desc.metadata.end(), ptr, ptr + len); + } + sCameraList.insert_or_assign(id, std::move(rec)); + } +} + +uint64_t EvsEnumerator::enumerateDisplays() { + LOG(INFO) << __FUNCTION__ << ": Starting display enumeration"; + uint64_t internalDisplayId = kInvalidDisplayId; + if (!sDisplayProxy) { + LOG(ERROR) << "ICarDisplayProxy is not available!"; + return internalDisplayId; + } + + std::vector displayIds; + if (auto status = sDisplayProxy->getDisplayIdList(&displayIds); !status.isOk()) { + LOG(ERROR) << "Failed to retrieve a display id list" + << ::android::statusToString(status.getStatus()); + return internalDisplayId; + } + + if (displayIds.size() > 0) { + // The first entry of the list is the internal display. See + // SurfaceFlinger::getPhysicalDisplayIds() implementation. + internalDisplayId = displayIds[0]; + for (const auto& id : displayIds) { + const auto port = id & 0xFF; + LOG(INFO) << "Display " << std::hex << id << " is detected on the port, " << port; + sDisplayPortList.insert_or_assign(port, id); + } + } + + LOG(INFO) << "Found " << sDisplayPortList.size() << " displays"; + return internalDisplayId; +} + +// Methods from ::android::hardware::automotive::evs::IEvsEnumerator follow. +ScopedAStatus EvsEnumerator::getCameraList(std::vector* _aidl_return) { + LOG(DEBUG) << __FUNCTION__; + if (!checkPermission()) { + return ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::PERMISSION_DENIED)); + } + + { + std::unique_lock lock(sLock); + if (sCameraList.size() < 1) { + // No qualified device has been found. Wait until new device is ready, + // for 10 seconds. + if (!sCameraSignal.wait_for(lock, kEnumerationTimeout, + [] { return sCameraList.size() > 0; })) { + LOG(DEBUG) << "Timer expired. No new device has been added."; + } + } + } + + // Build up a packed array of CameraDesc for return + _aidl_return->resize(sCameraList.size()); + unsigned i = 0; + for (const auto& [key, cam] : sCameraList) { + (*_aidl_return)[i++] = cam.desc; + } + + if (sConfigManager) { + // Adding camera groups that represent logical camera devices + auto camGroups = sConfigManager->getCameraGroupIdList(); + for (auto&& id : camGroups) { + if (sCameraList.find(id) != sCameraList.end()) { + // Already exists in the _aidl_return + continue; + } + + std::unique_ptr& tempInfo = + sConfigManager->getCameraGroupInfo(id); + CameraRecord cam(id.data()); + if (tempInfo) { + uint8_t* ptr = reinterpret_cast(tempInfo->characteristics); + const size_t len = get_camera_metadata_size(tempInfo->characteristics); + cam.desc.metadata.insert(cam.desc.metadata.end(), ptr, ptr + len); + } + + sCameraList.insert_or_assign(id, cam); + _aidl_return->push_back(cam.desc); + } + } + + // Send back the results + LOG(DEBUG) << "Reporting " << sCameraList.size() << " cameras available"; + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsEnumerator::getStreamList(const CameraDesc& desc, + std::vector* _aidl_return) { + using AidlPixelFormat = ::aidl::android::hardware::graphics::common::PixelFormat; + + camera_metadata_t* pMetadata = const_cast( + reinterpret_cast(desc.metadata.data())); + camera_metadata_entry_t streamConfig; + if (!find_camera_metadata_entry(pMetadata, ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, + &streamConfig)) { + const unsigned numStreamConfigs = streamConfig.count / sizeof(StreamConfiguration); + _aidl_return->resize(numStreamConfigs); + const StreamConfiguration* pCurrentConfig = + reinterpret_cast(streamConfig.data.i32); + for (unsigned i = 0; i < numStreamConfigs; ++i, ++pCurrentConfig) { + // Build ::aidl::android::hardware::automotive::evs::Stream from + // StreamConfiguration. + Stream current = { + .id = pCurrentConfig->id, + .streamType = + pCurrentConfig->type == + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT + ? StreamType::INPUT + : StreamType::OUTPUT, + .width = pCurrentConfig->width, + .height = pCurrentConfig->height, + .format = static_cast(pCurrentConfig->format), + .usage = BufferUsage::CAMERA_INPUT, + .rotation = Rotation::ROTATION_0, + }; + + (*_aidl_return)[i] = current; + } + } + + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsEnumerator::openCamera(const std::string& id, const Stream& cfg, + std::shared_ptr* obj) { + LOG(DEBUG) << __FUNCTION__; + if (!checkPermission()) { + return ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::PERMISSION_DENIED)); + } + + // Is this a recognized camera id? + CameraRecord* pRecord = findCameraById(id); + if (!pRecord) { + LOG(ERROR) << id << " does not exist!"; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); + } + + // Has this camera already been instantiated by another caller? + std::shared_ptr pActiveCamera = pRecord->activeInstance.lock(); + if (pActiveCamera) { + LOG(WARNING) << "Killing previous camera because of new caller"; + closeCamera(pActiveCamera); + } + + // Construct a camera instance for the caller + if (!sConfigManager) { + pActiveCamera = EvsMockCamera::Create(id.data()); + } else { + pActiveCamera = EvsMockCamera::Create(id.data(), sConfigManager->getCameraInfo(id), &cfg); + } + + pRecord->activeInstance = pActiveCamera; + if (!pActiveCamera) { + LOG(ERROR) << "Failed to create new EvsMockCamera object for " << id; + return ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::UNDERLYING_SERVICE_ERROR)); + } + + *obj = pActiveCamera; + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsEnumerator::closeCamera(const std::shared_ptr& cameraObj) { + LOG(DEBUG) << __FUNCTION__; + + if (!cameraObj) { + LOG(ERROR) << "Ignoring call to closeCamera with null camera ptr"; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); + } + + // Get the camera id so we can find it in our list + CameraDesc desc; + auto status = cameraObj->getCameraInfo(&desc); + if (!status.isOk()) { + LOG(ERROR) << "Failed to read a camera descriptor"; + return ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::UNDERLYING_SERVICE_ERROR)); + } + auto cameraId = desc.id; + closeCamera_impl(cameraObj, cameraId); + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsEnumerator::openDisplay(int32_t id, std::shared_ptr* displayObj) { + LOG(DEBUG) << __FUNCTION__; + if (!checkPermission()) { + return ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::PERMISSION_DENIED)); + } + + auto& displays = mutableActiveDisplays(); + + if (auto existing_display_search = displays.popDisplay(id)) { + // If we already have a display active, then we need to shut it down so we can + // give exclusive access to the new caller. + std::shared_ptr pActiveDisplay = existing_display_search->displayWeak.lock(); + if (pActiveDisplay) { + LOG(WARNING) << "Killing previous display because of new caller"; + pActiveDisplay->forceShutdown(); + } + } + + // Create a new display interface and return it + uint64_t targetDisplayId = mInternalDisplayId; + auto it = sDisplayPortList.find(id); + if (it != sDisplayPortList.end()) { + targetDisplayId = it->second; + } else { + LOG(WARNING) << "No display is available on the port " << static_cast(id) + << ". The main display " << mInternalDisplayId << " will be used instead"; + } + + // Create a new display interface and return it. + std::shared_ptr pActiveDisplay = + ndk::SharedRefBase::make(sDisplayProxy, targetDisplayId); + + if (auto insert_result = displays.tryInsert(id, pActiveDisplay); !insert_result) { + LOG(ERROR) << "Display ID " << id << " has been used by another caller."; + pActiveDisplay->forceShutdown(); + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::RESOURCE_BUSY)); + } + + LOG(DEBUG) << "Returning new EvsGlDisplay object " << pActiveDisplay.get(); + *displayObj = pActiveDisplay; + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsEnumerator::closeDisplay(const std::shared_ptr& obj) { + LOG(DEBUG) << __FUNCTION__; + + auto& displays = mutableActiveDisplays(); + const auto display_search = displays.popDisplay(obj); + + if (!display_search) { + LOG(WARNING) << "Ignoring close of previously orphaned display - why did a client steal?"; + return ScopedAStatus::ok(); + } + + auto pActiveDisplay = display_search->displayWeak.lock(); + + if (!pActiveDisplay) { + LOG(ERROR) << "Somehow a display is being destroyed " + << "when the enumerator didn't know one existed"; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); + } + + pActiveDisplay->forceShutdown(); + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsEnumerator::getDisplayState(DisplayState* state) { + LOG(DEBUG) << __FUNCTION__; + if (!checkPermission()) { + *state = DisplayState::DEAD; + return ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::PERMISSION_DENIED)); + } + + // TODO(b/262779341): For now we can just return the state of the 1st display. Need to update + // the API later. + + const auto& all_displays = mutableActiveDisplays().getAllDisplays(); + + // Do we still have a display object we think should be active? + if (all_displays.empty()) { + *state = DisplayState::NOT_OPEN; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); + } + + std::shared_ptr pActiveDisplay = all_displays.begin()->second.displayWeak.lock(); + if (pActiveDisplay) { + return pActiveDisplay->getDisplayState(state); + } else { + *state = DisplayState::NOT_OPEN; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); + } +} + +ScopedAStatus EvsEnumerator::getDisplayIdList(std::vector* list) { + std::vector& output = *list; + if (sDisplayPortList.size() > 0) { + output.resize(sDisplayPortList.size()); + unsigned i = 0; + output[i++] = mInternalDisplayId & 0xFF; + for (const auto& [port, id] : sDisplayPortList) { + if (mInternalDisplayId != id) { + output[i++] = port; + } + } + } + + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsEnumerator::isHardware(bool* flag) { + *flag = true; + return ScopedAStatus::ok(); +} + +void EvsEnumerator::notifyDeviceStatusChange(const std::string_view& deviceName, + DeviceStatusType type) { + std::lock_guard lock(sLock); + if (!mCallback) { + return; + } + + std::vector status{{.id = std::string(deviceName), .status = type}}; + if (!mCallback->deviceStatusChanged(status).isOk()) { + LOG(WARNING) << "Failed to notify a device status change, name = " << deviceName + << ", type = " << static_cast(type); + } +} + +ScopedAStatus EvsEnumerator::registerStatusCallback( + const std::shared_ptr& callback) { + std::lock_guard lock(sLock); + if (mCallback) { + LOG(INFO) << "Replacing an existing device status callback"; + } + mCallback = callback; + return ScopedAStatus::ok(); +} + +void EvsEnumerator::closeCamera_impl(const std::shared_ptr& pCamera, + const std::string& cameraId) { + // Find the named camera + CameraRecord* pRecord = findCameraById(cameraId); + + // Is the display being destroyed actually the one we think is active? + if (!pRecord) { + LOG(ERROR) << "Asked to close a camera whose name isn't recognized"; + } else { + std::shared_ptr pActiveCamera = pRecord->activeInstance.lock(); + if (!pActiveCamera) { + LOG(WARNING) << "Somehow a camera is being destroyed " + << "when the enumerator didn't know one existed"; + } else if (pActiveCamera != pCamera) { + // This can happen if the camera was aggressively reopened, + // orphaning this previous instance + LOG(WARNING) << "Ignoring close of previously orphaned camera " + << "- why did a client steal?"; + } else { + // Shutdown the active camera + pActiveCamera->shutdown(); + } + } + + return; +} + +EvsEnumerator::CameraRecord* EvsEnumerator::findCameraById(const std::string& cameraId) { + // Find the named camera + auto found = sCameraList.find(cameraId); + if (found != sCameraList.end()) { + // Found a match! + return &found->second; + } + + // We didn't find a match + return nullptr; +} + +std::optional EvsEnumerator::ActiveDisplays::popDisplay( + int32_t id) { + std::lock_guard lck(mMutex); + const auto search = mIdToDisplay.find(id); + if (search == mIdToDisplay.end()) { + return std::nullopt; + } + const auto display_info = search->second; + mIdToDisplay.erase(search); + mDisplayToId.erase(display_info.internalDisplayRawAddr); + return display_info; +} + +std::optional EvsEnumerator::ActiveDisplays::popDisplay( + const std::shared_ptr& display) { + const auto display_ptr_val = reinterpret_cast(display.get()); + std::lock_guard lck(mMutex); + const auto display_to_id_search = mDisplayToId.find(display_ptr_val); + if (display_to_id_search == mDisplayToId.end()) { + LOG(ERROR) << "Unknown display."; + return std::nullopt; + } + const auto id = display_to_id_search->second; + const auto id_to_display_search = mIdToDisplay.find(id); + mDisplayToId.erase(display_to_id_search); + if (id_to_display_search == mIdToDisplay.end()) { + LOG(ERROR) << "No correspsonding ID for the display, probably orphaned."; + return std::nullopt; + } + const auto display_info = id_to_display_search->second; + mIdToDisplay.erase(id); + return display_info; +} + +std::unordered_map +EvsEnumerator::ActiveDisplays::getAllDisplays() { + std::lock_guard lck(mMutex); + auto id_to_display_map_copy = mIdToDisplay; + return id_to_display_map_copy; +} + +bool EvsEnumerator::ActiveDisplays::tryInsert(int32_t id, + const std::shared_ptr& display) { + std::lock_guard lck(mMutex); + const auto display_ptr_val = reinterpret_cast(display.get()); + + auto id_to_display_insert_result = + mIdToDisplay.emplace(id, DisplayInfo{ + .id = id, + .displayWeak = display, + .internalDisplayRawAddr = display_ptr_val, + }); + if (!id_to_display_insert_result.second) { + return false; + } + auto display_to_id_insert_result = mDisplayToId.emplace(display_ptr_val, id); + if (!display_to_id_insert_result.second) { + mIdToDisplay.erase(id); + return false; + } + return true; +} + +ScopedAStatus EvsEnumerator::getUltrasonicsArrayList( + [[maybe_unused]] std::vector* list) { + // TODO(b/149874793): Add implementation for EVS Manager and Sample driver + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsEnumerator::openUltrasonicsArray( + [[maybe_unused]] const std::string& id, + [[maybe_unused]] std::shared_ptr* obj) { + // TODO(b/149874793): Add implementation for EVS Manager and Sample driver + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsEnumerator::closeUltrasonicsArray( + [[maybe_unused]] const std::shared_ptr& obj) { + // TODO(b/149874793): Add implementation for EVS Manager and Sample driver + return ScopedAStatus::ok(); +} + +} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/src/EvsGlDisplay.cpp b/automotive/evs/aidl/impl/default/src/EvsGlDisplay.cpp new file mode 100644 index 0000000000..e5f8e4c84a --- /dev/null +++ b/automotive/evs/aidl/impl/default/src/EvsGlDisplay.cpp @@ -0,0 +1,417 @@ +/* + * 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. + */ + +#include "EvsGlDisplay.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace { + +using ::aidl::android::frameworks::automotive::display::ICarDisplayProxy; +using ::aidl::android::hardware::graphics::common::BufferUsage; +using ::aidl::android::hardware::graphics::common::PixelFormat; +using ::android::base::ScopedLockAssertion; +using ::ndk::ScopedAStatus; + +constexpr auto kTimeout = std::chrono::seconds(1); + +bool debugFirstFrameDisplayed = false; + +int generateFingerPrint(buffer_handle_t handle) { + return static_cast(reinterpret_cast(handle) & 0xFFFFFFFF); +} + +} // namespace + +namespace aidl::android::hardware::automotive::evs::implementation { + +EvsGlDisplay::EvsGlDisplay(const std::shared_ptr& pDisplayProxy, + uint64_t displayId) + : mDisplayId(displayId), mDisplayProxy(pDisplayProxy) { + LOG(DEBUG) << "EvsGlDisplay instantiated"; + + // Set up our self description + // NOTE: These are arbitrary values chosen for testing + mInfo.id = std::to_string(displayId); + mInfo.vendorFlags = 3870; + + // Start a thread to render images on this display + { + std::lock_guard lock(mLock); + mState = RUN; + } + mRenderThread = std::thread([this]() { renderFrames(); }); +} + +EvsGlDisplay::~EvsGlDisplay() { + LOG(DEBUG) << "EvsGlDisplay being destroyed"; + forceShutdown(); +} + +/** + * This gets called if another caller "steals" ownership of the display + */ +void EvsGlDisplay::forceShutdown() { + LOG(DEBUG) << "EvsGlDisplay forceShutdown"; + { + std::lock_guard lock(mLock); + + // If the buffer isn't being held by a remote client, release it now as an + // optimization to release the resources more quickly than the destructor might + // get called. + if (mBuffer.handle != nullptr) { + // Report if we're going away while a buffer is outstanding + if (mBufferBusy || mState == RUN) { + LOG(ERROR) << "EvsGlDisplay going down while client is holding a buffer"; + } + mState = STOPPING; + } + + // Put this object into an unrecoverable error state since somebody else + // is going to own the display now. + mRequestedState = DisplayState::DEAD; + } + mBufferReadyToRender.notify_all(); + + if (mRenderThread.joinable()) { + mRenderThread.join(); + } +} + +/** + * Initialize GL in the context of a caller's thread and prepare a graphic + * buffer to use. + */ +bool EvsGlDisplay::initializeGlContextLocked() { + // Initialize our display window + // NOTE: This will cause the display to become "VISIBLE" before a frame is actually + // returned, which is contrary to the spec and will likely result in a black frame being + // (briefly) shown. + if (!mGlWrapper.initialize(mDisplayProxy, mDisplayId)) { + // Report the failure + LOG(ERROR) << "Failed to initialize GL display"; + return false; + } + + // Assemble the buffer description we'll use for our render target + static_assert(::aidl::android::hardware::graphics::common::PixelFormat::RGBA_8888 == + static_cast<::aidl::android::hardware::graphics::common::PixelFormat>( + HAL_PIXEL_FORMAT_RGBA_8888)); + mBuffer.description = { + .width = static_cast(mGlWrapper.getWidth()), + .height = static_cast(mGlWrapper.getHeight()), + .layers = 1, + .format = PixelFormat::RGBA_8888, + // FIXME: Below line is not using + // ::aidl::android::hardware::graphics::common::BufferUsage because + // BufferUsage enum does not support a bitwise-OR operation; they + // should be BufferUsage::GPU_RENDER_TARGET | + // BufferUsage::COMPOSER_OVERLAY + .usage = static_cast(GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_COMPOSER), + }; + + ::android::GraphicBufferAllocator& alloc(::android::GraphicBufferAllocator::get()); + uint32_t stride = static_cast(mBuffer.description.stride); + buffer_handle_t handle = nullptr; + const ::android::status_t result = + alloc.allocate(mBuffer.description.width, mBuffer.description.height, + static_cast<::android::PixelFormat>(mBuffer.description.format), + mBuffer.description.layers, + static_cast(mBuffer.description.usage), &handle, &stride, + /* requestorName= */ "EvsGlDisplay"); + mBuffer.description.stride = stride; + mBuffer.fingerprint = generateFingerPrint(mBuffer.handle); + if (result != ::android::NO_ERROR) { + LOG(ERROR) << "Error " << result << " allocating " << mBuffer.description.width << " x " + << mBuffer.description.height << " graphics buffer."; + mGlWrapper.shutdown(); + return false; + } + + mBuffer.handle = handle; + if (mBuffer.handle == nullptr) { + LOG(ERROR) << "We didn't get a buffer handle back from the allocator"; + mGlWrapper.shutdown(); + return false; + } + + LOG(DEBUG) << "Allocated new buffer " << mBuffer.handle << " with stride " + << mBuffer.description.stride; + return true; +} + +/** + * This method runs in a separate thread and renders the contents of the buffer. + */ +void EvsGlDisplay::renderFrames() { + { + std::lock_guard lock(mLock); + + if (!initializeGlContextLocked()) { + LOG(ERROR) << "Failed to initialize GL context"; + return; + } + + // Display buffer is ready. + mBufferBusy = false; + } + mBufferReadyToUse.notify_all(); + + while (true) { + { + std::unique_lock lock(mLock); + ScopedLockAssertion lock_assertion(mLock); + mBufferReadyToRender.wait( + lock, [this]() REQUIRES(mLock) { return mBufferReady || mState != RUN; }); + if (mState != RUN) { + LOG(DEBUG) << "A rendering thread is stopping"; + break; + } + mBufferReady = false; + } + + // Update the texture contents with the provided data + if (!mGlWrapper.updateImageTexture(mBuffer.handle, mBuffer.description)) { + LOG(WARNING) << "Failed to update the image texture"; + continue; + } + + // Put the image on the screen + mGlWrapper.renderImageToScreen(); + if (!debugFirstFrameDisplayed) { + LOG(DEBUG) << "EvsFirstFrameDisplayTiming start time: " << ::android::elapsedRealtime() + << " ms."; + debugFirstFrameDisplayed = true; + } + + // Mark current frame is consumed. + { + std::lock_guard lock(mLock); + mBufferBusy = false; + } + mBufferDone.notify_all(); + } + + LOG(DEBUG) << "A rendering thread is stopped."; + + // Drop the graphics buffer we've been using + ::android::GraphicBufferAllocator& alloc(::android::GraphicBufferAllocator::get()); + alloc.free(mBuffer.handle); + mBuffer.handle = nullptr; + + mGlWrapper.hideWindow(mDisplayProxy, mDisplayId); + mGlWrapper.shutdown(); + + std::lock_guard lock(mLock); + mState = STOPPED; +} + +/** + * Returns basic information about the EVS display provided by the system. + * See the description of the DisplayDesc structure for details. + */ +ScopedAStatus EvsGlDisplay::getDisplayInfo(DisplayDesc* _aidl_return) { + if (!mDisplayProxy) { + return ::ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::UNDERLYING_SERVICE_ERROR)); + } + + ::aidl::android::frameworks::automotive::display::DisplayDesc proxyDisplay; + auto status = mDisplayProxy->getDisplayInfo(mDisplayId, &proxyDisplay); + if (!status.isOk()) { + return ::ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::UNDERLYING_SERVICE_ERROR)); + } + + _aidl_return->width = proxyDisplay.width; + _aidl_return->height = proxyDisplay.height; + _aidl_return->orientation = static_cast(proxyDisplay.orientation); + _aidl_return->id = mInfo.id; // FIXME: what should be ID here? + _aidl_return->vendorFlags = mInfo.vendorFlags; + return ::ndk::ScopedAStatus::ok(); +} + +/** + * Clients may set the display state to express their desired state. + * The HAL implementation must gracefully accept a request for any state + * while in any other state, although the response may be to ignore the request. + * The display is defined to start in the NOT_VISIBLE state upon initialization. + * The client is then expected to request the VISIBLE_ON_NEXT_FRAME state, and + * then begin providing video. When the display is no longer required, the client + * is expected to request the NOT_VISIBLE state after passing the last video frame. + */ +ScopedAStatus EvsGlDisplay::setDisplayState(DisplayState state) { + LOG(DEBUG) << __FUNCTION__; + std::lock_guard lock(mLock); + + if (mRequestedState == DisplayState::DEAD) { + // This object no longer owns the display -- it's been superceeded! + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); + } + + // Ensure we recognize the requested state so we don't go off the rails + static constexpr ::ndk::enum_range kDisplayStateRange; + if (std::find(kDisplayStateRange.begin(), kDisplayStateRange.end(), state) == + kDisplayStateRange.end()) { + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); + } + + switch (state) { + case DisplayState::NOT_VISIBLE: + mGlWrapper.hideWindow(mDisplayProxy, mDisplayId); + break; + case DisplayState::VISIBLE: + mGlWrapper.showWindow(mDisplayProxy, mDisplayId); + break; + default: + break; + } + + // Record the requested state + mRequestedState = state; + + return ScopedAStatus::ok(); +} + +/** + * The HAL implementation should report the actual current state, which might + * transiently differ from the most recently requested state. Note, however, that + * the logic responsible for changing display states should generally live above + * the device layer, making it undesirable for the HAL implementation to + * spontaneously change display states. + */ +ScopedAStatus EvsGlDisplay::getDisplayState(DisplayState* _aidl_return) { + LOG(DEBUG) << __FUNCTION__; + std::lock_guard lock(mLock); + *_aidl_return = mRequestedState; + return ScopedAStatus::ok(); +} + +/** + * This call returns a handle to a frame buffer associated with the display. + * This buffer may be locked and written to by software and/or GL. This buffer + * must be returned via a call to returnTargetBufferForDisplay() even if the + * display is no longer visible. + */ +ScopedAStatus EvsGlDisplay::getTargetBuffer(BufferDesc* _aidl_return) { + LOG(DEBUG) << __FUNCTION__; + std::unique_lock lock(mLock); + ScopedLockAssertion lock_assertion(mLock); + if (mRequestedState == DisplayState::DEAD) { + LOG(ERROR) << "Rejecting buffer request from object that lost ownership of the display."; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); + } + + // If we don't already have a buffer, allocate one now + // mBuffer.memHandle is a type of buffer_handle_t, which is equal to + // native_handle_t*. + mBufferReadyToUse.wait(lock, [this]() REQUIRES(mLock) { return !mBufferBusy; }); + + // Do we have a frame available? + if (mBufferBusy) { + // This means either we have a 2nd client trying to compete for buffers + // (an unsupported mode of operation) or else the client hasn't returned + // a previously issued buffer yet (they're behaving badly). + // NOTE: We have to make the callback even if we have nothing to provide + LOG(ERROR) << "getTargetBuffer called while no buffers available."; + return ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::BUFFER_NOT_AVAILABLE)); + } + + // Mark our buffer as busy + mBufferBusy = true; + + // Send the buffer to the client + LOG(VERBOSE) << "Providing display buffer handle " << mBuffer.handle; + + BufferDesc bufferDescToSend = { + .buffer = + { + .handle = std::move(::android::dupToAidl(mBuffer.handle)), + .description = mBuffer.description, + }, + .pixelSizeBytes = 4, // RGBA_8888 is 4-byte-per-pixel format + .bufferId = mBuffer.fingerprint, + }; + *_aidl_return = std::move(bufferDescToSend); + + return ScopedAStatus::ok(); +} + +/** + * This call tells the display that the buffer is ready for display. + * The buffer is no longer valid for use by the client after this call. + */ +ScopedAStatus EvsGlDisplay::returnTargetBufferForDisplay(const BufferDesc& buffer) { + LOG(VERBOSE) << __FUNCTION__; + std::unique_lock lock(mLock); + ScopedLockAssertion lock_assertion(mLock); + + // Nobody should call us with a null handle + if (buffer.buffer.handle.fds.size() < 1) { + LOG(ERROR) << __FUNCTION__ << " called without a valid buffer handle."; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); + } + if (buffer.bufferId != mBuffer.fingerprint) { + LOG(ERROR) << "Got an unrecognized frame returned."; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); + } + if (!mBufferBusy) { + LOG(ERROR) << "A frame was returned with no outstanding frames."; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); + } + + // If we've been displaced by another owner of the display, then we can't do anything else + if (mRequestedState == DisplayState::DEAD) { + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); + } + + // If we were waiting for a new frame, this is it! + if (mRequestedState == DisplayState::VISIBLE_ON_NEXT_FRAME) { + mRequestedState = DisplayState::VISIBLE; + mGlWrapper.showWindow(mDisplayProxy, mDisplayId); + } + + // Validate we're in an expected state + if (mRequestedState != DisplayState::VISIBLE) { + // Not sure why a client would send frames back when we're not visible. + LOG(WARNING) << "Got a frame returned while not visible - ignoring."; + return ScopedAStatus::ok(); + } + mBufferReady = true; + mBufferReadyToRender.notify_all(); + + if (!mBufferDone.wait_for(lock, kTimeout, [this]() REQUIRES(mLock) { return !mBufferBusy; })) { + return ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::UNDERLYING_SERVICE_ERROR)); + } + + return ScopedAStatus::ok(); +} + +} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/src/EvsMockCamera.cpp b/automotive/evs/aidl/impl/default/src/EvsMockCamera.cpp new file mode 100644 index 0000000000..4b46a5ae64 --- /dev/null +++ b/automotive/evs/aidl/impl/default/src/EvsMockCamera.cpp @@ -0,0 +1,642 @@ +/* + * 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. + */ + +#include "EvsMockCamera.h" +#include "ConfigManager.h" +#include "EvsEnumerator.h" + +#include +#include +#include +#include + +#include + +namespace { + +using ::aidl::android::hardware::graphics::common::BufferUsage; +using ::ndk::ScopedAStatus; + +// Arbitrary limit on number of graphics buffers allowed to be allocated +// Safeguards against unreasonable resource consumption and provides a testable limit +constexpr unsigned kMaxBuffersInFlight = 100; + +// Minimum number of buffers to run a video stream +constexpr int kMinimumBuffersInFlight = 1; + +// Colors for the colorbar test pattern in ABGR format +constexpr uint32_t kColors[] = { + 0xFFFFFFFF, // white + 0xFF00FFFF, // yellow + 0xFFFFFF00, // cyan + 0xFF00FF00, // green + 0xFFFF00FF, // fuchsia + 0xFF0000FF, // red + 0xFFFF0000, // blue + 0xFF000000, // black +}; +constexpr size_t kNumColors = sizeof(kColors) / sizeof(kColors[0]); + +} // namespace + +namespace aidl::android::hardware::automotive::evs::implementation { + +EvsMockCamera::EvsMockCamera([[maybe_unused]] Sigil sigil, const char* id, + std::unique_ptr& camInfo) + : mFramesAllowed(0), mFramesInUse(0), mStreamState(STOPPED), mCameraInfo(camInfo) { + LOG(DEBUG) << __FUNCTION__; + + /* set a camera id */ + mDescription.id = id; + + /* set camera metadata */ + if (camInfo) { + uint8_t* ptr = reinterpret_cast(camInfo->characteristics); + const size_t len = get_camera_metadata_size(camInfo->characteristics); + mDescription.metadata.insert(mDescription.metadata.end(), ptr, ptr + len); + } +} + +EvsMockCamera::~EvsMockCamera() { + LOG(DEBUG) << __FUNCTION__; + shutdown(); +} + +// This gets called if another caller "steals" ownership of the camera +void EvsMockCamera::shutdown() { + LOG(DEBUG) << __FUNCTION__; + + // Make sure our output stream is cleaned up + // (It really should be already) + stopVideoStream_impl(); + + // Claim the lock while we work on internal state + std::lock_guard lock(mAccessLock); + + // Drop all the graphics buffers we've been using + if (mBuffers.size() > 0) { + ::android::GraphicBufferAllocator& alloc(::android::GraphicBufferAllocator::get()); + for (auto&& rec : mBuffers) { + if (rec.inUse) { + LOG(WARNING) << "WARNING: releasing a buffer remotely owned."; + } + alloc.free(rec.handle); + rec.handle = nullptr; + } + mBuffers.clear(); + } + + // Put this object into an unrecoverable error state since somebody else + // is going to own the underlying camera now + mStreamState = DEAD; +} + +// Methods from ::aidl::android::hardware::automotive::evs::IEvsCamera follow. +ScopedAStatus EvsMockCamera::getCameraInfo(CameraDesc* _aidl_return) { + LOG(DEBUG) << __FUNCTION__; + + // Send back our self description + *_aidl_return = mDescription; + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::setMaxFramesInFlight(int32_t bufferCount) { + LOG(DEBUG) << __FUNCTION__ << ", bufferCount = " << bufferCount; + ; + + std::lock_guard lock(mAccessLock); + + // If we've been displaced by another owner of the camera, then we can't do anything else + if (mStreamState == DEAD) { + LOG(ERROR) << "Ignoring setMaxFramesInFlight call when camera has been lost."; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); + } + + // We cannot function without at least one video buffer to send data + if (bufferCount < 1) { + LOG(ERROR) << "Ignoring setMaxFramesInFlight with less than one buffer requested."; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); + } + + // Update our internal state + if (!setAvailableFrames_Locked(bufferCount)) { + LOG(ERROR) << "Failed to adjust the maximum number of frames in flight."; + return ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::BUFFER_NOT_AVAILABLE)); + } + + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::startVideoStream(const std::shared_ptr& cb) { + LOG(DEBUG) << __FUNCTION__; + + if (!cb) { + LOG(ERROR) << "A given stream callback is invalid."; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); + } + + std::lock_guard lock(mAccessLock); + + // If we've been displaced by another owner of the camera, then we can't do anything else + if (mStreamState == DEAD) { + LOG(ERROR) << "Ignoring startVideoStream call when camera has been lost."; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); + } + + if (mStreamState != STOPPED) { + LOG(ERROR) << "Ignoring startVideoStream call when a stream is already running."; + return ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::STREAM_ALREADY_RUNNING)); + } + + // If the client never indicated otherwise, configure ourselves for a single streaming buffer + if (mFramesAllowed < kMinimumBuffersInFlight && + !setAvailableFrames_Locked(kMinimumBuffersInFlight)) { + LOG(ERROR) << "Failed to start stream because we couldn't get a graphics buffer"; + return ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::BUFFER_NOT_AVAILABLE)); + } + + // Record the user's callback for use when we have a frame ready + mStream = cb; + + // Start the frame generation thread + mStreamState = RUNNING; + mCaptureThread = std::thread([this]() { generateFrames(); }); + + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::doneWithFrame(const std::vector& list) { + std::lock_guard lock(mAccessLock); + for (const auto& desc : list) { + returnBufferLocked(desc.bufferId); + } + + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::stopVideoStream() { + LOG(DEBUG) << __FUNCTION__; + return stopVideoStream_impl(); +} + +ScopedAStatus EvsMockCamera::stopVideoStream_impl() { + std::unique_lock lock(mAccessLock); + + if (mStreamState != RUNNING) { + // Safely return here because a stream is not running. + return ScopedAStatus::ok(); + } + + // Tell the GenerateFrames loop we want it to stop + mStreamState = STOPPING; + + // Block outside the mutex until the "stop" flag has been acknowledged + // We won't send any more frames, but the client might still get some already in flight + LOG(DEBUG) << "Waiting for stream thread to end..."; + lock.unlock(); + if (mCaptureThread.joinable()) { + mCaptureThread.join(); + } + lock.lock(); + + mStreamState = STOPPED; + mStream = nullptr; + LOG(DEBUG) << "Stream marked STOPPED."; + + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::getExtendedInfo(int32_t opaqueIdentifier, + std::vector* opaqueValue) { + const auto it = mExtInfo.find(opaqueIdentifier); + if (it == mExtInfo.end()) { + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); + } else { + *opaqueValue = mExtInfo[opaqueIdentifier]; + } + + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::setExtendedInfo(int32_t opaqueIdentifier, + const std::vector& opaqueValue) { + mExtInfo.insert_or_assign(opaqueIdentifier, opaqueValue); + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::getPhysicalCameraInfo([[maybe_unused]] const std::string& id, + CameraDesc* _aidl_return) { + LOG(DEBUG) << __FUNCTION__; + + // This method works exactly same as getCameraInfo() in EVS HW module. + *_aidl_return = mDescription; + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::pauseVideoStream() { + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); +} + +ScopedAStatus EvsMockCamera::resumeVideoStream() { + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); +} + +ScopedAStatus EvsMockCamera::setPrimaryClient() { + /* Because EVS HW module reference implementation expects a single client at + * a time, this returns a success code always. + */ + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::forcePrimaryClient(const std::shared_ptr&) { + /* Because EVS HW module reference implementation expects a single client at + * a time, this returns a success code always. + */ + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::unsetPrimaryClient() { + /* Because EVS HW module reference implementation expects a single client at + * a time, there is no chance that this is called by the secondary client and + * therefore returns a success code always. + */ + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::getParameterList(std::vector* _aidl_return) { + if (mCameraInfo) { + _aidl_return->resize(mCameraInfo->controls.size()); + auto idx = 0; + for (auto& [name, range] : mCameraInfo->controls) { + (*_aidl_return)[idx++] = name; + } + } + + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::getIntParameterRange([[maybe_unused]] CameraParam id, + [[maybe_unused]] ParameterRange* _aidl_return) { + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); +} + +ScopedAStatus EvsMockCamera::setIntParameter( + [[maybe_unused]] CameraParam id, [[maybe_unused]] int32_t value, + [[maybe_unused]] std::vector* effectiveValue) { + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); +} + +ScopedAStatus EvsMockCamera::getIntParameter([[maybe_unused]] CameraParam id, + [[maybe_unused]] std::vector* value) { + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); +} + +ScopedAStatus EvsMockCamera::importExternalBuffers( + [[maybe_unused]] const std::vector& buffers, + [[maybe_unused]] int32_t* _aidl_return) { + LOG(DEBUG) << "This implementation does not support an external buffer import."; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); +} + +bool EvsMockCamera::setAvailableFrames_Locked(unsigned bufferCount) { + if (bufferCount < 1) { + LOG(ERROR) << "Ignoring request to set buffer count to zero"; + return false; + } + if (bufferCount > kMaxBuffersInFlight) { + LOG(ERROR) << "Rejecting buffer request in excess of internal limit"; + return false; + } + + // Is an increase required? + if (mFramesAllowed < bufferCount) { + // An increase is required + auto needed = bufferCount - mFramesAllowed; + LOG(INFO) << "Allocating " << needed << " buffers for camera frames"; + + auto added = increaseAvailableFrames_Locked(needed); + if (added != needed) { + // If we didn't add all the frames we needed, then roll back to the previous state + LOG(ERROR) << "Rolling back to previous frame queue size"; + decreaseAvailableFrames_Locked(added); + return false; + } + } else if (mFramesAllowed > bufferCount) { + // A decrease is required + auto framesToRelease = mFramesAllowed - bufferCount; + LOG(INFO) << "Returning " << framesToRelease << " camera frame buffers"; + + auto released = decreaseAvailableFrames_Locked(framesToRelease); + if (released != framesToRelease) { + // This shouldn't happen with a properly behaving client because the client + // should only make this call after returning sufficient outstanding buffers + // to allow a clean resize. + LOG(ERROR) << "Buffer queue shrink failed -- too many buffers currently in use?"; + } + } + + return true; +} + +unsigned EvsMockCamera::increaseAvailableFrames_Locked(unsigned numToAdd) { + // Acquire the graphics buffer allocator + ::android::GraphicBufferAllocator& alloc(::android::GraphicBufferAllocator::get()); + + unsigned added = 0; + while (added < numToAdd) { + unsigned pixelsPerLine = 0; + buffer_handle_t memHandle = nullptr; + auto result = alloc.allocate(mWidth, mHeight, mFormat, 1, mUsage, &memHandle, + &pixelsPerLine, 0, "EvsMockCamera"); + if (result != ::android::NO_ERROR) { + LOG(ERROR) << "Error " << result << " allocating " << mWidth << " x " << mHeight + << " graphics buffer"; + break; + } + if (memHandle == nullptr) { + LOG(ERROR) << "We didn't get a buffer handle back from the allocator"; + break; + } + if (mStride > 0) { + if (mStride != pixelsPerLine) { + LOG(ERROR) << "We did not expect to get buffers with different strides!"; + } + } else { + // Gralloc defines stride in terms of pixels per line + mStride = pixelsPerLine; + } + + // Find a place to store the new buffer + auto stored = false; + for (auto&& rec : mBuffers) { + if (rec.handle == nullptr) { + // Use this existing entry + rec.handle = memHandle; + rec.inUse = false; + stored = true; + break; + } + } + if (!stored) { + // Add a BufferRecord wrapping this handle to our set of available buffers + mBuffers.push_back(BufferRecord(memHandle)); + } + + ++mFramesAllowed; + ++added; + } + + return added; +} + +unsigned EvsMockCamera::decreaseAvailableFrames_Locked(unsigned numToRemove) { + // Acquire the graphics buffer allocator + ::android::GraphicBufferAllocator& alloc(::android::GraphicBufferAllocator::get()); + + unsigned removed = 0; + for (auto&& rec : mBuffers) { + // Is this record not in use, but holding a buffer that we can free? + if ((rec.inUse == false) && (rec.handle != nullptr)) { + // Release buffer and update the record so we can recognize it as "empty" + alloc.free(rec.handle); + rec.handle = nullptr; + + --mFramesAllowed; + ++removed; + + if (removed == numToRemove) { + break; + } + } + } + + return removed; +} + +// This is the asynchronous frame generation thread that runs in parallel with the +// main serving thread. There is one for each active camera instance. +void EvsMockCamera::generateFrames() { + LOG(DEBUG) << "Frame generation loop started."; + + unsigned idx = 0; + while (true) { + bool timeForFrame = false; + const nsecs_t startTime = systemTime(SYSTEM_TIME_MONOTONIC); + + // Lock scope for updating shared state + { + std::lock_guard lock(mAccessLock); + + if (mStreamState != RUNNING) { + // Break out of our main thread loop + break; + } + + // Are we allowed to issue another buffer? + if (mFramesInUse >= mFramesAllowed) { + // Can't do anything right now -- skip this frame + LOG(WARNING) << "Skipped a frame because too many are in flight."; + } else { + // Identify an available buffer to fill + for (idx = 0; idx < mBuffers.size(); idx++) { + if (!mBuffers[idx].inUse) { + if (mBuffers[idx].handle != nullptr) { + // Found an available record, so stop looking + break; + } + } + } + if (idx >= mBuffers.size()) { + // This shouldn't happen since we already checked mFramesInUse vs mFramesAllowed + ALOGE("Failed to find an available buffer slot\n"); + } else { + // We're going to make the frame busy + mBuffers[idx].inUse = true; + mFramesInUse++; + timeForFrame = true; + } + } + } + + if (timeForFrame) { + using AidlPixelFormat = ::aidl::android::hardware::graphics::common::PixelFormat; + + // Assemble the buffer description we'll transmit below + buffer_handle_t memHandle = mBuffers[idx].handle; + BufferDesc newBuffer = { + .buffer = + { + .description = + { + .width = static_cast(mWidth), + .height = static_cast(mHeight), + .layers = 1, + .format = static_cast(mFormat), + .usage = static_cast(mUsage), + .stride = static_cast(mStride), + }, + .handle = ::android::dupToAidl(memHandle), + }, + .bufferId = static_cast(idx), + .deviceId = mDescription.id, + .timestamp = static_cast(::android::elapsedRealtimeNano() * + 1e+3), // timestamps is in microseconds + }; + + // Write test data into the image buffer + fillMockFrame(memHandle, reinterpret_cast( + &newBuffer.buffer.description)); + + // Issue the (asynchronous) callback to the client -- can't be holding the lock + auto flag = false; + if (mStream) { + std::vector frames; + frames.push_back(std::move(newBuffer)); + flag = mStream->deliverFrame(frames).isOk(); + } + + if (flag) { + LOG(DEBUG) << "Delivered " << memHandle << ", id = " << mBuffers[idx].handle; + } else { + // This can happen if the client dies and is likely unrecoverable. + // To avoid consuming resources generating failing calls, we stop sending + // frames. Note, however, that the stream remains in the "STREAMING" state + // until cleaned up on the main thread. + LOG(ERROR) << "Frame delivery call failed in the transport layer."; + + // Since we didn't actually deliver it, mark the frame as available + std::lock_guard lock(mAccessLock); + mBuffers[idx].inUse = false; + mFramesInUse--; + } + } + + // We arbitrarily choose to generate frames at 15 fps to ensure we pass the 10fps test + // requirement + static const int kTargetFrameRate = 15; + static const nsecs_t kTargetFrameIntervalUs = 1000 * 1000 / kTargetFrameRate; + const nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); + const nsecs_t elapsedTimeUs = (now - startTime) / 1000; + const nsecs_t sleepDurationUs = kTargetFrameIntervalUs - elapsedTimeUs; + if (sleepDurationUs > 0) { + usleep(sleepDurationUs); + } + } + + // If we've been asked to stop, send an event to signal the actual end of stream + EvsEventDesc event = { + .aType = EvsEventType::STREAM_STOPPED, + }; + if (!mStream->notify(event).isOk()) { + ALOGE("Error delivering end of stream marker"); + } + + return; +} + +void EvsMockCamera::fillMockFrame(buffer_handle_t handle, const AHardwareBuffer_Desc* pDesc) { + // Lock our output buffer for writing + uint32_t* pixels = nullptr; + ::android::GraphicBufferMapper& mapper = ::android::GraphicBufferMapper::get(); + mapper.lock(handle, GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_NEVER, + ::android::Rect(pDesc->width, pDesc->height), (void**)&pixels); + + // If we failed to lock the pixel buffer, we're about to crash, but log it first + if (!pixels) { + ALOGE("Camera failed to gain access to image buffer for writing"); + return; + } + + // Fill in the test pixels; the colorbar in ABGR format + for (unsigned row = 0; row < pDesc->height; row++) { + for (unsigned col = 0; col < pDesc->width; col++) { + const uint32_t index = col * kNumColors / pDesc->width; + pixels[col] = kColors[index]; + } + // Point to the next row + // NOTE: stride retrieved from gralloc is in units of pixels + pixels = pixels + pDesc->stride; + } + + // Release our output buffer + mapper.unlock(handle); +} + +void EvsMockCamera::returnBufferLocked(const uint32_t bufferId) { + if (bufferId >= mBuffers.size()) { + ALOGE("ignoring doneWithFrame called with invalid bufferId %d (max is %zu)", bufferId, + mBuffers.size() - 1); + return; + } + + if (!mBuffers[bufferId].inUse) { + ALOGE("ignoring doneWithFrame called on frame %d which is already free", bufferId); + return; + } + + // Mark the frame as available + mBuffers[bufferId].inUse = false; + mFramesInUse--; + + // If this frame's index is high in the array, try to move it down + // to improve locality after mFramesAllowed has been reduced. + if (bufferId >= mFramesAllowed) { + // Find an empty slot lower in the array (which should always exist in this case) + for (auto&& rec : mBuffers) { + if (rec.handle == nullptr) { + rec.handle = mBuffers[bufferId].handle; + mBuffers[bufferId].handle = nullptr; + break; + } + } + } +} + +std::shared_ptr EvsMockCamera::Create(const char* deviceName) { + std::unique_ptr nullCamInfo = nullptr; + + return Create(deviceName, nullCamInfo); +} + +std::shared_ptr EvsMockCamera::Create( + const char* deviceName, std::unique_ptr& camInfo, + [[maybe_unused]] const Stream* streamCfg) { + std::shared_ptr c = + ndk::SharedRefBase::make(Sigil{}, deviceName, camInfo); + if (!c) { + LOG(ERROR) << "Failed to instantiate EvsMockCamera."; + return nullptr; + } + + // Use the first resolution from the list for the testing + // TODO(b/214835237): Uses a given Stream configuration to choose the best + // stream configuration. + auto it = camInfo->streamConfigurations.begin(); + c->mWidth = it->second.width; + c->mHeight = it->second.height; + c->mDescription.vendorFlags = 0xFFFFFFFF; // Arbitrary test value + + c->mFormat = HAL_PIXEL_FORMAT_RGBA_8888; + c->mUsage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_CAMERA_WRITE | + GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_RARELY; + + return c; +} + +} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/src/GlWrapper.cpp b/automotive/evs/aidl/impl/default/src/GlWrapper.cpp new file mode 100644 index 0000000000..0ee5ecb734 --- /dev/null +++ b/automotive/evs/aidl/impl/default/src/GlWrapper.cpp @@ -0,0 +1,465 @@ +/* + * 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. + */ + +#include "GlWrapper.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +namespace { + +using ::aidl::android::frameworks::automotive::display::DisplayDesc; +using ::aidl::android::frameworks::automotive::display::ICarDisplayProxy; +using ::aidl::android::frameworks::automotive::display::Rotation; +using ::aidl::android::hardware::common::NativeHandle; +using ::aidl::android::hardware::graphics::common::HardwareBufferDescription; +using ::android::GraphicBuffer; +using ::android::sp; + +constexpr const char vertexShaderSource[] = + "attribute vec4 pos; \n" + "attribute vec2 tex; \n" + "varying vec2 uv; \n" + "void main() \n" + "{ \n" + " gl_Position = pos; \n" + " uv = tex; \n" + "} \n"; + +constexpr const char pixelShaderSource[] = + "precision mediump float; \n" + "uniform sampler2D tex; \n" + "varying vec2 uv; \n" + "void main() \n" + "{ \n" + " gl_FragColor = texture2D(tex, uv);\n" + "} \n"; + +const char* getEGLError(void) { + switch (eglGetError()) { + case EGL_SUCCESS: + return "EGL_SUCCESS"; + case EGL_NOT_INITIALIZED: + return "EGL_NOT_INITIALIZED"; + case EGL_BAD_ACCESS: + return "EGL_BAD_ACCESS"; + case EGL_BAD_ALLOC: + return "EGL_BAD_ALLOC"; + case EGL_BAD_ATTRIBUTE: + return "EGL_BAD_ATTRIBUTE"; + case EGL_BAD_CONTEXT: + return "EGL_BAD_CONTEXT"; + case EGL_BAD_CONFIG: + return "EGL_BAD_CONFIG"; + case EGL_BAD_CURRENT_SURFACE: + return "EGL_BAD_CURRENT_SURFACE"; + case EGL_BAD_DISPLAY: + return "EGL_BAD_DISPLAY"; + case EGL_BAD_SURFACE: + return "EGL_BAD_SURFACE"; + case EGL_BAD_MATCH: + return "EGL_BAD_MATCH"; + case EGL_BAD_PARAMETER: + return "EGL_BAD_PARAMETER"; + case EGL_BAD_NATIVE_PIXMAP: + return "EGL_BAD_NATIVE_PIXMAP"; + case EGL_BAD_NATIVE_WINDOW: + return "EGL_BAD_NATIVE_WINDOW"; + case EGL_CONTEXT_LOST: + return "EGL_CONTEXT_LOST"; + default: + return "Unknown error"; + } +} + +// Given shader source, load and compile it +GLuint loadShader(GLenum type, const char* shaderSrc) { + // Create the shader object + GLuint shader = glCreateShader(type); + if (shader == 0) { + return 0; + } + + // Load and compile the shader + glShaderSource(shader, 1, &shaderSrc, nullptr); + glCompileShader(shader); + + // Verify the compilation worked as expected + GLint compiled = 0; + glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled); + if (!compiled) { + LOG(ERROR) << "Error compiling shader"; + + GLint size = 0; + glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &size); + if (size > 0) { + // Get and report the error message + char* infoLog = (char*)malloc(size); + glGetShaderInfoLog(shader, size, nullptr, infoLog); + LOG(ERROR) << " msg:" << std::endl << infoLog; + free(infoLog); + } + + glDeleteShader(shader); + return 0; + } + + return shader; +} + +// Create a program object given vertex and pixels shader source +GLuint buildShaderProgram(const char* vtxSrc, const char* pxlSrc) { + GLuint program = glCreateProgram(); + if (program == 0) { + LOG(ERROR) << "Failed to allocate program object"; + return 0; + } + + // Compile the shaders and bind them to this program + GLuint vertexShader = loadShader(GL_VERTEX_SHADER, vtxSrc); + if (vertexShader == 0) { + LOG(ERROR) << "Failed to load vertex shader"; + glDeleteProgram(program); + return 0; + } + GLuint pixelShader = loadShader(GL_FRAGMENT_SHADER, pxlSrc); + if (pixelShader == 0) { + LOG(ERROR) << "Failed to load pixel shader"; + glDeleteProgram(program); + glDeleteShader(vertexShader); + return 0; + } + glAttachShader(program, vertexShader); + glAttachShader(program, pixelShader); + + glBindAttribLocation(program, 0, "pos"); + glBindAttribLocation(program, 1, "tex"); + + // Link the program + glLinkProgram(program); + GLint linked = 0; + glGetProgramiv(program, GL_LINK_STATUS, &linked); + if (!linked) { + LOG(ERROR) << "Error linking program"; + GLint size = 0; + glGetProgramiv(program, GL_INFO_LOG_LENGTH, &size); + if (size > 0) { + // Get and report the error message + char* infoLog = (char*)malloc(size); + glGetProgramInfoLog(program, size, nullptr, infoLog); + LOG(ERROR) << " msg: " << infoLog; + free(infoLog); + } + + glDeleteProgram(program); + glDeleteShader(vertexShader); + glDeleteShader(pixelShader); + return 0; + } + + return program; +} + +::android::sp convertNativeHandleToHGBP(const NativeHandle& aidlHandle) { + native_handle_t* handle = ::android::dupFromAidl(aidlHandle); + if (handle->numFds != 0 || handle->numInts < std::ceil(sizeof(size_t) / sizeof(int))) { + LOG(ERROR) << "Invalid native handle"; + return nullptr; + } + ::android::hardware::hidl_vec halToken; + halToken.setToExternal(reinterpret_cast(const_cast(&(handle->data[1]))), + handle->data[0]); + ::android::sp hgbp = + HGraphicBufferProducer::castFrom(::android::retrieveHalInterface(halToken)); + return std::move(hgbp); +} + +} // namespace + +namespace aidl::android::hardware::automotive::evs::implementation { + +// Main entry point +bool GlWrapper::initialize(const std::shared_ptr& pWindowProxy, + uint64_t displayId) { + LOG(DEBUG) << __FUNCTION__; + + if (!pWindowProxy) { + LOG(ERROR) << "Could not get ICarDisplayProxy."; + return false; + } + + DisplayDesc displayDesc; + auto status = pWindowProxy->getDisplayInfo(displayId, &displayDesc); + if (!status.isOk()) { + LOG(ERROR) << "Failed to read the display information"; + return false; + } + + mWidth = displayDesc.width; + mHeight = displayDesc.height; + if ((displayDesc.orientation != Rotation::ROTATION_0) && + (displayDesc.orientation != Rotation::ROTATION_180)) { + std::swap(mWidth, mHeight); + } + LOG(INFO) << "Display resolution is " << mWidth << "x" << mHeight; + + NativeHandle aidlHandle; + status = pWindowProxy->getHGraphicBufferProducer(displayId, &aidlHandle); + if (!status.isOk()) { + LOG(ERROR) << "Failed to get IGraphicBufferProducer from ICarDisplayProxy."; + return false; + } + + mGfxBufferProducer = convertNativeHandleToHGBP(aidlHandle); + if (!mGfxBufferProducer) { + LOG(ERROR) << "Failed to convert a NativeHandle to HGBP."; + return false; + } + + mSurfaceHolder = getSurfaceFromHGBP(mGfxBufferProducer); + if (mSurfaceHolder == nullptr) { + LOG(ERROR) << "Failed to get a Surface from HGBP."; + return false; + } + + mWindow = getNativeWindow(mSurfaceHolder.get()); + if (mWindow == nullptr) { + LOG(ERROR) << "Failed to get a native window from Surface."; + return false; + } + + // Set up our OpenGL ES context associated with the default display + mDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); + if (mDisplay == EGL_NO_DISPLAY) { + LOG(ERROR) << "Failed to get egl display"; + return false; + } + + EGLint major = 2; + EGLint minor = 0; + if (!eglInitialize(mDisplay, &major, &minor)) { + LOG(ERROR) << "Failed to initialize EGL: " << getEGLError(); + return false; + } + + const EGLint config_attribs[] = { + // clang-format off + // Tag Value + EGL_RED_SIZE, 8, + EGL_GREEN_SIZE, 8, + EGL_BLUE_SIZE, 8, + EGL_DEPTH_SIZE, 0, + EGL_NONE + // clang-format on + }; + + // Pick the default configuration without constraints (is this good enough?) + EGLConfig egl_config = {0}; + EGLint numConfigs = -1; + eglChooseConfig(mDisplay, config_attribs, &egl_config, 1, &numConfigs); + if (numConfigs != 1) { + LOG(ERROR) << "Didn't find a suitable format for our display window, " << getEGLError(); + return false; + } + + // Create the EGL render target surface + mSurface = eglCreateWindowSurface(mDisplay, egl_config, mWindow, nullptr); + if (mSurface == EGL_NO_SURFACE) { + LOG(ERROR) << "eglCreateWindowSurface failed, " << getEGLError(); + return false; + } + + // Create the EGL context + // NOTE: Our shader is (currently at least) written to require version 3, so this + // is required. + const EGLint context_attribs[] = {EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE}; + mContext = eglCreateContext(mDisplay, egl_config, EGL_NO_CONTEXT, context_attribs); + if (mContext == EGL_NO_CONTEXT) { + LOG(ERROR) << "Failed to create OpenGL ES Context: " << getEGLError(); + return false; + } + + // Activate our render target for drawing + if (!eglMakeCurrent(mDisplay, mSurface, mSurface, mContext)) { + LOG(ERROR) << "Failed to make the OpenGL ES Context current: " << getEGLError(); + return false; + } + + // Create the shader program for our simple pipeline + mShaderProgram = buildShaderProgram(vertexShaderSource, pixelShaderSource); + if (!mShaderProgram) { + LOG(ERROR) << "Failed to build shader program: " << getEGLError(); + return false; + } + + // Create a GL texture that will eventually wrap our externally created texture surface(s) + glGenTextures(1, &mTextureMap); + if (mTextureMap <= 0) { + LOG(ERROR) << "Didn't get a texture handle allocated: " << getEGLError(); + return false; + } + + // Turn off mip-mapping for the created texture surface + // (the inbound camera imagery doesn't have MIPs) + glBindTexture(GL_TEXTURE_2D, mTextureMap); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glBindTexture(GL_TEXTURE_2D, 0); + + return true; +} + +void GlWrapper::shutdown() { + // Drop our device textures + if (mKHRimage != EGL_NO_IMAGE_KHR) { + eglDestroyImageKHR(mDisplay, mKHRimage); + mKHRimage = EGL_NO_IMAGE_KHR; + } + + // Release all GL resources + if (eglGetCurrentContext() == mContext) { + eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + } + eglDestroySurface(mDisplay, mSurface); + eglDestroyContext(mDisplay, mContext); + eglTerminate(mDisplay); + mSurface = EGL_NO_SURFACE; + mContext = EGL_NO_CONTEXT; + mDisplay = EGL_NO_DISPLAY; + + // Release the window + mSurfaceHolder = nullptr; +} + +void GlWrapper::showWindow(const std::shared_ptr& pWindowProxy, uint64_t id) { + if (pWindowProxy) { + pWindowProxy->showWindow(id); + } else { + LOG(ERROR) << "ICarDisplayProxy is not available."; + } +} + +void GlWrapper::hideWindow(const std::shared_ptr& pWindowProxy, uint64_t id) { + if (pWindowProxy) { + pWindowProxy->hideWindow(id); + } else { + LOG(ERROR) << "ICarDisplayProxy is not available."; + } +} + +bool GlWrapper::updateImageTexture(buffer_handle_t handle, + const HardwareBufferDescription& description) { + if (mKHRimage != EGL_NO_IMAGE_KHR) { + return true; + } + + // Create a temporary GraphicBuffer to wrap the provided handle. + sp pGfxBuffer = + new GraphicBuffer(description.width, description.height, + static_cast<::android::PixelFormat>(description.format), + description.layers, static_cast(description.usage), + description.stride, const_cast(handle), + /* keepOwnership= */ false); + if (!pGfxBuffer) { + LOG(ERROR) << "Failed to allocate GraphicBuffer to wrap our native handle"; + return false; + } + + // Get a GL compatible reference to the graphics buffer we've been given + EGLint eglImageAttributes[] = {EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE}; + EGLClientBuffer cbuf = static_cast(pGfxBuffer->getNativeBuffer()); + mKHRimage = eglCreateImageKHR(mDisplay, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID, cbuf, + eglImageAttributes); + if (mKHRimage == EGL_NO_IMAGE_KHR) { + LOG(ERROR) << "Error creating EGLImage: " << getEGLError(); + return false; + } + + // Update the texture handle we already created to refer to this gralloc buffer + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, mTextureMap); + glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, static_cast(mKHRimage)); + + return true; +} + +void GlWrapper::renderImageToScreen() { + // Set the viewport + glViewport(0, 0, mWidth, mHeight); + + // Clear the color buffer + glClearColor(0.1f, 0.5f, 0.1f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT); + + // Select our screen space simple texture shader + glUseProgram(mShaderProgram); + + // Bind the texture and assign it to the shader's sampler + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, mTextureMap); + GLint sampler = glGetUniformLocation(mShaderProgram, "tex"); + glUniform1i(sampler, 0); + + // We want our image to show up opaque regardless of alpha values + glDisable(GL_BLEND); + + // Draw a rectangle on the screen + GLfloat vertsCarPos[] = { + // clang-format off + -0.8, 0.8, 0.0f, // left top in window space + 0.8, 0.8, 0.0f, // right top + -0.8, -0.8, 0.0f, // left bottom + 0.8, -0.8, 0.0f // right bottom + // clang-format on + }; + + // NOTE: We didn't flip the image in the texture, so V=0 is actually the top of the image + GLfloat vertsCarTex[] = { + // clang-format off + 0.0f, 0.0f, // left top + 1.0f, 0.0f, // right top + 0.0f, 1.0f, // left bottom + 1.0f, 1.0f // right bottom + // clang-format on + }; + glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, vertsCarPos); + glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, vertsCarTex); + glEnableVertexAttribArray(0); + glEnableVertexAttribArray(1); + + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + + // Clean up and flip the rendered result to the front so it is visible + glDisableVertexAttribArray(0); + glDisableVertexAttribArray(1); + + glFinish(); + + if (eglSwapBuffers(mDisplay, mSurface) == EGL_FALSE) { + LOG(WARNING) << "Failed to swap EGL buffers, " << getEGLError(); + } +} + +} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/src/service.cpp b/automotive/evs/aidl/impl/default/src/service.cpp index 0a0913fd3c..7532d8735f 100644 --- a/automotive/evs/aidl/impl/default/src/service.cpp +++ b/automotive/evs/aidl/impl/default/src/service.cpp @@ -14,38 +14,75 @@ * limitations under the License. */ -#define LOG_TAG "EvsService" - -#include +#include "EvsEnumerator.h" +#include "EvsGlDisplay.h" #include #include #include -using ::aidl::android::hardware::automotive::evs::implementation::DefaultEvsEnumerator; +#include -int main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) { - std::shared_ptr vhal = ndk::SharedRefBase::make(); +#include +#include +#include - ALOGI("Registering as service..."); - binder_exception_t err = - AServiceManager_addService(vhal->asBinder().get(), "android.hardware.automotive.evs"); +namespace { + +using ::aidl::android::frameworks::automotive::display::ICarDisplayProxy; +using ::aidl::android::hardware::automotive::evs::implementation::EvsEnumerator; + +constexpr std::string_view kDisplayServiceInstanceName = "/default"; +constexpr std::string_view kHwInstanceName = "/hw/0"; +constexpr int kNumBinderThreads = 1; + +} // namespace + +int main() { + LOG(INFO) << "EVS Hardware Enumerator service is starting"; + + const std::string displayServiceInstanceName = + std::string(ICarDisplayProxy::descriptor) + std::string(kDisplayServiceInstanceName); + if (!AServiceManager_isDeclared(displayServiceInstanceName.data())) { + // TODO: We may just want to disable EVS display. + LOG(ERROR) << displayServiceInstanceName << " is required."; + return EXIT_FAILURE; + } + + std::shared_ptr displayService = ICarDisplayProxy::fromBinder( + ::ndk::SpAIBinder(AServiceManager_waitForService(displayServiceInstanceName.data()))); + if (!displayService) { + LOG(ERROR) << "Cannot use " << displayServiceInstanceName << ". Exiting."; + return EXIT_FAILURE; + } + + // Register our service -- if somebody is already registered by our name, + // they will be killed (their thread pool will throw an exception). + std::shared_ptr service = + ndk::SharedRefBase::make(displayService); + if (!service) { + LOG(ERROR) << "Failed to instantiate the service"; + return EXIT_FAILURE; + } + + const std::string instanceName = + std::string(EvsEnumerator::descriptor) + std::string(kHwInstanceName); + auto err = AServiceManager_addService(service->asBinder().get(), instanceName.data()); if (err != EX_NONE) { - ALOGE("failed to register android.hardware.automotive.evs service, exception: %d", err); - return 1; + LOG(ERROR) << "Failed to register " << instanceName << ", exception = " << err; + return EXIT_FAILURE; } - if (!ABinderProcess_setThreadPoolMaxThreadCount(1)) { - ALOGE("%s", "failed to set thread pool max thread count"); - return 1; + if (!ABinderProcess_setThreadPoolMaxThreadCount(kNumBinderThreads)) { + LOG(ERROR) << "Failed to set thread pool"; + return EXIT_FAILURE; } + ABinderProcess_startThreadPool(); - - ALOGI("Evs Service Ready"); + LOG(INFO) << "EVS Hardware Enumerator is ready"; ABinderProcess_joinThreadPool(); - - ALOGI("Evs Service Exiting"); - - return 0; + // In normal operation, we don't expect the thread pool to exit + LOG(INFO) << "EVS Hardware Enumerator is shutting down"; + return EXIT_SUCCESS; } From aaf13e76a380ac351ae8855f9e38b0ba8519391a Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 29 Jul 2022 22:22:31 +0000 Subject: [PATCH 818/998] Remove automotive.evs HIDL entry in compat matrix. This interface has been converted to AIDL. Bug: 218588089 Test: m -j Change-Id: I64fcff3f18074ac7ff67e9b8e6e79671e24e438e --- compatibility_matrices/compatibility_matrix.8.xml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.8.xml b/compatibility_matrices/compatibility_matrix.8.xml index d4fca6a85e..8f16e06a84 100644 --- a/compatibility_matrices/compatibility_matrix.8.xml +++ b/compatibility_matrices/compatibility_matrix.8.xml @@ -84,15 +84,6 @@ [a-z]+/[0-9]+ - - android.hardware.automotive.evs - 1.0-1 - - IEvsEnumerator - default - [a-z]+/[0-9]+ - - android.hardware.automotive.occupant_awareness 1 From c6b69e7ada81014468525a2857abc184dec6537f Mon Sep 17 00:00:00 2001 From: Zhanghao Date: Sat, 11 Mar 2023 01:54:11 +0000 Subject: [PATCH 819/998] Update cuttlefish mock gnssMeasurement value Update pseudorangeRateUncertaintyMps value to pass GnssMeasurementValuesTest. Bug: 264786442 Test: atest GnssMeasurementValuesTest Change-Id: I125e5db42a39573d123c3f9f16be59b957c0fbda --- gnss/common/utils/default/Utils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gnss/common/utils/default/Utils.cpp b/gnss/common/utils/default/Utils.cpp index 2aed29bb5a..8303d93e54 100644 --- a/gnss/common/utils/default/Utils.cpp +++ b/gnss/common/utils/default/Utils.cpp @@ -102,7 +102,7 @@ GnssDataV2_0 Utils::getMockMeasurementV2_0() { .receivedSvTimeUncertaintyInNs = 15, .cN0DbHz = 30.0, .pseudorangeRateMps = -484.13739013671875, - .pseudorangeRateUncertaintyMps = 1.0379999876022339, + .pseudorangeRateUncertaintyMps = 0.1037999987602233, .accumulatedDeltaRangeState = (uint32_t)V1_0::IGnssMeasurementCallback:: GnssAccumulatedDeltaRangeState::ADR_STATE_UNKNOWN, .accumulatedDeltaRangeM = 0.0, @@ -169,7 +169,7 @@ GnssData Utils::getMockMeasurement(const bool enableCorrVecOutputs, const bool e .basebandCN0DbHz = 26.5, .agcLevelDb = 2.3, .pseudorangeRateMps = -484.13739013671875, - .pseudorangeRateUncertaintyMps = 1.0379999876022339, + .pseudorangeRateUncertaintyMps = 0.1037999987602233, .accumulatedDeltaRangeState = GnssMeasurement::ADR_STATE_VALID, .accumulatedDeltaRangeM = 1.52, .accumulatedDeltaRangeUncertaintyM = 2.43, From 321f961b89ed6c4aec6697d6d5e3f36155587167 Mon Sep 17 00:00:00 2001 From: Tyler Trephan Date: Mon, 13 Mar 2023 17:54:40 +0000 Subject: [PATCH 820/998] Updated emulator model year to 2023. Test: None Fix: 273299574 Change-Id: I6680954b16ace598e6753034d7e2d6a3ff0fc2f8 --- .../aidl/impl/default_config/config/DefaultProperties.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 5d15f32866..9991248a6a 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -80,7 +80,7 @@ "property": "VehicleProperty::INFO_MODEL_YEAR", "defaultValue": { "int32Values": [ - 2020 + 2023 ] } }, From 9ed325bfffbac128073c3e265ab79ff084ae15f8 Mon Sep 17 00:00:00 2001 From: Kevin Han Date: Mon, 13 Mar 2023 21:18:28 +0000 Subject: [PATCH 821/998] Revert "Remove automotive.evs HIDL entry in compat matrix." Revert submission 21585493-b218588089 Reason for revert: b/273324345 Reverted changes: /q/submissionid:21585493-b218588089 Change-Id: I2173c457c47ae4603908f3192e0d4878d60d9159 --- compatibility_matrices/compatibility_matrix.8.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/compatibility_matrices/compatibility_matrix.8.xml b/compatibility_matrices/compatibility_matrix.8.xml index 8f16e06a84..d4fca6a85e 100644 --- a/compatibility_matrices/compatibility_matrix.8.xml +++ b/compatibility_matrices/compatibility_matrix.8.xml @@ -84,6 +84,15 @@ [a-z]+/[0-9]+ + + android.hardware.automotive.evs + 1.0-1 + + IEvsEnumerator + default + [a-z]+/[0-9]+ + + android.hardware.automotive.occupant_awareness 1 From d12e05929a18baf5f89b7d85e5c59483d1a793d0 Mon Sep 17 00:00:00 2001 From: Kevin Han Date: Mon, 13 Mar 2023 21:18:28 +0000 Subject: [PATCH 822/998] Revert "Add default implementation of AIDL EVS interface" Revert submission 21585493-b218588089 Reason for revert: b/273324345 Reverted changes: /q/submissionid:21585493-b218588089 Change-Id: I2826a16105f8e7b03f852f9babffb03d78d53fd0 --- automotive/evs/aidl/impl/default/Android.bp | 49 +- .../aidl/impl/default/evs-default-service.rc | 7 +- .../aidl/impl/default/evs-default-service.xml | 11 + .../aidl/impl/default/include/ConfigManager.h | 384 ------- .../impl/default/include/ConfigManagerUtil.h | 62 -- .../default/include/DefaultEvsEnumerator.h | 66 ++ .../aidl/impl/default/include/EvsEnumerator.h | 134 --- .../aidl/impl/default/include/EvsGlDisplay.h | 89 -- .../aidl/impl/default/include/EvsMockCamera.h | 152 --- .../evs/aidl/impl/default/include/GlWrapper.h | 79 -- .../default/manifest_evs-default-service.xml | 6 - .../resources/evs_mock_configuration.xml | 68 -- .../aidl/impl/default/src/ConfigManager.cpp | 992 ------------------ .../impl/default/src/ConfigManagerUtil.cpp | 155 --- .../impl/default/src/DefaultEvsEnumerator.cpp | 93 ++ .../aidl/impl/default/src/EvsEnumerator.cpp | 552 ---------- .../aidl/impl/default/src/EvsGlDisplay.cpp | 417 -------- .../aidl/impl/default/src/EvsMockCamera.cpp | 642 ------------ .../evs/aidl/impl/default/src/GlWrapper.cpp | 465 -------- .../evs/aidl/impl/default/src/service.cpp | 77 +- 20 files changed, 195 insertions(+), 4305 deletions(-) create mode 100644 automotive/evs/aidl/impl/default/evs-default-service.xml delete mode 100644 automotive/evs/aidl/impl/default/include/ConfigManager.h delete mode 100644 automotive/evs/aidl/impl/default/include/ConfigManagerUtil.h create mode 100644 automotive/evs/aidl/impl/default/include/DefaultEvsEnumerator.h delete mode 100644 automotive/evs/aidl/impl/default/include/EvsEnumerator.h delete mode 100644 automotive/evs/aidl/impl/default/include/EvsGlDisplay.h delete mode 100644 automotive/evs/aidl/impl/default/include/EvsMockCamera.h delete mode 100644 automotive/evs/aidl/impl/default/include/GlWrapper.h delete mode 100644 automotive/evs/aidl/impl/default/manifest_evs-default-service.xml delete mode 100644 automotive/evs/aidl/impl/default/resources/evs_mock_configuration.xml delete mode 100644 automotive/evs/aidl/impl/default/src/ConfigManager.cpp delete mode 100644 automotive/evs/aidl/impl/default/src/ConfigManagerUtil.cpp create mode 100644 automotive/evs/aidl/impl/default/src/DefaultEvsEnumerator.cpp delete mode 100644 automotive/evs/aidl/impl/default/src/EvsEnumerator.cpp delete mode 100644 automotive/evs/aidl/impl/default/src/EvsGlDisplay.cpp delete mode 100644 automotive/evs/aidl/impl/default/src/EvsMockCamera.cpp delete mode 100644 automotive/evs/aidl/impl/default/src/GlWrapper.cpp diff --git a/automotive/evs/aidl/impl/default/Android.bp b/automotive/evs/aidl/impl/default/Android.bp index bf6c0be236..dbe0314118 100644 --- a/automotive/evs/aidl/impl/default/Android.bp +++ b/automotive/evs/aidl/impl/default/Android.bp @@ -24,56 +24,13 @@ package { cc_binary { name: "android.hardware.automotive.evs-aidl-default-service", defaults: ["EvsHalDefaults"], - vintf_fragments: ["manifest_evs-default-service.xml"], + local_include_dirs: ["include"], + vintf_fragments: ["evs-default-service.xml"], init_rc: ["evs-default-service.rc"], vendor: true, relative_install_path: "hw", - cflags: [ - "-DGL_GLEXT_PROTOTYPES", - "-DEGL_EGLEXT_PROTOTYPES", - "-Wall", - "-Wextra", - "-Werror", - "-Wthread-safety", - ], - srcs: [ - ":libgui_frame_event_aidl", - "src/*.cpp" - ], + srcs: ["src/*.cpp"], shared_libs: [ - "android.hardware.graphics.bufferqueue@1.0", - "android.hardware.graphics.bufferqueue@2.0", - "android.hidl.token@1.0-utils", - "libEGL", - "libGLESv2", - "libbase", "libbinder_ndk", - "libbufferqueueconverter", - "libcamera_metadata", - "libhardware_legacy", - "libhidlbase", - "liblog", - "libnativewindow", - "libtinyxml2", - "libui", - "libutils", - "libyuv", ], - static_libs: [ - "android.frameworks.automotive.display-V1-ndk", - "android.hardware.automotive.evs-V1-ndk", - "android.hardware.common-V2-ndk", - "libaidlcommonsupport", - "libcutils", - ], - local_include_dirs: ["include"], - include_dirs: ["frameworks/native/include/"], - required: ["evs_mock_hal_configuration.xml"], -} - -prebuilt_etc { - name: "evs_mock_hal_configuration.xml", - soc_specific: true, - src: "resources/evs_mock_configuration.xml", - sub_dir: "automotive/evs", } diff --git a/automotive/evs/aidl/impl/default/evs-default-service.rc b/automotive/evs/aidl/impl/default/evs-default-service.rc index 3da41ff787..ea8e6892dc 100644 --- a/automotive/evs/aidl/impl/default/evs-default-service.rc +++ b/automotive/evs/aidl/impl/default/evs-default-service.rc @@ -1,8 +1,5 @@ service vendor.evs-hal-default /vendor/bin/hw/android.hardware.automotive.evs-aidl-default-service class early_hal - priority -20 - user graphics - group automotive_evs camera - onrestart restart cardisplayproxyd - onrestart restart evsmanagerd + user automotive_evs + group automotive_evs disabled diff --git a/automotive/evs/aidl/impl/default/evs-default-service.xml b/automotive/evs/aidl/impl/default/evs-default-service.xml new file mode 100644 index 0000000000..96ff9f6576 --- /dev/null +++ b/automotive/evs/aidl/impl/default/evs-default-service.xml @@ -0,0 +1,11 @@ + + + android.hardware.automotive.evs + hwbinder + 1 + + IEvsEnumerator + hw/0 + + + diff --git a/automotive/evs/aidl/impl/default/include/ConfigManager.h b/automotive/evs/aidl/impl/default/include/ConfigManager.h deleted file mode 100644 index 1d5fe772b2..0000000000 --- a/automotive/evs/aidl/impl/default/include/ConfigManager.h +++ /dev/null @@ -1,384 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include "ConfigManagerUtil.h" - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -/* - * Please note that this is different from what is defined in - * libhardware/modules/camera/3_4/metadata/types.h; this has one additional - * field to store a framerate. - */ -typedef struct { - int id; - int width; - int height; - ::aidl::android::hardware::graphics::common::PixelFormat format; - int type; - int framerate; -} StreamConfiguration; - -class ConfigManager final { - public: - static std::unique_ptr Create(); - ConfigManager(const ConfigManager&) = delete; - ConfigManager& operator=(const ConfigManager&) = delete; - - /* Camera device's capabilities and metadata */ - class CameraInfo { - public: - CameraInfo() : characteristics(nullptr) {} - - virtual ~CameraInfo(); - - /* Allocate memory for camera_metadata_t */ - bool allocate(size_t entry_cap, size_t data_cap) { - if (characteristics != nullptr) { - LOG(ERROR) << "Camera metadata is already allocated"; - return false; - } - - characteristics = allocate_camera_metadata(entry_cap, data_cap); - return characteristics != nullptr; - } - - /* - * List of supported controls that the primary client can program. - * Paraemters are stored with its valid range - */ - std::unordered_map<::aidl::android::hardware::automotive::evs::CameraParam, - std::tuple> - controls; - - /* - * List of supported output stream configurations. - */ - std::unordered_map streamConfigurations; - - /* - * Internal storage for camera metadata. Each entry holds a pointer to - * data and number of elements - */ - std::unordered_map> cameraMetadata; - - /* Camera module characteristics */ - camera_metadata_t* characteristics; - }; - - class CameraGroupInfo : public CameraInfo { - public: - CameraGroupInfo() {} - - /* ID of member camera devices */ - std::unordered_set devices; - - /* The capture operation of member camera devices are synchronized */ - int32_t synchronized = 0; - }; - - class SystemInfo { - public: - /* number of available cameras */ - int32_t numCameras = 0; - }; - - class DisplayInfo { - public: - /* - * List of supported input stream configurations. - */ - std::unordered_map streamConfigurations; - }; - - /* - * Return system information - * - * @return SystemInfo - * Constant reference of SystemInfo. - */ - const SystemInfo& getSystemInfo() { - std::unique_lock lock(mConfigLock); - mConfigCond.wait(lock, [this] { return mIsReady; }); - return mSystemInfo; - } - - /* - * Return a list of camera identifiers - * - * This function assumes that it is not being called frequently. - * - * @return std::vector - * A vector that contains unique camera device identifiers. - */ - std::vector getCameraIdList() { - std::unique_lock lock(mConfigLock); - mConfigCond.wait(lock, [this] { return mIsReady; }); - - std::vector aList; - aList.reserve(mCameraInfo.size()); - for (auto&& v : mCameraInfo) { - aList.push_back(v.first); - } - - return aList; - } - - /* - * Return a list of camera group identifiers - * - * This function assumes that it is not being called frequently. - * - * @return std::vector - * A vector that contains unique camera device identifiers. - */ - std::vector getCameraGroupIdList() { - std::unique_lock lock(mConfigLock); - mConfigCond.wait(lock, [this] { return mIsReady; }); - - std::vector aList; - aList.reserve(mCameraGroups.size()); - for (auto&& v : mCameraGroups) { - aList.push_back(v.first); - } - - return aList; - } - - /* - * Return a pointer to the camera group - * - * @return CameraGroup - * A pointer to a camera group identified by a given id. - */ - std::unique_ptr& getCameraGroupInfo(const std::string& gid) { - std::unique_lock lock(mConfigLock); - mConfigCond.wait(lock, [this] { return mIsReady; }); - - return mCameraGroups[gid]; - } - - /* - * Return a camera metadata - * - * @param cameraId - * Unique camera node identifier in string - * - * @return unique_ptr - * A pointer to CameraInfo that is associated with a given camera - * ID. This returns a null pointer if this does not recognize a - * given camera identifier. - */ - std::unique_ptr& getCameraInfo(const std::string& cameraId) noexcept { - std::unique_lock lock(mConfigLock); - mConfigCond.wait(lock, [this] { return mIsReady; }); - - return mCameraInfo[cameraId]; - } - - /* - * Tell whether the configuration data is ready to be used - * - * @return bool - * True if configuration data is ready to be consumed. - */ - bool isReady() const { return mIsReady; } - - private: - /* Constructors */ - ConfigManager() : mBinaryFilePath("") {} - - static std::string_view sConfigDefaultPath; - static std::string_view sConfigOverridePath; - - /* System configuration */ - SystemInfo mSystemInfo; - - /* Internal data structure for camera device information */ - std::unordered_map> mCameraInfo; - - /* Internal data structure for camera device information */ - std::unordered_map> mDisplayInfo; - - /* Camera groups are stored in hash map */ - std::unordered_map> mCameraGroups; - - /* - * Camera positions are stored in hash map. - * The position must be one of front, rear, left, and right. - */ - std::unordered_map> mCameraPosition; - - /* Configuration data lock */ - mutable std::mutex mConfigLock; - - /* - * This condition is signalled when it completes a configuration data - * preparation. - */ - std::condition_variable mConfigCond; - - /* A path to a binary configuration file */ - const char* mBinaryFilePath; - - /* Configuration data readiness */ - bool mIsReady = false; - - /* - * Parse a given EVS configuration file and store the information - * internally. - * - * @return bool - * True if it completes parsing a file successfully. - */ - bool readConfigDataFromXML() noexcept; - - /* - * read the information of the vehicle - * - * @param aSysElem - * A pointer to "system" XML element. - */ - void readSystemInfo(const tinyxml2::XMLElement* const aSysElem); - - /* - * read the information of camera devices - * - * @param aCameraElem - * A pointer to "camera" XML element that may contain multiple - * "device" elements. - */ - void readCameraInfo(const tinyxml2::XMLElement* const aCameraElem); - - /* - * read display device information - * - * @param aDisplayElem - * A pointer to "display" XML element that may contain multiple - * "device" elements. - */ - void readDisplayInfo(const tinyxml2::XMLElement* const aDisplayElem); - - /* - * read camera device information - * - * @param aCamera - * A pointer to CameraInfo that will be completed by this - * method. - * aDeviceElem - * A pointer to "device" XML element that contains camera module - * capability info and its characteristics. - * - * @return bool - * Return false upon any failure in reading and processing camera - * device information. - */ - bool readCameraDeviceInfo(CameraInfo* aCamera, const tinyxml2::XMLElement* aDeviceElem); - - /* - * read camera metadata - * - * @param aCapElem - * A pointer to "cap" XML element. - * @param aCamera - * A pointer to CameraInfo that is being filled by this method. - * @param dataSize - * Required size of memory to store camera metadata found in this - * method. This is calculated in this method and returned to the - * caller for camera_metadata allocation. - * - * @return size_t - * Number of camera metadata entries - */ - size_t readCameraCapabilities(const tinyxml2::XMLElement* const aCapElem, CameraInfo* aCamera, - size_t& dataSize); - - /* - * read camera metadata - * - * @param aParamElem - * A pointer to "characteristics" XML element. - * @param aCamera - * A pointer to CameraInfo that is being filled by this method. - * @param dataSize - * Required size of memory to store camera metadata found in this - * method. - * - * @return size_t - * Number of camera metadata entries - */ - size_t readCameraMetadata(const tinyxml2::XMLElement* const aParamElem, CameraInfo* aCamera, - size_t& dataSize); - - /* - * construct camera_metadata_t from camera capabilities and metadata - * - * @param aCamera - * A pointer to CameraInfo that is being filled by this method. - * @param totalEntries - * Number of camera metadata entries to be added. - * @param totalDataSize - * Sum of sizes of camera metadata entries to be added. - * - * @return bool - * False if either it fails to allocate memory for camera metadata - * or its size is not large enough to add all found camera metadata - * entries. - */ - bool constructCameraMetadata(CameraInfo* aCamera, const size_t totalEntries, - const size_t totalDataSize); - - /* - * Read configuration data from the binary file - * - * @return bool - * True if it succeeds to read configuration data from a binary - * file. - */ - bool readConfigDataFromBinary(); - - /* - * Store configuration data to the file - * - * @return bool - * True if it succeeds to serialize mCameraInfo to the file. - */ - bool writeConfigDataToBinary(); - - /* - * debugging method to print out all XML elements and their attributes in - * logcat message. - * - * @param aNode - * A pointer to the root XML element to navigate. - * @param prefix - * A prefix to XML string. - */ - void printElementNames(const tinyxml2::XMLElement* aNode, const std::string& prefix = "") const; -}; diff --git a/automotive/evs/aidl/impl/default/include/ConfigManagerUtil.h b/automotive/evs/aidl/impl/default/include/ConfigManagerUtil.h deleted file mode 100644 index 32b50d3332..0000000000 --- a/automotive/evs/aidl/impl/default/include/ConfigManagerUtil.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include -#include -#include -#include - -#include -#include - -class ConfigManagerUtil final { - public: - /** - * Convert a given string into V4L2_CID_* - */ - static bool convertToEvsCameraParam( - const std::string& id, - ::aidl::android::hardware::automotive::evs::CameraParam& camParam); - /** - * Convert a given string into android.hardware.graphics.common.PixelFormat - */ - static bool convertToPixelFormat(const std::string& in, - ::aidl::android::hardware::graphics::common::PixelFormat& out); - /** - * Convert a given string into corresponding camera metadata data tag defined in - * system/media/camera/include/system/camera_metadata_tags.h - */ - static bool convertToMetadataTag(const char* name, camera_metadata_tag& aTag); - /** - * Convert a given string into a floating value array - */ - static float* convertFloatArray(const char* sz, const char* vals, size_t& count, - const char delimiter = ','); - /** - * Trim a string - */ - static std::string trimString(const std::string& src, const std::string& ws = " \n\r\t\f\v"); - - /** - * Convert a given string to corresponding camera capabilities - */ - static bool convertToCameraCapability( - const char* name, camera_metadata_enum_android_request_available_capabilities_t& cap); - - DISALLOW_IMPLICIT_CONSTRUCTORS(ConfigManagerUtil); -}; diff --git a/automotive/evs/aidl/impl/default/include/DefaultEvsEnumerator.h b/automotive/evs/aidl/impl/default/include/DefaultEvsEnumerator.h new file mode 100644 index 0000000000..03a578d954 --- /dev/null +++ b/automotive/evs/aidl/impl/default/include/DefaultEvsEnumerator.h @@ -0,0 +1,66 @@ +/* + * 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. + */ + +#ifndef android_hardware_automotive_evs_aidl_impl_evshal_include_DefaultEvsHal_H_ +#define android_hardware_automotive_evs_aidl_impl_evshal_include_DefaultEvsHal_H_ + +#include + +namespace aidl::android::hardware::automotive::evs::implementation { + +class DefaultEvsEnumerator final + : public ::aidl::android::hardware::automotive::evs::BnEvsEnumerator { + ::ndk::ScopedAStatus isHardware(bool* flag) override; + ::ndk::ScopedAStatus openCamera( + const std::string& cameraId, + const ::aidl::android::hardware::automotive::evs::Stream& streamConfig, + std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsCamera>* obj) override; + ::ndk::ScopedAStatus closeCamera( + const std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsCamera>& obj) + override; + ::ndk::ScopedAStatus getCameraList( + std::vector<::aidl::android::hardware::automotive::evs::CameraDesc>* list) override; + ::ndk::ScopedAStatus getStreamList( + const ::aidl::android::hardware::automotive::evs::CameraDesc& desc, + std::vector<::aidl::android::hardware::automotive::evs::Stream>* _aidl_return) override; + ::ndk::ScopedAStatus openDisplay( + int32_t displayId, + std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsDisplay>* obj) override; + ::ndk::ScopedAStatus closeDisplay( + const std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsDisplay>& obj) + override; + ::ndk::ScopedAStatus getDisplayIdList(std::vector* list) override; + ::ndk::ScopedAStatus getDisplayState( + ::aidl::android::hardware::automotive::evs::DisplayState* state) override; + ::ndk::ScopedAStatus registerStatusCallback( + const std::shared_ptr< + ::aidl::android::hardware::automotive::evs::IEvsEnumeratorStatusCallback>& + callback) override; + ::ndk::ScopedAStatus openUltrasonicsArray( + const std::string& id, + std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsUltrasonicsArray>* obj) + override; + ::ndk::ScopedAStatus closeUltrasonicsArray( + const std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsUltrasonicsArray>& + arr) override; + ::ndk::ScopedAStatus getUltrasonicsArrayList( + std::vector<::aidl::android::hardware::automotive::evs::UltrasonicsArrayDesc>* list) + override; +}; + +} // namespace aidl::android::hardware::automotive::evs::implementation + +#endif // android_hardware_automotive_evs_aidl_impl_evshal_include_DefaultEvsHal_H_ diff --git a/automotive/evs/aidl/impl/default/include/EvsEnumerator.h b/automotive/evs/aidl/impl/default/include/EvsEnumerator.h deleted file mode 100644 index b11dd3ee80..0000000000 --- a/automotive/evs/aidl/impl/default/include/EvsEnumerator.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include "ConfigManager.h" -#include "EvsGlDisplay.h" -#include "EvsMockCamera.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -namespace aidl::android::hardware::automotive::evs::implementation { - -class EvsEnumerator final : public ::aidl::android::hardware::automotive::evs::BnEvsEnumerator { - public: - // Methods from ::aidl::android::hardware::automotive::evs::IEvsEnumerator - ndk::ScopedAStatus isHardware(bool* flag) override; - ndk::ScopedAStatus openCamera(const std::string& cameraId, const evs::Stream& streamConfig, - std::shared_ptr* obj) override; - ndk::ScopedAStatus closeCamera(const std::shared_ptr& obj) override; - ndk::ScopedAStatus getCameraList(std::vector* _aidl_return) override; - ndk::ScopedAStatus getStreamList(const evs::CameraDesc& desc, - std::vector* _aidl_return) override; - ndk::ScopedAStatus openDisplay(int32_t displayId, - std::shared_ptr* obj) override; - ndk::ScopedAStatus closeDisplay(const std::shared_ptr& obj) override; - ndk::ScopedAStatus getDisplayIdList(std::vector* list) override; - ndk::ScopedAStatus getDisplayState(evs::DisplayState* state) override; - ndk::ScopedAStatus registerStatusCallback( - const std::shared_ptr& callback) override; - ndk::ScopedAStatus openUltrasonicsArray( - const std::string& id, std::shared_ptr* obj) override; - ndk::ScopedAStatus closeUltrasonicsArray( - const std::shared_ptr& obj) override; - ndk::ScopedAStatus getUltrasonicsArrayList( - std::vector* list) override; - - // Implementation details - EvsEnumerator(const std::shared_ptr< - ::aidl::android::frameworks::automotive::display::ICarDisplayProxy>& - proxyService); - - void notifyDeviceStatusChange(const std::string_view& deviceName, evs::DeviceStatusType type); - - private: - struct CameraRecord { - evs::CameraDesc desc; - std::weak_ptr activeInstance; - - CameraRecord(const char* cameraId) : desc() { desc.id = cameraId; } - }; - - class ActiveDisplays { - public: - struct DisplayInfo { - int32_t id{-1}; - std::weak_ptr displayWeak; - uintptr_t internalDisplayRawAddr; - }; - - std::optional popDisplay(int32_t id); - - std::optional popDisplay(const std::shared_ptr& display); - - std::unordered_map getAllDisplays(); - - bool tryInsert(int32_t id, const std::shared_ptr& display); - - private: - std::mutex mMutex; - std::unordered_map mIdToDisplay GUARDED_BY(mMutex); - std::unordered_map mDisplayToId GUARDED_BY(mMutex); - }; - - bool checkPermission(); - void closeCamera_impl(const std::shared_ptr& pCamera, - const std::string& cameraId); - - static bool qualifyCaptureDevice(const char* deviceName); - static CameraRecord* findCameraById(const std::string& cameraId); - static void enumerateCameras(); - static bool addCaptureDevice(const std::string& deviceName); - static bool removeCaptureDevice(const std::string& deviceName); - // Enumerate available displays and return an id of the internal display - static uint64_t enumerateDisplays(); - - static ActiveDisplays& mutableActiveDisplays(); - - // NOTE: All members values are static so that all clients operate on the same state - // That is to say, this is effectively a singleton despite the fact that HIDL - // constructs a new instance for each client. - // Because our server has a single thread in the thread pool, these values are - // never accessed concurrently despite potentially having multiple instance objects - // using them. - static std::unordered_map sCameraList; - // Object destructs if client dies. - static std::mutex sLock; // Mutex on shared camera device list. - static std::condition_variable sCameraSignal; // Signal on camera device addition. - static std::unique_ptr sConfigManager; // ConfigManager - static std::shared_ptr<::aidl::android::frameworks::automotive::display::ICarDisplayProxy> - sDisplayProxy; - static std::unordered_map sDisplayPortList; - - uint64_t mInternalDisplayId; - std::shared_ptr mCallback; -}; - -} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/include/EvsGlDisplay.h b/automotive/evs/aidl/impl/default/include/EvsGlDisplay.h deleted file mode 100644 index ceabd9e863..0000000000 --- a/automotive/evs/aidl/impl/default/include/EvsGlDisplay.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include "GlWrapper.h" - -#include -#include -#include -#include -#include - -#include - -namespace aidl::android::hardware::automotive::evs::implementation { - -class EvsGlDisplay final : public BnEvsDisplay { - public: - // Methods from ::aidl::android::hardware::automotive::evs::IEvsDisplay - // follow. - ndk::ScopedAStatus getDisplayInfo(evs::DisplayDesc* _aidl_return) override; - ndk::ScopedAStatus getDisplayState(evs::DisplayState* _aidl_return) override; - ndk::ScopedAStatus getTargetBuffer(evs::BufferDesc* _aidl_return) override; - ndk::ScopedAStatus returnTargetBufferForDisplay(const evs::BufferDesc& buffer) override; - ndk::ScopedAStatus setDisplayState(evs::DisplayState state) override; - - // Implementation details - EvsGlDisplay(const std::shared_ptr& service, - uint64_t displayId); - virtual ~EvsGlDisplay() override; - - // This gets called if another caller "steals" ownership of the display - void forceShutdown(); - - private: - // A graphics buffer into which we'll store images. This member variable - // will be protected by semaphores. - struct BufferRecord { - ::aidl::android::hardware::graphics::common::HardwareBufferDescription description; - buffer_handle_t handle; - int fingerprint; - } mBuffer; - - // State of a rendering thread - enum RenderThreadStates { - STOPPED = 0, - STOPPING = 1, - RUN = 2, - }; - - uint64_t mDisplayId; - evs::DisplayDesc mInfo; - evs::DisplayState mRequestedState GUARDED_BY(mLock) = evs::DisplayState::NOT_VISIBLE; - std::shared_ptr mDisplayProxy; - - GlWrapper mGlWrapper; - mutable std::mutex mLock; - - // This tells us whether or not our buffer is in use. Protected by - // semaphores. - bool mBufferBusy = false; - - // Variables to synchronize a rendering thread w/ main and binder threads - std::thread mRenderThread; - RenderThreadStates mState GUARDED_BY(mLock) = STOPPED; - bool mBufferReady = false; - void renderFrames(); - bool initializeGlContextLocked() REQUIRES(mLock); - - std::condition_variable mBufferReadyToUse; - std::condition_variable mBufferReadyToRender; - std::condition_variable mBufferDone; -}; - -} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/include/EvsMockCamera.h b/automotive/evs/aidl/impl/default/include/EvsMockCamera.h deleted file mode 100644 index 46d47e77a2..0000000000 --- a/automotive/evs/aidl/impl/default/include/EvsMockCamera.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include "ConfigManager.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -// #include -#include -#include - -#include -#include - -namespace aidl::android::hardware::automotive::evs::implementation { - -class EvsMockCamera : public evs::BnEvsCamera { - // This prevents constructors from direct access while it allows this class to - // be instantiated via ndk::SharedRefBase::make<>. - private: - struct Sigil { - explicit Sigil() = default; - }; - - public: - // Methods from ::android::hardware::automotive::evs::IEvsCamera follow. - ndk::ScopedAStatus doneWithFrame(const std::vector& buffers) override; - ndk::ScopedAStatus forcePrimaryClient( - const std::shared_ptr& display) override; - ndk::ScopedAStatus getCameraInfo(evs::CameraDesc* _aidl_return) override; - ndk::ScopedAStatus getExtendedInfo(int32_t opaqueIdentifier, - std::vector* value) override; - ndk::ScopedAStatus getIntParameter(evs::CameraParam id, std::vector* value) override; - ndk::ScopedAStatus getIntParameterRange(evs::CameraParam id, - evs::ParameterRange* _aidl_return) override; - ndk::ScopedAStatus getParameterList(std::vector* _aidl_return) override; - ndk::ScopedAStatus getPhysicalCameraInfo(const std::string& deviceId, - evs::CameraDesc* _aidl_return) override; - ndk::ScopedAStatus importExternalBuffers(const std::vector& buffers, - int32_t* _aidl_return) override; - ndk::ScopedAStatus pauseVideoStream() override; - ndk::ScopedAStatus resumeVideoStream() override; - ndk::ScopedAStatus setExtendedInfo(int32_t opaqueIdentifier, - const std::vector& opaqueValue) override; - ndk::ScopedAStatus setIntParameter(evs::CameraParam id, int32_t value, - std::vector* effectiveValue) override; - ndk::ScopedAStatus setPrimaryClient() override; - ndk::ScopedAStatus setMaxFramesInFlight(int32_t bufferCount) override; - ndk::ScopedAStatus startVideoStream( - const std::shared_ptr& receiver) override; - ndk::ScopedAStatus stopVideoStream() override; - ndk::ScopedAStatus unsetPrimaryClient() override; - - static std::shared_ptr Create(const char* deviceName); - static std::shared_ptr Create( - const char* deviceName, std::unique_ptr& camInfo, - const evs::Stream* streamCfg = nullptr); - EvsMockCamera(const EvsMockCamera&) = delete; - EvsMockCamera& operator=(const EvsMockCamera&) = delete; - - virtual ~EvsMockCamera() override; - void shutdown(); - - const evs::CameraDesc& getDesc() { return mDescription; } - - // Constructors - EvsMockCamera(Sigil sigil, const char* deviceName, - std::unique_ptr& camInfo); - - private: - // These three functions are expected to be called while mAccessLock is held - bool setAvailableFrames_Locked(unsigned bufferCount); - unsigned increaseAvailableFrames_Locked(unsigned numToAdd); - unsigned decreaseAvailableFrames_Locked(unsigned numToRemove); - - void generateFrames(); - void fillMockFrame(buffer_handle_t handle, const AHardwareBuffer_Desc* pDesc); - void returnBufferLocked(const uint32_t bufferId); - ndk::ScopedAStatus stopVideoStream_impl(); - - CameraDesc mDescription = {}; // The properties of this camera - - std::thread mCaptureThread; // The thread we'll use to synthesize frames - - // The callback used to deliver each frame - std::shared_ptr mStream; - - // Horizontal pixel count in the buffers - uint32_t mWidth = 0; - // Vertical pixel count in the buffers - uint32_t mHeight = 0; - // Values from android_pixel_format_t - uint32_t mFormat = HAL_PIXEL_FORMAT_RGBA_8888; - // Values from from Gralloc.h - uint64_t mUsage = - GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_OFTEN; - // Bytes per line in the buffers - uint32_t mStride = 0; - - struct BufferRecord { - buffer_handle_t handle; - bool inUse; - - explicit BufferRecord(buffer_handle_t h) : handle(h), inUse(false){}; - }; - - std::vector mBuffers; // Graphics buffers to transfer images - unsigned mFramesAllowed; // How many buffers are we currently using - unsigned mFramesInUse; // How many buffers are currently outstanding - - enum StreamStateValues { - STOPPED, - RUNNING, - STOPPING, - DEAD, - }; - StreamStateValues mStreamState; - - // Synchronization necessary to deconflict mCaptureThread from the main service thread - std::mutex mAccessLock; - - // Static camera module information - std::unique_ptr& mCameraInfo; - - // For the extended info - std::unordered_map> mExtInfo; - std::unordered_map mParams; -}; - -} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/include/GlWrapper.h b/automotive/evs/aidl/impl/default/include/GlWrapper.h deleted file mode 100644 index adb250c8e1..0000000000 --- a/automotive/evs/aidl/impl/default/include/GlWrapper.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace aidl::android::hardware::automotive::evs::implementation { - -namespace automotivedisplay = ::aidl::android::frameworks::automotive::display; - -class GlWrapper { - public: - GlWrapper() : mSurfaceHolder(::android::SurfaceHolderUniquePtr(nullptr, nullptr)) {} - bool initialize(const std::shared_ptr& svc, - uint64_t displayId); - void shutdown(); - - bool updateImageTexture( - buffer_handle_t handle, - const ::aidl::android::hardware::graphics::common::HardwareBufferDescription& - description); - void renderImageToScreen(); - - void showWindow(const std::shared_ptr& svc, - uint64_t displayId); - void hideWindow(const std::shared_ptr& svc, - uint64_t displayId); - - unsigned getWidth() { return mWidth; }; - unsigned getHeight() { return mHeight; }; - - private: - ::android::sp<::android::hardware::graphics::bufferqueue::V2_0::IGraphicBufferProducer> - mGfxBufferProducer; - - EGLDisplay mDisplay; - EGLSurface mSurface; - EGLContext mContext; - - unsigned mWidth = 0; - unsigned mHeight = 0; - - EGLImageKHR mKHRimage = EGL_NO_IMAGE_KHR; - - GLuint mTextureMap = 0; - GLuint mShaderProgram = 0; - - // Opaque handle for a native hardware buffer defined in - // frameworks/native/opengl/include/EGL/eglplatform.h - ANativeWindow* mWindow; - - // Pointer to a Surface wrapper. - ::android::SurfaceHolderUniquePtr mSurfaceHolder; -}; - -} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/manifest_evs-default-service.xml b/automotive/evs/aidl/impl/default/manifest_evs-default-service.xml deleted file mode 100644 index 8480651e77..0000000000 --- a/automotive/evs/aidl/impl/default/manifest_evs-default-service.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - android.hardware.automotive.evs - IEvsEnumerator/hw/0 - - diff --git a/automotive/evs/aidl/impl/default/resources/evs_mock_configuration.xml b/automotive/evs/aidl/impl/default/resources/evs_mock_configuration.xml deleted file mode 100644 index 6cbc18eacf..0000000000 --- a/automotive/evs/aidl/impl/default/resources/evs_mock_configuration.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/automotive/evs/aidl/impl/default/src/ConfigManager.cpp b/automotive/evs/aidl/impl/default/src/ConfigManager.cpp deleted file mode 100644 index da791ed0b9..0000000000 --- a/automotive/evs/aidl/impl/default/src/ConfigManager.cpp +++ /dev/null @@ -1,992 +0,0 @@ -/* - * 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. - */ - -#include "ConfigManager.h" - -#include -#include -#include - -#include -#include -#include -#include - -namespace { - -using ::aidl::android::hardware::automotive::evs::CameraParam; -using ::aidl::android::hardware::graphics::common::PixelFormat; -using ::tinyxml2::XMLAttribute; -using ::tinyxml2::XMLDocument; -using ::tinyxml2::XMLElement; - -} // namespace - -std::string_view ConfigManager::sConfigDefaultPath = - "/vendor/etc/automotive/evs/evs_mock_hal_configuration.xml"; -std::string_view ConfigManager::sConfigOverridePath = - "/vendor/etc/automotive/evs/evs_configuration_override.xml"; - -void ConfigManager::printElementNames(const XMLElement* rootElem, const std::string& prefix) const { - const XMLElement* curElem = rootElem; - - while (curElem != nullptr) { - LOG(VERBOSE) << "[ELEM] " << prefix << curElem->Name(); - const XMLAttribute* curAttr = curElem->FirstAttribute(); - while (curAttr) { - LOG(VERBOSE) << "[ATTR] " << prefix << curAttr->Name() << ": " << curAttr->Value(); - curAttr = curAttr->Next(); - } - - /* recursively go down to descendants */ - printElementNames(curElem->FirstChildElement(), prefix + "\t"); - - curElem = curElem->NextSiblingElement(); - } -} - -void ConfigManager::readCameraInfo(const XMLElement* const aCameraElem) { - if (aCameraElem == nullptr) { - LOG(WARNING) << "XML file does not have required camera element"; - return; - } - - const XMLElement* curElem = aCameraElem->FirstChildElement(); - while (curElem != nullptr) { - if (!strcmp(curElem->Name(), "group")) { - /* camera group identifier */ - const char* id = curElem->FindAttribute("id")->Value(); - - /* create a camera group to be filled */ - CameraGroupInfo* aCamera = new CameraGroupInfo(); - - /* read camera device information */ - if (!readCameraDeviceInfo(aCamera, curElem)) { - LOG(WARNING) << "Failed to read a camera information of " << id; - delete aCamera; - continue; - } - - /* camera group synchronization */ - const char* sync = curElem->FindAttribute("synchronized")->Value(); - if (!strcmp(sync, "CALIBRATED")) { - aCamera->synchronized = ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED; - } else if (!strcmp(sync, "APPROXIMATE")) { - aCamera->synchronized = ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE; - } else { - aCamera->synchronized = 0; // Not synchronized - } - - /* add a group to hash map */ - mCameraGroups.insert_or_assign(id, std::unique_ptr(aCamera)); - } else if (!std::strcmp(curElem->Name(), "device")) { - /* camera unique identifier */ - const char* id = curElem->FindAttribute("id")->Value(); - - /* camera mount location */ - const char* pos = curElem->FindAttribute("position")->Value(); - - /* create a camera device to be filled */ - CameraInfo* aCamera = new CameraInfo(); - - /* read camera device information */ - if (!readCameraDeviceInfo(aCamera, curElem)) { - LOG(WARNING) << "Failed to read a camera information of " << id; - delete aCamera; - continue; - } - - /* store read camera module information */ - mCameraInfo.insert_or_assign(id, std::unique_ptr(aCamera)); - - /* assign a camera device to a position group */ - mCameraPosition[pos].insert(id); - } else { - /* ignore other device types */ - LOG(DEBUG) << "Unknown element " << curElem->Name() << " is ignored"; - } - - curElem = curElem->NextSiblingElement(); - } -} - -bool ConfigManager::readCameraDeviceInfo(CameraInfo* aCamera, const XMLElement* aDeviceElem) { - if (aCamera == nullptr || aDeviceElem == nullptr) { - return false; - } - - /* size information to allocate camera_metadata_t */ - size_t totalEntries = 0; - size_t totalDataSize = 0; - - /* read device capabilities */ - totalEntries += - readCameraCapabilities(aDeviceElem->FirstChildElement("caps"), aCamera, totalDataSize); - - /* read camera metadata */ - totalEntries += readCameraMetadata(aDeviceElem->FirstChildElement("characteristics"), aCamera, - totalDataSize); - - /* construct camera_metadata_t */ - if (!constructCameraMetadata(aCamera, totalEntries, totalDataSize)) { - LOG(WARNING) << "Either failed to allocate memory or " - << "allocated memory was not large enough"; - } - - return true; -} - -size_t ConfigManager::readCameraCapabilities(const XMLElement* const aCapElem, CameraInfo* aCamera, - size_t& dataSize) { - if (aCapElem == nullptr || aCamera == nullptr) { - return 0; - } - - std::string token; - const XMLElement* curElem = nullptr; - - /* a list of supported camera parameters/controls */ - curElem = aCapElem->FirstChildElement("supported_controls"); - if (curElem != nullptr) { - const XMLElement* ctrlElem = curElem->FirstChildElement("control"); - while (ctrlElem != nullptr) { - const char* nameAttr = ctrlElem->FindAttribute("name")->Value(); - int32_t minVal = INT32_MIN, maxVal = INT32_MAX; - if (!android::base::ParseInt(ctrlElem->FindAttribute("min")->Value(), &minVal)) { - LOG(WARNING) << "Failed to parse " << ctrlElem->FindAttribute("min")->Value(); - } - - if (!android::base::ParseInt(ctrlElem->FindAttribute("max")->Value(), &maxVal)) { - LOG(WARNING) << "Failed to parse " << ctrlElem->FindAttribute("max")->Value(); - } - - int32_t stepVal = 1; - const XMLAttribute* stepAttr = ctrlElem->FindAttribute("step"); - if (stepAttr != nullptr) { - if (!android::base::ParseInt(stepAttr->Value(), &stepVal)) { - LOG(WARNING) << "Failed to parse " << stepAttr->Value(); - } - } - - CameraParam aParam; - if (ConfigManagerUtil::convertToEvsCameraParam(nameAttr, aParam)) { - aCamera->controls.insert_or_assign( - aParam, std::move(std::make_tuple(minVal, maxVal, stepVal))); - } - - ctrlElem = ctrlElem->NextSiblingElement("control"); - } - } - - /* a list of camera stream configurations */ - curElem = aCapElem->FirstChildElement("stream"); - while (curElem != nullptr) { - /* read 5 attributes */ - const XMLAttribute* idAttr = curElem->FindAttribute("id"); - const XMLAttribute* widthAttr = curElem->FindAttribute("width"); - const XMLAttribute* heightAttr = curElem->FindAttribute("height"); - const XMLAttribute* fmtAttr = curElem->FindAttribute("format"); - const XMLAttribute* fpsAttr = curElem->FindAttribute("framerate"); - - int32_t id = -1; - int32_t framerate = 0; - if (!android::base::ParseInt(idAttr->Value(), &id)) { - LOG(WARNING) << "Failed to parse " << idAttr->Value(); - } - if (fpsAttr != nullptr) { - if (!android::base::ParseInt(fpsAttr->Value(), &framerate)) { - LOG(WARNING) << "Failed to parse " << fpsAttr->Value(); - } - } - - PixelFormat format = PixelFormat::UNSPECIFIED; - if (ConfigManagerUtil::convertToPixelFormat(fmtAttr->Value(), format)) { - StreamConfiguration cfg = { - .id = id, - .format = format, - .type = ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, - .framerate = framerate, - }; - - if (!android::base::ParseInt(widthAttr->Value(), &cfg.width) || - !android::base::ParseInt(heightAttr->Value(), &cfg.height)) { - LOG(WARNING) << "Failed to parse " << widthAttr->Value() << " and " - << heightAttr->Value(); - } - aCamera->streamConfigurations.insert_or_assign(id, cfg); - } - - curElem = curElem->NextSiblingElement("stream"); - } - - dataSize = calculate_camera_metadata_entry_data_size( - get_camera_metadata_tag_type(ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS), - aCamera->streamConfigurations.size() * sizeof(StreamConfiguration)); - - /* a single camera metadata entry contains multiple stream configurations */ - return dataSize > 0 ? 1 : 0; -} - -size_t ConfigManager::readCameraMetadata(const XMLElement* const aParamElem, CameraInfo* aCamera, - size_t& dataSize) { - if (aParamElem == nullptr || aCamera == nullptr) { - return 0; - } - - const XMLElement* curElem = aParamElem->FirstChildElement("parameter"); - size_t numEntries = 0; - camera_metadata_tag_t tag; - while (curElem != nullptr) { - if (ConfigManagerUtil::convertToMetadataTag(curElem->FindAttribute("name")->Value(), tag)) { - switch (tag) { - case ANDROID_LENS_DISTORTION: - case ANDROID_LENS_POSE_ROTATION: - case ANDROID_LENS_POSE_TRANSLATION: - case ANDROID_LENS_INTRINSIC_CALIBRATION: { - /* float[] */ - size_t count = 0; - void* data = ConfigManagerUtil::convertFloatArray( - curElem->FindAttribute("size")->Value(), - curElem->FindAttribute("value")->Value(), count); - - aCamera->cameraMetadata.insert_or_assign(tag, std::make_pair(data, count)); - - ++numEntries; - dataSize += calculate_camera_metadata_entry_data_size( - get_camera_metadata_tag_type(tag), count); - - break; - } - - case ANDROID_REQUEST_AVAILABLE_CAPABILITIES: { - camera_metadata_enum_android_request_available_capabilities_t* data = - new camera_metadata_enum_android_request_available_capabilities_t[1]; - if (ConfigManagerUtil::convertToCameraCapability( - curElem->FindAttribute("value")->Value(), *data)) { - aCamera->cameraMetadata.insert_or_assign(tag, - std::make_pair((void*)data, 1)); - - ++numEntries; - dataSize += calculate_camera_metadata_entry_data_size( - get_camera_metadata_tag_type(tag), 1); - } - break; - } - - case ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS: { - /* a comma-separated list of physical camera devices */ - size_t len = strlen(curElem->FindAttribute("value")->Value()); - char* data = new char[len + 1]; - memcpy(data, curElem->FindAttribute("value")->Value(), len * sizeof(char)); - - /* replace commas with null char */ - char* p = data; - while (*p != '\0') { - if (*p == ',') { - *p = '\0'; - } - ++p; - } - - aCamera->cameraMetadata.insert_or_assign(tag, - std::make_pair((void*)data, len + 1)); - - ++numEntries; - dataSize += calculate_camera_metadata_entry_data_size( - get_camera_metadata_tag_type(tag), len); - break; - } - - /* TODO(b/140416878): add vendor-defined/custom tag support */ - default: - LOG(WARNING) << "Parameter " << curElem->FindAttribute("name")->Value() - << " is not supported"; - break; - } - } else { - LOG(WARNING) << "Unsupported metadata tag " << curElem->FindAttribute("name")->Value() - << " is found."; - } - - curElem = curElem->NextSiblingElement("parameter"); - } - - return numEntries; -} - -bool ConfigManager::constructCameraMetadata(CameraInfo* aCamera, size_t totalEntries, - size_t totalDataSize) { - if (aCamera == nullptr || !aCamera->allocate(totalEntries, totalDataSize)) { - LOG(ERROR) << "Failed to allocate memory for camera metadata"; - return false; - } - - const size_t numStreamConfigs = aCamera->streamConfigurations.size(); - std::unique_ptr data(new int32_t[sizeof(StreamConfiguration) * numStreamConfigs]); - int32_t* ptr = data.get(); - for (auto& cfg : aCamera->streamConfigurations) { - memcpy(ptr, &cfg.second, sizeof(StreamConfiguration)); - ptr += sizeof(StreamConfiguration); - } - int32_t err = add_camera_metadata_entry( - aCamera->characteristics, ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, data.get(), - numStreamConfigs * sizeof(StreamConfiguration)); - - if (err) { - LOG(ERROR) << "Failed to add stream configurations to metadata, ignored"; - return false; - } - - bool success = true; - for (auto& [tag, entry] : aCamera->cameraMetadata) { - /* try to add new camera metadata entry */ - int32_t err = - add_camera_metadata_entry(aCamera->characteristics, tag, entry.first, entry.second); - if (err) { - LOG(ERROR) << "Failed to add an entry with a tag, " << std::hex << tag; - - /* may exceed preallocated capacity */ - LOG(ERROR) << "Camera metadata has " - << get_camera_metadata_entry_count(aCamera->characteristics) << " / " - << get_camera_metadata_entry_capacity(aCamera->characteristics) - << " entries and " - << get_camera_metadata_data_count(aCamera->characteristics) << " / " - << get_camera_metadata_data_capacity(aCamera->characteristics) - << " bytes are filled."; - LOG(ERROR) << "\tCurrent metadata entry requires " - << calculate_camera_metadata_entry_data_size(tag, entry.second) << " bytes."; - - success = false; - } - } - - LOG(VERBOSE) << "Camera metadata has " - << get_camera_metadata_entry_count(aCamera->characteristics) << " / " - << get_camera_metadata_entry_capacity(aCamera->characteristics) << " entries and " - << get_camera_metadata_data_count(aCamera->characteristics) << " / " - << get_camera_metadata_data_capacity(aCamera->characteristics) - << " bytes are filled."; - return success; -} - -void ConfigManager::readSystemInfo(const XMLElement* const aSysElem) { - if (aSysElem == nullptr) { - return; - } - - /* - * Please note that this function assumes that a given system XML element - * and its child elements follow DTD. If it does not, it will cause a - * segmentation fault due to the failure of finding expected attributes. - */ - - /* read number of cameras available in the system */ - const XMLElement* xmlElem = aSysElem->FirstChildElement("num_cameras"); - if (xmlElem != nullptr) { - if (!android::base::ParseInt(xmlElem->FindAttribute("value")->Value(), - &mSystemInfo.numCameras)) { - LOG(WARNING) << "Failed to parse " << xmlElem->FindAttribute("value")->Value(); - } - } -} - -void ConfigManager::readDisplayInfo(const XMLElement* const aDisplayElem) { - if (aDisplayElem == nullptr) { - LOG(WARNING) << "XML file does not have required camera element"; - return; - } - - const XMLElement* curDev = aDisplayElem->FirstChildElement("device"); - while (curDev != nullptr) { - const char* id = curDev->FindAttribute("id")->Value(); - std::unique_ptr dpy(new DisplayInfo()); - if (dpy == nullptr) { - LOG(ERROR) << "Failed to allocate memory for DisplayInfo"; - return; - } - - const XMLElement* cap = curDev->FirstChildElement("caps"); - if (cap != nullptr) { - const XMLElement* curStream = cap->FirstChildElement("stream"); - while (curStream != nullptr) { - /* read 4 attributes */ - const XMLAttribute* idAttr = curStream->FindAttribute("id"); - const XMLAttribute* widthAttr = curStream->FindAttribute("width"); - const XMLAttribute* heightAttr = curStream->FindAttribute("height"); - const XMLAttribute* fmtAttr = curStream->FindAttribute("format"); - - int32_t id = -1; - if (!android::base::ParseInt(idAttr->Value(), &id)) { - LOG(WARNING) << "Failed to parse " << idAttr->Value(); - } - PixelFormat format = PixelFormat::UNSPECIFIED; - if (ConfigManagerUtil::convertToPixelFormat(fmtAttr->Value(), format)) { - StreamConfiguration cfg = { - .id = id, - .format = format, - .type = ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT, - }; - if (!android::base::ParseInt(widthAttr->Value(), &cfg.width) || - !android::base::ParseInt(heightAttr->Value(), &cfg.height)) { - LOG(WARNING) << "Failed to parse " << widthAttr->Value() << " and " - << heightAttr->Value(); - } - dpy->streamConfigurations.insert_or_assign(id, cfg); - } - - curStream = curStream->NextSiblingElement("stream"); - } - } - - mDisplayInfo.insert_or_assign(id, std::move(dpy)); - curDev = curDev->NextSiblingElement("device"); - } - - return; -} - -bool ConfigManager::readConfigDataFromXML() noexcept { - XMLDocument xmlDoc; - - const int64_t parsingStart = android::elapsedRealtimeNano(); - - /* load and parse a configuration file */ - xmlDoc.LoadFile(sConfigOverridePath.data()); - if (xmlDoc.ErrorID() != tinyxml2::XML_SUCCESS) { - xmlDoc.LoadFile(sConfigDefaultPath.data()); - if (xmlDoc.ErrorID() != tinyxml2::XML_SUCCESS) { - LOG(ERROR) << "Failed to load and/or parse a configuration file, " << xmlDoc.ErrorStr(); - return false; - } - } - - /* retrieve the root element */ - const XMLElement* rootElem = xmlDoc.RootElement(); - if (std::strcmp(rootElem->Name(), "configuration") != 0) { - LOG(ERROR) << "A configuration file is not in the required format. " - << "See /etc/automotive/evs/evs_configuration.dtd"; - return false; - } - - std::unique_lock lock(mConfigLock); - - /* - * parse camera information; this needs to be done before reading system - * information - */ - readCameraInfo(rootElem->FirstChildElement("camera")); - - /* parse system information */ - readSystemInfo(rootElem->FirstChildElement("system")); - - /* parse display information */ - readDisplayInfo(rootElem->FirstChildElement("display")); - - /* configuration data is ready to be consumed */ - mIsReady = true; - - /* notify that configuration data is ready */ - lock.unlock(); - mConfigCond.notify_all(); - - const int64_t parsingEnd = android::elapsedRealtimeNano(); - LOG(INFO) << "Parsing configuration file takes " << std::scientific - << (double)(parsingEnd - parsingStart) / 1000000.0 << " ms."; - - return true; -} - -bool ConfigManager::readConfigDataFromBinary() { - /* Temporary buffer to hold configuration data read from a binary file */ - char mBuffer[1024]; - - std::fstream srcFile; - const int64_t readStart = android::elapsedRealtimeNano(); - - srcFile.open(mBinaryFilePath, std::fstream::in | std::fstream::binary); - if (!srcFile) { - LOG(ERROR) << "Failed to open a source binary file, " << mBinaryFilePath; - return false; - } - - std::unique_lock lock(mConfigLock); - mIsReady = false; - - /* read configuration data into the internal buffer */ - srcFile.read(mBuffer, sizeof(mBuffer)); - LOG(VERBOSE) << __FUNCTION__ << ": " << srcFile.gcount() << " bytes are read."; - char* p = mBuffer; - size_t sz = 0; - - /* read number of camera group information entries */ - const size_t ngrps = *(reinterpret_cast(p)); - p += sizeof(size_t); - - /* read each camera information entry */ - for (size_t cidx = 0; cidx < ngrps; ++cidx) { - /* read camera identifier */ - std::string cameraId = *(reinterpret_cast(p)); - p += sizeof(std::string); - - /* size of camera_metadata_t */ - const size_t num_entry = *(reinterpret_cast(p)); - p += sizeof(size_t); - const size_t num_data = *(reinterpret_cast(p)); - p += sizeof(size_t); - - /* create CameraInfo and add it to hash map */ - std::unique_ptr aCamera; - if (aCamera == nullptr || !aCamera->allocate(num_entry, num_data)) { - LOG(ERROR) << "Failed to create new CameraInfo object"; - mCameraInfo.clear(); - return false; - } - - /* controls */ - typedef struct { - CameraParam cid; - int32_t min; - int32_t max; - int32_t step; - } CameraCtrl; - sz = *(reinterpret_cast(p)); - p += sizeof(size_t); - CameraCtrl* ptr = reinterpret_cast(p); - for (size_t idx = 0; idx < sz; ++idx) { - CameraCtrl temp = *ptr++; - aCamera->controls.insert_or_assign( - temp.cid, std::move(std::make_tuple(temp.min, temp.max, temp.step))); - } - p = reinterpret_cast(ptr); - - /* stream configurations */ - sz = *(reinterpret_cast(p)); - p += sizeof(size_t); - int32_t* i32_ptr = reinterpret_cast(p); - for (size_t idx = 0; idx < sz; ++idx) { - const int32_t id = *i32_ptr++; - - StreamConfiguration temp; - memcpy(&temp, i32_ptr, sizeof(StreamConfiguration)); - i32_ptr += sizeof(StreamConfiguration); - aCamera->streamConfigurations.insert_or_assign(id, temp); - } - p = reinterpret_cast(i32_ptr); - - /* synchronization */ - aCamera->synchronized = *(reinterpret_cast(p)); - p += sizeof(int32_t); - - for (size_t idx = 0; idx < num_entry; ++idx) { - /* Read camera metadata entries */ - camera_metadata_tag_t tag = *reinterpret_cast(p); - p += sizeof(camera_metadata_tag_t); - const size_t count = *reinterpret_cast(p); - p += sizeof(size_t); - - const int32_t type = get_camera_metadata_tag_type(tag); - switch (type) { - case TYPE_BYTE: { - add_camera_metadata_entry(aCamera->characteristics, tag, p, count); - p += count * sizeof(uint8_t); - break; - } - case TYPE_INT32: { - add_camera_metadata_entry(aCamera->characteristics, tag, p, count); - p += count * sizeof(int32_t); - break; - } - case TYPE_FLOAT: { - add_camera_metadata_entry(aCamera->characteristics, tag, p, count); - p += count * sizeof(float); - break; - } - case TYPE_INT64: { - add_camera_metadata_entry(aCamera->characteristics, tag, p, count); - p += count * sizeof(int64_t); - break; - } - case TYPE_DOUBLE: { - add_camera_metadata_entry(aCamera->characteristics, tag, p, count); - p += count * sizeof(double); - break; - } - case TYPE_RATIONAL: - p += count * sizeof(camera_metadata_rational_t); - break; - default: - LOG(WARNING) << "Type " << type << " is unknown; " - << "data may be corrupted."; - break; - } - } - - mCameraInfo.insert_or_assign(cameraId, std::move(aCamera)); - } - - /* read number of camera information entries */ - const size_t ncams = *(reinterpret_cast(p)); - p += sizeof(size_t); - - /* read each camera information entry */ - for (size_t cidx = 0; cidx < ncams; ++cidx) { - /* read camera identifier */ - std::string cameraId = *(reinterpret_cast(p)); - p += sizeof(std::string); - - /* size of camera_metadata_t */ - const size_t num_entry = *(reinterpret_cast(p)); - p += sizeof(size_t); - const size_t num_data = *(reinterpret_cast(p)); - p += sizeof(size_t); - - /* create CameraInfo and add it to hash map */ - std::unique_ptr aCamera; - if (aCamera == nullptr || !aCamera->allocate(num_entry, num_data)) { - LOG(ERROR) << "Failed to create new CameraInfo object"; - mCameraInfo.clear(); - return false; - } - - /* controls */ - typedef struct { - CameraParam cid; - int32_t min; - int32_t max; - int32_t step; - } CameraCtrl; - sz = *(reinterpret_cast(p)); - p += sizeof(size_t); - CameraCtrl* ptr = reinterpret_cast(p); - for (size_t idx = 0; idx < sz; ++idx) { - CameraCtrl temp = *ptr++; - aCamera->controls.insert_or_assign( - temp.cid, std::move(std::make_tuple(temp.min, temp.max, temp.step))); - } - p = reinterpret_cast(ptr); - - /* stream configurations */ - sz = *(reinterpret_cast(p)); - p += sizeof(size_t); - int32_t* i32_ptr = reinterpret_cast(p); - for (size_t idx = 0; idx < sz; ++idx) { - const int32_t id = *i32_ptr++; - - StreamConfiguration temp; - memcpy(&temp, i32_ptr, sizeof(StreamConfiguration)); - i32_ptr += sizeof(StreamConfiguration); - aCamera->streamConfigurations.insert_or_assign(id, temp); - } - p = reinterpret_cast(i32_ptr); - - for (size_t idx = 0; idx < num_entry; ++idx) { - /* Read camera metadata entries */ - camera_metadata_tag_t tag = *reinterpret_cast(p); - p += sizeof(camera_metadata_tag_t); - const size_t count = *reinterpret_cast(p); - p += sizeof(size_t); - - const int32_t type = get_camera_metadata_tag_type(tag); - switch (type) { - case TYPE_BYTE: { - add_camera_metadata_entry(aCamera->characteristics, tag, p, count); - p += count * sizeof(uint8_t); - break; - } - case TYPE_INT32: { - add_camera_metadata_entry(aCamera->characteristics, tag, p, count); - p += count * sizeof(int32_t); - break; - } - case TYPE_FLOAT: { - add_camera_metadata_entry(aCamera->characteristics, tag, p, count); - p += count * sizeof(float); - break; - } - case TYPE_INT64: { - add_camera_metadata_entry(aCamera->characteristics, tag, p, count); - p += count * sizeof(int64_t); - break; - } - case TYPE_DOUBLE: { - add_camera_metadata_entry(aCamera->characteristics, tag, p, count); - p += count * sizeof(double); - break; - } - case TYPE_RATIONAL: - p += count * sizeof(camera_metadata_rational_t); - break; - default: - LOG(WARNING) << "Type " << type << " is unknown; " - << "data may be corrupted."; - break; - } - } - - mCameraInfo.insert_or_assign(cameraId, std::move(aCamera)); - } - - mIsReady = true; - - /* notify that configuration data is ready */ - lock.unlock(); - mConfigCond.notify_all(); - - int64_t readEnd = android::elapsedRealtimeNano(); - LOG(INFO) << __FUNCTION__ << " takes " << std::scientific - << (double)(readEnd - readStart) / 1000000.0 << " ms."; - - return true; -} - -bool ConfigManager::writeConfigDataToBinary() { - std::fstream outFile; - - const int64_t writeStart = android::elapsedRealtimeNano(); - - outFile.open(mBinaryFilePath, std::fstream::out | std::fstream::binary); - if (!outFile) { - LOG(ERROR) << "Failed to open a destination binary file, " << mBinaryFilePath; - return false; - } - - /* lock a configuration data while it's being written to the filesystem */ - std::lock_guard lock(mConfigLock); - - /* write camera group information */ - size_t sz = mCameraGroups.size(); - outFile.write(reinterpret_cast(&sz), sizeof(size_t)); - for (auto&& [camId, camInfo] : mCameraGroups) { - LOG(INFO) << "Storing camera group " << camId; - - /* write a camera identifier string */ - outFile.write(reinterpret_cast(&camId), sizeof(std::string)); - - /* controls */ - sz = camInfo->controls.size(); - outFile.write(reinterpret_cast(&sz), sizeof(size_t)); - for (auto&& [ctrl, range] : camInfo->controls) { - outFile.write(reinterpret_cast(&ctrl), sizeof(CameraParam)); - outFile.write(reinterpret_cast(&std::get<0>(range)), sizeof(int32_t)); - outFile.write(reinterpret_cast(&std::get<1>(range)), sizeof(int32_t)); - outFile.write(reinterpret_cast(&std::get<2>(range)), sizeof(int32_t)); - } - - /* stream configurations */ - sz = camInfo->streamConfigurations.size(); - outFile.write(reinterpret_cast(&sz), sizeof(size_t)); - for (auto&& [sid, cfg] : camInfo->streamConfigurations) { - outFile.write(reinterpret_cast(sid), sizeof(int32_t)); - outFile.write(reinterpret_cast(&cfg), sizeof(cfg)); - } - - /* synchronization */ - outFile.write(reinterpret_cast(&camInfo->synchronized), sizeof(int32_t)); - - /* size of camera_metadata_t */ - size_t num_entry = 0; - size_t num_data = 0; - if (camInfo->characteristics != nullptr) { - num_entry = get_camera_metadata_entry_count(camInfo->characteristics); - num_data = get_camera_metadata_data_count(camInfo->characteristics); - } - outFile.write(reinterpret_cast(&num_entry), sizeof(size_t)); - outFile.write(reinterpret_cast(&num_data), sizeof(size_t)); - - /* write each camera metadata entry */ - if (num_entry > 0) { - camera_metadata_entry_t entry; - for (size_t idx = 0; idx < num_entry; ++idx) { - if (get_camera_metadata_entry(camInfo->characteristics, idx, &entry)) { - LOG(ERROR) << "Failed to retrieve camera metadata entry " << idx; - outFile.close(); - return false; - } - - outFile.write(reinterpret_cast(&entry.tag), sizeof(entry.tag)); - outFile.write(reinterpret_cast(&entry.count), sizeof(entry.count)); - - int32_t type = get_camera_metadata_tag_type(entry.tag); - switch (type) { - case TYPE_BYTE: - outFile.write(reinterpret_cast(entry.data.u8), - sizeof(uint8_t) * entry.count); - break; - case TYPE_INT32: - outFile.write(reinterpret_cast(entry.data.i32), - sizeof(int32_t) * entry.count); - break; - case TYPE_FLOAT: - outFile.write(reinterpret_cast(entry.data.f), - sizeof(float) * entry.count); - break; - case TYPE_INT64: - outFile.write(reinterpret_cast(entry.data.i64), - sizeof(int64_t) * entry.count); - break; - case TYPE_DOUBLE: - outFile.write(reinterpret_cast(entry.data.d), - sizeof(double) * entry.count); - break; - case TYPE_RATIONAL: - [[fallthrough]]; - default: - LOG(WARNING) << "Type " << type << " is not supported."; - break; - } - } - } - } - - /* write camera device information */ - sz = mCameraInfo.size(); - outFile.write(reinterpret_cast(&sz), sizeof(size_t)); - for (auto&& [camId, camInfo] : mCameraInfo) { - LOG(INFO) << "Storing camera " << camId; - - /* write a camera identifier string */ - outFile.write(reinterpret_cast(&camId), sizeof(std::string)); - - /* controls */ - sz = camInfo->controls.size(); - outFile.write(reinterpret_cast(&sz), sizeof(size_t)); - for (auto& [ctrl, range] : camInfo->controls) { - outFile.write(reinterpret_cast(&ctrl), sizeof(CameraParam)); - outFile.write(reinterpret_cast(&std::get<0>(range)), sizeof(int32_t)); - outFile.write(reinterpret_cast(&std::get<1>(range)), sizeof(int32_t)); - outFile.write(reinterpret_cast(&std::get<2>(range)), sizeof(int32_t)); - } - - /* stream configurations */ - sz = camInfo->streamConfigurations.size(); - outFile.write(reinterpret_cast(&sz), sizeof(size_t)); - for (auto&& [sid, cfg] : camInfo->streamConfigurations) { - outFile.write(reinterpret_cast(sid), sizeof(int32_t)); - outFile.write(reinterpret_cast(&cfg), sizeof(cfg)); - } - - /* size of camera_metadata_t */ - size_t num_entry = 0; - size_t num_data = 0; - if (camInfo->characteristics != nullptr) { - num_entry = get_camera_metadata_entry_count(camInfo->characteristics); - num_data = get_camera_metadata_data_count(camInfo->characteristics); - } - outFile.write(reinterpret_cast(&num_entry), sizeof(size_t)); - outFile.write(reinterpret_cast(&num_data), sizeof(size_t)); - - /* write each camera metadata entry */ - if (num_entry > 0) { - camera_metadata_entry_t entry; - for (size_t idx = 0; idx < num_entry; ++idx) { - if (get_camera_metadata_entry(camInfo->characteristics, idx, &entry)) { - LOG(ERROR) << "Failed to retrieve camera metadata entry " << idx; - outFile.close(); - return false; - } - - outFile.write(reinterpret_cast(&entry.tag), sizeof(entry.tag)); - outFile.write(reinterpret_cast(&entry.count), sizeof(entry.count)); - - int32_t type = get_camera_metadata_tag_type(entry.tag); - switch (type) { - case TYPE_BYTE: - outFile.write(reinterpret_cast(entry.data.u8), - sizeof(uint8_t) * entry.count); - break; - case TYPE_INT32: - outFile.write(reinterpret_cast(entry.data.i32), - sizeof(int32_t) * entry.count); - break; - case TYPE_FLOAT: - outFile.write(reinterpret_cast(entry.data.f), - sizeof(float) * entry.count); - break; - case TYPE_INT64: - outFile.write(reinterpret_cast(entry.data.i64), - sizeof(int64_t) * entry.count); - break; - case TYPE_DOUBLE: - outFile.write(reinterpret_cast(entry.data.d), - sizeof(double) * entry.count); - break; - case TYPE_RATIONAL: - [[fallthrough]]; - default: - LOG(WARNING) << "Type " << type << " is not supported."; - break; - } - } - } - } - - outFile.close(); - int64_t writeEnd = android::elapsedRealtimeNano(); - LOG(INFO) << __FUNCTION__ << " takes " << std::scientific - << (double)(writeEnd - writeStart) / 1000000.0 << " ms."; - - return true; -} - -std::unique_ptr ConfigManager::Create() { - std::unique_ptr cfgMgr(new ConfigManager()); - - /* - * Read a configuration from XML file - * - * If this is too slow, ConfigManager::readConfigDataFromBinary() and - * ConfigManager::writeConfigDataToBinary()can serialize CameraInfo object - * to the filesystem and construct CameraInfo instead; this was - * evaluated as 10x faster. - */ - if (!cfgMgr->readConfigDataFromXML()) { - return nullptr; - } else { - return cfgMgr; - } -} - -ConfigManager::CameraInfo::~CameraInfo() { - free_camera_metadata(characteristics); - - for (auto&& [tag, val] : cameraMetadata) { - switch (tag) { - case ANDROID_LENS_DISTORTION: - case ANDROID_LENS_POSE_ROTATION: - case ANDROID_LENS_POSE_TRANSLATION: - case ANDROID_LENS_INTRINSIC_CALIBRATION: { - delete[] reinterpret_cast(val.first); - break; - } - - case ANDROID_REQUEST_AVAILABLE_CAPABILITIES: { - delete[] reinterpret_cast< - camera_metadata_enum_android_request_available_capabilities_t*>(val.first); - break; - } - - case ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS: { - delete[] reinterpret_cast(val.first); - break; - } - - default: - LOG(WARNING) << "Tag " << std::hex << tag << " is not supported. " - << "Data may be corrupted?"; - break; - } - } -} diff --git a/automotive/evs/aidl/impl/default/src/ConfigManagerUtil.cpp b/automotive/evs/aidl/impl/default/src/ConfigManagerUtil.cpp deleted file mode 100644 index e5fe6efa57..0000000000 --- a/automotive/evs/aidl/impl/default/src/ConfigManagerUtil.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/* - * 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. - */ - -#include "ConfigManagerUtil.h" - -#include -#include -#include -#include - -#include -#include - -#include - -using ::aidl::android::hardware::automotive::evs::CameraParam; -using ::aidl::android::hardware::graphics::common::PixelFormat; - -bool ConfigManagerUtil::convertToEvsCameraParam(const std::string& id, CameraParam& camParam) { - std::string trimmed = ConfigManagerUtil::trimString(id); - bool success = true; - - if (!trimmed.compare("BRIGHTNESS")) { - camParam = CameraParam::BRIGHTNESS; - } else if (!trimmed.compare("CONTRAST")) { - camParam = CameraParam::CONTRAST; - } else if (!trimmed.compare("AUTOGAIN")) { - camParam = CameraParam::AUTOGAIN; - } else if (!trimmed.compare("GAIN")) { - camParam = CameraParam::GAIN; - } else if (!trimmed.compare("AUTO_WHITE_BALANCE")) { - camParam = CameraParam::AUTO_WHITE_BALANCE; - } else if (!trimmed.compare("WHITE_BALANCE_TEMPERATURE")) { - camParam = CameraParam::WHITE_BALANCE_TEMPERATURE; - } else if (!trimmed.compare("SHARPNESS")) { - camParam = CameraParam::SHARPNESS; - } else if (!trimmed.compare("AUTO_EXPOSURE")) { - camParam = CameraParam::AUTO_EXPOSURE; - } else if (!trimmed.compare("ABSOLUTE_EXPOSURE")) { - camParam = CameraParam::ABSOLUTE_EXPOSURE; - } else if (!trimmed.compare("ABSOLUTE_FOCUS")) { - camParam = CameraParam::ABSOLUTE_FOCUS; - } else if (!trimmed.compare("AUTO_FOCUS")) { - camParam = CameraParam::AUTO_FOCUS; - } else if (!trimmed.compare("ABSOLUTE_ZOOM")) { - camParam = CameraParam::ABSOLUTE_ZOOM; - } else { - success = false; - } - - return success; -} - -bool ConfigManagerUtil::convertToPixelFormat(const std::string& in, PixelFormat& out) { - std::string trimmed = ConfigManagerUtil::trimString(in); - bool success = true; - - if (!trimmed.compare("RGBA_8888")) { - out = PixelFormat::RGBA_8888; - } else if (!trimmed.compare("YCRCB_420_SP")) { - out = PixelFormat::YCRCB_420_SP; - } else if (!trimmed.compare("YCBCR_422_I")) { - out = PixelFormat::YCBCR_422_I; - } else { - out = PixelFormat::UNSPECIFIED; - success = false; - } - - return success; -} - -bool ConfigManagerUtil::convertToMetadataTag(const char* name, camera_metadata_tag& aTag) { - if (!std::strcmp(name, "LENS_DISTORTION")) { - aTag = ANDROID_LENS_DISTORTION; - } else if (!std::strcmp(name, "LENS_INTRINSIC_CALIBRATION")) { - aTag = ANDROID_LENS_INTRINSIC_CALIBRATION; - } else if (!std::strcmp(name, "LENS_POSE_ROTATION")) { - aTag = ANDROID_LENS_POSE_ROTATION; - } else if (!std::strcmp(name, "LENS_POSE_TRANSLATION")) { - aTag = ANDROID_LENS_POSE_TRANSLATION; - } else if (!std::strcmp(name, "REQUEST_AVAILABLE_CAPABILITIES")) { - aTag = ANDROID_REQUEST_AVAILABLE_CAPABILITIES; - } else if (!std::strcmp(name, "LOGICAL_MULTI_CAMERA_PHYSICAL_IDS")) { - aTag = ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS; - } else { - return false; - } - - return true; -} - -bool ConfigManagerUtil::convertToCameraCapability( - const char* name, camera_metadata_enum_android_request_available_capabilities_t& cap) { - if (!std::strcmp(name, "DEPTH_OUTPUT")) { - cap = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT; - } else if (!std::strcmp(name, "LOGICAL_MULTI_CAMERA")) { - cap = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA; - } else if (!std::strcmp(name, "MONOCHROME")) { - cap = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME; - } else if (!std::strcmp(name, "SECURE_IMAGE_DATA")) { - cap = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SECURE_IMAGE_DATA; - } else { - return false; - } - - return true; -} - -float* ConfigManagerUtil::convertFloatArray(const char* sz, const char* vals, size_t& count, - const char delimiter) { - std::string size_string(sz); - std::string value_string(vals); - - if (!android::base::ParseUint(size_string, &count)) { - LOG(ERROR) << "Failed to parse " << size_string; - return nullptr; - } - float* result = new float[count]; - std::stringstream values(value_string); - - int32_t idx = 0; - std::string token; - while (getline(values, token, delimiter)) { - if (!android::base::ParseFloat(token, &result[idx++])) { - LOG(WARNING) << "Failed to parse " << token; - } - } - - return result; -} - -std::string ConfigManagerUtil::trimString(const std::string& src, const std::string& ws) { - const auto s = src.find_first_not_of(ws); - if (s == std::string::npos) { - return ""; - } - - const auto e = src.find_last_not_of(ws); - const auto r = e - s + 1; - - return src.substr(s, r); -} diff --git a/automotive/evs/aidl/impl/default/src/DefaultEvsEnumerator.cpp b/automotive/evs/aidl/impl/default/src/DefaultEvsEnumerator.cpp new file mode 100644 index 0000000000..5a81d05850 --- /dev/null +++ b/automotive/evs/aidl/impl/default/src/DefaultEvsEnumerator.cpp @@ -0,0 +1,93 @@ +/* + * 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. + */ + +// TODO(b/203661081): Remove below lines to disable compiler warnings. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-parameter" + +#define LOG_TAG "DefaultEvsEnumerator" + +#include + +namespace aidl::android::hardware::automotive::evs::implementation { + +using ::ndk::ScopedAStatus; + +ScopedAStatus DefaultEvsEnumerator::isHardware(bool* flag) { + // This returns true always. + *flag = true; + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::openCamera(const std::string& cameraId, + const Stream& streamConfig, + std::shared_ptr* obj) { + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::closeCamera(const std::shared_ptr& obj) { + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::getCameraList(std::vector* list) { + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::getStreamList(const CameraDesc& desc, + std::vector* _aidl_return) { + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::openDisplay(int32_t displayId, + std::shared_ptr* obj) { + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::closeDisplay(const std::shared_ptr& state) { + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::getDisplayIdList(std::vector* list) { + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::getDisplayState(DisplayState* state) { + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::registerStatusCallback( + const std::shared_ptr& callback) { + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::openUltrasonicsArray( + const std::string& id, std::shared_ptr* obj) { + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::closeUltrasonicsArray( + const std::shared_ptr& obj) { + return ScopedAStatus::ok(); +} + +ScopedAStatus DefaultEvsEnumerator::getUltrasonicsArrayList( + std::vector* list) { + return ScopedAStatus::ok(); +} + +} // namespace aidl::android::hardware::automotive::evs::implementation + +#pragma clang diagnostic pop diff --git a/automotive/evs/aidl/impl/default/src/EvsEnumerator.cpp b/automotive/evs/aidl/impl/default/src/EvsEnumerator.cpp deleted file mode 100644 index 6e2405deb5..0000000000 --- a/automotive/evs/aidl/impl/default/src/EvsEnumerator.cpp +++ /dev/null @@ -1,552 +0,0 @@ -/* - * 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. - */ - -#include "EvsEnumerator.h" - -#include "ConfigManager.h" -#include "EvsGlDisplay.h" -#include "EvsMockCamera.h" - -#include -#include -#include -#include - -#include -#include - -namespace { - -using ::aidl::android::frameworks::automotive::display::ICarDisplayProxy; -using ::aidl::android::hardware::graphics::common::BufferUsage; -using ::ndk::ScopedAStatus; -using std::chrono_literals::operator""s; - -// Constants -constexpr std::chrono::seconds kEnumerationTimeout = 10s; -constexpr uint64_t kInvalidDisplayId = std::numeric_limits::max(); -const std::set kAllowedUids = {AID_AUTOMOTIVE_EVS, AID_SYSTEM, AID_ROOT}; - -} // namespace - -namespace aidl::android::hardware::automotive::evs::implementation { - -// NOTE: All members values are static so that all clients operate on the same state -// That is to say, this is effectively a singleton despite the fact that HIDL -// constructs a new instance for each client. -std::unordered_map EvsEnumerator::sCameraList; -std::mutex EvsEnumerator::sLock; -std::condition_variable EvsEnumerator::sCameraSignal; -std::unique_ptr EvsEnumerator::sConfigManager; -std::shared_ptr EvsEnumerator::sDisplayProxy; -std::unordered_map EvsEnumerator::sDisplayPortList; - -EvsEnumerator::ActiveDisplays& EvsEnumerator::mutableActiveDisplays() { - static ActiveDisplays active_displays; - return active_displays; -} - -EvsEnumerator::EvsEnumerator(const std::shared_ptr& proxyService) { - LOG(DEBUG) << "EvsEnumerator is created."; - - if (!sConfigManager) { - /* loads and initializes ConfigManager in a separate thread */ - sConfigManager = ConfigManager::Create(); - } - - if (!sDisplayProxy) { - /* sets a car-window service handle */ - sDisplayProxy = proxyService; - } - - // Enumerate existing devices - enumerateCameras(); - mInternalDisplayId = enumerateDisplays(); -} - -bool EvsEnumerator::checkPermission() { - const auto uid = AIBinder_getCallingUid(); - if (kAllowedUids.find(uid) == kAllowedUids.end()) { - LOG(ERROR) << "EVS access denied: " - << "pid = " << AIBinder_getCallingPid() << ", uid = " << uid; - return false; - } - - return true; -} - -void EvsEnumerator::enumerateCameras() { - if (!sConfigManager) { - return; - } - - for (auto id : sConfigManager->getCameraIdList()) { - CameraRecord rec(id.data()); - std::unique_ptr& pInfo = sConfigManager->getCameraInfo(id); - if (pInfo) { - uint8_t* ptr = reinterpret_cast(pInfo->characteristics); - const size_t len = get_camera_metadata_size(pInfo->characteristics); - rec.desc.metadata.insert(rec.desc.metadata.end(), ptr, ptr + len); - } - sCameraList.insert_or_assign(id, std::move(rec)); - } -} - -uint64_t EvsEnumerator::enumerateDisplays() { - LOG(INFO) << __FUNCTION__ << ": Starting display enumeration"; - uint64_t internalDisplayId = kInvalidDisplayId; - if (!sDisplayProxy) { - LOG(ERROR) << "ICarDisplayProxy is not available!"; - return internalDisplayId; - } - - std::vector displayIds; - if (auto status = sDisplayProxy->getDisplayIdList(&displayIds); !status.isOk()) { - LOG(ERROR) << "Failed to retrieve a display id list" - << ::android::statusToString(status.getStatus()); - return internalDisplayId; - } - - if (displayIds.size() > 0) { - // The first entry of the list is the internal display. See - // SurfaceFlinger::getPhysicalDisplayIds() implementation. - internalDisplayId = displayIds[0]; - for (const auto& id : displayIds) { - const auto port = id & 0xFF; - LOG(INFO) << "Display " << std::hex << id << " is detected on the port, " << port; - sDisplayPortList.insert_or_assign(port, id); - } - } - - LOG(INFO) << "Found " << sDisplayPortList.size() << " displays"; - return internalDisplayId; -} - -// Methods from ::android::hardware::automotive::evs::IEvsEnumerator follow. -ScopedAStatus EvsEnumerator::getCameraList(std::vector* _aidl_return) { - LOG(DEBUG) << __FUNCTION__; - if (!checkPermission()) { - return ScopedAStatus::fromServiceSpecificError( - static_cast(EvsResult::PERMISSION_DENIED)); - } - - { - std::unique_lock lock(sLock); - if (sCameraList.size() < 1) { - // No qualified device has been found. Wait until new device is ready, - // for 10 seconds. - if (!sCameraSignal.wait_for(lock, kEnumerationTimeout, - [] { return sCameraList.size() > 0; })) { - LOG(DEBUG) << "Timer expired. No new device has been added."; - } - } - } - - // Build up a packed array of CameraDesc for return - _aidl_return->resize(sCameraList.size()); - unsigned i = 0; - for (const auto& [key, cam] : sCameraList) { - (*_aidl_return)[i++] = cam.desc; - } - - if (sConfigManager) { - // Adding camera groups that represent logical camera devices - auto camGroups = sConfigManager->getCameraGroupIdList(); - for (auto&& id : camGroups) { - if (sCameraList.find(id) != sCameraList.end()) { - // Already exists in the _aidl_return - continue; - } - - std::unique_ptr& tempInfo = - sConfigManager->getCameraGroupInfo(id); - CameraRecord cam(id.data()); - if (tempInfo) { - uint8_t* ptr = reinterpret_cast(tempInfo->characteristics); - const size_t len = get_camera_metadata_size(tempInfo->characteristics); - cam.desc.metadata.insert(cam.desc.metadata.end(), ptr, ptr + len); - } - - sCameraList.insert_or_assign(id, cam); - _aidl_return->push_back(cam.desc); - } - } - - // Send back the results - LOG(DEBUG) << "Reporting " << sCameraList.size() << " cameras available"; - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsEnumerator::getStreamList(const CameraDesc& desc, - std::vector* _aidl_return) { - using AidlPixelFormat = ::aidl::android::hardware::graphics::common::PixelFormat; - - camera_metadata_t* pMetadata = const_cast( - reinterpret_cast(desc.metadata.data())); - camera_metadata_entry_t streamConfig; - if (!find_camera_metadata_entry(pMetadata, ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, - &streamConfig)) { - const unsigned numStreamConfigs = streamConfig.count / sizeof(StreamConfiguration); - _aidl_return->resize(numStreamConfigs); - const StreamConfiguration* pCurrentConfig = - reinterpret_cast(streamConfig.data.i32); - for (unsigned i = 0; i < numStreamConfigs; ++i, ++pCurrentConfig) { - // Build ::aidl::android::hardware::automotive::evs::Stream from - // StreamConfiguration. - Stream current = { - .id = pCurrentConfig->id, - .streamType = - pCurrentConfig->type == - ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT - ? StreamType::INPUT - : StreamType::OUTPUT, - .width = pCurrentConfig->width, - .height = pCurrentConfig->height, - .format = static_cast(pCurrentConfig->format), - .usage = BufferUsage::CAMERA_INPUT, - .rotation = Rotation::ROTATION_0, - }; - - (*_aidl_return)[i] = current; - } - } - - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsEnumerator::openCamera(const std::string& id, const Stream& cfg, - std::shared_ptr* obj) { - LOG(DEBUG) << __FUNCTION__; - if (!checkPermission()) { - return ScopedAStatus::fromServiceSpecificError( - static_cast(EvsResult::PERMISSION_DENIED)); - } - - // Is this a recognized camera id? - CameraRecord* pRecord = findCameraById(id); - if (!pRecord) { - LOG(ERROR) << id << " does not exist!"; - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); - } - - // Has this camera already been instantiated by another caller? - std::shared_ptr pActiveCamera = pRecord->activeInstance.lock(); - if (pActiveCamera) { - LOG(WARNING) << "Killing previous camera because of new caller"; - closeCamera(pActiveCamera); - } - - // Construct a camera instance for the caller - if (!sConfigManager) { - pActiveCamera = EvsMockCamera::Create(id.data()); - } else { - pActiveCamera = EvsMockCamera::Create(id.data(), sConfigManager->getCameraInfo(id), &cfg); - } - - pRecord->activeInstance = pActiveCamera; - if (!pActiveCamera) { - LOG(ERROR) << "Failed to create new EvsMockCamera object for " << id; - return ScopedAStatus::fromServiceSpecificError( - static_cast(EvsResult::UNDERLYING_SERVICE_ERROR)); - } - - *obj = pActiveCamera; - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsEnumerator::closeCamera(const std::shared_ptr& cameraObj) { - LOG(DEBUG) << __FUNCTION__; - - if (!cameraObj) { - LOG(ERROR) << "Ignoring call to closeCamera with null camera ptr"; - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); - } - - // Get the camera id so we can find it in our list - CameraDesc desc; - auto status = cameraObj->getCameraInfo(&desc); - if (!status.isOk()) { - LOG(ERROR) << "Failed to read a camera descriptor"; - return ScopedAStatus::fromServiceSpecificError( - static_cast(EvsResult::UNDERLYING_SERVICE_ERROR)); - } - auto cameraId = desc.id; - closeCamera_impl(cameraObj, cameraId); - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsEnumerator::openDisplay(int32_t id, std::shared_ptr* displayObj) { - LOG(DEBUG) << __FUNCTION__; - if (!checkPermission()) { - return ScopedAStatus::fromServiceSpecificError( - static_cast(EvsResult::PERMISSION_DENIED)); - } - - auto& displays = mutableActiveDisplays(); - - if (auto existing_display_search = displays.popDisplay(id)) { - // If we already have a display active, then we need to shut it down so we can - // give exclusive access to the new caller. - std::shared_ptr pActiveDisplay = existing_display_search->displayWeak.lock(); - if (pActiveDisplay) { - LOG(WARNING) << "Killing previous display because of new caller"; - pActiveDisplay->forceShutdown(); - } - } - - // Create a new display interface and return it - uint64_t targetDisplayId = mInternalDisplayId; - auto it = sDisplayPortList.find(id); - if (it != sDisplayPortList.end()) { - targetDisplayId = it->second; - } else { - LOG(WARNING) << "No display is available on the port " << static_cast(id) - << ". The main display " << mInternalDisplayId << " will be used instead"; - } - - // Create a new display interface and return it. - std::shared_ptr pActiveDisplay = - ndk::SharedRefBase::make(sDisplayProxy, targetDisplayId); - - if (auto insert_result = displays.tryInsert(id, pActiveDisplay); !insert_result) { - LOG(ERROR) << "Display ID " << id << " has been used by another caller."; - pActiveDisplay->forceShutdown(); - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::RESOURCE_BUSY)); - } - - LOG(DEBUG) << "Returning new EvsGlDisplay object " << pActiveDisplay.get(); - *displayObj = pActiveDisplay; - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsEnumerator::closeDisplay(const std::shared_ptr& obj) { - LOG(DEBUG) << __FUNCTION__; - - auto& displays = mutableActiveDisplays(); - const auto display_search = displays.popDisplay(obj); - - if (!display_search) { - LOG(WARNING) << "Ignoring close of previously orphaned display - why did a client steal?"; - return ScopedAStatus::ok(); - } - - auto pActiveDisplay = display_search->displayWeak.lock(); - - if (!pActiveDisplay) { - LOG(ERROR) << "Somehow a display is being destroyed " - << "when the enumerator didn't know one existed"; - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); - } - - pActiveDisplay->forceShutdown(); - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsEnumerator::getDisplayState(DisplayState* state) { - LOG(DEBUG) << __FUNCTION__; - if (!checkPermission()) { - *state = DisplayState::DEAD; - return ScopedAStatus::fromServiceSpecificError( - static_cast(EvsResult::PERMISSION_DENIED)); - } - - // TODO(b/262779341): For now we can just return the state of the 1st display. Need to update - // the API later. - - const auto& all_displays = mutableActiveDisplays().getAllDisplays(); - - // Do we still have a display object we think should be active? - if (all_displays.empty()) { - *state = DisplayState::NOT_OPEN; - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); - } - - std::shared_ptr pActiveDisplay = all_displays.begin()->second.displayWeak.lock(); - if (pActiveDisplay) { - return pActiveDisplay->getDisplayState(state); - } else { - *state = DisplayState::NOT_OPEN; - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); - } -} - -ScopedAStatus EvsEnumerator::getDisplayIdList(std::vector* list) { - std::vector& output = *list; - if (sDisplayPortList.size() > 0) { - output.resize(sDisplayPortList.size()); - unsigned i = 0; - output[i++] = mInternalDisplayId & 0xFF; - for (const auto& [port, id] : sDisplayPortList) { - if (mInternalDisplayId != id) { - output[i++] = port; - } - } - } - - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsEnumerator::isHardware(bool* flag) { - *flag = true; - return ScopedAStatus::ok(); -} - -void EvsEnumerator::notifyDeviceStatusChange(const std::string_view& deviceName, - DeviceStatusType type) { - std::lock_guard lock(sLock); - if (!mCallback) { - return; - } - - std::vector status{{.id = std::string(deviceName), .status = type}}; - if (!mCallback->deviceStatusChanged(status).isOk()) { - LOG(WARNING) << "Failed to notify a device status change, name = " << deviceName - << ", type = " << static_cast(type); - } -} - -ScopedAStatus EvsEnumerator::registerStatusCallback( - const std::shared_ptr& callback) { - std::lock_guard lock(sLock); - if (mCallback) { - LOG(INFO) << "Replacing an existing device status callback"; - } - mCallback = callback; - return ScopedAStatus::ok(); -} - -void EvsEnumerator::closeCamera_impl(const std::shared_ptr& pCamera, - const std::string& cameraId) { - // Find the named camera - CameraRecord* pRecord = findCameraById(cameraId); - - // Is the display being destroyed actually the one we think is active? - if (!pRecord) { - LOG(ERROR) << "Asked to close a camera whose name isn't recognized"; - } else { - std::shared_ptr pActiveCamera = pRecord->activeInstance.lock(); - if (!pActiveCamera) { - LOG(WARNING) << "Somehow a camera is being destroyed " - << "when the enumerator didn't know one existed"; - } else if (pActiveCamera != pCamera) { - // This can happen if the camera was aggressively reopened, - // orphaning this previous instance - LOG(WARNING) << "Ignoring close of previously orphaned camera " - << "- why did a client steal?"; - } else { - // Shutdown the active camera - pActiveCamera->shutdown(); - } - } - - return; -} - -EvsEnumerator::CameraRecord* EvsEnumerator::findCameraById(const std::string& cameraId) { - // Find the named camera - auto found = sCameraList.find(cameraId); - if (found != sCameraList.end()) { - // Found a match! - return &found->second; - } - - // We didn't find a match - return nullptr; -} - -std::optional EvsEnumerator::ActiveDisplays::popDisplay( - int32_t id) { - std::lock_guard lck(mMutex); - const auto search = mIdToDisplay.find(id); - if (search == mIdToDisplay.end()) { - return std::nullopt; - } - const auto display_info = search->second; - mIdToDisplay.erase(search); - mDisplayToId.erase(display_info.internalDisplayRawAddr); - return display_info; -} - -std::optional EvsEnumerator::ActiveDisplays::popDisplay( - const std::shared_ptr& display) { - const auto display_ptr_val = reinterpret_cast(display.get()); - std::lock_guard lck(mMutex); - const auto display_to_id_search = mDisplayToId.find(display_ptr_val); - if (display_to_id_search == mDisplayToId.end()) { - LOG(ERROR) << "Unknown display."; - return std::nullopt; - } - const auto id = display_to_id_search->second; - const auto id_to_display_search = mIdToDisplay.find(id); - mDisplayToId.erase(display_to_id_search); - if (id_to_display_search == mIdToDisplay.end()) { - LOG(ERROR) << "No correspsonding ID for the display, probably orphaned."; - return std::nullopt; - } - const auto display_info = id_to_display_search->second; - mIdToDisplay.erase(id); - return display_info; -} - -std::unordered_map -EvsEnumerator::ActiveDisplays::getAllDisplays() { - std::lock_guard lck(mMutex); - auto id_to_display_map_copy = mIdToDisplay; - return id_to_display_map_copy; -} - -bool EvsEnumerator::ActiveDisplays::tryInsert(int32_t id, - const std::shared_ptr& display) { - std::lock_guard lck(mMutex); - const auto display_ptr_val = reinterpret_cast(display.get()); - - auto id_to_display_insert_result = - mIdToDisplay.emplace(id, DisplayInfo{ - .id = id, - .displayWeak = display, - .internalDisplayRawAddr = display_ptr_val, - }); - if (!id_to_display_insert_result.second) { - return false; - } - auto display_to_id_insert_result = mDisplayToId.emplace(display_ptr_val, id); - if (!display_to_id_insert_result.second) { - mIdToDisplay.erase(id); - return false; - } - return true; -} - -ScopedAStatus EvsEnumerator::getUltrasonicsArrayList( - [[maybe_unused]] std::vector* list) { - // TODO(b/149874793): Add implementation for EVS Manager and Sample driver - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsEnumerator::openUltrasonicsArray( - [[maybe_unused]] const std::string& id, - [[maybe_unused]] std::shared_ptr* obj) { - // TODO(b/149874793): Add implementation for EVS Manager and Sample driver - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsEnumerator::closeUltrasonicsArray( - [[maybe_unused]] const std::shared_ptr& obj) { - // TODO(b/149874793): Add implementation for EVS Manager and Sample driver - return ScopedAStatus::ok(); -} - -} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/src/EvsGlDisplay.cpp b/automotive/evs/aidl/impl/default/src/EvsGlDisplay.cpp deleted file mode 100644 index e5f8e4c84a..0000000000 --- a/automotive/evs/aidl/impl/default/src/EvsGlDisplay.cpp +++ /dev/null @@ -1,417 +0,0 @@ -/* - * 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. - */ - -#include "EvsGlDisplay.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace { - -using ::aidl::android::frameworks::automotive::display::ICarDisplayProxy; -using ::aidl::android::hardware::graphics::common::BufferUsage; -using ::aidl::android::hardware::graphics::common::PixelFormat; -using ::android::base::ScopedLockAssertion; -using ::ndk::ScopedAStatus; - -constexpr auto kTimeout = std::chrono::seconds(1); - -bool debugFirstFrameDisplayed = false; - -int generateFingerPrint(buffer_handle_t handle) { - return static_cast(reinterpret_cast(handle) & 0xFFFFFFFF); -} - -} // namespace - -namespace aidl::android::hardware::automotive::evs::implementation { - -EvsGlDisplay::EvsGlDisplay(const std::shared_ptr& pDisplayProxy, - uint64_t displayId) - : mDisplayId(displayId), mDisplayProxy(pDisplayProxy) { - LOG(DEBUG) << "EvsGlDisplay instantiated"; - - // Set up our self description - // NOTE: These are arbitrary values chosen for testing - mInfo.id = std::to_string(displayId); - mInfo.vendorFlags = 3870; - - // Start a thread to render images on this display - { - std::lock_guard lock(mLock); - mState = RUN; - } - mRenderThread = std::thread([this]() { renderFrames(); }); -} - -EvsGlDisplay::~EvsGlDisplay() { - LOG(DEBUG) << "EvsGlDisplay being destroyed"; - forceShutdown(); -} - -/** - * This gets called if another caller "steals" ownership of the display - */ -void EvsGlDisplay::forceShutdown() { - LOG(DEBUG) << "EvsGlDisplay forceShutdown"; - { - std::lock_guard lock(mLock); - - // If the buffer isn't being held by a remote client, release it now as an - // optimization to release the resources more quickly than the destructor might - // get called. - if (mBuffer.handle != nullptr) { - // Report if we're going away while a buffer is outstanding - if (mBufferBusy || mState == RUN) { - LOG(ERROR) << "EvsGlDisplay going down while client is holding a buffer"; - } - mState = STOPPING; - } - - // Put this object into an unrecoverable error state since somebody else - // is going to own the display now. - mRequestedState = DisplayState::DEAD; - } - mBufferReadyToRender.notify_all(); - - if (mRenderThread.joinable()) { - mRenderThread.join(); - } -} - -/** - * Initialize GL in the context of a caller's thread and prepare a graphic - * buffer to use. - */ -bool EvsGlDisplay::initializeGlContextLocked() { - // Initialize our display window - // NOTE: This will cause the display to become "VISIBLE" before a frame is actually - // returned, which is contrary to the spec and will likely result in a black frame being - // (briefly) shown. - if (!mGlWrapper.initialize(mDisplayProxy, mDisplayId)) { - // Report the failure - LOG(ERROR) << "Failed to initialize GL display"; - return false; - } - - // Assemble the buffer description we'll use for our render target - static_assert(::aidl::android::hardware::graphics::common::PixelFormat::RGBA_8888 == - static_cast<::aidl::android::hardware::graphics::common::PixelFormat>( - HAL_PIXEL_FORMAT_RGBA_8888)); - mBuffer.description = { - .width = static_cast(mGlWrapper.getWidth()), - .height = static_cast(mGlWrapper.getHeight()), - .layers = 1, - .format = PixelFormat::RGBA_8888, - // FIXME: Below line is not using - // ::aidl::android::hardware::graphics::common::BufferUsage because - // BufferUsage enum does not support a bitwise-OR operation; they - // should be BufferUsage::GPU_RENDER_TARGET | - // BufferUsage::COMPOSER_OVERLAY - .usage = static_cast(GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_COMPOSER), - }; - - ::android::GraphicBufferAllocator& alloc(::android::GraphicBufferAllocator::get()); - uint32_t stride = static_cast(mBuffer.description.stride); - buffer_handle_t handle = nullptr; - const ::android::status_t result = - alloc.allocate(mBuffer.description.width, mBuffer.description.height, - static_cast<::android::PixelFormat>(mBuffer.description.format), - mBuffer.description.layers, - static_cast(mBuffer.description.usage), &handle, &stride, - /* requestorName= */ "EvsGlDisplay"); - mBuffer.description.stride = stride; - mBuffer.fingerprint = generateFingerPrint(mBuffer.handle); - if (result != ::android::NO_ERROR) { - LOG(ERROR) << "Error " << result << " allocating " << mBuffer.description.width << " x " - << mBuffer.description.height << " graphics buffer."; - mGlWrapper.shutdown(); - return false; - } - - mBuffer.handle = handle; - if (mBuffer.handle == nullptr) { - LOG(ERROR) << "We didn't get a buffer handle back from the allocator"; - mGlWrapper.shutdown(); - return false; - } - - LOG(DEBUG) << "Allocated new buffer " << mBuffer.handle << " with stride " - << mBuffer.description.stride; - return true; -} - -/** - * This method runs in a separate thread and renders the contents of the buffer. - */ -void EvsGlDisplay::renderFrames() { - { - std::lock_guard lock(mLock); - - if (!initializeGlContextLocked()) { - LOG(ERROR) << "Failed to initialize GL context"; - return; - } - - // Display buffer is ready. - mBufferBusy = false; - } - mBufferReadyToUse.notify_all(); - - while (true) { - { - std::unique_lock lock(mLock); - ScopedLockAssertion lock_assertion(mLock); - mBufferReadyToRender.wait( - lock, [this]() REQUIRES(mLock) { return mBufferReady || mState != RUN; }); - if (mState != RUN) { - LOG(DEBUG) << "A rendering thread is stopping"; - break; - } - mBufferReady = false; - } - - // Update the texture contents with the provided data - if (!mGlWrapper.updateImageTexture(mBuffer.handle, mBuffer.description)) { - LOG(WARNING) << "Failed to update the image texture"; - continue; - } - - // Put the image on the screen - mGlWrapper.renderImageToScreen(); - if (!debugFirstFrameDisplayed) { - LOG(DEBUG) << "EvsFirstFrameDisplayTiming start time: " << ::android::elapsedRealtime() - << " ms."; - debugFirstFrameDisplayed = true; - } - - // Mark current frame is consumed. - { - std::lock_guard lock(mLock); - mBufferBusy = false; - } - mBufferDone.notify_all(); - } - - LOG(DEBUG) << "A rendering thread is stopped."; - - // Drop the graphics buffer we've been using - ::android::GraphicBufferAllocator& alloc(::android::GraphicBufferAllocator::get()); - alloc.free(mBuffer.handle); - mBuffer.handle = nullptr; - - mGlWrapper.hideWindow(mDisplayProxy, mDisplayId); - mGlWrapper.shutdown(); - - std::lock_guard lock(mLock); - mState = STOPPED; -} - -/** - * Returns basic information about the EVS display provided by the system. - * See the description of the DisplayDesc structure for details. - */ -ScopedAStatus EvsGlDisplay::getDisplayInfo(DisplayDesc* _aidl_return) { - if (!mDisplayProxy) { - return ::ndk::ScopedAStatus::fromServiceSpecificError( - static_cast(EvsResult::UNDERLYING_SERVICE_ERROR)); - } - - ::aidl::android::frameworks::automotive::display::DisplayDesc proxyDisplay; - auto status = mDisplayProxy->getDisplayInfo(mDisplayId, &proxyDisplay); - if (!status.isOk()) { - return ::ndk::ScopedAStatus::fromServiceSpecificError( - static_cast(EvsResult::UNDERLYING_SERVICE_ERROR)); - } - - _aidl_return->width = proxyDisplay.width; - _aidl_return->height = proxyDisplay.height; - _aidl_return->orientation = static_cast(proxyDisplay.orientation); - _aidl_return->id = mInfo.id; // FIXME: what should be ID here? - _aidl_return->vendorFlags = mInfo.vendorFlags; - return ::ndk::ScopedAStatus::ok(); -} - -/** - * Clients may set the display state to express their desired state. - * The HAL implementation must gracefully accept a request for any state - * while in any other state, although the response may be to ignore the request. - * The display is defined to start in the NOT_VISIBLE state upon initialization. - * The client is then expected to request the VISIBLE_ON_NEXT_FRAME state, and - * then begin providing video. When the display is no longer required, the client - * is expected to request the NOT_VISIBLE state after passing the last video frame. - */ -ScopedAStatus EvsGlDisplay::setDisplayState(DisplayState state) { - LOG(DEBUG) << __FUNCTION__; - std::lock_guard lock(mLock); - - if (mRequestedState == DisplayState::DEAD) { - // This object no longer owns the display -- it's been superceeded! - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); - } - - // Ensure we recognize the requested state so we don't go off the rails - static constexpr ::ndk::enum_range kDisplayStateRange; - if (std::find(kDisplayStateRange.begin(), kDisplayStateRange.end(), state) == - kDisplayStateRange.end()) { - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); - } - - switch (state) { - case DisplayState::NOT_VISIBLE: - mGlWrapper.hideWindow(mDisplayProxy, mDisplayId); - break; - case DisplayState::VISIBLE: - mGlWrapper.showWindow(mDisplayProxy, mDisplayId); - break; - default: - break; - } - - // Record the requested state - mRequestedState = state; - - return ScopedAStatus::ok(); -} - -/** - * The HAL implementation should report the actual current state, which might - * transiently differ from the most recently requested state. Note, however, that - * the logic responsible for changing display states should generally live above - * the device layer, making it undesirable for the HAL implementation to - * spontaneously change display states. - */ -ScopedAStatus EvsGlDisplay::getDisplayState(DisplayState* _aidl_return) { - LOG(DEBUG) << __FUNCTION__; - std::lock_guard lock(mLock); - *_aidl_return = mRequestedState; - return ScopedAStatus::ok(); -} - -/** - * This call returns a handle to a frame buffer associated with the display. - * This buffer may be locked and written to by software and/or GL. This buffer - * must be returned via a call to returnTargetBufferForDisplay() even if the - * display is no longer visible. - */ -ScopedAStatus EvsGlDisplay::getTargetBuffer(BufferDesc* _aidl_return) { - LOG(DEBUG) << __FUNCTION__; - std::unique_lock lock(mLock); - ScopedLockAssertion lock_assertion(mLock); - if (mRequestedState == DisplayState::DEAD) { - LOG(ERROR) << "Rejecting buffer request from object that lost ownership of the display."; - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); - } - - // If we don't already have a buffer, allocate one now - // mBuffer.memHandle is a type of buffer_handle_t, which is equal to - // native_handle_t*. - mBufferReadyToUse.wait(lock, [this]() REQUIRES(mLock) { return !mBufferBusy; }); - - // Do we have a frame available? - if (mBufferBusy) { - // This means either we have a 2nd client trying to compete for buffers - // (an unsupported mode of operation) or else the client hasn't returned - // a previously issued buffer yet (they're behaving badly). - // NOTE: We have to make the callback even if we have nothing to provide - LOG(ERROR) << "getTargetBuffer called while no buffers available."; - return ScopedAStatus::fromServiceSpecificError( - static_cast(EvsResult::BUFFER_NOT_AVAILABLE)); - } - - // Mark our buffer as busy - mBufferBusy = true; - - // Send the buffer to the client - LOG(VERBOSE) << "Providing display buffer handle " << mBuffer.handle; - - BufferDesc bufferDescToSend = { - .buffer = - { - .handle = std::move(::android::dupToAidl(mBuffer.handle)), - .description = mBuffer.description, - }, - .pixelSizeBytes = 4, // RGBA_8888 is 4-byte-per-pixel format - .bufferId = mBuffer.fingerprint, - }; - *_aidl_return = std::move(bufferDescToSend); - - return ScopedAStatus::ok(); -} - -/** - * This call tells the display that the buffer is ready for display. - * The buffer is no longer valid for use by the client after this call. - */ -ScopedAStatus EvsGlDisplay::returnTargetBufferForDisplay(const BufferDesc& buffer) { - LOG(VERBOSE) << __FUNCTION__; - std::unique_lock lock(mLock); - ScopedLockAssertion lock_assertion(mLock); - - // Nobody should call us with a null handle - if (buffer.buffer.handle.fds.size() < 1) { - LOG(ERROR) << __FUNCTION__ << " called without a valid buffer handle."; - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); - } - if (buffer.bufferId != mBuffer.fingerprint) { - LOG(ERROR) << "Got an unrecognized frame returned."; - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); - } - if (!mBufferBusy) { - LOG(ERROR) << "A frame was returned with no outstanding frames."; - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); - } - - // If we've been displaced by another owner of the display, then we can't do anything else - if (mRequestedState == DisplayState::DEAD) { - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); - } - - // If we were waiting for a new frame, this is it! - if (mRequestedState == DisplayState::VISIBLE_ON_NEXT_FRAME) { - mRequestedState = DisplayState::VISIBLE; - mGlWrapper.showWindow(mDisplayProxy, mDisplayId); - } - - // Validate we're in an expected state - if (mRequestedState != DisplayState::VISIBLE) { - // Not sure why a client would send frames back when we're not visible. - LOG(WARNING) << "Got a frame returned while not visible - ignoring."; - return ScopedAStatus::ok(); - } - mBufferReady = true; - mBufferReadyToRender.notify_all(); - - if (!mBufferDone.wait_for(lock, kTimeout, [this]() REQUIRES(mLock) { return !mBufferBusy; })) { - return ScopedAStatus::fromServiceSpecificError( - static_cast(EvsResult::UNDERLYING_SERVICE_ERROR)); - } - - return ScopedAStatus::ok(); -} - -} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/src/EvsMockCamera.cpp b/automotive/evs/aidl/impl/default/src/EvsMockCamera.cpp deleted file mode 100644 index 4b46a5ae64..0000000000 --- a/automotive/evs/aidl/impl/default/src/EvsMockCamera.cpp +++ /dev/null @@ -1,642 +0,0 @@ -/* - * 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. - */ - -#include "EvsMockCamera.h" -#include "ConfigManager.h" -#include "EvsEnumerator.h" - -#include -#include -#include -#include - -#include - -namespace { - -using ::aidl::android::hardware::graphics::common::BufferUsage; -using ::ndk::ScopedAStatus; - -// Arbitrary limit on number of graphics buffers allowed to be allocated -// Safeguards against unreasonable resource consumption and provides a testable limit -constexpr unsigned kMaxBuffersInFlight = 100; - -// Minimum number of buffers to run a video stream -constexpr int kMinimumBuffersInFlight = 1; - -// Colors for the colorbar test pattern in ABGR format -constexpr uint32_t kColors[] = { - 0xFFFFFFFF, // white - 0xFF00FFFF, // yellow - 0xFFFFFF00, // cyan - 0xFF00FF00, // green - 0xFFFF00FF, // fuchsia - 0xFF0000FF, // red - 0xFFFF0000, // blue - 0xFF000000, // black -}; -constexpr size_t kNumColors = sizeof(kColors) / sizeof(kColors[0]); - -} // namespace - -namespace aidl::android::hardware::automotive::evs::implementation { - -EvsMockCamera::EvsMockCamera([[maybe_unused]] Sigil sigil, const char* id, - std::unique_ptr& camInfo) - : mFramesAllowed(0), mFramesInUse(0), mStreamState(STOPPED), mCameraInfo(camInfo) { - LOG(DEBUG) << __FUNCTION__; - - /* set a camera id */ - mDescription.id = id; - - /* set camera metadata */ - if (camInfo) { - uint8_t* ptr = reinterpret_cast(camInfo->characteristics); - const size_t len = get_camera_metadata_size(camInfo->characteristics); - mDescription.metadata.insert(mDescription.metadata.end(), ptr, ptr + len); - } -} - -EvsMockCamera::~EvsMockCamera() { - LOG(DEBUG) << __FUNCTION__; - shutdown(); -} - -// This gets called if another caller "steals" ownership of the camera -void EvsMockCamera::shutdown() { - LOG(DEBUG) << __FUNCTION__; - - // Make sure our output stream is cleaned up - // (It really should be already) - stopVideoStream_impl(); - - // Claim the lock while we work on internal state - std::lock_guard lock(mAccessLock); - - // Drop all the graphics buffers we've been using - if (mBuffers.size() > 0) { - ::android::GraphicBufferAllocator& alloc(::android::GraphicBufferAllocator::get()); - for (auto&& rec : mBuffers) { - if (rec.inUse) { - LOG(WARNING) << "WARNING: releasing a buffer remotely owned."; - } - alloc.free(rec.handle); - rec.handle = nullptr; - } - mBuffers.clear(); - } - - // Put this object into an unrecoverable error state since somebody else - // is going to own the underlying camera now - mStreamState = DEAD; -} - -// Methods from ::aidl::android::hardware::automotive::evs::IEvsCamera follow. -ScopedAStatus EvsMockCamera::getCameraInfo(CameraDesc* _aidl_return) { - LOG(DEBUG) << __FUNCTION__; - - // Send back our self description - *_aidl_return = mDescription; - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsMockCamera::setMaxFramesInFlight(int32_t bufferCount) { - LOG(DEBUG) << __FUNCTION__ << ", bufferCount = " << bufferCount; - ; - - std::lock_guard lock(mAccessLock); - - // If we've been displaced by another owner of the camera, then we can't do anything else - if (mStreamState == DEAD) { - LOG(ERROR) << "Ignoring setMaxFramesInFlight call when camera has been lost."; - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); - } - - // We cannot function without at least one video buffer to send data - if (bufferCount < 1) { - LOG(ERROR) << "Ignoring setMaxFramesInFlight with less than one buffer requested."; - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); - } - - // Update our internal state - if (!setAvailableFrames_Locked(bufferCount)) { - LOG(ERROR) << "Failed to adjust the maximum number of frames in flight."; - return ScopedAStatus::fromServiceSpecificError( - static_cast(EvsResult::BUFFER_NOT_AVAILABLE)); - } - - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsMockCamera::startVideoStream(const std::shared_ptr& cb) { - LOG(DEBUG) << __FUNCTION__; - - if (!cb) { - LOG(ERROR) << "A given stream callback is invalid."; - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); - } - - std::lock_guard lock(mAccessLock); - - // If we've been displaced by another owner of the camera, then we can't do anything else - if (mStreamState == DEAD) { - LOG(ERROR) << "Ignoring startVideoStream call when camera has been lost."; - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); - } - - if (mStreamState != STOPPED) { - LOG(ERROR) << "Ignoring startVideoStream call when a stream is already running."; - return ScopedAStatus::fromServiceSpecificError( - static_cast(EvsResult::STREAM_ALREADY_RUNNING)); - } - - // If the client never indicated otherwise, configure ourselves for a single streaming buffer - if (mFramesAllowed < kMinimumBuffersInFlight && - !setAvailableFrames_Locked(kMinimumBuffersInFlight)) { - LOG(ERROR) << "Failed to start stream because we couldn't get a graphics buffer"; - return ScopedAStatus::fromServiceSpecificError( - static_cast(EvsResult::BUFFER_NOT_AVAILABLE)); - } - - // Record the user's callback for use when we have a frame ready - mStream = cb; - - // Start the frame generation thread - mStreamState = RUNNING; - mCaptureThread = std::thread([this]() { generateFrames(); }); - - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsMockCamera::doneWithFrame(const std::vector& list) { - std::lock_guard lock(mAccessLock); - for (const auto& desc : list) { - returnBufferLocked(desc.bufferId); - } - - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsMockCamera::stopVideoStream() { - LOG(DEBUG) << __FUNCTION__; - return stopVideoStream_impl(); -} - -ScopedAStatus EvsMockCamera::stopVideoStream_impl() { - std::unique_lock lock(mAccessLock); - - if (mStreamState != RUNNING) { - // Safely return here because a stream is not running. - return ScopedAStatus::ok(); - } - - // Tell the GenerateFrames loop we want it to stop - mStreamState = STOPPING; - - // Block outside the mutex until the "stop" flag has been acknowledged - // We won't send any more frames, but the client might still get some already in flight - LOG(DEBUG) << "Waiting for stream thread to end..."; - lock.unlock(); - if (mCaptureThread.joinable()) { - mCaptureThread.join(); - } - lock.lock(); - - mStreamState = STOPPED; - mStream = nullptr; - LOG(DEBUG) << "Stream marked STOPPED."; - - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsMockCamera::getExtendedInfo(int32_t opaqueIdentifier, - std::vector* opaqueValue) { - const auto it = mExtInfo.find(opaqueIdentifier); - if (it == mExtInfo.end()) { - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); - } else { - *opaqueValue = mExtInfo[opaqueIdentifier]; - } - - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsMockCamera::setExtendedInfo(int32_t opaqueIdentifier, - const std::vector& opaqueValue) { - mExtInfo.insert_or_assign(opaqueIdentifier, opaqueValue); - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsMockCamera::getPhysicalCameraInfo([[maybe_unused]] const std::string& id, - CameraDesc* _aidl_return) { - LOG(DEBUG) << __FUNCTION__; - - // This method works exactly same as getCameraInfo() in EVS HW module. - *_aidl_return = mDescription; - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsMockCamera::pauseVideoStream() { - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); -} - -ScopedAStatus EvsMockCamera::resumeVideoStream() { - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); -} - -ScopedAStatus EvsMockCamera::setPrimaryClient() { - /* Because EVS HW module reference implementation expects a single client at - * a time, this returns a success code always. - */ - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsMockCamera::forcePrimaryClient(const std::shared_ptr&) { - /* Because EVS HW module reference implementation expects a single client at - * a time, this returns a success code always. - */ - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsMockCamera::unsetPrimaryClient() { - /* Because EVS HW module reference implementation expects a single client at - * a time, there is no chance that this is called by the secondary client and - * therefore returns a success code always. - */ - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsMockCamera::getParameterList(std::vector* _aidl_return) { - if (mCameraInfo) { - _aidl_return->resize(mCameraInfo->controls.size()); - auto idx = 0; - for (auto& [name, range] : mCameraInfo->controls) { - (*_aidl_return)[idx++] = name; - } - } - - return ScopedAStatus::ok(); -} - -ScopedAStatus EvsMockCamera::getIntParameterRange([[maybe_unused]] CameraParam id, - [[maybe_unused]] ParameterRange* _aidl_return) { - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); -} - -ScopedAStatus EvsMockCamera::setIntParameter( - [[maybe_unused]] CameraParam id, [[maybe_unused]] int32_t value, - [[maybe_unused]] std::vector* effectiveValue) { - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); -} - -ScopedAStatus EvsMockCamera::getIntParameter([[maybe_unused]] CameraParam id, - [[maybe_unused]] std::vector* value) { - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); -} - -ScopedAStatus EvsMockCamera::importExternalBuffers( - [[maybe_unused]] const std::vector& buffers, - [[maybe_unused]] int32_t* _aidl_return) { - LOG(DEBUG) << "This implementation does not support an external buffer import."; - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); -} - -bool EvsMockCamera::setAvailableFrames_Locked(unsigned bufferCount) { - if (bufferCount < 1) { - LOG(ERROR) << "Ignoring request to set buffer count to zero"; - return false; - } - if (bufferCount > kMaxBuffersInFlight) { - LOG(ERROR) << "Rejecting buffer request in excess of internal limit"; - return false; - } - - // Is an increase required? - if (mFramesAllowed < bufferCount) { - // An increase is required - auto needed = bufferCount - mFramesAllowed; - LOG(INFO) << "Allocating " << needed << " buffers for camera frames"; - - auto added = increaseAvailableFrames_Locked(needed); - if (added != needed) { - // If we didn't add all the frames we needed, then roll back to the previous state - LOG(ERROR) << "Rolling back to previous frame queue size"; - decreaseAvailableFrames_Locked(added); - return false; - } - } else if (mFramesAllowed > bufferCount) { - // A decrease is required - auto framesToRelease = mFramesAllowed - bufferCount; - LOG(INFO) << "Returning " << framesToRelease << " camera frame buffers"; - - auto released = decreaseAvailableFrames_Locked(framesToRelease); - if (released != framesToRelease) { - // This shouldn't happen with a properly behaving client because the client - // should only make this call after returning sufficient outstanding buffers - // to allow a clean resize. - LOG(ERROR) << "Buffer queue shrink failed -- too many buffers currently in use?"; - } - } - - return true; -} - -unsigned EvsMockCamera::increaseAvailableFrames_Locked(unsigned numToAdd) { - // Acquire the graphics buffer allocator - ::android::GraphicBufferAllocator& alloc(::android::GraphicBufferAllocator::get()); - - unsigned added = 0; - while (added < numToAdd) { - unsigned pixelsPerLine = 0; - buffer_handle_t memHandle = nullptr; - auto result = alloc.allocate(mWidth, mHeight, mFormat, 1, mUsage, &memHandle, - &pixelsPerLine, 0, "EvsMockCamera"); - if (result != ::android::NO_ERROR) { - LOG(ERROR) << "Error " << result << " allocating " << mWidth << " x " << mHeight - << " graphics buffer"; - break; - } - if (memHandle == nullptr) { - LOG(ERROR) << "We didn't get a buffer handle back from the allocator"; - break; - } - if (mStride > 0) { - if (mStride != pixelsPerLine) { - LOG(ERROR) << "We did not expect to get buffers with different strides!"; - } - } else { - // Gralloc defines stride in terms of pixels per line - mStride = pixelsPerLine; - } - - // Find a place to store the new buffer - auto stored = false; - for (auto&& rec : mBuffers) { - if (rec.handle == nullptr) { - // Use this existing entry - rec.handle = memHandle; - rec.inUse = false; - stored = true; - break; - } - } - if (!stored) { - // Add a BufferRecord wrapping this handle to our set of available buffers - mBuffers.push_back(BufferRecord(memHandle)); - } - - ++mFramesAllowed; - ++added; - } - - return added; -} - -unsigned EvsMockCamera::decreaseAvailableFrames_Locked(unsigned numToRemove) { - // Acquire the graphics buffer allocator - ::android::GraphicBufferAllocator& alloc(::android::GraphicBufferAllocator::get()); - - unsigned removed = 0; - for (auto&& rec : mBuffers) { - // Is this record not in use, but holding a buffer that we can free? - if ((rec.inUse == false) && (rec.handle != nullptr)) { - // Release buffer and update the record so we can recognize it as "empty" - alloc.free(rec.handle); - rec.handle = nullptr; - - --mFramesAllowed; - ++removed; - - if (removed == numToRemove) { - break; - } - } - } - - return removed; -} - -// This is the asynchronous frame generation thread that runs in parallel with the -// main serving thread. There is one for each active camera instance. -void EvsMockCamera::generateFrames() { - LOG(DEBUG) << "Frame generation loop started."; - - unsigned idx = 0; - while (true) { - bool timeForFrame = false; - const nsecs_t startTime = systemTime(SYSTEM_TIME_MONOTONIC); - - // Lock scope for updating shared state - { - std::lock_guard lock(mAccessLock); - - if (mStreamState != RUNNING) { - // Break out of our main thread loop - break; - } - - // Are we allowed to issue another buffer? - if (mFramesInUse >= mFramesAllowed) { - // Can't do anything right now -- skip this frame - LOG(WARNING) << "Skipped a frame because too many are in flight."; - } else { - // Identify an available buffer to fill - for (idx = 0; idx < mBuffers.size(); idx++) { - if (!mBuffers[idx].inUse) { - if (mBuffers[idx].handle != nullptr) { - // Found an available record, so stop looking - break; - } - } - } - if (idx >= mBuffers.size()) { - // This shouldn't happen since we already checked mFramesInUse vs mFramesAllowed - ALOGE("Failed to find an available buffer slot\n"); - } else { - // We're going to make the frame busy - mBuffers[idx].inUse = true; - mFramesInUse++; - timeForFrame = true; - } - } - } - - if (timeForFrame) { - using AidlPixelFormat = ::aidl::android::hardware::graphics::common::PixelFormat; - - // Assemble the buffer description we'll transmit below - buffer_handle_t memHandle = mBuffers[idx].handle; - BufferDesc newBuffer = { - .buffer = - { - .description = - { - .width = static_cast(mWidth), - .height = static_cast(mHeight), - .layers = 1, - .format = static_cast(mFormat), - .usage = static_cast(mUsage), - .stride = static_cast(mStride), - }, - .handle = ::android::dupToAidl(memHandle), - }, - .bufferId = static_cast(idx), - .deviceId = mDescription.id, - .timestamp = static_cast(::android::elapsedRealtimeNano() * - 1e+3), // timestamps is in microseconds - }; - - // Write test data into the image buffer - fillMockFrame(memHandle, reinterpret_cast( - &newBuffer.buffer.description)); - - // Issue the (asynchronous) callback to the client -- can't be holding the lock - auto flag = false; - if (mStream) { - std::vector frames; - frames.push_back(std::move(newBuffer)); - flag = mStream->deliverFrame(frames).isOk(); - } - - if (flag) { - LOG(DEBUG) << "Delivered " << memHandle << ", id = " << mBuffers[idx].handle; - } else { - // This can happen if the client dies and is likely unrecoverable. - // To avoid consuming resources generating failing calls, we stop sending - // frames. Note, however, that the stream remains in the "STREAMING" state - // until cleaned up on the main thread. - LOG(ERROR) << "Frame delivery call failed in the transport layer."; - - // Since we didn't actually deliver it, mark the frame as available - std::lock_guard lock(mAccessLock); - mBuffers[idx].inUse = false; - mFramesInUse--; - } - } - - // We arbitrarily choose to generate frames at 15 fps to ensure we pass the 10fps test - // requirement - static const int kTargetFrameRate = 15; - static const nsecs_t kTargetFrameIntervalUs = 1000 * 1000 / kTargetFrameRate; - const nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); - const nsecs_t elapsedTimeUs = (now - startTime) / 1000; - const nsecs_t sleepDurationUs = kTargetFrameIntervalUs - elapsedTimeUs; - if (sleepDurationUs > 0) { - usleep(sleepDurationUs); - } - } - - // If we've been asked to stop, send an event to signal the actual end of stream - EvsEventDesc event = { - .aType = EvsEventType::STREAM_STOPPED, - }; - if (!mStream->notify(event).isOk()) { - ALOGE("Error delivering end of stream marker"); - } - - return; -} - -void EvsMockCamera::fillMockFrame(buffer_handle_t handle, const AHardwareBuffer_Desc* pDesc) { - // Lock our output buffer for writing - uint32_t* pixels = nullptr; - ::android::GraphicBufferMapper& mapper = ::android::GraphicBufferMapper::get(); - mapper.lock(handle, GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_NEVER, - ::android::Rect(pDesc->width, pDesc->height), (void**)&pixels); - - // If we failed to lock the pixel buffer, we're about to crash, but log it first - if (!pixels) { - ALOGE("Camera failed to gain access to image buffer for writing"); - return; - } - - // Fill in the test pixels; the colorbar in ABGR format - for (unsigned row = 0; row < pDesc->height; row++) { - for (unsigned col = 0; col < pDesc->width; col++) { - const uint32_t index = col * kNumColors / pDesc->width; - pixels[col] = kColors[index]; - } - // Point to the next row - // NOTE: stride retrieved from gralloc is in units of pixels - pixels = pixels + pDesc->stride; - } - - // Release our output buffer - mapper.unlock(handle); -} - -void EvsMockCamera::returnBufferLocked(const uint32_t bufferId) { - if (bufferId >= mBuffers.size()) { - ALOGE("ignoring doneWithFrame called with invalid bufferId %d (max is %zu)", bufferId, - mBuffers.size() - 1); - return; - } - - if (!mBuffers[bufferId].inUse) { - ALOGE("ignoring doneWithFrame called on frame %d which is already free", bufferId); - return; - } - - // Mark the frame as available - mBuffers[bufferId].inUse = false; - mFramesInUse--; - - // If this frame's index is high in the array, try to move it down - // to improve locality after mFramesAllowed has been reduced. - if (bufferId >= mFramesAllowed) { - // Find an empty slot lower in the array (which should always exist in this case) - for (auto&& rec : mBuffers) { - if (rec.handle == nullptr) { - rec.handle = mBuffers[bufferId].handle; - mBuffers[bufferId].handle = nullptr; - break; - } - } - } -} - -std::shared_ptr EvsMockCamera::Create(const char* deviceName) { - std::unique_ptr nullCamInfo = nullptr; - - return Create(deviceName, nullCamInfo); -} - -std::shared_ptr EvsMockCamera::Create( - const char* deviceName, std::unique_ptr& camInfo, - [[maybe_unused]] const Stream* streamCfg) { - std::shared_ptr c = - ndk::SharedRefBase::make(Sigil{}, deviceName, camInfo); - if (!c) { - LOG(ERROR) << "Failed to instantiate EvsMockCamera."; - return nullptr; - } - - // Use the first resolution from the list for the testing - // TODO(b/214835237): Uses a given Stream configuration to choose the best - // stream configuration. - auto it = camInfo->streamConfigurations.begin(); - c->mWidth = it->second.width; - c->mHeight = it->second.height; - c->mDescription.vendorFlags = 0xFFFFFFFF; // Arbitrary test value - - c->mFormat = HAL_PIXEL_FORMAT_RGBA_8888; - c->mUsage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_CAMERA_WRITE | - GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_RARELY; - - return c; -} - -} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/src/GlWrapper.cpp b/automotive/evs/aidl/impl/default/src/GlWrapper.cpp deleted file mode 100644 index 0ee5ecb734..0000000000 --- a/automotive/evs/aidl/impl/default/src/GlWrapper.cpp +++ /dev/null @@ -1,465 +0,0 @@ -/* - * 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. - */ - -#include "GlWrapper.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -namespace { - -using ::aidl::android::frameworks::automotive::display::DisplayDesc; -using ::aidl::android::frameworks::automotive::display::ICarDisplayProxy; -using ::aidl::android::frameworks::automotive::display::Rotation; -using ::aidl::android::hardware::common::NativeHandle; -using ::aidl::android::hardware::graphics::common::HardwareBufferDescription; -using ::android::GraphicBuffer; -using ::android::sp; - -constexpr const char vertexShaderSource[] = - "attribute vec4 pos; \n" - "attribute vec2 tex; \n" - "varying vec2 uv; \n" - "void main() \n" - "{ \n" - " gl_Position = pos; \n" - " uv = tex; \n" - "} \n"; - -constexpr const char pixelShaderSource[] = - "precision mediump float; \n" - "uniform sampler2D tex; \n" - "varying vec2 uv; \n" - "void main() \n" - "{ \n" - " gl_FragColor = texture2D(tex, uv);\n" - "} \n"; - -const char* getEGLError(void) { - switch (eglGetError()) { - case EGL_SUCCESS: - return "EGL_SUCCESS"; - case EGL_NOT_INITIALIZED: - return "EGL_NOT_INITIALIZED"; - case EGL_BAD_ACCESS: - return "EGL_BAD_ACCESS"; - case EGL_BAD_ALLOC: - return "EGL_BAD_ALLOC"; - case EGL_BAD_ATTRIBUTE: - return "EGL_BAD_ATTRIBUTE"; - case EGL_BAD_CONTEXT: - return "EGL_BAD_CONTEXT"; - case EGL_BAD_CONFIG: - return "EGL_BAD_CONFIG"; - case EGL_BAD_CURRENT_SURFACE: - return "EGL_BAD_CURRENT_SURFACE"; - case EGL_BAD_DISPLAY: - return "EGL_BAD_DISPLAY"; - case EGL_BAD_SURFACE: - return "EGL_BAD_SURFACE"; - case EGL_BAD_MATCH: - return "EGL_BAD_MATCH"; - case EGL_BAD_PARAMETER: - return "EGL_BAD_PARAMETER"; - case EGL_BAD_NATIVE_PIXMAP: - return "EGL_BAD_NATIVE_PIXMAP"; - case EGL_BAD_NATIVE_WINDOW: - return "EGL_BAD_NATIVE_WINDOW"; - case EGL_CONTEXT_LOST: - return "EGL_CONTEXT_LOST"; - default: - return "Unknown error"; - } -} - -// Given shader source, load and compile it -GLuint loadShader(GLenum type, const char* shaderSrc) { - // Create the shader object - GLuint shader = glCreateShader(type); - if (shader == 0) { - return 0; - } - - // Load and compile the shader - glShaderSource(shader, 1, &shaderSrc, nullptr); - glCompileShader(shader); - - // Verify the compilation worked as expected - GLint compiled = 0; - glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled); - if (!compiled) { - LOG(ERROR) << "Error compiling shader"; - - GLint size = 0; - glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &size); - if (size > 0) { - // Get and report the error message - char* infoLog = (char*)malloc(size); - glGetShaderInfoLog(shader, size, nullptr, infoLog); - LOG(ERROR) << " msg:" << std::endl << infoLog; - free(infoLog); - } - - glDeleteShader(shader); - return 0; - } - - return shader; -} - -// Create a program object given vertex and pixels shader source -GLuint buildShaderProgram(const char* vtxSrc, const char* pxlSrc) { - GLuint program = glCreateProgram(); - if (program == 0) { - LOG(ERROR) << "Failed to allocate program object"; - return 0; - } - - // Compile the shaders and bind them to this program - GLuint vertexShader = loadShader(GL_VERTEX_SHADER, vtxSrc); - if (vertexShader == 0) { - LOG(ERROR) << "Failed to load vertex shader"; - glDeleteProgram(program); - return 0; - } - GLuint pixelShader = loadShader(GL_FRAGMENT_SHADER, pxlSrc); - if (pixelShader == 0) { - LOG(ERROR) << "Failed to load pixel shader"; - glDeleteProgram(program); - glDeleteShader(vertexShader); - return 0; - } - glAttachShader(program, vertexShader); - glAttachShader(program, pixelShader); - - glBindAttribLocation(program, 0, "pos"); - glBindAttribLocation(program, 1, "tex"); - - // Link the program - glLinkProgram(program); - GLint linked = 0; - glGetProgramiv(program, GL_LINK_STATUS, &linked); - if (!linked) { - LOG(ERROR) << "Error linking program"; - GLint size = 0; - glGetProgramiv(program, GL_INFO_LOG_LENGTH, &size); - if (size > 0) { - // Get and report the error message - char* infoLog = (char*)malloc(size); - glGetProgramInfoLog(program, size, nullptr, infoLog); - LOG(ERROR) << " msg: " << infoLog; - free(infoLog); - } - - glDeleteProgram(program); - glDeleteShader(vertexShader); - glDeleteShader(pixelShader); - return 0; - } - - return program; -} - -::android::sp convertNativeHandleToHGBP(const NativeHandle& aidlHandle) { - native_handle_t* handle = ::android::dupFromAidl(aidlHandle); - if (handle->numFds != 0 || handle->numInts < std::ceil(sizeof(size_t) / sizeof(int))) { - LOG(ERROR) << "Invalid native handle"; - return nullptr; - } - ::android::hardware::hidl_vec halToken; - halToken.setToExternal(reinterpret_cast(const_cast(&(handle->data[1]))), - handle->data[0]); - ::android::sp hgbp = - HGraphicBufferProducer::castFrom(::android::retrieveHalInterface(halToken)); - return std::move(hgbp); -} - -} // namespace - -namespace aidl::android::hardware::automotive::evs::implementation { - -// Main entry point -bool GlWrapper::initialize(const std::shared_ptr& pWindowProxy, - uint64_t displayId) { - LOG(DEBUG) << __FUNCTION__; - - if (!pWindowProxy) { - LOG(ERROR) << "Could not get ICarDisplayProxy."; - return false; - } - - DisplayDesc displayDesc; - auto status = pWindowProxy->getDisplayInfo(displayId, &displayDesc); - if (!status.isOk()) { - LOG(ERROR) << "Failed to read the display information"; - return false; - } - - mWidth = displayDesc.width; - mHeight = displayDesc.height; - if ((displayDesc.orientation != Rotation::ROTATION_0) && - (displayDesc.orientation != Rotation::ROTATION_180)) { - std::swap(mWidth, mHeight); - } - LOG(INFO) << "Display resolution is " << mWidth << "x" << mHeight; - - NativeHandle aidlHandle; - status = pWindowProxy->getHGraphicBufferProducer(displayId, &aidlHandle); - if (!status.isOk()) { - LOG(ERROR) << "Failed to get IGraphicBufferProducer from ICarDisplayProxy."; - return false; - } - - mGfxBufferProducer = convertNativeHandleToHGBP(aidlHandle); - if (!mGfxBufferProducer) { - LOG(ERROR) << "Failed to convert a NativeHandle to HGBP."; - return false; - } - - mSurfaceHolder = getSurfaceFromHGBP(mGfxBufferProducer); - if (mSurfaceHolder == nullptr) { - LOG(ERROR) << "Failed to get a Surface from HGBP."; - return false; - } - - mWindow = getNativeWindow(mSurfaceHolder.get()); - if (mWindow == nullptr) { - LOG(ERROR) << "Failed to get a native window from Surface."; - return false; - } - - // Set up our OpenGL ES context associated with the default display - mDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); - if (mDisplay == EGL_NO_DISPLAY) { - LOG(ERROR) << "Failed to get egl display"; - return false; - } - - EGLint major = 2; - EGLint minor = 0; - if (!eglInitialize(mDisplay, &major, &minor)) { - LOG(ERROR) << "Failed to initialize EGL: " << getEGLError(); - return false; - } - - const EGLint config_attribs[] = { - // clang-format off - // Tag Value - EGL_RED_SIZE, 8, - EGL_GREEN_SIZE, 8, - EGL_BLUE_SIZE, 8, - EGL_DEPTH_SIZE, 0, - EGL_NONE - // clang-format on - }; - - // Pick the default configuration without constraints (is this good enough?) - EGLConfig egl_config = {0}; - EGLint numConfigs = -1; - eglChooseConfig(mDisplay, config_attribs, &egl_config, 1, &numConfigs); - if (numConfigs != 1) { - LOG(ERROR) << "Didn't find a suitable format for our display window, " << getEGLError(); - return false; - } - - // Create the EGL render target surface - mSurface = eglCreateWindowSurface(mDisplay, egl_config, mWindow, nullptr); - if (mSurface == EGL_NO_SURFACE) { - LOG(ERROR) << "eglCreateWindowSurface failed, " << getEGLError(); - return false; - } - - // Create the EGL context - // NOTE: Our shader is (currently at least) written to require version 3, so this - // is required. - const EGLint context_attribs[] = {EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE}; - mContext = eglCreateContext(mDisplay, egl_config, EGL_NO_CONTEXT, context_attribs); - if (mContext == EGL_NO_CONTEXT) { - LOG(ERROR) << "Failed to create OpenGL ES Context: " << getEGLError(); - return false; - } - - // Activate our render target for drawing - if (!eglMakeCurrent(mDisplay, mSurface, mSurface, mContext)) { - LOG(ERROR) << "Failed to make the OpenGL ES Context current: " << getEGLError(); - return false; - } - - // Create the shader program for our simple pipeline - mShaderProgram = buildShaderProgram(vertexShaderSource, pixelShaderSource); - if (!mShaderProgram) { - LOG(ERROR) << "Failed to build shader program: " << getEGLError(); - return false; - } - - // Create a GL texture that will eventually wrap our externally created texture surface(s) - glGenTextures(1, &mTextureMap); - if (mTextureMap <= 0) { - LOG(ERROR) << "Didn't get a texture handle allocated: " << getEGLError(); - return false; - } - - // Turn off mip-mapping for the created texture surface - // (the inbound camera imagery doesn't have MIPs) - glBindTexture(GL_TEXTURE_2D, mTextureMap); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glBindTexture(GL_TEXTURE_2D, 0); - - return true; -} - -void GlWrapper::shutdown() { - // Drop our device textures - if (mKHRimage != EGL_NO_IMAGE_KHR) { - eglDestroyImageKHR(mDisplay, mKHRimage); - mKHRimage = EGL_NO_IMAGE_KHR; - } - - // Release all GL resources - if (eglGetCurrentContext() == mContext) { - eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - } - eglDestroySurface(mDisplay, mSurface); - eglDestroyContext(mDisplay, mContext); - eglTerminate(mDisplay); - mSurface = EGL_NO_SURFACE; - mContext = EGL_NO_CONTEXT; - mDisplay = EGL_NO_DISPLAY; - - // Release the window - mSurfaceHolder = nullptr; -} - -void GlWrapper::showWindow(const std::shared_ptr& pWindowProxy, uint64_t id) { - if (pWindowProxy) { - pWindowProxy->showWindow(id); - } else { - LOG(ERROR) << "ICarDisplayProxy is not available."; - } -} - -void GlWrapper::hideWindow(const std::shared_ptr& pWindowProxy, uint64_t id) { - if (pWindowProxy) { - pWindowProxy->hideWindow(id); - } else { - LOG(ERROR) << "ICarDisplayProxy is not available."; - } -} - -bool GlWrapper::updateImageTexture(buffer_handle_t handle, - const HardwareBufferDescription& description) { - if (mKHRimage != EGL_NO_IMAGE_KHR) { - return true; - } - - // Create a temporary GraphicBuffer to wrap the provided handle. - sp pGfxBuffer = - new GraphicBuffer(description.width, description.height, - static_cast<::android::PixelFormat>(description.format), - description.layers, static_cast(description.usage), - description.stride, const_cast(handle), - /* keepOwnership= */ false); - if (!pGfxBuffer) { - LOG(ERROR) << "Failed to allocate GraphicBuffer to wrap our native handle"; - return false; - } - - // Get a GL compatible reference to the graphics buffer we've been given - EGLint eglImageAttributes[] = {EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE}; - EGLClientBuffer cbuf = static_cast(pGfxBuffer->getNativeBuffer()); - mKHRimage = eglCreateImageKHR(mDisplay, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID, cbuf, - eglImageAttributes); - if (mKHRimage == EGL_NO_IMAGE_KHR) { - LOG(ERROR) << "Error creating EGLImage: " << getEGLError(); - return false; - } - - // Update the texture handle we already created to refer to this gralloc buffer - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, mTextureMap); - glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, static_cast(mKHRimage)); - - return true; -} - -void GlWrapper::renderImageToScreen() { - // Set the viewport - glViewport(0, 0, mWidth, mHeight); - - // Clear the color buffer - glClearColor(0.1f, 0.5f, 0.1f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT); - - // Select our screen space simple texture shader - glUseProgram(mShaderProgram); - - // Bind the texture and assign it to the shader's sampler - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, mTextureMap); - GLint sampler = glGetUniformLocation(mShaderProgram, "tex"); - glUniform1i(sampler, 0); - - // We want our image to show up opaque regardless of alpha values - glDisable(GL_BLEND); - - // Draw a rectangle on the screen - GLfloat vertsCarPos[] = { - // clang-format off - -0.8, 0.8, 0.0f, // left top in window space - 0.8, 0.8, 0.0f, // right top - -0.8, -0.8, 0.0f, // left bottom - 0.8, -0.8, 0.0f // right bottom - // clang-format on - }; - - // NOTE: We didn't flip the image in the texture, so V=0 is actually the top of the image - GLfloat vertsCarTex[] = { - // clang-format off - 0.0f, 0.0f, // left top - 1.0f, 0.0f, // right top - 0.0f, 1.0f, // left bottom - 1.0f, 1.0f // right bottom - // clang-format on - }; - glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, vertsCarPos); - glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, vertsCarTex); - glEnableVertexAttribArray(0); - glEnableVertexAttribArray(1); - - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - // Clean up and flip the rendered result to the front so it is visible - glDisableVertexAttribArray(0); - glDisableVertexAttribArray(1); - - glFinish(); - - if (eglSwapBuffers(mDisplay, mSurface) == EGL_FALSE) { - LOG(WARNING) << "Failed to swap EGL buffers, " << getEGLError(); - } -} - -} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/src/service.cpp b/automotive/evs/aidl/impl/default/src/service.cpp index 7532d8735f..0a0913fd3c 100644 --- a/automotive/evs/aidl/impl/default/src/service.cpp +++ b/automotive/evs/aidl/impl/default/src/service.cpp @@ -14,75 +14,38 @@ * limitations under the License. */ -#include "EvsEnumerator.h" -#include "EvsGlDisplay.h" +#define LOG_TAG "EvsService" + +#include #include #include #include -#include +using ::aidl::android::hardware::automotive::evs::implementation::DefaultEvsEnumerator; -#include -#include -#include +int main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) { + std::shared_ptr vhal = ndk::SharedRefBase::make(); -namespace { - -using ::aidl::android::frameworks::automotive::display::ICarDisplayProxy; -using ::aidl::android::hardware::automotive::evs::implementation::EvsEnumerator; - -constexpr std::string_view kDisplayServiceInstanceName = "/default"; -constexpr std::string_view kHwInstanceName = "/hw/0"; -constexpr int kNumBinderThreads = 1; - -} // namespace - -int main() { - LOG(INFO) << "EVS Hardware Enumerator service is starting"; - - const std::string displayServiceInstanceName = - std::string(ICarDisplayProxy::descriptor) + std::string(kDisplayServiceInstanceName); - if (!AServiceManager_isDeclared(displayServiceInstanceName.data())) { - // TODO: We may just want to disable EVS display. - LOG(ERROR) << displayServiceInstanceName << " is required."; - return EXIT_FAILURE; - } - - std::shared_ptr displayService = ICarDisplayProxy::fromBinder( - ::ndk::SpAIBinder(AServiceManager_waitForService(displayServiceInstanceName.data()))); - if (!displayService) { - LOG(ERROR) << "Cannot use " << displayServiceInstanceName << ". Exiting."; - return EXIT_FAILURE; - } - - // Register our service -- if somebody is already registered by our name, - // they will be killed (their thread pool will throw an exception). - std::shared_ptr service = - ndk::SharedRefBase::make(displayService); - if (!service) { - LOG(ERROR) << "Failed to instantiate the service"; - return EXIT_FAILURE; - } - - const std::string instanceName = - std::string(EvsEnumerator::descriptor) + std::string(kHwInstanceName); - auto err = AServiceManager_addService(service->asBinder().get(), instanceName.data()); + ALOGI("Registering as service..."); + binder_exception_t err = + AServiceManager_addService(vhal->asBinder().get(), "android.hardware.automotive.evs"); if (err != EX_NONE) { - LOG(ERROR) << "Failed to register " << instanceName << ", exception = " << err; - return EXIT_FAILURE; + ALOGE("failed to register android.hardware.automotive.evs service, exception: %d", err); + return 1; } - if (!ABinderProcess_setThreadPoolMaxThreadCount(kNumBinderThreads)) { - LOG(ERROR) << "Failed to set thread pool"; - return EXIT_FAILURE; + if (!ABinderProcess_setThreadPoolMaxThreadCount(1)) { + ALOGE("%s", "failed to set thread pool max thread count"); + return 1; } - ABinderProcess_startThreadPool(); - LOG(INFO) << "EVS Hardware Enumerator is ready"; + + ALOGI("Evs Service Ready"); ABinderProcess_joinThreadPool(); - // In normal operation, we don't expect the thread pool to exit - LOG(INFO) << "EVS Hardware Enumerator is shutting down"; - return EXIT_SUCCESS; + + ALOGI("Evs Service Exiting"); + + return 0; } From 0716d7d56bd4268d263d3ca187c689d4116f13b8 Mon Sep 17 00:00:00 2001 From: Joshua McCloskey Date: Mon, 13 Mar 2023 22:19:28 +0000 Subject: [PATCH 823/998] Updated aidl doc w/ regard to lockout. Test: N/A Bug: 250071647 Change-Id: I774640b6f7a3f6397b6acbdb48c8ab14c6001a12 --- .../face/aidl/android/hardware/biometrics/face/ISession.aidl | 2 ++ .../android/hardware/biometrics/face/ISessionCallback.aidl | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl index a92b3667fe..2be76cb901 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl @@ -178,6 +178,8 @@ interface ISession { * 2) A face is rejected, and ISessionCallback#onAuthenticationFailed is invoked. * 3) Any non-recoverable error occurs (such as lockout). See the full list of * authentication-specific errors in the Error enum. + * 4) ISessionCallback#onLockoutPermanent is invoked. + * 5) ISessionCallback#onLockoutTimed is invoked. * * Note that upon successful authentication, the lockout counter for this (sensorId, userId) * pair must be cleared. diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/ISessionCallback.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/ISessionCallback.aidl index b3c348d521..9eb575cc3c 100644 --- a/biometrics/face/aidl/android/hardware/biometrics/face/ISessionCallback.aidl +++ b/biometrics/face/aidl/android/hardware/biometrics/face/ISessionCallback.aidl @@ -119,6 +119,8 @@ interface ISessionCallback { * lockout, and authentication can be restarted after a period of time. See * ISession#resetLockout. * + * This ends the authentication lifecycle. + * * @param sensorId Sensor for which the user is locked out. * @param userId User for which the sensor is locked out. * @param durationMillis Remaining duration of the lockout. @@ -131,6 +133,8 @@ interface ISessionCallback { * Authentication is disabled until the user unlocks with their device credential * (PIN/Pattern/Password). See ISession#resetLockout. * + * This ends the authentication lifecycle. + * * @param sensorId Sensor for which the user is locked out. * @param userId User for which the sensor is locked out. */ From fbe75bbcf1504fe33ec2733cd85dd13bdcce8884 Mon Sep 17 00:00:00 2001 From: ziyiw Date: Tue, 14 Mar 2023 00:17:23 +0000 Subject: [PATCH 824/998] Add new reason code and status code for session conflict. Also assigned a new number to the UWB regulation off status/reason code. Test: compile Bug: 272361935 Change-Id: I4cbf2443d7e3ec914ee465d9128fef5225a74712 --- .../hardware/uwb/fira_android/UwbVendorReasonCodes.aidl | 3 ++- .../hardware/uwb/fira_android/UwbVendorStatusCodes.aidl | 3 ++- .../hardware/uwb/fira_android/UwbVendorReasonCodes.aidl | 4 +++- .../hardware/uwb/fira_android/UwbVendorStatusCodes.aidl | 4 +++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl index d1f12569b8..a438cbe16a 100644 --- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl @@ -35,5 +35,6 @@ package android.hardware.uwb.fira_android; @Backing(type="int") @VintfStability enum UwbVendorReasonCodes { REASON_ERROR_INVALID_CHANNEL_WITH_AOA = 128, - REASON_REGULATION_UWB_OFF = 129, + REASON_ERROR_STOPPED_DUE_TO_OTHER_SESSION_CONFLICT = 129, + REASON_REGULATION_UWB_OFF = 130, } diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl index 768ef8ce24..28cf7fe1f3 100644 --- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl @@ -36,5 +36,6 @@ package android.hardware.uwb.fira_android; enum UwbVendorStatusCodes { STATUS_ERROR_CCC_SE_BUSY = 80, STATUS_ERROR_CCC_LIFECYCLE = 81, - STATUS_REGULATION_UWB_OFF = 82, + STATUS_ERROR_STOPPED_DUE_TO_OTHER_SESSION_CONFLICT = 82, + STATUS_REGULATION_UWB_OFF = 83, } diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl index a64a18884d..4207574108 100644 --- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl +++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorReasonCodes.aidl @@ -31,6 +31,8 @@ enum UwbVendorReasonCodes { /** Fira specific */ /** The channel requested is not available for AoA */ REASON_ERROR_INVALID_CHANNEL_WITH_AOA = 0x80, + /** UWB stopped caused by other session conflict */ + REASON_ERROR_STOPPED_DUE_TO_OTHER_SESSION_CONFLICT = 0x81, /** UWB has been disabled (eg: country code change leads to UWB unsupported) */ - REASON_REGULATION_UWB_OFF = 0x81, + REASON_REGULATION_UWB_OFF = 0x82, } diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl index f1eea9d397..f952334fd1 100644 --- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl +++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl @@ -33,6 +33,8 @@ enum UwbVendorStatusCodes { STATUS_ERROR_CCC_SE_BUSY = 0x50, /** CCC Lifecycle error */ STATUS_ERROR_CCC_LIFECYCLE = 0x51, + /** Other session conflict */ + STATUS_ERROR_STOPPED_DUE_TO_OTHER_SESSION_CONFLICT = 0x52, /** UWB Regulation Off */ - STATUS_REGULATION_UWB_OFF = 0x52, + STATUS_REGULATION_UWB_OFF = 0x53, } From dced9c7772590c49de1bd1b868aa0a8c01e6e950 Mon Sep 17 00:00:00 2001 From: shrikar Date: Tue, 14 Mar 2023 18:08:20 +0000 Subject: [PATCH 825/998] Removing DRIVER_ATTENTION_MONITORING properties from HAL layer. Bug: 273522827 Test: atest VtsHalAutomotiveVehicle_TargetTest Change-Id: Id7c505960b5395812e0d420997b3a0917bf02ba2 --- .../cpp/AccessForVehicleProperty.h | 3 - .../cpp/ChangeModeForVehicleProperty.h | 3 - .../java/AccessForVehicleProperty.java | 5 +- .../java/ChangeModeForVehicleProperty.java | 5 +- .../JsonConfigLoader/src/JsonConfigLoader.cpp | 6 -- .../config/DefaultProperties.json | 44 ------------- .../utils/common/include/VehicleHalTypes.h | 2 - .../DriverAttentionMonitoringState.aidl | 40 ----------- .../DriverAttentionMonitoringWarning.aidl | 40 ----------- .../automotive/vehicle/VehicleProperty.aidl | 3 - .../DriverAttentionMonitoringState.aidl | 43 ------------ .../DriverAttentionMonitoringWarning.aidl | 43 ------------ .../automotive/vehicle/VehicleProperty.aidl | 66 ------------------- .../VtsHalAutomotiveVehicle_TargetTest.cpp | 18 ----- 14 files changed, 2 insertions(+), 319 deletions(-) delete mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverAttentionMonitoringState.aidl delete mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverAttentionMonitoringWarning.aidl delete mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverAttentionMonitoringState.aidl delete mode 100644 automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverAttentionMonitoringWarning.aidl diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h index c8a36b82eb..d0c6e83ebe 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h @@ -272,9 +272,6 @@ std::unordered_map AccessForVehiclePrope {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess::READ_WRITE}, {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess::READ}, {VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess::READ}, - {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess::READ_WRITE}, - {VehicleProperty::DRIVER_ATTENTION_MONITORING_STATE, VehiclePropertyAccess::READ}, - {VehicleProperty::DRIVER_ATTENTION_MONITORING_WARNING, VehiclePropertyAccess::READ}, }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h index bea5002c9f..48532c93ca 100644 --- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h +++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h @@ -272,9 +272,6 @@ std::unordered_map ChangeModeForVehi {VehicleProperty::HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyChangeMode::ON_CHANGE}, {VehicleProperty::HANDS_ON_DETECTION_WARNING, VehiclePropertyChangeMode::ON_CHANGE}, - {VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE}, - {VehicleProperty::DRIVER_ATTENTION_MONITORING_STATE, VehiclePropertyChangeMode::ON_CHANGE}, - {VehicleProperty::DRIVER_ATTENTION_MONITORING_WARNING, VehiclePropertyChangeMode::ON_CHANGE}, }; } // namespace vehicle diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java index ee214efb67..758670d588 100644 --- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java @@ -263,10 +263,7 @@ public final class AccessForVehicleProperty { Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, VehiclePropertyAccess.READ), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyAccess.READ_WRITE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyAccess.READ), - Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess.READ), - Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyAccess.READ_WRITE), - Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_STATE, VehiclePropertyAccess.READ), - Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_WARNING, VehiclePropertyAccess.READ) + Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyAccess.READ) ); } diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java index d3cf71e6a4..29069f8de4 100644 --- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java +++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java @@ -263,10 +263,7 @@ public final class ChangeModeForVehicleProperty { Map.entry(VehicleProperty.ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, VehiclePropertyChangeMode.CONTINUOUS), Map.entry(VehicleProperty.HANDS_ON_DETECTION_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), Map.entry(VehicleProperty.HANDS_ON_DETECTION_DRIVER_STATE, VehiclePropertyChangeMode.ON_CHANGE), - Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyChangeMode.ON_CHANGE), - Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE), - Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_STATE, VehiclePropertyChangeMode.ON_CHANGE), - Map.entry(VehicleProperty.DRIVER_ATTENTION_MONITORING_WARNING, VehiclePropertyChangeMode.ON_CHANGE) + Map.entry(VehicleProperty.HANDS_ON_DETECTION_WARNING, VehiclePropertyChangeMode.ON_CHANGE) ); } diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp index d92107945e..ec0d310508 100644 --- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp +++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp @@ -41,8 +41,6 @@ using ::aidl::android::hardware::automotive::vehicle::ChangeModeForVehicleProper using ::aidl::android::hardware::automotive::vehicle::CruiseControlCommand; using ::aidl::android::hardware::automotive::vehicle::CruiseControlState; using ::aidl::android::hardware::automotive::vehicle::CruiseControlType; -using ::aidl::android::hardware::automotive::vehicle::DriverAttentionMonitoringState; -using ::aidl::android::hardware::automotive::vehicle::DriverAttentionMonitoringWarning; using ::aidl::android::hardware::automotive::vehicle::EmergencyLaneKeepAssistState; using ::aidl::android::hardware::automotive::vehicle::ErrorState; using ::aidl::android::hardware::automotive::vehicle::EvConnectorType; @@ -245,10 +243,6 @@ JsonValueParser::JsonValueParser() { std::make_unique>(); mConstantParsersByType["HandsOnDetectionWarning"] = std::make_unique>(); - mConstantParsersByType["DriverAttentionMonitoringState"] = - std::make_unique>(); - mConstantParsersByType["DriverAttentionMonitoringWarning"] = - std::make_unique>(); mConstantParsersByType["ErrorState"] = std::make_unique>(); mConstantParsersByType["AutomaticEmergencyBrakingState"] = std::make_unique>(); diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 8476c1b01c..28790e2982 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3536,50 +3536,6 @@ } ] }, - { - "property": "VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED", - "defaultValue": { - "int32Values": [ - 1 - ] - } - }, - { - "property": "VehicleProperty::DRIVER_ATTENTION_MONITORING_STATE", - "defaultValue": { - "int32Values": [ - "DriverAttentionMonitoringState::NOT_DISTRACTED" - ] - }, - "areas": [ - { - "areaId": 0, - "supportedEnumValues": [ - "ErrorState::NOT_AVAILABLE_DISABLED", - "DriverAttentionMonitoringState::DISTRACTED", - "DriverAttentionMonitoringState::NOT_DISTRACTED" - ] - } - ] - }, - { - "property": "VehicleProperty::DRIVER_ATTENTION_MONITORING_WARNING", - "defaultValue": { - "int32Values": [ - "DriverAttentionMonitoringWarning::NO_WARNING" - ] - }, - "areas": [ - { - "areaId": 0, - "supportedEnumValues": [ - "ErrorState::NOT_AVAILABLE_DISABLED", - "DriverAttentionMonitoringWarning::NO_WARNING", - "DriverAttentionMonitoringWarning::WARNING" - ] - } - ] - }, { "property": "VehicleProperty::INITIAL_USER_INFO" }, diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h index 7db4246333..e6d657d675 100644 --- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h +++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h @@ -24,8 +24,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverAttentionMonitoringState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverAttentionMonitoringState.aidl deleted file mode 100644 index 925f4474e0..0000000000 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverAttentionMonitoringState.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 -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.hardware.automotive.vehicle; -@Backing(type="int") @VintfStability -enum DriverAttentionMonitoringState { - OTHER = 0, - DISTRACTED = 1, - NOT_DISTRACTED = 2, -} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverAttentionMonitoringWarning.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverAttentionMonitoringWarning.aidl deleted file mode 100644 index 758b251702..0000000000 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/DriverAttentionMonitoringWarning.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 -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.hardware.automotive.vehicle; -@Backing(type="int") @VintfStability -enum DriverAttentionMonitoringWarning { - OTHER = 0, - NO_WARNING = 1, - WARNING = 2, -} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl index e0267f3aec..ba75e7b261 100644 --- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -270,7 +270,4 @@ enum VehicleProperty { HANDS_ON_DETECTION_ENABLED = (((0x1016 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313942 */, HANDS_ON_DETECTION_DRIVER_STATE = (((0x1017 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411095 */, HANDS_ON_DETECTION_WARNING = (((0x1018 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411096 */, - DRIVER_ATTENTION_MONITORING_ENABLED = (((0x1019 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313945 */, - DRIVER_ATTENTION_MONITORING_STATE = (((0x101A + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411098 */, - DRIVER_ATTENTION_MONITORING_WARNING = (((0x101B + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411099 */, } diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverAttentionMonitoringState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverAttentionMonitoringState.aidl deleted file mode 100644 index 7ebf844274..0000000000 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverAttentionMonitoringState.aidl +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.hardware.automotive.vehicle; - -/** - * Used to enumerate the current driver state of Driver Attention Monitoring. - * - * This enum could be extended in future releases to include additional feature states. - */ -@VintfStability -@Backing(type="int") -enum DriverAttentionMonitoringState { - /** - * This state is used as an alternative for any DriverAttentionMonitoringState value that is - * not defined in the platform. Ideally, implementations of - * VehicleProperty#DRIVER_ATTENTION_MONITORING_STATE should not use this state. The - * framework can use this field to remain backwards compatible if DriverAttentionMonitoringState - * is extended to include additional states. - */ - OTHER = 0, - /** - * The system detects that the driver is distracted. - */ - DISTRACTED = 1, - /** - * The system detects that the driver is attentive / not distracted. - */ - NOT_DISTRACTED = 2, -} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverAttentionMonitoringWarning.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverAttentionMonitoringWarning.aidl deleted file mode 100644 index 373dd7f763..0000000000 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/DriverAttentionMonitoringWarning.aidl +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.hardware.automotive.vehicle; - -/** - * Used to enumerate the current warning state of Driver Attention Monitoring. - */ -@VintfStability -@Backing(type="int") -enum DriverAttentionMonitoringWarning { - /** - * This state is used as an alternative for any DriverAttentionMonitoringWarning value that is - * defined in the platform. Ideally, implementations of - * VehicleProperty#DRIVER_ATTENTION_MONITORING_WARNING should not use this state. The framework - * can use this field to remain backwards compatible if DriverAttentionMonitoringWarning is - * extended to include additional states. - */ - OTHER = 0, - /** - * Driver Attention Monitoring is enabled and the driver's current state does not warrant - * sending a warning. - */ - NO_WARNING = 1, - /** - * Driver Attention Monitoring is enabled and the driver has been distracted for too long of a - * duration, and the vehicle is sending a warning to the driver as a consequence of this. - */ - WARNING = 2, -} diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index cd1f2947fe..7856e9ab3e 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -4165,72 +4165,6 @@ enum VehicleProperty { HANDS_ON_DETECTION_WARNING = 0x1018 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, - /** - * Enable or disable driver attention monitoring. - * - * Set true to enable driver attention monitoring and false to disable driver attention - * monitoring. When driver attention monitoring is enabled, a system inside the vehicle should - * be monitoring the attention level of the driver and should send a warning if it detects that - * the driver is distracted. - * - * In general, DRIVER_ATTENTION_MONITORING_ENABLED should always return true or false. If the - * feature is not available due to some temporary state, that information must be conveyed - * through the ErrorState values in the DRIVER_ATTENTION_MONITORING_STATE property. - * - * This property is defined as read_write, but OEMs have the option to implement it as read - * only. - * - * @change_mode VehiclePropertyChangeMode.ON_CHANGE - * @access VehiclePropertyAccess.READ_WRITE - */ - DRIVER_ATTENTION_MONITORING_ENABLED = - 0x1019 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN, - - /** - * Driver attention monitoring state. - * - * Returns whether the driver is currently attentive or distracted. Generally, this property - * should return a valid state defined in the DriverAttentionMonitoringState or ErrorState. For - * example, if the feature is not available due to some temporary state, that information should - * be conveyed through an ErrorState. - * - * If the vehicle wants to send a warning to the user because the driver has been distracted for - * too long, the warning should be surfaced through DRIVER_ATTENTION_MONITORING_WARNING. - * - * The VehicleAreaConfig#configArray array must define all states from - * DriverAttentionMonitoringState (including OTHER, which is not recommended) and ErrorState - * that are supported. - * - * @change_mode VehiclePropertyChangeMode.ON_CHANGE - * @access VehiclePropertyAccess.READ - * @data_enum DriverAttentionMonitoringState - * @data_enum ErrorState - */ - DRIVER_ATTENTION_MONITORING_STATE = - 0x101A + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, - - /** - * Driver attention monitoring warning. - * - * Returns whether a warning is being sent to the driver for being distracted for too long a - * duration. - * - * Generally, this property should return a valid state defined in the - * DriverAttentionMonitoringWarning or ErrorState. For example, if the feature is not available - * due to some temporary state, that information should be conveyed through an ErrorState. - * - * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined - * unless all states of both DriverAttentionMonitoringWarning (including OTHER, which is not - * recommended) and ErrorState are supported. - * - * @change_mode VehiclePropertyChangeMode.ON_CHANGE - * @access VehiclePropertyAccess.READ - * @data_enum DriverAttentionMonitoringWarning - * @data_enum ErrorState - */ - DRIVER_ATTENTION_MONITORING_WARNING = - 0x101B + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32, - /*************************************************************************** * End of ADAS Properties **************************************************************************/ diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp index 90fc7270d3..8bcad1e0cb 100644 --- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp +++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp @@ -601,24 +601,6 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyHandsOnDetectionWarningConfig) { VehicleArea::GLOBAL, VehiclePropertyType::INT32); } -TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverAttentionMonitoringEnabledConfig) { - verifyProperty(VehicleProperty::DRIVER_ATTENTION_MONITORING_ENABLED, - VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, - VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN); -} - -TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverAttentionMonitoringStateConfig) { - verifyProperty(VehicleProperty::DRIVER_ATTENTION_MONITORING_STATE, VehiclePropertyAccess::READ, - VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM, - VehicleArea::GLOBAL, VehiclePropertyType::INT32); -} - -TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyDriverAttentionMonitoringWarningConfig) { - verifyProperty(VehicleProperty::DRIVER_ATTENTION_MONITORING_WARNING, - VehiclePropertyAccess::READ, VehiclePropertyChangeMode::ON_CHANGE, - VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::INT32); -} - TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyEvBrakeRegenerationLevelConfig) { verifyProperty(VehicleProperty::EV_BRAKE_REGENERATION_LEVEL, VehiclePropertyAccess::READ_WRITE, VehiclePropertyChangeMode::ON_CHANGE, From 8f4111ca7daa9fe35f0785c4995c3ddde21f4da1 Mon Sep 17 00:00:00 2001 From: Avichal Rakesh Date: Fri, 3 Mar 2023 15:27:45 -0800 Subject: [PATCH 826/998] camera: Add logId to StreamConfiguration For data analysis from HAL logs, it is helpful to get some higher level information of the camera usage (such as the client's package name). HALs are denied access to this higher level information at runtime. To help data with data analysis, cameraservice will now pass a session identifier when configuring streams. This identifier can be used to correlate HAL logs with cameraservice logs at the time of log consumption. However this correlation cannot be made at runtime. This identifier is randomly generated and has no functional purpose and can be safely disregarded by HAL implementations that don't want to correlate their logs to cameraservice logs. Bug: 271171714 Test: Manually verified that cameraservice sends correct logId to the HAL. Change-Id: Ib0823a9de8f573233a6e037c178a4398eb26e7ef --- .../hardware/camera/device/CameraBlobId.aidl | 4 ++-- .../hardware/camera/device/RequestTemplate.aidl | 2 +- .../camera/device/StreamConfiguration.aidl | 1 + .../camera/device/StreamConfigurationMode.aidl | 16 ++++++++-------- .../camera/device/StreamConfiguration.aidl | 11 ++++++++++- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/CameraBlobId.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/CameraBlobId.aidl index 632499d55d..24083ad512 100644 --- a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/CameraBlobId.aidl +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/CameraBlobId.aidl @@ -34,6 +34,6 @@ package android.hardware.camera.device; @Backing(type="int") @VintfStability enum CameraBlobId { - JPEG = 255, - JPEG_APP_SEGMENTS = 256, + JPEG = 0x00FF, + JPEG_APP_SEGMENTS = 0x100, } diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/RequestTemplate.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/RequestTemplate.aidl index b70b8997d9..1f87aa338d 100644 --- a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/RequestTemplate.aidl +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/RequestTemplate.aidl @@ -40,5 +40,5 @@ enum RequestTemplate { VIDEO_SNAPSHOT = 4, ZERO_SHUTTER_LAG = 5, MANUAL = 6, - VENDOR_TEMPLATE_START = 1073741824, + VENDOR_TEMPLATE_START = 0x40000000, } diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamConfiguration.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamConfiguration.aidl index f3405780be..97fd067b8d 100644 --- a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamConfiguration.aidl +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamConfiguration.aidl @@ -39,4 +39,5 @@ parcelable StreamConfiguration { android.hardware.camera.device.CameraMetadata sessionParams; int streamConfigCounter; boolean multiResolutionInputImage; + long logId = 0; } diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamConfigurationMode.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamConfigurationMode.aidl index bdef41209d..ef7ec25d07 100644 --- a/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamConfigurationMode.aidl +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/current/android/hardware/camera/device/StreamConfigurationMode.aidl @@ -36,12 +36,12 @@ package android.hardware.camera.device; enum StreamConfigurationMode { NORMAL_MODE = 0, CONSTRAINED_HIGH_SPEED_MODE = 1, - VENDOR_MODE_0 = 32768, - VENDOR_MODE_1 = 32769, - VENDOR_MODE_2 = 32770, - VENDOR_MODE_3 = 32771, - VENDOR_MODE_4 = 32772, - VENDOR_MODE_5 = 32773, - VENDOR_MODE_6 = 32774, - VENDOR_MODE_7 = 32775, + VENDOR_MODE_0 = 0x8000, + VENDOR_MODE_1, + VENDOR_MODE_2, + VENDOR_MODE_3, + VENDOR_MODE_4, + VENDOR_MODE_5, + VENDOR_MODE_6, + VENDOR_MODE_7, } diff --git a/camera/device/aidl/android/hardware/camera/device/StreamConfiguration.aidl b/camera/device/aidl/android/hardware/camera/device/StreamConfiguration.aidl index cacd32c171..197d9af588 100644 --- a/camera/device/aidl/android/hardware/camera/device/StreamConfiguration.aidl +++ b/camera/device/aidl/android/hardware/camera/device/StreamConfiguration.aidl @@ -62,7 +62,7 @@ parcelable StreamConfiguration { */ CameraMetadata sessionParams; - /** + /** * An incrementing counter used for HAL to keep track of the stream * configuration and the paired oneway signalStreamFlush call. When the * counter in signalStreamFlush call is less than the counter here, that @@ -83,4 +83,13 @@ parcelable StreamConfiguration { * any one of the supported multi-resolution input stream sizes. */ boolean multiResolutionInputImage; + + /** + * Logging identifier to join HAL logs to logs collected by cameraservice. This field has no + * functional purpose. + * + * See documentation of 'mLogId' in frameworks/av/camera/include/camera/CameraSessionStats.h + * for specifics of this identifier and how it can be used to join with cameraservice logs. + */ + long logId = 0; } From 63aa43987b9ad53e7552d66a82186df5d4b05926 Mon Sep 17 00:00:00 2001 From: shrikar Date: Fri, 3 Mar 2023 20:02:06 +0000 Subject: [PATCH 827/998] Updated SEAT_MEMORY_SELECT maxValue documentation. Specified that maxValue must be equal to (numSeatPositions - 1). Bug: 262358054 Test: manual build Change-Id: I41304f5ca0dc4d997543a0f059c7486f179e5526 --- automotive/vehicle/2.0/types.hal | 6 +++--- .../hardware/automotive/vehicle/VehicleProperty.aidl | 6 +++--- current.txt | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/automotive/vehicle/2.0/types.hal b/automotive/vehicle/2.0/types.hal index 00d0452bcb..d75b046774 100644 --- a/automotive/vehicle/2.0/types.hal +++ b/automotive/vehicle/2.0/types.hal @@ -1810,11 +1810,11 @@ enum VehicleProperty : int32_t { * * This parameter selects the memory preset to use to select the seat * position. The minValue is always 0, and the maxValue determines the - * number of seat positions available. + * number of seat positions available (i.e. numSeatPositions - 1). * * For instance, if the driver's seat has 3 memory presets, the maxValue - * will be 3. When the user wants to select a preset, the desired preset - * number (1, 2, or 3) is set. + * will be 2. When the user wants to select a preset, the desired preset + * number (0, 1, or 2) is set. * * @change_mode VehiclePropertyChangeMode:ON_CHANGE * @access VehiclePropertyAccess:WRITE diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index cd1f2947fe..b9ded39982 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1596,11 +1596,11 @@ enum VehicleProperty { * * This parameter selects the memory preset to use to select the seat * position. The minValue is always 0, and the maxValue determines the - * number of seat positions available. + * number of seat preset memory slots available (i.e. numSeatPresets - 1). * * For instance, if the driver's seat has 3 memory presets, the maxValue - * will be 3. When the user wants to select a preset, the desired preset - * number (1, 2, or 3) is set. + * will be 2. When the user wants to select a preset, the desired preset + * number (0, 1, or 2) is set. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.WRITE diff --git a/current.txt b/current.txt index c40f9ea9b6..a6c4d807cf 100644 --- a/current.txt +++ b/current.txt @@ -936,5 +936,6 @@ b7ce2d87841585551b082fca6d099622e63b7099e0d8013f687ea1a1dc35c4dc android.hardwar a2fbd9747fbb9ceb8c1090b5a24138312246502d5af0654a8c2b603a9bf521fc android.hardware.gnss@1.0::IGnssCallback 889b59e3e7a59afa67bf19882a44f51a2f9e43b6556ec52baa9ec3efd1ef7fbe android.hardware.camera.device@3.2::types db37a1c757e2e69b1ec9c75a981a6987bd87a131d92ab6acc00e04d19f374281 android.hardware.automotive.vehicle@2.0::types +997017f581406fca1675d2f612f7ccd73f0d04eadd54bf6212e6cf5971d0872d android.hardware.automotive.vehicle@2.0::types # There will be no more HIDL HALs. Use AIDL instead. From 5b85c927c6f3c42d8b99a7a3d3361a560c55567a Mon Sep 17 00:00:00 2001 From: shrikar Date: Mon, 13 Mar 2023 21:18:22 +0000 Subject: [PATCH 828/998] Added info to docs to answer Q9 from Ford pending questions. Bug: 259309511 Test: manual build Change-Id: Ibd47982ba7426519ca03dd110b2b6bc5fd2e8e71 --- .../android/hardware/automotive/vehicle/VehicleProperty.aidl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index cd1f2947fe..1c613d078c 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -407,6 +407,10 @@ enum VehicleProperty { * all energy sources in a vehicle. For example, a hybrid car's range will * be the sum of the ranges based on fuel and battery. * + * This property may be writable because a navigation app could update the range if it has a + * more accurate estimate based on the upcoming route. However, this property can be set to + * VehiclePropertyAccess.READ only at the OEM's discretion. + * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ_WRITE * @unit VehicleUnit:METER From acfeb13d5fca494b3ad53b6102d125aeea8efd20 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 15 Mar 2023 13:32:23 -0700 Subject: [PATCH 829/998] Adjust TvMessageEventType enum to match Java framework Changing the "Other" value to match the value at frameworks/base/media/java/android/media/tv/TvInputManager.java Bug: 273794209 Test: mmm Change-Id: I88ff78edb7d133c0e5b51be301d8f71dea8e34ae --- .../current/android/hardware/tv/input/TvMessageEventType.aidl | 2 +- tv/input/aidl/android/hardware/tv/input/TvMessageEventType.aidl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessageEventType.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessageEventType.aidl index a033903814..3006198c68 100644 --- a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessageEventType.aidl +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessageEventType.aidl @@ -36,5 +36,5 @@ package android.hardware.tv.input; enum TvMessageEventType { WATERMARK = 1, CLOSED_CAPTION = 2, - OTHER = 3, + OTHER = 1000, } diff --git a/tv/input/aidl/android/hardware/tv/input/TvMessageEventType.aidl b/tv/input/aidl/android/hardware/tv/input/TvMessageEventType.aidl index 5a5f472a77..518c7fc441 100644 --- a/tv/input/aidl/android/hardware/tv/input/TvMessageEventType.aidl +++ b/tv/input/aidl/android/hardware/tv/input/TvMessageEventType.aidl @@ -21,5 +21,5 @@ package android.hardware.tv.input; enum TvMessageEventType { WATERMARK = 1, CLOSED_CAPTION = 2, - OTHER = 3, + OTHER = 1000, } From 6c3a1d8beb74c1254ff7af16522cb9f5842409ff Mon Sep 17 00:00:00 2001 From: Eric Jeong Date: Thu, 16 Mar 2023 00:45:40 -0700 Subject: [PATCH 830/998] Add getProcessorId to support multiple processors in remote access Bug: 262483074 Test: atest RemoteAccessServiceUnitTest Change-Id: I88dedb7ef914bd72772a4bbae2b283836bd1d19a --- .../remoteaccess/IRemoteAccess.aidl | 3 +- .../remoteaccess/IRemoteAccess.aidl | 21 +++++++++--- .../hal/default/include/RemoteAccessService.h | 8 +++-- .../hal/default/src/RemoteAccessService.cpp | 34 +++++++++++-------- .../test/RemoteAccessServiceUnitTest.cpp | 12 +++---- 5 files changed, 49 insertions(+), 29 deletions(-) diff --git a/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/current/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl b/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/current/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl index 9b6eb2f297..b0935c2fb2 100644 --- a/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/current/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl +++ b/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/current/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl @@ -34,8 +34,9 @@ package android.hardware.automotive.remoteaccess; @VintfStability interface IRemoteAccess { - String getDeviceId(); + String getVehicleId(); String getWakeupServiceName(); + String getProcessorId(); void setRemoteTaskCallback(android.hardware.automotive.remoteaccess.IRemoteTaskCallback callback); void clearRemoteTaskCallback(); void notifyApStateChange(in android.hardware.automotive.remoteaccess.ApState state); diff --git a/automotive/remoteaccess/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl b/automotive/remoteaccess/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl index a198b038a5..0f4125f475 100644 --- a/automotive/remoteaccess/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl +++ b/automotive/remoteaccess/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl @@ -28,19 +28,19 @@ import android.hardware.automotive.remoteaccess.IRemoteTaskCallback; @VintfStability interface IRemoteAccess { /** - * Gets a unique device ID that could be recognized by wake up server. + * Gets a unique vehicle ID that could be recognized by wake up server. * - * This device ID is provisioned during car production and is registered + *

This vehicle ID is provisioned during car production and is registered * with the wake up server. * - * @return a unique device ID. + * @return a unique vehicle ID. */ - String getDeviceId(); + String getVehicleId(); /** * Gets the name for the remote wakeup server. * - * This name will be provided to remote task server during registration + *

This name will be provided to remote task server during registration * and used by remote task server to find the remote wakeup server to * use for waking up the device. This name must be pre-negotiated between * the remote wakeup server/client and the remote task server/client and @@ -50,6 +50,17 @@ interface IRemoteAccess { */ String getWakeupServiceName(); + /** + * Gets a unique processor ID that could be recognized by wake up client. + * + *

This processor ID is used to identify each processor in the vehicle. + * The wake up client which handles many processors determines which + * processor to wake up from the processor ID. + * + *

The processor ID must be unique in the vehicle. + */ + String getProcessorId(); + /** * Sets a callback to be called when a remote task is requested. * diff --git a/automotive/remoteaccess/hal/default/include/RemoteAccessService.h b/automotive/remoteaccess/hal/default/include/RemoteAccessService.h index 74c2af4c9f..5cfca613f4 100644 --- a/automotive/remoteaccess/hal/default/include/RemoteAccessService.h +++ b/automotive/remoteaccess/hal/default/include/RemoteAccessService.h @@ -62,7 +62,9 @@ class RemoteAccessService ~RemoteAccessService(); - ndk::ScopedAStatus getDeviceId(std::string* deviceId) override; + ndk::ScopedAStatus getVehicleId(std::string* vehicleId) override; + + ndk::ScopedAStatus getProcessorId(std::string* processorId) override; ndk::ScopedAStatus getWakeupServiceName(std::string* wakeupServiceName) override; @@ -103,8 +105,8 @@ class RemoteAccessService void runTaskLoop(); void maybeStartTaskLoop(); void maybeStopTaskLoop(); - ndk::ScopedAStatus getDeviceIdWithClient( - android::frameworks::automotive::vhal::IVhalClient& client, std::string* deviceId); + ndk::ScopedAStatus getVehicleIdWithClient( + android::frameworks::automotive::vhal::IVhalClient& client, std::string* vehicleId); void setRetryWaitInMs(size_t retryWaitInMs) { mRetryWaitInMs = retryWaitInMs; } void dumpHelp(int fd); diff --git a/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp b/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp index 4be30a20fa..d9445933ae 100644 --- a/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp +++ b/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp @@ -48,11 +48,12 @@ using ::grpc::StatusCode; using ::ndk::ScopedAStatus; const std::string WAKEUP_SERVICE_NAME = "com.google.vehicle.wakeup"; +const std::string PROCESSOR_ID = "application_processor"; constexpr char COMMAND_SET_AP_STATE[] = "--set-ap-state"; constexpr char COMMAND_START_DEBUG_CALLBACK[] = "--start-debug-callback"; constexpr char COMMAND_STOP_DEBUG_CALLBACK[] = "--stop-debug-callback"; constexpr char COMMAND_SHOW_TASK[] = "--show-task"; -constexpr char COMMAND_GET_DEVICE_ID[] = "--get-device-id"; +constexpr char COMMAND_GET_VEHICLE_ID[] = "--get-vehicle-id"; std::vector stringToBytes(const std::string& s) { const char* data = s.data(); @@ -176,23 +177,23 @@ void RemoteAccessService::runTaskLoop() { } } -ScopedAStatus RemoteAccessService::getDeviceId(std::string* deviceId) { +ScopedAStatus RemoteAccessService::getVehicleId(std::string* vehicleId) { #ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION auto vhalClient = IVhalClient::tryCreate(); if (vhalClient == nullptr) { ALOGE("Failed to connect to VHAL"); return ScopedAStatus::fromServiceSpecificErrorWithMessage( - /*errorCode=*/0, "Failed to connect to VHAL to get device ID"); + /*errorCode=*/0, "Failed to connect to VHAL to get vehicle ID"); } - return getDeviceIdWithClient(*vhalClient.get(), deviceId); + return getVehicleIdWithClient(*vhalClient.get(), vehicleId); #else // Don't use VHAL client in fuzzing since IPC is not allowed. return ScopedAStatus::ok(); #endif } -ScopedAStatus RemoteAccessService::getDeviceIdWithClient(IVhalClient& vhalClient, - std::string* deviceId) { +ScopedAStatus RemoteAccessService::getVehicleIdWithClient(IVhalClient& vhalClient, + std::string* vehicleId) { auto result = vhalClient.getValueSync( *vhalClient.createHalPropValue(toInt(VehicleProperty::INFO_VIN))); if (!result.ok()) { @@ -200,7 +201,12 @@ ScopedAStatus RemoteAccessService::getDeviceIdWithClient(IVhalClient& vhalClient /*errorCode=*/0, ("failed to get INFO_VIN from VHAL: " + result.error().message()).c_str()); } - *deviceId = (*result)->getStringValue(); + *vehicleId = (*result)->getStringValue(); + return ScopedAStatus::ok(); +} + +ScopedAStatus RemoteAccessService::getProcessorId(std::string* processorId) { + *processorId = PROCESSOR_ID; return ScopedAStatus::ok(); } @@ -252,8 +258,8 @@ void RemoteAccessService::dumpHelp(int fd) { COMMAND_START_DEBUG_CALLBACK + " Start a debug callback that will record the received tasks\n" + COMMAND_STOP_DEBUG_CALLBACK + " Stop the debug callback\n" + COMMAND_SHOW_TASK + - " Show tasks received by debug callback\n" + COMMAND_GET_DEVICE_ID + - " Get device id\n") + " Show tasks received by debug callback\n" + COMMAND_GET_VEHICLE_ID + + " Get vehicle id\n") .c_str()); } @@ -316,13 +322,13 @@ binder_status_t RemoteAccessService::dump(int fd, const char** args, uint32_t nu dprintf(fd, "Debug callback is not currently used, use \"%s\" first.\n", COMMAND_START_DEBUG_CALLBACK); } - } else if (!strcmp(args[0], COMMAND_GET_DEVICE_ID)) { - std::string deviceId; - auto status = getDeviceId(&deviceId); + } else if (!strcmp(args[0], COMMAND_GET_VEHICLE_ID)) { + std::string vehicleId; + auto status = getVehicleId(&vehicleId); if (!status.isOk()) { - dprintErrorStatus(fd, "Failed to get device ID", status); + dprintErrorStatus(fd, "Failed to get vehicle ID", status); } else { - dprintf(fd, "Device Id: %s\n", deviceId.c_str()); + dprintf(fd, "Vehicle Id: %s\n", vehicleId.c_str()); } } else { dumpHelp(fd); diff --git a/automotive/remoteaccess/hal/default/test/RemoteAccessServiceUnitTest.cpp b/automotive/remoteaccess/hal/default/test/RemoteAccessServiceUnitTest.cpp index 8c4fa080eb..c5afd6300f 100644 --- a/automotive/remoteaccess/hal/default/test/RemoteAccessServiceUnitTest.cpp +++ b/automotive/remoteaccess/hal/default/test/RemoteAccessServiceUnitTest.cpp @@ -187,8 +187,8 @@ class RemoteAccessServiceUnitTest : public ::testing::Test { void setRetryWaitInMs(size_t retryWaitInMs) { mService->setRetryWaitInMs(retryWaitInMs); } - ScopedAStatus getDeviceIdWithClient(IVhalClient& vhalClient, std::string* deviceId) { - return mService->getDeviceIdWithClient(vhalClient, deviceId); + ScopedAStatus getVehicleIdWithClient(IVhalClient& vhalClient, std::string* vehicleId) { + return mService->getVehicleIdWithClient(vhalClient, vehicleId); } private: @@ -358,13 +358,13 @@ TEST_F(RemoteAccessServiceUnitTest, TestGetRemoteTasksNotReadyAfterReady) { std::this_thread::sleep_for(std::chrono::milliseconds(150)); } -TEST_F(RemoteAccessServiceUnitTest, testGetDeviceId) { - std::string deviceId; +TEST_F(RemoteAccessServiceUnitTest, testGetVehicleId) { + std::string vehicleId; FakeVhalClient vhalClient; - ASSERT_TRUE(getDeviceIdWithClient(vhalClient, &deviceId).isOk()); - ASSERT_EQ(deviceId, kTestVin); + ASSERT_TRUE(getVehicleIdWithClient(vhalClient, &vehicleId).isOk()); + ASSERT_EQ(vehicleId, kTestVin); } } // namespace remoteaccess From 0d841ae81243d73959fceb3f366e6536a2ec3869 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Thu, 16 Mar 2023 17:18:57 +0000 Subject: [PATCH 831/998] Add comment to the Vendor HAL Android.bp file to explain why the linter is disabled. If the linter were enabled, we would run into a build failure because fixed-size arrays are not supported on SDK Level < 33. The interface indicates min_sdk_version 30 due to mainline requirements, but the interface will only be accessed by devices running Android U. Bug: 267819850 Test: m Change-Id: Ifed2223d1c5f4bf46329ed72fa622b730e99cde1 --- wifi/aidl/Android.bp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wifi/aidl/Android.bp b/wifi/aidl/Android.bp index c0ca667b41..0c8572c024 100644 --- a/wifi/aidl/Android.bp +++ b/wifi/aidl/Android.bp @@ -37,6 +37,8 @@ aidl_interface { ], min_sdk_version: "30", lint: { + // Disable linter to avoid error about fixed size arrays. + // Interface will only be accessed on devices >= U. enabled: false, }, }, From cf9118c283fd0a34583227ed896a278196ae983b Mon Sep 17 00:00:00 2001 From: Austin Borger Date: Thu, 16 Mar 2023 10:34:28 -0700 Subject: [PATCH 832/998] Camera AIDL: Remove unsupported color space enums. Bug: 273961103 Test: Presubmit Change-Id: I349db6968b33024e34facf204b4638c73f4d242d --- .../camera/metadata/AutomotiveLensFacing.aidl | 30 +- .../camera/metadata/AutomotiveLocation.aidl | 22 +- .../camera/metadata/BlackLevelLock.aidl | 4 +- .../metadata/CameraMetadataSection.aidl | 70 +- .../metadata/CameraMetadataSectionStart.aidl | 70 +- .../camera/metadata/CameraMetadataTag.aidl | 604 +++++++++--------- .../ColorCorrectionAberrationMode.aidl | 6 +- .../camera/metadata/ColorCorrectionMode.aidl | 6 +- .../metadata/ControlAeAntibandingMode.aidl | 8 +- .../camera/metadata/ControlAeLock.aidl | 4 +- .../metadata/ControlAeLockAvailable.aidl | 4 +- .../camera/metadata/ControlAeMode.aidl | 12 +- .../metadata/ControlAePrecaptureTrigger.aidl | 6 +- .../camera/metadata/ControlAeState.aidl | 12 +- .../camera/metadata/ControlAfMode.aidl | 12 +- .../camera/metadata/ControlAfSceneChange.aidl | 4 +- .../camera/metadata/ControlAfState.aidl | 14 +- .../camera/metadata/ControlAfTrigger.aidl | 6 +- .../camera/metadata/ControlAutoframing.aidl | 6 +- .../metadata/ControlAutoframingAvailable.aidl | 4 +- .../metadata/ControlAutoframingState.aidl | 6 +- .../camera/metadata/ControlAwbLock.aidl | 4 +- .../metadata/ControlAwbLockAvailable.aidl | 4 +- .../camera/metadata/ControlAwbMode.aidl | 18 +- .../camera/metadata/ControlAwbState.aidl | 8 +- .../camera/metadata/ControlCaptureIntent.aidl | 16 +- .../camera/metadata/ControlEffectMode.aidl | 18 +- .../camera/metadata/ControlEnableZsl.aidl | 4 +- .../metadata/ControlExtendedSceneMode.aidl | 6 +- .../hardware/camera/metadata/ControlMode.aidl | 10 +- .../camera/metadata/ControlSceneMode.aidl | 38 +- .../metadata/ControlSettingsOverride.aidl | 6 +- .../ControlVideoStabilizationMode.aidl | 6 +- .../camera/metadata/DemosaicMode.aidl | 4 +- ...pthAvailableDepthStreamConfigurations.aidl | 4 +- ...StreamConfigurationsMaximumResolution.aidl | 4 +- ...lableDynamicDepthStreamConfigurations.aidl | 4 +- ...StreamConfigurationsMaximumResolution.aidl | 4 +- .../metadata/DepthDepthIsExclusive.aidl | 4 +- .../metadata/DistortionCorrectionMode.aidl | 6 +- .../hardware/camera/metadata/EdgeMode.aidl | 8 +- .../camera/metadata/FlashInfoAvailable.aidl | 4 +- .../hardware/camera/metadata/FlashMode.aidl | 6 +- .../hardware/camera/metadata/FlashState.aidl | 10 +- ...HeicAvailableHeicStreamConfigurations.aidl | 4 +- ...StreamConfigurationsMaximumResolution.aidl | 4 +- .../camera/metadata/HeicInfoSupported.aidl | 4 +- .../camera/metadata/HotPixelMode.aidl | 6 +- .../InfoSupportedBufferManagementVersion.aidl | 2 +- .../metadata/InfoSupportedHardwareLevel.aidl | 10 +- ...egrAvailableJpegRStreamConfigurations.aidl | 4 +- ...StreamConfigurationsMaximumResolution.aidl | 4 +- .../camera/metadata/LedAvailableLeds.aidl | 2 +- .../hardware/camera/metadata/LedTransmit.aidl | 4 +- .../hardware/camera/metadata/LensFacing.aidl | 6 +- .../LensInfoFocusDistanceCalibration.aidl | 6 +- .../LensOpticalStabilizationMode.aidl | 4 +- .../camera/metadata/LensPoseReference.aidl | 8 +- .../hardware/camera/metadata/LensState.aidl | 4 +- .../LogicalMultiCameraSensorSyncType.aidl | 4 +- .../camera/metadata/NoiseReductionMode.aidl | 10 +- .../camera/metadata/QuirksPartialResult.aidl | 4 +- .../RequestAvailableCapabilities.aidl | 42 +- ...RequestAvailableColorSpaceProfilesMap.aidl | 21 +- ...questAvailableDynamicRangeProfilesMap.aidl | 26 +- .../camera/metadata/RequestMetadataMode.aidl | 4 +- .../hardware/camera/metadata/RequestType.aidl | 4 +- .../metadata/ScalerAvailableFormats.aidl | 20 +- ...ilableRecommendedStreamConfigurations.aidl | 18 +- .../ScalerAvailableStreamConfigurations.aidl | 4 +- ...StreamConfigurationsMaximumResolution.aidl | 4 +- .../ScalerAvailableStreamUseCases.aidl | 16 +- .../camera/metadata/ScalerCroppingType.aidl | 4 +- .../ScalerMultiResolutionStreamSupported.aidl | 4 +- ...raMultiResolutionStreamConfigurations.aidl | 4 +- .../camera/metadata/ScalerRotateAndCrop.aidl | 10 +- .../SensorInfoColorFilterArrangement.aidl | 14 +- .../SensorInfoLensShadingApplied.aidl | 4 +- .../metadata/SensorInfoTimestampSource.aidl | 4 +- .../camera/metadata/SensorPixelMode.aidl | 4 +- .../metadata/SensorRawBinningFactorUsed.aidl | 4 +- .../metadata/SensorTestPatternMode.aidl | 12 +- .../hardware/camera/metadata/ShadingMode.aidl | 6 +- .../metadata/StatisticsFaceDetectMode.aidl | 6 +- .../metadata/StatisticsHistogramMode.aidl | 4 +- .../metadata/StatisticsHotPixelMapMode.aidl | 4 +- .../StatisticsLensShadingMapMode.aidl | 4 +- .../metadata/StatisticsOisDataMode.aidl | 4 +- .../metadata/StatisticsSceneFlicker.aidl | 6 +- .../metadata/StatisticsSharpnessMapMode.aidl | 4 +- .../camera/metadata/SyncFrameNumber.aidl | 4 +- .../camera/metadata/SyncMaxLatency.aidl | 2 +- .../hardware/camera/metadata/TonemapMode.aidl | 10 +- .../camera/metadata/TonemapPresetCurve.aidl | 4 +- ...RequestAvailableColorSpaceProfilesMap.aidl | 15 +- 95 files changed, 733 insertions(+), 759 deletions(-) diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/AutomotiveLensFacing.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/AutomotiveLensFacing.aidl index 14ad26e08a..18917f7752 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/AutomotiveLensFacing.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/AutomotiveLensFacing.aidl @@ -38,19 +38,19 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum AutomotiveLensFacing { - ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_OTHER = 0, - ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_FRONT = 1, - ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_REAR = 2, - ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_LEFT = 3, - ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_RIGHT = 4, - ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_OTHER = 5, - ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_LEFT = 6, - ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_CENTER = 7, - ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_RIGHT = 8, - ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_LEFT = 9, - ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_CENTER = 10, - ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_RIGHT = 11, - ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_LEFT = 12, - ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_CENTER = 13, - ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_RIGHT = 14, + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_OTHER, + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_FRONT, + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_REAR, + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_LEFT, + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_RIGHT, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_OTHER, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_LEFT, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_CENTER, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_RIGHT, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_LEFT, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_CENTER, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_RIGHT, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_LEFT, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_CENTER, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_RIGHT, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/AutomotiveLocation.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/AutomotiveLocation.aidl index 5417bdbf44..ad6003f3b1 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/AutomotiveLocation.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/AutomotiveLocation.aidl @@ -38,15 +38,15 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum AutomotiveLocation { - ANDROID_AUTOMOTIVE_LOCATION_INTERIOR = 0, - ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_OTHER = 1, - ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_FRONT = 2, - ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_REAR = 3, - ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_LEFT = 4, - ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_RIGHT = 5, - ANDROID_AUTOMOTIVE_LOCATION_EXTRA_OTHER = 6, - ANDROID_AUTOMOTIVE_LOCATION_EXTRA_FRONT = 7, - ANDROID_AUTOMOTIVE_LOCATION_EXTRA_REAR = 8, - ANDROID_AUTOMOTIVE_LOCATION_EXTRA_LEFT = 9, - ANDROID_AUTOMOTIVE_LOCATION_EXTRA_RIGHT = 10, + ANDROID_AUTOMOTIVE_LOCATION_INTERIOR, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_OTHER, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_FRONT, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_REAR, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_LEFT, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_RIGHT, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_OTHER, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_FRONT, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_REAR, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_LEFT, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_RIGHT, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/BlackLevelLock.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/BlackLevelLock.aidl index dcefa2f697..1f3e76f0b8 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/BlackLevelLock.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/BlackLevelLock.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum BlackLevelLock { - ANDROID_BLACK_LEVEL_LOCK_OFF = 0, - ANDROID_BLACK_LEVEL_LOCK_ON = 1, + ANDROID_BLACK_LEVEL_LOCK_OFF, + ANDROID_BLACK_LEVEL_LOCK_ON, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSection.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSection.aidl index d99f16e519..138101b4cb 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSection.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSection.aidl @@ -38,39 +38,39 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum CameraMetadataSection { - ANDROID_COLOR_CORRECTION = 0, - ANDROID_CONTROL = 1, - ANDROID_DEMOSAIC = 2, - ANDROID_EDGE = 3, - ANDROID_FLASH = 4, - ANDROID_FLASH_INFO = 5, - ANDROID_HOT_PIXEL = 6, - ANDROID_JPEG = 7, - ANDROID_LENS = 8, - ANDROID_LENS_INFO = 9, - ANDROID_NOISE_REDUCTION = 10, - ANDROID_QUIRKS = 11, - ANDROID_REQUEST = 12, - ANDROID_SCALER = 13, - ANDROID_SENSOR = 14, - ANDROID_SENSOR_INFO = 15, - ANDROID_SHADING = 16, - ANDROID_STATISTICS = 17, - ANDROID_STATISTICS_INFO = 18, - ANDROID_TONEMAP = 19, - ANDROID_LED = 20, - ANDROID_INFO = 21, - ANDROID_BLACK_LEVEL = 22, - ANDROID_SYNC = 23, - ANDROID_REPROCESS = 24, - ANDROID_DEPTH = 25, - ANDROID_LOGICAL_MULTI_CAMERA = 26, - ANDROID_DISTORTION_CORRECTION = 27, - ANDROID_HEIC = 28, - ANDROID_HEIC_INFO = 29, - ANDROID_AUTOMOTIVE = 30, - ANDROID_AUTOMOTIVE_LENS = 31, - ANDROID_EXTENSION = 32, - ANDROID_JPEGR = 33, - VENDOR_SECTION = 32768, + ANDROID_COLOR_CORRECTION, + ANDROID_CONTROL, + ANDROID_DEMOSAIC, + ANDROID_EDGE, + ANDROID_FLASH, + ANDROID_FLASH_INFO, + ANDROID_HOT_PIXEL, + ANDROID_JPEG, + ANDROID_LENS, + ANDROID_LENS_INFO, + ANDROID_NOISE_REDUCTION, + ANDROID_QUIRKS, + ANDROID_REQUEST, + ANDROID_SCALER, + ANDROID_SENSOR, + ANDROID_SENSOR_INFO, + ANDROID_SHADING, + ANDROID_STATISTICS, + ANDROID_STATISTICS_INFO, + ANDROID_TONEMAP, + ANDROID_LED, + ANDROID_INFO, + ANDROID_BLACK_LEVEL, + ANDROID_SYNC, + ANDROID_REPROCESS, + ANDROID_DEPTH, + ANDROID_LOGICAL_MULTI_CAMERA, + ANDROID_DISTORTION_CORRECTION, + ANDROID_HEIC, + ANDROID_HEIC_INFO, + ANDROID_AUTOMOTIVE, + ANDROID_AUTOMOTIVE_LENS, + ANDROID_EXTENSION, + ANDROID_JPEGR, + VENDOR_SECTION = 0x8000, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl index 0bcd84647f..85eee08a45 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl @@ -38,39 +38,39 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum CameraMetadataSectionStart { - ANDROID_COLOR_CORRECTION_START = 0, - ANDROID_CONTROL_START = 65536, - ANDROID_DEMOSAIC_START = 131072, - ANDROID_EDGE_START = 196608, - ANDROID_FLASH_START = 262144, - ANDROID_FLASH_INFO_START = 327680, - ANDROID_HOT_PIXEL_START = 393216, - ANDROID_JPEG_START = 458752, - ANDROID_LENS_START = 524288, - ANDROID_LENS_INFO_START = 589824, - ANDROID_NOISE_REDUCTION_START = 655360, - ANDROID_QUIRKS_START = 720896, - ANDROID_REQUEST_START = 786432, - ANDROID_SCALER_START = 851968, - ANDROID_SENSOR_START = 917504, - ANDROID_SENSOR_INFO_START = 983040, - ANDROID_SHADING_START = 1048576, - ANDROID_STATISTICS_START = 1114112, - ANDROID_STATISTICS_INFO_START = 1179648, - ANDROID_TONEMAP_START = 1245184, - ANDROID_LED_START = 1310720, - ANDROID_INFO_START = 1376256, - ANDROID_BLACK_LEVEL_START = 1441792, - ANDROID_SYNC_START = 1507328, - ANDROID_REPROCESS_START = 1572864, - ANDROID_DEPTH_START = 1638400, - ANDROID_LOGICAL_MULTI_CAMERA_START = 1703936, - ANDROID_DISTORTION_CORRECTION_START = 1769472, - ANDROID_HEIC_START = 1835008, - ANDROID_HEIC_INFO_START = 1900544, - ANDROID_AUTOMOTIVE_START = 1966080, - ANDROID_AUTOMOTIVE_LENS_START = 2031616, - ANDROID_EXTENSION_START = 2097152, - ANDROID_JPEGR_START = 2162688, - VENDOR_SECTION_START = -2147483648, + ANDROID_COLOR_CORRECTION_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_COLOR_CORRECTION << 16) /* 0 */, + ANDROID_CONTROL_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_CONTROL << 16) /* 65536 */, + ANDROID_DEMOSAIC_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_DEMOSAIC << 16) /* 131072 */, + ANDROID_EDGE_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_EDGE << 16) /* 196608 */, + ANDROID_FLASH_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_FLASH << 16) /* 262144 */, + ANDROID_FLASH_INFO_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_FLASH_INFO << 16) /* 327680 */, + ANDROID_HOT_PIXEL_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_HOT_PIXEL << 16) /* 393216 */, + ANDROID_JPEG_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_JPEG << 16) /* 458752 */, + ANDROID_LENS_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_LENS << 16) /* 524288 */, + ANDROID_LENS_INFO_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_LENS_INFO << 16) /* 589824 */, + ANDROID_NOISE_REDUCTION_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_NOISE_REDUCTION << 16) /* 655360 */, + ANDROID_QUIRKS_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_QUIRKS << 16) /* 720896 */, + ANDROID_REQUEST_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_REQUEST << 16) /* 786432 */, + ANDROID_SCALER_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_SCALER << 16) /* 851968 */, + ANDROID_SENSOR_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_SENSOR << 16) /* 917504 */, + ANDROID_SENSOR_INFO_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_SENSOR_INFO << 16) /* 983040 */, + ANDROID_SHADING_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_SHADING << 16) /* 1048576 */, + ANDROID_STATISTICS_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_STATISTICS << 16) /* 1114112 */, + ANDROID_STATISTICS_INFO_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_STATISTICS_INFO << 16) /* 1179648 */, + ANDROID_TONEMAP_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_TONEMAP << 16) /* 1245184 */, + ANDROID_LED_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_LED << 16) /* 1310720 */, + ANDROID_INFO_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_INFO << 16) /* 1376256 */, + ANDROID_BLACK_LEVEL_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_BLACK_LEVEL << 16) /* 1441792 */, + ANDROID_SYNC_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_SYNC << 16) /* 1507328 */, + ANDROID_REPROCESS_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_REPROCESS << 16) /* 1572864 */, + ANDROID_DEPTH_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_DEPTH << 16) /* 1638400 */, + ANDROID_LOGICAL_MULTI_CAMERA_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_LOGICAL_MULTI_CAMERA << 16) /* 1703936 */, + ANDROID_DISTORTION_CORRECTION_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_DISTORTION_CORRECTION << 16) /* 1769472 */, + ANDROID_HEIC_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_HEIC << 16) /* 1835008 */, + ANDROID_HEIC_INFO_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_HEIC_INFO << 16) /* 1900544 */, + ANDROID_AUTOMOTIVE_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_AUTOMOTIVE << 16) /* 1966080 */, + ANDROID_AUTOMOTIVE_LENS_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_AUTOMOTIVE_LENS << 16) /* 2031616 */, + ANDROID_EXTENSION_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_EXTENSION << 16) /* 2097152 */, + ANDROID_JPEGR_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_JPEGR << 16) /* 2162688 */, + VENDOR_SECTION_START = (android.hardware.camera.metadata.CameraMetadataSection.VENDOR_SECTION << 16) /* -2147483648 */, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl index b83eb2b268..71d4e41c44 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/CameraMetadataTag.aidl @@ -38,308 +38,308 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum CameraMetadataTag { - ANDROID_COLOR_CORRECTION_MODE = 0, - ANDROID_COLOR_CORRECTION_TRANSFORM = 1, - ANDROID_COLOR_CORRECTION_GAINS = 2, - ANDROID_COLOR_CORRECTION_ABERRATION_MODE = 3, - ANDROID_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES = 4, - ANDROID_CONTROL_AE_ANTIBANDING_MODE = 65536, - ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION = 65537, - ANDROID_CONTROL_AE_LOCK = 65538, - ANDROID_CONTROL_AE_MODE = 65539, - ANDROID_CONTROL_AE_REGIONS = 65540, - ANDROID_CONTROL_AE_TARGET_FPS_RANGE = 65541, - ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER = 65542, - ANDROID_CONTROL_AF_MODE = 65543, - ANDROID_CONTROL_AF_REGIONS = 65544, - ANDROID_CONTROL_AF_TRIGGER = 65545, - ANDROID_CONTROL_AWB_LOCK = 65546, - ANDROID_CONTROL_AWB_MODE = 65547, - ANDROID_CONTROL_AWB_REGIONS = 65548, - ANDROID_CONTROL_CAPTURE_INTENT = 65549, - ANDROID_CONTROL_EFFECT_MODE = 65550, - ANDROID_CONTROL_MODE = 65551, - ANDROID_CONTROL_SCENE_MODE = 65552, - ANDROID_CONTROL_VIDEO_STABILIZATION_MODE = 65553, - ANDROID_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES = 65554, - ANDROID_CONTROL_AE_AVAILABLE_MODES = 65555, - ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES = 65556, - ANDROID_CONTROL_AE_COMPENSATION_RANGE = 65557, - ANDROID_CONTROL_AE_COMPENSATION_STEP = 65558, - ANDROID_CONTROL_AF_AVAILABLE_MODES = 65559, - ANDROID_CONTROL_AVAILABLE_EFFECTS = 65560, - ANDROID_CONTROL_AVAILABLE_SCENE_MODES = 65561, - ANDROID_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES = 65562, - ANDROID_CONTROL_AWB_AVAILABLE_MODES = 65563, - ANDROID_CONTROL_MAX_REGIONS = 65564, - ANDROID_CONTROL_SCENE_MODE_OVERRIDES = 65565, - ANDROID_CONTROL_AE_PRECAPTURE_ID = 65566, - ANDROID_CONTROL_AE_STATE = 65567, - ANDROID_CONTROL_AF_STATE = 65568, - ANDROID_CONTROL_AF_TRIGGER_ID = 65569, - ANDROID_CONTROL_AWB_STATE = 65570, - ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS = 65571, - ANDROID_CONTROL_AE_LOCK_AVAILABLE = 65572, - ANDROID_CONTROL_AWB_LOCK_AVAILABLE = 65573, - ANDROID_CONTROL_AVAILABLE_MODES = 65574, - ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE = 65575, - ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST = 65576, - ANDROID_CONTROL_ENABLE_ZSL = 65577, - ANDROID_CONTROL_AF_SCENE_CHANGE = 65578, - ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_MAX_SIZES = 65579, - ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_ZOOM_RATIO_RANGES = 65580, - ANDROID_CONTROL_EXTENDED_SCENE_MODE = 65581, - ANDROID_CONTROL_ZOOM_RATIO_RANGE = 65582, - ANDROID_CONTROL_ZOOM_RATIO = 65583, - ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS_MAXIMUM_RESOLUTION = 65584, + ANDROID_COLOR_CORRECTION_MODE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_COLOR_CORRECTION_START /* 0 */, + ANDROID_COLOR_CORRECTION_TRANSFORM, + ANDROID_COLOR_CORRECTION_GAINS, + ANDROID_COLOR_CORRECTION_ABERRATION_MODE, + ANDROID_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES, + ANDROID_CONTROL_AE_ANTIBANDING_MODE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_CONTROL_START /* 65536 */, + ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION, + ANDROID_CONTROL_AE_LOCK, + ANDROID_CONTROL_AE_MODE, + ANDROID_CONTROL_AE_REGIONS, + ANDROID_CONTROL_AE_TARGET_FPS_RANGE, + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER, + ANDROID_CONTROL_AF_MODE, + ANDROID_CONTROL_AF_REGIONS, + ANDROID_CONTROL_AF_TRIGGER, + ANDROID_CONTROL_AWB_LOCK, + ANDROID_CONTROL_AWB_MODE, + ANDROID_CONTROL_AWB_REGIONS, + ANDROID_CONTROL_CAPTURE_INTENT, + ANDROID_CONTROL_EFFECT_MODE, + ANDROID_CONTROL_MODE, + ANDROID_CONTROL_SCENE_MODE, + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE, + ANDROID_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES, + ANDROID_CONTROL_AE_AVAILABLE_MODES, + ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES, + ANDROID_CONTROL_AE_COMPENSATION_RANGE, + ANDROID_CONTROL_AE_COMPENSATION_STEP, + ANDROID_CONTROL_AF_AVAILABLE_MODES, + ANDROID_CONTROL_AVAILABLE_EFFECTS, + ANDROID_CONTROL_AVAILABLE_SCENE_MODES, + ANDROID_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES, + ANDROID_CONTROL_AWB_AVAILABLE_MODES, + ANDROID_CONTROL_MAX_REGIONS, + ANDROID_CONTROL_SCENE_MODE_OVERRIDES, + ANDROID_CONTROL_AE_PRECAPTURE_ID, + ANDROID_CONTROL_AE_STATE, + ANDROID_CONTROL_AF_STATE, + ANDROID_CONTROL_AF_TRIGGER_ID, + ANDROID_CONTROL_AWB_STATE, + ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS, + ANDROID_CONTROL_AE_LOCK_AVAILABLE, + ANDROID_CONTROL_AWB_LOCK_AVAILABLE, + ANDROID_CONTROL_AVAILABLE_MODES, + ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE, + ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST, + ANDROID_CONTROL_ENABLE_ZSL, + ANDROID_CONTROL_AF_SCENE_CHANGE, + ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_MAX_SIZES, + ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_ZOOM_RATIO_RANGES, + ANDROID_CONTROL_EXTENDED_SCENE_MODE, + ANDROID_CONTROL_ZOOM_RATIO_RANGE, + ANDROID_CONTROL_ZOOM_RATIO, + ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS_MAXIMUM_RESOLUTION, ANDROID_CONTROL_SETTINGS_OVERRIDE = 65588, - ANDROID_CONTROL_AVAILABLE_SETTINGS_OVERRIDES = 65589, - ANDROID_CONTROL_SETTINGS_OVERRIDING_FRAME_NUMBER = 65590, - ANDROID_CONTROL_AUTOFRAMING = 65591, - ANDROID_CONTROL_AUTOFRAMING_AVAILABLE = 65592, - ANDROID_CONTROL_AUTOFRAMING_STATE = 65593, - ANDROID_DEMOSAIC_MODE = 131072, - ANDROID_EDGE_MODE = 196608, - ANDROID_EDGE_STRENGTH = 196609, - ANDROID_EDGE_AVAILABLE_EDGE_MODES = 196610, - ANDROID_FLASH_FIRING_POWER = 262144, - ANDROID_FLASH_FIRING_TIME = 262145, - ANDROID_FLASH_MODE = 262146, - ANDROID_FLASH_COLOR_TEMPERATURE = 262147, - ANDROID_FLASH_MAX_ENERGY = 262148, - ANDROID_FLASH_STATE = 262149, - ANDROID_FLASH_INFO_AVAILABLE = 327680, - ANDROID_FLASH_INFO_CHARGE_DURATION = 327681, - ANDROID_FLASH_INFO_STRENGTH_MAXIMUM_LEVEL = 327682, - ANDROID_FLASH_INFO_STRENGTH_DEFAULT_LEVEL = 327683, - ANDROID_HOT_PIXEL_MODE = 393216, - ANDROID_HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES = 393217, - ANDROID_JPEG_GPS_COORDINATES = 458752, - ANDROID_JPEG_GPS_PROCESSING_METHOD = 458753, - ANDROID_JPEG_GPS_TIMESTAMP = 458754, - ANDROID_JPEG_ORIENTATION = 458755, - ANDROID_JPEG_QUALITY = 458756, - ANDROID_JPEG_THUMBNAIL_QUALITY = 458757, - ANDROID_JPEG_THUMBNAIL_SIZE = 458758, - ANDROID_JPEG_AVAILABLE_THUMBNAIL_SIZES = 458759, - ANDROID_JPEG_MAX_SIZE = 458760, - ANDROID_JPEG_SIZE = 458761, - ANDROID_LENS_APERTURE = 524288, - ANDROID_LENS_FILTER_DENSITY = 524289, - ANDROID_LENS_FOCAL_LENGTH = 524290, - ANDROID_LENS_FOCUS_DISTANCE = 524291, - ANDROID_LENS_OPTICAL_STABILIZATION_MODE = 524292, - ANDROID_LENS_FACING = 524293, - ANDROID_LENS_POSE_ROTATION = 524294, - ANDROID_LENS_POSE_TRANSLATION = 524295, - ANDROID_LENS_FOCUS_RANGE = 524296, - ANDROID_LENS_STATE = 524297, - ANDROID_LENS_INTRINSIC_CALIBRATION = 524298, - ANDROID_LENS_RADIAL_DISTORTION = 524299, - ANDROID_LENS_POSE_REFERENCE = 524300, - ANDROID_LENS_DISTORTION = 524301, - ANDROID_LENS_DISTORTION_MAXIMUM_RESOLUTION = 524302, - ANDROID_LENS_INTRINSIC_CALIBRATION_MAXIMUM_RESOLUTION = 524303, - ANDROID_LENS_INFO_AVAILABLE_APERTURES = 589824, - ANDROID_LENS_INFO_AVAILABLE_FILTER_DENSITIES = 589825, - ANDROID_LENS_INFO_AVAILABLE_FOCAL_LENGTHS = 589826, - ANDROID_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION = 589827, - ANDROID_LENS_INFO_HYPERFOCAL_DISTANCE = 589828, - ANDROID_LENS_INFO_MINIMUM_FOCUS_DISTANCE = 589829, - ANDROID_LENS_INFO_SHADING_MAP_SIZE = 589830, - ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION = 589831, - ANDROID_NOISE_REDUCTION_MODE = 655360, - ANDROID_NOISE_REDUCTION_STRENGTH = 655361, - ANDROID_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES = 655362, - ANDROID_QUIRKS_METERING_CROP_REGION = 720896, - ANDROID_QUIRKS_TRIGGER_AF_WITH_AUTO = 720897, - ANDROID_QUIRKS_USE_ZSL_FORMAT = 720898, - ANDROID_QUIRKS_USE_PARTIAL_RESULT = 720899, - ANDROID_QUIRKS_PARTIAL_RESULT = 720900, - ANDROID_REQUEST_FRAME_COUNT = 786432, - ANDROID_REQUEST_ID = 786433, - ANDROID_REQUEST_INPUT_STREAMS = 786434, - ANDROID_REQUEST_METADATA_MODE = 786435, - ANDROID_REQUEST_OUTPUT_STREAMS = 786436, - ANDROID_REQUEST_TYPE = 786437, - ANDROID_REQUEST_MAX_NUM_OUTPUT_STREAMS = 786438, - ANDROID_REQUEST_MAX_NUM_REPROCESS_STREAMS = 786439, - ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS = 786440, - ANDROID_REQUEST_PIPELINE_DEPTH = 786441, - ANDROID_REQUEST_PIPELINE_MAX_DEPTH = 786442, - ANDROID_REQUEST_PARTIAL_RESULT_COUNT = 786443, - ANDROID_REQUEST_AVAILABLE_CAPABILITIES = 786444, - ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS = 786445, - ANDROID_REQUEST_AVAILABLE_RESULT_KEYS = 786446, - ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS = 786447, - ANDROID_REQUEST_AVAILABLE_SESSION_KEYS = 786448, - ANDROID_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS = 786449, - ANDROID_REQUEST_CHARACTERISTIC_KEYS_NEEDING_PERMISSION = 786450, - ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP = 786451, - ANDROID_REQUEST_RECOMMENDED_TEN_BIT_DYNAMIC_RANGE_PROFILE = 786452, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP = 786453, - ANDROID_SCALER_CROP_REGION = 851968, - ANDROID_SCALER_AVAILABLE_FORMATS = 851969, - ANDROID_SCALER_AVAILABLE_JPEG_MIN_DURATIONS = 851970, - ANDROID_SCALER_AVAILABLE_JPEG_SIZES = 851971, - ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM = 851972, - ANDROID_SCALER_AVAILABLE_PROCESSED_MIN_DURATIONS = 851973, - ANDROID_SCALER_AVAILABLE_PROCESSED_SIZES = 851974, - ANDROID_SCALER_AVAILABLE_RAW_MIN_DURATIONS = 851975, - ANDROID_SCALER_AVAILABLE_RAW_SIZES = 851976, - ANDROID_SCALER_AVAILABLE_INPUT_OUTPUT_FORMATS_MAP = 851977, - ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS = 851978, - ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS = 851979, - ANDROID_SCALER_AVAILABLE_STALL_DURATIONS = 851980, - ANDROID_SCALER_CROPPING_TYPE = 851981, - ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS = 851982, - ANDROID_SCALER_AVAILABLE_RECOMMENDED_INPUT_OUTPUT_FORMATS_MAP = 851983, - ANDROID_SCALER_AVAILABLE_ROTATE_AND_CROP_MODES = 851984, - ANDROID_SCALER_ROTATE_AND_CROP = 851985, - ANDROID_SCALER_DEFAULT_SECURE_IMAGE_SIZE = 851986, - ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS = 851987, - ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION = 851988, - ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION = 851989, - ANDROID_SCALER_AVAILABLE_STALL_DURATIONS_MAXIMUM_RESOLUTION = 851990, - ANDROID_SCALER_AVAILABLE_INPUT_OUTPUT_FORMATS_MAP_MAXIMUM_RESOLUTION = 851991, - ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED = 851992, + ANDROID_CONTROL_AVAILABLE_SETTINGS_OVERRIDES, + ANDROID_CONTROL_SETTINGS_OVERRIDING_FRAME_NUMBER, + ANDROID_CONTROL_AUTOFRAMING, + ANDROID_CONTROL_AUTOFRAMING_AVAILABLE, + ANDROID_CONTROL_AUTOFRAMING_STATE, + ANDROID_DEMOSAIC_MODE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_DEMOSAIC_START /* 131072 */, + ANDROID_EDGE_MODE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_EDGE_START /* 196608 */, + ANDROID_EDGE_STRENGTH, + ANDROID_EDGE_AVAILABLE_EDGE_MODES, + ANDROID_FLASH_FIRING_POWER = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_FLASH_START /* 262144 */, + ANDROID_FLASH_FIRING_TIME, + ANDROID_FLASH_MODE, + ANDROID_FLASH_COLOR_TEMPERATURE, + ANDROID_FLASH_MAX_ENERGY, + ANDROID_FLASH_STATE, + ANDROID_FLASH_INFO_AVAILABLE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_FLASH_INFO_START /* 327680 */, + ANDROID_FLASH_INFO_CHARGE_DURATION, + ANDROID_FLASH_INFO_STRENGTH_MAXIMUM_LEVEL, + ANDROID_FLASH_INFO_STRENGTH_DEFAULT_LEVEL, + ANDROID_HOT_PIXEL_MODE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_HOT_PIXEL_START /* 393216 */, + ANDROID_HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES, + ANDROID_JPEG_GPS_COORDINATES = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_JPEG_START /* 458752 */, + ANDROID_JPEG_GPS_PROCESSING_METHOD, + ANDROID_JPEG_GPS_TIMESTAMP, + ANDROID_JPEG_ORIENTATION, + ANDROID_JPEG_QUALITY, + ANDROID_JPEG_THUMBNAIL_QUALITY, + ANDROID_JPEG_THUMBNAIL_SIZE, + ANDROID_JPEG_AVAILABLE_THUMBNAIL_SIZES, + ANDROID_JPEG_MAX_SIZE, + ANDROID_JPEG_SIZE, + ANDROID_LENS_APERTURE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_LENS_START /* 524288 */, + ANDROID_LENS_FILTER_DENSITY, + ANDROID_LENS_FOCAL_LENGTH, + ANDROID_LENS_FOCUS_DISTANCE, + ANDROID_LENS_OPTICAL_STABILIZATION_MODE, + ANDROID_LENS_FACING, + ANDROID_LENS_POSE_ROTATION, + ANDROID_LENS_POSE_TRANSLATION, + ANDROID_LENS_FOCUS_RANGE, + ANDROID_LENS_STATE, + ANDROID_LENS_INTRINSIC_CALIBRATION, + ANDROID_LENS_RADIAL_DISTORTION, + ANDROID_LENS_POSE_REFERENCE, + ANDROID_LENS_DISTORTION, + ANDROID_LENS_DISTORTION_MAXIMUM_RESOLUTION, + ANDROID_LENS_INTRINSIC_CALIBRATION_MAXIMUM_RESOLUTION, + ANDROID_LENS_INFO_AVAILABLE_APERTURES = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_LENS_INFO_START /* 589824 */, + ANDROID_LENS_INFO_AVAILABLE_FILTER_DENSITIES, + ANDROID_LENS_INFO_AVAILABLE_FOCAL_LENGTHS, + ANDROID_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION, + ANDROID_LENS_INFO_HYPERFOCAL_DISTANCE, + ANDROID_LENS_INFO_MINIMUM_FOCUS_DISTANCE, + ANDROID_LENS_INFO_SHADING_MAP_SIZE, + ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION, + ANDROID_NOISE_REDUCTION_MODE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_NOISE_REDUCTION_START /* 655360 */, + ANDROID_NOISE_REDUCTION_STRENGTH, + ANDROID_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES, + ANDROID_QUIRKS_METERING_CROP_REGION = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_QUIRKS_START /* 720896 */, + ANDROID_QUIRKS_TRIGGER_AF_WITH_AUTO, + ANDROID_QUIRKS_USE_ZSL_FORMAT, + ANDROID_QUIRKS_USE_PARTIAL_RESULT, + ANDROID_QUIRKS_PARTIAL_RESULT, + ANDROID_REQUEST_FRAME_COUNT = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_REQUEST_START /* 786432 */, + ANDROID_REQUEST_ID, + ANDROID_REQUEST_INPUT_STREAMS, + ANDROID_REQUEST_METADATA_MODE, + ANDROID_REQUEST_OUTPUT_STREAMS, + ANDROID_REQUEST_TYPE, + ANDROID_REQUEST_MAX_NUM_OUTPUT_STREAMS, + ANDROID_REQUEST_MAX_NUM_REPROCESS_STREAMS, + ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS, + ANDROID_REQUEST_PIPELINE_DEPTH, + ANDROID_REQUEST_PIPELINE_MAX_DEPTH, + ANDROID_REQUEST_PARTIAL_RESULT_COUNT, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES, + ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS, + ANDROID_REQUEST_AVAILABLE_RESULT_KEYS, + ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS, + ANDROID_REQUEST_AVAILABLE_SESSION_KEYS, + ANDROID_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS, + ANDROID_REQUEST_CHARACTERISTIC_KEYS_NEEDING_PERMISSION, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP, + ANDROID_REQUEST_RECOMMENDED_TEN_BIT_DYNAMIC_RANGE_PROFILE, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP, + ANDROID_SCALER_CROP_REGION = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_SCALER_START /* 851968 */, + ANDROID_SCALER_AVAILABLE_FORMATS, + ANDROID_SCALER_AVAILABLE_JPEG_MIN_DURATIONS, + ANDROID_SCALER_AVAILABLE_JPEG_SIZES, + ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM, + ANDROID_SCALER_AVAILABLE_PROCESSED_MIN_DURATIONS, + ANDROID_SCALER_AVAILABLE_PROCESSED_SIZES, + ANDROID_SCALER_AVAILABLE_RAW_MIN_DURATIONS, + ANDROID_SCALER_AVAILABLE_RAW_SIZES, + ANDROID_SCALER_AVAILABLE_INPUT_OUTPUT_FORMATS_MAP, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, + ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS, + ANDROID_SCALER_AVAILABLE_STALL_DURATIONS, + ANDROID_SCALER_CROPPING_TYPE, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_INPUT_OUTPUT_FORMATS_MAP, + ANDROID_SCALER_AVAILABLE_ROTATE_AND_CROP_MODES, + ANDROID_SCALER_ROTATE_AND_CROP, + ANDROID_SCALER_DEFAULT_SECURE_IMAGE_SIZE, + ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION, + ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION, + ANDROID_SCALER_AVAILABLE_STALL_DURATIONS_MAXIMUM_RESOLUTION, + ANDROID_SCALER_AVAILABLE_INPUT_OUTPUT_FORMATS_MAP_MAXIMUM_RESOLUTION, + ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED, ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES = 851994, - ANDROID_SCALER_RAW_CROP_REGION = 851995, - ANDROID_SENSOR_EXPOSURE_TIME = 917504, - ANDROID_SENSOR_FRAME_DURATION = 917505, - ANDROID_SENSOR_SENSITIVITY = 917506, - ANDROID_SENSOR_REFERENCE_ILLUMINANT1 = 917507, - ANDROID_SENSOR_REFERENCE_ILLUMINANT2 = 917508, - ANDROID_SENSOR_CALIBRATION_TRANSFORM1 = 917509, - ANDROID_SENSOR_CALIBRATION_TRANSFORM2 = 917510, - ANDROID_SENSOR_COLOR_TRANSFORM1 = 917511, - ANDROID_SENSOR_COLOR_TRANSFORM2 = 917512, - ANDROID_SENSOR_FORWARD_MATRIX1 = 917513, - ANDROID_SENSOR_FORWARD_MATRIX2 = 917514, - ANDROID_SENSOR_BASE_GAIN_FACTOR = 917515, - ANDROID_SENSOR_BLACK_LEVEL_PATTERN = 917516, - ANDROID_SENSOR_MAX_ANALOG_SENSITIVITY = 917517, - ANDROID_SENSOR_ORIENTATION = 917518, - ANDROID_SENSOR_PROFILE_HUE_SAT_MAP_DIMENSIONS = 917519, - ANDROID_SENSOR_TIMESTAMP = 917520, - ANDROID_SENSOR_TEMPERATURE = 917521, - ANDROID_SENSOR_NEUTRAL_COLOR_POINT = 917522, - ANDROID_SENSOR_NOISE_PROFILE = 917523, - ANDROID_SENSOR_PROFILE_HUE_SAT_MAP = 917524, - ANDROID_SENSOR_PROFILE_TONE_CURVE = 917525, - ANDROID_SENSOR_GREEN_SPLIT = 917526, - ANDROID_SENSOR_TEST_PATTERN_DATA = 917527, - ANDROID_SENSOR_TEST_PATTERN_MODE = 917528, - ANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES = 917529, - ANDROID_SENSOR_ROLLING_SHUTTER_SKEW = 917530, - ANDROID_SENSOR_OPTICAL_BLACK_REGIONS = 917531, - ANDROID_SENSOR_DYNAMIC_BLACK_LEVEL = 917532, - ANDROID_SENSOR_DYNAMIC_WHITE_LEVEL = 917533, - ANDROID_SENSOR_OPAQUE_RAW_SIZE = 917534, - ANDROID_SENSOR_OPAQUE_RAW_SIZE_MAXIMUM_RESOLUTION = 917535, - ANDROID_SENSOR_PIXEL_MODE = 917536, - ANDROID_SENSOR_RAW_BINNING_FACTOR_USED = 917537, - ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE = 983040, - ANDROID_SENSOR_INFO_SENSITIVITY_RANGE = 983041, - ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT = 983042, - ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE = 983043, - ANDROID_SENSOR_INFO_MAX_FRAME_DURATION = 983044, - ANDROID_SENSOR_INFO_PHYSICAL_SIZE = 983045, - ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE = 983046, - ANDROID_SENSOR_INFO_WHITE_LEVEL = 983047, - ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE = 983048, - ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED = 983049, - ANDROID_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE = 983050, - ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION = 983051, - ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE_MAXIMUM_RESOLUTION = 983052, - ANDROID_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION = 983053, - ANDROID_SENSOR_INFO_BINNING_FACTOR = 983054, - ANDROID_SHADING_MODE = 1048576, - ANDROID_SHADING_STRENGTH = 1048577, - ANDROID_SHADING_AVAILABLE_MODES = 1048578, - ANDROID_STATISTICS_FACE_DETECT_MODE = 1114112, - ANDROID_STATISTICS_HISTOGRAM_MODE = 1114113, - ANDROID_STATISTICS_SHARPNESS_MAP_MODE = 1114114, - ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE = 1114115, - ANDROID_STATISTICS_FACE_IDS = 1114116, - ANDROID_STATISTICS_FACE_LANDMARKS = 1114117, - ANDROID_STATISTICS_FACE_RECTANGLES = 1114118, - ANDROID_STATISTICS_FACE_SCORES = 1114119, - ANDROID_STATISTICS_HISTOGRAM = 1114120, - ANDROID_STATISTICS_SHARPNESS_MAP = 1114121, - ANDROID_STATISTICS_LENS_SHADING_CORRECTION_MAP = 1114122, - ANDROID_STATISTICS_LENS_SHADING_MAP = 1114123, - ANDROID_STATISTICS_PREDICTED_COLOR_GAINS = 1114124, - ANDROID_STATISTICS_PREDICTED_COLOR_TRANSFORM = 1114125, - ANDROID_STATISTICS_SCENE_FLICKER = 1114126, - ANDROID_STATISTICS_HOT_PIXEL_MAP = 1114127, - ANDROID_STATISTICS_LENS_SHADING_MAP_MODE = 1114128, - ANDROID_STATISTICS_OIS_DATA_MODE = 1114129, - ANDROID_STATISTICS_OIS_TIMESTAMPS = 1114130, - ANDROID_STATISTICS_OIS_X_SHIFTS = 1114131, - ANDROID_STATISTICS_OIS_Y_SHIFTS = 1114132, - ANDROID_STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES = 1179648, - ANDROID_STATISTICS_INFO_HISTOGRAM_BUCKET_COUNT = 1179649, - ANDROID_STATISTICS_INFO_MAX_FACE_COUNT = 1179650, - ANDROID_STATISTICS_INFO_MAX_HISTOGRAM_COUNT = 1179651, - ANDROID_STATISTICS_INFO_MAX_SHARPNESS_MAP_VALUE = 1179652, - ANDROID_STATISTICS_INFO_SHARPNESS_MAP_SIZE = 1179653, - ANDROID_STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES = 1179654, - ANDROID_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES = 1179655, - ANDROID_STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES = 1179656, - ANDROID_TONEMAP_CURVE_BLUE = 1245184, - ANDROID_TONEMAP_CURVE_GREEN = 1245185, - ANDROID_TONEMAP_CURVE_RED = 1245186, - ANDROID_TONEMAP_MODE = 1245187, - ANDROID_TONEMAP_MAX_CURVE_POINTS = 1245188, - ANDROID_TONEMAP_AVAILABLE_TONE_MAP_MODES = 1245189, - ANDROID_TONEMAP_GAMMA = 1245190, - ANDROID_TONEMAP_PRESET_CURVE = 1245191, - ANDROID_LED_TRANSMIT = 1310720, - ANDROID_LED_AVAILABLE_LEDS = 1310721, - ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL = 1376256, - ANDROID_INFO_VERSION = 1376257, - ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION = 1376258, - ANDROID_INFO_DEVICE_STATE_ORIENTATIONS = 1376259, - ANDROID_BLACK_LEVEL_LOCK = 1441792, - ANDROID_SYNC_FRAME_NUMBER = 1507328, - ANDROID_SYNC_MAX_LATENCY = 1507329, - ANDROID_REPROCESS_EFFECTIVE_EXPOSURE_FACTOR = 1572864, - ANDROID_REPROCESS_MAX_CAPTURE_STALL = 1572865, - ANDROID_DEPTH_MAX_DEPTH_SAMPLES = 1638400, - ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS = 1638401, - ANDROID_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS = 1638402, - ANDROID_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS = 1638403, - ANDROID_DEPTH_DEPTH_IS_EXCLUSIVE = 1638404, - ANDROID_DEPTH_AVAILABLE_RECOMMENDED_DEPTH_STREAM_CONFIGURATIONS = 1638405, - ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS = 1638406, - ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS = 1638407, - ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS = 1638408, - ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION = 1638409, - ANDROID_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION = 1638410, - ANDROID_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS_MAXIMUM_RESOLUTION = 1638411, - ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION = 1638412, - ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION = 1638413, - ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS_MAXIMUM_RESOLUTION = 1638414, - ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS = 1703936, - ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE = 1703937, - ANDROID_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID = 1703938, - ANDROID_DISTORTION_CORRECTION_MODE = 1769472, - ANDROID_DISTORTION_CORRECTION_AVAILABLE_MODES = 1769473, - ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS = 1835008, - ANDROID_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS = 1835009, - ANDROID_HEIC_AVAILABLE_HEIC_STALL_DURATIONS = 1835010, - ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION = 1835011, - ANDROID_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION = 1835012, - ANDROID_HEIC_AVAILABLE_HEIC_STALL_DURATIONS_MAXIMUM_RESOLUTION = 1835013, - ANDROID_HEIC_INFO_SUPPORTED = 1900544, - ANDROID_HEIC_INFO_MAX_JPEG_APP_SEGMENTS_COUNT = 1900545, - ANDROID_AUTOMOTIVE_LOCATION = 1966080, - ANDROID_AUTOMOTIVE_LENS_FACING = 2031616, - ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS = 2162688, - ANDROID_JPEGR_AVAILABLE_JPEG_R_MIN_FRAME_DURATIONS = 2162689, - ANDROID_JPEGR_AVAILABLE_JPEG_R_STALL_DURATIONS = 2162690, - ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION = 2162691, - ANDROID_JPEGR_AVAILABLE_JPEG_R_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION = 2162692, - ANDROID_JPEGR_AVAILABLE_JPEG_R_STALL_DURATIONS_MAXIMUM_RESOLUTION = 2162693, + ANDROID_SCALER_RAW_CROP_REGION, + ANDROID_SENSOR_EXPOSURE_TIME = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_SENSOR_START /* 917504 */, + ANDROID_SENSOR_FRAME_DURATION, + ANDROID_SENSOR_SENSITIVITY, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1, + ANDROID_SENSOR_REFERENCE_ILLUMINANT2, + ANDROID_SENSOR_CALIBRATION_TRANSFORM1, + ANDROID_SENSOR_CALIBRATION_TRANSFORM2, + ANDROID_SENSOR_COLOR_TRANSFORM1, + ANDROID_SENSOR_COLOR_TRANSFORM2, + ANDROID_SENSOR_FORWARD_MATRIX1, + ANDROID_SENSOR_FORWARD_MATRIX2, + ANDROID_SENSOR_BASE_GAIN_FACTOR, + ANDROID_SENSOR_BLACK_LEVEL_PATTERN, + ANDROID_SENSOR_MAX_ANALOG_SENSITIVITY, + ANDROID_SENSOR_ORIENTATION, + ANDROID_SENSOR_PROFILE_HUE_SAT_MAP_DIMENSIONS, + ANDROID_SENSOR_TIMESTAMP, + ANDROID_SENSOR_TEMPERATURE, + ANDROID_SENSOR_NEUTRAL_COLOR_POINT, + ANDROID_SENSOR_NOISE_PROFILE, + ANDROID_SENSOR_PROFILE_HUE_SAT_MAP, + ANDROID_SENSOR_PROFILE_TONE_CURVE, + ANDROID_SENSOR_GREEN_SPLIT, + ANDROID_SENSOR_TEST_PATTERN_DATA, + ANDROID_SENSOR_TEST_PATTERN_MODE, + ANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES, + ANDROID_SENSOR_ROLLING_SHUTTER_SKEW, + ANDROID_SENSOR_OPTICAL_BLACK_REGIONS, + ANDROID_SENSOR_DYNAMIC_BLACK_LEVEL, + ANDROID_SENSOR_DYNAMIC_WHITE_LEVEL, + ANDROID_SENSOR_OPAQUE_RAW_SIZE, + ANDROID_SENSOR_OPAQUE_RAW_SIZE_MAXIMUM_RESOLUTION, + ANDROID_SENSOR_PIXEL_MODE, + ANDROID_SENSOR_RAW_BINNING_FACTOR_USED, + ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_SENSOR_INFO_START /* 983040 */, + ANDROID_SENSOR_INFO_SENSITIVITY_RANGE, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT, + ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE, + ANDROID_SENSOR_INFO_MAX_FRAME_DURATION, + ANDROID_SENSOR_INFO_PHYSICAL_SIZE, + ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE, + ANDROID_SENSOR_INFO_WHITE_LEVEL, + ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE, + ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED, + ANDROID_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE, + ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION, + ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE_MAXIMUM_RESOLUTION, + ANDROID_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION, + ANDROID_SENSOR_INFO_BINNING_FACTOR, + ANDROID_SHADING_MODE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_SHADING_START /* 1048576 */, + ANDROID_SHADING_STRENGTH, + ANDROID_SHADING_AVAILABLE_MODES, + ANDROID_STATISTICS_FACE_DETECT_MODE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_STATISTICS_START /* 1114112 */, + ANDROID_STATISTICS_HISTOGRAM_MODE, + ANDROID_STATISTICS_SHARPNESS_MAP_MODE, + ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE, + ANDROID_STATISTICS_FACE_IDS, + ANDROID_STATISTICS_FACE_LANDMARKS, + ANDROID_STATISTICS_FACE_RECTANGLES, + ANDROID_STATISTICS_FACE_SCORES, + ANDROID_STATISTICS_HISTOGRAM, + ANDROID_STATISTICS_SHARPNESS_MAP, + ANDROID_STATISTICS_LENS_SHADING_CORRECTION_MAP, + ANDROID_STATISTICS_LENS_SHADING_MAP, + ANDROID_STATISTICS_PREDICTED_COLOR_GAINS, + ANDROID_STATISTICS_PREDICTED_COLOR_TRANSFORM, + ANDROID_STATISTICS_SCENE_FLICKER, + ANDROID_STATISTICS_HOT_PIXEL_MAP, + ANDROID_STATISTICS_LENS_SHADING_MAP_MODE, + ANDROID_STATISTICS_OIS_DATA_MODE, + ANDROID_STATISTICS_OIS_TIMESTAMPS, + ANDROID_STATISTICS_OIS_X_SHIFTS, + ANDROID_STATISTICS_OIS_Y_SHIFTS, + ANDROID_STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_STATISTICS_INFO_START /* 1179648 */, + ANDROID_STATISTICS_INFO_HISTOGRAM_BUCKET_COUNT, + ANDROID_STATISTICS_INFO_MAX_FACE_COUNT, + ANDROID_STATISTICS_INFO_MAX_HISTOGRAM_COUNT, + ANDROID_STATISTICS_INFO_MAX_SHARPNESS_MAP_VALUE, + ANDROID_STATISTICS_INFO_SHARPNESS_MAP_SIZE, + ANDROID_STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES, + ANDROID_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES, + ANDROID_STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES, + ANDROID_TONEMAP_CURVE_BLUE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_TONEMAP_START /* 1245184 */, + ANDROID_TONEMAP_CURVE_GREEN, + ANDROID_TONEMAP_CURVE_RED, + ANDROID_TONEMAP_MODE, + ANDROID_TONEMAP_MAX_CURVE_POINTS, + ANDROID_TONEMAP_AVAILABLE_TONE_MAP_MODES, + ANDROID_TONEMAP_GAMMA, + ANDROID_TONEMAP_PRESET_CURVE, + ANDROID_LED_TRANSMIT = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_LED_START /* 1310720 */, + ANDROID_LED_AVAILABLE_LEDS, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_INFO_START /* 1376256 */, + ANDROID_INFO_VERSION, + ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION, + ANDROID_INFO_DEVICE_STATE_ORIENTATIONS, + ANDROID_BLACK_LEVEL_LOCK = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_BLACK_LEVEL_START /* 1441792 */, + ANDROID_SYNC_FRAME_NUMBER = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_SYNC_START /* 1507328 */, + ANDROID_SYNC_MAX_LATENCY, + ANDROID_REPROCESS_EFFECTIVE_EXPOSURE_FACTOR = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_REPROCESS_START /* 1572864 */, + ANDROID_REPROCESS_MAX_CAPTURE_STALL, + ANDROID_DEPTH_MAX_DEPTH_SAMPLES = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_DEPTH_START /* 1638400 */, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS, + ANDROID_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS, + ANDROID_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS, + ANDROID_DEPTH_DEPTH_IS_EXCLUSIVE, + ANDROID_DEPTH_AVAILABLE_RECOMMENDED_DEPTH_STREAM_CONFIGURATIONS, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION, + ANDROID_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION, + ANDROID_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS_MAXIMUM_RESOLUTION, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS_MAXIMUM_RESOLUTION, + ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_LOGICAL_MULTI_CAMERA_START /* 1703936 */, + ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE, + ANDROID_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID, + ANDROID_DISTORTION_CORRECTION_MODE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_DISTORTION_CORRECTION_START /* 1769472 */, + ANDROID_DISTORTION_CORRECTION_AVAILABLE_MODES, + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_HEIC_START /* 1835008 */, + ANDROID_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS, + ANDROID_HEIC_AVAILABLE_HEIC_STALL_DURATIONS, + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION, + ANDROID_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION, + ANDROID_HEIC_AVAILABLE_HEIC_STALL_DURATIONS_MAXIMUM_RESOLUTION, + ANDROID_HEIC_INFO_SUPPORTED = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_HEIC_INFO_START /* 1900544 */, + ANDROID_HEIC_INFO_MAX_JPEG_APP_SEGMENTS_COUNT, + ANDROID_AUTOMOTIVE_LOCATION = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_AUTOMOTIVE_START /* 1966080 */, + ANDROID_AUTOMOTIVE_LENS_FACING = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_AUTOMOTIVE_LENS_START /* 2031616 */, + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_JPEGR_START /* 2162688 */, + ANDROID_JPEGR_AVAILABLE_JPEG_R_MIN_FRAME_DURATIONS, + ANDROID_JPEGR_AVAILABLE_JPEG_R_STALL_DURATIONS, + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION, + ANDROID_JPEGR_AVAILABLE_JPEG_R_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION, + ANDROID_JPEGR_AVAILABLE_JPEG_R_STALL_DURATIONS_MAXIMUM_RESOLUTION, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ColorCorrectionAberrationMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ColorCorrectionAberrationMode.aidl index d04ffe3906..0b976f3d8b 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ColorCorrectionAberrationMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ColorCorrectionAberrationMode.aidl @@ -38,7 +38,7 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ColorCorrectionAberrationMode { - ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF = 0, - ANDROID_COLOR_CORRECTION_ABERRATION_MODE_FAST = 1, - ANDROID_COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY = 2, + ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF, + ANDROID_COLOR_CORRECTION_ABERRATION_MODE_FAST, + ANDROID_COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ColorCorrectionMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ColorCorrectionMode.aidl index 219c802bb8..2381605719 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ColorCorrectionMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ColorCorrectionMode.aidl @@ -38,7 +38,7 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ColorCorrectionMode { - ANDROID_COLOR_CORRECTION_MODE_TRANSFORM_MATRIX = 0, - ANDROID_COLOR_CORRECTION_MODE_FAST = 1, - ANDROID_COLOR_CORRECTION_MODE_HIGH_QUALITY = 2, + ANDROID_COLOR_CORRECTION_MODE_TRANSFORM_MATRIX, + ANDROID_COLOR_CORRECTION_MODE_FAST, + ANDROID_COLOR_CORRECTION_MODE_HIGH_QUALITY, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeAntibandingMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeAntibandingMode.aidl index 84fd718c53..0d5aad9a92 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeAntibandingMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeAntibandingMode.aidl @@ -38,8 +38,8 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlAeAntibandingMode { - ANDROID_CONTROL_AE_ANTIBANDING_MODE_OFF = 0, - ANDROID_CONTROL_AE_ANTIBANDING_MODE_50HZ = 1, - ANDROID_CONTROL_AE_ANTIBANDING_MODE_60HZ = 2, - ANDROID_CONTROL_AE_ANTIBANDING_MODE_AUTO = 3, + ANDROID_CONTROL_AE_ANTIBANDING_MODE_OFF, + ANDROID_CONTROL_AE_ANTIBANDING_MODE_50HZ, + ANDROID_CONTROL_AE_ANTIBANDING_MODE_60HZ, + ANDROID_CONTROL_AE_ANTIBANDING_MODE_AUTO, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeLock.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeLock.aidl index f825f112a1..766b835dc1 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeLock.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeLock.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlAeLock { - ANDROID_CONTROL_AE_LOCK_OFF = 0, - ANDROID_CONTROL_AE_LOCK_ON = 1, + ANDROID_CONTROL_AE_LOCK_OFF, + ANDROID_CONTROL_AE_LOCK_ON, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeLockAvailable.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeLockAvailable.aidl index df7924ed49..a22c93e379 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeLockAvailable.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeLockAvailable.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlAeLockAvailable { - ANDROID_CONTROL_AE_LOCK_AVAILABLE_FALSE = 0, - ANDROID_CONTROL_AE_LOCK_AVAILABLE_TRUE = 1, + ANDROID_CONTROL_AE_LOCK_AVAILABLE_FALSE, + ANDROID_CONTROL_AE_LOCK_AVAILABLE_TRUE, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeMode.aidl index 75a3486b37..5e1b87178e 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeMode.aidl @@ -38,10 +38,10 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlAeMode { - ANDROID_CONTROL_AE_MODE_OFF = 0, - ANDROID_CONTROL_AE_MODE_ON = 1, - ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH = 2, - ANDROID_CONTROL_AE_MODE_ON_ALWAYS_FLASH = 3, - ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE = 4, - ANDROID_CONTROL_AE_MODE_ON_EXTERNAL_FLASH = 5, + ANDROID_CONTROL_AE_MODE_OFF, + ANDROID_CONTROL_AE_MODE_ON, + ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH, + ANDROID_CONTROL_AE_MODE_ON_ALWAYS_FLASH, + ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE, + ANDROID_CONTROL_AE_MODE_ON_EXTERNAL_FLASH, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAePrecaptureTrigger.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAePrecaptureTrigger.aidl index 4678e01880..20382c0b3c 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAePrecaptureTrigger.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAePrecaptureTrigger.aidl @@ -38,7 +38,7 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlAePrecaptureTrigger { - ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE = 0, - ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_START = 1, - ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL = 2, + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE, + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_START, + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeState.aidl index 3be64ea802..e52eafe0d7 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeState.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAeState.aidl @@ -38,10 +38,10 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlAeState { - ANDROID_CONTROL_AE_STATE_INACTIVE = 0, - ANDROID_CONTROL_AE_STATE_SEARCHING = 1, - ANDROID_CONTROL_AE_STATE_CONVERGED = 2, - ANDROID_CONTROL_AE_STATE_LOCKED = 3, - ANDROID_CONTROL_AE_STATE_FLASH_REQUIRED = 4, - ANDROID_CONTROL_AE_STATE_PRECAPTURE = 5, + ANDROID_CONTROL_AE_STATE_INACTIVE, + ANDROID_CONTROL_AE_STATE_SEARCHING, + ANDROID_CONTROL_AE_STATE_CONVERGED, + ANDROID_CONTROL_AE_STATE_LOCKED, + ANDROID_CONTROL_AE_STATE_FLASH_REQUIRED, + ANDROID_CONTROL_AE_STATE_PRECAPTURE, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfMode.aidl index 155d3c9f92..6cd46c68db 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfMode.aidl @@ -38,10 +38,10 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlAfMode { - ANDROID_CONTROL_AF_MODE_OFF = 0, - ANDROID_CONTROL_AF_MODE_AUTO = 1, - ANDROID_CONTROL_AF_MODE_MACRO = 2, - ANDROID_CONTROL_AF_MODE_CONTINUOUS_VIDEO = 3, - ANDROID_CONTROL_AF_MODE_CONTINUOUS_PICTURE = 4, - ANDROID_CONTROL_AF_MODE_EDOF = 5, + ANDROID_CONTROL_AF_MODE_OFF, + ANDROID_CONTROL_AF_MODE_AUTO, + ANDROID_CONTROL_AF_MODE_MACRO, + ANDROID_CONTROL_AF_MODE_CONTINUOUS_VIDEO, + ANDROID_CONTROL_AF_MODE_CONTINUOUS_PICTURE, + ANDROID_CONTROL_AF_MODE_EDOF, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfSceneChange.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfSceneChange.aidl index 4b31c84fb2..ba853a1270 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfSceneChange.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfSceneChange.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlAfSceneChange { - ANDROID_CONTROL_AF_SCENE_CHANGE_NOT_DETECTED = 0, - ANDROID_CONTROL_AF_SCENE_CHANGE_DETECTED = 1, + ANDROID_CONTROL_AF_SCENE_CHANGE_NOT_DETECTED, + ANDROID_CONTROL_AF_SCENE_CHANGE_DETECTED, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfState.aidl index 4aac8c8a9d..25b6a1c01e 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfState.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfState.aidl @@ -38,11 +38,11 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlAfState { - ANDROID_CONTROL_AF_STATE_INACTIVE = 0, - ANDROID_CONTROL_AF_STATE_PASSIVE_SCAN = 1, - ANDROID_CONTROL_AF_STATE_PASSIVE_FOCUSED = 2, - ANDROID_CONTROL_AF_STATE_ACTIVE_SCAN = 3, - ANDROID_CONTROL_AF_STATE_FOCUSED_LOCKED = 4, - ANDROID_CONTROL_AF_STATE_NOT_FOCUSED_LOCKED = 5, - ANDROID_CONTROL_AF_STATE_PASSIVE_UNFOCUSED = 6, + ANDROID_CONTROL_AF_STATE_INACTIVE, + ANDROID_CONTROL_AF_STATE_PASSIVE_SCAN, + ANDROID_CONTROL_AF_STATE_PASSIVE_FOCUSED, + ANDROID_CONTROL_AF_STATE_ACTIVE_SCAN, + ANDROID_CONTROL_AF_STATE_FOCUSED_LOCKED, + ANDROID_CONTROL_AF_STATE_NOT_FOCUSED_LOCKED, + ANDROID_CONTROL_AF_STATE_PASSIVE_UNFOCUSED, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfTrigger.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfTrigger.aidl index 3fbf94b724..9d61b2d4dc 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfTrigger.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAfTrigger.aidl @@ -38,7 +38,7 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlAfTrigger { - ANDROID_CONTROL_AF_TRIGGER_IDLE = 0, - ANDROID_CONTROL_AF_TRIGGER_START = 1, - ANDROID_CONTROL_AF_TRIGGER_CANCEL = 2, + ANDROID_CONTROL_AF_TRIGGER_IDLE, + ANDROID_CONTROL_AF_TRIGGER_START, + ANDROID_CONTROL_AF_TRIGGER_CANCEL, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframing.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframing.aidl index eeb7bcd512..2daf00b586 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframing.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframing.aidl @@ -38,7 +38,7 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlAutoframing { - ANDROID_CONTROL_AUTOFRAMING_OFF = 0, - ANDROID_CONTROL_AUTOFRAMING_ON = 1, - ANDROID_CONTROL_AUTOFRAMING_AUTO = 2, + ANDROID_CONTROL_AUTOFRAMING_OFF, + ANDROID_CONTROL_AUTOFRAMING_ON, + ANDROID_CONTROL_AUTOFRAMING_AUTO, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframingAvailable.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframingAvailable.aidl index b075c325f9..ab91bb444b 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframingAvailable.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframingAvailable.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlAutoframingAvailable { - ANDROID_CONTROL_AUTOFRAMING_AVAILABLE_FALSE = 0, - ANDROID_CONTROL_AUTOFRAMING_AVAILABLE_TRUE = 1, + ANDROID_CONTROL_AUTOFRAMING_AVAILABLE_FALSE, + ANDROID_CONTROL_AUTOFRAMING_AVAILABLE_TRUE, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframingState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframingState.aidl index 60df0d4d44..db0d288fc4 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframingState.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAutoframingState.aidl @@ -38,7 +38,7 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlAutoframingState { - ANDROID_CONTROL_AUTOFRAMING_STATE_INACTIVE = 0, - ANDROID_CONTROL_AUTOFRAMING_STATE_FRAMING = 1, - ANDROID_CONTROL_AUTOFRAMING_STATE_CONVERGED = 2, + ANDROID_CONTROL_AUTOFRAMING_STATE_INACTIVE, + ANDROID_CONTROL_AUTOFRAMING_STATE_FRAMING, + ANDROID_CONTROL_AUTOFRAMING_STATE_CONVERGED, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbLock.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbLock.aidl index 0e297a51a3..949b5e89f2 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbLock.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbLock.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlAwbLock { - ANDROID_CONTROL_AWB_LOCK_OFF = 0, - ANDROID_CONTROL_AWB_LOCK_ON = 1, + ANDROID_CONTROL_AWB_LOCK_OFF, + ANDROID_CONTROL_AWB_LOCK_ON, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbLockAvailable.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbLockAvailable.aidl index d471d190bd..80c4c3175f 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbLockAvailable.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbLockAvailable.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlAwbLockAvailable { - ANDROID_CONTROL_AWB_LOCK_AVAILABLE_FALSE = 0, - ANDROID_CONTROL_AWB_LOCK_AVAILABLE_TRUE = 1, + ANDROID_CONTROL_AWB_LOCK_AVAILABLE_FALSE, + ANDROID_CONTROL_AWB_LOCK_AVAILABLE_TRUE, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbMode.aidl index a3463f835f..6ed9ece7aa 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbMode.aidl @@ -38,13 +38,13 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlAwbMode { - ANDROID_CONTROL_AWB_MODE_OFF = 0, - ANDROID_CONTROL_AWB_MODE_AUTO = 1, - ANDROID_CONTROL_AWB_MODE_INCANDESCENT = 2, - ANDROID_CONTROL_AWB_MODE_FLUORESCENT = 3, - ANDROID_CONTROL_AWB_MODE_WARM_FLUORESCENT = 4, - ANDROID_CONTROL_AWB_MODE_DAYLIGHT = 5, - ANDROID_CONTROL_AWB_MODE_CLOUDY_DAYLIGHT = 6, - ANDROID_CONTROL_AWB_MODE_TWILIGHT = 7, - ANDROID_CONTROL_AWB_MODE_SHADE = 8, + ANDROID_CONTROL_AWB_MODE_OFF, + ANDROID_CONTROL_AWB_MODE_AUTO, + ANDROID_CONTROL_AWB_MODE_INCANDESCENT, + ANDROID_CONTROL_AWB_MODE_FLUORESCENT, + ANDROID_CONTROL_AWB_MODE_WARM_FLUORESCENT, + ANDROID_CONTROL_AWB_MODE_DAYLIGHT, + ANDROID_CONTROL_AWB_MODE_CLOUDY_DAYLIGHT, + ANDROID_CONTROL_AWB_MODE_TWILIGHT, + ANDROID_CONTROL_AWB_MODE_SHADE, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbState.aidl index f1b0e40d2b..c5b02d5ed6 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbState.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlAwbState.aidl @@ -38,8 +38,8 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlAwbState { - ANDROID_CONTROL_AWB_STATE_INACTIVE = 0, - ANDROID_CONTROL_AWB_STATE_SEARCHING = 1, - ANDROID_CONTROL_AWB_STATE_CONVERGED = 2, - ANDROID_CONTROL_AWB_STATE_LOCKED = 3, + ANDROID_CONTROL_AWB_STATE_INACTIVE, + ANDROID_CONTROL_AWB_STATE_SEARCHING, + ANDROID_CONTROL_AWB_STATE_CONVERGED, + ANDROID_CONTROL_AWB_STATE_LOCKED, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlCaptureIntent.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlCaptureIntent.aidl index 283bb1be02..fa1c0a98ec 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlCaptureIntent.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlCaptureIntent.aidl @@ -38,12 +38,12 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlCaptureIntent { - ANDROID_CONTROL_CAPTURE_INTENT_CUSTOM = 0, - ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW = 1, - ANDROID_CONTROL_CAPTURE_INTENT_STILL_CAPTURE = 2, - ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_RECORD = 3, - ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT = 4, - ANDROID_CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG = 5, - ANDROID_CONTROL_CAPTURE_INTENT_MANUAL = 6, - ANDROID_CONTROL_CAPTURE_INTENT_MOTION_TRACKING = 7, + ANDROID_CONTROL_CAPTURE_INTENT_CUSTOM, + ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW, + ANDROID_CONTROL_CAPTURE_INTENT_STILL_CAPTURE, + ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_RECORD, + ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT, + ANDROID_CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG, + ANDROID_CONTROL_CAPTURE_INTENT_MANUAL, + ANDROID_CONTROL_CAPTURE_INTENT_MOTION_TRACKING, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlEffectMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlEffectMode.aidl index 911223dcf3..471deed753 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlEffectMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlEffectMode.aidl @@ -38,13 +38,13 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlEffectMode { - ANDROID_CONTROL_EFFECT_MODE_OFF = 0, - ANDROID_CONTROL_EFFECT_MODE_MONO = 1, - ANDROID_CONTROL_EFFECT_MODE_NEGATIVE = 2, - ANDROID_CONTROL_EFFECT_MODE_SOLARIZE = 3, - ANDROID_CONTROL_EFFECT_MODE_SEPIA = 4, - ANDROID_CONTROL_EFFECT_MODE_POSTERIZE = 5, - ANDROID_CONTROL_EFFECT_MODE_WHITEBOARD = 6, - ANDROID_CONTROL_EFFECT_MODE_BLACKBOARD = 7, - ANDROID_CONTROL_EFFECT_MODE_AQUA = 8, + ANDROID_CONTROL_EFFECT_MODE_OFF, + ANDROID_CONTROL_EFFECT_MODE_MONO, + ANDROID_CONTROL_EFFECT_MODE_NEGATIVE, + ANDROID_CONTROL_EFFECT_MODE_SOLARIZE, + ANDROID_CONTROL_EFFECT_MODE_SEPIA, + ANDROID_CONTROL_EFFECT_MODE_POSTERIZE, + ANDROID_CONTROL_EFFECT_MODE_WHITEBOARD, + ANDROID_CONTROL_EFFECT_MODE_BLACKBOARD, + ANDROID_CONTROL_EFFECT_MODE_AQUA, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlEnableZsl.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlEnableZsl.aidl index 920def7c20..3f2d4a32d1 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlEnableZsl.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlEnableZsl.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlEnableZsl { - ANDROID_CONTROL_ENABLE_ZSL_FALSE = 0, - ANDROID_CONTROL_ENABLE_ZSL_TRUE = 1, + ANDROID_CONTROL_ENABLE_ZSL_FALSE, + ANDROID_CONTROL_ENABLE_ZSL_TRUE, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlExtendedSceneMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlExtendedSceneMode.aidl index 2655d6144a..7838288884 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlExtendedSceneMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlExtendedSceneMode.aidl @@ -39,7 +39,7 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlExtendedSceneMode { ANDROID_CONTROL_EXTENDED_SCENE_MODE_DISABLED = 0, - ANDROID_CONTROL_EXTENDED_SCENE_MODE_BOKEH_STILL_CAPTURE = 1, - ANDROID_CONTROL_EXTENDED_SCENE_MODE_BOKEH_CONTINUOUS = 2, - ANDROID_CONTROL_EXTENDED_SCENE_MODE_VENDOR_START = 64, + ANDROID_CONTROL_EXTENDED_SCENE_MODE_BOKEH_STILL_CAPTURE, + ANDROID_CONTROL_EXTENDED_SCENE_MODE_BOKEH_CONTINUOUS, + ANDROID_CONTROL_EXTENDED_SCENE_MODE_VENDOR_START = 0x40, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlMode.aidl index f58491e536..c5a8172a07 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlMode.aidl @@ -38,9 +38,9 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlMode { - ANDROID_CONTROL_MODE_OFF = 0, - ANDROID_CONTROL_MODE_AUTO = 1, - ANDROID_CONTROL_MODE_USE_SCENE_MODE = 2, - ANDROID_CONTROL_MODE_OFF_KEEP_STATE = 3, - ANDROID_CONTROL_MODE_USE_EXTENDED_SCENE_MODE = 4, + ANDROID_CONTROL_MODE_OFF, + ANDROID_CONTROL_MODE_AUTO, + ANDROID_CONTROL_MODE_USE_SCENE_MODE, + ANDROID_CONTROL_MODE_OFF_KEEP_STATE, + ANDROID_CONTROL_MODE_USE_EXTENDED_SCENE_MODE, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlSceneMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlSceneMode.aidl index 994bbf3aa7..62c67e3f3d 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlSceneMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlSceneMode.aidl @@ -39,25 +39,25 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlSceneMode { ANDROID_CONTROL_SCENE_MODE_DISABLED = 0, - ANDROID_CONTROL_SCENE_MODE_FACE_PRIORITY = 1, - ANDROID_CONTROL_SCENE_MODE_ACTION = 2, - ANDROID_CONTROL_SCENE_MODE_PORTRAIT = 3, - ANDROID_CONTROL_SCENE_MODE_LANDSCAPE = 4, - ANDROID_CONTROL_SCENE_MODE_NIGHT = 5, - ANDROID_CONTROL_SCENE_MODE_NIGHT_PORTRAIT = 6, - ANDROID_CONTROL_SCENE_MODE_THEATRE = 7, - ANDROID_CONTROL_SCENE_MODE_BEACH = 8, - ANDROID_CONTROL_SCENE_MODE_SNOW = 9, - ANDROID_CONTROL_SCENE_MODE_SUNSET = 10, - ANDROID_CONTROL_SCENE_MODE_STEADYPHOTO = 11, - ANDROID_CONTROL_SCENE_MODE_FIREWORKS = 12, - ANDROID_CONTROL_SCENE_MODE_SPORTS = 13, - ANDROID_CONTROL_SCENE_MODE_PARTY = 14, - ANDROID_CONTROL_SCENE_MODE_CANDLELIGHT = 15, - ANDROID_CONTROL_SCENE_MODE_BARCODE = 16, - ANDROID_CONTROL_SCENE_MODE_HIGH_SPEED_VIDEO = 17, - ANDROID_CONTROL_SCENE_MODE_HDR = 18, - ANDROID_CONTROL_SCENE_MODE_FACE_PRIORITY_LOW_LIGHT = 19, + ANDROID_CONTROL_SCENE_MODE_FACE_PRIORITY, + ANDROID_CONTROL_SCENE_MODE_ACTION, + ANDROID_CONTROL_SCENE_MODE_PORTRAIT, + ANDROID_CONTROL_SCENE_MODE_LANDSCAPE, + ANDROID_CONTROL_SCENE_MODE_NIGHT, + ANDROID_CONTROL_SCENE_MODE_NIGHT_PORTRAIT, + ANDROID_CONTROL_SCENE_MODE_THEATRE, + ANDROID_CONTROL_SCENE_MODE_BEACH, + ANDROID_CONTROL_SCENE_MODE_SNOW, + ANDROID_CONTROL_SCENE_MODE_SUNSET, + ANDROID_CONTROL_SCENE_MODE_STEADYPHOTO, + ANDROID_CONTROL_SCENE_MODE_FIREWORKS, + ANDROID_CONTROL_SCENE_MODE_SPORTS, + ANDROID_CONTROL_SCENE_MODE_PARTY, + ANDROID_CONTROL_SCENE_MODE_CANDLELIGHT, + ANDROID_CONTROL_SCENE_MODE_BARCODE, + ANDROID_CONTROL_SCENE_MODE_HIGH_SPEED_VIDEO, + ANDROID_CONTROL_SCENE_MODE_HDR, + ANDROID_CONTROL_SCENE_MODE_FACE_PRIORITY_LOW_LIGHT, ANDROID_CONTROL_SCENE_MODE_DEVICE_CUSTOM_START = 100, ANDROID_CONTROL_SCENE_MODE_DEVICE_CUSTOM_END = 127, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlSettingsOverride.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlSettingsOverride.aidl index ed5d46f0f9..404bbfa50c 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlSettingsOverride.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlSettingsOverride.aidl @@ -38,7 +38,7 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlSettingsOverride { - ANDROID_CONTROL_SETTINGS_OVERRIDE_OFF = 0, - ANDROID_CONTROL_SETTINGS_OVERRIDE_ZOOM = 1, - ANDROID_CONTROL_SETTINGS_OVERRIDE_VENDOR_START = 16384, + ANDROID_CONTROL_SETTINGS_OVERRIDE_OFF, + ANDROID_CONTROL_SETTINGS_OVERRIDE_ZOOM, + ANDROID_CONTROL_SETTINGS_OVERRIDE_VENDOR_START = 0x4000, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlVideoStabilizationMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlVideoStabilizationMode.aidl index b3b24f750b..2b199eff0e 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlVideoStabilizationMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ControlVideoStabilizationMode.aidl @@ -38,7 +38,7 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ControlVideoStabilizationMode { - ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_OFF = 0, - ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_ON = 1, - ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION = 2, + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_OFF, + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_ON, + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DemosaicMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DemosaicMode.aidl index 26874a2f85..577000933b 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DemosaicMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DemosaicMode.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum DemosaicMode { - ANDROID_DEMOSAIC_MODE_FAST = 0, - ANDROID_DEMOSAIC_MODE_HIGH_QUALITY = 1, + ANDROID_DEMOSAIC_MODE_FAST, + ANDROID_DEMOSAIC_MODE_HIGH_QUALITY, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurations.aidl index 6a154ca0c9..0cce2da7a5 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurations.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurations.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum DepthAvailableDepthStreamConfigurations { - ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_OUTPUT = 0, - ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_INPUT = 1, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_OUTPUT, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_INPUT, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurationsMaximumResolution.aidl index 23d6589a1c..9be06db77a 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurationsMaximumResolution.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurationsMaximumResolution.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum DepthAvailableDepthStreamConfigurationsMaximumResolution { - ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT = 0, - ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT = 1, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurations.aidl index f3ca03964f..c6aebaad0a 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurations.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurations.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum DepthAvailableDynamicDepthStreamConfigurations { - ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_OUTPUT = 0, - ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_INPUT = 1, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_OUTPUT, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_INPUT, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurationsMaximumResolution.aidl index 46a4ce61e6..4d5161d800 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurationsMaximumResolution.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurationsMaximumResolution.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum DepthAvailableDynamicDepthStreamConfigurationsMaximumResolution { - ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT = 0, - ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT = 1, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthDepthIsExclusive.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthDepthIsExclusive.aidl index f5fc218318..f7b69cd289 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthDepthIsExclusive.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DepthDepthIsExclusive.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum DepthDepthIsExclusive { - ANDROID_DEPTH_DEPTH_IS_EXCLUSIVE_FALSE = 0, - ANDROID_DEPTH_DEPTH_IS_EXCLUSIVE_TRUE = 1, + ANDROID_DEPTH_DEPTH_IS_EXCLUSIVE_FALSE, + ANDROID_DEPTH_DEPTH_IS_EXCLUSIVE_TRUE, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DistortionCorrectionMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DistortionCorrectionMode.aidl index 46327e0bea..6e965f64f0 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DistortionCorrectionMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/DistortionCorrectionMode.aidl @@ -38,7 +38,7 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum DistortionCorrectionMode { - ANDROID_DISTORTION_CORRECTION_MODE_OFF = 0, - ANDROID_DISTORTION_CORRECTION_MODE_FAST = 1, - ANDROID_DISTORTION_CORRECTION_MODE_HIGH_QUALITY = 2, + ANDROID_DISTORTION_CORRECTION_MODE_OFF, + ANDROID_DISTORTION_CORRECTION_MODE_FAST, + ANDROID_DISTORTION_CORRECTION_MODE_HIGH_QUALITY, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/EdgeMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/EdgeMode.aidl index 4b02e194bc..fdd32f429a 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/EdgeMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/EdgeMode.aidl @@ -38,8 +38,8 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum EdgeMode { - ANDROID_EDGE_MODE_OFF = 0, - ANDROID_EDGE_MODE_FAST = 1, - ANDROID_EDGE_MODE_HIGH_QUALITY = 2, - ANDROID_EDGE_MODE_ZERO_SHUTTER_LAG = 3, + ANDROID_EDGE_MODE_OFF, + ANDROID_EDGE_MODE_FAST, + ANDROID_EDGE_MODE_HIGH_QUALITY, + ANDROID_EDGE_MODE_ZERO_SHUTTER_LAG, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/FlashInfoAvailable.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/FlashInfoAvailable.aidl index 10d07a5c96..83292fee4c 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/FlashInfoAvailable.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/FlashInfoAvailable.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum FlashInfoAvailable { - ANDROID_FLASH_INFO_AVAILABLE_FALSE = 0, - ANDROID_FLASH_INFO_AVAILABLE_TRUE = 1, + ANDROID_FLASH_INFO_AVAILABLE_FALSE, + ANDROID_FLASH_INFO_AVAILABLE_TRUE, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/FlashMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/FlashMode.aidl index 1ab056067e..e18ea3c076 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/FlashMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/FlashMode.aidl @@ -38,7 +38,7 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum FlashMode { - ANDROID_FLASH_MODE_OFF = 0, - ANDROID_FLASH_MODE_SINGLE = 1, - ANDROID_FLASH_MODE_TORCH = 2, + ANDROID_FLASH_MODE_OFF, + ANDROID_FLASH_MODE_SINGLE, + ANDROID_FLASH_MODE_TORCH, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/FlashState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/FlashState.aidl index a571e6608d..4343d4f1d6 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/FlashState.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/FlashState.aidl @@ -38,9 +38,9 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum FlashState { - ANDROID_FLASH_STATE_UNAVAILABLE = 0, - ANDROID_FLASH_STATE_CHARGING = 1, - ANDROID_FLASH_STATE_READY = 2, - ANDROID_FLASH_STATE_FIRED = 3, - ANDROID_FLASH_STATE_PARTIAL = 4, + ANDROID_FLASH_STATE_UNAVAILABLE, + ANDROID_FLASH_STATE_CHARGING, + ANDROID_FLASH_STATE_READY, + ANDROID_FLASH_STATE_FIRED, + ANDROID_FLASH_STATE_PARTIAL, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurations.aidl index d92c2db86d..3957267612 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurations.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurations.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum HeicAvailableHeicStreamConfigurations { - ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_OUTPUT = 0, - ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_INPUT = 1, + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_OUTPUT, + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_INPUT, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurationsMaximumResolution.aidl index f02cf588bf..4eda5386d8 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurationsMaximumResolution.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurationsMaximumResolution.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum HeicAvailableHeicStreamConfigurationsMaximumResolution { - ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT = 0, - ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT = 1, + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT, + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HeicInfoSupported.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HeicInfoSupported.aidl index ae5a8e784e..7079bbf82b 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HeicInfoSupported.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HeicInfoSupported.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum HeicInfoSupported { - ANDROID_HEIC_INFO_SUPPORTED_FALSE = 0, - ANDROID_HEIC_INFO_SUPPORTED_TRUE = 1, + ANDROID_HEIC_INFO_SUPPORTED_FALSE, + ANDROID_HEIC_INFO_SUPPORTED_TRUE, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HotPixelMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HotPixelMode.aidl index 1248c6040f..50b3446208 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HotPixelMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/HotPixelMode.aidl @@ -38,7 +38,7 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum HotPixelMode { - ANDROID_HOT_PIXEL_MODE_OFF = 0, - ANDROID_HOT_PIXEL_MODE_FAST = 1, - ANDROID_HOT_PIXEL_MODE_HIGH_QUALITY = 2, + ANDROID_HOT_PIXEL_MODE_OFF, + ANDROID_HOT_PIXEL_MODE_FAST, + ANDROID_HOT_PIXEL_MODE_HIGH_QUALITY, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl index 1272f27944..7303ff5a71 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl @@ -38,5 +38,5 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum InfoSupportedBufferManagementVersion { - ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_AIDL_DEVICE = 0, + ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_AIDL_DEVICE, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/InfoSupportedHardwareLevel.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/InfoSupportedHardwareLevel.aidl index 8ae39b0984..3b5064757b 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/InfoSupportedHardwareLevel.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/InfoSupportedHardwareLevel.aidl @@ -38,9 +38,9 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum InfoSupportedHardwareLevel { - ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED = 0, - ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_FULL = 1, - ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY = 2, - ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_3 = 3, - ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL = 4, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_FULL, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_3, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurations.aidl index cd005b5cc6..cf9dbb72b9 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurations.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurations.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum JpegrAvailableJpegRStreamConfigurations { - ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_OUTPUT = 0, - ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_INPUT = 1, + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_OUTPUT, + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_INPUT, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurationsMaximumResolution.aidl index 68028dbe47..0a95e1f3a9 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurationsMaximumResolution.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurationsMaximumResolution.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum JpegrAvailableJpegRStreamConfigurationsMaximumResolution { - ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT = 0, - ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT = 1, + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT, + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LedAvailableLeds.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LedAvailableLeds.aidl index da558d2056..b3beb2d144 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LedAvailableLeds.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LedAvailableLeds.aidl @@ -38,5 +38,5 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum LedAvailableLeds { - ANDROID_LED_AVAILABLE_LEDS_TRANSMIT = 0, + ANDROID_LED_AVAILABLE_LEDS_TRANSMIT, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LedTransmit.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LedTransmit.aidl index 658b3cd3b2..0cbf239c94 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LedTransmit.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LedTransmit.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum LedTransmit { - ANDROID_LED_TRANSMIT_OFF = 0, - ANDROID_LED_TRANSMIT_ON = 1, + ANDROID_LED_TRANSMIT_OFF, + ANDROID_LED_TRANSMIT_ON, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensFacing.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensFacing.aidl index 4db987bc67..d15674dc11 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensFacing.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensFacing.aidl @@ -38,7 +38,7 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum LensFacing { - ANDROID_LENS_FACING_FRONT = 0, - ANDROID_LENS_FACING_BACK = 1, - ANDROID_LENS_FACING_EXTERNAL = 2, + ANDROID_LENS_FACING_FRONT, + ANDROID_LENS_FACING_BACK, + ANDROID_LENS_FACING_EXTERNAL, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensInfoFocusDistanceCalibration.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensInfoFocusDistanceCalibration.aidl index d83d67f103..937347b1fd 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensInfoFocusDistanceCalibration.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensInfoFocusDistanceCalibration.aidl @@ -38,7 +38,7 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum LensInfoFocusDistanceCalibration { - ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_UNCALIBRATED = 0, - ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_APPROXIMATE = 1, - ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_CALIBRATED = 2, + ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_UNCALIBRATED, + ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_APPROXIMATE, + ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_CALIBRATED, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensOpticalStabilizationMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensOpticalStabilizationMode.aidl index f2f039c39a..550d9f3209 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensOpticalStabilizationMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensOpticalStabilizationMode.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum LensOpticalStabilizationMode { - ANDROID_LENS_OPTICAL_STABILIZATION_MODE_OFF = 0, - ANDROID_LENS_OPTICAL_STABILIZATION_MODE_ON = 1, + ANDROID_LENS_OPTICAL_STABILIZATION_MODE_OFF, + ANDROID_LENS_OPTICAL_STABILIZATION_MODE_ON, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensPoseReference.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensPoseReference.aidl index b2d837a0ff..6a3799df39 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensPoseReference.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensPoseReference.aidl @@ -38,8 +38,8 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum LensPoseReference { - ANDROID_LENS_POSE_REFERENCE_PRIMARY_CAMERA = 0, - ANDROID_LENS_POSE_REFERENCE_GYROSCOPE = 1, - ANDROID_LENS_POSE_REFERENCE_UNDEFINED = 2, - ANDROID_LENS_POSE_REFERENCE_AUTOMOTIVE = 3, + ANDROID_LENS_POSE_REFERENCE_PRIMARY_CAMERA, + ANDROID_LENS_POSE_REFERENCE_GYROSCOPE, + ANDROID_LENS_POSE_REFERENCE_UNDEFINED, + ANDROID_LENS_POSE_REFERENCE_AUTOMOTIVE, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensState.aidl index 4b15b0fe20..4f9895607d 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensState.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LensState.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum LensState { - ANDROID_LENS_STATE_STATIONARY = 0, - ANDROID_LENS_STATE_MOVING = 1, + ANDROID_LENS_STATE_STATIONARY, + ANDROID_LENS_STATE_MOVING, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LogicalMultiCameraSensorSyncType.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LogicalMultiCameraSensorSyncType.aidl index 224a7fab64..5eb5759b9e 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LogicalMultiCameraSensorSyncType.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/LogicalMultiCameraSensorSyncType.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum LogicalMultiCameraSensorSyncType { - ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE = 0, - ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED = 1, + ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE, + ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/NoiseReductionMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/NoiseReductionMode.aidl index ed0ebc164a..8b589ce819 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/NoiseReductionMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/NoiseReductionMode.aidl @@ -38,9 +38,9 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum NoiseReductionMode { - ANDROID_NOISE_REDUCTION_MODE_OFF = 0, - ANDROID_NOISE_REDUCTION_MODE_FAST = 1, - ANDROID_NOISE_REDUCTION_MODE_HIGH_QUALITY = 2, - ANDROID_NOISE_REDUCTION_MODE_MINIMAL = 3, - ANDROID_NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG = 4, + ANDROID_NOISE_REDUCTION_MODE_OFF, + ANDROID_NOISE_REDUCTION_MODE_FAST, + ANDROID_NOISE_REDUCTION_MODE_HIGH_QUALITY, + ANDROID_NOISE_REDUCTION_MODE_MINIMAL, + ANDROID_NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/QuirksPartialResult.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/QuirksPartialResult.aidl index d217fe8055..8ab6a05700 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/QuirksPartialResult.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/QuirksPartialResult.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum QuirksPartialResult { - ANDROID_QUIRKS_PARTIAL_RESULT_FINAL = 0, - ANDROID_QUIRKS_PARTIAL_RESULT_PARTIAL = 1, + ANDROID_QUIRKS_PARTIAL_RESULT_FINAL, + ANDROID_QUIRKS_PARTIAL_RESULT_PARTIAL, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl index 37b1decc18..0564db8da9 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl @@ -38,25 +38,25 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum RequestAvailableCapabilities { - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE = 0, - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR = 1, - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING = 2, - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_RAW = 3, - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_PRIVATE_REPROCESSING = 4, - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_READ_SENSOR_SETTINGS = 5, - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE = 6, - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_YUV_REPROCESSING = 7, - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT = 8, - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_CONSTRAINED_HIGH_SPEED_VIDEO = 9, - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING = 10, - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA = 11, - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME = 12, - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SECURE_IMAGE_DATA = 13, - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SYSTEM_CAMERA = 14, - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_OFFLINE_PROCESSING = 15, - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR = 16, - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_REMOSAIC_REPROCESSING = 17, - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT = 18, - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE = 19, - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_COLOR_SPACE_PROFILES = 20, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_RAW, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_PRIVATE_REPROCESSING, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_READ_SENSOR_SETTINGS, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_YUV_REPROCESSING, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_CONSTRAINED_HIGH_SPEED_VIDEO, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SECURE_IMAGE_DATA, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SYSTEM_CAMERA, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_OFFLINE_PROCESSING, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_REMOSAIC_REPROCESSING, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_COLOR_SPACE_PROFILES, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl index 0d59ab0f6a..74606bf110 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl @@ -38,21 +38,8 @@ package android.hardware.camera.metadata; @Backing(type="long") @VintfStability enum RequestAvailableColorSpaceProfilesMap { - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED = -1, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_SRGB = 0, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_LINEAR_SRGB = 1, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_EXTENDED_SRGB = 2, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_LINEAR_EXTENDED_SRGB = 3, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_BT709 = 4, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_BT2020 = 5, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_DCI_P3 = 6, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_DISPLAY_P3 = 7, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_NTSC_1953 = 8, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_SMPTE_C = 9, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ADOBE_RGB = 10, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_PRO_PHOTO_RGB = 11, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ACES = 12, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ACESCG = 13, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_CIE_XYZ = 14, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_CIE_LAB = 15, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED = (-1L) /* -1 */, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_SRGB = 0L, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_DISPLAY_P3 = 7L, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_BT2020_HLG = 16L, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableDynamicRangeProfilesMap.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableDynamicRangeProfilesMap.aidl index 16e38ba90f..45ffb1be1a 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableDynamicRangeProfilesMap.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestAvailableDynamicRangeProfilesMap.aidl @@ -38,17 +38,17 @@ package android.hardware.camera.metadata; @Backing(type="long") @VintfStability enum RequestAvailableDynamicRangeProfilesMap { - ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD = 1, - ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HLG10 = 2, - ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10 = 4, - ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10_PLUS = 8, - ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF = 16, - ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF_PO = 32, - ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM = 64, - ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM_PO = 128, - ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF = 256, - ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF_PO = 512, - ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM = 1024, - ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM_PO = 2048, - ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_MAX = 4096, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD = 0x1L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HLG10 = 0x2L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10 = 0x4L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10_PLUS = 0x8L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF = 0x10L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF_PO = 0x20L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM = 0x40L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM_PO = 0x80L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF = 0x100L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF_PO = 0x200L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM = 0x400L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM_PO = 0x800L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_MAX = 0x1000L, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestMetadataMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestMetadataMode.aidl index 90fba00fe0..cede79950c 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestMetadataMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestMetadataMode.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum RequestMetadataMode { - ANDROID_REQUEST_METADATA_MODE_NONE = 0, - ANDROID_REQUEST_METADATA_MODE_FULL = 1, + ANDROID_REQUEST_METADATA_MODE_NONE, + ANDROID_REQUEST_METADATA_MODE_FULL, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestType.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestType.aidl index 4f38cfbb4d..6b4ae71862 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestType.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/RequestType.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum RequestType { - ANDROID_REQUEST_TYPE_CAPTURE = 0, - ANDROID_REQUEST_TYPE_REPROCESS = 1, + ANDROID_REQUEST_TYPE_CAPTURE, + ANDROID_REQUEST_TYPE_REPROCESS, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableFormats.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableFormats.aidl index 41fd2c2340..fdc2f60887 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableFormats.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableFormats.aidl @@ -38,14 +38,14 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ScalerAvailableFormats { - ANDROID_SCALER_AVAILABLE_FORMATS_RAW16 = 32, - ANDROID_SCALER_AVAILABLE_FORMATS_RAW_OPAQUE = 36, - ANDROID_SCALER_AVAILABLE_FORMATS_YV12 = 842094169, - ANDROID_SCALER_AVAILABLE_FORMATS_YCrCb_420_SP = 17, - ANDROID_SCALER_AVAILABLE_FORMATS_IMPLEMENTATION_DEFINED = 34, - ANDROID_SCALER_AVAILABLE_FORMATS_YCbCr_420_888 = 35, - ANDROID_SCALER_AVAILABLE_FORMATS_BLOB = 33, - ANDROID_SCALER_AVAILABLE_FORMATS_RAW10 = 37, - ANDROID_SCALER_AVAILABLE_FORMATS_RAW12 = 38, - ANDROID_SCALER_AVAILABLE_FORMATS_Y8 = 538982489, + ANDROID_SCALER_AVAILABLE_FORMATS_RAW16 = 0x20, + ANDROID_SCALER_AVAILABLE_FORMATS_RAW_OPAQUE = 0x24, + ANDROID_SCALER_AVAILABLE_FORMATS_YV12 = 0x32315659, + ANDROID_SCALER_AVAILABLE_FORMATS_YCrCb_420_SP = 0x11, + ANDROID_SCALER_AVAILABLE_FORMATS_IMPLEMENTATION_DEFINED = 0x22, + ANDROID_SCALER_AVAILABLE_FORMATS_YCbCr_420_888 = 0x23, + ANDROID_SCALER_AVAILABLE_FORMATS_BLOB = 0x21, + ANDROID_SCALER_AVAILABLE_FORMATS_RAW10 = 0x25, + ANDROID_SCALER_AVAILABLE_FORMATS_RAW12 = 0x26, + ANDROID_SCALER_AVAILABLE_FORMATS_Y8 = 0x20203859, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableRecommendedStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableRecommendedStreamConfigurations.aidl index 85daa85849..741a99d839 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableRecommendedStreamConfigurations.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableRecommendedStreamConfigurations.aidl @@ -38,13 +38,13 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ScalerAvailableRecommendedStreamConfigurations { - ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_PREVIEW = 0, - ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_RECORD = 1, - ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_VIDEO_SNAPSHOT = 2, - ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_SNAPSHOT = 3, - ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_ZSL = 4, - ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_RAW = 5, - ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_LOW_LATENCY_SNAPSHOT = 6, - ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_10BIT_OUTPUT = 8, - ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_VENDOR_START = 24, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_PREVIEW = 0x0, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_RECORD = 0x1, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_VIDEO_SNAPSHOT = 0x2, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_SNAPSHOT = 0x3, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_ZSL = 0x4, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_RAW = 0x5, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_LOW_LATENCY_SNAPSHOT = 0x6, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_10BIT_OUTPUT = 0x8, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_VENDOR_START = 0x18, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamConfigurations.aidl index 1515ad5552..4e2899d46e 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamConfigurations.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamConfigurations.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ScalerAvailableStreamConfigurations { - ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT = 0, - ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT = 1, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamConfigurationsMaximumResolution.aidl index b9c3374e90..fb15815dfe 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamConfigurationsMaximumResolution.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamConfigurationsMaximumResolution.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ScalerAvailableStreamConfigurationsMaximumResolution { - ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT = 0, - ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT = 1, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl index 958fa122b0..ff92f9efd2 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl @@ -38,12 +38,12 @@ package android.hardware.camera.metadata; @Backing(type="long") @VintfStability enum ScalerAvailableStreamUseCases { - ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT = 0, - ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW = 1, - ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_STILL_CAPTURE = 2, - ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_RECORD = 3, - ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW_VIDEO_STILL = 4, - ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_CALL = 5, - ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW = 6, - ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VENDOR_START = 65536, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT = 0x0L, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW = 0x1L, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_STILL_CAPTURE = 0x2L, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_RECORD = 0x3L, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW_VIDEO_STILL = 0x4L, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_CALL = 0x5L, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW = 0x6L, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VENDOR_START = 0x10000L, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerCroppingType.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerCroppingType.aidl index 0487196937..60782e4650 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerCroppingType.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerCroppingType.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ScalerCroppingType { - ANDROID_SCALER_CROPPING_TYPE_CENTER_ONLY = 0, - ANDROID_SCALER_CROPPING_TYPE_FREEFORM = 1, + ANDROID_SCALER_CROPPING_TYPE_CENTER_ONLY, + ANDROID_SCALER_CROPPING_TYPE_FREEFORM, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerMultiResolutionStreamSupported.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerMultiResolutionStreamSupported.aidl index 711243f58c..e09d89c182 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerMultiResolutionStreamSupported.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerMultiResolutionStreamSupported.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ScalerMultiResolutionStreamSupported { - ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED_FALSE = 0, - ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED_TRUE = 1, + ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED_FALSE, + ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED_TRUE, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerPhysicalCameraMultiResolutionStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerPhysicalCameraMultiResolutionStreamConfigurations.aidl index 50bc09780e..64a022018b 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerPhysicalCameraMultiResolutionStreamConfigurations.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerPhysicalCameraMultiResolutionStreamConfigurations.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ScalerPhysicalCameraMultiResolutionStreamConfigurations { - ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_OUTPUT = 0, - ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_INPUT = 1, + ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_OUTPUT, + ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_INPUT, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerRotateAndCrop.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerRotateAndCrop.aidl index 3b9c5b8ef9..bf5380eea4 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerRotateAndCrop.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ScalerRotateAndCrop.aidl @@ -38,9 +38,9 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ScalerRotateAndCrop { - ANDROID_SCALER_ROTATE_AND_CROP_NONE = 0, - ANDROID_SCALER_ROTATE_AND_CROP_90 = 1, - ANDROID_SCALER_ROTATE_AND_CROP_180 = 2, - ANDROID_SCALER_ROTATE_AND_CROP_270 = 3, - ANDROID_SCALER_ROTATE_AND_CROP_AUTO = 4, + ANDROID_SCALER_ROTATE_AND_CROP_NONE, + ANDROID_SCALER_ROTATE_AND_CROP_90, + ANDROID_SCALER_ROTATE_AND_CROP_180, + ANDROID_SCALER_ROTATE_AND_CROP_270, + ANDROID_SCALER_ROTATE_AND_CROP_AUTO, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorInfoColorFilterArrangement.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorInfoColorFilterArrangement.aidl index 3400233f0c..c96f3c5e91 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorInfoColorFilterArrangement.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorInfoColorFilterArrangement.aidl @@ -38,11 +38,11 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum SensorInfoColorFilterArrangement { - ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGGB = 0, - ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GRBG = 1, - ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GBRG = 2, - ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_BGGR = 3, - ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGB = 4, - ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO = 5, - ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR = 6, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGGB, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GRBG, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GBRG, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_BGGR, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGB, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorInfoLensShadingApplied.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorInfoLensShadingApplied.aidl index c8faaee8bc..0153731bbc 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorInfoLensShadingApplied.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorInfoLensShadingApplied.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum SensorInfoLensShadingApplied { - ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED_FALSE = 0, - ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED_TRUE = 1, + ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED_FALSE, + ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED_TRUE, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorInfoTimestampSource.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorInfoTimestampSource.aidl index 2a4b3dd08b..9a00cf155e 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorInfoTimestampSource.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorInfoTimestampSource.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum SensorInfoTimestampSource { - ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN = 0, - ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME = 1, + ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN, + ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorPixelMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorPixelMode.aidl index e0214341cf..5f055d6b23 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorPixelMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorPixelMode.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum SensorPixelMode { - ANDROID_SENSOR_PIXEL_MODE_DEFAULT = 0, - ANDROID_SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION = 1, + ANDROID_SENSOR_PIXEL_MODE_DEFAULT, + ANDROID_SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorRawBinningFactorUsed.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorRawBinningFactorUsed.aidl index a1f0c5fed5..851dae0f8e 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorRawBinningFactorUsed.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorRawBinningFactorUsed.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum SensorRawBinningFactorUsed { - ANDROID_SENSOR_RAW_BINNING_FACTOR_USED_TRUE = 0, - ANDROID_SENSOR_RAW_BINNING_FACTOR_USED_FALSE = 1, + ANDROID_SENSOR_RAW_BINNING_FACTOR_USED_TRUE, + ANDROID_SENSOR_RAW_BINNING_FACTOR_USED_FALSE, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorTestPatternMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorTestPatternMode.aidl index 3f49b9a731..98f0ebe855 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorTestPatternMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SensorTestPatternMode.aidl @@ -38,11 +38,11 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum SensorTestPatternMode { - ANDROID_SENSOR_TEST_PATTERN_MODE_OFF = 0, - ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR = 1, - ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS = 2, - ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY = 3, - ANDROID_SENSOR_TEST_PATTERN_MODE_PN9 = 4, - ANDROID_SENSOR_TEST_PATTERN_MODE_BLACK = 5, + ANDROID_SENSOR_TEST_PATTERN_MODE_OFF, + ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR, + ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS, + ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY, + ANDROID_SENSOR_TEST_PATTERN_MODE_PN9, + ANDROID_SENSOR_TEST_PATTERN_MODE_BLACK, ANDROID_SENSOR_TEST_PATTERN_MODE_CUSTOM1 = 256, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ShadingMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ShadingMode.aidl index a2d2a320fc..ffc6a560ad 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ShadingMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/ShadingMode.aidl @@ -38,7 +38,7 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum ShadingMode { - ANDROID_SHADING_MODE_OFF = 0, - ANDROID_SHADING_MODE_FAST = 1, - ANDROID_SHADING_MODE_HIGH_QUALITY = 2, + ANDROID_SHADING_MODE_OFF, + ANDROID_SHADING_MODE_FAST, + ANDROID_SHADING_MODE_HIGH_QUALITY, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsFaceDetectMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsFaceDetectMode.aidl index 1c65f990be..48c6797a02 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsFaceDetectMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsFaceDetectMode.aidl @@ -38,7 +38,7 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum StatisticsFaceDetectMode { - ANDROID_STATISTICS_FACE_DETECT_MODE_OFF = 0, - ANDROID_STATISTICS_FACE_DETECT_MODE_SIMPLE = 1, - ANDROID_STATISTICS_FACE_DETECT_MODE_FULL = 2, + ANDROID_STATISTICS_FACE_DETECT_MODE_OFF, + ANDROID_STATISTICS_FACE_DETECT_MODE_SIMPLE, + ANDROID_STATISTICS_FACE_DETECT_MODE_FULL, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsHistogramMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsHistogramMode.aidl index 39a013e32f..354518b2cc 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsHistogramMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsHistogramMode.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum StatisticsHistogramMode { - ANDROID_STATISTICS_HISTOGRAM_MODE_OFF = 0, - ANDROID_STATISTICS_HISTOGRAM_MODE_ON = 1, + ANDROID_STATISTICS_HISTOGRAM_MODE_OFF, + ANDROID_STATISTICS_HISTOGRAM_MODE_ON, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsHotPixelMapMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsHotPixelMapMode.aidl index 3a8c6c2a03..b96e4be645 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsHotPixelMapMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsHotPixelMapMode.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum StatisticsHotPixelMapMode { - ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE_OFF = 0, - ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE_ON = 1, + ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE_OFF, + ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE_ON, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsLensShadingMapMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsLensShadingMapMode.aidl index cc280caca6..7d0b0823e4 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsLensShadingMapMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsLensShadingMapMode.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum StatisticsLensShadingMapMode { - ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_OFF = 0, - ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_ON = 1, + ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_OFF, + ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_ON, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsOisDataMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsOisDataMode.aidl index 6607037cb9..b80889bdec 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsOisDataMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsOisDataMode.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum StatisticsOisDataMode { - ANDROID_STATISTICS_OIS_DATA_MODE_OFF = 0, - ANDROID_STATISTICS_OIS_DATA_MODE_ON = 1, + ANDROID_STATISTICS_OIS_DATA_MODE_OFF, + ANDROID_STATISTICS_OIS_DATA_MODE_ON, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsSceneFlicker.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsSceneFlicker.aidl index bc286c36cd..a9268c07b1 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsSceneFlicker.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsSceneFlicker.aidl @@ -38,7 +38,7 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum StatisticsSceneFlicker { - ANDROID_STATISTICS_SCENE_FLICKER_NONE = 0, - ANDROID_STATISTICS_SCENE_FLICKER_50HZ = 1, - ANDROID_STATISTICS_SCENE_FLICKER_60HZ = 2, + ANDROID_STATISTICS_SCENE_FLICKER_NONE, + ANDROID_STATISTICS_SCENE_FLICKER_50HZ, + ANDROID_STATISTICS_SCENE_FLICKER_60HZ, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsSharpnessMapMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsSharpnessMapMode.aidl index 774a43a76d..09a2003887 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsSharpnessMapMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/StatisticsSharpnessMapMode.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum StatisticsSharpnessMapMode { - ANDROID_STATISTICS_SHARPNESS_MAP_MODE_OFF = 0, - ANDROID_STATISTICS_SHARPNESS_MAP_MODE_ON = 1, + ANDROID_STATISTICS_SHARPNESS_MAP_MODE_OFF, + ANDROID_STATISTICS_SHARPNESS_MAP_MODE_ON, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SyncFrameNumber.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SyncFrameNumber.aidl index 12ccbb9479..230f57e67f 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SyncFrameNumber.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SyncFrameNumber.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum SyncFrameNumber { - ANDROID_SYNC_FRAME_NUMBER_CONVERGING = -1, - ANDROID_SYNC_FRAME_NUMBER_UNKNOWN = -2, + ANDROID_SYNC_FRAME_NUMBER_CONVERGING = (-1) /* -1 */, + ANDROID_SYNC_FRAME_NUMBER_UNKNOWN = (-2) /* -2 */, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SyncMaxLatency.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SyncMaxLatency.aidl index e0116e7117..d484f45e77 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SyncMaxLatency.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/SyncMaxLatency.aidl @@ -39,5 +39,5 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum SyncMaxLatency { ANDROID_SYNC_MAX_LATENCY_PER_FRAME_CONTROL = 0, - ANDROID_SYNC_MAX_LATENCY_UNKNOWN = -1, + ANDROID_SYNC_MAX_LATENCY_UNKNOWN = (-1) /* -1 */, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/TonemapMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/TonemapMode.aidl index 728b2987ee..e729166000 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/TonemapMode.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/TonemapMode.aidl @@ -38,9 +38,9 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum TonemapMode { - ANDROID_TONEMAP_MODE_CONTRAST_CURVE = 0, - ANDROID_TONEMAP_MODE_FAST = 1, - ANDROID_TONEMAP_MODE_HIGH_QUALITY = 2, - ANDROID_TONEMAP_MODE_GAMMA_VALUE = 3, - ANDROID_TONEMAP_MODE_PRESET_CURVE = 4, + ANDROID_TONEMAP_MODE_CONTRAST_CURVE, + ANDROID_TONEMAP_MODE_FAST, + ANDROID_TONEMAP_MODE_HIGH_QUALITY, + ANDROID_TONEMAP_MODE_GAMMA_VALUE, + ANDROID_TONEMAP_MODE_PRESET_CURVE, } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/TonemapPresetCurve.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/TonemapPresetCurve.aidl index fc2e39bc3e..2e5fbd3ad0 100644 --- a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/TonemapPresetCurve.aidl +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/current/android/hardware/camera/metadata/TonemapPresetCurve.aidl @@ -38,6 +38,6 @@ package android.hardware.camera.metadata; @Backing(type="int") @VintfStability enum TonemapPresetCurve { - ANDROID_TONEMAP_PRESET_CURVE_SRGB = 0, - ANDROID_TONEMAP_PRESET_CURVE_REC709 = 1, + ANDROID_TONEMAP_PRESET_CURVE_SRGB, + ANDROID_TONEMAP_PRESET_CURVE_REC709, } diff --git a/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl b/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl index 14233051a2..b397dea8d2 100644 --- a/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl +++ b/camera/metadata/aidl/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl @@ -31,19 +31,6 @@ package android.hardware.camera.metadata; enum RequestAvailableColorSpaceProfilesMap { ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED = -1L, ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_SRGB = 0L, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_LINEAR_SRGB = 1L, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_EXTENDED_SRGB = 2L, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_LINEAR_EXTENDED_SRGB = 3L, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_BT709 = 4L, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_BT2020 = 5L, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_DCI_P3 = 6L, ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_DISPLAY_P3 = 7L, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_NTSC_1953 = 8L, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_SMPTE_C = 9L, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ADOBE_RGB = 10L, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_PRO_PHOTO_RGB = 11L, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ACES = 12L, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_ACESCG = 13L, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_CIE_XYZ = 14L, - ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_CIE_LAB = 15L, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_BT2020_HLG = 16L, } From 0e55469db975404f87f87e7b4fe8c78260da0ad2 Mon Sep 17 00:00:00 2001 From: Hao Chen Date: Wed, 15 Mar 2023 19:48:43 -0700 Subject: [PATCH 833/998] Add Display ID when Getting Display State Multiple displays can be opened concurrently, so display ID is needed when getting status of active displays. Test: build Bug: 262779341 Change-Id: I12af698be85ba72f0fb81f143441956dd0bfe1d2 --- .../automotive/evs/IEvsEnumerator.aidl | 1 + .../automotive/evs/IEvsEnumerator.aidl | 23 +++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsEnumerator.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsEnumerator.aidl index 225b5041b8..4cefdf2f7a 100644 --- a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsEnumerator.aidl +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/current/android/hardware/automotive/evs/IEvsEnumerator.aidl @@ -47,4 +47,5 @@ interface IEvsEnumerator { android.hardware.automotive.evs.IEvsDisplay openDisplay(in int id); android.hardware.automotive.evs.IEvsUltrasonicsArray openUltrasonicsArray(in String ultrasonicsArrayId); void registerStatusCallback(in android.hardware.automotive.evs.IEvsEnumeratorStatusCallback callback); + android.hardware.automotive.evs.DisplayState getDisplayStateById(in int id); } diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/IEvsEnumerator.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/IEvsEnumerator.aidl index 86987008c5..37b8ea52d4 100644 --- a/automotive/evs/aidl/android/hardware/automotive/evs/IEvsEnumerator.aidl +++ b/automotive/evs/aidl/android/hardware/automotive/evs/IEvsEnumerator.aidl @@ -78,12 +78,12 @@ interface IEvsEnumerator { byte[] getDisplayIdList(); /** - * This call requests the current state of the display + * This call requests the current state of the primary display * * If there is no open display, this returns DisplayState::NOT_OPEN. otherwise, it returns - * the actual state of the active display. This call is replicated on the IEvsEnumerator - * interface in order to allow secondary clients to monitor the state of the EVS display - * without acquiring exclusive ownership of the display. + * the actual state of the active primary display. This call is replicated on the + * IEvsEnumerator interface in order to allow secondary clients to monitor the state of the EVS + * display without acquiring exclusive ownership of the display. * * @return Current DisplayState of this Display. * @throws EvsResult::OWNERSHIP_LOST if current display is inactive @@ -163,4 +163,19 @@ interface IEvsEnumerator { * @param in callback IEvsEnumeratorStatusCallback implementation */ void registerStatusCallback(in IEvsEnumeratorStatusCallback callback); + + /** + * This call requests the current state of the display + * + * If the requested display is not active, this returns DisplayState::NOT_OPEN. otherwise, it + * returns the actual state of the active display. This call is replicated on the + * IEvsEnumerator interface in order to allow secondary clients to monitor the state of the EVS + * display without acquiring exclusive ownership of the display. + * + * @param in id ID of the requested display. + * @return Current DisplayState of this Display. + * @throws EvsResult::OWNERSHIP_LOST if current display is inactive + * EvsResult::PERMISSION_DENIED if the process is not permitted to do this operation. + */ + DisplayState getDisplayStateById(in int id); } From 34f4c1d5d78f66c6ac4705df41b44c687fc3c1a3 Mon Sep 17 00:00:00 2001 From: Vlad Popa Date: Thu, 16 Mar 2023 18:43:53 +0100 Subject: [PATCH 834/998] CSD: rename get/setOutputRs2 to include upper bound RS2 represents an interval of power levels. This is why it is clearer to specify upper bound in the naming to make it clear that we refer to the upper limit which when exceeded will trigger a momentary exposure. Test: atest VtsHalAudioCoreTargetTest Bug: 273961110 Change-Id: If4e065deeedb32c3e5e81caf4cd6924fb5815dc0 --- .../audio/core/sounddose/ISoundDose.aidl | 4 +-- .../audio/core/sounddose/ISoundDose.aidl | 27 ++++++++++--------- audio/aidl/default/SoundDose.cpp | 4 +-- .../default/include/core-impl/SoundDose.h | 4 +-- .../vts/VtsHalAudioCoreModuleTargetTest.cpp | 13 ++++----- 5 files changed, 27 insertions(+), 25 deletions(-) diff --git a/audio/aidl/aidl_api/android.hardware.audio.core.sounddose/current/android/hardware/audio/core/sounddose/ISoundDose.aidl b/audio/aidl/aidl_api/android.hardware.audio.core.sounddose/current/android/hardware/audio/core/sounddose/ISoundDose.aidl index 3b5d2d06cf..580009192d 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.core.sounddose/current/android/hardware/audio/core/sounddose/ISoundDose.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.core.sounddose/current/android/hardware/audio/core/sounddose/ISoundDose.aidl @@ -34,8 +34,8 @@ package android.hardware.audio.core.sounddose; @VintfStability interface ISoundDose { - void setOutputRs2(float rs2ValueDbA); - float getOutputRs2(); + void setOutputRs2UpperBound(float rs2ValueDbA); + float getOutputRs2UpperBound(); void registerSoundDoseCallback(in android.hardware.audio.core.sounddose.ISoundDose.IHalSoundDoseCallback callback); const int DEFAULT_MAX_RS2 = 100; const int MIN_RS2 = 80; diff --git a/audio/aidl/android/hardware/audio/core/sounddose/ISoundDose.aidl b/audio/aidl/android/hardware/audio/core/sounddose/ISoundDose.aidl index 953ab62bfe..b442ac5f8b 100644 --- a/audio/aidl/android/hardware/audio/core/sounddose/ISoundDose.aidl +++ b/audio/aidl/android/hardware/audio/core/sounddose/ISoundDose.aidl @@ -35,21 +35,21 @@ interface ISoundDose { const int MIN_RS2 = 80; /** - * Sets the RS2 value used for momentary exposure warnings. Default value is + * Sets the RS2 upper bound used for momentary exposure warnings. Default value is * DEFAULT_MAX_RS2 as specified in IEC62368-1 3rd edition. * - * @param rs2ValueDbA custom RS2 value to use. Must not be higher than DEFAULT_MAX_RS2 + * @param rs2ValueDbA custom RS2 upper bound to use * @throws EX_ILLEGAL_ARGUMENT if rs2ValueDbA is greater than DEFAULT_MAX_RS2 or lower - * than 80dBA + * than MIN_RS2 */ - void setOutputRs2(float rs2ValueDbA); + void setOutputRs2UpperBound(float rs2ValueDbA); /** - * Gets the RS2 value used for momentary exposure warnings. + * Gets the RS2 upper bound used for momentary exposure warnings. * - * @return the RS2 value in dBA + * @return the RS2 upper bound in dBA */ - float getOutputRs2(); + float getOutputRs2UpperBound(); /** * Registers the HAL callback for sound dose computation. If sound dose is supported @@ -68,9 +68,9 @@ interface ISoundDose { @VintfStability oneway interface IHalSoundDoseCallback { /** - * Called whenever the current MEL value exceeds the set RS2 value. + * Called whenever the current MEL value exceeds the set RS2 upper bound. * - * @param currentDbA the current MEL value which exceeds the RS2 value + * @param currentDbA the current MEL value which exceeds the RS2 upper bound * @param audioDevice the audio device where the MEL exposure warning was recorded */ void onMomentaryExposureWarning(float currentDbA, in AudioDevice audioDevice); @@ -78,14 +78,15 @@ interface ISoundDose { @VintfStability parcelable MelRecord { /** - * Array of continuously recorded MEL values >= RS1 (1 per second). + * Array of continuously recorded MEL values >= MIN_RS2 (1 per second). * First value in the array was recorded at 'timestamp'. */ float[] melValues; /** - * Corresponds to the time in seconds when the first MEL entry in melValues - * was recorded. The timestamp values have to be consistent throughout all - * audio ports, equal timestamp values will be aggregated. + * Corresponds to the time in seconds, as reported by CLOCK_MONOTONIC, when + * the first MEL entry in melValues was recorded. The timestamp values have + * to be consistent throughout all audio ports, equal timestamp values will + * be aggregated. */ long timestamp; } diff --git a/audio/aidl/default/SoundDose.cpp b/audio/aidl/default/SoundDose.cpp index be9f93af92..f12ce5d806 100644 --- a/audio/aidl/default/SoundDose.cpp +++ b/audio/aidl/default/SoundDose.cpp @@ -22,7 +22,7 @@ namespace aidl::android::hardware::audio::core::sounddose { -ndk::ScopedAStatus SoundDose::setOutputRs2(float in_rs2ValueDbA) { +ndk::ScopedAStatus SoundDose::setOutputRs2UpperBound(float in_rs2ValueDbA) { if (in_rs2ValueDbA < MIN_RS2 || in_rs2ValueDbA > DEFAULT_MAX_RS2) { LOG(ERROR) << __func__ << ": RS2 value is invalid: " << in_rs2ValueDbA; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); @@ -32,7 +32,7 @@ ndk::ScopedAStatus SoundDose::setOutputRs2(float in_rs2ValueDbA) { return ndk::ScopedAStatus::ok(); } -ndk::ScopedAStatus SoundDose::getOutputRs2(float* _aidl_return) { +ndk::ScopedAStatus SoundDose::getOutputRs2UpperBound(float* _aidl_return) { *_aidl_return = mRs2Value; LOG(DEBUG) << __func__ << ": returning " << *_aidl_return; return ndk::ScopedAStatus::ok(); diff --git a/audio/aidl/default/include/core-impl/SoundDose.h b/audio/aidl/default/include/core-impl/SoundDose.h index 306aa04d48..2a069d9bac 100644 --- a/audio/aidl/default/include/core-impl/SoundDose.h +++ b/audio/aidl/default/include/core-impl/SoundDose.h @@ -29,8 +29,8 @@ class SoundDose : public BnSoundDose { public: SoundDose() : mRs2Value(DEFAULT_MAX_RS2){}; - ndk::ScopedAStatus setOutputRs2(float in_rs2ValueDbA) override; - ndk::ScopedAStatus getOutputRs2(float* _aidl_return) override; + ndk::ScopedAStatus setOutputRs2UpperBound(float in_rs2ValueDbA) override; + ndk::ScopedAStatus getOutputRs2UpperBound(float* _aidl_return) override; ndk::ScopedAStatus registerSoundDoseCallback( const std::shared_ptr& in_callback) override; diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp index 5d522a324e..e790d4fcf6 100644 --- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp @@ -3543,26 +3543,27 @@ TEST_P(AudioCoreSoundDose, SameInstance) { << "getSoundDose must return the same interface instance across invocations"; } -TEST_P(AudioCoreSoundDose, GetSetOutputRs2) { +TEST_P(AudioCoreSoundDose, GetSetOutputRs2UpperBound) { if (soundDose == nullptr) { GTEST_SKIP() << "SoundDose is not supported"; } bool isSupported = false; - EXPECT_NO_FATAL_FAILURE(TestAccessors(soundDose.get(), &ISoundDose::getOutputRs2, - &ISoundDose::setOutputRs2, + EXPECT_NO_FATAL_FAILURE(TestAccessors(soundDose.get(), + &ISoundDose::getOutputRs2UpperBound, + &ISoundDose::setOutputRs2UpperBound, /*validValues=*/{80.f, 90.f, 100.f}, /*invalidValues=*/{79.f, 101.f}, &isSupported)); - EXPECT_TRUE(isSupported) << "Getting/Setting RS2 must be supported"; + EXPECT_TRUE(isSupported) << "Getting/Setting RS2 upper bound must be supported"; } -TEST_P(AudioCoreSoundDose, CheckDefaultRs2Value) { +TEST_P(AudioCoreSoundDose, CheckDefaultRs2UpperBound) { if (soundDose == nullptr) { GTEST_SKIP() << "SoundDose is not supported"; } float rs2Value; - ASSERT_IS_OK(soundDose->getOutputRs2(&rs2Value)); + ASSERT_IS_OK(soundDose->getOutputRs2UpperBound(&rs2Value)); EXPECT_EQ(rs2Value, ISoundDose::DEFAULT_MAX_RS2); } From 4275c8793c50a44b1cb10314406ac3c4890c8bb3 Mon Sep 17 00:00:00 2001 From: Oscar Shu Date: Wed, 8 Mar 2023 22:48:09 +0000 Subject: [PATCH 835/998] Update setAfcChannelAllowance Use a new structure to passdown: - AFC information queried based on frequency - AFC information queried based on channel number - expiration time This change is per chip vendor request. Based on AFC server support, either frequency based information or channel based information may be empty. If both are empty, then it indicate the driver should not allow any standard power transmission on 6Ghz. Bug: 262791660 Test: compile Test: Manually verified information is passed down with local framework change Change-Id: Id1d014a6113f6863b98ef8239a5a52d3863aa758 --- .../hardware/wifi/AfcChannelAllowance.aidl | 40 ++++++++++++++ .../wifi/AvailableAfcChannelInfo.aidl | 40 ++++++++++++++ .../android/hardware/wifi/IWifiChip.aidl | 2 +- .../hardware/wifi/AfcChannelAllowance.aidl | 52 +++++++++++++++++++ .../wifi/AvailableAfcChannelInfo.aidl | 44 ++++++++++++++++ .../aidl/android/hardware/wifi/IWifiChip.aidl | 12 ++--- wifi/aidl/default/wifi_chip.cpp | 12 +++-- wifi/aidl/default/wifi_chip.h | 4 +- 8 files changed, 191 insertions(+), 15 deletions(-) create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/AfcChannelAllowance.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/AvailableAfcChannelInfo.aidl create mode 100644 wifi/aidl/android/hardware/wifi/AfcChannelAllowance.aidl create mode 100644 wifi/aidl/android/hardware/wifi/AvailableAfcChannelInfo.aidl diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/AfcChannelAllowance.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/AfcChannelAllowance.aidl new file mode 100644 index 0000000000..4d3cd6eb58 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/AfcChannelAllowance.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.wifi; +@VintfStability +parcelable AfcChannelAllowance { + android.hardware.wifi.AvailableAfcFrequencyInfo[] availableAfcFrequencyInfos; + android.hardware.wifi.AvailableAfcChannelInfo[] availableAfcChannelInfos; + long availabilityExpireTimeMs; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/AvailableAfcChannelInfo.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/AvailableAfcChannelInfo.aidl new file mode 100644 index 0000000000..d2386401ba --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/AvailableAfcChannelInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.wifi; +@VintfStability +parcelable AvailableAfcChannelInfo { + int globalOperatingClass; + int channelCfi; + int maxEirpDbm; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl index 23f403021a..d50472148e 100644 --- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl @@ -61,7 +61,7 @@ interface IWifiChip { android.hardware.wifi.WifiRadioCombination[] getSupportedRadioCombinations(); android.hardware.wifi.WifiChipCapabilities getWifiChipCapabilities(); android.hardware.wifi.WifiUsableChannel[] getUsableChannels(in android.hardware.wifi.WifiBand band, in int ifaceModeMask, in int filterMask); - void setAfcChannelAllowance(in android.hardware.wifi.AvailableAfcFrequencyInfo[] availableAfcFrequencyInfo); + void setAfcChannelAllowance(in android.hardware.wifi.AfcChannelAllowance afcChannelAllowance); void registerEventCallback(in android.hardware.wifi.IWifiChipEventCallback callback); void removeApIface(in String ifname); void removeIfaceInstanceFromBridgedApIface(in String brIfaceName, in String ifaceInstanceName); diff --git a/wifi/aidl/android/hardware/wifi/AfcChannelAllowance.aidl b/wifi/aidl/android/hardware/wifi/AfcChannelAllowance.aidl new file mode 100644 index 0000000000..289383c2e3 --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/AfcChannelAllowance.aidl @@ -0,0 +1,52 @@ +/* + * 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.hardware.wifi; + +import android.hardware.wifi.AvailableAfcChannelInfo; +import android.hardware.wifi.AvailableAfcFrequencyInfo; + +/** + * Defines the maximum permissible power spectral density to support 6Ghz with standard power for + * AFC. The maximum power can be either defined based on frequencies or channel number. + * + * Note, based on AFC server support, either availableAfcFrequencyInfos or availableAfcChannelInfos + * may be empty. If one of them is empty while the other is not, use the non-empty one and ignore + * the empty one. If both are empty then it means 6Ghz standard power should not be supported at + * all. + * + * If availableAfcFrequencyInfos is non-empty, set the max permissible power according to the maxPsd + * per frequency range, and disallow emmision on 6Ghz frequencies not included in the structure. + * + * If availableAfcChannelInfos is non-empty, set the max permissible power according to the + * maxEirpDbm per channel, and disallow emmision on 6Ghz channels not included in the structure. + */ +@VintfStability +parcelable AfcChannelAllowance { + /** + * AFC max permissible information queried from AFC server based on frequency. + */ + AvailableAfcFrequencyInfo[] availableAfcFrequencyInfos; + /** + * AFC max permissible information queried from AFC server on channel number. + */ + AvailableAfcChannelInfo[] availableAfcChannelInfos; + /** + * The time in UTC at which this information expires, as the difference, measured in + * milliseconds between the expiration time and midnight, January 1, 1970 UTC. + */ + long availabilityExpireTimeMs; +} diff --git a/wifi/aidl/android/hardware/wifi/AvailableAfcChannelInfo.aidl b/wifi/aidl/android/hardware/wifi/AvailableAfcChannelInfo.aidl new file mode 100644 index 0000000000..398cd12ff9 --- /dev/null +++ b/wifi/aidl/android/hardware/wifi/AvailableAfcChannelInfo.aidl @@ -0,0 +1,44 @@ +/* + * 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.hardware.wifi; + +/** + * Defines the maximum EIRP per channel for supporting 6Ghz standard power for AFC. The format of + * the data structure is derived from the Wi-Fi Alliance AFC System to AFC Device Interface + * Specification: AvailableChannelInfo object. + */ +@VintfStability +parcelable AvailableAfcChannelInfo { + /** + * The global operating class used to define the channel center frequency indices + * and operating bandwidth. + */ + int globalOperatingClass; + + /** + * The channel center frequency index. + */ + int channelCfi; + + /** + * The maximum permissible EIRP in units of dBm available for the channel + * specified by channelCfi. In addition, in any portion of the channel, the conducted PSD plus + * the maximum antenna gain cannot exceed the maxEirp divided by the channel width defined by + * the globalOperatingClass. + */ + int maxEirpDbm; +} diff --git a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl index 1710f63e64..2226854c49 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl @@ -16,7 +16,7 @@ package android.hardware.wifi; -import android.hardware.wifi.AvailableAfcFrequencyInfo; +import android.hardware.wifi.AfcChannelAllowance; import android.hardware.wifi.IWifiApIface; import android.hardware.wifi.IWifiChipEventCallback; import android.hardware.wifi.IWifiNanIface; @@ -811,16 +811,12 @@ interface IWifiChip { in WifiBand band, in int ifaceModeMask, in int filterMask); /* - * Set the max power level the chip is allowed to transmit on for 6Ghz AFC - * using an array of AvailableAfcFrequencyInfo. The max power for - * frequencies not included in the input frequency ranges will be reset to - * their respective default values. - * @param availableAfcFrequencyInfo The list of frequency ranges and - * corresponding max allowed power. + * Set the max power level the chip is allowed to transmit on for 6Ghz AFC. + * @param afcChannelAllowance Specifies the power limitations for 6Ghz AFC. * @throws ServiceSpecificException with one of the following values: * |WifiStatusCode.ERROR_NOT_SUPPORTED| */ - void setAfcChannelAllowance(in AvailableAfcFrequencyInfo[] availableAfcFrequencyInfo); + void setAfcChannelAllowance(in AfcChannelAllowance afcChannelAllowance); /** * Requests notifications of significant events on this chip. Multiple calls diff --git a/wifi/aidl/default/wifi_chip.cpp b/wifi/aidl/default/wifi_chip.cpp index dd24e6b77e..e4c2d44b83 100644 --- a/wifi/aidl/default/wifi_chip.cpp +++ b/wifi/aidl/default/wifi_chip.cpp @@ -701,9 +701,9 @@ ndk::ScopedAStatus WifiChip::getUsableChannels(WifiBand in_band, int32_t in_ifac } ndk::ScopedAStatus WifiChip::setAfcChannelAllowance( - const std::vector& availableAfcFrequencyInfo) { + const AfcChannelAllowance& afcChannelAllowance) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::setAfcChannelAllowanceInternal, availableAfcFrequencyInfo); + &WifiChip::setAfcChannelAllowanceInternal, afcChannelAllowance); } ndk::ScopedAStatus WifiChip::triggerSubsystemRestart() { @@ -1431,8 +1431,12 @@ std::pair, ndk::ScopedAStatus> WifiChip::getUsabl } ndk::ScopedAStatus WifiChip::setAfcChannelAllowanceInternal( - const std::vector& availableAfcFrequencyInfo) { - LOG(INFO) << "setAfcChannelAllowance is not yet supported " << availableAfcFrequencyInfo.size(); + const AfcChannelAllowance& afcChannelAllowance) { + LOG(INFO) << "setAfcChannelAllowance is not yet supported. availableAfcFrequencyInfos size=" + << afcChannelAllowance.availableAfcFrequencyInfos.size() + << " availableAfcChannelInfos size=" + << afcChannelAllowance.availableAfcChannelInfos.size() + << " availabilityExpireTimeMs=" << afcChannelAllowance.availabilityExpireTimeMs; return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); } diff --git a/wifi/aidl/default/wifi_chip.h b/wifi/aidl/default/wifi_chip.h index c5dcee7888..3439f2b4b6 100644 --- a/wifi/aidl/default/wifi_chip.h +++ b/wifi/aidl/default/wifi_chip.h @@ -142,7 +142,7 @@ class WifiChip : public BnWifiChip { int32_t in_filterMask, std::vector* _aidl_return) override; ndk::ScopedAStatus setAfcChannelAllowance( - const std::vector& availableAfcFrequencyInfo) override; + const AfcChannelAllowance& afcChannelAllowance) override; ndk::ScopedAStatus triggerSubsystemRestart() override; ndk::ScopedAStatus getSupportedRadioCombinations( std::vector* _aidl_return) override; @@ -220,7 +220,7 @@ class WifiChip : public BnWifiChip { WifiBand band, int32_t ifaceModeMask, int32_t filterMask); ndk::ScopedAStatus enableStaChannelForPeerNetworkInternal(int32_t channelCategoryEnableFlag); ndk::ScopedAStatus setAfcChannelAllowanceInternal( - const std::vector& availableAfcFrequencyInfo); + const AfcChannelAllowance& afcChannelAllowance); ndk::ScopedAStatus handleChipConfiguration(std::unique_lock* lock, int32_t mode_id); ndk::ScopedAStatus registerDebugRingBufferCallback(); From fb8b891a3650f8c4b8552e6ddddbc0286526b698 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Thu, 16 Mar 2023 23:31:08 +0000 Subject: [PATCH 836/998] Disable linter in the Supplicant interface Android.bp file. This allows us to use fixed-size arrays in the interface. Bug: 273964536 Test: m Change-Id: Ic1a0c5ce5360e787e1664ed855e2642d22be7148 --- wifi/supplicant/aidl/Android.bp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wifi/supplicant/aidl/Android.bp b/wifi/supplicant/aidl/Android.bp index 9cb4e51651..c4d3767b69 100644 --- a/wifi/supplicant/aidl/Android.bp +++ b/wifi/supplicant/aidl/Android.bp @@ -36,6 +36,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 >= T. + enabled: false, + }, }, ndk: { gen_trace: true, From da640d66b2c6af95a60749b3583c3cd9f426519d Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Thu, 16 Mar 2023 23:33:11 +0000 Subject: [PATCH 837/998] Use fixed-size arrays for any arrays added in V2 that expect a pre-set size. Bug: 273964536 Test: m Change-Id: Iab1239484bfc7fd61834118e5a9e1999cab194ad --- .../current/android/hardware/wifi/supplicant/MloLink.aidl | 2 +- .../android/hardware/wifi/supplicant/MloLinksInfo.aidl | 2 +- .../hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl | 4 ++-- .../android/hardware/wifi/supplicant/PmkSaCacheData.aidl | 2 +- .../hardware/wifi/supplicant/SupplicantStateChangeData.aidl | 2 +- .../aidl/android/hardware/wifi/supplicant/MloLink.aidl | 2 +- .../aidl/android/hardware/wifi/supplicant/MloLinksInfo.aidl | 2 +- .../hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl | 4 ++-- .../aidl/android/hardware/wifi/supplicant/PmkSaCacheData.aidl | 2 +- .../hardware/wifi/supplicant/SupplicantStateChangeData.aidl | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLink.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLink.aidl index 8783c40cbb..8bda3242b3 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLink.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLink.aidl @@ -38,6 +38,6 @@ parcelable MloLink { byte[] staLinkMacAddress; byte tidsUplinkMap; byte tidsDownlinkMap; - @nullable byte[] apLinkMacAddress; + @nullable byte[6] apLinkMacAddress; int frequencyMHz; } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLinksInfo.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLinksInfo.aidl index cd98f7fb8f..3dac2d6694 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLinksInfo.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/MloLinksInfo.aidl @@ -36,5 +36,5 @@ package android.hardware.wifi.supplicant; parcelable MloLinksInfo { android.hardware.wifi.supplicant.MloLink[] links; int apMloLinkId; - @nullable byte[] apMldMacAddress; + @nullable byte[6] apMldMacAddress; } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl index 614b49e969..5465a86b13 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl @@ -41,8 +41,8 @@ parcelable P2pGroupStartedEventParams { byte[] psk; String passphrase; boolean isPersistent; - byte[] goDeviceAddress; - byte[] goInterfaceAddress; + byte[6] goDeviceAddress; + byte[6] goInterfaceAddress; boolean isP2pClientEapolIpAddressInfoPresent; android.hardware.wifi.supplicant.P2pClientEapolIpAddressInfo p2pClientIpInfo; } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/PmkSaCacheData.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/PmkSaCacheData.aidl index 436d0c0931..c31b16756c 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/PmkSaCacheData.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/PmkSaCacheData.aidl @@ -34,7 +34,7 @@ package android.hardware.wifi.supplicant; @VintfStability parcelable PmkSaCacheData { - byte[] bssid; + byte[6] bssid; long expirationTimeInSec; byte[] serializedEntry; } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl index e6bb859bc7..1d37635a29 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl @@ -37,7 +37,7 @@ parcelable SupplicantStateChangeData { android.hardware.wifi.supplicant.StaIfaceCallbackState newState; int id; byte[] ssid; - byte[] bssid; + byte[6] bssid; android.hardware.wifi.supplicant.KeyMgmtMask keyMgmtMask; int frequencyMhz; boolean filsHlpSent; diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLink.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLink.aidl index ed6528cb6f..0b4d66ed50 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLink.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLink.aidl @@ -61,7 +61,7 @@ parcelable MloLink { /** * AP Link MAC Address */ - @nullable byte[/* 6 */] apLinkMacAddress; + @nullable byte[6] apLinkMacAddress; /** * Frequency on which the link operates in MHz. */ diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLinksInfo.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLinksInfo.aidl index d954d16018..3b81df8a6c 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLinksInfo.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/MloLinksInfo.aidl @@ -35,5 +35,5 @@ parcelable MloLinksInfo { /** * AP MLD MAC address. */ - @nullable byte[/* 6 */] apMldMacAddress; + @nullable byte[6] apMldMacAddress; } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl index ccd536cd7c..96f1e16793 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl @@ -45,10 +45,10 @@ parcelable P2pGroupStartedEventParams { boolean isPersistent; /** MAC Address of the owner of this group. */ - byte[/* 6 */] goDeviceAddress; + byte[6] goDeviceAddress; /** MAC Address of the P2P interface of the owner of this group. */ - byte[/* 6 */] goInterfaceAddress; + byte[6] goInterfaceAddress; /** * Flag to indicate that the P2P Client IP address is allocated via EAPOL exchange. diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/PmkSaCacheData.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/PmkSaCacheData.aidl index bc28ff5335..e0f1d319d6 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/PmkSaCacheData.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/PmkSaCacheData.aidl @@ -24,7 +24,7 @@ parcelable PmkSaCacheData { /** * BSSID of the access point to which the station is associated. */ - byte[/* 6 */] bssid; + byte[6] bssid; /** * PMK expiration time in seconds. */ diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl index 8fa5dc77a1..f7c66e0ba3 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl @@ -46,7 +46,7 @@ parcelable SupplicantStateChangeData { * change event. This must be zero'ed if this event is not * specific to a particular network. */ - byte[/* 6 */] bssid; + byte[6] bssid; /** * Currently used key mgmt mask. From 011284e9c1c3c76a731106378eb2de7638d9183a Mon Sep 17 00:00:00 2001 From: shrikar Date: Mon, 13 Mar 2023 21:08:51 +0000 Subject: [PATCH 838/998] Added info to docs to answer Q8 from Ford pending questions. Bug: 259309511 Test: manual build Change-Id: I695d50e79ea39e669443d1fe40b91fbb204d2b98 --- .../hardware/automotive/vehicle/RawPropValues.aidl | 9 ++++++--- .../hardware/automotive/vehicle/VehiclePropertyType.aidl | 4 ++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/RawPropValues.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/RawPropValues.aidl index 9c6875b0b5..28ccc1da01 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/RawPropValues.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/RawPropValues.aidl @@ -20,8 +20,8 @@ package android.hardware.automotive.vehicle; @JavaDerive(equals=true, toString=true) parcelable RawPropValues { /** - * This is used for properties of types VehiclePropertyType#INT - * and VehiclePropertyType#INT_VEC + * This is used for properties of types VehiclePropertyType#INT32, + * VehiclePropertyType#BOOLEAN and VehiclePropertyType#INT32_VEC */ int[] int32Values = {}; @@ -31,7 +31,10 @@ parcelable RawPropValues { */ float[] floatValues; - /** This is used for properties of type VehiclePropertyType#INT64 */ + /** + * This is used for properties of type VehiclePropertyType#INT64 and + * VehiclePropertyType#INT64_VEC + */ long[] int64Values; /** This is used for properties of type VehiclePropertyType#BYTES */ diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehiclePropertyType.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehiclePropertyType.aidl index 62d26de3c3..7a68b4abc6 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehiclePropertyType.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehiclePropertyType.aidl @@ -25,6 +25,10 @@ package android.hardware.automotive.vehicle; @Backing(type="int") enum VehiclePropertyType { STRING = 0x00100000, + /** + * Boolean values should be specified through the int32Values in RawPropValues. + * int32Value = {0} represents false and int32Value = {1} represents true. + */ BOOLEAN = 0x00200000, INT32 = 0x00400000, INT32_VEC = 0x00410000, From 0ffc9720d66dba33e74e47e40472ccbcd2031d80 Mon Sep 17 00:00:00 2001 From: Xiang Wang Date: Fri, 17 Mar 2023 10:34:46 -0700 Subject: [PATCH 839/998] Fix callback test to only verify registration Bug: 270489278 Test: atest VtsHalThermalTargetTest Change-Id: I1e5af6e9092d3ab32b1d49382a2849fdab228bef --- thermal/aidl/vts/VtsHalThermalTargetTest.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/thermal/aidl/vts/VtsHalThermalTargetTest.cpp b/thermal/aidl/vts/VtsHalThermalTargetTest.cpp index 05cc8e0acf..835fbfa85a 100644 --- a/thermal/aidl/vts/VtsHalThermalTargetTest.cpp +++ b/thermal/aidl/vts/VtsHalThermalTargetTest.cpp @@ -134,7 +134,6 @@ TEST_P(ThermalAidlTest, RegisterThermalChangedCallbackTest) { // Expect to succeed with different callback status = mThermal->registerThermalChangedCallback(localThermalCallback); ASSERT_TRUE(status.isOk()) << status.getMessage(); - ASSERT_TRUE(localThermalCallback->waitForCallback(200ms)); // Remove the local callback status = mThermal->unregisterThermalChangedCallback(localThermalCallback); ASSERT_TRUE(status.isOk()) << status.getMessage(); @@ -158,7 +157,6 @@ TEST_P(ThermalAidlTest, RegisterThermalChangedCallbackWithTypeTest) { status = mThermal->registerThermalChangedCallbackWithType(localThermalCallback, TemperatureType::SKIN); ASSERT_TRUE(status.isOk()) << status.getMessage(); - ASSERT_TRUE(localThermalCallback->waitForCallback(200ms)); // Remove the local callback status = mThermal->unregisterThermalChangedCallback(localThermalCallback); ASSERT_TRUE(status.isOk()) << status.getMessage(); From 3750a7624438bea55572910de767a2bab627d398 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Fri, 17 Mar 2023 13:42:41 -0700 Subject: [PATCH 840/998] Add comment for remote task data. Test: None Bug: 274153816 Change-Id: Ib293d192c4ffe0e7374379359b2cf8463af25615 --- .../hardware/automotive/remoteaccess/IRemoteTaskCallback.aidl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/automotive/remoteaccess/android/hardware/automotive/remoteaccess/IRemoteTaskCallback.aidl b/automotive/remoteaccess/android/hardware/automotive/remoteaccess/IRemoteTaskCallback.aidl index 7a1616f107..2cd7a5db6b 100644 --- a/automotive/remoteaccess/android/hardware/automotive/remoteaccess/IRemoteTaskCallback.aidl +++ b/automotive/remoteaccess/android/hardware/automotive/remoteaccess/IRemoteTaskCallback.aidl @@ -24,6 +24,10 @@ interface IRemoteTaskCallback { /** * A callback that is called when a remote task is requested. * + * The data is passed down from the remote server to the remote task client + * which is an Android application, and is not interpreted/parsed by the + * Android system. + * * @param clientId An ID to uniquely identify a remote task client. * @param data Opaque task data passed to the remote task client. */ From 55eee605c9456cd7200073779462c2a10abdc4d4 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 17 Mar 2023 17:14:52 +0000 Subject: [PATCH 841/998] Update vhal manifest fragment and compat matrix We are serving V2 of the vhal interface, so reflect that in the manifest fragment. Test: lunch cf_x86_64_auto-userdebug && atest hal_implementation_test Bug: 266868868 Change-Id: I86217712f225df64cb3494be3461d7ff39d80064 --- automotive/vehicle/aidl/impl/vhal/vhal-default-service.xml | 2 +- compatibility_matrices/compatibility_matrix.8.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl/impl/vhal/vhal-default-service.xml b/automotive/vehicle/aidl/impl/vhal/vhal-default-service.xml index 4d587eeba8..9834cdbc67 100644 --- a/automotive/vehicle/aidl/impl/vhal/vhal-default-service.xml +++ b/automotive/vehicle/aidl/impl/vhal/vhal-default-service.xml @@ -1,7 +1,7 @@ android.hardware.automotive.vehicle - 1 + 2 IVehicle/default diff --git a/compatibility_matrices/compatibility_matrix.8.xml b/compatibility_matrices/compatibility_matrix.8.xml index c58f559c2b..d2db4382a6 100644 --- a/compatibility_matrices/compatibility_matrix.8.xml +++ b/compatibility_matrices/compatibility_matrix.8.xml @@ -103,6 +103,7 @@ android.hardware.automotive.vehicle + 1-2 IVehicle default From f1d77e2275f173c1f31bf1dbe50105e8f8ca5558 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 17 Mar 2023 18:19:52 +0000 Subject: [PATCH 842/998] Update automotive.audiocontrol manifest and compat matrix We are serving V3 of the interface, so reflect that in the manifest fragment. Allow it in the compat matrix. Test: lunch cf_x86_64_auto-userdebug && atest hal_implementation_test Bug: 266868868 Change-Id: Ib858b6e9eb7025fe05670641d55ca98389553077 --- automotive/audiocontrol/aidl/default/audiocontrol-default.xml | 2 +- compatibility_matrices/compatibility_matrix.8.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/automotive/audiocontrol/aidl/default/audiocontrol-default.xml b/automotive/audiocontrol/aidl/default/audiocontrol-default.xml index 3536bb928e..95cd7f024f 100644 --- a/automotive/audiocontrol/aidl/default/audiocontrol-default.xml +++ b/automotive/audiocontrol/aidl/default/audiocontrol-default.xml @@ -1,7 +1,7 @@ android.hardware.automotive.audiocontrol - 2 + 3 IAudioControl/default diff --git a/compatibility_matrices/compatibility_matrix.8.xml b/compatibility_matrices/compatibility_matrix.8.xml index d2db4382a6..6def4b8d4c 100644 --- a/compatibility_matrices/compatibility_matrix.8.xml +++ b/compatibility_matrices/compatibility_matrix.8.xml @@ -62,7 +62,7 @@ android.hardware.automotive.audiocontrol - 2 + 2-3 IAudioControl default From e548fc8c6b5a4eeab26915ba01ca3c48239f54e2 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Fri, 17 Mar 2023 17:07:05 -0700 Subject: [PATCH 843/998] Fix flakiness in DefaultVhalImpl_test. Test: atest android.hardware.automotive.vehicle@2.0-default-impl-unit-tests Bug: 272569067 Change-Id: I54c45d80cf09d314cafbd30844e9fbe296de4986 --- .../default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp index b5026a63dd..edd4484016 100644 --- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp +++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/tests/DefaultVhalImpl_test.cpp @@ -756,8 +756,9 @@ TEST_F(DefaultVhalImplTest, testDebugGenFakeDataLinear) { // Clear existing events. mEventQueue.flush(); std::this_thread::sleep_for(std::chrono::milliseconds(500)); - // There should be no new events generated. - EXPECT_EQ((size_t)0, mEventQueue.flush().size()); + // Technically there should be no new events generated, however, there might still be one event + // in the queue while we are stopping the generator. + EXPECT_LE(mEventQueue.flush().size(), 1u); } std::string getTestFilePath(const char* filename) { From 1027904931a939db6bdd9afb51df8e694e33f822 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Thu, 23 Feb 2023 19:18:03 -0800 Subject: [PATCH 844/998] Update default emulator values for HVAC_TEMPERATURE_VALUE_SUGGESTION Bug: 270448817 Test: atest CtsCarTestCases:CarPropertyManagerTest Change-Id: I21d9a600475effdd37881630fc49e7247cdad283 --- .../aidl/impl/default_config/config/DefaultProperties.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index 28790e2982..ae36290915 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -2371,7 +2371,7 @@ 66.19999694824219, "VehicleUnit::FAHRENHEIT", 19.0, - 66.5 + 66.0 ] } }, From 881bb300266a4206fe196c6fa5aaa7b1b9cba66d Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Sun, 12 Mar 2023 22:25:49 -0700 Subject: [PATCH 845/998] Implement HVAC_TEMPERATURE_VALUE_SUGGESTION in emulator VHAL This property behaves like a function call taking the value set and outputting the expected temperature values. Bug: 270448817 Test: atest FakeVehicleHardwareTest Change-Id: Idf9840312a59b186850b2d6b2c2fb57fee545283 --- .../hardware/include/FakeVehicleHardware.h | 7 + .../hardware/src/FakeVehicleHardware.cpp | 92 +++++ .../hardware/test/FakeVehicleHardwareTest.cpp | 354 ++++++++++++++++++ 3 files changed, 453 insertions(+) diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h index 6fd2367957..7b740920d2 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h @@ -178,6 +178,13 @@ class FakeVehicleHardware : public IVehicleHardware { void eventFromVehicleBus( const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value); + int getHvacTempNumIncrements(int requestedTemp, int minTemp, int maxTemp, int increment); + void updateHvacTemperatureValueSuggestionInput( + const std::vector& hvacTemperatureSetConfigArray, + std::vector* hvacTemperatureValueSuggestionInput); + VhalResult setHvacTemperatureValueSuggestion( + const aidl::android::hardware::automotive::vehicle::VehiclePropValue& + hvacTemperatureValueSuggestion); VhalResult maybeSetSpecialValue( const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value, bool* isSpecialValue); diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index 78c21e95d8..4544389143 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -67,6 +67,7 @@ using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup; using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyStatus; using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; +using ::aidl::android::hardware::automotive::vehicle::VehicleUnit; using ::android::base::EqualsIgnoreCase; using ::android::base::Error; @@ -298,6 +299,94 @@ VhalResult FakeVehicleHardware::setApPowerStateReport(const VehiclePropVal return {}; } +int FakeVehicleHardware::getHvacTempNumIncrements(int requestedTemp, int minTemp, int maxTemp, + int increment) { + requestedTemp = std::max(requestedTemp, minTemp); + requestedTemp = std::min(requestedTemp, maxTemp); + int numIncrements = (requestedTemp - minTemp) / increment; + return numIncrements; +} + +void FakeVehicleHardware::updateHvacTemperatureValueSuggestionInput( + const std::vector& hvacTemperatureSetConfigArray, + std::vector* hvacTemperatureValueSuggestionInput) { + int minTempInCelsius = hvacTemperatureSetConfigArray[0]; + int maxTempInCelsius = hvacTemperatureSetConfigArray[1]; + int incrementInCelsius = hvacTemperatureSetConfigArray[2]; + + int minTempInFahrenheit = hvacTemperatureSetConfigArray[3]; + int maxTempInFahrenheit = hvacTemperatureSetConfigArray[4]; + int incrementInFahrenheit = hvacTemperatureSetConfigArray[5]; + + // The HVAC_TEMPERATURE_SET config array values are temperature values that have been multiplied + // by 10 and converted to integers. Therefore, requestedTemp must also be multiplied by 10 and + // converted to an integer in order for them to be the same units. + int requestedTemp = static_cast((*hvacTemperatureValueSuggestionInput)[0] * 10.0f); + int numIncrements = + (*hvacTemperatureValueSuggestionInput)[1] == toInt(VehicleUnit::CELSIUS) + ? getHvacTempNumIncrements(requestedTemp, minTempInCelsius, maxTempInCelsius, + incrementInCelsius) + : getHvacTempNumIncrements(requestedTemp, minTempInFahrenheit, + maxTempInFahrenheit, incrementInFahrenheit); + + int suggestedTempInCelsius = minTempInCelsius + incrementInCelsius * numIncrements; + int suggestedTempInFahrenheit = minTempInFahrenheit + incrementInFahrenheit * numIncrements; + // HVAC_TEMPERATURE_VALUE_SUGGESTION specifies the temperature values to be in the original + // floating point form so we divide by 10 and convert to float. + (*hvacTemperatureValueSuggestionInput)[2] = static_cast(suggestedTempInCelsius) / 10.0f; + (*hvacTemperatureValueSuggestionInput)[3] = + static_cast(suggestedTempInFahrenheit) / 10.0f; +} + +VhalResult FakeVehicleHardware::setHvacTemperatureValueSuggestion( + const VehiclePropValue& hvacTemperatureValueSuggestion) { + auto hvacTemperatureSetConfigResult = + mServerSidePropStore->getConfig(toInt(VehicleProperty::HVAC_TEMPERATURE_SET)); + + if (!hvacTemperatureSetConfigResult.ok()) { + return StatusError(getErrorCode(hvacTemperatureSetConfigResult)) << StringPrintf( + "Failed to set HVAC_TEMPERATURE_VALUE_SUGGESTION because" + " HVAC_TEMPERATURE_SET could not be retrieved. Error: %s", + getErrorMsg(hvacTemperatureSetConfigResult).c_str()); + } + + const auto& originalInput = hvacTemperatureValueSuggestion.value.floatValues; + if (originalInput.size() != 4) { + return StatusError(StatusCode::INVALID_ARG) << StringPrintf( + "Failed to set HVAC_TEMPERATURE_VALUE_SUGGESTION because float" + " array value is not size 4."); + } + + bool isTemperatureUnitSpecified = originalInput[1] == toInt(VehicleUnit::CELSIUS) || + originalInput[1] == toInt(VehicleUnit::FAHRENHEIT); + if (!isTemperatureUnitSpecified) { + return StatusError(StatusCode::INVALID_ARG) << StringPrintf( + "Failed to set HVAC_TEMPERATURE_VALUE_SUGGESTION because float" + " value at index 1 is not any of %d or %d, which corresponds to" + " VehicleUnit#CELSIUS and VehicleUnit#FAHRENHEIT respectively.", + toInt(VehicleUnit::CELSIUS), toInt(VehicleUnit::FAHRENHEIT)); + } + + auto updatedValue = mValuePool->obtain(hvacTemperatureValueSuggestion); + const auto& hvacTemperatureSetConfigArray = hvacTemperatureSetConfigResult.value()->configArray; + auto& hvacTemperatureValueSuggestionInput = updatedValue->value.floatValues; + + updateHvacTemperatureValueSuggestionInput(hvacTemperatureSetConfigArray, + &hvacTemperatureValueSuggestionInput); + + updatedValue->timestamp = elapsedRealtimeNano(); + auto writeResult = mServerSidePropStore->writeValue(std::move(updatedValue), + /* updateStatus = */ true, + VehiclePropertyStore::EventMode::ALWAYS); + if (!writeResult.ok()) { + return StatusError(getErrorCode(writeResult)) + << StringPrintf("failed to write value into property store, error: %s", + getErrorMsg(writeResult).c_str()); + } + + return {}; +} + bool FakeVehicleHardware::isHvacPropAndHvacNotAvailable(int32_t propId, int32_t areaId) const { std::unordered_set powerProps(std::begin(HVAC_POWER_PROPERTIES), std::end(HVAC_POWER_PROPERTIES)); @@ -491,6 +580,9 @@ VhalResult FakeVehicleHardware::maybeSetSpecialValue(const VehiclePropValu case VENDOR_PROPERTY_ID: *isSpecialValue = true; return StatusError((StatusCode)VENDOR_ERROR_CODE); + case toInt(VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION): + *isSpecialValue = true; + return setHvacTemperatureValueSuggestion(value); #ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES case toInt(VehicleProperty::CLUSTER_REPORT_STATE): diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp index 93a63adbc6..a50b4ad58e 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp @@ -57,6 +57,7 @@ using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyStatus; using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue; +using ::aidl::android::hardware::automotive::vehicle::VehicleUnit; using ::android::base::expected; using ::android::base::ScopedLockAssertion; using ::android::base::StringPrintf; @@ -2242,6 +2243,359 @@ TEST_F(FakeVehicleHardwareTest, testUpdateSampleRate) { } } +TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { + float CELSIUS = static_cast(toInt(VehicleUnit::CELSIUS)); + float FAHRENHEIT = static_cast(toInt(VehicleUnit::FAHRENHEIT)); + + VehiclePropValue floatArraySizeFour = { + .prop = toInt(VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + .value.floatValues = {0, CELSIUS, 0, 0}, + }; + StatusCode status = setValue(floatArraySizeFour); + EXPECT_EQ(status, StatusCode::OK); + + VehiclePropValue floatArraySizeZero = { + .prop = toInt(VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + }; + status = setValue(floatArraySizeZero); + EXPECT_EQ(status, StatusCode::INVALID_ARG); + + VehiclePropValue floatArraySizeFive = { + .prop = toInt(VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + .value.floatValues = {0, CELSIUS, 0, 0, 0}, + }; + status = setValue(floatArraySizeFive); + EXPECT_EQ(status, StatusCode::INVALID_ARG); + + VehiclePropValue invalidUnit = { + .prop = toInt(VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + .value.floatValues = {0, 0, 0, 0}, + }; + status = setValue(floatArraySizeFive); + EXPECT_EQ(status, StatusCode::INVALID_ARG); + clearChangedProperties(); + + // Config array values from HVAC_TEMPERATURE_SET in DefaultProperties.json + auto configs = getHardware()->getAllPropertyConfigs(); + VehiclePropConfig* hvacTemperatureSetConfig = nullptr; + for (auto& config : configs) { + if (config.prop == toInt(VehicleProperty::HVAC_TEMPERATURE_SET)) { + hvacTemperatureSetConfig = &config; + break; + } + } + EXPECT_NE(hvacTemperatureSetConfig, nullptr); + + auto& hvacTemperatureSetConfigArray = hvacTemperatureSetConfig->configArray; + // The HVAC_TEMPERATURE_SET config array values are temperature values that have been multiplied + // by 10 and converted to integers. HVAC_TEMPERATURE_VALUE_SUGGESTION specifies the temperature + // values to be in the original floating point form so we divide by 10 and convert to float. + float minTempInCelsius = hvacTemperatureSetConfigArray[0] / 10.0f; + float maxTempInCelsius = hvacTemperatureSetConfigArray[1] / 10.0f; + float incrementInCelsius = hvacTemperatureSetConfigArray[2] / 10.0f; + float minTempInFahrenheit = hvacTemperatureSetConfigArray[3] / 10.0f; + float maxTempInFahrenheit = hvacTemperatureSetConfigArray[4] / 10.0f; + float incrementInFahrenheit = hvacTemperatureSetConfigArray[5] / 10.0f; + + auto testCases = { + SetSpecialValueTestCase{ + .name = "min_celsius_temperature", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + .value.floatValues = {minTempInCelsius, CELSIUS, 0, 0}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + .value.floatValues = {minTempInCelsius, CELSIUS, + minTempInCelsius, + minTempInFahrenheit}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "min_fahrenheit_temperature", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + .value.floatValues = {minTempInFahrenheit, FAHRENHEIT, + 0, 0}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + .value.floatValues = {minTempInFahrenheit, FAHRENHEIT, + minTempInCelsius, + minTempInFahrenheit}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "max_celsius_temperature", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + .value.floatValues = {maxTempInCelsius, CELSIUS, 0, 0}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + .value.floatValues = {maxTempInCelsius, CELSIUS, + maxTempInCelsius, + maxTempInFahrenheit}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "max_fahrenheit_temperature", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + .value.floatValues = {maxTempInFahrenheit, FAHRENHEIT, + 0, 0}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + .value.floatValues = {maxTempInFahrenheit, FAHRENHEIT, + maxTempInCelsius, + maxTempInFahrenheit}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "below_min_celsius_temperature", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + .value.floatValues = {minTempInCelsius - 1, CELSIUS, 0, + 0}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + .value.floatValues = {minTempInCelsius - 1, CELSIUS, + minTempInCelsius, + minTempInFahrenheit}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "below_min_fahrenheit_temperature", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + .value.floatValues = {minTempInFahrenheit - 1, + FAHRENHEIT, 0, 0}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + .value.floatValues = {minTempInFahrenheit - 1, + FAHRENHEIT, minTempInCelsius, + minTempInFahrenheit}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "above_max_celsius_temperature", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + .value.floatValues = {maxTempInCelsius + 1, CELSIUS, 0, + 0}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + .value.floatValues = {maxTempInCelsius + 1, CELSIUS, + maxTempInCelsius, + maxTempInFahrenheit}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "above_max_fahrenheit_temperature", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + .value.floatValues = {maxTempInFahrenheit + 1, + FAHRENHEIT, 0, 0}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + .value.floatValues = {maxTempInFahrenheit + 1, + FAHRENHEIT, maxTempInCelsius, + maxTempInFahrenheit}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "inbetween_value_celsius", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + .value.floatValues = {minTempInCelsius + + incrementInCelsius * 2.5f, + CELSIUS, 0, 0}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + .value.floatValues = + {minTempInCelsius + incrementInCelsius * 2.5f, + CELSIUS, + minTempInCelsius + incrementInCelsius * 2, + minTempInFahrenheit + + incrementInFahrenheit * 2}, + }, + }, + }, + SetSpecialValueTestCase{ + .name = "inbetween_value_fahrenheit", + .valuesToSet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + .value.floatValues = {minTempInFahrenheit + + incrementInFahrenheit * + 2.5f, + FAHRENHEIT, 0, 0}, + }, + }, + .expectedValuesToGet = + { + VehiclePropValue{ + .prop = toInt( + VehicleProperty:: + HVAC_TEMPERATURE_VALUE_SUGGESTION), + .areaId = HVAC_ALL, + .value.floatValues = + {minTempInFahrenheit + + incrementInFahrenheit * 2.5f, + FAHRENHEIT, + minTempInCelsius + incrementInCelsius * 2, + minTempInFahrenheit + + incrementInFahrenheit * 2}, + }, + }, + }, + }; + + for (auto& tc : testCases) { + StatusCode status = setValue(tc.valuesToSet[0]); + EXPECT_EQ(status, StatusCode::OK); + + auto events = getChangedProperties(); + EXPECT_EQ(events.size(), static_cast(1)); + events[0].timestamp = 0; + + EXPECT_EQ(events[0], (tc.expectedValuesToGet[0])) + << "Failed Test: " << tc.name << "\n" + << "Received - prop: " << events[0].prop << ", areaId: " << events[0].areaId + << ", floatValues: {" << events[0].value.floatValues[0] << ", " + << events[0].value.floatValues[1] << ", " << events[0].value.floatValues[2] << ", " + << events[0].value.floatValues[3] << "}\n" + << "Expected - prop: " << tc.expectedValuesToGet[0].prop + << ", areaId: " << tc.expectedValuesToGet[0].areaId << ", floatValues: {" + << tc.expectedValuesToGet[0].value.floatValues[0] << ", " + << tc.expectedValuesToGet[0].value.floatValues[1] << ", " + << tc.expectedValuesToGet[0].value.floatValues[2] << ", " + << tc.expectedValuesToGet[0].value.floatValues[3] << "}\n"; + clearChangedProperties(); + } +} + } // namespace fake } // namespace vehicle } // namespace automotive From 4b3434f96efab51e863e9133336a49f30a859575 Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Mon, 6 Mar 2023 18:41:27 +0000 Subject: [PATCH 846/998] Update EffectUUID initialization Avoid dynamic initialization global UUID variables Bug: 271500140 Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit Change-Id: I7574c1fe1ba0aaff1d9d29a9eed10de1aef33806 --- audio/aidl/default/EffectConfig.cpp | 45 ++- audio/aidl/default/EffectFactory.cpp | 13 +- audio/aidl/default/EffectImpl.cpp | 28 +- audio/aidl/default/EffectThread.cpp | 24 +- .../AcousticEchoCancelerSw.cpp | 12 +- .../AcousticEchoCancelerSw.h | 1 - .../AutomaticGainControlV1Sw.cpp | 12 +- .../AutomaticGainControlV1Sw.h | 1 - .../AutomaticGainControlV2Sw.cpp | 14 +- .../AutomaticGainControlV2Sw.h | 1 - audio/aidl/default/bassboost/BassBoostSw.cpp | 15 +- audio/aidl/default/bassboost/BassBoostSw.h | 1 - audio/aidl/default/downmix/DownmixSw.cpp | 23 +- audio/aidl/default/downmix/DownmixSw.h | 1 - .../DynamicsProcessingSw.cpp | 12 +- .../dynamicProcessing/DynamicsProcessingSw.h | 1 - audio/aidl/default/envReverb/EnvReverbSw.cpp | 12 +- audio/aidl/default/envReverb/EnvReverbSw.h | 1 - audio/aidl/default/equalizer/EqualizerSw.cpp | 27 +- audio/aidl/default/equalizer/EqualizerSw.h | 1 - .../default/extension/ExtensionEffect.cpp | 13 +- .../aidl/default/extension/ExtensionEffect.h | 1 - .../hapticGenerator/HapticGeneratorSw.cpp | 12 +- .../hapticGenerator/HapticGeneratorSw.h | 7 +- .../default/include/effect-impl/EffectTypes.h | 20 - .../default/include/effect-impl/EffectUUID.h | 354 ------------------ .../include/effectFactory-impl/EffectConfig.h | 4 + .../effectFactory-impl/EffectFactory.h | 2 +- .../loudnessEnhancer/LoudnessEnhancerSw.cpp | 12 +- .../loudnessEnhancer/LoudnessEnhancerSw.h | 1 - .../noiseSuppression/NoiseSuppressionSw.cpp | 13 +- .../noiseSuppression/NoiseSuppressionSw.h | 6 +- .../default/presetReverb/PresetReverbSw.cpp | 12 +- .../default/presetReverb/PresetReverbSw.h | 1 - .../default/virtualizer/VirtualizerSw.cpp | 14 +- .../aidl/default/virtualizer/VirtualizerSw.h | 1 - .../aidl/default/visualizer/VisualizerSw.cpp | 12 +- audio/aidl/default/visualizer/VisualizerSw.h | 3 +- audio/aidl/default/volume/VolumeSw.cpp | 12 +- audio/aidl/default/volume/VolumeSw.h | 1 - audio/aidl/vts/Android.bp | 1 + audio/aidl/vts/EffectFactoryHelper.h | 1 - audio/aidl/vts/EffectHelper.h | 1 + audio/aidl/vts/VtsHalAECTargetTest.cpp | 5 +- audio/aidl/vts/VtsHalAGC1TargetTest.cpp | 5 +- audio/aidl/vts/VtsHalAGC2TargetTest.cpp | 5 +- .../VtsHalAudioEffectFactoryTargetTest.cpp | 32 +- audio/aidl/vts/VtsHalBassBoostTargetTest.cpp | 4 +- audio/aidl/vts/VtsHalDownmixTargetTest.cpp | 5 +- .../aidl/vts/VtsHalDynamicsProcessingTest.cpp | 14 +- .../VtsHalEnvironmentalReverbTargetTest.cpp | 86 ++--- audio/aidl/vts/VtsHalEqualizerTargetTest.cpp | 5 +- .../vts/VtsHalHapticGeneratorTargetTest.cpp | 8 +- .../vts/VtsHalLoudnessEnhancerTargetTest.cpp | 4 +- audio/aidl/vts/VtsHalNSTargetTest.cpp | 4 +- .../aidl/vts/VtsHalPresetReverbTargetTest.cpp | 5 +- .../aidl/vts/VtsHalVirtualizerTargetTest.cpp | 4 +- audio/aidl/vts/VtsHalVisualizerTargetTest.cpp | 4 +- audio/aidl/vts/VtsHalVolumeTargetTest.cpp | 4 +- 59 files changed, 319 insertions(+), 624 deletions(-) delete mode 100644 audio/aidl/default/include/effect-impl/EffectUUID.h diff --git a/audio/aidl/default/EffectConfig.cpp b/audio/aidl/default/EffectConfig.cpp index c030b7a88c..5a83fef99a 100644 --- a/audio/aidl/default/EffectConfig.cpp +++ b/audio/aidl/default/EffectConfig.cpp @@ -16,6 +16,7 @@ #define LOG_TAG "AHAL_EffectConfig" #include +#include #include "effectFactory-impl/EffectConfig.h" @@ -163,15 +164,53 @@ bool EffectConfig::parseLibraryUuid(const tinyxml2::XMLElement& xml, libraryUuid.name = name; } - const char* uuid = xml.Attribute("uuid"); - RETURN_VALUE_IF(!uuid, false, "noUuidAttribute"); - RETURN_VALUE_IF(!stringToUuid(uuid, &libraryUuid.uuid), false, "invalidUuidAttribute"); + const char* uuidStr = xml.Attribute("uuid"); + RETURN_VALUE_IF(!uuidStr, false, "noUuidAttribute"); + libraryUuid.uuid = stringToUuid(uuidStr); + RETURN_VALUE_IF((libraryUuid.uuid == getEffectUuidZero()), false, "invalidUuidAttribute"); LOG(DEBUG) << __func__ << (isProxy ? " proxy " : libraryUuid.name) << " : " << libraryUuid.uuid.toString(); return true; } +bool EffectConfig::findUuid(const std::string& xmlEffectName, AudioUuid* uuid) { +// Difference from EFFECT_TYPE_LIST_DEF, there could be multiple name mapping to same Effect Type +#define EFFECT_XML_TYPE_LIST_DEF(V) \ + V("acoustic_echo_canceler", AcousticEchoCanceler) \ + V("automatic_gain_control_v1", AutomaticGainControlV1) \ + V("automatic_gain_control_v2", AutomaticGainControlV2) \ + V("bassboost", BassBoost) \ + V("downmix", Downmix) \ + V("dynamics_processing", DynamicsProcessing) \ + V("equalizer", Equalizer) \ + V("haptic_generator", HapticGenerator) \ + V("loudness_enhancer", LoudnessEnhancer) \ + V("env_reverb", EnvReverb) \ + V("reverb_env_aux", EnvReverb) \ + V("reverb_env_ins", EnvReverb) \ + V("preset_reverb", PresetReverb) \ + V("reverb_pre_aux", PresetReverb) \ + V("reverb_pre_ins", PresetReverb) \ + V("noise_suppression", NoiseSuppression) \ + V("spatializer", Spatializer) \ + V("virtualizer", Virtualizer) \ + V("visualizer", Visualizer) \ + V("volume", Volume) + +#define GENERATE_MAP_ENTRY_V(s, symbol) {s, &getEffectTypeUuid##symbol}, + + typedef const AudioUuid& (*UuidGetter)(void); + static const std::map uuidMap{ + // std::make_pair("s", &getEffectTypeUuidExtension)}; + {EFFECT_XML_TYPE_LIST_DEF(GENERATE_MAP_ENTRY_V)}}; + if (auto it = uuidMap.find(xmlEffectName); it != uuidMap.end()) { + *uuid = (*it->second)(); + return true; + } + return false; +} + const char* EffectConfig::dump(const tinyxml2::XMLElement& element, tinyxml2::XMLPrinter&& printer) const { element.Accept(&printer); diff --git a/audio/aidl/default/EffectFactory.cpp b/audio/aidl/default/EffectFactory.cpp index 638fa7fbb8..c1ac3f2d41 100644 --- a/audio/aidl/default/EffectFactory.cpp +++ b/audio/aidl/default/EffectFactory.cpp @@ -14,20 +14,19 @@ * limitations under the License. */ +#include #include #include #include -#include "include/effect-impl/EffectTypes.h" -#define LOG_TAG "AHAL_EffectFactory" -#include #include +#define LOG_TAG "AHAL_EffectFactory" #include #include +#include #include #include "effect-impl/EffectTypes.h" -#include "effect-impl/EffectUUID.h" #include "effectFactory-impl/EffectFactory.h" using aidl::android::media::audio::common::AudioUuid; @@ -214,8 +213,8 @@ void Factory::createIdentityWithConfig(const EffectConfig::LibraryUuid& configLi void Factory::loadEffectLibs() { const auto& configEffectsMap = mConfig.getEffectsMap(); for (const auto& configEffects : configEffectsMap) { - if (auto typeUuid = kUuidNameTypeMap.find(configEffects.first /* effect name */); - typeUuid != kUuidNameTypeMap.end()) { + if (AudioUuid uuid; + EffectConfig::findUuid(configEffects.first /* xml effect name */, &uuid)) { const auto& configLibs = configEffects.second; std::optional proxyUuid; if (configLibs.proxyLibrary.has_value()) { @@ -223,7 +222,7 @@ void Factory::loadEffectLibs() { proxyUuid = proxyLib.uuid; } for (const auto& configLib : configLibs.libraries) { - createIdentityWithConfig(configLib, typeUuid->second, proxyUuid); + createIdentityWithConfig(configLib, uuid, proxyUuid); } } else { LOG(ERROR) << __func__ << ": can not find type UUID for effect " << configEffects.first diff --git a/audio/aidl/default/EffectImpl.cpp b/audio/aidl/default/EffectImpl.cpp index e90fe35054..da1ad111db 100644 --- a/audio/aidl/default/EffectImpl.cpp +++ b/audio/aidl/default/EffectImpl.cpp @@ -40,7 +40,7 @@ namespace aidl::android::hardware::audio::effect { ndk::ScopedAStatus EffectImpl::open(const Parameter::Common& common, const std::optional& specific, OpenEffectReturn* ret) { - LOG(DEBUG) << __func__; + LOG(DEBUG) << getEffectName() << __func__; // effect only support 32bits float RETURN_IF(common.input.base.format.pcm != common.output.base.format.pcm || common.input.base.format.pcm != PcmType::FLOAT_32_BIT, @@ -71,12 +71,12 @@ ndk::ScopedAStatus EffectImpl::close() { RETURN_IF(releaseContext() != RetCode::SUCCESS, EX_UNSUPPORTED_OPERATION, "FailedToCreateWorker"); - LOG(DEBUG) << __func__; + LOG(DEBUG) << getEffectName() << __func__; return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus EffectImpl::setParameter(const Parameter& param) { - LOG(DEBUG) << __func__ << " with: " << param.toString(); + LOG(DEBUG) << getEffectName() << __func__ << " with: " << param.toString(); const auto tag = param.getTag(); switch (tag) { @@ -91,7 +91,8 @@ ndk::ScopedAStatus EffectImpl::setParameter(const Parameter& param) { return setParameterSpecific(param.get()); } default: { - LOG(ERROR) << __func__ << " unsupportedParameterTag " << toString(tag); + LOG(ERROR) << getEffectName() << __func__ << " unsupportedParameterTag " + << toString(tag); return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, "ParameterNotSupported"); } @@ -99,7 +100,7 @@ ndk::ScopedAStatus EffectImpl::setParameter(const Parameter& param) { } ndk::ScopedAStatus EffectImpl::getParameter(const Parameter::Id& id, Parameter* param) { - LOG(DEBUG) << __func__ << id.toString(); + LOG(DEBUG) << getEffectName() << __func__ << id.toString(); auto tag = id.getTag(); switch (tag) { case Parameter::Id::commonTag: { @@ -116,7 +117,7 @@ ndk::ScopedAStatus EffectImpl::getParameter(const Parameter::Id& id, Parameter* break; } } - LOG(DEBUG) << __func__ << param->toString(); + LOG(DEBUG) << getEffectName() << __func__ << param->toString(); return ndk::ScopedAStatus::ok(); } @@ -149,7 +150,8 @@ ndk::ScopedAStatus EffectImpl::setParameterCommon(const Parameter& param) { EX_ILLEGAL_ARGUMENT, "setVolumeStereoFailed"); break; default: { - LOG(ERROR) << __func__ << " unsupportedParameterTag " << toString(tag); + LOG(ERROR) << getEffectName() << __func__ << " unsupportedParameterTag " + << toString(tag); return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, "commonParamNotSupported"); } @@ -183,7 +185,7 @@ ndk::ScopedAStatus EffectImpl::getParameterCommon(const Parameter::Tag& tag, Par break; } default: { - LOG(DEBUG) << __func__ << " unsupported tag " << toString(tag); + LOG(DEBUG) << getEffectName() << __func__ << " unsupported tag " << toString(tag); return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, "tagNotSupported"); } @@ -198,8 +200,8 @@ ndk::ScopedAStatus EffectImpl::getState(State* state) { ndk::ScopedAStatus EffectImpl::command(CommandId command) { RETURN_IF(mState == State::INIT, EX_ILLEGAL_STATE, "CommandStateError"); - LOG(DEBUG) << __func__ << ": receive command: " << toString(command) << " at state " - << toString(mState); + LOG(DEBUG) << getEffectName() << __func__ << ": receive command: " << toString(command) + << " at state " << toString(mState); switch (command) { case CommandId::START: @@ -217,11 +219,11 @@ ndk::ScopedAStatus EffectImpl::command(CommandId command) { mState = State::IDLE; break; default: - LOG(ERROR) << __func__ << " instance still processing"; + LOG(ERROR) << getEffectName() << __func__ << " instance still processing"; return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, "CommandIdNotSupported"); } - LOG(DEBUG) << __func__ << " transfer to state: " << toString(mState); + LOG(DEBUG) << getEffectName() << __func__ << " transfer to state: " << toString(mState); return ndk::ScopedAStatus::ok(); } @@ -252,7 +254,7 @@ IEffect::Status EffectImpl::effectProcessImpl(float* in, float* out, int samples for (int i = 0; i < samples; i++) { *out++ = *in++; } - LOG(DEBUG) << __func__ << " done processing " << samples << " samples"; + LOG(DEBUG) << getEffectName() << __func__ << " done processing " << samples << " samples"; return {STATUS_OK, samples, samples}; } diff --git a/audio/aidl/default/EffectThread.cpp b/audio/aidl/default/EffectThread.cpp index 4f8fb3c08e..844127d2c7 100644 --- a/audio/aidl/default/EffectThread.cpp +++ b/audio/aidl/default/EffectThread.cpp @@ -36,7 +36,7 @@ EffectThread::~EffectThread() { RetCode EffectThread::createThread(std::shared_ptr context, const std::string& name, int priority, int sleepUs /* kSleepTimeUs */) { if (mThread.joinable()) { - LOG(WARNING) << __func__ << " thread already created, no-op"; + LOG(WARNING) << "-" << mName << "-" << __func__ << " thread already created, no-op"; return RetCode::SUCCESS; } mName = name; @@ -47,7 +47,7 @@ RetCode EffectThread::createThread(std::shared_ptr context, const mThreadContext = std::move(context); } mThread = std::thread(&EffectThread::threadLoop, this); - LOG(DEBUG) << __func__ << " " << name << " priority " << mPriority << " done"; + LOG(DEBUG) << "-" << mName << "-" << __func__ << " priority " << mPriority << " done"; return RetCode::SUCCESS; } @@ -66,7 +66,7 @@ RetCode EffectThread::destroyThread() { std::lock_guard lg(mThreadMutex); mThreadContext.reset(); } - LOG(DEBUG) << __func__ << " done"; + LOG(DEBUG) << "-" << mName << "-" << __func__ << " done"; return RetCode::SUCCESS; } @@ -80,21 +80,23 @@ RetCode EffectThread::stopThread() { RetCode EffectThread::handleStartStop(bool stop) { if (!mThread.joinable()) { - LOG(ERROR) << __func__ << " thread already destroyed"; + LOG(ERROR) << "-" << mName << "-" << __func__ << ": " + << " thread already destroyed"; return RetCode::ERROR_THREAD; } { std::lock_guard lg(mThreadMutex); if (stop == mStop) { - LOG(WARNING) << __func__ << " already " << (stop ? "stop" : "start"); + LOG(WARNING) << "-" << mName << "-" << __func__ << ": " + << " already " << (stop ? "stop" : "start"); return RetCode::SUCCESS; } mStop = stop; } mCv.notify_one(); - LOG(DEBUG) << (stop ? "stop done" : "start done"); + LOG(DEBUG) << ": " << mName << (stop ? " stop done" : " start done"); return RetCode::SUCCESS; } @@ -124,16 +126,18 @@ void EffectThread::process_l() { auto readSamples = inputMQ->availableToRead(), writeSamples = outputMQ->availableToWrite(); if (readSamples && writeSamples) { auto processSamples = std::min(readSamples, writeSamples); - LOG(DEBUG) << __func__ << " available to read " << readSamples << " available to write " - << writeSamples << " process " << processSamples; + LOG(DEBUG) << "-" << mName << "-" << __func__ << ": " + << " available to read " << readSamples << " available to write " << writeSamples + << " process " << processSamples; inputMQ->read(buffer, processSamples); IEffect::Status status = effectProcessImpl(buffer, buffer, processSamples); outputMQ->write(buffer, status.fmqProduced); statusMQ->writeBlocking(&status, 1); - LOG(DEBUG) << __func__ << " done processing, effect consumed " << status.fmqConsumed - << " produced " << status.fmqProduced; + LOG(DEBUG) << "-" << mName << "-" << __func__ << ": " + << " done processing, effect consumed " << status.fmqConsumed << " produced " + << status.fmqProduced; } else { usleep(mSleepTimeUs); } diff --git a/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.cpp b/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.cpp index 561f9a32ad..63a014ad67 100644 --- a/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.cpp +++ b/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.cpp @@ -22,19 +22,21 @@ #define LOG_TAG "AHAL_AcousticEchoCancelerSw" #include #include +#include #include "AcousticEchoCancelerSw.h" using aidl::android::hardware::audio::effect::AcousticEchoCancelerSw; using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectImplUuidAcousticEchoCancelerSw; +using aidl::android::hardware::audio::effect::getEffectTypeUuidAcousticEchoCanceler; using aidl::android::hardware::audio::effect::IEffect; -using aidl::android::hardware::audio::effect::kAcousticEchoCancelerSwImplUUID; using aidl::android::hardware::audio::effect::Range; using aidl::android::media::audio::common::AudioUuid; extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, std::shared_ptr* instanceSpp) { - if (!in_impl_uuid || *in_impl_uuid != kAcousticEchoCancelerSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidAcousticEchoCancelerSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -49,7 +51,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, } extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) { - if (!in_impl_uuid || *in_impl_uuid != kAcousticEchoCancelerSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidAcousticEchoCancelerSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -69,8 +71,8 @@ const std::vector AcousticEchoCancelerSw::kRan const Capability AcousticEchoCancelerSw::kCapability = {.range = AcousticEchoCancelerSw::kRanges}; const Descriptor AcousticEchoCancelerSw::kDescriptor = { - .common = {.id = {.type = kAcousticEchoCancelerTypeUUID, - .uuid = kAcousticEchoCancelerSwImplUUID, + .common = {.id = {.type = getEffectTypeUuidAcousticEchoCanceler(), + .uuid = getEffectImplUuidAcousticEchoCancelerSw(), .proxy = std::nullopt}, .flags = {.type = Flags::Type::INSERT, .insert = Flags::Insert::FIRST, diff --git a/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.h b/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.h index 753207df9c..73cf42b17a 100644 --- a/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.h +++ b/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.h @@ -23,7 +23,6 @@ #include #include "effect-impl/EffectImpl.h" -#include "effect-impl/EffectUUID.h" namespace aidl::android::hardware::audio::effect { diff --git a/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.cpp b/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.cpp index 39290b4792..ce10ae1674 100644 --- a/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.cpp +++ b/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.cpp @@ -17,18 +17,20 @@ #define LOG_TAG "AHAL_AutomaticGainControlV1Sw" #include +#include #include "AutomaticGainControlV1Sw.h" using aidl::android::hardware::audio::effect::AutomaticGainControlV1Sw; using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectImplUuidAutomaticGainControlV1Sw; +using aidl::android::hardware::audio::effect::getEffectTypeUuidAutomaticGainControlV1; using aidl::android::hardware::audio::effect::IEffect; -using aidl::android::hardware::audio::effect::kAutomaticGainControlV1SwImplUUID; using aidl::android::media::audio::common::AudioUuid; extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, std::shared_ptr* instanceSpp) { - if (!in_impl_uuid || *in_impl_uuid != kAutomaticGainControlV1SwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidAutomaticGainControlV1Sw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -43,7 +45,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, } extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) { - if (!in_impl_uuid || *in_impl_uuid != kAutomaticGainControlV1SwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidAutomaticGainControlV1Sw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -63,8 +65,8 @@ const Capability AutomaticGainControlV1Sw::kCapability = { .range = AutomaticGainControlV1Sw::kRanges}; const Descriptor AutomaticGainControlV1Sw::kDescriptor = { - .common = {.id = {.type = kAutomaticGainControlV1TypeUUID, - .uuid = kAutomaticGainControlV1SwImplUUID, + .common = {.id = {.type = getEffectTypeUuidAutomaticGainControlV1(), + .uuid = getEffectImplUuidAutomaticGainControlV1Sw(), .proxy = std::nullopt}, .flags = {.type = Flags::Type::INSERT, .insert = Flags::Insert::FIRST, diff --git a/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.h b/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.h index 6ba7328521..7d2a69f9d5 100644 --- a/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.h +++ b/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.h @@ -17,7 +17,6 @@ #pragma once #include "effect-impl/EffectImpl.h" -#include "effect-impl/EffectUUID.h" namespace aidl::android::hardware::audio::effect { diff --git a/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.cpp b/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.cpp index 50712a4f5b..1e336ac012 100644 --- a/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.cpp +++ b/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.cpp @@ -17,22 +17,24 @@ #include #include #include - #define LOG_TAG "AHAL_AutomaticGainControlV2Sw" + #include #include +#include #include "AutomaticGainControlV2Sw.h" using aidl::android::hardware::audio::effect::AutomaticGainControlV2Sw; using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectImplUuidAutomaticGainControlV2Sw; +using aidl::android::hardware::audio::effect::getEffectTypeUuidAutomaticGainControlV2; using aidl::android::hardware::audio::effect::IEffect; -using aidl::android::hardware::audio::effect::kAutomaticGainControlV2SwImplUUID; using aidl::android::media::audio::common::AudioUuid; extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, std::shared_ptr* instanceSpp) { - if (!in_impl_uuid || *in_impl_uuid != kAutomaticGainControlV2SwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidAutomaticGainControlV2Sw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -47,7 +49,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, } extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) { - if (!in_impl_uuid || *in_impl_uuid != kAutomaticGainControlV2SwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidAutomaticGainControlV2Sw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -67,8 +69,8 @@ const Capability AutomaticGainControlV2Sw::kCapability = { .range = AutomaticGainControlV2Sw::kRanges}; const Descriptor AutomaticGainControlV2Sw::kDescriptor = { - .common = {.id = {.type = kAutomaticGainControlV2TypeUUID, - .uuid = kAutomaticGainControlV2SwImplUUID, + .common = {.id = {.type = getEffectTypeUuidAutomaticGainControlV2(), + .uuid = getEffectImplUuidAutomaticGainControlV2Sw(), .proxy = std::nullopt}, .flags = {.type = Flags::Type::INSERT, .insert = Flags::Insert::FIRST, diff --git a/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.h b/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.h index 0b50f4de0b..9aa60eab60 100644 --- a/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.h +++ b/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.h @@ -22,7 +22,6 @@ #include #include "effect-impl/EffectImpl.h" -#include "effect-impl/EffectUUID.h" namespace aidl::android::hardware::audio::effect { diff --git a/audio/aidl/default/bassboost/BassBoostSw.cpp b/audio/aidl/default/bassboost/BassBoostSw.cpp index fb5374f3cc..dbf2e15c7d 100644 --- a/audio/aidl/default/bassboost/BassBoostSw.cpp +++ b/audio/aidl/default/bassboost/BassBoostSw.cpp @@ -21,19 +21,22 @@ #define LOG_TAG "AHAL_BassBoostSw" #include #include +#include #include "BassBoostSw.h" using aidl::android::hardware::audio::effect::BassBoostSw; using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectImplUuidBassBoostProxy; +using aidl::android::hardware::audio::effect::getEffectImplUuidBassBoostSw; +using aidl::android::hardware::audio::effect::getEffectTypeUuidBassBoost; using aidl::android::hardware::audio::effect::IEffect; -using aidl::android::hardware::audio::effect::kBassBoostSwImplUUID; using aidl::android::hardware::audio::effect::State; using aidl::android::media::audio::common::AudioUuid; extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, std::shared_ptr* instanceSpp) { - if (!in_impl_uuid || *in_impl_uuid != kBassBoostSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidBassBoostSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -48,7 +51,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, } extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) { - if (!in_impl_uuid || *in_impl_uuid != kBassBoostSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidBassBoostSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -64,9 +67,9 @@ const std::vector BassBoostSw::kRanges = { MAKE_RANGE(BassBoost, strengthPm, 0, 1000)}; const Capability BassBoostSw::kCapability = {.range = {BassBoostSw::kRanges}}; const Descriptor BassBoostSw::kDescriptor = { - .common = {.id = {.type = kBassBoostTypeUUID, - .uuid = kBassBoostSwImplUUID, - .proxy = kBassBoostProxyUUID}, + .common = {.id = {.type = getEffectTypeUuidBassBoost(), + .uuid = getEffectImplUuidBassBoostSw(), + .proxy = getEffectImplUuidBassBoostProxy()}, .flags = {.type = Flags::Type::INSERT, .insert = Flags::Insert::FIRST, .volume = Flags::Volume::CTRL}, diff --git a/audio/aidl/default/bassboost/BassBoostSw.h b/audio/aidl/default/bassboost/BassBoostSw.h index 8d183dd4dc..11324727a7 100644 --- a/audio/aidl/default/bassboost/BassBoostSw.h +++ b/audio/aidl/default/bassboost/BassBoostSw.h @@ -22,7 +22,6 @@ #include #include "effect-impl/EffectImpl.h" -#include "effect-impl/EffectUUID.h" namespace aidl::android::hardware::audio::effect { diff --git a/audio/aidl/default/downmix/DownmixSw.cpp b/audio/aidl/default/downmix/DownmixSw.cpp index 81a4c89fd6..ce5fe20817 100644 --- a/audio/aidl/default/downmix/DownmixSw.cpp +++ b/audio/aidl/default/downmix/DownmixSw.cpp @@ -20,19 +20,21 @@ #define LOG_TAG "AHAL_DownmixSw" #include #include +#include #include "DownmixSw.h" using aidl::android::hardware::audio::effect::Descriptor; using aidl::android::hardware::audio::effect::DownmixSw; +using aidl::android::hardware::audio::effect::getEffectImplUuidDownmixSw; +using aidl::android::hardware::audio::effect::getEffectTypeUuidDownmix; using aidl::android::hardware::audio::effect::IEffect; -using aidl::android::hardware::audio::effect::kDownmixSwImplUUID; using aidl::android::hardware::audio::effect::State; using aidl::android::media::audio::common::AudioUuid; extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, std::shared_ptr* instanceSpp) { - if (!in_impl_uuid || *in_impl_uuid != kDownmixSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidDownmixSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -47,7 +49,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, } extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) { - if (!in_impl_uuid || *in_impl_uuid != kDownmixSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidDownmixSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -59,13 +61,14 @@ namespace aidl::android::hardware::audio::effect { const std::string DownmixSw::kEffectName = "DownmixSw"; const Descriptor DownmixSw::kDescriptor = { - .common = { - .id = {.type = kDownmixTypeUUID, .uuid = kDownmixSwImplUUID, .proxy = std::nullopt}, - .flags = {.type = Flags::Type::INSERT, - .insert = Flags::Insert::FIRST, - .volume = Flags::Volume::CTRL}, - .name = kEffectName, - .implementor = "The Android Open Source Project"}}; + .common = {.id = {.type = getEffectTypeUuidDownmix(), + .uuid = getEffectImplUuidDownmixSw(), + .proxy = std::nullopt}, + .flags = {.type = Flags::Type::INSERT, + .insert = Flags::Insert::FIRST, + .volume = Flags::Volume::CTRL}, + .name = kEffectName, + .implementor = "The Android Open Source Project"}}; ndk::ScopedAStatus DownmixSw::getDescriptor(Descriptor* _aidl_return) { LOG(DEBUG) << __func__ << kDescriptor.toString(); diff --git a/audio/aidl/default/downmix/DownmixSw.h b/audio/aidl/default/downmix/DownmixSw.h index 37c978be5e..3f8a09b16c 100644 --- a/audio/aidl/default/downmix/DownmixSw.h +++ b/audio/aidl/default/downmix/DownmixSw.h @@ -22,7 +22,6 @@ #include #include "effect-impl/EffectImpl.h" -#include "effect-impl/EffectUUID.h" namespace aidl::android::hardware::audio::effect { diff --git a/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.cpp b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.cpp index 1dda6d1183..ed6cfa0b39 100644 --- a/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.cpp +++ b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.cpp @@ -22,19 +22,21 @@ #define LOG_TAG "AHAL_DynamicsProcessingSw" #include #include +#include #include "DynamicsProcessingSw.h" using aidl::android::hardware::audio::effect::Descriptor; using aidl::android::hardware::audio::effect::DynamicsProcessingSw; +using aidl::android::hardware::audio::effect::getEffectImplUuidDynamicsProcessingSw; +using aidl::android::hardware::audio::effect::getEffectTypeUuidDynamicsProcessing; using aidl::android::hardware::audio::effect::IEffect; -using aidl::android::hardware::audio::effect::kDynamicsProcessingSwImplUUID; using aidl::android::hardware::audio::effect::State; using aidl::android::media::audio::common::AudioUuid; extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, std::shared_ptr* instanceSpp) { - if (!in_impl_uuid || *in_impl_uuid != kDynamicsProcessingSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidDynamicsProcessingSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -49,7 +51,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, } extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) { - if (!in_impl_uuid || *in_impl_uuid != kDynamicsProcessingSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidDynamicsProcessingSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -88,8 +90,8 @@ const std::vector DynamicsProcessingSw::kRanges const Capability DynamicsProcessingSw::kCapability = {.range = DynamicsProcessingSw::kRanges}; const Descriptor DynamicsProcessingSw::kDescriptor = { - .common = {.id = {.type = kDynamicsProcessingTypeUUID, - .uuid = kDynamicsProcessingSwImplUUID, + .common = {.id = {.type = getEffectTypeUuidDynamicsProcessing(), + .uuid = getEffectImplUuidDynamicsProcessingSw(), .proxy = std::nullopt}, .flags = {.type = Flags::Type::INSERT, .insert = Flags::Insert::FIRST, diff --git a/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.h b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.h index 769f9ef14f..641cf71f68 100644 --- a/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.h +++ b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.h @@ -25,7 +25,6 @@ #include #include "effect-impl/EffectImpl.h" -#include "effect-impl/EffectUUID.h" namespace aidl::android::hardware::audio::effect { diff --git a/audio/aidl/default/envReverb/EnvReverbSw.cpp b/audio/aidl/default/envReverb/EnvReverbSw.cpp index 29288cacf3..73975c6996 100644 --- a/audio/aidl/default/envReverb/EnvReverbSw.cpp +++ b/audio/aidl/default/envReverb/EnvReverbSw.cpp @@ -21,19 +21,21 @@ #define LOG_TAG "AHAL_EnvReverbSw" #include #include +#include #include "EnvReverbSw.h" using aidl::android::hardware::audio::effect::Descriptor; using aidl::android::hardware::audio::effect::EnvReverbSw; +using aidl::android::hardware::audio::effect::getEffectImplUuidEnvReverbSw; +using aidl::android::hardware::audio::effect::getEffectTypeUuidEnvReverb; using aidl::android::hardware::audio::effect::IEffect; -using aidl::android::hardware::audio::effect::kEnvReverbSwImplUUID; using aidl::android::hardware::audio::effect::State; using aidl::android::media::audio::common::AudioUuid; extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, std::shared_ptr* instanceSpp) { - if (!in_impl_uuid || *in_impl_uuid != kEnvReverbSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidEnvReverbSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -48,7 +50,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, } extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) { - if (!in_impl_uuid || *in_impl_uuid != kEnvReverbSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidEnvReverbSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -76,8 +78,8 @@ const Capability EnvReverbSw::kCapability = { .range = Range::make(EnvReverbSw::kRanges)}; const Descriptor EnvReverbSw::kDescriptor = { - .common = {.id = {.type = kEnvReverbTypeUUID, - .uuid = kEnvReverbSwImplUUID, + .common = {.id = {.type = getEffectTypeUuidEnvReverb(), + .uuid = getEffectImplUuidEnvReverbSw(), .proxy = std::nullopt}, .flags = {.type = Flags::Type::INSERT, .insert = Flags::Insert::FIRST, diff --git a/audio/aidl/default/envReverb/EnvReverbSw.h b/audio/aidl/default/envReverb/EnvReverbSw.h index dd2cf5deb2..5e31e2f8b2 100644 --- a/audio/aidl/default/envReverb/EnvReverbSw.h +++ b/audio/aidl/default/envReverb/EnvReverbSw.h @@ -22,7 +22,6 @@ #include #include "effect-impl/EffectImpl.h" -#include "effect-impl/EffectUUID.h" namespace aidl::android::hardware::audio::effect { diff --git a/audio/aidl/default/equalizer/EqualizerSw.cpp b/audio/aidl/default/equalizer/EqualizerSw.cpp index 0fa7a11607..97699249fc 100644 --- a/audio/aidl/default/equalizer/EqualizerSw.cpp +++ b/audio/aidl/default/equalizer/EqualizerSw.cpp @@ -20,19 +20,21 @@ #define LOG_TAG "AHAL_EqualizerSw" #include #include +#include #include "EqualizerSw.h" using aidl::android::hardware::audio::effect::Descriptor; using aidl::android::hardware::audio::effect::EqualizerSw; +using aidl::android::hardware::audio::effect::getEffectImplUuidEqualizerSw; +using aidl::android::hardware::audio::effect::getEffectTypeUuidEqualizer; using aidl::android::hardware::audio::effect::IEffect; -using aidl::android::hardware::audio::effect::kEqualizerSwImplUUID; using aidl::android::hardware::audio::effect::State; using aidl::android::media::audio::common::AudioUuid; extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, std::shared_ptr* instanceSpp) { - if (!in_impl_uuid || *in_impl_uuid != kEqualizerSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidEqualizerSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -47,7 +49,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, } extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) { - if (!in_impl_uuid || *in_impl_uuid != kEqualizerSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidEqualizerSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -86,15 +88,16 @@ const std::vector EqualizerSw::kRanges = { MAKE_RANGE(Equalizer, centerFreqMh, std::vector({1}), std::vector({0}))}; const Capability EqualizerSw::kEqCap = {.range = EqualizerSw::kRanges}; -const Descriptor EqualizerSw::kDesc = {.common = {.id = {.type = kEqualizerTypeUUID, - .uuid = kEqualizerSwImplUUID, - .proxy = kEqualizerProxyUUID}, - .flags = {.type = Flags::Type::INSERT, - .insert = Flags::Insert::FIRST, - .volume = Flags::Volume::CTRL}, - .name = EqualizerSw::kEffectName, - .implementor = "The Android Open Source Project"}, - .capability = EqualizerSw::kEqCap}; +const Descriptor EqualizerSw::kDesc = { + .common = {.id = {.type = getEffectTypeUuidEqualizer(), + .uuid = getEffectImplUuidEqualizerSw(), + .proxy = getEffectImplUuidEqualizerProxy()}, + .flags = {.type = Flags::Type::INSERT, + .insert = Flags::Insert::FIRST, + .volume = Flags::Volume::CTRL}, + .name = EqualizerSw::kEffectName, + .implementor = "The Android Open Source Project"}, + .capability = EqualizerSw::kEqCap}; ndk::ScopedAStatus EqualizerSw::getDescriptor(Descriptor* _aidl_return) { LOG(DEBUG) << __func__ << kDesc.toString(); diff --git a/audio/aidl/default/equalizer/EqualizerSw.h b/audio/aidl/default/equalizer/EqualizerSw.h index f8987c718b..56af3b5821 100644 --- a/audio/aidl/default/equalizer/EqualizerSw.h +++ b/audio/aidl/default/equalizer/EqualizerSw.h @@ -22,7 +22,6 @@ #include #include "effect-impl/EffectImpl.h" -#include "effect-impl/EffectUUID.h" namespace aidl::android::hardware::audio::effect { diff --git a/audio/aidl/default/extension/ExtensionEffect.cpp b/audio/aidl/default/extension/ExtensionEffect.cpp index db1e4a4bf3..c4eebc005f 100644 --- a/audio/aidl/default/extension/ExtensionEffect.cpp +++ b/audio/aidl/default/extension/ExtensionEffect.cpp @@ -23,22 +23,23 @@ #define LOG_TAG "AHAL_ExtensionEffect" #include #include +#include #include "ExtensionEffect.h" using aidl::android::hardware::audio::effect::DefaultExtension; using aidl::android::hardware::audio::effect::Descriptor; using aidl::android::hardware::audio::effect::ExtensionEffect; +using aidl::android::hardware::audio::effect::getEffectUuidExtensionImpl; +using aidl::android::hardware::audio::effect::getEffectUuidExtensionType; using aidl::android::hardware::audio::effect::IEffect; -using aidl::android::hardware::audio::effect::kExtensionEffectImplUUID; -using aidl::android::hardware::audio::effect::kExtensionEffectTypeUUID; using aidl::android::hardware::audio::effect::Range; using aidl::android::hardware::audio::effect::VendorExtension; using aidl::android::media::audio::common::AudioUuid; extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, std::shared_ptr* instanceSpp) { - if (!in_impl_uuid || *in_impl_uuid != kExtensionEffectImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectUuidExtensionImpl()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -53,7 +54,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, } extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) { - if (!in_impl_uuid || *in_impl_uuid != kExtensionEffectImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectUuidExtensionImpl()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -66,8 +67,8 @@ namespace aidl::android::hardware::audio::effect { const std::string ExtensionEffect::kEffectName = "ExtensionEffectExample"; const Descriptor ExtensionEffect::kDescriptor = { - .common = {.id = {.type = kExtensionEffectTypeUUID, - .uuid = kExtensionEffectImplUUID, + .common = {.id = {.type = getEffectUuidExtensionType(), + .uuid = getEffectUuidExtensionImpl(), .proxy = std::nullopt}, .name = ExtensionEffect::kEffectName, .implementor = "The Android Open Source Project"}}; diff --git a/audio/aidl/default/extension/ExtensionEffect.h b/audio/aidl/default/extension/ExtensionEffect.h index f432d4096d..e7a068ba46 100644 --- a/audio/aidl/default/extension/ExtensionEffect.h +++ b/audio/aidl/default/extension/ExtensionEffect.h @@ -22,7 +22,6 @@ #include #include "effect-impl/EffectImpl.h" -#include "effect-impl/EffectUUID.h" namespace aidl::android::hardware::audio::effect { diff --git a/audio/aidl/default/hapticGenerator/HapticGeneratorSw.cpp b/audio/aidl/default/hapticGenerator/HapticGeneratorSw.cpp index 944f715ed3..27cdac8086 100644 --- a/audio/aidl/default/hapticGenerator/HapticGeneratorSw.cpp +++ b/audio/aidl/default/hapticGenerator/HapticGeneratorSw.cpp @@ -20,19 +20,21 @@ #define LOG_TAG "AHAL_HapticGeneratorSw" #include #include +#include #include "HapticGeneratorSw.h" using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectImplUuidHapticGeneratorSw; +using aidl::android::hardware::audio::effect::getEffectTypeUuidHapticGenerator; using aidl::android::hardware::audio::effect::HapticGeneratorSw; using aidl::android::hardware::audio::effect::IEffect; -using aidl::android::hardware::audio::effect::kHapticGeneratorSwImplUUID; using aidl::android::hardware::audio::effect::State; using aidl::android::media::audio::common::AudioUuid; extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, std::shared_ptr* instanceSpp) { - if (!in_impl_uuid || *in_impl_uuid != kHapticGeneratorSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidHapticGeneratorSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -47,7 +49,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, } extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) { - if (!in_impl_uuid || *in_impl_uuid != kHapticGeneratorSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidHapticGeneratorSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -60,8 +62,8 @@ namespace aidl::android::hardware::audio::effect { const std::string HapticGeneratorSw::kEffectName = "HapticGeneratorSw"; /* Effect descriptor */ const Descriptor HapticGeneratorSw::kDescriptor = { - .common = {.id = {.type = kHapticGeneratorTypeUUID, - .uuid = kHapticGeneratorSwImplUUID, + .common = {.id = {.type = getEffectTypeUuidHapticGenerator(), + .uuid = getEffectImplUuidHapticGeneratorSw(), .proxy = std::nullopt}, .flags = {.type = Flags::Type::INSERT, .insert = Flags::Insert::FIRST, diff --git a/audio/aidl/default/hapticGenerator/HapticGeneratorSw.h b/audio/aidl/default/hapticGenerator/HapticGeneratorSw.h index 428f460885..3bbe41ad29 100644 --- a/audio/aidl/default/hapticGenerator/HapticGeneratorSw.h +++ b/audio/aidl/default/hapticGenerator/HapticGeneratorSw.h @@ -16,13 +16,14 @@ #pragma once -#include -#include #include +#include #include +#include +#include + #include "effect-impl/EffectImpl.h" -#include "effect-impl/EffectUUID.h" namespace aidl::android::hardware::audio::effect { diff --git a/audio/aidl/default/include/effect-impl/EffectTypes.h b/audio/aidl/default/include/effect-impl/EffectTypes.h index fe534d772d..4bda7bea21 100644 --- a/audio/aidl/default/include/effect-impl/EffectTypes.h +++ b/audio/aidl/default/include/effect-impl/EffectTypes.h @@ -15,7 +15,6 @@ */ #pragma once -#include #include #include @@ -128,23 +127,4 @@ inline std::ostream& operator<<(std::ostream& out, const RetCode& code) { #define MAKE_RANGE(T, Tag, l, r) \ { .min = T::make(l), .max = T::make(r) } -static inline bool stringToUuid(const char* str, - ::aidl::android::media::audio::common::AudioUuid* uuid) { - RETURN_VALUE_IF(!uuid || !str, false, "nullPtr"); - - uint32_t tmp[10]; - if (sscanf(str, "%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x", tmp, tmp + 1, tmp + 2, tmp + 3, - tmp + 4, tmp + 5, tmp + 6, tmp + 7, tmp + 8, tmp + 9) < 10) { - return false; - } - - uuid->timeLow = (uint32_t)tmp[0]; - uuid->timeMid = (uint16_t)tmp[1]; - uuid->timeHiAndVersion = (uint16_t)tmp[2]; - uuid->clockSeq = (uint16_t)tmp[3]; - uuid->node.insert(uuid->node.end(), {(uint8_t)tmp[4], (uint8_t)tmp[5], (uint8_t)tmp[6], - (uint8_t)tmp[7], (uint8_t)tmp[8], (uint8_t)tmp[9]}); - return true; -} - } // namespace aidl::android::hardware::audio::effect diff --git a/audio/aidl/default/include/effect-impl/EffectUUID.h b/audio/aidl/default/include/effect-impl/EffectUUID.h deleted file mode 100644 index bc61c0f4cc..0000000000 --- a/audio/aidl/default/include/effect-impl/EffectUUID.h +++ /dev/null @@ -1,354 +0,0 @@ -/* - * 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. - */ - -#pragma once -#include - -#include - -namespace aidl::android::hardware::audio::effect { - -using ::aidl::android::media::audio::common::AudioUuid; - -// ec7178ec-e5e1-4432-a3f4-4657e6795210 -static const AudioUuid kEffectNullUuid = {static_cast(0xec7178ec), - 0xe5e1, - 0x4432, - 0xa3f4, - {0x46, 0x57, 0xe6, 0x79, 0x52, 0x10}}; -// Zero UUID -static const AudioUuid kEffectZeroUuid = { - static_cast(0x0), 0x0, 0x0, 0x0, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}; - -// 7b491460-8d4d-11e0-bd61-0002a5d5c51b. -static const AudioUuid kAcousticEchoCancelerTypeUUID = {static_cast(0x7b491460), - 0x8d4d, - 0x11e0, - 0xbd61, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -// bb392ec0-8d4d-11e0-a896-0002a5d5c51b -static const AudioUuid kAcousticEchoCancelerSwImplUUID = {static_cast(0xbb392ec0), - 0x8d4d, - 0x11e0, - 0xa896, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -// 0a8abfe0-654c-11e0-ba26-0002a5d5c51b -static const AudioUuid kAutomaticGainControlV1TypeUUID = {static_cast(0x0a8abfe0), - 0x654c, - 0x11e0, - 0xba26, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -// aa8130e0-66fc-11e0-bad0-0002a5d5c51b -static const AudioUuid kAutomaticGainControlV1SwImplUUID = {static_cast(0xaa8130e0), - 0x66fc, - 0x11e0, - 0xbad0, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -// ae3c653b-be18-4ab8-8938-418f0a7f06ac -static const AudioUuid kAutomaticGainControlV2TypeUUID = {static_cast(0xae3c653b), - 0xbe18, - 0x4ab8, - 0x8938, - {0x41, 0x8f, 0x0a, 0x7f, 0x06, 0xac}}; -// 89f38e65-d4d2-4d64-ad0e-2b3e799ea886 -static const AudioUuid kAutomaticGainControlV2SwImplUUID = {static_cast(0x89f38e65), - 0xd4d2, - 0x4d64, - 0xad0e, - {0x2b, 0x3e, 0x79, 0x9e, 0xa8, 0x86}}; -// 0634f220-ddd4-11db-a0fc-0002a5d5c51b -static const AudioUuid kBassBoostTypeUUID = {static_cast(0x0634f220), - 0xddd4, - 0x11db, - 0xa0fc, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -// fa8181f2-588b-11ed-9b6a-0242ac120002 -static const AudioUuid kBassBoostSwImplUUID = {static_cast(0xfa8181f2), - 0x588b, - 0x11ed, - 0x9b6a, - {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}}; -// 8631f300-72e2-11df-b57e-0002a5d5c51b -static const AudioUuid kBassBoostBundleImplUUID = {static_cast(0x8631f300), - 0x72e2, - 0x11df, - 0xb57e, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -// 14804144-a5ee-4d24-aa88-0002a5d5c51b -static const AudioUuid kBassBoostProxyUUID = {static_cast(0x14804144), - 0xa5ee, - 0x4d24, - 0xaa88, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -// 381e49cc-a858-4aa2-87f6-e8388e7601b2 -static const AudioUuid kDownmixTypeUUID = {static_cast(0x381e49cc), - 0xa858, - 0x4aa2, - 0x87f6, - {0xe8, 0x38, 0x8e, 0x76, 0x01, 0xb2}}; -// fa8187ba-588b-11ed-9b6a-0242ac120002 -static const AudioUuid kDownmixSwImplUUID = {static_cast(0xfa8187ba), - 0x588b, - 0x11ed, - 0x9b6a, - {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}}; -// 93f04452-e4fe-41cc-91f9-e475b6d1d69f -static const AudioUuid kDownmixImplUUID = {static_cast(0x93f04452), - 0xe4fe, - 0x41cc, - 0x91f9, - {0xe4, 0x75, 0xb6, 0xd1, 0xd6, 0x9f}}; -// 0bed4300-ddd6-11db-8f34-0002a5d5c51b. -static const AudioUuid kEqualizerTypeUUID = {static_cast(0x0bed4300), - 0xddd6, - 0x11db, - 0x8f34, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -// 0bed4300-847d-11df-bb17-0002a5d5c51b -static const AudioUuid kEqualizerSwImplUUID = {static_cast(0x0bed4300), - 0x847d, - 0x11df, - 0xbb17, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -// ce772f20-847d-11df-bb17-0002a5d5c51b -static const AudioUuid kEqualizerBundleImplUUID = {static_cast(0xce772f20), - 0x847d, - 0x11df, - 0xbb17, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -// c8e70ecd-48ca-456e-8a4f-0002a5d5c51b -static const AudioUuid kEqualizerProxyUUID = {static_cast(0xc8e70ecd), - 0x48ca, - 0x456e, - 0x8a4f, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -// 7261676f-6d75-7369-6364-28e2fd3ac39e -static const AudioUuid kDynamicsProcessingTypeUUID = {static_cast(0x7261676f), - 0x6d75, - 0x7369, - 0x6364, - {0x28, 0xe2, 0xfd, 0x3a, 0xc3, 0x9e}}; -// fa818d78-588b-11ed-9b6a-0242ac120002 -static const AudioUuid kDynamicsProcessingSwImplUUID = {static_cast(0xfa818d78), - 0x588b, - 0x11ed, - 0x9b6a, - {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}}; -// e0e6539b-1781-7261-676f-6d7573696340 -static const AudioUuid kDynamicsProcessingImplUUID = {static_cast(0xe0e6539b), - 0x1781, - 0x7261, - 0x676f, - {0x6d, 0x75, 0x73, 0x69, 0x63, 0x40}}; -// 1411e6d6-aecd-4021-a1cf-a6aceb0d71e5 -static const AudioUuid kHapticGeneratorTypeUUID = {static_cast(0x1411e6d6), - 0xaecd, - 0x4021, - 0xa1cf, - {0xa6, 0xac, 0xeb, 0x0d, 0x71, 0xe5}}; -// fa819110-588b-11ed-9b6a-0242ac120002 -static const AudioUuid kHapticGeneratorSwImplUUID = {static_cast(0xfa819110), - 0x588b, - 0x11ed, - 0x9b6a, - {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}}; -// 97c4acd1-8b82-4f2f-832e-c2fe5d7a9931 -static const AudioUuid kHapticGeneratorImplUUID = {static_cast(0x97c4acd1), - 0x8b82, - 0x4f2f, - 0x832e, - {0xc2, 0xfe, 0x5d, 0x7a, 0x99, 0x31}}; -// fe3199be-aed0-413f-87bb-11260eb63cf1 -static const AudioUuid kLoudnessEnhancerTypeUUID = {static_cast(0xfe3199be), - 0xaed0, - 0x413f, - 0x87bb, - {0x11, 0x26, 0x0e, 0xb6, 0x3c, 0xf1}}; -// fa819610-588b-11ed-9b6a-0242ac120002 -static const AudioUuid kLoudnessEnhancerSwImplUUID = {static_cast(0xfa819610), - 0x588b, - 0x11ed, - 0x9b6a, - {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}}; -// fa415329-2034-4bea-b5dc-5b381c8d1e2c -static const AudioUuid kLoudnessEnhancerImplUUID = {static_cast(0xfa415329), - 0x2034, - 0x4bea, - 0xb5dc, - {0x5b, 0x38, 0x1c, 0x8d, 0x1e, 0x2c}}; -// c2e5d5f0-94bd-4763-9cac-4e234d06839e -static const AudioUuid kEnvReverbTypeUUID = {static_cast(0xc2e5d5f0), - 0x94bd, - 0x4763, - 0x9cac, - {0x4e, 0x23, 0x4d, 0x06, 0x83, 0x9e}}; -// fa819886-588b-11ed-9b6a-0242ac120002 -static const AudioUuid kEnvReverbSwImplUUID = {static_cast(0xfa819886), - 0x588b, - 0x11ed, - 0x9b6a, - {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}}; -// 4a387fc0-8ab3-11df-8bad-0002a5d5c51b -static const AudioUuid kAuxEnvReverbImplUUID = {static_cast(0x4a387fc0), - 0x8ab3, - 0x11df, - 0x8bad, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -// c7a511a0-a3bb-11df-860e-0002a5d5c51b -static const AudioUuid kInsertEnvReverbImplUUID = {static_cast(0xc7a511a0), - 0xa3bb, - 0x11df, - 0x860e, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -// 58b4b260-8e06-11e0-aa8e-0002a5d5c51b -static const AudioUuid kNoiseSuppressionTypeUUID = {static_cast(0x58b4b260), - 0x8e06, - 0x11e0, - 0xaa8e, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -// c06c8400-8e06-11e0-9cb6-0002a5d5c51b -static const AudioUuid kNoiseSuppressionSwImplUUID = {static_cast(0xc06c8400), - 0x8e06, - 0x11e0, - 0x9cb6, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -// 47382d60-ddd8-11db-bf3a-0002a5d5c51b -static const AudioUuid kPresetReverbTypeUUID = {static_cast(0x47382d60), - 0xddd8, - 0x11db, - 0xbf3a, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -// fa8199c6-588b-11ed-9b6a-0242ac120002 -static const AudioUuid kPresetReverbSwImplUUID = {static_cast(0xfa8199c6), - 0x588b, - 0x11ed, - 0x9b6a, - {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}}; -// f29a1400-a3bb-11df-8ddc-0002a5d5c51b -static const AudioUuid kAuxPresetReverbImplUUID = {static_cast(0xf29a1400), - 0xa3bb, - 0x11df, - 0x8ddc, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -// 172cdf00-a3bc-11df-a72f-0002a5d5c51b -static const AudioUuid kInsertPresetReverbImplUUID = {static_cast(0x172cdf00), - 0xa3bc, - 0x11df, - 0xa72f, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -// 37cc2c00-dddd-11db-8577-0002a5d5c51b -static const AudioUuid kVirtualizerTypeUUID = {static_cast(0x37cc2c00), - 0xdddd, - 0x11db, - 0x8577, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -// fa819d86-588b-11ed-9b6a-0242ac120002 -static const AudioUuid kVirtualizerSwImplUUID = {static_cast(0xfa819d86), - 0x588b, - 0x11ed, - 0x9b6a, - {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}}; -// 1d4033c0-8557-11df-9f2d-0002a5d5c51b -static const AudioUuid kVirtualizerBundleImplUUID = {static_cast(0x1d4033c0), - 0x8557, - 0x11df, - 0x9f2d, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -// d3467faa-acc7-4d34-acaf-0002a5d5c51b -static const AudioUuid kVirtualizerProxyUUID = {static_cast(0xd3467faa), - 0xacc7, - 0x4d34, - 0xacaf, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -// e46b26a0-dddd-11db-8afd-0002a5d5c51b -static const AudioUuid kVisualizerTypeUUID = {static_cast(0xe46b26a0), - 0xdddd, - 0x11db, - 0x8afd, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -// fa81a0f6-588b-11ed-9b6a-0242ac120002 -static const AudioUuid kVisualizerSwImplUUID = {static_cast(0xfa81a0f6), - 0x588b, - 0x11ed, - 0x9b6a, - {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}}; -// d069d9e0-8329-11df-9168-0002a5d5c51b -// {0xd069d9e0, 0x8329, 0x11df, 0x9168, {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}, -static const AudioUuid kVisualizerImplUUID = {static_cast(0xd069d9e0), - 0x8329, - 0x11df, - 0x9168, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; -// fa81a2b8-588b-11ed-9b6a-0242ac120002 -static const AudioUuid kVolumeTypeUUID = {static_cast(0xfa81a2b8), - 0x588b, - 0x11ed, - 0x9b6a, - {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}}; -// fa81a718-588b-11ed-9b6a-0242ac120002 -static const AudioUuid kVolumeSwImplUUID = {static_cast(0xfa81a718), - 0x588b, - 0x11ed, - 0x9b6a, - {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}}; -// 119341a0-8469-11df-81f9-0002a5d5c51b -static const AudioUuid kVolumeBundleImplUUID = {static_cast(0x119341a0), - 0x8469, - 0x11df, - 0x81f9, - {0x00, 0x02, 0xa5, 0xd5, 0xc5, 0x1b}}; - -// fa81dbde-588b-11ed-9b6a-0242ac120002 -static const AudioUuid kExtensionEffectTypeUUID = {static_cast(0xfa81dbde), - 0x588b, - 0x11ed, - 0x9b6a, - {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}}; -// fa81dd00-588b-11ed-9b6a-0242ac120002 -static const AudioUuid kExtensionEffectImplUUID = {static_cast(0xfa81dd00), - 0x588b, - 0x11ed, - 0x9b6a, - {0x02, 0x42, 0xac, 0x12, 0x00, 0x02}}; -/** - * @brief A map between effect name and effect type UUID. - * All attribution in effect/effectProxy of audio_effects.xml should be listed in this map. - * We need this map is because existing audio_effects.xml don't have a type UUID defined. - */ -static const std::map kUuidNameTypeMap = { - {"acoustic_echo_canceler", kAcousticEchoCancelerTypeUUID}, - {"automatic_gain_control_v1", kAutomaticGainControlV1TypeUUID}, - {"automatic_gain_control_v2", kAutomaticGainControlV2TypeUUID}, - {"bassboost", kBassBoostTypeUUID}, - {"downmix", kDownmixTypeUUID}, - {"dynamics_processing", kDynamicsProcessingTypeUUID}, - {"equalizer", kEqualizerTypeUUID}, - {"extensioneffect", kExtensionEffectTypeUUID}, - {"haptic_generator", kHapticGeneratorTypeUUID}, - {"loudness_enhancer", kLoudnessEnhancerTypeUUID}, - {"env_reverb", kEnvReverbTypeUUID}, - {"noise_suppression", kNoiseSuppressionTypeUUID}, - {"preset_reverb", kPresetReverbTypeUUID}, - {"reverb_env_aux", kEnvReverbTypeUUID}, - {"reverb_env_ins", kEnvReverbTypeUUID}, - {"reverb_pre_aux", kPresetReverbTypeUUID}, - {"reverb_pre_ins", kPresetReverbTypeUUID}, - {"virtualizer", kVirtualizerTypeUUID}, - {"visualizer", kVisualizerTypeUUID}, - {"volume", kVolumeTypeUUID}, -}; - -} // namespace aidl::android::hardware::audio::effect diff --git a/audio/aidl/default/include/effectFactory-impl/EffectConfig.h b/audio/aidl/default/include/effectFactory-impl/EffectConfig.h index c499811f12..c627a273d9 100644 --- a/audio/aidl/default/include/effectFactory-impl/EffectConfig.h +++ b/audio/aidl/default/include/effectFactory-impl/EffectConfig.h @@ -17,6 +17,7 @@ #pragma once #include +#include #include #include #include @@ -62,6 +63,9 @@ class EffectConfig { return mProcessingMap; } + static bool findUuid(const std::string& xmlEffectName, + ::aidl::android::media::audio::common::AudioUuid* uuid); + private: static constexpr const char* kEffectLibPath[] = #ifdef __LP64__ diff --git a/audio/aidl/default/include/effectFactory-impl/EffectFactory.h b/audio/aidl/default/include/effectFactory-impl/EffectFactory.h index fc9ef0290f..b7f63afca0 100644 --- a/audio/aidl/default/include/effectFactory-impl/EffectFactory.h +++ b/audio/aidl/default/include/effectFactory-impl/EffectFactory.h @@ -105,7 +105,7 @@ class Factory : public BnFactory { const std::string& path); void createIdentityWithConfig( const EffectConfig::LibraryUuid& configLib, - const ::aidl::android::media::audio::common::AudioUuid& typeUuid, + const ::aidl::android::media::audio::common::AudioUuid& typeUuidStr, const std::optional<::aidl::android::media::audio::common::AudioUuid> proxyUuid); void loadEffectLibs(); /* Get effect_dl_interface_s from library handle */ diff --git a/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.cpp b/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.cpp index f115cc51d2..7954316654 100644 --- a/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.cpp +++ b/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.cpp @@ -20,19 +20,21 @@ #define LOG_TAG "AHAL_LoudnessEnhancerSw" #include #include +#include #include "LoudnessEnhancerSw.h" using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectImplUuidLoudnessEnhancerSw; +using aidl::android::hardware::audio::effect::getEffectTypeUuidLoudnessEnhancer; using aidl::android::hardware::audio::effect::IEffect; -using aidl::android::hardware::audio::effect::kLoudnessEnhancerSwImplUUID; using aidl::android::hardware::audio::effect::LoudnessEnhancerSw; using aidl::android::hardware::audio::effect::State; using aidl::android::media::audio::common::AudioUuid; extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, std::shared_ptr* instanceSpp) { - if (!in_impl_uuid || *in_impl_uuid != kLoudnessEnhancerSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidLoudnessEnhancerSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -47,7 +49,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, } extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) { - if (!in_impl_uuid || *in_impl_uuid != kLoudnessEnhancerSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidLoudnessEnhancerSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -59,8 +61,8 @@ namespace aidl::android::hardware::audio::effect { const std::string LoudnessEnhancerSw::kEffectName = "LoudnessEnhancerSw"; const Descriptor LoudnessEnhancerSw::kDescriptor = { - .common = {.id = {.type = kLoudnessEnhancerTypeUUID, - .uuid = kLoudnessEnhancerSwImplUUID, + .common = {.id = {.type = getEffectTypeUuidLoudnessEnhancer(), + .uuid = getEffectImplUuidLoudnessEnhancerSw(), .proxy = std::nullopt}, .flags = {.type = Flags::Type::INSERT, .insert = Flags::Insert::FIRST, diff --git a/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.h b/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.h index e252f4acd1..25824f20d5 100644 --- a/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.h +++ b/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.h @@ -22,7 +22,6 @@ #include #include "effect-impl/EffectImpl.h" -#include "effect-impl/EffectUUID.h" namespace aidl::android::hardware::audio::effect { diff --git a/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.cpp b/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.cpp index ba39b16217..9b2cb7ca6c 100644 --- a/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.cpp +++ b/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.cpp @@ -17,22 +17,25 @@ #include #include #include +#define LOG_TAG "AHAL_NoiseSuppressionSw" #define LOG_TAG "AHAL_NoiseSuppressionSw" #include #include +#include #include "NoiseSuppressionSw.h" using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectImplUuidNoiseSuppressionSw; +using aidl::android::hardware::audio::effect::getEffectTypeUuidNoiseSuppression; using aidl::android::hardware::audio::effect::IEffect; -using aidl::android::hardware::audio::effect::kNoiseSuppressionSwImplUUID; using aidl::android::hardware::audio::effect::NoiseSuppressionSw; using aidl::android::media::audio::common::AudioUuid; extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, std::shared_ptr* instanceSpp) { - if (!in_impl_uuid || *in_impl_uuid != kNoiseSuppressionSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidNoiseSuppressionSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -47,7 +50,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, } extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) { - if (!in_impl_uuid || *in_impl_uuid != kNoiseSuppressionSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidNoiseSuppressionSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -59,8 +62,8 @@ namespace aidl::android::hardware::audio::effect { const std::string NoiseSuppressionSw::kEffectName = "NoiseSuppressionSw"; const Descriptor NoiseSuppressionSw::kDescriptor = { - .common = {.id = {.type = kNoiseSuppressionTypeUUID, - .uuid = kNoiseSuppressionSwImplUUID, + .common = {.id = {.type = getEffectTypeUuidNoiseSuppression(), + .uuid = getEffectImplUuidNoiseSuppressionSw(), .proxy = std::nullopt}, .flags = {.type = Flags::Type::INSERT, .insert = Flags::Insert::FIRST, diff --git a/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.h b/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.h index 22bf0666c0..fc1e028808 100644 --- a/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.h +++ b/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.h @@ -16,13 +16,13 @@ #pragma once -#include -#include #include #include +#include +#include + #include "effect-impl/EffectImpl.h" -#include "effect-impl/EffectUUID.h" namespace aidl::android::hardware::audio::effect { diff --git a/audio/aidl/default/presetReverb/PresetReverbSw.cpp b/audio/aidl/default/presetReverb/PresetReverbSw.cpp index 14546a4a9e..3f02eb7382 100644 --- a/audio/aidl/default/presetReverb/PresetReverbSw.cpp +++ b/audio/aidl/default/presetReverb/PresetReverbSw.cpp @@ -21,19 +21,21 @@ #include #include #include +#include #include "PresetReverbSw.h" using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectImplUuidPresetReverbSw; +using aidl::android::hardware::audio::effect::getEffectTypeUuidPresetReverb; using aidl::android::hardware::audio::effect::IEffect; -using aidl::android::hardware::audio::effect::kPresetReverbSwImplUUID; using aidl::android::hardware::audio::effect::PresetReverbSw; using aidl::android::hardware::audio::effect::State; using aidl::android::media::audio::common::AudioUuid; extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, std::shared_ptr* instanceSpp) { - if (!in_impl_uuid || *in_impl_uuid != kPresetReverbSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidPresetReverbSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -48,7 +50,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, } extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) { - if (!in_impl_uuid || *in_impl_uuid != kPresetReverbSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidPresetReverbSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -72,8 +74,8 @@ const Capability PresetReverbSw::kCapability = { .range = Range::make(PresetReverbSw::kRanges)}; const Descriptor PresetReverbSw::kDescriptor = { - .common = {.id = {.type = kPresetReverbTypeUUID, - .uuid = kPresetReverbSwImplUUID, + .common = {.id = {.type = getEffectTypeUuidPresetReverb(), + .uuid = getEffectImplUuidPresetReverbSw(), .proxy = std::nullopt}, .flags = {.type = Flags::Type::INSERT, .insert = Flags::Insert::FIRST, diff --git a/audio/aidl/default/presetReverb/PresetReverbSw.h b/audio/aidl/default/presetReverb/PresetReverbSw.h index 5061475630..9ceee7cca9 100644 --- a/audio/aidl/default/presetReverb/PresetReverbSw.h +++ b/audio/aidl/default/presetReverb/PresetReverbSw.h @@ -22,7 +22,6 @@ #include #include "effect-impl/EffectImpl.h" -#include "effect-impl/EffectUUID.h" namespace aidl::android::hardware::audio::effect { diff --git a/audio/aidl/default/virtualizer/VirtualizerSw.cpp b/audio/aidl/default/virtualizer/VirtualizerSw.cpp index c5a0e8d335..e34464f460 100644 --- a/audio/aidl/default/virtualizer/VirtualizerSw.cpp +++ b/audio/aidl/default/virtualizer/VirtualizerSw.cpp @@ -21,12 +21,14 @@ #include #include #include +#include #include "VirtualizerSw.h" using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectImplUuidVirtualizerSw; +using aidl::android::hardware::audio::effect::getEffectTypeUuidVirtualizer; using aidl::android::hardware::audio::effect::IEffect; -using aidl::android::hardware::audio::effect::kVirtualizerSwImplUUID; using aidl::android::hardware::audio::effect::State; using aidl::android::hardware::audio::effect::VirtualizerSw; using aidl::android::media::audio::common::AudioChannelLayout; @@ -36,7 +38,7 @@ using aidl::android::media::audio::common::AudioUuid; extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, std::shared_ptr* instanceSpp) { - if (!in_impl_uuid || *in_impl_uuid != kVirtualizerSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidVirtualizerSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -51,7 +53,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, } extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) { - if (!in_impl_uuid || *in_impl_uuid != kVirtualizerSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidVirtualizerSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -73,9 +75,9 @@ const Capability VirtualizerSw::kCapability = { .range = Range::make(VirtualizerSw::kRanges)}; const Descriptor VirtualizerSw::kDescriptor = { - .common = {.id = {.type = kVirtualizerTypeUUID, - .uuid = kVirtualizerSwImplUUID, - .proxy = kVirtualizerProxyUUID}, + .common = {.id = {.type = getEffectTypeUuidVirtualizer(), + .uuid = getEffectImplUuidVirtualizerSw(), + .proxy = getEffectImplUuidVirtualizerProxy()}, .flags = {.type = Flags::Type::INSERT, .insert = Flags::Insert::FIRST, .volume = Flags::Volume::CTRL}, diff --git a/audio/aidl/default/virtualizer/VirtualizerSw.h b/audio/aidl/default/virtualizer/VirtualizerSw.h index 5c5b616742..5e114d9abd 100644 --- a/audio/aidl/default/virtualizer/VirtualizerSw.h +++ b/audio/aidl/default/virtualizer/VirtualizerSw.h @@ -22,7 +22,6 @@ #include #include "effect-impl/EffectImpl.h" -#include "effect-impl/EffectUUID.h" namespace aidl::android::hardware::audio::effect { diff --git a/audio/aidl/default/visualizer/VisualizerSw.cpp b/audio/aidl/default/visualizer/VisualizerSw.cpp index deb3204a06..0909f25144 100644 --- a/audio/aidl/default/visualizer/VisualizerSw.cpp +++ b/audio/aidl/default/visualizer/VisualizerSw.cpp @@ -17,19 +17,21 @@ #define LOG_TAG "AHAL_VisualizerSw" #include +#include #include "VisualizerSw.h" using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectImplUuidVisualizerSw; +using aidl::android::hardware::audio::effect::getEffectTypeUuidVisualizer; using aidl::android::hardware::audio::effect::IEffect; -using aidl::android::hardware::audio::effect::kVisualizerSwImplUUID; using aidl::android::hardware::audio::effect::State; using aidl::android::hardware::audio::effect::VisualizerSw; using aidl::android::media::audio::common::AudioUuid; extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, std::shared_ptr* instanceSpp) { - if (!in_impl_uuid || *in_impl_uuid != kVisualizerSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidVisualizerSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -44,7 +46,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, } extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) { - if (!in_impl_uuid || *in_impl_uuid != kVisualizerSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidVisualizerSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -66,8 +68,8 @@ const Capability VisualizerSw::kCapability = { .range = Range::make(VisualizerSw::kRanges)}; const Descriptor VisualizerSw::kDescriptor = { - .common = {.id = {.type = kVisualizerTypeUUID, - .uuid = kVisualizerSwImplUUID, + .common = {.id = {.type = getEffectTypeUuidVisualizer(), + .uuid = getEffectImplUuidVisualizerSw(), .proxy = std::nullopt}, .flags = {.type = Flags::Type::INSERT, .insert = Flags::Insert::FIRST, diff --git a/audio/aidl/default/visualizer/VisualizerSw.h b/audio/aidl/default/visualizer/VisualizerSw.h index ee7276a319..995774e197 100644 --- a/audio/aidl/default/visualizer/VisualizerSw.h +++ b/audio/aidl/default/visualizer/VisualizerSw.h @@ -16,11 +16,10 @@ #pragma once -#include #include +#include #include "effect-impl/EffectImpl.h" -#include "effect-impl/EffectUUID.h" namespace aidl::android::hardware::audio::effect { diff --git a/audio/aidl/default/volume/VolumeSw.cpp b/audio/aidl/default/volume/VolumeSw.cpp index 44cac446ba..890258457f 100644 --- a/audio/aidl/default/volume/VolumeSw.cpp +++ b/audio/aidl/default/volume/VolumeSw.cpp @@ -20,19 +20,21 @@ #define LOG_TAG "AHAL_VolumeSw" #include #include +#include #include "VolumeSw.h" using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectImplUuidVolumeSw; +using aidl::android::hardware::audio::effect::getEffectTypeUuidVolume; using aidl::android::hardware::audio::effect::IEffect; -using aidl::android::hardware::audio::effect::kVolumeSwImplUUID; using aidl::android::hardware::audio::effect::State; using aidl::android::hardware::audio::effect::VolumeSw; using aidl::android::media::audio::common::AudioUuid; extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, std::shared_ptr* instanceSpp) { - if (!in_impl_uuid || *in_impl_uuid != kVolumeSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidVolumeSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -47,7 +49,7 @@ extern "C" binder_exception_t createEffect(const AudioUuid* in_impl_uuid, } extern "C" binder_exception_t queryEffect(const AudioUuid* in_impl_uuid, Descriptor* _aidl_return) { - if (!in_impl_uuid || *in_impl_uuid != kVolumeSwImplUUID) { + if (!in_impl_uuid || *in_impl_uuid != getEffectImplUuidVolumeSw()) { LOG(ERROR) << __func__ << "uuid not supported"; return EX_ILLEGAL_ARGUMENT; } @@ -64,8 +66,8 @@ const std::vector VolumeSw::kRanges = {MAKE_RANGE(Volume, le const Capability VolumeSw::kCapability = {.range = Range::make(VolumeSw::kRanges)}; const Descriptor VolumeSw::kDescriptor = { - .common = {.id = {.type = kVolumeTypeUUID, - .uuid = kVolumeSwImplUUID, + .common = {.id = {.type = getEffectTypeUuidVolume(), + .uuid = getEffectImplUuidVolumeSw(), .proxy = std::nullopt}, .flags = {.type = Flags::Type::INSERT, .insert = Flags::Insert::FIRST, diff --git a/audio/aidl/default/volume/VolumeSw.h b/audio/aidl/default/volume/VolumeSw.h index 2dd4324bad..1432b2be0d 100644 --- a/audio/aidl/default/volume/VolumeSw.h +++ b/audio/aidl/default/volume/VolumeSw.h @@ -22,7 +22,6 @@ #include #include "effect-impl/EffectImpl.h" -#include "effect-impl/EffectUUID.h" namespace aidl::android::hardware::audio::effect { diff --git a/audio/aidl/vts/Android.bp b/audio/aidl/vts/Android.bp index 8db8eaf9aa..18aa6f0a51 100644 --- a/audio/aidl/vts/Android.bp +++ b/audio/aidl/vts/Android.bp @@ -37,6 +37,7 @@ cc_defaults { "general-tests", "vts", ], + srcs: [":effectCommonFile"], } cc_test { diff --git a/audio/aidl/vts/EffectFactoryHelper.h b/audio/aidl/vts/EffectFactoryHelper.h index 4add844533..a2499fd3c1 100644 --- a/audio/aidl/vts/EffectFactoryHelper.h +++ b/audio/aidl/vts/EffectFactoryHelper.h @@ -24,7 +24,6 @@ #include #include "TestUtils.h" -#include "effect-impl/EffectUUID.h" using namespace android; diff --git a/audio/aidl/vts/EffectHelper.h b/audio/aidl/vts/EffectHelper.h index a128f7c050..f6683cc5b1 100644 --- a/audio/aidl/vts/EffectHelper.h +++ b/audio/aidl/vts/EffectHelper.h @@ -31,6 +31,7 @@ #include #include #include +#include #include "AudioHalBinderServiceUtil.h" #include "EffectFactoryHelper.h" diff --git a/audio/aidl/vts/VtsHalAECTargetTest.cpp b/audio/aidl/vts/VtsHalAECTargetTest.cpp index 2d36cbb181..8828c41bbe 100644 --- a/audio/aidl/vts/VtsHalAECTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAECTargetTest.cpp @@ -29,9 +29,9 @@ using namespace android; using aidl::android::hardware::audio::effect::AcousticEchoCanceler; using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectTypeUuidAcousticEchoCanceler; using aidl::android::hardware::audio::effect::IEffect; using aidl::android::hardware::audio::effect::IFactory; -using aidl::android::hardware::audio::effect::kAcousticEchoCancelerTypeUUID; using aidl::android::hardware::audio::effect::Parameter; using aidl::android::hardware::audio::effect::Range; @@ -148,7 +148,8 @@ INSTANTIATE_TEST_SUITE_P( AECParamTest, AECParamTest, ::testing::Combine( testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kAcousticEchoCancelerTypeUUID)), + IFactory::descriptor, + getEffectTypeUuidAcousticEchoCanceler())), testing::ValuesIn(EffectHelper::getTestValueSet( diff --git a/audio/aidl/vts/VtsHalAGC1TargetTest.cpp b/audio/aidl/vts/VtsHalAGC1TargetTest.cpp index 15a9374352..edfcdf6fce 100644 --- a/audio/aidl/vts/VtsHalAGC1TargetTest.cpp +++ b/audio/aidl/vts/VtsHalAGC1TargetTest.cpp @@ -24,9 +24,9 @@ using namespace android; using aidl::android::hardware::audio::effect::AutomaticGainControlV1; using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectTypeUuidAutomaticGainControlV1; using aidl::android::hardware::audio::effect::IEffect; using aidl::android::hardware::audio::effect::IFactory; -using aidl::android::hardware::audio::effect::kAutomaticGainControlV1TypeUUID; using aidl::android::hardware::audio::effect::Parameter; enum ParamName { @@ -158,7 +158,8 @@ INSTANTIATE_TEST_SUITE_P( AGC1ParamTest, AGC1ParamTest, ::testing::Combine( testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kAutomaticGainControlV1TypeUUID)), + IFactory::descriptor, + getEffectTypeUuidAutomaticGainControlV1())), testing::ValuesIn(EffectHelper::getTestValueSet< AutomaticGainControlV1, int, Range::automaticGainControlV1, AutomaticGainControlV1::targetPeakLevelDbFs>( diff --git a/audio/aidl/vts/VtsHalAGC2TargetTest.cpp b/audio/aidl/vts/VtsHalAGC2TargetTest.cpp index 140537e67e..8ba8e45566 100644 --- a/audio/aidl/vts/VtsHalAGC2TargetTest.cpp +++ b/audio/aidl/vts/VtsHalAGC2TargetTest.cpp @@ -25,9 +25,9 @@ using namespace android; using aidl::android::hardware::audio::effect::AutomaticGainControlV2; using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectTypeUuidAutomaticGainControlV2; using aidl::android::hardware::audio::effect::IEffect; using aidl::android::hardware::audio::effect::IFactory; -using aidl::android::hardware::audio::effect::kAutomaticGainControlV2TypeUUID; using aidl::android::hardware::audio::effect::Parameter; enum ParamName { @@ -164,7 +164,8 @@ INSTANTIATE_TEST_SUITE_P( AGC2ParamTest, AGC2ParamTest, ::testing::Combine( testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kAutomaticGainControlV2TypeUUID)), + IFactory::descriptor, + getEffectTypeUuidAutomaticGainControlV2())), testing::ValuesIn(EffectHelper::getTestValueSet< AutomaticGainControlV2, int, Range::automaticGainControlV2, AutomaticGainControlV2::fixedDigitalGainMb>( diff --git a/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp index 21f5eb5636..7b9477dfa8 100644 --- a/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -38,10 +39,10 @@ using namespace android; using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectUuidNull; +using aidl::android::hardware::audio::effect::getEffectUuidZero; using aidl::android::hardware::audio::effect::IEffect; using aidl::android::hardware::audio::effect::IFactory; -using aidl::android::hardware::audio::effect::kEffectNullUuid; -using aidl::android::hardware::audio::effect::kEffectZeroUuid; using aidl::android::hardware::audio::effect::Processing; using aidl::android::media::audio::common::AudioSource; using aidl::android::media::audio::common::AudioStreamType; @@ -65,8 +66,8 @@ class EffectFactoryTest : public testing::TestWithParam { std::unique_ptr mFactoryHelper; std::shared_ptr mEffectFactory; std::vector> mEffects; - const Descriptor::Identity kNullId = {.uuid = kEffectNullUuid}; - const Descriptor::Identity kZeroId = {.uuid = kEffectZeroUuid}; + const Descriptor::Identity kNullId = {.uuid = getEffectUuidNull()}; + const Descriptor::Identity kZeroId = {.uuid = getEffectUuidZero()}; const Descriptor kNullDesc = {.common.id = kNullId}; const Descriptor kZeroDesc = {.common.id = kZeroId}; @@ -132,13 +133,13 @@ TEST_P(EffectFactoryTest, CanBeRestarted) { TEST_P(EffectFactoryTest, ExpectAllAospEffectTypes) { std::vector descs; std::set typeUuidSet( - {aidl::android::hardware::audio::effect::kBassBoostTypeUUID, - aidl::android::hardware::audio::effect::kEqualizerTypeUUID, - aidl::android::hardware::audio::effect::kEnvReverbTypeUUID, - aidl::android::hardware::audio::effect::kPresetReverbTypeUUID, - aidl::android::hardware::audio::effect::kDynamicsProcessingTypeUUID, - aidl::android::hardware::audio::effect::kHapticGeneratorTypeUUID, - aidl::android::hardware::audio::effect::kVirtualizerTypeUUID}); + {aidl::android::hardware::audio::effect::getEffectTypeUuidBassBoost(), + aidl::android::hardware::audio::effect::getEffectTypeUuidEqualizer(), + aidl::android::hardware::audio::effect::getEffectTypeUuidEnvReverb(), + aidl::android::hardware::audio::effect::getEffectTypeUuidPresetReverb(), + aidl::android::hardware::audio::effect::getEffectTypeUuidDynamicsProcessing(), + aidl::android::hardware::audio::effect::getEffectTypeUuidHapticGenerator(), + aidl::android::hardware::audio::effect::getEffectTypeUuidVirtualizer()}); EXPECT_IS_OK(mEffectFactory->queryEffects(std::nullopt, std::nullopt, std::nullopt, &descs)); EXPECT_TRUE(descs.size() >= typeUuidSet.size()); @@ -155,19 +156,22 @@ TEST_P(EffectFactoryTest, ExpectAllAospEffectTypes) { TEST_P(EffectFactoryTest, QueryNullTypeUuid) { std::vector descs; - EXPECT_IS_OK(mEffectFactory->queryEffects(kEffectNullUuid, std::nullopt, std::nullopt, &descs)); + EXPECT_IS_OK( + mEffectFactory->queryEffects(getEffectUuidNull(), std::nullopt, std::nullopt, &descs)); EXPECT_EQ(descs.size(), 0UL); } TEST_P(EffectFactoryTest, QueriedNullImplUuid) { std::vector descs; - EXPECT_IS_OK(mEffectFactory->queryEffects(std::nullopt, kEffectNullUuid, std::nullopt, &descs)); + EXPECT_IS_OK( + mEffectFactory->queryEffects(std::nullopt, getEffectUuidNull(), std::nullopt, &descs)); EXPECT_EQ(descs.size(), 0UL); } TEST_P(EffectFactoryTest, QueriedNullProxyUuid) { std::vector descs; - EXPECT_IS_OK(mEffectFactory->queryEffects(std::nullopt, std::nullopt, kEffectNullUuid, &descs)); + EXPECT_IS_OK( + mEffectFactory->queryEffects(std::nullopt, std::nullopt, getEffectUuidNull(), &descs)); EXPECT_EQ(descs.size(), 0UL); } diff --git a/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp b/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp index 824bd9f2de..9cfdc50a2c 100644 --- a/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp +++ b/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp @@ -27,9 +27,9 @@ using namespace android; using aidl::android::hardware::audio::effect::BassBoost; using aidl::android::hardware::audio::effect::Capability; using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectTypeUuidBassBoost; using aidl::android::hardware::audio::effect::IEffect; using aidl::android::hardware::audio::effect::IFactory; -using aidl::android::hardware::audio::effect::kBassBoostTypeUUID; using aidl::android::hardware::audio::effect::Parameter; using aidl::android::hardware::audio::effect::Range; @@ -138,7 +138,7 @@ INSTANTIATE_TEST_SUITE_P( BassBoostTest, BassBoostParamTest, ::testing::Combine( testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kBassBoostTypeUUID)), + IFactory::descriptor, getEffectTypeUuidBassBoost())), testing::ValuesIn(EffectHelper::getTestValueSet( kDescPair, EffectHelper::expandTestValueBasic))), diff --git a/audio/aidl/vts/VtsHalDownmixTargetTest.cpp b/audio/aidl/vts/VtsHalDownmixTargetTest.cpp index bd3b76bba3..5aeebde1a0 100644 --- a/audio/aidl/vts/VtsHalDownmixTargetTest.cpp +++ b/audio/aidl/vts/VtsHalDownmixTargetTest.cpp @@ -24,10 +24,9 @@ using namespace android; using aidl::android::hardware::audio::effect::Descriptor; using aidl::android::hardware::audio::effect::Downmix; +using aidl::android::hardware::audio::effect::getEffectTypeUuidDownmix; using aidl::android::hardware::audio::effect::IEffect; using aidl::android::hardware::audio::effect::IFactory; -using aidl::android::hardware::audio::effect::kDownmixTypeUUID; -using aidl::android::hardware::audio::effect::kEffectNullUuid; using aidl::android::hardware::audio::effect::Parameter; /** @@ -122,7 +121,7 @@ TEST_P(DownmixParamTest, SetAndGetType) { INSTANTIATE_TEST_SUITE_P( DownmixTest, DownmixParamTest, ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kDownmixTypeUUID)), + IFactory::descriptor, getEffectTypeUuidDownmix())), testing::ValuesIn(kTypeValues)), [](const testing::TestParamInfo& info) { auto descriptor = std::get(info.param).second; diff --git a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp index 0b05b17e61..c62a24ea62 100644 --- a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp +++ b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp @@ -30,9 +30,9 @@ using namespace android; using aidl::android::hardware::audio::effect::Descriptor; using aidl::android::hardware::audio::effect::DynamicsProcessing; +using aidl::android::hardware::audio::effect::getEffectTypeUuidDynamicsProcessing; using aidl::android::hardware::audio::effect::IEffect; using aidl::android::hardware::audio::effect::IFactory; -using aidl::android::hardware::audio::effect::kDynamicsProcessingTypeUUID; using aidl::android::hardware::audio::effect::Parameter; /** @@ -428,7 +428,7 @@ INSTANTIATE_TEST_SUITE_P( DynamicsProcessingTest, DynamicsProcessingTestEngineArchitecture, ::testing::Combine( testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kDynamicsProcessingTypeUUID)), + IFactory::descriptor, getEffectTypeUuidDynamicsProcessing())), testing::Values(DynamicsProcessing::ResolutionPreference::FAVOR_TIME_RESOLUTION, DynamicsProcessing::ResolutionPreference:: FAVOR_FREQUENCY_RESOLUTION), // variant @@ -480,7 +480,7 @@ TEST_P(DynamicsProcessingTestInputGain, SetAndGetInputGain) { INSTANTIATE_TEST_SUITE_P( DynamicsProcessingTest, DynamicsProcessingTestInputGain, ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kDynamicsProcessingTypeUUID)), + IFactory::descriptor, getEffectTypeUuidDynamicsProcessing())), testing::ValuesIn(DynamicsProcessingTestInputGain::kInputGainTestSet)), [](const auto& info) { auto descriptor = std::get(info.param).second; @@ -567,7 +567,7 @@ TEST_P(DynamicsProcessingTestLimiterConfig, SetAndGetLimiterConfig) { INSTANTIATE_TEST_SUITE_P( DynamicsProcessingTest, DynamicsProcessingTestLimiterConfig, ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kDynamicsProcessingTypeUUID)), + IFactory::descriptor, getEffectTypeUuidDynamicsProcessing())), testing::Values(-1, 0, 1, 2), // channel count testing::Bool(), // enable testing::Values(3), // link group @@ -642,7 +642,7 @@ INSTANTIATE_TEST_SUITE_P( DynamicsProcessingTest, DynamicsProcessingTestChannelConfig, ::testing::Combine( testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kDynamicsProcessingTypeUUID)), + IFactory::descriptor, getEffectTypeUuidDynamicsProcessing())), testing::ValuesIn( DynamicsProcessingTestHelper::kChannelConfigTestSet), // channel config testing::Bool()), // Engine inUse @@ -778,7 +778,7 @@ INSTANTIATE_TEST_SUITE_P( DynamicsProcessingTest, DynamicsProcessingTestEqBandConfig, ::testing::Combine( testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kDynamicsProcessingTypeUUID)), + IFactory::descriptor, getEffectTypeUuidDynamicsProcessing())), testing::Values(-1, 0, 10), // channel ID testing::ValuesIn( DynamicsProcessingTestHelper::kChannelConfigTestSet), // channel enable @@ -900,7 +900,7 @@ INSTANTIATE_TEST_SUITE_P( DynamicsProcessingTest, DynamicsProcessingTestMbcBandConfig, ::testing::Combine( testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kDynamicsProcessingTypeUUID)), + IFactory::descriptor, getEffectTypeUuidDynamicsProcessing())), testing::Values(-1, 0, 10), // channel count testing::ValuesIn( DynamicsProcessingTestHelper::kChannelConfigTestSet), // channel config diff --git a/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp b/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp index a2deb7ca7c..05c2c5b5e6 100644 --- a/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp +++ b/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp @@ -24,9 +24,9 @@ using namespace android; using aidl::android::hardware::audio::effect::Descriptor; using aidl::android::hardware::audio::effect::EnvironmentalReverb; +using aidl::android::hardware::audio::effect::getEffectTypeUuidEnvReverb; using aidl::android::hardware::audio::effect::IEffect; using aidl::android::hardware::audio::effect::IFactory; -using aidl::android::hardware::audio::effect::kEnvReverbTypeUUID; using aidl::android::hardware::audio::effect::Parameter; /** @@ -200,7 +200,7 @@ INSTANTIATE_TEST_SUITE_P( EnvironmentalReverbTest, EnvironmentalReverbRoomLevelTest, ::testing::Combine( testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kEnvReverbTypeUUID)), + IFactory::descriptor, getEffectTypeUuidEnvReverb())), testing::ValuesIn(EffectHelper::getTestValueSet( @@ -239,13 +239,12 @@ TEST_P(EnvironmentalReverbRoomHfLevelTest, SetAndGetRoomHfLevel) { INSTANTIATE_TEST_SUITE_P( EnvironmentalReverbTest, EnvironmentalReverbRoomHfLevelTest, - ::testing::Combine( - testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor, - kEnvReverbTypeUUID)), - testing::ValuesIn(EffectHelper::getTestValueSet( - kDescPair, EffectHelper::expandTestValueBasic))), + ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( + IFactory::descriptor, getEffectTypeUuidEnvReverb())), + testing::ValuesIn(EffectHelper::getTestValueSet< + EnvironmentalReverb, int, Range::environmentalReverb, + EnvironmentalReverb::roomHfLevelMb>( + kDescPair, EffectHelper::expandTestValueBasic))), [](const testing::TestParamInfo& info) { auto descriptor = std::get<0>(info.param).second; std::string roomHfLevel = std::to_string(std::get<1>(info.param)); @@ -280,13 +279,12 @@ TEST_P(EnvironmentalReverbDecayTimeTest, SetAndGetDecayTime) { INSTANTIATE_TEST_SUITE_P( EnvironmentalReverbTest, EnvironmentalReverbDecayTimeTest, - ::testing::Combine( - testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor, - kEnvReverbTypeUUID)), - testing::ValuesIn(EffectHelper::getTestValueSet( - kDescPair, EffectHelper::expandTestValueBasic))), + ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( + IFactory::descriptor, getEffectTypeUuidEnvReverb())), + testing::ValuesIn(EffectHelper::getTestValueSet< + EnvironmentalReverb, int, Range::environmentalReverb, + EnvironmentalReverb::decayTimeMs>( + kDescPair, EffectHelper::expandTestValueBasic))), [](const testing::TestParamInfo& info) { auto descriptor = std::get<0>(info.param).second; std::string decayTime = std::to_string(std::get<1>(info.param)); @@ -322,7 +320,7 @@ TEST_P(EnvironmentalReverbDecayHfRatioTest, SetAndGetDecayHfRatio) { INSTANTIATE_TEST_SUITE_P( EnvironmentalReverbTest, EnvironmentalReverbDecayHfRatioTest, ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kEnvReverbTypeUUID)), + IFactory::descriptor, getEffectTypeUuidEnvReverb())), testing::ValuesIn(EffectHelper::getTestValueSet< EnvironmentalReverb, int, Range::environmentalReverb, EnvironmentalReverb::decayHfRatioPm>( @@ -362,13 +360,12 @@ TEST_P(EnvironmentalReverbLevelTest, SetAndGetLevel) { INSTANTIATE_TEST_SUITE_P( EnvironmentalReverbTest, EnvironmentalReverbLevelTest, - ::testing::Combine( - testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor, - kEnvReverbTypeUUID)), - testing::ValuesIn(EffectHelper::getTestValueSet( - kDescPair, EffectHelper::expandTestValueBasic))), + ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( + IFactory::descriptor, getEffectTypeUuidEnvReverb())), + testing::ValuesIn(EffectHelper::getTestValueSet< + EnvironmentalReverb, int, Range::environmentalReverb, + EnvironmentalReverb::levelMb>( + kDescPair, EffectHelper::expandTestValueBasic))), [](const testing::TestParamInfo& info) { auto descriptor = std::get<0>(info.param).second; std::string level = std::to_string(std::get<1>(info.param)); @@ -403,13 +400,12 @@ TEST_P(EnvironmentalReverbDelayTest, SetAndGetDelay) { INSTANTIATE_TEST_SUITE_P( EnvironmentalReverbTest, EnvironmentalReverbDelayTest, - ::testing::Combine( - testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor, - kEnvReverbTypeUUID)), - testing::ValuesIn(EffectHelper::getTestValueSet( - kDescPair, EffectHelper::expandTestValueBasic))), + ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( + IFactory::descriptor, getEffectTypeUuidEnvReverb())), + testing::ValuesIn(EffectHelper::getTestValueSet< + EnvironmentalReverb, int, Range::environmentalReverb, + EnvironmentalReverb::delayMs>( + kDescPair, EffectHelper::expandTestValueBasic))), [](const testing::TestParamInfo& info) { auto descriptor = std::get<0>(info.param).second; std::string delay = std::to_string(std::get<1>(info.param)); @@ -444,13 +440,12 @@ TEST_P(EnvironmentalReverbDiffusionTest, SetAndGetDiffusion) { INSTANTIATE_TEST_SUITE_P( EnvironmentalReverbTest, EnvironmentalReverbDiffusionTest, - ::testing::Combine( - testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor, - kEnvReverbTypeUUID)), - testing::ValuesIn(EffectHelper::getTestValueSet( - kDescPair, EffectHelper::expandTestValueBasic))), + ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( + IFactory::descriptor, getEffectTypeUuidEnvReverb())), + testing::ValuesIn(EffectHelper::getTestValueSet< + EnvironmentalReverb, int, Range::environmentalReverb, + EnvironmentalReverb::diffusionPm>( + kDescPair, EffectHelper::expandTestValueBasic))), [](const testing::TestParamInfo& info) { auto descriptor = std::get<0>(info.param).second; std::string diffusion = std::to_string(std::get<1>(info.param)); @@ -485,13 +480,12 @@ TEST_P(EnvironmentalReverbDensityTest, SetAndGetDensity) { INSTANTIATE_TEST_SUITE_P( EnvironmentalReverbTest, EnvironmentalReverbDensityTest, - ::testing::Combine( - testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor, - kEnvReverbTypeUUID)), - testing::ValuesIn(EffectHelper::getTestValueSet( - kDescPair, EffectHelper::expandTestValueBasic))), + ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( + IFactory::descriptor, getEffectTypeUuidEnvReverb())), + testing::ValuesIn(EffectHelper::getTestValueSet< + EnvironmentalReverb, int, Range::environmentalReverb, + EnvironmentalReverb::densityPm>( + kDescPair, EffectHelper::expandTestValueBasic))), [](const testing::TestParamInfo& info) { auto descriptor = std::get<0>(info.param).second; std::string density = std::to_string(std::get<1>(info.param)); @@ -527,7 +521,7 @@ TEST_P(EnvironmentalReverbBypassTest, SetAndGetBypass) { INSTANTIATE_TEST_SUITE_P( EnvironmentalReverbTest, EnvironmentalReverbBypassTest, ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kEnvReverbTypeUUID)), + IFactory::descriptor, getEffectTypeUuidEnvReverb())), testing::Bool()), [](const testing::TestParamInfo& info) { auto descriptor = std::get<0>(info.param).second; diff --git a/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp b/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp index 9beb0a7210..716a2c67b5 100644 --- a/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp +++ b/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp @@ -37,15 +37,14 @@ #include "AudioHalBinderServiceUtil.h" #include "EffectHelper.h" #include "TestUtils.h" -#include "effect-impl/EffectUUID.h" using namespace android; using aidl::android::hardware::audio::effect::Descriptor; using aidl::android::hardware::audio::effect::Equalizer; +using aidl::android::hardware::audio::effect::getEffectTypeUuidEqualizer; using aidl::android::hardware::audio::effect::IEffect; using aidl::android::hardware::audio::effect::IFactory; -using aidl::android::hardware::audio::effect::kEqualizerTypeUUID; using aidl::android::hardware::audio::effect::Parameter; /** @@ -195,7 +194,7 @@ INSTANTIATE_TEST_SUITE_P( EqualizerTest, EqualizerTest, ::testing::Combine( testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kEqualizerTypeUUID)), + IFactory::descriptor, getEffectTypeUuidEqualizer())), testing::ValuesIn(EffectHelper::getTestValueSet( kDescPair, EffectHelper::expandTestValueBasic)), diff --git a/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp b/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp index 32ebc4f11c..7c79d1bfab 100644 --- a/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp +++ b/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp @@ -28,10 +28,10 @@ using namespace android; using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectTypeUuidHapticGenerator; using aidl::android::hardware::audio::effect::HapticGenerator; using aidl::android::hardware::audio::effect::IEffect; using aidl::android::hardware::audio::effect::IFactory; -using aidl::android::hardware::audio::effect::kHapticGeneratorTypeUUID; using aidl::android::hardware::audio::effect::Parameter; /** @@ -179,7 +179,7 @@ TEST_P(HapticGeneratorParamTest, SetAndGetVibratorInformation) { INSTANTIATE_TEST_SUITE_P( HapticGeneratorValidTest, HapticGeneratorParamTest, ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kHapticGeneratorTypeUUID)), + IFactory::descriptor, getEffectTypeUuidHapticGenerator())), testing::ValuesIn(kHapticScaleIdValues), testing::ValuesIn(kVibratorScaleValues), testing::ValuesIn(kResonantFrequencyValues), @@ -209,7 +209,7 @@ INSTANTIATE_TEST_SUITE_P( INSTANTIATE_TEST_SUITE_P( HapticGeneratorInvalidTest, HapticGeneratorParamTest, ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kHapticGeneratorTypeUUID)), + IFactory::descriptor, getEffectTypeUuidHapticGenerator())), testing::Values(MIN_ID - 1), testing::Values(HapticGenerator::VibratorScale::NONE), testing::Values(MIN_FLOAT), testing::Values(MIN_FLOAT), @@ -419,7 +419,7 @@ TEST_P(HapticGeneratorScalesTest, SetMultipleVectorRepeat) { INSTANTIATE_TEST_SUITE_P( HapticGeneratorScalesTest, HapticGeneratorScalesTest, ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kHapticGeneratorTypeUUID))), + IFactory::descriptor, getEffectTypeUuidHapticGenerator()))), [](const testing::TestParamInfo& info) { auto descriptor = std::get(info.param).second; std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + diff --git a/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp b/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp index 5faf7f41e6..96b048ed18 100644 --- a/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp +++ b/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp @@ -25,9 +25,9 @@ using namespace android; using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectTypeUuidLoudnessEnhancer; using aidl::android::hardware::audio::effect::IEffect; using aidl::android::hardware::audio::effect::IFactory; -using aidl::android::hardware::audio::effect::kLoudnessEnhancerTypeUUID; using aidl::android::hardware::audio::effect::LoudnessEnhancer; using aidl::android::hardware::audio::effect::Parameter; @@ -126,7 +126,7 @@ TEST_P(LoudnessEnhancerParamTest, SetAndGetGainMb) { INSTANTIATE_TEST_SUITE_P( LoudnessEnhancerTest, LoudnessEnhancerParamTest, ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kLoudnessEnhancerTypeUUID)), + IFactory::descriptor, getEffectTypeUuidLoudnessEnhancer())), testing::ValuesIn(kGainMbValues)), [](const testing::TestParamInfo& info) { auto descriptor = std::get(info.param).second; diff --git a/audio/aidl/vts/VtsHalNSTargetTest.cpp b/audio/aidl/vts/VtsHalNSTargetTest.cpp index 4fcda6b242..5525c80894 100644 --- a/audio/aidl/vts/VtsHalNSTargetTest.cpp +++ b/audio/aidl/vts/VtsHalNSTargetTest.cpp @@ -27,9 +27,9 @@ using namespace android; using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectTypeUuidNoiseSuppression; using aidl::android::hardware::audio::effect::IEffect; using aidl::android::hardware::audio::effect::IFactory; -using aidl::android::hardware::audio::effect::kNoiseSuppressionTypeUUID; using aidl::android::hardware::audio::effect::NoiseSuppression; using aidl::android::hardware::audio::effect::Parameter; @@ -146,7 +146,7 @@ TEST_P(NSParamTest, SetAndGetType) { INSTANTIATE_TEST_SUITE_P( NSParamTest, NSParamTest, ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kNoiseSuppressionTypeUUID)), + IFactory::descriptor, getEffectTypeUuidNoiseSuppression())), testing::ValuesIn(NSParamTest::getLevelValues()), testing::ValuesIn(NSParamTest::getTypeValues())), [](const testing::TestParamInfo& info) { diff --git a/audio/aidl/vts/VtsHalPresetReverbTargetTest.cpp b/audio/aidl/vts/VtsHalPresetReverbTargetTest.cpp index 7bce9c36ff..8fb4ebf339 100644 --- a/audio/aidl/vts/VtsHalPresetReverbTargetTest.cpp +++ b/audio/aidl/vts/VtsHalPresetReverbTargetTest.cpp @@ -24,10 +24,9 @@ using namespace android; using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectTypeUuidPresetReverb; using aidl::android::hardware::audio::effect::IEffect; using aidl::android::hardware::audio::effect::IFactory; -using aidl::android::hardware::audio::effect::kEffectNullUuid; -using aidl::android::hardware::audio::effect::kPresetReverbTypeUUID; using aidl::android::hardware::audio::effect::Parameter; using aidl::android::hardware::audio::effect::PresetReverb; @@ -132,7 +131,7 @@ TEST_P(PresetReverbParamTest, SetAndGetPresets) { INSTANTIATE_TEST_SUITE_P( PresetReverbTest, PresetReverbParamTest, ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kPresetReverbTypeUUID)), + IFactory::descriptor, getEffectTypeUuidPresetReverb())), testing::ValuesIn(kPresetsValues)), [](const testing::TestParamInfo& info) { auto descriptor = std::get(info.param).second; diff --git a/audio/aidl/vts/VtsHalVirtualizerTargetTest.cpp b/audio/aidl/vts/VtsHalVirtualizerTargetTest.cpp index 84b980f6d5..6b1da6388e 100644 --- a/audio/aidl/vts/VtsHalVirtualizerTargetTest.cpp +++ b/audio/aidl/vts/VtsHalVirtualizerTargetTest.cpp @@ -23,9 +23,9 @@ using namespace android; using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectTypeUuidVirtualizer; using aidl::android::hardware::audio::effect::IEffect; using aidl::android::hardware::audio::effect::IFactory; -using aidl::android::hardware::audio::effect::kVirtualizerTypeUUID; using aidl::android::hardware::audio::effect::Parameter; using aidl::android::hardware::audio::effect::Virtualizer; @@ -134,7 +134,7 @@ INSTANTIATE_TEST_SUITE_P( VirtualizerTest, VirtualizerParamTest, ::testing::Combine( testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kVirtualizerTypeUUID)), + IFactory::descriptor, getEffectTypeUuidVirtualizer())), testing::ValuesIn(EffectHelper::getTestValueSet< Virtualizer, int, Range::virtualizer, Virtualizer::strengthPm>( kDescPair, EffectHelper::expandTestValueBasic))), diff --git a/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp b/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp index e273824fbd..f41ba30b12 100644 --- a/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp +++ b/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp @@ -26,9 +26,9 @@ using namespace android; using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectTypeUuidVisualizer; using aidl::android::hardware::audio::effect::IEffect; using aidl::android::hardware::audio::effect::IFactory; -using aidl::android::hardware::audio::effect::kVisualizerTypeUUID; using aidl::android::hardware::audio::effect::Parameter; using aidl::android::hardware::audio::effect::Visualizer; @@ -177,7 +177,7 @@ INSTANTIATE_TEST_SUITE_P( VisualizerParamTest, VisualizerParamTest, ::testing::Combine( testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kVisualizerTypeUUID)), + IFactory::descriptor, getEffectTypeUuidVisualizer())), testing::ValuesIn(EffectHelper::getTestValueSet( kDescPair, EffectHelper::expandTestValueBasic)), diff --git a/audio/aidl/vts/VtsHalVolumeTargetTest.cpp b/audio/aidl/vts/VtsHalVolumeTargetTest.cpp index fbd10a83bf..90b7f37946 100644 --- a/audio/aidl/vts/VtsHalVolumeTargetTest.cpp +++ b/audio/aidl/vts/VtsHalVolumeTargetTest.cpp @@ -23,9 +23,9 @@ using namespace android; using aidl::android::hardware::audio::effect::Descriptor; +using aidl::android::hardware::audio::effect::getEffectTypeUuidVolume; using aidl::android::hardware::audio::effect::IEffect; using aidl::android::hardware::audio::effect::IFactory; -using aidl::android::hardware::audio::effect::kVolumeTypeUUID; using aidl::android::hardware::audio::effect::Parameter; using aidl::android::hardware::audio::effect::Volume; @@ -140,7 +140,7 @@ INSTANTIATE_TEST_SUITE_P( VolumeTest, VolumeParamTest, ::testing::Combine( testing::ValuesIn(kDescPair = EffectFactoryHelper::getAllEffectDescriptors( - IFactory::descriptor, kVolumeTypeUUID)), + IFactory::descriptor, getEffectTypeUuidVolume())), testing::ValuesIn( EffectHelper::getTestValueSet( kDescPair, EffectHelper::expandTestValueBasic)), From 17c7110b706eac466fcdc84adc1f4a53d33ec521 Mon Sep 17 00:00:00 2001 From: ramindani Date: Mon, 20 Mar 2023 10:51:14 -0700 Subject: [PATCH 847/998] [VTS] Add interface version check function Use the interface version check function in SetRefreshRateChangedCallbackDebug tests Update the GetOverlaySupport and SkipValidateDeprecatedTest To use the interface vesion function Test: atest VtsHalGraphicsComposer3_TargetTest BUG: 267565265 Change-Id: I3f37f4ff5610f8e9e3dec299ed7c3f0c41a630d7 --- .../VtsHalGraphicsComposer3_TargetTest.cpp | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 746330b148..323554c1e2 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -118,6 +118,12 @@ class GraphicsComposerAidlTest : public ::testing::TestWithParam { [&](const Capability& activeCapability) { return activeCapability == capability; }); } + int getInterfaceVersion() { + const auto& [versionStatus, version] = mComposerClient->getInterfaceVersion(); + EXPECT_TRUE(versionStatus.isOk()); + return version; + } + const VtsDisplay& getPrimaryDisplay() const { return mDisplays[0]; } int64_t getPrimaryDisplayId() const { return getPrimaryDisplay().getDisplayId(); } @@ -874,9 +880,7 @@ TEST_P(GraphicsComposerAidlTest, GetDisplayName) { } TEST_P(GraphicsComposerAidlTest, GetOverlaySupport) { - const auto& [versionStatus, version] = mComposerClient->getInterfaceVersion(); - ASSERT_TRUE(versionStatus.isOk()); - if (version == 1) { + if (getInterfaceVersion() <= 1) { GTEST_SUCCEED() << "Device does not support the new API for overlay support"; return; } @@ -2290,6 +2294,11 @@ TEST_P(GraphicsComposerAidlCommandTest, SetIdleTimerEnabled_Timeout_2) { } TEST_P(GraphicsComposerAidlCommandTest, SetRefreshRateChangedCallbackDebug_Unsupported) { + if (getInterfaceVersion() <= 1) { + GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is " + "not supported on older version of the service"; + return; + } if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) { auto status = mComposerClient->setRefreshRateChangedCallbackDebugEnabled( getPrimaryDisplayId(), /*enabled*/ true); @@ -2306,6 +2315,11 @@ TEST_P(GraphicsComposerAidlCommandTest, SetRefreshRateChangedCallbackDebug_Unsup } TEST_P(GraphicsComposerAidlCommandTest, SetRefreshRateChangedCallbackDebug_Enabled) { + if (getInterfaceVersion() <= 1) { + GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is " + "not supported on older version of the service"; + return; + } if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) { GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is not supported"; return; @@ -2335,6 +2349,11 @@ TEST_P(GraphicsComposerAidlCommandTest, SetRefreshRateChangedCallbackDebug_Enabl TEST_P(GraphicsComposerAidlCommandTest, SetRefreshRateChangedCallbackDebugEnabled_noCallbackWhenIdle) { + if (getInterfaceVersion() <= 1) { + GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is " + "not supported on older version of the service"; + return; + } if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) { GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is not supported"; return; @@ -2392,6 +2411,11 @@ TEST_P(GraphicsComposerAidlCommandTest, TEST_P(GraphicsComposerAidlCommandTest, SetRefreshRateChangedCallbackDebugEnabled_SetActiveConfigWithConstraints) { + if (getInterfaceVersion() <= 1) { + GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is " + "not supported on older version of the service"; + return; + } if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) { GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is not supported"; return; @@ -2514,9 +2538,7 @@ TEST_P(GraphicsComposerAidlCommandTest, MultiThreadedPresent) { * Capability::SKIP_VALIDATE has been deprecated and should not be enabled. */ TEST_P(GraphicsComposerAidlCommandTest, SkipValidateDeprecatedTest) { - const auto& [versionStatus, version] = mComposerClient->getInterfaceVersion(); - ASSERT_TRUE(versionStatus.isOk()); - if (version <= 1) { + if (getInterfaceVersion() <= 1) { GTEST_SUCCEED() << "HAL at version 1 or lower can contain Capability::SKIP_VALIDATE."; return; } From c47e21c398ae8a86c35fc59841541c888837aaf4 Mon Sep 17 00:00:00 2001 From: shrikar Date: Fri, 17 Mar 2023 17:11:49 +0000 Subject: [PATCH 848/998] Added info to docs to answer Q30 from Ford pending questions. Bug: 259309511 Test: manual build Change-Id: Ib843b6ea42772d32768ebc20a47ea7e172abc714 --- .../automotive/vehicle/VehicleProperty.aidl | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index b9ded39982..0f82431089 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -889,6 +889,9 @@ enum VehicleProperty { * Values must be one of VehicleUnit::CELSIUS or VehicleUnit::FAHRENHEIT * Note that internally, all temperatures are represented in floating point Celsius. * + * If updating HVAC_TEMPERATURE_DISPLAY_UNITS affects the values of other *_DISPLAY_UNITS + * properties, then their values must be updated and communicated to the AAOS framework as well. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleUnit @@ -1050,6 +1053,10 @@ enum VehicleProperty { * For example: configArray[0] = METER * configArray[1] = KILOMETER * configArray[2] = MILE + * + * If updating DISTANCE_DISPLAY_UNITS affects the values of other *_DISPLAY_UNITS properties, + * then their values must be updated and communicated to the AAOS framework as well. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleUnit @@ -1066,6 +1073,10 @@ enum VehicleProperty { * Volume units are defined in VehicleUnit. * For example: configArray[0] = LITER * configArray[1] = GALLON + * + * If updating FUEL_VOLUME_DISPLAY_UNITS affects the values of other *_DISPLAY_UNITS properties, + * then their values must be updated and communicated to the AAOS framework as well. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleUnit @@ -1083,6 +1094,10 @@ enum VehicleProperty { * For example: configArray[0] = KILOPASCAL * configArray[1] = PSI * configArray[2] = BAR + * + * If updating TIRE_PRESSURE_DISPLAY_UNITS affects the values of other *_DISPLAY_UNITS + * properties, then their values must be updated and communicated to the AAOS framework as well. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleUnit @@ -1100,6 +1115,10 @@ enum VehicleProperty { * For example: configArray[0] = WATT_HOUR * configArray[1] = AMPERE_HOURS * configArray[2] = KILOWATT_HOUR + * + * If updating EV_BATTERY_DISPLAY_UNITS affects the values of other *_DISPLAY_UNITS properties, + * then their values must be updated and communicated to the AAOS framework as well. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleUnit @@ -1128,6 +1147,10 @@ enum VehicleProperty { * For example: configArray[0] = METER_PER_SEC * configArray[1] = MILES_PER_HOUR * configArray[2] = KILOMETERS_PER_HOUR + * + * If updating VEHICLE_SPEED_DISPLAY_UNITS affects the values of other *_DISPLAY_UNITS + * properties, then their values must be updated and communicated to the AAOS framework as well. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ From 39332b5b973e3a54cfe7afd803a007e127cfbf02 Mon Sep 17 00:00:00 2001 From: shrikar Date: Fri, 17 Mar 2023 17:25:52 +0000 Subject: [PATCH 849/998] Added info to docs to answer Q35 from Ford pending questions. Bug: 259309511 Test: manual build Change-Id: I597b9861852a078282c95244f9360f2cb73f175a --- .../hardware/automotive/vehicle/VehicleHvacFanDirection.aidl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl index fa5d711ef3..f5b77dea10 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl @@ -29,6 +29,9 @@ enum VehicleHvacFanDirection { * FACE_AND_FLOOR = FACE | FLOOR */ FACE_AND_FLOOR = 0x3, + /** + * DEFROST may also be described as the windshield fan direction. + */ DEFROST = 0x4, /** * DEFROST_AND_FLOOR = DEFROST | FLOOR From 2dc47ca9252252cbd0e5d78032274aad33a75bee Mon Sep 17 00:00:00 2001 From: Ye Jiao Date: Mon, 13 Mar 2023 10:58:08 +0800 Subject: [PATCH 850/998] Add config to skip state toggle off/on for Wi-Fi NAN If STA and NAN share the same iface wlan0, Wi-Fi vendor HAL service sends eventDisabled to NAN framework when STA setMacAddress to wlan0. This disables NAN when STA is turned on. Since NAN always uses its own random MAC instead of using MAC of STA, this action is not necessary and gets NAN kicked off for no benefits. We add a build time configuration to optionally disable this behavior. Bug: 273426515 Test: manually test Change-Id: Ifc71b7e8d09eac1b66b9e18c70e0e6d202683ff6 --- wifi/1.6/default/Android.bp | 4 ++++ wifi/1.6/default/wifi_nan_iface.cpp | 2 ++ wifi/aidl/default/Android.bp | 4 ++++ wifi/aidl/default/wifi_nan_iface.cpp | 2 ++ 4 files changed, 12 insertions(+) diff --git a/wifi/1.6/default/Android.bp b/wifi/1.6/default/Android.bp index 0f98e71445..6038e367a4 100644 --- a/wifi/1.6/default/Android.bp +++ b/wifi/1.6/default/Android.bp @@ -26,6 +26,7 @@ soong_config_module_type { "hidl_feature_disable_ap", // WIFI_HIDL_FEATURE_DISABLE_AP "hidl_feature_disable_ap_mac_randomization", // WIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION "avoid_iface_reset_mac_change", // WIFI_AVOID_IFACE_RESET_MAC_CHANGE + "wifi_skip_state_toggle_off_on_for_nan", // WIFI_SKIP_STATE_TOGGLE_OFF_ON_FOR_NAN ], value_variables: [ "hal_interface_combinations", // WIFI_HAL_INTERFACE_COMBINATIONS @@ -53,6 +54,9 @@ wifi_hal_cc_defaults { avoid_iface_reset_mac_change: { cppflags: ["-DWIFI_AVOID_IFACE_RESET_MAC_CHANGE"], }, + wifi_skip_state_toggle_off_on_for_nan: { + cppflags: ["-DWIFI_SKIP_STATE_TOGGLE_OFF_ON_FOR_NAN"], + }, hal_interface_combinations: { cppflags: ["-DWIFI_HAL_INTERFACE_COMBINATIONS=%s"], }, diff --git a/wifi/1.6/default/wifi_nan_iface.cpp b/wifi/1.6/default/wifi_nan_iface.cpp index ac2ebc940e..4c61ba7ee5 100644 --- a/wifi/1.6/default/wifi_nan_iface.cpp +++ b/wifi/1.6/default/wifi_nan_iface.cpp @@ -453,6 +453,7 @@ WifiNanIface::WifiNanIface(const std::string& ifname, bool is_dedicated_iface, // Register for iface state toggle events. iface_util::IfaceEventHandlers event_handlers = {}; +#ifndef WIFI_SKIP_STATE_TOGGLE_OFF_ON_FOR_NAN event_handlers.on_state_toggle_off_on = [weak_ptr_this](const std::string& /* iface_name */) { const auto shared_ptr_this = weak_ptr_this.promote(); if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { @@ -467,6 +468,7 @@ WifiNanIface::WifiNanIface(const std::string& ifname, bool is_dedicated_iface, } } }; +#endif iface_util_.lock()->registerIfaceEventHandlers(ifname_, event_handlers); } diff --git a/wifi/aidl/default/Android.bp b/wifi/aidl/default/Android.bp index 441d461b78..91d609ddc7 100644 --- a/wifi/aidl/default/Android.bp +++ b/wifi/aidl/default/Android.bp @@ -26,6 +26,7 @@ soong_config_module_type { "hidl_feature_disable_ap", // WIFI_HIDL_FEATURE_DISABLE_AP "hidl_feature_disable_ap_mac_randomization", // WIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION "avoid_iface_reset_mac_change", // WIFI_AVOID_IFACE_RESET_MAC_CHANGE + "wifi_skip_state_toggle_off_on_for_nan", // WIFI_SKIP_STATE_TOGGLE_OFF_ON_FOR_NAN ], value_variables: [ "hal_interface_combinations", // WIFI_HAL_INTERFACE_COMBINATIONS @@ -53,6 +54,9 @@ wifi_hal_cc_defaults { avoid_iface_reset_mac_change: { cppflags: ["-DWIFI_AVOID_IFACE_RESET_MAC_CHANGE"], }, + wifi_skip_state_toggle_off_on_for_nan: { + cppflags: ["-DWIFI_SKIP_STATE_TOGGLE_OFF_ON_FOR_NAN"], + }, hal_interface_combinations: { cppflags: ["-DWIFI_HAL_INTERFACE_COMBINATIONS=%s"], }, diff --git a/wifi/aidl/default/wifi_nan_iface.cpp b/wifi/aidl/default/wifi_nan_iface.cpp index 8e3a191b7a..cefe7f7695 100644 --- a/wifi/aidl/default/wifi_nan_iface.cpp +++ b/wifi/aidl/default/wifi_nan_iface.cpp @@ -623,6 +623,7 @@ void WifiNanIface::registerCallbackHandlers() { // Register for iface state toggle events. iface_util::IfaceEventHandlers event_handlers = {}; +#ifndef WIFI_SKIP_STATE_TOGGLE_OFF_ON_FOR_NAN event_handlers.on_state_toggle_off_on = [weak_ptr_this](const std::string& /* iface_name */) { const auto shared_ptr_this = weak_ptr_this.lock(); if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { @@ -637,6 +638,7 @@ void WifiNanIface::registerCallbackHandlers() { } } }; +#endif iface_util_.lock()->registerIfaceEventHandlers(ifname_, event_handlers); } From 7cb57f095038e3ad457ecf0950cbfd5c728039c6 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Fri, 17 Mar 2023 10:35:16 -0700 Subject: [PATCH 851/998] Update Cruise Control properties HAL docs Specify the exact StatusCode that should be returned when the property is not available. Bug: 271302963 Test: presubmit Change-Id: I448071ca970985f20d1e414104c90142ca58e0f2 --- .../automotive/vehicle/VehicleProperty.aidl | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 7cd020bd31..0326ea233f 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -4054,7 +4054,10 @@ enum VehicleProperty { * * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined * unless all states of CruiseControlState are supported. Any unsupported commands sent through - * this property should return StatusCode.INVALID_ARG. + * this property must return StatusCode#INVALID_ARG. + * + * When this property is not available because CC is disabled (i.e. CRUISE_CONTROL_ENABLED is + * false), this property must return StatusCode#NOT_AVAILABLE_DISABLED. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.WRITE @@ -4072,8 +4075,8 @@ enum VehicleProperty { * The maxFloatValue represents the upper bound of the target speed. * The minFloatValue represents the lower bound of the target speed. * - * When this property is not available (for example when CRUISE_CONTROL_ENABLED is false), it - * should return StatusCode.NOT_AVAILABLE_DISABLED. + * When this property is not available because CC is disabled (i.e. CRUISE_CONTROL_ENABLED is + * false), this property must return StatusCode#NOT_AVAILABLE_DISABLED. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ @@ -4095,7 +4098,8 @@ enum VehicleProperty { * ascending order. All values must be positive. If the property is writable, all values must be * writable. * - * Writing to this property when it is not available should return StatusCode.NOT_AVAILABLE. + * When this property is not available because CC is disabled (i.e. CRUISE_CONTROL_ENABLED is + * false), this property must return StatusCode#NOT_AVAILABLE_DISABLED. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE @@ -4119,6 +4123,9 @@ enum VehicleProperty { * vehicle is too far away for the sensor to detect), this property should return * StatusCode.NOT_AVAILABLE. * + * When this property is not available because CC is disabled (i.e. CRUISE_CONTROL_ENABLED is + * false), this property must return StatusCode#NOT_AVAILABLE_DISABLED. + * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ * @unit VehicleUnit:MILLIMETER From 5ba8f5230cc8c8e9a281b503e8fb3f2c90cd5214 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Mon, 20 Mar 2023 20:22:36 -0700 Subject: [PATCH 852/998] Grant net_raw capabilities to remote access hal. Remote access test VHAL requires net_raw to select specific eth interface to communicate with TCU. Test: Manual test. Bug: 261108682 Change-Id: Ieb84a84ffeee2b8f907de8b58501024a3d704945 --- .../remoteaccess/hal/default/remoteaccess-tcu-test-service.rc | 1 + 1 file changed, 1 insertion(+) diff --git a/automotive/remoteaccess/hal/default/remoteaccess-tcu-test-service.rc b/automotive/remoteaccess/hal/default/remoteaccess-tcu-test-service.rc index 6437d70f08..59315ebe0b 100644 --- a/automotive/remoteaccess/hal/default/remoteaccess-tcu-test-service.rc +++ b/automotive/remoteaccess/hal/default/remoteaccess-tcu-test-service.rc @@ -2,3 +2,4 @@ service vendor.remoteaccess-default /vendor/bin/hw/android.hardware.automotive.r class hal user vehicle_network group system inet + capabilities NET_RAW From bddb15a53ef9cc840912a2612dc8ee18890b3918 Mon Sep 17 00:00:00 2001 From: Fred Gylys-Colwell Date: Wed, 22 Mar 2023 09:40:45 -0700 Subject: [PATCH 853/998] Update OWNERS file Bug: 274772704 Test: no code change Change-Id: I75aa5586e5a64838e81970021d1725012b612dca --- drm/aidl/OWNERS | 1 - drm/aidl/vts/OWNERS | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/drm/aidl/OWNERS b/drm/aidl/OWNERS index fa8fd20c9f..fe69725d67 100644 --- a/drm/aidl/OWNERS +++ b/drm/aidl/OWNERS @@ -1,4 +1,3 @@ # Bug component: 49079 -edwinwong@google.com kelzhan@google.com robertshih@google.com diff --git a/drm/aidl/vts/OWNERS b/drm/aidl/vts/OWNERS index e44b93eef9..fe69725d67 100644 --- a/drm/aidl/vts/OWNERS +++ b/drm/aidl/vts/OWNERS @@ -1,4 +1,3 @@ -edwinwong@google.com -jtinker@google.com +# Bug component: 49079 kelzhan@google.com robertshih@google.com From 0918fc865a1329662b2045ada3b63e247b448799 Mon Sep 17 00:00:00 2001 From: Austin Borger Date: Tue, 21 Mar 2023 18:48:18 -0700 Subject: [PATCH 854/998] Camera VTS: Add test validating stream configuration metadata Vendor static metadata entries related to the stream configuration tags like min frame duration, stall duration could include duplicate or invalid data. Check that this is not the case. Initially, this test only has impact for 10-bit HDR devices. More checks will be added in the future. Bug: 269165407 Test: Ran test on Pixel 7. Change-Id: I2ad820c1ba4753508fa1f61b31b51739358099ea --- .../VtsAidlHalCameraProvider_TargetTest.cpp | 41 +++++++++++++++++ camera/provider/aidl/vts/camera_aidl_test.cpp | 45 +++++++++++++++++++ camera/provider/aidl/vts/camera_aidl_test.h | 7 +++ 3 files changed, 93 insertions(+) diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp index 50fb052aa2..398d201619 100644 --- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp +++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp @@ -3051,6 +3051,47 @@ TEST_P(CameraAidlTest, configureStreamsUseCases) { configureStreamUseCaseInternal(previewStreamThreshold); } +// Validate the integrity of stream configuration metadata +TEST_P(CameraAidlTest, validateStreamConfigurations) { + std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); + std::vector outputStreams; + + const int32_t scalerSizesTag = ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS; + const int32_t scalerMinFrameDurationsTag = ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS; + const int32_t scalerStallDurationsTag = ANDROID_SCALER_AVAILABLE_STALL_DURATIONS; + + for (const auto& name : cameraDeviceNames) { + CameraMetadata meta; + std::shared_ptr cameraDevice; + + openEmptyDeviceSession(name, mProvider, &mSession /*out*/, &meta /*out*/, + &cameraDevice /*out*/); + camera_metadata_t* staticMeta = reinterpret_cast(meta.metadata.data()); + + if (is10BitDynamicRangeCapable(staticMeta)) { + std::vector> supportedP010Sizes, supportedBlobSizes; + + getSupportedSizes(staticMeta, scalerSizesTag, HAL_PIXEL_FORMAT_BLOB, + &supportedBlobSizes); + getSupportedSizes(staticMeta, scalerSizesTag, HAL_PIXEL_FORMAT_YCBCR_P010, + &supportedP010Sizes); + ASSERT_FALSE(supportedP010Sizes.empty()); + + std::vector blobMinDurations, blobStallDurations; + getSupportedDurations(staticMeta, scalerMinFrameDurationsTag, HAL_PIXEL_FORMAT_BLOB, + supportedP010Sizes, &blobMinDurations); + getSupportedDurations(staticMeta, scalerStallDurationsTag, HAL_PIXEL_FORMAT_BLOB, + supportedP010Sizes, &blobStallDurations); + ASSERT_FALSE(blobStallDurations.empty()); + ASSERT_FALSE(blobMinDurations.empty()); + ASSERT_EQ(supportedP010Sizes.size(), blobMinDurations.size()); + ASSERT_EQ(blobMinDurations.size(), blobStallDurations.size()); + } + + // Validate other aspects of stream configuration metadata... + } +} + GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(CameraAidlTest); INSTANTIATE_TEST_SUITE_P( PerInstance, CameraAidlTest, diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp index 64507feb07..42b5b7dc55 100644 --- a/camera/provider/aidl/vts/camera_aidl_test.cpp +++ b/camera/provider/aidl/vts/camera_aidl_test.cpp @@ -3703,3 +3703,48 @@ void CameraAidlTest::processZoomSettingsOverrideRequests( ASSERT_TRUE(ret.isOk()); } } + +void CameraAidlTest::getSupportedSizes(const camera_metadata_t* ch, uint32_t tag, int32_t format, + std::vector>* sizes /*out*/) { + if (sizes == nullptr) { + return; + } + + camera_metadata_ro_entry entry; + int retcode = find_camera_metadata_ro_entry(ch, tag, &entry); + if ((0 == retcode) && (entry.count > 0)) { + // Scaler entry contains 4 elements (format, width, height, type) + for (size_t i = 0; i < entry.count; i += 4) { + if ((entry.data.i32[i] == format) && + (entry.data.i32[i + 3] == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT)) { + sizes->push_back(std::make_tuple(entry.data.i32[i + 1], entry.data.i32[i + 2])); + } + } + } +} + +void CameraAidlTest::getSupportedDurations(const camera_metadata_t* ch, uint32_t tag, + int32_t format, + const std::vector>& sizes, + std::vector* durations /*out*/) { + if (durations == nullptr) { + return; + } + + camera_metadata_ro_entry entry; + int retcode = find_camera_metadata_ro_entry(ch, tag, &entry); + if ((0 == retcode) && (entry.count > 0)) { + // Duration entry contains 4 elements (format, width, height, duration) + for (const auto& size : sizes) { + int64_t width = std::get<0>(size); + int64_t height = std::get<1>(size); + for (size_t i = 0; i < entry.count; i += 4) { + if ((entry.data.i64[i] == format) && (entry.data.i64[i + 1] == width) && + (entry.data.i64[i + 2] == height)) { + durations->push_back(entry.data.i64[i + 3]); + break; + } + } + } + } +} diff --git a/camera/provider/aidl/vts/camera_aidl_test.h b/camera/provider/aidl/vts/camera_aidl_test.h index f13d6b202a..bf409d9b17 100644 --- a/camera/provider/aidl/vts/camera_aidl_test.h +++ b/camera/provider/aidl/vts/camera_aidl_test.h @@ -418,6 +418,13 @@ class CameraAidlTest : public ::testing::TestWithParam { bool supportsCroppedRawUseCase(const camera_metadata_t *staticMeta); bool isPerFrameControl(const camera_metadata_t* staticMeta); + void getSupportedSizes(const camera_metadata_t* ch, uint32_t tag, int32_t format, + std::vector>* sizes /*out*/); + + void getSupportedDurations(const camera_metadata_t* ch, uint32_t tag, int32_t format, + const std::vector>& sizes, + std::vector* durations /*out*/); + protected: // In-flight queue for tracking completion of capture requests. struct InFlightRequest { From 64cb96314180afa6a5e02b47bc218bb976c4f653 Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Wed, 15 Mar 2023 23:46:43 +0000 Subject: [PATCH 855/998] Allow secondary ids missing for DAB selector Sometimes DAB program selector used in tuning does not have secondary identifiers such as ensemble and frequency, and HAL will automatically selector a DAB station with specified ensemble and frequency. Thus, secondary ids in DAB program selector are not mandatory in HAL. Also updated broadcast radio AIDL HAL documentation. Bug: 273804622 Test: atest VtsHalBroadcastradioAidlTargetTest Change-Id: If05b7eeb79e299667c3a64bf8b931bb6396f9045 --- .../broadcastradio/AmFmRegionConfig.aidl | 5 ++- .../hardware/broadcastradio/ProgramInfo.aidl | 4 ++ .../broadcastradio/ProgramSelector.aidl | 8 ++-- .../aidl/default/BroadcastRadio.cpp | 29 +++++++------ broadcastradio/common/utilsaidl/Utils.cpp | 41 +++++++++---------- .../include/broadcastradio-utils-aidl/Utils.h | 1 + 6 files changed, 49 insertions(+), 39 deletions(-) diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/AmFmRegionConfig.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/AmFmRegionConfig.aidl index a3086c60cc..f4c6fd3f29 100644 --- a/broadcastradio/aidl/android/hardware/broadcastradio/AmFmRegionConfig.aidl +++ b/broadcastradio/aidl/android/hardware/broadcastradio/AmFmRegionConfig.aidl @@ -73,14 +73,15 @@ parcelable AmFmRegionConfig { /** * De-emphasis filter supported/configured. * - * It is a bitset of de-emphasis values (DEEMPHASIS_D50 and DEEMPHASIS_D75). + * It can be a combination of de-emphasis values ({@link #DEEMPHASIS_D50} and + * {@link #DEEMPHASIS_D75}). */ int fmDeemphasis; /** * RDS/RBDS variant supported/configured. * - * It is a bitset of RDS values (RDS and RBDS). + * It can be a combination of RDS values ({@link #RDS} and {@link #RBDS}). */ int fmRds; } diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl index d6502394ec..7632c81e1d 100644 --- a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl +++ b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramInfo.aidl @@ -150,6 +150,10 @@ parcelable ProgramInfo { /** * Program flags. + * + * It can be a combination of {@link #FLAG_LIVE}, {@link #FLAG_MUTED}, + * {@link #FLAG_TRAFFIC_PROGRAM}, {@link #FLAG_TRAFFIC_ANNOUNCEMENT}, + * {@link #FLAG_TUNABLE}, and {@link #FLAG_STEREO}. */ int infoFlags; diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramSelector.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramSelector.aidl index 93b0e12674..71b824b8e9 100644 --- a/broadcastradio/aidl/android/hardware/broadcastradio/ProgramSelector.aidl +++ b/broadcastradio/aidl/android/hardware/broadcastradio/ProgramSelector.aidl @@ -51,8 +51,7 @@ parcelable ProgramSelector { * - analogue AM/FM: AMFM_FREQUENCY_KHZ; * - FM RDS: RDS_PI; * - HD Radio: HD_STATION_ID_EXT; - * - DAB/DMB: DAB_SID_EXT (when used, DAB_ENSEMBLE and DAB_FREQUENCY_KHZ - * must present in secondaryIds); + * - DAB/DMB: DAB_SID_EXT; * - Digital Radio Mondiale: DRMO_SERVICE_ID; * - SiriusXM: SXM_SERVICE_ID; * - vendor-specific: VENDOR_START..VENDOR_END. @@ -63,13 +62,16 @@ parcelable ProgramSelector { * Secondary program identifiers. * * These identifiers are supplementary and can speed up tuning process, - * but the primary ID must be sufficient (i.e. RDS PI is enough to select + * but the primary ID should be sufficient (i.e. RDS PI is enough to select * a station from the list after a full band scan). * * Two selectors with different secondary IDs, but the same primary ID are * considered equal. In particular, secondary IDs array may get updated for * an entry on the program list (ie. when a better frequency for a given * station is found). + * + * If DAB_SID_EXT is used as primaryId, using DAB_ENSEMBLE or DAB_FREQUENCY_KHZ + * as secondray identifiers can uniquely identify the DAB station. */ ProgramIdentifier[] secondaryIds; } diff --git a/broadcastradio/aidl/default/BroadcastRadio.cpp b/broadcastradio/aidl/default/BroadcastRadio.cpp index 36520fb387..c0c475a532 100644 --- a/broadcastradio/aidl/default/BroadcastRadio.cpp +++ b/broadcastradio/aidl/default/BroadcastRadio.cpp @@ -589,10 +589,11 @@ binder_status_t BroadcastRadio::cmdTune(int fd, const char** args, uint32_t numA } ProgramSelector sel = {}; if (isDab) { - if (numArgs != 5) { + if (numArgs != 5 && numArgs != 3) { dprintf(fd, "Invalid number of arguments: please provide " - "--tune dab \n"); + "--tune dab or " + "--tune dab \n"); return STATUS_BAD_VALUE; } int sid; @@ -600,17 +601,21 @@ binder_status_t BroadcastRadio::cmdTune(int fd, const char** args, uint32_t numA dprintf(fd, "Non-integer sid provided with tune: %s\n", args[2]); return STATUS_BAD_VALUE; } - int ensemble; - if (!utils::parseArgInt(string(args[3]), &ensemble)) { - dprintf(fd, "Non-integer ensemble provided with tune: %s\n", args[3]); - return STATUS_BAD_VALUE; + if (numArgs == 3) { + sel = utils::makeSelectorDab(sid); + } else { + int ensemble; + if (!utils::parseArgInt(string(args[3]), &ensemble)) { + dprintf(fd, "Non-integer ensemble provided with tune: %s\n", args[3]); + return STATUS_BAD_VALUE; + } + int freq; + if (!utils::parseArgInt(string(args[4]), &freq)) { + dprintf(fd, "Non-integer frequency provided with tune: %s\n", args[4]); + return STATUS_BAD_VALUE; + } + sel = utils::makeSelectorDab(sid, ensemble, freq); } - int freq; - if (!utils::parseArgInt(string(args[4]), &freq)) { - dprintf(fd, "Non-integer frequency provided with tune: %s\n", args[4]); - return STATUS_BAD_VALUE; - } - sel = utils::makeSelectorDab(sid, ensemble, freq); } else { if (numArgs != 3) { dprintf(fd, "Invalid number of arguments: please provide --tune amfm \n"); diff --git a/broadcastradio/common/utilsaidl/Utils.cpp b/broadcastradio/common/utilsaidl/Utils.cpp index ad823661db..0551badc45 100644 --- a/broadcastradio/common/utilsaidl/Utils.cpp +++ b/broadcastradio/common/utilsaidl/Utils.cpp @@ -136,9 +136,18 @@ bool tunesTo(const ProgramSelector& a, const ProgramSelector& b) { return getHdSubchannel(b) == 0 && haveEqualIds(a, b, IdentifierType::AMFM_FREQUENCY_KHZ); case IdentifierType::DAB_SID_EXT: - return haveEqualIds(a, b, IdentifierType::DAB_SID_EXT) && - haveEqualIds(a, b, IdentifierType::DAB_ENSEMBLE) && - haveEqualIds(a, b, IdentifierType::DAB_FREQUENCY_KHZ); + if (!haveEqualIds(a, b, IdentifierType::DAB_SID_EXT)) { + return false; + } + if (hasId(a, IdentifierType::DAB_ENSEMBLE) && + !haveEqualIds(a, b, IdentifierType::DAB_ENSEMBLE)) { + return false; + } + if (hasId(a, IdentifierType::DAB_FREQUENCY_KHZ) && + !haveEqualIds(a, b, IdentifierType::DAB_FREQUENCY_KHZ)) { + return false; + } + return true; case IdentifierType::DRMO_SERVICE_ID: return haveEqualIds(a, b, IdentifierType::DRMO_SERVICE_ID); case IdentifierType::SXM_SERVICE_ID: @@ -289,25 +298,7 @@ bool isValid(const ProgramSelector& sel) { sel.primaryId.type > IdentifierType::VENDOR_END)) { return false; } - if (!isValid(sel.primaryId)) { - return false; - } - - bool isDab = sel.primaryId.type == IdentifierType::DAB_SID_EXT; - bool hasDabEnsemble = false; - bool hasDabFrequency = false; - for (auto it = sel.secondaryIds.begin(); it != sel.secondaryIds.end(); it++) { - if (!isValid(*it)) { - return false; - } - if (isDab && it->type == IdentifierType::DAB_ENSEMBLE) { - hasDabEnsemble = true; - } - if (isDab && it->type == IdentifierType::DAB_FREQUENCY_KHZ) { - hasDabFrequency = true; - } - } - return !isDab || (hasDabEnsemble && hasDabFrequency); + return isValid(sel.primaryId); } ProgramIdentifier makeIdentifier(IdentifierType type, int64_t value) { @@ -320,6 +311,12 @@ ProgramSelector makeSelectorAmfm(int32_t frequency) { return sel; } +ProgramSelector makeSelectorDab(int64_t sidExt) { + ProgramSelector sel = {}; + sel.primaryId = makeIdentifier(IdentifierType::DAB_SID_EXT, sidExt); + return sel; +} + ProgramSelector makeSelectorDab(int64_t sidExt, int32_t ensemble, int64_t freq) { ProgramSelector sel = {}; sel.primaryId = makeIdentifier(IdentifierType::DAB_SID_EXT, sidExt); diff --git a/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h b/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h index beebd037c2..ad075f2943 100644 --- a/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h +++ b/broadcastradio/common/utilsaidl/include/broadcastradio-utils-aidl/Utils.h @@ -138,6 +138,7 @@ bool isValid(const ProgramSelector& sel); ProgramIdentifier makeIdentifier(IdentifierType type, int64_t value); ProgramSelector makeSelectorAmfm(int32_t frequency); +ProgramSelector makeSelectorDab(int64_t sidExt); ProgramSelector makeSelectorDab(int64_t sidExt, int32_t ensemble, int64_t freq); bool satisfies(const ProgramFilter& filter, const ProgramSelector& sel); From 54b2236b223e418fb8c5c85df6e719ebdd94d174 Mon Sep 17 00:00:00 2001 From: Austin Borger Date: Wed, 22 Mar 2023 11:25:06 -0700 Subject: [PATCH 856/998] Camera VTS: Updated ColorSpaceNamed and color space tests. BT2020_HLG and BT2020_PQ were adding since the ColorSpaceProfiles tests were checked in. Add those to the ColorSpaceNamed enum. Also remove unsupported color spaces from the list of 8-bit color spaces to test, and change BT2020 to BT2020_HLG. Test: Ran on Pixel 7. Bug: 274789672 Change-Id: I9625a1f05017ccdcb383cdf8fd13084688acc79f --- .../vts/VtsAidlHalCameraProvider_TargetTest.cpp | 15 +++------------ camera/provider/aidl/vts/camera_aidl_test.cpp | 4 ++++ camera/provider/aidl/vts/camera_aidl_test.h | 4 +++- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp index 50fb052aa2..7dc2d470ab 100644 --- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp +++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp @@ -2025,16 +2025,7 @@ TEST_P(CameraAidlTest, process10BitDynamicRangeRequest) { } TEST_P(CameraAidlTest, process8BitColorSpaceRequests) { - static int profiles[] = { - ColorSpaceNamed::BT709, - ColorSpaceNamed::DCI_P3, - ColorSpaceNamed::DISPLAY_P3, - ColorSpaceNamed::EXTENDED_SRGB, - ColorSpaceNamed::LINEAR_EXTENDED_SRGB, - ColorSpaceNamed::NTSC_1953, - ColorSpaceNamed::SMPTE_C, - ColorSpaceNamed::SRGB - }; + static int profiles[] = {ColorSpaceNamed::DISPLAY_P3, ColorSpaceNamed::SRGB}; for (int32_t i = 0; i < sizeof(profiles) / sizeof(profiles[0]); i++) { processColorSpaceRequest(static_cast(profiles[i]), @@ -2059,10 +2050,10 @@ TEST_P(CameraAidlTest, process10BitColorSpaceRequests) { ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM_PO }; - // Process all dynamic range profiles with BT2020 + // Process all dynamic range profiles with BT2020_HLG for (int32_t i = 0; i < sizeof(dynamicRangeProfiles) / sizeof(dynamicRangeProfiles[0]); i++) { processColorSpaceRequest( - static_cast(ColorSpaceNamed::BT2020), + static_cast(ColorSpaceNamed::BT2020_HLG), static_cast(dynamicRangeProfiles[i])); } } diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp index 64507feb07..11c202bc4b 100644 --- a/camera/provider/aidl/vts/camera_aidl_test.cpp +++ b/camera/provider/aidl/vts/camera_aidl_test.cpp @@ -3085,6 +3085,10 @@ const char* CameraAidlTest::getColorSpaceProfileString( return "CIE_XYZ"; case ColorSpaceNamed::CIE_LAB: return "CIE_LAB"; + case ColorSpaceNamed::BT2020_HLG: + return "BT2020_HLG"; + case ColorSpaceNamed::BT2020_PQ: + return "BT2020_PQ"; default: return "INVALID"; } diff --git a/camera/provider/aidl/vts/camera_aidl_test.h b/camera/provider/aidl/vts/camera_aidl_test.h index f13d6b202a..709b70f141 100644 --- a/camera/provider/aidl/vts/camera_aidl_test.h +++ b/camera/provider/aidl/vts/camera_aidl_test.h @@ -145,7 +145,9 @@ class CameraAidlTest : public ::testing::TestWithParam { ACES, ACESCG, CIE_XYZ, - CIE_LAB + CIE_LAB, + BT2020_HLG, + BT2020_PQ }; struct AvailableZSLInputOutput { From 9549368dd47e3755278e7ee755dfc7b3a6f70aa4 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Tue, 21 Mar 2023 18:00:17 -0700 Subject: [PATCH 857/998] Add inject task cmd to default remoteaccess hal. This allows local remote access HAL test. This CL also adds debug status dump to remote access HAL. Test: Manual run on gcar_emu Bug: 272773565 Change-Id: Ic02b451d800cfe75d8c410a4dc52e8ce15e481b7 --- .../hal/default/include/RemoteAccessService.h | 11 +- .../hal/default/src/RemoteAccessService.cpp | 118 ++++++++++++++---- 2 files changed, 103 insertions(+), 26 deletions(-) diff --git a/automotive/remoteaccess/hal/default/include/RemoteAccessService.h b/automotive/remoteaccess/hal/default/include/RemoteAccessService.h index 5cfca613f4..9aabad6573 100644 --- a/automotive/remoteaccess/hal/default/include/RemoteAccessService.h +++ b/automotive/remoteaccess/hal/default/include/RemoteAccessService.h @@ -97,7 +97,10 @@ class RemoteAccessService bool mTaskWaitStopped GUARDED_BY(mLock); // A mutex to make sure startTaskLoop does not overlap with stopTaskLoop. std::mutex mStartStopTaskLoopLock; - bool mTaskLoopRunning GUARDED_BY(mStartStopTaskLoopLock); + bool mTaskLoopRunning GUARDED_BY(mStartStopTaskLoopLock) = false; + bool mGrpcConnected GUARDED_BY(mLock) = false; + std::unordered_map mClientIdToTaskCount GUARDED_BY(mLock); + // Default wait time before retry connecting to remote access client is 10s. size_t mRetryWaitInMs = 10'000; std::shared_ptr mDebugCallback; @@ -110,6 +113,12 @@ class RemoteAccessService void setRetryWaitInMs(size_t retryWaitInMs) { mRetryWaitInMs = retryWaitInMs; } void dumpHelp(int fd); + void printCurrentStatus(int fd); + std::string clientIdToTaskCountToStringLocked() REQUIRES(mLock); + void debugInjectTask(int fd, std::string_view clientId, std::string_view taskData); + void updateGrpcConnected(bool connected); + android::base::Result deliverRemoteTaskThroughCallback(const std::string& clientId, + std::string_view taskData); }; } // namespace remoteaccess diff --git a/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp b/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp index d9445933ae..bbda9df759 100644 --- a/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp +++ b/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp @@ -36,6 +36,8 @@ namespace { using ::aidl::android::hardware::automotive::remoteaccess::ApState; using ::aidl::android::hardware::automotive::remoteaccess::IRemoteTaskCallback; using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; +using ::android::base::Error; +using ::android::base::Result; using ::android::base::ScopedLockAssertion; using ::android::base::StringAppendF; using ::android::base::StringPrintf; @@ -54,8 +56,10 @@ constexpr char COMMAND_START_DEBUG_CALLBACK[] = "--start-debug-callback"; constexpr char COMMAND_STOP_DEBUG_CALLBACK[] = "--stop-debug-callback"; constexpr char COMMAND_SHOW_TASK[] = "--show-task"; constexpr char COMMAND_GET_VEHICLE_ID[] = "--get-vehicle-id"; +constexpr char COMMAND_INJECT_TASK[] = "--inject-task"; +constexpr char COMMAND_STATUS[] = "--status"; -std::vector stringToBytes(const std::string& s) { +std::vector stringToBytes(std::string_view s) { const char* data = s.data(); return std::vector(data, data + s.size()); } @@ -81,6 +85,10 @@ void dprintErrorStatus(int fd, const char* detail, const ScopedAStatus& status) dprintf(fd, "%s, code: %d, error: %s\n", detail, status.getStatus(), status.getMessage()); } +std::string boolToString(bool x) { + return x ? "true" : "false"; +} + } // namespace RemoteAccessService::RemoteAccessService(WakeupClient::StubInterface* grpcStub) @@ -126,6 +134,33 @@ void RemoteAccessService::maybeStopTaskLoop() { mTaskLoopRunning = false; } +void RemoteAccessService::updateGrpcConnected(bool connected) { + std::lock_guard lockGuard(mLock); + mGrpcConnected = connected; +} + +Result RemoteAccessService::deliverRemoteTaskThroughCallback(const std::string& clientId, + std::string_view taskData) { + std::shared_ptr callback; + { + std::lock_guard lockGuard(mLock); + callback = mRemoteTaskCallback; + mClientIdToTaskCount[clientId] += 1; + } + if (callback == nullptr) { + return Error() << "No callback registered, task ignored"; + } + ALOGD("Calling onRemoteTaskRequested callback for client ID: %s", clientId.c_str()); + ScopedAStatus callbackStatus = + callback->onRemoteTaskRequested(clientId, stringToBytes(taskData)); + if (!callbackStatus.isOk()) { + return Error() << "Failed to call onRemoteTaskRequested callback, status: " + << callbackStatus.getStatus() + << ", message: " << callbackStatus.getMessage(); + } + return {}; +} + void RemoteAccessService::runTaskLoop() { GetRemoteTasksRequest request = {}; std::unique_ptr> reader; @@ -135,28 +170,19 @@ void RemoteAccessService::runTaskLoop() { mGetRemoteTasksContext.reset(new ClientContext()); reader = mGrpcStub->GetRemoteTasks(mGetRemoteTasksContext.get(), request); } + updateGrpcConnected(true); GetRemoteTasksResponse response; while (reader->Read(&response)) { ALOGI("Receiving one task from remote task client"); - std::shared_ptr callback; - { - std::lock_guard lockGuard(mLock); - callback = mRemoteTaskCallback; - } - if (callback == nullptr) { - ALOGD("No callback registered, task ignored"); + if (auto result = + deliverRemoteTaskThroughCallback(response.clientid(), response.data()); + !result.ok()) { + ALOGE("%s", result.error().message().c_str()); continue; } - ALOGD("Calling onRemoteTaskRequested callback for client ID: %s", - response.clientid().c_str()); - ScopedAStatus callbackStatus = callback->onRemoteTaskRequested( - response.clientid(), stringToBytes(response.data())); - if (!callbackStatus.isOk()) { - ALOGE("Failed to call onRemoteTaskRequested callback, status: %d, message: %s", - callbackStatus.getStatus(), callbackStatus.getMessage()); - } } + updateGrpcConnected(false); Status status = reader->Finish(); mGetRemoteTasksContext.reset(); @@ -252,15 +278,17 @@ bool RemoteAccessService::checkDumpPermission() { } void RemoteAccessService::dumpHelp(int fd) { - dprintf(fd, "%s", - (std::string("RemoteAccess HAL debug interface, Usage: \n") + COMMAND_SET_AP_STATE + - " [0/1](isReadyForRemoteTask) [0/1](isWakeupRequired) Set the new AP state\n" + - COMMAND_START_DEBUG_CALLBACK + - " Start a debug callback that will record the received tasks\n" + - COMMAND_STOP_DEBUG_CALLBACK + " Stop the debug callback\n" + COMMAND_SHOW_TASK + - " Show tasks received by debug callback\n" + COMMAND_GET_VEHICLE_ID + - " Get vehicle id\n") - .c_str()); + dprintf(fd, + "RemoteAccess HAL debug interface, Usage: \n" + "%s [0/1](isReadyForRemoteTask) [0/1](isWakeupRequired): Set the new AP state\n" + "%s: Start a debug callback that will record the received tasks\n" + "%s: Stop the debug callback\n" + "%s: Show tasks received by debug callback\n" + "%s: Get vehicle id\n" + "%s [client_id] [task_data]: Inject a task\n" + "%s: Show status\n", + COMMAND_SET_AP_STATE, COMMAND_START_DEBUG_CALLBACK, COMMAND_STOP_DEBUG_CALLBACK, + COMMAND_SHOW_TASK, COMMAND_GET_VEHICLE_ID, COMMAND_INJECT_TASK, COMMAND_STATUS); } binder_status_t RemoteAccessService::dump(int fd, const char** args, uint32_t numArgs) { @@ -271,6 +299,7 @@ binder_status_t RemoteAccessService::dump(int fd, const char** args, uint32_t nu if (numArgs == 0) { dumpHelp(fd); + printCurrentStatus(fd); return STATUS_OK; } @@ -330,6 +359,14 @@ binder_status_t RemoteAccessService::dump(int fd, const char** args, uint32_t nu } else { dprintf(fd, "Vehicle Id: %s\n", vehicleId.c_str()); } + } else if (!strcmp(args[0], COMMAND_INJECT_TASK)) { + if (numArgs < 3) { + dumpHelp(fd); + return STATUS_OK; + } + debugInjectTask(fd, args[1], args[2]); + } else if (!strcmp(args[0], COMMAND_STATUS)) { + printCurrentStatus(fd); } else { dumpHelp(fd); } @@ -337,6 +374,37 @@ binder_status_t RemoteAccessService::dump(int fd, const char** args, uint32_t nu return STATUS_OK; } +void RemoteAccessService::printCurrentStatus(int fd) { + std::lock_guard lockGuard(mLock); + dprintf(fd, + "\nRemoteAccess HAL status \n" + "Remote task callback registered: %s\n" + "Task receiving GRPC connection established: %s\n" + "Received task count by clientId: \n%s\n", + boolToString(mRemoteTaskCallback.get()).c_str(), boolToString(mGrpcConnected).c_str(), + clientIdToTaskCountToStringLocked().c_str()); +} + +void RemoteAccessService::debugInjectTask(int fd, std::string_view clientId, + std::string_view taskData) { + std::string clientIdCopy = std::string(clientId); + if (auto result = deliverRemoteTaskThroughCallback(clientIdCopy, taskData); !result.ok()) { + dprintf(fd, "Failed to inject task: %s", result.error().message().c_str()); + return; + } + dprintf(fd, "Task for client: %s, data: [%s] successfully injected\n", clientId.data(), + taskData.data()); +} + +std::string RemoteAccessService::clientIdToTaskCountToStringLocked() { + // Print the table header + std::string output = "| ClientId | Count |\n"; + for (const auto& [clientId, taskCount] : mClientIdToTaskCount) { + output += StringPrintf(" %-9s %-6zu\n", clientId.c_str(), taskCount); + } + return output; +} + ScopedAStatus DebugRemoteTaskCallback::onRemoteTaskRequested(const std::string& clientId, const std::vector& data) { std::lock_guard lockGuard(mLock); From a3b22e5a72ad0b475b9422b3d42f515a04817825 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Wed, 22 Mar 2023 23:57:13 +0000 Subject: [PATCH 858/998] Update comment for the INonStandardCertCallback to indicate how certificates are added. Bug: 267819850 Test: m Change-Id: I896bf68138b93a97c843699d69bac193e7ee1523 --- .../hardware/wifi/supplicant/INonStandardCertCallback.aidl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl index 2f9e528c3a..2e11c76e92 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl @@ -18,7 +18,8 @@ package android.hardware.wifi.supplicant; /** * Callback to allow supplicant to retrieve non-standard certificate types - * from the client. + * from the framework. Certificates can be stored in the framework using + * the WifiKeystore#put system API. * * Must be registered by the client at initialization, so that * supplicant can call into the client to retrieve any values. From 4509505ce08d1d5830ea38cc94640f63d339b8c1 Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Thu, 23 Mar 2023 18:23:15 -0400 Subject: [PATCH 859/998] Revert "Add a DisplayCapability for multi-threaded present" This reverts commit b3e336edd112667ba174f268ad4cce53a484c545. Bug: 274954820 Test: build Change-Id: I6265f8de3db31f07506906cee82a91fe3baac0bc --- .../graphics/composer3/DisplayCapability.aidl | 1 - .../graphics/composer3/DisplayCapability.aidl | 16 ---------------- .../vts/VtsHalGraphicsComposer3_TargetTest.cpp | 16 +--------------- 3 files changed, 1 insertion(+), 32 deletions(-) diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl index 0e2d72bae0..6eba887aef 100644 --- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/DisplayCapability.aidl @@ -42,5 +42,4 @@ enum DisplayCapability { AUTO_LOW_LATENCY_MODE = 5, SUSPEND = 6, DISPLAY_IDLE_TIMER = 7, - MULTI_THREADED_PRESENT = 8, } diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl index 7154d74499..f4b29843b8 100644 --- a/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl +++ b/graphics/composer/aidl/android/hardware/graphics/composer3/DisplayCapability.aidl @@ -80,20 +80,4 @@ enum DisplayCapability { * IComposerCallback.onVsyncIdle. */ DISPLAY_IDLE_TIMER = 7, - /** - * Indicates that both the composer HAL implementation and the given display - * support calling executeCommands concurrently from separate threads. - * executeCommands for a particular display will never run concurrently to - * any other executeCommands for the same display. In addition, the - * CommandResultPayload must only reference displays included in the - * DisplayCommands passed to executeCommands. Displays referenced from - * separate threads must have minimal interference with one another. If a - * HWC-managed display has this capability, SurfaceFlinger can run - * executeCommands for this display concurrently with other displays with the - * same capability. - * @see IComposerClient.executeCommands - * @see DisplayCommand.presentDisplay - * @see DisplayCommand.validateDisplay - */ - MULTI_THREADED_PRESENT = 8, } diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 746330b148..5116774b40 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -2494,20 +2494,6 @@ TEST_P(GraphicsComposerAidlTest, GetDisplayConfigNoRepetitions) { } } -TEST_P(GraphicsComposerAidlCommandTest, MultiThreadedPresent) { - std::vector displays; - for (auto& display : mDisplays) { - if (hasDisplayCapability(display.getDisplayId(), - DisplayCapability::MULTI_THREADED_PRESENT)) { - displays.push_back(&display); - } - } - if (displays.size() <= 1u) { - return; - } - // TODO(b/251842321): Try to present on multiple threads. -} - /** * Test Capability::SKIP_VALIDATE * @@ -2583,4 +2569,4 @@ int main(int argc, char** argv) { } return RUN_ALL_TESTS(); -} \ No newline at end of file +} From ba2e505f404ab04551fa562585cffc1402b69356 Mon Sep 17 00:00:00 2001 From: Vlad Popa Date: Fri, 24 Mar 2023 16:48:13 +0000 Subject: [PATCH 860/998] CSD: Add VSR test annotation Test: m Bug: 248567177 Change-Id: Ie81669e87e8f7c4898d0ed02477d6661bc4676c5 --- .../aidl/sounddose/vts/VtsHalSoundDoseFactoryTargetTest.cpp | 1 + audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/audio/aidl/sounddose/vts/VtsHalSoundDoseFactoryTargetTest.cpp b/audio/aidl/sounddose/vts/VtsHalSoundDoseFactoryTargetTest.cpp index df35bae086..7722ccfb35 100644 --- a/audio/aidl/sounddose/vts/VtsHalSoundDoseFactoryTargetTest.cpp +++ b/audio/aidl/sounddose/vts/VtsHalSoundDoseFactoryTargetTest.cpp @@ -71,6 +71,7 @@ class SoundDoseFactory : public testing::TestWithParam { std::shared_ptr soundDoseFactory; }; +// @VsrTest = VSR-5.5-002.001 TEST_P(SoundDoseFactory, GetSoundDoseForSameModule) { const std::string module = "primary"; diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp index e790d4fcf6..b7203053fa 100644 --- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp @@ -3532,6 +3532,7 @@ ndk::ScopedAStatus AudioCoreSoundDose::NoOpHalSoundDoseCallback::onNewMelValues( return ndk::ScopedAStatus::ok(); } +// @VsrTest = VSR-5.5-002.001 TEST_P(AudioCoreSoundDose, SameInstance) { if (soundDose == nullptr) { GTEST_SKIP() << "SoundDose is not supported"; @@ -3543,6 +3544,7 @@ TEST_P(AudioCoreSoundDose, SameInstance) { << "getSoundDose must return the same interface instance across invocations"; } +// @VsrTest = VSR-5.5-002.001 TEST_P(AudioCoreSoundDose, GetSetOutputRs2UpperBound) { if (soundDose == nullptr) { GTEST_SKIP() << "SoundDose is not supported"; @@ -3557,6 +3559,7 @@ TEST_P(AudioCoreSoundDose, GetSetOutputRs2UpperBound) { EXPECT_TRUE(isSupported) << "Getting/Setting RS2 upper bound must be supported"; } +// @VsrTest = VSR-5.5-002.001 TEST_P(AudioCoreSoundDose, CheckDefaultRs2UpperBound) { if (soundDose == nullptr) { GTEST_SKIP() << "SoundDose is not supported"; @@ -3567,6 +3570,7 @@ TEST_P(AudioCoreSoundDose, CheckDefaultRs2UpperBound) { EXPECT_EQ(rs2Value, ISoundDose::DEFAULT_MAX_RS2); } +// @VsrTest = VSR-5.5-002.001 TEST_P(AudioCoreSoundDose, RegisterSoundDoseCallbackTwiceThrowsException) { if (soundDose == nullptr) { GTEST_SKIP() << "SoundDose is not supported"; @@ -3577,6 +3581,7 @@ TEST_P(AudioCoreSoundDose, RegisterSoundDoseCallbackTwiceThrowsException) { << "Registering sound dose callback twice should throw EX_ILLEGAL_STATE"; } +// @VsrTest = VSR-5.5-002.001 TEST_P(AudioCoreSoundDose, RegisterSoundDoseNullCallbackThrowsException) { if (soundDose == nullptr) { GTEST_SKIP() << "SoundDose is not supported"; From 496e3fb3775633edc16eee4b96e58512cdd0ff08 Mon Sep 17 00:00:00 2001 From: shrikar Date: Fri, 17 Mar 2023 21:36:15 +0000 Subject: [PATCH 861/998] Added HAL docs for unsupported LOCATION_CHARACTERIZATION behaviour. Bug: 271007857 Test: manual build Change-Id: Ifdb8a0752831967356b2d919a7a10c07363c72d6 --- .../hardware/automotive/vehicle/VehicleProperty.aidl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 7cd020bd31..a778bc1a38 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -2408,7 +2408,12 @@ enum VehicleProperty { * when computing the vehicle's location that is shared with Android through the GNSS HAL. * * The value must return a collection of bit flags. The bit flags are defined in - * LocationCharacterization. + * LocationCharacterization. The value must also include exactly one of DEAD_RECKONED or + * RAW_GNSS_ONLY among its collection of bit flags. + * + * When this property is not supported, it is assumed that no additional sensor inputs are fused + * into the GNSS updates provided through the GNSS HAL. That is unless otherwise specified + * through the GNSS HAL interfaces. * * @change_mode VehiclePropertyChangeMode.STATIC * @access VehiclePropertyAccess.READ From 7e62631ea455cfb5c32abf6f668f948bad5d1cfd Mon Sep 17 00:00:00 2001 From: Changyeon Jo Date: Mon, 13 Mar 2023 22:44:01 +0000 Subject: [PATCH 862/998] Revert "Revert "Add default implementation of AIDL EVS interface"" This reverts commit d12e05929a18baf5f89b7d85e5c59483d1a793d0. Bug: 218588089 Test: 1. Build cf_x86_64_auto lunch target. 2. Launch cvd in the accelerated graphics mode. 3. atest VtsHalEvsTargetTest and confirm that EVS HAL implementation passes all test cases except CameraStreamExternalBuffering that is not supported yet in new implementation. 4. Run evs_app and confirm the color bar pattern is shown on the display. > adb root && adb shell evs_app --test 5. Do the same on sdk_car_x86_64 lunch target. Change-Id: I4647d0ef7a2bd98fdfcb3833bfb060b4063bc42e --- automotive/evs/aidl/impl/default/Android.bp | 53 +- .../aidl/impl/default/evs-default-service.rc | 7 +- .../aidl/impl/default/include/ConfigManager.h | 384 +++++++ .../impl/default/include/ConfigManagerUtil.h | 62 ++ .../default/include/DefaultEvsEnumerator.h | 66 -- .../aidl/impl/default/include/EvsEnumerator.h | 134 +++ .../aidl/impl/default/include/EvsGlDisplay.h | 89 ++ .../aidl/impl/default/include/EvsMockCamera.h | 152 +++ .../evs/aidl/impl/default/include/GlWrapper.h | 79 ++ ...e.xml => manifest_evs-default-service.xml} | 6 +- .../resources/evs_mock_configuration.xml | 68 ++ .../aidl/impl/default/src/ConfigManager.cpp | 992 ++++++++++++++++++ .../impl/default/src/ConfigManagerUtil.cpp | 155 +++ .../impl/default/src/DefaultEvsEnumerator.cpp | 93 -- .../aidl/impl/default/src/EvsEnumerator.cpp | 552 ++++++++++ .../aidl/impl/default/src/EvsGlDisplay.cpp | 417 ++++++++ .../aidl/impl/default/src/EvsMockCamera.cpp | 642 ++++++++++++ .../evs/aidl/impl/default/src/GlWrapper.cpp | 465 ++++++++ .../evs/aidl/impl/default/src/service.cpp | 77 +- 19 files changed, 4302 insertions(+), 191 deletions(-) create mode 100644 automotive/evs/aidl/impl/default/include/ConfigManager.h create mode 100644 automotive/evs/aidl/impl/default/include/ConfigManagerUtil.h delete mode 100644 automotive/evs/aidl/impl/default/include/DefaultEvsEnumerator.h create mode 100644 automotive/evs/aidl/impl/default/include/EvsEnumerator.h create mode 100644 automotive/evs/aidl/impl/default/include/EvsGlDisplay.h create mode 100644 automotive/evs/aidl/impl/default/include/EvsMockCamera.h create mode 100644 automotive/evs/aidl/impl/default/include/GlWrapper.h rename automotive/evs/aidl/impl/default/{evs-default-service.xml => manifest_evs-default-service.xml} (51%) create mode 100644 automotive/evs/aidl/impl/default/resources/evs_mock_configuration.xml create mode 100644 automotive/evs/aidl/impl/default/src/ConfigManager.cpp create mode 100644 automotive/evs/aidl/impl/default/src/ConfigManagerUtil.cpp delete mode 100644 automotive/evs/aidl/impl/default/src/DefaultEvsEnumerator.cpp create mode 100644 automotive/evs/aidl/impl/default/src/EvsEnumerator.cpp create mode 100644 automotive/evs/aidl/impl/default/src/EvsGlDisplay.cpp create mode 100644 automotive/evs/aidl/impl/default/src/EvsMockCamera.cpp create mode 100644 automotive/evs/aidl/impl/default/src/GlWrapper.cpp diff --git a/automotive/evs/aidl/impl/default/Android.bp b/automotive/evs/aidl/impl/default/Android.bp index dbe0314118..bf6c0be236 100644 --- a/automotive/evs/aidl/impl/default/Android.bp +++ b/automotive/evs/aidl/impl/default/Android.bp @@ -24,13 +24,56 @@ package { cc_binary { name: "android.hardware.automotive.evs-aidl-default-service", defaults: ["EvsHalDefaults"], - local_include_dirs: ["include"], - vintf_fragments: ["evs-default-service.xml"], + vintf_fragments: ["manifest_evs-default-service.xml"], init_rc: ["evs-default-service.rc"], vendor: true, relative_install_path: "hw", - srcs: ["src/*.cpp"], - shared_libs: [ - "libbinder_ndk", + cflags: [ + "-DGL_GLEXT_PROTOTYPES", + "-DEGL_EGLEXT_PROTOTYPES", + "-Wall", + "-Wextra", + "-Werror", + "-Wthread-safety", ], + srcs: [ + ":libgui_frame_event_aidl", + "src/*.cpp" + ], + shared_libs: [ + "android.hardware.graphics.bufferqueue@1.0", + "android.hardware.graphics.bufferqueue@2.0", + "android.hidl.token@1.0-utils", + "libEGL", + "libGLESv2", + "libbase", + "libbinder_ndk", + "libbufferqueueconverter", + "libcamera_metadata", + "libhardware_legacy", + "libhidlbase", + "liblog", + "libnativewindow", + "libtinyxml2", + "libui", + "libutils", + "libyuv", + ], + static_libs: [ + "android.frameworks.automotive.display-V1-ndk", + "android.hardware.automotive.evs-V1-ndk", + "android.hardware.common-V2-ndk", + "libaidlcommonsupport", + "libcutils", + ], + local_include_dirs: ["include"], + include_dirs: ["frameworks/native/include/"], + required: ["evs_mock_hal_configuration.xml"], +} + +prebuilt_etc { + name: "evs_mock_hal_configuration.xml", + soc_specific: true, + src: "resources/evs_mock_configuration.xml", + sub_dir: "automotive/evs", } diff --git a/automotive/evs/aidl/impl/default/evs-default-service.rc b/automotive/evs/aidl/impl/default/evs-default-service.rc index ea8e6892dc..3da41ff787 100644 --- a/automotive/evs/aidl/impl/default/evs-default-service.rc +++ b/automotive/evs/aidl/impl/default/evs-default-service.rc @@ -1,5 +1,8 @@ service vendor.evs-hal-default /vendor/bin/hw/android.hardware.automotive.evs-aidl-default-service class early_hal - user automotive_evs - group automotive_evs + priority -20 + user graphics + group automotive_evs camera + onrestart restart cardisplayproxyd + onrestart restart evsmanagerd disabled diff --git a/automotive/evs/aidl/impl/default/include/ConfigManager.h b/automotive/evs/aidl/impl/default/include/ConfigManager.h new file mode 100644 index 0000000000..1d5fe772b2 --- /dev/null +++ b/automotive/evs/aidl/impl/default/include/ConfigManager.h @@ -0,0 +1,384 @@ +/* + * 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. + */ + +#pragma once + +#include "ConfigManagerUtil.h" + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +/* + * Please note that this is different from what is defined in + * libhardware/modules/camera/3_4/metadata/types.h; this has one additional + * field to store a framerate. + */ +typedef struct { + int id; + int width; + int height; + ::aidl::android::hardware::graphics::common::PixelFormat format; + int type; + int framerate; +} StreamConfiguration; + +class ConfigManager final { + public: + static std::unique_ptr Create(); + ConfigManager(const ConfigManager&) = delete; + ConfigManager& operator=(const ConfigManager&) = delete; + + /* Camera device's capabilities and metadata */ + class CameraInfo { + public: + CameraInfo() : characteristics(nullptr) {} + + virtual ~CameraInfo(); + + /* Allocate memory for camera_metadata_t */ + bool allocate(size_t entry_cap, size_t data_cap) { + if (characteristics != nullptr) { + LOG(ERROR) << "Camera metadata is already allocated"; + return false; + } + + characteristics = allocate_camera_metadata(entry_cap, data_cap); + return characteristics != nullptr; + } + + /* + * List of supported controls that the primary client can program. + * Paraemters are stored with its valid range + */ + std::unordered_map<::aidl::android::hardware::automotive::evs::CameraParam, + std::tuple> + controls; + + /* + * List of supported output stream configurations. + */ + std::unordered_map streamConfigurations; + + /* + * Internal storage for camera metadata. Each entry holds a pointer to + * data and number of elements + */ + std::unordered_map> cameraMetadata; + + /* Camera module characteristics */ + camera_metadata_t* characteristics; + }; + + class CameraGroupInfo : public CameraInfo { + public: + CameraGroupInfo() {} + + /* ID of member camera devices */ + std::unordered_set devices; + + /* The capture operation of member camera devices are synchronized */ + int32_t synchronized = 0; + }; + + class SystemInfo { + public: + /* number of available cameras */ + int32_t numCameras = 0; + }; + + class DisplayInfo { + public: + /* + * List of supported input stream configurations. + */ + std::unordered_map streamConfigurations; + }; + + /* + * Return system information + * + * @return SystemInfo + * Constant reference of SystemInfo. + */ + const SystemInfo& getSystemInfo() { + std::unique_lock lock(mConfigLock); + mConfigCond.wait(lock, [this] { return mIsReady; }); + return mSystemInfo; + } + + /* + * Return a list of camera identifiers + * + * This function assumes that it is not being called frequently. + * + * @return std::vector + * A vector that contains unique camera device identifiers. + */ + std::vector getCameraIdList() { + std::unique_lock lock(mConfigLock); + mConfigCond.wait(lock, [this] { return mIsReady; }); + + std::vector aList; + aList.reserve(mCameraInfo.size()); + for (auto&& v : mCameraInfo) { + aList.push_back(v.first); + } + + return aList; + } + + /* + * Return a list of camera group identifiers + * + * This function assumes that it is not being called frequently. + * + * @return std::vector + * A vector that contains unique camera device identifiers. + */ + std::vector getCameraGroupIdList() { + std::unique_lock lock(mConfigLock); + mConfigCond.wait(lock, [this] { return mIsReady; }); + + std::vector aList; + aList.reserve(mCameraGroups.size()); + for (auto&& v : mCameraGroups) { + aList.push_back(v.first); + } + + return aList; + } + + /* + * Return a pointer to the camera group + * + * @return CameraGroup + * A pointer to a camera group identified by a given id. + */ + std::unique_ptr& getCameraGroupInfo(const std::string& gid) { + std::unique_lock lock(mConfigLock); + mConfigCond.wait(lock, [this] { return mIsReady; }); + + return mCameraGroups[gid]; + } + + /* + * Return a camera metadata + * + * @param cameraId + * Unique camera node identifier in string + * + * @return unique_ptr + * A pointer to CameraInfo that is associated with a given camera + * ID. This returns a null pointer if this does not recognize a + * given camera identifier. + */ + std::unique_ptr& getCameraInfo(const std::string& cameraId) noexcept { + std::unique_lock lock(mConfigLock); + mConfigCond.wait(lock, [this] { return mIsReady; }); + + return mCameraInfo[cameraId]; + } + + /* + * Tell whether the configuration data is ready to be used + * + * @return bool + * True if configuration data is ready to be consumed. + */ + bool isReady() const { return mIsReady; } + + private: + /* Constructors */ + ConfigManager() : mBinaryFilePath("") {} + + static std::string_view sConfigDefaultPath; + static std::string_view sConfigOverridePath; + + /* System configuration */ + SystemInfo mSystemInfo; + + /* Internal data structure for camera device information */ + std::unordered_map> mCameraInfo; + + /* Internal data structure for camera device information */ + std::unordered_map> mDisplayInfo; + + /* Camera groups are stored in hash map */ + std::unordered_map> mCameraGroups; + + /* + * Camera positions are stored in hash map. + * The position must be one of front, rear, left, and right. + */ + std::unordered_map> mCameraPosition; + + /* Configuration data lock */ + mutable std::mutex mConfigLock; + + /* + * This condition is signalled when it completes a configuration data + * preparation. + */ + std::condition_variable mConfigCond; + + /* A path to a binary configuration file */ + const char* mBinaryFilePath; + + /* Configuration data readiness */ + bool mIsReady = false; + + /* + * Parse a given EVS configuration file and store the information + * internally. + * + * @return bool + * True if it completes parsing a file successfully. + */ + bool readConfigDataFromXML() noexcept; + + /* + * read the information of the vehicle + * + * @param aSysElem + * A pointer to "system" XML element. + */ + void readSystemInfo(const tinyxml2::XMLElement* const aSysElem); + + /* + * read the information of camera devices + * + * @param aCameraElem + * A pointer to "camera" XML element that may contain multiple + * "device" elements. + */ + void readCameraInfo(const tinyxml2::XMLElement* const aCameraElem); + + /* + * read display device information + * + * @param aDisplayElem + * A pointer to "display" XML element that may contain multiple + * "device" elements. + */ + void readDisplayInfo(const tinyxml2::XMLElement* const aDisplayElem); + + /* + * read camera device information + * + * @param aCamera + * A pointer to CameraInfo that will be completed by this + * method. + * aDeviceElem + * A pointer to "device" XML element that contains camera module + * capability info and its characteristics. + * + * @return bool + * Return false upon any failure in reading and processing camera + * device information. + */ + bool readCameraDeviceInfo(CameraInfo* aCamera, const tinyxml2::XMLElement* aDeviceElem); + + /* + * read camera metadata + * + * @param aCapElem + * A pointer to "cap" XML element. + * @param aCamera + * A pointer to CameraInfo that is being filled by this method. + * @param dataSize + * Required size of memory to store camera metadata found in this + * method. This is calculated in this method and returned to the + * caller for camera_metadata allocation. + * + * @return size_t + * Number of camera metadata entries + */ + size_t readCameraCapabilities(const tinyxml2::XMLElement* const aCapElem, CameraInfo* aCamera, + size_t& dataSize); + + /* + * read camera metadata + * + * @param aParamElem + * A pointer to "characteristics" XML element. + * @param aCamera + * A pointer to CameraInfo that is being filled by this method. + * @param dataSize + * Required size of memory to store camera metadata found in this + * method. + * + * @return size_t + * Number of camera metadata entries + */ + size_t readCameraMetadata(const tinyxml2::XMLElement* const aParamElem, CameraInfo* aCamera, + size_t& dataSize); + + /* + * construct camera_metadata_t from camera capabilities and metadata + * + * @param aCamera + * A pointer to CameraInfo that is being filled by this method. + * @param totalEntries + * Number of camera metadata entries to be added. + * @param totalDataSize + * Sum of sizes of camera metadata entries to be added. + * + * @return bool + * False if either it fails to allocate memory for camera metadata + * or its size is not large enough to add all found camera metadata + * entries. + */ + bool constructCameraMetadata(CameraInfo* aCamera, const size_t totalEntries, + const size_t totalDataSize); + + /* + * Read configuration data from the binary file + * + * @return bool + * True if it succeeds to read configuration data from a binary + * file. + */ + bool readConfigDataFromBinary(); + + /* + * Store configuration data to the file + * + * @return bool + * True if it succeeds to serialize mCameraInfo to the file. + */ + bool writeConfigDataToBinary(); + + /* + * debugging method to print out all XML elements and their attributes in + * logcat message. + * + * @param aNode + * A pointer to the root XML element to navigate. + * @param prefix + * A prefix to XML string. + */ + void printElementNames(const tinyxml2::XMLElement* aNode, const std::string& prefix = "") const; +}; diff --git a/automotive/evs/aidl/impl/default/include/ConfigManagerUtil.h b/automotive/evs/aidl/impl/default/include/ConfigManagerUtil.h new file mode 100644 index 0000000000..32b50d3332 --- /dev/null +++ b/automotive/evs/aidl/impl/default/include/ConfigManagerUtil.h @@ -0,0 +1,62 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include + +#include +#include + +class ConfigManagerUtil final { + public: + /** + * Convert a given string into V4L2_CID_* + */ + static bool convertToEvsCameraParam( + const std::string& id, + ::aidl::android::hardware::automotive::evs::CameraParam& camParam); + /** + * Convert a given string into android.hardware.graphics.common.PixelFormat + */ + static bool convertToPixelFormat(const std::string& in, + ::aidl::android::hardware::graphics::common::PixelFormat& out); + /** + * Convert a given string into corresponding camera metadata data tag defined in + * system/media/camera/include/system/camera_metadata_tags.h + */ + static bool convertToMetadataTag(const char* name, camera_metadata_tag& aTag); + /** + * Convert a given string into a floating value array + */ + static float* convertFloatArray(const char* sz, const char* vals, size_t& count, + const char delimiter = ','); + /** + * Trim a string + */ + static std::string trimString(const std::string& src, const std::string& ws = " \n\r\t\f\v"); + + /** + * Convert a given string to corresponding camera capabilities + */ + static bool convertToCameraCapability( + const char* name, camera_metadata_enum_android_request_available_capabilities_t& cap); + + DISALLOW_IMPLICIT_CONSTRUCTORS(ConfigManagerUtil); +}; diff --git a/automotive/evs/aidl/impl/default/include/DefaultEvsEnumerator.h b/automotive/evs/aidl/impl/default/include/DefaultEvsEnumerator.h deleted file mode 100644 index 03a578d954..0000000000 --- a/automotive/evs/aidl/impl/default/include/DefaultEvsEnumerator.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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. - */ - -#ifndef android_hardware_automotive_evs_aidl_impl_evshal_include_DefaultEvsHal_H_ -#define android_hardware_automotive_evs_aidl_impl_evshal_include_DefaultEvsHal_H_ - -#include - -namespace aidl::android::hardware::automotive::evs::implementation { - -class DefaultEvsEnumerator final - : public ::aidl::android::hardware::automotive::evs::BnEvsEnumerator { - ::ndk::ScopedAStatus isHardware(bool* flag) override; - ::ndk::ScopedAStatus openCamera( - const std::string& cameraId, - const ::aidl::android::hardware::automotive::evs::Stream& streamConfig, - std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsCamera>* obj) override; - ::ndk::ScopedAStatus closeCamera( - const std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsCamera>& obj) - override; - ::ndk::ScopedAStatus getCameraList( - std::vector<::aidl::android::hardware::automotive::evs::CameraDesc>* list) override; - ::ndk::ScopedAStatus getStreamList( - const ::aidl::android::hardware::automotive::evs::CameraDesc& desc, - std::vector<::aidl::android::hardware::automotive::evs::Stream>* _aidl_return) override; - ::ndk::ScopedAStatus openDisplay( - int32_t displayId, - std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsDisplay>* obj) override; - ::ndk::ScopedAStatus closeDisplay( - const std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsDisplay>& obj) - override; - ::ndk::ScopedAStatus getDisplayIdList(std::vector* list) override; - ::ndk::ScopedAStatus getDisplayState( - ::aidl::android::hardware::automotive::evs::DisplayState* state) override; - ::ndk::ScopedAStatus registerStatusCallback( - const std::shared_ptr< - ::aidl::android::hardware::automotive::evs::IEvsEnumeratorStatusCallback>& - callback) override; - ::ndk::ScopedAStatus openUltrasonicsArray( - const std::string& id, - std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsUltrasonicsArray>* obj) - override; - ::ndk::ScopedAStatus closeUltrasonicsArray( - const std::shared_ptr<::aidl::android::hardware::automotive::evs::IEvsUltrasonicsArray>& - arr) override; - ::ndk::ScopedAStatus getUltrasonicsArrayList( - std::vector<::aidl::android::hardware::automotive::evs::UltrasonicsArrayDesc>* list) - override; -}; - -} // namespace aidl::android::hardware::automotive::evs::implementation - -#endif // android_hardware_automotive_evs_aidl_impl_evshal_include_DefaultEvsHal_H_ diff --git a/automotive/evs/aidl/impl/default/include/EvsEnumerator.h b/automotive/evs/aidl/impl/default/include/EvsEnumerator.h new file mode 100644 index 0000000000..b11dd3ee80 --- /dev/null +++ b/automotive/evs/aidl/impl/default/include/EvsEnumerator.h @@ -0,0 +1,134 @@ +/* + * 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. + */ + +#pragma once + +#include "ConfigManager.h" +#include "EvsGlDisplay.h" +#include "EvsMockCamera.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace aidl::android::hardware::automotive::evs::implementation { + +class EvsEnumerator final : public ::aidl::android::hardware::automotive::evs::BnEvsEnumerator { + public: + // Methods from ::aidl::android::hardware::automotive::evs::IEvsEnumerator + ndk::ScopedAStatus isHardware(bool* flag) override; + ndk::ScopedAStatus openCamera(const std::string& cameraId, const evs::Stream& streamConfig, + std::shared_ptr* obj) override; + ndk::ScopedAStatus closeCamera(const std::shared_ptr& obj) override; + ndk::ScopedAStatus getCameraList(std::vector* _aidl_return) override; + ndk::ScopedAStatus getStreamList(const evs::CameraDesc& desc, + std::vector* _aidl_return) override; + ndk::ScopedAStatus openDisplay(int32_t displayId, + std::shared_ptr* obj) override; + ndk::ScopedAStatus closeDisplay(const std::shared_ptr& obj) override; + ndk::ScopedAStatus getDisplayIdList(std::vector* list) override; + ndk::ScopedAStatus getDisplayState(evs::DisplayState* state) override; + ndk::ScopedAStatus registerStatusCallback( + const std::shared_ptr& callback) override; + ndk::ScopedAStatus openUltrasonicsArray( + const std::string& id, std::shared_ptr* obj) override; + ndk::ScopedAStatus closeUltrasonicsArray( + const std::shared_ptr& obj) override; + ndk::ScopedAStatus getUltrasonicsArrayList( + std::vector* list) override; + + // Implementation details + EvsEnumerator(const std::shared_ptr< + ::aidl::android::frameworks::automotive::display::ICarDisplayProxy>& + proxyService); + + void notifyDeviceStatusChange(const std::string_view& deviceName, evs::DeviceStatusType type); + + private: + struct CameraRecord { + evs::CameraDesc desc; + std::weak_ptr activeInstance; + + CameraRecord(const char* cameraId) : desc() { desc.id = cameraId; } + }; + + class ActiveDisplays { + public: + struct DisplayInfo { + int32_t id{-1}; + std::weak_ptr displayWeak; + uintptr_t internalDisplayRawAddr; + }; + + std::optional popDisplay(int32_t id); + + std::optional popDisplay(const std::shared_ptr& display); + + std::unordered_map getAllDisplays(); + + bool tryInsert(int32_t id, const std::shared_ptr& display); + + private: + std::mutex mMutex; + std::unordered_map mIdToDisplay GUARDED_BY(mMutex); + std::unordered_map mDisplayToId GUARDED_BY(mMutex); + }; + + bool checkPermission(); + void closeCamera_impl(const std::shared_ptr& pCamera, + const std::string& cameraId); + + static bool qualifyCaptureDevice(const char* deviceName); + static CameraRecord* findCameraById(const std::string& cameraId); + static void enumerateCameras(); + static bool addCaptureDevice(const std::string& deviceName); + static bool removeCaptureDevice(const std::string& deviceName); + // Enumerate available displays and return an id of the internal display + static uint64_t enumerateDisplays(); + + static ActiveDisplays& mutableActiveDisplays(); + + // NOTE: All members values are static so that all clients operate on the same state + // That is to say, this is effectively a singleton despite the fact that HIDL + // constructs a new instance for each client. + // Because our server has a single thread in the thread pool, these values are + // never accessed concurrently despite potentially having multiple instance objects + // using them. + static std::unordered_map sCameraList; + // Object destructs if client dies. + static std::mutex sLock; // Mutex on shared camera device list. + static std::condition_variable sCameraSignal; // Signal on camera device addition. + static std::unique_ptr sConfigManager; // ConfigManager + static std::shared_ptr<::aidl::android::frameworks::automotive::display::ICarDisplayProxy> + sDisplayProxy; + static std::unordered_map sDisplayPortList; + + uint64_t mInternalDisplayId; + std::shared_ptr mCallback; +}; + +} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/include/EvsGlDisplay.h b/automotive/evs/aidl/impl/default/include/EvsGlDisplay.h new file mode 100644 index 0000000000..ceabd9e863 --- /dev/null +++ b/automotive/evs/aidl/impl/default/include/EvsGlDisplay.h @@ -0,0 +1,89 @@ +/* + * 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. + */ + +#pragma once + +#include "GlWrapper.h" + +#include +#include +#include +#include +#include + +#include + +namespace aidl::android::hardware::automotive::evs::implementation { + +class EvsGlDisplay final : public BnEvsDisplay { + public: + // Methods from ::aidl::android::hardware::automotive::evs::IEvsDisplay + // follow. + ndk::ScopedAStatus getDisplayInfo(evs::DisplayDesc* _aidl_return) override; + ndk::ScopedAStatus getDisplayState(evs::DisplayState* _aidl_return) override; + ndk::ScopedAStatus getTargetBuffer(evs::BufferDesc* _aidl_return) override; + ndk::ScopedAStatus returnTargetBufferForDisplay(const evs::BufferDesc& buffer) override; + ndk::ScopedAStatus setDisplayState(evs::DisplayState state) override; + + // Implementation details + EvsGlDisplay(const std::shared_ptr& service, + uint64_t displayId); + virtual ~EvsGlDisplay() override; + + // This gets called if another caller "steals" ownership of the display + void forceShutdown(); + + private: + // A graphics buffer into which we'll store images. This member variable + // will be protected by semaphores. + struct BufferRecord { + ::aidl::android::hardware::graphics::common::HardwareBufferDescription description; + buffer_handle_t handle; + int fingerprint; + } mBuffer; + + // State of a rendering thread + enum RenderThreadStates { + STOPPED = 0, + STOPPING = 1, + RUN = 2, + }; + + uint64_t mDisplayId; + evs::DisplayDesc mInfo; + evs::DisplayState mRequestedState GUARDED_BY(mLock) = evs::DisplayState::NOT_VISIBLE; + std::shared_ptr mDisplayProxy; + + GlWrapper mGlWrapper; + mutable std::mutex mLock; + + // This tells us whether or not our buffer is in use. Protected by + // semaphores. + bool mBufferBusy = false; + + // Variables to synchronize a rendering thread w/ main and binder threads + std::thread mRenderThread; + RenderThreadStates mState GUARDED_BY(mLock) = STOPPED; + bool mBufferReady = false; + void renderFrames(); + bool initializeGlContextLocked() REQUIRES(mLock); + + std::condition_variable mBufferReadyToUse; + std::condition_variable mBufferReadyToRender; + std::condition_variable mBufferDone; +}; + +} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/include/EvsMockCamera.h b/automotive/evs/aidl/impl/default/include/EvsMockCamera.h new file mode 100644 index 0000000000..46d47e77a2 --- /dev/null +++ b/automotive/evs/aidl/impl/default/include/EvsMockCamera.h @@ -0,0 +1,152 @@ +/* + * 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. + */ + +#pragma once + +#include "ConfigManager.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +// #include +#include +#include + +#include +#include + +namespace aidl::android::hardware::automotive::evs::implementation { + +class EvsMockCamera : public evs::BnEvsCamera { + // This prevents constructors from direct access while it allows this class to + // be instantiated via ndk::SharedRefBase::make<>. + private: + struct Sigil { + explicit Sigil() = default; + }; + + public: + // Methods from ::android::hardware::automotive::evs::IEvsCamera follow. + ndk::ScopedAStatus doneWithFrame(const std::vector& buffers) override; + ndk::ScopedAStatus forcePrimaryClient( + const std::shared_ptr& display) override; + ndk::ScopedAStatus getCameraInfo(evs::CameraDesc* _aidl_return) override; + ndk::ScopedAStatus getExtendedInfo(int32_t opaqueIdentifier, + std::vector* value) override; + ndk::ScopedAStatus getIntParameter(evs::CameraParam id, std::vector* value) override; + ndk::ScopedAStatus getIntParameterRange(evs::CameraParam id, + evs::ParameterRange* _aidl_return) override; + ndk::ScopedAStatus getParameterList(std::vector* _aidl_return) override; + ndk::ScopedAStatus getPhysicalCameraInfo(const std::string& deviceId, + evs::CameraDesc* _aidl_return) override; + ndk::ScopedAStatus importExternalBuffers(const std::vector& buffers, + int32_t* _aidl_return) override; + ndk::ScopedAStatus pauseVideoStream() override; + ndk::ScopedAStatus resumeVideoStream() override; + ndk::ScopedAStatus setExtendedInfo(int32_t opaqueIdentifier, + const std::vector& opaqueValue) override; + ndk::ScopedAStatus setIntParameter(evs::CameraParam id, int32_t value, + std::vector* effectiveValue) override; + ndk::ScopedAStatus setPrimaryClient() override; + ndk::ScopedAStatus setMaxFramesInFlight(int32_t bufferCount) override; + ndk::ScopedAStatus startVideoStream( + const std::shared_ptr& receiver) override; + ndk::ScopedAStatus stopVideoStream() override; + ndk::ScopedAStatus unsetPrimaryClient() override; + + static std::shared_ptr Create(const char* deviceName); + static std::shared_ptr Create( + const char* deviceName, std::unique_ptr& camInfo, + const evs::Stream* streamCfg = nullptr); + EvsMockCamera(const EvsMockCamera&) = delete; + EvsMockCamera& operator=(const EvsMockCamera&) = delete; + + virtual ~EvsMockCamera() override; + void shutdown(); + + const evs::CameraDesc& getDesc() { return mDescription; } + + // Constructors + EvsMockCamera(Sigil sigil, const char* deviceName, + std::unique_ptr& camInfo); + + private: + // These three functions are expected to be called while mAccessLock is held + bool setAvailableFrames_Locked(unsigned bufferCount); + unsigned increaseAvailableFrames_Locked(unsigned numToAdd); + unsigned decreaseAvailableFrames_Locked(unsigned numToRemove); + + void generateFrames(); + void fillMockFrame(buffer_handle_t handle, const AHardwareBuffer_Desc* pDesc); + void returnBufferLocked(const uint32_t bufferId); + ndk::ScopedAStatus stopVideoStream_impl(); + + CameraDesc mDescription = {}; // The properties of this camera + + std::thread mCaptureThread; // The thread we'll use to synthesize frames + + // The callback used to deliver each frame + std::shared_ptr mStream; + + // Horizontal pixel count in the buffers + uint32_t mWidth = 0; + // Vertical pixel count in the buffers + uint32_t mHeight = 0; + // Values from android_pixel_format_t + uint32_t mFormat = HAL_PIXEL_FORMAT_RGBA_8888; + // Values from from Gralloc.h + uint64_t mUsage = + GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_OFTEN; + // Bytes per line in the buffers + uint32_t mStride = 0; + + struct BufferRecord { + buffer_handle_t handle; + bool inUse; + + explicit BufferRecord(buffer_handle_t h) : handle(h), inUse(false){}; + }; + + std::vector mBuffers; // Graphics buffers to transfer images + unsigned mFramesAllowed; // How many buffers are we currently using + unsigned mFramesInUse; // How many buffers are currently outstanding + + enum StreamStateValues { + STOPPED, + RUNNING, + STOPPING, + DEAD, + }; + StreamStateValues mStreamState; + + // Synchronization necessary to deconflict mCaptureThread from the main service thread + std::mutex mAccessLock; + + // Static camera module information + std::unique_ptr& mCameraInfo; + + // For the extended info + std::unordered_map> mExtInfo; + std::unordered_map mParams; +}; + +} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/include/GlWrapper.h b/automotive/evs/aidl/impl/default/include/GlWrapper.h new file mode 100644 index 0000000000..adb250c8e1 --- /dev/null +++ b/automotive/evs/aidl/impl/default/include/GlWrapper.h @@ -0,0 +1,79 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace aidl::android::hardware::automotive::evs::implementation { + +namespace automotivedisplay = ::aidl::android::frameworks::automotive::display; + +class GlWrapper { + public: + GlWrapper() : mSurfaceHolder(::android::SurfaceHolderUniquePtr(nullptr, nullptr)) {} + bool initialize(const std::shared_ptr& svc, + uint64_t displayId); + void shutdown(); + + bool updateImageTexture( + buffer_handle_t handle, + const ::aidl::android::hardware::graphics::common::HardwareBufferDescription& + description); + void renderImageToScreen(); + + void showWindow(const std::shared_ptr& svc, + uint64_t displayId); + void hideWindow(const std::shared_ptr& svc, + uint64_t displayId); + + unsigned getWidth() { return mWidth; }; + unsigned getHeight() { return mHeight; }; + + private: + ::android::sp<::android::hardware::graphics::bufferqueue::V2_0::IGraphicBufferProducer> + mGfxBufferProducer; + + EGLDisplay mDisplay; + EGLSurface mSurface; + EGLContext mContext; + + unsigned mWidth = 0; + unsigned mHeight = 0; + + EGLImageKHR mKHRimage = EGL_NO_IMAGE_KHR; + + GLuint mTextureMap = 0; + GLuint mShaderProgram = 0; + + // Opaque handle for a native hardware buffer defined in + // frameworks/native/opengl/include/EGL/eglplatform.h + ANativeWindow* mWindow; + + // Pointer to a Surface wrapper. + ::android::SurfaceHolderUniquePtr mSurfaceHolder; +}; + +} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/evs-default-service.xml b/automotive/evs/aidl/impl/default/manifest_evs-default-service.xml similarity index 51% rename from automotive/evs/aidl/impl/default/evs-default-service.xml rename to automotive/evs/aidl/impl/default/manifest_evs-default-service.xml index 96ff9f6576..50692f7d5d 100644 --- a/automotive/evs/aidl/impl/default/evs-default-service.xml +++ b/automotive/evs/aidl/impl/default/manifest_evs-default-service.xml @@ -1,11 +1,7 @@ android.hardware.automotive.evs - hwbinder + IEvsEnumerator/hw/0 1 - - IEvsEnumerator - hw/0 - diff --git a/automotive/evs/aidl/impl/default/resources/evs_mock_configuration.xml b/automotive/evs/aidl/impl/default/resources/evs_mock_configuration.xml new file mode 100644 index 0000000000..6cbc18eacf --- /dev/null +++ b/automotive/evs/aidl/impl/default/resources/evs_mock_configuration.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/automotive/evs/aidl/impl/default/src/ConfigManager.cpp b/automotive/evs/aidl/impl/default/src/ConfigManager.cpp new file mode 100644 index 0000000000..da791ed0b9 --- /dev/null +++ b/automotive/evs/aidl/impl/default/src/ConfigManager.cpp @@ -0,0 +1,992 @@ +/* + * 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. + */ + +#include "ConfigManager.h" + +#include +#include +#include + +#include +#include +#include +#include + +namespace { + +using ::aidl::android::hardware::automotive::evs::CameraParam; +using ::aidl::android::hardware::graphics::common::PixelFormat; +using ::tinyxml2::XMLAttribute; +using ::tinyxml2::XMLDocument; +using ::tinyxml2::XMLElement; + +} // namespace + +std::string_view ConfigManager::sConfigDefaultPath = + "/vendor/etc/automotive/evs/evs_mock_hal_configuration.xml"; +std::string_view ConfigManager::sConfigOverridePath = + "/vendor/etc/automotive/evs/evs_configuration_override.xml"; + +void ConfigManager::printElementNames(const XMLElement* rootElem, const std::string& prefix) const { + const XMLElement* curElem = rootElem; + + while (curElem != nullptr) { + LOG(VERBOSE) << "[ELEM] " << prefix << curElem->Name(); + const XMLAttribute* curAttr = curElem->FirstAttribute(); + while (curAttr) { + LOG(VERBOSE) << "[ATTR] " << prefix << curAttr->Name() << ": " << curAttr->Value(); + curAttr = curAttr->Next(); + } + + /* recursively go down to descendants */ + printElementNames(curElem->FirstChildElement(), prefix + "\t"); + + curElem = curElem->NextSiblingElement(); + } +} + +void ConfigManager::readCameraInfo(const XMLElement* const aCameraElem) { + if (aCameraElem == nullptr) { + LOG(WARNING) << "XML file does not have required camera element"; + return; + } + + const XMLElement* curElem = aCameraElem->FirstChildElement(); + while (curElem != nullptr) { + if (!strcmp(curElem->Name(), "group")) { + /* camera group identifier */ + const char* id = curElem->FindAttribute("id")->Value(); + + /* create a camera group to be filled */ + CameraGroupInfo* aCamera = new CameraGroupInfo(); + + /* read camera device information */ + if (!readCameraDeviceInfo(aCamera, curElem)) { + LOG(WARNING) << "Failed to read a camera information of " << id; + delete aCamera; + continue; + } + + /* camera group synchronization */ + const char* sync = curElem->FindAttribute("synchronized")->Value(); + if (!strcmp(sync, "CALIBRATED")) { + aCamera->synchronized = ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED; + } else if (!strcmp(sync, "APPROXIMATE")) { + aCamera->synchronized = ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE; + } else { + aCamera->synchronized = 0; // Not synchronized + } + + /* add a group to hash map */ + mCameraGroups.insert_or_assign(id, std::unique_ptr(aCamera)); + } else if (!std::strcmp(curElem->Name(), "device")) { + /* camera unique identifier */ + const char* id = curElem->FindAttribute("id")->Value(); + + /* camera mount location */ + const char* pos = curElem->FindAttribute("position")->Value(); + + /* create a camera device to be filled */ + CameraInfo* aCamera = new CameraInfo(); + + /* read camera device information */ + if (!readCameraDeviceInfo(aCamera, curElem)) { + LOG(WARNING) << "Failed to read a camera information of " << id; + delete aCamera; + continue; + } + + /* store read camera module information */ + mCameraInfo.insert_or_assign(id, std::unique_ptr(aCamera)); + + /* assign a camera device to a position group */ + mCameraPosition[pos].insert(id); + } else { + /* ignore other device types */ + LOG(DEBUG) << "Unknown element " << curElem->Name() << " is ignored"; + } + + curElem = curElem->NextSiblingElement(); + } +} + +bool ConfigManager::readCameraDeviceInfo(CameraInfo* aCamera, const XMLElement* aDeviceElem) { + if (aCamera == nullptr || aDeviceElem == nullptr) { + return false; + } + + /* size information to allocate camera_metadata_t */ + size_t totalEntries = 0; + size_t totalDataSize = 0; + + /* read device capabilities */ + totalEntries += + readCameraCapabilities(aDeviceElem->FirstChildElement("caps"), aCamera, totalDataSize); + + /* read camera metadata */ + totalEntries += readCameraMetadata(aDeviceElem->FirstChildElement("characteristics"), aCamera, + totalDataSize); + + /* construct camera_metadata_t */ + if (!constructCameraMetadata(aCamera, totalEntries, totalDataSize)) { + LOG(WARNING) << "Either failed to allocate memory or " + << "allocated memory was not large enough"; + } + + return true; +} + +size_t ConfigManager::readCameraCapabilities(const XMLElement* const aCapElem, CameraInfo* aCamera, + size_t& dataSize) { + if (aCapElem == nullptr || aCamera == nullptr) { + return 0; + } + + std::string token; + const XMLElement* curElem = nullptr; + + /* a list of supported camera parameters/controls */ + curElem = aCapElem->FirstChildElement("supported_controls"); + if (curElem != nullptr) { + const XMLElement* ctrlElem = curElem->FirstChildElement("control"); + while (ctrlElem != nullptr) { + const char* nameAttr = ctrlElem->FindAttribute("name")->Value(); + int32_t minVal = INT32_MIN, maxVal = INT32_MAX; + if (!android::base::ParseInt(ctrlElem->FindAttribute("min")->Value(), &minVal)) { + LOG(WARNING) << "Failed to parse " << ctrlElem->FindAttribute("min")->Value(); + } + + if (!android::base::ParseInt(ctrlElem->FindAttribute("max")->Value(), &maxVal)) { + LOG(WARNING) << "Failed to parse " << ctrlElem->FindAttribute("max")->Value(); + } + + int32_t stepVal = 1; + const XMLAttribute* stepAttr = ctrlElem->FindAttribute("step"); + if (stepAttr != nullptr) { + if (!android::base::ParseInt(stepAttr->Value(), &stepVal)) { + LOG(WARNING) << "Failed to parse " << stepAttr->Value(); + } + } + + CameraParam aParam; + if (ConfigManagerUtil::convertToEvsCameraParam(nameAttr, aParam)) { + aCamera->controls.insert_or_assign( + aParam, std::move(std::make_tuple(minVal, maxVal, stepVal))); + } + + ctrlElem = ctrlElem->NextSiblingElement("control"); + } + } + + /* a list of camera stream configurations */ + curElem = aCapElem->FirstChildElement("stream"); + while (curElem != nullptr) { + /* read 5 attributes */ + const XMLAttribute* idAttr = curElem->FindAttribute("id"); + const XMLAttribute* widthAttr = curElem->FindAttribute("width"); + const XMLAttribute* heightAttr = curElem->FindAttribute("height"); + const XMLAttribute* fmtAttr = curElem->FindAttribute("format"); + const XMLAttribute* fpsAttr = curElem->FindAttribute("framerate"); + + int32_t id = -1; + int32_t framerate = 0; + if (!android::base::ParseInt(idAttr->Value(), &id)) { + LOG(WARNING) << "Failed to parse " << idAttr->Value(); + } + if (fpsAttr != nullptr) { + if (!android::base::ParseInt(fpsAttr->Value(), &framerate)) { + LOG(WARNING) << "Failed to parse " << fpsAttr->Value(); + } + } + + PixelFormat format = PixelFormat::UNSPECIFIED; + if (ConfigManagerUtil::convertToPixelFormat(fmtAttr->Value(), format)) { + StreamConfiguration cfg = { + .id = id, + .format = format, + .type = ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, + .framerate = framerate, + }; + + if (!android::base::ParseInt(widthAttr->Value(), &cfg.width) || + !android::base::ParseInt(heightAttr->Value(), &cfg.height)) { + LOG(WARNING) << "Failed to parse " << widthAttr->Value() << " and " + << heightAttr->Value(); + } + aCamera->streamConfigurations.insert_or_assign(id, cfg); + } + + curElem = curElem->NextSiblingElement("stream"); + } + + dataSize = calculate_camera_metadata_entry_data_size( + get_camera_metadata_tag_type(ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS), + aCamera->streamConfigurations.size() * sizeof(StreamConfiguration)); + + /* a single camera metadata entry contains multiple stream configurations */ + return dataSize > 0 ? 1 : 0; +} + +size_t ConfigManager::readCameraMetadata(const XMLElement* const aParamElem, CameraInfo* aCamera, + size_t& dataSize) { + if (aParamElem == nullptr || aCamera == nullptr) { + return 0; + } + + const XMLElement* curElem = aParamElem->FirstChildElement("parameter"); + size_t numEntries = 0; + camera_metadata_tag_t tag; + while (curElem != nullptr) { + if (ConfigManagerUtil::convertToMetadataTag(curElem->FindAttribute("name")->Value(), tag)) { + switch (tag) { + case ANDROID_LENS_DISTORTION: + case ANDROID_LENS_POSE_ROTATION: + case ANDROID_LENS_POSE_TRANSLATION: + case ANDROID_LENS_INTRINSIC_CALIBRATION: { + /* float[] */ + size_t count = 0; + void* data = ConfigManagerUtil::convertFloatArray( + curElem->FindAttribute("size")->Value(), + curElem->FindAttribute("value")->Value(), count); + + aCamera->cameraMetadata.insert_or_assign(tag, std::make_pair(data, count)); + + ++numEntries; + dataSize += calculate_camera_metadata_entry_data_size( + get_camera_metadata_tag_type(tag), count); + + break; + } + + case ANDROID_REQUEST_AVAILABLE_CAPABILITIES: { + camera_metadata_enum_android_request_available_capabilities_t* data = + new camera_metadata_enum_android_request_available_capabilities_t[1]; + if (ConfigManagerUtil::convertToCameraCapability( + curElem->FindAttribute("value")->Value(), *data)) { + aCamera->cameraMetadata.insert_or_assign(tag, + std::make_pair((void*)data, 1)); + + ++numEntries; + dataSize += calculate_camera_metadata_entry_data_size( + get_camera_metadata_tag_type(tag), 1); + } + break; + } + + case ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS: { + /* a comma-separated list of physical camera devices */ + size_t len = strlen(curElem->FindAttribute("value")->Value()); + char* data = new char[len + 1]; + memcpy(data, curElem->FindAttribute("value")->Value(), len * sizeof(char)); + + /* replace commas with null char */ + char* p = data; + while (*p != '\0') { + if (*p == ',') { + *p = '\0'; + } + ++p; + } + + aCamera->cameraMetadata.insert_or_assign(tag, + std::make_pair((void*)data, len + 1)); + + ++numEntries; + dataSize += calculate_camera_metadata_entry_data_size( + get_camera_metadata_tag_type(tag), len); + break; + } + + /* TODO(b/140416878): add vendor-defined/custom tag support */ + default: + LOG(WARNING) << "Parameter " << curElem->FindAttribute("name")->Value() + << " is not supported"; + break; + } + } else { + LOG(WARNING) << "Unsupported metadata tag " << curElem->FindAttribute("name")->Value() + << " is found."; + } + + curElem = curElem->NextSiblingElement("parameter"); + } + + return numEntries; +} + +bool ConfigManager::constructCameraMetadata(CameraInfo* aCamera, size_t totalEntries, + size_t totalDataSize) { + if (aCamera == nullptr || !aCamera->allocate(totalEntries, totalDataSize)) { + LOG(ERROR) << "Failed to allocate memory for camera metadata"; + return false; + } + + const size_t numStreamConfigs = aCamera->streamConfigurations.size(); + std::unique_ptr data(new int32_t[sizeof(StreamConfiguration) * numStreamConfigs]); + int32_t* ptr = data.get(); + for (auto& cfg : aCamera->streamConfigurations) { + memcpy(ptr, &cfg.second, sizeof(StreamConfiguration)); + ptr += sizeof(StreamConfiguration); + } + int32_t err = add_camera_metadata_entry( + aCamera->characteristics, ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, data.get(), + numStreamConfigs * sizeof(StreamConfiguration)); + + if (err) { + LOG(ERROR) << "Failed to add stream configurations to metadata, ignored"; + return false; + } + + bool success = true; + for (auto& [tag, entry] : aCamera->cameraMetadata) { + /* try to add new camera metadata entry */ + int32_t err = + add_camera_metadata_entry(aCamera->characteristics, tag, entry.first, entry.second); + if (err) { + LOG(ERROR) << "Failed to add an entry with a tag, " << std::hex << tag; + + /* may exceed preallocated capacity */ + LOG(ERROR) << "Camera metadata has " + << get_camera_metadata_entry_count(aCamera->characteristics) << " / " + << get_camera_metadata_entry_capacity(aCamera->characteristics) + << " entries and " + << get_camera_metadata_data_count(aCamera->characteristics) << " / " + << get_camera_metadata_data_capacity(aCamera->characteristics) + << " bytes are filled."; + LOG(ERROR) << "\tCurrent metadata entry requires " + << calculate_camera_metadata_entry_data_size(tag, entry.second) << " bytes."; + + success = false; + } + } + + LOG(VERBOSE) << "Camera metadata has " + << get_camera_metadata_entry_count(aCamera->characteristics) << " / " + << get_camera_metadata_entry_capacity(aCamera->characteristics) << " entries and " + << get_camera_metadata_data_count(aCamera->characteristics) << " / " + << get_camera_metadata_data_capacity(aCamera->characteristics) + << " bytes are filled."; + return success; +} + +void ConfigManager::readSystemInfo(const XMLElement* const aSysElem) { + if (aSysElem == nullptr) { + return; + } + + /* + * Please note that this function assumes that a given system XML element + * and its child elements follow DTD. If it does not, it will cause a + * segmentation fault due to the failure of finding expected attributes. + */ + + /* read number of cameras available in the system */ + const XMLElement* xmlElem = aSysElem->FirstChildElement("num_cameras"); + if (xmlElem != nullptr) { + if (!android::base::ParseInt(xmlElem->FindAttribute("value")->Value(), + &mSystemInfo.numCameras)) { + LOG(WARNING) << "Failed to parse " << xmlElem->FindAttribute("value")->Value(); + } + } +} + +void ConfigManager::readDisplayInfo(const XMLElement* const aDisplayElem) { + if (aDisplayElem == nullptr) { + LOG(WARNING) << "XML file does not have required camera element"; + return; + } + + const XMLElement* curDev = aDisplayElem->FirstChildElement("device"); + while (curDev != nullptr) { + const char* id = curDev->FindAttribute("id")->Value(); + std::unique_ptr dpy(new DisplayInfo()); + if (dpy == nullptr) { + LOG(ERROR) << "Failed to allocate memory for DisplayInfo"; + return; + } + + const XMLElement* cap = curDev->FirstChildElement("caps"); + if (cap != nullptr) { + const XMLElement* curStream = cap->FirstChildElement("stream"); + while (curStream != nullptr) { + /* read 4 attributes */ + const XMLAttribute* idAttr = curStream->FindAttribute("id"); + const XMLAttribute* widthAttr = curStream->FindAttribute("width"); + const XMLAttribute* heightAttr = curStream->FindAttribute("height"); + const XMLAttribute* fmtAttr = curStream->FindAttribute("format"); + + int32_t id = -1; + if (!android::base::ParseInt(idAttr->Value(), &id)) { + LOG(WARNING) << "Failed to parse " << idAttr->Value(); + } + PixelFormat format = PixelFormat::UNSPECIFIED; + if (ConfigManagerUtil::convertToPixelFormat(fmtAttr->Value(), format)) { + StreamConfiguration cfg = { + .id = id, + .format = format, + .type = ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT, + }; + if (!android::base::ParseInt(widthAttr->Value(), &cfg.width) || + !android::base::ParseInt(heightAttr->Value(), &cfg.height)) { + LOG(WARNING) << "Failed to parse " << widthAttr->Value() << " and " + << heightAttr->Value(); + } + dpy->streamConfigurations.insert_or_assign(id, cfg); + } + + curStream = curStream->NextSiblingElement("stream"); + } + } + + mDisplayInfo.insert_or_assign(id, std::move(dpy)); + curDev = curDev->NextSiblingElement("device"); + } + + return; +} + +bool ConfigManager::readConfigDataFromXML() noexcept { + XMLDocument xmlDoc; + + const int64_t parsingStart = android::elapsedRealtimeNano(); + + /* load and parse a configuration file */ + xmlDoc.LoadFile(sConfigOverridePath.data()); + if (xmlDoc.ErrorID() != tinyxml2::XML_SUCCESS) { + xmlDoc.LoadFile(sConfigDefaultPath.data()); + if (xmlDoc.ErrorID() != tinyxml2::XML_SUCCESS) { + LOG(ERROR) << "Failed to load and/or parse a configuration file, " << xmlDoc.ErrorStr(); + return false; + } + } + + /* retrieve the root element */ + const XMLElement* rootElem = xmlDoc.RootElement(); + if (std::strcmp(rootElem->Name(), "configuration") != 0) { + LOG(ERROR) << "A configuration file is not in the required format. " + << "See /etc/automotive/evs/evs_configuration.dtd"; + return false; + } + + std::unique_lock lock(mConfigLock); + + /* + * parse camera information; this needs to be done before reading system + * information + */ + readCameraInfo(rootElem->FirstChildElement("camera")); + + /* parse system information */ + readSystemInfo(rootElem->FirstChildElement("system")); + + /* parse display information */ + readDisplayInfo(rootElem->FirstChildElement("display")); + + /* configuration data is ready to be consumed */ + mIsReady = true; + + /* notify that configuration data is ready */ + lock.unlock(); + mConfigCond.notify_all(); + + const int64_t parsingEnd = android::elapsedRealtimeNano(); + LOG(INFO) << "Parsing configuration file takes " << std::scientific + << (double)(parsingEnd - parsingStart) / 1000000.0 << " ms."; + + return true; +} + +bool ConfigManager::readConfigDataFromBinary() { + /* Temporary buffer to hold configuration data read from a binary file */ + char mBuffer[1024]; + + std::fstream srcFile; + const int64_t readStart = android::elapsedRealtimeNano(); + + srcFile.open(mBinaryFilePath, std::fstream::in | std::fstream::binary); + if (!srcFile) { + LOG(ERROR) << "Failed to open a source binary file, " << mBinaryFilePath; + return false; + } + + std::unique_lock lock(mConfigLock); + mIsReady = false; + + /* read configuration data into the internal buffer */ + srcFile.read(mBuffer, sizeof(mBuffer)); + LOG(VERBOSE) << __FUNCTION__ << ": " << srcFile.gcount() << " bytes are read."; + char* p = mBuffer; + size_t sz = 0; + + /* read number of camera group information entries */ + const size_t ngrps = *(reinterpret_cast(p)); + p += sizeof(size_t); + + /* read each camera information entry */ + for (size_t cidx = 0; cidx < ngrps; ++cidx) { + /* read camera identifier */ + std::string cameraId = *(reinterpret_cast(p)); + p += sizeof(std::string); + + /* size of camera_metadata_t */ + const size_t num_entry = *(reinterpret_cast(p)); + p += sizeof(size_t); + const size_t num_data = *(reinterpret_cast(p)); + p += sizeof(size_t); + + /* create CameraInfo and add it to hash map */ + std::unique_ptr aCamera; + if (aCamera == nullptr || !aCamera->allocate(num_entry, num_data)) { + LOG(ERROR) << "Failed to create new CameraInfo object"; + mCameraInfo.clear(); + return false; + } + + /* controls */ + typedef struct { + CameraParam cid; + int32_t min; + int32_t max; + int32_t step; + } CameraCtrl; + sz = *(reinterpret_cast(p)); + p += sizeof(size_t); + CameraCtrl* ptr = reinterpret_cast(p); + for (size_t idx = 0; idx < sz; ++idx) { + CameraCtrl temp = *ptr++; + aCamera->controls.insert_or_assign( + temp.cid, std::move(std::make_tuple(temp.min, temp.max, temp.step))); + } + p = reinterpret_cast(ptr); + + /* stream configurations */ + sz = *(reinterpret_cast(p)); + p += sizeof(size_t); + int32_t* i32_ptr = reinterpret_cast(p); + for (size_t idx = 0; idx < sz; ++idx) { + const int32_t id = *i32_ptr++; + + StreamConfiguration temp; + memcpy(&temp, i32_ptr, sizeof(StreamConfiguration)); + i32_ptr += sizeof(StreamConfiguration); + aCamera->streamConfigurations.insert_or_assign(id, temp); + } + p = reinterpret_cast(i32_ptr); + + /* synchronization */ + aCamera->synchronized = *(reinterpret_cast(p)); + p += sizeof(int32_t); + + for (size_t idx = 0; idx < num_entry; ++idx) { + /* Read camera metadata entries */ + camera_metadata_tag_t tag = *reinterpret_cast(p); + p += sizeof(camera_metadata_tag_t); + const size_t count = *reinterpret_cast(p); + p += sizeof(size_t); + + const int32_t type = get_camera_metadata_tag_type(tag); + switch (type) { + case TYPE_BYTE: { + add_camera_metadata_entry(aCamera->characteristics, tag, p, count); + p += count * sizeof(uint8_t); + break; + } + case TYPE_INT32: { + add_camera_metadata_entry(aCamera->characteristics, tag, p, count); + p += count * sizeof(int32_t); + break; + } + case TYPE_FLOAT: { + add_camera_metadata_entry(aCamera->characteristics, tag, p, count); + p += count * sizeof(float); + break; + } + case TYPE_INT64: { + add_camera_metadata_entry(aCamera->characteristics, tag, p, count); + p += count * sizeof(int64_t); + break; + } + case TYPE_DOUBLE: { + add_camera_metadata_entry(aCamera->characteristics, tag, p, count); + p += count * sizeof(double); + break; + } + case TYPE_RATIONAL: + p += count * sizeof(camera_metadata_rational_t); + break; + default: + LOG(WARNING) << "Type " << type << " is unknown; " + << "data may be corrupted."; + break; + } + } + + mCameraInfo.insert_or_assign(cameraId, std::move(aCamera)); + } + + /* read number of camera information entries */ + const size_t ncams = *(reinterpret_cast(p)); + p += sizeof(size_t); + + /* read each camera information entry */ + for (size_t cidx = 0; cidx < ncams; ++cidx) { + /* read camera identifier */ + std::string cameraId = *(reinterpret_cast(p)); + p += sizeof(std::string); + + /* size of camera_metadata_t */ + const size_t num_entry = *(reinterpret_cast(p)); + p += sizeof(size_t); + const size_t num_data = *(reinterpret_cast(p)); + p += sizeof(size_t); + + /* create CameraInfo and add it to hash map */ + std::unique_ptr aCamera; + if (aCamera == nullptr || !aCamera->allocate(num_entry, num_data)) { + LOG(ERROR) << "Failed to create new CameraInfo object"; + mCameraInfo.clear(); + return false; + } + + /* controls */ + typedef struct { + CameraParam cid; + int32_t min; + int32_t max; + int32_t step; + } CameraCtrl; + sz = *(reinterpret_cast(p)); + p += sizeof(size_t); + CameraCtrl* ptr = reinterpret_cast(p); + for (size_t idx = 0; idx < sz; ++idx) { + CameraCtrl temp = *ptr++; + aCamera->controls.insert_or_assign( + temp.cid, std::move(std::make_tuple(temp.min, temp.max, temp.step))); + } + p = reinterpret_cast(ptr); + + /* stream configurations */ + sz = *(reinterpret_cast(p)); + p += sizeof(size_t); + int32_t* i32_ptr = reinterpret_cast(p); + for (size_t idx = 0; idx < sz; ++idx) { + const int32_t id = *i32_ptr++; + + StreamConfiguration temp; + memcpy(&temp, i32_ptr, sizeof(StreamConfiguration)); + i32_ptr += sizeof(StreamConfiguration); + aCamera->streamConfigurations.insert_or_assign(id, temp); + } + p = reinterpret_cast(i32_ptr); + + for (size_t idx = 0; idx < num_entry; ++idx) { + /* Read camera metadata entries */ + camera_metadata_tag_t tag = *reinterpret_cast(p); + p += sizeof(camera_metadata_tag_t); + const size_t count = *reinterpret_cast(p); + p += sizeof(size_t); + + const int32_t type = get_camera_metadata_tag_type(tag); + switch (type) { + case TYPE_BYTE: { + add_camera_metadata_entry(aCamera->characteristics, tag, p, count); + p += count * sizeof(uint8_t); + break; + } + case TYPE_INT32: { + add_camera_metadata_entry(aCamera->characteristics, tag, p, count); + p += count * sizeof(int32_t); + break; + } + case TYPE_FLOAT: { + add_camera_metadata_entry(aCamera->characteristics, tag, p, count); + p += count * sizeof(float); + break; + } + case TYPE_INT64: { + add_camera_metadata_entry(aCamera->characteristics, tag, p, count); + p += count * sizeof(int64_t); + break; + } + case TYPE_DOUBLE: { + add_camera_metadata_entry(aCamera->characteristics, tag, p, count); + p += count * sizeof(double); + break; + } + case TYPE_RATIONAL: + p += count * sizeof(camera_metadata_rational_t); + break; + default: + LOG(WARNING) << "Type " << type << " is unknown; " + << "data may be corrupted."; + break; + } + } + + mCameraInfo.insert_or_assign(cameraId, std::move(aCamera)); + } + + mIsReady = true; + + /* notify that configuration data is ready */ + lock.unlock(); + mConfigCond.notify_all(); + + int64_t readEnd = android::elapsedRealtimeNano(); + LOG(INFO) << __FUNCTION__ << " takes " << std::scientific + << (double)(readEnd - readStart) / 1000000.0 << " ms."; + + return true; +} + +bool ConfigManager::writeConfigDataToBinary() { + std::fstream outFile; + + const int64_t writeStart = android::elapsedRealtimeNano(); + + outFile.open(mBinaryFilePath, std::fstream::out | std::fstream::binary); + if (!outFile) { + LOG(ERROR) << "Failed to open a destination binary file, " << mBinaryFilePath; + return false; + } + + /* lock a configuration data while it's being written to the filesystem */ + std::lock_guard lock(mConfigLock); + + /* write camera group information */ + size_t sz = mCameraGroups.size(); + outFile.write(reinterpret_cast(&sz), sizeof(size_t)); + for (auto&& [camId, camInfo] : mCameraGroups) { + LOG(INFO) << "Storing camera group " << camId; + + /* write a camera identifier string */ + outFile.write(reinterpret_cast(&camId), sizeof(std::string)); + + /* controls */ + sz = camInfo->controls.size(); + outFile.write(reinterpret_cast(&sz), sizeof(size_t)); + for (auto&& [ctrl, range] : camInfo->controls) { + outFile.write(reinterpret_cast(&ctrl), sizeof(CameraParam)); + outFile.write(reinterpret_cast(&std::get<0>(range)), sizeof(int32_t)); + outFile.write(reinterpret_cast(&std::get<1>(range)), sizeof(int32_t)); + outFile.write(reinterpret_cast(&std::get<2>(range)), sizeof(int32_t)); + } + + /* stream configurations */ + sz = camInfo->streamConfigurations.size(); + outFile.write(reinterpret_cast(&sz), sizeof(size_t)); + for (auto&& [sid, cfg] : camInfo->streamConfigurations) { + outFile.write(reinterpret_cast(sid), sizeof(int32_t)); + outFile.write(reinterpret_cast(&cfg), sizeof(cfg)); + } + + /* synchronization */ + outFile.write(reinterpret_cast(&camInfo->synchronized), sizeof(int32_t)); + + /* size of camera_metadata_t */ + size_t num_entry = 0; + size_t num_data = 0; + if (camInfo->characteristics != nullptr) { + num_entry = get_camera_metadata_entry_count(camInfo->characteristics); + num_data = get_camera_metadata_data_count(camInfo->characteristics); + } + outFile.write(reinterpret_cast(&num_entry), sizeof(size_t)); + outFile.write(reinterpret_cast(&num_data), sizeof(size_t)); + + /* write each camera metadata entry */ + if (num_entry > 0) { + camera_metadata_entry_t entry; + for (size_t idx = 0; idx < num_entry; ++idx) { + if (get_camera_metadata_entry(camInfo->characteristics, idx, &entry)) { + LOG(ERROR) << "Failed to retrieve camera metadata entry " << idx; + outFile.close(); + return false; + } + + outFile.write(reinterpret_cast(&entry.tag), sizeof(entry.tag)); + outFile.write(reinterpret_cast(&entry.count), sizeof(entry.count)); + + int32_t type = get_camera_metadata_tag_type(entry.tag); + switch (type) { + case TYPE_BYTE: + outFile.write(reinterpret_cast(entry.data.u8), + sizeof(uint8_t) * entry.count); + break; + case TYPE_INT32: + outFile.write(reinterpret_cast(entry.data.i32), + sizeof(int32_t) * entry.count); + break; + case TYPE_FLOAT: + outFile.write(reinterpret_cast(entry.data.f), + sizeof(float) * entry.count); + break; + case TYPE_INT64: + outFile.write(reinterpret_cast(entry.data.i64), + sizeof(int64_t) * entry.count); + break; + case TYPE_DOUBLE: + outFile.write(reinterpret_cast(entry.data.d), + sizeof(double) * entry.count); + break; + case TYPE_RATIONAL: + [[fallthrough]]; + default: + LOG(WARNING) << "Type " << type << " is not supported."; + break; + } + } + } + } + + /* write camera device information */ + sz = mCameraInfo.size(); + outFile.write(reinterpret_cast(&sz), sizeof(size_t)); + for (auto&& [camId, camInfo] : mCameraInfo) { + LOG(INFO) << "Storing camera " << camId; + + /* write a camera identifier string */ + outFile.write(reinterpret_cast(&camId), sizeof(std::string)); + + /* controls */ + sz = camInfo->controls.size(); + outFile.write(reinterpret_cast(&sz), sizeof(size_t)); + for (auto& [ctrl, range] : camInfo->controls) { + outFile.write(reinterpret_cast(&ctrl), sizeof(CameraParam)); + outFile.write(reinterpret_cast(&std::get<0>(range)), sizeof(int32_t)); + outFile.write(reinterpret_cast(&std::get<1>(range)), sizeof(int32_t)); + outFile.write(reinterpret_cast(&std::get<2>(range)), sizeof(int32_t)); + } + + /* stream configurations */ + sz = camInfo->streamConfigurations.size(); + outFile.write(reinterpret_cast(&sz), sizeof(size_t)); + for (auto&& [sid, cfg] : camInfo->streamConfigurations) { + outFile.write(reinterpret_cast(sid), sizeof(int32_t)); + outFile.write(reinterpret_cast(&cfg), sizeof(cfg)); + } + + /* size of camera_metadata_t */ + size_t num_entry = 0; + size_t num_data = 0; + if (camInfo->characteristics != nullptr) { + num_entry = get_camera_metadata_entry_count(camInfo->characteristics); + num_data = get_camera_metadata_data_count(camInfo->characteristics); + } + outFile.write(reinterpret_cast(&num_entry), sizeof(size_t)); + outFile.write(reinterpret_cast(&num_data), sizeof(size_t)); + + /* write each camera metadata entry */ + if (num_entry > 0) { + camera_metadata_entry_t entry; + for (size_t idx = 0; idx < num_entry; ++idx) { + if (get_camera_metadata_entry(camInfo->characteristics, idx, &entry)) { + LOG(ERROR) << "Failed to retrieve camera metadata entry " << idx; + outFile.close(); + return false; + } + + outFile.write(reinterpret_cast(&entry.tag), sizeof(entry.tag)); + outFile.write(reinterpret_cast(&entry.count), sizeof(entry.count)); + + int32_t type = get_camera_metadata_tag_type(entry.tag); + switch (type) { + case TYPE_BYTE: + outFile.write(reinterpret_cast(entry.data.u8), + sizeof(uint8_t) * entry.count); + break; + case TYPE_INT32: + outFile.write(reinterpret_cast(entry.data.i32), + sizeof(int32_t) * entry.count); + break; + case TYPE_FLOAT: + outFile.write(reinterpret_cast(entry.data.f), + sizeof(float) * entry.count); + break; + case TYPE_INT64: + outFile.write(reinterpret_cast(entry.data.i64), + sizeof(int64_t) * entry.count); + break; + case TYPE_DOUBLE: + outFile.write(reinterpret_cast(entry.data.d), + sizeof(double) * entry.count); + break; + case TYPE_RATIONAL: + [[fallthrough]]; + default: + LOG(WARNING) << "Type " << type << " is not supported."; + break; + } + } + } + } + + outFile.close(); + int64_t writeEnd = android::elapsedRealtimeNano(); + LOG(INFO) << __FUNCTION__ << " takes " << std::scientific + << (double)(writeEnd - writeStart) / 1000000.0 << " ms."; + + return true; +} + +std::unique_ptr ConfigManager::Create() { + std::unique_ptr cfgMgr(new ConfigManager()); + + /* + * Read a configuration from XML file + * + * If this is too slow, ConfigManager::readConfigDataFromBinary() and + * ConfigManager::writeConfigDataToBinary()can serialize CameraInfo object + * to the filesystem and construct CameraInfo instead; this was + * evaluated as 10x faster. + */ + if (!cfgMgr->readConfigDataFromXML()) { + return nullptr; + } else { + return cfgMgr; + } +} + +ConfigManager::CameraInfo::~CameraInfo() { + free_camera_metadata(characteristics); + + for (auto&& [tag, val] : cameraMetadata) { + switch (tag) { + case ANDROID_LENS_DISTORTION: + case ANDROID_LENS_POSE_ROTATION: + case ANDROID_LENS_POSE_TRANSLATION: + case ANDROID_LENS_INTRINSIC_CALIBRATION: { + delete[] reinterpret_cast(val.first); + break; + } + + case ANDROID_REQUEST_AVAILABLE_CAPABILITIES: { + delete[] reinterpret_cast< + camera_metadata_enum_android_request_available_capabilities_t*>(val.first); + break; + } + + case ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS: { + delete[] reinterpret_cast(val.first); + break; + } + + default: + LOG(WARNING) << "Tag " << std::hex << tag << " is not supported. " + << "Data may be corrupted?"; + break; + } + } +} diff --git a/automotive/evs/aidl/impl/default/src/ConfigManagerUtil.cpp b/automotive/evs/aidl/impl/default/src/ConfigManagerUtil.cpp new file mode 100644 index 0000000000..e5fe6efa57 --- /dev/null +++ b/automotive/evs/aidl/impl/default/src/ConfigManagerUtil.cpp @@ -0,0 +1,155 @@ +/* + * 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. + */ + +#include "ConfigManagerUtil.h" + +#include +#include +#include +#include + +#include +#include + +#include + +using ::aidl::android::hardware::automotive::evs::CameraParam; +using ::aidl::android::hardware::graphics::common::PixelFormat; + +bool ConfigManagerUtil::convertToEvsCameraParam(const std::string& id, CameraParam& camParam) { + std::string trimmed = ConfigManagerUtil::trimString(id); + bool success = true; + + if (!trimmed.compare("BRIGHTNESS")) { + camParam = CameraParam::BRIGHTNESS; + } else if (!trimmed.compare("CONTRAST")) { + camParam = CameraParam::CONTRAST; + } else if (!trimmed.compare("AUTOGAIN")) { + camParam = CameraParam::AUTOGAIN; + } else if (!trimmed.compare("GAIN")) { + camParam = CameraParam::GAIN; + } else if (!trimmed.compare("AUTO_WHITE_BALANCE")) { + camParam = CameraParam::AUTO_WHITE_BALANCE; + } else if (!trimmed.compare("WHITE_BALANCE_TEMPERATURE")) { + camParam = CameraParam::WHITE_BALANCE_TEMPERATURE; + } else if (!trimmed.compare("SHARPNESS")) { + camParam = CameraParam::SHARPNESS; + } else if (!trimmed.compare("AUTO_EXPOSURE")) { + camParam = CameraParam::AUTO_EXPOSURE; + } else if (!trimmed.compare("ABSOLUTE_EXPOSURE")) { + camParam = CameraParam::ABSOLUTE_EXPOSURE; + } else if (!trimmed.compare("ABSOLUTE_FOCUS")) { + camParam = CameraParam::ABSOLUTE_FOCUS; + } else if (!trimmed.compare("AUTO_FOCUS")) { + camParam = CameraParam::AUTO_FOCUS; + } else if (!trimmed.compare("ABSOLUTE_ZOOM")) { + camParam = CameraParam::ABSOLUTE_ZOOM; + } else { + success = false; + } + + return success; +} + +bool ConfigManagerUtil::convertToPixelFormat(const std::string& in, PixelFormat& out) { + std::string trimmed = ConfigManagerUtil::trimString(in); + bool success = true; + + if (!trimmed.compare("RGBA_8888")) { + out = PixelFormat::RGBA_8888; + } else if (!trimmed.compare("YCRCB_420_SP")) { + out = PixelFormat::YCRCB_420_SP; + } else if (!trimmed.compare("YCBCR_422_I")) { + out = PixelFormat::YCBCR_422_I; + } else { + out = PixelFormat::UNSPECIFIED; + success = false; + } + + return success; +} + +bool ConfigManagerUtil::convertToMetadataTag(const char* name, camera_metadata_tag& aTag) { + if (!std::strcmp(name, "LENS_DISTORTION")) { + aTag = ANDROID_LENS_DISTORTION; + } else if (!std::strcmp(name, "LENS_INTRINSIC_CALIBRATION")) { + aTag = ANDROID_LENS_INTRINSIC_CALIBRATION; + } else if (!std::strcmp(name, "LENS_POSE_ROTATION")) { + aTag = ANDROID_LENS_POSE_ROTATION; + } else if (!std::strcmp(name, "LENS_POSE_TRANSLATION")) { + aTag = ANDROID_LENS_POSE_TRANSLATION; + } else if (!std::strcmp(name, "REQUEST_AVAILABLE_CAPABILITIES")) { + aTag = ANDROID_REQUEST_AVAILABLE_CAPABILITIES; + } else if (!std::strcmp(name, "LOGICAL_MULTI_CAMERA_PHYSICAL_IDS")) { + aTag = ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS; + } else { + return false; + } + + return true; +} + +bool ConfigManagerUtil::convertToCameraCapability( + const char* name, camera_metadata_enum_android_request_available_capabilities_t& cap) { + if (!std::strcmp(name, "DEPTH_OUTPUT")) { + cap = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT; + } else if (!std::strcmp(name, "LOGICAL_MULTI_CAMERA")) { + cap = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA; + } else if (!std::strcmp(name, "MONOCHROME")) { + cap = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME; + } else if (!std::strcmp(name, "SECURE_IMAGE_DATA")) { + cap = ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SECURE_IMAGE_DATA; + } else { + return false; + } + + return true; +} + +float* ConfigManagerUtil::convertFloatArray(const char* sz, const char* vals, size_t& count, + const char delimiter) { + std::string size_string(sz); + std::string value_string(vals); + + if (!android::base::ParseUint(size_string, &count)) { + LOG(ERROR) << "Failed to parse " << size_string; + return nullptr; + } + float* result = new float[count]; + std::stringstream values(value_string); + + int32_t idx = 0; + std::string token; + while (getline(values, token, delimiter)) { + if (!android::base::ParseFloat(token, &result[idx++])) { + LOG(WARNING) << "Failed to parse " << token; + } + } + + return result; +} + +std::string ConfigManagerUtil::trimString(const std::string& src, const std::string& ws) { + const auto s = src.find_first_not_of(ws); + if (s == std::string::npos) { + return ""; + } + + const auto e = src.find_last_not_of(ws); + const auto r = e - s + 1; + + return src.substr(s, r); +} diff --git a/automotive/evs/aidl/impl/default/src/DefaultEvsEnumerator.cpp b/automotive/evs/aidl/impl/default/src/DefaultEvsEnumerator.cpp deleted file mode 100644 index 5a81d05850..0000000000 --- a/automotive/evs/aidl/impl/default/src/DefaultEvsEnumerator.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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. - */ - -// TODO(b/203661081): Remove below lines to disable compiler warnings. -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-parameter" - -#define LOG_TAG "DefaultEvsEnumerator" - -#include - -namespace aidl::android::hardware::automotive::evs::implementation { - -using ::ndk::ScopedAStatus; - -ScopedAStatus DefaultEvsEnumerator::isHardware(bool* flag) { - // This returns true always. - *flag = true; - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::openCamera(const std::string& cameraId, - const Stream& streamConfig, - std::shared_ptr* obj) { - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::closeCamera(const std::shared_ptr& obj) { - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::getCameraList(std::vector* list) { - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::getStreamList(const CameraDesc& desc, - std::vector* _aidl_return) { - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::openDisplay(int32_t displayId, - std::shared_ptr* obj) { - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::closeDisplay(const std::shared_ptr& state) { - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::getDisplayIdList(std::vector* list) { - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::getDisplayState(DisplayState* state) { - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::registerStatusCallback( - const std::shared_ptr& callback) { - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::openUltrasonicsArray( - const std::string& id, std::shared_ptr* obj) { - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::closeUltrasonicsArray( - const std::shared_ptr& obj) { - return ScopedAStatus::ok(); -} - -ScopedAStatus DefaultEvsEnumerator::getUltrasonicsArrayList( - std::vector* list) { - return ScopedAStatus::ok(); -} - -} // namespace aidl::android::hardware::automotive::evs::implementation - -#pragma clang diagnostic pop diff --git a/automotive/evs/aidl/impl/default/src/EvsEnumerator.cpp b/automotive/evs/aidl/impl/default/src/EvsEnumerator.cpp new file mode 100644 index 0000000000..6e2405deb5 --- /dev/null +++ b/automotive/evs/aidl/impl/default/src/EvsEnumerator.cpp @@ -0,0 +1,552 @@ +/* + * 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. + */ + +#include "EvsEnumerator.h" + +#include "ConfigManager.h" +#include "EvsGlDisplay.h" +#include "EvsMockCamera.h" + +#include +#include +#include +#include + +#include +#include + +namespace { + +using ::aidl::android::frameworks::automotive::display::ICarDisplayProxy; +using ::aidl::android::hardware::graphics::common::BufferUsage; +using ::ndk::ScopedAStatus; +using std::chrono_literals::operator""s; + +// Constants +constexpr std::chrono::seconds kEnumerationTimeout = 10s; +constexpr uint64_t kInvalidDisplayId = std::numeric_limits::max(); +const std::set kAllowedUids = {AID_AUTOMOTIVE_EVS, AID_SYSTEM, AID_ROOT}; + +} // namespace + +namespace aidl::android::hardware::automotive::evs::implementation { + +// NOTE: All members values are static so that all clients operate on the same state +// That is to say, this is effectively a singleton despite the fact that HIDL +// constructs a new instance for each client. +std::unordered_map EvsEnumerator::sCameraList; +std::mutex EvsEnumerator::sLock; +std::condition_variable EvsEnumerator::sCameraSignal; +std::unique_ptr EvsEnumerator::sConfigManager; +std::shared_ptr EvsEnumerator::sDisplayProxy; +std::unordered_map EvsEnumerator::sDisplayPortList; + +EvsEnumerator::ActiveDisplays& EvsEnumerator::mutableActiveDisplays() { + static ActiveDisplays active_displays; + return active_displays; +} + +EvsEnumerator::EvsEnumerator(const std::shared_ptr& proxyService) { + LOG(DEBUG) << "EvsEnumerator is created."; + + if (!sConfigManager) { + /* loads and initializes ConfigManager in a separate thread */ + sConfigManager = ConfigManager::Create(); + } + + if (!sDisplayProxy) { + /* sets a car-window service handle */ + sDisplayProxy = proxyService; + } + + // Enumerate existing devices + enumerateCameras(); + mInternalDisplayId = enumerateDisplays(); +} + +bool EvsEnumerator::checkPermission() { + const auto uid = AIBinder_getCallingUid(); + if (kAllowedUids.find(uid) == kAllowedUids.end()) { + LOG(ERROR) << "EVS access denied: " + << "pid = " << AIBinder_getCallingPid() << ", uid = " << uid; + return false; + } + + return true; +} + +void EvsEnumerator::enumerateCameras() { + if (!sConfigManager) { + return; + } + + for (auto id : sConfigManager->getCameraIdList()) { + CameraRecord rec(id.data()); + std::unique_ptr& pInfo = sConfigManager->getCameraInfo(id); + if (pInfo) { + uint8_t* ptr = reinterpret_cast(pInfo->characteristics); + const size_t len = get_camera_metadata_size(pInfo->characteristics); + rec.desc.metadata.insert(rec.desc.metadata.end(), ptr, ptr + len); + } + sCameraList.insert_or_assign(id, std::move(rec)); + } +} + +uint64_t EvsEnumerator::enumerateDisplays() { + LOG(INFO) << __FUNCTION__ << ": Starting display enumeration"; + uint64_t internalDisplayId = kInvalidDisplayId; + if (!sDisplayProxy) { + LOG(ERROR) << "ICarDisplayProxy is not available!"; + return internalDisplayId; + } + + std::vector displayIds; + if (auto status = sDisplayProxy->getDisplayIdList(&displayIds); !status.isOk()) { + LOG(ERROR) << "Failed to retrieve a display id list" + << ::android::statusToString(status.getStatus()); + return internalDisplayId; + } + + if (displayIds.size() > 0) { + // The first entry of the list is the internal display. See + // SurfaceFlinger::getPhysicalDisplayIds() implementation. + internalDisplayId = displayIds[0]; + for (const auto& id : displayIds) { + const auto port = id & 0xFF; + LOG(INFO) << "Display " << std::hex << id << " is detected on the port, " << port; + sDisplayPortList.insert_or_assign(port, id); + } + } + + LOG(INFO) << "Found " << sDisplayPortList.size() << " displays"; + return internalDisplayId; +} + +// Methods from ::android::hardware::automotive::evs::IEvsEnumerator follow. +ScopedAStatus EvsEnumerator::getCameraList(std::vector* _aidl_return) { + LOG(DEBUG) << __FUNCTION__; + if (!checkPermission()) { + return ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::PERMISSION_DENIED)); + } + + { + std::unique_lock lock(sLock); + if (sCameraList.size() < 1) { + // No qualified device has been found. Wait until new device is ready, + // for 10 seconds. + if (!sCameraSignal.wait_for(lock, kEnumerationTimeout, + [] { return sCameraList.size() > 0; })) { + LOG(DEBUG) << "Timer expired. No new device has been added."; + } + } + } + + // Build up a packed array of CameraDesc for return + _aidl_return->resize(sCameraList.size()); + unsigned i = 0; + for (const auto& [key, cam] : sCameraList) { + (*_aidl_return)[i++] = cam.desc; + } + + if (sConfigManager) { + // Adding camera groups that represent logical camera devices + auto camGroups = sConfigManager->getCameraGroupIdList(); + for (auto&& id : camGroups) { + if (sCameraList.find(id) != sCameraList.end()) { + // Already exists in the _aidl_return + continue; + } + + std::unique_ptr& tempInfo = + sConfigManager->getCameraGroupInfo(id); + CameraRecord cam(id.data()); + if (tempInfo) { + uint8_t* ptr = reinterpret_cast(tempInfo->characteristics); + const size_t len = get_camera_metadata_size(tempInfo->characteristics); + cam.desc.metadata.insert(cam.desc.metadata.end(), ptr, ptr + len); + } + + sCameraList.insert_or_assign(id, cam); + _aidl_return->push_back(cam.desc); + } + } + + // Send back the results + LOG(DEBUG) << "Reporting " << sCameraList.size() << " cameras available"; + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsEnumerator::getStreamList(const CameraDesc& desc, + std::vector* _aidl_return) { + using AidlPixelFormat = ::aidl::android::hardware::graphics::common::PixelFormat; + + camera_metadata_t* pMetadata = const_cast( + reinterpret_cast(desc.metadata.data())); + camera_metadata_entry_t streamConfig; + if (!find_camera_metadata_entry(pMetadata, ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, + &streamConfig)) { + const unsigned numStreamConfigs = streamConfig.count / sizeof(StreamConfiguration); + _aidl_return->resize(numStreamConfigs); + const StreamConfiguration* pCurrentConfig = + reinterpret_cast(streamConfig.data.i32); + for (unsigned i = 0; i < numStreamConfigs; ++i, ++pCurrentConfig) { + // Build ::aidl::android::hardware::automotive::evs::Stream from + // StreamConfiguration. + Stream current = { + .id = pCurrentConfig->id, + .streamType = + pCurrentConfig->type == + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT + ? StreamType::INPUT + : StreamType::OUTPUT, + .width = pCurrentConfig->width, + .height = pCurrentConfig->height, + .format = static_cast(pCurrentConfig->format), + .usage = BufferUsage::CAMERA_INPUT, + .rotation = Rotation::ROTATION_0, + }; + + (*_aidl_return)[i] = current; + } + } + + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsEnumerator::openCamera(const std::string& id, const Stream& cfg, + std::shared_ptr* obj) { + LOG(DEBUG) << __FUNCTION__; + if (!checkPermission()) { + return ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::PERMISSION_DENIED)); + } + + // Is this a recognized camera id? + CameraRecord* pRecord = findCameraById(id); + if (!pRecord) { + LOG(ERROR) << id << " does not exist!"; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); + } + + // Has this camera already been instantiated by another caller? + std::shared_ptr pActiveCamera = pRecord->activeInstance.lock(); + if (pActiveCamera) { + LOG(WARNING) << "Killing previous camera because of new caller"; + closeCamera(pActiveCamera); + } + + // Construct a camera instance for the caller + if (!sConfigManager) { + pActiveCamera = EvsMockCamera::Create(id.data()); + } else { + pActiveCamera = EvsMockCamera::Create(id.data(), sConfigManager->getCameraInfo(id), &cfg); + } + + pRecord->activeInstance = pActiveCamera; + if (!pActiveCamera) { + LOG(ERROR) << "Failed to create new EvsMockCamera object for " << id; + return ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::UNDERLYING_SERVICE_ERROR)); + } + + *obj = pActiveCamera; + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsEnumerator::closeCamera(const std::shared_ptr& cameraObj) { + LOG(DEBUG) << __FUNCTION__; + + if (!cameraObj) { + LOG(ERROR) << "Ignoring call to closeCamera with null camera ptr"; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); + } + + // Get the camera id so we can find it in our list + CameraDesc desc; + auto status = cameraObj->getCameraInfo(&desc); + if (!status.isOk()) { + LOG(ERROR) << "Failed to read a camera descriptor"; + return ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::UNDERLYING_SERVICE_ERROR)); + } + auto cameraId = desc.id; + closeCamera_impl(cameraObj, cameraId); + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsEnumerator::openDisplay(int32_t id, std::shared_ptr* displayObj) { + LOG(DEBUG) << __FUNCTION__; + if (!checkPermission()) { + return ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::PERMISSION_DENIED)); + } + + auto& displays = mutableActiveDisplays(); + + if (auto existing_display_search = displays.popDisplay(id)) { + // If we already have a display active, then we need to shut it down so we can + // give exclusive access to the new caller. + std::shared_ptr pActiveDisplay = existing_display_search->displayWeak.lock(); + if (pActiveDisplay) { + LOG(WARNING) << "Killing previous display because of new caller"; + pActiveDisplay->forceShutdown(); + } + } + + // Create a new display interface and return it + uint64_t targetDisplayId = mInternalDisplayId; + auto it = sDisplayPortList.find(id); + if (it != sDisplayPortList.end()) { + targetDisplayId = it->second; + } else { + LOG(WARNING) << "No display is available on the port " << static_cast(id) + << ". The main display " << mInternalDisplayId << " will be used instead"; + } + + // Create a new display interface and return it. + std::shared_ptr pActiveDisplay = + ndk::SharedRefBase::make(sDisplayProxy, targetDisplayId); + + if (auto insert_result = displays.tryInsert(id, pActiveDisplay); !insert_result) { + LOG(ERROR) << "Display ID " << id << " has been used by another caller."; + pActiveDisplay->forceShutdown(); + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::RESOURCE_BUSY)); + } + + LOG(DEBUG) << "Returning new EvsGlDisplay object " << pActiveDisplay.get(); + *displayObj = pActiveDisplay; + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsEnumerator::closeDisplay(const std::shared_ptr& obj) { + LOG(DEBUG) << __FUNCTION__; + + auto& displays = mutableActiveDisplays(); + const auto display_search = displays.popDisplay(obj); + + if (!display_search) { + LOG(WARNING) << "Ignoring close of previously orphaned display - why did a client steal?"; + return ScopedAStatus::ok(); + } + + auto pActiveDisplay = display_search->displayWeak.lock(); + + if (!pActiveDisplay) { + LOG(ERROR) << "Somehow a display is being destroyed " + << "when the enumerator didn't know one existed"; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); + } + + pActiveDisplay->forceShutdown(); + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsEnumerator::getDisplayState(DisplayState* state) { + LOG(DEBUG) << __FUNCTION__; + if (!checkPermission()) { + *state = DisplayState::DEAD; + return ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::PERMISSION_DENIED)); + } + + // TODO(b/262779341): For now we can just return the state of the 1st display. Need to update + // the API later. + + const auto& all_displays = mutableActiveDisplays().getAllDisplays(); + + // Do we still have a display object we think should be active? + if (all_displays.empty()) { + *state = DisplayState::NOT_OPEN; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); + } + + std::shared_ptr pActiveDisplay = all_displays.begin()->second.displayWeak.lock(); + if (pActiveDisplay) { + return pActiveDisplay->getDisplayState(state); + } else { + *state = DisplayState::NOT_OPEN; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); + } +} + +ScopedAStatus EvsEnumerator::getDisplayIdList(std::vector* list) { + std::vector& output = *list; + if (sDisplayPortList.size() > 0) { + output.resize(sDisplayPortList.size()); + unsigned i = 0; + output[i++] = mInternalDisplayId & 0xFF; + for (const auto& [port, id] : sDisplayPortList) { + if (mInternalDisplayId != id) { + output[i++] = port; + } + } + } + + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsEnumerator::isHardware(bool* flag) { + *flag = true; + return ScopedAStatus::ok(); +} + +void EvsEnumerator::notifyDeviceStatusChange(const std::string_view& deviceName, + DeviceStatusType type) { + std::lock_guard lock(sLock); + if (!mCallback) { + return; + } + + std::vector status{{.id = std::string(deviceName), .status = type}}; + if (!mCallback->deviceStatusChanged(status).isOk()) { + LOG(WARNING) << "Failed to notify a device status change, name = " << deviceName + << ", type = " << static_cast(type); + } +} + +ScopedAStatus EvsEnumerator::registerStatusCallback( + const std::shared_ptr& callback) { + std::lock_guard lock(sLock); + if (mCallback) { + LOG(INFO) << "Replacing an existing device status callback"; + } + mCallback = callback; + return ScopedAStatus::ok(); +} + +void EvsEnumerator::closeCamera_impl(const std::shared_ptr& pCamera, + const std::string& cameraId) { + // Find the named camera + CameraRecord* pRecord = findCameraById(cameraId); + + // Is the display being destroyed actually the one we think is active? + if (!pRecord) { + LOG(ERROR) << "Asked to close a camera whose name isn't recognized"; + } else { + std::shared_ptr pActiveCamera = pRecord->activeInstance.lock(); + if (!pActiveCamera) { + LOG(WARNING) << "Somehow a camera is being destroyed " + << "when the enumerator didn't know one existed"; + } else if (pActiveCamera != pCamera) { + // This can happen if the camera was aggressively reopened, + // orphaning this previous instance + LOG(WARNING) << "Ignoring close of previously orphaned camera " + << "- why did a client steal?"; + } else { + // Shutdown the active camera + pActiveCamera->shutdown(); + } + } + + return; +} + +EvsEnumerator::CameraRecord* EvsEnumerator::findCameraById(const std::string& cameraId) { + // Find the named camera + auto found = sCameraList.find(cameraId); + if (found != sCameraList.end()) { + // Found a match! + return &found->second; + } + + // We didn't find a match + return nullptr; +} + +std::optional EvsEnumerator::ActiveDisplays::popDisplay( + int32_t id) { + std::lock_guard lck(mMutex); + const auto search = mIdToDisplay.find(id); + if (search == mIdToDisplay.end()) { + return std::nullopt; + } + const auto display_info = search->second; + mIdToDisplay.erase(search); + mDisplayToId.erase(display_info.internalDisplayRawAddr); + return display_info; +} + +std::optional EvsEnumerator::ActiveDisplays::popDisplay( + const std::shared_ptr& display) { + const auto display_ptr_val = reinterpret_cast(display.get()); + std::lock_guard lck(mMutex); + const auto display_to_id_search = mDisplayToId.find(display_ptr_val); + if (display_to_id_search == mDisplayToId.end()) { + LOG(ERROR) << "Unknown display."; + return std::nullopt; + } + const auto id = display_to_id_search->second; + const auto id_to_display_search = mIdToDisplay.find(id); + mDisplayToId.erase(display_to_id_search); + if (id_to_display_search == mIdToDisplay.end()) { + LOG(ERROR) << "No correspsonding ID for the display, probably orphaned."; + return std::nullopt; + } + const auto display_info = id_to_display_search->second; + mIdToDisplay.erase(id); + return display_info; +} + +std::unordered_map +EvsEnumerator::ActiveDisplays::getAllDisplays() { + std::lock_guard lck(mMutex); + auto id_to_display_map_copy = mIdToDisplay; + return id_to_display_map_copy; +} + +bool EvsEnumerator::ActiveDisplays::tryInsert(int32_t id, + const std::shared_ptr& display) { + std::lock_guard lck(mMutex); + const auto display_ptr_val = reinterpret_cast(display.get()); + + auto id_to_display_insert_result = + mIdToDisplay.emplace(id, DisplayInfo{ + .id = id, + .displayWeak = display, + .internalDisplayRawAddr = display_ptr_val, + }); + if (!id_to_display_insert_result.second) { + return false; + } + auto display_to_id_insert_result = mDisplayToId.emplace(display_ptr_val, id); + if (!display_to_id_insert_result.second) { + mIdToDisplay.erase(id); + return false; + } + return true; +} + +ScopedAStatus EvsEnumerator::getUltrasonicsArrayList( + [[maybe_unused]] std::vector* list) { + // TODO(b/149874793): Add implementation for EVS Manager and Sample driver + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsEnumerator::openUltrasonicsArray( + [[maybe_unused]] const std::string& id, + [[maybe_unused]] std::shared_ptr* obj) { + // TODO(b/149874793): Add implementation for EVS Manager and Sample driver + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsEnumerator::closeUltrasonicsArray( + [[maybe_unused]] const std::shared_ptr& obj) { + // TODO(b/149874793): Add implementation for EVS Manager and Sample driver + return ScopedAStatus::ok(); +} + +} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/src/EvsGlDisplay.cpp b/automotive/evs/aidl/impl/default/src/EvsGlDisplay.cpp new file mode 100644 index 0000000000..e5f8e4c84a --- /dev/null +++ b/automotive/evs/aidl/impl/default/src/EvsGlDisplay.cpp @@ -0,0 +1,417 @@ +/* + * 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. + */ + +#include "EvsGlDisplay.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace { + +using ::aidl::android::frameworks::automotive::display::ICarDisplayProxy; +using ::aidl::android::hardware::graphics::common::BufferUsage; +using ::aidl::android::hardware::graphics::common::PixelFormat; +using ::android::base::ScopedLockAssertion; +using ::ndk::ScopedAStatus; + +constexpr auto kTimeout = std::chrono::seconds(1); + +bool debugFirstFrameDisplayed = false; + +int generateFingerPrint(buffer_handle_t handle) { + return static_cast(reinterpret_cast(handle) & 0xFFFFFFFF); +} + +} // namespace + +namespace aidl::android::hardware::automotive::evs::implementation { + +EvsGlDisplay::EvsGlDisplay(const std::shared_ptr& pDisplayProxy, + uint64_t displayId) + : mDisplayId(displayId), mDisplayProxy(pDisplayProxy) { + LOG(DEBUG) << "EvsGlDisplay instantiated"; + + // Set up our self description + // NOTE: These are arbitrary values chosen for testing + mInfo.id = std::to_string(displayId); + mInfo.vendorFlags = 3870; + + // Start a thread to render images on this display + { + std::lock_guard lock(mLock); + mState = RUN; + } + mRenderThread = std::thread([this]() { renderFrames(); }); +} + +EvsGlDisplay::~EvsGlDisplay() { + LOG(DEBUG) << "EvsGlDisplay being destroyed"; + forceShutdown(); +} + +/** + * This gets called if another caller "steals" ownership of the display + */ +void EvsGlDisplay::forceShutdown() { + LOG(DEBUG) << "EvsGlDisplay forceShutdown"; + { + std::lock_guard lock(mLock); + + // If the buffer isn't being held by a remote client, release it now as an + // optimization to release the resources more quickly than the destructor might + // get called. + if (mBuffer.handle != nullptr) { + // Report if we're going away while a buffer is outstanding + if (mBufferBusy || mState == RUN) { + LOG(ERROR) << "EvsGlDisplay going down while client is holding a buffer"; + } + mState = STOPPING; + } + + // Put this object into an unrecoverable error state since somebody else + // is going to own the display now. + mRequestedState = DisplayState::DEAD; + } + mBufferReadyToRender.notify_all(); + + if (mRenderThread.joinable()) { + mRenderThread.join(); + } +} + +/** + * Initialize GL in the context of a caller's thread and prepare a graphic + * buffer to use. + */ +bool EvsGlDisplay::initializeGlContextLocked() { + // Initialize our display window + // NOTE: This will cause the display to become "VISIBLE" before a frame is actually + // returned, which is contrary to the spec and will likely result in a black frame being + // (briefly) shown. + if (!mGlWrapper.initialize(mDisplayProxy, mDisplayId)) { + // Report the failure + LOG(ERROR) << "Failed to initialize GL display"; + return false; + } + + // Assemble the buffer description we'll use for our render target + static_assert(::aidl::android::hardware::graphics::common::PixelFormat::RGBA_8888 == + static_cast<::aidl::android::hardware::graphics::common::PixelFormat>( + HAL_PIXEL_FORMAT_RGBA_8888)); + mBuffer.description = { + .width = static_cast(mGlWrapper.getWidth()), + .height = static_cast(mGlWrapper.getHeight()), + .layers = 1, + .format = PixelFormat::RGBA_8888, + // FIXME: Below line is not using + // ::aidl::android::hardware::graphics::common::BufferUsage because + // BufferUsage enum does not support a bitwise-OR operation; they + // should be BufferUsage::GPU_RENDER_TARGET | + // BufferUsage::COMPOSER_OVERLAY + .usage = static_cast(GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_COMPOSER), + }; + + ::android::GraphicBufferAllocator& alloc(::android::GraphicBufferAllocator::get()); + uint32_t stride = static_cast(mBuffer.description.stride); + buffer_handle_t handle = nullptr; + const ::android::status_t result = + alloc.allocate(mBuffer.description.width, mBuffer.description.height, + static_cast<::android::PixelFormat>(mBuffer.description.format), + mBuffer.description.layers, + static_cast(mBuffer.description.usage), &handle, &stride, + /* requestorName= */ "EvsGlDisplay"); + mBuffer.description.stride = stride; + mBuffer.fingerprint = generateFingerPrint(mBuffer.handle); + if (result != ::android::NO_ERROR) { + LOG(ERROR) << "Error " << result << " allocating " << mBuffer.description.width << " x " + << mBuffer.description.height << " graphics buffer."; + mGlWrapper.shutdown(); + return false; + } + + mBuffer.handle = handle; + if (mBuffer.handle == nullptr) { + LOG(ERROR) << "We didn't get a buffer handle back from the allocator"; + mGlWrapper.shutdown(); + return false; + } + + LOG(DEBUG) << "Allocated new buffer " << mBuffer.handle << " with stride " + << mBuffer.description.stride; + return true; +} + +/** + * This method runs in a separate thread and renders the contents of the buffer. + */ +void EvsGlDisplay::renderFrames() { + { + std::lock_guard lock(mLock); + + if (!initializeGlContextLocked()) { + LOG(ERROR) << "Failed to initialize GL context"; + return; + } + + // Display buffer is ready. + mBufferBusy = false; + } + mBufferReadyToUse.notify_all(); + + while (true) { + { + std::unique_lock lock(mLock); + ScopedLockAssertion lock_assertion(mLock); + mBufferReadyToRender.wait( + lock, [this]() REQUIRES(mLock) { return mBufferReady || mState != RUN; }); + if (mState != RUN) { + LOG(DEBUG) << "A rendering thread is stopping"; + break; + } + mBufferReady = false; + } + + // Update the texture contents with the provided data + if (!mGlWrapper.updateImageTexture(mBuffer.handle, mBuffer.description)) { + LOG(WARNING) << "Failed to update the image texture"; + continue; + } + + // Put the image on the screen + mGlWrapper.renderImageToScreen(); + if (!debugFirstFrameDisplayed) { + LOG(DEBUG) << "EvsFirstFrameDisplayTiming start time: " << ::android::elapsedRealtime() + << " ms."; + debugFirstFrameDisplayed = true; + } + + // Mark current frame is consumed. + { + std::lock_guard lock(mLock); + mBufferBusy = false; + } + mBufferDone.notify_all(); + } + + LOG(DEBUG) << "A rendering thread is stopped."; + + // Drop the graphics buffer we've been using + ::android::GraphicBufferAllocator& alloc(::android::GraphicBufferAllocator::get()); + alloc.free(mBuffer.handle); + mBuffer.handle = nullptr; + + mGlWrapper.hideWindow(mDisplayProxy, mDisplayId); + mGlWrapper.shutdown(); + + std::lock_guard lock(mLock); + mState = STOPPED; +} + +/** + * Returns basic information about the EVS display provided by the system. + * See the description of the DisplayDesc structure for details. + */ +ScopedAStatus EvsGlDisplay::getDisplayInfo(DisplayDesc* _aidl_return) { + if (!mDisplayProxy) { + return ::ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::UNDERLYING_SERVICE_ERROR)); + } + + ::aidl::android::frameworks::automotive::display::DisplayDesc proxyDisplay; + auto status = mDisplayProxy->getDisplayInfo(mDisplayId, &proxyDisplay); + if (!status.isOk()) { + return ::ndk::ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::UNDERLYING_SERVICE_ERROR)); + } + + _aidl_return->width = proxyDisplay.width; + _aidl_return->height = proxyDisplay.height; + _aidl_return->orientation = static_cast(proxyDisplay.orientation); + _aidl_return->id = mInfo.id; // FIXME: what should be ID here? + _aidl_return->vendorFlags = mInfo.vendorFlags; + return ::ndk::ScopedAStatus::ok(); +} + +/** + * Clients may set the display state to express their desired state. + * The HAL implementation must gracefully accept a request for any state + * while in any other state, although the response may be to ignore the request. + * The display is defined to start in the NOT_VISIBLE state upon initialization. + * The client is then expected to request the VISIBLE_ON_NEXT_FRAME state, and + * then begin providing video. When the display is no longer required, the client + * is expected to request the NOT_VISIBLE state after passing the last video frame. + */ +ScopedAStatus EvsGlDisplay::setDisplayState(DisplayState state) { + LOG(DEBUG) << __FUNCTION__; + std::lock_guard lock(mLock); + + if (mRequestedState == DisplayState::DEAD) { + // This object no longer owns the display -- it's been superceeded! + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); + } + + // Ensure we recognize the requested state so we don't go off the rails + static constexpr ::ndk::enum_range kDisplayStateRange; + if (std::find(kDisplayStateRange.begin(), kDisplayStateRange.end(), state) == + kDisplayStateRange.end()) { + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); + } + + switch (state) { + case DisplayState::NOT_VISIBLE: + mGlWrapper.hideWindow(mDisplayProxy, mDisplayId); + break; + case DisplayState::VISIBLE: + mGlWrapper.showWindow(mDisplayProxy, mDisplayId); + break; + default: + break; + } + + // Record the requested state + mRequestedState = state; + + return ScopedAStatus::ok(); +} + +/** + * The HAL implementation should report the actual current state, which might + * transiently differ from the most recently requested state. Note, however, that + * the logic responsible for changing display states should generally live above + * the device layer, making it undesirable for the HAL implementation to + * spontaneously change display states. + */ +ScopedAStatus EvsGlDisplay::getDisplayState(DisplayState* _aidl_return) { + LOG(DEBUG) << __FUNCTION__; + std::lock_guard lock(mLock); + *_aidl_return = mRequestedState; + return ScopedAStatus::ok(); +} + +/** + * This call returns a handle to a frame buffer associated with the display. + * This buffer may be locked and written to by software and/or GL. This buffer + * must be returned via a call to returnTargetBufferForDisplay() even if the + * display is no longer visible. + */ +ScopedAStatus EvsGlDisplay::getTargetBuffer(BufferDesc* _aidl_return) { + LOG(DEBUG) << __FUNCTION__; + std::unique_lock lock(mLock); + ScopedLockAssertion lock_assertion(mLock); + if (mRequestedState == DisplayState::DEAD) { + LOG(ERROR) << "Rejecting buffer request from object that lost ownership of the display."; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); + } + + // If we don't already have a buffer, allocate one now + // mBuffer.memHandle is a type of buffer_handle_t, which is equal to + // native_handle_t*. + mBufferReadyToUse.wait(lock, [this]() REQUIRES(mLock) { return !mBufferBusy; }); + + // Do we have a frame available? + if (mBufferBusy) { + // This means either we have a 2nd client trying to compete for buffers + // (an unsupported mode of operation) or else the client hasn't returned + // a previously issued buffer yet (they're behaving badly). + // NOTE: We have to make the callback even if we have nothing to provide + LOG(ERROR) << "getTargetBuffer called while no buffers available."; + return ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::BUFFER_NOT_AVAILABLE)); + } + + // Mark our buffer as busy + mBufferBusy = true; + + // Send the buffer to the client + LOG(VERBOSE) << "Providing display buffer handle " << mBuffer.handle; + + BufferDesc bufferDescToSend = { + .buffer = + { + .handle = std::move(::android::dupToAidl(mBuffer.handle)), + .description = mBuffer.description, + }, + .pixelSizeBytes = 4, // RGBA_8888 is 4-byte-per-pixel format + .bufferId = mBuffer.fingerprint, + }; + *_aidl_return = std::move(bufferDescToSend); + + return ScopedAStatus::ok(); +} + +/** + * This call tells the display that the buffer is ready for display. + * The buffer is no longer valid for use by the client after this call. + */ +ScopedAStatus EvsGlDisplay::returnTargetBufferForDisplay(const BufferDesc& buffer) { + LOG(VERBOSE) << __FUNCTION__; + std::unique_lock lock(mLock); + ScopedLockAssertion lock_assertion(mLock); + + // Nobody should call us with a null handle + if (buffer.buffer.handle.fds.size() < 1) { + LOG(ERROR) << __FUNCTION__ << " called without a valid buffer handle."; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); + } + if (buffer.bufferId != mBuffer.fingerprint) { + LOG(ERROR) << "Got an unrecognized frame returned."; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); + } + if (!mBufferBusy) { + LOG(ERROR) << "A frame was returned with no outstanding frames."; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); + } + + // If we've been displaced by another owner of the display, then we can't do anything else + if (mRequestedState == DisplayState::DEAD) { + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); + } + + // If we were waiting for a new frame, this is it! + if (mRequestedState == DisplayState::VISIBLE_ON_NEXT_FRAME) { + mRequestedState = DisplayState::VISIBLE; + mGlWrapper.showWindow(mDisplayProxy, mDisplayId); + } + + // Validate we're in an expected state + if (mRequestedState != DisplayState::VISIBLE) { + // Not sure why a client would send frames back when we're not visible. + LOG(WARNING) << "Got a frame returned while not visible - ignoring."; + return ScopedAStatus::ok(); + } + mBufferReady = true; + mBufferReadyToRender.notify_all(); + + if (!mBufferDone.wait_for(lock, kTimeout, [this]() REQUIRES(mLock) { return !mBufferBusy; })) { + return ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::UNDERLYING_SERVICE_ERROR)); + } + + return ScopedAStatus::ok(); +} + +} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/src/EvsMockCamera.cpp b/automotive/evs/aidl/impl/default/src/EvsMockCamera.cpp new file mode 100644 index 0000000000..4b46a5ae64 --- /dev/null +++ b/automotive/evs/aidl/impl/default/src/EvsMockCamera.cpp @@ -0,0 +1,642 @@ +/* + * 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. + */ + +#include "EvsMockCamera.h" +#include "ConfigManager.h" +#include "EvsEnumerator.h" + +#include +#include +#include +#include + +#include + +namespace { + +using ::aidl::android::hardware::graphics::common::BufferUsage; +using ::ndk::ScopedAStatus; + +// Arbitrary limit on number of graphics buffers allowed to be allocated +// Safeguards against unreasonable resource consumption and provides a testable limit +constexpr unsigned kMaxBuffersInFlight = 100; + +// Minimum number of buffers to run a video stream +constexpr int kMinimumBuffersInFlight = 1; + +// Colors for the colorbar test pattern in ABGR format +constexpr uint32_t kColors[] = { + 0xFFFFFFFF, // white + 0xFF00FFFF, // yellow + 0xFFFFFF00, // cyan + 0xFF00FF00, // green + 0xFFFF00FF, // fuchsia + 0xFF0000FF, // red + 0xFFFF0000, // blue + 0xFF000000, // black +}; +constexpr size_t kNumColors = sizeof(kColors) / sizeof(kColors[0]); + +} // namespace + +namespace aidl::android::hardware::automotive::evs::implementation { + +EvsMockCamera::EvsMockCamera([[maybe_unused]] Sigil sigil, const char* id, + std::unique_ptr& camInfo) + : mFramesAllowed(0), mFramesInUse(0), mStreamState(STOPPED), mCameraInfo(camInfo) { + LOG(DEBUG) << __FUNCTION__; + + /* set a camera id */ + mDescription.id = id; + + /* set camera metadata */ + if (camInfo) { + uint8_t* ptr = reinterpret_cast(camInfo->characteristics); + const size_t len = get_camera_metadata_size(camInfo->characteristics); + mDescription.metadata.insert(mDescription.metadata.end(), ptr, ptr + len); + } +} + +EvsMockCamera::~EvsMockCamera() { + LOG(DEBUG) << __FUNCTION__; + shutdown(); +} + +// This gets called if another caller "steals" ownership of the camera +void EvsMockCamera::shutdown() { + LOG(DEBUG) << __FUNCTION__; + + // Make sure our output stream is cleaned up + // (It really should be already) + stopVideoStream_impl(); + + // Claim the lock while we work on internal state + std::lock_guard lock(mAccessLock); + + // Drop all the graphics buffers we've been using + if (mBuffers.size() > 0) { + ::android::GraphicBufferAllocator& alloc(::android::GraphicBufferAllocator::get()); + for (auto&& rec : mBuffers) { + if (rec.inUse) { + LOG(WARNING) << "WARNING: releasing a buffer remotely owned."; + } + alloc.free(rec.handle); + rec.handle = nullptr; + } + mBuffers.clear(); + } + + // Put this object into an unrecoverable error state since somebody else + // is going to own the underlying camera now + mStreamState = DEAD; +} + +// Methods from ::aidl::android::hardware::automotive::evs::IEvsCamera follow. +ScopedAStatus EvsMockCamera::getCameraInfo(CameraDesc* _aidl_return) { + LOG(DEBUG) << __FUNCTION__; + + // Send back our self description + *_aidl_return = mDescription; + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::setMaxFramesInFlight(int32_t bufferCount) { + LOG(DEBUG) << __FUNCTION__ << ", bufferCount = " << bufferCount; + ; + + std::lock_guard lock(mAccessLock); + + // If we've been displaced by another owner of the camera, then we can't do anything else + if (mStreamState == DEAD) { + LOG(ERROR) << "Ignoring setMaxFramesInFlight call when camera has been lost."; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); + } + + // We cannot function without at least one video buffer to send data + if (bufferCount < 1) { + LOG(ERROR) << "Ignoring setMaxFramesInFlight with less than one buffer requested."; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); + } + + // Update our internal state + if (!setAvailableFrames_Locked(bufferCount)) { + LOG(ERROR) << "Failed to adjust the maximum number of frames in flight."; + return ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::BUFFER_NOT_AVAILABLE)); + } + + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::startVideoStream(const std::shared_ptr& cb) { + LOG(DEBUG) << __FUNCTION__; + + if (!cb) { + LOG(ERROR) << "A given stream callback is invalid."; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); + } + + std::lock_guard lock(mAccessLock); + + // If we've been displaced by another owner of the camera, then we can't do anything else + if (mStreamState == DEAD) { + LOG(ERROR) << "Ignoring startVideoStream call when camera has been lost."; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); + } + + if (mStreamState != STOPPED) { + LOG(ERROR) << "Ignoring startVideoStream call when a stream is already running."; + return ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::STREAM_ALREADY_RUNNING)); + } + + // If the client never indicated otherwise, configure ourselves for a single streaming buffer + if (mFramesAllowed < kMinimumBuffersInFlight && + !setAvailableFrames_Locked(kMinimumBuffersInFlight)) { + LOG(ERROR) << "Failed to start stream because we couldn't get a graphics buffer"; + return ScopedAStatus::fromServiceSpecificError( + static_cast(EvsResult::BUFFER_NOT_AVAILABLE)); + } + + // Record the user's callback for use when we have a frame ready + mStream = cb; + + // Start the frame generation thread + mStreamState = RUNNING; + mCaptureThread = std::thread([this]() { generateFrames(); }); + + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::doneWithFrame(const std::vector& list) { + std::lock_guard lock(mAccessLock); + for (const auto& desc : list) { + returnBufferLocked(desc.bufferId); + } + + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::stopVideoStream() { + LOG(DEBUG) << __FUNCTION__; + return stopVideoStream_impl(); +} + +ScopedAStatus EvsMockCamera::stopVideoStream_impl() { + std::unique_lock lock(mAccessLock); + + if (mStreamState != RUNNING) { + // Safely return here because a stream is not running. + return ScopedAStatus::ok(); + } + + // Tell the GenerateFrames loop we want it to stop + mStreamState = STOPPING; + + // Block outside the mutex until the "stop" flag has been acknowledged + // We won't send any more frames, but the client might still get some already in flight + LOG(DEBUG) << "Waiting for stream thread to end..."; + lock.unlock(); + if (mCaptureThread.joinable()) { + mCaptureThread.join(); + } + lock.lock(); + + mStreamState = STOPPED; + mStream = nullptr; + LOG(DEBUG) << "Stream marked STOPPED."; + + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::getExtendedInfo(int32_t opaqueIdentifier, + std::vector* opaqueValue) { + const auto it = mExtInfo.find(opaqueIdentifier); + if (it == mExtInfo.end()) { + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); + } else { + *opaqueValue = mExtInfo[opaqueIdentifier]; + } + + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::setExtendedInfo(int32_t opaqueIdentifier, + const std::vector& opaqueValue) { + mExtInfo.insert_or_assign(opaqueIdentifier, opaqueValue); + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::getPhysicalCameraInfo([[maybe_unused]] const std::string& id, + CameraDesc* _aidl_return) { + LOG(DEBUG) << __FUNCTION__; + + // This method works exactly same as getCameraInfo() in EVS HW module. + *_aidl_return = mDescription; + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::pauseVideoStream() { + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); +} + +ScopedAStatus EvsMockCamera::resumeVideoStream() { + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); +} + +ScopedAStatus EvsMockCamera::setPrimaryClient() { + /* Because EVS HW module reference implementation expects a single client at + * a time, this returns a success code always. + */ + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::forcePrimaryClient(const std::shared_ptr&) { + /* Because EVS HW module reference implementation expects a single client at + * a time, this returns a success code always. + */ + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::unsetPrimaryClient() { + /* Because EVS HW module reference implementation expects a single client at + * a time, there is no chance that this is called by the secondary client and + * therefore returns a success code always. + */ + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::getParameterList(std::vector* _aidl_return) { + if (mCameraInfo) { + _aidl_return->resize(mCameraInfo->controls.size()); + auto idx = 0; + for (auto& [name, range] : mCameraInfo->controls) { + (*_aidl_return)[idx++] = name; + } + } + + return ScopedAStatus::ok(); +} + +ScopedAStatus EvsMockCamera::getIntParameterRange([[maybe_unused]] CameraParam id, + [[maybe_unused]] ParameterRange* _aidl_return) { + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); +} + +ScopedAStatus EvsMockCamera::setIntParameter( + [[maybe_unused]] CameraParam id, [[maybe_unused]] int32_t value, + [[maybe_unused]] std::vector* effectiveValue) { + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); +} + +ScopedAStatus EvsMockCamera::getIntParameter([[maybe_unused]] CameraParam id, + [[maybe_unused]] std::vector* value) { + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); +} + +ScopedAStatus EvsMockCamera::importExternalBuffers( + [[maybe_unused]] const std::vector& buffers, + [[maybe_unused]] int32_t* _aidl_return) { + LOG(DEBUG) << "This implementation does not support an external buffer import."; + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); +} + +bool EvsMockCamera::setAvailableFrames_Locked(unsigned bufferCount) { + if (bufferCount < 1) { + LOG(ERROR) << "Ignoring request to set buffer count to zero"; + return false; + } + if (bufferCount > kMaxBuffersInFlight) { + LOG(ERROR) << "Rejecting buffer request in excess of internal limit"; + return false; + } + + // Is an increase required? + if (mFramesAllowed < bufferCount) { + // An increase is required + auto needed = bufferCount - mFramesAllowed; + LOG(INFO) << "Allocating " << needed << " buffers for camera frames"; + + auto added = increaseAvailableFrames_Locked(needed); + if (added != needed) { + // If we didn't add all the frames we needed, then roll back to the previous state + LOG(ERROR) << "Rolling back to previous frame queue size"; + decreaseAvailableFrames_Locked(added); + return false; + } + } else if (mFramesAllowed > bufferCount) { + // A decrease is required + auto framesToRelease = mFramesAllowed - bufferCount; + LOG(INFO) << "Returning " << framesToRelease << " camera frame buffers"; + + auto released = decreaseAvailableFrames_Locked(framesToRelease); + if (released != framesToRelease) { + // This shouldn't happen with a properly behaving client because the client + // should only make this call after returning sufficient outstanding buffers + // to allow a clean resize. + LOG(ERROR) << "Buffer queue shrink failed -- too many buffers currently in use?"; + } + } + + return true; +} + +unsigned EvsMockCamera::increaseAvailableFrames_Locked(unsigned numToAdd) { + // Acquire the graphics buffer allocator + ::android::GraphicBufferAllocator& alloc(::android::GraphicBufferAllocator::get()); + + unsigned added = 0; + while (added < numToAdd) { + unsigned pixelsPerLine = 0; + buffer_handle_t memHandle = nullptr; + auto result = alloc.allocate(mWidth, mHeight, mFormat, 1, mUsage, &memHandle, + &pixelsPerLine, 0, "EvsMockCamera"); + if (result != ::android::NO_ERROR) { + LOG(ERROR) << "Error " << result << " allocating " << mWidth << " x " << mHeight + << " graphics buffer"; + break; + } + if (memHandle == nullptr) { + LOG(ERROR) << "We didn't get a buffer handle back from the allocator"; + break; + } + if (mStride > 0) { + if (mStride != pixelsPerLine) { + LOG(ERROR) << "We did not expect to get buffers with different strides!"; + } + } else { + // Gralloc defines stride in terms of pixels per line + mStride = pixelsPerLine; + } + + // Find a place to store the new buffer + auto stored = false; + for (auto&& rec : mBuffers) { + if (rec.handle == nullptr) { + // Use this existing entry + rec.handle = memHandle; + rec.inUse = false; + stored = true; + break; + } + } + if (!stored) { + // Add a BufferRecord wrapping this handle to our set of available buffers + mBuffers.push_back(BufferRecord(memHandle)); + } + + ++mFramesAllowed; + ++added; + } + + return added; +} + +unsigned EvsMockCamera::decreaseAvailableFrames_Locked(unsigned numToRemove) { + // Acquire the graphics buffer allocator + ::android::GraphicBufferAllocator& alloc(::android::GraphicBufferAllocator::get()); + + unsigned removed = 0; + for (auto&& rec : mBuffers) { + // Is this record not in use, but holding a buffer that we can free? + if ((rec.inUse == false) && (rec.handle != nullptr)) { + // Release buffer and update the record so we can recognize it as "empty" + alloc.free(rec.handle); + rec.handle = nullptr; + + --mFramesAllowed; + ++removed; + + if (removed == numToRemove) { + break; + } + } + } + + return removed; +} + +// This is the asynchronous frame generation thread that runs in parallel with the +// main serving thread. There is one for each active camera instance. +void EvsMockCamera::generateFrames() { + LOG(DEBUG) << "Frame generation loop started."; + + unsigned idx = 0; + while (true) { + bool timeForFrame = false; + const nsecs_t startTime = systemTime(SYSTEM_TIME_MONOTONIC); + + // Lock scope for updating shared state + { + std::lock_guard lock(mAccessLock); + + if (mStreamState != RUNNING) { + // Break out of our main thread loop + break; + } + + // Are we allowed to issue another buffer? + if (mFramesInUse >= mFramesAllowed) { + // Can't do anything right now -- skip this frame + LOG(WARNING) << "Skipped a frame because too many are in flight."; + } else { + // Identify an available buffer to fill + for (idx = 0; idx < mBuffers.size(); idx++) { + if (!mBuffers[idx].inUse) { + if (mBuffers[idx].handle != nullptr) { + // Found an available record, so stop looking + break; + } + } + } + if (idx >= mBuffers.size()) { + // This shouldn't happen since we already checked mFramesInUse vs mFramesAllowed + ALOGE("Failed to find an available buffer slot\n"); + } else { + // We're going to make the frame busy + mBuffers[idx].inUse = true; + mFramesInUse++; + timeForFrame = true; + } + } + } + + if (timeForFrame) { + using AidlPixelFormat = ::aidl::android::hardware::graphics::common::PixelFormat; + + // Assemble the buffer description we'll transmit below + buffer_handle_t memHandle = mBuffers[idx].handle; + BufferDesc newBuffer = { + .buffer = + { + .description = + { + .width = static_cast(mWidth), + .height = static_cast(mHeight), + .layers = 1, + .format = static_cast(mFormat), + .usage = static_cast(mUsage), + .stride = static_cast(mStride), + }, + .handle = ::android::dupToAidl(memHandle), + }, + .bufferId = static_cast(idx), + .deviceId = mDescription.id, + .timestamp = static_cast(::android::elapsedRealtimeNano() * + 1e+3), // timestamps is in microseconds + }; + + // Write test data into the image buffer + fillMockFrame(memHandle, reinterpret_cast( + &newBuffer.buffer.description)); + + // Issue the (asynchronous) callback to the client -- can't be holding the lock + auto flag = false; + if (mStream) { + std::vector frames; + frames.push_back(std::move(newBuffer)); + flag = mStream->deliverFrame(frames).isOk(); + } + + if (flag) { + LOG(DEBUG) << "Delivered " << memHandle << ", id = " << mBuffers[idx].handle; + } else { + // This can happen if the client dies and is likely unrecoverable. + // To avoid consuming resources generating failing calls, we stop sending + // frames. Note, however, that the stream remains in the "STREAMING" state + // until cleaned up on the main thread. + LOG(ERROR) << "Frame delivery call failed in the transport layer."; + + // Since we didn't actually deliver it, mark the frame as available + std::lock_guard lock(mAccessLock); + mBuffers[idx].inUse = false; + mFramesInUse--; + } + } + + // We arbitrarily choose to generate frames at 15 fps to ensure we pass the 10fps test + // requirement + static const int kTargetFrameRate = 15; + static const nsecs_t kTargetFrameIntervalUs = 1000 * 1000 / kTargetFrameRate; + const nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); + const nsecs_t elapsedTimeUs = (now - startTime) / 1000; + const nsecs_t sleepDurationUs = kTargetFrameIntervalUs - elapsedTimeUs; + if (sleepDurationUs > 0) { + usleep(sleepDurationUs); + } + } + + // If we've been asked to stop, send an event to signal the actual end of stream + EvsEventDesc event = { + .aType = EvsEventType::STREAM_STOPPED, + }; + if (!mStream->notify(event).isOk()) { + ALOGE("Error delivering end of stream marker"); + } + + return; +} + +void EvsMockCamera::fillMockFrame(buffer_handle_t handle, const AHardwareBuffer_Desc* pDesc) { + // Lock our output buffer for writing + uint32_t* pixels = nullptr; + ::android::GraphicBufferMapper& mapper = ::android::GraphicBufferMapper::get(); + mapper.lock(handle, GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_NEVER, + ::android::Rect(pDesc->width, pDesc->height), (void**)&pixels); + + // If we failed to lock the pixel buffer, we're about to crash, but log it first + if (!pixels) { + ALOGE("Camera failed to gain access to image buffer for writing"); + return; + } + + // Fill in the test pixels; the colorbar in ABGR format + for (unsigned row = 0; row < pDesc->height; row++) { + for (unsigned col = 0; col < pDesc->width; col++) { + const uint32_t index = col * kNumColors / pDesc->width; + pixels[col] = kColors[index]; + } + // Point to the next row + // NOTE: stride retrieved from gralloc is in units of pixels + pixels = pixels + pDesc->stride; + } + + // Release our output buffer + mapper.unlock(handle); +} + +void EvsMockCamera::returnBufferLocked(const uint32_t bufferId) { + if (bufferId >= mBuffers.size()) { + ALOGE("ignoring doneWithFrame called with invalid bufferId %d (max is %zu)", bufferId, + mBuffers.size() - 1); + return; + } + + if (!mBuffers[bufferId].inUse) { + ALOGE("ignoring doneWithFrame called on frame %d which is already free", bufferId); + return; + } + + // Mark the frame as available + mBuffers[bufferId].inUse = false; + mFramesInUse--; + + // If this frame's index is high in the array, try to move it down + // to improve locality after mFramesAllowed has been reduced. + if (bufferId >= mFramesAllowed) { + // Find an empty slot lower in the array (which should always exist in this case) + for (auto&& rec : mBuffers) { + if (rec.handle == nullptr) { + rec.handle = mBuffers[bufferId].handle; + mBuffers[bufferId].handle = nullptr; + break; + } + } + } +} + +std::shared_ptr EvsMockCamera::Create(const char* deviceName) { + std::unique_ptr nullCamInfo = nullptr; + + return Create(deviceName, nullCamInfo); +} + +std::shared_ptr EvsMockCamera::Create( + const char* deviceName, std::unique_ptr& camInfo, + [[maybe_unused]] const Stream* streamCfg) { + std::shared_ptr c = + ndk::SharedRefBase::make(Sigil{}, deviceName, camInfo); + if (!c) { + LOG(ERROR) << "Failed to instantiate EvsMockCamera."; + return nullptr; + } + + // Use the first resolution from the list for the testing + // TODO(b/214835237): Uses a given Stream configuration to choose the best + // stream configuration. + auto it = camInfo->streamConfigurations.begin(); + c->mWidth = it->second.width; + c->mHeight = it->second.height; + c->mDescription.vendorFlags = 0xFFFFFFFF; // Arbitrary test value + + c->mFormat = HAL_PIXEL_FORMAT_RGBA_8888; + c->mUsage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_CAMERA_WRITE | + GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_RARELY; + + return c; +} + +} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/src/GlWrapper.cpp b/automotive/evs/aidl/impl/default/src/GlWrapper.cpp new file mode 100644 index 0000000000..0ee5ecb734 --- /dev/null +++ b/automotive/evs/aidl/impl/default/src/GlWrapper.cpp @@ -0,0 +1,465 @@ +/* + * 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. + */ + +#include "GlWrapper.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +namespace { + +using ::aidl::android::frameworks::automotive::display::DisplayDesc; +using ::aidl::android::frameworks::automotive::display::ICarDisplayProxy; +using ::aidl::android::frameworks::automotive::display::Rotation; +using ::aidl::android::hardware::common::NativeHandle; +using ::aidl::android::hardware::graphics::common::HardwareBufferDescription; +using ::android::GraphicBuffer; +using ::android::sp; + +constexpr const char vertexShaderSource[] = + "attribute vec4 pos; \n" + "attribute vec2 tex; \n" + "varying vec2 uv; \n" + "void main() \n" + "{ \n" + " gl_Position = pos; \n" + " uv = tex; \n" + "} \n"; + +constexpr const char pixelShaderSource[] = + "precision mediump float; \n" + "uniform sampler2D tex; \n" + "varying vec2 uv; \n" + "void main() \n" + "{ \n" + " gl_FragColor = texture2D(tex, uv);\n" + "} \n"; + +const char* getEGLError(void) { + switch (eglGetError()) { + case EGL_SUCCESS: + return "EGL_SUCCESS"; + case EGL_NOT_INITIALIZED: + return "EGL_NOT_INITIALIZED"; + case EGL_BAD_ACCESS: + return "EGL_BAD_ACCESS"; + case EGL_BAD_ALLOC: + return "EGL_BAD_ALLOC"; + case EGL_BAD_ATTRIBUTE: + return "EGL_BAD_ATTRIBUTE"; + case EGL_BAD_CONTEXT: + return "EGL_BAD_CONTEXT"; + case EGL_BAD_CONFIG: + return "EGL_BAD_CONFIG"; + case EGL_BAD_CURRENT_SURFACE: + return "EGL_BAD_CURRENT_SURFACE"; + case EGL_BAD_DISPLAY: + return "EGL_BAD_DISPLAY"; + case EGL_BAD_SURFACE: + return "EGL_BAD_SURFACE"; + case EGL_BAD_MATCH: + return "EGL_BAD_MATCH"; + case EGL_BAD_PARAMETER: + return "EGL_BAD_PARAMETER"; + case EGL_BAD_NATIVE_PIXMAP: + return "EGL_BAD_NATIVE_PIXMAP"; + case EGL_BAD_NATIVE_WINDOW: + return "EGL_BAD_NATIVE_WINDOW"; + case EGL_CONTEXT_LOST: + return "EGL_CONTEXT_LOST"; + default: + return "Unknown error"; + } +} + +// Given shader source, load and compile it +GLuint loadShader(GLenum type, const char* shaderSrc) { + // Create the shader object + GLuint shader = glCreateShader(type); + if (shader == 0) { + return 0; + } + + // Load and compile the shader + glShaderSource(shader, 1, &shaderSrc, nullptr); + glCompileShader(shader); + + // Verify the compilation worked as expected + GLint compiled = 0; + glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled); + if (!compiled) { + LOG(ERROR) << "Error compiling shader"; + + GLint size = 0; + glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &size); + if (size > 0) { + // Get and report the error message + char* infoLog = (char*)malloc(size); + glGetShaderInfoLog(shader, size, nullptr, infoLog); + LOG(ERROR) << " msg:" << std::endl << infoLog; + free(infoLog); + } + + glDeleteShader(shader); + return 0; + } + + return shader; +} + +// Create a program object given vertex and pixels shader source +GLuint buildShaderProgram(const char* vtxSrc, const char* pxlSrc) { + GLuint program = glCreateProgram(); + if (program == 0) { + LOG(ERROR) << "Failed to allocate program object"; + return 0; + } + + // Compile the shaders and bind them to this program + GLuint vertexShader = loadShader(GL_VERTEX_SHADER, vtxSrc); + if (vertexShader == 0) { + LOG(ERROR) << "Failed to load vertex shader"; + glDeleteProgram(program); + return 0; + } + GLuint pixelShader = loadShader(GL_FRAGMENT_SHADER, pxlSrc); + if (pixelShader == 0) { + LOG(ERROR) << "Failed to load pixel shader"; + glDeleteProgram(program); + glDeleteShader(vertexShader); + return 0; + } + glAttachShader(program, vertexShader); + glAttachShader(program, pixelShader); + + glBindAttribLocation(program, 0, "pos"); + glBindAttribLocation(program, 1, "tex"); + + // Link the program + glLinkProgram(program); + GLint linked = 0; + glGetProgramiv(program, GL_LINK_STATUS, &linked); + if (!linked) { + LOG(ERROR) << "Error linking program"; + GLint size = 0; + glGetProgramiv(program, GL_INFO_LOG_LENGTH, &size); + if (size > 0) { + // Get and report the error message + char* infoLog = (char*)malloc(size); + glGetProgramInfoLog(program, size, nullptr, infoLog); + LOG(ERROR) << " msg: " << infoLog; + free(infoLog); + } + + glDeleteProgram(program); + glDeleteShader(vertexShader); + glDeleteShader(pixelShader); + return 0; + } + + return program; +} + +::android::sp convertNativeHandleToHGBP(const NativeHandle& aidlHandle) { + native_handle_t* handle = ::android::dupFromAidl(aidlHandle); + if (handle->numFds != 0 || handle->numInts < std::ceil(sizeof(size_t) / sizeof(int))) { + LOG(ERROR) << "Invalid native handle"; + return nullptr; + } + ::android::hardware::hidl_vec halToken; + halToken.setToExternal(reinterpret_cast(const_cast(&(handle->data[1]))), + handle->data[0]); + ::android::sp hgbp = + HGraphicBufferProducer::castFrom(::android::retrieveHalInterface(halToken)); + return std::move(hgbp); +} + +} // namespace + +namespace aidl::android::hardware::automotive::evs::implementation { + +// Main entry point +bool GlWrapper::initialize(const std::shared_ptr& pWindowProxy, + uint64_t displayId) { + LOG(DEBUG) << __FUNCTION__; + + if (!pWindowProxy) { + LOG(ERROR) << "Could not get ICarDisplayProxy."; + return false; + } + + DisplayDesc displayDesc; + auto status = pWindowProxy->getDisplayInfo(displayId, &displayDesc); + if (!status.isOk()) { + LOG(ERROR) << "Failed to read the display information"; + return false; + } + + mWidth = displayDesc.width; + mHeight = displayDesc.height; + if ((displayDesc.orientation != Rotation::ROTATION_0) && + (displayDesc.orientation != Rotation::ROTATION_180)) { + std::swap(mWidth, mHeight); + } + LOG(INFO) << "Display resolution is " << mWidth << "x" << mHeight; + + NativeHandle aidlHandle; + status = pWindowProxy->getHGraphicBufferProducer(displayId, &aidlHandle); + if (!status.isOk()) { + LOG(ERROR) << "Failed to get IGraphicBufferProducer from ICarDisplayProxy."; + return false; + } + + mGfxBufferProducer = convertNativeHandleToHGBP(aidlHandle); + if (!mGfxBufferProducer) { + LOG(ERROR) << "Failed to convert a NativeHandle to HGBP."; + return false; + } + + mSurfaceHolder = getSurfaceFromHGBP(mGfxBufferProducer); + if (mSurfaceHolder == nullptr) { + LOG(ERROR) << "Failed to get a Surface from HGBP."; + return false; + } + + mWindow = getNativeWindow(mSurfaceHolder.get()); + if (mWindow == nullptr) { + LOG(ERROR) << "Failed to get a native window from Surface."; + return false; + } + + // Set up our OpenGL ES context associated with the default display + mDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); + if (mDisplay == EGL_NO_DISPLAY) { + LOG(ERROR) << "Failed to get egl display"; + return false; + } + + EGLint major = 2; + EGLint minor = 0; + if (!eglInitialize(mDisplay, &major, &minor)) { + LOG(ERROR) << "Failed to initialize EGL: " << getEGLError(); + return false; + } + + const EGLint config_attribs[] = { + // clang-format off + // Tag Value + EGL_RED_SIZE, 8, + EGL_GREEN_SIZE, 8, + EGL_BLUE_SIZE, 8, + EGL_DEPTH_SIZE, 0, + EGL_NONE + // clang-format on + }; + + // Pick the default configuration without constraints (is this good enough?) + EGLConfig egl_config = {0}; + EGLint numConfigs = -1; + eglChooseConfig(mDisplay, config_attribs, &egl_config, 1, &numConfigs); + if (numConfigs != 1) { + LOG(ERROR) << "Didn't find a suitable format for our display window, " << getEGLError(); + return false; + } + + // Create the EGL render target surface + mSurface = eglCreateWindowSurface(mDisplay, egl_config, mWindow, nullptr); + if (mSurface == EGL_NO_SURFACE) { + LOG(ERROR) << "eglCreateWindowSurface failed, " << getEGLError(); + return false; + } + + // Create the EGL context + // NOTE: Our shader is (currently at least) written to require version 3, so this + // is required. + const EGLint context_attribs[] = {EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE}; + mContext = eglCreateContext(mDisplay, egl_config, EGL_NO_CONTEXT, context_attribs); + if (mContext == EGL_NO_CONTEXT) { + LOG(ERROR) << "Failed to create OpenGL ES Context: " << getEGLError(); + return false; + } + + // Activate our render target for drawing + if (!eglMakeCurrent(mDisplay, mSurface, mSurface, mContext)) { + LOG(ERROR) << "Failed to make the OpenGL ES Context current: " << getEGLError(); + return false; + } + + // Create the shader program for our simple pipeline + mShaderProgram = buildShaderProgram(vertexShaderSource, pixelShaderSource); + if (!mShaderProgram) { + LOG(ERROR) << "Failed to build shader program: " << getEGLError(); + return false; + } + + // Create a GL texture that will eventually wrap our externally created texture surface(s) + glGenTextures(1, &mTextureMap); + if (mTextureMap <= 0) { + LOG(ERROR) << "Didn't get a texture handle allocated: " << getEGLError(); + return false; + } + + // Turn off mip-mapping for the created texture surface + // (the inbound camera imagery doesn't have MIPs) + glBindTexture(GL_TEXTURE_2D, mTextureMap); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glBindTexture(GL_TEXTURE_2D, 0); + + return true; +} + +void GlWrapper::shutdown() { + // Drop our device textures + if (mKHRimage != EGL_NO_IMAGE_KHR) { + eglDestroyImageKHR(mDisplay, mKHRimage); + mKHRimage = EGL_NO_IMAGE_KHR; + } + + // Release all GL resources + if (eglGetCurrentContext() == mContext) { + eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + } + eglDestroySurface(mDisplay, mSurface); + eglDestroyContext(mDisplay, mContext); + eglTerminate(mDisplay); + mSurface = EGL_NO_SURFACE; + mContext = EGL_NO_CONTEXT; + mDisplay = EGL_NO_DISPLAY; + + // Release the window + mSurfaceHolder = nullptr; +} + +void GlWrapper::showWindow(const std::shared_ptr& pWindowProxy, uint64_t id) { + if (pWindowProxy) { + pWindowProxy->showWindow(id); + } else { + LOG(ERROR) << "ICarDisplayProxy is not available."; + } +} + +void GlWrapper::hideWindow(const std::shared_ptr& pWindowProxy, uint64_t id) { + if (pWindowProxy) { + pWindowProxy->hideWindow(id); + } else { + LOG(ERROR) << "ICarDisplayProxy is not available."; + } +} + +bool GlWrapper::updateImageTexture(buffer_handle_t handle, + const HardwareBufferDescription& description) { + if (mKHRimage != EGL_NO_IMAGE_KHR) { + return true; + } + + // Create a temporary GraphicBuffer to wrap the provided handle. + sp pGfxBuffer = + new GraphicBuffer(description.width, description.height, + static_cast<::android::PixelFormat>(description.format), + description.layers, static_cast(description.usage), + description.stride, const_cast(handle), + /* keepOwnership= */ false); + if (!pGfxBuffer) { + LOG(ERROR) << "Failed to allocate GraphicBuffer to wrap our native handle"; + return false; + } + + // Get a GL compatible reference to the graphics buffer we've been given + EGLint eglImageAttributes[] = {EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE}; + EGLClientBuffer cbuf = static_cast(pGfxBuffer->getNativeBuffer()); + mKHRimage = eglCreateImageKHR(mDisplay, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID, cbuf, + eglImageAttributes); + if (mKHRimage == EGL_NO_IMAGE_KHR) { + LOG(ERROR) << "Error creating EGLImage: " << getEGLError(); + return false; + } + + // Update the texture handle we already created to refer to this gralloc buffer + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, mTextureMap); + glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, static_cast(mKHRimage)); + + return true; +} + +void GlWrapper::renderImageToScreen() { + // Set the viewport + glViewport(0, 0, mWidth, mHeight); + + // Clear the color buffer + glClearColor(0.1f, 0.5f, 0.1f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT); + + // Select our screen space simple texture shader + glUseProgram(mShaderProgram); + + // Bind the texture and assign it to the shader's sampler + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, mTextureMap); + GLint sampler = glGetUniformLocation(mShaderProgram, "tex"); + glUniform1i(sampler, 0); + + // We want our image to show up opaque regardless of alpha values + glDisable(GL_BLEND); + + // Draw a rectangle on the screen + GLfloat vertsCarPos[] = { + // clang-format off + -0.8, 0.8, 0.0f, // left top in window space + 0.8, 0.8, 0.0f, // right top + -0.8, -0.8, 0.0f, // left bottom + 0.8, -0.8, 0.0f // right bottom + // clang-format on + }; + + // NOTE: We didn't flip the image in the texture, so V=0 is actually the top of the image + GLfloat vertsCarTex[] = { + // clang-format off + 0.0f, 0.0f, // left top + 1.0f, 0.0f, // right top + 0.0f, 1.0f, // left bottom + 1.0f, 1.0f // right bottom + // clang-format on + }; + glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, vertsCarPos); + glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, vertsCarTex); + glEnableVertexAttribArray(0); + glEnableVertexAttribArray(1); + + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + + // Clean up and flip the rendered result to the front so it is visible + glDisableVertexAttribArray(0); + glDisableVertexAttribArray(1); + + glFinish(); + + if (eglSwapBuffers(mDisplay, mSurface) == EGL_FALSE) { + LOG(WARNING) << "Failed to swap EGL buffers, " << getEGLError(); + } +} + +} // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/src/service.cpp b/automotive/evs/aidl/impl/default/src/service.cpp index 0a0913fd3c..7532d8735f 100644 --- a/automotive/evs/aidl/impl/default/src/service.cpp +++ b/automotive/evs/aidl/impl/default/src/service.cpp @@ -14,38 +14,75 @@ * limitations under the License. */ -#define LOG_TAG "EvsService" - -#include +#include "EvsEnumerator.h" +#include "EvsGlDisplay.h" #include #include #include -using ::aidl::android::hardware::automotive::evs::implementation::DefaultEvsEnumerator; +#include -int main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) { - std::shared_ptr vhal = ndk::SharedRefBase::make(); +#include +#include +#include - ALOGI("Registering as service..."); - binder_exception_t err = - AServiceManager_addService(vhal->asBinder().get(), "android.hardware.automotive.evs"); +namespace { + +using ::aidl::android::frameworks::automotive::display::ICarDisplayProxy; +using ::aidl::android::hardware::automotive::evs::implementation::EvsEnumerator; + +constexpr std::string_view kDisplayServiceInstanceName = "/default"; +constexpr std::string_view kHwInstanceName = "/hw/0"; +constexpr int kNumBinderThreads = 1; + +} // namespace + +int main() { + LOG(INFO) << "EVS Hardware Enumerator service is starting"; + + const std::string displayServiceInstanceName = + std::string(ICarDisplayProxy::descriptor) + std::string(kDisplayServiceInstanceName); + if (!AServiceManager_isDeclared(displayServiceInstanceName.data())) { + // TODO: We may just want to disable EVS display. + LOG(ERROR) << displayServiceInstanceName << " is required."; + return EXIT_FAILURE; + } + + std::shared_ptr displayService = ICarDisplayProxy::fromBinder( + ::ndk::SpAIBinder(AServiceManager_waitForService(displayServiceInstanceName.data()))); + if (!displayService) { + LOG(ERROR) << "Cannot use " << displayServiceInstanceName << ". Exiting."; + return EXIT_FAILURE; + } + + // Register our service -- if somebody is already registered by our name, + // they will be killed (their thread pool will throw an exception). + std::shared_ptr service = + ndk::SharedRefBase::make(displayService); + if (!service) { + LOG(ERROR) << "Failed to instantiate the service"; + return EXIT_FAILURE; + } + + const std::string instanceName = + std::string(EvsEnumerator::descriptor) + std::string(kHwInstanceName); + auto err = AServiceManager_addService(service->asBinder().get(), instanceName.data()); if (err != EX_NONE) { - ALOGE("failed to register android.hardware.automotive.evs service, exception: %d", err); - return 1; + LOG(ERROR) << "Failed to register " << instanceName << ", exception = " << err; + return EXIT_FAILURE; } - if (!ABinderProcess_setThreadPoolMaxThreadCount(1)) { - ALOGE("%s", "failed to set thread pool max thread count"); - return 1; + if (!ABinderProcess_setThreadPoolMaxThreadCount(kNumBinderThreads)) { + LOG(ERROR) << "Failed to set thread pool"; + return EXIT_FAILURE; } + ABinderProcess_startThreadPool(); - - ALOGI("Evs Service Ready"); + LOG(INFO) << "EVS Hardware Enumerator is ready"; ABinderProcess_joinThreadPool(); - - ALOGI("Evs Service Exiting"); - - return 0; + // In normal operation, we don't expect the thread pool to exit + LOG(INFO) << "EVS Hardware Enumerator is shutting down"; + return EXIT_SUCCESS; } From 452fefe49903b539cb57e26c036161b93bb0e7d1 Mon Sep 17 00:00:00 2001 From: Changyeon Jo Date: Mon, 13 Mar 2023 23:19:08 +0000 Subject: [PATCH 863/998] Revert "Revert "Remove automotive.evs HIDL entry in compat matrix."" This reverts commit 9ed325bfffbac128073c3e265ab79ff084ae15f8. Bug: 218588089 Test: 1. Build cf_x86_64_auto lunch target. 2. Launch cvd in the accelerated graphics mode. 3. Run evs_app and confirm the color bar pattern is shown on the display. > adb root && adb shell evs_app --test 4. Do the same on sdk_car_x86_64 lunch target. Change-Id: If15ee3c14eb2a9fce00bd7950b717e7fc690755b --- compatibility_matrices/compatibility_matrix.8.xml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.8.xml b/compatibility_matrices/compatibility_matrix.8.xml index 6def4b8d4c..599915812f 100644 --- a/compatibility_matrices/compatibility_matrix.8.xml +++ b/compatibility_matrices/compatibility_matrix.8.xml @@ -84,15 +84,6 @@ [a-z]+/[0-9]+ - - android.hardware.automotive.evs - 1.0-1 - - IEvsEnumerator - default - [a-z]+/[0-9]+ - - android.hardware.automotive.occupant_awareness 1 From 97d9c731d8ea5daf9cf78db5d7ced2ccdb1d860a Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Fri, 17 Mar 2023 16:54:59 -0700 Subject: [PATCH 864/998] Specify that a read_write property can be read only in HAL Not all read_write properties are included. For example, properties not exposed through CarPropertyManager are not included. The only other exception is HVAC_TEMPERATURE_VALUE_SUGGESTION because it behaves like a function call so it needs to be writable. Bug: 195962745 Test: presubmit Change-Id: Ief758fd45b7d21ba2d81899d5bb056c3bc24b15b --- .../automotive/vehicle/VehicleProperty.aidl | 358 ++++++++++++++++-- 1 file changed, 330 insertions(+), 28 deletions(-) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 0326ea233f..2dc453c017 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -340,6 +340,9 @@ enum VehicleProperty { /** * Fuel door open * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -375,6 +378,9 @@ enum VehicleProperty { /** * EV charge port open * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -407,9 +413,9 @@ enum VehicleProperty { * all energy sources in a vehicle. For example, a hybrid car's range will * be the sum of the ranges based on fuel and battery. * - * This property may be writable because a navigation app could update the range if it has a - * more accurate estimate based on the upcoming route. However, this property can be set to - * VehiclePropertyAccess.READ only at the OEM's discretion. + * This property is defined as VehiclePropertyAccess.READ_WRITE because a navigation app could + * update the range if it has a more accurate estimate based on the upcoming route. However, + * this property can be implemented as VehiclePropertyAccess.READ only at the OEM's discretion. * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ_WRITE @@ -465,6 +471,9 @@ enum VehicleProperty { * If true, the vehicle may automatically shut off the engine when it is not needed and then * automatically restart it when needed. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -544,6 +553,9 @@ enum VehicleProperty { * regenerated from braking. The minInt32Value in default area's VehicleAreaConfig indicates no * regenerative braking. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -629,6 +641,9 @@ enum VehicleProperty { * * The EvStoppingMode enum may be extended to include more states in the future. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @data_enum EvStoppingMode @@ -683,6 +698,9 @@ enum VehicleProperty { * * Fan speed setting * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -691,6 +709,9 @@ enum VehicleProperty { /** * Fan direction setting * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleHvacFanDirection @@ -727,6 +748,9 @@ enum VehicleProperty { * that property to get the suggested value before setting HVAC_TEMPERATURE_SET. Otherwise, * the application may choose the value in HVAC_TEMPERATURE_SET configArray by itself. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @unit VehicleUnit:CELSIUS @@ -736,6 +760,9 @@ enum VehicleProperty { /** * Fan-based defrost for designated window. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -744,6 +771,9 @@ enum VehicleProperty { /** * On/off AC for designated areaId * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @config_flags Supported areaIds @@ -758,6 +788,9 @@ enum VehicleProperty { * Any parameters modified as a side effect of turning on/off the MAX AC * parameter shall generate onPropertyEvent() callbacks to the VHAL. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -777,6 +810,9 @@ enum VehicleProperty { * areaConfig.areaId = {ROW_1_LEFT | ROW_1_RIGHT} indicates HVAC_MAX_DEFROST_ON * only can be controlled for the front rows. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -790,6 +826,9 @@ enum VehicleProperty { * Recirc “off” means the majority of the airflow into the cabin is coming * from outside the car. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -825,6 +864,9 @@ enum VehicleProperty { * onPropertyEvent() callbacks (i.e. HVAC_DUAL_ON = false, * HVAC_TEMPERATURE_SET[AreaID] = xxx, etc). * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -833,6 +875,9 @@ enum VehicleProperty { /** * On/off automatic mode * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -849,6 +894,9 @@ enum VehicleProperty { * min/max range defines the allowable range and number of steps in each * direction. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -861,6 +909,9 @@ enum VehicleProperty { * The Max value in the config data represents the highest heating level. * The Min value in the config data MUST be zero and indicates no heating. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -875,6 +926,9 @@ enum VehicleProperty { * Negative value indicates cooling. * 0 indicates temperature control is off. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -896,6 +950,9 @@ enum VehicleProperty { * If updating HVAC_TEMPERATURE_DISPLAY_UNITS affects the values of other *_DISPLAY_UNITS * properties, then their values must be updated and communicated to the AAOS framework as well. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleUnit @@ -947,6 +1004,9 @@ enum VehicleProperty { * - ROW_1_LEFT | ROW_1_RIGHT * - ROW_2_LEFT | ROW_2_CENTER | ROW_2_RIGHT | ROW_3_LEFT | ROW_3_CENTER | ROW_3_RIGHT * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -978,6 +1038,9 @@ enum VehicleProperty { * switch to recirculation mode if the vehicle detects poor incoming air * quality. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -993,6 +1056,9 @@ enum VehicleProperty { * ventilation. This is different than seating cooling. It can be on at the * same time as cooling, or not. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1001,6 +1067,9 @@ enum VehicleProperty { /** * Electric defrosters' status * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1061,6 +1130,9 @@ enum VehicleProperty { * If updating DISTANCE_DISPLAY_UNITS affects the values of other *_DISPLAY_UNITS properties, * then their values must be updated and communicated to the AAOS framework as well. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleUnit @@ -1081,6 +1153,9 @@ enum VehicleProperty { * If updating FUEL_VOLUME_DISPLAY_UNITS affects the values of other *_DISPLAY_UNITS properties, * then their values must be updated and communicated to the AAOS framework as well. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleUnit @@ -1102,6 +1177,9 @@ enum VehicleProperty { * If updating TIRE_PRESSURE_DISPLAY_UNITS affects the values of other *_DISPLAY_UNITS * properties, then their values must be updated and communicated to the AAOS framework as well. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleUnit @@ -1123,6 +1201,9 @@ enum VehicleProperty { * If updating EV_BATTERY_DISPLAY_UNITS affects the values of other *_DISPLAY_UNITS properties, * then their values must be updated and communicated to the AAOS framework as well. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleUnit @@ -1136,6 +1217,9 @@ enum VehicleProperty { * True indicates units are distance over volume such as MPG. * False indicates units are volume over distance such as L/100KM. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1155,6 +1239,9 @@ enum VehicleProperty { * If updating VEHICLE_SPEED_DISPLAY_UNITS affects the values of other *_DISPLAY_UNITS * properties, then their values must be updated and communicated to the AAOS framework as well. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1282,7 +1369,6 @@ enum VehicleProperty { * * int32Values[0] : VehicleApPowerStateReport enum value * int32Values[1] : Time in ms to wake up, if necessary. Otherwise 0. - * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE @@ -1491,9 +1577,12 @@ enum VehicleProperty { * This is an integer in case a door may be set to a particular position. * Max value indicates fully open, min value (0) indicates fully closed. * - * Some vehicles (minivans) can open the door electronically. Hence, the + * Some vehicles (minivans) can open the door electronically. Hence, the * ability to write this property. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1502,6 +1591,9 @@ enum VehicleProperty { /** * Door move * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1512,6 +1604,9 @@ enum VehicleProperty { * * 'true' indicates door is locked * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1524,6 +1619,9 @@ enum VehicleProperty { * * If enabled, the door is unable to be opened from the inside. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1534,6 +1632,9 @@ enum VehicleProperty { * * Positive value indicates tilt upwards, negative value is downwards * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1544,6 +1645,9 @@ enum VehicleProperty { * * Positive value indicates tilt upwards, negative value is downwards * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1554,6 +1658,9 @@ enum VehicleProperty { * * Positive value indicate tilt right, negative value is left * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1564,6 +1671,9 @@ enum VehicleProperty { * * Positive value indicate tilt right, negative value is left * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1574,6 +1684,9 @@ enum VehicleProperty { * * True indicates mirror positions are locked and not changeable * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1584,6 +1697,9 @@ enum VehicleProperty { * * True indicates mirrors are folded * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1597,6 +1713,9 @@ enum VehicleProperty { * (for example, when the mirrors fold inward automatically when one exits and locks the * vehicle) is enabled. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1611,6 +1730,9 @@ enum VehicleProperty { * (for example, when the mirrors tilt downward automatically when one reverses the vehicle) is * enabled. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1654,6 +1776,9 @@ enum VehicleProperty { * Write access indicates automatic seat buckling capabilities. There are * no known cars at this time, but you never know... * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1666,6 +1791,9 @@ enum VehicleProperty { * Max value indicates highest position * Min value indicates lowest position * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1674,6 +1802,9 @@ enum VehicleProperty { /** * Seatbelt height move * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1686,6 +1817,9 @@ enum VehicleProperty { * Max value indicates closest to wheel, min value indicates most rearward * position. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1696,6 +1830,9 @@ enum VehicleProperty { * * Moves the seat position forward and aft. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1708,6 +1845,9 @@ enum VehicleProperty { * Max value indicates angling forward towards the steering wheel. * Min value indicates full recline. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1718,6 +1858,9 @@ enum VehicleProperty { * * Moves the backrest forward or recline. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1730,6 +1873,9 @@ enum VehicleProperty { * Max value indicates angling forward towards the steering wheel. * Min value indicates full recline. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1740,6 +1886,9 @@ enum VehicleProperty { * * Moves the backrest forward or recline. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1752,6 +1901,9 @@ enum VehicleProperty { * Max value indicates highest position. * Min value indicates lowest position. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1762,6 +1914,9 @@ enum VehicleProperty { * * Moves the seat height. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1774,6 +1929,9 @@ enum VehicleProperty { * Max value indicates longest depth position. * Min value indicates shortest position. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1784,6 +1942,9 @@ enum VehicleProperty { * * Adjusts the seat depth. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1796,6 +1957,9 @@ enum VehicleProperty { * Max value indicates front edge of seat higher than back edge. * Min value indicates front edge of seat lower than back edge. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1806,6 +1970,9 @@ enum VehicleProperty { * * Tilts the seat. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1818,6 +1985,9 @@ enum VehicleProperty { * Max value indicates most forward position. * Min value indicates most rearward position. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1828,6 +1998,9 @@ enum VehicleProperty { * * Adjusts the lumbar support. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1840,6 +2013,9 @@ enum VehicleProperty { * Max value indicates widest lumbar setting (i.e. least support) * Min value indicates thinnest lumbar setting. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1850,6 +2026,9 @@ enum VehicleProperty { * * Adjusts the amount of lateral lumbar support. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1866,6 +2045,9 @@ enum VehicleProperty { * Max value indicates tallest setting. * Min value indicates shortest setting. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1884,6 +2066,9 @@ enum VehicleProperty { * * This value is not in any particular unit but in a specified range of steps. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1895,6 +2080,9 @@ enum VehicleProperty { * * Moves the headrest up and down. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1907,6 +2095,9 @@ enum VehicleProperty { * Max value indicates most upright angle. * Min value indicates shallowest headrest angle. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1917,6 +2108,9 @@ enum VehicleProperty { * * Adjusts the angle of the headrest * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1929,6 +2123,9 @@ enum VehicleProperty { * Max value indicates position closest to front of car. * Min value indicates position closest to rear of car. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1937,6 +2134,9 @@ enum VehicleProperty { /** * Headrest fore/aft move * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -1978,6 +2178,9 @@ enum VehicleProperty { * For each supported area ID, the VehicleAreaConfig#supportedEnumValues must be defined unless * all enum values of VehicleLightSwitch are supported. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleLightSwitch @@ -1991,6 +2194,9 @@ enum VehicleProperty { * exit the vehicle. Each area ID must map to the seat that the user is trying to enter/exit * with the help of the easy access feature. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -2007,6 +2213,9 @@ enum VehicleProperty { * This property can be set to VehiclePropertyAccess.READ read only for the sake of regulation * or safety concerns. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -2023,6 +2232,9 @@ enum VehicleProperty { * * This value is not in any particular unit but in a specified range of steps. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -2042,6 +2254,9 @@ enum VehicleProperty { * Larger absolute values, either positive or negative, indicate a faster movement speed. Once * the seat cushion side support reaches the positional limit, the value resets to 0. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -2058,6 +2273,9 @@ enum VehicleProperty { * * This value is not in any particular unit but in a specified range of steps. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -2079,6 +2297,9 @@ enum VehicleProperty { * * This value is not in any particular unit but in a specified range of steps. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -2100,6 +2321,9 @@ enum VehicleProperty { * The area ID must match the seat that actually moves when the walk-in feature activates, not * the intended seat the passengers will sit in. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -2131,6 +2355,9 @@ enum VehicleProperty { * * Note that in this mode, 0 indicates the window is closed. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -2159,6 +2386,9 @@ enum VehicleProperty { * Max = open the sunroof, automatically stop when sunroof is fully open. * Min = open the vent, automatically stop when vent is fully open. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -2169,6 +2399,9 @@ enum VehicleProperty { * * True indicates windows are locked and can't be moved. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -2226,12 +2459,12 @@ enum VehicleProperty { * unless all states in WindshieldWipersSwitch are supported (including OTHER, which is not * recommended). * - * This property is defined as read_write, but OEMs have the option to implement it as read - * only. + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. * - * If this property is implemented as read_write and the OTHER state is listed in the - * VehicleAreaConfig#supportedEnumValues array, then OTHER is not a supported value for writing. - * It is only a supported value for reading. + * If this property is implemented as VehiclePropertyAccess.READ_WRITE and the OTHER state is + * listed in the VehicleAreaConfig#supportedEnumValues array, then OTHER is not a supported + * value for writing. It is only a supported value for reading. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE @@ -2254,6 +2487,9 @@ enum VehicleProperty { * * This value is not in any particular unit but in a specified range of steps. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -2273,6 +2509,9 @@ enum VehicleProperty { * * This value is not in any particular unit but in a specified range of steps. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -2290,6 +2529,9 @@ enum VehicleProperty { * * This value is not in any particular unit but in a specified range of steps. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -2308,6 +2550,9 @@ enum VehicleProperty { * * This value is not in any particular unit but in a specified range of steps. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -2319,6 +2564,9 @@ enum VehicleProperty { * If true, the steering wheel will lock automatically to prevent theft in certain * situations. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -2329,6 +2577,9 @@ enum VehicleProperty { * * If true, the steering wheel's position is locked and not changeable. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -2340,6 +2591,9 @@ enum VehicleProperty { * If true, the driver’s steering wheel will automatically adjust to make it easier for the * driver to enter and exit the vehicle. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -2362,6 +2616,9 @@ enum VehicleProperty { * front right dashboard has a glove box embedded in it, then the area ID should be * SEAT_1_RIGHT). * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -2377,6 +2634,9 @@ enum VehicleProperty { * front right dashboard has a glove box embedded in it, then the area ID should be * VehicleAreaSeat#ROW_1_RIGHT). * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -2588,6 +2848,9 @@ enum VehicleProperty { * * The setting that the user wants. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleLightSwitch @@ -2599,6 +2862,9 @@ enum VehicleProperty { * * The setting that the user wants. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleLightSwitch @@ -2626,6 +2892,9 @@ enum VehicleProperty { * Only one of FOG_LIGHTS_SWITCH or REAR_FOG_LIGHTS_SWITCH must be implemented and not both. * FRONT_FOG_LIGHTS_SWITCH must not be implemented. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleLightSwitch @@ -2637,6 +2906,9 @@ enum VehicleProperty { * * The setting that the user wants. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleLightSwitch @@ -2662,6 +2934,9 @@ enum VehicleProperty { * is open or because of a voice command. * For example, while the switch is in the "off" or "automatic" position. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleLightSwitch @@ -2687,6 +2962,9 @@ enum VehicleProperty { * is open or because of a voice command. * For example, while the switch is in the "off" or "automatic" position. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleLightSwitch @@ -2729,6 +3007,9 @@ enum VehicleProperty { * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues must be defined unless * all enum values of VehicleLightSwitch are supported. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleLightSwitch @@ -3395,6 +3676,9 @@ enum VehicleProperty { * Only one of FOG_LIGHTS_SWITCH or FRONT_FOG_LIGHTS_SWITCH must be implemented. Please refer to * the documentation on FOG_LIGHTS_SWITCH for more information. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleLightSwitch @@ -3423,6 +3707,9 @@ enum VehicleProperty { * Only one of FOG_LIGHTS_SWITCH or REAR_FOG_LIGHTS_SWITCH must be implemented. Please refer to * the documentation on FOG_LIGHTS_SWITCH for more information. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @data_enum VehicleLightSwitch @@ -3436,6 +3723,9 @@ enum VehicleProperty { * configArray[0] is used to specify the max current draw allowed by * the vehicle in Amperes. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @unit VehicleUnit:AMPERE @@ -3454,6 +3744,9 @@ enum VehicleProperty { * then the configArray should be {20, 40, 60, 80, 100} * If the configArray is empty then all values from 0 to 100 must be valid. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -3478,6 +3771,9 @@ enum VehicleProperty { * The setting that the user wants. Setting this property to true starts the battery charging * and setting to false stops charging. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE */ @@ -3670,8 +3966,8 @@ enum VehicleProperty { * low, that information must be conveyed through the ErrorState values in the * AUTOMATIC_EMERGENCY_BRAKING_STATE property. * - * This property is defined as read_write, but OEMs have the option to implement it as read - * only. + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE @@ -3712,8 +4008,8 @@ enum VehicleProperty { * low, that information must be conveyed through the ErrorState values in the * FORWARD_COLLISION_WARNING_STATE property. * - * This property is defined as read_write, but OEMs have the option to implement it as read - * only. + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE @@ -3751,8 +4047,8 @@ enum VehicleProperty { * information must be conveyed through the ErrorState values in the BLIND_SPOT_WARNING_STATE * property. * - * This property is defined as read_write, but OEMs have the option to implement it as read - * only. + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE @@ -3791,8 +4087,8 @@ enum VehicleProperty { * high, that information must be conveyed through the ErrorState values in the * LANE_DEPARTURE_WARNING_STATE property. * - * This property is defined as read_write, but OEMs have the option to implement it as read - * only. + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE @@ -3835,8 +4131,8 @@ enum VehicleProperty { * high, that information must be conveyed through the ErrorState values in the * LANE_KEEP_ASSIST_STATE property. * - * This property is defined as read_write, but OEMs have the option to implement it as read - * only. + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE @@ -3883,8 +4179,8 @@ enum VehicleProperty { * high, that information must be conveyed through the ErrorState values in the * LANE_CENTERING_ASSIST_STATE property. * - * This property is defined as read_write, but OEMs have the option to implement it as read - * only. + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE @@ -3951,8 +4247,8 @@ enum VehicleProperty { * low, that information must be conveyed through the ErrorState values in the * EMERGENCY_LANE_KEEP_ASSIST_STATE property. * - * This property is defined as read_write, but OEMs have the option to implement it as read - * only. + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE @@ -3994,8 +4290,8 @@ enum VehicleProperty { * information must be conveyed through the ErrorState values in the CRUISE_CONTROL_STATE * property. * - * This property is defined as read_write, but OEMs have the option to implement it as read - * only. + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE @@ -4019,6 +4315,9 @@ enum VehicleProperty { * Trying to write CruiseControlType#OTHER or an ErrorState to this property will throw an * IllegalArgumentException. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @data_enum CruiseControlType @@ -4101,6 +4400,9 @@ enum VehicleProperty { * When this property is not available because CC is disabled (i.e. CRUISE_CONTROL_ENABLED is * false), this property must return StatusCode#NOT_AVAILABLE_DISABLED. * + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE * @unit VehicleUnit:MILLI_SECS @@ -4144,8 +4446,8 @@ enum VehicleProperty { * not available due to some temporary state, that information must be conveyed through the * ErrorState values in the HANDS_ON_DETECTION_STATE property. * - * This property is defined as read_write, but OEMs have the option to implement it as read - * only. + * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to + * implement it as VehiclePropertyAccess.READ only. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ_WRITE From 5e80374926ab5f953b26e5fc52cb02c538356417 Mon Sep 17 00:00:00 2001 From: Austin Borger Date: Fri, 24 Mar 2023 18:28:12 -0700 Subject: [PATCH 865/998] Camera VTS: Fix processColorSpaceRequests. Changes were made to process10BitDynamicRangeRequest and the way frames are numbered. This needs to be carried over to processColorSpaceRequests. Bug: 275007341 Test: Ran process10BitColorSpaceRequest / process8BitColorSpaceRequest Change-Id: Ia0eb2fd71aff1bfc8398c85c68e1b9575a1cc058 --- camera/provider/aidl/vts/camera_aidl_test.cpp | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp index 058770ef5a..c315879ee5 100644 --- a/camera/provider/aidl/vts/camera_aidl_test.cpp +++ b/camera/provider/aidl/vts/camera_aidl_test.cpp @@ -3337,7 +3337,6 @@ void CameraAidlTest::processColorSpaceRequest( RequestAvailableColorSpaceProfilesMap colorSpace, RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile) { std::vector cameraDeviceNames = getCameraDeviceNames(mProvider); - int64_t bufferId = 1; CameraMetadata settings; for (const auto& name : cameraDeviceNames) { @@ -3456,12 +3455,12 @@ void CameraAidlTest::processColorSpaceRequest( // Stream as long as needed to fill the Hal inflight queue std::vector requests(halStreams[0].maxBuffers); - for (int32_t frameNumber = 0; frameNumber < requests.size(); frameNumber++) { + for (int32_t requestId = 0; requestId < requests.size(); requestId++) { std::shared_ptr inflightReq = std::make_shared( static_cast(halStreams.size()), false, supportsPartialResults, partialResultCount, std::unordered_set(), resultQueue); - CaptureRequest& request = requests[frameNumber]; + CaptureRequest& request = requests[requestId]; std::vector& outputBuffers = request.outputBuffers; outputBuffers.resize(halStreams.size()); @@ -3470,6 +3469,7 @@ void CameraAidlTest::processColorSpaceRequest( std::vector graphicBuffers; graphicBuffers.reserve(halStreams.size()); + auto bufferId = requestId + 1; // Buffer id value 0 is not valid for (const auto& halStream : halStreams) { buffer_handle_t buffer_handle; if (useHalBufManager) { @@ -3485,17 +3485,16 @@ void CameraAidlTest::processColorSpaceRequest( inflightReq->mOutstandingBufferIds[halStream.id][bufferId] = buffer_handle; graphicBuffers.push_back(buffer_handle); - outputBuffers[k] = {halStream.id, bufferId, - android::makeToAidl(buffer_handle), BufferStatus::OK, NativeHandle(), - NativeHandle()}; - bufferId++; + outputBuffers[k] = { + halStream.id, bufferId, android::makeToAidl(buffer_handle), + BufferStatus::OK, NativeHandle(), NativeHandle()}; } k++; } request.inputBuffer = { -1, 0, NativeHandle(), BufferStatus::ERROR, NativeHandle(), NativeHandle()}; - request.frameNumber = frameNumber; + request.frameNumber = bufferId; request.fmqSettingsSize = 0; request.settings = settings; request.inputWidth = 0; @@ -3503,9 +3502,8 @@ void CameraAidlTest::processColorSpaceRequest( { std::unique_lock l(mLock); - mInflightMap[frameNumber] = inflightReq; + mInflightMap[bufferId] = inflightReq; } - } int32_t numRequestProcessed = 0; @@ -3519,7 +3517,10 @@ void CameraAidlTest::processColorSpaceRequest( std::vector {halStreams[0].id}); ASSERT_TRUE(returnStatus.isOk()); - for (int32_t frameNumber = 0; frameNumber < requests.size(); frameNumber++) { + // We are keeping frame numbers and buffer ids consistent. Buffer id value of 0 + // is used to indicate a buffer that is not present/available so buffer ids as well + // as frame numbers begin with 1. + for (int32_t frameNumber = 1; frameNumber <= requests.size(); frameNumber++) { const auto& inflightReq = mInflightMap[frameNumber]; std::unique_lock l(mLock); while (!inflightReq->errorCodeValid && From e6396ba7ba6f5cce466ea70dd8414db6084c6590 Mon Sep 17 00:00:00 2001 From: Yuyang Huang Date: Thu, 23 Mar 2023 12:46:09 +0900 Subject: [PATCH 866/998] Add VTS to cover the APF VSR requirement since U Since Android U, VSR 5.3.12 mentioned the Android Packet Filtering must be supported by CHIPSETs and DEVICEs launching on Android 14 or higher. This VTS was added to check if APF is supported properly. Given the limitation of the VTS testing environment, the first version of the test case only checks: if the APF is supported by WiFi chips with version 4 and more than 1024 bytes of usable memory. Bug: 259309511 Test: atest VtsHalWifiStaIfaceTargetTest Change-Id: I3ee2a980a4440db232738a23c1633aaff3562d95 --- .../vts/functional/wifi_sta_iface_aidl_test.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp index 07817ccbe9..adc9b73ed1 100644 --- a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp +++ b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp @@ -92,14 +92,21 @@ TEST_P(WifiStaIfaceAidlTest, GetFeatureSet) { } /* - * GetApfPacketFilterCapabilities + * CheckApfIsSupported: + * Ensures the APF packet filter is fully supported as required in VSR 14: + * https://docs.partner.android.com/gms/policies/vsr/vsr-14 */ -TEST_P(WifiStaIfaceAidlTest, GetApfPacketFilterCapabilities) { - if (!isFeatureSupported(IWifiStaIface::FeatureSetMask::APF)) { - GTEST_SKIP() << "APF packet filter capabilities are not supported."; - } +TEST_P(WifiStaIfaceAidlTest, CheckApfIsSupported) { + // It is not required to check the vendor API level is at least U here + // because the Wi-Fi AIDL interface is launched with Android U(VSR-14). + // TODO: Add wavier list to the chipsets that doesn't support APF. + EXPECT_TRUE(isFeatureSupported(IWifiStaIface::FeatureSetMask::APF)); StaApfPacketFilterCapabilities apf_caps = {}; EXPECT_TRUE(wifi_sta_iface_->getApfPacketFilterCapabilities(&apf_caps).isOk()); + // The APF version must be 4 and the usable memory must be at least + // 1024 bytes. + EXPECT_EQ(apf_caps.version, 4); + EXPECT_GE(apf_caps.maxLength, 1024); } /* From 9bd47ef77cab48628dbde2753d7daea507f1e7b5 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Mon, 27 Mar 2023 09:32:28 -0700 Subject: [PATCH 867/998] uwb[aidl]: Added LAST_STS_INDEX_USED config into CCC open ranging params Add LAST_STS_INDEX_USED to CCC ranging Bug: 268762844 Test: test CCC Change-Id: I56514e7d7d0c927e6bf8e257547f7baeadd3770c --- .../uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl | 1 + .../uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl | 2 ++ 2 files changed, 3 insertions(+) diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl index 8413f06d0f..c3ac4019a2 100644 --- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl @@ -40,6 +40,7 @@ enum UwbVendorSessionAppConfigTlvTypes { CCC_UWB_CONFIG_ID = 164, CCC_PULSESHAPE_COMBO = 165, CCC_URSK_TTL = 166, + CCC_LAST_INDEX_USED = 168, NB_OF_RANGE_MEASUREMENTS = 227, NB_OF_AZIMUTH_MEASUREMENTS = 228, NB_OF_ELEVATION_MEASUREMENTS = 229, diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl index f303ed92d7..65bb1c9bbd 100644 --- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl +++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorSessionAppConfigTlvTypes.aidl @@ -46,6 +46,8 @@ enum UwbVendorSessionAppConfigTlvTypes { CCC_PULSESHAPE_COMBO = 0xA5, /** 2 byte data */ CCC_URSK_TTL = 0xA6, + /** 4 byte data */ + CCC_LAST_INDEX_USED = 0xA8, /** * Range 0xE3 - 0xFF is reserved for proprietary use in the FIRA spec. From c9e4122f5b6bdc6e01d4ecb601b3aa299e7fe316 Mon Sep 17 00:00:00 2001 From: Changyeon Jo Date: Sat, 25 Mar 2023 15:22:32 +0000 Subject: [PATCH 868/998] Implement incomplete or missing IEvsCamera methods This CL completes IEvsCamera interface implementation by adding following methods to a default AIDL EVS HAL implementation. - IEvsCamera::importExternalBuffers() - IEvsCamera::getIntParameterRange() - IEvsCamera::setIntParameter() - IEvsCamera::getIntParameter() Fix: 275101894 Test: 1. Launch CVD in accelerated graphics mode (gfxstream). 2. atest VtsHalEvsTargetTest --iteration 3 Change-Id: I70ed2a97f49d27146ce00cdaab9ca3f41a59fc98 --- .../aidl/impl/default/include/EvsMockCamera.h | 16 ++- .../aidl/impl/default/src/EvsMockCamera.cpp | 123 +++++++++++++++--- 2 files changed, 123 insertions(+), 16 deletions(-) diff --git a/automotive/evs/aidl/impl/default/include/EvsMockCamera.h b/automotive/evs/aidl/impl/default/include/EvsMockCamera.h index 46d47e77a2..7e010a29e0 100644 --- a/automotive/evs/aidl/impl/default/include/EvsMockCamera.h +++ b/automotive/evs/aidl/impl/default/include/EvsMockCamera.h @@ -146,7 +146,21 @@ class EvsMockCamera : public evs::BnEvsCamera { // For the extended info std::unordered_map> mExtInfo; - std::unordered_map mParams; + + // For the camera parameters. + struct CameraParameterDesc { + CameraParameterDesc(int min = 0, int max = 0, int step = 0, int value = 0) { + this->range.min = min; + this->range.max = max; + this->range.step = step; + this->value = value; + } + + ParameterRange range; + int32_t value; + }; + std::unordered_map> mParams; + void initializeParameters(); }; } // namespace aidl::android::hardware::automotive::evs::implementation diff --git a/automotive/evs/aidl/impl/default/src/EvsMockCamera.cpp b/automotive/evs/aidl/impl/default/src/EvsMockCamera.cpp index 4b46a5ae64..797b22154b 100644 --- a/automotive/evs/aidl/impl/default/src/EvsMockCamera.cpp +++ b/automotive/evs/aidl/impl/default/src/EvsMockCamera.cpp @@ -68,6 +68,9 @@ EvsMockCamera::EvsMockCamera([[maybe_unused]] Sigil sigil, const char* id, const size_t len = get_camera_metadata_size(camInfo->characteristics); mDescription.metadata.insert(mDescription.metadata.end(), ptr, ptr + len); } + + // Initialize parameters. + initializeParameters(); } EvsMockCamera::~EvsMockCamera() { @@ -75,6 +78,18 @@ EvsMockCamera::~EvsMockCamera() { shutdown(); } +void EvsMockCamera::initializeParameters() { + mParams.emplace( + CameraParam::BRIGHTNESS, + new CameraParameterDesc(/* min= */ 0, /* max= */ 255, /* step= */ 1, /* value= */ 255)); + mParams.emplace( + CameraParam::CONTRAST, + new CameraParameterDesc(/* min= */ 0, /* max= */ 255, /* step= */ 1, /* value= */ 255)); + mParams.emplace( + CameraParam::SHARPNESS, + new CameraParameterDesc(/* min= */ 0, /* max= */ 255, /* step= */ 1, /* value= */ 255)); +} + // This gets called if another caller "steals" ownership of the camera void EvsMockCamera::shutdown() { LOG(DEBUG) << __FUNCTION__; @@ -291,27 +306,105 @@ ScopedAStatus EvsMockCamera::getParameterList(std::vector* _aidl_re return ScopedAStatus::ok(); } -ScopedAStatus EvsMockCamera::getIntParameterRange([[maybe_unused]] CameraParam id, - [[maybe_unused]] ParameterRange* _aidl_return) { - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); +ScopedAStatus EvsMockCamera::getIntParameterRange(CameraParam id, ParameterRange* _aidl_return) { + auto it = mParams.find(id); + if (it == mParams.end()) { + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); + } + + _aidl_return->min = it->second->range.min; + _aidl_return->max = it->second->range.max; + _aidl_return->step = it->second->range.step; + return ScopedAStatus::ok(); } -ScopedAStatus EvsMockCamera::setIntParameter( - [[maybe_unused]] CameraParam id, [[maybe_unused]] int32_t value, - [[maybe_unused]] std::vector* effectiveValue) { - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); +ScopedAStatus EvsMockCamera::setIntParameter(CameraParam id, int32_t value, + std::vector* effectiveValue) { + auto it = mParams.find(id); + if (it == mParams.end()) { + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); + } + + // Rounding down to the closest value. + int32_t candidate = value / it->second->range.step * it->second->range.step; + if (candidate < it->second->range.min || candidate > it->second->range.max) { + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::INVALID_ARG)); + } + + it->second->value = candidate; + effectiveValue->push_back(candidate); + return ScopedAStatus::ok(); } -ScopedAStatus EvsMockCamera::getIntParameter([[maybe_unused]] CameraParam id, - [[maybe_unused]] std::vector* value) { - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); +ScopedAStatus EvsMockCamera::getIntParameter(CameraParam id, std::vector* value) { + auto it = mParams.find(id); + if (it == mParams.end()) { + return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); + } + + value->push_back(it->second->value); + return ScopedAStatus::ok(); } -ScopedAStatus EvsMockCamera::importExternalBuffers( - [[maybe_unused]] const std::vector& buffers, - [[maybe_unused]] int32_t* _aidl_return) { - LOG(DEBUG) << "This implementation does not support an external buffer import."; - return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::NOT_SUPPORTED)); +ScopedAStatus EvsMockCamera::importExternalBuffers(const std::vector& buffers, + int32_t* _aidl_return) { + size_t numBuffersToAdd = buffers.size(); + if (numBuffersToAdd < 1) { + LOG(DEBUG) << "Ignoring a request to import external buffers with an empty list."; + return ScopedAStatus::ok(); + } + + std::lock_guard lock(mAccessLock); + if (numBuffersToAdd > (kMaxBuffersInFlight - mFramesAllowed)) { + numBuffersToAdd -= (kMaxBuffersInFlight - mFramesAllowed); + LOG(WARNING) << "Exceed the limit on the number of buffers. " << numBuffersToAdd + << " buffers will be imported only."; + } + + ::android::GraphicBufferMapper& mapper = ::android::GraphicBufferMapper::get(); + const size_t before = mFramesAllowed; + for (size_t i = 0; i < numBuffersToAdd; ++i) { + auto& b = buffers[i]; + const AHardwareBuffer_Desc* pDesc = + reinterpret_cast(&b.buffer.description); + + buffer_handle_t handleToImport = ::android::dupFromAidl(b.buffer.handle); + buffer_handle_t handleToStore = nullptr; + if (handleToImport == nullptr) { + LOG(WARNING) << "Failed to duplicate a memory handle. Ignoring a buffer " << b.bufferId; + continue; + } + + ::android::status_t result = + mapper.importBuffer(handleToImport, pDesc->width, pDesc->height, pDesc->layers, + pDesc->format, pDesc->usage, pDesc->stride, &handleToStore); + if (result != ::android::NO_ERROR || handleToStore == nullptr) { + LOG(WARNING) << "Failed to import a buffer " << b.bufferId; + continue; + } + + bool stored = false; + for (auto&& rec : mBuffers) { + if (rec.handle != nullptr) { + continue; + } + + // Use this existing entry. + rec.handle = handleToStore; + rec.inUse = false; + stored = true; + break; + } + + if (!stored) { + // Add a BufferRecord wrapping this handle to our set of available buffers. + mBuffers.push_back(BufferRecord(handleToStore)); + } + ++mFramesAllowed; + } + + *_aidl_return = mFramesAllowed - before; + return ScopedAStatus::ok(); } bool EvsMockCamera::setAvailableFrames_Locked(unsigned bufferCount) { From f9a0be58d956c30dd6e9eefc7e735367da98b0b8 Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Mon, 20 Mar 2023 13:49:25 +0900 Subject: [PATCH 869/998] Set min_sdk_version for the Widevine APEX Bug: 251299786 Test: build WV APEX with V and install it on U device Change-Id: I51e387769631bb6dd821911fdae78f36b04b86c2 --- drm/aidl/Android.bp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drm/aidl/Android.bp b/drm/aidl/Android.bp index 6273a38a26..fb04d842ef 100644 --- a/drm/aidl/Android.bp +++ b/drm/aidl/Android.bp @@ -23,7 +23,7 @@ aidl_interface { sdk_version: "module_current", }, ndk: { - min_sdk_version: "current", + min_sdk_version: "UpsideDownCake", }, }, double_loadable: true, From ffe142751a56854c968cd9e9a0166b25f70e9a75 Mon Sep 17 00:00:00 2001 From: John Reck Date: Tue, 28 Mar 2023 11:39:27 -0400 Subject: [PATCH 870/998] Update DataSpace.aidl RANGE_EXTENDED Fixes: 274780844 Test: doc only change Change-Id: I619894e0bb3f4e6928e5c920af90fb8ce3702397 --- .../hardware/graphics/common/Dataspace.aidl | 50 ++++++++++--------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/graphics/common/aidl/android/hardware/graphics/common/Dataspace.aidl b/graphics/common/aidl/android/hardware/graphics/common/Dataspace.aidl index b44e613c3f..4f2a0872c3 100644 --- a/graphics/common/aidl/android/hardware/graphics/common/Dataspace.aidl +++ b/graphics/common/aidl/android/hardware/graphics/common/Dataspace.aidl @@ -87,7 +87,7 @@ enum Dataspace { * Use the unadjusted KR = 0.2126, KB = 0.0722 luminance interpretation * for RGB conversion. */ - STANDARD_BT709 = 1 << 16, // 1 << STANDARD_SHIFT + STANDARD_BT709 = 1 << 16, // 1 << STANDARD_SHIFT /** * Primaries: x y @@ -377,11 +377,19 @@ enum Dataspace { RANGE_LIMITED = 2 << 27, // 2 << RANGE_SHIFT = 0x10000000 /** - * Extended range is used for scRGB. Intended for use with - * floating point pixel formats. [0.0 - 1.0] is the standard - * sRGB space. Values outside the range 0.0 - 1.0 can encode - * color outside the sRGB gamut. - * Used to blend / merge multiple dataspaces on a single display. + * Extended range can be used in combination with FP16 to communicate scRGB or with + * SurfaceControl's setExtendedRangeBrightness(SurfaceControl, float, float) + * to indicate an HDR range. + * + * When used with floating point pixel formats and #STANDARD_BT709 then [0.0 - 1.0] is the + * standard sRGB space and values outside the range [0.0 - 1.0] can encode + * color outside the sRGB gamut. [-0.5, 7.5] is the standard scRGB range. + * Used to blend/merge multiple dataspaces on a single display. + * + * As of Android U in combination with composer3's mixed SDR/HDR feature then this may + * be combined with SurfaceControl's setExtendedRangeBrightness(SurfaceControl, float, float) + * and other formats such as RGBA_8888 or RGBA_1010102 to communicate a variable HDR + * brightness range, which in turn will influence that layer's dimming ratio when composited */ RANGE_EXTENDED = 3 << 27, // 3 << RANGE_SHIFT = 0x18000000 @@ -397,7 +405,6 @@ enum Dataspace { */ SRGB_LINEAR = 1 << 16 | 1 << 22 | 1 << 27, // STANDARD_BT709 | TRANSFER_LINEAR | RANGE_FULL - /** * scRGB linear encoding: * @@ -412,7 +419,6 @@ enum Dataspace { */ SCRGB_LINEAR = 1 << 16 | 1 << 22 | 3 << 27, // STANDARD_BT709 | TRANSFER_LINEAR | RANGE_EXTENDED - /** * sRGB gamma encoding: * @@ -428,7 +434,6 @@ enum Dataspace { */ SRGB = 1 << 16 | 2 << 22 | 1 << 27, // STANDARD_BT709 | TRANSFER_SRGB | RANGE_FULL - /** * scRGB: * @@ -470,8 +475,8 @@ enum Dataspace { * * Use limited range, SMPTE 170M transfer and BT.601_625 standard. */ - BT601_625 = 2 << 16 | 3 << 22 | 2 << 27, // STANDARD_BT601_625 | TRANSFER_SMPTE_170M | RANGE_LIMITED - + BT601_625 = + 2 << 16 | 3 << 22 | 2 << 27, // STANDARD_BT601_625 | TRANSFER_SMPTE_170M | RANGE_LIMITED /** * ITU-R Recommendation 601 (BT.601) - 525-line @@ -480,7 +485,8 @@ enum Dataspace { * * Use limited range, SMPTE 170M transfer and BT.601_525 standard. */ - BT601_525 = 4 << 16 | 3 << 22 | 2 << 27, // STANDARD_BT601_525 | TRANSFER_SMPTE_170M | RANGE_LIMITED + BT601_525 = + 4 << 16 | 3 << 22 | 2 << 27, // STANDARD_BT601_525 | TRANSFER_SMPTE_170M | RANGE_LIMITED /** * ITU-R Recommendation 709 (BT.709) @@ -491,7 +497,6 @@ enum Dataspace { */ BT709 = 1 << 16 | 3 << 22 | 2 << 27, // STANDARD_BT709 | TRANSFER_SMPTE_170M | RANGE_LIMITED - /** * SMPTE EG 432-1 and SMPTE RP 431-2. * @@ -501,7 +506,6 @@ enum Dataspace { */ DCI_P3_LINEAR = 10 << 16 | 1 << 22 | 1 << 27, // STANDARD_DCI_P3 | TRANSFER_LINEAR | RANGE_FULL - /** * SMPTE EG 432-1 and SMPTE RP 431-2. * @@ -513,15 +517,14 @@ enum Dataspace { */ DCI_P3 = 10 << 16 | 5 << 22 | 1 << 27, // STANDARD_DCI_P3 | TRANSFER_GAMMA2_6 | RANGE_FULL - /** * Display P3 * * Display P3 uses same primaries and white-point as DCI-P3 * linear transfer function makes this the same as DCI_P3_LINEAR. */ - DISPLAY_P3_LINEAR = 10 << 16 | 1 << 22 | 1 << 27, // STANDARD_DCI_P3 | TRANSFER_LINEAR | RANGE_FULL - + DISPLAY_P3_LINEAR = + 10 << 16 | 1 << 22 | 1 << 27, // STANDARD_DCI_P3 | TRANSFER_LINEAR | RANGE_FULL /** * Display P3 @@ -531,7 +534,6 @@ enum Dataspace { */ DISPLAY_P3 = 10 << 16 | 2 << 22 | 1 << 27, // STANDARD_DCI_P3 | TRANSFER_SRGB | RANGE_FULL - /** * Adobe RGB * @@ -541,7 +543,6 @@ enum Dataspace { */ ADOBE_RGB = 11 << 16 | 4 << 22 | 1 << 27, // STANDARD_ADOBE_RGB | TRANSFER_GAMMA2_2 | RANGE_FULL - /** * ITU-R Recommendation 2020 (BT.2020) * @@ -551,7 +552,6 @@ enum Dataspace { */ BT2020_LINEAR = 6 << 16 | 1 << 22 | 1 << 27, // STANDARD_BT2020 | TRANSFER_LINEAR | RANGE_FULL - /** * ITU-R Recommendation 2020 (BT.2020) * @@ -570,7 +570,6 @@ enum Dataspace { */ BT2020_PQ = 6 << 16 | 7 << 22 | 1 << 27, // STANDARD_BT2020 | TRANSFER_ST2084 | RANGE_FULL - /** * Data spaces for non-color formats */ @@ -611,7 +610,8 @@ enum Dataspace { * * Use limited range, SMPTE 170M transfer and BT2020 standard */ - BT2020_ITU = 6 << 16 | 3 << 22 | 2 << 27, // STANDARD_BT2020 | TRANSFER_SMPTE_170M | RANGE_LIMITED + BT2020_ITU = + 6 << 16 | 3 << 22 | 2 << 27, // STANDARD_BT2020 | TRANSFER_SMPTE_170M | RANGE_LIMITED /** * ITU-R Recommendation 2100 (BT.2100) @@ -621,7 +621,8 @@ enum Dataspace { * Use limited/full range, PQ/HLG transfer, and BT2020 standard * limited range is the preferred / normative definition for BT.2100 */ - BT2020_ITU_PQ = 6 << 16 | 7 << 22 | 2 << 27, // STANDARD_BT2020 | TRANSFER_ST2084 | RANGE_LIMITED + BT2020_ITU_PQ = + 6 << 16 | 7 << 22 | 2 << 27, // STANDARD_BT2020 | TRANSFER_ST2084 | RANGE_LIMITED BT2020_ITU_HLG = 6 << 16 | 8 << 22 | 2 << 27, // STANDARD_BT2020 | TRANSFER_HLG | RANGE_LIMITED BT2020_HLG = 6 << 16 | 8 << 22 | 1 << 27, // STANDARD_BT2020 | TRANSFER_HLG | RANGE_FULL @@ -687,5 +688,6 @@ enum Dataspace { * * Use full range, SMPTE 170M transfer and BT.709 standard. */ - BT709_FULL_RANGE = 1 << 16 | 3 << 22 | 1 << 27, // STANDARD_BT709 | TRANSFER_SMPTE_170M | RANGE_FULL + BT709_FULL_RANGE = + 1 << 16 | 3 << 22 | 1 << 27, // STANDARD_BT709 | TRANSFER_SMPTE_170M | RANGE_FULL } From e708da89b50bc9bcd6cac864bf9588b3d1a52f25 Mon Sep 17 00:00:00 2001 From: Hao Chen Date: Tue, 28 Mar 2023 16:20:57 -0700 Subject: [PATCH 871/998] Add VTS for EVS Display They are mostly copied from the HIDL 1.0 display test cases, with some minor changes. Test: `atest VtsHalEvsTargetTest` Bug: 275626422 Change-Id: Ica5379e7f021083b65ad8abf320f7751c1432c9e --- .../evs/aidl/vts/VtsHalEvsTargetTest.cpp | 154 ++++++++++++++++++ 1 file changed, 154 insertions(+) diff --git a/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp b/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp index 2706c499ba..60adf93cdf 100644 --- a/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp +++ b/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp @@ -51,6 +51,7 @@ #include #include +#include #include #include #include @@ -2197,6 +2198,159 @@ TEST_P(EvsAidlTest, UltrasonicsSetFramesInFlight) { } } +/* + * DisplayOpen: + * Test both clean shut down and "aggressive open" device stealing behavior. + */ +TEST_P(EvsAidlTest, DisplayOpen) { + LOG(INFO) << "Starting DisplayOpen test"; + + // Request available display IDs. + std::vector displayIds; + ASSERT_TRUE(mEnumerator->getDisplayIdList(&displayIds).isOk()); + EXPECT_GT(displayIds.size(), 0); + + for (const auto displayId : displayIds) { + std::shared_ptr pDisplay; + + // Request exclusive access to each EVS display, then let it go. + ASSERT_TRUE(mEnumerator->openDisplay(displayId, &pDisplay).isOk()); + ASSERT_NE(pDisplay, nullptr); + + { + // Ask the display what its name is. + DisplayDesc desc; + ASSERT_TRUE(pDisplay->getDisplayInfo(&desc).isOk()); + LOG(DEBUG) << "Found display " << desc.id; + } + + ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk()); + + // Ensure we can reopen the display after it has been closed. + ASSERT_TRUE(mEnumerator->openDisplay(displayId, &pDisplay).isOk()); + ASSERT_NE(pDisplay, nullptr); + + // Open the display while its already open -- ownership should be transferred. + std::shared_ptr pDisplay2; + ASSERT_TRUE(mEnumerator->openDisplay(displayId, &pDisplay2).isOk()); + ASSERT_NE(pDisplay2, nullptr); + + { + // Ensure the old display properly reports its assassination. + DisplayState badState; + EXPECT_TRUE(pDisplay->getDisplayState(&badState).isOk()); + EXPECT_EQ(badState, DisplayState::DEAD); + } + + // Close only the newest display instance -- the other should already be a zombie. + ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay2).isOk()); + + // Finally, validate that we can open the display after the provoked failure above. + ASSERT_TRUE(mEnumerator->openDisplay(displayId, &pDisplay).isOk()); + ASSERT_NE(pDisplay, nullptr); + ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk()); + } +} + +/* + * DisplayStates: + * Validate that display states transition as expected and can be queried from either the display + * object itself or the owning enumerator. + */ +TEST_P(EvsAidlTest, DisplayStates) { + using std::literals::chrono_literals::operator""ms; + + LOG(INFO) << "Starting DisplayStates test"; + + // Request available display IDs. + std::vector displayIds; + ASSERT_TRUE(mEnumerator->getDisplayIdList(&displayIds).isOk()); + EXPECT_GT(displayIds.size(), 0); + + for (const auto displayId : displayIds) { + // Ensure the display starts in the expected state. + { + DisplayState state; + EXPECT_FALSE(mEnumerator->getDisplayState(&state).isOk()); + } + + // Scope to limit the lifetime of the pDisplay pointer, and thus the IEvsDisplay object. + { + // Request exclusive access to the EVS display. + std::shared_ptr pDisplay; + ASSERT_TRUE(mEnumerator->openDisplay(displayId, &pDisplay).isOk()); + ASSERT_NE(pDisplay, nullptr); + { + DisplayState state; + EXPECT_TRUE(mEnumerator->getDisplayState(&state).isOk()); + EXPECT_EQ(state, DisplayState::NOT_VISIBLE); + } + + // Activate the display. + EXPECT_TRUE(pDisplay->setDisplayState(DisplayState::VISIBLE_ON_NEXT_FRAME).isOk()); + { + DisplayState state; + EXPECT_TRUE(mEnumerator->getDisplayState(&state).isOk()); + EXPECT_EQ(state, DisplayState::VISIBLE_ON_NEXT_FRAME); + } + { + DisplayState state; + EXPECT_TRUE(pDisplay->getDisplayState(&state).isOk()); + EXPECT_EQ(state, DisplayState::VISIBLE_ON_NEXT_FRAME); + } + + // Get the output buffer we'd use to display the imagery. + BufferDesc tgtBuffer; + ASSERT_TRUE(pDisplay->getTargetBuffer(&tgtBuffer).isOk()); + + // Send the target buffer back for display (we didn't actually fill anything). + EXPECT_TRUE(pDisplay->returnTargetBufferForDisplay(tgtBuffer).isOk()); + + // Sleep for a tenth of a second to ensure the driver has time to get the image + // displayed. + std::this_thread::sleep_for(100ms); + { + DisplayState state; + EXPECT_TRUE(mEnumerator->getDisplayState(&state).isOk()); + EXPECT_EQ(state, DisplayState::VISIBLE); + } + { + DisplayState state; + EXPECT_TRUE(pDisplay->getDisplayState(&state).isOk()); + EXPECT_EQ(state, DisplayState::VISIBLE); + } + + // Turn off the display. + EXPECT_TRUE(pDisplay->setDisplayState(DisplayState::NOT_VISIBLE).isOk()); + std::this_thread::sleep_for(100ms); + { + DisplayState state; + EXPECT_TRUE(mEnumerator->getDisplayState(&state).isOk()); + EXPECT_EQ(state, DisplayState::NOT_VISIBLE); + } + { + DisplayState state; + EXPECT_TRUE(pDisplay->getDisplayState(&state).isOk()); + EXPECT_EQ(state, DisplayState::NOT_VISIBLE); + } + + // Close the display. + mEnumerator->closeDisplay(pDisplay); + } + + // Now that the display pointer has gone out of scope, causing the IEvsDisplay interface + // object to be destroyed, we should be back to the "not open" state. + // NOTE: If we want this to pass without the sleep above, we'd have to add the + // (now recommended) closeDisplay() call instead of relying on the smarter pointer + // going out of scope. I've not done that because I want to verify that the deletion + // of the object does actually clean up (eventually). + { + DisplayState state; + EXPECT_FALSE(mEnumerator->getDisplayState(&state).isOk()); + } + } +} + GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EvsAidlTest); INSTANTIATE_TEST_SUITE_P( PerInstance, EvsAidlTest, From 49e36808da9d92c8104c37d25cad81c784beae6b Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Sat, 25 Mar 2023 21:31:47 +0000 Subject: [PATCH 872/998] Fix inconsistencies in VehicleArea HAL documentation Remove references of area types and use more consistent language. Use same documentation across AIDL and HIDL definitions. Bug: 259987652 Test: presubmit Change-Id: I4da6ff23fd221698c9fbe9c9f817f51959a49a79 --- automotive/vehicle/2.0/types.hal | 49 ++++++------------- .../automotive/vehicle/VehicleAreaConfig.aidl | 2 +- .../automotive/vehicle/VehiclePropConfig.aidl | 20 +++++++- .../automotive/vehicle/VehicleArea.aidl | 19 +++++++ current.txt | 1 + 5 files changed, 54 insertions(+), 37 deletions(-) diff --git a/automotive/vehicle/2.0/types.hal b/automotive/vehicle/2.0/types.hal index d75b046774..5b0a5055c1 100644 --- a/automotive/vehicle/2.0/types.hal +++ b/automotive/vehicle/2.0/types.hal @@ -57,46 +57,25 @@ enum VehiclePropertyType : int32_t { }; /** - * Vehicle Areas + * List of different supported area types for vehicle properties. * Used to construct property IDs in the VehicleProperty enum. * - * Some properties may be associated with particular vehicle areas. For - * example, VehicleProperty:DOOR_LOCK property must be associated with - * particular door, thus this property must be marked with - * VehicleArea:DOOR flag. + * Some properties may be associated with particular areas in the vehicle. For example, + * VehicleProperty#DOOR_LOCK property must be associated with a particular door, thus this property + * must be of the VehicleArea#DOOR area type. * - * Other properties may not be associated with particular vehicle area. - * These kinds of properties must have VehicleArea:GLOBAL flag. + * Other properties may not be associated with a particular area in the vehicle. These kinds of + * properties must be of the VehicleArea#GLOBAL area type. * - * [Definition] Area: An area represents a unique element of an AreaType. - * For instance, if AreaType is WINDOW, then an area may be FRONT_WINDSHIELD. - * - * [Definition] AreaID: An AreaID is a combination of one or more areas, - * and is represented using a bitmask of Area enums. Different AreaTypes may - * not be mixed in a single AreaID. For instance, a window area cannot be - * combined with a seat area in an AreaID. - * - * Rules for mapping a zoned property to AreaIDs: - * - A property must be mapped to an array of AreaIDs that are impacted when - * the property value changes. - * - Each element in the array must represent an AreaID, in which the - * property value can only be changed together in all the areas within - * the AreaID and never independently. That is, when the property value - * changes in one of the areas in an AreaID in the array, then it must - * automatically change in all other areas in the AreaID. - * - The property value must be independently controllable in any two - * different AreaIDs in the array. - * - An area must only appear once in the array of AreaIDs. That is, an - * area must only be part of a single AreaID in the array. - * - * [Definition] Global Property: A property that applies to the entire car - * and is not associated with a specific area. For example, FUEL_LEVEL, - * HVAC_STEERING_WHEEL_HEAT. - * - * Rules for mapping a global property to AreaIDs: - * - A global property must not be mapped to AreaIDs. -*/ + * Note: This is not the same as areaId used in VehicleAreaConfig. E.g. for a global property, the + * property ID is of the VehicleArea#GLOBAL area type, however, the area ID must be 0. + */ +// A better name would be VehicleAreaType enum VehicleArea : int32_t { + /** + * A global property is a property that applies to the entire vehicle and is not associated with + * a specific area. For example, FUEL_LEVEL, HVAC_STEERING_WHEEL_HEAT are global properties. + */ GLOBAL = 0x01000000, /** WINDOW maps to enum VehicleAreaWindow */ WINDOW = 0x03000000, diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl index abd9540876..20c046d574 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl @@ -20,7 +20,7 @@ package android.hardware.automotive.vehicle; @JavaDerive(equals=true, toString=true) parcelable VehicleAreaConfig { /** - * Area id is ignored for VehiclePropertyGroup:GLOBAL properties. + * Area id is always 0 for VehicleArea#GLOBAL properties. */ int areaId; diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl index 1b48f0b1b6..61b936932d 100644 --- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl +++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl @@ -37,7 +37,25 @@ parcelable VehiclePropConfig { VehiclePropertyChangeMode changeMode = VehiclePropertyChangeMode.STATIC; /** - * Contains per-area configuration. + * Contains per-areaId configuration. + * + * [Definition] area: An area represents a unique element of a VehicleArea. For instance, if the + * VehicleArea is WINDOW, then an example area is FRONT_WINDSHIELD. + * + * [Definition] area ID: An area ID is a combination of one or more areas, and is created by + * bitwise "OR"ing the areas together. Areas from different VehicleArea values may not be + * mixed in a single area ID. For example, a VehicleAreaWindow area cannot be combined with a + * VehicleAreaSeat area in an area ID. + * + * For VehicleArea#GLOBAL properties, they must map only to a single area ID of 0. + * + * Rules for mapping a non VehicleArea#GLOBAL property to area IDs: + * - A property must be mapped to a set of area IDs that are impacted when the property value + * changes. + * - An area cannot be part of multiple area IDs, it must only be part of a single area ID. + * - When the property value changes in one of the areas in an area ID, then it must + * automatically change in all other areas in the area ID. + * - The property value must be independently controllable in any two different area IDs. */ VehicleAreaConfig[] areaConfigs; diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleArea.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleArea.aidl index dab03496cb..6f7f78386a 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleArea.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleArea.aidl @@ -16,9 +16,28 @@ package android.hardware.automotive.vehicle; +/** + * List of different supported area types for vehicle properties. + * Used to construct property IDs in the VehicleProperty enum. + * + * Some properties may be associated with particular areas in the vehicle. For example, + * VehicleProperty#DOOR_LOCK property must be associated with a particular door, thus this property + * must be of the VehicleArea#DOOR area type. + * + * Other properties may not be associated with a particular area in the vehicle. These kinds of + * properties must be of the VehicleArea#GLOBAL area type. + * + * Note: This is not the same as areaId used in VehicleAreaConfig. E.g. for a global property, the + * property ID is of the VehicleArea#GLOBAL area type, however, the area ID must be 0. + */ @VintfStability @Backing(type="int") +// A better name would be VehicleAreaType enum VehicleArea { + /** + * A global property is a property that applies to the entire vehicle and is not associated with + * a specific area. For example, FUEL_LEVEL, HVAC_STEERING_WHEEL_HEAT are global properties. + */ GLOBAL = 0x01000000, /** WINDOW maps to enum VehicleAreaWindow */ WINDOW = 0x03000000, diff --git a/current.txt b/current.txt index a6c4d807cf..754093f2b1 100644 --- a/current.txt +++ b/current.txt @@ -937,5 +937,6 @@ a2fbd9747fbb9ceb8c1090b5a24138312246502d5af0654a8c2b603a9bf521fc android.hardwar 889b59e3e7a59afa67bf19882a44f51a2f9e43b6556ec52baa9ec3efd1ef7fbe android.hardware.camera.device@3.2::types db37a1c757e2e69b1ec9c75a981a6987bd87a131d92ab6acc00e04d19f374281 android.hardware.automotive.vehicle@2.0::types 997017f581406fca1675d2f612f7ccd73f0d04eadd54bf6212e6cf5971d0872d android.hardware.automotive.vehicle@2.0::types +06983ffe6d75e90a22503a6d9fd14417f983a36bb060a80ad5915240d69b8a40 android.hardware.automotive.vehicle@2.0::types # There will be no more HIDL HALs. Use AIDL instead. From ac8e69620739891ddf53069c04d186cff03a32ea Mon Sep 17 00:00:00 2001 From: Hao Chen Date: Wed, 29 Mar 2023 11:20:56 -0700 Subject: [PATCH 873/998] Uprev the EVS AIDL NDK Version Bug: 262779341 Test: build Change-Id: I39d2e6b969db11b03d4e1fe929b19d65f75e72ff --- automotive/evs/aidl/impl/Android.bp | 2 +- automotive/evs/aidl/impl/default/Android.bp | 4 ++-- .../aidl/impl/default/include/EvsEnumerator.h | 3 +++ .../aidl/impl/default/src/EvsEnumerator.cpp | 20 +++++++++++++------ automotive/evs/aidl/vts/Android.bp | 9 ++++----- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/automotive/evs/aidl/impl/Android.bp b/automotive/evs/aidl/impl/Android.bp index 0b51a0c1ff..fa44ebb4d9 100644 --- a/automotive/evs/aidl/impl/Android.bp +++ b/automotive/evs/aidl/impl/Android.bp @@ -22,7 +22,7 @@ cc_defaults { name: "EvsHalDefaults", defaults: ["android.hardware.graphics.common-ndk_static"], static_libs: [ - "android.hardware.automotive.evs-V1-ndk", + "android.hardware.automotive.evs-V2-ndk", "android.hardware.common-V2-ndk", ], shared_libs: [ diff --git a/automotive/evs/aidl/impl/default/Android.bp b/automotive/evs/aidl/impl/default/Android.bp index bf6c0be236..70c523b5fa 100644 --- a/automotive/evs/aidl/impl/default/Android.bp +++ b/automotive/evs/aidl/impl/default/Android.bp @@ -38,7 +38,7 @@ cc_binary { ], srcs: [ ":libgui_frame_event_aidl", - "src/*.cpp" + "src/*.cpp", ], shared_libs: [ "android.hardware.graphics.bufferqueue@1.0", @@ -61,7 +61,7 @@ cc_binary { ], static_libs: [ "android.frameworks.automotive.display-V1-ndk", - "android.hardware.automotive.evs-V1-ndk", + "android.hardware.automotive.evs-V2-ndk", "android.hardware.common-V2-ndk", "libaidlcommonsupport", "libcutils", diff --git a/automotive/evs/aidl/impl/default/include/EvsEnumerator.h b/automotive/evs/aidl/impl/default/include/EvsEnumerator.h index b11dd3ee80..259c266721 100644 --- a/automotive/evs/aidl/impl/default/include/EvsEnumerator.h +++ b/automotive/evs/aidl/impl/default/include/EvsEnumerator.h @@ -52,6 +52,7 @@ class EvsEnumerator final : public ::aidl::android::hardware::automotive::evs::B ndk::ScopedAStatus closeDisplay(const std::shared_ptr& obj) override; ndk::ScopedAStatus getDisplayIdList(std::vector* list) override; ndk::ScopedAStatus getDisplayState(evs::DisplayState* state) override; + ndk::ScopedAStatus getDisplayStateById(int32_t displayId, evs::DisplayState* state) override; ndk::ScopedAStatus registerStatusCallback( const std::shared_ptr& callback) override; ndk::ScopedAStatus openUltrasonicsArray( @@ -101,6 +102,8 @@ class EvsEnumerator final : public ::aidl::android::hardware::automotive::evs::B bool checkPermission(); void closeCamera_impl(const std::shared_ptr& pCamera, const std::string& cameraId); + ndk::ScopedAStatus getDisplayStateImpl(std::optional displayId, + evs::DisplayState* state); static bool qualifyCaptureDevice(const char* deviceName); static CameraRecord* findCameraById(const std::string& cameraId); diff --git a/automotive/evs/aidl/impl/default/src/EvsEnumerator.cpp b/automotive/evs/aidl/impl/default/src/EvsEnumerator.cpp index 6e2405deb5..5178958675 100644 --- a/automotive/evs/aidl/impl/default/src/EvsEnumerator.cpp +++ b/automotive/evs/aidl/impl/default/src/EvsEnumerator.cpp @@ -357,24 +357,32 @@ ScopedAStatus EvsEnumerator::closeDisplay(const std::shared_ptr& ob ScopedAStatus EvsEnumerator::getDisplayState(DisplayState* state) { LOG(DEBUG) << __FUNCTION__; + return getDisplayStateImpl(std::nullopt, state); +} + +ScopedAStatus EvsEnumerator::getDisplayStateById(int32_t displayId, DisplayState* state) { + LOG(DEBUG) << __FUNCTION__; + return getDisplayStateImpl(displayId, state); +} + +ScopedAStatus EvsEnumerator::getDisplayStateImpl(std::optional displayId, + DisplayState* state) { if (!checkPermission()) { *state = DisplayState::DEAD; return ScopedAStatus::fromServiceSpecificError( static_cast(EvsResult::PERMISSION_DENIED)); } - // TODO(b/262779341): For now we can just return the state of the 1st display. Need to update - // the API later. - const auto& all_displays = mutableActiveDisplays().getAllDisplays(); - // Do we still have a display object we think should be active? - if (all_displays.empty()) { + const auto display_search = displayId ? all_displays.find(*displayId) : all_displays.begin(); + + if (display_search == all_displays.end()) { *state = DisplayState::NOT_OPEN; return ScopedAStatus::fromServiceSpecificError(static_cast(EvsResult::OWNERSHIP_LOST)); } - std::shared_ptr pActiveDisplay = all_displays.begin()->second.displayWeak.lock(); + std::shared_ptr pActiveDisplay = display_search->second.displayWeak.lock(); if (pActiveDisplay) { return pActiveDisplay->getDisplayState(state); } else { diff --git a/automotive/evs/aidl/vts/Android.bp b/automotive/evs/aidl/vts/Android.bp index 5aa9501883..e50c913584 100644 --- a/automotive/evs/aidl/vts/Android.bp +++ b/automotive/evs/aidl/vts/Android.bp @@ -14,18 +14,17 @@ // limitations under the License. // -package{ +package { // See: http://go/android-license-faq // A large-scale-change added 'default_applicable_licenses' to import // all of the 'license_kinds' from "hardware_interfaces_license" // to get the below license kinds: // SPDX-license-identifier-Apache-2.0 - default_applicable_licenses : ["hardware_interfaces_license"], + default_applicable_licenses: ["hardware_interfaces_license"], } cc_test { -name: - "VtsHalEvsTargetTest", + name: "VtsHalEvsTargetTest", srcs: [ "*.cpp", ], @@ -42,7 +41,7 @@ name: ], static_libs: [ "android.hardware.automotive.evs@common-default-lib", - "android.hardware.automotive.evs-V1-ndk", + "android.hardware.automotive.evs-V2-ndk", "android.hardware.common-V2-ndk", "libaidlcommonsupport", ], From be8193928534132838a0360a42259cafc8eb3aa5 Mon Sep 17 00:00:00 2001 From: Hao Chen Date: Wed, 29 Mar 2023 16:18:47 -0700 Subject: [PATCH 874/998] Add VTS testcases for getDisplayStateById Test: build Bug: 275626422 Change-Id: I27dfced8f0040e6604baeed37df7e12f5ec5d73d --- .../evs/aidl/vts/VtsHalEvsTargetTest.cpp | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp b/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp index 60adf93cdf..a6d99adae5 100644 --- a/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp +++ b/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp @@ -2273,6 +2273,10 @@ TEST_P(EvsAidlTest, DisplayStates) { DisplayState state; EXPECT_FALSE(mEnumerator->getDisplayState(&state).isOk()); } + for (const auto displayIdToQuery : displayIds) { + DisplayState state; + EXPECT_FALSE(mEnumerator->getDisplayStateById(displayIdToQuery, &state).isOk()); + } // Scope to limit the lifetime of the pDisplay pointer, and thus the IEvsDisplay object. { @@ -2285,6 +2289,15 @@ TEST_P(EvsAidlTest, DisplayStates) { EXPECT_TRUE(mEnumerator->getDisplayState(&state).isOk()); EXPECT_EQ(state, DisplayState::NOT_VISIBLE); } + for (const auto displayIdToQuery : displayIds) { + DisplayState state; + if (displayIdToQuery == displayId) { + EXPECT_TRUE(mEnumerator->getDisplayStateById(displayIdToQuery, &state).isOk()); + EXPECT_EQ(state, DisplayState::NOT_VISIBLE); + } else { + EXPECT_FALSE(mEnumerator->getDisplayStateById(displayIdToQuery, &state).isOk()); + } + } // Activate the display. EXPECT_TRUE(pDisplay->setDisplayState(DisplayState::VISIBLE_ON_NEXT_FRAME).isOk()); @@ -2298,6 +2311,15 @@ TEST_P(EvsAidlTest, DisplayStates) { EXPECT_TRUE(pDisplay->getDisplayState(&state).isOk()); EXPECT_EQ(state, DisplayState::VISIBLE_ON_NEXT_FRAME); } + for (const auto displayIdToQuery : displayIds) { + DisplayState state; + if (displayIdToQuery == displayId) { + EXPECT_TRUE(mEnumerator->getDisplayStateById(displayIdToQuery, &state).isOk()); + EXPECT_EQ(state, DisplayState::VISIBLE_ON_NEXT_FRAME); + } else { + EXPECT_FALSE(mEnumerator->getDisplayStateById(displayIdToQuery, &state).isOk()); + } + } // Get the output buffer we'd use to display the imagery. BufferDesc tgtBuffer; @@ -2319,6 +2341,15 @@ TEST_P(EvsAidlTest, DisplayStates) { EXPECT_TRUE(pDisplay->getDisplayState(&state).isOk()); EXPECT_EQ(state, DisplayState::VISIBLE); } + for (const auto displayIdToQuery : displayIds) { + DisplayState state; + if (displayIdToQuery == displayId) { + EXPECT_TRUE(mEnumerator->getDisplayStateById(displayIdToQuery, &state).isOk()); + EXPECT_EQ(state, DisplayState::VISIBLE); + } else { + EXPECT_FALSE(mEnumerator->getDisplayStateById(displayIdToQuery, &state).isOk()); + } + } // Turn off the display. EXPECT_TRUE(pDisplay->setDisplayState(DisplayState::NOT_VISIBLE).isOk()); @@ -2333,6 +2364,15 @@ TEST_P(EvsAidlTest, DisplayStates) { EXPECT_TRUE(pDisplay->getDisplayState(&state).isOk()); EXPECT_EQ(state, DisplayState::NOT_VISIBLE); } + for (const auto displayIdToQuery : displayIds) { + DisplayState state; + if (displayIdToQuery == displayId) { + EXPECT_TRUE(mEnumerator->getDisplayStateById(displayIdToQuery, &state).isOk()); + EXPECT_EQ(state, DisplayState::NOT_VISIBLE); + } else { + EXPECT_FALSE(mEnumerator->getDisplayStateById(displayIdToQuery, &state).isOk()); + } + } // Close the display. mEnumerator->closeDisplay(pDisplay); @@ -2348,6 +2388,10 @@ TEST_P(EvsAidlTest, DisplayStates) { DisplayState state; EXPECT_FALSE(mEnumerator->getDisplayState(&state).isOk()); } + for (const auto displayIdToQuery : displayIds) { + DisplayState state; + EXPECT_FALSE(mEnumerator->getDisplayStateById(displayIdToQuery, &state).isOk()); + } } } From 04b2cdba739440dbd7270864c49bae6b7f5136a1 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Fri, 24 Mar 2023 18:27:58 -0700 Subject: [PATCH 875/998] audio: Add some utility methods, improve logging Add 'isDefaultAudioFormat' to Utils.h. Print the module type in 'setModuleDebug'. Align 'suggestDeviceAddressTag' with framework code. Bug: 273252382 Test: m Change-Id: I0248d2e866522a63a745d4af6132b7d2b6a01564 --- audio/aidl/common/include/Utils.h | 6 +++++ audio/aidl/default/Module.cpp | 24 +++++++++++++++---- .../vts/VtsHalAudioCoreModuleTargetTest.cpp | 4 +++- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/audio/aidl/common/include/Utils.h b/audio/aidl/common/include/Utils.h index 2cf862c81d..305c92471e 100644 --- a/audio/aidl/common/include/Utils.h +++ b/audio/aidl/common/include/Utils.h @@ -99,6 +99,12 @@ constexpr size_t getFrameSizeInBytes( return 0; } +constexpr bool isDefaultAudioFormat( + const ::aidl::android::media::audio::common::AudioFormatDescription& desc) { + return desc.type == ::aidl::android::media::audio::common::AudioFormatType::DEFAULT && + desc.pcm == ::aidl::android::media::audio::common::PcmType::DEFAULT; +} + constexpr bool isTelephonyDeviceType( ::aidl::android::media::audio::common::AudioDeviceType device) { return device == ::aidl::android::media::audio::common::AudioDeviceType::IN_TELEPHONY_RX || diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp index 984b9a1014..71dc4595e3 100644 --- a/audio/aidl/default/Module.cpp +++ b/audio/aidl/default/Module.cpp @@ -143,6 +143,21 @@ StreamOut::CreateInstance Module::getStreamOutCreator(Type type) { } } +std::ostream& operator<<(std::ostream& os, Module::Type t) { + switch (t) { + case Module::Type::DEFAULT: + os << "default"; + break; + case Module::Type::R_SUBMIX: + os << "r_submix"; + break; + case Module::Type::USB: + os << "usb"; + break; + } + return os; +} + void Module::cleanUpPatch(int32_t patchId) { erase_all_values(mPatches, std::set{patchId}); } @@ -352,16 +367,17 @@ void Module::updateStreamsConnectedState(const AudioPatch& oldPatch, const Audio ndk::ScopedAStatus Module::setModuleDebug( const ::aidl::android::hardware::audio::core::ModuleDebug& in_debug) { - LOG(DEBUG) << __func__ << ": old flags:" << mDebug.toString() + LOG(DEBUG) << __func__ << ": " << mType << ": old flags:" << mDebug.toString() << ", new flags: " << in_debug.toString(); if (mDebug.simulateDeviceConnections != in_debug.simulateDeviceConnections && !mConnectedDevicePorts.empty()) { - LOG(ERROR) << __func__ << ": attempting to change device connections simulation " - << "while having external devices connected"; + LOG(ERROR) << __func__ << ": " << mType + << ": attempting to change device connections simulation while having external " + << "devices connected"; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); } if (in_debug.streamTransientStateDelayMs < 0) { - LOG(ERROR) << __func__ << ": streamTransientStateDelayMs is negative: " + LOG(ERROR) << __func__ << ": " << mType << ": streamTransientStateDelayMs is negative: " << in_debug.streamTransientStateDelayMs; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp index b7203053fa..62b4270a11 100644 --- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp @@ -129,7 +129,9 @@ AudioDeviceAddress::Tag suggestDeviceAddressTag(const AudioDeviceDescription& de using Tag = AudioDeviceAddress::Tag; if (std::string_view connection = description.connection; connection == AudioDeviceDescription::CONNECTION_BT_A2DP || - connection == AudioDeviceDescription::CONNECTION_BT_LE || + // Note: BT LE Broadcast uses a "group id". + (description.type != AudioDeviceType::OUT_BROADCAST && + connection == AudioDeviceDescription::CONNECTION_BT_LE) || connection == AudioDeviceDescription::CONNECTION_BT_SCO || connection == AudioDeviceDescription::CONNECTION_WIRELESS) { return Tag::mac; From fe09942d2aaf63070e82404cfe7c51fe2729e4d0 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Fri, 24 Mar 2023 18:29:14 -0700 Subject: [PATCH 876/998] audio: Clarify profiles management for external devices Clarify what should happen to mix port profiles after connection of an external device. Add a test to verify this behavior. Also, add an XML file for the test runner for VtsHalAudioCoreTargetTest. Bug: 273252382 Test: atest VtsHalAudioCoreTargetTest Change-Id: I3381dd29c5922bf31fa3a8ae6fa273597e8333a1 --- .../android/hardware/audio/core/IModule.aidl | 13 ++++ audio/aidl/default/Module.cpp | 62 ++++++++++++++----- .../default/include/core-impl/Configuration.h | 3 +- audio/aidl/default/include/core-impl/Module.h | 6 +- .../vts/VtsHalAudioCoreModuleTargetTest.cpp | 36 +++++++++++ audio/aidl/vts/VtsHalAudioCoreTargetTest.xml | 33 ++++++++++ 6 files changed, 134 insertions(+), 19 deletions(-) create mode 100644 audio/aidl/vts/VtsHalAudioCoreTargetTest.xml diff --git a/audio/aidl/android/hardware/audio/core/IModule.aidl b/audio/aidl/android/hardware/audio/core/IModule.aidl index 78305018a3..7622d9a16c 100644 --- a/audio/aidl/android/hardware/audio/core/IModule.aidl +++ b/audio/aidl/android/hardware/audio/core/IModule.aidl @@ -192,6 +192,19 @@ interface IModule { * device address is specified for a point-to-multipoint external device * connection. * + * Since not all modules have a DSP that could perform sample rate and + * format conversions, behavior related to mix port configurations may vary. + * For modules with a DSP, mix ports can be pre-configured and have a fixed + * set of audio profiles supported by the DSP. For modules without a DSP, + * audio profiles of mix ports may change after connecting an external + * device. The typical case is that the mix port has an empty set of + * profiles when no external devices are connected, and after external + * device connection it receives the same set of profiles as the device + * ports that they can be routed to. The client will re-query current port + * configurations using 'getAudioPorts'. All mix ports that can be routed to + * the connected device port must have a non-empty set of audio profiles + * after successful connection of an external device. + * * Handling of a disconnect is done in a reverse order: * 1. Reset port configuration using the 'resetAudioPortConfig' method. * 2. Release the connected device port by calling the 'disconnectExternalDevice' diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp index 71dc4595e3..6b417a4331 100644 --- a/audio/aidl/default/Module.cpp +++ b/audio/aidl/default/Module.cpp @@ -456,38 +456,45 @@ ndk::ScopedAStatus Module::connectExternalDevice(const AudioPort& in_templateIdA LOG(DEBUG) << __func__ << ": device port " << connectedPort.id << " device set to " << connectedDevicePort.device.toString(); // Check if there is already a connected port with for the same external device. - for (auto connectedPortId : mConnectedDevicePorts) { - auto connectedPortIt = findById(ports, connectedPortId); + for (auto connectedPortPair : mConnectedDevicePorts) { + auto connectedPortIt = findById(ports, connectedPortPair.first); if (connectedPortIt->ext.get().device == connectedDevicePort.device) { LOG(ERROR) << __func__ << ": device " << connectedDevicePort.device.toString() - << " is already connected at the device port id " << connectedPortId; + << " is already connected at the device port id " + << connectedPortPair.first; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); } } } if (!mDebug.simulateDeviceConnections) { - // In a real HAL here we would attempt querying the profiles from the device. - LOG(ERROR) << __func__ << ": failed to query supported device profiles"; - // TODO: Check the return value when it is ready for actual devices. - populateConnectedDevicePort(&connectedPort); + if (ndk::ScopedAStatus status = populateConnectedDevicePort(&connectedPort); + !status.isOk()) { + return status; + } + } else { + auto& connectedProfiles = getConfig().connectedProfiles; + if (auto connectedProfilesIt = connectedProfiles.find(templateId); + connectedProfilesIt != connectedProfiles.end()) { + connectedPort.profiles = connectedProfilesIt->second; + } + } + if (connectedPort.profiles.empty()) { + LOG(ERROR) << "Profiles of a connected port still empty after connecting external device " + << connectedPort.toString(); return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE); } connectedPort.id = ++getConfig().nextPortId; - mConnectedDevicePorts.insert(connectedPort.id); + auto [connectedPortsIt, _] = + mConnectedDevicePorts.insert(std::pair(connectedPort.id, std::vector())); LOG(DEBUG) << __func__ << ": template port " << templateId << " external device connected, " << "connected port ID " << connectedPort.id; - auto& connectedProfiles = getConfig().connectedProfiles; - if (auto connectedProfilesIt = connectedProfiles.find(templateId); - connectedProfilesIt != connectedProfiles.end()) { - connectedPort.profiles = connectedProfilesIt->second; - } ports.push_back(connectedPort); onExternalDeviceConnectionChanged(connectedPort, true /*connected*/); - *_aidl_return = std::move(connectedPort); + std::vector routablePortIds; std::vector newRoutes; auto& routes = getConfig().routes; for (auto& r : routes) { @@ -497,15 +504,30 @@ ndk::ScopedAStatus Module::connectExternalDevice(const AudioPort& in_templateIdA newRoute.sinkPortId = connectedPort.id; newRoute.isExclusive = r.isExclusive; newRoutes.push_back(std::move(newRoute)); + routablePortIds.insert(routablePortIds.end(), r.sourcePortIds.begin(), + r.sourcePortIds.end()); } else { auto& srcs = r.sourcePortIds; if (std::find(srcs.begin(), srcs.end(), templateId) != srcs.end()) { srcs.push_back(connectedPort.id); + routablePortIds.push_back(r.sinkPortId); } } } routes.insert(routes.end(), newRoutes.begin(), newRoutes.end()); + // Note: this is a simplistic approach assuming that a mix port can only be populated + // from a single device port. Implementing support for stuffing dynamic profiles with a superset + // of all profiles from all routable dynamic device ports would be more involved. + for (const auto mixPortId : routablePortIds) { + auto portsIt = findById(ports, mixPortId); + if (portsIt != ports.end() && portsIt->profiles.empty()) { + portsIt->profiles = connectedPort.profiles; + connectedPortsIt->second.push_back(portsIt->id); + } + } + *_aidl_return = std::move(connectedPort); + return ndk::ScopedAStatus::ok(); } @@ -520,7 +542,8 @@ ndk::ScopedAStatus Module::disconnectExternalDevice(int32_t in_portId) { LOG(ERROR) << __func__ << ": port id " << in_portId << " is not a device port"; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } - if (mConnectedDevicePorts.count(in_portId) == 0) { + auto connectedPortsIt = mConnectedDevicePorts.find(in_portId); + if (connectedPortsIt == mConnectedDevicePorts.end()) { LOG(ERROR) << __func__ << ": port id " << in_portId << " is not a connected device port"; return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); } @@ -541,7 +564,6 @@ ndk::ScopedAStatus Module::disconnectExternalDevice(int32_t in_portId) { } onExternalDeviceConnectionChanged(*portIt, false /*connected*/); ports.erase(portIt); - mConnectedDevicePorts.erase(in_portId); LOG(DEBUG) << __func__ << ": connected device port " << in_portId << " released"; auto& routes = getConfig().routes; @@ -556,6 +578,14 @@ ndk::ScopedAStatus Module::disconnectExternalDevice(int32_t in_portId) { } } + for (const auto mixPortId : connectedPortsIt->second) { + auto mixPortIt = findById(ports, mixPortId); + if (mixPortIt != ports.end()) { + mixPortIt->profiles = {}; + } + } + mConnectedDevicePorts.erase(connectedPortsIt); + return ndk::ScopedAStatus::ok(); } diff --git a/audio/aidl/default/include/core-impl/Configuration.h b/audio/aidl/default/include/core-impl/Configuration.h index 4dd01338e2..70320e46aa 100644 --- a/audio/aidl/default/include/core-impl/Configuration.h +++ b/audio/aidl/default/include/core-impl/Configuration.h @@ -33,7 +33,8 @@ struct Configuration { std::vector<::aidl::android::media::audio::common::AudioPort> ports; std::vector<::aidl::android::media::audio::common::AudioPortConfig> portConfigs; std::vector<::aidl::android::media::audio::common::AudioPortConfig> initialConfigs; - // Port id -> List of profiles to use when the device port state is set to 'connected'. + // Port id -> List of profiles to use when the device port state is set to 'connected' + // in connection simulation mode. std::map> connectedProfiles; std::vector routes; diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h index 2cbda7d7b1..83ecfaa8c6 100644 --- a/audio/aidl/default/include/core-impl/Module.h +++ b/audio/aidl/default/include/core-impl/Module.h @@ -177,8 +177,10 @@ class Module : public BnModule { ChildInterface mBluetooth; ChildInterface mBluetoothA2dp; ChildInterface mBluetoothLe; - // ids of ports created at runtime via 'connectExternalDevice'. - std::set mConnectedDevicePorts; + // ids of device ports created at runtime via 'connectExternalDevice'. + // Also stores ids of mix ports with dynamic profiles which got populated from the connected + // port. + std::map> mConnectedDevicePorts; Streams mStreams; // Maps port ids and port config ids to patch ids. // Multimap because both ports and configs can be used by multiple patches. diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp index 62b4270a11..825b865ef1 100644 --- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp @@ -1780,6 +1780,42 @@ TEST_P(AudioCoreModule, ExternalDevicePortRoutes) { } } +// Note: This test relies on simulation of external device connections by the HAL module. +TEST_P(AudioCoreModule, ExternalDeviceMixPortConfigs) { + // After an external device has been connected, all mix ports that can be routed + // to the device port for the connected device must have non-empty profiles. + ASSERT_NO_FATAL_FAILURE(SetUpModuleConfig()); + std::vector externalDevicePorts = moduleConfig->getExternalDevicePorts(); + if (externalDevicePorts.empty()) { + GTEST_SKIP() << "No external devices in the module."; + } + for (const auto& port : externalDevicePorts) { + WithDevicePortConnectedState portConnected(GenerateUniqueDeviceAddress(port)); + ASSERT_NO_FATAL_FAILURE(portConnected.SetUp(module.get())); + std::vector routes; + ASSERT_IS_OK(module->getAudioRoutesForAudioPort(portConnected.getId(), &routes)); + std::vector allPorts; + ASSERT_IS_OK(module->getAudioPorts(&allPorts)); + for (const auto& r : routes) { + if (r.sinkPortId == portConnected.getId()) { + for (const auto& srcPortId : r.sourcePortIds) { + const auto srcPortIt = findById(allPorts, srcPortId); + ASSERT_NE(allPorts.end(), srcPortIt) << "port ID " << srcPortId; + EXPECT_NE(0UL, srcPortIt->profiles.size()) + << " source port " << srcPortIt->toString() << " must have its profiles" + << " populated following external device connection"; + } + } else { + const auto sinkPortIt = findById(allPorts, r.sinkPortId); + ASSERT_NE(allPorts.end(), sinkPortIt) << "port ID " << r.sinkPortId; + EXPECT_NE(0UL, sinkPortIt->profiles.size()) + << " source port " << sinkPortIt->toString() << " must have its" + << " profiles populated following external device connection"; + } + } + } +} + TEST_P(AudioCoreModule, MasterMute) { bool isSupported = false; EXPECT_NO_FATAL_FAILURE(TestAccessors(module.get(), &IModule::getMasterMute, diff --git a/audio/aidl/vts/VtsHalAudioCoreTargetTest.xml b/audio/aidl/vts/VtsHalAudioCoreTargetTest.xml new file mode 100644 index 0000000000..dfc10397f7 --- /dev/null +++ b/audio/aidl/vts/VtsHalAudioCoreTargetTest.xml @@ -0,0 +1,33 @@ + + + + From 6814c443ebe0305d47c8299c3945750b6c297a7b Mon Sep 17 00:00:00 2001 From: Sally Qi Date: Thu, 30 Mar 2023 23:41:29 -0700 Subject: [PATCH 877/998] Fix HDR sluggish issue. - skip writing blobs if empty packet is sent for per-frame metadata. Bug: 274050717 Test: play HDR video on YouTube Change-Id: If8716613136c70a5adee29074cc2e9d35a500264 --- .../composer-command-buffer/2.3/ComposerCommandBuffer.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/graphics/composer/2.3/utils/command-buffer/include/composer-command-buffer/2.3/ComposerCommandBuffer.h b/graphics/composer/2.3/utils/command-buffer/include/composer-command-buffer/2.3/ComposerCommandBuffer.h index afc22d8719..5e9a2877f6 100644 --- a/graphics/composer/2.3/utils/command-buffer/include/composer-command-buffer/2.3/ComposerCommandBuffer.h +++ b/graphics/composer/2.3/utils/command-buffer/include/composer-command-buffer/2.3/ComposerCommandBuffer.h @@ -87,6 +87,10 @@ class CommandWriterBase : public V2_2::CommandWriterBase { return; } + if (metadata.size() == 0) { + return; + } + // space for numElements commandLength += 1; From 9336eacc6da57c500b8663c0b2b22aefee1bb150 Mon Sep 17 00:00:00 2001 From: Shinru Han Date: Thu, 30 Mar 2023 14:45:53 +0800 Subject: [PATCH 878/998] Add AIDL version check for injectNiSuplMessageData() Test: atest VtsHalGnssTargetTest Bug: 242105192 Change-Id: Ic05990c94e81d3f303dfa4b3fd397a9e2ef749d6 --- gnss/aidl/vts/gnss_hal_test_cases.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp index 96dece473a..d6a1fc5986 100644 --- a/gnss/aidl/vts/gnss_hal_test_cases.cpp +++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp @@ -1132,8 +1132,10 @@ TEST_P(GnssHalTest, TestAGnssRilExtension) { status = iAGnssRil->setRefLocation(agnssReflocation); ASSERT_TRUE(status.isOk()); - status = iAGnssRil->injectNiSuplMessageData(std::vector(), 0); - ASSERT_FALSE(status.isOk()); + if (aidl_gnss_hal_->getInterfaceVersion() >= 3) { + status = iAGnssRil->injectNiSuplMessageData(std::vector(), 0); + ASSERT_FALSE(status.isOk()); + } } /* From 25e0d09c766e1a573d1dfc8be285f5da4aed43e4 Mon Sep 17 00:00:00 2001 From: Brian Lindahl Date: Fri, 9 Dec 2022 00:32:11 -0700 Subject: [PATCH 879/998] Add VTS test for clearing buffer slots to Composer HIDL and AIDL This feature allows SurfaceFlinger to clear buffer slots when buffers are discarded by SurfaceFlinger clients and will no longer be used, allowing the graphics memory to be freed immediately. Bug: 258196272 Test: atest VtsHalGraphicsComposerV2_4TargetTest Test: atest VtsHalGraphicsComposer3_TargetTest Change-Id: Ibfbe2078ac419bb8f3880ee3f0512acaad2f5012 --- .../VtsHalGraphicsComposerV2_1TargetTest.cpp | 106 +++++++++++++++- .../VtsHalGraphicsComposer3_TargetTest.cpp | 118 ++++++++++++++++-- 2 files changed, 214 insertions(+), 10 deletions(-) diff --git a/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp b/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp index 48226785d5..9444d89f80 100644 --- a/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp +++ b/graphics/composer/2.1/vts/functional/VtsHalGraphicsComposerV2_1TargetTest.cpp @@ -666,11 +666,13 @@ class GraphicsComposerHidlCommandTest : public GraphicsComposerHidlTest { ASSERT_NO_FATAL_FAILURE(GraphicsComposerHidlTest::TearDown()); } - NativeHandleWrapper allocate() { + NativeHandleWrapper allocate() { return allocate(mDisplayWidth, mDisplayHeight); } + + NativeHandleWrapper allocate(uint32_t width, uint32_t height) { uint64_t usage = static_cast(BufferUsage::CPU_WRITE_OFTEN | BufferUsage::CPU_READ_OFTEN | BufferUsage::COMPOSER_OVERLAY); - return mGralloc->allocate(mDisplayWidth, mDisplayHeight, 1, PixelFormat::RGBA_8888, usage); + return mGralloc->allocate(width, height, 1, PixelFormat::RGBA_8888, usage); } void execute() { mComposerClient->execute(mReader.get(), mWriter.get()); } @@ -883,6 +885,106 @@ TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_BUFFER) { execute(); } +/** + * Test IComposerClient::Command::SET_LAYER_BUFFER with the behavior used for clearing buffer slots. + */ +TEST_P(GraphicsComposerHidlCommandTest, SET_LAYER_BUFFER_multipleTimes) { + // A placeholder buffer used to clear buffer slots + auto clearSlotBuffer = allocate(1u, 1u); + + // + // Set the layer buffer to the first buffer + // + auto handle1 = allocate(); + ASSERT_NE(nullptr, handle1.get()); + IComposerClient::Rect displayFrame{0, 0, mDisplayWidth, mDisplayHeight}; + Layer layer; + ASSERT_NO_FATAL_FAILURE( + layer = mComposerClient->createLayer(mPrimaryDisplay, kBufferSlotCount)); + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->selectLayer(layer); + mWriter->setLayerCompositionType(IComposerClient::Composition::DEVICE); + mWriter->setLayerDisplayFrame(displayFrame); + mWriter->setLayerBuffer(0, handle1.get(), -1); + mWriter->setLayerDataspace(Dataspace::UNKNOWN); + mWriter->validateDisplay(); + execute(); + if (mReader->mCompositionChanges.size() != 0) { + GTEST_SUCCEED() << "Composition change requested, skipping test"; + return; + } + ASSERT_EQ(0, mReader->mErrors.size()); + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->presentDisplay(); + execute(); + ASSERT_EQ(0, mReader->mErrors.size()); + + // + // Set the layer buffer to the second buffer + // + auto handle2 = allocate(); + ASSERT_NE(nullptr, handle2.get()); + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->selectLayer(layer); + mWriter->setLayerCompositionType(IComposerClient::Composition::DEVICE); + mWriter->setLayerDisplayFrame(displayFrame); + mWriter->setLayerBuffer(1, handle2.get(), -1); + mWriter->setLayerDataspace(Dataspace::UNKNOWN); + mWriter->validateDisplay(); + execute(); + if (mReader->mCompositionChanges.size() != 0) { + GTEST_SUCCEED() << "Composition change requested, skipping test"; + return; + } + ASSERT_EQ(0, mReader->mErrors.size()); + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->presentDisplay(); + execute(); + ASSERT_EQ(0, mReader->mErrors.size()); + + // + // Set the layer buffer to the third buffer + // + auto handle3 = allocate(); + ASSERT_NE(nullptr, handle3.get()); + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->selectLayer(layer); + mWriter->setLayerCompositionType(IComposerClient::Composition::DEVICE); + mWriter->setLayerDisplayFrame(displayFrame); + mWriter->setLayerBuffer(2, handle3.get(), -1); + mWriter->setLayerDataspace(Dataspace::UNKNOWN); + mWriter->validateDisplay(); + execute(); + if (mReader->mCompositionChanges.size() != 0) { + GTEST_SUCCEED() << "Composition change requested, skipping test"; + return; + } + ASSERT_EQ(0, mReader->mErrors.size()); + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->presentDisplay(); + execute(); + ASSERT_EQ(0, mReader->mErrors.size()); + + // Ensure we can clear multiple buffer slots and then restore the active buffer at the end + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->selectLayer(layer); + mWriter->setLayerBuffer(0, clearSlotBuffer.get(), -1); + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->selectLayer(layer); + mWriter->setLayerBuffer(1, clearSlotBuffer.get(), -1); + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->selectLayer(layer); + mWriter->setLayerBuffer(2, nullptr, -1); + mWriter->validateDisplay(); + execute(); + ASSERT_EQ(0, mReader->mErrors.size()); + + mWriter->selectDisplay(mPrimaryDisplay); + mWriter->presentDisplay(); + execute(); + ASSERT_EQ(0, mReader->mErrors.size()); +} + /** * Test IComposerClient::Command::SET_LAYER_SURFACE_DAMAGE. */ diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index 746330b148..2b1b7532d9 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -1225,17 +1225,21 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest { }); } - sp allocate(::android::PixelFormat pixelFormat) { + sp allocate(uint32_t width, uint32_t height, + ::android::PixelFormat pixelFormat) { return sp::make( - static_cast(getPrimaryDisplay().getDisplayWidth()), - static_cast(getPrimaryDisplay().getDisplayHeight()), pixelFormat, - /*layerCount*/ 1U, - (static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | - static_cast(common::BufferUsage::CPU_READ_OFTEN) | - static_cast(common::BufferUsage::COMPOSER_OVERLAY)), + width, height, pixelFormat, /*layerCount*/ 1U, + static_cast(common::BufferUsage::CPU_WRITE_OFTEN) | + static_cast(common::BufferUsage::CPU_READ_OFTEN) | + static_cast(common::BufferUsage::COMPOSER_OVERLAY), "VtsHalGraphicsComposer3_TargetTest"); } + sp allocate(::android::PixelFormat pixelFormat) { + return allocate(static_cast(getPrimaryDisplay().getDisplayWidth()), + static_cast(getPrimaryDisplay().getDisplayHeight()), pixelFormat); + } + void sendRefreshFrame(const VtsDisplay& display, const VsyncPeriodChangeTimeline* timeline) { if (timeline != nullptr) { // Refresh time should be before newVsyncAppliedTimeNanos @@ -1749,6 +1753,104 @@ TEST_P(GraphicsComposerAidlCommandTest, SetLayerBuffer) { execute(); } +TEST_P(GraphicsComposerAidlCommandTest, SetLayerBufferSlotsToClear) { + // Older HAL versions use a backwards compatible way of clearing buffer slots + const auto& [versionStatus, version] = mComposerClient->getInterfaceVersion(); + ASSERT_TRUE(versionStatus.isOk()); + if (version <= 1) { + GTEST_SUCCEED() << "HAL at version 1 or lower does not have " + "LayerCommand::bufferSlotsToClear."; + return; + } + + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + auto& writer = getWriter(getPrimaryDisplayId()); + + // setup 3 buffers in the buffer cache, with the last buffer being active + // then emulate the Android platform code that clears all 3 buffer slots + + const auto buffer1 = allocate(::android::PIXEL_FORMAT_RGBA_8888); + ASSERT_NE(nullptr, buffer1); + const auto handle1 = buffer1->handle; + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle1, /*acquireFence*/ -1); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + const auto buffer2 = allocate(::android::PIXEL_FORMAT_RGBA_8888); + ASSERT_NE(nullptr, buffer2); + const auto handle2 = buffer2->handle; + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 1, handle2, /*acquireFence*/ -1); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + const auto buffer3 = allocate(::android::PIXEL_FORMAT_RGBA_8888); + ASSERT_NE(nullptr, buffer3); + const auto handle3 = buffer3->handle; + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 2, handle3, /*acquireFence*/ -1); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + // Ensure we can clear all 3 buffer slots, even the active buffer - it is assumed the + // current active buffer's slot will be cleared, but still remain the active buffer and no + // errors will occur. + writer.setLayerBufferSlotsToClear(getPrimaryDisplayId(), layer, {0, 1, 2}); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); +} + +TEST_P(GraphicsComposerAidlCommandTest, SetLayerBufferMultipleTimes) { + const auto& [layerStatus, layer] = + mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); + EXPECT_TRUE(layerStatus.isOk()); + auto& writer = getWriter(getPrimaryDisplayId()); + + // Setup 3 buffers in the buffer cache, with the last buffer being active. Then, emulate the + // Android platform code that clears all 3 buffer slots by setting all but the active buffer + // slot to a placeholder buffer, and then restoring the active buffer. + + // This is used on HALs that don't support setLayerBufferSlotsToClear (version <= 3.1). + + const auto buffer1 = allocate(::android::PIXEL_FORMAT_RGBA_8888); + ASSERT_NE(nullptr, buffer1); + const auto handle1 = buffer1->handle; + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, handle1, /*acquireFence*/ -1); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + const auto buffer2 = allocate(::android::PIXEL_FORMAT_RGBA_8888); + ASSERT_NE(nullptr, buffer2); + const auto handle2 = buffer2->handle; + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 1, handle2, /*acquireFence*/ -1); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + const auto buffer3 = allocate(::android::PIXEL_FORMAT_RGBA_8888); + ASSERT_NE(nullptr, buffer3); + const auto handle3 = buffer3->handle; + writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 2, handle3, /*acquireFence*/ -1); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); + + // Older versions of the HAL clear all but the active buffer slot with a placeholder buffer, + // and then restoring the current active buffer at the end + auto clearSlotBuffer = allocate(1u, 1u, ::android::PIXEL_FORMAT_RGB_888); + ASSERT_NE(nullptr, clearSlotBuffer); + auto clearSlotBufferHandle = clearSlotBuffer->handle; + + // clear buffer slots 0 and 1 with new layer commands... and then... + writer.setLayerBufferWithNewCommand(getPrimaryDisplayId(), layer, /* slot */ 0, + clearSlotBufferHandle, /*acquireFence*/ -1); + writer.setLayerBufferWithNewCommand(getPrimaryDisplayId(), layer, /* slot */ 1, + clearSlotBufferHandle, /*acquireFence*/ -1); + // ...reset the layer buffer to the current active buffer slot with a final new command + writer.setLayerBufferWithNewCommand(getPrimaryDisplayId(), layer, /*slot*/ 2, nullptr, + /*acquireFence*/ -1); + execute(); + ASSERT_TRUE(mReader.takeErrors().empty()); +} + TEST_P(GraphicsComposerAidlCommandTest, SetLayerSurfaceDamage) { const auto& [layerStatus, layer] = mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount); @@ -2583,4 +2685,4 @@ int main(int argc, char** argv) { } return RUN_ALL_TESTS(); -} \ No newline at end of file +} From c85693d02db99e5eb4ffd4c6464a4aca201c26a2 Mon Sep 17 00:00:00 2001 From: Brian Lindahl Date: Fri, 31 Mar 2023 07:31:51 -0600 Subject: [PATCH 880/998] Fix bug where buffer slots to clear were not set correctly Bug: 276417624 Bug: 258196272 Test: VtsHalGraphicsComposer3_TargetTest Change-Id: Ie077f14140d71f88a497c4a8995d73dd07c31598 --- .../hardware/graphics/composer3/ComposerClientWriter.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h index 22020c0ea9..4a5ac69f2f 100644 --- a/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h +++ b/graphics/composer/aidl/include/android/hardware/graphics/composer3/ComposerClientWriter.h @@ -144,10 +144,8 @@ class ComposerClientWriter final { void setLayerBufferSlotsToClear(int64_t display, int64_t layer, const std::vector& slotsToClear) { - LayerCommand& layerCommand = getLayerCommand(display, layer); - for (auto slot : slotsToClear) { - layerCommand.bufferSlotsToClear.emplace(static_cast(slot)); - } + getLayerCommand(display, layer) + .bufferSlotsToClear.emplace(slotsToClear.begin(), slotsToClear.end()); } void setLayerSurfaceDamage(int64_t display, int64_t layer, const std::vector& damage) { From 72dee4908eccf2ba4028f1fad9ab2f806e246e99 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Fri, 31 Mar 2023 12:32:32 -0700 Subject: [PATCH 881/998] All hals are marked optional in compatibility matrices (U) Requirements are tested separatedly, in vts_treble_vintf_test. New requirements are reflected in vts_treble_vintf_test. See change If922f97cbf9fc. Test: TH Bug: 247575800 Change-Id: I2ffb16e226a5bcf5166a99fc6199276b9230cf50 --- compatibility_matrices/compatibility_matrix.8.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compatibility_matrices/compatibility_matrix.8.xml b/compatibility_matrices/compatibility_matrix.8.xml index 599915812f..310eaa153a 100644 --- a/compatibility_matrices/compatibility_matrix.8.xml +++ b/compatibility_matrices/compatibility_matrix.8.xml @@ -1,5 +1,5 @@ - + android.hardware.audio 6.0 7.0-1 @@ -274,7 +274,7 @@ default - + android.hardware.health 1-2 @@ -387,7 +387,7 @@ default - + android.hardware.power 4 From d32f3784050f7f6c3c27607cc049ec66c97ef4b1 Mon Sep 17 00:00:00 2001 From: Zhanghao Date: Tue, 21 Mar 2023 05:41:55 +0000 Subject: [PATCH 882/998] GnssStatus for GnssMeasurement-only VTS test Update VTS test case: GnssStatus should be reported when only measurement is registered. Test: atest VtsHalGnssTargetTest Bug: 274653052 Change-Id: I53c741d2cee7a4c36ad0a2744ccb8b3e917b7996 --- .../android/hardware/gnss/IGnssCallback.aidl | 9 ++++--- gnss/aidl/default/Gnss.cpp | 1 + gnss/aidl/default/Gnss.h | 2 +- .../aidl/default/GnssMeasurementInterface.cpp | 8 +++++++ gnss/aidl/default/GnssMeasurementInterface.h | 4 ++++ gnss/aidl/vts/GnssCallbackAidl.cpp | 2 ++ gnss/aidl/vts/GnssCallbackAidl.h | 3 +++ gnss/aidl/vts/gnss_hal_test.cpp | 24 +++++++++++++++++++ gnss/aidl/vts/gnss_hal_test.h | 2 ++ gnss/aidl/vts/gnss_hal_test_cases.cpp | 18 +++++++++++--- 10 files changed, 66 insertions(+), 7 deletions(-) diff --git a/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl b/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl index ee21011a6d..0200625105 100644 --- a/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl +++ b/gnss/aidl/android/hardware/gnss/IGnssCallback.aidl @@ -214,9 +214,12 @@ interface IGnssCallback { /** * Callback for the HAL to pass a vector of GnssSvInfo back to the client. * - * If GnssMeasurement is registered, the SvStatus report interval is the same as the measurement - * interval, i.e., the interval the measurement engine runs at. If GnssMeasurement is not - * registered, the SvStatus interval is the same as the location interval. + * If only GnssMeasurement is registered, the SvStatus reporting interval must be + * the same as the measurement interval, i.e., the interval the measurement + * engine runs at. If only location is registered, the SvStatus interval must + * be the same as the location interval. If both GnssMeasurement and location + * are registered, then the SvStatus interval is the same as the lesser interval + * between the two. * * @param svInfo SV status information from HAL. */ diff --git a/gnss/aidl/default/Gnss.cpp b/gnss/aidl/default/Gnss.cpp index ec86d2ee01..f1b9cbfd3f 100644 --- a/gnss/aidl/default/Gnss.cpp +++ b/gnss/aidl/default/Gnss.cpp @@ -325,6 +325,7 @@ ScopedAStatus Gnss::getExtensionGnssMeasurement( ALOGD("getExtensionGnssMeasurement"); if (mGnssMeasurementInterface == nullptr) { mGnssMeasurementInterface = SharedRefBase::make(); + mGnssMeasurementInterface->setGnssInterface(static_cast>(this)); } *iGnssMeasurement = mGnssMeasurementInterface; return ScopedAStatus::ok(); diff --git a/gnss/aidl/default/Gnss.h b/gnss/aidl/default/Gnss.h index df10fc856b..00540cd62b 100644 --- a/gnss/aidl/default/Gnss.h +++ b/gnss/aidl/default/Gnss.h @@ -84,13 +84,13 @@ class Gnss : public BnGnss { IMeasurementCorrectionsInterface>* iMeasurementCorrections) override; + void reportSvStatus() const; std::shared_ptr mGnssConfiguration; std::shared_ptr mGnssPowerIndication; std::shared_ptr mGnssMeasurementInterface; private: void reportLocation(const GnssLocation&) const; - void reportSvStatus() const; void reportSvStatus(const std::vector& svInfoList) const; std::vector filterBlocklistedSatellites( std::vector gnssSvInfoList) const; diff --git a/gnss/aidl/default/GnssMeasurementInterface.cpp b/gnss/aidl/default/GnssMeasurementInterface.cpp index 90056ce617..aab9e038d0 100644 --- a/gnss/aidl/default/GnssMeasurementInterface.cpp +++ b/gnss/aidl/default/GnssMeasurementInterface.cpp @@ -20,6 +20,7 @@ #include #include #include "DeviceFileReader.h" +#include "Gnss.h" #include "GnssRawMeasurementParser.h" #include "GnssReplayUtils.h" #include "Utils.h" @@ -126,6 +127,9 @@ void GnssMeasurementInterface::start(const bool enableCorrVecOutputs, auto measurement = Utils::getMockMeasurement(enableCorrVecOutputs, enableFullTracking); this->reportMeasurement(measurement); + if (!mLocationEnabled) { + mGnss->reportSvStatus(); + } } intervalMs = (mLocationEnabled) ? std::min(mLocationIntervalMs, mIntervalMs) : mIntervalMs; @@ -164,6 +168,10 @@ void GnssMeasurementInterface::setLocationEnabled(const bool enabled) { mLocationEnabled = enabled; } +void GnssMeasurementInterface::setGnssInterface(const std::shared_ptr& gnss) { + mGnss = gnss; +} + void GnssMeasurementInterface::waitForStoppingThreads() { for (auto& future : mFutures) { ALOGD("Stopping previous thread."); diff --git a/gnss/aidl/default/GnssMeasurementInterface.h b/gnss/aidl/default/GnssMeasurementInterface.h index d2737e5206..926a4e759b 100644 --- a/gnss/aidl/default/GnssMeasurementInterface.h +++ b/gnss/aidl/default/GnssMeasurementInterface.h @@ -25,6 +25,7 @@ #include "Utils.h" namespace aidl::android::hardware::gnss { +class Gnss; struct GnssMeasurementInterface : public BnGnssMeasurementInterface { public: @@ -39,6 +40,7 @@ struct GnssMeasurementInterface : public BnGnssMeasurementInterface { const Options& options) override; void setLocationInterval(const int intervalMs); void setLocationEnabled(const bool enabled); + void setGnssInterface(const std::shared_ptr& gnss); private: void start(const bool enableCorrVecOutputs, const bool enableFullTracking); @@ -59,6 +61,8 @@ struct GnssMeasurementInterface : public BnGnssMeasurementInterface { // Synchronization lock for sCallback mutable std::mutex mMutex; + + std::shared_ptr mGnss; }; } // namespace aidl::android::hardware::gnss diff --git a/gnss/aidl/vts/GnssCallbackAidl.cpp b/gnss/aidl/vts/GnssCallbackAidl.cpp index d3be41437a..2e34921006 100644 --- a/gnss/aidl/vts/GnssCallbackAidl.cpp +++ b/gnss/aidl/vts/GnssCallbackAidl.cpp @@ -18,6 +18,7 @@ #include "GnssCallbackAidl.h" #include +#include using android::binder::Status; using android::hardware::gnss::GnssLocation; @@ -53,6 +54,7 @@ Status GnssCallbackAidl::gnssStatusCb(const GnssStatusValue /* status */) { Status GnssCallbackAidl::gnssSvStatusCb(const std::vector& svInfoList) { ALOGI("gnssSvStatusCb. Size = %d", (int)svInfoList.size()); sv_info_list_cbq_.store(svInfoList); + sv_info_list_timestamps_millis_cbq_.store(::android::elapsedRealtime()); return Status::ok(); } diff --git a/gnss/aidl/vts/GnssCallbackAidl.h b/gnss/aidl/vts/GnssCallbackAidl.h index 06526d3d2d..82a0df4814 100644 --- a/gnss/aidl/vts/GnssCallbackAidl.h +++ b/gnss/aidl/vts/GnssCallbackAidl.h @@ -29,6 +29,7 @@ class GnssCallbackAidl : public android::hardware::gnss::BnGnssCallback { info_cbq_("system_info"), location_cbq_("location"), sv_info_list_cbq_("sv_info"), + sv_info_list_timestamps_millis_cbq_("sv_info_timestamps"), nmea_cbq_("nmea"){}; ~GnssCallbackAidl(){}; @@ -64,6 +65,8 @@ class GnssCallbackAidl : public android::hardware::gnss::BnGnssCallback { android::hardware::gnss::common::GnssCallbackEventQueue< std::vector> sv_info_list_cbq_; + android::hardware::gnss::common::GnssCallbackEventQueue + sv_info_list_timestamps_millis_cbq_; android::hardware::gnss::common::GnssCallbackEventQueue> nmea_cbq_; }; \ No newline at end of file diff --git a/gnss/aidl/vts/gnss_hal_test.cpp b/gnss/aidl/vts/gnss_hal_test.cpp index fb9af527c5..4f5e6a0b6b 100644 --- a/gnss/aidl/vts/gnss_hal_test.cpp +++ b/gnss/aidl/vts/gnss_hal_test.cpp @@ -478,6 +478,30 @@ void GnssHalTest::collectMeasurementIntervals(const sp& deltasMs) { + aidl_gnss_cb_->sv_info_list_timestamps_millis_cbq_.reset(); + aidl_gnss_cb_->sv_info_list_cbq_.reset(); + + auto status = aidl_gnss_hal_->startSvStatus(); + EXPECT_TRUE(status.isOk()); + ASSERT_TRUE(aidl_gnss_cb_->sv_info_list_timestamps_millis_cbq_.size() == + aidl_gnss_cb_->sv_info_list_cbq_.size()); + long lastElapsedRealtimeMillis = 0; + for (int i = 0; i < numMeasurementEvents; i++) { + long timeStamp; + ASSERT_TRUE(aidl_gnss_cb_->sv_info_list_timestamps_millis_cbq_.retrieve(timeStamp, + timeoutSeconds)); + if (lastElapsedRealtimeMillis != 0) { + deltasMs.push_back(timeStamp - lastElapsedRealtimeMillis); + } + lastElapsedRealtimeMillis = timeStamp; + } + status = aidl_gnss_hal_->stopSvStatus(); + EXPECT_TRUE(status.isOk()); +} + void GnssHalTest::checkGnssDataFields(const sp& callback, const int numMeasurementEvents, const int timeoutSeconds, const bool isFullTracking) { diff --git a/gnss/aidl/vts/gnss_hal_test.h b/gnss/aidl/vts/gnss_hal_test.h index 470294ca31..88d01c1769 100644 --- a/gnss/aidl/vts/gnss_hal_test.h +++ b/gnss/aidl/vts/gnss_hal_test.h @@ -101,6 +101,8 @@ class GnssHalTest : public android::hardware::gnss::common::GnssHalTestTemplate< void collectMeasurementIntervals(const sp& callback, const int numMeasurementEvents, const int timeoutSeconds, std::vector& deltaMs); + void collectSvInfoListTimestamps(const int numMeasurementEvents, const int timeoutSeconds, + std::vector& deltasMs); void checkGnssDataFields(const sp& callback, const int numMeasurementEvents, const int timeoutSeconds, const bool isFullTracking); diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp index 96dece473a..17d65f581b 100644 --- a/gnss/aidl/vts/gnss_hal_test_cases.cpp +++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp @@ -1407,6 +1407,7 @@ TEST_P(GnssHalTest, TestStopSvStatusAndNmea) { * TestGnssMeasurementIntervals_WithoutLocation: * 1. Start measurement at intervals * 2. Verify measurement are received at expected intervals + * 3. Verify status are reported at expected intervals */ TEST_P(GnssHalTest, TestGnssMeasurementIntervals_WithoutLocation) { if (aidl_gnss_hal_->getInterfaceVersion() <= 1) { @@ -1426,13 +1427,24 @@ TEST_P(GnssHalTest, TestGnssMeasurementIntervals_WithoutLocation) { auto callback = sp::make(); startMeasurementWithInterval(intervals[i], iGnssMeasurement, callback); - std::vector deltas; - collectMeasurementIntervals(callback, numEvents[i], /* timeoutSeconds= */ 10, deltas); + std::vector measurementDeltas; + std::vector svInfoListTimestampsDeltas; + collectMeasurementIntervals(callback, numEvents[i], /* timeoutSeconds= */ 10, + measurementDeltas); + if (aidl_gnss_hal_->getInterfaceVersion() >= 3) { + collectSvInfoListTimestamps(numEvents[i], /* timeoutSeconds= */ 10, + svInfoListTimestampsDeltas); + } status = iGnssMeasurement->close(); ASSERT_TRUE(status.isOk()); - assertMeanAndStdev(intervals[i], deltas); + assertMeanAndStdev(intervals[i], measurementDeltas); + + if (aidl_gnss_hal_->getInterfaceVersion() >= 3) { + assertMeanAndStdev(intervals[i], svInfoListTimestampsDeltas); + EXPECT_TRUE(aidl_gnss_cb_->sv_info_list_cbq_.size() > 0); + } } } From 49cb038af11876a9fe1155dea33fc4109768359b Mon Sep 17 00:00:00 2001 From: Shuzhen Wang Date: Thu, 30 Mar 2023 19:17:33 -0700 Subject: [PATCH 883/998] Camera: VTS: Fail test if availableSettingsOverride is empty If availableSettingsOverride key is in CameraCharacteristics, it must contains at least OFF. Test: atest VtsAidlHalCameraProvider_TargetTest Bug: 272546819 Change-Id: If6fb7275fc1191947dc120c9873274f4a1883720 --- camera/provider/aidl/vts/camera_aidl_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp index 64507feb07..ee0c518b39 100644 --- a/camera/provider/aidl/vts/camera_aidl_test.cpp +++ b/camera/provider/aidl/vts/camera_aidl_test.cpp @@ -336,7 +336,7 @@ void CameraAidlTest::verifySettingsOverrideCharacteristics(const camera_metadata int retcode = find_camera_metadata_ro_entry(metadata, ANDROID_CONTROL_AVAILABLE_SETTINGS_OVERRIDES, &entry); bool supportSettingsOverride = false; - if ((0 == retcode) && (entry.count > 0)) { + if (0 == retcode) { supportSettingsOverride = true; bool hasOff = false; for (size_t i = 0; i < entry.count; i++) { From 3d81801f17d910625c600c07dc5fb37b3b2ebeec Mon Sep 17 00:00:00 2001 From: Changyeon Jo Date: Fri, 31 Mar 2023 10:45:49 -0700 Subject: [PATCH 884/998] Correct compatibility matrix version 8 Remove a default instance from android.hardware.automotive.evs hal entry because they must be provided by the framework. Bug: 276467810 Test: Build Change-Id: I5437c8b50f38ab5f030d4a31a7f0234e31e1561a --- compatibility_matrices/compatibility_matrix.8.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/compatibility_matrices/compatibility_matrix.8.xml b/compatibility_matrices/compatibility_matrix.8.xml index 310eaa153a..8ee86ccca7 100644 --- a/compatibility_matrices/compatibility_matrix.8.xml +++ b/compatibility_matrices/compatibility_matrix.8.xml @@ -80,7 +80,6 @@ android.hardware.automotive.evs IEvsEnumerator - default [a-z]+/[0-9]+ From bc433a0d5b4b5437f5ca0de771b327ce3841e273 Mon Sep 17 00:00:00 2001 From: Changyeon Jo Date: Mon, 3 Apr 2023 05:16:34 +0000 Subject: [PATCH 885/998] Correct comments - Fix a typo on ExposureParameters.coarseIntegrationTimeLShift. - Add a comment that describes a descriptor field of GridStatistics. Bug: 276675923 Test: build Change-Id: Ida93c21c9de7f7c1d661c790d82342750d5f29fe --- .../android/hardware/automotive/evs/ExposureParameters.aidl | 2 +- .../aidl/android/hardware/automotive/evs/GridStatistics.aidl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/ExposureParameters.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/ExposureParameters.aidl index 6a85ade94e..e644fedb95 100644 --- a/automotive/evs/aidl/android/hardware/automotive/evs/ExposureParameters.aidl +++ b/automotive/evs/aidl/android/hardware/automotive/evs/ExposureParameters.aidl @@ -42,7 +42,7 @@ parcelable ExposureParameters { /** Remainder exposure time in clocks. */ long fineIntegrationTimeInPixelClocks; /** - * Logarthm value of coarse integration time multiplier. + * Logarithm value of coarse integration time multiplier. */ int coarseIntegrationTimeLShift; } diff --git a/automotive/evs/aidl/android/hardware/automotive/evs/GridStatistics.aidl b/automotive/evs/aidl/android/hardware/automotive/evs/GridStatistics.aidl index e66c51eb2e..57f72eaf44 100644 --- a/automotive/evs/aidl/android/hardware/automotive/evs/GridStatistics.aidl +++ b/automotive/evs/aidl/android/hardware/automotive/evs/GridStatistics.aidl @@ -25,7 +25,7 @@ import android.hardware.common.Ashmem; */ @VintfStability parcelable GridStatistics { - /** */ + /** Descriptors of grid statistics in shared memory. */ GridStatisticDesc[] descriptors; /** * Shared memory object containing one or more grid statistics. From 708d49cfce0cfa4ef9bd222ea694dbc6338d8798 Mon Sep 17 00:00:00 2001 From: ramindani Date: Sat, 25 Mar 2023 06:03:29 -0700 Subject: [PATCH 886/998] VTS add length is not zero check for executeSetClientTarget Test: atest VtsHalGraphicsComposerV2_1TargetTest BUG: 252764410 Change-Id: Icd15f6e7bfdd7b3e3d0d4b407195258d4171c560 --- .../utils/hal/include/composer-hal/2.1/ComposerCommandEngine.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerCommandEngine.h b/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerCommandEngine.h index ab67eb10bc..9ae6173a91 100644 --- a/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerCommandEngine.h +++ b/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerCommandEngine.h @@ -207,7 +207,7 @@ class ComposerCommandEngine : protected CommandReaderBase { bool executeSetClientTarget(uint16_t length) { // 4 parameters followed by N rectangles - if ((length - 4) % 4 != 0) { + if (!length || (length - 4) % 4 != 0) { return false; } From 2f83e56e61cc7d2eb59b414df48e67b58e4fc245 Mon Sep 17 00:00:00 2001 From: ziyiw Date: Mon, 3 Apr 2023 20:31:44 +0000 Subject: [PATCH 887/998] Add min uwb initiation time as new vendor capability. Test: manual Bug: 245854896 Change-Id: I640b54356d4a7dc338d995596147aa6716278b54 --- .../uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl | 1 + .../uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl index 0cc01c59bd..25d704ecde 100644 --- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl +++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl @@ -44,6 +44,7 @@ enum UwbVendorCapabilityTlvTypes { CCC_SUPPORTED_PULSE_SHAPE_COMBOS = 166, CCC_SUPPORTED_RAN_MULTIPLIER = 167, CCC_SUPPORTED_MAX_RANGING_SESSION_NUMBER = 168, + CCC_SUPPORTED_MIN_UWB_INITIATION_TIME_MS = 169, SUPPORTED_AOA_RESULT_REQ_ANTENNA_INTERLEAVING = 227, SUPPORTED_MIN_RANGING_INTERVAL_MS = 228, SUPPORTED_RANGE_DATA_NTF_CONFIG = 229, diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl index 891b6f0853..22b7bfeedf 100644 --- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl +++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl @@ -144,6 +144,11 @@ enum UwbVendorCapabilityTlvTypes { */ CCC_SUPPORTED_MAX_RANGING_SESSION_NUMBER = 0xA8, + /** + * Int value to indicate the smallest supported CCC uwb initiation time in ms + */ + CCC_SUPPORTED_MIN_UWB_INITIATION_TIME_MS = 0xA9, + /********************************************* * FIRA specific ********************************************/ From df979bb50b25479fec5b32620d697ccd3022ed8a Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Mon, 3 Apr 2023 10:03:33 -0700 Subject: [PATCH 888/998] Document how HVAC_AUTO_ON can be indirectly disabled Bug: 259582041 Test: presubmit Change-Id: I05edfbc35dd3830696803e7e5010402330584867 --- .../hardware/automotive/vehicle/VehicleProperty.aidl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 8a3ab90241..19c3376692 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -873,7 +873,17 @@ enum VehicleProperty { HVAC_DUAL_ON = 0x0509 + 0x10000000 + 0x05000000 + 0x00200000, // VehiclePropertyGroup:SYSTEM,VehicleArea:SEAT,VehiclePropertyType:BOOLEAN /** - * On/off automatic mode + * On/off automatic climate control. + * + * If true, automatic climate control is on. If false, automatic climate control is off. + * + * If the vehicle does not support directly turning off automatic climate control, then OEMs + * should add logic in their VHAL implementation so that setting HVAC_AUTO_ON to false would + * change the necessary HVAC settings to indirectly turn off HVAC_AUTO_ON. Ideally, this should + * not be disruptive to the user, so OEMs should change back to the previous state any settings + * that were modified once automatic climate control is off. That way the only outcome should be + * that HVAC_AUTO_ON is off. If restoring the HVAC settings to its previous settings is not + * possible, then the OEM should choose the least disruptive change and implement that. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. From 0fe90d2119979b3028dbeb37cf489d3829614343 Mon Sep 17 00:00:00 2001 From: Changyeon Jo Date: Tue, 4 Apr 2023 14:21:14 -0700 Subject: [PATCH 889/998] Specify compatible versions of EVS HAL implementations Bug: 276467810 Test: m -j check-vintf-all Change-Id: I5e483dfe2f7dec170839cf33904836f146d8cb3c --- compatibility_matrices/compatibility_matrix.8.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/compatibility_matrices/compatibility_matrix.8.xml b/compatibility_matrices/compatibility_matrix.8.xml index 8ee86ccca7..875af95887 100644 --- a/compatibility_matrices/compatibility_matrix.8.xml +++ b/compatibility_matrices/compatibility_matrix.8.xml @@ -78,6 +78,7 @@ android.hardware.automotive.evs + 1-2 IEvsEnumerator [a-z]+/[0-9]+ From 64950a0cce85dfafef52f1702e0f68e5e0c79b24 Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Tue, 4 Apr 2023 21:25:22 +0000 Subject: [PATCH 890/998] Allow android.hardware.tv.tuner V2 to be used Add V2 to the Android 14 framework compatibility matrix. Also update the tuner-default device manifest fragment to reflect the version of android.hardware.tv.tuner that it serves. Test: lunch aosp_cf_x86_64_tv-userdebug && atest hal_implementation_test Bug: 266868403 Change-Id: I14264dc156d086bc2e25ff41cb71aef37f629e95 --- compatibility_matrices/compatibility_matrix.8.xml | 2 +- tv/tuner/aidl/default/tuner-default.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/compatibility_matrices/compatibility_matrix.8.xml b/compatibility_matrices/compatibility_matrix.8.xml index 310eaa153a..3940a0ff63 100644 --- a/compatibility_matrices/compatibility_matrix.8.xml +++ b/compatibility_matrices/compatibility_matrix.8.xml @@ -623,7 +623,7 @@ android.hardware.tv.tuner - 1 + 1-2 ITuner default diff --git a/tv/tuner/aidl/default/tuner-default.xml b/tv/tuner/aidl/default/tuner-default.xml index f0d03adcea..bff8ff01ed 100644 --- a/tv/tuner/aidl/default/tuner-default.xml +++ b/tv/tuner/aidl/default/tuner-default.xml @@ -2,5 +2,6 @@ android.hardware.tv.tuner ITuner/default + 2 From 7d601ebfb6ec18726abef923b27310669768a18d Mon Sep 17 00:00:00 2001 From: Austin Borger Date: Mon, 3 Apr 2023 11:07:24 -0700 Subject: [PATCH 891/998] Camera: Update documentation for dataSpace/colorSpace in Stream.aidl. Bug: 271350569 Test: N/A Change-Id: I3f853cece53d102c231a8de1cfcab5ed1fdb0dc0 --- .../android/hardware/camera/device/Stream.aidl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/camera/device/aidl/android/hardware/camera/device/Stream.aidl b/camera/device/aidl/android/hardware/camera/device/Stream.aidl index 457b1bc768..0a657d70d7 100644 --- a/camera/device/aidl/android/hardware/camera/device/Stream.aidl +++ b/camera/device/aidl/android/hardware/camera/device/Stream.aidl @@ -107,9 +107,10 @@ parcelable Stream { * supported. The dataspace values are set using the V0 dataspace * definitions. * - * The color space implied by dataSpace should be overridden by colorSpace if - * the device supports the REQUEST_AVAILABLE_CAPABILITIES_COLOR_SPACE_PROFILES - * capability. + * The standard bits of this field will match the requested colorSpace (if set) for + * non-BLOB formats. For BLOB formats, if colorSpace is not + * ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED, colorSpace takes + * over as the authority for the color space of the stream regardless of dataSpace. */ android.hardware.graphics.common.Dataspace dataSpace; @@ -234,11 +235,11 @@ parcelable Stream { * ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED, and the color space * implied by dataSpace should be used instead. * - * When specified, this field is the ultimate authority over the color space of the stream, - * regardless of dataSpace. The purpose of this field is to support specifying wide gamut - * color spaces for dataSpace values such as JFIF and HEIF. + * When specified, this field and the standard bits of dataSpace will match for non-BLOB + * formats. For BLOB formats, the dataSpace will remain unchanged. In this case, this field is + * the ultimate authority over the color space of the stream. * - * Possible values are the ordinals of the ColorSpace.Named enum in the public-facing API. + * See ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP for possible values. */ int colorSpace; } From 7b65166e336e7832a80a32e96d4a205fa47011d8 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Thu, 6 Apr 2023 21:01:59 +0000 Subject: [PATCH 892/998] Remove HIDL implementation for the WiFi Vendor HAL. Bug: 274964641 Test: Treehugger builds. Change-Id: I0198870790077f1ca03c663d58aac53eb4a64b83 --- wifi/1.6/default/Android.bp | 242 -- wifi/1.6/default/THREADING.README | 35 - .../android.hardware.wifi@1.0-service-lazy.rc | 14 - .../android.hardware.wifi@1.0-service.rc | 12 - .../android.hardware.wifi@1.0-service.xml | 11 - .../default/hal_legacy/AudioHardwareBase.h | 66 - .../hal_legacy/AudioHardwareInterface.h | 296 -- .../default/hal_legacy/AudioPolicyInterface.h | 249 -- .../hal_legacy/AudioPolicyManagerBase.h | 567 ---- .../default/hal_legacy/AudioSystemLegacy.h | 358 -- wifi/1.6/default/hal_legacy/IMountService.h | 65 - .../default/hal_legacy/audio_policy_conf.h | 54 - wifi/1.6/default/hal_legacy/gscan.h | 427 --- .../1.6/default/hal_legacy/link_layer_stats.h | 285 -- wifi/1.6/default/hal_legacy/power.h | 40 - wifi/1.6/default/hal_legacy/roam.h | 57 - wifi/1.6/default/hal_legacy/rtt.h | 314 -- wifi/1.6/default/hal_legacy/tdls.h | 84 - wifi/1.6/default/hal_legacy/uevent.h | 35 - .../hal_legacy/wifi_cached_scan_results.h | 92 - wifi/1.6/default/hal_legacy/wifi_config.h | 44 - wifi/1.6/default/hal_legacy/wifi_hal.h | 1020 ------ wifi/1.6/default/hal_legacy/wifi_logger.h | 650 ---- wifi/1.6/default/hal_legacy/wifi_nan.h | 2726 --------------- wifi/1.6/default/hal_legacy/wifi_offload.h | 30 - wifi/1.6/default/hal_legacy/wifi_twt.h | 156 - wifi/1.6/default/hidl_callback_util.h | 122 - wifi/1.6/default/hidl_return_util.h | 118 - wifi/1.6/default/hidl_struct_util.cpp | 3007 ----------------- wifi/1.6/default/hidl_struct_util.h | 204 -- wifi/1.6/default/hidl_sync_util.cpp | 39 - wifi/1.6/default/hidl_sync_util.h | 37 - wifi/1.6/default/ringbuffer.cpp | 64 - wifi/1.6/default/ringbuffer.h | 62 - wifi/1.6/default/service.cpp | 71 - .../tests/hidl_struct_util_unit_tests.cpp | 486 --- wifi/1.6/default/tests/main.cpp | 28 - .../1.6/default/tests/mock_interface_tool.cpp | 29 - wifi/1.6/default/tests/mock_interface_tool.h | 42 - .../default/tests/mock_wifi_feature_flags.cpp | 35 - .../default/tests/mock_wifi_feature_flags.h | 47 - .../default/tests/mock_wifi_iface_util.cpp | 39 - wifi/1.6/default/tests/mock_wifi_iface_util.h | 50 - .../default/tests/mock_wifi_legacy_hal.cpp | 39 - wifi/1.6/default/tests/mock_wifi_legacy_hal.h | 71 - .../tests/mock_wifi_mode_controller.cpp | 37 - .../default/tests/mock_wifi_mode_controller.h | 46 - .../default/tests/ringbuffer_unit_tests.cpp | 97 - wifi/1.6/default/tests/runtests.sh | 26 - .../default/tests/wifi_chip_unit_tests.cpp | 864 ----- .../tests/wifi_iface_util_unit_tests.cpp | 96 - .../tests/wifi_nan_iface_unit_tests.cpp | 138 - wifi/1.6/default/wifi.cpp | 294 -- wifi/1.6/default/wifi.h | 105 - wifi/1.6/default/wifi_ap_iface.cpp | 204 -- wifi/1.6/default/wifi_ap_iface.h | 89 - wifi/1.6/default/wifi_chip.cpp | 2062 ----------- wifi/1.6/default/wifi_chip.h | 317 -- wifi/1.6/default/wifi_feature_flags.cpp | 247 -- wifi/1.6/default/wifi_feature_flags.h | 58 - wifi/1.6/default/wifi_iface_util.cpp | 176 - wifi/1.6/default/wifi_iface_util.h | 87 - wifi/1.6/default/wifi_legacy_hal.cpp | 1654 --------- wifi/1.6/default/wifi_legacy_hal.h | 739 ---- wifi/1.6/default/wifi_legacy_hal_factory.cpp | 254 -- wifi/1.6/default/wifi_legacy_hal_factory.h | 66 - wifi/1.6/default/wifi_legacy_hal_stubs.cpp | 178 - wifi/1.6/default/wifi_legacy_hal_stubs.h | 37 - wifi/1.6/default/wifi_mode_controller.cpp | 89 - wifi/1.6/default/wifi_mode_controller.h | 63 - wifi/1.6/default/wifi_nan_iface.cpp | 1018 ------ wifi/1.6/default/wifi_nan_iface.h | 208 -- wifi/1.6/default/wifi_p2p_iface.cpp | 69 - wifi/1.6/default/wifi_p2p_iface.h | 66 - wifi/1.6/default/wifi_rtt_controller.cpp | 377 --- wifi/1.6/default/wifi_rtt_controller.h | 138 - wifi/1.6/default/wifi_sta_iface.cpp | 592 ---- wifi/1.6/default/wifi_sta_iface.h | 157 - wifi/1.6/default/wifi_status_util.cpp | 106 - wifi/1.6/default/wifi_status_util.h | 44 - 80 files changed, 23317 deletions(-) delete mode 100644 wifi/1.6/default/Android.bp delete mode 100644 wifi/1.6/default/THREADING.README delete mode 100644 wifi/1.6/default/android.hardware.wifi@1.0-service-lazy.rc delete mode 100644 wifi/1.6/default/android.hardware.wifi@1.0-service.rc delete mode 100644 wifi/1.6/default/android.hardware.wifi@1.0-service.xml delete mode 100644 wifi/1.6/default/hal_legacy/AudioHardwareBase.h delete mode 100644 wifi/1.6/default/hal_legacy/AudioHardwareInterface.h delete mode 100644 wifi/1.6/default/hal_legacy/AudioPolicyInterface.h delete mode 100644 wifi/1.6/default/hal_legacy/AudioPolicyManagerBase.h delete mode 100644 wifi/1.6/default/hal_legacy/AudioSystemLegacy.h delete mode 100644 wifi/1.6/default/hal_legacy/IMountService.h delete mode 100644 wifi/1.6/default/hal_legacy/audio_policy_conf.h delete mode 100644 wifi/1.6/default/hal_legacy/gscan.h delete mode 100644 wifi/1.6/default/hal_legacy/link_layer_stats.h delete mode 100644 wifi/1.6/default/hal_legacy/power.h delete mode 100644 wifi/1.6/default/hal_legacy/roam.h delete mode 100644 wifi/1.6/default/hal_legacy/rtt.h delete mode 100644 wifi/1.6/default/hal_legacy/tdls.h delete mode 100644 wifi/1.6/default/hal_legacy/uevent.h delete mode 100644 wifi/1.6/default/hal_legacy/wifi_cached_scan_results.h delete mode 100644 wifi/1.6/default/hal_legacy/wifi_config.h delete mode 100644 wifi/1.6/default/hal_legacy/wifi_hal.h delete mode 100644 wifi/1.6/default/hal_legacy/wifi_logger.h delete mode 100644 wifi/1.6/default/hal_legacy/wifi_nan.h delete mode 100644 wifi/1.6/default/hal_legacy/wifi_offload.h delete mode 100644 wifi/1.6/default/hal_legacy/wifi_twt.h delete mode 100644 wifi/1.6/default/hidl_callback_util.h delete mode 100644 wifi/1.6/default/hidl_return_util.h delete mode 100644 wifi/1.6/default/hidl_struct_util.cpp delete mode 100644 wifi/1.6/default/hidl_struct_util.h delete mode 100644 wifi/1.6/default/hidl_sync_util.cpp delete mode 100644 wifi/1.6/default/hidl_sync_util.h delete mode 100644 wifi/1.6/default/ringbuffer.cpp delete mode 100644 wifi/1.6/default/ringbuffer.h delete mode 100644 wifi/1.6/default/service.cpp delete mode 100644 wifi/1.6/default/tests/hidl_struct_util_unit_tests.cpp delete mode 100644 wifi/1.6/default/tests/main.cpp delete mode 100644 wifi/1.6/default/tests/mock_interface_tool.cpp delete mode 100644 wifi/1.6/default/tests/mock_interface_tool.h delete mode 100644 wifi/1.6/default/tests/mock_wifi_feature_flags.cpp delete mode 100644 wifi/1.6/default/tests/mock_wifi_feature_flags.h delete mode 100644 wifi/1.6/default/tests/mock_wifi_iface_util.cpp delete mode 100644 wifi/1.6/default/tests/mock_wifi_iface_util.h delete mode 100644 wifi/1.6/default/tests/mock_wifi_legacy_hal.cpp delete mode 100644 wifi/1.6/default/tests/mock_wifi_legacy_hal.h delete mode 100644 wifi/1.6/default/tests/mock_wifi_mode_controller.cpp delete mode 100644 wifi/1.6/default/tests/mock_wifi_mode_controller.h delete mode 100644 wifi/1.6/default/tests/ringbuffer_unit_tests.cpp delete mode 100755 wifi/1.6/default/tests/runtests.sh delete mode 100644 wifi/1.6/default/tests/wifi_chip_unit_tests.cpp delete mode 100644 wifi/1.6/default/tests/wifi_iface_util_unit_tests.cpp delete mode 100644 wifi/1.6/default/tests/wifi_nan_iface_unit_tests.cpp delete mode 100644 wifi/1.6/default/wifi.cpp delete mode 100644 wifi/1.6/default/wifi.h delete mode 100644 wifi/1.6/default/wifi_ap_iface.cpp delete mode 100644 wifi/1.6/default/wifi_ap_iface.h delete mode 100644 wifi/1.6/default/wifi_chip.cpp delete mode 100644 wifi/1.6/default/wifi_chip.h delete mode 100644 wifi/1.6/default/wifi_feature_flags.cpp delete mode 100644 wifi/1.6/default/wifi_feature_flags.h delete mode 100644 wifi/1.6/default/wifi_iface_util.cpp delete mode 100644 wifi/1.6/default/wifi_iface_util.h delete mode 100644 wifi/1.6/default/wifi_legacy_hal.cpp delete mode 100644 wifi/1.6/default/wifi_legacy_hal.h delete mode 100644 wifi/1.6/default/wifi_legacy_hal_factory.cpp delete mode 100644 wifi/1.6/default/wifi_legacy_hal_factory.h delete mode 100644 wifi/1.6/default/wifi_legacy_hal_stubs.cpp delete mode 100644 wifi/1.6/default/wifi_legacy_hal_stubs.h delete mode 100644 wifi/1.6/default/wifi_mode_controller.cpp delete mode 100644 wifi/1.6/default/wifi_mode_controller.h delete mode 100644 wifi/1.6/default/wifi_nan_iface.cpp delete mode 100644 wifi/1.6/default/wifi_nan_iface.h delete mode 100644 wifi/1.6/default/wifi_p2p_iface.cpp delete mode 100644 wifi/1.6/default/wifi_p2p_iface.h delete mode 100644 wifi/1.6/default/wifi_rtt_controller.cpp delete mode 100644 wifi/1.6/default/wifi_rtt_controller.h delete mode 100644 wifi/1.6/default/wifi_sta_iface.cpp delete mode 100644 wifi/1.6/default/wifi_sta_iface.h delete mode 100644 wifi/1.6/default/wifi_status_util.cpp delete mode 100644 wifi/1.6/default/wifi_status_util.h diff --git a/wifi/1.6/default/Android.bp b/wifi/1.6/default/Android.bp deleted file mode 100644 index 6038e367a4..0000000000 --- a/wifi/1.6/default/Android.bp +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright (C) 2021 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 { - default_applicable_licenses: ["hardware_interfaces_license"], -} - -soong_config_module_type { - name: "wifi_hal_cc_defaults", - module_type: "cc_defaults", - config_namespace: "wifi", - bool_variables: [ - "hidl_feature_aware", // WIFI_HIDL_FEATURE_AWARE - "hidl_feature_dual_interface", // WIFI_HIDL_FEATURE_DUAL_INTERFACE - "hidl_feature_disable_ap", // WIFI_HIDL_FEATURE_DISABLE_AP - "hidl_feature_disable_ap_mac_randomization", // WIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION - "avoid_iface_reset_mac_change", // WIFI_AVOID_IFACE_RESET_MAC_CHANGE - "wifi_skip_state_toggle_off_on_for_nan", // WIFI_SKIP_STATE_TOGGLE_OFF_ON_FOR_NAN - ], - value_variables: [ - "hal_interface_combinations", // WIFI_HAL_INTERFACE_COMBINATIONS - ], - properties: [ - "cppflags", - ], -} - -wifi_hal_cc_defaults { - name: "android.hardware.wifi@1.0-service-cppflags-defaults", - soong_config_variables: { - hidl_feature_aware: { - cppflags: ["-DWIFI_HIDL_FEATURE_AWARE"], - }, - hidl_feature_dual_interface: { - cppflags: ["-DWIFI_HIDL_FEATURE_DUAL_INTERFACE"], - }, - hidl_feature_disable_ap: { - cppflags: ["-DWIFI_HIDL_FEATURE_DISABLE_AP"], - }, - hidl_feature_disable_ap_mac_randomization: { - cppflags: ["-DWIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION"], - }, - avoid_iface_reset_mac_change: { - cppflags: ["-DWIFI_AVOID_IFACE_RESET_MAC_CHANGE"], - }, - wifi_skip_state_toggle_off_on_for_nan: { - cppflags: ["-DWIFI_SKIP_STATE_TOGGLE_OFF_ON_FOR_NAN"], - }, - hal_interface_combinations: { - cppflags: ["-DWIFI_HAL_INTERFACE_COMBINATIONS=%s"], - }, - }, -} - -cc_library_static { - name: "android.hardware.wifi@1.0-service-lib", - defaults: ["android.hardware.wifi@1.0-service-cppflags-defaults"], - proprietary: true, - compile_multilib: "first", - cppflags: [ - "-Wall", - "-Werror", - "-Wextra", - ], - // Allow implicit fallthroughs in wifi_legacy_hal.cpp until they are fixed. - cflags: ["-Wno-error=implicit-fallthrough"], - srcs: [ - "hidl_struct_util.cpp", - "hidl_sync_util.cpp", - "ringbuffer.cpp", - "wifi.cpp", - "wifi_ap_iface.cpp", - "wifi_chip.cpp", - "wifi_feature_flags.cpp", - "wifi_iface_util.cpp", - "wifi_legacy_hal.cpp", - "wifi_legacy_hal_factory.cpp", - "wifi_legacy_hal_stubs.cpp", - "wifi_mode_controller.cpp", - "wifi_nan_iface.cpp", - "wifi_p2p_iface.cpp", - "wifi_rtt_controller.cpp", - "wifi_sta_iface.cpp", - "wifi_status_util.cpp", - ], - - shared_libs: [ - "libbase", - "libcutils", - "libhidlbase", - "liblog", - "libnl", - "libutils", - "libwifi-hal", - "libwifi-system-iface", - "libxml2", - "android.hardware.wifi@1.0", - "android.hardware.wifi@1.1", - "android.hardware.wifi@1.2", - "android.hardware.wifi@1.3", - "android.hardware.wifi@1.4", - "android.hardware.wifi@1.5", - "android.hardware.wifi@1.6", - ], - - export_include_dirs: ["."], -} - -cc_binary { - name: "android.hardware.wifi@1.0-service", - vintf_fragments: ["android.hardware.wifi@1.0-service.xml"], - relative_install_path: "hw", - proprietary: true, - cppflags: [ - "-Wall", - "-Werror", - "-Wextra", - ], - srcs: ["service.cpp"], - shared_libs: [ - "libbase", - "libcutils", - "libhidlbase", - "liblog", - "libnl", - "libutils", - "libwifi-hal", - "libwifi-system-iface", - "libxml2", - "android.hardware.wifi@1.0", - "android.hardware.wifi@1.1", - "android.hardware.wifi@1.2", - "android.hardware.wifi@1.3", - "android.hardware.wifi@1.4", - "android.hardware.wifi@1.5", - "android.hardware.wifi@1.6", - ], - static_libs: ["android.hardware.wifi@1.0-service-lib"], - init_rc: ["android.hardware.wifi@1.0-service.rc"], -} - -cc_binary { - name: "android.hardware.wifi@1.0-service-lazy", - vintf_fragments: ["android.hardware.wifi@1.0-service.xml"], - overrides: ["android.hardware.wifi@1.0-service"], - cflags: ["-DLAZY_SERVICE"], - relative_install_path: "hw", - proprietary: true, - cppflags: [ - "-Wall", - "-Werror", - "-Wextra", - ], - srcs: ["service.cpp"], - shared_libs: [ - "libbase", - "libcutils", - "libhidlbase", - "liblog", - "libnl", - "libutils", - "libwifi-hal", - "libwifi-system-iface", - "libxml2", - "android.hardware.wifi@1.0", - "android.hardware.wifi@1.1", - "android.hardware.wifi@1.2", - "android.hardware.wifi@1.3", - "android.hardware.wifi@1.4", - "android.hardware.wifi@1.5", - "android.hardware.wifi@1.6", - ], - static_libs: ["android.hardware.wifi@1.0-service-lib"], - init_rc: ["android.hardware.wifi@1.0-service-lazy.rc"], -} - -cc_test { - name: "android.hardware.wifi@1.0-service-tests", - proprietary: true, - compile_multilib: "first", - cppflags: [ - "-Wall", - "-Werror", - "-Wextra", - ], - srcs: [ - "tests/hidl_struct_util_unit_tests.cpp", - "tests/main.cpp", - "tests/mock_interface_tool.cpp", - "tests/mock_wifi_feature_flags.cpp", - "tests/mock_wifi_iface_util.cpp", - "tests/mock_wifi_legacy_hal.cpp", - "tests/mock_wifi_mode_controller.cpp", - "tests/ringbuffer_unit_tests.cpp", - "tests/wifi_nan_iface_unit_tests.cpp", - "tests/wifi_chip_unit_tests.cpp", - "tests/wifi_iface_util_unit_tests.cpp", - ], - static_libs: [ - "libgmock", - "libgtest", - "android.hardware.wifi@1.0", - "android.hardware.wifi@1.1", - "android.hardware.wifi@1.2", - "android.hardware.wifi@1.3", - "android.hardware.wifi@1.4", - "android.hardware.wifi@1.5", - "android.hardware.wifi@1.6", - "android.hardware.wifi@1.0-service-lib", - ], - shared_libs: [ - "libbase", - "libcutils", - "libhidlbase", - "liblog", - "libnl", - "libutils", - "libwifi-hal", - "libwifi-system-iface", - ], -} - -filegroup { - name: "default-android.hardware.wifi@1.0-service.rc", - srcs: ["android.hardware.wifi@1.0-service.rc"], -} - -filegroup { - name: "default-android.hardware.wifi@1.0-service.xml", - srcs: ["android.hardware.wifi@1.0-service.xml"], -} diff --git a/wifi/1.6/default/THREADING.README b/wifi/1.6/default/THREADING.README deleted file mode 100644 index 8366ca0201..0000000000 --- a/wifi/1.6/default/THREADING.README +++ /dev/null @@ -1,35 +0,0 @@ -Vendor HAL Threading Model -========================== -The vendor HAL service has two threads: -1. HIDL thread: This is the main thread which processes all the incoming HIDL -RPC's. -2. Legacy HAL event loop thread: This is the thread forked off for processing -the legacy HAL event loop (wifi_event_loop()). This thread is used to process -any asynchronous netlink events posted by the driver. Any asynchronous -callbacks passed to the legacy HAL API's are invoked on this thread. - -Synchronization Concerns -======================== -wifi_legacy_hal.cpp has a bunch of global "C" style functions to handle the -legacy callbacks. Each of these "C" style function invokes a corresponding -"std::function" version of the callback which does the actual processing. -The variables holding these "std::function" callbacks are reset from the HIDL -thread when they are no longer used. For example: stopGscan() will reset the -corresponding "on_gscan_*" callback variables which were set when startGscan() -was invoked. This is not thread safe since these callback variables are -accesed from the legacy hal event loop thread as well. - -Synchronization Solution -======================== -Adding a global lock seems to be the most trivial solution to the problem. -a) All of the asynchronous "C" style callbacks will acquire the global lock -before invoking the corresponding "std::function" callback variables. -b) All of the HIDL methods will also acquire the global lock before processing -(in hidl_return_util::validateAndCall()). - -Note: It's important that we only acquire the global lock for asynchronous -callbacks, because there is no guarantee (or documentation to clarify) that the -synchronous callbacks are invoked on the same invocation thread. If that is not -the case in some implementation, we will end up deadlocking the system since the -HIDL thread would have acquired the global lock which is needed by the -synchronous callback executed on the legacy hal event loop thread. diff --git a/wifi/1.6/default/android.hardware.wifi@1.0-service-lazy.rc b/wifi/1.6/default/android.hardware.wifi@1.0-service-lazy.rc deleted file mode 100644 index ee8c818d90..0000000000 --- a/wifi/1.6/default/android.hardware.wifi@1.0-service-lazy.rc +++ /dev/null @@ -1,14 +0,0 @@ -service vendor.wifi_hal_legacy /vendor/bin/hw/android.hardware.wifi@1.0-service-lazy - interface android.hardware.wifi@1.0::IWifi default - interface android.hardware.wifi@1.1::IWifi default - interface android.hardware.wifi@1.2::IWifi default - interface android.hardware.wifi@1.3::IWifi default - interface android.hardware.wifi@1.4::IWifi default - interface android.hardware.wifi@1.5::IWifi default - interface android.hardware.wifi@1.6::IWifi default - oneshot - disabled - class hal - capabilities NET_ADMIN NET_RAW SYS_MODULE - user wifi - group wifi gps diff --git a/wifi/1.6/default/android.hardware.wifi@1.0-service.rc b/wifi/1.6/default/android.hardware.wifi@1.0-service.rc deleted file mode 100644 index 18f40d0bb5..0000000000 --- a/wifi/1.6/default/android.hardware.wifi@1.0-service.rc +++ /dev/null @@ -1,12 +0,0 @@ -service vendor.wifi_hal_legacy /vendor/bin/hw/android.hardware.wifi@1.0-service - interface android.hardware.wifi@1.0::IWifi default - interface android.hardware.wifi@1.1::IWifi default - interface android.hardware.wifi@1.2::IWifi default - interface android.hardware.wifi@1.3::IWifi default - interface android.hardware.wifi@1.4::IWifi default - interface android.hardware.wifi@1.5::IWifi default - interface android.hardware.wifi@1.6::IWifi default - class hal - capabilities NET_ADMIN NET_RAW SYS_MODULE - user wifi - group wifi gps diff --git a/wifi/1.6/default/android.hardware.wifi@1.0-service.xml b/wifi/1.6/default/android.hardware.wifi@1.0-service.xml deleted file mode 100644 index 771fbaaf42..0000000000 --- a/wifi/1.6/default/android.hardware.wifi@1.0-service.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - android.hardware.wifi - hwbinder - 1.6 - - IWifi - default - - - diff --git a/wifi/1.6/default/hal_legacy/AudioHardwareBase.h b/wifi/1.6/default/hal_legacy/AudioHardwareBase.h deleted file mode 100644 index eb61472523..0000000000 --- a/wifi/1.6/default/hal_legacy/AudioHardwareBase.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -#ifndef ANDROID_AUDIO_HARDWARE_BASE_H -#define ANDROID_AUDIO_HARDWARE_BASE_H - -#include - -#include - -namespace android_audio_legacy { - -// ---------------------------------------------------------------------------- - -/** - * AudioHardwareBase is a convenient base class used for implementing the - * AudioHardwareInterface interface. - */ -class AudioHardwareBase : public AudioHardwareInterface { - public: - AudioHardwareBase(); - virtual ~AudioHardwareBase() {} - - /** - * setMode is called when the audio mode changes. NORMAL mode is for - * standard audio playback, RINGTONE when a ringtone is playing, IN_CALL - * when a telephony call is in progress, IN_COMMUNICATION when a VoIP call is in progress. - */ - virtual status_t setMode(int mode); - - virtual status_t setParameters(const String8& keyValuePairs); - virtual String8 getParameters(const String8& keys); - - virtual size_t getInputBufferSize(uint32_t sampleRate, int format, int channelCount); - virtual status_t getMasterVolume(float* volume); - - /**This method dumps the state of the audio hardware */ - virtual status_t dumpState(int fd, const Vector& args); - - protected: - /** returns true if the given mode maps to a telephony or VoIP call is in progress */ - virtual bool isModeInCall(int mode) { - return ((mode == AudioSystem::MODE_IN_CALL) || - (mode == AudioSystem::MODE_IN_COMMUNICATION)); - }; - /** returns true if a telephony or VoIP call is in progress */ - virtual bool isInCall() { return isModeInCall(mMode); }; - int mMode; -}; - -}; // namespace android_audio_legacy - -#endif // ANDROID_AUDIO_HARDWARE_BASE_H diff --git a/wifi/1.6/default/hal_legacy/AudioHardwareInterface.h b/wifi/1.6/default/hal_legacy/AudioHardwareInterface.h deleted file mode 100644 index 7befb799af..0000000000 --- a/wifi/1.6/default/hal_legacy/AudioHardwareInterface.h +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -#ifndef ANDROID_AUDIO_HARDWARE_INTERFACE_H -#define ANDROID_AUDIO_HARDWARE_INTERFACE_H - -#include -#include - -#include -#include -#include -#include - -#include - -#include -#include - -#include - -namespace android_audio_legacy { -using android::String16; -using android::String8; -using android::Vector; - -// ---------------------------------------------------------------------------- - -/** - * AudioStreamOut is the abstraction interface for the audio output hardware. - * - * It provides information about various properties of the audio output hardware driver. - */ -class AudioStreamOut { - public: - virtual ~AudioStreamOut() = 0; - - /** return audio sampling rate in hz - eg. 44100 */ - virtual uint32_t sampleRate() const = 0; - - /** returns size of output buffer - eg. 4800 */ - virtual size_t bufferSize() const = 0; - - /** - * returns the output channel mask - */ - virtual uint32_t channels() const = 0; - - /** - * return audio format in 8bit or 16bit PCM format - - * eg. AudioSystem:PCM_16_BIT - */ - virtual int format() const = 0; - - /** - * return the frame size (number of bytes per sample). - */ - uint32_t frameSize() const { - return audio_channel_count_from_out_mask(channels()) * - ((format() == AUDIO_FORMAT_PCM_16_BIT) ? sizeof(int16_t) : sizeof(int8_t)); - } - - /** - * return the audio hardware driver latency in milli seconds. - */ - virtual uint32_t latency() const = 0; - - /** - * Use this method in situations where audio mixing is done in the - * hardware. This method serves as a direct interface with hardware, - * allowing you to directly set the volume as apposed to via the framework. - * This method might produce multiple PCM outputs or hardware accelerated - * codecs, such as MP3 or AAC. - */ - virtual status_t setVolume(float left, float right) = 0; - - /** write audio buffer to driver. Returns number of bytes written */ - virtual ssize_t write(const void* buffer, size_t bytes) = 0; - - /** - * Put the audio hardware output into standby mode. Returns - * status based on include/utils/Errors.h - */ - virtual status_t standby() = 0; - - /** dump the state of the audio output device */ - virtual status_t dump(int fd, const Vector& args) = 0; - - // set/get audio output parameters. The function accepts a list of parameters - // key value pairs in the form: key1=value1;key2=value2;... - // Some keys are reserved for standard parameters (See AudioParameter class). - // If the implementation does not accept a parameter change while the output is - // active but the parameter is acceptable otherwise, it must return INVALID_OPERATION. - // The audio flinger will put the output in standby and then change the parameter value. - virtual status_t setParameters(const String8& keyValuePairs) = 0; - virtual String8 getParameters(const String8& keys) = 0; - - // return the number of audio frames written by the audio dsp to DAC since - // the output has exited standby - virtual status_t getRenderPosition(uint32_t* dspFrames) = 0; - - /** - * get the local time at which the next write to the audio driver will be - * presented - */ - virtual status_t getNextWriteTimestamp(int64_t* timestamp); - - /** - * Return a recent count of the number of audio frames presented to an external observer. - */ - virtual status_t getPresentationPosition(uint64_t* frames, struct timespec* timestamp); -}; - -/** - * AudioStreamIn is the abstraction interface for the audio input hardware. - * - * It defines the various properties of the audio hardware input driver. - */ -class AudioStreamIn { - public: - virtual ~AudioStreamIn() = 0; - - /** return audio sampling rate in hz - eg. 44100 */ - virtual uint32_t sampleRate() const = 0; - - /** return the input buffer size allowed by audio driver */ - virtual size_t bufferSize() const = 0; - - /** return input channel mask */ - virtual uint32_t channels() const = 0; - - /** - * return audio format in 8bit or 16bit PCM format - - * eg. AudioSystem:PCM_16_BIT - */ - virtual int format() const = 0; - - /** - * return the frame size (number of bytes per sample). - */ - uint32_t frameSize() const { - return audio_channel_count_from_in_mask(channels()) * - ((format() == AudioSystem::PCM_16_BIT) ? sizeof(int16_t) : sizeof(int8_t)); - } - - /** set the input gain for the audio driver. This method is for - * for future use */ - virtual status_t setGain(float gain) = 0; - - /** read audio buffer in from audio driver */ - virtual ssize_t read(void* buffer, ssize_t bytes) = 0; - - /** dump the state of the audio input device */ - virtual status_t dump(int fd, const Vector& args) = 0; - - /** - * Put the audio hardware input into standby mode. Returns - * status based on include/utils/Errors.h - */ - virtual status_t standby() = 0; - - // set/get audio input parameters. The function accepts a list of parameters - // key value pairs in the form: key1=value1;key2=value2;... - // Some keys are reserved for standard parameters (See AudioParameter class). - // If the implementation does not accept a parameter change while the output is - // active but the parameter is acceptable otherwise, it must return INVALID_OPERATION. - // The audio flinger will put the input in standby and then change the parameter value. - virtual status_t setParameters(const String8& keyValuePairs) = 0; - virtual String8 getParameters(const String8& keys) = 0; - - // Return the number of input frames lost in the audio driver since the last call of this - // function. Audio driver is expected to reset the value to 0 and restart counting upon - // returning the current value by this function call. Such loss typically occurs when the user - // space process is blocked longer than the capacity of audio driver buffers. Unit: the number - // of input audio frames - virtual unsigned int getInputFramesLost() const = 0; - - virtual status_t addAudioEffect(effect_handle_t effect) = 0; - virtual status_t removeAudioEffect(effect_handle_t effect) = 0; -}; - -/** - * AudioHardwareInterface.h defines the interface to the audio hardware abstraction layer. - * - * The interface supports setting and getting parameters, selecting audio routing - * paths, and defining input and output streams. - * - * AudioFlinger initializes the audio hardware and immediately opens an output stream. - * You can set Audio routing to output to handset, speaker, Bluetooth, or a headset. - * - * The audio input stream is initialized when AudioFlinger is called to carry out - * a record operation. - */ -class AudioHardwareInterface { - public: - virtual ~AudioHardwareInterface() {} - - /** - * check to see if the audio hardware interface has been initialized. - * return status based on values defined in include/utils/Errors.h - */ - virtual status_t initCheck() = 0; - - /** set the audio volume of a voice call. Range is between 0.0 and 1.0 */ - virtual status_t setVoiceVolume(float volume) = 0; - - /** - * set the audio volume for all audio activities other than voice call. - * Range between 0.0 and 1.0. If any value other than NO_ERROR is returned, - * the software mixer will emulate this capability. - */ - virtual status_t setMasterVolume(float volume) = 0; - - /** - * Get the current master volume value for the HAL, if the HAL supports - * master volume control. AudioFlinger will query this value from the - * primary audio HAL when the service starts and use the value for setting - * the initial master volume across all HALs. - */ - virtual status_t getMasterVolume(float* volume) = 0; - - /** - * setMode is called when the audio mode changes. NORMAL mode is for - * standard audio playback, RINGTONE when a ringtone is playing, and IN_CALL - * when a call is in progress. - */ - virtual status_t setMode(int mode) = 0; - - // mic mute - virtual status_t setMicMute(bool state) = 0; - virtual status_t getMicMute(bool* state) = 0; - - // set/get global audio parameters - virtual status_t setParameters(const String8& keyValuePairs) = 0; - virtual String8 getParameters(const String8& keys) = 0; - - // Returns audio input buffer size according to parameters passed or 0 if one of the - // parameters is not supported - virtual size_t getInputBufferSize(uint32_t sampleRate, int format, int channelCount) = 0; - - /** This method creates and opens the audio hardware output stream */ - virtual AudioStreamOut* openOutputStream(uint32_t devices, int* format = 0, - uint32_t* channels = 0, uint32_t* sampleRate = 0, - status_t* status = 0) = 0; - virtual AudioStreamOut* openOutputStreamWithFlags( - uint32_t devices, audio_output_flags_t flags = (audio_output_flags_t)0, int* format = 0, - uint32_t* channels = 0, uint32_t* sampleRate = 0, status_t* status = 0) = 0; - virtual void closeOutputStream(AudioStreamOut* out) = 0; - - /** This method creates and opens the audio hardware input stream */ - virtual AudioStreamIn* openInputStream(uint32_t devices, int* format, uint32_t* channels, - uint32_t* sampleRate, status_t* status, - AudioSystem::audio_in_acoustics acoustics) = 0; - virtual void closeInputStream(AudioStreamIn* in) = 0; - - /**This method dumps the state of the audio hardware */ - virtual status_t dumpState(int fd, const Vector& args) = 0; - - virtual status_t setMasterMute(bool muted) = 0; - - static AudioHardwareInterface* create(); - - virtual int createAudioPatch(unsigned int num_sources, const struct audio_port_config* sources, - unsigned int num_sinks, const struct audio_port_config* sinks, - audio_patch_handle_t* handle) = 0; - - virtual int releaseAudioPatch(audio_patch_handle_t handle) = 0; - - virtual int getAudioPort(struct audio_port* port) = 0; - - virtual int setAudioPortConfig(const struct audio_port_config* config) = 0; - - protected: - virtual status_t dump(int fd, const Vector& args) = 0; -}; - -// ---------------------------------------------------------------------------- - -extern "C" AudioHardwareInterface* createAudioHardware(void); - -}; // namespace android_audio_legacy - -#endif // ANDROID_AUDIO_HARDWARE_INTERFACE_H diff --git a/wifi/1.6/default/hal_legacy/AudioPolicyInterface.h b/wifi/1.6/default/hal_legacy/AudioPolicyInterface.h deleted file mode 100644 index ec9c432cdb..0000000000 --- a/wifi/1.6/default/hal_legacy/AudioPolicyInterface.h +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -#ifndef ANDROID_AUDIOPOLICYINTERFACE_H -#define ANDROID_AUDIOPOLICYINTERFACE_H - -#include -#include -#include - -#include -#include - -namespace android_audio_legacy { -using android::String8; -using android::ToneGenerator; -using android::Vector; - -// ---------------------------------------------------------------------------- - -// The AudioPolicyInterface and AudioPolicyClientInterface classes define the communication -// interfaces between the platform specific audio policy manager and Android generic audio policy -// manager. The platform specific audio policy manager must implement methods of the -// AudioPolicyInterface class. This implementation makes use of the AudioPolicyClientInterface to -// control the activity and configuration of audio input and output streams. -// -// The platform specific audio policy manager is in charge of the audio routing and volume control -// policies for a given platform. -// The main roles of this module are: -// - keep track of current system state (removable device connections, phone state, user -// requests...). System state changes and user actions are notified to audio policy manager with -// methods of the AudioPolicyInterface. -// - process getOutput() queries received when AudioTrack objects are created: Those queries -// return a handler on an output that has been selected, configured and opened by the audio policy -// manager and that must be used by the AudioTrack when registering to the AudioFlinger with the -// createTrack() method. When the AudioTrack object is released, a putOutput() query is received -// and the audio policy manager can decide to close or reconfigure the output depending on other -// streams using this output and current system state. -// - similarly process getInput() and putInput() queries received from AudioRecord objects and -// configure audio inputs. -// - process volume control requests: the stream volume is converted from an index value (received -// from UI) to a float value applicable to each output as a function of platform specific settings -// and current output route (destination device). It also make sure that streams are not muted if -// not allowed (e.g. camera shutter sound in some countries). -// -// The platform specific audio policy manager is provided as a shared library by platform vendors -// (as for libaudio.so) and is linked with libaudioflinger.so - -// Audio Policy Manager Interface -class AudioPolicyInterface { - public: - virtual ~AudioPolicyInterface() {} - // - // configuration functions - // - - // indicate a change in device connection status - virtual status_t setDeviceConnectionState(audio_devices_t device, - AudioSystem::device_connection_state state, - const char* device_address) = 0; - // retrieve a device connection status - virtual AudioSystem::device_connection_state getDeviceConnectionState( - audio_devices_t device, const char* device_address) = 0; - // indicate a change in phone state. Valid phones states are defined by AudioSystem::audio_mode - virtual void setPhoneState(int state) = 0; - // force using a specific device category for the specified usage - virtual void setForceUse(AudioSystem::force_use usage, AudioSystem::forced_config config) = 0; - // retrieve current device category forced for a given usage - virtual AudioSystem::forced_config getForceUse(AudioSystem::force_use usage) = 0; - // set a system property (e.g. camera sound always audible) - virtual void setSystemProperty(const char* property, const char* value) = 0; - // check proper initialization - virtual status_t initCheck() = 0; - - // - // Audio routing query functions - // - - // request an output appropriate for playback of the supplied stream type and parameters - virtual audio_io_handle_t getOutput(AudioSystem::stream_type stream, uint32_t samplingRate, - audio_format_t format, audio_channel_mask_t channelMask, - AudioSystem::output_flags flags, - const audio_offload_info_t* offloadInfo) = 0; - // indicates to the audio policy manager that the output starts being used by corresponding - // stream. - virtual status_t startOutput(audio_io_handle_t output, AudioSystem::stream_type stream, - audio_session_t session = AUDIO_SESSION_NONE) = 0; - // indicates to the audio policy manager that the output stops being used by corresponding - // stream. - virtual status_t stopOutput(audio_io_handle_t output, AudioSystem::stream_type stream, - audio_session_t session = AUDIO_SESSION_NONE) = 0; - // releases the output. - virtual void releaseOutput(audio_io_handle_t output) = 0; - - // request an input appropriate for record from the supplied device with supplied parameters. - virtual audio_io_handle_t getInput(int inputSource, uint32_t samplingRate, - audio_format_t format, audio_channel_mask_t channelMask, - AudioSystem::audio_in_acoustics acoustics) = 0; - // indicates to the audio policy manager that the input starts being used. - virtual status_t startInput(audio_io_handle_t input) = 0; - // indicates to the audio policy manager that the input stops being used. - virtual status_t stopInput(audio_io_handle_t input) = 0; - // releases the input. - virtual void releaseInput(audio_io_handle_t input) = 0; - - // - // volume control functions - // - - // initialises stream volume conversion parameters by specifying volume index range. - virtual void initStreamVolume(AudioSystem::stream_type stream, int indexMin, int indexMax) = 0; - - // sets the new stream volume at a level corresponding to the supplied index for the - // supplied device. By convention, specifying AUDIO_DEVICE_OUT_DEFAULT means - // setting volume for all devices - virtual status_t setStreamVolumeIndex(AudioSystem::stream_type stream, int index, - audio_devices_t device) = 0; - - // retrieve current volume index for the specified stream and the - // specified device. By convention, specifying AUDIO_DEVICE_OUT_DEFAULT means - // querying the volume of the active device. - virtual status_t getStreamVolumeIndex(AudioSystem::stream_type stream, int* index, - audio_devices_t device) = 0; - - // return the strategy corresponding to a given stream type - virtual uint32_t getStrategyForStream(AudioSystem::stream_type stream) = 0; - - // return the enabled output devices for the given stream type - virtual audio_devices_t getDevicesForStream(AudioSystem::stream_type stream) = 0; - - // Audio effect management - virtual audio_io_handle_t getOutputForEffect(const effect_descriptor_t* desc) = 0; - virtual status_t registerEffect(const effect_descriptor_t* desc, audio_io_handle_t io, - uint32_t strategy, audio_session_t session, int id) = 0; - virtual status_t unregisterEffect(int id) = 0; - virtual status_t setEffectEnabled(int id, bool enabled) = 0; - - virtual bool isStreamActive(int stream, uint32_t inPastMs = 0) const = 0; - virtual bool isStreamActiveRemotely(int stream, uint32_t inPastMs = 0) const = 0; - virtual bool isSourceActive(audio_source_t source) const = 0; - - // dump state - virtual status_t dump(int fd) = 0; - - virtual bool isOffloadSupported(const audio_offload_info_t& offloadInfo) = 0; -}; - -// Audio Policy client Interface -class AudioPolicyClientInterface { - public: - virtual ~AudioPolicyClientInterface() {} - - // - // Audio HW module functions - // - - // loads a HW module. - virtual audio_module_handle_t loadHwModule(const char* name) = 0; - - // - // Audio output Control functions - // - - // opens an audio output with the requested parameters. The parameter values can indicate to use - // the default values in case the audio policy manager has no specific requirements for the - // output being opened. When the function returns, the parameter values reflect the actual - // values used by the audio hardware output stream. The audio policy manager can check if the - // proposed parameters are suitable or not and act accordingly. - virtual audio_io_handle_t openOutput(audio_module_handle_t module, audio_devices_t* pDevices, - uint32_t* pSamplingRate, audio_format_t* pFormat, - audio_channel_mask_t* pChannelMask, uint32_t* pLatencyMs, - audio_output_flags_t flags, - const audio_offload_info_t* offloadInfo = NULL) = 0; - // creates a special output that is duplicated to the two outputs passed as arguments. The - // duplication is performed by a special mixer thread in the AudioFlinger. - virtual audio_io_handle_t openDuplicateOutput(audio_io_handle_t output1, - audio_io_handle_t output2) = 0; - // closes the output stream - virtual status_t closeOutput(audio_io_handle_t output) = 0; - // suspends the output. When an output is suspended, the corresponding audio hardware output - // stream is placed in standby and the AudioTracks attached to the mixer thread are still - // processed but the output mix is discarded. - virtual status_t suspendOutput(audio_io_handle_t output) = 0; - // restores a suspended output. - virtual status_t restoreOutput(audio_io_handle_t output) = 0; - - // - // Audio input Control functions - // - - // opens an audio input - virtual audio_io_handle_t openInput(audio_module_handle_t module, audio_devices_t* pDevices, - uint32_t* pSamplingRate, audio_format_t* pFormat, - audio_channel_mask_t* pChannelMask) = 0; - // closes an audio input - virtual status_t closeInput(audio_io_handle_t input) = 0; - // - // misc control functions - // - - // set a stream volume for a particular output. For the same user setting, a given stream type - // can have different volumes for each output (destination device) it is attached to. - virtual status_t setStreamVolume(AudioSystem::stream_type stream, float volume, - audio_io_handle_t output, int delayMs = 0) = 0; - - // invalidate a stream type, causing a reroute to an unspecified new output - virtual status_t invalidateStream(AudioSystem::stream_type stream) = 0; - - // function enabling to send proprietary informations directly from audio policy manager to - // audio hardware interface. - virtual void setParameters(audio_io_handle_t ioHandle, const String8& keyValuePairs, - int delayMs = 0) = 0; - // function enabling to receive proprietary informations directly from audio hardware interface - // to audio policy manager. - virtual String8 getParameters(audio_io_handle_t ioHandle, const String8& keys) = 0; - - // request the playback of a tone on the specified stream: used for instance to replace - // notification sounds when playing over a telephony device during a phone call. - virtual status_t startTone(ToneGenerator::tone_type tone, AudioSystem::stream_type stream) = 0; - virtual status_t stopTone() = 0; - - // set down link audio volume. - virtual status_t setVoiceVolume(float volume, int delayMs = 0) = 0; - - // move effect to the specified output - virtual status_t moveEffects(audio_session_t session, audio_io_handle_t srcOutput, - audio_io_handle_t dstOutput) = 0; -}; - -extern "C" AudioPolicyInterface* createAudioPolicyManager( - AudioPolicyClientInterface* clientInterface); -extern "C" void destroyAudioPolicyManager(AudioPolicyInterface* interface); - -}; // namespace android_audio_legacy - -#endif // ANDROID_AUDIOPOLICYINTERFACE_H diff --git a/wifi/1.6/default/hal_legacy/AudioPolicyManagerBase.h b/wifi/1.6/default/hal_legacy/AudioPolicyManagerBase.h deleted file mode 100644 index ccc0d32632..0000000000 --- a/wifi/1.6/default/hal_legacy/AudioPolicyManagerBase.h +++ /dev/null @@ -1,567 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace android_audio_legacy { -using android::DefaultKeyedVector; -using android::KeyedVector; -using android::SortedVector; - -// ---------------------------------------------------------------------------- - -#define MAX_DEVICE_ADDRESS_LEN 20 -// Attenuation applied to STRATEGY_SONIFICATION streams when a headset is connected: 6dB -#define SONIFICATION_HEADSET_VOLUME_FACTOR 0.5 -// Min volume for STRATEGY_SONIFICATION streams when limited by music volume: -36dB -#define SONIFICATION_HEADSET_VOLUME_MIN 0.016 -// Time in milliseconds during which we consider that music is still active after a music -// track was stopped - see computeVolume() -#define SONIFICATION_HEADSET_MUSIC_DELAY 5000 -// Time in milliseconds after media stopped playing during which we consider that the -// sonification should be as unobtrusive as during the time media was playing. -#define SONIFICATION_RESPECTFUL_AFTER_MUSIC_DELAY 5000 -// Time in milliseconds during witch some streams are muted while the audio path -// is switched -#define MUTE_TIME_MS 2000 - -#define NUM_TEST_OUTPUTS 5 - -#define NUM_VOL_CURVE_KNEES 2 - -// Default minimum length allowed for offloading a compressed track -// Can be overridden by the audio.offload.min.duration.secs property -#define OFFLOAD_DEFAULT_MIN_DURATION_SECS 60 - -// ---------------------------------------------------------------------------- -// AudioPolicyManagerBase implements audio policy manager behavior common to all platforms. -// Each platform must implement an AudioPolicyManager class derived from AudioPolicyManagerBase -// and override methods for which the platform specific behavior differs from the implementation -// in AudioPolicyManagerBase. Even if no specific behavior is required, the AudioPolicyManager -// class must be implemented as well as the class factory function createAudioPolicyManager() -// and provided in a shared library libaudiopolicy.so. -// ---------------------------------------------------------------------------- - -class AudioPolicyManagerBase : public AudioPolicyInterface -#ifdef AUDIO_POLICY_TEST - , - public Thread -#endif // AUDIO_POLICY_TEST -{ - - public: - AudioPolicyManagerBase(AudioPolicyClientInterface* clientInterface); - virtual ~AudioPolicyManagerBase(); - - // AudioPolicyInterface - virtual status_t setDeviceConnectionState(audio_devices_t device, - AudioSystem::device_connection_state state, - const char* device_address); - virtual AudioSystem::device_connection_state getDeviceConnectionState( - audio_devices_t device, const char* device_address); - virtual void setPhoneState(int state); - virtual void setForceUse(AudioSystem::force_use usage, AudioSystem::forced_config config); - virtual AudioSystem::forced_config getForceUse(AudioSystem::force_use usage); - virtual void setSystemProperty(const char* property, const char* value); - virtual status_t initCheck(); - virtual audio_io_handle_t getOutput(AudioSystem::stream_type stream, uint32_t samplingRate, - audio_format_t format, audio_channel_mask_t channelMask, - AudioSystem::output_flags flags, - const audio_offload_info_t* offloadInfo); - virtual status_t startOutput(audio_io_handle_t output, AudioSystem::stream_type stream, - audio_session_t session = AUDIO_SESSION_NONE); - virtual status_t stopOutput(audio_io_handle_t output, AudioSystem::stream_type stream, - audio_session_t session = AUDIO_SESSION_NONE); - virtual void releaseOutput(audio_io_handle_t output); - virtual audio_io_handle_t getInput(int inputSource, uint32_t samplingRate, - audio_format_t format, audio_channel_mask_t channelMask, - AudioSystem::audio_in_acoustics acoustics); - - // indicates to the audio policy manager that the input starts being used. - virtual status_t startInput(audio_io_handle_t input); - - // indicates to the audio policy manager that the input stops being used. - virtual status_t stopInput(audio_io_handle_t input); - virtual void releaseInput(audio_io_handle_t input); - virtual void closeAllInputs(); - virtual void initStreamVolume(AudioSystem::stream_type stream, int indexMin, int indexMax); - virtual status_t setStreamVolumeIndex(AudioSystem::stream_type stream, int index, - audio_devices_t device); - virtual status_t getStreamVolumeIndex(AudioSystem::stream_type stream, int* index, - audio_devices_t device); - - // return the strategy corresponding to a given stream type - virtual uint32_t getStrategyForStream(AudioSystem::stream_type stream); - - // return the enabled output devices for the given stream type - virtual audio_devices_t getDevicesForStream(AudioSystem::stream_type stream); - - virtual audio_io_handle_t getOutputForEffect(const effect_descriptor_t* desc = NULL); - virtual status_t registerEffect(const effect_descriptor_t* desc, audio_io_handle_t io, - uint32_t strategy, audio_session_t session, int id); - virtual status_t unregisterEffect(int id); - virtual status_t setEffectEnabled(int id, bool enabled); - - virtual bool isStreamActive(int stream, uint32_t inPastMs = 0) const; - // return whether a stream is playing remotely, override to change the definition of - // local/remote playback, used for instance by notification manager to not make - // media players lose audio focus when not playing locally - virtual bool isStreamActiveRemotely(int stream, uint32_t inPastMs = 0) const; - virtual bool isSourceActive(audio_source_t source) const; - - virtual status_t dump(int fd); - - virtual bool isOffloadSupported(const audio_offload_info_t& offloadInfo); - - protected: - enum routing_strategy { - STRATEGY_MEDIA, - STRATEGY_PHONE, - STRATEGY_SONIFICATION, - STRATEGY_SONIFICATION_RESPECTFUL, - STRATEGY_DTMF, - STRATEGY_ENFORCED_AUDIBLE, - NUM_STRATEGIES - }; - - // 4 points to define the volume attenuation curve, each characterized by the volume - // index (from 0 to 100) at which they apply, and the attenuation in dB at that index. - // we use 100 steps to avoid rounding errors when computing the volume in volIndexToAmpl() - - enum { VOLMIN = 0, VOLKNEE1 = 1, VOLKNEE2 = 2, VOLMAX = 3, VOLCNT = 4 }; - - class VolumeCurvePoint { - public: - int mIndex; - float mDBAttenuation; - }; - - // device categories used for volume curve management. - enum device_category { - DEVICE_CATEGORY_HEADSET, - DEVICE_CATEGORY_SPEAKER, - DEVICE_CATEGORY_EARPIECE, - DEVICE_CATEGORY_CNT - }; - - class IOProfile; - - class HwModule { - public: - HwModule(const char* name); - ~HwModule(); - - void dump(int fd); - - const char* const mName; // base name of the audio HW module (primary, a2dp ...) - audio_module_handle_t mHandle; - Vector mOutputProfiles; // output profiles exposed by this module - Vector mInputProfiles; // input profiles exposed by this module - }; - - // the IOProfile class describes the capabilities of an output or input stream. - // It is currently assumed that all combination of listed parameters are supported. - // It is used by the policy manager to determine if an output or input is suitable for - // a given use case, open/close it accordingly and connect/disconnect audio tracks - // to/from it. - class IOProfile { - public: - IOProfile(HwModule* module); - ~IOProfile(); - - bool isCompatibleProfile(audio_devices_t device, uint32_t samplingRate, - audio_format_t format, audio_channel_mask_t channelMask, - audio_output_flags_t flags) const; - - void dump(int fd); - void log(); - - // by convention, "0' in the first entry in mSamplingRates, mChannelMasks or mFormats - // indicates the supported parameters should be read from the output stream - // after it is opened for the first time - Vector mSamplingRates; // supported sampling rates - Vector mChannelMasks; // supported channel masks - Vector mFormats; // supported audio formats - audio_devices_t mSupportedDevices; // supported devices (devices this output can be - // routed to) - audio_output_flags_t mFlags; // attribute flags (e.g primary output, - // direct output...). For outputs only. - HwModule* mModule; // audio HW module exposing this I/O stream - }; - - // default volume curve - static const VolumeCurvePoint sDefaultVolumeCurve[AudioPolicyManagerBase::VOLCNT]; - // default volume curve for media strategy - static const VolumeCurvePoint sDefaultMediaVolumeCurve[AudioPolicyManagerBase::VOLCNT]; - // volume curve for media strategy on speakers - static const VolumeCurvePoint sSpeakerMediaVolumeCurve[AudioPolicyManagerBase::VOLCNT]; - // volume curve for sonification strategy on speakers - static const VolumeCurvePoint sSpeakerSonificationVolumeCurve[AudioPolicyManagerBase::VOLCNT]; - static const VolumeCurvePoint - sSpeakerSonificationVolumeCurveDrc[AudioPolicyManagerBase::VOLCNT]; - static const VolumeCurvePoint sDefaultSystemVolumeCurve[AudioPolicyManagerBase::VOLCNT]; - static const VolumeCurvePoint sDefaultSystemVolumeCurveDrc[AudioPolicyManagerBase::VOLCNT]; - static const VolumeCurvePoint sHeadsetSystemVolumeCurve[AudioPolicyManagerBase::VOLCNT]; - static const VolumeCurvePoint sDefaultVoiceVolumeCurve[AudioPolicyManagerBase::VOLCNT]; - static const VolumeCurvePoint sSpeakerVoiceVolumeCurve[AudioPolicyManagerBase::VOLCNT]; - // default volume curves per stream and device category. See initializeVolumeCurves() - static const VolumeCurvePoint* sVolumeProfiles[AudioSystem::NUM_STREAM_TYPES] - [DEVICE_CATEGORY_CNT]; - - // descriptor for audio outputs. Used to maintain current configuration of each opened audio - // output and keep track of the usage of this output by each audio stream type. - class AudioOutputDescriptor { - public: - AudioOutputDescriptor(const IOProfile* profile); - - status_t dump(int fd); - - audio_devices_t device() const; - void changeRefCount(AudioSystem::stream_type stream, int delta); - - bool isDuplicated() const { return (mOutput1 != NULL && mOutput2 != NULL); } - audio_devices_t supportedDevices(); - uint32_t latency(); - bool sharesHwModuleWith(const AudioOutputDescriptor* outputDesc); - bool isActive(uint32_t inPastMs = 0) const; - bool isStreamActive(AudioSystem::stream_type stream, uint32_t inPastMs = 0, - nsecs_t sysTime = 0) const; - bool isStrategyActive(routing_strategy strategy, uint32_t inPastMs = 0, - nsecs_t sysTime = 0) const; - - audio_io_handle_t mId; // output handle - uint32_t mSamplingRate; // - audio_format_t mFormat; // - audio_channel_mask_t mChannelMask; // output configuration - uint32_t mLatency; // - audio_output_flags_t mFlags; // - audio_devices_t mDevice; // current device this output is routed to - uint32_t mRefCount[AudioSystem::NUM_STREAM_TYPES]; // number of streams of each type using - // this output - nsecs_t mStopTime[AudioSystem::NUM_STREAM_TYPES]; - AudioOutputDescriptor* mOutput1; // used by duplicated outputs: first output - AudioOutputDescriptor* mOutput2; // used by duplicated outputs: second output - float mCurVolume[AudioSystem::NUM_STREAM_TYPES]; // current stream volume - int mMuteCount[AudioSystem::NUM_STREAM_TYPES]; // mute request counter - const IOProfile* mProfile; // I/O profile this output derives from - bool mStrategyMutedByDevice[NUM_STRATEGIES]; // strategies muted because of incompatible - // device selection. See - // checkDeviceMuteStrategies() - uint32_t mDirectOpenCount; // number of clients using this output (direct outputs only) - bool mForceRouting; // Next routing for this output will be forced as current device routed - // is null - }; - - // descriptor for audio inputs. Used to maintain current configuration of each opened audio - // input and keep track of the usage of this input. - class AudioInputDescriptor { - public: - AudioInputDescriptor(const IOProfile* profile); - - status_t dump(int fd); - - audio_io_handle_t mId; // input handle - uint32_t mSamplingRate; // - audio_format_t mFormat; // input configuration - audio_channel_mask_t mChannelMask; // - audio_devices_t mDevice; // current device this input is routed to - uint32_t mRefCount; // number of AudioRecord clients using this output - int mInputSource; // input source selected by application (mediarecorder.h) - const IOProfile* mProfile; // I/O profile this output derives from - }; - - // stream descriptor used for volume control - class StreamDescriptor { - public: - StreamDescriptor(); - - int getVolumeIndex(audio_devices_t device); - void dump(int fd); - - int mIndexMin; // min volume index - int mIndexMax; // max volume index - KeyedVector mIndexCur; // current volume index per device - bool mCanBeMuted; // true is the stream can be muted - - const VolumeCurvePoint* mVolumeCurve[DEVICE_CATEGORY_CNT]; - }; - - // stream descriptor used for volume control - class EffectDescriptor { - public: - status_t dump(int fd); - - int mIo; // io the effect is attached to - routing_strategy mStrategy; // routing strategy the effect is associated to - audio_session_t mSession; // audio session the effect is on - effect_descriptor_t mDesc; // effect descriptor - bool mEnabled; // enabled state: CPU load being used or not - }; - - void addOutput(audio_io_handle_t id, AudioOutputDescriptor* outputDesc); - void addInput(audio_io_handle_t id, AudioInputDescriptor* inputDesc); - - // return the strategy corresponding to a given stream type - static routing_strategy getStrategy(AudioSystem::stream_type stream); - - // return appropriate device for streams handled by the specified strategy according to current - // phone state, connected devices... - // if fromCache is true, the device is returned from mDeviceForStrategy[], - // otherwise it is determine by current state - // (device connected,phone state, force use, a2dp output...) - // This allows to: - // 1 speed up process when the state is stable (when starting or stopping an output) - // 2 access to either current device selection (fromCache == true) or - // "future" device selection (fromCache == false) when called from a context - // where conditions are changing (setDeviceConnectionState(), setPhoneState()...) AND - // before updateDevicesAndOutputs() is called. - virtual audio_devices_t getDeviceForStrategy(routing_strategy strategy, bool fromCache); - - // change the route of the specified output. Returns the number of ms we have slept to - // allow new routing to take effect in certain cases. - uint32_t setOutputDevice(audio_io_handle_t output, audio_devices_t device, bool force = false, - int delayMs = 0); - - // select input device corresponding to requested audio source - virtual audio_devices_t getDeviceForInputSource(int inputSource); - - // return io handle of active input or 0 if no input is active - // Only considers inputs from physical devices (e.g. main mic, headset mic) when - // ignoreVirtualInputs is true. - audio_io_handle_t getActiveInput(bool ignoreVirtualInputs = true); - - // initialize volume curves for each strategy and device category - void initializeVolumeCurves(); - - // compute the actual volume for a given stream according to the requested index and a - // particular device - virtual float computeVolume(int stream, int index, audio_io_handle_t output, - audio_devices_t device); - - // check that volume change is permitted, compute and send new volume to audio hardware - status_t checkAndSetVolume(int stream, int index, audio_io_handle_t output, - audio_devices_t device, int delayMs = 0, bool force = false); - - // apply all stream volumes to the specified output and device - void applyStreamVolumes(audio_io_handle_t output, audio_devices_t device, int delayMs = 0, - bool force = false); - - // Mute or unmute all streams handled by the specified strategy on the specified output - void setStrategyMute(routing_strategy strategy, bool on, audio_io_handle_t output, - int delayMs = 0, audio_devices_t device = (audio_devices_t)0); - - // Mute or unmute the stream on the specified output - void setStreamMute(int stream, bool on, audio_io_handle_t output, int delayMs = 0, - audio_devices_t device = (audio_devices_t)0); - - // handle special cases for sonification strategy while in call: mute streams or replace by - // a special tone in the device used for communication - void handleIncallSonification(int stream, bool starting, bool stateChange); - - // true if device is in a telephony or VoIP call - virtual bool isInCall(); - - // true if given state represents a device in a telephony or VoIP call - virtual bool isStateInCall(int state); - - // when a device is connected, checks if an open output can be routed - // to this device. If none is open, tries to open one of the available outputs. - // Returns an output suitable to this device or 0. - // when a device is disconnected, checks if an output is not used any more and - // returns its handle if any. - // transfers the audio tracks and effects from one output thread to another accordingly. - status_t checkOutputsForDevice(audio_devices_t device, - AudioSystem::device_connection_state state, - SortedVector& outputs, - const String8 paramStr); - - status_t checkInputsForDevice(audio_devices_t device, - AudioSystem::device_connection_state state, - SortedVector& inputs, const String8 paramStr); - - // close an output and its companion duplicating output. - void closeOutput(audio_io_handle_t output); - - // checks and if necessary changes outputs used for all strategies. - // must be called every time a condition that affects the output choice for a given strategy - // changes: connected device, phone state, force use... - // Must be called before updateDevicesAndOutputs() - void checkOutputForStrategy(routing_strategy strategy); - - // Same as checkOutputForStrategy() but for a all strategies in order of priority - void checkOutputForAllStrategies(); - - // manages A2DP output suspend/restore according to phone state and BT SCO usage - void checkA2dpSuspend(); - - // returns the A2DP output handle if it is open or 0 otherwise - audio_io_handle_t getA2dpOutput(); - - // selects the most appropriate device on output for current state - // must be called every time a condition that affects the device choice for a given output is - // changed: connected device, phone state, force use, output start, output stop.. - // see getDeviceForStrategy() for the use of fromCache parameter - - audio_devices_t getNewDevice(audio_io_handle_t output, bool fromCache); - // updates cache of device used by all strategies (mDeviceForStrategy[]) - // must be called every time a condition that affects the device choice for a given strategy is - // changed: connected device, phone state, force use... - // cached values are used by getDeviceForStrategy() if parameter fromCache is true. - // Must be called after checkOutputForAllStrategies() - - void updateDevicesAndOutputs(); - - virtual uint32_t getMaxEffectsCpuLoad(); - virtual uint32_t getMaxEffectsMemory(); -#ifdef AUDIO_POLICY_TEST - virtual bool threadLoop(); - void exit(); - int testOutputIndex(audio_io_handle_t output); -#endif // AUDIO_POLICY_TEST - - status_t setEffectEnabled(EffectDescriptor* pDesc, bool enabled); - - // returns the category the device belongs to with regard to volume curve management - static device_category getDeviceCategory(audio_devices_t device); - - // extract one device relevant for volume control from multiple device selection - static audio_devices_t getDeviceForVolume(audio_devices_t device); - - SortedVector getOutputsForDevice( - audio_devices_t device, - DefaultKeyedVector openOutputs); - bool vectorsEqual(SortedVector& outputs1, - SortedVector& outputs2); - - // mute/unmute strategies using an incompatible device combination - // if muting, wait for the audio in pcm buffer to be drained before proceeding - // if unmuting, unmute only after the specified delay - // Returns the number of ms waited - uint32_t checkDeviceMuteStrategies(AudioOutputDescriptor* outputDesc, - audio_devices_t prevDevice, uint32_t delayMs); - - audio_io_handle_t selectOutput(const SortedVector& outputs, - AudioSystem::output_flags flags); - IOProfile* getInputProfile(audio_devices_t device, uint32_t samplingRate, audio_format_t format, - audio_channel_mask_t channelMask); - IOProfile* getProfileForDirectOutput(audio_devices_t device, uint32_t samplingRate, - audio_format_t format, audio_channel_mask_t channelMask, - audio_output_flags_t flags); - - audio_io_handle_t selectOutputForEffects(const SortedVector& outputs); - - bool isNonOffloadableEffectEnabled(); - - // - // Audio policy configuration file parsing (audio_policy.conf) - // - static uint32_t stringToEnum(const struct StringToEnum* table, size_t size, const char* name); - static bool stringToBool(const char* value); - static audio_output_flags_t parseFlagNames(char* name); - static audio_devices_t parseDeviceNames(char* name); - void loadSamplingRates(char* name, IOProfile* profile); - void loadFormats(char* name, IOProfile* profile); - void loadOutChannels(char* name, IOProfile* profile); - void loadInChannels(char* name, IOProfile* profile); - status_t loadOutput(cnode* root, HwModule* module); - status_t loadInput(cnode* root, HwModule* module); - void loadHwModule(cnode* root); - void loadHwModules(cnode* root); - void loadGlobalConfig(cnode* root); - status_t loadAudioPolicyConfig(const char* path); - void defaultAudioPolicyConfig(void); - - AudioPolicyClientInterface* mpClientInterface; // audio policy client interface - audio_io_handle_t mPrimaryOutput; // primary output handle - // list of descriptors for outputs currently opened - DefaultKeyedVector mOutputs; - // copy of mOutputs before setDeviceConnectionState() opens new outputs - // reset to mOutputs when updateDevicesAndOutputs() is called. - DefaultKeyedVector mPreviousOutputs; - - // list of input descriptors currently opened - DefaultKeyedVector mInputs; - - audio_devices_t mAvailableOutputDevices; // bit field of all available output devices - audio_devices_t mAvailableInputDevices; // bit field of all available input devices - // without AUDIO_DEVICE_BIT_IN to allow direct bit - // field comparisons - int mPhoneState; // current phone state - AudioSystem::forced_config - mForceUse[AudioSystem::NUM_FORCE_USE]; // current forced use configuration - - StreamDescriptor - mStreams[AudioSystem::NUM_STREAM_TYPES]; // stream descriptors for volume control - String8 mA2dpDeviceAddress; // A2DP device MAC address - String8 mScoDeviceAddress; // SCO device MAC address - String8 mUsbOutCardAndDevice; // USB audio ALSA card and device numbers: - // card=;device=<> - bool mLimitRingtoneVolume; // limit ringtone volume to music volume if headset connected - audio_devices_t mDeviceForStrategy[NUM_STRATEGIES]; - float mLastVoiceVolume; // last voice volume value sent to audio HAL - - // Maximum CPU load allocated to audio effects in 0.1 MIPS (ARMv5TE, 0 WS memory) units - static const uint32_t MAX_EFFECTS_CPU_LOAD = 1000; - // Maximum memory allocated to audio effects in KB - static const uint32_t MAX_EFFECTS_MEMORY = 512; - uint32_t mTotalEffectsCpuLoad; // current CPU load used by effects - uint32_t mTotalEffectsMemory; // current memory used by effects - KeyedVector mEffects; // list of registered audio effects - bool mA2dpSuspended; // true if A2DP output is suspended - bool mHasA2dp; // true on platforms with support for bluetooth A2DP - bool mHasUsb; // true on platforms with support for USB audio - bool mHasRemoteSubmix; // true on platforms with support for remote presentation of a submix - audio_devices_t mAttachedOutputDevices; // output devices always available on the platform - audio_devices_t mDefaultOutputDevice; // output device selected by default at boot time - // (must be in mAttachedOutputDevices) - bool mSpeakerDrcEnabled; // true on devices that use DRC on the DEVICE_CATEGORY_SPEAKER path - // to boost soft sounds, used to adjust volume curves accordingly - - Vector mHwModules; - -#ifdef AUDIO_POLICY_TEST - Mutex mLock; - Condition mWaitWorkCV; - - int mCurOutput; - bool mDirectOutput; - audio_io_handle_t mTestOutputs[NUM_TEST_OUTPUTS]; - int mTestInput; - uint32_t mTestDevice; - uint32_t mTestSamplingRate; - uint32_t mTestFormat; - uint32_t mTestChannels; - uint32_t mTestLatencyMs; -#endif // AUDIO_POLICY_TEST - - private: - static float volIndexToAmpl(audio_devices_t device, const StreamDescriptor& streamDesc, - int indexInUi); - // updates device caching and output for streams that can influence the - // routing of notifications - void handleNotificationRoutingForStream(AudioSystem::stream_type stream); - static bool isVirtualInputDevice(audio_devices_t device); -}; - -}; // namespace android_audio_legacy diff --git a/wifi/1.6/default/hal_legacy/AudioSystemLegacy.h b/wifi/1.6/default/hal_legacy/AudioSystemLegacy.h deleted file mode 100644 index 943b0db944..0000000000 --- a/wifi/1.6/default/hal_legacy/AudioSystemLegacy.h +++ /dev/null @@ -1,358 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -#ifndef ANDROID_AUDIOSYSTEM_LEGACY_H_ -#define ANDROID_AUDIOSYSTEM_LEGACY_H_ - -#include -#include -#include - -#include -#include - -namespace android_audio_legacy { - -using android::AudioParameter; -using android::status_t; - -enum { - OK = android::OK, - NO_ERROR = android::NO_ERROR, - - UNKNOWN_ERROR = android::UNKNOWN_ERROR, - - NO_MEMORY = android::NO_MEMORY, - INVALID_OPERATION = android::INVALID_OPERATION, - BAD_VALUE = android::BAD_VALUE, - BAD_TYPE = android::BAD_TYPE, - NAME_NOT_FOUND = android::NAME_NOT_FOUND, - PERMISSION_DENIED = android::PERMISSION_DENIED, - NO_INIT = android::NO_INIT, - ALREADY_EXISTS = android::ALREADY_EXISTS, - DEAD_OBJECT = android::DEAD_OBJECT, - FAILED_TRANSACTION = android::FAILED_TRANSACTION, - BAD_INDEX = android::BAD_INDEX, - NOT_ENOUGH_DATA = android::NOT_ENOUGH_DATA, - WOULD_BLOCK = android::WOULD_BLOCK, - TIMED_OUT = android::TIMED_OUT, - UNKNOWN_TRANSACTION = android::UNKNOWN_TRANSACTION, -}; - -enum audio_source { - AUDIO_SOURCE_DEFAULT = 0, - AUDIO_SOURCE_MIC = 1, - AUDIO_SOURCE_VOICE_UPLINK = 2, - AUDIO_SOURCE_VOICE_DOWNLINK = 3, - AUDIO_SOURCE_VOICE_CALL = 4, - AUDIO_SOURCE_CAMCORDER = 5, - AUDIO_SOURCE_VOICE_RECOGNITION = 6, - AUDIO_SOURCE_VOICE_COMMUNICATION = 7, - AUDIO_SOURCE_MAX = AUDIO_SOURCE_VOICE_COMMUNICATION, - - AUDIO_SOURCE_LIST_END // must be last - used to validate audio source type -}; - -class AudioSystem { - public: -#if 1 - enum stream_type { - DEFAULT = -1, - VOICE_CALL = 0, - SYSTEM = 1, - RING = 2, - MUSIC = 3, - ALARM = 4, - NOTIFICATION = 5, - BLUETOOTH_SCO = 6, - ENFORCED_AUDIBLE = 7, // Sounds that cannot be muted by user and must be routed to speaker - DTMF = 8, - TTS = 9, - NUM_STREAM_TYPES - }; - - // Audio sub formats (see AudioSystem::audio_format). - enum pcm_sub_format { - PCM_SUB_16_BIT = 0x1, // must be 1 for backward compatibility - PCM_SUB_8_BIT = 0x2, // must be 2 for backward compatibility - }; - - enum audio_sessions { - SESSION_OUTPUT_STAGE = AUDIO_SESSION_OUTPUT_STAGE, - SESSION_OUTPUT_MIX = AUDIO_SESSION_OUTPUT_MIX, - }; - - // MP3 sub format field definition : can use 11 LSBs in the same way as MP3 frame header to - // specify bit rate, stereo mode, version... - enum mp3_sub_format { - // TODO - }; - - // AMR NB/WB sub format field definition: specify frame block interleaving, bandwidth efficient - // or octet aligned, encoding mode for recording... - enum amr_sub_format { - // TODO - }; - - // AAC sub format field definition: specify profile or bitrate for recording... - enum aac_sub_format { - // TODO - }; - - // VORBIS sub format field definition: specify quality for recording... - enum vorbis_sub_format { - // TODO - }; - - // Audio format consists in a main format field (upper 8 bits) and a sub format field (lower 24 - // bits). The main format indicates the main codec type. The sub format field indicates options - // and parameters for each format. The sub format is mainly used for record to indicate for - // instance the requested bitrate or profile. It can also be used for certain formats to give - // informations not present in the encoded audio stream (e.g. octet alignement for AMR). - enum audio_format { - INVALID_FORMAT = -1, - FORMAT_DEFAULT = 0, - PCM = 0x00000000, // must be 0 for backward compatibility - MP3 = 0x01000000, - AMR_NB = 0x02000000, - AMR_WB = 0x03000000, - AAC = 0x04000000, - HE_AAC_V1 = 0x05000000, - HE_AAC_V2 = 0x06000000, - VORBIS = 0x07000000, - MAIN_FORMAT_MASK = 0xFF000000, - SUB_FORMAT_MASK = 0x00FFFFFF, - // Aliases - PCM_16_BIT = (PCM | PCM_SUB_16_BIT), - PCM_8_BIT = (PCM | PCM_SUB_8_BIT) - }; - - enum audio_channels { - // output channels - CHANNEL_OUT_FRONT_LEFT = 0x1, - CHANNEL_OUT_FRONT_RIGHT = 0x2, - CHANNEL_OUT_FRONT_CENTER = 0x4, - CHANNEL_OUT_LOW_FREQUENCY = 0x8, - CHANNEL_OUT_BACK_LEFT = 0x10, - CHANNEL_OUT_BACK_RIGHT = 0x20, - CHANNEL_OUT_FRONT_LEFT_OF_CENTER = 0x40, - CHANNEL_OUT_FRONT_RIGHT_OF_CENTER = 0x80, - CHANNEL_OUT_BACK_CENTER = 0x100, - CHANNEL_OUT_SIDE_LEFT = 0x200, - CHANNEL_OUT_SIDE_RIGHT = 0x400, - CHANNEL_OUT_TOP_CENTER = 0x800, - CHANNEL_OUT_TOP_FRONT_LEFT = 0x1000, - CHANNEL_OUT_TOP_FRONT_CENTER = 0x2000, - CHANNEL_OUT_TOP_FRONT_RIGHT = 0x4000, - CHANNEL_OUT_TOP_BACK_LEFT = 0x8000, - CHANNEL_OUT_TOP_BACK_CENTER = 0x10000, - CHANNEL_OUT_TOP_BACK_RIGHT = 0x20000, - - CHANNEL_OUT_MONO = CHANNEL_OUT_FRONT_LEFT, - CHANNEL_OUT_STEREO = (CHANNEL_OUT_FRONT_LEFT | CHANNEL_OUT_FRONT_RIGHT), - CHANNEL_OUT_QUAD = (CHANNEL_OUT_FRONT_LEFT | CHANNEL_OUT_FRONT_RIGHT | - CHANNEL_OUT_BACK_LEFT | CHANNEL_OUT_BACK_RIGHT), - CHANNEL_OUT_SURROUND = (CHANNEL_OUT_FRONT_LEFT | CHANNEL_OUT_FRONT_RIGHT | - CHANNEL_OUT_FRONT_CENTER | CHANNEL_OUT_BACK_CENTER), - CHANNEL_OUT_5POINT1 = - (CHANNEL_OUT_FRONT_LEFT | CHANNEL_OUT_FRONT_RIGHT | CHANNEL_OUT_FRONT_CENTER | - CHANNEL_OUT_LOW_FREQUENCY | CHANNEL_OUT_BACK_LEFT | CHANNEL_OUT_BACK_RIGHT), - // matches the correct AudioFormat.CHANNEL_OUT_7POINT1_SURROUND definition for 7.1 - CHANNEL_OUT_7POINT1 = - (CHANNEL_OUT_FRONT_LEFT | CHANNEL_OUT_FRONT_RIGHT | CHANNEL_OUT_FRONT_CENTER | - CHANNEL_OUT_LOW_FREQUENCY | CHANNEL_OUT_BACK_LEFT | CHANNEL_OUT_BACK_RIGHT | - CHANNEL_OUT_SIDE_LEFT | CHANNEL_OUT_SIDE_RIGHT), - CHANNEL_OUT_ALL = - (CHANNEL_OUT_FRONT_LEFT | CHANNEL_OUT_FRONT_RIGHT | CHANNEL_OUT_FRONT_CENTER | - CHANNEL_OUT_LOW_FREQUENCY | CHANNEL_OUT_BACK_LEFT | CHANNEL_OUT_BACK_RIGHT | - CHANNEL_OUT_FRONT_LEFT_OF_CENTER | CHANNEL_OUT_FRONT_RIGHT_OF_CENTER | - CHANNEL_OUT_BACK_CENTER | CHANNEL_OUT_SIDE_LEFT | CHANNEL_OUT_SIDE_RIGHT | - CHANNEL_OUT_TOP_CENTER | CHANNEL_OUT_TOP_FRONT_LEFT | - CHANNEL_OUT_TOP_FRONT_CENTER | CHANNEL_OUT_TOP_FRONT_RIGHT | - CHANNEL_OUT_TOP_BACK_LEFT | CHANNEL_OUT_TOP_BACK_CENTER | - CHANNEL_OUT_TOP_BACK_RIGHT), - - // input channels - CHANNEL_IN_LEFT = 0x4, - CHANNEL_IN_RIGHT = 0x8, - CHANNEL_IN_FRONT = 0x10, - CHANNEL_IN_BACK = 0x20, - CHANNEL_IN_LEFT_PROCESSED = 0x40, - CHANNEL_IN_RIGHT_PROCESSED = 0x80, - CHANNEL_IN_FRONT_PROCESSED = 0x100, - CHANNEL_IN_BACK_PROCESSED = 0x200, - CHANNEL_IN_PRESSURE = 0x400, - CHANNEL_IN_X_AXIS = 0x800, - CHANNEL_IN_Y_AXIS = 0x1000, - CHANNEL_IN_Z_AXIS = 0x2000, - CHANNEL_IN_VOICE_UPLINK = 0x4000, - CHANNEL_IN_VOICE_DNLINK = 0x8000, - CHANNEL_IN_MONO = CHANNEL_IN_FRONT, - CHANNEL_IN_STEREO = (CHANNEL_IN_LEFT | CHANNEL_IN_RIGHT), - CHANNEL_IN_ALL = (CHANNEL_IN_LEFT | CHANNEL_IN_RIGHT | CHANNEL_IN_FRONT | CHANNEL_IN_BACK | - CHANNEL_IN_LEFT_PROCESSED | CHANNEL_IN_RIGHT_PROCESSED | - CHANNEL_IN_FRONT_PROCESSED | CHANNEL_IN_BACK_PROCESSED | - CHANNEL_IN_PRESSURE | CHANNEL_IN_X_AXIS | CHANNEL_IN_Y_AXIS | - CHANNEL_IN_Z_AXIS | CHANNEL_IN_VOICE_UPLINK | CHANNEL_IN_VOICE_DNLINK) - }; - - enum audio_mode { - MODE_INVALID = -2, - MODE_CURRENT = -1, - MODE_NORMAL = 0, - MODE_RINGTONE, - MODE_IN_CALL, - MODE_IN_COMMUNICATION, - NUM_MODES // not a valid entry, denotes end-of-list - }; - - enum audio_in_acoustics { - AGC_ENABLE = 0x0001, - AGC_DISABLE = 0, - NS_ENABLE = 0x0002, - NS_DISABLE = 0, - TX_IIR_ENABLE = 0x0004, - TX_DISABLE = 0 - }; - - // DO NOT USE: the "audio_devices" enumeration below is obsolete, use type "audio_devices_t" and - // audio device enumeration from system/audio.h instead. - enum audio_devices { - // output devices - DEVICE_OUT_EARPIECE = 0x1, - DEVICE_OUT_SPEAKER = 0x2, - DEVICE_OUT_WIRED_HEADSET = 0x4, - DEVICE_OUT_WIRED_HEADPHONE = 0x8, - DEVICE_OUT_BLUETOOTH_SCO = 0x10, - DEVICE_OUT_BLUETOOTH_SCO_HEADSET = 0x20, - DEVICE_OUT_BLUETOOTH_SCO_CARKIT = 0x40, - DEVICE_OUT_BLUETOOTH_A2DP = 0x80, - DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES = 0x100, - DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER = 0x200, - DEVICE_OUT_AUX_DIGITAL = 0x400, - DEVICE_OUT_ANLG_DOCK_HEADSET = 0x800, - DEVICE_OUT_DGTL_DOCK_HEADSET = 0x1000, - DEVICE_OUT_DEFAULT = 0x8000, - DEVICE_OUT_ALL = - (DEVICE_OUT_EARPIECE | DEVICE_OUT_SPEAKER | DEVICE_OUT_WIRED_HEADSET | - DEVICE_OUT_WIRED_HEADPHONE | DEVICE_OUT_BLUETOOTH_SCO | - DEVICE_OUT_BLUETOOTH_SCO_HEADSET | DEVICE_OUT_BLUETOOTH_SCO_CARKIT | - DEVICE_OUT_BLUETOOTH_A2DP | DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES | - DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER | DEVICE_OUT_AUX_DIGITAL | - DEVICE_OUT_ANLG_DOCK_HEADSET | DEVICE_OUT_DGTL_DOCK_HEADSET | DEVICE_OUT_DEFAULT), - DEVICE_OUT_ALL_A2DP = (DEVICE_OUT_BLUETOOTH_A2DP | DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES | - DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER), - - // input devices - DEVICE_IN_COMMUNICATION = 0x10000, - DEVICE_IN_AMBIENT = 0x20000, - DEVICE_IN_BUILTIN_MIC = 0x40000, - DEVICE_IN_BLUETOOTH_SCO_HEADSET = 0x80000, - DEVICE_IN_WIRED_HEADSET = 0x100000, - DEVICE_IN_AUX_DIGITAL = 0x200000, - DEVICE_IN_VOICE_CALL = 0x400000, - DEVICE_IN_BACK_MIC = 0x800000, - DEVICE_IN_DEFAULT = 0x80000000, - - DEVICE_IN_ALL = - (DEVICE_IN_COMMUNICATION | DEVICE_IN_AMBIENT | DEVICE_IN_BUILTIN_MIC | - DEVICE_IN_BLUETOOTH_SCO_HEADSET | DEVICE_IN_WIRED_HEADSET | DEVICE_IN_AUX_DIGITAL | - DEVICE_IN_VOICE_CALL | DEVICE_IN_BACK_MIC | DEVICE_IN_DEFAULT) - }; - - // request to open a direct output with getOutput() (by opposition to sharing an output with - // other AudioTracks) - enum output_flags { OUTPUT_FLAG_INDIRECT = 0x0, OUTPUT_FLAG_DIRECT = 0x1 }; - - // device categories used for setForceUse() - enum forced_config { - FORCE_NONE, - FORCE_SPEAKER, - FORCE_HEADPHONES, - FORCE_BT_SCO, - FORCE_BT_A2DP, - FORCE_WIRED_ACCESSORY, - FORCE_BT_CAR_DOCK, - FORCE_BT_DESK_DOCK, - FORCE_ANALOG_DOCK, - FORCE_DIGITAL_DOCK, - FORCE_NO_BT_A2DP, - FORCE_SYSTEM_ENFORCED, - NUM_FORCE_CONFIG, - FORCE_DEFAULT = FORCE_NONE - }; - - // usages used for setForceUse() - enum force_use { - FOR_COMMUNICATION, - FOR_MEDIA, - FOR_RECORD, - FOR_DOCK, - FOR_SYSTEM, - NUM_FORCE_USE - }; - - // - // AudioPolicyService interface - // - - // device connection states used for setDeviceConnectionState() - enum device_connection_state { - DEVICE_STATE_UNAVAILABLE, - DEVICE_STATE_AVAILABLE, - NUM_DEVICE_STATES - }; - -#endif - - static uint32_t popCount(uint32_t u) { return popcount(u); } - -#if 1 - static bool isOutputDevice(audio_devices device) { - if ((popcount(device) == 1) && ((device & ~DEVICE_OUT_ALL) == 0)) - return true; - else - return false; - } - static bool isInputDevice(audio_devices device) { - if ((popcount(device) == 1) && ((device & ~DEVICE_IN_ALL) == 0)) - return true; - else - return false; - } - static bool isA2dpDevice(audio_devices device) { - return audio_is_a2dp_device((audio_devices_t)device); - } - static bool isBluetoothScoDevice(audio_devices device) { - return audio_is_bluetooth_sco_device((audio_devices_t)device); - } - static bool isValidFormat(uint32_t format) { - return audio_is_valid_format((audio_format_t)format); - } - static bool isLinearPCM(uint32_t format) { return audio_is_linear_pcm((audio_format_t)format); } - static bool isOutputChannel(audio_channel_mask_t channel) { - return audio_is_output_channel(channel); - } - static bool isInputChannel(audio_channel_mask_t channel) { - return audio_is_input_channel(channel); - } - -#endif -}; - -}; // namespace android_audio_legacy - -#endif // ANDROID_AUDIOSYSTEM_LEGACY_H_ diff --git a/wifi/1.6/default/hal_legacy/IMountService.h b/wifi/1.6/default/hal_legacy/IMountService.h deleted file mode 100644 index 158ff5945b..0000000000 --- a/wifi/1.6/default/hal_legacy/IMountService.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -// -#ifndef ANDROID_HARDWARE_IMOUNTSERVICE_H -#define ANDROID_HARDWARE_IMOUNTSERVICE_H - -#include -#include - -namespace android { - -// ---------------------------------------------------------------------- - -class IMountService : public IInterface { - public: - static const int OperationSucceeded = 0; - static const int OperationFailedInternalError = -1; - static const int OperationFailedNoMedia = -2; - static const int OperationFailedMediaBlank = -3; - static const int OperationFailedMediaCorrupt = -4; - static const int OperationFailedVolumeNotMounted = -5; - - public: - DECLARE_META_INTERFACE(MountService); - - virtual void getShareMethodList() = 0; - virtual bool getShareMethodAvailable(String16 method) = 0; - virtual int shareVolume(String16 path, String16 method) = 0; - virtual int unshareVolume(String16 path, String16 method) = 0; - virtual bool getVolumeShared(String16 path, String16 method) = 0; - virtual int mountVolume(String16 path) = 0; - virtual int unmountVolume(String16 path) = 0; - virtual int formatVolume(String16 path) = 0; - virtual String16 getVolumeState(String16 mountPoint) = 0; - virtual int createSecureContainer(String16 id, int sizeMb, String16 fstype, String16 key, - int ownerUid) = 0; - virtual int finalizeSecureContainer(String16 id) = 0; - virtual int destroySecureContainer(String16 id) = 0; - virtual int mountSecureContainer(String16 id, String16 key, int ownerUid) = 0; - virtual int unmountSecureContainer(String16 id) = 0; - virtual int renameSecureContainer(String16 oldId, String16 newId) = 0; - virtual String16 getSecureContainerPath(String16 id) = 0; - virtual void getSecureContainerList() = 0; - virtual void shutdown() = 0; -}; - -// ---------------------------------------------------------------------- - -}; // namespace android - -#endif // ANDROID_HARDWARE_IMOUNTSERVICE_H diff --git a/wifi/1.6/default/hal_legacy/audio_policy_conf.h b/wifi/1.6/default/hal_legacy/audio_policy_conf.h deleted file mode 100644 index 13d62f96de..0000000000 --- a/wifi/1.6/default/hal_legacy/audio_policy_conf.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#ifndef ANDROID_AUDIO_POLICY_CONF_H -#define ANDROID_AUDIO_POLICY_CONF_H - -///////////////////////////////////////////////// -// Definitions for audio policy configuration file (audio_policy.conf) -///////////////////////////////////////////////// - -#define AUDIO_HARDWARE_MODULE_ID_MAX_LEN 32 - -#define AUDIO_POLICY_CONFIG_FILE "/system/etc/audio_policy.conf" -#define AUDIO_POLICY_VENDOR_CONFIG_FILE "/vendor/etc/audio_policy.conf" - -// global configuration -#define GLOBAL_CONFIG_TAG "global_configuration" - -#define ATTACHED_OUTPUT_DEVICES_TAG "attached_output_devices" -#define DEFAULT_OUTPUT_DEVICE_TAG "default_output_device" -#define ATTACHED_INPUT_DEVICES_TAG "attached_input_devices" -#define SPEAKER_DRC_ENABLED_TAG "speaker_drc_enabled" - -// hw modules descriptions -#define AUDIO_HW_MODULE_TAG "audio_hw_modules" - -#define OUTPUTS_TAG "outputs" -#define INPUTS_TAG "inputs" - -#define SAMPLING_RATES_TAG "sampling_rates" -#define FORMATS_TAG "formats" -#define CHANNELS_TAG "channel_masks" -#define DEVICES_TAG "devices" -#define FLAGS_TAG "flags" - -#define DYNAMIC_VALUE_TAG \ - "dynamic" // special value for "channel_masks", "sampling_rates" and - // "formats" in outputs descriptors indicating that supported - // values should be queried after opening the output. - -#endif // ANDROID_AUDIO_POLICY_CONF_H diff --git a/wifi/1.6/default/hal_legacy/gscan.h b/wifi/1.6/default/hal_legacy/gscan.h deleted file mode 100644 index c6c52c6e1a..0000000000 --- a/wifi/1.6/default/hal_legacy/gscan.h +++ /dev/null @@ -1,427 +0,0 @@ -#include "wifi_hal.h" - -#ifndef __WIFI_HAL_GSCAN_H__ -#define __WIFI_HAL_GSCAN_H__ - -// Define static_assert() unless already defined by compiler. -#ifndef __has_feature -#define __has_feature(__x) 0 -#endif -#if !(__has_feature(cxx_static_assert)) && !defined(static_assert) -#define static_assert(__b, __m) \ - extern int compile_time_assert_failed[(__b) ? 1 : -1] __attribute__((unused)); -#endif - -/* AP Scans */ - -typedef enum { - WIFI_BAND_UNSPECIFIED, - WIFI_BAND_BG = 1, // 2.4 GHz - WIFI_BAND_A = 2, // 5 GHz without DFS - WIFI_BAND_A_DFS = 4, // 5 GHz DFS only - WIFI_BAND_A_WITH_DFS = 6, // 5 GHz with DFS - WIFI_BAND_ABG = 3, // 2.4 GHz + 5 GHz; no DFS - WIFI_BAND_ABG_WITH_DFS = 7, // 2.4 GHz + 5 GHz with DFS -} wifi_band; - -#define MAX_CHANNELS 16 -#define MAX_BUCKETS 16 -#define MAX_HOTLIST_APS 128 -#define MAX_SIGNIFICANT_CHANGE_APS 64 -#define MAX_EPNO_NETWORKS 64 -#define MAX_HOTLIST_SSID 8 -#define MAX_AP_CACHE_PER_SCAN 32 - -wifi_error wifi_get_valid_channels(wifi_interface_handle handle, int band, int max_channels, - wifi_channel* channels, int* num_channels); - -typedef struct { - int max_scan_cache_size; // total space allocated for scan (in bytes) - int max_scan_buckets; // maximum number of channel buckets - int max_ap_cache_per_scan; // maximum number of APs that can be stored per scan - int max_rssi_sample_size; // number of RSSI samples used for averaging RSSI - int max_scan_reporting_threshold; // max possible report_threshold as described - // in wifi_scan_cmd_params - int max_hotlist_bssids; // maximum number of entries for hotlist BSSIDs - int max_hotlist_ssids; // maximum number of entries for hotlist SSIDs - int max_significant_wifi_change_aps; // maximum number of entries for - // significant wifi change APs - int max_bssid_history_entries; // number of BSSID/RSSI entries that device can hold - int max_number_epno_networks; // max number of epno entries - int max_number_epno_networks_by_ssid; // max number of epno entries if ssid is specified, - // that is, epno entries for which an exact match is - // required, or entries corresponding to hidden ssids - int max_number_of_white_listed_ssid; // max number of white listed SSIDs, M target is 2 to 4 -} wifi_gscan_capabilities; - -wifi_error wifi_get_gscan_capabilities(wifi_interface_handle handle, - wifi_gscan_capabilities* capabilities); - -typedef enum { - WIFI_SCAN_RESULTS_AVAILABLE, // reported when REPORT_EVENTS_EACH_SCAN is set and a scan - // completes. WIFI_SCAN_THRESHOLD_NUM_SCANS or - // WIFI_SCAN_THRESHOLD_PERCENT can be reported instead if the - // reason for the event is available; however, at most one of - // these events should be reported per scan. If there are - // multiple buckets that were scanned this period and one has the - // EACH_SCAN flag set then this event should be prefered. - WIFI_SCAN_THRESHOLD_NUM_SCANS, // can be reported when REPORT_EVENTS_EACH_SCAN is not set and - // report_threshold_num_scans is reached. - WIFI_SCAN_THRESHOLD_PERCENT, // can be reported when REPORT_EVENTS_EACH_SCAN is not set and - // report_threshold_percent is reached. - WIFI_SCAN_FAILED, // reported when currently executing gscans have failed. - // start_gscan will need to be called again in order to continue - // scanning. This is intended to indicate abnormal scan - // terminations (not those as a result of stop_gscan). -} wifi_scan_event; - -/* Format of information elements found in the beacon */ -typedef struct { - byte id; // element identifier - byte len; // number of bytes to follow - byte data[]; -} wifi_information_element; - -typedef struct { - wifi_timestamp ts; // time since boot (in microsecond) when the result was - // retrieved - char ssid[32 + 1]; // null terminated - mac_addr bssid; - wifi_channel channel; // channel frequency in MHz - wifi_rssi rssi; // in db - wifi_timespan rtt; // in nanoseconds - wifi_timespan rtt_sd; // standard deviation in rtt - unsigned short beacon_period; // period advertised in the beacon - unsigned short capability; // capabilities advertised in the beacon - unsigned int ie_length; // size of the ie_data blob - char ie_data[1]; // blob of all the information elements found in the - // beacon; this data should be a packed list of - // wifi_information_element objects, one after the other. - // other fields -} wifi_scan_result; - -static_assert( - MAX_BUCKETS <= 8 * sizeof(unsigned), - "The buckets_scanned bitset is represented by an unsigned int and cannot support this many " - "buckets on this platform."); -typedef struct { - /* reported when each probe response is received, if report_events - * enabled in wifi_scan_cmd_params. buckets_scanned is a bitset of the - * buckets that are currently being scanned. See the buckets_scanned field - * in the wifi_cached_scan_results struct for more details. - */ - void (*on_full_scan_result)(wifi_request_id id, wifi_scan_result* result, - unsigned buckets_scanned); - - /* indicates progress of scanning statemachine */ - void (*on_scan_event)(wifi_request_id id, wifi_scan_event event); - -} wifi_scan_result_handler; - -typedef struct { - wifi_channel channel; // frequency - int dwellTimeMs; // dwell time hint - int passive; // 0 => active, 1 => passive scan; ignored for DFS - /* Add channel class */ -} wifi_scan_channel_spec; - -#define REPORT_EVENTS_EACH_SCAN (1 << 0) -#define REPORT_EVENTS_FULL_RESULTS (1 << 1) -#define REPORT_EVENTS_NO_BATCH (1 << 2) - -typedef struct { - int bucket; // bucket index, 0 based - wifi_band band; // when UNSPECIFIED, use channel list - int period; // desired period, in millisecond; if this is too - // low, the firmware should choose to generate results as - // fast as it can instead of failing the command. - // for exponential backoff bucket this is the min_period - /* report_events semantics - - * This is a bit field; which defines following bits - - * REPORT_EVENTS_EACH_SCAN => report a scan completion event after scan. If this is not set - * then scan completion events should be reported if - * report_threshold_percent or report_threshold_num_scans is - * reached. - * REPORT_EVENTS_FULL_RESULTS => forward scan results (beacons/probe responses + IEs) - * in real time to HAL, in addition to completion events - * Note: To keep backward compatibility, fire completion - * events regardless of REPORT_EVENTS_EACH_SCAN. - * REPORT_EVENTS_NO_BATCH => controls if scans for this bucket should be placed in the - * history buffer - */ - byte report_events; - int max_period; // if max_period is non zero or different than period, then this bucket is - // an exponential backoff bucket and the scan period will grow exponentially - // as per formula: actual_period(N) = period * (base ^ (N/step_count)) - // to a maximum period of max_period - int base; // for exponential back off bucket: multiplier: new_period=old_period*base - int step_count; // for exponential back off bucket, number of scans to perform for a given - // period - - int num_channels; - // channels to scan; these may include DFS channels - // Note that a given channel may appear in multiple buckets - wifi_scan_channel_spec channels[MAX_CHANNELS]; -} wifi_scan_bucket_spec; - -typedef struct { - int base_period; // base timer period in ms - int max_ap_per_scan; // number of access points to store in each scan entry in - // the BSSID/RSSI history buffer (keep the highest RSSI - // access points) - int report_threshold_percent; // in %, when scan buffer is this much full, wake up apps - // processor - int report_threshold_num_scans; // in number of scans, wake up AP after these many scans - int num_buckets; - wifi_scan_bucket_spec buckets[MAX_BUCKETS]; -} wifi_scan_cmd_params; - -/* - * Start periodic GSCAN - * When this is called all requested buckets should be scanned, starting the beginning of the cycle - * - * For example: - * If there are two buckets specified - * - Bucket 1: period=10s - * - Bucket 2: period=20s - * - Bucket 3: period=30s - * Then the following scans should occur - * - t=0 buckets 1, 2, and 3 are scanned - * - t=10 bucket 1 is scanned - * - t=20 bucket 1 and 2 are scanned - * - t=30 bucket 1 and 3 are scanned - * - t=40 bucket 1 and 2 are scanned - * - t=50 bucket 1 is scanned - * - t=60 buckets 1, 2, and 3 are scanned - * - and the patter repeats - * - * If any scan does not occur or is incomplete (error, interrupted, etc) then a cached scan result - * should still be recorded with the WIFI_SCAN_FLAG_INTERRUPTED flag set. - */ -wifi_error wifi_start_gscan(wifi_request_id id, wifi_interface_handle iface, - wifi_scan_cmd_params params, wifi_scan_result_handler handler); - -/* Stop periodic GSCAN */ -wifi_error wifi_stop_gscan(wifi_request_id id, wifi_interface_handle iface); - -typedef enum { - WIFI_SCAN_FLAG_INTERRUPTED = 1 // Indicates that scan results are not complete because - // probes were not sent on some channels -} wifi_scan_flags; - -/* Get the GSCAN cached scan results */ -typedef struct { - int scan_id; // a unique identifier for the scan unit - int flags; // a bitmask with additional - // information about scan. - unsigned buckets_scanned; // a bitset of the buckets that were scanned. - // for example a value of 13 (0b1101) would - // indicate that buckets 0, 2 and 3 were - // scanned to produce this list of results. - // should be set to 0 if this information is - // not available. - int num_results; // number of bssids retrieved by the scan - wifi_scan_result results[MAX_AP_CACHE_PER_SCAN]; // scan results - one for each bssid -} wifi_cached_scan_results; - -wifi_error wifi_get_cached_gscan_results(wifi_interface_handle iface, byte flush, int max, - wifi_cached_scan_results* results, int* num); - -/* BSSID Hotlist */ -typedef struct { - void (*on_hotlist_ap_found)(wifi_request_id id, unsigned num_results, - wifi_scan_result* results); - void (*on_hotlist_ap_lost)(wifi_request_id id, unsigned num_results, wifi_scan_result* results); -} wifi_hotlist_ap_found_handler; - -typedef struct { - mac_addr bssid; // AP BSSID - wifi_rssi low; // low threshold - wifi_rssi high; // high threshold -} ap_threshold_param; - -typedef struct { - int lost_ap_sample_size; - int num_bssid; // number of hotlist APs - ap_threshold_param ap[MAX_HOTLIST_APS]; // hotlist APs -} wifi_bssid_hotlist_params; - -/* Set the BSSID Hotlist */ -wifi_error wifi_set_bssid_hotlist(wifi_request_id id, wifi_interface_handle iface, - wifi_bssid_hotlist_params params, - wifi_hotlist_ap_found_handler handler); - -/* Clear the BSSID Hotlist */ -wifi_error wifi_reset_bssid_hotlist(wifi_request_id id, wifi_interface_handle iface); - -/* SSID Hotlist */ -typedef struct { - void (*on_hotlist_ssid_found)(wifi_request_id id, unsigned num_results, - wifi_scan_result* results); - void (*on_hotlist_ssid_lost)(wifi_request_id id, unsigned num_results, - wifi_scan_result* results); -} wifi_hotlist_ssid_handler; - -typedef struct { - char ssid[32 + 1]; // SSID - wifi_band band; // band for this set of threshold params - wifi_rssi low; // low threshold - wifi_rssi high; // high threshold -} ssid_threshold_param; - -typedef struct { - int lost_ssid_sample_size; - int num_ssid; // number of hotlist SSIDs - ssid_threshold_param ssid[MAX_HOTLIST_SSID]; // hotlist SSIDs -} wifi_ssid_hotlist_params; - -/* Significant wifi change */ -typedef struct { - mac_addr bssid; // BSSID - wifi_channel channel; // channel frequency in MHz - int num_rssi; // number of rssi samples - wifi_rssi rssi[]; // RSSI history in db -} wifi_significant_change_result; - -typedef struct { - void (*on_significant_change)(wifi_request_id id, unsigned num_results, - wifi_significant_change_result** results); -} wifi_significant_change_handler; - -// The sample size parameters in the wifi_significant_change_params structure -// represent the number of occurence of a g-scan where the BSSID was seen and RSSI was -// collected for that BSSID, or, the BSSID was expected to be seen and didn't. -// for instance: lost_ap_sample_size : number of time a g-scan was performed on the -// channel the BSSID was seen last, and the BSSID was not seen during those g-scans -typedef struct { - int rssi_sample_size; // number of samples for averaging RSSI - int lost_ap_sample_size; // number of samples to confirm AP loss - int min_breaching; // number of APs breaching threshold - int num_bssid; // max 64 - ap_threshold_param ap[MAX_SIGNIFICANT_CHANGE_APS]; -} wifi_significant_change_params; - -/* Set the Signifcant AP change list */ -wifi_error wifi_set_significant_change_handler(wifi_request_id id, wifi_interface_handle iface, - wifi_significant_change_params params, - wifi_significant_change_handler handler); - -/* Clear the Signifcant AP change list */ -wifi_error wifi_reset_significant_change_handler(wifi_request_id id, wifi_interface_handle iface); - -/* Random MAC OUI for PNO */ -wifi_error wifi_set_scanning_mac_oui(wifi_interface_handle handle, oui scan_oui); - -// Enhanced PNO: -// Enhanced PNO feature is expected to be enabled all of the time (e.g. screen lit) and may thus -// require firmware to store a large number of networks, covering the whole list of known networks. -// Therefore, it is acceptable for firmware to store a crc24, crc32 or other short hash of the SSID, -// such that a low but non-zero probability of collision exist. With that scheme it should be -// possible for firmware to keep an entry as small as 4 bytes for each pno network. -// For instance, a firmware pn0 entry can be implemented in the form of: -// PNO ENTRY = crc24(3 bytes) | flags>>3 (5 bits) | auth flags(3 bits) -// -// No scans should be automatically performed by the chip. Instead all scan results from gscan -// should be scored and the wifi_epno_handler on_network_found callback should be called with -// the scan results. -// -// A PNO network shall be reported once, that is, once a network is reported by firmware -// its entry shall be marked as "done" until framework calls wifi_set_epno_list again. -// Calling wifi_set_epno_list shall reset the "done" status of pno networks in firmware. -// -// A network should only be considered found if its RSSI is above the minimum RSSI for its -// frequency range (min5GHz_rssi and min24GHz_rssi for 5GHz and 2.4GHz networks respectively). -// When disconnected the list of scan results should be returned if any network is found. -// When connected the scan results shall be reported only if the score of any network in the scan -// is greater than that of the currently connected BSSID. -// -// The FW should calculate the score of all the candidates (including currently connected one) -// with following equation: -// RSSI score = (RSSI + 85) * 4; -// If RSSI score > initial_score_max , RSSI score = initial_score_max; -// final score = RSSI score -// + current_connection_bonus (if currently connected BSSID) -// + same_network_bonus (if network has SAME_NETWORK flag) -// + secure_bonus (if the network is not open) -// + band5GHz_bonus (if BSSID is on 5G) -// If there is a BSSID’s score > current BSSID’s score, then report the cached scan results -// at the end of the scan (excluding the ones on blacklist) to the upper layer. -// Additionally, all BSSIDs that are in the BSSID blacklist should be ignored by Enhanced PNO - -// Whether directed scan needs to be performed (for hidden SSIDs) -#define WIFI_PNO_FLAG_DIRECTED_SCAN (1 << 0) -// Whether PNO event shall be triggered if the network is found on A band -#define WIFI_PNO_FLAG_A_BAND (1 << 1) -// Whether PNO event shall be triggered if the network is found on G band -#define WIFI_PNO_FLAG_G_BAND (1 << 2) -// Whether strict matching is required -// If required then the firmware must store the network's SSID and not just a hash -#define WIFI_PNO_FLAG_STRICT_MATCH (1 << 3) -// If this SSID should be considered the same network as the currently connected one for scoring -#define WIFI_PNO_FLAG_SAME_NETWORK (1 << 4) - -// Code for matching the beacon AUTH IE - additional codes TBD -#define WIFI_PNO_AUTH_CODE_OPEN (1 << 0) // open -#define WIFI_PNO_AUTH_CODE_PSK (1 << 1) // WPA_PSK or WPA2PSK -#define WIFI_PNO_AUTH_CODE_EAPOL (1 << 2) // any EAPOL - -typedef struct { - char ssid[32 + 1]; // null terminated - byte flags; // WIFI_PNO_FLAG_XXX - byte auth_bit_field; // auth bit field for matching WPA IE -} wifi_epno_network; - -/* ePNO Parameters */ -typedef struct { - int min5GHz_rssi; // minimum 5GHz RSSI for a BSSID to be considered - int min24GHz_rssi; // minimum 2.4GHz RSSI for a BSSID to be considered - int initial_score_max; // the maximum score that a network can have before bonuses - int current_connection_bonus; // only report when there is a network's score this much higher - // than the current connection. - int same_network_bonus; // score bonus for all networks with the same network flag - int secure_bonus; // score bonus for networks that are not open - int band5GHz_bonus; // 5GHz RSSI score bonus (applied to all 5GHz networks) - int num_networks; // number of wifi_epno_network objects - wifi_epno_network networks[MAX_EPNO_NETWORKS]; // PNO networks -} wifi_epno_params; - -typedef struct { - // on results - void (*on_network_found)(wifi_request_id id, unsigned num_results, wifi_scan_result* results); -} wifi_epno_handler; - -/* Set the ePNO list - enable ePNO with the given parameters */ -wifi_error wifi_set_epno_list(wifi_request_id id, wifi_interface_handle iface, - const wifi_epno_params* epno_params, wifi_epno_handler handler); - -/* Reset the ePNO list - no ePNO networks should be matched after this */ -wifi_error wifi_reset_epno_list(wifi_request_id id, wifi_interface_handle iface); - -typedef struct { - int id; // identifier of this network block, report this in event - char realm[256]; // null terminated UTF8 encoded realm, 0 if unspecified - int64_t roamingConsortiumIds[16]; // roaming consortium ids to match, 0s if unspecified - byte plmn[3]; // mcc/mnc combination as per rules, 0s if unspecified -} wifi_passpoint_network; - -typedef struct { - void (*on_passpoint_network_found)( - wifi_request_id id, - int net_id, // network block identifier for the matched network - wifi_scan_result* result, // scan result, with channel and beacon information - int anqp_len, // length of ANQP blob - byte* anqp // ANQP data, in the information_element format - ); -} wifi_passpoint_event_handler; - -/* Sets a list for passpoint networks for PNO purposes; it should be matched - * against any passpoint networks (designated by Interworking element) found - * during regular PNO scan. */ -wifi_error wifi_set_passpoint_list(wifi_request_id id, wifi_interface_handle iface, int num, - wifi_passpoint_network* networks, - wifi_passpoint_event_handler handler); - -/* Reset passpoint network list - no Passpoint networks should be matched after this */ -wifi_error wifi_reset_passpoint_list(wifi_request_id id, wifi_interface_handle iface); - -#endif diff --git a/wifi/1.6/default/hal_legacy/link_layer_stats.h b/wifi/1.6/default/hal_legacy/link_layer_stats.h deleted file mode 100644 index 7585cdfee4..0000000000 --- a/wifi/1.6/default/hal_legacy/link_layer_stats.h +++ /dev/null @@ -1,285 +0,0 @@ -#include "wifi_hal.h" - -#ifndef __WIFI_HAL_STATS_H -#define __WIFI_HAL_STATS_H - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define STATS_MAJOR_VERSION 1 -#define STATS_MINOR_VERSION 0 -#define STATS_MICRO_VERSION 0 - -typedef enum { - WIFI_DISCONNECTED = 0, - WIFI_AUTHENTICATING = 1, - WIFI_ASSOCIATING = 2, - WIFI_ASSOCIATED = 3, - WIFI_EAPOL_STARTED = 4, // if done by firmware/driver - WIFI_EAPOL_COMPLETED = 5, // if done by firmware/driver -} wifi_connection_state; - -typedef enum { - WIFI_ROAMING_IDLE = 0, - WIFI_ROAMING_ACTIVE = 1, -} wifi_roam_state; - -typedef enum { - WIFI_INTERFACE_STA = 0, - WIFI_INTERFACE_SOFTAP = 1, - WIFI_INTERFACE_IBSS = 2, - WIFI_INTERFACE_P2P_CLIENT = 3, - WIFI_INTERFACE_P2P_GO = 4, - WIFI_INTERFACE_NAN = 5, - WIFI_INTERFACE_MESH = 6, - WIFI_INTERFACE_TDLS = 7, - WIFI_INTERFACE_UNKNOWN = -1 -} wifi_interface_mode; - -#define WIFI_CAPABILITY_QOS 0x00000001 // set for QOS association -#define WIFI_CAPABILITY_PROTECTED \ - 0x00000002 // set for protected association (802.11 beacon frame control protected bit set) -#define WIFI_CAPABILITY_INTERWORKING \ - 0x00000004 // set if 802.11 Extended Capabilities element interworking bit is set -#define WIFI_CAPABILITY_HS20 0x00000008 // set for HS20 association -#define WIFI_CAPABILITY_SSID_UTF8 \ - 0x00000010 // set is 802.11 Extended Capabilities element UTF-8 SSID bit is set -#define WIFI_CAPABILITY_COUNTRY 0x00000020 // set is 802.11 Country Element is present - -typedef struct { - wifi_interface_mode mode; // interface mode - u8 mac_addr[6]; // interface mac address (self) - wifi_connection_state state; // connection state (valid for STA, CLI only) - wifi_roam_state roaming; // roaming state - u32 capabilities; // WIFI_CAPABILITY_XXX (self) - u8 ssid[33]; // null terminated SSID - u8 bssid[6]; // bssid - u8 ap_country_str[3]; // country string advertised by AP - u8 country_str[3]; // country string for this association - u8 time_slicing_duty_cycle_percent; // if this iface is being served using time slicing on a - // radio with one or more ifaces (i.e MCC), then the duty - // cycle assigned to this iface in %. If not using time - // slicing (i.e SCC or DBS), set to 100. -} wifi_interface_link_layer_info; - -/* channel information */ -typedef struct { - wifi_channel_width width; // channel width (20, 40, 80, 80+80, 160, 320) - wifi_channel center_freq; // primary 20 MHz channel - wifi_channel center_freq0; // center frequency (MHz) first segment - wifi_channel center_freq1; // center frequency (MHz) second segment -} wifi_channel_info; - -/* wifi rate */ -typedef struct { - u32 preamble : 3; // 0: OFDM, 1:CCK, 2:HT 3:VHT 4:HE 5:EHT 6..7 reserved - u32 nss : 2; // 0:1x1, 1:2x2, 3:3x3, 4:4x4 - u32 bw : 3; // 0:20MHz, 1:40Mhz, 2:80Mhz, 3:160Mhz 4:320Mhz - u32 rateMcsIdx : 8; // OFDM/CCK rate code would be as per ieee std in the units of 0.5mbps - // HT/VHT/HE/EHT it would be mcs index - u32 reserved : 16; // reserved - u32 bitrate; // units of 100 Kbps -} wifi_rate; - -/* channel statistics */ -typedef struct { - wifi_channel_info channel; // channel - u32 on_time; // msecs the radio is awake (32 bits number accruing over time) - u32 cca_busy_time; // msecs the CCA register is busy (32 bits number accruing over time) -} wifi_channel_stat; - -// Max number of tx power levels. The actual number vary per device and is specified by -// |num_tx_levels| -#define RADIO_STAT_MAX_TX_LEVELS 256 - -/* radio statistics */ -typedef struct { - wifi_radio radio; // wifi radio (if multiple radio supported) - u32 on_time; // msecs the radio is awake (32 bits number accruing over time) - u32 tx_time; // msecs the radio is transmitting (32 bits number accruing over time) - u32 num_tx_levels; // number of radio transmit power levels - u32* tx_time_per_levels; // pointer to an array of radio transmit per power levels in - // msecs accured over time - u32 rx_time; // msecs the radio is in active receive (32 bits number accruing over time) - u32 on_time_scan; // msecs the radio is awake due to all scan (32 bits number accruing over - // time) - u32 on_time_nbd; // msecs the radio is awake due to NAN (32 bits number accruing over time) - u32 on_time_gscan; // msecs the radio is awake due to G?scan (32 bits number accruing over - // time) - u32 on_time_roam_scan; // msecs the radio is awake due to roam?scan (32 bits number accruing - // over time) - u32 on_time_pno_scan; // msecs the radio is awake due to PNO scan (32 bits number accruing over - // time) - u32 on_time_hs20; // msecs the radio is awake due to HS2.0 scans and GAS exchange (32 bits - // number accruing over time) - u32 num_channels; // number of channels - wifi_channel_stat channels[]; // channel statistics -} wifi_radio_stat; - -/** - * Packet statistics reporting by firmware is performed on MPDU basi (i.e. counters increase by 1 - * for each MPDU) As well, "data packet" in associated comments, shall be interpreted as 802.11 data - * packet, that is, 802.11 frame control subtype == 2 and excluding management and control frames. - * - * As an example, in the case of transmission of an MSDU fragmented in 16 MPDUs which are - * transmitted OTA in a 16 units long a-mpdu, for which a block ack is received with 5 bits set: - * tx_mpdu : shall increase by 5 - * retries : shall increase by 16 - * tx_ampdu : shall increase by 1 - * data packet counters shall not increase regardless of the number of BAR potentially sent by - * device for this a-mpdu data packet counters shall not increase regardless of the number of BA - * received by device for this a-mpdu - * - * For each subsequent retransmission of the 11 remaining non ACK'ed mpdus - * (regardless of the fact that they are transmitted in a-mpdu or not) - * retries : shall increase by 1 - * - * If no subsequent BA or ACK are received from AP, until packet lifetime expires for those 11 - * packet that were not ACK'ed mpdu_lost : shall increase by 11 - */ - -/* per rate statistics */ -typedef struct { - wifi_rate rate; // rate information - u32 tx_mpdu; // number of successfully transmitted data pkts (ACK rcvd) - u32 rx_mpdu; // number of received data pkts - u32 mpdu_lost; // number of data packet losses (no ACK) - u32 retries; // total number of data pkt retries - u32 retries_short; // number of short data pkt retries - u32 retries_long; // number of long data pkt retries -} wifi_rate_stat; - -/* access categories */ -typedef enum { - WIFI_AC_VO = 0, - WIFI_AC_VI = 1, - WIFI_AC_BE = 2, - WIFI_AC_BK = 3, - WIFI_AC_MAX = 4, -} wifi_traffic_ac; - -/* wifi peer type */ -typedef enum { - WIFI_PEER_STA, - WIFI_PEER_AP, - WIFI_PEER_P2P_GO, - WIFI_PEER_P2P_CLIENT, - WIFI_PEER_NAN, - WIFI_PEER_TDLS, - WIFI_PEER_INVALID, -} wifi_peer_type; - -/* per peer statistics */ -typedef struct bssload_info { - u16 sta_count; // station count - u16 chan_util; // channel utilization - u8 PAD[4]; -} bssload_info_t; - -typedef struct { - wifi_peer_type type; // peer type (AP, TDLS, GO etc.) - u8 peer_mac_address[6]; // mac address - u32 capabilities; // peer WIFI_CAPABILITY_XXX - bssload_info_t bssload; // STA count and CU - u32 num_rate; // number of rates - wifi_rate_stat rate_stats[]; // per rate statistics, number of entries = num_rate -} wifi_peer_info; - -/* Per access category statistics */ -typedef struct { - wifi_traffic_ac ac; // access category (VI, VO, BE, BK) - u32 tx_mpdu; // number of successfully transmitted unicast data pkts (ACK rcvd) - u32 rx_mpdu; // number of received unicast data packets - u32 tx_mcast; // number of succesfully transmitted multicast data packets - // STA case: implies ACK received from AP for the unicast packet in which mcast - // pkt was sent - u32 rx_mcast; // number of received multicast data packets - u32 rx_ampdu; // number of received unicast a-mpdus; support of this counter is optional - u32 tx_ampdu; // number of transmitted unicast a-mpdus; support of this counter is optional - u32 mpdu_lost; // number of data pkt losses (no ACK) - u32 retries; // total number of data pkt retries - u32 retries_short; // number of short data pkt retries - u32 retries_long; // number of long data pkt retries - u32 contention_time_min; // data pkt min contention time (usecs) - u32 contention_time_max; // data pkt max contention time (usecs) - u32 contention_time_avg; // data pkt avg contention time (usecs) - u32 contention_num_samples; // num of data pkts used for contention statistics -} wifi_wmm_ac_stat; - -/* interface statistics */ -typedef struct { - wifi_interface_handle iface; // wifi interface - wifi_interface_link_layer_info info; // current state of the interface - u32 beacon_rx; // access point beacon received count from connected AP - u64 average_tsf_offset; // average beacon offset encountered (beacon_TSF - TBTT) - // The average_tsf_offset field is used so as to calculate the - // typical beacon contention time on the channel as well may be - // used to debug beacon synchronization and related power consumption - // issue - u32 leaky_ap_detected; // indicate that this AP typically leaks packets beyond the driver guard - // time. - u32 leaky_ap_avg_num_frames_leaked; // average number of frame leaked by AP after frame with PM - // bit set was ACK'ed by AP - u32 leaky_ap_guard_time; // guard time currently in force (when implementing IEEE power - // management based on frame control PM bit), How long driver waits - // before shutting down the radio and after receiving an ACK for a - // data frame with PM bit set) - u32 mgmt_rx; // access point mgmt frames received count from connected AP (including Beacon) - u32 mgmt_action_rx; // action frames received count - u32 mgmt_action_tx; // action frames transmit count - wifi_rssi rssi_mgmt; // access Point Beacon and Management frames RSSI (averaged) - wifi_rssi rssi_data; // access Point Data Frames RSSI (averaged) from connected AP - wifi_rssi rssi_ack; // access Point ACK RSSI (averaged) from connected AP - wifi_wmm_ac_stat ac[WIFI_AC_MAX]; // per ac data packet statistics - u32 num_peers; // number of peers - wifi_peer_info peer_info[]; // per peer statistics -} wifi_iface_stat; - -/* configuration params */ -typedef struct { - u32 mpdu_size_threshold; // threshold to classify the pkts as short or long - // packet size < mpdu_size_threshold => short - u32 aggressive_statistics_gathering; // set for field debug mode. Driver should collect all - // statistics regardless of performance impact. -} wifi_link_layer_params; - -/* API to trigger the link layer statistics collection. - Unless his API is invoked - link layer statistics will not be collected. - Radio statistics (once started) do not stop or get reset unless wifi_clear_link_stats is invoked - Interface statistics (once started) reset and start afresh after each connection */ -wifi_error wifi_set_link_stats(wifi_interface_handle iface, wifi_link_layer_params params); - -/* callback for reporting link layer stats */ -typedef struct { - void (*on_link_stats_results)(wifi_request_id id, wifi_iface_stat* iface_stat, int num_radios, - wifi_radio_stat* radio_stat); -} wifi_stats_result_handler; - -/* api to collect the link layer statistics for a given iface and all the radio stats */ -wifi_error wifi_get_link_stats(wifi_request_id id, wifi_interface_handle iface, - wifi_stats_result_handler handler); - -/* wifi statistics bitmap */ -#define WIFI_STATS_RADIO 0x00000001 // all radio statistics -#define WIFI_STATS_RADIO_CCA 0x00000002 // cca_busy_time (within radio statistics) -#define WIFI_STATS_RADIO_CHANNELS 0x00000004 // all channel statistics (within radio statistics) -#define WIFI_STATS_RADIO_SCAN 0x00000008 // all scan statistics (within radio statistics) -#define WIFI_STATS_IFACE 0x00000010 // all interface statistics -#define WIFI_STATS_IFACE_TXRATE 0x00000020 // all tx rate statistics (within interface statistics) -#define WIFI_STATS_IFACE_AC 0x00000040 // all ac statistics (within interface statistics) -#define WIFI_STATS_IFACE_CONTENTION \ - 0x00000080 // all contention (min, max, avg) statistics (within ac statisctics) - -/* clear api to reset statistics, stats_clear_rsp_mask identifies what stats have been cleared - stop_req = 1 will imply whether to stop the statistics collection. - stop_rsp = 1 will imply that stop_req was honored and statistics collection was stopped. - */ -wifi_error wifi_clear_link_stats(wifi_interface_handle iface, u32 stats_clear_req_mask, - u32* stats_clear_rsp_mask, u8 stop_req, u8* stop_rsp); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /*__WIFI_HAL_STATS_ */ diff --git a/wifi/1.6/default/hal_legacy/power.h b/wifi/1.6/default/hal_legacy/power.h deleted file mode 100644 index 2b6d12ac90..0000000000 --- a/wifi/1.6/default/hal_legacy/power.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -#ifndef _HARDWARE_POWER_H -#define _HARDWARE_POWER_H - -#include - -#if __cplusplus -extern "C" { -#endif - -enum { - PARTIAL_WAKE_LOCK = 1, // the cpu stays on, but the screen is off - FULL_WAKE_LOCK = 2 // the screen is also on -}; - -// while you have a lock held, the device will stay on at least at the -// level you request. -int acquire_wake_lock(int lock, const char* id); -int release_wake_lock(const char* id); - -#if __cplusplus -} // extern "C" -#endif - -#endif // _HARDWARE_POWER_H diff --git a/wifi/1.6/default/hal_legacy/roam.h b/wifi/1.6/default/hal_legacy/roam.h deleted file mode 100644 index 3369e3e3e0..0000000000 --- a/wifi/1.6/default/hal_legacy/roam.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef __WIFI_HAL_ROAM_H__ -#define __WIFI_HAL_ROAM_H__ - -#include "wifi_hal.h" - -#define MAX_BLACKLIST_BSSID 16 -#define MAX_WHITELIST_SSID 8 -#define MAX_SSID_LENGTH 32 - -typedef struct { - u32 max_blacklist_size; - u32 max_whitelist_size; -} wifi_roaming_capabilities; - -typedef enum { ROAMING_DISABLE, ROAMING_ENABLE } fw_roaming_state_t; - -typedef struct { - u32 length; - char ssid_str[MAX_SSID_LENGTH]; -} ssid_t; - -typedef struct { - u32 num_blacklist_bssid; // Number of bssids valid in blacklist_bssid[]. - mac_addr blacklist_bssid[MAX_BLACKLIST_BSSID]; // List of bssids which should not be considered - // for romaing by firmware/driver. - u32 num_whitelist_ssid; // Number of ssids valid in whitelist_ssid[]. - ssid_t whitelist_ssid[MAX_WHITELIST_SSID]; // List of ssids to which firmware/driver can - // consider to roam to. -} wifi_roaming_config; - -/* Get the chipset roaming capabilities. */ -wifi_error wifi_get_roaming_capabilities(wifi_interface_handle handle, - wifi_roaming_capabilities* caps); -/* Enable/disable firmware roaming */ -wifi_error wifi_enable_firmware_roaming(wifi_interface_handle handle, fw_roaming_state_t state); - -/* Pass down the blacklist BSSID and whitelist SSID to firmware. */ -wifi_error wifi_configure_roaming(wifi_interface_handle handle, - wifi_roaming_config* roaming_config); - -#endif /* __WIFI_HAL_ROAM_H__ */ diff --git a/wifi/1.6/default/hal_legacy/rtt.h b/wifi/1.6/default/hal_legacy/rtt.h deleted file mode 100644 index 8be7fd38ae..0000000000 --- a/wifi/1.6/default/hal_legacy/rtt.h +++ /dev/null @@ -1,314 +0,0 @@ - -#include "gscan.h" -#include "wifi_hal.h" - -#ifndef __WIFI_HAL_RTT_H__ -#define __WIFI_HAL_RTT_H__ - -/* Ranging status */ -typedef enum { - RTT_STATUS_SUCCESS = 0, - RTT_STATUS_FAILURE = 1, // general failure status - RTT_STATUS_FAIL_NO_RSP = 2, // target STA does not respond to request - RTT_STATUS_FAIL_REJECTED = 3, // request rejected. Applies to 2-sided RTT only - RTT_STATUS_FAIL_NOT_SCHEDULED_YET = 4, - RTT_STATUS_FAIL_TM_TIMEOUT = 5, // timing measurement times out - RTT_STATUS_FAIL_AP_ON_DIFF_CHANNEL = 6, // Target on different channel, cannot range - RTT_STATUS_FAIL_NO_CAPABILITY = 7, // ranging not supported - RTT_STATUS_ABORTED = 8, // request aborted for unknown reason - RTT_STATUS_FAIL_INVALID_TS = 9, // Invalid T1-T4 timestamp - RTT_STATUS_FAIL_PROTOCOL = 10, // 11mc protocol failed - RTT_STATUS_FAIL_SCHEDULE = 11, // request could not be scheduled - RTT_STATUS_FAIL_BUSY_TRY_LATER = 12, // responder cannot collaborate at time of request - RTT_STATUS_INVALID_REQ = 13, // bad request args - RTT_STATUS_NO_WIFI = 14, // WiFi not enabled - RTT_STATUS_FAIL_FTM_PARAM_OVERRIDE = - 15, // Responder overrides param info, cannot range with new params - RTT_STATUS_NAN_RANGING_PROTOCOL_FAILURE = 16, // Negotiation failure - RTT_STATUS_NAN_RANGING_CONCURRENCY_NOT_SUPPORTED = 17, // concurrency not supported (NDP+RTT) -} wifi_rtt_status; - -/* RTT peer type */ -typedef enum { - RTT_PEER_AP = 0x1, - RTT_PEER_STA = 0x2, - RTT_PEER_P2P_GO = 0x3, - RTT_PEER_P2P_CLIENT = 0x4, - RTT_PEER_NAN = 0x5 -} rtt_peer_type; - -/* RTT Measurement Bandwidth */ -typedef enum { - WIFI_RTT_BW_5 = 0x01, - WIFI_RTT_BW_10 = 0x02, - WIFI_RTT_BW_20 = 0x04, - WIFI_RTT_BW_40 = 0x08, - WIFI_RTT_BW_80 = 0x10, - WIFI_RTT_BW_160 = 0x20, - WIFI_RTT_BW_320 = 0x40 -} wifi_rtt_bw; - -/* RTT Measurement Preamble */ -typedef enum { - WIFI_RTT_PREAMBLE_LEGACY = 0x1, - WIFI_RTT_PREAMBLE_HT = 0x2, - WIFI_RTT_PREAMBLE_VHT = 0x4, - WIFI_RTT_PREAMBLE_HE = 0x8, - WIFI_RTT_PREAMBLE_EHT = 0x10, -} wifi_rtt_preamble; - -/* RTT Type */ -typedef enum { - RTT_TYPE_1_SIDED = 0x1, - RTT_TYPE_2_SIDED = 0x2, -} wifi_rtt_type; - -/* RTT configuration */ -typedef struct { - mac_addr addr; // peer device mac address - wifi_rtt_type type; // 1-sided or 2-sided RTT - rtt_peer_type peer; // optional - peer device hint (STA, P2P, AP) - wifi_channel_info channel; // Required for STA-AP mode, optional for P2P, NBD etc. - unsigned burst_period; // Time interval between bursts (units: 100 ms). - // Applies to 1-sided and 2-sided RTT multi-burst requests. - // Range: 0-31, 0: no preference by initiator (2-sided RTT) - unsigned num_burst; // Total number of RTT bursts to be executed. It will be - // specified in the same way as the parameter "Number of - // Burst Exponent" found in the FTM frame format. It - // applies to both: 1-sided RTT and 2-sided RTT. Valid - // values are 0 to 15 as defined in 802.11mc std. - // 0 means single shot - // The implication of this parameter on the maximum - // number of RTT results is the following: - // for 1-sided RTT: max num of RTT results = - // (2^num_burst)*(num_frames_per_burst) for 2-sided RTT: max num of RTT - // results = (2^num_burst)*(num_frames_per_burst - 1) - unsigned num_frames_per_burst; // num of frames per burst. - // Minimum value = 1, Maximum value = 31 - // For 2-sided this equals the number of FTM frames - // to be attempted in a single burst. This also - // equals the number of FTM frames that the - // initiator will request that the responder send - // in a single frame. - unsigned - num_retries_per_rtt_frame; // number of retries for a failed RTT frame. Applies - // to 1-sided RTT only. Minimum value = 0, Maximum value = 3 - - // following fields are only valid for 2-side RTT - unsigned num_retries_per_ftmr; // Maximum number of retries that the initiator can - // retry an FTMR frame. - // Minimum value = 0, Maximum value = 3 - byte LCI_request; // 1: request LCI, 0: do not request LCI - byte LCR_request; // 1: request LCR, 0: do not request LCR - unsigned burst_duration; // Applies to 1-sided and 2-sided RTT. Valid values will - // be 2-11 and 15 as specified by the 802.11mc std for - // the FTM parameter burst duration. In a multi-burst - // request, if responder overrides with larger value, - // the initiator will return failure. In a single-burst - // request if responder overrides with larger value, - // the initiator will sent TMR_STOP to terminate RTT - // at the end of the burst_duration it requested. - wifi_rtt_preamble preamble; // RTT preamble to be used in the RTT frames - wifi_rtt_bw bw; // RTT BW to be used in the RTT frames -} wifi_rtt_config; - -/* RTT results */ -typedef struct { - mac_addr addr; // device mac address - unsigned burst_num; // burst number in a multi-burst request - unsigned measurement_number; // Total RTT measurement frames attempted - unsigned success_number; // Total successful RTT measurement frames - byte number_per_burst_peer; // Maximum number of "FTM frames per burst" supported by - // the responder STA. Applies to 2-sided RTT only. - // If reponder overrides with larger value: - // - for single-burst request initiator will truncate the - // larger value and send a TMR_STOP after receiving as - // many frames as originally requested. - // - for multi-burst request, initiator will return - // failure right away. - wifi_rtt_status status; // ranging status - byte retry_after_duration; // When status == RTT_STATUS_FAIL_BUSY_TRY_LATER, - // this will be the time provided by the responder as to - // when the request can be tried again. Applies to 2-sided - // RTT only. In sec, 1-31sec. - wifi_rtt_type type; // RTT type - wifi_rssi rssi; // average rssi in 0.5 dB steps e.g. 143 implies -71.5 dB - wifi_rssi rssi_spread; // rssi spread in 0.5 dB steps e.g. 5 implies 2.5 dB spread (optional) - wifi_rate tx_rate; // 1-sided RTT: TX rate of RTT frame. - // 2-sided RTT: TX rate of initiator's Ack in response to FTM frame. - wifi_rate rx_rate; // 1-sided RTT: TX rate of Ack from other side. - // 2-sided RTT: TX rate of FTM frame coming from responder. - wifi_timespan rtt; // round trip time in picoseconds - wifi_timespan rtt_sd; // rtt standard deviation in picoseconds - wifi_timespan rtt_spread; // difference between max and min rtt times recorded in picoseconds - int distance_mm; // distance in mm (optional) - int distance_sd_mm; // standard deviation in mm (optional) - int distance_spread_mm; // difference between max and min distance recorded in mm (optional) - wifi_timestamp ts; // time of the measurement (in microseconds since boot) - int burst_duration; // in ms, actual time taken by the FW to finish one burst - // measurement. Applies to 1-sided and 2-sided RTT. - int negotiated_burst_num; // Number of bursts allowed by the responder. Applies - // to 2-sided RTT only. - wifi_information_element* LCI; // for 11mc only - wifi_information_element* LCR; // for 11mc only -} wifi_rtt_result; - -/* RTT result callback */ -typedef struct { - void (*on_rtt_results)(wifi_request_id id, unsigned num_results, wifi_rtt_result* rtt_result[]); -} wifi_rtt_event_handler; - -/* API to request RTT measurement */ -wifi_error wifi_rtt_range_request(wifi_request_id id, wifi_interface_handle iface, - unsigned num_rtt_config, wifi_rtt_config rtt_config[], - wifi_rtt_event_handler handler); - -/* API to cancel RTT measurements */ -wifi_error wifi_rtt_range_cancel(wifi_request_id id, wifi_interface_handle iface, - unsigned num_devices, mac_addr addr[]); - -/* NBD ranging channel map */ -typedef struct { - wifi_channel availablity[32]; // specifies the channel map for each of the 16 TU windows - // frequency of 0 => unspecified; which means firmware is - // free to do whatever it wants in this window. -} wifi_channel_map; - -/* API to start publishing the channel map on responder device in a NBD cluster. - Responder device will take this request and schedule broadcasting the channel map - in a NBD ranging attribute in a SDF. DE will automatically remove the ranging - attribute from the OTA queue after number of DW specified by num_dw - where Each DW is 512 TUs apart */ -wifi_error wifi_rtt_channel_map_set(wifi_request_id id, wifi_interface_handle iface, - wifi_channel_map* params, unsigned num_dw); - -/* API to clear the channel map on the responder device in a NBD cluster. - Responder device will cancel future ranging channel request, starting from “next” - DW interval and will also stop broadcasting NBD ranging attribute in SDF */ -wifi_error wifi_rtt_channel_map_clear(wifi_request_id id, wifi_interface_handle iface); - -// Preamble definition for bit mask used in wifi_rtt_capabilities -#define PREAMBLE_LEGACY 0x1 -#define PREAMBLE_HT 0x2 -#define PREAMBLE_VHT 0x4 -#define PREAMBLE_HE 0x8 -#define PREAMBLE_EHT 0x10 - -// BW definition for bit mask used in wifi_rtt_capabilities -#define BW_5_SUPPORT 0x1 -#define BW_10_SUPPORT 0x2 -#define BW_20_SUPPORT 0x4 -#define BW_40_SUPPORT 0x8 -#define BW_80_SUPPORT 0x10 -#define BW_160_SUPPORT 0x20 -#define BW_320_SUPPORT 0x40 - -/* RTT Capabilities */ -typedef struct { - byte rtt_one_sided_supported; // if 1-sided rtt data collection is supported - byte rtt_ftm_supported; // if ftm rtt data collection is supported - byte lci_support; // if initiator supports LCI request. Applies to 2-sided RTT - byte lcr_support; // if initiator supports LCR request. Applies to 2-sided RTT - byte preamble_support; // bit mask indicates what preamble is supported by initiator - byte bw_support; // bit mask indicates what BW is supported by initiator - byte responder_supported; // if 11mc responder mode is supported - byte mc_version; // draft 11mc spec version supported by chip. For instance, - // version 4.0 should be 40 and version 4.3 should be 43 etc. -} wifi_rtt_capabilities; - -/* RTT capabilities of the device */ -wifi_error wifi_get_rtt_capabilities(wifi_interface_handle iface, - wifi_rtt_capabilities* capabilities); - -/* debugging definitions */ -enum { - RTT_DEBUG_DISABLE, - RTT_DEBUG_LOG, - RTT_DEBUG_PROTO, - RTT_DEBUG_BURST, - RTT_DEBUG_ACCURACY, - RTT_DEBUG_LOGDETAIL -}; // rtt debug type - -enum { RTT_DEBUG_FORMAT_TXT, RTT_DEBUG_FORMAT_BINARY }; // rtt debug format - -typedef struct rtt_debug { - unsigned version; - unsigned len; // total length of after len field - unsigned type; // rtt debug type - unsigned format; // rtt debug format - char dbuf[0]; // debug content -} rtt_debug_t; - -/* set configuration for debug */ -wifi_error wifi_rtt_debug_cfg(wifi_interface_handle h, unsigned rtt_dbg_type, char* cfgbuf, - unsigned cfg_buf_size); -/* get the debug information */ -wifi_error wifi_rtt_debug_get(wifi_interface_handle h, rtt_debug_t** debugbuf); -/* free the debug buffer */ -wifi_error wifi_rtt_debug_free(wifi_interface_handle h, rtt_debug_t* debugbuf); - -/* API for setting LCI/LCR information to be provided to a requestor */ -typedef enum { - WIFI_MOTION_NOT_EXPECTED = 0, // Not expected to change location - WIFI_MOTION_EXPECTED = 1, // Expected to change location - WIFI_MOTION_UNKNOWN = 2, // Movement pattern unknown -} wifi_motion_pattern; - -typedef struct { - long latitude; // latitude in degrees * 2^25 , 2's complement - long longitude; // latitude in degrees * 2^25 , 2's complement - int altitude; // Altitude in units of 1/256 m - byte latitude_unc; // As defined in Section 2.3.2 of IETF RFC 6225 - byte longitude_unc; // As defined in Section 2.3.2 of IETF RFC 6225 - byte altitude_unc; // As defined in Section 2.4.5 from IETF RFC 6225: - - // Following element for configuring the Z subelement - wifi_motion_pattern motion_pattern; - int floor; // floor in units of 1/16th of floor. 0x80000000 if unknown. - int height_above_floor; // in units of 1/64 m - int height_unc; // in units of 1/64 m. 0 if unknown -} wifi_lci_information; - -typedef struct { - char country_code[2]; // country code - int length; // length of the info field - char civic_info[256]; // Civic info to be copied in FTM frame -} wifi_lcr_information; - -// API to configure the LCI. Used in RTT Responder mode only -wifi_error wifi_set_lci(wifi_request_id id, wifi_interface_handle iface, wifi_lci_information* lci); - -// API to configure the LCR. Used in RTT Responder mode only. -wifi_error wifi_set_lcr(wifi_request_id id, wifi_interface_handle iface, wifi_lcr_information* lcr); - -/** - * RTT Responder information - */ -typedef struct { - wifi_channel_info channel; - wifi_rtt_preamble preamble; -} wifi_rtt_responder; - -/** - * Get RTT responder information e.g. WiFi channel to enable responder on. - */ -wifi_error wifi_rtt_get_responder_info(wifi_interface_handle iface, - wifi_rtt_responder* responder_info); - -/** - * Enable RTT responder mode. - * channel_hint - hint of the channel information where RTT responder should be enabled on. - * max_duration_seconds - timeout of responder mode. - * channel_used - channel used for RTT responder, NULL if responder is not enabled. - */ -wifi_error wifi_enable_responder(wifi_request_id id, wifi_interface_handle iface, - wifi_channel_info channel_hint, unsigned max_duration_seconds, - wifi_rtt_responder* responder_info); - -/** - * Disable RTT responder mode. - */ -wifi_error wifi_disable_responder(wifi_request_id id, wifi_interface_handle iface); - -#endif diff --git a/wifi/1.6/default/hal_legacy/tdls.h b/wifi/1.6/default/hal_legacy/tdls.h deleted file mode 100644 index 787b13a338..0000000000 --- a/wifi/1.6/default/hal_legacy/tdls.h +++ /dev/null @@ -1,84 +0,0 @@ - -#include "wifi_hal.h" - -#ifndef _TDLS_H_ -#define _TDLS_H_ - -typedef enum { - WIFI_TDLS_DISABLED = 1, /* TDLS is not enabled, default status for all STAs */ - WIFI_TDLS_ENABLED, /* TDLS is enabled, but not yet tried */ - WIFI_TDLS_ESTABLISHED, /* Direct link is established */ - WIFI_TDLS_ESTABLISHED_OFF_CHANNEL, /* Direct link is established using MCC */ - WIFI_TDLS_DROPPED, /* Direct link was established, - * but is temporarily dropped now */ - WIFI_TDLS_FAILED /* TDLS permanent failed. Inform error to upper layer - * and go back to WIFI_TDLS_DISABLED */ -} wifi_tdls_state; - -typedef enum { - WIFI_TDLS_SUCCESS, /* Success */ - WIFI_TDLS_UNSPECIFIED = -1, /* Unspecified reason */ - WIFI_TDLS_NOT_SUPPORTED = -2, /* Remote side doesn't support TDLS */ - WIFI_TDLS_UNSUPPORTED_BAND = -3, /* Remote side doesn't support this band */ - WIFI_TDLS_NOT_BENEFICIAL = -4, /* Going to AP is better than going direct */ - WIFI_TDLS_DROPPED_BY_REMOTE = -5 /* Remote side doesn't want it anymore */ -} wifi_tdls_reason; - -typedef struct { - int channel; /* channel hint, in channel number (NOT frequency ) */ - int global_operating_class; /* operating class to use */ - int max_latency_ms; /* max latency that can be tolerated by apps */ - int min_bandwidth_kbps; /* bandwidth required by apps, in kilo bits per second */ -} wifi_tdls_params; - -typedef struct { - int channel; - int global_operating_class; - wifi_tdls_state state; - wifi_tdls_reason reason; -} wifi_tdls_status; - -typedef struct { - int max_concurrent_tdls_session_num; /* Maximum TDLS session number can be supported by the - * Firmware and hardware*/ - int is_global_tdls_supported; /* 1 -- support, 0 -- not support */ - int is_per_mac_tdls_supported; /* 1 -- support, 0 -- not support */ - int is_off_channel_tdls_supported; /* 1 -- support, 0 -- not support */ -} wifi_tdls_capabilities; - -typedef struct { - /* on_tdls_state_changed - reports state of TDLS link to framework - * Report this event when the state of TDLS link changes */ - void (*on_tdls_state_changed)(mac_addr addr, wifi_tdls_status status); -} wifi_tdls_handler; - -/* wifi_enable_tdls - enables TDLS-auto mode for a specific route - * - * params specifies hints, which provide more information about - * why TDLS is being sought. The firmware should do its best to - * honor the hints before downgrading regular AP link - * If upper layer has no specific values, this should be NULL - * - * handler is used to inform the upper layer about the status change and the corresponding reason - */ -wifi_error wifi_enable_tdls(wifi_interface_handle iface, mac_addr addr, wifi_tdls_params* params, - wifi_tdls_handler handler); - -/* wifi_disable_tdls - disables TDLS-auto mode for a specific route - * - * This terminates any existing TDLS with addr device, and frees the - * device resources to make TDLS connections on new routes. - * - * DON'T fire any more events on 'handler' specified in earlier call to - * wifi_enable_tdls after this action. - */ -wifi_error wifi_disable_tdls(wifi_interface_handle iface, mac_addr addr); - -/* wifi_get_tdls_status - allows getting the status of TDLS for a specific route */ -wifi_error wifi_get_tdls_status(wifi_interface_handle iface, mac_addr addr, - wifi_tdls_status* status); - -/* return the current HW + Firmware combination's TDLS capabilities */ -wifi_error wifi_get_tdls_capabilities(wifi_interface_handle iface, - wifi_tdls_capabilities* capabilities); -#endif diff --git a/wifi/1.6/default/hal_legacy/uevent.h b/wifi/1.6/default/hal_legacy/uevent.h deleted file mode 100644 index 5b82b327e4..0000000000 --- a/wifi/1.6/default/hal_legacy/uevent.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -#ifndef _HARDWARE_UEVENT_H -#define _HARDWARE_UEVENT_H - -#if __cplusplus -extern "C" { -#endif - -int uevent_init(); -int uevent_get_fd(); -int uevent_next_event(char* buffer, int buffer_length); -int uevent_add_native_handler(void (*handler)(void* data, const char* msg, int msg_len), - void* handler_data); -int uevent_remove_native_handler(void (*handler)(void* data, const char* msg, int msg_len)); - -#if __cplusplus -} // extern "C" -#endif - -#endif // _HARDWARE_UEVENT_H diff --git a/wifi/1.6/default/hal_legacy/wifi_cached_scan_results.h b/wifi/1.6/default/hal_legacy/wifi_cached_scan_results.h deleted file mode 100644 index c7392c24f1..0000000000 --- a/wifi/1.6/default/hal_legacy/wifi_cached_scan_results.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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. - */ - -#ifndef __WIFI_CACHED_SCAN_RESULTS_H__ -#define __WIFI_CACHED_SCAN_RESULTS_H__ - -#include "wifi_hal.h" - -#define WIFI_CACHED_SCAN_RESULT_FLAGS_NONE (0) -/* Element ID 61 (HT Operation) is present (see HT 7.3.2) */ -#define WIFI_CACHED_SCAN_RESULT_FLAGS_HT_OPS_PRESENT (1 << 0) -/* Element ID 192 (VHT Operation) is present (see VHT 8.4.2) */ -#define WIFI_CACHED_SCAN_RESULT_FLAGS_VHT_OPS_PRESENT (1 << 1) -/* Element ID 255 + Extension 36 (HE Operation) is present - * (see 802.11ax 9.4.2.1) - */ -#define WIFI_CACHED_SCAN_RESULT_FLAGS_HE_OPS_PRESENT (1 << 2) -/* Element ID 255 + Extension 106 (HE Operation) is present - * (see 802.11be D1.5 9.4.2.1) - */ -#define WIFI_CACHED_SCAN_RESULT_FLAGS_EHT_OPS_PRESENT (1 << 3) -/* Element ID 127 (Extended Capabilities) is present, and bit 70 - * (Fine Timing Measurement Responder) is set to 1 - * (see IEEE Std 802.11-2016 9.4.2.27) - */ -#define WIFI_CACHED_SCAN_RESULT_FLAGS_IS_FTM_RESPONDER (1 << 4) - -/** - * Provides information about a single access point (AP) detected in a scan. - */ -typedef struct { - /* Number of milliseconds prior to ts in the enclosing - * wifi_cached_scan_result_report struct when - * the probe response or beacon frame that - * was used to populate this structure was received. - */ - u32 age_ms; - /* The Capability Information field */ - u16 capability; - /* null terminated */ - u8 ssid[33]; - u8 ssid_len; - u8 bssid[6]; - /* A set of flags from WIFI_CACHED_SCAN_RESULT_FLAGS_* */ - u8 flags; - s8 rssi; - wifi_channel_spec chanspec; -} wifi_cached_scan_result; - -/* - * Data structure sent with events of type WifiCachedScanResult. - */ -typedef struct { - /* time since boot (in microsecond) when the result was retrieved */ - wifi_timestamp ts; - /* If 0, indicates that all frequencies in current regulation were - * scanned. Otherwise, indicates the number of frequencies scanned, as - * specified in scanned_freq_list. - */ - u16 scanned_freq_num; - /* Pointer to an array containing scanned_freq_num values comprising the - * set of frequencies that were scanned. Frequencies are specified as - * channel center frequencies in MHz. May be NULL if scannedFreqListLen is - * 0. - */ - const u32* scanned_freq_list; - /* The total number of cached results returned. */ - u8 result_cnt; - /* Pointer to an array containing result_cnt entries. May be NULL if - * result_cnt is 0. - */ - const wifi_cached_scan_result* results; -} wifi_cached_scan_report; - -/* callback for reporting cached scan report */ -typedef struct { - void (*on_cached_scan_results)(wifi_cached_scan_report* cache_report); -} wifi_cached_scan_result_handler; -#endif diff --git a/wifi/1.6/default/hal_legacy/wifi_config.h b/wifi/1.6/default/hal_legacy/wifi_config.h deleted file mode 100644 index 459a3feb61..0000000000 --- a/wifi/1.6/default/hal_legacy/wifi_config.h +++ /dev/null @@ -1,44 +0,0 @@ -#include "wifi_hal.h" - -#ifndef __WIFI_HAL_CONFIG_H -#define __WIFI_HAL_CONFIG_H - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define CONFIG_MAJOR_VERSION 1 -#define CONFIG_MINOR_VERSION 0 -#define CONFIG_MICRO_VERSION 0 - -// whether the wifi chipset wakes at every dtim beacon or a multiple of the dtim period -// if extended_dtim is set to 3, the STA shall wake up every 3 DTIM beacons -wifi_error wifi_extended_dtim_config_set(wifi_request_id id, wifi_interface_handle iface, - int extended_dtim); - -// set the country code to driver -wifi_error wifi_set_country_code(wifi_interface_handle iface, const char* country_code); - -// set the wifi_iface stats averaging factor used to calculate -// statistics like average the TSF offset or average number of frame leaked -// For instance, upon beacon reception: -// current_avg = ((beacon_TSF - TBTT) * factor + previous_avg * (0x10000 - factor) ) / 0x10000 -// For instance, when evaluating leaky APs: -// current_avg = ((num frame received within guard time) * factor + previous_avg * (0x10000 - -// factor)) / 0x10000 - -wifi_error wifi_set_beacon_wifi_iface_stats_averaging_factor(wifi_request_id id, - wifi_interface_handle iface, - u16 factor); - -// configure guard time, i.e. when implementing IEEE power management based on -// frame control PM bit, how long driver waits before shutting down the radio and -// after receiving an ACK for a data frame with PM bit set -wifi_error wifi_set_guard_time(wifi_request_id id, wifi_interface_handle iface, u32 guard_time); - -#ifdef __cplusplus -} - -#endif /* __cplusplus */ - -#endif /*__WIFI_HAL_STATS_ */ diff --git a/wifi/1.6/default/hal_legacy/wifi_hal.h b/wifi/1.6/default/hal_legacy/wifi_hal.h deleted file mode 100644 index 383ba718a3..0000000000 --- a/wifi/1.6/default/hal_legacy/wifi_hal.h +++ /dev/null @@ -1,1020 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef __WIFI_HAL_H__ -#define __WIFI_HAL_H__ - -#ifdef __cplusplus -extern "C" { -#endif -#include - -#define IFNAMSIZ 16 - -/* typedefs */ -typedef unsigned char byte; -typedef unsigned char u8; -typedef signed char s8; -typedef uint16_t u16; -typedef uint32_t u32; -typedef int32_t s32; -typedef uint64_t u64; -typedef int64_t s64; -typedef int wifi_request_id; -typedef int wifi_channel; // indicates channel frequency in MHz -typedef int wifi_rssi; -typedef int wifi_radio; -typedef byte mac_addr[6]; -typedef byte oui[3]; -typedef int64_t wifi_timestamp; // In microseconds (us) -typedef int64_t wifi_timespan; // In picoseconds (ps) -typedef uint64_t feature_set; - -/* forward declarations */ -struct wifi_info; -struct wifi_interface_info; -typedef struct wifi_info* wifi_handle; -typedef struct wifi_interface_info* wifi_interface_handle; - -/* WiFi Common definitions */ -/* channel operating width */ -typedef enum { - WIFI_CHAN_WIDTH_20 = 0, - WIFI_CHAN_WIDTH_40 = 1, - WIFI_CHAN_WIDTH_80 = 2, - WIFI_CHAN_WIDTH_160 = 3, - WIFI_CHAN_WIDTH_80P80 = 4, - WIFI_CHAN_WIDTH_5 = 5, - WIFI_CHAN_WIDTH_10 = 6, - WIFI_CHAN_WIDTH_320 = 7, - WIFI_CHAN_WIDTH_INVALID = -1 -} wifi_channel_width; - -/* Pre selected Power scenarios to be applied from BDF file */ -typedef enum { - WIFI_POWER_SCENARIO_INVALID = -2, - WIFI_POWER_SCENARIO_DEFAULT = -1, - WIFI_POWER_SCENARIO_VOICE_CALL = 0, - WIFI_POWER_SCENARIO_ON_HEAD_CELL_OFF = 1, - WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON = 2, - WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF = 3, - WIFI_POWER_SCENARIO_ON_BODY_CELL_ON = 4, - WIFI_POWER_SCENARIO_ON_BODY_BT = 5, - WIFI_POWER_SCENARIO_ON_HEAD_HOTSPOT = 6, - WIFI_POWER_SCENARIO_ON_HEAD_HOTSPOT_MMW = 7, - WIFI_POWER_SCENARIO_ON_BODY_CELL_ON_BT = 8, - WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT = 9, - WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_BT = 10, - WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_MMW = 11, - WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_BT_MMW = 12, - WIFI_POWER_SCENARIO_ON_HEAD_CELL_OFF_UNFOLDED = 13, - WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON_UNFOLDED = 14, - WIFI_POWER_SCENARIO_ON_HEAD_HOTSPOT_UNFOLDED = 15, - WIFI_POWER_SCENARIO_ON_HEAD_HOTSPOT_MMW_UNFOLDED = 16, - WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF_UNFOLDED = 17, - WIFI_POWER_SCENARIO_ON_BODY_BT_UNFOLDED = 18, - WIFI_POWER_SCENARIO_ON_BODY_CELL_ON_UNFOLDED = 19, - WIFI_POWER_SCENARIO_ON_BODY_CELL_ON_BT_UNFOLDED = 20, - WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_UNFOLDED = 21, - WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_BT_UNFOLDED = 22, - WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_MMW_UNFOLDED = 23, - WIFI_POWER_SCENARIO_ON_BODY_HOTSPOT_BT_MMW_UNFOLDED = 24, -} wifi_power_scenario; - -typedef enum { - WIFI_LATENCY_MODE_NORMAL = 0, - WIFI_LATENCY_MODE_LOW = 1, -} wifi_latency_mode; - -/* Wifi Thermal mitigation modes */ -typedef enum { - WIFI_MITIGATION_NONE = 0, - WIFI_MITIGATION_LIGHT = 1, - WIFI_MITIGATION_MODERATE = 2, - WIFI_MITIGATION_SEVERE = 3, - WIFI_MITIGATION_CRITICAL = 4, - WIFI_MITIGATION_EMERGENCY = 5, -} wifi_thermal_mode; - -/* - * Wifi voice over IP mode - * may add new modes later, for example, voice + video over IP mode. - */ -typedef enum { - WIFI_VOIP_MODE_OFF = 0, - WIFI_VOIP_MODE_ON = 1, -} wifi_voip_mode; - -/* List of interface types supported */ -typedef enum { - WIFI_INTERFACE_TYPE_STA = 0, - WIFI_INTERFACE_TYPE_AP = 1, - WIFI_INTERFACE_TYPE_P2P = 2, - WIFI_INTERFACE_TYPE_NAN = 3, -} wifi_interface_type; - -/* - * enum wlan_mac_band - Band information corresponding to the WLAN MAC. - */ -typedef enum { - /* WLAN MAC Operates in 2.4 GHz Band */ - WLAN_MAC_2_4_BAND = 1 << 0, - /* WLAN MAC Operates in 5 GHz Band */ - WLAN_MAC_5_0_BAND = 1 << 1, - /* WLAN MAC Operates in 6 GHz Band */ - WLAN_MAC_6_0_BAND = 1 << 2, - /* WLAN MAC Operates in 60 GHz Band */ - WLAN_MAC_60_0_BAND = 1 << 3, -} wlan_mac_band; - -/* List of chre nan rtt state */ -typedef enum { - CHRE_PREEMPTED = 0, - CHRE_UNAVAILABLE = 1, - CHRE_AVAILABLE = 2, -} chre_nan_rtt_state; - -typedef struct { - wifi_channel_width width; - int center_frequency0; - int center_frequency1; - int primary_frequency; -} wifi_channel_spec; - -/* - * wifi_usable_channel specifies a channel frequency, bandwidth, and bitmask - * of modes allowed on the channel. - */ -typedef struct { - /* Channel frequency in MHz */ - wifi_channel freq; - /* Channel operating width (20, 40, 80, 160, 320 etc.) */ - wifi_channel_width width; - /* BIT MASK of BIT(WIFI_INTERFACE_*) represented by |wifi_interface_mode| - * Bitmask does not represent concurrency. - * Examples: - * - If a channel is usable only for STA, then only the WIFI_INTERFACE_STA - * bit would be set for that channel. - * - If 5GHz SAP is not allowed, then none of the 5GHz channels will have - * WIFI_INTERFACE_SOFTAP bit set. - * Note: TDLS bit is set only if there is a STA connection. TDLS bit is set - * on non-STA channels only if TDLS off channel is supported. - */ - u32 iface_mode_mask; -} wifi_usable_channel; - -/* - * wifi_usable_channel_filter - */ -typedef enum { - /* Filter Wifi channels that should be avoided due to cellular coex - * restrictions. Some Wifi channels can have extreme interference - * from/to cellular due to short frequency separation with neighboring - * cellular channels or when there is harmonic and intermodulation - * interference. Channels which only have some performance degradation - * (e.g. power back off is sufficient to deal with coexistence issue) - * can be included and should not be filtered out. - */ - WIFI_USABLE_CHANNEL_FILTER_CELLULAR_COEXISTENCE = 1 << 0, - /* Filter channels due to concurrency state. - * Examples: - * - 5GHz SAP operation may be supported in standalone mode, but if - * there is STA connection on 5GHz DFS channel, none of the 5GHz - * channels are usable for SAP if device does not support DFS SAP mode. - * - P2P GO may not be supported on indoor channels in EU during - * standalone mode but if there is a STA connection on indoor channel, - * P2P GO may be supported by some vendors on the same STA channel. - */ - WIFI_USABLE_CHANNEL_FILTER_CONCURRENCY = 1 << 1, - /* This Filter queries Wifi channels and bands that are supported for - * NAN3.1 Instant communication mode. This filter should only be applied to NAN interface. - * If 5G is supported default discovery channel 149/44 is considered, - * If 5G is not supported then channel 6 has to be considered. - * Based on regulatory domain if channel 149 and 44 are restricted, channel 6 should - * be considered for instant communication channel - */ - WIFI_USABLE_CHANNEL_FILTER_NAN_INSTANT_MODE = 1 << 2, -} wifi_usable_channel_filter; - -typedef enum { - WIFI_SUCCESS = 0, - WIFI_ERROR_NONE = 0, - WIFI_ERROR_UNKNOWN = -1, - WIFI_ERROR_UNINITIALIZED = -2, - WIFI_ERROR_NOT_SUPPORTED = -3, - WIFI_ERROR_NOT_AVAILABLE = -4, // Not available right now, but try later - WIFI_ERROR_INVALID_ARGS = -5, - WIFI_ERROR_INVALID_REQUEST_ID = -6, - WIFI_ERROR_TIMED_OUT = -7, - WIFI_ERROR_TOO_MANY_REQUESTS = -8, // Too many instances of this request - WIFI_ERROR_OUT_OF_MEMORY = -9, - WIFI_ERROR_BUSY = -10, -} wifi_error; - -typedef enum { - WIFI_ACCESS_CATEGORY_BEST_EFFORT = 0, - WIFI_ACCESS_CATEGORY_BACKGROUND = 1, - WIFI_ACCESS_CATEGORY_VIDEO = 2, - WIFI_ACCESS_CATEGORY_VOICE = 3 -} wifi_access_category; - -/* Antenna configuration */ -typedef enum { - WIFI_ANTENNA_UNSPECIFIED = 0, - WIFI_ANTENNA_1X1 = 1, - WIFI_ANTENNA_2X2 = 2, - WIFI_ANTENNA_3X3 = 3, - WIFI_ANTENNA_4X4 = 4, -} wifi_antenna_configuration; - -/* Wifi Radio configuration */ -typedef struct { - /* Operating band */ - wlan_mac_band band; - /* Antenna configuration */ - wifi_antenna_configuration antenna_cfg; -} wifi_radio_configuration; - -/* WiFi Radio Combination */ -typedef struct { - u32 num_radio_configurations; - wifi_radio_configuration radio_configurations[]; -} wifi_radio_combination; - -/* WiFi Radio combinations matrix */ -/* For Example in case of a chip which has two radios, where one radio is - * capable of 2.4GHz 2X2 only and another radio which is capable of either - * 5GHz or 6GHz 2X2, number of possible radio combinations in this case - * are 5 and possible combinations are - * {{{2G 2X2}}, //Standalone 2G - * {{5G 2X2}}, //Standalone 5G - * {{6G 2X2}}, //Standalone 6G - * {{2G 2X2}, {5G 2X2}}, //2G+5G DBS - * {{2G 2X2}, {6G 2X2}}} //2G+6G DBS - * Note: Since this chip doesn’t support 5G+6G simultaneous operation - * as there is only one radio which can support both, So it can only - * do MCC 5G+6G. This table should not get populated with possible MCC - * configurations. This is only for simultaneous radio configurations - * (such as Standalone, multi band simultaneous or single band simultaneous). - */ -typedef struct { - u32 num_radio_combinations; - /* Each row represents possible radio combinations */ - wifi_radio_combination radio_combinations[]; -} wifi_radio_combination_matrix; - -/* Initialize/Cleanup */ - -wifi_error wifi_initialize(wifi_handle* handle); - -/** - * wifi_wait_for_driver - * Function should block until the driver is ready to proceed. - * Any errors from this function is considered fatal & will fail the HAL startup sequence. - * - * on success returns WIFI_SUCCESS - * on failure returns WIFI_ERROR_TIMED_OUT - */ -wifi_error wifi_wait_for_driver_ready(void); - -typedef void (*wifi_cleaned_up_handler)(wifi_handle handle); -void wifi_cleanup(wifi_handle handle, wifi_cleaned_up_handler handler); -void wifi_event_loop(wifi_handle handle); - -/* Error handling */ -void wifi_get_error_info(wifi_error err, const char** msg); // return a pointer to a static string - -/* Feature enums */ -#define WIFI_FEATURE_INFRA (uint64_t)0x1 // Basic infrastructure mode -#define WIFI_FEATURE_INFRA_5G (uint64_t)0x2 // Support for 5 GHz Band -#define WIFI_FEATURE_HOTSPOT (uint64_t)0x4 // Support for GAS/ANQP -#define WIFI_FEATURE_P2P (uint64_t)0x8 // Wifi-Direct -#define WIFI_FEATURE_SOFT_AP (uint64_t)0x10 // Soft AP -#define WIFI_FEATURE_GSCAN (uint64_t)0x20 // Google-Scan APIs -#define WIFI_FEATURE_NAN (uint64_t)0x40 // Neighbor Awareness Networking -#define WIFI_FEATURE_D2D_RTT (uint64_t)0x80 // Device-to-device RTT -#define WIFI_FEATURE_D2AP_RTT (uint64_t)0x100 // Device-to-AP RTT -#define WIFI_FEATURE_BATCH_SCAN (uint64_t)0x200 // Batched Scan (legacy) -#define WIFI_FEATURE_PNO (uint64_t)0x400 // Preferred network offload -#define WIFI_FEATURE_ADDITIONAL_STA (uint64_t)0x800 // Support for two STAs -#define WIFI_FEATURE_TDLS (uint64_t)0x1000 // Tunnel directed link setup -#define WIFI_FEATURE_TDLS_OFFCHANNEL (uint64_t)0x2000 // Support for TDLS off channel -#define WIFI_FEATURE_EPR (uint64_t)0x4000 // Enhanced power reporting -#define WIFI_FEATURE_AP_STA (uint64_t)0x8000 // Support for AP STA Concurrency -#define WIFI_FEATURE_LINK_LAYER_STATS (uint64_t)0x10000 // Link layer stats collection -#define WIFI_FEATURE_LOGGER (uint64_t)0x20000 // WiFi Logger -#define WIFI_FEATURE_HAL_EPNO (uint64_t)0x40000 // WiFi PNO enhanced -#define WIFI_FEATURE_RSSI_MONITOR (uint64_t)0x80000 // RSSI Monitor -#define WIFI_FEATURE_MKEEP_ALIVE (uint64_t)0x100000 // WiFi mkeep_alive -#define WIFI_FEATURE_CONFIG_NDO (uint64_t)0x200000 // ND offload configure -#define WIFI_FEATURE_TX_TRANSMIT_POWER (uint64_t)0x400000 // Capture Tx transmit power levels -#define WIFI_FEATURE_CONTROL_ROAMING (uint64_t)0x800000 // Enable/Disable firmware roaming -#define WIFI_FEATURE_IE_WHITELIST (uint64_t)0x1000000 // Support Probe IE white listing -#define WIFI_FEATURE_SCAN_RAND \ - (uint64_t)0x2000000 // Support MAC & Probe Sequence Number randomization -#define WIFI_FEATURE_SET_TX_POWER_LIMIT (uint64_t)0x4000000 // Support Tx Power Limit setting -#define WIFI_FEATURE_USE_BODY_HEAD_SAR \ - (uint64_t)0x8000000 // Support Using Body/Head Proximity for SAR -#define WIFI_FEATURE_DYNAMIC_SET_MAC \ - (uint64_t)0x10000000 // Support changing MAC address without iface reset(down and up) -#define WIFI_FEATURE_SET_LATENCY_MODE (uint64_t)0x40000000 // Support Latency mode setting -#define WIFI_FEATURE_P2P_RAND_MAC (uint64_t)0x80000000 // Support P2P MAC randomization -#define WIFI_FEATURE_INFRA_60G (uint64_t)0x100000000 // Support for 60GHz Band -// Add more features here - -#define IS_MASK_SET(mask, flags) (((flags) & (mask)) == (mask)) - -#define IS_SUPPORTED_FEATURE(feature, featureSet) IS_MASK_SET(feature, featureSet) - -/* Feature set */ -wifi_error wifi_get_supported_feature_set(wifi_interface_handle handle, feature_set* set); - -/* - * Each row represents a valid feature combination; - * all other combinations are invalid! - */ -wifi_error wifi_get_concurrency_matrix(wifi_interface_handle handle, int set_size_max, - feature_set set[], int* set_size); - -/* multiple interface support */ - -wifi_error wifi_get_ifaces(wifi_handle handle, int* num_ifaces, wifi_interface_handle** ifaces); -wifi_error wifi_get_iface_name(wifi_interface_handle iface, char* name, size_t size); -wifi_interface_handle wifi_get_iface_handle(wifi_handle handle, char* name); - -/* STA + STA support - Supported if WIFI_FEATURE_ADDITIONAL_STA is set */ - -/** - * Invoked to indicate that the provided iface is the primary STA iface when there are more - * than 1 STA iface concurrently active. - * - * Note: If the wifi firmware/chip cannot support multiple instances of any offload - * (like roaming, APF, rssi threshold, etc), the firmware should ensure that these - * offloads are at least enabled for the primary interface. If the new primary interface is - * already connected to a network, the firmware must switch all the offloads on - * this new interface without disconnecting. - */ -wifi_error wifi_multi_sta_set_primary_connection(wifi_handle handle, wifi_interface_handle iface); - -/** - * When there are 2 or more simultaneous STA connections, this use case hint indicates what - * use-case is being enabled by the framework. This use case hint can be used by the firmware - * to modify various firmware configurations like: - * - Allowed BSSIDs the firmware can choose for the initial connection/roaming attempts. - * - Duty cycle to choose for the 2 STA connections if the radio is in MCC mode. - * - Whether roaming, APF and other offloads needs to be enabled or not. - * - * Note: - * - This will be invoked before an active wifi connection is established on the second interface. - * - This use-case hint is implicitly void when the second STA interface is brought down. - */ -typedef enum { - /** - * Usage: - * - This will be sent down for make before break use-case. - * - Platform is trying to speculatively connect to a second network and evaluate it without - * disrupting the primary connection. - * - * Requirements for Firmware: - * - Do not reduce the number of tx/rx chains of primary connection. - * - If using MCC, should set the MCC duty cycle of the primary connection to be higher than - * the secondary connection (maybe 70/30 split). - * - Should pick the best BSSID for the secondary STA (disregard the chip mode) independent of - * the primary STA: - * - Don’t optimize for DBS vs MCC/SCC - * - Should not impact the primary connection’s bssid selection: - * - Don’t downgrade chains of the existing primary connection. - * - Don’t optimize for DBS vs MCC/SCC. - */ - WIFI_DUAL_STA_TRANSIENT_PREFER_PRIMARY = 0, - /** - * Usage: - * - This will be sent down for any app requested peer to peer connections. - * - In this case, both the connections needs to be allocated equal resources. - * - For the peer to peer use case, BSSID for the secondary connection will be chosen by the - * framework. - * - * Requirements for Firmware: - * - Can choose MCC or DBS mode depending on the MCC efficiency and HW capability. - * - If using MCC, set the MCC duty cycle of the primary connection to be equal to the secondary - * connection. - * - Prefer BSSID candidates which will help provide the best "overall" performance for both the - * connections. - */ - WIFI_DUAL_STA_NON_TRANSIENT_UNBIASED = 1 -} wifi_multi_sta_use_case; - -wifi_error wifi_multi_sta_set_use_case(wifi_handle handle, wifi_multi_sta_use_case use_case); - -/* Configuration events */ - -typedef struct { - void (*on_country_code_changed)(char code[2]); // We can get this from supplicant too - - // More event handlers -} wifi_event_handler; - -typedef struct { - char iface_name[IFNAMSIZ + 1]; - wifi_channel channel; -} wifi_iface_info; - -typedef struct { - u32 wlan_mac_id; - /* BIT MASK of BIT(WLAN_MAC*) as represented by wlan_mac_band */ - u32 mac_band; - /* Represents the connected Wi-Fi interfaces associated with each MAC */ - int num_iface; - wifi_iface_info* iface_info; -} wifi_mac_info; - -typedef struct { - void (*on_radio_mode_change)(wifi_request_id id, unsigned num_mac, wifi_mac_info* mac_info); -} wifi_radio_mode_change_handler; - -typedef struct { - void (*on_rssi_threshold_breached)(wifi_request_id id, u8* cur_bssid, s8 cur_rssi); -} wifi_rssi_event_handler; - -typedef struct { - void (*on_subsystem_restart)(const char* error); -} wifi_subsystem_restart_handler; - -typedef struct { - void (*on_chre_nan_rtt_change)(chre_nan_rtt_state state); -} wifi_chre_handler; - -wifi_error wifi_set_iface_event_handler(wifi_request_id id, wifi_interface_handle iface, - wifi_event_handler eh); -wifi_error wifi_reset_iface_event_handler(wifi_request_id id, wifi_interface_handle iface); - -wifi_error wifi_set_nodfs_flag(wifi_interface_handle handle, u32 nodfs); -wifi_error wifi_select_tx_power_scenario(wifi_interface_handle handle, - wifi_power_scenario scenario); -wifi_error wifi_reset_tx_power_scenario(wifi_interface_handle handle); -wifi_error wifi_set_latency_mode(wifi_interface_handle handle, wifi_latency_mode mode); -wifi_error wifi_map_dscp_access_category(wifi_handle handle, uint32_t start, uint32_t end, - uint32_t access_category); -wifi_error wifi_reset_dscp_mapping(wifi_handle handle); - -wifi_error wifi_set_subsystem_restart_handler(wifi_handle handle, - wifi_subsystem_restart_handler handler); - -/** - * Wifi HAL Thermal Mitigation API - * - * wifi_handle : wifi global handle (note: this is not a interface specific - * command). Mitigation is expected to be applied across all active interfaces - * The implementation and the mitigation action mapping to each mode is chip - * specific. Mitigation will be active until Wifi is turned off or - * WIFI_MITIGATION_NONE mode is sent - * - * mode: Thermal mitigation mode - * WIFI_MITIGATION_NONE : Clear all Wifi thermal mitigation actions - * WIFI_MITIGATION_LIGHT : Light Throttling where UX is not impacted - * WIFI_MITIGATION_MODERATE : Moderate throttling where UX not largely impacted - * WIFI_MITIGATION_SEVERE : Severe throttling where UX is largely impacted - * WIFI_MITIGATION_CRITICAL : Platform has done everything to reduce power - * WIFI_MITIGATION_EMERGENCY: Key components in platform are shutting down - * - * completion_window - * Deadline (in milliseconds) to complete this request, value 0 implies apply - * immediately. Deadline is basically a relaxed limit and allows vendors to - * apply the mitigation within the window (if it cannot apply immediately) - * - * Return - * WIFI_ERROR_NOT_SUPPORTED : Chip does not support thermal mitigation - * WIFI_ERROR_BUSY : Mitigation is supported, but retry later - * WIFI_ERROR_NONE : Mitigation request has been accepted - */ -wifi_error wifi_set_thermal_mitigation_mode(wifi_handle handle, wifi_thermal_mode mode, - u32 completion_window); - -typedef struct rx_data_cnt_details_t { - int rx_unicast_cnt; /*Total rx unicast packet which woke up host */ - int rx_multicast_cnt; /*Total rx multicast packet which woke up host */ - int rx_broadcast_cnt; /*Total rx broadcast packet which woke up host */ -} RX_DATA_WAKE_CNT_DETAILS; - -typedef struct rx_wake_pkt_type_classification_t { - int icmp_pkt; /*wake icmp packet count */ - int icmp6_pkt; /*wake icmp6 packet count */ - int icmp6_ra; /*wake icmp6 RA packet count */ - int icmp6_na; /*wake icmp6 NA packet count */ - int icmp6_ns; /*wake icmp6 NS packet count */ - // ToDo: Any more interesting classification to add? -} RX_WAKE_PKT_TYPE_CLASSFICATION; - -typedef struct rx_multicast_cnt_t { - int ipv4_rx_multicast_addr_cnt; /*Rx wake packet was ipv4 multicast */ - int ipv6_rx_multicast_addr_cnt; /*Rx wake packet was ipv6 multicast */ - int other_rx_multicast_addr_cnt; /*Rx wake packet was non-ipv4 and non-ipv6*/ -} RX_MULTICAST_WAKE_DATA_CNT; - -/* - * Structure holding all the driver/firmware wake count reasons. - * - * Buffers for the array fields (cmd_event_wake_cnt/driver_fw_local_wake_cnt) - * are allocated and freed by the framework. The size of each allocated - * array is indicated by the corresponding |_cnt| field. HAL needs to fill in - * the corresponding |_used| field to indicate the number of elements used in - * the array. - */ -typedef struct wlan_driver_wake_reason_cnt_t { - int total_cmd_event_wake; /* Total count of cmd event wakes */ - int* cmd_event_wake_cnt; /* Individual wake count array, each index a reason */ - int cmd_event_wake_cnt_sz; /* Max number of cmd event wake reasons */ - int cmd_event_wake_cnt_used; /* Number of cmd event wake reasons specific to the driver */ - - int total_driver_fw_local_wake; /* Total count of drive/fw wakes, for local reasons */ - int* driver_fw_local_wake_cnt; /* Individual wake count array, each index a reason */ - int driver_fw_local_wake_cnt_sz; /* Max number of local driver/fw wake reasons */ - int driver_fw_local_wake_cnt_used; /* Number of local driver/fw wake reasons specific to the - driver */ - - int total_rx_data_wake; /* total data rx packets, that woke up host */ - RX_DATA_WAKE_CNT_DETAILS rx_wake_details; - RX_WAKE_PKT_TYPE_CLASSFICATION rx_wake_pkt_classification_info; - RX_MULTICAST_WAKE_DATA_CNT rx_multicast_wake_pkt_info; -} WLAN_DRIVER_WAKE_REASON_CNT; - -/* Wi-Fi coex channel avoidance support */ - -#define WIFI_COEX_NO_POWER_CAP (int32_t)0x7FFFFFF - -typedef enum { WIFI_AWARE = 1 << 0, SOFTAP = 1 << 1, WIFI_DIRECT = 1 << 2 } wifi_coex_restriction; - -/** - * Representation of a Wi-Fi channel to be avoided for Wi-Fi coex channel avoidance. - * - * band is represented as an WLAN_MAC* enum value defined in wlan_mac_band. - * If power_cap_dbm is WIFI_COEX_NO_POWER_CAP, then no power cap should be applied if the specified - * channel is used. - */ -typedef struct { - wlan_mac_band band; - u32 channel; - s32 power_cap_dbm; -} wifi_coex_unsafe_channel; - -/* include various feature headers */ - -#include "gscan.h" -#include "link_layer_stats.h" -#include "roam.h" -#include "rtt.h" -#include "tdls.h" -#include "wifi_cached_scan_results.h" -#include "wifi_config.h" -#include "wifi_logger.h" -#include "wifi_nan.h" -#include "wifi_offload.h" -#include "wifi_twt.h" - -// wifi HAL function pointer table -typedef struct { - wifi_error (*wifi_initialize)(wifi_handle*); - wifi_error (*wifi_wait_for_driver_ready)(void); - void (*wifi_cleanup)(wifi_handle, wifi_cleaned_up_handler); - void (*wifi_event_loop)(wifi_handle); - void (*wifi_get_error_info)(wifi_error, const char**); - wifi_error (*wifi_get_supported_feature_set)(wifi_interface_handle, feature_set*); - wifi_error (*wifi_get_concurrency_matrix)(wifi_interface_handle, int, feature_set*, int*); - wifi_error (*wifi_set_scanning_mac_oui)(wifi_interface_handle, unsigned char*); - wifi_error (*wifi_get_supported_channels)(wifi_handle, int*, wifi_channel*); - wifi_error (*wifi_is_epr_supported)(wifi_handle); - wifi_error (*wifi_get_ifaces)(wifi_handle, int*, wifi_interface_handle**); - wifi_error (*wifi_get_iface_name)(wifi_interface_handle, char* name, size_t); - wifi_error (*wifi_set_iface_event_handler)(wifi_request_id, wifi_interface_handle, - wifi_event_handler); - wifi_error (*wifi_reset_iface_event_handler)(wifi_request_id, wifi_interface_handle); - wifi_error (*wifi_start_gscan)(wifi_request_id, wifi_interface_handle, wifi_scan_cmd_params, - wifi_scan_result_handler); - wifi_error (*wifi_stop_gscan)(wifi_request_id, wifi_interface_handle); - wifi_error (*wifi_get_cached_gscan_results)(wifi_interface_handle, byte, int, - wifi_cached_scan_results*, int*); - wifi_error (*wifi_set_bssid_hotlist)(wifi_request_id, wifi_interface_handle, - wifi_bssid_hotlist_params, wifi_hotlist_ap_found_handler); - wifi_error (*wifi_reset_bssid_hotlist)(wifi_request_id, wifi_interface_handle); - wifi_error (*wifi_set_significant_change_handler)(wifi_request_id, wifi_interface_handle, - wifi_significant_change_params, - wifi_significant_change_handler); - wifi_error (*wifi_reset_significant_change_handler)(wifi_request_id, wifi_interface_handle); - wifi_error (*wifi_get_gscan_capabilities)(wifi_interface_handle, wifi_gscan_capabilities*); - wifi_error (*wifi_set_link_stats)(wifi_interface_handle, wifi_link_layer_params); - wifi_error (*wifi_get_link_stats)(wifi_request_id, wifi_interface_handle, - wifi_stats_result_handler); - wifi_error (*wifi_clear_link_stats)(wifi_interface_handle, u32, u32*, u8, u8*); - wifi_error (*wifi_get_valid_channels)(wifi_interface_handle, int, int, wifi_channel*, int*); - wifi_error (*wifi_rtt_range_request)(wifi_request_id, wifi_interface_handle, unsigned, - wifi_rtt_config[], wifi_rtt_event_handler); - wifi_error (*wifi_rtt_range_cancel)(wifi_request_id, wifi_interface_handle, unsigned, - mac_addr[]); - wifi_error (*wifi_get_rtt_capabilities)(wifi_interface_handle, wifi_rtt_capabilities*); - wifi_error (*wifi_rtt_get_responder_info)(wifi_interface_handle iface, - wifi_rtt_responder* responder_info); - wifi_error (*wifi_enable_responder)(wifi_request_id id, wifi_interface_handle iface, - wifi_channel_info channel_hint, - unsigned max_duration_seconds, - wifi_rtt_responder* responder_info); - wifi_error (*wifi_disable_responder)(wifi_request_id id, wifi_interface_handle iface); - wifi_error (*wifi_set_nodfs_flag)(wifi_interface_handle, u32); - wifi_error (*wifi_start_logging)(wifi_interface_handle, u32, u32, u32, u32, char*); - wifi_error (*wifi_set_epno_list)(wifi_request_id, wifi_interface_handle, - const wifi_epno_params*, wifi_epno_handler); - wifi_error (*wifi_reset_epno_list)(wifi_request_id, wifi_interface_handle); - wifi_error (*wifi_set_country_code)(wifi_interface_handle, const char*); - wifi_error (*wifi_get_firmware_memory_dump)(wifi_interface_handle iface, - wifi_firmware_memory_dump_handler handler); - wifi_error (*wifi_set_log_handler)(wifi_request_id id, wifi_interface_handle iface, - wifi_ring_buffer_data_handler handler); - wifi_error (*wifi_reset_log_handler)(wifi_request_id id, wifi_interface_handle iface); - wifi_error (*wifi_set_alert_handler)(wifi_request_id id, wifi_interface_handle iface, - wifi_alert_handler handler); - wifi_error (*wifi_reset_alert_handler)(wifi_request_id id, wifi_interface_handle iface); - wifi_error (*wifi_get_firmware_version)(wifi_interface_handle iface, char* buffer, - int buffer_size); - wifi_error (*wifi_get_ring_buffers_status)(wifi_interface_handle iface, u32* num_rings, - wifi_ring_buffer_status* status); - wifi_error (*wifi_get_logger_supported_feature_set)(wifi_interface_handle iface, - unsigned int* support); - wifi_error (*wifi_get_ring_data)(wifi_interface_handle iface, char* ring_name); - wifi_error (*wifi_enable_tdls)(wifi_interface_handle, mac_addr, wifi_tdls_params*, - wifi_tdls_handler); - wifi_error (*wifi_disable_tdls)(wifi_interface_handle, mac_addr); - wifi_error (*wifi_get_tdls_status)(wifi_interface_handle, mac_addr, wifi_tdls_status*); - wifi_error (*wifi_get_tdls_capabilities)(wifi_interface_handle iface, - wifi_tdls_capabilities* capabilities); - wifi_error (*wifi_get_driver_version)(wifi_interface_handle iface, char* buffer, - int buffer_size); - wifi_error (*wifi_set_passpoint_list)(wifi_request_id id, wifi_interface_handle iface, int num, - wifi_passpoint_network* networks, - wifi_passpoint_event_handler handler); - wifi_error (*wifi_reset_passpoint_list)(wifi_request_id id, wifi_interface_handle iface); - wifi_error (*wifi_set_lci)(wifi_request_id id, wifi_interface_handle iface, - wifi_lci_information* lci); - wifi_error (*wifi_set_lcr)(wifi_request_id id, wifi_interface_handle iface, - wifi_lcr_information* lcr); - wifi_error (*wifi_start_sending_offloaded_packet)(wifi_request_id id, - wifi_interface_handle iface, u16 ether_type, - u8* ip_packet, u16 ip_packet_len, - u8* src_mac_addr, u8* dst_mac_addr, - u32 period_msec); - wifi_error (*wifi_stop_sending_offloaded_packet)(wifi_request_id id, - wifi_interface_handle iface); - wifi_error (*wifi_start_rssi_monitoring)(wifi_request_id id, wifi_interface_handle iface, - s8 max_rssi, s8 min_rssi, wifi_rssi_event_handler eh); - wifi_error (*wifi_stop_rssi_monitoring)(wifi_request_id id, wifi_interface_handle iface); - wifi_error (*wifi_get_wake_reason_stats)(wifi_interface_handle iface, - WLAN_DRIVER_WAKE_REASON_CNT* wifi_wake_reason_cnt); - wifi_error (*wifi_configure_nd_offload)(wifi_interface_handle iface, u8 enable); - wifi_error (*wifi_get_driver_memory_dump)(wifi_interface_handle iface, - wifi_driver_memory_dump_callbacks callbacks); - wifi_error (*wifi_start_pkt_fate_monitoring)(wifi_interface_handle iface); - wifi_error (*wifi_get_tx_pkt_fates)(wifi_interface_handle handle, - wifi_tx_report* tx_report_bufs, size_t n_requested_fates, - size_t* n_provided_fates); - wifi_error (*wifi_get_rx_pkt_fates)(wifi_interface_handle handle, - wifi_rx_report* rx_report_bufs, size_t n_requested_fates, - size_t* n_provided_fates); - - /* NAN functions */ - wifi_error (*wifi_nan_enable_request)(transaction_id id, wifi_interface_handle iface, - NanEnableRequest* msg); - wifi_error (*wifi_nan_disable_request)(transaction_id id, wifi_interface_handle iface); - wifi_error (*wifi_nan_publish_request)(transaction_id id, wifi_interface_handle iface, - NanPublishRequest* msg); - wifi_error (*wifi_nan_publish_cancel_request)(transaction_id id, wifi_interface_handle iface, - NanPublishCancelRequest* msg); - wifi_error (*wifi_nan_subscribe_request)(transaction_id id, wifi_interface_handle iface, - NanSubscribeRequest* msg); - wifi_error (*wifi_nan_subscribe_cancel_request)(transaction_id id, wifi_interface_handle iface, - NanSubscribeCancelRequest* msg); - wifi_error (*wifi_nan_transmit_followup_request)(transaction_id id, wifi_interface_handle iface, - NanTransmitFollowupRequest* msg); - wifi_error (*wifi_nan_stats_request)(transaction_id id, wifi_interface_handle iface, - NanStatsRequest* msg); - wifi_error (*wifi_nan_config_request)(transaction_id id, wifi_interface_handle iface, - NanConfigRequest* msg); - wifi_error (*wifi_nan_tca_request)(transaction_id id, wifi_interface_handle iface, - NanTCARequest* msg); - wifi_error (*wifi_nan_beacon_sdf_payload_request)(transaction_id id, - wifi_interface_handle iface, - NanBeaconSdfPayloadRequest* msg); - wifi_error (*wifi_nan_register_handler)(wifi_interface_handle iface, - NanCallbackHandler handlers); - wifi_error (*wifi_nan_get_version)(wifi_handle handle, NanVersion* version); - wifi_error (*wifi_nan_get_capabilities)(transaction_id id, wifi_interface_handle iface); - wifi_error (*wifi_nan_data_interface_create)(transaction_id id, wifi_interface_handle iface, - char* iface_name); - wifi_error (*wifi_nan_data_interface_delete)(transaction_id id, wifi_interface_handle iface, - char* iface_name); - wifi_error (*wifi_nan_data_request_initiator)(transaction_id id, wifi_interface_handle iface, - NanDataPathInitiatorRequest* msg); - wifi_error (*wifi_nan_data_indication_response)(transaction_id id, wifi_interface_handle iface, - NanDataPathIndicationResponse* msg); - wifi_error (*wifi_nan_data_end)(transaction_id id, wifi_interface_handle iface, - NanDataPathEndRequest* msg); - wifi_error (*wifi_select_tx_power_scenario)(wifi_interface_handle iface, - wifi_power_scenario scenario); - wifi_error (*wifi_reset_tx_power_scenario)(wifi_interface_handle iface); - - /** - * Returns the chipset's hardware filtering capabilities: - * @param version pointer to version of the packet filter interpreter - *                supported, filled in upon return. 0 indicates no support. - * @param max_len pointer to maximum size of the filter bytecode, filled in - *                upon return. - */ - wifi_error (*wifi_get_packet_filter_capabilities)(wifi_interface_handle handle, u32* version, - u32* max_len); - /** -     * Programs the packet filter. - * @param program pointer to the program byte-code. - * @param len length of the program byte-code. -     */ - wifi_error (*wifi_set_packet_filter)(wifi_interface_handle handle, const u8* program, u32 len); - wifi_error (*wifi_read_packet_filter)(wifi_interface_handle handle, u32 src_offset, - u8* host_dst, u32 length); - wifi_error (*wifi_get_roaming_capabilities)(wifi_interface_handle handle, - wifi_roaming_capabilities* caps); - wifi_error (*wifi_enable_firmware_roaming)(wifi_interface_handle handle, - fw_roaming_state_t state); - wifi_error (*wifi_configure_roaming)(wifi_interface_handle handle, - wifi_roaming_config* roaming_config); - wifi_error (*wifi_set_radio_mode_change_handler)(wifi_request_id id, - wifi_interface_handle iface, - wifi_radio_mode_change_handler eh); - wifi_error (*wifi_set_latency_mode)(wifi_interface_handle iface, wifi_latency_mode mode); - wifi_error (*wifi_set_thermal_mitigation_mode)(wifi_handle handle, wifi_thermal_mode mode, - u32 completion_window); - wifi_error (*wifi_map_dscp_access_category)(wifi_handle handle, u32 start, u32 end, - u32 access_category); - wifi_error (*wifi_reset_dscp_mapping)(wifi_handle handle); - - wifi_error (*wifi_virtual_interface_create)(wifi_handle handle, const char* ifname, - wifi_interface_type iface_type); - wifi_error (*wifi_virtual_interface_delete)(wifi_handle handle, const char* ifname); - - wifi_error (*wifi_set_subsystem_restart_handler)(wifi_handle handle, - wifi_subsystem_restart_handler handler); - - /** - * Allow vendor HAL to choose interface name when creating - * an interface. This can be implemented by chips with their - * own interface naming policy. - * If not implemented, the default naming will be used. - */ - wifi_error (*wifi_get_supported_iface_name)(wifi_handle handle, u32 iface_type, char* name, - size_t len); - - /** - * Perform early initialization steps that are needed when WIFI - * is disabled. - * If the function returns failure, it means the vendor HAL is unusable - * (for example, if chip hardware is not installed) and no further - * functions should be called. - */ - wifi_error (*wifi_early_initialize)(void); - - /** - * Get supported feature set which are chip-global, that is - * not dependent on any created interface. - */ - wifi_error (*wifi_get_chip_feature_set)(wifi_handle handle, feature_set* set); - - /** - * Invoked to indicate that the provided iface is the primary STA iface when there are more - * than 1 STA iface concurrently active. - */ - wifi_error (*wifi_multi_sta_set_primary_connection)(wifi_handle handle, - wifi_interface_handle iface); - - /** - * When there are 2 simultaneous STA connections, this use case hint - * indicates what STA + STA use-case is being enabled by the framework. - */ - wifi_error (*wifi_multi_sta_set_use_case)(wifi_handle handle, wifi_multi_sta_use_case use_case); - - /** - * Invoked to indicate that the following list of wifi_coex_unsafe_channel should be avoided - * with the specified restrictions. - * @param unsafeChannels list of current |wifi_coex_unsafe_channel| to avoid. - * @param restrictions bitmask of |wifi_coex_restriction| indicating wifi interfaces to - * restrict from the current unsafe channels. - */ - wifi_error (*wifi_set_coex_unsafe_channels)(wifi_handle handle, u32 num_channels, - wifi_coex_unsafe_channel* unsafeChannels, - u32 restrictions); - - /** - * Invoked to set voip optimization mode for the provided STA iface - */ - wifi_error (*wifi_set_voip_mode)(wifi_interface_handle iface, wifi_voip_mode mode); - - /**@brief twt_register_handler - * Request to register TWT callback before sending any TWT request - * @param wifi_interface_handle: - * @param TwtCallbackHandler: callback function pointers - * @return Synchronous wifi_error - */ - wifi_error (*wifi_twt_register_handler)(wifi_interface_handle iface, - TwtCallbackHandler handler); - - /**@brief twt_get_capability - * Request TWT capability - * @param wifi_interface_handle: - * @return Synchronous wifi_error and TwtCapabilitySet - */ - wifi_error (*wifi_twt_get_capability)(wifi_interface_handle iface, - TwtCapabilitySet* twt_cap_set); - - /**@brief twt_setup_request - * Request to send TWT setup frame - * @param wifi_interface_handle: - * @param TwtSetupRequest: detailed parameters of setup request - * @return Synchronous wifi_error - * @return Asynchronous EventTwtSetupResponse CB return TwtSetupResponse - */ - wifi_error (*wifi_twt_setup_request)(wifi_interface_handle iface, TwtSetupRequest* msg); - - /**@brief twt_teardown_request - * Request to send TWT teardown frame - * @param wifi_interface_handle: - * @param TwtTeardownRequest: detailed parameters of teardown request - * @return Synchronous wifi_error - * @return Asynchronous EventTwtTeardownCompletion CB return TwtTeardownCompletion - * TwtTeardownCompletion may also be received due to other events - * like CSA, BTCX, TWT scheduler, MultiConnection, peer-initiated teardown, etc. - */ - wifi_error (*wifi_twt_teardown_request)(wifi_interface_handle iface, TwtTeardownRequest* msg); - - /**@brief twt_info_frame_request - * Request to send TWT info frame - * @param wifi_interface_handle: - * @param TwtInfoFrameRequest: detailed parameters in info frame - * @return Synchronous wifi_error - * @return Asynchronous EventTwtInfoFrameReceived CB return TwtInfoFrameReceived - * Driver may also receive Peer-initiated TwtInfoFrame - */ - wifi_error (*wifi_twt_info_frame_request)(wifi_interface_handle iface, - TwtInfoFrameRequest* msg); - - /**@brief twt_get_stats - * Request to get TWT stats - * @param wifi_interface_handle: - * @param config_id: configuration ID of TWT request - * @return Synchronous wifi_error and TwtStats - */ - wifi_error (*wifi_twt_get_stats)(wifi_interface_handle iface, u8 config_id, TwtStats* stats); - - /**@brief twt_clear_stats - * Request to clear TWT stats - * @param wifi_interface_handle: - * @param config_id: configuration ID of TWT request - * @return Synchronous wifi_error - */ - wifi_error (*wifi_twt_clear_stats)(wifi_interface_handle iface, u8 config_id); - - /** - * Invoked to set DTIM configuration when the host is in the suspend mode - * @param wifi_interface_handle: - * @param multiplier: when STA in the power saving mode, the wake up interval will be set to - * 1) multiplier * DTIM period if multiplier > 0. - * 2) the device default value if multiplier <=0 - * Some implementations may apply an additional cap to wake up interval in the case of 1). - */ - wifi_error (*wifi_set_dtim_config)(wifi_interface_handle handle, u32 multiplier); - - /**@brief wifi_get_usable_channels - * Request list of usable channels for the requested bands and modes. Usable - * implies channel is allowed as per regulatory for the current country code - * and not restricted due to other hard limitations (e.g. DFS, Coex) In - * certain modes (e.g. STA+SAP) there could be other hard restrictions - * since MCC operation many not be supported by SAP. This API also allows - * driver to return list of usable channels for each mode uniquely to - * distinguish cases where only a limited set of modes are allowed on - * a given channel e.g. srd channels may be supported for P2P but not - * for SAP or P2P-Client may be allowed on an indoor channel but P2P-GO - * may not be allowed. This API is not interface specific and will be - * used to query capabilities of driver in terms of what modes (STA, SAP, - * P2P_CLI, P2P_GO, NAN, TDLS) can be supported on each of the channels. - * @param handle global wifi_handle - * @param band_mask BIT MASK of WLAN_MAC* as represented by |wlan_mac_band| - * @param iface_mode_mask BIT MASK of BIT(WIFI_INTERFACE_*) represented by - * |wifi_interface_mode|. Bitmask respresents all the modes that the - * caller is interested in (e.g. STA, SAP, WFD-CLI, WFD-GO, TDLS, NAN). - * Note: Bitmask does not represent concurrency matrix. If the caller - * is interested in CLI, GO modes, the iface_mode_mask would be set - * to WIFI_INTERFACE_P2P_CLIENT|WIFI_INTERFACE_P2P_GO. - * @param filter_mask BIT MASK of WIFI_USABLE_CHANNEL_FILTER_* represented by - * |wifi_usable_channel_filter|. Indicates if the channel list should - * be filtered based on additional criteria. If filter_mask is not - * specified, driver should return list of usable channels purely - * based on regulatory constraints. - * @param max_size maximum number of |wifi_usable_channel| - * @param size actual number of |wifi_usable_channel| entries returned by driver - * @param channels list of usable channels represented by |wifi_usable_channel| - */ - wifi_error (*wifi_get_usable_channels)(wifi_handle handle, u32 band_mask, u32 iface_mode_mask, - u32 filter_mask, u32 max_size, u32* size, - wifi_usable_channel* channels); - - /** - * Trigger wifi subsystem restart to reload firmware - */ - wifi_error (*wifi_trigger_subsystem_restart)(wifi_handle handle); - - /** - * Invoked to set that the device is operating in an indoor environment. - * @param handle global wifi_handle - * @param isIndoor: true if the device is operating in an indoor - * environment, false otherwise. - * @return Synchronous wifi_error - */ - wifi_error (*wifi_set_indoor_state)(wifi_handle handle, bool isIndoor); - - /**@brief wifi_get_supported_radio_combinations_matrix - * Request all the possible radio combinations this device can offer. - * @param handle global wifi_handle - * @param max_size maximum size allocated for filling the wifi_radio_combination_matrix - * @param wifi_radio_combination_matrix to return all the possible radio - * combinations. - * @param size actual size of wifi_radio_combination_matrix returned from - * lower layer - * - */ - wifi_error (*wifi_get_supported_radio_combinations_matrix)( - wifi_handle handle, u32 max_size, u32* size, - wifi_radio_combination_matrix* radio_combination_matrix); - - /**@brief wifi_nan_rtt_chre_enable_request - * Request to enable CHRE NAN RTT - * @param transaction_id: NAN transaction id - * @param wifi_interface_handle - * @param NanEnableRequest request message - * @return Synchronous wifi_error - */ - wifi_error (*wifi_nan_rtt_chre_enable_request)(transaction_id id, wifi_interface_handle iface, - NanEnableRequest* msg); - - /**@brief wifi_nan_rtt_chre_disable_request - * Request to disable CHRE NAN RTT - * @param transaction_id: NAN transaction id - * @param wifi_interface_handle - * @return Synchronous wifi_error - */ - wifi_error (*wifi_nan_rtt_chre_disable_request)(transaction_id id, wifi_interface_handle iface); - - /**@brief wifi_chre_register_handler - * register a handler to get the state of CHR - * @param wifi_interface_handle - * @param wifi_chre_handler: callback function pointer - * @return Synchronous wifi_error - */ - wifi_error (*wifi_chre_register_handler)(wifi_interface_handle iface, - wifi_chre_handler handler); - - /**@brief wifi_enable_tx_power_limits - * Enable WiFi Tx power limis - * @param wifi_interface_handle - * @param isEnable : If enable TX limit or not - * @return Synchronous wifi_error - */ - wifi_error (*wifi_enable_tx_power_limits)(wifi_interface_handle iface, bool isEnable); - - /**@brief wifi_get_cached_scan_results - * Retrieve scan results cached in wifi firmware - * @param wifi_interface_handle - * @param wifi_cached_scan_result_handler : callback function pointer - * @return Synchronous wifi_error - */ - wifi_error (*wifi_get_cached_scan_results)(wifi_interface_handle iface, - wifi_cached_scan_result_handler handler); - /* - * when adding new functions make sure to add stubs in - * hal_tool.cpp::init_wifi_stub_hal_func_table - */ -} wifi_hal_fn; - -wifi_error init_wifi_vendor_hal_func_table(wifi_hal_fn* fn); -typedef wifi_error (*init_wifi_vendor_hal_func_table_t)(wifi_hal_fn* fn); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/wifi/1.6/default/hal_legacy/wifi_logger.h b/wifi/1.6/default/hal_legacy/wifi_logger.h deleted file mode 100644 index 76d6f7400d..0000000000 --- a/wifi/1.6/default/hal_legacy/wifi_logger.h +++ /dev/null @@ -1,650 +0,0 @@ -#include "wifi_hal.h" - -#ifndef __WIFI_HAL_LOGGER_H -#define __WIFI_HAL_LOGGER_H - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define LOGGER_MAJOR_VERSION 1 -#define LOGGER_MINOR_VERSION 0 -#define LOGGER_MICRO_VERSION 0 - -/** - * WiFi logger life cycle is as follow: - * - * - At initialization time, framework will call wifi_get_ring_buffers_status - * so as to obtain the names and list of supported buffers. - * - When WiFi operation start framework will call wifi_start_logging - * so as to trigger log collection. - * - Developper UI will provide an option to the user, so as it can set the verbose level - * of individual buffer as reported by wifi_get_ring_buffers_status. - * - During wifi operations, driver will periodically report per ring data to framework - * by invoking the on_ring_buffer_data call back. - * - when capturing a bug report, framework will indicate to driver that all the data - * has to be uploaded, urgently, by calling wifi_get_ring_data. - * - * The data uploaded by driver will be stored by framework in separate files, with one stream - * of file per ring. - * Framework will store the files in pcapng format, allowing for easy merging and parsing - * with network analyzer tools. - */ - -typedef int wifi_ring_buffer_id; - -#define PER_PACKET_ENTRY_FLAGS_DIRECTION_TX 1 // 0: TX, 1: RX -#define PER_PACKET_ENTRY_FLAGS_TX_SUCCESS \ - 2 // whether packet was transmitted or - // received/decrypted successfully -#define PER_PACKET_ENTRY_FLAGS_80211_HEADER 4 // has full 802.11 header, else has 802.3 header -#define PER_PACKET_ENTRY_FLAGS_PROTECTED 8 // whether packet was encrypted - -typedef struct { - u8 flags; - u8 tid; // transmit or received tid - u16 MCS; // modulation and bandwidth - u8 rssi; // TX: RSSI of ACK for that packet - // RX: RSSI of packet - u8 num_retries; // number of attempted retries - u16 last_transmit_rate; // last transmit rate in .5 mbps - u16 link_layer_transmit_sequence; // transmit/reeive sequence for that MPDU packet - u64 firmware_entry_timestamp; // TX: firmware timestamp (us) when packet is queued within - // firmware buffer for SDIO/HSIC or into PCIe buffer - // RX: firmware receive timestamp - u64 start_contention_timestamp; // firmware timestamp (us) when packet start contending for the - // medium for the first time, at head of its AC queue, - // or as part of an MPDU or A-MPDU. This timestamp is - // not updated for each retry, only the first transmit attempt. - u64 transmit_success_timestamp; // fimrware timestamp (us) when packet is successfully - // transmitted or aborted because it has exhausted - // its maximum number of retries. - u8 data[0]; // packet data. The length of packet data is determined by the entry_size field of - // the wifi_ring_buffer_entry structure. It is expected that first bytes of the - // packet, or packet headers only (up to TCP or RTP/UDP headers) - // will be copied into the ring -} __attribute__((packed)) wifi_ring_per_packet_status_entry; - -/* Below events refer to the wifi_connectivity_event ring and shall be supported */ -#define WIFI_EVENT_ASSOCIATION_REQUESTED 0 // driver receives association command from kernel -#define WIFI_EVENT_AUTH_COMPLETE 1 -#define WIFI_EVENT_ASSOC_COMPLETE 2 -#define WIFI_EVENT_FW_AUTH_STARTED 3 // fw event indicating auth frames are sent -#define WIFI_EVENT_FW_ASSOC_STARTED 4 // fw event indicating assoc frames are sent -#define WIFI_EVENT_FW_RE_ASSOC_STARTED 5 // fw event indicating reassoc frames are sent -#define WIFI_EVENT_DRIVER_SCAN_REQUESTED 6 -#define WIFI_EVENT_DRIVER_SCAN_RESULT_FOUND 7 -#define WIFI_EVENT_DRIVER_SCAN_COMPLETE 8 -#define WIFI_EVENT_G_SCAN_STARTED 9 -#define WIFI_EVENT_G_SCAN_COMPLETE 10 -#define WIFI_EVENT_DISASSOCIATION_REQUESTED 11 -#define WIFI_EVENT_RE_ASSOCIATION_REQUESTED 12 -#define WIFI_EVENT_ROAM_REQUESTED 13 -#define WIFI_EVENT_BEACON_RECEIVED \ - 14 // received beacon from AP (event enabled - // only in verbose mode) -#define WIFI_EVENT_ROAM_SCAN_STARTED 15 // firmware has triggered a roam scan (not g-scan) -#define WIFI_EVENT_ROAM_SCAN_COMPLETE 16 // firmware has completed a roam scan (not g-scan) -#define WIFI_EVENT_ROAM_SEARCH_STARTED \ - 17 // firmware has started searching for roam - // candidates (with reason =xx) -#define WIFI_EVENT_ROAM_SEARCH_STOPPED \ - 18 // firmware has stopped searching for roam - // candidates (with reason =xx) -#define WIFI_EVENT_CHANNEL_SWITCH_ANOUNCEMENT 20 // received channel switch anouncement from AP -#define WIFI_EVENT_FW_EAPOL_FRAME_TRANSMIT_START \ - 21 // fw start transmit eapol frame, with - // EAPOL index 1-4 -#define WIFI_EVENT_FW_EAPOL_FRAME_TRANSMIT_STOP \ - 22 // fw gives up eapol frame, with rate, - // success/failure and number retries -#define WIFI_EVENT_DRIVER_EAPOL_FRAME_TRANSMIT_REQUESTED \ - 23 // kernel queue EAPOL for transmission - // in driver with EAPOL index 1-4 -#define WIFI_EVENT_FW_EAPOL_FRAME_RECEIVED \ - 24 // with rate, regardless of the fact that - // EAPOL frame is accepted or rejected by fw -#define WIFI_EVENT_DRIVER_EAPOL_FRAME_RECEIVED \ - 26 // with rate, and eapol index, driver has - // received EAPOL frame and will queue it up - // to wpa_supplicant -#define WIFI_EVENT_BLOCK_ACK_NEGOTIATION_COMPLETE 27 // with success/failure, parameters -#define WIFI_EVENT_BT_COEX_BT_SCO_START 28 -#define WIFI_EVENT_BT_COEX_BT_SCO_STOP 29 -#define WIFI_EVENT_BT_COEX_BT_SCAN_START \ - 30 // for paging/scan etc., when BT starts transmiting - // twice per BT slot -#define WIFI_EVENT_BT_COEX_BT_SCAN_STOP 31 -#define WIFI_EVENT_BT_COEX_BT_HID_START 32 -#define WIFI_EVENT_BT_COEX_BT_HID_STOP 33 -#define WIFI_EVENT_ROAM_AUTH_STARTED 34 // fw sends auth frame in roaming to next candidate -#define WIFI_EVENT_ROAM_AUTH_COMPLETE 35 // fw receive auth confirm from ap -#define WIFI_EVENT_ROAM_ASSOC_STARTED \ - 36 // firmware sends assoc/reassoc frame in - // roaming to next candidate -#define WIFI_EVENT_ROAM_ASSOC_COMPLETE 37 // firmware receive assoc/reassoc confirm from ap -#define WIFI_EVENT_G_SCAN_STOP 38 // firmware sends stop G_SCAN -#define WIFI_EVENT_G_SCAN_CYCLE_STARTED 39 // firmware indicates G_SCAN scan cycle started -#define WIFI_EVENT_G_SCAN_CYCLE_COMPLETED 40 // firmware indicates G_SCAN scan cycle completed -#define WIFI_EVENT_G_SCAN_BUCKET_STARTED \ - 41 // firmware indicates G_SCAN scan start - // for a particular bucket -#define WIFI_EVENT_G_SCAN_BUCKET_COMPLETED \ - 42 // firmware indicates G_SCAN scan completed for - // for a particular bucket -#define WIFI_EVENT_G_SCAN_RESULTS_AVAILABLE \ - 43 // Event received from firmware about G_SCAN scan - // results being available -#define WIFI_EVENT_G_SCAN_CAPABILITIES \ - 44 // Event received from firmware with G_SCAN - // capabilities -#define WIFI_EVENT_ROAM_CANDIDATE_FOUND \ - 45 // Event received from firmware when eligible - // candidate is found -#define WIFI_EVENT_ROAM_SCAN_CONFIG \ - 46 // Event received from firmware when roam scan - // configuration gets enabled or disabled -#define WIFI_EVENT_AUTH_TIMEOUT 47 // firmware/driver timed out authentication -#define WIFI_EVENT_ASSOC_TIMEOUT 48 // firmware/driver timed out association -#define WIFI_EVENT_MEM_ALLOC_FAILURE 49 // firmware/driver encountered allocation failure -#define WIFI_EVENT_DRIVER_PNO_ADD 50 // driver added a PNO network in firmware -#define WIFI_EVENT_DRIVER_PNO_REMOVE 51 // driver removed a PNO network in firmware -#define WIFI_EVENT_DRIVER_PNO_NETWORK_FOUND \ - 52 // driver received PNO networks - // found indication from firmware -#define WIFI_EVENT_DRIVER_PNO_SCAN_REQUESTED 53 // driver triggered a scan for PNO networks -#define WIFI_EVENT_DRIVER_PNO_SCAN_RESULT_FOUND \ - 54 // driver received scan results - // of PNO networks -#define WIFI_EVENT_DRIVER_PNO_SCAN_COMPLETE \ - 55 // driver updated scan results from - // PNO networks to cfg80211 - -/** - * Parameters of wifi logger events are TLVs - * Event parameters tags are defined as: - */ -#define WIFI_TAG_VENDOR_SPECIFIC 0 // take a byte stream as parameter -#define WIFI_TAG_BSSID 1 // takes a 6 bytes MAC address as parameter -#define WIFI_TAG_ADDR 2 // takes a 6 bytes MAC address as parameter -#define WIFI_TAG_SSID 3 // takes a 32 bytes SSID address as parameter -#define WIFI_TAG_STATUS 4 // takes an integer as parameter -#define WIFI_TAG_CHANNEL_SPEC 5 // takes one or more wifi_channel_spec as parameter -#define WIFI_TAG_WAKE_LOCK_EVENT 6 // takes a wake_lock_event struct as parameter -#define WIFI_TAG_ADDR1 7 // takes a 6 bytes MAC address as parameter -#define WIFI_TAG_ADDR2 8 // takes a 6 bytes MAC address as parameter -#define WIFI_TAG_ADDR3 9 // takes a 6 bytes MAC address as parameter -#define WIFI_TAG_ADDR4 10 // takes a 6 bytes MAC address as parameter -#define WIFI_TAG_TSF 11 // take a 64 bits TSF value as parameter -#define WIFI_TAG_IE \ - 12 // take one or more specific 802.11 IEs parameter, - // IEs are in turn indicated in TLV format as per - // 802.11 spec -#define WIFI_TAG_INTERFACE 13 // take interface name as parameter -#define WIFI_TAG_REASON_CODE 14 // take a reason code as per 802.11 as parameter -#define WIFI_TAG_RATE_MBPS 15 // take a wifi rate in 0.5 mbps -#define WIFI_TAG_REQUEST_ID 16 // take an integer as parameter -#define WIFI_TAG_BUCKET_ID 17 // take an integer as parameter -#define WIFI_TAG_GSCAN_PARAMS 18 // takes a wifi_scan_cmd_params struct as parameter -#define WIFI_TAG_GSCAN_CAPABILITIES 19 // takes a wifi_gscan_capabilities struct as parameter -#define WIFI_TAG_SCAN_ID 20 // take an integer as parameter -#define WIFI_TAG_RSSI 21 // take an integer as parameter -#define WIFI_TAG_CHANNEL 22 // take an integer as parameter -#define WIFI_TAG_LINK_ID 23 // take an integer as parameter -#define WIFI_TAG_LINK_ROLE 24 // take an integer as parameter -#define WIFI_TAG_LINK_STATE 25 // take an integer as parameter -#define WIFI_TAG_LINK_TYPE 26 // take an integer as parameter -#define WIFI_TAG_TSCO 27 // take an integer as parameter -#define WIFI_TAG_RSCO 28 // take an integer as parameter -#define WIFI_TAG_EAPOL_MESSAGE_TYPE \ - 29 // take an integer as parameter - // M1-1, M2-2, M3-3, M4-4 - -typedef struct { - u16 tag; - u16 length; // length of value - u8 value[0]; -} __attribute__((packed)) tlv_log; - -typedef struct { - u16 event; - tlv_log tlvs[0]; // separate parameter structure per event to be provided and optional data - // the event_data is expected to include an official android part, with some - // parameter as transmit rate, num retries, num scan result found etc... - // as well, event_data can include a vendor proprietary part which is - // understood by the developer only. -} __attribute__((packed)) wifi_ring_buffer_driver_connectivity_event; - -/** - * Ring buffer name for power events ring. note that power event are extremely frequents - * and thus should be stored in their own ring/file so as not to clobber connectivity events. - */ -typedef struct { - int status; // 0 taken, 1 released - int reason; // reason why this wake lock is taken - char name[0]; // null terminated -} __attribute__((packed)) wake_lock_event; - -typedef struct { - u16 event; - tlv_log tlvs[0]; -} __attribute__((packed)) wifi_power_event; - -/** - * This structure represent a logger entry within a ring buffer. - * Wifi driver are responsible to manage the ring buffer and write the debug - * information into those rings. - * - * In general, the debug entries can be used to store meaningful 802.11 information (SME, MLME, - * connection and packet statistics) as well as vendor proprietary data that is specific to a - * specific driver or chipset. - * Binary entries can be used so as to store packet data or vendor specific information and - * will be treated as blobs of data by android. - * - * A user land process will be started by framework so as to periodically retrieve the - * data logged by drivers into their ring buffer, store the data into log files and include - * the logs into android bugreports. - */ -enum { - RING_BUFFER_ENTRY_FLAGS_HAS_BINARY = (1 << (0)), // set for binary entries - RING_BUFFER_ENTRY_FLAGS_HAS_TIMESTAMP = (1 << (1)) // set if 64 bits timestamp is present -}; - -enum { - ENTRY_TYPE_CONNECT_EVENT = 1, - ENTRY_TYPE_PKT, - ENTRY_TYPE_WAKE_LOCK, - ENTRY_TYPE_POWER_EVENT, - ENTRY_TYPE_DATA -}; - -typedef struct { - u16 entry_size; // the size of payload excluding the header. - u8 flags; - u8 type; // entry type - u64 timestamp; // present if has_timestamp bit is set. -} __attribute__((packed)) wifi_ring_buffer_entry; - -#define WIFI_RING_BUFFER_FLAG_HAS_BINARY_ENTRIES 0x00000001 // set if binary entries are present -#define WIFI_RING_BUFFER_FLAG_HAS_ASCII_ENTRIES 0x00000002 // set if ascii entries are present - -/* ring buffer params */ -/** - * written_bytes and read_bytes implement a producer consumer API - * hence written_bytes >= read_bytes - * a modulo arithmetic of the buffer size has to be applied to those counters: - * actual offset into ring buffer = written_bytes % ring_buffer_byte_size - * - */ -typedef struct { - u8 name[32]; - u32 flags; - wifi_ring_buffer_id ring_id; // unique integer representing the ring - u32 ring_buffer_byte_size; // total memory size allocated for the buffer - u32 verbose_level; // verbose level for ring buffer - u32 written_bytes; // number of bytes that was written to the buffer by driver, - // monotonously increasing integer - u32 read_bytes; // number of bytes that was read from the buffer by user land, - // monotonously increasing integer - u32 written_records; // number of records that was written to the buffer by driver, - // monotonously increasing integer -} wifi_ring_buffer_status; - -/** - * Callback for reporting ring data - * - * The ring buffer data collection is event based: - * - Driver calls on_ring_buffer_data when new records are available, the wifi_ring_buffer_status - * passed up to framework in the call back indicates to framework if more data is available in - * the ring buffer. It is not expected that driver will necessarily always empty the ring - * immediately as data is available, instead driver will report data every X seconds or if - * N bytes are available. - * - In the case where a bug report has to be captured, framework will require driver to upload - * all data immediately. This is indicated to driver when framework calls wifi_get_ringdata. - * When framework calls wifi_get_ring_data, driver will start sending all available data in the - * indicated ring by repeatedly invoking the on_ring_buffer_data callback. - * - * The callback is called by log handler whenever ring data comes in driver. - */ -typedef struct { - void (*on_ring_buffer_data)(char* ring_name, char* buffer, int buffer_size, - wifi_ring_buffer_status* status); -} wifi_ring_buffer_data_handler; - -/** - * API to set the log handler for getting ring data - * - Only a single instance of log handler can be instantiated for each ring buffer. - */ -wifi_error wifi_set_log_handler(wifi_request_id id, wifi_interface_handle iface, - wifi_ring_buffer_data_handler handler); - -/* API to reset the log handler */ -wifi_error wifi_reset_log_handler(wifi_request_id id, wifi_interface_handle iface); - -/** - * Callback for reporting FW dump - * - * The buffer data collection is event based such as FW health check or FW dump. - * The callback is called by alert handler. - */ -typedef struct { - void (*on_alert)(wifi_request_id id, char* buffer, int buffer_size, int err_code); -} wifi_alert_handler; - -/* - * API to set the alert handler for the alert case in Wi-Fi Chip - * - Only a single instance of alert handler can be instantiated. - */ -wifi_error wifi_set_alert_handler(wifi_request_id id, wifi_interface_handle iface, - wifi_alert_handler handler); - -/* API to reset the alert handler */ -wifi_error wifi_reset_alert_handler(wifi_request_id id, wifi_interface_handle iface); - -/* API for framework to indicate driver has to upload and drain all data of a given ring */ -wifi_error wifi_get_ring_data(wifi_interface_handle iface, char* ring_name); - -/** - * API to trigger the debug collection. - * Unless his API is invoked - logging is not triggered. - * - Verbose_level 0 corresponds to no collection, - * and it makes log handler stop by no more events from driver. - * - Verbose_level 1 correspond to normal log level, with minimal user impact. - * This is the default value. - * - Verbose_level 2 are enabled when user is lazily trying to reproduce a problem, - * wifi performances and power can be impacted but device should not otherwise be - * significantly impacted. - * - Verbose_level 3+ are used when trying to actively debug a problem. - * - * ring_name represent the name of the ring for which data collection shall start. - * - * flags: TBD parameter used to enable/disable specific events on a ring - * max_interval: maximum interval in seconds for driver to invoke on_ring_buffer_data, - * ignore if zero - * min_data_size: minimum data size in buffer for driver to invoke on_ring_buffer_data, - * ignore if zero - */ -wifi_error wifi_start_logging(wifi_interface_handle iface, u32 verbose_level, u32 flags, - u32 max_interval_sec, u32 min_data_size, char* ring_name); - -/** - * API to get the status of all ring buffers supported by driver. - * - Caller is responsible to allocate / free ring buffer status. - * - Maximum no of ring buffer would be 10. - */ -wifi_error wifi_get_ring_buffers_status(wifi_interface_handle iface, u32* num_rings, - wifi_ring_buffer_status* status); - -/** - * Synchronous memory dump by user request. - * - Caller is responsible to store memory dump data into a local, - * e.g., /data/misc/wifi/memdump.bin - */ -typedef struct { - void (*on_firmware_memory_dump)(char* buffer, int buffer_size); -} wifi_firmware_memory_dump_handler; - -/** - * API to collect a firmware memory dump for a given iface by async memdump event. - * - Triggered by Alerthandler, esp. when FW problem or FW health check happens - * - Caller is responsible to store fw dump data into a local, - * e.g., /data/misc/wifi/alertdump-1.bin - */ -wifi_error wifi_get_firmware_memory_dump(wifi_interface_handle iface, - wifi_firmware_memory_dump_handler handler); - -/** - * API to collect a firmware version string. - * - Caller is responsible to allocate / free a buffer to retrieve firmware verion info. - * - Max string will be at most 256 bytes. - */ -wifi_error wifi_get_firmware_version(wifi_interface_handle iface, char* buffer, int buffer_size); - -/** - * API to collect a driver version string. - * - Caller is responsible to allocate / free a buffer to retrieve driver verion info. - * - Max string will be at most 256 bytes. - */ -wifi_error wifi_get_driver_version(wifi_interface_handle iface, char* buffer, int buffer_size); - -/* Feature set */ -enum { - WIFI_LOGGER_MEMORY_DUMP_SUPPORTED = (1 << (0)), // Memory dump of FW - WIFI_LOGGER_PER_PACKET_TX_RX_STATUS_SUPPORTED = (1 << (1)), // PKT status - WIFI_LOGGER_CONNECT_EVENT_SUPPORTED = (1 << (2)), // Connectivity event - WIFI_LOGGER_POWER_EVENT_SUPPORTED = (1 << (3)), // POWER of Driver - WIFI_LOGGER_WAKE_LOCK_SUPPORTED = (1 << (4)), // WAKE LOCK of Driver - WIFI_LOGGER_VERBOSE_SUPPORTED = (1 << (5)), // verbose log of FW - WIFI_LOGGER_WATCHDOG_TIMER_SUPPORTED = (1 << (6)), // monitor the health of FW - WIFI_LOGGER_DRIVER_DUMP_SUPPORTED = (1 << (7)), // dumps driver state - WIFI_LOGGER_PACKET_FATE_SUPPORTED = (1 << (8)), // tracks connection packets' fate -}; - -/** - * API to retrieve the current supportive features. - * - An integer variable is enough to have bit mapping info by caller. - */ -wifi_error wifi_get_logger_supported_feature_set(wifi_interface_handle iface, - unsigned int* support); - -typedef struct { - /* Buffer is to be allocated and freed by HAL implementation. */ - void (*on_driver_memory_dump)(char* buffer, int buffer_size); -} wifi_driver_memory_dump_callbacks; - -/** - API to collect driver state. - - Framework will call this API soon before or after (but not - concurrently with) wifi_get_firmware_memory_dump(). Capturing - firmware and driver dumps is intended to help identify - inconsistent state between these components. - - - In response to this call, HAL implementation should make one or - more calls to callbacks.on_driver_memory_dump(). Framework will - copy data out of the received |buffer|s, and concatenate the - contents thereof. - - HAL implemention will indicate completion of the driver memory - dump by returning from this call. -*/ -wifi_error wifi_get_driver_memory_dump(wifi_interface_handle iface, - wifi_driver_memory_dump_callbacks callbacks); - -/* packet fate logs */ - -#define MD5_PREFIX_LEN 4 -#define MAX_FATE_LOG_LEN 32 -#define MAX_FRAME_LEN_ETHERNET 1518 -#define MAX_FRAME_LEN_80211_MGMT 2352 // 802.11-2012 Fig. 8-34 - -typedef enum { - // Sent over air and ACKed. - TX_PKT_FATE_ACKED, - - // Sent over air but not ACKed. (Normal for broadcast/multicast.) - TX_PKT_FATE_SENT, - - // Queued within firmware, but not yet sent over air. - TX_PKT_FATE_FW_QUEUED, - - // Dropped by firmware as invalid. E.g. bad source address, bad checksum, - // or invalid for current state. - TX_PKT_FATE_FW_DROP_INVALID, - - // Dropped by firmware due to lack of buffer space. - TX_PKT_FATE_FW_DROP_NOBUFS, - - // Dropped by firmware for any other reason. Includes frames that - // were sent by driver to firmware, but unaccounted for by - // firmware. - TX_PKT_FATE_FW_DROP_OTHER, - - // Queued within driver, not yet sent to firmware. - TX_PKT_FATE_DRV_QUEUED, - - // Dropped by driver as invalid. E.g. bad source address, or - // invalid for current state. - TX_PKT_FATE_DRV_DROP_INVALID, - - // Dropped by driver due to lack of buffer space. - TX_PKT_FATE_DRV_DROP_NOBUFS, - - // Dropped by driver for any other reason. - TX_PKT_FATE_DRV_DROP_OTHER, -} wifi_tx_packet_fate; - -typedef enum { - // Valid and delivered to network stack (e.g., netif_rx()). - RX_PKT_FATE_SUCCESS, - - // Queued within firmware, but not yet sent to driver. - RX_PKT_FATE_FW_QUEUED, - - // Dropped by firmware due to host-programmable filters. - RX_PKT_FATE_FW_DROP_FILTER, - - // Dropped by firmware as invalid. E.g. bad checksum, decrypt failed, - // or invalid for current state. - RX_PKT_FATE_FW_DROP_INVALID, - - // Dropped by firmware due to lack of buffer space. - RX_PKT_FATE_FW_DROP_NOBUFS, - - // Dropped by firmware for any other reason. - RX_PKT_FATE_FW_DROP_OTHER, - - // Queued within driver, not yet delivered to network stack. - RX_PKT_FATE_DRV_QUEUED, - - // Dropped by driver due to filter rules. - RX_PKT_FATE_DRV_DROP_FILTER, - - // Dropped by driver as invalid. E.g. not permitted in current state. - RX_PKT_FATE_DRV_DROP_INVALID, - - // Dropped by driver due to lack of buffer space. - RX_PKT_FATE_DRV_DROP_NOBUFS, - - // Dropped by driver for any other reason. - RX_PKT_FATE_DRV_DROP_OTHER, -} wifi_rx_packet_fate; - -typedef enum { - FRAME_TYPE_UNKNOWN, - FRAME_TYPE_ETHERNET_II, - FRAME_TYPE_80211_MGMT, -} frame_type; - -typedef struct { - // The type of MAC-layer frame that this frame_info holds. - // - For data frames, use FRAME_TYPE_ETHERNET_II. - // - For management frames, use FRAME_TYPE_80211_MGMT. - // - If the type of the frame is unknown, use FRAME_TYPE_UNKNOWN. - frame_type payload_type; - - // The number of bytes included in |frame_content|. If the frame - // contents are missing (e.g. RX frame dropped in firmware), - // |frame_len| should be set to 0. - size_t frame_len; - - // Host clock when this frame was received by the driver (either - // outbound from the host network stack, or inbound from the - // firmware). - // - The timestamp should be taken from a clock which includes time - // the host spent suspended (e.g. ktime_get_boottime()). - // - If no host timestamp is available (e.g. RX frame was dropped in - // firmware), this field should be set to 0. - u32 driver_timestamp_usec; - - // Firmware clock when this frame was received by the firmware - // (either outbound from the host, or inbound from a remote - // station). - // - The timestamp should be taken from a clock which includes time - // firmware spent suspended (if applicable). - // - If no firmware timestamp is available (e.g. TX frame was - // dropped by driver), this field should be set to 0. - // - Consumers of |frame_info| should _not_ assume any - // synchronization between driver and firmware clocks. - u32 firmware_timestamp_usec; - - // Actual frame content. - // - Should be provided for TX frames originated by the host. - // - Should be provided for RX frames received by the driver. - // - Optionally provided for TX frames originated by firmware. (At - // discretion of HAL implementation.) - // - Optionally provided for RX frames dropped in firmware. (At - // discretion of HAL implementation.) - // - If frame content is not provided, |frame_len| should be set - // to 0. - union { - char ethernet_ii_bytes[MAX_FRAME_LEN_ETHERNET]; - char ieee_80211_mgmt_bytes[MAX_FRAME_LEN_80211_MGMT]; - } frame_content; -} frame_info; - -typedef struct { - // Prefix of MD5 hash of |frame_inf.frame_content|. If frame - // content is not provided, prefix of MD5 hash over the same data - // that would be in frame_content, if frame content were provided. - char md5_prefix[MD5_PREFIX_LEN]; - wifi_tx_packet_fate fate; - frame_info frame_inf; -} wifi_tx_report; - -typedef struct { - // Prefix of MD5 hash of |frame_inf.frame_content|. If frame - // content is not provided, prefix of MD5 hash over the same data - // that would be in frame_content, if frame content were provided. - char md5_prefix[MD5_PREFIX_LEN]; - wifi_rx_packet_fate fate; - frame_info frame_inf; -} wifi_rx_report; - -/** - API to start packet fate monitoring. - - Once stared, monitoring should remain active until HAL is unloaded. - - When HAL is unloaded, all packet fate buffers should be cleared. -*/ -wifi_error wifi_start_pkt_fate_monitoring(wifi_interface_handle handle); - -/** - API to retrieve fates of outbound packets. - - HAL implementation should fill |tx_report_bufs| with fates of - _first_ min(n_requested_fates, actual packets) frames - transmitted for the most recent association. The fate reports - should follow the same order as their respective packets. - - HAL implementation may choose (but is not required) to include - reports for management frames. - - Packets reported by firmware, but not recognized by driver, - should be included. However, the ordering of the corresponding - reports is at the discretion of HAL implementation. - - Framework may call this API multiple times for the same association. - - Framework will ensure |n_requested_fates <= MAX_FATE_LOG_LEN|. - - Framework will allocate and free the referenced storage. -*/ -wifi_error wifi_get_tx_pkt_fates(wifi_interface_handle handle, wifi_tx_report* tx_report_bufs, - size_t n_requested_fates, size_t* n_provided_fates); - -/** - API to retrieve fates of inbound packets. - - HAL implementation should fill |rx_report_bufs| with fates of - _first_ min(n_requested_fates, actual packets) frames - received for the most recent association. The fate reports - should follow the same order as their respective packets. - - HAL implementation may choose (but is not required) to include - reports for management frames. - - Packets reported by firmware, but not recognized by driver, - should be included. However, the ordering of the corresponding - reports is at the discretion of HAL implementation. - - Framework may call this API multiple times for the same association. - - Framework will ensure |n_requested_fates <= MAX_FATE_LOG_LEN|. - - Framework will allocate and free the referenced storage. -*/ -wifi_error wifi_get_rx_pkt_fates(wifi_interface_handle handle, wifi_rx_report* rx_report_bufs, - size_t n_requested_fates, size_t* n_provided_fates); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /*__WIFI_HAL_STATS_ */ diff --git a/wifi/1.6/default/hal_legacy/wifi_nan.h b/wifi/1.6/default/hal_legacy/wifi_nan.h deleted file mode 100644 index 3591b98adc..0000000000 --- a/wifi/1.6/default/hal_legacy/wifi_nan.h +++ /dev/null @@ -1,2726 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef __NAN_H__ -#define __NAN_H__ - -#include -#include -#include "wifi_hal.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/***************************************************************************** - * Neighbour Aware Network Service Structures and Functions - *****************************************************************************/ - -/* - Definitions - All multi-byte fields within all NAN protocol stack messages are assumed to be in Little Endian - order. -*/ - -typedef int NanVersion; -typedef u16 transaction_id; -typedef u32 NanDataPathId; - -#define NAN_MAC_ADDR_LEN 6 -#define NAN_MAJOR_VERSION 2 -#define NAN_MINOR_VERSION 0 -#define NAN_MICRO_VERSION 1 -#define NAN_MAX_SOCIAL_CHANNELS 3 - -/* NAN Maximum Lengths */ -#define NAN_MAX_SERVICE_NAME_LEN 255 -#define NAN_MAX_MATCH_FILTER_LEN 255 -#define NAN_MAX_SERVICE_SPECIFIC_INFO_LEN 1024 -#define NAN_MAX_VSA_DATA_LEN 1024 -#define NAN_MAX_MESH_DATA_LEN 32 -#define NAN_MAX_INFRA_DATA_LEN 32 -#define NAN_MAX_CLUSTER_ATTRIBUTE_LEN 255 -#define NAN_MAX_SUBSCRIBE_MAX_ADDRESS 42 -#define NAN_MAX_FAM_CHANNELS 32 -#define NAN_MAX_POSTDISCOVERY_LEN 5 -#define NAN_MAX_FRAME_DATA_LEN 504 -#define NAN_DP_MAX_APP_INFO_LEN 512 -#define NAN_ERROR_STR_LEN 255 -#define NAN_PMK_INFO_LEN 32 -#define NAN_MAX_SCID_BUF_LEN 1024 -#define NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN 1024 -#define NAN_SECURITY_MIN_PASSPHRASE_LEN 8 -#define NAN_SECURITY_MAX_PASSPHRASE_LEN 63 -#define NAN_MAX_CHANNEL_INFO_SUPPORTED 4 - -/* - Definition of various NanResponseType -*/ -typedef enum { - NAN_RESPONSE_ENABLED = 0, - NAN_RESPONSE_DISABLED = 1, - NAN_RESPONSE_PUBLISH = 2, - NAN_RESPONSE_PUBLISH_CANCEL = 3, - NAN_RESPONSE_TRANSMIT_FOLLOWUP = 4, - NAN_RESPONSE_SUBSCRIBE = 5, - NAN_RESPONSE_SUBSCRIBE_CANCEL = 6, - NAN_RESPONSE_STATS = 7, - NAN_RESPONSE_CONFIG = 8, - NAN_RESPONSE_TCA = 9, - NAN_RESPONSE_ERROR = 10, - NAN_RESPONSE_BEACON_SDF_PAYLOAD = 11, - NAN_GET_CAPABILITIES = 12, - NAN_DP_INTERFACE_CREATE = 13, - NAN_DP_INTERFACE_DELETE = 14, - NAN_DP_INITIATOR_RESPONSE = 15, - NAN_DP_RESPONDER_RESPONSE = 16, - NAN_DP_END = 17 -} NanResponseType; - -/* NAN Publish Types */ -typedef enum { - NAN_PUBLISH_TYPE_UNSOLICITED = 0, - NAN_PUBLISH_TYPE_SOLICITED, - NAN_PUBLISH_TYPE_UNSOLICITED_SOLICITED -} NanPublishType; - -/* NAN Transmit Priorities */ -typedef enum { NAN_TX_PRIORITY_NORMAL = 0, NAN_TX_PRIORITY_HIGH } NanTxPriority; - -/* NAN Statistics Request ID Codes */ -typedef enum { - NAN_STATS_ID_DE_PUBLISH = 0, - NAN_STATS_ID_DE_SUBSCRIBE, - NAN_STATS_ID_DE_MAC, - NAN_STATS_ID_DE_TIMING_SYNC, - NAN_STATS_ID_DE_DW, - NAN_STATS_ID_DE -} NanStatsType; - -/* NAN Protocol Event ID Codes */ -typedef enum { - NAN_EVENT_ID_DISC_MAC_ADDR = 0, - NAN_EVENT_ID_STARTED_CLUSTER, - NAN_EVENT_ID_JOINED_CLUSTER -} NanDiscEngEventType; - -/* NAN Data Path type */ -typedef enum { NAN_DATA_PATH_UNICAST_MSG = 0, NAN_DATA_PATH_MULTICAST_MSG } NdpType; - -/* NAN Ranging Configuration */ -typedef enum { NAN_RANGING_DISABLE = 0, NAN_RANGING_ENABLE } NanRangingState; - -/* TCA Type */ -typedef enum { NAN_TCA_ID_CLUSTER_SIZE = 0 } NanTcaType; - -/* NAN Channel Info */ -typedef struct { - u32 channel; - u32 bandwidth; - u32 nss; -} NanChannelInfo; - -/* - Various NAN Protocol Response code -*/ -typedef enum { - /* NAN Protocol Response Codes */ - NAN_STATUS_SUCCESS = 0, - /* NAN Discovery Engine/Host driver failures */ - NAN_STATUS_INTERNAL_FAILURE = 1, - /* NAN OTA failures */ - NAN_STATUS_PROTOCOL_FAILURE = 2, - /* if the publish/subscribe id is invalid */ - NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID = 3, - /* If we run out of resources allocated */ - NAN_STATUS_NO_RESOURCE_AVAILABLE = 4, - /* if invalid params are passed */ - NAN_STATUS_INVALID_PARAM = 5, - /* if the requestor instance id is invalid */ - NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID = 6, - /* if the ndp id is invalid */ - NAN_STATUS_INVALID_NDP_ID = 7, - /* if NAN is enabled when wifi is turned off */ - NAN_STATUS_NAN_NOT_ALLOWED = 8, - /* if over the air ack is not received */ - NAN_STATUS_NO_OTA_ACK = 9, - /* If NAN is already enabled and we are try to re-enable the same */ - NAN_STATUS_ALREADY_ENABLED = 10, - /* If followup message internal queue is full */ - NAN_STATUS_FOLLOWUP_QUEUE_FULL = 11, - /* Unsupported concurrency session enabled, NAN disabled notified */ - NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED = 12 -} NanStatusType; - -/* NAN Transmit Types */ -typedef enum { NAN_TX_TYPE_BROADCAST = 0, NAN_TX_TYPE_UNICAST } NanTxType; - -/* NAN Subscribe Type */ -typedef enum { NAN_SUBSCRIBE_TYPE_PASSIVE = 0, NAN_SUBSCRIBE_TYPE_ACTIVE } NanSubscribeType; - -/* NAN Service Response Filter Attribute Bit */ -typedef enum { NAN_SRF_ATTR_BLOOM_FILTER = 0, NAN_SRF_ATTR_PARTIAL_MAC_ADDR } NanSRFType; - -/* NAN Service Response Filter Include Bit */ -typedef enum { NAN_SRF_INCLUDE_DO_NOT_RESPOND = 0, NAN_SRF_INCLUDE_RESPOND } NanSRFIncludeType; - -/* NAN Match indication type */ -typedef enum { - NAN_MATCH_ALG_MATCH_ONCE = 0, - NAN_MATCH_ALG_MATCH_CONTINUOUS, - NAN_MATCH_ALG_MATCH_NEVER -} NanMatchAlg; - -/* NAN Transmit Window Type */ -typedef enum { NAN_TRANSMIT_IN_DW = 0, NAN_TRANSMIT_IN_FAW } NanTransmitWindowType; - -/* NAN SRF State in Subscribe */ -typedef enum { NAN_DO_NOT_USE_SRF = 0, NAN_USE_SRF } NanSRFState; - -/* NAN Include SSI in MatchInd */ -typedef enum { - NAN_SSI_NOT_REQUIRED_IN_MATCH_IND = 0, - NAN_SSI_REQUIRED_IN_MATCH_IND -} NanSsiInMatchInd; - -/* NAN DP security Configuration */ -typedef enum { NAN_DP_CONFIG_NO_SECURITY = 0, NAN_DP_CONFIG_SECURITY } NanDataPathSecurityCfgStatus; - -typedef enum { NAN_QOS_NOT_REQUIRED = 0, NAN_QOS_REQUIRED } NanQosCfgStatus; - -/* Data request Responder's response */ -typedef enum { NAN_DP_REQUEST_ACCEPT = 0, NAN_DP_REQUEST_REJECT } NanDataPathResponseCode; - -/* NAN DP channel config options */ -typedef enum { - NAN_DP_CHANNEL_NOT_REQUESTED = 0, - NAN_DP_REQUEST_CHANNEL_SETUP, - NAN_DP_FORCE_CHANNEL_SETUP -} NanDataPathChannelCfg; - -/* Enable/Disable NAN Ranging Auto response */ -typedef enum { - NAN_RANGING_AUTO_RESPONSE_ENABLE = 1, - NAN_RANGING_AUTO_RESPONSE_DISABLE -} NanRangingAutoResponse; - -/* Enable/Disable NAN service range report */ -typedef enum { NAN_DISABLE_RANGE_REPORT = 1, NAN_ENABLE_RANGE_REPORT } NanRangeReport; - -/* NAN Range Response */ -typedef enum { - NAN_RANGE_REQUEST_ACCEPT = 1, - NAN_RANGE_REQUEST_REJECT, - NAN_RANGE_REQUEST_CANCEL -} NanRangeResponse; - -/* NAN Security Key Input Type*/ -typedef enum { - NAN_SECURITY_KEY_INPUT_PMK = 1, - NAN_SECURITY_KEY_INPUT_PASSPHRASE -} NanSecurityKeyInputType; - -typedef struct { - /* pmk length */ - u32 pmk_len; - /* - PMK: Info is optional in Discovery phase. - PMK info can be passed during - the NDP session. - */ - u8 pmk[NAN_PMK_INFO_LEN]; -} NanSecurityPmk; - -typedef struct { - /* passphrase length */ - u32 passphrase_len; - /* - passphrase info is optional in Discovery phase. - passphrase info can be passed during - the NDP session. - */ - u8 passphrase[NAN_SECURITY_MAX_PASSPHRASE_LEN]; -} NanSecurityPassPhrase; - -typedef struct { - NanSecurityKeyInputType key_type; - union { - NanSecurityPmk pmk_info; - NanSecurityPassPhrase passphrase_info; - } body; -} NanSecurityKeyInfo; - -/* NAN Security Cipher Suites Mask */ -#define NAN_CIPHER_SUITE_SHARED_KEY_NONE 0x00 -#define NAN_CIPHER_SUITE_SHARED_KEY_128_MASK 0x01 -#define NAN_CIPHER_SUITE_SHARED_KEY_256_MASK 0x02 -#define NAN_CIPHER_SUITE_PUBLIC_KEY_2WDH_128_MASK 0x04 -#define NAN_CIPHER_SUITE_PUBLIC_KEY_2WDH_256_MASK 0x08 - -/* NAN ranging indication condition MASKS */ -#define NAN_RANGING_INDICATE_CONTINUOUS_MASK 0x01 -#define NAN_RANGING_INDICATE_INGRESS_MET_MASK 0x02 -#define NAN_RANGING_INDICATE_EGRESS_MET_MASK 0x04 - -/* NAN schedule update reason MASKS */ -#define NAN_SCHEDULE_UPDATE_NSS_MASK 0x01 -#define NAN_SCHEDULE_UPDATE_CHANNEL_MASK 0x02 - -/* - Structure to set the Service Descriptor Extension - Attribute (SDEA) passed as part of NanPublishRequest/ - NanSubscribeRequest/NanMatchInd. -*/ -typedef struct { - /* - Optional configuration of Data Path Enable request. - configure flag determines whether configuration needs - to be passed or not. - */ - u8 config_nan_data_path; - NdpType ndp_type; - /* - NAN secuirty required flag to indicate - if the security is enabled or disabled - */ - NanDataPathSecurityCfgStatus security_cfg; - /* - NAN ranging required flag to indicate - if ranging is enabled on disabled - */ - NanRangingState ranging_state; - /* - Enable/Disable Ranging report, - when configured NanRangeReportInd received - */ - NanRangeReport range_report; - /* - NAN QOS required flag to indicate - if QOS is required or not. - */ - NanQosCfgStatus qos_cfg; -} NanSdeaCtrlParams; - -/* - Nan Ranging Peer Info in MatchInd -*/ -typedef struct { - /* - Distance to the NAN device with the MAC address indicated - with ranged mac address. - */ - u32 range_measurement_mm; - /* Ranging event matching the configuration of continuous/ingress/egress. */ - u32 ranging_event_type; -} NanRangeInfo; - -/* Nan/NDP Capabilites info */ -typedef struct { - u32 max_concurrent_nan_clusters; - u32 max_publishes; - u32 max_subscribes; - u32 max_service_name_len; - u32 max_match_filter_len; - u32 max_total_match_filter_len; - u32 max_service_specific_info_len; - u32 max_vsa_data_len; - u32 max_mesh_data_len; - u32 max_ndi_interfaces; - u32 max_ndp_sessions; - u32 max_app_info_len; - u32 max_queued_transmit_followup_msgs; - u32 ndp_supported_bands; - u32 cipher_suites_supported; - u32 max_scid_len; - bool is_ndp_security_supported; - u32 max_sdea_service_specific_info_len; - u32 max_subscribe_address; - u32 ndpe_attr_supported; - bool is_instant_mode_supported; -} NanCapabilities; - -/* - Nan accept policy: Per service basis policy - Based on this policy(ALL/NONE), responder side - will send ACCEPT/REJECT -*/ -typedef enum { - NAN_SERVICE_ACCEPT_POLICY_NONE = 0, - /* Default value */ - NAN_SERVICE_ACCEPT_POLICY_ALL -} NanServiceAcceptPolicy; - -/* - Host can send Vendor specific attributes which the Discovery Engine can - enclose in Beacons and/or Service Discovery frames transmitted. - Below structure is used to populate that. -*/ -typedef struct { - /* - 0 = transmit only in the next discovery window - 1 = transmit in next 16 discovery window - */ - u8 payload_transmit_flag; - /* - Below flags will determine in which all frames - the vendor specific attributes should be included - */ - u8 tx_in_discovery_beacon; - u8 tx_in_sync_beacon; - u8 tx_in_service_discovery; - /* Organizationally Unique Identifier */ - u32 vendor_oui; - /* - vendor specific attribute to be transmitted - vsa_len : Length of the vsa data. - */ - u32 vsa_len; - u8 vsa[NAN_MAX_VSA_DATA_LEN]; -} NanTransmitVendorSpecificAttribute; - -/* - Discovery Engine will forward any Vendor Specific Attributes - which it received as part of this structure. -*/ -/* Mask to determine on which frames attribute was received */ -#define RX_DISCOVERY_BEACON_MASK 0x01 -#define RX_SYNC_BEACON_MASK 0x02 -#define RX_SERVICE_DISCOVERY_MASK 0x04 -typedef struct { - /* - Frames on which this vendor specific attribute - was received. Mask defined above - */ - u8 vsa_received_on; - /* Organizationally Unique Identifier */ - u32 vendor_oui; - /* vendor specific attribute */ - u32 attr_len; - u8 vsa[NAN_MAX_VSA_DATA_LEN]; -} NanReceiveVendorSpecificAttribute; - -/* - NAN Beacon SDF Payload Received structure - Discovery engine sends the details of received Beacon or - Service Discovery Frames as part of this structure. -*/ -typedef struct { - /* Frame data */ - u32 frame_len; - u8 frame_data[NAN_MAX_FRAME_DATA_LEN]; -} NanBeaconSdfPayloadReceive; - -/* - Host can set the Periodic scan parameters for each of the - 3(6, 44, 149) Social channels. Only these channels are allowed - any other channels are rejected -*/ -typedef enum { - NAN_CHANNEL_24G_BAND = 0, - NAN_CHANNEL_5G_BAND_LOW, - NAN_CHANNEL_5G_BAND_HIGH -} NanChannelIndex; - -/* - Structure to set the Social Channel Scan parameters - passed as part of NanEnableRequest/NanConfigRequest -*/ -typedef struct { - /* - Dwell time of each social channel in milliseconds - NanChannelIndex corresponds to the respective channel - If time set to 0 then the FW default time will be used. - */ - u8 dwell_time[NAN_MAX_SOCIAL_CHANNELS]; // default value 200 msec - - /* - Scan period of each social channel in seconds - NanChannelIndex corresponds to the respective channel - If time set to 0 then the FW default time will be used. - */ - u16 scan_period[NAN_MAX_SOCIAL_CHANNELS]; // default value 20 sec -} NanSocialChannelScanParams; - -/* - Host can send Post Connectivity Capability attributes - to be included in Service Discovery frames transmitted - as part of this structure. -*/ -typedef struct { - /* - 0 = transmit only in the next discovery window - 1 = transmit in next 16 discovery window - */ - u8 payload_transmit_flag; - /* 1 - Wifi Direct supported 0 - Not supported */ - u8 is_wfd_supported; - /* 1 - Wifi Direct Services supported 0 - Not supported */ - u8 is_wfds_supported; - /* 1 - TDLS supported 0 - Not supported */ - u8 is_tdls_supported; - /* 1 - IBSS supported 0 - Not supported */ - u8 is_ibss_supported; - /* 1 - Mesh supported 0 - Not supported */ - u8 is_mesh_supported; - /* - 1 - NAN Device currently connect to WLAN Infra AP - 0 - otherwise - */ - u8 wlan_infra_field; -} NanTransmitPostConnectivityCapability; - -/* - Discovery engine providing the post connectivity capability - received. -*/ -typedef struct { - /* 1 - Wifi Direct supported 0 - Not supported */ - u8 is_wfd_supported; - /* 1 - Wifi Direct Services supported 0 - Not supported */ - u8 is_wfds_supported; - /* 1 - TDLS supported 0 - Not supported */ - u8 is_tdls_supported; - /* 1 - IBSS supported 0 - Not supported */ - u8 is_ibss_supported; - /* 1 - Mesh supported 0 - Not supported */ - u8 is_mesh_supported; - /* - 1 - NAN Device currently connect to WLAN Infra AP - 0 - otherwise - */ - u8 wlan_infra_field; -} NanReceivePostConnectivityCapability; - -/* - Indicates the availability interval duration associated with the - Availability Intervals Bitmap field -*/ -typedef enum { - NAN_DURATION_16MS = 0, - NAN_DURATION_32MS = 1, - NAN_DURATION_64MS = 2 -} NanAvailDuration; - -/* Further availability per channel information */ -typedef struct { - /* Defined above */ - NanAvailDuration entry_control; - /* - 1 byte field indicating the frequency band the NAN Device - will be available as defined in IEEE Std. 802.11-2012 - Annex E Table E-4 Global Operating Classes - */ - u8 class_val; - /* - 1 byte field indicating the channel the NAN Device - will be available. - */ - u8 channel; - /* - Map Id - 4 bit field which identifies the Further - availability map attribute. - */ - u8 mapid; - /* - divides the time between the beginnings of consecutive Discovery - Windows of a given NAN cluster into consecutive time intervals - of equal durations. The time interval duration is specified by - the Availability Interval Duration subfield of the Entry Control - field. - - A Nan device that sets the i-th bit of the Availability - Intervals Bitmap to 1 shall be present during the corresponding - i-th time interval in the operation channel indicated by the - Operating Class and Channel Number fields in the same Availability Entry. - - A Nan device that sets the i-th bit of the Availability Intervals Bitmap to - 0 may be present during the corresponding i-th time interval in the operation - channel indicated by the Operating Class and Channel Number fields in the same - Availability Entry. - - The size of the Bitmap is dependent upon the Availability Interval Duration - chosen in the Entry Control Field. The size can be either 1, 2 or 4 bytes long - - - Duration field is equal to 0, only AIB[0] is valid - - Duration field is equal to 1, only AIB [0] and AIB [1] is valid - - Duration field is equal to 2, AIB [0], AIB [1], AIB [2] and AIB [3] are valid - */ - u32 avail_interval_bitmap; -} NanFurtherAvailabilityChannel; - -/* - Further availability map which can be sent and received from - Discovery engine -*/ -typedef struct { - /* - Number of channels indicates the number of channel - entries which is part of fam - */ - u8 numchans; - NanFurtherAvailabilityChannel famchan[NAN_MAX_FAM_CHANNELS]; -} NanFurtherAvailabilityMap; - -/* - Host can send Post-Nan Discovery attributes which the Discovery Engine can - enclose in Service Discovery frames -*/ -/* Possible connection types in Post NAN Discovery attributes */ -typedef enum { - NAN_CONN_WLAN_INFRA = 0, - NAN_CONN_P2P_OPER = 1, - NAN_CONN_WLAN_IBSS = 2, - NAN_CONN_WLAN_MESH = 3, - NAN_CONN_FURTHER_SERVICE_AVAILABILITY = 4, - NAN_CONN_WLAN_RANGING = 5 -} NanConnectionType; - -/* Possible device roles in Post NAN Discovery attributes */ -typedef enum { - NAN_WLAN_INFRA_AP = 0, - NAN_WLAN_INFRA_STA = 1, - NAN_P2P_OPER_GO = 2, - NAN_P2P_OPER_DEV = 3, - NAN_P2P_OPER_CLI = 4 -} NanDeviceRole; - -/* Configuration params of NAN Ranging */ -typedef struct { - /* - Interval in milli sec between two ranging measurements. - If the Awake DW intervals in NanEnable/Config are larger - than the ranging intervals priority is given to Awake DW - Intervals. Only on a match the ranging is initiated for the - peer - */ - u32 ranging_interval_msec; - /* - Flags indicating the type of ranging event to be notified - NAN_RANGING_INDICATE_ MASKS are used to set these. - BIT0 - Continuous Ranging event notification. - BIT1 - Ingress distance is <=. - BIT2 - Egress distance is >=. - */ - u32 config_ranging_indications; - /* Ingress distance in millimeters (optional) */ - u32 distance_ingress_mm; - /* Egress distance in millmilliimeters (optional) */ - u32 distance_egress_mm; -} NanRangingCfg; - -/* NAN Ranging request's response */ -typedef struct { - /* Publish Id of an earlier Publisher */ - u16 publish_id; - /* - A 32 bit Requestor instance Id which is sent to the Application. - This Id will be used in subsequent RangeResponse on Subscribe side. - */ - u32 requestor_instance_id; - /* Peer MAC addr of Range Requestor */ - u8 peer_addr[NAN_MAC_ADDR_LEN]; - /* Response indicating ACCEPT/REJECT/CANCEL of Range Request */ - NanRangeResponse ranging_response; -} NanRangeResponseCfg; - -/* Structure of Post NAN Discovery attribute */ -typedef struct { - /* Connection type of the host */ - NanConnectionType type; - /* - Device role of the host based on - the connection type - */ - NanDeviceRole role; - /* - Flag to send the information as a single shot or repeated - for next 16 discovery windows - 0 - Single_shot - 1 - next 16 discovery windows - */ - u8 transmit_freq; - /* Duration of the availability bitmask */ - NanAvailDuration duration; - /* Availability interval bitmap based on duration */ - u32 avail_interval_bitmap; - /* - Mac address depending on the conn type and device role - -------------------------------------------------- - | Conn Type | Device Role | Mac address Usage | - -------------------------------------------------- - | WLAN_INFRA | AP/STA | BSSID of the AP | - -------------------------------------------------- - | P2P_OPER | GO | GO's address | - -------------------------------------------------- - | P2P_OPER | P2P_DEVICE | Address of who | - | | | would become GO | - -------------------------------------------------- - | WLAN_IBSS | NA | BSSID | - -------------------------------------------------- - | WLAN_MESH | NA | BSSID | - -------------------------------------------------- - */ - u8 addr[NAN_MAC_ADDR_LEN]; - /* - Mandatory mesh id value if connection type is WLAN_MESH - Mesh id contains 0-32 octet identifier and should be - as per IEEE Std.802.11-2012 spec. - */ - u16 mesh_id_len; - u8 mesh_id[NAN_MAX_MESH_DATA_LEN]; - /* - Optional infrastructure SSID if conn_type is set to - NAN_CONN_WLAN_INFRA - */ - u16 infrastructure_ssid_len; - u8 infrastructure_ssid_val[NAN_MAX_INFRA_DATA_LEN]; -} NanTransmitPostDiscovery; - -/* - Discovery engine providing the structure of Post NAN - Discovery -*/ -typedef struct { - /* Connection type of the host */ - NanConnectionType type; - /* - Device role of the host based on - the connection type - */ - NanDeviceRole role; - /* Duration of the availability bitmask */ - NanAvailDuration duration; - /* Availability interval bitmap based on duration */ - u32 avail_interval_bitmap; - /* - Map Id - 4 bit field which identifies the Further - availability map attribute. - */ - u8 mapid; - /* - Mac address depending on the conn type and device role - -------------------------------------------------- - | Conn Type | Device Role | Mac address Usage | - -------------------------------------------------- - | WLAN_INFRA | AP/STA | BSSID of the AP | - -------------------------------------------------- - | P2P_OPER | GO | GO's address | - -------------------------------------------------- - | P2P_OPER | P2P_DEVICE | Address of who | - | | | would become GO | - -------------------------------------------------- - | WLAN_IBSS | NA | BSSID | - -------------------------------------------------- - | WLAN_MESH | NA | BSSID | - -------------------------------------------------- - */ - u8 addr[NAN_MAC_ADDR_LEN]; - /* - Mandatory mesh id value if connection type is WLAN_MESH - Mesh id contains 0-32 octet identifier and should be - as per IEEE Std.802.11-2012 spec. - */ - u16 mesh_id_len; - u8 mesh_id[NAN_MAX_MESH_DATA_LEN]; - /* - Optional infrastructure SSID if conn_type is set to - NAN_CONN_WLAN_INFRA - */ - u16 infrastructure_ssid_len; - u8 infrastructure_ssid_val[NAN_MAX_INFRA_DATA_LEN]; -} NanReceivePostDiscovery; - -/* - NAN device level configuration of SDF and Sync beacons in both - 2.4/5GHz bands -*/ -typedef struct { - /* Configure 2.4GHz DW Band */ - u8 config_2dot4g_dw_band; - /* - Indicates the interval for Sync beacons and SDF's in 2.4GHz band. - Valid values of DW Interval are: 1, 2, 3, 4 and 5, 0 is reserved. - The SDF includes in OTA when enabled. The publish/subscribe period - values don't override the device level configurations. - */ - u32 dw_2dot4g_interval_val; // default value 1 - /* Configure 5GHz DW Band */ - u8 config_5g_dw_band; - /* - Indicates the interval for Sync beacons and SDF's in 5GHz band - Valid values of DW Interval are: 1, 2, 3, 4 and 5, 0 no wake up for - any interval. The SDF includes in OTA when enabled. The publish/subscribe - period values don't override the device level configurations. - */ - u32 dw_5g_interval_val; // default value 1 when 5G is enabled -} NanConfigDW; - -/* - Enable Request Message Structure - The NanEnableReq message instructs the Discovery Engine to enter an operational state -*/ -typedef struct { - /* Mandatory parameters below */ - u8 master_pref; // default value 0x02 - /* - A cluster_low value matching cluster_high indicates a request to join - a cluster with that value. If the requested cluster is not found the - device will start its own cluster. - */ - u16 cluster_low; // default value 0 - u16 cluster_high; // default value 0xFFFF - - /* - Optional configuration of Enable request. - Each of the optional parameters have configure flag which - determine whether configuration is to be passed or not. - */ - u8 config_support_5g; - u8 support_5g_val; // default value 0; turned off by default - /* - BIT 0 is used to specify to include Service IDs in Sync/Discovery beacons - 0 - Do not include SIDs in any beacons - 1 - Include SIDs in all beacons. - Rest 7 bits are count field which allows control over the number of SIDs - included in the Beacon. 0 means to include as many SIDs that fit into - the maximum allow Beacon frame size - */ - u8 config_sid_beacon; - u8 sid_beacon_val; // default value 0x01 - /* - The rssi values below should be specified without sign. - For eg: -70dBm should be specified as 70. - */ - u8 config_2dot4g_rssi_close; - u8 rssi_close_2dot4g_val; // default value -60 dBm - - u8 config_2dot4g_rssi_middle; - u8 rssi_middle_2dot4g_val; // default value -70 dBm - - u8 config_2dot4g_rssi_proximity; - u8 rssi_proximity_2dot4g_val; // default value -60dBm - - u8 config_hop_count_limit; - u8 hop_count_limit_val; // default value 0x02 - - /* - Defines 2.4G channel access support - 0 - No Support - 1 - Supported - */ - u8 config_2dot4g_support; - u8 support_2dot4g_val; // default value 0x01 - /* - Defines 2.4G channels will be used for sync/discovery beacons - 0 - 2.4G channels not used for beacons - 1 - 2.4G channels used for beacons - */ - u8 config_2dot4g_beacons; - u8 beacon_2dot4g_val; // default value 1 - /* - Defines 2.4G channels will be used for Service Discovery frames - 0 - 2.4G channels not used for Service Discovery frames - 1 - 2.4G channels used for Service Discovery frames - */ - u8 config_2dot4g_sdf; - u8 sdf_2dot4g_val; // default value 1 - /* - Defines 5G channels will be used for sync/discovery beacons - 0 - 5G channels not used for beacons - 1 - 5G channels used for beacons - */ - u8 config_5g_beacons; - u8 beacon_5g_val; // default value 1 when 5G is enabled - /* - Defines 5G channels will be used for Service Discovery frames - 0 - 5G channels not used for Service Discovery frames - 1 - 5G channels used for Service Discovery frames - */ - u8 config_5g_sdf; - u8 sdf_5g_val; // default value is 0 when 5G is enabled - /* - 1 byte value which defines the RSSI in - dBm for a close by Peer in 5 Ghz channels. - The rssi values should be specified without sign. - For eg: -70dBm should be specified as 70. - */ - u8 config_5g_rssi_close; - u8 rssi_close_5g_val; // default value -60dBm when 5G is enabled - /* - 1 byte value which defines the RSSI value in - dBm for a close by Peer in 5 Ghz channels. - The rssi values should be specified without sign. - For eg: -70dBm should be specified as 70. - */ - u8 config_5g_rssi_middle; - u8 rssi_middle_5g_val; // default value -75dBm when 5G is enabled - /* - 1 byte value which defines the RSSI filter - threshold. Any Service Descriptors received above this - value that are configured for RSSI filtering will be dropped. - The rssi values should be specified without sign. - For eg: -70dBm should be specified as 70. - */ - u8 config_5g_rssi_close_proximity; - u8 rssi_close_proximity_5g_val; // default value -60dBm when 5G is enabled - /* - 1 byte quantity which defines the window size over - which the “average RSSI” will be calculated over. - */ - u8 config_rssi_window_size; - u8 rssi_window_size_val; // default value 0x08 - /* - The 24 bit Organizationally Unique ID + the 8 bit Network Id. - */ - u8 config_oui; - u32 oui_val; // default value {0x51, 0x6F, 0x9A, 0x01, 0x00, 0x00} - /* - NAN Interface Address, If not configured the Discovery Engine - will generate a 6 byte Random MAC. - */ - u8 config_intf_addr; - u8 intf_addr_val[NAN_MAC_ADDR_LEN]; - /* - If set to 1, the Discovery Engine will enclose the Cluster - Attribute only sent in Beacons in a Vendor Specific Attribute - and transmit in a Service Descriptor Frame. - */ - u8 config_cluster_attribute_val; - /* - The periodicity in seconds between full scan’s to find any new - clusters available in the area. A Full scan should not be done - more than every 10 seconds and should not be done less than every - 30 seconds. - */ - u8 config_scan_params; - NanSocialChannelScanParams scan_params_val; - /* - 1 byte quantity which forces the Random Factor to a particular - value for all transmitted Sync/Discovery beacons - */ - u8 config_random_factor_force; - u8 random_factor_force_val; // default value off and set to 0x00 - /* - 1 byte quantity which forces the HC for all transmitted Sync and - Discovery Beacon NO matter the real HC being received over the - air. - */ - u8 config_hop_count_force; - u8 hop_count_force_val; // default value 0x00 - - /* channel frequency in MHz to enable Nan on */ - u8 config_24g_channel; - wifi_channel channel_24g_val; // default value channel 0x6 - - u8 config_5g_channel; - wifi_channel channel_5g_val; // default value channel 44 or 149 regulatory - // domain - /* Configure 2.4/5GHz DW */ - NanConfigDW config_dw; - - /* - By default discovery MAC address randomization is enabled - and default interval value is 30 minutes i.e. 1800 seconds. - The value 0 is used to disable MAC addr randomization. - */ - u8 config_disc_mac_addr_randomization; - u32 disc_mac_addr_rand_interval_sec; // default value 1800 sec - - /* - Set/Enable corresponding bits to disable Discovery indications: - BIT0 - Disable Discovery MAC Address Event. - BIT1 - Disable Started Cluster Event. - BIT2 - Disable Joined Cluster Event. - */ - u8 discovery_indication_cfg; // default value 0x0 - /* - BIT 0 is used to specify to include Service IDs in Sync/Discovery beacons - 0 - Do not include SIDs in any beacons - 1 - Include SIDs in all beacons. - Rest 7 bits are count field which allows control over the number of SIDs - included in the Beacon. 0 means to include as many SIDs that fit into - the maximum allow Beacon frame size - */ - u8 config_subscribe_sid_beacon; - u32 subscribe_sid_beacon_val; // default value 0x0 - /* - Discovery Beacon Interval config. - Default value is 128 msec in 2G DW and 176 msec in 2G/5G DW. - When 0 value is passed it is reset to default value of 128 or 176 msec. - */ - u8 config_discovery_beacon_int; - u32 discovery_beacon_interval; - /* - Enable Number of Spatial Streams. - This is NAN Power Optimization feature for NAN discovery. - */ - u8 config_nss; - // default value is implementation specific and passing 0 sets it to default - u32 nss; - /* - Enable device level NAN Ranging feature. - 0 - Disable - 1 - Enable - */ - u8 config_enable_ranging; - u32 enable_ranging; - /* - Enable/Disable DW Early termination. - 0 - Disable - 1 - Enable - */ - u8 config_dw_early_termination; - u32 enable_dw_termination; - /* - Indicate whether to use NDPE attribute to bring-up TCP/IP connection. - If config_ndpe_attr is not configured, the default behavior is - not using NDPE attr, and the capability is not advertised. - 0 - Not use - 1 - Use - */ - u8 config_ndpe_attr; - u32 use_ndpe_attr; - /* - Enable NAN v3.1 instant communication mode. - 0 - Disable - 1 - Enable - */ - u8 config_enable_instant_mode; - u32 enable_instant_mode; - /* - Config NAN v3.1 instant communication channel frequency selected over NFC/OOB method. - If dual band is supported default channel is 149 or 44 as per regulatory domain, - else channel 6 (send frequency in MHz). - Sometimes depending on country code retrictions, even 149/44 may be restricted - in those cases instant channel will be operational only in 2.4GHz. - Use wifi_get_usable_channels() API to get supported bands/channels before - Instant mode NFC handshake is triggered - */ - u8 config_instant_mode_channel; - wifi_channel instant_mode_channel; -} NanEnableRequest; - -/* - Publish Msg Structure - Message is used to request the DE to publish the Service Name - using the parameters passed into the Discovery Window -*/ -typedef struct { - u16 publish_id; /* id 0 means new publish, any other id is existing publish */ - u16 ttl; /* how many seconds to run for. 0 means forever until canceled */ - /* - period: Awake DW Interval for publish(service) - Indicates the interval between two Discovery Windows in which - the device supporting the service is awake to transmit or - receive the Service Discovery frames. - Valid values of Awake DW Interval are: 1, 2, 4, 8 and 16, value 0 will - default to 1. - */ - u16 period; - NanPublishType publish_type; /* 0= unsolicited, solicited = 1, 2= both */ - NanTxType tx_type; /* 0 = broadcast, 1= unicast if solicited publish */ - u8 publish_count; /* number of OTA Publish, 0 means forever until canceled */ - u16 service_name_len; /* length of service name */ - u8 service_name[NAN_MAX_SERVICE_NAME_LEN]; /* UTF-8 encoded string identifying the service */ - /* - Field which specifies how the matching indication to host is controlled. - 0 - Match and Indicate Once - 1 - Match and Indicate continuous - 2 - Match and Indicate never. This means don't indicate the match to the host. - 3 - Reserved - */ - NanMatchAlg publish_match_indicator; - - /* - Sequence of values - NAN Device that has invoked a Subscribe method corresponding to this Publish method - */ - u16 service_specific_info_len; - u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN]; - - /* - Ordered sequence of pairs which specify further response conditions - beyond the service name used to filter subscribe messages to respond to. - This is only needed when the PT is set to NAN_SOLICITED or NAN_SOLICITED_UNSOLICITED. - */ - u16 rx_match_filter_len; - u8 rx_match_filter[NAN_MAX_MATCH_FILTER_LEN]; - - /* - Ordered sequence of pairs to be included in the Discovery Frame. - If present it is always sent in a Discovery Frame - */ - u16 tx_match_filter_len; - u8 tx_match_filter[NAN_MAX_MATCH_FILTER_LEN]; - - /* - flag which specifies that the Publish should use the configured RSSI - threshold and the received RSSI in order to filter requests - 0 – ignore the configured RSSI threshold when running a Service - Descriptor attribute or Service ID List Attribute through the DE matching logic. - 1 – use the configured RSSI threshold when running a Service - Descriptor attribute or Service ID List Attribute through the DE matching logic. - - */ - u8 rssi_threshold_flag; - - /* - 8-bit bitmap which allows the Host to associate this publish - with a particular Post-NAN Connectivity attribute - which has been sent down in a NanConfigureRequest/NanEnableRequest - message. If the DE fails to find a configured Post-NAN - connectivity attributes referenced by the bitmap, - the DE will return an error code to the Host. - If the Publish is configured to use a Post-NAN Connectivity - attribute and the Host does not refresh the Post-NAN Connectivity - attribute the Publish will be canceled and the Host will be sent - a PublishTerminatedIndication message. - */ - u8 connmap; - /* - Set/Enable corresponding bits to disable any indications that follow a publish. - BIT0 - Disable publish termination indication. - BIT1 - Disable match expired indication. - BIT2 - Disable followUp indication received (OTA). - BIT3 - Disable publishReplied indication. - */ - u8 recv_indication_cfg; - /* - Nan accept policy for the specific service(publish) - */ - NanServiceAcceptPolicy service_responder_policy; - /* NAN Cipher Suite Type */ - u32 cipher_type; - /* - Nan Security Key Info is optional in Discovery phase. - PMK or passphrase info can be passed during - the NDP session. - */ - NanSecurityKeyInfo key_info; - - /* Security Context Identifiers length */ - u32 scid_len; - /* - Security Context Identifier attribute contains PMKID - shall be included in NDP setup and response messages. - Security Context Identifier, Identifies the Security - Context. For NAN Shared Key Cipher Suite, this field - contains the 16 octet PMKID identifying the PMK used - for setting up the Secure Data Path. - */ - u8 scid[NAN_MAX_SCID_BUF_LEN]; - - /* NAN configure service discovery extended attributes */ - NanSdeaCtrlParams sdea_params; - - /* NAN Ranging configuration */ - NanRangingCfg ranging_cfg; - - /* Enable/disable NAN serivce Ranging auto response mode */ - NanRangingAutoResponse ranging_auto_response; - - /* - When the ranging_auto_response_cfg is not set, NanRangeRequestInd is - received. Nan Range Response to Peer MAC Addr is notified to indicate - ACCEPT/REJECT/CANCEL to the requestor. - */ - NanRangeResponseCfg range_response_cfg; - - /* - Sequence of values indicating the service specific info in SDEA - */ - u16 sdea_service_specific_info_len; - u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN]; -} NanPublishRequest; - -/* - Publish Cancel Msg Structure - The PublishServiceCancelReq Message is used to request the DE to stop publishing - the Service Name identified by the Publish Id in the message. -*/ -typedef struct { - u16 publish_id; -} NanPublishCancelRequest; - -/* - NAN Subscribe Structure - The SubscribeServiceReq message is sent to the Discovery Engine - whenever the Upper layers would like to listen for a Service Name -*/ -typedef struct { - u16 subscribe_id; /* id 0 means new subscribe, non zero is existing subscribe */ - u16 ttl; /* how many seconds to run for. 0 means forever until canceled */ - /* - period: Awake DW Interval for subscribe(service) - Indicates the interval between two Discovery Windows in which - the device supporting the service is awake to transmit or - receive the Service Discovery frames. - Valid values of Awake DW Interval are: 1, 2, 4, 8 and 16, value 0 will - default to 1. - */ - u16 period; - - /* Flag which specifies how the Subscribe request shall be processed. */ - NanSubscribeType subscribe_type; /* 0 - PASSIVE , 1- ACTIVE */ - - /* Flag which specifies on Active Subscribes how the Service Response Filter attribute is - * populated.*/ - NanSRFType serviceResponseFilter; /* 0 - Bloom Filter, 1 - MAC Addr */ - - /* Flag which specifies how the Service Response Filter Include bit is populated.*/ - NanSRFIncludeType - serviceResponseInclude; /* 0=Do not respond if in the Address Set, 1= Respond */ - - /* Flag which specifies if the Service Response Filter should be used when creating - * Subscribes.*/ - NanSRFState useServiceResponseFilter; /* 0=Do not send the Service Response Filter,1= send */ - - /* - Flag which specifies if the Service Specific Info is needed in - the Publish message before creating the MatchIndication - */ - NanSsiInMatchInd ssiRequiredForMatchIndication; /* 0=Not needed, 1= Required */ - - /* - Field which specifies how the matching indication to host is controlled. - 0 - Match and Indicate Once - 1 - Match and Indicate continuous - 2 - Match and Indicate never. This means don't indicate the match to the host. - 3 - Reserved - */ - NanMatchAlg subscribe_match_indicator; - - /* - The number of Subscribe Matches which should occur - before the Subscribe request is automatically terminated. - */ - u8 subscribe_count; /* If this value is 0 this field is not used by the DE.*/ - - u16 service_name_len; /* length of service name */ - u8 service_name[NAN_MAX_SERVICE_NAME_LEN]; /* UTF-8 encoded string identifying the service */ - - /* Sequence of values which further specify the published service beyond the service name*/ - u16 service_specific_info_len; - u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN]; - - /* - Ordered sequence of pairs used to filter out received publish discovery - messages. This can be sent both for a Passive or an Active Subscribe - */ - u16 rx_match_filter_len; - u8 rx_match_filter[NAN_MAX_MATCH_FILTER_LEN]; - - /* - Ordered sequence of pairs included in the - Discovery Frame when an Active Subscribe is used. - */ - u16 tx_match_filter_len; - u8 tx_match_filter[NAN_MAX_MATCH_FILTER_LEN]; - - /* - Flag which specifies that the Subscribe should use the configured RSSI - threshold and the received RSSI in order to filter requests - 0 – ignore the configured RSSI threshold when running a Service - Descriptor attribute or Service ID List Attribute through the DE matching logic. - 1 – use the configured RSSI threshold when running a Service - Descriptor attribute or Service ID List Attribute through the DE matching logic. - - */ - u8 rssi_threshold_flag; - - /* - 8-bit bitmap which allows the Host to associate this Active - Subscribe with a particular Post-NAN Connectivity attribute - which has been sent down in a NanConfigureRequest/NanEnableRequest - message. If the DE fails to find a configured Post-NAN - connectivity attributes referenced by the bitmap, - the DE will return an error code to the Host. - If the Subscribe is configured to use a Post-NAN Connectivity - attribute and the Host does not refresh the Post-NAN Connectivity - attribute the Subscribe will be canceled and the Host will be sent - a SubscribeTerminatedIndication message. - */ - u8 connmap; - /* - NAN Interface Address, conforming to the format as described in - 8.2.4.3.2 of IEEE Std. 802.11-2012. - */ - u8 num_intf_addr_present; - u8 intf_addr[NAN_MAX_SUBSCRIBE_MAX_ADDRESS][NAN_MAC_ADDR_LEN]; - /* - Set/Enable corresponding bits to disable indications that follow a subscribe. - BIT0 - Disable subscribe termination indication. - BIT1 - Disable match expired indication. - BIT2 - Disable followUp indication received (OTA). - */ - u8 recv_indication_cfg; - - /* NAN Cipher Suite Type */ - u32 cipher_type; - /* - Nan Security Key Info is optional in Discovery phase. - PMK or passphrase info can be passed during - the NDP session. - */ - NanSecurityKeyInfo key_info; - - /* Security Context Identifiers length */ - u32 scid_len; - /* - Security Context Identifier attribute contains PMKID - shall be included in NDP setup and response messages. - Security Context Identifier, Identifies the Security - Context. For NAN Shared Key Cipher Suite, this field - contains the 16 octet PMKID identifying the PMK used - for setting up the Secure Data Path. - */ - u8 scid[NAN_MAX_SCID_BUF_LEN]; - - /* NAN configure service discovery extended attributes */ - NanSdeaCtrlParams sdea_params; - - /* NAN Ranging configuration */ - NanRangingCfg ranging_cfg; - - /* Enable/disable NAN serivce Ranging auto response mode */ - NanRangingAutoResponse ranging_auto_response; - - /* - When the ranging_auto_response_cfg is not set, NanRangeRequestInd is - received. Nan Range Response to Peer MAC Addr is notified to indicate - ACCEPT/REJECT/CANCEL to the requestor. - */ - NanRangeResponseCfg range_response_cfg; - - /* - Sequence of values indicating the service specific info in SDEA - */ - u16 sdea_service_specific_info_len; - u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN]; -} NanSubscribeRequest; - -/* - NAN Subscribe Cancel Structure - The SubscribeCancelReq Message is used to request the DE to stop looking for the Service Name. -*/ -typedef struct { - u16 subscribe_id; -} NanSubscribeCancelRequest; - -/* - Transmit follow up Structure - The TransmitFollowupReq message is sent to the DE to allow the sending of the - Service_Specific_Info to a particular MAC address. -*/ -typedef struct { - /* Publish or Subscribe Id of an earlier Publish/Subscribe */ - u16 publish_subscribe_id; - - /* - This Id is the Requestor Instance that is passed as - part of earlier MatchInd/FollowupInd message. - */ - u32 requestor_instance_id; - u8 addr[NAN_MAC_ADDR_LEN]; /* Unicast address */ - NanTxPriority priority; /* priority of the request 2=high */ - NanTransmitWindowType dw_or_faw; /* 0= send in a DW, 1=send in FAW */ - - /* - Sequence of values which further specify the published service beyond - the service name. - */ - u16 service_specific_info_len; - u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN]; - /* - Set/Enable corresponding bits to disable responses after followUp. - BIT0 - Disable followUp response from FW. - */ - u8 recv_indication_cfg; - - /* - Sequence of values indicating the service specific info in SDEA - */ - u16 sdea_service_specific_info_len; - u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN]; -} NanTransmitFollowupRequest; - -/* - Stats Request structure - The Discovery Engine can be queried at runtime by the Host processor for statistics - concerning various parts of the Discovery Engine. -*/ -typedef struct { - NanStatsType stats_type; /* NAN Statistics Request Type */ - u8 clear; /* 0= Do not clear the stats and return the current contents , 1= Clear the associated - stats */ -} NanStatsRequest; - -/* - Config Structure - The NanConfigurationReq message is sent by the Host to the - Discovery Engine in order to configure the Discovery Engine during runtime. -*/ -typedef struct { - u8 config_sid_beacon; - u8 sid_beacon; - u8 config_rssi_proximity; - u8 rssi_proximity; // default value -60dBm - u8 config_master_pref; - u8 master_pref; // default value 0x02 - /* - 1 byte value which defines the RSSI filter threshold. - Any Service Descriptors received above this value - that are configured for RSSI filtering will be dropped. - The rssi values should be specified without sign. - For eg: -70dBm should be specified as 70. - */ - u8 config_5g_rssi_close_proximity; - u8 rssi_close_proximity_5g_val; // default value -60dBm - /* - Optional configuration of Configure request. - Each of the optional parameters have configure flag which - determine whether configuration is to be passed or not. - */ - /* - 1 byte quantity which defines the window size over - which the “average RSSI” will be calculated over. - */ - u8 config_rssi_window_size; - u8 rssi_window_size_val; // default value 0x08 - /* - If set to 1, the Discovery Engine will enclose the Cluster - Attribute only sent in Beacons in a Vendor Specific Attribute - and transmit in a Service Descriptor Frame. - */ - u8 config_cluster_attribute_val; - /* - The periodicity in seconds between full scan’s to find any new - clusters available in the area. A Full scan should not be done - more than every 10 seconds and should not be done less than every - 30 seconds. - */ - u8 config_scan_params; - NanSocialChannelScanParams scan_params_val; - /* - 1 byte quantity which forces the Random Factor to a particular - value for all transmitted Sync/Discovery beacons - */ - u8 config_random_factor_force; - u8 random_factor_force_val; // default value 0x00 - /* - 1 byte quantity which forces the HC for all transmitted Sync and - Discovery Beacon NO matter the real HC being received over the - air. - */ - u8 config_hop_count_force; - u8 hop_count_force_val; // default value of 0 - /* NAN Post Connectivity Capability */ - u8 config_conn_capability; - NanTransmitPostConnectivityCapability conn_capability_val; - /* NAN Post Discover Capability */ - u8 num_config_discovery_attr; - NanTransmitPostDiscovery discovery_attr_val[NAN_MAX_POSTDISCOVERY_LEN]; - /* NAN Further availability Map */ - u8 config_fam; - NanFurtherAvailabilityMap fam_val; - /* Configure 2.4/5GHz DW */ - NanConfigDW config_dw; - /* - By default discovery MAC address randomization is enabled - and default interval value is 30 minutes i.e. 1800 seconds. - The value 0 is used to disable MAC addr randomization. - */ - u8 config_disc_mac_addr_randomization; - u32 disc_mac_addr_rand_interval_sec; // default value of 30 minutes - - /* - Set/Enable corresponding bits to disable Discovery indications: - BIT0 - Disable Discovery MAC Address Event. - BIT1 - Disable Started Cluster Event. - BIT2 - Disable Joined Cluster Event. - */ - u8 discovery_indication_cfg; // default value of 0 - /* - BIT 0 is used to specify to include Service IDs in Sync/Discovery beacons - 0 - Do not include SIDs in any beacons - 1 - Include SIDs in all beacons. - Rest 7 bits are count field which allows control over the number of SIDs - included in the Beacon. 0 means to include as many SIDs that fit into - the maximum allow Beacon frame size - */ - u8 config_subscribe_sid_beacon; - u32 subscribe_sid_beacon_val; // default value 0x0 - /* - Discovery Beacon Interval config. - Default value is 128 msec in 2G DW and 176 msec in 2G/5G DW. - When 0 value is passed it is reset to default value of 128 or 176 msec. - */ - u8 config_discovery_beacon_int; - u32 discovery_beacon_interval; - /* - Enable Number of Spatial Streams. - This is NAN Power Optimization feature for NAN discovery. - */ - u8 config_nss; - // default value is implementation specific and passing 0 sets it to default - u32 nss; - /* - Enable device level NAN Ranging feature. - 0 - Disable - 1 - Enable - */ - u8 config_enable_ranging; - u32 enable_ranging; - /* - Enable/Disable DW Early termination. - 0 - Disable - 1 - Enable - */ - u8 config_dw_early_termination; - u32 enable_dw_termination; - /* - Indicate whether to use NDPE attribute to bring-up TCP/IP connection - If config_ndpe_attr is not configured, the default behavior is - not using NDPE attr, and the capability is not advertised. - 0 - Not use - 1 - Use - */ - u8 config_ndpe_attr; - u32 use_ndpe_attr; - /* - Enable NAN v3.1 instant communication mode. - 0 - Disable - 1 - Enable - */ - u8 config_enable_instant_mode; - u32 enable_instant_mode; - /* - Config NAN v3.1 instant communication channel selected over NFC/OOB method. - If dual band is supported default channel is 149 or 44 as per regulatory domain, - else channel 6 (send frequency in MHz). - Sometimes depending on country code retrictions, even 149/44 may be restricted - in those cases instant channel will be operational only in 2.4GHz. - Use wifi_get_usable_channels() API to get supported bands/channels before - Instant mode NFC handshake is triggered - */ - u8 config_instant_mode_channel; - wifi_channel instant_mode_channel; -} NanConfigRequest; - -/* - TCA Structure - The Discovery Engine can be configured to send up Events whenever a configured - Threshold Crossing Alert (TCA) Type crosses an integral threshold in a particular direction. -*/ -typedef struct { - NanTcaType tca_type; /* Nan Protocol Threshold Crossing Alert (TCA) Codes */ - - /* flag which control whether or not an event is generated for the Rising direction */ - u8 rising_direction_evt_flag; /* 0 - no event, 1 - event */ - - /* flag which control whether or not an event is generated for the Falling direction */ - u8 falling_direction_evt_flag; /* 0 - no event, 1 - event */ - - /* flag which requests a previous TCA request to be cleared from the DE */ - u8 clear; /*0= Do not clear the TCA, 1=Clear the TCA */ - - /* 32 bit value which represents the threshold to be used.*/ - u32 threshold; -} NanTCARequest; - -/* - Beacon Sdf Payload Structure - The Discovery Engine can be configured to publish vendor specific attributes as part of - beacon or service discovery frame transmitted as part of this request.. -*/ -typedef struct { - /* - NanVendorAttribute will have the Vendor Specific Attribute which the - vendor wants to publish as part of Discovery or Sync or Service discovery frame - */ - NanTransmitVendorSpecificAttribute vsa; -} NanBeaconSdfPayloadRequest; - -/* Publish statistics. */ -typedef struct { - u32 validPublishServiceReqMsgs; - u32 validPublishServiceRspMsgs; - u32 validPublishServiceCancelReqMsgs; - u32 validPublishServiceCancelRspMsgs; - u32 validPublishRepliedIndMsgs; - u32 validPublishTerminatedIndMsgs; - u32 validActiveSubscribes; - u32 validMatches; - u32 validFollowups; - u32 invalidPublishServiceReqMsgs; - u32 invalidPublishServiceCancelReqMsgs; - u32 invalidActiveSubscribes; - u32 invalidMatches; - u32 invalidFollowups; - u32 publishCount; - u32 publishNewMatchCount; - u32 pubsubGlobalNewMatchCount; -} NanPublishStats; - -/* Subscribe statistics. */ -typedef struct { - u32 validSubscribeServiceReqMsgs; - u32 validSubscribeServiceRspMsgs; - u32 validSubscribeServiceCancelReqMsgs; - u32 validSubscribeServiceCancelRspMsgs; - u32 validSubscribeTerminatedIndMsgs; - u32 validSubscribeMatchIndMsgs; - u32 validSubscribeUnmatchIndMsgs; - u32 validSolicitedPublishes; - u32 validMatches; - u32 validFollowups; - u32 invalidSubscribeServiceReqMsgs; - u32 invalidSubscribeServiceCancelReqMsgs; - u32 invalidSubscribeFollowupReqMsgs; - u32 invalidSolicitedPublishes; - u32 invalidMatches; - u32 invalidFollowups; - u32 subscribeCount; - u32 bloomFilterIndex; - u32 subscribeNewMatchCount; - u32 pubsubGlobalNewMatchCount; -} NanSubscribeStats; - -/* NAN DW Statistics*/ -typedef struct { - /* RX stats */ - u32 validFrames; - u32 validActionFrames; - u32 validBeaconFrames; - u32 ignoredActionFrames; - u32 ignoredBeaconFrames; - u32 invalidFrames; - u32 invalidActionFrames; - u32 invalidBeaconFrames; - u32 invalidMacHeaders; - u32 invalidPafHeaders; - u32 nonNanBeaconFrames; - - u32 earlyActionFrames; - u32 inDwActionFrames; - u32 lateActionFrames; - - /* TX stats */ - u32 framesQueued; - u32 totalTRSpUpdates; - u32 completeByTRSp; - u32 completeByTp75DW; - u32 completeByTendDW; - u32 lateActionFramesTx; -} NanDWStats; - -/* NAN MAC Statistics. */ -typedef struct { - /* RX stats */ - u32 validFrames; - u32 validActionFrames; - u32 validBeaconFrames; - u32 ignoredActionFrames; - u32 ignoredBeaconFrames; - u32 invalidFrames; - u32 invalidActionFrames; - u32 invalidBeaconFrames; - u32 invalidMacHeaders; - u32 invalidPafHeaders; - u32 nonNanBeaconFrames; - - u32 earlyActionFrames; - u32 inDwActionFrames; - u32 lateActionFrames; - - /* TX stats */ - u32 framesQueued; - u32 totalTRSpUpdates; - u32 completeByTRSp; - u32 completeByTp75DW; - u32 completeByTendDW; - u32 lateActionFramesTx; - - u32 twIncreases; - u32 twDecreases; - u32 twChanges; - u32 twHighwater; - u32 bloomFilterIndex; -} NanMacStats; - -/* NAN Sync Statistics*/ -typedef struct { - u64 currTsf; - u64 myRank; - u64 currAmRank; - u64 lastAmRank; - u32 currAmBTT; - u32 lastAmBTT; - u8 currAmHopCount; - u8 currRole; - u16 currClusterId; - - u64 timeSpentInCurrRole; - u64 totalTimeSpentAsMaster; - u64 totalTimeSpentAsNonMasterSync; - u64 totalTimeSpentAsNonMasterNonSync; - u32 transitionsToAnchorMaster; - u32 transitionsToMaster; - u32 transitionsToNonMasterSync; - u32 transitionsToNonMasterNonSync; - u32 amrUpdateCount; - u32 amrUpdateRankChangedCount; - u32 amrUpdateBTTChangedCount; - u32 amrUpdateHcChangedCount; - u32 amrUpdateNewDeviceCount; - u32 amrExpireCount; - u32 mergeCount; - u32 beaconsAboveHcLimit; - u32 beaconsBelowRssiThresh; - u32 beaconsIgnoredNoSpace; - u32 beaconsForOurCluster; - u32 beaconsForOtherCluster; - u32 beaconCancelRequests; - u32 beaconCancelFailures; - u32 beaconUpdateRequests; - u32 beaconUpdateFailures; - u32 syncBeaconTxAttempts; - u32 syncBeaconTxFailures; - u32 discBeaconTxAttempts; - u32 discBeaconTxFailures; - u32 amHopCountExpireCount; - u32 ndpChannelFreq; - u32 ndpChannelFreq2; - u32 schedUpdateChannelFreq; -} NanSyncStats; - -/* NAN Misc DE Statistics */ -typedef struct { - u32 validErrorRspMsgs; - u32 validTransmitFollowupReqMsgs; - u32 validTransmitFollowupRspMsgs; - u32 validFollowupIndMsgs; - u32 validConfigurationReqMsgs; - u32 validConfigurationRspMsgs; - u32 validStatsReqMsgs; - u32 validStatsRspMsgs; - u32 validEnableReqMsgs; - u32 validEnableRspMsgs; - u32 validDisableReqMsgs; - u32 validDisableRspMsgs; - u32 validDisableIndMsgs; - u32 validEventIndMsgs; - u32 validTcaReqMsgs; - u32 validTcaRspMsgs; - u32 validTcaIndMsgs; - u32 invalidTransmitFollowupReqMsgs; - u32 invalidConfigurationReqMsgs; - u32 invalidStatsReqMsgs; - u32 invalidEnableReqMsgs; - u32 invalidDisableReqMsgs; - u32 invalidTcaReqMsgs; -} NanDeStats; - -/* Publish Response Message structure */ -typedef struct { - u16 publish_id; -} NanPublishResponse; - -/* Subscribe Response Message structure */ -typedef struct { - u16 subscribe_id; -} NanSubscribeResponse; - -/* - Stats Response Message structure - The Discovery Engine response to a request by the Host for statistics. -*/ -typedef struct { - NanStatsType stats_type; - union { - NanPublishStats publish_stats; - NanSubscribeStats subscribe_stats; - NanMacStats mac_stats; - NanSyncStats sync_stats; - NanDeStats de_stats; - NanDWStats dw_stats; - } data; -} NanStatsResponse; - -/* Response returned for Initiators Data request */ -typedef struct { - /* - Unique token Id generated on the initiator - side used for a NDP session between two NAN devices - */ - NanDataPathId ndp_instance_id; -} NanDataPathRequestResponse; - -/* - NAN Response messages -*/ -typedef struct { - NanStatusType status; /* contains the result code */ - char nan_error[NAN_ERROR_STR_LEN]; /* Describe the NAN error type */ - NanResponseType response_type; /* NanResponseType Definitions */ - union { - NanPublishResponse publish_response; - NanSubscribeResponse subscribe_response; - NanStatsResponse stats_response; - NanDataPathRequestResponse data_request_response; - NanCapabilities nan_capabilities; - } body; -} NanResponseMsg; - -/* - Publish Replied Indication - The PublishRepliedInd Message is sent by the DE when an Active Subscribe is - received over the air and it matches a Solicited PublishServiceReq which had - been created with the replied_event_flag set. -*/ -typedef struct { - /* - A 32 bit Requestor Instance Id which is sent to the Application. - This Id will be sent in any subsequent UnmatchInd/FollowupInd - messages - */ - u32 requestor_instance_id; - u8 addr[NAN_MAC_ADDR_LEN]; - /* - If RSSI filtering was configured in NanPublishRequest then this - field will contain the received RSSI value. 0 if not - */ - u8 rssi_value; -} NanPublishRepliedInd; - -/* - Publish Terminated - The PublishTerminatedInd message is sent by the DE whenever a Publish - terminates from a user-specified timeout or a unrecoverable error in the DE. -*/ -typedef struct { - /* Id returned during the initial Publish */ - u16 publish_id; - /* - For all user configured termination NAN_STATUS_SUCCESS - and no other reasons expected from firmware. - */ - NanStatusType reason; - char nan_reason[NAN_ERROR_STR_LEN]; /* Describe the NAN reason type */ -} NanPublishTerminatedInd; - -/* - Match Indication - The MatchInd message is sent once per responding MAC address whenever - the Discovery Engine detects a match for a previous SubscribeServiceReq - or PublishServiceReq. -*/ -typedef struct { - /* Publish or Subscribe Id of an earlier Publish/Subscribe */ - u16 publish_subscribe_id; - /* - A 32 bit Requestor Instance Id which is sent to the Application. - This Id will be sent in any subsequent UnmatchInd/FollowupInd - messages - */ - u32 requestor_instance_id; - u8 addr[NAN_MAC_ADDR_LEN]; - - /* - Sequence of octets which were received in a Discovery Frame matching the - Subscribe Request. - */ - u16 service_specific_info_len; - u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN]; - - /* - Ordered sequence of pairs received in the Discovery Frame - matching the Subscribe Request. - */ - u16 sdf_match_filter_len; - u8 sdf_match_filter[NAN_MAX_MATCH_FILTER_LEN]; - - /* - flag to indicate if the Match occurred in a Beacon Frame or in a - Service Discovery Frame. - 0 - Match occured in a Service Discovery Frame - 1 - Match occured in a Beacon Frame - */ - u8 match_occured_flag; - - /* - flag to indicate FW is out of resource and that it can no longer - track this Service Name. The Host still need to send the received - Match_Handle but duplicate MatchInd messages may be received on - this Handle until the resource frees up. - 0 - FW is caching this match - 1 - FW is unable to cache this match - */ - u8 out_of_resource_flag; - - /* - If RSSI filtering was configured in NanSubscribeRequest then this - field will contain the received RSSI value. 0 if not. - All rssi values should be specified without sign. - For eg: -70dBm should be specified as 70. - */ - u8 rssi_value; - - /* - optional attributes. Each optional attribute is associated with a flag - which specifies whether the attribute is valid or not - */ - /* NAN Post Connectivity Capability received */ - u8 is_conn_capability_valid; - NanReceivePostConnectivityCapability conn_capability; - - /* NAN Post Discover Capability */ - u8 num_rx_discovery_attr; - NanReceivePostDiscovery discovery_attr[NAN_MAX_POSTDISCOVERY_LEN]; - - /* NAN Further availability Map */ - u8 num_chans; - NanFurtherAvailabilityChannel famchan[NAN_MAX_FAM_CHANNELS]; - - /* NAN Cluster Attribute */ - u8 cluster_attribute_len; - u8 cluster_attribute[NAN_MAX_CLUSTER_ATTRIBUTE_LEN]; - - /* NAN Cipher Suite */ - u32 peer_cipher_type; - - /* Security Context Identifiers length */ - u32 scid_len; - /* - Security Context Identifier attribute contains PMKID - shall be included in NDP setup and response messages. - Security Context Identifier, Identifies the Security - Context. For NAN Shared Key Cipher Suite, this field - contains the 16 octet PMKID identifying the PMK used - for setting up the Secure Data Path. - */ - u8 scid[NAN_MAX_SCID_BUF_LEN]; - - /* Peer service discovery extended attributes */ - NanSdeaCtrlParams peer_sdea_params; - - /* - Ranging indication and NanMatchAlg are not tied. - Ex: NanMatchAlg can indicate Match_ONCE, but ranging - indications can be continuous. All ranging indications - depend on SDEA control parameters of ranging required for - continuous, and ingress/egress values in the ranging config. - Ranging indication data is notified if: - 1) Ranging required is enabled in SDEA. - range info notified continuous. - 2) if range_limit ingress/egress MASKS are enabled - notify once for ingress >= ingress_distance - and egress <= egress_distance, same for ingress_egress_both - 3) if the Awake DW intervals are higher than the ranging intervals, - priority is given to the device DW intervalsi. - */ - /* - Range Info includes: - 1) distance to the NAN device with the MAC address indicated - with ranged mac address. - 2) Ranging event matching the configuration of continuous/ingress/egress. - */ - NanRangeInfo range_info; - - /* - Sequence of values indicating the service specific info in SDEA - */ - u16 sdea_service_specific_info_len; - u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN]; -} NanMatchInd; - -/* - MatchExpired Indication - The MatchExpiredInd message is sent whenever the Discovery Engine detects that - a previously Matched Service has been gone for too long. If the previous - MatchInd message for this Publish/Subscribe Id had the out_of_resource_flag - set then this message will not be received -*/ -typedef struct { - /* Publish or Subscribe Id of an earlier Publish/Subscribe */ - u16 publish_subscribe_id; - /* - 32 bit value sent by the DE in a previous - MatchInd/FollowupInd to the application. - */ - u32 requestor_instance_id; -} NanMatchExpiredInd; - -/* - Subscribe Terminated - The SubscribeTerminatedInd message is sent by the DE whenever a - Subscribe terminates from a user-specified timeout or a unrecoverable error in the DE. -*/ -typedef struct { - /* Id returned during initial Subscribe */ - u16 subscribe_id; - /* - For all user configured termination NAN_STATUS_SUCCESS - and no other reasons expected from firmware. - */ - NanStatusType reason; - char nan_reason[NAN_ERROR_STR_LEN]; /* Describe the NAN reason type */ -} NanSubscribeTerminatedInd; - -/* - Followup Indication Message - The FollowupInd message is sent by the DE to the Host whenever it receives a - Followup message from another peer. -*/ -typedef struct { - /* Publish or Subscribe Id of an earlier Publish/Subscribe */ - u16 publish_subscribe_id; - /* - A 32 bit Requestor instance Id which is sent to the Application. - This Id will be used in subsequent UnmatchInd/FollowupInd messages. - */ - u32 requestor_instance_id; - u8 addr[NAN_MAC_ADDR_LEN]; - - /* Flag which the DE uses to decide if received in a DW or a FAW*/ - u8 dw_or_faw; /* 0=Received in a DW, 1 = Received in a FAW*/ - - /* - Sequence of values which further specify the published service beyond - the service name - */ - u16 service_specific_info_len; - u8 service_specific_info[NAN_MAX_SERVICE_SPECIFIC_INFO_LEN]; - - /* - Sequence of values indicating the service specific info in SDEA - */ - u16 sdea_service_specific_info_len; - u8 sdea_service_specific_info[NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN]; -} NanFollowupInd; - -/* - Event data notifying the Mac address of the Discovery engine. - which is reported as one of the Discovery engine event -*/ -typedef struct { - u8 addr[NAN_MAC_ADDR_LEN]; -} NanMacAddressEvent; - -/* - Event data notifying the Cluster address of the cluster - which is reported as one of the Discovery engine event -*/ -typedef struct { - u8 addr[NAN_MAC_ADDR_LEN]; -} NanClusterEvent; - -/* - Discovery Engine Event Indication - The Discovery Engine can inform the Host when significant events occur - The data following the EventId is dependent upon the EventId type. - In other words, each new event defined will carry a different - structure of information back to the host. -*/ -typedef struct { - NanDiscEngEventType event_type; /* NAN Protocol Event Codes */ - union { - /* - MacAddressEvent which will have 6 byte mac address - of the Discovery engine. - */ - NanMacAddressEvent mac_addr; - /* - Cluster Event Data which will be obtained when the - device starts a new cluster or joins a cluster. - The event data will have 6 byte octet string of the - cluster started or joined. - */ - NanClusterEvent cluster; - } data; -} NanDiscEngEventInd; - -/* Cluster size TCA event*/ -typedef struct { - /* size of the cluster*/ - u32 cluster_size; -} NanTcaClusterEvent; - -/* - NAN TCA Indication - The Discovery Engine can inform the Host when significant events occur. - The data following the TcaId is dependent upon the TcaId type. - In other words, each new event defined will carry a different structure - of information back to the host. -*/ -typedef struct { - NanTcaType tca_type; - /* flag which defines if the configured Threshold has risen above the threshold */ - u8 rising_direction_evt_flag; /* 0 - no event, 1 - event */ - - /* flag which defines if the configured Threshold has fallen below the threshold */ - u8 falling_direction_evt_flag; /* 0 - no event, 1 - event */ - union { - /* - This event in obtained when the cluser size threshold - is crossed. Event will have the cluster size - */ - NanTcaClusterEvent cluster; - } data; -} NanTCAInd; - -/* - NAN Disabled Indication - The NanDisableInd message indicates to the upper layers that the Discovery - Engine has flushed all state and has been shutdown. When this message is received - the DE is guaranteed to have left the NAN cluster it was part of and will have terminated - any in progress Publishes or Subscribes. -*/ -typedef struct { - /* - Following reasons expected: - NAN_STATUS_SUCCESS - NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED - */ - NanStatusType reason; - char nan_reason[NAN_ERROR_STR_LEN]; /* Describe the NAN reason type */ -} NanDisabledInd; - -/* - NAN Beacon or SDF Payload Indication - The NanBeaconSdfPayloadInd message indicates to the upper layers that information - elements were received either in a Beacon or SDF which needs to be delivered - outside of a Publish/Subscribe Handle. -*/ -typedef struct { - /* The MAC address of the peer which sent the attributes.*/ - u8 addr[NAN_MAC_ADDR_LEN]; - /* - Optional attributes. Each optional attribute is associated with a flag - which specifies whether the attribute is valid or not - */ - /* NAN Receive Vendor Specific Attribute*/ - u8 is_vsa_received; - NanReceiveVendorSpecificAttribute vsa; - - /* NAN Beacon or SDF Payload Received*/ - u8 is_beacon_sdf_payload_received; - NanBeaconSdfPayloadReceive data; -} NanBeaconSdfPayloadInd; - -/* - Event Indication notifying the - transmit followup in progress -*/ -typedef struct { - transaction_id id; - /* - Following reason codes returned: - NAN_STATUS_SUCCESS - NAN_STATUS_NO_OTA_ACK - NAN_STATUS_PROTOCOL_FAILURE - */ - NanStatusType reason; - char nan_reason[NAN_ERROR_STR_LEN]; /* Describe the NAN reason type */ -} NanTransmitFollowupInd; - -/* - Data request Initiator/Responder - app/service related info -*/ -typedef struct { - u16 ndp_app_info_len; - u8 ndp_app_info[NAN_DP_MAX_APP_INFO_LEN]; -} NanDataPathAppInfo; - -/* QoS configuration */ -typedef enum { NAN_DP_CONFIG_NO_QOS = 0, NAN_DP_CONFIG_QOS } NanDataPathQosCfg; - -/* Configuration params of Data request Initiator/Responder */ -typedef struct { - /* Status Indicating Security/No Security */ - NanDataPathSecurityCfgStatus security_cfg; - NanDataPathQosCfg qos_cfg; -} NanDataPathCfg; - -/* Nan Data Path Initiator requesting a data session */ -typedef struct { - /* - Unique Instance Id identifying the Responder's service. - This is same as publish_id notified on the subscribe side - in a publish/subscribe scenario - */ - u32 requestor_instance_id; /* Value 0 for no publish/subscribe */ - - /* Config flag for channel request */ - NanDataPathChannelCfg channel_request_type; - /* Channel frequency in MHz to start data-path */ - wifi_channel channel; - /* - Discovery MAC addr of the publisher/peer - */ - u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN]; - /* - Interface name on which this NDP session is to be started. - This will be the same interface name provided during interface - create. - */ - char ndp_iface[IFNAMSIZ + 1]; - /* Initiator/Responder Security/QoS configuration */ - NanDataPathCfg ndp_cfg; - /* App/Service information of the Initiator */ - NanDataPathAppInfo app_info; - /* NAN Cipher Suite Type */ - u32 cipher_type; - /* - Nan Security Key Info is optional in Discovery phase. - PMK or passphrase info can be passed during - the NDP session. - */ - NanSecurityKeyInfo key_info; - /* length of service name */ - u32 service_name_len; - /* - UTF-8 encoded string identifying the service name. - The service name field is only used if a Nan discovery - is not associated with the NDP (out-of-band discovery). - */ - u8 service_name[NAN_MAX_SERVICE_NAME_LEN]; - - /* Security Context Identifiers length */ - u32 scid_len; - /* - Security Context Identifier attribute contains PMKID - shall be included in NDP setup and response messages. - Security Context Identifier, Identifies the Security - Context. For NAN Shared Key Cipher Suite, this field - contains the 16 octet PMKID identifying the PMK used - for setting up the Secure Data Path. - */ - u8 scid[NAN_MAX_SCID_BUF_LEN]; -} NanDataPathInitiatorRequest; - -/* - Data struct to initiate a data response on the responder side - for an indication received with a data request -*/ -typedef struct { - /* - Unique token Id generated on the initiator/responder - side used for a NDP session between two NAN devices - */ - NanDataPathId ndp_instance_id; - /* - Interface name on which this NDP session is to be started. - This will be the same interface name provided during interface - create. - */ - char ndp_iface[IFNAMSIZ + 1]; - /* Initiator/Responder Security/QoS configuration */ - NanDataPathCfg ndp_cfg; - /* App/Service information of the responder */ - NanDataPathAppInfo app_info; - /* Response Code indicating ACCEPT/REJECT/DEFER */ - NanDataPathResponseCode rsp_code; - /* NAN Cipher Suite Type */ - u32 cipher_type; - /* - Nan Security Key Info is optional in Discovery phase. - PMK or passphrase info can be passed during - the NDP session. - */ - NanSecurityKeyInfo key_info; - /* length of service name */ - u32 service_name_len; - /* - UTF-8 encoded string identifying the service name. - The service name field is only used if a Nan discovery - is not associated with the NDP (out-of-band discovery). - */ - u8 service_name[NAN_MAX_SERVICE_NAME_LEN]; - - /* Security Context Identifiers length */ - u32 scid_len; - /* - Security Context Identifier attribute contains PMKID - shall be included in NDP setup and response messages. - Security Context Identifier, Identifies the Security - Context. For NAN Shared Key Cipher Suite, this field - contains the 16 octet PMKID identifying the PMK used - for setting up the Secure Data Path. - */ - u8 scid[NAN_MAX_SCID_BUF_LEN]; -} NanDataPathIndicationResponse; - -/* NDP termination info */ -typedef struct { - u8 num_ndp_instances; - /* - Unique token Id generated on the initiator/responder side - used for a NDP session between two NAN devices - */ - NanDataPathId ndp_instance_id[]; -} NanDataPathEndRequest; - -/* - Event indication received on the - responder side when a Nan Data request or - NDP session is initiated on the Initiator side -*/ -typedef struct { - /* - Unique Instance Id corresponding to a service/session. - This is similar to the publish_id generated on the - publisher side - */ - u16 service_instance_id; - /* Discovery MAC addr of the peer/initiator */ - u8 peer_disc_mac_addr[NAN_MAC_ADDR_LEN]; - /* - Unique token Id generated on the initiator/responder side - used for a NDP session between two NAN devices - */ - NanDataPathId ndp_instance_id; - /* Initiator/Responder Security/QoS configuration */ - NanDataPathCfg ndp_cfg; - /* App/Service information of the initiator */ - NanDataPathAppInfo app_info; - - /* Security Context Identifiers length */ - u32 scid_len; - /* - Security Context Identifier attribute contains PMKID - shall be included in NDP setup and response messages. - Security Context Identifier, Identifies the Security - Context. For NAN Shared Key Cipher Suite, this field - contains the 16 octet PMKID identifying the PMK used - for setting up the Secure Data Path. - */ - u8 scid[NAN_MAX_SCID_BUF_LEN]; -} NanDataPathRequestInd; - -/* - Event indication of data confirm is received on both - initiator and responder side confirming a NDP session -*/ -typedef struct { - /* - Unique token Id generated on the initiator/responder side - used for a NDP session between two NAN devices - */ - NanDataPathId ndp_instance_id; - /* - NDI mac address of the peer - (required to derive target ipv6 address) - */ - u8 peer_ndi_mac_addr[NAN_MAC_ADDR_LEN]; - /* App/Service information of Initiator/Responder */ - NanDataPathAppInfo app_info; - /* Response code indicating ACCEPT/REJECT/DEFER */ - NanDataPathResponseCode rsp_code; - /* - Reason code indicating the cause for REJECT. - NAN_STATUS_SUCCESS and NAN_STATUS_PROTOCOL_FAILURE are - expected reason codes. - */ - NanStatusType reason_code; - /* Number of channels for which info is indicated */ - u32 num_channels; - /* - Data indicating the Channel list and BW of the channel. - */ - NanChannelInfo channel_info[NAN_MAX_CHANNEL_INFO_SUPPORTED]; -} NanDataPathConfirmInd; - -/* - Event indication of schedule update is received on both - initiator and responder when a schedule change occurs -*/ -typedef struct { - /* - NMI mac address - */ - u8 peer_mac_addr[NAN_MAC_ADDR_LEN]; - /* - Reason code indicating the cause of schedule update. - BIT_0 NSS Update - BIT_1 Channel list update - */ - u32 schedule_update_reason_code; - /* Number of channels for which info is indicated */ - u32 num_channels; - /* - Data indicating the Channel list and BW of the channel. - */ - NanChannelInfo channel_info[NAN_MAX_CHANNEL_INFO_SUPPORTED]; - /* Number of NDP instance Ids */ - u8 num_ndp_instances; - /* - Unique token Id generated on the initiator/responder side - used for a NDP session between two NAN devices - */ - NanDataPathId ndp_instance_id[]; -} NanDataPathScheduleUpdateInd; - -/* - Event indication received on the - initiator/responder side terminating - a NDP session -*/ -typedef struct { - u8 num_ndp_instances; - /* - Unique token Id generated on the initiator/responder side - used for a NDP session between two NAN devices - */ - NanDataPathId ndp_instance_id[]; -} NanDataPathEndInd; - -/* - Event indicating Range Request received on the - Published side. -*/ -typedef struct { - u16 publish_id; /* id is existing publish */ - /* Range Requestor's MAC address */ - u8 range_req_intf_addr[NAN_MAC_ADDR_LEN]; -} NanRangeRequestInd; - -/* - Event indicating Range report on the - Published side. -*/ -typedef struct { - u16 publish_id; /* id is existing publish */ - /* Range Requestor's MAC address */ - u8 range_req_intf_addr[NAN_MAC_ADDR_LEN]; - /* - Distance to the NAN device with the MAC address indicated - with ranged mac address. - */ - u32 range_measurement_mm; -} NanRangeReportInd; - -/* Response and Event Callbacks */ -typedef struct { - /* NotifyResponse invoked to notify the status of the Request */ - void (*NotifyResponse)(transaction_id id, NanResponseMsg* rsp_data); - /* Callbacks for various Events */ - void (*EventPublishReplied)(NanPublishRepliedInd* event); - void (*EventPublishTerminated)(NanPublishTerminatedInd* event); - void (*EventMatch)(NanMatchInd* event); - void (*EventMatchExpired)(NanMatchExpiredInd* event); - void (*EventSubscribeTerminated)(NanSubscribeTerminatedInd* event); - void (*EventFollowup)(NanFollowupInd* event); - void (*EventDiscEngEvent)(NanDiscEngEventInd* event); - void (*EventDisabled)(NanDisabledInd* event); - void (*EventTca)(NanTCAInd* event); - void (*EventBeaconSdfPayload)(NanBeaconSdfPayloadInd* event); - void (*EventDataRequest)(NanDataPathRequestInd* event); - void (*EventDataConfirm)(NanDataPathConfirmInd* event); - void (*EventDataEnd)(NanDataPathEndInd* event); - void (*EventTransmitFollowup)(NanTransmitFollowupInd* event); - void (*EventRangeRequest)(NanRangeRequestInd* event); - void (*EventRangeReport)(NanRangeReportInd* event); - void (*EventScheduleUpdate)(NanDataPathScheduleUpdateInd* event); -} NanCallbackHandler; - -/**@brief nan_enable_request - * Enable NAN functionality - * - * @param transaction_id: - * @param wifi_interface_handle: - * @param NanEnableRequest: - * @return Synchronous wifi_error - * @return Asynchronous NotifyResponse CB return - * NAN_STATUS_SUCCESS - * NAN_STATUS_ALREADY_ENABLED - * NAN_STATUS_INVALID_PARAM - * NAN_STATUS_INTERNAL_FAILURE - * NAN_STATUS_PROTOCOL_FAILURE - * NAN_STATUS_NAN_NOT_ALLOWED - */ -wifi_error nan_enable_request(transaction_id id, wifi_interface_handle iface, - NanEnableRequest* msg); - -/**@brief nan_disbale_request - * Disable NAN functionality. - * - * @param transaction_id: - * @param wifi_interface_handle: - * @param NanDisableRequest: - * @return Synchronous wifi_error - * @return Asynchronous NotifyResponse CB return - * NAN_STATUS_SUCCESS - * NAN_STATUS_PROTOCOL_FAILURE - * - */ -wifi_error nan_disable_request(transaction_id id, wifi_interface_handle iface); - -/**@brief nan_publish_request - * Publish request to advertize a service - * - * @param transaction_id: - * @param wifi_interface_handle: - * @param NanPublishRequest: - * @return Synchronous wifi_error - * @return Asynchronous NotifyResponse CB return - * NAN_STATUS_SUCCESS - * NAN_STATUS_INVALID_PARAM - * NAN_STATUS_PROTOCOL_FAILURE - * NAN_STATUS_NO_RESOURCE_AVAILABLE - * NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID - */ -wifi_error nan_publish_request(transaction_id id, wifi_interface_handle iface, - NanPublishRequest* msg); - -/**@brief nan_publish_cancel_request - * Cancel previous publish request - * - * @param transaction_id: - * @param wifi_interface_handle: - * @param NanPublishCancelRequest: - * @return Synchronous wifi_error - * @return Asynchronous NotifyResponse CB return - * NAN_STATUS_SUCCESS - * NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID - * NAN_STATUS_INTERNAL_FAILURE - */ -wifi_error nan_publish_cancel_request(transaction_id id, wifi_interface_handle iface, - NanPublishCancelRequest* msg); - -/**@brief nan_subscribe_request - * Subscribe request to search for a service - * - * @param transaction_id: - * @param wifi_interface_handle: - * @param NanSubscribeRequest: - * @return Synchronous wifi_error - * @return Asynchronous NotifyResponse CB return - * NAN_STATUS_SUCCESS - * NAN_STATUS_INVALID_PARAM - * NAN_STATUS_PROTOCOL_FAILURE - * NAN_STATUS_INTERNAL_FAILURE - * NAN_STATUS_NO_SPACE_AVAILABLE - * NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID - */ -wifi_error nan_subscribe_request(transaction_id id, wifi_interface_handle iface, - NanSubscribeRequest* msg); - -/**@brief nan_subscribe_cancel_request - * Cancel previous subscribe requests. - * - * @param transaction_id: - * @param wifi_interface_handle: - * @param NanSubscribeRequest: - * @return Synchronous wifi_error - * @return Asynchronous NotifyResponse CB return - * NAN_STATUS_SUCCESS - * NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID - * NAN_STATUS_INTERNAL_FAILURE - */ -wifi_error nan_subscribe_cancel_request(transaction_id id, wifi_interface_handle iface, - NanSubscribeCancelRequest* msg); - -/**@brief nan_transmit_followup_request - * NAN transmit follow up request - * - * @param transaction_id: - * @param wifi_interface_handle: - * @param NanTransmitFollowupRequest: - * @return Synchronous wifi_error - * @return Asynchronous NotifyResponse CB return - * NAN_STATUS_SUCCESS - * NAN_STATUS_INVALID_PARAM - * NAN_STATUS_INTERNAL_FAILURE - * NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID - * NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID - * NAN_STATUS_FOLLOWUP_QUEUE_FULL - * @return Asynchronous TransmitFollowupInd CB return - * NAN_STATUS_SUCCESS - * NAN_STATUS_PROTOCOL_FAILURE - * NAN_STATUS_NO_OTA_ACK - */ -wifi_error nan_transmit_followup_request(transaction_id id, wifi_interface_handle iface, - NanTransmitFollowupRequest* msg); - -/**@brief nan_stats_request - * Request NAN statistics from Discovery Engine. - * - * @param transaction_id: - * @param wifi_interface_handle: - * @param NanStatsRequest: - * @return Synchronous wifi_error - * @return Asynchronous NotifyResponse CB return - * NAN_STATUS_SUCCESS - * NAN_STATUS_INTERNAL_FAILURE - * NAN_STATUS_INVALID_PARAM - */ -wifi_error nan_stats_request(transaction_id id, wifi_interface_handle iface, NanStatsRequest* msg); - -/**@brief nan_config_request - * NAN configuration request. - * - * @param transaction_id: - * @param wifi_interface_handle: - * @param NanConfigRequest: - * @return Synchronous wifi_error - * @return Asynchronous NotifyResponse CB return - * NAN_STATUS_SUCCESS - * NAN_STATUS_INVALID_PARAM - * NAN_STATUS_PROTOCOL_FAILURE - * NAN_STATUS_INTERNAL_FAILURE - */ -wifi_error nan_config_request(transaction_id id, wifi_interface_handle iface, - NanConfigRequest* msg); - -/**@brief nan_tca_request - * Configure the various Threshold crossing alerts - * - * @param transaction_id: - * @param wifi_interface_handle: - * @param NanStatsRequest: - * @return Synchronous wifi_error - * @return Asynchronous NotifyResponse CB return - * NAN_STATUS_SUCCESS - * NAN_STATUS_INVALID_PARAM - * NAN_STATUS_INTERNAL_FAILURE - */ -wifi_error nan_tca_request(transaction_id id, wifi_interface_handle iface, NanTCARequest* msg); - -/**@brief nan_beacon_sdf_payload_request - * Set NAN Beacon or sdf payload to discovery engine. - * This instructs the Discovery Engine to begin publishing the - * received payload in any Beacon or Service Discovery Frame transmitted - * - * @param transaction_id: - * @param wifi_interface_handle: - * @param NanStatsRequest: - * @return Synchronous wifi_error - * @return Asynchronous NotifyResponse CB return - * NAN_STATUS_SUCCESS - * NAN_STATUS_INVALID_PARAM - * NAN_STATUS_INTERNAL_FAILURE - */ -wifi_error nan_beacon_sdf_payload_request(transaction_id id, wifi_interface_handle iface, - NanBeaconSdfPayloadRequest* msg); - -/* Register NAN callbacks. */ -wifi_error nan_register_handler(wifi_interface_handle iface, NanCallbackHandler handlers); - -/* Get NAN HAL version. */ -wifi_error nan_get_version(wifi_handle handle, NanVersion* version); - -/**@brief nan_get_capabilities - * Get NAN Capabilities - * - * @param transaction_id: - * @param wifi_interface_handle: - * @return Synchronous wifi_error - * @return Asynchronous NotifyResponse CB return - * NAN_STATUS_SUCCESS - */ -/* Get NAN capabilities. */ -wifi_error nan_get_capabilities(transaction_id id, wifi_interface_handle iface); - -/* ========== Nan Data Path APIs ================ */ -/**@brief nan_data_interface_create - * Create NAN Data Interface. - * - * @param transaction_id: - * @param wifi_interface_handle: - * @param iface_name: - * @return Synchronous wifi_error - * @return Asynchronous NotifyResponse CB return - * NAN_STATUS_SUCCESS - * NAN_STATUS_INVALID_PARAM - * NAN_STATUS_INTERNAL_FAILURE - */ -wifi_error nan_data_interface_create(transaction_id id, wifi_interface_handle iface, - char* iface_name); - -/**@brief nan_data_interface_delete - * Delete NAN Data Interface. - * - * @param transaction_id: - * @param wifi_interface_handle: - * @param iface_name: - * @return Synchronous wifi_error - * @return Asynchronous NotifyResponse CB return - * NAN_STATUS_SUCCESS - * NAN_STATUS_INVALID_PARAM - * NAN_STATUS_INTERNAL_FAILURE - */ -wifi_error nan_data_interface_delete(transaction_id id, wifi_interface_handle iface, - char* iface_name); - -/**@brief nan_data_request_initiator - * Initiate a NAN Data Path session. - * - * @param transaction_id: - * @param wifi_interface_handle: - * @param NanDataPathInitiatorRequest: - * @return Synchronous wifi_error - * @return Asynchronous NotifyResponse CB return - * NAN_STATUS_SUCCESS - * NAN_STATUS_INVALID_PARAM - * NAN_STATUS_INTERNAL_FAILURE - * NAN_STATUS_PROTOCOL_FAILURE - * NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID - */ -wifi_error nan_data_request_initiator(transaction_id id, wifi_interface_handle iface, - NanDataPathInitiatorRequest* msg); - -/**@brief nan_data_indication_response - * Response to a data indication received - * corresponding to a NDP session. An indication - * is received with a data request and the responder - * will send a data response - * - * @param transaction_id: - * @param wifi_interface_handle: - * @param NanDataPathIndicationResponse: - * @return Synchronous wifi_error - * @return Asynchronous NotifyResponse CB return - * NAN_STATUS_SUCCESS - * NAN_STATUS_INVALID_PARAM - * NAN_STATUS_INTERNAL_FAILURE - * NAN_STATUS_PROTOCOL_FAILURE - * NAN_STATUS_INVALID_NDP_ID - */ -wifi_error nan_data_indication_response(transaction_id id, wifi_interface_handle iface, - NanDataPathIndicationResponse* msg); - -/**@brief nan_data_end - * NDL termination request: from either Initiator/Responder - * - * @param transaction_id: - * @param wifi_interface_handle: - * @param NanDataPathEndRequest: - * @return Synchronous wifi_error - * @return Asynchronous NotifyResponse CB return - * NAN_STATUS_SUCCESS - * NAN_STATUS_INVALID_PARAM - * NAN_STATUS_INTERNAL_FAILURE - * NAN_STATUS_PROTOCOL_FAILURE - * NAN_STATUS_INVALID_NDP_ID - */ -wifi_error nan_data_end(transaction_id id, wifi_interface_handle iface, NanDataPathEndRequest* msg); -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __NAN_H__ */ diff --git a/wifi/1.6/default/hal_legacy/wifi_offload.h b/wifi/1.6/default/hal_legacy/wifi_offload.h deleted file mode 100644 index 0c69e39f75..0000000000 --- a/wifi/1.6/default/hal_legacy/wifi_offload.h +++ /dev/null @@ -1,30 +0,0 @@ -#include "wifi_hal.h" - -#ifndef __WIFI_HAL_OFFLOAD_H -#define __WIFI_HAL_OFFLOAD_H - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -#define ETHER_ADDR_LEN 6 // Ethernet frame address length -#define N_AVAIL_ID 3 // available mkeep_alive IDs from 1 to 3 -#define MKEEP_ALIVE_IP_PKT_MAX 256 // max size of IP packet for keep alive - -/** - * Send specified keep alive packet periodically. - */ -wifi_error wifi_start_sending_offloaded_packet(wifi_request_id id, wifi_interface_handle iface, - u16 ether_type, u8* ip_packet, u16 ip_packet_len, - u8* src_mac_addr, u8* dst_mac_addr, u32 period_msec); - -/** - * Stop sending keep alive packet. - */ -wifi_error wifi_stop_sending_offloaded_packet(wifi_request_id id, wifi_interface_handle iface); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /*__WIFI_HAL_OFFLOAD_H */ diff --git a/wifi/1.6/default/hal_legacy/wifi_twt.h b/wifi/1.6/default/hal_legacy/wifi_twt.h deleted file mode 100644 index 994bb18262..0000000000 --- a/wifi/1.6/default/hal_legacy/wifi_twt.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (C) 2020 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. - */ - -#ifndef __WIFI_HAL_TWT_H__ -#define __WIFI_HAL_TWT_H__ - -#include "wifi_hal.h" - -typedef struct { - u8 requester_supported; // 0 for not supporting requester - u8 responder_supported; // 0 for not supporting responder - u8 broadcast_twt_supported; // 0 for not supporting broadcast TWT - u8 flexibile_twt_supported; // 0 for not supporting flexible TWT -} TwtCapability; - -typedef struct { - TwtCapability device_capability; - TwtCapability peer_capability; -} TwtCapabilitySet; - -// For all optional fields below, if no value specify -1 -typedef struct { - u8 config_id; // An unique ID for an individual TWT request - u8 negotiation_type; // 0 for individual TWT, 1 for broadcast TWT - u8 trigger_type; // 0 for non-triggered TWT, 1 for triggered TWT - s32 wake_dur_us; // Proposed wake duration in us - s32 wake_int_us; // Average wake interval in us - s32 wake_int_min_us; // Min wake interval in us. Optional. - s32 wake_int_max_us; // Max wake interval in us. Optional. - s32 wake_dur_min_us; // Min wake duration in us. Optional. - s32 wake_dur_max_us; // Max wake duration in us. Optional. - s32 avg_pkt_size; // Average bytes of each packet to send in each wake - // duration. Optional. - s32 avg_pkt_num; // Average number of packets to send in each wake - // duration. Optional. - s32 wake_time_off_us; // First wake duration time offset in us. Optional. -} TwtSetupRequest; - -typedef enum { - TWT_SETUP_SUCCESS = 0, // TWT setup is accepted. - TWT_SETUP_REJECT = 1, // TWT setup is rejected by AP. - TWT_SETUP_TIMEOUT = 2, // TWT setup response from AP times out. - TWT_SETUP_IE = 3, // AP sent TWT Setup IE parsing failure. - TWT_SETUP_PARAMS = 4, // AP sent TWT Setup IE Parameters invalid. - TWT_SETUP_ERROR = 255, // Generic error -} TwtSetupReasonCode; - -typedef struct { - u8 config_id; // An unique ID for an individual TWT request - u8 status; // 0 for success, non-zero for failure - TwtSetupReasonCode reason_code; - u8 negotiation_type; // 0 for individual TWT, 1 for broadcast TWT - u8 trigger_type; // 0 for non-triggered TWT, 1 for triggered TWT - s32 wake_dur_us; // Proposed wake duration in us - s32 wake_int_us; // Average wake interval in us - s32 wake_time_off_us; // First wake duration time offset in us. -} TwtSetupResponse; - -typedef struct { - u8 config_id; // An unique ID for an individual TWT request - u8 all_twt; // 0 for individual setp request, 1 for all TWT - u8 negotiation_type; // 0 for individual TWT, 1 for broadcast TWT -} TwtTeardownRequest; - -typedef enum { - TWT_TD_RC_HOST = 0, // Teardown triggered by Host - TWT_TD_RC_PEER = 1, // Peer initiated teardown - TWT_TD_RC_MCHAN = 2, // Teardown due to MCHAN Active - TWT_TD_RC_MCNX = 3, // Teardown due to MultiConnection - TWT_TD_RC_CSA = 4, // Teardown due to CSA - TWT_TD_RC_BTCX = 5, // Teardown due to BT Coex - TWT_TD_RC_SETUP_FAIL = 6, // Setup fails midway. Teardown all connections - TWT_TD_RC_SCHED = 7, // Teardown by TWT Scheduler - TWT_TD_RC_ERROR = 255, // Generic error cases -} TwtTeardownReason; - -typedef struct { - u8 config_id; // An unique ID for an individual TWT request - u8 all_twt; // 0 for individual setp request, 1 for all TWT - u8 status; // 0 for success, non-zero for failure - TwtTeardownReason reason; -} TwtTeardownCompletion; - -typedef struct { - u8 config_id; // An unique ID for an individual TWT request - u8 all_twt; // 0 for individual setup request, 1 for all TWT - s32 resume_time_us; // If -1, TWT is suspended for indefinite time. - // Otherwise, TWT is suspended for resume_time_us -} TwtInfoFrameRequest; - -typedef enum { - TWT_INFO_RC_HOST = 0, // Host initiated TWT Info frame */ - TWT_INFO_RC_PEER = 1, // Peer initiated TWT Info frame - TWT_INFO_RC_ERROR = 2, // Generic error conditions */ -} TwtInfoFrameReason; - -// TWT Info frame triggered externally. -// Device should not send TwtInfoFrameReceived to Host for internally -// triggered TWT Info frame during SCAN, MCHAN operations. -typedef struct { - u8 config_id; // An unique ID for an individual TWT request - u8 all_twt; // 0 for individual setup request, 1 for all TWT - u8 status; // 0 for success, non-zero for failure - TwtInfoFrameReason reason; - u8 twt_resumed; // 1 - TWT resumed, 0 - TWT suspended -} TwtInfoFrameReceived; - -typedef struct { - u8 config_id; - u32 avg_pkt_num_tx; // Average number of Tx packets in each wake duration. - u32 avg_pkt_num_rx; // Average number of Rx packets in each wake duration. - u32 avg_tx_pkt_size; // Average bytes per Rx packet in each wake duration. - u32 avg_rx_pkt_size; // Average bytes per Rx packet in each wake duration. - u32 avg_eosp_dur_us; // Average duration of early terminated SP - u32 eosp_count; // Count of early terminations - u32 num_sp; // Count of service period (SP), also known as wake duration. -} TwtStats; - -// Asynchronous notification from the device. -// For example, TWT was torn down by the device and later when the device is -// ready, it can send this async notification. -// This can be expandable in future. -typedef enum { - TWT_NOTIF_ALLOW_TWT = 1, // Device ready to process TWT Setup request -} TwtNotification; - -typedef struct { - TwtNotification notification; -} TwtDeviceNotify; - -// Callbacks for various TWT responses and events -typedef struct { - // Callback for TWT setup response - void (*EventTwtSetupResponse)(TwtSetupResponse* event); - // Callback for TWT teardown completion - void (*EventTwtTeardownCompletion)(TwtTeardownCompletion* event); - // Callback for TWT info frame received event - void (*EventTwtInfoFrameReceived)(TwtInfoFrameReceived* event); - // Callback for TWT notification from the device - void (*EventTwtDeviceNotify)(TwtDeviceNotify* event); -} TwtCallbackHandler; - -#endif /* __WIFI_HAL_TWT_H__ */ diff --git a/wifi/1.6/default/hidl_callback_util.h b/wifi/1.6/default/hidl_callback_util.h deleted file mode 100644 index aab0ae5393..0000000000 --- a/wifi/1.6/default/hidl_callback_util.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (C) 2017 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. - */ - -#ifndef HIDL_CALLBACK_UTIL_H_ -#define HIDL_CALLBACK_UTIL_H_ - -#include - -#include -#include - -namespace { -// Type of callback invoked by the death handler. -using on_death_cb_function = std::function; - -// Private class used to keep track of death of individual -// callbacks stored in HidlCallbackHandler. -template -class HidlDeathHandler : public android::hardware::hidl_death_recipient { - public: - HidlDeathHandler(const on_death_cb_function& user_cb_function) - : cb_function_(user_cb_function) {} - ~HidlDeathHandler() = default; - - // Death notification for callbacks. - void serviceDied(uint64_t cookie, - const android::wp& /* who */) override { - cb_function_(cookie); - } - - private: - on_death_cb_function cb_function_; - - DISALLOW_COPY_AND_ASSIGN(HidlDeathHandler); -}; -} // namespace - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace hidl_callback_util { -template -// Provides a class to manage callbacks for the various HIDL interfaces and -// handle the death of the process hosting each callback. -class HidlCallbackHandler { - public: - HidlCallbackHandler() - : death_handler_(new HidlDeathHandler( - std::bind(&HidlCallbackHandler::onObjectDeath, this, std::placeholders::_1))) {} - ~HidlCallbackHandler() = default; - - bool addCallback(const sp& cb) { - // TODO(b/33818800): Can't compare proxies yet. So, use the cookie - // (callback proxy's raw pointer) to track the death of individual - // clients. - uint64_t cookie = reinterpret_cast(cb.get()); - for (const auto& s : cb_set_) { - if (interfacesEqual(cb, s)) { - LOG(ERROR) << "Duplicate death notification registration"; - return true; - } - } - if (!cb->linkToDeath(death_handler_, cookie)) { - LOG(ERROR) << "Failed to register death notification"; - return false; - } - cb_set_.insert(cb); - return true; - } - - const std::set>& getCallbacks() { return cb_set_; } - - // Death notification for callbacks. - void onObjectDeath(uint64_t cookie) { - CallbackType* cb = reinterpret_cast(cookie); - const auto& iter = cb_set_.find(cb); - if (iter == cb_set_.end()) { - LOG(ERROR) << "Unknown callback death notification received"; - return; - } - cb_set_.erase(iter); - LOG(DEBUG) << "Dead callback removed from list"; - } - - void invalidate() { - for (const sp& cb : cb_set_) { - if (!cb->unlinkToDeath(death_handler_)) { - LOG(ERROR) << "Failed to deregister death notification"; - } - } - cb_set_.clear(); - } - - private: - std::set> cb_set_; - sp> death_handler_; - - DISALLOW_COPY_AND_ASSIGN(HidlCallbackHandler); -}; - -} // namespace hidl_callback_util -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android -#endif // HIDL_CALLBACK_UTIL_H_ diff --git a/wifi/1.6/default/hidl_return_util.h b/wifi/1.6/default/hidl_return_util.h deleted file mode 100644 index a0efac2c57..0000000000 --- a/wifi/1.6/default/hidl_return_util.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef HIDL_RETURN_UTIL_H_ -#define HIDL_RETURN_UTIL_H_ - -#include "hidl_sync_util.h" -#include "wifi_status_util.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace hidl_return_util { -using namespace android::hardware::wifi::V1_0; - -/** - * These utility functions are used to invoke a method on the provided - * HIDL interface object. - * These functions checks if the provided HIDL interface object is valid. - * a) if valid, Invokes the corresponding internal implementation function of - * the HIDL method. It then invokes the HIDL continuation callback with - * the status and any returned values. - * b) if invalid, invokes the HIDL continuation callback with the - * provided error status and default values. - */ -// Use for HIDL methods which return only an instance of WifiStatus. -template -Return validateAndCall(ObjT* obj, WifiStatusCode status_code_if_invalid, WorkFuncT&& work, - const std::function& hidl_cb, - Args&&... args) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (obj->isValid()) { - hidl_cb((obj->*work)(std::forward(args)...)); - } else { - hidl_cb(createWifiStatus(status_code_if_invalid)); - } - return Void(); -} - -// Use for HIDL methods which return only an instance of WifiStatus. -// This version passes the global lock acquired to the body of the method. -// Note: Only used by IWifi::stop() currently. -template -Return validateAndCallWithLock(ObjT* obj, WifiStatusCode status_code_if_invalid, - WorkFuncT&& work, - const std::function& hidl_cb, - Args&&... args) { - auto lock = hidl_sync_util::acquireGlobalLock(); - if (obj->isValid()) { - hidl_cb((obj->*work)(&lock, std::forward(args)...)); - } else { - hidl_cb(createWifiStatus(status_code_if_invalid)); - } - return Void(); -} - -// Use for HIDL methods which return instance of WifiStatus and a single return -// value. -template -Return validateAndCall(ObjT* obj, WifiStatusCode status_code_if_invalid, WorkFuncT&& work, - const std::function& hidl_cb, - Args&&... args) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (obj->isValid()) { - const auto& ret_pair = (obj->*work)(std::forward(args)...); - const WifiStatus& status = std::get<0>(ret_pair); - const auto& ret_value = std::get<1>(ret_pair); - hidl_cb(status, ret_value); - } else { - hidl_cb(createWifiStatus(status_code_if_invalid), - typename std::remove_reference::type()); - } - return Void(); -} - -// Use for HIDL methods which return instance of WifiStatus and 2 return -// values. -template -Return validateAndCall( - ObjT* obj, WifiStatusCode status_code_if_invalid, WorkFuncT&& work, - const std::function& hidl_cb, Args&&... args) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (obj->isValid()) { - const auto& ret_tuple = (obj->*work)(std::forward(args)...); - const WifiStatus& status = std::get<0>(ret_tuple); - const auto& ret_value1 = std::get<1>(ret_tuple); - const auto& ret_value2 = std::get<2>(ret_tuple); - hidl_cb(status, ret_value1, ret_value2); - } else { - hidl_cb(createWifiStatus(status_code_if_invalid), - typename std::remove_reference::type(), - typename std::remove_reference::type()); - } - return Void(); -} - -} // namespace hidl_return_util -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android -#endif // HIDL_RETURN_UTIL_H_ diff --git a/wifi/1.6/default/hidl_struct_util.cpp b/wifi/1.6/default/hidl_struct_util.cpp deleted file mode 100644 index 2112b260f3..0000000000 --- a/wifi/1.6/default/hidl_struct_util.cpp +++ /dev/null @@ -1,3007 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#include -#include - -#include "hidl_struct_util.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace hidl_struct_util { - -using V1_6::NanConfigRequestSupplemental; - -WifiChannelWidthInMhz convertLegacyWifiChannelWidthToHidl(legacy_hal::wifi_channel_width type); - -hidl_string safeConvertChar(const char* str, size_t max_len) { - const char* c = str; - size_t size = 0; - while (*c && (unsigned char)*c < 128 && size < max_len) { - ++size; - ++c; - } - return hidl_string(str, size); -} - -IWifiChip::ChipCapabilityMask convertLegacyLoggerFeatureToHidlChipCapability(uint32_t feature) { - using HidlChipCaps = IWifiChip::ChipCapabilityMask; - switch (feature) { - case legacy_hal::WIFI_LOGGER_MEMORY_DUMP_SUPPORTED: - return HidlChipCaps::DEBUG_MEMORY_FIRMWARE_DUMP; - case legacy_hal::WIFI_LOGGER_DRIVER_DUMP_SUPPORTED: - return HidlChipCaps::DEBUG_MEMORY_DRIVER_DUMP; - case legacy_hal::WIFI_LOGGER_CONNECT_EVENT_SUPPORTED: - return HidlChipCaps::DEBUG_RING_BUFFER_CONNECT_EVENT; - case legacy_hal::WIFI_LOGGER_POWER_EVENT_SUPPORTED: - return HidlChipCaps::DEBUG_RING_BUFFER_POWER_EVENT; - case legacy_hal::WIFI_LOGGER_WAKE_LOCK_SUPPORTED: - return HidlChipCaps::DEBUG_RING_BUFFER_WAKELOCK_EVENT; - }; - CHECK(false) << "Unknown legacy feature: " << feature; - return {}; -} - -IWifiStaIface::StaIfaceCapabilityMask convertLegacyLoggerFeatureToHidlStaIfaceCapability( - uint32_t feature) { - using HidlStaIfaceCaps = IWifiStaIface::StaIfaceCapabilityMask; - switch (feature) { - case legacy_hal::WIFI_LOGGER_PACKET_FATE_SUPPORTED: - return HidlStaIfaceCaps::DEBUG_PACKET_FATE; - }; - CHECK(false) << "Unknown legacy feature: " << feature; - return {}; -} - -V1_5::IWifiChip::ChipCapabilityMask convertLegacyFeatureToHidlChipCapability(uint64_t feature) { - using HidlChipCaps = V1_5::IWifiChip::ChipCapabilityMask; - switch (feature) { - case WIFI_FEATURE_SET_TX_POWER_LIMIT: - return HidlChipCaps::SET_TX_POWER_LIMIT; - case WIFI_FEATURE_USE_BODY_HEAD_SAR: - return HidlChipCaps::USE_BODY_HEAD_SAR; - case WIFI_FEATURE_D2D_RTT: - return HidlChipCaps::D2D_RTT; - case WIFI_FEATURE_D2AP_RTT: - return HidlChipCaps::D2AP_RTT; - case WIFI_FEATURE_INFRA_60G: - return HidlChipCaps::WIGIG; - case WIFI_FEATURE_SET_LATENCY_MODE: - return HidlChipCaps::SET_LATENCY_MODE; - case WIFI_FEATURE_P2P_RAND_MAC: - return HidlChipCaps::P2P_RAND_MAC; - }; - CHECK(false) << "Unknown legacy feature: " << feature; - return {}; -} - -IWifiStaIface::StaIfaceCapabilityMask convertLegacyFeatureToHidlStaIfaceCapability( - uint64_t feature) { - using HidlStaIfaceCaps = IWifiStaIface::StaIfaceCapabilityMask; - switch (feature) { - case WIFI_FEATURE_GSCAN: - return HidlStaIfaceCaps::BACKGROUND_SCAN; - case WIFI_FEATURE_LINK_LAYER_STATS: - return HidlStaIfaceCaps::LINK_LAYER_STATS; - case WIFI_FEATURE_RSSI_MONITOR: - return HidlStaIfaceCaps::RSSI_MONITOR; - case WIFI_FEATURE_CONTROL_ROAMING: - return HidlStaIfaceCaps::CONTROL_ROAMING; - case WIFI_FEATURE_IE_WHITELIST: - return HidlStaIfaceCaps::PROBE_IE_WHITELIST; - case WIFI_FEATURE_SCAN_RAND: - return HidlStaIfaceCaps::SCAN_RAND; - case WIFI_FEATURE_INFRA_5G: - return HidlStaIfaceCaps::STA_5G; - case WIFI_FEATURE_HOTSPOT: - return HidlStaIfaceCaps::HOTSPOT; - case WIFI_FEATURE_PNO: - return HidlStaIfaceCaps::PNO; - case WIFI_FEATURE_TDLS: - return HidlStaIfaceCaps::TDLS; - case WIFI_FEATURE_TDLS_OFFCHANNEL: - return HidlStaIfaceCaps::TDLS_OFFCHANNEL; - case WIFI_FEATURE_CONFIG_NDO: - return HidlStaIfaceCaps::ND_OFFLOAD; - case WIFI_FEATURE_MKEEP_ALIVE: - return HidlStaIfaceCaps::KEEP_ALIVE; - }; - CHECK(false) << "Unknown legacy feature: " << feature; - return {}; -} - -bool convertLegacyFeaturesToHidlChipCapabilities(uint64_t legacy_feature_set, - uint32_t legacy_logger_feature_set, - uint32_t* hidl_caps) { - if (!hidl_caps) { - return false; - } - *hidl_caps = {}; - using HidlChipCaps = IWifiChip::ChipCapabilityMask; - for (const auto feature : {legacy_hal::WIFI_LOGGER_MEMORY_DUMP_SUPPORTED, - legacy_hal::WIFI_LOGGER_DRIVER_DUMP_SUPPORTED, - legacy_hal::WIFI_LOGGER_CONNECT_EVENT_SUPPORTED, - legacy_hal::WIFI_LOGGER_POWER_EVENT_SUPPORTED, - legacy_hal::WIFI_LOGGER_WAKE_LOCK_SUPPORTED}) { - if (feature & legacy_logger_feature_set) { - *hidl_caps |= convertLegacyLoggerFeatureToHidlChipCapability(feature); - } - } - std::vector features = {WIFI_FEATURE_SET_TX_POWER_LIMIT, - WIFI_FEATURE_USE_BODY_HEAD_SAR, - WIFI_FEATURE_D2D_RTT, - WIFI_FEATURE_D2AP_RTT, - WIFI_FEATURE_INFRA_60G, - WIFI_FEATURE_SET_LATENCY_MODE, - WIFI_FEATURE_P2P_RAND_MAC}; - for (const auto feature : features) { - if (feature & legacy_feature_set) { - *hidl_caps |= convertLegacyFeatureToHidlChipCapability(feature); - } - } - - // There are no flags for these 3 in the legacy feature set. Adding them to - // the set because all the current devices support it. - *hidl_caps |= HidlChipCaps::DEBUG_RING_BUFFER_VENDOR_DATA; - *hidl_caps |= HidlChipCaps::DEBUG_HOST_WAKE_REASON_STATS; - *hidl_caps |= HidlChipCaps::DEBUG_ERROR_ALERTS; - return true; -} - -WifiDebugRingBufferFlags convertLegacyDebugRingBufferFlagsToHidl(uint32_t flag) { - switch (flag) { - case WIFI_RING_BUFFER_FLAG_HAS_BINARY_ENTRIES: - return WifiDebugRingBufferFlags::HAS_BINARY_ENTRIES; - case WIFI_RING_BUFFER_FLAG_HAS_ASCII_ENTRIES: - return WifiDebugRingBufferFlags::HAS_ASCII_ENTRIES; - }; - CHECK(false) << "Unknown legacy flag: " << flag; - return {}; -} - -bool convertLegacyDebugRingBufferStatusToHidl( - const legacy_hal::wifi_ring_buffer_status& legacy_status, - WifiDebugRingBufferStatus* hidl_status) { - if (!hidl_status) { - return false; - } - *hidl_status = {}; - hidl_status->ringName = safeConvertChar(reinterpret_cast(legacy_status.name), - sizeof(legacy_status.name)); - hidl_status->flags = 0; - for (const auto flag : - {WIFI_RING_BUFFER_FLAG_HAS_BINARY_ENTRIES, WIFI_RING_BUFFER_FLAG_HAS_ASCII_ENTRIES}) { - if (flag & legacy_status.flags) { - hidl_status->flags |= static_cast::type>( - convertLegacyDebugRingBufferFlagsToHidl(flag)); - } - } - hidl_status->ringId = legacy_status.ring_id; - hidl_status->sizeInBytes = legacy_status.ring_buffer_byte_size; - // Calculate free size of the ring the buffer. We don't need to send the - // exact read/write pointers that were there in the legacy HAL interface. - if (legacy_status.written_bytes >= legacy_status.read_bytes) { - hidl_status->freeSizeInBytes = legacy_status.ring_buffer_byte_size - - (legacy_status.written_bytes - legacy_status.read_bytes); - } else { - hidl_status->freeSizeInBytes = legacy_status.read_bytes - legacy_status.written_bytes; - } - hidl_status->verboseLevel = legacy_status.verbose_level; - return true; -} - -bool convertLegacyVectorOfDebugRingBufferStatusToHidl( - const std::vector& legacy_status_vec, - std::vector* hidl_status_vec) { - if (!hidl_status_vec) { - return false; - } - *hidl_status_vec = {}; - for (const auto& legacy_status : legacy_status_vec) { - WifiDebugRingBufferStatus hidl_status; - if (!convertLegacyDebugRingBufferStatusToHidl(legacy_status, &hidl_status)) { - return false; - } - hidl_status_vec->push_back(hidl_status); - } - return true; -} - -bool convertLegacyWakeReasonStatsToHidl(const legacy_hal::WakeReasonStats& legacy_stats, - WifiDebugHostWakeReasonStats* hidl_stats) { - if (!hidl_stats) { - return false; - } - *hidl_stats = {}; - hidl_stats->totalCmdEventWakeCnt = legacy_stats.wake_reason_cnt.total_cmd_event_wake; - hidl_stats->cmdEventWakeCntPerType = legacy_stats.cmd_event_wake_cnt; - hidl_stats->totalDriverFwLocalWakeCnt = legacy_stats.wake_reason_cnt.total_driver_fw_local_wake; - hidl_stats->driverFwLocalWakeCntPerType = legacy_stats.driver_fw_local_wake_cnt; - hidl_stats->totalRxPacketWakeCnt = legacy_stats.wake_reason_cnt.total_rx_data_wake; - hidl_stats->rxPktWakeDetails.rxUnicastCnt = - legacy_stats.wake_reason_cnt.rx_wake_details.rx_unicast_cnt; - hidl_stats->rxPktWakeDetails.rxMulticastCnt = - legacy_stats.wake_reason_cnt.rx_wake_details.rx_multicast_cnt; - hidl_stats->rxPktWakeDetails.rxBroadcastCnt = - legacy_stats.wake_reason_cnt.rx_wake_details.rx_broadcast_cnt; - hidl_stats->rxMulticastPkWakeDetails.ipv4RxMulticastAddrCnt = - legacy_stats.wake_reason_cnt.rx_multicast_wake_pkt_info.ipv4_rx_multicast_addr_cnt; - hidl_stats->rxMulticastPkWakeDetails.ipv6RxMulticastAddrCnt = - legacy_stats.wake_reason_cnt.rx_multicast_wake_pkt_info.ipv6_rx_multicast_addr_cnt; - hidl_stats->rxMulticastPkWakeDetails.otherRxMulticastAddrCnt = - legacy_stats.wake_reason_cnt.rx_multicast_wake_pkt_info.other_rx_multicast_addr_cnt; - hidl_stats->rxIcmpPkWakeDetails.icmpPkt = - legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp_pkt; - hidl_stats->rxIcmpPkWakeDetails.icmp6Pkt = - legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_pkt; - hidl_stats->rxIcmpPkWakeDetails.icmp6Ra = - legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_ra; - hidl_stats->rxIcmpPkWakeDetails.icmp6Na = - legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_na; - hidl_stats->rxIcmpPkWakeDetails.icmp6Ns = - legacy_stats.wake_reason_cnt.rx_wake_pkt_classification_info.icmp6_ns; - return true; -} - -legacy_hal::wifi_power_scenario convertHidlTxPowerScenarioToLegacy( - V1_1::IWifiChip::TxPowerScenario hidl_scenario) { - switch (hidl_scenario) { - // This is the only supported scenario for V1_1 - case V1_1::IWifiChip::TxPowerScenario::VOICE_CALL: - return legacy_hal::WIFI_POWER_SCENARIO_VOICE_CALL; - }; - CHECK(false); -} - -legacy_hal::wifi_power_scenario convertHidlTxPowerScenarioToLegacy_1_2( - V1_2::IWifiChip::TxPowerScenario hidl_scenario) { - switch (hidl_scenario) { - // This is the only supported scenario for V1_1 - case V1_2::IWifiChip::TxPowerScenario::VOICE_CALL: - return legacy_hal::WIFI_POWER_SCENARIO_VOICE_CALL; - // Those are the supported scenarios for V1_2 - case V1_2::IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF: - return legacy_hal::WIFI_POWER_SCENARIO_ON_HEAD_CELL_OFF; - case V1_2::IWifiChip::TxPowerScenario::ON_HEAD_CELL_ON: - return legacy_hal::WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON; - case V1_2::IWifiChip::TxPowerScenario::ON_BODY_CELL_OFF: - return legacy_hal::WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF; - case V1_2::IWifiChip::TxPowerScenario::ON_BODY_CELL_ON: - return legacy_hal::WIFI_POWER_SCENARIO_ON_BODY_CELL_ON; - }; - CHECK(false); -} - -legacy_hal::wifi_latency_mode convertHidlLatencyModeToLegacy( - V1_3::IWifiChip::LatencyMode hidl_latency_mode) { - switch (hidl_latency_mode) { - case V1_3::IWifiChip::LatencyMode::NORMAL: - return legacy_hal::WIFI_LATENCY_MODE_NORMAL; - case V1_3::IWifiChip::LatencyMode::LOW: - return legacy_hal::WIFI_LATENCY_MODE_LOW; - } - CHECK(false); -} - -bool convertLegacyWifiMacInfoToHidl( - const legacy_hal::WifiMacInfo& legacy_mac_info, - V1_4::IWifiChipEventCallback::RadioModeInfo* hidl_radio_mode_info) { - if (!hidl_radio_mode_info) { - return false; - } - *hidl_radio_mode_info = {}; - - hidl_radio_mode_info->radioId = legacy_mac_info.wlan_mac_id; - // Convert from bitmask of bands in the legacy HAL to enum value in - // the HIDL interface. - if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND && - legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND && - legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND) { - hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_24GHZ_5GHZ_6GHZ; - } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND && - legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND) { - hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_5GHZ_6GHZ; - } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_6_0_BAND) { - hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_6GHZ; - } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND && - legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND) { - hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_24GHZ_5GHZ; - } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_2_4_BAND) { - hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_24GHZ; - } else if (legacy_mac_info.mac_band & legacy_hal::WLAN_MAC_5_0_BAND) { - hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_5GHZ; - } else { - hidl_radio_mode_info->bandInfo = V1_4::WifiBand::BAND_UNSPECIFIED; - } - std::vector iface_info_vec; - for (const auto& legacy_iface_info : legacy_mac_info.iface_infos) { - V1_2::IWifiChipEventCallback::IfaceInfo iface_info; - iface_info.name = legacy_iface_info.name; - iface_info.channel = legacy_iface_info.channel; - iface_info_vec.push_back(iface_info); - } - hidl_radio_mode_info->ifaceInfos = iface_info_vec; - return true; -} - -uint32_t convertHidlWifiBandToLegacyMacBand(V1_5::WifiBand hidl_band) { - switch (hidl_band) { - case V1_5::WifiBand::BAND_24GHZ: - return legacy_hal::WLAN_MAC_2_4_BAND; - case V1_5::WifiBand::BAND_5GHZ: - case V1_5::WifiBand::BAND_5GHZ_DFS: - case V1_5::WifiBand::BAND_5GHZ_WITH_DFS: - return legacy_hal::WLAN_MAC_5_0_BAND; - case V1_5::WifiBand::BAND_24GHZ_5GHZ: - case V1_5::WifiBand::BAND_24GHZ_5GHZ_WITH_DFS: - return (legacy_hal::WLAN_MAC_2_4_BAND | legacy_hal::WLAN_MAC_5_0_BAND); - case V1_5::WifiBand::BAND_6GHZ: - return legacy_hal::WLAN_MAC_6_0_BAND; - case V1_5::WifiBand::BAND_5GHZ_6GHZ: - return (legacy_hal::WLAN_MAC_5_0_BAND | legacy_hal::WLAN_MAC_6_0_BAND); - case V1_5::WifiBand::BAND_24GHZ_5GHZ_6GHZ: - case V1_5::WifiBand::BAND_24GHZ_5GHZ_WITH_DFS_6GHZ: - return (legacy_hal::WLAN_MAC_2_4_BAND | legacy_hal::WLAN_MAC_5_0_BAND | - legacy_hal::WLAN_MAC_6_0_BAND); - case V1_5::WifiBand::BAND_60GHZ: - return legacy_hal::WLAN_MAC_60_0_BAND; - default: - return (legacy_hal::WLAN_MAC_2_4_BAND | legacy_hal::WLAN_MAC_5_0_BAND | - legacy_hal::WLAN_MAC_6_0_BAND | legacy_hal::WLAN_MAC_60_0_BAND); - } -} - -V1_5::WifiBand convertLegacyMacBandToHidlWifiBand(uint32_t band) { - switch (band) { - case legacy_hal::WLAN_MAC_2_4_BAND: - return V1_5::WifiBand::BAND_24GHZ; - case legacy_hal::WLAN_MAC_5_0_BAND: - return V1_5::WifiBand::BAND_5GHZ; - case legacy_hal::WLAN_MAC_6_0_BAND: - return V1_5::WifiBand::BAND_6GHZ; - case legacy_hal::WLAN_MAC_60_0_BAND: - return V1_5::WifiBand::BAND_60GHZ; - default: - return V1_5::WifiBand::BAND_UNSPECIFIED; - } -} - -uint32_t convertHidlWifiIfaceModeToLegacy(uint32_t hidl_iface_mask) { - uint32_t legacy_iface_mask = 0; - if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_STA) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_STA); - } - if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_SOFTAP) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_SOFTAP); - } - if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_P2P_CLIENT) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_P2P_CLIENT); - } - if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_P2P_GO) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_P2P_GO); - } - if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_NAN) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_NAN); - } - if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_TDLS) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_TDLS); - } - if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_MESH) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_MESH); - } - if (hidl_iface_mask & V1_5::WifiIfaceMode::IFACE_MODE_IBSS) { - legacy_iface_mask |= (1 << legacy_hal::WIFI_INTERFACE_IBSS); - } - return legacy_iface_mask; -} - -uint32_t convertLegacyWifiInterfaceModeToHidl(uint32_t legacy_iface_mask) { - uint32_t hidl_iface_mask = 0; - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_STA)) { - hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_STA; - } - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_SOFTAP)) { - hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_SOFTAP; - } - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_P2P_CLIENT)) { - hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_P2P_CLIENT; - } - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_P2P_GO)) { - hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_P2P_GO; - } - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_NAN)) { - hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_NAN; - } - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_TDLS)) { - hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_TDLS; - } - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_MESH)) { - hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_MESH; - } - if (legacy_iface_mask & (1 << legacy_hal::WIFI_INTERFACE_IBSS)) { - hidl_iface_mask |= V1_5::WifiIfaceMode::IFACE_MODE_IBSS; - } - return hidl_iface_mask; -} - -uint32_t convertHidlUsableChannelFilterToLegacy(uint32_t hidl_filter_mask) { - uint32_t legacy_filter_mask = 0; - if (hidl_filter_mask & V1_5::IWifiChip::UsableChannelFilter::CELLULAR_COEXISTENCE) { - legacy_filter_mask |= legacy_hal::WIFI_USABLE_CHANNEL_FILTER_CELLULAR_COEXISTENCE; - } - if (hidl_filter_mask & V1_5::IWifiChip::UsableChannelFilter::CONCURRENCY) { - legacy_filter_mask |= legacy_hal::WIFI_USABLE_CHANNEL_FILTER_CONCURRENCY; - } - if (hidl_filter_mask & V1_6::IWifiChip::UsableChannelFilter::NAN_INSTANT_MODE) { - legacy_filter_mask |= WIFI_USABLE_CHANNEL_FILTER_NAN_INSTANT_MODE; - } - return legacy_filter_mask; -} - -bool convertLegacyWifiUsableChannelToHidl( - const legacy_hal::wifi_usable_channel& legacy_usable_channel, - V1_6::WifiUsableChannel* hidl_usable_channel) { - if (!hidl_usable_channel) { - return false; - } - *hidl_usable_channel = {}; - hidl_usable_channel->channel = legacy_usable_channel.freq; - hidl_usable_channel->channelBandwidth = - convertLegacyWifiChannelWidthToHidl(legacy_usable_channel.width); - hidl_usable_channel->ifaceModeMask = - convertLegacyWifiInterfaceModeToHidl(legacy_usable_channel.iface_mode_mask); - - return true; -} - -bool convertLegacyWifiUsableChannelsToHidl( - const std::vector& legacy_usable_channels, - std::vector* hidl_usable_channels) { - if (!hidl_usable_channels) { - return false; - } - *hidl_usable_channels = {}; - for (const auto& legacy_usable_channel : legacy_usable_channels) { - V1_6::WifiUsableChannel hidl_usable_channel; - if (!convertLegacyWifiUsableChannelToHidl(legacy_usable_channel, &hidl_usable_channel)) { - return false; - } - hidl_usable_channels->push_back(hidl_usable_channel); - } - return true; -} - -bool convertLegacyWifiMacInfosToHidl( - const std::vector& legacy_mac_infos, - std::vector* hidl_radio_mode_infos) { - if (!hidl_radio_mode_infos) { - return false; - } - *hidl_radio_mode_infos = {}; - - for (const auto& legacy_mac_info : legacy_mac_infos) { - V1_4::IWifiChipEventCallback::RadioModeInfo hidl_radio_mode_info; - if (!convertLegacyWifiMacInfoToHidl(legacy_mac_info, &hidl_radio_mode_info)) { - return false; - } - hidl_radio_mode_infos->push_back(hidl_radio_mode_info); - } - return true; -} - -bool convertLegacyFeaturesToHidlStaCapabilities(uint64_t legacy_feature_set, - uint32_t legacy_logger_feature_set, - uint32_t* hidl_caps) { - if (!hidl_caps) { - return false; - } - *hidl_caps = {}; - using HidlStaIfaceCaps = IWifiStaIface::StaIfaceCapabilityMask; - for (const auto feature : {legacy_hal::WIFI_LOGGER_PACKET_FATE_SUPPORTED}) { - if (feature & legacy_logger_feature_set) { - *hidl_caps |= convertLegacyLoggerFeatureToHidlStaIfaceCapability(feature); - } - } - for (const auto feature : - {WIFI_FEATURE_GSCAN, WIFI_FEATURE_LINK_LAYER_STATS, WIFI_FEATURE_RSSI_MONITOR, - WIFI_FEATURE_CONTROL_ROAMING, WIFI_FEATURE_IE_WHITELIST, WIFI_FEATURE_SCAN_RAND, - WIFI_FEATURE_INFRA_5G, WIFI_FEATURE_HOTSPOT, WIFI_FEATURE_PNO, WIFI_FEATURE_TDLS, - WIFI_FEATURE_TDLS_OFFCHANNEL, WIFI_FEATURE_CONFIG_NDO, WIFI_FEATURE_MKEEP_ALIVE}) { - if (feature & legacy_feature_set) { - *hidl_caps |= convertLegacyFeatureToHidlStaIfaceCapability(feature); - } - } - // There is no flag for this one in the legacy feature set. Adding it to the - // set because all the current devices support it. - *hidl_caps |= HidlStaIfaceCaps::APF; - return true; -} - -bool convertLegacyApfCapabilitiesToHidl(const legacy_hal::PacketFilterCapabilities& legacy_caps, - StaApfPacketFilterCapabilities* hidl_caps) { - if (!hidl_caps) { - return false; - } - *hidl_caps = {}; - hidl_caps->version = legacy_caps.version; - hidl_caps->maxLength = legacy_caps.max_len; - return true; -} - -uint8_t convertHidlGscanReportEventFlagToLegacy( - StaBackgroundScanBucketEventReportSchemeMask hidl_flag) { - using HidlFlag = StaBackgroundScanBucketEventReportSchemeMask; - switch (hidl_flag) { - case HidlFlag::EACH_SCAN: - return REPORT_EVENTS_EACH_SCAN; - case HidlFlag::FULL_RESULTS: - return REPORT_EVENTS_FULL_RESULTS; - case HidlFlag::NO_BATCH: - return REPORT_EVENTS_NO_BATCH; - }; - CHECK(false); -} - -StaScanDataFlagMask convertLegacyGscanDataFlagToHidl(uint8_t legacy_flag) { - switch (legacy_flag) { - case legacy_hal::WIFI_SCAN_FLAG_INTERRUPTED: - return StaScanDataFlagMask::INTERRUPTED; - }; - CHECK(false) << "Unknown legacy flag: " << legacy_flag; - // To silence the compiler warning about reaching the end of non-void - // function. - return {}; -} - -bool convertLegacyGscanCapabilitiesToHidl(const legacy_hal::wifi_gscan_capabilities& legacy_caps, - StaBackgroundScanCapabilities* hidl_caps) { - if (!hidl_caps) { - return false; - } - *hidl_caps = {}; - hidl_caps->maxCacheSize = legacy_caps.max_scan_cache_size; - hidl_caps->maxBuckets = legacy_caps.max_scan_buckets; - hidl_caps->maxApCachePerScan = legacy_caps.max_ap_cache_per_scan; - hidl_caps->maxReportingThreshold = legacy_caps.max_scan_reporting_threshold; - return true; -} - -legacy_hal::wifi_band convertHidlWifiBandToLegacy(V1_0::WifiBand band) { - switch (band) { - case V1_0::WifiBand::BAND_UNSPECIFIED: - return legacy_hal::WIFI_BAND_UNSPECIFIED; - case V1_0::WifiBand::BAND_24GHZ: - return legacy_hal::WIFI_BAND_BG; - case V1_0::WifiBand::BAND_5GHZ: - return legacy_hal::WIFI_BAND_A; - case V1_0::WifiBand::BAND_5GHZ_DFS: - return legacy_hal::WIFI_BAND_A_DFS; - case V1_0::WifiBand::BAND_5GHZ_WITH_DFS: - return legacy_hal::WIFI_BAND_A_WITH_DFS; - case V1_0::WifiBand::BAND_24GHZ_5GHZ: - return legacy_hal::WIFI_BAND_ABG; - case V1_0::WifiBand::BAND_24GHZ_5GHZ_WITH_DFS: - return legacy_hal::WIFI_BAND_ABG_WITH_DFS; - }; - CHECK(false); -} - -bool convertHidlGscanParamsToLegacy(const StaBackgroundScanParameters& hidl_scan_params, - legacy_hal::wifi_scan_cmd_params* legacy_scan_params) { - if (!legacy_scan_params) { - return false; - } - *legacy_scan_params = {}; - legacy_scan_params->base_period = hidl_scan_params.basePeriodInMs; - legacy_scan_params->max_ap_per_scan = hidl_scan_params.maxApPerScan; - legacy_scan_params->report_threshold_percent = hidl_scan_params.reportThresholdPercent; - legacy_scan_params->report_threshold_num_scans = hidl_scan_params.reportThresholdNumScans; - if (hidl_scan_params.buckets.size() > MAX_BUCKETS) { - return false; - } - legacy_scan_params->num_buckets = hidl_scan_params.buckets.size(); - for (uint32_t bucket_idx = 0; bucket_idx < hidl_scan_params.buckets.size(); bucket_idx++) { - const StaBackgroundScanBucketParameters& hidl_bucket_spec = - hidl_scan_params.buckets[bucket_idx]; - legacy_hal::wifi_scan_bucket_spec& legacy_bucket_spec = - legacy_scan_params->buckets[bucket_idx]; - if (hidl_bucket_spec.bucketIdx >= MAX_BUCKETS) { - return false; - } - legacy_bucket_spec.bucket = hidl_bucket_spec.bucketIdx; - legacy_bucket_spec.band = convertHidlWifiBandToLegacy(hidl_bucket_spec.band); - legacy_bucket_spec.period = hidl_bucket_spec.periodInMs; - legacy_bucket_spec.max_period = hidl_bucket_spec.exponentialMaxPeriodInMs; - legacy_bucket_spec.base = hidl_bucket_spec.exponentialBase; - legacy_bucket_spec.step_count = hidl_bucket_spec.exponentialStepCount; - legacy_bucket_spec.report_events = 0; - using HidlFlag = StaBackgroundScanBucketEventReportSchemeMask; - for (const auto flag : {HidlFlag::EACH_SCAN, HidlFlag::FULL_RESULTS, HidlFlag::NO_BATCH}) { - if (hidl_bucket_spec.eventReportScheme & - static_cast::type>(flag)) { - legacy_bucket_spec.report_events |= convertHidlGscanReportEventFlagToLegacy(flag); - } - } - if (hidl_bucket_spec.frequencies.size() > MAX_CHANNELS) { - return false; - } - legacy_bucket_spec.num_channels = hidl_bucket_spec.frequencies.size(); - for (uint32_t freq_idx = 0; freq_idx < hidl_bucket_spec.frequencies.size(); freq_idx++) { - legacy_bucket_spec.channels[freq_idx].channel = hidl_bucket_spec.frequencies[freq_idx]; - } - } - return true; -} - -bool convertLegacyIeToHidl(const legacy_hal::wifi_information_element& legacy_ie, - WifiInformationElement* hidl_ie) { - if (!hidl_ie) { - return false; - } - *hidl_ie = {}; - hidl_ie->id = legacy_ie.id; - hidl_ie->data = std::vector(legacy_ie.data, legacy_ie.data + legacy_ie.len); - return true; -} - -bool convertLegacyIeBlobToHidl(const uint8_t* ie_blob, uint32_t ie_blob_len, - std::vector* hidl_ies) { - if (!ie_blob || !hidl_ies) { - return false; - } - *hidl_ies = {}; - const uint8_t* ies_begin = ie_blob; - const uint8_t* ies_end = ie_blob + ie_blob_len; - const uint8_t* next_ie = ies_begin; - using wifi_ie = legacy_hal::wifi_information_element; - constexpr size_t kIeHeaderLen = sizeof(wifi_ie); - // Each IE should atleast have the header (i.e |id| & |len| fields). - while (next_ie + kIeHeaderLen <= ies_end) { - const wifi_ie& legacy_ie = (*reinterpret_cast(next_ie)); - uint32_t curr_ie_len = kIeHeaderLen + legacy_ie.len; - if (next_ie + curr_ie_len > ies_end) { - LOG(ERROR) << "Error parsing IE blob. Next IE: " << (void*)next_ie - << ", Curr IE len: " << curr_ie_len << ", IEs End: " << (void*)ies_end; - break; - } - WifiInformationElement hidl_ie; - if (!convertLegacyIeToHidl(legacy_ie, &hidl_ie)) { - LOG(ERROR) << "Error converting IE. Id: " << legacy_ie.id << ", len: " << legacy_ie.len; - break; - } - hidl_ies->push_back(std::move(hidl_ie)); - next_ie += curr_ie_len; - } - // Check if the blob has been fully consumed. - if (next_ie != ies_end) { - LOG(ERROR) << "Failed to fully parse IE blob. Next IE: " << (void*)next_ie - << ", IEs End: " << (void*)ies_end; - } - return true; -} - -bool convertLegacyGscanResultToHidl(const legacy_hal::wifi_scan_result& legacy_scan_result, - bool has_ie_data, StaScanResult* hidl_scan_result) { - if (!hidl_scan_result) { - return false; - } - *hidl_scan_result = {}; - hidl_scan_result->timeStampInUs = legacy_scan_result.ts; - hidl_scan_result->ssid = std::vector( - legacy_scan_result.ssid, - legacy_scan_result.ssid + - strnlen(legacy_scan_result.ssid, sizeof(legacy_scan_result.ssid) - 1)); - memcpy(hidl_scan_result->bssid.data(), legacy_scan_result.bssid, - hidl_scan_result->bssid.size()); - hidl_scan_result->frequency = legacy_scan_result.channel; - hidl_scan_result->rssi = legacy_scan_result.rssi; - hidl_scan_result->beaconPeriodInMs = legacy_scan_result.beacon_period; - hidl_scan_result->capability = legacy_scan_result.capability; - if (has_ie_data) { - std::vector ies; - if (!convertLegacyIeBlobToHidl(reinterpret_cast(legacy_scan_result.ie_data), - legacy_scan_result.ie_length, &ies)) { - return false; - } - hidl_scan_result->informationElements = std::move(ies); - } - return true; -} - -bool convertLegacyCachedGscanResultsToHidl( - const legacy_hal::wifi_cached_scan_results& legacy_cached_scan_result, - StaScanData* hidl_scan_data) { - if (!hidl_scan_data) { - return false; - } - *hidl_scan_data = {}; - hidl_scan_data->flags = 0; - for (const auto flag : {legacy_hal::WIFI_SCAN_FLAG_INTERRUPTED}) { - if (legacy_cached_scan_result.flags & flag) { - hidl_scan_data->flags |= static_cast::type>( - convertLegacyGscanDataFlagToHidl(flag)); - } - } - hidl_scan_data->bucketsScanned = legacy_cached_scan_result.buckets_scanned; - - CHECK(legacy_cached_scan_result.num_results >= 0 && - legacy_cached_scan_result.num_results <= MAX_AP_CACHE_PER_SCAN); - std::vector hidl_scan_results; - for (int32_t result_idx = 0; result_idx < legacy_cached_scan_result.num_results; result_idx++) { - StaScanResult hidl_scan_result; - if (!convertLegacyGscanResultToHidl(legacy_cached_scan_result.results[result_idx], false, - &hidl_scan_result)) { - return false; - } - hidl_scan_results.push_back(hidl_scan_result); - } - hidl_scan_data->results = std::move(hidl_scan_results); - return true; -} - -bool convertLegacyVectorOfCachedGscanResultsToHidl( - const std::vector& legacy_cached_scan_results, - std::vector* hidl_scan_datas) { - if (!hidl_scan_datas) { - return false; - } - *hidl_scan_datas = {}; - for (const auto& legacy_cached_scan_result : legacy_cached_scan_results) { - StaScanData hidl_scan_data; - if (!convertLegacyCachedGscanResultsToHidl(legacy_cached_scan_result, &hidl_scan_data)) { - return false; - } - hidl_scan_datas->push_back(hidl_scan_data); - } - return true; -} - -WifiDebugTxPacketFate convertLegacyDebugTxPacketFateToHidl(legacy_hal::wifi_tx_packet_fate fate) { - switch (fate) { - case legacy_hal::TX_PKT_FATE_ACKED: - return WifiDebugTxPacketFate::ACKED; - case legacy_hal::TX_PKT_FATE_SENT: - return WifiDebugTxPacketFate::SENT; - case legacy_hal::TX_PKT_FATE_FW_QUEUED: - return WifiDebugTxPacketFate::FW_QUEUED; - case legacy_hal::TX_PKT_FATE_FW_DROP_INVALID: - return WifiDebugTxPacketFate::FW_DROP_INVALID; - case legacy_hal::TX_PKT_FATE_FW_DROP_NOBUFS: - return WifiDebugTxPacketFate::FW_DROP_NOBUFS; - case legacy_hal::TX_PKT_FATE_FW_DROP_OTHER: - return WifiDebugTxPacketFate::FW_DROP_OTHER; - case legacy_hal::TX_PKT_FATE_DRV_QUEUED: - return WifiDebugTxPacketFate::DRV_QUEUED; - case legacy_hal::TX_PKT_FATE_DRV_DROP_INVALID: - return WifiDebugTxPacketFate::DRV_DROP_INVALID; - case legacy_hal::TX_PKT_FATE_DRV_DROP_NOBUFS: - return WifiDebugTxPacketFate::DRV_DROP_NOBUFS; - case legacy_hal::TX_PKT_FATE_DRV_DROP_OTHER: - return WifiDebugTxPacketFate::DRV_DROP_OTHER; - }; - CHECK(false) << "Unknown legacy fate type: " << fate; -} - -WifiDebugRxPacketFate convertLegacyDebugRxPacketFateToHidl(legacy_hal::wifi_rx_packet_fate fate) { - switch (fate) { - case legacy_hal::RX_PKT_FATE_SUCCESS: - return WifiDebugRxPacketFate::SUCCESS; - case legacy_hal::RX_PKT_FATE_FW_QUEUED: - return WifiDebugRxPacketFate::FW_QUEUED; - case legacy_hal::RX_PKT_FATE_FW_DROP_FILTER: - return WifiDebugRxPacketFate::FW_DROP_FILTER; - case legacy_hal::RX_PKT_FATE_FW_DROP_INVALID: - return WifiDebugRxPacketFate::FW_DROP_INVALID; - case legacy_hal::RX_PKT_FATE_FW_DROP_NOBUFS: - return WifiDebugRxPacketFate::FW_DROP_NOBUFS; - case legacy_hal::RX_PKT_FATE_FW_DROP_OTHER: - return WifiDebugRxPacketFate::FW_DROP_OTHER; - case legacy_hal::RX_PKT_FATE_DRV_QUEUED: - return WifiDebugRxPacketFate::DRV_QUEUED; - case legacy_hal::RX_PKT_FATE_DRV_DROP_FILTER: - return WifiDebugRxPacketFate::DRV_DROP_FILTER; - case legacy_hal::RX_PKT_FATE_DRV_DROP_INVALID: - return WifiDebugRxPacketFate::DRV_DROP_INVALID; - case legacy_hal::RX_PKT_FATE_DRV_DROP_NOBUFS: - return WifiDebugRxPacketFate::DRV_DROP_NOBUFS; - case legacy_hal::RX_PKT_FATE_DRV_DROP_OTHER: - return WifiDebugRxPacketFate::DRV_DROP_OTHER; - }; - CHECK(false) << "Unknown legacy fate type: " << fate; -} - -WifiDebugPacketFateFrameType convertLegacyDebugPacketFateFrameTypeToHidl( - legacy_hal::frame_type type) { - switch (type) { - case legacy_hal::FRAME_TYPE_UNKNOWN: - return WifiDebugPacketFateFrameType::UNKNOWN; - case legacy_hal::FRAME_TYPE_ETHERNET_II: - return WifiDebugPacketFateFrameType::ETHERNET_II; - case legacy_hal::FRAME_TYPE_80211_MGMT: - return WifiDebugPacketFateFrameType::MGMT_80211; - }; - CHECK(false) << "Unknown legacy frame type: " << type; -} - -bool convertLegacyDebugPacketFateFrameToHidl(const legacy_hal::frame_info& legacy_frame, - WifiDebugPacketFateFrameInfo* hidl_frame) { - if (!hidl_frame) { - return false; - } - *hidl_frame = {}; - hidl_frame->frameType = convertLegacyDebugPacketFateFrameTypeToHidl(legacy_frame.payload_type); - hidl_frame->frameLen = legacy_frame.frame_len; - hidl_frame->driverTimestampUsec = legacy_frame.driver_timestamp_usec; - hidl_frame->firmwareTimestampUsec = legacy_frame.firmware_timestamp_usec; - const uint8_t* frame_begin = - reinterpret_cast(legacy_frame.frame_content.ethernet_ii_bytes); - hidl_frame->frameContent = - std::vector(frame_begin, frame_begin + legacy_frame.frame_len); - return true; -} - -bool convertLegacyDebugTxPacketFateToHidl(const legacy_hal::wifi_tx_report& legacy_fate, - WifiDebugTxPacketFateReport* hidl_fate) { - if (!hidl_fate) { - return false; - } - *hidl_fate = {}; - hidl_fate->fate = convertLegacyDebugTxPacketFateToHidl(legacy_fate.fate); - return convertLegacyDebugPacketFateFrameToHidl(legacy_fate.frame_inf, &hidl_fate->frameInfo); -} - -bool convertLegacyVectorOfDebugTxPacketFateToHidl( - const std::vector& legacy_fates, - std::vector* hidl_fates) { - if (!hidl_fates) { - return false; - } - *hidl_fates = {}; - for (const auto& legacy_fate : legacy_fates) { - WifiDebugTxPacketFateReport hidl_fate; - if (!convertLegacyDebugTxPacketFateToHidl(legacy_fate, &hidl_fate)) { - return false; - } - hidl_fates->push_back(hidl_fate); - } - return true; -} - -bool convertLegacyDebugRxPacketFateToHidl(const legacy_hal::wifi_rx_report& legacy_fate, - WifiDebugRxPacketFateReport* hidl_fate) { - if (!hidl_fate) { - return false; - } - *hidl_fate = {}; - hidl_fate->fate = convertLegacyDebugRxPacketFateToHidl(legacy_fate.fate); - return convertLegacyDebugPacketFateFrameToHidl(legacy_fate.frame_inf, &hidl_fate->frameInfo); -} - -bool convertLegacyVectorOfDebugRxPacketFateToHidl( - const std::vector& legacy_fates, - std::vector* hidl_fates) { - if (!hidl_fates) { - return false; - } - *hidl_fates = {}; - for (const auto& legacy_fate : legacy_fates) { - WifiDebugRxPacketFateReport hidl_fate; - if (!convertLegacyDebugRxPacketFateToHidl(legacy_fate, &hidl_fate)) { - return false; - } - hidl_fates->push_back(hidl_fate); - } - return true; -} - -bool convertLegacyLinkLayerRadioStatsToHidl( - const legacy_hal::LinkLayerRadioStats& legacy_radio_stat, - V1_6::StaLinkLayerRadioStats* hidl_radio_stat) { - if (!hidl_radio_stat) { - return false; - } - *hidl_radio_stat = {}; - - hidl_radio_stat->radioId = legacy_radio_stat.stats.radio; - hidl_radio_stat->V1_0.onTimeInMs = legacy_radio_stat.stats.on_time; - hidl_radio_stat->V1_0.txTimeInMs = legacy_radio_stat.stats.tx_time; - hidl_radio_stat->V1_0.rxTimeInMs = legacy_radio_stat.stats.rx_time; - hidl_radio_stat->V1_0.onTimeInMsForScan = legacy_radio_stat.stats.on_time_scan; - hidl_radio_stat->V1_0.txTimeInMsPerLevel = legacy_radio_stat.tx_time_per_levels; - hidl_radio_stat->onTimeInMsForNanScan = legacy_radio_stat.stats.on_time_nbd; - hidl_radio_stat->onTimeInMsForBgScan = legacy_radio_stat.stats.on_time_gscan; - hidl_radio_stat->onTimeInMsForRoamScan = legacy_radio_stat.stats.on_time_roam_scan; - hidl_radio_stat->onTimeInMsForPnoScan = legacy_radio_stat.stats.on_time_pno_scan; - hidl_radio_stat->onTimeInMsForHs20Scan = legacy_radio_stat.stats.on_time_hs20; - - std::vector hidl_channel_stats; - - for (const auto& channel_stat : legacy_radio_stat.channel_stats) { - V1_6::WifiChannelStats hidl_channel_stat; - hidl_channel_stat.onTimeInMs = channel_stat.on_time; - hidl_channel_stat.ccaBusyTimeInMs = channel_stat.cca_busy_time; - /* - * TODO once b/119142899 is fixed, - * replace below code with convertLegacyWifiChannelInfoToHidl() - */ - hidl_channel_stat.channel.width = WifiChannelWidthInMhz::WIDTH_20; - hidl_channel_stat.channel.centerFreq = channel_stat.channel.center_freq; - hidl_channel_stat.channel.centerFreq0 = channel_stat.channel.center_freq0; - hidl_channel_stat.channel.centerFreq1 = channel_stat.channel.center_freq1; - hidl_channel_stats.push_back(hidl_channel_stat); - } - - hidl_radio_stat->channelStats = hidl_channel_stats; - - return true; -} - -bool convertLegacyLinkLayerStatsToHidl(const legacy_hal::LinkLayerStats& legacy_stats, - V1_6::StaLinkLayerStats* hidl_stats) { - if (!hidl_stats) { - return false; - } - *hidl_stats = {}; - // iface legacy_stats conversion. - hidl_stats->iface.V1_0.beaconRx = legacy_stats.iface.beacon_rx; - hidl_stats->iface.V1_0.avgRssiMgmt = legacy_stats.iface.rssi_mgmt; - hidl_stats->iface.V1_0.wmeBePktStats.rxMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].rx_mpdu; - hidl_stats->iface.V1_0.wmeBePktStats.txMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].tx_mpdu; - hidl_stats->iface.V1_0.wmeBePktStats.lostMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].mpdu_lost; - hidl_stats->iface.V1_0.wmeBePktStats.retries = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].retries; - hidl_stats->iface.wmeBeContentionTimeStats.contentionTimeMinInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_min; - hidl_stats->iface.wmeBeContentionTimeStats.contentionTimeMaxInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_max; - hidl_stats->iface.wmeBeContentionTimeStats.contentionTimeAvgInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_avg; - hidl_stats->iface.wmeBeContentionTimeStats.contentionNumSamples = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_num_samples; - hidl_stats->iface.V1_0.wmeBkPktStats.rxMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].rx_mpdu; - hidl_stats->iface.V1_0.wmeBkPktStats.txMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].tx_mpdu; - hidl_stats->iface.V1_0.wmeBkPktStats.lostMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].mpdu_lost; - hidl_stats->iface.V1_0.wmeBkPktStats.retries = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].retries; - hidl_stats->iface.wmeBkContentionTimeStats.contentionTimeMinInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_min; - hidl_stats->iface.wmeBkContentionTimeStats.contentionTimeMaxInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_max; - hidl_stats->iface.wmeBkContentionTimeStats.contentionTimeAvgInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_avg; - hidl_stats->iface.wmeBkContentionTimeStats.contentionNumSamples = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_num_samples; - hidl_stats->iface.V1_0.wmeViPktStats.rxMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].rx_mpdu; - hidl_stats->iface.V1_0.wmeViPktStats.txMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].tx_mpdu; - hidl_stats->iface.V1_0.wmeViPktStats.lostMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].mpdu_lost; - hidl_stats->iface.V1_0.wmeViPktStats.retries = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].retries; - hidl_stats->iface.wmeViContentionTimeStats.contentionTimeMinInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_min; - hidl_stats->iface.wmeViContentionTimeStats.contentionTimeMaxInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_max; - hidl_stats->iface.wmeViContentionTimeStats.contentionTimeAvgInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_avg; - hidl_stats->iface.wmeViContentionTimeStats.contentionNumSamples = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_num_samples; - hidl_stats->iface.V1_0.wmeVoPktStats.rxMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].rx_mpdu; - hidl_stats->iface.V1_0.wmeVoPktStats.txMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].tx_mpdu; - hidl_stats->iface.V1_0.wmeVoPktStats.lostMpdu = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].mpdu_lost; - hidl_stats->iface.V1_0.wmeVoPktStats.retries = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].retries; - hidl_stats->iface.wmeVoContentionTimeStats.contentionTimeMinInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_min; - hidl_stats->iface.wmeVoContentionTimeStats.contentionTimeMaxInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_max; - hidl_stats->iface.wmeVoContentionTimeStats.contentionTimeAvgInUsec = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_avg; - hidl_stats->iface.wmeVoContentionTimeStats.contentionNumSamples = - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_num_samples; - hidl_stats->iface.timeSliceDutyCycleInPercent = - legacy_stats.iface.info.time_slicing_duty_cycle_percent; - // peer info legacy_stats conversion. - std::vector hidl_peers_info_stats; - for (const auto& legacy_peer_info_stats : legacy_stats.peers) { - V1_6::StaPeerInfo hidl_peer_info_stats; - if (!convertLegacyPeerInfoStatsToHidl(legacy_peer_info_stats, &hidl_peer_info_stats)) { - return false; - } - hidl_peers_info_stats.push_back(hidl_peer_info_stats); - } - hidl_stats->iface.peers = hidl_peers_info_stats; - // radio legacy_stats conversion. - std::vector hidl_radios_stats; - for (const auto& legacy_radio_stats : legacy_stats.radios) { - V1_6::StaLinkLayerRadioStats hidl_radio_stats; - if (!convertLegacyLinkLayerRadioStatsToHidl(legacy_radio_stats, &hidl_radio_stats)) { - return false; - } - hidl_radios_stats.push_back(hidl_radio_stats); - } - hidl_stats->radios = hidl_radios_stats; - // Timestamp in the HAL wrapper here since it's not provided in the legacy - // HAL API. - hidl_stats->timeStampInMs = uptimeMillis(); - return true; -} - -bool convertLegacyPeerInfoStatsToHidl(const legacy_hal::WifiPeerInfo& legacy_peer_info_stats, - V1_6::StaPeerInfo* hidl_peer_info_stats) { - if (!hidl_peer_info_stats) { - return false; - } - *hidl_peer_info_stats = {}; - hidl_peer_info_stats->staCount = legacy_peer_info_stats.peer_info.bssload.sta_count; - hidl_peer_info_stats->chanUtil = legacy_peer_info_stats.peer_info.bssload.chan_util; - - std::vector hidlRateStats; - for (const auto& legacy_rate_stats : legacy_peer_info_stats.rate_stats) { - V1_6::StaRateStat rateStat; - if (!convertLegacyWifiRateInfoToHidl(legacy_rate_stats.rate, &rateStat.rateInfo)) { - return false; - } - rateStat.txMpdu = legacy_rate_stats.tx_mpdu; - rateStat.rxMpdu = legacy_rate_stats.rx_mpdu; - rateStat.mpduLost = legacy_rate_stats.mpdu_lost; - rateStat.retries = legacy_rate_stats.retries; - hidlRateStats.push_back(rateStat); - } - hidl_peer_info_stats->rateStats = hidlRateStats; - return true; -} - -bool convertLegacyRoamingCapabilitiesToHidl( - const legacy_hal::wifi_roaming_capabilities& legacy_caps, - StaRoamingCapabilities* hidl_caps) { - if (!hidl_caps) { - return false; - } - *hidl_caps = {}; - hidl_caps->maxBlacklistSize = legacy_caps.max_blacklist_size; - hidl_caps->maxWhitelistSize = legacy_caps.max_whitelist_size; - return true; -} - -bool convertHidlRoamingConfigToLegacy(const StaRoamingConfig& hidl_config, - legacy_hal::wifi_roaming_config* legacy_config) { - if (!legacy_config) { - return false; - } - *legacy_config = {}; - if (hidl_config.bssidBlacklist.size() > MAX_BLACKLIST_BSSID || - hidl_config.ssidWhitelist.size() > MAX_WHITELIST_SSID) { - return false; - } - legacy_config->num_blacklist_bssid = hidl_config.bssidBlacklist.size(); - uint32_t i = 0; - for (const auto& bssid : hidl_config.bssidBlacklist) { - CHECK(bssid.size() == sizeof(legacy_hal::mac_addr)); - memcpy(legacy_config->blacklist_bssid[i++], bssid.data(), bssid.size()); - } - legacy_config->num_whitelist_ssid = hidl_config.ssidWhitelist.size(); - i = 0; - for (const auto& ssid : hidl_config.ssidWhitelist) { - CHECK(ssid.size() <= sizeof(legacy_hal::ssid_t::ssid_str)); - legacy_config->whitelist_ssid[i].length = ssid.size(); - memcpy(legacy_config->whitelist_ssid[i].ssid_str, ssid.data(), ssid.size()); - i++; - } - return true; -} - -legacy_hal::fw_roaming_state_t convertHidlRoamingStateToLegacy(StaRoamingState state) { - switch (state) { - case StaRoamingState::ENABLED: - return legacy_hal::ROAMING_ENABLE; - case StaRoamingState::DISABLED: - return legacy_hal::ROAMING_DISABLE; - }; - CHECK(false); -} - -legacy_hal::NanMatchAlg convertHidlNanMatchAlgToLegacy(NanMatchAlg type) { - switch (type) { - case NanMatchAlg::MATCH_ONCE: - return legacy_hal::NAN_MATCH_ALG_MATCH_ONCE; - case NanMatchAlg::MATCH_CONTINUOUS: - return legacy_hal::NAN_MATCH_ALG_MATCH_CONTINUOUS; - case NanMatchAlg::MATCH_NEVER: - return legacy_hal::NAN_MATCH_ALG_MATCH_NEVER; - } - CHECK(false); -} - -legacy_hal::NanPublishType convertHidlNanPublishTypeToLegacy(NanPublishType type) { - switch (type) { - case NanPublishType::UNSOLICITED: - return legacy_hal::NAN_PUBLISH_TYPE_UNSOLICITED; - case NanPublishType::SOLICITED: - return legacy_hal::NAN_PUBLISH_TYPE_SOLICITED; - case NanPublishType::UNSOLICITED_SOLICITED: - return legacy_hal::NAN_PUBLISH_TYPE_UNSOLICITED_SOLICITED; - } - CHECK(false); -} - -legacy_hal::NanTxType convertHidlNanTxTypeToLegacy(NanTxType type) { - switch (type) { - case NanTxType::BROADCAST: - return legacy_hal::NAN_TX_TYPE_BROADCAST; - case NanTxType::UNICAST: - return legacy_hal::NAN_TX_TYPE_UNICAST; - } - CHECK(false); -} - -legacy_hal::NanSubscribeType convertHidlNanSubscribeTypeToLegacy(NanSubscribeType type) { - switch (type) { - case NanSubscribeType::PASSIVE: - return legacy_hal::NAN_SUBSCRIBE_TYPE_PASSIVE; - case NanSubscribeType::ACTIVE: - return legacy_hal::NAN_SUBSCRIBE_TYPE_ACTIVE; - } - CHECK(false); -} - -legacy_hal::NanSRFType convertHidlNanSrfTypeToLegacy(NanSrfType type) { - switch (type) { - case NanSrfType::BLOOM_FILTER: - return legacy_hal::NAN_SRF_ATTR_BLOOM_FILTER; - case NanSrfType::PARTIAL_MAC_ADDR: - return legacy_hal::NAN_SRF_ATTR_PARTIAL_MAC_ADDR; - } - CHECK(false); -} - -legacy_hal::NanDataPathChannelCfg convertHidlNanDataPathChannelCfgToLegacy( - NanDataPathChannelCfg type) { - switch (type) { - case NanDataPathChannelCfg::CHANNEL_NOT_REQUESTED: - return legacy_hal::NAN_DP_CHANNEL_NOT_REQUESTED; - case NanDataPathChannelCfg::REQUEST_CHANNEL_SETUP: - return legacy_hal::NAN_DP_REQUEST_CHANNEL_SETUP; - case NanDataPathChannelCfg::FORCE_CHANNEL_SETUP: - return legacy_hal::NAN_DP_FORCE_CHANNEL_SETUP; - } - CHECK(false); -} - -NanStatusType convertLegacyNanStatusTypeToHidl(legacy_hal::NanStatusType type) { - switch (type) { - case legacy_hal::NAN_STATUS_SUCCESS: - return NanStatusType::SUCCESS; - case legacy_hal::NAN_STATUS_INTERNAL_FAILURE: - return NanStatusType::INTERNAL_FAILURE; - case legacy_hal::NAN_STATUS_PROTOCOL_FAILURE: - return NanStatusType::PROTOCOL_FAILURE; - case legacy_hal::NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID: - return NanStatusType::INVALID_SESSION_ID; - case legacy_hal::NAN_STATUS_NO_RESOURCE_AVAILABLE: - return NanStatusType::NO_RESOURCES_AVAILABLE; - case legacy_hal::NAN_STATUS_INVALID_PARAM: - return NanStatusType::INVALID_ARGS; - case legacy_hal::NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID: - return NanStatusType::INVALID_PEER_ID; - case legacy_hal::NAN_STATUS_INVALID_NDP_ID: - return NanStatusType::INVALID_NDP_ID; - case legacy_hal::NAN_STATUS_NAN_NOT_ALLOWED: - return NanStatusType::NAN_NOT_ALLOWED; - case legacy_hal::NAN_STATUS_NO_OTA_ACK: - return NanStatusType::NO_OTA_ACK; - case legacy_hal::NAN_STATUS_ALREADY_ENABLED: - return NanStatusType::ALREADY_ENABLED; - case legacy_hal::NAN_STATUS_FOLLOWUP_QUEUE_FULL: - return NanStatusType::FOLLOWUP_TX_QUEUE_FULL; - case legacy_hal::NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED: - return NanStatusType::UNSUPPORTED_CONCURRENCY_NAN_DISABLED; - } - CHECK(false); -} - -void convertToWifiNanStatus(legacy_hal::NanStatusType type, const char* str, size_t max_len, - WifiNanStatus* wifiNanStatus) { - wifiNanStatus->status = convertLegacyNanStatusTypeToHidl(type); - wifiNanStatus->description = safeConvertChar(str, max_len); -} - -bool convertHidlNanEnableRequestToLegacy(const V1_4::NanEnableRequest& hidl_request, - legacy_hal::NanEnableRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertHidlNanEnableRequestToLegacy: null legacy_request"; - return false; - } - *legacy_request = {}; - - legacy_request->config_2dot4g_support = 1; - legacy_request->support_2dot4g_val = - hidl_request.operateInBand[(size_t)NanBandIndex::NAN_BAND_24GHZ]; - legacy_request->config_support_5g = 1; - legacy_request->support_5g_val = - hidl_request.operateInBand[(size_t)NanBandIndex::NAN_BAND_5GHZ]; - legacy_request->config_hop_count_limit = 1; - legacy_request->hop_count_limit_val = hidl_request.hopCountMax; - legacy_request->master_pref = hidl_request.configParams.masterPref; - legacy_request->discovery_indication_cfg = 0; - legacy_request->discovery_indication_cfg |= - hidl_request.configParams.disableDiscoveryAddressChangeIndication ? 0x1 : 0x0; - legacy_request->discovery_indication_cfg |= - hidl_request.configParams.disableStartedClusterIndication ? 0x2 : 0x0; - legacy_request->discovery_indication_cfg |= - hidl_request.configParams.disableJoinedClusterIndication ? 0x4 : 0x0; - legacy_request->config_sid_beacon = 1; - if (hidl_request.configParams.numberOfPublishServiceIdsInBeacon > 127) { - LOG(ERROR) << "convertHidlNanEnableRequestToLegacy: " - "numberOfPublishServiceIdsInBeacon > 127"; - return false; - } - legacy_request->sid_beacon_val = - (hidl_request.configParams.includePublishServiceIdsInBeacon ? 0x1 : 0x0) | - (hidl_request.configParams.numberOfPublishServiceIdsInBeacon << 1); - legacy_request->config_subscribe_sid_beacon = 1; - if (hidl_request.configParams.numberOfSubscribeServiceIdsInBeacon > 127) { - LOG(ERROR) << "convertHidlNanEnableRequestToLegacy: " - "numberOfSubscribeServiceIdsInBeacon > 127"; - return false; - } - legacy_request->subscribe_sid_beacon_val = - (hidl_request.configParams.includeSubscribeServiceIdsInBeacon ? 0x1 : 0x0) | - (hidl_request.configParams.numberOfSubscribeServiceIdsInBeacon << 1); - legacy_request->config_rssi_window_size = 1; - legacy_request->rssi_window_size_val = hidl_request.configParams.rssiWindowSize; - legacy_request->config_disc_mac_addr_randomization = 1; - legacy_request->disc_mac_addr_rand_interval_sec = - hidl_request.configParams.macAddressRandomizationIntervalSec; - legacy_request->config_2dot4g_rssi_close = 1; - if (hidl_request.configParams.bandSpecificConfig.size() != 3) { - LOG(ERROR) << "convertHidlNanEnableRequestToLegacy: " - "bandSpecificConfig.size() != 3"; - return false; - } - legacy_request->rssi_close_2dot4g_val = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .rssiClose; - legacy_request->config_2dot4g_rssi_middle = 1; - legacy_request->rssi_middle_2dot4g_val = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .rssiMiddle; - legacy_request->config_2dot4g_rssi_proximity = 1; - legacy_request->rssi_proximity_2dot4g_val = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .rssiCloseProximity; - legacy_request->config_scan_params = 1; - legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_24G_BAND] = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .dwellTimeMs; - legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_24G_BAND] = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .scanPeriodSec; - legacy_request->config_dw.config_2dot4g_dw_band = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .validDiscoveryWindowIntervalVal; - legacy_request->config_dw.dw_2dot4g_interval_val = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .discoveryWindowIntervalVal; - legacy_request->config_5g_rssi_close = 1; - legacy_request->rssi_close_5g_val = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .rssiClose; - legacy_request->config_5g_rssi_middle = 1; - legacy_request->rssi_middle_5g_val = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .rssiMiddle; - legacy_request->config_5g_rssi_close_proximity = 1; - legacy_request->rssi_close_proximity_5g_val = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .rssiCloseProximity; - legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .dwellTimeMs; - legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .scanPeriodSec; - legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .dwellTimeMs; - legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .scanPeriodSec; - legacy_request->config_dw.config_5g_dw_band = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .validDiscoveryWindowIntervalVal; - legacy_request->config_dw.dw_5g_interval_val = - hidl_request.configParams.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .discoveryWindowIntervalVal; - if (hidl_request.debugConfigs.validClusterIdVals) { - legacy_request->cluster_low = hidl_request.debugConfigs.clusterIdBottomRangeVal; - legacy_request->cluster_high = hidl_request.debugConfigs.clusterIdTopRangeVal; - } else { // need 'else' since not configurable in legacy HAL - legacy_request->cluster_low = 0x0000; - legacy_request->cluster_high = 0xFFFF; - } - legacy_request->config_intf_addr = hidl_request.debugConfigs.validIntfAddrVal; - memcpy(legacy_request->intf_addr_val, hidl_request.debugConfigs.intfAddrVal.data(), 6); - legacy_request->config_oui = hidl_request.debugConfigs.validOuiVal; - legacy_request->oui_val = hidl_request.debugConfigs.ouiVal; - legacy_request->config_random_factor_force = - hidl_request.debugConfigs.validRandomFactorForceVal; - legacy_request->random_factor_force_val = hidl_request.debugConfigs.randomFactorForceVal; - legacy_request->config_hop_count_force = hidl_request.debugConfigs.validHopCountForceVal; - legacy_request->hop_count_force_val = hidl_request.debugConfigs.hopCountForceVal; - legacy_request->config_24g_channel = hidl_request.debugConfigs.validDiscoveryChannelVal; - legacy_request->channel_24g_val = - hidl_request.debugConfigs.discoveryChannelMhzVal[(size_t)NanBandIndex::NAN_BAND_24GHZ]; - legacy_request->config_5g_channel = hidl_request.debugConfigs.validDiscoveryChannelVal; - legacy_request->channel_5g_val = - hidl_request.debugConfigs.discoveryChannelMhzVal[(size_t)NanBandIndex::NAN_BAND_5GHZ]; - legacy_request->config_2dot4g_beacons = hidl_request.debugConfigs.validUseBeaconsInBandVal; - legacy_request->beacon_2dot4g_val = - hidl_request.debugConfigs.useBeaconsInBandVal[(size_t)NanBandIndex::NAN_BAND_24GHZ]; - legacy_request->config_5g_beacons = hidl_request.debugConfigs.validUseBeaconsInBandVal; - legacy_request->beacon_5g_val = - hidl_request.debugConfigs.useBeaconsInBandVal[(size_t)NanBandIndex::NAN_BAND_5GHZ]; - legacy_request->config_2dot4g_sdf = hidl_request.debugConfigs.validUseSdfInBandVal; - legacy_request->sdf_2dot4g_val = - hidl_request.debugConfigs.useSdfInBandVal[(size_t)NanBandIndex::NAN_BAND_24GHZ]; - legacy_request->config_5g_sdf = hidl_request.debugConfigs.validUseSdfInBandVal; - legacy_request->sdf_5g_val = - hidl_request.debugConfigs.useSdfInBandVal[(size_t)NanBandIndex::NAN_BAND_5GHZ]; - - /* TODO: b/145609058 - * Missing updates needed to legacy_hal::NanEnableRequest and conversion to - * it for 6GHz band */ - - return true; -} - -bool convertHidlNanEnableRequest_1_6ToLegacy(const V1_4::NanEnableRequest& hidl_request1, - const NanConfigRequestSupplemental& hidl_request2, - legacy_hal::NanEnableRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertHidlNanEnableRequest_1_6ToLegacy: null legacy_request"; - return false; - } - - *legacy_request = {}; - if (!convertHidlNanEnableRequestToLegacy(hidl_request1, legacy_request)) { - return false; - } - - legacy_request->config_discovery_beacon_int = 1; - legacy_request->discovery_beacon_interval = hidl_request2.V1_5.V1_2.discoveryBeaconIntervalMs; - legacy_request->config_nss = 1; - legacy_request->nss = hidl_request2.V1_5.V1_2.numberOfSpatialStreamsInDiscovery; - legacy_request->config_dw_early_termination = 1; - legacy_request->enable_dw_termination = - hidl_request2.V1_5.V1_2.enableDiscoveryWindowEarlyTermination; - legacy_request->config_enable_ranging = 1; - legacy_request->enable_ranging = hidl_request2.V1_5.V1_2.enableRanging; - - legacy_request->config_enable_instant_mode = 1; - legacy_request->enable_instant_mode = hidl_request2.V1_5.enableInstantCommunicationMode; - legacy_request->config_instant_mode_channel = 1; - legacy_request->instant_mode_channel = hidl_request2.instantModeChannel; - - return true; -} - -bool convertHidlNanConfigRequest_1_6ToLegacy(const V1_4::NanConfigRequest& hidl_request1, - const NanConfigRequestSupplemental& hidl_request2, - legacy_hal::NanConfigRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertHidlNanConfigRequest_1_6ToLegacy: null legacy_request"; - return false; - } - - *legacy_request = {}; - if (!convertHidlNanConfigRequestToLegacy(hidl_request1, legacy_request)) { - return false; - } - - legacy_request->config_discovery_beacon_int = 1; - legacy_request->discovery_beacon_interval = hidl_request2.V1_5.V1_2.discoveryBeaconIntervalMs; - legacy_request->config_nss = 1; - legacy_request->nss = hidl_request2.V1_5.V1_2.numberOfSpatialStreamsInDiscovery; - legacy_request->config_dw_early_termination = 1; - legacy_request->enable_dw_termination = - hidl_request2.V1_5.V1_2.enableDiscoveryWindowEarlyTermination; - legacy_request->config_enable_ranging = 1; - legacy_request->enable_ranging = hidl_request2.V1_5.V1_2.enableRanging; - - legacy_request->config_enable_instant_mode = 1; - legacy_request->enable_instant_mode = hidl_request2.V1_5.enableInstantCommunicationMode; - legacy_request->config_instant_mode_channel = 1; - legacy_request->instant_mode_channel = hidl_request2.instantModeChannel; - - return true; -} - -bool convertHidlNanPublishRequestToLegacy(const V1_6::NanPublishRequest& hidl_request, - legacy_hal::NanPublishRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: null legacy_request"; - return false; - } - *legacy_request = {}; - - legacy_request->publish_id = hidl_request.baseConfigs.sessionId; - legacy_request->ttl = hidl_request.baseConfigs.ttlSec; - legacy_request->period = hidl_request.baseConfigs.discoveryWindowPeriod; - legacy_request->publish_count = hidl_request.baseConfigs.discoveryCount; - legacy_request->service_name_len = hidl_request.baseConfigs.serviceName.size(); - if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { - LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: service_name_len " - "too large"; - return false; - } - memcpy(legacy_request->service_name, hidl_request.baseConfigs.serviceName.data(), - legacy_request->service_name_len); - legacy_request->publish_match_indicator = - convertHidlNanMatchAlgToLegacy(hidl_request.baseConfigs.discoveryMatchIndicator); - legacy_request->service_specific_info_len = hidl_request.baseConfigs.serviceSpecificInfo.size(); - if (legacy_request->service_specific_info_len > NAN_MAX_SERVICE_SPECIFIC_INFO_LEN) { - LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: " - "service_specific_info_len too large"; - return false; - } - memcpy(legacy_request->service_specific_info, - hidl_request.baseConfigs.serviceSpecificInfo.data(), - legacy_request->service_specific_info_len); - legacy_request->sdea_service_specific_info_len = - hidl_request.baseConfigs.extendedServiceSpecificInfo.size(); - if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) { - LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: " - "sdea_service_specific_info_len too large"; - return false; - } - memcpy(legacy_request->sdea_service_specific_info, - hidl_request.baseConfigs.extendedServiceSpecificInfo.data(), - legacy_request->sdea_service_specific_info_len); - legacy_request->rx_match_filter_len = hidl_request.baseConfigs.rxMatchFilter.size(); - if (legacy_request->rx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { - LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: " - "rx_match_filter_len too large"; - return false; - } - memcpy(legacy_request->rx_match_filter, hidl_request.baseConfigs.rxMatchFilter.data(), - legacy_request->rx_match_filter_len); - legacy_request->tx_match_filter_len = hidl_request.baseConfigs.txMatchFilter.size(); - if (legacy_request->tx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { - LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: " - "tx_match_filter_len too large"; - return false; - } - memcpy(legacy_request->tx_match_filter, hidl_request.baseConfigs.txMatchFilter.data(), - legacy_request->tx_match_filter_len); - legacy_request->rssi_threshold_flag = hidl_request.baseConfigs.useRssiThreshold; - legacy_request->recv_indication_cfg = 0; - legacy_request->recv_indication_cfg |= - hidl_request.baseConfigs.disableDiscoveryTerminationIndication ? 0x1 : 0x0; - legacy_request->recv_indication_cfg |= - hidl_request.baseConfigs.disableMatchExpirationIndication ? 0x2 : 0x0; - legacy_request->recv_indication_cfg |= - hidl_request.baseConfigs.disableFollowupReceivedIndication ? 0x4 : 0x0; - legacy_request->recv_indication_cfg |= 0x8; - legacy_request->cipher_type = (unsigned int)hidl_request.baseConfigs.securityConfig.cipherType; - - legacy_request->scid_len = hidl_request.baseConfigs.securityConfig.scid.size(); - if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) { - LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: scid_len too large"; - return false; - } - memcpy(legacy_request->scid, hidl_request.baseConfigs.securityConfig.scid.data(), - legacy_request->scid_len); - - if (hidl_request.baseConfigs.securityConfig.securityType == NanDataPathSecurityType::PMK) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; - legacy_request->key_info.body.pmk_info.pmk_len = - hidl_request.baseConfigs.securityConfig.pmk.size(); - if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { - LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: invalid pmk_len"; - return false; - } - memcpy(legacy_request->key_info.body.pmk_info.pmk, - hidl_request.baseConfigs.securityConfig.pmk.data(), - legacy_request->key_info.body.pmk_info.pmk_len); - } - if (hidl_request.baseConfigs.securityConfig.securityType == - NanDataPathSecurityType::PASSPHRASE) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; - legacy_request->key_info.body.passphrase_info.passphrase_len = - hidl_request.baseConfigs.securityConfig.passphrase.size(); - if (legacy_request->key_info.body.passphrase_info.passphrase_len < - NAN_SECURITY_MIN_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: " - "passphrase_len too small"; - return false; - } - if (legacy_request->key_info.body.passphrase_info.passphrase_len > - NAN_SECURITY_MAX_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: " - "passphrase_len too large"; - return false; - } - memcpy(legacy_request->key_info.body.passphrase_info.passphrase, - hidl_request.baseConfigs.securityConfig.passphrase.data(), - legacy_request->key_info.body.passphrase_info.passphrase_len); - } - legacy_request->sdea_params.security_cfg = - (hidl_request.baseConfigs.securityConfig.securityType != NanDataPathSecurityType::OPEN) - ? legacy_hal::NAN_DP_CONFIG_SECURITY - : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; - - legacy_request->sdea_params.ranging_state = hidl_request.baseConfigs.rangingRequired - ? legacy_hal::NAN_RANGING_ENABLE - : legacy_hal::NAN_RANGING_DISABLE; - legacy_request->ranging_cfg.ranging_interval_msec = - hidl_request.baseConfigs.rangingIntervalMsec; - legacy_request->ranging_cfg.config_ranging_indications = - hidl_request.baseConfigs.configRangingIndications; - legacy_request->ranging_cfg.distance_ingress_mm = - hidl_request.baseConfigs.distanceIngressCm * 10; - legacy_request->ranging_cfg.distance_egress_mm = hidl_request.baseConfigs.distanceEgressCm * 10; - legacy_request->ranging_auto_response = hidl_request.baseConfigs.rangingRequired - ? legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE - : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE; - legacy_request->sdea_params.range_report = legacy_hal::NAN_DISABLE_RANGE_REPORT; - legacy_request->publish_type = convertHidlNanPublishTypeToLegacy(hidl_request.publishType); - legacy_request->tx_type = convertHidlNanTxTypeToLegacy(hidl_request.txType); - legacy_request->service_responder_policy = hidl_request.autoAcceptDataPathRequests - ? legacy_hal::NAN_SERVICE_ACCEPT_POLICY_ALL - : legacy_hal::NAN_SERVICE_ACCEPT_POLICY_NONE; - - return true; -} - -bool convertHidlNanSubscribeRequestToLegacy(const V1_0::NanSubscribeRequest& hidl_request, - legacy_hal::NanSubscribeRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: legacy_request is null"; - return false; - } - *legacy_request = {}; - - legacy_request->subscribe_id = hidl_request.baseConfigs.sessionId; - legacy_request->ttl = hidl_request.baseConfigs.ttlSec; - legacy_request->period = hidl_request.baseConfigs.discoveryWindowPeriod; - legacy_request->subscribe_count = hidl_request.baseConfigs.discoveryCount; - legacy_request->service_name_len = hidl_request.baseConfigs.serviceName.size(); - if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { - LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " - "service_name_len too large"; - return false; - } - memcpy(legacy_request->service_name, hidl_request.baseConfigs.serviceName.data(), - legacy_request->service_name_len); - legacy_request->subscribe_match_indicator = - convertHidlNanMatchAlgToLegacy(hidl_request.baseConfigs.discoveryMatchIndicator); - legacy_request->service_specific_info_len = hidl_request.baseConfigs.serviceSpecificInfo.size(); - if (legacy_request->service_specific_info_len > NAN_MAX_SERVICE_SPECIFIC_INFO_LEN) { - LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " - "service_specific_info_len too large"; - return false; - } - memcpy(legacy_request->service_specific_info, - hidl_request.baseConfigs.serviceSpecificInfo.data(), - legacy_request->service_specific_info_len); - legacy_request->sdea_service_specific_info_len = - hidl_request.baseConfigs.extendedServiceSpecificInfo.size(); - if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) { - LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " - "sdea_service_specific_info_len too large"; - return false; - } - memcpy(legacy_request->sdea_service_specific_info, - hidl_request.baseConfigs.extendedServiceSpecificInfo.data(), - legacy_request->sdea_service_specific_info_len); - legacy_request->rx_match_filter_len = hidl_request.baseConfigs.rxMatchFilter.size(); - if (legacy_request->rx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { - LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " - "rx_match_filter_len too large"; - return false; - } - memcpy(legacy_request->rx_match_filter, hidl_request.baseConfigs.rxMatchFilter.data(), - legacy_request->rx_match_filter_len); - legacy_request->tx_match_filter_len = hidl_request.baseConfigs.txMatchFilter.size(); - if (legacy_request->tx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) { - LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " - "tx_match_filter_len too large"; - return false; - } - memcpy(legacy_request->tx_match_filter, hidl_request.baseConfigs.txMatchFilter.data(), - legacy_request->tx_match_filter_len); - legacy_request->rssi_threshold_flag = hidl_request.baseConfigs.useRssiThreshold; - legacy_request->recv_indication_cfg = 0; - legacy_request->recv_indication_cfg |= - hidl_request.baseConfigs.disableDiscoveryTerminationIndication ? 0x1 : 0x0; - legacy_request->recv_indication_cfg |= - hidl_request.baseConfigs.disableMatchExpirationIndication ? 0x2 : 0x0; - legacy_request->recv_indication_cfg |= - hidl_request.baseConfigs.disableFollowupReceivedIndication ? 0x4 : 0x0; - legacy_request->cipher_type = (unsigned int)hidl_request.baseConfigs.securityConfig.cipherType; - if (hidl_request.baseConfigs.securityConfig.securityType == NanDataPathSecurityType::PMK) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; - legacy_request->key_info.body.pmk_info.pmk_len = - hidl_request.baseConfigs.securityConfig.pmk.size(); - if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { - LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: invalid pmk_len"; - return false; - } - memcpy(legacy_request->key_info.body.pmk_info.pmk, - hidl_request.baseConfigs.securityConfig.pmk.data(), - legacy_request->key_info.body.pmk_info.pmk_len); - } - if (hidl_request.baseConfigs.securityConfig.securityType == - NanDataPathSecurityType::PASSPHRASE) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; - legacy_request->key_info.body.passphrase_info.passphrase_len = - hidl_request.baseConfigs.securityConfig.passphrase.size(); - if (legacy_request->key_info.body.passphrase_info.passphrase_len < - NAN_SECURITY_MIN_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " - "passphrase_len too small"; - return false; - } - if (legacy_request->key_info.body.passphrase_info.passphrase_len > - NAN_SECURITY_MAX_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " - "passphrase_len too large"; - return false; - } - memcpy(legacy_request->key_info.body.passphrase_info.passphrase, - hidl_request.baseConfigs.securityConfig.passphrase.data(), - legacy_request->key_info.body.passphrase_info.passphrase_len); - } - legacy_request->sdea_params.security_cfg = - (hidl_request.baseConfigs.securityConfig.securityType != NanDataPathSecurityType::OPEN) - ? legacy_hal::NAN_DP_CONFIG_SECURITY - : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; - legacy_request->sdea_params.ranging_state = hidl_request.baseConfigs.rangingRequired - ? legacy_hal::NAN_RANGING_ENABLE - : legacy_hal::NAN_RANGING_DISABLE; - legacy_request->ranging_cfg.ranging_interval_msec = - hidl_request.baseConfigs.rangingIntervalMsec; - legacy_request->ranging_cfg.config_ranging_indications = - hidl_request.baseConfigs.configRangingIndications; - legacy_request->ranging_cfg.distance_ingress_mm = - hidl_request.baseConfigs.distanceIngressCm * 10; - legacy_request->ranging_cfg.distance_egress_mm = hidl_request.baseConfigs.distanceEgressCm * 10; - legacy_request->ranging_auto_response = hidl_request.baseConfigs.rangingRequired - ? legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE - : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE; - legacy_request->sdea_params.range_report = legacy_hal::NAN_DISABLE_RANGE_REPORT; - legacy_request->subscribe_type = - convertHidlNanSubscribeTypeToLegacy(hidl_request.subscribeType); - legacy_request->serviceResponseFilter = convertHidlNanSrfTypeToLegacy(hidl_request.srfType); - legacy_request->serviceResponseInclude = hidl_request.srfRespondIfInAddressSet - ? legacy_hal::NAN_SRF_INCLUDE_RESPOND - : legacy_hal::NAN_SRF_INCLUDE_DO_NOT_RESPOND; - legacy_request->useServiceResponseFilter = - hidl_request.shouldUseSrf ? legacy_hal::NAN_USE_SRF : legacy_hal::NAN_DO_NOT_USE_SRF; - legacy_request->ssiRequiredForMatchIndication = - hidl_request.isSsiRequiredForMatch ? legacy_hal::NAN_SSI_REQUIRED_IN_MATCH_IND - : legacy_hal::NAN_SSI_NOT_REQUIRED_IN_MATCH_IND; - legacy_request->num_intf_addr_present = hidl_request.intfAddr.size(); - if (legacy_request->num_intf_addr_present > NAN_MAX_SUBSCRIBE_MAX_ADDRESS) { - LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: " - "num_intf_addr_present - too many"; - return false; - } - for (int i = 0; i < legacy_request->num_intf_addr_present; i++) { - memcpy(legacy_request->intf_addr[i], hidl_request.intfAddr[i].data(), 6); - } - - return true; -} - -bool convertHidlNanTransmitFollowupRequestToLegacy( - const NanTransmitFollowupRequest& hidl_request, - legacy_hal::NanTransmitFollowupRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertHidlNanTransmitFollowupRequestToLegacy: " - "legacy_request is null"; - return false; - } - *legacy_request = {}; - - legacy_request->publish_subscribe_id = hidl_request.discoverySessionId; - legacy_request->requestor_instance_id = hidl_request.peerId; - memcpy(legacy_request->addr, hidl_request.addr.data(), 6); - legacy_request->priority = hidl_request.isHighPriority ? legacy_hal::NAN_TX_PRIORITY_HIGH - : legacy_hal::NAN_TX_PRIORITY_NORMAL; - legacy_request->dw_or_faw = hidl_request.shouldUseDiscoveryWindow - ? legacy_hal::NAN_TRANSMIT_IN_DW - : legacy_hal::NAN_TRANSMIT_IN_FAW; - legacy_request->service_specific_info_len = hidl_request.serviceSpecificInfo.size(); - if (legacy_request->service_specific_info_len > NAN_MAX_SERVICE_SPECIFIC_INFO_LEN) { - LOG(ERROR) << "convertHidlNanTransmitFollowupRequestToLegacy: " - "service_specific_info_len too large"; - return false; - } - memcpy(legacy_request->service_specific_info, hidl_request.serviceSpecificInfo.data(), - legacy_request->service_specific_info_len); - legacy_request->sdea_service_specific_info_len = - hidl_request.extendedServiceSpecificInfo.size(); - if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) { - LOG(ERROR) << "convertHidlNanTransmitFollowupRequestToLegacy: " - "sdea_service_specific_info_len too large"; - return false; - } - memcpy(legacy_request->sdea_service_specific_info, - hidl_request.extendedServiceSpecificInfo.data(), - legacy_request->sdea_service_specific_info_len); - legacy_request->recv_indication_cfg = hidl_request.disableFollowupResultIndication ? 0x1 : 0x0; - - return true; -} - -bool convertHidlNanConfigRequestToLegacy(const V1_4::NanConfigRequest& hidl_request, - legacy_hal::NanConfigRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertHidlNanConfigRequestToLegacy: legacy_request is null"; - return false; - } - *legacy_request = {}; - - // TODO: b/34059183 tracks missing configurations in legacy HAL or uknown - // defaults - legacy_request->master_pref = hidl_request.masterPref; - legacy_request->discovery_indication_cfg = 0; - legacy_request->discovery_indication_cfg |= - hidl_request.disableDiscoveryAddressChangeIndication ? 0x1 : 0x0; - legacy_request->discovery_indication_cfg |= - hidl_request.disableStartedClusterIndication ? 0x2 : 0x0; - legacy_request->discovery_indication_cfg |= - hidl_request.disableJoinedClusterIndication ? 0x4 : 0x0; - legacy_request->config_sid_beacon = 1; - if (hidl_request.numberOfPublishServiceIdsInBeacon > 127) { - LOG(ERROR) << "convertHidlNanConfigRequestToLegacy: " - "numberOfPublishServiceIdsInBeacon > 127"; - return false; - } - legacy_request->sid_beacon = (hidl_request.includePublishServiceIdsInBeacon ? 0x1 : 0x0) | - (hidl_request.numberOfPublishServiceIdsInBeacon << 1); - legacy_request->config_subscribe_sid_beacon = 1; - if (hidl_request.numberOfSubscribeServiceIdsInBeacon > 127) { - LOG(ERROR) << "convertHidlNanConfigRequestToLegacy: " - "numberOfSubscribeServiceIdsInBeacon > 127"; - return false; - } - legacy_request->subscribe_sid_beacon_val = - (hidl_request.includeSubscribeServiceIdsInBeacon ? 0x1 : 0x0) | - (hidl_request.numberOfSubscribeServiceIdsInBeacon << 1); - legacy_request->config_rssi_window_size = 1; - legacy_request->rssi_window_size_val = hidl_request.rssiWindowSize; - legacy_request->config_disc_mac_addr_randomization = 1; - legacy_request->disc_mac_addr_rand_interval_sec = - hidl_request.macAddressRandomizationIntervalSec; - /* TODO : missing - legacy_request->config_2dot4g_rssi_close = 1; - legacy_request->rssi_close_2dot4g_val = - hidl_request.bandSpecificConfig[ - (size_t) NanBandIndex::NAN_BAND_24GHZ].rssiClose; - legacy_request->config_2dot4g_rssi_middle = 1; - legacy_request->rssi_middle_2dot4g_val = - hidl_request.bandSpecificConfig[ - (size_t) NanBandIndex::NAN_BAND_24GHZ].rssiMiddle; - legacy_request->config_2dot4g_rssi_proximity = 1; - legacy_request->rssi_proximity_2dot4g_val = - hidl_request.bandSpecificConfig[ - (size_t) NanBandIndex::NAN_BAND_24GHZ].rssiCloseProximity; - */ - legacy_request->config_scan_params = 1; - legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_24G_BAND] = - hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ].dwellTimeMs; - legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_24G_BAND] = - hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ].scanPeriodSec; - legacy_request->config_dw.config_2dot4g_dw_band = - hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .validDiscoveryWindowIntervalVal; - legacy_request->config_dw.dw_2dot4g_interval_val = - hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_24GHZ] - .discoveryWindowIntervalVal; - /* TODO: missing - legacy_request->config_5g_rssi_close = 1; - legacy_request->rssi_close_5g_val = - hidl_request.bandSpecificConfig[ - (size_t) NanBandIndex::NAN_BAND_5GHZ].rssiClose; - legacy_request->config_5g_rssi_middle = 1; - legacy_request->rssi_middle_5g_val = - hidl_request.bandSpecificConfig[ - (size_t) NanBandIndex::NAN_BAND_5GHZ].rssiMiddle; - */ - legacy_request->config_5g_rssi_close_proximity = 1; - legacy_request->rssi_close_proximity_5g_val = - hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].rssiCloseProximity; - legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = - hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].dwellTimeMs; - legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_LOW] = - hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].scanPeriodSec; - legacy_request->scan_params_val.dwell_time[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = - hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].dwellTimeMs; - legacy_request->scan_params_val.scan_period[legacy_hal::NAN_CHANNEL_5G_BAND_HIGH] = - hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ].scanPeriodSec; - legacy_request->config_dw.config_5g_dw_band = - hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .validDiscoveryWindowIntervalVal; - legacy_request->config_dw.dw_5g_interval_val = - hidl_request.bandSpecificConfig[(size_t)NanBandIndex::NAN_BAND_5GHZ] - .discoveryWindowIntervalVal; - /* TODO: b/145609058 - * Missing updates needed to legacy_hal::NanConfigRequest and conversion to - * it for 6GHz band */ - - return true; -} - -bool convertHidlNanDataPathInitiatorRequestToLegacy( - const V1_0::NanInitiateDataPathRequest& hidl_request, - legacy_hal::NanDataPathInitiatorRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " - "legacy_request is null"; - return false; - } - *legacy_request = {}; - - legacy_request->requestor_instance_id = hidl_request.peerId; - memcpy(legacy_request->peer_disc_mac_addr, hidl_request.peerDiscMacAddr.data(), 6); - legacy_request->channel_request_type = - convertHidlNanDataPathChannelCfgToLegacy(hidl_request.channelRequestType); - legacy_request->channel = hidl_request.channel; - if (strnlen(hidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " - "ifaceName too long"; - return false; - } - strlcpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1); - legacy_request->ndp_cfg.security_cfg = - (hidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN) - ? legacy_hal::NAN_DP_CONFIG_SECURITY - : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; - legacy_request->app_info.ndp_app_info_len = hidl_request.appInfo.size(); - if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " - "ndp_app_info_len too large"; - return false; - } - memcpy(legacy_request->app_info.ndp_app_info, hidl_request.appInfo.data(), - legacy_request->app_info.ndp_app_info_len); - legacy_request->cipher_type = (unsigned int)hidl_request.securityConfig.cipherType; - if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; - legacy_request->key_info.body.pmk_info.pmk_len = hidl_request.securityConfig.pmk.size(); - if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " - "invalid pmk_len"; - return false; - } - memcpy(legacy_request->key_info.body.pmk_info.pmk, hidl_request.securityConfig.pmk.data(), - legacy_request->key_info.body.pmk_info.pmk_len); - } - if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; - legacy_request->key_info.body.passphrase_info.passphrase_len = - hidl_request.securityConfig.passphrase.size(); - if (legacy_request->key_info.body.passphrase_info.passphrase_len < - NAN_SECURITY_MIN_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " - "passphrase_len too small"; - return false; - } - if (legacy_request->key_info.body.passphrase_info.passphrase_len > - NAN_SECURITY_MAX_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " - "passphrase_len too large"; - return false; - } - memcpy(legacy_request->key_info.body.passphrase_info.passphrase, - hidl_request.securityConfig.passphrase.data(), - legacy_request->key_info.body.passphrase_info.passphrase_len); - } - legacy_request->service_name_len = hidl_request.serviceNameOutOfBand.size(); - if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: " - "service_name_len too large"; - return false; - } - memcpy(legacy_request->service_name, hidl_request.serviceNameOutOfBand.data(), - legacy_request->service_name_len); - - return true; -} - -bool convertHidlNanDataPathInitiatorRequest_1_6ToLegacy( - const V1_6::NanInitiateDataPathRequest& hidl_request, - legacy_hal::NanDataPathInitiatorRequest* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " - "legacy_request is null"; - return false; - } - *legacy_request = {}; - - legacy_request->requestor_instance_id = hidl_request.peerId; - memcpy(legacy_request->peer_disc_mac_addr, hidl_request.peerDiscMacAddr.data(), 6); - legacy_request->channel_request_type = - convertHidlNanDataPathChannelCfgToLegacy(hidl_request.channelRequestType); - legacy_request->channel = hidl_request.channel; - if (strnlen(hidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " - "ifaceName too long"; - return false; - } - strlcpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1); - legacy_request->ndp_cfg.security_cfg = - (hidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN) - ? legacy_hal::NAN_DP_CONFIG_SECURITY - : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; - legacy_request->app_info.ndp_app_info_len = hidl_request.appInfo.size(); - if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " - "ndp_app_info_len too large"; - return false; - } - memcpy(legacy_request->app_info.ndp_app_info, hidl_request.appInfo.data(), - legacy_request->app_info.ndp_app_info_len); - legacy_request->cipher_type = (unsigned int)hidl_request.securityConfig.cipherType; - if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; - legacy_request->key_info.body.pmk_info.pmk_len = hidl_request.securityConfig.pmk.size(); - if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " - "invalid pmk_len"; - return false; - } - memcpy(legacy_request->key_info.body.pmk_info.pmk, hidl_request.securityConfig.pmk.data(), - legacy_request->key_info.body.pmk_info.pmk_len); - } - if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; - legacy_request->key_info.body.passphrase_info.passphrase_len = - hidl_request.securityConfig.passphrase.size(); - if (legacy_request->key_info.body.passphrase_info.passphrase_len < - NAN_SECURITY_MIN_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " - "passphrase_len too small"; - return false; - } - if (legacy_request->key_info.body.passphrase_info.passphrase_len > - NAN_SECURITY_MAX_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " - "passphrase_len too large"; - return false; - } - memcpy(legacy_request->key_info.body.passphrase_info.passphrase, - hidl_request.securityConfig.passphrase.data(), - legacy_request->key_info.body.passphrase_info.passphrase_len); - } - legacy_request->service_name_len = hidl_request.serviceNameOutOfBand.size(); - if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: " - "service_name_len too large"; - return false; - } - memcpy(legacy_request->service_name, hidl_request.serviceNameOutOfBand.data(), - legacy_request->service_name_len); - legacy_request->scid_len = hidl_request.securityConfig.scid.size(); - if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) { - LOG(ERROR) << "convertHidlNanDataPathInitiatorRequest_1_6ToLegacy: scid_len too large"; - return false; - } - memcpy(legacy_request->scid, hidl_request.securityConfig.scid.data(), legacy_request->scid_len); - - return true; -} - -bool convertHidlNanDataPathIndicationResponseToLegacy( - const V1_0::NanRespondToDataPathIndicationRequest& hidl_request, - legacy_hal::NanDataPathIndicationResponse* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: " - "legacy_request is null"; - return false; - } - *legacy_request = {}; - - legacy_request->rsp_code = hidl_request.acceptRequest ? legacy_hal::NAN_DP_REQUEST_ACCEPT - : legacy_hal::NAN_DP_REQUEST_REJECT; - legacy_request->ndp_instance_id = hidl_request.ndpInstanceId; - if (strnlen(hidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: " - "ifaceName too long"; - return false; - } - strlcpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1); - legacy_request->ndp_cfg.security_cfg = - (hidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN) - ? legacy_hal::NAN_DP_CONFIG_SECURITY - : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; - legacy_request->app_info.ndp_app_info_len = hidl_request.appInfo.size(); - if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: " - "ndp_app_info_len too large"; - return false; - } - memcpy(legacy_request->app_info.ndp_app_info, hidl_request.appInfo.data(), - legacy_request->app_info.ndp_app_info_len); - legacy_request->cipher_type = (unsigned int)hidl_request.securityConfig.cipherType; - if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; - legacy_request->key_info.body.pmk_info.pmk_len = hidl_request.securityConfig.pmk.size(); - if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: " - "invalid pmk_len"; - return false; - } - memcpy(legacy_request->key_info.body.pmk_info.pmk, hidl_request.securityConfig.pmk.data(), - legacy_request->key_info.body.pmk_info.pmk_len); - } - if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; - legacy_request->key_info.body.passphrase_info.passphrase_len = - hidl_request.securityConfig.passphrase.size(); - if (legacy_request->key_info.body.passphrase_info.passphrase_len < - NAN_SECURITY_MIN_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: " - "passphrase_len too small"; - return false; - } - if (legacy_request->key_info.body.passphrase_info.passphrase_len > - NAN_SECURITY_MAX_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: " - "passphrase_len too large"; - return false; - } - memcpy(legacy_request->key_info.body.passphrase_info.passphrase, - hidl_request.securityConfig.passphrase.data(), - legacy_request->key_info.body.passphrase_info.passphrase_len); - } - legacy_request->service_name_len = hidl_request.serviceNameOutOfBand.size(); - if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: " - "service_name_len too large"; - return false; - } - memcpy(legacy_request->service_name, hidl_request.serviceNameOutOfBand.data(), - legacy_request->service_name_len); - - return true; -} - -bool convertHidlNanDataPathIndicationResponse_1_6ToLegacy( - const V1_6::NanRespondToDataPathIndicationRequest& hidl_request, - legacy_hal::NanDataPathIndicationResponse* legacy_request) { - if (!legacy_request) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " - "legacy_request is null"; - return false; - } - *legacy_request = {}; - - legacy_request->rsp_code = hidl_request.acceptRequest ? legacy_hal::NAN_DP_REQUEST_ACCEPT - : legacy_hal::NAN_DP_REQUEST_REJECT; - legacy_request->ndp_instance_id = hidl_request.ndpInstanceId; - if (strnlen(hidl_request.ifaceName.c_str(), IFNAMSIZ + 1) == IFNAMSIZ + 1) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " - "ifaceName too long"; - return false; - } - strlcpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str(), IFNAMSIZ + 1); - legacy_request->ndp_cfg.security_cfg = - (hidl_request.securityConfig.securityType != NanDataPathSecurityType::OPEN) - ? legacy_hal::NAN_DP_CONFIG_SECURITY - : legacy_hal::NAN_DP_CONFIG_NO_SECURITY; - legacy_request->app_info.ndp_app_info_len = hidl_request.appInfo.size(); - if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " - "ndp_app_info_len too large"; - return false; - } - memcpy(legacy_request->app_info.ndp_app_info, hidl_request.appInfo.data(), - legacy_request->app_info.ndp_app_info_len); - legacy_request->cipher_type = (unsigned int)hidl_request.securityConfig.cipherType; - if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK; - legacy_request->key_info.body.pmk_info.pmk_len = hidl_request.securityConfig.pmk.size(); - if (legacy_request->key_info.body.pmk_info.pmk_len != NAN_PMK_INFO_LEN) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " - "invalid pmk_len"; - return false; - } - memcpy(legacy_request->key_info.body.pmk_info.pmk, hidl_request.securityConfig.pmk.data(), - legacy_request->key_info.body.pmk_info.pmk_len); - } - if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) { - legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE; - legacy_request->key_info.body.passphrase_info.passphrase_len = - hidl_request.securityConfig.passphrase.size(); - if (legacy_request->key_info.body.passphrase_info.passphrase_len < - NAN_SECURITY_MIN_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " - "passphrase_len too small"; - return false; - } - if (legacy_request->key_info.body.passphrase_info.passphrase_len > - NAN_SECURITY_MAX_PASSPHRASE_LEN) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " - "passphrase_len too large"; - return false; - } - memcpy(legacy_request->key_info.body.passphrase_info.passphrase, - hidl_request.securityConfig.passphrase.data(), - legacy_request->key_info.body.passphrase_info.passphrase_len); - } - legacy_request->service_name_len = hidl_request.serviceNameOutOfBand.size(); - if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: " - "service_name_len too large"; - return false; - } - memcpy(legacy_request->service_name, hidl_request.serviceNameOutOfBand.data(), - legacy_request->service_name_len); - legacy_request->scid_len = hidl_request.securityConfig.scid.size(); - if (legacy_request->scid_len > NAN_MAX_SCID_BUF_LEN) { - LOG(ERROR) << "convertHidlNanDataPathIndicationResponse_1_6ToLegacy: scid_len too large"; - return false; - } - memcpy(legacy_request->scid, hidl_request.securityConfig.scid.data(), legacy_request->scid_len); - - return true; -} - -bool convertLegacyNanResponseHeaderToHidl(const legacy_hal::NanResponseMsg& legacy_response, - WifiNanStatus* wifiNanStatus) { - if (!wifiNanStatus) { - LOG(ERROR) << "convertLegacyNanResponseHeaderToHidl: wifiNanStatus is null"; - return false; - } - *wifiNanStatus = {}; - - convertToWifiNanStatus(legacy_response.status, legacy_response.nan_error, - sizeof(legacy_response.nan_error), wifiNanStatus); - return true; -} - -bool convertLegacyNanCapabilitiesResponseToHidl(const legacy_hal::NanCapabilities& legacy_response, - V1_6::NanCapabilities* hidl_response) { - if (!hidl_response) { - LOG(ERROR) << "convertLegacyNanCapabilitiesResponseToHidl: " - "hidl_response is null"; - return false; - } - *hidl_response = {}; - - hidl_response->maxConcurrentClusters = legacy_response.max_concurrent_nan_clusters; - hidl_response->maxPublishes = legacy_response.max_publishes; - hidl_response->maxSubscribes = legacy_response.max_subscribes; - hidl_response->maxServiceNameLen = legacy_response.max_service_name_len; - hidl_response->maxMatchFilterLen = legacy_response.max_match_filter_len; - hidl_response->maxTotalMatchFilterLen = legacy_response.max_total_match_filter_len; - hidl_response->maxServiceSpecificInfoLen = legacy_response.max_service_specific_info_len; - hidl_response->maxExtendedServiceSpecificInfoLen = - legacy_response.max_sdea_service_specific_info_len; - hidl_response->maxNdiInterfaces = legacy_response.max_ndi_interfaces; - hidl_response->maxNdpSessions = legacy_response.max_ndp_sessions; - hidl_response->maxAppInfoLen = legacy_response.max_app_info_len; - hidl_response->maxQueuedTransmitFollowupMsgs = - legacy_response.max_queued_transmit_followup_msgs; - hidl_response->maxSubscribeInterfaceAddresses = legacy_response.max_subscribe_address; - hidl_response->supportedCipherSuites = legacy_response.cipher_suites_supported; - hidl_response->instantCommunicationModeSupportFlag = legacy_response.is_instant_mode_supported; - - return true; -} - -bool convertLegacyNanMatchIndToHidl(const legacy_hal::NanMatchInd& legacy_ind, - V1_6::NanMatchInd* hidl_ind) { - if (!hidl_ind) { - LOG(ERROR) << "convertLegacyNanMatchIndToHidl: hidl_ind is null"; - return false; - } - *hidl_ind = {}; - - hidl_ind->discoverySessionId = legacy_ind.publish_subscribe_id; - hidl_ind->peerId = legacy_ind.requestor_instance_id; - hidl_ind->addr = hidl_array(legacy_ind.addr); - hidl_ind->serviceSpecificInfo = std::vector( - legacy_ind.service_specific_info, - legacy_ind.service_specific_info + legacy_ind.service_specific_info_len); - hidl_ind->extendedServiceSpecificInfo = std::vector( - legacy_ind.sdea_service_specific_info, - legacy_ind.sdea_service_specific_info + legacy_ind.sdea_service_specific_info_len); - hidl_ind->matchFilter = - std::vector(legacy_ind.sdf_match_filter, - legacy_ind.sdf_match_filter + legacy_ind.sdf_match_filter_len); - hidl_ind->matchOccuredInBeaconFlag = legacy_ind.match_occured_flag == 1; - hidl_ind->outOfResourceFlag = legacy_ind.out_of_resource_flag == 1; - hidl_ind->rssiValue = legacy_ind.rssi_value; - hidl_ind->peerCipherType = (V1_6::NanCipherSuiteType)legacy_ind.peer_cipher_type; - hidl_ind->peerRequiresSecurityEnabledInNdp = - legacy_ind.peer_sdea_params.security_cfg == legacy_hal::NAN_DP_CONFIG_SECURITY; - hidl_ind->peerRequiresRanging = - legacy_ind.peer_sdea_params.ranging_state == legacy_hal::NAN_RANGING_ENABLE; - hidl_ind->rangingMeasurementInMm = legacy_ind.range_info.range_measurement_mm; - hidl_ind->rangingIndicationType = legacy_ind.range_info.ranging_event_type; - hidl_ind->scid = std::vector(legacy_ind.scid, legacy_ind.scid + legacy_ind.scid_len); - return true; -} - -bool convertLegacyNanFollowupIndToHidl(const legacy_hal::NanFollowupInd& legacy_ind, - NanFollowupReceivedInd* hidl_ind) { - if (!hidl_ind) { - LOG(ERROR) << "convertLegacyNanFollowupIndToHidl: hidl_ind is null"; - return false; - } - *hidl_ind = {}; - - hidl_ind->discoverySessionId = legacy_ind.publish_subscribe_id; - hidl_ind->peerId = legacy_ind.requestor_instance_id; - hidl_ind->addr = hidl_array(legacy_ind.addr); - hidl_ind->receivedInFaw = legacy_ind.dw_or_faw == 1; - hidl_ind->serviceSpecificInfo = std::vector( - legacy_ind.service_specific_info, - legacy_ind.service_specific_info + legacy_ind.service_specific_info_len); - hidl_ind->extendedServiceSpecificInfo = std::vector( - legacy_ind.sdea_service_specific_info, - legacy_ind.sdea_service_specific_info + legacy_ind.sdea_service_specific_info_len); - - return true; -} - -bool convertLegacyNanDataPathRequestIndToHidl(const legacy_hal::NanDataPathRequestInd& legacy_ind, - NanDataPathRequestInd* hidl_ind) { - if (!hidl_ind) { - LOG(ERROR) << "convertLegacyNanDataPathRequestIndToHidl: hidl_ind is null"; - return false; - } - *hidl_ind = {}; - - hidl_ind->discoverySessionId = legacy_ind.service_instance_id; - hidl_ind->peerDiscMacAddr = hidl_array(legacy_ind.peer_disc_mac_addr); - hidl_ind->ndpInstanceId = legacy_ind.ndp_instance_id; - hidl_ind->securityRequired = - legacy_ind.ndp_cfg.security_cfg == legacy_hal::NAN_DP_CONFIG_SECURITY; - hidl_ind->appInfo = std::vector( - legacy_ind.app_info.ndp_app_info, - legacy_ind.app_info.ndp_app_info + legacy_ind.app_info.ndp_app_info_len); - - return true; -} - -bool convertLegacyNdpChannelInfoToHidl(const legacy_hal::NanChannelInfo& legacy_struct, - V1_6::NanDataPathChannelInfo* hidl_struct) { - if (!hidl_struct) { - LOG(ERROR) << "convertLegacyNdpChannelInfoToHidl: hidl_struct is null"; - return false; - } - *hidl_struct = {}; - - hidl_struct->channelFreq = legacy_struct.channel; - hidl_struct->channelBandwidth = convertLegacyWifiChannelWidthToHidl( - (legacy_hal::wifi_channel_width)legacy_struct.bandwidth); - hidl_struct->numSpatialStreams = legacy_struct.nss; - - return true; -} - -bool convertLegacyNanDataPathConfirmIndToHidl(const legacy_hal::NanDataPathConfirmInd& legacy_ind, - V1_6::NanDataPathConfirmInd* hidl_ind) { - if (!hidl_ind) { - LOG(ERROR) << "convertLegacyNanDataPathConfirmIndToHidl: hidl_ind is null"; - return false; - } - *hidl_ind = {}; - - hidl_ind->V1_0.ndpInstanceId = legacy_ind.ndp_instance_id; - hidl_ind->V1_0.dataPathSetupSuccess = legacy_ind.rsp_code == legacy_hal::NAN_DP_REQUEST_ACCEPT; - hidl_ind->V1_0.peerNdiMacAddr = hidl_array(legacy_ind.peer_ndi_mac_addr); - hidl_ind->V1_0.appInfo = std::vector( - legacy_ind.app_info.ndp_app_info, - legacy_ind.app_info.ndp_app_info + legacy_ind.app_info.ndp_app_info_len); - hidl_ind->V1_0.status.status = convertLegacyNanStatusTypeToHidl(legacy_ind.reason_code); - hidl_ind->V1_0.status.description = ""; // TODO: b/34059183 - - std::vector channelInfo; - for (unsigned int i = 0; i < legacy_ind.num_channels; ++i) { - V1_6::NanDataPathChannelInfo hidl_struct; - if (!convertLegacyNdpChannelInfoToHidl(legacy_ind.channel_info[i], &hidl_struct)) { - return false; - } - channelInfo.push_back(hidl_struct); - } - hidl_ind->channelInfo = channelInfo; - - return true; -} - -bool convertLegacyNanDataPathScheduleUpdateIndToHidl( - const legacy_hal::NanDataPathScheduleUpdateInd& legacy_ind, - V1_6::NanDataPathScheduleUpdateInd* hidl_ind) { - if (!hidl_ind) { - LOG(ERROR) << "convertLegacyNanDataPathScheduleUpdateIndToHidl: " - "hidl_ind is null"; - return false; - } - *hidl_ind = {}; - - hidl_ind->peerDiscoveryAddress = hidl_array(legacy_ind.peer_mac_addr); - std::vector channelInfo; - for (unsigned int i = 0; i < legacy_ind.num_channels; ++i) { - V1_6::NanDataPathChannelInfo hidl_struct; - if (!convertLegacyNdpChannelInfoToHidl(legacy_ind.channel_info[i], &hidl_struct)) { - return false; - } - channelInfo.push_back(hidl_struct); - } - hidl_ind->channelInfo = channelInfo; - std::vector ndpInstanceIds; - for (unsigned int i = 0; i < legacy_ind.num_ndp_instances; ++i) { - ndpInstanceIds.push_back(legacy_ind.ndp_instance_id[i]); - } - hidl_ind->ndpInstanceIds = ndpInstanceIds; - - return true; -} - -legacy_hal::wifi_rtt_type convertHidlRttTypeToLegacy(RttType type) { - switch (type) { - case RttType::ONE_SIDED: - return legacy_hal::RTT_TYPE_1_SIDED; - case RttType::TWO_SIDED: - return legacy_hal::RTT_TYPE_2_SIDED; - }; - CHECK(false); -} - -RttType convertLegacyRttTypeToHidl(legacy_hal::wifi_rtt_type type) { - switch (type) { - case legacy_hal::RTT_TYPE_1_SIDED: - return RttType::ONE_SIDED; - case legacy_hal::RTT_TYPE_2_SIDED: - return RttType::TWO_SIDED; - }; - CHECK(false) << "Unknown legacy type: " << type; -} - -legacy_hal::rtt_peer_type convertHidlRttPeerTypeToLegacy(RttPeerType type) { - switch (type) { - case RttPeerType::AP: - return legacy_hal::RTT_PEER_AP; - case RttPeerType::STA: - return legacy_hal::RTT_PEER_STA; - case RttPeerType::P2P_GO: - return legacy_hal::RTT_PEER_P2P_GO; - case RttPeerType::P2P_CLIENT: - return legacy_hal::RTT_PEER_P2P_CLIENT; - case RttPeerType::NAN: - return legacy_hal::RTT_PEER_NAN; - }; - CHECK(false); -} - -legacy_hal::wifi_channel_width convertHidlWifiChannelWidthToLegacy(WifiChannelWidthInMhz type) { - switch (type) { - case WifiChannelWidthInMhz::WIDTH_20: - return legacy_hal::WIFI_CHAN_WIDTH_20; - case WifiChannelWidthInMhz::WIDTH_40: - return legacy_hal::WIFI_CHAN_WIDTH_40; - case WifiChannelWidthInMhz::WIDTH_80: - return legacy_hal::WIFI_CHAN_WIDTH_80; - case WifiChannelWidthInMhz::WIDTH_160: - return legacy_hal::WIFI_CHAN_WIDTH_160; - case WifiChannelWidthInMhz::WIDTH_80P80: - return legacy_hal::WIFI_CHAN_WIDTH_80P80; - case WifiChannelWidthInMhz::WIDTH_5: - return legacy_hal::WIFI_CHAN_WIDTH_5; - case WifiChannelWidthInMhz::WIDTH_10: - return legacy_hal::WIFI_CHAN_WIDTH_10; - case V1_6::WifiChannelWidthInMhz::WIDTH_320: - return legacy_hal::WIFI_CHAN_WIDTH_320; - case WifiChannelWidthInMhz::WIDTH_INVALID: - return legacy_hal::WIFI_CHAN_WIDTH_INVALID; - }; - CHECK(false); -} - -V1_6::WifiChannelWidthInMhz convertLegacyWifiChannelWidthToHidl( - legacy_hal::wifi_channel_width type) { - switch (type) { - case legacy_hal::WIFI_CHAN_WIDTH_20: - return WifiChannelWidthInMhz::WIDTH_20; - case legacy_hal::WIFI_CHAN_WIDTH_40: - return WifiChannelWidthInMhz::WIDTH_40; - case legacy_hal::WIFI_CHAN_WIDTH_80: - return WifiChannelWidthInMhz::WIDTH_80; - case legacy_hal::WIFI_CHAN_WIDTH_160: - return WifiChannelWidthInMhz::WIDTH_160; - case legacy_hal::WIFI_CHAN_WIDTH_80P80: - return WifiChannelWidthInMhz::WIDTH_80P80; - case legacy_hal::WIFI_CHAN_WIDTH_5: - return WifiChannelWidthInMhz::WIDTH_5; - case legacy_hal::WIFI_CHAN_WIDTH_10: - return WifiChannelWidthInMhz::WIDTH_10; - case legacy_hal::WIFI_CHAN_WIDTH_320: - return V1_6::WifiChannelWidthInMhz::WIDTH_320; - default: - return WifiChannelWidthInMhz::WIDTH_INVALID; - }; -} - -legacy_hal::wifi_rtt_preamble convertHidlRttPreambleToLegacy(V1_6::RttPreamble type) { - switch (type) { - case V1_6::RttPreamble::LEGACY: - return legacy_hal::WIFI_RTT_PREAMBLE_LEGACY; - case V1_6::RttPreamble::HT: - return legacy_hal::WIFI_RTT_PREAMBLE_HT; - case V1_6::RttPreamble::VHT: - return legacy_hal::WIFI_RTT_PREAMBLE_VHT; - case V1_6::RttPreamble::HE: - return legacy_hal::WIFI_RTT_PREAMBLE_HE; - case V1_6::RttPreamble::EHT: - return legacy_hal::WIFI_RTT_PREAMBLE_EHT; - }; - CHECK(false); -} - -V1_6::RttPreamble convertLegacyRttPreambleToHidl(legacy_hal::wifi_rtt_preamble type) { - switch (type) { - case legacy_hal::WIFI_RTT_PREAMBLE_LEGACY: - return V1_6::RttPreamble::LEGACY; - case legacy_hal::WIFI_RTT_PREAMBLE_HT: - return V1_6::RttPreamble::HT; - case legacy_hal::WIFI_RTT_PREAMBLE_VHT: - return V1_6::RttPreamble::VHT; - case legacy_hal::WIFI_RTT_PREAMBLE_HE: - return V1_6::RttPreamble::HE; - case legacy_hal::WIFI_RTT_PREAMBLE_EHT: - return V1_6::RttPreamble::EHT; - }; - CHECK(false) << "Unknown legacy type: " << type; -} - -legacy_hal::wifi_rtt_bw convertHidlRttBwToLegacy(RttBw type) { - switch (type) { - case RttBw::BW_5MHZ: - return legacy_hal::WIFI_RTT_BW_5; - case RttBw::BW_10MHZ: - return legacy_hal::WIFI_RTT_BW_10; - case RttBw::BW_20MHZ: - return legacy_hal::WIFI_RTT_BW_20; - case RttBw::BW_40MHZ: - return legacy_hal::WIFI_RTT_BW_40; - case RttBw::BW_80MHZ: - return legacy_hal::WIFI_RTT_BW_80; - case RttBw::BW_160MHZ: - return legacy_hal::WIFI_RTT_BW_160; - case RttBw::BW_320MHZ: - return legacy_hal::WIFI_RTT_BW_320; - }; - CHECK(false); -} - -RttBw convertLegacyRttBwToHidl(legacy_hal::wifi_rtt_bw type) { - switch (type) { - case legacy_hal::WIFI_RTT_BW_5: - return RttBw::BW_5MHZ; - case legacy_hal::WIFI_RTT_BW_10: - return RttBw::BW_10MHZ; - case legacy_hal::WIFI_RTT_BW_20: - return RttBw::BW_20MHZ; - case legacy_hal::WIFI_RTT_BW_40: - return RttBw::BW_40MHZ; - case legacy_hal::WIFI_RTT_BW_80: - return RttBw::BW_80MHZ; - case legacy_hal::WIFI_RTT_BW_160: - return RttBw::BW_160MHZ; - case legacy_hal::WIFI_RTT_BW_320: - return RttBw::BW_320MHZ; - }; - CHECK(false) << "Unknown legacy type: " << type; -} - -legacy_hal::wifi_motion_pattern convertHidlRttMotionPatternToLegacy(RttMotionPattern type) { - switch (type) { - case RttMotionPattern::NOT_EXPECTED: - return legacy_hal::WIFI_MOTION_NOT_EXPECTED; - case RttMotionPattern::EXPECTED: - return legacy_hal::WIFI_MOTION_EXPECTED; - case RttMotionPattern::UNKNOWN: - return legacy_hal::WIFI_MOTION_UNKNOWN; - }; - CHECK(false); -} - -V1_6::WifiRatePreamble convertLegacyWifiRatePreambleToHidl(uint8_t preamble) { - switch (preamble) { - case 0: - return V1_6::WifiRatePreamble::OFDM; - case 1: - return V1_6::WifiRatePreamble::CCK; - case 2: - return V1_6::WifiRatePreamble::HT; - case 3: - return V1_6::WifiRatePreamble::VHT; - case 4: - return V1_6::WifiRatePreamble::HE; - case 5: - return V1_6::WifiRatePreamble::EHT; - default: - return V1_6::WifiRatePreamble::RESERVED; - }; - CHECK(false) << "Unknown legacy preamble: " << preamble; -} - -WifiRateNss convertLegacyWifiRateNssToHidl(uint8_t nss) { - switch (nss) { - case 0: - return WifiRateNss::NSS_1x1; - case 1: - return WifiRateNss::NSS_2x2; - case 2: - return WifiRateNss::NSS_3x3; - case 3: - return WifiRateNss::NSS_4x4; - }; - CHECK(false) << "Unknown legacy nss: " << nss; - return {}; -} - -RttStatus convertLegacyRttStatusToHidl(legacy_hal::wifi_rtt_status status) { - switch (status) { - case legacy_hal::RTT_STATUS_SUCCESS: - return RttStatus::SUCCESS; - case legacy_hal::RTT_STATUS_FAILURE: - return RttStatus::FAILURE; - case legacy_hal::RTT_STATUS_FAIL_NO_RSP: - return RttStatus::FAIL_NO_RSP; - case legacy_hal::RTT_STATUS_FAIL_REJECTED: - return RttStatus::FAIL_REJECTED; - case legacy_hal::RTT_STATUS_FAIL_NOT_SCHEDULED_YET: - return RttStatus::FAIL_NOT_SCHEDULED_YET; - case legacy_hal::RTT_STATUS_FAIL_TM_TIMEOUT: - return RttStatus::FAIL_TM_TIMEOUT; - case legacy_hal::RTT_STATUS_FAIL_AP_ON_DIFF_CHANNEL: - return RttStatus::FAIL_AP_ON_DIFF_CHANNEL; - case legacy_hal::RTT_STATUS_FAIL_NO_CAPABILITY: - return RttStatus::FAIL_NO_CAPABILITY; - case legacy_hal::RTT_STATUS_ABORTED: - return RttStatus::ABORTED; - case legacy_hal::RTT_STATUS_FAIL_INVALID_TS: - return RttStatus::FAIL_INVALID_TS; - case legacy_hal::RTT_STATUS_FAIL_PROTOCOL: - return RttStatus::FAIL_PROTOCOL; - case legacy_hal::RTT_STATUS_FAIL_SCHEDULE: - return RttStatus::FAIL_SCHEDULE; - case legacy_hal::RTT_STATUS_FAIL_BUSY_TRY_LATER: - return RttStatus::FAIL_BUSY_TRY_LATER; - case legacy_hal::RTT_STATUS_INVALID_REQ: - return RttStatus::INVALID_REQ; - case legacy_hal::RTT_STATUS_NO_WIFI: - return RttStatus::NO_WIFI; - case legacy_hal::RTT_STATUS_FAIL_FTM_PARAM_OVERRIDE: - return RttStatus::FAIL_FTM_PARAM_OVERRIDE; - case legacy_hal::RTT_STATUS_NAN_RANGING_PROTOCOL_FAILURE: - return RttStatus::FAILURE; // TODO: add HIDL enumeration - case legacy_hal::RTT_STATUS_NAN_RANGING_CONCURRENCY_NOT_SUPPORTED: - return RttStatus::FAILURE; // TODO: add HIDL enumeration - }; - CHECK(false) << "Unknown legacy status: " << status; -} - -bool convertHidlWifiChannelInfoToLegacy(const WifiChannelInfo& hidl_info, - legacy_hal::wifi_channel_info* legacy_info) { - if (!legacy_info) { - return false; - } - *legacy_info = {}; - legacy_info->width = convertHidlWifiChannelWidthToLegacy(hidl_info.width); - legacy_info->center_freq = hidl_info.centerFreq; - legacy_info->center_freq0 = hidl_info.centerFreq0; - legacy_info->center_freq1 = hidl_info.centerFreq1; - return true; -} - -bool convertLegacyWifiChannelInfoToHidl(const legacy_hal::wifi_channel_info& legacy_info, - WifiChannelInfo* hidl_info) { - if (!hidl_info) { - return false; - } - *hidl_info = {}; - hidl_info->width = convertLegacyWifiChannelWidthToHidl(legacy_info.width); - hidl_info->centerFreq = legacy_info.center_freq; - hidl_info->centerFreq0 = legacy_info.center_freq0; - hidl_info->centerFreq1 = legacy_info.center_freq1; - return true; -} - -bool convertHidlRttConfigToLegacy(const V1_6::RttConfig& hidl_config, - legacy_hal::wifi_rtt_config* legacy_config) { - if (!legacy_config) { - return false; - } - *legacy_config = {}; - CHECK(hidl_config.addr.size() == sizeof(legacy_config->addr)); - memcpy(legacy_config->addr, hidl_config.addr.data(), hidl_config.addr.size()); - legacy_config->type = convertHidlRttTypeToLegacy(hidl_config.type); - legacy_config->peer = convertHidlRttPeerTypeToLegacy(hidl_config.peer); - if (!convertHidlWifiChannelInfoToLegacy(hidl_config.channel, &legacy_config->channel)) { - return false; - } - legacy_config->burst_period = hidl_config.burstPeriod; - legacy_config->num_burst = hidl_config.numBurst; - legacy_config->num_frames_per_burst = hidl_config.numFramesPerBurst; - legacy_config->num_retries_per_rtt_frame = hidl_config.numRetriesPerRttFrame; - legacy_config->num_retries_per_ftmr = hidl_config.numRetriesPerFtmr; - legacy_config->LCI_request = hidl_config.mustRequestLci; - legacy_config->LCR_request = hidl_config.mustRequestLcr; - legacy_config->burst_duration = hidl_config.burstDuration; - legacy_config->preamble = convertHidlRttPreambleToLegacy(hidl_config.preamble); - legacy_config->bw = convertHidlRttBwToLegacy(hidl_config.bw); - return true; -} - -bool convertHidlVectorOfRttConfigToLegacy( - const std::vector& hidl_configs, - std::vector* legacy_configs) { - if (!legacy_configs) { - return false; - } - *legacy_configs = {}; - for (const auto& hidl_config : hidl_configs) { - legacy_hal::wifi_rtt_config legacy_config; - if (!convertHidlRttConfigToLegacy(hidl_config, &legacy_config)) { - return false; - } - legacy_configs->push_back(legacy_config); - } - return true; -} - -bool convertHidlRttLciInformationToLegacy(const RttLciInformation& hidl_info, - legacy_hal::wifi_lci_information* legacy_info) { - if (!legacy_info) { - return false; - } - *legacy_info = {}; - legacy_info->latitude = hidl_info.latitude; - legacy_info->longitude = hidl_info.longitude; - legacy_info->altitude = hidl_info.altitude; - legacy_info->latitude_unc = hidl_info.latitudeUnc; - legacy_info->longitude_unc = hidl_info.longitudeUnc; - legacy_info->altitude_unc = hidl_info.altitudeUnc; - legacy_info->motion_pattern = convertHidlRttMotionPatternToLegacy(hidl_info.motionPattern); - legacy_info->floor = hidl_info.floor; - legacy_info->height_above_floor = hidl_info.heightAboveFloor; - legacy_info->height_unc = hidl_info.heightUnc; - return true; -} - -bool convertHidlRttLcrInformationToLegacy(const RttLcrInformation& hidl_info, - legacy_hal::wifi_lcr_information* legacy_info) { - if (!legacy_info) { - return false; - } - *legacy_info = {}; - CHECK(hidl_info.countryCode.size() == sizeof(legacy_info->country_code)); - memcpy(legacy_info->country_code, hidl_info.countryCode.data(), hidl_info.countryCode.size()); - if (hidl_info.civicInfo.size() > sizeof(legacy_info->civic_info)) { - return false; - } - legacy_info->length = hidl_info.civicInfo.size(); - memcpy(legacy_info->civic_info, hidl_info.civicInfo.c_str(), hidl_info.civicInfo.size()); - return true; -} - -bool convertHidlRttResponderToLegacy(const V1_6::RttResponder& hidl_responder, - legacy_hal::wifi_rtt_responder* legacy_responder) { - if (!legacy_responder) { - return false; - } - *legacy_responder = {}; - if (!convertHidlWifiChannelInfoToLegacy(hidl_responder.channel, &legacy_responder->channel)) { - return false; - } - legacy_responder->preamble = convertHidlRttPreambleToLegacy(hidl_responder.preamble); - return true; -} - -bool convertLegacyRttResponderToHidl(const legacy_hal::wifi_rtt_responder& legacy_responder, - V1_6::RttResponder* hidl_responder) { - if (!hidl_responder) { - return false; - } - *hidl_responder = {}; - if (!convertLegacyWifiChannelInfoToHidl(legacy_responder.channel, &hidl_responder->channel)) { - return false; - } - hidl_responder->preamble = convertLegacyRttPreambleToHidl(legacy_responder.preamble); - return true; -} - -bool convertLegacyRttCapabilitiesToHidl( - const legacy_hal::wifi_rtt_capabilities& legacy_capabilities, - V1_6::RttCapabilities* hidl_capabilities) { - if (!hidl_capabilities) { - return false; - } - *hidl_capabilities = {}; - hidl_capabilities->rttOneSidedSupported = legacy_capabilities.rtt_one_sided_supported; - hidl_capabilities->rttFtmSupported = legacy_capabilities.rtt_ftm_supported; - hidl_capabilities->lciSupported = legacy_capabilities.lci_support; - hidl_capabilities->lcrSupported = legacy_capabilities.lcr_support; - hidl_capabilities->responderSupported = legacy_capabilities.responder_supported; - hidl_capabilities->preambleSupport = 0; - for (const auto flag : {legacy_hal::WIFI_RTT_PREAMBLE_LEGACY, legacy_hal::WIFI_RTT_PREAMBLE_HT, - legacy_hal::WIFI_RTT_PREAMBLE_VHT, legacy_hal::WIFI_RTT_PREAMBLE_HE, - legacy_hal::WIFI_RTT_PREAMBLE_EHT}) { - if (legacy_capabilities.preamble_support & flag) { - hidl_capabilities->preambleSupport |= - static_cast::type>( - convertLegacyRttPreambleToHidl(flag)); - } - } - hidl_capabilities->bwSupport = 0; - for (const auto flag : - {legacy_hal::WIFI_RTT_BW_5, legacy_hal::WIFI_RTT_BW_10, legacy_hal::WIFI_RTT_BW_20, - legacy_hal::WIFI_RTT_BW_40, legacy_hal::WIFI_RTT_BW_80, legacy_hal::WIFI_RTT_BW_160, - legacy_hal::WIFI_RTT_BW_320}) { - if (legacy_capabilities.bw_support & flag) { - hidl_capabilities->bwSupport |= - static_cast::type>(convertLegacyRttBwToHidl(flag)); - } - } - hidl_capabilities->mcVersion = legacy_capabilities.mc_version; - return true; -} - -bool convertLegacyWifiRateInfoToHidl(const legacy_hal::wifi_rate& legacy_rate, - V1_6::WifiRateInfo* hidl_rate) { - if (!hidl_rate) { - return false; - } - *hidl_rate = {}; - hidl_rate->preamble = convertLegacyWifiRatePreambleToHidl(legacy_rate.preamble); - hidl_rate->nss = convertLegacyWifiRateNssToHidl(legacy_rate.nss); - hidl_rate->bw = convertLegacyWifiChannelWidthToHidl( - static_cast(legacy_rate.bw)); - hidl_rate->rateMcsIdx = legacy_rate.rateMcsIdx; - hidl_rate->bitRateInKbps = legacy_rate.bitrate; - return true; -} - -bool convertLegacyRttResultToHidl(const legacy_hal::wifi_rtt_result& legacy_result, - V1_6::RttResult* hidl_result) { - if (!hidl_result) { - return false; - } - *hidl_result = {}; - CHECK(sizeof(legacy_result.addr) == hidl_result->addr.size()); - memcpy(hidl_result->addr.data(), legacy_result.addr, sizeof(legacy_result.addr)); - hidl_result->burstNum = legacy_result.burst_num; - hidl_result->measurementNumber = legacy_result.measurement_number; - hidl_result->successNumber = legacy_result.success_number; - hidl_result->numberPerBurstPeer = legacy_result.number_per_burst_peer; - hidl_result->status = convertLegacyRttStatusToHidl(legacy_result.status); - hidl_result->retryAfterDuration = legacy_result.retry_after_duration; - hidl_result->type = convertLegacyRttTypeToHidl(legacy_result.type); - hidl_result->rssi = legacy_result.rssi; - hidl_result->rssiSpread = legacy_result.rssi_spread; - if (!convertLegacyWifiRateInfoToHidl(legacy_result.tx_rate, &hidl_result->txRate)) { - return false; - } - if (!convertLegacyWifiRateInfoToHidl(legacy_result.rx_rate, &hidl_result->rxRate)) { - return false; - } - hidl_result->rtt = legacy_result.rtt; - hidl_result->rttSd = legacy_result.rtt_sd; - hidl_result->rttSpread = legacy_result.rtt_spread; - hidl_result->distanceInMm = legacy_result.distance_mm; - hidl_result->distanceSdInMm = legacy_result.distance_sd_mm; - hidl_result->distanceSpreadInMm = legacy_result.distance_spread_mm; - hidl_result->timeStampInUs = legacy_result.ts; - hidl_result->burstDurationInMs = legacy_result.burst_duration; - hidl_result->negotiatedBurstNum = legacy_result.negotiated_burst_num; - if (legacy_result.LCI && !convertLegacyIeToHidl(*legacy_result.LCI, &hidl_result->lci)) { - return false; - } - if (legacy_result.LCR && !convertLegacyIeToHidl(*legacy_result.LCR, &hidl_result->lcr)) { - return false; - } - return true; -} - -bool convertLegacyVectorOfRttResultToHidl( - const std::vector& legacy_results, - std::vector* hidl_results) { - if (!hidl_results) { - return false; - } - *hidl_results = {}; - for (const auto legacy_result : legacy_results) { - V1_6::RttResult hidl_result; - if (!convertLegacyRttResultToHidl(*legacy_result, &hidl_result)) { - return false; - } - hidl_results->push_back(hidl_result); - } - return true; -} - -legacy_hal::wifi_interface_type convertHidlIfaceTypeToLegacy(IfaceType hidl_interface_type) { - switch (hidl_interface_type) { - case IfaceType::STA: - return legacy_hal::WIFI_INTERFACE_TYPE_STA; - case IfaceType::AP: - return legacy_hal::WIFI_INTERFACE_TYPE_AP; - case IfaceType::P2P: - return legacy_hal::WIFI_INTERFACE_TYPE_P2P; - case IfaceType::NAN: - return legacy_hal::WIFI_INTERFACE_TYPE_NAN; - } - CHECK(false); -} - -legacy_hal::wifi_multi_sta_use_case convertHidlMultiStaUseCaseToLegacy( - V1_5::IWifiChip::MultiStaUseCase use_case) { - switch (use_case) { - case V1_5::IWifiChip::MultiStaUseCase::DUAL_STA_TRANSIENT_PREFER_PRIMARY: - return legacy_hal::WIFI_DUAL_STA_TRANSIENT_PREFER_PRIMARY; - case V1_5::IWifiChip::MultiStaUseCase::DUAL_STA_NON_TRANSIENT_UNBIASED: - return legacy_hal::WIFI_DUAL_STA_NON_TRANSIENT_UNBIASED; - } - CHECK(false); -} - -bool convertHidlCoexUnsafeChannelToLegacy( - const V1_5::IWifiChip::CoexUnsafeChannel& hidl_unsafe_channel, - legacy_hal::wifi_coex_unsafe_channel* legacy_unsafe_channel) { - if (!legacy_unsafe_channel) { - return false; - } - *legacy_unsafe_channel = {}; - switch (hidl_unsafe_channel.band) { - case V1_5::WifiBand::BAND_24GHZ: - legacy_unsafe_channel->band = legacy_hal::WLAN_MAC_2_4_BAND; - break; - case V1_5::WifiBand::BAND_5GHZ: - legacy_unsafe_channel->band = legacy_hal::WLAN_MAC_5_0_BAND; - break; - default: - return false; - }; - legacy_unsafe_channel->channel = hidl_unsafe_channel.channel; - legacy_unsafe_channel->power_cap_dbm = hidl_unsafe_channel.powerCapDbm; - return true; -} - -bool convertHidlVectorOfCoexUnsafeChannelToLegacy( - const std::vector& hidl_unsafe_channels, - std::vector* legacy_unsafe_channels) { - if (!legacy_unsafe_channels) { - return false; - } - *legacy_unsafe_channels = {}; - for (const auto& hidl_unsafe_channel : hidl_unsafe_channels) { - legacy_hal::wifi_coex_unsafe_channel legacy_unsafe_channel; - if (!hidl_struct_util::convertHidlCoexUnsafeChannelToLegacy(hidl_unsafe_channel, - &legacy_unsafe_channel)) { - return false; - } - legacy_unsafe_channels->push_back(legacy_unsafe_channel); - } - return true; -} - -V1_6::WifiAntennaMode convertLegacyAntennaConfigurationToHidl(uint32_t antenna_cfg) { - switch (antenna_cfg) { - case legacy_hal::WIFI_ANTENNA_1X1: - return V1_6::WifiAntennaMode::WIFI_ANTENNA_MODE_1X1; - case legacy_hal::WIFI_ANTENNA_2X2: - return V1_6::WifiAntennaMode::WIFI_ANTENNA_MODE_2X2; - case legacy_hal::WIFI_ANTENNA_3X3: - return V1_6::WifiAntennaMode::WIFI_ANTENNA_MODE_3X3; - case legacy_hal::WIFI_ANTENNA_4X4: - return V1_6::WifiAntennaMode::WIFI_ANTENNA_MODE_4X4; - default: - return V1_6::WifiAntennaMode::WIFI_ANTENNA_MODE_UNSPECIFIED; - } -} - -bool convertLegacyWifiRadioConfigurationToHidl( - legacy_hal::wifi_radio_configuration* radio_configuration, - V1_6::WifiRadioConfiguration* hidl_radio_configuration) { - if (!hidl_radio_configuration) { - return false; - } - *hidl_radio_configuration = {}; - hidl_radio_configuration->bandInfo = - hidl_struct_util::convertLegacyMacBandToHidlWifiBand(radio_configuration->band); - if (hidl_radio_configuration->bandInfo == V1_5::WifiBand::BAND_UNSPECIFIED) { - LOG(ERROR) << "Unspecified band"; - return false; - } - hidl_radio_configuration->antennaMode = - hidl_struct_util::convertLegacyAntennaConfigurationToHidl( - radio_configuration->antenna_cfg); - return true; -} - -bool convertLegacyRadioCombinationsMatrixToHidl( - legacy_hal::wifi_radio_combination_matrix* legacy_matrix, - WifiRadioCombinationMatrix* hidl_matrix) { - if (!hidl_matrix || !legacy_matrix) { - return false; - } - *hidl_matrix = {}; - - int num_combinations = legacy_matrix->num_radio_combinations; - std::vector radio_combinations_vec; - if (!num_combinations) { - LOG(ERROR) << "zero radio combinations"; - return false; - } - wifi_radio_combination* l_radio_combinations_ptr = legacy_matrix->radio_combinations; - for (int i = 0; i < num_combinations; i++) { - int num_configurations = l_radio_combinations_ptr->num_radio_configurations; - WifiRadioCombination radioCombination; - std::vector radio_configurations_vec; - if (!num_configurations) { - LOG(ERROR) << "zero radio configurations"; - return false; - } - for (int j = 0; j < num_configurations; j++) { - WifiRadioConfiguration radioConfiguration; - wifi_radio_configuration* l_radio_configurations_ptr = - &l_radio_combinations_ptr->radio_configurations[j]; - if (!hidl_struct_util::convertLegacyWifiRadioConfigurationToHidl( - l_radio_configurations_ptr, &radioConfiguration)) { - LOG(ERROR) << "Error converting wifi radio configuration"; - return false; - } - radio_configurations_vec.push_back(radioConfiguration); - } - radioCombination.radioConfigurations = radio_configurations_vec; - radio_combinations_vec.push_back(radioCombination); - l_radio_combinations_ptr = - (wifi_radio_combination*)((u8*)l_radio_combinations_ptr + - sizeof(wifi_radio_combination) + - (sizeof(wifi_radio_configuration) * num_configurations)); - } - hidl_matrix->radioCombinations = radio_combinations_vec; - return true; -} - -} // namespace hidl_struct_util -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/hidl_struct_util.h b/wifi/1.6/default/hidl_struct_util.h deleted file mode 100644 index 2d4a5f13f4..0000000000 --- a/wifi/1.6/default/hidl_struct_util.h +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef HIDL_STRUCT_UTIL_H_ -#define HIDL_STRUCT_UTIL_H_ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "wifi_legacy_hal.h" - -/** - * This file contains a bunch of functions to convert structs from the legacy - * HAL to HIDL and vice versa. - * TODO(b/32093047): Add unit tests for these conversion methods in the VTS test - * suite. - */ -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace hidl_struct_util { -using namespace android::hardware::wifi::V1_0; - -// Chip conversion methods. -bool convertLegacyFeaturesToHidlChipCapabilities(uint64_t legacy_feature_set, - uint32_t legacy_logger_feature_set, - uint32_t* hidl_caps); -bool convertLegacyDebugRingBufferStatusToHidl( - const legacy_hal::wifi_ring_buffer_status& legacy_status, - WifiDebugRingBufferStatus* hidl_status); -bool convertLegacyVectorOfDebugRingBufferStatusToHidl( - const std::vector& legacy_status_vec, - std::vector* hidl_status_vec); -bool convertLegacyWakeReasonStatsToHidl(const legacy_hal::WakeReasonStats& legacy_stats, - WifiDebugHostWakeReasonStats* hidl_stats); -legacy_hal::wifi_power_scenario convertHidlTxPowerScenarioToLegacy( - V1_1::IWifiChip::TxPowerScenario hidl_scenario); -legacy_hal::wifi_latency_mode convertHidlLatencyModeToLegacy( - V1_3::IWifiChip::LatencyMode hidl_latency_mode); -legacy_hal::wifi_power_scenario convertHidlTxPowerScenarioToLegacy_1_2( - V1_2::IWifiChip::TxPowerScenario hidl_scenario); -bool convertLegacyWifiMacInfosToHidl( - const std::vector& legacy_mac_infos, - std::vector* hidl_radio_mode_infos); -legacy_hal::wifi_interface_type convertHidlIfaceTypeToLegacy(IfaceType hidl_interface_type); -legacy_hal::wifi_multi_sta_use_case convertHidlMultiStaUseCaseToLegacy( - V1_5::IWifiChip::MultiStaUseCase use_case); -bool convertHidlCoexUnsafeChannelToLegacy( - const V1_5::IWifiChip::CoexUnsafeChannel& hidl_unsafe_channel, - legacy_hal::wifi_coex_unsafe_channel* legacy_unsafe_channel); -bool convertHidlVectorOfCoexUnsafeChannelToLegacy( - const std::vector& hidl_unsafe_channels, - std::vector* legacy_unsafe_channels); -bool convertLegacyRadioCombinationsMatrixToHidl( - legacy_hal::wifi_radio_combination_matrix* legacy_matrix, - V1_6::WifiRadioCombinationMatrix* hidl_matrix); -V1_5::WifiBand convertLegacyMacBandToHidlWifiBand(uint32_t band); -V1_6::WifiAntennaMode convertLegacyAntennaConfigurationToHidl(uint32_t antenna_cfg); - -// STA iface conversion methods. -bool convertLegacyFeaturesToHidlStaCapabilities(uint64_t legacy_feature_set, - uint32_t legacy_logger_feature_set, - uint32_t* hidl_caps); -bool convertLegacyApfCapabilitiesToHidl(const legacy_hal::PacketFilterCapabilities& legacy_caps, - StaApfPacketFilterCapabilities* hidl_caps); -bool convertLegacyGscanCapabilitiesToHidl(const legacy_hal::wifi_gscan_capabilities& legacy_caps, - StaBackgroundScanCapabilities* hidl_caps); -legacy_hal::wifi_band convertHidlWifiBandToLegacy(V1_0::WifiBand band); -bool convertHidlGscanParamsToLegacy(const StaBackgroundScanParameters& hidl_scan_params, - legacy_hal::wifi_scan_cmd_params* legacy_scan_params); -// |has_ie_data| indicates whether or not the wifi_scan_result includes 802.11 -// Information Elements (IEs) -bool convertLegacyGscanResultToHidl(const legacy_hal::wifi_scan_result& legacy_scan_result, - bool has_ie_data, StaScanResult* hidl_scan_result); -// |cached_results| is assumed to not include IEs. -bool convertLegacyVectorOfCachedGscanResultsToHidl( - const std::vector& legacy_cached_scan_results, - std::vector* hidl_scan_datas); -bool convertLegacyLinkLayerStatsToHidl(const legacy_hal::LinkLayerStats& legacy_stats, - V1_6::StaLinkLayerStats* hidl_stats); -bool convertLegacyRoamingCapabilitiesToHidl( - const legacy_hal::wifi_roaming_capabilities& legacy_caps, - StaRoamingCapabilities* hidl_caps); -bool convertHidlRoamingConfigToLegacy(const StaRoamingConfig& hidl_config, - legacy_hal::wifi_roaming_config* legacy_config); -legacy_hal::fw_roaming_state_t convertHidlRoamingStateToLegacy(StaRoamingState state); -bool convertLegacyVectorOfDebugTxPacketFateToHidl( - const std::vector& legacy_fates, - std::vector* hidl_fates); -bool convertLegacyVectorOfDebugRxPacketFateToHidl( - const std::vector& legacy_fates, - std::vector* hidl_fates); - -// NAN iface conversion methods. -void convertToWifiNanStatus(legacy_hal::NanStatusType type, const char* str, size_t max_len, - WifiNanStatus* wifiNanStatus); -bool convertHidlNanEnableRequestToLegacy(const V1_4::NanEnableRequest& hidl_request, - legacy_hal::NanEnableRequest* legacy_request); -bool convertHidlNanConfigRequestToLegacy(const V1_4::NanConfigRequest& hidl_request, - legacy_hal::NanConfigRequest* legacy_request); -bool convertHidlNanEnableRequest_1_6ToLegacy( - const V1_4::NanEnableRequest& hidl_request1, - const V1_6::NanConfigRequestSupplemental& hidl_request2, - legacy_hal::NanEnableRequest* legacy_request); -bool convertHidlNanConfigRequest_1_6ToLegacy( - const V1_4::NanConfigRequest& hidl_request1, - const V1_6::NanConfigRequestSupplemental& hidl_request2, - legacy_hal::NanConfigRequest* legacy_request); -bool convertHidlNanPublishRequestToLegacy(const V1_6::NanPublishRequest& hidl_request, - legacy_hal::NanPublishRequest* legacy_request); -bool convertHidlNanSubscribeRequestToLegacy(const V1_0::NanSubscribeRequest& hidl_request, - legacy_hal::NanSubscribeRequest* legacy_request); -bool convertHidlNanTransmitFollowupRequestToLegacy( - const NanTransmitFollowupRequest& hidl_request, - legacy_hal::NanTransmitFollowupRequest* legacy_request); -bool convertHidlNanDataPathInitiatorRequestToLegacy( - const V1_0::NanInitiateDataPathRequest& hidl_request, - legacy_hal::NanDataPathInitiatorRequest* legacy_request); -bool convertHidlNanDataPathIndicationResponseToLegacy( - const V1_0::NanRespondToDataPathIndicationRequest& hidl_response, - legacy_hal::NanDataPathIndicationResponse* legacy_response); -bool convertHidlNanDataPathInitiatorRequest_1_6ToLegacy( - const V1_6::NanInitiateDataPathRequest& hidl_request, - legacy_hal::NanDataPathInitiatorRequest* legacy_request); -bool convertHidlNanDataPathIndicationResponse_1_6ToLegacy( - const V1_6::NanRespondToDataPathIndicationRequest& hidl_response, - legacy_hal::NanDataPathIndicationResponse* legacy_response); - -bool convertLegacyNanResponseHeaderToHidl(const legacy_hal::NanResponseMsg& legacy_response, - WifiNanStatus* wifiNanStatus); -bool convertLegacyNanCapabilitiesResponseToHidl(const legacy_hal::NanCapabilities& legacy_response, - V1_6::NanCapabilities* hidl_response); -bool convertLegacyNanMatchIndToHidl(const legacy_hal::NanMatchInd& legacy_ind, - V1_6::NanMatchInd* hidl_ind); -bool convertLegacyNanFollowupIndToHidl(const legacy_hal::NanFollowupInd& legacy_ind, - NanFollowupReceivedInd* hidl_ind); -bool convertLegacyNanDataPathRequestIndToHidl(const legacy_hal::NanDataPathRequestInd& legacy_ind, - NanDataPathRequestInd* hidl_ind); -bool convertLegacyNanDataPathConfirmIndToHidl(const legacy_hal::NanDataPathConfirmInd& legacy_ind, - V1_6::NanDataPathConfirmInd* hidl_ind); -bool convertLegacyNanDataPathScheduleUpdateIndToHidl( - const legacy_hal::NanDataPathScheduleUpdateInd& legacy_ind, - V1_6::NanDataPathScheduleUpdateInd* hidl_ind); - -// RTT controller conversion methods. -bool convertHidlVectorOfRttConfigToLegacy(const std::vector& hidl_configs, - std::vector* legacy_configs); -bool convertHidlRttLciInformationToLegacy(const RttLciInformation& hidl_info, - legacy_hal::wifi_lci_information* legacy_info); -bool convertHidlRttLcrInformationToLegacy(const RttLcrInformation& hidl_info, - legacy_hal::wifi_lcr_information* legacy_info); -bool convertHidlRttResponderToLegacy(const V1_6::RttResponder& hidl_responder, - legacy_hal::wifi_rtt_responder* legacy_responder); -bool convertHidlWifiChannelInfoToLegacy(const V1_6::WifiChannelInfo& hidl_info, - legacy_hal::wifi_channel_info* legacy_info); -bool convertLegacyRttResponderToHidl(const legacy_hal::wifi_rtt_responder& legacy_responder, - V1_6::RttResponder* hidl_responder); -bool convertLegacyRttCapabilitiesToHidl( - const legacy_hal::wifi_rtt_capabilities& legacy_capabilities, - V1_6::RttCapabilities* hidl_capabilities); -bool convertLegacyVectorOfRttResultToHidl( - const std::vector& legacy_results, - std::vector* hidl_results); -uint32_t convertHidlWifiBandToLegacyMacBand(V1_5::WifiBand band); -uint32_t convertHidlWifiIfaceModeToLegacy(uint32_t hidl_iface_mask); -uint32_t convertHidlUsableChannelFilterToLegacy(uint32_t hidl_filter_mask); -bool convertLegacyWifiUsableChannelsToHidl( - const std::vector& legacy_usable_channels, - std::vector* hidl_usable_channels); -bool convertLegacyPeerInfoStatsToHidl(const legacy_hal::WifiPeerInfo& legacy_peer_info_stats, - V1_6::StaPeerInfo* hidl_peer_info_stats); -bool convertLegacyWifiRateInfoToHidl(const legacy_hal::wifi_rate& legacy_rate, - V1_6::WifiRateInfo* hidl_rate); -} // namespace hidl_struct_util -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // HIDL_STRUCT_UTIL_H_ diff --git a/wifi/1.6/default/hidl_sync_util.cpp b/wifi/1.6/default/hidl_sync_util.cpp deleted file mode 100644 index 358d95e668..0000000000 --- a/wifi/1.6/default/hidl_sync_util.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#include "hidl_sync_util.h" - -namespace { -std::recursive_mutex g_mutex; -} // namespace - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace hidl_sync_util { - -std::unique_lock acquireGlobalLock() { - return std::unique_lock{g_mutex}; -} - -} // namespace hidl_sync_util -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/hidl_sync_util.h b/wifi/1.6/default/hidl_sync_util.h deleted file mode 100644 index 2c1c37b0ad..0000000000 --- a/wifi/1.6/default/hidl_sync_util.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef HIDL_SYNC_UTIL_H_ -#define HIDL_SYNC_UTIL_H_ - -#include - -// Utility that provides a global lock to synchronize access between -// the HIDL thread and the legacy HAL's event loop. -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace hidl_sync_util { -std::unique_lock acquireGlobalLock(); -} // namespace hidl_sync_util -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android -#endif // HIDL_SYNC_UTIL_H_ diff --git a/wifi/1.6/default/ringbuffer.cpp b/wifi/1.6/default/ringbuffer.cpp deleted file mode 100644 index 981bf7bce7..0000000000 --- a/wifi/1.6/default/ringbuffer.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2018 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. - */ - -#include - -#include "ringbuffer.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { - -Ringbuffer::Ringbuffer(size_t maxSize) : size_(0), maxSize_(maxSize) {} - -enum Ringbuffer::AppendStatus Ringbuffer::append(const std::vector& input) { - if (input.size() == 0) { - return AppendStatus::FAIL_IP_BUFFER_ZERO; - } - if (input.size() > maxSize_) { - LOG(INFO) << "Oversized message of " << input.size() << " bytes is dropped"; - return AppendStatus::FAIL_IP_BUFFER_EXCEEDED_MAXSIZE; - } - data_.push_back(input); - size_ += input.size() * sizeof(input[0]); - while (size_ > maxSize_) { - if (data_.front().size() <= 0 || data_.front().size() > maxSize_) { - LOG(ERROR) << "First buffer in the ring buffer is Invalid. Size: " - << data_.front().size(); - return AppendStatus::FAIL_RING_BUFFER_CORRUPTED; - } - size_ -= data_.front().size() * sizeof(data_.front()[0]); - data_.pop_front(); - } - return AppendStatus::SUCCESS; -} - -const std::list>& Ringbuffer::getData() const { - return data_; -} - -void Ringbuffer::clear() { - data_.clear(); - size_ = 0; -} - -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/ringbuffer.h b/wifi/1.6/default/ringbuffer.h deleted file mode 100644 index c6a1e4c52d..0000000000 --- a/wifi/1.6/default/ringbuffer.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2018 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. - */ - -#ifndef RINGBUFFER_H_ -#define RINGBUFFER_H_ - -#include -#include - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { - -/** - * Ringbuffer object used to store debug data. - */ -class Ringbuffer { - public: - // Error codes for the append ring buffer operation - enum AppendStatus { - SUCCESS, - FAIL_GENERIC, - FAIL_IP_BUFFER_ZERO, - FAIL_IP_BUFFER_EXCEEDED_MAXSIZE, - FAIL_RING_BUFFER_CORRUPTED - }; - explicit Ringbuffer(size_t maxSize); - - // Appends the data buffer and deletes from the front until buffer is - // within |maxSize_|. - enum AppendStatus append(const std::vector& input); - const std::list>& getData() const; - void clear(); - - private: - std::list> data_; - size_t size_; - size_t maxSize_; -}; - -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // RINGBUFFER_H_ diff --git a/wifi/1.6/default/service.cpp b/wifi/1.6/default/service.cpp deleted file mode 100644 index c874d8b199..0000000000 --- a/wifi/1.6/default/service.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#include -#include -#include -#include -#include -#include - -#include "wifi.h" -#include "wifi_feature_flags.h" -#include "wifi_legacy_hal.h" -#include "wifi_legacy_hal_factory.h" -#include "wifi_mode_controller.h" - -using android::hardware::configureRpcThreadpool; -using android::hardware::joinRpcThreadpool; -using android::hardware::LazyServiceRegistrar; -using android::hardware::wifi::V1_6::implementation::feature_flags::WifiFeatureFlags; -using android::hardware::wifi::V1_6::implementation::legacy_hal::WifiLegacyHal; -using android::hardware::wifi::V1_6::implementation::legacy_hal::WifiLegacyHalFactory; -using android::hardware::wifi::V1_6::implementation::mode_controller::WifiModeController; - -#ifdef LAZY_SERVICE -const bool kLazyService = true; -#else -const bool kLazyService = false; -#endif - -int main(int /*argc*/, char** argv) { - signal(SIGPIPE, SIG_IGN); - android::base::InitLogging(argv, android::base::LogdLogger(android::base::SYSTEM)); - LOG(INFO) << "Wifi Hal is booting up..."; - - configureRpcThreadpool(1, true /* callerWillJoin */); - - const auto iface_tool = std::make_shared(); - const auto legacy_hal_factory = std::make_shared(iface_tool); - - // Setup hwbinder service - android::sp service = - new android::hardware::wifi::V1_6::implementation::Wifi( - iface_tool, legacy_hal_factory, std::make_shared(), - std::make_shared()); - if (kLazyService) { - auto registrar = LazyServiceRegistrar::getInstance(); - CHECK_EQ(registrar.registerService(service), android::NO_ERROR) - << "Failed to register wifi HAL"; - } else { - CHECK_EQ(service->registerAsService(), android::NO_ERROR) << "Failed to register wifi HAL"; - } - - joinRpcThreadpool(); - - LOG(INFO) << "Wifi Hal is terminating..."; - return 0; -} diff --git a/wifi/1.6/default/tests/hidl_struct_util_unit_tests.cpp b/wifi/1.6/default/tests/hidl_struct_util_unit_tests.cpp deleted file mode 100644 index 0dd0aa15bb..0000000000 --- a/wifi/1.6/default/tests/hidl_struct_util_unit_tests.cpp +++ /dev/null @@ -1,486 +0,0 @@ -/* - * Copyright (C) 2017, 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. - */ - -#include -#include -#include - -#undef NAN -#include "hidl_struct_util.h" - -using testing::Test; - -namespace { -constexpr uint32_t kMacId1 = 1; -constexpr uint32_t kMacId2 = 2; -constexpr uint32_t kIfaceChannel1 = 3; -constexpr uint32_t kIfaceChannel2 = 5; -constexpr char kIfaceName1[] = "wlan0"; -constexpr char kIfaceName2[] = "wlan1"; -} // namespace -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -using namespace android::hardware::wifi::V1_0; -using ::android::hardware::wifi::V1_6::WifiChannelWidthInMhz; - -class HidlStructUtilTest : public Test {}; - -TEST_F(HidlStructUtilTest, CanConvertLegacyWifiMacInfosToHidlWithOneMac) { - std::vector legacy_mac_infos; - legacy_hal::WifiMacInfo legacy_mac_info1 = { - .wlan_mac_id = kMacId1, - .mac_band = legacy_hal::WLAN_MAC_5_0_BAND | legacy_hal::WLAN_MAC_2_4_BAND}; - legacy_hal::WifiIfaceInfo legacy_iface_info1 = {.name = kIfaceName1, .channel = kIfaceChannel1}; - legacy_hal::WifiIfaceInfo legacy_iface_info2 = {.name = kIfaceName2, .channel = kIfaceChannel2}; - legacy_mac_info1.iface_infos.push_back(legacy_iface_info1); - legacy_mac_info1.iface_infos.push_back(legacy_iface_info2); - legacy_mac_infos.push_back(legacy_mac_info1); - - std::vector hidl_radio_mode_infos; - ASSERT_TRUE(hidl_struct_util::convertLegacyWifiMacInfosToHidl(legacy_mac_infos, - &hidl_radio_mode_infos)); - - ASSERT_EQ(1u, hidl_radio_mode_infos.size()); - auto hidl_radio_mode_info1 = hidl_radio_mode_infos[0]; - EXPECT_EQ(legacy_mac_info1.wlan_mac_id, hidl_radio_mode_info1.radioId); - EXPECT_EQ(V1_4::WifiBand::BAND_24GHZ_5GHZ, hidl_radio_mode_info1.bandInfo); - ASSERT_EQ(2u, hidl_radio_mode_info1.ifaceInfos.size()); - auto hidl_iface_info1 = hidl_radio_mode_info1.ifaceInfos[0]; - EXPECT_EQ(legacy_iface_info1.name, hidl_iface_info1.name); - EXPECT_EQ(static_cast(legacy_iface_info1.channel), hidl_iface_info1.channel); - auto hidl_iface_info2 = hidl_radio_mode_info1.ifaceInfos[1]; - EXPECT_EQ(legacy_iface_info2.name, hidl_iface_info2.name); - EXPECT_EQ(static_cast(legacy_iface_info2.channel), hidl_iface_info2.channel); -} - -TEST_F(HidlStructUtilTest, CanConvertLegacyWifiMacInfosToHidlWithTwoMac) { - std::vector legacy_mac_infos; - legacy_hal::WifiMacInfo legacy_mac_info1 = {.wlan_mac_id = kMacId1, - .mac_band = legacy_hal::WLAN_MAC_5_0_BAND}; - legacy_hal::WifiIfaceInfo legacy_iface_info1 = {.name = kIfaceName1, .channel = kIfaceChannel1}; - legacy_hal::WifiMacInfo legacy_mac_info2 = {.wlan_mac_id = kMacId2, - .mac_band = legacy_hal::WLAN_MAC_2_4_BAND}; - legacy_hal::WifiIfaceInfo legacy_iface_info2 = {.name = kIfaceName2, .channel = kIfaceChannel2}; - legacy_mac_info1.iface_infos.push_back(legacy_iface_info1); - legacy_mac_infos.push_back(legacy_mac_info1); - legacy_mac_info2.iface_infos.push_back(legacy_iface_info2); - legacy_mac_infos.push_back(legacy_mac_info2); - - std::vector hidl_radio_mode_infos; - ASSERT_TRUE(hidl_struct_util::convertLegacyWifiMacInfosToHidl(legacy_mac_infos, - &hidl_radio_mode_infos)); - - ASSERT_EQ(2u, hidl_radio_mode_infos.size()); - - // Find mac info 1. - const auto hidl_radio_mode_info1 = - std::find_if(hidl_radio_mode_infos.begin(), hidl_radio_mode_infos.end(), - [&legacy_mac_info1](const V1_4::IWifiChipEventCallback::RadioModeInfo& x) { - return x.radioId == legacy_mac_info1.wlan_mac_id; - }); - ASSERT_NE(hidl_radio_mode_infos.end(), hidl_radio_mode_info1); - EXPECT_EQ(V1_4::WifiBand::BAND_5GHZ, hidl_radio_mode_info1->bandInfo); - ASSERT_EQ(1u, hidl_radio_mode_info1->ifaceInfos.size()); - auto hidl_iface_info1 = hidl_radio_mode_info1->ifaceInfos[0]; - EXPECT_EQ(legacy_iface_info1.name, hidl_iface_info1.name); - EXPECT_EQ(static_cast(legacy_iface_info1.channel), hidl_iface_info1.channel); - - // Find mac info 2. - const auto hidl_radio_mode_info2 = - std::find_if(hidl_radio_mode_infos.begin(), hidl_radio_mode_infos.end(), - [&legacy_mac_info2](const V1_4::IWifiChipEventCallback::RadioModeInfo& x) { - return x.radioId == legacy_mac_info2.wlan_mac_id; - }); - ASSERT_NE(hidl_radio_mode_infos.end(), hidl_radio_mode_info2); - EXPECT_EQ(V1_4::WifiBand::BAND_24GHZ, hidl_radio_mode_info2->bandInfo); - ASSERT_EQ(1u, hidl_radio_mode_info2->ifaceInfos.size()); - auto hidl_iface_info2 = hidl_radio_mode_info2->ifaceInfos[0]; - EXPECT_EQ(legacy_iface_info2.name, hidl_iface_info2.name); - EXPECT_EQ(static_cast(legacy_iface_info2.channel), hidl_iface_info2.channel); -} - -TEST_F(HidlStructUtilTest, canConvertLegacyLinkLayerStatsToHidl) { - legacy_hal::LinkLayerStats legacy_stats{}; - legacy_stats.radios.push_back(legacy_hal::LinkLayerRadioStats{}); - legacy_stats.radios.push_back(legacy_hal::LinkLayerRadioStats{}); - legacy_stats.peers.push_back(legacy_hal::WifiPeerInfo{}); - legacy_stats.peers.push_back(legacy_hal::WifiPeerInfo{}); - legacy_stats.iface.beacon_rx = rand(); - legacy_stats.iface.rssi_mgmt = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].rx_mpdu = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].tx_mpdu = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].mpdu_lost = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].retries = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_min = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_max = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_avg = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_num_samples = rand(); - - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].rx_mpdu = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].tx_mpdu = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].mpdu_lost = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].retries = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_min = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_max = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_avg = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_num_samples = rand(); - - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].rx_mpdu = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].tx_mpdu = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].mpdu_lost = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].retries = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_min = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_max = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_avg = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_num_samples = rand(); - - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].rx_mpdu = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].tx_mpdu = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].mpdu_lost = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].retries = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_min = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_max = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_avg = rand(); - legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_num_samples = rand(); - - legacy_stats.iface.info.time_slicing_duty_cycle_percent = rand(); - legacy_stats.iface.num_peers = 1; - - for (auto& radio : legacy_stats.radios) { - radio.stats.radio = rand(); - radio.stats.on_time = rand(); - radio.stats.tx_time = rand(); - radio.stats.rx_time = rand(); - radio.stats.on_time_scan = rand(); - radio.stats.on_time_nbd = rand(); - radio.stats.on_time_gscan = rand(); - radio.stats.on_time_roam_scan = rand(); - radio.stats.on_time_pno_scan = rand(); - radio.stats.on_time_hs20 = rand(); - for (int i = 0; i < 4; i++) { - radio.tx_time_per_levels.push_back(rand()); - } - - legacy_hal::wifi_channel_stat channel_stat1 = { - .channel = {legacy_hal::WIFI_CHAN_WIDTH_20, 2437, 2437, 0}, - .on_time = 0x1111, - .cca_busy_time = 0x55, - }; - legacy_hal::wifi_channel_stat channel_stat2 = { - .channel = {legacy_hal::WIFI_CHAN_WIDTH_20, 5180, 5180, 0}, - .on_time = 0x2222, - .cca_busy_time = 0x66, - }; - radio.channel_stats.push_back(channel_stat1); - radio.channel_stats.push_back(channel_stat2); - } - - for (auto& peer : legacy_stats.peers) { - peer.peer_info.bssload.sta_count = rand(); - peer.peer_info.bssload.chan_util = rand(); - wifi_rate_stat rate_stat1 = { - .rate = {3, 1, 2, 5, 0, 0}, - .tx_mpdu = 0, - .rx_mpdu = 1, - .mpdu_lost = 2, - .retries = 3, - .retries_short = 4, - .retries_long = 5, - }; - wifi_rate_stat rate_stat2 = { - .rate = {2, 2, 1, 6, 0, 1}, - .tx_mpdu = 6, - .rx_mpdu = 7, - .mpdu_lost = 8, - .retries = 9, - .retries_short = 10, - .retries_long = 11, - }; - peer.rate_stats.push_back(rate_stat1); - peer.rate_stats.push_back(rate_stat2); - } - - V1_6::StaLinkLayerStats converted{}; - hidl_struct_util::convertLegacyLinkLayerStatsToHidl(legacy_stats, &converted); - EXPECT_EQ(legacy_stats.iface.beacon_rx, converted.iface.V1_0.beaconRx); - EXPECT_EQ(legacy_stats.iface.rssi_mgmt, converted.iface.V1_0.avgRssiMgmt); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].rx_mpdu, - converted.iface.V1_0.wmeBePktStats.rxMpdu); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].tx_mpdu, - converted.iface.V1_0.wmeBePktStats.txMpdu); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].mpdu_lost, - converted.iface.V1_0.wmeBePktStats.lostMpdu); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].retries, - converted.iface.V1_0.wmeBePktStats.retries); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_min, - converted.iface.wmeBeContentionTimeStats.contentionTimeMinInUsec); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_max, - converted.iface.wmeBeContentionTimeStats.contentionTimeMaxInUsec); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_time_avg, - converted.iface.wmeBeContentionTimeStats.contentionTimeAvgInUsec); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BE].contention_num_samples, - converted.iface.wmeBeContentionTimeStats.contentionNumSamples); - - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].rx_mpdu, - converted.iface.V1_0.wmeBkPktStats.rxMpdu); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].tx_mpdu, - converted.iface.V1_0.wmeBkPktStats.txMpdu); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].mpdu_lost, - converted.iface.V1_0.wmeBkPktStats.lostMpdu); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].retries, - converted.iface.V1_0.wmeBkPktStats.retries); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_min, - converted.iface.wmeBkContentionTimeStats.contentionTimeMinInUsec); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_max, - converted.iface.wmeBkContentionTimeStats.contentionTimeMaxInUsec); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_time_avg, - converted.iface.wmeBkContentionTimeStats.contentionTimeAvgInUsec); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_BK].contention_num_samples, - converted.iface.wmeBkContentionTimeStats.contentionNumSamples); - - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].rx_mpdu, - converted.iface.V1_0.wmeViPktStats.rxMpdu); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].tx_mpdu, - converted.iface.V1_0.wmeViPktStats.txMpdu); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].mpdu_lost, - converted.iface.V1_0.wmeViPktStats.lostMpdu); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].retries, - converted.iface.V1_0.wmeViPktStats.retries); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_min, - converted.iface.wmeViContentionTimeStats.contentionTimeMinInUsec); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_max, - converted.iface.wmeViContentionTimeStats.contentionTimeMaxInUsec); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_time_avg, - converted.iface.wmeViContentionTimeStats.contentionTimeAvgInUsec); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VI].contention_num_samples, - converted.iface.wmeViContentionTimeStats.contentionNumSamples); - - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].rx_mpdu, - converted.iface.V1_0.wmeVoPktStats.rxMpdu); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].tx_mpdu, - converted.iface.V1_0.wmeVoPktStats.txMpdu); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].mpdu_lost, - converted.iface.V1_0.wmeVoPktStats.lostMpdu); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].retries, - converted.iface.V1_0.wmeVoPktStats.retries); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_min, - converted.iface.wmeVoContentionTimeStats.contentionTimeMinInUsec); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_max, - converted.iface.wmeVoContentionTimeStats.contentionTimeMaxInUsec); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_time_avg, - converted.iface.wmeVoContentionTimeStats.contentionTimeAvgInUsec); - EXPECT_EQ(legacy_stats.iface.ac[legacy_hal::WIFI_AC_VO].contention_num_samples, - converted.iface.wmeVoContentionTimeStats.contentionNumSamples); - - EXPECT_EQ(legacy_stats.iface.info.time_slicing_duty_cycle_percent, - converted.iface.timeSliceDutyCycleInPercent); - - EXPECT_EQ(legacy_stats.radios.size(), converted.radios.size()); - for (size_t i = 0; i < legacy_stats.radios.size(); i++) { - EXPECT_EQ(legacy_stats.radios[i].stats.radio, converted.radios[i].radioId); - EXPECT_EQ(legacy_stats.radios[i].stats.on_time, converted.radios[i].V1_0.onTimeInMs); - EXPECT_EQ(legacy_stats.radios[i].stats.tx_time, converted.radios[i].V1_0.txTimeInMs); - EXPECT_EQ(legacy_stats.radios[i].stats.rx_time, converted.radios[i].V1_0.rxTimeInMs); - EXPECT_EQ(legacy_stats.radios[i].stats.on_time_scan, - converted.radios[i].V1_0.onTimeInMsForScan); - EXPECT_EQ(legacy_stats.radios[i].tx_time_per_levels.size(), - converted.radios[i].V1_0.txTimeInMsPerLevel.size()); - for (size_t j = 0; j < legacy_stats.radios[i].tx_time_per_levels.size(); j++) { - EXPECT_EQ(legacy_stats.radios[i].tx_time_per_levels[j], - converted.radios[i].V1_0.txTimeInMsPerLevel[j]); - } - EXPECT_EQ(legacy_stats.radios[i].stats.on_time_nbd, - converted.radios[i].onTimeInMsForNanScan); - EXPECT_EQ(legacy_stats.radios[i].stats.on_time_gscan, - converted.radios[i].onTimeInMsForBgScan); - EXPECT_EQ(legacy_stats.radios[i].stats.on_time_roam_scan, - converted.radios[i].onTimeInMsForRoamScan); - EXPECT_EQ(legacy_stats.radios[i].stats.on_time_pno_scan, - converted.radios[i].onTimeInMsForPnoScan); - EXPECT_EQ(legacy_stats.radios[i].stats.on_time_hs20, - converted.radios[i].onTimeInMsForHs20Scan); - EXPECT_EQ(legacy_stats.radios[i].channel_stats.size(), - converted.radios[i].channelStats.size()); - for (size_t k = 0; k < legacy_stats.radios[i].channel_stats.size(); k++) { - auto& legacy_channel_st = legacy_stats.radios[i].channel_stats[k]; - EXPECT_EQ(WifiChannelWidthInMhz::WIDTH_20, - converted.radios[i].channelStats[k].channel.width); - EXPECT_EQ(WifiChannelInMhz(legacy_channel_st.channel.center_freq), - converted.radios[i].channelStats[k].channel.centerFreq); - EXPECT_EQ(WifiChannelInMhz(legacy_channel_st.channel.center_freq0), - converted.radios[i].channelStats[k].channel.centerFreq0); - EXPECT_EQ(WifiChannelInMhz(legacy_channel_st.channel.center_freq1), - converted.radios[i].channelStats[k].channel.centerFreq1); - EXPECT_EQ(legacy_channel_st.cca_busy_time, - converted.radios[i].channelStats[k].ccaBusyTimeInMs); - EXPECT_EQ(legacy_channel_st.on_time, converted.radios[i].channelStats[k].onTimeInMs); - } - } - - EXPECT_EQ(legacy_stats.peers.size(), converted.iface.peers.size()); - for (size_t i = 0; i < legacy_stats.peers.size(); i++) { - EXPECT_EQ(legacy_stats.peers[i].peer_info.bssload.sta_count, - converted.iface.peers[i].staCount); - EXPECT_EQ(legacy_stats.peers[i].peer_info.bssload.chan_util, - converted.iface.peers[i].chanUtil); - for (size_t j = 0; j < legacy_stats.peers[i].rate_stats.size(); j++) { - EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].rate.preamble, - (uint32_t)converted.iface.peers[i].rateStats[j].rateInfo.preamble); - EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].rate.nss, - (uint32_t)converted.iface.peers[i].rateStats[j].rateInfo.nss); - EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].rate.bw, - (uint32_t)converted.iface.peers[i].rateStats[j].rateInfo.bw); - EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].rate.rateMcsIdx, - converted.iface.peers[i].rateStats[j].rateInfo.rateMcsIdx); - EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].tx_mpdu, - converted.iface.peers[i].rateStats[j].txMpdu); - EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].rx_mpdu, - converted.iface.peers[i].rateStats[j].rxMpdu); - EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].mpdu_lost, - converted.iface.peers[i].rateStats[j].mpduLost); - EXPECT_EQ(legacy_stats.peers[i].rate_stats[j].retries, - converted.iface.peers[i].rateStats[j].retries); - } - } -} - -TEST_F(HidlStructUtilTest, CanConvertLegacyFeaturesToHidl) { - using HidlChipCaps = V1_3::IWifiChip::ChipCapabilityMask; - - uint32_t hidle_caps; - - uint32_t legacy_feature_set = WIFI_FEATURE_D2D_RTT | WIFI_FEATURE_SET_LATENCY_MODE; - uint32_t legacy_logger_feature_set = legacy_hal::WIFI_LOGGER_DRIVER_DUMP_SUPPORTED; - - ASSERT_TRUE(hidl_struct_util::convertLegacyFeaturesToHidlChipCapabilities( - legacy_feature_set, legacy_logger_feature_set, &hidle_caps)); - - EXPECT_EQ(HidlChipCaps::DEBUG_RING_BUFFER_VENDOR_DATA | - HidlChipCaps::DEBUG_HOST_WAKE_REASON_STATS | - HidlChipCaps::DEBUG_ERROR_ALERTS | HidlChipCaps::D2D_RTT | - HidlChipCaps::SET_LATENCY_MODE | HidlChipCaps::DEBUG_MEMORY_DRIVER_DUMP, - hidle_caps); -} - -void insertRadioCombination(legacy_hal::wifi_radio_combination* dst_radio_combination_ptr, - int num_radio_configurations, - legacy_hal::wifi_radio_configuration* radio_configuration) { - dst_radio_combination_ptr->num_radio_configurations = num_radio_configurations; - memcpy(dst_radio_combination_ptr->radio_configurations, radio_configuration, - num_radio_configurations * sizeof(legacy_hal::wifi_radio_configuration)); -} - -void verifyRadioCombination(WifiRadioCombination* radioCombination, size_t num_radio_configurations, - legacy_hal::wifi_radio_configuration* radio_configuration) { - EXPECT_EQ(num_radio_configurations, radioCombination->radioConfigurations.size()); - for (size_t i = 0; i < num_radio_configurations; i++) { - EXPECT_EQ(hidl_struct_util::convertLegacyMacBandToHidlWifiBand(radio_configuration->band), - radioCombination->radioConfigurations[i].bandInfo); - EXPECT_EQ(hidl_struct_util::convertLegacyAntennaConfigurationToHidl( - radio_configuration->antenna_cfg), - radioCombination->radioConfigurations[i].antennaMode); - radio_configuration++; - } -} - -TEST_F(HidlStructUtilTest, canConvertLegacyRadioCombinationsMatrixToHidl) { - legacy_hal::wifi_radio_configuration radio_configurations_array1[] = { - {.band = legacy_hal::WLAN_MAC_2_4_BAND, .antenna_cfg = legacy_hal::WIFI_ANTENNA_1X1}, - }; - legacy_hal::wifi_radio_configuration radio_configurations_array2[] = { - {.band = legacy_hal::WLAN_MAC_2_4_BAND, .antenna_cfg = legacy_hal::WIFI_ANTENNA_2X2}, - {.band = legacy_hal::WLAN_MAC_5_0_BAND, .antenna_cfg = legacy_hal::WIFI_ANTENNA_3X3}, - }; - legacy_hal::wifi_radio_configuration radio_configurations_array3[] = { - {.band = legacy_hal::WLAN_MAC_2_4_BAND, .antenna_cfg = legacy_hal::WIFI_ANTENNA_2X2}, - {.band = legacy_hal::WLAN_MAC_6_0_BAND, .antenna_cfg = legacy_hal::WIFI_ANTENNA_1X1}, - {.band = legacy_hal::WLAN_MAC_5_0_BAND, .antenna_cfg = legacy_hal::WIFI_ANTENNA_4X4}, - }; - - int num_radio_configs = 0; - int num_combinations = 0; - std::array buffer; - buffer.fill(0); - legacy_hal::wifi_radio_combination_matrix* legacy_matrix = - reinterpret_cast(buffer.data()); - legacy_hal::wifi_radio_combination* radio_combinations; - - // Prepare a legacy wifi_radio_combination_matrix - legacy_matrix->num_radio_combinations = 3; - // Insert first combination - radio_combinations = - (legacy_hal::wifi_radio_combination*)((char*)legacy_matrix->radio_combinations); - insertRadioCombination( - radio_combinations, - sizeof(radio_configurations_array1) / sizeof(radio_configurations_array1[0]), - radio_configurations_array1); - num_combinations++; - num_radio_configs += - sizeof(radio_configurations_array1) / sizeof(radio_configurations_array1[0]); - - // Insert second combination - radio_combinations = - (legacy_hal::wifi_radio_combination*)((char*)legacy_matrix->radio_combinations + - (num_combinations * - sizeof(legacy_hal::wifi_radio_combination)) + - (num_radio_configs * - sizeof(wifi_radio_configuration))); - insertRadioCombination( - radio_combinations, - sizeof(radio_configurations_array2) / sizeof(radio_configurations_array2[0]), - radio_configurations_array2); - num_combinations++; - num_radio_configs += - sizeof(radio_configurations_array2) / sizeof(radio_configurations_array2[0]); - - // Insert third combination - radio_combinations = - (legacy_hal::wifi_radio_combination*)((char*)legacy_matrix->radio_combinations + - (num_combinations * - sizeof(legacy_hal::wifi_radio_combination)) + - (num_radio_configs * - sizeof(wifi_radio_configuration))); - insertRadioCombination( - radio_combinations, - sizeof(radio_configurations_array3) / sizeof(radio_configurations_array3[0]), - radio_configurations_array3); - - V1_6::WifiRadioCombinationMatrix converted_matrix{}; - hidl_struct_util::convertLegacyRadioCombinationsMatrixToHidl(legacy_matrix, &converted_matrix); - - // Verify the conversion - EXPECT_EQ(legacy_matrix->num_radio_combinations, converted_matrix.radioCombinations.size()); - verifyRadioCombination( - &converted_matrix.radioCombinations[0], - sizeof(radio_configurations_array1) / sizeof(radio_configurations_array1[0]), - radio_configurations_array1); - verifyRadioCombination( - &converted_matrix.radioCombinations[1], - sizeof(radio_configurations_array2) / sizeof(radio_configurations_array2[0]), - radio_configurations_array2); - verifyRadioCombination( - &converted_matrix.radioCombinations[2], - sizeof(radio_configurations_array3) / sizeof(radio_configurations_array3[0]), - radio_configurations_array3); -} -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/tests/main.cpp b/wifi/1.6/default/tests/main.cpp deleted file mode 100644 index 9aac837242..0000000000 --- a/wifi/1.6/default/tests/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2017 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. - */ - -#include -#include - -#include - -int main(int argc, char** argv) { - ::testing::InitGoogleTest(&argc, argv); - ::testing::InitGoogleMock(&argc, argv); - // Force ourselves to always log to stderr - android::base::InitLogging(argv, android::base::StderrLogger); - return RUN_ALL_TESTS(); -} diff --git a/wifi/1.6/default/tests/mock_interface_tool.cpp b/wifi/1.6/default/tests/mock_interface_tool.cpp deleted file mode 100644 index b99a16446c..0000000000 --- a/wifi/1.6/default/tests/mock_interface_tool.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2019 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. - */ -#include -#include -#include - -#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 -#include "mock_interface_tool.h" - -namespace android { -namespace wifi_system { - -MockInterfaceTool::MockInterfaceTool() {} - -} // namespace wifi_system -} // namespace android diff --git a/wifi/1.6/default/tests/mock_interface_tool.h b/wifi/1.6/default/tests/mock_interface_tool.h deleted file mode 100644 index 7ce3992c7e..0000000000 --- a/wifi/1.6/default/tests/mock_interface_tool.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2019 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. - */ - -#ifndef MOCK_INTERFACE_TOOL_H -#define MOCK_INTERFACE_TOOL_H - -#include -#include - -namespace android { -namespace wifi_system { - -class MockInterfaceTool : public InterfaceTool { - public: - MockInterfaceTool(); - - MOCK_METHOD1(GetUpState, bool(const char* if_name)); - MOCK_METHOD2(SetUpState, bool(const char* if_name, bool request_up)); - MOCK_METHOD1(SetWifiUpState, bool(bool request_up)); - MOCK_METHOD2(SetMacAddress, - bool(const char* if_name, const std::array& address)); - MOCK_METHOD1(GetFactoryMacAddress, std::array(const char* if_name)); - -}; // class MockInterfaceTool - -} // namespace wifi_system -} // namespace android - -#endif // MOCK_INTERFACE_TOOL_H diff --git a/wifi/1.6/default/tests/mock_wifi_feature_flags.cpp b/wifi/1.6/default/tests/mock_wifi_feature_flags.cpp deleted file mode 100644 index d10b74c3a0..0000000000 --- a/wifi/1.6/default/tests/mock_wifi_feature_flags.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2017 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. - */ - -#include - -#include "mock_wifi_feature_flags.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace feature_flags { - -MockWifiFeatureFlags::MockWifiFeatureFlags() {} - -} // namespace feature_flags -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/tests/mock_wifi_feature_flags.h b/wifi/1.6/default/tests/mock_wifi_feature_flags.h deleted file mode 100644 index fbe1f7a5ac..0000000000 --- a/wifi/1.6/default/tests/mock_wifi_feature_flags.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2017 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. - */ - -#ifndef MOCK_WIFI_FEATURE_FLAGS_H_ -#define MOCK_WIFI_FEATURE_FLAGS_H_ - -#include -#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 - -#include "wifi_feature_flags.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace feature_flags { - -class MockWifiFeatureFlags : public WifiFeatureFlags { - public: - MockWifiFeatureFlags(); - - MOCK_METHOD1(getChipModes, std::vector(bool is_primary)); - MOCK_METHOD0(isApMacRandomizationDisabled, bool()); -}; - -} // namespace feature_flags -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // MOCK_WIFI_FEATURE_FLAGS_H_ diff --git a/wifi/1.6/default/tests/mock_wifi_iface_util.cpp b/wifi/1.6/default/tests/mock_wifi_iface_util.cpp deleted file mode 100644 index 24b16cb469..0000000000 --- a/wifi/1.6/default/tests/mock_wifi_iface_util.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2019 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. - */ - -#include -#include -#include - -#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 -#include "mock_wifi_iface_util.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace iface_util { - -MockWifiIfaceUtil::MockWifiIfaceUtil(const std::weak_ptr iface_tool, - const std::weak_ptr legacy_hal) - : WifiIfaceUtil(iface_tool, legacy_hal) {} -} // namespace iface_util -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/tests/mock_wifi_iface_util.h b/wifi/1.6/default/tests/mock_wifi_iface_util.h deleted file mode 100644 index 2701c36d76..0000000000 --- a/wifi/1.6/default/tests/mock_wifi_iface_util.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2019 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. - */ - -#ifndef MOCK_WIFI_IFACE_UTIL_H_ -#define MOCK_WIFI_IFACE_UTIL_H_ - -#include - -#include "wifi_iface_util.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace iface_util { - -class MockWifiIfaceUtil : public WifiIfaceUtil { - public: - MockWifiIfaceUtil(const std::weak_ptr iface_tool, - const std::weak_ptr legacy_hal); - MOCK_METHOD1(getFactoryMacAddress, std::array(const std::string&)); - MOCK_METHOD2(setMacAddress, bool(const std::string&, const std::array&)); - MOCK_METHOD0(getOrCreateRandomMacAddress, std::array()); - MOCK_METHOD2(registerIfaceEventHandlers, void(const std::string&, IfaceEventHandlers)); - MOCK_METHOD1(unregisterIfaceEventHandlers, void(const std::string&)); - MOCK_METHOD2(setUpState, bool(const std::string&, bool)); - MOCK_METHOD1(ifNameToIndex, unsigned(const std::string&)); -}; -} // namespace iface_util -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // MOCK_WIFI_IFACE_UTIL_H_ diff --git a/wifi/1.6/default/tests/mock_wifi_legacy_hal.cpp b/wifi/1.6/default/tests/mock_wifi_legacy_hal.cpp deleted file mode 100644 index 2c558612e3..0000000000 --- a/wifi/1.6/default/tests/mock_wifi_legacy_hal.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2017 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. - */ - -#include -#include -#include - -#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 -#include "mock_wifi_legacy_hal.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace legacy_hal { - -MockWifiLegacyHal::MockWifiLegacyHal(const std::weak_ptr iface_tool, - const wifi_hal_fn& fn, bool is_primary) - : WifiLegacyHal(iface_tool, fn, is_primary) {} -} // namespace legacy_hal -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/tests/mock_wifi_legacy_hal.h b/wifi/1.6/default/tests/mock_wifi_legacy_hal.h deleted file mode 100644 index 85dbf0fe49..0000000000 --- a/wifi/1.6/default/tests/mock_wifi_legacy_hal.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2017 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. - */ - -#ifndef MOCK_WIFI_LEGACY_HAL_H_ -#define MOCK_WIFI_LEGACY_HAL_H_ - -#include - -#include "wifi_legacy_hal.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace legacy_hal { - -class MockWifiLegacyHal : public WifiLegacyHal { - public: - MockWifiLegacyHal(const std::weak_ptr iface_tool, - const wifi_hal_fn& fn, bool is_primary); - MOCK_METHOD0(initialize, wifi_error()); - MOCK_METHOD0(start, wifi_error()); - MOCK_METHOD2(stop, - wifi_error(std::unique_lock*, const std::function&)); - MOCK_METHOD2(setDfsFlag, wifi_error(const std::string&, bool)); - MOCK_METHOD2(registerRadioModeChangeCallbackHandler, - wifi_error(const std::string&, const on_radio_mode_change_callback&)); - MOCK_METHOD1(getFirmwareVersion, - std::pair(const std::string& iface_name)); - MOCK_METHOD1(getDriverVersion, - std::pair(const std::string& iface_name)); - - MOCK_METHOD2(selectTxPowerScenario, - wifi_error(const std::string& iface_name, wifi_power_scenario scenario)); - MOCK_METHOD1(resetTxPowerScenario, wifi_error(const std::string& iface_name)); - MOCK_METHOD2(nanRegisterCallbackHandlers, - wifi_error(const std::string&, const NanCallbackHandlers&)); - MOCK_METHOD2(nanDisableRequest, wifi_error(const std::string&, transaction_id)); - MOCK_METHOD3(nanDataInterfaceDelete, - wifi_error(const std::string&, transaction_id, const std::string&)); - MOCK_METHOD2(createVirtualInterface, - wifi_error(const std::string& ifname, wifi_interface_type iftype)); - MOCK_METHOD1(deleteVirtualInterface, wifi_error(const std::string& ifname)); - MOCK_METHOD0(waitForDriverReady, wifi_error()); - MOCK_METHOD2(getSupportedIfaceName, wifi_error(uint32_t, std::string&)); - MOCK_METHOD1(registerSubsystemRestartCallbackHandler, - wifi_error(const on_subsystem_restart_callback&)); - MOCK_METHOD1(getSupportedFeatureSet, std::pair(const std::string&)); -}; -} // namespace legacy_hal -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // MOCK_WIFI_LEGACY_HAL_H_ diff --git a/wifi/1.6/default/tests/mock_wifi_mode_controller.cpp b/wifi/1.6/default/tests/mock_wifi_mode_controller.cpp deleted file mode 100644 index 446f8296f8..0000000000 --- a/wifi/1.6/default/tests/mock_wifi_mode_controller.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2017 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. - */ - -#include -#include -#include - -#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 -#include "mock_wifi_mode_controller.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace mode_controller { - -MockWifiModeController::MockWifiModeController() : WifiModeController() {} -} // namespace mode_controller -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/tests/mock_wifi_mode_controller.h b/wifi/1.6/default/tests/mock_wifi_mode_controller.h deleted file mode 100644 index addcc81591..0000000000 --- a/wifi/1.6/default/tests/mock_wifi_mode_controller.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2017 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. - */ - -#ifndef MOCK_WIFI_MODE_CONTROLLER_H_ -#define MOCK_WIFI_MODE_CONTROLLER_H_ - -#include - -#include "wifi_mode_controller.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace mode_controller { - -class MockWifiModeController : public WifiModeController { - public: - MockWifiModeController(); - MOCK_METHOD0(initialize, bool()); - MOCK_METHOD1(changeFirmwareMode, bool(IfaceType)); - MOCK_METHOD1(isFirmwareModeChangeNeeded, bool(IfaceType)); - MOCK_METHOD0(deinitialize, bool()); -}; -} // namespace mode_controller -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // MOCK_WIFI_MODE_CONTROLLER_H_ diff --git a/wifi/1.6/default/tests/ringbuffer_unit_tests.cpp b/wifi/1.6/default/tests/ringbuffer_unit_tests.cpp deleted file mode 100644 index eb86194ff0..0000000000 --- a/wifi/1.6/default/tests/ringbuffer_unit_tests.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2018, 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. - */ - -#include - -#include "ringbuffer.h" - -using testing::Return; -using testing::Test; - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { - -class RingbufferTest : public Test { - public: - const uint32_t maxBufferSize_ = 10; - Ringbuffer buffer_{maxBufferSize_}; -}; - -TEST_F(RingbufferTest, CreateEmptyBuffer) { - ASSERT_TRUE(buffer_.getData().empty()); -} - -TEST_F(RingbufferTest, CanUseFullBufferCapacity) { - const std::vector input(maxBufferSize_ / 2, '0'); - const std::vector input2(maxBufferSize_ / 2, '1'); - buffer_.append(input); - buffer_.append(input2); - ASSERT_EQ(2u, buffer_.getData().size()); - EXPECT_EQ(input, buffer_.getData().front()); - EXPECT_EQ(input2, buffer_.getData().back()); -} - -TEST_F(RingbufferTest, OldDataIsRemovedOnOverflow) { - const std::vector input(maxBufferSize_ / 2, '0'); - const std::vector input2(maxBufferSize_ / 2, '1'); - const std::vector input3 = {'G'}; - buffer_.append(input); - buffer_.append(input2); - buffer_.append(input3); - ASSERT_EQ(2u, buffer_.getData().size()); - EXPECT_EQ(input2, buffer_.getData().front()); - EXPECT_EQ(input3, buffer_.getData().back()); -} - -TEST_F(RingbufferTest, MultipleOldDataIsRemovedOnOverflow) { - const std::vector input(maxBufferSize_ / 2, '0'); - const std::vector input2(maxBufferSize_ / 2, '1'); - const std::vector input3(maxBufferSize_, '2'); - buffer_.append(input); - buffer_.append(input2); - buffer_.append(input3); - ASSERT_EQ(1u, buffer_.getData().size()); - EXPECT_EQ(input3, buffer_.getData().front()); -} - -TEST_F(RingbufferTest, AppendingEmptyBufferDoesNotAddGarbage) { - const std::vector input = {}; - buffer_.append(input); - ASSERT_TRUE(buffer_.getData().empty()); -} - -TEST_F(RingbufferTest, OversizedAppendIsDropped) { - const std::vector input(maxBufferSize_ + 1, '0'); - buffer_.append(input); - ASSERT_TRUE(buffer_.getData().empty()); -} - -TEST_F(RingbufferTest, OversizedAppendDoesNotDropExistingData) { - const std::vector input(maxBufferSize_, '0'); - const std::vector input2(maxBufferSize_ + 1, '1'); - buffer_.append(input); - buffer_.append(input2); - ASSERT_EQ(1u, buffer_.getData().size()); - EXPECT_EQ(input, buffer_.getData().front()); -} -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/tests/runtests.sh b/wifi/1.6/default/tests/runtests.sh deleted file mode 100755 index 6bce3ef8c4..0000000000 --- a/wifi/1.6/default/tests/runtests.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -# Copyright(C) 2017 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. - -if [ -z $ANDROID_BUILD_TOP ]; then - echo "You need to source and lunch before you can use this script" - exit 1 -fi -set -e - -$ANDROID_BUILD_TOP/build/soong/soong_ui.bash --make-mode android.hardware.wifi@1.0-service-tests -adb root -adb sync data -adb shell /data/nativetest64/vendor/android.hardware.wifi@1.0-service-tests/android.hardware.wifi@1.0-service-tests diff --git a/wifi/1.6/default/tests/wifi_chip_unit_tests.cpp b/wifi/1.6/default/tests/wifi_chip_unit_tests.cpp deleted file mode 100644 index 81117c5e06..0000000000 --- a/wifi/1.6/default/tests/wifi_chip_unit_tests.cpp +++ /dev/null @@ -1,864 +0,0 @@ -/* - * Copyright (C) 2017, 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. - */ - -#include -#include -#include -#include - -#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 -#include "wifi_chip.h" - -#include "mock_interface_tool.h" -#include "mock_wifi_feature_flags.h" -#include "mock_wifi_iface_util.h" -#include "mock_wifi_legacy_hal.h" -#include "mock_wifi_mode_controller.h" - -using testing::NiceMock; -using testing::Return; -using testing::Test; - -namespace { -using android::hardware::wifi::V1_0::ChipId; - -constexpr ChipId kFakeChipId = 5; -} // namespace - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { - -class WifiChipTest : public Test { - protected: - void setupV1IfaceCombination() { - // clang-format off - const hidl_vec combinationsSta = { - {{{{IfaceConcurrencyType::STA}, 1}, {{IfaceConcurrencyType::P2P}, 1}}} - }; - const hidl_vec combinationsAp = { - {{{{IfaceConcurrencyType::AP}, 1}}} - }; - const std::vector modes = { - {feature_flags::chip_mode_ids::kV1Sta, combinationsSta}, - {feature_flags::chip_mode_ids::kV1Ap, combinationsAp} - }; - // clang-format on - EXPECT_CALL(*feature_flags_, getChipModes(true)).WillRepeatedly(testing::Return(modes)); - } - - void setupV1_AwareIfaceCombination() { - // clang-format off - const hidl_vec combinationsSta = { - {{{{IfaceConcurrencyType::STA}, 1}, - {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN}, 1}}} - }; - const hidl_vec combinationsAp = { - {{{{IfaceConcurrencyType::AP}, 1}}} - }; - const std::vector modes = { - {feature_flags::chip_mode_ids::kV1Sta, combinationsSta}, - {feature_flags::chip_mode_ids::kV1Ap, combinationsAp} - }; - // clang-format on - EXPECT_CALL(*feature_flags_, getChipModes(true)).WillRepeatedly(testing::Return(modes)); - } - - void setupV1_AwareDisabledApIfaceCombination() { - // clang-format off - const hidl_vec combinationsSta = { - {{{{IfaceConcurrencyType::STA}, 1}, - {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN}, 1}}} - }; - const std::vector modes = { - {feature_flags::chip_mode_ids::kV1Sta, combinationsSta} - }; - // clang-format on - EXPECT_CALL(*feature_flags_, getChipModes(true)).WillRepeatedly(testing::Return(modes)); - } - - void setupV2_AwareIfaceCombination() { - // clang-format off - const hidl_vec combinations = { - {{{{IfaceConcurrencyType::STA}, 1}, {{IfaceConcurrencyType::AP}, 1}}}, - {{{{IfaceConcurrencyType::STA}, 1}, - {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN}, 1}}} - }; - const std::vector modes = { - {feature_flags::chip_mode_ids::kV3, combinations} - }; - // clang-format on - EXPECT_CALL(*feature_flags_, getChipModes(true)).WillRepeatedly(testing::Return(modes)); - } - - void setupV2_AwareDisabledApIfaceCombination() { - // clang-format off - const hidl_vec combinations = { - {{{{IfaceConcurrencyType::STA}, 1}, - {{IfaceConcurrencyType::P2P, IfaceConcurrencyType::NAN}, 1}}} - }; - const std::vector modes = { - {feature_flags::chip_mode_ids::kV3, combinations} - }; - // clang-format on - EXPECT_CALL(*feature_flags_, getChipModes(true)).WillRepeatedly(testing::Return(modes)); - } - - void setup_MultiIfaceCombination() { - // clang-format off - const hidl_vec combinations = { - {{{{IfaceConcurrencyType::STA}, 3}, {{IfaceConcurrencyType::AP}, 1}}} - }; - const std::vector modes = { - {feature_flags::chip_mode_ids::kV3, combinations} - }; - // clang-format on - EXPECT_CALL(*feature_flags_, getChipModes(true)).WillRepeatedly(testing::Return(modes)); - } - - void assertNumberOfModes(uint32_t num_modes) { - chip_->getAvailableModes_1_6([num_modes](const WifiStatus& status, - const std::vector& modes) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - // V2_Aware has 1 mode of operation. - ASSERT_EQ(num_modes, modes.size()); - }); - } - - void findModeAndConfigureForIfaceType(const IfaceConcurrencyType& type) { - // This should be aligned with kInvalidModeId in wifi_chip.cpp. - ChipModeId mode_id = UINT32_MAX; - chip_->getAvailableModes_1_6([&mode_id, &type]( - const WifiStatus& status, - const std::vector& modes) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - for (const auto& mode : modes) { - for (const auto& combination : mode.availableCombinations) { - for (const auto& limit : combination.limits) { - if (limit.types.end() != - std::find(limit.types.begin(), limit.types.end(), type)) { - mode_id = mode.id; - } - } - } - } - }); - ASSERT_NE(UINT32_MAX, mode_id); - - chip_->configureChip(mode_id, [](const WifiStatus& status) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - }); - } - - // Returns an empty string on error. - std::string createIface(const IfaceType& type) { - std::string iface_name; - if (type == IfaceType::AP) { - chip_->createApIface( - [&iface_name](const WifiStatus& status, const sp& iface) { - if (WifiStatusCode::SUCCESS == status.code) { - ASSERT_NE(iface.get(), nullptr); - iface->getName([&iface_name](const WifiStatus& status, - const hidl_string& name) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - iface_name = name.c_str(); - }); - } - }); - } else if (type == IfaceType::NAN) { - chip_->createNanIface( - [&iface_name](const WifiStatus& status, - const sp& iface) { - if (WifiStatusCode::SUCCESS == status.code) { - ASSERT_NE(iface.get(), nullptr); - iface->getName([&iface_name](const WifiStatus& status, - const hidl_string& name) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - iface_name = name.c_str(); - }); - } - }); - } else if (type == IfaceType::P2P) { - chip_->createP2pIface( - [&iface_name](const WifiStatus& status, const sp& iface) { - if (WifiStatusCode::SUCCESS == status.code) { - ASSERT_NE(iface.get(), nullptr); - iface->getName([&iface_name](const WifiStatus& status, - const hidl_string& name) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - iface_name = name.c_str(); - }); - } - }); - } else if (type == IfaceType::STA) { - chip_->createStaIface( - [&iface_name](const WifiStatus& status, const sp& iface) { - if (WifiStatusCode::SUCCESS == status.code) { - ASSERT_NE(iface.get(), nullptr); - iface->getName([&iface_name](const WifiStatus& status, - const hidl_string& name) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - iface_name = name.c_str(); - }); - } - }); - } - return iface_name; - } - - void removeIface(const IfaceType& type, const std::string& iface_name) { - if (type == IfaceType::AP) { - chip_->removeApIface(iface_name, [](const WifiStatus& status) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - }); - } else if (type == IfaceType::NAN) { - chip_->removeNanIface(iface_name, [](const WifiStatus& status) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - }); - } else if (type == IfaceType::P2P) { - chip_->removeP2pIface(iface_name, [](const WifiStatus& status) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - }); - } else if (type == IfaceType::STA) { - chip_->removeStaIface(iface_name, [](const WifiStatus& status) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - }); - } - } - - bool createRttController() { - bool success = false; - chip_->createRttController_1_6( - NULL, [&success](const WifiStatus& status, const sp& rtt) { - if (WifiStatusCode::SUCCESS == status.code) { - ASSERT_NE(rtt.get(), nullptr); - success = true; - } - }); - return success; - } - - static void subsystemRestartHandler(const std::string& /*error*/) {} - - sp chip_; - ChipId chip_id_ = kFakeChipId; - legacy_hal::wifi_hal_fn fake_func_table_; - std::shared_ptr> iface_tool_{ - new NiceMock}; - std::shared_ptr> legacy_hal_{ - new NiceMock(iface_tool_, fake_func_table_, true)}; - std::shared_ptr> mode_controller_{ - new NiceMock}; - std::shared_ptr> iface_util_{ - new NiceMock(iface_tool_, legacy_hal_)}; - std::shared_ptr> feature_flags_{ - new NiceMock}; - - public: - void SetUp() override { - chip_ = new WifiChip(chip_id_, true, legacy_hal_, mode_controller_, iface_util_, - feature_flags_, subsystemRestartHandler); - - EXPECT_CALL(*mode_controller_, changeFirmwareMode(testing::_)) - .WillRepeatedly(testing::Return(true)); - EXPECT_CALL(*legacy_hal_, start()) - .WillRepeatedly(testing::Return(legacy_hal::WIFI_SUCCESS)); - // Vendor HAL does not override the name by default. - EXPECT_CALL(*legacy_hal_, getSupportedIfaceName(testing::_, testing::_)) - .WillRepeatedly(testing::Return(legacy_hal::WIFI_ERROR_UNKNOWN)); - } - - void TearDown() override { - // Restore default system iface names (This should ideally be using a - // mock). - property_set("wifi.interface", "wlan0"); - property_set("wifi.concurrent.interface", "wlan1"); - property_set("wifi.aware.interface", nullptr); - } -}; - -////////// V1 Iface Combinations //////////// -// Mode 1 - STA + P2P -// Mode 2 - AP -class WifiChipV1IfaceCombinationTest : public WifiChipTest { - public: - void SetUp() override { - setupV1IfaceCombination(); - WifiChipTest::SetUp(); - // V1 has 2 modes of operation. - assertNumberOfModes(2u); - } -}; - -TEST_F(WifiChipV1IfaceCombinationTest, StaMode_CreateSta_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); -} - -TEST_F(WifiChipV1IfaceCombinationTest, StaMode_CreateP2p_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::P2P).empty()); -} - -TEST_F(WifiChipV1IfaceCombinationTest, StaMode_CreateNan_ShouldFail) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_TRUE(createIface(IfaceType::NAN).empty()); -} - -TEST_F(WifiChipV1IfaceCombinationTest, StaMode_CreateAp_ShouldFail) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_TRUE(createIface(IfaceType::AP).empty()); -} - -TEST_F(WifiChipV1IfaceCombinationTest, StaMode_CreateStaP2p_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::STA).empty()); - ASSERT_FALSE(createIface(IfaceType::P2P).empty()); -} - -TEST_F(WifiChipV1IfaceCombinationTest, ApMode_CreateAp_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - ASSERT_EQ(createIface(IfaceType::AP), "wlan0"); -} - -TEST_F(WifiChipV1IfaceCombinationTest, ApMode_CreateSta_ShouldFail) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - ASSERT_TRUE(createIface(IfaceType::STA).empty()); -} - -TEST_F(WifiChipV1IfaceCombinationTest, ApMode_CreateP2p_ShouldFail) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - ASSERT_TRUE(createIface(IfaceType::STA).empty()); -} - -TEST_F(WifiChipV1IfaceCombinationTest, ApMode_CreateNan_ShouldFail) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - ASSERT_TRUE(createIface(IfaceType::NAN).empty()); -} - -////////// V1 + Aware Iface Combinations //////////// -// Mode 1 - STA + P2P/NAN -// Mode 2 - AP -class WifiChipV1_AwareIfaceCombinationTest : public WifiChipTest { - public: - void SetUp() override { - setupV1_AwareIfaceCombination(); - WifiChipTest::SetUp(); - // V1_Aware has 2 modes of operation. - assertNumberOfModes(2u); - } -}; - -TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateSta_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); -} - -TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateP2p_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::P2P).empty()); -} - -TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateNan_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::NAN).empty()); -} - -TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateAp_ShouldFail) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_TRUE(createIface(IfaceType::AP).empty()); -} - -TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaP2p_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::STA).empty()); - ASSERT_FALSE(createIface(IfaceType::P2P).empty()); -} - -TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaNan_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::STA).empty()); - ASSERT_FALSE(createIface(IfaceType::NAN).empty()); -} - -TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaP2PNan_ShouldFail) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::STA).empty()); - ASSERT_FALSE(createIface(IfaceType::P2P).empty()); - ASSERT_TRUE(createIface(IfaceType::NAN).empty()); -} - -TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaNan_AfterP2pRemove_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::STA).empty()); - const auto p2p_iface_name = createIface(IfaceType::P2P); - ASSERT_FALSE(p2p_iface_name.empty()); - ASSERT_TRUE(createIface(IfaceType::NAN).empty()); - - // After removing P2P iface, NAN iface creation should succeed. - removeIface(IfaceType::P2P, p2p_iface_name); - ASSERT_FALSE(createIface(IfaceType::NAN).empty()); -} - -TEST_F(WifiChipV1_AwareIfaceCombinationTest, StaMode_CreateStaP2p_AfterNanRemove_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::STA).empty()); - const auto nan_iface_name = createIface(IfaceType::NAN); - ASSERT_FALSE(nan_iface_name.empty()); - ASSERT_TRUE(createIface(IfaceType::P2P).empty()); - - // After removing NAN iface, P2P iface creation should succeed. - removeIface(IfaceType::NAN, nan_iface_name); - ASSERT_FALSE(createIface(IfaceType::P2P).empty()); -} - -TEST_F(WifiChipV1_AwareIfaceCombinationTest, ApMode_CreateAp_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - ASSERT_EQ(createIface(IfaceType::AP), "wlan0"); -} - -TEST_F(WifiChipV1_AwareIfaceCombinationTest, ApMode_CreateSta_ShouldFail) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - ASSERT_TRUE(createIface(IfaceType::STA).empty()); -} - -TEST_F(WifiChipV1_AwareIfaceCombinationTest, ApMode_CreateP2p_ShouldFail) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - ASSERT_TRUE(createIface(IfaceType::STA).empty()); -} - -TEST_F(WifiChipV1_AwareIfaceCombinationTest, ApMode_CreateNan_ShouldFail) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - ASSERT_TRUE(createIface(IfaceType::NAN).empty()); -} - -TEST_F(WifiChipV1_AwareIfaceCombinationTest, RttControllerFlowStaModeNoSta) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_TRUE(createRttController()); -} - -TEST_F(WifiChipV1_AwareIfaceCombinationTest, RttControllerFlowStaModeWithSta) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::STA).empty()); - ASSERT_TRUE(createRttController()); -} - -TEST_F(WifiChipV1_AwareIfaceCombinationTest, RttControllerFlowApToSta) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - const auto ap_iface_name = createIface(IfaceType::AP); - ASSERT_FALSE(ap_iface_name.empty()); - ASSERT_FALSE(createRttController()); - - removeIface(IfaceType::AP, ap_iface_name); - - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_TRUE(createRttController()); -} - -TEST_F(WifiChipV1_AwareIfaceCombinationTest, SelectTxScenarioWithOnlySta) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); - EXPECT_CALL(*legacy_hal_, selectTxPowerScenario("wlan0", testing::_)) - .WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS)); - chip_->selectTxPowerScenario_1_2( - V1_2::IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF, - [](const WifiStatus& status) { ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); }); -} - -TEST_F(WifiChipV1_AwareIfaceCombinationTest, SelectTxScenarioWithOnlyAp) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - ASSERT_EQ(createIface(IfaceType::AP), "wlan0"); - EXPECT_CALL(*legacy_hal_, selectTxPowerScenario("wlan0", testing::_)) - .WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS)); - chip_->selectTxPowerScenario_1_2( - V1_2::IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF, - [](const WifiStatus& status) { ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); }); -} - -////////// V2 + Aware Iface Combinations //////////// -// Mode 1 - STA + STA/AP -// - STA + P2P/NAN -class WifiChipV2_AwareIfaceCombinationTest : public WifiChipTest { - public: - void SetUp() override { - setupV2_AwareIfaceCombination(); - WifiChipTest::SetUp(); - // V2_Aware has 1 mode of operation. - assertNumberOfModes(1u); - } -}; - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateSta_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateP2p_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::P2P).empty()); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateNan_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::NAN).empty()); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateAp_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_EQ(createIface(IfaceType::AP), "wlan1"); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaSta_ShouldFail) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); - ASSERT_TRUE(createIface(IfaceType::STA).empty()); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaAp_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); - ASSERT_EQ(createIface(IfaceType::AP), "wlan1"); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateApSta_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - ASSERT_EQ(createIface(IfaceType::AP), "wlan1"); - ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateSta_AfterStaApRemove_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - const auto sta_iface_name = createIface(IfaceType::STA); - ASSERT_FALSE(sta_iface_name.empty()); - const auto ap_iface_name = createIface(IfaceType::AP); - ASSERT_FALSE(ap_iface_name.empty()); - - ASSERT_TRUE(createIface(IfaceType::STA).empty()); - - // After removing AP & STA iface, STA iface creation should succeed. - removeIface(IfaceType::STA, sta_iface_name); - removeIface(IfaceType::AP, ap_iface_name); - ASSERT_FALSE(createIface(IfaceType::STA).empty()); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaP2p_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::STA).empty()); - ASSERT_FALSE(createIface(IfaceType::P2P).empty()); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaNan_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::STA).empty()); - ASSERT_FALSE(createIface(IfaceType::NAN).empty()); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaP2PNan_ShouldFail) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::STA).empty()); - ASSERT_FALSE(createIface(IfaceType::P2P).empty()); - ASSERT_TRUE(createIface(IfaceType::NAN).empty()); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaNan_AfterP2pRemove_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::STA).empty()); - const auto p2p_iface_name = createIface(IfaceType::P2P); - ASSERT_FALSE(p2p_iface_name.empty()); - ASSERT_TRUE(createIface(IfaceType::NAN).empty()); - - // After removing P2P iface, NAN iface creation should succeed. - removeIface(IfaceType::P2P, p2p_iface_name); - ASSERT_FALSE(createIface(IfaceType::NAN).empty()); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaP2p_AfterNanRemove_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::STA).empty()); - const auto nan_iface_name = createIface(IfaceType::NAN); - ASSERT_FALSE(nan_iface_name.empty()); - ASSERT_TRUE(createIface(IfaceType::P2P).empty()); - - // After removing NAN iface, P2P iface creation should succeed. - removeIface(IfaceType::NAN, nan_iface_name); - ASSERT_FALSE(createIface(IfaceType::P2P).empty()); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateApNan_ShouldFail) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - ASSERT_FALSE(createIface(IfaceType::AP).empty()); - ASSERT_TRUE(createIface(IfaceType::NAN).empty()); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateApP2p_ShouldFail) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - ASSERT_FALSE(createIface(IfaceType::AP).empty()); - ASSERT_TRUE(createIface(IfaceType::P2P).empty()); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, StaMode_CreateStaNan_AfterP2pRemove_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::STA).empty()); - const auto p2p_iface_name = createIface(IfaceType::P2P); - ASSERT_FALSE(p2p_iface_name.empty()); - ASSERT_TRUE(createIface(IfaceType::NAN).empty()); - - // After removing P2P iface, NAN iface creation should succeed. - removeIface(IfaceType::P2P, p2p_iface_name); - ASSERT_FALSE(createIface(IfaceType::NAN).empty()); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, StaMode_CreateStaP2p_AfterNanRemove_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::STA).empty()); - const auto nan_iface_name = createIface(IfaceType::NAN); - ASSERT_FALSE(nan_iface_name.empty()); - ASSERT_TRUE(createIface(IfaceType::P2P).empty()); - - // After removing NAN iface, P2P iface creation should succeed. - removeIface(IfaceType::NAN, nan_iface_name); - ASSERT_FALSE(createIface(IfaceType::P2P).empty()); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateStaAp_EnsureDifferentIfaceNames) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - const auto sta_iface_name = createIface(IfaceType::STA); - const auto ap_iface_name = createIface(IfaceType::AP); - ASSERT_FALSE(sta_iface_name.empty()); - ASSERT_FALSE(ap_iface_name.empty()); - ASSERT_NE(sta_iface_name, ap_iface_name); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, RttControllerFlowStaModeNoSta) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_TRUE(createRttController()); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, RttControllerFlowStaModeWithSta) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::STA).empty()); - ASSERT_TRUE(createRttController()); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, RttControllerFlow) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::STA).empty()); - ASSERT_FALSE(createIface(IfaceType::AP).empty()); - ASSERT_TRUE(createRttController()); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, SelectTxScenarioWithOnlySta) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); - EXPECT_CALL(*legacy_hal_, selectTxPowerScenario("wlan0", testing::_)) - .WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS)); - chip_->selectTxPowerScenario_1_2( - V1_2::IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF, - [](const WifiStatus& status) { ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); }); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, SelectTxScenarioWithOnlyAp) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::AP); - ASSERT_EQ(createIface(IfaceType::AP), "wlan1"); - EXPECT_CALL(*legacy_hal_, selectTxPowerScenario("wlan1", testing::_)) - .WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS)); - chip_->selectTxPowerScenario_1_2( - V1_2::IWifiChip::TxPowerScenario::ON_HEAD_CELL_OFF, - [](const WifiStatus& status) { ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); }); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, InvalidateAndRemoveNanOnStaRemove) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); - - // Create NAN iface - ASSERT_EQ(createIface(IfaceType::NAN), "wlan0"); - - // We should have 1 nan iface. - chip_->getNanIfaceNames([](const WifiStatus& status, const hidl_vec& iface_names) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - ASSERT_EQ(iface_names.size(), 1u); - ASSERT_EQ(iface_names[0], "wlan0"); - }); - // Retrieve the exact iface object. - sp nan_iface; - chip_->getNanIface("wlan0", - [&nan_iface](const WifiStatus& status, - const sp& iface) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - ASSERT_NE(iface.get(), nullptr); - nan_iface = iface; - }); - - // Remove the STA iface. - removeIface(IfaceType::STA, "wlan0"); - // We should have 0 nan iface now. - chip_->getNanIfaceNames([](const WifiStatus& status, const hidl_vec& iface_names) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - ASSERT_EQ(iface_names.size(), 0u); - }); - // Any operation on the nan iface object should return error now. - nan_iface->getName([](const WifiStatus& status, const std::string& /* iface_name */) { - ASSERT_EQ(WifiStatusCode::ERROR_WIFI_IFACE_INVALID, status.code); - }); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, InvalidateAndRemoveRttControllerOnStaRemove) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); - - // Create RTT controller - sp rtt_controller; - chip_->createRttController_1_6( - NULL, [&rtt_controller](const WifiStatus& status, const sp& rtt) { - if (WifiStatusCode::SUCCESS == status.code) { - ASSERT_NE(rtt.get(), nullptr); - rtt_controller = rtt; - } - }); - - // Remove the STA iface. - removeIface(IfaceType::STA, "wlan0"); - - // Any operation on the rtt controller object should return error now. - rtt_controller->getBoundIface([](const WifiStatus& status, const sp& /* iface */) { - ASSERT_EQ(WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, status.code); - }); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateNanWithSharedNanIface) { - property_set("wifi.aware.interface", nullptr); - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); - ASSERT_EQ(createIface(IfaceType::NAN), "wlan0"); - removeIface(IfaceType::NAN, "wlan0"); - EXPECT_CALL(*iface_util_, setUpState(testing::_, testing::_)).Times(0); -} - -TEST_F(WifiChipV2_AwareIfaceCombinationTest, CreateNanWithDedicatedNanIface) { - property_set("wifi.aware.interface", "aware0"); - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); - EXPECT_CALL(*iface_util_, ifNameToIndex("aware0")).WillOnce(testing::Return(4)); - EXPECT_CALL(*iface_util_, setUpState("aware0", true)).WillOnce(testing::Return(true)); - ASSERT_EQ(createIface(IfaceType::NAN), "aware0"); - - EXPECT_CALL(*iface_util_, setUpState("aware0", false)).WillOnce(testing::Return(true)); - removeIface(IfaceType::NAN, "aware0"); -} - -////////// V1 Iface Combinations when AP creation is disabled ////////// -class WifiChipV1_AwareDisabledApIfaceCombinationTest : public WifiChipTest { - public: - void SetUp() override { - setupV1_AwareDisabledApIfaceCombination(); - WifiChipTest::SetUp(); - } -}; - -TEST_F(WifiChipV1_AwareDisabledApIfaceCombinationTest, StaMode_CreateSta_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::STA).empty()); - ASSERT_TRUE(createIface(IfaceType::AP).empty()); -} - -////////// V2 Iface Combinations when AP creation is disabled ////////// -class WifiChipV2_AwareDisabledApIfaceCombinationTest : public WifiChipTest { - public: - void SetUp() override { - setupV2_AwareDisabledApIfaceCombination(); - WifiChipTest::SetUp(); - } -}; - -TEST_F(WifiChipV2_AwareDisabledApIfaceCombinationTest, CreateSta_ShouldSucceed) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::STA).empty()); - ASSERT_TRUE(createIface(IfaceType::AP).empty()); -} - -////////// Hypothetical Iface Combination with multiple ifaces ////////// -class WifiChip_MultiIfaceTest : public WifiChipTest { - public: - void SetUp() override { - setup_MultiIfaceCombination(); - WifiChipTest::SetUp(); - } -}; - -TEST_F(WifiChip_MultiIfaceTest, Create3Sta) { - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_FALSE(createIface(IfaceType::STA).empty()); - ASSERT_FALSE(createIface(IfaceType::STA).empty()); - ASSERT_FALSE(createIface(IfaceType::STA).empty()); - ASSERT_TRUE(createIface(IfaceType::STA).empty()); -} - -TEST_F(WifiChip_MultiIfaceTest, CreateStaWithDefaultNames) { - property_set("wifi.interface.0", ""); - property_set("wifi.interface.1", ""); - property_set("wifi.interface.2", ""); - property_set("wifi.interface", ""); - property_set("wifi.concurrent.interface", ""); - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); - ASSERT_EQ(createIface(IfaceType::STA), "wlan1"); - ASSERT_EQ(createIface(IfaceType::STA), "wlan2"); -} - -TEST_F(WifiChip_MultiIfaceTest, CreateStaWithCustomNames) { - property_set("wifi.interface.0", "test0"); - property_set("wifi.interface.1", "test1"); - property_set("wifi.interface.2", "test2"); - property_set("wifi.interface", "bad0"); - property_set("wifi.concurrent.interface", "bad1"); - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_EQ(createIface(IfaceType::STA), "bad0"); - ASSERT_EQ(createIface(IfaceType::STA), "bad1"); - ASSERT_EQ(createIface(IfaceType::STA), "test2"); -} - -TEST_F(WifiChip_MultiIfaceTest, CreateStaWithCustomAltNames) { - property_set("wifi.interface.0", ""); - property_set("wifi.interface.1", ""); - property_set("wifi.interface.2", ""); - property_set("wifi.interface", "testA0"); - property_set("wifi.concurrent.interface", "testA1"); - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - ASSERT_EQ(createIface(IfaceType::STA), "testA0"); - ASSERT_EQ(createIface(IfaceType::STA), "testA1"); - ASSERT_EQ(createIface(IfaceType::STA), "wlan2"); -} - -TEST_F(WifiChip_MultiIfaceTest, CreateApStartsWithIdx1) { - // WifiChip_MultiIfaceTest iface combo: STAx3 + APx1 - // When the HAL support dual STAs, AP should start with idx 2. - findModeAndConfigureForIfaceType(IfaceConcurrencyType::STA); - // First AP will be slotted to wlan1. - ASSERT_EQ(createIface(IfaceType::AP), "wlan2"); - // First STA will be slotted to wlan0. - ASSERT_EQ(createIface(IfaceType::STA), "wlan0"); - // All further STA will be slotted to the remaining free indices. - ASSERT_EQ(createIface(IfaceType::STA), "wlan1"); - ASSERT_EQ(createIface(IfaceType::STA), "wlan3"); -} -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/tests/wifi_iface_util_unit_tests.cpp b/wifi/1.6/default/tests/wifi_iface_util_unit_tests.cpp deleted file mode 100644 index cc9a3340a5..0000000000 --- a/wifi/1.6/default/tests/wifi_iface_util_unit_tests.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2019, 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. - */ - -#include -#include -#include - -#undef NAN -#include "wifi_iface_util.h" - -#include "mock_interface_tool.h" -#include "mock_wifi_legacy_hal.h" - -using testing::NiceMock; -using testing::Test; - -namespace { -constexpr uint8_t kValidUnicastLocallyAssignedMacAddressMask = 0x02; -constexpr uint8_t kMacAddress[] = {0x02, 0x12, 0x45, 0x56, 0xab, 0xcc}; -constexpr char kIfaceName[] = "test-wlan0"; - -bool isValidUnicastLocallyAssignedMacAddress(const std::array& mac_address) { - uint8_t first_byte = mac_address[0]; - return (first_byte & 0x3) == kValidUnicastLocallyAssignedMacAddressMask; -} -} // namespace - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace iface_util { -class WifiIfaceUtilTest : public Test { - protected: - std::shared_ptr> iface_tool_{ - new NiceMock}; - legacy_hal::wifi_hal_fn fake_func_table_; - std::shared_ptr> legacy_hal_{ - new NiceMock(iface_tool_, fake_func_table_, true)}; - WifiIfaceUtil* iface_util_ = new WifiIfaceUtil(iface_tool_, legacy_hal_); -}; - -TEST_F(WifiIfaceUtilTest, GetOrCreateRandomMacAddress) { - auto mac_address = iface_util_->getOrCreateRandomMacAddress(); - ASSERT_TRUE(isValidUnicastLocallyAssignedMacAddress(mac_address)); - - // All further calls should return the same MAC address. - ASSERT_EQ(mac_address, iface_util_->getOrCreateRandomMacAddress()); - ASSERT_EQ(mac_address, iface_util_->getOrCreateRandomMacAddress()); -} - -TEST_F(WifiIfaceUtilTest, IfaceEventHandlers_SetMacAddress) { - std::array mac_address = {}; - std::copy(std::begin(kMacAddress), std::end(kMacAddress), std::begin(mac_address)); - EXPECT_CALL(*iface_tool_, SetMacAddress(testing::_, testing::_)) - .WillRepeatedly(testing::Return(true)); - EXPECT_CALL(*iface_tool_, SetUpState(testing::_, testing::_)) - .WillRepeatedly(testing::Return(true)); - - // Register for iface state toggle events. - bool callback_invoked = false; - iface_util::IfaceEventHandlers event_handlers = {}; - event_handlers.on_state_toggle_off_on = - [&callback_invoked](const std::string& /* iface_name */) { callback_invoked = true; }; - iface_util_->registerIfaceEventHandlers(kIfaceName, event_handlers); - // Invoke setMacAddress and ensure that the cb is invoked. - ASSERT_TRUE(iface_util_->setMacAddress(kIfaceName, mac_address)); - ASSERT_TRUE(callback_invoked); - - // Unregister for iface state toggle events. - callback_invoked = false; - iface_util_->unregisterIfaceEventHandlers(kIfaceName); - // Invoke setMacAddress and ensure that the cb is not invoked. - ASSERT_TRUE(iface_util_->setMacAddress(kIfaceName, mac_address)); - ASSERT_FALSE(callback_invoked); -} -} // namespace iface_util -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/tests/wifi_nan_iface_unit_tests.cpp b/wifi/1.6/default/tests/wifi_nan_iface_unit_tests.cpp deleted file mode 100644 index 8a5ddcd998..0000000000 --- a/wifi/1.6/default/tests/wifi_nan_iface_unit_tests.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (C) 2019, 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. - */ - -#include -#include -#include -#include - -#undef NAN // This is weird, NAN is defined in bionic/libc/include/math.h:38 -#include "wifi_nan_iface.h" - -#include "mock_interface_tool.h" -#include "mock_wifi_feature_flags.h" -#include "mock_wifi_iface_util.h" -#include "mock_wifi_legacy_hal.h" - -using testing::NiceMock; -using testing::Return; -using testing::Test; - -namespace { -constexpr char kIfaceName[] = "mockWlan0"; -} // namespace - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { - -using android::hardware::wifi::V1_2::NanDataPathConfirmInd; - -bool CaptureIfaceEventHandlers(const std::string& /* iface_name*/, - iface_util::IfaceEventHandlers in_iface_event_handlers, - iface_util::IfaceEventHandlers* out_iface_event_handlers) { - *out_iface_event_handlers = in_iface_event_handlers; - return true; -} - -class MockNanIfaceEventCallback : public V1_5::IWifiNanIfaceEventCallback { - public: - MockNanIfaceEventCallback() = default; - - MOCK_METHOD3(notifyCapabilitiesResponse, - Return(uint16_t, const WifiNanStatus&, - const android::hardware::wifi::V1_0::NanCapabilities&)); - MOCK_METHOD2(notifyEnableResponse, Return(uint16_t, const WifiNanStatus&)); - MOCK_METHOD2(notifyConfigResponse, Return(uint16_t, const WifiNanStatus&)); - MOCK_METHOD2(notifyDisableResponse, Return(uint16_t, const WifiNanStatus&)); - MOCK_METHOD3(notifyStartPublishResponse, Return(uint16_t, const WifiNanStatus&, uint8_t)); - MOCK_METHOD2(notifyStopPublishResponse, Return(uint16_t, const WifiNanStatus&)); - MOCK_METHOD3(notifyStartSubscribeResponse, - Return(uint16_t, const WifiNanStatus&, uint8_t)); - MOCK_METHOD2(notifyStopSubscribeResponse, Return(uint16_t, const WifiNanStatus&)); - MOCK_METHOD2(notifyTransmitFollowupResponse, Return(uint16_t, const WifiNanStatus&)); - MOCK_METHOD2(notifyCreateDataInterfaceResponse, Return(uint16_t, const WifiNanStatus&)); - MOCK_METHOD2(notifyDeleteDataInterfaceResponse, Return(uint16_t, const WifiNanStatus&)); - MOCK_METHOD3(notifyInitiateDataPathResponse, - Return(uint16_t, const WifiNanStatus&, uint32_t)); - MOCK_METHOD2(notifyRespondToDataPathIndicationResponse, - Return(uint16_t, const WifiNanStatus&)); - MOCK_METHOD2(notifyTerminateDataPathResponse, Return(uint16_t, const WifiNanStatus&)); - MOCK_METHOD1(eventClusterEvent, Return(const NanClusterEventInd&)); - MOCK_METHOD1(eventDisabled, Return(const WifiNanStatus&)); - MOCK_METHOD2(eventPublishTerminated, Return(uint8_t, const WifiNanStatus&)); - MOCK_METHOD2(eventSubscribeTerminated, Return(uint8_t, const WifiNanStatus&)); - MOCK_METHOD1(eventMatch, Return(const V1_0::NanMatchInd&)); - MOCK_METHOD1(eventMatch_1_6, Return(const NanMatchInd&)); - MOCK_METHOD2(eventMatchExpired, Return(uint8_t, uint32_t)); - MOCK_METHOD1(eventFollowupReceived, Return(const NanFollowupReceivedInd&)); - MOCK_METHOD2(eventTransmitFollowup, Return(uint16_t, const WifiNanStatus&)); - MOCK_METHOD1(eventDataPathRequest, Return(const NanDataPathRequestInd&)); - MOCK_METHOD1(eventDataPathConfirm, - Return(const android::hardware::wifi::V1_0::NanDataPathConfirmInd&)); - MOCK_METHOD1(eventDataPathTerminated, Return(uint32_t)); - MOCK_METHOD1(eventDataPathConfirm_1_2, - Return(const android::hardware::wifi::V1_2::NanDataPathConfirmInd&)); - MOCK_METHOD1(eventDataPathConfirm_1_6, Return(const NanDataPathConfirmInd&)); - MOCK_METHOD1(eventDataPathScheduleUpdate, - Return(const android::hardware::wifi::V1_2::NanDataPathScheduleUpdateInd&)); - MOCK_METHOD1(eventDataPathScheduleUpdate_1_6, - Return(const NanDataPathScheduleUpdateInd&)); - MOCK_METHOD3(notifyCapabilitiesResponse_1_5, - Return(uint16_t, const WifiNanStatus&, const V1_5::NanCapabilities&)); -}; - -class WifiNanIfaceTest : public Test { - protected: - legacy_hal::wifi_hal_fn fake_func_table_; - std::shared_ptr> iface_tool_{ - new NiceMock}; - std::shared_ptr> legacy_hal_{ - new NiceMock(iface_tool_, fake_func_table_, true)}; - std::shared_ptr> iface_util_{ - new NiceMock(iface_tool_, legacy_hal_)}; -}; - -TEST_F(WifiNanIfaceTest, IfacEventHandlers_OnStateToggleOffOn) { - iface_util::IfaceEventHandlers captured_iface_event_handlers = {}; - EXPECT_CALL(*legacy_hal_, nanRegisterCallbackHandlers(testing::_, testing::_)) - .WillOnce(testing::Return(legacy_hal::WIFI_SUCCESS)); - EXPECT_CALL(*iface_util_, registerIfaceEventHandlers(testing::_, testing::_)) - .WillOnce(testing::Invoke(bind(CaptureIfaceEventHandlers, std::placeholders::_1, - std::placeholders::_2, &captured_iface_event_handlers))); - sp nan_iface = new WifiNanIface(kIfaceName, false, legacy_hal_, iface_util_); - - // Register a mock nan event callback. - sp> mock_event_callback{ - new NiceMock}; - nan_iface->registerEventCallback(mock_event_callback, [](const WifiStatus& status) { - ASSERT_EQ(WifiStatusCode::SUCCESS, status.code); - }); - // Ensure that the eventDisabled() function in mock callback will be - // invoked. - WifiNanStatus expected_nan_status = {NanStatusType::UNSUPPORTED_CONCURRENCY_NAN_DISABLED, ""}; - EXPECT_CALL(*mock_event_callback, eventDisabled(expected_nan_status)).Times(1); - - // Trigger the iface state toggle callback. - captured_iface_event_handlers.on_state_toggle_off_on(kIfaceName); -} -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/wifi.cpp b/wifi/1.6/default/wifi.cpp deleted file mode 100644 index c302ce2434..0000000000 --- a/wifi/1.6/default/wifi.cpp +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#include - -#include "hidl_return_util.h" -#include "wifi.h" -#include "wifi_status_util.h" - -namespace { -// Starting Chip ID, will be assigned to primary chip -static constexpr android::hardware::wifi::V1_0::ChipId kPrimaryChipId = 0; -} // namespace - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -using hidl_return_util::validateAndCall; -using hidl_return_util::validateAndCallWithLock; - -Wifi::Wifi(const std::shared_ptr iface_tool, - const std::shared_ptr legacy_hal_factory, - const std::shared_ptr mode_controller, - const std::shared_ptr feature_flags) - : iface_tool_(iface_tool), - legacy_hal_factory_(legacy_hal_factory), - mode_controller_(mode_controller), - feature_flags_(feature_flags), - run_state_(RunState::STOPPED) {} - -bool Wifi::isValid() { - // This object is always valid. - return true; -} - -Return Wifi::registerEventCallback(const sp& event_callback, - registerEventCallback_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN, - &Wifi::registerEventCallbackInternal, hidl_status_cb, event_callback); -} - -Return Wifi::registerEventCallback_1_5(const sp& event_callback, - registerEventCallback_1_5_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN, - &Wifi::registerEventCallbackInternal_1_5, hidl_status_cb, - event_callback); -} - -Return Wifi::isStarted() { - return run_state_ != RunState::STOPPED; -} - -Return Wifi::start(start_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN, &Wifi::startInternal, - hidl_status_cb); -} - -Return Wifi::stop(stop_cb hidl_status_cb) { - return validateAndCallWithLock(this, WifiStatusCode::ERROR_UNKNOWN, &Wifi::stopInternal, - hidl_status_cb); -} - -Return Wifi::getChipIds(getChipIds_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN, &Wifi::getChipIdsInternal, - hidl_status_cb); -} - -Return Wifi::getChip(ChipId chip_id, getChip_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_UNKNOWN, &Wifi::getChipInternal, - hidl_status_cb, chip_id); -} - -Return Wifi::debug(const hidl_handle& handle, const hidl_vec&) { - LOG(INFO) << "-----------Debug is called----------------"; - if (chips_.size() == 0) { - return Void(); - } - - for (sp chip : chips_) { - if (!chip.get()) continue; - - chip->debug(handle, {}); - } - return Void(); -} - -WifiStatus Wifi::registerEventCallbackInternal( - const sp& event_callback __unused) { - // Deprecated support for this callback. - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus Wifi::registerEventCallbackInternal_1_5( - const sp& event_callback) { - if (!event_cb_handler_.addCallback(event_callback)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -WifiStatus Wifi::startInternal() { - if (run_state_ == RunState::STARTED) { - return createWifiStatus(WifiStatusCode::SUCCESS); - } else if (run_state_ == RunState::STOPPING) { - return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE, "HAL is stopping"); - } - WifiStatus wifi_status = initializeModeControllerAndLegacyHal(); - if (wifi_status.code == WifiStatusCode::SUCCESS) { - // Register the callback for subsystem restart - const auto& on_subsystem_restart_callback = [this](const std::string& error) { - WifiStatus wifi_status = createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, error); - for (const auto& callback : event_cb_handler_.getCallbacks()) { - LOG(INFO) << "Attempting to invoke onSubsystemRestart " - "callback"; - if (!callback->onSubsystemRestart(wifi_status).isOk()) { - LOG(ERROR) << "Failed to invoke onSubsystemRestart callback"; - } else { - LOG(INFO) << "Succeeded to invoke onSubsystemRestart " - "callback"; - } - } - }; - - // Create the chip instance once the HAL is started. - android::hardware::wifi::V1_0::ChipId chipId = kPrimaryChipId; - for (auto& hal : legacy_hals_) { - chips_.push_back( - new WifiChip(chipId, chipId == kPrimaryChipId, hal, mode_controller_, - std::make_shared(iface_tool_, hal), - feature_flags_, on_subsystem_restart_callback)); - chipId++; - } - run_state_ = RunState::STARTED; - for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onStart().isOk()) { - LOG(ERROR) << "Failed to invoke onStart callback"; - }; - } - LOG(INFO) << "Wifi HAL started"; - } else { - for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onFailure(wifi_status).isOk()) { - LOG(ERROR) << "Failed to invoke onFailure callback"; - } - } - LOG(ERROR) << "Wifi HAL start failed"; - // Clear the event callback objects since the HAL start failed. - event_cb_handler_.invalidate(); - } - return wifi_status; -} - -WifiStatus Wifi::stopInternal( - /* NONNULL */ std::unique_lock* lock) { - if (run_state_ == RunState::STOPPED) { - return createWifiStatus(WifiStatusCode::SUCCESS); - } else if (run_state_ == RunState::STOPPING) { - return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE, "HAL is stopping"); - } - // Clear the chip object and its child objects since the HAL is now - // stopped. - for (auto& chip : chips_) { - if (chip.get()) { - chip->invalidate(); - chip.clear(); - } - } - chips_.clear(); - WifiStatus wifi_status = stopLegacyHalAndDeinitializeModeController(lock); - if (wifi_status.code == WifiStatusCode::SUCCESS) { - for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onStop().isOk()) { - LOG(ERROR) << "Failed to invoke onStop callback"; - }; - } - LOG(INFO) << "Wifi HAL stopped"; - } else { - for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onFailure(wifi_status).isOk()) { - LOG(ERROR) << "Failed to invoke onFailure callback"; - } - } - LOG(ERROR) << "Wifi HAL stop failed"; - } - // Clear the event callback objects since the HAL is now stopped. - event_cb_handler_.invalidate(); - return wifi_status; -} - -std::pair> Wifi::getChipIdsInternal() { - std::vector chip_ids; - - for (auto& chip : chips_) { - ChipId chip_id = getChipIdFromWifiChip(chip); - if (chip_id != UINT32_MAX) chip_ids.emplace_back(chip_id); - } - return {createWifiStatus(WifiStatusCode::SUCCESS), std::move(chip_ids)}; -} - -std::pair> Wifi::getChipInternal(ChipId chip_id) { - for (auto& chip : chips_) { - ChipId cand_id = getChipIdFromWifiChip(chip); - if ((cand_id != UINT32_MAX) && (cand_id == chip_id)) - return {createWifiStatus(WifiStatusCode::SUCCESS), chip}; - } - - return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr}; -} - -WifiStatus Wifi::initializeModeControllerAndLegacyHal() { - if (!mode_controller_->initialize()) { - LOG(ERROR) << "Failed to initialize firmware mode controller"; - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - - legacy_hals_ = legacy_hal_factory_->getHals(); - if (legacy_hals_.empty()) return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - int index = 0; // for failure log - for (auto& hal : legacy_hals_) { - legacy_hal::wifi_error legacy_status = hal->initialize(); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - // Currently WifiLegacyHal::initialize does not allocate extra mem, - // only initializes the function table. If this changes, need to - // implement WifiLegacyHal::deinitialize and deinitalize the - // HALs already initialized - LOG(ERROR) << "Failed to initialize legacy HAL index: " << index - << " error: " << legacyErrorToString(legacy_status); - return createWifiStatusFromLegacyError(legacy_status); - } - index++; - } - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -WifiStatus Wifi::stopLegacyHalAndDeinitializeModeController( - /* NONNULL */ std::unique_lock* lock) { - legacy_hal::wifi_error legacy_status = legacy_hal::WIFI_SUCCESS; - int index = 0; - - run_state_ = RunState::STOPPING; - for (auto& hal : legacy_hals_) { - legacy_hal::wifi_error tmp = hal->stop(lock, [&]() {}); - if (tmp != legacy_hal::WIFI_SUCCESS) { - LOG(ERROR) << "Failed to stop legacy HAL index: " << index - << " error: " << legacyErrorToString(legacy_status); - legacy_status = tmp; - } - index++; - } - run_state_ = RunState::STOPPED; - - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - LOG(ERROR) << "One or more legacy HALs failed to stop"; - return createWifiStatusFromLegacyError(legacy_status); - } - if (!mode_controller_->deinitialize()) { - LOG(ERROR) << "Failed to deinitialize firmware mode controller"; - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -ChipId Wifi::getChipIdFromWifiChip(sp& chip) { - ChipId chip_id = UINT32_MAX; - if (chip.get()) { - chip->getId([&](WifiStatus status, uint32_t id) { - if (status.code == WifiStatusCode::SUCCESS) { - chip_id = id; - } - }); - } - - return chip_id; -} -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/wifi.h b/wifi/1.6/default/wifi.h deleted file mode 100644 index 435358e797..0000000000 --- a/wifi/1.6/default/wifi.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef WIFI_H_ -#define WIFI_H_ - -// HACK: NAN is a macro defined in math.h, which can be included in various -// headers. This wifi HAL uses an enum called NAN, which does not compile when -// the macro is defined. Undefine NAN to work around it. -#undef NAN -#include - -#include -#include -#include - -#include "hidl_callback_util.h" -#include "wifi_chip.h" -#include "wifi_feature_flags.h" -#include "wifi_legacy_hal.h" -#include "wifi_legacy_hal_factory.h" -#include "wifi_mode_controller.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { - -/** - * Root HIDL interface object used to control the Wifi HAL. - */ -class Wifi : public V1_6::IWifi { - public: - Wifi(const std::shared_ptr iface_tool, - const std::shared_ptr legacy_hal_factory, - const std::shared_ptr mode_controller, - const std::shared_ptr feature_flags); - - bool isValid(); - - // HIDL methods exposed. - Return registerEventCallback(const sp& event_callback, - registerEventCallback_cb hidl_status_cb) override; - Return registerEventCallback_1_5(const sp& event_callback, - registerEventCallback_1_5_cb hidl_status_cb) override; - Return isStarted() override; - Return start(start_cb hidl_status_cb) override; - Return stop(stop_cb hidl_status_cb) override; - Return getChipIds(getChipIds_cb hidl_status_cb) override; - Return getChip(ChipId chip_id, getChip_cb hidl_status_cb) override; - Return debug(const hidl_handle& handle, const hidl_vec& options) override; - - private: - enum class RunState { STOPPED, STARTED, STOPPING }; - - // Corresponding worker functions for the HIDL methods. - WifiStatus registerEventCallbackInternal( - const sp& event_callback __unused); - WifiStatus registerEventCallbackInternal_1_5( - const sp& event_callback); - WifiStatus startInternal(); - WifiStatus stopInternal(std::unique_lock* lock); - std::pair> getChipIdsInternal(); - std::pair> getChipInternal(ChipId chip_id); - - WifiStatus initializeModeControllerAndLegacyHal(); - WifiStatus stopLegacyHalAndDeinitializeModeController( - std::unique_lock* lock); - ChipId getChipIdFromWifiChip(sp& chip); - - // Instance is created in this root level |IWifi| HIDL interface object - // and shared with all the child HIDL interface objects. - std::shared_ptr iface_tool_; - std::shared_ptr legacy_hal_factory_; - std::shared_ptr mode_controller_; - std::vector> legacy_hals_; - std::shared_ptr feature_flags_; - RunState run_state_; - std::vector> chips_; - hidl_callback_util::HidlCallbackHandler event_cb_handler_; - - DISALLOW_COPY_AND_ASSIGN(Wifi); -}; - -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // WIFI_H_ diff --git a/wifi/1.6/default/wifi_ap_iface.cpp b/wifi/1.6/default/wifi_ap_iface.cpp deleted file mode 100644 index b2957db13f..0000000000 --- a/wifi/1.6/default/wifi_ap_iface.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#include - -#include "hidl_return_util.h" -#include "hidl_struct_util.h" -#include "wifi_ap_iface.h" -#include "wifi_status_util.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -using hidl_return_util::validateAndCall; - -WifiApIface::WifiApIface(const std::string& ifname, const std::vector& instances, - const std::weak_ptr legacy_hal, - const std::weak_ptr iface_util) - : ifname_(ifname), - instances_(instances), - legacy_hal_(legacy_hal), - iface_util_(iface_util), - is_valid_(true) {} - -void WifiApIface::invalidate() { - legacy_hal_.reset(); - is_valid_ = false; -} - -bool WifiApIface::isValid() { - return is_valid_; -} - -std::string WifiApIface::getName() { - return ifname_; -} - -void WifiApIface::removeInstance(std::string instance) { - instances_.erase(std::remove(instances_.begin(), instances_.end(), instance), instances_.end()); -} - -Return WifiApIface::getName(getName_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::getNameInternal, hidl_status_cb); -} - -Return WifiApIface::getType(getType_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::getTypeInternal, hidl_status_cb); -} - -Return WifiApIface::setCountryCode(const hidl_array& code, - setCountryCode_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::setCountryCodeInternal, hidl_status_cb, code); -} - -Return WifiApIface::getValidFrequenciesForBand(V1_0::WifiBand band, - getValidFrequenciesForBand_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::getValidFrequenciesForBandInternal, hidl_status_cb, band); -} - -Return WifiApIface::setMacAddress(const hidl_array& mac, - setMacAddress_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::setMacAddressInternal, hidl_status_cb, mac); -} - -Return WifiApIface::getFactoryMacAddress(getFactoryMacAddress_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::getFactoryMacAddressInternal, hidl_status_cb, - instances_.size() > 0 ? instances_[0] : ifname_); -} - -Return WifiApIface::resetToFactoryMacAddress(resetToFactoryMacAddress_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::resetToFactoryMacAddressInternal, hidl_status_cb); -} - -Return WifiApIface::getBridgedInstances(getBridgedInstances_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiApIface::getBridgedInstancesInternal, hidl_status_cb); -} - -std::pair WifiApIface::getNameInternal() { - return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_}; -} - -std::pair WifiApIface::getTypeInternal() { - return {createWifiStatus(WifiStatusCode::SUCCESS), IfaceType::AP}; -} - -WifiStatus WifiApIface::setCountryCodeInternal(const std::array& code) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->setCountryCode( - instances_.size() > 0 ? instances_[0] : ifname_, code); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair> -WifiApIface::getValidFrequenciesForBandInternal(V1_0::WifiBand band) { - static_assert(sizeof(WifiChannelInMhz) == sizeof(uint32_t), "Size mismatch"); - legacy_hal::wifi_error legacy_status; - std::vector valid_frequencies; - std::tie(legacy_status, valid_frequencies) = legacy_hal_.lock()->getValidFrequenciesForBand( - instances_.size() > 0 ? instances_[0] : ifname_, - hidl_struct_util::convertHidlWifiBandToLegacy(band)); - return {createWifiStatusFromLegacyError(legacy_status), valid_frequencies}; -} - -WifiStatus WifiApIface::setMacAddressInternal(const std::array& mac) { - // Support random MAC up to 2 interfaces - if (instances_.size() == 2) { - int rbyte = 1; - for (auto const& intf : instances_) { - std::array rmac = mac; - // reverse the bits to avoid collision - rmac[rbyte] = 0xff - rmac[rbyte]; - if (!iface_util_.lock()->setMacAddress(intf, rmac)) { - LOG(INFO) << "Failed to set random mac address on " << intf; - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - rbyte++; - } - } - // It also needs to set mac address for bridged interface, otherwise the mac - // address of bridged interface will be changed after one of instance - // down. - if (!iface_util_.lock()->setMacAddress(ifname_, mac)) { - LOG(ERROR) << "Fail to config MAC for interface " << ifname_; - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -std::pair> WifiApIface::getFactoryMacAddressInternal( - const std::string& ifaceName) { - std::array mac = iface_util_.lock()->getFactoryMacAddress(ifaceName); - if (mac[0] == 0 && mac[1] == 0 && mac[2] == 0 && mac[3] == 0 && mac[4] == 0 && mac[5] == 0) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), mac}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), mac}; -} - -WifiStatus WifiApIface::resetToFactoryMacAddressInternal() { - std::pair> getMacResult; - if (instances_.size() == 2) { - for (auto const& intf : instances_) { - getMacResult = getFactoryMacAddressInternal(intf); - LOG(DEBUG) << "Reset MAC to factory MAC on " << intf; - if (getMacResult.first.code != WifiStatusCode::SUCCESS || - !iface_util_.lock()->setMacAddress(intf, getMacResult.second)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - } - // It needs to set mac address for bridged interface, otherwise the mac - // address of the bridged interface will be changed after one of the - // instance down. Thus we are generating a random MAC address for the - // bridged interface even if we got the request to reset the Factory - // MAC. Since the bridged interface is an internal interface for the - // operation of bpf and others networking operation. - if (!iface_util_.lock()->setMacAddress(ifname_, - iface_util_.lock()->createRandomMacAddress())) { - LOG(ERROR) << "Fail to config MAC for bridged interface " << ifname_; - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - } else { - getMacResult = getFactoryMacAddressInternal(ifname_); - LOG(DEBUG) << "Reset MAC to factory MAC on " << ifname_; - if (getMacResult.first.code != WifiStatusCode::SUCCESS || - !iface_util_.lock()->setMacAddress(ifname_, getMacResult.second)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - } - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -std::pair> WifiApIface::getBridgedInstancesInternal() { - std::vector instances; - for (const auto& instance_name : instances_) { - instances.push_back(instance_name); - } - return {createWifiStatus(WifiStatusCode::SUCCESS), instances}; -} -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/wifi_ap_iface.h b/wifi/1.6/default/wifi_ap_iface.h deleted file mode 100644 index d1c06424df..0000000000 --- a/wifi/1.6/default/wifi_ap_iface.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef WIFI_AP_IFACE_H_ -#define WIFI_AP_IFACE_H_ - -#include -#include - -#include "wifi_iface_util.h" -#include "wifi_legacy_hal.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -using namespace android::hardware::wifi::V1_0; - -/** - * HIDL interface object used to control a AP Iface instance. - */ -class WifiApIface : public V1_5::IWifiApIface { - public: - WifiApIface(const std::string& ifname, const std::vector& instances, - const std::weak_ptr legacy_hal, - const std::weak_ptr iface_util); - // Refer to |WifiChip::invalidate()|. - void invalidate(); - bool isValid(); - std::string getName(); - void removeInstance(std::string instance); - - // HIDL methods exposed. - Return getName(getName_cb hidl_status_cb) override; - Return getType(getType_cb hidl_status_cb) override; - Return setCountryCode(const hidl_array& code, - setCountryCode_cb hidl_status_cb) override; - Return getValidFrequenciesForBand(V1_0::WifiBand band, - getValidFrequenciesForBand_cb hidl_status_cb) override; - Return setMacAddress(const hidl_array& mac, - setMacAddress_cb hidl_status_cb) override; - Return getFactoryMacAddress(getFactoryMacAddress_cb hidl_status_cb) override; - Return resetToFactoryMacAddress(resetToFactoryMacAddress_cb hidl_status_cb) override; - - Return getBridgedInstances(getBridgedInstances_cb hidl_status_cb) override; - - private: - // Corresponding worker functions for the HIDL methods. - std::pair getNameInternal(); - std::pair getTypeInternal(); - WifiStatus setCountryCodeInternal(const std::array& code); - std::pair> getValidFrequenciesForBandInternal( - V1_0::WifiBand band); - WifiStatus setMacAddressInternal(const std::array& mac); - std::pair> getFactoryMacAddressInternal( - const std::string& ifaceName); - WifiStatus resetToFactoryMacAddressInternal(); - std::pair> getBridgedInstancesInternal(); - - std::string ifname_; - std::vector instances_; - std::weak_ptr legacy_hal_; - std::weak_ptr iface_util_; - bool is_valid_; - - DISALLOW_COPY_AND_ASSIGN(WifiApIface); -}; - -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // WIFI_AP_IFACE_H_ diff --git a/wifi/1.6/default/wifi_chip.cpp b/wifi/1.6/default/wifi_chip.cpp deleted file mode 100644 index 920beb8778..0000000000 --- a/wifi/1.6/default/wifi_chip.cpp +++ /dev/null @@ -1,2062 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#include - -#include -#include -#include -#include -#include -#include - -#include "hidl_return_util.h" -#include "hidl_struct_util.h" -#include "wifi_chip.h" -#include "wifi_status_util.h" - -#define P2P_MGMT_DEVICE_PREFIX "p2p-dev-" - -namespace { -using android::sp; -using android::base::unique_fd; -using android::hardware::hidl_string; -using android::hardware::hidl_vec; -using android::hardware::wifi::V1_0::ChipModeId; -using android::hardware::wifi::V1_0::IfaceType; -using android::hardware::wifi::V1_0::IWifiChip; - -constexpr char kCpioMagic[] = "070701"; -constexpr size_t kMaxBufferSizeBytes = 1024 * 1024 * 3; -constexpr uint32_t kMaxRingBufferFileAgeSeconds = 60 * 60 * 10; -constexpr uint32_t kMaxRingBufferFileNum = 20; -constexpr char kTombstoneFolderPath[] = "/data/vendor/tombstones/wifi/"; -constexpr char kActiveWlanIfaceNameProperty[] = "wifi.active.interface"; -constexpr char kNoActiveWlanIfaceNamePropertyValue[] = ""; -constexpr unsigned kMaxWlanIfaces = 5; -constexpr char kApBridgeIfacePrefix[] = "ap_br_"; - -template -void invalidateAndClear(std::vector>& ifaces, sp iface) { - iface->invalidate(); - ifaces.erase(std::remove(ifaces.begin(), ifaces.end(), iface), ifaces.end()); -} - -template -void invalidateAndClearAll(std::vector>& ifaces) { - for (const auto& iface : ifaces) { - iface->invalidate(); - } - ifaces.clear(); -} - -template -std::vector getNames(std::vector>& ifaces) { - std::vector names; - for (const auto& iface : ifaces) { - names.emplace_back(iface->getName()); - } - return names; -} - -template -sp findUsingName(std::vector>& ifaces, const std::string& name) { - std::vector names; - for (const auto& iface : ifaces) { - if (name == iface->getName()) { - return iface; - } - } - return nullptr; -} - -std::string getWlanIfaceName(unsigned idx) { - if (idx >= kMaxWlanIfaces) { - CHECK(false) << "Requested interface beyond wlan" << kMaxWlanIfaces; - return {}; - } - - std::array buffer; - if (idx == 0 || idx == 1) { - const char* altPropName = (idx == 0) ? "wifi.interface" : "wifi.concurrent.interface"; - auto res = property_get(altPropName, buffer.data(), nullptr); - if (res > 0) return buffer.data(); - } - std::string propName = "wifi.interface." + std::to_string(idx); - auto res = property_get(propName.c_str(), buffer.data(), nullptr); - if (res > 0) return buffer.data(); - - return "wlan" + std::to_string(idx); -} - -// Returns the dedicated iface name if defined. -// Returns two ifaces in bridged mode. -std::vector getPredefinedApIfaceNames(bool is_bridged) { - std::vector ifnames; - std::array buffer; - buffer.fill(0); - if (property_get("ro.vendor.wifi.sap.interface", buffer.data(), nullptr) == 0) { - return ifnames; - } - ifnames.push_back(buffer.data()); - if (is_bridged) { - buffer.fill(0); - if (property_get("ro.vendor.wifi.sap.concurrent.iface", buffer.data(), nullptr) == 0) { - return ifnames; - } - ifnames.push_back(buffer.data()); - } - return ifnames; -} - -std::string getPredefinedP2pIfaceName() { - std::array primaryIfaceName; - char p2pParentIfname[100]; - std::string p2pDevIfName = ""; - std::array buffer; - property_get("wifi.direct.interface", buffer.data(), "p2p0"); - if (strncmp(buffer.data(), P2P_MGMT_DEVICE_PREFIX, strlen(P2P_MGMT_DEVICE_PREFIX)) == 0) { - /* Get the p2p parent interface name from p2p device interface name set - * in property */ - strlcpy(p2pParentIfname, buffer.data() + strlen(P2P_MGMT_DEVICE_PREFIX), - strlen(buffer.data()) - strlen(P2P_MGMT_DEVICE_PREFIX)); - if (property_get(kActiveWlanIfaceNameProperty, primaryIfaceName.data(), nullptr) == 0) { - return buffer.data(); - } - /* Check if the parent interface derived from p2p device interface name - * is active */ - if (strncmp(p2pParentIfname, primaryIfaceName.data(), - strlen(buffer.data()) - strlen(P2P_MGMT_DEVICE_PREFIX)) != 0) { - /* - * Update the predefined p2p device interface parent interface name - * with current active wlan interface - */ - p2pDevIfName += P2P_MGMT_DEVICE_PREFIX; - p2pDevIfName += primaryIfaceName.data(); - LOG(INFO) << "update the p2p device interface name to " << p2pDevIfName.c_str(); - return p2pDevIfName; - } - } - return buffer.data(); -} - -// Returns the dedicated iface name if one is defined. -std::string getPredefinedNanIfaceName() { - std::array buffer; - if (property_get("wifi.aware.interface", buffer.data(), nullptr) == 0) { - return {}; - } - return buffer.data(); -} - -void setActiveWlanIfaceNameProperty(const std::string& ifname) { - auto res = property_set(kActiveWlanIfaceNameProperty, ifname.data()); - if (res != 0) { - PLOG(ERROR) << "Failed to set active wlan iface name property"; - } -} - -// delete files that meet either conditions: -// 1. older than a predefined time in the wifi tombstone dir. -// 2. Files in excess to a predefined amount, starting from the oldest ones -bool removeOldFilesInternal() { - time_t now = time(0); - const time_t delete_files_before = now - kMaxRingBufferFileAgeSeconds; - std::unique_ptr dir_dump(opendir(kTombstoneFolderPath), closedir); - if (!dir_dump) { - PLOG(ERROR) << "Failed to open directory"; - return false; - } - struct dirent* dp; - bool success = true; - std::list> valid_files; - while ((dp = readdir(dir_dump.get()))) { - if (dp->d_type != DT_REG) { - continue; - } - std::string cur_file_name(dp->d_name); - struct stat cur_file_stat; - std::string cur_file_path = kTombstoneFolderPath + cur_file_name; - if (stat(cur_file_path.c_str(), &cur_file_stat) == -1) { - PLOG(ERROR) << "Failed to get file stat for " << cur_file_path; - success = false; - continue; - } - const time_t cur_file_time = cur_file_stat.st_mtime; - valid_files.push_back(std::pair(cur_file_time, cur_file_path)); - } - valid_files.sort(); // sort the list of files by last modified time from - // small to big. - uint32_t cur_file_count = valid_files.size(); - for (auto cur_file : valid_files) { - if (cur_file_count > kMaxRingBufferFileNum || cur_file.first < delete_files_before) { - if (unlink(cur_file.second.c_str()) != 0) { - PLOG(ERROR) << "Error deleting file"; - success = false; - } - cur_file_count--; - } else { - break; - } - } - return success; -} - -// Helper function for |cpioArchiveFilesInDir| -bool cpioWriteHeader(int out_fd, struct stat& st, const char* file_name, size_t file_name_len) { - const int buf_size = 32 * 1024; - std::array read_buf; - ssize_t llen = snprintf( - read_buf.data(), buf_size, "%s%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X", - kCpioMagic, static_cast(st.st_ino), st.st_mode, st.st_uid, st.st_gid, - static_cast(st.st_nlink), static_cast(st.st_mtime), - static_cast(st.st_size), major(st.st_dev), minor(st.st_dev), major(st.st_rdev), - minor(st.st_rdev), static_cast(file_name_len), 0); - if (write(out_fd, read_buf.data(), llen < buf_size ? llen : buf_size - 1) == -1) { - PLOG(ERROR) << "Error writing cpio header to file " << file_name; - return false; - } - if (write(out_fd, file_name, file_name_len) == -1) { - PLOG(ERROR) << "Error writing filename to file " << file_name; - return false; - } - - // NUL Pad header up to 4 multiple bytes. - llen = (llen + file_name_len) % 4; - if (llen != 0) { - const uint32_t zero = 0; - if (write(out_fd, &zero, 4 - llen) == -1) { - PLOG(ERROR) << "Error padding 0s to file " << file_name; - return false; - } - } - return true; -} - -// Helper function for |cpioArchiveFilesInDir| -size_t cpioWriteFileContent(int fd_read, int out_fd, struct stat& st) { - // writing content of file - std::array read_buf; - ssize_t llen = st.st_size; - size_t n_error = 0; - while (llen > 0) { - ssize_t bytes_read = read(fd_read, read_buf.data(), read_buf.size()); - if (bytes_read == -1) { - PLOG(ERROR) << "Error reading file"; - return ++n_error; - } - llen -= bytes_read; - if (write(out_fd, read_buf.data(), bytes_read) == -1) { - PLOG(ERROR) << "Error writing data to file"; - return ++n_error; - } - if (bytes_read == 0) { // this should never happen, but just in case - // to unstuck from while loop - PLOG(ERROR) << "Unexpected read result"; - n_error++; - break; - } - } - llen = st.st_size % 4; - if (llen != 0) { - const uint32_t zero = 0; - if (write(out_fd, &zero, 4 - llen) == -1) { - PLOG(ERROR) << "Error padding 0s to file"; - return ++n_error; - } - } - return n_error; -} - -// Helper function for |cpioArchiveFilesInDir| -bool cpioWriteFileTrailer(int out_fd) { - const int buf_size = 4096; - std::array read_buf; - read_buf.fill(0); - ssize_t llen = snprintf(read_buf.data(), 4096, "070701%040X%056X%08XTRAILER!!!", 1, 0x0b, 0); - if (write(out_fd, read_buf.data(), (llen < buf_size ? llen : buf_size - 1) + 4) == -1) { - PLOG(ERROR) << "Error writing trailing bytes"; - return false; - } - return true; -} - -// Archives all files in |input_dir| and writes result into |out_fd| -// Logic obtained from //external/toybox/toys/posix/cpio.c "Output cpio archive" -// portion -size_t cpioArchiveFilesInDir(int out_fd, const char* input_dir) { - struct dirent* dp; - size_t n_error = 0; - std::unique_ptr dir_dump(opendir(input_dir), closedir); - if (!dir_dump) { - PLOG(ERROR) << "Failed to open directory"; - return ++n_error; - } - while ((dp = readdir(dir_dump.get()))) { - if (dp->d_type != DT_REG) { - continue; - } - std::string cur_file_name(dp->d_name); - struct stat st; - const std::string cur_file_path = kTombstoneFolderPath + cur_file_name; - if (stat(cur_file_path.c_str(), &st) == -1) { - PLOG(ERROR) << "Failed to get file stat for " << cur_file_path; - n_error++; - continue; - } - const int fd_read = open(cur_file_path.c_str(), O_RDONLY); - if (fd_read == -1) { - PLOG(ERROR) << "Failed to open file " << cur_file_path; - n_error++; - continue; - } - std::string file_name_with_last_modified_time = - cur_file_name + "-" + std::to_string(st.st_mtime); - // string.size() does not include the null terminator. The cpio FreeBSD - // file header expects the null character to be included in the length. - const size_t file_name_len = file_name_with_last_modified_time.size() + 1; - unique_fd file_auto_closer(fd_read); - if (!cpioWriteHeader(out_fd, st, file_name_with_last_modified_time.c_str(), - file_name_len)) { - return ++n_error; - } - size_t write_error = cpioWriteFileContent(fd_read, out_fd, st); - if (write_error) { - return n_error + write_error; - } - } - if (!cpioWriteFileTrailer(out_fd)) { - return ++n_error; - } - return n_error; -} - -// Helper function to create a non-const char*. -std::vector makeCharVec(const std::string& str) { - std::vector vec(str.size() + 1); - vec.assign(str.begin(), str.end()); - vec.push_back('\0'); - return vec; -} - -} // namespace - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -using hidl_return_util::validateAndCall; -using hidl_return_util::validateAndCallWithLock; - -WifiChip::WifiChip(ChipId chip_id, bool is_primary, - const std::weak_ptr legacy_hal, - const std::weak_ptr mode_controller, - const std::shared_ptr iface_util, - const std::weak_ptr feature_flags, - const std::function& handler) - : chip_id_(chip_id), - legacy_hal_(legacy_hal), - mode_controller_(mode_controller), - iface_util_(iface_util), - is_valid_(true), - current_mode_id_(feature_flags::chip_mode_ids::kInvalid), - modes_(feature_flags.lock()->getChipModes(is_primary)), - debug_ring_buffer_cb_registered_(false), - subsystemCallbackHandler_(handler) { - setActiveWlanIfaceNameProperty(kNoActiveWlanIfaceNamePropertyValue); -} - -void WifiChip::invalidate() { - if (!writeRingbufferFilesInternal()) { - LOG(ERROR) << "Error writing files to flash"; - } - invalidateAndRemoveAllIfaces(); - setActiveWlanIfaceNameProperty(kNoActiveWlanIfaceNamePropertyValue); - legacy_hal_.reset(); - event_cb_handler_.invalidate(); - is_valid_ = false; -} - -bool WifiChip::isValid() { - return is_valid_; -} - -std::set> WifiChip::getEventCallbacks() { - return event_cb_handler_.getCallbacks(); -} - -Return WifiChip::getId(getId_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, &WifiChip::getIdInternal, - hidl_status_cb); -} - -// Deprecated support for this callback -Return WifiChip::registerEventCallback(const sp& event_callback, - registerEventCallback_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::registerEventCallbackInternal, hidl_status_cb, - event_callback); -} - -Return WifiChip::getCapabilities(getCapabilities_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getCapabilitiesInternal, hidl_status_cb); -} - -Return WifiChip::getAvailableModes(getAvailableModes_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getAvailableModesInternal, hidl_status_cb); -} - -Return WifiChip::configureChip(ChipModeId mode_id, configureChip_cb hidl_status_cb) { - return validateAndCallWithLock(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::configureChipInternal, hidl_status_cb, mode_id); -} - -Return WifiChip::getMode(getMode_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getModeInternal, hidl_status_cb); -} - -Return WifiChip::requestChipDebugInfo(requestChipDebugInfo_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::requestChipDebugInfoInternal, hidl_status_cb); -} - -Return WifiChip::requestDriverDebugDump(requestDriverDebugDump_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::requestDriverDebugDumpInternal, hidl_status_cb); -} - -Return WifiChip::requestFirmwareDebugDump(requestFirmwareDebugDump_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::requestFirmwareDebugDumpInternal, hidl_status_cb); -} - -Return WifiChip::createApIface(createApIface_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::createApIfaceInternal, hidl_status_cb); -} - -Return WifiChip::createBridgedApIface(createBridgedApIface_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::createBridgedApIfaceInternal, hidl_status_cb); -} - -Return WifiChip::getApIfaceNames(getApIfaceNames_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getApIfaceNamesInternal, hidl_status_cb); -} - -Return WifiChip::getApIface(const hidl_string& ifname, getApIface_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getApIfaceInternal, hidl_status_cb, ifname); -} - -Return WifiChip::removeApIface(const hidl_string& ifname, removeApIface_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::removeApIfaceInternal, hidl_status_cb, ifname); -} - -Return WifiChip::removeIfaceInstanceFromBridgedApIface( - const hidl_string& ifname, const hidl_string& ifInstanceName, - removeIfaceInstanceFromBridgedApIface_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::removeIfaceInstanceFromBridgedApIfaceInternal, hidl_status_cb, - ifname, ifInstanceName); -} - -Return WifiChip::createNanIface(createNanIface_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::createNanIfaceInternal, hidl_status_cb); -} - -Return WifiChip::getNanIfaceNames(getNanIfaceNames_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getNanIfaceNamesInternal, hidl_status_cb); -} - -Return WifiChip::getNanIface(const hidl_string& ifname, getNanIface_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getNanIfaceInternal, hidl_status_cb, ifname); -} - -Return WifiChip::removeNanIface(const hidl_string& ifname, removeNanIface_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::removeNanIfaceInternal, hidl_status_cb, ifname); -} - -Return WifiChip::createP2pIface(createP2pIface_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::createP2pIfaceInternal, hidl_status_cb); -} - -Return WifiChip::getP2pIfaceNames(getP2pIfaceNames_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getP2pIfaceNamesInternal, hidl_status_cb); -} - -Return WifiChip::getP2pIface(const hidl_string& ifname, getP2pIface_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getP2pIfaceInternal, hidl_status_cb, ifname); -} - -Return WifiChip::removeP2pIface(const hidl_string& ifname, removeP2pIface_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::removeP2pIfaceInternal, hidl_status_cb, ifname); -} - -Return WifiChip::createStaIface(createStaIface_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::createStaIfaceInternal, hidl_status_cb); -} - -Return WifiChip::getStaIfaceNames(getStaIfaceNames_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getStaIfaceNamesInternal, hidl_status_cb); -} - -Return WifiChip::getStaIface(const hidl_string& ifname, getStaIface_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getStaIfaceInternal, hidl_status_cb, ifname); -} - -Return WifiChip::removeStaIface(const hidl_string& ifname, removeStaIface_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::removeStaIfaceInternal, hidl_status_cb, ifname); -} - -Return WifiChip::createRttController(const sp& bound_iface, - createRttController_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::createRttControllerInternal, hidl_status_cb, bound_iface); -} - -Return WifiChip::getDebugRingBuffersStatus(getDebugRingBuffersStatus_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getDebugRingBuffersStatusInternal, hidl_status_cb); -} - -Return WifiChip::startLoggingToDebugRingBuffer( - const hidl_string& ring_name, WifiDebugRingBufferVerboseLevel verbose_level, - uint32_t max_interval_in_sec, uint32_t min_data_size_in_bytes, - startLoggingToDebugRingBuffer_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::startLoggingToDebugRingBufferInternal, hidl_status_cb, - ring_name, verbose_level, max_interval_in_sec, min_data_size_in_bytes); -} - -Return WifiChip::forceDumpToDebugRingBuffer(const hidl_string& ring_name, - forceDumpToDebugRingBuffer_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::forceDumpToDebugRingBufferInternal, hidl_status_cb, - ring_name); -} - -Return WifiChip::flushRingBufferToFile(flushRingBufferToFile_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::flushRingBufferToFileInternal, hidl_status_cb); -} - -Return WifiChip::stopLoggingToDebugRingBuffer( - stopLoggingToDebugRingBuffer_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::stopLoggingToDebugRingBufferInternal, hidl_status_cb); -} - -Return WifiChip::getDebugHostWakeReasonStats(getDebugHostWakeReasonStats_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getDebugHostWakeReasonStatsInternal, hidl_status_cb); -} - -Return WifiChip::enableDebugErrorAlerts(bool enable, - enableDebugErrorAlerts_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::enableDebugErrorAlertsInternal, hidl_status_cb, enable); -} - -Return WifiChip::selectTxPowerScenario(V1_1::IWifiChip::TxPowerScenario scenario, - selectTxPowerScenario_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::selectTxPowerScenarioInternal, hidl_status_cb, scenario); -} - -Return WifiChip::resetTxPowerScenario(resetTxPowerScenario_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::resetTxPowerScenarioInternal, hidl_status_cb); -} - -Return WifiChip::setLatencyMode(LatencyMode mode, setLatencyMode_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::setLatencyModeInternal, hidl_status_cb, mode); -} - -Return WifiChip::registerEventCallback_1_2( - const sp& event_callback, - registerEventCallback_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::registerEventCallbackInternal_1_2, hidl_status_cb, - event_callback); -} - -Return WifiChip::selectTxPowerScenario_1_2(TxPowerScenario scenario, - selectTxPowerScenario_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::selectTxPowerScenarioInternal_1_2, hidl_status_cb, scenario); -} - -Return WifiChip::getCapabilities_1_3(getCapabilities_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getCapabilitiesInternal_1_3, hidl_status_cb); -} - -Return WifiChip::getCapabilities_1_5(getCapabilities_1_5_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getCapabilitiesInternal_1_5, hidl_status_cb); -} - -Return WifiChip::debug(const hidl_handle& handle, const hidl_vec&) { - if (handle != nullptr && handle->numFds >= 1) { - { - std::unique_lock lk(lock_t); - for (const auto& item : ringbuffer_map_) { - forceDumpToDebugRingBufferInternal(item.first); - } - // unique_lock unlocked here - } - usleep(100 * 1000); // sleep for 100 milliseconds to wait for - // ringbuffer updates. - int fd = handle->data[0]; - if (!writeRingbufferFilesInternal()) { - LOG(ERROR) << "Error writing files to flash"; - } - uint32_t n_error = cpioArchiveFilesInDir(fd, kTombstoneFolderPath); - if (n_error != 0) { - LOG(ERROR) << n_error << " errors occured in cpio function"; - } - fsync(fd); - } else { - LOG(ERROR) << "File handle error"; - } - return Void(); -} - -Return WifiChip::createRttController_1_4(const sp& bound_iface, - createRttController_1_4_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::createRttControllerInternal_1_4, hidl_status_cb, bound_iface); -} - -Return WifiChip::registerEventCallback_1_4( - const sp& event_callback, - registerEventCallback_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::registerEventCallbackInternal_1_4, hidl_status_cb, - event_callback); -} - -Return WifiChip::setMultiStaPrimaryConnection( - const hidl_string& ifname, setMultiStaPrimaryConnection_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::setMultiStaPrimaryConnectionInternal, hidl_status_cb, ifname); -} - -Return WifiChip::setMultiStaUseCase(MultiStaUseCase use_case, - setMultiStaUseCase_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::setMultiStaUseCaseInternal, hidl_status_cb, use_case); -} - -Return WifiChip::setCoexUnsafeChannels(const hidl_vec& unsafeChannels, - hidl_bitfield restrictions, - setCoexUnsafeChannels_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::setCoexUnsafeChannelsInternal, hidl_status_cb, unsafeChannels, - restrictions); -} - -Return WifiChip::setCountryCode(const hidl_array& code, - setCountryCode_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiChip::setCountryCodeInternal, hidl_status_cb, code); -} - -Return WifiChip::getUsableChannels( - WifiBand band, hidl_bitfield ifaceModeMask, - hidl_bitfield filterMask, - getUsableChannels_cb _hidl_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getUsableChannelsInternal, _hidl_cb, band, ifaceModeMask, - filterMask); -} - -Return WifiChip::triggerSubsystemRestart(triggerSubsystemRestart_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::triggerSubsystemRestartInternal, hidl_status_cb); -} - -Return WifiChip::createRttController_1_6(const sp& bound_iface, - createRttController_1_6_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::createRttControllerInternal_1_6, hidl_status_cb, bound_iface); -} - -Return WifiChip::getUsableChannels_1_6( - WifiBand band, hidl_bitfield ifaceModeMask, - hidl_bitfield filterMask, - getUsableChannels_1_6_cb _hidl_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getUsableChannelsInternal_1_6, _hidl_cb, band, ifaceModeMask, - filterMask); -} - -Return WifiChip::getSupportedRadioCombinationsMatrix( - getSupportedRadioCombinationsMatrix_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getSupportedRadioCombinationsMatrixInternal, hidl_status_cb); -} - -Return WifiChip::getAvailableModes_1_6(getAvailableModes_1_6_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, - &WifiChip::getAvailableModesInternal_1_6, hidl_status_cb); -} - -void WifiChip::invalidateAndRemoveAllIfaces() { - invalidateAndClearBridgedApAll(); - invalidateAndClearAll(ap_ifaces_); - invalidateAndClearAll(nan_ifaces_); - invalidateAndClearAll(p2p_ifaces_); - invalidateAndClearAll(sta_ifaces_); - // Since all the ifaces are invalid now, all RTT controller objects - // using those ifaces also need to be invalidated. - for (const auto& rtt : rtt_controllers_) { - rtt->invalidate(); - } - rtt_controllers_.clear(); -} - -void WifiChip::invalidateAndRemoveDependencies(const std::string& removed_iface_name) { - for (auto it = nan_ifaces_.begin(); it != nan_ifaces_.end();) { - auto nan_iface = *it; - if (nan_iface->getName() == removed_iface_name) { - nan_iface->invalidate(); - for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onIfaceRemoved(IfaceType::NAN, removed_iface_name).isOk()) { - LOG(ERROR) << "Failed to invoke onIfaceRemoved callback"; - } - } - it = nan_ifaces_.erase(it); - } else { - ++it; - } - } - - for (auto it = rtt_controllers_.begin(); it != rtt_controllers_.end();) { - auto rtt = *it; - if (rtt->getIfaceName() == removed_iface_name) { - rtt->invalidate(); - it = rtt_controllers_.erase(it); - } else { - ++it; - } - } -} - -std::pair WifiChip::getIdInternal() { - return {createWifiStatus(WifiStatusCode::SUCCESS), chip_id_}; -} - -WifiStatus WifiChip::registerEventCallbackInternal( - const sp& /* event_callback */) { - // Deprecated support for this callback. - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -std::pair WifiChip::getCapabilitiesInternal() { - // Deprecated support for this callback. - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), 0}; -} - -std::pair> -WifiChip::getAvailableModesInternal() { - // Deprecated support -- use getAvailableModes_1_6 for more granular concurrency combinations. - std::vector modes_1_0 = {}; - for (const auto& mode_1_6 : modes_) { - std::vector combos_1_0; - for (const auto& combo_1_6 : mode_1_6.availableCombinations) { - std::vector limits_1_0; - for (const auto& limit_1_6 : combo_1_6.limits) { - std::vector types_1_0; - for (IfaceConcurrencyType type_1_6 : limit_1_6.types) { - switch (type_1_6) { - case IfaceConcurrencyType::STA: - types_1_0.push_back(IfaceType::STA); - break; - case IfaceConcurrencyType::AP: - types_1_0.push_back(IfaceType::AP); - break; - case IfaceConcurrencyType::AP_BRIDGED: - // Ignore AP_BRIDGED - break; - case IfaceConcurrencyType::P2P: - types_1_0.push_back(IfaceType::P2P); - break; - case IfaceConcurrencyType::NAN: - types_1_0.push_back(IfaceType::NAN); - break; - } - } - if (types_1_0.empty()) { - continue; - } - V1_0::IWifiChip::ChipIfaceCombinationLimit limit_1_0; - limit_1_0.types = hidl_vec(types_1_0); - limit_1_0.maxIfaces = limit_1_6.maxIfaces; - limits_1_0.push_back(limit_1_0); - } - if (limits_1_0.empty()) { - continue; - } - V1_0::IWifiChip::ChipIfaceCombination combo_1_0; - combo_1_0.limits = hidl_vec(limits_1_0); - combos_1_0.push_back(combo_1_0); - } - if (combos_1_0.empty()) { - continue; - } - V1_0::IWifiChip::ChipMode mode_1_0; - mode_1_0.id = mode_1_6.id; - mode_1_0.availableCombinations = hidl_vec(combos_1_0); - modes_1_0.push_back(mode_1_0); - } - return {createWifiStatus(WifiStatusCode::SUCCESS), modes_1_0}; -} - -WifiStatus WifiChip::configureChipInternal( - /* NONNULL */ std::unique_lock* lock, ChipModeId mode_id) { - if (!isValidModeId(mode_id)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - if (mode_id == current_mode_id_) { - LOG(DEBUG) << "Already in the specified mode " << mode_id; - return createWifiStatus(WifiStatusCode::SUCCESS); - } - WifiStatus status = handleChipConfiguration(lock, mode_id); - if (status.code != WifiStatusCode::SUCCESS) { - for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onChipReconfigureFailure(status).isOk()) { - LOG(ERROR) << "Failed to invoke onChipReconfigureFailure callback"; - } - } - return status; - } - for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onChipReconfigured(mode_id).isOk()) { - LOG(ERROR) << "Failed to invoke onChipReconfigured callback"; - } - } - current_mode_id_ = mode_id; - LOG(INFO) << "Configured chip in mode " << mode_id; - setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); - - legacy_hal_.lock()->registerSubsystemRestartCallbackHandler(subsystemCallbackHandler_); - - return status; -} - -std::pair WifiChip::getModeInternal() { - if (!isValidModeId(current_mode_id_)) { - return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), current_mode_id_}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), current_mode_id_}; -} - -std::pair WifiChip::requestChipDebugInfoInternal() { - V1_4::IWifiChip::ChipDebugInfo result; - legacy_hal::wifi_error legacy_status; - std::string driver_desc; - const auto ifname = getFirstActiveWlanIfaceName(); - std::tie(legacy_status, driver_desc) = legacy_hal_.lock()->getDriverVersion(ifname); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - LOG(ERROR) << "Failed to get driver version: " << legacyErrorToString(legacy_status); - WifiStatus status = - createWifiStatusFromLegacyError(legacy_status, "failed to get driver version"); - return {status, result}; - } - result.driverDescription = driver_desc.c_str(); - - std::string firmware_desc; - std::tie(legacy_status, firmware_desc) = legacy_hal_.lock()->getFirmwareVersion(ifname); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - LOG(ERROR) << "Failed to get firmware version: " << legacyErrorToString(legacy_status); - WifiStatus status = - createWifiStatusFromLegacyError(legacy_status, "failed to get firmware version"); - return {status, result}; - } - result.firmwareDescription = firmware_desc.c_str(); - - return {createWifiStatus(WifiStatusCode::SUCCESS), result}; -} - -std::pair> WifiChip::requestDriverDebugDumpInternal() { - legacy_hal::wifi_error legacy_status; - std::vector driver_dump; - std::tie(legacy_status, driver_dump) = - legacy_hal_.lock()->requestDriverMemoryDump(getFirstActiveWlanIfaceName()); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - LOG(ERROR) << "Failed to get driver debug dump: " << legacyErrorToString(legacy_status); - return {createWifiStatusFromLegacyError(legacy_status), std::vector()}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), driver_dump}; -} - -std::pair> WifiChip::requestFirmwareDebugDumpInternal() { - legacy_hal::wifi_error legacy_status; - std::vector firmware_dump; - std::tie(legacy_status, firmware_dump) = - legacy_hal_.lock()->requestFirmwareMemoryDump(getFirstActiveWlanIfaceName()); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - LOG(ERROR) << "Failed to get firmware debug dump: " << legacyErrorToString(legacy_status); - return {createWifiStatusFromLegacyError(legacy_status), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), firmware_dump}; -} - -WifiStatus WifiChip::createVirtualApInterface(const std::string& apVirtIf) { - legacy_hal::wifi_error legacy_status; - legacy_status = legacy_hal_.lock()->createVirtualInterface( - apVirtIf, hidl_struct_util::convertHidlIfaceTypeToLegacy(IfaceType::AP)); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - LOG(ERROR) << "Failed to add interface: " << apVirtIf << " " - << legacyErrorToString(legacy_status); - return createWifiStatusFromLegacyError(legacy_status); - } - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -sp WifiChip::newWifiApIface(std::string& ifname) { - std::vector ap_instances; - for (auto const& it : br_ifaces_ap_instances_) { - if (it.first == ifname) { - ap_instances = it.second; - } - } - sp iface = new WifiApIface(ifname, ap_instances, legacy_hal_, iface_util_); - ap_ifaces_.push_back(iface); - for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onIfaceAdded(IfaceType::AP, ifname).isOk()) { - LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; - } - } - setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); - return iface; -} - -std::pair> WifiChip::createApIfaceInternal() { - if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::AP)) { - return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; - } - std::string ifname = allocateApIfaceName(); - WifiStatus status = createVirtualApInterface(ifname); - if (status.code != WifiStatusCode::SUCCESS) { - return {status, {}}; - } - sp iface = newWifiApIface(ifname); - return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; -} - -std::pair> WifiChip::createBridgedApIfaceInternal() { - if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::AP_BRIDGED)) { - return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; - } - std::vector ap_instances = allocateBridgedApInstanceNames(); - if (ap_instances.size() < 2) { - LOG(ERROR) << "Fail to allocate two instances"; - return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; - } - std::string br_ifname = kApBridgeIfacePrefix + ap_instances[0]; - for (int i = 0; i < 2; i++) { - WifiStatus status = createVirtualApInterface(ap_instances[i]); - if (status.code != WifiStatusCode::SUCCESS) { - if (i != 0) { // The failure happened when creating second virtual - // iface. - legacy_hal_.lock()->deleteVirtualInterface( - ap_instances.front()); // Remove the first virtual iface. - } - return {status, {}}; - } - } - br_ifaces_ap_instances_[br_ifname] = ap_instances; - if (!iface_util_->createBridge(br_ifname)) { - LOG(ERROR) << "Failed createBridge - br_name=" << br_ifname.c_str(); - deleteApIface(br_ifname); - return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; - } - for (auto const& instance : ap_instances) { - // Bind ap instance interface to AP bridge - if (!iface_util_->addIfaceToBridge(br_ifname, instance)) { - LOG(ERROR) << "Failed add if to Bridge - if_name=" << instance.c_str(); - deleteApIface(br_ifname); - return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; - } - } - sp iface = newWifiApIface(br_ifname); - return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; -} - -std::pair> WifiChip::getApIfaceNamesInternal() { - if (ap_ifaces_.empty()) { - return {createWifiStatus(WifiStatusCode::SUCCESS), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), getNames(ap_ifaces_)}; -} - -std::pair> WifiChip::getApIfaceInternal( - const std::string& ifname) { - const auto iface = findUsingName(ap_ifaces_, ifname); - if (!iface.get()) { - return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; -} - -WifiStatus WifiChip::removeApIfaceInternal(const std::string& ifname) { - const auto iface = findUsingName(ap_ifaces_, ifname); - if (!iface.get()) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - // Invalidate & remove any dependent objects first. - // Note: This is probably not required because we never create - // nan/rtt objects over AP iface. But, there is no harm to do it - // here and not make that assumption all over the place. - invalidateAndRemoveDependencies(ifname); - deleteApIface(ifname); - invalidateAndClear(ap_ifaces_, iface); - for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onIfaceRemoved(IfaceType::AP, ifname).isOk()) { - LOG(ERROR) << "Failed to invoke onIfaceRemoved callback"; - } - } - setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -WifiStatus WifiChip::removeIfaceInstanceFromBridgedApIfaceInternal( - const std::string& ifname, const std::string& ifInstanceName) { - const auto iface = findUsingName(ap_ifaces_, ifname); - if (!iface.get() || ifInstanceName.empty()) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - // Requires to remove one of the instance in bridge mode - for (auto const& it : br_ifaces_ap_instances_) { - if (it.first == ifname) { - std::vector ap_instances = it.second; - for (auto const& iface : ap_instances) { - if (iface == ifInstanceName) { - if (!iface_util_->removeIfaceFromBridge(it.first, iface)) { - LOG(ERROR) << "Failed to remove interface: " << ifInstanceName << " from " - << ifname; - return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->deleteVirtualInterface(iface); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - LOG(ERROR) << "Failed to del interface: " << iface << " " - << legacyErrorToString(legacy_status); - return createWifiStatusFromLegacyError(legacy_status); - } - ap_instances.erase( - std::remove(ap_instances.begin(), ap_instances.end(), ifInstanceName), - ap_instances.end()); - br_ifaces_ap_instances_[ifname] = ap_instances; - break; - } - } - break; - } - } - iface->removeInstance(ifInstanceName); - setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); - - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -std::pair> WifiChip::createNanIfaceInternal() { - if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::NAN)) { - return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; - } - bool is_dedicated_iface = true; - std::string ifname = getPredefinedNanIfaceName(); - if (ifname.empty() || !iface_util_->ifNameToIndex(ifname)) { - // Use the first shared STA iface (wlan0) if a dedicated aware iface is - // not defined. - ifname = getFirstActiveWlanIfaceName(); - is_dedicated_iface = false; - } - sp iface = new WifiNanIface(ifname, is_dedicated_iface, legacy_hal_, iface_util_); - nan_ifaces_.push_back(iface); - for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onIfaceAdded(IfaceType::NAN, ifname).isOk()) { - LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; - } - } - return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; -} - -std::pair> WifiChip::getNanIfaceNamesInternal() { - if (nan_ifaces_.empty()) { - return {createWifiStatus(WifiStatusCode::SUCCESS), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), getNames(nan_ifaces_)}; -} - -std::pair> WifiChip::getNanIfaceInternal( - const std::string& ifname) { - const auto iface = findUsingName(nan_ifaces_, ifname); - if (!iface.get()) { - return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; -} - -WifiStatus WifiChip::removeNanIfaceInternal(const std::string& ifname) { - const auto iface = findUsingName(nan_ifaces_, ifname); - if (!iface.get()) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - invalidateAndClear(nan_ifaces_, iface); - for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onIfaceRemoved(IfaceType::NAN, ifname).isOk()) { - LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; - } - } - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -std::pair> WifiChip::createP2pIfaceInternal() { - if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::P2P)) { - return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; - } - std::string ifname = getPredefinedP2pIfaceName(); - sp iface = new WifiP2pIface(ifname, legacy_hal_); - p2p_ifaces_.push_back(iface); - for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onIfaceAdded(IfaceType::P2P, ifname).isOk()) { - LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; - } - } - return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; -} - -std::pair> WifiChip::getP2pIfaceNamesInternal() { - if (p2p_ifaces_.empty()) { - return {createWifiStatus(WifiStatusCode::SUCCESS), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), getNames(p2p_ifaces_)}; -} - -std::pair> WifiChip::getP2pIfaceInternal(const std::string& ifname) { - const auto iface = findUsingName(p2p_ifaces_, ifname); - if (!iface.get()) { - return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; -} - -WifiStatus WifiChip::removeP2pIfaceInternal(const std::string& ifname) { - const auto iface = findUsingName(p2p_ifaces_, ifname); - if (!iface.get()) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - invalidateAndClear(p2p_ifaces_, iface); - for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onIfaceRemoved(IfaceType::P2P, ifname).isOk()) { - LOG(ERROR) << "Failed to invoke onIfaceRemoved callback"; - } - } - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -std::pair> WifiChip::createStaIfaceInternal() { - if (!canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::STA)) { - return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; - } - std::string ifname = allocateStaIfaceName(); - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->createVirtualInterface( - ifname, hidl_struct_util::convertHidlIfaceTypeToLegacy(IfaceType::STA)); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - LOG(ERROR) << "Failed to add interface: " << ifname << " " - << legacyErrorToString(legacy_status); - return {createWifiStatusFromLegacyError(legacy_status), {}}; - } - sp iface = new WifiStaIface(ifname, legacy_hal_, iface_util_); - sta_ifaces_.push_back(iface); - for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onIfaceAdded(IfaceType::STA, ifname).isOk()) { - LOG(ERROR) << "Failed to invoke onIfaceAdded callback"; - } - } - setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); - return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; -} - -std::pair> WifiChip::getStaIfaceNamesInternal() { - if (sta_ifaces_.empty()) { - return {createWifiStatus(WifiStatusCode::SUCCESS), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), getNames(sta_ifaces_)}; -} - -std::pair> WifiChip::getStaIfaceInternal( - const std::string& ifname) { - const auto iface = findUsingName(sta_ifaces_, ifname); - if (!iface.get()) { - return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), iface}; -} - -WifiStatus WifiChip::removeStaIfaceInternal(const std::string& ifname) { - const auto iface = findUsingName(sta_ifaces_, ifname); - if (!iface.get()) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - // Invalidate & remove any dependent objects first. - invalidateAndRemoveDependencies(ifname); - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->deleteVirtualInterface(ifname); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - LOG(ERROR) << "Failed to remove interface: " << ifname << " " - << legacyErrorToString(legacy_status); - } - invalidateAndClear(sta_ifaces_, iface); - for (const auto& callback : event_cb_handler_.getCallbacks()) { - if (!callback->onIfaceRemoved(IfaceType::STA, ifname).isOk()) { - LOG(ERROR) << "Failed to invoke onIfaceRemoved callback"; - } - } - setActiveWlanIfaceNameProperty(getFirstActiveWlanIfaceName()); - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -std::pair> WifiChip::createRttControllerInternal( - const sp& /*bound_iface*/) { - LOG(ERROR) << "createRttController is not supported on this HAL"; - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; -} - -std::pair> -WifiChip::getDebugRingBuffersStatusInternal() { - legacy_hal::wifi_error legacy_status; - std::vector legacy_ring_buffer_status_vec; - std::tie(legacy_status, legacy_ring_buffer_status_vec) = - legacy_hal_.lock()->getRingBuffersStatus(getFirstActiveWlanIfaceName()); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), {}}; - } - std::vector hidl_ring_buffer_status_vec; - if (!hidl_struct_util::convertLegacyVectorOfDebugRingBufferStatusToHidl( - legacy_ring_buffer_status_vec, &hidl_ring_buffer_status_vec)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_ring_buffer_status_vec}; -} - -WifiStatus WifiChip::startLoggingToDebugRingBufferInternal( - const hidl_string& ring_name, WifiDebugRingBufferVerboseLevel verbose_level, - uint32_t max_interval_in_sec, uint32_t min_data_size_in_bytes) { - WifiStatus status = registerDebugRingBufferCallback(); - if (status.code != WifiStatusCode::SUCCESS) { - return status; - } - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startRingBufferLogging( - getFirstActiveWlanIfaceName(), ring_name, - static_cast::type>(verbose_level), - max_interval_in_sec, min_data_size_in_bytes); - ringbuffer_map_.insert( - std::pair(ring_name, Ringbuffer(kMaxBufferSizeBytes))); - // if verbose logging enabled, turn up HAL daemon logging as well. - if (verbose_level < WifiDebugRingBufferVerboseLevel::VERBOSE) { - android::base::SetMinimumLogSeverity(android::base::DEBUG); - } else { - android::base::SetMinimumLogSeverity(android::base::VERBOSE); - } - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiChip::forceDumpToDebugRingBufferInternal(const hidl_string& ring_name) { - WifiStatus status = registerDebugRingBufferCallback(); - if (status.code != WifiStatusCode::SUCCESS) { - return status; - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->getRingBufferData(getFirstActiveWlanIfaceName(), ring_name); - - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiChip::flushRingBufferToFileInternal() { - if (!writeRingbufferFilesInternal()) { - LOG(ERROR) << "Error writing files to flash"; - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -WifiStatus WifiChip::stopLoggingToDebugRingBufferInternal() { - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->deregisterRingBufferCallbackHandler(getFirstActiveWlanIfaceName()); - if (legacy_status == legacy_hal::WIFI_SUCCESS) { - debug_ring_buffer_cb_registered_ = false; - } - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair -WifiChip::getDebugHostWakeReasonStatsInternal() { - legacy_hal::wifi_error legacy_status; - legacy_hal::WakeReasonStats legacy_stats; - std::tie(legacy_status, legacy_stats) = - legacy_hal_.lock()->getWakeReasonStats(getFirstActiveWlanIfaceName()); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), {}}; - } - WifiDebugHostWakeReasonStats hidl_stats; - if (!hidl_struct_util::convertLegacyWakeReasonStatsToHidl(legacy_stats, &hidl_stats)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_stats}; -} - -WifiStatus WifiChip::enableDebugErrorAlertsInternal(bool enable) { - legacy_hal::wifi_error legacy_status; - if (enable) { - android::wp weak_ptr_this(this); - const auto& on_alert_callback = [weak_ptr_this](int32_t error_code, - std::vector debug_data) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onDebugErrorAlert(error_code, debug_data).isOk()) { - LOG(ERROR) << "Failed to invoke onDebugErrorAlert callback"; - } - } - }; - legacy_status = legacy_hal_.lock()->registerErrorAlertCallbackHandler( - getFirstActiveWlanIfaceName(), on_alert_callback); - } else { - legacy_status = legacy_hal_.lock()->deregisterErrorAlertCallbackHandler( - getFirstActiveWlanIfaceName()); - } - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiChip::selectTxPowerScenarioInternal(V1_1::IWifiChip::TxPowerScenario scenario) { - auto legacy_status = legacy_hal_.lock()->selectTxPowerScenario( - getFirstActiveWlanIfaceName(), - hidl_struct_util::convertHidlTxPowerScenarioToLegacy(scenario)); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiChip::resetTxPowerScenarioInternal() { - auto legacy_status = legacy_hal_.lock()->resetTxPowerScenario(getFirstActiveWlanIfaceName()); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiChip::setLatencyModeInternal(LatencyMode mode) { - auto legacy_status = legacy_hal_.lock()->setLatencyMode( - getFirstActiveWlanIfaceName(), hidl_struct_util::convertHidlLatencyModeToLegacy(mode)); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiChip::registerEventCallbackInternal_1_2( - const sp& /* event_callback */) { - // Deprecated support for this callback. - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiChip::selectTxPowerScenarioInternal_1_2(TxPowerScenario scenario) { - auto legacy_status = legacy_hal_.lock()->selectTxPowerScenario( - getFirstActiveWlanIfaceName(), - hidl_struct_util::convertHidlTxPowerScenarioToLegacy_1_2(scenario)); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair WifiChip::getCapabilitiesInternal_1_3() { - // Deprecated support for this callback. - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), 0}; -} - -std::pair WifiChip::getCapabilitiesInternal_1_5() { - legacy_hal::wifi_error legacy_status; - uint64_t legacy_feature_set; - uint32_t legacy_logger_feature_set; - const auto ifname = getFirstActiveWlanIfaceName(); - std::tie(legacy_status, legacy_feature_set) = - legacy_hal_.lock()->getSupportedFeatureSet(ifname); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), 0}; - } - std::tie(legacy_status, legacy_logger_feature_set) = - legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - // some devices don't support querying logger feature set - legacy_logger_feature_set = 0; - } - uint32_t hidl_caps; - if (!hidl_struct_util::convertLegacyFeaturesToHidlChipCapabilities( - legacy_feature_set, legacy_logger_feature_set, &hidl_caps)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), 0}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps}; -} - -std::pair> WifiChip::createRttControllerInternal_1_4( - const sp& /*bound_iface*/) { - LOG(ERROR) << "createRttController_1_4 is not supported on this HAL"; - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; -} - -WifiStatus WifiChip::registerEventCallbackInternal_1_4( - const sp& event_callback) { - if (!event_cb_handler_.addCallback(event_callback)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -WifiStatus WifiChip::setMultiStaPrimaryConnectionInternal(const std::string& ifname) { - auto legacy_status = legacy_hal_.lock()->multiStaSetPrimaryConnection(ifname); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiChip::setMultiStaUseCaseInternal(MultiStaUseCase use_case) { - auto legacy_status = legacy_hal_.lock()->multiStaSetUseCase( - hidl_struct_util::convertHidlMultiStaUseCaseToLegacy(use_case)); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiChip::setCoexUnsafeChannelsInternal(std::vector unsafe_channels, - uint32_t restrictions) { - std::vector legacy_unsafe_channels; - if (!hidl_struct_util::convertHidlVectorOfCoexUnsafeChannelToLegacy(unsafe_channels, - &legacy_unsafe_channels)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - uint32_t legacy_restrictions = 0; - if (restrictions & CoexRestriction::WIFI_DIRECT) { - legacy_restrictions |= legacy_hal::wifi_coex_restriction::WIFI_DIRECT; - } - if (restrictions & CoexRestriction::SOFTAP) { - legacy_restrictions |= legacy_hal::wifi_coex_restriction::SOFTAP; - } - if (restrictions & CoexRestriction::WIFI_AWARE) { - legacy_restrictions |= legacy_hal::wifi_coex_restriction::WIFI_AWARE; - } - auto legacy_status = - legacy_hal_.lock()->setCoexUnsafeChannels(legacy_unsafe_channels, legacy_restrictions); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiChip::setCountryCodeInternal(const std::array& code) { - auto legacy_status = legacy_hal_.lock()->setCountryCode(getFirstActiveWlanIfaceName(), code); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair> WifiChip::getUsableChannelsInternal( - WifiBand /*band*/, uint32_t /*ifaceModeMask*/, uint32_t /*filterMask*/) { - LOG(ERROR) << "getUsableChannels is not supported on this HAL"; - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; -} - -WifiStatus WifiChip::triggerSubsystemRestartInternal() { - auto legacy_status = legacy_hal_.lock()->triggerSubsystemRestart(); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair> WifiChip::createRttControllerInternal_1_6( - const sp& bound_iface) { - if (sta_ifaces_.size() == 0 && - !canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType::STA)) { - LOG(ERROR) << "createRttControllerInternal_1_6: Chip cannot support STAs " - "(and RTT by extension)"; - return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; - } - sp rtt = - new WifiRttController(getFirstActiveWlanIfaceName(), bound_iface, legacy_hal_); - rtt_controllers_.emplace_back(rtt); - return {createWifiStatus(WifiStatusCode::SUCCESS), rtt}; -} - -std::pair> WifiChip::getUsableChannelsInternal_1_6( - WifiBand band, uint32_t ifaceModeMask, uint32_t filterMask) { - legacy_hal::wifi_error legacy_status; - std::vector legacy_usable_channels; - std::tie(legacy_status, legacy_usable_channels) = legacy_hal_.lock()->getUsableChannels( - hidl_struct_util::convertHidlWifiBandToLegacyMacBand(band), - hidl_struct_util::convertHidlWifiIfaceModeToLegacy(ifaceModeMask), - hidl_struct_util::convertHidlUsableChannelFilterToLegacy(filterMask)); - - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), {}}; - } - std::vector hidl_usable_channels; - if (!hidl_struct_util::convertLegacyWifiUsableChannelsToHidl(legacy_usable_channels, - &hidl_usable_channels)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_usable_channels}; -} - -std::pair -WifiChip::getSupportedRadioCombinationsMatrixInternal() { - legacy_hal::wifi_error legacy_status; - legacy_hal::wifi_radio_combination_matrix* legacy_matrix; - - std::tie(legacy_status, legacy_matrix) = - legacy_hal_.lock()->getSupportedRadioCombinationsMatrix(); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - LOG(ERROR) << "Failed to get SupportedRadioCombinations matrix from legacy HAL: " - << legacyErrorToString(legacy_status); - return {createWifiStatusFromLegacyError(legacy_status), {}}; - } - - V1_6::WifiRadioCombinationMatrix hidl_matrix; - if (!hidl_struct_util::convertLegacyRadioCombinationsMatrixToHidl(legacy_matrix, - &hidl_matrix)) { - LOG(ERROR) << "Failed convertLegacyRadioCombinationsMatrixToHidl() "; - return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_matrix}; -} - -std::pair> -WifiChip::getAvailableModesInternal_1_6() { - return {createWifiStatus(WifiStatusCode::SUCCESS), modes_}; -} - -WifiStatus WifiChip::handleChipConfiguration( - /* NONNULL */ std::unique_lock* lock, ChipModeId mode_id) { - // If the chip is already configured in a different mode, stop - // the legacy HAL and then start it after firmware mode change. - if (isValidModeId(current_mode_id_)) { - LOG(INFO) << "Reconfiguring chip from mode " << current_mode_id_ << " to mode " << mode_id; - invalidateAndRemoveAllIfaces(); - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->stop(lock, []() {}); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - LOG(ERROR) << "Failed to stop legacy HAL: " << legacyErrorToString(legacy_status); - return createWifiStatusFromLegacyError(legacy_status); - } - } - // Firmware mode change not needed for V2 devices. - bool success = true; - if (mode_id == feature_flags::chip_mode_ids::kV1Sta) { - success = mode_controller_.lock()->changeFirmwareMode(IfaceType::STA); - } else if (mode_id == feature_flags::chip_mode_ids::kV1Ap) { - success = mode_controller_.lock()->changeFirmwareMode(IfaceType::AP); - } - if (!success) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->start(); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - LOG(ERROR) << "Failed to start legacy HAL: " << legacyErrorToString(legacy_status); - return createWifiStatusFromLegacyError(legacy_status); - } - // Every time the HAL is restarted, we need to register the - // radio mode change callback. - WifiStatus status = registerRadioModeChangeCallback(); - if (status.code != WifiStatusCode::SUCCESS) { - // This probably is not a critical failure? - LOG(ERROR) << "Failed to register radio mode change callback"; - } - // Extract and save the version information into property. - std::pair version_info; - version_info = WifiChip::requestChipDebugInfoInternal(); - if (WifiStatusCode::SUCCESS == version_info.first.code) { - property_set("vendor.wlan.firmware.version", - version_info.second.firmwareDescription.c_str()); - property_set("vendor.wlan.driver.version", version_info.second.driverDescription.c_str()); - } - - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -WifiStatus WifiChip::registerDebugRingBufferCallback() { - if (debug_ring_buffer_cb_registered_) { - return createWifiStatus(WifiStatusCode::SUCCESS); - } - - android::wp weak_ptr_this(this); - const auto& on_ring_buffer_data_callback = - [weak_ptr_this](const std::string& name, const std::vector& data, - const legacy_hal::wifi_ring_buffer_status& status) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - WifiDebugRingBufferStatus hidl_status; - Ringbuffer::AppendStatus appendstatus; - if (!hidl_struct_util::convertLegacyDebugRingBufferStatusToHidl(status, - &hidl_status)) { - LOG(ERROR) << "Error converting ring buffer status"; - return; - } - { - std::unique_lock lk(shared_ptr_this->lock_t); - const auto& target = shared_ptr_this->ringbuffer_map_.find(name); - if (target != shared_ptr_this->ringbuffer_map_.end()) { - Ringbuffer& cur_buffer = target->second; - appendstatus = cur_buffer.append(data); - } else { - LOG(ERROR) << "Ringname " << name << " not found"; - return; - } - // unique_lock unlocked here - } - if (appendstatus == Ringbuffer::AppendStatus::FAIL_RING_BUFFER_CORRUPTED) { - LOG(ERROR) << "Ringname " << name << " is corrupted. Clear the ring buffer"; - shared_ptr_this->writeRingbufferFilesInternal(); - return; - } - - }; - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->registerRingBufferCallbackHandler( - getFirstActiveWlanIfaceName(), on_ring_buffer_data_callback); - - if (legacy_status == legacy_hal::WIFI_SUCCESS) { - debug_ring_buffer_cb_registered_ = true; - } - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiChip::registerRadioModeChangeCallback() { - android::wp weak_ptr_this(this); - const auto& on_radio_mode_change_callback = - [weak_ptr_this](const std::vector& mac_infos) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - std::vector hidl_radio_mode_infos; - if (!hidl_struct_util::convertLegacyWifiMacInfosToHidl(mac_infos, - &hidl_radio_mode_infos)) { - LOG(ERROR) << "Error converting wifi mac info"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onRadioModeChange_1_4(hidl_radio_mode_infos).isOk()) { - LOG(ERROR) << "Failed to invoke onRadioModeChange_1_4" - << " callback on: " << toString(callback); - } - } - }; - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->registerRadioModeChangeCallbackHandler( - getFirstActiveWlanIfaceName(), on_radio_mode_change_callback); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::vector -WifiChip::getCurrentModeConcurrencyCombinations() { - if (!isValidModeId(current_mode_id_)) { - LOG(ERROR) << "Chip not configured in a mode yet"; - return {}; - } - for (const auto& mode : modes_) { - if (mode.id == current_mode_id_) { - return mode.availableCombinations; - } - } - CHECK(0) << "Expected to find concurrency combinations for current mode!"; - return {}; -} - -// Returns a map indexed by IfaceConcurrencyType with the number of ifaces currently -// created of the corresponding concurrency type. -std::map WifiChip::getCurrentConcurrencyCombination() { - std::map iface_counts; - uint32_t num_ap = 0; - uint32_t num_ap_bridged = 0; - for (const auto& ap_iface : ap_ifaces_) { - std::string ap_iface_name = ap_iface->getName(); - if (br_ifaces_ap_instances_.count(ap_iface_name) > 0 && - br_ifaces_ap_instances_[ap_iface_name].size() > 1) { - num_ap_bridged++; - } else { - num_ap++; - } - } - iface_counts[IfaceConcurrencyType::AP] = num_ap; - iface_counts[IfaceConcurrencyType::AP_BRIDGED] = num_ap_bridged; - iface_counts[IfaceConcurrencyType::NAN] = nan_ifaces_.size(); - iface_counts[IfaceConcurrencyType::P2P] = p2p_ifaces_.size(); - iface_counts[IfaceConcurrencyType::STA] = sta_ifaces_.size(); - return iface_counts; -} - -// This expands the provided concurrency combinations to a more parseable -// form. Returns a vector of available combinations possible with the number -// of each concurrency type in the combination. -// This method is a port of HalDeviceManager.expandConcurrencyCombos() from framework. -std::vector> WifiChip::expandConcurrencyCombinations( - const V1_6::IWifiChip::ChipConcurrencyCombination& combination) { - uint32_t num_expanded_combos = 1; - for (const auto& limit : combination.limits) { - for (uint32_t i = 0; i < limit.maxIfaces; i++) { - num_expanded_combos *= limit.types.size(); - } - } - - // Allocate the vector of expanded combos and reset all concurrency type counts to 0 - // in each combo. - std::vector> expanded_combos; - expanded_combos.resize(num_expanded_combos); - for (auto& expanded_combo : expanded_combos) { - for (const auto type : - {IfaceConcurrencyType::AP, IfaceConcurrencyType::AP_BRIDGED, IfaceConcurrencyType::NAN, - IfaceConcurrencyType::P2P, IfaceConcurrencyType::STA}) { - expanded_combo[type] = 0; - } - } - uint32_t span = num_expanded_combos; - for (const auto& limit : combination.limits) { - for (uint32_t i = 0; i < limit.maxIfaces; i++) { - span /= limit.types.size(); - for (uint32_t k = 0; k < num_expanded_combos; ++k) { - const auto iface_type = limit.types[(k / span) % limit.types.size()]; - expanded_combos[k][iface_type]++; - } - } - } - return expanded_combos; -} - -bool WifiChip::canExpandedConcurrencyComboSupportConcurrencyTypeWithCurrentTypes( - const std::map& expanded_combo, - IfaceConcurrencyType requested_type) { - const auto current_combo = getCurrentConcurrencyCombination(); - - // Check if we have space for 1 more iface of |type| in this combo - for (const auto type : - {IfaceConcurrencyType::AP, IfaceConcurrencyType::AP_BRIDGED, IfaceConcurrencyType::NAN, - IfaceConcurrencyType::P2P, IfaceConcurrencyType::STA}) { - size_t num_ifaces_needed = current_combo.at(type); - if (type == requested_type) { - num_ifaces_needed++; - } - size_t num_ifaces_allowed = expanded_combo.at(type); - if (num_ifaces_needed > num_ifaces_allowed) { - return false; - } - } - return true; -} - -// This method does the following: -// a) Enumerate all possible concurrency combos by expanding the current -// ChipConcurrencyCombination. -// b) Check if the requested concurrency type can be added to the current mode -// with the concurrency combination that is already active. -bool WifiChip::canCurrentModeSupportConcurrencyTypeWithCurrentTypes( - IfaceConcurrencyType requested_type) { - if (!isValidModeId(current_mode_id_)) { - LOG(ERROR) << "Chip not configured in a mode yet"; - return false; - } - const auto combinations = getCurrentModeConcurrencyCombinations(); - for (const auto& combination : combinations) { - const auto expanded_combos = expandConcurrencyCombinations(combination); - for (const auto& expanded_combo : expanded_combos) { - if (canExpandedConcurrencyComboSupportConcurrencyTypeWithCurrentTypes(expanded_combo, - requested_type)) { - return true; - } - } - } - return false; -} - -// Note: This does not consider concurrency types already active. It only checks if the -// provided expanded concurrency combination can support the requested combo. -bool WifiChip::canExpandedConcurrencyComboSupportConcurrencyCombo( - const std::map& expanded_combo, - const std::map& req_combo) { - // Check if we have space for 1 more |type| in this combo - for (const auto type : - {IfaceConcurrencyType::AP, IfaceConcurrencyType::AP_BRIDGED, IfaceConcurrencyType::NAN, - IfaceConcurrencyType::P2P, IfaceConcurrencyType::STA}) { - if (req_combo.count(type) == 0) { - // Concurrency type not in the req_combo. - continue; - } - size_t num_ifaces_needed = req_combo.at(type); - size_t num_ifaces_allowed = expanded_combo.at(type); - if (num_ifaces_needed > num_ifaces_allowed) { - return false; - } - } - return true; -} -// This method does the following: -// a) Enumerate all possible concurrency combos by expanding the current -// ChipConcurrencyCombination. -// b) Check if the requested concurrency combo can be added to the current mode. -// Note: This does not consider concurrency types already active. It only checks if the -// current mode can support the requested combo. -bool WifiChip::canCurrentModeSupportConcurrencyCombo( - const std::map& req_combo) { - if (!isValidModeId(current_mode_id_)) { - LOG(ERROR) << "Chip not configured in a mode yet"; - return false; - } - const auto combinations = getCurrentModeConcurrencyCombinations(); - for (const auto& combination : combinations) { - const auto expanded_combos = expandConcurrencyCombinations(combination); - for (const auto& expanded_combo : expanded_combos) { - if (canExpandedConcurrencyComboSupportConcurrencyCombo(expanded_combo, req_combo)) { - return true; - } - } - } - return false; -} - -// This method does the following: -// a) Enumerate all possible concurrency combos by expanding the current -// ChipConcurrencyCombination. -// b) Check if the requested concurrency type can be added to the current mode. -bool WifiChip::canCurrentModeSupportConcurrencyType(IfaceConcurrencyType requested_type) { - // Check if we can support at least 1 of the requested concurrency type. - std::map req_iface_combo; - req_iface_combo[requested_type] = 1; - return canCurrentModeSupportConcurrencyCombo(req_iface_combo); -} - -bool WifiChip::isValidModeId(ChipModeId mode_id) { - for (const auto& mode : modes_) { - if (mode.id == mode_id) { - return true; - } - } - return false; -} - -bool WifiChip::isStaApConcurrencyAllowedInCurrentMode() { - // Check if we can support at least 1 STA & 1 AP concurrently. - std::map req_iface_combo; - req_iface_combo[IfaceConcurrencyType::STA] = 1; - req_iface_combo[IfaceConcurrencyType::AP] = 1; - return canCurrentModeSupportConcurrencyCombo(req_iface_combo); -} - -bool WifiChip::isDualStaConcurrencyAllowedInCurrentMode() { - // Check if we can support at least 2 STA concurrently. - std::map req_iface_combo; - req_iface_combo[IfaceConcurrencyType::STA] = 2; - return canCurrentModeSupportConcurrencyCombo(req_iface_combo); -} - -std::string WifiChip::getFirstActiveWlanIfaceName() { - if (sta_ifaces_.size() > 0) return sta_ifaces_[0]->getName(); - if (ap_ifaces_.size() > 0) { - // If the first active wlan iface is bridged iface. - // Return first instance name. - for (auto const& it : br_ifaces_ap_instances_) { - if (it.first == ap_ifaces_[0]->getName()) { - return it.second[0]; - } - } - return ap_ifaces_[0]->getName(); - } - // This could happen if the chip call is made before any STA/AP - // iface is created. Default to wlan0 for such cases. - LOG(WARNING) << "No active wlan interfaces in use! Using default"; - return getWlanIfaceNameWithType(IfaceType::STA, 0); -} - -// Return the first wlan (wlan0, wlan1 etc.) starting from |start_idx| -// not already in use. -// Note: This doesn't check the actual presence of these interfaces. -std::string WifiChip::allocateApOrStaIfaceName(IfaceType type, uint32_t start_idx) { - for (unsigned idx = start_idx; idx < kMaxWlanIfaces; idx++) { - const auto ifname = getWlanIfaceNameWithType(type, idx); - if (findUsingNameFromBridgedApInstances(ifname)) continue; - if (findUsingName(ap_ifaces_, ifname)) continue; - if (findUsingName(sta_ifaces_, ifname)) continue; - return ifname; - } - // This should never happen. We screwed up somewhere if it did. - CHECK(false) << "All wlan interfaces in use already!"; - return {}; -} - -uint32_t WifiChip::startIdxOfApIface() { - if (isDualStaConcurrencyAllowedInCurrentMode()) { - // When the HAL support dual STAs, AP should start with idx 2. - return 2; - } else if (isStaApConcurrencyAllowedInCurrentMode()) { - // When the HAL support STA + AP but it doesn't support dual STAs. - // AP should start with idx 1. - return 1; - } - // No concurrency support. - return 0; -} - -// AP iface names start with idx 1 for modes supporting -// concurrent STA and not dual AP, else start with idx 0. -std::string WifiChip::allocateApIfaceName() { - // Check if we have a dedicated iface for AP. - std::vector ifnames = getPredefinedApIfaceNames(true); - for (auto const& ifname : ifnames) { - if (findUsingName(ap_ifaces_, ifname)) continue; - return ifname; - } - return allocateApOrStaIfaceName(IfaceType::AP, startIdxOfApIface()); -} - -std::vector WifiChip::allocateBridgedApInstanceNames() { - // Check if we have a dedicated iface for AP. - std::vector instances = getPredefinedApIfaceNames(true); - if (instances.size() == 2) { - return instances; - } else { - int num_ifaces_need_to_allocate = 2 - instances.size(); - for (int i = 0; i < num_ifaces_need_to_allocate; i++) { - std::string instance_name = - allocateApOrStaIfaceName(IfaceType::AP, startIdxOfApIface() + i); - if (!instance_name.empty()) { - instances.push_back(instance_name); - } - } - } - return instances; -} - -// STA iface names start with idx 0. -// Primary STA iface will always be 0. -std::string WifiChip::allocateStaIfaceName() { - return allocateApOrStaIfaceName(IfaceType::STA, 0); -} - -bool WifiChip::writeRingbufferFilesInternal() { - if (!removeOldFilesInternal()) { - LOG(ERROR) << "Error occurred while deleting old tombstone files"; - return false; - } - // write ringbuffers to file - { - std::unique_lock lk(lock_t); - for (auto& item : ringbuffer_map_) { - Ringbuffer& cur_buffer = item.second; - if (cur_buffer.getData().empty()) { - continue; - } - const std::string file_path_raw = kTombstoneFolderPath + item.first + "XXXXXXXXXX"; - const int dump_fd = mkstemp(makeCharVec(file_path_raw).data()); - if (dump_fd == -1) { - PLOG(ERROR) << "create file failed"; - return false; - } - unique_fd file_auto_closer(dump_fd); - for (const auto& cur_block : cur_buffer.getData()) { - if (cur_block.size() <= 0 || cur_block.size() > kMaxBufferSizeBytes) { - PLOG(ERROR) << "Ring buffer: " << item.first - << " is corrupted. Invalid block size: " << cur_block.size(); - break; - } - if (write(dump_fd, cur_block.data(), sizeof(cur_block[0]) * cur_block.size()) == - -1) { - PLOG(ERROR) << "Error writing to file"; - } - } - cur_buffer.clear(); - } - // unique_lock unlocked here - } - return true; -} - -std::string WifiChip::getWlanIfaceNameWithType(IfaceType type, unsigned idx) { - std::string ifname; - - // let the legacy hal override the interface name - legacy_hal::wifi_error err = legacy_hal_.lock()->getSupportedIfaceName((uint32_t)type, ifname); - if (err == legacy_hal::WIFI_SUCCESS) return ifname; - - return getWlanIfaceName(idx); -} - -void WifiChip::invalidateAndClearBridgedApAll() { - for (auto const& it : br_ifaces_ap_instances_) { - for (auto const& iface : it.second) { - iface_util_->removeIfaceFromBridge(it.first, iface); - legacy_hal_.lock()->deleteVirtualInterface(iface); - } - iface_util_->deleteBridge(it.first); - } - br_ifaces_ap_instances_.clear(); -} - -void WifiChip::deleteApIface(const std::string& if_name) { - if (if_name.empty()) return; - // delete bridged interfaces if have - for (auto const& it : br_ifaces_ap_instances_) { - if (it.first == if_name) { - for (auto const& iface : it.second) { - iface_util_->removeIfaceFromBridge(if_name, iface); - legacy_hal_.lock()->deleteVirtualInterface(iface); - } - iface_util_->deleteBridge(if_name); - br_ifaces_ap_instances_.erase(if_name); - // ifname is bridged AP, return here. - return; - } - } - - // No bridged AP case, delete AP iface - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->deleteVirtualInterface(if_name); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - LOG(ERROR) << "Failed to remove interface: " << if_name << " " - << legacyErrorToString(legacy_status); - } -} - -bool WifiChip::findUsingNameFromBridgedApInstances(const std::string& name) { - for (auto const& it : br_ifaces_ap_instances_) { - if (it.first == name) { - return true; - } - for (auto const& iface : it.second) { - if (iface == name) { - return true; - } - } - } - return false; -} - -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/wifi_chip.h b/wifi/1.6/default/wifi_chip.h deleted file mode 100644 index e8ddaa6f9e..0000000000 --- a/wifi/1.6/default/wifi_chip.h +++ /dev/null @@ -1,317 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef WIFI_CHIP_H_ -#define WIFI_CHIP_H_ - -// HACK: NAN is a macro defined in math.h, which can be included in various -// headers. This wifi HAL uses an enum called NAN, which does not compile when -// the macro is defined. Undefine NAN to work around it. -#undef NAN - -#include -#include -#include - -#include -#include -#include -#include - -#include "hidl_callback_util.h" -#include "ringbuffer.h" -#include "wifi_ap_iface.h" -#include "wifi_feature_flags.h" -#include "wifi_legacy_hal.h" -#include "wifi_mode_controller.h" -#include "wifi_nan_iface.h" -#include "wifi_p2p_iface.h" -#include "wifi_rtt_controller.h" -#include "wifi_sta_iface.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -using namespace android::hardware::wifi::V1_0; -using V1_5::WifiBand; - -/** - * HIDL interface object used to control a Wifi HAL chip instance. - * Since there is only a single chip instance used today, there is no - * identifying handle information stored here. - */ -class WifiChip : public V1_6::IWifiChip { - public: - WifiChip(ChipId chip_id, bool is_primary, - const std::weak_ptr legacy_hal, - const std::weak_ptr mode_controller, - const std::shared_ptr iface_util, - const std::weak_ptr feature_flags, - const std::function& subsystemCallbackHandler); - // HIDL does not provide a built-in mechanism to let the server invalidate - // a HIDL interface object after creation. If any client process holds onto - // a reference to the object in their context, any method calls on that - // reference will continue to be directed to the server. - // - // However Wifi HAL needs to control the lifetime of these objects. So, add - // a public |invalidate| method to |WifiChip| and it's child objects. This - // will be used to mark an object invalid when either: - // a) Wifi HAL is stopped, or - // b) Wifi Chip is reconfigured. - // - // All HIDL method implementations should check if the object is still - // marked valid before processing them. - void invalidate(); - bool isValid(); - std::set> getEventCallbacks(); - - // HIDL methods exposed. - Return getId(getId_cb hidl_status_cb) override; - // Deprecated support for this callback - Return registerEventCallback(const sp& event_callback, - registerEventCallback_cb hidl_status_cb) override; - Return getCapabilities(getCapabilities_cb hidl_status_cb) override; - Return getAvailableModes(getAvailableModes_cb hidl_status_cb) override; - Return configureChip(ChipModeId mode_id, configureChip_cb hidl_status_cb) override; - Return getMode(getMode_cb hidl_status_cb) override; - Return requestChipDebugInfo(requestChipDebugInfo_cb hidl_status_cb) override; - Return requestDriverDebugDump(requestDriverDebugDump_cb hidl_status_cb) override; - Return requestFirmwareDebugDump(requestFirmwareDebugDump_cb hidl_status_cb) override; - Return createApIface(createApIface_cb hidl_status_cb) override; - Return createBridgedApIface(createBridgedApIface_cb hidl_status_cb) override; - Return getApIfaceNames(getApIfaceNames_cb hidl_status_cb) override; - Return getApIface(const hidl_string& ifname, getApIface_cb hidl_status_cb) override; - Return removeApIface(const hidl_string& ifname, removeApIface_cb hidl_status_cb) override; - Return removeIfaceInstanceFromBridgedApIface( - const hidl_string& brIfaceName, const hidl_string& ifaceInstanceName, - removeIfaceInstanceFromBridgedApIface_cb hidl_status_cb) override; - Return createNanIface(createNanIface_cb hidl_status_cb) override; - Return getNanIfaceNames(getNanIfaceNames_cb hidl_status_cb) override; - Return getNanIface(const hidl_string& ifname, getNanIface_cb hidl_status_cb) override; - Return removeNanIface(const hidl_string& ifname, - removeNanIface_cb hidl_status_cb) override; - Return createP2pIface(createP2pIface_cb hidl_status_cb) override; - Return getP2pIfaceNames(getP2pIfaceNames_cb hidl_status_cb) override; - Return getP2pIface(const hidl_string& ifname, getP2pIface_cb hidl_status_cb) override; - Return removeP2pIface(const hidl_string& ifname, - removeP2pIface_cb hidl_status_cb) override; - Return createStaIface(createStaIface_cb hidl_status_cb) override; - Return getStaIfaceNames(getStaIfaceNames_cb hidl_status_cb) override; - Return getStaIface(const hidl_string& ifname, getStaIface_cb hidl_status_cb) override; - Return removeStaIface(const hidl_string& ifname, - removeStaIface_cb hidl_status_cb) override; - Return createRttController(const sp& bound_iface, - createRttController_cb hidl_status_cb) override; - Return getDebugRingBuffersStatus(getDebugRingBuffersStatus_cb hidl_status_cb) override; - Return startLoggingToDebugRingBuffer( - const hidl_string& ring_name, WifiDebugRingBufferVerboseLevel verbose_level, - uint32_t max_interval_in_sec, uint32_t min_data_size_in_bytes, - startLoggingToDebugRingBuffer_cb hidl_status_cb) override; - Return forceDumpToDebugRingBuffer(const hidl_string& ring_name, - forceDumpToDebugRingBuffer_cb hidl_status_cb) override; - Return flushRingBufferToFile(flushRingBufferToFile_cb hidl_status_cb) override; - Return stopLoggingToDebugRingBuffer( - stopLoggingToDebugRingBuffer_cb hidl_status_cb) override; - Return getDebugHostWakeReasonStats( - getDebugHostWakeReasonStats_cb hidl_status_cb) override; - Return enableDebugErrorAlerts(bool enable, - enableDebugErrorAlerts_cb hidl_status_cb) override; - Return selectTxPowerScenario(V1_1::IWifiChip::TxPowerScenario scenario, - selectTxPowerScenario_cb hidl_status_cb) override; - Return resetTxPowerScenario(resetTxPowerScenario_cb hidl_status_cb) override; - Return setLatencyMode(LatencyMode mode, setLatencyMode_cb hidl_status_cb) override; - Return registerEventCallback_1_2(const sp& event_callback, - registerEventCallback_1_2_cb hidl_status_cb) override; - Return selectTxPowerScenario_1_2(TxPowerScenario scenario, - selectTxPowerScenario_cb hidl_status_cb) override; - Return getCapabilities_1_3(getCapabilities_cb hidl_status_cb) override; - Return getCapabilities_1_5(getCapabilities_1_5_cb hidl_status_cb) override; - Return debug(const hidl_handle& handle, const hidl_vec& options) override; - Return createRttController_1_4(const sp& bound_iface, - createRttController_1_4_cb hidl_status_cb) override; - Return registerEventCallback_1_4(const sp& event_callback, - registerEventCallback_1_4_cb hidl_status_cb) override; - Return setMultiStaPrimaryConnection( - const hidl_string& ifname, setMultiStaPrimaryConnection_cb hidl_status_cb) override; - Return setMultiStaUseCase(MultiStaUseCase use_case, - setMultiStaUseCase_cb hidl_status_cb) override; - Return setCoexUnsafeChannels(const hidl_vec& unsafe_channels, - hidl_bitfield restrictions, - setCoexUnsafeChannels_cb hidl_status_cb) override; - Return setCountryCode(const hidl_array& code, - setCountryCode_cb _hidl_cb) override; - Return getUsableChannels(WifiBand band, hidl_bitfield ifaceModeMask, - hidl_bitfield filterMask, - getUsableChannels_cb _hidl_cb) override; - Return triggerSubsystemRestart(triggerSubsystemRestart_cb hidl_status_cb) override; - Return createRttController_1_6(const sp& bound_iface, - createRttController_1_6_cb hidl_status_cb) override; - Return getUsableChannels_1_6(WifiBand band, - hidl_bitfield ifaceModeMask, - hidl_bitfield filterMask, - getUsableChannels_1_6_cb _hidl_cb) override; - Return getSupportedRadioCombinationsMatrix( - getSupportedRadioCombinationsMatrix_cb hidl_status_cb) override; - Return getAvailableModes_1_6(getAvailableModes_1_6_cb hidl_status_cb) override; - - private: - void invalidateAndRemoveAllIfaces(); - // When a STA iface is removed any dependent NAN-ifaces/RTT-controllers are - // invalidated & removed. - void invalidateAndRemoveDependencies(const std::string& removed_iface_name); - - // Corresponding worker functions for the HIDL methods. - std::pair getIdInternal(); - // Deprecated support for this callback - WifiStatus registerEventCallbackInternal( - const sp& event_callback); - std::pair getCapabilitiesInternal(); - std::pair> getAvailableModesInternal(); - WifiStatus configureChipInternal(std::unique_lock* lock, - ChipModeId mode_id); - std::pair getModeInternal(); - std::pair requestChipDebugInfoInternal(); - std::pair> requestDriverDebugDumpInternal(); - std::pair> requestFirmwareDebugDumpInternal(); - sp newWifiApIface(std::string& ifname); - WifiStatus createVirtualApInterface(const std::string& apVirtIf); - std::pair> createApIfaceInternal(); - std::pair> createBridgedApIfaceInternal(); - std::pair> getApIfaceNamesInternal(); - std::pair> getApIfaceInternal(const std::string& ifname); - WifiStatus removeApIfaceInternal(const std::string& ifname); - WifiStatus removeIfaceInstanceFromBridgedApIfaceInternal(const std::string& brIfaceName, - const std::string& ifInstanceName); - std::pair> createNanIfaceInternal(); - std::pair> getNanIfaceNamesInternal(); - std::pair> getNanIfaceInternal(const std::string& ifname); - WifiStatus removeNanIfaceInternal(const std::string& ifname); - std::pair> createP2pIfaceInternal(); - std::pair> getP2pIfaceNamesInternal(); - std::pair> getP2pIfaceInternal(const std::string& ifname); - WifiStatus removeP2pIfaceInternal(const std::string& ifname); - std::pair> createStaIfaceInternal(); - std::pair> getStaIfaceNamesInternal(); - std::pair> getStaIfaceInternal(const std::string& ifname); - WifiStatus removeStaIfaceInternal(const std::string& ifname); - std::pair> createRttControllerInternal( - const sp& bound_iface); - std::pair> - getDebugRingBuffersStatusInternal(); - WifiStatus startLoggingToDebugRingBufferInternal(const hidl_string& ring_name, - WifiDebugRingBufferVerboseLevel verbose_level, - uint32_t max_interval_in_sec, - uint32_t min_data_size_in_bytes); - WifiStatus forceDumpToDebugRingBufferInternal(const hidl_string& ring_name); - WifiStatus flushRingBufferToFileInternal(); - WifiStatus stopLoggingToDebugRingBufferInternal(); - std::pair getDebugHostWakeReasonStatsInternal(); - WifiStatus enableDebugErrorAlertsInternal(bool enable); - WifiStatus selectTxPowerScenarioInternal(V1_1::IWifiChip::TxPowerScenario scenario); - WifiStatus resetTxPowerScenarioInternal(); - WifiStatus setLatencyModeInternal(LatencyMode mode); - WifiStatus registerEventCallbackInternal_1_2( - const sp& event_callback); - WifiStatus selectTxPowerScenarioInternal_1_2(TxPowerScenario scenario); - std::pair getCapabilitiesInternal_1_3(); - std::pair getCapabilitiesInternal_1_5(); - std::pair> createRttControllerInternal_1_4( - const sp& bound_iface); - WifiStatus registerEventCallbackInternal_1_4( - const sp& event_callback); - WifiStatus setMultiStaPrimaryConnectionInternal(const std::string& ifname); - WifiStatus setMultiStaUseCaseInternal(MultiStaUseCase use_case); - WifiStatus setCoexUnsafeChannelsInternal(std::vector unsafe_channels, - uint32_t restrictions); - WifiStatus setCountryCodeInternal(const std::array& code); - std::pair> getUsableChannelsInternal( - WifiBand band, uint32_t ifaceModeMask, uint32_t filterMask); - WifiStatus handleChipConfiguration(std::unique_lock* lock, - ChipModeId mode_id); - WifiStatus registerDebugRingBufferCallback(); - WifiStatus registerRadioModeChangeCallback(); - std::vector - getCurrentModeConcurrencyCombinations(); - std::map getCurrentConcurrencyCombination(); - std::vector> expandConcurrencyCombinations( - const V1_6::IWifiChip::ChipConcurrencyCombination& combination); - bool canExpandedConcurrencyComboSupportConcurrencyTypeWithCurrentTypes( - const std::map& expanded_combo, - IfaceConcurrencyType requested_type); - bool canCurrentModeSupportConcurrencyTypeWithCurrentTypes(IfaceConcurrencyType requested_type); - bool canExpandedConcurrencyComboSupportConcurrencyCombo( - const std::map& expanded_combo, - const std::map& req_combo); - bool canCurrentModeSupportConcurrencyCombo( - const std::map& req_combo); - bool canCurrentModeSupportConcurrencyType(IfaceConcurrencyType requested_type); - bool isValidModeId(ChipModeId mode_id); - bool isStaApConcurrencyAllowedInCurrentMode(); - bool isDualStaConcurrencyAllowedInCurrentMode(); - uint32_t startIdxOfApIface(); - std::string getFirstActiveWlanIfaceName(); - std::string allocateApOrStaIfaceName(IfaceType type, uint32_t start_idx); - std::string allocateApIfaceName(); - std::vector allocateBridgedApInstanceNames(); - std::string allocateStaIfaceName(); - bool writeRingbufferFilesInternal(); - std::string getWlanIfaceNameWithType(IfaceType type, unsigned idx); - void invalidateAndClearBridgedApAll(); - void deleteApIface(const std::string& if_name); - bool findUsingNameFromBridgedApInstances(const std::string& name); - WifiStatus triggerSubsystemRestartInternal(); - std::pair> createRttControllerInternal_1_6( - const sp& bound_iface); - std::pair> getUsableChannelsInternal_1_6( - WifiBand band, uint32_t ifaceModeMask, uint32_t filterMask); - std::pair getSupportedRadioCombinationsMatrixInternal(); - std::pair> getAvailableModesInternal_1_6(); - - ChipId chip_id_; - std::weak_ptr legacy_hal_; - std::weak_ptr mode_controller_; - std::shared_ptr iface_util_; - std::vector> ap_ifaces_; - std::vector> nan_ifaces_; - std::vector> p2p_ifaces_; - std::vector> sta_ifaces_; - std::vector> rtt_controllers_; - std::map ringbuffer_map_; - bool is_valid_; - // Members pertaining to chip configuration. - uint32_t current_mode_id_; - std::mutex lock_t; - std::vector modes_; - // The legacy ring buffer callback API has only a global callback - // registration mechanism. Use this to check if we have already - // registered a callback. - bool debug_ring_buffer_cb_registered_; - hidl_callback_util::HidlCallbackHandler event_cb_handler_; - - const std::function subsystemCallbackHandler_; - std::map> br_ifaces_ap_instances_; - DISALLOW_COPY_AND_ASSIGN(WifiChip); -}; - -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // WIFI_CHIP_H_ diff --git a/wifi/1.6/default/wifi_feature_flags.cpp b/wifi/1.6/default/wifi_feature_flags.cpp deleted file mode 100644 index e80a3cdcb6..0000000000 --- a/wifi/1.6/default/wifi_feature_flags.cpp +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#include - -#include -#include - -#include "wifi_feature_flags.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace feature_flags { - -using V1_0::ChipModeId; -using V1_0::IWifiChip; -using V1_6::IfaceConcurrencyType; - -/* The chip may either have a single mode supporting any number of combinations, - * or a fixed dual-mode (so it involves firmware loading to switch between - * modes) setting. If there is a need to support more modes, it needs to be - * implemented manually in WiFi HAL (see changeFirmwareMode in - * WifiChip::handleChipConfiguration). - * - * Supported combinations are defined in device's makefile, for example: - * WIFI_HAL_INTERFACE_COMBINATIONS := {{{STA, AP}, 1}, {{P2P, NAN}, 1}}, - * WIFI_HAL_INTERFACE_COMBINATIONS += {{{STA}, 1}, {{AP}, 2}} - * What means: - * Interface concurrency combination 1: 1 STA or AP and 1 P2P or NAN concurrent iface - * operations. - * Interface concurrency combination 2: 1 STA and 2 AP concurrent iface operations. - * - * For backward compatibility, the following makefile flags can be used to - * generate combinations list: - * - WIFI_HIDL_FEATURE_DUAL_INTERFACE - * - WIFI_HIDL_FEATURE_DISABLE_AP - * - WIFI_HIDL_FEATURE_AWARE - * However, they are ignored if WIFI_HAL_INTERFACE_COMBINATIONS was provided. - * With WIFI_HIDL_FEATURE_DUAL_INTERFACE flag set, there is a single mode with - * two concurrency combinations: - * Interface Concurrency Combination 1: Will support 1 STA and 1 P2P or NAN (optional) - * concurrent iface operations. - * Interface Concurrency Combination 2: Will support 1 STA and 1 AP concurrent - * iface operations. - * - * The only dual-mode configuration supported is for alternating STA and AP - * mode, that may involve firmware reloading. In such case, there are 2 separate - * modes of operation with 1 concurrency combination each: - * Mode 1 (STA mode): Will support 1 STA and 1 P2P or NAN (optional) - * concurrent iface operations. - * Mode 2 (AP mode): Will support 1 AP iface operation. - * - * If Aware is enabled, the concurrency combination will be modified to support either - * P2P or NAN in place of just P2P. - */ -// clang-format off -#ifdef WIFI_HAL_INTERFACE_COMBINATIONS -constexpr ChipModeId kMainModeId = chip_mode_ids::kV3; -#elif defined(WIFI_HIDL_FEATURE_DUAL_INTERFACE) -// former V2 (fixed dual interface) setup expressed as V3 -constexpr ChipModeId kMainModeId = chip_mode_ids::kV3; -# ifdef WIFI_HIDL_FEATURE_DISABLE_AP -# ifdef WIFI_HIDL_FEATURE_AWARE -// 1 STA + 1 of (P2P or NAN) -# define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{P2P, NAN}, 1}} -# else -// 1 STA + 1 P2P -# define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{P2P}, 1}} -# endif -# else -# ifdef WIFI_HIDL_FEATURE_AWARE -// (1 STA + 1 AP) or (1 STA + 1 of (P2P or NAN)) -# define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{AP}, 1}},\ - {{{STA}, 1}, {{P2P, NAN}, 1}} -# else -// (1 STA + 1 AP) or (1 STA + 1 P2P) -# define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{AP}, 1}},\ - {{{STA}, 1}, {{P2P}, 1}} -# endif -# endif -#else -// V1 (fixed single interface, dual-mode chip) -constexpr ChipModeId kMainModeId = chip_mode_ids::kV1Sta; -# ifdef WIFI_HIDL_FEATURE_AWARE -// 1 STA + 1 of (P2P or NAN) -# define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{P2P, NAN}, 1}} -# else -// 1 STA + 1 P2P -# define WIFI_HAL_INTERFACE_COMBINATIONS {{{STA}, 1}, {{P2P}, 1}} -# endif - -# ifndef WIFI_HIDL_FEATURE_DISABLE_AP -# define WIFI_HAL_INTERFACE_COMBINATIONS_AP {{{AP}, 1}} -# endif -#endif -// clang-format on - -/** - * Helper class to convert a collection of combination limits to a combination. - * - * The main point here is to simplify the syntax required by - * WIFI_HAL_INTERFACE_COMBINATIONS. - */ -struct ChipConcurrencyCombination - : public hidl_vec { - ChipConcurrencyCombination( - const std::initializer_list list) - : hidl_vec(list) {} - - operator V1_6::IWifiChip::ChipConcurrencyCombination() const { return {*this}; } - - static hidl_vec make_vec( - const std::initializer_list list) { - return hidl_vec( // - std::begin(list), std::end(list)); - } -}; - -#define STA IfaceConcurrencyType::STA -#define AP IfaceConcurrencyType::AP -#define AP_BRIDGED IfaceConcurrencyType::AP_BRIDGED -#define P2P IfaceConcurrencyType::P2P -#define NAN IfaceConcurrencyType::NAN -static const std::vector kChipModesPrimary{ - {kMainModeId, ChipConcurrencyCombination::make_vec({WIFI_HAL_INTERFACE_COMBINATIONS})}, -#ifdef WIFI_HAL_INTERFACE_COMBINATIONS_AP - {chip_mode_ids::kV1Ap, - ChipConcurrencyCombination::make_vec({WIFI_HAL_INTERFACE_COMBINATIONS_AP})}, -#endif -}; - -static const std::vector kChipModesSecondary{ -#ifdef WIFI_HAL_INTERFACE_COMBINATIONS_SECONDARY_CHIP - {chip_mode_ids::kV3, - ChipConcurrencyCombination::make_vec({WIFI_HAL_INTERFACE_COMBINATIONS_SECONDARY_CHIP})}, -#endif -}; - -constexpr char kDebugPresetInterfaceCombinationIdxProperty[] = - "persist.vendor.debug.wifi.hal.preset_interface_combination_idx"; -// List of pre-defined concurrency combinations that can be enabled at runtime via -// setting the property: "kDebugPresetInterfaceCombinationIdxProperty" to the -// corresponding index value. -static const std::vector>> - kDebugChipModes{// Legacy combination - No STA/AP concurrencies. - // 0 - (1 AP) or (1 STA + 1 of (P2P or NAN)) - {"No STA/AP Concurrency", - {{kMainModeId, ChipConcurrencyCombination::make_vec( - {{{{AP}, 1}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}}, - - // STA + AP concurrency - // 1 - (1 STA + 1 AP) or (1 STA + 1 of (P2P or NAN)) - {"STA + AP Concurrency", - {{kMainModeId, - ChipConcurrencyCombination::make_vec( - {{{{STA}, 1}, {{AP}, 1}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}}, - - // STA + STA concurrency - // 2 - (1 STA + 1 AP) or (2 STA + 1 of (P2P or NAN)) - {"Dual STA Concurrency", - {{kMainModeId, - ChipConcurrencyCombination::make_vec( - {{{{STA}, 1}, {{AP}, 1}}, {{{STA}, 2}, {{P2P, NAN}, 1}}})}}}, - - // AP + AP + STA concurrency - // 3 - (1 STA + 2 AP) or (1 STA + 1 of (P2P or NAN)) - {"Dual AP Concurrency", - {{kMainModeId, - ChipConcurrencyCombination::make_vec( - {{{{STA}, 1}, {{AP}, 2}}, {{{STA}, 1}, {{P2P, NAN}, 1}}})}}}, - - // STA + STA concurrency and AP + AP + STA concurrency - // 4 - (1 STA + 2 AP) or (2 STA + 1 of (P2P or NAN)) - {"Dual STA & Dual AP Concurrency", - {{kMainModeId, - ChipConcurrencyCombination::make_vec( - {{{{STA}, 1}, {{AP}, 2}}, {{{STA}, 2}, {{P2P, NAN}, 1}}})}}}, - - // STA + STA concurrency - // 5 - (1 STA + 1 AP (bridged or single) | P2P | NAN), or (2 STA)) - {"Dual STA or STA plus single other interface", - {{kMainModeId, ChipConcurrencyCombination::make_vec( - {{{{STA}, 1}, {{P2P, NAN, AP, AP_BRIDGED}, 1}}, - {{{STA}, 2}}})}}}}; - -#undef STA -#undef AP -#undef P2P -#undef NAN - -#ifdef WIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION -#pragma message \ - "WIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION is deprecated; override " \ - "'config_wifi_ap_randomization_supported' in " \ - "frameworks/base/core/res/res/values/config.xml in the device overlay " \ - "instead" -#endif // WIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION - -WifiFeatureFlags::WifiFeatureFlags() {} - -std::vector WifiFeatureFlags::getChipModesForPrimary() { - std::array buffer; - auto res = property_get(kDebugPresetInterfaceCombinationIdxProperty, buffer.data(), nullptr); - // Debug property not set, use the device preset concurrency combination. - if (res <= 0) return kChipModesPrimary; - - // Debug property set, use one of the debug preset concurrency combination. - unsigned long idx = std::stoul(buffer.data()); - if (idx >= kDebugChipModes.size()) { - LOG(ERROR) << "Invalid index set in property: " - << kDebugPresetInterfaceCombinationIdxProperty; - return kChipModesPrimary; - } - std::string name; - std::vector chip_modes; - std::tie(name, chip_modes) = kDebugChipModes[idx]; - LOG(INFO) << "Using debug chip mode: <" << name - << "> set via property: " << kDebugPresetInterfaceCombinationIdxProperty; - return chip_modes; -} - -std::vector WifiFeatureFlags::getChipModes(bool is_primary) { - return (is_primary) ? getChipModesForPrimary() : kChipModesSecondary; -} - -} // namespace feature_flags -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/wifi_feature_flags.h b/wifi/1.6/default/wifi_feature_flags.h deleted file mode 100644 index 1635341e3f..0000000000 --- a/wifi/1.6/default/wifi_feature_flags.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef WIFI_FEATURE_FLAGS_H_ -#define WIFI_FEATURE_FLAGS_H_ - -#include - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace feature_flags { - -namespace chip_mode_ids { -// These mode ID's should be unique (even across combo versions). Refer to -// handleChipConfiguration() for it's usage. -constexpr V1_0::ChipModeId kInvalid = UINT32_MAX; -// Mode ID's for V1 -constexpr V1_0::ChipModeId kV1Sta = 0; -constexpr V1_0::ChipModeId kV1Ap = 1; -// Mode ID for V3 -constexpr V1_0::ChipModeId kV3 = 3; -} // namespace chip_mode_ids - -class WifiFeatureFlags { - public: - WifiFeatureFlags(); - virtual ~WifiFeatureFlags() = default; - - virtual std::vector getChipModes(bool is_primary); - - private: - std::vector getChipModesForPrimary(); -}; - -} // namespace feature_flags -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // WIFI_FEATURE_FLAGS_H_ diff --git a/wifi/1.6/default/wifi_iface_util.cpp b/wifi/1.6/default/wifi_iface_util.cpp deleted file mode 100644 index d55e4f8251..0000000000 --- a/wifi/1.6/default/wifi_iface_util.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (C) 2019 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. - */ - -#include -#include -#include -#include -#include - -#include -#include -#include - -#undef NAN -#include "wifi_iface_util.h" - -namespace { -// Constants to set the local bit & clear the multicast bit. -constexpr uint8_t kMacAddressMulticastMask = 0x01; -constexpr uint8_t kMacAddressLocallyAssignedMask = 0x02; -} // namespace - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace iface_util { - -WifiIfaceUtil::WifiIfaceUtil(const std::weak_ptr iface_tool, - const std::weak_ptr legacy_hal) - : iface_tool_(iface_tool), - legacy_hal_(legacy_hal), - random_mac_address_(nullptr), - event_handlers_map_() {} - -std::array WifiIfaceUtil::getFactoryMacAddress(const std::string& iface_name) { - return iface_tool_.lock()->GetFactoryMacAddress(iface_name.c_str()); -} - -bool WifiIfaceUtil::setMacAddress(const std::string& iface_name, - const std::array& mac) { -#ifndef WIFI_AVOID_IFACE_RESET_MAC_CHANGE - legacy_hal::wifi_error legacy_status; - uint64_t legacy_feature_set; - std::tie(legacy_status, legacy_feature_set) = - legacy_hal_.lock()->getSupportedFeatureSet(iface_name); - - if (!(legacy_feature_set & WIFI_FEATURE_DYNAMIC_SET_MAC) && - !iface_tool_.lock()->SetUpState(iface_name.c_str(), false)) { - LOG(ERROR) << "SetUpState(false) failed."; - return false; - } -#endif - bool success = iface_tool_.lock()->SetMacAddress(iface_name.c_str(), mac); -#ifndef WIFI_AVOID_IFACE_RESET_MAC_CHANGE - if (!(legacy_feature_set & WIFI_FEATURE_DYNAMIC_SET_MAC) && - !iface_tool_.lock()->SetUpState(iface_name.c_str(), true)) { - LOG(ERROR) << "SetUpState(true) failed. Wait for driver ready."; - // Wait for driver ready and try to set iface UP again - if (legacy_hal_.lock()->waitForDriverReady() != legacy_hal::WIFI_SUCCESS) { - LOG(ERROR) << "SetUpState(true) wait for driver ready failed."; - return false; - } - if (!iface_tool_.lock()->SetUpState(iface_name.c_str(), true)) { - LOG(ERROR) << "SetUpState(true) failed after retry."; - return false; - } - } -#endif - IfaceEventHandlers event_handlers = {}; - const auto it = event_handlers_map_.find(iface_name); - if (it != event_handlers_map_.end()) { - event_handlers = it->second; - } - if (event_handlers.on_state_toggle_off_on != nullptr) { - event_handlers.on_state_toggle_off_on(iface_name); - } - if (!success) { - LOG(ERROR) << "SetMacAddress failed on " << iface_name; - } else { - LOG(DEBUG) << "SetMacAddress succeeded on " << iface_name; - } - return success; -} - -std::array WifiIfaceUtil::getOrCreateRandomMacAddress() { - if (random_mac_address_) { - return *random_mac_address_.get(); - } - random_mac_address_ = std::make_unique>(createRandomMacAddress()); - return *random_mac_address_.get(); -} - -void WifiIfaceUtil::registerIfaceEventHandlers(const std::string& iface_name, - IfaceEventHandlers handlers) { - event_handlers_map_[iface_name] = handlers; -} - -void WifiIfaceUtil::unregisterIfaceEventHandlers(const std::string& iface_name) { - event_handlers_map_.erase(iface_name); -} - -std::array WifiIfaceUtil::createRandomMacAddress() { - std::array address = {}; - std::random_device rd; - std::default_random_engine engine(rd()); - std::uniform_int_distribution dist(std::numeric_limits::min(), - std::numeric_limits::max()); - for (size_t i = 0; i < address.size(); i++) { - address[i] = dist(engine); - } - // Set the local bit and clear the multicast bit. - address[0] |= kMacAddressLocallyAssignedMask; - address[0] &= ~kMacAddressMulticastMask; - return address; -} - -bool WifiIfaceUtil::setUpState(const std::string& iface_name, bool request_up) { - if (!iface_tool_.lock()->SetUpState(iface_name.c_str(), request_up)) { - LOG(ERROR) << "SetUpState to " << request_up << " failed"; - return false; - } - return true; -} - -unsigned WifiIfaceUtil::ifNameToIndex(const std::string& iface_name) { - return if_nametoindex(iface_name.c_str()); -} - -bool WifiIfaceUtil::createBridge(const std::string& br_name) { - if (!iface_tool_.lock()->createBridge(br_name)) { - return false; - } - - if (!iface_tool_.lock()->SetUpState(br_name.c_str(), true)) { - LOG(ERROR) << "bridge SetUpState(true) failed."; - } - return true; -} - -bool WifiIfaceUtil::deleteBridge(const std::string& br_name) { - if (!iface_tool_.lock()->SetUpState(br_name.c_str(), false)) { - LOG(INFO) << "SetUpState(false) failed for bridge=" << br_name.c_str(); - } - - return iface_tool_.lock()->deleteBridge(br_name); -} - -bool WifiIfaceUtil::addIfaceToBridge(const std::string& br_name, const std::string& if_name) { - return iface_tool_.lock()->addIfaceToBridge(br_name, if_name); -} - -bool WifiIfaceUtil::removeIfaceFromBridge(const std::string& br_name, const std::string& if_name) { - return iface_tool_.lock()->removeIfaceFromBridge(br_name, if_name); -} - -} // namespace iface_util -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/wifi_iface_util.h b/wifi/1.6/default/wifi_iface_util.h deleted file mode 100644 index c5db5deed1..0000000000 --- a/wifi/1.6/default/wifi_iface_util.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2019 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. - */ - -#ifndef WIFI_IFACE_UTIL_H_ -#define WIFI_IFACE_UTIL_H_ - -#include - -#include - -#include "wifi_legacy_hal.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace iface_util { - -// Iface event handlers. -struct IfaceEventHandlers { - // Callback to be invoked when the iface is set down & up for MAC address - // change. - std::function on_state_toggle_off_on; -}; - -/** - * Util class for common iface operations. - */ -class WifiIfaceUtil { - public: - WifiIfaceUtil(const std::weak_ptr iface_tool, - const std::weak_ptr legacy_hal); - virtual ~WifiIfaceUtil() = default; - - virtual std::array getFactoryMacAddress(const std::string& iface_name); - virtual bool setMacAddress(const std::string& iface_name, const std::array& mac); - // Get or create a random MAC address. The MAC address returned from - // this method will remain the same throughout the lifetime of the HAL - // daemon. (So, changes on every reboot) - virtual std::array getOrCreateRandomMacAddress(); - - // Register for any iface event callbacks for the provided interface. - virtual void registerIfaceEventHandlers(const std::string& iface_name, - IfaceEventHandlers handlers); - virtual void unregisterIfaceEventHandlers(const std::string& iface_name); - virtual bool setUpState(const std::string& iface_name, bool request_up); - virtual unsigned ifNameToIndex(const std::string& iface_name); - - virtual bool createBridge(const std::string& br_name); - - virtual bool deleteBridge(const std::string& br_name); - - virtual bool addIfaceToBridge(const std::string& br_name, const std::string& if_name); - - virtual bool removeIfaceFromBridge(const std::string& br_name, const std::string& if_name); - // Get a random MAC address. - virtual std::array createRandomMacAddress(); - - private: - std::weak_ptr iface_tool_; - std::weak_ptr legacy_hal_; - std::unique_ptr> random_mac_address_; - std::map event_handlers_map_; -}; - -} // namespace iface_util -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // WIFI_IFACE_UTIL_H_ diff --git a/wifi/1.6/default/wifi_legacy_hal.cpp b/wifi/1.6/default/wifi_legacy_hal.cpp deleted file mode 100644 index 43cb7c42a1..0000000000 --- a/wifi/1.6/default/wifi_legacy_hal.cpp +++ /dev/null @@ -1,1654 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#include -#include - -#include -#include -#include - -#include "hidl_sync_util.h" -#include "wifi_legacy_hal.h" -#include "wifi_legacy_hal_stubs.h" - -namespace { -// Constants ported over from the legacy HAL calling code -// (com_android_server_wifi_WifiNative.cpp). This will all be thrown -// away when this shim layer is replaced by the real vendor -// implementation. -static constexpr uint32_t kMaxVersionStringLength = 256; -static constexpr uint32_t kMaxCachedGscanResults = 64; -static constexpr uint32_t kMaxGscanFrequenciesForBand = 64; -static constexpr uint32_t kLinkLayerStatsDataMpduSizeThreshold = 128; -static constexpr uint32_t kMaxWakeReasonStatsArraySize = 32; -static constexpr uint32_t kMaxRingBuffers = 10; -static constexpr uint32_t kMaxWifiUsableChannels = 256; -static constexpr uint32_t kMaxSupportedRadioCombinationsMatrixLength = 256; -// need a long timeout (1000ms) for chips that unload their driver. -static constexpr uint32_t kMaxStopCompleteWaitMs = 1000; -static constexpr char kDriverPropName[] = "wlan.driver.status"; - -// Helper function to create a non-const char* for legacy Hal API's. -std::vector makeCharVec(const std::string& str) { - std::vector vec(str.size() + 1); - vec.assign(str.begin(), str.end()); - vec.push_back('\0'); - return vec; -} -} // namespace - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace legacy_hal { - -// Legacy HAL functions accept "C" style function pointers, so use global -// functions to pass to the legacy HAL function and store the corresponding -// std::function methods to be invoked. -// -// Callback to be invoked once |stop| is complete -std::function on_stop_complete_internal_callback; -void onAsyncStopComplete(wifi_handle handle) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_stop_complete_internal_callback) { - on_stop_complete_internal_callback(handle); - // Invalidate this callback since we don't want this firing again. - on_stop_complete_internal_callback = nullptr; - } -} - -// Callback to be invoked for driver dump. -std::function on_driver_memory_dump_internal_callback; -void onSyncDriverMemoryDump(char* buffer, int buffer_size) { - if (on_driver_memory_dump_internal_callback) { - on_driver_memory_dump_internal_callback(buffer, buffer_size); - } -} - -// Callback to be invoked for firmware dump. -std::function on_firmware_memory_dump_internal_callback; -void onSyncFirmwareMemoryDump(char* buffer, int buffer_size) { - if (on_firmware_memory_dump_internal_callback) { - on_firmware_memory_dump_internal_callback(buffer, buffer_size); - } -} - -// Callback to be invoked for Gscan events. -std::function on_gscan_event_internal_callback; -void onAsyncGscanEvent(wifi_request_id id, wifi_scan_event event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_gscan_event_internal_callback) { - on_gscan_event_internal_callback(id, event); - } -} - -// Callback to be invoked for Gscan full results. -std::function - on_gscan_full_result_internal_callback; -void onAsyncGscanFullResult(wifi_request_id id, wifi_scan_result* result, - uint32_t buckets_scanned) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_gscan_full_result_internal_callback) { - on_gscan_full_result_internal_callback(id, result, buckets_scanned); - } -} - -// Callback to be invoked for link layer stats results. -std::function - on_link_layer_stats_result_internal_callback; -void onSyncLinkLayerStatsResult(wifi_request_id id, wifi_iface_stat* iface_stat, int num_radios, - wifi_radio_stat* radio_stat) { - if (on_link_layer_stats_result_internal_callback) { - on_link_layer_stats_result_internal_callback(id, iface_stat, num_radios, radio_stat); - } -} - -// Callback to be invoked for rssi threshold breach. -std::function - on_rssi_threshold_breached_internal_callback; -void onAsyncRssiThresholdBreached(wifi_request_id id, uint8_t* bssid, int8_t rssi) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_rssi_threshold_breached_internal_callback) { - on_rssi_threshold_breached_internal_callback(id, bssid, rssi); - } -} - -// Callback to be invoked for ring buffer data indication. -std::function - on_ring_buffer_data_internal_callback; -void onAsyncRingBufferData(char* ring_name, char* buffer, int buffer_size, - wifi_ring_buffer_status* status) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_ring_buffer_data_internal_callback) { - on_ring_buffer_data_internal_callback(ring_name, buffer, buffer_size, status); - } -} - -// Callback to be invoked for error alert indication. -std::function on_error_alert_internal_callback; -void onAsyncErrorAlert(wifi_request_id id, char* buffer, int buffer_size, int err_code) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_error_alert_internal_callback) { - on_error_alert_internal_callback(id, buffer, buffer_size, err_code); - } -} - -// Callback to be invoked for radio mode change indication. -std::function - on_radio_mode_change_internal_callback; -void onAsyncRadioModeChange(wifi_request_id id, uint32_t num_macs, wifi_mac_info* mac_infos) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_radio_mode_change_internal_callback) { - on_radio_mode_change_internal_callback(id, num_macs, mac_infos); - } -} - -// Callback to be invoked to report subsystem restart -std::function on_subsystem_restart_internal_callback; -void onAsyncSubsystemRestart(const char* error) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_subsystem_restart_internal_callback) { - on_subsystem_restart_internal_callback(error); - } -} - -// Callback to be invoked for rtt results results. -std::function - on_rtt_results_internal_callback; -void onAsyncRttResults(wifi_request_id id, unsigned num_results, wifi_rtt_result* rtt_results[]) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_rtt_results_internal_callback) { - on_rtt_results_internal_callback(id, num_results, rtt_results); - on_rtt_results_internal_callback = nullptr; - } -} - -// Callbacks for the various NAN operations. -// NOTE: These have very little conversions to perform before invoking the user -// callbacks. -// So, handle all of them here directly to avoid adding an unnecessary layer. -std::function on_nan_notify_response_user_callback; -void onAysncNanNotifyResponse(transaction_id id, NanResponseMsg* msg) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_nan_notify_response_user_callback && msg) { - on_nan_notify_response_user_callback(id, *msg); - } -} - -std::function on_nan_event_publish_replied_user_callback; -void onAysncNanEventPublishReplied(NanPublishRepliedInd* /* event */) { - LOG(ERROR) << "onAysncNanEventPublishReplied triggered"; -} - -std::function on_nan_event_publish_terminated_user_callback; -void onAysncNanEventPublishTerminated(NanPublishTerminatedInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_nan_event_publish_terminated_user_callback && event) { - on_nan_event_publish_terminated_user_callback(*event); - } -} - -std::function on_nan_event_match_user_callback; -void onAysncNanEventMatch(NanMatchInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_nan_event_match_user_callback && event) { - on_nan_event_match_user_callback(*event); - } -} - -std::function on_nan_event_match_expired_user_callback; -void onAysncNanEventMatchExpired(NanMatchExpiredInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_nan_event_match_expired_user_callback && event) { - on_nan_event_match_expired_user_callback(*event); - } -} - -std::function - on_nan_event_subscribe_terminated_user_callback; -void onAysncNanEventSubscribeTerminated(NanSubscribeTerminatedInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_nan_event_subscribe_terminated_user_callback && event) { - on_nan_event_subscribe_terminated_user_callback(*event); - } -} - -std::function on_nan_event_followup_user_callback; -void onAysncNanEventFollowup(NanFollowupInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_nan_event_followup_user_callback && event) { - on_nan_event_followup_user_callback(*event); - } -} - -std::function on_nan_event_disc_eng_event_user_callback; -void onAysncNanEventDiscEngEvent(NanDiscEngEventInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_nan_event_disc_eng_event_user_callback && event) { - on_nan_event_disc_eng_event_user_callback(*event); - } -} - -std::function on_nan_event_disabled_user_callback; -void onAysncNanEventDisabled(NanDisabledInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_nan_event_disabled_user_callback && event) { - on_nan_event_disabled_user_callback(*event); - } -} - -std::function on_nan_event_tca_user_callback; -void onAysncNanEventTca(NanTCAInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_nan_event_tca_user_callback && event) { - on_nan_event_tca_user_callback(*event); - } -} - -std::function on_nan_event_beacon_sdf_payload_user_callback; -void onAysncNanEventBeaconSdfPayload(NanBeaconSdfPayloadInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_nan_event_beacon_sdf_payload_user_callback && event) { - on_nan_event_beacon_sdf_payload_user_callback(*event); - } -} - -std::function on_nan_event_data_path_request_user_callback; -void onAysncNanEventDataPathRequest(NanDataPathRequestInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_nan_event_data_path_request_user_callback && event) { - on_nan_event_data_path_request_user_callback(*event); - } -} -std::function on_nan_event_data_path_confirm_user_callback; -void onAysncNanEventDataPathConfirm(NanDataPathConfirmInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_nan_event_data_path_confirm_user_callback && event) { - on_nan_event_data_path_confirm_user_callback(*event); - } -} - -std::function on_nan_event_data_path_end_user_callback; -void onAysncNanEventDataPathEnd(NanDataPathEndInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_nan_event_data_path_end_user_callback && event) { - on_nan_event_data_path_end_user_callback(*event); - } -} - -std::function on_nan_event_transmit_follow_up_user_callback; -void onAysncNanEventTransmitFollowUp(NanTransmitFollowupInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_nan_event_transmit_follow_up_user_callback && event) { - on_nan_event_transmit_follow_up_user_callback(*event); - } -} - -std::function on_nan_event_range_request_user_callback; -void onAysncNanEventRangeRequest(NanRangeRequestInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_nan_event_range_request_user_callback && event) { - on_nan_event_range_request_user_callback(*event); - } -} - -std::function on_nan_event_range_report_user_callback; -void onAysncNanEventRangeReport(NanRangeReportInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_nan_event_range_report_user_callback && event) { - on_nan_event_range_report_user_callback(*event); - } -} - -std::function on_nan_event_schedule_update_user_callback; -void onAsyncNanEventScheduleUpdate(NanDataPathScheduleUpdateInd* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_nan_event_schedule_update_user_callback && event) { - on_nan_event_schedule_update_user_callback(*event); - } -} - -// Callbacks for the various TWT operations. -std::function on_twt_event_setup_response_callback; -void onAsyncTwtEventSetupResponse(TwtSetupResponse* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_twt_event_setup_response_callback && event) { - on_twt_event_setup_response_callback(*event); - } -} - -std::function on_twt_event_teardown_completion_callback; -void onAsyncTwtEventTeardownCompletion(TwtTeardownCompletion* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_twt_event_teardown_completion_callback && event) { - on_twt_event_teardown_completion_callback(*event); - } -} - -std::function on_twt_event_info_frame_received_callback; -void onAsyncTwtEventInfoFrameReceived(TwtInfoFrameReceived* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_twt_event_info_frame_received_callback && event) { - on_twt_event_info_frame_received_callback(*event); - } -} - -std::function on_twt_event_device_notify_callback; -void onAsyncTwtEventDeviceNotify(TwtDeviceNotify* event) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_twt_event_device_notify_callback && event) { - on_twt_event_device_notify_callback(*event); - } -} - -// Callback to report current CHRE NAN state -std::function on_chre_nan_rtt_internal_callback; -void onAsyncChreNanRttState(chre_nan_rtt_state state) { - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (on_chre_nan_rtt_internal_callback) { - on_chre_nan_rtt_internal_callback(state); - } -} - -// Callback to report cached scan results -std::function on_cached_scan_results_internal_callback; -void onSyncCachedScanResults(wifi_cached_scan_report* cache_report) { - if (on_cached_scan_results_internal_callback) { - on_cached_scan_results_internal_callback(cache_report); - } -} - -// End of the free-standing "C" style callbacks. - -WifiLegacyHal::WifiLegacyHal(const std::weak_ptr iface_tool, - const wifi_hal_fn& fn, bool is_primary) - : global_func_table_(fn), - global_handle_(nullptr), - awaiting_event_loop_termination_(false), - is_started_(false), - iface_tool_(iface_tool), - is_primary_(is_primary) {} - -wifi_error WifiLegacyHal::initialize() { - LOG(DEBUG) << "Initialize legacy HAL"; - // this now does nothing, since HAL function table is provided - // to the constructor - return WIFI_SUCCESS; -} - -wifi_error WifiLegacyHal::start() { - // Ensure that we're starting in a good state. - CHECK(global_func_table_.wifi_initialize && !global_handle_ && iface_name_to_handle_.empty() && - !awaiting_event_loop_termination_); - if (is_started_) { - LOG(DEBUG) << "Legacy HAL already started"; - return WIFI_SUCCESS; - } - LOG(DEBUG) << "Waiting for the driver ready"; - wifi_error status = global_func_table_.wifi_wait_for_driver_ready(); - if (status == WIFI_ERROR_TIMED_OUT || status == WIFI_ERROR_UNKNOWN) { - LOG(ERROR) << "Failed or timed out awaiting driver ready"; - return status; - } - - if (is_primary_) { - property_set(kDriverPropName, "ok"); - - if (!iface_tool_.lock()->SetWifiUpState(true)) { - LOG(ERROR) << "Failed to set WiFi interface up"; - return WIFI_ERROR_UNKNOWN; - } - } - - LOG(DEBUG) << "Starting legacy HAL"; - status = global_func_table_.wifi_initialize(&global_handle_); - if (status != WIFI_SUCCESS || !global_handle_) { - LOG(ERROR) << "Failed to retrieve global handle"; - return status; - } - std::thread(&WifiLegacyHal::runEventLoop, this).detach(); - status = retrieveIfaceHandles(); - if (status != WIFI_SUCCESS || iface_name_to_handle_.empty()) { - LOG(ERROR) << "Failed to retrieve wlan interface handle"; - return status; - } - LOG(DEBUG) << "Legacy HAL start complete"; - is_started_ = true; - return WIFI_SUCCESS; -} - -wifi_error WifiLegacyHal::stop( - /* NONNULL */ std::unique_lock* lock, - const std::function& on_stop_complete_user_callback) { - if (!is_started_) { - LOG(DEBUG) << "Legacy HAL already stopped"; - on_stop_complete_user_callback(); - return WIFI_SUCCESS; - } - LOG(DEBUG) << "Stopping legacy HAL"; - on_stop_complete_internal_callback = [on_stop_complete_user_callback, - this](wifi_handle handle) { - CHECK_EQ(global_handle_, handle) << "Handle mismatch"; - LOG(INFO) << "Legacy HAL stop complete callback received"; - // Invalidate all the internal pointers now that the HAL is - // stopped. - invalidate(); - if (is_primary_) iface_tool_.lock()->SetWifiUpState(false); - on_stop_complete_user_callback(); - is_started_ = false; - }; - awaiting_event_loop_termination_ = true; - global_func_table_.wifi_cleanup(global_handle_, onAsyncStopComplete); - const auto status = - stop_wait_cv_.wait_for(*lock, std::chrono::milliseconds(kMaxStopCompleteWaitMs), - [this] { return !awaiting_event_loop_termination_; }); - if (!status) { - LOG(ERROR) << "Legacy HAL stop failed or timed out"; - return WIFI_ERROR_UNKNOWN; - } - LOG(DEBUG) << "Legacy HAL stop complete"; - return WIFI_SUCCESS; -} - -bool WifiLegacyHal::isStarted() { - return is_started_; -} - -wifi_error WifiLegacyHal::waitForDriverReady() { - return global_func_table_.wifi_wait_for_driver_ready(); -} - -std::pair WifiLegacyHal::getDriverVersion(const std::string& iface_name) { - std::array buffer; - buffer.fill(0); - wifi_error status = global_func_table_.wifi_get_driver_version(getIfaceHandle(iface_name), - buffer.data(), buffer.size()); - return {status, buffer.data()}; -} - -std::pair WifiLegacyHal::getFirmwareVersion( - const std::string& iface_name) { - std::array buffer; - buffer.fill(0); - wifi_error status = global_func_table_.wifi_get_firmware_version(getIfaceHandle(iface_name), - buffer.data(), buffer.size()); - return {status, buffer.data()}; -} - -std::pair> WifiLegacyHal::requestDriverMemoryDump( - const std::string& iface_name) { - std::vector driver_dump; - on_driver_memory_dump_internal_callback = [&driver_dump](char* buffer, int buffer_size) { - driver_dump.insert(driver_dump.end(), reinterpret_cast(buffer), - reinterpret_cast(buffer) + buffer_size); - }; - wifi_error status = global_func_table_.wifi_get_driver_memory_dump(getIfaceHandle(iface_name), - {onSyncDriverMemoryDump}); - on_driver_memory_dump_internal_callback = nullptr; - return {status, std::move(driver_dump)}; -} - -std::pair> WifiLegacyHal::requestFirmwareMemoryDump( - const std::string& iface_name) { - std::vector firmware_dump; - on_firmware_memory_dump_internal_callback = [&firmware_dump](char* buffer, int buffer_size) { - firmware_dump.insert(firmware_dump.end(), reinterpret_cast(buffer), - reinterpret_cast(buffer) + buffer_size); - }; - wifi_error status = global_func_table_.wifi_get_firmware_memory_dump( - getIfaceHandle(iface_name), {onSyncFirmwareMemoryDump}); - on_firmware_memory_dump_internal_callback = nullptr; - return {status, std::move(firmware_dump)}; -} - -std::pair WifiLegacyHal::getSupportedFeatureSet( - const std::string& iface_name) { - feature_set set = 0, chip_set = 0; - wifi_error status = WIFI_SUCCESS; - - static_assert(sizeof(set) == sizeof(uint64_t), - "Some feature_flags can not be represented in output"); - wifi_interface_handle iface_handle = getIfaceHandle(iface_name); - - global_func_table_.wifi_get_chip_feature_set( - global_handle_, &chip_set); /* ignore error, chip_set will stay 0 */ - - if (iface_handle) { - status = global_func_table_.wifi_get_supported_feature_set(iface_handle, &set); - } - return {status, static_cast(set | chip_set)}; -} - -std::pair WifiLegacyHal::getPacketFilterCapabilities( - const std::string& iface_name) { - PacketFilterCapabilities caps; - wifi_error status = global_func_table_.wifi_get_packet_filter_capabilities( - getIfaceHandle(iface_name), &caps.version, &caps.max_len); - return {status, caps}; -} - -wifi_error WifiLegacyHal::setPacketFilter(const std::string& iface_name, - const std::vector& program) { - return global_func_table_.wifi_set_packet_filter(getIfaceHandle(iface_name), program.data(), - program.size()); -} - -std::pair> WifiLegacyHal::readApfPacketFilterData( - const std::string& iface_name) { - PacketFilterCapabilities caps; - wifi_error status = global_func_table_.wifi_get_packet_filter_capabilities( - getIfaceHandle(iface_name), &caps.version, &caps.max_len); - if (status != WIFI_SUCCESS) { - return {status, {}}; - } - - // Size the buffer to read the entire program & work memory. - std::vector buffer(caps.max_len); - - status = global_func_table_.wifi_read_packet_filter( - getIfaceHandle(iface_name), /*src_offset=*/0, buffer.data(), buffer.size()); - return {status, std::move(buffer)}; -} - -std::pair WifiLegacyHal::getGscanCapabilities( - const std::string& iface_name) { - wifi_gscan_capabilities caps; - wifi_error status = - global_func_table_.wifi_get_gscan_capabilities(getIfaceHandle(iface_name), &caps); - return {status, caps}; -} - -wifi_error WifiLegacyHal::startGscan( - const std::string& iface_name, wifi_request_id id, const wifi_scan_cmd_params& params, - const std::function& on_failure_user_callback, - const on_gscan_results_callback& on_results_user_callback, - const on_gscan_full_result_callback& on_full_result_user_callback) { - // If there is already an ongoing background scan, reject new scan requests. - if (on_gscan_event_internal_callback || on_gscan_full_result_internal_callback) { - return WIFI_ERROR_NOT_AVAILABLE; - } - - // This callback will be used to either trigger |on_results_user_callback| - // or |on_failure_user_callback|. - on_gscan_event_internal_callback = [iface_name, on_failure_user_callback, - on_results_user_callback, - this](wifi_request_id id, wifi_scan_event event) { - switch (event) { - case WIFI_SCAN_RESULTS_AVAILABLE: - case WIFI_SCAN_THRESHOLD_NUM_SCANS: - case WIFI_SCAN_THRESHOLD_PERCENT: { - wifi_error status; - std::vector cached_scan_results; - std::tie(status, cached_scan_results) = getGscanCachedResults(iface_name); - if (status == WIFI_SUCCESS) { - on_results_user_callback(id, cached_scan_results); - return; - } - FALLTHROUGH_INTENDED; - } - // Fall through if failed. Failure to retrieve cached scan - // results should trigger a background scan failure. - case WIFI_SCAN_FAILED: - on_failure_user_callback(id); - on_gscan_event_internal_callback = nullptr; - on_gscan_full_result_internal_callback = nullptr; - return; - } - LOG(FATAL) << "Unexpected gscan event received: " << event; - }; - - on_gscan_full_result_internal_callback = [on_full_result_user_callback]( - wifi_request_id id, wifi_scan_result* result, - uint32_t buckets_scanned) { - if (result) { - on_full_result_user_callback(id, result, buckets_scanned); - } - }; - - wifi_scan_result_handler handler = {onAsyncGscanFullResult, onAsyncGscanEvent}; - wifi_error status = - global_func_table_.wifi_start_gscan(id, getIfaceHandle(iface_name), params, handler); - if (status != WIFI_SUCCESS) { - on_gscan_event_internal_callback = nullptr; - on_gscan_full_result_internal_callback = nullptr; - } - return status; -} - -wifi_error WifiLegacyHal::stopGscan(const std::string& iface_name, wifi_request_id id) { - // If there is no an ongoing background scan, reject stop requests. - // TODO(b/32337212): This needs to be handled by the HIDL object because we - // need to return the NOT_STARTED error code. - if (!on_gscan_event_internal_callback && !on_gscan_full_result_internal_callback) { - return WIFI_ERROR_NOT_AVAILABLE; - } - wifi_error status = global_func_table_.wifi_stop_gscan(id, getIfaceHandle(iface_name)); - // If the request Id is wrong, don't stop the ongoing background scan. Any - // other error should be treated as the end of background scan. - if (status != WIFI_ERROR_INVALID_REQUEST_ID) { - on_gscan_event_internal_callback = nullptr; - on_gscan_full_result_internal_callback = nullptr; - } - return status; -} - -std::pair> WifiLegacyHal::getValidFrequenciesForBand( - const std::string& iface_name, wifi_band band) { - static_assert(sizeof(uint32_t) >= sizeof(wifi_channel), - "Wifi Channel cannot be represented in output"); - std::vector freqs; - freqs.resize(kMaxGscanFrequenciesForBand); - int32_t num_freqs = 0; - wifi_error status = global_func_table_.wifi_get_valid_channels( - getIfaceHandle(iface_name), band, freqs.size(), - reinterpret_cast(freqs.data()), &num_freqs); - CHECK(num_freqs >= 0 && static_cast(num_freqs) <= kMaxGscanFrequenciesForBand); - freqs.resize(num_freqs); - return {status, std::move(freqs)}; -} - -wifi_error WifiLegacyHal::setDfsFlag(const std::string& iface_name, bool dfs_on) { - return global_func_table_.wifi_set_nodfs_flag(getIfaceHandle(iface_name), dfs_on ? 0 : 1); -} - -wifi_error WifiLegacyHal::enableLinkLayerStats(const std::string& iface_name, bool debug) { - wifi_link_layer_params params; - params.mpdu_size_threshold = kLinkLayerStatsDataMpduSizeThreshold; - params.aggressive_statistics_gathering = debug; - return global_func_table_.wifi_set_link_stats(getIfaceHandle(iface_name), params); -} - -wifi_error WifiLegacyHal::disableLinkLayerStats(const std::string& iface_name) { - // TODO: Do we care about these responses? - uint32_t clear_mask_rsp; - uint8_t stop_rsp; - return global_func_table_.wifi_clear_link_stats(getIfaceHandle(iface_name), 0xFFFFFFFF, - &clear_mask_rsp, 1, &stop_rsp); -} - -std::pair WifiLegacyHal::getLinkLayerStats( - const std::string& iface_name) { - LinkLayerStats link_stats{}; - LinkLayerStats* link_stats_ptr = &link_stats; - - on_link_layer_stats_result_internal_callback = [&link_stats_ptr]( - wifi_request_id /* id */, - wifi_iface_stat* iface_stats_ptr, - int num_radios, - wifi_radio_stat* radio_stats_ptr) { - wifi_radio_stat* l_radio_stats_ptr; - wifi_peer_info* l_peer_info_stats_ptr; - - if (iface_stats_ptr != nullptr) { - link_stats_ptr->iface = *iface_stats_ptr; - l_peer_info_stats_ptr = iface_stats_ptr->peer_info; - for (uint32_t i = 0; i < iface_stats_ptr->num_peers; i++) { - WifiPeerInfo peer; - peer.peer_info = *l_peer_info_stats_ptr; - if (l_peer_info_stats_ptr->num_rate > 0) { - /* Copy the rate stats */ - peer.rate_stats.assign( - l_peer_info_stats_ptr->rate_stats, - l_peer_info_stats_ptr->rate_stats + l_peer_info_stats_ptr->num_rate); - } - peer.peer_info.num_rate = 0; - link_stats_ptr->peers.push_back(peer); - l_peer_info_stats_ptr = - (wifi_peer_info*)((u8*)l_peer_info_stats_ptr + sizeof(wifi_peer_info) + - (sizeof(wifi_rate_stat) * - l_peer_info_stats_ptr->num_rate)); - } - link_stats_ptr->iface.num_peers = 0; - } else { - LOG(ERROR) << "Invalid iface stats in link layer stats"; - } - if (num_radios <= 0 || radio_stats_ptr == nullptr) { - LOG(ERROR) << "Invalid radio stats in link layer stats"; - return; - } - l_radio_stats_ptr = radio_stats_ptr; - for (int i = 0; i < num_radios; i++) { - LinkLayerRadioStats radio; - - radio.stats = *l_radio_stats_ptr; - // Copy over the tx level array to the separate vector. - if (l_radio_stats_ptr->num_tx_levels > 0 && - l_radio_stats_ptr->tx_time_per_levels != nullptr) { - radio.tx_time_per_levels.assign( - l_radio_stats_ptr->tx_time_per_levels, - l_radio_stats_ptr->tx_time_per_levels + l_radio_stats_ptr->num_tx_levels); - } - radio.stats.num_tx_levels = 0; - radio.stats.tx_time_per_levels = nullptr; - /* Copy over the channel stat to separate vector */ - if (l_radio_stats_ptr->num_channels > 0) { - /* Copy the channel stats */ - radio.channel_stats.assign( - l_radio_stats_ptr->channels, - l_radio_stats_ptr->channels + l_radio_stats_ptr->num_channels); - } - link_stats_ptr->radios.push_back(radio); - l_radio_stats_ptr = - (wifi_radio_stat*)((u8*)l_radio_stats_ptr + sizeof(wifi_radio_stat) + - (sizeof(wifi_channel_stat) * - l_radio_stats_ptr->num_channels)); - } - }; - - wifi_error status = global_func_table_.wifi_get_link_stats(0, getIfaceHandle(iface_name), - {onSyncLinkLayerStatsResult}); - on_link_layer_stats_result_internal_callback = nullptr; - return {status, link_stats}; -} - -wifi_error WifiLegacyHal::startRssiMonitoring( - const std::string& iface_name, wifi_request_id id, int8_t max_rssi, int8_t min_rssi, - const on_rssi_threshold_breached_callback& on_threshold_breached_user_callback) { - if (on_rssi_threshold_breached_internal_callback) { - return WIFI_ERROR_NOT_AVAILABLE; - } - on_rssi_threshold_breached_internal_callback = [on_threshold_breached_user_callback]( - wifi_request_id id, uint8_t* bssid_ptr, - int8_t rssi) { - if (!bssid_ptr) { - return; - } - std::array bssid_arr; - // |bssid_ptr| pointer is assumed to have 6 bytes for the mac - // address. - std::copy(bssid_ptr, bssid_ptr + 6, std::begin(bssid_arr)); - on_threshold_breached_user_callback(id, bssid_arr, rssi); - }; - wifi_error status = global_func_table_.wifi_start_rssi_monitoring( - id, getIfaceHandle(iface_name), max_rssi, min_rssi, {onAsyncRssiThresholdBreached}); - if (status != WIFI_SUCCESS) { - on_rssi_threshold_breached_internal_callback = nullptr; - } - return status; -} - -wifi_error WifiLegacyHal::stopRssiMonitoring(const std::string& iface_name, wifi_request_id id) { - if (!on_rssi_threshold_breached_internal_callback) { - return WIFI_ERROR_NOT_AVAILABLE; - } - wifi_error status = - global_func_table_.wifi_stop_rssi_monitoring(id, getIfaceHandle(iface_name)); - // If the request Id is wrong, don't stop the ongoing rssi monitoring. Any - // other error should be treated as the end of background scan. - if (status != WIFI_ERROR_INVALID_REQUEST_ID) { - on_rssi_threshold_breached_internal_callback = nullptr; - } - return status; -} - -std::pair WifiLegacyHal::getRoamingCapabilities( - const std::string& iface_name) { - wifi_roaming_capabilities caps; - wifi_error status = - global_func_table_.wifi_get_roaming_capabilities(getIfaceHandle(iface_name), &caps); - return {status, caps}; -} - -wifi_error WifiLegacyHal::configureRoaming(const std::string& iface_name, - const wifi_roaming_config& config) { - wifi_roaming_config config_internal = config; - return global_func_table_.wifi_configure_roaming(getIfaceHandle(iface_name), &config_internal); -} - -wifi_error WifiLegacyHal::enableFirmwareRoaming(const std::string& iface_name, - fw_roaming_state_t state) { - return global_func_table_.wifi_enable_firmware_roaming(getIfaceHandle(iface_name), state); -} - -wifi_error WifiLegacyHal::configureNdOffload(const std::string& iface_name, bool enable) { - return global_func_table_.wifi_configure_nd_offload(getIfaceHandle(iface_name), enable); -} - -wifi_error WifiLegacyHal::startSendingOffloadedPacket(const std::string& iface_name, - uint32_t cmd_id, uint16_t ether_type, - const std::vector& ip_packet_data, - const std::array& src_address, - const std::array& dst_address, - uint32_t period_in_ms) { - std::vector ip_packet_data_internal(ip_packet_data); - std::vector src_address_internal(src_address.data(), - src_address.data() + src_address.size()); - std::vector dst_address_internal(dst_address.data(), - dst_address.data() + dst_address.size()); - return global_func_table_.wifi_start_sending_offloaded_packet( - cmd_id, getIfaceHandle(iface_name), ether_type, ip_packet_data_internal.data(), - ip_packet_data_internal.size(), src_address_internal.data(), - dst_address_internal.data(), period_in_ms); -} - -wifi_error WifiLegacyHal::stopSendingOffloadedPacket(const std::string& iface_name, - uint32_t cmd_id) { - return global_func_table_.wifi_stop_sending_offloaded_packet(cmd_id, - getIfaceHandle(iface_name)); -} - -wifi_error WifiLegacyHal::selectTxPowerScenario(const std::string& iface_name, - wifi_power_scenario scenario) { - return global_func_table_.wifi_select_tx_power_scenario(getIfaceHandle(iface_name), scenario); -} - -wifi_error WifiLegacyHal::resetTxPowerScenario(const std::string& iface_name) { - return global_func_table_.wifi_reset_tx_power_scenario(getIfaceHandle(iface_name)); -} - -wifi_error WifiLegacyHal::setLatencyMode(const std::string& iface_name, wifi_latency_mode mode) { - return global_func_table_.wifi_set_latency_mode(getIfaceHandle(iface_name), mode); -} - -wifi_error WifiLegacyHal::setThermalMitigationMode(wifi_thermal_mode mode, - uint32_t completion_window) { - return global_func_table_.wifi_set_thermal_mitigation_mode(global_handle_, mode, - completion_window); -} - -wifi_error WifiLegacyHal::setDscpToAccessCategoryMapping(uint32_t start, uint32_t end, - uint32_t access_category) { - return global_func_table_.wifi_map_dscp_access_category(global_handle_, start, end, - access_category); -} - -wifi_error WifiLegacyHal::resetDscpToAccessCategoryMapping() { - return global_func_table_.wifi_reset_dscp_mapping(global_handle_); -} - -std::pair WifiLegacyHal::getLoggerSupportedFeatureSet( - const std::string& iface_name) { - uint32_t supported_feature_flags = 0; - wifi_error status = WIFI_SUCCESS; - - wifi_interface_handle iface_handle = getIfaceHandle(iface_name); - - if (iface_handle) { - status = global_func_table_.wifi_get_logger_supported_feature_set(iface_handle, - &supported_feature_flags); - } - return {status, supported_feature_flags}; -} - -wifi_error WifiLegacyHal::startPktFateMonitoring(const std::string& iface_name) { - return global_func_table_.wifi_start_pkt_fate_monitoring(getIfaceHandle(iface_name)); -} - -std::pair> WifiLegacyHal::getTxPktFates( - const std::string& iface_name) { - std::vector tx_pkt_fates; - tx_pkt_fates.resize(MAX_FATE_LOG_LEN); - size_t num_fates = 0; - wifi_error status = global_func_table_.wifi_get_tx_pkt_fates( - getIfaceHandle(iface_name), tx_pkt_fates.data(), tx_pkt_fates.size(), &num_fates); - CHECK(num_fates <= MAX_FATE_LOG_LEN); - tx_pkt_fates.resize(num_fates); - return {status, std::move(tx_pkt_fates)}; -} - -std::pair> WifiLegacyHal::getRxPktFates( - const std::string& iface_name) { - std::vector rx_pkt_fates; - rx_pkt_fates.resize(MAX_FATE_LOG_LEN); - size_t num_fates = 0; - wifi_error status = global_func_table_.wifi_get_rx_pkt_fates( - getIfaceHandle(iface_name), rx_pkt_fates.data(), rx_pkt_fates.size(), &num_fates); - CHECK(num_fates <= MAX_FATE_LOG_LEN); - rx_pkt_fates.resize(num_fates); - return {status, std::move(rx_pkt_fates)}; -} - -std::pair WifiLegacyHal::getWakeReasonStats( - const std::string& iface_name) { - WakeReasonStats stats; - stats.cmd_event_wake_cnt.resize(kMaxWakeReasonStatsArraySize); - stats.driver_fw_local_wake_cnt.resize(kMaxWakeReasonStatsArraySize); - - // This legacy struct needs separate memory to store the variable sized wake - // reason types. - stats.wake_reason_cnt.cmd_event_wake_cnt = - reinterpret_cast(stats.cmd_event_wake_cnt.data()); - stats.wake_reason_cnt.cmd_event_wake_cnt_sz = stats.cmd_event_wake_cnt.size(); - stats.wake_reason_cnt.cmd_event_wake_cnt_used = 0; - stats.wake_reason_cnt.driver_fw_local_wake_cnt = - reinterpret_cast(stats.driver_fw_local_wake_cnt.data()); - stats.wake_reason_cnt.driver_fw_local_wake_cnt_sz = stats.driver_fw_local_wake_cnt.size(); - stats.wake_reason_cnt.driver_fw_local_wake_cnt_used = 0; - - wifi_error status = global_func_table_.wifi_get_wake_reason_stats(getIfaceHandle(iface_name), - &stats.wake_reason_cnt); - - CHECK(stats.wake_reason_cnt.cmd_event_wake_cnt_used >= 0 && - static_cast(stats.wake_reason_cnt.cmd_event_wake_cnt_used) <= - kMaxWakeReasonStatsArraySize); - stats.cmd_event_wake_cnt.resize(stats.wake_reason_cnt.cmd_event_wake_cnt_used); - stats.wake_reason_cnt.cmd_event_wake_cnt = nullptr; - - CHECK(stats.wake_reason_cnt.driver_fw_local_wake_cnt_used >= 0 && - static_cast(stats.wake_reason_cnt.driver_fw_local_wake_cnt_used) <= - kMaxWakeReasonStatsArraySize); - stats.driver_fw_local_wake_cnt.resize(stats.wake_reason_cnt.driver_fw_local_wake_cnt_used); - stats.wake_reason_cnt.driver_fw_local_wake_cnt = nullptr; - - return {status, stats}; -} - -wifi_error WifiLegacyHal::registerRingBufferCallbackHandler( - const std::string& iface_name, const on_ring_buffer_data_callback& on_user_data_callback) { - if (on_ring_buffer_data_internal_callback) { - return WIFI_ERROR_NOT_AVAILABLE; - } - on_ring_buffer_data_internal_callback = [on_user_data_callback]( - char* ring_name, char* buffer, int buffer_size, - wifi_ring_buffer_status* status) { - if (status && buffer) { - std::vector buffer_vector(reinterpret_cast(buffer), - reinterpret_cast(buffer) + buffer_size); - on_user_data_callback(ring_name, buffer_vector, *status); - } - }; - wifi_error status = global_func_table_.wifi_set_log_handler(0, getIfaceHandle(iface_name), - {onAsyncRingBufferData}); - if (status != WIFI_SUCCESS) { - on_ring_buffer_data_internal_callback = nullptr; - } - return status; -} - -wifi_error WifiLegacyHal::deregisterRingBufferCallbackHandler(const std::string& iface_name) { - if (!on_ring_buffer_data_internal_callback) { - return WIFI_ERROR_NOT_AVAILABLE; - } - on_ring_buffer_data_internal_callback = nullptr; - return global_func_table_.wifi_reset_log_handler(0, getIfaceHandle(iface_name)); -} - -std::pair> WifiLegacyHal::getRingBuffersStatus( - const std::string& iface_name) { - std::vector ring_buffers_status; - ring_buffers_status.resize(kMaxRingBuffers); - uint32_t num_rings = kMaxRingBuffers; - wifi_error status = global_func_table_.wifi_get_ring_buffers_status( - getIfaceHandle(iface_name), &num_rings, ring_buffers_status.data()); - CHECK(num_rings <= kMaxRingBuffers); - ring_buffers_status.resize(num_rings); - return {status, std::move(ring_buffers_status)}; -} - -wifi_error WifiLegacyHal::startRingBufferLogging(const std::string& iface_name, - const std::string& ring_name, - uint32_t verbose_level, uint32_t max_interval_sec, - uint32_t min_data_size) { - return global_func_table_.wifi_start_logging(getIfaceHandle(iface_name), verbose_level, 0, - max_interval_sec, min_data_size, - makeCharVec(ring_name).data()); -} - -wifi_error WifiLegacyHal::getRingBufferData(const std::string& iface_name, - const std::string& ring_name) { - return global_func_table_.wifi_get_ring_data(getIfaceHandle(iface_name), - makeCharVec(ring_name).data()); -} - -wifi_error WifiLegacyHal::registerErrorAlertCallbackHandler( - const std::string& iface_name, const on_error_alert_callback& on_user_alert_callback) { - if (on_error_alert_internal_callback) { - return WIFI_ERROR_NOT_AVAILABLE; - } - on_error_alert_internal_callback = [on_user_alert_callback](wifi_request_id id, char* buffer, - int buffer_size, int err_code) { - if (buffer) { - CHECK(id == 0); - on_user_alert_callback( - err_code, - std::vector(reinterpret_cast(buffer), - reinterpret_cast(buffer) + buffer_size)); - } - }; - wifi_error status = global_func_table_.wifi_set_alert_handler(0, getIfaceHandle(iface_name), - {onAsyncErrorAlert}); - if (status != WIFI_SUCCESS) { - on_error_alert_internal_callback = nullptr; - } - return status; -} - -wifi_error WifiLegacyHal::deregisterErrorAlertCallbackHandler(const std::string& iface_name) { - if (!on_error_alert_internal_callback) { - return WIFI_ERROR_NOT_AVAILABLE; - } - on_error_alert_internal_callback = nullptr; - return global_func_table_.wifi_reset_alert_handler(0, getIfaceHandle(iface_name)); -} - -wifi_error WifiLegacyHal::registerRadioModeChangeCallbackHandler( - const std::string& iface_name, - const on_radio_mode_change_callback& on_user_change_callback) { - if (on_radio_mode_change_internal_callback) { - return WIFI_ERROR_NOT_AVAILABLE; - } - on_radio_mode_change_internal_callback = [on_user_change_callback]( - wifi_request_id /* id */, uint32_t num_macs, - wifi_mac_info* mac_infos_arr) { - if (num_macs > 0 && mac_infos_arr) { - std::vector mac_infos_vec; - for (uint32_t i = 0; i < num_macs; i++) { - WifiMacInfo mac_info; - mac_info.wlan_mac_id = mac_infos_arr[i].wlan_mac_id; - mac_info.mac_band = mac_infos_arr[i].mac_band; - for (int32_t j = 0; j < mac_infos_arr[i].num_iface; j++) { - WifiIfaceInfo iface_info; - iface_info.name = mac_infos_arr[i].iface_info[j].iface_name; - iface_info.channel = mac_infos_arr[i].iface_info[j].channel; - mac_info.iface_infos.push_back(iface_info); - } - mac_infos_vec.push_back(mac_info); - } - on_user_change_callback(mac_infos_vec); - } - }; - wifi_error status = global_func_table_.wifi_set_radio_mode_change_handler( - 0, getIfaceHandle(iface_name), {onAsyncRadioModeChange}); - if (status != WIFI_SUCCESS) { - on_radio_mode_change_internal_callback = nullptr; - } - return status; -} - -wifi_error WifiLegacyHal::registerSubsystemRestartCallbackHandler( - const on_subsystem_restart_callback& on_restart_callback) { - if (on_subsystem_restart_internal_callback) { - return WIFI_ERROR_NOT_AVAILABLE; - } - on_subsystem_restart_internal_callback = [on_restart_callback](const char* error) { - on_restart_callback(error); - }; - wifi_error status = global_func_table_.wifi_set_subsystem_restart_handler( - global_handle_, {onAsyncSubsystemRestart}); - if (status != WIFI_SUCCESS) { - on_subsystem_restart_internal_callback = nullptr; - } - return status; -} - -wifi_error WifiLegacyHal::startRttRangeRequest( - const std::string& iface_name, wifi_request_id id, - const std::vector& rtt_configs, - const on_rtt_results_callback& on_results_user_callback) { - if (on_rtt_results_internal_callback) { - return WIFI_ERROR_NOT_AVAILABLE; - } - - on_rtt_results_internal_callback = [on_results_user_callback](wifi_request_id id, - unsigned num_results, - wifi_rtt_result* rtt_results[]) { - if (num_results > 0 && !rtt_results) { - LOG(ERROR) << "Unexpected nullptr in RTT results"; - return; - } - std::vector rtt_results_vec; - std::copy_if(rtt_results, rtt_results + num_results, back_inserter(rtt_results_vec), - [](wifi_rtt_result* rtt_result) { return rtt_result != nullptr; }); - on_results_user_callback(id, rtt_results_vec); - }; - - std::vector rtt_configs_internal(rtt_configs); - wifi_error status = global_func_table_.wifi_rtt_range_request( - id, getIfaceHandle(iface_name), rtt_configs.size(), rtt_configs_internal.data(), - {onAsyncRttResults}); - if (status != WIFI_SUCCESS) { - on_rtt_results_internal_callback = nullptr; - } - return status; -} - -wifi_error WifiLegacyHal::cancelRttRangeRequest( - const std::string& iface_name, wifi_request_id id, - const std::vector>& mac_addrs) { - if (!on_rtt_results_internal_callback) { - return WIFI_ERROR_NOT_AVAILABLE; - } - static_assert(sizeof(mac_addr) == sizeof(std::array), "MAC address size mismatch"); - // TODO: How do we handle partial cancels (i.e only a subset of enabled mac - // addressed are cancelled). - std::vector> mac_addrs_internal(mac_addrs); - wifi_error status = global_func_table_.wifi_rtt_range_cancel( - id, getIfaceHandle(iface_name), mac_addrs.size(), - reinterpret_cast(mac_addrs_internal.data())); - // If the request Id is wrong, don't stop the ongoing range request. Any - // other error should be treated as the end of rtt ranging. - if (status != WIFI_ERROR_INVALID_REQUEST_ID) { - on_rtt_results_internal_callback = nullptr; - } - return status; -} - -std::pair WifiLegacyHal::getRttCapabilities( - const std::string& iface_name) { - wifi_rtt_capabilities rtt_caps; - wifi_error status = - global_func_table_.wifi_get_rtt_capabilities(getIfaceHandle(iface_name), &rtt_caps); - return {status, rtt_caps}; -} - -std::pair WifiLegacyHal::getRttResponderInfo( - const std::string& iface_name) { - wifi_rtt_responder rtt_responder; - wifi_error status = global_func_table_.wifi_rtt_get_responder_info(getIfaceHandle(iface_name), - &rtt_responder); - return {status, rtt_responder}; -} - -wifi_error WifiLegacyHal::enableRttResponder(const std::string& iface_name, wifi_request_id id, - const wifi_channel_info& channel_hint, - uint32_t max_duration_secs, - const wifi_rtt_responder& info) { - wifi_rtt_responder info_internal(info); - return global_func_table_.wifi_enable_responder(id, getIfaceHandle(iface_name), channel_hint, - max_duration_secs, &info_internal); -} - -wifi_error WifiLegacyHal::disableRttResponder(const std::string& iface_name, wifi_request_id id) { - return global_func_table_.wifi_disable_responder(id, getIfaceHandle(iface_name)); -} - -wifi_error WifiLegacyHal::setRttLci(const std::string& iface_name, wifi_request_id id, - const wifi_lci_information& info) { - wifi_lci_information info_internal(info); - return global_func_table_.wifi_set_lci(id, getIfaceHandle(iface_name), &info_internal); -} - -wifi_error WifiLegacyHal::setRttLcr(const std::string& iface_name, wifi_request_id id, - const wifi_lcr_information& info) { - wifi_lcr_information info_internal(info); - return global_func_table_.wifi_set_lcr(id, getIfaceHandle(iface_name), &info_internal); -} - -wifi_error WifiLegacyHal::nanRegisterCallbackHandlers(const std::string& iface_name, - const NanCallbackHandlers& user_callbacks) { - on_nan_notify_response_user_callback = user_callbacks.on_notify_response; - on_nan_event_publish_terminated_user_callback = user_callbacks.on_event_publish_terminated; - on_nan_event_match_user_callback = user_callbacks.on_event_match; - on_nan_event_match_expired_user_callback = user_callbacks.on_event_match_expired; - on_nan_event_subscribe_terminated_user_callback = user_callbacks.on_event_subscribe_terminated; - on_nan_event_followup_user_callback = user_callbacks.on_event_followup; - on_nan_event_disc_eng_event_user_callback = user_callbacks.on_event_disc_eng_event; - on_nan_event_disabled_user_callback = user_callbacks.on_event_disabled; - on_nan_event_tca_user_callback = user_callbacks.on_event_tca; - on_nan_event_beacon_sdf_payload_user_callback = user_callbacks.on_event_beacon_sdf_payload; - on_nan_event_data_path_request_user_callback = user_callbacks.on_event_data_path_request; - on_nan_event_data_path_confirm_user_callback = user_callbacks.on_event_data_path_confirm; - on_nan_event_data_path_end_user_callback = user_callbacks.on_event_data_path_end; - on_nan_event_transmit_follow_up_user_callback = user_callbacks.on_event_transmit_follow_up; - on_nan_event_range_request_user_callback = user_callbacks.on_event_range_request; - on_nan_event_range_report_user_callback = user_callbacks.on_event_range_report; - on_nan_event_schedule_update_user_callback = user_callbacks.on_event_schedule_update; - - return global_func_table_.wifi_nan_register_handler( - getIfaceHandle(iface_name), - {onAysncNanNotifyResponse, onAysncNanEventPublishReplied, - onAysncNanEventPublishTerminated, onAysncNanEventMatch, onAysncNanEventMatchExpired, - onAysncNanEventSubscribeTerminated, onAysncNanEventFollowup, - onAysncNanEventDiscEngEvent, onAysncNanEventDisabled, onAysncNanEventTca, - onAysncNanEventBeaconSdfPayload, onAysncNanEventDataPathRequest, - onAysncNanEventDataPathConfirm, onAysncNanEventDataPathEnd, - onAysncNanEventTransmitFollowUp, onAysncNanEventRangeRequest, - onAysncNanEventRangeReport, onAsyncNanEventScheduleUpdate}); -} - -wifi_error WifiLegacyHal::nanEnableRequest(const std::string& iface_name, transaction_id id, - const NanEnableRequest& msg) { - NanEnableRequest msg_internal(msg); - return global_func_table_.wifi_nan_enable_request(id, getIfaceHandle(iface_name), - &msg_internal); -} - -wifi_error WifiLegacyHal::nanDisableRequest(const std::string& iface_name, transaction_id id) { - return global_func_table_.wifi_nan_disable_request(id, getIfaceHandle(iface_name)); -} - -wifi_error WifiLegacyHal::nanPublishRequest(const std::string& iface_name, transaction_id id, - const NanPublishRequest& msg) { - NanPublishRequest msg_internal(msg); - return global_func_table_.wifi_nan_publish_request(id, getIfaceHandle(iface_name), - &msg_internal); -} - -wifi_error WifiLegacyHal::nanPublishCancelRequest(const std::string& iface_name, transaction_id id, - const NanPublishCancelRequest& msg) { - NanPublishCancelRequest msg_internal(msg); - return global_func_table_.wifi_nan_publish_cancel_request(id, getIfaceHandle(iface_name), - &msg_internal); -} - -wifi_error WifiLegacyHal::nanSubscribeRequest(const std::string& iface_name, transaction_id id, - const NanSubscribeRequest& msg) { - NanSubscribeRequest msg_internal(msg); - return global_func_table_.wifi_nan_subscribe_request(id, getIfaceHandle(iface_name), - &msg_internal); -} - -wifi_error WifiLegacyHal::nanSubscribeCancelRequest(const std::string& iface_name, - transaction_id id, - const NanSubscribeCancelRequest& msg) { - NanSubscribeCancelRequest msg_internal(msg); - return global_func_table_.wifi_nan_subscribe_cancel_request(id, getIfaceHandle(iface_name), - &msg_internal); -} - -wifi_error WifiLegacyHal::nanTransmitFollowupRequest(const std::string& iface_name, - transaction_id id, - const NanTransmitFollowupRequest& msg) { - NanTransmitFollowupRequest msg_internal(msg); - return global_func_table_.wifi_nan_transmit_followup_request(id, getIfaceHandle(iface_name), - &msg_internal); -} - -wifi_error WifiLegacyHal::nanStatsRequest(const std::string& iface_name, transaction_id id, - const NanStatsRequest& msg) { - NanStatsRequest msg_internal(msg); - return global_func_table_.wifi_nan_stats_request(id, getIfaceHandle(iface_name), &msg_internal); -} - -wifi_error WifiLegacyHal::nanConfigRequest(const std::string& iface_name, transaction_id id, - const NanConfigRequest& msg) { - NanConfigRequest msg_internal(msg); - return global_func_table_.wifi_nan_config_request(id, getIfaceHandle(iface_name), - &msg_internal); -} - -wifi_error WifiLegacyHal::nanTcaRequest(const std::string& iface_name, transaction_id id, - const NanTCARequest& msg) { - NanTCARequest msg_internal(msg); - return global_func_table_.wifi_nan_tca_request(id, getIfaceHandle(iface_name), &msg_internal); -} - -wifi_error WifiLegacyHal::nanBeaconSdfPayloadRequest(const std::string& iface_name, - transaction_id id, - const NanBeaconSdfPayloadRequest& msg) { - NanBeaconSdfPayloadRequest msg_internal(msg); - return global_func_table_.wifi_nan_beacon_sdf_payload_request(id, getIfaceHandle(iface_name), - &msg_internal); -} - -std::pair WifiLegacyHal::nanGetVersion() { - NanVersion version; - wifi_error status = global_func_table_.wifi_nan_get_version(global_handle_, &version); - return {status, version}; -} - -wifi_error WifiLegacyHal::nanGetCapabilities(const std::string& iface_name, transaction_id id) { - return global_func_table_.wifi_nan_get_capabilities(id, getIfaceHandle(iface_name)); -} - -wifi_error WifiLegacyHal::nanDataInterfaceCreate(const std::string& iface_name, transaction_id id, - const std::string& data_iface_name) { - return global_func_table_.wifi_nan_data_interface_create(id, getIfaceHandle(iface_name), - makeCharVec(data_iface_name).data()); -} - -wifi_error WifiLegacyHal::nanDataInterfaceDelete(const std::string& iface_name, transaction_id id, - const std::string& data_iface_name) { - return global_func_table_.wifi_nan_data_interface_delete(id, getIfaceHandle(iface_name), - makeCharVec(data_iface_name).data()); -} - -wifi_error WifiLegacyHal::nanDataRequestInitiator(const std::string& iface_name, transaction_id id, - const NanDataPathInitiatorRequest& msg) { - NanDataPathInitiatorRequest msg_internal(msg); - return global_func_table_.wifi_nan_data_request_initiator(id, getIfaceHandle(iface_name), - &msg_internal); -} - -wifi_error WifiLegacyHal::nanDataIndicationResponse(const std::string& iface_name, - transaction_id id, - const NanDataPathIndicationResponse& msg) { - NanDataPathIndicationResponse msg_internal(msg); - return global_func_table_.wifi_nan_data_indication_response(id, getIfaceHandle(iface_name), - &msg_internal); -} - -typedef struct { - u8 num_ndp_instances; - NanDataPathId ndp_instance_id; -} NanDataPathEndSingleNdpIdRequest; - -wifi_error WifiLegacyHal::nanDataEnd(const std::string& iface_name, transaction_id id, - uint32_t ndpInstanceId) { - NanDataPathEndSingleNdpIdRequest msg; - msg.num_ndp_instances = 1; - msg.ndp_instance_id = ndpInstanceId; - wifi_error status = global_func_table_.wifi_nan_data_end(id, getIfaceHandle(iface_name), - (NanDataPathEndRequest*)&msg); - return status; -} - -wifi_error WifiLegacyHal::setCountryCode(const std::string& iface_name, - std::array code) { - std::string code_str(code.data(), code.data() + code.size()); - return global_func_table_.wifi_set_country_code(getIfaceHandle(iface_name), code_str.c_str()); -} - -wifi_error WifiLegacyHal::retrieveIfaceHandles() { - wifi_interface_handle* iface_handles = nullptr; - int num_iface_handles = 0; - wifi_error status = - global_func_table_.wifi_get_ifaces(global_handle_, &num_iface_handles, &iface_handles); - if (status != WIFI_SUCCESS) { - LOG(ERROR) << "Failed to enumerate interface handles"; - return status; - } - iface_name_to_handle_.clear(); - for (int i = 0; i < num_iface_handles; ++i) { - std::array iface_name_arr = {}; - status = global_func_table_.wifi_get_iface_name(iface_handles[i], iface_name_arr.data(), - iface_name_arr.size()); - if (status != WIFI_SUCCESS) { - LOG(WARNING) << "Failed to get interface handle name"; - continue; - } - // Assuming the interface name is null terminated since the legacy HAL - // API does not return a size. - std::string iface_name(iface_name_arr.data()); - LOG(INFO) << "Adding interface handle for " << iface_name; - iface_name_to_handle_[iface_name] = iface_handles[i]; - } - return WIFI_SUCCESS; -} - -wifi_interface_handle WifiLegacyHal::getIfaceHandle(const std::string& iface_name) { - const auto iface_handle_iter = iface_name_to_handle_.find(iface_name); - if (iface_handle_iter == iface_name_to_handle_.end()) { - LOG(ERROR) << "Unknown iface name: " << iface_name; - return nullptr; - } - return iface_handle_iter->second; -} - -void WifiLegacyHal::runEventLoop() { - LOG(DEBUG) << "Starting legacy HAL event loop"; - global_func_table_.wifi_event_loop(global_handle_); - const auto lock = hidl_sync_util::acquireGlobalLock(); - if (!awaiting_event_loop_termination_) { - LOG(FATAL) << "Legacy HAL event loop terminated, but HAL was not stopping"; - } - LOG(DEBUG) << "Legacy HAL event loop terminated"; - awaiting_event_loop_termination_ = false; - stop_wait_cv_.notify_one(); -} - -std::pair> WifiLegacyHal::getGscanCachedResults( - const std::string& iface_name) { - std::vector cached_scan_results; - cached_scan_results.resize(kMaxCachedGscanResults); - int32_t num_results = 0; - wifi_error status = global_func_table_.wifi_get_cached_gscan_results( - getIfaceHandle(iface_name), true /* always flush */, cached_scan_results.size(), - cached_scan_results.data(), &num_results); - CHECK(num_results >= 0 && static_cast(num_results) <= kMaxCachedGscanResults); - cached_scan_results.resize(num_results); - // Check for invalid IE lengths in these cached scan results and correct it. - for (auto& cached_scan_result : cached_scan_results) { - int num_scan_results = cached_scan_result.num_results; - for (int i = 0; i < num_scan_results; i++) { - auto& scan_result = cached_scan_result.results[i]; - if (scan_result.ie_length > 0) { - LOG(DEBUG) << "Cached scan result has non-zero IE length " << scan_result.ie_length; - scan_result.ie_length = 0; - } - } - } - return {status, std::move(cached_scan_results)}; -} - -wifi_error WifiLegacyHal::createVirtualInterface(const std::string& ifname, - wifi_interface_type iftype) { - // Create the interface if it doesn't exist. If interface already exist, - // Vendor Hal should return WIFI_SUCCESS. - wifi_error status = global_func_table_.wifi_virtual_interface_create(global_handle_, - ifname.c_str(), iftype); - return handleVirtualInterfaceCreateOrDeleteStatus(ifname, status); -} - -wifi_error WifiLegacyHal::deleteVirtualInterface(const std::string& ifname) { - // Delete the interface if it was created dynamically. - wifi_error status = - global_func_table_.wifi_virtual_interface_delete(global_handle_, ifname.c_str()); - return handleVirtualInterfaceCreateOrDeleteStatus(ifname, status); -} - -wifi_error WifiLegacyHal::handleVirtualInterfaceCreateOrDeleteStatus(const std::string& ifname, - wifi_error status) { - if (status == WIFI_SUCCESS) { - // refresh list of handlers now. - status = retrieveIfaceHandles(); - } else if (status == WIFI_ERROR_NOT_SUPPORTED) { - // Vendor hal does not implement this API. Such vendor implementations - // are expected to create / delete interface by other means. - - // check if interface exists. - if (if_nametoindex(ifname.c_str())) { - status = retrieveIfaceHandles(); - } - } - return status; -} - -wifi_error WifiLegacyHal::getSupportedIfaceName(uint32_t iface_type, std::string& ifname) { - std::array buffer; - - wifi_error res = global_func_table_.wifi_get_supported_iface_name( - global_handle_, (uint32_t)iface_type, buffer.data(), buffer.size()); - if (res == WIFI_SUCCESS) ifname = buffer.data(); - - return res; -} - -wifi_error WifiLegacyHal::multiStaSetPrimaryConnection(const std::string& ifname) { - return global_func_table_.wifi_multi_sta_set_primary_connection(global_handle_, - getIfaceHandle(ifname)); -} - -wifi_error WifiLegacyHal::multiStaSetUseCase(wifi_multi_sta_use_case use_case) { - return global_func_table_.wifi_multi_sta_set_use_case(global_handle_, use_case); -} - -wifi_error WifiLegacyHal::setCoexUnsafeChannels( - std::vector unsafe_channels, uint32_t restrictions) { - return global_func_table_.wifi_set_coex_unsafe_channels(global_handle_, unsafe_channels.size(), - unsafe_channels.data(), restrictions); -} - -wifi_error WifiLegacyHal::setVoipMode(const std::string& iface_name, wifi_voip_mode mode) { - return global_func_table_.wifi_set_voip_mode(getIfaceHandle(iface_name), mode); -} - -wifi_error WifiLegacyHal::twtRegisterHandler(const std::string& iface_name, - const TwtCallbackHandlers& user_callbacks) { - on_twt_event_setup_response_callback = user_callbacks.on_setup_response; - on_twt_event_teardown_completion_callback = user_callbacks.on_teardown_completion; - on_twt_event_info_frame_received_callback = user_callbacks.on_info_frame_received; - on_twt_event_device_notify_callback = user_callbacks.on_device_notify; - - return global_func_table_.wifi_twt_register_handler( - getIfaceHandle(iface_name), - {onAsyncTwtEventSetupResponse, onAsyncTwtEventTeardownCompletion, - onAsyncTwtEventInfoFrameReceived, onAsyncTwtEventDeviceNotify}); -} - -std::pair WifiLegacyHal::twtGetCapability( - const std::string& iface_name) { - TwtCapabilitySet capSet; - wifi_error status = - global_func_table_.wifi_twt_get_capability(getIfaceHandle(iface_name), &capSet); - return {status, capSet}; -} - -wifi_error WifiLegacyHal::twtSetupRequest(const std::string& iface_name, - const TwtSetupRequest& msg) { - TwtSetupRequest msgInternal(msg); - return global_func_table_.wifi_twt_setup_request(getIfaceHandle(iface_name), &msgInternal); -} - -wifi_error WifiLegacyHal::twtTearDownRequest(const std::string& iface_name, - const TwtTeardownRequest& msg) { - TwtTeardownRequest msgInternal(msg); - return global_func_table_.wifi_twt_teardown_request(getIfaceHandle(iface_name), &msgInternal); -} - -wifi_error WifiLegacyHal::twtInfoFrameRequest(const std::string& iface_name, - const TwtInfoFrameRequest& msg) { - TwtInfoFrameRequest msgInternal(msg); - return global_func_table_.wifi_twt_info_frame_request(getIfaceHandle(iface_name), &msgInternal); -} - -std::pair WifiLegacyHal::twtGetStats(const std::string& iface_name, - uint8_t configId) { - TwtStats stats; - wifi_error status = - global_func_table_.wifi_twt_get_stats(getIfaceHandle(iface_name), configId, &stats); - return {status, stats}; -} - -wifi_error WifiLegacyHal::twtClearStats(const std::string& iface_name, uint8_t configId) { - return global_func_table_.wifi_twt_clear_stats(getIfaceHandle(iface_name), configId); -} - -wifi_error WifiLegacyHal::setDtimConfig(const std::string& iface_name, uint32_t multiplier) { - return global_func_table_.wifi_set_dtim_config(getIfaceHandle(iface_name), multiplier); -} - -std::pair> WifiLegacyHal::getUsableChannels( - uint32_t band_mask, uint32_t iface_mode_mask, uint32_t filter_mask) { - std::vector channels; - channels.resize(kMaxWifiUsableChannels); - uint32_t size = 0; - wifi_error status = global_func_table_.wifi_get_usable_channels( - global_handle_, band_mask, iface_mode_mask, filter_mask, channels.size(), &size, - reinterpret_cast(channels.data())); - CHECK(size >= 0 && size <= kMaxWifiUsableChannels); - channels.resize(size); - return {status, std::move(channels)}; -} - -wifi_error WifiLegacyHal::triggerSubsystemRestart() { - return global_func_table_.wifi_trigger_subsystem_restart(global_handle_); -} - -wifi_error WifiLegacyHal::setIndoorState(bool isIndoor) { - return global_func_table_.wifi_set_indoor_state(global_handle_, isIndoor); -} - -std::pair -WifiLegacyHal::getSupportedRadioCombinationsMatrix() { - char* buffer = new char[kMaxSupportedRadioCombinationsMatrixLength]; - std::fill(buffer, buffer + kMaxSupportedRadioCombinationsMatrixLength, 0); - uint32_t size = 0; - wifi_radio_combination_matrix* radio_combination_matrix_ptr = - reinterpret_cast(buffer); - wifi_error status = global_func_table_.wifi_get_supported_radio_combinations_matrix( - global_handle_, kMaxSupportedRadioCombinationsMatrixLength, &size, - radio_combination_matrix_ptr); - CHECK(size >= 0 && size <= kMaxSupportedRadioCombinationsMatrixLength); - return {status, radio_combination_matrix_ptr}; -} - -wifi_error WifiLegacyHal::chreNanRttRequest(const std::string& iface_name, bool enable) { - if (enable) - return global_func_table_.wifi_nan_rtt_chre_enable_request(0, getIfaceHandle(iface_name), - NULL); - else - return global_func_table_.wifi_nan_rtt_chre_disable_request(0, getIfaceHandle(iface_name)); -} - -wifi_error WifiLegacyHal::chreRegisterHandler(const std::string& iface_name, - const ChreCallbackHandlers& handler) { - if (on_chre_nan_rtt_internal_callback) { - return WIFI_ERROR_NOT_AVAILABLE; - } - - on_chre_nan_rtt_internal_callback = handler.on_wifi_chre_nan_rtt_state; - - wifi_error status = global_func_table_.wifi_chre_register_handler(getIfaceHandle(iface_name), - {onAsyncChreNanRttState}); - if (status != WIFI_SUCCESS) { - on_chre_nan_rtt_internal_callback = nullptr; - } - return status; -} - -wifi_error WifiLegacyHal::enableWifiTxPowerLimits(const std::string& iface_name, bool enable) { - return global_func_table_.wifi_enable_tx_power_limits(getIfaceHandle(iface_name), enable); -} - -wifi_error WifiLegacyHal::getWifiCachedScanResults( - const std::string& iface_name, const CachedScanResultsCallbackHandlers& handler) { - on_cached_scan_results_internal_callback = handler.on_cached_scan_results; - - wifi_error status = global_func_table_.wifi_get_cached_scan_results(getIfaceHandle(iface_name), - {onSyncCachedScanResults}); - - on_cached_scan_results_internal_callback = nullptr; - return status; -} - -void WifiLegacyHal::invalidate() { - global_handle_ = nullptr; - iface_name_to_handle_.clear(); - on_driver_memory_dump_internal_callback = nullptr; - on_firmware_memory_dump_internal_callback = nullptr; - on_gscan_event_internal_callback = nullptr; - on_gscan_full_result_internal_callback = nullptr; - on_link_layer_stats_result_internal_callback = nullptr; - on_rssi_threshold_breached_internal_callback = nullptr; - on_ring_buffer_data_internal_callback = nullptr; - on_error_alert_internal_callback = nullptr; - on_radio_mode_change_internal_callback = nullptr; - on_subsystem_restart_internal_callback = nullptr; - on_rtt_results_internal_callback = nullptr; - on_nan_notify_response_user_callback = nullptr; - on_nan_event_publish_terminated_user_callback = nullptr; - on_nan_event_match_user_callback = nullptr; - on_nan_event_match_expired_user_callback = nullptr; - on_nan_event_subscribe_terminated_user_callback = nullptr; - on_nan_event_followup_user_callback = nullptr; - on_nan_event_disc_eng_event_user_callback = nullptr; - on_nan_event_disabled_user_callback = nullptr; - on_nan_event_tca_user_callback = nullptr; - on_nan_event_beacon_sdf_payload_user_callback = nullptr; - on_nan_event_data_path_request_user_callback = nullptr; - on_nan_event_data_path_confirm_user_callback = nullptr; - on_nan_event_data_path_end_user_callback = nullptr; - on_nan_event_transmit_follow_up_user_callback = nullptr; - on_nan_event_range_request_user_callback = nullptr; - on_nan_event_range_report_user_callback = nullptr; - on_nan_event_schedule_update_user_callback = nullptr; - on_twt_event_setup_response_callback = nullptr; - on_twt_event_teardown_completion_callback = nullptr; - on_twt_event_info_frame_received_callback = nullptr; - on_twt_event_device_notify_callback = nullptr; - on_chre_nan_rtt_internal_callback = nullptr; -} - -} // namespace legacy_hal -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/wifi_legacy_hal.h b/wifi/1.6/default/wifi_legacy_hal.h deleted file mode 100644 index b6bd5ea6ba..0000000000 --- a/wifi/1.6/default/wifi_legacy_hal.h +++ /dev/null @@ -1,739 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef WIFI_LEGACY_HAL_H_ -#define WIFI_LEGACY_HAL_H_ - -#include -#include -#include -#include -#include - -#include -#include - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -// This is in a separate namespace to prevent typename conflicts between -// the legacy HAL types and the HIDL interface types. -namespace legacy_hal { -// Import all the types defined inside the legacy HAL header files into this -// namespace. -using ::chre_nan_rtt_state; -using ::frame_info; -using ::frame_type; -using ::FRAME_TYPE_80211_MGMT; -using ::FRAME_TYPE_ETHERNET_II; -using ::FRAME_TYPE_UNKNOWN; -using ::fw_roaming_state_t; -using ::mac_addr; -using ::NAN_CHANNEL_24G_BAND; -using ::NAN_CHANNEL_5G_BAND_HIGH; -using ::NAN_CHANNEL_5G_BAND_LOW; -using ::NAN_DISABLE_RANGE_REPORT; -using ::NAN_DO_NOT_USE_SRF; -using ::NAN_DP_CHANNEL_NOT_REQUESTED; -using ::NAN_DP_CONFIG_NO_SECURITY; -using ::NAN_DP_CONFIG_SECURITY; -using ::NAN_DP_END; -using ::NAN_DP_FORCE_CHANNEL_SETUP; -using ::NAN_DP_INITIATOR_RESPONSE; -using ::NAN_DP_INTERFACE_CREATE; -using ::NAN_DP_INTERFACE_DELETE; -using ::NAN_DP_REQUEST_ACCEPT; -using ::NAN_DP_REQUEST_CHANNEL_SETUP; -using ::NAN_DP_REQUEST_REJECT; -using ::NAN_DP_RESPONDER_RESPONSE; -using ::NAN_GET_CAPABILITIES; -using ::NAN_MATCH_ALG_MATCH_CONTINUOUS; -using ::NAN_MATCH_ALG_MATCH_NEVER; -using ::NAN_MATCH_ALG_MATCH_ONCE; -using ::NAN_PUBLISH_TYPE_SOLICITED; -using ::NAN_PUBLISH_TYPE_UNSOLICITED; -using ::NAN_PUBLISH_TYPE_UNSOLICITED_SOLICITED; -using ::NAN_RANGING_AUTO_RESPONSE_DISABLE; -using ::NAN_RANGING_AUTO_RESPONSE_ENABLE; -using ::NAN_RANGING_DISABLE; -using ::NAN_RANGING_ENABLE; -using ::NAN_RESPONSE_BEACON_SDF_PAYLOAD; -using ::NAN_RESPONSE_CONFIG; -using ::NAN_RESPONSE_DISABLED; -using ::NAN_RESPONSE_ENABLED; -using ::NAN_RESPONSE_ERROR; -using ::NAN_RESPONSE_PUBLISH; -using ::NAN_RESPONSE_PUBLISH_CANCEL; -using ::NAN_RESPONSE_STATS; -using ::NAN_RESPONSE_SUBSCRIBE; -using ::NAN_RESPONSE_SUBSCRIBE_CANCEL; -using ::NAN_RESPONSE_TCA; -using ::NAN_RESPONSE_TRANSMIT_FOLLOWUP; -using ::NAN_SECURITY_KEY_INPUT_PASSPHRASE; -using ::NAN_SECURITY_KEY_INPUT_PMK; -using ::NAN_SERVICE_ACCEPT_POLICY_ALL; -using ::NAN_SERVICE_ACCEPT_POLICY_NONE; -using ::NAN_SRF_ATTR_BLOOM_FILTER; -using ::NAN_SRF_ATTR_PARTIAL_MAC_ADDR; -using ::NAN_SRF_INCLUDE_DO_NOT_RESPOND; -using ::NAN_SRF_INCLUDE_RESPOND; -using ::NAN_SSI_NOT_REQUIRED_IN_MATCH_IND; -using ::NAN_SSI_REQUIRED_IN_MATCH_IND; -using ::NAN_STATUS_ALREADY_ENABLED; -using ::NAN_STATUS_FOLLOWUP_QUEUE_FULL; -using ::NAN_STATUS_INTERNAL_FAILURE; -using ::NAN_STATUS_INVALID_NDP_ID; -using ::NAN_STATUS_INVALID_PARAM; -using ::NAN_STATUS_INVALID_PUBLISH_SUBSCRIBE_ID; -using ::NAN_STATUS_INVALID_REQUESTOR_INSTANCE_ID; -using ::NAN_STATUS_NAN_NOT_ALLOWED; -using ::NAN_STATUS_NO_OTA_ACK; -using ::NAN_STATUS_NO_RESOURCE_AVAILABLE; -using ::NAN_STATUS_PROTOCOL_FAILURE; -using ::NAN_STATUS_SUCCESS; -using ::NAN_STATUS_UNSUPPORTED_CONCURRENCY_NAN_DISABLED; -using ::NAN_SUBSCRIBE_TYPE_ACTIVE; -using ::NAN_SUBSCRIBE_TYPE_PASSIVE; -using ::NAN_TRANSMIT_IN_DW; -using ::NAN_TRANSMIT_IN_FAW; -using ::NAN_TX_PRIORITY_HIGH; -using ::NAN_TX_PRIORITY_NORMAL; -using ::NAN_TX_TYPE_BROADCAST; -using ::NAN_TX_TYPE_UNICAST; -using ::NAN_USE_SRF; -using ::NanBeaconSdfPayloadInd; -using ::NanCapabilities; -using ::NanChannelInfo; -using ::NanConfigRequest; -using ::NanDataPathChannelCfg; -using ::NanDataPathConfirmInd; -using ::NanDataPathEndInd; -using ::NanDataPathIndicationResponse; -using ::NanDataPathInitiatorRequest; -using ::NanDataPathRequestInd; -using ::NanDataPathScheduleUpdateInd; -using ::NanDisabledInd; -using ::NanDiscEngEventInd; -using ::NanEnableRequest; -using ::NanFollowupInd; -using ::NanMatchAlg; -using ::NanMatchExpiredInd; -using ::NanMatchInd; -using ::NanPublishCancelRequest; -using ::NanPublishRequest; -using ::NanPublishTerminatedInd; -using ::NanPublishType; -using ::NanRangeReportInd; -using ::NanRangeRequestInd; -using ::NanResponseMsg; -using ::NanSRFType; -using ::NanStatusType; -using ::NanSubscribeCancelRequest; -using ::NanSubscribeRequest; -using ::NanSubscribeTerminatedInd; -using ::NanSubscribeType; -using ::NanTransmitFollowupInd; -using ::NanTransmitFollowupRequest; -using ::NanTxType; -using ::ROAMING_DISABLE; -using ::ROAMING_ENABLE; -using ::RTT_PEER_AP; -using ::RTT_PEER_NAN; -using ::RTT_PEER_P2P_CLIENT; -using ::RTT_PEER_P2P_GO; -using ::RTT_PEER_STA; -using ::rtt_peer_type; -using ::RTT_STATUS_ABORTED; -using ::RTT_STATUS_FAIL_AP_ON_DIFF_CHANNEL; -using ::RTT_STATUS_FAIL_BUSY_TRY_LATER; -using ::RTT_STATUS_FAIL_FTM_PARAM_OVERRIDE; -using ::RTT_STATUS_FAIL_INVALID_TS; -using ::RTT_STATUS_FAIL_NO_CAPABILITY; -using ::RTT_STATUS_FAIL_NO_RSP; -using ::RTT_STATUS_FAIL_NOT_SCHEDULED_YET; -using ::RTT_STATUS_FAIL_PROTOCOL; -using ::RTT_STATUS_FAIL_REJECTED; -using ::RTT_STATUS_FAIL_SCHEDULE; -using ::RTT_STATUS_FAIL_TM_TIMEOUT; -using ::RTT_STATUS_FAILURE; -using ::RTT_STATUS_INVALID_REQ; -using ::RTT_STATUS_NAN_RANGING_CONCURRENCY_NOT_SUPPORTED; -using ::RTT_STATUS_NAN_RANGING_PROTOCOL_FAILURE; -using ::RTT_STATUS_NO_WIFI; -using ::RTT_STATUS_SUCCESS; -using ::RTT_TYPE_1_SIDED; -using ::RTT_TYPE_2_SIDED; -using ::RX_PKT_FATE_DRV_DROP_FILTER; -using ::RX_PKT_FATE_DRV_DROP_INVALID; -using ::RX_PKT_FATE_DRV_DROP_NOBUFS; -using ::RX_PKT_FATE_DRV_DROP_OTHER; -using ::RX_PKT_FATE_DRV_QUEUED; -using ::RX_PKT_FATE_FW_DROP_FILTER; -using ::RX_PKT_FATE_FW_DROP_INVALID; -using ::RX_PKT_FATE_FW_DROP_NOBUFS; -using ::RX_PKT_FATE_FW_DROP_OTHER; -using ::RX_PKT_FATE_FW_QUEUED; -using ::RX_PKT_FATE_SUCCESS; -using ::ssid_t; -using ::transaction_id; -using ::TX_PKT_FATE_ACKED; -using ::TX_PKT_FATE_DRV_DROP_INVALID; -using ::TX_PKT_FATE_DRV_DROP_NOBUFS; -using ::TX_PKT_FATE_DRV_DROP_OTHER; -using ::TX_PKT_FATE_DRV_QUEUED; -using ::TX_PKT_FATE_FW_DROP_INVALID; -using ::TX_PKT_FATE_FW_DROP_NOBUFS; -using ::TX_PKT_FATE_FW_DROP_OTHER; -using ::TX_PKT_FATE_FW_QUEUED; -using ::TX_PKT_FATE_SENT; -using ::WIFI_AC_BE; -using ::WIFI_AC_BK; -using ::WIFI_AC_VI; -using ::WIFI_AC_VO; -using ::WIFI_ANTENNA_1X1; -using ::WIFI_ANTENNA_2X2; -using ::WIFI_ANTENNA_3X3; -using ::WIFI_ANTENNA_4X4; -using ::WIFI_ANTENNA_UNSPECIFIED; -using ::wifi_band; -using ::WIFI_BAND_A; -using ::WIFI_BAND_A_DFS; -using ::WIFI_BAND_A_WITH_DFS; -using ::WIFI_BAND_ABG; -using ::WIFI_BAND_ABG_WITH_DFS; -using ::WIFI_BAND_BG; -using ::WIFI_BAND_UNSPECIFIED; -using ::wifi_cached_scan_report; -using ::wifi_cached_scan_results; -using ::WIFI_CHAN_WIDTH_10; -using ::WIFI_CHAN_WIDTH_160; -using ::WIFI_CHAN_WIDTH_20; -using ::WIFI_CHAN_WIDTH_320; -using ::WIFI_CHAN_WIDTH_40; -using ::WIFI_CHAN_WIDTH_5; -using ::WIFI_CHAN_WIDTH_80; -using ::WIFI_CHAN_WIDTH_80P80; -using ::WIFI_CHAN_WIDTH_INVALID; -using ::wifi_channel_info; -using ::wifi_channel_stat; -using ::wifi_channel_width; -using ::wifi_coex_restriction; -using ::wifi_coex_unsafe_channel; -using ::WIFI_DUAL_STA_NON_TRANSIENT_UNBIASED; -using ::WIFI_DUAL_STA_TRANSIENT_PREFER_PRIMARY; -using ::wifi_error; -using ::WIFI_ERROR_BUSY; -using ::WIFI_ERROR_INVALID_ARGS; -using ::WIFI_ERROR_INVALID_REQUEST_ID; -using ::WIFI_ERROR_NONE; -using ::WIFI_ERROR_NOT_AVAILABLE; -using ::WIFI_ERROR_NOT_SUPPORTED; -using ::WIFI_ERROR_OUT_OF_MEMORY; -using ::WIFI_ERROR_TIMED_OUT; -using ::WIFI_ERROR_TOO_MANY_REQUESTS; -using ::WIFI_ERROR_UNINITIALIZED; -using ::WIFI_ERROR_UNKNOWN; -using ::wifi_gscan_capabilities; -using ::wifi_hal_fn; -using ::wifi_information_element; -using ::WIFI_INTERFACE_IBSS; -using ::WIFI_INTERFACE_MESH; -using ::wifi_interface_mode; -using ::WIFI_INTERFACE_NAN; -using ::WIFI_INTERFACE_P2P_CLIENT; -using ::WIFI_INTERFACE_P2P_GO; -using ::WIFI_INTERFACE_SOFTAP; -using ::WIFI_INTERFACE_STA; -using ::WIFI_INTERFACE_TDLS; -using ::wifi_interface_type; -using ::WIFI_INTERFACE_TYPE_AP; -using ::WIFI_INTERFACE_TYPE_NAN; -using ::WIFI_INTERFACE_TYPE_P2P; -using ::WIFI_INTERFACE_TYPE_STA; -using ::WIFI_INTERFACE_UNKNOWN; -using ::wifi_latency_mode; -using ::WIFI_LATENCY_MODE_LOW; -using ::WIFI_LATENCY_MODE_NORMAL; -using ::wifi_lci_information; -using ::wifi_lcr_information; -using ::WIFI_LOGGER_CONNECT_EVENT_SUPPORTED; -using ::WIFI_LOGGER_DRIVER_DUMP_SUPPORTED; -using ::WIFI_LOGGER_MEMORY_DUMP_SUPPORTED; -using ::WIFI_LOGGER_PACKET_FATE_SUPPORTED; -using ::WIFI_LOGGER_POWER_EVENT_SUPPORTED; -using ::WIFI_LOGGER_WAKE_LOCK_SUPPORTED; -using ::WIFI_MOTION_EXPECTED; -using ::WIFI_MOTION_NOT_EXPECTED; -using ::wifi_motion_pattern; -using ::WIFI_MOTION_UNKNOWN; -using ::wifi_multi_sta_use_case; -using ::wifi_power_scenario; -using ::WIFI_POWER_SCENARIO_ON_BODY_CELL_OFF; -using ::WIFI_POWER_SCENARIO_ON_BODY_CELL_ON; -using ::WIFI_POWER_SCENARIO_ON_HEAD_CELL_OFF; -using ::WIFI_POWER_SCENARIO_ON_HEAD_CELL_ON; -using ::WIFI_POWER_SCENARIO_VOICE_CALL; -using ::wifi_radio_combination; -using ::wifi_radio_combination_matrix; -using ::wifi_radio_configuration; -using ::wifi_rate; -using ::wifi_request_id; -using ::wifi_ring_buffer_status; -using ::wifi_roaming_capabilities; -using ::wifi_roaming_config; -using ::wifi_rtt_bw; -using ::WIFI_RTT_BW_10; -using ::WIFI_RTT_BW_160; -using ::WIFI_RTT_BW_20; -using ::WIFI_RTT_BW_320; -using ::WIFI_RTT_BW_40; -using ::WIFI_RTT_BW_5; -using ::WIFI_RTT_BW_80; -using ::wifi_rtt_capabilities; -using ::wifi_rtt_config; -using ::wifi_rtt_preamble; -using ::WIFI_RTT_PREAMBLE_EHT; -using ::WIFI_RTT_PREAMBLE_HE; -using ::WIFI_RTT_PREAMBLE_HT; -using ::WIFI_RTT_PREAMBLE_LEGACY; -using ::WIFI_RTT_PREAMBLE_VHT; -using ::wifi_rtt_responder; -using ::wifi_rtt_result; -using ::wifi_rtt_status; -using ::wifi_rtt_type; -using ::wifi_rx_packet_fate; -using ::wifi_rx_report; -using ::wifi_scan_bucket_spec; -using ::wifi_scan_cmd_params; -using ::WIFI_SCAN_FLAG_INTERRUPTED; -using ::wifi_scan_result; -using ::WIFI_SUCCESS; -using ::wifi_tx_packet_fate; -using ::wifi_tx_report; -using ::wifi_usable_channel; -using ::WIFI_USABLE_CHANNEL_FILTER_CELLULAR_COEXISTENCE; -using ::WIFI_USABLE_CHANNEL_FILTER_CONCURRENCY; -using ::WLAN_MAC_2_4_BAND; -using ::WLAN_MAC_5_0_BAND; -using ::WLAN_MAC_60_0_BAND; -using ::WLAN_MAC_6_0_BAND; - -// APF capabilities supported by the iface. -struct PacketFilterCapabilities { - uint32_t version; - uint32_t max_len; -}; - -// WARNING: We don't care about the variable sized members of either -// |wifi_iface_stat|, |wifi_radio_stat| structures. So, using the pragma -// to escape the compiler warnings regarding this. -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wgnu-variable-sized-type-not-at-end" -// The |wifi_radio_stat.tx_time_per_levels| stats is provided as a pointer in -// |wifi_radio_stat| structure in the legacy HAL API. Separate that out -// into a separate return element to avoid passing pointers around. -struct LinkLayerRadioStats { - wifi_radio_stat stats; - std::vector tx_time_per_levels; - std::vector channel_stats; -}; - -struct WifiPeerInfo { - wifi_peer_info peer_info; - std::vector rate_stats; -}; - -struct LinkLayerStats { - wifi_iface_stat iface; - std::vector radios; - std::vector peers; -}; -#pragma GCC diagnostic pop - -// The |WLAN_DRIVER_WAKE_REASON_CNT.cmd_event_wake_cnt| and -// |WLAN_DRIVER_WAKE_REASON_CNT.driver_fw_local_wake_cnt| stats is provided -// as a pointer in |WLAN_DRIVER_WAKE_REASON_CNT| structure in the legacy HAL -// API. Separate that out into a separate return elements to avoid passing -// pointers around. -struct WakeReasonStats { - WLAN_DRIVER_WAKE_REASON_CNT wake_reason_cnt; - std::vector cmd_event_wake_cnt; - std::vector driver_fw_local_wake_cnt; -}; - -// NAN response and event callbacks struct. -struct NanCallbackHandlers { - // NotifyResponse invoked to notify the status of the Request. - std::function on_notify_response; - // Various event callbacks. - std::function on_event_publish_terminated; - std::function on_event_match; - std::function on_event_match_expired; - std::function on_event_subscribe_terminated; - std::function on_event_followup; - std::function on_event_disc_eng_event; - std::function on_event_disabled; - std::function on_event_tca; - std::function on_event_beacon_sdf_payload; - std::function on_event_data_path_request; - std::function on_event_data_path_confirm; - std::function on_event_data_path_end; - std::function on_event_transmit_follow_up; - std::function on_event_range_request; - std::function on_event_range_report; - std::function on_event_schedule_update; -}; - -// Full scan results contain IE info and are hence passed by reference, to -// preserve the variable length array member |ie_data|. Callee must not retain -// the pointer. -using on_gscan_full_result_callback = - std::function; -// These scan results don't contain any IE info, so no need to pass by -// reference. -using on_gscan_results_callback = - std::function&)>; - -// Invoked when the rssi value breaches the thresholds set. -using on_rssi_threshold_breached_callback = - std::function, int8_t)>; - -// Callback for RTT range request results. -// Rtt results contain IE info and are hence passed by reference, to -// preserve the |LCI| and |LCR| pointers. Callee must not retain -// the pointer. -using on_rtt_results_callback = - std::function&)>; - -// Callback for ring buffer data. -using on_ring_buffer_data_callback = std::function&, const wifi_ring_buffer_status&)>; - -// Callback for alerts. -using on_error_alert_callback = std::function&)>; - -// Callback for subsystem restart -using on_subsystem_restart_callback = std::function; - -// Struct for the mac info from the legacy HAL. This is a cleaner version -// of the |wifi_mac_info| & |wifi_iface_info|. -typedef struct { - std::string name; - wifi_channel channel; -} WifiIfaceInfo; - -typedef struct { - uint32_t wlan_mac_id; - /* BIT MASK of BIT(WLAN_MAC*) as represented by wlan_mac_band */ - uint32_t mac_band; - /* Represents the connected Wi-Fi interfaces associated with each MAC */ - std::vector iface_infos; -} WifiMacInfo; - -// Callback for radio mode change -using on_radio_mode_change_callback = std::function&)>; - -// TWT response and event callbacks struct. -struct TwtCallbackHandlers { - // Callback for TWT setup response - std::function on_setup_response; - // Callback for TWT teardown completion - std::function on_teardown_completion; - // Callback for TWT info frame received event - std::function on_info_frame_received; - // Callback for TWT notification from the device - std::function on_device_notify; -}; - -// CHRE response and event callbacks struct. -struct ChreCallbackHandlers { - // Callback for CHRE NAN RTT - std::function on_wifi_chre_nan_rtt_state; -}; - -// Cached Scan Results response and event callbacks struct. -struct CachedScanResultsCallbackHandlers { - // Callback for Cached Scan Results - std::function on_cached_scan_results; -}; - -/** - * Class that encapsulates all legacy HAL interactions. - * This class manages the lifetime of the event loop thread used by legacy HAL. - * - * Note: There will only be a single instance of this class created in the Wifi - * object and will be valid for the lifetime of the process. - */ -class WifiLegacyHal { - public: - WifiLegacyHal(const std::weak_ptr iface_tool, const wifi_hal_fn& fn, - bool is_primary); - virtual ~WifiLegacyHal() = default; - - // Initialize the legacy HAL function table. - virtual wifi_error initialize(); - // Start the legacy HAL and the event looper thread. - virtual wifi_error start(); - // Deinitialize the legacy HAL and wait for the event loop thread to exit - // using a predefined timeout. - virtual wifi_error stop(std::unique_lock* lock, - const std::function& on_complete_callback); - virtual wifi_error waitForDriverReady(); - // Checks if legacy HAL has successfully started - bool isStarted(); - // Wrappers for all the functions in the legacy HAL function table. - virtual std::pair getDriverVersion(const std::string& iface_name); - virtual std::pair getFirmwareVersion(const std::string& iface_name); - std::pair> requestDriverMemoryDump( - const std::string& iface_name); - std::pair> requestFirmwareMemoryDump( - const std::string& iface_name); - virtual std::pair getSupportedFeatureSet(const std::string& iface_name); - // APF functions. - std::pair getPacketFilterCapabilities( - const std::string& iface_name); - wifi_error setPacketFilter(const std::string& iface_name, const std::vector& program); - std::pair> readApfPacketFilterData( - const std::string& iface_name); - // Gscan functions. - std::pair getGscanCapabilities( - const std::string& iface_name); - // These API's provides a simplified interface over the legacy Gscan API's: - // a) All scan events from the legacy HAL API other than the - // |WIFI_SCAN_FAILED| are treated as notification of results. - // This method then retrieves the cached scan results from the legacy - // HAL API and triggers the externally provided - // |on_results_user_callback| on success. - // b) |WIFI_SCAN_FAILED| scan event or failure to retrieve cached scan - // results - // triggers the externally provided |on_failure_user_callback|. - // c) Full scan result event triggers the externally provided - // |on_full_result_user_callback|. - wifi_error startGscan(const std::string& iface_name, wifi_request_id id, - const wifi_scan_cmd_params& params, - const std::function& on_failure_callback, - const on_gscan_results_callback& on_results_callback, - const on_gscan_full_result_callback& on_full_result_callback); - wifi_error stopGscan(const std::string& iface_name, wifi_request_id id); - std::pair> getValidFrequenciesForBand( - const std::string& iface_name, wifi_band band); - virtual wifi_error setDfsFlag(const std::string& iface_name, bool dfs_on); - // Link layer stats functions. - wifi_error enableLinkLayerStats(const std::string& iface_name, bool debug); - wifi_error disableLinkLayerStats(const std::string& iface_name); - std::pair getLinkLayerStats(const std::string& iface_name); - // RSSI monitor functions. - wifi_error startRssiMonitoring( - const std::string& iface_name, wifi_request_id id, int8_t max_rssi, int8_t min_rssi, - const on_rssi_threshold_breached_callback& on_threshold_breached_callback); - wifi_error stopRssiMonitoring(const std::string& iface_name, wifi_request_id id); - std::pair getRoamingCapabilities( - const std::string& iface_name); - wifi_error configureRoaming(const std::string& iface_name, const wifi_roaming_config& config); - wifi_error enableFirmwareRoaming(const std::string& iface_name, fw_roaming_state_t state); - wifi_error configureNdOffload(const std::string& iface_name, bool enable); - wifi_error startSendingOffloadedPacket(const std::string& iface_name, uint32_t cmd_id, - uint16_t ether_type, - const std::vector& ip_packet_data, - const std::array& src_address, - const std::array& dst_address, - uint32_t period_in_ms); - wifi_error stopSendingOffloadedPacket(const std::string& iface_name, uint32_t cmd_id); - virtual wifi_error selectTxPowerScenario(const std::string& iface_name, - wifi_power_scenario scenario); - virtual wifi_error resetTxPowerScenario(const std::string& iface_name); - wifi_error setLatencyMode(const std::string& iface_name, wifi_latency_mode mode); - wifi_error setThermalMitigationMode(wifi_thermal_mode mode, uint32_t completion_window); - wifi_error setDscpToAccessCategoryMapping(uint32_t start, uint32_t end, - uint32_t access_category); - wifi_error resetDscpToAccessCategoryMapping(); - // Logger/debug functions. - std::pair getLoggerSupportedFeatureSet(const std::string& iface_name); - wifi_error startPktFateMonitoring(const std::string& iface_name); - std::pair> getTxPktFates(const std::string& iface_name); - std::pair> getRxPktFates(const std::string& iface_name); - std::pair getWakeReasonStats(const std::string& iface_name); - wifi_error registerRingBufferCallbackHandler( - const std::string& iface_name, const on_ring_buffer_data_callback& on_data_callback); - wifi_error deregisterRingBufferCallbackHandler(const std::string& iface_name); - virtual wifi_error registerSubsystemRestartCallbackHandler( - const on_subsystem_restart_callback& on_restart_callback); - std::pair> getRingBuffersStatus( - const std::string& iface_name); - wifi_error startRingBufferLogging(const std::string& iface_name, const std::string& ring_name, - uint32_t verbose_level, uint32_t max_interval_sec, - uint32_t min_data_size); - wifi_error getRingBufferData(const std::string& iface_name, const std::string& ring_name); - wifi_error registerErrorAlertCallbackHandler(const std::string& iface_name, - const on_error_alert_callback& on_alert_callback); - wifi_error deregisterErrorAlertCallbackHandler(const std::string& iface_name); - // Radio mode functions. - virtual wifi_error registerRadioModeChangeCallbackHandler( - const std::string& iface_name, - const on_radio_mode_change_callback& on_user_change_callback); - // RTT functions. - wifi_error startRttRangeRequest(const std::string& iface_name, wifi_request_id id, - const std::vector& rtt_configs, - const on_rtt_results_callback& on_results_callback); - wifi_error cancelRttRangeRequest(const std::string& iface_name, wifi_request_id id, - const std::vector>& mac_addrs); - std::pair getRttCapabilities(const std::string& iface_name); - std::pair getRttResponderInfo(const std::string& iface_name); - wifi_error enableRttResponder(const std::string& iface_name, wifi_request_id id, - const wifi_channel_info& channel_hint, uint32_t max_duration_secs, - const wifi_rtt_responder& info); - wifi_error disableRttResponder(const std::string& iface_name, wifi_request_id id); - wifi_error setRttLci(const std::string& iface_name, wifi_request_id id, - const wifi_lci_information& info); - wifi_error setRttLcr(const std::string& iface_name, wifi_request_id id, - const wifi_lcr_information& info); - // NAN functions. - virtual wifi_error nanRegisterCallbackHandlers(const std::string& iface_name, - const NanCallbackHandlers& callbacks); - wifi_error nanEnableRequest(const std::string& iface_name, transaction_id id, - const NanEnableRequest& msg); - virtual wifi_error nanDisableRequest(const std::string& iface_name, transaction_id id); - wifi_error nanPublishRequest(const std::string& iface_name, transaction_id id, - const NanPublishRequest& msg); - wifi_error nanPublishCancelRequest(const std::string& iface_name, transaction_id id, - const NanPublishCancelRequest& msg); - wifi_error nanSubscribeRequest(const std::string& iface_name, transaction_id id, - const NanSubscribeRequest& msg); - wifi_error nanSubscribeCancelRequest(const std::string& iface_name, transaction_id id, - const NanSubscribeCancelRequest& msg); - wifi_error nanTransmitFollowupRequest(const std::string& iface_name, transaction_id id, - const NanTransmitFollowupRequest& msg); - wifi_error nanStatsRequest(const std::string& iface_name, transaction_id id, - const NanStatsRequest& msg); - wifi_error nanConfigRequest(const std::string& iface_name, transaction_id id, - const NanConfigRequest& msg); - wifi_error nanTcaRequest(const std::string& iface_name, transaction_id id, - const NanTCARequest& msg); - wifi_error nanBeaconSdfPayloadRequest(const std::string& iface_name, transaction_id id, - const NanBeaconSdfPayloadRequest& msg); - std::pair nanGetVersion(); - wifi_error nanGetCapabilities(const std::string& iface_name, transaction_id id); - wifi_error nanDataInterfaceCreate(const std::string& iface_name, transaction_id id, - const std::string& data_iface_name); - virtual wifi_error nanDataInterfaceDelete(const std::string& iface_name, transaction_id id, - const std::string& data_iface_name); - wifi_error nanDataRequestInitiator(const std::string& iface_name, transaction_id id, - const NanDataPathInitiatorRequest& msg); - wifi_error nanDataIndicationResponse(const std::string& iface_name, transaction_id id, - const NanDataPathIndicationResponse& msg); - wifi_error nanDataEnd(const std::string& iface_name, transaction_id id, uint32_t ndpInstanceId); - // AP functions. - wifi_error setCountryCode(const std::string& iface_name, std::array code); - - // interface functions. - virtual wifi_error createVirtualInterface(const std::string& ifname, - wifi_interface_type iftype); - virtual wifi_error deleteVirtualInterface(const std::string& ifname); - virtual wifi_error getSupportedIfaceName(uint32_t iface_type, std::string& ifname); - - // STA + STA functions - virtual wifi_error multiStaSetPrimaryConnection(const std::string& ifname); - virtual wifi_error multiStaSetUseCase(wifi_multi_sta_use_case use_case); - - // Coex functions. - virtual wifi_error setCoexUnsafeChannels(std::vector unsafe_channels, - uint32_t restrictions); - - wifi_error setVoipMode(const std::string& iface_name, wifi_voip_mode mode); - - wifi_error twtRegisterHandler(const std::string& iface_name, - const TwtCallbackHandlers& handler); - - std::pair twtGetCapability(const std::string& iface_name); - - wifi_error twtSetupRequest(const std::string& iface_name, const TwtSetupRequest& msg); - - wifi_error twtTearDownRequest(const std::string& iface_name, const TwtTeardownRequest& msg); - - wifi_error twtInfoFrameRequest(const std::string& iface_name, const TwtInfoFrameRequest& msg); - - std::pair twtGetStats(const std::string& iface_name, uint8_t configId); - - wifi_error twtClearStats(const std::string& iface_name, uint8_t configId); - - wifi_error setDtimConfig(const std::string& iface_name, uint32_t multiplier); - - // Retrieve the list of usable channels in the requested bands - // for the requested modes - std::pair> getUsableChannels( - uint32_t band_mask, uint32_t iface_mode_mask, uint32_t filter_mask); - - wifi_error triggerSubsystemRestart(); - - wifi_error setIndoorState(bool isIndoor); - - std::pair getSupportedRadioCombinationsMatrix(); - - // CHRE NAN RTT function - wifi_error chreNanRttRequest(const std::string& iface_name, bool enable); - - wifi_error chreRegisterHandler(const std::string& iface_name, - const ChreCallbackHandlers& handler); - - wifi_error enableWifiTxPowerLimits(const std::string& iface_name, bool enable); - wifi_error getWifiCachedScanResults(const std::string& iface_name, - const CachedScanResultsCallbackHandlers& handler); - - private: - // Retrieve interface handles for all the available interfaces. - wifi_error retrieveIfaceHandles(); - wifi_interface_handle getIfaceHandle(const std::string& iface_name); - // Run the legacy HAL event loop thread. - void runEventLoop(); - // Retrieve the cached gscan results to pass the results back to the - // external callbacks. - std::pair> getGscanCachedResults( - const std::string& iface_name); - void invalidate(); - // Handles wifi (error) status of Virtual interface create/delete - wifi_error handleVirtualInterfaceCreateOrDeleteStatus(const std::string& ifname, - wifi_error status); - - // Global function table of legacy HAL. - wifi_hal_fn global_func_table_; - // Opaque handle to be used for all global operations. - wifi_handle global_handle_; - // Map of interface name to handle that is to be used for all interface - // specific operations. - std::map iface_name_to_handle_; - // Flag to indicate if we have initiated the cleanup of legacy HAL. - std::atomic awaiting_event_loop_termination_; - std::condition_variable_any stop_wait_cv_; - // Flag to indicate if the legacy HAL has been started. - bool is_started_; - std::weak_ptr iface_tool_; - // flag to indicate if this HAL is for the primary chip. This is used - // in order to avoid some hard-coded behavior used with older HALs, - // such as bring wlan0 interface up/down on start/stop HAL. - // it may be removed once vendor HALs are updated. - bool is_primary_; -}; - -} // namespace legacy_hal -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // WIFI_LEGACY_HAL_H_ diff --git a/wifi/1.6/default/wifi_legacy_hal_factory.cpp b/wifi/1.6/default/wifi_legacy_hal_factory.cpp deleted file mode 100644 index 147bf4d7cc..0000000000 --- a/wifi/1.6/default/wifi_legacy_hal_factory.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (C) 2020 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. - */ - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "wifi_legacy_hal_factory.h" -#include "wifi_legacy_hal_stubs.h" - -namespace { -static constexpr char kVendorHalsDescPath[] = "/vendor/etc/wifi/vendor_hals"; -static constexpr char kVendorHalsDescExt[] = ".xml"; -static constexpr uint32_t kVendorHalsDescVersion = 1; - -bool isDirectory(struct dirent* entryPtr) { - bool isDir = false; - if (entryPtr->d_type != DT_UNKNOWN && entryPtr->d_type != DT_LNK) { - isDir = (entryPtr->d_type == DT_DIR); - } else { - struct stat entryStat; - stat(entryPtr->d_name, &entryStat); - isDir = S_ISDIR(entryStat.st_mode); - } - return isDir; -} - -bool isFileExtension(const char* name, const char* ext) { - if (name == NULL) return false; - if (ext == NULL) return false; - - size_t extLen = strlen(ext); - size_t nameLen = strlen(name); - - if (extLen > nameLen) return false; - - if (strncmp(name + nameLen - extLen, ext, extLen) != 0) return false; - - return true; -} -}; // namespace - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace legacy_hal { - -WifiLegacyHalFactory::WifiLegacyHalFactory( - const std::weak_ptr iface_tool) - : iface_tool_(iface_tool) {} - -std::vector> WifiLegacyHalFactory::getHals() { - if (legacy_hals_.empty()) { - if (!initVendorHalDescriptorFromLinked()) initVendorHalsDescriptorList(); - for (auto& desc : descs_) { - std::shared_ptr hal = - std::make_shared(iface_tool_, desc.fn, desc.primary); - legacy_hals_.push_back(hal); - } - } - - return legacy_hals_; -} - -bool WifiLegacyHalFactory::initVendorHalDescriptorFromLinked() { - wifi_hal_lib_desc desc; - - if (!initLinkedHalFunctionTable(&desc.fn)) return false; - - desc.primary = true; - desc.handle = NULL; - descs_.push_back(desc); - return true; -} - -bool WifiLegacyHalFactory::initLinkedHalFunctionTable(wifi_hal_fn* hal_fn) { - init_wifi_vendor_hal_func_table_t initfn; - - initfn = (init_wifi_vendor_hal_func_table_t)dlsym(RTLD_DEFAULT, - "init_wifi_vendor_hal_func_table"); - if (!initfn) { - LOG(INFO) << "no vendor HAL library linked, will try dynamic load"; - return false; - } - - if (!initHalFuncTableWithStubs(hal_fn)) { - LOG(ERROR) << "Can not initialize the basic function pointer table"; - return false; - } - - if (initfn(hal_fn) != WIFI_SUCCESS) { - LOG(ERROR) << "Can not initialize the vendor function pointer table"; - return false; - } - - return true; -} - -/* - * Overall structure of the HAL descriptor XML schema - * - * - * - * /vendor/lib64/libwifi-hal-qcom.so - * 1 - * - */ -void WifiLegacyHalFactory::initVendorHalsDescriptorList() { - xmlDocPtr xml; - xmlNodePtr node, cnode; - char* version; - std::string path; - xmlChar* value; - wifi_hal_lib_desc desc; - - LOG(INFO) << "processing vendor HALs descriptions in " << kVendorHalsDescPath; - DIR* dirPtr = ::opendir(kVendorHalsDescPath); - if (dirPtr == NULL) { - LOG(ERROR) << "failed to open " << kVendorHalsDescPath; - return; - } - for (struct dirent* entryPtr = ::readdir(dirPtr); entryPtr != NULL; - entryPtr = ::readdir(dirPtr)) { - if (isDirectory(entryPtr)) continue; - - if (!isFileExtension(entryPtr->d_name, kVendorHalsDescExt)) - continue; // only process .xml files - - LOG(INFO) << "processing config file: " << entryPtr->d_name; - - std::string fullPath(kVendorHalsDescPath); - fullPath.append("/"); - fullPath.append(entryPtr->d_name); - xml = xmlReadFile(fullPath.c_str(), "UTF-8", XML_PARSE_RECOVER); - if (!xml) { - LOG(ERROR) << "failed to parse: " << entryPtr->d_name << " skipping..."; - continue; - } - node = xmlDocGetRootElement(xml); - if (!node) { - LOG(ERROR) << "empty config file: " << entryPtr->d_name << " skipping..."; - goto skip; - } - if (xmlStrcmp(node->name, BAD_CAST "WifiVendorHal")) { - LOG(ERROR) << "bad config, root element not WifiVendorHal: " << entryPtr->d_name - << " skipping..."; - goto skip; - } - version = (char*)xmlGetProp(node, BAD_CAST "version"); - if (!version || strtoul(version, NULL, 0) != kVendorHalsDescVersion) { - LOG(ERROR) << "conf file: " << entryPtr->d_name - << "must have version: " << kVendorHalsDescVersion << ", skipping..."; - goto skip; - } - cnode = node->children; - path.clear(); - desc.primary = false; - while (cnode) { - if (!xmlStrcmp(cnode->name, BAD_CAST "path")) { - value = xmlNodeListGetString(xml, cnode->children, 1); - if (value) path = (char*)value; - xmlFree(value); - } else if (!xmlStrcmp(cnode->name, BAD_CAST "primary")) { - value = xmlNodeListGetString(xml, cnode->children, 1); - desc.primary = !xmlStrcmp(value, BAD_CAST "1"); - xmlFree(value); - } - cnode = cnode->next; - } - if (path.empty()) { - LOG(ERROR) << "hal library path not provided in: " << entryPtr->d_name - << ", skipping..."; - goto skip; - } - if (loadVendorHalLib(path, desc)) { - if (desc.primary) - descs_.insert(descs_.begin(), desc); - else - descs_.push_back(desc); - } - skip: - xmlFreeDoc(xml); - } - ::closedir(dirPtr); -} - -bool WifiLegacyHalFactory::loadVendorHalLib(const std::string& path, wifi_hal_lib_desc& desc) { - void* h = dlopen(path.c_str(), RTLD_NOW | RTLD_LOCAL); - init_wifi_vendor_hal_func_table_t initfn; - wifi_error res; - - if (!h) { - LOG(ERROR) << "failed to open vendor hal library: " << path; - return false; - } - initfn = (init_wifi_vendor_hal_func_table_t)dlsym(h, "init_wifi_vendor_hal_func_table"); - if (!initfn) { - LOG(ERROR) << "init_wifi_vendor_hal_func_table not found in: " << path; - goto out_err; - } - - if (!initHalFuncTableWithStubs(&desc.fn)) { - LOG(ERROR) << "Can not initialize the basic function pointer table"; - goto out_err; - } - res = initfn(&desc.fn); - if (res != WIFI_SUCCESS) { - LOG(ERROR) << "failed to initialize the vendor func table in: " << path - << " error: " << res; - goto out_err; - } - - res = desc.fn.wifi_early_initialize(); - // vendor HALs which do not implement early_initialize will return - // WIFI_ERROR_NOT_SUPPORTED, treat this as success. - if (res != WIFI_SUCCESS && res != WIFI_ERROR_NOT_SUPPORTED) { - LOG(ERROR) << "early initialization failed in: " << path << " error: " << res; - goto out_err; - } - - desc.handle = h; - return true; -out_err: - dlclose(h); - return false; -} - -} // namespace legacy_hal -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/wifi_legacy_hal_factory.h b/wifi/1.6/default/wifi_legacy_hal_factory.h deleted file mode 100644 index 9f4423efb7..0000000000 --- a/wifi/1.6/default/wifi_legacy_hal_factory.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2020 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. - */ - -#ifndef WIFI_LEGACY_HAL_FACTORY_H_ -#define WIFI_LEGACY_HAL_FACTORY_H_ - -#include - -#include "wifi_legacy_hal.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -// This is in a separate namespace to prevent typename conflicts between -// the legacy HAL types and the HIDL interface types. -namespace legacy_hal { -/** - * Class that creates WifiLegacyHal objects for vendor HALs in the system. - */ -class WifiLegacyHalFactory { - public: - WifiLegacyHalFactory(const std::weak_ptr iface_tool); - virtual ~WifiLegacyHalFactory() = default; - - std::vector> getHals(); - - private: - typedef struct { - wifi_hal_fn fn; - bool primary; - void* handle; - } wifi_hal_lib_desc; - - bool initVendorHalDescriptorFromLinked(); - void initVendorHalsDescriptorList(); - bool initLinkedHalFunctionTable(wifi_hal_fn* hal_fn); - bool loadVendorHalLib(const std::string& path, wifi_hal_lib_desc& desc); - - std::weak_ptr iface_tool_; - std::vector descs_; - std::vector> legacy_hals_; -}; - -} // namespace legacy_hal -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // WIFI_LEGACY_HAL_FACTORY_H_ diff --git a/wifi/1.6/default/wifi_legacy_hal_stubs.cpp b/wifi/1.6/default/wifi_legacy_hal_stubs.cpp deleted file mode 100644 index 8f8527a4cc..0000000000 --- a/wifi/1.6/default/wifi_legacy_hal_stubs.cpp +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#include "wifi_legacy_hal_stubs.h" - -// TODO: Remove these stubs from HalTool in libwifi-system. -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace legacy_hal { -template -struct stubFunction; - -template -struct stubFunction { - static constexpr R invoke(Args...) { return WIFI_ERROR_NOT_SUPPORTED; } -}; -template -struct stubFunction { - static constexpr void invoke(Args...) {} -}; - -template -void populateStubFor(T* val) { - *val = &stubFunction::invoke; -} - -bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { - if (hal_fn == nullptr) { - return false; - } - populateStubFor(&hal_fn->wifi_initialize); - populateStubFor(&hal_fn->wifi_wait_for_driver_ready); - populateStubFor(&hal_fn->wifi_cleanup); - populateStubFor(&hal_fn->wifi_event_loop); - populateStubFor(&hal_fn->wifi_get_error_info); - populateStubFor(&hal_fn->wifi_get_supported_feature_set); - populateStubFor(&hal_fn->wifi_get_concurrency_matrix); - populateStubFor(&hal_fn->wifi_set_scanning_mac_oui); - populateStubFor(&hal_fn->wifi_get_supported_channels); - populateStubFor(&hal_fn->wifi_is_epr_supported); - populateStubFor(&hal_fn->wifi_get_ifaces); - populateStubFor(&hal_fn->wifi_get_iface_name); - populateStubFor(&hal_fn->wifi_set_iface_event_handler); - populateStubFor(&hal_fn->wifi_reset_iface_event_handler); - populateStubFor(&hal_fn->wifi_start_gscan); - populateStubFor(&hal_fn->wifi_stop_gscan); - populateStubFor(&hal_fn->wifi_get_cached_gscan_results); - populateStubFor(&hal_fn->wifi_set_bssid_hotlist); - populateStubFor(&hal_fn->wifi_reset_bssid_hotlist); - populateStubFor(&hal_fn->wifi_set_significant_change_handler); - populateStubFor(&hal_fn->wifi_reset_significant_change_handler); - populateStubFor(&hal_fn->wifi_get_gscan_capabilities); - populateStubFor(&hal_fn->wifi_set_link_stats); - populateStubFor(&hal_fn->wifi_get_link_stats); - populateStubFor(&hal_fn->wifi_clear_link_stats); - populateStubFor(&hal_fn->wifi_get_valid_channels); - populateStubFor(&hal_fn->wifi_rtt_range_request); - populateStubFor(&hal_fn->wifi_rtt_range_cancel); - populateStubFor(&hal_fn->wifi_get_rtt_capabilities); - populateStubFor(&hal_fn->wifi_rtt_get_responder_info); - populateStubFor(&hal_fn->wifi_enable_responder); - populateStubFor(&hal_fn->wifi_disable_responder); - populateStubFor(&hal_fn->wifi_set_nodfs_flag); - populateStubFor(&hal_fn->wifi_start_logging); - populateStubFor(&hal_fn->wifi_set_epno_list); - populateStubFor(&hal_fn->wifi_reset_epno_list); - populateStubFor(&hal_fn->wifi_set_country_code); - populateStubFor(&hal_fn->wifi_get_firmware_memory_dump); - populateStubFor(&hal_fn->wifi_set_log_handler); - populateStubFor(&hal_fn->wifi_reset_log_handler); - populateStubFor(&hal_fn->wifi_set_alert_handler); - populateStubFor(&hal_fn->wifi_reset_alert_handler); - populateStubFor(&hal_fn->wifi_get_firmware_version); - populateStubFor(&hal_fn->wifi_get_ring_buffers_status); - populateStubFor(&hal_fn->wifi_get_logger_supported_feature_set); - populateStubFor(&hal_fn->wifi_get_ring_data); - populateStubFor(&hal_fn->wifi_enable_tdls); - populateStubFor(&hal_fn->wifi_disable_tdls); - populateStubFor(&hal_fn->wifi_get_tdls_status); - populateStubFor(&hal_fn->wifi_get_tdls_capabilities); - populateStubFor(&hal_fn->wifi_get_driver_version); - populateStubFor(&hal_fn->wifi_set_passpoint_list); - populateStubFor(&hal_fn->wifi_reset_passpoint_list); - populateStubFor(&hal_fn->wifi_set_lci); - populateStubFor(&hal_fn->wifi_set_lcr); - populateStubFor(&hal_fn->wifi_start_sending_offloaded_packet); - populateStubFor(&hal_fn->wifi_stop_sending_offloaded_packet); - populateStubFor(&hal_fn->wifi_start_rssi_monitoring); - populateStubFor(&hal_fn->wifi_stop_rssi_monitoring); - populateStubFor(&hal_fn->wifi_get_wake_reason_stats); - populateStubFor(&hal_fn->wifi_configure_nd_offload); - populateStubFor(&hal_fn->wifi_get_driver_memory_dump); - populateStubFor(&hal_fn->wifi_start_pkt_fate_monitoring); - populateStubFor(&hal_fn->wifi_get_tx_pkt_fates); - populateStubFor(&hal_fn->wifi_get_rx_pkt_fates); - populateStubFor(&hal_fn->wifi_nan_enable_request); - populateStubFor(&hal_fn->wifi_nan_disable_request); - populateStubFor(&hal_fn->wifi_nan_publish_request); - populateStubFor(&hal_fn->wifi_nan_publish_cancel_request); - populateStubFor(&hal_fn->wifi_nan_subscribe_request); - populateStubFor(&hal_fn->wifi_nan_subscribe_cancel_request); - populateStubFor(&hal_fn->wifi_nan_transmit_followup_request); - populateStubFor(&hal_fn->wifi_nan_stats_request); - populateStubFor(&hal_fn->wifi_nan_config_request); - populateStubFor(&hal_fn->wifi_nan_tca_request); - populateStubFor(&hal_fn->wifi_nan_beacon_sdf_payload_request); - populateStubFor(&hal_fn->wifi_nan_register_handler); - populateStubFor(&hal_fn->wifi_nan_get_version); - populateStubFor(&hal_fn->wifi_nan_get_capabilities); - populateStubFor(&hal_fn->wifi_nan_data_interface_create); - populateStubFor(&hal_fn->wifi_nan_data_interface_delete); - populateStubFor(&hal_fn->wifi_nan_data_request_initiator); - populateStubFor(&hal_fn->wifi_nan_data_indication_response); - populateStubFor(&hal_fn->wifi_nan_data_end); - populateStubFor(&hal_fn->wifi_get_packet_filter_capabilities); - populateStubFor(&hal_fn->wifi_set_packet_filter); - populateStubFor(&hal_fn->wifi_read_packet_filter); - populateStubFor(&hal_fn->wifi_get_roaming_capabilities); - populateStubFor(&hal_fn->wifi_enable_firmware_roaming); - populateStubFor(&hal_fn->wifi_configure_roaming); - populateStubFor(&hal_fn->wifi_select_tx_power_scenario); - populateStubFor(&hal_fn->wifi_reset_tx_power_scenario); - populateStubFor(&hal_fn->wifi_set_radio_mode_change_handler); - populateStubFor(&hal_fn->wifi_set_latency_mode); - populateStubFor(&hal_fn->wifi_set_thermal_mitigation_mode); - populateStubFor(&hal_fn->wifi_virtual_interface_create); - populateStubFor(&hal_fn->wifi_virtual_interface_delete); - populateStubFor(&hal_fn->wifi_map_dscp_access_category); - populateStubFor(&hal_fn->wifi_reset_dscp_mapping); - populateStubFor(&hal_fn->wifi_set_subsystem_restart_handler); - populateStubFor(&hal_fn->wifi_get_supported_iface_name); - populateStubFor(&hal_fn->wifi_early_initialize); - populateStubFor(&hal_fn->wifi_get_chip_feature_set); - populateStubFor(&hal_fn->wifi_multi_sta_set_primary_connection); - populateStubFor(&hal_fn->wifi_multi_sta_set_use_case); - populateStubFor(&hal_fn->wifi_set_coex_unsafe_channels); - populateStubFor(&hal_fn->wifi_set_voip_mode); - populateStubFor(&hal_fn->wifi_twt_register_handler); - populateStubFor(&hal_fn->wifi_twt_get_capability); - populateStubFor(&hal_fn->wifi_twt_setup_request); - populateStubFor(&hal_fn->wifi_twt_teardown_request); - populateStubFor(&hal_fn->wifi_twt_info_frame_request); - populateStubFor(&hal_fn->wifi_twt_get_stats); - populateStubFor(&hal_fn->wifi_twt_clear_stats); - populateStubFor(&hal_fn->wifi_set_dtim_config); - populateStubFor(&hal_fn->wifi_get_usable_channels); - populateStubFor(&hal_fn->wifi_trigger_subsystem_restart); - populateStubFor(&hal_fn->wifi_set_indoor_state); - populateStubFor(&hal_fn->wifi_get_supported_radio_combinations_matrix); - populateStubFor(&hal_fn->wifi_nan_rtt_chre_enable_request); - populateStubFor(&hal_fn->wifi_nan_rtt_chre_disable_request); - populateStubFor(&hal_fn->wifi_chre_register_handler); - populateStubFor(&hal_fn->wifi_enable_tx_power_limits); - populateStubFor(&hal_fn->wifi_get_cached_scan_results); - return true; -} -} // namespace legacy_hal -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/wifi_legacy_hal_stubs.h b/wifi/1.6/default/wifi_legacy_hal_stubs.h deleted file mode 100644 index ebc03479f1..0000000000 --- a/wifi/1.6/default/wifi_legacy_hal_stubs.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef WIFI_LEGACY_HAL_STUBS_H_ -#define WIFI_LEGACY_HAL_STUBS_H_ - -#include - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace legacy_hal { - -bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn); -} // namespace legacy_hal -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // WIFI_LEGACY_HAL_STUBS_H_ diff --git a/wifi/1.6/default/wifi_mode_controller.cpp b/wifi/1.6/default/wifi_mode_controller.cpp deleted file mode 100644 index 4b8ac7dd1c..0000000000 --- a/wifi/1.6/default/wifi_mode_controller.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#include -#include -#include - -#include "wifi_mode_controller.h" - -using android::hardware::wifi::V1_0::IfaceType; -using android::wifi_hal::DriverTool; - -namespace { -int convertIfaceTypeToFirmwareMode(IfaceType type) { - int mode; - switch (type) { - case IfaceType::AP: - mode = DriverTool::kFirmwareModeAp; - break; - case IfaceType::P2P: - mode = DriverTool::kFirmwareModeP2p; - break; - case IfaceType::NAN: - // NAN is exposed in STA mode currently. - mode = DriverTool::kFirmwareModeSta; - break; - case IfaceType::STA: - mode = DriverTool::kFirmwareModeSta; - break; - } - return mode; -} -} // namespace - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace mode_controller { - -WifiModeController::WifiModeController() : driver_tool_(new DriverTool) {} - -bool WifiModeController::isFirmwareModeChangeNeeded(IfaceType type) { - return driver_tool_->IsFirmwareModeChangeNeeded(convertIfaceTypeToFirmwareMode(type)); -} - -bool WifiModeController::initialize() { - if (!driver_tool_->LoadDriver()) { - LOG(ERROR) << "Failed to load WiFi driver"; - return false; - } - return true; -} - -bool WifiModeController::changeFirmwareMode(IfaceType type) { - if (!driver_tool_->ChangeFirmwareMode(convertIfaceTypeToFirmwareMode(type))) { - LOG(ERROR) << "Failed to change firmware mode"; - return false; - } - return true; -} - -bool WifiModeController::deinitialize() { - if (!driver_tool_->UnloadDriver()) { - LOG(ERROR) << "Failed to unload WiFi driver"; - return false; - } - return true; -} -} // namespace mode_controller -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/wifi_mode_controller.h b/wifi/1.6/default/wifi_mode_controller.h deleted file mode 100644 index fee2b66d4e..0000000000 --- a/wifi/1.6/default/wifi_mode_controller.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef WIFI_MODE_CONTROLLER_H_ -#define WIFI_MODE_CONTROLLER_H_ - -#include - -#include - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -namespace mode_controller { -using namespace android::hardware::wifi::V1_0; - -/** - * Class that encapsulates all firmware mode configuration. - * This class will perform the necessary firmware reloads to put the chip in the - * required state (essentially a wrapper over DriverTool). - */ -class WifiModeController { - public: - WifiModeController(); - virtual ~WifiModeController() = default; - - // Checks if a firmware mode change is necessary to support the specified - // iface type operations. - virtual bool isFirmwareModeChangeNeeded(IfaceType type); - virtual bool initialize(); - // Change the firmware mode to support the specified iface type operations. - virtual bool changeFirmwareMode(IfaceType type); - // Unload the driver. This should be invoked whenever |IWifi.stop()| is - // invoked. - virtual bool deinitialize(); - - private: - std::unique_ptr driver_tool_; -}; - -} // namespace mode_controller -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // WIFI_MODE_CONTROLLER_H_ diff --git a/wifi/1.6/default/wifi_nan_iface.cpp b/wifi/1.6/default/wifi_nan_iface.cpp deleted file mode 100644 index 4c61ba7ee5..0000000000 --- a/wifi/1.6/default/wifi_nan_iface.cpp +++ /dev/null @@ -1,1018 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#include - -#include "hidl_return_util.h" -#include "hidl_struct_util.h" -#include "wifi_nan_iface.h" -#include "wifi_status_util.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -using hidl_return_util::validateAndCall; - -WifiNanIface::WifiNanIface(const std::string& ifname, bool is_dedicated_iface, - const std::weak_ptr legacy_hal, - const std::weak_ptr iface_util) - : ifname_(ifname), - is_dedicated_iface_(is_dedicated_iface), - legacy_hal_(legacy_hal), - iface_util_(iface_util), - is_valid_(true) { - if (is_dedicated_iface_) { - // If using a dedicated iface, set the iface up first. - if (!iface_util_.lock()->setUpState(ifname_, true)) { - // Fatal failure, invalidate the iface object. - invalidate(); - return; - } - } - // Register all the callbacks here. these should be valid for the lifetime - // of the object. Whenever the mode changes legacy HAL will remove - // all of these callbacks. - legacy_hal::NanCallbackHandlers callback_handlers; - android::wp weak_ptr_this(this); - - // Callback for response. - callback_handlers.on_notify_response = [weak_ptr_this](legacy_hal::transaction_id id, - const legacy_hal::NanResponseMsg& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - WifiNanStatus wifiNanStatus; - if (!hidl_struct_util::convertLegacyNanResponseHeaderToHidl(msg, &wifiNanStatus)) { - LOG(ERROR) << "Failed to convert nan response header"; - return; - } - - switch (msg.response_type) { - case legacy_hal::NAN_RESPONSE_ENABLED: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyEnableResponse(id, wifiNanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_DISABLED: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyDisableResponse(id, wifiNanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_PUBLISH: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyStartPublishResponse(id, wifiNanStatus, - msg.body.publish_response.publish_id) - .isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_PUBLISH_CANCEL: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyStopPublishResponse(id, wifiNanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_TRANSMIT_FOLLOWUP: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyTransmitFollowupResponse(id, wifiNanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_SUBSCRIBE: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyStartSubscribeResponse( - id, wifiNanStatus, - msg.body.subscribe_response.subscribe_id) - .isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_SUBSCRIBE_CANCEL: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyStopSubscribeResponse(id, wifiNanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_CONFIG: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyConfigResponse(id, wifiNanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_GET_CAPABILITIES: { - V1_6::NanCapabilities hidl_struct; - if (!hidl_struct_util::convertLegacyNanCapabilitiesResponseToHidl( - msg.body.nan_capabilities, &hidl_struct)) { - LOG(ERROR) << "Failed to convert nan capabilities response"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks_1_6()) { - if (!callback->notifyCapabilitiesResponse_1_6(id, wifiNanStatus, hidl_struct) - .isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_DP_INTERFACE_CREATE: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyCreateDataInterfaceResponse(id, wifiNanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_DP_INTERFACE_DELETE: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyDeleteDataInterfaceResponse(id, wifiNanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_DP_INITIATOR_RESPONSE: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyInitiateDataPathResponse( - id, wifiNanStatus, - msg.body.data_request_response.ndp_instance_id) - .isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_DP_RESPONDER_RESPONSE: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyRespondToDataPathIndicationResponse(id, wifiNanStatus) - .isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_DP_END: { - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->notifyTerminateDataPathResponse(id, wifiNanStatus).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - break; - } - case legacy_hal::NAN_RESPONSE_BEACON_SDF_PAYLOAD: - /* fall through */ - case legacy_hal::NAN_RESPONSE_TCA: - /* fall through */ - case legacy_hal::NAN_RESPONSE_STATS: - /* fall through */ - case legacy_hal::NAN_RESPONSE_ERROR: - /* fall through */ - default: - LOG(ERROR) << "Unknown or unhandled response type: " << msg.response_type; - return; - } - }; - - callback_handlers.on_event_disc_eng_event = - [weak_ptr_this](const legacy_hal::NanDiscEngEventInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - NanClusterEventInd hidl_struct; - // event types defined identically - hence can be cast - hidl_struct.eventType = (NanClusterEventType)msg.event_type; - hidl_struct.addr = msg.data.mac_addr.addr; - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventClusterEvent(hidl_struct).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_disabled = [weak_ptr_this](const legacy_hal::NanDisabledInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - WifiNanStatus status; - hidl_struct_util::convertToWifiNanStatus(msg.reason, msg.nan_reason, sizeof(msg.nan_reason), - &status); - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventDisabled(status).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_publish_terminated = - [weak_ptr_this](const legacy_hal::NanPublishTerminatedInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - WifiNanStatus status; - hidl_struct_util::convertToWifiNanStatus(msg.reason, msg.nan_reason, - sizeof(msg.nan_reason), &status); - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventPublishTerminated(msg.publish_id, status).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_subscribe_terminated = - [weak_ptr_this](const legacy_hal::NanSubscribeTerminatedInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - WifiNanStatus status; - hidl_struct_util::convertToWifiNanStatus(msg.reason, msg.nan_reason, - sizeof(msg.nan_reason), &status); - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventSubscribeTerminated(msg.subscribe_id, status).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_match = [weak_ptr_this](const legacy_hal::NanMatchInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - V1_6::NanMatchInd hidl_struct; - if (!hidl_struct_util::convertLegacyNanMatchIndToHidl(msg, &hidl_struct)) { - LOG(ERROR) << "Failed to convert nan capabilities response"; - return; - } - - for (const auto& callback : shared_ptr_this->getEventCallbacks_1_6()) { - if (!callback->eventMatch_1_6(hidl_struct).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_match_expired = [weak_ptr_this]( - const legacy_hal::NanMatchExpiredInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventMatchExpired(msg.publish_subscribe_id, msg.requestor_instance_id) - .isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_followup = [weak_ptr_this](const legacy_hal::NanFollowupInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - NanFollowupReceivedInd hidl_struct; - if (!hidl_struct_util::convertLegacyNanFollowupIndToHidl(msg, &hidl_struct)) { - LOG(ERROR) << "Failed to convert nan capabilities response"; - return; - } - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventFollowupReceived(hidl_struct).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_transmit_follow_up = - [weak_ptr_this](const legacy_hal::NanTransmitFollowupInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - WifiNanStatus status; - hidl_struct_util::convertToWifiNanStatus(msg.reason, msg.nan_reason, - sizeof(msg.nan_reason), &status); - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventTransmitFollowup(msg.id, status).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_data_path_request = - [weak_ptr_this](const legacy_hal::NanDataPathRequestInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - NanDataPathRequestInd hidl_struct; - if (!hidl_struct_util::convertLegacyNanDataPathRequestIndToHidl(msg, - &hidl_struct)) { - LOG(ERROR) << "Failed to convert nan capabilities response"; - return; - } - - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventDataPathRequest(hidl_struct).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_data_path_confirm = - [weak_ptr_this](const legacy_hal::NanDataPathConfirmInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - V1_6::NanDataPathConfirmInd hidl_struct; - if (!hidl_struct_util::convertLegacyNanDataPathConfirmIndToHidl(msg, - &hidl_struct)) { - LOG(ERROR) << "Failed to convert nan capabilities response"; - return; - } - - for (const auto& callback : shared_ptr_this->getEventCallbacks_1_6()) { - if (!callback->eventDataPathConfirm_1_6(hidl_struct).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - callback_handlers.on_event_data_path_end = - [weak_ptr_this](const legacy_hal::NanDataPathEndInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - for (int i = 0; i < msg.num_ndp_instances; ++i) { - if (!callback->eventDataPathTerminated(msg.ndp_instance_id[i]).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - } - }; - - callback_handlers.on_event_beacon_sdf_payload = - [weak_ptr_this](const legacy_hal::NanBeaconSdfPayloadInd& /* msg */) { - LOG(ERROR) << "on_event_beacon_sdf_payload - should not be called"; - }; - - callback_handlers.on_event_range_request = - [weak_ptr_this](const legacy_hal::NanRangeRequestInd& /* msg */) { - LOG(ERROR) << "on_event_range_request - should not be called"; - }; - - callback_handlers.on_event_range_report = - [weak_ptr_this](const legacy_hal::NanRangeReportInd& /* msg */) { - LOG(ERROR) << "on_event_range_report - should not be called"; - }; - - callback_handlers.on_event_schedule_update = - [weak_ptr_this](const legacy_hal::NanDataPathScheduleUpdateInd& msg) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - V1_6::NanDataPathScheduleUpdateInd hidl_struct; - if (!hidl_struct_util::convertLegacyNanDataPathScheduleUpdateIndToHidl( - msg, &hidl_struct)) { - LOG(ERROR) << "Failed to convert nan capabilities response"; - return; - } - - for (const auto& callback : shared_ptr_this->getEventCallbacks_1_6()) { - if (!callback->eventDataPathScheduleUpdate_1_6(hidl_struct).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanRegisterCallbackHandlers(ifname_, callback_handlers); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - LOG(ERROR) << "Failed to register nan callbacks. Invalidating object"; - invalidate(); - } - - // Register for iface state toggle events. - iface_util::IfaceEventHandlers event_handlers = {}; -#ifndef WIFI_SKIP_STATE_TOGGLE_OFF_ON_FOR_NAN - event_handlers.on_state_toggle_off_on = [weak_ptr_this](const std::string& /* iface_name */) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - // Tell framework that NAN has been disabled. - WifiNanStatus status = {NanStatusType::UNSUPPORTED_CONCURRENCY_NAN_DISABLED, ""}; - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->eventDisabled(status).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; -#endif - iface_util_.lock()->registerIfaceEventHandlers(ifname_, event_handlers); -} - -void WifiNanIface::invalidate() { - if (!isValid()) { - return; - } - // send commands to HAL to actually disable and destroy interfaces - legacy_hal_.lock()->nanDisableRequest(ifname_, 0xFFFF); - legacy_hal_.lock()->nanDataInterfaceDelete(ifname_, 0xFFFE, "aware_data0"); - legacy_hal_.lock()->nanDataInterfaceDelete(ifname_, 0xFFFD, "aware_data1"); - iface_util_.lock()->unregisterIfaceEventHandlers(ifname_); - legacy_hal_.reset(); - event_cb_handler_.invalidate(); - event_cb_handler_1_2_.invalidate(); - event_cb_handler_1_5_.invalidate(); - is_valid_ = false; - if (is_dedicated_iface_) { - // If using a dedicated iface, set the iface down. - iface_util_.lock()->setUpState(ifname_, false); - } -} - -bool WifiNanIface::isValid() { - return is_valid_; -} - -std::string WifiNanIface::getName() { - return ifname_; -} - -std::set> WifiNanIface::getEventCallbacks() { - return event_cb_handler_.getCallbacks(); -} - -std::set> WifiNanIface::getEventCallbacks_1_2() { - return event_cb_handler_1_2_.getCallbacks(); -} - -std::set> WifiNanIface::getEventCallbacks_1_5() { - return event_cb_handler_1_5_.getCallbacks(); -} - -std::set> WifiNanIface::getEventCallbacks_1_6() { - return event_cb_handler_1_6_.getCallbacks(); -} - -Return WifiNanIface::getName(getName_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::getNameInternal, hidl_status_cb); -} - -Return WifiNanIface::getType(getType_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::getTypeInternal, hidl_status_cb); -} - -Return WifiNanIface::registerEventCallback( - const sp& callback, - registerEventCallback_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::registerEventCallbackInternal, hidl_status_cb, callback); -} - -Return WifiNanIface::getCapabilitiesRequest(uint16_t cmd_id, - getCapabilitiesRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::getCapabilitiesRequestInternal, hidl_status_cb, cmd_id); -} - -Return WifiNanIface::enableRequest(uint16_t cmd_id, const V1_0::NanEnableRequest& msg, - enableRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::enableRequestInternal, hidl_status_cb, cmd_id, msg); -} - -Return WifiNanIface::configRequest(uint16_t cmd_id, const V1_0::NanConfigRequest& msg, - configRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::configRequestInternal, hidl_status_cb, cmd_id, msg); -} - -Return WifiNanIface::disableRequest(uint16_t cmd_id, disableRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::disableRequestInternal, hidl_status_cb, cmd_id); -} - -Return WifiNanIface::startPublishRequest(uint16_t cmd_id, const V1_0::NanPublishRequest& msg, - startPublishRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::startPublishRequestInternal, hidl_status_cb, cmd_id, msg); -} - -Return WifiNanIface::stopPublishRequest(uint16_t cmd_id, uint8_t sessionId, - stopPublishRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::stopPublishRequestInternal, hidl_status_cb, cmd_id, - sessionId); -} - -Return WifiNanIface::startSubscribeRequest(uint16_t cmd_id, - const V1_0::NanSubscribeRequest& msg, - startSubscribeRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::startSubscribeRequestInternal, hidl_status_cb, cmd_id, - msg); -} - -Return WifiNanIface::stopSubscribeRequest(uint16_t cmd_id, uint8_t sessionId, - stopSubscribeRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::stopSubscribeRequestInternal, hidl_status_cb, cmd_id, - sessionId); -} - -Return WifiNanIface::transmitFollowupRequest(uint16_t cmd_id, - const NanTransmitFollowupRequest& msg, - transmitFollowupRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::transmitFollowupRequestInternal, hidl_status_cb, cmd_id, - msg); -} - -Return WifiNanIface::createDataInterfaceRequest( - uint16_t cmd_id, const hidl_string& iface_name, - createDataInterfaceRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::createDataInterfaceRequestInternal, hidl_status_cb, - cmd_id, iface_name); -} - -Return WifiNanIface::deleteDataInterfaceRequest( - uint16_t cmd_id, const hidl_string& iface_name, - deleteDataInterfaceRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::deleteDataInterfaceRequestInternal, hidl_status_cb, - cmd_id, iface_name); -} - -Return WifiNanIface::initiateDataPathRequest(uint16_t cmd_id, - const V1_0::NanInitiateDataPathRequest& msg, - initiateDataPathRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::initiateDataPathRequestInternal, hidl_status_cb, cmd_id, - msg); -} - -Return WifiNanIface::respondToDataPathIndicationRequest( - uint16_t cmd_id, const V1_0::NanRespondToDataPathIndicationRequest& msg, - respondToDataPathIndicationRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::respondToDataPathIndicationRequestInternal, - hidl_status_cb, cmd_id, msg); -} - -Return WifiNanIface::terminateDataPathRequest(uint16_t cmd_id, uint32_t ndpInstanceId, - terminateDataPathRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::terminateDataPathRequestInternal, hidl_status_cb, cmd_id, - ndpInstanceId); -} - -Return WifiNanIface::registerEventCallback_1_2( - const sp& callback, - registerEventCallback_1_2_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::registerEventCallback_1_2Internal, hidl_status_cb, - callback); -} - -Return WifiNanIface::enableRequest_1_2(uint16_t cmd_id, const V1_0::NanEnableRequest& msg1, - const V1_2::NanConfigRequestSupplemental& msg2, - enableRequest_1_2_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::enableRequest_1_2Internal, hidl_status_cb, cmd_id, msg1, - msg2); -} - -Return WifiNanIface::configRequest_1_2(uint16_t cmd_id, const V1_0::NanConfigRequest& msg1, - const V1_2::NanConfigRequestSupplemental& msg2, - configRequest_1_2_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::configRequest_1_2Internal, hidl_status_cb, cmd_id, msg1, - msg2); -} - -Return WifiNanIface::enableRequest_1_4(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, - const V1_2::NanConfigRequestSupplemental& msg2, - enableRequest_1_4_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::enableRequest_1_4Internal, hidl_status_cb, cmd_id, msg1, - msg2); -} - -Return WifiNanIface::configRequest_1_4(uint16_t cmd_id, const V1_4::NanConfigRequest& msg1, - const V1_2::NanConfigRequestSupplemental& msg2, - configRequest_1_4_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::configRequest_1_4Internal, hidl_status_cb, cmd_id, msg1, - msg2); -} - -Return WifiNanIface::registerEventCallback_1_5( - const sp& callback, - registerEventCallback_1_5_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::registerEventCallback_1_5Internal, hidl_status_cb, - callback); -} - -Return WifiNanIface::enableRequest_1_5(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, - const V1_5::NanConfigRequestSupplemental& msg2, - enableRequest_1_5_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::enableRequest_1_5Internal, hidl_status_cb, cmd_id, msg1, - msg2); -} - -Return WifiNanIface::configRequest_1_5(uint16_t cmd_id, const V1_4::NanConfigRequest& msg1, - const V1_5::NanConfigRequestSupplemental& msg2, - configRequest_1_5_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::configRequest_1_5Internal, hidl_status_cb, cmd_id, msg1, - msg2); -} - -Return WifiNanIface::getCapabilitiesRequest_1_5( - uint16_t cmd_id, getCapabilitiesRequest_1_5_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::getCapabilitiesRequest_1_5Internal, hidl_status_cb, - cmd_id); -} - -Return WifiNanIface::enableRequest_1_6(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, - const V1_6::NanConfigRequestSupplemental& msg2, - enableRequest_1_5_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::enableRequest_1_6Internal, hidl_status_cb, cmd_id, msg1, - msg2); -} - -Return WifiNanIface::configRequest_1_6(uint16_t cmd_id, const V1_4::NanConfigRequest& msg1, - const V1_6::NanConfigRequestSupplemental& msg2, - configRequest_1_5_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::configRequest_1_6Internal, hidl_status_cb, cmd_id, msg1, - msg2); -} - -Return WifiNanIface::initiateDataPathRequest_1_6(uint16_t cmd_id, - const V1_6::NanInitiateDataPathRequest& msg, - initiateDataPathRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::initiateDataPathRequest_1_6Internal, hidl_status_cb, - cmd_id, msg); -} - -Return WifiNanIface::respondToDataPathIndicationRequest_1_6( - uint16_t cmd_id, const V1_6::NanRespondToDataPathIndicationRequest& msg, - respondToDataPathIndicationRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::respondToDataPathIndicationRequest_1_6Internal, - hidl_status_cb, cmd_id, msg); -} - -Return WifiNanIface::startPublishRequest_1_6(uint16_t cmd_id, - const V1_6::NanPublishRequest& msg, - startPublishRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::startPublishRequest_1_6Internal, hidl_status_cb, cmd_id, - msg); -} - -std::pair WifiNanIface::getNameInternal() { - return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_}; -} - -std::pair WifiNanIface::getTypeInternal() { - return {createWifiStatus(WifiStatusCode::SUCCESS), IfaceType::NAN}; -} - -Return WifiNanIface::registerEventCallback_1_6( - const sp& callback, - registerEventCallback_1_6_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiNanIface::registerEventCallback_1_6Internal, hidl_status_cb, - callback); -} - -WifiStatus WifiNanIface::registerEventCallbackInternal( - const sp& callback) { - if (!event_cb_handler_.addCallback(callback)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -WifiStatus WifiNanIface::getCapabilitiesRequestInternal(uint16_t /* cmd_id */) { - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiNanIface::enableRequestInternal(uint16_t /* cmd_id */, - const V1_0::NanEnableRequest& /* msg */) { - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiNanIface::configRequestInternal(uint16_t /* cmd_id */, - const V1_0::NanConfigRequest& /* msg */) { - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiNanIface::disableRequestInternal(uint16_t cmd_id) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->nanDisableRequest(ifname_, cmd_id); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::startPublishRequestInternal(uint16_t /* cmd_id */, - const V1_0::NanPublishRequest& /* msg */) { - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiNanIface::stopPublishRequestInternal(uint16_t cmd_id, uint8_t sessionId) { - legacy_hal::NanPublishCancelRequest legacy_msg; - legacy_msg.publish_id = sessionId; - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanPublishCancelRequest(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::startSubscribeRequestInternal(uint16_t cmd_id, - const V1_0::NanSubscribeRequest& msg) { - legacy_hal::NanSubscribeRequest legacy_msg; - if (!hidl_struct_util::convertHidlNanSubscribeRequestToLegacy(msg, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanSubscribeRequest(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::stopSubscribeRequestInternal(uint16_t cmd_id, uint8_t sessionId) { - legacy_hal::NanSubscribeCancelRequest legacy_msg; - legacy_msg.subscribe_id = sessionId; - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanSubscribeCancelRequest(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::transmitFollowupRequestInternal(uint16_t cmd_id, - const NanTransmitFollowupRequest& msg) { - legacy_hal::NanTransmitFollowupRequest legacy_msg; - if (!hidl_struct_util::convertHidlNanTransmitFollowupRequestToLegacy(msg, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanTransmitFollowupRequest(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::createDataInterfaceRequestInternal(uint16_t cmd_id, - const std::string& iface_name) { - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanDataInterfaceCreate(ifname_, cmd_id, iface_name); - return createWifiStatusFromLegacyError(legacy_status); -} -WifiStatus WifiNanIface::deleteDataInterfaceRequestInternal(uint16_t cmd_id, - const std::string& iface_name) { - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanDataInterfaceDelete(ifname_, cmd_id, iface_name); - return createWifiStatusFromLegacyError(legacy_status); -} -WifiStatus WifiNanIface::initiateDataPathRequestInternal( - uint16_t cmd_id, const V1_0::NanInitiateDataPathRequest& msg) { - legacy_hal::NanDataPathInitiatorRequest legacy_msg; - if (!hidl_struct_util::convertHidlNanDataPathInitiatorRequestToLegacy(msg, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanDataRequestInitiator(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} -WifiStatus WifiNanIface::respondToDataPathIndicationRequestInternal( - uint16_t cmd_id, const V1_0::NanRespondToDataPathIndicationRequest& msg) { - legacy_hal::NanDataPathIndicationResponse legacy_msg; - if (!hidl_struct_util::convertHidlNanDataPathIndicationResponseToLegacy(msg, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanDataIndicationResponse(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} -WifiStatus WifiNanIface::terminateDataPathRequestInternal(uint16_t cmd_id, uint32_t ndpInstanceId) { - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanDataEnd(ifname_, cmd_id, ndpInstanceId); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::registerEventCallback_1_2Internal( - const sp& callback) { - sp callback_1_0 = callback; - if (!event_cb_handler_.addCallback(callback_1_0)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - if (!event_cb_handler_1_2_.addCallback(callback)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -WifiStatus WifiNanIface::enableRequest_1_2Internal( - uint16_t /* cmd_id */, const V1_0::NanEnableRequest& /* msg1 */, - const V1_2::NanConfigRequestSupplemental& /* msg2 */) { - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiNanIface::configRequest_1_2Internal( - uint16_t /* cmd_id */, const V1_0::NanConfigRequest& /* msg1 */, - const V1_2::NanConfigRequestSupplemental& /* msg2 */) { - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiNanIface::enableRequest_1_4Internal( - uint16_t /* cmd_id */, const V1_4::NanEnableRequest& /* msg1 */, - const V1_2::NanConfigRequestSupplemental& /* msg2 */) { - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiNanIface::configRequest_1_4Internal( - uint16_t /* cmd_id */, const V1_4::NanConfigRequest& /* msg1 */, - const V1_2::NanConfigRequestSupplemental& /* msg2 */) { - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiNanIface::registerEventCallback_1_5Internal( - const sp& callback) { - sp callback_1_0 = callback; - if (!event_cb_handler_.addCallback(callback_1_0)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - sp callback_1_2 = callback; - if (!event_cb_handler_1_2_.addCallback(callback_1_2)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - if (!event_cb_handler_1_5_.addCallback(callback)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -WifiStatus WifiNanIface::getCapabilitiesRequest_1_5Internal(uint16_t cmd_id) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->nanGetCapabilities(ifname_, cmd_id); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::enableRequest_1_5Internal( - uint16_t /* cmd_id */, const V1_4::NanEnableRequest& /* msg1 */, - const V1_5::NanConfigRequestSupplemental& /* msg2 */) { - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiNanIface::configRequest_1_5Internal( - uint16_t /* cmd_id */, const V1_4::NanConfigRequest& /* msg1 */, - const V1_5::NanConfigRequestSupplemental& /* msg2 */) { - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiNanIface::enableRequest_1_6Internal(uint16_t cmd_id, - const V1_4::NanEnableRequest& msg1, - const V1_6::NanConfigRequestSupplemental& msg2) { - legacy_hal::NanEnableRequest legacy_msg; - if (!hidl_struct_util::convertHidlNanEnableRequest_1_6ToLegacy(msg1, msg2, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanEnableRequest(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::configRequest_1_6Internal(uint16_t cmd_id, - const V1_4::NanConfigRequest& msg1, - const V1_6::NanConfigRequestSupplemental& msg2) { - legacy_hal::NanConfigRequest legacy_msg; - if (!hidl_struct_util::convertHidlNanConfigRequest_1_6ToLegacy(msg1, msg2, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanConfigRequest(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::initiateDataPathRequest_1_6Internal( - uint16_t cmd_id, const V1_6::NanInitiateDataPathRequest& msg) { - legacy_hal::NanDataPathInitiatorRequest legacy_msg; - if (!hidl_struct_util::convertHidlNanDataPathInitiatorRequest_1_6ToLegacy(msg, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanDataRequestInitiator(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::respondToDataPathIndicationRequest_1_6Internal( - uint16_t cmd_id, const V1_6::NanRespondToDataPathIndicationRequest& msg) { - legacy_hal::NanDataPathIndicationResponse legacy_msg; - if (!hidl_struct_util::convertHidlNanDataPathIndicationResponse_1_6ToLegacy(msg, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanDataIndicationResponse(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::startPublishRequest_1_6Internal(uint16_t cmd_id, - const V1_6::NanPublishRequest& msg) { - legacy_hal::NanPublishRequest legacy_msg; - if (!hidl_struct_util::convertHidlNanPublishRequestToLegacy(msg, &legacy_msg)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->nanPublishRequest(ifname_, cmd_id, legacy_msg); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiNanIface::registerEventCallback_1_6Internal( - const sp& callback) { - sp callback_1_0 = callback; - if (!event_cb_handler_.addCallback(callback_1_0)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - sp callback_1_2 = callback; - if (!event_cb_handler_1_2_.addCallback(callback_1_2)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - sp callback_1_5 = callback; - if (!event_cb_handler_1_5_.addCallback(callback_1_5)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - if (!event_cb_handler_1_6_.addCallback(callback)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - return createWifiStatus(WifiStatusCode::SUCCESS); -} -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/wifi_nan_iface.h b/wifi/1.6/default/wifi_nan_iface.h deleted file mode 100644 index 15bf57298c..0000000000 --- a/wifi/1.6/default/wifi_nan_iface.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef WIFI_NAN_IFACE_H_ -#define WIFI_NAN_IFACE_H_ - -#include -#include -#include - -#include "hidl_callback_util.h" -#include "wifi_iface_util.h" -#include "wifi_legacy_hal.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -using namespace android::hardware::wifi::V1_0; -using namespace android::hardware::wifi::V1_2; -using namespace android::hardware::wifi::V1_4; -using namespace android::hardware::wifi::V1_6; - -/** - * HIDL interface object used to control a NAN Iface instance. - */ -class WifiNanIface : public V1_6::IWifiNanIface { - public: - WifiNanIface(const std::string& ifname, bool is_dedicated_iface, - const std::weak_ptr legacy_hal, - const std::weak_ptr iface_util); - // Refer to |WifiChip::invalidate()|. - void invalidate(); - bool isValid(); - std::string getName(); - - // HIDL methods exposed. - Return getName(getName_cb hidl_status_cb) override; - Return getType(getType_cb hidl_status_cb) override; - Return registerEventCallback(const sp& callback, - registerEventCallback_cb hidl_status_cb) override; - Return getCapabilitiesRequest(uint16_t cmd_id, - getCapabilitiesRequest_cb hidl_status_cb) override; - Return enableRequest(uint16_t cmd_id, const V1_0::NanEnableRequest& msg, - enableRequest_cb hidl_status_cb) override; - Return configRequest(uint16_t cmd_id, const V1_0::NanConfigRequest& msg, - configRequest_cb hidl_status_cb) override; - Return disableRequest(uint16_t cmd_id, disableRequest_cb hidl_status_cb) override; - Return startPublishRequest(uint16_t cmd_id, const V1_0::NanPublishRequest& msg, - startPublishRequest_cb hidl_status_cb) override; - Return stopPublishRequest(uint16_t cmd_id, uint8_t sessionId, - stopPublishRequest_cb hidl_status_cb) override; - Return startSubscribeRequest(uint16_t cmd_id, const V1_0::NanSubscribeRequest& msg, - startSubscribeRequest_cb hidl_status_cb) override; - Return stopSubscribeRequest(uint16_t cmd_id, uint8_t sessionId, - stopSubscribeRequest_cb hidl_status_cb) override; - Return transmitFollowupRequest(uint16_t cmd_id, const NanTransmitFollowupRequest& msg, - transmitFollowupRequest_cb hidl_status_cb) override; - Return createDataInterfaceRequest(uint16_t cmd_id, const hidl_string& iface_name, - createDataInterfaceRequest_cb hidl_status_cb) override; - Return deleteDataInterfaceRequest(uint16_t cmd_id, const hidl_string& iface_name, - deleteDataInterfaceRequest_cb hidl_status_cb) override; - Return initiateDataPathRequest(uint16_t cmd_id, - const V1_0::NanInitiateDataPathRequest& msg, - initiateDataPathRequest_cb hidl_status_cb) override; - Return respondToDataPathIndicationRequest( - uint16_t cmd_id, const V1_0::NanRespondToDataPathIndicationRequest& msg, - respondToDataPathIndicationRequest_cb hidl_status_cb) override; - Return terminateDataPathRequest(uint16_t cmd_id, uint32_t ndpInstanceId, - terminateDataPathRequest_cb hidl_status_cb) override; - - Return registerEventCallback_1_2(const sp& callback, - registerEventCallback_1_2_cb hidl_status_cb) override; - Return enableRequest_1_2(uint16_t cmd_id, const V1_0::NanEnableRequest& msg1, - const V1_2::NanConfigRequestSupplemental& msg2, - enableRequest_1_2_cb hidl_status_cb) override; - Return configRequest_1_2(uint16_t cmd_id, const V1_0::NanConfigRequest& msg1, - const V1_2::NanConfigRequestSupplemental& msg2, - configRequest_1_2_cb hidl_status_cb) override; - Return enableRequest_1_4(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, - const V1_2::NanConfigRequestSupplemental& msg2, - enableRequest_1_4_cb hidl_status_cb) override; - Return configRequest_1_4(uint16_t cmd_id, const V1_4::NanConfigRequest& msg1, - const V1_2::NanConfigRequestSupplemental& msg2, - configRequest_1_4_cb hidl_status_cb) override; - Return registerEventCallback_1_5(const sp& callback, - registerEventCallback_1_5_cb hidl_status_cb) override; - Return enableRequest_1_5(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, - const V1_5::NanConfigRequestSupplemental& msg2, - enableRequest_1_5_cb hidl_status_cb) override; - Return configRequest_1_5(uint16_t cmd_id, const V1_4::NanConfigRequest& msg1, - const V1_5::NanConfigRequestSupplemental& msg2, - configRequest_1_5_cb hidl_status_cb) override; - Return getCapabilitiesRequest_1_5(uint16_t cmd_id, - getCapabilitiesRequest_cb hidl_status_cb) override; - Return registerEventCallback_1_6(const sp& callback, - registerEventCallback_1_6_cb hidl_status_cb) override; - Return initiateDataPathRequest_1_6( - uint16_t cmd_id, const V1_6::NanInitiateDataPathRequest& msg, - initiateDataPathRequest_1_6_cb hidl_status_cb) override; - Return respondToDataPathIndicationRequest_1_6( - uint16_t cmd_id, const V1_6::NanRespondToDataPathIndicationRequest& msg, - respondToDataPathIndicationRequest_1_6_cb hidl_status_cb) override; - Return enableRequest_1_6(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, - const V1_6::NanConfigRequestSupplemental& msg2, - enableRequest_1_6_cb hidl_status_cb) override; - Return configRequest_1_6(uint16_t cmd_id, const V1_4::NanConfigRequest& msg1, - const V1_6::NanConfigRequestSupplemental& msg2, - configRequest_1_6_cb hidl_status_cb) override; - Return startPublishRequest_1_6(uint16_t cmd_id, const V1_6::NanPublishRequest& msg, - startPublishRequest_cb hidl_status_cb) override; - - private: - // Corresponding worker functions for the HIDL methods. - std::pair getNameInternal(); - std::pair getTypeInternal(); - WifiStatus registerEventCallbackInternal(const sp& callback); - WifiStatus getCapabilitiesRequestInternal(uint16_t cmd_id); - WifiStatus enableRequestInternal(uint16_t cmd_id, const V1_0::NanEnableRequest& msg); - WifiStatus configRequestInternal(uint16_t cmd_id, const V1_0::NanConfigRequest& msg); - WifiStatus disableRequestInternal(uint16_t cmd_id); - WifiStatus startPublishRequestInternal(uint16_t cmd_id, const V1_0::NanPublishRequest& msg); - WifiStatus stopPublishRequestInternal(uint16_t cmd_id, uint8_t sessionId); - WifiStatus startSubscribeRequestInternal(uint16_t cmd_id, const V1_0::NanSubscribeRequest& msg); - WifiStatus stopSubscribeRequestInternal(uint16_t cmd_id, uint8_t sessionId); - WifiStatus transmitFollowupRequestInternal(uint16_t cmd_id, - const NanTransmitFollowupRequest& msg); - WifiStatus createDataInterfaceRequestInternal(uint16_t cmd_id, const std::string& iface_name); - WifiStatus deleteDataInterfaceRequestInternal(uint16_t cmd_id, const std::string& iface_name); - WifiStatus initiateDataPathRequestInternal(uint16_t cmd_id, - const V1_0::NanInitiateDataPathRequest& msg); - WifiStatus respondToDataPathIndicationRequestInternal( - uint16_t cmd_id, const V1_0::NanRespondToDataPathIndicationRequest& msg); - WifiStatus terminateDataPathRequestInternal(uint16_t cmd_id, uint32_t ndpInstanceId); - - WifiStatus registerEventCallback_1_2Internal( - const sp& callback); - WifiStatus enableRequest_1_2Internal(uint16_t cmd_id, const V1_0::NanEnableRequest& msg1, - const V1_2::NanConfigRequestSupplemental& msg2); - WifiStatus configRequest_1_2Internal(uint16_t cmd_id, const V1_0::NanConfigRequest& msg, - const V1_2::NanConfigRequestSupplemental& msg2); - WifiStatus enableRequest_1_4Internal(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, - const V1_2::NanConfigRequestSupplemental& msg2); - WifiStatus configRequest_1_4Internal(uint16_t cmd_id, const V1_4::NanConfigRequest& msg, - const V1_2::NanConfigRequestSupplemental& msg2); - WifiStatus registerEventCallback_1_5Internal( - const sp& callback); - WifiStatus enableRequest_1_5Internal(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, - const V1_5::NanConfigRequestSupplemental& msg2); - WifiStatus configRequest_1_5Internal(uint16_t cmd_id, const V1_4::NanConfigRequest& msg, - const V1_5::NanConfigRequestSupplemental& msg2); - WifiStatus getCapabilitiesRequest_1_5Internal(uint16_t cmd_id); - WifiStatus registerEventCallback_1_6Internal( - const sp& callback); - - WifiStatus enableRequest_1_6Internal(uint16_t cmd_id, const V1_4::NanEnableRequest& msg1, - const V1_6::NanConfigRequestSupplemental& msg2); - WifiStatus configRequest_1_6Internal(uint16_t cmd_id, const V1_4::NanConfigRequest& msg, - const V1_6::NanConfigRequestSupplemental& msg2); - WifiStatus startPublishRequest_1_6Internal(uint16_t cmd_id, const V1_6::NanPublishRequest& msg); - WifiStatus initiateDataPathRequest_1_6Internal(uint16_t cmd_id, - const V1_6::NanInitiateDataPathRequest& msg); - WifiStatus respondToDataPathIndicationRequest_1_6Internal( - uint16_t cmd_id, const V1_6::NanRespondToDataPathIndicationRequest& msg); - - // all 1_0 and descendant callbacks - std::set> getEventCallbacks(); - // all 1_2 and descendant callbacks - std::set> getEventCallbacks_1_2(); - // all 1_5 and descendant callbacks - std::set> getEventCallbacks_1_5(); - // all 1_6 and descendant callbacks - std::set> getEventCallbacks_1_6(); - - std::string ifname_; - bool is_dedicated_iface_; - std::weak_ptr legacy_hal_; - std::weak_ptr iface_util_; - bool is_valid_; - hidl_callback_util::HidlCallbackHandler event_cb_handler_; - hidl_callback_util::HidlCallbackHandler event_cb_handler_1_2_; - hidl_callback_util::HidlCallbackHandler event_cb_handler_1_5_; - hidl_callback_util::HidlCallbackHandler event_cb_handler_1_6_; - - DISALLOW_COPY_AND_ASSIGN(WifiNanIface); -}; - -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // WIFI_NAN_IFACE_H_ diff --git a/wifi/1.6/default/wifi_p2p_iface.cpp b/wifi/1.6/default/wifi_p2p_iface.cpp deleted file mode 100644 index d4b1fcabf1..0000000000 --- a/wifi/1.6/default/wifi_p2p_iface.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#include - -#include "hidl_return_util.h" -#include "wifi_p2p_iface.h" -#include "wifi_status_util.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -using hidl_return_util::validateAndCall; - -WifiP2pIface::WifiP2pIface(const std::string& ifname, - const std::weak_ptr legacy_hal) - : ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {} - -void WifiP2pIface::invalidate() { - legacy_hal_.reset(); - is_valid_ = false; -} - -bool WifiP2pIface::isValid() { - return is_valid_; -} - -std::string WifiP2pIface::getName() { - return ifname_; -} - -Return WifiP2pIface::getName(getName_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiP2pIface::getNameInternal, hidl_status_cb); -} - -Return WifiP2pIface::getType(getType_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiP2pIface::getTypeInternal, hidl_status_cb); -} - -std::pair WifiP2pIface::getNameInternal() { - return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_}; -} - -std::pair WifiP2pIface::getTypeInternal() { - return {createWifiStatus(WifiStatusCode::SUCCESS), IfaceType::P2P}; -} - -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/wifi_p2p_iface.h b/wifi/1.6/default/wifi_p2p_iface.h deleted file mode 100644 index 00894437cf..0000000000 --- a/wifi/1.6/default/wifi_p2p_iface.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef WIFI_P2P_IFACE_H_ -#define WIFI_P2P_IFACE_H_ - -#include -#include - -#include "wifi_legacy_hal.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -using namespace android::hardware::wifi::V1_0; - -/** - * HIDL interface object used to control a P2P Iface instance. - */ -class WifiP2pIface : public V1_0::IWifiP2pIface { - public: - WifiP2pIface(const std::string& ifname, - const std::weak_ptr legacy_hal); - // Refer to |WifiChip::invalidate()|. - void invalidate(); - bool isValid(); - std::string getName(); - - // HIDL methods exposed. - Return getName(getName_cb hidl_status_cb) override; - Return getType(getType_cb hidl_status_cb) override; - - private: - // Corresponding worker functions for the HIDL methods. - std::pair getNameInternal(); - std::pair getTypeInternal(); - - std::string ifname_; - std::weak_ptr legacy_hal_; - bool is_valid_; - - DISALLOW_COPY_AND_ASSIGN(WifiP2pIface); -}; - -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // WIFI_P2P_IFACE_H_ diff --git a/wifi/1.6/default/wifi_rtt_controller.cpp b/wifi/1.6/default/wifi_rtt_controller.cpp deleted file mode 100644 index aa9ee2f520..0000000000 --- a/wifi/1.6/default/wifi_rtt_controller.cpp +++ /dev/null @@ -1,377 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#include - -#include "hidl_return_util.h" -#include "hidl_struct_util.h" -#include "wifi_rtt_controller.h" -#include "wifi_status_util.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -using hidl_return_util::validateAndCall; - -WifiRttController::WifiRttController(const std::string& iface_name, - const sp& bound_iface, - const std::weak_ptr legacy_hal) - : ifname_(iface_name), bound_iface_(bound_iface), legacy_hal_(legacy_hal), is_valid_(true) {} - -void WifiRttController::invalidate() { - legacy_hal_.reset(); - event_callbacks_.clear(); - is_valid_ = false; -} - -bool WifiRttController::isValid() { - return is_valid_; -} - -std::vector> WifiRttController::getEventCallbacks() { - return event_callbacks_; -} - -std::string WifiRttController::getIfaceName() { - return ifname_; -} - -Return WifiRttController::getBoundIface(getBoundIface_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::getBoundIfaceInternal, hidl_status_cb); -} - -Return WifiRttController::registerEventCallback( - const sp& callback, - registerEventCallback_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::registerEventCallbackInternal, hidl_status_cb, - callback); -} - -Return WifiRttController::rangeRequest(uint32_t cmd_id, - const hidl_vec& rtt_configs, - rangeRequest_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::rangeRequestInternal, hidl_status_cb, cmd_id, - rtt_configs); -} - -Return WifiRttController::rangeCancel(uint32_t cmd_id, - const hidl_vec>& addrs, - rangeCancel_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::rangeCancelInternal, hidl_status_cb, cmd_id, addrs); -} - -Return WifiRttController::getCapabilities(getCapabilities_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::getCapabilitiesInternal, hidl_status_cb); -} - -Return WifiRttController::setLci(uint32_t cmd_id, const RttLciInformation& lci, - setLci_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::setLciInternal, hidl_status_cb, cmd_id, lci); -} - -Return WifiRttController::setLcr(uint32_t cmd_id, const RttLcrInformation& lcr, - setLcr_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::setLcrInternal, hidl_status_cb, cmd_id, lcr); -} - -Return WifiRttController::getResponderInfo(getResponderInfo_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::getResponderInfoInternal, hidl_status_cb); -} - -Return WifiRttController::enableResponder(uint32_t cmd_id, - const V1_0::WifiChannelInfo& channel_hint, - uint32_t max_duration_seconds, - const V1_0::RttResponder& info, - enableResponder_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::enableResponderInternal, hidl_status_cb, cmd_id, - channel_hint, max_duration_seconds, info); -} - -Return WifiRttController::disableResponder(uint32_t cmd_id, - disableResponder_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::disableResponderInternal, hidl_status_cb, cmd_id); -} - -Return WifiRttController::registerEventCallback_1_4( - const sp& callback, - registerEventCallback_1_4_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::registerEventCallbackInternal_1_4, hidl_status_cb, - callback); -} - -Return WifiRttController::rangeRequest_1_4(uint32_t cmd_id, - const hidl_vec& rtt_configs, - rangeRequest_1_4_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::rangeRequestInternal_1_4, hidl_status_cb, cmd_id, - rtt_configs); -} - -Return WifiRttController::getCapabilities_1_4(getCapabilities_1_4_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::getCapabilitiesInternal_1_4, hidl_status_cb); -} - -Return WifiRttController::getResponderInfo_1_4(getResponderInfo_1_4_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::getResponderInfoInternal_1_4, hidl_status_cb); -} - -Return WifiRttController::enableResponder_1_4(uint32_t cmd_id, - const V1_0::WifiChannelInfo& channel_hint, - uint32_t max_duration_seconds, - const V1_4::RttResponder& info, - enableResponder_1_4_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::enableResponderInternal_1_4, hidl_status_cb, cmd_id, - channel_hint, max_duration_seconds, info); -} - -Return WifiRttController::registerEventCallback_1_6( - const sp& callback, - registerEventCallback_1_6_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::registerEventCallbackInternal_1_6, hidl_status_cb, - callback); -} - -Return WifiRttController::rangeRequest_1_6(uint32_t cmd_id, - const hidl_vec& rtt_configs, - rangeRequest_1_6_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::rangeRequestInternal_1_6, hidl_status_cb, cmd_id, - rtt_configs); -} - -Return WifiRttController::getCapabilities_1_6(getCapabilities_1_6_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::getCapabilitiesInternal_1_6, hidl_status_cb); -} - -Return WifiRttController::getResponderInfo_1_6(getResponderInfo_1_6_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::getResponderInfoInternal_1_6, hidl_status_cb); -} - -Return WifiRttController::enableResponder_1_6(uint32_t cmd_id, - const V1_6::WifiChannelInfo& channel_hint, - uint32_t max_duration_seconds, - const V1_6::RttResponder& info, - enableResponder_1_6_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_RTT_CONTROLLER_INVALID, - &WifiRttController::enableResponderInternal_1_6, hidl_status_cb, cmd_id, - channel_hint, max_duration_seconds, info); -} - -std::pair> WifiRttController::getBoundIfaceInternal() { - return {createWifiStatus(WifiStatusCode::SUCCESS), bound_iface_}; -} - -WifiStatus WifiRttController::registerEventCallbackInternal( - const sp& /* callback */) { - // Deprecated support for this api - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiRttController::rangeRequestInternal( - uint32_t /* cmd_id */, const std::vector& /* rtt_configs */) { - // Deprecated support for this api - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiRttController::rangeCancelInternal( - uint32_t cmd_id, const std::vector>& addrs) { - std::vector> legacy_addrs; - for (const auto& addr : addrs) { - legacy_addrs.push_back(addr); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->cancelRttRangeRequest(ifname_, cmd_id, legacy_addrs); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair WifiRttController::getCapabilitiesInternal() { - // Deprecated support for this api - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; -} - -WifiStatus WifiRttController::setLciInternal(uint32_t cmd_id, const RttLciInformation& lci) { - legacy_hal::wifi_lci_information legacy_lci; - if (!hidl_struct_util::convertHidlRttLciInformationToLegacy(lci, &legacy_lci)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->setRttLci(ifname_, cmd_id, legacy_lci); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiRttController::setLcrInternal(uint32_t cmd_id, const RttLcrInformation& lcr) { - legacy_hal::wifi_lcr_information legacy_lcr; - if (!hidl_struct_util::convertHidlRttLcrInformationToLegacy(lcr, &legacy_lcr)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->setRttLcr(ifname_, cmd_id, legacy_lcr); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair WifiRttController::getResponderInfoInternal() { - // Deprecated support for this api - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; -} - -WifiStatus WifiRttController::enableResponderInternal( - uint32_t /* cmd_id */, const V1_0::WifiChannelInfo& /* channel_hint */, - uint32_t /* max_duration_seconds */, const V1_0::RttResponder& /* info */) { - // Deprecated support for this api - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED)}; -} - -WifiStatus WifiRttController::disableResponderInternal(uint32_t cmd_id) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->disableRttResponder(ifname_, cmd_id); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiRttController::registerEventCallbackInternal_1_4( - const sp& /* callback */) { - // Deprecated support for this api - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiRttController::rangeRequestInternal_1_4( - uint32_t /* cmd_id */, const std::vector& /* rtt_configs */) { - // Deprecated support for this api - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -std::pair WifiRttController::getCapabilitiesInternal_1_4() { - // Deprecated support for this api - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; -} - -std::pair WifiRttController::getResponderInfoInternal_1_4() { - // Deprecated support for this api - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; -} - -WifiStatus WifiRttController::enableResponderInternal_1_4( - uint32_t /* cmd_id */, const V1_0::WifiChannelInfo& /* channel_hint */, - uint32_t /* max_duration_seconds */, const V1_4::RttResponder& /* info */) { - // Deprecated support for this api - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED)}; -} - -WifiStatus WifiRttController::registerEventCallbackInternal_1_6( - const sp& callback) { - // TODO(b/31632518): remove the callback when the client is destroyed - event_callbacks_.emplace_back(callback); - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -WifiStatus WifiRttController::rangeRequestInternal_1_6( - uint32_t cmd_id, const std::vector& rtt_configs) { - std::vector legacy_configs; - if (!hidl_struct_util::convertHidlVectorOfRttConfigToLegacy(rtt_configs, &legacy_configs)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - android::wp weak_ptr_this(this); - const auto& on_results_callback = - [weak_ptr_this](legacy_hal::wifi_request_id id, - const std::vector& results) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - std::vector hidl_results; - if (!hidl_struct_util::convertLegacyVectorOfRttResultToHidl(results, - &hidl_results)) { - LOG(ERROR) << "Failed to convert rtt results to HIDL structs"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onResults_1_6(id, hidl_results).isOk()) { - LOG(ERROR) << "Failed to invoke the callback"; - } - } - }; - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startRttRangeRequest( - ifname_, cmd_id, legacy_configs, on_results_callback); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair WifiRttController::getCapabilitiesInternal_1_6() { - legacy_hal::wifi_error legacy_status; - legacy_hal::wifi_rtt_capabilities legacy_caps; - std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getRttCapabilities(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), {}}; - } - V1_6::RttCapabilities hidl_caps; - if (!hidl_struct_util::convertLegacyRttCapabilitiesToHidl(legacy_caps, &hidl_caps)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps}; -} - -std::pair WifiRttController::getResponderInfoInternal_1_6() { - legacy_hal::wifi_error legacy_status; - legacy_hal::wifi_rtt_responder legacy_responder; - std::tie(legacy_status, legacy_responder) = legacy_hal_.lock()->getRttResponderInfo(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), {}}; - } - V1_6::RttResponder hidl_responder; - if (!hidl_struct_util::convertLegacyRttResponderToHidl(legacy_responder, &hidl_responder)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_responder}; -} - -WifiStatus WifiRttController::enableResponderInternal_1_6(uint32_t cmd_id, - const V1_6::WifiChannelInfo& channel_hint, - uint32_t max_duration_seconds, - const V1_6::RttResponder& info) { - legacy_hal::wifi_channel_info legacy_channel_info; - if (!hidl_struct_util::convertHidlWifiChannelInfoToLegacy(channel_hint, &legacy_channel_info)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_rtt_responder legacy_responder; - if (!hidl_struct_util::convertHidlRttResponderToLegacy(info, &legacy_responder)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->enableRttResponder( - ifname_, cmd_id, legacy_channel_info, max_duration_seconds, legacy_responder); - return createWifiStatusFromLegacyError(legacy_status); -} -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/wifi_rtt_controller.h b/wifi/1.6/default/wifi_rtt_controller.h deleted file mode 100644 index fd5f68b6a8..0000000000 --- a/wifi/1.6/default/wifi_rtt_controller.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef WIFI_RTT_CONTROLLER_H_ -#define WIFI_RTT_CONTROLLER_H_ - -#include -#include -#include -#include - -#include "wifi_legacy_hal.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { - -/** - * HIDL interface object used to control all RTT operations. - */ -class WifiRttController : public V1_6::IWifiRttController { - public: - WifiRttController(const std::string& iface_name, const sp& bound_iface, - const std::weak_ptr legacy_hal); - // Refer to |WifiChip::invalidate()|. - void invalidate(); - bool isValid(); - std::vector> getEventCallbacks(); - std::string getIfaceName(); - - // HIDL methods exposed. - Return getBoundIface(getBoundIface_cb hidl_status_cb) override; - Return registerEventCallback(const sp& callback, - registerEventCallback_cb hidl_status_cb) override; - Return rangeRequest(uint32_t cmd_id, const hidl_vec& rtt_configs, - rangeRequest_cb hidl_status_cb) override; - Return rangeCancel(uint32_t cmd_id, const hidl_vec>& addrs, - rangeCancel_cb hidl_status_cb) override; - Return getCapabilities(getCapabilities_cb hidl_status_cb) override; - Return setLci(uint32_t cmd_id, const RttLciInformation& lci, - setLci_cb hidl_status_cb) override; - Return setLcr(uint32_t cmd_id, const RttLcrInformation& lcr, - setLcr_cb hidl_status_cb) override; - Return getResponderInfo(getResponderInfo_cb hidl_status_cb) override; - Return enableResponder(uint32_t cmd_id, const V1_0::WifiChannelInfo& channel_hint, - uint32_t max_duration_seconds, const V1_0::RttResponder& info, - enableResponder_cb hidl_status_cb) override; - Return disableResponder(uint32_t cmd_id, disableResponder_cb hidl_status_cb) override; - Return registerEventCallback_1_4( - const sp& callback, - registerEventCallback_1_4_cb hidl_status_cb) override; - Return rangeRequest_1_4(uint32_t cmd_id, const hidl_vec& rtt_configs, - rangeRequest_1_4_cb hidl_status_cb) override; - Return getCapabilities_1_4(getCapabilities_1_4_cb hidl_status_cb) override; - Return getResponderInfo_1_4(getResponderInfo_1_4_cb hidl_status_cb) override; - Return enableResponder_1_4(uint32_t cmd_id, const V1_0::WifiChannelInfo& channel_hint, - uint32_t max_duration_seconds, const V1_4::RttResponder& info, - enableResponder_1_4_cb hidl_status_cb) override; - Return registerEventCallback_1_6( - const sp& callback, - registerEventCallback_1_6_cb hidl_status_cb) override; - Return rangeRequest_1_6(uint32_t cmd_id, const hidl_vec& rtt_configs, - rangeRequest_1_6_cb hidl_status_cb) override; - Return getCapabilities_1_6(getCapabilities_1_6_cb hidl_status_cb) override; - Return getResponderInfo_1_6(getResponderInfo_1_6_cb hidl_status_cb) override; - Return enableResponder_1_6(uint32_t cmd_id, const V1_6::WifiChannelInfo& channel_hint, - uint32_t max_duration_seconds, const V1_6::RttResponder& info, - enableResponder_1_6_cb hidl_status_cb) override; - - private: - // Corresponding worker functions for the HIDL methods. - std::pair> getBoundIfaceInternal(); - WifiStatus registerEventCallbackInternal( - const sp& callback); - WifiStatus rangeRequestInternal(uint32_t cmd_id, - const std::vector& rtt_configs); - WifiStatus rangeCancelInternal(uint32_t cmd_id, - const std::vector>& addrs); - std::pair getCapabilitiesInternal(); - WifiStatus setLciInternal(uint32_t cmd_id, const RttLciInformation& lci); - WifiStatus setLcrInternal(uint32_t cmd_id, const RttLcrInformation& lcr); - std::pair getResponderInfoInternal(); - WifiStatus enableResponderInternal(uint32_t cmd_id, const V1_0::WifiChannelInfo& channel_hint, - uint32_t max_duration_seconds, - const V1_0::RttResponder& info); - WifiStatus disableResponderInternal(uint32_t cmd_id); - WifiStatus registerEventCallbackInternal_1_4( - const sp& callback); - WifiStatus rangeRequestInternal_1_4(uint32_t cmd_id, - const std::vector& rtt_configs); - std::pair getCapabilitiesInternal_1_4(); - std::pair getResponderInfoInternal_1_4(); - WifiStatus enableResponderInternal_1_4(uint32_t cmd_id, - const V1_0::WifiChannelInfo& channel_hint, - uint32_t max_duration_seconds, - const V1_4::RttResponder& info); - WifiStatus registerEventCallbackInternal_1_6( - const sp& callback); - WifiStatus rangeRequestInternal_1_6(uint32_t cmd_id, - const std::vector& rtt_configs); - std::pair getCapabilitiesInternal_1_6(); - std::pair getResponderInfoInternal_1_6(); - WifiStatus enableResponderInternal_1_6(uint32_t cmd_id, - const V1_6::WifiChannelInfo& channel_hint, - uint32_t max_duration_seconds, - const V1_6::RttResponder& info); - - std::string ifname_; - sp bound_iface_; - std::weak_ptr legacy_hal_; - std::vector> event_callbacks_; - bool is_valid_; - - DISALLOW_COPY_AND_ASSIGN(WifiRttController); -}; - -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // WIFI_RTT_CONTROLLER_H_ diff --git a/wifi/1.6/default/wifi_sta_iface.cpp b/wifi/1.6/default/wifi_sta_iface.cpp deleted file mode 100644 index dd11839c97..0000000000 --- a/wifi/1.6/default/wifi_sta_iface.cpp +++ /dev/null @@ -1,592 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#include - -#include "hidl_return_util.h" -#include "hidl_struct_util.h" -#include "wifi_sta_iface.h" -#include "wifi_status_util.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -using hidl_return_util::validateAndCall; - -WifiStaIface::WifiStaIface(const std::string& ifname, - const std::weak_ptr legacy_hal, - const std::weak_ptr iface_util) - : ifname_(ifname), legacy_hal_(legacy_hal), iface_util_(iface_util), is_valid_(true) { - // Turn on DFS channel usage for STA iface. - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->setDfsFlag(ifname_, true); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - LOG(ERROR) << "Failed to set DFS flag; DFS channels may be unavailable."; - } -} - -void WifiStaIface::invalidate() { - legacy_hal_.reset(); - event_cb_handler_.invalidate(); - is_valid_ = false; -} - -bool WifiStaIface::isValid() { - return is_valid_; -} - -std::string WifiStaIface::getName() { - return ifname_; -} - -std::set> WifiStaIface::getEventCallbacks() { - return event_cb_handler_.getCallbacks(); -} - -Return WifiStaIface::getName(getName_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getNameInternal, hidl_status_cb); -} - -Return WifiStaIface::getType(getType_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getTypeInternal, hidl_status_cb); -} - -Return WifiStaIface::registerEventCallback(const sp& callback, - registerEventCallback_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::registerEventCallbackInternal, hidl_status_cb, callback); -} - -Return WifiStaIface::getCapabilities(getCapabilities_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getCapabilitiesInternal, hidl_status_cb); -} - -Return WifiStaIface::getApfPacketFilterCapabilities( - getApfPacketFilterCapabilities_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getApfPacketFilterCapabilitiesInternal, hidl_status_cb); -} - -Return WifiStaIface::installApfPacketFilter(uint32_t cmd_id, const hidl_vec& program, - installApfPacketFilter_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::installApfPacketFilterInternal, hidl_status_cb, cmd_id, - program); -} - -Return WifiStaIface::readApfPacketFilterData(readApfPacketFilterData_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::readApfPacketFilterDataInternal, hidl_status_cb); -} - -Return WifiStaIface::getBackgroundScanCapabilities( - getBackgroundScanCapabilities_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getBackgroundScanCapabilitiesInternal, hidl_status_cb); -} - -Return WifiStaIface::getValidFrequenciesForBand( - V1_0::WifiBand band, getValidFrequenciesForBand_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getValidFrequenciesForBandInternal, hidl_status_cb, band); -} - -Return WifiStaIface::startBackgroundScan(uint32_t cmd_id, - const StaBackgroundScanParameters& params, - startBackgroundScan_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::startBackgroundScanInternal, hidl_status_cb, cmd_id, - params); -} - -Return WifiStaIface::stopBackgroundScan(uint32_t cmd_id, - stopBackgroundScan_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::stopBackgroundScanInternal, hidl_status_cb, cmd_id); -} - -Return WifiStaIface::enableLinkLayerStatsCollection( - bool debug, enableLinkLayerStatsCollection_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::enableLinkLayerStatsCollectionInternal, hidl_status_cb, - debug); -} - -Return WifiStaIface::disableLinkLayerStatsCollection( - disableLinkLayerStatsCollection_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::disableLinkLayerStatsCollectionInternal, hidl_status_cb); -} - -Return WifiStaIface::getLinkLayerStats(getLinkLayerStats_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getLinkLayerStatsInternal, hidl_status_cb); -} - -Return WifiStaIface::getLinkLayerStats_1_3(getLinkLayerStats_1_3_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getLinkLayerStatsInternal_1_3, hidl_status_cb); -} - -Return WifiStaIface::getLinkLayerStats_1_5(getLinkLayerStats_1_5_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getLinkLayerStatsInternal_1_5, hidl_status_cb); -} - -Return WifiStaIface::getLinkLayerStats_1_6(getLinkLayerStats_1_6_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getLinkLayerStatsInternal_1_6, hidl_status_cb); -} - -Return WifiStaIface::startRssiMonitoring(uint32_t cmd_id, int32_t max_rssi, int32_t min_rssi, - startRssiMonitoring_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::startRssiMonitoringInternal, hidl_status_cb, cmd_id, - max_rssi, min_rssi); -} - -Return WifiStaIface::stopRssiMonitoring(uint32_t cmd_id, - stopRssiMonitoring_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::stopRssiMonitoringInternal, hidl_status_cb, cmd_id); -} - -Return WifiStaIface::getRoamingCapabilities(getRoamingCapabilities_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getRoamingCapabilitiesInternal, hidl_status_cb); -} - -Return WifiStaIface::configureRoaming(const StaRoamingConfig& config, - configureRoaming_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::configureRoamingInternal, hidl_status_cb, config); -} - -Return WifiStaIface::setRoamingState(StaRoamingState state, - setRoamingState_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::setRoamingStateInternal, hidl_status_cb, state); -} - -Return WifiStaIface::enableNdOffload(bool enable, enableNdOffload_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::enableNdOffloadInternal, hidl_status_cb, enable); -} - -Return WifiStaIface::startSendingKeepAlivePackets( - uint32_t cmd_id, const hidl_vec& ip_packet_data, uint16_t ether_type, - const hidl_array& src_address, const hidl_array& dst_address, - uint32_t period_in_ms, startSendingKeepAlivePackets_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::startSendingKeepAlivePacketsInternal, hidl_status_cb, - cmd_id, ip_packet_data, ether_type, src_address, dst_address, - period_in_ms); -} - -Return WifiStaIface::stopSendingKeepAlivePackets( - uint32_t cmd_id, stopSendingKeepAlivePackets_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::stopSendingKeepAlivePacketsInternal, hidl_status_cb, - cmd_id); -} - -Return WifiStaIface::setScanningMacOui(const hidl_array& oui, - setScanningMacOui_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::setScanningMacOuiInternal, hidl_status_cb, oui); -} - -Return WifiStaIface::startDebugPacketFateMonitoring( - startDebugPacketFateMonitoring_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::startDebugPacketFateMonitoringInternal, hidl_status_cb); -} - -Return WifiStaIface::getDebugTxPacketFates(getDebugTxPacketFates_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getDebugTxPacketFatesInternal, hidl_status_cb); -} - -Return WifiStaIface::getDebugRxPacketFates(getDebugRxPacketFates_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getDebugRxPacketFatesInternal, hidl_status_cb); -} - -Return WifiStaIface::setMacAddress(const hidl_array& mac, - setMacAddress_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::setMacAddressInternal, hidl_status_cb, mac); -} - -Return WifiStaIface::getFactoryMacAddress(getFactoryMacAddress_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::getFactoryMacAddressInternal, hidl_status_cb); -} - -Return WifiStaIface::setScanMode(bool enable, setScanMode_cb hidl_status_cb) { - return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID, - &WifiStaIface::setScanModeInternal, hidl_status_cb, enable); -} - -std::pair WifiStaIface::getNameInternal() { - return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_}; -} - -std::pair WifiStaIface::getTypeInternal() { - return {createWifiStatus(WifiStatusCode::SUCCESS), IfaceType::STA}; -} - -WifiStatus WifiStaIface::registerEventCallbackInternal( - const sp& callback) { - if (!event_cb_handler_.addCallback(callback)) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -std::pair WifiStaIface::getCapabilitiesInternal() { - legacy_hal::wifi_error legacy_status; - uint64_t legacy_feature_set; - std::tie(legacy_status, legacy_feature_set) = - legacy_hal_.lock()->getSupportedFeatureSet(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), 0}; - } - uint32_t legacy_logger_feature_set; - std::tie(legacy_status, legacy_logger_feature_set) = - legacy_hal_.lock()->getLoggerSupportedFeatureSet(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - // some devices don't support querying logger feature set - legacy_logger_feature_set = 0; - } - uint32_t hidl_caps; - if (!hidl_struct_util::convertLegacyFeaturesToHidlStaCapabilities( - legacy_feature_set, legacy_logger_feature_set, &hidl_caps)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), 0}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps}; -} - -std::pair -WifiStaIface::getApfPacketFilterCapabilitiesInternal() { - legacy_hal::wifi_error legacy_status; - legacy_hal::PacketFilterCapabilities legacy_caps; - std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getPacketFilterCapabilities(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), {}}; - } - StaApfPacketFilterCapabilities hidl_caps; - if (!hidl_struct_util::convertLegacyApfCapabilitiesToHidl(legacy_caps, &hidl_caps)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps}; -} - -WifiStatus WifiStaIface::installApfPacketFilterInternal(uint32_t /* cmd_id */, - const std::vector& program) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->setPacketFilter(ifname_, program); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair> WifiStaIface::readApfPacketFilterDataInternal() { - const std::pair> legacy_status_and_data = - legacy_hal_.lock()->readApfPacketFilterData(ifname_); - return {createWifiStatusFromLegacyError(legacy_status_and_data.first), - std::move(legacy_status_and_data.second)}; -} - -std::pair -WifiStaIface::getBackgroundScanCapabilitiesInternal() { - legacy_hal::wifi_error legacy_status; - legacy_hal::wifi_gscan_capabilities legacy_caps; - std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getGscanCapabilities(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), {}}; - } - StaBackgroundScanCapabilities hidl_caps; - if (!hidl_struct_util::convertLegacyGscanCapabilitiesToHidl(legacy_caps, &hidl_caps)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps}; -} - -std::pair> -WifiStaIface::getValidFrequenciesForBandInternal(V1_0::WifiBand band) { - static_assert(sizeof(WifiChannelInMhz) == sizeof(uint32_t), "Size mismatch"); - legacy_hal::wifi_error legacy_status; - std::vector valid_frequencies; - std::tie(legacy_status, valid_frequencies) = legacy_hal_.lock()->getValidFrequenciesForBand( - ifname_, hidl_struct_util::convertHidlWifiBandToLegacy(band)); - return {createWifiStatusFromLegacyError(legacy_status), valid_frequencies}; -} - -WifiStatus WifiStaIface::startBackgroundScanInternal(uint32_t cmd_id, - const StaBackgroundScanParameters& params) { - legacy_hal::wifi_scan_cmd_params legacy_params; - if (!hidl_struct_util::convertHidlGscanParamsToLegacy(params, &legacy_params)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - android::wp weak_ptr_this(this); - const auto& on_failure_callback = [weak_ptr_this](legacy_hal::wifi_request_id id) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onBackgroundScanFailure(id).isOk()) { - LOG(ERROR) << "Failed to invoke onBackgroundScanFailure callback"; - } - } - }; - const auto& on_results_callback = - [weak_ptr_this](legacy_hal::wifi_request_id id, - const std::vector& results) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - std::vector hidl_scan_datas; - if (!hidl_struct_util::convertLegacyVectorOfCachedGscanResultsToHidl( - results, &hidl_scan_datas)) { - LOG(ERROR) << "Failed to convert scan results to HIDL structs"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onBackgroundScanResults(id, hidl_scan_datas).isOk()) { - LOG(ERROR) << "Failed to invoke onBackgroundScanResults callback"; - } - } - }; - const auto& on_full_result_callback = [weak_ptr_this]( - legacy_hal::wifi_request_id id, - const legacy_hal::wifi_scan_result* result, - uint32_t buckets_scanned) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - StaScanResult hidl_scan_result; - if (!hidl_struct_util::convertLegacyGscanResultToHidl(*result, true, &hidl_scan_result)) { - LOG(ERROR) << "Failed to convert full scan results to HIDL structs"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onBackgroundFullScanResult(id, buckets_scanned, hidl_scan_result) - .isOk()) { - LOG(ERROR) << "Failed to invoke onBackgroundFullScanResult callback"; - } - } - }; - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->startGscan(ifname_, cmd_id, legacy_params, on_failure_callback, - on_results_callback, on_full_result_callback); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiStaIface::stopBackgroundScanInternal(uint32_t cmd_id) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->stopGscan(ifname_, cmd_id); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiStaIface::enableLinkLayerStatsCollectionInternal(bool debug) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->enableLinkLayerStats(ifname_, debug); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiStaIface::disableLinkLayerStatsCollectionInternal() { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->disableLinkLayerStats(ifname_); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair WifiStaIface::getLinkLayerStatsInternal() { - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; -} - -std::pair WifiStaIface::getLinkLayerStatsInternal_1_3() { - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; -} - -std::pair WifiStaIface::getLinkLayerStatsInternal_1_5() { - return {createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED), {}}; -} - -std::pair WifiStaIface::getLinkLayerStatsInternal_1_6() { - legacy_hal::wifi_error legacy_status; - legacy_hal::LinkLayerStats legacy_stats; - std::tie(legacy_status, legacy_stats) = legacy_hal_.lock()->getLinkLayerStats(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), {}}; - } - V1_6::StaLinkLayerStats hidl_stats; - if (!hidl_struct_util::convertLegacyLinkLayerStatsToHidl(legacy_stats, &hidl_stats)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_stats}; -} - -WifiStatus WifiStaIface::startRssiMonitoringInternal(uint32_t cmd_id, int32_t max_rssi, - int32_t min_rssi) { - android::wp weak_ptr_this(this); - const auto& on_threshold_breached_callback = [weak_ptr_this](legacy_hal::wifi_request_id id, - std::array bssid, - int8_t rssi) { - const auto shared_ptr_this = weak_ptr_this.promote(); - if (!shared_ptr_this.get() || !shared_ptr_this->isValid()) { - LOG(ERROR) << "Callback invoked on an invalid object"; - return; - } - for (const auto& callback : shared_ptr_this->getEventCallbacks()) { - if (!callback->onRssiThresholdBreached(id, bssid, rssi).isOk()) { - LOG(ERROR) << "Failed to invoke onRssiThresholdBreached callback"; - } - } - }; - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startRssiMonitoring( - ifname_, cmd_id, max_rssi, min_rssi, on_threshold_breached_callback); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiStaIface::stopRssiMonitoringInternal(uint32_t cmd_id) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->stopRssiMonitoring(ifname_, cmd_id); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair WifiStaIface::getRoamingCapabilitiesInternal() { - legacy_hal::wifi_error legacy_status; - legacy_hal::wifi_roaming_capabilities legacy_caps; - std::tie(legacy_status, legacy_caps) = legacy_hal_.lock()->getRoamingCapabilities(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), {}}; - } - StaRoamingCapabilities hidl_caps; - if (!hidl_struct_util::convertLegacyRoamingCapabilitiesToHidl(legacy_caps, &hidl_caps)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_caps}; -} - -WifiStatus WifiStaIface::configureRoamingInternal(const StaRoamingConfig& config) { - legacy_hal::wifi_roaming_config legacy_config; - if (!hidl_struct_util::convertHidlRoamingConfigToLegacy(config, &legacy_config)) { - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); - } - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->configureRoaming(ifname_, legacy_config); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiStaIface::setRoamingStateInternal(StaRoamingState state) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->enableFirmwareRoaming( - ifname_, hidl_struct_util::convertHidlRoamingStateToLegacy(state)); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiStaIface::enableNdOffloadInternal(bool enable) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->configureNdOffload(ifname_, enable); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiStaIface::startSendingKeepAlivePacketsInternal( - uint32_t cmd_id, const std::vector& ip_packet_data, uint16_t ether_type, - const std::array& src_address, const std::array& dst_address, - uint32_t period_in_ms) { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startSendingOffloadedPacket( - ifname_, cmd_id, ether_type, ip_packet_data, src_address, dst_address, period_in_ms); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiStaIface::stopSendingKeepAlivePacketsInternal(uint32_t cmd_id) { - legacy_hal::wifi_error legacy_status = - legacy_hal_.lock()->stopSendingOffloadedPacket(ifname_, cmd_id); - return createWifiStatusFromLegacyError(legacy_status); -} - -WifiStatus WifiStaIface::setScanningMacOuiInternal(const std::array& /* oui */) { - // deprecated. - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -WifiStatus WifiStaIface::startDebugPacketFateMonitoringInternal() { - legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->startPktFateMonitoring(ifname_); - return createWifiStatusFromLegacyError(legacy_status); -} - -std::pair> -WifiStaIface::getDebugTxPacketFatesInternal() { - legacy_hal::wifi_error legacy_status; - std::vector legacy_fates; - std::tie(legacy_status, legacy_fates) = legacy_hal_.lock()->getTxPktFates(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), {}}; - } - std::vector hidl_fates; - if (!hidl_struct_util::convertLegacyVectorOfDebugTxPacketFateToHidl(legacy_fates, - &hidl_fates)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_fates}; -} - -std::pair> -WifiStaIface::getDebugRxPacketFatesInternal() { - legacy_hal::wifi_error legacy_status; - std::vector legacy_fates; - std::tie(legacy_status, legacy_fates) = legacy_hal_.lock()->getRxPktFates(ifname_); - if (legacy_status != legacy_hal::WIFI_SUCCESS) { - return {createWifiStatusFromLegacyError(legacy_status), {}}; - } - std::vector hidl_fates; - if (!hidl_struct_util::convertLegacyVectorOfDebugRxPacketFateToHidl(legacy_fates, - &hidl_fates)) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_fates}; -} - -WifiStatus WifiStaIface::setMacAddressInternal(const std::array& mac) { - bool status = iface_util_.lock()->setMacAddress(ifname_, mac); - if (!status) { - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN); - } - return createWifiStatus(WifiStatusCode::SUCCESS); -} - -std::pair> WifiStaIface::getFactoryMacAddressInternal() { - std::array mac = iface_util_.lock()->getFactoryMacAddress(ifname_); - if (mac[0] == 0 && mac[1] == 0 && mac[2] == 0 && mac[3] == 0 && mac[4] == 0 && mac[5] == 0) { - return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), mac}; - } - return {createWifiStatus(WifiStatusCode::SUCCESS), mac}; -} - -WifiStatus WifiStaIface::setScanModeInternal(bool enable) { - // OEM's need to implement this on their devices if needed. - LOG(WARNING) << "setScanModeInternal(" << enable << ") not supported"; - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); -} - -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/wifi_sta_iface.h b/wifi/1.6/default/wifi_sta_iface.h deleted file mode 100644 index c01c50b612..0000000000 --- a/wifi/1.6/default/wifi_sta_iface.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef WIFI_STA_IFACE_H_ -#define WIFI_STA_IFACE_H_ - -#include -#include -#include - -#include "hidl_callback_util.h" -#include "wifi_iface_util.h" -#include "wifi_legacy_hal.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -using namespace android::hardware::wifi::V1_0; - -/** - * HIDL interface object used to control a STA Iface instance. - */ -class WifiStaIface : public V1_6::IWifiStaIface { - public: - WifiStaIface(const std::string& ifname, - const std::weak_ptr legacy_hal, - const std::weak_ptr iface_util); - // Refer to |WifiChip::invalidate()|. - void invalidate(); - bool isValid(); - std::set> getEventCallbacks(); - std::string getName(); - - // HIDL methods exposed. - Return getName(getName_cb hidl_status_cb) override; - Return getType(getType_cb hidl_status_cb) override; - Return registerEventCallback(const sp& callback, - registerEventCallback_cb hidl_status_cb) override; - Return getCapabilities(getCapabilities_cb hidl_status_cb) override; - Return getApfPacketFilterCapabilities( - getApfPacketFilterCapabilities_cb hidl_status_cb) override; - Return installApfPacketFilter(uint32_t cmd_id, const hidl_vec& program, - installApfPacketFilter_cb hidl_status_cb) override; - Return readApfPacketFilterData(readApfPacketFilterData_cb hidl_status_cb) override; - Return getBackgroundScanCapabilities( - getBackgroundScanCapabilities_cb hidl_status_cb) override; - Return getValidFrequenciesForBand(V1_0::WifiBand band, - getValidFrequenciesForBand_cb hidl_status_cb) override; - Return startBackgroundScan(uint32_t cmd_id, const StaBackgroundScanParameters& params, - startBackgroundScan_cb hidl_status_cb) override; - Return stopBackgroundScan(uint32_t cmd_id, stopBackgroundScan_cb hidl_status_cb) override; - Return enableLinkLayerStatsCollection( - bool debug, enableLinkLayerStatsCollection_cb hidl_status_cb) override; - Return disableLinkLayerStatsCollection( - disableLinkLayerStatsCollection_cb hidl_status_cb) override; - Return getLinkLayerStats(getLinkLayerStats_cb hidl_status_cb) override; - Return getLinkLayerStats_1_3(getLinkLayerStats_1_3_cb hidl_status_cb) override; - Return getLinkLayerStats_1_5(getLinkLayerStats_1_5_cb hidl_status_cb) override; - Return getLinkLayerStats_1_6(getLinkLayerStats_1_6_cb hidl_status_cb) override; - Return startRssiMonitoring(uint32_t cmd_id, int32_t max_rssi, int32_t min_rssi, - startRssiMonitoring_cb hidl_status_cb) override; - Return stopRssiMonitoring(uint32_t cmd_id, stopRssiMonitoring_cb hidl_status_cb) override; - Return getRoamingCapabilities(getRoamingCapabilities_cb hidl_status_cb) override; - Return configureRoaming(const StaRoamingConfig& config, - configureRoaming_cb hidl_status_cb) override; - Return setRoamingState(StaRoamingState state, setRoamingState_cb hidl_status_cb) override; - Return enableNdOffload(bool enable, enableNdOffload_cb hidl_status_cb) override; - Return startSendingKeepAlivePackets( - uint32_t cmd_id, const hidl_vec& ip_packet_data, uint16_t ether_type, - const hidl_array& src_address, const hidl_array& dst_address, - uint32_t period_in_ms, startSendingKeepAlivePackets_cb hidl_status_cb) override; - Return stopSendingKeepAlivePackets( - uint32_t cmd_id, stopSendingKeepAlivePackets_cb hidl_status_cb) override; - Return setScanningMacOui(const hidl_array& oui, - setScanningMacOui_cb hidl_status_cb) override; - Return startDebugPacketFateMonitoring( - startDebugPacketFateMonitoring_cb hidl_status_cb) override; - Return getDebugTxPacketFates(getDebugTxPacketFates_cb hidl_status_cb) override; - Return getDebugRxPacketFates(getDebugRxPacketFates_cb hidl_status_cb) override; - Return setMacAddress(const hidl_array& mac, - setMacAddress_cb hidl_status_cb) override; - Return getFactoryMacAddress(getFactoryMacAddress_cb hidl_status_cb) override; - Return setScanMode(bool enable, setScanMode_cb hidl_status_cb) override; - - private: - // Corresponding worker functions for the HIDL methods. - std::pair getNameInternal(); - std::pair getTypeInternal(); - WifiStatus registerEventCallbackInternal(const sp& callback); - std::pair getCapabilitiesInternal(); - std::pair getApfPacketFilterCapabilitiesInternal(); - WifiStatus installApfPacketFilterInternal(uint32_t cmd_id, const std::vector& program); - std::pair> readApfPacketFilterDataInternal(); - std::pair getBackgroundScanCapabilitiesInternal(); - std::pair> getValidFrequenciesForBandInternal( - V1_0::WifiBand band); - WifiStatus startBackgroundScanInternal(uint32_t cmd_id, - const StaBackgroundScanParameters& params); - WifiStatus stopBackgroundScanInternal(uint32_t cmd_id); - WifiStatus enableLinkLayerStatsCollectionInternal(bool debug); - WifiStatus disableLinkLayerStatsCollectionInternal(); - std::pair getLinkLayerStatsInternal(); - std::pair getLinkLayerStatsInternal_1_3(); - std::pair getLinkLayerStatsInternal_1_5(); - std::pair getLinkLayerStatsInternal_1_6(); - WifiStatus startRssiMonitoringInternal(uint32_t cmd_id, int32_t max_rssi, int32_t min_rssi); - WifiStatus stopRssiMonitoringInternal(uint32_t cmd_id); - std::pair getRoamingCapabilitiesInternal(); - WifiStatus configureRoamingInternal(const StaRoamingConfig& config); - WifiStatus setRoamingStateInternal(StaRoamingState state); - WifiStatus enableNdOffloadInternal(bool enable); - WifiStatus startSendingKeepAlivePacketsInternal(uint32_t cmd_id, - const std::vector& ip_packet_data, - uint16_t ether_type, - const std::array& src_address, - const std::array& dst_address, - uint32_t period_in_ms); - WifiStatus stopSendingKeepAlivePacketsInternal(uint32_t cmd_id); - WifiStatus setScanningMacOuiInternal(const std::array& oui); - WifiStatus startDebugPacketFateMonitoringInternal(); - std::pair> getDebugTxPacketFatesInternal(); - std::pair> getDebugRxPacketFatesInternal(); - WifiStatus setMacAddressInternal(const std::array& mac); - std::pair> getFactoryMacAddressInternal(); - WifiStatus setScanModeInternal(bool enable); - - std::string ifname_; - std::weak_ptr legacy_hal_; - std::weak_ptr iface_util_; - bool is_valid_; - hidl_callback_util::HidlCallbackHandler event_cb_handler_; - - DISALLOW_COPY_AND_ASSIGN(WifiStaIface); -}; - -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // WIFI_STA_IFACE_H_ diff --git a/wifi/1.6/default/wifi_status_util.cpp b/wifi/1.6/default/wifi_status_util.cpp deleted file mode 100644 index 3b18e537cd..0000000000 --- a/wifi/1.6/default/wifi_status_util.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#include "wifi_status_util.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { - -std::string legacyErrorToString(legacy_hal::wifi_error error) { - switch (error) { - case legacy_hal::WIFI_SUCCESS: - return "SUCCESS"; - case legacy_hal::WIFI_ERROR_UNINITIALIZED: - return "UNINITIALIZED"; - case legacy_hal::WIFI_ERROR_NOT_AVAILABLE: - return "NOT_AVAILABLE"; - case legacy_hal::WIFI_ERROR_NOT_SUPPORTED: - return "NOT_SUPPORTED"; - case legacy_hal::WIFI_ERROR_INVALID_ARGS: - return "INVALID_ARGS"; - case legacy_hal::WIFI_ERROR_INVALID_REQUEST_ID: - return "INVALID_REQUEST_ID"; - case legacy_hal::WIFI_ERROR_TIMED_OUT: - return "TIMED_OUT"; - case legacy_hal::WIFI_ERROR_TOO_MANY_REQUESTS: - return "TOO_MANY_REQUESTS"; - case legacy_hal::WIFI_ERROR_OUT_OF_MEMORY: - return "OUT_OF_MEMORY"; - case legacy_hal::WIFI_ERROR_BUSY: - return "BUSY"; - case legacy_hal::WIFI_ERROR_UNKNOWN: - return "UNKNOWN"; - default: - return "UNKNOWN ERROR"; - } -} - -WifiStatus createWifiStatus(WifiStatusCode code, const std::string& description) { - return {code, description}; -} - -WifiStatus createWifiStatus(WifiStatusCode code) { - return createWifiStatus(code, ""); -} - -WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error, const std::string& desc) { - switch (error) { - case legacy_hal::WIFI_ERROR_UNINITIALIZED: - case legacy_hal::WIFI_ERROR_NOT_AVAILABLE: - return createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE, desc); - - case legacy_hal::WIFI_ERROR_NOT_SUPPORTED: - return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED, desc); - - case legacy_hal::WIFI_ERROR_INVALID_ARGS: - case legacy_hal::WIFI_ERROR_INVALID_REQUEST_ID: - return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS, desc); - - case legacy_hal::WIFI_ERROR_TIMED_OUT: - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, desc + ", timed out"); - - case legacy_hal::WIFI_ERROR_TOO_MANY_REQUESTS: - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, desc + ", too many requests"); - - case legacy_hal::WIFI_ERROR_OUT_OF_MEMORY: - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, desc + ", out of memory"); - - case legacy_hal::WIFI_ERROR_BUSY: - return createWifiStatus(WifiStatusCode::ERROR_BUSY); - - case legacy_hal::WIFI_ERROR_NONE: - return createWifiStatus(WifiStatusCode::SUCCESS, desc); - - case legacy_hal::WIFI_ERROR_UNKNOWN: - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, "unknown"); - - default: - return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, "unknown error"); - } -} - -WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error) { - return createWifiStatusFromLegacyError(error, ""); -} - -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android diff --git a/wifi/1.6/default/wifi_status_util.h b/wifi/1.6/default/wifi_status_util.h deleted file mode 100644 index ea1c29486b..0000000000 --- a/wifi/1.6/default/wifi_status_util.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#ifndef WIFI_STATUS_UTIL_H_ -#define WIFI_STATUS_UTIL_H_ - -#include - -#include "wifi_legacy_hal.h" - -namespace android { -namespace hardware { -namespace wifi { -namespace V1_6 { -namespace implementation { -using namespace android::hardware::wifi::V1_0; - -std::string legacyErrorToString(legacy_hal::wifi_error error); -WifiStatus createWifiStatus(WifiStatusCode code, const std::string& description); -WifiStatus createWifiStatus(WifiStatusCode code); -WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error, - const std::string& description); -WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error); - -} // namespace implementation -} // namespace V1_6 -} // namespace wifi -} // namespace hardware -} // namespace android - -#endif // WIFI_STATUS_UTIL_H_ From 36f0b25a197e8d66533605ad9b643a9883d1b29c Mon Sep 17 00:00:00 2001 From: shrikar Date: Thu, 6 Apr 2023 19:49:05 +0000 Subject: [PATCH 893/998] Added info to docs to answer Q25 from Ford pending questions. Bug: 259309511 Test: manual build Change-Id: I21e2672ff41ad6b8fc08866641abe58dd75c8efc --- .../hardware/automotive/vehicle/VehicleProperty.aidl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 8a3ab90241..fe1eb2ddb7 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -484,12 +484,15 @@ enum VehicleProperty { * * This is the gear selected by the user. * - * Values in the config data must represent the list of supported gears - * for this vehicle. For example, config data for an automatic transmission - * must contain {GEAR_NEUTRAL, GEAR_REVERSE, GEAR_PARK, GEAR_DRIVE, - * GEAR_1, GEAR_2,...} and for manual transmission the list must be + * Values in the config data must represent the list of supported gears for this vehicle. For + * example, config data for an automatic transmission must contain {GEAR_NEUTRAL, GEAR_REVERSE, + * GEAR_PARK, GEAR_DRIVE, GEAR_1, GEAR_2,...} and for manual transmission the list must be * {GEAR_NEUTRAL, GEAR_REVERSE, GEAR_1, GEAR_2,...} * + * In the case of an automatic transmission vehicle that allows the driver to select specific + * gears on demand (i.e. "manual mode"), GEAR_SELECTION's value must be set to the specific gear + * selected by the driver instead of simply GEAR_DRIVE. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ * @data_enum VehicleGear From e18364056a4f40b2094044409fee3f4564c31f79 Mon Sep 17 00:00:00 2001 From: shrikar Date: Mon, 13 Mar 2023 22:07:20 +0000 Subject: [PATCH 894/998] Added info to HAL docs to answer Q14 from Ford pending questions. Bug: 259309511 Test: manual build Change-Id: Icd1607e7f05cee7eec3f0a9826e3590149ff5c08 --- .../automotive/vehicle/VehicleProperty.aidl | 341 ++++++++++++++---- 1 file changed, 275 insertions(+), 66 deletions(-) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 8a3ab90241..9edb9b17aa 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -549,9 +549,8 @@ enum VehicleProperty { * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All values between * minInt32Value and maxInt32Value must be supported. The minInt32Value must be 0. * - * The maxInt32Value in default area's VehicleAreaConfig indicates the maximum amount of energy - * regenerated from braking. The minInt32Value in default area's VehicleAreaConfig indicates no - * regenerative braking. + * The maxInt32Value indicates the maximum amount of energy regenerated from braking. The + * minInt32Value indicates no regenerative braking. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -1591,6 +1590,19 @@ enum VehicleProperty { /** * Door move * + * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers + * between minInt32Value and maxInt32Value must be supported. + * + * The maxInt32Value represents the maximum movement speed of the door while opening. + * The minInt32Value represents the maximum movement speed of the door while closing. + * + * Larger absolute values, either positive or negative, indicate a faster movement speed. Once + * the door reaches the positional limit, the value must reset to 0. If DOOR_MOVE's value is + * currently 0, then that means there is no movement currently occurring. + * + * This property is not in any particular unit but in a specified range of relative movement + * speeds. + * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. * @@ -1643,7 +1655,19 @@ enum VehicleProperty { /** * Mirror Z Move * - * Positive value indicates tilt upwards, negative value is downwards + * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers + * between minInt32Value and maxInt32Value must be supported. + * + * The maxInt32Value represents the maximum movement speed of the mirror while tilting upwards. + * The minInt32Value represents the maximum movement speed of the mirror while tilting + * downwards. + * + * Larger absolute values, either positive or negative, indicate a faster movement speed. Once + * the mirror reaches the positional limit, the value must reset to 0. If MIRROR_Z_MOVE's value + * is currently 0, then that means there is no movement currently occurring. + * + * This property is not in any particular unit but in a specified range of relative movement + * speeds. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -1669,7 +1693,18 @@ enum VehicleProperty { /** * Mirror Y Move * - * Positive value indicate tilt right, negative value is left + * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers + * between minInt32Value and maxInt32Value must be supported. + * + * The maxInt32Value represents the maximum movement speed of the mirror while tilting right. + * The minInt32Value represents the maximum movement speed of the mirror while tilting left. + * + * Larger absolute values, either positive or negative, indicate a faster movement speed. Once + * the mirror reaches the positional limit, the value must reset to 0. If MIRROR_Y_MOVE's value + * is currently 0, then that means there is no movement currently occurring. + * + * This property is not in any particular unit but in a specified range of relative movement + * speeds. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -1802,6 +1837,22 @@ enum VehicleProperty { /** * Seatbelt height move * + * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers + * between minInt32Value and maxInt32Value must be supported. + * + * The maxInt32Value represents the maximum movement speed of the seat belt's shoulder anchor + * while moving upwards. + * The minInt32Value represents the maximum movement speed of the seat belt's shoulder anchor + * while moving downwards. + * + * Larger absolute values, either positive or negative, indicate a faster movement speed. Once + * the seat belt reaches the positional limit, the value must reset to 0. If + * SEAT_BELT_HEIGHT_MOVE's value is currently 0, then that means there is no movement currently + * occurring. + * + * This property is not in any particular unit but in a specified range of relative movement + * speeds. + * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. * @@ -1828,7 +1879,20 @@ enum VehicleProperty { /** * Seat fore/aft move * - * Moves the seat position forward and aft. + * This property moves the entire seat forward/backward in the direction that it is facing. + * + * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers + * between minInt32Value and maxInt32Value must be supported. + * + * The maxInt32Value represents the maximum movement speed of the seat while moving forward. + * The minInt32Value represents the maximum movement speed of the seat while moving backward. + * + * Larger absolute values, either positive or negative, indicate a faster movement speed. Once + * the seat reaches the positional limit, the value must reset to 0. If SEAT_FORE_AFT_MOVE's + * value is currently 0, then that means there is no movement currently occurring. + * + * This property is not in any particular unit but in a specified range of relative movement + * speeds. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -1856,7 +1920,20 @@ enum VehicleProperty { /** * Seat backrest angle 1 move * - * Moves the backrest forward or recline. + * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers + * between minInt32Value and maxInt32Value must be supported. + * + * The maxInt32Value represents the maximum movement speed of the seat backrest while angling + * forward. + * The minInt32Value represents the maximum movement speed of the seat backrest while reclining. + * + * Larger absolute values, either positive or negative, indicate a faster movement speed. Once + * the seat backrest reaches the positional limit, the value must reset to 0. If + * SEAT_BACKREST_ANGLE_1_MOVE's value is currently 0, then that means there is no movement + * currently occurring. + * + * This property is not in any particular unit but in a specified range of relative movement + * speeds. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -1884,7 +1961,20 @@ enum VehicleProperty { /** * Seat backrest angle 2 move * - * Moves the backrest forward or recline. + * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers + * between minInt32Value and maxInt32Value must be supported. + * + * The maxInt32Value represents the maximum movement speed of the seat backrest while angling + * forward. + * The minInt32Value represents the maximum movement speed of the seat backrest while reclining. + * + * Larger absolute values, either positive or negative, indicate a faster movement speed. Once + * the seat backrest reaches the positional limit, the value must reset to 0. If + * SEAT_BACKREST_ANGLE_2_MOVE's value is currently 0, then that means there is no movement + * currently occurring. + * + * This property is not in any particular unit but in a specified range of relative movement + * speeds. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -1912,7 +2002,18 @@ enum VehicleProperty { /** * Seat height move * - * Moves the seat height. + * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers + * between minInt32Value and maxInt32Value must be supported. + * + * The maxInt32Value represents the maximum movement speed of the seat while moving upward. + * The minInt32Value represents the maximum movement speed of the seat while moving downward. + * + * Larger absolute values, either positive or negative, indicate a faster movement speed. Once + * the seat reaches the positional limit, the value must reset to 0. If SEAT_HEIGHT_MOVE's value + * is currently 0, then that means there is no movement currently occurring. + * + * This property is not in any particular unit but in a specified range of relative movement + * speeds. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -1940,7 +2041,19 @@ enum VehicleProperty { /** * Seat depth move * - * Adjusts the seat depth. + * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers + * between minInt32Value and maxInt32Value must be supported. + * + * The maxInt32Value represents the maximum movement speed of the seat while getting deeper + * The minInt32Value represents the maximum movement speed of the seat while getting shallower. + * + * Larger absolute values, either positive or negative, indicate a faster movement speed. Once + * the seat backrest reaches the positional limit, the value must reset to 0. If + * SEAT_DEPTH_MOVE's value is currently 0, then that means there is no movement currently + * occurring. + * + * This property is not in any particular unit but in a specified range of relative movement + * speeds. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -1968,7 +2081,20 @@ enum VehicleProperty { /** * Seat tilt move * - * Tilts the seat. + * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers + * between minInt32Value and maxInt32Value must be supported. + * + * The maxInt32Value represents the maximum movement speed of the front edge of the seat while + * moving upward. + * The minInt32Value represents the maximum movement speed of the front edge of the seat while + * moving downward. + * + * Larger absolute values, either positive or negative, indicate a faster movement speed. Once + * the seat bottom reaches the positional limit, the value must reset to 0. If SEAT_TILT_MOVE's + * value is currently 0, then that means there is no movement currently occurring. + * + * This property is not in any particular unit but in a specified range of relative movement + * speeds. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -1996,7 +2122,21 @@ enum VehicleProperty { /** * Lumbar fore/aft move * - * Adjusts the lumbar support. + * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers + * between minInt32Value and maxInt32Value must be supported. + * + * The maxInt32Value represents the maximum movement speed of the seat's lumbar support while + * moving forward. + * The minInt32Value represents the maximum movement speed of the seat's lumbar support while + * moving backward. + * + * Larger absolute values, either positive or negative, indicate a faster movement speed. Once + * the seat's lumbar support reaches the positional limit, the value must reset to 0. If + * SEAT_LUMBAR_FORE_AFT_MOVE's value is currently 0, then that means there is no movement + * currently occurring. + * + * This property is not in any particular unit but in a specified range of relative movement + * speeds. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2024,7 +2164,21 @@ enum VehicleProperty { /** * Lumbar side support move * - * Adjusts the amount of lateral lumbar support. + * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers + * between minInt32Value and maxInt32Value must be supported. + * + * The maxInt32Value represents the maximum movement speed of the seat's lumbar side support + * while getting wider. + * The minInt32Value represents the maximum movement speed of the seat's lumbar side support + * while getting thinner. + * + * Larger absolute values, either positive or negative, indicate a faster movement speed. Once + * the seat's lumbar side support reaches the positional limit, the value must reset to 0. If + * SEAT_LUMBAR_SIDE_SUPPORT_MOVE's value is currently 0, then that means there is no movement + * currently occurring. + * + * This property is not in any particular unit but in a specified range of relative movement + * speeds. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2060,11 +2214,11 @@ enum VehicleProperty { * Sets the headrest height for supported seats. VehiclePropConfig.areaConfigs specifies which * seats are supported. * - * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All values between - * minInt32Value and maxInt32Value must be supported. The maxInt32Value indicates the tallest - * setting and the minInt32Value indicates the shortest setting. + * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All values + * between minInt32Value and maxInt32Value must be supported. The maxInt32Value indicates the + * tallest setting and the minInt32Value indicates the shortest setting. * - * This value is not in any particular unit but in a specified range of steps. + * This property is not in any particular unit but in a specified range of steps. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2078,7 +2232,21 @@ enum VehicleProperty { /** * Headrest height move * - * Moves the headrest up and down. + * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers + * between minInt32Value and maxInt32Value must be supported. + * + * The maxInt32Value represents the maximum movement speed of the seat's headrest while moving + * up. + * The minInt32Value represents the maximum movement speed of the seat's headrest while moving + * down. + * + * Larger absolute values, either positive or negative, indicate a faster movement speed. Once + * the seat's headrest reaches the positional limit, the value must reset to 0. If + * SEAT_HEADREST_HEIGHT_MOVE's value is currently 0, then that means there is no movement + * currently occurring. + * + * This property is not in any particular unit but in a specified range of relative movement + * speeds. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2106,7 +2274,21 @@ enum VehicleProperty { /** * Headrest angle move * - * Adjusts the angle of the headrest + * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers + * between minInt32Value and maxInt32Value must be supported. + * + * The maxInt32Value represents the maximum movement speed of the seat's headrest while moving + * into an upright/forward position. + * The minInt32Value represents the maximum movement speed of the seat's headrest while moving + * into a shallow position. + * + * Larger absolute values, either positive or negative, indicate a faster movement speed. Once + * the seat's headrest reaches the positional limit, the value must reset to 0. If + * SEAT_HEADREST_ANGLE_MOVE's value is currently 0, then that means there is no movement + * currently occurring. + * + * This property is not in any particular unit but in a specified range of relative movement + * speeds. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2134,6 +2316,22 @@ enum VehicleProperty { /** * Headrest fore/aft move * + * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers + * between minInt32Value and maxInt32Value must be supported. + * + * The maxInt32Value represents the maximum movement speed of the seat's headrest while moving + * forward. + * The minInt32Value represents the maximum movement speed of the seat's headrest while moving + * backward. + * + * Larger absolute values, either positive or negative, indicate a faster movement speed. Once + * the seat's headrest reaches the positional limit, the value must reset to 0. If + * SEAT_HEADREST_FORE_AFT_MOVE's value is currently 0, then that means there is no movement + * currently occurring. + * + * This property is not in any particular unit but in a specified range of relative movement + * speeds. + * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. * @@ -2224,13 +2422,13 @@ enum VehicleProperty { /** * Represents property for seat’s hipside (bottom cushion’s side) support position. * - * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers - * between minInt32Value and maxInt32Value are supported. + * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers + * between minInt32Value and maxInt32Value must be supported. * - * maxInt32Value indicates the widest cushion side support setting (i.e. least support). - * minInt32Value indicates the thinnest cushion side support setting (i.e most support). + * The maxInt32Value indicates the widest cushion side support setting (i.e. least support). + * The minInt32Value indicates the thinnest cushion side support setting (i.e most support). * - * This value is not in any particular unit but in a specified range of steps. + * This property is not in any particular unit but in a specified range of steps. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2243,16 +2441,21 @@ enum VehicleProperty { /** * Represents property for movement direction and speed of seat cushion side support. * - * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers + * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers * between minInt32Value and maxInt32Value must be supported. * - * maxInt32Value in default area's VehicleAreaConfig represents the maximum movement speed of - * the seat cushion side support in the growing wider direction (i.e. less support). - * minInt32Value in default area's VehicleAreaConfig represents the maximum movement speed of - * the seat cushion side support in the growing thinner direction (i.e. more support). + * The maxInt32Value represents the maximum movement speed of the seat cushion side support when + * growing wider (i.e. support is decreasing). + * The minInt32Value represents the maximum movement speed of the seat cushion side support when + * growing thinner (i.e. support is increasing). * * Larger absolute values, either positive or negative, indicate a faster movement speed. Once - * the seat cushion side support reaches the positional limit, the value resets to 0. + * the seat cushion side support reaches the positional limit, the value must reset to 0. If + * SEAT_CUSHION_SIDE_SUPPORT_MOVE's value is currently 0, then that means there is no movement + * currently occurring. + * + * This property is not in any particular unit but in a specified range of relative movement + * speeds. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2265,13 +2468,13 @@ enum VehicleProperty { /** * Represents property for seat’s lumbar support vertical position. * - * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers - * between minInt32Value and maxInt32Value are supported. + * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers + * between minInt32Value and maxInt32Value must be supported. * - * maxInt32Value indicates the highest position. - * minInt32Value indicates the lowest position. + * The maxInt32Value indicates the highest position. + * The minInt32Value indicates the lowest position. * - * This value is not in any particular unit but in a specified range of steps. + * This property is not in any particular unit but in a specified range of steps. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2284,18 +2487,19 @@ enum VehicleProperty { /** * Represents property for vertical movement direction and speed of seat lumbar support. * - * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers + * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers * between minInt32Value and maxInt32Value must be supported. * - * maxInt32Value in default area's VehicleAreaConfig indicates the lumbar support is moving at - * the fastest upward speed. - * minInt32Value in default area's VehicleAreaConfig indicates the lumbar support is moving at - * the fastest downward speed. + * The maxInt32Value indicates the lumbar support is moving at the fastest upward speed. + * The minInt32Value indicates the lumbar support is moving at the fastest downward speed. * * Larger absolute values, either positive or negative, indicate a faster movement speed. Once - * the seat cushion side support reaches the positional limit, the value resets to 0. + * the seat cushion side support reaches the positional limit, the value must reset to 0. If + * SEAT_LUMBAR_VERTICAL_MOVE's value is currently 0, then that means there is no movement + * currently occurring. * - * This value is not in any particular unit but in a specified range of steps. + * This property is not in any particular unit but in a specified range of relative movement + * speeds. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2308,12 +2512,12 @@ enum VehicleProperty { /** * Represents property that indicates the current walk-in position of the seat. * - * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. + * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. * The minInt32Value must be 0. * All integers between minInt32Value and maxInt32Value must be supported. * - * minInt32Value indicates the normal seat position. - * maxInt32Value indicates the seat is in the full walk-in position. + * The minInt32Value indicates the normal seat position. + * The maxInt32Value indicates the seat is in the full walk-in position. * * Values in between minInt32Value and maxInt32Value indicate a transition state between the * normal and walk-in positions. @@ -2481,11 +2685,10 @@ enum VehicleProperty { * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All values between * minInt32Value and maxInt32Value must be supported. * - * The maxInt32Value in default area's VehicleAreaConfig indicates the steering wheel position - * closest to the driver. The minInt32Value in default area's VehicleAreaConfig indicates the - * steering wheel position furthest to the driver. + * The maxInt32Value indicates the steering wheel position closest to the driver. + * The minInt32Value indicates the steering wheel position furthest to the driver. * - * This value is not in any particular unit but in a specified range of steps. + * This property is not in any particular unit but in a specified range of steps. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2501,13 +2704,16 @@ enum VehicleProperty { * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All values between * minInt32Value and maxInt32Value must be supported. * - * The maxInt32Value in default area's VehicleAreaConfig indicates the steering wheel moving - * towards the driver. The minInt32Value in default area's VehicleAreaConfig indicates the - * steering wheel moving away from the driver. Larger integers, either positive or negative, - * indicate a faster movement speed. Once the steering wheel reaches the positional limit, the - * value resets to 0. + * The maxInt32Value indicates the steering wheel moving towards the driver. + * The minInt32Value indicates the steering wheel moving away from the driver. * - * This value is not in any particular unit but in a specified range of steps. + * Larger integers, either positive or negative, indicate a faster movement speed. Once the + * steering wheel reaches the positional limit, the value must reset to 0. If + * STEERING_WHEEL_DEPTH_MOVE's value is currently 0, then that means there is no movement + * currently occurring. + * + * This property is not in any particular unit but in a specified range of relative movement + * speeds. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2523,11 +2729,10 @@ enum VehicleProperty { * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All values between * minInt32Value and maxInt32Value must be supported. * - * The maxInt32Value in default area's VehicleAreaConfig indicates the steering wheel being in - * the highest position. The minInt32Value in default area's VehicleAreaConfig indicates the - * steering wheel being in the lowest position. + * The maxInt32Value indicates the steering wheel being in the highest position. + * The minInt32Value indicates the steering wheel being in the lowest position. * - * This value is not in any particular unit but in a specified range of steps. + * This property is not in any particular unit but in a specified range of steps. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2543,12 +2748,16 @@ enum VehicleProperty { * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All values between * minInt32Value and maxInt32Value must be supported. * - * The maxInt32Value in default area's VehicleAreaConfig indicates the steering wheel moving - * upwards. The minInt32Value in default area's VehicleAreaConfig indicates the steering wheel - * moving downwards. Larger integers, either positive or negative, indicate a faster movement - * speed. Once the steering wheel reaches the positional limit, the value resets to 0. + * The maxInt32Value indicates the steering wheel moving upwards. + * The minInt32Value indicates the steering wheel moving downwards. * - * This value is not in any particular unit but in a specified range of steps. + * Larger integers, either positive or negative, indicate a faster movement speed. Once the + * steering wheel reaches the positional limit, the value must reset to 0. If + * STEERING_WHEEL_HEIGHT_MOVE's value is currently 0, then that means there is no movement + * currently occurring. + * + * This property is not in any particular unit but in a specified range of relative movement + * speeds. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2606,8 +2815,8 @@ enum VehicleProperty { * The minInt32Value must be 0. * All integers between minInt32Value and maxInt32Value must be supported. * - * minInt32Value indicates that the glove box door is closed. - * maxInt32Value indicates that the glove box door is in the fully open position. + * The minInt32Value indicates that the glove box door is closed. + * The maxInt32Value indicates that the glove box door is in the fully open position. * * Values in between minInt32Value and maxInt32Value indicate a transition state between the * closed and fully open positions. From f77dd218aaa41e677305c5cb9fc8e26b0be5c3dc Mon Sep 17 00:00:00 2001 From: shrikar Date: Fri, 17 Mar 2023 23:04:57 +0000 Subject: [PATCH 895/998] Changed *_MOVE and *_POS HAL docs to be consistent. Bug: 259477002 Test: manual build Change-Id: Ie69333bdb68c97c844fbf0cc93bd75ffe6f58093 --- .../automotive/vehicle/VehicleProperty.aidl | 302 ++++++++++++++---- 1 file changed, 241 insertions(+), 61 deletions(-) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 9edb9b17aa..61cf14ef3d 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -1573,8 +1573,16 @@ enum VehicleProperty { /** * Door position * - * This is an integer in case a door may be set to a particular position. - * Max value indicates fully open, min value (0) indicates fully closed. + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. + * All integers between minInt32Value and maxInt32Value must be supported. + * + * The minInt32Value indicates the door is closed. The minInt32Value must be 0. + * The maxInt32Value indicates the door is fully open. + * + * Values in between minInt32Value and maxInt32Value indicate a transition state between the + * closed and fully open positions. + * + * This property is not in any particular unit but in a specified range of relative positions. * * Some vehicles (minivans) can open the door electronically. Hence, the * ability to write this property. @@ -1642,7 +1650,19 @@ enum VehicleProperty { /** * Mirror Z Position * - * Positive value indicates tilt upwards, negative value is downwards + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. + * All integers between minInt32Value and maxInt32Value must be supported. + * + * The minInt32Value indicates the mirror is tilted completely downwards. This must be a + * non-positive value. + * The maxInt32Value indicates the mirror is tilted completely upwards. This must be a + * non-negative value. + * 0 indicates the mirror is not tilted in either direction. + * + * Values in between minInt32Value and maxInt32Value indicate a transition state between the + * fully downward and fully upwards positions. + * + * This property is not in any particular unit but in a specified range of relative positions. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -1680,7 +1700,19 @@ enum VehicleProperty { /** * Mirror Y Position * - * Positive value indicate tilt right, negative value is left + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. + * All integers between minInt32Value and maxInt32Value must be supported. + * + * The minInt32Value indicates the mirror is tilted completely to the left. This must be a + * non-positive value. + * The maxInt32Value indicates the mirror is tilted completely to the right. This must be a + * non-negative value. + * 0 indicates the mirror is not tilted in either direction. + * + * Values in between minInt32Value and maxInt32Value indicate a transition state between the + * left extreme and right extreme positions. + * + * This property is not in any particular unit but in a specified range of relative positions. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -1823,8 +1855,17 @@ enum VehicleProperty { * Seatbelt height position * * Adjusts the shoulder belt anchor point. - * Max value indicates highest position - * Min value indicates lowest position + * + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. + * All integers between minInt32Value and maxInt32Value must be supported. + * + * The minInt32Value indicates the seat belt's shoulder anchor is at its lowest position. + * The maxInt32Value indicates the seat belt's shoulder anchor is at its highest position. + * + * Values in between minInt32Value and maxInt32Value indicate a transition state between the + * lowest and highest positions. + * + * This property is not in any particular unit but in a specified range of relative positions. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -1864,9 +1905,18 @@ enum VehicleProperty { /** * Seat fore/aft position * - * Sets the seat position forward (closer to steering wheel) and backwards. - * Max value indicates closest to wheel, min value indicates most rearward - * position. + * Sets the seat position forward and backwards. + * + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. + * All integers between minInt32Value and maxInt32Value must be supported. + * + * The minInt32Value indicates the seat is at its rearward-most linear position. + * The maxInt32Value indicates the seat is at its forward-most linear position. + * + * Values in between minInt32Value and maxInt32Value indicate a transition state between the + * closest and farthest positions. + * + * This property is not in any particular unit but in a specified range of relative positions. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -1906,8 +1956,19 @@ enum VehicleProperty { * Seat backrest angle 1 position * * Backrest angle 1 is the actuator closest to the bottom of the seat. - * Max value indicates angling forward towards the steering wheel. - * Min value indicates full recline. + * + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. + * All integers between minInt32Value and maxInt32Value must be supported. + * + * The minInt32Value indicates the seat backrest's full recline position w.r.t the + * actuator at the bottom of the seat. + * The maxInt32Value indicates the seat backrest's most upright/forward position w.r.t the + * actuator at the bottom of the seat. + * + * Values in between minInt32Value and maxInt32Value indicate a transition state between the + * full recline and upright/forward positions. + * + * This property is not in any particular unit but in a specified range of relative positions. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -1947,8 +2008,21 @@ enum VehicleProperty { * Seat backrest angle 2 position * * Backrest angle 2 is the next actuator up from the bottom of the seat. - * Max value indicates angling forward towards the steering wheel. - * Min value indicates full recline. + * + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers + * between minInt32Value and maxInt32Value must be supported. + * + * The minInt32Value indicates the seat backrest's full recline position w.r.t the next + * actuator in the backrest from the one at the bottom of the seat (see + * SEAT_BACKREST_ANGLE_1_POS for additional details). + * The maxInt32Value indicates the seat backrest's most upright/forward position w.r.t the + * next actuator in the backrest from the one at the bottom of the seat(see + * SEAT_BACKREST_ANGLE_1_POS for additional details). + * + * Values in between minInt32Value and maxInt32Value indicate a transition state between the + * full recline and upright/forward positions. + * + * This property is not in any particular unit but in a specified range of relative positions. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -1987,9 +2061,16 @@ enum VehicleProperty { /** * Seat height position * - * Sets the seat height. - * Max value indicates highest position. - * Min value indicates lowest position. + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. + * All integers between minInt32Value and maxInt32Value must be supported. + * + * The minInt32Value indicates the seat is in its lowest position. + * The maxInt32Value indicates the seat is in its highest position. + * + * Values in between minInt32Value and maxInt32Value indicate a transition state between the + * lowest and highest positions. + * + * This property is not in any particular unit but in a specified range of relative positions. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2027,8 +2108,20 @@ enum VehicleProperty { * Seat depth position * * Sets the seat depth, distance from back rest to front edge of seat. - * Max value indicates longest depth position. - * Min value indicates shortest position. + * + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. + * All integers between minInt32Value and maxInt32Value must be supported. + * + * The minInt32Value indicates the seat is in its shallowest position (i.e. the position with + * the smallest distance between the front edge of the seat cushion and the rear end of the + * seat). + * The maxInt32Value indicates the seat is in its deepest position (i.e. the position with the + * largest distance between the front edge of the seat cushion and the rear end of the seat). + * + * Values in between minInt32Value and maxInt32Value indicate a transition state between the + * shallowest and deepest positions. + * + * This property is not in any particular unit but in a specified range of relative positions. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2066,9 +2159,20 @@ enum VehicleProperty { /** * Seat tilt position * - * Sets the seat tilt. - * Max value indicates front edge of seat higher than back edge. - * Min value indicates front edge of seat lower than back edge. + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. + * All integers between minInt32Value and maxInt32Value must be supported. + * + * The minInt32Value indicates the seat bottom is angled at its lowest angular position. This + * corresponds to the seat's front edge at its lowest possible position relative to the rear + * end of the seat. + * The maxInt32Value indicates the seat bottom is angled at its highest angular position. This + * corresponds to the seat's front edge at its highest possible position relative to the rear + * end of the seat. + * + * Values in between minInt32Value and maxInt32Value indicate a transition state between the + * lowest and highest positions. + * + * This property is not in any particular unit but in a specified range of relative positions. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2107,9 +2211,18 @@ enum VehicleProperty { /** * Lumber fore/aft position * - * Pushes the lumbar support forward and backwards - * Max value indicates most forward position. - * Min value indicates most rearward position. + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. + * All integers between minInt32Value and maxInt32Value must be supported. + * + * The minInt32Value indicates the lumbar support is in its rearward most position (i.e. least + * supportive position). + * The maxInt32Value indicates the lumbar support is in its forward most position (i.e. most + * supportive position). + * + * Values in between minInt32Value and maxInt32Value indicate a transition state between the + * forward and rearward positions. + * + * This property is not in any particular unit but in a specified range of relative positions. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2149,9 +2262,18 @@ enum VehicleProperty { /** * Lumbar side support position * - * Sets the amount of lateral lumbar support. - * Max value indicates widest lumbar setting (i.e. least support) - * Min value indicates thinnest lumbar setting. + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. + * All integers between minInt32Value and maxInt32Value must be supported. + * + * The minInt32Value indicates the lumbar side support is in its thinnest position (i.e. + * most support). + * The maxInt32Value indicates the lumbar side support is in its widest position (i.e. + * least support). + * + * Values in between minInt32Value and maxInt32Value indicate a transition state between the + * thinnest and widest positions. + * + * This property is not in any particular unit but in a specified range of relative positions. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2214,11 +2336,16 @@ enum VehicleProperty { * Sets the headrest height for supported seats. VehiclePropConfig.areaConfigs specifies which * seats are supported. * - * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All values - * between minInt32Value and maxInt32Value must be supported. The maxInt32Value indicates the - * tallest setting and the minInt32Value indicates the shortest setting. + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. + * All integers between minInt32Value and maxInt32Value must be supported. * - * This property is not in any particular unit but in a specified range of steps. + * The minInt32Value indicates the headrest is in its lowest position. + * The maxInt32Value indicates the headrest is in its highest position. + * + * Values in between minInt32Value and maxInt32Value indicate a transition state between the + * lowest and highest positions. + * + * This property is not in any particular unit but in a specified range of relative positions. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2259,9 +2386,16 @@ enum VehicleProperty { /** * Headrest angle position * - * Sets the angle of the headrest. - * Max value indicates most upright angle. - * Min value indicates shallowest headrest angle. + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. + * All integers between minInt32Value and maxInt32Value must be supported. + * + * The minInt32Value indicates the headrest is in its full recline position. + * The maxInt32Value indicates the headrest is in its most upright/forward position. + * + * Values in between minInt32Value and maxInt32Value indicate a transition state between the + * full recline and most upright/forward positions. + * + * This property is not in any particular unit but in a specified range of relative positions. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2301,9 +2435,16 @@ enum VehicleProperty { /** * Headrest fore/aft position * - * Adjusts the headrest forwards and backwards. - * Max value indicates position closest to front of car. - * Min value indicates position closest to rear of car. + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. + * All integers between minInt32Value and maxInt32Value must be supported. + * + * The minInt32Value indicates the headrest is in its rearward-most linear position. + * The maxInt32Value indicates the headrest is in its forward-most linear position. + * + * Values in between minInt32Value and maxInt32Value indicate a transition state between the + * forward and rearward positions. + * + * This property is not in any particular unit but in a specified range of relative positions. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2425,10 +2566,15 @@ enum VehicleProperty { * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers * between minInt32Value and maxInt32Value must be supported. * - * The maxInt32Value indicates the widest cushion side support setting (i.e. least support). - * The minInt32Value indicates the thinnest cushion side support setting (i.e most support). + * The maxInt32Value indicates the seat cushion side support is in its widest position (i.e. + * least support). + * The minInt32Value indicates the seat cushion side support is in its thinnest position (i.e. + * most support). * - * This property is not in any particular unit but in a specified range of steps. + * Values in between minInt32Value and maxInt32Value indicate a transition state between the + * thinnest and widest positions. + * + * This property is not in any particular unit but in a specified range of relative positions. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2471,10 +2617,13 @@ enum VehicleProperty { * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers * between minInt32Value and maxInt32Value must be supported. * - * The maxInt32Value indicates the highest position. - * The minInt32Value indicates the lowest position. + * The maxInt32Value indicates the lumbar support's highest position. + * The minInt32Value indicates the lumbar support's lowest position. * - * This property is not in any particular unit but in a specified range of steps. + * Values in between minInt32Value and maxInt32Value indicate a transition state between the + * lowest and highest positions. + * + * This property is not in any particular unit but in a specified range of relative positions. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2513,15 +2662,16 @@ enum VehicleProperty { * Represents property that indicates the current walk-in position of the seat. * * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. - * The minInt32Value must be 0. * All integers between minInt32Value and maxInt32Value must be supported. * - * The minInt32Value indicates the normal seat position. + * The minInt32Value indicates the normal seat position. The minInt32Value must be 0. * The maxInt32Value indicates the seat is in the full walk-in position. * * Values in between minInt32Value and maxInt32Value indicate a transition state between the * normal and walk-in positions. * + * This property is not in any particular unit but in a specified range of relative positions. + * * The area ID must match the seat that actually moves when the walk-in feature activates, not * the intended seat the passengers will sit in. * @@ -2548,16 +2698,29 @@ enum VehicleProperty { /** * Window Position * - * Min = window up / closed - * Max = window down / open + * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. + * All integers between minInt32Value and maxInt32Value must be supported. * - * For a window that may open out of plane (i.e. vent mode of sunroof) this - * parameter will work with negative values as follows: - * Max = sunroof completely open - * 0 = sunroof closed. - * Min = sunroof vent completely open + * The minInt32Value indicates the window is closed/fully open out of plane. If the window + * cannot open out of plane, then minInt32Value is the position of the window when fully closed + * and must be 0. If the window can open out of plane, the minInt32Value indicates the window + * is fully open in its position out of plane and will be a negative value. See the example + * below for a more detailed explanation. + * The maxInt32Value indicates the window is fully open. * - * Note that in this mode, 0 indicates the window is closed. + * Values in between minInt32Value and maxInt32Value indicate a transition state between the + * closed/fully open out-of-plane and fully open positions. + * + * This property is not in any particular unit but in a specified range of relative positions. + * + * For example, this is how the property should work for a window that can move out of plane: + * For a window that may open out of plane (i.e. vent mode of sunroof) this + * parameter will work with negative values as follows: + * Max = sunroof completely open + * 0 = sunroof closed. + * Min = sunroof vent completely open + * + * Note that in this mode, 0 indicates the window is closed. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2570,10 +2733,20 @@ enum VehicleProperty { /** * Window Move * - * Max = Open the window as fast as possible - * Min = Close the window as fast as possible - * Magnitude denotes relative speed. I.e. +2 is faster than +1 in closing - * the window. + * The maxInt32Value and minInt32Value in each VehicleAreaConfig must be defined. All integers + * between minInt32Value and maxInt32Value must be supported. + * + * The maxInt32Value indicates the window is opening in plane/closing in the out of plane + * direction at the fastest speed. + * The minInt32Value indicates the window is closing in plane/opening in the out of plane + * direction at the fastest speed. + * + * Larger absolute values, either positive or negative, indicate a faster movement speed. Once + * the window reaches the positional limit, the value must reset to 0. If WINDOW_MOVE's value is + * currently 0, then that means there is no movement currently occurring. + * + * This property is not in any particular unit but in a specified range of relative movement + * speeds. * * For a window that may open out of plane (i.e. vent mode of sunroof) this * parameter will work as follows: @@ -2688,7 +2861,10 @@ enum VehicleProperty { * The maxInt32Value indicates the steering wheel position closest to the driver. * The minInt32Value indicates the steering wheel position furthest to the driver. * - * This property is not in any particular unit but in a specified range of steps. + * Values in between minInt32Value and maxInt32Value indicate a transition state between the + * closest and furthest positions. + * + * This property is not in any particular unit but in a specified range of relative positions. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2732,7 +2908,10 @@ enum VehicleProperty { * The maxInt32Value indicates the steering wheel being in the highest position. * The minInt32Value indicates the steering wheel being in the lowest position. * - * This property is not in any particular unit but in a specified range of steps. + * Values in between minInt32Value and maxInt32Value indicate a transition state between the + * lowest and highest positions. + * + * This property is not in any particular unit but in a specified range of relative positions. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -2812,15 +2991,16 @@ enum VehicleProperty { * Property that represents the current position of the glove box door. * * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. - * The minInt32Value must be 0. * All integers between minInt32Value and maxInt32Value must be supported. * - * The minInt32Value indicates that the glove box door is closed. + * The minInt32Value indicates that the glove box door is closed. The minInt32Value must be 0. * The maxInt32Value indicates that the glove box door is in the fully open position. * * Values in between minInt32Value and maxInt32Value indicate a transition state between the * closed and fully open positions. * + * This property is not in any particular unit but in a specified range of relative positions. + * * The area ID must match the seat by which the glove box is intended to be used (e.g. if the * front right dashboard has a glove box embedded in it, then the area ID should be * SEAT_1_RIGHT). From 45bd6fa885318f9cdacf653ece3362135bdc0c94 Mon Sep 17 00:00:00 2001 From: shrikar Date: Mon, 3 Apr 2023 22:12:32 +0000 Subject: [PATCH 896/998] Changed STEERING_WHEEL_DEPTH min/max value definition in HAL. Bug: 276327125 Test: manual build Change-Id: I5a5cf3033ac50d3816b508544315a16a52161b35 --- .../hardware/automotive/vehicle/VehicleProperty.aidl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 61cf14ef3d..dc11d62d2c 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -2858,8 +2858,8 @@ enum VehicleProperty { * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All values between * minInt32Value and maxInt32Value must be supported. * - * The maxInt32Value indicates the steering wheel position closest to the driver. - * The minInt32Value indicates the steering wheel position furthest to the driver. + * The maxInt32Value indicates the steering wheel position furthest from the driver. + * The minInt32Value indicates the steering wheel position closest to the driver. * * Values in between minInt32Value and maxInt32Value indicate a transition state between the * closest and furthest positions. @@ -2880,8 +2880,8 @@ enum VehicleProperty { * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All values between * minInt32Value and maxInt32Value must be supported. * - * The maxInt32Value indicates the steering wheel moving towards the driver. - * The minInt32Value indicates the steering wheel moving away from the driver. + * The maxInt32Value indicates the steering wheel moving away from the driver. + * The minInt32Value indicates the steering wheel moving towards the driver. * * Larger integers, either positive or negative, indicate a faster movement speed. Once the * steering wheel reaches the positional limit, the value must reset to 0. If From 0eca9c3d6bde09c5cc719d525c0541480edaf5b8 Mon Sep 17 00:00:00 2001 From: shrikar Date: Tue, 4 Apr 2023 01:46:42 +0000 Subject: [PATCH 897/998] Added info to docs to answer Q20 from Ford pending questions. Bug: 259309511 Test: manual build Change-Id: I921a7fc0a896e7343d0f0c51a1eb40f5e95aee10 --- .../automotive/vehicle/VehicleProperty.aidl | 92 +++++++++++++------ 1 file changed, 62 insertions(+), 30 deletions(-) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 61cf14ef3d..cf4c91475d 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -428,10 +428,10 @@ enum VehicleProperty { * * Each tires is identified by its areaConfig.areaId config and their * minFloatValue/maxFloatValue are used to store OEM recommended pressure - * range. - * The Min value in the areaConfig data represents the lower bound of + * range. The minFloatValue and maxFloatValue in VehicleAreaConfig must be defined. + * The minFloatValue in the areaConfig data represents the lower bound of * the recommended tire pressure. - * The Max value in the areaConfig data represents the upper bound of + * The maxFloatValue in the areaConfig data represents the upper bound of * the recommended tire pressure. * For example: * The following areaConfig indicates the recommended tire pressure @@ -697,6 +697,14 @@ enum VehicleProperty { * * Fan speed setting * + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. + * All integers between minInt32Value and maxInt32Value must be supported. + * + * The minInt32Value indicates the lowest fan speed. + * The maxInt32Value indicates the highest fan speed. + * + * This property is not in any particular unit but in a specified range of relative speeds. + * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. * @@ -885,13 +893,15 @@ enum VehicleProperty { /** * Seat heating/cooling * - * Negative values indicate cooling. - * 0 indicates off. - * Positive values indicate heating. + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. + * All integers between minInt32Value and maxInt32Value must be supported. * - * Some vehicles may have multiple levels of heating and cooling. The - * min/max range defines the allowable range and number of steps in each - * direction. + * The maxInt32Value indicates the maximum seat temperature heating setting. + * The minInt32Value must be 0, unless the vehicle supports seat cooling as well. In this case, + * minInt32Value indicates the maximum seat temperature cooling setting. + * + * This property is not in any particular unit, but in a specified range of relative temperature + * settings. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -905,8 +915,15 @@ enum VehicleProperty { * Side Mirror Heat * * Increasing values denote higher heating levels for side mirrors. - * The Max value in the config data represents the highest heating level. - * The Min value in the config data MUST be zero and indicates no heating. + * + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. + * All integers between minInt32Value and maxInt32Value must be supported. + * + * The maxInt32Value in the config data represents the maximum heating level. + * The minInt32Value in the config data MUST be zero and indicates no heating. + * + * This property is not in any particular unit but in a specified range of relative heating + * settings. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -919,11 +936,16 @@ enum VehicleProperty { /** * Steering Wheel Heating/Cooling * - * Sets the amount of heating/cooling for the steering wheel - * config data Min and Max MUST be set appropriately. - * Positive value indicates heating. - * Negative value indicates cooling. - * 0 indicates temperature control is off. + * Sets the amount of heating/cooling for the steering wheel. + * + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. + * All integers between minInt32Value and maxInt32Value must be supported. + * + * The maxInt32Value indicates the maximum steering wheel heating setting. + * The minInt32Value should be 0, unless the vehicle supports steering wheel cooling as well. In + * such a case, the minInt32Value indicates the maximum steering wheel cooling setting. + * + * This property is not in any particular unit but in a specified range of heating settings. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -1048,8 +1070,14 @@ enum VehicleProperty { /** * Seat ventilation * - * 0 indicates off. - * Positive values indicates ventilation level. + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. + * All integers between minInt32Value and maxInt32Value must be supported. + * + * The minInt32Value must be 0. + * The maxInt32Value indicates the maximum ventilation setting available for the seat. + * + * This property is not in any particular unit but in the specified range of ventilation + * settings. * * Used by HVAC apps and Assistant to enable, change, or read state of seat * ventilation. This is different than seating cooling. It can be on at the @@ -1810,13 +1838,14 @@ enum VehicleProperty { /** * Seat memory select * - * This parameter selects the memory preset to use to select the seat - * position. The minValue is always 0, and the maxValue determines the - * number of seat preset memory slots available (i.e. numSeatPresets - 1). + * This parameter selects the memory preset to use to select the seat position. The + * maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. All integers between + * minInt32Value and maxInt32Value must be supported. The minInt32Value is always 0, and the + * maxInt32Value determines the number of seat preset memory slots available (i.e. + * numSeatPresets - 1). * - * For instance, if the driver's seat has 3 memory presets, the maxValue - * will be 2. When the user wants to select a preset, the desired preset - * number (0, 1, or 2) is set. + * For instance, if the driver's seat has 3 memory presets, the maxInt32Value will be 2. When + * the user wants to select a preset, the desired preset number (0, 1, or 2) is set. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.WRITE @@ -1826,9 +1855,10 @@ enum VehicleProperty { /** * Seat memory set * - * This setting allows the user to save the current seat position settings - * into the selected preset slot. The maxValue for each seat position - * must match the maxValue for SEAT_MEMORY_SELECT. + * This setting allows the user to save the current seat position settings into the selected + * preset slot. The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. The + * minInt32Value must be 0, and the maxInt32Value for each seat position must match the + * maxInt32Value for SEAT_MEMORY_SELECT. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.WRITE @@ -2794,8 +2824,9 @@ enum VehicleProperty { * When an intermittent wiper setting is selected, this property value must be set to 0 during * the "pause" period of the intermittent wiping. * - * The maxInt32Value for each area ID must specify the longest wiper period. The minInt32Value - * must be set to 0 for each area ID. + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. The maxInt32Value + * for each area ID must specify the longest wiper period. The minInt32Value must be set to 0 + * for each area ID. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ @@ -4762,7 +4793,7 @@ enum VehicleProperty { /** * Current target speed for Cruise Control (CC). * - * OEMs should set the minInt32Value and maxInt32Value values for this property to define the + * OEMs should set the minFloatValue and maxFloatValue values for this property to define the * min and max target speed values. These values must be non-negative. * * The maxFloatValue represents the upper bound of the target speed. @@ -4811,6 +4842,7 @@ enum VehicleProperty { * Returns the measured distance in millimeters between the rear-most point of the leading * vehicle and the front-most point of the ACC vehicle. * + * The maxInt32Value and minInt32Value in VehicleAreaConfig must be defined. * The minInt32Value should be 0. * The maxInt32Value should be populated with the maximum range the distance sensor can support. * This value should be non-negative. From 90059381f0b69fe7933af60610e9651a57840887 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Fri, 7 Apr 2023 22:56:43 +0000 Subject: [PATCH 898/998] Do not check the returned value in the VTS test for IWifiChip#getFeatureSet. Some implementations of the legacy HAL, such as Goldfish, do not have any supported features. Bug: 273886122 Test: atest VtsHalWifiChipTargetTest (tested on Cuttlefish) Change-Id: I3ca22187cab0e77d36a28908e57ff4970535e4ae --- wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp index ca88d8e850..bbd27f95e3 100644 --- a/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp +++ b/wifi/aidl/vts/functional/wifi_chip_aidl_test.cpp @@ -189,8 +189,8 @@ TEST_P(WifiChipAidlTest, RegisterEventCallback) { */ TEST_P(WifiChipAidlTest, GetFeatureSet) { configureChipForConcurrencyType(IfaceConcurrencyType::STA); - int32_t features = getChipFeatureSet(wifi_chip_); - EXPECT_NE(features, 0); + int32_t features; + EXPECT_TRUE(wifi_chip_->getFeatureSet(&features).isOk()); } /* From ec1198d941f61ca6bf35143c816a495bc4a9cf3a Mon Sep 17 00:00:00 2001 From: Alex Buynytskyy Date: Tue, 4 Apr 2023 19:52:27 +0000 Subject: [PATCH 899/998] UpsideDownCake is now 34 Ignore-AOSP-First: UpsideDownCake Finalization Bug: 275409981 Test: build Change-Id: I832ab7a8b5445ba85e27bbcf5be64906bfa0e5be --- audio/aidl/Android.bp | 39 +- .../android.hardware.audio.common/2/.hash | 1 + .../audio/common/AudioOffloadMetadata.aidl | 42 ++ .../audio/common/PlaybackTrackMetadata.aidl | 43 ++ .../audio/common/RecordTrackMetadata.aidl | 42 ++ .../hardware/audio/common/SinkMetadata.aidl | 38 ++ .../hardware/audio/common/SourceMetadata.aidl | 38 ++ .../1/.hash | 1 + .../audio/core/sounddose/ISoundDose.aidl | 52 +++ .../android.hardware.audio.core/1/.hash | 1 + .../hardware/audio/core/AudioPatch.aidl | 42 ++ .../hardware/audio/core/AudioRoute.aidl | 40 ++ .../hardware/audio/core/IBluetooth.aidl | 61 +++ .../hardware/audio/core/IBluetoothA2dp.aidl | 41 ++ .../hardware/audio/core/IBluetoothLe.aidl | 41 ++ .../android/hardware/audio/core/IConfig.aidl | 39 ++ .../android/hardware/audio/core/IModule.aidl | 118 ++++++ .../hardware/audio/core/IStreamCallback.aidl | 40 ++ .../hardware/audio/core/IStreamCommon.aidl | 44 ++ .../hardware/audio/core/IStreamIn.aidl | 58 +++ .../hardware/audio/core/IStreamOut.aidl | 54 +++ .../audio/core/IStreamOutEventCallback.aidl | 39 ++ .../hardware/audio/core/ITelephony.aidl | 56 +++ .../audio/core/MmapBufferDescriptor.aidl | 41 ++ .../hardware/audio/core/ModuleDebug.aidl | 39 ++ .../hardware/audio/core/StreamDescriptor.aidl | 93 +++++ .../audio/core/SurroundSoundConfig.aidl | 43 ++ .../hardware/audio/core/VendorParameter.aidl | 39 ++ .../android.hardware.audio.effect/1/.hash | 1 + .../audio/effect/AcousticEchoCanceler.aidl | 45 +++ .../audio/effect/AutomaticGainControlV1.aidl | 46 +++ .../audio/effect/AutomaticGainControlV2.aidl | 51 +++ .../hardware/audio/effect/BassBoost.aidl | 44 ++ .../hardware/audio/effect/Capability.aidl | 39 ++ .../hardware/audio/effect/CommandId.aidl | 50 +++ .../audio/effect/DefaultExtension.aidl | 38 ++ .../hardware/audio/effect/Descriptor.aidl | 70 ++++ .../hardware/audio/effect/Downmix.aidl | 49 +++ .../audio/effect/DynamicsProcessing.aidl | 115 ++++++ .../audio/effect/EnvironmentalReverb.aidl | 54 +++ .../hardware/audio/effect/Equalizer.aidl | 64 +++ .../android/hardware/audio/effect/Flags.aidl | 74 ++++ .../audio/effect/HapticGenerator.aidl | 65 +++ .../hardware/audio/effect/IEffect.aidl | 56 +++ .../hardware/audio/effect/IFactory.aidl | 41 ++ .../audio/effect/LoudnessEnhancer.aidl | 44 ++ .../audio/effect/NoiseSuppression.aidl | 57 +++ .../hardware/audio/effect/Parameter.aidl | 95 +++++ .../hardware/audio/effect/PresetReverb.aidl | 55 +++ .../hardware/audio/effect/Processing.aidl | 44 ++ .../android/hardware/audio/effect/Range.aidl | 133 ++++++ .../android/hardware/audio/effect/State.aidl | 40 ++ .../audio/effect/VendorExtension.aidl | 38 ++ .../hardware/audio/effect/Virtualizer.aidl | 58 +++ .../hardware/audio/effect/Visualizer.aidl | 65 +++ .../android/hardware/audio/effect/Volume.aidl | 45 +++ audio/aidl/sounddose/Android.bp | 6 + .../android.hardware.audio.sounddose/1/.hash | 1 + .../audio/sounddose/ISoundDoseFactory.aidl | 38 ++ automotive/audiocontrol/aidl/Android.bp | 8 + .../3/.hash | 1 + .../audiocontrol/AudioFocusChange.aidl | 45 +++ .../audiocontrol/AudioGainConfigInfo.aidl | 40 ++ .../automotive/audiocontrol/DuckingInfo.aidl | 42 ++ .../audiocontrol/IAudioControl.aidl | 51 +++ .../audiocontrol/IAudioGainCallback.aidl | 38 ++ .../audiocontrol/IFocusListener.aidl | 41 ++ .../audiocontrol/IModuleChangeCallback.aidl | 38 ++ .../automotive/audiocontrol/MutingInfo.aidl | 40 ++ .../automotive/audiocontrol/Reasons.aidl | 47 +++ automotive/can/aidl/Android.bp | 8 + .../android.hardware.automotive.can/1/.hash | 1 + .../hardware/automotive/can/BusConfig.aidl | 46 +++ .../automotive/can/ICanController.aidl | 41 ++ .../automotive/can/IndexedInterface.aidl | 38 ++ .../automotive/can/InterfaceType.aidl | 41 ++ .../automotive/can/NativeInterface.aidl | 42 ++ .../hardware/automotive/can/Result.aidl | 45 +++ .../automotive/can/SlcanInterface.aidl | 42 ++ .../automotive/can/VirtualInterface.aidl | 38 ++ automotive/evs/aidl/Android.bp | 9 + .../android.hardware.automotive.evs/2/.hash | 1 + .../hardware/automotive/evs/BufferDesc.aidl | 47 +++ .../hardware/automotive/evs/CameraDesc.aidl | 40 ++ .../hardware/automotive/evs/CameraParam.aidl | 49 +++ .../hardware/automotive/evs/ColorChannel.aidl | 41 ++ .../hardware/automotive/evs/DeviceStatus.aidl | 39 ++ .../automotive/evs/DeviceStatusType.aidl | 41 ++ .../hardware/automotive/evs/DisplayDesc.aidl | 42 ++ .../hardware/automotive/evs/DisplayState.aidl | 42 ++ .../hardware/automotive/evs/EmbeddedData.aidl | 40 ++ .../hardware/automotive/evs/EvsEventDesc.aidl | 40 ++ .../hardware/automotive/evs/EvsEventType.aidl | 44 ++ .../hardware/automotive/evs/EvsResult.aidl | 48 +++ .../automotive/evs/ExposureParameters.aidl | 42 ++ .../automotive/evs/GridStatisticDesc.aidl | 42 ++ .../automotive/evs/GridStatisticType.aidl | 41 ++ .../automotive/evs/GridStatistics.aidl | 39 ++ .../hardware/automotive/evs/Histogram.aidl | 42 ++ .../hardware/automotive/evs/IEvsCamera.aidl | 55 +++ .../automotive/evs/IEvsCameraStream.aidl | 39 ++ .../hardware/automotive/evs/IEvsDisplay.aidl | 42 ++ .../automotive/evs/IEvsEnumerator.aidl | 51 +++ .../evs/IEvsEnumeratorStatusCallback.aidl | 38 ++ .../automotive/evs/IEvsUltrasonicsArray.aidl | 42 ++ .../evs/IEvsUltrasonicsArrayStream.aidl | 39 ++ .../automotive/evs/ParameterRange.aidl | 40 ++ .../hardware/automotive/evs/Rotation.aidl | 41 ++ .../automotive/evs/RotationQuaternion.aidl | 41 ++ .../hardware/automotive/evs/SensorPose.aidl | 39 ++ .../android/hardware/automotive/evs/Size.aidl | 39 ++ .../hardware/automotive/evs/Stream.aidl | 45 +++ .../hardware/automotive/evs/StreamType.aidl | 39 ++ .../hardware/automotive/evs/Translation.aidl | 40 ++ .../automotive/evs/UltrasonicSensor.aidl | 40 ++ .../automotive/evs/UltrasonicsArrayDesc.aidl | 41 ++ .../evs/UltrasonicsDataFrameDesc.aidl | 43 ++ automotive/ivn_android_device/aidl/Android.bp | 9 +- .../android.hardware.automotive.ivn/1/.hash | 1 + .../automotive/ivn/ConnectProtocol.aidl | 38 ++ .../hardware/automotive/ivn/EndpointInfo.aidl | 41 ++ .../automotive/ivn/HardwareIdentifiers.aidl | 43 ++ .../automotive/ivn/IIvnAndroidDevice.aidl | 43 ++ .../hardware/automotive/ivn/OccupantType.aidl | 40 ++ .../automotive/ivn/OccupantZoneInfo.aidl | 40 ++ automotive/remoteaccess/Android.bp | 8 + .../1/.hash | 1 + .../automotive/remoteaccess/ApState.aidl | 39 ++ .../remoteaccess/IRemoteAccess.aidl | 43 ++ .../remoteaccess/IRemoteTaskCallback.aidl | 38 ++ automotive/vehicle/aidl/Android.bp | 7 +- .../2/.hash | 1 + .../automotive/vehicle/GetValueRequest.aidl | 39 ++ .../automotive/vehicle/GetValueRequests.aidl | 39 ++ .../automotive/vehicle/GetValueResult.aidl | 40 ++ .../automotive/vehicle/GetValueResults.aidl | 39 ++ .../hardware/automotive/vehicle/IVehicle.aidl | 46 +++ .../automotive/vehicle/IVehicleCallback.aidl | 41 ++ .../automotive/vehicle/RawPropValues.aidl | 42 ++ .../automotive/vehicle/SetValueRequest.aidl | 39 ++ .../automotive/vehicle/SetValueRequests.aidl | 39 ++ .../automotive/vehicle/SetValueResult.aidl | 39 ++ .../automotive/vehicle/SetValueResults.aidl | 39 ++ .../automotive/vehicle/StatusCode.aidl | 48 +++ .../automotive/vehicle/SubscribeOptions.aidl | 40 ++ .../automotive/vehicle/VehicleAreaConfig.aidl | 45 +++ .../automotive/vehicle/VehiclePropConfig.aidl | 45 +++ .../vehicle/VehiclePropConfigs.aidl | 39 ++ .../automotive/vehicle/VehiclePropError.aidl | 40 ++ .../automotive/vehicle/VehiclePropErrors.aidl | 39 ++ .../automotive/vehicle/VehiclePropValue.aidl | 42 ++ .../automotive/vehicle/VehiclePropValues.aidl | 40 ++ .../vehicle/VehiclePropertyAccess.aidl | 41 ++ .../vehicle/VehiclePropertyChangeMode.aidl | 40 ++ .../vehicle/VehiclePropertyStatus.aidl | 40 ++ automotive/vehicle/aidl_property/Android.bp | 7 +- .../2/.hash | 1 + .../AutomaticEmergencyBrakingState.aidl | 41 ++ .../vehicle/BlindSpotWarningState.aidl | 40 ++ .../automotive/vehicle/CreateUserRequest.aidl | 41 ++ .../vehicle/CreateUserResponse.aidl | 40 ++ .../automotive/vehicle/CreateUserStatus.aidl | 39 ++ .../vehicle/CruiseControlCommand.aidl | 43 ++ .../vehicle/CruiseControlState.aidl | 43 ++ .../automotive/vehicle/CruiseControlType.aidl | 41 ++ .../automotive/vehicle/CustomInputType.aidl | 47 +++ .../vehicle/DiagnosticFloatSensorIndex.aidl | 108 +++++ .../vehicle/DiagnosticIntegerSensorIndex.aidl | 69 ++++ .../ElectronicTollCollectionCardStatus.aidl | 41 ++ .../ElectronicTollCollectionCardType.aidl | 40 ++ .../vehicle/EmergencyLaneKeepAssistState.aidl | 44 ++ .../automotive/vehicle/ErrorState.aidl | 43 ++ .../automotive/vehicle/EvChargeState.aidl | 42 ++ .../automotive/vehicle/EvConnectorType.aidl | 50 +++ .../vehicle/EvRegenerativeBrakingState.aidl | 41 ++ .../automotive/vehicle/EvStoppingMode.aidl | 41 ++ .../vehicle/EvsServiceRequestIndex.aidl | 39 ++ .../automotive/vehicle/EvsServiceState.aidl | 39 ++ .../automotive/vehicle/EvsServiceType.aidl | 46 +++ .../vehicle/ForwardCollisionWarningState.aidl | 40 ++ .../hardware/automotive/vehicle/FuelType.aidl | 50 +++ .../vehicle/GsrComplianceRequirementType.aidl | 39 ++ .../vehicle/HandsOnDetectionDriverState.aidl | 40 ++ .../vehicle/HandsOnDetectionWarning.aidl | 40 ++ .../vehicle/InitialUserInfoRequest.aidl | 40 ++ .../vehicle/InitialUserInfoRequestType.aidl | 42 ++ .../vehicle/InitialUserInfoResponse.aidl | 42 ++ .../InitialUserInfoResponseAction.aidl | 40 ++ .../vehicle/LaneCenteringAssistCommand.aidl | 39 ++ .../vehicle/LaneCenteringAssistState.aidl | 43 ++ .../vehicle/LaneDepartureWarningState.aidl | 41 ++ .../vehicle/LaneKeepAssistState.aidl | 42 ++ .../vehicle/LocationCharacterization.aidl | 46 +++ .../vehicle/Obd2CommonIgnitionMonitors.aidl | 43 ++ .../Obd2CompressionIgnitionMonitors.aidl | 55 +++ .../vehicle/Obd2FuelSystemStatus.aidl | 42 ++ .../automotive/vehicle/Obd2FuelType.aidl | 61 +++ .../vehicle/Obd2IgnitionMonitorKind.aidl | 39 ++ .../vehicle/Obd2SecondaryAirStatus.aidl | 41 ++ .../vehicle/Obd2SparkIgnitionMonitors.aidl | 59 +++ .../automotive/vehicle/PortLocationType.aidl | 44 ++ .../vehicle/ProcessTerminationReason.aidl | 40 ++ .../automotive/vehicle/RemoveUserRequest.aidl | 40 ++ .../automotive/vehicle/RotaryInputType.aidl | 39 ++ .../vehicle/SwitchUserMessageType.aidl | 43 ++ .../automotive/vehicle/SwitchUserRequest.aidl | 41 ++ .../vehicle/SwitchUserResponse.aidl | 41 ++ .../automotive/vehicle/SwitchUserStatus.aidl | 39 ++ .../automotive/vehicle/TrailerState.aidl | 41 ++ .../UserIdentificationAssociation.aidl | 39 ++ ...UserIdentificationAssociationSetValue.aidl | 41 ++ .../UserIdentificationAssociationType.aidl | 43 ++ .../UserIdentificationAssociationValue.aidl | 41 ++ .../vehicle/UserIdentificationGetRequest.aidl | 41 ++ .../vehicle/UserIdentificationResponse.aidl | 41 ++ .../UserIdentificationSetAssociation.aidl | 39 ++ .../vehicle/UserIdentificationSetRequest.aidl | 41 ++ .../hardware/automotive/vehicle/UserInfo.aidl | 45 +++ .../automotive/vehicle/UsersInfo.aidl | 40 ++ .../vehicle/VehicleApPowerBootupReason.aidl | 40 ++ .../VehicleApPowerStateConfigFlag.aidl | 40 ++ .../vehicle/VehicleApPowerStateReport.aidl | 47 +++ .../vehicle/VehicleApPowerStateReq.aidl | 41 ++ .../vehicle/VehicleApPowerStateReqIndex.aidl | 39 ++ .../VehicleApPowerStateShutdownParam.aidl | 43 ++ .../automotive/vehicle/VehicleArea.aidl | 44 ++ .../automotive/vehicle/VehicleAreaDoor.aidl | 45 +++ .../automotive/vehicle/VehicleAreaMirror.aidl | 40 ++ .../automotive/vehicle/VehicleAreaSeat.aidl | 46 +++ .../automotive/vehicle/VehicleAreaWheel.aidl | 42 ++ .../automotive/vehicle/VehicleAreaWindow.aidl | 47 +++ .../automotive/vehicle/VehicleDisplay.aidl | 42 ++ .../automotive/vehicle/VehicleGear.aidl | 51 +++ .../vehicle/VehicleHvacFanDirection.aidl | 43 ++ .../vehicle/VehicleHwKeyInputAction.aidl | 39 ++ .../VehicleHwMotionButtonStateFlag.aidl | 44 ++ .../vehicle/VehicleHwMotionInputAction.aidl | 50 +++ .../vehicle/VehicleHwMotionInputSource.aidl | 53 +++ .../vehicle/VehicleHwMotionToolType.aidl | 42 ++ .../vehicle/VehicleIgnitionState.aidl | 43 ++ .../automotive/vehicle/VehicleLightState.aidl | 40 ++ .../vehicle/VehicleLightSwitch.aidl | 41 ++ .../automotive/vehicle/VehicleOilLevel.aidl | 42 ++ .../automotive/vehicle/VehicleProperty.aidl | 273 +++++++++++++ .../vehicle/VehiclePropertyGroup.aidl | 40 ++ .../vehicle/VehiclePropertyType.aidl | 48 +++ .../vehicle/VehicleSeatOccupancyState.aidl | 40 ++ .../automotive/vehicle/VehicleTurnSignal.aidl | 40 ++ .../automotive/vehicle/VehicleUnit.aidl | 71 ++++ .../vehicle/VehicleVendorPermission.aidl | 75 ++++ ...msAvailabilityStateIntegerValuesIndex.aidl | 41 ++ .../VmsBaseMessageIntegerValuesIndex.aidl | 38 ++ .../automotive/vehicle/VmsMessageType.aidl | 54 +++ ...LayerAndPublisherIdIntegerValuesIndex.aidl | 42 ++ ...VmsMessageWithLayerIntegerValuesIndex.aidl | 41 ++ .../VmsOfferingMessageIntegerValuesIndex.aidl | 41 ++ ...ublisherInformationIntegerValuesIndex.aidl | 39 ++ ...StartSessionMessageIntegerValuesIndex.aidl | 40 ++ ...sSubscriptionsStateIntegerValuesIndex.aidl | 42 ++ .../vehicle/WindshieldWipersState.aidl | 41 ++ .../vehicle/WindshieldWipersSwitch.aidl | 52 +++ biometrics/common/aidl/Android.bp | 7 +- .../3/.hash | 1 + .../biometrics/common/AuthenticateReason.aidl | 63 +++ .../biometrics/common/CommonProps.aidl | 42 ++ .../biometrics/common/ComponentInfo.aidl | 43 ++ .../biometrics/common/DisplayState.aidl | 43 ++ .../common/ICancellationSignal.aidl | 39 ++ .../biometrics/common/OperationContext.aidl | 48 +++ .../biometrics/common/OperationReason.aidl | 41 ++ .../biometrics/common/SensorStrength.aidl | 41 ++ .../biometrics/common/WakeReason.aidl | 48 +++ biometrics/face/aidl/Android.bp | 9 + .../android.hardware.biometrics.face/3/.hash | 1 + .../biometrics/face/AcquiredInfo.aidl | 64 +++ .../biometrics/face/AuthenticationFrame.aidl | 38 ++ .../hardware/biometrics/face/BaseFrame.aidl | 43 ++ .../hardware/biometrics/face/Cell.aidl | 40 ++ .../biometrics/face/EnrollmentFrame.aidl | 40 ++ .../biometrics/face/EnrollmentStage.aidl | 44 ++ .../face/EnrollmentStageConfig.aidl | 39 ++ .../biometrics/face/EnrollmentType.aidl | 39 ++ .../hardware/biometrics/face/Error.aidl | 46 +++ .../biometrics/face/FaceSensorType.aidl | 40 ++ .../hardware/biometrics/face/Feature.aidl | 40 ++ .../hardware/biometrics/face/IFace.aidl | 39 ++ .../hardware/biometrics/face/ISession.aidl | 55 +++ .../biometrics/face/ISessionCallback.aidl | 56 +++ .../hardware/biometrics/face/SensorProps.aidl | 47 +++ biometrics/fingerprint/aidl/Android.bp | 9 + .../3/.hash | 1 + .../biometrics/fingerprint/AcquiredInfo.aidl | 53 +++ .../biometrics/fingerprint/Error.aidl | 48 +++ .../fingerprint/FingerprintSensorType.aidl | 44 ++ .../biometrics/fingerprint/IFingerprint.aidl | 40 ++ .../biometrics/fingerprint/ISession.aidl | 66 +++ .../fingerprint/ISessionCallback.aidl | 54 +++ .../fingerprint/PointerContext.aidl | 47 +++ .../fingerprint/SensorLocation.aidl | 47 +++ .../biometrics/fingerprint/SensorProps.aidl | 46 +++ .../biometrics/fingerprint/SensorShape.aidl | 40 ++ .../fingerprint/TouchDetectionParameters.aidl | 40 ++ bluetooth/aidl/Android.bp | 8 + .../android.hardware.bluetooth/1/.hash | 1 + .../hardware/bluetooth/IBluetoothHci.aidl | 43 ++ .../bluetooth/IBluetoothHciCallbacks.aidl | 42 ++ .../1/android/hardware/bluetooth/Status.aidl | 42 ++ bluetooth/audio/aidl/Android.bp | 9 + .../android.hardware.bluetooth.audio/3/.hash | 1 + .../bluetooth/audio/AacCapabilities.aidl | 43 ++ .../bluetooth/audio/AacConfiguration.aidl | 43 ++ .../bluetooth/audio/AacObjectType.aidl | 41 ++ .../audio/AptxAdaptiveCapabilities.aidl | 46 +++ .../audio/AptxAdaptiveChannelMode.aidl | 42 ++ .../audio/AptxAdaptiveConfiguration.aidl | 46 +++ .../audio/AptxAdaptiveInputMode.aidl | 39 ++ .../audio/AptxAdaptiveLeCapabilities.aidl | 42 ++ .../audio/AptxAdaptiveLeConfiguration.aidl | 43 ++ .../audio/AptxAdaptiveTimeToPlay.aidl | 43 ++ .../bluetooth/audio/AptxCapabilities.aidl | 40 ++ .../bluetooth/audio/AptxConfiguration.aidl | 40 ++ .../hardware/bluetooth/audio/AptxMode.aidl | 41 ++ .../bluetooth/audio/AptxSinkBuffering.aidl | 43 ++ .../bluetooth/audio/AudioCapabilities.aidl | 40 ++ .../bluetooth/audio/AudioConfiguration.aidl | 41 ++ .../bluetooth/audio/AudioLocation.aidl | 40 ++ .../bluetooth/audio/BluetoothAudioStatus.aidl | 42 ++ .../bluetooth/audio/BroadcastCapability.aidl | 50 +++ .../hardware/bluetooth/audio/ChannelMode.aidl | 41 ++ .../bluetooth/audio/CodecCapabilities.aidl | 54 +++ .../bluetooth/audio/CodecConfiguration.aidl | 59 +++ .../hardware/bluetooth/audio/CodecType.aidl | 49 +++ .../bluetooth/audio/IBluetoothAudioPort.aidl | 44 ++ .../audio/IBluetoothAudioProvider.aidl | 43 ++ .../audio/IBluetoothAudioProviderFactory.aidl | 39 ++ .../hardware/bluetooth/audio/LatencyMode.aidl | 42 ++ .../bluetooth/audio/Lc3Capabilities.aidl | 43 ++ .../bluetooth/audio/Lc3Configuration.aidl | 43 ++ .../bluetooth/audio/LdacCapabilities.aidl | 41 ++ .../bluetooth/audio/LdacChannelMode.aidl | 41 ++ .../bluetooth/audio/LdacConfiguration.aidl | 41 ++ .../bluetooth/audio/LdacQualityIndex.aidl | 41 ++ .../audio/LeAudioBroadcastConfiguration.aidl | 46 +++ .../LeAudioCodecCapabilitiesSetting.aidl | 40 ++ .../audio/LeAudioCodecConfiguration.aidl | 44 ++ .../bluetooth/audio/LeAudioConfiguration.aidl | 48 +++ .../bluetooth/audio/OpusCapabilities.aidl | 43 ++ .../bluetooth/audio/OpusConfiguration.aidl | 43 ++ .../bluetooth/audio/PcmCapabilities.aidl | 41 ++ .../bluetooth/audio/PcmConfiguration.aidl | 41 ++ .../bluetooth/audio/PresentationPosition.aidl | 45 +++ .../bluetooth/audio/SbcAllocMethod.aidl | 39 ++ .../bluetooth/audio/SbcCapabilities.aidl | 45 +++ .../bluetooth/audio/SbcChannelMode.aidl | 42 ++ .../bluetooth/audio/SbcConfiguration.aidl | 45 +++ .../hardware/bluetooth/audio/SessionType.aidl | 49 +++ .../bluetooth/audio/UnicastCapability.aidl | 52 +++ boot/aidl/Android.bp | 8 + .../aidl_api/android.hardware.boot/1/.hash | 1 + .../1/android/hardware/boot/IBootControl.aidl | 50 +++ .../1/android/hardware/boot/MergeStatus.aidl | 42 ++ broadcastradio/aidl/Android.bp | 8 + .../android.hardware.broadcastradio/1/.hash | 1 + .../broadcastradio/AmFmBandRange.aidl | 41 ++ .../broadcastradio/AmFmRegionConfig.aidl | 44 ++ .../hardware/broadcastradio/Announcement.aidl | 40 ++ .../broadcastradio/AnnouncementType.aidl | 46 +++ .../hardware/broadcastradio/ConfigFlag.aidl | 46 +++ .../broadcastradio/DabTableEntry.aidl | 39 ++ .../broadcastradio/IAnnouncementListener.aidl | 38 ++ .../broadcastradio/IBroadcastRadio.aidl | 58 +++ .../hardware/broadcastradio/ICloseHandle.aidl | 38 ++ .../broadcastradio/ITunerCallback.aidl | 43 ++ .../broadcastradio/IdentifierType.aidl | 52 +++ .../hardware/broadcastradio/Metadata.aidl | 53 +++ .../broadcastradio/ProgramFilter.aidl | 41 ++ .../broadcastradio/ProgramIdentifier.aidl | 39 ++ .../hardware/broadcastradio/ProgramInfo.aidl | 51 +++ .../broadcastradio/ProgramListChunk.aidl | 41 ++ .../broadcastradio/ProgramSelector.aidl | 39 ++ .../hardware/broadcastradio/Properties.aidl | 43 ++ .../hardware/broadcastradio/Result.aidl | 45 +++ .../broadcastradio/VendorKeyValue.aidl | 39 ++ camera/device/aidl/Android.bp | 13 +- .../android.hardware.camera.device/2/.hash | 1 + .../hardware/camera/device/BufferCache.aidl | 39 ++ .../hardware/camera/device/BufferRequest.aidl | 39 ++ .../camera/device/BufferRequestStatus.aidl | 42 ++ .../hardware/camera/device/BufferStatus.aidl | 39 ++ .../hardware/camera/device/CameraBlob.aidl | 39 ++ .../hardware/camera/device/CameraBlobId.aidl | 39 ++ .../camera/device/CameraMetadata.aidl | 38 ++ .../device/CameraOfflineSessionInfo.aidl | 39 ++ .../camera/device/CaptureRequest.aidl | 45 +++ .../hardware/camera/device/CaptureResult.aidl | 44 ++ .../hardware/camera/device/ErrorCode.aidl | 41 ++ .../hardware/camera/device/ErrorMsg.aidl | 40 ++ .../hardware/camera/device/HalStream.aidl | 45 +++ .../hardware/camera/device/ICameraDevice.aidl | 46 +++ .../camera/device/ICameraDeviceCallback.aidl | 41 ++ .../camera/device/ICameraDeviceSession.aidl | 48 +++ .../device/ICameraInjectionSession.aidl | 39 ++ .../camera/device/ICameraOfflineSession.aidl | 40 ++ .../hardware/camera/device/NotifyMsg.aidl | 39 ++ .../camera/device/OfflineRequest.aidl | 39 ++ .../hardware/camera/device/OfflineStream.aidl | 40 ++ .../camera/device/PhysicalCameraMetadata.aidl | 40 ++ .../camera/device/PhysicalCameraSetting.aidl | 40 ++ .../camera/device/RequestTemplate.aidl | 44 ++ .../hardware/camera/device/ShutterMsg.aidl | 40 ++ .../hardware/camera/device/Stream.aidl | 52 +++ .../hardware/camera/device/StreamBuffer.aidl | 43 ++ .../device/StreamBufferRequestError.aidl | 41 ++ .../camera/device/StreamBufferRet.aidl | 39 ++ .../camera/device/StreamBuffersVal.aidl | 39 ++ .../camera/device/StreamConfiguration.aidl | 43 ++ .../device/StreamConfigurationMode.aidl | 47 +++ .../camera/device/StreamRotation.aidl | 41 ++ .../hardware/camera/device/StreamType.aidl | 39 ++ camera/metadata/aidl/Android.bp | 9 +- .../android.hardware.camera.metadata/2/.hash | 1 + .../camera/metadata/AutomotiveLensFacing.aidl | 56 +++ .../camera/metadata/AutomotiveLocation.aidl | 52 +++ .../camera/metadata/BlackLevelLock.aidl | 43 ++ .../metadata/CameraMetadataSection.aidl | 76 ++++ .../metadata/CameraMetadataSectionStart.aidl | 76 ++++ .../camera/metadata/CameraMetadataTag.aidl | 345 ++++++++++++++++ .../ColorCorrectionAberrationMode.aidl | 44 ++ .../camera/metadata/ColorCorrectionMode.aidl | 44 ++ .../metadata/ControlAeAntibandingMode.aidl | 45 +++ .../camera/metadata/ControlAeLock.aidl | 43 ++ .../metadata/ControlAeLockAvailable.aidl | 43 ++ .../camera/metadata/ControlAeMode.aidl | 47 +++ .../metadata/ControlAePrecaptureTrigger.aidl | 44 ++ .../camera/metadata/ControlAeState.aidl | 47 +++ .../camera/metadata/ControlAfMode.aidl | 47 +++ .../camera/metadata/ControlAfSceneChange.aidl | 43 ++ .../camera/metadata/ControlAfState.aidl | 48 +++ .../camera/metadata/ControlAfTrigger.aidl | 44 ++ .../camera/metadata/ControlAutoframing.aidl | 44 ++ .../metadata/ControlAutoframingAvailable.aidl | 43 ++ .../metadata/ControlAutoframingState.aidl | 44 ++ .../camera/metadata/ControlAwbLock.aidl | 43 ++ .../metadata/ControlAwbLockAvailable.aidl | 43 ++ .../camera/metadata/ControlAwbMode.aidl | 50 +++ .../camera/metadata/ControlAwbState.aidl | 45 +++ .../camera/metadata/ControlCaptureIntent.aidl | 49 +++ .../camera/metadata/ControlEffectMode.aidl | 50 +++ .../camera/metadata/ControlEnableZsl.aidl | 43 ++ .../metadata/ControlExtendedSceneMode.aidl | 45 +++ .../hardware/camera/metadata/ControlMode.aidl | 46 +++ .../camera/metadata/ControlSceneMode.aidl | 63 +++ .../metadata/ControlSettingsOverride.aidl | 44 ++ .../ControlVideoStabilizationMode.aidl | 44 ++ .../camera/metadata/DemosaicMode.aidl | 43 ++ ...pthAvailableDepthStreamConfigurations.aidl | 43 ++ ...StreamConfigurationsMaximumResolution.aidl | 43 ++ ...lableDynamicDepthStreamConfigurations.aidl | 43 ++ ...StreamConfigurationsMaximumResolution.aidl | 43 ++ .../metadata/DepthDepthIsExclusive.aidl | 43 ++ .../metadata/DistortionCorrectionMode.aidl | 44 ++ .../hardware/camera/metadata/EdgeMode.aidl | 45 +++ .../camera/metadata/FlashInfoAvailable.aidl | 43 ++ .../hardware/camera/metadata/FlashMode.aidl | 44 ++ .../hardware/camera/metadata/FlashState.aidl | 46 +++ ...HeicAvailableHeicStreamConfigurations.aidl | 43 ++ ...StreamConfigurationsMaximumResolution.aidl | 43 ++ .../camera/metadata/HeicInfoSupported.aidl | 43 ++ .../camera/metadata/HotPixelMode.aidl | 44 ++ .../InfoSupportedBufferManagementVersion.aidl | 42 ++ .../metadata/InfoSupportedHardwareLevel.aidl | 46 +++ ...egrAvailableJpegRStreamConfigurations.aidl | 43 ++ ...StreamConfigurationsMaximumResolution.aidl | 43 ++ .../camera/metadata/LedAvailableLeds.aidl | 42 ++ .../hardware/camera/metadata/LedTransmit.aidl | 43 ++ .../hardware/camera/metadata/LensFacing.aidl | 44 ++ .../LensInfoFocusDistanceCalibration.aidl | 44 ++ .../LensOpticalStabilizationMode.aidl | 43 ++ .../camera/metadata/LensPoseReference.aidl | 45 +++ .../hardware/camera/metadata/LensState.aidl | 43 ++ .../LogicalMultiCameraSensorSyncType.aidl | 43 ++ .../camera/metadata/NoiseReductionMode.aidl | 46 +++ .../camera/metadata/QuirksPartialResult.aidl | 43 ++ .../RequestAvailableCapabilities.aidl | 62 +++ ...RequestAvailableColorSpaceProfilesMap.aidl | 45 +++ ...questAvailableDynamicRangeProfilesMap.aidl | 54 +++ .../camera/metadata/RequestMetadataMode.aidl | 43 ++ .../hardware/camera/metadata/RequestType.aidl | 43 ++ .../metadata/ScalerAvailableFormats.aidl | 51 +++ ...ilableRecommendedStreamConfigurations.aidl | 50 +++ .../ScalerAvailableStreamConfigurations.aidl | 43 ++ ...StreamConfigurationsMaximumResolution.aidl | 43 ++ .../ScalerAvailableStreamUseCases.aidl | 49 +++ .../camera/metadata/ScalerCroppingType.aidl | 43 ++ .../ScalerMultiResolutionStreamSupported.aidl | 43 ++ ...raMultiResolutionStreamConfigurations.aidl | 43 ++ .../camera/metadata/ScalerRotateAndCrop.aidl | 46 +++ .../SensorInfoColorFilterArrangement.aidl | 48 +++ .../SensorInfoLensShadingApplied.aidl | 43 ++ .../metadata/SensorInfoTimestampSource.aidl | 43 ++ .../camera/metadata/SensorPixelMode.aidl | 43 ++ .../metadata/SensorRawBinningFactorUsed.aidl | 43 ++ .../metadata/SensorReferenceIlluminant1.aidl | 60 +++ .../metadata/SensorTestPatternMode.aidl | 48 +++ .../hardware/camera/metadata/ShadingMode.aidl | 44 ++ .../metadata/StatisticsFaceDetectMode.aidl | 44 ++ .../metadata/StatisticsHistogramMode.aidl | 43 ++ .../metadata/StatisticsHotPixelMapMode.aidl | 43 ++ .../StatisticsLensShadingMapMode.aidl | 43 ++ .../metadata/StatisticsOisDataMode.aidl | 43 ++ .../metadata/StatisticsSceneFlicker.aidl | 44 ++ .../metadata/StatisticsSharpnessMapMode.aidl | 43 ++ .../camera/metadata/SyncFrameNumber.aidl | 43 ++ .../camera/metadata/SyncMaxLatency.aidl | 43 ++ .../hardware/camera/metadata/TonemapMode.aidl | 46 +++ .../camera/metadata/TonemapPresetCurve.aidl | 43 ++ camera/provider/aidl/Android.bp | 10 +- .../android.hardware.camera.provider/2/.hash | 1 + .../CameraIdAndStreamCombination.aidl | 39 ++ .../ConcurrentCameraIdCombination.aidl | 38 ++ .../camera/provider/ICameraProvider.aidl | 48 +++ .../provider/ICameraProviderCallback.aidl | 40 ++ cas/aidl/Android.bp | 8 + .../aidl_api/android.hardware.cas/1/.hash | 1 + .../hardware/cas/AidlCasPluginDescriptor.aidl | 40 ++ .../hardware/cas/DestinationBuffer.aidl | 40 ++ .../1/android/hardware/cas/ICas.aidl | 50 +++ .../1/android/hardware/cas/ICasListener.aidl | 41 ++ .../1/android/hardware/cas/IDescrambler.aidl | 42 ++ .../hardware/cas/IMediaCasService.aidl | 43 ++ .../hardware/cas/ScramblingControl.aidl | 42 ++ .../android/hardware/cas/ScramblingMode.aidl | 53 +++ .../1/android/hardware/cas/SessionIntent.aidl | 42 ++ .../1/android/hardware/cas/SharedBuffer.aidl | 41 ++ .../1/android/hardware/cas/Status.aidl | 60 +++ .../1/android/hardware/cas/StatusEvent.aidl | 40 ++ .../1/android/hardware/cas/SubSample.aidl | 40 ++ confirmationui/aidl/Android.bp | 8 + .../android.hardware.confirmationui/1/.hash | 1 + .../IConfirmationResultCallback.aidl | 38 ++ .../confirmationui/IConfirmationUI.aidl | 54 +++ .../confirmationui/TestModeCommands.aidl | 39 ++ .../hardware/confirmationui/UIOption.aidl | 39 ++ contexthub/aidl/Android.bp | 6 + .../android.hardware.contexthub/2/.hash | 1 + .../hardware/contexthub/AsyncEventType.aidl | 38 ++ .../hardware/contexthub/ContextHubInfo.aidl | 48 +++ .../contexthub/ContextHubMessage.aidl | 42 ++ .../hardware/contexthub/HostEndpointInfo.aidl | 47 +++ .../hardware/contexthub/IContextHub.aidl | 52 +++ .../contexthub/IContextHubCallback.aidl | 43 ++ .../contexthub/NanSessionRequest.aidl | 38 ++ .../contexthub/NanSessionStateUpdate.aidl | 38 ++ .../hardware/contexthub/NanoappBinary.aidl | 46 +++ .../hardware/contexthub/NanoappInfo.aidl | 42 ++ .../contexthub/NanoappRpcService.aidl | 39 ++ .../android/hardware/contexthub/Setting.aidl | 44 ++ fastboot/aidl/Android.bp | 8 + .../android.hardware.fastboot/1/.hash | 1 + .../hardware/fastboot/FileSystemType.aidl | 40 ++ .../android/hardware/fastboot/IFastboot.aidl | 44 ++ gatekeeper/aidl/Android.bp | 8 + .../android.hardware.gatekeeper/1/.hash | 1 + .../gatekeeper/GatekeeperEnrollResponse.aidl | 41 ++ .../gatekeeper/GatekeeperVerifyResponse.aidl | 40 ++ .../hardware/gatekeeper/IGatekeeper.aidl | 46 +++ gnss/aidl/Android.bp | 5 + .../aidl_api/android.hardware.gnss/3/.hash | 1 + .../hardware/gnss/BlocklistedSource.aidl | 40 ++ .../hardware/gnss/CorrelationVector.aidl | 42 ++ .../hardware/gnss/ElapsedRealtime.aidl | 43 ++ .../3/android/hardware/gnss/GnssClock.aidl | 56 +++ .../hardware/gnss/GnssConstellationType.aidl | 46 +++ .../3/android/hardware/gnss/GnssData.aidl | 49 +++ .../3/android/hardware/gnss/GnssLocation.aidl | 58 +++ .../hardware/gnss/GnssMeasurement.aidl | 99 +++++ .../hardware/gnss/GnssMultipathIndicator.aidl | 41 ++ .../android/hardware/gnss/GnssPowerStats.aidl | 45 +++ .../android/hardware/gnss/GnssSignalType.aidl | 57 +++ .../3/android/hardware/gnss/IAGnss.aidl | 50 +++ .../android/hardware/gnss/IAGnssCallback.aidl | 54 +++ .../3/android/hardware/gnss/IAGnssRil.aidl | 81 ++++ .../hardware/gnss/IAGnssRilCallback.aidl | 40 ++ .../3/android/hardware/gnss/IGnss.aidl | 103 +++++ .../hardware/gnss/IGnssAntennaInfo.aidl | 40 ++ .../gnss/IGnssAntennaInfoCallback.aidl | 61 +++ .../android/hardware/gnss/IGnssBatching.aidl | 51 +++ .../hardware/gnss/IGnssBatchingCallback.aidl | 39 ++ .../android/hardware/gnss/IGnssCallback.aidl | 97 +++++ .../hardware/gnss/IGnssConfiguration.aidl | 52 +++ .../3/android/hardware/gnss/IGnssDebug.aidl | 88 ++++ .../android/hardware/gnss/IGnssGeofence.aidl | 43 ++ .../hardware/gnss/IGnssGeofenceCallback.aidl | 55 +++ .../gnss/IGnssMeasurementCallback.aidl | 39 ++ .../gnss/IGnssMeasurementInterface.aidl | 47 +++ .../gnss/IGnssNavigationMessageCallback.aidl | 69 ++++ .../gnss/IGnssNavigationMessageInterface.aidl | 40 ++ .../hardware/gnss/IGnssPowerIndication.aidl | 40 ++ .../gnss/IGnssPowerIndicationCallback.aidl | 46 +++ .../3/android/hardware/gnss/IGnssPsds.aidl | 40 ++ .../hardware/gnss/IGnssPsdsCallback.aidl | 39 ++ .../3/android/hardware/gnss/PsdsType.aidl | 41 ++ .../hardware/gnss/SatelliteClockInfo.aidl | 41 ++ .../hardware/gnss/SatellitePositionEcef.aidl | 42 ++ .../3/android/hardware/gnss/SatellitePvt.aidl | 59 +++ .../hardware/gnss/SatelliteVelocityEcef.aidl | 42 ++ .../IMeasurementCorrectionsCallback.aidl | 42 ++ .../IMeasurementCorrectionsInterface.aidl | 40 ++ .../MeasurementCorrections.aidl | 48 +++ .../ReflectingPlane.aidl | 42 ++ .../SingleSatCorrection.aidl | 63 +++ .../IGnssVisibilityControl.aidl | 40 ++ .../IGnssVisibilityControlCallback.aidl | 75 ++++ graphics/allocator/aidl/Android.bp | 10 +- .../2/.hash | 1 + .../graphics/allocator/AllocationError.aidl | 40 ++ .../graphics/allocator/AllocationResult.aidl | 39 ++ .../allocator/BufferDescriptorInfo.aidl | 45 +++ .../graphics/allocator/IAllocator.aidl | 44 ++ graphics/common/aidl/Android.bp | 9 +- .../android.hardware.graphics.common/4/.hash | 1 + .../graphics/common/AlphaInterpretation.aidl | 40 ++ .../hardware/graphics/common/BlendMode.aidl | 42 ++ .../hardware/graphics/common/BufferUsage.aidl | 65 +++ .../graphics/common/ChromaSiting.aidl | 42 ++ .../graphics/common/ColorTransform.aidl | 45 +++ .../hardware/graphics/common/Compression.aidl | 40 ++ .../hardware/graphics/common/Cta861_3.aidl | 40 ++ .../hardware/graphics/common/Dataspace.aidl | 99 +++++ .../common/DisplayDecorationSupport.aidl | 40 ++ .../graphics/common/ExtendableType.aidl | 40 ++ .../hardware/graphics/common/FRect.aidl | 42 ++ .../graphics/common/HardwareBuffer.aidl | 40 ++ .../common/HardwareBufferDescription.aidl | 44 ++ .../android/hardware/graphics/common/Hdr.aidl | 44 ++ .../common/HdrConversionCapability.aidl | 40 ++ .../common/HdrConversionStrategy.aidl | 40 ++ .../hardware/graphics/common/Interlaced.aidl | 41 ++ .../hardware/graphics/common/PixelFormat.aidl | 71 ++++ .../hardware/graphics/common/PlaneLayout.aidl | 47 +++ .../graphics/common/PlaneLayoutComponent.aidl | 41 ++ .../common/PlaneLayoutComponentType.aidl | 46 +++ .../hardware/graphics/common/Point.aidl | 40 ++ .../hardware/graphics/common/Rect.aidl | 42 ++ .../hardware/graphics/common/Smpte2086.aidl | 44 ++ .../graphics/common/StandardMetadataType.aidl | 62 +++ .../hardware/graphics/common/Transform.aidl | 44 ++ .../hardware/graphics/common/XyColor.aidl | 40 ++ graphics/composer/aidl/Android.bp | 10 +- .../2/.hash | 1 + .../hardware/graphics/composer3/Buffer.aidl | 40 ++ .../graphics/composer3/Capability.aidl | 48 +++ .../composer3/ChangedCompositionLayer.aidl | 39 ++ .../composer3/ChangedCompositionTypes.aidl | 39 ++ .../graphics/composer3/ClientTarget.aidl | 40 ++ .../composer3/ClientTargetProperty.aidl | 39 ++ .../ClientTargetPropertyWithBrightness.aidl | 41 ++ .../composer3/ClockMonotonicTimestamp.aidl | 38 ++ .../hardware/graphics/composer3/Color.aidl | 41 ++ .../graphics/composer3/ColorMode.aidl | 51 +++ .../graphics/composer3/CommandError.aidl | 39 ++ .../composer3/CommandResultPayload.aidl | 44 ++ .../graphics/composer3/Composition.aidl | 45 +++ .../graphics/composer3/ContentType.aidl | 42 ++ .../graphics/composer3/DimmingStage.aidl | 40 ++ .../graphics/composer3/DisplayAttribute.aidl | 44 ++ .../graphics/composer3/DisplayBrightness.aidl | 39 ++ .../graphics/composer3/DisplayCapability.aidl | 45 +++ .../graphics/composer3/DisplayCommand.aidl | 48 +++ .../composer3/DisplayConnectionType.aidl | 39 ++ .../composer3/DisplayContentSample.aidl | 42 ++ .../DisplayContentSamplingAttributes.aidl | 40 ++ .../composer3/DisplayIdentification.aidl | 39 ++ .../graphics/composer3/DisplayRequest.aidl | 48 +++ .../composer3/FormatColorComponent.aidl | 41 ++ .../graphics/composer3/HdrCapabilities.aidl | 41 ++ .../graphics/composer3/IComposer.aidl | 40 ++ .../graphics/composer3/IComposerCallback.aidl | 44 ++ .../graphics/composer3/IComposerClient.aidl | 93 +++++ .../graphics/composer3/LayerBrightness.aidl | 38 ++ .../graphics/composer3/LayerCommand.aidl | 58 +++ .../graphics/composer3/OverlayProperties.aidl | 45 +++ .../composer3/ParcelableBlendMode.aidl | 38 ++ .../composer3/ParcelableComposition.aidl | 38 ++ .../composer3/ParcelableDataspace.aidl | 38 ++ .../composer3/ParcelableTransform.aidl | 38 ++ .../graphics/composer3/PerFrameMetadata.aidl | 39 ++ .../composer3/PerFrameMetadataBlob.aidl | 39 ++ .../composer3/PerFrameMetadataKey.aidl | 50 +++ .../graphics/composer3/PlaneAlpha.aidl | 38 ++ .../graphics/composer3/PowerMode.aidl | 42 ++ .../graphics/composer3/PresentFence.aidl | 39 ++ .../graphics/composer3/PresentOrValidate.aidl | 44 ++ .../composer3/ReadbackBufferAttributes.aidl | 39 ++ .../RefreshRateChangedDebugData.aidl | 39 ++ .../graphics/composer3/ReleaseFences.aidl | 44 ++ .../graphics/composer3/RenderIntent.aidl | 41 ++ .../graphics/composer3/VirtualDisplay.aidl | 39 ++ .../VsyncPeriodChangeConstraints.aidl | 39 ++ .../composer3/VsyncPeriodChangeTimeline.aidl | 40 ++ .../hardware/graphics/composer3/ZOrder.aidl | 38 ++ health/aidl/Android.bp | 6 + .../aidl_api/android.hardware.health/2/.hash | 1 + .../hardware/health/BatteryCapacityLevel.aidl | 44 ++ .../health/BatteryChargingPolicy.aidl | 41 ++ .../hardware/health/BatteryChargingState.aidl | 43 ++ .../hardware/health/BatteryHealth.aidl | 47 +++ .../hardware/health/BatteryHealthData.aidl | 40 ++ .../hardware/health/BatteryStatus.aidl | 42 ++ .../2/android/hardware/health/DiskStats.aidl | 48 +++ .../2/android/hardware/health/HealthInfo.aidl | 64 +++ .../2/android/hardware/health/IHealth.aidl | 54 +++ .../hardware/health/IHealthInfoCallback.aidl | 38 ++ .../android/hardware/health/StorageInfo.aidl | 41 ++ identity/aidl/Android.bp | 9 +- .../android.hardware.identity/5/.hash | 1 + .../hardware/identity/Certificate.aidl | 38 ++ .../hardware/identity/CipherSuite.aidl | 38 ++ .../identity/HardwareInformation.aidl | 43 ++ .../identity/IIdentityCredential.aidl | 55 +++ .../identity/IIdentityCredentialStore.aidl | 55 +++ .../identity/IPresentationSession.aidl | 42 ++ .../identity/IWritableIdentityCredential.aidl | 45 +++ .../hardware/identity/RequestDataItem.aidl | 40 ++ .../hardware/identity/RequestNamespace.aidl | 39 ++ .../identity/SecureAccessControlProfile.aidl | 43 ++ keymaster/aidl/Android.bp | 6 + .../android.hardware.keymaster/4/.hash | 1 + .../hardware/keymaster/HardwareAuthToken.aidl | 44 ++ .../keymaster/HardwareAuthenticatorType.aidl | 42 ++ .../hardware/keymaster/SecurityLevel.aidl | 41 ++ .../android/hardware/keymaster/Timestamp.aidl | 39 ++ .../hardware/keymaster/VerificationToken.aidl | 42 ++ media/bufferpool/aidl/Android.bp | 11 + .../1/.hash | 1 + .../hardware/media/bufferpool2/Buffer.aidl | 39 ++ .../BufferInvalidationMessage.aidl | 40 ++ .../media/bufferpool2/BufferStatus.aidl | 47 +++ .../bufferpool2/BufferStatusMessage.aidl | 43 ++ .../hardware/media/bufferpool2/IAccessor.aidl | 46 +++ .../media/bufferpool2/IClientManager.aidl | 43 ++ .../media/bufferpool2/IConnection.aidl | 47 +++ .../hardware/media/bufferpool2/IObserver.aidl | 38 ++ .../media/bufferpool2/ResultStatus.aidl | 42 ++ power/aidl/Android.bp | 5 + .../aidl_api/android.hardware.power/4/.hash | 1 + .../4/android/hardware/power/Boost.aidl | 43 ++ .../4/android/hardware/power/IPower.aidl | 43 ++ .../hardware/power/IPowerHintSession.aidl | 44 ++ .../4/android/hardware/power/Mode.aidl | 54 +++ .../4/android/hardware/power/SessionHint.aidl | 42 ++ .../android/hardware/power/WorkDuration.aidl | 39 ++ power/stats/aidl/Android.bp | 14 +- .../android.hardware.power.stats/2/.hash | 1 + .../android/hardware/power/stats/Channel.aidl | 40 ++ .../hardware/power/stats/EnergyConsumer.aidl | 41 ++ .../stats/EnergyConsumerAttribution.aidl | 39 ++ .../power/stats/EnergyConsumerResult.aidl | 41 ++ .../power/stats/EnergyConsumerType.aidl | 45 +++ .../power/stats/EnergyMeasurement.aidl | 41 ++ .../hardware/power/stats/IPowerStats.aidl | 43 ++ .../hardware/power/stats/PowerEntity.aidl | 40 ++ .../2/android/hardware/power/stats/State.aidl | 39 ++ .../hardware/power/stats/StateResidency.aidl | 41 ++ .../power/stats/StateResidencyResult.aidl | 39 ++ radio/aidl/Android.bp | 79 +++- .../android.hardware.radio.config/2/.hash | 1 + .../hardware/radio/config/IRadioConfig.aidl | 53 +++ .../radio/config/IRadioConfigIndication.aidl | 38 ++ .../radio/config/IRadioConfigResponse.aidl | 44 ++ .../config/MultipleEnabledProfilesMode.aidl | 41 ++ .../radio/config/PhoneCapability.aidl | 41 ++ .../hardware/radio/config/SimPortInfo.aidl | 40 ++ .../hardware/radio/config/SimSlotStatus.aidl | 42 ++ .../radio/config/SlotPortMapping.aidl | 39 ++ .../android.hardware.radio.data/2/.hash | 1 + .../hardware/radio/data/ApnAuthType.aidl | 41 ++ .../android/hardware/radio/data/ApnTypes.aidl | 53 +++ .../radio/data/DataCallFailCause.aidl | 381 ++++++++++++++++++ .../hardware/radio/data/DataProfileInfo.aidl | 67 +++ .../radio/data/DataRequestReason.aidl | 40 ++ .../radio/data/DataThrottlingAction.aidl | 41 ++ .../2/android/hardware/radio/data/EpsQos.aidl | 40 ++ .../hardware/radio/data/IRadioData.aidl | 53 +++ .../radio/data/IRadioDataIndication.aidl | 42 ++ .../radio/data/IRadioDataResponse.aidl | 52 +++ .../hardware/radio/data/KeepaliveRequest.aidl | 46 +++ .../hardware/radio/data/KeepaliveStatus.aidl | 42 ++ .../hardware/radio/data/LinkAddress.aidl | 43 ++ .../2/android/hardware/radio/data/NrQos.aidl | 49 +++ .../android/hardware/radio/data/OsAppId.aidl | 38 ++ .../hardware/radio/data/PcoDataInfo.aidl | 41 ++ .../hardware/radio/data/PdpProtocolType.aidl | 44 ++ .../hardware/radio/data/PortRange.aidl | 41 ++ .../2/android/hardware/radio/data/Qos.aidl | 40 ++ .../hardware/radio/data/QosBandwidth.aidl | 39 ++ .../hardware/radio/data/QosFilter.aidl | 55 +++ .../radio/data/QosFilterIpsecSpi.aidl | 39 ++ .../radio/data/QosFilterIpv6FlowLabel.aidl | 39 ++ .../radio/data/QosFilterTypeOfService.aidl | 39 ++ .../hardware/radio/data/QosSession.aidl | 40 ++ .../radio/data/RouteSelectionDescriptor.aidl | 46 +++ .../radio/data/SetupDataCallResult.aidl | 62 +++ .../hardware/radio/data/SliceInfo.aidl | 52 +++ .../hardware/radio/data/SlicingConfig.aidl | 39 ++ .../radio/data/TrafficDescriptor.aidl | 39 ++ .../android/hardware/radio/data/UrspRule.aidl | 40 ++ .../android.hardware.radio.ims.media/1/.hash | 1 + .../hardware/radio/ims/media/AmrMode.aidl | 46 +++ .../hardware/radio/ims/media/AmrParams.aidl | 40 ++ .../hardware/radio/ims/media/AnbrMode.aidl | 39 ++ .../hardware/radio/ims/media/CallQuality.aidl | 58 +++ .../hardware/radio/ims/media/CodecMode.aidl | 40 ++ .../hardware/radio/ims/media/CodecParams.aidl | 43 ++ .../radio/ims/media/CodecSpecificParams.aidl | 39 ++ .../hardware/radio/ims/media/CodecType.aidl | 42 ++ .../hardware/radio/ims/media/DtmfParams.aidl | 40 ++ .../radio/ims/media/EvsBandwidth.aidl | 42 ++ .../hardware/radio/ims/media/EvsMode.aidl | 58 +++ .../hardware/radio/ims/media/EvsParams.aidl | 43 ++ .../hardware/radio/ims/media/IImsMedia.aidl | 40 ++ .../radio/ims/media/IImsMediaListener.aidl | 40 ++ .../radio/ims/media/IImsMediaSession.aidl | 44 ++ .../ims/media/IImsMediaSessionListener.aidl | 44 ++ .../radio/ims/media/LocalEndPoint.aidl | 40 ++ .../radio/ims/media/MediaDirection.aidl | 42 ++ .../radio/ims/media/MediaQualityStatus.aidl | 41 ++ .../ims/media/MediaQualityThreshold.aidl | 44 ++ .../hardware/radio/ims/media/RtcpConfig.aidl | 41 ++ .../ims/media/RtcpXrReportBlockType.aidl | 45 +++ .../hardware/radio/ims/media/RtpAddress.aidl | 39 ++ .../hardware/radio/ims/media/RtpConfig.aidl | 43 ++ .../hardware/radio/ims/media/RtpError.aidl | 44 ++ .../radio/ims/media/RtpHeaderExtension.aidl | 39 ++ .../radio/ims/media/RtpSessionParams.aidl | 42 ++ .../android.hardware.radio.ims/1/.hash | 1 + .../radio/ims/ConnectionFailureInfo.aidl | 53 +++ .../hardware/radio/ims/EpsFallbackReason.aidl | 39 ++ .../android/hardware/radio/ims/IRadioIms.aidl | 45 +++ .../radio/ims/IRadioImsIndication.aidl | 40 ++ .../hardware/radio/ims/IRadioImsResponse.aidl | 44 ++ .../1/android/hardware/radio/ims/ImsCall.aidl | 64 +++ .../radio/ims/ImsDeregistrationReason.aidl | 40 ++ .../hardware/radio/ims/ImsRegistration.aidl | 46 +++ .../radio/ims/ImsRegistrationState.aidl | 39 ++ .../radio/ims/ImsStreamDirection.aidl | 39 ++ .../hardware/radio/ims/ImsStreamType.aidl | 39 ++ .../hardware/radio/ims/ImsTrafficType.aidl | 44 ++ .../android/hardware/radio/ims/SrvccCall.aidl | 64 +++ .../hardware/radio/ims/SuggestedAction.aidl | 40 ++ .../android.hardware.radio.messaging/2/.hash | 1 + .../messaging/CdmaBroadcastSmsConfigInfo.aidl | 40 ++ .../hardware/radio/messaging/CdmaSmsAck.aidl | 39 ++ .../radio/messaging/CdmaSmsAddress.aidl | 68 ++++ .../radio/messaging/CdmaSmsMessage.aidl | 43 ++ .../radio/messaging/CdmaSmsSubaddress.aidl | 42 ++ .../radio/messaging/CdmaSmsWriteArgs.aidl | 43 ++ .../messaging/GsmBroadcastSmsConfigInfo.aidl | 42 ++ .../radio/messaging/GsmSmsMessage.aidl | 39 ++ .../radio/messaging/IRadioMessaging.aidl | 60 +++ .../messaging/IRadioMessagingIndication.aidl | 44 ++ .../messaging/IRadioMessagingResponse.aidl | 59 +++ .../radio/messaging/ImsSmsMessage.aidl | 42 ++ .../radio/messaging/SendSmsResult.aidl | 40 ++ .../messaging/SmsAcknowledgeFailCause.aidl | 39 ++ .../radio/messaging/SmsWriteArgs.aidl | 44 ++ .../android.hardware.radio.modem/2/.hash | 1 + .../radio/modem/ActivityStatsInfo.aidl | 40 ++ .../modem/ActivityStatsTechSpecificInfo.aidl | 46 +++ .../hardware/radio/modem/DeviceStateType.aidl | 40 ++ .../hardware/radio/modem/HardwareConfig.aidl | 47 +++ .../radio/modem/HardwareConfigModem.aidl | 42 ++ .../radio/modem/HardwareConfigSim.aidl | 38 ++ .../hardware/radio/modem/IRadioModem.aidl | 67 +++ .../radio/modem/IRadioModemIndication.aidl | 42 ++ .../radio/modem/IRadioModemResponse.aidl | 66 +++ .../hardware/radio/modem/ImeiInfo.aidl | 45 +++ .../android/hardware/radio/modem/NvItem.aidl | 81 ++++ .../hardware/radio/modem/NvWriteItem.aidl | 42 ++ .../hardware/radio/modem/RadioCapability.aidl | 50 +++ .../hardware/radio/modem/RadioState.aidl | 40 ++ .../hardware/radio/modem/ResetNvType.aidl | 40 ++ .../android.hardware.radio.network/2/.hash | 1 + .../network/AccessTechnologySpecificInfo.aidl | 42 ++ .../hardware/radio/network/BarringInfo.aidl | 85 ++++ .../network/BarringTypeSpecificInfo.aidl | 40 ++ .../network/Cdma2000RegistrationInfo.aidl | 44 ++ .../radio/network/CdmaRoamingType.aidl | 40 ++ .../radio/network/CdmaSignalStrength.aidl | 39 ++ .../radio/network/CellConnectionStatus.aidl | 40 ++ .../hardware/radio/network/CellIdentity.aidl | 44 ++ .../radio/network/CellIdentityCdma.aidl | 43 ++ .../radio/network/CellIdentityGsm.aidl | 45 +++ .../radio/network/CellIdentityLte.aidl | 48 +++ .../radio/network/CellIdentityNr.aidl | 46 +++ .../radio/network/CellIdentityTdscdma.aidl | 46 +++ .../radio/network/CellIdentityWcdma.aidl | 46 +++ .../hardware/radio/network/CellInfo.aidl | 40 ++ .../hardware/radio/network/CellInfoCdma.aidl | 40 ++ .../hardware/radio/network/CellInfoGsm.aidl | 39 ++ .../hardware/radio/network/CellInfoLte.aidl | 39 ++ .../hardware/radio/network/CellInfoNr.aidl | 39 ++ .../network/CellInfoRatSpecificInfo.aidl | 43 ++ .../radio/network/CellInfoTdscdma.aidl | 39 ++ .../hardware/radio/network/CellInfoWcdma.aidl | 39 ++ .../network/ClosedSubscriberGroupInfo.aidl | 40 ++ .../hardware/radio/network/Domain.aidl | 39 ++ .../hardware/radio/network/EmergencyMode.aidl | 40 ++ .../network/EmergencyNetworkScanTrigger.aidl | 39 ++ .../radio/network/EmergencyRegResult.aidl | 46 +++ .../radio/network/EmergencyScanType.aidl | 40 ++ .../hardware/radio/network/EutranBands.aidl | 97 +++++ .../radio/network/EutranRegistrationInfo.aidl | 48 +++ .../radio/network/EvdoSignalStrength.aidl | 40 ++ .../hardware/radio/network/GeranBands.aidl | 51 +++ .../radio/network/GsmSignalStrength.aidl | 40 ++ .../hardware/radio/network/IRadioNetwork.aidl | 84 ++++ .../network/IRadioNetworkIndication.aidl | 52 +++ .../radio/network/IRadioNetworkResponse.aidl | 83 ++++ .../radio/network/IndicationFilter.aidl | 46 +++ .../hardware/radio/network/LceDataInfo.aidl | 40 ++ .../radio/network/LinkCapacityEstimate.aidl | 41 ++ .../radio/network/LteSignalStrength.aidl | 44 ++ .../hardware/radio/network/LteVopsInfo.aidl | 39 ++ .../radio/network/NetworkScanRequest.aidl | 53 +++ .../radio/network/NetworkScanResult.aidl | 42 ++ .../hardware/radio/network/NgranBands.aidl | 90 +++++ .../network/NrDualConnectivityState.aidl | 40 ++ .../hardware/radio/network/NrIndicators.aidl | 40 ++ .../radio/network/NrSignalStrength.aidl | 46 +++ .../hardware/radio/network/NrVopsInfo.aidl | 51 +++ .../hardware/radio/network/OperatorInfo.aidl | 45 +++ .../radio/network/PhoneRestrictedState.aidl | 42 ++ .../radio/network/PhysicalChannelConfig.aidl | 46 +++ .../network/PhysicalChannelConfigBand.aidl | 42 ++ .../radio/network/RadioAccessSpecifier.aidl | 40 ++ .../network/RadioAccessSpecifierBands.aidl | 42 ++ .../hardware/radio/network/RadioBandMode.aidl | 56 +++ .../hardware/radio/network/RegState.aidl | 48 +++ .../radio/network/RegStateResult.aidl | 43 ++ .../radio/network/RegistrationFailCause.aidl | 89 ++++ .../radio/network/SignalStrength.aidl | 44 ++ .../radio/network/SignalThresholdInfo.aidl | 52 +++ .../radio/network/SuppSvcNotification.aidl | 42 ++ .../radio/network/TdscdmaSignalStrength.aidl | 40 ++ .../hardware/radio/network/UsageSetting.aidl | 39 ++ .../hardware/radio/network/UtranBands.aidl | 63 +++ .../radio/network/WcdmaSignalStrength.aidl | 41 ++ .../android.hardware.radio.sap/1/.hash | 1 + .../1/android/hardware/radio/sap/ISap.aidl | 46 +++ .../hardware/radio/sap/ISapCallback.aidl | 48 +++ .../hardware/radio/sap/SapApduType.aidl | 39 ++ .../hardware/radio/sap/SapConnectRsp.aidl | 42 ++ .../hardware/radio/sap/SapDisconnectType.aidl | 39 ++ .../hardware/radio/sap/SapResultCode.aidl | 45 +++ .../android/hardware/radio/sap/SapStatus.aidl | 43 ++ .../radio/sap/SapTransferProtocol.aidl | 39 ++ .../android.hardware.radio.sim/2/.hash | 1 + .../android/hardware/radio/sim/AppStatus.aidl | 57 +++ .../hardware/radio/sim/CardPowerState.aidl | 40 ++ .../hardware/radio/sim/CardStatus.aidl | 52 +++ .../2/android/hardware/radio/sim/Carrier.aidl | 46 +++ .../radio/sim/CarrierRestrictions.aidl | 47 +++ .../radio/sim/CdmaSubscriptionSource.aidl | 39 ++ .../android/hardware/radio/sim/IRadioSim.aidl | 77 ++++ .../radio/sim/IRadioSimIndication.aidl | 48 +++ .../hardware/radio/sim/IRadioSimResponse.aidl | 76 ++++ .../2/android/hardware/radio/sim/IccIo.aidl | 46 +++ .../hardware/radio/sim/IccIoResult.aidl | 40 ++ .../radio/sim/ImsiEncryptionInfo.aidl | 45 +++ .../hardware/radio/sim/PbReceivedStatus.aidl | 41 ++ .../hardware/radio/sim/PersoSubstate.aidl | 72 ++++ .../hardware/radio/sim/PhonebookCapacity.aidl | 47 +++ .../radio/sim/PhonebookRecordInfo.aidl | 42 ++ .../android/hardware/radio/sim/PinState.aidl | 43 ++ .../hardware/radio/sim/SelectUiccSub.aidl | 46 +++ .../hardware/radio/sim/SessionInfo.aidl | 39 ++ .../2/android/hardware/radio/sim/SimApdu.aidl | 45 +++ .../radio/sim/SimLockMultiSimPolicy.aidl | 39 ++ .../hardware/radio/sim/SimRefreshResult.aidl | 43 ++ .../android.hardware.radio.voice/2/.hash | 1 + .../hardware/radio/voice/AudioQuality.aidl | 47 +++ .../2/android/hardware/radio/voice/Call.aidl | 62 +++ .../hardware/radio/voice/CallForwardInfo.aidl | 48 +++ .../hardware/radio/voice/CdmaCallWaiting.aidl | 57 +++ .../radio/voice/CdmaDisplayInfoRecord.aidl | 39 ++ .../radio/voice/CdmaInformationRecord.aidl | 57 +++ .../voice/CdmaLineControlInfoRecord.aidl | 41 ++ .../radio/voice/CdmaNumberInfoRecord.aidl | 43 ++ .../radio/voice/CdmaOtaProvisionStatus.aidl | 49 +++ .../CdmaRedirectingNumberInfoRecord.aidl | 46 +++ .../radio/voice/CdmaSignalInfoRecord.aidl | 41 ++ .../voice/CdmaT53AudioControlInfoRecord.aidl | 39 ++ .../radio/voice/CdmaT53ClirInfoRecord.aidl | 38 ++ .../android/hardware/radio/voice/CfData.aidl | 39 ++ .../hardware/radio/voice/ClipStatus.aidl | 40 ++ .../2/android/hardware/radio/voice/Dial.aidl | 43 ++ .../radio/voice/EmergencyCallRouting.aidl | 40 ++ .../hardware/radio/voice/EmergencyNumber.aidl | 47 +++ .../radio/voice/EmergencyServiceCategory.aidl | 45 +++ .../hardware/radio/voice/IRadioVoice.aidl | 76 ++++ .../radio/voice/IRadioVoiceIndication.aidl | 52 +++ .../radio/voice/IRadioVoiceResponse.aidl | 75 ++++ .../radio/voice/LastCallFailCause.aidl | 133 ++++++ .../radio/voice/LastCallFailCauseInfo.aidl | 39 ++ .../hardware/radio/voice/SrvccState.aidl | 41 ++ .../hardware/radio/voice/SsInfoData.aidl | 39 ++ .../radio/voice/StkCcUnsolSsResult.aidl | 84 ++++ .../android/hardware/radio/voice/TtyMode.aidl | 41 ++ .../hardware/radio/voice/UssdModeType.aidl | 43 ++ .../android/hardware/radio/voice/UusInfo.aidl | 52 +++ .../aidl_api/android.hardware.radio/2/.hash | 1 + .../android/hardware/radio/AccessNetwork.aidl | 44 ++ .../hardware/radio/RadioAccessFamily.aidl | 61 +++ .../2/android/hardware/radio/RadioConst.aidl | 41 ++ .../2/android/hardware/radio/RadioError.aidl | 126 ++++++ .../hardware/radio/RadioIndicationType.aidl | 39 ++ .../hardware/radio/RadioResponseInfo.aidl | 40 ++ .../radio/RadioResponseInfoModem.aidl | 41 ++ .../hardware/radio/RadioResponseType.aidl | 40 ++ .../hardware/radio/RadioTechnology.aidl | 61 +++ .../hardware/radio/RadioTechnologyFamily.aidl | 39 ++ secure_element/aidl/Android.bp | 8 + .../android.hardware.secure_element/1/.hash | 1 + .../secure_element/ISecureElement.aidl | 50 +++ .../ISecureElementCallback.aidl | 38 ++ .../LogicalChannelResponse.aidl | 39 ++ security/keymint/aidl/Android.bp | 6 +- .../android.hardware.security.keymint/3/.hash | 1 + .../hardware/security/keymint/Algorithm.aidl | 43 ++ .../security/keymint/AttestationKey.aidl | 41 ++ .../security/keymint/BeginResult.aidl | 41 ++ .../hardware/security/keymint/BlockMode.aidl | 42 ++ .../security/keymint/Certificate.aidl | 39 ++ .../hardware/security/keymint/Digest.aidl | 45 +++ .../hardware/security/keymint/EcCurve.aidl | 43 ++ .../hardware/security/keymint/ErrorCode.aidl | 125 ++++++ .../security/keymint/HardwareAuthToken.aidl | 44 ++ .../keymint/HardwareAuthenticatorType.aidl | 42 ++ .../security/keymint/IKeyMintDevice.aidl | 56 +++ .../security/keymint/IKeyMintOperation.aidl | 42 ++ .../security/keymint/KeyCharacteristics.aidl | 40 ++ .../security/keymint/KeyCreationResult.aidl | 41 ++ .../hardware/security/keymint/KeyFormat.aidl | 41 ++ .../security/keymint/KeyMintHardwareInfo.aidl | 43 ++ .../hardware/security/keymint/KeyOrigin.aidl | 43 ++ .../security/keymint/KeyParameter.aidl | 40 ++ .../security/keymint/KeyParameterValue.aidl | 53 +++ .../hardware/security/keymint/KeyPurpose.aidl | 45 +++ .../security/keymint/PaddingMode.aidl | 44 ++ .../security/keymint/SecurityLevel.aidl | 42 ++ .../hardware/security/keymint/Tag.aidl | 104 +++++ .../hardware/security/keymint/TagType.aidl | 49 +++ security/rkp/aidl/Android.bp | 6 + .../android.hardware.security.rkp/3/.hash | 1 + .../hardware/security/keymint/DeviceInfo.aidl | 39 ++ .../IRemotelyProvisionedComponent.aidl | 48 +++ .../security/keymint/MacedPublicKey.aidl | 39 ++ .../security/keymint/ProtectedData.aidl | 39 ++ .../security/keymint/RpcHardwareInfo.aidl | 47 +++ sensors/aidl/Android.bp | 9 + .../aidl_api/android.hardware.sensors/2/.hash | 1 + .../hardware/sensors/AdditionalInfo.aidl | 76 ++++ .../hardware/sensors/DynamicSensorInfo.aidl | 44 ++ .../2/android/hardware/sensors/Event.aidl | 139 +++++++ .../2/android/hardware/sensors/ISensors.aidl | 91 +++++ .../hardware/sensors/ISensorsCallback.aidl | 39 ++ .../android/hardware/sensors/SensorInfo.aidl | 71 ++++ .../hardware/sensors/SensorStatus.aidl | 42 ++ .../android/hardware/sensors/SensorType.aidl | 80 ++++ thermal/aidl/Android.bp | 8 + .../aidl_api/android.hardware.thermal/1/.hash | 1 + .../hardware/thermal/CoolingDevice.aidl | 41 ++ .../android/hardware/thermal/CoolingType.aidl | 49 +++ .../1/android/hardware/thermal/IThermal.aidl | 47 +++ .../thermal/IThermalChangedCallback.aidl | 39 ++ .../android/hardware/thermal/Temperature.aidl | 42 ++ .../thermal/TemperatureThreshold.aidl | 42 ++ .../hardware/thermal/TemperatureType.aidl | 53 +++ .../hardware/thermal/ThrottlingSeverity.aidl | 45 +++ tv/hdmi/cec/aidl/Android.bp | 8 + .../android.hardware.tv.hdmi.cec/1/.hash | 1 + .../hardware/tv/hdmi/cec/AbortReason.aidl | 43 ++ .../hardware/tv/hdmi/cec/CecDeviceType.aidl | 43 ++ .../tv/hdmi/cec/CecLogicalAddress.aidl | 54 +++ .../hardware/tv/hdmi/cec/CecMessage.aidl | 41 ++ .../hardware/tv/hdmi/cec/CecMessageType.aidl | 111 +++++ .../hardware/tv/hdmi/cec/IHdmiCec.aidl | 49 +++ .../tv/hdmi/cec/IHdmiCecCallback.aidl | 38 ++ .../android/hardware/tv/hdmi/cec/Result.aidl | 43 ++ .../tv/hdmi/cec/SendMessageResult.aidl | 41 ++ tv/hdmi/connection/aidl/Android.bp | 8 + .../1/.hash | 1 + .../tv/hdmi/connection/HdmiPortInfo.aidl | 43 ++ .../tv/hdmi/connection/HdmiPortType.aidl | 39 ++ .../tv/hdmi/connection/HpdSignal.aidl | 39 ++ .../tv/hdmi/connection/IHdmiConnection.aidl | 42 ++ .../connection/IHdmiConnectionCallback.aidl | 38 ++ .../hardware/tv/hdmi/connection/Result.aidl | 42 ++ tv/hdmi/earc/aidl/Android.bp | 8 + .../android.hardware.tv.hdmi.earc/1/.hash | 1 + .../android/hardware/tv/hdmi/earc/IEArc.aidl | 42 ++ .../hardware/tv/hdmi/earc/IEArcCallback.aidl | 39 ++ .../hardware/tv/hdmi/earc/IEArcStatus.aidl | 41 ++ .../android/hardware/tv/hdmi/earc/Result.aidl | 41 ++ tv/input/aidl/Android.bp | 12 + .../android.hardware.tv.input/1/.hash | 1 + .../tv/input/CableConnectionStatus.aidl | 40 ++ .../1/android/hardware/tv/input/ITvInput.aidl | 47 +++ .../hardware/tv/input/ITvInputCallback.aidl | 39 ++ .../hardware/tv/input/TvInputDeviceInfo.aidl | 42 ++ .../hardware/tv/input/TvInputEvent.aidl | 39 ++ .../hardware/tv/input/TvInputEventType.aidl | 40 ++ .../hardware/tv/input/TvInputType.aidl | 47 +++ .../android/hardware/tv/input/TvMessage.aidl | 41 ++ .../hardware/tv/input/TvMessageEvent.aidl | 40 ++ .../hardware/tv/input/TvMessageEventType.aidl | 40 ++ .../hardware/tv/input/TvStreamConfig.aidl | 40 ++ tv/tuner/aidl/Android.bp | 9 + .../android.hardware.tv.tuner/2/.hash | 1 + .../hardware/tv/tuner/AudioExtraMetaData.aidl | 44 ++ .../hardware/tv/tuner/AudioPreselection.aidl | 45 +++ .../tv/tuner/AudioPreselectionLabel.aidl | 40 ++ ...ioPreselectionRenderingIndicationType.aidl | 43 ++ .../hardware/tv/tuner/AudioPresentation.aidl | 40 ++ .../hardware/tv/tuner/AudioStreamType.aidl | 58 +++ .../hardware/tv/tuner/AvStreamType.aidl | 40 ++ .../2/android/hardware/tv/tuner/Constant.aidl | 51 +++ .../hardware/tv/tuner/Constant64Bit.aidl | 41 ++ .../android/hardware/tv/tuner/DataFormat.aidl | 43 ++ .../tv/tuner/DemuxAlpFilterSettings.aidl | 41 ++ .../DemuxAlpFilterSettingsFilterSettings.aidl | 40 ++ .../hardware/tv/tuner/DemuxAlpFilterType.aidl | 42 ++ .../hardware/tv/tuner/DemuxAlpLengthType.aidl | 41 ++ .../hardware/tv/tuner/DemuxCapabilities.aidl | 51 +++ .../tv/tuner/DemuxFilterAvSettings.aidl | 40 ++ .../tv/tuner/DemuxFilterDownloadEvent.aidl | 44 ++ .../tv/tuner/DemuxFilterDownloadSettings.aidl | 40 ++ .../hardware/tv/tuner/DemuxFilterEvent.aidl | 48 +++ .../tv/tuner/DemuxFilterIpPayloadEvent.aidl | 39 ++ .../tv/tuner/DemuxFilterMainType.aidl | 44 ++ .../tv/tuner/DemuxFilterMediaEvent.aidl | 52 +++ .../DemuxFilterMediaEventExtraMetaData.aidl | 41 ++ .../tv/tuner/DemuxFilterMmtpRecordEvent.aidl | 44 ++ .../tv/tuner/DemuxFilterMonitorEvent.aidl | 40 ++ .../tv/tuner/DemuxFilterMonitorEventType.aidl | 40 ++ .../tv/tuner/DemuxFilterPesDataSettings.aidl | 40 ++ .../tv/tuner/DemuxFilterPesEvent.aidl | 41 ++ .../tv/tuner/DemuxFilterRecordSettings.aidl | 41 ++ .../tv/tuner/DemuxFilterScIndexMask.aidl | 42 ++ .../tv/tuner/DemuxFilterSectionBits.aidl | 41 ++ .../tv/tuner/DemuxFilterSectionEvent.aidl | 42 ++ .../tv/tuner/DemuxFilterSectionSettings.aidl | 43 ++ .../DemuxFilterSectionSettingsCondition.aidl | 40 ++ ...lterSectionSettingsConditionTableInfo.aidl | 40 ++ .../tv/tuner/DemuxFilterSettings.aidl | 43 ++ .../hardware/tv/tuner/DemuxFilterStatus.aidl | 43 ++ .../hardware/tv/tuner/DemuxFilterSubType.aidl | 43 ++ .../tv/tuner/DemuxFilterTemiEvent.aidl | 41 ++ .../tv/tuner/DemuxFilterTsRecordEvent.aidl | 44 ++ .../hardware/tv/tuner/DemuxFilterType.aidl | 40 ++ .../android/hardware/tv/tuner/DemuxInfo.aidl | 39 ++ .../hardware/tv/tuner/DemuxIpAddress.aidl | 42 ++ .../tv/tuner/DemuxIpAddressIpAddress.aidl | 40 ++ .../tv/tuner/DemuxIpFilterSettings.aidl | 40 ++ .../DemuxIpFilterSettingsFilterSettings.aidl | 41 ++ .../hardware/tv/tuner/DemuxIpFilterType.aidl | 44 ++ .../tv/tuner/DemuxMmtpFilterSettings.aidl | 40 ++ ...DemuxMmtpFilterSettingsFilterSettings.aidl | 44 ++ .../tv/tuner/DemuxMmtpFilterType.aidl | 46 +++ .../2/android/hardware/tv/tuner/DemuxPid.aidl | 40 ++ .../tv/tuner/DemuxQueueNotifyBits.aidl | 40 ++ .../tv/tuner/DemuxRecordScIndexType.aidl | 43 ++ .../hardware/tv/tuner/DemuxScAvcIndex.aidl | 44 ++ .../hardware/tv/tuner/DemuxScHevcIndex.aidl | 47 +++ .../hardware/tv/tuner/DemuxScIndex.aidl | 43 ++ .../hardware/tv/tuner/DemuxScVvcIndex.aidl | 46 +++ .../tv/tuner/DemuxTlvFilterSettings.aidl | 41 ++ .../DemuxTlvFilterSettingsFilterSettings.aidl | 41 ++ .../hardware/tv/tuner/DemuxTlvFilterType.aidl | 42 ++ .../tv/tuner/DemuxTsFilterSettings.aidl | 40 ++ .../DemuxTsFilterSettingsFilterSettings.aidl | 43 ++ .../hardware/tv/tuner/DemuxTsFilterType.aidl | 47 +++ .../hardware/tv/tuner/DemuxTsIndex.aidl | 56 +++ .../hardware/tv/tuner/DvrSettings.aidl | 40 ++ .../2/android/hardware/tv/tuner/DvrType.aidl | 40 ++ .../hardware/tv/tuner/FilterDelayHint.aidl | 40 ++ .../tv/tuner/FilterDelayHintType.aidl | 41 ++ .../tv/tuner/FrontendAnalogAftFlag.aidl | 41 ++ .../tv/tuner/FrontendAnalogCapabilities.aidl | 40 ++ .../tv/tuner/FrontendAnalogSettings.aidl | 44 ++ .../tv/tuner/FrontendAnalogSifStandard.aidl | 57 +++ .../hardware/tv/tuner/FrontendAnalogType.aidl | 47 +++ .../tv/tuner/FrontendAtsc3Bandwidth.aidl | 43 ++ .../tv/tuner/FrontendAtsc3Capabilities.aidl | 44 ++ .../tv/tuner/FrontendAtsc3CodeRate.aidl | 52 +++ .../tuner/FrontendAtsc3DemodOutputFormat.aidl | 41 ++ .../hardware/tv/tuner/FrontendAtsc3Fec.aidl | 46 +++ .../tv/tuner/FrontendAtsc3Modulation.aidl | 46 +++ .../tv/tuner/FrontendAtsc3PlpSettings.aidl | 43 ++ .../tv/tuner/FrontendAtsc3Settings.aidl | 44 ++ .../FrontendAtsc3TimeInterleaveMode.aidl | 42 ++ .../tv/tuner/FrontendAtscCapabilities.aidl | 39 ++ .../tv/tuner/FrontendAtscModulation.aidl | 42 ++ .../tv/tuner/FrontendAtscSettings.aidl | 42 ++ .../hardware/tv/tuner/FrontendBandwidth.aidl | 43 ++ .../FrontendCableTimeInterleaveMode.aidl | 49 +++ .../tv/tuner/FrontendCapabilities.aidl | 49 +++ .../tv/tuner/FrontendDtmbBandwidth.aidl | 42 ++ .../tv/tuner/FrontendDtmbCapabilities.aidl | 44 ++ .../tv/tuner/FrontendDtmbCodeRate.aidl | 43 ++ .../tv/tuner/FrontendDtmbGuardInterval.aidl | 46 +++ .../tv/tuner/FrontendDtmbModulation.aidl | 45 +++ .../tv/tuner/FrontendDtmbSettings.aidl | 47 +++ .../tuner/FrontendDtmbTimeInterleaveMode.aidl | 42 ++ .../tuner/FrontendDtmbTransmissionMode.aidl | 42 ++ .../hardware/tv/tuner/FrontendDvbcAnnex.aidl | 42 ++ .../tv/tuner/FrontendDvbcBandwidth.aidl | 43 ++ .../tv/tuner/FrontendDvbcCapabilities.aidl | 41 ++ .../tv/tuner/FrontendDvbcModulation.aidl | 45 +++ .../tv/tuner/FrontendDvbcOuterFec.aidl | 41 ++ .../tv/tuner/FrontendDvbcSettings.aidl | 48 +++ .../tv/tuner/FrontendDvbsCapabilities.aidl | 41 ++ .../tv/tuner/FrontendDvbsCodeRate.aidl | 42 ++ .../tv/tuner/FrontendDvbsModulation.aidl | 53 +++ .../hardware/tv/tuner/FrontendDvbsPilot.aidl | 42 ++ .../tv/tuner/FrontendDvbsRolloff.aidl | 45 +++ .../tv/tuner/FrontendDvbsScanType.aidl | 43 ++ .../tv/tuner/FrontendDvbsSettings.aidl | 51 +++ .../tv/tuner/FrontendDvbsStandard.aidl | 43 ++ .../tv/tuner/FrontendDvbsVcmMode.aidl | 41 ++ .../tv/tuner/FrontendDvbtBandwidth.aidl | 46 +++ .../tv/tuner/FrontendDvbtCapabilities.aidl | 46 +++ .../tv/tuner/FrontendDvbtCoderate.aidl | 49 +++ .../tv/tuner/FrontendDvbtConstellation.aidl | 48 +++ .../tv/tuner/FrontendDvbtGuardInterval.aidl | 47 +++ .../tv/tuner/FrontendDvbtHierarchy.aidl | 48 +++ .../tv/tuner/FrontendDvbtPlpMode.aidl | 41 ++ .../tv/tuner/FrontendDvbtSettings.aidl | 54 +++ .../tv/tuner/FrontendDvbtStandard.aidl | 42 ++ .../tuner/FrontendDvbtTransmissionMode.aidl | 49 +++ .../hardware/tv/tuner/FrontendEventType.aidl | 41 ++ .../tv/tuner/FrontendGuardInterval.aidl | 41 ++ .../hardware/tv/tuner/FrontendInfo.aidl | 47 +++ .../hardware/tv/tuner/FrontendInnerFec.aidl | 92 +++++ .../tv/tuner/FrontendInterleaveMode.aidl | 42 ++ .../tv/tuner/FrontendIptvCapabilities.aidl | 39 ++ .../tv/tuner/FrontendIptvSettings.aidl | 44 ++ .../tv/tuner/FrontendIptvSettingsFec.aidl | 41 ++ .../tv/tuner/FrontendIptvSettingsFecType.aidl | 42 ++ .../tv/tuner/FrontendIptvSettingsIgmp.aidl | 42 ++ .../tuner/FrontendIptvSettingsProtocol.aidl | 41 ++ .../tv/tuner/FrontendIsdbs3Capabilities.aidl | 40 ++ .../tv/tuner/FrontendIsdbs3Coderate.aidl | 51 +++ .../tv/tuner/FrontendIsdbs3Modulation.aidl | 45 +++ .../tv/tuner/FrontendIsdbs3Rolloff.aidl | 40 ++ .../tv/tuner/FrontendIsdbs3Settings.aidl | 46 +++ .../tv/tuner/FrontendIsdbsCapabilities.aidl | 40 ++ .../tv/tuner/FrontendIsdbsCoderate.aidl | 45 +++ .../tv/tuner/FrontendIsdbsModulation.aidl | 43 ++ .../tv/tuner/FrontendIsdbsRolloff.aidl | 40 ++ .../tv/tuner/FrontendIsdbsSettings.aidl | 46 +++ .../tv/tuner/FrontendIsdbsStreamIdType.aidl | 41 ++ .../tv/tuner/FrontendIsdbtBandwidth.aidl | 43 ++ .../tv/tuner/FrontendIsdbtCapabilities.aidl | 46 +++ .../tv/tuner/FrontendIsdbtCoderate.aidl | 49 +++ .../tv/tuner/FrontendIsdbtGuardInterval.aidl | 47 +++ .../tv/tuner/FrontendIsdbtLayerSettings.aidl | 42 ++ .../hardware/tv/tuner/FrontendIsdbtMode.aidl | 43 ++ .../tv/tuner/FrontendIsdbtModulation.aidl | 44 ++ .../FrontendIsdbtPartialReceptionFlag.aidl | 42 ++ .../tv/tuner/FrontendIsdbtSettings.aidl | 47 +++ .../FrontendIsdbtTimeInterleaveMode.aidl | 52 +++ .../hardware/tv/tuner/FrontendModulation.aidl | 47 +++ .../tv/tuner/FrontendModulationStatus.aidl | 43 ++ .../hardware/tv/tuner/FrontendRollOff.aidl | 41 ++ .../tv/tuner/FrontendScanAtsc3PlpInfo.aidl | 40 ++ .../tv/tuner/FrontendScanMessage.aidl | 54 +++ .../tv/tuner/FrontendScanMessageStandard.aidl | 41 ++ .../tv/tuner/FrontendScanMessageType.aidl | 54 +++ .../hardware/tv/tuner/FrontendScanType.aidl | 41 ++ .../hardware/tv/tuner/FrontendSettings.aidl | 49 +++ .../tv/tuner/FrontendSpectralInversion.aidl | 41 ++ .../hardware/tv/tuner/FrontendStatus.aidl | 85 ++++ .../tv/tuner/FrontendStatusAtsc3PlpInfo.aidl | 41 ++ .../tv/tuner/FrontendStatusReadiness.aidl | 43 ++ .../hardware/tv/tuner/FrontendStatusType.aidl | 85 ++++ .../tv/tuner/FrontendTransmissionMode.aidl | 41 ++ .../hardware/tv/tuner/FrontendType.aidl | 50 +++ .../2/android/hardware/tv/tuner/IDemux.aidl | 47 +++ .../hardware/tv/tuner/IDescrambler.aidl | 43 ++ .../2/android/hardware/tv/tuner/IDvr.aidl | 47 +++ .../hardware/tv/tuner/IDvrCallback.aidl | 40 ++ .../2/android/hardware/tv/tuner/IFilter.aidl | 53 +++ .../hardware/tv/tuner/IFilterCallback.aidl | 40 ++ .../android/hardware/tv/tuner/IFrontend.aidl | 51 +++ .../hardware/tv/tuner/IFrontendCallback.aidl | 40 ++ .../2/android/hardware/tv/tuner/ILnb.aidl | 44 ++ .../hardware/tv/tuner/ILnbCallback.aidl | 40 ++ .../hardware/tv/tuner/ITimeFilter.aidl | 43 ++ .../2/android/hardware/tv/tuner/ITuner.aidl | 54 +++ .../hardware/tv/tuner/LnbEventType.aidl | 42 ++ .../hardware/tv/tuner/LnbPosition.aidl | 41 ++ .../2/android/hardware/tv/tuner/LnbTone.aidl | 40 ++ .../android/hardware/tv/tuner/LnbVoltage.aidl | 47 +++ .../hardware/tv/tuner/PlaybackSettings.aidl | 43 ++ .../hardware/tv/tuner/PlaybackStatus.aidl | 42 ++ .../hardware/tv/tuner/RecordSettings.aidl | 43 ++ .../hardware/tv/tuner/RecordStatus.aidl | 42 ++ .../2/android/hardware/tv/tuner/Result.aidl | 45 +++ .../hardware/tv/tuner/ScramblingStatus.aidl | 41 ++ .../hardware/tv/tuner/VideoStreamType.aidl | 52 +++ usb/aidl/Android.bp | 6 + .../aidl_api/android.hardware.usb/2/.hash | 1 + .../2/android/hardware/usb/AltModeData.aidl | 46 +++ .../hardware/usb/ComplianceWarning.aidl | 41 ++ .../usb/ContaminantDetectionStatus.aidl | 41 ++ .../usb/ContaminantProtectionMode.aidl | 41 ++ .../usb/ContaminantProtectionStatus.aidl | 42 ++ .../usb/DisplayPortAltModePinAssignment.aidl | 44 ++ .../usb/DisplayPortAltModeStatus.aidl | 41 ++ .../2/android/hardware/usb/IUsb.aidl | 45 +++ .../2/android/hardware/usb/IUsbCallback.aidl | 45 +++ .../hardware/usb/LinkTrainingStatus.aidl | 40 ++ .../android/hardware/usb/PlugOrientation.aidl | 42 ++ .../2/android/hardware/usb/PortDataRole.aidl | 40 ++ .../2/android/hardware/usb/PortMode.aidl | 43 ++ .../2/android/hardware/usb/PortPowerRole.aidl | 40 ++ .../2/android/hardware/usb/PortRole.aidl | 40 ++ .../2/android/hardware/usb/PortStatus.aidl | 57 +++ .../hardware/usb/PowerBrickStatus.aidl | 40 ++ .../2/android/hardware/usb/Status.aidl | 42 ++ .../2/android/hardware/usb/UsbDataStatus.aidl | 46 +++ usb/gadget/aidl/Android.bp | 8 + .../android.hardware.usb.gadget/1/.hash | 1 + .../hardware/usb/gadget/GadgetFunction.aidl | 47 +++ .../hardware/usb/gadget/IUsbGadget.aidl | 41 ++ .../usb/gadget/IUsbGadgetCallback.aidl | 41 ++ .../1/android/hardware/usb/gadget/Status.aidl | 42 ++ .../android/hardware/usb/gadget/UsbSpeed.aidl | 48 +++ weaver/aidl/Android.bp | 6 + .../aidl_api/android.hardware.weaver/2/.hash | 1 + .../2/android/hardware/weaver/IWeaver.aidl | 43 ++ .../android/hardware/weaver/WeaverConfig.aidl | 40 ++ .../hardware/weaver/WeaverReadResponse.aidl | 40 ++ .../hardware/weaver/WeaverReadStatus.aidl | 41 ++ wifi/aidl/Android.bp | 8 + .../aidl_api/android.hardware.wifi/1/.hash | 1 + .../hardware/wifi/AfcChannelAllowance.aidl | 40 ++ .../wifi/AvailableAfcChannelInfo.aidl | 40 ++ .../wifi/AvailableAfcFrequencyInfo.aidl | 40 ++ .../1/android/hardware/wifi/IWifi.aidl | 43 ++ .../1/android/hardware/wifi/IWifiApIface.aidl | 43 ++ .../1/android/hardware/wifi/IWifiChip.aidl | 175 ++++++++ .../hardware/wifi/IWifiChipEventCallback.aidl | 55 +++ .../hardware/wifi/IWifiEventCallback.aidl | 41 ++ .../android/hardware/wifi/IWifiNanIface.aidl | 62 +++ .../wifi/IWifiNanIfaceEventCallback.aidl | 75 ++++ .../android/hardware/wifi/IWifiP2pIface.aidl | 38 ++ .../hardware/wifi/IWifiRttController.aidl | 47 +++ .../wifi/IWifiRttControllerEventCallback.aidl | 38 ++ .../android/hardware/wifi/IWifiStaIface.aidl | 81 ++++ .../wifi/IWifiStaIfaceEventCallback.aidl | 41 ++ .../hardware/wifi/IfaceConcurrencyType.aidl | 42 ++ .../1/android/hardware/wifi/IfaceType.aidl | 41 ++ .../1/android/hardware/wifi/MacAddress.aidl | 38 ++ .../1/android/hardware/wifi/NanBandIndex.aidl | 40 ++ .../hardware/wifi/NanBandSpecificConfig.aidl | 44 ++ .../wifi/NanBootstrappingConfirmInd.aidl | 42 ++ .../hardware/wifi/NanBootstrappingMethod.aidl | 48 +++ .../wifi/NanBootstrappingRequest.aidl | 41 ++ .../wifi/NanBootstrappingRequestInd.aidl | 42 ++ .../wifi/NanBootstrappingResponse.aidl | 39 ++ .../wifi/NanBootstrappingResponseCode.aidl | 40 ++ .../hardware/wifi/NanCapabilities.aidl | 57 +++ .../hardware/wifi/NanCipherSuiteType.aidl | 44 ++ .../hardware/wifi/NanClusterEventInd.aidl | 39 ++ .../hardware/wifi/NanClusterEventType.aidl | 40 ++ .../hardware/wifi/NanConfigRequest.aidl | 48 +++ .../wifi/NanConfigRequestSupplemental.aidl | 44 ++ .../hardware/wifi/NanDataPathChannelCfg.aidl | 40 ++ .../hardware/wifi/NanDataPathChannelInfo.aidl | 40 ++ .../hardware/wifi/NanDataPathConfirmInd.aidl | 43 ++ .../hardware/wifi/NanDataPathRequestInd.aidl | 42 ++ .../wifi/NanDataPathScheduleUpdateInd.aidl | 40 ++ .../wifi/NanDataPathSecurityConfig.aidl | 42 ++ .../wifi/NanDataPathSecurityType.aidl | 40 ++ .../android/hardware/wifi/NanDebugConfig.aidl | 54 +++ .../wifi/NanDiscoveryCommonConfig.aidl | 58 +++ .../hardware/wifi/NanEnableRequest.aidl | 41 ++ .../hardware/wifi/NanFollowupReceivedInd.aidl | 43 ++ .../wifi/NanIdentityResolutionAttribute.aidl | 39 ++ .../wifi/NanInitiateDataPathRequest.aidl | 46 +++ .../1/android/hardware/wifi/NanMatchAlg.aidl | 40 ++ .../1/android/hardware/wifi/NanMatchInd.aidl | 54 +++ .../android/hardware/wifi/NanPairingAkm.aidl | 39 ++ .../hardware/wifi/NanPairingConfig.aidl | 41 ++ .../hardware/wifi/NanPairingConfirmInd.aidl | 43 ++ .../hardware/wifi/NanPairingRequest.aidl | 43 ++ .../hardware/wifi/NanPairingRequestInd.aidl | 44 ++ .../hardware/wifi/NanPairingRequestType.aidl | 39 ++ .../wifi/NanPairingSecurityConfig.aidl | 42 ++ .../hardware/wifi/NanPairingSecurityType.aidl | 40 ++ .../hardware/wifi/NanPublishRequest.aidl | 43 ++ .../android/hardware/wifi/NanPublishType.aidl | 40 ++ .../hardware/wifi/NanRangingIndication.aidl | 40 ++ ...NanRespondToDataPathIndicationRequest.aidl | 44 ++ .../NanRespondToPairingIndicationRequest.aidl | 43 ++ .../1/android/hardware/wifi/NanSrfType.aidl | 39 ++ .../1/android/hardware/wifi/NanStatus.aidl | 39 ++ .../android/hardware/wifi/NanStatusCode.aidl | 55 +++ .../hardware/wifi/NanSubscribeRequest.aidl | 46 +++ .../hardware/wifi/NanSubscribeType.aidl | 39 ++ .../wifi/NanSuspensionModeChangeInd.aidl | 38 ++ .../wifi/NanTransmitFollowupRequest.aidl | 45 +++ .../1/android/hardware/wifi/NanTxType.aidl | 39 ++ .../hardware/wifi/NpkSecurityAssociation.aidl | 42 ++ .../1/android/hardware/wifi/RttBw.aidl | 45 +++ .../hardware/wifi/RttCapabilities.aidl | 45 +++ .../1/android/hardware/wifi/RttConfig.aidl | 51 +++ .../hardware/wifi/RttLciInformation.aidl | 47 +++ .../hardware/wifi/RttLcrInformation.aidl | 39 ++ .../hardware/wifi/RttMotionPattern.aidl | 40 ++ .../1/android/hardware/wifi/RttPeerType.aidl | 42 ++ .../1/android/hardware/wifi/RttPreamble.aidl | 42 ++ .../1/android/hardware/wifi/RttResponder.aidl | 39 ++ .../1/android/hardware/wifi/RttResult.aidl | 62 +++ .../1/android/hardware/wifi/RttStatus.aidl | 55 +++ .../1/android/hardware/wifi/RttType.aidl | 39 ++ .../1/android/hardware/wifi/Ssid.aidl | 38 ++ .../wifi/StaApfPacketFilterCapabilities.aidl | 39 ++ ...groundScanBucketEventReportSchemeMask.aidl | 40 ++ .../StaBackgroundScanBucketParameters.aidl | 45 +++ .../wifi/StaBackgroundScanCapabilities.aidl | 41 ++ .../wifi/StaBackgroundScanLimits.aidl | 40 ++ .../wifi/StaBackgroundScanParameters.aidl | 42 ++ .../StaLinkLayerIfaceContentionTimeStats.aidl | 41 ++ .../wifi/StaLinkLayerIfacePacketStats.aidl | 41 ++ .../hardware/wifi/StaLinkLayerIfaceStats.aidl | 38 ++ .../hardware/wifi/StaLinkLayerLinkStats.aidl | 59 +++ .../hardware/wifi/StaLinkLayerRadioStats.aidl | 49 +++ .../hardware/wifi/StaLinkLayerStats.aidl | 40 ++ .../1/android/hardware/wifi/StaPeerInfo.aidl | 40 ++ .../1/android/hardware/wifi/StaRateStat.aidl | 42 ++ .../hardware/wifi/StaRoamingCapabilities.aidl | 39 ++ .../hardware/wifi/StaRoamingConfig.aidl | 39 ++ .../hardware/wifi/StaRoamingState.aidl | 39 ++ .../1/android/hardware/wifi/StaScanData.aidl | 40 ++ .../hardware/wifi/StaScanDataFlagMask.aidl | 38 ++ .../android/hardware/wifi/StaScanResult.aidl | 45 +++ .../hardware/wifi/WifiAntennaMode.aidl | 42 ++ .../1/android/hardware/wifi/WifiBand.aidl | 51 +++ .../hardware/wifi/WifiChannelInfo.aidl | 41 ++ .../hardware/wifi/WifiChannelStats.aidl | 40 ++ .../hardware/wifi/WifiChannelWidthInMhz.aidl | 46 +++ .../hardware/wifi/WifiChipCapabilities.aidl | 40 ++ ...ebugHostWakeReasonRxIcmpPacketDetails.aidl | 42 ++ ...ostWakeReasonRxMulticastPacketDetails.aidl | 40 ++ ...ifiDebugHostWakeReasonRxPacketDetails.aidl | 40 ++ .../wifi/WifiDebugHostWakeReasonStats.aidl | 45 +++ .../wifi/WifiDebugPacketFateFrameInfo.aidl | 42 ++ .../wifi/WifiDebugPacketFateFrameType.aidl | 40 ++ .../wifi/WifiDebugRingBufferFlags.aidl | 40 ++ .../wifi/WifiDebugRingBufferStatus.aidl | 43 ++ .../wifi/WifiDebugRingBufferVerboseLevel.aidl | 41 ++ .../hardware/wifi/WifiDebugRxPacketFate.aidl | 48 +++ .../wifi/WifiDebugRxPacketFateReport.aidl | 39 ++ .../hardware/wifi/WifiDebugTxPacketFate.aidl | 47 +++ .../wifi/WifiDebugTxPacketFateReport.aidl | 39 ++ .../android/hardware/wifi/WifiIfaceMode.aidl | 45 +++ .../hardware/wifi/WifiInformationElement.aidl | 39 ++ .../hardware/wifi/WifiRadioCombination.aidl | 38 ++ .../hardware/wifi/WifiRadioConfiguration.aidl | 39 ++ .../1/android/hardware/wifi/WifiRateInfo.aidl | 42 ++ .../1/android/hardware/wifi/WifiRateNss.aidl | 41 ++ .../hardware/wifi/WifiRatePreamble.aidl | 44 ++ .../android/hardware/wifi/WifiStatusCode.aidl | 47 +++ .../hardware/wifi/WifiUsableChannel.aidl | 40 ++ wifi/supplicant/aidl/Android.bp | 6 + .../android.hardware.wifi.supplicant/2/.hash | 1 + .../hardware/wifi/supplicant/AnqpData.aidl | 44 ++ .../hardware/wifi/supplicant/AnqpInfoId.aidl | 43 ++ .../supplicant/AssociationRejectionData.aidl | 45 +++ .../hardware/wifi/supplicant/AuthAlgMask.aidl | 41 ++ .../AuxiliarySupplicantEventCode.aidl | 40 ++ .../hardware/wifi/supplicant/BssTmData.aidl | 42 ++ .../wifi/supplicant/BssTmDataFlagsMask.aidl | 45 +++ .../wifi/supplicant/BssTmStatusCode.aidl | 46 +++ .../wifi/supplicant/BssidChangeReason.aidl | 40 ++ .../wifi/supplicant/BtCoexistenceMode.aidl | 40 ++ .../supplicant/ConnectionCapabilities.aidl | 43 ++ .../hardware/wifi/supplicant/DebugLevel.aidl | 43 ++ .../hardware/wifi/supplicant/DppAkm.aidl | 41 ++ .../wifi/supplicant/DppConfigurationData.aidl | 43 ++ .../wifi/supplicant/DppConnectionKeys.aidl | 40 ++ .../hardware/wifi/supplicant/DppCurve.aidl | 43 ++ .../wifi/supplicant/DppEventType.aidl | 39 ++ .../wifi/supplicant/DppFailureCode.aidl | 49 +++ .../hardware/wifi/supplicant/DppNetRole.aidl | 39 ++ .../wifi/supplicant/DppProgressCode.aidl | 41 ++ .../supplicant/DppResponderBootstrapInfo.aidl | 40 ++ .../wifi/supplicant/DppStatusErrorCode.aidl | 53 +++ .../wifi/supplicant/EapErrorCode.aidl | 42 ++ .../hardware/wifi/supplicant/EapMethod.aidl | 45 +++ .../wifi/supplicant/EapPhase2Method.aidl | 45 +++ .../wifi/supplicant/ExtRadioWorkDefaults.aidl | 38 ++ .../hardware/wifi/supplicant/FreqRange.aidl | 39 ++ .../wifi/supplicant/GroupCipherMask.aidl | 45 +++ .../wifi/supplicant/GroupMgmtCipherMask.aidl | 40 ++ .../hardware/wifi/supplicant/GsmRand.aidl | 38 ++ .../wifi/supplicant/Hs20AnqpData.aidl | 41 ++ .../wifi/supplicant/Hs20AnqpSubtypes.aidl | 41 ++ .../supplicant/INonStandardCertCallback.aidl | 39 ++ .../hardware/wifi/supplicant/ISupplicant.aidl | 52 +++ .../wifi/supplicant/ISupplicantCallback.aidl | 39 ++ .../wifi/supplicant/ISupplicantP2pIface.aidl | 100 +++++ .../ISupplicantP2pIfaceCallback.aidl | 56 +++ .../supplicant/ISupplicantP2pNetwork.aidl | 47 +++ .../wifi/supplicant/ISupplicantStaIface.aidl | 102 +++++ .../ISupplicantStaIfaceCallback.aidl | 87 ++++ .../supplicant/ISupplicantStaNetwork.aidl | 138 +++++++ .../ISupplicantStaNetworkCallback.aidl | 43 ++ .../hardware/wifi/supplicant/IfaceInfo.aidl | 39 ++ .../hardware/wifi/supplicant/IfaceType.aidl | 39 ++ .../hardware/wifi/supplicant/IpVersion.aidl | 39 ++ .../hardware/wifi/supplicant/KeyMgmtMask.aidl | 54 +++ .../hardware/wifi/supplicant/LegacyMode.aidl | 41 ++ .../hardware/wifi/supplicant/MacAddress.aidl | 38 ++ .../MboAssocDisallowedReasonCode.aidl | 43 ++ .../MboCellularDataConnectionPrefValue.aidl | 40 ++ .../supplicant/MboTransitionReasonCode.aidl | 47 +++ .../wifi/supplicant/MiracastMode.aidl | 40 ++ .../hardware/wifi/supplicant/MloLink.aidl | 43 ++ .../wifi/supplicant/MloLinksInfo.aidl | 40 ++ .../NetworkRequestEapSimGsmAuthParams.aidl | 38 ++ .../NetworkRequestEapSimUmtsAuthParams.aidl | 39 ++ .../NetworkResponseEapSimGsmAuthParams.aidl | 39 ++ .../NetworkResponseEapSimUmtsAuthParams.aidl | 40 ++ .../OceRssiBasedAssocRejectAttr.aidl | 39 ++ .../hardware/wifi/supplicant/OcspType.aidl | 41 ++ .../hardware/wifi/supplicant/OsuMethod.aidl | 39 ++ .../P2pClientEapolIpAddressInfo.aidl | 40 ++ .../wifi/supplicant/P2pFrameTypeMask.aidl | 50 +++ .../supplicant/P2pGroupCapabilityMask.aidl | 44 ++ .../P2pGroupStartedEventParams.aidl | 48 +++ .../supplicant/P2pProvDiscStatusCode.aidl | 42 ++ .../wifi/supplicant/P2pStatusCode.aidl | 50 +++ .../wifi/supplicant/PairwiseCipherMask.aidl | 43 ++ .../wifi/supplicant/PmkSaCacheData.aidl | 40 ++ .../hardware/wifi/supplicant/PortRange.aidl | 39 ++ .../hardware/wifi/supplicant/ProtoMask.aidl | 41 ++ .../wifi/supplicant/ProtocolNextHeader.aidl | 40 ++ .../supplicant/QosPolicyClassifierParams.aidl | 47 +++ .../QosPolicyClassifierParamsMask.aidl | 45 +++ .../wifi/supplicant/QosPolicyData.aidl | 41 ++ .../wifi/supplicant/QosPolicyRequestType.aidl | 39 ++ .../wifi/supplicant/QosPolicyScsData.aidl | 25 ++ .../supplicant/QosPolicyScsRequestStatus.aidl | 24 ++ .../QosPolicyScsRequestStatusCode.aidl | 26 ++ .../QosPolicyScsResponseStatus.aidl | 24 ++ .../QosPolicyScsResponseStatusCode.aidl | 31 ++ .../wifi/supplicant/QosPolicyStatus.aidl | 39 ++ .../wifi/supplicant/QosPolicyStatusCode.aidl | 41 ++ .../wifi/supplicant/RxFilterType.aidl | 39 ++ .../hardware/wifi/supplicant/SaeH2eMode.aidl | 40 ++ .../wifi/supplicant/SignalPollResult.aidl | 42 ++ .../supplicant/StaIfaceCallbackState.aidl | 47 +++ .../wifi/supplicant/StaIfaceReasonCode.aidl | 98 +++++ .../wifi/supplicant/StaIfaceStatusCode.aidl | 134 ++++++ .../supplicant/SupplicantStateChangeData.aidl | 44 ++ .../wifi/supplicant/SupplicantStatusCode.aidl | 49 +++ .../hardware/wifi/supplicant/TlsVersion.aidl | 41 ++ .../TransitionDisableIndication.aidl | 41 ++ .../wifi/supplicant/WifiTechnology.aidl | 43 ++ .../supplicant/WpaDriverCapabilitiesMask.aidl | 44 ++ .../wifi/supplicant/WpsConfigError.aidl | 58 +++ .../wifi/supplicant/WpsConfigMethods.aidl | 51 +++ .../wifi/supplicant/WpsDevPasswordId.aidl | 45 +++ .../wifi/supplicant/WpsErrorIndication.aidl | 41 ++ .../wifi/supplicant/WpsProvisionMethod.aidl | 40 ++ 1580 files changed, 68100 insertions(+), 18 deletions(-) create mode 100644 audio/aidl/aidl_api/android.hardware.audio.common/2/.hash create mode 100644 audio/aidl/aidl_api/android.hardware.audio.common/2/android/hardware/audio/common/AudioOffloadMetadata.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.common/2/android/hardware/audio/common/PlaybackTrackMetadata.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.common/2/android/hardware/audio/common/RecordTrackMetadata.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.common/2/android/hardware/audio/common/SinkMetadata.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.common/2/android/hardware/audio/common/SourceMetadata.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core.sounddose/1/.hash create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core.sounddose/1/android/hardware/audio/core/sounddose/ISoundDose.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/1/.hash create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/AudioPatch.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/AudioRoute.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IBluetooth.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IBluetoothA2dp.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IBluetoothLe.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IConfig.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IModule.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IStreamCallback.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IStreamCommon.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IStreamIn.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IStreamOut.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IStreamOutEventCallback.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/ITelephony.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/MmapBufferDescriptor.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/ModuleDebug.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/StreamDescriptor.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/SurroundSoundConfig.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/VendorParameter.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/.hash create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/AcousticEchoCanceler.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/AutomaticGainControlV1.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/AutomaticGainControlV2.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/BassBoost.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Capability.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/CommandId.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/DefaultExtension.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Descriptor.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Downmix.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/DynamicsProcessing.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/EnvironmentalReverb.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Equalizer.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Flags.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/HapticGenerator.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/IEffect.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/IFactory.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/LoudnessEnhancer.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/NoiseSuppression.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Parameter.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/PresetReverb.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Processing.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Range.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/State.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/VendorExtension.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Virtualizer.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Visualizer.aidl create mode 100644 audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Volume.aidl create mode 100644 audio/aidl/sounddose/aidl_api/android.hardware.audio.sounddose/1/.hash create mode 100644 audio/aidl/sounddose/aidl_api/android.hardware.audio.sounddose/1/android/hardware/audio/sounddose/ISoundDoseFactory.aidl create mode 100644 automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/.hash create mode 100644 automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/AudioFocusChange.aidl create mode 100644 automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl create mode 100644 automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/DuckingInfo.aidl create mode 100644 automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/IAudioControl.aidl create mode 100644 automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/IAudioGainCallback.aidl create mode 100644 automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/IFocusListener.aidl create mode 100644 automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/IModuleChangeCallback.aidl create mode 100644 automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/MutingInfo.aidl create mode 100644 automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/Reasons.aidl create mode 100644 automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/.hash create mode 100644 automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/BusConfig.aidl create mode 100644 automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/ICanController.aidl create mode 100644 automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/IndexedInterface.aidl create mode 100644 automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/InterfaceType.aidl create mode 100644 automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/NativeInterface.aidl create mode 100644 automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/Result.aidl create mode 100644 automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/SlcanInterface.aidl create mode 100644 automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/VirtualInterface.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/.hash create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/BufferDesc.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/CameraDesc.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/CameraParam.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/ColorChannel.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/DeviceStatus.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/DeviceStatusType.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/DisplayDesc.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/DisplayState.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/EmbeddedData.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/EvsEventDesc.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/EvsEventType.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/EvsResult.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/ExposureParameters.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/GridStatisticDesc.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/GridStatisticType.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/GridStatistics.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/Histogram.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsCamera.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsCameraStream.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsDisplay.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsEnumerator.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsEnumeratorStatusCallback.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsUltrasonicsArray.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsUltrasonicsArrayStream.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/ParameterRange.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/Rotation.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/RotationQuaternion.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/SensorPose.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/Size.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/Stream.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/StreamType.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/Translation.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/UltrasonicSensor.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/UltrasonicsArrayDesc.aidl create mode 100644 automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/UltrasonicsDataFrameDesc.aidl create mode 100644 automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/.hash create mode 100644 automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/ConnectProtocol.aidl create mode 100644 automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/EndpointInfo.aidl create mode 100644 automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/HardwareIdentifiers.aidl create mode 100644 automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/IIvnAndroidDevice.aidl create mode 100644 automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/OccupantType.aidl create mode 100644 automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/OccupantZoneInfo.aidl create mode 100644 automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/1/.hash create mode 100644 automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/1/android/hardware/automotive/remoteaccess/ApState.aidl create mode 100644 automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/1/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl create mode 100644 automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/1/android/hardware/automotive/remoteaccess/IRemoteTaskCallback.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/.hash create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueRequest.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueRequests.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueResult.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueResults.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/IVehicle.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/IVehicleCallback.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/RawPropValues.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueRequest.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueRequests.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueResult.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueResults.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/StatusCode.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SubscribeOptions.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropConfig.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropConfigs.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropError.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropErrors.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropValue.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropValues.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropertyAccess.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.aidl create mode 100644 automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropertyStatus.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/.hash create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/AutomaticEmergencyBrakingState.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/BlindSpotWarningState.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CreateUserRequest.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CreateUserResponse.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CreateUserStatus.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CruiseControlCommand.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CruiseControlState.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CruiseControlType.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CustomInputType.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EmergencyLaneKeepAssistState.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/ErrorState.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvChargeState.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvConnectorType.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvStoppingMode.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvsServiceState.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvsServiceType.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/FuelType.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/HandsOnDetectionDriverState.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/HandsOnDetectionWarning.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/LaneCenteringAssistCommand.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/LaneCenteringAssistState.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/LaneDepartureWarningState.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/LaneKeepAssistState.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/LocationCharacterization.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2FuelType.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/PortLocationType.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/RemoveUserRequest.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/RotaryInputType.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/SwitchUserRequest.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/SwitchUserResponse.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/SwitchUserStatus.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/TrailerState.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserInfo.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UsersInfo.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerBootupReason.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleArea.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleDisplay.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleGear.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHwMotionInputAction.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHwMotionInputSource.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHwMotionToolType.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleLightState.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleOilLevel.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleProperty.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehiclePropertyType.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleUnit.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsMessageType.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/WindshieldWipersState.aidl create mode 100644 automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/WindshieldWipersSwitch.aidl create mode 100644 biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/.hash create mode 100644 biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/AuthenticateReason.aidl create mode 100644 biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/CommonProps.aidl create mode 100644 biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/ComponentInfo.aidl create mode 100644 biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/DisplayState.aidl create mode 100644 biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/ICancellationSignal.aidl create mode 100644 biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/OperationContext.aidl create mode 100644 biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/OperationReason.aidl create mode 100644 biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/SensorStrength.aidl create mode 100644 biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/WakeReason.aidl create mode 100644 biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/.hash create mode 100644 biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/AcquiredInfo.aidl create mode 100644 biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/AuthenticationFrame.aidl create mode 100644 biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/BaseFrame.aidl create mode 100644 biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/Cell.aidl create mode 100644 biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/EnrollmentFrame.aidl create mode 100644 biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/EnrollmentStage.aidl create mode 100644 biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/EnrollmentStageConfig.aidl create mode 100644 biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/EnrollmentType.aidl create mode 100644 biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/Error.aidl create mode 100644 biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/FaceSensorType.aidl create mode 100644 biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/Feature.aidl create mode 100644 biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/IFace.aidl create mode 100644 biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/ISession.aidl create mode 100644 biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/ISessionCallback.aidl create mode 100644 biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/SensorProps.aidl create mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/.hash create mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl create mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/Error.aidl create mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl create mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/IFingerprint.aidl create mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/ISession.aidl create mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/ISessionCallback.aidl create mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/PointerContext.aidl create mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/SensorLocation.aidl create mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/SensorProps.aidl create mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/SensorShape.aidl create mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/TouchDetectionParameters.aidl create mode 100644 bluetooth/aidl/aidl_api/android.hardware.bluetooth/1/.hash create mode 100644 bluetooth/aidl/aidl_api/android.hardware.bluetooth/1/android/hardware/bluetooth/IBluetoothHci.aidl create mode 100644 bluetooth/aidl/aidl_api/android.hardware.bluetooth/1/android/hardware/bluetooth/IBluetoothHciCallbacks.aidl create mode 100644 bluetooth/aidl/aidl_api/android.hardware.bluetooth/1/android/hardware/bluetooth/Status.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/.hash create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AacCapabilities.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AacConfiguration.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AacObjectType.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveCapabilities.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveChannelMode.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveConfiguration.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveInputMode.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveLeCapabilities.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveLeConfiguration.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveTimeToPlay.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxCapabilities.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxConfiguration.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxMode.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxSinkBuffering.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AudioCapabilities.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AudioConfiguration.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AudioLocation.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/BroadcastCapability.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/ChannelMode.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/CodecCapabilities.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/CodecConfiguration.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/CodecType.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/IBluetoothAudioPort.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/IBluetoothAudioProviderFactory.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LatencyMode.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/Lc3Capabilities.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/Lc3Configuration.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LdacCapabilities.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LdacChannelMode.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LdacConfiguration.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LdacQualityIndex.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LeAudioCodecCapabilitiesSetting.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LeAudioCodecConfiguration.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/OpusCapabilities.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/OpusConfiguration.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/PcmCapabilities.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/PcmConfiguration.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/PresentationPosition.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/SbcAllocMethod.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/SbcCapabilities.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/SbcChannelMode.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/SbcConfiguration.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/SessionType.aidl create mode 100644 bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/UnicastCapability.aidl create mode 100644 boot/aidl/aidl_api/android.hardware.boot/1/.hash create mode 100644 boot/aidl/aidl_api/android.hardware.boot/1/android/hardware/boot/IBootControl.aidl create mode 100644 boot/aidl/aidl_api/android.hardware.boot/1/android/hardware/boot/MergeStatus.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/.hash create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/AmFmBandRange.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/AmFmRegionConfig.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/Announcement.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/AnnouncementType.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ConfigFlag.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/DabTableEntry.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/IAnnouncementListener.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/IBroadcastRadio.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ICloseHandle.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ITunerCallback.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/IdentifierType.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/Metadata.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ProgramFilter.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ProgramIdentifier.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ProgramInfo.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ProgramListChunk.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ProgramSelector.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/Properties.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/Result.aidl create mode 100644 broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/VendorKeyValue.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/.hash create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/BufferCache.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/BufferRequest.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/BufferRequestStatus.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/BufferStatus.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CameraBlob.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CameraBlobId.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CameraMetadata.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CameraOfflineSessionInfo.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CaptureRequest.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CaptureResult.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ErrorCode.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ErrorMsg.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/HalStream.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ICameraDevice.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ICameraDeviceCallback.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ICameraDeviceSession.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ICameraInjectionSession.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ICameraOfflineSession.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/NotifyMsg.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/OfflineRequest.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/OfflineStream.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/PhysicalCameraMetadata.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/PhysicalCameraSetting.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/RequestTemplate.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ShutterMsg.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/Stream.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamBuffer.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamBufferRequestError.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamBufferRet.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamBuffersVal.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamConfiguration.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamConfigurationMode.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamRotation.aidl create mode 100644 camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamType.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/.hash create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/AutomotiveLensFacing.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/AutomotiveLocation.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/BlackLevelLock.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/CameraMetadataSection.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/CameraMetadataTag.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ColorCorrectionAberrationMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ColorCorrectionMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAeAntibandingMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAeLock.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAeLockAvailable.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAeMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAePrecaptureTrigger.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAeState.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAfMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAfSceneChange.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAfState.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAfTrigger.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAutoframing.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAutoframingAvailable.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAutoframingState.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAwbLock.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAwbLockAvailable.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAwbMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAwbState.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlCaptureIntent.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlEffectMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlEnableZsl.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlExtendedSceneMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlSceneMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlSettingsOverride.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlVideoStabilizationMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DemosaicMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurations.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurationsMaximumResolution.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurations.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurationsMaximumResolution.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DepthDepthIsExclusive.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DistortionCorrectionMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/EdgeMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/FlashInfoAvailable.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/FlashMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/FlashState.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurations.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurationsMaximumResolution.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/HeicInfoSupported.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/HotPixelMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/InfoSupportedHardwareLevel.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurations.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurationsMaximumResolution.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LedAvailableLeds.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LedTransmit.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LensFacing.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LensInfoFocusDistanceCalibration.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LensOpticalStabilizationMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LensPoseReference.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LensState.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LogicalMultiCameraSensorSyncType.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/NoiseReductionMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/QuirksPartialResult.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/RequestAvailableDynamicRangeProfilesMap.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/RequestMetadataMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/RequestType.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerAvailableFormats.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerAvailableRecommendedStreamConfigurations.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerAvailableStreamConfigurations.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerAvailableStreamConfigurationsMaximumResolution.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerCroppingType.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerMultiResolutionStreamSupported.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerPhysicalCameraMultiResolutionStreamConfigurations.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerRotateAndCrop.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorInfoColorFilterArrangement.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorInfoLensShadingApplied.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorInfoTimestampSource.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorPixelMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorRawBinningFactorUsed.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorReferenceIlluminant1.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorTestPatternMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ShadingMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsFaceDetectMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsHistogramMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsHotPixelMapMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsLensShadingMapMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsOisDataMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsSceneFlicker.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsSharpnessMapMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SyncFrameNumber.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SyncMaxLatency.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/TonemapMode.aidl create mode 100644 camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/TonemapPresetCurve.aidl create mode 100644 camera/provider/aidl/aidl_api/android.hardware.camera.provider/2/.hash create mode 100644 camera/provider/aidl/aidl_api/android.hardware.camera.provider/2/android/hardware/camera/provider/CameraIdAndStreamCombination.aidl create mode 100644 camera/provider/aidl/aidl_api/android.hardware.camera.provider/2/android/hardware/camera/provider/ConcurrentCameraIdCombination.aidl create mode 100644 camera/provider/aidl/aidl_api/android.hardware.camera.provider/2/android/hardware/camera/provider/ICameraProvider.aidl create mode 100644 camera/provider/aidl/aidl_api/android.hardware.camera.provider/2/android/hardware/camera/provider/ICameraProviderCallback.aidl create mode 100644 cas/aidl/aidl_api/android.hardware.cas/1/.hash create mode 100644 cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/AidlCasPluginDescriptor.aidl create mode 100644 cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/DestinationBuffer.aidl create mode 100644 cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/ICas.aidl create mode 100644 cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/ICasListener.aidl create mode 100644 cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/IDescrambler.aidl create mode 100644 cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/IMediaCasService.aidl create mode 100644 cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/ScramblingControl.aidl create mode 100644 cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/ScramblingMode.aidl create mode 100644 cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/SessionIntent.aidl create mode 100644 cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/SharedBuffer.aidl create mode 100644 cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/Status.aidl create mode 100644 cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/StatusEvent.aidl create mode 100644 cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/SubSample.aidl create mode 100644 confirmationui/aidl/aidl_api/android.hardware.confirmationui/1/.hash create mode 100644 confirmationui/aidl/aidl_api/android.hardware.confirmationui/1/android/hardware/confirmationui/IConfirmationResultCallback.aidl create mode 100644 confirmationui/aidl/aidl_api/android.hardware.confirmationui/1/android/hardware/confirmationui/IConfirmationUI.aidl create mode 100644 confirmationui/aidl/aidl_api/android.hardware.confirmationui/1/android/hardware/confirmationui/TestModeCommands.aidl create mode 100644 confirmationui/aidl/aidl_api/android.hardware.confirmationui/1/android/hardware/confirmationui/UIOption.aidl create mode 100644 contexthub/aidl/aidl_api/android.hardware.contexthub/2/.hash create mode 100644 contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/AsyncEventType.aidl create mode 100644 contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/ContextHubInfo.aidl create mode 100644 contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/ContextHubMessage.aidl create mode 100644 contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/HostEndpointInfo.aidl create mode 100644 contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/IContextHub.aidl create mode 100644 contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/IContextHubCallback.aidl create mode 100644 contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/NanSessionRequest.aidl create mode 100644 contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/NanSessionStateUpdate.aidl create mode 100644 contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/NanoappBinary.aidl create mode 100644 contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/NanoappInfo.aidl create mode 100644 contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/NanoappRpcService.aidl create mode 100644 contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/Setting.aidl create mode 100644 fastboot/aidl/aidl_api/android.hardware.fastboot/1/.hash create mode 100644 fastboot/aidl/aidl_api/android.hardware.fastboot/1/android/hardware/fastboot/FileSystemType.aidl create mode 100644 fastboot/aidl/aidl_api/android.hardware.fastboot/1/android/hardware/fastboot/IFastboot.aidl create mode 100644 gatekeeper/aidl/aidl_api/android.hardware.gatekeeper/1/.hash create mode 100644 gatekeeper/aidl/aidl_api/android.hardware.gatekeeper/1/android/hardware/gatekeeper/GatekeeperEnrollResponse.aidl create mode 100644 gatekeeper/aidl/aidl_api/android.hardware.gatekeeper/1/android/hardware/gatekeeper/GatekeeperVerifyResponse.aidl create mode 100644 gatekeeper/aidl/aidl_api/android.hardware.gatekeeper/1/android/hardware/gatekeeper/IGatekeeper.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/.hash create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/BlocklistedSource.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/CorrelationVector.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/ElapsedRealtime.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssClock.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssConstellationType.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssData.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssLocation.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssMeasurement.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssMultipathIndicator.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssPowerStats.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssSignalType.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IAGnss.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IAGnssCallback.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IAGnssRil.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IAGnssRilCallback.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnss.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssAntennaInfo.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssAntennaInfoCallback.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssBatching.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssBatchingCallback.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssCallback.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssConfiguration.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssDebug.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssGeofence.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssGeofenceCallback.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssMeasurementCallback.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssMeasurementInterface.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssNavigationMessageCallback.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssNavigationMessageInterface.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssPowerIndication.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssPowerIndicationCallback.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssPsds.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssPsdsCallback.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/PsdsType.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/SatelliteClockInfo.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/SatellitePositionEcef.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/SatellitePvt.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/SatelliteVelocityEcef.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsCallback.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsInterface.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/measurement_corrections/MeasurementCorrections.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/measurement_corrections/ReflectingPlane.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/measurement_corrections/SingleSatCorrection.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/visibility_control/IGnssVisibilityControl.aidl create mode 100644 gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/visibility_control/IGnssVisibilityControlCallback.aidl create mode 100644 graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/2/.hash create mode 100644 graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/2/android/hardware/graphics/allocator/AllocationError.aidl create mode 100644 graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/2/android/hardware/graphics/allocator/AllocationResult.aidl create mode 100644 graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/2/android/hardware/graphics/allocator/BufferDescriptorInfo.aidl create mode 100644 graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/2/android/hardware/graphics/allocator/IAllocator.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/.hash create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/AlphaInterpretation.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/BlendMode.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/BufferUsage.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/ChromaSiting.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/ColorTransform.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Compression.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Cta861_3.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Dataspace.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/DisplayDecorationSupport.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/ExtendableType.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/FRect.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/HardwareBuffer.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/HardwareBufferDescription.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Hdr.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/HdrConversionCapability.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/HdrConversionStrategy.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Interlaced.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/PixelFormat.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/PlaneLayout.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/PlaneLayoutComponent.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/PlaneLayoutComponentType.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Point.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Rect.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Smpte2086.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/StandardMetadataType.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Transform.aidl create mode 100644 graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/XyColor.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/.hash create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/Buffer.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/Capability.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ChangedCompositionLayer.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ChangedCompositionTypes.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ClientTarget.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ClientTargetProperty.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/Color.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ColorMode.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/CommandError.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/CommandResultPayload.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/Composition.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ContentType.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DimmingStage.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayAttribute.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayBrightness.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayCapability.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayCommand.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayConnectionType.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayContentSample.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayContentSamplingAttributes.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayIdentification.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayRequest.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/FormatColorComponent.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/HdrCapabilities.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/IComposer.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/IComposerCallback.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/IComposerClient.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/LayerBrightness.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/LayerCommand.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/OverlayProperties.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ParcelableBlendMode.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ParcelableComposition.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ParcelableDataspace.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ParcelableTransform.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PerFrameMetadata.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PerFrameMetadataBlob.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PerFrameMetadataKey.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PlaneAlpha.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PowerMode.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PresentFence.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PresentOrValidate.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ReadbackBufferAttributes.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ReleaseFences.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/RenderIntent.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/VirtualDisplay.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/VsyncPeriodChangeConstraints.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/VsyncPeriodChangeTimeline.aidl create mode 100644 graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ZOrder.aidl create mode 100644 health/aidl/aidl_api/android.hardware.health/2/.hash create mode 100644 health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryCapacityLevel.aidl create mode 100644 health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryChargingPolicy.aidl create mode 100644 health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryChargingState.aidl create mode 100644 health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryHealth.aidl create mode 100644 health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryHealthData.aidl create mode 100644 health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryStatus.aidl create mode 100644 health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/DiskStats.aidl create mode 100644 health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/HealthInfo.aidl create mode 100644 health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/IHealth.aidl create mode 100644 health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/IHealthInfoCallback.aidl create mode 100644 health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/StorageInfo.aidl create mode 100644 identity/aidl/aidl_api/android.hardware.identity/5/.hash create mode 100644 identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/Certificate.aidl create mode 100644 identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/CipherSuite.aidl create mode 100644 identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/HardwareInformation.aidl create mode 100644 identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/IIdentityCredential.aidl create mode 100644 identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/IIdentityCredentialStore.aidl create mode 100644 identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/IPresentationSession.aidl create mode 100644 identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/IWritableIdentityCredential.aidl create mode 100644 identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/RequestDataItem.aidl create mode 100644 identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/RequestNamespace.aidl create mode 100644 identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/SecureAccessControlProfile.aidl create mode 100644 keymaster/aidl/aidl_api/android.hardware.keymaster/4/.hash create mode 100644 keymaster/aidl/aidl_api/android.hardware.keymaster/4/android/hardware/keymaster/HardwareAuthToken.aidl create mode 100644 keymaster/aidl/aidl_api/android.hardware.keymaster/4/android/hardware/keymaster/HardwareAuthenticatorType.aidl create mode 100644 keymaster/aidl/aidl_api/android.hardware.keymaster/4/android/hardware/keymaster/SecurityLevel.aidl create mode 100644 keymaster/aidl/aidl_api/android.hardware.keymaster/4/android/hardware/keymaster/Timestamp.aidl create mode 100644 keymaster/aidl/aidl_api/android.hardware.keymaster/4/android/hardware/keymaster/VerificationToken.aidl create mode 100644 media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/.hash create mode 100644 media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/Buffer.aidl create mode 100644 media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/BufferInvalidationMessage.aidl create mode 100644 media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/BufferStatus.aidl create mode 100644 media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/BufferStatusMessage.aidl create mode 100644 media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/IAccessor.aidl create mode 100644 media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/IClientManager.aidl create mode 100644 media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/IConnection.aidl create mode 100644 media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/IObserver.aidl create mode 100644 media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/ResultStatus.aidl create mode 100644 power/aidl/aidl_api/android.hardware.power/4/.hash create mode 100644 power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/Boost.aidl create mode 100644 power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/IPower.aidl create mode 100644 power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/IPowerHintSession.aidl create mode 100644 power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/Mode.aidl create mode 100644 power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/SessionHint.aidl create mode 100644 power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/WorkDuration.aidl create mode 100644 power/stats/aidl/aidl_api/android.hardware.power.stats/2/.hash create mode 100644 power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/Channel.aidl create mode 100644 power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/EnergyConsumer.aidl create mode 100644 power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/EnergyConsumerAttribution.aidl create mode 100644 power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/EnergyConsumerResult.aidl create mode 100644 power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/EnergyConsumerType.aidl create mode 100644 power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/EnergyMeasurement.aidl create mode 100644 power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/IPowerStats.aidl create mode 100644 power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/PowerEntity.aidl create mode 100644 power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/State.aidl create mode 100644 power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/StateResidency.aidl create mode 100644 power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/StateResidencyResult.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.config/2/.hash create mode 100644 radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/IRadioConfig.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/IRadioConfigIndication.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/IRadioConfigResponse.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/PhoneCapability.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/SimPortInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/SimSlotStatus.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/SlotPortMapping.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/.hash create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/ApnAuthType.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/ApnTypes.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/DataCallFailCause.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/DataProfileInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/DataRequestReason.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/DataThrottlingAction.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/EpsQos.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/IRadioData.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/IRadioDataIndication.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/IRadioDataResponse.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/KeepaliveRequest.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/KeepaliveStatus.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/LinkAddress.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/NrQos.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/OsAppId.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/PcoDataInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/PdpProtocolType.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/PortRange.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/Qos.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosBandwidth.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosFilter.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosFilterIpsecSpi.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosFilterIpv6FlowLabel.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosFilterTypeOfService.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosSession.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/RouteSelectionDescriptor.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/SetupDataCallResult.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/SliceInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/SlicingConfig.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/TrafficDescriptor.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/UrspRule.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/.hash create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/AmrMode.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/AmrParams.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/AnbrMode.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/CallQuality.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/CodecMode.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/CodecParams.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/CodecSpecificParams.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/CodecType.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/DtmfParams.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/EvsBandwidth.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/EvsMode.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/EvsParams.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/IImsMedia.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/IImsMediaListener.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/IImsMediaSession.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/LocalEndPoint.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/MediaDirection.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/MediaQualityStatus.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/MediaQualityThreshold.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtcpConfig.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtpAddress.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtpConfig.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtpError.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtpHeaderExtension.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtpSessionParams.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/1/.hash create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ConnectionFailureInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/EpsFallbackReason.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/IRadioIms.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/IRadioImsIndication.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/IRadioImsResponse.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsCall.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsDeregistrationReason.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsRegistration.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsRegistrationState.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsStreamDirection.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsStreamType.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsTrafficType.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/SrvccCall.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/SuggestedAction.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.messaging/2/.hash create mode 100644 radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaBroadcastSmsConfigInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaSmsAck.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaSmsAddress.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaSmsMessage.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaSmsSubaddress.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaSmsWriteArgs.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/GsmBroadcastSmsConfigInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/GsmSmsMessage.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/IRadioMessaging.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/IRadioMessagingIndication.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/IRadioMessagingResponse.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/ImsSmsMessage.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/SendSmsResult.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/SmsAcknowledgeFailCause.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/SmsWriteArgs.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.modem/2/.hash create mode 100644 radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/ActivityStatsInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/DeviceStateType.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/HardwareConfig.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/HardwareConfigModem.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/HardwareConfigSim.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/IRadioModem.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/IRadioModemIndication.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/IRadioModemResponse.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/ImeiInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/NvItem.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/NvWriteItem.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/RadioCapability.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/RadioState.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/ResetNvType.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/.hash create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/BarringInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/BarringTypeSpecificInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/Cdma2000RegistrationInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CdmaRoamingType.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CdmaSignalStrength.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellConnectionStatus.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentity.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityCdma.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityGsm.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityLte.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityNr.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityTdscdma.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityWcdma.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoCdma.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoGsm.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoLte.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoNr.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoRatSpecificInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoTdscdma.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoWcdma.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/ClosedSubscriberGroupInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/Domain.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EmergencyMode.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EmergencyRegResult.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EmergencyScanType.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EutranBands.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EutranRegistrationInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EvdoSignalStrength.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/GeranBands.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/GsmSignalStrength.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/IRadioNetwork.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/IRadioNetworkIndication.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/IRadioNetworkResponse.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/IndicationFilter.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/LceDataInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/LinkCapacityEstimate.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/LteSignalStrength.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/LteVopsInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NetworkScanRequest.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NetworkScanResult.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NgranBands.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NrDualConnectivityState.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NrIndicators.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NrSignalStrength.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NrVopsInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/OperatorInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/PhoneRestrictedState.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/PhysicalChannelConfig.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/PhysicalChannelConfigBand.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RadioAccessSpecifier.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RadioAccessSpecifierBands.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RadioBandMode.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RegState.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RegStateResult.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RegistrationFailCause.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/SignalStrength.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/SignalThresholdInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/SuppSvcNotification.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/TdscdmaSignalStrength.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/UsageSetting.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/UtranBands.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/WcdmaSignalStrength.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sap/1/.hash create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/ISap.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/ISapCallback.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapApduType.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapConnectRsp.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapDisconnectType.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapResultCode.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapStatus.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapTransferProtocol.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/2/.hash create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/AppStatus.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/CardPowerState.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/CardStatus.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/Carrier.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/CarrierRestrictions.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/CdmaSubscriptionSource.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/IRadioSim.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/IRadioSimIndication.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/IRadioSimResponse.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/IccIo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/IccIoResult.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/ImsiEncryptionInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/PbReceivedStatus.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/PersoSubstate.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/PhonebookCapacity.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/PhonebookRecordInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/PinState.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/SelectUiccSub.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/SessionInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/SimApdu.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/SimRefreshResult.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/.hash create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/AudioQuality.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/Call.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CallForwardInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaCallWaiting.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaInformationRecord.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaLineControlInfoRecord.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaRedirectingNumberInfoRecord.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaSignalInfoRecord.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaT53AudioControlInfoRecord.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaT53ClirInfoRecord.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CfData.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/ClipStatus.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/Dial.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/EmergencyCallRouting.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/EmergencyNumber.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/EmergencyServiceCategory.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/IRadioVoice.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/IRadioVoiceIndication.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/IRadioVoiceResponse.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/LastCallFailCause.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/LastCallFailCauseInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/SrvccState.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/SsInfoData.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/StkCcUnsolSsResult.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/TtyMode.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/UssdModeType.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/UusInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio/2/.hash create mode 100644 radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/AccessNetwork.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioAccessFamily.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioConst.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioError.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioIndicationType.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioResponseInfo.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioResponseInfoModem.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioResponseType.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioTechnology.aidl create mode 100644 radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioTechnologyFamily.aidl create mode 100644 secure_element/aidl/aidl_api/android.hardware.secure_element/1/.hash create mode 100644 secure_element/aidl/aidl_api/android.hardware.secure_element/1/android/hardware/secure_element/ISecureElement.aidl create mode 100644 secure_element/aidl/aidl_api/android.hardware.secure_element/1/android/hardware/secure_element/ISecureElementCallback.aidl create mode 100644 secure_element/aidl/aidl_api/android.hardware.secure_element/1/android/hardware/secure_element/LogicalChannelResponse.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/.hash create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/Algorithm.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/AttestationKey.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/BeginResult.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/BlockMode.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/Certificate.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/Digest.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/EcCurve.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/ErrorCode.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/HardwareAuthToken.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/HardwareAuthenticatorType.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/IKeyMintDevice.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/IKeyMintOperation.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyCharacteristics.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyCreationResult.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyFormat.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyMintHardwareInfo.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyOrigin.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyParameter.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyParameterValue.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyPurpose.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/PaddingMode.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/SecurityLevel.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/Tag.aidl create mode 100644 security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/TagType.aidl create mode 100644 security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/.hash create mode 100644 security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/android/hardware/security/keymint/DeviceInfo.aidl create mode 100644 security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl create mode 100644 security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/android/hardware/security/keymint/MacedPublicKey.aidl create mode 100644 security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/android/hardware/security/keymint/ProtectedData.aidl create mode 100644 security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/android/hardware/security/keymint/RpcHardwareInfo.aidl create mode 100644 sensors/aidl/aidl_api/android.hardware.sensors/2/.hash create mode 100644 sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/AdditionalInfo.aidl create mode 100644 sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/DynamicSensorInfo.aidl create mode 100644 sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/Event.aidl create mode 100644 sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/ISensors.aidl create mode 100644 sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/ISensorsCallback.aidl create mode 100644 sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/SensorInfo.aidl create mode 100644 sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/SensorStatus.aidl create mode 100644 sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/SensorType.aidl create mode 100644 thermal/aidl/aidl_api/android.hardware.thermal/1/.hash create mode 100644 thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/CoolingDevice.aidl create mode 100644 thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/CoolingType.aidl create mode 100644 thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/IThermal.aidl create mode 100644 thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/IThermalChangedCallback.aidl create mode 100644 thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/Temperature.aidl create mode 100644 thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/TemperatureThreshold.aidl create mode 100644 thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/TemperatureType.aidl create mode 100644 thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/ThrottlingSeverity.aidl create mode 100644 tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/.hash create mode 100644 tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/AbortReason.aidl create mode 100644 tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/CecDeviceType.aidl create mode 100644 tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/CecLogicalAddress.aidl create mode 100644 tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/CecMessage.aidl create mode 100644 tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/CecMessageType.aidl create mode 100644 tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/IHdmiCec.aidl create mode 100644 tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/IHdmiCecCallback.aidl create mode 100644 tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/Result.aidl create mode 100644 tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/SendMessageResult.aidl create mode 100644 tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/.hash create mode 100644 tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl create mode 100644 tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/HdmiPortType.aidl create mode 100644 tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/HpdSignal.aidl create mode 100644 tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/IHdmiConnection.aidl create mode 100644 tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/IHdmiConnectionCallback.aidl create mode 100644 tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/Result.aidl create mode 100644 tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/1/.hash create mode 100644 tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/1/android/hardware/tv/hdmi/earc/IEArc.aidl create mode 100644 tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/1/android/hardware/tv/hdmi/earc/IEArcCallback.aidl create mode 100644 tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/1/android/hardware/tv/hdmi/earc/IEArcStatus.aidl create mode 100644 tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/1/android/hardware/tv/hdmi/earc/Result.aidl create mode 100644 tv/input/aidl/aidl_api/android.hardware.tv.input/1/.hash create mode 100644 tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/CableConnectionStatus.aidl create mode 100644 tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/ITvInput.aidl create mode 100644 tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/ITvInputCallback.aidl create mode 100644 tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvInputDeviceInfo.aidl create mode 100644 tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvInputEvent.aidl create mode 100644 tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvInputEventType.aidl create mode 100644 tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvInputType.aidl create mode 100644 tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvMessage.aidl create mode 100644 tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvMessageEvent.aidl create mode 100644 tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvMessageEventType.aidl create mode 100644 tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvStreamConfig.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/.hash create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioExtraMetaData.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioPreselection.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioPreselectionLabel.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioPreselectionRenderingIndicationType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioPresentation.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioStreamType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AvStreamType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/Constant.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/Constant64Bit.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DataFormat.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxAlpFilterSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxAlpFilterSettingsFilterSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxAlpFilterType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxAlpLengthType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxCapabilities.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterAvSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterDownloadEvent.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterDownloadSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterEvent.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterIpPayloadEvent.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMainType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMediaEventExtraMetaData.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMmtpRecordEvent.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMonitorEvent.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMonitorEventType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterPesDataSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterPesEvent.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterRecordSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterScIndexMask.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSectionBits.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSectionEvent.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSectionSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSectionSettingsCondition.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSectionSettingsConditionTableInfo.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterStatus.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSubType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterTemiEvent.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterTsRecordEvent.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxInfo.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxIpAddress.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxIpAddressIpAddress.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxIpFilterSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxIpFilterSettingsFilterSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxIpFilterType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxMmtpFilterSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxMmtpFilterSettingsFilterSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxMmtpFilterType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxPid.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxQueueNotifyBits.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxRecordScIndexType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxScAvcIndex.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxScHevcIndex.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxScIndex.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxScVvcIndex.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTlvFilterSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTlvFilterSettingsFilterSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTlvFilterType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTsFilterSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTsFilterSettingsFilterSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTsFilterType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTsIndex.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DvrSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DvrType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FilterDelayHint.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FilterDelayHintType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAnalogAftFlag.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAnalogCapabilities.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAnalogSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAnalogSifStandard.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAnalogType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3Bandwidth.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3Capabilities.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3CodeRate.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3DemodOutputFormat.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3Fec.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3Modulation.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3PlpSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3Settings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3TimeInterleaveMode.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtscCapabilities.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtscModulation.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtscSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendBandwidth.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendCableTimeInterleaveMode.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendCapabilities.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbBandwidth.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbCapabilities.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbCodeRate.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbGuardInterval.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbModulation.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbTimeInterleaveMode.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbTransmissionMode.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcAnnex.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcBandwidth.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcCapabilities.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcModulation.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcOuterFec.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsCapabilities.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsCodeRate.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsModulation.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsPilot.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsRolloff.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsScanType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsStandard.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsVcmMode.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtBandwidth.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtCapabilities.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtCoderate.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtConstellation.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtGuardInterval.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtHierarchy.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtPlpMode.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtStandard.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtTransmissionMode.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendEventType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendGuardInterval.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendInfo.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendInnerFec.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendInterleaveMode.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvCapabilities.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvSettingsFec.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvSettingsFecType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvSettingsIgmp.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvSettingsProtocol.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbs3Capabilities.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbs3Coderate.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbs3Modulation.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbs3Rolloff.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbs3Settings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsCapabilities.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsCoderate.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsModulation.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsRolloff.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsStreamIdType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtBandwidth.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtCapabilities.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtCoderate.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtGuardInterval.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtLayerSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtMode.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtModulation.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtPartialReceptionFlag.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtTimeInterleaveMode.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendModulation.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendModulationStatus.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendRollOff.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendScanAtsc3PlpInfo.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendScanMessage.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendScanMessageStandard.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendScanMessageType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendScanType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendSpectralInversion.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendStatus.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendStatusAtsc3PlpInfo.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendStatusReadiness.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendStatusType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendTransmissionMode.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IDemux.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IDescrambler.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IDvr.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IDvrCallback.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IFilter.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IFilterCallback.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IFrontend.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IFrontendCallback.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/ILnb.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/ILnbCallback.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/ITimeFilter.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/ITuner.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/LnbEventType.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/LnbPosition.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/LnbTone.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/LnbVoltage.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/PlaybackSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/PlaybackStatus.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/RecordSettings.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/RecordStatus.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/Result.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/ScramblingStatus.aidl create mode 100644 tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/VideoStreamType.aidl create mode 100644 usb/aidl/aidl_api/android.hardware.usb/2/.hash create mode 100644 usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/AltModeData.aidl create mode 100644 usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/ComplianceWarning.aidl create mode 100644 usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/ContaminantDetectionStatus.aidl create mode 100644 usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/ContaminantProtectionMode.aidl create mode 100644 usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/ContaminantProtectionStatus.aidl create mode 100644 usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/DisplayPortAltModePinAssignment.aidl create mode 100644 usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/DisplayPortAltModeStatus.aidl create mode 100644 usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/IUsb.aidl create mode 100644 usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/IUsbCallback.aidl create mode 100644 usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/LinkTrainingStatus.aidl create mode 100644 usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PlugOrientation.aidl create mode 100644 usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PortDataRole.aidl create mode 100644 usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PortMode.aidl create mode 100644 usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PortPowerRole.aidl create mode 100644 usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PortRole.aidl create mode 100644 usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PortStatus.aidl create mode 100644 usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PowerBrickStatus.aidl create mode 100644 usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/Status.aidl create mode 100644 usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/UsbDataStatus.aidl create mode 100644 usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/.hash create mode 100644 usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/android/hardware/usb/gadget/GadgetFunction.aidl create mode 100644 usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/android/hardware/usb/gadget/IUsbGadget.aidl create mode 100644 usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/android/hardware/usb/gadget/IUsbGadgetCallback.aidl create mode 100644 usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/android/hardware/usb/gadget/Status.aidl create mode 100644 usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/android/hardware/usb/gadget/UsbSpeed.aidl create mode 100644 weaver/aidl/aidl_api/android.hardware.weaver/2/.hash create mode 100644 weaver/aidl/aidl_api/android.hardware.weaver/2/android/hardware/weaver/IWeaver.aidl create mode 100644 weaver/aidl/aidl_api/android.hardware.weaver/2/android/hardware/weaver/WeaverConfig.aidl create mode 100644 weaver/aidl/aidl_api/android.hardware.weaver/2/android/hardware/weaver/WeaverReadResponse.aidl create mode 100644 weaver/aidl/aidl_api/android.hardware.weaver/2/android/hardware/weaver/WeaverReadStatus.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/.hash create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/AfcChannelAllowance.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/AvailableAfcChannelInfo.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/AvailableAfcFrequencyInfo.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifi.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiApIface.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiChip.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiChipEventCallback.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiEventCallback.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiNanIface.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiP2pIface.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiRttController.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiRttControllerEventCallback.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiStaIface.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiStaIfaceEventCallback.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IfaceConcurrencyType.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IfaceType.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/MacAddress.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBandIndex.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBandSpecificConfig.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingConfirmInd.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingMethod.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingRequest.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingRequestInd.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingResponse.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingResponseCode.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanCapabilities.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanCipherSuiteType.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanClusterEventInd.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanClusterEventType.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanConfigRequest.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanConfigRequestSupplemental.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathChannelCfg.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathChannelInfo.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathConfirmInd.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathRequestInd.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathScheduleUpdateInd.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathSecurityConfig.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathSecurityType.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDebugConfig.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDiscoveryCommonConfig.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanEnableRequest.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanFollowupReceivedInd.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanIdentityResolutionAttribute.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanInitiateDataPathRequest.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanMatchAlg.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanMatchInd.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingAkm.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingConfig.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingConfirmInd.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingRequest.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingRequestInd.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingRequestType.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingSecurityConfig.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingSecurityType.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPublishRequest.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPublishType.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanRangingIndication.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanRespondToDataPathIndicationRequest.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanSrfType.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanStatus.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanStatusCode.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanSubscribeRequest.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanSubscribeType.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanSuspensionModeChangeInd.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanTransmitFollowupRequest.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanTxType.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NpkSecurityAssociation.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttBw.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttCapabilities.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttConfig.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttLciInformation.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttLcrInformation.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttMotionPattern.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttPeerType.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttPreamble.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttResponder.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttResult.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttStatus.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttType.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/Ssid.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaApfPacketFilterCapabilities.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaBackgroundScanBucketEventReportSchemeMask.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaBackgroundScanBucketParameters.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaBackgroundScanCapabilities.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaBackgroundScanLimits.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaBackgroundScanParameters.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerIfaceContentionTimeStats.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerIfacePacketStats.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerIfaceStats.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerLinkStats.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerRadioStats.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerStats.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaPeerInfo.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaRateStat.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaRoamingCapabilities.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaRoamingConfig.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaRoamingState.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaScanData.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaScanDataFlagMask.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaScanResult.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiAntennaMode.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiBand.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiChannelInfo.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiChannelStats.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiChannelWidthInMhz.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiChipCapabilities.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugHostWakeReasonRxIcmpPacketDetails.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugHostWakeReasonRxMulticastPacketDetails.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugHostWakeReasonRxPacketDetails.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugHostWakeReasonStats.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugPacketFateFrameInfo.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugPacketFateFrameType.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugRingBufferFlags.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugRingBufferStatus.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugRingBufferVerboseLevel.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugRxPacketFate.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugRxPacketFateReport.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugTxPacketFate.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugTxPacketFateReport.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiIfaceMode.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiInformationElement.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiRadioCombination.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiRadioConfiguration.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiRateInfo.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiRateNss.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiRatePreamble.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiStatusCode.aidl create mode 100644 wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiUsableChannel.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/.hash create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/AnqpData.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/AnqpInfoId.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/AssociationRejectionData.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/AuthAlgMask.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/AuxiliarySupplicantEventCode.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/BssTmData.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/BssTmDataFlagsMask.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/BssTmStatusCode.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/BssidChangeReason.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/BtCoexistenceMode.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DebugLevel.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppAkm.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppConfigurationData.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppConnectionKeys.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppCurve.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppEventType.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppFailureCode.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppNetRole.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppProgressCode.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppResponderBootstrapInfo.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppStatusErrorCode.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/EapErrorCode.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/EapMethod.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/EapPhase2Method.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ExtRadioWorkDefaults.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/FreqRange.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/GroupCipherMask.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/GroupMgmtCipherMask.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/GsmRand.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/Hs20AnqpData.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/Hs20AnqpSubtypes.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicant.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantCallback.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantP2pNetwork.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantStaNetworkCallback.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/IfaceInfo.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/IfaceType.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/IpVersion.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/KeyMgmtMask.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/LegacyMode.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MacAddress.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MboAssocDisallowedReasonCode.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MboCellularDataConnectionPrefValue.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MboTransitionReasonCode.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MiracastMode.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MloLink.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MloLinksInfo.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/NetworkRequestEapSimGsmAuthParams.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/NetworkRequestEapSimUmtsAuthParams.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/NetworkResponseEapSimGsmAuthParams.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/NetworkResponseEapSimUmtsAuthParams.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/OceRssiBasedAssocRejectAttr.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/OcspType.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/OsuMethod.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pClientEapolIpAddressInfo.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pFrameTypeMask.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pGroupCapabilityMask.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pProvDiscStatusCode.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pStatusCode.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/PairwiseCipherMask.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/PmkSaCacheData.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/PortRange.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ProtoMask.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ProtocolNextHeader.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyClassifierParams.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyClassifierParamsMask.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyData.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyRequestType.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyScsData.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyScsRequestStatus.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyScsRequestStatusCode.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyScsResponseStatus.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyScsResponseStatusCode.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyStatus.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyStatusCode.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/RxFilterType.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/SaeH2eMode.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/SignalPollResult.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/StaIfaceCallbackState.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/StaIfaceReasonCode.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/StaIfaceStatusCode.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/SupplicantStatusCode.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/TlsVersion.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/TransitionDisableIndication.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WifiTechnology.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpsConfigError.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpsConfigMethods.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpsDevPasswordId.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpsErrorIndication.aidl create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpsProvisionMethod.aidl diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp index 515787e170..5a009fe674 100644 --- a/audio/aidl/Android.bp +++ b/audio/aidl/Android.bp @@ -42,7 +42,7 @@ aidl_interface { "android/hardware/audio/common/SinkMetadata.aidl", "android/hardware/audio/common/SourceMetadata.aidl", ], - frozen: false, + frozen: true, imports: [ "android.media.audio.common.types-V2", ], @@ -71,6 +71,11 @@ aidl_interface { version: "1", imports: ["android.media.audio.common.types-V2"], }, + { + version: "2", + imports: ["android.media.audio.common.types-V2"], + }, + // IMPORTANT: Update latest_android_hardware_audio_common every time you // add the latest frozen version to versions_with_info ], @@ -147,9 +152,22 @@ aidl_interface { }, }, versions_with_info: [ + { + version: "1", + imports: [ + "android.hardware.common-V2", + "android.hardware.common.fmq-V1", + "android.hardware.audio.common-V2", + "android.hardware.audio.core.sounddose-V1", + "android.hardware.audio.effect-V1", + "android.media.audio.common.types-V2", + ], + }, + // IMPORTANT: Update latest_android_hardware_audio_core every time you // add the latest frozen version to versions_with_info ], + frozen: true, } // Note: This should always be one version ahead of the last frozen version @@ -194,9 +212,15 @@ aidl_interface { }, }, versions_with_info: [ + { + version: "1", + imports: ["android.media.audio.common.types-V2"], + }, + // IMPORTANT: Update latest_android_hardware_audio_core_sounddose every time you // add the latest frozen version to versions_with_info ], + frozen: true, } // Note: This should always be one version ahead of the last frozen version @@ -268,6 +292,19 @@ aidl_interface { sdk_version: "module_current", }, }, + versions_with_info: [ + { + version: "1", + imports: [ + "android.hardware.common-V2", + "android.hardware.common.fmq-V1", + "android.hardware.audio.common-V2", + "android.media.audio.common.types-V2", + ], + }, + ], + frozen: true, + } latest_android_hardware_audio_effect = "android.hardware.audio.effect-V1" diff --git a/audio/aidl/aidl_api/android.hardware.audio.common/2/.hash b/audio/aidl/aidl_api/android.hardware.audio.common/2/.hash new file mode 100644 index 0000000000..6f56a4ca5a --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.common/2/.hash @@ -0,0 +1 @@ +6780ccb29120b4c7d3ed60f55a23c13b0431f3a4 diff --git a/audio/aidl/aidl_api/android.hardware.audio.common/2/android/hardware/audio/common/AudioOffloadMetadata.aidl b/audio/aidl/aidl_api/android.hardware.audio.common/2/android/hardware/audio/common/AudioOffloadMetadata.aidl new file mode 100644 index 0000000000..000504bd40 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.common/2/android/hardware/audio/common/AudioOffloadMetadata.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 -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.hardware.audio.common; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable AudioOffloadMetadata { + int sampleRate; + android.media.audio.common.AudioChannelLayout channelMask; + int averageBitRatePerSecond; + int delayFrames; + int paddingFrames; +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.common/2/android/hardware/audio/common/PlaybackTrackMetadata.aidl b/audio/aidl/aidl_api/android.hardware.audio.common/2/android/hardware/audio/common/PlaybackTrackMetadata.aidl new file mode 100644 index 0000000000..be4941c751 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.common/2/android/hardware/audio/common/PlaybackTrackMetadata.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.audio.common; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable PlaybackTrackMetadata { + android.media.audio.common.AudioUsage usage = android.media.audio.common.AudioUsage.INVALID; + android.media.audio.common.AudioContentType contentType = android.media.audio.common.AudioContentType.UNKNOWN; + float gain; + android.media.audio.common.AudioChannelLayout channelMask; + @nullable android.media.audio.common.AudioDevice sourceDevice; + @utf8InCpp String[] tags; +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.common/2/android/hardware/audio/common/RecordTrackMetadata.aidl b/audio/aidl/aidl_api/android.hardware.audio.common/2/android/hardware/audio/common/RecordTrackMetadata.aidl new file mode 100644 index 0000000000..8f667d1081 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.common/2/android/hardware/audio/common/RecordTrackMetadata.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.audio.common; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable RecordTrackMetadata { + android.media.audio.common.AudioSource source = android.media.audio.common.AudioSource.SYS_RESERVED_INVALID; + float gain; + @nullable android.media.audio.common.AudioDevice destinationDevice; + android.media.audio.common.AudioChannelLayout channelMask; + @utf8InCpp String[] tags; +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.common/2/android/hardware/audio/common/SinkMetadata.aidl b/audio/aidl/aidl_api/android.hardware.audio.common/2/android/hardware/audio/common/SinkMetadata.aidl new file mode 100644 index 0000000000..270147d2bb --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.common/2/android/hardware/audio/common/SinkMetadata.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2021 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 -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.hardware.audio.common; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SinkMetadata { + android.hardware.audio.common.RecordTrackMetadata[] tracks; +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.common/2/android/hardware/audio/common/SourceMetadata.aidl b/audio/aidl/aidl_api/android.hardware.audio.common/2/android/hardware/audio/common/SourceMetadata.aidl new file mode 100644 index 0000000000..2d4a982352 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.common/2/android/hardware/audio/common/SourceMetadata.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2021 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 -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.hardware.audio.common; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SourceMetadata { + android.hardware.audio.common.PlaybackTrackMetadata[] tracks; +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core.sounddose/1/.hash b/audio/aidl/aidl_api/android.hardware.audio.core.sounddose/1/.hash new file mode 100644 index 0000000000..270b1c92dd --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core.sounddose/1/.hash @@ -0,0 +1 @@ +7913a7ff584002e6889416e5dddbe46878d0a51e diff --git a/audio/aidl/aidl_api/android.hardware.audio.core.sounddose/1/android/hardware/audio/core/sounddose/ISoundDose.aidl b/audio/aidl/aidl_api/android.hardware.audio.core.sounddose/1/android/hardware/audio/core/sounddose/ISoundDose.aidl new file mode 100644 index 0000000000..580009192d --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core.sounddose/1/android/hardware/audio/core/sounddose/ISoundDose.aidl @@ -0,0 +1,52 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core.sounddose; +@VintfStability +interface ISoundDose { + void setOutputRs2UpperBound(float rs2ValueDbA); + float getOutputRs2UpperBound(); + void registerSoundDoseCallback(in android.hardware.audio.core.sounddose.ISoundDose.IHalSoundDoseCallback callback); + const int DEFAULT_MAX_RS2 = 100; + const int MIN_RS2 = 80; + @VintfStability + interface IHalSoundDoseCallback { + oneway void onMomentaryExposureWarning(float currentDbA, in android.media.audio.common.AudioDevice audioDevice); + oneway void onNewMelValues(in android.hardware.audio.core.sounddose.ISoundDose.IHalSoundDoseCallback.MelRecord melRecord, in android.media.audio.common.AudioDevice audioDevice); + @VintfStability + parcelable MelRecord { + float[] melValues; + long timestamp; + } + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/1/.hash b/audio/aidl/aidl_api/android.hardware.audio.core/1/.hash new file mode 100644 index 0000000000..8eb6be5ff0 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/1/.hash @@ -0,0 +1 @@ +1cec1e67515bdd2b896d80d20a64bf899b2470bf diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/AudioPatch.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/AudioPatch.aidl new file mode 100644 index 0000000000..078b5ea329 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/AudioPatch.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable AudioPatch { + int id; + int[] sourcePortConfigIds; + int[] sinkPortConfigIds; + int minimumStreamBufferSizeFrames; + int[] latenciesMs; +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/AudioRoute.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/AudioRoute.aidl new file mode 100644 index 0000000000..deeef872d7 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/AudioRoute.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable AudioRoute { + int[] sourcePortIds; + int sinkPortId; + boolean isExclusive; +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IBluetooth.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IBluetooth.aidl new file mode 100644 index 0000000000..9357a1587e --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IBluetooth.aidl @@ -0,0 +1,61 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@VintfStability +interface IBluetooth { + android.hardware.audio.core.IBluetooth.ScoConfig setScoConfig(in android.hardware.audio.core.IBluetooth.ScoConfig config); + android.hardware.audio.core.IBluetooth.HfpConfig setHfpConfig(in android.hardware.audio.core.IBluetooth.HfpConfig config); + @JavaDerive(equals=true, toString=true) @VintfStability + parcelable ScoConfig { + @nullable android.media.audio.common.Boolean isEnabled; + @nullable android.media.audio.common.Boolean isNrecEnabled; + android.hardware.audio.core.IBluetooth.ScoConfig.Mode mode = android.hardware.audio.core.IBluetooth.ScoConfig.Mode.UNSPECIFIED; + @nullable @utf8InCpp String debugName; + @VintfStability + enum Mode { + UNSPECIFIED, + SCO, + SCO_WB, + SCO_SWB, + } + } + @JavaDerive(equals=true, toString=true) @VintfStability + parcelable HfpConfig { + @nullable android.media.audio.common.Boolean isEnabled; + @nullable android.media.audio.common.Int sampleRate; + @nullable android.media.audio.common.Float volume; + const int VOLUME_MIN = 0; + const int VOLUME_MAX = 1; + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IBluetoothA2dp.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IBluetoothA2dp.aidl new file mode 100644 index 0000000000..0f4c46d73f --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IBluetoothA2dp.aidl @@ -0,0 +1,41 @@ +/* + * 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 -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.hardware.audio.core; +@VintfStability +interface IBluetoothA2dp { + boolean isEnabled(); + void setEnabled(boolean enabled); + boolean supportsOffloadReconfiguration(); + void reconfigureOffload(in android.hardware.audio.core.VendorParameter[] parameters); +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IBluetoothLe.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IBluetoothLe.aidl new file mode 100644 index 0000000000..2068daf431 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IBluetoothLe.aidl @@ -0,0 +1,41 @@ +/* + * 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 -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.hardware.audio.core; +@VintfStability +interface IBluetoothLe { + boolean isEnabled(); + void setEnabled(boolean enabled); + boolean supportsOffloadReconfiguration(); + void reconfigureOffload(in android.hardware.audio.core.VendorParameter[] parameters); +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IConfig.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IConfig.aidl new file mode 100644 index 0000000000..9ce45bb652 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IConfig.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@VintfStability +interface IConfig { + android.hardware.audio.core.SurroundSoundConfig getSurroundSoundConfig(); + android.media.audio.common.AudioHalEngineConfig getEngineConfig(); +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IModule.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IModule.aidl new file mode 100644 index 0000000000..e14e9c0f71 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IModule.aidl @@ -0,0 +1,118 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@VintfStability +interface IModule { + void setModuleDebug(in android.hardware.audio.core.ModuleDebug debug); + @nullable android.hardware.audio.core.ITelephony getTelephony(); + @nullable android.hardware.audio.core.IBluetooth getBluetooth(); + @nullable android.hardware.audio.core.IBluetoothA2dp getBluetoothA2dp(); + @nullable android.hardware.audio.core.IBluetoothLe getBluetoothLe(); + android.media.audio.common.AudioPort connectExternalDevice(in android.media.audio.common.AudioPort templateIdAndAdditionalData); + void disconnectExternalDevice(int portId); + android.hardware.audio.core.AudioPatch[] getAudioPatches(); + android.media.audio.common.AudioPort getAudioPort(int portId); + android.media.audio.common.AudioPortConfig[] getAudioPortConfigs(); + android.media.audio.common.AudioPort[] getAudioPorts(); + android.hardware.audio.core.AudioRoute[] getAudioRoutes(); + android.hardware.audio.core.AudioRoute[] getAudioRoutesForAudioPort(int portId); + android.hardware.audio.core.IModule.OpenInputStreamReturn openInputStream(in android.hardware.audio.core.IModule.OpenInputStreamArguments args); + android.hardware.audio.core.IModule.OpenOutputStreamReturn openOutputStream(in android.hardware.audio.core.IModule.OpenOutputStreamArguments args); + android.hardware.audio.core.IModule.SupportedPlaybackRateFactors getSupportedPlaybackRateFactors(); + android.hardware.audio.core.AudioPatch setAudioPatch(in android.hardware.audio.core.AudioPatch requested); + boolean setAudioPortConfig(in android.media.audio.common.AudioPortConfig requested, out android.media.audio.common.AudioPortConfig suggested); + void resetAudioPatch(int patchId); + void resetAudioPortConfig(int portConfigId); + boolean getMasterMute(); + void setMasterMute(boolean mute); + float getMasterVolume(); + void setMasterVolume(float volume); + boolean getMicMute(); + void setMicMute(boolean mute); + android.media.audio.common.MicrophoneInfo[] getMicrophones(); + void updateAudioMode(android.media.audio.common.AudioMode mode); + void updateScreenRotation(android.hardware.audio.core.IModule.ScreenRotation rotation); + void updateScreenState(boolean isTurnedOn); + @nullable android.hardware.audio.core.sounddose.ISoundDose getSoundDose(); + int generateHwAvSyncId(); + android.hardware.audio.core.VendorParameter[] getVendorParameters(in @utf8InCpp String[] ids); + void setVendorParameters(in android.hardware.audio.core.VendorParameter[] parameters, boolean async); + void addDeviceEffect(int portConfigId, in android.hardware.audio.effect.IEffect effect); + void removeDeviceEffect(int portConfigId, in android.hardware.audio.effect.IEffect effect); + android.media.audio.common.AudioMMapPolicyInfo[] getMmapPolicyInfos(android.media.audio.common.AudioMMapPolicyType mmapPolicyType); + boolean supportsVariableLatency(); + int getAAudioMixerBurstCount(); + int getAAudioHardwareBurstMinUsec(); + const int DEFAULT_AAUDIO_MIXER_BURST_COUNT = 2; + const int DEFAULT_AAUDIO_HARDWARE_BURST_MIN_DURATION_US = 1000; + @VintfStability + parcelable OpenInputStreamArguments { + int portConfigId; + android.hardware.audio.common.SinkMetadata sinkMetadata; + long bufferSizeFrames; + } + @VintfStability + parcelable OpenInputStreamReturn { + android.hardware.audio.core.IStreamIn stream; + android.hardware.audio.core.StreamDescriptor desc; + } + @VintfStability + parcelable OpenOutputStreamArguments { + int portConfigId; + android.hardware.audio.common.SourceMetadata sourceMetadata; + @nullable android.media.audio.common.AudioOffloadInfo offloadInfo; + long bufferSizeFrames; + @nullable android.hardware.audio.core.IStreamCallback callback; + @nullable android.hardware.audio.core.IStreamOutEventCallback eventCallback; + } + @VintfStability + parcelable OpenOutputStreamReturn { + android.hardware.audio.core.IStreamOut stream; + android.hardware.audio.core.StreamDescriptor desc; + } + @VintfStability + parcelable SupportedPlaybackRateFactors { + float minSpeed; + float maxSpeed; + float minPitch; + float maxPitch; + } + @Backing(type="int") @VintfStability + enum ScreenRotation { + DEG_0 = 0, + DEG_90 = 1, + DEG_180 = 2, + DEG_270 = 3, + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IStreamCallback.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IStreamCallback.aidl new file mode 100644 index 0000000000..5a2ab78d88 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IStreamCallback.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@VintfStability +interface IStreamCallback { + oneway void onTransferReady(); + oneway void onError(); + oneway void onDrainReady(); +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IStreamCommon.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IStreamCommon.aidl new file mode 100644 index 0000000000..65a2ee4542 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IStreamCommon.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@VintfStability +interface IStreamCommon { + void close(); + void prepareToClose(); + void updateHwAvSyncId(int hwAvSyncId); + android.hardware.audio.core.VendorParameter[] getVendorParameters(in @utf8InCpp String[] ids); + void setVendorParameters(in android.hardware.audio.core.VendorParameter[] parameters, boolean async); + void addEffect(in android.hardware.audio.effect.IEffect effect); + void removeEffect(in android.hardware.audio.effect.IEffect effect); +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IStreamIn.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IStreamIn.aidl new file mode 100644 index 0000000000..a01f877e86 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IStreamIn.aidl @@ -0,0 +1,58 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@VintfStability +interface IStreamIn { + android.hardware.audio.core.IStreamCommon getStreamCommon(); + android.media.audio.common.MicrophoneDynamicInfo[] getActiveMicrophones(); + android.hardware.audio.core.IStreamIn.MicrophoneDirection getMicrophoneDirection(); + void setMicrophoneDirection(android.hardware.audio.core.IStreamIn.MicrophoneDirection direction); + float getMicrophoneFieldDimension(); + void setMicrophoneFieldDimension(float zoom); + void updateMetadata(in android.hardware.audio.common.SinkMetadata sinkMetadata); + float[] getHwGain(); + void setHwGain(in float[] channelGains); + const int MIC_FIELD_DIMENSION_WIDE_ANGLE = (-1) /* -1 */; + const int MIC_FIELD_DIMENSION_NO_ZOOM = 0; + const int MIC_FIELD_DIMENSION_MAX_ZOOM = 1; + const int HW_GAIN_MIN = 0; + const int HW_GAIN_MAX = 1; + @Backing(type="int") @VintfStability + enum MicrophoneDirection { + UNSPECIFIED = 0, + FRONT = 1, + BACK = 2, + EXTERNAL = 3, + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IStreamOut.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IStreamOut.aidl new file mode 100644 index 0000000000..ec3078efd7 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IStreamOut.aidl @@ -0,0 +1,54 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@VintfStability +interface IStreamOut { + android.hardware.audio.core.IStreamCommon getStreamCommon(); + void updateMetadata(in android.hardware.audio.common.SourceMetadata sourceMetadata); + void updateOffloadMetadata(in android.hardware.audio.common.AudioOffloadMetadata offloadMetadata); + float[] getHwVolume(); + void setHwVolume(in float[] channelVolumes); + float getAudioDescriptionMixLevel(); + void setAudioDescriptionMixLevel(float leveldB); + android.media.audio.common.AudioDualMonoMode getDualMonoMode(); + void setDualMonoMode(android.media.audio.common.AudioDualMonoMode mode); + android.media.audio.common.AudioLatencyMode[] getRecommendedLatencyModes(); + void setLatencyMode(android.media.audio.common.AudioLatencyMode mode); + android.media.audio.common.AudioPlaybackRate getPlaybackRateParameters(); + void setPlaybackRateParameters(in android.media.audio.common.AudioPlaybackRate playbackRate); + void selectPresentation(int presentationId, int programId); + const int HW_VOLUME_MIN = 0; + const int HW_VOLUME_MAX = 1; + const int AUDIO_DESCRIPTION_MIX_LEVEL_MAX = 48; +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IStreamOutEventCallback.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IStreamOutEventCallback.aidl new file mode 100644 index 0000000000..31cf0b7fc7 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/IStreamOutEventCallback.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@VintfStability +interface IStreamOutEventCallback { + oneway void onCodecFormatChanged(in byte[] audioMetadata); + oneway void onRecommendedLatencyModeChanged(in android.media.audio.common.AudioLatencyMode[] modes); +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/ITelephony.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/ITelephony.aidl new file mode 100644 index 0000000000..84d7aa1aa4 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/ITelephony.aidl @@ -0,0 +1,56 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@VintfStability +interface ITelephony { + android.media.audio.common.AudioMode[] getSupportedAudioModes(); + void switchAudioMode(android.media.audio.common.AudioMode mode); + android.hardware.audio.core.ITelephony.TelecomConfig setTelecomConfig(in android.hardware.audio.core.ITelephony.TelecomConfig config); + @JavaDerive(equals=true, toString=true) @VintfStability + parcelable TelecomConfig { + @nullable android.media.audio.common.Float voiceVolume; + android.hardware.audio.core.ITelephony.TelecomConfig.TtyMode ttyMode = android.hardware.audio.core.ITelephony.TelecomConfig.TtyMode.UNSPECIFIED; + @nullable android.media.audio.common.Boolean isHacEnabled; + const int VOICE_VOLUME_MIN = 0; + const int VOICE_VOLUME_MAX = 1; + @Backing(type="int") @VintfStability + enum TtyMode { + UNSPECIFIED = (-1) /* -1 */, + OFF = 0, + FULL = 1, + HCO = 2, + VCO = 3, + } + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/MmapBufferDescriptor.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/MmapBufferDescriptor.aidl new file mode 100644 index 0000000000..6ea1c69526 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/MmapBufferDescriptor.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable MmapBufferDescriptor { + android.hardware.common.Ashmem sharedMemory; + long burstSizeFrames; + int flags; + const int FLAG_INDEX_APPLICATION_SHAREABLE = 0; +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/ModuleDebug.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/ModuleDebug.aidl new file mode 100644 index 0000000000..467d37b6f7 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/ModuleDebug.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable ModuleDebug { + boolean simulateDeviceConnections; + int streamTransientStateDelayMs; +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/StreamDescriptor.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/StreamDescriptor.aidl new file mode 100644 index 0000000000..3e3dc38b2a --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/StreamDescriptor.aidl @@ -0,0 +1,93 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable StreamDescriptor { + android.hardware.common.fmq.MQDescriptor command; + android.hardware.common.fmq.MQDescriptor reply; + int frameSizeBytes; + long bufferSizeFrames; + android.hardware.audio.core.StreamDescriptor.AudioBuffer audio; + const int LATENCY_UNKNOWN = (-1) /* -1 */; + @FixedSize @VintfStability + parcelable Position { + long frames = UNKNOWN /* -1 */; + long timeNs = UNKNOWN /* -1 */; + const long UNKNOWN = (-1) /* -1 */; + } + @Backing(type="int") @VintfStability + enum State { + STANDBY = 1, + IDLE = 2, + ACTIVE = 3, + PAUSED = 4, + DRAINING = 5, + DRAIN_PAUSED = 6, + TRANSFERRING = 7, + TRANSFER_PAUSED = 8, + ERROR = 100, + } + @Backing(type="byte") @VintfStability + enum DrainMode { + DRAIN_UNSPECIFIED = 0, + DRAIN_ALL = 1, + DRAIN_EARLY_NOTIFY = 2, + } + @FixedSize @VintfStability + union Command { + int halReservedExit; + android.media.audio.common.Void getStatus; + android.media.audio.common.Void start; + int burst; + android.hardware.audio.core.StreamDescriptor.DrainMode drain; + android.media.audio.common.Void standby; + android.media.audio.common.Void pause; + android.media.audio.common.Void flush; + } + @FixedSize @VintfStability + parcelable Reply { + int status; + int fmqByteCount; + android.hardware.audio.core.StreamDescriptor.Position observable; + android.hardware.audio.core.StreamDescriptor.Position hardware; + int latencyMs; + int xrunFrames; + android.hardware.audio.core.StreamDescriptor.State state = android.hardware.audio.core.StreamDescriptor.State.STANDBY; + } + @VintfStability + union AudioBuffer { + android.hardware.common.fmq.MQDescriptor fmq; + android.hardware.audio.core.MmapBufferDescriptor mmap; + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/SurroundSoundConfig.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/SurroundSoundConfig.aidl new file mode 100644 index 0000000000..08a153778f --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/SurroundSoundConfig.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SurroundSoundConfig { + android.hardware.audio.core.SurroundSoundConfig.SurroundFormatFamily[] formatFamilies; + @VintfStability + parcelable SurroundFormatFamily { + android.media.audio.common.AudioFormatDescription primaryFormat; + android.media.audio.common.AudioFormatDescription[] subFormats; + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/VendorParameter.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/VendorParameter.aidl new file mode 100644 index 0000000000..bfe33ee4b4 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.core/1/android/hardware/audio/core/VendorParameter.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.core; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VendorParameter { + @utf8InCpp String id; + ParcelableHolder ext; +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/.hash b/audio/aidl/aidl_api/android.hardware.audio.effect/1/.hash new file mode 100644 index 0000000000..9914460874 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/.hash @@ -0,0 +1 @@ +504db4349f884424a8acc3f2fc0f6bb74dbfcdf0 diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/AcousticEchoCanceler.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/AcousticEchoCanceler.aidl new file mode 100644 index 0000000000..16367c0b80 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/AcousticEchoCanceler.aidl @@ -0,0 +1,45 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +union AcousticEchoCanceler { + android.hardware.audio.effect.VendorExtension vendor; + int echoDelayUs; + boolean mobileMode; + @VintfStability + union Id { + android.hardware.audio.effect.VendorExtension vendorExtensionTag; + android.hardware.audio.effect.AcousticEchoCanceler.Tag commonTag; + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/AutomaticGainControlV1.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/AutomaticGainControlV1.aidl new file mode 100644 index 0000000000..e69e2bd81d --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/AutomaticGainControlV1.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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +union AutomaticGainControlV1 { + android.hardware.audio.effect.VendorExtension vendor; + int targetPeakLevelDbFs; + int maxCompressionGainDb; + boolean enableLimiter; + @VintfStability + union Id { + android.hardware.audio.effect.VendorExtension vendorExtensionTag; + android.hardware.audio.effect.AutomaticGainControlV1.Tag commonTag; + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/AutomaticGainControlV2.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/AutomaticGainControlV2.aidl new file mode 100644 index 0000000000..46ffcafb31 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/AutomaticGainControlV2.aidl @@ -0,0 +1,51 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +union AutomaticGainControlV2 { + android.hardware.audio.effect.VendorExtension vendor; + int fixedDigitalGainMb; + android.hardware.audio.effect.AutomaticGainControlV2.LevelEstimator levelEstimator; + int saturationMarginMb; + @VintfStability + union Id { + android.hardware.audio.effect.VendorExtension vendorExtensionTag; + android.hardware.audio.effect.AutomaticGainControlV2.Tag commonTag; + } + @Backing(type="int") @VintfStability + enum LevelEstimator { + RMS = 0, + PEAK = 1, + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/BassBoost.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/BassBoost.aidl new file mode 100644 index 0000000000..c248ce8a8a --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/BassBoost.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +union BassBoost { + android.hardware.audio.effect.VendorExtension vendor; + int strengthPm; + @VintfStability + union Id { + android.hardware.audio.effect.VendorExtension vendorExtensionTag; + android.hardware.audio.effect.BassBoost.Tag commonTag; + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Capability.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Capability.aidl new file mode 100644 index 0000000000..c9df073489 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Capability.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +parcelable Capability { + android.hardware.audio.effect.VendorExtension vendorExtension; + android.hardware.audio.effect.Range range; +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/CommandId.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/CommandId.aidl new file mode 100644 index 0000000000..86b69fa2f2 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/CommandId.aidl @@ -0,0 +1,50 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@Backing(type="int") @VintfStability +enum CommandId { + START = 0, + STOP = 1, + RESET = 2, + VENDOR_COMMAND_0 = 0x100, + VENDOR_COMMAND_1, + VENDOR_COMMAND_2, + VENDOR_COMMAND_3, + VENDOR_COMMAND_4, + VENDOR_COMMAND_5, + VENDOR_COMMAND_6, + VENDOR_COMMAND_7, + VENDOR_COMMAND_8, + VENDOR_COMMAND_9, +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/DefaultExtension.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/DefaultExtension.aidl new file mode 100644 index 0000000000..f1cf3898c5 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/DefaultExtension.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.hardware.audio.effect; +@VintfStability +parcelable DefaultExtension { + byte[] bytes; +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Descriptor.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Descriptor.aidl new file mode 100644 index 0000000000..82dae97d24 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Descriptor.aidl @@ -0,0 +1,70 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +parcelable Descriptor { + android.hardware.audio.effect.Descriptor.Common common; + android.hardware.audio.effect.Capability capability; + const String EFFECT_TYPE_UUID_AEC = "7b491460-8d4d-11e0-bd61-0002a5d5c51b"; + const String EFFECT_TYPE_UUID_AGC1 = "0a8abfe0-654c-11e0-ba26-0002a5d5c51b"; + const String EFFECT_TYPE_UUID_AGC2 = "ae3c653b-be18-4ab8-8938-418f0a7f06ac"; + const String EFFECT_TYPE_UUID_BASS_BOOST = "0634f220-ddd4-11db-a0fc-0002a5d5c51b"; + const String EFFECT_TYPE_UUID_DOWNMIX = "381e49cc-a858-4aa2-87f6-e8388e7601b2"; + const String EFFECT_TYPE_UUID_DYNAMICS_PROCESSING = "7261676f-6d75-7369-6364-28e2fd3ac39e"; + const String EFFECT_TYPE_UUID_ENV_REVERB = "c2e5d5f0-94bd-4763-9cac-4e234d06839e"; + const String EFFECT_TYPE_UUID_EQUALIZER = "0bed4300-ddd6-11db-8f34-0002a5d5c51b"; + const String EFFECT_TYPE_UUID_HAPTIC_GENERATOR = "1411e6d6-aecd-4021-a1cf-a6aceb0d71e5"; + const String EFFECT_TYPE_UUID_LOUDNESS_ENHANCER = "fe3199be-aed0-413f-87bb-11260eb63cf1"; + const String EFFECT_TYPE_UUID_NS = "58b4b260-8e06-11e0-aa8e-0002a5d5c51b"; + const String EFFECT_TYPE_UUID_PRESET_REVERB = "47382d60-ddd8-11db-bf3a-0002a5d5c51b"; + const String EFFECT_TYPE_UUID_SPATIALIZER = "ccd4cf09-a79d-46c2-9aae-06a1698d6c8f"; + const String EFFECT_TYPE_UUID_VIRTUALIZER = "37cc2c00-dddd-11db-8577-0002a5d5c51b"; + const String EFFECT_TYPE_UUID_VISUALIZER = "d069d9e0-8329-11df-9168-0002a5d5c51b"; + const String EFFECT_TYPE_UUID_VOLUME = "fa81a2b8-588b-11ed-9b6a-0242ac120002"; + @VintfStability + parcelable Identity { + android.media.audio.common.AudioUuid type; + android.media.audio.common.AudioUuid uuid; + @nullable android.media.audio.common.AudioUuid proxy; + } + @VintfStability + parcelable Common { + android.hardware.audio.effect.Descriptor.Identity id; + android.hardware.audio.effect.Flags flags; + int cpuLoad; + int memoryUsage; + @utf8InCpp String name; + @utf8InCpp String implementor; + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Downmix.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Downmix.aidl new file mode 100644 index 0000000000..ce0a7df1ff --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Downmix.aidl @@ -0,0 +1,49 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +union Downmix { + android.hardware.audio.effect.VendorExtension vendor; + android.hardware.audio.effect.Downmix.Type type; + @VintfStability + union Id { + android.hardware.audio.effect.VendorExtension vendorExtensionTag; + android.hardware.audio.effect.Downmix.Tag commonTag; + } + @VintfStability + enum Type { + STRIP, + FOLD, + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/DynamicsProcessing.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/DynamicsProcessing.aidl new file mode 100644 index 0000000000..04f627d07b --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/DynamicsProcessing.aidl @@ -0,0 +1,115 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +union DynamicsProcessing { + android.hardware.audio.effect.VendorExtension vendor; + android.hardware.audio.effect.DynamicsProcessing.EngineArchitecture engineArchitecture; + android.hardware.audio.effect.DynamicsProcessing.ChannelConfig[] preEq; + android.hardware.audio.effect.DynamicsProcessing.ChannelConfig[] postEq; + android.hardware.audio.effect.DynamicsProcessing.EqBandConfig[] preEqBand; + android.hardware.audio.effect.DynamicsProcessing.EqBandConfig[] postEqBand; + android.hardware.audio.effect.DynamicsProcessing.ChannelConfig[] mbc; + android.hardware.audio.effect.DynamicsProcessing.MbcBandConfig[] mbcBand; + android.hardware.audio.effect.DynamicsProcessing.LimiterConfig[] limiter; + android.hardware.audio.effect.DynamicsProcessing.InputGain[] inputGain; + @VintfStability + union Id { + android.hardware.audio.effect.VendorExtension vendorExtensionTag; + android.hardware.audio.effect.DynamicsProcessing.Tag commonTag; + } + enum ResolutionPreference { + FAVOR_FREQUENCY_RESOLUTION, + FAVOR_TIME_RESOLUTION, + } + @VintfStability + parcelable StageEnablement { + boolean inUse; + int bandCount; + } + @VintfStability + parcelable EngineArchitecture { + android.hardware.audio.effect.DynamicsProcessing.ResolutionPreference resolutionPreference = android.hardware.audio.effect.DynamicsProcessing.ResolutionPreference.FAVOR_FREQUENCY_RESOLUTION; + float preferredProcessingDurationMs; + android.hardware.audio.effect.DynamicsProcessing.StageEnablement preEqStage; + android.hardware.audio.effect.DynamicsProcessing.StageEnablement postEqStage; + android.hardware.audio.effect.DynamicsProcessing.StageEnablement mbcStage; + boolean limiterInUse; + } + @VintfStability + parcelable ChannelConfig { + int channel; + boolean enable; + } + @VintfStability + parcelable EqBandConfig { + int channel; + int band; + boolean enable; + float cutoffFrequencyHz; + float gainDb; + } + @VintfStability + parcelable MbcBandConfig { + int channel; + int band; + boolean enable; + float cutoffFrequencyHz; + float attackTimeMs; + float releaseTimeMs; + float ratio; + float thresholdDb; + float kneeWidthDb; + float noiseGateThresholdDb; + float expanderRatio; + float preGainDb; + float postGainDb; + } + @VintfStability + parcelable LimiterConfig { + int channel; + boolean enable; + int linkGroup; + float attackTimeMs; + float releaseTimeMs; + float ratio; + float thresholdDb; + float postGainDb; + } + @VintfStability + parcelable InputGain { + int channel; + float gainDb; + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/EnvironmentalReverb.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/EnvironmentalReverb.aidl new file mode 100644 index 0000000000..00b7d1acfb --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/EnvironmentalReverb.aidl @@ -0,0 +1,54 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +union EnvironmentalReverb { + android.hardware.audio.effect.VendorExtension vendor; + int roomLevelMb; + int roomHfLevelMb; + int decayTimeMs; + int decayHfRatioPm; + int reflectionsLevelMb; + int reflectionsDelayMs; + int levelMb; + int delayMs; + int diffusionPm; + int densityPm; + boolean bypass; + @VintfStability + union Id { + android.hardware.audio.effect.VendorExtension vendorExtensionTag; + android.hardware.audio.effect.EnvironmentalReverb.Tag commonTag; + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Equalizer.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Equalizer.aidl new file mode 100644 index 0000000000..80f7c7e952 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Equalizer.aidl @@ -0,0 +1,64 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +union Equalizer { + android.hardware.audio.effect.VendorExtension vendor; + android.hardware.audio.effect.Equalizer.BandLevel[] bandLevels; + int preset; + int[] centerFreqMh; + android.hardware.audio.effect.Equalizer.BandFrequency[] bandFrequencies; + android.hardware.audio.effect.Equalizer.Preset[] presets; + @VintfStability + union Id { + android.hardware.audio.effect.VendorExtension vendorExtensionTag; + android.hardware.audio.effect.Equalizer.Tag commonTag; + } + @VintfStability + parcelable BandLevel { + int index; + int levelMb; + } + @VintfStability + parcelable BandFrequency { + int index; + int minMh; + int maxMh; + } + @VintfStability + parcelable Preset { + int index; + @utf8InCpp String name; + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Flags.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Flags.aidl new file mode 100644 index 0000000000..bcbf870fd7 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Flags.aidl @@ -0,0 +1,74 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +parcelable Flags { + android.hardware.audio.effect.Flags.Type type = android.hardware.audio.effect.Flags.Type.INSERT; + android.hardware.audio.effect.Flags.Insert insert = android.hardware.audio.effect.Flags.Insert.ANY; + android.hardware.audio.effect.Flags.Volume volume = android.hardware.audio.effect.Flags.Volume.NONE; + android.hardware.audio.effect.Flags.HardwareAccelerator hwAcceleratorMode = android.hardware.audio.effect.Flags.HardwareAccelerator.NONE; + boolean offloadIndication; + boolean deviceIndication; + boolean audioModeIndication; + boolean audioSourceIndication; + boolean bypass; + @Backing(type="byte") @VintfStability + enum Type { + INSERT = 0, + AUXILIARY = 1, + REPLACE = 2, + PRE_PROC = 3, + POST_PROC = 4, + } + @Backing(type="byte") @VintfStability + enum Insert { + ANY = 0, + FIRST = 1, + LAST = 2, + EXCLUSIVE = 3, + } + @Backing(type="byte") @VintfStability + enum Volume { + NONE = 0, + CTRL = 1, + IND = 2, + MONITOR = 3, + } + @Backing(type="byte") @VintfStability + enum HardwareAccelerator { + NONE = 0, + SIMPLE = 1, + TUNNEL = 2, + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/HapticGenerator.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/HapticGenerator.aidl new file mode 100644 index 0000000000..8addab7b5f --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/HapticGenerator.aidl @@ -0,0 +1,65 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +union HapticGenerator { + android.hardware.audio.effect.VendorExtension vendor; + android.hardware.audio.effect.HapticGenerator.HapticScale[] hapticScales; + android.hardware.audio.effect.HapticGenerator.VibratorInformation vibratorInfo; + @VintfStability + union Id { + android.hardware.audio.effect.VendorExtension vendorExtensionTag; + android.hardware.audio.effect.HapticGenerator.Tag commonTag; + } + @Backing(type="int") @VintfStability + enum VibratorScale { + MUTE = (-100) /* -100 */, + VERY_LOW = (-2) /* -2 */, + LOW = (-1) /* -1 */, + NONE = 0, + HIGH = 1, + VERY_HIGH = 2, + } + @VintfStability + parcelable HapticScale { + int id; + android.hardware.audio.effect.HapticGenerator.VibratorScale scale = android.hardware.audio.effect.HapticGenerator.VibratorScale.MUTE; + } + @VintfStability + parcelable VibratorInformation { + float resonantFrequencyHz; + float qFactor; + float maxAmplitude; + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/IEffect.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/IEffect.aidl new file mode 100644 index 0000000000..8c196e7abf --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/IEffect.aidl @@ -0,0 +1,56 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +interface IEffect { + android.hardware.audio.effect.IEffect.OpenEffectReturn open(in android.hardware.audio.effect.Parameter.Common common, in @nullable android.hardware.audio.effect.Parameter.Specific specific); + void close(); + android.hardware.audio.effect.Descriptor getDescriptor(); + void command(in android.hardware.audio.effect.CommandId commandId); + android.hardware.audio.effect.State getState(); + void setParameter(in android.hardware.audio.effect.Parameter param); + android.hardware.audio.effect.Parameter getParameter(in android.hardware.audio.effect.Parameter.Id paramId); + @FixedSize @VintfStability + parcelable Status { + int status; + int fmqConsumed; + int fmqProduced; + } + @VintfStability + parcelable OpenEffectReturn { + android.hardware.common.fmq.MQDescriptor statusMQ; + android.hardware.common.fmq.MQDescriptor inputDataMQ; + android.hardware.common.fmq.MQDescriptor outputDataMQ; + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/IFactory.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/IFactory.aidl new file mode 100644 index 0000000000..a6c138c0ef --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/IFactory.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +interface IFactory { + android.hardware.audio.effect.Descriptor[] queryEffects(in @nullable android.media.audio.common.AudioUuid type, in @nullable android.media.audio.common.AudioUuid implementation, in @nullable android.media.audio.common.AudioUuid proxy); + android.hardware.audio.effect.Processing[] queryProcessing(in @nullable android.hardware.audio.effect.Processing.Type type); + android.hardware.audio.effect.IEffect createEffect(in android.media.audio.common.AudioUuid implUuid); + void destroyEffect(in android.hardware.audio.effect.IEffect handle); +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/LoudnessEnhancer.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/LoudnessEnhancer.aidl new file mode 100644 index 0000000000..fc276d67bc --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/LoudnessEnhancer.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +union LoudnessEnhancer { + android.hardware.audio.effect.VendorExtension vendor; + int gainMb; + @VintfStability + union Id { + android.hardware.audio.effect.VendorExtension vendorExtensionTag; + android.hardware.audio.effect.LoudnessEnhancer.Tag commonTag; + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/NoiseSuppression.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/NoiseSuppression.aidl new file mode 100644 index 0000000000..7f30fe2ab7 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/NoiseSuppression.aidl @@ -0,0 +1,57 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +union NoiseSuppression { + android.hardware.audio.effect.VendorExtension vendor; + android.hardware.audio.effect.NoiseSuppression.Level level; + android.hardware.audio.effect.NoiseSuppression.Type type; + @VintfStability + union Id { + android.hardware.audio.effect.VendorExtension vendorExtensionTag; + android.hardware.audio.effect.NoiseSuppression.Tag commonTag; + } + @Backing(type="int") @VintfStability + enum Level { + LOW, + MEDIUM, + HIGH, + VERY_HIGH, + } + @Backing(type="int") @VintfStability + enum Type { + SINGLE_CHANNEL, + MULTI_CHANNEL, + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Parameter.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Parameter.aidl new file mode 100644 index 0000000000..0422bd92c7 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Parameter.aidl @@ -0,0 +1,95 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +union Parameter { + android.hardware.audio.effect.Parameter.Common common; + android.media.audio.common.AudioDeviceDescription[] deviceDescription; + android.media.audio.common.AudioMode mode; + android.media.audio.common.AudioSource source; + boolean offload; + android.hardware.audio.effect.Parameter.VolumeStereo volumeStereo; + android.hardware.audio.effect.Parameter.Specific specific; + @VintfStability + union Id { + android.hardware.audio.effect.VendorExtension vendorEffectTag; + android.hardware.audio.effect.AcousticEchoCanceler.Id acousticEchoCancelerTag; + android.hardware.audio.effect.AutomaticGainControlV1.Id automaticGainControlV1Tag; + android.hardware.audio.effect.AutomaticGainControlV2.Id automaticGainControlV2Tag; + android.hardware.audio.effect.BassBoost.Id bassBoostTag; + android.hardware.audio.effect.Downmix.Id downmixTag; + android.hardware.audio.effect.DynamicsProcessing.Id dynamicsProcessingTag; + android.hardware.audio.effect.EnvironmentalReverb.Id environmentalReverbTag; + android.hardware.audio.effect.Equalizer.Id equalizerTag; + android.hardware.audio.effect.HapticGenerator.Id hapticGeneratorTag; + android.hardware.audio.effect.LoudnessEnhancer.Id loudnessEnhancerTag; + android.hardware.audio.effect.NoiseSuppression.Id noiseSuppressionTag; + android.hardware.audio.effect.PresetReverb.Id presetReverbTag; + android.hardware.audio.effect.Virtualizer.Id virtualizerTag; + android.hardware.audio.effect.Visualizer.Id visualizerTag; + android.hardware.audio.effect.Volume.Id volumeTag; + android.hardware.audio.effect.Parameter.Tag commonTag; + } + @VintfStability + parcelable Common { + int session; + int ioHandle; + android.media.audio.common.AudioConfig input; + android.media.audio.common.AudioConfig output; + } + @VintfStability + parcelable VolumeStereo { + float left; + float right; + } + @VintfStability + union Specific { + android.hardware.audio.effect.VendorExtension vendorEffect; + android.hardware.audio.effect.AcousticEchoCanceler acousticEchoCanceler; + android.hardware.audio.effect.AutomaticGainControlV1 automaticGainControlV1; + android.hardware.audio.effect.AutomaticGainControlV2 automaticGainControlV2; + android.hardware.audio.effect.BassBoost bassBoost; + android.hardware.audio.effect.Downmix downmix; + android.hardware.audio.effect.DynamicsProcessing dynamicsProcessing; + android.hardware.audio.effect.EnvironmentalReverb environmentalReverb; + android.hardware.audio.effect.Equalizer equalizer; + android.hardware.audio.effect.HapticGenerator hapticGenerator; + android.hardware.audio.effect.LoudnessEnhancer loudnessEnhancer; + android.hardware.audio.effect.NoiseSuppression noiseSuppression; + android.hardware.audio.effect.PresetReverb presetReverb; + android.hardware.audio.effect.Virtualizer virtualizer; + android.hardware.audio.effect.Visualizer visualizer; + android.hardware.audio.effect.Volume volume; + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/PresetReverb.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/PresetReverb.aidl new file mode 100644 index 0000000000..26d96b54f3 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/PresetReverb.aidl @@ -0,0 +1,55 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +union PresetReverb { + android.hardware.audio.effect.VendorExtension vendor; + android.hardware.audio.effect.PresetReverb.Presets[] supportedPresets; + android.hardware.audio.effect.PresetReverb.Presets preset; + @Backing(type="int") @VintfStability + enum Presets { + NONE, + SMALLROOM, + MEDIUMROOM, + LARGEROOM, + MEDIUMHALL, + LARGEHALL, + PLATE, + } + @VintfStability + union Id { + android.hardware.audio.effect.VendorExtension vendorExtensionTag; + android.hardware.audio.effect.PresetReverb.Tag commonTag; + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Processing.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Processing.aidl new file mode 100644 index 0000000000..f6d6ee25bf --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Processing.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +parcelable Processing { + android.hardware.audio.effect.Processing.Type type; + android.hardware.audio.effect.Descriptor[] ids; + @VintfStability + union Type { + android.media.audio.common.AudioStreamType streamType = android.media.audio.common.AudioStreamType.INVALID; + android.media.audio.common.AudioSource source; + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Range.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Range.aidl new file mode 100644 index 0000000000..93edc5edfa --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Range.aidl @@ -0,0 +1,133 @@ +/* + * 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 -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.hardware.audio.effect; +@VintfStability +union Range { + android.hardware.audio.effect.Range.VendorExtensionRange[] vendorExtension = {}; + android.hardware.audio.effect.Range.AcousticEchoCancelerRange[] acousticEchoCanceler; + android.hardware.audio.effect.Range.AutomaticGainControlV1Range[] automaticGainControlV1; + android.hardware.audio.effect.Range.AutomaticGainControlV2Range[] automaticGainControlV2; + android.hardware.audio.effect.Range.BassBoostRange[] bassBoost; + android.hardware.audio.effect.Range.DownmixRange[] downmix; + android.hardware.audio.effect.Range.DynamicsProcessingRange[] dynamicsProcessing; + android.hardware.audio.effect.Range.EnvironmentalReverbRange[] environmentalReverb; + android.hardware.audio.effect.Range.EqualizerRange[] equalizer; + android.hardware.audio.effect.Range.HapticGeneratorRange[] hapticGenerator; + android.hardware.audio.effect.Range.LoudnessEnhancerRange[] loudnessEnhancer; + android.hardware.audio.effect.Range.NoiseSuppressionRange[] noiseSuppression; + android.hardware.audio.effect.Range.PresetReverbRange[] presetReverb; + android.hardware.audio.effect.Range.VirtualizerRange[] virtualizer; + android.hardware.audio.effect.Range.VisualizerRange[] visualizer; + android.hardware.audio.effect.Range.VolumeRange[] volume; + @VintfStability + parcelable AcousticEchoCancelerRange { + android.hardware.audio.effect.AcousticEchoCanceler min; + android.hardware.audio.effect.AcousticEchoCanceler max; + } + @VintfStability + parcelable AutomaticGainControlV1Range { + android.hardware.audio.effect.AutomaticGainControlV1 min; + android.hardware.audio.effect.AutomaticGainControlV1 max; + } + @VintfStability + parcelable AutomaticGainControlV2Range { + android.hardware.audio.effect.AutomaticGainControlV2 min; + android.hardware.audio.effect.AutomaticGainControlV2 max; + } + @VintfStability + parcelable BassBoostRange { + android.hardware.audio.effect.BassBoost min; + android.hardware.audio.effect.BassBoost max; + } + @VintfStability + parcelable DownmixRange { + android.hardware.audio.effect.Downmix min; + android.hardware.audio.effect.Downmix max; + } + @VintfStability + parcelable DynamicsProcessingRange { + android.hardware.audio.effect.DynamicsProcessing min; + android.hardware.audio.effect.DynamicsProcessing max; + } + @VintfStability + parcelable EnvironmentalReverbRange { + android.hardware.audio.effect.EnvironmentalReverb min; + android.hardware.audio.effect.EnvironmentalReverb max; + } + @VintfStability + parcelable EqualizerRange { + android.hardware.audio.effect.Equalizer min; + android.hardware.audio.effect.Equalizer max; + } + @VintfStability + parcelable HapticGeneratorRange { + android.hardware.audio.effect.HapticGenerator min; + android.hardware.audio.effect.HapticGenerator max; + } + @VintfStability + parcelable LoudnessEnhancerRange { + android.hardware.audio.effect.LoudnessEnhancer min; + android.hardware.audio.effect.LoudnessEnhancer max; + } + @VintfStability + parcelable NoiseSuppressionRange { + android.hardware.audio.effect.NoiseSuppression min; + android.hardware.audio.effect.NoiseSuppression max; + } + @VintfStability + parcelable PresetReverbRange { + android.hardware.audio.effect.PresetReverb min; + android.hardware.audio.effect.PresetReverb max; + } + @VintfStability + parcelable VendorExtensionRange { + android.hardware.audio.effect.VendorExtension min; + android.hardware.audio.effect.VendorExtension max; + } + @VintfStability + parcelable VirtualizerRange { + android.hardware.audio.effect.Virtualizer min; + android.hardware.audio.effect.Virtualizer max; + } + @VintfStability + parcelable VisualizerRange { + android.hardware.audio.effect.Visualizer min; + android.hardware.audio.effect.Visualizer max; + } + @VintfStability + parcelable VolumeRange { + android.hardware.audio.effect.Volume min; + android.hardware.audio.effect.Volume max; + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/State.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/State.aidl new file mode 100644 index 0000000000..17f98142f8 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/State.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@Backing(type="byte") @VintfStability +enum State { + INIT, + IDLE, + PROCESSING, +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/VendorExtension.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/VendorExtension.aidl new file mode 100644 index 0000000000..b806334a90 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/VendorExtension.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +parcelable VendorExtension { + ParcelableHolder extension; +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Virtualizer.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Virtualizer.aidl new file mode 100644 index 0000000000..6092b140c2 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Virtualizer.aidl @@ -0,0 +1,58 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +union Virtualizer { + android.hardware.audio.effect.VendorExtension vendor; + int strengthPm; + android.hardware.audio.effect.Virtualizer.ChannelAngle[] speakerAngles; + android.media.audio.common.AudioDeviceDescription device; + @VintfStability + union Id { + android.hardware.audio.effect.VendorExtension vendorExtensionTag; + android.hardware.audio.effect.Virtualizer.Tag commonTag; + android.hardware.audio.effect.Virtualizer.SpeakerAnglesPayload speakerAnglesPayload; + } + @VintfStability + parcelable SpeakerAnglesPayload { + android.media.audio.common.AudioChannelLayout layout; + android.media.audio.common.AudioDeviceDescription device; + } + @VintfStability + parcelable ChannelAngle { + int channel; + int azimuthDegree; + int elevationDegree; + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Visualizer.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Visualizer.aidl new file mode 100644 index 0000000000..7d319da751 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Visualizer.aidl @@ -0,0 +1,65 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +union Visualizer { + android.hardware.audio.effect.Visualizer.Id id; + android.hardware.audio.effect.VendorExtension vendor; + android.hardware.audio.effect.Visualizer.Measurement measurement; + byte[] captureSampleBuffer; + int latencyMs; + int captureSamples; + android.hardware.audio.effect.Visualizer.ScalingMode scalingMode; + android.hardware.audio.effect.Visualizer.MeasurementMode measurementMode; + @VintfStability + union Id { + android.hardware.audio.effect.VendorExtension vendorExtensionTag; + android.hardware.audio.effect.Visualizer.Tag commonTag; + } + @VintfStability + enum ScalingMode { + NORMALIZED = 0, + AS_PLAYED, + } + @VintfStability + enum MeasurementMode { + NONE = 0, + PEAK_RMS, + } + @VintfStability + parcelable Measurement { + int rms; + int peak; + } +} diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Volume.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Volume.aidl new file mode 100644 index 0000000000..8227118d72 --- /dev/null +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Volume.aidl @@ -0,0 +1,45 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.effect; +@VintfStability +union Volume { + android.hardware.audio.effect.VendorExtension vendor; + int levelDb; + boolean mute; + @VintfStability + union Id { + android.hardware.audio.effect.VendorExtension vendorExtensionTag; + android.hardware.audio.effect.Volume.Tag commonTag; + } +} diff --git a/audio/aidl/sounddose/Android.bp b/audio/aidl/sounddose/Android.bp index 85d6e217a8..6f2f79083b 100644 --- a/audio/aidl/sounddose/Android.bp +++ b/audio/aidl/sounddose/Android.bp @@ -44,9 +44,15 @@ aidl_interface { }, }, versions_with_info: [ + { + version: "1", + imports: ["android.hardware.audio.core.sounddose-V1"], + }, + // IMPORTANT: Update latest_android_hardware_audio_sounddose every time you // add the latest frozen version to versions_with_info ], + frozen: true, } // Note: This should always be one version ahead of the last frozen version diff --git a/audio/aidl/sounddose/aidl_api/android.hardware.audio.sounddose/1/.hash b/audio/aidl/sounddose/aidl_api/android.hardware.audio.sounddose/1/.hash new file mode 100644 index 0000000000..625ababf12 --- /dev/null +++ b/audio/aidl/sounddose/aidl_api/android.hardware.audio.sounddose/1/.hash @@ -0,0 +1 @@ +7acf835db643d39414afbbbbcda816e2d7e8c77a diff --git a/audio/aidl/sounddose/aidl_api/android.hardware.audio.sounddose/1/android/hardware/audio/sounddose/ISoundDoseFactory.aidl b/audio/aidl/sounddose/aidl_api/android.hardware.audio.sounddose/1/android/hardware/audio/sounddose/ISoundDoseFactory.aidl new file mode 100644 index 0000000000..148720ce4f --- /dev/null +++ b/audio/aidl/sounddose/aidl_api/android.hardware.audio.sounddose/1/android/hardware/audio/sounddose/ISoundDoseFactory.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.audio.sounddose; +@VintfStability +interface ISoundDoseFactory { + @nullable android.hardware.audio.core.sounddose.ISoundDose getSoundDose(in @utf8InCpp String module); +} diff --git a/automotive/audiocontrol/aidl/Android.bp b/automotive/audiocontrol/aidl/Android.bp index 03dab08f1f..9ae77cdea9 100644 --- a/automotive/audiocontrol/aidl/Android.bp +++ b/automotive/audiocontrol/aidl/Android.bp @@ -43,7 +43,15 @@ aidl_interface { "android.media.audio.common.types-V2", ], }, + { + version: "3", + imports: [ + "android.hardware.audio.common-V1", + "android.media.audio.common.types-V2", + ], + }, ], + frozen: true, } diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/.hash b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/.hash new file mode 100644 index 0000000000..c8dbf1cc9d --- /dev/null +++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/.hash @@ -0,0 +1 @@ +bc0ead0d35057635fdb88f5353686cbbc6c65dcd diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/AudioFocusChange.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/AudioFocusChange.aidl new file mode 100644 index 0000000000..8eab521ce4 --- /dev/null +++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/AudioFocusChange.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2020 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 -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.hardware.automotive.audiocontrol; +@Backing(type="int") @VintfStability +enum AudioFocusChange { + NONE = 0, + GAIN = 1, + GAIN_TRANSIENT = 2, + GAIN_TRANSIENT_MAY_DUCK = 3, + GAIN_TRANSIENT_EXCLUSIVE = 4, + LOSS = ((-1) * GAIN) /* -1 */, + LOSS_TRANSIENT = ((-1) * GAIN_TRANSIENT) /* -2 */, + LOSS_TRANSIENT_CAN_DUCK = ((-1) * GAIN_TRANSIENT_MAY_DUCK) /* -3 */, +} diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl new file mode 100644 index 0000000000..91ce035229 --- /dev/null +++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/AudioGainConfigInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.audiocontrol; +@VintfStability +parcelable AudioGainConfigInfo { + int zoneId; + String devicePortAddress; + int volumeIndex; +} diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/DuckingInfo.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/DuckingInfo.aidl new file mode 100644 index 0000000000..23abb46bd7 --- /dev/null +++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/DuckingInfo.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2020 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 -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.hardware.automotive.audiocontrol; +@VintfStability +parcelable DuckingInfo { + int zoneId; + String[] deviceAddressesToDuck; + String[] deviceAddressesToUnduck; + String[] usagesHoldingFocus; + @nullable android.hardware.audio.common.PlaybackTrackMetadata[] playbackMetaDataHoldingFocus; +} diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/IAudioControl.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/IAudioControl.aidl new file mode 100644 index 0000000000..ffd575dfa4 --- /dev/null +++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/IAudioControl.aidl @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2020 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 -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.hardware.automotive.audiocontrol; +@VintfStability +interface IAudioControl { + /** + * @deprecated use {@link android.hardware.audio.common.PlaybackTrackMetadata} instead. + */ + oneway void onAudioFocusChange(in String usage, in int zoneId, in android.hardware.automotive.audiocontrol.AudioFocusChange focusChange); + oneway void onDevicesToDuckChange(in android.hardware.automotive.audiocontrol.DuckingInfo[] duckingInfos); + oneway void onDevicesToMuteChange(in android.hardware.automotive.audiocontrol.MutingInfo[] mutingInfos); + oneway void registerFocusListener(in android.hardware.automotive.audiocontrol.IFocusListener listener); + oneway void setBalanceTowardRight(in float value); + oneway void setFadeTowardFront(in float value); + oneway void onAudioFocusChangeWithMetaData(in android.hardware.audio.common.PlaybackTrackMetadata playbackMetaData, in int zoneId, in android.hardware.automotive.audiocontrol.AudioFocusChange focusChange); + oneway void setAudioDeviceGainsChanged(in android.hardware.automotive.audiocontrol.Reasons[] reasons, in android.hardware.automotive.audiocontrol.AudioGainConfigInfo[] gains); + oneway void registerGainCallback(in android.hardware.automotive.audiocontrol.IAudioGainCallback callback); + void setModuleChangeCallback(in android.hardware.automotive.audiocontrol.IModuleChangeCallback callback); + void clearModuleChangeCallback(); +} diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/IAudioGainCallback.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/IAudioGainCallback.aidl new file mode 100644 index 0000000000..17a087f20c --- /dev/null +++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/IAudioGainCallback.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.audiocontrol; +@VintfStability +interface IAudioGainCallback { + oneway void onAudioDeviceGainsChanged(in android.hardware.automotive.audiocontrol.Reasons[] reasons, in android.hardware.automotive.audiocontrol.AudioGainConfigInfo[] gains); +} diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/IFocusListener.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/IFocusListener.aidl new file mode 100644 index 0000000000..3e175529fa --- /dev/null +++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/IFocusListener.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2020 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 -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.hardware.automotive.audiocontrol; +@VintfStability +interface IFocusListener { + oneway void abandonAudioFocus(in String usage, in int zoneId); + oneway void requestAudioFocus(in String usage, in int zoneId, in android.hardware.automotive.audiocontrol.AudioFocusChange focusGain); + oneway void abandonAudioFocusWithMetaData(in android.hardware.audio.common.PlaybackTrackMetadata playbackMetaData, in int zoneId); + oneway void requestAudioFocusWithMetaData(in android.hardware.audio.common.PlaybackTrackMetadata playbackMetaData, in int zoneId, in android.hardware.automotive.audiocontrol.AudioFocusChange focusGain); +} diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/IModuleChangeCallback.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/IModuleChangeCallback.aidl new file mode 100644 index 0000000000..2bbb9362b9 --- /dev/null +++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/IModuleChangeCallback.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.hardware.automotive.audiocontrol; +@VintfStability +interface IModuleChangeCallback { + oneway void onAudioPortsChanged(in android.media.audio.common.AudioPort[] audioPorts); +} diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/MutingInfo.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/MutingInfo.aidl new file mode 100644 index 0000000000..b25ed0f1e9 --- /dev/null +++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/MutingInfo.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2020 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 -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.hardware.automotive.audiocontrol; +@VintfStability +parcelable MutingInfo { + int zoneId; + String[] deviceAddressesToMute; + String[] deviceAddressesToUnmute; +} diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/Reasons.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/Reasons.aidl new file mode 100644 index 0000000000..8d669850a5 --- /dev/null +++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/3/android/hardware/automotive/audiocontrol/Reasons.aidl @@ -0,0 +1,47 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.audiocontrol; +@Backing(type="int") @VintfStability +enum Reasons { + FORCED_MASTER_MUTE = 0x1, + REMOTE_MUTE = 0x2, + TCU_MUTE = 0x4, + ADAS_DUCKING = 0x8, + NAV_DUCKING = 0x10, + PROJECTION_DUCKING = 0x20, + THERMAL_LIMITATION = 0x40, + SUSPEND_EXIT_VOL_LIMITATION = 0x80, + EXTERNAL_AMP_VOL_FEEDBACK = 0x100, + OTHER = 0x80000000, +} diff --git a/automotive/can/aidl/Android.bp b/automotive/can/aidl/Android.bp index 67333b9730..3c4ee19af7 100644 --- a/automotive/can/aidl/Android.bp +++ b/automotive/can/aidl/Android.bp @@ -37,4 +37,12 @@ aidl_interface { enabled: true, }, }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + frozen: true, + } diff --git a/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/.hash b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/.hash new file mode 100644 index 0000000000..441924dcc7 --- /dev/null +++ b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/.hash @@ -0,0 +1 @@ +faa17409884ed5419fe73ebd24279109ca7549e1 diff --git a/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/BusConfig.aidl b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/BusConfig.aidl new file mode 100644 index 0000000000..0212e00f4c --- /dev/null +++ b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/BusConfig.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.can; +@VintfStability +parcelable BusConfig { + String name; + android.hardware.automotive.can.BusConfig.InterfaceId interfaceId; + int bitrate; + union InterfaceId { + android.hardware.automotive.can.VirtualInterface virtualif; + android.hardware.automotive.can.NativeInterface nativeif; + android.hardware.automotive.can.SlcanInterface slcan; + android.hardware.automotive.can.IndexedInterface indexed; + } +} diff --git a/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/ICanController.aidl b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/ICanController.aidl new file mode 100644 index 0000000000..5d032f27ab --- /dev/null +++ b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/ICanController.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.can; +@VintfStability +interface ICanController { + android.hardware.automotive.can.InterfaceType[] getSupportedInterfaceTypes(); + String getInterfaceName(in String busName); + String upBus(in android.hardware.automotive.can.BusConfig config); + void downBus(in String name); +} diff --git a/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/IndexedInterface.aidl b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/IndexedInterface.aidl new file mode 100644 index 0000000000..1b00adf1e1 --- /dev/null +++ b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/IndexedInterface.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.can; +@VintfStability +parcelable IndexedInterface { + byte index; +} diff --git a/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/InterfaceType.aidl b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/InterfaceType.aidl new file mode 100644 index 0000000000..a1bdb90d22 --- /dev/null +++ b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/InterfaceType.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.can; +@Backing(type="byte") @VintfStability +enum InterfaceType { + VIRTUAL, + NATIVE, + SLCAN, + INDEXED, +} diff --git a/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/NativeInterface.aidl b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/NativeInterface.aidl new file mode 100644 index 0000000000..5d6c119356 --- /dev/null +++ b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/NativeInterface.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.can; +@VintfStability +parcelable NativeInterface { + android.hardware.automotive.can.NativeInterface.InterfaceId interfaceId; + union InterfaceId { + String ifname; + String[] serialno; + } +} diff --git a/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/Result.aidl b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/Result.aidl new file mode 100644 index 0000000000..5669645528 --- /dev/null +++ b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/Result.aidl @@ -0,0 +1,45 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.can; +@Backing(type="int") @VintfStability +enum Result { + OK, + UNKNOWN_ERROR, + INVALID_STATE, + NOT_SUPPORTED, + BAD_INTERFACE_ID, + BAD_BITRATE, + BAD_BUS_NAME, + INTERFACE_DOWN, +} diff --git a/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/SlcanInterface.aidl b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/SlcanInterface.aidl new file mode 100644 index 0000000000..af0c07d22a --- /dev/null +++ b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/SlcanInterface.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.can; +@VintfStability +parcelable SlcanInterface { + android.hardware.automotive.can.SlcanInterface.InterfaceId interfaceId; + union InterfaceId { + String ttyname; + String[] serialno; + } +} diff --git a/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/VirtualInterface.aidl b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/VirtualInterface.aidl new file mode 100644 index 0000000000..c870612dd9 --- /dev/null +++ b/automotive/can/aidl/aidl_api/android.hardware.automotive.can/1/android/hardware/automotive/can/VirtualInterface.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.can; +@VintfStability +parcelable VirtualInterface { + String ifname; +} diff --git a/automotive/evs/aidl/Android.bp b/automotive/evs/aidl/Android.bp index 8aaa1ced54..bafb4af30f 100644 --- a/automotive/evs/aidl/Android.bp +++ b/automotive/evs/aidl/Android.bp @@ -56,6 +56,15 @@ aidl_interface { "android.hardware.graphics.common-V4", ], }, + { + version: "2", + imports: [ + "android.hardware.common-V2", + "android.hardware.graphics.common-V4", + ], + }, + ], + frozen: true, } diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/.hash b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/.hash new file mode 100644 index 0000000000..406943ebf0 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/.hash @@ -0,0 +1 @@ +36c9e7c4f9a0e7264c1e5dd61359cb6397fcd182 diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/BufferDesc.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/BufferDesc.aidl new file mode 100644 index 0000000000..332aca34a6 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/BufferDesc.aidl @@ -0,0 +1,47 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@VintfStability +parcelable BufferDesc { + android.hardware.graphics.common.HardwareBuffer buffer; + int pixelSizeBytes; + int bufferId; + @utf8InCpp String deviceId; + long timestamp; + byte[] metadata; + @nullable android.hardware.automotive.evs.ExposureParameters[] exposureSettings; + @nullable android.hardware.automotive.evs.Histogram[] histograms; + @nullable android.hardware.automotive.evs.GridStatistics[] grids; + @nullable android.hardware.automotive.evs.EmbeddedData embeddedData; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/CameraDesc.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/CameraDesc.aidl new file mode 100644 index 0000000000..4dadeb88b2 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/CameraDesc.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@VintfStability +parcelable CameraDesc { + @utf8InCpp String id; + int vendorFlags; + byte[] metadata; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/CameraParam.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/CameraParam.aidl new file mode 100644 index 0000000000..21207b348a --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/CameraParam.aidl @@ -0,0 +1,49 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@Backing(type="int") @VintfStability +enum CameraParam { + BRIGHTNESS, + CONTRAST, + AUTOGAIN, + GAIN, + AUTO_WHITE_BALANCE, + WHITE_BALANCE_TEMPERATURE, + SHARPNESS, + AUTO_EXPOSURE, + ABSOLUTE_EXPOSURE, + ABSOLUTE_FOCUS, + AUTO_FOCUS, + ABSOLUTE_ZOOM, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/ColorChannel.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/ColorChannel.aidl new file mode 100644 index 0000000000..e59db4cee2 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/ColorChannel.aidl @@ -0,0 +1,41 @@ +/* + * 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 -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.hardware.automotive.evs; +@Backing(type="int") @VintfStability +enum ColorChannel { + R, + G_EVEN, + B, + G_ODD_OR_Y, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/DeviceStatus.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/DeviceStatus.aidl new file mode 100644 index 0000000000..cc066ac6db --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/DeviceStatus.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@VintfStability +parcelable DeviceStatus { + @utf8InCpp String id; + android.hardware.automotive.evs.DeviceStatusType status; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/DeviceStatusType.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/DeviceStatusType.aidl new file mode 100644 index 0000000000..92c2247019 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/DeviceStatusType.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@Backing(type="int") @VintfStability +enum DeviceStatusType { + CAMERA_AVAILABLE, + CAMERA_NOT_AVAILABLE, + DISPLAY_AVAILABLE, + DISPLAY_NOT_AVAILABLE, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/DisplayDesc.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/DisplayDesc.aidl new file mode 100644 index 0000000000..4ac029e479 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/DisplayDesc.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@VintfStability +parcelable DisplayDesc { + @utf8InCpp String id; + int width; + int height; + android.hardware.automotive.evs.Rotation orientation; + int vendorFlags; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/DisplayState.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/DisplayState.aidl new file mode 100644 index 0000000000..5f03f43e86 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/DisplayState.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@Backing(type="int") @VintfStability +enum DisplayState { + NOT_OPEN = 0, + NOT_VISIBLE, + VISIBLE_ON_NEXT_FRAME, + VISIBLE, + DEAD, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/EmbeddedData.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/EmbeddedData.aidl new file mode 100644 index 0000000000..e1f50d2e23 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/EmbeddedData.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.automotive.evs; +@VintfStability +parcelable EmbeddedData { + int widthInBytes; + int heightInLines; + android.hardware.common.Ashmem data; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/EvsEventDesc.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/EvsEventDesc.aidl new file mode 100644 index 0000000000..09b2b9db13 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/EvsEventDesc.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@VintfStability +parcelable EvsEventDesc { + android.hardware.automotive.evs.EvsEventType aType; + @utf8InCpp String deviceId; + int[] payload; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/EvsEventType.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/EvsEventType.aidl new file mode 100644 index 0000000000..2e75a25328 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/EvsEventType.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@Backing(type="int") @VintfStability +enum EvsEventType { + STREAM_STARTED = 0, + STREAM_STOPPED, + FRAME_DROPPED, + TIMEOUT, + PARAMETER_CHANGED, + MASTER_RELEASED, + STREAM_ERROR, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/EvsResult.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/EvsResult.aidl new file mode 100644 index 0000000000..1f047508e5 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/EvsResult.aidl @@ -0,0 +1,48 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@Backing(type="int") @VintfStability +enum EvsResult { + OK = 0, + INVALID_ARG, + STREAM_ALREADY_RUNNING, + BUFFER_NOT_AVAILABLE, + OWNERSHIP_LOST, + UNDERLYING_SERVICE_ERROR, + PERMISSION_DENIED, + RESOURCE_NOT_AVAILABLE, + RESOURCE_BUSY, + NOT_IMPLEMENTED, + NOT_SUPPORTED, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/ExposureParameters.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/ExposureParameters.aidl new file mode 100644 index 0000000000..28289ae7e9 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/ExposureParameters.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 -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.hardware.automotive.evs; +@VintfStability +parcelable ExposureParameters { + float[4] analogGain; + float[4] digitalGain; + long coarseIntegrationTimeInLines; + long fineIntegrationTimeInPixelClocks; + int coarseIntegrationTimeLShift; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/GridStatisticDesc.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/GridStatisticDesc.aidl new file mode 100644 index 0000000000..f9fadd994f --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/GridStatisticDesc.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 -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.hardware.automotive.evs; +@VintfStability +parcelable GridStatisticDesc { + android.hardware.automotive.evs.ColorChannel channel; + android.hardware.automotive.evs.GridStatisticType type; + android.hardware.graphics.common.Rect roi; + android.hardware.automotive.evs.Size cellSize; + int bitDepth; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/GridStatisticType.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/GridStatisticType.aidl new file mode 100644 index 0000000000..c2b2d66301 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/GridStatisticType.aidl @@ -0,0 +1,41 @@ +/* + * 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 -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.hardware.automotive.evs; +@Backing(type="int") @VintfStability +enum GridStatisticType { + USER_DEFINED, + AVERAGE, + SUM, + SATURATION_COUNT, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/GridStatistics.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/GridStatistics.aidl new file mode 100644 index 0000000000..d87cff3787 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/GridStatistics.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.hardware.automotive.evs; +@VintfStability +parcelable GridStatistics { + android.hardware.automotive.evs.GridStatisticDesc[] descriptors; + android.hardware.common.Ashmem data; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/Histogram.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/Histogram.aidl new file mode 100644 index 0000000000..cb73eba88f --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/Histogram.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 -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.hardware.automotive.evs; +@VintfStability +parcelable Histogram { + android.hardware.automotive.evs.ColorChannel channel; + android.hardware.graphics.common.Rect roi; + int size; + int capacity; + long[] bins; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsCamera.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsCamera.aidl new file mode 100644 index 0000000000..ce1b97d16c --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsCamera.aidl @@ -0,0 +1,55 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@VintfStability +interface IEvsCamera { + void doneWithFrame(in android.hardware.automotive.evs.BufferDesc[] buffer); + void forcePrimaryClient(in android.hardware.automotive.evs.IEvsDisplay display); + android.hardware.automotive.evs.CameraDesc getCameraInfo(); + byte[] getExtendedInfo(in int opaqueIdentifier); + int[] getIntParameter(in android.hardware.automotive.evs.CameraParam id); + android.hardware.automotive.evs.ParameterRange getIntParameterRange(in android.hardware.automotive.evs.CameraParam id); + android.hardware.automotive.evs.CameraParam[] getParameterList(); + android.hardware.automotive.evs.CameraDesc getPhysicalCameraInfo(in String deviceId); + int importExternalBuffers(in android.hardware.automotive.evs.BufferDesc[] buffers); + void pauseVideoStream(); + void resumeVideoStream(); + void setExtendedInfo(in int opaqueIdentifier, in byte[] opaqueValue); + int[] setIntParameter(in android.hardware.automotive.evs.CameraParam id, in int value); + void setPrimaryClient(); + void setMaxFramesInFlight(in int bufferCount); + void startVideoStream(in android.hardware.automotive.evs.IEvsCameraStream receiver); + void stopVideoStream(); + void unsetPrimaryClient(); +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsCameraStream.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsCameraStream.aidl new file mode 100644 index 0000000000..6e2e64a3c4 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsCameraStream.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@VintfStability +interface IEvsCameraStream { + oneway void deliverFrame(in android.hardware.automotive.evs.BufferDesc[] buffer); + oneway void notify(in android.hardware.automotive.evs.EvsEventDesc event); +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsDisplay.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsDisplay.aidl new file mode 100644 index 0000000000..9b538d43a2 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsDisplay.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@VintfStability +interface IEvsDisplay { + android.hardware.automotive.evs.DisplayDesc getDisplayInfo(); + android.hardware.automotive.evs.DisplayState getDisplayState(); + android.hardware.automotive.evs.BufferDesc getTargetBuffer(); + void returnTargetBufferForDisplay(in android.hardware.automotive.evs.BufferDesc buffer); + void setDisplayState(in android.hardware.automotive.evs.DisplayState state); +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsEnumerator.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsEnumerator.aidl new file mode 100644 index 0000000000..4cefdf2f7a --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsEnumerator.aidl @@ -0,0 +1,51 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@VintfStability +interface IEvsEnumerator { + void closeCamera(in android.hardware.automotive.evs.IEvsCamera carCamera); + void closeDisplay(in android.hardware.automotive.evs.IEvsDisplay display); + void closeUltrasonicsArray(in android.hardware.automotive.evs.IEvsUltrasonicsArray evsUltrasonicsArray); + android.hardware.automotive.evs.CameraDesc[] getCameraList(); + byte[] getDisplayIdList(); + android.hardware.automotive.evs.DisplayState getDisplayState(); + android.hardware.automotive.evs.Stream[] getStreamList(in android.hardware.automotive.evs.CameraDesc description); + android.hardware.automotive.evs.UltrasonicsArrayDesc[] getUltrasonicsArrayList(); + boolean isHardware(); + android.hardware.automotive.evs.IEvsCamera openCamera(in String cameraId, in android.hardware.automotive.evs.Stream streamCfg); + android.hardware.automotive.evs.IEvsDisplay openDisplay(in int id); + android.hardware.automotive.evs.IEvsUltrasonicsArray openUltrasonicsArray(in String ultrasonicsArrayId); + void registerStatusCallback(in android.hardware.automotive.evs.IEvsEnumeratorStatusCallback callback); + android.hardware.automotive.evs.DisplayState getDisplayStateById(in int id); +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsEnumeratorStatusCallback.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsEnumeratorStatusCallback.aidl new file mode 100644 index 0000000000..c39a4e855e --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsEnumeratorStatusCallback.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@VintfStability +interface IEvsEnumeratorStatusCallback { + oneway void deviceStatusChanged(in android.hardware.automotive.evs.DeviceStatus[] status); +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsUltrasonicsArray.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsUltrasonicsArray.aidl new file mode 100644 index 0000000000..1183ab392c --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsUltrasonicsArray.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@VintfStability +interface IEvsUltrasonicsArray { + void doneWithDataFrame(in android.hardware.automotive.evs.UltrasonicsDataFrameDesc dataFrameDesc); + android.hardware.automotive.evs.UltrasonicsArrayDesc getUltrasonicArrayInfo(); + void setMaxFramesInFlight(in int bufferCount); + void startStream(in android.hardware.automotive.evs.IEvsUltrasonicsArrayStream stream); + void stopStream(); +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsUltrasonicsArrayStream.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsUltrasonicsArrayStream.aidl new file mode 100644 index 0000000000..510b0a4692 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/IEvsUltrasonicsArrayStream.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@VintfStability +interface IEvsUltrasonicsArrayStream { + oneway void deliverDataFrame(in android.hardware.automotive.evs.UltrasonicsDataFrameDesc dataFrameDesc); + oneway void notify(in android.hardware.automotive.evs.EvsEventDesc event); +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/ParameterRange.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/ParameterRange.aidl new file mode 100644 index 0000000000..44e9b59276 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/ParameterRange.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@VintfStability +parcelable ParameterRange { + int min; + int max; + int step; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/Rotation.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/Rotation.aidl new file mode 100644 index 0000000000..91971fc5e7 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/Rotation.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@Backing(type="int") @VintfStability +enum Rotation { + ROTATION_0 = 0, + ROTATION_90 = 1, + ROTATION_180 = 2, + ROTATION_270 = 3, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/RotationQuaternion.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/RotationQuaternion.aidl new file mode 100644 index 0000000000..d9c8b6e247 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/RotationQuaternion.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@VintfStability +parcelable RotationQuaternion { + float x; + float y; + float z; + float w; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/SensorPose.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/SensorPose.aidl new file mode 100644 index 0000000000..4ead9eaf2e --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/SensorPose.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@VintfStability +parcelable SensorPose { + android.hardware.automotive.evs.RotationQuaternion rotation; + android.hardware.automotive.evs.Translation translation; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/Size.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/Size.aidl new file mode 100644 index 0000000000..aa113f7976 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/Size.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.hardware.automotive.evs; +@VintfStability +parcelable Size { + int widthInPixels = (-1) /* -1 */; + int heightInPixels = (-1) /* -1 */; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/Stream.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/Stream.aidl new file mode 100644 index 0000000000..154a693a51 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/Stream.aidl @@ -0,0 +1,45 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@VintfStability +parcelable Stream { + int id; + android.hardware.automotive.evs.StreamType streamType; + int width; + int height; + int framerate; + android.hardware.graphics.common.PixelFormat format; + android.hardware.graphics.common.BufferUsage usage; + android.hardware.automotive.evs.Rotation rotation; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/StreamType.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/StreamType.aidl new file mode 100644 index 0000000000..9819c8910b --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/StreamType.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@Backing(type="int") @VintfStability +enum StreamType { + OUTPUT = 0, + INPUT = 1, +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/Translation.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/Translation.aidl new file mode 100644 index 0000000000..488d80f479 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/Translation.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@VintfStability +parcelable Translation { + float x; + float y; + float z; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/UltrasonicSensor.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/UltrasonicSensor.aidl new file mode 100644 index 0000000000..23f81f8093 --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/UltrasonicSensor.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@VintfStability +parcelable UltrasonicSensor { + android.hardware.automotive.evs.SensorPose pose; + float maxRangeMm; + float angleOfMeasurement; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/UltrasonicsArrayDesc.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/UltrasonicsArrayDesc.aidl new file mode 100644 index 0000000000..4a988759fd --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/UltrasonicsArrayDesc.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@VintfStability +parcelable UltrasonicsArrayDesc { + @utf8InCpp String ultrasonicsArrayId; + int maxReadingsPerSensorCount; + int maxReceiversCount; + android.hardware.automotive.evs.UltrasonicSensor[] sensors; +} diff --git a/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/UltrasonicsDataFrameDesc.aidl b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/UltrasonicsDataFrameDesc.aidl new file mode 100644 index 0000000000..35ec84bdcc --- /dev/null +++ b/automotive/evs/aidl/aidl_api/android.hardware.automotive.evs/2/android/hardware/automotive/evs/UltrasonicsDataFrameDesc.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.evs; +@VintfStability +parcelable UltrasonicsDataFrameDesc { + long timestampNs; + int id; + byte[] transmittersIdList; + byte[] receiversIdList; + int[] receiversReadingsCountList; + android.hardware.common.Ashmem waveformsData; +} diff --git a/automotive/ivn_android_device/aidl/Android.bp b/automotive/ivn_android_device/aidl/Android.bp index 95a0c73a9e..9af709fd6c 100644 --- a/automotive/ivn_android_device/aidl/Android.bp +++ b/automotive/ivn_android_device/aidl/Android.bp @@ -27,7 +27,7 @@ aidl_interface { srcs: [ "android/hardware/automotive/ivn/*.aidl", ], - frozen: false, + frozen: true, stability: "vintf", backend: { cpp: { @@ -41,4 +41,11 @@ aidl_interface { ], }, }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + } diff --git a/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/.hash b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/.hash new file mode 100644 index 0000000000..58de5d69fa --- /dev/null +++ b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/.hash @@ -0,0 +1 @@ +50960edf7eaa130e8103dba62c96f62d7eac84bf diff --git a/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/ConnectProtocol.aidl b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/ConnectProtocol.aidl new file mode 100644 index 0000000000..80d7a2a2af --- /dev/null +++ b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/ConnectProtocol.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.hardware.automotive.ivn; +@Backing(type="int") @VintfStability +enum ConnectProtocol { + TCP_IP = 0, +} diff --git a/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/EndpointInfo.aidl b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/EndpointInfo.aidl new file mode 100644 index 0000000000..5693520eb5 --- /dev/null +++ b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/EndpointInfo.aidl @@ -0,0 +1,41 @@ +/* + * 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 -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.hardware.automotive.ivn; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable EndpointInfo { + android.hardware.automotive.ivn.ConnectProtocol connectProtocol; + String ipAddress; + int portNumber; + android.hardware.automotive.ivn.HardwareIdentifiers hardwareId; +} diff --git a/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/HardwareIdentifiers.aidl b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/HardwareIdentifiers.aidl new file mode 100644 index 0000000000..1a8b21de7f --- /dev/null +++ b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/HardwareIdentifiers.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.hardware.automotive.ivn; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable HardwareIdentifiers { + @nullable String brandName; + @nullable String deviceName; + @nullable String productName; + @nullable String manufacturerName; + @nullable String modelName; + @nullable String serialNumber; +} diff --git a/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/IIvnAndroidDevice.aidl b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/IIvnAndroidDevice.aidl new file mode 100644 index 0000000000..a04d829583 --- /dev/null +++ b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/IIvnAndroidDevice.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.hardware.automotive.ivn; +@VintfStability +interface IIvnAndroidDevice { + int getMyDeviceId(); + int[] getOtherDeviceIds(); + int getDeviceIdForOccupantZone(int zoneId); + android.hardware.automotive.ivn.OccupantZoneInfo[] getOccupantZonesForDevice(int androidDeviceId); + android.hardware.automotive.ivn.EndpointInfo getMyEndpointInfo(); + android.hardware.automotive.ivn.EndpointInfo getEndpointInfoForDevice(int androidDeviceId); +} diff --git a/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/OccupantType.aidl b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/OccupantType.aidl new file mode 100644 index 0000000000..6dd0c07d16 --- /dev/null +++ b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/OccupantType.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.automotive.ivn; +@Backing(type="int") @VintfStability +enum OccupantType { + DRIVER = 1, + FRONT_PASSENGER = 2, + REAR_PASSENGER = 3, +} diff --git a/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/OccupantZoneInfo.aidl b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/OccupantZoneInfo.aidl new file mode 100644 index 0000000000..41108e9c78 --- /dev/null +++ b/automotive/ivn_android_device/aidl/aidl_api/android.hardware.automotive.ivn/1/android/hardware/automotive/ivn/OccupantZoneInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.automotive.ivn; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable OccupantZoneInfo { + int zoneId; + android.hardware.automotive.ivn.OccupantType occupantType; + int seat; +} diff --git a/automotive/remoteaccess/Android.bp b/automotive/remoteaccess/Android.bp index ac04354609..7cd6f60fe9 100644 --- a/automotive/remoteaccess/Android.bp +++ b/automotive/remoteaccess/Android.bp @@ -36,4 +36,12 @@ aidl_interface { ], }, }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + frozen: true, + } diff --git a/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/1/.hash b/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/1/.hash new file mode 100644 index 0000000000..66eed7f0fa --- /dev/null +++ b/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/1/.hash @@ -0,0 +1 @@ +67d4a3a069e9240732d2945a4b5f7868f266431b diff --git a/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/1/android/hardware/automotive/remoteaccess/ApState.aidl b/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/1/android/hardware/automotive/remoteaccess/ApState.aidl new file mode 100644 index 0000000000..da4f1d4304 --- /dev/null +++ b/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/1/android/hardware/automotive/remoteaccess/ApState.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.remoteaccess; +@VintfStability +parcelable ApState { + boolean isReadyForRemoteTask; + boolean isWakeupRequired; +} diff --git a/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/1/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl b/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/1/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl new file mode 100644 index 0000000000..b0935c2fb2 --- /dev/null +++ b/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/1/android/hardware/automotive/remoteaccess/IRemoteAccess.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.remoteaccess; +@VintfStability +interface IRemoteAccess { + String getVehicleId(); + String getWakeupServiceName(); + String getProcessorId(); + void setRemoteTaskCallback(android.hardware.automotive.remoteaccess.IRemoteTaskCallback callback); + void clearRemoteTaskCallback(); + void notifyApStateChange(in android.hardware.automotive.remoteaccess.ApState state); +} diff --git a/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/1/android/hardware/automotive/remoteaccess/IRemoteTaskCallback.aidl b/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/1/android/hardware/automotive/remoteaccess/IRemoteTaskCallback.aidl new file mode 100644 index 0000000000..295100ea51 --- /dev/null +++ b/automotive/remoteaccess/aidl_api/android.hardware.automotive.remoteaccess/1/android/hardware/automotive/remoteaccess/IRemoteTaskCallback.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.remoteaccess; +@VintfStability +interface IRemoteTaskCallback { + oneway void onRemoteTaskRequested(String clientId, in byte[] data); +} diff --git a/automotive/vehicle/aidl/Android.bp b/automotive/vehicle/aidl/Android.bp index 9c8d9c5f6d..3b93bca76c 100644 --- a/automotive/vehicle/aidl/Android.bp +++ b/automotive/vehicle/aidl/Android.bp @@ -27,7 +27,7 @@ aidl_interface { srcs: [ "android/hardware/automotive/vehicle/*.aidl", ], - frozen: false, + frozen: true, stability: "vintf", backend: { cpp: { @@ -47,6 +47,11 @@ aidl_interface { version: "1", imports: [], }, + { + version: "2", + imports: [], + }, + ], } diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/.hash b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/.hash new file mode 100644 index 0000000000..b04a6b5bbd --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/.hash @@ -0,0 +1 @@ +a741c2814ba6e9852e106bc26e820d741f66ebb8 diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueRequest.aidl new file mode 100644 index 0000000000..d88cd8b076 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueRequest.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable GetValueRequest { + long requestId; + android.hardware.automotive.vehicle.VehiclePropValue prop; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueRequests.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueRequests.aidl new file mode 100644 index 0000000000..a7df2ff24d --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueRequests.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable GetValueRequests { + android.hardware.automotive.vehicle.GetValueRequest[] payloads; + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueResult.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueResult.aidl new file mode 100644 index 0000000000..25f3575862 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueResult.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable GetValueResult { + long requestId; + android.hardware.automotive.vehicle.StatusCode status = android.hardware.automotive.vehicle.StatusCode.OK; + @nullable android.hardware.automotive.vehicle.VehiclePropValue prop; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueResults.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueResults.aidl new file mode 100644 index 0000000000..4c365b1074 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/GetValueResults.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable GetValueResults { + android.hardware.automotive.vehicle.GetValueResult[] payloads; + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/IVehicle.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/IVehicle.aidl new file mode 100644 index 0000000000..b5f62aa3bf --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/IVehicle.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@VintfStability +interface IVehicle { + android.hardware.automotive.vehicle.VehiclePropConfigs getAllPropConfigs(); + android.hardware.automotive.vehicle.VehiclePropConfigs getPropConfigs(in int[] props); + void getValues(android.hardware.automotive.vehicle.IVehicleCallback callback, in android.hardware.automotive.vehicle.GetValueRequests requests); + void setValues(android.hardware.automotive.vehicle.IVehicleCallback callback, in android.hardware.automotive.vehicle.SetValueRequests requests); + void subscribe(in android.hardware.automotive.vehicle.IVehicleCallback callback, in android.hardware.automotive.vehicle.SubscribeOptions[] options, int maxSharedMemoryFileCount); + void unsubscribe(in android.hardware.automotive.vehicle.IVehicleCallback callback, in int[] propIds); + void returnSharedMemory(in android.hardware.automotive.vehicle.IVehicleCallback callback, long sharedMemoryId); + const long INVALID_MEMORY_ID = 0; + const int MAX_SHARED_MEMORY_FILES_PER_CLIENT = 3; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/IVehicleCallback.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/IVehicleCallback.aidl new file mode 100644 index 0000000000..2c5a333dde --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/IVehicleCallback.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@VintfStability +interface IVehicleCallback { + oneway void onGetValues(in android.hardware.automotive.vehicle.GetValueResults responses); + oneway void onSetValues(in android.hardware.automotive.vehicle.SetValueResults responses); + oneway void onPropertyEvent(in android.hardware.automotive.vehicle.VehiclePropValues propValues, int sharedMemoryFileCount); + oneway void onPropertySetError(in android.hardware.automotive.vehicle.VehiclePropErrors errors); +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/RawPropValues.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/RawPropValues.aidl new file mode 100644 index 0000000000..e7b0a137cf --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/RawPropValues.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable RawPropValues { + int[] int32Values = {}; + float[] floatValues; + long[] int64Values; + byte[] byteValues; + @utf8InCpp String stringValue; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueRequest.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueRequest.aidl new file mode 100644 index 0000000000..6a65307f3c --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueRequest.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SetValueRequest { + long requestId; + android.hardware.automotive.vehicle.VehiclePropValue value; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueRequests.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueRequests.aidl new file mode 100644 index 0000000000..15fd7ea8a8 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueRequests.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SetValueRequests { + android.hardware.automotive.vehicle.SetValueRequest[] payloads; + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueResult.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueResult.aidl new file mode 100644 index 0000000000..ec5fabb0b4 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueResult.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SetValueResult { + long requestId; + android.hardware.automotive.vehicle.StatusCode status = android.hardware.automotive.vehicle.StatusCode.OK; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueResults.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueResults.aidl new file mode 100644 index 0000000000..47f16563ce --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SetValueResults.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SetValueResults { + android.hardware.automotive.vehicle.SetValueResult[] payloads; + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/StatusCode.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/StatusCode.aidl new file mode 100644 index 0000000000..f7e8c5abf7 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/StatusCode.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum StatusCode { + OK = 0, + TRY_AGAIN = 1, + INVALID_ARG = 2, + NOT_AVAILABLE = 3, + ACCESS_DENIED = 4, + INTERNAL_ERROR = 5, + NOT_AVAILABLE_DISABLED = 6, + NOT_AVAILABLE_SPEED_LOW = 7, + NOT_AVAILABLE_SPEED_HIGH = 8, + NOT_AVAILABLE_POOR_VISIBILITY = 9, + NOT_AVAILABLE_SAFETY = 10, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SubscribeOptions.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SubscribeOptions.aidl new file mode 100644 index 0000000000..91e7c1499a --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/SubscribeOptions.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SubscribeOptions { + int propId; + int[] areaIds; + float sampleRate; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl new file mode 100644 index 0000000000..6960894f13 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VehicleAreaConfig { + int areaId; + int minInt32Value; + int maxInt32Value; + long minInt64Value; + long maxInt64Value; + float minFloatValue; + float maxFloatValue; + @nullable long[] supportedEnumValues; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropConfig.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropConfig.aidl new file mode 100644 index 0000000000..8602d2d03d --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropConfig.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VehiclePropConfig { + int prop; + android.hardware.automotive.vehicle.VehiclePropertyAccess access = android.hardware.automotive.vehicle.VehiclePropertyAccess.NONE; + android.hardware.automotive.vehicle.VehiclePropertyChangeMode changeMode = android.hardware.automotive.vehicle.VehiclePropertyChangeMode.STATIC; + android.hardware.automotive.vehicle.VehicleAreaConfig[] areaConfigs; + int[] configArray; + @utf8InCpp String configString; + float minSampleRate; + float maxSampleRate; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropConfigs.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropConfigs.aidl new file mode 100644 index 0000000000..04c8006983 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropConfigs.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VehiclePropConfigs { + android.hardware.automotive.vehicle.VehiclePropConfig[] payloads; + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropError.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropError.aidl new file mode 100644 index 0000000000..983529542f --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropError.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VehiclePropError { + int propId; + int areaId; + android.hardware.automotive.vehicle.StatusCode errorCode = android.hardware.automotive.vehicle.StatusCode.OK; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropErrors.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropErrors.aidl new file mode 100644 index 0000000000..9dcb10bc9e --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropErrors.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VehiclePropErrors { + android.hardware.automotive.vehicle.VehiclePropError[] payloads; + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropValue.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropValue.aidl new file mode 100644 index 0000000000..c87379fd9b --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropValue.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VehiclePropValue { + long timestamp; + int areaId; + int prop; + android.hardware.automotive.vehicle.VehiclePropertyStatus status = android.hardware.automotive.vehicle.VehiclePropertyStatus.AVAILABLE; + android.hardware.automotive.vehicle.RawPropValues value; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropValues.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropValues.aidl new file mode 100644 index 0000000000..e09a6b95df --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropValues.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VehiclePropValues { + android.hardware.automotive.vehicle.VehiclePropValue[] payloads; + long sharedMemoryId; + @nullable ParcelFileDescriptor sharedMemoryFd; +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropertyAccess.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropertyAccess.aidl new file mode 100644 index 0000000000..dde9a88fd3 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropertyAccess.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehiclePropertyAccess { + NONE = 0x00, + READ = 0x01, + WRITE = 0x02, + READ_WRITE = 0x03, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.aidl new file mode 100644 index 0000000000..2f9d107e88 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehiclePropertyChangeMode { + STATIC = 0x00, + ON_CHANGE = 0x01, + CONTINUOUS = 0x02, +} diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropertyStatus.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropertyStatus.aidl new file mode 100644 index 0000000000..642ce83f21 --- /dev/null +++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/2/android/hardware/automotive/vehicle/VehiclePropertyStatus.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehiclePropertyStatus { + AVAILABLE = 0x00, + UNAVAILABLE = 0x01, + ERROR = 0x02, +} diff --git a/automotive/vehicle/aidl_property/Android.bp b/automotive/vehicle/aidl_property/Android.bp index 58ce50d6e8..19fa4a38db 100644 --- a/automotive/vehicle/aidl_property/Android.bp +++ b/automotive/vehicle/aidl_property/Android.bp @@ -28,7 +28,7 @@ aidl_interface { // This HAL was originally part of android.hardware.automotive.vehicle "android/hardware/automotive/vehicle/*.aidl", ], - frozen: false, + frozen: true, stability: "vintf", backend: { cpp: { @@ -48,6 +48,11 @@ aidl_interface { version: "1", imports: [], }, + { + version: "2", + imports: [], + }, + ], } diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/.hash b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/.hash new file mode 100644 index 0000000000..46c03c396d --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/.hash @@ -0,0 +1 @@ +666fd8f93217775f55c3eb6ef9897cdde7e43da9 diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/AutomaticEmergencyBrakingState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/AutomaticEmergencyBrakingState.aidl new file mode 100644 index 0000000000..b316df7454 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/AutomaticEmergencyBrakingState.aidl @@ -0,0 +1,41 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum AutomaticEmergencyBrakingState { + OTHER = 0, + ENABLED = 1, + ACTIVATED = 2, + USER_OVERRIDE = 3, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/BlindSpotWarningState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/BlindSpotWarningState.aidl new file mode 100644 index 0000000000..535b0b1e2f --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/BlindSpotWarningState.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum BlindSpotWarningState { + OTHER = 0, + NO_WARNING = 1, + WARNING = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CreateUserRequest.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CreateUserRequest.aidl new file mode 100644 index 0000000000..22c690c00f --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CreateUserRequest.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable CreateUserRequest { + int requestId; + android.hardware.automotive.vehicle.UserInfo newUserInfo; + @utf8InCpp String newUserName; + android.hardware.automotive.vehicle.UsersInfo usersInfo; +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CreateUserResponse.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CreateUserResponse.aidl new file mode 100644 index 0000000000..7d0196b4e5 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CreateUserResponse.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable CreateUserResponse { + int requestId; + android.hardware.automotive.vehicle.CreateUserStatus status = android.hardware.automotive.vehicle.CreateUserStatus.SUCCESS; + @utf8InCpp String errorMessage; +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CreateUserStatus.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CreateUserStatus.aidl new file mode 100644 index 0000000000..4c3b751656 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CreateUserStatus.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum CreateUserStatus { + SUCCESS = 1, + FAILURE = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CruiseControlCommand.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CruiseControlCommand.aidl new file mode 100644 index 0000000000..d6a104d25b --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CruiseControlCommand.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum CruiseControlCommand { + ACTIVATE = 1, + SUSPEND = 2, + INCREASE_TARGET_SPEED = 3, + DECREASE_TARGET_SPEED = 4, + INCREASE_TARGET_TIME_GAP = 5, + DECREASE_TARGET_TIME_GAP = 6, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CruiseControlState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CruiseControlState.aidl new file mode 100644 index 0000000000..ddaffa30c2 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CruiseControlState.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum CruiseControlState { + OTHER = 0, + ENABLED = 1, + ACTIVATED = 2, + USER_OVERRIDE = 3, + SUSPENDED = 4, + FORCED_DEACTIVATION_WARNING = 5, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CruiseControlType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CruiseControlType.aidl new file mode 100644 index 0000000000..aab9dfe966 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CruiseControlType.aidl @@ -0,0 +1,41 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum CruiseControlType { + OTHER = 0, + STANDARD = 1, + ADAPTIVE = 2, + PREDICTIVE = 3, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CustomInputType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CustomInputType.aidl new file mode 100644 index 0000000000..4decb6985d --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/CustomInputType.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum CustomInputType { + CUSTOM_EVENT_F1 = 1001, + CUSTOM_EVENT_F2 = 1002, + CUSTOM_EVENT_F3 = 1003, + CUSTOM_EVENT_F4 = 1004, + CUSTOM_EVENT_F5 = 1005, + CUSTOM_EVENT_F6 = 1006, + CUSTOM_EVENT_F7 = 1007, + CUSTOM_EVENT_F8 = 1008, + CUSTOM_EVENT_F9 = 1009, + CUSTOM_EVENT_F10 = 1010, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl new file mode 100644 index 0000000000..9704704eab --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/DiagnosticFloatSensorIndex.aidl @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum DiagnosticFloatSensorIndex { + CALCULATED_ENGINE_LOAD = 0, + ENGINE_COOLANT_TEMPERATURE = 1, + SHORT_TERM_FUEL_TRIM_BANK1 = 2, + LONG_TERM_FUEL_TRIM_BANK1 = 3, + SHORT_TERM_FUEL_TRIM_BANK2 = 4, + LONG_TERM_FUEL_TRIM_BANK2 = 5, + FUEL_PRESSURE = 6, + INTAKE_MANIFOLD_ABSOLUTE_PRESSURE = 7, + ENGINE_RPM = 8, + VEHICLE_SPEED = 9, + TIMING_ADVANCE = 10, + MAF_AIR_FLOW_RATE = 11, + THROTTLE_POSITION = 12, + OXYGEN_SENSOR1_VOLTAGE = 13, + OXYGEN_SENSOR1_SHORT_TERM_FUEL_TRIM = 14, + OXYGEN_SENSOR1_FUEL_AIR_EQUIVALENCE_RATIO = 15, + OXYGEN_SENSOR2_VOLTAGE = 16, + OXYGEN_SENSOR2_SHORT_TERM_FUEL_TRIM = 17, + OXYGEN_SENSOR2_FUEL_AIR_EQUIVALENCE_RATIO = 18, + OXYGEN_SENSOR3_VOLTAGE = 19, + OXYGEN_SENSOR3_SHORT_TERM_FUEL_TRIM = 20, + OXYGEN_SENSOR3_FUEL_AIR_EQUIVALENCE_RATIO = 21, + OXYGEN_SENSOR4_VOLTAGE = 22, + OXYGEN_SENSOR4_SHORT_TERM_FUEL_TRIM = 23, + OXYGEN_SENSOR4_FUEL_AIR_EQUIVALENCE_RATIO = 24, + OXYGEN_SENSOR5_VOLTAGE = 25, + OXYGEN_SENSOR5_SHORT_TERM_FUEL_TRIM = 26, + OXYGEN_SENSOR5_FUEL_AIR_EQUIVALENCE_RATIO = 27, + OXYGEN_SENSOR6_VOLTAGE = 28, + OXYGEN_SENSOR6_SHORT_TERM_FUEL_TRIM = 29, + OXYGEN_SENSOR6_FUEL_AIR_EQUIVALENCE_RATIO = 30, + OXYGEN_SENSOR7_VOLTAGE = 31, + OXYGEN_SENSOR7_SHORT_TERM_FUEL_TRIM = 32, + OXYGEN_SENSOR7_FUEL_AIR_EQUIVALENCE_RATIO = 33, + OXYGEN_SENSOR8_VOLTAGE = 34, + OXYGEN_SENSOR8_SHORT_TERM_FUEL_TRIM = 35, + OXYGEN_SENSOR8_FUEL_AIR_EQUIVALENCE_RATIO = 36, + FUEL_RAIL_PRESSURE = 37, + FUEL_RAIL_GAUGE_PRESSURE = 38, + COMMANDED_EXHAUST_GAS_RECIRCULATION = 39, + EXHAUST_GAS_RECIRCULATION_ERROR = 40, + COMMANDED_EVAPORATIVE_PURGE = 41, + FUEL_TANK_LEVEL_INPUT = 42, + EVAPORATION_SYSTEM_VAPOR_PRESSURE = 43, + CATALYST_TEMPERATURE_BANK1_SENSOR1 = 44, + CATALYST_TEMPERATURE_BANK2_SENSOR1 = 45, + CATALYST_TEMPERATURE_BANK1_SENSOR2 = 46, + CATALYST_TEMPERATURE_BANK2_SENSOR2 = 47, + ABSOLUTE_LOAD_VALUE = 48, + FUEL_AIR_COMMANDED_EQUIVALENCE_RATIO = 49, + RELATIVE_THROTTLE_POSITION = 50, + ABSOLUTE_THROTTLE_POSITION_B = 51, + ABSOLUTE_THROTTLE_POSITION_C = 52, + ACCELERATOR_PEDAL_POSITION_D = 53, + ACCELERATOR_PEDAL_POSITION_E = 54, + ACCELERATOR_PEDAL_POSITION_F = 55, + COMMANDED_THROTTLE_ACTUATOR = 56, + ETHANOL_FUEL_PERCENTAGE = 57, + ABSOLUTE_EVAPORATION_SYSTEM_VAPOR_PRESSURE = 58, + SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1 = 59, + SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2 = 60, + SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3 = 61, + SHORT_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4 = 62, + LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK1 = 63, + LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK2 = 64, + LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK3 = 65, + LONG_TERM_SECONDARY_OXYGEN_SENSOR_TRIM_BANK4 = 66, + RELATIVE_ACCELERATOR_PEDAL_POSITION = 67, + HYBRID_BATTERY_PACK_REMAINING_LIFE = 68, + FUEL_INJECTION_TIMING = 69, + ENGINE_FUEL_RATE = 70, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl new file mode 100644 index 0000000000..b3f13d4263 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/DiagnosticIntegerSensorIndex.aidl @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum DiagnosticIntegerSensorIndex { + FUEL_SYSTEM_STATUS = 0, + MALFUNCTION_INDICATOR_LIGHT_ON = 1, + IGNITION_MONITORS_SUPPORTED = 2, + IGNITION_SPECIFIC_MONITORS = 3, + INTAKE_AIR_TEMPERATURE = 4, + COMMANDED_SECONDARY_AIR_STATUS = 5, + NUM_OXYGEN_SENSORS_PRESENT = 6, + RUNTIME_SINCE_ENGINE_START = 7, + DISTANCE_TRAVELED_WITH_MALFUNCTION_INDICATOR_LIGHT_ON = 8, + WARMUPS_SINCE_CODES_CLEARED = 9, + DISTANCE_TRAVELED_SINCE_CODES_CLEARED = 10, + ABSOLUTE_BAROMETRIC_PRESSURE = 11, + CONTROL_MODULE_VOLTAGE = 12, + AMBIENT_AIR_TEMPERATURE = 13, + TIME_WITH_MALFUNCTION_LIGHT_ON = 14, + TIME_SINCE_TROUBLE_CODES_CLEARED = 15, + MAX_FUEL_AIR_EQUIVALENCE_RATIO = 16, + MAX_OXYGEN_SENSOR_VOLTAGE = 17, + MAX_OXYGEN_SENSOR_CURRENT = 18, + MAX_INTAKE_MANIFOLD_ABSOLUTE_PRESSURE = 19, + MAX_AIR_FLOW_RATE_FROM_MASS_AIR_FLOW_SENSOR = 20, + FUEL_TYPE = 21, + FUEL_RAIL_ABSOLUTE_PRESSURE = 22, + ENGINE_OIL_TEMPERATURE = 23, + DRIVER_DEMAND_PERCENT_TORQUE = 24, + ENGINE_ACTUAL_PERCENT_TORQUE = 25, + ENGINE_REFERENCE_PERCENT_TORQUE = 26, + ENGINE_PERCENT_TORQUE_DATA_IDLE = 27, + ENGINE_PERCENT_TORQUE_DATA_POINT1 = 28, + ENGINE_PERCENT_TORQUE_DATA_POINT2 = 29, + ENGINE_PERCENT_TORQUE_DATA_POINT3 = 30, + ENGINE_PERCENT_TORQUE_DATA_POINT4 = 31, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl new file mode 100644 index 0000000000..9772aeeba0 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/ElectronicTollCollectionCardStatus.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum ElectronicTollCollectionCardStatus { + UNKNOWN = 0, + ELECTRONIC_TOLL_COLLECTION_CARD_VALID = 1, + ELECTRONIC_TOLL_COLLECTION_CARD_INVALID = 2, + ELECTRONIC_TOLL_COLLECTION_CARD_NOT_INSERTED = 3, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl new file mode 100644 index 0000000000..22cf2c388b --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/ElectronicTollCollectionCardType.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum ElectronicTollCollectionCardType { + UNKNOWN = 0, + JP_ELECTRONIC_TOLL_COLLECTION_CARD = 1, + JP_ELECTRONIC_TOLL_COLLECTION_CARD_V2 = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EmergencyLaneKeepAssistState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EmergencyLaneKeepAssistState.aidl new file mode 100644 index 0000000000..078acde168 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EmergencyLaneKeepAssistState.aidl @@ -0,0 +1,44 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum EmergencyLaneKeepAssistState { + OTHER = 0, + ENABLED = 1, + WARNING_LEFT = 2, + WARNING_RIGHT = 3, + ACTIVATED_STEER_LEFT = 4, + ACTIVATED_STEER_RIGHT = 5, + USER_OVERRIDE = 6, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/ErrorState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/ErrorState.aidl new file mode 100644 index 0000000000..dd950ce88c --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/ErrorState.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum ErrorState { + OTHER_ERROR_STATE = (-1) /* -1 */, + NOT_AVAILABLE_DISABLED = (-2) /* -2 */, + NOT_AVAILABLE_SPEED_LOW = (-3) /* -3 */, + NOT_AVAILABLE_SPEED_HIGH = (-4) /* -4 */, + NOT_AVAILABLE_POOR_VISIBILITY = (-5) /* -5 */, + NOT_AVAILABLE_SAFETY = (-6) /* -6 */, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvChargeState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvChargeState.aidl new file mode 100644 index 0000000000..fe1c240a2d --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvChargeState.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum EvChargeState { + UNKNOWN = 0, + CHARGING = 1, + FULLY_CHARGED = 2, + NOT_CHARGING = 3, + ERROR = 4, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvConnectorType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvConnectorType.aidl new file mode 100644 index 0000000000..b469578e77 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvConnectorType.aidl @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum EvConnectorType { + UNKNOWN = 0, + IEC_TYPE_1_AC = 1, + IEC_TYPE_2_AC = 2, + IEC_TYPE_3_AC = 3, + IEC_TYPE_4_DC = 4, + IEC_TYPE_1_CCS_DC = 5, + IEC_TYPE_2_CCS_DC = 6, + TESLA_ROADSTER = 7, + TESLA_HPWC = 8, + TESLA_SUPERCHARGER = 9, + GBT_AC = 10, + GBT_DC = 11, + OTHER = 101, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl new file mode 100644 index 0000000000..b8695623fb --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvRegenerativeBrakingState.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum EvRegenerativeBrakingState { + UNKNOWN = 0, + DISABLED = 1, + PARTIALLY_ENABLED = 2, + FULLY_ENABLED = 3, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvStoppingMode.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvStoppingMode.aidl new file mode 100644 index 0000000000..3be8d1263f --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvStoppingMode.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum EvStoppingMode { + OTHER = 0, + CREEP = 1, + ROLL = 2, + HOLD = 3, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl new file mode 100644 index 0000000000..2fdb9b5a8d --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvsServiceRequestIndex.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum EvsServiceRequestIndex { + TYPE = 0, + STATE = 1, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvsServiceState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvsServiceState.aidl new file mode 100644 index 0000000000..df81ee7d27 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvsServiceState.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum EvsServiceState { + OFF = 0, + ON = 1, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvsServiceType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvsServiceType.aidl new file mode 100644 index 0000000000..285732cc39 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/EvsServiceType.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum EvsServiceType { + REARVIEW = 0, + SURROUNDVIEW = 1, + FRONTVIEW = 2, + LEFTVIEW = 3, + RIGHTVIEW = 4, + DRIVERVIEW = 5, + FRONTPASSENGERSVIEW = 6, + REARPASSENGERSVIEW = 7, + USER_DEFINED = 1000, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl new file mode 100644 index 0000000000..371885d3b5 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum ForwardCollisionWarningState { + OTHER = 0, + NO_WARNING = 1, + WARNING = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/FuelType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/FuelType.aidl new file mode 100644 index 0000000000..14bb61b7af --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/FuelType.aidl @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum FuelType { + FUEL_TYPE_UNKNOWN = 0, + FUEL_TYPE_UNLEADED = 1, + FUEL_TYPE_LEADED = 2, + FUEL_TYPE_DIESEL_1 = 3, + FUEL_TYPE_DIESEL_2 = 4, + FUEL_TYPE_BIODIESEL = 5, + FUEL_TYPE_E85 = 6, + FUEL_TYPE_LPG = 7, + FUEL_TYPE_CNG = 8, + FUEL_TYPE_LNG = 9, + FUEL_TYPE_ELECTRIC = 10, + FUEL_TYPE_HYDROGEN = 11, + FUEL_TYPE_OTHER = 12, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl new file mode 100644 index 0000000000..9c565ee818 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/GsrComplianceRequirementType.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum GsrComplianceRequirementType { + GSR_COMPLIANCE_NOT_REQUIRED = 0, + GSR_COMPLIANCE_REQUIRED_V1 = 1, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/HandsOnDetectionDriverState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/HandsOnDetectionDriverState.aidl new file mode 100644 index 0000000000..bb390f2224 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/HandsOnDetectionDriverState.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum HandsOnDetectionDriverState { + OTHER = 0, + HANDS_ON = 1, + HANDS_OFF = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/HandsOnDetectionWarning.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/HandsOnDetectionWarning.aidl new file mode 100644 index 0000000000..4ea4d1d450 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/HandsOnDetectionWarning.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum HandsOnDetectionWarning { + OTHER = 0, + NO_WARNING = 1, + WARNING = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl new file mode 100644 index 0000000000..a4c048aadb --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/InitialUserInfoRequest.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable InitialUserInfoRequest { + int requestId; + android.hardware.automotive.vehicle.InitialUserInfoRequestType requestType = android.hardware.automotive.vehicle.InitialUserInfoRequestType.UNKNOWN; + android.hardware.automotive.vehicle.UsersInfo usersInfo; +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl new file mode 100644 index 0000000000..51260fa7b0 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/InitialUserInfoRequestType.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum InitialUserInfoRequestType { + UNKNOWN = 0, + FIRST_BOOT = 1, + FIRST_BOOT_AFTER_OTA = 2, + COLD_BOOT = 3, + RESUME = 4, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl new file mode 100644 index 0000000000..f0e161261d --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/InitialUserInfoResponse.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable InitialUserInfoResponse { + int requestId; + android.hardware.automotive.vehicle.InitialUserInfoResponseAction action = android.hardware.automotive.vehicle.InitialUserInfoResponseAction.DEFAULT; + android.hardware.automotive.vehicle.UserInfo userToSwitchOrCreate; + @utf8InCpp String userLocales; + @utf8InCpp String userNameToCreate; +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl new file mode 100644 index 0000000000..d654b5c23e --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/InitialUserInfoResponseAction.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum InitialUserInfoResponseAction { + DEFAULT = 0, + SWITCH = 1, + CREATE = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/LaneCenteringAssistCommand.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/LaneCenteringAssistCommand.aidl new file mode 100644 index 0000000000..9e726052e8 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/LaneCenteringAssistCommand.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum LaneCenteringAssistCommand { + ACTIVATE = 1, + DEACTIVATE = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/LaneCenteringAssistState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/LaneCenteringAssistState.aidl new file mode 100644 index 0000000000..c5afe2be1a --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/LaneCenteringAssistState.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum LaneCenteringAssistState { + OTHER = 0, + ENABLED = 1, + ACTIVATION_REQUESTED = 2, + ACTIVATED = 3, + USER_OVERRIDE = 4, + FORCED_DEACTIVATION_WARNING = 5, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/LaneDepartureWarningState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/LaneDepartureWarningState.aidl new file mode 100644 index 0000000000..cdddb6f2d2 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/LaneDepartureWarningState.aidl @@ -0,0 +1,41 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum LaneDepartureWarningState { + OTHER = 0, + NO_WARNING = 1, + WARNING_LEFT = 2, + WARNING_RIGHT = 3, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/LaneKeepAssistState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/LaneKeepAssistState.aidl new file mode 100644 index 0000000000..9c92ff69c5 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/LaneKeepAssistState.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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum LaneKeepAssistState { + OTHER = 0, + ENABLED = 1, + ACTIVATED_STEER_LEFT = 2, + ACTIVATED_STEER_RIGHT = 3, + USER_OVERRIDE = 4, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/LocationCharacterization.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/LocationCharacterization.aidl new file mode 100644 index 0000000000..27abe417dc --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/LocationCharacterization.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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum LocationCharacterization { + PRIOR_LOCATIONS = 0x1, + GYROSCOPE_FUSION = 0x2, + ACCELEROMETER_FUSION = 0x4, + COMPASS_FUSION = 0x8, + WHEEL_SPEED_FUSION = 0x10, + STEERING_ANGLE_FUSION = 0x20, + CAR_SPEED_FUSION = 0x40, + DEAD_RECKONED = 0x80, + RAW_GNSS_ONLY = 0x100, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl new file mode 100644 index 0000000000..7d122241eb --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2CommonIgnitionMonitors.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum Obd2CommonIgnitionMonitors { + COMPONENTS_AVAILABLE = (0x1 << 0) /* 1 */, + COMPONENTS_INCOMPLETE = (0x1 << 1) /* 2 */, + FUEL_SYSTEM_AVAILABLE = (0x1 << 2) /* 4 */, + FUEL_SYSTEM_INCOMPLETE = (0x1 << 3) /* 8 */, + MISFIRE_AVAILABLE = (0x1 << 4) /* 16 */, + MISFIRE_INCOMPLETE = (0x1 << 5) /* 32 */, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl new file mode 100644 index 0000000000..90240bf4bf --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2CompressionIgnitionMonitors.aidl @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum Obd2CompressionIgnitionMonitors { + COMPONENTS_AVAILABLE = (0x1 << 0) /* 1 */, + COMPONENTS_INCOMPLETE = (0x1 << 1) /* 2 */, + FUEL_SYSTEM_AVAILABLE = (0x1 << 2) /* 4 */, + FUEL_SYSTEM_INCOMPLETE = (0x1 << 3) /* 8 */, + MISFIRE_AVAILABLE = (0x1 << 4) /* 16 */, + MISFIRE_INCOMPLETE = (0x1 << 5) /* 32 */, + EGR_OR_VVT_AVAILABLE = (0x1 << 6) /* 64 */, + EGR_OR_VVT_INCOMPLETE = (0x1 << 7) /* 128 */, + PM_FILTER_AVAILABLE = (0x1 << 8) /* 256 */, + PM_FILTER_INCOMPLETE = (0x1 << 9) /* 512 */, + EXHAUST_GAS_SENSOR_AVAILABLE = (0x1 << 10) /* 1024 */, + EXHAUST_GAS_SENSOR_INCOMPLETE = (0x1 << 11) /* 2048 */, + BOOST_PRESSURE_AVAILABLE = (0x1 << 12) /* 4096 */, + BOOST_PRESSURE_INCOMPLETE = (0x1 << 13) /* 8192 */, + NOx_SCR_AVAILABLE = (0x1 << 14) /* 16384 */, + NOx_SCR_INCOMPLETE = (0x1 << 15) /* 32768 */, + NMHC_CATALYST_AVAILABLE = (0x1 << 16) /* 65536 */, + NMHC_CATALYST_INCOMPLETE = (0x1 << 17) /* 131072 */, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl new file mode 100644 index 0000000000..9d588ead1c --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2FuelSystemStatus.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum Obd2FuelSystemStatus { + OPEN_INSUFFICIENT_ENGINE_TEMPERATURE = 1, + CLOSED_LOOP = 2, + OPEN_ENGINE_LOAD_OR_DECELERATION = 4, + OPEN_SYSTEM_FAILURE = 8, + CLOSED_LOOP_BUT_FEEDBACK_FAULT = 16, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2FuelType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2FuelType.aidl new file mode 100644 index 0000000000..3ab3920d04 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2FuelType.aidl @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum Obd2FuelType { + NOT_AVAILABLE = 0, + GASOLINE = 1, + METHANOL = 2, + ETHANOL = 3, + DIESEL = 4, + LPG = 5, + CNG = 6, + PROPANE = 7, + ELECTRIC = 8, + BIFUEL_RUNNING_GASOLINE = 9, + BIFUEL_RUNNING_METHANOL = 10, + BIFUEL_RUNNING_ETHANOL = 11, + BIFUEL_RUNNING_LPG = 12, + BIFUEL_RUNNING_CNG = 13, + BIFUEL_RUNNING_PROPANE = 14, + BIFUEL_RUNNING_ELECTRIC = 15, + BIFUEL_RUNNING_ELECTRIC_AND_COMBUSTION = 16, + HYBRID_GASOLINE = 17, + HYBRID_ETHANOL = 18, + HYBRID_DIESEL = 19, + HYBRID_ELECTRIC = 20, + HYBRID_RUNNING_ELECTRIC_AND_COMBUSTION = 21, + HYBRID_REGENERATIVE = 22, + BIFUEL_RUNNING_DIESEL = 23, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl new file mode 100644 index 0000000000..ec8f1c2e57 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2IgnitionMonitorKind.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum Obd2IgnitionMonitorKind { + SPARK = 0, + COMPRESSION = 1, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl new file mode 100644 index 0000000000..7f445bf564 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2SecondaryAirStatus.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum Obd2SecondaryAirStatus { + UPSTREAM = 1, + DOWNSTREAM_OF_CATALYCIC_CONVERTER = 2, + FROM_OUTSIDE_OR_OFF = 4, + PUMP_ON_FOR_DIAGNOSTICS = 8, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl new file mode 100644 index 0000000000..51e321b828 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/Obd2SparkIgnitionMonitors.aidl @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum Obd2SparkIgnitionMonitors { + COMPONENTS_AVAILABLE = (0x1 << 0) /* 1 */, + COMPONENTS_INCOMPLETE = (0x1 << 1) /* 2 */, + FUEL_SYSTEM_AVAILABLE = (0x1 << 2) /* 4 */, + FUEL_SYSTEM_INCOMPLETE = (0x1 << 3) /* 8 */, + MISFIRE_AVAILABLE = (0x1 << 4) /* 16 */, + MISFIRE_INCOMPLETE = (0x1 << 5) /* 32 */, + EGR_AVAILABLE = (0x1 << 6) /* 64 */, + EGR_INCOMPLETE = (0x1 << 7) /* 128 */, + OXYGEN_SENSOR_HEATER_AVAILABLE = (0x1 << 8) /* 256 */, + OXYGEN_SENSOR_HEATER_INCOMPLETE = (0x1 << 9) /* 512 */, + OXYGEN_SENSOR_AVAILABLE = (0x1 << 10) /* 1024 */, + OXYGEN_SENSOR_INCOMPLETE = (0x1 << 11) /* 2048 */, + AC_REFRIGERANT_AVAILABLE = (0x1 << 12) /* 4096 */, + AC_REFRIGERANT_INCOMPLETE = (0x1 << 13) /* 8192 */, + SECONDARY_AIR_SYSTEM_AVAILABLE = (0x1 << 14) /* 16384 */, + SECONDARY_AIR_SYSTEM_INCOMPLETE = (0x1 << 15) /* 32768 */, + EVAPORATIVE_SYSTEM_AVAILABLE = (0x1 << 16) /* 65536 */, + EVAPORATIVE_SYSTEM_INCOMPLETE = (0x1 << 17) /* 131072 */, + HEATED_CATALYST_AVAILABLE = (0x1 << 18) /* 262144 */, + HEATED_CATALYST_INCOMPLETE = (0x1 << 19) /* 524288 */, + CATALYST_AVAILABLE = (0x1 << 20) /* 1048576 */, + CATALYST_INCOMPLETE = (0x1 << 21) /* 2097152 */, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/PortLocationType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/PortLocationType.aidl new file mode 100644 index 0000000000..b831c7ebd9 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/PortLocationType.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum PortLocationType { + UNKNOWN = 0, + FRONT_LEFT = 1, + FRONT_RIGHT = 2, + REAR_RIGHT = 3, + REAR_LEFT = 4, + FRONT = 5, + REAR = 6, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl new file mode 100644 index 0000000000..f2838ad818 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/ProcessTerminationReason.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum ProcessTerminationReason { + NOT_RESPONDING = 1, + IO_OVERUSE = 2, + MEMORY_OVERUSE = 3, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/RemoveUserRequest.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/RemoveUserRequest.aidl new file mode 100644 index 0000000000..74457b9ab7 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/RemoveUserRequest.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable RemoveUserRequest { + int requestId; + android.hardware.automotive.vehicle.UserInfo removedUserInfo; + android.hardware.automotive.vehicle.UsersInfo usersInfo; +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/RotaryInputType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/RotaryInputType.aidl new file mode 100644 index 0000000000..ff90034711 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/RotaryInputType.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum RotaryInputType { + ROTARY_INPUT_TYPE_SYSTEM_NAVIGATION = 0, + ROTARY_INPUT_TYPE_AUDIO_VOLUME = 1, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl new file mode 100644 index 0000000000..a3e59f128d --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/SwitchUserMessageType.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum SwitchUserMessageType { + UNKNOWN = 0, + LEGACY_ANDROID_SWITCH = 1, + ANDROID_SWITCH = 2, + VEHICLE_RESPONSE = 3, + VEHICLE_REQUEST = 4, + ANDROID_POST_SWITCH = 5, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/SwitchUserRequest.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/SwitchUserRequest.aidl new file mode 100644 index 0000000000..3012b7a51d --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/SwitchUserRequest.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SwitchUserRequest { + int requestId; + android.hardware.automotive.vehicle.SwitchUserMessageType messageType = android.hardware.automotive.vehicle.SwitchUserMessageType.UNKNOWN; + android.hardware.automotive.vehicle.UserInfo targetUser; + android.hardware.automotive.vehicle.UsersInfo usersInfo; +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/SwitchUserResponse.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/SwitchUserResponse.aidl new file mode 100644 index 0000000000..8915d1b866 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/SwitchUserResponse.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable SwitchUserResponse { + int requestId; + android.hardware.automotive.vehicle.SwitchUserMessageType messageType = android.hardware.automotive.vehicle.SwitchUserMessageType.UNKNOWN; + android.hardware.automotive.vehicle.SwitchUserStatus status = android.hardware.automotive.vehicle.SwitchUserStatus.SUCCESS; + @utf8InCpp String errorMessage; +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/SwitchUserStatus.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/SwitchUserStatus.aidl new file mode 100644 index 0000000000..c7be9ec949 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/SwitchUserStatus.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum SwitchUserStatus { + SUCCESS = 1, + FAILURE = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/TrailerState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/TrailerState.aidl new file mode 100644 index 0000000000..2491340acd --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/TrailerState.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum TrailerState { + UNKNOWN = 0, + NOT_PRESENT = 1, + PRESENT = 2, + ERROR = 3, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl new file mode 100644 index 0000000000..a540f8ead8 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationAssociation.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable UserIdentificationAssociation { + android.hardware.automotive.vehicle.UserIdentificationAssociationType type = android.hardware.automotive.vehicle.UserIdentificationAssociationType.INVALID; + android.hardware.automotive.vehicle.UserIdentificationAssociationValue value = android.hardware.automotive.vehicle.UserIdentificationAssociationValue.UNKNOWN; +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl new file mode 100644 index 0000000000..1fd9ee8c31 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationAssociationSetValue.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum UserIdentificationAssociationSetValue { + INVALID = 0, + ASSOCIATE_CURRENT_USER = 1, + DISASSOCIATE_CURRENT_USER = 2, + DISASSOCIATE_ALL_USERS = 3, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl new file mode 100644 index 0000000000..6498375b0f --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationAssociationType.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum UserIdentificationAssociationType { + INVALID = 0, + KEY_FOB = 1, + CUSTOM_1 = 101, + CUSTOM_2 = 102, + CUSTOM_3 = 103, + CUSTOM_4 = 104, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl new file mode 100644 index 0000000000..d5e01691fa --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationAssociationValue.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum UserIdentificationAssociationValue { + UNKNOWN = 1, + ASSOCIATED_CURRENT_USER = 2, + ASSOCIATED_ANOTHER_USER = 3, + NOT_ASSOCIATED_ANY_USER = 4, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl new file mode 100644 index 0000000000..fe7fd6f6bc --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationGetRequest.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable UserIdentificationGetRequest { + int requestId; + android.hardware.automotive.vehicle.UserInfo userInfo; + int numberAssociationTypes; + android.hardware.automotive.vehicle.UserIdentificationAssociationType[] associationTypes; +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl new file mode 100644 index 0000000000..3e2a2579cc --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationResponse.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable UserIdentificationResponse { + int requestId; + int numberAssociation; + android.hardware.automotive.vehicle.UserIdentificationAssociation[] associations; + @utf8InCpp String errorMessage; +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl new file mode 100644 index 0000000000..57840fb77c --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationSetAssociation.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable UserIdentificationSetAssociation { + android.hardware.automotive.vehicle.UserIdentificationAssociationType type = android.hardware.automotive.vehicle.UserIdentificationAssociationType.INVALID; + android.hardware.automotive.vehicle.UserIdentificationAssociationSetValue value = android.hardware.automotive.vehicle.UserIdentificationAssociationSetValue.INVALID; +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl new file mode 100644 index 0000000000..db01b515a8 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserIdentificationSetRequest.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable UserIdentificationSetRequest { + int requestId; + android.hardware.automotive.vehicle.UserInfo userInfo; + int numberAssociations; + android.hardware.automotive.vehicle.UserIdentificationSetAssociation[] associations; +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserInfo.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserInfo.aidl new file mode 100644 index 0000000000..feb5a73ed4 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UserInfo.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable UserInfo { + int userId = 0; + int flags; + const int USER_FLAG_SYSTEM = 0x01; + const int USER_FLAG_GUEST = 0x02; + const int USER_FLAG_EPHEMERAL = 0x04; + const int USER_FLAG_ADMIN = 0x08; + const int USER_FLAG_DISABLED = 0x10; + const int USER_FLAG_PROFILE = 0x20; +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UsersInfo.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UsersInfo.aidl new file mode 100644 index 0000000000..edcef2edfd --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/UsersInfo.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable UsersInfo { + android.hardware.automotive.vehicle.UserInfo currentUser; + int numberUsers; + android.hardware.automotive.vehicle.UserInfo[] existingUsers; +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerBootupReason.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerBootupReason.aidl new file mode 100644 index 0000000000..9720aca787 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerBootupReason.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleApPowerBootupReason { + USER_POWER_ON = 0, + SYSTEM_USER_DETECTION = 1, + SYSTEM_REMOTE_ACCESS = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl new file mode 100644 index 0000000000..cc12490233 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleApPowerStateConfigFlag { + ENABLE_DEEP_SLEEP_FLAG = 0x1, + CONFIG_SUPPORT_TIMER_POWER_ON_FLAG = 0x2, + ENABLE_HIBERNATION_FLAG = 0x4, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl new file mode 100644 index 0000000000..e4f7e54f75 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerStateReport.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleApPowerStateReport { + WAIT_FOR_VHAL = 0x1, + DEEP_SLEEP_ENTRY = 0x2, + DEEP_SLEEP_EXIT = 0x3, + SHUTDOWN_POSTPONE = 0x4, + SHUTDOWN_START = 0x5, + ON = 0x6, + SHUTDOWN_PREPARE = 0x7, + SHUTDOWN_CANCELLED = 0x8, + HIBERNATION_ENTRY = 0x9, + HIBERNATION_EXIT = 0xA, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl new file mode 100644 index 0000000000..8b94d31598 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerStateReq.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleApPowerStateReq { + ON = 0, + SHUTDOWN_PREPARE = 1, + CANCEL_SHUTDOWN = 2, + FINISHED = 3, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl new file mode 100644 index 0000000000..f995c73ee5 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerStateReqIndex.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleApPowerStateReqIndex { + STATE = 0, + ADDITIONAL = 1, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl new file mode 100644 index 0000000000..3fde1c7869 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleApPowerStateShutdownParam { + SHUTDOWN_IMMEDIATELY = 1, + CAN_SLEEP = 2, + SHUTDOWN_ONLY = 3, + SLEEP_IMMEDIATELY = 4, + HIBERNATE_IMMEDIATELY = 5, + CAN_HIBERNATE = 6, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleArea.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleArea.aidl new file mode 100644 index 0000000000..db867f4cc1 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleArea.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleArea { + GLOBAL = 0x01000000, + WINDOW = 0x03000000, + MIRROR = 0x04000000, + SEAT = 0x05000000, + DOOR = 0x06000000, + WHEEL = 0x07000000, + MASK = 0x0f000000, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl new file mode 100644 index 0000000000..04976d631d --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleAreaDoor.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleAreaDoor { + ROW_1_LEFT = 0x00000001, + ROW_1_RIGHT = 0x00000004, + ROW_2_LEFT = 0x00000010, + ROW_2_RIGHT = 0x00000040, + ROW_3_LEFT = 0x00000100, + ROW_3_RIGHT = 0x00000400, + HOOD = 0x10000000, + REAR = 0x20000000, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl new file mode 100644 index 0000000000..2d1c0483a2 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleAreaMirror.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleAreaMirror { + DRIVER_LEFT = 0x00000001, + DRIVER_RIGHT = 0x00000002, + DRIVER_CENTER = 0x00000004, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl new file mode 100644 index 0000000000..44c9d54567 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleAreaSeat.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleAreaSeat { + ROW_1_LEFT = 0x0001, + ROW_1_CENTER = 0x0002, + ROW_1_RIGHT = 0x0004, + ROW_2_LEFT = 0x0010, + ROW_2_CENTER = 0x0020, + ROW_2_RIGHT = 0x0040, + ROW_3_LEFT = 0x0100, + ROW_3_CENTER = 0x0200, + ROW_3_RIGHT = 0x0400, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl new file mode 100644 index 0000000000..d1b314e0ac --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleAreaWheel.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleAreaWheel { + UNKNOWN = 0x0, + LEFT_FRONT = 0x1, + RIGHT_FRONT = 0x2, + LEFT_REAR = 0x4, + RIGHT_REAR = 0x8, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl new file mode 100644 index 0000000000..2afcca3dd1 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleAreaWindow.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleAreaWindow { + FRONT_WINDSHIELD = 0x00000001, + REAR_WINDSHIELD = 0x00000002, + ROW_1_LEFT = 0x00000010, + ROW_1_RIGHT = 0x00000040, + ROW_2_LEFT = 0x00000100, + ROW_2_RIGHT = 0x00000400, + ROW_3_LEFT = 0x00001000, + ROW_3_RIGHT = 0x00004000, + ROOF_TOP_1 = 0x00010000, + ROOF_TOP_2 = 0x00020000, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleDisplay.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleDisplay.aidl new file mode 100644 index 0000000000..be335ec7e7 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleDisplay.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleDisplay { + MAIN = 0, + INSTRUMENT_CLUSTER = 1, + HUD = 2, + INPUT = 3, + AUXILIARY = 4, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleGear.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleGear.aidl new file mode 100644 index 0000000000..b8a299c41a --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleGear.aidl @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleGear { + GEAR_UNKNOWN = 0x0000, + GEAR_NEUTRAL = 0x0001, + GEAR_REVERSE = 0x0002, + GEAR_PARK = 0x0004, + GEAR_DRIVE = 0x0008, + GEAR_1 = 0x0010, + GEAR_2 = 0x0020, + GEAR_3 = 0x0040, + GEAR_4 = 0x0080, + GEAR_5 = 0x0100, + GEAR_6 = 0x0200, + GEAR_7 = 0x0400, + GEAR_8 = 0x0800, + GEAR_9 = 0x1000, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl new file mode 100644 index 0000000000..4f9870a674 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHvacFanDirection.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleHvacFanDirection { + UNKNOWN = 0x0, + FACE = 0x1, + FLOOR = 0x2, + FACE_AND_FLOOR = 0x3, + DEFROST = 0x4, + DEFROST_AND_FLOOR = 0x06, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl new file mode 100644 index 0000000000..c4ac002067 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHwKeyInputAction.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleHwKeyInputAction { + ACTION_DOWN = 0, + ACTION_UP = 1, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl new file mode 100644 index 0000000000..29c5ed6f6e --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHwMotionButtonStateFlag.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleHwMotionButtonStateFlag { + BUTTON_PRIMARY = 0x0001, + BUTTON_SECONDARY = 0x0002, + BUTTON_TERTIARY = 0x0004, + BUTTON_BACK = 0x0008, + BUTTON_FORWARD = 0x0010, + BUTTON_STYLUS_PRIMARY = 0x0020, + BUTTON_STYLUS_SECONDARY = 0x0040, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHwMotionInputAction.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHwMotionInputAction.aidl new file mode 100644 index 0000000000..db4b41eb9d --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHwMotionInputAction.aidl @@ -0,0 +1,50 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleHwMotionInputAction { + ACTION_DOWN = 0, + ACTION_UP = 1, + ACTION_MOVE = 2, + ACTION_CANCEL = 3, + ACTION_OUTSIDE = 4, + ACTION_POINTER_DOWN = 5, + ACTION_POINTER_UP = 6, + ACTION_HOVER_MOVE = 7, + ACTION_SCROLL = 8, + ACTION_HOVER_ENTER = 9, + ACTION_HOVER_EXIT = 10, + ACTION_BUTTON_PRESS = 11, + ACTION_BUTTON_RELEASE = 12, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHwMotionInputSource.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHwMotionInputSource.aidl new file mode 100644 index 0000000000..88c7873a43 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHwMotionInputSource.aidl @@ -0,0 +1,53 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleHwMotionInputSource { + SOURCE_UNKNOWN = 0, + SOURCE_KEYBOARD = 1, + SOURCE_DPAD = 2, + SOURCE_GAMEPAD = 3, + SOURCE_TOUCHSCREEN = 4, + SOURCE_MOUSE = 5, + SOURCE_STYLUS = 6, + SOURCE_BLUETOOTH_STYLUS = 7, + SOURCE_TRACKBALL = 8, + SOURCE_MOUSE_RELATIVE = 9, + SOURCE_TOUCHPAD = 10, + SOURCE_TOUCH_NAVIGATION = 11, + SOURCE_ROTARY_ENCODER = 12, + SOURCE_JOYSTICK = 13, + SOURCE_HDMI = 14, + SOURCE_SENSOR = 15, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHwMotionToolType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHwMotionToolType.aidl new file mode 100644 index 0000000000..2b3bc7f157 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleHwMotionToolType.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleHwMotionToolType { + TOOL_TYPE_UNKNOWN = 0, + TOOL_TYPE_FINGER = 1, + TOOL_TYPE_STYLUS = 2, + TOOL_TYPE_MOUSE = 3, + TOOL_TYPE_ERASER = 4, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl new file mode 100644 index 0000000000..f572a128bb --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleIgnitionState.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleIgnitionState { + UNDEFINED = 0, + LOCK = 1, + OFF, + ACC, + ON, + START, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleLightState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleLightState.aidl new file mode 100644 index 0000000000..d569851407 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleLightState.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleLightState { + OFF = 0, + ON = 1, + DAYTIME_RUNNING = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl new file mode 100644 index 0000000000..f244884f98 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleLightSwitch.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleLightSwitch { + OFF = 0, + ON = 1, + DAYTIME_RUNNING = 2, + AUTOMATIC = 0x100, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleOilLevel.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleOilLevel.aidl new file mode 100644 index 0000000000..f2eb5aa913 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleOilLevel.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleOilLevel { + CRITICALLY_LOW = 0, + LOW = 1, + NORMAL = 2, + HIGH = 3, + ERROR = 4, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleProperty.aidl new file mode 100644 index 0000000000..ba75e7b261 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -0,0 +1,273 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleProperty { + INVALID = 0x00000000, + INFO_VIN = (((0x0100 + 0x10000000) + 0x01000000) + 0x00100000) /* 286261504 */, + INFO_MAKE = (((0x0101 + 0x10000000) + 0x01000000) + 0x00100000) /* 286261505 */, + INFO_MODEL = (((0x0102 + 0x10000000) + 0x01000000) + 0x00100000) /* 286261506 */, + INFO_MODEL_YEAR = (((0x0103 + 0x10000000) + 0x01000000) + 0x00400000) /* 289407235 */, + INFO_FUEL_CAPACITY = (((0x0104 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504388 */, + INFO_FUEL_TYPE = (((0x0105 + 0x10000000) + 0x01000000) + 0x00410000) /* 289472773 */, + INFO_EV_BATTERY_CAPACITY = (((0x0106 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504390 */, + INFO_EV_CONNECTOR_TYPE = (((0x0107 + 0x10000000) + 0x01000000) + 0x00410000) /* 289472775 */, + INFO_FUEL_DOOR_LOCATION = (((0x0108 + 0x10000000) + 0x01000000) + 0x00400000) /* 289407240 */, + INFO_EV_PORT_LOCATION = (((0x0109 + 0x10000000) + 0x01000000) + 0x00400000) /* 289407241 */, + INFO_DRIVER_SEAT = (((0x010A + 0x10000000) + 0x05000000) + 0x00400000) /* 356516106 */, + INFO_EXTERIOR_DIMENSIONS = (((0x010B + 0x10000000) + 0x01000000) + 0x00410000) /* 289472779 */, + INFO_MULTI_EV_PORT_LOCATIONS = (((0x010C + 0x10000000) + 0x01000000) + 0x00410000) /* 289472780 */, + PERF_ODOMETER = (((0x0204 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504644 */, + PERF_VEHICLE_SPEED = (((0x0207 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504647 */, + PERF_VEHICLE_SPEED_DISPLAY = (((0x0208 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504648 */, + PERF_STEERING_ANGLE = (((0x0209 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504649 */, + PERF_REAR_STEERING_ANGLE = (((0x0210 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504656 */, + ENGINE_COOLANT_TEMP = (((0x0301 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504897 */, + ENGINE_OIL_LEVEL = (((0x0303 + 0x10000000) + 0x01000000) + 0x00400000) /* 289407747 */, + ENGINE_OIL_TEMP = (((0x0304 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504900 */, + ENGINE_RPM = (((0x0305 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504901 */, + WHEEL_TICK = (((0x0306 + 0x10000000) + 0x01000000) + 0x00510000) /* 290521862 */, + FUEL_LEVEL = (((0x0307 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504903 */, + FUEL_DOOR_OPEN = (((0x0308 + 0x10000000) + 0x01000000) + 0x00200000) /* 287310600 */, + EV_BATTERY_LEVEL = (((0x0309 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504905 */, + EV_CURRENT_BATTERY_CAPACITY = (((0x030D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.FLOAT) /* 291504909 */, + EV_CHARGE_PORT_OPEN = (((0x030A + 0x10000000) + 0x01000000) + 0x00200000) /* 287310602 */, + EV_CHARGE_PORT_CONNECTED = (((0x030B + 0x10000000) + 0x01000000) + 0x00200000) /* 287310603 */, + EV_BATTERY_INSTANTANEOUS_CHARGE_RATE = (((0x030C + 0x10000000) + 0x01000000) + 0x00600000) /* 291504908 */, + RANGE_REMAINING = (((0x0308 + 0x10000000) + 0x01000000) + 0x00600000) /* 291504904 */, + TIRE_PRESSURE = (((0x0309 + 0x10000000) + 0x07000000) + 0x00600000) /* 392168201 */, + CRITICALLY_LOW_TIRE_PRESSURE = (((0x030A + 0x10000000) + 0x07000000) + 0x00600000) /* 392168202 */, + ENGINE_IDLE_AUTO_STOP_ENABLED = (((0x0320 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287310624 */, + GEAR_SELECTION = (((0x0400 + 0x10000000) + 0x01000000) + 0x00400000) /* 289408000 */, + CURRENT_GEAR = (((0x0401 + 0x10000000) + 0x01000000) + 0x00400000) /* 289408001 */, + PARKING_BRAKE_ON = (((0x0402 + 0x10000000) + 0x01000000) + 0x00200000) /* 287310850 */, + PARKING_BRAKE_AUTO_APPLY = (((0x0403 + 0x10000000) + 0x01000000) + 0x00200000) /* 287310851 */, + EV_BRAKE_REGENERATION_LEVEL = (((0x040C + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289408012 */, + FUEL_LEVEL_LOW = (((0x0405 + 0x10000000) + 0x01000000) + 0x00200000) /* 287310853 */, + NIGHT_MODE = (((0x0407 + 0x10000000) + 0x01000000) + 0x00200000) /* 287310855 */, + TURN_SIGNAL_STATE = (((0x0408 + 0x10000000) + 0x01000000) + 0x00400000) /* 289408008 */, + IGNITION_STATE = (((0x0409 + 0x10000000) + 0x01000000) + 0x00400000) /* 289408009 */, + ABS_ACTIVE = (((0x040A + 0x10000000) + 0x01000000) + 0x00200000) /* 287310858 */, + TRACTION_CONTROL_ACTIVE = (((0x040B + 0x10000000) + 0x01000000) + 0x00200000) /* 287310859 */, + EV_STOPPING_MODE = (((0x040D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289408013 */, + HVAC_FAN_SPEED = (((0x0500 + 0x10000000) + 0x05000000) + 0x00400000) /* 356517120 */, + HVAC_FAN_DIRECTION = (((0x0501 + 0x10000000) + 0x05000000) + 0x00400000) /* 356517121 */, + HVAC_TEMPERATURE_CURRENT = (((0x0502 + 0x10000000) + 0x05000000) + 0x00600000) /* 358614274 */, + HVAC_TEMPERATURE_SET = (((0x0503 + 0x10000000) + 0x05000000) + 0x00600000) /* 358614275 */, + HVAC_DEFROSTER = (((0x0504 + 0x10000000) + 0x03000000) + 0x00200000) /* 320865540 */, + HVAC_AC_ON = (((0x0505 + 0x10000000) + 0x05000000) + 0x00200000) /* 354419973 */, + HVAC_MAX_AC_ON = (((0x0506 + 0x10000000) + 0x05000000) + 0x00200000) /* 354419974 */, + HVAC_MAX_DEFROST_ON = (((0x0507 + 0x10000000) + 0x05000000) + 0x00200000) /* 354419975 */, + HVAC_RECIRC_ON = (((0x0508 + 0x10000000) + 0x05000000) + 0x00200000) /* 354419976 */, + HVAC_DUAL_ON = (((0x0509 + 0x10000000) + 0x05000000) + 0x00200000) /* 354419977 */, + HVAC_AUTO_ON = (((0x050A + 0x10000000) + 0x05000000) + 0x00200000) /* 354419978 */, + HVAC_SEAT_TEMPERATURE = (((0x050B + 0x10000000) + 0x05000000) + 0x00400000) /* 356517131 */, + HVAC_SIDE_MIRROR_HEAT = (((0x050C + 0x10000000) + 0x04000000) + 0x00400000) /* 339739916 */, + HVAC_STEERING_WHEEL_HEAT = (((0x050D + 0x10000000) + 0x01000000) + 0x00400000) /* 289408269 */, + HVAC_TEMPERATURE_DISPLAY_UNITS = (((0x050E + 0x10000000) + 0x01000000) + 0x00400000) /* 289408270 */, + HVAC_ACTUAL_FAN_SPEED_RPM = (((0x050F + 0x10000000) + 0x05000000) + 0x00400000) /* 356517135 */, + HVAC_POWER_ON = (((0x0510 + 0x10000000) + 0x05000000) + 0x00200000) /* 354419984 */, + HVAC_FAN_DIRECTION_AVAILABLE = (((0x0511 + 0x10000000) + 0x05000000) + 0x00410000) /* 356582673 */, + HVAC_AUTO_RECIRC_ON = (((0x0512 + 0x10000000) + 0x05000000) + 0x00200000) /* 354419986 */, + HVAC_SEAT_VENTILATION = (((0x0513 + 0x10000000) + 0x05000000) + 0x00400000) /* 356517139 */, + HVAC_ELECTRIC_DEFROSTER_ON = (((0x0514 + 0x10000000) + 0x03000000) + 0x00200000) /* 320865556 */, + HVAC_TEMPERATURE_VALUE_SUGGESTION = (((0x0515 + 0x10000000) + 0x01000000) + 0x00610000) /* 291570965 */, + DISTANCE_DISPLAY_UNITS = (((0x0600 + 0x10000000) + 0x01000000) + 0x00400000) /* 289408512 */, + FUEL_VOLUME_DISPLAY_UNITS = (((0x0601 + 0x10000000) + 0x01000000) + 0x00400000) /* 289408513 */, + TIRE_PRESSURE_DISPLAY_UNITS = (((0x0602 + 0x10000000) + 0x01000000) + 0x00400000) /* 289408514 */, + EV_BATTERY_DISPLAY_UNITS = (((0x0603 + 0x10000000) + 0x01000000) + 0x00400000) /* 289408515 */, + FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME = (((0x0604 + 0x10000000) + 0x01000000) + 0x00200000) /* 287311364 */, + VEHICLE_SPEED_DISPLAY_UNITS = (((0x0605 + 0x10000000) + 0x01000000) + 0x00400000) /* 289408517 */, + EXTERNAL_CAR_TIME = (((0x0608 + 0x10000000) + 0x01000000) + 0x00500000) /* 290457096 */, + ANDROID_EPOCH_TIME = (((0x0606 + 0x10000000) + 0x01000000) + 0x00500000) /* 290457094 */, + STORAGE_ENCRYPTION_BINDING_SEED = (((0x0607 + 0x10000000) + 0x01000000) + 0x00700000) /* 292554247 */, + ENV_OUTSIDE_TEMPERATURE = (((0x0703 + 0x10000000) + 0x01000000) + 0x00600000) /* 291505923 */, + AP_POWER_STATE_REQ = (((0x0A00 + 0x10000000) + 0x01000000) + 0x00410000) /* 289475072 */, + AP_POWER_STATE_REPORT = (((0x0A01 + 0x10000000) + 0x01000000) + 0x00410000) /* 289475073 */, + AP_POWER_BOOTUP_REASON = (((0x0A02 + 0x10000000) + 0x01000000) + 0x00400000) /* 289409538 */, + DISPLAY_BRIGHTNESS = (((0x0A03 + 0x10000000) + 0x01000000) + 0x00400000) /* 289409539 */, + PER_DISPLAY_BRIGHTNESS = (((0x0A04 + 0x10000000) + 0x01000000) + 0x00410000) /* 289475076 */, + HW_KEY_INPUT = (((0x0A10 + 0x10000000) + 0x01000000) + 0x00410000) /* 289475088 */, + HW_KEY_INPUT_V2 = (((0x0A11 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.MIXED) /* 367004177 */, + HW_MOTION_INPUT = (((0x0A12 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.MIXED) /* 367004178 */, + HW_ROTARY_INPUT = (((0x0A20 + 0x10000000) + 0x01000000) + 0x00410000) /* 289475104 */, + HW_CUSTOM_INPUT = (((0X0A30 + 0x10000000) + 0x01000000) + 0x00410000) /* 289475120 */, + DOOR_POS = (((0x0B00 + 0x10000000) + 0x06000000) + 0x00400000) /* 373295872 */, + DOOR_MOVE = (((0x0B01 + 0x10000000) + 0x06000000) + 0x00400000) /* 373295873 */, + DOOR_LOCK = (((0x0B02 + 0x10000000) + 0x06000000) + 0x00200000) /* 371198722 */, + DOOR_CHILD_LOCK_ENABLED = (((0x0B03 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.DOOR) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 371198723 */, + MIRROR_Z_POS = (((0x0B40 + 0x10000000) + 0x04000000) + 0x00400000) /* 339741504 */, + MIRROR_Z_MOVE = (((0x0B41 + 0x10000000) + 0x04000000) + 0x00400000) /* 339741505 */, + MIRROR_Y_POS = (((0x0B42 + 0x10000000) + 0x04000000) + 0x00400000) /* 339741506 */, + MIRROR_Y_MOVE = (((0x0B43 + 0x10000000) + 0x04000000) + 0x00400000) /* 339741507 */, + MIRROR_LOCK = (((0x0B44 + 0x10000000) + 0x01000000) + 0x00200000) /* 287312708 */, + MIRROR_FOLD = (((0x0B45 + 0x10000000) + 0x01000000) + 0x00200000) /* 287312709 */, + MIRROR_AUTO_FOLD_ENABLED = (((0x0B46 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.MIRROR) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 337644358 */, + MIRROR_AUTO_TILT_ENABLED = (((0x0B47 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.MIRROR) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 337644359 */, + SEAT_MEMORY_SELECT = (((0x0B80 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518784 */, + SEAT_MEMORY_SET = (((0x0B81 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518785 */, + SEAT_BELT_BUCKLED = (((0x0B82 + 0x10000000) + 0x05000000) + 0x00200000) /* 354421634 */, + SEAT_BELT_HEIGHT_POS = (((0x0B83 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518787 */, + SEAT_BELT_HEIGHT_MOVE = (((0x0B84 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518788 */, + SEAT_FORE_AFT_POS = (((0x0B85 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518789 */, + SEAT_FORE_AFT_MOVE = (((0x0B86 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518790 */, + SEAT_BACKREST_ANGLE_1_POS = (((0x0B87 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518791 */, + SEAT_BACKREST_ANGLE_1_MOVE = (((0x0B88 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518792 */, + SEAT_BACKREST_ANGLE_2_POS = (((0x0B89 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518793 */, + SEAT_BACKREST_ANGLE_2_MOVE = (((0x0B8A + 0x10000000) + 0x05000000) + 0x00400000) /* 356518794 */, + SEAT_HEIGHT_POS = (((0x0B8B + 0x10000000) + 0x05000000) + 0x00400000) /* 356518795 */, + SEAT_HEIGHT_MOVE = (((0x0B8C + 0x10000000) + 0x05000000) + 0x00400000) /* 356518796 */, + SEAT_DEPTH_POS = (((0x0B8D + 0x10000000) + 0x05000000) + 0x00400000) /* 356518797 */, + SEAT_DEPTH_MOVE = (((0x0B8E + 0x10000000) + 0x05000000) + 0x00400000) /* 356518798 */, + SEAT_TILT_POS = (((0x0B8F + 0x10000000) + 0x05000000) + 0x00400000) /* 356518799 */, + SEAT_TILT_MOVE = (((0x0B90 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518800 */, + SEAT_LUMBAR_FORE_AFT_POS = (((0x0B91 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518801 */, + SEAT_LUMBAR_FORE_AFT_MOVE = (((0x0B92 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518802 */, + SEAT_LUMBAR_SIDE_SUPPORT_POS = (((0x0B93 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518803 */, + SEAT_LUMBAR_SIDE_SUPPORT_MOVE = (((0x0B94 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518804 */, + SEAT_HEADREST_HEIGHT_POS = (((0x0B95 + 0x10000000) + 0x01000000) + 0x00400000) /* 289409941 */, + SEAT_HEADREST_HEIGHT_POS_V2 = (((0x0BA4 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518820 */, + SEAT_HEADREST_HEIGHT_MOVE = (((0x0B96 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518806 */, + SEAT_HEADREST_ANGLE_POS = (((0x0B97 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518807 */, + SEAT_HEADREST_ANGLE_MOVE = (((0x0B98 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518808 */, + SEAT_HEADREST_FORE_AFT_POS = (((0x0B99 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518809 */, + SEAT_HEADREST_FORE_AFT_MOVE = (((0x0B9A + 0x10000000) + 0x05000000) + 0x00400000) /* 356518810 */, + SEAT_FOOTWELL_LIGHTS_STATE = (((0x0B9B + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518811 */, + SEAT_FOOTWELL_LIGHTS_SWITCH = (((0x0B9C + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518812 */, + SEAT_EASY_ACCESS_ENABLED = (((0x0B9D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 354421661 */, + SEAT_AIRBAG_ENABLED = (((0x0B9E + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 354421662 */, + SEAT_CUSHION_SIDE_SUPPORT_POS = (((0x0B9F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518815 */, + SEAT_CUSHION_SIDE_SUPPORT_MOVE = (((0x0BA0 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518816 */, + SEAT_LUMBAR_VERTICAL_POS = (((0x0BA1 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518817 */, + SEAT_LUMBAR_VERTICAL_MOVE = (((0x0BA2 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518818 */, + SEAT_WALK_IN_POS = (((0x0BA3 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518819 */, + SEAT_OCCUPANCY = (((0x0BB0 + 0x10000000) + 0x05000000) + 0x00400000) /* 356518832 */, + WINDOW_POS = (((0x0BC0 + 0x10000000) + 0x03000000) + 0x00400000) /* 322964416 */, + WINDOW_MOVE = (((0x0BC1 + 0x10000000) + 0x03000000) + 0x00400000) /* 322964417 */, + WINDOW_LOCK = (((0x0BC4 + 0x10000000) + 0x03000000) + 0x00200000) /* 320867268 */, + WINDSHIELD_WIPERS_PERIOD = (((0x0BC5 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.WINDOW) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 322964421 */, + WINDSHIELD_WIPERS_STATE = (((0x0BC6 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.WINDOW) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 322964422 */, + WINDSHIELD_WIPERS_SWITCH = (((0x0BC7 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.WINDOW) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 322964423 */, + STEERING_WHEEL_DEPTH_POS = (((0x0BE0 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410016 */, + STEERING_WHEEL_DEPTH_MOVE = (((0x0BE1 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410017 */, + STEERING_WHEEL_HEIGHT_POS = (((0x0BE2 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410018 */, + STEERING_WHEEL_HEIGHT_MOVE = (((0x0BE3 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410019 */, + STEERING_WHEEL_THEFT_LOCK_ENABLED = (((0x0BE4 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287312868 */, + STEERING_WHEEL_LOCKED = (((0x0BE5 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287312869 */, + STEERING_WHEEL_EASY_ACCESS_ENABLED = (((0x0BE6 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287312870 */, + GLOVE_BOX_DOOR_POS = (((0x0BF0 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 356518896 */, + GLOVE_BOX_LOCKED = (((0x0BF1 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.SEAT) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 354421745 */, + VEHICLE_MAP_SERVICE = (((0x0C00 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299895808 */, + LOCATION_CHARACTERIZATION = (((0x0C10 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410064 */, + OBD2_LIVE_FRAME = (((0x0D00 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896064 */, + OBD2_FREEZE_FRAME = (((0x0D01 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896065 */, + OBD2_FREEZE_FRAME_INFO = (((0x0D02 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896066 */, + OBD2_FREEZE_FRAME_CLEAR = (((0x0D03 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896067 */, + HEADLIGHTS_STATE = (((0x0E00 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410560 */, + HIGH_BEAM_LIGHTS_STATE = (((0x0E01 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410561 */, + FOG_LIGHTS_STATE = (((0x0E02 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410562 */, + HAZARD_LIGHTS_STATE = (((0x0E03 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410563 */, + HEADLIGHTS_SWITCH = (((0x0E10 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410576 */, + HIGH_BEAM_LIGHTS_SWITCH = (((0x0E11 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410577 */, + FOG_LIGHTS_SWITCH = (((0x0E12 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410578 */, + HAZARD_LIGHTS_SWITCH = (((0x0E13 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410579 */, + CABIN_LIGHTS_STATE = (((0x0F01 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410817 */, + CABIN_LIGHTS_SWITCH = (((0x0F02 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410818 */, + READING_LIGHTS_STATE = (((0x0F03 + 0x10000000) + 0x05000000) + 0x00400000) /* 356519683 */, + READING_LIGHTS_SWITCH = (((0x0F04 + 0x10000000) + 0x05000000) + 0x00400000) /* 356519684 */, + STEERING_WHEEL_LIGHTS_STATE = (((0x0F0C + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410828 */, + STEERING_WHEEL_LIGHTS_SWITCH = (((0x0F0D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410829 */, + SUPPORT_CUSTOMIZE_VENDOR_PERMISSION = (((0x0F05 + 0x10000000) + 0x01000000) + 0x00200000) /* 287313669 */, + DISABLED_OPTIONAL_FEATURES = (((0x0F06 + 0x10000000) + 0x01000000) + 0x00100000) /* 286265094 */, + INITIAL_USER_INFO = (((0x0F07 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896583 */, + SWITCH_USER = (((0x0F08 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896584 */, + CREATE_USER = (((0x0F09 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896585 */, + REMOVE_USER = (((0x0F0A + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896586 */, + USER_IDENTIFICATION_ASSOCIATION = (((0x0F0B + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896587 */, + EVS_SERVICE_REQUEST = (((0x0F10 + 0x10000000) + 0x01000000) + 0x00410000) /* 289476368 */, + POWER_POLICY_REQ = (((0x0F21 + 0x10000000) + 0x01000000) + 0x00100000) /* 286265121 */, + POWER_POLICY_GROUP_REQ = (((0x0F22 + 0x10000000) + 0x01000000) + 0x00100000) /* 286265122 */, + CURRENT_POWER_POLICY = (((0x0F23 + 0x10000000) + 0x01000000) + 0x00100000) /* 286265123 */, + WATCHDOG_ALIVE = (((0xF31 + 0x10000000) + 0x01000000) + 0x00500000) /* 290459441 */, + WATCHDOG_TERMINATED_PROCESS = (((0x0F32 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896626 */, + VHAL_HEARTBEAT = (((0x0F33 + 0x10000000) + 0x01000000) + 0x00500000) /* 290459443 */, + CLUSTER_SWITCH_UI = (((0x0F34 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410868 */, + CLUSTER_DISPLAY_STATE = (((0x0F35 + 0x10000000) + 0x01000000) + 0x00410000) /* 289476405 */, + CLUSTER_REPORT_STATE = (((0x0F36 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299896630 */, + CLUSTER_REQUEST_DISPLAY = (((0x0F37 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410871 */, + CLUSTER_NAVIGATION_STATE = (((0x0F38 + 0x10000000) + 0x01000000) + 0x00700000) /* 292556600 */, + ELECTRONIC_TOLL_COLLECTION_CARD_TYPE = (((0x0F39 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410873 */, + ELECTRONIC_TOLL_COLLECTION_CARD_STATUS = (((0x0F3A + 0x10000000) + 0x01000000) + 0x00400000) /* 289410874 */, + FRONT_FOG_LIGHTS_STATE = (((0x0F3B + 0x10000000) + 0x01000000) + 0x00400000) /* 289410875 */, + FRONT_FOG_LIGHTS_SWITCH = (((0x0F3C + 0x10000000) + 0x01000000) + 0x00400000) /* 289410876 */, + REAR_FOG_LIGHTS_STATE = (((0x0F3D + 0x10000000) + 0x01000000) + 0x00400000) /* 289410877 */, + REAR_FOG_LIGHTS_SWITCH = (((0x0F3E + 0x10000000) + 0x01000000) + 0x00400000) /* 289410878 */, + EV_CHARGE_CURRENT_DRAW_LIMIT = (((0x0F3F + 0x10000000) + 0x01000000) + 0x00600000) /* 291508031 */, + EV_CHARGE_PERCENT_LIMIT = (((0x0F40 + 0x10000000) + 0x01000000) + 0x00600000) /* 291508032 */, + EV_CHARGE_STATE = (((0x0F41 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410881 */, + EV_CHARGE_SWITCH = (((0x0F42 + 0x10000000) + 0x01000000) + 0x00200000) /* 287313730 */, + EV_CHARGE_TIME_REMAINING = (((0x0F43 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410883 */, + EV_REGENERATIVE_BRAKING_STATE = (((0x0F44 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410884 */, + TRAILER_PRESENT = (((0x0F45 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410885 */, + VEHICLE_CURB_WEIGHT = (((0x0F46 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410886 */, + GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT = (((0x0F47 + 0x10000000) + 0x01000000) + 0x00400000) /* 289410887 */, + SUPPORTED_PROPERTY_IDS = (((0x0F48 + 0x10000000) + 0x01000000) + 0x00410000) /* 289476424 */, + SHUTDOWN_REQUEST = (((0x0F49 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410889 */, + VEHICLE_IN_USE = (((0x0F4A + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313738 */, + AUTOMATIC_EMERGENCY_BRAKING_ENABLED = (((0x1000 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313920 */, + AUTOMATIC_EMERGENCY_BRAKING_STATE = (((0x1001 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411073 */, + FORWARD_COLLISION_WARNING_ENABLED = (((0x1002 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313922 */, + FORWARD_COLLISION_WARNING_STATE = (((0x1003 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411075 */, + BLIND_SPOT_WARNING_ENABLED = (((0x1004 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313924 */, + BLIND_SPOT_WARNING_STATE = (((0x1005 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.MIRROR) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 339742725 */, + LANE_DEPARTURE_WARNING_ENABLED = (((0x1006 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313926 */, + LANE_DEPARTURE_WARNING_STATE = (((0x1007 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411079 */, + LANE_KEEP_ASSIST_ENABLED = (((0x1008 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313928 */, + LANE_KEEP_ASSIST_STATE = (((0x1009 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411081 */, + LANE_CENTERING_ASSIST_ENABLED = (((0x100A + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313930 */, + LANE_CENTERING_ASSIST_COMMAND = (((0x100B + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411083 */, + LANE_CENTERING_ASSIST_STATE = (((0x100C + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411084 */, + EMERGENCY_LANE_KEEP_ASSIST_ENABLED = (((0x100D + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313933 */, + EMERGENCY_LANE_KEEP_ASSIST_STATE = (((0x100E + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411086 */, + CRUISE_CONTROL_ENABLED = (((0x100F + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313935 */, + CRUISE_CONTROL_TYPE = (((0x1010 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411088 */, + CRUISE_CONTROL_STATE = (((0x1011 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411089 */, + CRUISE_CONTROL_COMMAND = (((0x1012 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411090 */, + CRUISE_CONTROL_TARGET_SPEED = (((0x1013 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.FLOAT) /* 291508243 */, + ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP = (((0x1014 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411092 */, + ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE = (((0x1015 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411093 */, + HANDS_ON_DETECTION_ENABLED = (((0x1016 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.BOOLEAN) /* 287313942 */, + HANDS_ON_DETECTION_DRIVER_STATE = (((0x1017 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411095 */, + HANDS_ON_DETECTION_WARNING = (((0x1018 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289411096 */, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl new file mode 100644 index 0000000000..714d514cf4 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehiclePropertyGroup.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehiclePropertyGroup { + SYSTEM = 0x10000000, + VENDOR = 0x20000000, + MASK = 0xf0000000, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehiclePropertyType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehiclePropertyType.aidl new file mode 100644 index 0000000000..7525cbbf69 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehiclePropertyType.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehiclePropertyType { + STRING = 0x00100000, + BOOLEAN = 0x00200000, + INT32 = 0x00400000, + INT32_VEC = 0x00410000, + INT64 = 0x00500000, + INT64_VEC = 0x00510000, + FLOAT = 0x00600000, + FLOAT_VEC = 0x00610000, + BYTES = 0x00700000, + MIXED = 0x00e00000, + MASK = 0x00ff0000, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl new file mode 100644 index 0000000000..3e870e8925 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleSeatOccupancyState.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleSeatOccupancyState { + UNKNOWN = 0, + VACANT = 1, + OCCUPIED = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl new file mode 100644 index 0000000000..0431b45b9a --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleTurnSignal.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleTurnSignal { + NONE = 0x00, + RIGHT = 0x01, + LEFT = 0x02, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleUnit.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleUnit.aidl new file mode 100644 index 0000000000..9aca98bec2 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleUnit.aidl @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleUnit { + SHOULD_NOT_USE = 0x000, + METER_PER_SEC = 0x01, + RPM = 0x02, + HERTZ = 0x03, + PERCENTILE = 0x10, + MILLIMETER = 0x20, + METER = 0x21, + KILOMETER = 0x23, + MILE = 0x24, + CELSIUS = 0x30, + FAHRENHEIT = 0x31, + KELVIN = 0x32, + MILLILITER = 0x40, + LITER = 0x41, + GALLON = 0x42, + US_GALLON = 0x42, + IMPERIAL_GALLON = 0x43, + NANO_SECS = 0x50, + MILLI_SECS = 0x51, + SECS = 0x53, + YEAR = 0x59, + WATT_HOUR = 0x60, + MILLIAMPERE = 0x61, + MILLIVOLT = 0x62, + MILLIWATTS = 0x63, + AMPERE_HOURS = 0x64, + KILOWATT_HOUR = 0x65, + AMPERE = 0x66, + KILOPASCAL = 0x70, + PSI = 0x71, + BAR = 0x72, + DEGREES = 0x80, + MILES_PER_HOUR = 0x90, + KILOMETERS_PER_HOUR = 0x91, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl new file mode 100644 index 0000000000..3aa326c9c7 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VehicleVendorPermission.aidl @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VehicleVendorPermission { + PERMISSION_DEFAULT = 0x00000000, + PERMISSION_SET_VENDOR_CATEGORY_WINDOW = 0X00000001, + PERMISSION_GET_VENDOR_CATEGORY_WINDOW = 0x00000002, + PERMISSION_SET_VENDOR_CATEGORY_DOOR = 0x00000003, + PERMISSION_GET_VENDOR_CATEGORY_DOOR = 0x00000004, + PERMISSION_SET_VENDOR_CATEGORY_SEAT = 0x00000005, + PERMISSION_GET_VENDOR_CATEGORY_SEAT = 0x00000006, + PERMISSION_SET_VENDOR_CATEGORY_MIRROR = 0x00000007, + PERMISSION_GET_VENDOR_CATEGORY_MIRROR = 0x00000008, + PERMISSION_SET_VENDOR_CATEGORY_INFO = 0x00000009, + PERMISSION_GET_VENDOR_CATEGORY_INFO = 0x0000000A, + PERMISSION_SET_VENDOR_CATEGORY_ENGINE = 0x0000000B, + PERMISSION_GET_VENDOR_CATEGORY_ENGINE = 0x0000000C, + PERMISSION_SET_VENDOR_CATEGORY_HVAC = 0x0000000D, + PERMISSION_GET_VENDOR_CATEGORY_HVAC = 0x0000000E, + PERMISSION_SET_VENDOR_CATEGORY_LIGHT = 0x0000000F, + PERMISSION_GET_VENDOR_CATEGORY_LIGHT = 0x00000010, + PERMISSION_SET_VENDOR_CATEGORY_1 = 0x00010000, + PERMISSION_GET_VENDOR_CATEGORY_1 = 0x00011000, + PERMISSION_SET_VENDOR_CATEGORY_2 = 0x00020000, + PERMISSION_GET_VENDOR_CATEGORY_2 = 0x00021000, + PERMISSION_SET_VENDOR_CATEGORY_3 = 0x00030000, + PERMISSION_GET_VENDOR_CATEGORY_3 = 0x00031000, + PERMISSION_SET_VENDOR_CATEGORY_4 = 0x00040000, + PERMISSION_GET_VENDOR_CATEGORY_4 = 0x00041000, + PERMISSION_SET_VENDOR_CATEGORY_5 = 0x00050000, + PERMISSION_GET_VENDOR_CATEGORY_5 = 0x00051000, + PERMISSION_SET_VENDOR_CATEGORY_6 = 0x00060000, + PERMISSION_GET_VENDOR_CATEGORY_6 = 0x00061000, + PERMISSION_SET_VENDOR_CATEGORY_7 = 0x00070000, + PERMISSION_GET_VENDOR_CATEGORY_7 = 0x00071000, + PERMISSION_SET_VENDOR_CATEGORY_8 = 0x00080000, + PERMISSION_GET_VENDOR_CATEGORY_8 = 0x00081000, + PERMISSION_SET_VENDOR_CATEGORY_9 = 0x00090000, + PERMISSION_GET_VENDOR_CATEGORY_9 = 0x00091000, + PERMISSION_SET_VENDOR_CATEGORY_10 = 0x000A0000, + PERMISSION_GET_VENDOR_CATEGORY_10 = 0x000A1000, + PERMISSION_NOT_ACCESSIBLE = 0xF0000000, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl new file mode 100644 index 0000000000..0dcfbc4a5d --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsAvailabilityStateIntegerValuesIndex.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VmsAvailabilityStateIntegerValuesIndex { + MESSAGE_TYPE = 0, + SEQUENCE_NUMBER = 1, + NUMBER_OF_ASSOCIATED_LAYERS = 2, + LAYERS_START = 3, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl new file mode 100644 index 0000000000..45514d081a --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsBaseMessageIntegerValuesIndex.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VmsBaseMessageIntegerValuesIndex { + MESSAGE_TYPE = 0, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsMessageType.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsMessageType.aidl new file mode 100644 index 0000000000..1248c069ce --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsMessageType.aidl @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VmsMessageType { + SUBSCRIBE = 1, + SUBSCRIBE_TO_PUBLISHER = 2, + UNSUBSCRIBE = 3, + UNSUBSCRIBE_TO_PUBLISHER = 4, + OFFERING = 5, + AVAILABILITY_REQUEST = 6, + SUBSCRIPTIONS_REQUEST = 7, + AVAILABILITY_RESPONSE = 8, + AVAILABILITY_CHANGE = 9, + SUBSCRIPTIONS_RESPONSE = 10, + SUBSCRIPTIONS_CHANGE = 11, + DATA = 12, + PUBLISHER_ID_REQUEST = 13, + PUBLISHER_ID_RESPONSE = 14, + PUBLISHER_INFORMATION_REQUEST = 15, + PUBLISHER_INFORMATION_RESPONSE = 16, + START_SESSION = 17, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl new file mode 100644 index 0000000000..8b0e3a5ef2 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsMessageWithLayerAndPublisherIdIntegerValuesIndex.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VmsMessageWithLayerAndPublisherIdIntegerValuesIndex { + MESSAGE_TYPE = 0, + LAYER_TYPE = 1, + LAYER_SUBTYPE = 2, + LAYER_VERSION = 3, + PUBLISHER_ID = 4, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl new file mode 100644 index 0000000000..65dd4ae395 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsMessageWithLayerIntegerValuesIndex.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VmsMessageWithLayerIntegerValuesIndex { + MESSAGE_TYPE = 0, + LAYER_TYPE = 1, + LAYER_SUBTYPE = 2, + LAYER_VERSION = 3, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl new file mode 100644 index 0000000000..fc2a9c1844 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsOfferingMessageIntegerValuesIndex.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VmsOfferingMessageIntegerValuesIndex { + MESSAGE_TYPE = 0, + PUBLISHER_ID = 1, + NUMBER_OF_OFFERS = 2, + OFFERING_START = 3, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl new file mode 100644 index 0000000000..a9b017fdb1 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsPublisherInformationIntegerValuesIndex.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VmsPublisherInformationIntegerValuesIndex { + MESSAGE_TYPE = 0, + PUBLISHER_ID = 1, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl new file mode 100644 index 0000000000..d942bc8392 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsStartSessionMessageIntegerValuesIndex.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VmsStartSessionMessageIntegerValuesIndex { + MESSAGE_TYPE = 0, + SERVICE_ID = 1, + CLIENT_ID = 2, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl new file mode 100644 index 0000000000..796d7f722c --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/VmsSubscriptionsStateIntegerValuesIndex.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum VmsSubscriptionsStateIntegerValuesIndex { + MESSAGE_TYPE = 0, + SEQUENCE_NUMBER = 1, + NUMBER_OF_LAYERS = 2, + NUMBER_OF_ASSOCIATED_LAYERS = 3, + SUBSCRIPTIONS_START = 4, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/WindshieldWipersState.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/WindshieldWipersState.aidl new file mode 100644 index 0000000000..d0c1e8d70d --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/WindshieldWipersState.aidl @@ -0,0 +1,41 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum WindshieldWipersState { + OTHER = 0, + OFF = 1, + ON = 2, + SERVICE = 3, +} diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/WindshieldWipersSwitch.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/WindshieldWipersSwitch.aidl new file mode 100644 index 0000000000..6c170fe6a4 --- /dev/null +++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/2/android/hardware/automotive/vehicle/WindshieldWipersSwitch.aidl @@ -0,0 +1,52 @@ +/* + * 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 -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.hardware.automotive.vehicle; +@Backing(type="int") @VintfStability +enum WindshieldWipersSwitch { + OTHER = 0, + OFF = 1, + MIST = 2, + INTERMITTENT_LEVEL_1 = 3, + INTERMITTENT_LEVEL_2 = 4, + INTERMITTENT_LEVEL_3 = 5, + INTERMITTENT_LEVEL_4 = 6, + INTERMITTENT_LEVEL_5 = 7, + CONTINUOUS_LEVEL_1 = 8, + CONTINUOUS_LEVEL_2 = 9, + CONTINUOUS_LEVEL_3 = 10, + CONTINUOUS_LEVEL_4 = 11, + CONTINUOUS_LEVEL_5 = 12, + AUTO = 13, + SERVICE = 14, +} diff --git a/biometrics/common/aidl/Android.bp b/biometrics/common/aidl/Android.bp index 88edf04932..b41a9374ea 100644 --- a/biometrics/common/aidl/Android.bp +++ b/biometrics/common/aidl/Android.bp @@ -13,7 +13,7 @@ aidl_interface { srcs: [ "android/hardware/biometrics/common/*.aidl", ], - frozen: false, + frozen: true, stability: "vintf", backend: { java: { @@ -32,5 +32,10 @@ aidl_interface { version: "2", imports: [], }, + { + version: "3", + imports: [], + }, + ], } diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/.hash b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/.hash new file mode 100644 index 0000000000..15b5032bbe --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/.hash @@ -0,0 +1 @@ +a9ebb97f5abea1dc6800b69d821ef61944e80e65 diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/AuthenticateReason.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/AuthenticateReason.aidl new file mode 100644 index 0000000000..f639ead601 --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/AuthenticateReason.aidl @@ -0,0 +1,63 @@ +/* + * 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 -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.hardware.biometrics.common; +/* @hide */ +@VintfStability +union AuthenticateReason { + android.hardware.biometrics.common.AuthenticateReason.Vendor vendorAuthenticateReason; + android.hardware.biometrics.common.AuthenticateReason.Face faceAuthenticateReason; + android.hardware.biometrics.common.AuthenticateReason.Fingerprint fingerprintAuthenticateReason; + @VintfStability + parcelable Vendor { + ParcelableHolder extension; + } + @Backing(type="int") @VintfStability + enum Fingerprint { + UNKNOWN, + } + @Backing(type="int") @VintfStability + enum Face { + UNKNOWN, + STARTED_WAKING_UP, + PRIMARY_BOUNCER_SHOWN, + ASSISTANT_VISIBLE, + ALTERNATE_BIOMETRIC_BOUNCER_SHOWN, + NOTIFICATION_PANEL_CLICKED, + OCCLUDING_APP_REQUESTED, + PICK_UP_GESTURE_TRIGGERED, + QS_EXPANDED, + SWIPE_UP_ON_BOUNCER, + UDFPS_POINTER_DOWN, + } +} diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/CommonProps.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/CommonProps.aidl new file mode 100644 index 0000000000..1eb8541352 --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/CommonProps.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2020 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 -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.hardware.biometrics.common; +/* @hide */ +@VintfStability +parcelable CommonProps { + int sensorId; + android.hardware.biometrics.common.SensorStrength sensorStrength = android.hardware.biometrics.common.SensorStrength.CONVENIENCE; + int maxEnrollmentsPerUser; + android.hardware.biometrics.common.ComponentInfo[] componentInfo; +} diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/ComponentInfo.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/ComponentInfo.aidl new file mode 100644 index 0000000000..471ed2ba37 --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/ComponentInfo.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2020 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 -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.hardware.biometrics.common; +/* @hide */ +@VintfStability +parcelable ComponentInfo { + String componentId; + String hardwareVersion; + String firmwareVersion; + String serialNumber; + String softwareVersion; +} diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/DisplayState.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/DisplayState.aidl new file mode 100644 index 0000000000..176e8d603b --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/DisplayState.aidl @@ -0,0 +1,43 @@ +/* + * 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 -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.hardware.biometrics.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum DisplayState { + UNKNOWN, + LOCKSCREEN, + NO_UI, + SCREENSAVER, + AOD, +} diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/ICancellationSignal.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/ICancellationSignal.aidl new file mode 100644 index 0000000000..670114f10a --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/ICancellationSignal.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2020 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 -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.hardware.biometrics.common; +/* @hide */ +@VintfStability +interface ICancellationSignal { + oneway void cancel(); +} diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/OperationContext.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/OperationContext.aidl new file mode 100644 index 0000000000..378017e8d4 --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/OperationContext.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2021 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 -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.hardware.biometrics.common; +/* @hide */ +@VintfStability +parcelable OperationContext { + int id = 0; + android.hardware.biometrics.common.OperationReason reason = android.hardware.biometrics.common.OperationReason.UNKNOWN; + /** + * @deprecated use displayState instead. + */ + boolean isAod = false; + boolean isCrypto = false; + android.hardware.biometrics.common.WakeReason wakeReason = android.hardware.biometrics.common.WakeReason.UNKNOWN; + android.hardware.biometrics.common.DisplayState displayState = android.hardware.biometrics.common.DisplayState.UNKNOWN; + @nullable android.hardware.biometrics.common.AuthenticateReason authenticateReason; +} diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/OperationReason.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/OperationReason.aidl new file mode 100644 index 0000000000..188054a45a --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/OperationReason.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.biometrics.common; +/* @hide */ +@Backing(type="byte") @VintfStability +enum OperationReason { + UNKNOWN, + BIOMETRIC_PROMPT, + KEYGUARD, +} diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/SensorStrength.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/SensorStrength.aidl new file mode 100644 index 0000000000..c93178167d --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/SensorStrength.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2020 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 -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.hardware.biometrics.common; +/* @hide */ +@Backing(type="byte") @VintfStability +enum SensorStrength { + CONVENIENCE, + WEAK, + STRONG, +} diff --git a/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/WakeReason.aidl b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/WakeReason.aidl new file mode 100644 index 0000000000..6a08776280 --- /dev/null +++ b/biometrics/common/aidl/aidl_api/android.hardware.biometrics.common/3/android/hardware/biometrics/common/WakeReason.aidl @@ -0,0 +1,48 @@ +/* + * 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 -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.hardware.biometrics.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum WakeReason { + UNKNOWN, + POWER_BUTTON, + GESTURE, + WAKE_KEY, + WAKE_MOTION, + LID, + DISPLAY_GROUP_ADDED, + TAP, + LIFT, + BIOMETRIC, +} diff --git a/biometrics/face/aidl/Android.bp b/biometrics/face/aidl/Android.bp index 7b11335bd1..79df9c6354 100644 --- a/biometrics/face/aidl/Android.bp +++ b/biometrics/face/aidl/Android.bp @@ -44,7 +44,16 @@ aidl_interface { "android.hardware.keymaster-V3", ], }, + { + version: "3", + imports: [ + "android.hardware.biometrics.common-V3", + "android.hardware.common-V2", + "android.hardware.keymaster-V4", + ], + }, ], + frozen: true, } diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/.hash b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/.hash new file mode 100644 index 0000000000..3b42823a6c --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/.hash @@ -0,0 +1 @@ +fca1ab84dda6c013b251270d848eb6d964a6d765 diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/AcquiredInfo.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/AcquiredInfo.aidl new file mode 100644 index 0000000000..5312ca16d6 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/AcquiredInfo.aidl @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2021 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 -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.hardware.biometrics.face; +@Backing(type="byte") @VintfStability +enum AcquiredInfo { + UNKNOWN, + GOOD, + INSUFFICIENT, + TOO_BRIGHT, + TOO_DARK, + TOO_CLOSE, + TOO_FAR, + FACE_TOO_HIGH, + FACE_TOO_LOW, + FACE_TOO_RIGHT, + FACE_TOO_LEFT, + POOR_GAZE, + NOT_DETECTED, + TOO_MUCH_MOTION, + RECALIBRATE, + TOO_DIFFERENT, + TOO_SIMILAR, + PAN_TOO_EXTREME, + TILT_TOO_EXTREME, + ROLL_TOO_EXTREME, + FACE_OBSCURED, + START, + SENSOR_DIRTY, + VENDOR, + FIRST_FRAME_RECEIVED, + DARK_GLASSES_DETECTED, + MOUTH_COVERING_DETECTED, +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/AuthenticationFrame.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/AuthenticationFrame.aidl new file mode 100644 index 0000000000..20bc76779b --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/AuthenticationFrame.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2021 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 -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.hardware.biometrics.face; +@VintfStability +parcelable AuthenticationFrame { + android.hardware.biometrics.face.BaseFrame data; +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/BaseFrame.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/BaseFrame.aidl new file mode 100644 index 0000000000..67b5cf4169 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/BaseFrame.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.biometrics.face; +@VintfStability +parcelable BaseFrame { + android.hardware.biometrics.face.AcquiredInfo acquiredInfo = android.hardware.biometrics.face.AcquiredInfo.UNKNOWN; + int vendorCode; + float pan; + float tilt; + float distance; + boolean isCancellable; +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/Cell.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/Cell.aidl new file mode 100644 index 0000000000..6be8c8e975 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/Cell.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.biometrics.face; +@VintfStability +parcelable Cell { + int x; + int y; + int z; +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/EnrollmentFrame.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/EnrollmentFrame.aidl new file mode 100644 index 0000000000..0ea10d6ddb --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/EnrollmentFrame.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.biometrics.face; +@VintfStability +parcelable EnrollmentFrame { + @nullable android.hardware.biometrics.face.Cell cell; + android.hardware.biometrics.face.EnrollmentStage stage = android.hardware.biometrics.face.EnrollmentStage.UNKNOWN; + android.hardware.biometrics.face.BaseFrame data; +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/EnrollmentStage.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/EnrollmentStage.aidl new file mode 100644 index 0000000000..a203dbec18 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/EnrollmentStage.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.biometrics.face; +@Backing(type="byte") @VintfStability +enum EnrollmentStage { + UNKNOWN, + FIRST_FRAME_RECEIVED, + WAITING_FOR_CENTERING, + HOLD_STILL_IN_CENTER, + ENROLLING_MOVEMENT_1, + ENROLLING_MOVEMENT_2, + ENROLLMENT_FINISHED, +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/EnrollmentStageConfig.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/EnrollmentStageConfig.aidl new file mode 100644 index 0000000000..48db2cf615 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/EnrollmentStageConfig.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.biometrics.face; +@VintfStability +parcelable EnrollmentStageConfig { + android.hardware.biometrics.face.EnrollmentStage stage = android.hardware.biometrics.face.EnrollmentStage.UNKNOWN; + List cells; +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/EnrollmentType.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/EnrollmentType.aidl new file mode 100644 index 0000000000..da1e8a3e95 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/EnrollmentType.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.biometrics.face; +@Backing(type="byte") @VintfStability +enum EnrollmentType { + DEFAULT, + ACCESSIBILITY, +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/Error.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/Error.aidl new file mode 100644 index 0000000000..28eb420587 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/Error.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.biometrics.face; +@Backing(type="byte") @VintfStability +enum Error { + UNKNOWN, + HW_UNAVAILABLE, + UNABLE_TO_PROCESS, + TIMEOUT, + NO_SPACE, + CANCELED, + UNABLE_TO_REMOVE, + VENDOR, + REENROLL_REQUIRED, +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/FaceSensorType.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/FaceSensorType.aidl new file mode 100644 index 0000000000..bf1677ceec --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/FaceSensorType.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.biometrics.face; +@Backing(type="byte") @VintfStability +enum FaceSensorType { + UNKNOWN, + RGB, + IR, +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/Feature.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/Feature.aidl new file mode 100644 index 0000000000..924e6af44e --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/Feature.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.biometrics.face; +@Backing(type="byte") @VintfStability +enum Feature { + REQUIRE_ATTENTION, + REQUIRE_DIVERSE_POSES, + DEBUG, +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/IFace.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/IFace.aidl new file mode 100644 index 0000000000..fc4a4d04bb --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/IFace.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.biometrics.face; +@VintfStability +interface IFace { + android.hardware.biometrics.face.SensorProps[] getSensorProps(); + android.hardware.biometrics.face.ISession createSession(in int sensorId, in int userId, in android.hardware.biometrics.face.ISessionCallback cb); +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/ISession.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/ISession.aidl new file mode 100644 index 0000000000..366553485a --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/ISession.aidl @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2021 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 -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.hardware.biometrics.face; +@VintfStability +interface ISession { + void generateChallenge(); + void revokeChallenge(in long challenge); + android.hardware.biometrics.face.EnrollmentStageConfig[] getEnrollmentConfig(in android.hardware.biometrics.face.EnrollmentType enrollmentType); + android.hardware.biometrics.common.ICancellationSignal enroll(in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.biometrics.face.EnrollmentType type, in android.hardware.biometrics.face.Feature[] features, in @nullable android.hardware.common.NativeHandle previewSurface); + android.hardware.biometrics.common.ICancellationSignal authenticate(in long operationId); + android.hardware.biometrics.common.ICancellationSignal detectInteraction(); + void enumerateEnrollments(); + void removeEnrollments(in int[] enrollmentIds); + void getFeatures(); + void setFeature(in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.biometrics.face.Feature feature, boolean enabled); + void getAuthenticatorId(); + void invalidateAuthenticatorId(); + void resetLockout(in android.hardware.keymaster.HardwareAuthToken hat); + void close(); + android.hardware.biometrics.common.ICancellationSignal authenticateWithContext(in long operationId, in android.hardware.biometrics.common.OperationContext context); + android.hardware.biometrics.common.ICancellationSignal enrollWithContext(in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.biometrics.face.EnrollmentType type, in android.hardware.biometrics.face.Feature[] features, in @nullable android.hardware.common.NativeHandle previewSurface, in android.hardware.biometrics.common.OperationContext context); + android.hardware.biometrics.common.ICancellationSignal detectInteractionWithContext(in android.hardware.biometrics.common.OperationContext context); + void onContextChanged(in android.hardware.biometrics.common.OperationContext context); +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/ISessionCallback.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/ISessionCallback.aidl new file mode 100644 index 0000000000..bbace29aa0 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/ISessionCallback.aidl @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2021 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 -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.hardware.biometrics.face; +@VintfStability +interface ISessionCallback { + void onChallengeGenerated(in long challenge); + void onChallengeRevoked(in long challenge); + void onAuthenticationFrame(in android.hardware.biometrics.face.AuthenticationFrame frame); + void onEnrollmentFrame(in android.hardware.biometrics.face.EnrollmentFrame frame); + void onError(in android.hardware.biometrics.face.Error error, in int vendorCode); + void onEnrollmentProgress(in int enrollmentId, int remaining); + void onAuthenticationSucceeded(in int enrollmentId, in android.hardware.keymaster.HardwareAuthToken hat); + void onAuthenticationFailed(); + void onLockoutTimed(in long durationMillis); + void onLockoutPermanent(); + void onLockoutCleared(); + void onInteractionDetected(); + void onEnrollmentsEnumerated(in int[] enrollmentIds); + void onFeaturesRetrieved(in android.hardware.biometrics.face.Feature[] features); + void onFeatureSet(android.hardware.biometrics.face.Feature feature); + void onEnrollmentsRemoved(in int[] enrollmentIds); + void onAuthenticatorIdRetrieved(in long authenticatorId); + void onAuthenticatorIdInvalidated(in long newAuthenticatorId); + void onSessionClosed(); +} diff --git a/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/SensorProps.aidl b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/SensorProps.aidl new file mode 100644 index 0000000000..8b3c51bb12 --- /dev/null +++ b/biometrics/face/aidl/aidl_api/android.hardware.biometrics.face/3/android/hardware/biometrics/face/SensorProps.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2021 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 -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.hardware.biometrics.face; +@VintfStability +parcelable SensorProps { + android.hardware.biometrics.common.CommonProps commonProps; + android.hardware.biometrics.face.FaceSensorType sensorType = android.hardware.biometrics.face.FaceSensorType.UNKNOWN; + boolean halControlsPreview; + int previewDisplayId; + int enrollPreviewWidth; + int enrollPreviewHeight; + float enrollTranslationX; + float enrollTranslationY; + float enrollPreviewScale; + boolean supportsDetectInteraction; +} diff --git a/biometrics/fingerprint/aidl/Android.bp b/biometrics/fingerprint/aidl/Android.bp index f749822e52..c543a93f08 100644 --- a/biometrics/fingerprint/aidl/Android.bp +++ b/biometrics/fingerprint/aidl/Android.bp @@ -41,5 +41,14 @@ aidl_interface { "android.hardware.keymaster-V3", ], }, + { + version: "3", + imports: [ + "android.hardware.biometrics.common-V3", + "android.hardware.keymaster-V4", + ], + }, + ], + frozen: true, } diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/.hash b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/.hash new file mode 100644 index 0000000000..34b605dd72 --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/.hash @@ -0,0 +1 @@ +637371b53fb7faf9bd43aa51b72c23852d6e6d96 diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl new file mode 100644 index 0000000000..7075f715fd --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2020 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 -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.hardware.biometrics.fingerprint; +/* @hide */ +@Backing(type="byte") @VintfStability +enum AcquiredInfo { + UNKNOWN, + GOOD, + PARTIAL, + INSUFFICIENT, + SENSOR_DIRTY, + TOO_SLOW, + TOO_FAST, + VENDOR, + START, + TOO_DARK, + TOO_BRIGHT, + IMMOBILE, + RETRYING_CAPTURE, + LIFT_TOO_SOON, + POWER_PRESS, +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/Error.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/Error.aidl new file mode 100644 index 0000000000..9eeaac53ec --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/Error.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2020 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 -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.hardware.biometrics.fingerprint; +/* @hide */ +@Backing(type="byte") @VintfStability +enum Error { + UNKNOWN, + HW_UNAVAILABLE, + UNABLE_TO_PROCESS, + TIMEOUT, + NO_SPACE, + CANCELED, + UNABLE_TO_REMOVE, + VENDOR, + BAD_CALIBRATION, + POWER_PRESS, +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl new file mode 100644 index 0000000000..381aaf7365 --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/FingerprintSensorType.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2020 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 -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.hardware.biometrics.fingerprint; +/* @hide */ +@Backing(type="byte") @VintfStability +enum FingerprintSensorType { + UNKNOWN, + REAR, + UNDER_DISPLAY_ULTRASONIC, + UNDER_DISPLAY_OPTICAL, + POWER_BUTTON, + HOME_BUTTON, +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/IFingerprint.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/IFingerprint.aidl new file mode 100644 index 0000000000..0b6f3008ac --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/IFingerprint.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2020 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 -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.hardware.biometrics.fingerprint; +/* @hide */ +@VintfStability +interface IFingerprint { + android.hardware.biometrics.fingerprint.SensorProps[] getSensorProps(); + android.hardware.biometrics.fingerprint.ISession createSession(in int sensorId, in int userId, in android.hardware.biometrics.fingerprint.ISessionCallback cb); +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/ISession.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/ISession.aidl new file mode 100644 index 0000000000..4fdcefc8ff --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/ISession.aidl @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2020 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 -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.hardware.biometrics.fingerprint; +/* @hide */ +@VintfStability +interface ISession { + void generateChallenge(); + void revokeChallenge(in long challenge); + android.hardware.biometrics.common.ICancellationSignal enroll(in android.hardware.keymaster.HardwareAuthToken hat); + android.hardware.biometrics.common.ICancellationSignal authenticate(in long operationId); + android.hardware.biometrics.common.ICancellationSignal detectInteraction(); + void enumerateEnrollments(); + void removeEnrollments(in int[] enrollmentIds); + void getAuthenticatorId(); + void invalidateAuthenticatorId(); + void resetLockout(in android.hardware.keymaster.HardwareAuthToken hat); + void close(); + /** + * @deprecated use onPointerDownWithContext instead. + */ + void onPointerDown(in int pointerId, in int x, in int y, in float minor, in float major); + /** + * @deprecated use onPointerUpWithContext instead. + */ + void onPointerUp(in int pointerId); + void onUiReady(); + android.hardware.biometrics.common.ICancellationSignal authenticateWithContext(in long operationId, in android.hardware.biometrics.common.OperationContext context); + android.hardware.biometrics.common.ICancellationSignal enrollWithContext(in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.biometrics.common.OperationContext context); + android.hardware.biometrics.common.ICancellationSignal detectInteractionWithContext(in android.hardware.biometrics.common.OperationContext context); + void onPointerDownWithContext(in android.hardware.biometrics.fingerprint.PointerContext context); + void onPointerUpWithContext(in android.hardware.biometrics.fingerprint.PointerContext context); + void onContextChanged(in android.hardware.biometrics.common.OperationContext context); + void onPointerCancelWithContext(in android.hardware.biometrics.fingerprint.PointerContext context); + void setIgnoreDisplayTouches(in boolean shouldIgnore); +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/ISessionCallback.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/ISessionCallback.aidl new file mode 100644 index 0000000000..be18ffed1a --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/ISessionCallback.aidl @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2020 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 -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.hardware.biometrics.fingerprint; +/* @hide */ +@VintfStability +interface ISessionCallback { + void onChallengeGenerated(in long challenge); + void onChallengeRevoked(in long challenge); + void onAcquired(in android.hardware.biometrics.fingerprint.AcquiredInfo info, in int vendorCode); + void onError(in android.hardware.biometrics.fingerprint.Error error, in int vendorCode); + void onEnrollmentProgress(in int enrollmentId, int remaining); + void onAuthenticationSucceeded(in int enrollmentId, in android.hardware.keymaster.HardwareAuthToken hat); + void onAuthenticationFailed(); + void onLockoutTimed(in long durationMillis); + void onLockoutPermanent(); + void onLockoutCleared(); + void onInteractionDetected(); + void onEnrollmentsEnumerated(in int[] enrollmentIds); + void onEnrollmentsRemoved(in int[] enrollmentIds); + void onAuthenticatorIdRetrieved(in long authenticatorId); + void onAuthenticatorIdInvalidated(in long newAuthenticatorId); + void onSessionClosed(); +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/PointerContext.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/PointerContext.aidl new file mode 100644 index 0000000000..d9bf0854ca --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/PointerContext.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2021 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 -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.hardware.biometrics.fingerprint; +/* @hide */ +@JavaDerive(equals=true) @VintfStability +parcelable PointerContext { + int pointerId = (-1) /* -1 */; + float x = 0f; + float y = 0f; + float minor = 0f; + float major = 0f; + float orientation = 0f; + boolean isAod = false; + long time = 0; + long gestureStart = 0; +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/SensorLocation.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/SensorLocation.aidl new file mode 100644 index 0000000000..965576e822 --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/SensorLocation.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2021 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 -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.hardware.biometrics.fingerprint; +/* @hide */ +@VintfStability +parcelable SensorLocation { + /** + * @deprecated use the display field instead. This field was never used. + */ + int displayId; + int sensorLocationX; + int sensorLocationY; + int sensorRadius; + String display = ""; + android.hardware.biometrics.fingerprint.SensorShape sensorShape = android.hardware.biometrics.fingerprint.SensorShape.CIRCLE; +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/SensorProps.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/SensorProps.aidl new file mode 100644 index 0000000000..a97d819dba --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/SensorProps.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2020 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 -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.hardware.biometrics.fingerprint; +/* @hide */ +@VintfStability +parcelable SensorProps { + android.hardware.biometrics.common.CommonProps commonProps; + android.hardware.biometrics.fingerprint.FingerprintSensorType sensorType = android.hardware.biometrics.fingerprint.FingerprintSensorType.UNKNOWN; + android.hardware.biometrics.fingerprint.SensorLocation[] sensorLocations; + boolean supportsNavigationGestures; + boolean supportsDetectInteraction; + boolean halHandlesDisplayTouches; + boolean halControlsIllumination; + @nullable android.hardware.biometrics.fingerprint.TouchDetectionParameters touchDetectionParameters; +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/SensorShape.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/SensorShape.aidl new file mode 100644 index 0000000000..f673b1c806 --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/SensorShape.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.biometrics.fingerprint; +/* @hide */ +@Backing(type="byte") @VintfStability +enum SensorShape { + SQUARE, + CIRCLE, +} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/TouchDetectionParameters.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/TouchDetectionParameters.aidl new file mode 100644 index 0000000000..2e3ec4f574 --- /dev/null +++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/3/android/hardware/biometrics/fingerprint/TouchDetectionParameters.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.biometrics.fingerprint; +/* @hide */ +@VintfStability +parcelable TouchDetectionParameters { + float targetSize = 1.0f; + float minOverlap = 0.0f; +} diff --git a/bluetooth/aidl/Android.bp b/bluetooth/aidl/Android.bp index 1788ed372c..c6a592f5dc 100644 --- a/bluetooth/aidl/Android.bp +++ b/bluetooth/aidl/Android.bp @@ -34,4 +34,12 @@ aidl_interface { min_sdk_version: "33", }, }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + frozen: true, + } diff --git a/bluetooth/aidl/aidl_api/android.hardware.bluetooth/1/.hash b/bluetooth/aidl/aidl_api/android.hardware.bluetooth/1/.hash new file mode 100644 index 0000000000..e5ef0bff26 --- /dev/null +++ b/bluetooth/aidl/aidl_api/android.hardware.bluetooth/1/.hash @@ -0,0 +1 @@ +f0eb2eb6d3b970cef8fb1b6e22c4ec39a4da5119 diff --git a/bluetooth/aidl/aidl_api/android.hardware.bluetooth/1/android/hardware/bluetooth/IBluetoothHci.aidl b/bluetooth/aidl/aidl_api/android.hardware.bluetooth/1/android/hardware/bluetooth/IBluetoothHci.aidl new file mode 100644 index 0000000000..8b1cad2775 --- /dev/null +++ b/bluetooth/aidl/aidl_api/android.hardware.bluetooth/1/android/hardware/bluetooth/IBluetoothHci.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.bluetooth; +@VintfStability +interface IBluetoothHci { + void close(); + void initialize(in android.hardware.bluetooth.IBluetoothHciCallbacks callback); + void sendAclData(in byte[] data); + void sendHciCommand(in byte[] command); + void sendIsoData(in byte[] data); + void sendScoData(in byte[] data); +} diff --git a/bluetooth/aidl/aidl_api/android.hardware.bluetooth/1/android/hardware/bluetooth/IBluetoothHciCallbacks.aidl b/bluetooth/aidl/aidl_api/android.hardware.bluetooth/1/android/hardware/bluetooth/IBluetoothHciCallbacks.aidl new file mode 100644 index 0000000000..aecff7f2e3 --- /dev/null +++ b/bluetooth/aidl/aidl_api/android.hardware.bluetooth/1/android/hardware/bluetooth/IBluetoothHciCallbacks.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.bluetooth; +@VintfStability +interface IBluetoothHciCallbacks { + void aclDataReceived(in byte[] data); + void hciEventReceived(in byte[] event); + void initializationComplete(in android.hardware.bluetooth.Status status); + void isoDataReceived(in byte[] data); + void scoDataReceived(in byte[] data); +} diff --git a/bluetooth/aidl/aidl_api/android.hardware.bluetooth/1/android/hardware/bluetooth/Status.aidl b/bluetooth/aidl/aidl_api/android.hardware.bluetooth/1/android/hardware/bluetooth/Status.aidl new file mode 100644 index 0000000000..227224c7ac --- /dev/null +++ b/bluetooth/aidl/aidl_api/android.hardware.bluetooth/1/android/hardware/bluetooth/Status.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.bluetooth; +@Backing(type="int") @VintfStability +enum Status { + SUCCESS, + ALREADY_INITIALIZED, + UNABLE_TO_OPEN_INTERFACE, + HARDWARE_INITIALIZATION_ERROR, + UNKNOWN, +} diff --git a/bluetooth/audio/aidl/Android.bp b/bluetooth/audio/aidl/Android.bp index 618141f8ca..32f8cca7d2 100644 --- a/bluetooth/audio/aidl/Android.bp +++ b/bluetooth/audio/aidl/Android.bp @@ -64,7 +64,16 @@ aidl_interface { "android.hardware.audio.common-V1", ], }, + { + version: "3", + imports: [ + "android.hardware.common-V2", + "android.hardware.common.fmq-V1", + "android.hardware.audio.common-V1", + ], + }, ], + frozen: true, } diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/.hash b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/.hash new file mode 100644 index 0000000000..36a90add45 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/.hash @@ -0,0 +1 @@ +fead4df60244a5440283617064f184690414a685 diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AacCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AacCapabilities.aidl new file mode 100644 index 0000000000..e548cd326a --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AacCapabilities.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable AacCapabilities { + android.hardware.bluetooth.audio.AacObjectType[] objectType; + int[] sampleRateHz; + android.hardware.bluetooth.audio.ChannelMode[] channelMode; + boolean variableBitRateSupported; + byte[] bitsPerSample; + boolean adaptiveBitRateSupported; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AacConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AacConfiguration.aidl new file mode 100644 index 0000000000..29ab8ce3d0 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AacConfiguration.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable AacConfiguration { + android.hardware.bluetooth.audio.AacObjectType objectType; + int sampleRateHz; + android.hardware.bluetooth.audio.ChannelMode channelMode; + boolean variableBitRateEnabled; + byte bitsPerSample; + boolean adaptiveBitRateSupported; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AacObjectType.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AacObjectType.aidl new file mode 100644 index 0000000000..418dd7a6a5 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AacObjectType.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.bluetooth.audio; +@Backing(type="byte") @VintfStability +enum AacObjectType { + MPEG2_LC, + MPEG4_LC, + MPEG4_LTP, + MPEG4_SCALABLE, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveCapabilities.aidl new file mode 100644 index 0000000000..4e5dfe66c2 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveCapabilities.aidl @@ -0,0 +1,46 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable AptxAdaptiveCapabilities { + int[] sampleRateHz; + android.hardware.bluetooth.audio.AptxAdaptiveChannelMode[] channelMode; + byte[] bitsPerSample; + android.hardware.bluetooth.audio.AptxMode[] aptxMode; + android.hardware.bluetooth.audio.AptxSinkBuffering sinkBufferingMs; + android.hardware.bluetooth.audio.AptxAdaptiveTimeToPlay ttp; + android.hardware.bluetooth.audio.AptxAdaptiveInputMode inputMode; + int inputFadeDurationMs; + byte[] aptxAdaptiveConfigStream; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveChannelMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveChannelMode.aidl new file mode 100644 index 0000000000..675f9f2d23 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveChannelMode.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.bluetooth.audio; +@Backing(type="int") @VintfStability +enum AptxAdaptiveChannelMode { + JOINT_STEREO = 0, + MONO = 1, + DUAL_MONO = 2, + TWS_STEREO = 4, + UNKNOWN = 0xFF, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveConfiguration.aidl new file mode 100644 index 0000000000..aab05213b4 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveConfiguration.aidl @@ -0,0 +1,46 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable AptxAdaptiveConfiguration { + int sampleRateHz; + android.hardware.bluetooth.audio.AptxAdaptiveChannelMode channelMode; + byte bitsPerSample; + android.hardware.bluetooth.audio.AptxMode aptxMode; + android.hardware.bluetooth.audio.AptxSinkBuffering sinkBufferingMs; + android.hardware.bluetooth.audio.AptxAdaptiveTimeToPlay ttp; + android.hardware.bluetooth.audio.AptxAdaptiveInputMode inputMode; + int inputFadeDurationMs; + byte[] aptxAdaptiveConfigStream; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveInputMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveInputMode.aidl new file mode 100644 index 0000000000..a18303ed75 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveInputMode.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.bluetooth.audio; +@Backing(type="int") @VintfStability +enum AptxAdaptiveInputMode { + STEREO = 0x00, + DUAL_MONO = 0x01, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveLeCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveLeCapabilities.aidl new file mode 100644 index 0000000000..c9d3cde671 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveLeCapabilities.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable AptxAdaptiveLeCapabilities { + byte[] pcmBitDepth; + int[] samplingFrequencyHz; + int[] frameDurationUs; + int[] octetsPerFrame; + byte[] blocksPerSdu; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveLeConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveLeConfiguration.aidl new file mode 100644 index 0000000000..76df4edba1 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveLeConfiguration.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable AptxAdaptiveLeConfiguration { + byte pcmBitDepth; + int samplingFrequencyHz; + int frameDurationUs; + int octetsPerFrame; + byte blocksPerSdu; + int codecMode; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveTimeToPlay.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveTimeToPlay.aidl new file mode 100644 index 0000000000..35606667cb --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxAdaptiveTimeToPlay.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable AptxAdaptiveTimeToPlay { + byte lowLowLatency; + byte highLowLatency; + byte lowHighQuality; + byte highHighQuality; + byte lowTws; + byte highTws; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxCapabilities.aidl new file mode 100644 index 0000000000..08a38e26e1 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxCapabilities.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable AptxCapabilities { + int[] sampleRateHz; + android.hardware.bluetooth.audio.ChannelMode[] channelMode; + byte[] bitsPerSample; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxConfiguration.aidl new file mode 100644 index 0000000000..91e88b32f3 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxConfiguration.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable AptxConfiguration { + int sampleRateHz; + android.hardware.bluetooth.audio.ChannelMode channelMode; + byte bitsPerSample; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxMode.aidl new file mode 100644 index 0000000000..dd8cf08c39 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxMode.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.bluetooth.audio; +@Backing(type="int") @VintfStability +enum AptxMode { + UNKNOWN = 0x00, + HIGH_QUALITY = 0x1000, + LOW_LATENCY = 0x2000, + ULTRA_LOW_LATENCY = 0x4000, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxSinkBuffering.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxSinkBuffering.aidl new file mode 100644 index 0000000000..527418e308 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AptxSinkBuffering.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable AptxSinkBuffering { + byte minLowLatency; + byte maxLowLatency; + byte minHighQuality; + byte maxHighQuality; + byte minTws; + byte maxTws; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AudioCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AudioCapabilities.aidl new file mode 100644 index 0000000000..8ae716ff23 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AudioCapabilities.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +union AudioCapabilities { + android.hardware.bluetooth.audio.PcmCapabilities pcmCapabilities; + android.hardware.bluetooth.audio.CodecCapabilities a2dpCapabilities; + android.hardware.bluetooth.audio.LeAudioCodecCapabilitiesSetting leAudioCapabilities; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AudioConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AudioConfiguration.aidl new file mode 100644 index 0000000000..3abfb31b7b --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AudioConfiguration.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +union AudioConfiguration { + android.hardware.bluetooth.audio.PcmConfiguration pcmConfig; + android.hardware.bluetooth.audio.CodecConfiguration a2dpConfig; + android.hardware.bluetooth.audio.LeAudioConfiguration leAudioConfig; + android.hardware.bluetooth.audio.LeAudioBroadcastConfiguration leAudioBroadcastConfig; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AudioLocation.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AudioLocation.aidl new file mode 100644 index 0000000000..941344cdbe --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/AudioLocation.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@Backing(type="int") @VintfStability +enum AudioLocation { + UNKNOWN = 1, + FRONT_LEFT = (1 << 1) /* 2 */, + FRONT_RIGHT = (1 << 2) /* 4 */, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl new file mode 100644 index 0000000000..c20c057626 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/BluetoothAudioStatus.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@Backing(type="int") @VintfStability +enum BluetoothAudioStatus { + UNKNOWN = 0, + SUCCESS = 1, + UNSUPPORTED_CODEC_CONFIGURATION = 2, + FAILURE = 3, + RECONFIGURATION = 4, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/BroadcastCapability.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/BroadcastCapability.aidl new file mode 100644 index 0000000000..58710effe7 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/BroadcastCapability.aidl @@ -0,0 +1,50 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable BroadcastCapability { + android.hardware.bluetooth.audio.CodecType codecType; + android.hardware.bluetooth.audio.AudioLocation supportedChannel; + int channelCountPerStream; + android.hardware.bluetooth.audio.BroadcastCapability.LeAudioCodecCapabilities leAudioCodecCapabilities; + @VintfStability + parcelable VendorCapabilities { + ParcelableHolder extension; + } + @VintfStability + union LeAudioCodecCapabilities { + @nullable android.hardware.bluetooth.audio.Lc3Capabilities[] lc3Capabilities; + @nullable android.hardware.bluetooth.audio.BroadcastCapability.VendorCapabilities[] vendorCapabillities; + } +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/ChannelMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/ChannelMode.aidl new file mode 100644 index 0000000000..2bb5cd8e8b --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/ChannelMode.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@Backing(type="byte") @VintfStability +enum ChannelMode { + UNKNOWN, + MONO, + STEREO, + DUALMONO, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/CodecCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/CodecCapabilities.aidl new file mode 100644 index 0000000000..b00649a62d --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/CodecCapabilities.aidl @@ -0,0 +1,54 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable CodecCapabilities { + android.hardware.bluetooth.audio.CodecType codecType; + android.hardware.bluetooth.audio.CodecCapabilities.Capabilities capabilities; + @VintfStability + parcelable VendorCapabilities { + ParcelableHolder extension; + } + @VintfStability + union Capabilities { + android.hardware.bluetooth.audio.SbcCapabilities sbcCapabilities; + android.hardware.bluetooth.audio.AacCapabilities aacCapabilities; + android.hardware.bluetooth.audio.LdacCapabilities ldacCapabilities; + android.hardware.bluetooth.audio.AptxCapabilities aptxCapabilities; + android.hardware.bluetooth.audio.AptxAdaptiveCapabilities aptxAdaptiveCapabilities; + android.hardware.bluetooth.audio.Lc3Capabilities lc3Capabilities; + android.hardware.bluetooth.audio.CodecCapabilities.VendorCapabilities vendorCapabilities; + @nullable android.hardware.bluetooth.audio.OpusCapabilities opusCapabilities; + } +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/CodecConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/CodecConfiguration.aidl new file mode 100644 index 0000000000..7f5ea48d8a --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/CodecConfiguration.aidl @@ -0,0 +1,59 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable CodecConfiguration { + android.hardware.bluetooth.audio.CodecType codecType; + int encodedAudioBitrate; + int peerMtu; + boolean isScmstEnabled; + android.hardware.bluetooth.audio.CodecConfiguration.CodecSpecific config; + @VintfStability + parcelable VendorConfiguration { + int vendorId; + char codecId; + ParcelableHolder codecConfig; + } + @VintfStability + union CodecSpecific { + android.hardware.bluetooth.audio.SbcConfiguration sbcConfig; + android.hardware.bluetooth.audio.AacConfiguration aacConfig; + android.hardware.bluetooth.audio.LdacConfiguration ldacConfig; + android.hardware.bluetooth.audio.AptxConfiguration aptxConfig; + android.hardware.bluetooth.audio.AptxAdaptiveConfiguration aptxAdaptiveConfig; + android.hardware.bluetooth.audio.Lc3Configuration lc3Config; + android.hardware.bluetooth.audio.CodecConfiguration.VendorConfiguration vendorConfig; + @nullable android.hardware.bluetooth.audio.OpusConfiguration opusConfig; + } +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/CodecType.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/CodecType.aidl new file mode 100644 index 0000000000..d4f205e365 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/CodecType.aidl @@ -0,0 +1,49 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@Backing(type="int") @VintfStability +enum CodecType { + UNKNOWN, + SBC, + AAC, + APTX, + APTX_HD, + LDAC, + LC3, + VENDOR, + APTX_ADAPTIVE, + OPUS, + APTX_ADAPTIVE_LE, + APTX_ADAPTIVE_LEX, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/IBluetoothAudioPort.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/IBluetoothAudioPort.aidl new file mode 100644 index 0000000000..d364371707 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/IBluetoothAudioPort.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +interface IBluetoothAudioPort { + android.hardware.bluetooth.audio.PresentationPosition getPresentationPosition(); + void startStream(boolean isLowLatency); + void stopStream(); + void suspendStream(); + void updateSourceMetadata(in android.hardware.audio.common.SourceMetadata sourceMetadata); + void updateSinkMetadata(in android.hardware.audio.common.SinkMetadata sinkMetadata); + void setLatencyMode(in android.hardware.bluetooth.audio.LatencyMode latencyMode); +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl new file mode 100644 index 0000000000..267af0f4b4 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +interface IBluetoothAudioProvider { + void endSession(); + android.hardware.common.fmq.MQDescriptor startSession(in android.hardware.bluetooth.audio.IBluetoothAudioPort hostIf, in android.hardware.bluetooth.audio.AudioConfiguration audioConfig, in android.hardware.bluetooth.audio.LatencyMode[] supportedLatencyModes); + void streamStarted(in android.hardware.bluetooth.audio.BluetoothAudioStatus status); + void streamSuspended(in android.hardware.bluetooth.audio.BluetoothAudioStatus status); + void updateAudioConfiguration(in android.hardware.bluetooth.audio.AudioConfiguration audioConfig); + void setLowLatencyModeAllowed(in boolean allowed); +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/IBluetoothAudioProviderFactory.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/IBluetoothAudioProviderFactory.aidl new file mode 100644 index 0000000000..5e33deb856 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/IBluetoothAudioProviderFactory.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +interface IBluetoothAudioProviderFactory { + android.hardware.bluetooth.audio.AudioCapabilities[] getProviderCapabilities(in android.hardware.bluetooth.audio.SessionType sessionType); + android.hardware.bluetooth.audio.IBluetoothAudioProvider openProvider(in android.hardware.bluetooth.audio.SessionType sessionType); +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LatencyMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LatencyMode.aidl new file mode 100644 index 0000000000..1140f9e90b --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LatencyMode.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.bluetooth.audio; +@Backing(type="int") @VintfStability +enum LatencyMode { + UNKNOWN, + LOW_LATENCY, + FREE, + DYNAMIC_SPATIAL_AUDIO_SOFTWARE, + DYNAMIC_SPATIAL_AUDIO_HARDWARE, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/Lc3Capabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/Lc3Capabilities.aidl new file mode 100644 index 0000000000..cc4449aea9 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/Lc3Capabilities.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable Lc3Capabilities { + byte[] pcmBitDepth; + int[] samplingFrequencyHz; + int[] frameDurationUs; + int[] octetsPerFrame; + byte[] blocksPerSdu; + android.hardware.bluetooth.audio.ChannelMode[] channelMode; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/Lc3Configuration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/Lc3Configuration.aidl new file mode 100644 index 0000000000..7e8dccff5f --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/Lc3Configuration.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable Lc3Configuration { + byte pcmBitDepth; + int samplingFrequencyHz; + int frameDurationUs; + int octetsPerFrame; + byte blocksPerSdu; + android.hardware.bluetooth.audio.ChannelMode channelMode; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LdacCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LdacCapabilities.aidl new file mode 100644 index 0000000000..aa4e4c8793 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LdacCapabilities.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable LdacCapabilities { + int[] sampleRateHz; + android.hardware.bluetooth.audio.LdacChannelMode[] channelMode; + android.hardware.bluetooth.audio.LdacQualityIndex[] qualityIndex; + byte[] bitsPerSample; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LdacChannelMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LdacChannelMode.aidl new file mode 100644 index 0000000000..3d80c4b127 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LdacChannelMode.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@Backing(type="byte") @VintfStability +enum LdacChannelMode { + UNKNOWN, + STEREO, + DUAL, + MONO, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LdacConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LdacConfiguration.aidl new file mode 100644 index 0000000000..8a3763800b --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LdacConfiguration.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable LdacConfiguration { + int sampleRateHz; + android.hardware.bluetooth.audio.LdacChannelMode channelMode; + android.hardware.bluetooth.audio.LdacQualityIndex qualityIndex; + byte bitsPerSample; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LdacQualityIndex.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LdacQualityIndex.aidl new file mode 100644 index 0000000000..a332dc5103 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LdacQualityIndex.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@Backing(type="byte") @VintfStability +enum LdacQualityIndex { + HIGH, + MID, + LOW, + ABR, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl new file mode 100644 index 0000000000..2945710c26 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LeAudioBroadcastConfiguration.aidl @@ -0,0 +1,46 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable LeAudioBroadcastConfiguration { + android.hardware.bluetooth.audio.CodecType codecType; + android.hardware.bluetooth.audio.LeAudioBroadcastConfiguration.BroadcastStreamMap[] streamMap; + @VintfStability + parcelable BroadcastStreamMap { + char streamHandle; + int audioChannelAllocation; + android.hardware.bluetooth.audio.LeAudioCodecConfiguration leAudioCodecConfig; + char pcmStreamId; + } +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LeAudioCodecCapabilitiesSetting.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LeAudioCodecCapabilitiesSetting.aidl new file mode 100644 index 0000000000..9818d543ac --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LeAudioCodecCapabilitiesSetting.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable LeAudioCodecCapabilitiesSetting { + android.hardware.bluetooth.audio.UnicastCapability unicastEncodeCapability; + android.hardware.bluetooth.audio.UnicastCapability unicastDecodeCapability; + android.hardware.bluetooth.audio.BroadcastCapability broadcastCapability; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LeAudioCodecConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LeAudioCodecConfiguration.aidl new file mode 100644 index 0000000000..031ee679ac --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LeAudioCodecConfiguration.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +union LeAudioCodecConfiguration { + android.hardware.bluetooth.audio.Lc3Configuration lc3Config; + android.hardware.bluetooth.audio.LeAudioCodecConfiguration.VendorConfiguration vendorConfig; + android.hardware.bluetooth.audio.AptxAdaptiveLeConfiguration aptxAdaptiveLeConfig; + @VintfStability + parcelable VendorConfiguration { + ParcelableHolder extension; + } +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl new file mode 100644 index 0000000000..2d9ebae9f4 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/LeAudioConfiguration.aidl @@ -0,0 +1,48 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable LeAudioConfiguration { + android.hardware.bluetooth.audio.CodecType codecType; + android.hardware.bluetooth.audio.LeAudioConfiguration.StreamMap[] streamMap; + int peerDelayUs; + android.hardware.bluetooth.audio.LeAudioCodecConfiguration leAudioCodecConfig; + @nullable byte[] vendorSpecificMetadata; + @VintfStability + parcelable StreamMap { + char streamHandle; + int audioChannelAllocation; + boolean isStreamActive; + } +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/OpusCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/OpusCapabilities.aidl new file mode 100644 index 0000000000..2c04b0f3bb --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/OpusCapabilities.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable OpusCapabilities { + byte[] pcmBitDepth; + int[] samplingFrequencyHz; + int[] frameDurationUs; + int[] octetsPerFrame; + byte[] blocksPerSdu; + android.hardware.bluetooth.audio.ChannelMode[] channelMode; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/OpusConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/OpusConfiguration.aidl new file mode 100644 index 0000000000..811d32a7ea --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/OpusConfiguration.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable OpusConfiguration { + byte pcmBitDepth; + int samplingFrequencyHz; + int frameDurationUs; + int octetsPerFrame; + byte blocksPerSdu; + android.hardware.bluetooth.audio.ChannelMode channelMode; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/PcmCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/PcmCapabilities.aidl new file mode 100644 index 0000000000..0c2f87d599 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/PcmCapabilities.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable PcmCapabilities { + int[] sampleRateHz; + android.hardware.bluetooth.audio.ChannelMode[] channelMode; + byte[] bitsPerSample; + int[] dataIntervalUs; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/PcmConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/PcmConfiguration.aidl new file mode 100644 index 0000000000..93d7805a33 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/PcmConfiguration.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable PcmConfiguration { + int sampleRateHz; + android.hardware.bluetooth.audio.ChannelMode channelMode; + byte bitsPerSample; + int dataIntervalUs; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/PresentationPosition.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/PresentationPosition.aidl new file mode 100644 index 0000000000..7e997e8c8f --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/PresentationPosition.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable PresentationPosition { + long remoteDeviceAudioDelayNanos; + long transmittedOctets; + android.hardware.bluetooth.audio.PresentationPosition.TimeSpec transmittedOctetsTimestamp; + @VintfStability + parcelable TimeSpec { + long tvSec; + long tvNSec; + } +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/SbcAllocMethod.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/SbcAllocMethod.aidl new file mode 100644 index 0000000000..9cf65d57ec --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/SbcAllocMethod.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@Backing(type="byte") @VintfStability +enum SbcAllocMethod { + ALLOC_MD_S, + ALLOC_MD_L, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/SbcCapabilities.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/SbcCapabilities.aidl new file mode 100644 index 0000000000..c8d7e7e74e --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/SbcCapabilities.aidl @@ -0,0 +1,45 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable SbcCapabilities { + int[] sampleRateHz; + android.hardware.bluetooth.audio.SbcChannelMode[] channelMode; + byte[] blockLength; + byte[] numSubbands; + android.hardware.bluetooth.audio.SbcAllocMethod[] allocMethod; + byte[] bitsPerSample; + int minBitpool; + int maxBitpool; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/SbcChannelMode.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/SbcChannelMode.aidl new file mode 100644 index 0000000000..7779aa052f --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/SbcChannelMode.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@Backing(type="byte") @VintfStability +enum SbcChannelMode { + UNKNOWN, + JOINT_STEREO, + STEREO, + DUAL, + MONO, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/SbcConfiguration.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/SbcConfiguration.aidl new file mode 100644 index 0000000000..8eab9c3d96 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/SbcConfiguration.aidl @@ -0,0 +1,45 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable SbcConfiguration { + int sampleRateHz; + android.hardware.bluetooth.audio.SbcChannelMode channelMode; + byte blockLength; + byte numSubbands; + android.hardware.bluetooth.audio.SbcAllocMethod allocMethod; + byte bitsPerSample; + int minBitpool; + int maxBitpool; +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/SessionType.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/SessionType.aidl new file mode 100644 index 0000000000..4b2c10f71d --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/SessionType.aidl @@ -0,0 +1,49 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@Backing(type="byte") @VintfStability +enum SessionType { + UNKNOWN, + A2DP_SOFTWARE_ENCODING_DATAPATH, + A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH, + HEARING_AID_SOFTWARE_ENCODING_DATAPATH, + LE_AUDIO_SOFTWARE_ENCODING_DATAPATH, + LE_AUDIO_SOFTWARE_DECODING_DATAPATH, + LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH, + LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH, + LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH, + LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH, + A2DP_SOFTWARE_DECODING_DATAPATH, + A2DP_HARDWARE_OFFLOAD_DECODING_DATAPATH, +} diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/UnicastCapability.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/UnicastCapability.aidl new file mode 100644 index 0000000000..894a2f3148 --- /dev/null +++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/3/android/hardware/bluetooth/audio/UnicastCapability.aidl @@ -0,0 +1,52 @@ +/* + * Copyright 2021 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 -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.hardware.bluetooth.audio; +@VintfStability +parcelable UnicastCapability { + android.hardware.bluetooth.audio.CodecType codecType; + android.hardware.bluetooth.audio.AudioLocation supportedChannel; + int deviceCount; + int channelCountPerDevice; + android.hardware.bluetooth.audio.UnicastCapability.LeAudioCodecCapabilities leAudioCodecCapabilities; + @VintfStability + parcelable VendorCapabilities { + ParcelableHolder extension; + } + @VintfStability + union LeAudioCodecCapabilities { + android.hardware.bluetooth.audio.Lc3Capabilities lc3Capabilities; + android.hardware.bluetooth.audio.UnicastCapability.VendorCapabilities vendorCapabillities; + android.hardware.bluetooth.audio.AptxAdaptiveLeCapabilities aptxAdaptiveLeCapabilities; + } +} diff --git a/boot/aidl/Android.bp b/boot/aidl/Android.bp index be382451f1..c2ba1b6272 100644 --- a/boot/aidl/Android.bp +++ b/boot/aidl/Android.bp @@ -37,4 +37,12 @@ aidl_interface { enabled: false, }, }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + frozen: true, + } diff --git a/boot/aidl/aidl_api/android.hardware.boot/1/.hash b/boot/aidl/aidl_api/android.hardware.boot/1/.hash new file mode 100644 index 0000000000..b6f1cb28f6 --- /dev/null +++ b/boot/aidl/aidl_api/android.hardware.boot/1/.hash @@ -0,0 +1 @@ +2400346954240a5de495a1debc81429dd012d7b7 diff --git a/boot/aidl/aidl_api/android.hardware.boot/1/android/hardware/boot/IBootControl.aidl b/boot/aidl/aidl_api/android.hardware.boot/1/android/hardware/boot/IBootControl.aidl new file mode 100644 index 0000000000..0c083f6e36 --- /dev/null +++ b/boot/aidl/aidl_api/android.hardware.boot/1/android/hardware/boot/IBootControl.aidl @@ -0,0 +1,50 @@ +// +// 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. +// +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.boot; +@VintfStability +interface IBootControl { + int getActiveBootSlot(); + int getCurrentSlot(); + int getNumberSlots(); + android.hardware.boot.MergeStatus getSnapshotMergeStatus(); + String getSuffix(in int slot); + boolean isSlotBootable(in int slot); + boolean isSlotMarkedSuccessful(in int slot); + void markBootSuccessful(); + void setActiveBootSlot(in int slot); + void setSlotAsUnbootable(in int slot); + void setSnapshotMergeStatus(in android.hardware.boot.MergeStatus status); + const int INVALID_SLOT = (-1) /* -1 */; + const int COMMAND_FAILED = (-2) /* -2 */; +} diff --git a/boot/aidl/aidl_api/android.hardware.boot/1/android/hardware/boot/MergeStatus.aidl b/boot/aidl/aidl_api/android.hardware.boot/1/android/hardware/boot/MergeStatus.aidl new file mode 100644 index 0000000000..cdf3f349b1 --- /dev/null +++ b/boot/aidl/aidl_api/android.hardware.boot/1/android/hardware/boot/MergeStatus.aidl @@ -0,0 +1,42 @@ +// +// 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. +// +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.boot; +@Backing(type="int") @VintfStability +enum MergeStatus { + NONE = 0, + UNKNOWN, + SNAPSHOTTED, + MERGING, + CANCELLED, +} diff --git a/broadcastradio/aidl/Android.bp b/broadcastradio/aidl/Android.bp index 2d8078b926..3f89029232 100644 --- a/broadcastradio/aidl/Android.bp +++ b/broadcastradio/aidl/Android.bp @@ -37,4 +37,12 @@ aidl_interface { min_sdk_version: "Tiramisu", }, }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + frozen: true, + } diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/.hash b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/.hash new file mode 100644 index 0000000000..41917fe3b3 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/.hash @@ -0,0 +1 @@ +3c864ddf392d28cfbf95849bedf0b753b81cc013 diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/AmFmBandRange.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/AmFmBandRange.aidl new file mode 100644 index 0000000000..ca511aa13a --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/AmFmBandRange.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable AmFmBandRange { + int lowerBound; + int upperBound; + int spacing; + int seekSpacing; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/AmFmRegionConfig.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/AmFmRegionConfig.aidl new file mode 100644 index 0000000000..b96def32f8 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/AmFmRegionConfig.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable AmFmRegionConfig { + android.hardware.broadcastradio.AmFmBandRange[] ranges; + int fmDeemphasis; + int fmRds; + const int DEEMPHASIS_D50 = (1 << 0) /* 1 */; + const int DEEMPHASIS_D75 = (1 << 1) /* 2 */; + const int RDS = (1 << 0) /* 1 */; + const int RBDS = (1 << 1) /* 2 */; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/Announcement.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/Announcement.aidl new file mode 100644 index 0000000000..bbdd86f7dc --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/Announcement.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable Announcement { + android.hardware.broadcastradio.ProgramSelector selector; + android.hardware.broadcastradio.AnnouncementType type = android.hardware.broadcastradio.AnnouncementType.INVALID; + android.hardware.broadcastradio.VendorKeyValue[] vendorInfo; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/AnnouncementType.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/AnnouncementType.aidl new file mode 100644 index 0000000000..1d187fe0b2 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/AnnouncementType.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@Backing(type="byte") @JavaDerive(equals=true, toString=true) @VintfStability +enum AnnouncementType { + INVALID = 0, + EMERGENCY = 1, + WARNING, + TRAFFIC, + WEATHER, + NEWS, + EVENT, + SPORT, + MISC, +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ConfigFlag.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ConfigFlag.aidl new file mode 100644 index 0000000000..98af437266 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ConfigFlag.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@Backing(type="int") @JavaDerive(equals=true, toString=true) @VintfStability +enum ConfigFlag { + FORCE_MONO = 1, + FORCE_ANALOG, + FORCE_DIGITAL, + RDS_AF, + RDS_REG, + DAB_DAB_LINKING, + DAB_FM_LINKING, + DAB_DAB_SOFT_LINKING, + DAB_FM_SOFT_LINKING, +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/DabTableEntry.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/DabTableEntry.aidl new file mode 100644 index 0000000000..162f4abd62 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/DabTableEntry.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable DabTableEntry { + String label; + int frequencyKhz; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/IAnnouncementListener.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/IAnnouncementListener.aidl new file mode 100644 index 0000000000..346af5807d --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/IAnnouncementListener.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@VintfStability +interface IAnnouncementListener { + oneway void onListUpdated(in android.hardware.broadcastradio.Announcement[] announcements); +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/IBroadcastRadio.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/IBroadcastRadio.aidl new file mode 100644 index 0000000000..39eb04c105 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/IBroadcastRadio.aidl @@ -0,0 +1,58 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@VintfStability +interface IBroadcastRadio { + android.hardware.broadcastradio.Properties getProperties(); + android.hardware.broadcastradio.AmFmRegionConfig getAmFmRegionConfig(in boolean full); + android.hardware.broadcastradio.DabTableEntry[] getDabRegionConfig(); + void setTunerCallback(in android.hardware.broadcastradio.ITunerCallback callback); + void unsetTunerCallback(); + void tune(in android.hardware.broadcastradio.ProgramSelector program); + void seek(in boolean directionUp, in boolean skipSubChannel); + void step(in boolean directionUp); + void cancel(); + void startProgramListUpdates(in android.hardware.broadcastradio.ProgramFilter filter); + void stopProgramListUpdates(); + boolean isConfigFlagSet(in android.hardware.broadcastradio.ConfigFlag flag); + void setConfigFlag(in android.hardware.broadcastradio.ConfigFlag flag, in boolean value); + android.hardware.broadcastradio.VendorKeyValue[] setParameters(in android.hardware.broadcastradio.VendorKeyValue[] parameters); + android.hardware.broadcastradio.VendorKeyValue[] getParameters(in String[] keys); + byte[] getImage(in int id); + android.hardware.broadcastradio.ICloseHandle registerAnnouncementListener(in android.hardware.broadcastradio.IAnnouncementListener listener, in android.hardware.broadcastradio.AnnouncementType[] enabled); + const int INVALID_IMAGE = 0; + const int ANTENNA_STATE_CHANGE_TIMEOUT_MS = 100; + const int LIST_COMPLETE_TIMEOUT_MS = 300000; + const int TUNER_TIMEOUT_MS = 30000; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ICloseHandle.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ICloseHandle.aidl new file mode 100644 index 0000000000..75e7f2a4c0 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ICloseHandle.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@VintfStability +interface ICloseHandle { + void close(); +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ITunerCallback.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ITunerCallback.aidl new file mode 100644 index 0000000000..f5badade46 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ITunerCallback.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@VintfStability +interface ITunerCallback { + oneway void onTuneFailed(in android.hardware.broadcastradio.Result result, in android.hardware.broadcastradio.ProgramSelector selector); + oneway void onCurrentProgramInfoChanged(in android.hardware.broadcastradio.ProgramInfo info); + oneway void onProgramListUpdated(in android.hardware.broadcastradio.ProgramListChunk chunk); + oneway void onAntennaStateChange(in boolean connected); + oneway void onConfigFlagUpdated(in android.hardware.broadcastradio.ConfigFlag flag, in boolean value); + oneway void onParametersUpdated(in android.hardware.broadcastradio.VendorKeyValue[] parameters); +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/IdentifierType.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/IdentifierType.aidl new file mode 100644 index 0000000000..63a0efd506 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/IdentifierType.aidl @@ -0,0 +1,52 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@Backing(type="int") @JavaDerive(equals=true, toString=true) @VintfStability +enum IdentifierType { + VENDOR_START = 1000, + VENDOR_END = 1999, + INVALID = 0, + AMFM_FREQUENCY_KHZ, + RDS_PI, + HD_STATION_ID_EXT, + HD_STATION_NAME, + DAB_SID_EXT, + DAB_ENSEMBLE, + DAB_SCID, + DAB_FREQUENCY_KHZ, + DRMO_SERVICE_ID, + DRMO_FREQUENCY_KHZ, + SXM_SERVICE_ID = (DRMO_FREQUENCY_KHZ + 2) /* 12 */, + SXM_CHANNEL, +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/Metadata.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/Metadata.aidl new file mode 100644 index 0000000000..e02b6b1bd0 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/Metadata.aidl @@ -0,0 +1,53 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +union Metadata { + String rdsPs; + int rdsPty; + int rbdsPty; + String rdsRt; + String songTitle; + String songArtist; + String songAlbum; + int stationIcon; + int albumArt; + String programName; + String dabEnsembleName; + String dabEnsembleNameShort; + String dabServiceName; + String dabServiceNameShort; + String dabComponentName; + String dabComponentNameShort; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ProgramFilter.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ProgramFilter.aidl new file mode 100644 index 0000000000..9edeb8d5c6 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ProgramFilter.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable ProgramFilter { + android.hardware.broadcastradio.IdentifierType[] identifierTypes; + android.hardware.broadcastradio.ProgramIdentifier[] identifiers; + boolean includeCategories; + boolean excludeModifications; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ProgramIdentifier.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ProgramIdentifier.aidl new file mode 100644 index 0000000000..66763508ad --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ProgramIdentifier.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable ProgramIdentifier { + android.hardware.broadcastradio.IdentifierType type = android.hardware.broadcastradio.IdentifierType.INVALID; + long value; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ProgramInfo.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ProgramInfo.aidl new file mode 100644 index 0000000000..335f060049 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ProgramInfo.aidl @@ -0,0 +1,51 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable ProgramInfo { + android.hardware.broadcastradio.ProgramSelector selector; + android.hardware.broadcastradio.ProgramIdentifier logicallyTunedTo; + android.hardware.broadcastradio.ProgramIdentifier physicallyTunedTo; + @nullable android.hardware.broadcastradio.ProgramIdentifier[] relatedContent; + int infoFlags; + int signalQuality; + android.hardware.broadcastradio.Metadata[] metadata; + android.hardware.broadcastradio.VendorKeyValue[] vendorInfo; + const int FLAG_LIVE = (1 << 0) /* 1 */; + const int FLAG_MUTED = (1 << 1) /* 2 */; + const int FLAG_TRAFFIC_PROGRAM = (1 << 2) /* 4 */; + const int FLAG_TRAFFIC_ANNOUNCEMENT = (1 << 3) /* 8 */; + const int FLAG_TUNABLE = (1 << 4) /* 16 */; + const int FLAG_STEREO = (1 << 5) /* 32 */; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ProgramListChunk.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ProgramListChunk.aidl new file mode 100644 index 0000000000..5d53b99302 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ProgramListChunk.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable ProgramListChunk { + boolean purge; + boolean complete; + android.hardware.broadcastradio.ProgramInfo[] modified; + @nullable android.hardware.broadcastradio.ProgramIdentifier[] removed; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ProgramSelector.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ProgramSelector.aidl new file mode 100644 index 0000000000..9af1dc8880 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/ProgramSelector.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable ProgramSelector { + android.hardware.broadcastradio.ProgramIdentifier primaryId; + android.hardware.broadcastradio.ProgramIdentifier[] secondaryIds; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/Properties.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/Properties.aidl new file mode 100644 index 0000000000..643b819d8a --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/Properties.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable Properties { + String maker; + String product; + String version; + String serial; + android.hardware.broadcastradio.IdentifierType[] supportedIdentifierTypes; + android.hardware.broadcastradio.VendorKeyValue[] vendorInfo; +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/Result.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/Result.aidl new file mode 100644 index 0000000000..b0fc018cb7 --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/Result.aidl @@ -0,0 +1,45 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@Backing(type="int") @JavaDerive(equals=true, toString=true) @VintfStability +enum Result { + OK = 0, + INTERNAL_ERROR, + INVALID_ARGUMENTS, + INVALID_STATE, + NOT_SUPPORTED, + TIMEOUT, + CANCELED, + UNKNOWN_ERROR, +} diff --git a/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/VendorKeyValue.aidl b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/VendorKeyValue.aidl new file mode 100644 index 0000000000..3c6b19438f --- /dev/null +++ b/broadcastradio/aidl/aidl_api/android.hardware.broadcastradio/1/android/hardware/broadcastradio/VendorKeyValue.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.broadcastradio; +@JavaDerive(equals=true, toString=true) @VintfStability +parcelable VendorKeyValue { + String key; + String value; +} diff --git a/camera/device/aidl/Android.bp b/camera/device/aidl/Android.bp index 00d9da026f..43a3934e74 100644 --- a/camera/device/aidl/Android.bp +++ b/camera/device/aidl/Android.bp @@ -11,7 +11,7 @@ aidl_interface { name: "android.hardware.camera.device", vendor_available: true, srcs: ["android/hardware/camera/device/*.aidl"], - frozen: false, + frozen: true, stability: "vintf", imports: [ "android.hardware.common-V2", @@ -40,6 +40,17 @@ aidl_interface { "android.hardware.graphics.common-V4", ], }, + { + version: "2", + imports: [ + "android.hardware.common-V2", + "android.hardware.common.fmq-V1", + "android.hardware.camera.common-V1", + "android.hardware.camera.metadata-V2", + "android.hardware.graphics.common-V4", + ], + }, + ], } diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/.hash b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/.hash new file mode 100644 index 0000000000..7a7bd43eb8 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/.hash @@ -0,0 +1 @@ +c03791dc9ced356c793cc487d0de3266dcb06ac9 diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/BufferCache.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/BufferCache.aidl new file mode 100644 index 0000000000..9439172d6b --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/BufferCache.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +parcelable BufferCache { + int streamId; + long bufferId; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/BufferRequest.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/BufferRequest.aidl new file mode 100644 index 0000000000..c40a24aa79 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/BufferRequest.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +parcelable BufferRequest { + int streamId; + int numBuffersRequested; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/BufferRequestStatus.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/BufferRequestStatus.aidl new file mode 100644 index 0000000000..72fb61ba29 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/BufferRequestStatus.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@Backing(type="int") @VintfStability +enum BufferRequestStatus { + OK = 0, + FAILED_PARTIAL = 1, + FAILED_CONFIGURING = 2, + FAILED_ILLEGAL_ARGUMENTS = 3, + FAILED_UNKNOWN = 4, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/BufferStatus.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/BufferStatus.aidl new file mode 100644 index 0000000000..43a2b35e74 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/BufferStatus.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@Backing(type="int") @VintfStability +enum BufferStatus { + OK = 0, + ERROR = 1, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CameraBlob.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CameraBlob.aidl new file mode 100644 index 0000000000..520181c87f --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CameraBlob.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +parcelable CameraBlob { + android.hardware.camera.device.CameraBlobId blobId; + int blobSizeBytes; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CameraBlobId.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CameraBlobId.aidl new file mode 100644 index 0000000000..24083ad512 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CameraBlobId.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@Backing(type="int") @VintfStability +enum CameraBlobId { + JPEG = 0x00FF, + JPEG_APP_SEGMENTS = 0x100, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CameraMetadata.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CameraMetadata.aidl new file mode 100644 index 0000000000..b96d69e1b8 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CameraMetadata.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +parcelable CameraMetadata { + byte[] metadata; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CameraOfflineSessionInfo.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CameraOfflineSessionInfo.aidl new file mode 100644 index 0000000000..1ad8e115c8 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CameraOfflineSessionInfo.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +parcelable CameraOfflineSessionInfo { + android.hardware.camera.device.OfflineStream[] offlineStreams; + android.hardware.camera.device.OfflineRequest[] offlineRequests; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CaptureRequest.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CaptureRequest.aidl new file mode 100644 index 0000000000..6b5b256571 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CaptureRequest.aidl @@ -0,0 +1,45 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +parcelable CaptureRequest { + int frameNumber; + long fmqSettingsSize; + android.hardware.camera.device.CameraMetadata settings; + android.hardware.camera.device.StreamBuffer inputBuffer; + int inputWidth; + int inputHeight; + android.hardware.camera.device.StreamBuffer[] outputBuffers; + android.hardware.camera.device.PhysicalCameraSetting[] physicalCameraSettings; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CaptureResult.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CaptureResult.aidl new file mode 100644 index 0000000000..a820e2c463 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/CaptureResult.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +parcelable CaptureResult { + int frameNumber; + long fmqResultSize; + android.hardware.camera.device.CameraMetadata result; + android.hardware.camera.device.StreamBuffer[] outputBuffers; + android.hardware.camera.device.StreamBuffer inputBuffer; + int partialResult; + android.hardware.camera.device.PhysicalCameraMetadata[] physicalCameraMetadata; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ErrorCode.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ErrorCode.aidl new file mode 100644 index 0000000000..2f9887a7a5 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ErrorCode.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@Backing(type="int") @VintfStability +enum ErrorCode { + ERROR_DEVICE = 1, + ERROR_REQUEST = 2, + ERROR_RESULT = 3, + ERROR_BUFFER = 4, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ErrorMsg.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ErrorMsg.aidl new file mode 100644 index 0000000000..b2e9512bbf --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ErrorMsg.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +parcelable ErrorMsg { + int frameNumber; + int errorStreamId; + android.hardware.camera.device.ErrorCode errorCode; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/HalStream.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/HalStream.aidl new file mode 100644 index 0000000000..a5784bcf32 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/HalStream.aidl @@ -0,0 +1,45 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +parcelable HalStream { + int id; + android.hardware.graphics.common.PixelFormat overrideFormat; + android.hardware.graphics.common.BufferUsage producerUsage; + android.hardware.graphics.common.BufferUsage consumerUsage; + int maxBuffers; + android.hardware.graphics.common.Dataspace overrideDataSpace; + String physicalCameraId; + boolean supportOffline; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ICameraDevice.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ICameraDevice.aidl new file mode 100644 index 0000000000..51c60676be --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ICameraDevice.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +interface ICameraDevice { + android.hardware.camera.device.CameraMetadata getCameraCharacteristics(); + android.hardware.camera.device.CameraMetadata getPhysicalCameraCharacteristics(in String physicalCameraId); + android.hardware.camera.common.CameraResourceCost getResourceCost(); + boolean isStreamCombinationSupported(in android.hardware.camera.device.StreamConfiguration streams); + android.hardware.camera.device.ICameraDeviceSession open(in android.hardware.camera.device.ICameraDeviceCallback callback); + android.hardware.camera.device.ICameraInjectionSession openInjectionSession(in android.hardware.camera.device.ICameraDeviceCallback callback); + void setTorchMode(boolean on); + void turnOnTorchWithStrengthLevel(int torchStrength); + int getTorchStrengthLevel(); +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ICameraDeviceCallback.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ICameraDeviceCallback.aidl new file mode 100644 index 0000000000..7b79c6c87a --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ICameraDeviceCallback.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +interface ICameraDeviceCallback { + void notify(in android.hardware.camera.device.NotifyMsg[] msgs); + void processCaptureResult(in android.hardware.camera.device.CaptureResult[] results); + android.hardware.camera.device.BufferRequestStatus requestStreamBuffers(in android.hardware.camera.device.BufferRequest[] bufReqs, out android.hardware.camera.device.StreamBufferRet[] buffers); + void returnStreamBuffers(in android.hardware.camera.device.StreamBuffer[] buffers); +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ICameraDeviceSession.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ICameraDeviceSession.aidl new file mode 100644 index 0000000000..2196d37a6c --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ICameraDeviceSession.aidl @@ -0,0 +1,48 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +interface ICameraDeviceSession { + void close(); + android.hardware.camera.device.HalStream[] configureStreams(in android.hardware.camera.device.StreamConfiguration requestedConfiguration); + android.hardware.camera.device.CameraMetadata constructDefaultRequestSettings(in android.hardware.camera.device.RequestTemplate type); + void flush(); + android.hardware.common.fmq.MQDescriptor getCaptureRequestMetadataQueue(); + android.hardware.common.fmq.MQDescriptor getCaptureResultMetadataQueue(); + boolean isReconfigurationRequired(in android.hardware.camera.device.CameraMetadata oldSessionParams, in android.hardware.camera.device.CameraMetadata newSessionParams); + int processCaptureRequest(in android.hardware.camera.device.CaptureRequest[] requests, in android.hardware.camera.device.BufferCache[] cachesToRemove); + oneway void signalStreamFlush(in int[] streamIds, in int streamConfigCounter); + android.hardware.camera.device.ICameraOfflineSession switchToOffline(in int[] streamsToKeep, out android.hardware.camera.device.CameraOfflineSessionInfo offlineSessionInfo); + void repeatingRequestEnd(in int frameNumber, in int[] streamIds); +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ICameraInjectionSession.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ICameraInjectionSession.aidl new file mode 100644 index 0000000000..80f74f331c --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ICameraInjectionSession.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +interface ICameraInjectionSession { + void configureInjectionStreams(in android.hardware.camera.device.StreamConfiguration requestedConfiguration, in android.hardware.camera.device.CameraMetadata characteristics); + android.hardware.camera.device.ICameraDeviceSession getCameraDeviceSession(); +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ICameraOfflineSession.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ICameraOfflineSession.aidl new file mode 100644 index 0000000000..727d856fc8 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ICameraOfflineSession.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +interface ICameraOfflineSession { + void close(); + android.hardware.common.fmq.MQDescriptor getCaptureResultMetadataQueue(); + void setCallback(in android.hardware.camera.device.ICameraDeviceCallback cb); +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/NotifyMsg.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/NotifyMsg.aidl new file mode 100644 index 0000000000..3ad7e52e63 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/NotifyMsg.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +union NotifyMsg { + android.hardware.camera.device.ErrorMsg error; + android.hardware.camera.device.ShutterMsg shutter; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/OfflineRequest.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/OfflineRequest.aidl new file mode 100644 index 0000000000..6e6f29d6fc --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/OfflineRequest.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +parcelable OfflineRequest { + int frameNumber; + int[] pendingStreams; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/OfflineStream.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/OfflineStream.aidl new file mode 100644 index 0000000000..54cb1fed0e --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/OfflineStream.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +parcelable OfflineStream { + int id; + int numOutstandingBuffers; + long[] circulatingBufferIds; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/PhysicalCameraMetadata.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/PhysicalCameraMetadata.aidl new file mode 100644 index 0000000000..3d66ab8713 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/PhysicalCameraMetadata.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +parcelable PhysicalCameraMetadata { + long fmqMetadataSize; + String physicalCameraId; + android.hardware.camera.device.CameraMetadata metadata; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/PhysicalCameraSetting.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/PhysicalCameraSetting.aidl new file mode 100644 index 0000000000..a6c241d453 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/PhysicalCameraSetting.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +parcelable PhysicalCameraSetting { + long fmqSettingsSize; + String physicalCameraId; + android.hardware.camera.device.CameraMetadata settings; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/RequestTemplate.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/RequestTemplate.aidl new file mode 100644 index 0000000000..1f87aa338d --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/RequestTemplate.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@Backing(type="int") @VintfStability +enum RequestTemplate { + PREVIEW = 1, + STILL_CAPTURE = 2, + VIDEO_RECORD = 3, + VIDEO_SNAPSHOT = 4, + ZERO_SHUTTER_LAG = 5, + MANUAL = 6, + VENDOR_TEMPLATE_START = 0x40000000, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ShutterMsg.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ShutterMsg.aidl new file mode 100644 index 0000000000..ce059ac0db --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/ShutterMsg.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +parcelable ShutterMsg { + int frameNumber; + long timestamp; + long readoutTimestamp; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/Stream.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/Stream.aidl new file mode 100644 index 0000000000..5057663e65 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/Stream.aidl @@ -0,0 +1,52 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +parcelable Stream { + int id; + android.hardware.camera.device.StreamType streamType; + int width; + int height; + android.hardware.graphics.common.PixelFormat format; + android.hardware.graphics.common.BufferUsage usage; + android.hardware.graphics.common.Dataspace dataSpace; + android.hardware.camera.device.StreamRotation rotation; + String physicalCameraId; + int bufferSize; + int groupId; + android.hardware.camera.metadata.SensorPixelMode[] sensorPixelModesUsed; + android.hardware.camera.metadata.RequestAvailableDynamicRangeProfilesMap dynamicRangeProfile; + android.hardware.camera.metadata.ScalerAvailableStreamUseCases useCase; + int colorSpace; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamBuffer.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamBuffer.aidl new file mode 100644 index 0000000000..8fabf032db --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamBuffer.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +parcelable StreamBuffer { + int streamId; + long bufferId; + android.hardware.common.NativeHandle buffer; + android.hardware.camera.device.BufferStatus status; + android.hardware.common.NativeHandle acquireFence; + android.hardware.common.NativeHandle releaseFence; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamBufferRequestError.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamBufferRequestError.aidl new file mode 100644 index 0000000000..f450149635 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamBufferRequestError.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@Backing(type="int") @VintfStability +enum StreamBufferRequestError { + NO_BUFFER_AVAILABLE = 1, + MAX_BUFFER_EXCEEDED = 2, + STREAM_DISCONNECTED = 3, + UNKNOWN_ERROR = 4, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamBufferRet.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamBufferRet.aidl new file mode 100644 index 0000000000..3998cc34fa --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamBufferRet.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +parcelable StreamBufferRet { + int streamId; + android.hardware.camera.device.StreamBuffersVal val; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamBuffersVal.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamBuffersVal.aidl new file mode 100644 index 0000000000..bebc9fcced --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamBuffersVal.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +union StreamBuffersVal { + android.hardware.camera.device.StreamBufferRequestError error = android.hardware.camera.device.StreamBufferRequestError.UNKNOWN_ERROR; + android.hardware.camera.device.StreamBuffer[] buffers; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamConfiguration.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamConfiguration.aidl new file mode 100644 index 0000000000..97fd067b8d --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamConfiguration.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@VintfStability +parcelable StreamConfiguration { + android.hardware.camera.device.Stream[] streams; + android.hardware.camera.device.StreamConfigurationMode operationMode; + android.hardware.camera.device.CameraMetadata sessionParams; + int streamConfigCounter; + boolean multiResolutionInputImage; + long logId = 0; +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamConfigurationMode.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamConfigurationMode.aidl new file mode 100644 index 0000000000..ef7ec25d07 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamConfigurationMode.aidl @@ -0,0 +1,47 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@Backing(type="int") @VintfStability +enum StreamConfigurationMode { + NORMAL_MODE = 0, + CONSTRAINED_HIGH_SPEED_MODE = 1, + VENDOR_MODE_0 = 0x8000, + VENDOR_MODE_1, + VENDOR_MODE_2, + VENDOR_MODE_3, + VENDOR_MODE_4, + VENDOR_MODE_5, + VENDOR_MODE_6, + VENDOR_MODE_7, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamRotation.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamRotation.aidl new file mode 100644 index 0000000000..2ef4274f88 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamRotation.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@Backing(type="int") @VintfStability +enum StreamRotation { + ROTATION_0 = 0, + ROTATION_90 = 1, + ROTATION_180 = 2, + ROTATION_270 = 3, +} diff --git a/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamType.aidl b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamType.aidl new file mode 100644 index 0000000000..0f13fe8be7 --- /dev/null +++ b/camera/device/aidl/aidl_api/android.hardware.camera.device/2/android/hardware/camera/device/StreamType.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.device; +@Backing(type="int") @VintfStability +enum StreamType { + OUTPUT = 0, + INPUT = 1, +} diff --git a/camera/metadata/aidl/Android.bp b/camera/metadata/aidl/Android.bp index 7bec61dcd4..5872a86727 100644 --- a/camera/metadata/aidl/Android.bp +++ b/camera/metadata/aidl/Android.bp @@ -11,7 +11,7 @@ aidl_interface { name: "android.hardware.camera.metadata", vendor_available: true, srcs: ["android/hardware/camera/metadata/*.aidl"], - frozen: false, + frozen: true, stability: "vintf", backend: { cpp: { @@ -22,13 +22,18 @@ aidl_interface { }, rust: { enabled: true, - } + }, }, versions_with_info: [ { version: "1", imports: [], }, + { + version: "2", + imports: [], + }, + ], } diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/.hash b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/.hash new file mode 100644 index 0000000000..c11d4115ae --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/.hash @@ -0,0 +1 @@ +634042390edccd6163f1ec2fb2ff56ff1befaad4 diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/AutomotiveLensFacing.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/AutomotiveLensFacing.aidl new file mode 100644 index 0000000000..18917f7752 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/AutomotiveLensFacing.aidl @@ -0,0 +1,56 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum AutomotiveLensFacing { + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_OTHER, + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_FRONT, + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_REAR, + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_LEFT, + ANDROID_AUTOMOTIVE_LENS_FACING_EXTERIOR_RIGHT, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_OTHER, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_LEFT, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_CENTER, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_1_RIGHT, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_LEFT, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_CENTER, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_2_RIGHT, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_LEFT, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_CENTER, + ANDROID_AUTOMOTIVE_LENS_FACING_INTERIOR_SEAT_ROW_3_RIGHT, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/AutomotiveLocation.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/AutomotiveLocation.aidl new file mode 100644 index 0000000000..ad6003f3b1 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/AutomotiveLocation.aidl @@ -0,0 +1,52 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum AutomotiveLocation { + ANDROID_AUTOMOTIVE_LOCATION_INTERIOR, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_OTHER, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_FRONT, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_REAR, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_LEFT, + ANDROID_AUTOMOTIVE_LOCATION_EXTERIOR_RIGHT, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_OTHER, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_FRONT, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_REAR, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_LEFT, + ANDROID_AUTOMOTIVE_LOCATION_EXTRA_RIGHT, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/BlackLevelLock.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/BlackLevelLock.aidl new file mode 100644 index 0000000000..1f3e76f0b8 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/BlackLevelLock.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum BlackLevelLock { + ANDROID_BLACK_LEVEL_LOCK_OFF, + ANDROID_BLACK_LEVEL_LOCK_ON, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/CameraMetadataSection.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/CameraMetadataSection.aidl new file mode 100644 index 0000000000..138101b4cb --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/CameraMetadataSection.aidl @@ -0,0 +1,76 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum CameraMetadataSection { + ANDROID_COLOR_CORRECTION, + ANDROID_CONTROL, + ANDROID_DEMOSAIC, + ANDROID_EDGE, + ANDROID_FLASH, + ANDROID_FLASH_INFO, + ANDROID_HOT_PIXEL, + ANDROID_JPEG, + ANDROID_LENS, + ANDROID_LENS_INFO, + ANDROID_NOISE_REDUCTION, + ANDROID_QUIRKS, + ANDROID_REQUEST, + ANDROID_SCALER, + ANDROID_SENSOR, + ANDROID_SENSOR_INFO, + ANDROID_SHADING, + ANDROID_STATISTICS, + ANDROID_STATISTICS_INFO, + ANDROID_TONEMAP, + ANDROID_LED, + ANDROID_INFO, + ANDROID_BLACK_LEVEL, + ANDROID_SYNC, + ANDROID_REPROCESS, + ANDROID_DEPTH, + ANDROID_LOGICAL_MULTI_CAMERA, + ANDROID_DISTORTION_CORRECTION, + ANDROID_HEIC, + ANDROID_HEIC_INFO, + ANDROID_AUTOMOTIVE, + ANDROID_AUTOMOTIVE_LENS, + ANDROID_EXTENSION, + ANDROID_JPEGR, + VENDOR_SECTION = 0x8000, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl new file mode 100644 index 0000000000..85eee08a45 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/CameraMetadataSectionStart.aidl @@ -0,0 +1,76 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum CameraMetadataSectionStart { + ANDROID_COLOR_CORRECTION_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_COLOR_CORRECTION << 16) /* 0 */, + ANDROID_CONTROL_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_CONTROL << 16) /* 65536 */, + ANDROID_DEMOSAIC_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_DEMOSAIC << 16) /* 131072 */, + ANDROID_EDGE_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_EDGE << 16) /* 196608 */, + ANDROID_FLASH_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_FLASH << 16) /* 262144 */, + ANDROID_FLASH_INFO_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_FLASH_INFO << 16) /* 327680 */, + ANDROID_HOT_PIXEL_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_HOT_PIXEL << 16) /* 393216 */, + ANDROID_JPEG_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_JPEG << 16) /* 458752 */, + ANDROID_LENS_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_LENS << 16) /* 524288 */, + ANDROID_LENS_INFO_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_LENS_INFO << 16) /* 589824 */, + ANDROID_NOISE_REDUCTION_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_NOISE_REDUCTION << 16) /* 655360 */, + ANDROID_QUIRKS_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_QUIRKS << 16) /* 720896 */, + ANDROID_REQUEST_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_REQUEST << 16) /* 786432 */, + ANDROID_SCALER_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_SCALER << 16) /* 851968 */, + ANDROID_SENSOR_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_SENSOR << 16) /* 917504 */, + ANDROID_SENSOR_INFO_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_SENSOR_INFO << 16) /* 983040 */, + ANDROID_SHADING_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_SHADING << 16) /* 1048576 */, + ANDROID_STATISTICS_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_STATISTICS << 16) /* 1114112 */, + ANDROID_STATISTICS_INFO_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_STATISTICS_INFO << 16) /* 1179648 */, + ANDROID_TONEMAP_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_TONEMAP << 16) /* 1245184 */, + ANDROID_LED_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_LED << 16) /* 1310720 */, + ANDROID_INFO_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_INFO << 16) /* 1376256 */, + ANDROID_BLACK_LEVEL_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_BLACK_LEVEL << 16) /* 1441792 */, + ANDROID_SYNC_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_SYNC << 16) /* 1507328 */, + ANDROID_REPROCESS_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_REPROCESS << 16) /* 1572864 */, + ANDROID_DEPTH_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_DEPTH << 16) /* 1638400 */, + ANDROID_LOGICAL_MULTI_CAMERA_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_LOGICAL_MULTI_CAMERA << 16) /* 1703936 */, + ANDROID_DISTORTION_CORRECTION_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_DISTORTION_CORRECTION << 16) /* 1769472 */, + ANDROID_HEIC_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_HEIC << 16) /* 1835008 */, + ANDROID_HEIC_INFO_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_HEIC_INFO << 16) /* 1900544 */, + ANDROID_AUTOMOTIVE_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_AUTOMOTIVE << 16) /* 1966080 */, + ANDROID_AUTOMOTIVE_LENS_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_AUTOMOTIVE_LENS << 16) /* 2031616 */, + ANDROID_EXTENSION_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_EXTENSION << 16) /* 2097152 */, + ANDROID_JPEGR_START = (android.hardware.camera.metadata.CameraMetadataSection.ANDROID_JPEGR << 16) /* 2162688 */, + VENDOR_SECTION_START = (android.hardware.camera.metadata.CameraMetadataSection.VENDOR_SECTION << 16) /* -2147483648 */, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/CameraMetadataTag.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/CameraMetadataTag.aidl new file mode 100644 index 0000000000..71d4e41c44 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/CameraMetadataTag.aidl @@ -0,0 +1,345 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum CameraMetadataTag { + ANDROID_COLOR_CORRECTION_MODE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_COLOR_CORRECTION_START /* 0 */, + ANDROID_COLOR_CORRECTION_TRANSFORM, + ANDROID_COLOR_CORRECTION_GAINS, + ANDROID_COLOR_CORRECTION_ABERRATION_MODE, + ANDROID_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES, + ANDROID_CONTROL_AE_ANTIBANDING_MODE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_CONTROL_START /* 65536 */, + ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION, + ANDROID_CONTROL_AE_LOCK, + ANDROID_CONTROL_AE_MODE, + ANDROID_CONTROL_AE_REGIONS, + ANDROID_CONTROL_AE_TARGET_FPS_RANGE, + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER, + ANDROID_CONTROL_AF_MODE, + ANDROID_CONTROL_AF_REGIONS, + ANDROID_CONTROL_AF_TRIGGER, + ANDROID_CONTROL_AWB_LOCK, + ANDROID_CONTROL_AWB_MODE, + ANDROID_CONTROL_AWB_REGIONS, + ANDROID_CONTROL_CAPTURE_INTENT, + ANDROID_CONTROL_EFFECT_MODE, + ANDROID_CONTROL_MODE, + ANDROID_CONTROL_SCENE_MODE, + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE, + ANDROID_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES, + ANDROID_CONTROL_AE_AVAILABLE_MODES, + ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES, + ANDROID_CONTROL_AE_COMPENSATION_RANGE, + ANDROID_CONTROL_AE_COMPENSATION_STEP, + ANDROID_CONTROL_AF_AVAILABLE_MODES, + ANDROID_CONTROL_AVAILABLE_EFFECTS, + ANDROID_CONTROL_AVAILABLE_SCENE_MODES, + ANDROID_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES, + ANDROID_CONTROL_AWB_AVAILABLE_MODES, + ANDROID_CONTROL_MAX_REGIONS, + ANDROID_CONTROL_SCENE_MODE_OVERRIDES, + ANDROID_CONTROL_AE_PRECAPTURE_ID, + ANDROID_CONTROL_AE_STATE, + ANDROID_CONTROL_AF_STATE, + ANDROID_CONTROL_AF_TRIGGER_ID, + ANDROID_CONTROL_AWB_STATE, + ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS, + ANDROID_CONTROL_AE_LOCK_AVAILABLE, + ANDROID_CONTROL_AWB_LOCK_AVAILABLE, + ANDROID_CONTROL_AVAILABLE_MODES, + ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE, + ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST, + ANDROID_CONTROL_ENABLE_ZSL, + ANDROID_CONTROL_AF_SCENE_CHANGE, + ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_MAX_SIZES, + ANDROID_CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_ZOOM_RATIO_RANGES, + ANDROID_CONTROL_EXTENDED_SCENE_MODE, + ANDROID_CONTROL_ZOOM_RATIO_RANGE, + ANDROID_CONTROL_ZOOM_RATIO, + ANDROID_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS_MAXIMUM_RESOLUTION, + ANDROID_CONTROL_SETTINGS_OVERRIDE = 65588, + ANDROID_CONTROL_AVAILABLE_SETTINGS_OVERRIDES, + ANDROID_CONTROL_SETTINGS_OVERRIDING_FRAME_NUMBER, + ANDROID_CONTROL_AUTOFRAMING, + ANDROID_CONTROL_AUTOFRAMING_AVAILABLE, + ANDROID_CONTROL_AUTOFRAMING_STATE, + ANDROID_DEMOSAIC_MODE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_DEMOSAIC_START /* 131072 */, + ANDROID_EDGE_MODE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_EDGE_START /* 196608 */, + ANDROID_EDGE_STRENGTH, + ANDROID_EDGE_AVAILABLE_EDGE_MODES, + ANDROID_FLASH_FIRING_POWER = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_FLASH_START /* 262144 */, + ANDROID_FLASH_FIRING_TIME, + ANDROID_FLASH_MODE, + ANDROID_FLASH_COLOR_TEMPERATURE, + ANDROID_FLASH_MAX_ENERGY, + ANDROID_FLASH_STATE, + ANDROID_FLASH_INFO_AVAILABLE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_FLASH_INFO_START /* 327680 */, + ANDROID_FLASH_INFO_CHARGE_DURATION, + ANDROID_FLASH_INFO_STRENGTH_MAXIMUM_LEVEL, + ANDROID_FLASH_INFO_STRENGTH_DEFAULT_LEVEL, + ANDROID_HOT_PIXEL_MODE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_HOT_PIXEL_START /* 393216 */, + ANDROID_HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES, + ANDROID_JPEG_GPS_COORDINATES = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_JPEG_START /* 458752 */, + ANDROID_JPEG_GPS_PROCESSING_METHOD, + ANDROID_JPEG_GPS_TIMESTAMP, + ANDROID_JPEG_ORIENTATION, + ANDROID_JPEG_QUALITY, + ANDROID_JPEG_THUMBNAIL_QUALITY, + ANDROID_JPEG_THUMBNAIL_SIZE, + ANDROID_JPEG_AVAILABLE_THUMBNAIL_SIZES, + ANDROID_JPEG_MAX_SIZE, + ANDROID_JPEG_SIZE, + ANDROID_LENS_APERTURE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_LENS_START /* 524288 */, + ANDROID_LENS_FILTER_DENSITY, + ANDROID_LENS_FOCAL_LENGTH, + ANDROID_LENS_FOCUS_DISTANCE, + ANDROID_LENS_OPTICAL_STABILIZATION_MODE, + ANDROID_LENS_FACING, + ANDROID_LENS_POSE_ROTATION, + ANDROID_LENS_POSE_TRANSLATION, + ANDROID_LENS_FOCUS_RANGE, + ANDROID_LENS_STATE, + ANDROID_LENS_INTRINSIC_CALIBRATION, + ANDROID_LENS_RADIAL_DISTORTION, + ANDROID_LENS_POSE_REFERENCE, + ANDROID_LENS_DISTORTION, + ANDROID_LENS_DISTORTION_MAXIMUM_RESOLUTION, + ANDROID_LENS_INTRINSIC_CALIBRATION_MAXIMUM_RESOLUTION, + ANDROID_LENS_INFO_AVAILABLE_APERTURES = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_LENS_INFO_START /* 589824 */, + ANDROID_LENS_INFO_AVAILABLE_FILTER_DENSITIES, + ANDROID_LENS_INFO_AVAILABLE_FOCAL_LENGTHS, + ANDROID_LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION, + ANDROID_LENS_INFO_HYPERFOCAL_DISTANCE, + ANDROID_LENS_INFO_MINIMUM_FOCUS_DISTANCE, + ANDROID_LENS_INFO_SHADING_MAP_SIZE, + ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION, + ANDROID_NOISE_REDUCTION_MODE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_NOISE_REDUCTION_START /* 655360 */, + ANDROID_NOISE_REDUCTION_STRENGTH, + ANDROID_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES, + ANDROID_QUIRKS_METERING_CROP_REGION = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_QUIRKS_START /* 720896 */, + ANDROID_QUIRKS_TRIGGER_AF_WITH_AUTO, + ANDROID_QUIRKS_USE_ZSL_FORMAT, + ANDROID_QUIRKS_USE_PARTIAL_RESULT, + ANDROID_QUIRKS_PARTIAL_RESULT, + ANDROID_REQUEST_FRAME_COUNT = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_REQUEST_START /* 786432 */, + ANDROID_REQUEST_ID, + ANDROID_REQUEST_INPUT_STREAMS, + ANDROID_REQUEST_METADATA_MODE, + ANDROID_REQUEST_OUTPUT_STREAMS, + ANDROID_REQUEST_TYPE, + ANDROID_REQUEST_MAX_NUM_OUTPUT_STREAMS, + ANDROID_REQUEST_MAX_NUM_REPROCESS_STREAMS, + ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS, + ANDROID_REQUEST_PIPELINE_DEPTH, + ANDROID_REQUEST_PIPELINE_MAX_DEPTH, + ANDROID_REQUEST_PARTIAL_RESULT_COUNT, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES, + ANDROID_REQUEST_AVAILABLE_REQUEST_KEYS, + ANDROID_REQUEST_AVAILABLE_RESULT_KEYS, + ANDROID_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS, + ANDROID_REQUEST_AVAILABLE_SESSION_KEYS, + ANDROID_REQUEST_AVAILABLE_PHYSICAL_CAMERA_REQUEST_KEYS, + ANDROID_REQUEST_CHARACTERISTIC_KEYS_NEEDING_PERMISSION, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP, + ANDROID_REQUEST_RECOMMENDED_TEN_BIT_DYNAMIC_RANGE_PROFILE, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP, + ANDROID_SCALER_CROP_REGION = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_SCALER_START /* 851968 */, + ANDROID_SCALER_AVAILABLE_FORMATS, + ANDROID_SCALER_AVAILABLE_JPEG_MIN_DURATIONS, + ANDROID_SCALER_AVAILABLE_JPEG_SIZES, + ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM, + ANDROID_SCALER_AVAILABLE_PROCESSED_MIN_DURATIONS, + ANDROID_SCALER_AVAILABLE_PROCESSED_SIZES, + ANDROID_SCALER_AVAILABLE_RAW_MIN_DURATIONS, + ANDROID_SCALER_AVAILABLE_RAW_SIZES, + ANDROID_SCALER_AVAILABLE_INPUT_OUTPUT_FORMATS_MAP, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, + ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS, + ANDROID_SCALER_AVAILABLE_STALL_DURATIONS, + ANDROID_SCALER_CROPPING_TYPE, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_INPUT_OUTPUT_FORMATS_MAP, + ANDROID_SCALER_AVAILABLE_ROTATE_AND_CROP_MODES, + ANDROID_SCALER_ROTATE_AND_CROP, + ANDROID_SCALER_DEFAULT_SECURE_IMAGE_SIZE, + ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION, + ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION, + ANDROID_SCALER_AVAILABLE_STALL_DURATIONS_MAXIMUM_RESOLUTION, + ANDROID_SCALER_AVAILABLE_INPUT_OUTPUT_FORMATS_MAP_MAXIMUM_RESOLUTION, + ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES = 851994, + ANDROID_SCALER_RAW_CROP_REGION, + ANDROID_SENSOR_EXPOSURE_TIME = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_SENSOR_START /* 917504 */, + ANDROID_SENSOR_FRAME_DURATION, + ANDROID_SENSOR_SENSITIVITY, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1, + ANDROID_SENSOR_REFERENCE_ILLUMINANT2, + ANDROID_SENSOR_CALIBRATION_TRANSFORM1, + ANDROID_SENSOR_CALIBRATION_TRANSFORM2, + ANDROID_SENSOR_COLOR_TRANSFORM1, + ANDROID_SENSOR_COLOR_TRANSFORM2, + ANDROID_SENSOR_FORWARD_MATRIX1, + ANDROID_SENSOR_FORWARD_MATRIX2, + ANDROID_SENSOR_BASE_GAIN_FACTOR, + ANDROID_SENSOR_BLACK_LEVEL_PATTERN, + ANDROID_SENSOR_MAX_ANALOG_SENSITIVITY, + ANDROID_SENSOR_ORIENTATION, + ANDROID_SENSOR_PROFILE_HUE_SAT_MAP_DIMENSIONS, + ANDROID_SENSOR_TIMESTAMP, + ANDROID_SENSOR_TEMPERATURE, + ANDROID_SENSOR_NEUTRAL_COLOR_POINT, + ANDROID_SENSOR_NOISE_PROFILE, + ANDROID_SENSOR_PROFILE_HUE_SAT_MAP, + ANDROID_SENSOR_PROFILE_TONE_CURVE, + ANDROID_SENSOR_GREEN_SPLIT, + ANDROID_SENSOR_TEST_PATTERN_DATA, + ANDROID_SENSOR_TEST_PATTERN_MODE, + ANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES, + ANDROID_SENSOR_ROLLING_SHUTTER_SKEW, + ANDROID_SENSOR_OPTICAL_BLACK_REGIONS, + ANDROID_SENSOR_DYNAMIC_BLACK_LEVEL, + ANDROID_SENSOR_DYNAMIC_WHITE_LEVEL, + ANDROID_SENSOR_OPAQUE_RAW_SIZE, + ANDROID_SENSOR_OPAQUE_RAW_SIZE_MAXIMUM_RESOLUTION, + ANDROID_SENSOR_PIXEL_MODE, + ANDROID_SENSOR_RAW_BINNING_FACTOR_USED, + ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_SENSOR_INFO_START /* 983040 */, + ANDROID_SENSOR_INFO_SENSITIVITY_RANGE, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT, + ANDROID_SENSOR_INFO_EXPOSURE_TIME_RANGE, + ANDROID_SENSOR_INFO_MAX_FRAME_DURATION, + ANDROID_SENSOR_INFO_PHYSICAL_SIZE, + ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE, + ANDROID_SENSOR_INFO_WHITE_LEVEL, + ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE, + ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED, + ANDROID_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE, + ANDROID_SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION, + ANDROID_SENSOR_INFO_PIXEL_ARRAY_SIZE_MAXIMUM_RESOLUTION, + ANDROID_SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION, + ANDROID_SENSOR_INFO_BINNING_FACTOR, + ANDROID_SHADING_MODE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_SHADING_START /* 1048576 */, + ANDROID_SHADING_STRENGTH, + ANDROID_SHADING_AVAILABLE_MODES, + ANDROID_STATISTICS_FACE_DETECT_MODE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_STATISTICS_START /* 1114112 */, + ANDROID_STATISTICS_HISTOGRAM_MODE, + ANDROID_STATISTICS_SHARPNESS_MAP_MODE, + ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE, + ANDROID_STATISTICS_FACE_IDS, + ANDROID_STATISTICS_FACE_LANDMARKS, + ANDROID_STATISTICS_FACE_RECTANGLES, + ANDROID_STATISTICS_FACE_SCORES, + ANDROID_STATISTICS_HISTOGRAM, + ANDROID_STATISTICS_SHARPNESS_MAP, + ANDROID_STATISTICS_LENS_SHADING_CORRECTION_MAP, + ANDROID_STATISTICS_LENS_SHADING_MAP, + ANDROID_STATISTICS_PREDICTED_COLOR_GAINS, + ANDROID_STATISTICS_PREDICTED_COLOR_TRANSFORM, + ANDROID_STATISTICS_SCENE_FLICKER, + ANDROID_STATISTICS_HOT_PIXEL_MAP, + ANDROID_STATISTICS_LENS_SHADING_MAP_MODE, + ANDROID_STATISTICS_OIS_DATA_MODE, + ANDROID_STATISTICS_OIS_TIMESTAMPS, + ANDROID_STATISTICS_OIS_X_SHIFTS, + ANDROID_STATISTICS_OIS_Y_SHIFTS, + ANDROID_STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_STATISTICS_INFO_START /* 1179648 */, + ANDROID_STATISTICS_INFO_HISTOGRAM_BUCKET_COUNT, + ANDROID_STATISTICS_INFO_MAX_FACE_COUNT, + ANDROID_STATISTICS_INFO_MAX_HISTOGRAM_COUNT, + ANDROID_STATISTICS_INFO_MAX_SHARPNESS_MAP_VALUE, + ANDROID_STATISTICS_INFO_SHARPNESS_MAP_SIZE, + ANDROID_STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES, + ANDROID_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES, + ANDROID_STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES, + ANDROID_TONEMAP_CURVE_BLUE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_TONEMAP_START /* 1245184 */, + ANDROID_TONEMAP_CURVE_GREEN, + ANDROID_TONEMAP_CURVE_RED, + ANDROID_TONEMAP_MODE, + ANDROID_TONEMAP_MAX_CURVE_POINTS, + ANDROID_TONEMAP_AVAILABLE_TONE_MAP_MODES, + ANDROID_TONEMAP_GAMMA, + ANDROID_TONEMAP_PRESET_CURVE, + ANDROID_LED_TRANSMIT = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_LED_START /* 1310720 */, + ANDROID_LED_AVAILABLE_LEDS, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_INFO_START /* 1376256 */, + ANDROID_INFO_VERSION, + ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION, + ANDROID_INFO_DEVICE_STATE_ORIENTATIONS, + ANDROID_BLACK_LEVEL_LOCK = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_BLACK_LEVEL_START /* 1441792 */, + ANDROID_SYNC_FRAME_NUMBER = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_SYNC_START /* 1507328 */, + ANDROID_SYNC_MAX_LATENCY, + ANDROID_REPROCESS_EFFECTIVE_EXPOSURE_FACTOR = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_REPROCESS_START /* 1572864 */, + ANDROID_REPROCESS_MAX_CAPTURE_STALL, + ANDROID_DEPTH_MAX_DEPTH_SAMPLES = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_DEPTH_START /* 1638400 */, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS, + ANDROID_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS, + ANDROID_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS, + ANDROID_DEPTH_DEPTH_IS_EXCLUSIVE, + ANDROID_DEPTH_AVAILABLE_RECOMMENDED_DEPTH_STREAM_CONFIGURATIONS, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION, + ANDROID_DEPTH_AVAILABLE_DEPTH_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION, + ANDROID_DEPTH_AVAILABLE_DEPTH_STALL_DURATIONS_MAXIMUM_RESOLUTION, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STALL_DURATIONS_MAXIMUM_RESOLUTION, + ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_LOGICAL_MULTI_CAMERA_START /* 1703936 */, + ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE, + ANDROID_LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID, + ANDROID_DISTORTION_CORRECTION_MODE = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_DISTORTION_CORRECTION_START /* 1769472 */, + ANDROID_DISTORTION_CORRECTION_AVAILABLE_MODES, + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_HEIC_START /* 1835008 */, + ANDROID_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS, + ANDROID_HEIC_AVAILABLE_HEIC_STALL_DURATIONS, + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION, + ANDROID_HEIC_AVAILABLE_HEIC_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION, + ANDROID_HEIC_AVAILABLE_HEIC_STALL_DURATIONS_MAXIMUM_RESOLUTION, + ANDROID_HEIC_INFO_SUPPORTED = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_HEIC_INFO_START /* 1900544 */, + ANDROID_HEIC_INFO_MAX_JPEG_APP_SEGMENTS_COUNT, + ANDROID_AUTOMOTIVE_LOCATION = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_AUTOMOTIVE_START /* 1966080 */, + ANDROID_AUTOMOTIVE_LENS_FACING = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_AUTOMOTIVE_LENS_START /* 2031616 */, + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS = android.hardware.camera.metadata.CameraMetadataSectionStart.ANDROID_JPEGR_START /* 2162688 */, + ANDROID_JPEGR_AVAILABLE_JPEG_R_MIN_FRAME_DURATIONS, + ANDROID_JPEGR_AVAILABLE_JPEG_R_STALL_DURATIONS, + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION, + ANDROID_JPEGR_AVAILABLE_JPEG_R_MIN_FRAME_DURATIONS_MAXIMUM_RESOLUTION, + ANDROID_JPEGR_AVAILABLE_JPEG_R_STALL_DURATIONS_MAXIMUM_RESOLUTION, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ColorCorrectionAberrationMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ColorCorrectionAberrationMode.aidl new file mode 100644 index 0000000000..0b976f3d8b --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ColorCorrectionAberrationMode.aidl @@ -0,0 +1,44 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ColorCorrectionAberrationMode { + ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF, + ANDROID_COLOR_CORRECTION_ABERRATION_MODE_FAST, + ANDROID_COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ColorCorrectionMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ColorCorrectionMode.aidl new file mode 100644 index 0000000000..2381605719 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ColorCorrectionMode.aidl @@ -0,0 +1,44 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ColorCorrectionMode { + ANDROID_COLOR_CORRECTION_MODE_TRANSFORM_MATRIX, + ANDROID_COLOR_CORRECTION_MODE_FAST, + ANDROID_COLOR_CORRECTION_MODE_HIGH_QUALITY, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAeAntibandingMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAeAntibandingMode.aidl new file mode 100644 index 0000000000..0d5aad9a92 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAeAntibandingMode.aidl @@ -0,0 +1,45 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAeAntibandingMode { + ANDROID_CONTROL_AE_ANTIBANDING_MODE_OFF, + ANDROID_CONTROL_AE_ANTIBANDING_MODE_50HZ, + ANDROID_CONTROL_AE_ANTIBANDING_MODE_60HZ, + ANDROID_CONTROL_AE_ANTIBANDING_MODE_AUTO, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAeLock.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAeLock.aidl new file mode 100644 index 0000000000..766b835dc1 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAeLock.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAeLock { + ANDROID_CONTROL_AE_LOCK_OFF, + ANDROID_CONTROL_AE_LOCK_ON, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAeLockAvailable.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAeLockAvailable.aidl new file mode 100644 index 0000000000..a22c93e379 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAeLockAvailable.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAeLockAvailable { + ANDROID_CONTROL_AE_LOCK_AVAILABLE_FALSE, + ANDROID_CONTROL_AE_LOCK_AVAILABLE_TRUE, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAeMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAeMode.aidl new file mode 100644 index 0000000000..5e1b87178e --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAeMode.aidl @@ -0,0 +1,47 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAeMode { + ANDROID_CONTROL_AE_MODE_OFF, + ANDROID_CONTROL_AE_MODE_ON, + ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH, + ANDROID_CONTROL_AE_MODE_ON_ALWAYS_FLASH, + ANDROID_CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE, + ANDROID_CONTROL_AE_MODE_ON_EXTERNAL_FLASH, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAePrecaptureTrigger.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAePrecaptureTrigger.aidl new file mode 100644 index 0000000000..20382c0b3c --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAePrecaptureTrigger.aidl @@ -0,0 +1,44 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAePrecaptureTrigger { + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE, + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_START, + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAeState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAeState.aidl new file mode 100644 index 0000000000..e52eafe0d7 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAeState.aidl @@ -0,0 +1,47 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAeState { + ANDROID_CONTROL_AE_STATE_INACTIVE, + ANDROID_CONTROL_AE_STATE_SEARCHING, + ANDROID_CONTROL_AE_STATE_CONVERGED, + ANDROID_CONTROL_AE_STATE_LOCKED, + ANDROID_CONTROL_AE_STATE_FLASH_REQUIRED, + ANDROID_CONTROL_AE_STATE_PRECAPTURE, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAfMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAfMode.aidl new file mode 100644 index 0000000000..6cd46c68db --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAfMode.aidl @@ -0,0 +1,47 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAfMode { + ANDROID_CONTROL_AF_MODE_OFF, + ANDROID_CONTROL_AF_MODE_AUTO, + ANDROID_CONTROL_AF_MODE_MACRO, + ANDROID_CONTROL_AF_MODE_CONTINUOUS_VIDEO, + ANDROID_CONTROL_AF_MODE_CONTINUOUS_PICTURE, + ANDROID_CONTROL_AF_MODE_EDOF, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAfSceneChange.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAfSceneChange.aidl new file mode 100644 index 0000000000..ba853a1270 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAfSceneChange.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAfSceneChange { + ANDROID_CONTROL_AF_SCENE_CHANGE_NOT_DETECTED, + ANDROID_CONTROL_AF_SCENE_CHANGE_DETECTED, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAfState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAfState.aidl new file mode 100644 index 0000000000..25b6a1c01e --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAfState.aidl @@ -0,0 +1,48 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAfState { + ANDROID_CONTROL_AF_STATE_INACTIVE, + ANDROID_CONTROL_AF_STATE_PASSIVE_SCAN, + ANDROID_CONTROL_AF_STATE_PASSIVE_FOCUSED, + ANDROID_CONTROL_AF_STATE_ACTIVE_SCAN, + ANDROID_CONTROL_AF_STATE_FOCUSED_LOCKED, + ANDROID_CONTROL_AF_STATE_NOT_FOCUSED_LOCKED, + ANDROID_CONTROL_AF_STATE_PASSIVE_UNFOCUSED, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAfTrigger.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAfTrigger.aidl new file mode 100644 index 0000000000..9d61b2d4dc --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAfTrigger.aidl @@ -0,0 +1,44 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAfTrigger { + ANDROID_CONTROL_AF_TRIGGER_IDLE, + ANDROID_CONTROL_AF_TRIGGER_START, + ANDROID_CONTROL_AF_TRIGGER_CANCEL, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAutoframing.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAutoframing.aidl new file mode 100644 index 0000000000..2daf00b586 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAutoframing.aidl @@ -0,0 +1,44 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAutoframing { + ANDROID_CONTROL_AUTOFRAMING_OFF, + ANDROID_CONTROL_AUTOFRAMING_ON, + ANDROID_CONTROL_AUTOFRAMING_AUTO, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAutoframingAvailable.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAutoframingAvailable.aidl new file mode 100644 index 0000000000..ab91bb444b --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAutoframingAvailable.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAutoframingAvailable { + ANDROID_CONTROL_AUTOFRAMING_AVAILABLE_FALSE, + ANDROID_CONTROL_AUTOFRAMING_AVAILABLE_TRUE, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAutoframingState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAutoframingState.aidl new file mode 100644 index 0000000000..db0d288fc4 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAutoframingState.aidl @@ -0,0 +1,44 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAutoframingState { + ANDROID_CONTROL_AUTOFRAMING_STATE_INACTIVE, + ANDROID_CONTROL_AUTOFRAMING_STATE_FRAMING, + ANDROID_CONTROL_AUTOFRAMING_STATE_CONVERGED, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAwbLock.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAwbLock.aidl new file mode 100644 index 0000000000..949b5e89f2 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAwbLock.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAwbLock { + ANDROID_CONTROL_AWB_LOCK_OFF, + ANDROID_CONTROL_AWB_LOCK_ON, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAwbLockAvailable.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAwbLockAvailable.aidl new file mode 100644 index 0000000000..80c4c3175f --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAwbLockAvailable.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAwbLockAvailable { + ANDROID_CONTROL_AWB_LOCK_AVAILABLE_FALSE, + ANDROID_CONTROL_AWB_LOCK_AVAILABLE_TRUE, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAwbMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAwbMode.aidl new file mode 100644 index 0000000000..6ed9ece7aa --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAwbMode.aidl @@ -0,0 +1,50 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAwbMode { + ANDROID_CONTROL_AWB_MODE_OFF, + ANDROID_CONTROL_AWB_MODE_AUTO, + ANDROID_CONTROL_AWB_MODE_INCANDESCENT, + ANDROID_CONTROL_AWB_MODE_FLUORESCENT, + ANDROID_CONTROL_AWB_MODE_WARM_FLUORESCENT, + ANDROID_CONTROL_AWB_MODE_DAYLIGHT, + ANDROID_CONTROL_AWB_MODE_CLOUDY_DAYLIGHT, + ANDROID_CONTROL_AWB_MODE_TWILIGHT, + ANDROID_CONTROL_AWB_MODE_SHADE, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAwbState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAwbState.aidl new file mode 100644 index 0000000000..c5b02d5ed6 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlAwbState.aidl @@ -0,0 +1,45 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlAwbState { + ANDROID_CONTROL_AWB_STATE_INACTIVE, + ANDROID_CONTROL_AWB_STATE_SEARCHING, + ANDROID_CONTROL_AWB_STATE_CONVERGED, + ANDROID_CONTROL_AWB_STATE_LOCKED, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlCaptureIntent.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlCaptureIntent.aidl new file mode 100644 index 0000000000..fa1c0a98ec --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlCaptureIntent.aidl @@ -0,0 +1,49 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlCaptureIntent { + ANDROID_CONTROL_CAPTURE_INTENT_CUSTOM, + ANDROID_CONTROL_CAPTURE_INTENT_PREVIEW, + ANDROID_CONTROL_CAPTURE_INTENT_STILL_CAPTURE, + ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_RECORD, + ANDROID_CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT, + ANDROID_CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG, + ANDROID_CONTROL_CAPTURE_INTENT_MANUAL, + ANDROID_CONTROL_CAPTURE_INTENT_MOTION_TRACKING, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlEffectMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlEffectMode.aidl new file mode 100644 index 0000000000..471deed753 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlEffectMode.aidl @@ -0,0 +1,50 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlEffectMode { + ANDROID_CONTROL_EFFECT_MODE_OFF, + ANDROID_CONTROL_EFFECT_MODE_MONO, + ANDROID_CONTROL_EFFECT_MODE_NEGATIVE, + ANDROID_CONTROL_EFFECT_MODE_SOLARIZE, + ANDROID_CONTROL_EFFECT_MODE_SEPIA, + ANDROID_CONTROL_EFFECT_MODE_POSTERIZE, + ANDROID_CONTROL_EFFECT_MODE_WHITEBOARD, + ANDROID_CONTROL_EFFECT_MODE_BLACKBOARD, + ANDROID_CONTROL_EFFECT_MODE_AQUA, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlEnableZsl.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlEnableZsl.aidl new file mode 100644 index 0000000000..3f2d4a32d1 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlEnableZsl.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlEnableZsl { + ANDROID_CONTROL_ENABLE_ZSL_FALSE, + ANDROID_CONTROL_ENABLE_ZSL_TRUE, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlExtendedSceneMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlExtendedSceneMode.aidl new file mode 100644 index 0000000000..7838288884 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlExtendedSceneMode.aidl @@ -0,0 +1,45 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlExtendedSceneMode { + ANDROID_CONTROL_EXTENDED_SCENE_MODE_DISABLED = 0, + ANDROID_CONTROL_EXTENDED_SCENE_MODE_BOKEH_STILL_CAPTURE, + ANDROID_CONTROL_EXTENDED_SCENE_MODE_BOKEH_CONTINUOUS, + ANDROID_CONTROL_EXTENDED_SCENE_MODE_VENDOR_START = 0x40, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlMode.aidl new file mode 100644 index 0000000000..c5a8172a07 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlMode.aidl @@ -0,0 +1,46 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlMode { + ANDROID_CONTROL_MODE_OFF, + ANDROID_CONTROL_MODE_AUTO, + ANDROID_CONTROL_MODE_USE_SCENE_MODE, + ANDROID_CONTROL_MODE_OFF_KEEP_STATE, + ANDROID_CONTROL_MODE_USE_EXTENDED_SCENE_MODE, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlSceneMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlSceneMode.aidl new file mode 100644 index 0000000000..62c67e3f3d --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlSceneMode.aidl @@ -0,0 +1,63 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlSceneMode { + ANDROID_CONTROL_SCENE_MODE_DISABLED = 0, + ANDROID_CONTROL_SCENE_MODE_FACE_PRIORITY, + ANDROID_CONTROL_SCENE_MODE_ACTION, + ANDROID_CONTROL_SCENE_MODE_PORTRAIT, + ANDROID_CONTROL_SCENE_MODE_LANDSCAPE, + ANDROID_CONTROL_SCENE_MODE_NIGHT, + ANDROID_CONTROL_SCENE_MODE_NIGHT_PORTRAIT, + ANDROID_CONTROL_SCENE_MODE_THEATRE, + ANDROID_CONTROL_SCENE_MODE_BEACH, + ANDROID_CONTROL_SCENE_MODE_SNOW, + ANDROID_CONTROL_SCENE_MODE_SUNSET, + ANDROID_CONTROL_SCENE_MODE_STEADYPHOTO, + ANDROID_CONTROL_SCENE_MODE_FIREWORKS, + ANDROID_CONTROL_SCENE_MODE_SPORTS, + ANDROID_CONTROL_SCENE_MODE_PARTY, + ANDROID_CONTROL_SCENE_MODE_CANDLELIGHT, + ANDROID_CONTROL_SCENE_MODE_BARCODE, + ANDROID_CONTROL_SCENE_MODE_HIGH_SPEED_VIDEO, + ANDROID_CONTROL_SCENE_MODE_HDR, + ANDROID_CONTROL_SCENE_MODE_FACE_PRIORITY_LOW_LIGHT, + ANDROID_CONTROL_SCENE_MODE_DEVICE_CUSTOM_START = 100, + ANDROID_CONTROL_SCENE_MODE_DEVICE_CUSTOM_END = 127, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlSettingsOverride.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlSettingsOverride.aidl new file mode 100644 index 0000000000..404bbfa50c --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlSettingsOverride.aidl @@ -0,0 +1,44 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlSettingsOverride { + ANDROID_CONTROL_SETTINGS_OVERRIDE_OFF, + ANDROID_CONTROL_SETTINGS_OVERRIDE_ZOOM, + ANDROID_CONTROL_SETTINGS_OVERRIDE_VENDOR_START = 0x4000, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlVideoStabilizationMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlVideoStabilizationMode.aidl new file mode 100644 index 0000000000..2b199eff0e --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ControlVideoStabilizationMode.aidl @@ -0,0 +1,44 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ControlVideoStabilizationMode { + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_OFF, + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_ON, + ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DemosaicMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DemosaicMode.aidl new file mode 100644 index 0000000000..577000933b --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DemosaicMode.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum DemosaicMode { + ANDROID_DEMOSAIC_MODE_FAST, + ANDROID_DEMOSAIC_MODE_HIGH_QUALITY, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurations.aidl new file mode 100644 index 0000000000..0cce2da7a5 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurations.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum DepthAvailableDepthStreamConfigurations { + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_OUTPUT, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_INPUT, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurationsMaximumResolution.aidl new file mode 100644 index 0000000000..9be06db77a --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DepthAvailableDepthStreamConfigurationsMaximumResolution.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum DepthAvailableDepthStreamConfigurationsMaximumResolution { + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurations.aidl new file mode 100644 index 0000000000..c6aebaad0a --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurations.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum DepthAvailableDynamicDepthStreamConfigurations { + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_OUTPUT, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_INPUT, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurationsMaximumResolution.aidl new file mode 100644 index 0000000000..4d5161d800 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DepthAvailableDynamicDepthStreamConfigurationsMaximumResolution.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum DepthAvailableDynamicDepthStreamConfigurationsMaximumResolution { + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT, + ANDROID_DEPTH_AVAILABLE_DYNAMIC_DEPTH_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DepthDepthIsExclusive.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DepthDepthIsExclusive.aidl new file mode 100644 index 0000000000..f7b69cd289 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DepthDepthIsExclusive.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum DepthDepthIsExclusive { + ANDROID_DEPTH_DEPTH_IS_EXCLUSIVE_FALSE, + ANDROID_DEPTH_DEPTH_IS_EXCLUSIVE_TRUE, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DistortionCorrectionMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DistortionCorrectionMode.aidl new file mode 100644 index 0000000000..6e965f64f0 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/DistortionCorrectionMode.aidl @@ -0,0 +1,44 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum DistortionCorrectionMode { + ANDROID_DISTORTION_CORRECTION_MODE_OFF, + ANDROID_DISTORTION_CORRECTION_MODE_FAST, + ANDROID_DISTORTION_CORRECTION_MODE_HIGH_QUALITY, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/EdgeMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/EdgeMode.aidl new file mode 100644 index 0000000000..fdd32f429a --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/EdgeMode.aidl @@ -0,0 +1,45 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum EdgeMode { + ANDROID_EDGE_MODE_OFF, + ANDROID_EDGE_MODE_FAST, + ANDROID_EDGE_MODE_HIGH_QUALITY, + ANDROID_EDGE_MODE_ZERO_SHUTTER_LAG, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/FlashInfoAvailable.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/FlashInfoAvailable.aidl new file mode 100644 index 0000000000..83292fee4c --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/FlashInfoAvailable.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum FlashInfoAvailable { + ANDROID_FLASH_INFO_AVAILABLE_FALSE, + ANDROID_FLASH_INFO_AVAILABLE_TRUE, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/FlashMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/FlashMode.aidl new file mode 100644 index 0000000000..e18ea3c076 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/FlashMode.aidl @@ -0,0 +1,44 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum FlashMode { + ANDROID_FLASH_MODE_OFF, + ANDROID_FLASH_MODE_SINGLE, + ANDROID_FLASH_MODE_TORCH, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/FlashState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/FlashState.aidl new file mode 100644 index 0000000000..4343d4f1d6 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/FlashState.aidl @@ -0,0 +1,46 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum FlashState { + ANDROID_FLASH_STATE_UNAVAILABLE, + ANDROID_FLASH_STATE_CHARGING, + ANDROID_FLASH_STATE_READY, + ANDROID_FLASH_STATE_FIRED, + ANDROID_FLASH_STATE_PARTIAL, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurations.aidl new file mode 100644 index 0000000000..3957267612 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurations.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum HeicAvailableHeicStreamConfigurations { + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_OUTPUT, + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_INPUT, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurationsMaximumResolution.aidl new file mode 100644 index 0000000000..4eda5386d8 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/HeicAvailableHeicStreamConfigurationsMaximumResolution.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum HeicAvailableHeicStreamConfigurationsMaximumResolution { + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT, + ANDROID_HEIC_AVAILABLE_HEIC_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/HeicInfoSupported.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/HeicInfoSupported.aidl new file mode 100644 index 0000000000..7079bbf82b --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/HeicInfoSupported.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum HeicInfoSupported { + ANDROID_HEIC_INFO_SUPPORTED_FALSE, + ANDROID_HEIC_INFO_SUPPORTED_TRUE, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/HotPixelMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/HotPixelMode.aidl new file mode 100644 index 0000000000..50b3446208 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/HotPixelMode.aidl @@ -0,0 +1,44 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum HotPixelMode { + ANDROID_HOT_PIXEL_MODE_OFF, + ANDROID_HOT_PIXEL_MODE_FAST, + ANDROID_HOT_PIXEL_MODE_HIGH_QUALITY, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl new file mode 100644 index 0000000000..7303ff5a71 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/InfoSupportedBufferManagementVersion.aidl @@ -0,0 +1,42 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum InfoSupportedBufferManagementVersion { + ANDROID_INFO_SUPPORTED_BUFFER_MANAGEMENT_VERSION_AIDL_DEVICE, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/InfoSupportedHardwareLevel.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/InfoSupportedHardwareLevel.aidl new file mode 100644 index 0000000000..3b5064757b --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/InfoSupportedHardwareLevel.aidl @@ -0,0 +1,46 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum InfoSupportedHardwareLevel { + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_FULL, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_3, + ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurations.aidl new file mode 100644 index 0000000000..cf9dbb72b9 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurations.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum JpegrAvailableJpegRStreamConfigurations { + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_OUTPUT, + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_INPUT, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurationsMaximumResolution.aidl new file mode 100644 index 0000000000..0a95e1f3a9 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/JpegrAvailableJpegRStreamConfigurationsMaximumResolution.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum JpegrAvailableJpegRStreamConfigurationsMaximumResolution { + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT, + ANDROID_JPEGR_AVAILABLE_JPEG_R_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LedAvailableLeds.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LedAvailableLeds.aidl new file mode 100644 index 0000000000..b3beb2d144 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LedAvailableLeds.aidl @@ -0,0 +1,42 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum LedAvailableLeds { + ANDROID_LED_AVAILABLE_LEDS_TRANSMIT, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LedTransmit.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LedTransmit.aidl new file mode 100644 index 0000000000..0cbf239c94 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LedTransmit.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum LedTransmit { + ANDROID_LED_TRANSMIT_OFF, + ANDROID_LED_TRANSMIT_ON, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LensFacing.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LensFacing.aidl new file mode 100644 index 0000000000..d15674dc11 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LensFacing.aidl @@ -0,0 +1,44 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum LensFacing { + ANDROID_LENS_FACING_FRONT, + ANDROID_LENS_FACING_BACK, + ANDROID_LENS_FACING_EXTERNAL, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LensInfoFocusDistanceCalibration.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LensInfoFocusDistanceCalibration.aidl new file mode 100644 index 0000000000..937347b1fd --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LensInfoFocusDistanceCalibration.aidl @@ -0,0 +1,44 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum LensInfoFocusDistanceCalibration { + ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_UNCALIBRATED, + ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_APPROXIMATE, + ANDROID_LENS_INFO_FOCUS_DISTANCE_CALIBRATION_CALIBRATED, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LensOpticalStabilizationMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LensOpticalStabilizationMode.aidl new file mode 100644 index 0000000000..550d9f3209 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LensOpticalStabilizationMode.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum LensOpticalStabilizationMode { + ANDROID_LENS_OPTICAL_STABILIZATION_MODE_OFF, + ANDROID_LENS_OPTICAL_STABILIZATION_MODE_ON, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LensPoseReference.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LensPoseReference.aidl new file mode 100644 index 0000000000..6a3799df39 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LensPoseReference.aidl @@ -0,0 +1,45 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum LensPoseReference { + ANDROID_LENS_POSE_REFERENCE_PRIMARY_CAMERA, + ANDROID_LENS_POSE_REFERENCE_GYROSCOPE, + ANDROID_LENS_POSE_REFERENCE_UNDEFINED, + ANDROID_LENS_POSE_REFERENCE_AUTOMOTIVE, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LensState.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LensState.aidl new file mode 100644 index 0000000000..4f9895607d --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LensState.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum LensState { + ANDROID_LENS_STATE_STATIONARY, + ANDROID_LENS_STATE_MOVING, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LogicalMultiCameraSensorSyncType.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LogicalMultiCameraSensorSyncType.aidl new file mode 100644 index 0000000000..5eb5759b9e --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/LogicalMultiCameraSensorSyncType.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum LogicalMultiCameraSensorSyncType { + ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE, + ANDROID_LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/NoiseReductionMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/NoiseReductionMode.aidl new file mode 100644 index 0000000000..8b589ce819 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/NoiseReductionMode.aidl @@ -0,0 +1,46 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum NoiseReductionMode { + ANDROID_NOISE_REDUCTION_MODE_OFF, + ANDROID_NOISE_REDUCTION_MODE_FAST, + ANDROID_NOISE_REDUCTION_MODE_HIGH_QUALITY, + ANDROID_NOISE_REDUCTION_MODE_MINIMAL, + ANDROID_NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/QuirksPartialResult.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/QuirksPartialResult.aidl new file mode 100644 index 0000000000..8ab6a05700 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/QuirksPartialResult.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum QuirksPartialResult { + ANDROID_QUIRKS_PARTIAL_RESULT_FINAL, + ANDROID_QUIRKS_PARTIAL_RESULT_PARTIAL, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl new file mode 100644 index 0000000000..0564db8da9 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/RequestAvailableCapabilities.aidl @@ -0,0 +1,62 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum RequestAvailableCapabilities { + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_RAW, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_PRIVATE_REPROCESSING, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_READ_SENSOR_SETTINGS, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_YUV_REPROCESSING, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_CONSTRAINED_HIGH_SPEED_VIDEO, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SECURE_IMAGE_DATA, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_SYSTEM_CAMERA, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_OFFLINE_PROCESSING, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_REMOSAIC_REPROCESSING, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DYNAMIC_RANGE_TEN_BIT, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE, + ANDROID_REQUEST_AVAILABLE_CAPABILITIES_COLOR_SPACE_PROFILES, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl new file mode 100644 index 0000000000..74606bf110 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/RequestAvailableColorSpaceProfilesMap.aidl @@ -0,0 +1,45 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="long") @VintfStability +enum RequestAvailableColorSpaceProfilesMap { + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_UNSPECIFIED = (-1L) /* -1 */, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_SRGB = 0L, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_DISPLAY_P3 = 7L, + ANDROID_REQUEST_AVAILABLE_COLOR_SPACE_PROFILES_MAP_BT2020_HLG = 16L, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/RequestAvailableDynamicRangeProfilesMap.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/RequestAvailableDynamicRangeProfilesMap.aidl new file mode 100644 index 0000000000..45ffb1be1a --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/RequestAvailableDynamicRangeProfilesMap.aidl @@ -0,0 +1,54 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="long") @VintfStability +enum RequestAvailableDynamicRangeProfilesMap { + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD = 0x1L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HLG10 = 0x2L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10 = 0x4L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_HDR10_PLUS = 0x8L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF = 0x10L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_REF_PO = 0x20L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM = 0x40L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_10B_HDR_OEM_PO = 0x80L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF = 0x100L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_REF_PO = 0x200L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM = 0x400L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_DOLBY_VISION_8B_HDR_OEM_PO = 0x800L, + ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_MAX = 0x1000L, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/RequestMetadataMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/RequestMetadataMode.aidl new file mode 100644 index 0000000000..cede79950c --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/RequestMetadataMode.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum RequestMetadataMode { + ANDROID_REQUEST_METADATA_MODE_NONE, + ANDROID_REQUEST_METADATA_MODE_FULL, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/RequestType.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/RequestType.aidl new file mode 100644 index 0000000000..6b4ae71862 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/RequestType.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum RequestType { + ANDROID_REQUEST_TYPE_CAPTURE, + ANDROID_REQUEST_TYPE_REPROCESS, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerAvailableFormats.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerAvailableFormats.aidl new file mode 100644 index 0000000000..fdc2f60887 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerAvailableFormats.aidl @@ -0,0 +1,51 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerAvailableFormats { + ANDROID_SCALER_AVAILABLE_FORMATS_RAW16 = 0x20, + ANDROID_SCALER_AVAILABLE_FORMATS_RAW_OPAQUE = 0x24, + ANDROID_SCALER_AVAILABLE_FORMATS_YV12 = 0x32315659, + ANDROID_SCALER_AVAILABLE_FORMATS_YCrCb_420_SP = 0x11, + ANDROID_SCALER_AVAILABLE_FORMATS_IMPLEMENTATION_DEFINED = 0x22, + ANDROID_SCALER_AVAILABLE_FORMATS_YCbCr_420_888 = 0x23, + ANDROID_SCALER_AVAILABLE_FORMATS_BLOB = 0x21, + ANDROID_SCALER_AVAILABLE_FORMATS_RAW10 = 0x25, + ANDROID_SCALER_AVAILABLE_FORMATS_RAW12 = 0x26, + ANDROID_SCALER_AVAILABLE_FORMATS_Y8 = 0x20203859, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerAvailableRecommendedStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerAvailableRecommendedStreamConfigurations.aidl new file mode 100644 index 0000000000..741a99d839 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerAvailableRecommendedStreamConfigurations.aidl @@ -0,0 +1,50 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerAvailableRecommendedStreamConfigurations { + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_PREVIEW = 0x0, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_RECORD = 0x1, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_VIDEO_SNAPSHOT = 0x2, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_SNAPSHOT = 0x3, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_ZSL = 0x4, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_RAW = 0x5, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_LOW_LATENCY_SNAPSHOT = 0x6, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_10BIT_OUTPUT = 0x8, + ANDROID_SCALER_AVAILABLE_RECOMMENDED_STREAM_CONFIGURATIONS_VENDOR_START = 0x18, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerAvailableStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerAvailableStreamConfigurations.aidl new file mode 100644 index 0000000000..4e2899d46e --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerAvailableStreamConfigurations.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerAvailableStreamConfigurations { + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_INPUT, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerAvailableStreamConfigurationsMaximumResolution.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerAvailableStreamConfigurationsMaximumResolution.aidl new file mode 100644 index 0000000000..fb15815dfe --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerAvailableStreamConfigurationsMaximumResolution.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerAvailableStreamConfigurationsMaximumResolution { + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_OUTPUT, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_MAXIMUM_RESOLUTION_INPUT, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl new file mode 100644 index 0000000000..ff92f9efd2 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerAvailableStreamUseCases.aidl @@ -0,0 +1,49 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="long") @VintfStability +enum ScalerAvailableStreamUseCases { + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_DEFAULT = 0x0L, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW = 0x1L, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_STILL_CAPTURE = 0x2L, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_RECORD = 0x3L, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_PREVIEW_VIDEO_STILL = 0x4L, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VIDEO_CALL = 0x5L, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW = 0x6L, + ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES_VENDOR_START = 0x10000L, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerCroppingType.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerCroppingType.aidl new file mode 100644 index 0000000000..60782e4650 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerCroppingType.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerCroppingType { + ANDROID_SCALER_CROPPING_TYPE_CENTER_ONLY, + ANDROID_SCALER_CROPPING_TYPE_FREEFORM, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerMultiResolutionStreamSupported.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerMultiResolutionStreamSupported.aidl new file mode 100644 index 0000000000..e09d89c182 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerMultiResolutionStreamSupported.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerMultiResolutionStreamSupported { + ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED_FALSE, + ANDROID_SCALER_MULTI_RESOLUTION_STREAM_SUPPORTED_TRUE, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerPhysicalCameraMultiResolutionStreamConfigurations.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerPhysicalCameraMultiResolutionStreamConfigurations.aidl new file mode 100644 index 0000000000..64a022018b --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerPhysicalCameraMultiResolutionStreamConfigurations.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerPhysicalCameraMultiResolutionStreamConfigurations { + ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_OUTPUT, + ANDROID_SCALER_PHYSICAL_CAMERA_MULTI_RESOLUTION_STREAM_CONFIGURATIONS_INPUT, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerRotateAndCrop.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerRotateAndCrop.aidl new file mode 100644 index 0000000000..bf5380eea4 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ScalerRotateAndCrop.aidl @@ -0,0 +1,46 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ScalerRotateAndCrop { + ANDROID_SCALER_ROTATE_AND_CROP_NONE, + ANDROID_SCALER_ROTATE_AND_CROP_90, + ANDROID_SCALER_ROTATE_AND_CROP_180, + ANDROID_SCALER_ROTATE_AND_CROP_270, + ANDROID_SCALER_ROTATE_AND_CROP_AUTO, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorInfoColorFilterArrangement.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorInfoColorFilterArrangement.aidl new file mode 100644 index 0000000000..c96f3c5e91 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorInfoColorFilterArrangement.aidl @@ -0,0 +1,48 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum SensorInfoColorFilterArrangement { + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGGB, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GRBG, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GBRG, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_BGGR, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGB, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO, + ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorInfoLensShadingApplied.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorInfoLensShadingApplied.aidl new file mode 100644 index 0000000000..0153731bbc --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorInfoLensShadingApplied.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum SensorInfoLensShadingApplied { + ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED_FALSE, + ANDROID_SENSOR_INFO_LENS_SHADING_APPLIED_TRUE, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorInfoTimestampSource.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorInfoTimestampSource.aidl new file mode 100644 index 0000000000..9a00cf155e --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorInfoTimestampSource.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum SensorInfoTimestampSource { + ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN, + ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorPixelMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorPixelMode.aidl new file mode 100644 index 0000000000..5f055d6b23 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorPixelMode.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum SensorPixelMode { + ANDROID_SENSOR_PIXEL_MODE_DEFAULT, + ANDROID_SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorRawBinningFactorUsed.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorRawBinningFactorUsed.aidl new file mode 100644 index 0000000000..851dae0f8e --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorRawBinningFactorUsed.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum SensorRawBinningFactorUsed { + ANDROID_SENSOR_RAW_BINNING_FACTOR_USED_TRUE, + ANDROID_SENSOR_RAW_BINNING_FACTOR_USED_FALSE, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorReferenceIlluminant1.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorReferenceIlluminant1.aidl new file mode 100644 index 0000000000..cd22d2e35d --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorReferenceIlluminant1.aidl @@ -0,0 +1,60 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum SensorReferenceIlluminant1 { + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_DAYLIGHT = 1, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_FLUORESCENT = 2, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_TUNGSTEN = 3, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_FLASH = 4, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_FINE_WEATHER = 9, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_CLOUDY_WEATHER = 10, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_SHADE = 11, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_DAYLIGHT_FLUORESCENT = 12, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_DAY_WHITE_FLUORESCENT = 13, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_COOL_WHITE_FLUORESCENT = 14, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_WHITE_FLUORESCENT = 15, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_A = 17, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_B = 18, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_STANDARD_C = 19, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_D55 = 20, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_D65 = 21, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_D75 = 22, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_D50 = 23, + ANDROID_SENSOR_REFERENCE_ILLUMINANT1_ISO_STUDIO_TUNGSTEN = 24, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorTestPatternMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorTestPatternMode.aidl new file mode 100644 index 0000000000..98f0ebe855 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SensorTestPatternMode.aidl @@ -0,0 +1,48 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum SensorTestPatternMode { + ANDROID_SENSOR_TEST_PATTERN_MODE_OFF, + ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR, + ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS, + ANDROID_SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY, + ANDROID_SENSOR_TEST_PATTERN_MODE_PN9, + ANDROID_SENSOR_TEST_PATTERN_MODE_BLACK, + ANDROID_SENSOR_TEST_PATTERN_MODE_CUSTOM1 = 256, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ShadingMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ShadingMode.aidl new file mode 100644 index 0000000000..ffc6a560ad --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/ShadingMode.aidl @@ -0,0 +1,44 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum ShadingMode { + ANDROID_SHADING_MODE_OFF, + ANDROID_SHADING_MODE_FAST, + ANDROID_SHADING_MODE_HIGH_QUALITY, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsFaceDetectMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsFaceDetectMode.aidl new file mode 100644 index 0000000000..48c6797a02 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsFaceDetectMode.aidl @@ -0,0 +1,44 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum StatisticsFaceDetectMode { + ANDROID_STATISTICS_FACE_DETECT_MODE_OFF, + ANDROID_STATISTICS_FACE_DETECT_MODE_SIMPLE, + ANDROID_STATISTICS_FACE_DETECT_MODE_FULL, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsHistogramMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsHistogramMode.aidl new file mode 100644 index 0000000000..354518b2cc --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsHistogramMode.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum StatisticsHistogramMode { + ANDROID_STATISTICS_HISTOGRAM_MODE_OFF, + ANDROID_STATISTICS_HISTOGRAM_MODE_ON, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsHotPixelMapMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsHotPixelMapMode.aidl new file mode 100644 index 0000000000..b96e4be645 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsHotPixelMapMode.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum StatisticsHotPixelMapMode { + ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE_OFF, + ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE_ON, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsLensShadingMapMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsLensShadingMapMode.aidl new file mode 100644 index 0000000000..7d0b0823e4 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsLensShadingMapMode.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum StatisticsLensShadingMapMode { + ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_OFF, + ANDROID_STATISTICS_LENS_SHADING_MAP_MODE_ON, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsOisDataMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsOisDataMode.aidl new file mode 100644 index 0000000000..b80889bdec --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsOisDataMode.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum StatisticsOisDataMode { + ANDROID_STATISTICS_OIS_DATA_MODE_OFF, + ANDROID_STATISTICS_OIS_DATA_MODE_ON, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsSceneFlicker.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsSceneFlicker.aidl new file mode 100644 index 0000000000..a9268c07b1 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsSceneFlicker.aidl @@ -0,0 +1,44 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum StatisticsSceneFlicker { + ANDROID_STATISTICS_SCENE_FLICKER_NONE, + ANDROID_STATISTICS_SCENE_FLICKER_50HZ, + ANDROID_STATISTICS_SCENE_FLICKER_60HZ, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsSharpnessMapMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsSharpnessMapMode.aidl new file mode 100644 index 0000000000..09a2003887 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/StatisticsSharpnessMapMode.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum StatisticsSharpnessMapMode { + ANDROID_STATISTICS_SHARPNESS_MAP_MODE_OFF, + ANDROID_STATISTICS_SHARPNESS_MAP_MODE_ON, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SyncFrameNumber.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SyncFrameNumber.aidl new file mode 100644 index 0000000000..230f57e67f --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SyncFrameNumber.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum SyncFrameNumber { + ANDROID_SYNC_FRAME_NUMBER_CONVERGING = (-1) /* -1 */, + ANDROID_SYNC_FRAME_NUMBER_UNKNOWN = (-2) /* -2 */, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SyncMaxLatency.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SyncMaxLatency.aidl new file mode 100644 index 0000000000..d484f45e77 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/SyncMaxLatency.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum SyncMaxLatency { + ANDROID_SYNC_MAX_LATENCY_PER_FRAME_CONTROL = 0, + ANDROID_SYNC_MAX_LATENCY_UNKNOWN = (-1) /* -1 */, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/TonemapMode.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/TonemapMode.aidl new file mode 100644 index 0000000000..e729166000 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/TonemapMode.aidl @@ -0,0 +1,46 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum TonemapMode { + ANDROID_TONEMAP_MODE_CONTRAST_CURVE, + ANDROID_TONEMAP_MODE_FAST, + ANDROID_TONEMAP_MODE_HIGH_QUALITY, + ANDROID_TONEMAP_MODE_GAMMA_VALUE, + ANDROID_TONEMAP_MODE_PRESET_CURVE, +} diff --git a/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/TonemapPresetCurve.aidl b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/TonemapPresetCurve.aidl new file mode 100644 index 0000000000..2e5fbd3ad0 --- /dev/null +++ b/camera/metadata/aidl/aidl_api/android.hardware.camera.metadata/2/android/hardware/camera/metadata/TonemapPresetCurve.aidl @@ -0,0 +1,43 @@ +/* + * 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. + *//* + * Autogenerated from camera metadata definitions in + * /system/media/camera/docs/metadata_definitions.xml + * *** DO NOT EDIT BY HAND *** + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.metadata; +@Backing(type="int") @VintfStability +enum TonemapPresetCurve { + ANDROID_TONEMAP_PRESET_CURVE_SRGB, + ANDROID_TONEMAP_PRESET_CURVE_REC709, +} diff --git a/camera/provider/aidl/Android.bp b/camera/provider/aidl/Android.bp index d7e613e657..35ec9766a0 100644 --- a/camera/provider/aidl/Android.bp +++ b/camera/provider/aidl/Android.bp @@ -17,7 +17,7 @@ aidl_interface { "android.hardware.camera.device-V2", "android.hardware.camera.common-V1", ], - frozen: false, + frozen: true, stability: "vintf", backend: { java: { @@ -35,6 +35,14 @@ aidl_interface { "android.hardware.camera.common-V1", ], }, + { + version: "2", + imports: [ + "android.hardware.camera.device-V2", + "android.hardware.camera.common-V1", + ], + }, + ], } diff --git a/camera/provider/aidl/aidl_api/android.hardware.camera.provider/2/.hash b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/2/.hash new file mode 100644 index 0000000000..2770775591 --- /dev/null +++ b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/2/.hash @@ -0,0 +1 @@ +5c3de5da344a2cf7f68e1078a9ed9d6770e59136 diff --git a/camera/provider/aidl/aidl_api/android.hardware.camera.provider/2/android/hardware/camera/provider/CameraIdAndStreamCombination.aidl b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/2/android/hardware/camera/provider/CameraIdAndStreamCombination.aidl new file mode 100644 index 0000000000..df77c40a28 --- /dev/null +++ b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/2/android/hardware/camera/provider/CameraIdAndStreamCombination.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.provider; +@VintfStability +parcelable CameraIdAndStreamCombination { + String cameraId; + android.hardware.camera.device.StreamConfiguration streamConfiguration; +} diff --git a/camera/provider/aidl/aidl_api/android.hardware.camera.provider/2/android/hardware/camera/provider/ConcurrentCameraIdCombination.aidl b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/2/android/hardware/camera/provider/ConcurrentCameraIdCombination.aidl new file mode 100644 index 0000000000..334fb2c827 --- /dev/null +++ b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/2/android/hardware/camera/provider/ConcurrentCameraIdCombination.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.provider; +@VintfStability +parcelable ConcurrentCameraIdCombination { + List combination; +} diff --git a/camera/provider/aidl/aidl_api/android.hardware.camera.provider/2/android/hardware/camera/provider/ICameraProvider.aidl b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/2/android/hardware/camera/provider/ICameraProvider.aidl new file mode 100644 index 0000000000..2f0184f639 --- /dev/null +++ b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/2/android/hardware/camera/provider/ICameraProvider.aidl @@ -0,0 +1,48 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.provider; +@VintfStability +interface ICameraProvider { + void setCallback(android.hardware.camera.provider.ICameraProviderCallback callback); + android.hardware.camera.common.VendorTagSection[] getVendorTags(); + String[] getCameraIdList(); + android.hardware.camera.device.ICameraDevice getCameraDeviceInterface(String cameraDeviceName); + void notifyDeviceStateChange(long deviceState); + android.hardware.camera.provider.ConcurrentCameraIdCombination[] getConcurrentCameraIds(); + boolean isConcurrentStreamCombinationSupported(in android.hardware.camera.provider.CameraIdAndStreamCombination[] configs); + const long DEVICE_STATE_NORMAL = 0; + const long DEVICE_STATE_BACK_COVERED = (1 << 0) /* 1 */; + const long DEVICE_STATE_FRONT_COVERED = (1 << 1) /* 2 */; + const long DEVICE_STATE_FOLDED = (1 << 2) /* 4 */; +} diff --git a/camera/provider/aidl/aidl_api/android.hardware.camera.provider/2/android/hardware/camera/provider/ICameraProviderCallback.aidl b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/2/android/hardware/camera/provider/ICameraProviderCallback.aidl new file mode 100644 index 0000000000..d3c53f5bc2 --- /dev/null +++ b/camera/provider/aidl/aidl_api/android.hardware.camera.provider/2/android/hardware/camera/provider/ICameraProviderCallback.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.camera.provider; +@VintfStability +interface ICameraProviderCallback { + void cameraDeviceStatusChange(String cameraDeviceName, android.hardware.camera.common.CameraDeviceStatus newStatus); + void torchModeStatusChange(String cameraDeviceName, android.hardware.camera.common.TorchModeStatus newStatus); + void physicalCameraDeviceStatusChange(String cameraDeviceName, String physicalCameraDeviceName, android.hardware.camera.common.CameraDeviceStatus newStatus); +} diff --git a/cas/aidl/Android.bp b/cas/aidl/Android.bp index 32f12b12a5..123d29d194 100644 --- a/cas/aidl/Android.bp +++ b/cas/aidl/Android.bp @@ -37,4 +37,12 @@ aidl_interface { sdk_version: "module_current", }, }, + versions_with_info: [ + { + version: "1", + imports: ["android.hardware.common-V2"], + }, + ], + frozen: true, + } diff --git a/cas/aidl/aidl_api/android.hardware.cas/1/.hash b/cas/aidl/aidl_api/android.hardware.cas/1/.hash new file mode 100644 index 0000000000..025bfbdf0c --- /dev/null +++ b/cas/aidl/aidl_api/android.hardware.cas/1/.hash @@ -0,0 +1 @@ +bc51d8d70a55ec4723d3f73d0acf7003306bf69f diff --git a/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/AidlCasPluginDescriptor.aidl b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/AidlCasPluginDescriptor.aidl new file mode 100644 index 0000000000..89d8625307 --- /dev/null +++ b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/AidlCasPluginDescriptor.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.cas; +/* @hide */ +@VintfStability +parcelable AidlCasPluginDescriptor { + int caSystemId; + String name; +} diff --git a/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/DestinationBuffer.aidl b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/DestinationBuffer.aidl new file mode 100644 index 0000000000..b69cc33a92 --- /dev/null +++ b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/DestinationBuffer.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.cas; +/* @hide */ +@VintfStability +union DestinationBuffer { + android.hardware.cas.SharedBuffer nonsecureMemory; + android.hardware.common.NativeHandle secureMemory; +} diff --git a/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/ICas.aidl b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/ICas.aidl new file mode 100644 index 0000000000..903ab924ca --- /dev/null +++ b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/ICas.aidl @@ -0,0 +1,50 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.cas; +/* @hide */ +@VintfStability +interface ICas { + void closeSession(in byte[] sessionId); + byte[] openSessionDefault(); + byte[] openSession(in android.hardware.cas.SessionIntent intent, in android.hardware.cas.ScramblingMode mode); + void processEcm(in byte[] sessionId, in byte[] ecm); + void processEmm(in byte[] emm); + void provision(in String provisionString); + void refreshEntitlements(in int refreshType, in byte[] refreshData); + void release(); + void sendEvent(in int event, in int arg, in byte[] eventData); + void sendSessionEvent(in byte[] sessionId, in int event, in int arg, in byte[] eventData); + void setPrivateData(in byte[] pvtData); + void setSessionPrivateData(in byte[] sessionId, in byte[] pvtData); +} diff --git a/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/ICasListener.aidl b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/ICasListener.aidl new file mode 100644 index 0000000000..db75062568 --- /dev/null +++ b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/ICasListener.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.cas; +/* @hide */ +@VintfStability +interface ICasListener { + void onEvent(in int event, in int arg, in byte[] data); + void onSessionEvent(in byte[] sessionId, in int event, in int arg, in byte[] data); + void onStatusUpdate(in android.hardware.cas.StatusEvent event, in int number); +} diff --git a/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/IDescrambler.aidl b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/IDescrambler.aidl new file mode 100644 index 0000000000..411891b6b1 --- /dev/null +++ b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/IDescrambler.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.cas; +/* @hide */ +@VintfStability +interface IDescrambler { + int descramble(in android.hardware.cas.ScramblingControl scramblingControl, in android.hardware.cas.SubSample[] subSamples, in android.hardware.cas.SharedBuffer srcBuffer, in long srcOffset, in android.hardware.cas.DestinationBuffer dstBuffer, in long dstOffset); + void release(); + boolean requiresSecureDecoderComponent(in String mime); + void setMediaCasSession(in byte[] sessionId); +} diff --git a/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/IMediaCasService.aidl b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/IMediaCasService.aidl new file mode 100644 index 0000000000..1f945a7c94 --- /dev/null +++ b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/IMediaCasService.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.cas; +/* @hide */ +@VintfStability +interface IMediaCasService { + android.hardware.cas.IDescrambler createDescrambler(in int CA_system_id); + android.hardware.cas.ICas createPlugin(in int CA_system_id, in android.hardware.cas.ICasListener listener); + android.hardware.cas.AidlCasPluginDescriptor[] enumeratePlugins(); + boolean isDescramblerSupported(in int CA_system_id); + boolean isSystemIdSupported(in int CA_system_id); +} diff --git a/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/ScramblingControl.aidl b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/ScramblingControl.aidl new file mode 100644 index 0000000000..c8834ac7df --- /dev/null +++ b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/ScramblingControl.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.cas; +/* @hide */ +@Backing(type="int") @VintfStability +enum ScramblingControl { + UNSCRAMBLED = 0, + RESERVED = 1, + EVENKEY = 2, + ODDKEY = 3, +} diff --git a/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/ScramblingMode.aidl b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/ScramblingMode.aidl new file mode 100644 index 0000000000..9d542cc63e --- /dev/null +++ b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/ScramblingMode.aidl @@ -0,0 +1,53 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.cas; +/* @hide */ +@Backing(type="int") @VintfStability +enum ScramblingMode { + RESERVED = 0, + DVB_CSA1, + DVB_CSA2, + DVB_CSA3_STANDARD, + DVB_CSA3_MINIMAL, + DVB_CSA3_ENHANCE, + DVB_CISSA_V1, + DVB_IDSA, + MULTI2, + AES128, + AES_ECB, + AES_SCTE52, + TDES_ECB, + TDES_SCTE52, + AES_CBC, +} diff --git a/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/SessionIntent.aidl b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/SessionIntent.aidl new file mode 100644 index 0000000000..00a2fd778c --- /dev/null +++ b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/SessionIntent.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.cas; +/* @hide */ +@Backing(type="int") @VintfStability +enum SessionIntent { + LIVE, + PLAYBACK, + RECORD, + TIMESHIFT, +} diff --git a/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/SharedBuffer.aidl b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/SharedBuffer.aidl new file mode 100644 index 0000000000..9200b1dbf3 --- /dev/null +++ b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/SharedBuffer.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.cas; +/* @hide */ +@VintfStability +parcelable SharedBuffer { + android.hardware.common.Ashmem heapBase; + long offset; + long size; +} diff --git a/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/Status.aidl b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/Status.aidl new file mode 100644 index 0000000000..3691009d5d --- /dev/null +++ b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/Status.aidl @@ -0,0 +1,60 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.cas; +/* @hide */ +@VintfStability +parcelable Status { + const int OK = 0; + const int ERROR_CAS_NO_LICENSE = 1; + const int ERROR_CAS_LICENSE_EXPIRED = 2; + const int ERROR_CAS_SESSION_NOT_OPENED = 3; + const int ERROR_CAS_CANNOT_HANDLE = 4; + const int ERROR_CAS_INVALID_STATE = 5; + const int BAD_VALUE = 6; + const int ERROR_CAS_NOT_PROVISIONED = 7; + const int ERROR_CAS_RESOURCE_BUSY = 8; + const int ERROR_CAS_INSUFFICIENT_OUTPUT_PROTECTION = 9; + const int ERROR_CAS_TAMPER_DETECTED = 10; + const int ERROR_CAS_DEVICE_REVOKED = 11; + const int ERROR_CAS_DECRYPT_UNIT_NOT_INITIALIZED = 12; + const int ERROR_CAS_DECRYPT = 13; + const int ERROR_CAS_UNKNOWN = 14; + const int ERROR_CAS_NEED_ACTIVATION = 15; + const int ERROR_CAS_NEED_PAIRING = 16; + const int ERROR_CAS_NO_CARD = 17; + const int ERROR_CAS_CARD_MUTE = 18; + const int ERROR_CAS_CARD_INVALID = 19; + const int ERROR_CAS_BLACKOUT = 20; + const int ERROR_CAS_REBOOTING = 21; +} diff --git a/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/StatusEvent.aidl b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/StatusEvent.aidl new file mode 100644 index 0000000000..0cf37ddfda --- /dev/null +++ b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/StatusEvent.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.cas; +/* @hide */ +@Backing(type="byte") @VintfStability +enum StatusEvent { + PLUGIN_PHYSICAL_MODULE_CHANGED, + PLUGIN_SESSION_NUMBER_CHANGED, +} diff --git a/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/SubSample.aidl b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/SubSample.aidl new file mode 100644 index 0000000000..5bd1a1e196 --- /dev/null +++ b/cas/aidl/aidl_api/android.hardware.cas/1/android/hardware/cas/SubSample.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.cas; +/* @hide */ +@VintfStability +parcelable SubSample { + int numBytesOfClearData; + int numBytesOfEncryptedData; +} diff --git a/confirmationui/aidl/Android.bp b/confirmationui/aidl/Android.bp index 5395101ab2..51bde0a4a0 100644 --- a/confirmationui/aidl/Android.bp +++ b/confirmationui/aidl/Android.bp @@ -35,4 +35,12 @@ aidl_interface { enabled: false, }, }, + versions_with_info: [ + { + version: "1", + imports: ["android.hardware.security.keymint-V3"], + }, + ], + frozen: true, + } diff --git a/confirmationui/aidl/aidl_api/android.hardware.confirmationui/1/.hash b/confirmationui/aidl/aidl_api/android.hardware.confirmationui/1/.hash new file mode 100644 index 0000000000..72b88d439c --- /dev/null +++ b/confirmationui/aidl/aidl_api/android.hardware.confirmationui/1/.hash @@ -0,0 +1 @@ +4ae5a11c7bcce793ed8db5333483cc4296d3367e diff --git a/confirmationui/aidl/aidl_api/android.hardware.confirmationui/1/android/hardware/confirmationui/IConfirmationResultCallback.aidl b/confirmationui/aidl/aidl_api/android.hardware.confirmationui/1/android/hardware/confirmationui/IConfirmationResultCallback.aidl new file mode 100644 index 0000000000..6d6ec97377 --- /dev/null +++ b/confirmationui/aidl/aidl_api/android.hardware.confirmationui/1/android/hardware/confirmationui/IConfirmationResultCallback.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.confirmationui; +@VintfStability +interface IConfirmationResultCallback { + void result(in int error, in byte[] formattedMessage, in byte[] confirmationToken); +} diff --git a/confirmationui/aidl/aidl_api/android.hardware.confirmationui/1/android/hardware/confirmationui/IConfirmationUI.aidl b/confirmationui/aidl/aidl_api/android.hardware.confirmationui/1/android/hardware/confirmationui/IConfirmationUI.aidl new file mode 100644 index 0000000000..9c03173cc5 --- /dev/null +++ b/confirmationui/aidl/aidl_api/android.hardware.confirmationui/1/android/hardware/confirmationui/IConfirmationUI.aidl @@ -0,0 +1,54 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.confirmationui; +@VintfStability +interface IConfirmationUI { + void abort(); + void deliverSecureInputEvent(in android.hardware.security.keymint.HardwareAuthToken secureInputToken); + void promptUserConfirmation(in android.hardware.confirmationui.IConfirmationResultCallback resultCB, in byte[] promptText, in byte[] extraData, in @utf8InCpp String locale, in android.hardware.confirmationui.UIOption[] uiOptions); + const int OK = 0; + const int CANCELED = 1; + const int ABORTED = 2; + const int OPERATION_PENDING = 3; + const int IGNORED = 4; + const int SYSTEM_ERROR = 5; + const int UNIMPLEMENTED = 6; + const int UNEXPECTED = 7; + const int UI_ERROR = 0x10000; + const int UI_ERROR_MISSING_GLYPH = 0x10001; + const int UI_ERROR_MESSAGE_TOO_LONG = 0x10002; + const int UI_ERROR_MALFORMED_UTF8ENCODING = 0x10003; + const int TEST_KEY_BYTE = 0xA5; + const int MAX_MESSAGE_SIZE = 0x1800; +} diff --git a/confirmationui/aidl/aidl_api/android.hardware.confirmationui/1/android/hardware/confirmationui/TestModeCommands.aidl b/confirmationui/aidl/aidl_api/android.hardware.confirmationui/1/android/hardware/confirmationui/TestModeCommands.aidl new file mode 100644 index 0000000000..b8629d1321 --- /dev/null +++ b/confirmationui/aidl/aidl_api/android.hardware.confirmationui/1/android/hardware/confirmationui/TestModeCommands.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.confirmationui; +@Backing(type="int") @VintfStability +enum TestModeCommands { + OK_EVENT = 0, + CANCEL_EVENT = 1, +} diff --git a/confirmationui/aidl/aidl_api/android.hardware.confirmationui/1/android/hardware/confirmationui/UIOption.aidl b/confirmationui/aidl/aidl_api/android.hardware.confirmationui/1/android/hardware/confirmationui/UIOption.aidl new file mode 100644 index 0000000000..ebecf9e295 --- /dev/null +++ b/confirmationui/aidl/aidl_api/android.hardware.confirmationui/1/android/hardware/confirmationui/UIOption.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.confirmationui; +@Backing(type="int") @VintfStability +enum UIOption { + ACCESSIBILITY_INVERTED = 0, + ACCESSIBILITY_MAGNIFIED = 1, +} diff --git a/contexthub/aidl/Android.bp b/contexthub/aidl/Android.bp index a8654455e7..814bf3b200 100644 --- a/contexthub/aidl/Android.bp +++ b/contexthub/aidl/Android.bp @@ -40,6 +40,12 @@ aidl_interface { version: "1", imports: [], }, + { + version: "2", + imports: [], + }, + ], + frozen: true, } diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/2/.hash b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/.hash new file mode 100644 index 0000000000..44f517b4bb --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/.hash @@ -0,0 +1 @@ +b0fd976b134e549e03726d3ebeeae848e520d3d3 diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/AsyncEventType.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/AsyncEventType.aidl new file mode 100644 index 0000000000..8e0ff89c12 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/AsyncEventType.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2021 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 -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.hardware.contexthub; +@Backing(type="int") @VintfStability +enum AsyncEventType { + RESTARTED = 1, +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/ContextHubInfo.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/ContextHubInfo.aidl new file mode 100644 index 0000000000..e5735566e7 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/ContextHubInfo.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2021 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 -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.hardware.contexthub; +@VintfStability +parcelable ContextHubInfo { + String name; + String vendor; + String toolchain; + int id; + float peakMips; + int maxSupportedMessageLengthBytes; + long chrePlatformId; + byte chreApiMajorVersion; + byte chreApiMinorVersion; + char chrePatchVersion; + String[] supportedPermissions; +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/ContextHubMessage.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/ContextHubMessage.aidl new file mode 100644 index 0000000000..e38c251928 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/ContextHubMessage.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.contexthub; +@VintfStability +parcelable ContextHubMessage { + long nanoappId; + char hostEndPoint; + int messageType; + byte[] messageBody; + String[] permissions; +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/HostEndpointInfo.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/HostEndpointInfo.aidl new file mode 100644 index 0000000000..dabdbb6648 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/HostEndpointInfo.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2021 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 -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.hardware.contexthub; +@VintfStability +parcelable HostEndpointInfo { + char hostEndpointId; + android.hardware.contexthub.HostEndpointInfo.Type type; + @nullable String packageName; + @nullable String attributionTag; + @Backing(type="int") @VintfStability + enum Type { + FRAMEWORK = 1, + APP = 2, + NATIVE = 3, + } +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/IContextHub.aidl new file mode 100644 index 0000000000..de8d752695 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/IContextHub.aidl @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2021 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 -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.hardware.contexthub; +@VintfStability +interface IContextHub { + List getContextHubs(); + void loadNanoapp(in int contextHubId, in android.hardware.contexthub.NanoappBinary appBinary, in int transactionId); + void unloadNanoapp(in int contextHubId, in long appId, in int transactionId); + void disableNanoapp(in int contextHubId, in long appId, in int transactionId); + void enableNanoapp(in int contextHubId, in long appId, in int transactionId); + void onSettingChanged(in android.hardware.contexthub.Setting setting, in boolean enabled); + void queryNanoapps(in int contextHubId); + void registerCallback(in int contextHubId, in android.hardware.contexthub.IContextHubCallback cb); + void sendMessageToHub(in int contextHubId, in android.hardware.contexthub.ContextHubMessage message); + void onHostEndpointConnected(in android.hardware.contexthub.HostEndpointInfo hostEndpointInfo); + void onHostEndpointDisconnected(char hostEndpointId); + long[] getPreloadedNanoappIds(in int contextHubId); + void onNanSessionStateChanged(in android.hardware.contexthub.NanSessionStateUpdate update); + void setTestMode(in boolean enable); + const int EX_CONTEXT_HUB_UNSPECIFIED = (-1) /* -1 */; +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/IContextHubCallback.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/IContextHubCallback.aidl new file mode 100644 index 0000000000..6163cfc662 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/IContextHubCallback.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.contexthub; +@VintfStability +interface IContextHubCallback { + void handleNanoappInfo(in android.hardware.contexthub.NanoappInfo[] appInfo); + void handleContextHubMessage(in android.hardware.contexthub.ContextHubMessage msg, in String[] msgContentPerms); + void handleContextHubAsyncEvent(in android.hardware.contexthub.AsyncEventType evt); + void handleTransactionResult(in int transactionId, in boolean success); + void handleNanSessionRequest(in android.hardware.contexthub.NanSessionRequest request); + const int CONTEXTHUB_NAN_TRANSACTION_TIMEOUT_MS = 10000; +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/NanSessionRequest.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/NanSessionRequest.aidl new file mode 100644 index 0000000000..d539707ccc --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/NanSessionRequest.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.hardware.contexthub; +@VintfStability +parcelable NanSessionRequest { + boolean enable; +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/NanSessionStateUpdate.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/NanSessionStateUpdate.aidl new file mode 100644 index 0000000000..80771e2365 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/NanSessionStateUpdate.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.hardware.contexthub; +@VintfStability +parcelable NanSessionStateUpdate { + boolean state; +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/NanoappBinary.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/NanoappBinary.aidl new file mode 100644 index 0000000000..fdf38601a9 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/NanoappBinary.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.contexthub; +@VintfStability +parcelable NanoappBinary { + long nanoappId; + int nanoappVersion; + int flags; + byte targetChreApiMajorVersion; + byte targetChreApiMinorVersion; + byte[] customBinary; + const int FLAG_SIGNED = (1 << 0) /* 1 */; + const int FLAG_ENCRYPTED = (1 << 1) /* 2 */; + const int FLAG_TCM_CAPABLE = (1 << 2) /* 4 */; +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/NanoappInfo.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/NanoappInfo.aidl new file mode 100644 index 0000000000..7175d7f329 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/NanoappInfo.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.contexthub; +@VintfStability +parcelable NanoappInfo { + long nanoappId; + int nanoappVersion; + boolean enabled; + String[] permissions; + android.hardware.contexthub.NanoappRpcService[] rpcServices; +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/NanoappRpcService.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/NanoappRpcService.aidl new file mode 100644 index 0000000000..a6a1644195 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/NanoappRpcService.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.contexthub; +@VintfStability +parcelable NanoappRpcService { + long id; + int version; +} diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/Setting.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/Setting.aidl new file mode 100644 index 0000000000..aeb720b779 --- /dev/null +++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/2/android/hardware/contexthub/Setting.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.contexthub; +@Backing(type="byte") @VintfStability +enum Setting { + LOCATION = 1, + WIFI_MAIN, + WIFI_SCANNING, + AIRPLANE_MODE, + MICROPHONE, + BT_MAIN, + BT_SCANNING, +} diff --git a/fastboot/aidl/Android.bp b/fastboot/aidl/Android.bp index a5735abdb6..29423cb4df 100644 --- a/fastboot/aidl/Android.bp +++ b/fastboot/aidl/Android.bp @@ -35,4 +35,12 @@ aidl_interface { enabled: false, }, }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + frozen: true, + } diff --git a/fastboot/aidl/aidl_api/android.hardware.fastboot/1/.hash b/fastboot/aidl/aidl_api/android.hardware.fastboot/1/.hash new file mode 100644 index 0000000000..458ca94d1b --- /dev/null +++ b/fastboot/aidl/aidl_api/android.hardware.fastboot/1/.hash @@ -0,0 +1 @@ +da59ee6c3e1088cbace3b6a913077ce52ca2ef25 diff --git a/fastboot/aidl/aidl_api/android.hardware.fastboot/1/android/hardware/fastboot/FileSystemType.aidl b/fastboot/aidl/aidl_api/android.hardware.fastboot/1/android/hardware/fastboot/FileSystemType.aidl new file mode 100644 index 0000000000..b8a8828ee1 --- /dev/null +++ b/fastboot/aidl/aidl_api/android.hardware.fastboot/1/android/hardware/fastboot/FileSystemType.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.fastboot; +@Backing(type="byte") @VintfStability +enum FileSystemType { + EXT4, + F2FS, + RAW, +} diff --git a/fastboot/aidl/aidl_api/android.hardware.fastboot/1/android/hardware/fastboot/IFastboot.aidl b/fastboot/aidl/aidl_api/android.hardware.fastboot/1/android/hardware/fastboot/IFastboot.aidl new file mode 100644 index 0000000000..445fcdef75 --- /dev/null +++ b/fastboot/aidl/aidl_api/android.hardware.fastboot/1/android/hardware/fastboot/IFastboot.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.fastboot; +@VintfStability +interface IFastboot { + String doOemCommand(in String oemCmd); + void doOemSpecificErase(); + int getBatteryVoltageFlashingThreshold(); + boolean getOffModeChargeState(); + android.hardware.fastboot.FileSystemType getPartitionType(in String partitionName); + String getVariant(); + const int FAILURE_UNKNOWN = 1; +} diff --git a/gatekeeper/aidl/Android.bp b/gatekeeper/aidl/Android.bp index 770e8ab694..b050f6a1a5 100644 --- a/gatekeeper/aidl/Android.bp +++ b/gatekeeper/aidl/Android.bp @@ -26,4 +26,12 @@ aidl_interface { enabled: false, }, }, + versions_with_info: [ + { + version: "1", + imports: ["android.hardware.security.keymint-V3"], + }, + ], + frozen: true, + } diff --git a/gatekeeper/aidl/aidl_api/android.hardware.gatekeeper/1/.hash b/gatekeeper/aidl/aidl_api/android.hardware.gatekeeper/1/.hash new file mode 100644 index 0000000000..f06e62b93b --- /dev/null +++ b/gatekeeper/aidl/aidl_api/android.hardware.gatekeeper/1/.hash @@ -0,0 +1 @@ +d877e8a1608a00fd9068bcd7e69ea480a7ea17f0 diff --git a/gatekeeper/aidl/aidl_api/android.hardware.gatekeeper/1/android/hardware/gatekeeper/GatekeeperEnrollResponse.aidl b/gatekeeper/aidl/aidl_api/android.hardware.gatekeeper/1/android/hardware/gatekeeper/GatekeeperEnrollResponse.aidl new file mode 100644 index 0000000000..ae64ffce5a --- /dev/null +++ b/gatekeeper/aidl/aidl_api/android.hardware.gatekeeper/1/android/hardware/gatekeeper/GatekeeperEnrollResponse.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.gatekeeper; +@VintfStability +parcelable GatekeeperEnrollResponse { + int statusCode; + int timeoutMs; + long secureUserId; + byte[] data; +} diff --git a/gatekeeper/aidl/aidl_api/android.hardware.gatekeeper/1/android/hardware/gatekeeper/GatekeeperVerifyResponse.aidl b/gatekeeper/aidl/aidl_api/android.hardware.gatekeeper/1/android/hardware/gatekeeper/GatekeeperVerifyResponse.aidl new file mode 100644 index 0000000000..f55da302d2 --- /dev/null +++ b/gatekeeper/aidl/aidl_api/android.hardware.gatekeeper/1/android/hardware/gatekeeper/GatekeeperVerifyResponse.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.gatekeeper; +@VintfStability +parcelable GatekeeperVerifyResponse { + int statusCode; + int timeoutMs; + android.hardware.security.keymint.HardwareAuthToken hardwareAuthToken; +} diff --git a/gatekeeper/aidl/aidl_api/android.hardware.gatekeeper/1/android/hardware/gatekeeper/IGatekeeper.aidl b/gatekeeper/aidl/aidl_api/android.hardware.gatekeeper/1/android/hardware/gatekeeper/IGatekeeper.aidl new file mode 100644 index 0000000000..ab74615a3b --- /dev/null +++ b/gatekeeper/aidl/aidl_api/android.hardware.gatekeeper/1/android/hardware/gatekeeper/IGatekeeper.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.gatekeeper; +@SensitiveData @VintfStability +interface IGatekeeper { + void deleteAllUsers(); + void deleteUser(in int uid); + android.hardware.gatekeeper.GatekeeperEnrollResponse enroll(in int uid, in byte[] currentPasswordHandle, in byte[] currentPassword, in byte[] desiredPassword); + android.hardware.gatekeeper.GatekeeperVerifyResponse verify(in int uid, in long challenge, in byte[] enrolledPasswordHandle, in byte[] providedPassword); + const int STATUS_REENROLL = 1; + const int STATUS_OK = 0; + const int ERROR_GENERAL_FAILURE = (-1) /* -1 */; + const int ERROR_RETRY_TIMEOUT = (-2) /* -2 */; + const int ERROR_NOT_IMPLEMENTED = (-3) /* -3 */; +} diff --git a/gnss/aidl/Android.bp b/gnss/aidl/Android.bp index f45fe5d54b..cb2c001612 100644 --- a/gnss/aidl/Android.bp +++ b/gnss/aidl/Android.bp @@ -46,7 +46,12 @@ aidl_interface { version: "2", imports: [], }, + { + version: "3", + imports: [], + }, ], + frozen: true, } diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/.hash b/gnss/aidl/aidl_api/android.hardware.gnss/3/.hash new file mode 100644 index 0000000000..06d0e5d850 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/.hash @@ -0,0 +1 @@ +747fa8b8b4bb55d21f2c42446dd1b31de1dfbeaa diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/BlocklistedSource.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/BlocklistedSource.aidl new file mode 100644 index 0000000000..ccb2b281db --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/BlocklistedSource.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +parcelable BlocklistedSource { + android.hardware.gnss.GnssConstellationType constellation = android.hardware.gnss.GnssConstellationType.UNKNOWN; + int svid; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/CorrelationVector.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/CorrelationVector.aidl new file mode 100644 index 0000000000..b9590036db --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/CorrelationVector.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +parcelable CorrelationVector { + double frequencyOffsetMps; + double samplingWidthM; + double samplingStartM; + int[] magnitude; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/ElapsedRealtime.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/ElapsedRealtime.aidl new file mode 100644 index 0000000000..5d7f51e342 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/ElapsedRealtime.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +parcelable ElapsedRealtime { + int flags; + long timestampNs; + double timeUncertaintyNs; + const int HAS_TIMESTAMP_NS = (1 << 0) /* 1 */; + const int HAS_TIME_UNCERTAINTY_NS = (1 << 1) /* 2 */; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssClock.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssClock.aidl new file mode 100644 index 0000000000..63edd44a19 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssClock.aidl @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +parcelable GnssClock { + int gnssClockFlags; + int leapSecond; + long timeNs; + double timeUncertaintyNs; + long fullBiasNs; + double biasNs; + double biasUncertaintyNs; + double driftNsps; + double driftUncertaintyNsps; + int hwClockDiscontinuityCount; + android.hardware.gnss.GnssSignalType referenceSignalTypeForIsb; + const int HAS_LEAP_SECOND = (1 << 0) /* 1 */; + const int HAS_TIME_UNCERTAINTY = (1 << 1) /* 2 */; + const int HAS_FULL_BIAS = (1 << 2) /* 4 */; + const int HAS_BIAS = (1 << 3) /* 8 */; + const int HAS_BIAS_UNCERTAINTY = (1 << 4) /* 16 */; + const int HAS_DRIFT = (1 << 5) /* 32 */; + const int HAS_DRIFT_UNCERTAINTY = (1 << 6) /* 64 */; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssConstellationType.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssConstellationType.aidl new file mode 100644 index 0000000000..fee2ef67c3 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssConstellationType.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@Backing(type="int") @VintfStability +enum GnssConstellationType { + UNKNOWN = 0, + GPS = 1, + SBAS = 2, + GLONASS = 3, + QZSS = 4, + BEIDOU = 5, + GALILEO = 6, + IRNSS = 7, +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssData.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssData.aidl new file mode 100644 index 0000000000..54e3b2165e --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssData.aidl @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +parcelable GnssData { + android.hardware.gnss.GnssMeasurement[] measurements; + android.hardware.gnss.GnssClock clock; + android.hardware.gnss.ElapsedRealtime elapsedRealtime; + android.hardware.gnss.GnssData.GnssAgc[] gnssAgcs = {}; + boolean isFullTracking; + @VintfStability + parcelable GnssAgc { + double agcLevelDb; + android.hardware.gnss.GnssConstellationType constellation = android.hardware.gnss.GnssConstellationType.UNKNOWN; + long carrierFrequencyHz; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssLocation.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssLocation.aidl new file mode 100644 index 0000000000..e64d98a297 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssLocation.aidl @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2021 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +parcelable GnssLocation { + int gnssLocationFlags; + double latitudeDegrees; + double longitudeDegrees; + double altitudeMeters; + double speedMetersPerSec; + double bearingDegrees; + double horizontalAccuracyMeters; + double verticalAccuracyMeters; + double speedAccuracyMetersPerSecond; + double bearingAccuracyDegrees; + long timestampMillis; + android.hardware.gnss.ElapsedRealtime elapsedRealtime; + const int HAS_LAT_LONG = 0x0001; + const int HAS_ALTITUDE = 0x0002; + const int HAS_SPEED = 0x0004; + const int HAS_BEARING = 0x0008; + const int HAS_HORIZONTAL_ACCURACY = 0x0010; + const int HAS_VERTICAL_ACCURACY = 0x0020; + const int HAS_SPEED_ACCURACY = 0x0040; + const int HAS_BEARING_ACCURACY = 0x0080; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssMeasurement.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssMeasurement.aidl new file mode 100644 index 0000000000..a2594af99a --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssMeasurement.aidl @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +parcelable GnssMeasurement { + int flags; + int svid; + android.hardware.gnss.GnssSignalType signalType; + double timeOffsetNs; + int state; + long receivedSvTimeInNs; + long receivedSvTimeUncertaintyInNs; + double antennaCN0DbHz; + double basebandCN0DbHz; + double pseudorangeRateMps; + double pseudorangeRateUncertaintyMps; + int accumulatedDeltaRangeState; + double accumulatedDeltaRangeM; + double accumulatedDeltaRangeUncertaintyM; + long carrierCycles; + double carrierPhase; + double carrierPhaseUncertainty; + android.hardware.gnss.GnssMultipathIndicator multipathIndicator = android.hardware.gnss.GnssMultipathIndicator.UNKNOWN; + double snrDb; + double agcLevelDb; + double fullInterSignalBiasNs; + double fullInterSignalBiasUncertaintyNs; + double satelliteInterSignalBiasNs; + double satelliteInterSignalBiasUncertaintyNs; + android.hardware.gnss.SatellitePvt satellitePvt; + android.hardware.gnss.CorrelationVector[] correlationVectors; + const int HAS_SNR = (1 << 0) /* 1 */; + const int HAS_CARRIER_FREQUENCY = (1 << 9) /* 512 */; + const int HAS_CARRIER_CYCLES = (1 << 10) /* 1024 */; + const int HAS_CARRIER_PHASE = (1 << 11) /* 2048 */; + const int HAS_CARRIER_PHASE_UNCERTAINTY = (1 << 12) /* 4096 */; + const int HAS_AUTOMATIC_GAIN_CONTROL = (1 << 13) /* 8192 */; + const int HAS_FULL_ISB = (1 << 16) /* 65536 */; + const int HAS_FULL_ISB_UNCERTAINTY = (1 << 17) /* 131072 */; + const int HAS_SATELLITE_ISB = (1 << 18) /* 262144 */; + const int HAS_SATELLITE_ISB_UNCERTAINTY = (1 << 19) /* 524288 */; + const int HAS_SATELLITE_PVT = (1 << 20) /* 1048576 */; + const int HAS_CORRELATION_VECTOR = (1 << 21) /* 2097152 */; + const int STATE_UNKNOWN = 0; + const int STATE_CODE_LOCK = (1 << 0) /* 1 */; + const int STATE_BIT_SYNC = (1 << 1) /* 2 */; + const int STATE_SUBFRAME_SYNC = (1 << 2) /* 4 */; + const int STATE_TOW_DECODED = (1 << 3) /* 8 */; + const int STATE_MSEC_AMBIGUOUS = (1 << 4) /* 16 */; + const int STATE_SYMBOL_SYNC = (1 << 5) /* 32 */; + const int STATE_GLO_STRING_SYNC = (1 << 6) /* 64 */; + const int STATE_GLO_TOD_DECODED = (1 << 7) /* 128 */; + const int STATE_BDS_D2_BIT_SYNC = (1 << 8) /* 256 */; + const int STATE_BDS_D2_SUBFRAME_SYNC = (1 << 9) /* 512 */; + const int STATE_GAL_E1BC_CODE_LOCK = (1 << 10) /* 1024 */; + const int STATE_GAL_E1C_2ND_CODE_LOCK = (1 << 11) /* 2048 */; + const int STATE_GAL_E1B_PAGE_SYNC = (1 << 12) /* 4096 */; + const int STATE_SBAS_SYNC = (1 << 13) /* 8192 */; + const int STATE_TOW_KNOWN = (1 << 14) /* 16384 */; + const int STATE_GLO_TOD_KNOWN = (1 << 15) /* 32768 */; + const int STATE_2ND_CODE_LOCK = (1 << 16) /* 65536 */; + const int ADR_STATE_UNKNOWN = 0; + const int ADR_STATE_VALID = (1 << 0) /* 1 */; + const int ADR_STATE_RESET = (1 << 1) /* 2 */; + const int ADR_STATE_CYCLE_SLIP = (1 << 2) /* 4 */; + const int ADR_STATE_HALF_CYCLE_RESOLVED = (1 << 3) /* 8 */; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssMultipathIndicator.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssMultipathIndicator.aidl new file mode 100644 index 0000000000..62ade9c3e8 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssMultipathIndicator.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@Backing(type="int") @VintfStability +enum GnssMultipathIndicator { + UNKNOWN = 0, + PRESENT = 1, + NOT_PRESENT = 2, +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssPowerStats.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssPowerStats.aidl new file mode 100644 index 0000000000..c4a9e6179e --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssPowerStats.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +parcelable GnssPowerStats { + android.hardware.gnss.ElapsedRealtime elapsedRealtime; + double totalEnergyMilliJoule; + double singlebandTrackingModeEnergyMilliJoule; + double multibandTrackingModeEnergyMilliJoule; + double singlebandAcquisitionModeEnergyMilliJoule; + double multibandAcquisitionModeEnergyMilliJoule; + double[] otherModesEnergyMilliJoule; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssSignalType.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssSignalType.aidl new file mode 100644 index 0000000000..4a49547b49 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/GnssSignalType.aidl @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +parcelable GnssSignalType { + android.hardware.gnss.GnssConstellationType constellation = android.hardware.gnss.GnssConstellationType.UNKNOWN; + double carrierFrequencyHz; + @utf8InCpp String codeType; + const @utf8InCpp String CODE_TYPE_A = "A"; + const @utf8InCpp String CODE_TYPE_B = "B"; + const @utf8InCpp String CODE_TYPE_C = "C"; + const @utf8InCpp String CODE_TYPE_D = "D"; + const @utf8InCpp String CODE_TYPE_I = "I"; + const @utf8InCpp String CODE_TYPE_L = "L"; + const @utf8InCpp String CODE_TYPE_M = "M"; + const @utf8InCpp String CODE_TYPE_N = "N"; + const @utf8InCpp String CODE_TYPE_P = "P"; + const @utf8InCpp String CODE_TYPE_Q = "Q"; + const @utf8InCpp String CODE_TYPE_S = "S"; + const @utf8InCpp String CODE_TYPE_W = "W"; + const @utf8InCpp String CODE_TYPE_X = "X"; + const @utf8InCpp String CODE_TYPE_Y = "Y"; + const @utf8InCpp String CODE_TYPE_Z = "Z"; + const @utf8InCpp String CODE_TYPE_UNKNOWN = "UNKNOWN"; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IAGnss.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IAGnss.aidl new file mode 100644 index 0000000000..639539ad65 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IAGnss.aidl @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2021 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +interface IAGnss { + void setCallback(in android.hardware.gnss.IAGnssCallback callback); + void dataConnClosed(); + void dataConnFailed(); + void setServer(in android.hardware.gnss.IAGnssCallback.AGnssType type, in @utf8InCpp String hostname, in int port); + void dataConnOpen(in long networkHandle, in @utf8InCpp String apn, in android.hardware.gnss.IAGnss.ApnIpType apnIpType); + @Backing(type="int") @VintfStability + enum ApnIpType { + INVALID = 0, + IPV4 = 1, + IPV6 = 2, + IPV4V6 = 3, + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IAGnssCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IAGnssCallback.aidl new file mode 100644 index 0000000000..b2da8d9583 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IAGnssCallback.aidl @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2021 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +interface IAGnssCallback { + void agnssStatusCb(in android.hardware.gnss.IAGnssCallback.AGnssType type, in android.hardware.gnss.IAGnssCallback.AGnssStatusValue status); + @Backing(type="int") @VintfStability + enum AGnssType { + SUPL = 1, + C2K = 2, + SUPL_EIMS = 3, + SUPL_IMS = 4, + } + @Backing(type="int") @VintfStability + enum AGnssStatusValue { + REQUEST_AGNSS_DATA_CONN = 1, + RELEASE_AGNSS_DATA_CONN = 2, + AGNSS_DATA_CONNECTED = 3, + AGNSS_DATA_CONN_DONE = 4, + AGNSS_DATA_CONN_FAILED = 5, + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IAGnssRil.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IAGnssRil.aidl new file mode 100644 index 0000000000..c8634ec2b0 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IAGnssRil.aidl @@ -0,0 +1,81 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +interface IAGnssRil { + void setCallback(in android.hardware.gnss.IAGnssRilCallback callback); + void setRefLocation(in android.hardware.gnss.IAGnssRil.AGnssRefLocation agnssReflocation); + void setSetId(in android.hardware.gnss.IAGnssRil.SetIdType type, in @utf8InCpp String setid); + void updateNetworkState(in android.hardware.gnss.IAGnssRil.NetworkAttributes attributes); + void injectNiSuplMessageData(in byte[] msgData, in int slotIndex); + const int NETWORK_CAPABILITY_NOT_METERED = 0x01; + const int NETWORK_CAPABILITY_NOT_ROAMING = 0x02; + @Backing(type="int") @VintfStability + enum AGnssRefLocationType { + GSM_CELLID = 1, + UMTS_CELLID = 2, + LTE_CELLID = 4, + NR_CELLID = 8, + } + @Backing(type="int") @VintfStability + enum SetIdType { + NONE = 0, + IMSI = 1, + MSISDM = 2, + } + @VintfStability + parcelable AGnssRefLocationCellID { + android.hardware.gnss.IAGnssRil.AGnssRefLocationType type; + int mcc; + int mnc; + int lac; + long cid; + int tac; + int pcid; + int arfcn; + } + @VintfStability + parcelable AGnssRefLocation { + android.hardware.gnss.IAGnssRil.AGnssRefLocationType type; + android.hardware.gnss.IAGnssRil.AGnssRefLocationCellID cellID; + } + @VintfStability + parcelable NetworkAttributes { + long networkHandle; + boolean isConnected; + int capabilities; + @utf8InCpp String apn; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IAGnssRilCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IAGnssRilCallback.aidl new file mode 100644 index 0000000000..3717026622 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IAGnssRilCallback.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +interface IAGnssRilCallback { + void requestSetIdCb(in int setIdflag); + void requestRefLocCb(); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnss.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnss.aidl new file mode 100644 index 0000000000..d1aaf2c457 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnss.aidl @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +interface IGnss { + void setCallback(in android.hardware.gnss.IGnssCallback callback); + void close(); + @nullable android.hardware.gnss.IGnssPsds getExtensionPsds(); + android.hardware.gnss.IGnssConfiguration getExtensionGnssConfiguration(); + android.hardware.gnss.IGnssMeasurementInterface getExtensionGnssMeasurement(); + android.hardware.gnss.IGnssPowerIndication getExtensionGnssPowerIndication(); + @nullable android.hardware.gnss.IGnssBatching getExtensionGnssBatching(); + @nullable android.hardware.gnss.IGnssGeofence getExtensionGnssGeofence(); + @nullable android.hardware.gnss.IGnssNavigationMessageInterface getExtensionGnssNavigationMessage(); + android.hardware.gnss.IAGnss getExtensionAGnss(); + android.hardware.gnss.IAGnssRil getExtensionAGnssRil(); + android.hardware.gnss.IGnssDebug getExtensionGnssDebug(); + android.hardware.gnss.visibility_control.IGnssVisibilityControl getExtensionGnssVisibilityControl(); + void start(); + void stop(); + void injectTime(in long timeMs, in long timeReferenceMs, in int uncertaintyMs); + void injectLocation(in android.hardware.gnss.GnssLocation location); + void injectBestLocation(in android.hardware.gnss.GnssLocation location); + void deleteAidingData(in android.hardware.gnss.IGnss.GnssAidingData aidingDataFlags); + void setPositionMode(in android.hardware.gnss.IGnss.PositionModeOptions options); + android.hardware.gnss.IGnssAntennaInfo getExtensionGnssAntennaInfo(); + @nullable android.hardware.gnss.measurement_corrections.IMeasurementCorrectionsInterface getExtensionMeasurementCorrections(); + void startSvStatus(); + void stopSvStatus(); + void startNmea(); + void stopNmea(); + const int ERROR_INVALID_ARGUMENT = 1; + const int ERROR_ALREADY_INIT = 2; + const int ERROR_GENERIC = 3; + @Backing(type="int") @VintfStability + enum GnssPositionMode { + STANDALONE = 0, + MS_BASED = 1, + MS_ASSISTED = 2, + } + @Backing(type="int") @VintfStability + enum GnssPositionRecurrence { + RECURRENCE_PERIODIC = 0, + RECURRENCE_SINGLE = 1, + } + @Backing(type="int") @VintfStability + enum GnssAidingData { + EPHEMERIS = 0x0001, + ALMANAC = 0x0002, + POSITION = 0x0004, + TIME = 0x0008, + IONO = 0x0010, + UTC = 0x0020, + HEALTH = 0x0040, + SVDIR = 0x0080, + SVSTEER = 0x0100, + SADATA = 0x0200, + RTI = 0x0400, + CELLDB_INFO = 0x8000, + ALL = 0xFFFF, + } + @VintfStability + parcelable PositionModeOptions { + android.hardware.gnss.IGnss.GnssPositionMode mode; + android.hardware.gnss.IGnss.GnssPositionRecurrence recurrence; + int minIntervalMs; + int preferredAccuracyMeters; + int preferredTimeMs; + boolean lowPowerMode; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssAntennaInfo.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssAntennaInfo.aidl new file mode 100644 index 0000000000..43ad328e5c --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssAntennaInfo.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +interface IGnssAntennaInfo { + void setCallback(in android.hardware.gnss.IGnssAntennaInfoCallback callback); + void close(); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssAntennaInfoCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssAntennaInfoCallback.aidl new file mode 100644 index 0000000000..eb6abe55f8 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssAntennaInfoCallback.aidl @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2021 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +interface IGnssAntennaInfoCallback { + void gnssAntennaInfoCb(in android.hardware.gnss.IGnssAntennaInfoCallback.GnssAntennaInfo[] gnssAntennaInfos); + @VintfStability + parcelable Row { + double[] row; + } + @VintfStability + parcelable Coord { + double x; + double xUncertainty; + double y; + double yUncertainty; + double z; + double zUncertainty; + } + @VintfStability + parcelable GnssAntennaInfo { + long carrierFrequencyHz; + android.hardware.gnss.IGnssAntennaInfoCallback.Coord phaseCenterOffsetCoordinateMillimeters; + android.hardware.gnss.IGnssAntennaInfoCallback.Row[] phaseCenterVariationCorrectionMillimeters; + android.hardware.gnss.IGnssAntennaInfoCallback.Row[] phaseCenterVariationCorrectionUncertaintyMillimeters; + android.hardware.gnss.IGnssAntennaInfoCallback.Row[] signalGainCorrectionDbi; + android.hardware.gnss.IGnssAntennaInfoCallback.Row[] signalGainCorrectionUncertaintyDbi; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssBatching.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssBatching.aidl new file mode 100644 index 0000000000..a021f55918 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssBatching.aidl @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2021 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +interface IGnssBatching { + void init(in android.hardware.gnss.IGnssBatchingCallback callback); + int getBatchSize(); + void start(in android.hardware.gnss.IGnssBatching.Options options); + void flush(); + void stop(); + void cleanup(); + const int WAKEUP_ON_FIFO_FULL = 0x01; + @VintfStability + parcelable Options { + long periodNanos; + float minDistanceMeters; + int flags; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssBatchingCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssBatchingCallback.aidl new file mode 100644 index 0000000000..b12a8bd519 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssBatchingCallback.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +interface IGnssBatchingCallback { + void gnssLocationBatchCb(in android.hardware.gnss.GnssLocation[] locations); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssCallback.aidl new file mode 100644 index 0000000000..61710d3e25 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssCallback.aidl @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +interface IGnssCallback { + void gnssSetCapabilitiesCb(in int capabilities); + void gnssStatusCb(in android.hardware.gnss.IGnssCallback.GnssStatusValue status); + void gnssSvStatusCb(in android.hardware.gnss.IGnssCallback.GnssSvInfo[] svInfoList); + void gnssLocationCb(in android.hardware.gnss.GnssLocation location); + void gnssNmeaCb(in long timestamp, in @utf8InCpp String nmea); + void gnssAcquireWakelockCb(); + void gnssReleaseWakelockCb(); + void gnssSetSystemInfoCb(in android.hardware.gnss.IGnssCallback.GnssSystemInfo info); + void gnssRequestTimeCb(); + void gnssRequestLocationCb(in boolean independentFromGnss, in boolean isUserEmergency); + void gnssSetSignalTypeCapabilitiesCb(in android.hardware.gnss.GnssSignalType[] gnssSignalTypes); + const int CAPABILITY_SCHEDULING = (1 << 0) /* 1 */; + const int CAPABILITY_MSB = (1 << 1) /* 2 */; + const int CAPABILITY_MSA = (1 << 2) /* 4 */; + const int CAPABILITY_SINGLE_SHOT = (1 << 3) /* 8 */; + const int CAPABILITY_ON_DEMAND_TIME = (1 << 4) /* 16 */; + const int CAPABILITY_GEOFENCING = (1 << 5) /* 32 */; + const int CAPABILITY_MEASUREMENTS = (1 << 6) /* 64 */; + const int CAPABILITY_NAV_MESSAGES = (1 << 7) /* 128 */; + const int CAPABILITY_LOW_POWER_MODE = (1 << 8) /* 256 */; + const int CAPABILITY_SATELLITE_BLOCKLIST = (1 << 9) /* 512 */; + const int CAPABILITY_MEASUREMENT_CORRECTIONS = (1 << 10) /* 1024 */; + const int CAPABILITY_ANTENNA_INFO = (1 << 11) /* 2048 */; + const int CAPABILITY_CORRELATION_VECTOR = (1 << 12) /* 4096 */; + const int CAPABILITY_SATELLITE_PVT = (1 << 13) /* 8192 */; + const int CAPABILITY_MEASUREMENT_CORRECTIONS_FOR_DRIVING = (1 << 14) /* 16384 */; + const int CAPABILITY_ACCUMULATED_DELTA_RANGE = (1 << 15) /* 32768 */; + @Backing(type="int") @VintfStability + enum GnssStatusValue { + NONE = 0, + SESSION_BEGIN = 1, + SESSION_END = 2, + ENGINE_ON = 3, + ENGINE_OFF = 4, + } + @Backing(type="int") @VintfStability + enum GnssSvFlags { + NONE = 0, + HAS_EPHEMERIS_DATA = (1 << 0) /* 1 */, + HAS_ALMANAC_DATA = (1 << 1) /* 2 */, + USED_IN_FIX = (1 << 2) /* 4 */, + HAS_CARRIER_FREQUENCY = (1 << 3) /* 8 */, + } + @VintfStability + parcelable GnssSvInfo { + int svid; + android.hardware.gnss.GnssConstellationType constellation; + float cN0Dbhz; + float basebandCN0DbHz; + float elevationDegrees; + float azimuthDegrees; + long carrierFrequencyHz; + int svFlag; + } + @VintfStability + parcelable GnssSystemInfo { + int yearOfHw; + @utf8InCpp String name; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssConfiguration.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssConfiguration.aidl new file mode 100644 index 0000000000..70df11afa9 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssConfiguration.aidl @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +interface IGnssConfiguration { + void setSuplVersion(in int version); + void setSuplMode(in int mode); + void setLppProfile(in int lppProfile); + void setGlonassPositioningProtocol(in int protocol); + void setEmergencySuplPdn(in boolean enable); + void setEsExtensionSec(in int emergencyExtensionSeconds); + void setBlocklist(in android.hardware.gnss.BlocklistedSource[] blocklist); + const int SUPL_MODE_MSB = 0x01; + const int SUPL_MODE_MSA = 0x02; + const int LPP_PROFILE_USER_PLANE = 0x01; + const int LPP_PROFILE_CONTROL_PLANE = 0x02; + const int GLONASS_POS_PROTOCOL_RRC_CPLANE = 0x01; + const int GLONASS_POS_PROTOCOL_RRLP_UPLANE = 0x02; + const int GLONASS_POS_PROTOCOL_LPP_UPLANE = 0x04; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssDebug.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssDebug.aidl new file mode 100644 index 0000000000..591b53301f --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssDebug.aidl @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2021 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +interface IGnssDebug { + android.hardware.gnss.IGnssDebug.DebugData getDebugData(); + @Backing(type="int") @VintfStability + enum SatelliteEphemerisType { + EPHEMERIS = 0, + ALMANAC_ONLY = 1, + NOT_AVAILABLE = 2, + } + @Backing(type="int") @VintfStability + enum SatelliteEphemerisHealth { + GOOD = 0, + BAD = 1, + UNKNOWN = 2, + } + @VintfStability + parcelable TimeDebug { + long timeEstimateMs; + float timeUncertaintyNs; + float frequencyUncertaintyNsPerSec; + } + @VintfStability + parcelable PositionDebug { + boolean valid; + double latitudeDegrees; + double longitudeDegrees; + float altitudeMeters; + float speedMetersPerSec; + float bearingDegrees; + double horizontalAccuracyMeters; + double verticalAccuracyMeters; + double speedAccuracyMetersPerSecond; + double bearingAccuracyDegrees; + float ageSeconds; + } + @VintfStability + parcelable SatelliteData { + int svid; + android.hardware.gnss.GnssConstellationType constellation; + android.hardware.gnss.IGnssDebug.SatelliteEphemerisType ephemerisType; + android.hardware.gnss.SatellitePvt.SatelliteEphemerisSource ephemerisSource; + android.hardware.gnss.IGnssDebug.SatelliteEphemerisHealth ephemerisHealth; + float ephemerisAgeSeconds; + boolean serverPredictionIsAvailable; + float serverPredictionAgeSeconds; + } + @VintfStability + parcelable DebugData { + android.hardware.gnss.IGnssDebug.PositionDebug position; + android.hardware.gnss.IGnssDebug.TimeDebug time; + List satelliteDataArray; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssGeofence.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssGeofence.aidl new file mode 100644 index 0000000000..5065ad49c8 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssGeofence.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +interface IGnssGeofence { + void setCallback(in android.hardware.gnss.IGnssGeofenceCallback callback); + void addGeofence(in int geofenceId, in double latitudeDegrees, in double longitudeDegrees, in double radiusMeters, in int lastTransition, in int monitorTransitions, in int notificationResponsivenessMs, in int unknownTimerMs); + void pauseGeofence(in int geofenceId); + void resumeGeofence(in int geofenceId, in int monitorTransitions); + void removeGeofence(in int geofenceId); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssGeofenceCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssGeofenceCallback.aidl new file mode 100644 index 0000000000..90f9ebce43 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssGeofenceCallback.aidl @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2021 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +interface IGnssGeofenceCallback { + void gnssGeofenceTransitionCb(in int geofenceId, in android.hardware.gnss.GnssLocation location, in int transition, in long timestampMillis); + void gnssGeofenceStatusCb(in int availability, in android.hardware.gnss.GnssLocation lastLocation); + void gnssGeofenceAddCb(in int geofenceId, in int status); + void gnssGeofenceRemoveCb(in int geofenceId, in int status); + void gnssGeofencePauseCb(in int geofenceId, in int status); + void gnssGeofenceResumeCb(in int geofenceId, in int status); + const int ENTERED = (1 << 0) /* 1 */; + const int EXITED = (1 << 1) /* 2 */; + const int UNCERTAIN = (1 << 2) /* 4 */; + const int UNAVAILABLE = (1 << 0) /* 1 */; + const int AVAILABLE = (1 << 1) /* 2 */; + const int OPERATION_SUCCESS = 0; + const int ERROR_TOO_MANY_GEOFENCES = (-100) /* -100 */; + const int ERROR_ID_EXISTS = (-101) /* -101 */; + const int ERROR_ID_UNKNOWN = (-102) /* -102 */; + const int ERROR_INVALID_TRANSITION = (-103) /* -103 */; + const int ERROR_GENERIC = (-149) /* -149 */; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssMeasurementCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssMeasurementCallback.aidl new file mode 100644 index 0000000000..624a7ae84d --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssMeasurementCallback.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +interface IGnssMeasurementCallback { + void gnssMeasurementCb(in android.hardware.gnss.GnssData data); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssMeasurementInterface.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssMeasurementInterface.aidl new file mode 100644 index 0000000000..6fe6a6c6fd --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssMeasurementInterface.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +interface IGnssMeasurementInterface { + void setCallback(in android.hardware.gnss.IGnssMeasurementCallback callback, in boolean enableFullTracking, in boolean enableCorrVecOutputs); + void close(); + void setCallbackWithOptions(in android.hardware.gnss.IGnssMeasurementCallback callback, in android.hardware.gnss.IGnssMeasurementInterface.Options options); + @VintfStability + parcelable Options { + boolean enableFullTracking; + boolean enableCorrVecOutputs; + int intervalMs; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssNavigationMessageCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssNavigationMessageCallback.aidl new file mode 100644 index 0000000000..57d0e68d44 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssNavigationMessageCallback.aidl @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2021 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +interface IGnssNavigationMessageCallback { + void gnssNavigationMessageCb(in android.hardware.gnss.IGnssNavigationMessageCallback.GnssNavigationMessage message); + @VintfStability + parcelable GnssNavigationMessage { + int svid; + android.hardware.gnss.IGnssNavigationMessageCallback.GnssNavigationMessage.GnssNavigationMessageType type; + int status; + int messageId; + int submessageId; + byte[] data; + const int STATUS_PARITY_PASSED = (1 << 0) /* 1 */; + const int STATUS_PARITY_REBUILT = (1 << 1) /* 2 */; + const int STATUS_UNKNOWN = 0; + @Backing(type="int") @VintfStability + enum GnssNavigationMessageType { + UNKNOWN = 0, + GPS_L1CA = 0x0101, + GPS_L2CNAV = 0x0102, + GPS_L5CNAV = 0x0103, + SBS = 0x0201, + GPS_CNAV2 = 0x0104, + GLO_L1CA = 0x0301, + QZS_L1CA = 0x0401, + BDS_D1 = 0x0501, + BDS_D2 = 0x0502, + BDS_CNAV1 = 0x0503, + BDS_CNAV2 = 0x0504, + GAL_I = 0x0601, + GAL_F = 0x0602, + IRN_L5CA = 0x0701, + } + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssNavigationMessageInterface.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssNavigationMessageInterface.aidl new file mode 100644 index 0000000000..187773dd81 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssNavigationMessageInterface.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +interface IGnssNavigationMessageInterface { + void setCallback(in android.hardware.gnss.IGnssNavigationMessageCallback callback); + void close(); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssPowerIndication.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssPowerIndication.aidl new file mode 100644 index 0000000000..f77dbfff86 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssPowerIndication.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +interface IGnssPowerIndication { + void setCallback(in android.hardware.gnss.IGnssPowerIndicationCallback callback); + oneway void requestGnssPowerStats(); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssPowerIndicationCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssPowerIndicationCallback.aidl new file mode 100644 index 0000000000..07b10ad201 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssPowerIndicationCallback.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +interface IGnssPowerIndicationCallback { + void setCapabilitiesCb(in int capabilities); + oneway void gnssPowerStatsCb(in android.hardware.gnss.GnssPowerStats gnssPowerStats); + const int CAPABILITY_TOTAL = (1 << 0) /* 1 */; + const int CAPABILITY_SINGLEBAND_TRACKING = (1 << 1) /* 2 */; + const int CAPABILITY_MULTIBAND_TRACKING = (1 << 2) /* 4 */; + const int CAPABILITY_SINGLEBAND_ACQUISITION = (1 << 3) /* 8 */; + const int CAPABILITY_MULTIBAND_ACQUISITION = (1 << 4) /* 16 */; + const int CAPABILITY_OTHER_MODES = (1 << 5) /* 32 */; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssPsds.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssPsds.aidl new file mode 100644 index 0000000000..3aee798b33 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssPsds.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +interface IGnssPsds { + void injectPsdsData(in android.hardware.gnss.PsdsType psdsType, in byte[] psdsData); + void setCallback(in android.hardware.gnss.IGnssPsdsCallback callback); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssPsdsCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssPsdsCallback.aidl new file mode 100644 index 0000000000..dadc9fb092 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/IGnssPsdsCallback.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +interface IGnssPsdsCallback { + void downloadRequestCb(in android.hardware.gnss.PsdsType psdsType); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/PsdsType.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/PsdsType.aidl new file mode 100644 index 0000000000..60b15d63eb --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/PsdsType.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@Backing(type="int") @VintfStability +enum PsdsType { + LONG_TERM = 1, + NORMAL = 2, + REALTIME = 3, +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/SatelliteClockInfo.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/SatelliteClockInfo.aidl new file mode 100644 index 0000000000..05f7733280 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/SatelliteClockInfo.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +parcelable SatelliteClockInfo { + double satHardwareCodeBiasMeters; + double satTimeCorrectionMeters; + double satClkDriftMps; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/SatellitePositionEcef.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/SatellitePositionEcef.aidl new file mode 100644 index 0000000000..3d4f7ff6e2 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/SatellitePositionEcef.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +parcelable SatellitePositionEcef { + double posXMeters; + double posYMeters; + double posZMeters; + double ureMeters; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/SatellitePvt.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/SatellitePvt.aidl new file mode 100644 index 0000000000..ae65f39e3a --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/SatellitePvt.aidl @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +parcelable SatellitePvt { + int flags; + android.hardware.gnss.SatellitePositionEcef satPosEcef; + android.hardware.gnss.SatelliteVelocityEcef satVelEcef; + android.hardware.gnss.SatelliteClockInfo satClockInfo; + double ionoDelayMeters; + double tropoDelayMeters; + long timeOfClockSeconds; + int issueOfDataClock; + long timeOfEphemerisSeconds; + int issueOfDataEphemeris; + android.hardware.gnss.SatellitePvt.SatelliteEphemerisSource ephemerisSource = android.hardware.gnss.SatellitePvt.SatelliteEphemerisSource.OTHER; + const int HAS_POSITION_VELOCITY_CLOCK_INFO = (1 << 0) /* 1 */; + const int HAS_IONO = (1 << 1) /* 2 */; + const int HAS_TROPO = (1 << 2) /* 4 */; + @Backing(type="int") @VintfStability + enum SatelliteEphemerisSource { + DEMODULATED = 0, + SERVER_NORMAL = 1, + SERVER_LONG_TERM = 2, + OTHER = 3, + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/SatelliteVelocityEcef.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/SatelliteVelocityEcef.aidl new file mode 100644 index 0000000000..94d0b344b7 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/SatelliteVelocityEcef.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2020 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 -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.hardware.gnss; +/* @hide */ +@VintfStability +parcelable SatelliteVelocityEcef { + double velXMps; + double velYMps; + double velZMps; + double ureRateMps; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsCallback.aidl new file mode 100644 index 0000000000..61909d05f7 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsCallback.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.gnss.measurement_corrections; +/* @hide */ +@VintfStability +interface IMeasurementCorrectionsCallback { + void setCapabilitiesCb(in int capabilities); + const int CAPABILITY_LOS_SATS = (1 << 0) /* 1 */; + const int CAPABILITY_EXCESS_PATH_LENGTH = (1 << 1) /* 2 */; + const int CAPABILITY_REFLECTING_PLANE = (1 << 2) /* 4 */; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsInterface.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsInterface.aidl new file mode 100644 index 0000000000..bd305345f6 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/measurement_corrections/IMeasurementCorrectionsInterface.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.gnss.measurement_corrections; +/* @hide */ +@VintfStability +interface IMeasurementCorrectionsInterface { + void setCorrections(in android.hardware.gnss.measurement_corrections.MeasurementCorrections corrections); + void setCallback(in android.hardware.gnss.measurement_corrections.IMeasurementCorrectionsCallback callback); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/measurement_corrections/MeasurementCorrections.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/measurement_corrections/MeasurementCorrections.aidl new file mode 100644 index 0000000000..35fd79e57e --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/measurement_corrections/MeasurementCorrections.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2021 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 -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.hardware.gnss.measurement_corrections; +/* @hide */ +@VintfStability +parcelable MeasurementCorrections { + double latitudeDegrees; + double longitudeDegrees; + double altitudeMeters; + double horizontalPositionUncertaintyMeters; + double verticalPositionUncertaintyMeters; + long toaGpsNanosecondsOfWeek; + android.hardware.gnss.measurement_corrections.SingleSatCorrection[] satCorrections; + boolean hasEnvironmentBearing; + float environmentBearingDegrees; + float environmentBearingUncertaintyDegrees; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/measurement_corrections/ReflectingPlane.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/measurement_corrections/ReflectingPlane.aidl new file mode 100644 index 0000000000..90c9e03336 --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/measurement_corrections/ReflectingPlane.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.gnss.measurement_corrections; +/* @hide */ +@VintfStability +parcelable ReflectingPlane { + double latitudeDegrees; + double longitudeDegrees; + double altitudeMeters; + double reflectingPlaneAzimuthDegrees; +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/measurement_corrections/SingleSatCorrection.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/measurement_corrections/SingleSatCorrection.aidl new file mode 100644 index 0000000000..72d32e434c --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/measurement_corrections/SingleSatCorrection.aidl @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2021 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 -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.hardware.gnss.measurement_corrections; +/* @hide */ +@VintfStability +parcelable SingleSatCorrection { + int singleSatCorrectionFlags; + android.hardware.gnss.GnssConstellationType constellation; + int svid; + long carrierFrequencyHz; + float probSatIsLos; + float combinedExcessPathLengthMeters; + float combinedExcessPathLengthUncertaintyMeters; + float combinedAttenuationDb; + android.hardware.gnss.measurement_corrections.SingleSatCorrection.ExcessPathInfo[] excessPathInfos; + const int SINGLE_SAT_CORRECTION_HAS_SAT_IS_LOS_PROBABILITY = 0x0001; + const int SINGLE_SAT_CORRECTION_HAS_COMBINED_EXCESS_PATH_LENGTH = 0x0002; + const int SINGLE_SAT_CORRECTION_HAS_COMBINED_EXCESS_PATH_LENGTH_UNC = 0x0004; + const int SINGLE_SAT_CORRECTION_HAS_COMBINED_ATTENUATION = 0x0010; + @VintfStability + parcelable ExcessPathInfo { + int excessPathInfoFlags; + float excessPathLengthMeters; + float excessPathLengthUncertaintyMeters; + android.hardware.gnss.measurement_corrections.ReflectingPlane reflectingPlane; + float attenuationDb; + const int EXCESS_PATH_INFO_HAS_EXCESS_PATH_LENGTH = 0x0001; + const int EXCESS_PATH_INFO_HAS_EXCESS_PATH_LENGTH_UNC = 0x0002; + const int EXCESS_PATH_INFO_HAS_REFLECTING_PLANE = 0x0004; + const int EXCESS_PATH_INFO_HAS_ATTENUATION = 0x0008; + } +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/visibility_control/IGnssVisibilityControl.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/visibility_control/IGnssVisibilityControl.aidl new file mode 100644 index 0000000000..d7a7a9651f --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/visibility_control/IGnssVisibilityControl.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.gnss.visibility_control; +/* @hide */ +@VintfStability +interface IGnssVisibilityControl { + void enableNfwLocationAccess(in @utf8InCpp String[] proxyApps); + void setCallback(in android.hardware.gnss.visibility_control.IGnssVisibilityControlCallback callback); +} diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/visibility_control/IGnssVisibilityControlCallback.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/visibility_control/IGnssVisibilityControlCallback.aidl new file mode 100644 index 0000000000..c9b96f50bb --- /dev/null +++ b/gnss/aidl/aidl_api/android.hardware.gnss/3/android/hardware/gnss/visibility_control/IGnssVisibilityControlCallback.aidl @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2021 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 -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.hardware.gnss.visibility_control; +/* @hide */ +@VintfStability +interface IGnssVisibilityControlCallback { + void nfwNotifyCb(in android.hardware.gnss.visibility_control.IGnssVisibilityControlCallback.NfwNotification notification); + boolean isInEmergencySession(); + @Backing(type="int") @VintfStability + enum NfwProtocolStack { + CTRL_PLANE = 0, + SUPL = 1, + IMS = 10, + SIM = 11, + OTHER_PROTOCOL_STACK = 100, + } + @Backing(type="int") @VintfStability + enum NfwRequestor { + CARRIER = 0, + OEM = 10, + MODEM_CHIPSET_VENDOR = 11, + GNSS_CHIPSET_VENDOR = 12, + OTHER_CHIPSET_VENDOR = 13, + AUTOMOBILE_CLIENT = 20, + OTHER_REQUESTOR = 100, + } + @Backing(type="int") @VintfStability + enum NfwResponseType { + REJECTED = 0, + ACCEPTED_NO_LOCATION_PROVIDED = 1, + ACCEPTED_LOCATION_PROVIDED = 2, + } + @VintfStability + parcelable NfwNotification { + String proxyAppPackageName; + android.hardware.gnss.visibility_control.IGnssVisibilityControlCallback.NfwProtocolStack protocolStack; + String otherProtocolStackName; + android.hardware.gnss.visibility_control.IGnssVisibilityControlCallback.NfwRequestor requestor; + String requestorId; + android.hardware.gnss.visibility_control.IGnssVisibilityControlCallback.NfwResponseType responseType; + boolean inEmergencyMode; + boolean isCachedLocation; + } +} diff --git a/graphics/allocator/aidl/Android.bp b/graphics/allocator/aidl/Android.bp index 67c7fb5e29..a3a2c554ca 100644 --- a/graphics/allocator/aidl/Android.bp +++ b/graphics/allocator/aidl/Android.bp @@ -39,12 +39,20 @@ aidl_interface { min_sdk_version: "29", }, }, - frozen: false, + frozen: true, versions_with_info: [ { version: "1", imports: ["android.hardware.common-V2"], }, + { + version: "2", + imports: [ + "android.hardware.common-V2", + "android.hardware.graphics.common-V4", + ], + }, + ], } diff --git a/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/2/.hash b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/2/.hash new file mode 100644 index 0000000000..cd11a097e3 --- /dev/null +++ b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/2/.hash @@ -0,0 +1 @@ +9499fec09c544e9de5be3c87125721600f8ade66 diff --git a/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/2/android/hardware/graphics/allocator/AllocationError.aidl b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/2/android/hardware/graphics/allocator/AllocationError.aidl new file mode 100644 index 0000000000..e50d170b62 --- /dev/null +++ b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/2/android/hardware/graphics/allocator/AllocationError.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.graphics.allocator; +@Backing(type="int") @VintfStability +enum AllocationError { + BAD_DESCRIPTOR, + NO_RESOURCES, + UNSUPPORTED, +} diff --git a/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/2/android/hardware/graphics/allocator/AllocationResult.aidl b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/2/android/hardware/graphics/allocator/AllocationResult.aidl new file mode 100644 index 0000000000..73cfeb5422 --- /dev/null +++ b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/2/android/hardware/graphics/allocator/AllocationResult.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.graphics.allocator; +@VintfStability +parcelable AllocationResult { + int stride; + android.hardware.common.NativeHandle[] buffers; +} diff --git a/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/2/android/hardware/graphics/allocator/BufferDescriptorInfo.aidl b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/2/android/hardware/graphics/allocator/BufferDescriptorInfo.aidl new file mode 100644 index 0000000000..49c249742f --- /dev/null +++ b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/2/android/hardware/graphics/allocator/BufferDescriptorInfo.aidl @@ -0,0 +1,45 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.graphics.allocator; +@VintfStability +parcelable BufferDescriptorInfo { + byte[128] name; + int width; + int height; + int layerCount; + android.hardware.graphics.common.PixelFormat format = android.hardware.graphics.common.PixelFormat.UNSPECIFIED; + android.hardware.graphics.common.BufferUsage usage = android.hardware.graphics.common.BufferUsage.CPU_READ_NEVER; + long reservedSize; + android.hardware.graphics.common.ExtendableType[] additionalOptions; +} diff --git a/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/2/android/hardware/graphics/allocator/IAllocator.aidl b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/2/android/hardware/graphics/allocator/IAllocator.aidl new file mode 100644 index 0000000000..66e49a70c0 --- /dev/null +++ b/graphics/allocator/aidl/aidl_api/android.hardware.graphics.allocator/2/android/hardware/graphics/allocator/IAllocator.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.graphics.allocator; +@VintfStability +interface IAllocator { + /** + * @deprecated As of android.hardware.graphics.allocator-V2 in combination with AIMAPPER_VERSION_5 this is deprecated & replaced with allocate2. If android.hardware.graphics.mapper@4 is still in use, however, this is still required to be implemented. + */ + android.hardware.graphics.allocator.AllocationResult allocate(in byte[] descriptor, in int count); + android.hardware.graphics.allocator.AllocationResult allocate2(in android.hardware.graphics.allocator.BufferDescriptorInfo descriptor, in int count); + boolean isSupported(in android.hardware.graphics.allocator.BufferDescriptorInfo descriptor); + String getIMapperLibrarySuffix(); +} diff --git a/graphics/common/aidl/Android.bp b/graphics/common/aidl/Android.bp index 6c8ff4bf92..02334e85c2 100644 --- a/graphics/common/aidl/Android.bp +++ b/graphics/common/aidl/Android.bp @@ -41,9 +41,9 @@ aidl_interface { }, rust: { enabled: true, - } + }, }, - frozen: false, + frozen: true, versions_with_info: [ { version: "1", @@ -63,5 +63,10 @@ aidl_interface { "android.hardware.common-V2", ], }, + { + version: "4", + imports: ["android.hardware.common-V2"], + }, + ], } diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/.hash b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/.hash new file mode 100644 index 0000000000..ef17b34926 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/.hash @@ -0,0 +1 @@ +9bcf4b83485ce912dc39108201504f77b8c96cef diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/AlphaInterpretation.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/AlphaInterpretation.aidl new file mode 100644 index 0000000000..ea60283fe1 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/AlphaInterpretation.aidl @@ -0,0 +1,40 @@ +/** + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.graphics.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum AlphaInterpretation { + COVERAGE = 0, + MASK = 1, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/BlendMode.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/BlendMode.aidl new file mode 100644 index 0000000000..d1f61beee8 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/BlendMode.aidl @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2019, 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 -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.hardware.graphics.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum BlendMode { + INVALID = 0, + NONE = 1, + PREMULTIPLIED = 2, + COVERAGE = 3, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/BufferUsage.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/BufferUsage.aidl new file mode 100644 index 0000000000..d42a6d57b8 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/BufferUsage.aidl @@ -0,0 +1,65 @@ +/* + * Copyright 2019 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 -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.hardware.graphics.common; +/* @hide */ +@Backing(type="long") @VintfStability +enum BufferUsage { + CPU_READ_MASK = 0xf, + CPU_READ_NEVER = 0, + CPU_READ_RARELY = 2, + CPU_READ_OFTEN = 3, + CPU_WRITE_MASK = (0xf << 4) /* 240 */, + CPU_WRITE_NEVER = (0 << 4) /* 0 */, + CPU_WRITE_RARELY = (2 << 4) /* 32 */, + CPU_WRITE_OFTEN = (3 << 4) /* 48 */, + GPU_TEXTURE = (1 << 8) /* 256 */, + GPU_RENDER_TARGET = (1 << 9) /* 512 */, + COMPOSER_OVERLAY = (1 << 11) /* 2048 */, + COMPOSER_CLIENT_TARGET = (1 << 12) /* 4096 */, + PROTECTED = (1 << 14) /* 16384 */, + COMPOSER_CURSOR = (1 << 15) /* 32768 */, + VIDEO_ENCODER = (1 << 16) /* 65536 */, + CAMERA_OUTPUT = (1 << 17) /* 131072 */, + CAMERA_INPUT = (1 << 18) /* 262144 */, + RENDERSCRIPT = (1 << 20) /* 1048576 */, + VIDEO_DECODER = (1 << 22) /* 4194304 */, + SENSOR_DIRECT_DATA = (1 << 23) /* 8388608 */, + GPU_DATA_BUFFER = (1 << 24) /* 16777216 */, + GPU_CUBE_MAP = (1 << 25) /* 33554432 */, + GPU_MIPMAP_COMPLETE = (1 << 26) /* 67108864 */, + HW_IMAGE_ENCODER = (1 << 27) /* 134217728 */, + FRONT_BUFFER = (1L << 32) /* 4294967296 */, + VENDOR_MASK = (0xf << 28) /* -268435456 */, + VENDOR_MASK_HI = ((1L * 0xffff) << 48) /* -281474976710656 */, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/ChromaSiting.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/ChromaSiting.aidl new file mode 100644 index 0000000000..b8af644604 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/ChromaSiting.aidl @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2019, 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 -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.hardware.graphics.common; +/* @hide */ +@Backing(type="long") @VintfStability +enum ChromaSiting { + NONE = 0, + UNKNOWN = 1, + SITED_INTERSTITIAL = 2, + COSITED_HORIZONTAL = 3, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/ColorTransform.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/ColorTransform.aidl new file mode 100644 index 0000000000..f74859b788 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/ColorTransform.aidl @@ -0,0 +1,45 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum ColorTransform { + IDENTITY = 0, + ARBITRARY_MATRIX = 1, + VALUE_INVERSE = 2, + GRAYSCALE = 3, + CORRECT_PROTANOPIA = 4, + CORRECT_DEUTERANOPIA = 5, + CORRECT_TRITANOPIA = 6, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Compression.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Compression.aidl new file mode 100644 index 0000000000..4f155e19a9 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Compression.aidl @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2019, 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 -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.hardware.graphics.common; +/* @hide */ +@Backing(type="long") @VintfStability +enum Compression { + NONE = 0, + DISPLAY_STREAM_COMPRESSION = 1, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Cta861_3.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Cta861_3.aidl new file mode 100644 index 0000000000..ec90c9c64f --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Cta861_3.aidl @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2019, 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 -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.hardware.graphics.common; +/* @hide */ +@VintfStability +parcelable Cta861_3 { + float maxContentLightLevel; + float maxFrameAverageLightLevel; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Dataspace.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Dataspace.aidl new file mode 100644 index 0000000000..d9ff5aabed --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Dataspace.aidl @@ -0,0 +1,99 @@ +/** + * Copyright (c) 2019, 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 -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.hardware.graphics.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum Dataspace { + UNKNOWN = 0x0, + ARBITRARY = 0x1, + STANDARD_SHIFT = 16, + STANDARD_MASK = (63 << 16) /* 4128768 */, + STANDARD_UNSPECIFIED = (0 << 16) /* 0 */, + STANDARD_BT709 = (1 << 16) /* 65536 */, + STANDARD_BT601_625 = (2 << 16) /* 131072 */, + STANDARD_BT601_625_UNADJUSTED = (3 << 16) /* 196608 */, + STANDARD_BT601_525 = (4 << 16) /* 262144 */, + STANDARD_BT601_525_UNADJUSTED = (5 << 16) /* 327680 */, + STANDARD_BT2020 = (6 << 16) /* 393216 */, + STANDARD_BT2020_CONSTANT_LUMINANCE = (7 << 16) /* 458752 */, + STANDARD_BT470M = (8 << 16) /* 524288 */, + STANDARD_FILM = (9 << 16) /* 589824 */, + STANDARD_DCI_P3 = (10 << 16) /* 655360 */, + STANDARD_ADOBE_RGB = (11 << 16) /* 720896 */, + TRANSFER_SHIFT = 22, + TRANSFER_MASK = (31 << 22) /* 130023424 */, + TRANSFER_UNSPECIFIED = (0 << 22) /* 0 */, + TRANSFER_LINEAR = (1 << 22) /* 4194304 */, + TRANSFER_SRGB = (2 << 22) /* 8388608 */, + TRANSFER_SMPTE_170M = (3 << 22) /* 12582912 */, + TRANSFER_GAMMA2_2 = (4 << 22) /* 16777216 */, + TRANSFER_GAMMA2_6 = (5 << 22) /* 20971520 */, + TRANSFER_GAMMA2_8 = (6 << 22) /* 25165824 */, + TRANSFER_ST2084 = (7 << 22) /* 29360128 */, + TRANSFER_HLG = (8 << 22) /* 33554432 */, + RANGE_SHIFT = 27, + RANGE_MASK = (7 << 27) /* 939524096 */, + RANGE_UNSPECIFIED = (0 << 27) /* 0 */, + RANGE_FULL = (1 << 27) /* 134217728 */, + RANGE_LIMITED = (2 << 27) /* 268435456 */, + RANGE_EXTENDED = (3 << 27) /* 402653184 */, + SRGB_LINEAR = (((1 << 16) | (1 << 22)) | (1 << 27)) /* 138477568 */, + SCRGB_LINEAR = (((1 << 16) | (1 << 22)) | (3 << 27)) /* 406913024 */, + SRGB = (((1 << 16) | (2 << 22)) | (1 << 27)) /* 142671872 */, + SCRGB = (((1 << 16) | (2 << 22)) | (3 << 27)) /* 411107328 */, + JFIF = (((2 << 16) | (3 << 22)) | (1 << 27)) /* 146931712 */, + BT601_625 = (((2 << 16) | (3 << 22)) | (2 << 27)) /* 281149440 */, + BT601_525 = (((4 << 16) | (3 << 22)) | (2 << 27)) /* 281280512 */, + BT709 = (((1 << 16) | (3 << 22)) | (2 << 27)) /* 281083904 */, + DCI_P3_LINEAR = (((10 << 16) | (1 << 22)) | (1 << 27)) /* 139067392 */, + DCI_P3 = (((10 << 16) | (5 << 22)) | (1 << 27)) /* 155844608 */, + DISPLAY_P3_LINEAR = (((10 << 16) | (1 << 22)) | (1 << 27)) /* 139067392 */, + DISPLAY_P3 = (((10 << 16) | (2 << 22)) | (1 << 27)) /* 143261696 */, + ADOBE_RGB = (((11 << 16) | (4 << 22)) | (1 << 27)) /* 151715840 */, + BT2020_LINEAR = (((6 << 16) | (1 << 22)) | (1 << 27)) /* 138805248 */, + BT2020 = (((6 << 16) | (3 << 22)) | (1 << 27)) /* 147193856 */, + BT2020_PQ = (((6 << 16) | (7 << 22)) | (1 << 27)) /* 163971072 */, + DEPTH = 0x1000, + SENSOR = 0x1001, + BT2020_ITU = (((6 << 16) | (3 << 22)) | (2 << 27)) /* 281411584 */, + BT2020_ITU_PQ = (((6 << 16) | (7 << 22)) | (2 << 27)) /* 298188800 */, + BT2020_ITU_HLG = (((6 << 16) | (8 << 22)) | (2 << 27)) /* 302383104 */, + BT2020_HLG = (((6 << 16) | (8 << 22)) | (1 << 27)) /* 168165376 */, + DISPLAY_BT2020 = (((6 << 16) | (2 << 22)) | (1 << 27)) /* 142999552 */, + DYNAMIC_DEPTH = 0x1002, + JPEG_APP_SEGMENTS = 0x1003, + HEIF = 0x1004, + JPEG_R = 0x1005, + BT709_FULL_RANGE = (((1 << 16) | (3 << 22)) | (1 << 27)) /* 146866176 */, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/DisplayDecorationSupport.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/DisplayDecorationSupport.aidl new file mode 100644 index 0000000000..27eff76432 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/DisplayDecorationSupport.aidl @@ -0,0 +1,40 @@ +/** + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.graphics.common; +/* @hide */ +@VintfStability +parcelable DisplayDecorationSupport { + android.hardware.graphics.common.PixelFormat format; + android.hardware.graphics.common.AlphaInterpretation alphaInterpretation; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/ExtendableType.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/ExtendableType.aidl new file mode 100644 index 0000000000..5ff17752f7 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/ExtendableType.aidl @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2019, 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 -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.hardware.graphics.common; +/* @hide */ +@VintfStability +parcelable ExtendableType { + @utf8InCpp String name; + long value = 0; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/FRect.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/FRect.aidl new file mode 100644 index 0000000000..7972e111e2 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/FRect.aidl @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.common; +/* @hide */ +@VintfStability +parcelable FRect { + float left; + float top; + float right; + float bottom; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/HardwareBuffer.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/HardwareBuffer.aidl new file mode 100644 index 0000000000..1817769af2 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/HardwareBuffer.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2019 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 -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.hardware.graphics.common; +/* @hide */ +@VintfStability +parcelable HardwareBuffer { + android.hardware.graphics.common.HardwareBufferDescription description; + android.hardware.common.NativeHandle handle; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/HardwareBufferDescription.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/HardwareBufferDescription.aidl new file mode 100644 index 0000000000..70f46a1e6c --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/HardwareBufferDescription.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 2019 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 -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.hardware.graphics.common; +/* @hide */ +@VintfStability +parcelable HardwareBufferDescription { + int width; + int height; + int layers; + android.hardware.graphics.common.PixelFormat format = android.hardware.graphics.common.PixelFormat.UNSPECIFIED; + android.hardware.graphics.common.BufferUsage usage = android.hardware.graphics.common.BufferUsage.CPU_READ_NEVER; + int stride; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Hdr.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Hdr.aidl new file mode 100644 index 0000000000..71927b6fbf --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Hdr.aidl @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum Hdr { + INVALID = 0, + DOLBY_VISION = 1, + HDR10 = 2, + HLG = 3, + HDR10_PLUS = 4, + DOLBY_VISION_4K30 = 5, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/HdrConversionCapability.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/HdrConversionCapability.aidl new file mode 100644 index 0000000000..b74f7d7ce5 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/HdrConversionCapability.aidl @@ -0,0 +1,40 @@ +/** + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.graphics.common; +@VintfStability +parcelable HdrConversionCapability { + android.hardware.graphics.common.Hdr sourceType; + android.hardware.graphics.common.Hdr outputType; + boolean addsLatency; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/HdrConversionStrategy.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/HdrConversionStrategy.aidl new file mode 100644 index 0000000000..db785cf63f --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/HdrConversionStrategy.aidl @@ -0,0 +1,40 @@ +/** + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.graphics.common; +@VintfStability +union HdrConversionStrategy { + boolean passthrough = true; + android.hardware.graphics.common.Hdr[] autoAllowedHdrTypes; + android.hardware.graphics.common.Hdr forceHdrConversion; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Interlaced.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Interlaced.aidl new file mode 100644 index 0000000000..e04d2ab2bd --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Interlaced.aidl @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2019, 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 -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.hardware.graphics.common; +/* @hide */ +@Backing(type="long") @VintfStability +enum Interlaced { + NONE = 0, + TOP_BOTTOM = 1, + RIGHT_LEFT = 2, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/PixelFormat.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/PixelFormat.aidl new file mode 100644 index 0000000000..ed84a44b4f --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/PixelFormat.aidl @@ -0,0 +1,71 @@ +/* + * Copyright 2019 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 -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.hardware.graphics.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum PixelFormat { + UNSPECIFIED = 0, + RGBA_8888 = 0x1, + RGBX_8888 = 0x2, + RGB_888 = 0x3, + RGB_565 = 0x4, + BGRA_8888 = 0x5, + YCBCR_422_SP = 0x10, + YCRCB_420_SP = 0x11, + YCBCR_422_I = 0x14, + RGBA_FP16 = 0x16, + RAW16 = 0x20, + BLOB = 0x21, + IMPLEMENTATION_DEFINED = 0x22, + YCBCR_420_888 = 0x23, + RAW_OPAQUE = 0x24, + RAW10 = 0x25, + RAW12 = 0x26, + RGBA_1010102 = 0x2B, + Y8 = 0x20203859, + Y16 = 0x20363159, + YV12 = 0x32315659, + DEPTH_16 = 0x30, + DEPTH_24 = 0x31, + DEPTH_24_STENCIL_8 = 0x32, + DEPTH_32F = 0x33, + DEPTH_32F_STENCIL_8 = 0x34, + STENCIL_8 = 0x35, + YCBCR_P010 = 0x36, + HSV_888 = 0x37, + R_8 = 0x38, + R_16_UINT = 0x39, + RG_1616_UINT = 0x3a, + RGBA_10101010 = 0x3b, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/PlaneLayout.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/PlaneLayout.aidl new file mode 100644 index 0000000000..a09097511b --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/PlaneLayout.aidl @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2019, 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 -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.hardware.graphics.common; +/* @hide */ +@VintfStability +parcelable PlaneLayout { + android.hardware.graphics.common.PlaneLayoutComponent[] components; + long offsetInBytes; + long sampleIncrementInBits; + long strideInBytes; + long widthInSamples; + long heightInSamples; + long totalSizeInBytes; + long horizontalSubsampling; + long verticalSubsampling; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/PlaneLayoutComponent.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/PlaneLayoutComponent.aidl new file mode 100644 index 0000000000..0768240bf5 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/PlaneLayoutComponent.aidl @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2019, 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 -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.hardware.graphics.common; +/* @hide */ +@VintfStability +parcelable PlaneLayoutComponent { + android.hardware.graphics.common.ExtendableType type; + long offsetInBits; + long sizeInBits; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/PlaneLayoutComponentType.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/PlaneLayoutComponentType.aidl new file mode 100644 index 0000000000..e3067515fd --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/PlaneLayoutComponentType.aidl @@ -0,0 +1,46 @@ +/** + * Copyright (c) 2019, 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 -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.hardware.graphics.common; +/* @hide */ +@Backing(type="long") @VintfStability +enum PlaneLayoutComponentType { + Y = (1 << 0) /* 1 */, + CB = (1 << 1) /* 2 */, + CR = (1 << 2) /* 4 */, + R = (1 << 10) /* 1024 */, + G = (1 << 11) /* 2048 */, + B = (1 << 12) /* 4096 */, + RAW = (1 << 20) /* 1048576 */, + A = (1 << 30) /* 1073741824 */, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Point.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Point.aidl new file mode 100644 index 0000000000..af4705a1e4 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Point.aidl @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.common; +/* @hide */ +@VintfStability +parcelable Point { + int x; + int y; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Rect.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Rect.aidl new file mode 100644 index 0000000000..463a68f973 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Rect.aidl @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2019, 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 -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.hardware.graphics.common; +/* @hide */ +@VintfStability +parcelable Rect { + int left; + int top; + int right; + int bottom; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Smpte2086.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Smpte2086.aidl new file mode 100644 index 0000000000..dce9226c09 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Smpte2086.aidl @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2019, 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 -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.hardware.graphics.common; +/* @hide */ +@VintfStability +parcelable Smpte2086 { + android.hardware.graphics.common.XyColor primaryRed; + android.hardware.graphics.common.XyColor primaryGreen; + android.hardware.graphics.common.XyColor primaryBlue; + android.hardware.graphics.common.XyColor whitePoint; + float maxLuminance; + float minLuminance; +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/StandardMetadataType.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/StandardMetadataType.aidl new file mode 100644 index 0000000000..6e2e1063c3 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/StandardMetadataType.aidl @@ -0,0 +1,62 @@ +/** + * Copyright (c) 2019,libgralloctypes_helper 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 -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.hardware.graphics.common; +/* @hide */ +@Backing(type="long") @VintfStability +enum StandardMetadataType { + INVALID = 0, + BUFFER_ID = 1, + NAME = 2, + WIDTH = 3, + HEIGHT = 4, + LAYER_COUNT = 5, + PIXEL_FORMAT_REQUESTED = 6, + PIXEL_FORMAT_FOURCC = 7, + PIXEL_FORMAT_MODIFIER = 8, + USAGE = 9, + ALLOCATION_SIZE = 10, + PROTECTED_CONTENT = 11, + COMPRESSION = 12, + INTERLACED = 13, + CHROMA_SITING = 14, + PLANE_LAYOUTS = 15, + CROP = 16, + DATASPACE = 17, + BLEND_MODE = 18, + SMPTE2086 = 19, + CTA861_3 = 20, + SMPTE2094_40 = 21, + SMPTE2094_10 = 22, + STRIDE = 23, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Transform.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Transform.aidl new file mode 100644 index 0000000000..dbed57dae6 --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/Transform.aidl @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.common; +/* @hide */ +@Backing(type="int") @VintfStability +enum Transform { + NONE = 0, + FLIP_H = (1 << 0) /* 1 */, + FLIP_V = (1 << 1) /* 2 */, + ROT_90 = (1 << 2) /* 4 */, + ROT_180 = (FLIP_H | FLIP_V) /* 3 */, + ROT_270 = ((FLIP_H | FLIP_V) | ROT_90) /* 7 */, +} diff --git a/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/XyColor.aidl b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/XyColor.aidl new file mode 100644 index 0000000000..e300f25dad --- /dev/null +++ b/graphics/common/aidl/aidl_api/android.hardware.graphics.common/4/android/hardware/graphics/common/XyColor.aidl @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2019, 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 -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.hardware.graphics.common; +/* @hide */ +@VintfStability +parcelable XyColor { + float x; + float y; +} diff --git a/graphics/composer/aidl/Android.bp b/graphics/composer/aidl/Android.bp index 1e08221301..40448ec43e 100644 --- a/graphics/composer/aidl/Android.bp +++ b/graphics/composer/aidl/Android.bp @@ -31,7 +31,7 @@ aidl_interface { enabled: true, support_system_process: true, }, - frozen: false, + frozen: true, vndk_use_version: "1", srcs: [ "android/hardware/graphics/composer3/*.aidl", @@ -63,6 +63,14 @@ aidl_interface { "android.hardware.common-V2", ], }, + { + version: "2", + imports: [ + "android.hardware.graphics.common-V4", + "android.hardware.common-V2", + ], + }, + ], } diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/.hash b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/.hash new file mode 100644 index 0000000000..70d4ced84c --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/.hash @@ -0,0 +1 @@ +b6d53bcf537cbe89633b1622e2b065ea17291234 diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/Buffer.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/Buffer.aidl new file mode 100644 index 0000000000..a33ad23323 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/Buffer.aidl @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable Buffer { + int slot; + @nullable android.hardware.common.NativeHandle handle; + @nullable ParcelFileDescriptor fence; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/Capability.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/Capability.aidl new file mode 100644 index 0000000000..f02f8aaa77 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/Capability.aidl @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@Backing(type="int") @VintfStability +enum Capability { + INVALID = 0, + SIDEBAND_STREAM = 1, + SKIP_CLIENT_COLOR_TRANSFORM = 2, + PRESENT_FENCE_IS_NOT_RELIABLE = 3, + /** + * @deprecated - enabled by default. + */ + SKIP_VALIDATE = 4, + BOOT_DISPLAY_CONFIG = 5, + HDR_OUTPUT_CONVERSION_CONFIG = 6, + REFRESH_RATE_CHANGED_CALLBACK_DEBUG = 7, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ChangedCompositionLayer.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ChangedCompositionLayer.aidl new file mode 100644 index 0000000000..7e47ba8b5e --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ChangedCompositionLayer.aidl @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable ChangedCompositionLayer { + long layer; + android.hardware.graphics.composer3.Composition composition; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ChangedCompositionTypes.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ChangedCompositionTypes.aidl new file mode 100644 index 0000000000..9a5ca9700d --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ChangedCompositionTypes.aidl @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable ChangedCompositionTypes { + long display; + android.hardware.graphics.composer3.ChangedCompositionLayer[] layers; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ClientTarget.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ClientTarget.aidl new file mode 100644 index 0000000000..7632707ec2 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ClientTarget.aidl @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable ClientTarget { + android.hardware.graphics.composer3.Buffer buffer; + android.hardware.graphics.common.Dataspace dataspace; + android.hardware.graphics.common.Rect[] damage; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ClientTargetProperty.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ClientTargetProperty.aidl new file mode 100644 index 0000000000..d34d1b0ab8 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ClientTargetProperty.aidl @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable ClientTargetProperty { + android.hardware.graphics.common.PixelFormat pixelFormat; + android.hardware.graphics.common.Dataspace dataspace; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl new file mode 100644 index 0000000000..8fb6933c95 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ClientTargetPropertyWithBrightness.aidl @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable ClientTargetPropertyWithBrightness { + long display; + android.hardware.graphics.composer3.ClientTargetProperty clientTargetProperty; + float brightness; + android.hardware.graphics.composer3.DimmingStage dimmingStage; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl new file mode 100644 index 0000000000..480a85c27f --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ClockMonotonicTimestamp.aidl @@ -0,0 +1,38 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable ClockMonotonicTimestamp { + long timestampNanos; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/Color.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/Color.aidl new file mode 100644 index 0000000000..822290908e --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/Color.aidl @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable Color { + float r; + float g; + float b; + float a; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ColorMode.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ColorMode.aidl new file mode 100644 index 0000000000..53852b6270 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ColorMode.aidl @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@Backing(type="int") @VintfStability +enum ColorMode { + NATIVE = 0, + STANDARD_BT601_625 = 1, + STANDARD_BT601_625_UNADJUSTED = 2, + STANDARD_BT601_525 = 3, + STANDARD_BT601_525_UNADJUSTED = 4, + STANDARD_BT709 = 5, + DCI_P3 = 6, + SRGB = 7, + ADOBE_RGB = 8, + DISPLAY_P3 = 9, + BT2020 = 10, + BT2100_PQ = 11, + BT2100_HLG = 12, + DISPLAY_BT2020 = 13, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/CommandError.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/CommandError.aidl new file mode 100644 index 0000000000..103bfdc689 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/CommandError.aidl @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable CommandError { + int commandIndex; + int errorCode; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/CommandResultPayload.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/CommandResultPayload.aidl new file mode 100644 index 0000000000..6892f06180 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/CommandResultPayload.aidl @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +union CommandResultPayload { + android.hardware.graphics.composer3.CommandError error; + android.hardware.graphics.composer3.ChangedCompositionTypes changedCompositionTypes; + android.hardware.graphics.composer3.DisplayRequest displayRequest; + android.hardware.graphics.composer3.PresentFence presentFence; + android.hardware.graphics.composer3.ReleaseFences releaseFences; + android.hardware.graphics.composer3.PresentOrValidate presentOrValidateResult; + android.hardware.graphics.composer3.ClientTargetPropertyWithBrightness clientTargetProperty; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/Composition.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/Composition.aidl new file mode 100644 index 0000000000..34d6822148 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/Composition.aidl @@ -0,0 +1,45 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@Backing(type="int") @VintfStability +enum Composition { + INVALID = 0, + CLIENT = 1, + DEVICE = 2, + SOLID_COLOR = 3, + CURSOR = 4, + SIDEBAND = 5, + DISPLAY_DECORATION = 6, + REFRESH_RATE_INDICATOR = 7, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ContentType.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ContentType.aidl new file mode 100644 index 0000000000..d87b7670dd --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ContentType.aidl @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@Backing(type="int") @VintfStability +enum ContentType { + NONE = 0, + GRAPHICS = 1, + PHOTO = 2, + CINEMA = 3, + GAME = 4, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DimmingStage.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DimmingStage.aidl new file mode 100644 index 0000000000..44457f8ec1 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DimmingStage.aidl @@ -0,0 +1,40 @@ +/** + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.graphics.composer3; +@Backing(type="int") @VintfStability +enum DimmingStage { + NONE = 0, + LINEAR = 1, + GAMMA_OETF = 2, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayAttribute.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayAttribute.aidl new file mode 100644 index 0000000000..8454c40dbe --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayAttribute.aidl @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@Backing(type="int") @VintfStability +enum DisplayAttribute { + INVALID = 0, + WIDTH = 1, + HEIGHT = 2, + VSYNC_PERIOD = 3, + DPI_X = 4, + DPI_Y = 5, + CONFIG_GROUP = 7, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayBrightness.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayBrightness.aidl new file mode 100644 index 0000000000..e765189b96 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayBrightness.aidl @@ -0,0 +1,39 @@ +/** + * Copyright 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable DisplayBrightness { + float brightness; + float brightnessNits; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayCapability.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayCapability.aidl new file mode 100644 index 0000000000..6eba887aef --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayCapability.aidl @@ -0,0 +1,45 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@Backing(type="int") @VintfStability +enum DisplayCapability { + INVALID = 0, + SKIP_CLIENT_COLOR_TRANSFORM = 1, + DOZE = 2, + BRIGHTNESS = 3, + PROTECTED_CONTENTS = 4, + AUTO_LOW_LATENCY_MODE = 5, + SUSPEND = 6, + DISPLAY_IDLE_TIMER = 7, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayCommand.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayCommand.aidl new file mode 100644 index 0000000000..662240e96b --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayCommand.aidl @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable DisplayCommand { + long display; + android.hardware.graphics.composer3.LayerCommand[] layers; + @nullable float[] colorTransformMatrix; + @nullable android.hardware.graphics.composer3.DisplayBrightness brightness; + @nullable android.hardware.graphics.composer3.ClientTarget clientTarget; + @nullable android.hardware.graphics.composer3.Buffer virtualDisplayOutputBuffer; + @nullable android.hardware.graphics.composer3.ClockMonotonicTimestamp expectedPresentTime; + boolean validateDisplay; + boolean acceptDisplayChanges; + boolean presentDisplay; + boolean presentOrValidateDisplay; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayConnectionType.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayConnectionType.aidl new file mode 100644 index 0000000000..640f82a0cd --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayConnectionType.aidl @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@Backing(type="int") @VintfStability +enum DisplayConnectionType { + INTERNAL = 0, + EXTERNAL = 1, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayContentSample.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayContentSample.aidl new file mode 100644 index 0000000000..c62453634f --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayContentSample.aidl @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable DisplayContentSample { + long frameCount; + long[] sampleComponent0; + long[] sampleComponent1; + long[] sampleComponent2; + long[] sampleComponent3; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayContentSamplingAttributes.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayContentSamplingAttributes.aidl new file mode 100644 index 0000000000..7c6542f527 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayContentSamplingAttributes.aidl @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable DisplayContentSamplingAttributes { + android.hardware.graphics.common.PixelFormat format; + android.hardware.graphics.common.Dataspace dataspace; + android.hardware.graphics.composer3.FormatColorComponent componentMask; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayIdentification.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayIdentification.aidl new file mode 100644 index 0000000000..a0cc9b097b --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayIdentification.aidl @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable DisplayIdentification { + byte port; + byte[] data; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayRequest.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayRequest.aidl new file mode 100644 index 0000000000..e6db116398 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/DisplayRequest.aidl @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable DisplayRequest { + long display; + int mask; + android.hardware.graphics.composer3.DisplayRequest.LayerRequest[] layerRequests; + const int FLIP_CLIENT_TARGET = (1 << 0) /* 1 */; + const int WRITE_CLIENT_TARGET_TO_OUTPUT = (1 << 1) /* 2 */; + @VintfStability + parcelable LayerRequest { + long layer; + int mask; + const int CLEAR_CLIENT_TARGET = (1 << 0) /* 1 */; + } +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/FormatColorComponent.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/FormatColorComponent.aidl new file mode 100644 index 0000000000..89dae83bbe --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/FormatColorComponent.aidl @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@Backing(type="byte") @VintfStability +enum FormatColorComponent { + FORMAT_COMPONENT_0 = (1 << 0) /* 1 */, + FORMAT_COMPONENT_1 = (1 << 1) /* 2 */, + FORMAT_COMPONENT_2 = (1 << 2) /* 4 */, + FORMAT_COMPONENT_3 = (1 << 3) /* 8 */, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/HdrCapabilities.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/HdrCapabilities.aidl new file mode 100644 index 0000000000..80141d3543 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/HdrCapabilities.aidl @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable HdrCapabilities { + android.hardware.graphics.common.Hdr[] types; + float maxLuminance; + float maxAverageLuminance; + float minLuminance; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/IComposer.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/IComposer.aidl new file mode 100644 index 0000000000..21b9ad88cd --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/IComposer.aidl @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +interface IComposer { + android.hardware.graphics.composer3.IComposerClient createClient(); + android.hardware.graphics.composer3.Capability[] getCapabilities(); + const int EX_NO_RESOURCES = 6; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/IComposerCallback.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/IComposerCallback.aidl new file mode 100644 index 0000000000..2c08cbeffd --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/IComposerCallback.aidl @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +interface IComposerCallback { + void onHotplug(long display, boolean connected); + oneway void onRefresh(long display); + oneway void onSeamlessPossible(long display); + oneway void onVsync(long display, long timestamp, int vsyncPeriodNanos); + oneway void onVsyncPeriodTimingChanged(long display, in android.hardware.graphics.composer3.VsyncPeriodChangeTimeline updatedTimeline); + oneway void onVsyncIdle(long display); + oneway void onRefreshRateChangedDebug(in android.hardware.graphics.composer3.RefreshRateChangedDebugData data); +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/IComposerClient.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/IComposerClient.aidl new file mode 100644 index 0000000000..cb85a88995 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/IComposerClient.aidl @@ -0,0 +1,93 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +interface IComposerClient { + long createLayer(long display, int bufferSlotCount); + android.hardware.graphics.composer3.VirtualDisplay createVirtualDisplay(int width, int height, android.hardware.graphics.common.PixelFormat formatHint, int outputBufferSlotCount); + void destroyLayer(long display, long layer); + void destroyVirtualDisplay(long display); + android.hardware.graphics.composer3.CommandResultPayload[] executeCommands(in android.hardware.graphics.composer3.DisplayCommand[] commands); + int getActiveConfig(long display); + android.hardware.graphics.composer3.ColorMode[] getColorModes(long display); + float[] getDataspaceSaturationMatrix(android.hardware.graphics.common.Dataspace dataspace); + int getDisplayAttribute(long display, int config, android.hardware.graphics.composer3.DisplayAttribute attribute); + android.hardware.graphics.composer3.DisplayCapability[] getDisplayCapabilities(long display); + int[] getDisplayConfigs(long display); + android.hardware.graphics.composer3.DisplayConnectionType getDisplayConnectionType(long display); + android.hardware.graphics.composer3.DisplayIdentification getDisplayIdentificationData(long display); + String getDisplayName(long display); + int getDisplayVsyncPeriod(long display); + android.hardware.graphics.composer3.DisplayContentSample getDisplayedContentSample(long display, long maxFrames, long timestamp); + android.hardware.graphics.composer3.DisplayContentSamplingAttributes getDisplayedContentSamplingAttributes(long display); + android.hardware.graphics.common.Transform getDisplayPhysicalOrientation(long display); + android.hardware.graphics.composer3.HdrCapabilities getHdrCapabilities(long display); + int getMaxVirtualDisplayCount(); + android.hardware.graphics.composer3.PerFrameMetadataKey[] getPerFrameMetadataKeys(long display); + android.hardware.graphics.composer3.ReadbackBufferAttributes getReadbackBufferAttributes(long display); + @nullable ParcelFileDescriptor getReadbackBufferFence(long display); + android.hardware.graphics.composer3.RenderIntent[] getRenderIntents(long display, android.hardware.graphics.composer3.ColorMode mode); + android.hardware.graphics.composer3.ContentType[] getSupportedContentTypes(long display); + @nullable android.hardware.graphics.common.DisplayDecorationSupport getDisplayDecorationSupport(long display); + void registerCallback(in android.hardware.graphics.composer3.IComposerCallback callback); + void setActiveConfig(long display, int config); + android.hardware.graphics.composer3.VsyncPeriodChangeTimeline setActiveConfigWithConstraints(long display, int config, in android.hardware.graphics.composer3.VsyncPeriodChangeConstraints vsyncPeriodChangeConstraints); + void setBootDisplayConfig(long display, int config); + void clearBootDisplayConfig(long display); + int getPreferredBootDisplayConfig(long display); + void setAutoLowLatencyMode(long display, boolean on); + void setClientTargetSlotCount(long display, int clientTargetSlotCount); + void setColorMode(long display, android.hardware.graphics.composer3.ColorMode mode, android.hardware.graphics.composer3.RenderIntent intent); + void setContentType(long display, android.hardware.graphics.composer3.ContentType type); + void setDisplayedContentSamplingEnabled(long display, boolean enable, android.hardware.graphics.composer3.FormatColorComponent componentMask, long maxFrames); + void setPowerMode(long display, android.hardware.graphics.composer3.PowerMode mode); + void setReadbackBuffer(long display, in android.hardware.common.NativeHandle buffer, in @nullable ParcelFileDescriptor releaseFence); + void setVsyncEnabled(long display, boolean enabled); + void setIdleTimerEnabled(long display, int timeoutMs); + android.hardware.graphics.composer3.OverlayProperties getOverlaySupport(); + android.hardware.graphics.common.HdrConversionCapability[] getHdrConversionCapabilities(); + android.hardware.graphics.common.Hdr setHdrConversionStrategy(in android.hardware.graphics.common.HdrConversionStrategy conversionStrategy); + void setRefreshRateChangedCallbackDebugEnabled(long display, boolean enabled); + const int EX_BAD_CONFIG = 1; + const int EX_BAD_DISPLAY = 2; + const int EX_BAD_LAYER = 3; + const int EX_BAD_PARAMETER = 4; + const int EX_RESERVED = 5; + const int EX_NO_RESOURCES = 6; + const int EX_NOT_VALIDATED = 7; + const int EX_UNSUPPORTED = 8; + const int EX_SEAMLESS_NOT_ALLOWED = 9; + const int EX_SEAMLESS_NOT_POSSIBLE = 10; + const int INVALID_CONFIGURATION = 0x7fffffff; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/LayerBrightness.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/LayerBrightness.aidl new file mode 100644 index 0000000000..a726cc12bf --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/LayerBrightness.aidl @@ -0,0 +1,38 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable LayerBrightness { + float brightness; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/LayerCommand.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/LayerCommand.aidl new file mode 100644 index 0000000000..6d32218af1 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/LayerCommand.aidl @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable LayerCommand { + long layer; + @nullable android.hardware.graphics.common.Point cursorPosition; + @nullable android.hardware.graphics.composer3.Buffer buffer; + @nullable android.hardware.graphics.common.Rect[] damage; + @nullable android.hardware.graphics.composer3.ParcelableBlendMode blendMode; + @nullable android.hardware.graphics.composer3.Color color; + @nullable android.hardware.graphics.composer3.ParcelableComposition composition; + @nullable android.hardware.graphics.composer3.ParcelableDataspace dataspace; + @nullable android.hardware.graphics.common.Rect displayFrame; + @nullable android.hardware.graphics.composer3.PlaneAlpha planeAlpha; + @nullable android.hardware.common.NativeHandle sidebandStream; + @nullable android.hardware.graphics.common.FRect sourceCrop; + @nullable android.hardware.graphics.composer3.ParcelableTransform transform; + @nullable android.hardware.graphics.common.Rect[] visibleRegion; + @nullable android.hardware.graphics.composer3.ZOrder z; + @nullable float[] colorTransform; + @nullable android.hardware.graphics.composer3.LayerBrightness brightness; + @nullable android.hardware.graphics.composer3.PerFrameMetadata[] perFrameMetadata; + @nullable android.hardware.graphics.composer3.PerFrameMetadataBlob[] perFrameMetadataBlob; + @nullable android.hardware.graphics.common.Rect[] blockingRegion; + @nullable int[] bufferSlotsToClear; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/OverlayProperties.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/OverlayProperties.aidl new file mode 100644 index 0000000000..7d31ea3b1e --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/OverlayProperties.aidl @@ -0,0 +1,45 @@ +/** + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable OverlayProperties { + android.hardware.graphics.composer3.OverlayProperties.SupportedBufferCombinations[] combinations; + boolean supportMixedColorSpaces; + parcelable SupportedBufferCombinations { + android.hardware.graphics.common.PixelFormat[] pixelFormats; + android.hardware.graphics.common.Dataspace[] standards; + android.hardware.graphics.common.Dataspace[] transfers; + android.hardware.graphics.common.Dataspace[] ranges; + } +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ParcelableBlendMode.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ParcelableBlendMode.aidl new file mode 100644 index 0000000000..f1fee5f376 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ParcelableBlendMode.aidl @@ -0,0 +1,38 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable ParcelableBlendMode { + android.hardware.graphics.common.BlendMode blendMode; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ParcelableComposition.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ParcelableComposition.aidl new file mode 100644 index 0000000000..98fbb665e2 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ParcelableComposition.aidl @@ -0,0 +1,38 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable ParcelableComposition { + android.hardware.graphics.composer3.Composition composition; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ParcelableDataspace.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ParcelableDataspace.aidl new file mode 100644 index 0000000000..76ecf85b9f --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ParcelableDataspace.aidl @@ -0,0 +1,38 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable ParcelableDataspace { + android.hardware.graphics.common.Dataspace dataspace; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ParcelableTransform.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ParcelableTransform.aidl new file mode 100644 index 0000000000..b673656438 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ParcelableTransform.aidl @@ -0,0 +1,38 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable ParcelableTransform { + android.hardware.graphics.common.Transform transform; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PerFrameMetadata.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PerFrameMetadata.aidl new file mode 100644 index 0000000000..cd1f351381 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PerFrameMetadata.aidl @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable PerFrameMetadata { + android.hardware.graphics.composer3.PerFrameMetadataKey key; + float value; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PerFrameMetadataBlob.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PerFrameMetadataBlob.aidl new file mode 100644 index 0000000000..c1e74d9e3d --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PerFrameMetadataBlob.aidl @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable PerFrameMetadataBlob { + android.hardware.graphics.composer3.PerFrameMetadataKey key; + byte[] blob; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PerFrameMetadataKey.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PerFrameMetadataKey.aidl new file mode 100644 index 0000000000..10a7deef0a --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PerFrameMetadataKey.aidl @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@Backing(type="int") @VintfStability +enum PerFrameMetadataKey { + DISPLAY_RED_PRIMARY_X, + DISPLAY_RED_PRIMARY_Y, + DISPLAY_GREEN_PRIMARY_X, + DISPLAY_GREEN_PRIMARY_Y, + DISPLAY_BLUE_PRIMARY_X, + DISPLAY_BLUE_PRIMARY_Y, + WHITE_POINT_X, + WHITE_POINT_Y, + MAX_LUMINANCE, + MIN_LUMINANCE, + MAX_CONTENT_LIGHT_LEVEL, + MAX_FRAME_AVERAGE_LIGHT_LEVEL, + HDR10_PLUS_SEI, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PlaneAlpha.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PlaneAlpha.aidl new file mode 100644 index 0000000000..c48c2a8a34 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PlaneAlpha.aidl @@ -0,0 +1,38 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable PlaneAlpha { + float alpha; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PowerMode.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PowerMode.aidl new file mode 100644 index 0000000000..f587d4dfa8 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PowerMode.aidl @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@Backing(type="int") @VintfStability +enum PowerMode { + OFF = 0, + DOZE = 1, + DOZE_SUSPEND = 3, + ON = 2, + ON_SUSPEND = 4, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PresentFence.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PresentFence.aidl new file mode 100644 index 0000000000..3bb09cdb34 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PresentFence.aidl @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable PresentFence { + long display; + ParcelFileDescriptor fence; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PresentOrValidate.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PresentOrValidate.aidl new file mode 100644 index 0000000000..dbfac2259d --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/PresentOrValidate.aidl @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable PresentOrValidate { + long display; + android.hardware.graphics.composer3.PresentOrValidate.Result result; + @VintfStability + enum Result { + Validated, + Presented, + } +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ReadbackBufferAttributes.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ReadbackBufferAttributes.aidl new file mode 100644 index 0000000000..bb51bdc04a --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ReadbackBufferAttributes.aidl @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable ReadbackBufferAttributes { + android.hardware.graphics.common.PixelFormat format; + android.hardware.graphics.common.Dataspace dataspace; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl new file mode 100644 index 0000000000..2b9801a4aa --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/RefreshRateChangedDebugData.aidl @@ -0,0 +1,39 @@ +/** + * Copyright 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable RefreshRateChangedDebugData { + long display; + int vsyncPeriodNanos; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ReleaseFences.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ReleaseFences.aidl new file mode 100644 index 0000000000..d623661250 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ReleaseFences.aidl @@ -0,0 +1,44 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable ReleaseFences { + long display; + android.hardware.graphics.composer3.ReleaseFences.Layer[] layers; + @VintfStability + parcelable Layer { + long layer; + ParcelFileDescriptor fence; + } +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/RenderIntent.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/RenderIntent.aidl new file mode 100644 index 0000000000..5670c10655 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/RenderIntent.aidl @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@Backing(type="int") @VintfStability +enum RenderIntent { + COLORIMETRIC = 0, + ENHANCE = 1, + TONE_MAP_COLORIMETRIC = 2, + TONE_MAP_ENHANCE = 3, +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/VirtualDisplay.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/VirtualDisplay.aidl new file mode 100644 index 0000000000..886be2e3d0 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/VirtualDisplay.aidl @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable VirtualDisplay { + long display; + android.hardware.graphics.common.PixelFormat format; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/VsyncPeriodChangeConstraints.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/VsyncPeriodChangeConstraints.aidl new file mode 100644 index 0000000000..df38c11f58 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/VsyncPeriodChangeConstraints.aidl @@ -0,0 +1,39 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable VsyncPeriodChangeConstraints { + long desiredTimeNanos; + boolean seamlessRequired; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/VsyncPeriodChangeTimeline.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/VsyncPeriodChangeTimeline.aidl new file mode 100644 index 0000000000..9fb3999e3e --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/VsyncPeriodChangeTimeline.aidl @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable VsyncPeriodChangeTimeline { + long newVsyncAppliedTimeNanos; + boolean refreshRequired; + long refreshTimeNanos; +} diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ZOrder.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ZOrder.aidl new file mode 100644 index 0000000000..ea96ea3a69 --- /dev/null +++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/2/android/hardware/graphics/composer3/ZOrder.aidl @@ -0,0 +1,38 @@ +/** + * Copyright (c) 2021, 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 -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.hardware.graphics.composer3; +@VintfStability +parcelable ZOrder { + int z; +} diff --git a/health/aidl/Android.bp b/health/aidl/Android.bp index 6d4f914b07..e288f179bb 100644 --- a/health/aidl/Android.bp +++ b/health/aidl/Android.bp @@ -42,7 +42,13 @@ aidl_interface { version: "1", imports: [], }, + { + version: "2", + imports: [], + }, + ], + frozen: true, } diff --git a/health/aidl/aidl_api/android.hardware.health/2/.hash b/health/aidl/aidl_api/android.hardware.health/2/.hash new file mode 100644 index 0000000000..384f780caa --- /dev/null +++ b/health/aidl/aidl_api/android.hardware.health/2/.hash @@ -0,0 +1 @@ +d92c40b74b56341959d2ad70271145fdbd70b5c7 diff --git a/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryCapacityLevel.aidl b/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryCapacityLevel.aidl new file mode 100644 index 0000000000..4d705887e5 --- /dev/null +++ b/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryCapacityLevel.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.health; +@Backing(type="int") @VintfStability +enum BatteryCapacityLevel { + UNSUPPORTED = (-1) /* -1 */, + UNKNOWN, + CRITICAL, + LOW, + NORMAL, + HIGH, + FULL, +} diff --git a/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryChargingPolicy.aidl b/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryChargingPolicy.aidl new file mode 100644 index 0000000000..42fbf95090 --- /dev/null +++ b/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryChargingPolicy.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.health; +@Backing(type="int") @VintfStability +enum BatteryChargingPolicy { + INVALID = 0, + DEFAULT = 1, + LONG_LIFE = 2, + ADAPTIVE = 3, +} diff --git a/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryChargingState.aidl b/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryChargingState.aidl new file mode 100644 index 0000000000..e21eb28133 --- /dev/null +++ b/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryChargingState.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.health; +@Backing(type="int") @VintfStability +enum BatteryChargingState { + INVALID = 0, + NORMAL = 1, + TOO_COLD = 2, + TOO_HOT = 3, + LONG_LIFE = 4, + ADAPTIVE = 5, +} diff --git a/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryHealth.aidl b/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryHealth.aidl new file mode 100644 index 0000000000..8d13198440 --- /dev/null +++ b/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryHealth.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2021 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 -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.hardware.health; +@Backing(type="int") @VintfStability +enum BatteryHealth { + UNKNOWN = 1, + GOOD = 2, + OVERHEAT = 3, + DEAD = 4, + OVER_VOLTAGE = 5, + UNSPECIFIED_FAILURE = 6, + COLD = 7, + FAIR = 8, + NOT_AVAILABLE = 11, + INCONSISTENT = 12, +} diff --git a/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryHealthData.aidl b/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryHealthData.aidl new file mode 100644 index 0000000000..2dd01b146f --- /dev/null +++ b/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryHealthData.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.health; +@VintfStability +parcelable BatteryHealthData { + long batteryManufacturingDateSeconds; + long batteryFirstUsageSeconds; + long batteryStateOfHealth; +} diff --git a/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryStatus.aidl b/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryStatus.aidl new file mode 100644 index 0000000000..340b2ecc3f --- /dev/null +++ b/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/BatteryStatus.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.health; +@Backing(type="int") @VintfStability +enum BatteryStatus { + UNKNOWN = 1, + CHARGING = 2, + DISCHARGING = 3, + NOT_CHARGING = 4, + FULL = 5, +} diff --git a/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/DiskStats.aidl b/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/DiskStats.aidl new file mode 100644 index 0000000000..5aa58900bb --- /dev/null +++ b/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/DiskStats.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2021 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 -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.hardware.health; +@VintfStability +parcelable DiskStats { + long reads; + long readMerges; + long readSectors; + long readTicks; + long writes; + long writeMerges; + long writeSectors; + long writeTicks; + long ioInFlight; + long ioTicks; + long ioInQueue; +} diff --git a/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/HealthInfo.aidl b/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/HealthInfo.aidl new file mode 100644 index 0000000000..bfa14758f3 --- /dev/null +++ b/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/HealthInfo.aidl @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2021 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 -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.hardware.health; +@VintfStability +parcelable HealthInfo { + boolean chargerAcOnline; + boolean chargerUsbOnline; + boolean chargerWirelessOnline; + boolean chargerDockOnline; + int maxChargingCurrentMicroamps; + int maxChargingVoltageMicrovolts; + android.hardware.health.BatteryStatus batteryStatus; + android.hardware.health.BatteryHealth batteryHealth; + boolean batteryPresent; + int batteryLevel; + int batteryVoltageMillivolts; + int batteryTemperatureTenthsCelsius; + int batteryCurrentMicroamps; + int batteryCycleCount; + int batteryFullChargeUah; + int batteryChargeCounterUah; + String batteryTechnology; + int batteryCurrentAverageMicroamps; + android.hardware.health.DiskStats[] diskStats; + android.hardware.health.StorageInfo[] storageInfos; + android.hardware.health.BatteryCapacityLevel batteryCapacityLevel; + long batteryChargeTimeToFullNowSeconds; + int batteryFullChargeDesignCapacityUah; + android.hardware.health.BatteryChargingState chargingState; + android.hardware.health.BatteryChargingPolicy chargingPolicy; + @nullable android.hardware.health.BatteryHealthData batteryHealthData; + const int BATTERY_CHARGE_TIME_TO_FULL_NOW_SECONDS_UNSUPPORTED = (-1) /* -1 */; +} diff --git a/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/IHealth.aidl b/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/IHealth.aidl new file mode 100644 index 0000000000..b49dfffbe4 --- /dev/null +++ b/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/IHealth.aidl @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2021 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 -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.hardware.health; +@VintfStability +interface IHealth { + void registerCallback(in android.hardware.health.IHealthInfoCallback callback); + void unregisterCallback(in android.hardware.health.IHealthInfoCallback callback); + void update(); + int getChargeCounterUah(); + int getCurrentNowMicroamps(); + int getCurrentAverageMicroamps(); + int getCapacity(); + long getEnergyCounterNwh(); + android.hardware.health.BatteryStatus getChargeStatus(); + android.hardware.health.StorageInfo[] getStorageInfo(); + android.hardware.health.DiskStats[] getDiskStats(); + android.hardware.health.HealthInfo getHealthInfo(); + void setChargingPolicy(android.hardware.health.BatteryChargingPolicy in_value); + android.hardware.health.BatteryChargingPolicy getChargingPolicy(); + android.hardware.health.BatteryHealthData getBatteryHealthData(); + const int STATUS_UNKNOWN = 2; + const int STATUS_CALLBACK_DIED = 4; +} diff --git a/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/IHealthInfoCallback.aidl b/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/IHealthInfoCallback.aidl new file mode 100644 index 0000000000..1b6366fa7a --- /dev/null +++ b/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/IHealthInfoCallback.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2021 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 -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.hardware.health; +@VintfStability +interface IHealthInfoCallback { + oneway void healthInfoChanged(in android.hardware.health.HealthInfo info); +} diff --git a/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/StorageInfo.aidl b/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/StorageInfo.aidl new file mode 100644 index 0000000000..eaae5a6110 --- /dev/null +++ b/health/aidl/aidl_api/android.hardware.health/2/android/hardware/health/StorageInfo.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.health; +@VintfStability +parcelable StorageInfo { + int eol; + int lifetimeA; + int lifetimeB; + String version; +} diff --git a/identity/aidl/Android.bp b/identity/aidl/Android.bp index 6a25e628dc..da70406055 100644 --- a/identity/aidl/Android.bp +++ b/identity/aidl/Android.bp @@ -18,7 +18,7 @@ aidl_interface { "android.hardware.security.rkp-V3", ], stability: "vintf", - frozen: false, + frozen: true, backend: { java: { platform_apis: true, @@ -56,6 +56,13 @@ aidl_interface { "android.hardware.security.rkp-V3", ], }, + { + version: "5", + imports: [ + "android.hardware.keymaster-V3", + "android.hardware.security.rkp-V3", + ], + }, ], diff --git a/identity/aidl/aidl_api/android.hardware.identity/5/.hash b/identity/aidl/aidl_api/android.hardware.identity/5/.hash new file mode 100644 index 0000000000..158dc4fbbd --- /dev/null +++ b/identity/aidl/aidl_api/android.hardware.identity/5/.hash @@ -0,0 +1 @@ +63f77d853b84219479b25418b1ce6fd1553f30db diff --git a/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/Certificate.aidl b/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/Certificate.aidl new file mode 100644 index 0000000000..83e1797386 --- /dev/null +++ b/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/Certificate.aidl @@ -0,0 +1,38 @@ +/* + * Copyright 2020 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 -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.hardware.identity; +@VintfStability +parcelable Certificate { + byte[] encodedCertificate; +} diff --git a/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/CipherSuite.aidl b/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/CipherSuite.aidl new file mode 100644 index 0000000000..e6ec04e805 --- /dev/null +++ b/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/CipherSuite.aidl @@ -0,0 +1,38 @@ +/* + * Copyright 2020 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 -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.hardware.identity; +@Backing(type="int") @VintfStability +enum CipherSuite { + CIPHERSUITE_ECDHE_HKDF_ECDSA_WITH_AES_256_GCM_SHA256 = 1, +} diff --git a/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/HardwareInformation.aidl b/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/HardwareInformation.aidl new file mode 100644 index 0000000000..9b96ea8a68 --- /dev/null +++ b/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/HardwareInformation.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2020 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 -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.hardware.identity; +@VintfStability +parcelable HardwareInformation { + @utf8InCpp String credentialStoreName; + @utf8InCpp String credentialStoreAuthorName; + int dataChunkSize; + boolean isDirectAccess; + @utf8InCpp String[] supportedDocTypes; + boolean isRemoteKeyProvisioningSupported = false; +} diff --git a/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/IIdentityCredential.aidl b/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/IIdentityCredential.aidl new file mode 100644 index 0000000000..4f2fe0bbe2 --- /dev/null +++ b/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/IIdentityCredential.aidl @@ -0,0 +1,55 @@ +/* + * Copyright 2020 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 -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.hardware.identity; +@VintfStability +interface IIdentityCredential { + /** + * @deprecated use deleteCredentalWithChallenge() instead. + */ + byte[] deleteCredential(); + byte[] createEphemeralKeyPair(); + void setReaderEphemeralPublicKey(in byte[] publicKey); + long createAuthChallenge(); + void startRetrieval(in android.hardware.identity.SecureAccessControlProfile[] accessControlProfiles, in android.hardware.keymaster.HardwareAuthToken authToken, in byte[] itemsRequest, in byte[] signingKeyBlob, in byte[] sessionTranscript, in byte[] readerSignature, in int[] requestCounts); + void startRetrieveEntryValue(in @utf8InCpp String nameSpace, in @utf8InCpp String name, in int entrySize, in int[] accessControlProfileIds); + byte[] retrieveEntryValue(in byte[] encryptedContent); + @SuppressWarnings(value={"out-array"}) void finishRetrieval(out byte[] mac, out byte[] deviceNameSpaces); + @SuppressWarnings(value={"out-array"}) android.hardware.identity.Certificate generateSigningKeyPair(out byte[] signingKeyBlob); + void setRequestedNamespaces(in android.hardware.identity.RequestNamespace[] requestNamespaces); + void setVerificationToken(in android.hardware.keymaster.VerificationToken verificationToken); + byte[] deleteCredentialWithChallenge(in byte[] challenge); + byte[] proveOwnership(in byte[] challenge); + android.hardware.identity.IWritableIdentityCredential updateCredential(); + @SuppressWarnings(value={"out-array"}) void finishRetrievalWithSignature(out byte[] mac, out byte[] deviceNameSpaces, out byte[] ecdsaSignature); +} diff --git a/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/IIdentityCredentialStore.aidl b/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/IIdentityCredentialStore.aidl new file mode 100644 index 0000000000..31ca8b10f3 --- /dev/null +++ b/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/IIdentityCredentialStore.aidl @@ -0,0 +1,55 @@ +/* + * Copyright 2020 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 -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.hardware.identity; +@VintfStability +interface IIdentityCredentialStore { + android.hardware.identity.HardwareInformation getHardwareInformation(); + android.hardware.identity.IWritableIdentityCredential createCredential(in @utf8InCpp String docType, in boolean testCredential); + android.hardware.identity.IIdentityCredential getCredential(in android.hardware.identity.CipherSuite cipherSuite, in byte[] credentialData); + android.hardware.identity.IPresentationSession createPresentationSession(in android.hardware.identity.CipherSuite cipherSuite); + android.hardware.security.keymint.IRemotelyProvisionedComponent getRemotelyProvisionedComponent(); + const int STATUS_OK = 0; + const int STATUS_FAILED = 1; + const int STATUS_CIPHER_SUITE_NOT_SUPPORTED = 2; + const int STATUS_INVALID_DATA = 3; + const int STATUS_INVALID_AUTH_TOKEN = 4; + const int STATUS_INVALID_ITEMS_REQUEST_MESSAGE = 5; + const int STATUS_READER_SIGNATURE_CHECK_FAILED = 6; + const int STATUS_EPHEMERAL_PUBLIC_KEY_NOT_FOUND = 7; + const int STATUS_USER_AUTHENTICATION_FAILED = 8; + const int STATUS_READER_AUTHENTICATION_FAILED = 9; + const int STATUS_NO_ACCESS_CONTROL_PROFILES = 10; + const int STATUS_NOT_IN_REQUEST_MESSAGE = 11; + const int STATUS_SESSION_TRANSCRIPT_MISMATCH = 12; +} diff --git a/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/IPresentationSession.aidl b/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/IPresentationSession.aidl new file mode 100644 index 0000000000..705dc292c5 --- /dev/null +++ b/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/IPresentationSession.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.identity; +@VintfStability +interface IPresentationSession { + byte[] getEphemeralKeyPair(); + long getAuthChallenge(); + void setReaderEphemeralPublicKey(in byte[] publicKey); + void setSessionTranscript(in byte[] sessionTranscript); + android.hardware.identity.IIdentityCredential getCredential(in byte[] credentialData); +} diff --git a/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/IWritableIdentityCredential.aidl b/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/IWritableIdentityCredential.aidl new file mode 100644 index 0000000000..5377349a52 --- /dev/null +++ b/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/IWritableIdentityCredential.aidl @@ -0,0 +1,45 @@ +/* + * Copyright 2020 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 -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.hardware.identity; +@VintfStability +interface IWritableIdentityCredential { + android.hardware.identity.Certificate[] getAttestationCertificate(in byte[] attestationApplicationId, in byte[] attestationChallenge); + void startPersonalization(in int accessControlProfileCount, in int[] entryCounts); + android.hardware.identity.SecureAccessControlProfile addAccessControlProfile(in int id, in android.hardware.identity.Certificate readerCertificate, in boolean userAuthenticationRequired, in long timeoutMillis, in long secureUserId); + void beginAddEntry(in int[] accessControlProfileIds, in @utf8InCpp String nameSpace, in @utf8InCpp String name, in int entrySize); + byte[] addEntryValue(in byte[] content); + @SuppressWarnings(value={"out-array"}) void finishAddingEntries(out byte[] credentialData, out byte[] proofOfProvisioningSignature); + void setExpectedProofOfProvisioningSize(in int expectedProofOfProvisioningSize); + void setRemotelyProvisionedAttestationKey(in byte[] attestationKeyBlob, in byte[] attestationCertificate); +} diff --git a/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/RequestDataItem.aidl b/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/RequestDataItem.aidl new file mode 100644 index 0000000000..cec8e0c94d --- /dev/null +++ b/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/RequestDataItem.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2020 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 -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.hardware.identity; +@VintfStability +parcelable RequestDataItem { + @utf8InCpp String name; + long size; + int[] accessControlProfileIds; +} diff --git a/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/RequestNamespace.aidl b/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/RequestNamespace.aidl new file mode 100644 index 0000000000..05b9ec295f --- /dev/null +++ b/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/RequestNamespace.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 2020 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 -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.hardware.identity; +@VintfStability +parcelable RequestNamespace { + @utf8InCpp String namespaceName; + android.hardware.identity.RequestDataItem[] items; +} diff --git a/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/SecureAccessControlProfile.aidl b/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/SecureAccessControlProfile.aidl new file mode 100644 index 0000000000..2003594eb4 --- /dev/null +++ b/identity/aidl/aidl_api/android.hardware.identity/5/android/hardware/identity/SecureAccessControlProfile.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2020 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 -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.hardware.identity; +@VintfStability +parcelable SecureAccessControlProfile { + int id; + android.hardware.identity.Certificate readerCertificate; + boolean userAuthenticationRequired; + long timeoutMillis; + long secureUserId; + byte[] mac; +} diff --git a/keymaster/aidl/Android.bp b/keymaster/aidl/Android.bp index a3800c1105..0f2debdfaa 100644 --- a/keymaster/aidl/Android.bp +++ b/keymaster/aidl/Android.bp @@ -32,5 +32,11 @@ aidl_interface { version: "3", imports: [], }, + { + version: "4", + imports: [], + }, + ], + frozen: true, } diff --git a/keymaster/aidl/aidl_api/android.hardware.keymaster/4/.hash b/keymaster/aidl/aidl_api/android.hardware.keymaster/4/.hash new file mode 100644 index 0000000000..cfa2965ba0 --- /dev/null +++ b/keymaster/aidl/aidl_api/android.hardware.keymaster/4/.hash @@ -0,0 +1 @@ +d60ca1bb57f94508910cac7b8910c85e2a49a11f diff --git a/keymaster/aidl/aidl_api/android.hardware.keymaster/4/android/hardware/keymaster/HardwareAuthToken.aidl b/keymaster/aidl/aidl_api/android.hardware.keymaster/4/android/hardware/keymaster/HardwareAuthToken.aidl new file mode 100644 index 0000000000..6e84e98628 --- /dev/null +++ b/keymaster/aidl/aidl_api/android.hardware.keymaster/4/android/hardware/keymaster/HardwareAuthToken.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 2020 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 -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.hardware.keymaster; +/* @hide */ +@VintfStability +parcelable HardwareAuthToken { + long challenge; + long userId; + long authenticatorId; + android.hardware.keymaster.HardwareAuthenticatorType authenticatorType = android.hardware.keymaster.HardwareAuthenticatorType.NONE; + android.hardware.keymaster.Timestamp timestamp; + byte[] mac; +} diff --git a/keymaster/aidl/aidl_api/android.hardware.keymaster/4/android/hardware/keymaster/HardwareAuthenticatorType.aidl b/keymaster/aidl/aidl_api/android.hardware.keymaster/4/android/hardware/keymaster/HardwareAuthenticatorType.aidl new file mode 100644 index 0000000000..9526bed622 --- /dev/null +++ b/keymaster/aidl/aidl_api/android.hardware.keymaster/4/android/hardware/keymaster/HardwareAuthenticatorType.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2020 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 -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.hardware.keymaster; +/* @hide */ +@Backing(type="int") @VintfStability +enum HardwareAuthenticatorType { + NONE = 0, + PASSWORD = (1 << 0) /* 1 */, + FINGERPRINT = (1 << 1) /* 2 */, + ANY = 0xFFFFFFFF, +} diff --git a/keymaster/aidl/aidl_api/android.hardware.keymaster/4/android/hardware/keymaster/SecurityLevel.aidl b/keymaster/aidl/aidl_api/android.hardware.keymaster/4/android/hardware/keymaster/SecurityLevel.aidl new file mode 100644 index 0000000000..d32ef6882c --- /dev/null +++ b/keymaster/aidl/aidl_api/android.hardware.keymaster/4/android/hardware/keymaster/SecurityLevel.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2020 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 -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.hardware.keymaster; +/* @hide */ +@Backing(type="int") @VintfStability +enum SecurityLevel { + SOFTWARE = 0, + TRUSTED_ENVIRONMENT = 1, + STRONGBOX = 2, +} diff --git a/keymaster/aidl/aidl_api/android.hardware.keymaster/4/android/hardware/keymaster/Timestamp.aidl b/keymaster/aidl/aidl_api/android.hardware.keymaster/4/android/hardware/keymaster/Timestamp.aidl new file mode 100644 index 0000000000..5b7b37affa --- /dev/null +++ b/keymaster/aidl/aidl_api/android.hardware.keymaster/4/android/hardware/keymaster/Timestamp.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 2020 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 -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.hardware.keymaster; +/* @hide */ +@VintfStability +parcelable Timestamp { + long milliSeconds; +} diff --git a/keymaster/aidl/aidl_api/android.hardware.keymaster/4/android/hardware/keymaster/VerificationToken.aidl b/keymaster/aidl/aidl_api/android.hardware.keymaster/4/android/hardware/keymaster/VerificationToken.aidl new file mode 100644 index 0000000000..10fa5e11f5 --- /dev/null +++ b/keymaster/aidl/aidl_api/android.hardware.keymaster/4/android/hardware/keymaster/VerificationToken.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2020 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 -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.hardware.keymaster; +/* @hide */ +@VintfStability +parcelable VerificationToken { + long challenge; + android.hardware.keymaster.Timestamp timestamp; + android.hardware.keymaster.SecurityLevel securityLevel = android.hardware.keymaster.SecurityLevel.SOFTWARE; + byte[] mac; +} diff --git a/media/bufferpool/aidl/Android.bp b/media/bufferpool/aidl/Android.bp index b01cdbecdc..8caf525ffe 100644 --- a/media/bufferpool/aidl/Android.bp +++ b/media/bufferpool/aidl/Android.bp @@ -47,4 +47,15 @@ aidl_interface { min_sdk_version: "29", }, }, + versions_with_info: [ + { + version: "1", + imports: [ + "android.hardware.common-V2", + "android.hardware.common.fmq-V1", + ], + }, + ], + frozen: true, + } diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/.hash b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/.hash new file mode 100644 index 0000000000..f59137745c --- /dev/null +++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/.hash @@ -0,0 +1 @@ +b44598709e65cdb5184a8956aac5495b5dec6c0a diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/Buffer.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/Buffer.aidl new file mode 100644 index 0000000000..4ea0bba7fc --- /dev/null +++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/Buffer.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.bufferpool2; +@VintfStability +parcelable Buffer { + int id; + android.hardware.common.NativeHandle buffer; +} diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/BufferInvalidationMessage.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/BufferInvalidationMessage.aidl new file mode 100644 index 0000000000..181286c197 --- /dev/null +++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/BufferInvalidationMessage.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.bufferpool2; +@FixedSize @VintfStability +parcelable BufferInvalidationMessage { + int messageId; + int fromBufferId; + int toBufferId; +} diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/BufferStatus.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/BufferStatus.aidl new file mode 100644 index 0000000000..13174ffe09 --- /dev/null +++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/BufferStatus.aidl @@ -0,0 +1,47 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.bufferpool2; +@Backing(type="int") @VintfStability +enum BufferStatus { + NOT_USED = 0, + USED = 1, + TRANSFER_TO = 2, + TRANSFER_FROM = 3, + TRANSFER_TIMEOUT = 4, + TRANSFER_LOST = 5, + TRANSFER_FETCH = 6, + TRANSFER_OK = 7, + TRANSFER_ERROR = 8, + INVALIDATION_ACK = 9, +} diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/BufferStatusMessage.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/BufferStatusMessage.aidl new file mode 100644 index 0000000000..7e79a368d1 --- /dev/null +++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/BufferStatusMessage.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.bufferpool2; +@FixedSize @VintfStability +parcelable BufferStatusMessage { + long transactionId; + int bufferId; + android.hardware.media.bufferpool2.BufferStatus status; + long connectionId; + long targetConnectionId; + long timestampUs; +} diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/IAccessor.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/IAccessor.aidl new file mode 100644 index 0000000000..4053797dcf --- /dev/null +++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/IAccessor.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.bufferpool2; +@VintfStability +interface IAccessor { + android.hardware.media.bufferpool2.IAccessor.ConnectionInfo connect(in android.hardware.media.bufferpool2.IObserver observer); + @VintfStability + parcelable ConnectionInfo { + android.hardware.media.bufferpool2.IConnection connection; + long connectionId; + int msgId; + android.hardware.common.fmq.MQDescriptor toFmqDesc; + android.hardware.common.fmq.MQDescriptor fromFmqDesc; + } +} diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/IClientManager.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/IClientManager.aidl new file mode 100644 index 0000000000..5899a403a6 --- /dev/null +++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/IClientManager.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.bufferpool2; +@VintfStability +interface IClientManager { + android.hardware.media.bufferpool2.IClientManager.Registration registerSender(in android.hardware.media.bufferpool2.IAccessor bufferPool); + @VintfStability + parcelable Registration { + long connectionId; + boolean isNew = true; + } +} diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/IConnection.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/IConnection.aidl new file mode 100644 index 0000000000..844e920df0 --- /dev/null +++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/IConnection.aidl @@ -0,0 +1,47 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.bufferpool2; +@VintfStability +interface IConnection { + android.hardware.media.bufferpool2.IConnection.FetchResult[] fetch(in android.hardware.media.bufferpool2.IConnection.FetchInfo[] fetchInfos); + void sync(); + parcelable FetchInfo { + long transactionId; + int bufferId; + } + union FetchResult { + android.hardware.media.bufferpool2.Buffer buffer; + int failure; + } +} diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/IObserver.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/IObserver.aidl new file mode 100644 index 0000000000..2d8cffe70c --- /dev/null +++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/IObserver.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.bufferpool2; +@VintfStability +interface IObserver { + oneway void onMessage(in long connectionId, in int msgId); +} diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/ResultStatus.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/ResultStatus.aidl new file mode 100644 index 0000000000..4bc3889e3f --- /dev/null +++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/1/android/hardware/media/bufferpool2/ResultStatus.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.media.bufferpool2; +@VintfStability +parcelable ResultStatus { + const int OK = 0; + const int NO_MEMORY = 1; + const int ALREADY_EXISTS = 2; + const int NOT_FOUND = 3; + const int CRITICAL_ERROR = 4; +} diff --git a/power/aidl/Android.bp b/power/aidl/Android.bp index 70b1203031..082572d34c 100644 --- a/power/aidl/Android.bp +++ b/power/aidl/Android.bp @@ -49,7 +49,12 @@ aidl_interface { version: "3", imports: [], }, + { + version: "4", + imports: [], + }, ], + frozen: true, } diff --git a/power/aidl/aidl_api/android.hardware.power/4/.hash b/power/aidl/aidl_api/android.hardware.power/4/.hash new file mode 100644 index 0000000000..10f7e2cd2f --- /dev/null +++ b/power/aidl/aidl_api/android.hardware.power/4/.hash @@ -0,0 +1 @@ +141ac3bb33bb4f524de020669f12599c18cdd67f diff --git a/power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/Boost.aidl b/power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/Boost.aidl new file mode 100644 index 0000000000..8ee15eff7f --- /dev/null +++ b/power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/Boost.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2020 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 -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.hardware.power; +@Backing(type="int") @VintfStability +enum Boost { + INTERACTION, + DISPLAY_UPDATE_IMMINENT, + ML_ACC, + AUDIO_LAUNCH, + CAMERA_LAUNCH, + CAMERA_SHOT, +} diff --git a/power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/IPower.aidl b/power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/IPower.aidl new file mode 100644 index 0000000000..ae03313f11 --- /dev/null +++ b/power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/IPower.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2020 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 -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.hardware.power; +@VintfStability +interface IPower { + oneway void setMode(in android.hardware.power.Mode type, in boolean enabled); + boolean isModeSupported(in android.hardware.power.Mode type); + oneway void setBoost(in android.hardware.power.Boost type, in int durationMs); + boolean isBoostSupported(in android.hardware.power.Boost type); + android.hardware.power.IPowerHintSession createHintSession(in int tgid, in int uid, in int[] threadIds, in long durationNanos); + long getHintSessionPreferredRate(); +} diff --git a/power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/IPowerHintSession.aidl b/power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/IPowerHintSession.aidl new file mode 100644 index 0000000000..e6809da92c --- /dev/null +++ b/power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/IPowerHintSession.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.power; +@VintfStability +interface IPowerHintSession { + oneway void updateTargetWorkDuration(long targetDurationNanos); + oneway void reportActualWorkDuration(in android.hardware.power.WorkDuration[] durations); + oneway void pause(); + oneway void resume(); + oneway void close(); + oneway void sendHint(android.hardware.power.SessionHint hint); + void setThreads(in int[] threadIds); +} diff --git a/power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/Mode.aidl b/power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/Mode.aidl new file mode 100644 index 0000000000..efbb300f8d --- /dev/null +++ b/power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/Mode.aidl @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2020 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 -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.hardware.power; +@Backing(type="int") @VintfStability +enum Mode { + DOUBLE_TAP_TO_WAKE, + LOW_POWER, + SUSTAINED_PERFORMANCE, + FIXED_PERFORMANCE, + VR, + LAUNCH, + EXPENSIVE_RENDERING, + INTERACTIVE, + DEVICE_IDLE, + DISPLAY_INACTIVE, + AUDIO_STREAMING_LOW_LATENCY, + CAMERA_STREAMING_SECURE, + CAMERA_STREAMING_LOW, + CAMERA_STREAMING_MID, + CAMERA_STREAMING_HIGH, + GAME, + GAME_LOADING, +} diff --git a/power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/SessionHint.aidl b/power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/SessionHint.aidl new file mode 100644 index 0000000000..9c1f381543 --- /dev/null +++ b/power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/SessionHint.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.power; +@Backing(type="int") @VintfStability +enum SessionHint { + CPU_LOAD_UP = 0, + CPU_LOAD_DOWN = 1, + CPU_LOAD_RESET = 2, + CPU_LOAD_RESUME = 3, + POWER_EFFICIENCY = 4, +} diff --git a/power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/WorkDuration.aidl b/power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/WorkDuration.aidl new file mode 100644 index 0000000000..e86cd40ec2 --- /dev/null +++ b/power/aidl/aidl_api/android.hardware.power/4/android/hardware/power/WorkDuration.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.power; +@VintfStability +parcelable WorkDuration { + long timeStampNanos; + long durationNanos; +} diff --git a/power/stats/aidl/Android.bp b/power/stats/aidl/Android.bp index b1b2515035..43bcfc8f18 100644 --- a/power/stats/aidl/Android.bp +++ b/power/stats/aidl/Android.bp @@ -37,5 +37,17 @@ aidl_interface { }, }, host_supported: true, - versions: ["1"], + versions_with_info: [ + { + version: "1", + imports: [], + }, + { + version: "2", + imports: [], + }, + + ], + frozen: true, + } diff --git a/power/stats/aidl/aidl_api/android.hardware.power.stats/2/.hash b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/.hash new file mode 100644 index 0000000000..b715ccbdee --- /dev/null +++ b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/.hash @@ -0,0 +1 @@ +c3e113101b731c666717eb579492efa287a8f529 diff --git a/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/Channel.aidl b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/Channel.aidl new file mode 100644 index 0000000000..d1048a4095 --- /dev/null +++ b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/Channel.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2020 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 -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.hardware.power.stats; +@VintfStability +parcelable Channel { + int id; + @utf8InCpp String name; + @utf8InCpp String subsystem; +} diff --git a/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/EnergyConsumer.aidl b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/EnergyConsumer.aidl new file mode 100644 index 0000000000..13f528d57b --- /dev/null +++ b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/EnergyConsumer.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2020 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 -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.hardware.power.stats; +@VintfStability +parcelable EnergyConsumer { + int id; + int ordinal; + android.hardware.power.stats.EnergyConsumerType type = android.hardware.power.stats.EnergyConsumerType.OTHER; + @utf8InCpp String name; +} diff --git a/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/EnergyConsumerAttribution.aidl b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/EnergyConsumerAttribution.aidl new file mode 100644 index 0000000000..ee120685c7 --- /dev/null +++ b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/EnergyConsumerAttribution.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2020 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 -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.hardware.power.stats; +@VintfStability +parcelable EnergyConsumerAttribution { + int uid; + long energyUWs; +} diff --git a/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/EnergyConsumerResult.aidl b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/EnergyConsumerResult.aidl new file mode 100644 index 0000000000..7d8aa989cd --- /dev/null +++ b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/EnergyConsumerResult.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2020 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 -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.hardware.power.stats; +@VintfStability +parcelable EnergyConsumerResult { + int id; + long timestampMs; + long energyUWs; + android.hardware.power.stats.EnergyConsumerAttribution[] attribution; +} diff --git a/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/EnergyConsumerType.aidl b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/EnergyConsumerType.aidl new file mode 100644 index 0000000000..02b612bbeb --- /dev/null +++ b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/EnergyConsumerType.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2020 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 -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.hardware.power.stats; +@VintfStability +enum EnergyConsumerType { + OTHER, + BLUETOOTH, + CPU_CLUSTER, + DISPLAY, + GNSS, + MOBILE_RADIO, + WIFI, + CAMERA, +} diff --git a/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/EnergyMeasurement.aidl b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/EnergyMeasurement.aidl new file mode 100644 index 0000000000..ffe3aa48c5 --- /dev/null +++ b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/EnergyMeasurement.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2020 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 -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.hardware.power.stats; +@VintfStability +parcelable EnergyMeasurement { + int id; + long timestampMs; + long durationMs; + long energyUWs; +} diff --git a/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/IPowerStats.aidl b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/IPowerStats.aidl new file mode 100644 index 0000000000..79175158e4 --- /dev/null +++ b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/IPowerStats.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2020 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 -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.hardware.power.stats; +@VintfStability +interface IPowerStats { + android.hardware.power.stats.PowerEntity[] getPowerEntityInfo(); + android.hardware.power.stats.StateResidencyResult[] getStateResidency(in int[] powerEntityIds); + android.hardware.power.stats.EnergyConsumer[] getEnergyConsumerInfo(); + android.hardware.power.stats.EnergyConsumerResult[] getEnergyConsumed(in int[] energyConsumerIds); + android.hardware.power.stats.Channel[] getEnergyMeterInfo(); + android.hardware.power.stats.EnergyMeasurement[] readEnergyMeter(in int[] channelIds); +} diff --git a/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/PowerEntity.aidl b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/PowerEntity.aidl new file mode 100644 index 0000000000..f42e715cfd --- /dev/null +++ b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/PowerEntity.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2020 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 -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.hardware.power.stats; +@VintfStability +parcelable PowerEntity { + int id; + @utf8InCpp String name; + android.hardware.power.stats.State[] states; +} diff --git a/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/State.aidl b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/State.aidl new file mode 100644 index 0000000000..cf29dd714f --- /dev/null +++ b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/State.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2020 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 -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.hardware.power.stats; +@VintfStability +parcelable State { + int id; + @utf8InCpp String name; +} diff --git a/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/StateResidency.aidl b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/StateResidency.aidl new file mode 100644 index 0000000000..0af35b391c --- /dev/null +++ b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/StateResidency.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2020 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 -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.hardware.power.stats; +@VintfStability +parcelable StateResidency { + int id; + long totalTimeInStateMs; + long totalStateEntryCount; + long lastEntryTimestampMs; +} diff --git a/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/StateResidencyResult.aidl b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/StateResidencyResult.aidl new file mode 100644 index 0000000000..14358b7fed --- /dev/null +++ b/power/stats/aidl/aidl_api/android.hardware.power.stats/2/android/hardware/power/stats/StateResidencyResult.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2020 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 -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.hardware.power.stats; +@VintfStability +parcelable StateResidencyResult { + int id; + android.hardware.power.stats.StateResidency[] stateResidencyData; +} diff --git a/radio/aidl/Android.bp b/radio/aidl/Android.bp index e8cebd76d1..09f845b8ab 100644 --- a/radio/aidl/Android.bp +++ b/radio/aidl/Android.bp @@ -12,7 +12,7 @@ aidl_interface { vendor_available: true, host_supported: true, srcs: ["android/hardware/radio/*.aidl"], - frozen: false, + frozen: true, stability: "vintf", backend: { cpp: { @@ -27,6 +27,11 @@ aidl_interface { version: "1", imports: [], }, + { + version: "2", + imports: [], + }, + ], } @@ -36,7 +41,7 @@ aidl_interface { vendor_available: true, host_supported: true, srcs: ["android/hardware/radio/config/*.aidl"], - frozen: false, + frozen: true, stability: "vintf", imports: ["android.hardware.radio-V2"], backend: { @@ -52,6 +57,11 @@ aidl_interface { version: "1", imports: ["android.hardware.radio-V1"], }, + { + version: "2", + imports: ["android.hardware.radio-V2"], + }, + ], } @@ -76,7 +86,13 @@ aidl_interface { version: "1", imports: ["android.hardware.radio-V1"], }, + { + version: "2", + imports: ["android.hardware.radio-V2"], + }, + ], + frozen: true, } @@ -100,7 +116,13 @@ aidl_interface { version: "1", imports: ["android.hardware.radio-V1"], }, + { + version: "2", + imports: ["android.hardware.radio-V2"], + }, + ], + frozen: true, } @@ -124,7 +146,13 @@ aidl_interface { version: "1", imports: ["android.hardware.radio-V1"], }, + { + version: "2", + imports: ["android.hardware.radio-V2"], + }, + ], + frozen: true, } @@ -148,7 +176,13 @@ aidl_interface { version: "1", imports: ["android.hardware.radio-V1"], }, + { + version: "2", + imports: ["android.hardware.radio-V2"], + }, + ], + frozen: true, } @@ -171,6 +205,13 @@ aidl_interface { min_sdk_version: "Tiramisu", }, }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + frozen: true, } @@ -200,7 +241,16 @@ aidl_interface { "android.hardware.radio.config-V1", ], }, + { + version: "2", + imports: [ + "android.hardware.radio-V2", + "android.hardware.radio.config-V2", + ], + }, + ], + frozen: true, } @@ -224,7 +274,13 @@ aidl_interface { version: "1", imports: ["android.hardware.radio-V1"], }, + { + version: "2", + imports: ["android.hardware.radio-V2"], + }, + ], + frozen: true, } @@ -245,6 +301,17 @@ aidl_interface { sdk_version: "module_current", }, }, + versions_with_info: [ + { + version: "1", + imports: [ + "android.hardware.radio-V2", + "android.hardware.radio.data-V2", + ], + }, + ], + frozen: true, + } aidl_interface { @@ -261,4 +328,12 @@ aidl_interface { sdk_version: "module_current", }, }, + versions_with_info: [ + { + version: "1", + imports: ["android.hardware.radio-V2"], + }, + ], + frozen: true, + } diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/2/.hash b/radio/aidl/aidl_api/android.hardware.radio.config/2/.hash new file mode 100644 index 0000000000..a3998322b3 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.config/2/.hash @@ -0,0 +1 @@ +0be135cf3de9586d6aabb58cb6af0ba425431743 diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/IRadioConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/IRadioConfig.aidl new file mode 100644 index 0000000000..a48a89b458 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/IRadioConfig.aidl @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2021 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 interface is used by telephony and telecom to talk to cellular radio for the purpose of + * radio configuration, and it is not associated with any specific modem or slot. + * All the functions have minimum one parameter: + * serial: which corresponds to serial no. of request. Serial numbers must only be memorized for the + * duration of a method call. If clients provide colliding serials (including passing the same + * serial to different methods), multiple responses (one for each method call) must still be served. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.config; +@VintfStability +interface IRadioConfig { + oneway void getHalDeviceCapabilities(in int serial); + oneway void getNumOfLiveModems(in int serial); + oneway void getPhoneCapability(in int serial); + oneway void getSimSlotsStatus(in int serial); + oneway void setNumOfLiveModems(in int serial, in byte numOfLiveModems); + oneway void setPreferredDataModem(in int serial, in byte modemId); + oneway void setResponseFunctions(in android.hardware.radio.config.IRadioConfigResponse radioConfigResponse, in android.hardware.radio.config.IRadioConfigIndication radioConfigIndication); + oneway void setSimSlotsMapping(in int serial, in android.hardware.radio.config.SlotPortMapping[] slotMap); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/IRadioConfigIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/IRadioConfigIndication.aidl new file mode 100644 index 0000000000..994e337c04 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/IRadioConfigIndication.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.config; +@VintfStability +interface IRadioConfigIndication { + oneway void simSlotsStatusChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.config.SimSlotStatus[] slotStatus); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/IRadioConfigResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/IRadioConfigResponse.aidl new file mode 100644 index 0000000000..038b0aeb58 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/IRadioConfigResponse.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.config; +@VintfStability +interface IRadioConfigResponse { + oneway void getHalDeviceCapabilitiesResponse(in android.hardware.radio.RadioResponseInfo info, in boolean modemReducedFeatureSet1); + oneway void getNumOfLiveModemsResponse(in android.hardware.radio.RadioResponseInfo info, in byte numOfLiveModems); + oneway void getPhoneCapabilityResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.config.PhoneCapability phoneCapability); + oneway void getSimSlotsStatusResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.config.SimSlotStatus[] slotStatus); + oneway void setNumOfLiveModemsResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setPreferredDataModemResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setSimSlotsMappingResponse(in android.hardware.radio.RadioResponseInfo info); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl new file mode 100644 index 0000000000..74017e407a --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/MultipleEnabledProfilesMode.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.config; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum MultipleEnabledProfilesMode { + NONE, + MEP_A1, + MEP_A2, + MEP_B, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/PhoneCapability.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/PhoneCapability.aidl new file mode 100644 index 0000000000..db3a4c65f3 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/PhoneCapability.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.config; +@JavaDerive(toString=true) @VintfStability +parcelable PhoneCapability { + byte maxActiveData; + byte maxActiveInternetData; + boolean isInternetLingeringSupported; + byte[] logicalModemIds; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/SimPortInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/SimPortInfo.aidl new file mode 100644 index 0000000000..b5d31ada35 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/SimPortInfo.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.config; +@JavaDerive(toString=true) @VintfStability +parcelable SimPortInfo { + String iccId; + int logicalSlotId; + boolean portActive; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/SimSlotStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/SimSlotStatus.aidl new file mode 100644 index 0000000000..c264dfd3cf --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/SimSlotStatus.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.config; +@JavaDerive(toString=true) @VintfStability +parcelable SimSlotStatus { + int cardState; + String atr; + String eid; + android.hardware.radio.config.SimPortInfo[] portInfo; + android.hardware.radio.config.MultipleEnabledProfilesMode supportedMepMode = android.hardware.radio.config.MultipleEnabledProfilesMode.NONE; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/SlotPortMapping.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/SlotPortMapping.aidl new file mode 100644 index 0000000000..31271eed8d --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.config/2/android/hardware/radio/config/SlotPortMapping.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.config; +@JavaDerive(toString=true) @VintfStability +parcelable SlotPortMapping { + int physicalSlotId; + int portId; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/.hash b/radio/aidl/aidl_api/android.hardware.radio.data/2/.hash new file mode 100644 index 0000000000..566a4752e1 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/.hash @@ -0,0 +1 @@ +cb458326b02e0e87143f24118543e8cc7d6a9e8e diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/ApnAuthType.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/ApnAuthType.aidl new file mode 100644 index 0000000000..a33ad6e338 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/ApnAuthType.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum ApnAuthType { + NO_PAP_NO_CHAP, + PAP_NO_CHAP, + NO_PAP_CHAP, + PAP_CHAP, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/ApnTypes.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/ApnTypes.aidl new file mode 100644 index 0000000000..9133c7b2cb --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/ApnTypes.aidl @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum ApnTypes { + NONE = 0, + DEFAULT = (1 << 0) /* 1 */, + MMS = (1 << 1) /* 2 */, + SUPL = (1 << 2) /* 4 */, + DUN = (1 << 3) /* 8 */, + HIPRI = (1 << 4) /* 16 */, + FOTA = (1 << 5) /* 32 */, + IMS = (1 << 6) /* 64 */, + CBS = (1 << 7) /* 128 */, + IA = (1 << 8) /* 256 */, + EMERGENCY = (1 << 9) /* 512 */, + MCX = (1 << 10) /* 1024 */, + XCAP = (1 << 11) /* 2048 */, + VSIM = (1 << 12) /* 4096 */, + BIP = (1 << 13) /* 8192 */, + ENTERPRISE = (1 << 14) /* 16384 */, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/DataCallFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/DataCallFailCause.aidl new file mode 100644 index 0000000000..28d122d986 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/DataCallFailCause.aidl @@ -0,0 +1,381 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum DataCallFailCause { + NONE = 0, + OPERATOR_BARRED = 0x08, + NAS_SIGNALLING = 0x0E, + INSUFFICIENT_RESOURCES = 0x1A, + MISSING_UNKNOWN_APN = 0x1B, + UNKNOWN_PDP_ADDRESS_TYPE = 0x1C, + USER_AUTHENTICATION = 0x1D, + ACTIVATION_REJECT_GGSN = 0x1E, + ACTIVATION_REJECT_UNSPECIFIED = 0x1F, + SERVICE_OPTION_NOT_SUPPORTED = 0x20, + SERVICE_OPTION_NOT_SUBSCRIBED = 0x21, + SERVICE_OPTION_OUT_OF_ORDER = 0x22, + NSAPI_IN_USE = 0x23, + REGULAR_DEACTIVATION = 0x24, + QOS_NOT_ACCEPTED = 0x25, + NETWORK_FAILURE = 0x26, + UMTS_REACTIVATION_REQ = 0x27, + FEATURE_NOT_SUPP = 0x28, + TFT_SEMANTIC_ERROR = 0x29, + TFT_SYTAX_ERROR = 0x2A, + UNKNOWN_PDP_CONTEXT = 0x2B, + FILTER_SEMANTIC_ERROR = 0x2C, + FILTER_SYTAX_ERROR = 0x2D, + PDP_WITHOUT_ACTIVE_TFT = 0x2E, + ONLY_IPV4_ALLOWED = 0x32, + ONLY_IPV6_ALLOWED = 0x33, + ONLY_SINGLE_BEARER_ALLOWED = 0x34, + ESM_INFO_NOT_RECEIVED = 0x35, + PDN_CONN_DOES_NOT_EXIST = 0x36, + MULTI_CONN_TO_SAME_PDN_NOT_ALLOWED = 0x37, + MAX_ACTIVE_PDP_CONTEXT_REACHED = 0x41, + UNSUPPORTED_APN_IN_CURRENT_PLMN = 0x42, + INVALID_TRANSACTION_ID = 0x51, + MESSAGE_INCORRECT_SEMANTIC = 0x5F, + INVALID_MANDATORY_INFO = 0x60, + MESSAGE_TYPE_UNSUPPORTED = 0x61, + MSG_TYPE_NONCOMPATIBLE_STATE = 0x62, + UNKNOWN_INFO_ELEMENT = 0x63, + CONDITIONAL_IE_ERROR = 0x64, + MSG_AND_PROTOCOL_STATE_UNCOMPATIBLE = 0x65, + PROTOCOL_ERRORS = 0x6F, + APN_TYPE_CONFLICT = 0x70, + INVALID_PCSCF_ADDR = 0x71, + INTERNAL_CALL_PREEMPT_BY_HIGH_PRIO_APN = 0x72, + EMM_ACCESS_BARRED = 0x73, + EMERGENCY_IFACE_ONLY = 0x74, + IFACE_MISMATCH = 0x75, + COMPANION_IFACE_IN_USE = 0x76, + IP_ADDRESS_MISMATCH = 0x77, + IFACE_AND_POL_FAMILY_MISMATCH = 0x78, + EMM_ACCESS_BARRED_INFINITE_RETRY = 0x79, + AUTH_FAILURE_ON_EMERGENCY_CALL = 0x7A, + OEM_DCFAILCAUSE_1 = 0x1001, + OEM_DCFAILCAUSE_2 = 0x1002, + OEM_DCFAILCAUSE_3 = 0x1003, + OEM_DCFAILCAUSE_4 = 0x1004, + OEM_DCFAILCAUSE_5 = 0x1005, + OEM_DCFAILCAUSE_6 = 0x1006, + OEM_DCFAILCAUSE_7 = 0x1007, + OEM_DCFAILCAUSE_8 = 0x1008, + OEM_DCFAILCAUSE_9 = 0x1009, + OEM_DCFAILCAUSE_10 = 0x100A, + OEM_DCFAILCAUSE_11 = 0x100B, + OEM_DCFAILCAUSE_12 = 0x100C, + OEM_DCFAILCAUSE_13 = 0x100D, + OEM_DCFAILCAUSE_14 = 0x100E, + OEM_DCFAILCAUSE_15 = 0x100F, + VOICE_REGISTRATION_FAIL = (-1) /* -1 */, + DATA_REGISTRATION_FAIL = (-2) /* -2 */, + SIGNAL_LOST = (-3) /* -3 */, + PREF_RADIO_TECH_CHANGED = (-4) /* -4 */, + RADIO_POWER_OFF = (-5) /* -5 */, + TETHERED_CALL_ACTIVE = (-6) /* -6 */, + ERROR_UNSPECIFIED = 0xffff, + LLC_SNDCP = 0x19, + ACTIVATION_REJECTED_BCM_VIOLATION = 0x30, + COLLISION_WITH_NETWORK_INITIATED_REQUEST = 0x38, + ONLY_IPV4V6_ALLOWED = 0x39, + ONLY_NON_IP_ALLOWED = 0x3A, + UNSUPPORTED_QCI_VALUE = 0x3B, + BEARER_HANDLING_NOT_SUPPORTED = 0x3C, + INVALID_DNS_ADDR = 0x7B, + INVALID_PCSCF_OR_DNS_ADDRESS = 0x7C, + CALL_PREEMPT_BY_EMERGENCY_APN = 0x7F, + UE_INITIATED_DETACH_OR_DISCONNECT = 0x80, + MIP_FA_REASON_UNSPECIFIED = 0x7D0, + MIP_FA_ADMIN_PROHIBITED = 0x7D1, + MIP_FA_INSUFFICIENT_RESOURCES = 0x7D2, + MIP_FA_MOBILE_NODE_AUTHENTICATION_FAILURE = 0x7D3, + MIP_FA_HOME_AGENT_AUTHENTICATION_FAILURE = 0x7D4, + MIP_FA_REQUESTED_LIFETIME_TOO_LONG = 0x7D5, + MIP_FA_MALFORMED_REQUEST = 0x7D6, + MIP_FA_MALFORMED_REPLY = 0x7D7, + MIP_FA_ENCAPSULATION_UNAVAILABLE = 0x7D8, + MIP_FA_VJ_HEADER_COMPRESSION_UNAVAILABLE = 0x7D9, + MIP_FA_REVERSE_TUNNEL_UNAVAILABLE = 0x7DA, + MIP_FA_REVERSE_TUNNEL_IS_MANDATORY = 0x7DB, + MIP_FA_DELIVERY_STYLE_NOT_SUPPORTED = 0x7DC, + MIP_FA_MISSING_NAI = 0x7DD, + MIP_FA_MISSING_HOME_AGENT = 0x7DE, + MIP_FA_MISSING_HOME_ADDRESS = 0x7DF, + MIP_FA_UNKNOWN_CHALLENGE = 0x7E0, + MIP_FA_MISSING_CHALLENGE = 0x7E1, + MIP_FA_STALE_CHALLENGE = 0x7E2, + MIP_HA_REASON_UNSPECIFIED = 0x7E3, + MIP_HA_ADMIN_PROHIBITED = 0x7E4, + MIP_HA_INSUFFICIENT_RESOURCES = 0x7E5, + MIP_HA_MOBILE_NODE_AUTHENTICATION_FAILURE = 0x7E6, + MIP_HA_FOREIGN_AGENT_AUTHENTICATION_FAILURE = 0x7E7, + MIP_HA_REGISTRATION_ID_MISMATCH = 0x7E8, + MIP_HA_MALFORMED_REQUEST = 0x7E9, + MIP_HA_UNKNOWN_HOME_AGENT_ADDRESS = 0x7EA, + MIP_HA_REVERSE_TUNNEL_UNAVAILABLE = 0x7EB, + MIP_HA_REVERSE_TUNNEL_IS_MANDATORY = 0x7EC, + MIP_HA_ENCAPSULATION_UNAVAILABLE = 0x7ED, + CLOSE_IN_PROGRESS = 0x7EE, + NETWORK_INITIATED_TERMINATION = 0x7EF, + MODEM_APP_PREEMPTED = 0x7F0, + PDN_IPV4_CALL_DISALLOWED = 0x7F1, + PDN_IPV4_CALL_THROTTLED = 0x7F2, + PDN_IPV6_CALL_DISALLOWED = 0x7F3, + PDN_IPV6_CALL_THROTTLED = 0x7F4, + MODEM_RESTART = 0x7F5, + PDP_PPP_NOT_SUPPORTED = 0x7F6, + UNPREFERRED_RAT = 0x7F7, + PHYSICAL_LINK_CLOSE_IN_PROGRESS = 0x7F8, + APN_PENDING_HANDOVER = 0x7F9, + PROFILE_BEARER_INCOMPATIBLE = 0x7FA, + SIM_CARD_CHANGED = 0x7FB, + LOW_POWER_MODE_OR_POWERING_DOWN = 0x7FC, + APN_DISABLED = 0x7FD, + MAX_PPP_INACTIVITY_TIMER_EXPIRED = 0x7FE, + IPV6_ADDRESS_TRANSFER_FAILED = 0x7FF, + TRAT_SWAP_FAILED = 0x800, + EHRPD_TO_HRPD_FALLBACK = 0x801, + MIP_CONFIG_FAILURE = 0x802, + PDN_INACTIVITY_TIMER_EXPIRED = 0x803, + MAX_IPV4_CONNECTIONS = 0x804, + MAX_IPV6_CONNECTIONS = 0x805, + APN_MISMATCH = 0x806, + IP_VERSION_MISMATCH = 0x807, + DUN_CALL_DISALLOWED = 0x808, + INTERNAL_EPC_NONEPC_TRANSITION = 0x809, + INTERFACE_IN_USE = 0x80A, + APN_DISALLOWED_ON_ROAMING = 0x80B, + APN_PARAMETERS_CHANGED = 0x80C, + NULL_APN_DISALLOWED = 0x80D, + THERMAL_MITIGATION = 0x80E, + DATA_SETTINGS_DISABLED = 0x80F, + DATA_ROAMING_SETTINGS_DISABLED = 0x810, + DDS_SWITCHED = 0x811, + FORBIDDEN_APN_NAME = 0x812, + DDS_SWITCH_IN_PROGRESS = 0x813, + CALL_DISALLOWED_IN_ROAMING = 0x814, + NON_IP_NOT_SUPPORTED = 0x815, + PDN_NON_IP_CALL_THROTTLED = 0x816, + PDN_NON_IP_CALL_DISALLOWED = 0x817, + CDMA_LOCK = 0x818, + CDMA_INTERCEPT = 0x819, + CDMA_REORDER = 0x81A, + CDMA_RELEASE_DUE_TO_SO_REJECTION = 0x81B, + CDMA_INCOMING_CALL = 0x81C, + CDMA_ALERT_STOP = 0x81D, + CHANNEL_ACQUISITION_FAILURE = 0x81E, + MAX_ACCESS_PROBE = 0x81F, + CONCURRENT_SERVICE_NOT_SUPPORTED_BY_BASE_STATION = 0x820, + NO_RESPONSE_FROM_BASE_STATION = 0x821, + REJECTED_BY_BASE_STATION = 0x822, + CONCURRENT_SERVICES_INCOMPATIBLE = 0x823, + NO_CDMA_SERVICE = 0x824, + RUIM_NOT_PRESENT = 0x825, + CDMA_RETRY_ORDER = 0x826, + ACCESS_BLOCK = 0x827, + ACCESS_BLOCK_ALL = 0x828, + IS707B_MAX_ACCESS_PROBES = 0x829, + THERMAL_EMERGENCY = 0x82A, + CONCURRENT_SERVICES_NOT_ALLOWED = 0x82B, + INCOMING_CALL_REJECTED = 0x82C, + NO_SERVICE_ON_GATEWAY = 0x82D, + NO_GPRS_CONTEXT = 0x82E, + ILLEGAL_MS = 0x82F, + ILLEGAL_ME = 0x830, + GPRS_SERVICES_AND_NON_GPRS_SERVICES_NOT_ALLOWED = 0x831, + GPRS_SERVICES_NOT_ALLOWED = 0x832, + MS_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK = 0x833, + IMPLICITLY_DETACHED = 0x834, + PLMN_NOT_ALLOWED = 0x835, + LOCATION_AREA_NOT_ALLOWED = 0x836, + GPRS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN = 0x837, + PDP_DUPLICATE = 0x838, + UE_RAT_CHANGE = 0x839, + CONGESTION = 0x83A, + NO_PDP_CONTEXT_ACTIVATED = 0x83B, + ACCESS_CLASS_DSAC_REJECTION = 0x83C, + PDP_ACTIVATE_MAX_RETRY_FAILED = 0x83D, + RADIO_ACCESS_BEARER_FAILURE = 0x83E, + ESM_UNKNOWN_EPS_BEARER_CONTEXT = 0x83F, + DRB_RELEASED_BY_RRC = 0x840, + CONNECTION_RELEASED = 0x841, + EMM_DETACHED = 0x842, + EMM_ATTACH_FAILED = 0x843, + EMM_ATTACH_STARTED = 0x844, + LTE_NAS_SERVICE_REQUEST_FAILED = 0x845, + DUPLICATE_BEARER_ID = 0x846, + ESM_COLLISION_SCENARIOS = 0x847, + ESM_BEARER_DEACTIVATED_TO_SYNC_WITH_NETWORK = 0x848, + ESM_NW_ACTIVATED_DED_BEARER_WITH_ID_OF_DEF_BEARER = 0x849, + ESM_BAD_OTA_MESSAGE = 0x84A, + ESM_DOWNLOAD_SERVER_REJECTED_THE_CALL = 0x84B, + ESM_CONTEXT_TRANSFERRED_DUE_TO_IRAT = 0x84C, + DS_EXPLICIT_DEACTIVATION = 0x84D, + ESM_LOCAL_CAUSE_NONE = 0x84E, + LTE_THROTTLING_NOT_REQUIRED = 0x84F, + ACCESS_CONTROL_LIST_CHECK_FAILURE = 0x850, + SERVICE_NOT_ALLOWED_ON_PLMN = 0x851, + EMM_T3417_EXPIRED = 0x852, + EMM_T3417_EXT_EXPIRED = 0x853, + RRC_UPLINK_DATA_TRANSMISSION_FAILURE = 0x854, + RRC_UPLINK_DELIVERY_FAILED_DUE_TO_HANDOVER = 0x855, + RRC_UPLINK_CONNECTION_RELEASE = 0x856, + RRC_UPLINK_RADIO_LINK_FAILURE = 0x857, + RRC_UPLINK_ERROR_REQUEST_FROM_NAS = 0x858, + RRC_CONNECTION_ACCESS_STRATUM_FAILURE = 0x859, + RRC_CONNECTION_ANOTHER_PROCEDURE_IN_PROGRESS = 0x85A, + RRC_CONNECTION_ACCESS_BARRED = 0x85B, + RRC_CONNECTION_CELL_RESELECTION = 0x85C, + RRC_CONNECTION_CONFIG_FAILURE = 0x85D, + RRC_CONNECTION_TIMER_EXPIRED = 0x85E, + RRC_CONNECTION_LINK_FAILURE = 0x85F, + RRC_CONNECTION_CELL_NOT_CAMPED = 0x860, + RRC_CONNECTION_SYSTEM_INTERVAL_FAILURE = 0x861, + RRC_CONNECTION_REJECT_BY_NETWORK = 0x862, + RRC_CONNECTION_NORMAL_RELEASE = 0x863, + RRC_CONNECTION_RADIO_LINK_FAILURE = 0x864, + RRC_CONNECTION_REESTABLISHMENT_FAILURE = 0x865, + RRC_CONNECTION_OUT_OF_SERVICE_DURING_CELL_REGISTER = 0x866, + RRC_CONNECTION_ABORT_REQUEST = 0x867, + RRC_CONNECTION_SYSTEM_INFORMATION_BLOCK_READ_ERROR = 0x868, + NETWORK_INITIATED_DETACH_WITH_AUTO_REATTACH = 0x869, + NETWORK_INITIATED_DETACH_NO_AUTO_REATTACH = 0x86A, + ESM_PROCEDURE_TIME_OUT = 0x86B, + INVALID_CONNECTION_ID = 0x86C, + MAXIMIUM_NSAPIS_EXCEEDED = 0x86D, + INVALID_PRIMARY_NSAPI = 0x86E, + CANNOT_ENCODE_OTA_MESSAGE = 0x86F, + RADIO_ACCESS_BEARER_SETUP_FAILURE = 0x870, + PDP_ESTABLISH_TIMEOUT_EXPIRED = 0x871, + PDP_MODIFY_TIMEOUT_EXPIRED = 0x872, + PDP_INACTIVE_TIMEOUT_EXPIRED = 0x873, + PDP_LOWERLAYER_ERROR = 0x874, + PDP_MODIFY_COLLISION = 0x875, + /** + * @deprecated use MAXIMUM_SIZE_OF_L2_MESSAGE_EXCEEDED instead. + */ + MAXINUM_SIZE_OF_L2_MESSAGE_EXCEEDED = 0x876, + MAXIMUM_SIZE_OF_L2_MESSAGE_EXCEEDED = 0x876, + NAS_REQUEST_REJECTED_BY_NETWORK = 0x877, + RRC_CONNECTION_INVALID_REQUEST = 0x878, + RRC_CONNECTION_TRACKING_AREA_ID_CHANGED = 0x879, + RRC_CONNECTION_RF_UNAVAILABLE = 0x87A, + RRC_CONNECTION_ABORTED_DUE_TO_IRAT_CHANGE = 0x87B, + RRC_CONNECTION_RELEASED_SECURITY_NOT_ACTIVE = 0x87C, + RRC_CONNECTION_ABORTED_AFTER_HANDOVER = 0x87D, + RRC_CONNECTION_ABORTED_AFTER_IRAT_CELL_CHANGE = 0x87E, + RRC_CONNECTION_ABORTED_DURING_IRAT_CELL_CHANGE = 0x87F, + IMSI_UNKNOWN_IN_HOME_SUBSCRIBER_SERVER = 0x880, + IMEI_NOT_ACCEPTED = 0x881, + EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED = 0x882, + EPS_SERVICES_NOT_ALLOWED_IN_PLMN = 0x883, + MSC_TEMPORARILY_NOT_REACHABLE = 0x884, + CS_DOMAIN_NOT_AVAILABLE = 0x885, + ESM_FAILURE = 0x886, + MAC_FAILURE = 0x887, + SYNCHRONIZATION_FAILURE = 0x888, + UE_SECURITY_CAPABILITIES_MISMATCH = 0x889, + SECURITY_MODE_REJECTED = 0x88A, + UNACCEPTABLE_NON_EPS_AUTHENTICATION = 0x88B, + CS_FALLBACK_CALL_ESTABLISHMENT_NOT_ALLOWED = 0x88C, + NO_EPS_BEARER_CONTEXT_ACTIVATED = 0x88D, + INVALID_EMM_STATE = 0x88E, + NAS_LAYER_FAILURE = 0x88F, + MULTIPLE_PDP_CALL_NOT_ALLOWED = 0x890, + EMBMS_NOT_ENABLED = 0x891, + IRAT_HANDOVER_FAILED = 0x892, + EMBMS_REGULAR_DEACTIVATION = 0x893, + TEST_LOOPBACK_REGULAR_DEACTIVATION = 0x894, + LOWER_LAYER_REGISTRATION_FAILURE = 0x895, + DATA_PLAN_EXPIRED = 0x896, + UMTS_HANDOVER_TO_IWLAN = 0x897, + EVDO_CONNECTION_DENY_BY_GENERAL_OR_NETWORK_BUSY = 0x898, + EVDO_CONNECTION_DENY_BY_BILLING_OR_AUTHENTICATION_FAILURE = 0x899, + EVDO_HDR_CHANGED = 0x89A, + EVDO_HDR_EXITED = 0x89B, + EVDO_HDR_NO_SESSION = 0x89C, + EVDO_USING_GPS_FIX_INSTEAD_OF_HDR_CALL = 0x89D, + EVDO_HDR_CONNECTION_SETUP_TIMEOUT = 0x89E, + FAILED_TO_ACQUIRE_COLOCATED_HDR = 0x89F, + OTASP_COMMIT_IN_PROGRESS = 0x8A0, + NO_HYBRID_HDR_SERVICE = 0x8A1, + HDR_NO_LOCK_GRANTED = 0x8A2, + DBM_OR_SMS_IN_PROGRESS = 0x8A3, + HDR_FADE = 0x8A4, + HDR_ACCESS_FAILURE = 0x8A5, + UNSUPPORTED_1X_PREV = 0x8A6, + LOCAL_END = 0x8A7, + NO_SERVICE = 0x8A8, + FADE = 0x8A9, + NORMAL_RELEASE = 0x8AA, + ACCESS_ATTEMPT_ALREADY_IN_PROGRESS = 0x8AB, + REDIRECTION_OR_HANDOFF_IN_PROGRESS = 0x8AC, + EMERGENCY_MODE = 0x8AD, + PHONE_IN_USE = 0x8AE, + INVALID_MODE = 0x8AF, + INVALID_SIM_STATE = 0x8B0, + NO_COLLOCATED_HDR = 0x8B1, + UE_IS_ENTERING_POWERSAVE_MODE = 0x8B2, + DUAL_SWITCH = 0x8B3, + PPP_TIMEOUT = 0x8B4, + PPP_AUTH_FAILURE = 0x8B5, + PPP_OPTION_MISMATCH = 0x8B6, + PPP_PAP_FAILURE = 0x8B7, + PPP_CHAP_FAILURE = 0x8B8, + PPP_CLOSE_IN_PROGRESS = 0x8B9, + LIMITED_TO_IPV4 = 0x8BA, + LIMITED_TO_IPV6 = 0x8BB, + VSNCP_TIMEOUT = 0x8BC, + VSNCP_GEN_ERROR = 0x8BD, + VSNCP_APN_UNAUTHORIZED = 0x8BE, + VSNCP_PDN_LIMIT_EXCEEDED = 0x8BF, + VSNCP_NO_PDN_GATEWAY_ADDRESS = 0x8C0, + VSNCP_PDN_GATEWAY_UNREACHABLE = 0x8C1, + VSNCP_PDN_GATEWAY_REJECT = 0x8C2, + VSNCP_INSUFFICIENT_PARAMETERS = 0x8C3, + VSNCP_RESOURCE_UNAVAILABLE = 0x8C4, + VSNCP_ADMINISTRATIVELY_PROHIBITED = 0x8C5, + VSNCP_PDN_ID_IN_USE = 0x8C6, + VSNCP_SUBSCRIBER_LIMITATION = 0x8C7, + VSNCP_PDN_EXISTS_FOR_THIS_APN = 0x8C8, + VSNCP_RECONNECT_NOT_ALLOWED = 0x8C9, + IPV6_PREFIX_UNAVAILABLE = 0x8CA, + HANDOFF_PREFERENCE_CHANGED = 0x8CB, + SLICE_REJECTED = 0x8CC, + MATCH_ALL_RULE_NOT_ALLOWED = 0x8CD, + ALL_MATCHING_RULES_FAILED = 0x8CE, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/DataProfileInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/DataProfileInfo.aidl new file mode 100644 index 0000000000..0136fa4a5a --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/DataProfileInfo.aidl @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable DataProfileInfo { + int profileId; + String apn; + android.hardware.radio.data.PdpProtocolType protocol; + android.hardware.radio.data.PdpProtocolType roamingProtocol; + android.hardware.radio.data.ApnAuthType authType; + String user; + String password; + int type; + int maxConnsTime; + int maxConns; + int waitTime; + boolean enabled; + int supportedApnTypesBitmap; + int bearerBitmap; + int mtuV4; + int mtuV6; + boolean preferred; + boolean persistent; + boolean alwaysOn; + android.hardware.radio.data.TrafficDescriptor trafficDescriptor; + const int ID_DEFAULT = 0; + const int ID_TETHERED = 1; + const int ID_IMS = 2; + const int ID_FOTA = 3; + const int ID_CBS = 4; + const int ID_OEM_BASE = 1000; + const int ID_INVALID = 0xFFFFFFFF; + const int TYPE_COMMON = 0; + const int TYPE_3GPP = 1; + const int TYPE_3GPP2 = 2; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/DataRequestReason.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/DataRequestReason.aidl new file mode 100644 index 0000000000..0ddaff1662 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/DataRequestReason.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum DataRequestReason { + NORMAL = 1, + SHUTDOWN = 2, + HANDOVER = 3, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/DataThrottlingAction.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/DataThrottlingAction.aidl new file mode 100644 index 0000000000..e80a764046 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/DataThrottlingAction.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@Backing(type="byte") @JavaDerive(toString=true) @VintfStability +enum DataThrottlingAction { + NO_DATA_THROTTLING, + THROTTLE_SECONDARY_CARRIER, + THROTTLE_ANCHOR_CARRIER, + HOLD, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/EpsQos.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/EpsQos.aidl new file mode 100644 index 0000000000..5b9aaa0b1e --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/EpsQos.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable EpsQos { + int qci; + android.hardware.radio.data.QosBandwidth downlink; + android.hardware.radio.data.QosBandwidth uplink; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/IRadioData.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/IRadioData.aidl new file mode 100644 index 0000000000..7b572f1f8e --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/IRadioData.aidl @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@VintfStability +interface IRadioData { + oneway void allocatePduSessionId(in int serial); + oneway void cancelHandover(in int serial, in int callId); + oneway void deactivateDataCall(in int serial, in int cid, in android.hardware.radio.data.DataRequestReason reason); + oneway void getDataCallList(in int serial); + oneway void getSlicingConfig(in int serial); + oneway void releasePduSessionId(in int serial, in int id); + oneway void responseAcknowledgement(); + oneway void setDataAllowed(in int serial, in boolean allow); + oneway void setDataProfile(in int serial, in android.hardware.radio.data.DataProfileInfo[] profiles); + oneway void setDataThrottling(in int serial, in android.hardware.radio.data.DataThrottlingAction dataThrottlingAction, in long completionDurationMillis); + oneway void setInitialAttachApn(in int serial, in @nullable android.hardware.radio.data.DataProfileInfo dataProfileInfo); + oneway void setResponseFunctions(in android.hardware.radio.data.IRadioDataResponse radioDataResponse, in android.hardware.radio.data.IRadioDataIndication radioDataIndication); + oneway void setupDataCall(in int serial, in android.hardware.radio.AccessNetwork accessNetwork, in android.hardware.radio.data.DataProfileInfo dataProfileInfo, in boolean roamingAllowed, in android.hardware.radio.data.DataRequestReason reason, in android.hardware.radio.data.LinkAddress[] addresses, in String[] dnses, in int pduSessionId, in @nullable android.hardware.radio.data.SliceInfo sliceInfo, in boolean matchAllRuleAllowed); + oneway void startHandover(in int serial, in int callId); + oneway void startKeepalive(in int serial, in android.hardware.radio.data.KeepaliveRequest keepalive); + oneway void stopKeepalive(in int serial, in int sessionHandle); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/IRadioDataIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/IRadioDataIndication.aidl new file mode 100644 index 0000000000..0ffa1f7ddf --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/IRadioDataIndication.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@VintfStability +interface IRadioDataIndication { + oneway void dataCallListChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.data.SetupDataCallResult[] dcList); + oneway void keepaliveStatus(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.data.KeepaliveStatus status); + oneway void pcoData(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.data.PcoDataInfo pco); + oneway void unthrottleApn(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.data.DataProfileInfo dataProfileInfo); + oneway void slicingConfigChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.data.SlicingConfig slicingConfig); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/IRadioDataResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/IRadioDataResponse.aidl new file mode 100644 index 0000000000..4edc17d4ad --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/IRadioDataResponse.aidl @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@VintfStability +interface IRadioDataResponse { + oneway void acknowledgeRequest(in int serial); + oneway void allocatePduSessionIdResponse(in android.hardware.radio.RadioResponseInfo info, in int id); + oneway void cancelHandoverResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void deactivateDataCallResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void getDataCallListResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.data.SetupDataCallResult[] dcResponse); + oneway void getSlicingConfigResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.data.SlicingConfig slicingConfig); + oneway void releasePduSessionIdResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setDataAllowedResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setDataProfileResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setDataThrottlingResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setInitialAttachApnResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setupDataCallResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.data.SetupDataCallResult dcResponse); + oneway void startHandoverResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void startKeepaliveResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.data.KeepaliveStatus status); + oneway void stopKeepaliveResponse(in android.hardware.radio.RadioResponseInfo info); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/KeepaliveRequest.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/KeepaliveRequest.aidl new file mode 100644 index 0000000000..592a54a90c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/KeepaliveRequest.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable KeepaliveRequest { + int type; + byte[] sourceAddress; + int sourcePort; + byte[] destinationAddress; + int destinationPort; + int maxKeepaliveIntervalMillis; + int cid; + const int TYPE_NATT_IPV4 = 0; + const int TYPE_NATT_IPV6 = 1; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/KeepaliveStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/KeepaliveStatus.aidl new file mode 100644 index 0000000000..82b0fc8ec1 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/KeepaliveStatus.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable KeepaliveStatus { + int sessionHandle; + int code; + const int CODE_ACTIVE = 0; + const int CODE_INACTIVE = 1; + const int CODE_PENDING = 2; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/LinkAddress.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/LinkAddress.aidl new file mode 100644 index 0000000000..77d637b9b9 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/LinkAddress.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable LinkAddress { + String address; + int addressProperties; + long deprecationTime; + long expirationTime; + const int ADDRESS_PROPERTY_NONE = 0; + const int ADDRESS_PROPERTY_DEPRECATED = 0x20; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/NrQos.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/NrQos.aidl new file mode 100644 index 0000000000..660a531275 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/NrQos.aidl @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable NrQos { + int fiveQi; + android.hardware.radio.data.QosBandwidth downlink; + android.hardware.radio.data.QosBandwidth uplink; + byte qfi; + /** + * @deprecated use averagingWindowMillis; + */ + char averagingWindowMs; + int averagingWindowMillis = AVERAGING_WINDOW_UNKNOWN /* -1 */; + const byte FLOW_ID_RANGE_MIN = 1; + const byte FLOW_ID_RANGE_MAX = 63; + const int AVERAGING_WINDOW_UNKNOWN = (-1) /* -1 */; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/OsAppId.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/OsAppId.aidl new file mode 100644 index 0000000000..8595d5206d --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/OsAppId.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable OsAppId { + byte[] osAppId; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/PcoDataInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/PcoDataInfo.aidl new file mode 100644 index 0000000000..033b12f4ee --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/PcoDataInfo.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable PcoDataInfo { + int cid; + String bearerProto; + int pcoId; + byte[] contents; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/PdpProtocolType.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/PdpProtocolType.aidl new file mode 100644 index 0000000000..1e5970d8e3 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/PdpProtocolType.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum PdpProtocolType { + UNKNOWN = (-1) /* -1 */, + IP = 0, + IPV6 = 1, + IPV4V6 = 2, + PPP = 3, + NON_IP = 4, + UNSTRUCTURED = 5, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/PortRange.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/PortRange.aidl new file mode 100644 index 0000000000..470a9c11b3 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/PortRange.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable PortRange { + int start; + int end; + const int PORT_RANGE_MIN = 20; + const int PORT_RANGE_MAX = 65535; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/Qos.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/Qos.aidl new file mode 100644 index 0000000000..ca06e4112b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/Qos.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@JavaDerive(toString=true) @VintfStability +union Qos { + boolean noinit; + android.hardware.radio.data.EpsQos eps; + android.hardware.radio.data.NrQos nr; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosBandwidth.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosBandwidth.aidl new file mode 100644 index 0000000000..6d4b7a9f49 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosBandwidth.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable QosBandwidth { + int maxBitrateKbps; + int guaranteedBitrateKbps; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosFilter.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosFilter.aidl new file mode 100644 index 0000000000..a3d4ced840 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosFilter.aidl @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable QosFilter { + String[] localAddresses; + String[] remoteAddresses; + @nullable android.hardware.radio.data.PortRange localPort; + @nullable android.hardware.radio.data.PortRange remotePort; + byte protocol; + android.hardware.radio.data.QosFilterTypeOfService tos; + android.hardware.radio.data.QosFilterIpv6FlowLabel flowLabel; + android.hardware.radio.data.QosFilterIpsecSpi spi; + byte direction; + int precedence; + const byte DIRECTION_DOWNLINK = 0; + const byte DIRECTION_UPLINK = 1; + const byte DIRECTION_BIDIRECTIONAL = 2; + const byte PROTOCOL_UNSPECIFIED = (-1) /* -1 */; + const byte PROTOCOL_TCP = 6; + const byte PROTOCOL_UDP = 17; + const byte PROTOCOL_ESP = 50; + const byte PROTOCOL_AH = 51; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosFilterIpsecSpi.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosFilterIpsecSpi.aidl new file mode 100644 index 0000000000..4b75340276 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosFilterIpsecSpi.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@JavaDerive(toString=true) @VintfStability +union QosFilterIpsecSpi { + boolean noinit; + int value; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosFilterIpv6FlowLabel.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosFilterIpv6FlowLabel.aidl new file mode 100644 index 0000000000..3fb34ea375 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosFilterIpv6FlowLabel.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@JavaDerive(toString=true) @VintfStability +union QosFilterIpv6FlowLabel { + boolean noinit; + int value; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosFilterTypeOfService.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosFilterTypeOfService.aidl new file mode 100644 index 0000000000..fa85b5acc3 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosFilterTypeOfService.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@JavaDerive(toString=true) @VintfStability +union QosFilterTypeOfService { + boolean noinit; + byte value; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosSession.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosSession.aidl new file mode 100644 index 0000000000..bbfdd2d48c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/QosSession.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable QosSession { + int qosSessionId; + android.hardware.radio.data.Qos qos; + android.hardware.radio.data.QosFilter[] qosFilters; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/RouteSelectionDescriptor.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/RouteSelectionDescriptor.aidl new file mode 100644 index 0000000000..acbdbd0fd5 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/RouteSelectionDescriptor.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable RouteSelectionDescriptor { + byte precedence; + android.hardware.radio.data.PdpProtocolType sessionType; + byte sscMode; + android.hardware.radio.data.SliceInfo[] sliceInfo; + String[] dnn; + const byte SSC_MODE_UNKNOWN = (-1) /* -1 */; + const byte SSC_MODE_1 = 1; + const byte SSC_MODE_2 = 2; + const byte SSC_MODE_3 = 3; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/SetupDataCallResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/SetupDataCallResult.aidl new file mode 100644 index 0000000000..83f9db61ac --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/SetupDataCallResult.aidl @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable SetupDataCallResult { + android.hardware.radio.data.DataCallFailCause cause; + long suggestedRetryTime; + int cid; + int active; + android.hardware.radio.data.PdpProtocolType type; + String ifname; + android.hardware.radio.data.LinkAddress[] addresses; + String[] dnses; + String[] gateways; + String[] pcscf; + int mtuV4; + int mtuV6; + android.hardware.radio.data.Qos defaultQos; + android.hardware.radio.data.QosSession[] qosSessions; + byte handoverFailureMode; + int pduSessionId; + @nullable android.hardware.radio.data.SliceInfo sliceInfo; + android.hardware.radio.data.TrafficDescriptor[] trafficDescriptors; + const int DATA_CONNECTION_STATUS_INACTIVE = 0; + const int DATA_CONNECTION_STATUS_DORMANT = 1; + const int DATA_CONNECTION_STATUS_ACTIVE = 2; + const byte HANDOVER_FAILURE_MODE_LEGACY = 0; + const byte HANDOVER_FAILURE_MODE_DO_FALLBACK = 1; + const byte HANDOVER_FAILURE_MODE_NO_FALLBACK_RETRY_HANDOVER = 2; + const byte HANDOVER_FAILURE_MODE_NO_FALLBACK_RETRY_SETUP_NORMAL = 3; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/SliceInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/SliceInfo.aidl new file mode 100644 index 0000000000..efe48165ee --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/SliceInfo.aidl @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable SliceInfo { + byte sliceServiceType; + int sliceDifferentiator; + byte mappedHplmnSst; + int mappedHplmnSd; + byte status; + const byte SERVICE_TYPE_NONE = 0; + const byte SERVICE_TYPE_EMBB = 1; + const byte SERVICE_TYPE_URLLC = 2; + const byte SERVICE_TYPE_MIOT = 3; + const byte STATUS_UNKNOWN = 0; + const byte STATUS_CONFIGURED = 1; + const byte STATUS_ALLOWED = 2; + const byte STATUS_REJECTED_NOT_AVAILABLE_IN_PLMN = 3; + const byte STATUS_REJECTED_NOT_AVAILABLE_IN_REG_AREA = 4; + const byte STATUS_DEFAULT_CONFIGURED = 5; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/SlicingConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/SlicingConfig.aidl new file mode 100644 index 0000000000..b00febebaf --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/SlicingConfig.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable SlicingConfig { + android.hardware.radio.data.UrspRule[] urspRules; + android.hardware.radio.data.SliceInfo[] sliceInfo; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/TrafficDescriptor.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/TrafficDescriptor.aidl new file mode 100644 index 0000000000..d7b0654970 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/TrafficDescriptor.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable TrafficDescriptor { + @nullable String dnn; + @nullable android.hardware.radio.data.OsAppId osAppId; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/UrspRule.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/UrspRule.aidl new file mode 100644 index 0000000000..7002fd118c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.data/2/android/hardware/radio/data/UrspRule.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.data; +@JavaDerive(toString=true) @VintfStability +parcelable UrspRule { + int precedence; + android.hardware.radio.data.TrafficDescriptor[] trafficDescriptors; + android.hardware.radio.data.RouteSelectionDescriptor[] routeSelectionDescriptor; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/.hash b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/.hash new file mode 100644 index 0000000000..c57de3309d --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/.hash @@ -0,0 +1 @@ +af4dcb2aeff14e1352901a2a240c03d0a5377da9 diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/AmrMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/AmrMode.aidl new file mode 100644 index 0000000000..37e3b256f3 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/AmrMode.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@Backing(type="int") @VintfStability +enum AmrMode { + AMR_MODE_0 = (1 << 0) /* 1 */, + AMR_MODE_1 = (1 << 1) /* 2 */, + AMR_MODE_2 = (1 << 2) /* 4 */, + AMR_MODE_3 = (1 << 3) /* 8 */, + AMR_MODE_4 = (1 << 4) /* 16 */, + AMR_MODE_5 = (1 << 5) /* 32 */, + AMR_MODE_6 = (1 << 6) /* 64 */, + AMR_MODE_7 = (1 << 7) /* 128 */, + AMR_MODE_8 = (1 << 8) /* 256 */, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/AmrParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/AmrParams.aidl new file mode 100644 index 0000000000..36edb7f8c4 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/AmrParams.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable AmrParams { + android.hardware.radio.ims.media.AmrMode amrMode; + boolean octetAligned; + int maxRedundancyMillis; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/AnbrMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/AnbrMode.aidl new file mode 100644 index 0000000000..c108c07033 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/AnbrMode.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims.media; +@JavaDerive(toString=true) @VintfStability +parcelable AnbrMode { + android.hardware.radio.ims.media.CodecMode anbrUplinkMode; + android.hardware.radio.ims.media.CodecMode anbrDownlinkMode; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/CallQuality.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/CallQuality.aidl new file mode 100644 index 0000000000..fff6e1c3c2 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/CallQuality.aidl @@ -0,0 +1,58 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable CallQuality { + int downlinkCallQualityLevel; + int uplinkCallQualityLevel; + int callDuration; + int numRtpPacketsTransmitted; + int numRtpPacketsReceived; + int numRtpPacketsTransmittedLost; + int numRtpPacketsNotReceived; + int averageRelativeJitter; + int maxRelativeJitter; + int averageRoundTripTime; + int codecType; + boolean rtpInactivityDetected; + boolean rxSilenceDetected; + boolean txSilenceDetected; + int numVoiceFrames; + int numNoDataFrames; + int numDroppedRtpPackets; + long minPlayoutDelayMillis; + long maxPlayoutDelayMillis; + int numRtpSidPacketsReceived; + int numRtpDuplicatePackets; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/CodecMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/CodecMode.aidl new file mode 100644 index 0000000000..0e9140f023 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/CodecMode.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims.media; +@JavaDerive(toString=true) @VintfStability +union CodecMode { + boolean noinit; + android.hardware.radio.ims.media.AmrMode amr; + android.hardware.radio.ims.media.EvsMode evs; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/CodecParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/CodecParams.aidl new file mode 100644 index 0000000000..3da2dbd9ef --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/CodecParams.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable CodecParams { + android.hardware.radio.ims.media.CodecType codecType; + byte rxPayloadTypeNumber; + byte txPayloadTypeNumber; + byte samplingRateKHz; + boolean dtxEnabled; + android.hardware.radio.ims.media.CodecSpecificParams codecSpecificParams; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/CodecSpecificParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/CodecSpecificParams.aidl new file mode 100644 index 0000000000..08e3f0f15e --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/CodecSpecificParams.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +union CodecSpecificParams { + android.hardware.radio.ims.media.AmrParams amr; + android.hardware.radio.ims.media.EvsParams evs; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/CodecType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/CodecType.aidl new file mode 100644 index 0000000000..e4193cd6a2 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/CodecType.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@Backing(type="int") @VintfStability +enum CodecType { + AMR = (1 << 0) /* 1 */, + AMR_WB = (1 << 1) /* 2 */, + EVS = (1 << 2) /* 4 */, + PCMA = (1 << 3) /* 8 */, + PCMU = (1 << 4) /* 16 */, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/DtmfParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/DtmfParams.aidl new file mode 100644 index 0000000000..5523fd87ca --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/DtmfParams.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable DtmfParams { + byte rxPayloadTypeNumber; + byte txPayloadTypeNumber; + byte samplingRateKHz; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/EvsBandwidth.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/EvsBandwidth.aidl new file mode 100644 index 0000000000..db3eb2941a --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/EvsBandwidth.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@Backing(type="int") @VintfStability +enum EvsBandwidth { + NONE = 0, + NARROW_BAND = (1 << 0) /* 1 */, + WIDE_BAND = (1 << 1) /* 2 */, + SUPER_WIDE_BAND = (1 << 2) /* 4 */, + FULL_BAND = (1 << 3) /* 8 */, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/EvsMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/EvsMode.aidl new file mode 100644 index 0000000000..fb1f14da3a --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/EvsMode.aidl @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@Backing(type="int") @VintfStability +enum EvsMode { + EVS_MODE_0 = (1 << 0) /* 1 */, + EVS_MODE_1 = (1 << 1) /* 2 */, + EVS_MODE_2 = (1 << 2) /* 4 */, + EVS_MODE_3 = (1 << 3) /* 8 */, + EVS_MODE_4 = (1 << 4) /* 16 */, + EVS_MODE_5 = (1 << 5) /* 32 */, + EVS_MODE_6 = (1 << 6) /* 64 */, + EVS_MODE_7 = (1 << 7) /* 128 */, + EVS_MODE_8 = (1 << 8) /* 256 */, + EVS_MODE_9 = (1 << 9) /* 512 */, + EVS_MODE_10 = (1 << 10) /* 1024 */, + EVS_MODE_11 = (1 << 11) /* 2048 */, + EVS_MODE_12 = (1 << 12) /* 4096 */, + EVS_MODE_13 = (1 << 13) /* 8192 */, + EVS_MODE_14 = (1 << 14) /* 16384 */, + EVS_MODE_15 = (1 << 15) /* 32768 */, + EVS_MODE_16 = (1 << 16) /* 65536 */, + EVS_MODE_17 = (1 << 17) /* 131072 */, + EVS_MODE_18 = (1 << 18) /* 262144 */, + EVS_MODE_19 = (1 << 19) /* 524288 */, + EVS_MODE_20 = (1 << 20) /* 1048576 */, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/EvsParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/EvsParams.aidl new file mode 100644 index 0000000000..735eb082ab --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/EvsParams.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable EvsParams { + android.hardware.radio.ims.media.EvsBandwidth bandwidth; + android.hardware.radio.ims.media.EvsMode evsMode; + byte channelAwareMode; + boolean useHeaderFullOnly; + boolean useEvsModeSwitch; + byte codecModeRequest; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/IImsMedia.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/IImsMedia.aidl new file mode 100644 index 0000000000..30793e5eb2 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/IImsMedia.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +interface IImsMedia { + oneway void setListener(in android.hardware.radio.ims.media.IImsMediaListener mediaListener); + oneway void openSession(int sessionId, in android.hardware.radio.ims.media.LocalEndPoint localEndPoint, in android.hardware.radio.ims.media.RtpConfig config); + oneway void closeSession(int sessionId); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/IImsMediaListener.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/IImsMediaListener.aidl new file mode 100644 index 0000000000..40f7107cdf --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/IImsMediaListener.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +interface IImsMediaListener { + oneway void onOpenSessionSuccess(int sessionId, android.hardware.radio.ims.media.IImsMediaSession session); + oneway void onOpenSessionFailure(int sessionId, android.hardware.radio.ims.media.RtpError error); + oneway void onSessionClosed(int sessionId); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/IImsMediaSession.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/IImsMediaSession.aidl new file mode 100644 index 0000000000..ea9f3a4282 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/IImsMediaSession.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +interface IImsMediaSession { + oneway void setListener(in android.hardware.radio.ims.media.IImsMediaSessionListener sessionListener); + oneway void modifySession(in android.hardware.radio.ims.media.RtpConfig config); + oneway void sendDtmf(char dtmfDigit, int duration); + oneway void startDtmf(char dtmfDigit); + oneway void stopDtmf(); + oneway void sendHeaderExtension(in List extensions); + oneway void setMediaQualityThreshold(in android.hardware.radio.ims.media.MediaQualityThreshold threshold); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl new file mode 100644 index 0000000000..cb221df830 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/IImsMediaSessionListener.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +interface IImsMediaSessionListener { + oneway void onModifySessionResponse(in android.hardware.radio.ims.media.RtpConfig config, android.hardware.radio.ims.media.RtpError error); + oneway void onFirstMediaPacketReceived(in android.hardware.radio.ims.media.RtpConfig config); + oneway void onHeaderExtensionReceived(in List extensions); + oneway void notifyMediaQualityStatus(in android.hardware.radio.ims.media.MediaQualityStatus quality); + oneway void triggerAnbrQuery(in android.hardware.radio.ims.media.RtpConfig config); + oneway void onDtmfReceived(char dtmfDigit, int durationMs); + oneway void onCallQualityChanged(in android.hardware.radio.ims.media.CallQuality callQuality); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/LocalEndPoint.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/LocalEndPoint.aidl new file mode 100644 index 0000000000..6ec51569af --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/LocalEndPoint.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable LocalEndPoint { + ParcelFileDescriptor rtpFd; + ParcelFileDescriptor rtcpFd; + int modemId; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/MediaDirection.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/MediaDirection.aidl new file mode 100644 index 0000000000..0e9eaee31b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/MediaDirection.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@Backing(type="int") @VintfStability +enum MediaDirection { + NO_FLOW = 0, + RTP_TX = (1 << 0) /* 1 */, + RTP_RX = (1 << 1) /* 2 */, + RTCP_TX = (1 << 2) /* 4 */, + RTCP_RX = (1 << 3) /* 8 */, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/MediaQualityStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/MediaQualityStatus.aidl new file mode 100644 index 0000000000..4accf5315b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/MediaQualityStatus.aidl @@ -0,0 +1,41 @@ +/* + * 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable MediaQualityStatus { + int rtpInactivityTimeMillis; + int rtcpInactivityTimeMillis; + int rtpPacketLossRate; + int rtpJitterMillis; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/MediaQualityThreshold.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/MediaQualityThreshold.aidl new file mode 100644 index 0000000000..31cf3739a7 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/MediaQualityThreshold.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable MediaQualityThreshold { + int[] rtpInactivityTimerMillis; + int rtcpInactivityTimerMillis; + int rtpPacketLossDurationMillis; + int rtpHysteresisTimeInMillis; + int[] rtpPacketLossRate; + int[] rtpJitterMillis; + boolean notifyCurrentStatus; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtcpConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtcpConfig.aidl new file mode 100644 index 0000000000..6a76d85cd8 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtcpConfig.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable RtcpConfig { + String canonicalName; + int transmitPort; + int transmitIntervalSec; + int rtcpXrBlocks; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl new file mode 100644 index 0000000000..289c810b87 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@Backing(type="int") @VintfStability +enum RtcpXrReportBlockType { + RTCPXR_NONE = 0, + RTCPXR_LOSS_RLE_REPORT_BLOCK = (1 << 0) /* 1 */, + RTCPXR_DUPLICATE_RLE_REPORT_BLOCK = (1 << 1) /* 2 */, + RTCPXR_PACKET_RECEIPT_TIMES_REPORT_BLOCK = (1 << 2) /* 4 */, + RTCPXR_RECEIVER_REFERENCE_TIME_REPORT_BLOCK = (1 << 3) /* 8 */, + RTCPXR_DLRR_REPORT_BLOCK = (1 << 4) /* 16 */, + RTCPXR_STATISTICS_SUMMARY_REPORT_BLOCK = (1 << 5) /* 32 */, + RTCPXR_VOIP_METRICS_REPORT_BLOCK = (1 << 6) /* 64 */, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtpAddress.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtpAddress.aidl new file mode 100644 index 0000000000..35357d179a --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtpAddress.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable RtpAddress { + String ipAddress; + int portNumber; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtpConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtpConfig.aidl new file mode 100644 index 0000000000..8a826f6b5f --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtpConfig.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable RtpConfig { + int direction; + android.hardware.radio.AccessNetwork accessNetwork; + android.hardware.radio.ims.media.RtpAddress remoteAddress; + android.hardware.radio.ims.media.RtpSessionParams sessionParams; + android.hardware.radio.ims.media.RtcpConfig rtcpConfig; + android.hardware.radio.ims.media.AnbrMode anbrModeParams; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtpError.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtpError.aidl new file mode 100644 index 0000000000..41b0aeb287 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtpError.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@Backing(type="int") @VintfStability +enum RtpError { + NONE = 0, + INVALID_PARAM = 1, + NOT_READY = 2, + NO_MEMORY = 3, + NO_RESOURCES = 4, + PORT_UNAVAILABLE = 5, + NOT_SUPPORTED = 6, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtpHeaderExtension.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtpHeaderExtension.aidl new file mode 100644 index 0000000000..83b8a314e3 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtpHeaderExtension.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable RtpHeaderExtension { + int localId; + byte[] data; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtpSessionParams.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtpSessionParams.aidl new file mode 100644 index 0000000000..13a7487f73 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/1/android/hardware/radio/ims/media/RtpSessionParams.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.ims.media; +@VintfStability +parcelable RtpSessionParams { + byte pTimeMillis; + int maxPtimeMillis; + byte dscp; + android.hardware.radio.ims.media.DtmfParams dtmfParams; + android.hardware.radio.ims.media.CodecParams codecParams; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/1/.hash b/radio/aidl/aidl_api/android.hardware.radio.ims/1/.hash new file mode 100644 index 0000000000..9d5f5c1649 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/1/.hash @@ -0,0 +1 @@ +b09f8d98a60fbe74cefaca7aea9903ab5450110a diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ConnectionFailureInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ConnectionFailureInfo.aidl new file mode 100644 index 0000000000..90e75f96e1 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ConnectionFailureInfo.aidl @@ -0,0 +1,53 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@JavaDerive(toString=true) @VintfStability +parcelable ConnectionFailureInfo { + android.hardware.radio.ims.ConnectionFailureInfo.ConnectionFailureReason failureReason; + int causeCode; + int waitTimeMillis; + @Backing(type="int") @VintfStability + enum ConnectionFailureReason { + REASON_ACCESS_DENIED = 1, + REASON_NAS_FAILURE = 2, + REASON_RACH_FAILURE = 3, + REASON_RLC_FAILURE = 4, + REASON_RRC_REJECT = 5, + REASON_RRC_TIMEOUT = 6, + REASON_NO_SERVICE = 7, + REASON_PDN_NOT_AVAILABLE = 8, + REASON_RF_BUSY = 9, + REASON_UNSPECIFIED = 0xFFFF, + } +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/EpsFallbackReason.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/EpsFallbackReason.aidl new file mode 100644 index 0000000000..ebea9034ec --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/EpsFallbackReason.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum EpsFallbackReason { + NO_NETWORK_TRIGGER = 1, + NO_NETWORK_RESPONSE = 2, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/IRadioIms.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/IRadioIms.aidl new file mode 100644 index 0000000000..4df870969d --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/IRadioIms.aidl @@ -0,0 +1,45 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@VintfStability +interface IRadioIms { + oneway void setSrvccCallInfo(int serial, in android.hardware.radio.ims.SrvccCall[] srvccCalls); + oneway void updateImsRegistrationInfo(int serial, in android.hardware.radio.ims.ImsRegistration imsRegistration); + oneway void startImsTraffic(int serial, int token, android.hardware.radio.ims.ImsTrafficType imsTrafficType, android.hardware.radio.AccessNetwork accessNetworkType, android.hardware.radio.ims.ImsCall.Direction trafficDirection); + oneway void stopImsTraffic(int serial, int token); + oneway void triggerEpsFallback(int serial, in android.hardware.radio.ims.EpsFallbackReason reason); + oneway void setResponseFunctions(in android.hardware.radio.ims.IRadioImsResponse radioImsResponse, in android.hardware.radio.ims.IRadioImsIndication radioImsIndication); + oneway void sendAnbrQuery(int serial, android.hardware.radio.ims.ImsStreamType mediaType, android.hardware.radio.ims.ImsStreamDirection direction, int bitsPerSecond); + oneway void updateImsCallStatus(int serial, in android.hardware.radio.ims.ImsCall[] imsCalls); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/IRadioImsIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/IRadioImsIndication.aidl new file mode 100644 index 0000000000..ef6b4cc9ca --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/IRadioImsIndication.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@VintfStability +interface IRadioImsIndication { + oneway void onConnectionSetupFailure(in android.hardware.radio.RadioIndicationType type, int token, in android.hardware.radio.ims.ConnectionFailureInfo info); + oneway void notifyAnbr(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.ims.ImsStreamType mediaType, in android.hardware.radio.ims.ImsStreamDirection direction, int bitsPerSecond); + oneway void triggerImsDeregistration(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.ims.ImsDeregistrationReason reason); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/IRadioImsResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/IRadioImsResponse.aidl new file mode 100644 index 0000000000..053ba46864 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/IRadioImsResponse.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@VintfStability +interface IRadioImsResponse { + oneway void setSrvccCallInfoResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void updateImsRegistrationInfoResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void startImsTrafficResponse(in android.hardware.radio.RadioResponseInfo info, in @nullable android.hardware.radio.ims.ConnectionFailureInfo failureInfo); + oneway void stopImsTrafficResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void triggerEpsFallbackResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void sendAnbrQueryResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void updateImsCallStatusResponse(in android.hardware.radio.RadioResponseInfo info); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsCall.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsCall.aidl new file mode 100644 index 0000000000..6e14830012 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsCall.aidl @@ -0,0 +1,64 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@JavaDerive(toString=true) @VintfStability +parcelable ImsCall { + int index; + android.hardware.radio.ims.ImsCall.CallType callType; + android.hardware.radio.AccessNetwork accessNetwork; + android.hardware.radio.ims.ImsCall.CallState callState; + android.hardware.radio.ims.ImsCall.Direction direction; + boolean isHeldByRemote; + @Backing(type="int") + enum CallType { + NORMAL, + EMERGENCY, + } + @Backing(type="int") + enum CallState { + ACTIVE, + HOLDING, + DIALING, + ALERTING, + INCOMING, + WAITING, + DISCONNECTING, + DISCONNECTED, + } + @Backing(type="int") + enum Direction { + INCOMING, + OUTGOING, + } +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsDeregistrationReason.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsDeregistrationReason.aidl new file mode 100644 index 0000000000..b04e5598c7 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsDeregistrationReason.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum ImsDeregistrationReason { + REASON_SIM_REMOVED = 1, + REASON_SIM_REFRESH = 2, + REASON_ALLOWED_NETWORK_TYPES_CHANGED = 3, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsRegistration.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsRegistration.aidl new file mode 100644 index 0000000000..7ed6bafc43 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsRegistration.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@JavaDerive(toString=true) @VintfStability +parcelable ImsRegistration { + android.hardware.radio.ims.ImsRegistrationState regState; + android.hardware.radio.AccessNetwork accessNetworkType; + android.hardware.radio.ims.SuggestedAction suggestedAction; + int capabilities; + const int IMS_MMTEL_CAPABILITY_NONE = 0; + const int IMS_MMTEL_CAPABILITY_VOICE = (1 << 0) /* 1 */; + const int IMS_MMTEL_CAPABILITY_VIDEO = (1 << 1) /* 2 */; + const int IMS_MMTEL_CAPABILITY_SMS = (1 << 2) /* 4 */; + const int IMS_RCS_CAPABILITIES = (1 << 3) /* 8 */; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsRegistrationState.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsRegistrationState.aidl new file mode 100644 index 0000000000..6302b4798d --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsRegistrationState.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum ImsRegistrationState { + NOT_REGISTERED, + REGISTERED, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsStreamDirection.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsStreamDirection.aidl new file mode 100644 index 0000000000..cf2e4f1d89 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsStreamDirection.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum ImsStreamDirection { + UPLINK = 1, + DOWNLINK = 2, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsStreamType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsStreamType.aidl new file mode 100644 index 0000000000..10c477f938 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsStreamType.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@Backing(type="int") @VintfStability +enum ImsStreamType { + AUDIO = 1, + VIDEO = 2, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsTrafficType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsTrafficType.aidl new file mode 100644 index 0000000000..b1a0b770cd --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/ImsTrafficType.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum ImsTrafficType { + EMERGENCY, + EMERGENCY_SMS, + VOICE, + VIDEO, + SMS, + REGISTRATION, + UT_XCAP, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/SrvccCall.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/SrvccCall.aidl new file mode 100644 index 0000000000..5119b0ff02 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/SrvccCall.aidl @@ -0,0 +1,64 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@JavaDerive(toString=true) @VintfStability +parcelable SrvccCall { + int index; + android.hardware.radio.ims.SrvccCall.CallType callType; + int callState; + android.hardware.radio.ims.SrvccCall.CallSubState callSubstate; + android.hardware.radio.ims.SrvccCall.ToneType ringbackToneType; + boolean isMpty; + boolean isMT; + String number; + int numPresentation; + String name; + int namePresentation; + @Backing(type="int") @VintfStability + enum CallType { + NORMAL, + EMERGENCY, + } + @Backing(type="int") @VintfStability + enum CallSubState { + NONE, + PREALERTING, + } + @Backing(type="int") @VintfStability + enum ToneType { + NONE, + LOCAL, + NETWORK, + } +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/SuggestedAction.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/SuggestedAction.aidl new file mode 100644 index 0000000000..bbe170e445 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.ims/1/android/hardware/radio/ims/SuggestedAction.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.ims; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum SuggestedAction { + NONE, + TRIGGER_PLMN_BLOCK, + TRIGGER_PLMN_BLOCK_WITH_TIMEOUT, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/2/.hash b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/.hash new file mode 100644 index 0000000000..280bdb1678 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/.hash @@ -0,0 +1 @@ +50aefda34c9dd40090c8d5925e71d5b84530c3d0 diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaBroadcastSmsConfigInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaBroadcastSmsConfigInfo.aidl new file mode 100644 index 0000000000..39e2be2f63 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaBroadcastSmsConfigInfo.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.messaging; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaBroadcastSmsConfigInfo { + int serviceCategory; + int language; + boolean selected; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaSmsAck.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaSmsAck.aidl new file mode 100644 index 0000000000..befdbdefb6 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaSmsAck.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.messaging; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaSmsAck { + boolean errorClass; + int smsCauseCode; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaSmsAddress.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaSmsAddress.aidl new file mode 100644 index 0000000000..ab29c775dd --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaSmsAddress.aidl @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.messaging; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaSmsAddress { + int digitMode; + boolean isNumberModeDataNetwork; + int numberType; + int numberPlan; + byte[] digits; + const int DIGIT_MODE_FOUR_BIT = 0; + const int DIGIT_MODE_EIGHT_BIT = 1; + const int NUMBER_PLAN_UNKNOWN = 0; + const int NUMBER_PLAN_TELEPHONY = 1; + const int NUMBER_PLAN_RESERVED_2 = 2; + const int NUMBER_PLAN_DATA = 3; + const int NUMBER_PLAN_TELEX = 4; + const int NUMBER_PLAN_RESERVED_5 = 5; + const int NUMBER_PLAN_RESERVED_6 = 6; + const int NUMBER_PLAN_RESERVED_7 = 7; + const int NUMBER_PLAN_RESERVED_8 = 8; + const int NUMBER_PLAN_PRIVATE = 9; + const int NUMBER_PLAN_RESERVED_10 = 10; + const int NUMBER_PLAN_RESERVED_11 = 11; + const int NUMBER_PLAN_RESERVED_12 = 12; + const int NUMBER_PLAN_RESERVED_13 = 13; + const int NUMBER_PLAN_RESERVED_14 = 14; + const int NUMBER_PLAN_RESERVED_15 = 15; + const int NUMBER_TYPE_UNKNOWN = 0; + const int NUMBER_TYPE_INTERNATIONAL_OR_DATA_IP = 1; + const int NUMBER_TYPE_NATIONAL_OR_INTERNET_MAIL = 2; + const int NUMBER_TYPE_NETWORK = 3; + const int NUMBER_TYPE_SUBSCRIBER = 4; + const int NUMBER_TYPE_ALPHANUMERIC = 5; + const int NUMBER_TYPE_ABBREVIATED = 6; + const int NUMBER_TYPE_RESERVED_7 = 7; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaSmsMessage.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaSmsMessage.aidl new file mode 100644 index 0000000000..867596c81b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaSmsMessage.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.messaging; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaSmsMessage { + int teleserviceId; + boolean isServicePresent; + int serviceCategory; + android.hardware.radio.messaging.CdmaSmsAddress address; + android.hardware.radio.messaging.CdmaSmsSubaddress subAddress; + byte[] bearerData; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaSmsSubaddress.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaSmsSubaddress.aidl new file mode 100644 index 0000000000..d67fe8c577 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaSmsSubaddress.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.messaging; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaSmsSubaddress { + int subaddressType; + boolean odd; + byte[] digits; + const int SUBADDRESS_TYPE_NSAP = 0; + const int SUBADDRESS_TYPE_USER_SPECIFIED = 1; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaSmsWriteArgs.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaSmsWriteArgs.aidl new file mode 100644 index 0000000000..b0a7f98dc6 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/CdmaSmsWriteArgs.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.messaging; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaSmsWriteArgs { + int status; + android.hardware.radio.messaging.CdmaSmsMessage message; + const int STATUS_REC_UNREAD = 0; + const int STATUS_REC_READ = 1; + const int STATUS_STO_UNSENT = 2; + const int STATUS_STO_SENT = 3; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/GsmBroadcastSmsConfigInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/GsmBroadcastSmsConfigInfo.aidl new file mode 100644 index 0000000000..46604cabe6 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/GsmBroadcastSmsConfigInfo.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.messaging; +@JavaDerive(toString=true) @VintfStability +parcelable GsmBroadcastSmsConfigInfo { + int fromServiceId; + int toServiceId; + int fromCodeScheme; + int toCodeScheme; + boolean selected; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/GsmSmsMessage.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/GsmSmsMessage.aidl new file mode 100644 index 0000000000..4df7fd2508 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/GsmSmsMessage.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.messaging; +@JavaDerive(toString=true) @VintfStability +parcelable GsmSmsMessage { + String smscPdu; + String pdu; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/IRadioMessaging.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/IRadioMessaging.aidl new file mode 100644 index 0000000000..dfec59ae45 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/IRadioMessaging.aidl @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.messaging; +@VintfStability +interface IRadioMessaging { + oneway void acknowledgeIncomingGsmSmsWithPdu(in int serial, in boolean success, in String ackPdu); + oneway void acknowledgeLastIncomingCdmaSms(in int serial, in android.hardware.radio.messaging.CdmaSmsAck smsAck); + oneway void acknowledgeLastIncomingGsmSms(in int serial, in boolean success, in android.hardware.radio.messaging.SmsAcknowledgeFailCause cause); + oneway void deleteSmsOnRuim(in int serial, in int index); + oneway void deleteSmsOnSim(in int serial, in int index); + oneway void getCdmaBroadcastConfig(in int serial); + oneway void getGsmBroadcastConfig(in int serial); + oneway void getSmscAddress(in int serial); + oneway void reportSmsMemoryStatus(in int serial, in boolean available); + oneway void responseAcknowledgement(); + oneway void sendCdmaSms(in int serial, in android.hardware.radio.messaging.CdmaSmsMessage sms); + oneway void sendCdmaSmsExpectMore(in int serial, in android.hardware.radio.messaging.CdmaSmsMessage sms); + oneway void sendImsSms(in int serial, in android.hardware.radio.messaging.ImsSmsMessage message); + oneway void sendSms(in int serial, in android.hardware.radio.messaging.GsmSmsMessage message); + oneway void sendSmsExpectMore(in int serial, in android.hardware.radio.messaging.GsmSmsMessage message); + oneway void setCdmaBroadcastActivation(in int serial, in boolean activate); + oneway void setCdmaBroadcastConfig(in int serial, in android.hardware.radio.messaging.CdmaBroadcastSmsConfigInfo[] configInfo); + oneway void setGsmBroadcastActivation(in int serial, in boolean activate); + oneway void setGsmBroadcastConfig(in int serial, in android.hardware.radio.messaging.GsmBroadcastSmsConfigInfo[] configInfo); + oneway void setResponseFunctions(in android.hardware.radio.messaging.IRadioMessagingResponse radioMessagingResponse, in android.hardware.radio.messaging.IRadioMessagingIndication radioMessagingIndication); + oneway void setSmscAddress(in int serial, in String smsc); + oneway void writeSmsToRuim(in int serial, in android.hardware.radio.messaging.CdmaSmsWriteArgs cdmaSms); + oneway void writeSmsToSim(in int serial, in android.hardware.radio.messaging.SmsWriteArgs smsWriteArgs); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/IRadioMessagingIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/IRadioMessagingIndication.aidl new file mode 100644 index 0000000000..8f7824f515 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/IRadioMessagingIndication.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.messaging; +@VintfStability +interface IRadioMessagingIndication { + oneway void cdmaNewSms(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.messaging.CdmaSmsMessage msg); + oneway void cdmaRuimSmsStorageFull(in android.hardware.radio.RadioIndicationType type); + oneway void newBroadcastSms(in android.hardware.radio.RadioIndicationType type, in byte[] data); + oneway void newSms(in android.hardware.radio.RadioIndicationType type, in byte[] pdu); + oneway void newSmsOnSim(in android.hardware.radio.RadioIndicationType type, in int recordNumber); + oneway void newSmsStatusReport(in android.hardware.radio.RadioIndicationType type, in byte[] pdu); + oneway void simSmsStorageFull(in android.hardware.radio.RadioIndicationType type); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/IRadioMessagingResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/IRadioMessagingResponse.aidl new file mode 100644 index 0000000000..c3af7a684c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/IRadioMessagingResponse.aidl @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.messaging; +@VintfStability +interface IRadioMessagingResponse { + oneway void acknowledgeIncomingGsmSmsWithPduResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void acknowledgeLastIncomingCdmaSmsResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void acknowledgeLastIncomingGsmSmsResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void acknowledgeRequest(in int serial); + oneway void deleteSmsOnRuimResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void deleteSmsOnSimResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void getCdmaBroadcastConfigResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.messaging.CdmaBroadcastSmsConfigInfo[] configs); + oneway void getGsmBroadcastConfigResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.messaging.GsmBroadcastSmsConfigInfo[] configs); + oneway void getSmscAddressResponse(in android.hardware.radio.RadioResponseInfo info, in String smsc); + oneway void reportSmsMemoryStatusResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void sendCdmaSmsExpectMoreResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.messaging.SendSmsResult sms); + oneway void sendCdmaSmsResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.messaging.SendSmsResult sms); + oneway void sendImsSmsResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.messaging.SendSmsResult sms); + oneway void sendSmsExpectMoreResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.messaging.SendSmsResult sms); + oneway void sendSmsResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.messaging.SendSmsResult sms); + oneway void setCdmaBroadcastActivationResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setCdmaBroadcastConfigResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setGsmBroadcastActivationResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setGsmBroadcastConfigResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setSmscAddressResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void writeSmsToRuimResponse(in android.hardware.radio.RadioResponseInfo info, in int index); + oneway void writeSmsToSimResponse(in android.hardware.radio.RadioResponseInfo info, in int index); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/ImsSmsMessage.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/ImsSmsMessage.aidl new file mode 100644 index 0000000000..85f62b781d --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/ImsSmsMessage.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.messaging; +@JavaDerive(toString=true) @VintfStability +parcelable ImsSmsMessage { + android.hardware.radio.RadioTechnologyFamily tech; + boolean retry; + int messageRef; + android.hardware.radio.messaging.CdmaSmsMessage[] cdmaMessage; + android.hardware.radio.messaging.GsmSmsMessage[] gsmMessage; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/SendSmsResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/SendSmsResult.aidl new file mode 100644 index 0000000000..32f7a5cb71 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/SendSmsResult.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.messaging; +@JavaDerive(toString=true) @VintfStability +parcelable SendSmsResult { + int messageRef; + String ackPDU; + int errorCode; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/SmsAcknowledgeFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/SmsAcknowledgeFailCause.aidl new file mode 100644 index 0000000000..d061c9ea17 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/SmsAcknowledgeFailCause.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.messaging; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum SmsAcknowledgeFailCause { + MEMORY_CAPACITY_EXCEEDED = 0xD3, + UNSPECIFIED_ERROR = 0XFF, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/SmsWriteArgs.aidl b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/SmsWriteArgs.aidl new file mode 100644 index 0000000000..489cc07068 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.messaging/2/android/hardware/radio/messaging/SmsWriteArgs.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.messaging; +@JavaDerive(toString=true) @VintfStability +parcelable SmsWriteArgs { + int status; + String pdu; + String smsc; + const int STATUS_REC_UNREAD = 0; + const int STATUS_REC_READ = 1; + const int STATUS_STO_UNSENT = 2; + const int STATUS_STO_SENT = 3; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/2/.hash b/radio/aidl/aidl_api/android.hardware.radio.modem/2/.hash new file mode 100644 index 0000000000..46183203c4 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/2/.hash @@ -0,0 +1 @@ +09927560afccc75a063944fbbab3af48099261ca diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/ActivityStatsInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/ActivityStatsInfo.aidl new file mode 100644 index 0000000000..7e22ee046e --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/ActivityStatsInfo.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.modem; +@JavaDerive(toString=true) @VintfStability +parcelable ActivityStatsInfo { + int sleepModeTimeMs; + int idleModeTimeMs; + android.hardware.radio.modem.ActivityStatsTechSpecificInfo[] techSpecificInfo; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl new file mode 100644 index 0000000000..08ed9a529e --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/ActivityStatsTechSpecificInfo.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.modem; +@JavaDerive(toString=true) @VintfStability +parcelable ActivityStatsTechSpecificInfo { + android.hardware.radio.AccessNetwork rat; + int frequencyRange; + int[] txmModetimeMs; + int rxModeTimeMs; + const int FREQUENCY_RANGE_UNKNOWN = 0; + const int FREQUENCY_RANGE_LOW = 1; + const int FREQUENCY_RANGE_MID = 2; + const int FREQUENCY_RANGE_HIGH = 3; + const int FREQUENCY_RANGE_MMWAVE = 4; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/DeviceStateType.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/DeviceStateType.aidl new file mode 100644 index 0000000000..acc0b22bb8 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/DeviceStateType.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.modem; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum DeviceStateType { + POWER_SAVE_MODE, + CHARGING_STATE, + LOW_DATA_EXPECTED, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/HardwareConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/HardwareConfig.aidl new file mode 100644 index 0000000000..3a0ec2514b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/HardwareConfig.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.modem; +@JavaDerive(toString=true) @VintfStability +parcelable HardwareConfig { + int type; + String uuid; + int state; + android.hardware.radio.modem.HardwareConfigModem[] modem; + android.hardware.radio.modem.HardwareConfigSim[] sim; + const int STATE_ENABLED = 0; + const int STATE_STANDBY = 1; + const int STATE_DISABLED = 2; + const int TYPE_MODEM = 0; + const int TYPE_SIM = 1; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/HardwareConfigModem.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/HardwareConfigModem.aidl new file mode 100644 index 0000000000..62bb160fc4 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/HardwareConfigModem.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.modem; +@JavaDerive(toString=true) @VintfStability +parcelable HardwareConfigModem { + int rilModel; + android.hardware.radio.RadioTechnology rat; + int maxVoiceCalls; + int maxDataCalls; + int maxStandby; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/HardwareConfigSim.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/HardwareConfigSim.aidl new file mode 100644 index 0000000000..5810982975 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/HardwareConfigSim.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.modem; +@JavaDerive(toString=true) @VintfStability +parcelable HardwareConfigSim { + String modemUuid; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/IRadioModem.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/IRadioModem.aidl new file mode 100644 index 0000000000..8546be789b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/IRadioModem.aidl @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.modem; +@VintfStability +interface IRadioModem { + oneway void enableModem(in int serial, in boolean on); + oneway void getBasebandVersion(in int serial); + /** + * @deprecated use getImei(int serial) + */ + oneway void getDeviceIdentity(in int serial); + oneway void getHardwareConfig(in int serial); + oneway void getModemActivityInfo(in int serial); + oneway void getModemStackStatus(in int serial); + oneway void getRadioCapability(in int serial); + /** + * @deprecated NV APIs are deprecated starting from Android U. + */ + oneway void nvReadItem(in int serial, in android.hardware.radio.modem.NvItem itemId); + oneway void nvResetConfig(in int serial, in android.hardware.radio.modem.ResetNvType resetType); + /** + * @deprecated NV APIs are deprecated starting from Android U. + */ + oneway void nvWriteCdmaPrl(in int serial, in byte[] prl); + /** + * @deprecated NV APIs are deprecated starting from Android U. + */ + oneway void nvWriteItem(in int serial, in android.hardware.radio.modem.NvWriteItem item); + oneway void requestShutdown(in int serial); + oneway void responseAcknowledgement(); + oneway void sendDeviceState(in int serial, in android.hardware.radio.modem.DeviceStateType deviceStateType, in boolean state); + oneway void setRadioCapability(in int serial, in android.hardware.radio.modem.RadioCapability rc); + oneway void setRadioPower(in int serial, in boolean powerOn, in boolean forEmergencyCall, in boolean preferredForEmergencyCall); + oneway void setResponseFunctions(in android.hardware.radio.modem.IRadioModemResponse radioModemResponse, in android.hardware.radio.modem.IRadioModemIndication radioModemIndication); + oneway void getImei(in int serial); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/IRadioModemIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/IRadioModemIndication.aidl new file mode 100644 index 0000000000..514ff9a03e --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/IRadioModemIndication.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.modem; +@VintfStability +interface IRadioModemIndication { + oneway void hardwareConfigChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.modem.HardwareConfig[] configs); + oneway void modemReset(in android.hardware.radio.RadioIndicationType type, in String reason); + oneway void radioCapabilityIndication(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.modem.RadioCapability rc); + oneway void radioStateChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.modem.RadioState radioState); + oneway void rilConnected(in android.hardware.radio.RadioIndicationType type); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/IRadioModemResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/IRadioModemResponse.aidl new file mode 100644 index 0000000000..5955439666 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/IRadioModemResponse.aidl @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.modem; +@VintfStability +interface IRadioModemResponse { + oneway void acknowledgeRequest(in int serial); + oneway void enableModemResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void getBasebandVersionResponse(in android.hardware.radio.RadioResponseInfo info, in String version); + /** + * @deprecated use getImeiResponse(RadioResponseInfo responseInfo, ImeiInfo imeiInfo) + */ + oneway void getDeviceIdentityResponse(in android.hardware.radio.RadioResponseInfo info, in String imei, in String imeisv, in String esn, in String meid); + oneway void getHardwareConfigResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.modem.HardwareConfig[] config); + oneway void getModemActivityInfoResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.modem.ActivityStatsInfo activityInfo); + oneway void getModemStackStatusResponse(in android.hardware.radio.RadioResponseInfo info, in boolean isEnabled); + oneway void getRadioCapabilityResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.modem.RadioCapability rc); + /** + * @deprecated NV APIs are deprecated starting from Android U. + */ + oneway void nvReadItemResponse(in android.hardware.radio.RadioResponseInfo info, in String result); + oneway void nvResetConfigResponse(in android.hardware.radio.RadioResponseInfo info); + /** + * @deprecated NV APIs are deprecated starting from Android U. + */ + oneway void nvWriteCdmaPrlResponse(in android.hardware.radio.RadioResponseInfo info); + /** + * @deprecated NV APIs are deprecated starting from Android U. + */ + oneway void nvWriteItemResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void requestShutdownResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void sendDeviceStateResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setRadioCapabilityResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.modem.RadioCapability rc); + oneway void setRadioPowerResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void getImeiResponse(in android.hardware.radio.RadioResponseInfo responseInfo, in @nullable android.hardware.radio.modem.ImeiInfo imeiInfo); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/ImeiInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/ImeiInfo.aidl new file mode 100644 index 0000000000..f8776ec412 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/ImeiInfo.aidl @@ -0,0 +1,45 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.modem; +@JavaDerive(toString=true) @VintfStability +parcelable ImeiInfo { + android.hardware.radio.modem.ImeiInfo.ImeiType type; + String imei; + String svn; + @Backing(type="int") @VintfStability + enum ImeiType { + PRIMARY = 1, + SECONDARY = 2, + } +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/NvItem.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/NvItem.aidl new file mode 100644 index 0000000000..b80d7acde1 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/NvItem.aidl @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.modem; +/** + * @deprecated NV APIs are deprecated starting from Android U. + */ +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum NvItem { + CDMA_MEID = 1, + CDMA_MIN = 2, + CDMA_MDN = 3, + CDMA_ACCOLC = 4, + DEVICE_MSL = 11, + RTN_RECONDITIONED_STATUS = 12, + RTN_ACTIVATION_DATE = 13, + RTN_LIFE_TIMER = 14, + RTN_LIFE_CALLS = 15, + RTN_LIFE_DATA_TX = 16, + RTN_LIFE_DATA_RX = 17, + OMADM_HFA_LEVEL = 18, + MIP_PROFILE_NAI = 31, + MIP_PROFILE_HOME_ADDRESS = 32, + MIP_PROFILE_AAA_AUTH = 33, + MIP_PROFILE_HA_AUTH = 34, + MIP_PROFILE_PRI_HA_ADDR = 35, + MIP_PROFILE_SEC_HA_ADDR = 36, + MIP_PROFILE_REV_TUN_PREF = 37, + MIP_PROFILE_HA_SPI = 38, + MIP_PROFILE_AAA_SPI = 39, + MIP_PROFILE_MN_HA_SS = 40, + MIP_PROFILE_MN_AAA_SS = 41, + CDMA_PRL_VERSION = 51, + CDMA_BC10 = 52, + CDMA_BC14 = 53, + CDMA_SO68 = 54, + CDMA_SO73_COP0 = 55, + CDMA_SO73_COP1TO7 = 56, + CDMA_1X_ADVANCED_ENABLED = 57, + CDMA_EHRPD_ENABLED = 58, + CDMA_EHRPD_FORCED = 59, + LTE_BAND_ENABLE_25 = 71, + LTE_BAND_ENABLE_26 = 72, + LTE_BAND_ENABLE_41 = 73, + LTE_SCAN_PRIORITY_25 = 74, + LTE_SCAN_PRIORITY_26 = 75, + LTE_SCAN_PRIORITY_41 = 76, + LTE_HIDDEN_BAND_PRIORITY_25 = 77, + LTE_HIDDEN_BAND_PRIORITY_26 = 78, + LTE_HIDDEN_BAND_PRIORITY_41 = 79, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/NvWriteItem.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/NvWriteItem.aidl new file mode 100644 index 0000000000..6a786bc419 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/NvWriteItem.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.modem; +/** + * @deprecated NV APIs are deprecated starting from Android U. + */ +@JavaDerive(toString=true) @VintfStability +parcelable NvWriteItem { + android.hardware.radio.modem.NvItem itemId; + String value; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/RadioCapability.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/RadioCapability.aidl new file mode 100644 index 0000000000..f2e2858590 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/RadioCapability.aidl @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.modem; +@JavaDerive(toString=true) @VintfStability +parcelable RadioCapability { + int session; + int phase; + int raf; + String logicalModemUuid; + int status; + const int PHASE_CONFIGURED = 0; + const int PHASE_START = 1; + const int PHASE_APPLY = 2; + const int PHASE_UNSOL_RSP = 3; + const int PHASE_FINISH = 4; + const int STATUS_NONE = 0; + const int STATUS_SUCCESS = 1; + const int STATUS_FAIL = 2; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/RadioState.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/RadioState.aidl new file mode 100644 index 0000000000..57f29410c5 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/RadioState.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.modem; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum RadioState { + OFF = 0, + UNAVAILABLE = 1, + ON = 10, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/ResetNvType.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/ResetNvType.aidl new file mode 100644 index 0000000000..37622b1312 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.modem/2/android/hardware/radio/modem/ResetNvType.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.modem; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum ResetNvType { + RELOAD, + ERASE, + FACTORY_RESET, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/.hash b/radio/aidl/aidl_api/android.hardware.radio.network/2/.hash new file mode 100644 index 0000000000..d3889fa9b0 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/.hash @@ -0,0 +1 @@ +1b6608f238bd0b1c642df315621a7b605eafc883 diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl new file mode 100644 index 0000000000..28d886256d --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/AccessTechnologySpecificInfo.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +union AccessTechnologySpecificInfo { + boolean noinit; + android.hardware.radio.network.Cdma2000RegistrationInfo cdmaInfo; + android.hardware.radio.network.EutranRegistrationInfo eutranInfo; + android.hardware.radio.network.NrVopsInfo ngranNrVopsInfo; + boolean geranDtmSupported; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/BarringInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/BarringInfo.aidl new file mode 100644 index 0000000000..e105b39101 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/BarringInfo.aidl @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable BarringInfo { + int serviceType; + int barringType; + @nullable android.hardware.radio.network.BarringTypeSpecificInfo barringTypeSpecificInfo; + const int BARRING_TYPE_NONE = 0; + const int BARRING_TYPE_CONDITIONAL = 1; + const int BARRING_TYPE_UNCONDITIONAL = 2; + const int SERVICE_TYPE_CS_SERVICE = 0; + const int SERVICE_TYPE_PS_SERVICE = 1; + const int SERVICE_TYPE_CS_VOICE = 2; + const int SERVICE_TYPE_MO_SIGNALLING = 3; + const int SERVICE_TYPE_MO_DATA = 4; + const int SERVICE_TYPE_CS_FALLBACK = 5; + const int SERVICE_TYPE_MMTEL_VOICE = 6; + const int SERVICE_TYPE_MMTEL_VIDEO = 7; + const int SERVICE_TYPE_EMERGENCY = 8; + const int SERVICE_TYPE_SMS = 9; + const int SERVICE_TYPE_OPERATOR_1 = 1001; + const int SERVICE_TYPE_OPERATOR_2 = 1002; + const int SERVICE_TYPE_OPERATOR_3 = 1003; + const int SERVICE_TYPE_OPERATOR_4 = 1004; + const int SERVICE_TYPE_OPERATOR_5 = 1005; + const int SERVICE_TYPE_OPERATOR_6 = 1006; + const int SERVICE_TYPE_OPERATOR_7 = 1007; + const int SERVICE_TYPE_OPERATOR_8 = 1008; + const int SERVICE_TYPE_OPERATOR_9 = 1009; + const int SERVICE_TYPE_OPERATOR_10 = 1010; + const int SERVICE_TYPE_OPERATOR_11 = 1011; + const int SERVICE_TYPE_OPERATOR_12 = 1012; + const int SERVICE_TYPE_OPERATOR_13 = 1013; + const int SERVICE_TYPE_OPERATOR_14 = 1014; + const int SERVICE_TYPE_OPERATOR_15 = 1015; + const int SERVICE_TYPE_OPERATOR_16 = 1016; + const int SERVICE_TYPE_OPERATOR_17 = 1017; + const int SERVICE_TYPE_OPERATOR_18 = 1018; + const int SERVICE_TYPE_OPERATOR_19 = 1019; + const int SERVICE_TYPE_OPERATOR_20 = 1020; + const int SERVICE_TYPE_OPERATOR_21 = 1021; + const int SERVICE_TYPE_OPERATOR_22 = 1022; + const int SERVICE_TYPE_OPERATOR_23 = 1023; + const int SERVICE_TYPE_OPERATOR_24 = 1024; + const int SERVICE_TYPE_OPERATOR_25 = 1025; + const int SERVICE_TYPE_OPERATOR_26 = 1026; + const int SERVICE_TYPE_OPERATOR_27 = 1027; + const int SERVICE_TYPE_OPERATOR_28 = 1028; + const int SERVICE_TYPE_OPERATOR_29 = 1029; + const int SERVICE_TYPE_OPERATOR_30 = 1030; + const int SERVICE_TYPE_OPERATOR_31 = 1031; + const int SERVICE_TYPE_OPERATOR_32 = 1032; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/BarringTypeSpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/BarringTypeSpecificInfo.aidl new file mode 100644 index 0000000000..a81363339e --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/BarringTypeSpecificInfo.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable BarringTypeSpecificInfo { + int factor; + int timeSeconds; + boolean isBarred; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/Cdma2000RegistrationInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/Cdma2000RegistrationInfo.aidl new file mode 100644 index 0000000000..e8fb79ec98 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/Cdma2000RegistrationInfo.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable Cdma2000RegistrationInfo { + boolean cssSupported; + int roamingIndicator; + int systemIsInPrl; + int defaultRoamingIndicator; + const int PRL_INDICATOR_NOT_REGISTERED = (-1) /* -1 */; + const int PRL_INDICATOR_NOT_IN_PRL = 0; + const int PRL_INDICATOR_IN_PRL = 1; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CdmaRoamingType.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CdmaRoamingType.aidl new file mode 100644 index 0000000000..2a4db70cab --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CdmaRoamingType.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum CdmaRoamingType { + HOME_NETWORK, + AFFILIATED_ROAM, + ANY_ROAM, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CdmaSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CdmaSignalStrength.aidl new file mode 100644 index 0000000000..e2f97bf98f --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CdmaSignalStrength.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaSignalStrength { + int dbm; + int ecio; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellConnectionStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellConnectionStatus.aidl new file mode 100644 index 0000000000..5ce3b3e613 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellConnectionStatus.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum CellConnectionStatus { + NONE, + PRIMARY_SERVING, + SECONDARY_SERVING, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentity.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentity.aidl new file mode 100644 index 0000000000..2ee92dee29 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentity.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +union CellIdentity { + boolean noinit; + android.hardware.radio.network.CellIdentityGsm gsm; + android.hardware.radio.network.CellIdentityWcdma wcdma; + android.hardware.radio.network.CellIdentityTdscdma tdscdma; + android.hardware.radio.network.CellIdentityCdma cdma; + android.hardware.radio.network.CellIdentityLte lte; + android.hardware.radio.network.CellIdentityNr nr; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityCdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityCdma.aidl new file mode 100644 index 0000000000..d659a2891c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityCdma.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellIdentityCdma { + int networkId; + int systemId; + int baseStationId; + int longitude; + int latitude; + android.hardware.radio.network.OperatorInfo operatorNames; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityGsm.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityGsm.aidl new file mode 100644 index 0000000000..d3193be072 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityGsm.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellIdentityGsm { + String mcc; + String mnc; + int lac; + int cid; + int arfcn; + byte bsic; + android.hardware.radio.network.OperatorInfo operatorNames; + String[] additionalPlmns; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityLte.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityLte.aidl new file mode 100644 index 0000000000..2ae7b43e2d --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityLte.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellIdentityLte { + String mcc; + String mnc; + int ci; + int pci; + int tac; + int earfcn; + android.hardware.radio.network.OperatorInfo operatorNames; + int bandwidth; + String[] additionalPlmns; + @nullable android.hardware.radio.network.ClosedSubscriberGroupInfo csgInfo; + android.hardware.radio.network.EutranBands[] bands; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityNr.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityNr.aidl new file mode 100644 index 0000000000..b30af506d8 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityNr.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellIdentityNr { + String mcc; + String mnc; + long nci; + int pci; + int tac; + int nrarfcn; + android.hardware.radio.network.OperatorInfo operatorNames; + String[] additionalPlmns; + android.hardware.radio.network.NgranBands[] bands; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityTdscdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityTdscdma.aidl new file mode 100644 index 0000000000..e99d14771c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityTdscdma.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellIdentityTdscdma { + String mcc; + String mnc; + int lac; + int cid; + int cpid; + int uarfcn; + android.hardware.radio.network.OperatorInfo operatorNames; + String[] additionalPlmns; + @nullable android.hardware.radio.network.ClosedSubscriberGroupInfo csgInfo; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityWcdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityWcdma.aidl new file mode 100644 index 0000000000..12001fcd67 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellIdentityWcdma.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellIdentityWcdma { + String mcc; + String mnc; + int lac; + int cid; + int psc; + int uarfcn; + android.hardware.radio.network.OperatorInfo operatorNames; + String[] additionalPlmns; + @nullable android.hardware.radio.network.ClosedSubscriberGroupInfo csgInfo; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfo.aidl new file mode 100644 index 0000000000..467c6b77cc --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfo.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellInfo { + boolean registered; + android.hardware.radio.network.CellConnectionStatus connectionStatus; + android.hardware.radio.network.CellInfoRatSpecificInfo ratSpecificInfo; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoCdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoCdma.aidl new file mode 100644 index 0000000000..e3bf46b918 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoCdma.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellInfoCdma { + android.hardware.radio.network.CellIdentityCdma cellIdentityCdma; + android.hardware.radio.network.CdmaSignalStrength signalStrengthCdma; + android.hardware.radio.network.EvdoSignalStrength signalStrengthEvdo; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoGsm.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoGsm.aidl new file mode 100644 index 0000000000..84dcd07d72 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoGsm.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellInfoGsm { + android.hardware.radio.network.CellIdentityGsm cellIdentityGsm; + android.hardware.radio.network.GsmSignalStrength signalStrengthGsm; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoLte.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoLte.aidl new file mode 100644 index 0000000000..221340b06a --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoLte.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellInfoLte { + android.hardware.radio.network.CellIdentityLte cellIdentityLte; + android.hardware.radio.network.LteSignalStrength signalStrengthLte; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoNr.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoNr.aidl new file mode 100644 index 0000000000..b392c1d2c7 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoNr.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellInfoNr { + android.hardware.radio.network.CellIdentityNr cellIdentityNr; + android.hardware.radio.network.NrSignalStrength signalStrengthNr; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoRatSpecificInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoRatSpecificInfo.aidl new file mode 100644 index 0000000000..4ab0640b29 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoRatSpecificInfo.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +union CellInfoRatSpecificInfo { + android.hardware.radio.network.CellInfoGsm gsm; + android.hardware.radio.network.CellInfoWcdma wcdma; + android.hardware.radio.network.CellInfoTdscdma tdscdma; + android.hardware.radio.network.CellInfoLte lte; + android.hardware.radio.network.CellInfoNr nr; + android.hardware.radio.network.CellInfoCdma cdma; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoTdscdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoTdscdma.aidl new file mode 100644 index 0000000000..138b35ce62 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoTdscdma.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellInfoTdscdma { + android.hardware.radio.network.CellIdentityTdscdma cellIdentityTdscdma; + android.hardware.radio.network.TdscdmaSignalStrength signalStrengthTdscdma; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoWcdma.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoWcdma.aidl new file mode 100644 index 0000000000..cf7b135c63 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/CellInfoWcdma.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable CellInfoWcdma { + android.hardware.radio.network.CellIdentityWcdma cellIdentityWcdma; + android.hardware.radio.network.WcdmaSignalStrength signalStrengthWcdma; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/ClosedSubscriberGroupInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/ClosedSubscriberGroupInfo.aidl new file mode 100644 index 0000000000..fe734c8f78 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/ClosedSubscriberGroupInfo.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable ClosedSubscriberGroupInfo { + boolean csgIndication; + String homeNodebName; + int csgIdentity; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/Domain.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/Domain.aidl new file mode 100644 index 0000000000..2daeadd7fd --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/Domain.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum Domain { + CS = (1 << 0) /* 1 */, + PS = (1 << 1) /* 2 */, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EmergencyMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EmergencyMode.aidl new file mode 100644 index 0000000000..071e6b5012 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EmergencyMode.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum EmergencyMode { + EMERGENCY_WWAN = 1, + EMERGENCY_WLAN = 2, + EMERGENCY_CALLBACK = 3, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl new file mode 100644 index 0000000000..2797affc01 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EmergencyNetworkScanTrigger.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable EmergencyNetworkScanTrigger { + android.hardware.radio.AccessNetwork[] accessNetwork; + android.hardware.radio.network.EmergencyScanType scanType; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EmergencyRegResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EmergencyRegResult.aidl new file mode 100644 index 0000000000..7d99a53c7b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EmergencyRegResult.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable EmergencyRegResult { + android.hardware.radio.AccessNetwork accessNetwork; + android.hardware.radio.network.RegState regState; + android.hardware.radio.network.Domain emcDomain; + boolean isVopsSupported; + boolean isEmcBearerSupported; + byte nwProvidedEmc; + byte nwProvidedEmf; + String mcc = ""; + String mnc = ""; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EmergencyScanType.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EmergencyScanType.aidl new file mode 100644 index 0000000000..5e86c76a43 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EmergencyScanType.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum EmergencyScanType { + NO_PREFERENCE = 0, + LIMITED_SERVICE = 1, + FULL_SERVICE = 2, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EutranBands.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EutranBands.aidl new file mode 100644 index 0000000000..57fac3f5d7 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EutranBands.aidl @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum EutranBands { + BAND_1 = 1, + BAND_2 = 2, + BAND_3 = 3, + BAND_4 = 4, + BAND_5 = 5, + BAND_6 = 6, + BAND_7 = 7, + BAND_8 = 8, + BAND_9 = 9, + BAND_10 = 10, + BAND_11 = 11, + BAND_12 = 12, + BAND_13 = 13, + BAND_14 = 14, + BAND_17 = 17, + BAND_18 = 18, + BAND_19 = 19, + BAND_20 = 20, + BAND_21 = 21, + BAND_22 = 22, + BAND_23 = 23, + BAND_24 = 24, + BAND_25 = 25, + BAND_26 = 26, + BAND_27 = 27, + BAND_28 = 28, + BAND_30 = 30, + BAND_31 = 31, + BAND_33 = 33, + BAND_34 = 34, + BAND_35 = 35, + BAND_36 = 36, + BAND_37 = 37, + BAND_38 = 38, + BAND_39 = 39, + BAND_40 = 40, + BAND_41 = 41, + BAND_42 = 42, + BAND_43 = 43, + BAND_44 = 44, + BAND_45 = 45, + BAND_46 = 46, + BAND_47 = 47, + BAND_48 = 48, + BAND_65 = 65, + BAND_66 = 66, + BAND_68 = 68, + BAND_70 = 70, + BAND_49 = 49, + BAND_50 = 50, + BAND_51 = 51, + BAND_52 = 52, + BAND_53 = 53, + BAND_71 = 71, + BAND_72 = 72, + BAND_73 = 73, + BAND_74 = 74, + BAND_85 = 85, + BAND_87 = 87, + BAND_88 = 88, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EutranRegistrationInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EutranRegistrationInfo.aidl new file mode 100644 index 0000000000..2321cac467 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EutranRegistrationInfo.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable EutranRegistrationInfo { + android.hardware.radio.network.LteVopsInfo lteVopsInfo; + android.hardware.radio.network.NrIndicators nrIndicators; + android.hardware.radio.network.EutranRegistrationInfo.AttachResultType lteAttachResultType; + int extraInfo; + const int EXTRA_CSFB_NOT_PREFERRED = (1 << 0) /* 1 */; + const int EXTRA_SMS_ONLY = (1 << 1) /* 2 */; + enum AttachResultType { + NONE, + EPS_ONLY, + COMBINED, + } +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EvdoSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EvdoSignalStrength.aidl new file mode 100644 index 0000000000..7c567119f8 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/EvdoSignalStrength.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable EvdoSignalStrength { + int dbm; + int ecio; + int signalNoiseRatio; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/GeranBands.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/GeranBands.aidl new file mode 100644 index 0000000000..135935ff8f --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/GeranBands.aidl @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum GeranBands { + BAND_T380 = 1, + BAND_T410 = 2, + BAND_450 = 3, + BAND_480 = 4, + BAND_710 = 5, + BAND_750 = 6, + BAND_T810 = 7, + BAND_850 = 8, + BAND_P900 = 9, + BAND_E900 = 10, + BAND_R900 = 11, + BAND_DCS1800 = 12, + BAND_PCS1900 = 13, + BAND_ER900 = 14, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/GsmSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/GsmSignalStrength.aidl new file mode 100644 index 0000000000..2b53b39317 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/GsmSignalStrength.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable GsmSignalStrength { + int signalStrength; + int bitErrorRate; + int timingAdvance; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/IRadioNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/IRadioNetwork.aidl new file mode 100644 index 0000000000..382ddd846c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/IRadioNetwork.aidl @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@VintfStability +interface IRadioNetwork { + oneway void getAllowedNetworkTypesBitmap(in int serial); + oneway void getAvailableBandModes(in int serial); + oneway void getAvailableNetworks(in int serial); + oneway void getBarringInfo(in int serial); + oneway void getCdmaRoamingPreference(in int serial); + oneway void getCellInfoList(in int serial); + oneway void getDataRegistrationState(in int serial); + /** + * @deprecated Deprecated starting from Android U. + */ + oneway void getImsRegistrationState(in int serial); + oneway void getNetworkSelectionMode(in int serial); + oneway void getOperator(in int serial); + oneway void getSignalStrength(in int serial); + oneway void getSystemSelectionChannels(in int serial); + oneway void getVoiceRadioTechnology(in int serial); + oneway void getVoiceRegistrationState(in int serial); + oneway void isNrDualConnectivityEnabled(in int serial); + oneway void responseAcknowledgement(); + oneway void setAllowedNetworkTypesBitmap(in int serial, in int networkTypeBitmap); + oneway void setBandMode(in int serial, in android.hardware.radio.network.RadioBandMode mode); + oneway void setBarringPassword(in int serial, in String facility, in String oldPassword, in String newPassword); + oneway void setCdmaRoamingPreference(in int serial, in android.hardware.radio.network.CdmaRoamingType type); + oneway void setCellInfoListRate(in int serial, in int rate); + oneway void setIndicationFilter(in int serial, in int indicationFilter); + oneway void setLinkCapacityReportingCriteria(in int serial, in int hysteresisMs, in int hysteresisDlKbps, in int hysteresisUlKbps, in int[] thresholdsDownlinkKbps, in int[] thresholdsUplinkKbps, in android.hardware.radio.AccessNetwork accessNetwork); + oneway void setLocationUpdates(in int serial, in boolean enable); + oneway void setNetworkSelectionModeAutomatic(in int serial); + oneway void setNetworkSelectionModeManual(in int serial, in String operatorNumeric, in android.hardware.radio.AccessNetwork ran); + oneway void setNrDualConnectivityState(in int serial, in android.hardware.radio.network.NrDualConnectivityState nrDualConnectivityState); + oneway void setResponseFunctions(in android.hardware.radio.network.IRadioNetworkResponse radioNetworkResponse, in android.hardware.radio.network.IRadioNetworkIndication radioNetworkIndication); + oneway void setSignalStrengthReportingCriteria(in int serial, in android.hardware.radio.network.SignalThresholdInfo[] signalThresholdInfos); + oneway void setSuppServiceNotifications(in int serial, in boolean enable); + oneway void setSystemSelectionChannels(in int serial, in boolean specifyChannels, in android.hardware.radio.network.RadioAccessSpecifier[] specifiers); + oneway void startNetworkScan(in int serial, in android.hardware.radio.network.NetworkScanRequest request); + oneway void stopNetworkScan(in int serial); + oneway void supplyNetworkDepersonalization(in int serial, in String netPin); + oneway void setUsageSetting(in int serial, in android.hardware.radio.network.UsageSetting usageSetting); + oneway void getUsageSetting(in int serial); + oneway void setEmergencyMode(int serial, in android.hardware.radio.network.EmergencyMode emcModeType); + oneway void triggerEmergencyNetworkScan(int serial, in android.hardware.radio.network.EmergencyNetworkScanTrigger request); + oneway void cancelEmergencyNetworkScan(int serial, boolean resetScan); + oneway void exitEmergencyMode(in int serial); + oneway void setNullCipherAndIntegrityEnabled(in int serial, in boolean enabled); + oneway void isNullCipherAndIntegrityEnabled(in int serial); + oneway void isN1ModeEnabled(in int serial); + oneway void setN1ModeEnabled(in int serial, boolean enable); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/IRadioNetworkIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/IRadioNetworkIndication.aidl new file mode 100644 index 0000000000..0f017ea8ba --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/IRadioNetworkIndication.aidl @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@VintfStability +interface IRadioNetworkIndication { + oneway void barringInfoChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.CellIdentity cellIdentity, in android.hardware.radio.network.BarringInfo[] barringInfos); + oneway void cdmaPrlChanged(in android.hardware.radio.RadioIndicationType type, in int version); + oneway void cellInfoList(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.CellInfo[] records); + oneway void currentLinkCapacityEstimate(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.LinkCapacityEstimate lce); + oneway void currentPhysicalChannelConfigs(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.PhysicalChannelConfig[] configs); + oneway void currentSignalStrength(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.SignalStrength signalStrength); + oneway void imsNetworkStateChanged(in android.hardware.radio.RadioIndicationType type); + oneway void networkScanResult(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.NetworkScanResult result); + oneway void networkStateChanged(in android.hardware.radio.RadioIndicationType type); + oneway void nitzTimeReceived(in android.hardware.radio.RadioIndicationType type, in String nitzTime, in long receivedTimeMs, in long ageMs); + oneway void registrationFailed(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.CellIdentity cellIdentity, in String chosenPlmn, in int domain, in int causeCode, in int additionalCauseCode); + oneway void restrictedStateChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.PhoneRestrictedState state); + oneway void suppSvcNotify(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.SuppSvcNotification suppSvc); + oneway void voiceRadioTechChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.RadioTechnology rat); + oneway void emergencyNetworkScanResult(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.network.EmergencyRegResult result); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/IRadioNetworkResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/IRadioNetworkResponse.aidl new file mode 100644 index 0000000000..bfe8fa3f67 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/IRadioNetworkResponse.aidl @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@VintfStability +interface IRadioNetworkResponse { + oneway void acknowledgeRequest(in int serial); + oneway void getAllowedNetworkTypesBitmapResponse(in android.hardware.radio.RadioResponseInfo info, in int networkTypeBitmap); + oneway void getAvailableBandModesResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.RadioBandMode[] bandModes); + oneway void getAvailableNetworksResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.OperatorInfo[] networkInfos); + oneway void getBarringInfoResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.CellIdentity cellIdentity, in android.hardware.radio.network.BarringInfo[] barringInfos); + oneway void getCdmaRoamingPreferenceResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.CdmaRoamingType type); + oneway void getCellInfoListResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.CellInfo[] cellInfo); + oneway void getDataRegistrationStateResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.RegStateResult dataRegResponse); + /** + * @deprecated Deprecated starting from Android U. + */ + oneway void getImsRegistrationStateResponse(in android.hardware.radio.RadioResponseInfo info, in boolean isRegistered, in android.hardware.radio.RadioTechnologyFamily ratFamily); + oneway void getNetworkSelectionModeResponse(in android.hardware.radio.RadioResponseInfo info, in boolean manual); + oneway void getOperatorResponse(in android.hardware.radio.RadioResponseInfo info, in String longName, in String shortName, in String numeric); + oneway void getSignalStrengthResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.SignalStrength signalStrength); + oneway void getSystemSelectionChannelsResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.RadioAccessSpecifier[] specifiers); + oneway void getVoiceRadioTechnologyResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.RadioTechnology rat); + oneway void getVoiceRegistrationStateResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.RegStateResult voiceRegResponse); + oneway void isNrDualConnectivityEnabledResponse(in android.hardware.radio.RadioResponseInfo info, in boolean isEnabled); + oneway void setAllowedNetworkTypesBitmapResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setBandModeResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setBarringPasswordResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setCdmaRoamingPreferenceResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setCellInfoListRateResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setIndicationFilterResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setLinkCapacityReportingCriteriaResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setLocationUpdatesResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setNetworkSelectionModeAutomaticResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setNetworkSelectionModeManualResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setNrDualConnectivityStateResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setSignalStrengthReportingCriteriaResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setSuppServiceNotificationsResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setSystemSelectionChannelsResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void startNetworkScanResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void stopNetworkScanResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void supplyNetworkDepersonalizationResponse(in android.hardware.radio.RadioResponseInfo info, in int remainingRetries); + oneway void setUsageSettingResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void getUsageSettingResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.UsageSetting usageSetting); + oneway void setEmergencyModeResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.network.EmergencyRegResult regState); + oneway void triggerEmergencyNetworkScanResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void exitEmergencyModeResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void cancelEmergencyNetworkScanResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setNullCipherAndIntegrityEnabledResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void isNullCipherAndIntegrityEnabledResponse(in android.hardware.radio.RadioResponseInfo info, in boolean isEnabled); + oneway void isN1ModeEnabledResponse(in android.hardware.radio.RadioResponseInfo info, boolean isEnabled); + oneway void setN1ModeEnabledResponse(in android.hardware.radio.RadioResponseInfo info); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/IndicationFilter.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/IndicationFilter.aidl new file mode 100644 index 0000000000..cd538c86ef --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/IndicationFilter.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum IndicationFilter { + NONE = 0, + ALL = (~0) /* -1 */, + SIGNAL_STRENGTH = (1 << 0) /* 1 */, + FULL_NETWORK_STATE = (1 << 1) /* 2 */, + DATA_CALL_DORMANCY_CHANGED = (1 << 2) /* 4 */, + LINK_CAPACITY_ESTIMATE = (1 << 3) /* 8 */, + PHYSICAL_CHANNEL_CONFIG = (1 << 4) /* 16 */, + REGISTRATION_FAILURE = (1 << 5) /* 32 */, + BARRING_INFO = (1 << 6) /* 64 */, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/LceDataInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/LceDataInfo.aidl new file mode 100644 index 0000000000..27b16c11fb --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/LceDataInfo.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable LceDataInfo { + int lastHopCapacityKbps; + byte confidenceLevel; + boolean lceSuspended; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/LinkCapacityEstimate.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/LinkCapacityEstimate.aidl new file mode 100644 index 0000000000..5707b8e990 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/LinkCapacityEstimate.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable LinkCapacityEstimate { + int downlinkCapacityKbps; + int uplinkCapacityKbps; + int secondaryDownlinkCapacityKbps; + int secondaryUplinkCapacityKbps; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/LteSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/LteSignalStrength.aidl new file mode 100644 index 0000000000..b5b8579305 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/LteSignalStrength.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable LteSignalStrength { + int signalStrength; + int rsrp; + int rsrq; + int rssnr; + int cqi; + int timingAdvance; + int cqiTableIndex; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/LteVopsInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/LteVopsInfo.aidl new file mode 100644 index 0000000000..6d8dd4e83a --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/LteVopsInfo.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable LteVopsInfo { + boolean isVopsSupported; + boolean isEmcBearerSupported; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NetworkScanRequest.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NetworkScanRequest.aidl new file mode 100644 index 0000000000..6039740167 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NetworkScanRequest.aidl @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable NetworkScanRequest { + int type; + int interval; + android.hardware.radio.network.RadioAccessSpecifier[] specifiers; + int maxSearchTime; + boolean incrementalResults; + int incrementalResultsPeriodicity; + String[] mccMncs; + const int RADIO_ACCESS_SPECIFIER_MAX_SIZE = 8; + const int INCREMENTAL_RESULTS_PREIODICITY_RANGE_MIN = 1; + const int INCREMENTAL_RESULTS_PREIODICITY_RANGE_MAX = 10; + const int MAX_SEARCH_TIME_RANGE_MIN = 60; + const int MAX_SEARCH_TIME_RANGE_MAX = 3600; + const int SCAN_INTERVAL_RANGE_MIN = 5; + const int SCAN_INTERVAL_RANGE_MAX = 300; + const int SCAN_TYPE_ONE_SHOT = 0; + const int SCAN_TYPE_PERIODIC = 1; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NetworkScanResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NetworkScanResult.aidl new file mode 100644 index 0000000000..4e392d0c5c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NetworkScanResult.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable NetworkScanResult { + int status; + android.hardware.radio.RadioError error; + android.hardware.radio.network.CellInfo[] networkInfos; + const int SCAN_STATUS_PARTIAL = 1; + const int SCAN_STATUS_COMPLETE = 2; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NgranBands.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NgranBands.aidl new file mode 100644 index 0000000000..590469076a --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NgranBands.aidl @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum NgranBands { + BAND_1 = 1, + BAND_2 = 2, + BAND_3 = 3, + BAND_5 = 5, + BAND_7 = 7, + BAND_8 = 8, + BAND_12 = 12, + BAND_14 = 14, + BAND_18 = 18, + BAND_20 = 20, + BAND_25 = 25, + BAND_26 = 26, + BAND_28 = 28, + BAND_29 = 29, + BAND_30 = 30, + BAND_34 = 34, + BAND_38 = 38, + BAND_39 = 39, + BAND_40 = 40, + BAND_41 = 41, + BAND_46 = 46, + BAND_48 = 48, + BAND_50 = 50, + BAND_51 = 51, + BAND_53 = 53, + BAND_65 = 65, + BAND_66 = 66, + BAND_70 = 70, + BAND_71 = 71, + BAND_74 = 74, + BAND_75 = 75, + BAND_76 = 76, + BAND_77 = 77, + BAND_78 = 78, + BAND_79 = 79, + BAND_80 = 80, + BAND_81 = 81, + BAND_82 = 82, + BAND_83 = 83, + BAND_84 = 84, + BAND_86 = 86, + BAND_89 = 89, + BAND_90 = 90, + BAND_91 = 91, + BAND_92 = 92, + BAND_93 = 93, + BAND_94 = 94, + BAND_95 = 95, + BAND_96 = 96, + BAND_257 = 257, + BAND_258 = 258, + BAND_260 = 260, + BAND_261 = 261, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NrDualConnectivityState.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NrDualConnectivityState.aidl new file mode 100644 index 0000000000..62c2a56c8d --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NrDualConnectivityState.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@Backing(type="byte") @JavaDerive(toString=true) @VintfStability +enum NrDualConnectivityState { + ENABLE = 1, + DISABLE = 2, + DISABLE_IMMEDIATE = 3, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NrIndicators.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NrIndicators.aidl new file mode 100644 index 0000000000..88429f6f38 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NrIndicators.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable NrIndicators { + boolean isEndcAvailable; + boolean isDcNrRestricted; + boolean isNrAvailable; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NrSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NrSignalStrength.aidl new file mode 100644 index 0000000000..7d6ab8234a --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NrSignalStrength.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable NrSignalStrength { + int ssRsrp; + int ssRsrq; + int ssSinr; + int csiRsrp; + int csiRsrq; + int csiSinr; + int csiCqiTableIndex; + byte[] csiCqiReport; + int timingAdvance = 0x7FFFFFFF; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NrVopsInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NrVopsInfo.aidl new file mode 100644 index 0000000000..e5a0a700ca --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/NrVopsInfo.aidl @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable NrVopsInfo { + byte vopsSupported; + byte emcSupported; + byte emfSupported; + const byte EMC_INDICATOR_NOT_SUPPORTED = 0; + const byte EMC_INDICATOR_NR_CONNECTED_TO_5GCN = 1; + const byte EMC_INDICATOR_EUTRA_CONNECTED_TO_5GCN = 2; + const byte EMC_INDICATOR_BOTH_NR_EUTRA_CONNECTED_TO_5GCN = 3; + const byte EMF_INDICATOR_NOT_SUPPORTED = 0; + const byte EMF_INDICATOR_NR_CONNECTED_TO_5GCN = 1; + const byte EMF_INDICATOR_EUTRA_CONNECTED_TO_5GCN = 2; + const byte EMF_INDICATOR_BOTH_NR_EUTRA_CONNECTED_TO_5GCN = 3; + const byte VOPS_INDICATOR_VOPS_NOT_SUPPORTED = 0; + const byte VOPS_INDICATOR_VOPS_OVER_3GPP = 1; + const byte VOPS_INDICATOR_VOPS_OVER_NON_3GPP = 2; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/OperatorInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/OperatorInfo.aidl new file mode 100644 index 0000000000..034150e61f --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/OperatorInfo.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable OperatorInfo { + String alphaLong; + String alphaShort; + String operatorNumeric; + int status; + const int STATUS_UNKNOWN = 0; + const int STATUS_AVAILABLE = 1; + const int STATUS_CURRENT = 2; + const int STATUS_FORBIDDEN = 3; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/PhoneRestrictedState.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/PhoneRestrictedState.aidl new file mode 100644 index 0000000000..4e3e39eab0 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/PhoneRestrictedState.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum PhoneRestrictedState { + NONE = 0x00, + CS_EMERGENCY = 0x01, + CS_NORMAL = 0x02, + CS_ALL = 0x04, + PS_ALL = 0x10, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/PhysicalChannelConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/PhysicalChannelConfig.aidl new file mode 100644 index 0000000000..928c6b728c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/PhysicalChannelConfig.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable PhysicalChannelConfig { + android.hardware.radio.network.CellConnectionStatus status; + android.hardware.radio.RadioTechnology rat; + int downlinkChannelNumber; + int uplinkChannelNumber; + int cellBandwidthDownlinkKhz; + int cellBandwidthUplinkKhz; + int[] contextIds; + int physicalCellId; + android.hardware.radio.network.PhysicalChannelConfigBand band; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/PhysicalChannelConfigBand.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/PhysicalChannelConfigBand.aidl new file mode 100644 index 0000000000..efc64a6930 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/PhysicalChannelConfigBand.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +union PhysicalChannelConfigBand { + boolean noinit; + android.hardware.radio.network.GeranBands geranBand; + android.hardware.radio.network.UtranBands utranBand; + android.hardware.radio.network.EutranBands eutranBand; + android.hardware.radio.network.NgranBands ngranBand; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RadioAccessSpecifier.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RadioAccessSpecifier.aidl new file mode 100644 index 0000000000..1566bb5224 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RadioAccessSpecifier.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable RadioAccessSpecifier { + android.hardware.radio.AccessNetwork accessNetwork; + android.hardware.radio.network.RadioAccessSpecifierBands bands; + int[] channels; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RadioAccessSpecifierBands.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RadioAccessSpecifierBands.aidl new file mode 100644 index 0000000000..a6ac12a28a --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RadioAccessSpecifierBands.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +union RadioAccessSpecifierBands { + boolean noinit; + android.hardware.radio.network.GeranBands[] geranBands; + android.hardware.radio.network.UtranBands[] utranBands; + android.hardware.radio.network.EutranBands[] eutranBands; + android.hardware.radio.network.NgranBands[] ngranBands; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RadioBandMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RadioBandMode.aidl new file mode 100644 index 0000000000..74696fbfbf --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RadioBandMode.aidl @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum RadioBandMode { + BAND_MODE_UNSPECIFIED, + BAND_MODE_EURO, + BAND_MODE_USA, + BAND_MODE_JPN, + BAND_MODE_AUS, + BAND_MODE_AUS_2, + BAND_MODE_CELL_800, + BAND_MODE_PCS, + BAND_MODE_JTACS, + BAND_MODE_KOREA_PCS, + BAND_MODE_5_450M, + BAND_MODE_IMT2000, + BAND_MODE_7_700M_2, + BAND_MODE_8_1800M, + BAND_MODE_9_900M, + BAND_MODE_10_800M_2, + BAND_MODE_EURO_PAMR_400M, + BAND_MODE_AWS, + BAND_MODE_USA_2500M, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RegState.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RegState.aidl new file mode 100644 index 0000000000..711c9ac3a6 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RegState.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum RegState { + NOT_REG_MT_NOT_SEARCHING_OP = 0, + REG_HOME = 1, + NOT_REG_MT_SEARCHING_OP = 2, + REG_DENIED = 3, + UNKNOWN = 4, + REG_ROAMING = 5, + NOT_REG_MT_NOT_SEARCHING_OP_EM = 10, + NOT_REG_MT_SEARCHING_OP_EM = 12, + REG_DENIED_EM = 13, + UNKNOWN_EM = 14, + REG_EM = 20, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RegStateResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RegStateResult.aidl new file mode 100644 index 0000000000..f0a03aea4f --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RegStateResult.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable RegStateResult { + android.hardware.radio.network.RegState regState; + android.hardware.radio.RadioTechnology rat; + android.hardware.radio.network.RegistrationFailCause reasonForDenial; + android.hardware.radio.network.CellIdentity cellIdentity; + String registeredPlmn; + android.hardware.radio.network.AccessTechnologySpecificInfo accessTechnologySpecificInfo; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RegistrationFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RegistrationFailCause.aidl new file mode 100644 index 0000000000..8acf8ab22d --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/RegistrationFailCause.aidl @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum RegistrationFailCause { + NONE = 0, + IMSI_UNKNOWN_IN_HLR = 2, + ILLEGAL_MS = 3, + IMSI_UNKNOWN_IN_VLR = 4, + IMEI_NOT_ACCEPTED = 5, + ILLEGAL_ME = 6, + GPRS_SERVICES_NOT_ALLOWED = 7, + GPRS_AND_NON_GPRS_SERVICES_NOT_ALLOWED = 8, + MS_IDENTITY_CANNOT_BE_DERIVED_BY_NETWORK = 9, + IMPLICITLY_DETACHED = 10, + PLMN_NOT_ALLOWED = 11, + LOCATION_AREA_NOT_ALLOWED = 12, + ROAMING_NOT_ALLOWED = 13, + GPRS_SERVICES_NOT_ALLOWED_IN_PLMN = 14, + NO_SUITABLE_CELLS = 15, + MSC_TEMPORARILY_NOT_REACHABLE = 15, + NETWORK_FAILURE = 17, + MAC_FAILURE = 20, + SYNC_FAILURE = 21, + CONGESTION = 22, + GSM_AUTHENTICATION_UNACCEPTABLE = 23, + NOT_AUTHORIZED_FOR_THIS_CSG = 25, + SMS_PROVIDED_BY_GPRS_IN_ROUTING_AREA, + SERVICE_OPTION_NOT_SUPPORTED = 32, + SERVICE_OPTION_NOT_SUBSCRIBED = 33, + SERVICE_OPTION_TEMPORARILY_OUT_OF_ORDER = 34, + CALL_CANNOT_BE_IDENTIFIED = 38, + NO_PDP_CONTEXT_ACTIVATED = 40, + RETRY_UPON_ENTRY_INTO_NEW_CELL_1 = 48, + RETRY_UPON_ENTRY_INTO_NEW_CELL_2 = 49, + RETRY_UPON_ENTRY_INTO_NEW_CELL_3 = 50, + RETRY_UPON_ENTRY_INTO_NEW_CELL_4 = 51, + RETRY_UPON_ENTRY_INTO_NEW_CELL_5 = 52, + RETRY_UPON_ENTRY_INTO_NEW_CELL_6 = 53, + RETRY_UPON_ENTRY_INTO_NEW_CELL_7 = 54, + RETRY_UPON_ENTRY_INTO_NEW_CELL_8 = 55, + RETRY_UPON_ENTRY_INTO_NEW_CELL_9 = 56, + RETRY_UPON_ENTRY_INTO_NEW_CELL_10 = 57, + RETRY_UPON_ENTRY_INTO_NEW_CELL_11 = 58, + RETRY_UPON_ENTRY_INTO_NEW_CELL_12 = 59, + RETRY_UPON_ENTRY_INTO_NEW_CELL_13 = 60, + RETRY_UPON_ENTRY_INTO_NEW_CELL_14 = 61, + RETRY_UPON_ENTRY_INTO_NEW_CELL_15 = 62, + RETRY_UPON_ENTRY_INTO_NEW_CELL_16 = 63, + SEMANTICALLY_INCORRECT_MESSAGE = 95, + INVALID_MANDATORY_INFORMATION = 96, + MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED = 97, + MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 98, + INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED = 99, + CONDITIONAL_IE_ERROR = 100, + MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 101, + PROTOCOL_ERROR_UNSPECIFIED = 111, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/SignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/SignalStrength.aidl new file mode 100644 index 0000000000..1c50190947 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/SignalStrength.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable SignalStrength { + android.hardware.radio.network.GsmSignalStrength gsm; + android.hardware.radio.network.CdmaSignalStrength cdma; + android.hardware.radio.network.EvdoSignalStrength evdo; + android.hardware.radio.network.LteSignalStrength lte; + android.hardware.radio.network.TdscdmaSignalStrength tdscdma; + android.hardware.radio.network.WcdmaSignalStrength wcdma; + android.hardware.radio.network.NrSignalStrength nr; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/SignalThresholdInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/SignalThresholdInfo.aidl new file mode 100644 index 0000000000..744eed7ec5 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/SignalThresholdInfo.aidl @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable SignalThresholdInfo { + int signalMeasurement; + int hysteresisMs; + int hysteresisDb; + int[] thresholds; + boolean isEnabled; + android.hardware.radio.AccessNetwork ran; + const int SIGNAL_MEASUREMENT_TYPE_RSSI = 1; + const int SIGNAL_MEASUREMENT_TYPE_RSCP = 2; + const int SIGNAL_MEASUREMENT_TYPE_RSRP = 3; + const int SIGNAL_MEASUREMENT_TYPE_RSRQ = 4; + const int SIGNAL_MEASUREMENT_TYPE_RSSNR = 5; + const int SIGNAL_MEASUREMENT_TYPE_SSRSRP = 6; + const int SIGNAL_MEASUREMENT_TYPE_SSRSRQ = 7; + const int SIGNAL_MEASUREMENT_TYPE_SSSINR = 8; + const int SIGNAL_MEASUREMENT_TYPE_ECNO = 9; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/SuppSvcNotification.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/SuppSvcNotification.aidl new file mode 100644 index 0000000000..b62c71bd37 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/SuppSvcNotification.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable SuppSvcNotification { + boolean isMT; + int code; + int index; + int type; + String number; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/TdscdmaSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/TdscdmaSignalStrength.aidl new file mode 100644 index 0000000000..d74c950bde --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/TdscdmaSignalStrength.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable TdscdmaSignalStrength { + int signalStrength; + int bitErrorRate; + int rscp; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/UsageSetting.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/UsageSetting.aidl new file mode 100644 index 0000000000..3ca16b5eaa --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/UsageSetting.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum UsageSetting { + VOICE_CENTRIC = 1, + DATA_CENTRIC = 2, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/UtranBands.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/UtranBands.aidl new file mode 100644 index 0000000000..8be3da28f3 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/UtranBands.aidl @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum UtranBands { + BAND_1 = 1, + BAND_2 = 2, + BAND_3 = 3, + BAND_4 = 4, + BAND_5 = 5, + BAND_6 = 6, + BAND_7 = 7, + BAND_8 = 8, + BAND_9 = 9, + BAND_10 = 10, + BAND_11 = 11, + BAND_12 = 12, + BAND_13 = 13, + BAND_14 = 14, + BAND_19 = 19, + BAND_20 = 20, + BAND_21 = 21, + BAND_22 = 22, + BAND_25 = 25, + BAND_26 = 26, + BAND_A = 101, + BAND_B = 102, + BAND_C = 103, + BAND_D = 104, + BAND_E = 105, + BAND_F = 106, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/WcdmaSignalStrength.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/WcdmaSignalStrength.aidl new file mode 100644 index 0000000000..91125271d2 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.network/2/android/hardware/radio/network/WcdmaSignalStrength.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.network; +@JavaDerive(toString=true) @VintfStability +parcelable WcdmaSignalStrength { + int signalStrength; + int bitErrorRate; + int rscp; + int ecno; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sap/1/.hash b/radio/aidl/aidl_api/android.hardware.radio.sap/1/.hash new file mode 100644 index 0000000000..876503fb1c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sap/1/.hash @@ -0,0 +1 @@ +dacee485b56bd1e1e5b5bcdedbd20e71ac24444b diff --git a/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/ISap.aidl b/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/ISap.aidl new file mode 100644 index 0000000000..37391e9804 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/ISap.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.sap; +@VintfStability +interface ISap { + oneway void apduReq(in int serial, in android.hardware.radio.sap.SapApduType type, in byte[] command); + oneway void connectReq(in int serial, in int maxMsgSizeBytes); + oneway void disconnectReq(in int serial); + oneway void powerReq(in int serial, in boolean powerOn); + oneway void resetSimReq(in int serial); + oneway void setCallback(in android.hardware.radio.sap.ISapCallback sapCallback); + oneway void setTransferProtocolReq(in int serial, in android.hardware.radio.sap.SapTransferProtocol transferProtocol); + oneway void transferAtrReq(in int serial); + oneway void transferCardReaderStatusReq(in int serial); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/ISapCallback.aidl b/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/ISapCallback.aidl new file mode 100644 index 0000000000..d507709a6d --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/ISapCallback.aidl @@ -0,0 +1,48 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.sap; +@VintfStability +interface ISapCallback { + oneway void apduResponse(in int serial, in android.hardware.radio.sap.SapResultCode resultCode, in byte[] apduRsp); + oneway void connectResponse(in int serial, in android.hardware.radio.sap.SapConnectRsp sapConnectRsp, in int maxMsgSizeBytes); + oneway void disconnectIndication(in int serial, in android.hardware.radio.sap.SapDisconnectType disconnectType); + oneway void disconnectResponse(in int serial); + oneway void errorResponse(in int serial); + oneway void powerResponse(in int serial, in android.hardware.radio.sap.SapResultCode resultCode); + oneway void resetSimResponse(in int serial, in android.hardware.radio.sap.SapResultCode resultCode); + oneway void statusIndication(in int serial, in android.hardware.radio.sap.SapStatus status); + oneway void transferAtrResponse(in int serial, in android.hardware.radio.sap.SapResultCode resultCode, in byte[] atr); + oneway void transferCardReaderStatusResponse(in int serial, in android.hardware.radio.sap.SapResultCode resultCode, in int cardReaderStatus); + oneway void transferProtocolResponse(in int serial, in android.hardware.radio.sap.SapResultCode resultCode); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapApduType.aidl b/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapApduType.aidl new file mode 100644 index 0000000000..6cef92bdf1 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapApduType.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.sap; +@Backing(type="int") @VintfStability +enum SapApduType { + APDU, + APDU7816, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapConnectRsp.aidl b/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapConnectRsp.aidl new file mode 100644 index 0000000000..841dfe3e8c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapConnectRsp.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.sap; +@Backing(type="int") @VintfStability +enum SapConnectRsp { + SUCCESS, + CONNECT_FAILURE, + MSG_SIZE_TOO_LARGE, + MSG_SIZE_TOO_SMALL, + CONNECT_OK_CALL_ONGOING, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapDisconnectType.aidl b/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapDisconnectType.aidl new file mode 100644 index 0000000000..dace1e1ace --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapDisconnectType.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.sap; +@Backing(type="int") @VintfStability +enum SapDisconnectType { + GRACEFUL, + IMMEDIATE, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapResultCode.aidl b/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapResultCode.aidl new file mode 100644 index 0000000000..a2a6df0a05 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapResultCode.aidl @@ -0,0 +1,45 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.sap; +@Backing(type="int") @VintfStability +enum SapResultCode { + SUCCESS, + GENERIC_FAILURE, + CARD_NOT_ACCESSSIBLE, + CARD_ALREADY_POWERED_OFF, + CARD_REMOVED, + CARD_ALREADY_POWERED_ON, + DATA_NOT_AVAILABLE, + NOT_SUPPORTED, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapStatus.aidl new file mode 100644 index 0000000000..6988c994c9 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapStatus.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.sap; +@Backing(type="int") @VintfStability +enum SapStatus { + UNKNOWN_ERROR, + CARD_RESET, + CARD_NOT_ACCESSIBLE, + CARD_REMOVED, + CARD_INSERTED, + RECOVERED, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapTransferProtocol.aidl b/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapTransferProtocol.aidl new file mode 100644 index 0000000000..3c6852eb22 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sap/1/android/hardware/radio/sap/SapTransferProtocol.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.radio.sap; +@Backing(type="int") @VintfStability +enum SapTransferProtocol { + T0, + T1, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/2/.hash b/radio/aidl/aidl_api/android.hardware.radio.sim/2/.hash new file mode 100644 index 0000000000..54ba274d43 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/2/.hash @@ -0,0 +1 @@ +4f348cc7aca716cc41c09ea95895c4b261231035 diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/AppStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/AppStatus.aidl new file mode 100644 index 0000000000..8a41fb9d90 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/AppStatus.aidl @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable AppStatus { + int appType; + int appState; + android.hardware.radio.sim.PersoSubstate persoSubstate; + String aidPtr; + String appLabelPtr; + boolean pin1Replaced; + android.hardware.radio.sim.PinState pin1; + android.hardware.radio.sim.PinState pin2; + const int APP_STATE_UNKNOWN = 0; + const int APP_STATE_DETECTED = 1; + const int APP_STATE_PIN = 2; + const int APP_STATE_PUK = 3; + const int APP_STATE_SUBSCRIPTION_PERSO = 4; + const int APP_STATE_READY = 5; + const int APP_TYPE_UNKNOWN = 0; + const int APP_TYPE_SIM = 1; + const int APP_TYPE_USIM = 2; + const int APP_TYPE_RUIM = 3; + const int APP_TYPE_CSIM = 4; + const int APP_TYPE_ISIM = 5; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/CardPowerState.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/CardPowerState.aidl new file mode 100644 index 0000000000..6bc3919fb2 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/CardPowerState.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.sim; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum CardPowerState { + POWER_DOWN, + POWER_UP, + POWER_UP_PASS_THROUGH, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/CardStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/CardStatus.aidl new file mode 100644 index 0000000000..46cb7becb2 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/CardStatus.aidl @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable CardStatus { + int cardState; + android.hardware.radio.sim.PinState universalPinState; + int gsmUmtsSubscriptionAppIndex; + int cdmaSubscriptionAppIndex; + int imsSubscriptionAppIndex; + android.hardware.radio.sim.AppStatus[] applications; + String atr; + String iccid; + String eid; + android.hardware.radio.config.SlotPortMapping slotMap; + android.hardware.radio.config.MultipleEnabledProfilesMode supportedMepMode = android.hardware.radio.config.MultipleEnabledProfilesMode.NONE; + const int STATE_ABSENT = 0; + const int STATE_PRESENT = 1; + const int STATE_ERROR = 2; + const int STATE_RESTRICTED = 3; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/Carrier.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/Carrier.aidl new file mode 100644 index 0000000000..cc56888f31 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/Carrier.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable Carrier { + String mcc; + String mnc; + int matchType; + String matchData; + const int MATCH_TYPE_ALL = 0; + const int MATCH_TYPE_SPN = 1; + const int MATCH_TYPE_IMSI_PREFIX = 2; + const int MATCH_TYPE_GID1 = 3; + const int MATCH_TYPE_GID2 = 4; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/CarrierRestrictions.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/CarrierRestrictions.aidl new file mode 100644 index 0000000000..3700de3143 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/CarrierRestrictions.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable CarrierRestrictions { + android.hardware.radio.sim.Carrier[] allowedCarriers; + android.hardware.radio.sim.Carrier[] excludedCarriers; + boolean allowedCarriersPrioritized; + android.hardware.radio.sim.CarrierRestrictions.CarrierRestrictionStatus status; + @Backing(type="int") @VintfStability + enum CarrierRestrictionStatus { + UNKNOWN = 0, + NOT_RESTRICTED = 1, + RESTRICTED = 2, + } +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/CdmaSubscriptionSource.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/CdmaSubscriptionSource.aidl new file mode 100644 index 0000000000..080aa5ed27 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/CdmaSubscriptionSource.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.sim; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum CdmaSubscriptionSource { + RUIM_SIM, + NV, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/IRadioSim.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/IRadioSim.aidl new file mode 100644 index 0000000000..901b2519f6 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/IRadioSim.aidl @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.sim; +@VintfStability +interface IRadioSim { + oneway void areUiccApplicationsEnabled(in int serial); + oneway void changeIccPin2ForApp(in int serial, in String oldPin2, in String newPin2, in String aid); + oneway void changeIccPinForApp(in int serial, in String oldPin, in String newPin, in String aid); + oneway void enableUiccApplications(in int serial, in boolean enable); + oneway void getAllowedCarriers(in int serial); + oneway void getCdmaSubscription(in int serial); + oneway void getCdmaSubscriptionSource(in int serial); + oneway void getFacilityLockForApp(in int serial, in String facility, in String password, in int serviceClass, in String appId); + oneway void getIccCardStatus(in int serial); + oneway void getImsiForApp(in int serial, in String aid); + oneway void getSimPhonebookCapacity(in int serial); + oneway void getSimPhonebookRecords(in int serial); + /** + * @deprecated use iccCloseLogicalChannelWithSessionInfo instead. + */ + oneway void iccCloseLogicalChannel(in int serial, in int channelId); + oneway void iccIoForApp(in int serial, in android.hardware.radio.sim.IccIo iccIo); + oneway void iccOpenLogicalChannel(in int serial, in String aid, in int p2); + oneway void iccTransmitApduBasicChannel(in int serial, in android.hardware.radio.sim.SimApdu message); + oneway void iccTransmitApduLogicalChannel(in int serial, in android.hardware.radio.sim.SimApdu message); + oneway void reportStkServiceIsRunning(in int serial); + oneway void requestIccSimAuthentication(in int serial, in int authContext, in String authData, in String aid); + oneway void responseAcknowledgement(); + oneway void sendEnvelope(in int serial, in String contents); + oneway void sendEnvelopeWithStatus(in int serial, in String contents); + oneway void sendTerminalResponseToSim(in int serial, in String contents); + oneway void setAllowedCarriers(in int serial, in android.hardware.radio.sim.CarrierRestrictions carriers, in android.hardware.radio.sim.SimLockMultiSimPolicy multiSimPolicy); + oneway void setCarrierInfoForImsiEncryption(in int serial, in android.hardware.radio.sim.ImsiEncryptionInfo imsiEncryptionInfo); + oneway void setCdmaSubscriptionSource(in int serial, in android.hardware.radio.sim.CdmaSubscriptionSource cdmaSub); + oneway void setFacilityLockForApp(in int serial, in String facility, in boolean lockState, in String password, in int serviceClass, in String appId); + oneway void setResponseFunctions(in android.hardware.radio.sim.IRadioSimResponse radioSimResponse, in android.hardware.radio.sim.IRadioSimIndication radioSimIndication); + oneway void setSimCardPower(in int serial, in android.hardware.radio.sim.CardPowerState powerUp); + oneway void setUiccSubscription(in int serial, in android.hardware.radio.sim.SelectUiccSub uiccSub); + oneway void supplyIccPin2ForApp(in int serial, in String pin2, in String aid); + oneway void supplyIccPinForApp(in int serial, in String pin, in String aid); + oneway void supplyIccPuk2ForApp(in int serial, in String puk2, in String pin2, in String aid); + oneway void supplyIccPukForApp(in int serial, in String puk, in String pin, in String aid); + oneway void supplySimDepersonalization(in int serial, in android.hardware.radio.sim.PersoSubstate persoType, in String controlKey); + oneway void updateSimPhonebookRecords(in int serial, in android.hardware.radio.sim.PhonebookRecordInfo recordInfo); + oneway void iccCloseLogicalChannelWithSessionInfo(in int serial, in android.hardware.radio.sim.SessionInfo sessionInfo); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/IRadioSimIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/IRadioSimIndication.aidl new file mode 100644 index 0000000000..d4371b8e69 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/IRadioSimIndication.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.sim; +@VintfStability +interface IRadioSimIndication { + oneway void carrierInfoForImsiEncryption(in android.hardware.radio.RadioIndicationType info); + oneway void cdmaSubscriptionSourceChanged(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.sim.CdmaSubscriptionSource cdmaSource); + oneway void simPhonebookChanged(in android.hardware.radio.RadioIndicationType type); + oneway void simPhonebookRecordsReceived(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.sim.PbReceivedStatus status, in android.hardware.radio.sim.PhonebookRecordInfo[] records); + oneway void simRefresh(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.sim.SimRefreshResult refreshResult); + oneway void simStatusChanged(in android.hardware.radio.RadioIndicationType type); + oneway void stkEventNotify(in android.hardware.radio.RadioIndicationType type, in String cmd); + oneway void stkProactiveCommand(in android.hardware.radio.RadioIndicationType type, in String cmd); + oneway void stkSessionEnd(in android.hardware.radio.RadioIndicationType type); + oneway void subscriptionStatusChanged(in android.hardware.radio.RadioIndicationType type, in boolean activate); + oneway void uiccApplicationsEnablementChanged(in android.hardware.radio.RadioIndicationType type, in boolean enabled); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/IRadioSimResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/IRadioSimResponse.aidl new file mode 100644 index 0000000000..d7c2100fd6 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/IRadioSimResponse.aidl @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.sim; +@VintfStability +interface IRadioSimResponse { + oneway void acknowledgeRequest(in int serial); + oneway void areUiccApplicationsEnabledResponse(in android.hardware.radio.RadioResponseInfo info, in boolean enabled); + oneway void changeIccPin2ForAppResponse(in android.hardware.radio.RadioResponseInfo info, in int remainingRetries); + oneway void changeIccPinForAppResponse(in android.hardware.radio.RadioResponseInfo info, in int remainingRetries); + oneway void enableUiccApplicationsResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void getAllowedCarriersResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.CarrierRestrictions carriers, in android.hardware.radio.sim.SimLockMultiSimPolicy multiSimPolicy); + oneway void getCdmaSubscriptionResponse(in android.hardware.radio.RadioResponseInfo info, in String mdn, in String hSid, in String hNid, in String min, in String prl); + oneway void getCdmaSubscriptionSourceResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.CdmaSubscriptionSource source); + oneway void getFacilityLockForAppResponse(in android.hardware.radio.RadioResponseInfo info, in int response); + oneway void getIccCardStatusResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.CardStatus cardStatus); + oneway void getImsiForAppResponse(in android.hardware.radio.RadioResponseInfo info, in String imsi); + oneway void getSimPhonebookCapacityResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.PhonebookCapacity capacity); + oneway void getSimPhonebookRecordsResponse(in android.hardware.radio.RadioResponseInfo info); + /** + * @deprecated use iccCloseLogicalChannelWithSessionInfoResponse instead. + */ + oneway void iccCloseLogicalChannelResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void iccIoForAppResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.IccIoResult iccIo); + oneway void iccOpenLogicalChannelResponse(in android.hardware.radio.RadioResponseInfo info, in int channelId, in byte[] selectResponse); + oneway void iccTransmitApduBasicChannelResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.IccIoResult result); + oneway void iccTransmitApduLogicalChannelResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.IccIoResult result); + oneway void reportStkServiceIsRunningResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void requestIccSimAuthenticationResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.IccIoResult result); + oneway void sendEnvelopeResponse(in android.hardware.radio.RadioResponseInfo info, in String commandResponse); + oneway void sendEnvelopeWithStatusResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.IccIoResult iccIo); + oneway void sendTerminalResponseToSimResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setAllowedCarriersResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setCarrierInfoForImsiEncryptionResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setCdmaSubscriptionSourceResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setFacilityLockForAppResponse(in android.hardware.radio.RadioResponseInfo info, in int retry); + oneway void setSimCardPowerResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setUiccSubscriptionResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void supplyIccPin2ForAppResponse(in android.hardware.radio.RadioResponseInfo info, in int remainingRetries); + oneway void supplyIccPinForAppResponse(in android.hardware.radio.RadioResponseInfo info, in int remainingRetries); + oneway void supplyIccPuk2ForAppResponse(in android.hardware.radio.RadioResponseInfo info, in int remainingRetries); + oneway void supplyIccPukForAppResponse(in android.hardware.radio.RadioResponseInfo info, in int remainingRetries); + oneway void supplySimDepersonalizationResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.sim.PersoSubstate persoType, in int remainingRetries); + oneway void updateSimPhonebookRecordsResponse(in android.hardware.radio.RadioResponseInfo info, in int updatedRecordIndex); + oneway void iccCloseLogicalChannelWithSessionInfoResponse(in android.hardware.radio.RadioResponseInfo info); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/IccIo.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/IccIo.aidl new file mode 100644 index 0000000000..5a312dc4fd --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/IccIo.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable IccIo { + int command; + int fileId; + String path; + int p1; + int p2; + int p3; + String data; + String pin2; + String aid; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/IccIoResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/IccIoResult.aidl new file mode 100644 index 0000000000..6c6bde2012 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/IccIoResult.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable IccIoResult { + int sw1; + int sw2; + String simResponse; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/ImsiEncryptionInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/ImsiEncryptionInfo.aidl new file mode 100644 index 0000000000..05e71cd102 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/ImsiEncryptionInfo.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable ImsiEncryptionInfo { + String mcc; + String mnc; + byte[] carrierKey; + String keyIdentifier; + long expirationTime; + byte keyType; + const byte PUBLIC_KEY_TYPE_EPDG = 1; + const byte PUBLIC_KEY_TYPE_WLAN = 2; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/PbReceivedStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/PbReceivedStatus.aidl new file mode 100644 index 0000000000..5e96fc6f22 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/PbReceivedStatus.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.sim; +@Backing(type="byte") @JavaDerive(toString=true) @VintfStability +enum PbReceivedStatus { + PB_RECEIVED_OK = 1, + PB_RECEIVED_ERROR = 2, + PB_RECEIVED_ABORT = 3, + PB_RECEIVED_FINAL = 4, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/PersoSubstate.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/PersoSubstate.aidl new file mode 100644 index 0000000000..dc1d960631 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/PersoSubstate.aidl @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.sim; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum PersoSubstate { + UNKNOWN, + IN_PROGRESS, + READY, + SIM_NETWORK, + SIM_NETWORK_SUBSET, + SIM_CORPORATE, + SIM_SERVICE_PROVIDER, + SIM_SIM, + SIM_NETWORK_PUK, + SIM_NETWORK_SUBSET_PUK, + SIM_CORPORATE_PUK, + SIM_SERVICE_PROVIDER_PUK, + SIM_SIM_PUK, + RUIM_NETWORK1, + RUIM_NETWORK2, + RUIM_HRPD, + RUIM_CORPORATE, + RUIM_SERVICE_PROVIDER, + RUIM_RUIM, + RUIM_NETWORK1_PUK, + RUIM_NETWORK2_PUK, + RUIM_HRPD_PUK, + RUIM_CORPORATE_PUK, + RUIM_SERVICE_PROVIDER_PUK, + RUIM_RUIM_PUK, + SIM_SPN, + SIM_SPN_PUK, + SIM_SP_EHPLMN, + SIM_SP_EHPLMN_PUK, + SIM_ICCID, + SIM_ICCID_PUK, + SIM_IMPI, + SIM_IMPI_PUK, + SIM_NS_SP, + SIM_NS_SP_PUK, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/PhonebookCapacity.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/PhonebookCapacity.aidl new file mode 100644 index 0000000000..7531c9638a --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/PhonebookCapacity.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable PhonebookCapacity { + int maxAdnRecords; + int usedAdnRecords; + int maxEmailRecords; + int usedEmailRecords; + int maxAdditionalNumberRecords; + int usedAdditionalNumberRecords; + int maxNameLen; + int maxNumberLen; + int maxEmailLen; + int maxAdditionalNumberLen; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/PhonebookRecordInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/PhonebookRecordInfo.aidl new file mode 100644 index 0000000000..2e96a4bf54 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/PhonebookRecordInfo.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable PhonebookRecordInfo { + int recordId; + String name; + String number; + String[] emails; + String[] additionalNumbers; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/PinState.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/PinState.aidl new file mode 100644 index 0000000000..663ea734bf --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/PinState.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.sim; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum PinState { + UNKNOWN, + ENABLED_NOT_VERIFIED, + ENABLED_VERIFIED, + DISABLED, + ENABLED_BLOCKED, + ENABLED_PERM_BLOCKED, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/SelectUiccSub.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/SelectUiccSub.aidl new file mode 100644 index 0000000000..02121e632c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/SelectUiccSub.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable SelectUiccSub { + int slot; + int appIndex; + int subType; + int actStatus; + const int SUBSCRIPTION_TYPE_1 = 0; + const int SUBSCRIPTION_TYPE_2 = 1; + const int SUBSCRIPTION_TYPE_3 = 2; + const int ACT_STATUS_DEACTIVATE = 0; + const int ACT_STATUS_ACTIVATE = 1; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/SessionInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/SessionInfo.aidl new file mode 100644 index 0000000000..1329141f22 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/SessionInfo.aidl @@ -0,0 +1,39 @@ +/* + * 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 -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.hardware.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable SessionInfo { + int sessionId; + boolean isEs10 = false; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/SimApdu.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/SimApdu.aidl new file mode 100644 index 0000000000..c391e5af34 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/SimApdu.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable SimApdu { + int sessionId; + int cla; + int instruction; + int p1; + int p2; + int p3; + String data; + boolean isEs10 = false; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl new file mode 100644 index 0000000000..d59fcab886 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/SimLockMultiSimPolicy.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.sim; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum SimLockMultiSimPolicy { + NO_MULTISIM_POLICY, + ONE_VALID_SIM_MUST_BE_PRESENT, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/SimRefreshResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/SimRefreshResult.aidl new file mode 100644 index 0000000000..69bf4767d3 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.sim/2/android/hardware/radio/sim/SimRefreshResult.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.sim; +@JavaDerive(toString=true) @VintfStability +parcelable SimRefreshResult { + int type; + int efId; + String aid; + const int TYPE_SIM_FILE_UPDATE = 0; + const int TYPE_SIM_INIT = 1; + const int TYPE_SIM_RESET = 2; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/.hash b/radio/aidl/aidl_api/android.hardware.radio.voice/2/.hash new file mode 100644 index 0000000000..eef445d459 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/.hash @@ -0,0 +1 @@ +8c5e0d53dc67b5ed221b2da0570a17684d973a20 diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/AudioQuality.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/AudioQuality.aidl new file mode 100644 index 0000000000..1ab29029b9 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/AudioQuality.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum AudioQuality { + UNSPECIFIED, + AMR, + AMR_WB, + GSM_EFR, + GSM_FR, + GSM_HR, + EVRC, + EVRC_B, + EVRC_WB, + EVRC_NW, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/Call.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/Call.aidl new file mode 100644 index 0000000000..10d2ee751b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/Call.aidl @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable Call { + int state; + int index; + int toa; + boolean isMpty; + boolean isMT; + byte als; + boolean isVoice; + boolean isVoicePrivacy; + String number; + int numberPresentation; + String name; + int namePresentation; + android.hardware.radio.voice.UusInfo[] uusInfo; + android.hardware.radio.voice.AudioQuality audioQuality; + String forwardedNumber; + const int PRESENTATION_ALLOWED = 0; + const int PRESENTATION_RESTRICTED = 1; + const int PRESENTATION_UNKNOWN = 2; + const int PRESENTATION_PAYPHONE = 3; + const int STATE_ACTIVE = 0; + const int STATE_HOLDING = 1; + const int STATE_DIALING = 2; + const int STATE_ALERTING = 3; + const int STATE_INCOMING = 4; + const int STATE_WAITING = 5; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CallForwardInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CallForwardInfo.aidl new file mode 100644 index 0000000000..8e7aaab565 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CallForwardInfo.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable CallForwardInfo { + int status; + int reason; + int serviceClass; + int toa; + String number; + int timeSeconds; + const int STATUS_DISABLE = 0; + const int STATUS_ENABLE = 1; + const int STATUS_INTERROGATE = 2; + const int STATUS_REGISTRATION = 3; + const int STATUS_ERASURE = 4; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaCallWaiting.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaCallWaiting.aidl new file mode 100644 index 0000000000..310f9a0fac --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaCallWaiting.aidl @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaCallWaiting { + String number; + int numberPresentation; + String name; + android.hardware.radio.voice.CdmaSignalInfoRecord signalInfoRecord; + int numberType; + int numberPlan; + const int NUMBER_PLAN_UNKNOWN = 0; + const int NUMBER_PLAN_ISDN = 1; + const int NUMBER_PLAN_DATA = 3; + const int NUMBER_PLAN_TELEX = 4; + const int NUMBER_PLAN_NATIONAL = 8; + const int NUMBER_PLAN_PRIVATE = 9; + const int NUMBER_PRESENTATION_ALLOWED = 0; + const int NUMBER_PRESENTATION_RESTRICTED = 1; + const int NUMBER_PRESENTATION_UNKNOWN = 2; + const int NUMBER_TYPE_UNKNOWN = 0; + const int NUMBER_TYPE_INTERNATIONAL = 1; + const int NUMBER_TYPE_NATIONAL = 2; + const int NUMBER_TYPE_NETWORK_SPECIFIC = 3; + const int NUMBER_TYPE_SUBSCRIBER = 4; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl new file mode 100644 index 0000000000..b6b562c028 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaDisplayInfoRecord.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaDisplayInfoRecord { + String alphaBuf; + const int CDMA_ALPHA_INFO_BUFFER_LENGTH = 64; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaInformationRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaInformationRecord.aidl new file mode 100644 index 0000000000..24ae775479 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaInformationRecord.aidl @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaInformationRecord { + int name; + android.hardware.radio.voice.CdmaDisplayInfoRecord[] display; + android.hardware.radio.voice.CdmaNumberInfoRecord[] number; + android.hardware.radio.voice.CdmaSignalInfoRecord[] signal; + android.hardware.radio.voice.CdmaRedirectingNumberInfoRecord[] redir; + android.hardware.radio.voice.CdmaLineControlInfoRecord[] lineCtrl; + android.hardware.radio.voice.CdmaT53ClirInfoRecord[] clir; + android.hardware.radio.voice.CdmaT53AudioControlInfoRecord[] audioCtrl; + const int CDMA_MAX_NUMBER_OF_INFO_RECS = 10; + const int NAME_DISPLAY = 0; + const int NAME_CALLED_PARTY_NUMBER = 1; + const int NAME_CALLING_PARTY_NUMBER = 2; + const int NAME_CONNECTED_NUMBER = 3; + const int NAME_SIGNAL = 4; + const int NAME_REDIRECTING_NUMBER = 5; + const int NAME_LINE_CONTROL = 6; + const int NAME_EXTENDED_DISPLAY = 7; + const int NAME_T53_CLIR = 8; + const int NAME_T53_RELEASE = 9; + const int NAME_T53_AUDIO_CONTROL = 10; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaLineControlInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaLineControlInfoRecord.aidl new file mode 100644 index 0000000000..e34b3937b4 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaLineControlInfoRecord.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaLineControlInfoRecord { + byte lineCtrlPolarityIncluded; + byte lineCtrlToggle; + byte lineCtrlReverse; + byte lineCtrlPowerDenial; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl new file mode 100644 index 0000000000..aeb0347d67 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaNumberInfoRecord.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaNumberInfoRecord { + String number; + byte numberType; + byte numberPlan; + byte pi; + byte si; + const int CDMA_NUMBER_INFO_BUFFER_LENGTH = 81; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl new file mode 100644 index 0000000000..fad384172b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaOtaProvisionStatus.aidl @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum CdmaOtaProvisionStatus { + SPL_UNLOCKED, + SPC_RETRIES_EXCEEDED, + A_KEY_EXCHANGED, + SSD_UPDATED, + NAM_DOWNLOADED, + MDN_DOWNLOADED, + IMSI_DOWNLOADED, + PRL_DOWNLOADED, + COMMITTED, + OTAPA_STARTED, + OTAPA_STOPPED, + OTAPA_ABORTED, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaRedirectingNumberInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaRedirectingNumberInfoRecord.aidl new file mode 100644 index 0000000000..b61b91b34f --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaRedirectingNumberInfoRecord.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaRedirectingNumberInfoRecord { + android.hardware.radio.voice.CdmaNumberInfoRecord redirectingNumber; + int redirectingReason; + const int REDIRECTING_REASON_UNKNOWN = 0; + const int REDIRECTING_REASON_CALL_FORWARDING_BUSY = 1; + const int REDIRECTING_REASON_CALL_FORWARDING_NO_REPLY = 2; + const int REDIRECTING_REASON_CALLED_DTE_OUT_OF_ORDER = 9; + const int REDIRECTING_REASON_CALL_FORWARDING_BY_THE_CALLED_DTE = 10; + const int REDIRECTING_REASON_CALL_FORWARDING_UNCONDITIONAL = 15; + const int REDIRECTING_REASON_RESERVED = 16; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaSignalInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaSignalInfoRecord.aidl new file mode 100644 index 0000000000..6c7b264476 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaSignalInfoRecord.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaSignalInfoRecord { + boolean isPresent; + byte signalType; + byte alertPitch; + byte signal; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaT53AudioControlInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaT53AudioControlInfoRecord.aidl new file mode 100644 index 0000000000..438231cbad --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaT53AudioControlInfoRecord.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaT53AudioControlInfoRecord { + byte upLink; + byte downLink; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaT53ClirInfoRecord.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaT53ClirInfoRecord.aidl new file mode 100644 index 0000000000..1b254f56a0 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CdmaT53ClirInfoRecord.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable CdmaT53ClirInfoRecord { + byte cause; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CfData.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CfData.aidl new file mode 100644 index 0000000000..7e799c7b03 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/CfData.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable CfData { + android.hardware.radio.voice.CallForwardInfo[] cfInfo; + const int NUM_SERVICE_CLASSES = 7; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/ClipStatus.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/ClipStatus.aidl new file mode 100644 index 0000000000..a34149ad1b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/ClipStatus.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum ClipStatus { + CLIP_PROVISIONED, + CLIP_UNPROVISIONED, + UNKNOWN, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/Dial.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/Dial.aidl new file mode 100644 index 0000000000..2b2e7590bc --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/Dial.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable Dial { + String address; + int clir; + android.hardware.radio.voice.UusInfo[] uusInfo; + const int CLIR_DEFAULT = 0; + const int CLIR_INVOCATION = 1; + const int CLIR_SUPPRESSION = 2; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/EmergencyCallRouting.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/EmergencyCallRouting.aidl new file mode 100644 index 0000000000..4e1dfc09fa --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/EmergencyCallRouting.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum EmergencyCallRouting { + UNKNOWN, + EMERGENCY, + NORMAL, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/EmergencyNumber.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/EmergencyNumber.aidl new file mode 100644 index 0000000000..f2a7d8ca6d --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/EmergencyNumber.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable EmergencyNumber { + String number; + String mcc; + String mnc; + int categories; + String[] urns; + int sources; + const int SOURCE_NETWORK_SIGNALING = (1 << 0) /* 1 */; + const int SOURCE_SIM = (1 << 1) /* 2 */; + const int SOURCE_MODEM_CONFIG = (1 << 2) /* 4 */; + const int SOURCE_DEFAULT = (1 << 3) /* 8 */; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/EmergencyServiceCategory.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/EmergencyServiceCategory.aidl new file mode 100644 index 0000000000..3a0cdae88b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/EmergencyServiceCategory.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum EmergencyServiceCategory { + UNSPECIFIED = 0, + POLICE = (1 << 0) /* 1 */, + AMBULANCE = (1 << 1) /* 2 */, + FIRE_BRIGADE = (1 << 2) /* 4 */, + MARINE_GUARD = (1 << 3) /* 8 */, + MOUNTAIN_RESCUE = (1 << 4) /* 16 */, + MIEC = (1 << 5) /* 32 */, + AIEC = (1 << 6) /* 64 */, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/IRadioVoice.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/IRadioVoice.aidl new file mode 100644 index 0000000000..603b1d67aa --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/IRadioVoice.aidl @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@VintfStability +interface IRadioVoice { + oneway void acceptCall(in int serial); + oneway void cancelPendingUssd(in int serial); + oneway void conference(in int serial); + oneway void dial(in int serial, in android.hardware.radio.voice.Dial dialInfo); + oneway void emergencyDial(in int serial, in android.hardware.radio.voice.Dial dialInfo, in int categories, in String[] urns, in android.hardware.radio.voice.EmergencyCallRouting routing, in boolean hasKnownUserIntentEmergency, in boolean isTesting); + oneway void exitEmergencyCallbackMode(in int serial); + oneway void explicitCallTransfer(in int serial); + oneway void getCallForwardStatus(in int serial, in android.hardware.radio.voice.CallForwardInfo callInfo); + oneway void getCallWaiting(in int serial, in int serviceClass); + oneway void getClip(in int serial); + oneway void getClir(in int serial); + oneway void getCurrentCalls(in int serial); + oneway void getLastCallFailCause(in int serial); + oneway void getMute(in int serial); + oneway void getPreferredVoicePrivacy(in int serial); + oneway void getTtyMode(in int serial); + oneway void handleStkCallSetupRequestFromSim(in int serial, in boolean accept); + oneway void hangup(in int serial, in int gsmIndex); + oneway void hangupForegroundResumeBackground(in int serial); + oneway void hangupWaitingOrBackground(in int serial); + oneway void isVoNrEnabled(in int serial); + oneway void rejectCall(in int serial); + oneway void responseAcknowledgement(); + oneway void sendBurstDtmf(in int serial, in String dtmf, in int on, in int off); + oneway void sendCdmaFeatureCode(in int serial, in String featureCode); + oneway void sendDtmf(in int serial, in String s); + oneway void sendUssd(in int serial, in String ussd); + oneway void separateConnection(in int serial, in int gsmIndex); + oneway void setCallForward(in int serial, in android.hardware.radio.voice.CallForwardInfo callInfo); + oneway void setCallWaiting(in int serial, in boolean enable, in int serviceClass); + oneway void setClir(in int serial, in int status); + oneway void setMute(in int serial, in boolean enable); + oneway void setPreferredVoicePrivacy(in int serial, in boolean enable); + oneway void setResponseFunctions(in android.hardware.radio.voice.IRadioVoiceResponse radioVoiceResponse, in android.hardware.radio.voice.IRadioVoiceIndication radioVoiceIndication); + oneway void setTtyMode(in int serial, in android.hardware.radio.voice.TtyMode mode); + oneway void setVoNrEnabled(in int serial, in boolean enable); + oneway void startDtmf(in int serial, in String s); + oneway void stopDtmf(in int serial); + oneway void switchWaitingOrHoldingAndActive(in int serial); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/IRadioVoiceIndication.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/IRadioVoiceIndication.aidl new file mode 100644 index 0000000000..189ed43cf9 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/IRadioVoiceIndication.aidl @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@VintfStability +interface IRadioVoiceIndication { + oneway void callRing(in android.hardware.radio.RadioIndicationType type, in boolean isGsm, in android.hardware.radio.voice.CdmaSignalInfoRecord record); + oneway void callStateChanged(in android.hardware.radio.RadioIndicationType type); + oneway void cdmaCallWaiting(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.voice.CdmaCallWaiting callWaitingRecord); + oneway void cdmaInfoRec(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.voice.CdmaInformationRecord[] records); + oneway void cdmaOtaProvisionStatus(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.voice.CdmaOtaProvisionStatus status); + oneway void currentEmergencyNumberList(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.voice.EmergencyNumber[] emergencyNumberList); + oneway void enterEmergencyCallbackMode(in android.hardware.radio.RadioIndicationType type); + oneway void exitEmergencyCallbackMode(in android.hardware.radio.RadioIndicationType type); + oneway void indicateRingbackTone(in android.hardware.radio.RadioIndicationType type, in boolean start); + oneway void onSupplementaryServiceIndication(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.voice.StkCcUnsolSsResult ss); + oneway void onUssd(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.voice.UssdModeType modeType, in String msg); + oneway void resendIncallMute(in android.hardware.radio.RadioIndicationType type); + oneway void srvccStateNotify(in android.hardware.radio.RadioIndicationType type, in android.hardware.radio.voice.SrvccState state); + oneway void stkCallControlAlphaNotify(in android.hardware.radio.RadioIndicationType type, in String alpha); + oneway void stkCallSetup(in android.hardware.radio.RadioIndicationType type, in long timeout); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/IRadioVoiceResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/IRadioVoiceResponse.aidl new file mode 100644 index 0000000000..7acc0446dd --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/IRadioVoiceResponse.aidl @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@VintfStability +interface IRadioVoiceResponse { + oneway void acceptCallResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void acknowledgeRequest(in int serial); + oneway void cancelPendingUssdResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void conferenceResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void dialResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void emergencyDialResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void exitEmergencyCallbackModeResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void explicitCallTransferResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void getCallForwardStatusResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.voice.CallForwardInfo[] callForwardInfos); + oneway void getCallWaitingResponse(in android.hardware.radio.RadioResponseInfo info, in boolean enable, in int serviceClass); + oneway void getClipResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.voice.ClipStatus status); + oneway void getClirResponse(in android.hardware.radio.RadioResponseInfo info, in int n, in int m); + oneway void getCurrentCallsResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.voice.Call[] calls); + oneway void getLastCallFailCauseResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.voice.LastCallFailCauseInfo failCauseinfo); + oneway void getMuteResponse(in android.hardware.radio.RadioResponseInfo info, in boolean enable); + oneway void getPreferredVoicePrivacyResponse(in android.hardware.radio.RadioResponseInfo info, in boolean enable); + oneway void getTtyModeResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.voice.TtyMode mode); + oneway void handleStkCallSetupRequestFromSimResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void hangupConnectionResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void hangupForegroundResumeBackgroundResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void hangupWaitingOrBackgroundResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void isVoNrEnabledResponse(in android.hardware.radio.RadioResponseInfo info, in boolean enable); + oneway void rejectCallResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void sendBurstDtmfResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void sendCdmaFeatureCodeResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void sendDtmfResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void sendUssdResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void separateConnectionResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setCallForwardResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setCallWaitingResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setClirResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setMuteResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setPreferredVoicePrivacyResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setTtyModeResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void setVoNrEnabledResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void startDtmfResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void stopDtmfResponse(in android.hardware.radio.RadioResponseInfo info); + oneway void switchWaitingOrHoldingAndActiveResponse(in android.hardware.radio.RadioResponseInfo info); +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/LastCallFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/LastCallFailCause.aidl new file mode 100644 index 0000000000..7d546233f1 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/LastCallFailCause.aidl @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum LastCallFailCause { + UNOBTAINABLE_NUMBER = 1, + NO_ROUTE_TO_DESTINATION = 3, + CHANNEL_UNACCEPTABLE = 6, + OPERATOR_DETERMINED_BARRING = 8, + NORMAL = 16, + BUSY = 17, + NO_USER_RESPONDING = 18, + NO_ANSWER_FROM_USER = 19, + CALL_REJECTED = 21, + NUMBER_CHANGED = 22, + PREEMPTION = 25, + DESTINATION_OUT_OF_ORDER = 27, + INVALID_NUMBER_FORMAT = 28, + FACILITY_REJECTED = 29, + RESP_TO_STATUS_ENQUIRY = 30, + NORMAL_UNSPECIFIED = 31, + CONGESTION = 34, + NETWORK_OUT_OF_ORDER = 38, + TEMPORARY_FAILURE = 41, + SWITCHING_EQUIPMENT_CONGESTION = 42, + ACCESS_INFORMATION_DISCARDED = 43, + REQUESTED_CIRCUIT_OR_CHANNEL_NOT_AVAILABLE = 44, + RESOURCES_UNAVAILABLE_OR_UNSPECIFIED = 47, + QOS_UNAVAILABLE = 49, + REQUESTED_FACILITY_NOT_SUBSCRIBED = 50, + INCOMING_CALLS_BARRED_WITHIN_CUG = 55, + BEARER_CAPABILITY_NOT_AUTHORIZED = 57, + BEARER_CAPABILITY_UNAVAILABLE = 58, + SERVICE_OPTION_NOT_AVAILABLE = 63, + BEARER_SERVICE_NOT_IMPLEMENTED = 65, + ACM_LIMIT_EXCEEDED = 68, + REQUESTED_FACILITY_NOT_IMPLEMENTED = 69, + ONLY_DIGITAL_INFORMATION_BEARER_AVAILABLE = 70, + SERVICE_OR_OPTION_NOT_IMPLEMENTED = 79, + INVALID_TRANSACTION_IDENTIFIER = 81, + USER_NOT_MEMBER_OF_CUG = 87, + INCOMPATIBLE_DESTINATION = 88, + INVALID_TRANSIT_NW_SELECTION = 91, + SEMANTICALLY_INCORRECT_MESSAGE = 95, + INVALID_MANDATORY_INFORMATION = 96, + MESSAGE_TYPE_NON_IMPLEMENTED = 97, + MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 98, + INFORMATION_ELEMENT_NON_EXISTENT = 99, + CONDITIONAL_IE_ERROR = 100, + MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 101, + RECOVERY_ON_TIMER_EXPIRED = 102, + PROTOCOL_ERROR_UNSPECIFIED = 111, + INTERWORKING_UNSPECIFIED = 127, + CALL_BARRED = 240, + FDN_BLOCKED = 241, + IMSI_UNKNOWN_IN_VLR = 242, + IMEI_NOT_ACCEPTED = 243, + DIAL_MODIFIED_TO_USSD = 244, + DIAL_MODIFIED_TO_SS = 245, + DIAL_MODIFIED_TO_DIAL = 246, + RADIO_OFF = 247, + OUT_OF_SERVICE = 248, + NO_VALID_SIM = 249, + RADIO_INTERNAL_ERROR = 250, + NETWORK_RESP_TIMEOUT = 251, + NETWORK_REJECT = 252, + RADIO_ACCESS_FAILURE = 253, + RADIO_LINK_FAILURE = 254, + RADIO_LINK_LOST = 255, + RADIO_UPLINK_FAILURE = 256, + RADIO_SETUP_FAILURE = 257, + RADIO_RELEASE_NORMAL = 258, + RADIO_RELEASE_ABNORMAL = 259, + ACCESS_CLASS_BLOCKED = 260, + NETWORK_DETACH = 261, + CDMA_LOCKED_UNTIL_POWER_CYCLE = 1000, + CDMA_DROP = 1001, + CDMA_INTERCEPT = 1002, + CDMA_REORDER = 1003, + CDMA_SO_REJECT = 1004, + CDMA_RETRY_ORDER = 1005, + CDMA_ACCESS_FAILURE = 1006, + CDMA_PREEMPTED = 1007, + CDMA_NOT_EMERGENCY = 1008, + CDMA_ACCESS_BLOCKED = 1009, + OEM_CAUSE_1 = 0xf001, + OEM_CAUSE_2 = 0xf002, + OEM_CAUSE_3 = 0xf003, + OEM_CAUSE_4 = 0xf004, + OEM_CAUSE_5 = 0xf005, + OEM_CAUSE_6 = 0xf006, + OEM_CAUSE_7 = 0xf007, + OEM_CAUSE_8 = 0xf008, + OEM_CAUSE_9 = 0xf009, + OEM_CAUSE_10 = 0xf00a, + OEM_CAUSE_11 = 0xf00b, + OEM_CAUSE_12 = 0xf00c, + OEM_CAUSE_13 = 0xf00d, + OEM_CAUSE_14 = 0xf00e, + OEM_CAUSE_15 = 0xf00f, + ERROR_UNSPECIFIED = 0xffff, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/LastCallFailCauseInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/LastCallFailCauseInfo.aidl new file mode 100644 index 0000000000..221acf7306 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/LastCallFailCauseInfo.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable LastCallFailCauseInfo { + android.hardware.radio.voice.LastCallFailCause causeCode; + String vendorCause; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/SrvccState.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/SrvccState.aidl new file mode 100644 index 0000000000..4b5c216081 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/SrvccState.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum SrvccState { + HANDOVER_STARTED, + HANDOVER_COMPLETED, + HANDOVER_FAILED, + HANDOVER_CANCELED, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/SsInfoData.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/SsInfoData.aidl new file mode 100644 index 0000000000..f18b404605 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/SsInfoData.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable SsInfoData { + int[] ssInfo; + const int SS_INFO_MAX = 4; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/StkCcUnsolSsResult.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/StkCcUnsolSsResult.aidl new file mode 100644 index 0000000000..f04942b774 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/StkCcUnsolSsResult.aidl @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable StkCcUnsolSsResult { + int serviceType; + int requestType; + int teleserviceType; + int serviceClass; + android.hardware.radio.RadioError result; + android.hardware.radio.voice.SsInfoData[] ssInfo; + android.hardware.radio.voice.CfData[] cfData; + const int REQUEST_TYPE_ACTIVATION = 0; + const int REQUEST_TYPE_DEACTIVATION = 1; + const int REQUEST_TYPE_INTERROGATION = 2; + const int REQUEST_TYPE_REGISTRATION = 3; + const int REQUEST_TYPE_ERASURE = 4; + const int SERVICE_TYPE_CFU = 0; + const int SERVICE_TYPE_CF_BUSY = 1; + const int SERVICE_TYPE_CF_NO_REPLY = 2; + const int SERVICE_TYPE_CF_NOT_REACHABLE = 3; + const int SERVICE_TYPE_CF_ALL = 4; + const int SERVICE_TYPE_CF_ALL_CONDITIONAL = 5; + const int SERVICE_TYPE_CLIP = 6; + const int SERVICE_TYPE_CLIR = 7; + const int SERVICE_TYPE_COLP = 8; + const int SERVICE_TYPE_COLR = 9; + const int SERVICE_TYPE_WAIT = 10; + const int SERVICE_TYPE_BAOC = 11; + const int SERVICE_TYPE_BAOIC = 12; + const int SERVICE_TYPE_BAOIC_EXC_HOME = 13; + const int SERVICE_TYPE_BAIC = 14; + const int SERVICE_TYPE_BAIC_ROAMING = 15; + const int SERVICE_TYPE_ALL_BARRING = 16; + const int SERVICE_TYPE_OUTGOING_BARRING = 17; + const int SERVICE_TYPE_INCOMING_BARRING = 18; + const int TELESERVICE_TYPE_ALL_TELE_AND_BEARER_SERVICES = 0; + const int TELESERVICE_TYPE_ALL_TELESEVICES = 1; + const int TELESERVICE_TYPE_TELEPHONY = 2; + const int TELESERVICE_TYPE_ALL_DATA_TELESERVICES = 3; + const int TELESERVICE_TYPE_SMS_SERVICES = 4; + const int TELESERVICE_TYPE_ALL_TELESERVICES_EXCEPT_SMS = 5; + const int SUPP_SERVICE_CLASS_NONE = 0; + const int SUPP_SERVICE_CLASS_VOICE = (1 << 0) /* 1 */; + const int SUPP_SERVICE_CLASS_DATA = (1 << 1) /* 2 */; + const int SUPP_SERVICE_CLASS_FAX = (1 << 2) /* 4 */; + const int SUPP_SERVICE_CLASS_SMS = (1 << 3) /* 8 */; + const int SUPP_SERVICE_CLASS_DATA_SYNC = (1 << 4) /* 16 */; + const int SUPP_SERVICE_CLASS_DATA_ASYNC = (1 << 5) /* 32 */; + const int SUPP_SERVICE_CLASS_PACKET = (1 << 6) /* 64 */; + const int SUPP_SERVICE_CLASS_PAD = (1 << 7) /* 128 */; + const int SUPP_SERVICE_CLASS_MAX = (1 << 7) /* 128 */; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/TtyMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/TtyMode.aidl new file mode 100644 index 0000000000..e432e65093 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/TtyMode.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum TtyMode { + OFF, + FULL, + HCO, + VCO, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/UssdModeType.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/UssdModeType.aidl new file mode 100644 index 0000000000..424e73fc35 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/UssdModeType.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum UssdModeType { + NOTIFY, + REQUEST, + NW_RELEASE, + LOCAL_CLIENT, + NOT_SUPPORTED, + NW_TIMEOUT, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/UusInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/UusInfo.aidl new file mode 100644 index 0000000000..931376014c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio.voice/2/android/hardware/radio/voice/UusInfo.aidl @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio.voice; +@JavaDerive(toString=true) @VintfStability +parcelable UusInfo { + int uusType; + int uusDcs; + String uusData; + const int UUS_DCS_USP = 0; + const int UUS_DCS_OSIHLP = 1; + const int UUS_DCS_X244 = 2; + const int UUS_DCS_RMCF = 3; + const int UUS_DCS_IA5C = 4; + const int UUS_TYPE_TYPE1_IMPLICIT = 0; + const int UUS_TYPE_TYPE1_REQUIRED = 1; + const int UUS_TYPE_TYPE1_NOT_REQUIRED = 2; + const int UUS_TYPE_TYPE2_REQUIRED = 3; + const int UUS_TYPE_TYPE2_NOT_REQUIRED = 4; + const int UUS_TYPE_TYPE3_REQUIRED = 5; + const int UUS_TYPE_TYPE3_NOT_REQUIRED = 6; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio/2/.hash b/radio/aidl/aidl_api/android.hardware.radio/2/.hash new file mode 100644 index 0000000000..f7a1438c26 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio/2/.hash @@ -0,0 +1 @@ +bb059adfc597be7a26032661374ee203320b3494 diff --git a/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/AccessNetwork.aidl b/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/AccessNetwork.aidl new file mode 100644 index 0000000000..964165149d --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/AccessNetwork.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum AccessNetwork { + UNKNOWN, + GERAN, + UTRAN, + EUTRAN, + CDMA2000, + IWLAN, + NGRAN, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioAccessFamily.aidl b/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioAccessFamily.aidl new file mode 100644 index 0000000000..b7b074bda2 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioAccessFamily.aidl @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum RadioAccessFamily { + UNKNOWN = (1 << android.hardware.radio.RadioTechnology.UNKNOWN) /* 1 */, + GPRS = (1 << android.hardware.radio.RadioTechnology.GPRS) /* 2 */, + EDGE = (1 << android.hardware.radio.RadioTechnology.EDGE) /* 4 */, + UMTS = (1 << android.hardware.radio.RadioTechnology.UMTS) /* 8 */, + IS95A = (1 << android.hardware.radio.RadioTechnology.IS95A) /* 16 */, + IS95B = (1 << android.hardware.radio.RadioTechnology.IS95B) /* 32 */, + ONE_X_RTT = (1 << android.hardware.radio.RadioTechnology.ONE_X_RTT) /* 64 */, + EVDO_0 = (1 << android.hardware.radio.RadioTechnology.EVDO_0) /* 128 */, + EVDO_A = (1 << android.hardware.radio.RadioTechnology.EVDO_A) /* 256 */, + HSDPA = (1 << android.hardware.radio.RadioTechnology.HSDPA) /* 512 */, + HSUPA = (1 << android.hardware.radio.RadioTechnology.HSUPA) /* 1024 */, + HSPA = (1 << android.hardware.radio.RadioTechnology.HSPA) /* 2048 */, + EVDO_B = (1 << android.hardware.radio.RadioTechnology.EVDO_B) /* 4096 */, + EHRPD = (1 << android.hardware.radio.RadioTechnology.EHRPD) /* 8192 */, + LTE = (1 << android.hardware.radio.RadioTechnology.LTE) /* 16384 */, + HSPAP = (1 << android.hardware.radio.RadioTechnology.HSPAP) /* 32768 */, + GSM = (1 << android.hardware.radio.RadioTechnology.GSM) /* 65536 */, + TD_SCDMA = (1 << android.hardware.radio.RadioTechnology.TD_SCDMA) /* 131072 */, + IWLAN = (1 << android.hardware.radio.RadioTechnology.IWLAN) /* 262144 */, + /** + * @deprecated use LTE instead. + */ + LTE_CA = (1 << android.hardware.radio.RadioTechnology.LTE_CA) /* 524288 */, + NR = (1 << android.hardware.radio.RadioTechnology.NR) /* 1048576 */, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioConst.aidl b/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioConst.aidl new file mode 100644 index 0000000000..9785825e9d --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioConst.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio; +@JavaDerive(toString=true) @VintfStability +parcelable RadioConst { + const int MAX_RILDS = 3; + const int MAX_UUID_LENGTH = 64; + const int CARD_MAX_APPS = 8; + const int P2_CONSTANT_NO_P2 = (-1) /* -1 */; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioError.aidl b/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioError.aidl new file mode 100644 index 0000000000..98606e588b --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioError.aidl @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum RadioError { + NONE = 0, + RADIO_NOT_AVAILABLE = 1, + GENERIC_FAILURE = 2, + PASSWORD_INCORRECT = 3, + SIM_PIN2 = 4, + SIM_PUK2 = 5, + REQUEST_NOT_SUPPORTED = 6, + CANCELLED = 7, + OP_NOT_ALLOWED_DURING_VOICE_CALL = 8, + OP_NOT_ALLOWED_BEFORE_REG_TO_NW = 9, + SMS_SEND_FAIL_RETRY = 10, + SIM_ABSENT = 11, + SUBSCRIPTION_NOT_AVAILABLE = 12, + MODE_NOT_SUPPORTED = 13, + FDN_CHECK_FAILURE = 14, + ILLEGAL_SIM_OR_ME = 15, + MISSING_RESOURCE = 16, + NO_SUCH_ELEMENT = 17, + DIAL_MODIFIED_TO_USSD = 18, + DIAL_MODIFIED_TO_SS = 19, + DIAL_MODIFIED_TO_DIAL = 20, + USSD_MODIFIED_TO_DIAL = 21, + USSD_MODIFIED_TO_SS = 22, + USSD_MODIFIED_TO_USSD = 23, + SS_MODIFIED_TO_DIAL = 24, + SS_MODIFIED_TO_USSD = 25, + SUBSCRIPTION_NOT_SUPPORTED = 26, + SS_MODIFIED_TO_SS = 27, + LCE_NOT_SUPPORTED = 36, + NO_MEMORY = 37, + INTERNAL_ERR = 38, + SYSTEM_ERR = 39, + MODEM_ERR = 40, + INVALID_STATE = 41, + NO_RESOURCES = 42, + SIM_ERR = 43, + INVALID_ARGUMENTS = 44, + INVALID_SIM_STATE = 45, + INVALID_MODEM_STATE = 46, + INVALID_CALL_ID = 47, + NO_SMS_TO_ACK = 48, + NETWORK_ERR = 49, + REQUEST_RATE_LIMITED = 50, + SIM_BUSY = 51, + SIM_FULL = 52, + NETWORK_REJECT = 53, + OPERATION_NOT_ALLOWED = 54, + EMPTY_RECORD = 55, + INVALID_SMS_FORMAT = 56, + ENCODING_ERR = 57, + INVALID_SMSC_ADDRESS = 58, + NO_SUCH_ENTRY = 59, + NETWORK_NOT_READY = 60, + NOT_PROVISIONED = 61, + NO_SUBSCRIPTION = 62, + NO_NETWORK_FOUND = 63, + DEVICE_IN_USE = 64, + ABORTED = 65, + INVALID_RESPONSE = 66, + OEM_ERROR_1 = 501, + OEM_ERROR_2 = 502, + OEM_ERROR_3 = 503, + OEM_ERROR_4 = 504, + OEM_ERROR_5 = 505, + OEM_ERROR_6 = 506, + OEM_ERROR_7 = 507, + OEM_ERROR_8 = 508, + OEM_ERROR_9 = 509, + OEM_ERROR_10 = 510, + OEM_ERROR_11 = 511, + OEM_ERROR_12 = 512, + OEM_ERROR_13 = 513, + OEM_ERROR_14 = 514, + OEM_ERROR_15 = 515, + OEM_ERROR_16 = 516, + OEM_ERROR_17 = 517, + OEM_ERROR_18 = 518, + OEM_ERROR_19 = 519, + OEM_ERROR_20 = 520, + OEM_ERROR_21 = 521, + OEM_ERROR_22 = 522, + OEM_ERROR_23 = 523, + OEM_ERROR_24 = 524, + OEM_ERROR_25 = 525, + SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED = 67, + ACCESS_BARRED = 68, + BLOCKED_DUE_TO_CALL = 69, + RF_HARDWARE_ISSUE = 70, + NO_RF_CALIBRATION_INFO = 71, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioIndicationType.aidl b/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioIndicationType.aidl new file mode 100644 index 0000000000..58b35a5723 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioIndicationType.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum RadioIndicationType { + UNSOLICITED, + UNSOLICITED_ACK_EXP, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioResponseInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioResponseInfo.aidl new file mode 100644 index 0000000000..b2a7a062f9 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioResponseInfo.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio; +@JavaDerive(toString=true) @VintfStability +parcelable RadioResponseInfo { + android.hardware.radio.RadioResponseType type; + int serial; + android.hardware.radio.RadioError error; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioResponseInfoModem.aidl b/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioResponseInfoModem.aidl new file mode 100644 index 0000000000..37ed7bb230 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioResponseInfoModem.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio; +@JavaDerive(toString=true) @VintfStability +parcelable RadioResponseInfoModem { + android.hardware.radio.RadioResponseType type; + int serial; + android.hardware.radio.RadioError error; + boolean isEnabled; +} diff --git a/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioResponseType.aidl b/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioResponseType.aidl new file mode 100644 index 0000000000..1ee62bd94c --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioResponseType.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum RadioResponseType { + SOLICITED, + SOLICITED_ACK, + SOLICITED_ACK_EXP, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioTechnology.aidl b/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioTechnology.aidl new file mode 100644 index 0000000000..b6af5aabf2 --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioTechnology.aidl @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum RadioTechnology { + UNKNOWN, + GPRS, + EDGE, + UMTS, + IS95A, + IS95B, + ONE_X_RTT, + EVDO_0, + EVDO_A, + HSDPA, + HSUPA, + HSPA, + EVDO_B, + EHRPD, + LTE, + HSPAP, + GSM, + TD_SCDMA, + IWLAN, + /** + * @deprecated use LTE instead and indicate carrier aggregation through multiple physical channel configurations in IRadioNetwork::currentPhysicalChannelConfigs. + */ + LTE_CA, + NR, +} diff --git a/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioTechnologyFamily.aidl b/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioTechnologyFamily.aidl new file mode 100644 index 0000000000..2af7e535da --- /dev/null +++ b/radio/aidl/aidl_api/android.hardware.radio/2/android/hardware/radio/RadioTechnologyFamily.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.radio; +@Backing(type="int") @JavaDerive(toString=true) @VintfStability +enum RadioTechnologyFamily { + THREE_GPP, + THREE_GPP2, +} diff --git a/secure_element/aidl/Android.bp b/secure_element/aidl/Android.bp index 6450eb4a99..655487de34 100644 --- a/secure_element/aidl/Android.bp +++ b/secure_element/aidl/Android.bp @@ -21,6 +21,14 @@ aidl_interface { sdk_version: "system_current", }, }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + frozen: true, + } cc_test { diff --git a/secure_element/aidl/aidl_api/android.hardware.secure_element/1/.hash b/secure_element/aidl/aidl_api/android.hardware.secure_element/1/.hash new file mode 100644 index 0000000000..d7ad83f1c9 --- /dev/null +++ b/secure_element/aidl/aidl_api/android.hardware.secure_element/1/.hash @@ -0,0 +1 @@ +3430a4053a6e5f73f2d0c250cab7a8ba654efdae diff --git a/secure_element/aidl/aidl_api/android.hardware.secure_element/1/android/hardware/secure_element/ISecureElement.aidl b/secure_element/aidl/aidl_api/android.hardware.secure_element/1/android/hardware/secure_element/ISecureElement.aidl new file mode 100644 index 0000000000..fba29ab8fa --- /dev/null +++ b/secure_element/aidl/aidl_api/android.hardware.secure_element/1/android/hardware/secure_element/ISecureElement.aidl @@ -0,0 +1,50 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.secure_element; +@VintfStability +interface ISecureElement { + void closeChannel(in byte channelNumber); + byte[] getAtr(); + void init(in android.hardware.secure_element.ISecureElementCallback clientCallback); + boolean isCardPresent(); + byte[] openBasicChannel(in byte[] aid, in byte p2); + android.hardware.secure_element.LogicalChannelResponse openLogicalChannel(in byte[] aid, in byte p2); + void reset(); + byte[] transmit(in byte[] data); + const int FAILED = 1; + const int CHANNEL_NOT_AVAILABLE = 2; + const int NO_SUCH_ELEMENT_ERROR = 3; + const int UNSUPPORTED_OPERATION = 4; + const int IOERROR = 5; +} diff --git a/secure_element/aidl/aidl_api/android.hardware.secure_element/1/android/hardware/secure_element/ISecureElementCallback.aidl b/secure_element/aidl/aidl_api/android.hardware.secure_element/1/android/hardware/secure_element/ISecureElementCallback.aidl new file mode 100644 index 0000000000..6c2be2a73a --- /dev/null +++ b/secure_element/aidl/aidl_api/android.hardware.secure_element/1/android/hardware/secure_element/ISecureElementCallback.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.secure_element; +@VintfStability +interface ISecureElementCallback { + void onStateChange(in boolean connected, in String debugReason); +} diff --git a/secure_element/aidl/aidl_api/android.hardware.secure_element/1/android/hardware/secure_element/LogicalChannelResponse.aidl b/secure_element/aidl/aidl_api/android.hardware.secure_element/1/android/hardware/secure_element/LogicalChannelResponse.aidl new file mode 100644 index 0000000000..f2e7f0423a --- /dev/null +++ b/secure_element/aidl/aidl_api/android.hardware.secure_element/1/android/hardware/secure_element/LogicalChannelResponse.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.secure_element; +@VintfStability +parcelable LogicalChannelResponse { + byte channelNumber; + byte[] selectResponse; +} diff --git a/security/keymint/aidl/Android.bp b/security/keymint/aidl/Android.bp index 4753afbd0e..e346610f91 100644 --- a/security/keymint/aidl/Android.bp +++ b/security/keymint/aidl/Android.bp @@ -17,7 +17,7 @@ aidl_interface { "android.hardware.security.secureclock-V1", ], stability: "vintf", - frozen: false, + frozen: true, backend: { java: { platform_apis: true, @@ -42,6 +42,10 @@ aidl_interface { version: "2", imports: ["android.hardware.security.secureclock-V1"], }, + { + version: "3", + imports: ["android.hardware.security.secureclock-V1"], + }, ], diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/.hash b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/.hash new file mode 100644 index 0000000000..d8a0378fb9 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/.hash @@ -0,0 +1 @@ +74a538630d5d90f732f361a2313cbb69b09eb047 diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/Algorithm.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/Algorithm.aidl new file mode 100644 index 0000000000..6da124f601 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/Algorithm.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2020 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 -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.hardware.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum Algorithm { + RSA = 1, + EC = 3, + AES = 32, + TRIPLE_DES = 33, + HMAC = 128, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/AttestationKey.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/AttestationKey.aidl new file mode 100644 index 0000000000..90f2e6ee54 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/AttestationKey.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.security.keymint; +/* @hide */ +@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability +parcelable AttestationKey { + byte[] keyBlob; + android.hardware.security.keymint.KeyParameter[] attestKeyParams; + byte[] issuerSubjectName; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/BeginResult.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/BeginResult.aidl new file mode 100644 index 0000000000..c952a3152a --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/BeginResult.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2020 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 -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.hardware.security.keymint; +/* @hide */ +@VintfStability +parcelable BeginResult { + long challenge; + android.hardware.security.keymint.KeyParameter[] params; + android.hardware.security.keymint.IKeyMintOperation operation; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/BlockMode.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/BlockMode.aidl new file mode 100644 index 0000000000..004988326b --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/BlockMode.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2020 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 -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.hardware.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum BlockMode { + ECB = 1, + CBC = 2, + CTR = 3, + GCM = 32, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/Certificate.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/Certificate.aidl new file mode 100644 index 0000000000..645f0a72ee --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/Certificate.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 2020 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 -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.hardware.security.keymint; +/* @hide */ +@VintfStability +parcelable Certificate { + byte[] encodedCertificate; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/Digest.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/Digest.aidl new file mode 100644 index 0000000000..0df709609f --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/Digest.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2020 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 -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.hardware.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum Digest { + NONE = 0, + MD5 = 1, + SHA1 = 2, + SHA_2_224 = 3, + SHA_2_256 = 4, + SHA_2_384 = 5, + SHA_2_512 = 6, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/EcCurve.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/EcCurve.aidl new file mode 100644 index 0000000000..ffc7efe0e7 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/EcCurve.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2020 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 -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.hardware.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum EcCurve { + P_224 = 0, + P_256 = 1, + P_384 = 2, + P_521 = 3, + CURVE_25519 = 4, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/ErrorCode.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/ErrorCode.aidl new file mode 100644 index 0000000000..6d49c44621 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/ErrorCode.aidl @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2020 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 -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.hardware.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum ErrorCode { + OK = 0, + ROOT_OF_TRUST_ALREADY_SET = (-1) /* -1 */, + UNSUPPORTED_PURPOSE = (-2) /* -2 */, + INCOMPATIBLE_PURPOSE = (-3) /* -3 */, + UNSUPPORTED_ALGORITHM = (-4) /* -4 */, + INCOMPATIBLE_ALGORITHM = (-5) /* -5 */, + UNSUPPORTED_KEY_SIZE = (-6) /* -6 */, + UNSUPPORTED_BLOCK_MODE = (-7) /* -7 */, + INCOMPATIBLE_BLOCK_MODE = (-8) /* -8 */, + UNSUPPORTED_MAC_LENGTH = (-9) /* -9 */, + UNSUPPORTED_PADDING_MODE = (-10) /* -10 */, + INCOMPATIBLE_PADDING_MODE = (-11) /* -11 */, + UNSUPPORTED_DIGEST = (-12) /* -12 */, + INCOMPATIBLE_DIGEST = (-13) /* -13 */, + INVALID_EXPIRATION_TIME = (-14) /* -14 */, + INVALID_USER_ID = (-15) /* -15 */, + INVALID_AUTHORIZATION_TIMEOUT = (-16) /* -16 */, + UNSUPPORTED_KEY_FORMAT = (-17) /* -17 */, + INCOMPATIBLE_KEY_FORMAT = (-18) /* -18 */, + UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM = (-19) /* -19 */, + UNSUPPORTED_KEY_VERIFICATION_ALGORITHM = (-20) /* -20 */, + INVALID_INPUT_LENGTH = (-21) /* -21 */, + KEY_EXPORT_OPTIONS_INVALID = (-22) /* -22 */, + DELEGATION_NOT_ALLOWED = (-23) /* -23 */, + KEY_NOT_YET_VALID = (-24) /* -24 */, + KEY_EXPIRED = (-25) /* -25 */, + KEY_USER_NOT_AUTHENTICATED = (-26) /* -26 */, + OUTPUT_PARAMETER_NULL = (-27) /* -27 */, + INVALID_OPERATION_HANDLE = (-28) /* -28 */, + INSUFFICIENT_BUFFER_SPACE = (-29) /* -29 */, + VERIFICATION_FAILED = (-30) /* -30 */, + TOO_MANY_OPERATIONS = (-31) /* -31 */, + UNEXPECTED_NULL_POINTER = (-32) /* -32 */, + INVALID_KEY_BLOB = (-33) /* -33 */, + IMPORTED_KEY_NOT_ENCRYPTED = (-34) /* -34 */, + IMPORTED_KEY_DECRYPTION_FAILED = (-35) /* -35 */, + IMPORTED_KEY_NOT_SIGNED = (-36) /* -36 */, + IMPORTED_KEY_VERIFICATION_FAILED = (-37) /* -37 */, + INVALID_ARGUMENT = (-38) /* -38 */, + UNSUPPORTED_TAG = (-39) /* -39 */, + INVALID_TAG = (-40) /* -40 */, + MEMORY_ALLOCATION_FAILED = (-41) /* -41 */, + IMPORT_PARAMETER_MISMATCH = (-44) /* -44 */, + SECURE_HW_ACCESS_DENIED = (-45) /* -45 */, + OPERATION_CANCELLED = (-46) /* -46 */, + CONCURRENT_ACCESS_CONFLICT = (-47) /* -47 */, + SECURE_HW_BUSY = (-48) /* -48 */, + SECURE_HW_COMMUNICATION_FAILED = (-49) /* -49 */, + UNSUPPORTED_EC_FIELD = (-50) /* -50 */, + MISSING_NONCE = (-51) /* -51 */, + INVALID_NONCE = (-52) /* -52 */, + MISSING_MAC_LENGTH = (-53) /* -53 */, + KEY_RATE_LIMIT_EXCEEDED = (-54) /* -54 */, + CALLER_NONCE_PROHIBITED = (-55) /* -55 */, + KEY_MAX_OPS_EXCEEDED = (-56) /* -56 */, + INVALID_MAC_LENGTH = (-57) /* -57 */, + MISSING_MIN_MAC_LENGTH = (-58) /* -58 */, + UNSUPPORTED_MIN_MAC_LENGTH = (-59) /* -59 */, + UNSUPPORTED_KDF = (-60) /* -60 */, + UNSUPPORTED_EC_CURVE = (-61) /* -61 */, + KEY_REQUIRES_UPGRADE = (-62) /* -62 */, + ATTESTATION_CHALLENGE_MISSING = (-63) /* -63 */, + KEYMINT_NOT_CONFIGURED = (-64) /* -64 */, + ATTESTATION_APPLICATION_ID_MISSING = (-65) /* -65 */, + CANNOT_ATTEST_IDS = (-66) /* -66 */, + ROLLBACK_RESISTANCE_UNAVAILABLE = (-67) /* -67 */, + HARDWARE_TYPE_UNAVAILABLE = (-68) /* -68 */, + PROOF_OF_PRESENCE_REQUIRED = (-69) /* -69 */, + CONCURRENT_PROOF_OF_PRESENCE_REQUESTED = (-70) /* -70 */, + NO_USER_CONFIRMATION = (-71) /* -71 */, + DEVICE_LOCKED = (-72) /* -72 */, + EARLY_BOOT_ENDED = (-73) /* -73 */, + ATTESTATION_KEYS_NOT_PROVISIONED = (-74) /* -74 */, + ATTESTATION_IDS_NOT_PROVISIONED = (-75) /* -75 */, + INVALID_OPERATION = (-76) /* -76 */, + STORAGE_KEY_UNSUPPORTED = (-77) /* -77 */, + INCOMPATIBLE_MGF_DIGEST = (-78) /* -78 */, + UNSUPPORTED_MGF_DIGEST = (-79) /* -79 */, + MISSING_NOT_BEFORE = (-80) /* -80 */, + MISSING_NOT_AFTER = (-81) /* -81 */, + MISSING_ISSUER_SUBJECT = (-82) /* -82 */, + INVALID_ISSUER_SUBJECT = (-83) /* -83 */, + BOOT_LEVEL_EXCEEDED = (-84) /* -84 */, + HARDWARE_NOT_YET_AVAILABLE = (-85) /* -85 */, + UNIMPLEMENTED = (-100) /* -100 */, + VERSION_MISMATCH = (-101) /* -101 */, + UNKNOWN_ERROR = (-1000) /* -1000 */, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/HardwareAuthToken.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/HardwareAuthToken.aidl new file mode 100644 index 0000000000..2e07924382 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/HardwareAuthToken.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 2020 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 -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.hardware.security.keymint; +/* @hide */ +@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability +parcelable HardwareAuthToken { + long challenge; + long userId; + long authenticatorId; + android.hardware.security.keymint.HardwareAuthenticatorType authenticatorType = android.hardware.security.keymint.HardwareAuthenticatorType.NONE; + android.hardware.security.secureclock.Timestamp timestamp; + byte[] mac; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/HardwareAuthenticatorType.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/HardwareAuthenticatorType.aidl new file mode 100644 index 0000000000..eb4f6215b7 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/HardwareAuthenticatorType.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2020 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 -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.hardware.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum HardwareAuthenticatorType { + NONE = 0, + PASSWORD = (1 << 0) /* 1 */, + FINGERPRINT = (1 << 1) /* 2 */, + ANY = 0xFFFFFFFF, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/IKeyMintDevice.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/IKeyMintDevice.aidl new file mode 100644 index 0000000000..dcc22c4ba7 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/IKeyMintDevice.aidl @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2020 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 -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.hardware.security.keymint; +/* @hide */ +@SensitiveData @VintfStability +interface IKeyMintDevice { + android.hardware.security.keymint.KeyMintHardwareInfo getHardwareInfo(); + void addRngEntropy(in byte[] data); + android.hardware.security.keymint.KeyCreationResult generateKey(in android.hardware.security.keymint.KeyParameter[] keyParams, in @nullable android.hardware.security.keymint.AttestationKey attestationKey); + android.hardware.security.keymint.KeyCreationResult importKey(in android.hardware.security.keymint.KeyParameter[] keyParams, in android.hardware.security.keymint.KeyFormat keyFormat, in byte[] keyData, in @nullable android.hardware.security.keymint.AttestationKey attestationKey); + android.hardware.security.keymint.KeyCreationResult importWrappedKey(in byte[] wrappedKeyData, in byte[] wrappingKeyBlob, in byte[] maskingKey, in android.hardware.security.keymint.KeyParameter[] unwrappingParams, in long passwordSid, in long biometricSid); + byte[] upgradeKey(in byte[] keyBlobToUpgrade, in android.hardware.security.keymint.KeyParameter[] upgradeParams); + void deleteKey(in byte[] keyBlob); + void deleteAllKeys(); + void destroyAttestationIds(); + android.hardware.security.keymint.BeginResult begin(in android.hardware.security.keymint.KeyPurpose purpose, in byte[] keyBlob, in android.hardware.security.keymint.KeyParameter[] params, in @nullable android.hardware.security.keymint.HardwareAuthToken authToken); + void deviceLocked(in boolean passwordOnly, in @nullable android.hardware.security.secureclock.TimeStampToken timestampToken); + void earlyBootEnded(); + byte[] convertStorageKeyToEphemeral(in byte[] storageKeyBlob); + android.hardware.security.keymint.KeyCharacteristics[] getKeyCharacteristics(in byte[] keyBlob, in byte[] appId, in byte[] appData); + byte[16] getRootOfTrustChallenge(); + byte[] getRootOfTrust(in byte[16] challenge); + void sendRootOfTrust(in byte[] rootOfTrust); + const int AUTH_TOKEN_MAC_LENGTH = 32; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/IKeyMintOperation.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/IKeyMintOperation.aidl new file mode 100644 index 0000000000..4ab4ffed11 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/IKeyMintOperation.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2020 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 -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.hardware.security.keymint; +/* @hide */ +@SensitiveData @VintfStability +interface IKeyMintOperation { + void updateAad(in byte[] input, in @nullable android.hardware.security.keymint.HardwareAuthToken authToken, in @nullable android.hardware.security.secureclock.TimeStampToken timeStampToken); + byte[] update(in byte[] input, in @nullable android.hardware.security.keymint.HardwareAuthToken authToken, in @nullable android.hardware.security.secureclock.TimeStampToken timeStampToken); + byte[] finish(in @nullable byte[] input, in @nullable byte[] signature, in @nullable android.hardware.security.keymint.HardwareAuthToken authToken, in @nullable android.hardware.security.secureclock.TimeStampToken timestampToken, in @nullable byte[] confirmationToken); + void abort(); +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyCharacteristics.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyCharacteristics.aidl new file mode 100644 index 0000000000..008381f282 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyCharacteristics.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2020 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 -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.hardware.security.keymint; +/* @hide */ +@VintfStability +parcelable KeyCharacteristics { + android.hardware.security.keymint.SecurityLevel securityLevel = android.hardware.security.keymint.SecurityLevel.SOFTWARE; + android.hardware.security.keymint.KeyParameter[] authorizations; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyCreationResult.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyCreationResult.aidl new file mode 100644 index 0000000000..9f77d3e3d5 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyCreationResult.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.security.keymint; +/* @hide */ +@VintfStability +parcelable KeyCreationResult { + byte[] keyBlob; + android.hardware.security.keymint.KeyCharacteristics[] keyCharacteristics; + android.hardware.security.keymint.Certificate[] certificateChain; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyFormat.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyFormat.aidl new file mode 100644 index 0000000000..9560d8d2b5 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyFormat.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2020 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 -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.hardware.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum KeyFormat { + X509 = 0, + PKCS8 = 1, + RAW = 3, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyMintHardwareInfo.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyMintHardwareInfo.aidl new file mode 100644 index 0000000000..2113e42a8e --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyMintHardwareInfo.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2020 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 -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.hardware.security.keymint; +/* @hide */ +@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability +parcelable KeyMintHardwareInfo { + int versionNumber; + android.hardware.security.keymint.SecurityLevel securityLevel = android.hardware.security.keymint.SecurityLevel.SOFTWARE; + @utf8InCpp String keyMintName; + @utf8InCpp String keyMintAuthorName; + boolean timestampTokenRequired; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyOrigin.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyOrigin.aidl new file mode 100644 index 0000000000..4b3c659ffe --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyOrigin.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2020 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 -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.hardware.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum KeyOrigin { + GENERATED = 0, + DERIVED = 1, + IMPORTED = 2, + RESERVED = 3, + SECURELY_IMPORTED = 4, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyParameter.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyParameter.aidl new file mode 100644 index 0000000000..c5a1e011d2 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyParameter.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2020 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 -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.hardware.security.keymint; +/* @hide */ +@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability +parcelable KeyParameter { + android.hardware.security.keymint.Tag tag = android.hardware.security.keymint.Tag.INVALID; + android.hardware.security.keymint.KeyParameterValue value; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyParameterValue.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyParameterValue.aidl new file mode 100644 index 0000000000..7a0b074fe5 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyParameterValue.aidl @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2020 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 -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.hardware.security.keymint; +/* @hide */ +@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability +union KeyParameterValue { + int invalid; + android.hardware.security.keymint.Algorithm algorithm; + android.hardware.security.keymint.BlockMode blockMode; + android.hardware.security.keymint.PaddingMode paddingMode; + android.hardware.security.keymint.Digest digest; + android.hardware.security.keymint.EcCurve ecCurve; + android.hardware.security.keymint.KeyOrigin origin; + android.hardware.security.keymint.KeyPurpose keyPurpose; + android.hardware.security.keymint.HardwareAuthenticatorType hardwareAuthenticatorType; + android.hardware.security.keymint.SecurityLevel securityLevel; + boolean boolValue; + int integer; + long longInteger; + long dateTime; + byte[] blob; +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyPurpose.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyPurpose.aidl new file mode 100644 index 0000000000..b84bec1fc0 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/KeyPurpose.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2020 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 -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.hardware.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum KeyPurpose { + ENCRYPT = 0, + DECRYPT = 1, + SIGN = 2, + VERIFY = 3, + WRAP_KEY = 5, + AGREE_KEY = 6, + ATTEST_KEY = 7, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/PaddingMode.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/PaddingMode.aidl new file mode 100644 index 0000000000..dba4a8a06e --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/PaddingMode.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2020 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 -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.hardware.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum PaddingMode { + NONE = 1, + RSA_OAEP = 2, + RSA_PSS = 3, + RSA_PKCS1_1_5_ENCRYPT = 4, + RSA_PKCS1_1_5_SIGN = 5, + PKCS7 = 64, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/SecurityLevel.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/SecurityLevel.aidl new file mode 100644 index 0000000000..0d278e0af9 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/SecurityLevel.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2020 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 -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.hardware.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum SecurityLevel { + SOFTWARE = 0, + TRUSTED_ENVIRONMENT = 1, + STRONGBOX = 2, + KEYSTORE = 100, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/Tag.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/Tag.aidl new file mode 100644 index 0000000000..0d30c0aad1 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/Tag.aidl @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2020 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 -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.hardware.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum Tag { + INVALID = 0, + PURPOSE = (android.hardware.security.keymint.TagType.ENUM_REP | 1) /* 536870913 */, + ALGORITHM = (android.hardware.security.keymint.TagType.ENUM | 2) /* 268435458 */, + KEY_SIZE = (android.hardware.security.keymint.TagType.UINT | 3) /* 805306371 */, + BLOCK_MODE = (android.hardware.security.keymint.TagType.ENUM_REP | 4) /* 536870916 */, + DIGEST = (android.hardware.security.keymint.TagType.ENUM_REP | 5) /* 536870917 */, + PADDING = (android.hardware.security.keymint.TagType.ENUM_REP | 6) /* 536870918 */, + CALLER_NONCE = (android.hardware.security.keymint.TagType.BOOL | 7) /* 1879048199 */, + MIN_MAC_LENGTH = (android.hardware.security.keymint.TagType.UINT | 8) /* 805306376 */, + EC_CURVE = (android.hardware.security.keymint.TagType.ENUM | 10) /* 268435466 */, + RSA_PUBLIC_EXPONENT = (android.hardware.security.keymint.TagType.ULONG | 200) /* 1342177480 */, + INCLUDE_UNIQUE_ID = (android.hardware.security.keymint.TagType.BOOL | 202) /* 1879048394 */, + RSA_OAEP_MGF_DIGEST = (android.hardware.security.keymint.TagType.ENUM_REP | 203) /* 536871115 */, + BOOTLOADER_ONLY = (android.hardware.security.keymint.TagType.BOOL | 302) /* 1879048494 */, + ROLLBACK_RESISTANCE = (android.hardware.security.keymint.TagType.BOOL | 303) /* 1879048495 */, + HARDWARE_TYPE = (android.hardware.security.keymint.TagType.ENUM | 304) /* 268435760 */, + EARLY_BOOT_ONLY = (android.hardware.security.keymint.TagType.BOOL | 305) /* 1879048497 */, + ACTIVE_DATETIME = (android.hardware.security.keymint.TagType.DATE | 400) /* 1610613136 */, + ORIGINATION_EXPIRE_DATETIME = (android.hardware.security.keymint.TagType.DATE | 401) /* 1610613137 */, + USAGE_EXPIRE_DATETIME = (android.hardware.security.keymint.TagType.DATE | 402) /* 1610613138 */, + MIN_SECONDS_BETWEEN_OPS = (android.hardware.security.keymint.TagType.UINT | 403) /* 805306771 */, + MAX_USES_PER_BOOT = (android.hardware.security.keymint.TagType.UINT | 404) /* 805306772 */, + USAGE_COUNT_LIMIT = (android.hardware.security.keymint.TagType.UINT | 405) /* 805306773 */, + USER_ID = (android.hardware.security.keymint.TagType.UINT | 501) /* 805306869 */, + USER_SECURE_ID = (android.hardware.security.keymint.TagType.ULONG_REP | 502) /* -1610612234 */, + NO_AUTH_REQUIRED = (android.hardware.security.keymint.TagType.BOOL | 503) /* 1879048695 */, + USER_AUTH_TYPE = (android.hardware.security.keymint.TagType.ENUM | 504) /* 268435960 */, + AUTH_TIMEOUT = (android.hardware.security.keymint.TagType.UINT | 505) /* 805306873 */, + ALLOW_WHILE_ON_BODY = (android.hardware.security.keymint.TagType.BOOL | 506) /* 1879048698 */, + TRUSTED_USER_PRESENCE_REQUIRED = (android.hardware.security.keymint.TagType.BOOL | 507) /* 1879048699 */, + TRUSTED_CONFIRMATION_REQUIRED = (android.hardware.security.keymint.TagType.BOOL | 508) /* 1879048700 */, + UNLOCKED_DEVICE_REQUIRED = (android.hardware.security.keymint.TagType.BOOL | 509) /* 1879048701 */, + APPLICATION_ID = (android.hardware.security.keymint.TagType.BYTES | 601) /* -1879047591 */, + APPLICATION_DATA = (android.hardware.security.keymint.TagType.BYTES | 700) /* -1879047492 */, + CREATION_DATETIME = (android.hardware.security.keymint.TagType.DATE | 701) /* 1610613437 */, + ORIGIN = (android.hardware.security.keymint.TagType.ENUM | 702) /* 268436158 */, + ROOT_OF_TRUST = (android.hardware.security.keymint.TagType.BYTES | 704) /* -1879047488 */, + OS_VERSION = (android.hardware.security.keymint.TagType.UINT | 705) /* 805307073 */, + OS_PATCHLEVEL = (android.hardware.security.keymint.TagType.UINT | 706) /* 805307074 */, + UNIQUE_ID = (android.hardware.security.keymint.TagType.BYTES | 707) /* -1879047485 */, + ATTESTATION_CHALLENGE = (android.hardware.security.keymint.TagType.BYTES | 708) /* -1879047484 */, + ATTESTATION_APPLICATION_ID = (android.hardware.security.keymint.TagType.BYTES | 709) /* -1879047483 */, + ATTESTATION_ID_BRAND = (android.hardware.security.keymint.TagType.BYTES | 710) /* -1879047482 */, + ATTESTATION_ID_DEVICE = (android.hardware.security.keymint.TagType.BYTES | 711) /* -1879047481 */, + ATTESTATION_ID_PRODUCT = (android.hardware.security.keymint.TagType.BYTES | 712) /* -1879047480 */, + ATTESTATION_ID_SERIAL = (android.hardware.security.keymint.TagType.BYTES | 713) /* -1879047479 */, + ATTESTATION_ID_IMEI = (android.hardware.security.keymint.TagType.BYTES | 714) /* -1879047478 */, + ATTESTATION_ID_MEID = (android.hardware.security.keymint.TagType.BYTES | 715) /* -1879047477 */, + ATTESTATION_ID_MANUFACTURER = (android.hardware.security.keymint.TagType.BYTES | 716) /* -1879047476 */, + ATTESTATION_ID_MODEL = (android.hardware.security.keymint.TagType.BYTES | 717) /* -1879047475 */, + VENDOR_PATCHLEVEL = (android.hardware.security.keymint.TagType.UINT | 718) /* 805307086 */, + BOOT_PATCHLEVEL = (android.hardware.security.keymint.TagType.UINT | 719) /* 805307087 */, + DEVICE_UNIQUE_ATTESTATION = (android.hardware.security.keymint.TagType.BOOL | 720) /* 1879048912 */, + IDENTITY_CREDENTIAL_KEY = (android.hardware.security.keymint.TagType.BOOL | 721) /* 1879048913 */, + STORAGE_KEY = (android.hardware.security.keymint.TagType.BOOL | 722) /* 1879048914 */, + ATTESTATION_ID_SECOND_IMEI = (android.hardware.security.keymint.TagType.BYTES | 723) /* -1879047469 */, + ASSOCIATED_DATA = (android.hardware.security.keymint.TagType.BYTES | 1000) /* -1879047192 */, + NONCE = (android.hardware.security.keymint.TagType.BYTES | 1001) /* -1879047191 */, + MAC_LENGTH = (android.hardware.security.keymint.TagType.UINT | 1003) /* 805307371 */, + RESET_SINCE_ID_ROTATION = (android.hardware.security.keymint.TagType.BOOL | 1004) /* 1879049196 */, + CONFIRMATION_TOKEN = (android.hardware.security.keymint.TagType.BYTES | 1005) /* -1879047187 */, + CERTIFICATE_SERIAL = (android.hardware.security.keymint.TagType.BIGNUM | 1006) /* -2147482642 */, + CERTIFICATE_SUBJECT = (android.hardware.security.keymint.TagType.BYTES | 1007) /* -1879047185 */, + CERTIFICATE_NOT_BEFORE = (android.hardware.security.keymint.TagType.DATE | 1008) /* 1610613744 */, + CERTIFICATE_NOT_AFTER = (android.hardware.security.keymint.TagType.DATE | 1009) /* 1610613745 */, + MAX_BOOT_LEVEL = (android.hardware.security.keymint.TagType.UINT | 1010) /* 805307378 */, +} diff --git a/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/TagType.aidl b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/TagType.aidl new file mode 100644 index 0000000000..ca19e7ee27 --- /dev/null +++ b/security/keymint/aidl/aidl_api/android.hardware.security.keymint/3/android/hardware/security/keymint/TagType.aidl @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2020 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 -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.hardware.security.keymint; +/* @hide */ +@Backing(type="int") @VintfStability +enum TagType { + INVALID = (0 << 28) /* 0 */, + ENUM = (1 << 28) /* 268435456 */, + ENUM_REP = (2 << 28) /* 536870912 */, + UINT = (3 << 28) /* 805306368 */, + UINT_REP = (4 << 28) /* 1073741824 */, + ULONG = (5 << 28) /* 1342177280 */, + DATE = (6 << 28) /* 1610612736 */, + BOOL = (7 << 28) /* 1879048192 */, + BIGNUM = (8 << 28) /* -2147483648 */, + BYTES = (9 << 28) /* -1879048192 */, + ULONG_REP = (10 << 28) /* -1610612736 */, +} diff --git a/security/rkp/aidl/Android.bp b/security/rkp/aidl/Android.bp index 5285477519..e2ce649efb 100644 --- a/security/rkp/aidl/Android.bp +++ b/security/rkp/aidl/Android.bp @@ -37,5 +37,11 @@ aidl_interface { { version: "2", }, + { + version: "3", + imports: [], + }, + ], + frozen: true, } diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/.hash b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/.hash new file mode 100644 index 0000000000..85cefd9900 --- /dev/null +++ b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/.hash @@ -0,0 +1 @@ +7d14edbfab5c490efa407ba55fa80614bb48ae8e diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/android/hardware/security/keymint/DeviceInfo.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/android/hardware/security/keymint/DeviceInfo.aidl new file mode 100644 index 0000000000..d04d49cea8 --- /dev/null +++ b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/android/hardware/security/keymint/DeviceInfo.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.security.keymint; +/* @hide */ +@VintfStability +parcelable DeviceInfo { + byte[] deviceInfo; +} diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl new file mode 100644 index 0000000000..626ece8de2 --- /dev/null +++ b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2020 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 -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.hardware.security.keymint; +/* @hide */ +@VintfStability +interface IRemotelyProvisionedComponent { + android.hardware.security.keymint.RpcHardwareInfo getHardwareInfo(); + byte[] generateEcdsaP256KeyPair(in boolean testMode, out android.hardware.security.keymint.MacedPublicKey macedPublicKey); + byte[] generateCertificateRequest(in boolean testMode, in android.hardware.security.keymint.MacedPublicKey[] keysToSign, in byte[] endpointEncryptionCertChain, in byte[] challenge, out android.hardware.security.keymint.DeviceInfo deviceInfo, out android.hardware.security.keymint.ProtectedData protectedData); + byte[] generateCertificateRequestV2(in android.hardware.security.keymint.MacedPublicKey[] keysToSign, in byte[] challenge); + const int STATUS_FAILED = 1; + const int STATUS_INVALID_MAC = 2; + const int STATUS_PRODUCTION_KEY_IN_TEST_REQUEST = 3; + const int STATUS_TEST_KEY_IN_PRODUCTION_REQUEST = 4; + const int STATUS_INVALID_EEK = 5; + const int STATUS_REMOVED = 6; +} diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/android/hardware/security/keymint/MacedPublicKey.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/android/hardware/security/keymint/MacedPublicKey.aidl new file mode 100644 index 0000000000..8095e8ce04 --- /dev/null +++ b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/android/hardware/security/keymint/MacedPublicKey.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2020 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 -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.hardware.security.keymint; +/* @hide */ +@VintfStability +parcelable MacedPublicKey { + byte[] macedKey; +} diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/android/hardware/security/keymint/ProtectedData.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/android/hardware/security/keymint/ProtectedData.aidl new file mode 100644 index 0000000000..d1610b4d6f --- /dev/null +++ b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/android/hardware/security/keymint/ProtectedData.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.security.keymint; +/* @hide */ +@VintfStability +parcelable ProtectedData { + byte[] protectedData; +} diff --git a/security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/android/hardware/security/keymint/RpcHardwareInfo.aidl b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/android/hardware/security/keymint/RpcHardwareInfo.aidl new file mode 100644 index 0000000000..147331c1a9 --- /dev/null +++ b/security/rkp/aidl/aidl_api/android.hardware.security.rkp/3/android/hardware/security/keymint/RpcHardwareInfo.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2020 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 -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.hardware.security.keymint; +/* @hide */ +@RustDerive(Clone=true, Eq=true, Hash=true, Ord=true, PartialEq=true, PartialOrd=true) @VintfStability +parcelable RpcHardwareInfo { + int versionNumber; + @utf8InCpp String rpcAuthorName; + int supportedEekCurve = CURVE_NONE /* 0 */; + @nullable @utf8InCpp String uniqueId; + int supportedNumKeysInCsr = 4; + const int CURVE_NONE = 0; + const int CURVE_P256 = 1; + const int CURVE_25519 = 2; + const int MIN_SUPPORTED_NUM_KEYS_IN_CSR = 20; +} diff --git a/sensors/aidl/Android.bp b/sensors/aidl/Android.bp index 9673190731..3914ec1f7b 100644 --- a/sensors/aidl/Android.bp +++ b/sensors/aidl/Android.bp @@ -33,6 +33,15 @@ aidl_interface { "android.hardware.common.fmq-V1", ], }, + { + version: "2", + imports: [ + "android.hardware.common-V2", + "android.hardware.common.fmq-V1", + ], + }, + ], + frozen: true, } diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/2/.hash b/sensors/aidl/aidl_api/android.hardware.sensors/2/.hash new file mode 100644 index 0000000000..f04da9f6d9 --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/2/.hash @@ -0,0 +1 @@ +8cdc9f2ea08fd57e6c60a600fea28a51a2ff12f9 diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/AdditionalInfo.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/AdditionalInfo.aidl new file mode 100644 index 0000000000..a35b54ca38 --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/AdditionalInfo.aidl @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2021 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 -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.hardware.sensors; +@FixedSize @VintfStability +parcelable AdditionalInfo { + android.hardware.sensors.AdditionalInfo.AdditionalInfoType type; + int serial; + android.hardware.sensors.AdditionalInfo.AdditionalInfoPayload payload; + @FixedSize @VintfStability + union AdditionalInfoPayload { + android.hardware.sensors.AdditionalInfo.AdditionalInfoPayload.Int32Values dataInt32; + android.hardware.sensors.AdditionalInfo.AdditionalInfoPayload.FloatValues dataFloat; + @FixedSize @VintfStability + parcelable Int32Values { + int[14] values; + } + @FixedSize @VintfStability + parcelable FloatValues { + float[14] values; + } + } + @Backing(type="int") @VintfStability + enum AdditionalInfoType { + AINFO_BEGIN = 0, + AINFO_END = 1, + AINFO_UNTRACKED_DELAY = 0x10000, + AINFO_INTERNAL_TEMPERATURE, + AINFO_VEC3_CALIBRATION, + AINFO_SENSOR_PLACEMENT, + AINFO_SAMPLING, + AINFO_CHANNEL_NOISE = 0x20000, + AINFO_CHANNEL_SAMPLER, + AINFO_CHANNEL_FILTER, + AINFO_CHANNEL_LINEAR_TRANSFORM, + AINFO_CHANNEL_NONLINEAR_MAP, + AINFO_CHANNEL_RESAMPLER, + AINFO_LOCAL_GEOMAGNETIC_FIELD = 0x30000, + AINFO_LOCAL_GRAVITY, + AINFO_DOCK_STATE, + AINFO_HIGH_PERFORMANCE_MODE, + AINFO_MAGNETIC_FIELD_CALIBRATION, + AINFO_CUSTOM_START = 0x10000000, + AINFO_DEBUGGING_START = 0x40000000, + } +} diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/DynamicSensorInfo.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/DynamicSensorInfo.aidl new file mode 100644 index 0000000000..0c9a493a91 --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/DynamicSensorInfo.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.sensors; +@FixedSize @VintfStability +parcelable DynamicSensorInfo { + boolean connected; + int sensorHandle; + android.hardware.sensors.DynamicSensorInfo.Uuid uuid; + @FixedSize @VintfStability + parcelable Uuid { + byte[16] values; + } +} diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/Event.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/Event.aidl new file mode 100644 index 0000000000..4f49002fce --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/Event.aidl @@ -0,0 +1,139 @@ +/* + * Copyright (C) 2021 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 -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.hardware.sensors; +@FixedSize @VintfStability +parcelable Event { + long timestamp; + int sensorHandle; + android.hardware.sensors.SensorType sensorType; + android.hardware.sensors.Event.EventPayload payload; + @FixedSize @VintfStability + union EventPayload { + android.hardware.sensors.Event.EventPayload.Vec3 vec3; + android.hardware.sensors.Event.EventPayload.Vec4 vec4; + android.hardware.sensors.Event.EventPayload.Uncal uncal; + android.hardware.sensors.Event.EventPayload.MetaData meta; + float scalar; + long stepCount; + android.hardware.sensors.Event.EventPayload.HeartRate heartRate; + android.hardware.sensors.Event.EventPayload.Pose6Dof pose6DOF; + android.hardware.sensors.DynamicSensorInfo dynamic; + android.hardware.sensors.AdditionalInfo additional; + android.hardware.sensors.Event.EventPayload.Data data; + android.hardware.sensors.Event.EventPayload.HeadTracker headTracker; + android.hardware.sensors.Event.EventPayload.LimitedAxesImu limitedAxesImu; + android.hardware.sensors.Event.EventPayload.LimitedAxesImuUncal limitedAxesImuUncal; + android.hardware.sensors.Event.EventPayload.Heading heading; + @FixedSize @VintfStability + parcelable Vec4 { + float x; + float y; + float z; + float w; + } + @FixedSize @VintfStability + parcelable Vec3 { + float x; + float y; + float z; + android.hardware.sensors.SensorStatus status; + } + @FixedSize @VintfStability + parcelable Uncal { + float x; + float y; + float z; + float xBias; + float yBias; + float zBias; + } + @FixedSize @VintfStability + parcelable HeadTracker { + float rx; + float ry; + float rz; + float vx; + float vy; + float vz; + int discontinuityCount; + } + @FixedSize @VintfStability + parcelable LimitedAxesImu { + float x; + float y; + float z; + float xSupported; + float ySupported; + float zSupported; + } + @FixedSize @VintfStability + parcelable LimitedAxesImuUncal { + float x; + float y; + float z; + float xBias; + float yBias; + float zBias; + float xSupported; + float ySupported; + float zSupported; + } + @FixedSize @VintfStability + parcelable HeartRate { + float bpm; + android.hardware.sensors.SensorStatus status; + } + @FixedSize @VintfStability + parcelable Heading { + float heading; + float accuracy; + } + @FixedSize @VintfStability + parcelable MetaData { + android.hardware.sensors.Event.EventPayload.MetaData.MetaDataEventType what; + @Backing(type="int") @VintfStability + enum MetaDataEventType { + META_DATA_FLUSH_COMPLETE = 1, + } + } + @FixedSize @VintfStability + parcelable Pose6Dof { + float[15] values; + } + @FixedSize @VintfStability + parcelable Data { + float[16] values; + } + } +} diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/ISensors.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/ISensors.aidl new file mode 100644 index 0000000000..0566a64c3c --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/ISensors.aidl @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2021 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 -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.hardware.sensors; +@VintfStability +interface ISensors { + void activate(in int sensorHandle, in boolean enabled); + void batch(in int sensorHandle, in long samplingPeriodNs, in long maxReportLatencyNs); + int configDirectReport(in int sensorHandle, in int channelHandle, in android.hardware.sensors.ISensors.RateLevel rate); + void flush(in int sensorHandle); + android.hardware.sensors.SensorInfo[] getSensorsList(); + void initialize(in android.hardware.common.fmq.MQDescriptor eventQueueDescriptor, in android.hardware.common.fmq.MQDescriptor wakeLockDescriptor, in android.hardware.sensors.ISensorsCallback sensorsCallback); + void injectSensorData(in android.hardware.sensors.Event event); + int registerDirectChannel(in android.hardware.sensors.ISensors.SharedMemInfo mem); + void setOperationMode(in android.hardware.sensors.ISensors.OperationMode mode); + void unregisterDirectChannel(in int channelHandle); + const int ERROR_NO_MEMORY = (-12) /* -12 */; + const int ERROR_BAD_VALUE = (-22) /* -22 */; + const int WAKE_LOCK_TIMEOUT_SECONDS = 1; + const int EVENT_QUEUE_FLAG_BITS_READ_AND_PROCESS = (1 << 0) /* 1 */; + const int EVENT_QUEUE_FLAG_BITS_EVENTS_READ = (1 << 1) /* 2 */; + const int WAKE_LOCK_QUEUE_FLAG_BITS_DATA_WRITTEN = (1 << 0) /* 1 */; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_FIELD = 0x0; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_REPORT_TOKEN = 0x4; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_SENSOR_TYPE = 0x8; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_ATOMIC_COUNTER = 0xC; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_TIMESTAMP = 0x10; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_DATA = 0x18; + const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_RESERVED = 0x58; + const int DIRECT_REPORT_SENSOR_EVENT_TOTAL_LENGTH = 104; + const int RUNTIME_SENSORS_HANDLE_BASE = 0x5F000000; + const int RUNTIME_SENSORS_HANDLE_END = 0x5FFFFFFF; + @Backing(type="int") @VintfStability + enum RateLevel { + STOP, + NORMAL, + FAST, + VERY_FAST, + } + @Backing(type="int") @VintfStability + enum OperationMode { + NORMAL = 0, + DATA_INJECTION = 1, + } + @VintfStability + parcelable SharedMemInfo { + android.hardware.sensors.ISensors.SharedMemInfo.SharedMemType type; + android.hardware.sensors.ISensors.SharedMemInfo.SharedMemFormat format; + int size; + android.hardware.common.NativeHandle memoryHandle; + @Backing(type="int") @VintfStability + enum SharedMemFormat { + SENSORS_EVENT = 1, + } + @Backing(type="int") @VintfStability + enum SharedMemType { + ASHMEM = 1, + GRALLOC, + } + } +} diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/ISensorsCallback.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/ISensorsCallback.aidl new file mode 100644 index 0000000000..78ab56711b --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/ISensorsCallback.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.sensors; +@VintfStability +interface ISensorsCallback { + void onDynamicSensorsConnected(in android.hardware.sensors.SensorInfo[] sensorInfos); + void onDynamicSensorsDisconnected(in int[] sensorHandles); +} diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/SensorInfo.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/SensorInfo.aidl new file mode 100644 index 0000000000..677e6c4e39 --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/SensorInfo.aidl @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2021 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 -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.hardware.sensors; +@VintfStability +parcelable SensorInfo { + int sensorHandle; + String name; + String vendor; + int version; + android.hardware.sensors.SensorType type; + String typeAsString; + float maxRange; + float resolution; + float power; + int minDelayUs; + int fifoReservedEventCount; + int fifoMaxEventCount; + String requiredPermission; + int maxDelayUs; + int flags; + const int SENSOR_FLAG_BITS_WAKE_UP = 1; + const int SENSOR_FLAG_BITS_CONTINUOUS_MODE = 0; + const int SENSOR_FLAG_BITS_ON_CHANGE_MODE = 2; + const int SENSOR_FLAG_BITS_ONE_SHOT_MODE = 4; + const int SENSOR_FLAG_BITS_SPECIAL_REPORTING_MODE = 6; + const int SENSOR_FLAG_BITS_DATA_INJECTION = 0x10; + const int SENSOR_FLAG_BITS_DYNAMIC_SENSOR = 0x20; + const int SENSOR_FLAG_BITS_ADDITIONAL_INFO = 0x40; + const int SENSOR_FLAG_BITS_DIRECT_CHANNEL_ASHMEM = 0x400; + const int SENSOR_FLAG_BITS_DIRECT_CHANNEL_GRALLOC = 0x800; + const int SENSOR_FLAG_BITS_MASK_REPORTING_MODE = 0xE; + const int SENSOR_FLAG_BITS_MASK_DIRECT_REPORT = 0x380; + const int SENSOR_FLAG_BITS_MASK_DIRECT_CHANNEL = 0xC00; + const int SENSOR_FLAG_SHIFT_REPORTING_MODE = 1; + const int SENSOR_FLAG_SHIFT_DATA_INJECTION = 4; + const int SENSOR_FLAG_SHIFT_DYNAMIC_SENSOR = 5; + const int SENSOR_FLAG_SHIFT_ADDITIONAL_INFO = 6; + const int SENSOR_FLAG_SHIFT_DIRECT_REPORT = 7; + const int SENSOR_FLAG_SHIFT_DIRECT_CHANNEL = 10; +} diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/SensorStatus.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/SensorStatus.aidl new file mode 100644 index 0000000000..f401dac04c --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/SensorStatus.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.sensors; +@Backing(type="byte") @VintfStability +enum SensorStatus { + NO_CONTACT = (-1) /* -1 */, + UNRELIABLE = 0, + ACCURACY_LOW = 1, + ACCURACY_MEDIUM = 2, + ACCURACY_HIGH = 3, +} diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/SensorType.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/SensorType.aidl new file mode 100644 index 0000000000..0639f131c5 --- /dev/null +++ b/sensors/aidl/aidl_api/android.hardware.sensors/2/android/hardware/sensors/SensorType.aidl @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2021 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 -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.hardware.sensors; +@Backing(type="int") @VintfStability +enum SensorType { + META_DATA = 0, + ACCELEROMETER = 1, + MAGNETIC_FIELD = 2, + ORIENTATION = 3, + GYROSCOPE = 4, + LIGHT = 5, + PRESSURE = 6, + PROXIMITY = 8, + GRAVITY = 9, + LINEAR_ACCELERATION = 10, + ROTATION_VECTOR = 11, + RELATIVE_HUMIDITY = 12, + AMBIENT_TEMPERATURE = 13, + MAGNETIC_FIELD_UNCALIBRATED = 14, + GAME_ROTATION_VECTOR = 15, + GYROSCOPE_UNCALIBRATED = 16, + SIGNIFICANT_MOTION = 17, + STEP_DETECTOR = 18, + STEP_COUNTER = 19, + GEOMAGNETIC_ROTATION_VECTOR = 20, + HEART_RATE = 21, + TILT_DETECTOR = 22, + WAKE_GESTURE = 23, + GLANCE_GESTURE = 24, + PICK_UP_GESTURE = 25, + WRIST_TILT_GESTURE = 26, + DEVICE_ORIENTATION = 27, + POSE_6DOF = 28, + STATIONARY_DETECT = 29, + MOTION_DETECT = 30, + HEART_BEAT = 31, + DYNAMIC_SENSOR_META = 32, + ADDITIONAL_INFO = 33, + LOW_LATENCY_OFFBODY_DETECT = 34, + ACCELEROMETER_UNCALIBRATED = 35, + HINGE_ANGLE = 36, + HEAD_TRACKER = 37, + ACCELEROMETER_LIMITED_AXES = 38, + GYROSCOPE_LIMITED_AXES = 39, + ACCELEROMETER_LIMITED_AXES_UNCALIBRATED = 40, + GYROSCOPE_LIMITED_AXES_UNCALIBRATED = 41, + HEADING = 42, + DEVICE_PRIVATE_BASE = 0x10000, +} diff --git a/thermal/aidl/Android.bp b/thermal/aidl/Android.bp index b132746d81..efc763c388 100644 --- a/thermal/aidl/Android.bp +++ b/thermal/aidl/Android.bp @@ -36,4 +36,12 @@ aidl_interface { platform_apis: true, }, }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + frozen: true, + } diff --git a/thermal/aidl/aidl_api/android.hardware.thermal/1/.hash b/thermal/aidl/aidl_api/android.hardware.thermal/1/.hash new file mode 100644 index 0000000000..1a9e33bc2b --- /dev/null +++ b/thermal/aidl/aidl_api/android.hardware.thermal/1/.hash @@ -0,0 +1 @@ +76e77ca374a7860f09aeac48e98b2ec61f576767 diff --git a/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/CoolingDevice.aidl b/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/CoolingDevice.aidl new file mode 100644 index 0000000000..dff3c4cc49 --- /dev/null +++ b/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/CoolingDevice.aidl @@ -0,0 +1,41 @@ +/* + * 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 + * +1 * 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 -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.hardware.thermal; +/* @hide */ +@JavaDerive(toString=true) @VintfStability +parcelable CoolingDevice { + android.hardware.thermal.CoolingType type; + String name; + long value; +} diff --git a/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/CoolingType.aidl b/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/CoolingType.aidl new file mode 100644 index 0000000000..1f87cf29ae --- /dev/null +++ b/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/CoolingType.aidl @@ -0,0 +1,49 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.thermal; +/* @hide */ +@Backing(type="int") @VintfStability +enum CoolingType { + FAN, + BATTERY, + CPU, + GPU, + MODEM, + NPU, + COMPONENT, + TPU, + POWER_AMPLIFIER, + DISPLAY, + SPEAKER, +} diff --git a/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/IThermal.aidl b/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/IThermal.aidl new file mode 100644 index 0000000000..c9b6cab364 --- /dev/null +++ b/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/IThermal.aidl @@ -0,0 +1,47 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.thermal; +/* @hide */ +@VintfStability +interface IThermal { + android.hardware.thermal.CoolingDevice[] getCoolingDevices(); + android.hardware.thermal.CoolingDevice[] getCoolingDevicesWithType(in android.hardware.thermal.CoolingType type); + android.hardware.thermal.Temperature[] getTemperatures(); + android.hardware.thermal.Temperature[] getTemperaturesWithType(in android.hardware.thermal.TemperatureType type); + android.hardware.thermal.TemperatureThreshold[] getTemperatureThresholds(); + android.hardware.thermal.TemperatureThreshold[] getTemperatureThresholdsWithType(in android.hardware.thermal.TemperatureType type); + void registerThermalChangedCallback(in android.hardware.thermal.IThermalChangedCallback callback); + void registerThermalChangedCallbackWithType(in android.hardware.thermal.IThermalChangedCallback callback, in android.hardware.thermal.TemperatureType type); + void unregisterThermalChangedCallback(in android.hardware.thermal.IThermalChangedCallback callback); +} diff --git a/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/IThermalChangedCallback.aidl b/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/IThermalChangedCallback.aidl new file mode 100644 index 0000000000..5e1d753d18 --- /dev/null +++ b/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/IThermalChangedCallback.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.thermal; +/* @hide */ +@VintfStability +interface IThermalChangedCallback { + oneway void notifyThrottling(in android.hardware.thermal.Temperature temperature); +} diff --git a/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/Temperature.aidl b/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/Temperature.aidl new file mode 100644 index 0000000000..ce70ab844f --- /dev/null +++ b/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/Temperature.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.thermal; +/* @hide */ +@JavaDerive(toString=true) @VintfStability +parcelable Temperature { + android.hardware.thermal.TemperatureType type; + String name; + float value; + android.hardware.thermal.ThrottlingSeverity throttlingStatus; +} diff --git a/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/TemperatureThreshold.aidl b/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/TemperatureThreshold.aidl new file mode 100644 index 0000000000..a384d19600 --- /dev/null +++ b/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/TemperatureThreshold.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.thermal; +/* @hide */ +@JavaDerive(toString=true) @VintfStability +parcelable TemperatureThreshold { + android.hardware.thermal.TemperatureType type; + String name; + float[] hotThrottlingThresholds; + float[] coldThrottlingThresholds; +} diff --git a/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/TemperatureType.aidl b/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/TemperatureType.aidl new file mode 100644 index 0000000000..fb0b0b3e7b --- /dev/null +++ b/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/TemperatureType.aidl @@ -0,0 +1,53 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.thermal; +/* @hide */ +@Backing(type="int") @VintfStability +enum TemperatureType { + UNKNOWN = (-1) /* -1 */, + CPU = 0, + GPU = 1, + BATTERY = 2, + SKIN = 3, + USB_PORT = 4, + POWER_AMPLIFIER = 5, + BCL_VOLTAGE = 6, + BCL_CURRENT = 7, + BCL_PERCENTAGE = 8, + NPU = 9, + TPU = 10, + DISPLAY = 11, + MODEM = 12, + SOC = 13, +} diff --git a/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/ThrottlingSeverity.aidl b/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/ThrottlingSeverity.aidl new file mode 100644 index 0000000000..183344d45b --- /dev/null +++ b/thermal/aidl/aidl_api/android.hardware.thermal/1/android/hardware/thermal/ThrottlingSeverity.aidl @@ -0,0 +1,45 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.thermal; +/* @hide */ +@Backing(type="int") @VintfStability +enum ThrottlingSeverity { + NONE = 0, + LIGHT, + MODERATE, + SEVERE, + CRITICAL, + EMERGENCY, + SHUTDOWN, +} diff --git a/tv/hdmi/cec/aidl/Android.bp b/tv/hdmi/cec/aidl/Android.bp index 1bd9e41a9d..53cb5a9246 100644 --- a/tv/hdmi/cec/aidl/Android.bp +++ b/tv/hdmi/cec/aidl/Android.bp @@ -26,4 +26,12 @@ aidl_interface { sdk_version: "module_current", }, }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + frozen: true, + } diff --git a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/.hash b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/.hash new file mode 100644 index 0000000000..8a30199a90 --- /dev/null +++ b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/.hash @@ -0,0 +1 @@ +cd956e3a0c2e6ade71693c85e9f0aeffa221ea26 diff --git a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/AbortReason.aidl b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/AbortReason.aidl new file mode 100644 index 0000000000..45b973a74f --- /dev/null +++ b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/AbortReason.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.hdmi.cec; +@Backing(type="int") @VintfStability +enum AbortReason { + UNRECOGNIZED_MODE = 0, + NOT_IN_CORRECT_MODE = 1, + CANNOT_PROVIDE_SOURCE = 2, + INVALID_OPERAND = 3, + REFUSED = 4, + UNABLE_TO_DETERMINE = 5, +} diff --git a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/CecDeviceType.aidl b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/CecDeviceType.aidl new file mode 100644 index 0000000000..4f7e247bf7 --- /dev/null +++ b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/CecDeviceType.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.hdmi.cec; +@Backing(type="byte") @VintfStability +enum CecDeviceType { + INACTIVE = (-1) /* -1 */, + TV = 0, + RECORDER = 1, + TUNER = 3, + PLAYBACK = 4, + AUDIO_SYSTEM = 5, +} diff --git a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/CecLogicalAddress.aidl b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/CecLogicalAddress.aidl new file mode 100644 index 0000000000..1fc9fb7eee --- /dev/null +++ b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/CecLogicalAddress.aidl @@ -0,0 +1,54 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.hdmi.cec; +@Backing(type="byte") @VintfStability +enum CecLogicalAddress { + TV = 0, + RECORDER_1 = 1, + RECORDER_2 = 2, + TUNER_1 = 3, + PLAYBACK_1 = 4, + AUDIO_SYSTEM = 5, + TUNER_2 = 6, + TUNER_3 = 7, + PLAYBACK_2 = 8, + RECORDER_3 = 9, + TUNER_4 = 10, + PLAYBACK_3 = 11, + BACKUP_1 = 12, + BACKUP_2 = 13, + FREE_USE = 14, + BROADCAST = 15, + UNREGISTERED = 15, +} diff --git a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/CecMessage.aidl b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/CecMessage.aidl new file mode 100644 index 0000000000..9de07ec8c8 --- /dev/null +++ b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/CecMessage.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.hdmi.cec; +@VintfStability +parcelable CecMessage { + android.hardware.tv.hdmi.cec.CecLogicalAddress initiator; + android.hardware.tv.hdmi.cec.CecLogicalAddress destination; + byte[] body; + const int MAX_MESSAGE_BODY_LENGTH = 15; +} diff --git a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/CecMessageType.aidl b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/CecMessageType.aidl new file mode 100644 index 0000000000..20472f0192 --- /dev/null +++ b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/CecMessageType.aidl @@ -0,0 +1,111 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.hdmi.cec; +@Backing(type="int") @VintfStability +enum CecMessageType { + FEATURE_ABORT = 0x00, + IMAGE_VIEW_ON = 0x04, + TUNER_STEP_INCREMENT = 0x05, + TUNER_STEP_DECREMENT = 0x06, + TUNER_DEVICE_STATUS = 0x07, + GIVE_TUNER_DEVICE_STATUS = 0x08, + RECORD_ON = 0x09, + RECORD_STATUS = 0x0A, + RECORD_OFF = 0x0B, + TEXT_VIEW_ON = 0x0D, + RECORD_TV_SCREEN = 0x0F, + GIVE_DECK_STATUS = 0x1A, + DECK_STATUS = 0x1B, + SET_MENU_LANGUAGE = 0x32, + CLEAR_ANALOG_TIMER = 0x33, + SET_ANALOG_TIMER = 0x34, + TIMER_STATUS = 0x35, + STANDBY = 0x36, + PLAY = 0x41, + DECK_CONTROL = 0x42, + TIMER_CLEARED_STATUS = 0x43, + USER_CONTROL_PRESSED = 0x44, + USER_CONTROL_RELEASED = 0x45, + GIVE_OSD_NAME = 0x46, + SET_OSD_NAME = 0x47, + SET_OSD_STRING = 0x64, + SET_TIMER_PROGRAM_TITLE = 0x67, + SYSTEM_AUDIO_MODE_REQUEST = 0x70, + GIVE_AUDIO_STATUS = 0x71, + SET_SYSTEM_AUDIO_MODE = 0x72, + REPORT_AUDIO_STATUS = 0x7A, + GIVE_SYSTEM_AUDIO_MODE_STATUS = 0x7D, + SYSTEM_AUDIO_MODE_STATUS = 0x7E, + ROUTING_CHANGE = 0x80, + ROUTING_INFORMATION = 0x81, + ACTIVE_SOURCE = 0x82, + GIVE_PHYSICAL_ADDRESS = 0x83, + REPORT_PHYSICAL_ADDRESS = 0x84, + REQUEST_ACTIVE_SOURCE = 0x85, + SET_STREAM_PATH = 0x86, + DEVICE_VENDOR_ID = 0x87, + VENDOR_COMMAND = 0x89, + VENDOR_REMOTE_BUTTON_DOWN = 0x8A, + VENDOR_REMOTE_BUTTON_UP = 0x8B, + GIVE_DEVICE_VENDOR_ID = 0x8C, + MENU_REQUEST = 0x8D, + MENU_STATUS = 0x8E, + GIVE_DEVICE_POWER_STATUS = 0x8F, + REPORT_POWER_STATUS = 0x90, + GET_MENU_LANGUAGE = 0x91, + SELECT_ANALOG_SERVICE = 0x92, + SELECT_DIGITAL_SERVICE = 0x93, + SET_DIGITAL_TIMER = 0x97, + CLEAR_DIGITAL_TIMER = 0x99, + SET_AUDIO_RATE = 0x9A, + INACTIVE_SOURCE = 0x9D, + CEC_VERSION = 0x9E, + GET_CEC_VERSION = 0x9F, + VENDOR_COMMAND_WITH_ID = 0xA0, + CLEAR_EXTERNAL_TIMER = 0xA1, + SET_EXTERNAL_TIMER = 0xA2, + REPORT_SHORT_AUDIO_DESCRIPTOR = 0xA3, + REQUEST_SHORT_AUDIO_DESCRIPTOR = 0xA4, + INITIATE_ARC = 0xC0, + REPORT_ARC_INITIATED = 0xC1, + REPORT_ARC_TERMINATED = 0xC2, + REQUEST_ARC_INITIATION = 0xC3, + REQUEST_ARC_TERMINATION = 0xC4, + TERMINATE_ARC = 0xC5, + ABORT = 0xFF, + GIVE_FEATURES = 0xA5, + REPORT_FEATURES = 0xA6, + REQUEST_CURRENT_LATENCY = 0xA7, + REPORT_CURRENT_LATENCY = 0xA8, +} diff --git a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/IHdmiCec.aidl b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/IHdmiCec.aidl new file mode 100644 index 0000000000..c6060d1f47 --- /dev/null +++ b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/IHdmiCec.aidl @@ -0,0 +1,49 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.hdmi.cec; +@VintfStability +interface IHdmiCec { + android.hardware.tv.hdmi.cec.Result addLogicalAddress(in android.hardware.tv.hdmi.cec.CecLogicalAddress addr); + void clearLogicalAddress(); + void enableAudioReturnChannel(in int portId, in boolean enable); + int getCecVersion(); + int getPhysicalAddress(); + int getVendorId(); + android.hardware.tv.hdmi.cec.SendMessageResult sendMessage(in android.hardware.tv.hdmi.cec.CecMessage message); + void setCallback(in @nullable android.hardware.tv.hdmi.cec.IHdmiCecCallback callback); + void setLanguage(in String language); + void enableWakeupByOtp(in boolean value); + void enableCec(in boolean value); + void enableSystemCecControl(in boolean value); +} diff --git a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/IHdmiCecCallback.aidl b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/IHdmiCecCallback.aidl new file mode 100644 index 0000000000..43fdfbdb21 --- /dev/null +++ b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/IHdmiCecCallback.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.hdmi.cec; +@VintfStability +interface IHdmiCecCallback { + oneway void onCecMessage(in android.hardware.tv.hdmi.cec.CecMessage message); +} diff --git a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/Result.aidl b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/Result.aidl new file mode 100644 index 0000000000..c6828efb4e --- /dev/null +++ b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/Result.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.hdmi.cec; +@Backing(type="byte") @VintfStability +enum Result { + SUCCESS = 0, + FAILURE_UNKNOWN = 1, + FAILURE_INVALID_ARGS = 2, + FAILURE_INVALID_STATE = 3, + FAILURE_NOT_SUPPORTED = 4, + FAILURE_BUSY = 5, +} diff --git a/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/SendMessageResult.aidl b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/SendMessageResult.aidl new file mode 100644 index 0000000000..87b50c9af1 --- /dev/null +++ b/tv/hdmi/cec/aidl/aidl_api/android.hardware.tv.hdmi.cec/1/android/hardware/tv/hdmi/cec/SendMessageResult.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.hdmi.cec; +@Backing(type="byte") @VintfStability +enum SendMessageResult { + SUCCESS = 0, + NACK = 1, + BUSY = 2, + FAIL = 3, +} diff --git a/tv/hdmi/connection/aidl/Android.bp b/tv/hdmi/connection/aidl/Android.bp index b342c52424..ff7e166b9e 100644 --- a/tv/hdmi/connection/aidl/Android.bp +++ b/tv/hdmi/connection/aidl/Android.bp @@ -26,4 +26,12 @@ aidl_interface { sdk_version: "module_current", }, }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + frozen: true, + } diff --git a/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/.hash b/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/.hash new file mode 100644 index 0000000000..e11a015a88 --- /dev/null +++ b/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/.hash @@ -0,0 +1 @@ +85c26fa47f3c3062aa93ffc8bb0897a85c8cb118 diff --git a/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl b/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl new file mode 100644 index 0000000000..ac35c99f97 --- /dev/null +++ b/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.hdmi.connection; +@VintfStability +parcelable HdmiPortInfo { + android.hardware.tv.hdmi.connection.HdmiPortType type; + int portId; + boolean cecSupported; + boolean arcSupported; + boolean eArcSupported; + int physicalAddress; +} diff --git a/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/HdmiPortType.aidl b/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/HdmiPortType.aidl new file mode 100644 index 0000000000..fc2d7e5290 --- /dev/null +++ b/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/HdmiPortType.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.hdmi.connection; +@Backing(type="byte") @VintfStability +enum HdmiPortType { + INPUT = 0, + OUTPUT = 1, +} diff --git a/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/HpdSignal.aidl b/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/HpdSignal.aidl new file mode 100644 index 0000000000..697da2955d --- /dev/null +++ b/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/HpdSignal.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.hdmi.connection; +@Backing(type="byte") @VintfStability +enum HpdSignal { + HDMI_HPD_PHYSICAL = 0, + HDMI_HPD_STATUS_BIT = 1, +} diff --git a/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/IHdmiConnection.aidl b/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/IHdmiConnection.aidl new file mode 100644 index 0000000000..cf7c4bdb5e --- /dev/null +++ b/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/IHdmiConnection.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.hdmi.connection; +@VintfStability +interface IHdmiConnection { + android.hardware.tv.hdmi.connection.HdmiPortInfo[] getPortInfo(); + boolean isConnected(in int portId); + void setCallback(in android.hardware.tv.hdmi.connection.IHdmiConnectionCallback callback); + void setHpdSignal(android.hardware.tv.hdmi.connection.HpdSignal signal, in int portId); + android.hardware.tv.hdmi.connection.HpdSignal getHpdSignal(in int portId); +} diff --git a/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/IHdmiConnectionCallback.aidl b/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/IHdmiConnectionCallback.aidl new file mode 100644 index 0000000000..f9f6856197 --- /dev/null +++ b/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/IHdmiConnectionCallback.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.hdmi.connection; +@VintfStability +interface IHdmiConnectionCallback { + oneway void onHotplugEvent(in boolean connected, in int portId); +} diff --git a/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/Result.aidl b/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/Result.aidl new file mode 100644 index 0000000000..93182c51f2 --- /dev/null +++ b/tv/hdmi/connection/aidl/aidl_api/android.hardware.tv.hdmi.connection/1/android/hardware/tv/hdmi/connection/Result.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.hdmi.connection; +@VintfStability +enum Result { + SUCCESS = 0, + FAILURE_UNKNOWN = 1, + FAILURE_INVALID_ARGS = 2, + FAILURE_INVALID_STATE = 3, + FAILURE_NOT_SUPPORTED = 4, +} diff --git a/tv/hdmi/earc/aidl/Android.bp b/tv/hdmi/earc/aidl/Android.bp index d76cc1bb34..d08e46d9a3 100644 --- a/tv/hdmi/earc/aidl/Android.bp +++ b/tv/hdmi/earc/aidl/Android.bp @@ -27,4 +27,12 @@ aidl_interface { sdk_version: "module_current", }, }, + versions_with_info: [ + { + version: "1", + imports: ["android.hardware.tv.hdmi.connection-V1"], + }, + ], + frozen: true, + } diff --git a/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/1/.hash b/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/1/.hash new file mode 100644 index 0000000000..856086ea9d --- /dev/null +++ b/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/1/.hash @@ -0,0 +1 @@ +101230f18c7b8438921e517e80eea4ccc7c1e463 diff --git a/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/1/android/hardware/tv/hdmi/earc/IEArc.aidl b/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/1/android/hardware/tv/hdmi/earc/IEArc.aidl new file mode 100644 index 0000000000..1ea7df75a8 --- /dev/null +++ b/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/1/android/hardware/tv/hdmi/earc/IEArc.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.hdmi.earc; +@VintfStability +interface IEArc { + void setEArcEnabled(in boolean enabled); + boolean isEArcEnabled(); + void setCallback(in android.hardware.tv.hdmi.earc.IEArcCallback callback); + android.hardware.tv.hdmi.earc.IEArcStatus getState(in int portId); + byte[] getLastReportedAudioCapabilities(in int portId); +} diff --git a/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/1/android/hardware/tv/hdmi/earc/IEArcCallback.aidl b/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/1/android/hardware/tv/hdmi/earc/IEArcCallback.aidl new file mode 100644 index 0000000000..1730dcf1bc --- /dev/null +++ b/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/1/android/hardware/tv/hdmi/earc/IEArcCallback.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.hdmi.earc; +@VintfStability +interface IEArcCallback { + oneway void onStateChange(in android.hardware.tv.hdmi.earc.IEArcStatus status, in int portId); + oneway void onCapabilitiesReported(in byte[] rawCapabilities, in int portId); +} diff --git a/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/1/android/hardware/tv/hdmi/earc/IEArcStatus.aidl b/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/1/android/hardware/tv/hdmi/earc/IEArcStatus.aidl new file mode 100644 index 0000000000..6dcbd8d49e --- /dev/null +++ b/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/1/android/hardware/tv/hdmi/earc/IEArcStatus.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.hdmi.earc; +@Backing(type="byte") @VintfStability +enum IEArcStatus { + IDLE = 0, + EARC_PENDING = 1, + ARC_PENDING = 2, + EARC_CONNECTED = 3, +} diff --git a/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/1/android/hardware/tv/hdmi/earc/Result.aidl b/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/1/android/hardware/tv/hdmi/earc/Result.aidl new file mode 100644 index 0000000000..b248f41f40 --- /dev/null +++ b/tv/hdmi/earc/aidl/aidl_api/android.hardware.tv.hdmi.earc/1/android/hardware/tv/hdmi/earc/Result.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.hdmi.earc; +@VintfStability +enum Result { + SUCCESS = 0, + FAILURE_UNKNOWN = 1, + FAILURE_INVALID_ARGS = 2, + FAILURE_NOT_SUPPORTED = 4, +} diff --git a/tv/input/aidl/Android.bp b/tv/input/aidl/Android.bp index 2591151fe8..35f510a162 100644 --- a/tv/input/aidl/Android.bp +++ b/tv/input/aidl/Android.bp @@ -25,4 +25,16 @@ aidl_interface { enabled: false, }, }, + versions_with_info: [ + { + version: "1", + imports: [ + "android.hardware.common-V2", + "android.media.audio.common.types-V1", + "android.hardware.common.fmq-V1", + ], + }, + ], + frozen: true, + } diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/1/.hash b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/.hash new file mode 100644 index 0000000000..0bd248bcf0 --- /dev/null +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/.hash @@ -0,0 +1 @@ +b247370748c1e172b1279ecdc6d23d14b225bbdc diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/CableConnectionStatus.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/CableConnectionStatus.aidl new file mode 100644 index 0000000000..a48bdb11c6 --- /dev/null +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/CableConnectionStatus.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.input; +@Backing(type="int") @VintfStability +enum CableConnectionStatus { + UNKNOWN = 0, + CONNECTED = 1, + DISCONNECTED = 2, +} diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/ITvInput.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/ITvInput.aidl new file mode 100644 index 0000000000..84fe2fb7d7 --- /dev/null +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/ITvInput.aidl @@ -0,0 +1,47 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.input; +@VintfStability +interface ITvInput { + void closeStream(in int deviceId, in int streamId); + android.hardware.tv.input.TvStreamConfig[] getStreamConfigurations(in int deviceId); + android.hardware.common.NativeHandle openStream(in int deviceId, in int streamId); + void setCallback(in android.hardware.tv.input.ITvInputCallback callback); + void setTvMessageEnabled(int deviceId, int streamId, in android.hardware.tv.input.TvMessageEventType type, boolean enabled); + void getTvMessageQueueDesc(out android.hardware.common.fmq.MQDescriptor queue, int deviceId, int streamId); + const int STATUS_UNKNOWN = 1; + const int STATUS_NO_RESOURCE = 2; + const int STATUS_INVALID_ARGUMENTS = 3; + const int STATUS_INVALID_STATE = 4; +} diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/ITvInputCallback.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/ITvInputCallback.aidl new file mode 100644 index 0000000000..974701341c --- /dev/null +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/ITvInputCallback.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.input; +@VintfStability +interface ITvInputCallback { + void notify(in android.hardware.tv.input.TvInputEvent event); + void notifyTvMessageEvent(in android.hardware.tv.input.TvMessageEvent event); +} diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvInputDeviceInfo.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvInputDeviceInfo.aidl new file mode 100644 index 0000000000..d0951467be --- /dev/null +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvInputDeviceInfo.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.input; +@VintfStability +parcelable TvInputDeviceInfo { + int deviceId; + android.hardware.tv.input.TvInputType type; + int portId; + android.hardware.tv.input.CableConnectionStatus cableConnectionStatus; + android.media.audio.common.AudioDevice audioDevice; +} diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvInputEvent.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvInputEvent.aidl new file mode 100644 index 0000000000..cfa8a34c9e --- /dev/null +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvInputEvent.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.input; +@VintfStability +parcelable TvInputEvent { + android.hardware.tv.input.TvInputEventType type; + android.hardware.tv.input.TvInputDeviceInfo deviceInfo; +} diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvInputEventType.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvInputEventType.aidl new file mode 100644 index 0000000000..a9f518ac85 --- /dev/null +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvInputEventType.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.input; +@Backing(type="int") @VintfStability +enum TvInputEventType { + DEVICE_AVAILABLE = 1, + DEVICE_UNAVAILABLE = 2, + STREAM_CONFIGURATIONS_CHANGED = 3, +} diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvInputType.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvInputType.aidl new file mode 100644 index 0000000000..7e44a7d653 --- /dev/null +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvInputType.aidl @@ -0,0 +1,47 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.input; +@Backing(type="int") @VintfStability +enum TvInputType { + OTHER = 1, + TUNER = 2, + COMPOSITE = 3, + SVIDEO = 4, + SCART = 5, + COMPONENT = 6, + VGA = 7, + DVI = 8, + HDMI = 9, + DISPLAY_PORT = 10, +} diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvMessage.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvMessage.aidl new file mode 100644 index 0000000000..04cb099f97 --- /dev/null +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvMessage.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.input; +@VintfStability +parcelable TvMessage { + String subType; + long groupId; + int dataLengthBytes; + const long NO_GROUP_ID = (-1) /* -1 */; +} diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvMessageEvent.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvMessageEvent.aidl new file mode 100644 index 0000000000..94fe665d1d --- /dev/null +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvMessageEvent.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.input; +@VintfStability +parcelable TvMessageEvent { + android.hardware.tv.input.TvMessageEventType type; + int streamId; + android.hardware.tv.input.TvMessage[] messages; +} diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvMessageEventType.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvMessageEventType.aidl new file mode 100644 index 0000000000..3006198c68 --- /dev/null +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvMessageEventType.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.input; +@Backing(type="int") @VintfStability +enum TvMessageEventType { + WATERMARK = 1, + CLOSED_CAPTION = 2, + OTHER = 1000, +} diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvStreamConfig.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvStreamConfig.aidl new file mode 100644 index 0000000000..8378ff3a87 --- /dev/null +++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/1/android/hardware/tv/input/TvStreamConfig.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.input; +@VintfStability +parcelable TvStreamConfig { + int streamId; + int maxVideoWidth; + int maxVideoHeight; +} diff --git a/tv/tuner/aidl/Android.bp b/tv/tuner/aidl/Android.bp index ecb744ccbf..6cbf362f53 100644 --- a/tv/tuner/aidl/Android.bp +++ b/tv/tuner/aidl/Android.bp @@ -32,6 +32,15 @@ aidl_interface { "android.hardware.common.fmq-V1", ], }, + { + version: "2", + imports: [ + "android.hardware.common-V2", + "android.hardware.common.fmq-V1", + ], + }, + ], + frozen: true, } diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/.hash b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/.hash new file mode 100644 index 0000000000..59f22f4eec --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/.hash @@ -0,0 +1 @@ +f8d74c149f04e76b6d622db2bd8e465dae24b08c diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioExtraMetaData.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioExtraMetaData.aidl new file mode 100644 index 0000000000..9db960926b --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioExtraMetaData.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable AudioExtraMetaData { + byte adFade; + byte adPan; + char versionTextTag; + byte adGainCenter; + byte adGainFront; + byte adGainSurround; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioPreselection.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioPreselection.aidl new file mode 100644 index 0000000000..ab0404e875 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioPreselection.aidl @@ -0,0 +1,45 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable AudioPreselection { + int preselectionId; + android.hardware.tv.tuner.AudioPreselectionLabel[] labels; + String language; + android.hardware.tv.tuner.AudioPreselectionRenderingIndicationType renderingIndication; + boolean hasAudioDescription; + boolean hasSpokenSubtitles; + boolean hasDialogueEnhancement; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioPreselectionLabel.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioPreselectionLabel.aidl new file mode 100644 index 0000000000..79f3b6f008 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioPreselectionLabel.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable AudioPreselectionLabel { + String language; + String text; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioPreselectionRenderingIndicationType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioPreselectionRenderingIndicationType.aidl new file mode 100644 index 0000000000..2977ff6ebc --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioPreselectionRenderingIndicationType.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum AudioPreselectionRenderingIndicationType { + NOT_INDICATED, + STEREO, + TWO_DIMENSIONAL, + THREE_DIMENSIONAL, + HEADPHONE, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioPresentation.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioPresentation.aidl new file mode 100644 index 0000000000..eba820c6b5 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioPresentation.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable AudioPresentation { + android.hardware.tv.tuner.AudioPreselection preselection; + int ac4ShortProgramId = (-1) /* -1 */; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioStreamType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioStreamType.aidl new file mode 100644 index 0000000000..4754bb121f --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AudioStreamType.aidl @@ -0,0 +1,58 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum AudioStreamType { + UNDEFINED, + PCM, + MP3, + MPEG1, + MPEG2, + MPEGH, + AAC, + AC3, + EAC3, + AC4, + DTS, + DTS_HD, + WMA, + OPUS, + VORBIS, + DRA, + AAC_ADTS, + AAC_LATM, + AAC_HE_ADTS, + AAC_HE_LATM, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AvStreamType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AvStreamType.aidl new file mode 100644 index 0000000000..4d6acfffa1 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/AvStreamType.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union AvStreamType { + android.hardware.tv.tuner.VideoStreamType video = android.hardware.tv.tuner.VideoStreamType.UNDEFINED; + android.hardware.tv.tuner.AudioStreamType audio; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/Constant.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/Constant.aidl new file mode 100644 index 0000000000..1f7153b9c9 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/Constant.aidl @@ -0,0 +1,51 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum Constant { + INVALID_TS_PID = 0xFFFF, + INVALID_STREAM_ID = 0xFFFF, + INVALID_FILTER_ID = 0xFFFFFFFF, + INVALID_AV_SYNC_ID = 0xFFFFFFFF, + INVALID_MMTP_RECORD_EVENT_MPT_SEQUENCE_NUM = 0xFFFFFFFF, + INVALID_FIRST_MACROBLOCK_IN_SLICE = 0xFFFFFFFF, + INVALID_FRONTEND_SETTING_FREQUENCY = 0xFFFFFFFF, + INVALID_IP_FILTER_CONTEXT_ID = 0xFFFFFFFF, + INVALID_LTS_ID = 0xFFFFFFFF, + INVALID_FRONTEND_ID = 0xFFFFFFFF, + INVALID_LNB_ID = 0xFFFFFFFF, + INVALID_KEYTOKEN = 0x00, + INVALID_TABINFO_VERSION = 0xFFFFFFFF, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/Constant64Bit.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/Constant64Bit.aidl new file mode 100644 index 0000000000..ccbfd1a5c4 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/Constant64Bit.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="long") @VintfStability +enum Constant64Bit { + INVALID_FILTER_ID_64BIT = 0xFFFFFFFFFFFFFFFF, + INVALID_AV_SYNC_ID_64BIT = 0xFFFFFFFFFFFFFFFF, + INVALID_PRESENTATION_TIME_STAMP = 0xFFFFFFFFFFFFFFFF, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DataFormat.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DataFormat.aidl new file mode 100644 index 0000000000..5fb34baab5 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DataFormat.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum DataFormat { + TS, + PES, + ES, + SHV_TLV, + UNDEFINED, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxAlpFilterSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxAlpFilterSettings.aidl new file mode 100644 index 0000000000..91a04a436c --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxAlpFilterSettings.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxAlpFilterSettings { + int packetType; + android.hardware.tv.tuner.DemuxAlpLengthType lengthType = android.hardware.tv.tuner.DemuxAlpLengthType.UNDEFINED; + android.hardware.tv.tuner.DemuxAlpFilterSettingsFilterSettings filterSettings; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxAlpFilterSettingsFilterSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxAlpFilterSettingsFilterSettings.aidl new file mode 100644 index 0000000000..6b15492768 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxAlpFilterSettingsFilterSettings.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union DemuxAlpFilterSettingsFilterSettings { + boolean noinit; + android.hardware.tv.tuner.DemuxFilterSectionSettings section; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxAlpFilterType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxAlpFilterType.aidl new file mode 100644 index 0000000000..c164f19282 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxAlpFilterType.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum DemuxAlpFilterType { + UNDEFINED, + SECTION, + PTP, + PAYLOAD_THROUGH, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxAlpLengthType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxAlpLengthType.aidl new file mode 100644 index 0000000000..59edc34007 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxAlpLengthType.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="byte") @VintfStability +enum DemuxAlpLengthType { + UNDEFINED = 0, + WITHOUT_ADDITIONAL_HEADER, + WITH_ADDITIONAL_HEADER, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxCapabilities.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxCapabilities.aidl new file mode 100644 index 0000000000..49afb94b6b --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxCapabilities.aidl @@ -0,0 +1,51 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxCapabilities { + int numDemux; + int numRecord; + int numPlayback; + int numTsFilter; + int numSectionFilter; + int numAudioFilter; + int numVideoFilter; + int numPesFilter; + int numPcrFilter; + long numBytesInSectionFilter; + int filterCaps; + int[] linkCaps; + boolean bTimeFilter; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterAvSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterAvSettings.aidl new file mode 100644 index 0000000000..3e5df2d635 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterAvSettings.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxFilterAvSettings { + boolean isPassthrough; + boolean isSecureMemory; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterDownloadEvent.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterDownloadEvent.aidl new file mode 100644 index 0000000000..8a05dbd6b8 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterDownloadEvent.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxFilterDownloadEvent { + int itemId; + int downloadId; + int mpuSequenceNumber; + int itemFragmentIndex; + int lastItemFragmentIndex; + int dataLength; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterDownloadSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterDownloadSettings.aidl new file mode 100644 index 0000000000..86ce646f69 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterDownloadSettings.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxFilterDownloadSettings { + boolean useDownloadId; + int downloadId; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterEvent.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterEvent.aidl new file mode 100644 index 0000000000..617f71cc34 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterEvent.aidl @@ -0,0 +1,48 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union DemuxFilterEvent { + android.hardware.tv.tuner.DemuxFilterSectionEvent section; + android.hardware.tv.tuner.DemuxFilterMediaEvent media; + android.hardware.tv.tuner.DemuxFilterPesEvent pes; + android.hardware.tv.tuner.DemuxFilterTsRecordEvent tsRecord; + android.hardware.tv.tuner.DemuxFilterMmtpRecordEvent mmtpRecord; + android.hardware.tv.tuner.DemuxFilterDownloadEvent download; + android.hardware.tv.tuner.DemuxFilterIpPayloadEvent ipPayload; + android.hardware.tv.tuner.DemuxFilterTemiEvent temi; + android.hardware.tv.tuner.DemuxFilterMonitorEvent monitorEvent; + int startId; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterIpPayloadEvent.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterIpPayloadEvent.aidl new file mode 100644 index 0000000000..9134df35c2 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterIpPayloadEvent.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxFilterIpPayloadEvent { + int dataLength; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMainType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMainType.aidl new file mode 100644 index 0000000000..b78965dfd3 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMainType.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum DemuxFilterMainType { + UNDEFINED = 0, + TS = (1 << 0) /* 1 */, + MMTP = (1 << 1) /* 2 */, + IP = (1 << 2) /* 4 */, + TLV = (1 << 3) /* 8 */, + ALP = (1 << 4) /* 16 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl new file mode 100644 index 0000000000..61a955590e --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl @@ -0,0 +1,52 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxFilterMediaEvent { + int streamId; + boolean isPtsPresent; + long pts; + boolean isDtsPresent; + long dts; + long dataLength; + long offset; + android.hardware.common.NativeHandle avMemory; + boolean isSecureMemory; + long avDataId; + int mpuSequenceNumber; + boolean isPesPrivateData; + android.hardware.tv.tuner.DemuxFilterMediaEventExtraMetaData extraMetaData; + android.hardware.tv.tuner.DemuxFilterScIndexMask scIndexMask; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMediaEventExtraMetaData.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMediaEventExtraMetaData.aidl new file mode 100644 index 0000000000..28caf19580 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMediaEventExtraMetaData.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union DemuxFilterMediaEventExtraMetaData { + boolean noinit; + android.hardware.tv.tuner.AudioExtraMetaData audio; + android.hardware.tv.tuner.AudioPresentation[] audioPresentations = {}; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMmtpRecordEvent.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMmtpRecordEvent.aidl new file mode 100644 index 0000000000..4e31ba8c73 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMmtpRecordEvent.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxFilterMmtpRecordEvent { + int scHevcIndexMask; + long byteNumber; + long pts; + int mpuSequenceNumber; + int firstMbInSlice; + int tsIndexMask; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMonitorEvent.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMonitorEvent.aidl new file mode 100644 index 0000000000..177de7a0c1 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMonitorEvent.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union DemuxFilterMonitorEvent { + android.hardware.tv.tuner.ScramblingStatus scramblingStatus = android.hardware.tv.tuner.ScramblingStatus.UNKNOWN; + int cid; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMonitorEventType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMonitorEventType.aidl new file mode 100644 index 0000000000..062650b2e3 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterMonitorEventType.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum DemuxFilterMonitorEventType { + SCRAMBLING_STATUS = (1 << 0) /* 1 */, + IP_CID_CHANGE = (1 << 1) /* 2 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterPesDataSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterPesDataSettings.aidl new file mode 100644 index 0000000000..2420142149 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterPesDataSettings.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxFilterPesDataSettings { + int streamId; + boolean isRaw; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterPesEvent.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterPesEvent.aidl new file mode 100644 index 0000000000..3ddd5e0a35 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterPesEvent.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxFilterPesEvent { + int streamId; + int dataLength; + int mpuSequenceNumber; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterRecordSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterRecordSettings.aidl new file mode 100644 index 0000000000..02c478f4c1 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterRecordSettings.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxFilterRecordSettings { + int tsIndexMask; + android.hardware.tv.tuner.DemuxRecordScIndexType scIndexType = android.hardware.tv.tuner.DemuxRecordScIndexType.NONE; + android.hardware.tv.tuner.DemuxFilterScIndexMask scIndexMask; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterScIndexMask.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterScIndexMask.aidl new file mode 100644 index 0000000000..8dfc60eb54 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterScIndexMask.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union DemuxFilterScIndexMask { + int scIndex; + int scAvc; + int scHevc; + int scVvc; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSectionBits.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSectionBits.aidl new file mode 100644 index 0000000000..b666c7b6ba --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSectionBits.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxFilterSectionBits { + byte[] filter; + byte[] mask; + byte[] mode; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSectionEvent.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSectionEvent.aidl new file mode 100644 index 0000000000..199a09c747 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSectionEvent.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxFilterSectionEvent { + int tableId; + int version; + int sectionNum; + long dataLength; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSectionSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSectionSettings.aidl new file mode 100644 index 0000000000..7936e59001 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSectionSettings.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxFilterSectionSettings { + android.hardware.tv.tuner.DemuxFilterSectionSettingsCondition condition; + boolean isCheckCrc; + boolean isRepeat; + boolean isRaw; + int bitWidthOfLengthField; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSectionSettingsCondition.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSectionSettingsCondition.aidl new file mode 100644 index 0000000000..0b101dece4 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSectionSettingsCondition.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union DemuxFilterSectionSettingsCondition { + android.hardware.tv.tuner.DemuxFilterSectionBits sectionBits; + android.hardware.tv.tuner.DemuxFilterSectionSettingsConditionTableInfo tableInfo; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSectionSettingsConditionTableInfo.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSectionSettingsConditionTableInfo.aidl new file mode 100644 index 0000000000..82d30cbf7e --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSectionSettingsConditionTableInfo.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxFilterSectionSettingsConditionTableInfo { + int tableId; + int version; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSettings.aidl new file mode 100644 index 0000000000..c12fde25ab --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSettings.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union DemuxFilterSettings { + android.hardware.tv.tuner.DemuxTsFilterSettings ts; + android.hardware.tv.tuner.DemuxMmtpFilterSettings mmtp; + android.hardware.tv.tuner.DemuxIpFilterSettings ip; + android.hardware.tv.tuner.DemuxTlvFilterSettings tlv; + android.hardware.tv.tuner.DemuxAlpFilterSettings alp; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterStatus.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterStatus.aidl new file mode 100644 index 0000000000..cfc5838946 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterStatus.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="byte") @VintfStability +enum DemuxFilterStatus { + DATA_READY = (1 << 0) /* 1 */, + LOW_WATER = (1 << 1) /* 2 */, + HIGH_WATER = (1 << 2) /* 4 */, + OVERFLOW = (1 << 3) /* 8 */, + NO_DATA = (1 << 4) /* 16 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSubType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSubType.aidl new file mode 100644 index 0000000000..2e2a774535 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterSubType.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union DemuxFilterSubType { + android.hardware.tv.tuner.DemuxTsFilterType tsFilterType = android.hardware.tv.tuner.DemuxTsFilterType.UNDEFINED; + android.hardware.tv.tuner.DemuxMmtpFilterType mmtpFilterType; + android.hardware.tv.tuner.DemuxIpFilterType ipFilterType; + android.hardware.tv.tuner.DemuxTlvFilterType tlvFilterType; + android.hardware.tv.tuner.DemuxAlpFilterType alpFilterType; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterTemiEvent.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterTemiEvent.aidl new file mode 100644 index 0000000000..ce158618e3 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterTemiEvent.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxFilterTemiEvent { + long pts; + byte descrTag; + byte[] descrData; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterTsRecordEvent.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterTsRecordEvent.aidl new file mode 100644 index 0000000000..5c27faf95d --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterTsRecordEvent.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxFilterTsRecordEvent { + android.hardware.tv.tuner.DemuxPid pid; + int tsIndexMask; + android.hardware.tv.tuner.DemuxFilterScIndexMask scIndexMask; + long byteNumber; + long pts; + int firstMbInSlice; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterType.aidl new file mode 100644 index 0000000000..b2f499d65d --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxFilterType.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxFilterType { + android.hardware.tv.tuner.DemuxFilterMainType mainType = android.hardware.tv.tuner.DemuxFilterMainType.UNDEFINED; + android.hardware.tv.tuner.DemuxFilterSubType subType; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxInfo.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxInfo.aidl new file mode 100644 index 0000000000..12f9dc8a05 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxInfo.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxInfo { + int filterTypes = android.hardware.tv.tuner.DemuxFilterMainType.UNDEFINED /* 0 */; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxIpAddress.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxIpAddress.aidl new file mode 100644 index 0000000000..a044a19d7e --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxIpAddress.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxIpAddress { + android.hardware.tv.tuner.DemuxIpAddressIpAddress srcIpAddress; + android.hardware.tv.tuner.DemuxIpAddressIpAddress dstIpAddress; + int srcPort; + int dstPort; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxIpAddressIpAddress.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxIpAddressIpAddress.aidl new file mode 100644 index 0000000000..62de08847e --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxIpAddressIpAddress.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union DemuxIpAddressIpAddress { + byte[] v4 = {}; + byte[] v6; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxIpFilterSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxIpFilterSettings.aidl new file mode 100644 index 0000000000..2b0610b4ef --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxIpFilterSettings.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxIpFilterSettings { + android.hardware.tv.tuner.DemuxIpAddress ipAddr; + android.hardware.tv.tuner.DemuxIpFilterSettingsFilterSettings filterSettings; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxIpFilterSettingsFilterSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxIpFilterSettingsFilterSettings.aidl new file mode 100644 index 0000000000..daac2847a6 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxIpFilterSettingsFilterSettings.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union DemuxIpFilterSettingsFilterSettings { + boolean noinit; + android.hardware.tv.tuner.DemuxFilterSectionSettings section; + boolean bPassthrough; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxIpFilterType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxIpFilterType.aidl new file mode 100644 index 0000000000..7320aec497 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxIpFilterType.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum DemuxIpFilterType { + UNDEFINED, + SECTION, + NTP, + IP_PAYLOAD, + IP, + PAYLOAD_THROUGH, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxMmtpFilterSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxMmtpFilterSettings.aidl new file mode 100644 index 0000000000..b22c564cf9 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxMmtpFilterSettings.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxMmtpFilterSettings { + int mmtpPid; + android.hardware.tv.tuner.DemuxMmtpFilterSettingsFilterSettings filterSettings; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxMmtpFilterSettingsFilterSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxMmtpFilterSettingsFilterSettings.aidl new file mode 100644 index 0000000000..4b23306818 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxMmtpFilterSettingsFilterSettings.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union DemuxMmtpFilterSettingsFilterSettings { + boolean noinit; + android.hardware.tv.tuner.DemuxFilterSectionSettings section; + android.hardware.tv.tuner.DemuxFilterAvSettings av; + android.hardware.tv.tuner.DemuxFilterPesDataSettings pesData; + android.hardware.tv.tuner.DemuxFilterRecordSettings record; + android.hardware.tv.tuner.DemuxFilterDownloadSettings download; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxMmtpFilterType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxMmtpFilterType.aidl new file mode 100644 index 0000000000..a89c5b1650 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxMmtpFilterType.aidl @@ -0,0 +1,46 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum DemuxMmtpFilterType { + UNDEFINED, + SECTION, + PES, + MMTP, + AUDIO, + VIDEO, + RECORD, + DOWNLOAD, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxPid.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxPid.aidl new file mode 100644 index 0000000000..c452f35b36 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxPid.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union DemuxPid { + int tPid; + int mmtpPid; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxQueueNotifyBits.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxQueueNotifyBits.aidl new file mode 100644 index 0000000000..ecb4e8b28e --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxQueueNotifyBits.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum DemuxQueueNotifyBits { + DATA_READY = (1 << 0) /* 1 */, + DATA_CONSUMED = (1 << 1) /* 2 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxRecordScIndexType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxRecordScIndexType.aidl new file mode 100644 index 0000000000..5556bb2533 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxRecordScIndexType.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum DemuxRecordScIndexType { + NONE, + SC, + SC_HEVC, + SC_AVC, + SC_VVC, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxScAvcIndex.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxScAvcIndex.aidl new file mode 100644 index 0000000000..5c5179304e --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxScAvcIndex.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum DemuxScAvcIndex { + UNDEFINED = 0, + I_SLICE = (1 << 0) /* 1 */, + P_SLICE = (1 << 1) /* 2 */, + B_SLICE = (1 << 2) /* 4 */, + SI_SLICE = (1 << 3) /* 8 */, + SP_SLICE = (1 << 4) /* 16 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxScHevcIndex.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxScHevcIndex.aidl new file mode 100644 index 0000000000..d07bcb7ba3 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxScHevcIndex.aidl @@ -0,0 +1,47 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum DemuxScHevcIndex { + UNDEFINED = 0, + SPS = (1 << 0) /* 1 */, + AUD = (1 << 1) /* 2 */, + SLICE_CE_BLA_W_LP = (1 << 2) /* 4 */, + SLICE_BLA_W_RADL = (1 << 3) /* 8 */, + SLICE_BLA_N_LP = (1 << 4) /* 16 */, + SLICE_IDR_W_RADL = (1 << 5) /* 32 */, + SLICE_IDR_N_LP = (1 << 6) /* 64 */, + SLICE_TRAIL_CRA = (1 << 7) /* 128 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxScIndex.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxScIndex.aidl new file mode 100644 index 0000000000..509c1abbc8 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxScIndex.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum DemuxScIndex { + UNDEFINED = 0, + I_FRAME = (1 << 0) /* 1 */, + P_FRAME = (1 << 1) /* 2 */, + B_FRAME = (1 << 2) /* 4 */, + SEQUENCE = (1 << 3) /* 8 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxScVvcIndex.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxScVvcIndex.aidl new file mode 100644 index 0000000000..ac3a5e668f --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxScVvcIndex.aidl @@ -0,0 +1,46 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum DemuxScVvcIndex { + UNDEFINED = 0, + SLICE_IDR_W_RADL = (1 << 0) /* 1 */, + SLICE_IDR_N_LP = (1 << 1) /* 2 */, + SLICE_CRA = (1 << 2) /* 4 */, + SLICE_GDR = (1 << 3) /* 8 */, + VPS = (1 << 4) /* 16 */, + SPS = (1 << 5) /* 32 */, + AUD = (1 << 6) /* 64 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTlvFilterSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTlvFilterSettings.aidl new file mode 100644 index 0000000000..ddb61cea79 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTlvFilterSettings.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxTlvFilterSettings { + int packetType; + boolean isCompressedIpPacket; + android.hardware.tv.tuner.DemuxTlvFilterSettingsFilterSettings filterSettings; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTlvFilterSettingsFilterSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTlvFilterSettingsFilterSettings.aidl new file mode 100644 index 0000000000..a9d319803c --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTlvFilterSettingsFilterSettings.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union DemuxTlvFilterSettingsFilterSettings { + boolean noinit; + android.hardware.tv.tuner.DemuxFilterSectionSettings section; + boolean bPassthrough; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTlvFilterType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTlvFilterType.aidl new file mode 100644 index 0000000000..bd9e583150 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTlvFilterType.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum DemuxTlvFilterType { + UNDEFINED, + SECTION, + TLV, + PAYLOAD_THROUGH, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTsFilterSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTsFilterSettings.aidl new file mode 100644 index 0000000000..d8d424f193 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTsFilterSettings.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable DemuxTsFilterSettings { + int tpid; + android.hardware.tv.tuner.DemuxTsFilterSettingsFilterSettings filterSettings; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTsFilterSettingsFilterSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTsFilterSettingsFilterSettings.aidl new file mode 100644 index 0000000000..5d81bb6237 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTsFilterSettingsFilterSettings.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union DemuxTsFilterSettingsFilterSettings { + boolean noinit; + android.hardware.tv.tuner.DemuxFilterSectionSettings section; + android.hardware.tv.tuner.DemuxFilterAvSettings av; + android.hardware.tv.tuner.DemuxFilterPesDataSettings pesData; + android.hardware.tv.tuner.DemuxFilterRecordSettings record; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTsFilterType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTsFilterType.aidl new file mode 100644 index 0000000000..8be0e95508 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTsFilterType.aidl @@ -0,0 +1,47 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum DemuxTsFilterType { + UNDEFINED, + SECTION, + PES, + TS, + AUDIO, + VIDEO, + PCR, + RECORD, + TEMI, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTsIndex.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTsIndex.aidl new file mode 100644 index 0000000000..9ca684f4b2 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DemuxTsIndex.aidl @@ -0,0 +1,56 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum DemuxTsIndex { + FIRST_PACKET = (1 << 0) /* 1 */, + PAYLOAD_UNIT_START_INDICATOR = (1 << 1) /* 2 */, + CHANGE_TO_NOT_SCRAMBLED = (1 << 2) /* 4 */, + CHANGE_TO_EVEN_SCRAMBLED = (1 << 3) /* 8 */, + CHANGE_TO_ODD_SCRAMBLED = (1 << 4) /* 16 */, + DISCONTINUITY_INDICATOR = (1 << 5) /* 32 */, + RANDOM_ACCESS_INDICATOR = (1 << 6) /* 64 */, + PRIORITY_INDICATOR = (1 << 7) /* 128 */, + PCR_FLAG = (1 << 8) /* 256 */, + OPCR_FLAG = (1 << 9) /* 512 */, + SPLICING_POINT_FLAG = (1 << 10) /* 1024 */, + PRIVATE_DATA = (1 << 11) /* 2048 */, + ADAPTATION_EXTENSION_FLAG = (1 << 12) /* 4096 */, + MPT_INDEX_MPT = (1 << 16) /* 65536 */, + MPT_INDEX_VIDEO = (1 << 17) /* 131072 */, + MPT_INDEX_AUDIO = (1 << 18) /* 262144 */, + MPT_INDEX_TIMESTAMP_TARGET_VIDEO = (1 << 19) /* 524288 */, + MPT_INDEX_TIMESTAMP_TARGET_AUDIO = (1 << 20) /* 1048576 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DvrSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DvrSettings.aidl new file mode 100644 index 0000000000..26f864a08e --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DvrSettings.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union DvrSettings { + android.hardware.tv.tuner.RecordSettings record; + android.hardware.tv.tuner.PlaybackSettings playback; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DvrType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DvrType.aidl new file mode 100644 index 0000000000..6dab74b301 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/DvrType.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="byte") @VintfStability +enum DvrType { + RECORD, + PLAYBACK, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FilterDelayHint.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FilterDelayHint.aidl new file mode 100644 index 0000000000..1fdafd2f09 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FilterDelayHint.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FilterDelayHint { + android.hardware.tv.tuner.FilterDelayHintType hintType = android.hardware.tv.tuner.FilterDelayHintType.INVALID; + int hintValue; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FilterDelayHintType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FilterDelayHintType.aidl new file mode 100644 index 0000000000..af35c70e5d --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FilterDelayHintType.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FilterDelayHintType { + INVALID, + TIME_DELAY_IN_MS, + DATA_SIZE_DELAY_IN_BYTES, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAnalogAftFlag.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAnalogAftFlag.aidl new file mode 100644 index 0000000000..45aa2af498 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAnalogAftFlag.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendAnalogAftFlag { + UNDEFINED, + AFT_TRUE, + AFT_FALSE, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAnalogCapabilities.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAnalogCapabilities.aidl new file mode 100644 index 0000000000..46131be795 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAnalogCapabilities.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendAnalogCapabilities { + int typeCap; + int sifStandardCap; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAnalogSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAnalogSettings.aidl new file mode 100644 index 0000000000..33e934739c --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAnalogSettings.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendAnalogSettings { + long frequency; + long endFrequency; + android.hardware.tv.tuner.FrontendSpectralInversion inversion = android.hardware.tv.tuner.FrontendSpectralInversion.UNDEFINED; + android.hardware.tv.tuner.FrontendAnalogType type = android.hardware.tv.tuner.FrontendAnalogType.UNDEFINED; + android.hardware.tv.tuner.FrontendAnalogAftFlag aftFlag = android.hardware.tv.tuner.FrontendAnalogAftFlag.UNDEFINED; + android.hardware.tv.tuner.FrontendAnalogSifStandard sifStandard = android.hardware.tv.tuner.FrontendAnalogSifStandard.UNDEFINED; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAnalogSifStandard.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAnalogSifStandard.aidl new file mode 100644 index 0000000000..8d19461d06 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAnalogSifStandard.aidl @@ -0,0 +1,57 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendAnalogSifStandard { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + BG = (1 << 1) /* 2 */, + BG_A2 = (1 << 2) /* 4 */, + BG_NICAM = (1 << 3) /* 8 */, + I = (1 << 4) /* 16 */, + DK = (1 << 5) /* 32 */, + DK1_A2 = (1 << 6) /* 64 */, + DK2_A2 = (1 << 7) /* 128 */, + DK3_A2 = (1 << 8) /* 256 */, + DK_NICAM = (1 << 9) /* 512 */, + L = (1 << 10) /* 1024 */, + M = (1 << 11) /* 2048 */, + M_BTSC = (1 << 12) /* 4096 */, + M_A2 = (1 << 13) /* 8192 */, + M_EIAJ = (1 << 14) /* 16384 */, + I_NICAM = (1 << 15) /* 32768 */, + L_NICAM = (1 << 16) /* 65536 */, + L_PRIME = (1 << 17) /* 131072 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAnalogType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAnalogType.aidl new file mode 100644 index 0000000000..bf8b00094c --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAnalogType.aidl @@ -0,0 +1,47 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendAnalogType { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + PAL = (1 << 1) /* 2 */, + PAL_M = (1 << 2) /* 4 */, + PAL_N = (1 << 3) /* 8 */, + PAL_60 = (1 << 4) /* 16 */, + NTSC = (1 << 5) /* 32 */, + NTSC_443 = (1 << 6) /* 64 */, + SECAM = (1 << 7) /* 128 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3Bandwidth.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3Bandwidth.aidl new file mode 100644 index 0000000000..9704f40a1e --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3Bandwidth.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendAtsc3Bandwidth { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + BANDWIDTH_6MHZ = (1 << 1) /* 2 */, + BANDWIDTH_7MHZ = (1 << 2) /* 4 */, + BANDWIDTH_8MHZ = (1 << 3) /* 8 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3Capabilities.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3Capabilities.aidl new file mode 100644 index 0000000000..b2a25c7d49 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3Capabilities.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendAtsc3Capabilities { + int bandwidthCap; + int modulationCap; + int timeInterleaveModeCap; + int codeRateCap; + int fecCap; + byte demodOutputFormatCap; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3CodeRate.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3CodeRate.aidl new file mode 100644 index 0000000000..2d09271942 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3CodeRate.aidl @@ -0,0 +1,52 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendAtsc3CodeRate { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + CODERATE_2_15 = (1 << 1) /* 2 */, + CODERATE_3_15 = (1 << 2) /* 4 */, + CODERATE_4_15 = (1 << 3) /* 8 */, + CODERATE_5_15 = (1 << 4) /* 16 */, + CODERATE_6_15 = (1 << 5) /* 32 */, + CODERATE_7_15 = (1 << 6) /* 64 */, + CODERATE_8_15 = (1 << 7) /* 128 */, + CODERATE_9_15 = (1 << 8) /* 256 */, + CODERATE_10_15 = (1 << 9) /* 512 */, + CODERATE_11_15 = (1 << 10) /* 1024 */, + CODERATE_12_15 = (1 << 11) /* 2048 */, + CODERATE_13_15 = (1 << 12) /* 4096 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3DemodOutputFormat.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3DemodOutputFormat.aidl new file mode 100644 index 0000000000..22267e7d30 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3DemodOutputFormat.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="byte") @VintfStability +enum FrontendAtsc3DemodOutputFormat { + UNDEFINED = 0, + ATSC3_LINKLAYER_PACKET = (1 << 0) /* 1 */, + BASEBAND_PACKET = (1 << 1) /* 2 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3Fec.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3Fec.aidl new file mode 100644 index 0000000000..2e229c0a46 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3Fec.aidl @@ -0,0 +1,46 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendAtsc3Fec { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + BCH_LDPC_16K = (1 << 1) /* 2 */, + BCH_LDPC_64K = (1 << 2) /* 4 */, + CRC_LDPC_16K = (1 << 3) /* 8 */, + CRC_LDPC_64K = (1 << 4) /* 16 */, + LDPC_16K = (1 << 5) /* 32 */, + LDPC_64K = (1 << 6) /* 64 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3Modulation.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3Modulation.aidl new file mode 100644 index 0000000000..cbe8c1f0cc --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3Modulation.aidl @@ -0,0 +1,46 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendAtsc3Modulation { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + MOD_QPSK = (1 << 1) /* 2 */, + MOD_16QAM = (1 << 2) /* 4 */, + MOD_64QAM = (1 << 3) /* 8 */, + MOD_256QAM = (1 << 4) /* 16 */, + MOD_1024QAM = (1 << 5) /* 32 */, + MOD_4096QAM = (1 << 6) /* 64 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3PlpSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3PlpSettings.aidl new file mode 100644 index 0000000000..6301f96c61 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3PlpSettings.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendAtsc3PlpSettings { + int plpId; + android.hardware.tv.tuner.FrontendAtsc3Modulation modulation = android.hardware.tv.tuner.FrontendAtsc3Modulation.UNDEFINED; + android.hardware.tv.tuner.FrontendAtsc3TimeInterleaveMode interleaveMode = android.hardware.tv.tuner.FrontendAtsc3TimeInterleaveMode.UNDEFINED; + android.hardware.tv.tuner.FrontendAtsc3CodeRate codeRate = android.hardware.tv.tuner.FrontendAtsc3CodeRate.UNDEFINED; + android.hardware.tv.tuner.FrontendAtsc3Fec fec = android.hardware.tv.tuner.FrontendAtsc3Fec.UNDEFINED; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3Settings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3Settings.aidl new file mode 100644 index 0000000000..3cbb0d0337 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3Settings.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendAtsc3Settings { + long frequency; + long endFrequency; + android.hardware.tv.tuner.FrontendAtsc3Bandwidth bandwidth = android.hardware.tv.tuner.FrontendAtsc3Bandwidth.UNDEFINED; + android.hardware.tv.tuner.FrontendSpectralInversion inversion = android.hardware.tv.tuner.FrontendSpectralInversion.UNDEFINED; + android.hardware.tv.tuner.FrontendAtsc3DemodOutputFormat demodOutputFormat = android.hardware.tv.tuner.FrontendAtsc3DemodOutputFormat.UNDEFINED; + android.hardware.tv.tuner.FrontendAtsc3PlpSettings[] plpSettings; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3TimeInterleaveMode.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3TimeInterleaveMode.aidl new file mode 100644 index 0000000000..4e706414f4 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtsc3TimeInterleaveMode.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendAtsc3TimeInterleaveMode { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + CTI = (1 << 1) /* 2 */, + HTI = (1 << 2) /* 4 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtscCapabilities.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtscCapabilities.aidl new file mode 100644 index 0000000000..c24afae7b0 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtscCapabilities.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendAtscCapabilities { + int modulationCap; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtscModulation.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtscModulation.aidl new file mode 100644 index 0000000000..7da48f1f83 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtscModulation.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendAtscModulation { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + MOD_8VSB = (1 << 2) /* 4 */, + MOD_16VSB = (1 << 3) /* 8 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtscSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtscSettings.aidl new file mode 100644 index 0000000000..9121c12d5d --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendAtscSettings.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendAtscSettings { + long frequency; + long endFrequency; + android.hardware.tv.tuner.FrontendSpectralInversion inversion = android.hardware.tv.tuner.FrontendSpectralInversion.UNDEFINED; + android.hardware.tv.tuner.FrontendAtscModulation modulation = android.hardware.tv.tuner.FrontendAtscModulation.UNDEFINED; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendBandwidth.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendBandwidth.aidl new file mode 100644 index 0000000000..5355637422 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendBandwidth.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union FrontendBandwidth { + android.hardware.tv.tuner.FrontendAtsc3Bandwidth atsc3 = android.hardware.tv.tuner.FrontendAtsc3Bandwidth.UNDEFINED; + android.hardware.tv.tuner.FrontendDvbcBandwidth dvbc; + android.hardware.tv.tuner.FrontendDvbtBandwidth dvbt; + android.hardware.tv.tuner.FrontendIsdbtBandwidth isdbt; + android.hardware.tv.tuner.FrontendDtmbBandwidth dtmb; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendCableTimeInterleaveMode.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendCableTimeInterleaveMode.aidl new file mode 100644 index 0000000000..61cbf12dd0 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendCableTimeInterleaveMode.aidl @@ -0,0 +1,49 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendCableTimeInterleaveMode { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + INTERLEAVING_128_1_0 = (1 << 1) /* 2 */, + INTERLEAVING_128_1_1 = (1 << 2) /* 4 */, + INTERLEAVING_64_2 = (1 << 3) /* 8 */, + INTERLEAVING_32_4 = (1 << 4) /* 16 */, + INTERLEAVING_16_8 = (1 << 5) /* 32 */, + INTERLEAVING_8_16 = (1 << 6) /* 64 */, + INTERLEAVING_128_2 = (1 << 7) /* 128 */, + INTERLEAVING_128_3 = (1 << 8) /* 256 */, + INTERLEAVING_128_4 = (1 << 9) /* 512 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendCapabilities.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendCapabilities.aidl new file mode 100644 index 0000000000..c9443b1782 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendCapabilities.aidl @@ -0,0 +1,49 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union FrontendCapabilities { + android.hardware.tv.tuner.FrontendAnalogCapabilities analogCaps; + android.hardware.tv.tuner.FrontendAtscCapabilities atscCaps; + android.hardware.tv.tuner.FrontendAtsc3Capabilities atsc3Caps; + android.hardware.tv.tuner.FrontendDtmbCapabilities dtmbCaps; + android.hardware.tv.tuner.FrontendDvbsCapabilities dvbsCaps; + android.hardware.tv.tuner.FrontendDvbcCapabilities dvbcCaps; + android.hardware.tv.tuner.FrontendDvbtCapabilities dvbtCaps; + android.hardware.tv.tuner.FrontendIsdbsCapabilities isdbsCaps; + android.hardware.tv.tuner.FrontendIsdbs3Capabilities isdbs3Caps; + android.hardware.tv.tuner.FrontendIsdbtCapabilities isdbtCaps; + @nullable android.hardware.tv.tuner.FrontendIptvCapabilities iptvCaps; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbBandwidth.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbBandwidth.aidl new file mode 100644 index 0000000000..6f62d91c65 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbBandwidth.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendDtmbBandwidth { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + BANDWIDTH_8MHZ = (1 << 1) /* 2 */, + BANDWIDTH_6MHZ = (1 << 2) /* 4 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbCapabilities.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbCapabilities.aidl new file mode 100644 index 0000000000..8d35104e09 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbCapabilities.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendDtmbCapabilities { + int transmissionModeCap; + int bandwidthCap; + int modulationCap; + int codeRateCap; + int guardIntervalCap; + int interleaveModeCap; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbCodeRate.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbCodeRate.aidl new file mode 100644 index 0000000000..d6be639739 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbCodeRate.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendDtmbCodeRate { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + CODERATE_2_5 = (1 << 1) /* 2 */, + CODERATE_3_5 = (1 << 2) /* 4 */, + CODERATE_4_5 = (1 << 3) /* 8 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbGuardInterval.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbGuardInterval.aidl new file mode 100644 index 0000000000..5626064634 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbGuardInterval.aidl @@ -0,0 +1,46 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendDtmbGuardInterval { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + PN_420_VARIOUS = (1 << 1) /* 2 */, + PN_595_CONST = (1 << 2) /* 4 */, + PN_945_VARIOUS = (1 << 3) /* 8 */, + PN_420_CONST = (1 << 4) /* 16 */, + PN_945_CONST = (1 << 5) /* 32 */, + PN_RESERVED = (1 << 6) /* 64 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbModulation.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbModulation.aidl new file mode 100644 index 0000000000..036e64b7bf --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbModulation.aidl @@ -0,0 +1,45 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendDtmbModulation { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + CONSTELLATION_4QAM = (1 << 1) /* 2 */, + CONSTELLATION_4QAM_NR = (1 << 2) /* 4 */, + CONSTELLATION_16QAM = (1 << 3) /* 8 */, + CONSTELLATION_32QAM = (1 << 4) /* 16 */, + CONSTELLATION_64QAM = (1 << 5) /* 32 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbSettings.aidl new file mode 100644 index 0000000000..5f9b775db1 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbSettings.aidl @@ -0,0 +1,47 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendDtmbSettings { + long frequency; + long endFrequency; + android.hardware.tv.tuner.FrontendSpectralInversion inversion = android.hardware.tv.tuner.FrontendSpectralInversion.UNDEFINED; + android.hardware.tv.tuner.FrontendDtmbTransmissionMode transmissionMode = android.hardware.tv.tuner.FrontendDtmbTransmissionMode.UNDEFINED; + android.hardware.tv.tuner.FrontendDtmbBandwidth bandwidth = android.hardware.tv.tuner.FrontendDtmbBandwidth.UNDEFINED; + android.hardware.tv.tuner.FrontendDtmbModulation modulation = android.hardware.tv.tuner.FrontendDtmbModulation.UNDEFINED; + android.hardware.tv.tuner.FrontendDtmbCodeRate codeRate = android.hardware.tv.tuner.FrontendDtmbCodeRate.UNDEFINED; + android.hardware.tv.tuner.FrontendDtmbGuardInterval guardInterval = android.hardware.tv.tuner.FrontendDtmbGuardInterval.UNDEFINED; + android.hardware.tv.tuner.FrontendDtmbTimeInterleaveMode interleaveMode = android.hardware.tv.tuner.FrontendDtmbTimeInterleaveMode.UNDEFINED; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbTimeInterleaveMode.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbTimeInterleaveMode.aidl new file mode 100644 index 0000000000..12238871ed --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbTimeInterleaveMode.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendDtmbTimeInterleaveMode { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + TIMER_INT_240 = (1 << 1) /* 2 */, + TIMER_INT_720 = (1 << 2) /* 4 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbTransmissionMode.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbTransmissionMode.aidl new file mode 100644 index 0000000000..0498825d30 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDtmbTransmissionMode.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendDtmbTransmissionMode { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + C1 = (1 << 1) /* 2 */, + C3780 = (1 << 2) /* 4 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcAnnex.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcAnnex.aidl new file mode 100644 index 0000000000..985add1534 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcAnnex.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="byte") @VintfStability +enum FrontendDvbcAnnex { + UNDEFINED = 0, + A = (1 << 0) /* 1 */, + B = (1 << 1) /* 2 */, + C = (1 << 2) /* 4 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcBandwidth.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcBandwidth.aidl new file mode 100644 index 0000000000..c253cfe452 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcBandwidth.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendDvbcBandwidth { + UNDEFINED = 0, + BANDWIDTH_5MHZ = (1 << 0) /* 1 */, + BANDWIDTH_6MHZ = (1 << 1) /* 2 */, + BANDWIDTH_7MHZ = (1 << 2) /* 4 */, + BANDWIDTH_8MHZ = (1 << 3) /* 8 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcCapabilities.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcCapabilities.aidl new file mode 100644 index 0000000000..0c0e3ee5d0 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcCapabilities.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendDvbcCapabilities { + int modulationCap; + long fecCap; + byte annexCap; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcModulation.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcModulation.aidl new file mode 100644 index 0000000000..c18e83e82b --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcModulation.aidl @@ -0,0 +1,45 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendDvbcModulation { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + MOD_16QAM = (1 << 1) /* 2 */, + MOD_32QAM = (1 << 2) /* 4 */, + MOD_64QAM = (1 << 3) /* 8 */, + MOD_128QAM = (1 << 4) /* 16 */, + MOD_256QAM = (1 << 5) /* 32 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcOuterFec.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcOuterFec.aidl new file mode 100644 index 0000000000..a6fbc6de4e --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcOuterFec.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendDvbcOuterFec { + UNDEFINED = 0, + OUTER_FEC_NONE, + OUTER_FEC_RS, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcSettings.aidl new file mode 100644 index 0000000000..6b2caedf83 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbcSettings.aidl @@ -0,0 +1,48 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendDvbcSettings { + long frequency; + long endFrequency; + android.hardware.tv.tuner.FrontendDvbcModulation modulation = android.hardware.tv.tuner.FrontendDvbcModulation.UNDEFINED; + android.hardware.tv.tuner.FrontendInnerFec fec = android.hardware.tv.tuner.FrontendInnerFec.FEC_UNDEFINED; + int symbolRate; + android.hardware.tv.tuner.FrontendDvbcOuterFec outerFec = android.hardware.tv.tuner.FrontendDvbcOuterFec.UNDEFINED; + android.hardware.tv.tuner.FrontendDvbcAnnex annex = android.hardware.tv.tuner.FrontendDvbcAnnex.UNDEFINED; + android.hardware.tv.tuner.FrontendSpectralInversion inversion = android.hardware.tv.tuner.FrontendSpectralInversion.UNDEFINED; + android.hardware.tv.tuner.FrontendCableTimeInterleaveMode interleaveMode = android.hardware.tv.tuner.FrontendCableTimeInterleaveMode.UNDEFINED; + android.hardware.tv.tuner.FrontendDvbcBandwidth bandwidth = android.hardware.tv.tuner.FrontendDvbcBandwidth.UNDEFINED; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsCapabilities.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsCapabilities.aidl new file mode 100644 index 0000000000..43e8aee23b --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsCapabilities.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendDvbsCapabilities { + int modulationCap; + long innerfecCap; + byte standard; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsCodeRate.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsCodeRate.aidl new file mode 100644 index 0000000000..4c3d4e466a --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsCodeRate.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendDvbsCodeRate { + android.hardware.tv.tuner.FrontendInnerFec fec = android.hardware.tv.tuner.FrontendInnerFec.FEC_UNDEFINED; + boolean isLinear; + boolean isShortFrames; + int bitsPer1000Symbol; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsModulation.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsModulation.aidl new file mode 100644 index 0000000000..71957d5b72 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsModulation.aidl @@ -0,0 +1,53 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendDvbsModulation { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + MOD_QPSK = (1 << 1) /* 2 */, + MOD_8PSK = (1 << 2) /* 4 */, + MOD_16QAM = (1 << 3) /* 8 */, + MOD_16PSK = (1 << 4) /* 16 */, + MOD_32PSK = (1 << 5) /* 32 */, + MOD_ACM = (1 << 6) /* 64 */, + MOD_8APSK = (1 << 7) /* 128 */, + MOD_16APSK = (1 << 8) /* 256 */, + MOD_32APSK = (1 << 9) /* 512 */, + MOD_64APSK = (1 << 10) /* 1024 */, + MOD_128APSK = (1 << 11) /* 2048 */, + MOD_256APSK = (1 << 12) /* 4096 */, + MOD_RESERVED = (1 << 13) /* 8192 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsPilot.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsPilot.aidl new file mode 100644 index 0000000000..e3543b3c2f --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsPilot.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendDvbsPilot { + UNDEFINED, + ON, + OFF, + AUTO, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsRolloff.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsRolloff.aidl new file mode 100644 index 0000000000..2181abf9ef --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsRolloff.aidl @@ -0,0 +1,45 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendDvbsRolloff { + UNDEFINED, + ROLLOFF_0_35, + ROLLOFF_0_25, + ROLLOFF_0_20, + ROLLOFF_0_15, + ROLLOFF_0_10, + ROLLOFF_0_5, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsScanType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsScanType.aidl new file mode 100644 index 0000000000..46edb56be2 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsScanType.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendDvbsScanType { + UNDEFINED = 0, + DIRECT, + DISEQC, + UNICABLE, + JESS, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsSettings.aidl new file mode 100644 index 0000000000..dab8888b65 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsSettings.aidl @@ -0,0 +1,51 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendDvbsSettings { + long frequency; + long endFrequency; + android.hardware.tv.tuner.FrontendSpectralInversion inversion = android.hardware.tv.tuner.FrontendSpectralInversion.UNDEFINED; + android.hardware.tv.tuner.FrontendDvbsModulation modulation = android.hardware.tv.tuner.FrontendDvbsModulation.UNDEFINED; + android.hardware.tv.tuner.FrontendDvbsCodeRate coderate; + int symbolRate; + android.hardware.tv.tuner.FrontendDvbsRolloff rolloff = android.hardware.tv.tuner.FrontendDvbsRolloff.UNDEFINED; + android.hardware.tv.tuner.FrontendDvbsPilot pilot = android.hardware.tv.tuner.FrontendDvbsPilot.UNDEFINED; + int inputStreamId; + android.hardware.tv.tuner.FrontendDvbsStandard standard = android.hardware.tv.tuner.FrontendDvbsStandard.UNDEFINED; + android.hardware.tv.tuner.FrontendDvbsVcmMode vcmMode = android.hardware.tv.tuner.FrontendDvbsVcmMode.UNDEFINED; + android.hardware.tv.tuner.FrontendDvbsScanType scanType = android.hardware.tv.tuner.FrontendDvbsScanType.UNDEFINED; + boolean isDiseqcRxMessage; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsStandard.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsStandard.aidl new file mode 100644 index 0000000000..bcb1c6da11 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsStandard.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="byte") @VintfStability +enum FrontendDvbsStandard { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + S = (1 << 1) /* 2 */, + S2 = (1 << 2) /* 4 */, + S2X = (1 << 3) /* 8 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsVcmMode.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsVcmMode.aidl new file mode 100644 index 0000000000..af874230a9 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbsVcmMode.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendDvbsVcmMode { + UNDEFINED, + AUTO, + MANUAL, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtBandwidth.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtBandwidth.aidl new file mode 100644 index 0000000000..ff2d9e4762 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtBandwidth.aidl @@ -0,0 +1,46 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendDvbtBandwidth { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + BANDWIDTH_8MHZ = (1 << 1) /* 2 */, + BANDWIDTH_7MHZ = (1 << 2) /* 4 */, + BANDWIDTH_6MHZ = (1 << 3) /* 8 */, + BANDWIDTH_5MHZ = (1 << 4) /* 16 */, + BANDWIDTH_1_7MHZ = (1 << 5) /* 32 */, + BANDWIDTH_10MHZ = (1 << 6) /* 64 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtCapabilities.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtCapabilities.aidl new file mode 100644 index 0000000000..a0e6ce2710 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtCapabilities.aidl @@ -0,0 +1,46 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendDvbtCapabilities { + int transmissionModeCap; + int bandwidthCap; + int constellationCap; + int coderateCap; + int hierarchyCap; + int guardIntervalCap; + boolean isT2Supported; + boolean isMisoSupported; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtCoderate.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtCoderate.aidl new file mode 100644 index 0000000000..8d2df06f30 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtCoderate.aidl @@ -0,0 +1,49 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendDvbtCoderate { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + CODERATE_1_2 = (1 << 1) /* 2 */, + CODERATE_2_3 = (1 << 2) /* 4 */, + CODERATE_3_4 = (1 << 3) /* 8 */, + CODERATE_5_6 = (1 << 4) /* 16 */, + CODERATE_7_8 = (1 << 5) /* 32 */, + CODERATE_3_5 = (1 << 6) /* 64 */, + CODERATE_4_5 = (1 << 7) /* 128 */, + CODERATE_6_7 = (1 << 8) /* 256 */, + CODERATE_8_9 = (1 << 9) /* 512 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtConstellation.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtConstellation.aidl new file mode 100644 index 0000000000..4bd5691b9e --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtConstellation.aidl @@ -0,0 +1,48 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendDvbtConstellation { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + CONSTELLATION_QPSK = (1 << 1) /* 2 */, + CONSTELLATION_16QAM = (1 << 2) /* 4 */, + CONSTELLATION_64QAM = (1 << 3) /* 8 */, + CONSTELLATION_256QAM = (1 << 4) /* 16 */, + CONSTELLATION_QPSK_R = (1 << 5) /* 32 */, + CONSTELLATION_16QAM_R = (1 << 6) /* 64 */, + CONSTELLATION_64QAM_R = (1 << 7) /* 128 */, + CONSTELLATION_256QAM_R = (1 << 8) /* 256 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtGuardInterval.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtGuardInterval.aidl new file mode 100644 index 0000000000..01c2b66b50 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtGuardInterval.aidl @@ -0,0 +1,47 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendDvbtGuardInterval { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + INTERVAL_1_32 = (1 << 1) /* 2 */, + INTERVAL_1_16 = (1 << 2) /* 4 */, + INTERVAL_1_8 = (1 << 3) /* 8 */, + INTERVAL_1_4 = (1 << 4) /* 16 */, + INTERVAL_1_128 = (1 << 5) /* 32 */, + INTERVAL_19_128 = (1 << 6) /* 64 */, + INTERVAL_19_256 = (1 << 7) /* 128 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtHierarchy.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtHierarchy.aidl new file mode 100644 index 0000000000..bd86479794 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtHierarchy.aidl @@ -0,0 +1,48 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendDvbtHierarchy { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + HIERARCHY_NON_NATIVE = (1 << 1) /* 2 */, + HIERARCHY_1_NATIVE = (1 << 2) /* 4 */, + HIERARCHY_2_NATIVE = (1 << 3) /* 8 */, + HIERARCHY_4_NATIVE = (1 << 4) /* 16 */, + HIERARCHY_NON_INDEPTH = (1 << 5) /* 32 */, + HIERARCHY_1_INDEPTH = (1 << 6) /* 64 */, + HIERARCHY_2_INDEPTH = (1 << 7) /* 128 */, + HIERARCHY_4_INDEPTH = (1 << 8) /* 256 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtPlpMode.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtPlpMode.aidl new file mode 100644 index 0000000000..dc8e12c6ed --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtPlpMode.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendDvbtPlpMode { + UNDEFINED, + AUTO, + MANUAL, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtSettings.aidl new file mode 100644 index 0000000000..ec1277aa99 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtSettings.aidl @@ -0,0 +1,54 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendDvbtSettings { + long frequency; + long endFrequency; + android.hardware.tv.tuner.FrontendSpectralInversion inversion = android.hardware.tv.tuner.FrontendSpectralInversion.UNDEFINED; + android.hardware.tv.tuner.FrontendDvbtTransmissionMode transmissionMode = android.hardware.tv.tuner.FrontendDvbtTransmissionMode.UNDEFINED; + android.hardware.tv.tuner.FrontendDvbtBandwidth bandwidth = android.hardware.tv.tuner.FrontendDvbtBandwidth.UNDEFINED; + android.hardware.tv.tuner.FrontendDvbtConstellation constellation = android.hardware.tv.tuner.FrontendDvbtConstellation.UNDEFINED; + android.hardware.tv.tuner.FrontendDvbtHierarchy hierarchy = android.hardware.tv.tuner.FrontendDvbtHierarchy.UNDEFINED; + android.hardware.tv.tuner.FrontendDvbtCoderate hpCoderate = android.hardware.tv.tuner.FrontendDvbtCoderate.UNDEFINED; + android.hardware.tv.tuner.FrontendDvbtCoderate lpCoderate = android.hardware.tv.tuner.FrontendDvbtCoderate.UNDEFINED; + android.hardware.tv.tuner.FrontendDvbtGuardInterval guardInterval = android.hardware.tv.tuner.FrontendDvbtGuardInterval.UNDEFINED; + boolean isHighPriority; + android.hardware.tv.tuner.FrontendDvbtStandard standard = android.hardware.tv.tuner.FrontendDvbtStandard.UNDEFINED; + boolean isMiso; + android.hardware.tv.tuner.FrontendDvbtPlpMode plpMode = android.hardware.tv.tuner.FrontendDvbtPlpMode.UNDEFINED; + int plpId; + int plpGroupId; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtStandard.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtStandard.aidl new file mode 100644 index 0000000000..080cc5cc84 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtStandard.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="byte") @VintfStability +enum FrontendDvbtStandard { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + T = (1 << 1) /* 2 */, + T2 = (1 << 2) /* 4 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtTransmissionMode.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtTransmissionMode.aidl new file mode 100644 index 0000000000..3731f8691d --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendDvbtTransmissionMode.aidl @@ -0,0 +1,49 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendDvbtTransmissionMode { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + MODE_2K = (1 << 1) /* 2 */, + MODE_8K = (1 << 2) /* 4 */, + MODE_4K = (1 << 3) /* 8 */, + MODE_1K = (1 << 4) /* 16 */, + MODE_16K = (1 << 5) /* 32 */, + MODE_32K = (1 << 6) /* 64 */, + MODE_8K_E = (1 << 7) /* 128 */, + MODE_16K_E = (1 << 8) /* 256 */, + MODE_32K_E = (1 << 9) /* 512 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendEventType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendEventType.aidl new file mode 100644 index 0000000000..101e347153 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendEventType.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendEventType { + LOCKED, + NO_SIGNAL, + LOST_LOCK, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendGuardInterval.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendGuardInterval.aidl new file mode 100644 index 0000000000..15c738a47c --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendGuardInterval.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union FrontendGuardInterval { + android.hardware.tv.tuner.FrontendDvbtGuardInterval dvbt = android.hardware.tv.tuner.FrontendDvbtGuardInterval.UNDEFINED; + android.hardware.tv.tuner.FrontendIsdbtGuardInterval isdbt; + android.hardware.tv.tuner.FrontendDtmbGuardInterval dtmb; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendInfo.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendInfo.aidl new file mode 100644 index 0000000000..d5bdd58505 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendInfo.aidl @@ -0,0 +1,47 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendInfo { + android.hardware.tv.tuner.FrontendType type = android.hardware.tv.tuner.FrontendType.UNDEFINED; + long minFrequency; + long maxFrequency; + int minSymbolRate; + int maxSymbolRate; + long acquireRange; + int exclusiveGroupId; + android.hardware.tv.tuner.FrontendStatusType[] statusCaps; + android.hardware.tv.tuner.FrontendCapabilities frontendCaps; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendInnerFec.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendInnerFec.aidl new file mode 100644 index 0000000000..da91888d73 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendInnerFec.aidl @@ -0,0 +1,92 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="long") @VintfStability +enum FrontendInnerFec { + FEC_UNDEFINED = 0, + AUTO = (1L << 0) /* 1 */, + FEC_1_2 = (1L << 1) /* 2 */, + FEC_1_3 = (1L << 2) /* 4 */, + FEC_1_4 = (1L << 3) /* 8 */, + FEC_1_5 = (1L << 4) /* 16 */, + FEC_2_3 = (1L << 5) /* 32 */, + FEC_2_5 = (1L << 6) /* 64 */, + FEC_2_9 = (1L << 7) /* 128 */, + FEC_3_4 = (1L << 8) /* 256 */, + FEC_3_5 = (1L << 9) /* 512 */, + FEC_4_5 = (1L << 10) /* 1024 */, + FEC_4_15 = (1L << 11) /* 2048 */, + FEC_5_6 = (1L << 12) /* 4096 */, + FEC_5_9 = (1L << 13) /* 8192 */, + FEC_6_7 = (1L << 14) /* 16384 */, + FEC_7_8 = (1L << 15) /* 32768 */, + FEC_7_9 = (1L << 16) /* 65536 */, + FEC_7_15 = (1L << 17) /* 131072 */, + FEC_8_9 = (1L << 18) /* 262144 */, + FEC_8_15 = (1L << 19) /* 524288 */, + FEC_9_10 = (1L << 20) /* 1048576 */, + FEC_9_20 = (1L << 21) /* 2097152 */, + FEC_11_15 = (1L << 22) /* 4194304 */, + FEC_11_20 = (1L << 23) /* 8388608 */, + FEC_11_45 = (1L << 24) /* 16777216 */, + FEC_13_18 = (1L << 25) /* 33554432 */, + FEC_13_45 = (1L << 26) /* 67108864 */, + FEC_14_45 = (1L << 27) /* 134217728 */, + FEC_23_36 = (1L << 28) /* 268435456 */, + FEC_25_36 = (1L << 29) /* 536870912 */, + FEC_26_45 = (1L << 30) /* 1073741824 */, + FEC_28_45 = (1L << 31) /* 2147483648 */, + FEC_29_45 = (1L << 32) /* 4294967296 */, + FEC_31_45 = (1L << 33) /* 8589934592 */, + FEC_32_45 = (1L << 34) /* 17179869184 */, + FEC_77_90 = (1L << 35) /* 34359738368 */, + FEC_2_15 = (1L << 36) /* 68719476736 */, + FEC_3_15 = (1L << 37) /* 137438953472 */, + FEC_5_15 = (1L << 38) /* 274877906944 */, + FEC_6_15 = (1L << 39) /* 549755813888 */, + FEC_9_15 = (1L << 40) /* 1099511627776 */, + FEC_10_15 = (1L << 41) /* 2199023255552 */, + FEC_12_15 = (1L << 42) /* 4398046511104 */, + FEC_13_15 = (1L << 43) /* 8796093022208 */, + FEC_18_30 = (1L << 44) /* 17592186044416 */, + FEC_20_30 = (1L << 45) /* 35184372088832 */, + FEC_90_180 = (1L << 46) /* 70368744177664 */, + FEC_96_180 = (1L << 47) /* 140737488355328 */, + FEC_104_180 = (1L << 48) /* 281474976710656 */, + FEC_128_180 = (1L << 49) /* 562949953421312 */, + FEC_132_180 = (1L << 50) /* 1125899906842624 */, + FEC_135_180 = (1L << 51) /* 2251799813685248 */, + FEC_140_180 = (1L << 52) /* 4503599627370496 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendInterleaveMode.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendInterleaveMode.aidl new file mode 100644 index 0000000000..ac38731260 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendInterleaveMode.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union FrontendInterleaveMode { + android.hardware.tv.tuner.FrontendAtsc3TimeInterleaveMode atsc3 = android.hardware.tv.tuner.FrontendAtsc3TimeInterleaveMode.UNDEFINED; + android.hardware.tv.tuner.FrontendCableTimeInterleaveMode dvbc; + android.hardware.tv.tuner.FrontendDtmbTimeInterleaveMode dtmb; + android.hardware.tv.tuner.FrontendIsdbtTimeInterleaveMode isdbt; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvCapabilities.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvCapabilities.aidl new file mode 100644 index 0000000000..543543df96 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvCapabilities.aidl @@ -0,0 +1,39 @@ +/* + * Copyright 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendIptvCapabilities { + int protocolCap; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvSettings.aidl new file mode 100644 index 0000000000..73582f3efb --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvSettings.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendIptvSettings { + android.hardware.tv.tuner.FrontendIptvSettingsProtocol protocol = android.hardware.tv.tuner.FrontendIptvSettingsProtocol.UNDEFINED; + android.hardware.tv.tuner.FrontendIptvSettingsFec fec; + android.hardware.tv.tuner.FrontendIptvSettingsIgmp igmp = android.hardware.tv.tuner.FrontendIptvSettingsIgmp.UNDEFINED; + long bitrate; + android.hardware.tv.tuner.DemuxIpAddress ipAddr; + String contentUrl; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvSettingsFec.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvSettingsFec.aidl new file mode 100644 index 0000000000..c3613772ef --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvSettingsFec.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendIptvSettingsFec { + android.hardware.tv.tuner.FrontendIptvSettingsFecType type; + int fecColNum; + int fecRowNum; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvSettingsFecType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvSettingsFecType.aidl new file mode 100644 index 0000000000..5806cc5018 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvSettingsFecType.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendIptvSettingsFecType { + UNDEFINED = 0, + COLUMN = (1 << 0) /* 1 */, + ROW = (1 << 1) /* 2 */, + COLUMN_ROW = (1 << 2) /* 4 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvSettingsIgmp.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvSettingsIgmp.aidl new file mode 100644 index 0000000000..43ae523f19 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvSettingsIgmp.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendIptvSettingsIgmp { + UNDEFINED = 0, + V1 = (1 << 0) /* 1 */, + V2 = (1 << 1) /* 2 */, + V3 = (1 << 2) /* 4 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvSettingsProtocol.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvSettingsProtocol.aidl new file mode 100644 index 0000000000..2e4c47851b --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIptvSettingsProtocol.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendIptvSettingsProtocol { + UNDEFINED = 0, + UDP = (1 << 0) /* 1 */, + RTP = (1 << 1) /* 2 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbs3Capabilities.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbs3Capabilities.aidl new file mode 100644 index 0000000000..4be37c2006 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbs3Capabilities.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendIsdbs3Capabilities { + int modulationCap; + int coderateCap; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbs3Coderate.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbs3Coderate.aidl new file mode 100644 index 0000000000..de865cae01 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbs3Coderate.aidl @@ -0,0 +1,51 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendIsdbs3Coderate { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + CODERATE_1_3 = (1 << 1) /* 2 */, + CODERATE_2_5 = (1 << 2) /* 4 */, + CODERATE_1_2 = (1 << 3) /* 8 */, + CODERATE_3_5 = (1 << 4) /* 16 */, + CODERATE_2_3 = (1 << 5) /* 32 */, + CODERATE_3_4 = (1 << 6) /* 64 */, + CODERATE_7_9 = (1 << 7) /* 128 */, + CODERATE_4_5 = (1 << 8) /* 256 */, + CODERATE_5_6 = (1 << 9) /* 512 */, + CODERATE_7_8 = (1 << 10) /* 1024 */, + CODERATE_9_10 = (1 << 11) /* 2048 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbs3Modulation.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbs3Modulation.aidl new file mode 100644 index 0000000000..adc902d591 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbs3Modulation.aidl @@ -0,0 +1,45 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendIsdbs3Modulation { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + MOD_BPSK = (1 << 1) /* 2 */, + MOD_QPSK = (1 << 2) /* 4 */, + MOD_8PSK = (1 << 3) /* 8 */, + MOD_16APSK = (1 << 4) /* 16 */, + MOD_32APSK = (1 << 5) /* 32 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbs3Rolloff.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbs3Rolloff.aidl new file mode 100644 index 0000000000..c93cf2004a --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbs3Rolloff.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendIsdbs3Rolloff { + UNDEFINED, + ROLLOFF_0_03, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbs3Settings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbs3Settings.aidl new file mode 100644 index 0000000000..8c491d6fa2 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbs3Settings.aidl @@ -0,0 +1,46 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendIsdbs3Settings { + long frequency; + long endFrequency; + int streamId; + android.hardware.tv.tuner.FrontendIsdbsStreamIdType streamIdType = android.hardware.tv.tuner.FrontendIsdbsStreamIdType.UNDEFINED; + android.hardware.tv.tuner.FrontendIsdbs3Modulation modulation = android.hardware.tv.tuner.FrontendIsdbs3Modulation.UNDEFINED; + android.hardware.tv.tuner.FrontendIsdbs3Coderate coderate = android.hardware.tv.tuner.FrontendIsdbs3Coderate.UNDEFINED; + int symbolRate; + android.hardware.tv.tuner.FrontendIsdbs3Rolloff rolloff = android.hardware.tv.tuner.FrontendIsdbs3Rolloff.UNDEFINED; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsCapabilities.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsCapabilities.aidl new file mode 100644 index 0000000000..2cb892cd3d --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsCapabilities.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendIsdbsCapabilities { + int modulationCap; + int coderateCap; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsCoderate.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsCoderate.aidl new file mode 100644 index 0000000000..a0e436f540 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsCoderate.aidl @@ -0,0 +1,45 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendIsdbsCoderate { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + CODERATE_1_2 = (1 << 1) /* 2 */, + CODERATE_2_3 = (1 << 2) /* 4 */, + CODERATE_3_4 = (1 << 3) /* 8 */, + CODERATE_5_6 = (1 << 4) /* 16 */, + CODERATE_7_8 = (1 << 5) /* 32 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsModulation.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsModulation.aidl new file mode 100644 index 0000000000..61a21c397f --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsModulation.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendIsdbsModulation { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + MOD_BPSK = (1 << 1) /* 2 */, + MOD_QPSK = (1 << 2) /* 4 */, + MOD_TC8PSK = (1 << 3) /* 8 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsRolloff.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsRolloff.aidl new file mode 100644 index 0000000000..b769231043 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsRolloff.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendIsdbsRolloff { + UNDEFINED, + ROLLOFF_0_35, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsSettings.aidl new file mode 100644 index 0000000000..324fb6feb4 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsSettings.aidl @@ -0,0 +1,46 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendIsdbsSettings { + long frequency; + long endFrequency; + int streamId; + android.hardware.tv.tuner.FrontendIsdbsStreamIdType streamIdType = android.hardware.tv.tuner.FrontendIsdbsStreamIdType.UNDEFINED; + android.hardware.tv.tuner.FrontendIsdbsModulation modulation = android.hardware.tv.tuner.FrontendIsdbsModulation.UNDEFINED; + android.hardware.tv.tuner.FrontendIsdbsCoderate coderate = android.hardware.tv.tuner.FrontendIsdbsCoderate.UNDEFINED; + int symbolRate; + android.hardware.tv.tuner.FrontendIsdbsRolloff rolloff = android.hardware.tv.tuner.FrontendIsdbsRolloff.UNDEFINED; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsStreamIdType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsStreamIdType.aidl new file mode 100644 index 0000000000..77956b6278 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbsStreamIdType.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendIsdbsStreamIdType { + STREAM_ID, + RELATIVE_STREAM_NUMBER, + UNDEFINED, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtBandwidth.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtBandwidth.aidl new file mode 100644 index 0000000000..209620fddf --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtBandwidth.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendIsdbtBandwidth { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + BANDWIDTH_8MHZ = (1 << 1) /* 2 */, + BANDWIDTH_7MHZ = (1 << 2) /* 4 */, + BANDWIDTH_6MHZ = (1 << 3) /* 8 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtCapabilities.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtCapabilities.aidl new file mode 100644 index 0000000000..dbf631b8c7 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtCapabilities.aidl @@ -0,0 +1,46 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendIsdbtCapabilities { + int modeCap; + int bandwidthCap; + int modulationCap; + int coderateCap; + int guardIntervalCap; + int timeInterleaveCap; + boolean isSegmentAuto; + boolean isFullSegment; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtCoderate.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtCoderate.aidl new file mode 100644 index 0000000000..4236b7cf58 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtCoderate.aidl @@ -0,0 +1,49 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendIsdbtCoderate { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + CODERATE_1_2 = (1 << 1) /* 2 */, + CODERATE_2_3 = (1 << 2) /* 4 */, + CODERATE_3_4 = (1 << 3) /* 8 */, + CODERATE_5_6 = (1 << 4) /* 16 */, + CODERATE_7_8 = (1 << 5) /* 32 */, + CODERATE_3_5 = (1 << 6) /* 64 */, + CODERATE_4_5 = (1 << 7) /* 128 */, + CODERATE_6_7 = (1 << 8) /* 256 */, + CODERATE_8_9 = (1 << 9) /* 512 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtGuardInterval.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtGuardInterval.aidl new file mode 100644 index 0000000000..86225e2ab1 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtGuardInterval.aidl @@ -0,0 +1,47 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendIsdbtGuardInterval { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + INTERVAL_1_32 = (1 << 1) /* 2 */, + INTERVAL_1_16 = (1 << 2) /* 4 */, + INTERVAL_1_8 = (1 << 3) /* 8 */, + INTERVAL_1_4 = (1 << 4) /* 16 */, + INTERVAL_1_128 = (1 << 5) /* 32 */, + INTERVAL_19_128 = (1 << 6) /* 64 */, + INTERVAL_19_256 = (1 << 7) /* 128 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtLayerSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtLayerSettings.aidl new file mode 100644 index 0000000000..0055793439 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtLayerSettings.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendIsdbtLayerSettings { + android.hardware.tv.tuner.FrontendIsdbtModulation modulation = android.hardware.tv.tuner.FrontendIsdbtModulation.UNDEFINED; + android.hardware.tv.tuner.FrontendIsdbtCoderate coderate = android.hardware.tv.tuner.FrontendIsdbtCoderate.UNDEFINED; + android.hardware.tv.tuner.FrontendIsdbtTimeInterleaveMode timeInterleave = android.hardware.tv.tuner.FrontendIsdbtTimeInterleaveMode.UNDEFINED; + int numOfSegment; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtMode.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtMode.aidl new file mode 100644 index 0000000000..0e38c26370 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtMode.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendIsdbtMode { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + MODE_1 = (1 << 1) /* 2 */, + MODE_2 = (1 << 2) /* 4 */, + MODE_3 = (1 << 3) /* 8 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtModulation.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtModulation.aidl new file mode 100644 index 0000000000..4474c83917 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtModulation.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendIsdbtModulation { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + MOD_DQPSK = (1 << 1) /* 2 */, + MOD_QPSK = (1 << 2) /* 4 */, + MOD_16QAM = (1 << 3) /* 8 */, + MOD_64QAM = (1 << 4) /* 16 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtPartialReceptionFlag.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtPartialReceptionFlag.aidl new file mode 100644 index 0000000000..1387e662de --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtPartialReceptionFlag.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendIsdbtPartialReceptionFlag { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + FALSE = (1 << 1) /* 2 */, + TRUE = (1 << 2) /* 4 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtSettings.aidl new file mode 100644 index 0000000000..605bc210e5 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtSettings.aidl @@ -0,0 +1,47 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendIsdbtSettings { + long frequency; + long endFrequency; + android.hardware.tv.tuner.FrontendSpectralInversion inversion = android.hardware.tv.tuner.FrontendSpectralInversion.UNDEFINED; + android.hardware.tv.tuner.FrontendIsdbtBandwidth bandwidth = android.hardware.tv.tuner.FrontendIsdbtBandwidth.UNDEFINED; + android.hardware.tv.tuner.FrontendIsdbtMode mode = android.hardware.tv.tuner.FrontendIsdbtMode.UNDEFINED; + android.hardware.tv.tuner.FrontendIsdbtGuardInterval guardInterval = android.hardware.tv.tuner.FrontendIsdbtGuardInterval.UNDEFINED; + int serviceAreaId; + android.hardware.tv.tuner.FrontendIsdbtPartialReceptionFlag partialReceptionFlag = android.hardware.tv.tuner.FrontendIsdbtPartialReceptionFlag.UNDEFINED; + android.hardware.tv.tuner.FrontendIsdbtLayerSettings[] layerSettings; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtTimeInterleaveMode.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtTimeInterleaveMode.aidl new file mode 100644 index 0000000000..b9d76ee5b1 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendIsdbtTimeInterleaveMode.aidl @@ -0,0 +1,52 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendIsdbtTimeInterleaveMode { + UNDEFINED = 0, + AUTO = (1 << 0) /* 1 */, + INTERLEAVE_1_0 = (1 << 1) /* 2 */, + INTERLEAVE_1_4 = (1 << 2) /* 4 */, + INTERLEAVE_1_8 = (1 << 3) /* 8 */, + INTERLEAVE_1_16 = (1 << 4) /* 16 */, + INTERLEAVE_2_0 = (1 << 5) /* 32 */, + INTERLEAVE_2_2 = (1 << 6) /* 64 */, + INTERLEAVE_2_4 = (1 << 7) /* 128 */, + INTERLEAVE_2_8 = (1 << 8) /* 256 */, + INTERLEAVE_3_0 = (1 << 9) /* 512 */, + INTERLEAVE_3_1 = (1 << 10) /* 1024 */, + INTERLEAVE_3_2 = (1 << 11) /* 2048 */, + INTERLEAVE_3_4 = (1 << 12) /* 4096 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendModulation.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendModulation.aidl new file mode 100644 index 0000000000..6e396b0422 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendModulation.aidl @@ -0,0 +1,47 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union FrontendModulation { + android.hardware.tv.tuner.FrontendDvbcModulation dvbc = android.hardware.tv.tuner.FrontendDvbcModulation.UNDEFINED; + android.hardware.tv.tuner.FrontendDvbsModulation dvbs; + android.hardware.tv.tuner.FrontendDvbtConstellation dvbt; + android.hardware.tv.tuner.FrontendIsdbsModulation isdbs; + android.hardware.tv.tuner.FrontendIsdbs3Modulation isdbs3; + android.hardware.tv.tuner.FrontendIsdbtModulation isdbt; + android.hardware.tv.tuner.FrontendAtscModulation atsc; + android.hardware.tv.tuner.FrontendAtsc3Modulation atsc3; + android.hardware.tv.tuner.FrontendDtmbModulation dtmb; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendModulationStatus.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendModulationStatus.aidl new file mode 100644 index 0000000000..723fdd044b --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendModulationStatus.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union FrontendModulationStatus { + android.hardware.tv.tuner.FrontendDvbcModulation dvbc = android.hardware.tv.tuner.FrontendDvbcModulation.UNDEFINED; + android.hardware.tv.tuner.FrontendDvbsModulation dvbs; + android.hardware.tv.tuner.FrontendIsdbsModulation isdbs; + android.hardware.tv.tuner.FrontendIsdbs3Modulation isdbs3; + android.hardware.tv.tuner.FrontendIsdbtModulation isdbt; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendRollOff.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendRollOff.aidl new file mode 100644 index 0000000000..c5f8b8e8b7 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendRollOff.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union FrontendRollOff { + android.hardware.tv.tuner.FrontendDvbsRolloff dvbs = android.hardware.tv.tuner.FrontendDvbsRolloff.UNDEFINED; + android.hardware.tv.tuner.FrontendIsdbsRolloff isdbs; + android.hardware.tv.tuner.FrontendIsdbs3Rolloff isdbs3; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendScanAtsc3PlpInfo.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendScanAtsc3PlpInfo.aidl new file mode 100644 index 0000000000..56ef3e3d13 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendScanAtsc3PlpInfo.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendScanAtsc3PlpInfo { + int plpId; + boolean bLlsFlag; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendScanMessage.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendScanMessage.aidl new file mode 100644 index 0000000000..e763cfb617 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendScanMessage.aidl @@ -0,0 +1,54 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union FrontendScanMessage { + boolean isLocked; + boolean isEnd; + int progressPercent; + long[] frequencies; + int[] symbolRates; + android.hardware.tv.tuner.FrontendDvbtHierarchy hierarchy; + android.hardware.tv.tuner.FrontendAnalogType analogType; + int[] plpIds; + int[] groupIds; + int[] inputStreamIds; + android.hardware.tv.tuner.FrontendScanMessageStandard std; + android.hardware.tv.tuner.FrontendScanAtsc3PlpInfo[] atsc3PlpInfos; + android.hardware.tv.tuner.FrontendModulation modulation; + android.hardware.tv.tuner.FrontendDvbcAnnex annex; + boolean isHighPriority; + int[] dvbtCellIds; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendScanMessageStandard.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendScanMessageStandard.aidl new file mode 100644 index 0000000000..e163fc6670 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendScanMessageStandard.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union FrontendScanMessageStandard { + android.hardware.tv.tuner.FrontendDvbsStandard sStd = android.hardware.tv.tuner.FrontendDvbsStandard.UNDEFINED; + android.hardware.tv.tuner.FrontendDvbtStandard tStd; + android.hardware.tv.tuner.FrontendAnalogSifStandard sifStd; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendScanMessageType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendScanMessageType.aidl new file mode 100644 index 0000000000..186dbd7550 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendScanMessageType.aidl @@ -0,0 +1,54 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendScanMessageType { + LOCKED, + END, + PROGRESS_PERCENT, + FREQUENCY, + SYMBOL_RATE, + HIERARCHY, + ANALOG_TYPE, + PLP_IDS, + GROUP_IDS, + INPUT_STREAM_IDS, + STANDARD, + ATSC3_PLP_INFO, + MODULATION, + DVBC_ANNEX, + HIGH_PRIORITY, + DVBT_CELL_IDS, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendScanType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendScanType.aidl new file mode 100644 index 0000000000..cef02ccd75 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendScanType.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendScanType { + SCAN_UNDEFINED = 0, + SCAN_AUTO = (1 << 0) /* 1 */, + SCAN_BLIND = (1 << 1) /* 2 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendSettings.aidl new file mode 100644 index 0000000000..9810ba6490 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendSettings.aidl @@ -0,0 +1,49 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union FrontendSettings { + android.hardware.tv.tuner.FrontendAnalogSettings analog; + android.hardware.tv.tuner.FrontendAtscSettings atsc; + android.hardware.tv.tuner.FrontendAtsc3Settings atsc3; + android.hardware.tv.tuner.FrontendDvbsSettings dvbs; + android.hardware.tv.tuner.FrontendDvbcSettings dvbc; + android.hardware.tv.tuner.FrontendDvbtSettings dvbt; + android.hardware.tv.tuner.FrontendIsdbsSettings isdbs; + android.hardware.tv.tuner.FrontendIsdbs3Settings isdbs3; + android.hardware.tv.tuner.FrontendIsdbtSettings isdbt; + android.hardware.tv.tuner.FrontendDtmbSettings dtmb; + @nullable android.hardware.tv.tuner.FrontendIptvSettings iptv; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendSpectralInversion.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendSpectralInversion.aidl new file mode 100644 index 0000000000..14ec2fd4b9 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendSpectralInversion.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendSpectralInversion { + UNDEFINED, + NORMAL, + INVERTED, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendStatus.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendStatus.aidl new file mode 100644 index 0000000000..b991ab6836 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendStatus.aidl @@ -0,0 +1,85 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union FrontendStatus { + boolean isDemodLocked; + int snr; + int ber; + int per; + int preBer; + int signalQuality; + int signalStrength; + int symbolRate; + android.hardware.tv.tuner.FrontendInnerFec innerFec; + android.hardware.tv.tuner.FrontendModulationStatus modulationStatus; + android.hardware.tv.tuner.FrontendSpectralInversion inversion; + android.hardware.tv.tuner.LnbVoltage lnbVoltage; + int plpId; + boolean isEWBS; + int agc; + boolean isLnaOn; + boolean[] isLayerError; + int mer; + long freqOffset; + android.hardware.tv.tuner.FrontendDvbtHierarchy hierarchy; + boolean isRfLocked; + android.hardware.tv.tuner.FrontendStatusAtsc3PlpInfo[] plpInfo; + android.hardware.tv.tuner.FrontendModulation[] modulations; + int[] bers; + android.hardware.tv.tuner.FrontendInnerFec[] codeRates; + android.hardware.tv.tuner.FrontendBandwidth bandwidth; + android.hardware.tv.tuner.FrontendGuardInterval interval; + android.hardware.tv.tuner.FrontendTransmissionMode transmissionMode; + int uec; + int systemId; + android.hardware.tv.tuner.FrontendInterleaveMode[] interleaving; + int[] isdbtSegment; + int[] tsDataRate; + android.hardware.tv.tuner.FrontendRollOff rollOff; + boolean isMiso; + boolean isLinear; + boolean isShortFrames; + android.hardware.tv.tuner.FrontendIsdbtMode isdbtMode; + android.hardware.tv.tuner.FrontendIsdbtPartialReceptionFlag partialReceptionFlag; + int[] streamIdList; + int[] dvbtCellIds; + android.hardware.tv.tuner.FrontendScanAtsc3PlpInfo[] allPlpInfo; + String iptvContentUrl = ""; + long iptvPacketsReceived; + long iptvPacketsLost; + int iptvWorstJitterMs; + int iptvAverageJitterMs; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendStatusAtsc3PlpInfo.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendStatusAtsc3PlpInfo.aidl new file mode 100644 index 0000000000..8f65925236 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendStatusAtsc3PlpInfo.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable FrontendStatusAtsc3PlpInfo { + int plpId; + boolean isLocked; + int uec; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendStatusReadiness.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendStatusReadiness.aidl new file mode 100644 index 0000000000..13735fae8e --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendStatusReadiness.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendStatusReadiness { + UNDEFINED, + UNAVAILABLE, + UNSTABLE, + STABLE, + UNSUPPORTED, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendStatusType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendStatusType.aidl new file mode 100644 index 0000000000..9f34e8ddcf --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendStatusType.aidl @@ -0,0 +1,85 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendStatusType { + DEMOD_LOCK, + SNR, + BER, + PER, + PRE_BER, + SIGNAL_QUALITY, + SIGNAL_STRENGTH, + SYMBOL_RATE, + FEC, + MODULATION, + SPECTRAL, + LNB_VOLTAGE, + PLP_ID, + EWBS, + AGC, + LNA, + LAYER_ERROR, + MER, + FREQ_OFFSET, + HIERARCHY, + RF_LOCK, + ATSC3_PLP_INFO, + MODULATIONS, + BERS, + CODERATES, + BANDWIDTH, + GUARD_INTERVAL, + TRANSMISSION_MODE, + UEC, + T2_SYSTEM_ID, + INTERLEAVINGS, + ISDBT_SEGMENTS, + TS_DATA_RATES, + ROLL_OFF, + IS_MISO, + IS_LINEAR, + IS_SHORT_FRAMES, + ISDBT_MODE, + ISDBT_PARTIAL_RECEPTION_FLAG, + STREAM_ID_LIST, + DVBT_CELL_IDS, + ATSC3_ALL_PLP_INFO, + IPTV_CONTENT_URL, + IPTV_PACKETS_LOST, + IPTV_PACKETS_RECEIVED, + IPTV_WORST_JITTER_MS, + IPTV_AVERAGE_JITTER_MS, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendTransmissionMode.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendTransmissionMode.aidl new file mode 100644 index 0000000000..72c36419ec --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendTransmissionMode.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +union FrontendTransmissionMode { + android.hardware.tv.tuner.FrontendDvbtTransmissionMode dvbt = android.hardware.tv.tuner.FrontendDvbtTransmissionMode.UNDEFINED; + android.hardware.tv.tuner.FrontendIsdbtMode isdbt; + android.hardware.tv.tuner.FrontendDtmbTransmissionMode dtmb; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendType.aidl new file mode 100644 index 0000000000..455bbc0551 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/FrontendType.aidl @@ -0,0 +1,50 @@ +/* + * Copyright 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum FrontendType { + UNDEFINED = 0, + ANALOG, + ATSC, + ATSC3, + DVBC, + DVBS, + DVBT, + ISDBS, + ISDBS3, + ISDBT, + DTMB, + IPTV, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IDemux.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IDemux.aidl new file mode 100644 index 0000000000..59ec92ba3b --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IDemux.aidl @@ -0,0 +1,47 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +interface IDemux { + void setFrontendDataSource(in int frontendId); + android.hardware.tv.tuner.IFilter openFilter(in android.hardware.tv.tuner.DemuxFilterType type, in int bufferSize, in android.hardware.tv.tuner.IFilterCallback cb); + android.hardware.tv.tuner.ITimeFilter openTimeFilter(); + int getAvSyncHwId(in android.hardware.tv.tuner.IFilter filter); + long getAvSyncTime(in int avSyncHwId); + void close(); + android.hardware.tv.tuner.IDvr openDvr(in android.hardware.tv.tuner.DvrType type, in int bufferSize, in android.hardware.tv.tuner.IDvrCallback cb); + void connectCiCam(in int ciCamId); + void disconnectCiCam(); +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IDescrambler.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IDescrambler.aidl new file mode 100644 index 0000000000..3cf3c044ba --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IDescrambler.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +interface IDescrambler { + void setDemuxSource(in int demuxId); + void setKeyToken(in byte[] keyToken); + void addPid(in android.hardware.tv.tuner.DemuxPid pid, in android.hardware.tv.tuner.IFilter optionalSourceFilter); + void removePid(in android.hardware.tv.tuner.DemuxPid pid, in android.hardware.tv.tuner.IFilter optionalSourceFilter); + void close(); +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IDvr.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IDvr.aidl new file mode 100644 index 0000000000..4648712393 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IDvr.aidl @@ -0,0 +1,47 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +interface IDvr { + void getQueueDesc(out android.hardware.common.fmq.MQDescriptor queue); + void configure(in android.hardware.tv.tuner.DvrSettings settings); + void attachFilter(in android.hardware.tv.tuner.IFilter filter); + void detachFilter(in android.hardware.tv.tuner.IFilter filter); + void start(); + void stop(); + void flush(); + void close(); + void setStatusCheckIntervalHint(in long milliseconds); +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IDvrCallback.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IDvrCallback.aidl new file mode 100644 index 0000000000..13c8644b7b --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IDvrCallback.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +interface IDvrCallback { + oneway void onPlaybackStatus(in android.hardware.tv.tuner.PlaybackStatus status); + oneway void onRecordStatus(in android.hardware.tv.tuner.RecordStatus status); +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IFilter.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IFilter.aidl new file mode 100644 index 0000000000..32d9d64f73 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IFilter.aidl @@ -0,0 +1,53 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +interface IFilter { + void getQueueDesc(out android.hardware.common.fmq.MQDescriptor queue); + void close(); + void configure(in android.hardware.tv.tuner.DemuxFilterSettings settings); + void configureAvStreamType(in android.hardware.tv.tuner.AvStreamType avStreamType); + void configureIpCid(in int ipCid); + void configureMonitorEvent(in int monitorEventTypes); + void start(); + void stop(); + void flush(); + long getAvSharedHandle(out android.hardware.common.NativeHandle avMemory); + int getId(); + long getId64Bit(); + void releaseAvHandle(in android.hardware.common.NativeHandle avMemory, in long avDataId); + void setDataSource(in android.hardware.tv.tuner.IFilter filter); + void setDelayHint(in android.hardware.tv.tuner.FilterDelayHint hint); +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IFilterCallback.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IFilterCallback.aidl new file mode 100644 index 0000000000..d8bedba451 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IFilterCallback.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +interface IFilterCallback { + oneway void onFilterEvent(in android.hardware.tv.tuner.DemuxFilterEvent[] events); + oneway void onFilterStatus(in android.hardware.tv.tuner.DemuxFilterStatus status); +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IFrontend.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IFrontend.aidl new file mode 100644 index 0000000000..3e3ff4fad6 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IFrontend.aidl @@ -0,0 +1,51 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +interface IFrontend { + void setCallback(in android.hardware.tv.tuner.IFrontendCallback callback); + void tune(in android.hardware.tv.tuner.FrontendSettings settings); + void stopTune(); + void close(); + void scan(in android.hardware.tv.tuner.FrontendSettings settings, in android.hardware.tv.tuner.FrontendScanType type); + void stopScan(); + android.hardware.tv.tuner.FrontendStatus[] getStatus(in android.hardware.tv.tuner.FrontendStatusType[] statusTypes); + void setLnb(in int lnbId); + int linkCiCam(in int ciCamId); + void unlinkCiCam(in int ciCamId); + String getHardwareInfo(); + void removeOutputPid(int pid); + android.hardware.tv.tuner.FrontendStatusReadiness[] getFrontendStatusReadiness(in android.hardware.tv.tuner.FrontendStatusType[] statusTypes); +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IFrontendCallback.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IFrontendCallback.aidl new file mode 100644 index 0000000000..c22d280834 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/IFrontendCallback.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +interface IFrontendCallback { + oneway void onEvent(in android.hardware.tv.tuner.FrontendEventType frontendEventType); + oneway void onScanMessage(in android.hardware.tv.tuner.FrontendScanMessageType type, in android.hardware.tv.tuner.FrontendScanMessage message); +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/ILnb.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/ILnb.aidl new file mode 100644 index 0000000000..c3fdd87e62 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/ILnb.aidl @@ -0,0 +1,44 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +interface ILnb { + void setCallback(in android.hardware.tv.tuner.ILnbCallback callback); + void setVoltage(in android.hardware.tv.tuner.LnbVoltage voltage); + void setTone(in android.hardware.tv.tuner.LnbTone tone); + void setSatellitePosition(in android.hardware.tv.tuner.LnbPosition position); + void sendDiseqcMessage(in byte[] diseqcMessage); + void close(); +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/ILnbCallback.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/ILnbCallback.aidl new file mode 100644 index 0000000000..42e84da4d1 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/ILnbCallback.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +interface ILnbCallback { + oneway void onDiseqcMessage(in byte[] diseqcMessage); + oneway void onEvent(in android.hardware.tv.tuner.LnbEventType lnbEventType); +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/ITimeFilter.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/ITimeFilter.aidl new file mode 100644 index 0000000000..838eeba1d2 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/ITimeFilter.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +interface ITimeFilter { + void setTimeStamp(in long timeStamp); + void clearTimeStamp(); + long getTimeStamp(); + long getSourceTime(); + void close(); +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/ITuner.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/ITuner.aidl new file mode 100644 index 0000000000..732f3fd952 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/ITuner.aidl @@ -0,0 +1,54 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@SuppressWarnings(value={"out-array"}) @VintfStability +interface ITuner { + int[] getFrontendIds(); + android.hardware.tv.tuner.IFrontend openFrontendById(in int frontendId); + android.hardware.tv.tuner.IDemux openDemux(out int[] demuxId); + android.hardware.tv.tuner.DemuxCapabilities getDemuxCaps(); + android.hardware.tv.tuner.IDescrambler openDescrambler(); + android.hardware.tv.tuner.FrontendInfo getFrontendInfo(in int frontendId); + int[] getLnbIds(); + android.hardware.tv.tuner.ILnb openLnbById(in int lnbId); + android.hardware.tv.tuner.ILnb openLnbByName(in String lnbName, out int[] lnbId); + void setLna(in boolean bEnable); + void setMaxNumberOfFrontends(in android.hardware.tv.tuner.FrontendType frontendType, in int maxNumber); + int getMaxNumberOfFrontends(in android.hardware.tv.tuner.FrontendType frontendType); + boolean isLnaSupported(); + int[] getDemuxIds(); + android.hardware.tv.tuner.IDemux openDemuxById(in int demuxId); + android.hardware.tv.tuner.DemuxInfo getDemuxInfo(in int demuxId); +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/LnbEventType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/LnbEventType.aidl new file mode 100644 index 0000000000..7bec809d7f --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/LnbEventType.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum LnbEventType { + DISEQC_RX_OVERFLOW, + DISEQC_RX_TIMEOUT, + DISEQC_RX_PARITY_ERROR, + LNB_OVERLOAD, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/LnbPosition.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/LnbPosition.aidl new file mode 100644 index 0000000000..a4a5740630 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/LnbPosition.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum LnbPosition { + UNDEFINED, + POSITION_A, + POSITION_B, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/LnbTone.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/LnbTone.aidl new file mode 100644 index 0000000000..06283540d9 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/LnbTone.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum LnbTone { + NONE, + CONTINUOUS, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/LnbVoltage.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/LnbVoltage.aidl new file mode 100644 index 0000000000..b18ff0e120 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/LnbVoltage.aidl @@ -0,0 +1,47 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum LnbVoltage { + NONE, + VOLTAGE_5V, + VOLTAGE_11V, + VOLTAGE_12V, + VOLTAGE_13V, + VOLTAGE_14V, + VOLTAGE_15V, + VOLTAGE_18V, + VOLTAGE_19V, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/PlaybackSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/PlaybackSettings.aidl new file mode 100644 index 0000000000..e0dd5db071 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/PlaybackSettings.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable PlaybackSettings { + int statusMask; + long lowThreshold; + long highThreshold; + android.hardware.tv.tuner.DataFormat dataFormat = android.hardware.tv.tuner.DataFormat.UNDEFINED; + long packetSize; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/PlaybackStatus.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/PlaybackStatus.aidl new file mode 100644 index 0000000000..a8b63782f2 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/PlaybackStatus.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum PlaybackStatus { + SPACE_EMPTY = (1 << 0) /* 1 */, + SPACE_ALMOST_EMPTY = (1 << 1) /* 2 */, + SPACE_ALMOST_FULL = (1 << 2) /* 4 */, + SPACE_FULL = (1 << 3) /* 8 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/RecordSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/RecordSettings.aidl new file mode 100644 index 0000000000..de693cd2d2 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/RecordSettings.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@VintfStability +parcelable RecordSettings { + int statusMask; + long lowThreshold; + long highThreshold; + android.hardware.tv.tuner.DataFormat dataFormat = android.hardware.tv.tuner.DataFormat.UNDEFINED; + long packetSize; +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/RecordStatus.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/RecordStatus.aidl new file mode 100644 index 0000000000..e06b6160db --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/RecordStatus.aidl @@ -0,0 +1,42 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="byte") @VintfStability +enum RecordStatus { + DATA_READY = (1 << 0) /* 1 */, + LOW_WATER = (1 << 1) /* 2 */, + HIGH_WATER = (1 << 2) /* 4 */, + OVERFLOW = (1 << 3) /* 8 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/Result.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/Result.aidl new file mode 100644 index 0000000000..ae43350549 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/Result.aidl @@ -0,0 +1,45 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum Result { + SUCCESS, + UNAVAILABLE, + NOT_INITIALIZED, + INVALID_STATE, + INVALID_ARGUMENT, + OUT_OF_MEMORY, + UNKNOWN_ERROR, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/ScramblingStatus.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/ScramblingStatus.aidl new file mode 100644 index 0000000000..4d52de17c3 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/ScramblingStatus.aidl @@ -0,0 +1,41 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum ScramblingStatus { + UNKNOWN = (1 << 0) /* 1 */, + NOT_SCRAMBLED = (1 << 1) /* 2 */, + SCRAMBLED = (1 << 2) /* 4 */, +} diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/VideoStreamType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/VideoStreamType.aidl new file mode 100644 index 0000000000..530f4549d2 --- /dev/null +++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/2/android/hardware/tv/tuner/VideoStreamType.aidl @@ -0,0 +1,52 @@ +/* + * Copyright 2021 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 -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.hardware.tv.tuner; +/* @hide */ +@Backing(type="int") @VintfStability +enum VideoStreamType { + UNDEFINED, + RESERVED, + MPEG1, + MPEG2, + MPEG4P2, + AVC, + HEVC, + VC1, + VP8, + VP9, + AV1, + AVS, + AVS2, + VVC, +} diff --git a/usb/aidl/Android.bp b/usb/aidl/Android.bp index 4f59f02024..b82f6d5043 100644 --- a/usb/aidl/Android.bp +++ b/usb/aidl/Android.bp @@ -39,6 +39,12 @@ aidl_interface { version: "1", imports: [], }, + { + version: "2", + imports: [], + }, + ], + frozen: true, } diff --git a/usb/aidl/aidl_api/android.hardware.usb/2/.hash b/usb/aidl/aidl_api/android.hardware.usb/2/.hash new file mode 100644 index 0000000000..ce43da6c53 --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/2/.hash @@ -0,0 +1 @@ +6c1263ce61606107f41a9edb66be1783d5881f00 diff --git a/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/AltModeData.aidl b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/AltModeData.aidl new file mode 100644 index 0000000000..d25ee84151 --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/AltModeData.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not us e 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 -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.hardware.usb; +@VintfStability +union AltModeData { + android.hardware.usb.AltModeData.DisplayPortAltModeData displayPortAltModeData; + @VintfStability + parcelable DisplayPortAltModeData { + android.hardware.usb.DisplayPortAltModeStatus partnerSinkStatus = android.hardware.usb.DisplayPortAltModeStatus.UNKNOWN; + android.hardware.usb.DisplayPortAltModeStatus cableStatus = android.hardware.usb.DisplayPortAltModeStatus.UNKNOWN; + android.hardware.usb.DisplayPortAltModePinAssignment pinAssignment = android.hardware.usb.DisplayPortAltModePinAssignment.NONE; + boolean hpd = false; + android.hardware.usb.LinkTrainingStatus linkTrainingStatus = android.hardware.usb.LinkTrainingStatus.UNKNOWN; + } +} diff --git a/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/ComplianceWarning.aidl b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/ComplianceWarning.aidl new file mode 100644 index 0000000000..8b67070bc6 --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/ComplianceWarning.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.usb; +@Backing(type="int") @VintfStability +enum ComplianceWarning { + OTHER = 1, + DEBUG_ACCESSORY = 2, + BC_1_2 = 3, + MISSING_RP = 4, +} diff --git a/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/ContaminantDetectionStatus.aidl b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/ContaminantDetectionStatus.aidl new file mode 100644 index 0000000000..24c69664f7 --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/ContaminantDetectionStatus.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.usb; +@VintfStability +enum ContaminantDetectionStatus { + NOT_SUPPORTED = 0, + DISABLED = 1, + NOT_DETECTED = 2, + DETECTED = 3, +} diff --git a/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/ContaminantProtectionMode.aidl b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/ContaminantProtectionMode.aidl new file mode 100644 index 0000000000..99798693ff --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/ContaminantProtectionMode.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.usb; +@VintfStability +enum ContaminantProtectionMode { + NONE = 0, + FORCE_SINK = 1, + FORCE_SOURCE = 2, + FORCE_DISABLE = 3, +} diff --git a/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/ContaminantProtectionStatus.aidl b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/ContaminantProtectionStatus.aidl new file mode 100644 index 0000000000..9642261444 --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/ContaminantProtectionStatus.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.usb; +@VintfStability +enum ContaminantProtectionStatus { + NONE = 0, + FORCE_SINK = 1, + FORCE_SOURCE = 2, + FORCE_DISABLE = 3, + DISABLED = 4, +} diff --git a/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/DisplayPortAltModePinAssignment.aidl b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/DisplayPortAltModePinAssignment.aidl new file mode 100644 index 0000000000..5908117e9e --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/DisplayPortAltModePinAssignment.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.usb; +@Backing(type="int") @VintfStability +enum DisplayPortAltModePinAssignment { + NONE = 0, + A = 1, + B = 2, + C = 3, + D = 4, + E = 5, + F = 6, +} diff --git a/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/DisplayPortAltModeStatus.aidl b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/DisplayPortAltModeStatus.aidl new file mode 100644 index 0000000000..dc69b98955 --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/DisplayPortAltModeStatus.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.usb; +@Backing(type="int") @VintfStability +enum DisplayPortAltModeStatus { + UNKNOWN = 0, + NOT_CAPABLE = 1, + CAPABLE = 2, + ENABLED = 3, +} diff --git a/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/IUsb.aidl b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/IUsb.aidl new file mode 100644 index 0000000000..859f52652b --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/IUsb.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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 -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.hardware.usb; +@VintfStability +interface IUsb { + oneway void enableContaminantPresenceDetection(in String portName, in boolean enable, long transactionId); + oneway void enableUsbData(in String portName, boolean enable, long transactionId); + oneway void enableUsbDataWhileDocked(in String portName, long transactionId); + oneway void queryPortStatus(long transactionId); + oneway void setCallback(in android.hardware.usb.IUsbCallback callback); + oneway void switchRole(in String portName, in android.hardware.usb.PortRole role, long transactionId); + oneway void limitPowerTransfer(in String portName, boolean limit, long transactionId); + oneway void resetUsbPort(in String portName, long transactionId); +} diff --git a/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/IUsbCallback.aidl b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/IUsbCallback.aidl new file mode 100644 index 0000000000..4abfaec53b --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/IUsbCallback.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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 -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.hardware.usb; +@VintfStability +interface IUsbCallback { + oneway void notifyPortStatusChange(in android.hardware.usb.PortStatus[] currentPortStatus, in android.hardware.usb.Status retval); + oneway void notifyRoleSwitchStatus(in String portName, in android.hardware.usb.PortRole newRole, in android.hardware.usb.Status retval, long transactionId); + oneway void notifyEnableUsbDataStatus(in String portName, boolean enable, in android.hardware.usb.Status retval, long transactionId); + oneway void notifyEnableUsbDataWhileDockedStatus(in String portName, in android.hardware.usb.Status retval, long transactionId); + oneway void notifyContaminantEnabledStatus(in String portName, boolean enable, in android.hardware.usb.Status retval, long transactionId); + oneway void notifyQueryPortStatus(in String portName, in android.hardware.usb.Status retval, long transactionId); + oneway void notifyLimitPowerTransferStatus(in String portName, boolean limit, in android.hardware.usb.Status retval, long transactionId); + oneway void notifyResetUsbPortStatus(in String portName, in android.hardware.usb.Status retval, long transactionId); +} diff --git a/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/LinkTrainingStatus.aidl b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/LinkTrainingStatus.aidl new file mode 100644 index 0000000000..1f0b2dcca7 --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/LinkTrainingStatus.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.usb; +@Backing(type="int") @VintfStability +enum LinkTrainingStatus { + UNKNOWN = 0, + SUCCESS = 1, + FAILURE = 2, +} diff --git a/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PlugOrientation.aidl b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PlugOrientation.aidl new file mode 100644 index 0000000000..e2185444b1 --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PlugOrientation.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.usb; +@Backing(type="int") @VintfStability +enum PlugOrientation { + UNKNOWN = 0, + UNPLUGGED = 1, + PLUGGED_UNKNOWN = 2, + PLUGGED_NORMAL = 3, + PLUGGED_FLIPPED = 4, +} diff --git a/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PortDataRole.aidl b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PortDataRole.aidl new file mode 100644 index 0000000000..105b316775 --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PortDataRole.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.usb; +@VintfStability +enum PortDataRole { + NONE = 0, + HOST = 1, + DEVICE = 2, +} diff --git a/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PortMode.aidl b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PortMode.aidl new file mode 100644 index 0000000000..34e43343ad --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PortMode.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.usb; +@VintfStability +enum PortMode { + NONE = 0, + UFP = 1, + DFP = 2, + DRP = 3, + AUDIO_ACCESSORY = 4, + DEBUG_ACCESSORY = 5, +} diff --git a/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PortPowerRole.aidl b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PortPowerRole.aidl new file mode 100644 index 0000000000..0e6f3fb426 --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PortPowerRole.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.usb; +@VintfStability +enum PortPowerRole { + NONE = 0, + SOURCE = 1, + SINK = 2, +} diff --git a/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PortRole.aidl b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PortRole.aidl new file mode 100644 index 0000000000..c66aeccde9 --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PortRole.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.usb; +@VintfStability +union PortRole { + android.hardware.usb.PortPowerRole powerRole = android.hardware.usb.PortPowerRole.NONE; + android.hardware.usb.PortDataRole dataRole; + android.hardware.usb.PortMode mode; +} diff --git a/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PortStatus.aidl b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PortStatus.aidl new file mode 100644 index 0000000000..cefddba719 --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PortStatus.aidl @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2021 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 -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.hardware.usb; +@VintfStability +parcelable PortStatus { + String portName; + android.hardware.usb.PortDataRole currentDataRole = android.hardware.usb.PortDataRole.NONE; + android.hardware.usb.PortPowerRole currentPowerRole = android.hardware.usb.PortPowerRole.NONE; + android.hardware.usb.PortMode currentMode = android.hardware.usb.PortMode.NONE; + boolean canChangeMode; + boolean canChangeDataRole; + boolean canChangePowerRole; + android.hardware.usb.PortMode[] supportedModes; + android.hardware.usb.ContaminantProtectionMode[] supportedContaminantProtectionModes; + boolean supportsEnableContaminantPresenceProtection; + android.hardware.usb.ContaminantProtectionStatus contaminantProtectionStatus = android.hardware.usb.ContaminantProtectionStatus.NONE; + boolean supportsEnableContaminantPresenceDetection; + android.hardware.usb.ContaminantDetectionStatus contaminantDetectionStatus = android.hardware.usb.ContaminantDetectionStatus.NOT_SUPPORTED; + android.hardware.usb.UsbDataStatus[] usbDataStatus; + boolean powerTransferLimited; + android.hardware.usb.PowerBrickStatus powerBrickStatus; + boolean supportsComplianceWarnings = false; + android.hardware.usb.ComplianceWarning[] complianceWarnings = {}; + android.hardware.usb.PlugOrientation plugOrientation = android.hardware.usb.PlugOrientation.UNKNOWN; + android.hardware.usb.AltModeData[] supportedAltModes = {}; +} diff --git a/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PowerBrickStatus.aidl b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PowerBrickStatus.aidl new file mode 100644 index 0000000000..01d2fdd9f7 --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/PowerBrickStatus.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.usb; +@VintfStability +enum PowerBrickStatus { + UNKNOWN = 0, + CONNECTED = 1, + NOT_CONNECTED = 2, +} diff --git a/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/Status.aidl b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/Status.aidl new file mode 100644 index 0000000000..f28fc2a70e --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/Status.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.usb; +@Backing(type="int") @VintfStability +enum Status { + SUCCESS = 0, + ERROR = 1, + INVALID_ARGUMENT = 2, + UNRECOGNIZED_ROLE = 3, + NOT_SUPPORTED = 4, +} diff --git a/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/UsbDataStatus.aidl b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/UsbDataStatus.aidl new file mode 100644 index 0000000000..b976852b3e --- /dev/null +++ b/usb/aidl/aidl_api/android.hardware.usb/2/android/hardware/usb/UsbDataStatus.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.usb; +@VintfStability +enum UsbDataStatus { + UNKNOWN = 0, + ENABLED = 1, + DISABLED_OVERHEAT = 2, + DISABLED_CONTAMINANT = 3, + DISABLED_DOCK = 4, + DISABLED_FORCE = 5, + DISABLED_DEBUG = 6, + DISABLED_DOCK_HOST_MODE = 7, + DISABLED_DOCK_DEVICE_MODE = 8, +} diff --git a/usb/gadget/aidl/Android.bp b/usb/gadget/aidl/Android.bp index cb8560aebc..eb1996b0b8 100644 --- a/usb/gadget/aidl/Android.bp +++ b/usb/gadget/aidl/Android.bp @@ -34,4 +34,12 @@ aidl_interface { sdk_version: "module_current", }, }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + frozen: true, + } diff --git a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/.hash b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/.hash new file mode 100644 index 0000000000..ea51eecbda --- /dev/null +++ b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/.hash @@ -0,0 +1 @@ +cb628c69682659911bca5c1d04042adba7f0de4b diff --git a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/android/hardware/usb/gadget/GadgetFunction.aidl b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/android/hardware/usb/gadget/GadgetFunction.aidl new file mode 100644 index 0000000000..0cf58441e7 --- /dev/null +++ b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/android/hardware/usb/gadget/GadgetFunction.aidl @@ -0,0 +1,47 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.usb.gadget; +@VintfStability +parcelable GadgetFunction { + const long NONE = 0; + const long ADB = 1; + const long ACCESSORY = (1 << 1) /* 2 */; + const long MTP = (1 << 2) /* 4 */; + const long MIDI = (1 << 3) /* 8 */; + const long PTP = (1 << 4) /* 16 */; + const long RNDIS = (1 << 5) /* 32 */; + const long AUDIO_SOURCE = (1 << 6) /* 64 */; + const long UVC = (1 << 7) /* 128 */; + const long NCM = (1 << 10) /* 1024 */; +} diff --git a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/android/hardware/usb/gadget/IUsbGadget.aidl b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/android/hardware/usb/gadget/IUsbGadget.aidl new file mode 100644 index 0000000000..b5c0b5c253 --- /dev/null +++ b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/android/hardware/usb/gadget/IUsbGadget.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.usb.gadget; +@VintfStability +interface IUsbGadget { + oneway void setCurrentUsbFunctions(in long functions, in android.hardware.usb.gadget.IUsbGadgetCallback callback, in long timeoutMs, long transactionId); + oneway void getCurrentUsbFunctions(in android.hardware.usb.gadget.IUsbGadgetCallback callback, long transactionId); + oneway void getUsbSpeed(in android.hardware.usb.gadget.IUsbGadgetCallback callback, long transactionId); + oneway void reset(in android.hardware.usb.gadget.IUsbGadgetCallback callback, long transactionId); +} diff --git a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/android/hardware/usb/gadget/IUsbGadgetCallback.aidl b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/android/hardware/usb/gadget/IUsbGadgetCallback.aidl new file mode 100644 index 0000000000..b2b0e5ad58 --- /dev/null +++ b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/android/hardware/usb/gadget/IUsbGadgetCallback.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.usb.gadget; +@VintfStability +interface IUsbGadgetCallback { + oneway void setCurrentUsbFunctionsCb(in long functions, in android.hardware.usb.gadget.Status status, long transactionId); + oneway void getCurrentUsbFunctionsCb(in long functions, in android.hardware.usb.gadget.Status status, long transactionId); + oneway void getUsbSpeedCb(in android.hardware.usb.gadget.UsbSpeed speed, long transactionId); + oneway void resetCb(in android.hardware.usb.gadget.Status status, long transactionId); +} diff --git a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/android/hardware/usb/gadget/Status.aidl b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/android/hardware/usb/gadget/Status.aidl new file mode 100644 index 0000000000..bdcf6854fe --- /dev/null +++ b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/android/hardware/usb/gadget/Status.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.usb.gadget; +@Backing(type="int") @VintfStability +enum Status { + SUCCESS = 0, + ERROR = 1, + FUNCTIONS_APPLIED = 2, + FUNCTIONS_NOT_APPLIED = 3, + CONFIGURATION_NOT_SUPPORTED = 4, +} diff --git a/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/android/hardware/usb/gadget/UsbSpeed.aidl b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/android/hardware/usb/gadget/UsbSpeed.aidl new file mode 100644 index 0000000000..fea35098c3 --- /dev/null +++ b/usb/gadget/aidl/aidl_api/android.hardware.usb.gadget/1/android/hardware/usb/gadget/UsbSpeed.aidl @@ -0,0 +1,48 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.usb.gadget; +@Backing(type="int") @VintfStability +enum UsbSpeed { + UNKNOWN = (-1) /* -1 */, + LOWSPEED = 0, + FULLSPEED = 1, + HIGHSPEED = 2, + SUPERSPEED = 3, + SUPERSPEED_10Gb = 4, + SUPERSPEED_20Gb = 5, + USB4_GEN2_10Gb = 6, + USB4_GEN2_20Gb = 7, + USB4_GEN3_20Gb = 8, + USB4_GEN3_40Gb = 9, +} diff --git a/weaver/aidl/Android.bp b/weaver/aidl/Android.bp index 74cec99f7d..38d017f9b5 100644 --- a/weaver/aidl/Android.bp +++ b/weaver/aidl/Android.bp @@ -22,5 +22,11 @@ aidl_interface { version: "1", imports: [], }, + { + version: "2", + imports: [], + }, + ], + frozen: true, } diff --git a/weaver/aidl/aidl_api/android.hardware.weaver/2/.hash b/weaver/aidl/aidl_api/android.hardware.weaver/2/.hash new file mode 100644 index 0000000000..0d204c98ac --- /dev/null +++ b/weaver/aidl/aidl_api/android.hardware.weaver/2/.hash @@ -0,0 +1 @@ +0d60d74c2704ad281e219244514516db8482ef3d diff --git a/weaver/aidl/aidl_api/android.hardware.weaver/2/android/hardware/weaver/IWeaver.aidl b/weaver/aidl/aidl_api/android.hardware.weaver/2/android/hardware/weaver/IWeaver.aidl new file mode 100644 index 0000000000..61627d95c4 --- /dev/null +++ b/weaver/aidl/aidl_api/android.hardware.weaver/2/android/hardware/weaver/IWeaver.aidl @@ -0,0 +1,43 @@ +/* + * Copyright 2020 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 -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.hardware.weaver; +@VintfStability +interface IWeaver { + android.hardware.weaver.WeaverConfig getConfig(); + android.hardware.weaver.WeaverReadResponse read(in int slotId, in byte[] key); + void write(in int slotId, in byte[] key, in byte[] value); + const int STATUS_FAILED = 1; + const int STATUS_INCORRECT_KEY = 2; + const int STATUS_THROTTLE = 3; +} diff --git a/weaver/aidl/aidl_api/android.hardware.weaver/2/android/hardware/weaver/WeaverConfig.aidl b/weaver/aidl/aidl_api/android.hardware.weaver/2/android/hardware/weaver/WeaverConfig.aidl new file mode 100644 index 0000000000..7491f32872 --- /dev/null +++ b/weaver/aidl/aidl_api/android.hardware.weaver/2/android/hardware/weaver/WeaverConfig.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 2020 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 -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.hardware.weaver; +@VintfStability +parcelable WeaverConfig { + int slots; + int keySize; + int valueSize; +} diff --git a/weaver/aidl/aidl_api/android.hardware.weaver/2/android/hardware/weaver/WeaverReadResponse.aidl b/weaver/aidl/aidl_api/android.hardware.weaver/2/android/hardware/weaver/WeaverReadResponse.aidl new file mode 100644 index 0000000000..96e528fa30 --- /dev/null +++ b/weaver/aidl/aidl_api/android.hardware.weaver/2/android/hardware/weaver/WeaverReadResponse.aidl @@ -0,0 +1,40 @@ +/* + * Copyright 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.weaver; +@VintfStability +parcelable WeaverReadResponse { + long timeout; + byte[] value; + android.hardware.weaver.WeaverReadStatus status = android.hardware.weaver.WeaverReadStatus.FAILED; +} diff --git a/weaver/aidl/aidl_api/android.hardware.weaver/2/android/hardware/weaver/WeaverReadStatus.aidl b/weaver/aidl/aidl_api/android.hardware.weaver/2/android/hardware/weaver/WeaverReadStatus.aidl new file mode 100644 index 0000000000..e0be80e5b9 --- /dev/null +++ b/weaver/aidl/aidl_api/android.hardware.weaver/2/android/hardware/weaver/WeaverReadStatus.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.weaver; +@Backing(type="int") @VintfStability +enum WeaverReadStatus { + OK, + FAILED, + INCORRECT_KEY, + THROTTLE, +} diff --git a/wifi/aidl/Android.bp b/wifi/aidl/Android.bp index 0c8572c024..7bc8ae7739 100644 --- a/wifi/aidl/Android.bp +++ b/wifi/aidl/Android.bp @@ -43,4 +43,12 @@ aidl_interface { }, }, }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + frozen: true, + } diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/.hash b/wifi/aidl/aidl_api/android.hardware.wifi/1/.hash new file mode 100644 index 0000000000..be9627a638 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/.hash @@ -0,0 +1 @@ +aa2d34a8d196759e8f89109768ebe16039e47518 diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/AfcChannelAllowance.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/AfcChannelAllowance.aidl new file mode 100644 index 0000000000..4d3cd6eb58 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/AfcChannelAllowance.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.wifi; +@VintfStability +parcelable AfcChannelAllowance { + android.hardware.wifi.AvailableAfcFrequencyInfo[] availableAfcFrequencyInfos; + android.hardware.wifi.AvailableAfcChannelInfo[] availableAfcChannelInfos; + long availabilityExpireTimeMs; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/AvailableAfcChannelInfo.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/AvailableAfcChannelInfo.aidl new file mode 100644 index 0000000000..d2386401ba --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/AvailableAfcChannelInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.wifi; +@VintfStability +parcelable AvailableAfcChannelInfo { + int globalOperatingClass; + int channelCfi; + int maxEirpDbm; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/AvailableAfcFrequencyInfo.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/AvailableAfcFrequencyInfo.aidl new file mode 100644 index 0000000000..cbea5affb9 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/AvailableAfcFrequencyInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.wifi; +@VintfStability +parcelable AvailableAfcFrequencyInfo { + int startFrequencyMhz; + int endFrequencyMhz; + int maxPsd; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifi.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifi.aidl new file mode 100644 index 0000000000..cc995fce3f --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifi.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +interface IWifi { + @PropagateAllowBlocking android.hardware.wifi.IWifiChip getChip(int chipId); + int[] getChipIds(); + boolean isStarted(); + void registerEventCallback(in android.hardware.wifi.IWifiEventCallback callback); + void start(); + void stop(); +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiApIface.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiApIface.aidl new file mode 100644 index 0000000000..e71dde40fd --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiApIface.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +interface IWifiApIface { + String getName(); + String[] getBridgedInstances(); + byte[6] getFactoryMacAddress(); + void setCountryCode(in byte[2] code); + void resetToFactoryMacAddress(); + void setMacAddress(in byte[6] mac); +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiChip.aidl new file mode 100644 index 0000000000..4ea2081ace --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiChip.aidl @@ -0,0 +1,175 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +interface IWifiChip { + void configureChip(in int modeId); + @PropagateAllowBlocking android.hardware.wifi.IWifiApIface createApIface(); + @PropagateAllowBlocking android.hardware.wifi.IWifiApIface createBridgedApIface(); + @PropagateAllowBlocking android.hardware.wifi.IWifiNanIface createNanIface(); + @PropagateAllowBlocking android.hardware.wifi.IWifiP2pIface createP2pIface(); + @PropagateAllowBlocking android.hardware.wifi.IWifiRttController createRttController(in android.hardware.wifi.IWifiStaIface boundIface); + @PropagateAllowBlocking android.hardware.wifi.IWifiStaIface createStaIface(); + void enableDebugErrorAlerts(in boolean enable); + void flushRingBufferToFile(); + void forceDumpToDebugRingBuffer(in String ringName); + @PropagateAllowBlocking android.hardware.wifi.IWifiApIface getApIface(in String ifname); + String[] getApIfaceNames(); + android.hardware.wifi.IWifiChip.ChipMode[] getAvailableModes(); + int getFeatureSet(); + android.hardware.wifi.WifiDebugHostWakeReasonStats getDebugHostWakeReasonStats(); + android.hardware.wifi.WifiDebugRingBufferStatus[] getDebugRingBuffersStatus(); + int getId(); + int getMode(); + @PropagateAllowBlocking android.hardware.wifi.IWifiNanIface getNanIface(in String ifname); + String[] getNanIfaceNames(); + @PropagateAllowBlocking android.hardware.wifi.IWifiP2pIface getP2pIface(in String ifname); + String[] getP2pIfaceNames(); + @PropagateAllowBlocking android.hardware.wifi.IWifiStaIface getStaIface(in String ifname); + String[] getStaIfaceNames(); + android.hardware.wifi.WifiRadioCombination[] getSupportedRadioCombinations(); + android.hardware.wifi.WifiChipCapabilities getWifiChipCapabilities(); + android.hardware.wifi.WifiUsableChannel[] getUsableChannels(in android.hardware.wifi.WifiBand band, in int ifaceModeMask, in int filterMask); + void setAfcChannelAllowance(in android.hardware.wifi.AfcChannelAllowance afcChannelAllowance); + void registerEventCallback(in android.hardware.wifi.IWifiChipEventCallback callback); + void removeApIface(in String ifname); + void removeIfaceInstanceFromBridgedApIface(in String brIfaceName, in String ifaceInstanceName); + void removeNanIface(in String ifname); + void removeP2pIface(in String ifname); + void removeStaIface(in String ifname); + android.hardware.wifi.IWifiChip.ChipDebugInfo requestChipDebugInfo(); + byte[] requestDriverDebugDump(); + byte[] requestFirmwareDebugDump(); + void resetTxPowerScenario(); + void selectTxPowerScenario(in android.hardware.wifi.IWifiChip.TxPowerScenario scenario); + void setCoexUnsafeChannels(in android.hardware.wifi.IWifiChip.CoexUnsafeChannel[] unsafeChannels, in int restrictions); + void setCountryCode(in byte[2] code); + void setLatencyMode(in android.hardware.wifi.IWifiChip.LatencyMode mode); + void setMultiStaPrimaryConnection(in String ifName); + void setMultiStaUseCase(in android.hardware.wifi.IWifiChip.MultiStaUseCase useCase); + void startLoggingToDebugRingBuffer(in String ringName, in android.hardware.wifi.WifiDebugRingBufferVerboseLevel verboseLevel, in int maxIntervalInSec, in int minDataSizeInBytes); + void stopLoggingToDebugRingBuffer(); + void triggerSubsystemRestart(); + void enableStaChannelForPeerNetwork(in int channelCategoryEnableFlag); + void setMloMode(in android.hardware.wifi.IWifiChip.ChipMloMode mode); + const int NO_POWER_CAP_CONSTANT = 0x7FFFFFFF; + @Backing(type="int") @VintfStability + enum FeatureSetMask { + SET_TX_POWER_LIMIT = (1 << 0) /* 1 */, + D2D_RTT = (1 << 1) /* 2 */, + D2AP_RTT = (1 << 2) /* 4 */, + USE_BODY_HEAD_SAR = (1 << 3) /* 8 */, + SET_LATENCY_MODE = (1 << 4) /* 16 */, + P2P_RAND_MAC = (1 << 5) /* 32 */, + WIGIG = (1 << 6) /* 64 */, + SET_AFC_CHANNEL_ALLOWANCE = (1 << 7) /* 128 */, + T2LM_NEGOTIATION = (1 << 8) /* 256 */, + } + @VintfStability + parcelable ChipConcurrencyCombinationLimit { + android.hardware.wifi.IfaceConcurrencyType[] types; + int maxIfaces; + } + @VintfStability + parcelable ChipConcurrencyCombination { + android.hardware.wifi.IWifiChip.ChipConcurrencyCombinationLimit[] limits; + } + @VintfStability + parcelable ChipDebugInfo { + String driverDescription; + String firmwareDescription; + } + @VintfStability + parcelable ChipIfaceCombinationLimit { + android.hardware.wifi.IfaceType[] types; + int maxIfaces; + } + @VintfStability + parcelable ChipIfaceCombination { + android.hardware.wifi.IWifiChip.ChipIfaceCombinationLimit[] limits; + } + @VintfStability + parcelable ChipMode { + int id; + android.hardware.wifi.IWifiChip.ChipConcurrencyCombination[] availableCombinations; + } + @Backing(type="int") @VintfStability + enum CoexRestriction { + WIFI_DIRECT = (1 << 0) /* 1 */, + SOFTAP = (1 << 1) /* 2 */, + WIFI_AWARE = (1 << 2) /* 4 */, + } + @VintfStability + parcelable CoexUnsafeChannel { + android.hardware.wifi.WifiBand band; + int channel; + int powerCapDbm; + } + @Backing(type="int") @VintfStability + enum LatencyMode { + NORMAL = 0, + LOW = 1, + } + @Backing(type="byte") @VintfStability + enum MultiStaUseCase { + DUAL_STA_TRANSIENT_PREFER_PRIMARY = 0, + DUAL_STA_NON_TRANSIENT_UNBIASED = 1, + } + @Backing(type="int") @VintfStability + enum TxPowerScenario { + VOICE_CALL = 0, + ON_HEAD_CELL_OFF = 1, + ON_HEAD_CELL_ON = 2, + ON_BODY_CELL_OFF = 3, + ON_BODY_CELL_ON = 4, + } + @Backing(type="int") @VintfStability + enum UsableChannelFilter { + CELLULAR_COEXISTENCE = (1 << 0) /* 1 */, + CONCURRENCY = (1 << 1) /* 2 */, + NAN_INSTANT_MODE = (1 << 2) /* 4 */, + } + @Backing(type="int") @VintfStability + enum ChannelCategoryMask { + INDOOR_CHANNEL = (1 << 0) /* 1 */, + DFS_CHANNEL = (1 << 1) /* 2 */, + } + @Backing(type="int") @VintfStability + enum ChipMloMode { + DEFAULT = 0, + LOW_LATENCY = 1, + HIGH_THROUGHPUT = 2, + LOW_POWER = 3, + } +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiChipEventCallback.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiChipEventCallback.aidl new file mode 100644 index 0000000000..3fd8533c44 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiChipEventCallback.aidl @@ -0,0 +1,55 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +interface IWifiChipEventCallback { + oneway void onChipReconfigureFailure(in android.hardware.wifi.WifiStatusCode status); + oneway void onChipReconfigured(in int modeId); + oneway void onDebugErrorAlert(in int errorCode, in byte[] debugData); + oneway void onDebugRingBufferDataAvailable(in android.hardware.wifi.WifiDebugRingBufferStatus status, in byte[] data); + oneway void onIfaceAdded(in android.hardware.wifi.IfaceType type, in String name); + oneway void onIfaceRemoved(in android.hardware.wifi.IfaceType type, in String name); + oneway void onRadioModeChange(in android.hardware.wifi.IWifiChipEventCallback.RadioModeInfo[] radioModeInfos); + @VintfStability + parcelable IfaceInfo { + String name; + int channel; + } + @VintfStability + parcelable RadioModeInfo { + int radioId; + android.hardware.wifi.WifiBand bandInfo; + android.hardware.wifi.IWifiChipEventCallback.IfaceInfo[] ifaceInfos; + } +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiEventCallback.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiEventCallback.aidl new file mode 100644 index 0000000000..00e5cb6e09 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiEventCallback.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +interface IWifiEventCallback { + oneway void onFailure(in android.hardware.wifi.WifiStatusCode status); + oneway void onStart(); + oneway void onStop(); + oneway void onSubsystemRestart(in android.hardware.wifi.WifiStatusCode status); +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiNanIface.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiNanIface.aidl new file mode 100644 index 0000000000..0e2f90fbc0 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiNanIface.aidl @@ -0,0 +1,62 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +interface IWifiNanIface { + String getName(); + void configRequest(in char cmdId, in android.hardware.wifi.NanConfigRequest msg1, in android.hardware.wifi.NanConfigRequestSupplemental msg2); + void createDataInterfaceRequest(in char cmdId, in String ifaceName); + void deleteDataInterfaceRequest(in char cmdId, in String ifaceName); + void disableRequest(in char cmdId); + void enableRequest(in char cmdId, in android.hardware.wifi.NanEnableRequest msg1, in android.hardware.wifi.NanConfigRequestSupplemental msg2); + void getCapabilitiesRequest(in char cmdId); + void initiateDataPathRequest(in char cmdId, in android.hardware.wifi.NanInitiateDataPathRequest msg); + void registerEventCallback(in android.hardware.wifi.IWifiNanIfaceEventCallback callback); + void respondToDataPathIndicationRequest(in char cmdId, in android.hardware.wifi.NanRespondToDataPathIndicationRequest msg); + void startPublishRequest(in char cmdId, in android.hardware.wifi.NanPublishRequest msg); + void startSubscribeRequest(in char cmdId, in android.hardware.wifi.NanSubscribeRequest msg); + void stopPublishRequest(in char cmdId, in byte sessionId); + void stopSubscribeRequest(in char cmdId, in byte sessionId); + void terminateDataPathRequest(in char cmdId, in int ndpInstanceId); + void suspendRequest(in char cmdId, in byte sessionId); + void resumeRequest(in char cmdId, in byte sessionId); + void transmitFollowupRequest(in char cmdId, in android.hardware.wifi.NanTransmitFollowupRequest msg); + void initiatePairingRequest(in char cmdId, in android.hardware.wifi.NanPairingRequest msg); + void respondToPairingIndicationRequest(in char cmdId, in android.hardware.wifi.NanRespondToPairingIndicationRequest msg); + void initiateBootstrappingRequest(in char cmdId, in android.hardware.wifi.NanBootstrappingRequest msg); + void respondToBootstrappingIndicationRequest(in char cmdId, in android.hardware.wifi.NanBootstrappingResponse msg); + void terminatePairingRequest(in char cmdId, in int pairingInstanceId); + const int MIN_DATA_PATH_CONFIG_PASSPHRASE_LENGTH = 8; + const int MAX_DATA_PATH_CONFIG_PASSPHRASE_LENGTH = 63; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl new file mode 100644 index 0000000000..8c443309ee --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl @@ -0,0 +1,75 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +interface IWifiNanIfaceEventCallback { + oneway void eventClusterEvent(in android.hardware.wifi.NanClusterEventInd event); + oneway void eventDataPathConfirm(in android.hardware.wifi.NanDataPathConfirmInd event); + oneway void eventDataPathRequest(in android.hardware.wifi.NanDataPathRequestInd event); + oneway void eventDataPathScheduleUpdate(in android.hardware.wifi.NanDataPathScheduleUpdateInd event); + oneway void eventDataPathTerminated(in int ndpInstanceId); + oneway void eventDisabled(in android.hardware.wifi.NanStatus status); + oneway void eventFollowupReceived(in android.hardware.wifi.NanFollowupReceivedInd event); + oneway void eventMatch(in android.hardware.wifi.NanMatchInd event); + oneway void eventMatchExpired(in byte discoverySessionId, in int peerId); + oneway void eventPublishTerminated(in byte sessionId, in android.hardware.wifi.NanStatus status); + oneway void eventSubscribeTerminated(in byte sessionId, in android.hardware.wifi.NanStatus status); + oneway void eventTransmitFollowup(in char id, in android.hardware.wifi.NanStatus status); + oneway void eventSuspensionModeChanged(in android.hardware.wifi.NanSuspensionModeChangeInd event); + oneway void notifyCapabilitiesResponse(in char id, in android.hardware.wifi.NanStatus status, in android.hardware.wifi.NanCapabilities capabilities); + oneway void notifyConfigResponse(in char id, in android.hardware.wifi.NanStatus status); + oneway void notifyCreateDataInterfaceResponse(in char id, in android.hardware.wifi.NanStatus status); + oneway void notifyDeleteDataInterfaceResponse(in char id, in android.hardware.wifi.NanStatus status); + oneway void notifyDisableResponse(in char id, in android.hardware.wifi.NanStatus status); + oneway void notifyEnableResponse(in char id, in android.hardware.wifi.NanStatus status); + oneway void notifyInitiateDataPathResponse(in char id, in android.hardware.wifi.NanStatus status, in int ndpInstanceId); + oneway void notifyRespondToDataPathIndicationResponse(in char id, in android.hardware.wifi.NanStatus status); + oneway void notifyStartPublishResponse(in char id, in android.hardware.wifi.NanStatus status, in byte sessionId); + oneway void notifyStartSubscribeResponse(in char id, in android.hardware.wifi.NanStatus status, in byte sessionId); + oneway void notifyStopPublishResponse(in char id, in android.hardware.wifi.NanStatus status); + oneway void notifyStopSubscribeResponse(in char id, in android.hardware.wifi.NanStatus status); + oneway void notifyTerminateDataPathResponse(in char id, in android.hardware.wifi.NanStatus status); + oneway void notifySuspendResponse(in char id, in android.hardware.wifi.NanStatus status); + oneway void notifyResumeResponse(in char id, in android.hardware.wifi.NanStatus status); + oneway void notifyTransmitFollowupResponse(in char id, in android.hardware.wifi.NanStatus status); + oneway void eventPairingRequest(in android.hardware.wifi.NanPairingRequestInd event); + oneway void eventPairingConfirm(in android.hardware.wifi.NanPairingConfirmInd event); + oneway void notifyInitiatePairingResponse(in char id, in android.hardware.wifi.NanStatus status, in int pairingInstanceId); + oneway void notifyRespondToPairingIndicationResponse(in char id, in android.hardware.wifi.NanStatus status); + oneway void eventBootstrappingRequest(in android.hardware.wifi.NanBootstrappingRequestInd event); + oneway void eventBootstrappingConfirm(in android.hardware.wifi.NanBootstrappingConfirmInd event); + oneway void notifyInitiateBootstrappingResponse(in char id, in android.hardware.wifi.NanStatus status, in int bootstrappingInstanceId); + oneway void notifyRespondToBootstrappingIndicationResponse(in char id, in android.hardware.wifi.NanStatus status); + oneway void notifyTerminatePairingResponse(in char id, in android.hardware.wifi.NanStatus status); +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiP2pIface.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiP2pIface.aidl new file mode 100644 index 0000000000..5e9948e0b7 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiP2pIface.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +interface IWifiP2pIface { + String getName(); +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiRttController.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiRttController.aidl new file mode 100644 index 0000000000..730a055eeb --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiRttController.aidl @@ -0,0 +1,47 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +interface IWifiRttController { + void disableResponder(in int cmdId); + void enableResponder(in int cmdId, in android.hardware.wifi.WifiChannelInfo channelHint, in int maxDurationInSeconds, in android.hardware.wifi.RttResponder info); + android.hardware.wifi.IWifiStaIface getBoundIface(); + android.hardware.wifi.RttCapabilities getCapabilities(); + android.hardware.wifi.RttResponder getResponderInfo(); + void rangeCancel(in int cmdId, in android.hardware.wifi.MacAddress[] addrs); + void rangeRequest(in int cmdId, in android.hardware.wifi.RttConfig[] rttConfigs); + void registerEventCallback(in android.hardware.wifi.IWifiRttControllerEventCallback callback); + void setLci(in int cmdId, in android.hardware.wifi.RttLciInformation lci); + void setLcr(in int cmdId, in android.hardware.wifi.RttLcrInformation lcr); +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiRttControllerEventCallback.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiRttControllerEventCallback.aidl new file mode 100644 index 0000000000..a6a33fc049 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiRttControllerEventCallback.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +interface IWifiRttControllerEventCallback { + oneway void onResults(in int cmdId, in android.hardware.wifi.RttResult[] results); +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiStaIface.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiStaIface.aidl new file mode 100644 index 0000000000..923deff01f --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiStaIface.aidl @@ -0,0 +1,81 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +interface IWifiStaIface { + String getName(); + void configureRoaming(in android.hardware.wifi.StaRoamingConfig config); + void disableLinkLayerStatsCollection(); + void enableLinkLayerStatsCollection(in boolean debug); + void enableNdOffload(in boolean enable); + android.hardware.wifi.StaApfPacketFilterCapabilities getApfPacketFilterCapabilities(); + android.hardware.wifi.StaBackgroundScanCapabilities getBackgroundScanCapabilities(); + int getFeatureSet(); + android.hardware.wifi.WifiDebugRxPacketFateReport[] getDebugRxPacketFates(); + android.hardware.wifi.WifiDebugTxPacketFateReport[] getDebugTxPacketFates(); + byte[6] getFactoryMacAddress(); + android.hardware.wifi.StaLinkLayerStats getLinkLayerStats(); + android.hardware.wifi.StaRoamingCapabilities getRoamingCapabilities(); + void installApfPacketFilter(in byte[] program); + byte[] readApfPacketFilterData(); + void registerEventCallback(in android.hardware.wifi.IWifiStaIfaceEventCallback callback); + void setMacAddress(in byte[6] mac); + void setRoamingState(in android.hardware.wifi.StaRoamingState state); + void setScanMode(in boolean enable); + void startBackgroundScan(in int cmdId, in android.hardware.wifi.StaBackgroundScanParameters params); + void startDebugPacketFateMonitoring(); + void startRssiMonitoring(in int cmdId, in int maxRssi, in int minRssi); + void startSendingKeepAlivePackets(in int cmdId, in byte[] ipPacketData, in char etherType, in byte[6] srcAddress, in byte[6] dstAddress, in int periodInMs); + void stopBackgroundScan(in int cmdId); + void stopRssiMonitoring(in int cmdId); + void stopSendingKeepAlivePackets(in int cmdId); + void setDtimMultiplier(in int multiplier); + @Backing(type="int") @VintfStability + enum FeatureSetMask { + APF = (1 << 0) /* 1 */, + BACKGROUND_SCAN = (1 << 1) /* 2 */, + LINK_LAYER_STATS = (1 << 2) /* 4 */, + RSSI_MONITOR = (1 << 3) /* 8 */, + CONTROL_ROAMING = (1 << 4) /* 16 */, + PROBE_IE_ALLOWLIST = (1 << 5) /* 32 */, + SCAN_RAND = (1 << 6) /* 64 */, + STA_5G = (1 << 7) /* 128 */, + HOTSPOT = (1 << 8) /* 256 */, + PNO = (1 << 9) /* 512 */, + TDLS = (1 << 10) /* 1024 */, + TDLS_OFFCHANNEL = (1 << 11) /* 2048 */, + ND_OFFLOAD = (1 << 12) /* 4096 */, + KEEP_ALIVE = (1 << 13) /* 8192 */, + } +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiStaIfaceEventCallback.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiStaIfaceEventCallback.aidl new file mode 100644 index 0000000000..48b85b0fcf --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IWifiStaIfaceEventCallback.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +interface IWifiStaIfaceEventCallback { + oneway void onBackgroundFullScanResult(in int cmdId, in int bucketsScanned, in android.hardware.wifi.StaScanResult result); + oneway void onBackgroundScanFailure(in int cmdId); + oneway void onBackgroundScanResults(in int cmdId, in android.hardware.wifi.StaScanData[] scanDatas); + oneway void onRssiThresholdBreached(in int cmdId, in byte[6] currBssid, in int currRssi); +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IfaceConcurrencyType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IfaceConcurrencyType.aidl new file mode 100644 index 0000000000..d584423f5a --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IfaceConcurrencyType.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum IfaceConcurrencyType { + STA, + AP, + AP_BRIDGED, + P2P, + NAN_IFACE, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IfaceType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IfaceType.aidl new file mode 100644 index 0000000000..67022dfdff --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/IfaceType.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum IfaceType { + STA, + AP, + P2P, + NAN_IFACE, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/MacAddress.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/MacAddress.aidl new file mode 100644 index 0000000000..c4a06136ec --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/MacAddress.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable MacAddress { + byte[6] data; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBandIndex.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBandIndex.aidl new file mode 100644 index 0000000000..3f1ea5e444 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBandIndex.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum NanBandIndex { + NAN_BAND_24GHZ = 0, + NAN_BAND_5GHZ, + NAN_BAND_6GHZ = 2, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBandSpecificConfig.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBandSpecificConfig.aidl new file mode 100644 index 0000000000..57540b3835 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBandSpecificConfig.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanBandSpecificConfig { + byte rssiClose; + byte rssiMiddle; + byte rssiCloseProximity; + char dwellTimeMs; + char scanPeriodSec; + boolean validDiscoveryWindowIntervalVal; + byte discoveryWindowIntervalVal; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingConfirmInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingConfirmInd.aidl new file mode 100644 index 0000000000..5ab8dcd213 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingConfirmInd.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanBootstrappingConfirmInd { + int bootstrappingInstanceId; + android.hardware.wifi.NanBootstrappingResponseCode responseCode; + android.hardware.wifi.NanStatus reasonCode; + int comeBackDelay; + byte[] cookie; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingMethod.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingMethod.aidl new file mode 100644 index 0000000000..6ff62b2f52 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingMethod.aidl @@ -0,0 +1,48 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum NanBootstrappingMethod { + BOOTSTRAPPING_OPPORTUNISTIC_MASK = (1 << 0) /* 1 */, + BOOTSTRAPPING_PIN_CODE_DISPLAY_MASK = (1 << 1) /* 2 */, + BOOTSTRAPPING_PASSPHRASE_DISPLAY_MASK = (1 << 2) /* 4 */, + BOOTSTRAPPING_QR_DISPLAY_MASK = (1 << 3) /* 8 */, + BOOTSTRAPPING_NFC_TAG_MASK = (1 << 4) /* 16 */, + BOOTSTRAPPING_PIN_CODE_KEYPAD_MASK = (1 << 5) /* 32 */, + BOOTSTRAPPING_PASSPHRASE_KEYPAD_MASK = (1 << 6) /* 64 */, + BOOTSTRAPPING_QR_SCAN_MASK = (1 << 7) /* 128 */, + BOOTSTRAPPING_NFC_READER_MASK = (1 << 8) /* 256 */, + BOOTSTRAPPING_SERVICE_MANAGED_MASK = (1 << 14) /* 16384 */, + BOOTSTRAPPING_HANDSHAKE_SHIP_MASK = (1 << 15) /* 32768 */, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingRequest.aidl new file mode 100644 index 0000000000..dd0a5ede2f --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingRequest.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanBootstrappingRequest { + int peerId; + byte[6] peerDiscMacAddr; + android.hardware.wifi.NanBootstrappingMethod requestBootstrappingMethod; + byte[] cookie; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingRequestInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingRequestInd.aidl new file mode 100644 index 0000000000..a4398e9310 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingRequestInd.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanBootstrappingRequestInd { + byte discoverySessionId; + int peerId; + byte[6] peerDiscMacAddr; + int bootstrappingInstanceId; + android.hardware.wifi.NanBootstrappingMethod requestBootstrappingMethod; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingResponse.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingResponse.aidl new file mode 100644 index 0000000000..6dd9b2603a --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingResponse.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanBootstrappingResponse { + int bootstrappingInstanceId; + boolean acceptRequest; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingResponseCode.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingResponseCode.aidl new file mode 100644 index 0000000000..a3e9e4d2ae --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanBootstrappingResponseCode.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum NanBootstrappingResponseCode { + NAN_BOOTSTRAPPING_REQUEST_ACCEPT = 0, + NAN_BOOTSTRAPPING_REQUEST_REJECT, + NAN_BOOTSTRAPPING_REQUEST_COMEBACK, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanCapabilities.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanCapabilities.aidl new file mode 100644 index 0000000000..a30893a0c2 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanCapabilities.aidl @@ -0,0 +1,57 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanCapabilities { + int maxConcurrentClusters; + int maxPublishes; + int maxSubscribes; + int maxServiceNameLen; + int maxMatchFilterLen; + int maxTotalMatchFilterLen; + int maxServiceSpecificInfoLen; + int maxExtendedServiceSpecificInfoLen; + int maxNdiInterfaces; + int maxNdpSessions; + int maxAppInfoLen; + int maxQueuedTransmitFollowupMsgs; + int maxSubscribeInterfaceAddresses; + int supportedCipherSuites; + boolean instantCommunicationModeSupportFlag; + boolean supports6g; + boolean supportsHe; + boolean supportsPairing; + boolean supportsSetClusterId; + boolean supportsSuspension; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanCipherSuiteType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanCipherSuiteType.aidl new file mode 100644 index 0000000000..6f3158e670 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanCipherSuiteType.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum NanCipherSuiteType { + NONE = 0, + SHARED_KEY_128_MASK = (1 << 0) /* 1 */, + SHARED_KEY_256_MASK = (1 << 1) /* 2 */, + PUBLIC_KEY_2WDH_128_MASK = (1 << 2) /* 4 */, + PUBLIC_KEY_2WDH_256_MASK = (1 << 3) /* 8 */, + PUBLIC_KEY_PASN_128_MASK = (1 << 6) /* 64 */, + PUBLIC_KEY_PASN_256_MASK = (1 << 7) /* 128 */, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanClusterEventInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanClusterEventInd.aidl new file mode 100644 index 0000000000..7a3ff8151a --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanClusterEventInd.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanClusterEventInd { + android.hardware.wifi.NanClusterEventType eventType; + byte[6] addr; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanClusterEventType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanClusterEventType.aidl new file mode 100644 index 0000000000..6c20543d86 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanClusterEventType.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum NanClusterEventType { + DISCOVERY_MAC_ADDRESS_CHANGED = 0, + STARTED_CLUSTER, + JOINED_CLUSTER, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanConfigRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanConfigRequest.aidl new file mode 100644 index 0000000000..5ead6515d0 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanConfigRequest.aidl @@ -0,0 +1,48 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanConfigRequest { + byte masterPref; + boolean disableDiscoveryAddressChangeIndication; + boolean disableStartedClusterIndication; + boolean disableJoinedClusterIndication; + boolean includePublishServiceIdsInBeacon; + byte numberOfPublishServiceIdsInBeacon; + boolean includeSubscribeServiceIdsInBeacon; + byte numberOfSubscribeServiceIdsInBeacon; + char rssiWindowSize; + int macAddressRandomizationIntervalSec; + android.hardware.wifi.NanBandSpecificConfig[3] bandSpecificConfig; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanConfigRequestSupplemental.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanConfigRequestSupplemental.aidl new file mode 100644 index 0000000000..99f2af771e --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanConfigRequestSupplemental.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanConfigRequestSupplemental { + int discoveryBeaconIntervalMs; + int numberOfSpatialStreamsInDiscovery; + boolean enableDiscoveryWindowEarlyTermination; + boolean enableRanging; + boolean enableInstantCommunicationMode; + int instantModeChannel; + int clusterId; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathChannelCfg.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathChannelCfg.aidl new file mode 100644 index 0000000000..4233c32863 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathChannelCfg.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum NanDataPathChannelCfg { + CHANNEL_NOT_REQUESTED = 0, + REQUEST_CHANNEL_SETUP, + FORCE_CHANNEL_SETUP, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathChannelInfo.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathChannelInfo.aidl new file mode 100644 index 0000000000..d111db784c --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathChannelInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanDataPathChannelInfo { + int channelFreq; + android.hardware.wifi.WifiChannelWidthInMhz channelBandwidth; + int numSpatialStreams; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathConfirmInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathConfirmInd.aidl new file mode 100644 index 0000000000..2e1e2caece --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathConfirmInd.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanDataPathConfirmInd { + int ndpInstanceId; + boolean dataPathSetupSuccess; + byte[6] peerNdiMacAddr; + byte[] appInfo; + android.hardware.wifi.NanStatus status; + android.hardware.wifi.NanDataPathChannelInfo[] channelInfo; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathRequestInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathRequestInd.aidl new file mode 100644 index 0000000000..74d5b73aba --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathRequestInd.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanDataPathRequestInd { + byte discoverySessionId; + byte[6] peerDiscMacAddr; + int ndpInstanceId; + boolean securityRequired; + byte[] appInfo; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathScheduleUpdateInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathScheduleUpdateInd.aidl new file mode 100644 index 0000000000..5fabf5539c --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathScheduleUpdateInd.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanDataPathScheduleUpdateInd { + byte[6] peerDiscoveryAddress; + android.hardware.wifi.NanDataPathChannelInfo[] channelInfo; + int[] ndpInstanceIds; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathSecurityConfig.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathSecurityConfig.aidl new file mode 100644 index 0000000000..635dbce788 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathSecurityConfig.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanDataPathSecurityConfig { + android.hardware.wifi.NanDataPathSecurityType securityType; + android.hardware.wifi.NanCipherSuiteType cipherType; + byte[32] pmk; + byte[] passphrase; + byte[16] scid; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathSecurityType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathSecurityType.aidl new file mode 100644 index 0000000000..cb7904d180 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDataPathSecurityType.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum NanDataPathSecurityType { + OPEN, + PMK, + PASSPHRASE, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDebugConfig.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDebugConfig.aidl new file mode 100644 index 0000000000..b84d891221 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDebugConfig.aidl @@ -0,0 +1,54 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanDebugConfig { + boolean validClusterIdVals; + char clusterIdBottomRangeVal; + char clusterIdTopRangeVal; + boolean validIntfAddrVal; + byte[6] intfAddrVal; + boolean validOuiVal; + int ouiVal; + boolean validRandomFactorForceVal; + byte randomFactorForceVal; + boolean validHopCountForceVal; + byte hopCountForceVal; + boolean validDiscoveryChannelVal; + int[3] discoveryChannelMhzVal; + boolean validUseBeaconsInBandVal; + boolean[3] useBeaconsInBandVal; + boolean validUseSdfInBandVal; + boolean[3] useSdfInBandVal; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDiscoveryCommonConfig.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDiscoveryCommonConfig.aidl new file mode 100644 index 0000000000..96d940ae31 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanDiscoveryCommonConfig.aidl @@ -0,0 +1,58 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanDiscoveryCommonConfig { + byte sessionId; + char ttlSec; + char discoveryWindowPeriod; + byte discoveryCount; + byte[] serviceName; + android.hardware.wifi.NanMatchAlg discoveryMatchIndicator; + byte[] serviceSpecificInfo; + byte[] extendedServiceSpecificInfo; + byte[] rxMatchFilter; + byte[] txMatchFilter; + boolean useRssiThreshold; + boolean disableDiscoveryTerminationIndication; + boolean disableMatchExpirationIndication; + boolean disableFollowupReceivedIndication; + android.hardware.wifi.NanDataPathSecurityConfig securityConfig; + boolean rangingRequired; + int rangingIntervalMs; + int configRangingIndications; + char distanceIngressCm; + char distanceEgressCm; + boolean enableSessionSuspendability; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanEnableRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanEnableRequest.aidl new file mode 100644 index 0000000000..eaa009cfd1 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanEnableRequest.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanEnableRequest { + boolean[3] operateInBand; + byte hopCountMax; + android.hardware.wifi.NanConfigRequest configParams; + android.hardware.wifi.NanDebugConfig debugConfigs; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanFollowupReceivedInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanFollowupReceivedInd.aidl new file mode 100644 index 0000000000..743ad9d227 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanFollowupReceivedInd.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanFollowupReceivedInd { + byte discoverySessionId; + int peerId; + byte[6] addr; + boolean receivedInFaw; + byte[] serviceSpecificInfo; + byte[] extendedServiceSpecificInfo; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanIdentityResolutionAttribute.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanIdentityResolutionAttribute.aidl new file mode 100644 index 0000000000..843107ea40 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanIdentityResolutionAttribute.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanIdentityResolutionAttribute { + byte[8] nonce; + byte[8] tag; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanInitiateDataPathRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanInitiateDataPathRequest.aidl new file mode 100644 index 0000000000..740a140780 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanInitiateDataPathRequest.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanInitiateDataPathRequest { + int peerId; + byte[6] peerDiscMacAddr; + android.hardware.wifi.NanDataPathChannelCfg channelRequestType; + int channel; + String ifaceName; + android.hardware.wifi.NanDataPathSecurityConfig securityConfig; + byte[] appInfo; + byte[] serviceNameOutOfBand; + byte discoverySessionId; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanMatchAlg.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanMatchAlg.aidl new file mode 100644 index 0000000000..93ac26b25f --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanMatchAlg.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum NanMatchAlg { + MATCH_ONCE = 0, + MATCH_CONTINUOUS, + MATCH_NEVER, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanMatchInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanMatchInd.aidl new file mode 100644 index 0000000000..317489f223 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanMatchInd.aidl @@ -0,0 +1,54 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanMatchInd { + byte discoverySessionId; + int peerId; + byte[6] addr; + byte[] serviceSpecificInfo; + byte[] extendedServiceSpecificInfo; + byte[] matchFilter; + boolean matchOccurredInBeaconFlag; + boolean outOfResourceFlag; + byte rssiValue; + android.hardware.wifi.NanCipherSuiteType peerCipherType; + boolean peerRequiresSecurityEnabledInNdp; + boolean peerRequiresRanging; + int rangingMeasurementInMm; + int rangingIndicationType; + byte[] scid; + android.hardware.wifi.NanPairingConfig peerPairingConfig; + android.hardware.wifi.NanIdentityResolutionAttribute peerNira; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingAkm.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingAkm.aidl new file mode 100644 index 0000000000..05bbaee0d5 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingAkm.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum NanPairingAkm { + SAE = 0, + PASN = 1, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingConfig.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingConfig.aidl new file mode 100644 index 0000000000..1c04a96d6c --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingConfig.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanPairingConfig { + boolean enablePairingSetup; + boolean enablePairingCache; + boolean enablePairingVerification; + int supportedBootstrappingMethods; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingConfirmInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingConfirmInd.aidl new file mode 100644 index 0000000000..8ecf22aa01 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingConfirmInd.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanPairingConfirmInd { + int pairingInstanceId; + boolean pairingSuccess; + android.hardware.wifi.NanStatus status; + android.hardware.wifi.NanPairingRequestType requestType; + boolean enablePairingCache; + android.hardware.wifi.NpkSecurityAssociation npksa; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingRequest.aidl new file mode 100644 index 0000000000..2a644ae63b --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingRequest.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanPairingRequest { + int peerId; + byte[6] peerDiscMacAddr; + android.hardware.wifi.NanPairingRequestType requestType; + boolean enablePairingCache; + byte[16] pairingIdentityKey; + android.hardware.wifi.NanPairingSecurityConfig securityConfig; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingRequestInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingRequestInd.aidl new file mode 100644 index 0000000000..66762b93e6 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingRequestInd.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanPairingRequestInd { + byte discoverySessionId; + int peerId; + byte[6] peerDiscMacAddr; + int pairingInstanceId; + android.hardware.wifi.NanPairingRequestType requestType; + boolean enablePairingCache; + android.hardware.wifi.NanIdentityResolutionAttribute peerNira; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingRequestType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingRequestType.aidl new file mode 100644 index 0000000000..3488340bf4 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingRequestType.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum NanPairingRequestType { + NAN_PAIRING_SETUP = 0, + NAN_PAIRING_VERIFICATION, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingSecurityConfig.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingSecurityConfig.aidl new file mode 100644 index 0000000000..1a6a13c550 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingSecurityConfig.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanPairingSecurityConfig { + android.hardware.wifi.NanPairingSecurityType securityType; + byte[32] pmk; + byte[] passphrase; + android.hardware.wifi.NanPairingAkm akm; + android.hardware.wifi.NanCipherSuiteType cipherType; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingSecurityType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingSecurityType.aidl new file mode 100644 index 0000000000..9f6c774021 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPairingSecurityType.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum NanPairingSecurityType { + OPPORTUNISTIC, + PMK, + PASSPHRASE, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPublishRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPublishRequest.aidl new file mode 100644 index 0000000000..c49f5f9012 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPublishRequest.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanPublishRequest { + android.hardware.wifi.NanDiscoveryCommonConfig baseConfigs; + android.hardware.wifi.NanPublishType publishType; + android.hardware.wifi.NanTxType txType; + boolean autoAcceptDataPathRequests; + android.hardware.wifi.NanPairingConfig pairingConfig; + byte[16] identityKey; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPublishType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPublishType.aidl new file mode 100644 index 0000000000..30dffb29d1 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanPublishType.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum NanPublishType { + UNSOLICITED = 0, + SOLICITED, + UNSOLICITED_SOLICITED, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanRangingIndication.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanRangingIndication.aidl new file mode 100644 index 0000000000..cf72dcea23 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanRangingIndication.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum NanRangingIndication { + CONTINUOUS_INDICATION_MASK = (1 << 0) /* 1 */, + INGRESS_MET_MASK = (1 << 1) /* 2 */, + EGRESS_MET_MASK = (1 << 2) /* 4 */, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanRespondToDataPathIndicationRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanRespondToDataPathIndicationRequest.aidl new file mode 100644 index 0000000000..0f873b5ea8 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanRespondToDataPathIndicationRequest.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanRespondToDataPathIndicationRequest { + boolean acceptRequest; + int ndpInstanceId; + String ifaceName; + android.hardware.wifi.NanDataPathSecurityConfig securityConfig; + byte[] appInfo; + byte[] serviceNameOutOfBand; + byte discoverySessionId; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl new file mode 100644 index 0000000000..a58890c542 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanRespondToPairingIndicationRequest { + boolean acceptRequest; + int pairingInstanceId; + android.hardware.wifi.NanPairingRequestType requestType; + boolean enablePairingCache; + byte[16] pairingIdentityKey; + android.hardware.wifi.NanPairingSecurityConfig securityConfig; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanSrfType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanSrfType.aidl new file mode 100644 index 0000000000..82409fd5aa --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanSrfType.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum NanSrfType { + BLOOM_FILTER = 0, + PARTIAL_MAC_ADDR, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanStatus.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanStatus.aidl new file mode 100644 index 0000000000..834558ae72 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanStatus.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanStatus { + android.hardware.wifi.NanStatusCode status; + String description; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanStatusCode.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanStatusCode.aidl new file mode 100644 index 0000000000..ec12eb0c4c --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanStatusCode.aidl @@ -0,0 +1,55 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum NanStatusCode { + SUCCESS = 0, + INTERNAL_FAILURE = 1, + PROTOCOL_FAILURE = 2, + INVALID_SESSION_ID = 3, + NO_RESOURCES_AVAILABLE = 4, + INVALID_ARGS = 5, + INVALID_PEER_ID = 6, + INVALID_NDP_ID = 7, + NAN_NOT_ALLOWED = 8, + NO_OTA_ACK = 9, + ALREADY_ENABLED = 10, + FOLLOWUP_TX_QUEUE_FULL = 11, + UNSUPPORTED_CONCURRENCY_NAN_DISABLED = 12, + INVALID_PAIRING_ID = 13, + INVALID_BOOTSTRAPPING_ID = 14, + REDUNDANT_REQUEST = 15, + NOT_SUPPORTED = 16, + NO_CONNECTION = 17, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanSubscribeRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanSubscribeRequest.aidl new file mode 100644 index 0000000000..96be096d74 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanSubscribeRequest.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanSubscribeRequest { + android.hardware.wifi.NanDiscoveryCommonConfig baseConfigs; + android.hardware.wifi.NanSubscribeType subscribeType; + android.hardware.wifi.NanSrfType srfType; + boolean srfRespondIfInAddressSet; + boolean shouldUseSrf; + boolean isSsiRequiredForMatch; + android.hardware.wifi.MacAddress[] intfAddr; + android.hardware.wifi.NanPairingConfig pairingConfig; + byte[16] identityKey; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanSubscribeType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanSubscribeType.aidl new file mode 100644 index 0000000000..4f06df956d --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanSubscribeType.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum NanSubscribeType { + PASSIVE = 0, + ACTIVE, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanSuspensionModeChangeInd.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanSuspensionModeChangeInd.aidl new file mode 100644 index 0000000000..557fc796d9 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanSuspensionModeChangeInd.aidl @@ -0,0 +1,38 @@ +/* + * 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 -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.hardware.wifi; +@VintfStability +parcelable NanSuspensionModeChangeInd { + boolean isSuspended; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanTransmitFollowupRequest.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanTransmitFollowupRequest.aidl new file mode 100644 index 0000000000..20c94d9558 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanTransmitFollowupRequest.aidl @@ -0,0 +1,45 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NanTransmitFollowupRequest { + byte discoverySessionId; + int peerId; + byte[6] addr; + boolean isHighPriority; + boolean shouldUseDiscoveryWindow; + byte[] serviceSpecificInfo; + byte[] extendedServiceSpecificInfo; + boolean disableFollowupResultIndication; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanTxType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanTxType.aidl new file mode 100644 index 0000000000..798d3a29e6 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NanTxType.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum NanTxType { + BROADCAST = 0, + UNICAST, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NpkSecurityAssociation.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NpkSecurityAssociation.aidl new file mode 100644 index 0000000000..508e92009d --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/NpkSecurityAssociation.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable NpkSecurityAssociation { + byte[16] peerNanIdentityKey; + byte[16] localNanIdentityKey; + byte[32] npk; + android.hardware.wifi.NanPairingAkm akm; + android.hardware.wifi.NanCipherSuiteType cipherType; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttBw.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttBw.aidl new file mode 100644 index 0000000000..7cc700250e --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttBw.aidl @@ -0,0 +1,45 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum RttBw { + BW_UNSPECIFIED = 0x0, + BW_5MHZ = 0x01, + BW_10MHZ = 0x02, + BW_20MHZ = 0x04, + BW_40MHZ = 0x08, + BW_80MHZ = 0x10, + BW_160MHZ = 0x20, + BW_320MHZ = 0x40, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttCapabilities.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttCapabilities.aidl new file mode 100644 index 0000000000..cf64687c50 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttCapabilities.aidl @@ -0,0 +1,45 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable RttCapabilities { + boolean rttOneSidedSupported; + boolean rttFtmSupported; + boolean lciSupported; + boolean lcrSupported; + boolean responderSupported; + android.hardware.wifi.RttPreamble preambleSupport; + android.hardware.wifi.RttBw bwSupport; + byte mcVersion; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttConfig.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttConfig.aidl new file mode 100644 index 0000000000..ccdf2cee68 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttConfig.aidl @@ -0,0 +1,51 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable RttConfig { + byte[6] addr; + android.hardware.wifi.RttType type; + android.hardware.wifi.RttPeerType peer; + android.hardware.wifi.WifiChannelInfo channel; + int burstPeriod; + int numBurst; + int numFramesPerBurst; + int numRetriesPerRttFrame; + int numRetriesPerFtmr; + boolean mustRequestLci; + boolean mustRequestLcr; + int burstDuration; + android.hardware.wifi.RttPreamble preamble; + android.hardware.wifi.RttBw bw; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttLciInformation.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttLciInformation.aidl new file mode 100644 index 0000000000..0fcf151fd1 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttLciInformation.aidl @@ -0,0 +1,47 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable RttLciInformation { + long latitude; + long longitude; + int altitude; + byte latitudeUnc; + byte longitudeUnc; + byte altitudeUnc; + android.hardware.wifi.RttMotionPattern motionPattern; + int floor; + int heightAboveFloor; + int heightUnc; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttLcrInformation.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttLcrInformation.aidl new file mode 100644 index 0000000000..c756ddab0d --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttLcrInformation.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable RttLcrInformation { + byte[2] countryCode; + String civicInfo; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttMotionPattern.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttMotionPattern.aidl new file mode 100644 index 0000000000..7c8e3692b1 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttMotionPattern.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum RttMotionPattern { + NOT_EXPECTED = 0, + EXPECTED = 1, + UNKNOWN = 2, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttPeerType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttPeerType.aidl new file mode 100644 index 0000000000..23fa7f67cb --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttPeerType.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum RttPeerType { + AP = 1, + STA = 2, + P2P_GO = 3, + P2P_CLIENT = 4, + NAN_TYPE = 5, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttPreamble.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttPreamble.aidl new file mode 100644 index 0000000000..de26f28f81 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttPreamble.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum RttPreamble { + LEGACY = 0x1, + HT = 0x2, + VHT = 0x4, + HE = 0x8, + EHT = 0x10, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttResponder.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttResponder.aidl new file mode 100644 index 0000000000..41463b5292 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttResponder.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable RttResponder { + android.hardware.wifi.WifiChannelInfo channel; + android.hardware.wifi.RttPreamble preamble; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttResult.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttResult.aidl new file mode 100644 index 0000000000..8375dcb148 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttResult.aidl @@ -0,0 +1,62 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable RttResult { + byte[6] addr; + int burstNum; + int measurementNumber; + int successNumber; + byte numberPerBurstPeer; + android.hardware.wifi.RttStatus status; + byte retryAfterDuration; + android.hardware.wifi.RttType type; + int rssi; + int rssiSpread; + android.hardware.wifi.WifiRateInfo txRate; + android.hardware.wifi.WifiRateInfo rxRate; + long rtt; + long rttSd; + long rttSpread; + int distanceInMm; + int distanceSdInMm; + int distanceSpreadInMm; + long timeStampInUs; + int burstDurationInMs; + int negotiatedBurstNum; + android.hardware.wifi.WifiInformationElement lci; + android.hardware.wifi.WifiInformationElement lcr; + int channelFreqMHz; + android.hardware.wifi.RttBw packetBw; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttStatus.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttStatus.aidl new file mode 100644 index 0000000000..2817497a7a --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttStatus.aidl @@ -0,0 +1,55 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum RttStatus { + SUCCESS = 0, + FAILURE = 1, + FAIL_NO_RSP = 2, + FAIL_REJECTED = 3, + FAIL_NOT_SCHEDULED_YET = 4, + FAIL_TM_TIMEOUT = 5, + FAIL_AP_ON_DIFF_CHANNEL = 6, + FAIL_NO_CAPABILITY = 7, + ABORTED = 8, + FAIL_INVALID_TS = 9, + FAIL_PROTOCOL = 10, + FAIL_SCHEDULE = 11, + FAIL_BUSY_TRY_LATER = 12, + INVALID_REQ = 13, + NO_WIFI = 14, + FAIL_FTM_PARAM_OVERRIDE = 15, + NAN_RANGING_PROTOCOL_FAILURE = 16, + NAN_RANGING_CONCURRENCY_NOT_SUPPORTED = 17, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttType.aidl new file mode 100644 index 0000000000..2b6087a6bc --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/RttType.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum RttType { + ONE_SIDED = 1, + TWO_SIDED = 2, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/Ssid.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/Ssid.aidl new file mode 100644 index 0000000000..98b523f37e --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/Ssid.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable Ssid { + byte[32] data; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaApfPacketFilterCapabilities.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaApfPacketFilterCapabilities.aidl new file mode 100644 index 0000000000..3b4d785a42 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaApfPacketFilterCapabilities.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable StaApfPacketFilterCapabilities { + int version; + int maxLength; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaBackgroundScanBucketEventReportSchemeMask.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaBackgroundScanBucketEventReportSchemeMask.aidl new file mode 100644 index 0000000000..249d87622a --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaBackgroundScanBucketEventReportSchemeMask.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum StaBackgroundScanBucketEventReportSchemeMask { + EACH_SCAN = (1 << 0) /* 1 */, + FULL_RESULTS = (1 << 1) /* 2 */, + NO_BATCH = (1 << 2) /* 4 */, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaBackgroundScanBucketParameters.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaBackgroundScanBucketParameters.aidl new file mode 100644 index 0000000000..4e9671a370 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaBackgroundScanBucketParameters.aidl @@ -0,0 +1,45 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable StaBackgroundScanBucketParameters { + int bucketIdx; + android.hardware.wifi.WifiBand band; + int[] frequencies; + int periodInMs; + int eventReportScheme; + int exponentialMaxPeriodInMs; + int exponentialBase; + int exponentialStepCount; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaBackgroundScanCapabilities.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaBackgroundScanCapabilities.aidl new file mode 100644 index 0000000000..758dd97485 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaBackgroundScanCapabilities.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable StaBackgroundScanCapabilities { + int maxCacheSize; + int maxBuckets; + int maxApCachePerScan; + int maxReportingThreshold; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaBackgroundScanLimits.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaBackgroundScanLimits.aidl new file mode 100644 index 0000000000..05d0277d1c --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaBackgroundScanLimits.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum StaBackgroundScanLimits { + MAX_CHANNELS = 16, + MAX_BUCKETS = 16, + MAX_AP_CACHE_PER_SCAN = 32, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaBackgroundScanParameters.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaBackgroundScanParameters.aidl new file mode 100644 index 0000000000..077356685d --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaBackgroundScanParameters.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable StaBackgroundScanParameters { + int basePeriodInMs; + int maxApPerScan; + int reportThresholdPercent; + int reportThresholdNumScans; + android.hardware.wifi.StaBackgroundScanBucketParameters[] buckets; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerIfaceContentionTimeStats.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerIfaceContentionTimeStats.aidl new file mode 100644 index 0000000000..4dee6de3fd --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerIfaceContentionTimeStats.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable StaLinkLayerIfaceContentionTimeStats { + int contentionTimeMinInUsec; + int contentionTimeMaxInUsec; + int contentionTimeAvgInUsec; + int contentionNumSamples; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerIfacePacketStats.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerIfacePacketStats.aidl new file mode 100644 index 0000000000..eddf52ee25 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerIfacePacketStats.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable StaLinkLayerIfacePacketStats { + long rxMpdu; + long txMpdu; + long lostMpdu; + long retries; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerIfaceStats.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerIfaceStats.aidl new file mode 100644 index 0000000000..a4192076d2 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerIfaceStats.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable StaLinkLayerIfaceStats { + android.hardware.wifi.StaLinkLayerLinkStats[] links; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerLinkStats.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerLinkStats.aidl new file mode 100644 index 0000000000..cd21c256fe --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerLinkStats.aidl @@ -0,0 +1,59 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable StaLinkLayerLinkStats { + int linkId; + int radioId; + int frequencyMhz; + int beaconRx; + int avgRssiMgmt; + android.hardware.wifi.StaLinkLayerIfacePacketStats wmeBePktStats; + android.hardware.wifi.StaLinkLayerIfacePacketStats wmeBkPktStats; + android.hardware.wifi.StaLinkLayerIfacePacketStats wmeViPktStats; + android.hardware.wifi.StaLinkLayerIfacePacketStats wmeVoPktStats; + byte timeSliceDutyCycleInPercent; + android.hardware.wifi.StaLinkLayerIfaceContentionTimeStats wmeBeContentionTimeStats; + android.hardware.wifi.StaLinkLayerIfaceContentionTimeStats wmeBkContentionTimeStats; + android.hardware.wifi.StaLinkLayerIfaceContentionTimeStats wmeViContentionTimeStats; + android.hardware.wifi.StaLinkLayerIfaceContentionTimeStats wmeVoContentionTimeStats; + android.hardware.wifi.StaPeerInfo[] peers; + android.hardware.wifi.StaLinkLayerLinkStats.StaLinkState state; + @Backing(type="int") @VintfStability + enum StaLinkState { + UNKNOWN = 0, + NOT_IN_USE = (1 << 0) /* 1 */, + IN_USE = (1 << 1) /* 2 */, + } +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerRadioStats.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerRadioStats.aidl new file mode 100644 index 0000000000..84d24c9974 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerRadioStats.aidl @@ -0,0 +1,49 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable StaLinkLayerRadioStats { + int onTimeInMs; + int txTimeInMs; + int[] txTimeInMsPerLevel; + int rxTimeInMs; + int onTimeInMsForScan; + int onTimeInMsForNanScan; + int onTimeInMsForBgScan; + int onTimeInMsForRoamScan; + int onTimeInMsForPnoScan; + int onTimeInMsForHs20Scan; + android.hardware.wifi.WifiChannelStats[] channelStats; + int radioId; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerStats.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerStats.aidl new file mode 100644 index 0000000000..9c05346998 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaLinkLayerStats.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable StaLinkLayerStats { + android.hardware.wifi.StaLinkLayerIfaceStats iface; + android.hardware.wifi.StaLinkLayerRadioStats[] radios; + long timeStampInMs; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaPeerInfo.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaPeerInfo.aidl new file mode 100644 index 0000000000..93a901fb2a --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaPeerInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable StaPeerInfo { + char staCount; + char chanUtil; + android.hardware.wifi.StaRateStat[] rateStats; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaRateStat.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaRateStat.aidl new file mode 100644 index 0000000000..43b69fc900 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaRateStat.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable StaRateStat { + android.hardware.wifi.WifiRateInfo rateInfo; + int txMpdu; + int rxMpdu; + int mpduLost; + int retries; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaRoamingCapabilities.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaRoamingCapabilities.aidl new file mode 100644 index 0000000000..9eed877d6f --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaRoamingCapabilities.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable StaRoamingCapabilities { + int maxBlocklistSize; + int maxAllowlistSize; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaRoamingConfig.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaRoamingConfig.aidl new file mode 100644 index 0000000000..2b37cee12a --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaRoamingConfig.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable StaRoamingConfig { + android.hardware.wifi.MacAddress[] bssidBlocklist; + android.hardware.wifi.Ssid[] ssidAllowlist; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaRoamingState.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaRoamingState.aidl new file mode 100644 index 0000000000..1f3d91f290 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaRoamingState.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="byte") @VintfStability +enum StaRoamingState { + DISABLED = 0, + ENABLED = 1, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaScanData.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaScanData.aidl new file mode 100644 index 0000000000..7c75232e51 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaScanData.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable StaScanData { + int flags; + int bucketsScanned; + android.hardware.wifi.StaScanResult[] results; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaScanDataFlagMask.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaScanDataFlagMask.aidl new file mode 100644 index 0000000000..0ca4b4b41c --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaScanDataFlagMask.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum StaScanDataFlagMask { + INTERRUPTED = (1 << 0) /* 1 */, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaScanResult.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaScanResult.aidl new file mode 100644 index 0000000000..9a8d29720c --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/StaScanResult.aidl @@ -0,0 +1,45 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable StaScanResult { + long timeStampInUs; + byte[] ssid; + byte[6] bssid; + int rssi; + int frequency; + char beaconPeriodInMs; + char capability; + android.hardware.wifi.WifiInformationElement[] informationElements; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiAntennaMode.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiAntennaMode.aidl new file mode 100644 index 0000000000..b47b7f502a --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiAntennaMode.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum WifiAntennaMode { + WIFI_ANTENNA_MODE_UNSPECIFIED = 0, + WIFI_ANTENNA_MODE_1X1 = 1, + WIFI_ANTENNA_MODE_2X2 = 2, + WIFI_ANTENNA_MODE_3X3 = 3, + WIFI_ANTENNA_MODE_4X4 = 4, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiBand.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiBand.aidl new file mode 100644 index 0000000000..e9a87ee458 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiBand.aidl @@ -0,0 +1,51 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum WifiBand { + BAND_UNSPECIFIED = 0, + BAND_24GHZ = 1, + BAND_5GHZ = 2, + BAND_5GHZ_DFS = 4, + BAND_5GHZ_WITH_DFS = 6, + BAND_24GHZ_5GHZ = 3, + BAND_24GHZ_5GHZ_WITH_DFS = 7, + BAND_6GHZ = 8, + BAND_5GHZ_6GHZ = 10, + BAND_24GHZ_5GHZ_6GHZ = 11, + BAND_24GHZ_5GHZ_WITH_DFS_6GHZ = 15, + BAND_60GHZ = 16, + BAND_24GHZ_5GHZ_6GHZ_60GHZ = 27, + BAND_24GHZ_5GHZ_WITH_DFS_6GHZ_60GHZ = 31, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiChannelInfo.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiChannelInfo.aidl new file mode 100644 index 0000000000..297c923dbe --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiChannelInfo.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable WifiChannelInfo { + android.hardware.wifi.WifiChannelWidthInMhz width; + int centerFreq; + int centerFreq0; + int centerFreq1; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiChannelStats.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiChannelStats.aidl new file mode 100644 index 0000000000..c6e7acc937 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiChannelStats.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable WifiChannelStats { + android.hardware.wifi.WifiChannelInfo channel; + int onTimeInMs; + int ccaBusyTimeInMs; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiChannelWidthInMhz.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiChannelWidthInMhz.aidl new file mode 100644 index 0000000000..e6ea642db6 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiChannelWidthInMhz.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum WifiChannelWidthInMhz { + WIDTH_INVALID = (-1) /* -1 */, + WIDTH_20 = 0, + WIDTH_40 = 1, + WIDTH_80 = 2, + WIDTH_160 = 3, + WIDTH_80P80 = 4, + WIDTH_5 = 5, + WIDTH_10 = 6, + WIDTH_320 = 7, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiChipCapabilities.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiChipCapabilities.aidl new file mode 100644 index 0000000000..b5034ea387 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiChipCapabilities.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable WifiChipCapabilities { + int maxMloAssociationLinkCount; + int maxMloStrLinkCount; + int maxConcurrentTdlsSessionCount; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugHostWakeReasonRxIcmpPacketDetails.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugHostWakeReasonRxIcmpPacketDetails.aidl new file mode 100644 index 0000000000..8415e09ad8 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugHostWakeReasonRxIcmpPacketDetails.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable WifiDebugHostWakeReasonRxIcmpPacketDetails { + int icmpPkt; + int icmp6Pkt; + int icmp6Ra; + int icmp6Na; + int icmp6Ns; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugHostWakeReasonRxMulticastPacketDetails.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugHostWakeReasonRxMulticastPacketDetails.aidl new file mode 100644 index 0000000000..30301d3e45 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugHostWakeReasonRxMulticastPacketDetails.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable WifiDebugHostWakeReasonRxMulticastPacketDetails { + int ipv4RxMulticastAddrCnt; + int ipv6RxMulticastAddrCnt; + int otherRxMulticastAddrCnt; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugHostWakeReasonRxPacketDetails.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugHostWakeReasonRxPacketDetails.aidl new file mode 100644 index 0000000000..81183225dc --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugHostWakeReasonRxPacketDetails.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable WifiDebugHostWakeReasonRxPacketDetails { + int rxUnicastCnt; + int rxMulticastCnt; + int rxBroadcastCnt; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugHostWakeReasonStats.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugHostWakeReasonStats.aidl new file mode 100644 index 0000000000..1766476919 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugHostWakeReasonStats.aidl @@ -0,0 +1,45 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable WifiDebugHostWakeReasonStats { + int totalCmdEventWakeCnt; + int[] cmdEventWakeCntPerType; + int totalDriverFwLocalWakeCnt; + int[] driverFwLocalWakeCntPerType; + int totalRxPacketWakeCnt; + android.hardware.wifi.WifiDebugHostWakeReasonRxPacketDetails rxPktWakeDetails; + android.hardware.wifi.WifiDebugHostWakeReasonRxMulticastPacketDetails rxMulticastPkWakeDetails; + android.hardware.wifi.WifiDebugHostWakeReasonRxIcmpPacketDetails rxIcmpPkWakeDetails; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugPacketFateFrameInfo.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugPacketFateFrameInfo.aidl new file mode 100644 index 0000000000..2ff6cfcbeb --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugPacketFateFrameInfo.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable WifiDebugPacketFateFrameInfo { + android.hardware.wifi.WifiDebugPacketFateFrameType frameType; + long frameLen; + long driverTimestampUsec; + long firmwareTimestampUsec; + byte[] frameContent; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugPacketFateFrameType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugPacketFateFrameType.aidl new file mode 100644 index 0000000000..6db96efc0f --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugPacketFateFrameType.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum WifiDebugPacketFateFrameType { + UNKNOWN, + ETHERNET_II, + MGMT_80211, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugRingBufferFlags.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugRingBufferFlags.aidl new file mode 100644 index 0000000000..9ababc373d --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugRingBufferFlags.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum WifiDebugRingBufferFlags { + HAS_BINARY_ENTRIES = (1 << 0) /* 1 */, + HAS_ASCII_ENTRIES = (1 << 1) /* 2 */, + HAS_PER_PACKET_ENTRIES = (1 << 2) /* 4 */, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugRingBufferStatus.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugRingBufferStatus.aidl new file mode 100644 index 0000000000..e4249d9a88 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugRingBufferStatus.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable WifiDebugRingBufferStatus { + String ringName; + int flags; + int ringId; + int sizeInBytes; + int freeSizeInBytes; + int verboseLevel; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugRingBufferVerboseLevel.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugRingBufferVerboseLevel.aidl new file mode 100644 index 0000000000..e614f3fba0 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugRingBufferVerboseLevel.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum WifiDebugRingBufferVerboseLevel { + NONE = 0, + DEFAULT = 1, + VERBOSE = 2, + EXCESSIVE = 3, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugRxPacketFate.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugRxPacketFate.aidl new file mode 100644 index 0000000000..f638c4f7df --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugRxPacketFate.aidl @@ -0,0 +1,48 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum WifiDebugRxPacketFate { + SUCCESS, + FW_QUEUED, + FW_DROP_FILTER, + FW_DROP_INVALID, + FW_DROP_NOBUFS, + FW_DROP_OTHER, + DRV_QUEUED, + DRV_DROP_FILTER, + DRV_DROP_INVALID, + DRV_DROP_NOBUFS, + DRV_DROP_OTHER, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugRxPacketFateReport.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugRxPacketFateReport.aidl new file mode 100644 index 0000000000..bfe0c0aee6 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugRxPacketFateReport.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable WifiDebugRxPacketFateReport { + android.hardware.wifi.WifiDebugRxPacketFate fate; + android.hardware.wifi.WifiDebugPacketFateFrameInfo frameInfo; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugTxPacketFate.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugTxPacketFate.aidl new file mode 100644 index 0000000000..778ca5dee2 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugTxPacketFate.aidl @@ -0,0 +1,47 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum WifiDebugTxPacketFate { + ACKED, + SENT, + FW_QUEUED, + FW_DROP_INVALID, + FW_DROP_NOBUFS, + FW_DROP_OTHER, + DRV_QUEUED, + DRV_DROP_INVALID, + DRV_DROP_NOBUFS, + DRV_DROP_OTHER, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugTxPacketFateReport.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugTxPacketFateReport.aidl new file mode 100644 index 0000000000..aee5c31103 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiDebugTxPacketFateReport.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable WifiDebugTxPacketFateReport { + android.hardware.wifi.WifiDebugTxPacketFate fate; + android.hardware.wifi.WifiDebugPacketFateFrameInfo frameInfo; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiIfaceMode.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiIfaceMode.aidl new file mode 100644 index 0000000000..557cef4c77 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiIfaceMode.aidl @@ -0,0 +1,45 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum WifiIfaceMode { + IFACE_MODE_STA = (1 << 0) /* 1 */, + IFACE_MODE_SOFTAP = (1 << 1) /* 2 */, + IFACE_MODE_IBSS = (1 << 2) /* 4 */, + IFACE_MODE_P2P_CLIENT = (1 << 3) /* 8 */, + IFACE_MODE_P2P_GO = (1 << 4) /* 16 */, + IFACE_MODE_NAN = (1 << 5) /* 32 */, + IFACE_MODE_MESH = (1 << 6) /* 64 */, + IFACE_MODE_TDLS = (1 << 7) /* 128 */, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiInformationElement.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiInformationElement.aidl new file mode 100644 index 0000000000..27ba0db19c --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiInformationElement.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable WifiInformationElement { + byte id; + byte[] data; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiRadioCombination.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiRadioCombination.aidl new file mode 100644 index 0000000000..f060db87f3 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiRadioCombination.aidl @@ -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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable WifiRadioCombination { + android.hardware.wifi.WifiRadioConfiguration[] radioConfigurations; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiRadioConfiguration.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiRadioConfiguration.aidl new file mode 100644 index 0000000000..5169351525 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiRadioConfiguration.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable WifiRadioConfiguration { + android.hardware.wifi.WifiBand bandInfo; + android.hardware.wifi.WifiAntennaMode antennaMode; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiRateInfo.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiRateInfo.aidl new file mode 100644 index 0000000000..c4aca637bf --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiRateInfo.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable WifiRateInfo { + android.hardware.wifi.WifiRatePreamble preamble; + android.hardware.wifi.WifiRateNss nss; + android.hardware.wifi.WifiChannelWidthInMhz bw; + byte rateMcsIdx; + int bitRateInKbps; +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiRateNss.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiRateNss.aidl new file mode 100644 index 0000000000..0ad6f04847 --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiRateNss.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum WifiRateNss { + NSS_1x1 = 0, + NSS_2x2 = 1, + NSS_3x3 = 2, + NSS_4x4 = 3, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiRatePreamble.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiRatePreamble.aidl new file mode 100644 index 0000000000..04b63583ea --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiRatePreamble.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum WifiRatePreamble { + OFDM = 0, + CCK = 1, + HT = 2, + VHT = 3, + RESERVED = 4, + HE = 5, + EHT = 6, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiStatusCode.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiStatusCode.aidl new file mode 100644 index 0000000000..9a15fa1cae --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiStatusCode.aidl @@ -0,0 +1,47 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@Backing(type="int") @VintfStability +enum WifiStatusCode { + SUCCESS, + ERROR_WIFI_CHIP_INVALID, + ERROR_WIFI_IFACE_INVALID, + ERROR_WIFI_RTT_CONTROLLER_INVALID, + ERROR_NOT_SUPPORTED, + ERROR_NOT_AVAILABLE, + ERROR_NOT_STARTED, + ERROR_INVALID_ARGS, + ERROR_BUSY, + ERROR_UNKNOWN, +} diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiUsableChannel.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiUsableChannel.aidl new file mode 100644 index 0000000000..774b2423ff --- /dev/null +++ b/wifi/aidl/aidl_api/android.hardware.wifi/1/android/hardware/wifi/WifiUsableChannel.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi; +@VintfStability +parcelable WifiUsableChannel { + int channel; + android.hardware.wifi.WifiChannelWidthInMhz channelBandwidth; + int ifaceModeMask; +} diff --git a/wifi/supplicant/aidl/Android.bp b/wifi/supplicant/aidl/Android.bp index c4d3767b69..ac5a952add 100644 --- a/wifi/supplicant/aidl/Android.bp +++ b/wifi/supplicant/aidl/Android.bp @@ -51,6 +51,12 @@ aidl_interface { version: "1", imports: [], }, + { + version: "2", + imports: [], + }, + ], + frozen: true, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/.hash b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/.hash new file mode 100644 index 0000000000..e691512244 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/.hash @@ -0,0 +1 @@ +5e5c6d9e5565999f73fa7f797f5b94616174745b diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/AnqpData.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/AnqpData.aidl new file mode 100644 index 0000000000..d8e49d70f3 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/AnqpData.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable AnqpData { + byte[] venueName; + byte[] roamingConsortium; + byte[] ipAddrTypeAvailability; + byte[] naiRealm; + byte[] anqp3gppCellularNetwork; + byte[] domainName; + byte[] venueUrl; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/AnqpInfoId.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/AnqpInfoId.aidl new file mode 100644 index 0000000000..cc323608f9 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/AnqpInfoId.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum AnqpInfoId { + VENUE_NAME = 258, + ROAMING_CONSORTIUM = 261, + IP_ADDR_TYPE_AVAILABILITY = 262, + NAI_REALM = 263, + ANQP_3GPP_CELLULAR_NETWORK = 264, + DOMAIN_NAME = 268, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/AssociationRejectionData.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/AssociationRejectionData.aidl new file mode 100644 index 0000000000..f6830dc8be --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/AssociationRejectionData.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable AssociationRejectionData { + byte[] ssid; + byte[] bssid; + android.hardware.wifi.supplicant.StaIfaceStatusCode statusCode; + boolean timedOut; + boolean isMboAssocDisallowedReasonCodePresent; + android.hardware.wifi.supplicant.MboAssocDisallowedReasonCode mboAssocDisallowedReason; + boolean isOceRssiBasedAssocRejectAttrPresent; + android.hardware.wifi.supplicant.OceRssiBasedAssocRejectAttr oceRssiBasedAssocRejectData; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/AuthAlgMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/AuthAlgMask.aidl new file mode 100644 index 0000000000..44210185cf --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/AuthAlgMask.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum AuthAlgMask { + OPEN = (1 << 0) /* 1 */, + SHARED = (1 << 1) /* 2 */, + LEAP = (1 << 2) /* 4 */, + SAE = (1 << 4) /* 16 */, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/AuxiliarySupplicantEventCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/AuxiliarySupplicantEventCode.aidl new file mode 100644 index 0000000000..a339a9272f --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/AuxiliarySupplicantEventCode.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum AuxiliarySupplicantEventCode { + EAP_METHOD_SELECTED, + SSID_TEMP_DISABLED, + OPEN_SSL_FAILURE, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/BssTmData.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/BssTmData.aidl new file mode 100644 index 0000000000..34d894d6fa --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/BssTmData.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable BssTmData { + android.hardware.wifi.supplicant.BssTmStatusCode status; + android.hardware.wifi.supplicant.BssTmDataFlagsMask flags; + int assocRetryDelayMs; + android.hardware.wifi.supplicant.MboTransitionReasonCode mboTransitionReason; + android.hardware.wifi.supplicant.MboCellularDataConnectionPrefValue mboCellPreference; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/BssTmDataFlagsMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/BssTmDataFlagsMask.aidl new file mode 100644 index 0000000000..6f0045c82c --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/BssTmDataFlagsMask.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum BssTmDataFlagsMask { + WNM_MODE_PREFERRED_CANDIDATE_LIST_INCLUDED = (1 << 0) /* 1 */, + WNM_MODE_ABRIDGED = (1 << 1) /* 2 */, + WNM_MODE_DISASSOCIATION_IMMINENT = (1 << 2) /* 4 */, + WNM_MODE_BSS_TERMINATION_INCLUDED = (1 << 3) /* 8 */, + WNM_MODE_ESS_DISASSOCIATION_IMMINENT = (1 << 4) /* 16 */, + MBO_TRANSITION_REASON_CODE_INCLUDED = (1 << 5) /* 32 */, + MBO_ASSOC_RETRY_DELAY_INCLUDED = (1 << 6) /* 64 */, + MBO_CELLULAR_DATA_CONNECTION_PREFERENCE_INCLUDED = (1 << 7) /* 128 */, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/BssTmStatusCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/BssTmStatusCode.aidl new file mode 100644 index 0000000000..c95825fe3c --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/BssTmStatusCode.aidl @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="byte") @VintfStability +enum BssTmStatusCode { + ACCEPT = 0, + REJECT_UNSPECIFIED = 1, + REJECT_INSUFFICIENT_BEACON = 2, + REJECT_INSUFFICIENT_CAPABITY = 3, + REJECT_BSS_TERMINATION_UNDESIRED = 4, + REJECT_BSS_TERMINATION_DELAY_REQUEST = 5, + REJECT_STA_CANDIDATE_LIST_PROVIDED = 6, + REJECT_NO_SUITABLE_CANDIDATES = 7, + REJECT_LEAVING_ESS = 8, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/BssidChangeReason.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/BssidChangeReason.aidl new file mode 100644 index 0000000000..1d24579201 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/BssidChangeReason.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="byte") @VintfStability +enum BssidChangeReason { + ASSOC_START = 0, + ASSOC_COMPLETE = 1, + DISASSOC = 2, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/BtCoexistenceMode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/BtCoexistenceMode.aidl new file mode 100644 index 0000000000..bdc1b4a991 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/BtCoexistenceMode.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="byte") @VintfStability +enum BtCoexistenceMode { + ENABLED = 0, + DISABLED = 1, + SENSE = 2, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl new file mode 100644 index 0000000000..553cbc8e25 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ConnectionCapabilities.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable ConnectionCapabilities { + android.hardware.wifi.supplicant.WifiTechnology technology; + int channelBandwidth; + int maxNumberTxSpatialStreams; + int maxNumberRxSpatialStreams; + android.hardware.wifi.supplicant.LegacyMode legacyMode; + boolean apTidToLinkMapNegotiationSupported; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DebugLevel.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DebugLevel.aidl new file mode 100644 index 0000000000..fbfb5b3468 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DebugLevel.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum DebugLevel { + EXCESSIVE = 0, + MSGDUMP = 1, + DEBUG = 2, + INFO = 3, + WARNING = 4, + ERROR = 5, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppAkm.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppAkm.aidl new file mode 100644 index 0000000000..730843d2ec --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppAkm.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum DppAkm { + PSK, + PSK_SAE, + SAE, + DPP, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppConfigurationData.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppConfigurationData.aidl new file mode 100644 index 0000000000..2225330538 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppConfigurationData.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable DppConfigurationData { + byte[] ssid; + String password; + byte[] psk; + android.hardware.wifi.supplicant.DppAkm securityAkm; + android.hardware.wifi.supplicant.DppConnectionKeys dppConnectionKeys; + boolean connStatusRequested; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppConnectionKeys.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppConnectionKeys.aidl new file mode 100644 index 0000000000..559d1c94ce --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppConnectionKeys.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable DppConnectionKeys { + byte[] connector; + byte[] cSign; + byte[] netAccessKey; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppCurve.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppCurve.aidl new file mode 100644 index 0000000000..14cb49f681 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppCurve.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum DppCurve { + PRIME256V1, + SECP384R1, + SECP521R1, + BRAINPOOLP256R1, + BRAINPOOLP384R1, + BRAINPOOLP512R1, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppEventType.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppEventType.aidl new file mode 100644 index 0000000000..47c8cc0e35 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppEventType.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum DppEventType { + CONFIGURATION_SENT, + CONFIGURATION_APPLIED, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppFailureCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppFailureCode.aidl new file mode 100644 index 0000000000..89fbc4bab1 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppFailureCode.aidl @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum DppFailureCode { + INVALID_URI, + AUTHENTICATION, + NOT_COMPATIBLE, + CONFIGURATION, + BUSY, + TIMEOUT, + FAILURE, + NOT_SUPPORTED, + CONFIGURATION_REJECTED, + CANNOT_FIND_NETWORK, + ENROLLEE_AUTHENTICATION, + URI_GENERATION, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppNetRole.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppNetRole.aidl new file mode 100644 index 0000000000..77a910b251 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppNetRole.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum DppNetRole { + STA, + AP, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppProgressCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppProgressCode.aidl new file mode 100644 index 0000000000..ea244de3c2 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppProgressCode.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum DppProgressCode { + AUTHENTICATION_SUCCESS, + RESPONSE_PENDING, + CONFIGURATION_SENT_WAITING_RESPONSE, + CONFIGURATION_ACCEPTED, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppResponderBootstrapInfo.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppResponderBootstrapInfo.aidl new file mode 100644 index 0000000000..8b6492b4f3 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppResponderBootstrapInfo.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable DppResponderBootstrapInfo { + int bootstrapId; + int listenChannel; + String uri; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppStatusErrorCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppStatusErrorCode.aidl new file mode 100644 index 0000000000..21f07dded5 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/DppStatusErrorCode.aidl @@ -0,0 +1,53 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum DppStatusErrorCode { + UNKNOWN = (-1) /* -1 */, + SUCCESS = 0, + NOT_COMPATIBLE = 1, + AUTH_FAILURE = 2, + UNWRAP_FAILURE = 3, + BAD_GROUP = 4, + CONFIGURE_FAILURE = 5, + RESPONSE_PENDING = 6, + INVALID_CONNECTOR = 7, + NO_MATCH = 8, + CONFIG_REJECTED = 9, + NO_AP = 10, + CONFIGURE_PENDING = 11, + CSR_NEEDED = 12, + CSR_BAD = 13, + NEW_KEY_NEEDED = 14, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/EapErrorCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/EapErrorCode.aidl new file mode 100644 index 0000000000..2cf81d9ca2 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/EapErrorCode.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum EapErrorCode { + SIM_GENERAL_FAILURE_AFTER_AUTH = 0, + SIM_TEMPORARILY_DENIED = 1026, + SIM_NOT_SUBSCRIBED = 1031, + SIM_GENERAL_FAILURE_BEFORE_AUTH = 16384, + SIM_VENDOR_SPECIFIC_EXPIRED_CERT = 16385, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/EapMethod.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/EapMethod.aidl new file mode 100644 index 0000000000..4ab23afefd --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/EapMethod.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum EapMethod { + PEAP = 0, + TLS = 1, + TTLS = 2, + PWD = 3, + SIM = 4, + AKA = 5, + AKA_PRIME = 6, + WFA_UNAUTH_TLS = 7, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/EapPhase2Method.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/EapPhase2Method.aidl new file mode 100644 index 0000000000..4bd93a08da --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/EapPhase2Method.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum EapPhase2Method { + NONE = 0, + PAP = 1, + MSPAP = 2, + MSPAPV2 = 3, + GTC = 4, + SIM = 5, + AKA = 6, + AKA_PRIME = 7, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ExtRadioWorkDefaults.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ExtRadioWorkDefaults.aidl new file mode 100644 index 0000000000..cbf1a3ee37 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ExtRadioWorkDefaults.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum ExtRadioWorkDefaults { + TIMEOUT_IN_SECS = 10, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/FreqRange.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/FreqRange.aidl new file mode 100644 index 0000000000..0971d517f6 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/FreqRange.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable FreqRange { + int min; + int max; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/GroupCipherMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/GroupCipherMask.aidl new file mode 100644 index 0000000000..d22d3d0582 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/GroupCipherMask.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum GroupCipherMask { + WEP40 = (1 << 1) /* 2 */, + WEP104 = (1 << 2) /* 4 */, + TKIP = (1 << 3) /* 8 */, + CCMP = (1 << 4) /* 16 */, + GTK_NOT_USED = (1 << 14) /* 16384 */, + GCMP_256 = (1 << 8) /* 256 */, + SMS4 = (1 << 7) /* 128 */, + GCMP_128 = (1 << 6) /* 64 */, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/GroupMgmtCipherMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/GroupMgmtCipherMask.aidl new file mode 100644 index 0000000000..23bb04fe2f --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/GroupMgmtCipherMask.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum GroupMgmtCipherMask { + BIP_GMAC_128 = (1 << 11) /* 2048 */, + BIP_GMAC_256 = (1 << 12) /* 4096 */, + BIP_CMAC_256 = (1 << 13) /* 8192 */, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/GsmRand.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/GsmRand.aidl new file mode 100644 index 0000000000..599a68339a --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/GsmRand.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable GsmRand { + byte[] data; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/Hs20AnqpData.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/Hs20AnqpData.aidl new file mode 100644 index 0000000000..43b182a24a --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/Hs20AnqpData.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable Hs20AnqpData { + byte[] operatorFriendlyName; + byte[] wanMetrics; + byte[] connectionCapability; + byte[] osuProvidersList; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/Hs20AnqpSubtypes.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/Hs20AnqpSubtypes.aidl new file mode 100644 index 0000000000..270d43b073 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/Hs20AnqpSubtypes.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum Hs20AnqpSubtypes { + OPERATOR_FRIENDLY_NAME = 3, + WAN_METRICS = 4, + CONNECTION_CAPABILITY = 5, + OSU_PROVIDERS_LIST = 8, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl new file mode 100644 index 0000000000..bcf0ea8cb6 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/INonStandardCertCallback.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@VintfStability +interface INonStandardCertCallback { + byte[] getBlob(in String alias); + String[] listAliases(in String prefix); +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicant.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicant.aidl new file mode 100644 index 0000000000..dd62167907 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicant.aidl @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +interface ISupplicant { + @PropagateAllowBlocking android.hardware.wifi.supplicant.ISupplicantP2pIface addP2pInterface(in String ifName); + @PropagateAllowBlocking android.hardware.wifi.supplicant.ISupplicantStaIface addStaInterface(in String ifName); + android.hardware.wifi.supplicant.DebugLevel getDebugLevel(); + @PropagateAllowBlocking android.hardware.wifi.supplicant.ISupplicantP2pIface getP2pInterface(in String ifName); + @PropagateAllowBlocking android.hardware.wifi.supplicant.ISupplicantStaIface getStaInterface(in String ifName); + boolean isDebugShowKeysEnabled(); + boolean isDebugShowTimestampEnabled(); + android.hardware.wifi.supplicant.IfaceInfo[] listInterfaces(); + void registerCallback(in android.hardware.wifi.supplicant.ISupplicantCallback callback); + void removeInterface(in android.hardware.wifi.supplicant.IfaceInfo ifaceInfo); + void setConcurrencyPriority(in android.hardware.wifi.supplicant.IfaceType type); + void setDebugParams(in android.hardware.wifi.supplicant.DebugLevel level, in boolean showTimestamp, in boolean showKeys); + oneway void terminate(); + void registerNonStandardCertCallback(in android.hardware.wifi.supplicant.INonStandardCertCallback callback); + const int EXT_RADIO_WORK_TIMEOUT_IN_SECS = 10; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantCallback.aidl new file mode 100644 index 0000000000..7281053cdb --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantCallback.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +interface ISupplicantCallback { + oneway void onInterfaceCreated(in String ifaceName); + oneway void onInterfaceRemoved(in String ifaceName); +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl new file mode 100644 index 0000000000..19e6728420 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +interface ISupplicantP2pIface { + void addBonjourService(in byte[] query, in byte[] response); + void addGroup(in boolean persistent, in int persistentNetworkId); + void addGroupWithConfig(in byte[] ssid, in String pskPassphrase, in boolean persistent, in int freq, in byte[] peerAddress, in boolean joinExistingGroup); + @PropagateAllowBlocking android.hardware.wifi.supplicant.ISupplicantP2pNetwork addNetwork(); + void addUpnpService(in int version, in String serviceName); + void cancelConnect(); + void cancelServiceDiscovery(in long identifier); + void cancelWps(in String groupIfName); + void configureExtListen(in int periodInMillis, in int intervalInMillis); + String connect(in byte[] peerAddress, in android.hardware.wifi.supplicant.WpsProvisionMethod provisionMethod, in String preSelectedPin, in boolean joinExistingGroup, in boolean persistent, in int goIntent); + byte[] createNfcHandoverRequestMessage(); + byte[] createNfcHandoverSelectMessage(); + void enableWfd(in boolean enable); + void find(in int timeoutInSec); + void flush(); + void flushServices(); + byte[] getDeviceAddress(); + boolean getEdmg(); + android.hardware.wifi.supplicant.P2pGroupCapabilityMask getGroupCapability(in byte[] peerAddress); + String getName(); + @PropagateAllowBlocking android.hardware.wifi.supplicant.ISupplicantP2pNetwork getNetwork(in int id); + byte[] getSsid(in byte[] peerAddress); + android.hardware.wifi.supplicant.IfaceType getType(); + void invite(in String groupIfName, in byte[] goDeviceAddress, in byte[] peerAddress); + int[] listNetworks(); + void provisionDiscovery(in byte[] peerAddress, in android.hardware.wifi.supplicant.WpsProvisionMethod provisionMethod); + void registerCallback(in android.hardware.wifi.supplicant.ISupplicantP2pIfaceCallback callback); + void reinvoke(in int persistentNetworkId, in byte[] peerAddress); + void reject(in byte[] peerAddress); + void removeBonjourService(in byte[] query); + void removeGroup(in String groupIfName); + void removeNetwork(in int id); + void removeUpnpService(in int version, in String serviceName); + void reportNfcHandoverInitiation(in byte[] select); + void reportNfcHandoverResponse(in byte[] request); + long requestServiceDiscovery(in byte[] peerAddress, in byte[] query); + void saveConfig(); + void setDisallowedFrequencies(in android.hardware.wifi.supplicant.FreqRange[] ranges); + void setEdmg(in boolean enable); + void setGroupIdle(in String groupIfName, in int timeoutInSec); + void setListenChannel(in int channel, in int operatingClass); + void setMacRandomization(in boolean enable); + void setMiracastMode(in android.hardware.wifi.supplicant.MiracastMode mode); + void setPowerSave(in String groupIfName, in boolean enable); + void setSsidPostfix(in byte[] postfix); + void setWfdDeviceInfo(in byte[] info); + void setWfdR2DeviceInfo(in byte[] info); + void removeClient(in byte[] peerAddress, in boolean isLegacyClient); + void setWpsConfigMethods(in android.hardware.wifi.supplicant.WpsConfigMethods configMethods); + void setWpsDeviceName(in String name); + void setWpsDeviceType(in byte[] type); + void setWpsManufacturer(in String manufacturer); + void setWpsModelName(in String modelName); + void setWpsModelNumber(in String modelNumber); + void setWpsSerialNumber(in String serialNumber); + void startWpsPbc(in String groupIfName, in byte[] bssid); + String startWpsPinDisplay(in String groupIfName, in byte[] bssid); + void startWpsPinKeypad(in String groupIfName, in String pin); + void stopFind(); + void findOnSocialChannels(in int timeoutInSec); + void findOnSpecificFrequency(in int freqInHz, in int timeoutInSec); + void setVendorElements(in android.hardware.wifi.supplicant.P2pFrameTypeMask frameTypeMask, in byte[] vendorElemBytes); + void configureEapolIpAddressAllocationParams(in int ipAddressGo, in int ipAddressMask, in int ipAddressStart, in int ipAddressEnd); +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl new file mode 100644 index 0000000000..da3ca52897 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantP2pIfaceCallback.aidl @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +interface ISupplicantP2pIfaceCallback { + oneway void onDeviceFound(in byte[] srcAddress, in byte[] p2pDeviceAddress, in byte[] primaryDeviceType, in String deviceName, in android.hardware.wifi.supplicant.WpsConfigMethods configMethods, in byte deviceCapabilities, in android.hardware.wifi.supplicant.P2pGroupCapabilityMask groupCapabilities, in byte[] wfdDeviceInfo); + oneway void onDeviceLost(in byte[] p2pDeviceAddress); + oneway void onFindStopped(); + oneway void onGoNegotiationCompleted(in android.hardware.wifi.supplicant.P2pStatusCode status); + oneway void onGoNegotiationRequest(in byte[] srcAddress, in android.hardware.wifi.supplicant.WpsDevPasswordId passwordId); + oneway void onGroupFormationFailure(in String failureReason); + oneway void onGroupFormationSuccess(); + oneway void onGroupRemoved(in String groupIfname, in boolean isGroupOwner); + oneway void onGroupStarted(in String groupIfname, in boolean isGroupOwner, in byte[] ssid, in int frequency, in byte[] psk, in String passphrase, in byte[] goDeviceAddress, in boolean isPersistent); + oneway void onInvitationReceived(in byte[] srcAddress, in byte[] goDeviceAddress, in byte[] bssid, in int persistentNetworkId, in int operatingFrequency); + oneway void onInvitationResult(in byte[] bssid, in android.hardware.wifi.supplicant.P2pStatusCode status); + oneway void onProvisionDiscoveryCompleted(in byte[] p2pDeviceAddress, in boolean isRequest, in android.hardware.wifi.supplicant.P2pProvDiscStatusCode status, in android.hardware.wifi.supplicant.WpsConfigMethods configMethods, in String generatedPin); + oneway void onR2DeviceFound(in byte[] srcAddress, in byte[] p2pDeviceAddress, in byte[] primaryDeviceType, in String deviceName, in android.hardware.wifi.supplicant.WpsConfigMethods configMethods, in byte deviceCapabilities, in android.hardware.wifi.supplicant.P2pGroupCapabilityMask groupCapabilities, in byte[] wfdDeviceInfo, in byte[] wfdR2DeviceInfo); + oneway void onServiceDiscoveryResponse(in byte[] srcAddress, in char updateIndicator, in byte[] tlvs); + oneway void onStaAuthorized(in byte[] srcAddress, in byte[] p2pDeviceAddress); + oneway void onStaDeauthorized(in byte[] srcAddress, in byte[] p2pDeviceAddress); + oneway void onGroupFrequencyChanged(in String groupIfname, in int frequency); + oneway void onDeviceFoundWithVendorElements(in byte[] srcAddress, in byte[] p2pDeviceAddress, in byte[] primaryDeviceType, in String deviceName, in android.hardware.wifi.supplicant.WpsConfigMethods configMethods, in byte deviceCapabilities, in android.hardware.wifi.supplicant.P2pGroupCapabilityMask groupCapabilities, in byte[] wfdDeviceInfo, in byte[] wfdR2DeviceInfo, in byte[] vendorElemBytes); + oneway void onGroupStartedWithParams(in android.hardware.wifi.supplicant.P2pGroupStartedEventParams groupStartedEventParams); +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantP2pNetwork.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantP2pNetwork.aidl new file mode 100644 index 0000000000..ef72724642 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantP2pNetwork.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +interface ISupplicantP2pNetwork { + byte[] getBssid(); + android.hardware.wifi.supplicant.MacAddress[] getClientList(); + int getId(); + String getInterfaceName(); + byte[] getSsid(); + android.hardware.wifi.supplicant.IfaceType getType(); + boolean isCurrent(); + boolean isGroupOwner(); + boolean isPersistent(); + void setClientList(in android.hardware.wifi.supplicant.MacAddress[] clients); +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl new file mode 100644 index 0000000000..1616b26003 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantStaIface.aidl @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +interface ISupplicantStaIface { + int addDppPeerUri(in String uri); + int addExtRadioWork(in String name, in int freqInMhz, in int timeoutInSec); + @PropagateAllowBlocking android.hardware.wifi.supplicant.ISupplicantStaNetwork addNetwork(); + void addRxFilter(in android.hardware.wifi.supplicant.RxFilterType type); + void cancelWps(); + void disconnect(); + void enableAutoReconnect(in boolean enable); + void filsHlpAddRequest(in byte[] dst_mac, in byte[] pkt); + void filsHlpFlushRequest(); + android.hardware.wifi.supplicant.DppResponderBootstrapInfo generateDppBootstrapInfoForResponder(in byte[] macAddress, in String deviceInfo, in android.hardware.wifi.supplicant.DppCurve curve); + void generateSelfDppConfiguration(in String ssid, in byte[] privEcKey); + android.hardware.wifi.supplicant.ConnectionCapabilities getConnectionCapabilities(); + android.hardware.wifi.supplicant.MloLinksInfo getConnectionMloLinksInfo(); + android.hardware.wifi.supplicant.KeyMgmtMask getKeyMgmtCapabilities(); + byte[] getMacAddress(); + String getName(); + @PropagateAllowBlocking android.hardware.wifi.supplicant.ISupplicantStaNetwork getNetwork(in int id); + android.hardware.wifi.supplicant.IfaceType getType(); + android.hardware.wifi.supplicant.WpaDriverCapabilitiesMask getWpaDriverCapabilities(); + void initiateAnqpQuery(in byte[] macAddress, in android.hardware.wifi.supplicant.AnqpInfoId[] infoElements, in android.hardware.wifi.supplicant.Hs20AnqpSubtypes[] subTypes); + void initiateHs20IconQuery(in byte[] macAddress, in String fileName); + void initiateTdlsDiscover(in byte[] macAddress); + void initiateTdlsSetup(in byte[] macAddress); + void initiateTdlsTeardown(in byte[] macAddress); + void initiateVenueUrlAnqpQuery(in byte[] macAddress); + int[] listNetworks(); + void reassociate(); + void reconnect(); + void registerCallback(in android.hardware.wifi.supplicant.ISupplicantStaIfaceCallback callback); + void setQosPolicyFeatureEnabled(in boolean enable); + void sendQosPolicyResponse(in int qosPolicyRequestId, in boolean morePolicies, in android.hardware.wifi.supplicant.QosPolicyStatus[] qosPolicyStatusList); + void removeAllQosPolicies(); + void removeDppUri(in int id); + void removeExtRadioWork(in int id); + void removeNetwork(in int id); + void removeRxFilter(in android.hardware.wifi.supplicant.RxFilterType type); + void setBtCoexistenceMode(in android.hardware.wifi.supplicant.BtCoexistenceMode mode); + void setBtCoexistenceScanModeEnabled(in boolean enable); + void setCountryCode(in byte[] code); + void setExternalSim(in boolean useExternalSim); + void setMboCellularDataStatus(in boolean available); + void setPowerSave(in boolean enable); + void setSuspendModeEnabled(in boolean enable); + void setWpsConfigMethods(in android.hardware.wifi.supplicant.WpsConfigMethods configMethods); + void setWpsDeviceName(in String name); + void setWpsDeviceType(in byte[] type); + void setWpsManufacturer(in String manufacturer); + void setWpsModelName(in String modelName); + void setWpsModelNumber(in String modelNumber); + void setWpsSerialNumber(in String serialNumber); + byte[] startDppConfiguratorInitiator(in int peerBootstrapId, in int ownBootstrapId, in String ssid, in String password, in String psk, in android.hardware.wifi.supplicant.DppNetRole netRole, in android.hardware.wifi.supplicant.DppAkm securityAkm, in byte[] privEcKey); + void startDppEnrolleeInitiator(in int peerBootstrapId, in int ownBootstrapId); + void startDppEnrolleeResponder(in int listenChannel); + void startRxFilter(); + void startWpsPbc(in byte[] bssid); + String startWpsPinDisplay(in byte[] bssid); + void startWpsPinKeypad(in String pin); + void startWpsRegistrar(in byte[] bssid, in String pin); + void stopDppInitiator(); + void stopDppResponder(in int ownBootstrapId); + void stopRxFilter(); + android.hardware.wifi.supplicant.SignalPollResult[] getSignalPollResults(); + android.hardware.wifi.supplicant.QosPolicyScsRequestStatus[] addQosPolicyRequestForScs(in android.hardware.wifi.supplicant.QosPolicyScsData[] qosPolicyData); + android.hardware.wifi.supplicant.QosPolicyScsRequestStatus[] removeQosPolicyForScs(in byte[] scsPolicyIds); + const int MAX_POLICIES_PER_QOS_SCS_REQUEST = 16; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl new file mode 100644 index 0000000000..1c232237ea --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +interface ISupplicantStaIfaceCallback { + oneway void onAnqpQueryDone(in byte[] bssid, in android.hardware.wifi.supplicant.AnqpData data, in android.hardware.wifi.supplicant.Hs20AnqpData hs20Data); + oneway void onAssociationRejected(in android.hardware.wifi.supplicant.AssociationRejectionData assocRejectData); + oneway void onAuthenticationTimeout(in byte[] bssid); + oneway void onAuxiliarySupplicantEvent(in android.hardware.wifi.supplicant.AuxiliarySupplicantEventCode eventCode, in byte[] bssid, in String reasonString); + oneway void onBssTmHandlingDone(in android.hardware.wifi.supplicant.BssTmData tmData); + oneway void onBssidChanged(in android.hardware.wifi.supplicant.BssidChangeReason reason, in byte[] bssid); + oneway void onDisconnected(in byte[] bssid, in boolean locallyGenerated, in android.hardware.wifi.supplicant.StaIfaceReasonCode reasonCode); + oneway void onDppFailure(in android.hardware.wifi.supplicant.DppFailureCode code, in String ssid, in String channelList, in char[] bandList); + oneway void onDppProgress(in android.hardware.wifi.supplicant.DppProgressCode code); + oneway void onDppSuccess(in android.hardware.wifi.supplicant.DppEventType event); + /** + * @deprecated This callback is deprecated from AIDL v2, newer HAL should call onDppConfigReceived. + */ + oneway void onDppSuccessConfigReceived(in byte[] ssid, in String password, in byte[] psk, in android.hardware.wifi.supplicant.DppAkm securityAkm, in android.hardware.wifi.supplicant.DppConnectionKeys dppConnectionKeys); + oneway void onDppSuccessConfigSent(); + oneway void onEapFailure(in byte[] bssid, in int errorCode); + oneway void onExtRadioWorkStart(in int id); + oneway void onExtRadioWorkTimeout(in int id); + oneway void onHs20DeauthImminentNotice(in byte[] bssid, in int reasonCode, in int reAuthDelayInSec, in String url); + oneway void onHs20IconQueryDone(in byte[] bssid, in String fileName, in byte[] data); + oneway void onHs20SubscriptionRemediation(in byte[] bssid, in android.hardware.wifi.supplicant.OsuMethod osuMethod, in String url); + oneway void onHs20TermsAndConditionsAcceptanceRequestedNotification(in byte[] bssid, in String url); + oneway void onNetworkAdded(in int id); + oneway void onNetworkNotFound(in byte[] ssid); + oneway void onNetworkRemoved(in int id); + /** + * @deprecated use onPmkSaCacheAdded() instead. + */ + oneway void onPmkCacheAdded(in long expirationTimeInSec, in byte[] serializedEntry); + /** + * @deprecated This callback is deprecated from AIDL v2, newer HAL should call onSupplicantStateChanged() + */ + oneway void onStateChanged(in android.hardware.wifi.supplicant.StaIfaceCallbackState newState, in byte[] bssid, in int id, in byte[] ssid, in boolean filsHlpSent); + oneway void onWpsEventFail(in byte[] bssid, in android.hardware.wifi.supplicant.WpsConfigError configError, in android.hardware.wifi.supplicant.WpsErrorIndication errorInd); + oneway void onWpsEventPbcOverlap(); + oneway void onWpsEventSuccess(); + oneway void onQosPolicyReset(); + oneway void onQosPolicyRequest(in int qosPolicyRequestId, in android.hardware.wifi.supplicant.QosPolicyData[] qosPolicyData); + oneway void onMloLinksInfoChanged(in android.hardware.wifi.supplicant.ISupplicantStaIfaceCallback.MloLinkInfoChangeReason reason); + oneway void onDppConfigReceived(in android.hardware.wifi.supplicant.DppConfigurationData configData); + oneway void onDppConnectionStatusResultSent(in android.hardware.wifi.supplicant.DppStatusErrorCode code); + oneway void onBssFrequencyChanged(in int frequencyMhz); + oneway void onSupplicantStateChanged(in android.hardware.wifi.supplicant.SupplicantStateChangeData stateChangeData); + oneway void onQosPolicyResponseForScs(in android.hardware.wifi.supplicant.QosPolicyScsResponseStatus[] qosPolicyScsResponseStatus); + oneway void onPmkSaCacheAdded(in android.hardware.wifi.supplicant.PmkSaCacheData pmkSaData); + @Backing(type="int") @VintfStability + enum MloLinkInfoChangeReason { + TID_TO_LINK_MAP = 0, + MULTI_LINK_RECONFIG_AP_REMOVAL = 1, + } +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl new file mode 100644 index 0000000000..bfc05a4ad8 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantStaNetwork.aidl @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +interface ISupplicantStaNetwork { + void disable(); + void enable(in boolean noConnect); + void enableSaePkOnlyMode(in boolean enable); + void enableSuiteBEapOpenSslCiphers(); + void enableTlsSuiteBEapPhase1Param(in boolean enable); + android.hardware.wifi.supplicant.AuthAlgMask getAuthAlg(); + byte[] getBssid(); + String getEapAltSubjectMatch(); + byte[] getEapAnonymousIdentity(); + String getEapCACert(); + String getEapCAPath(); + String getEapClientCert(); + String getEapDomainSuffixMatch(); + boolean getEapEngine(); + String getEapEngineId(); + byte[] getEapIdentity(); + android.hardware.wifi.supplicant.EapMethod getEapMethod(); + byte[] getEapPassword(); + android.hardware.wifi.supplicant.EapPhase2Method getEapPhase2Method(); + String getEapPrivateKeyId(); + String getEapSubjectMatch(); + boolean getEdmg(); + android.hardware.wifi.supplicant.GroupCipherMask getGroupCipher(); + android.hardware.wifi.supplicant.GroupMgmtCipherMask getGroupMgmtCipher(); + int getId(); + String getIdStr(); + String getInterfaceName(); + android.hardware.wifi.supplicant.KeyMgmtMask getKeyMgmt(); + android.hardware.wifi.supplicant.OcspType getOcsp(); + android.hardware.wifi.supplicant.PairwiseCipherMask getPairwiseCipher(); + android.hardware.wifi.supplicant.ProtoMask getProto(); + byte[] getPsk(); + String getPskPassphrase(); + boolean getRequirePmf(); + String getSaePassword(); + String getSaePasswordId(); + boolean getScanSsid(); + byte[] getSsid(); + android.hardware.wifi.supplicant.IfaceType getType(); + String getWapiCertSuite(); + byte[] getWepKey(in int keyIdx); + int getWepTxKeyIdx(); + byte[] getWpsNfcConfigurationToken(); + void registerCallback(in android.hardware.wifi.supplicant.ISupplicantStaNetworkCallback callback); + void select(); + void sendNetworkEapIdentityResponse(in byte[] identity, in byte[] encryptedIdentity); + void sendNetworkEapSimGsmAuthFailure(); + void sendNetworkEapSimGsmAuthResponse(in android.hardware.wifi.supplicant.NetworkResponseEapSimGsmAuthParams[] params); + void sendNetworkEapSimUmtsAuthFailure(); + void sendNetworkEapSimUmtsAuthResponse(in android.hardware.wifi.supplicant.NetworkResponseEapSimUmtsAuthParams params); + void sendNetworkEapSimUmtsAutsResponse(in byte[] auts); + void setAuthAlg(in android.hardware.wifi.supplicant.AuthAlgMask authAlgMask); + void setBssid(in byte[] bssid); + void setDppKeys(in android.hardware.wifi.supplicant.DppConnectionKeys keys); + void setEapAltSubjectMatch(in String match); + void setEapAnonymousIdentity(in byte[] identity); + void setEapCACert(in String path); + void setEapCAPath(in String path); + void setEapClientCert(in String path); + void setEapDomainSuffixMatch(in String match); + void setEapEncryptedImsiIdentity(in byte[] identity); + void setEapEngine(in boolean enable); + void setEapEngineID(in String id); + void setEapErp(in boolean enable); + void setEapIdentity(in byte[] identity); + void setEapMethod(in android.hardware.wifi.supplicant.EapMethod method); + void setEapPassword(in byte[] password); + void setEapPhase2Method(in android.hardware.wifi.supplicant.EapPhase2Method method); + void setEapPrivateKeyId(in String id); + void setEapSubjectMatch(in String match); + void setEdmg(in boolean enable); + void setGroupCipher(in android.hardware.wifi.supplicant.GroupCipherMask groupCipherMask); + void setGroupMgmtCipher(in android.hardware.wifi.supplicant.GroupMgmtCipherMask groupMgmtCipherMask); + void setIdStr(in String idStr); + void setKeyMgmt(in android.hardware.wifi.supplicant.KeyMgmtMask keyMgmtMask); + void setOcsp(in android.hardware.wifi.supplicant.OcspType ocspType); + void setPairwiseCipher(in android.hardware.wifi.supplicant.PairwiseCipherMask pairwiseCipherMask); + void setPmkCache(in byte[] serializedEntry); + void setProactiveKeyCaching(in boolean enable); + void setProto(in android.hardware.wifi.supplicant.ProtoMask protoMask); + void setPsk(in byte[] psk); + void setPskPassphrase(in String psk); + void setRequirePmf(in boolean enable); + void setSaeH2eMode(in android.hardware.wifi.supplicant.SaeH2eMode mode); + void setSaePassword(in String saePassword); + void setSaePasswordId(in String saePasswordId); + void setScanSsid(in boolean enable); + void setSsid(in byte[] ssid); + void setUpdateIdentifier(in int id); + void setWapiCertSuite(in String suite); + void setWepKey(in int keyIdx, in byte[] wepKey); + void setWepTxKeyIdx(in int keyIdx); + void setRoamingConsortiumSelection(in byte[] selectedRcoi); + void setMinimumTlsVersionEapPhase1Param(android.hardware.wifi.supplicant.TlsVersion tlsVersion); + void setStrictConservativePeerMode(in boolean enable); + const int SSID_MAX_LEN_IN_BYTES = 32; + const int PSK_PASSPHRASE_MIN_LEN_IN_BYTES = 8; + const int PSK_PASSPHRASE_MAX_LEN_IN_BYTES = 63; + const int WEP_KEYS_MAX_NUM = 4; + const int WEP40_KEY_LEN_IN_BYTES = 5; + const int WEP104_KEY_LEN_IN_BYTES = 13; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantStaNetworkCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantStaNetworkCallback.aidl new file mode 100644 index 0000000000..f9a078be4d --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ISupplicantStaNetworkCallback.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +interface ISupplicantStaNetworkCallback { + oneway void onNetworkEapIdentityRequest(); + oneway void onNetworkEapSimGsmAuthRequest(in android.hardware.wifi.supplicant.NetworkRequestEapSimGsmAuthParams params); + oneway void onNetworkEapSimUmtsAuthRequest(in android.hardware.wifi.supplicant.NetworkRequestEapSimUmtsAuthParams params); + oneway void onTransitionDisable(in android.hardware.wifi.supplicant.TransitionDisableIndication ind); + oneway void onServerCertificateAvailable(in int depth, in byte[] subject, in byte[] certHash, in byte[] certBlob); + oneway void onPermanentIdReqDenied(); +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/IfaceInfo.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/IfaceInfo.aidl new file mode 100644 index 0000000000..6706c8c6ef --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/IfaceInfo.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable IfaceInfo { + android.hardware.wifi.supplicant.IfaceType type; + String name; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/IfaceType.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/IfaceType.aidl new file mode 100644 index 0000000000..e11c2f7ec6 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/IfaceType.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum IfaceType { + STA, + P2P, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/IpVersion.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/IpVersion.aidl new file mode 100644 index 0000000000..958031437c --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/IpVersion.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@Backing(type="byte") @VintfStability +enum IpVersion { + VERSION_4, + VERSION_6, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/KeyMgmtMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/KeyMgmtMask.aidl new file mode 100644 index 0000000000..35d51bc566 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/KeyMgmtMask.aidl @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum KeyMgmtMask { + WPA_EAP = (1 << 0) /* 1 */, + WPA_PSK = (1 << 1) /* 2 */, + NONE = (1 << 2) /* 4 */, + IEEE8021X = (1 << 3) /* 8 */, + FT_EAP = (1 << 5) /* 32 */, + FT_PSK = (1 << 6) /* 64 */, + OSEN = (1 << 15) /* 32768 */, + WPA_EAP_SHA256 = (1 << 7) /* 128 */, + WPA_PSK_SHA256 = (1 << 8) /* 256 */, + SAE = (1 << 10) /* 1024 */, + SUITE_B_192 = (1 << 17) /* 131072 */, + OWE = (1 << 22) /* 4194304 */, + DPP = (1 << 23) /* 8388608 */, + WAPI_PSK = (1 << 12) /* 4096 */, + WAPI_CERT = (1 << 13) /* 8192 */, + FILS_SHA256 = (1 << 18) /* 262144 */, + FILS_SHA384 = (1 << 19) /* 524288 */, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/LegacyMode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/LegacyMode.aidl new file mode 100644 index 0000000000..6896d75f7f --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/LegacyMode.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum LegacyMode { + UNKNOWN = 0, + A_MODE = 1, + B_MODE = 2, + G_MODE = 3, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MacAddress.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MacAddress.aidl new file mode 100644 index 0000000000..d17930a649 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MacAddress.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable MacAddress { + byte[] data; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MboAssocDisallowedReasonCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MboAssocDisallowedReasonCode.aidl new file mode 100644 index 0000000000..661165d062 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MboAssocDisallowedReasonCode.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="byte") @VintfStability +enum MboAssocDisallowedReasonCode { + RESERVED = 0, + UNSPECIFIED = 1, + MAX_NUM_STA_ASSOCIATED = 2, + AIR_INTERFACE_OVERLOADED = 3, + AUTH_SERVER_OVERLOADED = 4, + INSUFFICIENT_RSSI = 5, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MboCellularDataConnectionPrefValue.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MboCellularDataConnectionPrefValue.aidl new file mode 100644 index 0000000000..c4024d097b --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MboCellularDataConnectionPrefValue.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum MboCellularDataConnectionPrefValue { + EXCLUDED = 0, + NOT_PREFERRED = 1, + PREFERRED = 255, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MboTransitionReasonCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MboTransitionReasonCode.aidl new file mode 100644 index 0000000000..caed0950ee --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MboTransitionReasonCode.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="byte") @VintfStability +enum MboTransitionReasonCode { + UNSPECIFIED = 0, + EXCESSIVE_FRAME_LOSS = 1, + EXCESSIVE_TRAFFIC_DELAY = 2, + INSUFFICIENT_BANDWIDTH = 3, + LOAD_BALANCING = 4, + LOW_RSSI = 5, + RX_EXCESSIVE_RETRIES = 6, + HIGH_INTERFERENCE = 7, + GRAY_ZONE = 8, + TRANSITION_TO_PREMIUM_AP = 9, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MiracastMode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MiracastMode.aidl new file mode 100644 index 0000000000..6bc9e4d629 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MiracastMode.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="byte") @VintfStability +enum MiracastMode { + DISABLED = 0, + SOURCE = 1, + SINK = 2, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MloLink.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MloLink.aidl new file mode 100644 index 0000000000..8bda3242b3 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MloLink.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable MloLink { + byte linkId; + byte[] staLinkMacAddress; + byte tidsUplinkMap; + byte tidsDownlinkMap; + @nullable byte[6] apLinkMacAddress; + int frequencyMHz; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MloLinksInfo.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MloLinksInfo.aidl new file mode 100644 index 0000000000..3dac2d6694 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/MloLinksInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable MloLinksInfo { + android.hardware.wifi.supplicant.MloLink[] links; + int apMloLinkId; + @nullable byte[6] apMldMacAddress; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/NetworkRequestEapSimGsmAuthParams.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/NetworkRequestEapSimGsmAuthParams.aidl new file mode 100644 index 0000000000..1f03bb84c7 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/NetworkRequestEapSimGsmAuthParams.aidl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable NetworkRequestEapSimGsmAuthParams { + android.hardware.wifi.supplicant.GsmRand[] rands; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/NetworkRequestEapSimUmtsAuthParams.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/NetworkRequestEapSimUmtsAuthParams.aidl new file mode 100644 index 0000000000..956a799b7d --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/NetworkRequestEapSimUmtsAuthParams.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable NetworkRequestEapSimUmtsAuthParams { + byte[] rand; + byte[] autn; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/NetworkResponseEapSimGsmAuthParams.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/NetworkResponseEapSimGsmAuthParams.aidl new file mode 100644 index 0000000000..29415b739d --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/NetworkResponseEapSimGsmAuthParams.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable NetworkResponseEapSimGsmAuthParams { + byte[] kc; + byte[] sres; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/NetworkResponseEapSimUmtsAuthParams.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/NetworkResponseEapSimUmtsAuthParams.aidl new file mode 100644 index 0000000000..4e58dd8261 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/NetworkResponseEapSimUmtsAuthParams.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable NetworkResponseEapSimUmtsAuthParams { + byte[] res; + byte[] ik; + byte[] ck; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/OceRssiBasedAssocRejectAttr.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/OceRssiBasedAssocRejectAttr.aidl new file mode 100644 index 0000000000..95a95bc543 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/OceRssiBasedAssocRejectAttr.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable OceRssiBasedAssocRejectAttr { + int deltaRssi; + int retryDelayS; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/OcspType.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/OcspType.aidl new file mode 100644 index 0000000000..d5ed084537 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/OcspType.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum OcspType { + NONE, + REQUEST_CERT_STATUS, + REQUIRE_CERT_STATUS, + REQUIRE_ALL_CERTS_STATUS, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/OsuMethod.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/OsuMethod.aidl new file mode 100644 index 0000000000..1b99e2f157 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/OsuMethod.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="byte") @VintfStability +enum OsuMethod { + OMA_DM = 0, + SOAP_XML_SPP = 1, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pClientEapolIpAddressInfo.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pClientEapolIpAddressInfo.aidl new file mode 100644 index 0000000000..db31ca1d48 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pClientEapolIpAddressInfo.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable P2pClientEapolIpAddressInfo { + int ipAddressClient; + int ipAddressMask; + int ipAddressGo; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pFrameTypeMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pFrameTypeMask.aidl new file mode 100644 index 0000000000..3c6f8ed5ed --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pFrameTypeMask.aidl @@ -0,0 +1,50 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum P2pFrameTypeMask { + P2P_FRAME_PROBE_REQ_P2P = (1 << 0) /* 1 */, + P2P_FRAME_PROBE_RESP_P2P = (1 << 1) /* 2 */, + P2P_FRAME_PROBE_RESP_P2P_GO = (1 << 2) /* 4 */, + P2P_FRAME_BEACON_P2P_GO = (1 << 3) /* 8 */, + P2P_FRAME_P2P_PD_REQ = (1 << 4) /* 16 */, + P2P_FRAME_P2P_PD_RESP = (1 << 5) /* 32 */, + P2P_FRAME_P2P_GO_NEG_REQ = (1 << 6) /* 64 */, + P2P_FRAME_P2P_GO_NEG_RESP = (1 << 7) /* 128 */, + P2P_FRAME_P2P_GO_NEG_CONF = (1 << 8) /* 256 */, + P2P_FRAME_P2P_INV_REQ = (1 << 9) /* 512 */, + P2P_FRAME_P2P_INV_RESP = (1 << 10) /* 1024 */, + P2P_FRAME_P2P_ASSOC_REQ = (1 << 11) /* 2048 */, + P2P_FRAME_P2P_ASSOC_RESP = (1 << 12) /* 4096 */, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pGroupCapabilityMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pGroupCapabilityMask.aidl new file mode 100644 index 0000000000..e47713182e --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pGroupCapabilityMask.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum P2pGroupCapabilityMask { + GROUP_OWNER = (1 << 0) /* 1 */, + PERSISTENT_GROUP = (1 << 1) /* 2 */, + GROUP_LIMIT = (1 << 2) /* 4 */, + INTRA_BSS_DIST = (1 << 3) /* 8 */, + CROSS_CONN = (1 << 4) /* 16 */, + PERSISTENT_RECONN = (1 << 5) /* 32 */, + GROUP_FORMATION = (1 << 6) /* 64 */, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl new file mode 100644 index 0000000000..5465a86b13 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl @@ -0,0 +1,48 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable P2pGroupStartedEventParams { + String groupInterfaceName; + boolean isGroupOwner; + byte[] ssid; + int frequencyMHz; + byte[] psk; + String passphrase; + boolean isPersistent; + byte[6] goDeviceAddress; + byte[6] goInterfaceAddress; + boolean isP2pClientEapolIpAddressInfoPresent; + android.hardware.wifi.supplicant.P2pClientEapolIpAddressInfo p2pClientIpInfo; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pProvDiscStatusCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pProvDiscStatusCode.aidl new file mode 100644 index 0000000000..c8e53b93c1 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pProvDiscStatusCode.aidl @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="byte") @VintfStability +enum P2pProvDiscStatusCode { + SUCCESS = 0, + TIMEOUT = 1, + REJECTED = 2, + TIMEOUT_JOIN = 3, + INFO_UNAVAILABLE = 4, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pStatusCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pStatusCode.aidl new file mode 100644 index 0000000000..c7ad3832c7 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/P2pStatusCode.aidl @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum P2pStatusCode { + SUCCESS = 0, + FAIL_INFO_CURRENTLY_UNAVAILABLE = 1, + FAIL_INCOMPATIBLE_PARAMS = 2, + FAIL_LIMIT_REACHED = 3, + FAIL_INVALID_PARAMS = 4, + FAIL_UNABLE_TO_ACCOMMODATE = 5, + FAIL_PREV_PROTOCOL_ERROR = 6, + FAIL_NO_COMMON_CHANNELS = 7, + FAIL_UNKNOWN_GROUP = 8, + FAIL_BOTH_GO_INTENT_15 = 9, + FAIL_INCOMPATIBLE_PROV_METHOD = 10, + FAIL_REJECTED_BY_USER = 11, + SUCCESS_DEFERRED = 12, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/PairwiseCipherMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/PairwiseCipherMask.aidl new file mode 100644 index 0000000000..a4c7b6065b --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/PairwiseCipherMask.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum PairwiseCipherMask { + NONE = (1 << 0) /* 1 */, + TKIP = (1 << 3) /* 8 */, + CCMP = (1 << 4) /* 16 */, + GCMP_128 = (1 << 6) /* 64 */, + SMS4 = (1 << 7) /* 128 */, + GCMP_256 = (1 << 8) /* 256 */, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/PmkSaCacheData.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/PmkSaCacheData.aidl new file mode 100644 index 0000000000..c31b16756c --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/PmkSaCacheData.aidl @@ -0,0 +1,40 @@ +/* + * 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable PmkSaCacheData { + byte[6] bssid; + long expirationTimeInSec; + byte[] serializedEntry; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/PortRange.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/PortRange.aidl new file mode 100644 index 0000000000..b2004f242b --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/PortRange.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable PortRange { + int startPort; + int endPort; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ProtoMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ProtoMask.aidl new file mode 100644 index 0000000000..ba79025fa1 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ProtoMask.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum ProtoMask { + WPA = (1 << 0) /* 1 */, + RSN = (1 << 1) /* 2 */, + WAPI = (1 << 2) /* 4 */, + OSEN = (1 << 3) /* 8 */, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ProtocolNextHeader.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ProtocolNextHeader.aidl new file mode 100644 index 0000000000..8fb91d0511 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/ProtocolNextHeader.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@Backing(type="byte") @VintfStability +enum ProtocolNextHeader { + TCP = 6, + UDP = 17, + ESP = 50, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyClassifierParams.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyClassifierParams.aidl new file mode 100644 index 0000000000..156d57ac0c --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyClassifierParams.aidl @@ -0,0 +1,47 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable QosPolicyClassifierParams { + android.hardware.wifi.supplicant.IpVersion ipVersion; + android.hardware.wifi.supplicant.QosPolicyClassifierParamsMask classifierParamMask; + byte[] srcIp; + byte[] dstIp; + int srcPort; + android.hardware.wifi.supplicant.PortRange dstPortRange; + android.hardware.wifi.supplicant.ProtocolNextHeader protocolNextHdr; + byte[] flowLabelIpv6; + String domainName; + byte dscp; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyClassifierParamsMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyClassifierParamsMask.aidl new file mode 100644 index 0000000000..fda5e3ef67 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyClassifierParamsMask.aidl @@ -0,0 +1,45 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum QosPolicyClassifierParamsMask { + SRC_IP = (1 << 0) /* 1 */, + DST_IP = (1 << 1) /* 2 */, + SRC_PORT = (1 << 2) /* 4 */, + DST_PORT_RANGE = (1 << 3) /* 8 */, + PROTOCOL_NEXT_HEADER = (1 << 4) /* 16 */, + FLOW_LABEL = (1 << 5) /* 32 */, + DOMAIN_NAME = (1 << 6) /* 64 */, + DSCP = (1 << 7) /* 128 */, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyData.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyData.aidl new file mode 100644 index 0000000000..1719565a81 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyData.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable QosPolicyData { + byte policyId; + android.hardware.wifi.supplicant.QosPolicyRequestType requestType; + byte dscp; + android.hardware.wifi.supplicant.QosPolicyClassifierParams classifierParams; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyRequestType.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyRequestType.aidl new file mode 100644 index 0000000000..fd4e787d9e --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyRequestType.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@Backing(type="byte") @VintfStability +enum QosPolicyRequestType { + QOS_POLICY_ADD, + QOS_POLICY_REMOVE, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyScsData.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyScsData.aidl new file mode 100644 index 0000000000..4e5e8ae961 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyScsData.aidl @@ -0,0 +1,25 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable QosPolicyScsData { + byte policyId; + byte userPriority; + android.hardware.wifi.supplicant.QosPolicyClassifierParams classifierParams; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyScsRequestStatus.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyScsRequestStatus.aidl new file mode 100644 index 0000000000..d5573af593 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyScsRequestStatus.aidl @@ -0,0 +1,24 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable QosPolicyScsRequestStatus { + byte policyId; + android.hardware.wifi.supplicant.QosPolicyScsRequestStatusCode qosPolicyScsRequestStatusCode; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyScsRequestStatusCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyScsRequestStatusCode.aidl new file mode 100644 index 0000000000..8e0467f75a --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyScsRequestStatusCode.aidl @@ -0,0 +1,26 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum QosPolicyScsRequestStatusCode { + SENT, + ALREADY_ACTIVE, + NOT_EXIST, + INVALID, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyScsResponseStatus.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyScsResponseStatus.aidl new file mode 100644 index 0000000000..2737f1a5a8 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyScsResponseStatus.aidl @@ -0,0 +1,24 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable QosPolicyScsResponseStatus { + byte policyId; + android.hardware.wifi.supplicant.QosPolicyScsResponseStatusCode qosPolicyScsResponseStatusCode; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyScsResponseStatusCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyScsResponseStatusCode.aidl new file mode 100644 index 0000000000..5d460c69c5 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyScsResponseStatusCode.aidl @@ -0,0 +1,31 @@ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum QosPolicyScsResponseStatusCode { + SUCCESS, + TCLAS_REQUEST_DECLINED, + TCLAS_NOT_SUPPORTED_BY_AP, + TCLAS_INSUFFICIENT_RESOURCES, + TCLAS_RESOURCES_EXHAUSTED, + TCLAS_PROCESSING_TERMINATED_INSUFFICIENT_QOS, + TCLAS_PROCESSING_TERMINATED_POLICY_CONFLICT, + TCLAS_PROCESSING_TERMINATED, + TIMEOUT, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyStatus.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyStatus.aidl new file mode 100644 index 0000000000..61278c5fe5 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyStatus.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable QosPolicyStatus { + byte policyId; + android.hardware.wifi.supplicant.QosPolicyStatusCode status; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyStatusCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyStatusCode.aidl new file mode 100644 index 0000000000..92286325c8 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/QosPolicyStatusCode.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@Backing(type="byte") @VintfStability +enum QosPolicyStatusCode { + QOS_POLICY_SUCCESS, + QOS_POLICY_REQUEST_DECLINED, + QOS_POLICY_CLASSIFIER_NOT_SUPPORTED, + QOS_POLICY_INSUFFICIENT_RESOURCES, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/RxFilterType.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/RxFilterType.aidl new file mode 100644 index 0000000000..63f5bf2c45 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/RxFilterType.aidl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="byte") @VintfStability +enum RxFilterType { + V4_MULTICAST = 0, + V6_MULTICAST = 1, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/SaeH2eMode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/SaeH2eMode.aidl new file mode 100644 index 0000000000..4730d72c04 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/SaeH2eMode.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="byte") @VintfStability +enum SaeH2eMode { + DISABLED, + H2E_OPTIONAL, + H2E_MANDATORY, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/SignalPollResult.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/SignalPollResult.aidl new file mode 100644 index 0000000000..52d3f2447d --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/SignalPollResult.aidl @@ -0,0 +1,42 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable SignalPollResult { + int linkId; + int currentRssiDbm; + int txBitrateMbps; + int rxBitrateMbps; + int frequencyMhz; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/StaIfaceCallbackState.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/StaIfaceCallbackState.aidl new file mode 100644 index 0000000000..d78cfa2f28 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/StaIfaceCallbackState.aidl @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum StaIfaceCallbackState { + DISCONNECTED = 0, + IFACE_DISABLED = 1, + INACTIVE = 2, + SCANNING = 3, + AUTHENTICATING = 4, + ASSOCIATING = 5, + ASSOCIATED = 6, + FOURWAY_HANDSHAKE = 7, + GROUP_HANDSHAKE = 8, + COMPLETED = 9, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/StaIfaceReasonCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/StaIfaceReasonCode.aidl new file mode 100644 index 0000000000..f26e7c5393 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/StaIfaceReasonCode.aidl @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum StaIfaceReasonCode { + UNSPECIFIED = 1, + PREV_AUTH_NOT_VALID = 2, + DEAUTH_LEAVING = 3, + DISASSOC_DUE_TO_INACTIVITY = 4, + DISASSOC_AP_BUSY = 5, + CLASS2_FRAME_FROM_NONAUTH_STA = 6, + CLASS3_FRAME_FROM_NONASSOC_STA = 7, + DISASSOC_STA_HAS_LEFT = 8, + STA_REQ_ASSOC_WITHOUT_AUTH = 9, + PWR_CAPABILITY_NOT_VALID = 10, + SUPPORTED_CHANNEL_NOT_VALID = 11, + BSS_TRANSITION_DISASSOC = 12, + INVALID_IE = 13, + MICHAEL_MIC_FAILURE = 14, + FOURWAY_HANDSHAKE_TIMEOUT = 15, + GROUP_KEY_UPDATE_TIMEOUT = 16, + IE_IN_4WAY_DIFFERS = 17, + GROUP_CIPHER_NOT_VALID = 18, + PAIRWISE_CIPHER_NOT_VALID = 19, + AKMP_NOT_VALID = 20, + UNSUPPORTED_RSN_IE_VERSION = 21, + INVALID_RSN_IE_CAPAB = 22, + IEEE_802_1X_AUTH_FAILED = 23, + CIPHER_SUITE_REJECTED = 24, + TDLS_TEARDOWN_UNREACHABLE = 25, + TDLS_TEARDOWN_UNSPECIFIED = 26, + SSP_REQUESTED_DISASSOC = 27, + NO_SSP_ROAMING_AGREEMENT = 28, + BAD_CIPHER_OR_AKM = 29, + NOT_AUTHORIZED_THIS_LOCATION = 30, + SERVICE_CHANGE_PRECLUDES_TS = 31, + UNSPECIFIED_QOS_REASON = 32, + NOT_ENOUGH_BANDWIDTH = 33, + DISASSOC_LOW_ACK = 34, + EXCEEDED_TXOP = 35, + STA_LEAVING = 36, + END_TS_BA_DLS = 37, + UNKNOWN_TS_BA = 38, + TIMEOUT = 39, + PEERKEY_MISMATCH = 45, + AUTHORIZED_ACCESS_LIMIT_REACHED = 46, + EXTERNAL_SERVICE_REQUIREMENTS = 47, + INVALID_FT_ACTION_FRAME_COUNT = 48, + INVALID_PMKID = 49, + INVALID_MDE = 50, + INVALID_FTE = 51, + MESH_PEERING_CANCELLED = 52, + MESH_MAX_PEERS = 53, + MESH_CONFIG_POLICY_VIOLATION = 54, + MESH_CLOSE_RCVD = 55, + MESH_MAX_RETRIES = 56, + MESH_CONFIRM_TIMEOUT = 57, + MESH_INVALID_GTK = 58, + MESH_INCONSISTENT_PARAMS = 59, + MESH_INVALID_SECURITY_CAP = 60, + MESH_PATH_ERROR_NO_PROXY_INFO = 61, + MESH_PATH_ERROR_NO_FORWARDING_INFO = 62, + MESH_PATH_ERROR_DEST_UNREACHABLE = 63, + MAC_ADDRESS_ALREADY_EXISTS_IN_MBSS = 64, + MESH_CHANNEL_SWITCH_REGULATORY_REQ = 65, + MESH_CHANNEL_SWITCH_UNSPECIFIED = 66, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/StaIfaceStatusCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/StaIfaceStatusCode.aidl new file mode 100644 index 0000000000..13529a5be1 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/StaIfaceStatusCode.aidl @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum StaIfaceStatusCode { + SUCCESS = 0, + UNSPECIFIED_FAILURE = 1, + TDLS_WAKEUP_ALTERNATE = 2, + TDLS_WAKEUP_REJECT = 3, + SECURITY_DISABLED = 5, + UNACCEPTABLE_LIFETIME = 6, + NOT_IN_SAME_BSS = 7, + CAPS_UNSUPPORTED = 10, + REASSOC_NO_ASSOC = 11, + ASSOC_DENIED_UNSPEC = 12, + NOT_SUPPORTED_AUTH_ALG = 13, + UNKNOWN_AUTH_TRANSACTION = 14, + CHALLENGE_FAIL = 15, + AUTH_TIMEOUT = 16, + AP_UNABLE_TO_HANDLE_NEW_STA = 17, + ASSOC_DENIED_RATES = 18, + ASSOC_DENIED_NOSHORT = 19, + SPEC_MGMT_REQUIRED = 22, + PWR_CAPABILITY_NOT_VALID = 23, + SUPPORTED_CHANNEL_NOT_VALID = 24, + ASSOC_DENIED_NO_SHORT_SLOT_TIME = 25, + ASSOC_DENIED_NO_HT = 27, + R0KH_UNREACHABLE = 28, + ASSOC_DENIED_NO_PCO = 29, + ASSOC_REJECTED_TEMPORARILY = 30, + ROBUST_MGMT_FRAME_POLICY_VIOLATION = 31, + UNSPECIFIED_QOS_FAILURE = 32, + DENIED_INSUFFICIENT_BANDWIDTH = 33, + DENIED_POOR_CHANNEL_CONDITIONS = 34, + DENIED_QOS_NOT_SUPPORTED = 35, + REQUEST_DECLINED = 37, + INVALID_PARAMETERS = 38, + REJECTED_WITH_SUGGESTED_CHANGES = 39, + INVALID_IE = 40, + GROUP_CIPHER_NOT_VALID = 41, + PAIRWISE_CIPHER_NOT_VALID = 42, + AKMP_NOT_VALID = 43, + UNSUPPORTED_RSN_IE_VERSION = 44, + INVALID_RSN_IE_CAPAB = 45, + CIPHER_REJECTED_PER_POLICY = 46, + TS_NOT_CREATED = 47, + DIRECT_LINK_NOT_ALLOWED = 48, + DEST_STA_NOT_PRESENT = 49, + DEST_STA_NOT_QOS_STA = 50, + ASSOC_DENIED_LISTEN_INT_TOO_LARGE = 51, + INVALID_FT_ACTION_FRAME_COUNT = 52, + INVALID_PMKID = 53, + INVALID_MDIE = 54, + INVALID_FTIE = 55, + REQUESTED_TCLAS_NOT_SUPPORTED = 56, + INSUFFICIENT_TCLAS_PROCESSING_RESOURCES = 57, + TRY_ANOTHER_BSS = 58, + GAS_ADV_PROTO_NOT_SUPPORTED = 59, + NO_OUTSTANDING_GAS_REQ = 60, + GAS_RESP_NOT_RECEIVED = 61, + STA_TIMED_OUT_WAITING_FOR_GAS_RESP = 62, + GAS_RESP_LARGER_THAN_LIMIT = 63, + REQ_REFUSED_HOME = 64, + ADV_SRV_UNREACHABLE = 65, + REQ_REFUSED_SSPN = 67, + REQ_REFUSED_UNAUTH_ACCESS = 68, + INVALID_RSNIE = 72, + U_APSD_COEX_NOT_SUPPORTED = 73, + U_APSD_COEX_MODE_NOT_SUPPORTED = 74, + BAD_INTERVAL_WITH_U_APSD_COEX = 75, + ANTI_CLOGGING_TOKEN_REQ = 76, + FINITE_CYCLIC_GROUP_NOT_SUPPORTED = 77, + CANNOT_FIND_ALT_TBTT = 78, + TRANSMISSION_FAILURE = 79, + REQ_TCLAS_NOT_SUPPORTED = 80, + TCLAS_RESOURCES_EXCHAUSTED = 81, + REJECTED_WITH_SUGGESTED_BSS_TRANSITION = 82, + REJECT_WITH_SCHEDULE = 83, + REJECT_NO_WAKEUP_SPECIFIED = 84, + SUCCESS_POWER_SAVE_MODE = 85, + PENDING_ADMITTING_FST_SESSION = 86, + PERFORMING_FST_NOW = 87, + PENDING_GAP_IN_BA_WINDOW = 88, + REJECT_U_PID_SETTING = 89, + REFUSED_EXTERNAL_REASON = 92, + REFUSED_AP_OUT_OF_MEMORY = 93, + REJECTED_EMERGENCY_SERVICE_NOT_SUPPORTED = 94, + QUERY_RESP_OUTSTANDING = 95, + REJECT_DSE_BAND = 96, + TCLAS_PROCESSING_TERMINATED = 97, + TS_SCHEDULE_CONFLICT = 98, + DENIED_WITH_SUGGESTED_BAND_AND_CHANNEL = 99, + MCCAOP_RESERVATION_CONFLICT = 100, + MAF_LIMIT_EXCEEDED = 101, + MCCA_TRACK_LIMIT_EXCEEDED = 102, + DENIED_DUE_TO_SPECTRUM_MANAGEMENT = 103, + ASSOC_DENIED_NO_VHT = 104, + ENABLEMENT_DENIED = 105, + RESTRICTION_FROM_AUTHORIZED_GDB = 106, + AUTHORIZATION_DEENABLED = 107, + FILS_AUTHENTICATION_FAILURE = 112, + UNKNOWN_AUTHENTICATION_SERVER = 113, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl new file mode 100644 index 0000000000..1d37635a29 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl @@ -0,0 +1,44 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@VintfStability +parcelable SupplicantStateChangeData { + android.hardware.wifi.supplicant.StaIfaceCallbackState newState; + int id; + byte[] ssid; + byte[6] bssid; + android.hardware.wifi.supplicant.KeyMgmtMask keyMgmtMask; + int frequencyMhz; + boolean filsHlpSent; +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/SupplicantStatusCode.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/SupplicantStatusCode.aidl new file mode 100644 index 0000000000..d7ff7982b5 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/SupplicantStatusCode.aidl @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum SupplicantStatusCode { + SUCCESS, + FAILURE_UNKNOWN, + FAILURE_ARGS_INVALID, + FAILURE_IFACE_INVALID, + FAILURE_IFACE_UNKNOWN, + FAILURE_IFACE_EXISTS, + FAILURE_IFACE_DISABLED, + FAILURE_IFACE_NOT_DISCONNECTED, + FAILURE_NETWORK_INVALID, + FAILURE_NETWORK_UNKNOWN, + FAILURE_UNSUPPORTED, + FAILURE_ONGOING_REQUEST, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/TlsVersion.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/TlsVersion.aidl new file mode 100644 index 0000000000..b31826a198 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/TlsVersion.aidl @@ -0,0 +1,41 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum TlsVersion { + TLS_V1_0, + TLS_V1_1, + TLS_V1_2, + TLS_V1_3, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/TransitionDisableIndication.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/TransitionDisableIndication.aidl new file mode 100644 index 0000000000..f1d7370c76 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/TransitionDisableIndication.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum TransitionDisableIndication { + USE_WPA3_PERSONAL = (1 << 0) /* 1 */, + USE_SAE_PK = (1 << 1) /* 2 */, + USE_WPA3_ENTERPRISE = (1 << 2) /* 4 */, + USE_ENHANCED_OPEN = (1 << 3) /* 8 */, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WifiTechnology.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WifiTechnology.aidl new file mode 100644 index 0000000000..bf5081ea70 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WifiTechnology.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum WifiTechnology { + UNKNOWN = 0, + LEGACY = 1, + HT = 2, + VHT = 3, + HE = 4, + EHT = 5, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl new file mode 100644 index 0000000000..330f2aa267 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum WpaDriverCapabilitiesMask { + MBO = (1 << 0) /* 1 */, + OCE = (1 << 1) /* 2 */, + SAE_PK = (1 << 2) /* 4 */, + WFD_R2 = (1 << 3) /* 8 */, + TRUST_ON_FIRST_USE = (1 << 4) /* 16 */, + SET_TLS_MINIMUM_VERSION = (1 << 5) /* 32 */, + TLS_V1_3 = (1 << 6) /* 64 */, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpsConfigError.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpsConfigError.aidl new file mode 100644 index 0000000000..c48b282e35 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpsConfigError.aidl @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum WpsConfigError { + NO_ERROR = 0, + OOB_IFACE_READ_ERROR = 1, + DECRYPTION_CRC_FAILURE = 2, + CHAN_24_NOT_SUPPORTED = 3, + CHAN_50_NOT_SUPPORTED = 4, + SIGNAL_TOO_WEAK = 5, + NETWORK_AUTH_FAILURE = 6, + NETWORK_ASSOC_FAILURE = 7, + NO_DHCP_RESPONSE = 8, + FAILED_DHCP_CONFIG = 9, + IP_ADDR_CONFLICT = 10, + NO_CONN_TO_REGISTRAR = 11, + MULTIPLE_PBC_DETECTED = 12, + ROGUE_SUSPECTED = 13, + DEVICE_BUSY = 14, + SETUP_LOCKED = 15, + MSG_TIMEOUT = 16, + REG_SESS_TIMEOUT = 17, + DEV_PASSWORD_AUTH_FAILURE = 18, + CHAN_60G_NOT_SUPPORTED = 19, + PUBLIC_KEY_HASH_MISMATCH = 20, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpsConfigMethods.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpsConfigMethods.aidl new file mode 100644 index 0000000000..b9ea211bb4 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpsConfigMethods.aidl @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum WpsConfigMethods { + USBA = 0x0001, + ETHERNET = 0x0002, + LABEL = 0x0004, + DISPLAY = 0x0008, + EXT_NFC_TOKEN = 0x0010, + INT_NFC_TOKEN = 0x0020, + NFC_INTERFACE = 0x0040, + PUSHBUTTON = 0x0080, + KEYPAD = 0x0100, + VIRT_PUSHBUTTON = 0x0280, + PHY_PUSHBUTTON = 0x0480, + P2PS = 0x1000, + VIRT_DISPLAY = 0x2008, + PHY_DISPLAY = 0x4008, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpsDevPasswordId.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpsDevPasswordId.aidl new file mode 100644 index 0000000000..9a20187b6e --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpsDevPasswordId.aidl @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum WpsDevPasswordId { + DEFAULT = 0x0000, + USER_SPECIFIED = 0x0001, + MACHINE_SPECIFIED = 0x0002, + REKEY = 0x0003, + PUSHBUTTON = 0x0004, + REGISTRAR_SPECIFIED = 0x0005, + NFC_CONNECTION_HANDOVER = 0x0007, + P2PS_DEFAULT = 0x0008, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpsErrorIndication.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpsErrorIndication.aidl new file mode 100644 index 0000000000..50e69ff03b --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpsErrorIndication.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum WpsErrorIndication { + NO_ERROR = 0, + SECURITY_TKIP_ONLY_PROHIBITED = 1, + SECURITY_WEP_PROHIBITED = 2, + AUTH_FAILURE = 3, +} diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpsProvisionMethod.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpsProvisionMethod.aidl new file mode 100644 index 0000000000..177d218db3 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/2/android/hardware/wifi/supplicant/WpsProvisionMethod.aidl @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2021 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 -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.hardware.wifi.supplicant; +@Backing(type="int") @VintfStability +enum WpsProvisionMethod { + PBC, + DISPLAY, + KEYPAD, +} From 57896d2a1c7f55b302851662175817d257ba2805 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Mon, 10 Apr 2023 23:47:45 +0000 Subject: [PATCH 900/998] Acquire the global lock when the dump method is called. This should prevent a race condition between stop() and dump(). stop() already acquires the global lock when it calls validateAndCall(). Bug: 274641043 Test: adb shell dumpsys wifi # validates dump() Change-Id: Ie2df0861308954cd2e399c9604d4ae0dcddf95fb --- wifi/aidl/default/wifi.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wifi/aidl/default/wifi.cpp b/wifi/aidl/default/wifi.cpp index e30c38abcf..d6a85da198 100644 --- a/wifi/aidl/default/wifi.cpp +++ b/wifi/aidl/default/wifi.cpp @@ -19,6 +19,7 @@ #include #include "aidl_return_util.h" +#include "aidl_sync_util.h" #include "wifi_status_util.h" namespace { @@ -32,6 +33,7 @@ namespace hardware { namespace wifi { using aidl_return_util::validateAndCall; using aidl_return_util::validateAndCallWithLock; +using aidl_sync_util::acquireGlobalLock; Wifi::Wifi(const std::shared_ptr<::android::wifi_system::InterfaceTool> iface_tool, const std::shared_ptr legacy_hal_factory, @@ -78,6 +80,7 @@ ndk::ScopedAStatus Wifi::getChip(int32_t in_chipId, std::shared_ptr* } binder_status_t Wifi::dump(int fd, const char** args, uint32_t numArgs) { + const auto lock = acquireGlobalLock(); LOG(INFO) << "-----------Debug was called----------------"; if (chips_.size() == 0) { LOG(INFO) << "No chips to display."; From ee588b2cd3b4a99218081337350c4749d4907670 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi Date: Mon, 10 Apr 2023 05:58:03 +0000 Subject: [PATCH 901/998] Ignore new tests for IRadioNetwork V2 in devices with V1 Bug: 277537061 Test: atest VtsHalRadioTargetTest:PerInstance/RadioNetworkTest Change-Id: I902c736017bf0f2aad0bd9077ca29f4480293369 --- radio/aidl/vts/radio_network_test.cpp | 72 +++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index 7d9986b2f7..57bd4fb596 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -1871,6 +1871,14 @@ TEST_P(RadioNetworkTest, supplyNetworkDepersonalization) { * Test IRadioNetwork.setEmergencyMode() for the response returned. */ TEST_P(RadioNetworkTest, setEmergencyMode) { + int32_t aidl_version; + ndk::ScopedAStatus aidl_status = radio_network->getInterfaceVersion(&aidl_version); + ASSERT_OK(aidl_status); + if (aidl_version < 2) { + ALOGI("Skipped the test since setEmergencyMode is not supported on version < 2."); + GTEST_SKIP(); + } + LOG(DEBUG) << "setEmergencyMode"; serial = GetRandomSerialNumber(); @@ -1883,6 +1891,11 @@ TEST_P(RadioNetworkTest, setEmergencyMode) { radioRsp_network->rspInfo.error, {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR, RadioError::INVALID_ARGUMENTS})); + + // exit emergency mode for other tests + serial = GetRandomSerialNumber(); + radio_network->exitEmergencyMode(serial); + LOG(DEBUG) << "setEmergencyMode finished"; } @@ -1890,6 +1903,15 @@ TEST_P(RadioNetworkTest, setEmergencyMode) { * Test IRadioNetwork.triggerEmergencyNetworkScan() for the response returned. */ TEST_P(RadioNetworkTest, triggerEmergencyNetworkScan) { + int32_t aidl_version; + ndk::ScopedAStatus aidl_status = radio_network->getInterfaceVersion(&aidl_version); + ASSERT_OK(aidl_status); + if (aidl_version < 2) { + ALOGI("Skipped the test since" + " triggerEmergencyNetworkScan is not supported on version < 2."); + GTEST_SKIP(); + } + LOG(DEBUG) << "triggerEmergencyNetworkScan"; serial = GetRandomSerialNumber(); @@ -1913,6 +1935,14 @@ TEST_P(RadioNetworkTest, triggerEmergencyNetworkScan) { * Test IRadioNetwork.cancelEmergencyNetworkScan() for the response returned. */ TEST_P(RadioNetworkTest, cancelEmergencyNetworkScan) { + int32_t aidl_version; + ndk::ScopedAStatus aidl_status = radio_network->getInterfaceVersion(&aidl_version); + ASSERT_OK(aidl_status); + if (aidl_version < 2) { + ALOGI("Skipped the test since cancelEmergencyNetworkScan is not supported on version < 2."); + GTEST_SKIP(); + } + LOG(DEBUG) << "cancelEmergencyNetworkScan"; serial = GetRandomSerialNumber(); @@ -1932,6 +1962,14 @@ TEST_P(RadioNetworkTest, cancelEmergencyNetworkScan) { * Test IRadioNetwork.exitEmergencyMode() for the response returned. */ TEST_P(RadioNetworkTest, exitEmergencyMode) { + int32_t aidl_version; + ndk::ScopedAStatus aidl_status = radio_network->getInterfaceVersion(&aidl_version); + ASSERT_OK(aidl_status); + if (aidl_version < 2) { + ALOGI("Skipped the test since exitEmergencyMode is not supported on version < 2."); + GTEST_SKIP(); + } + LOG(DEBUG) << "exitEmergencyMode"; serial = GetRandomSerialNumber(); @@ -1951,6 +1989,14 @@ TEST_P(RadioNetworkTest, exitEmergencyMode) { * Test IRadioNetwork.setN1ModeEnabled() for the response returned. */ TEST_P(RadioNetworkTest, setN1ModeEnabled) { + int32_t aidl_version; + ndk::ScopedAStatus aidl_status = radio_network->getInterfaceVersion(&aidl_version); + ASSERT_OK(aidl_status); + if (aidl_version < 2) { + ALOGI("Skipped the test since setN1ModeEnabled is not supported on version < 2."); + GTEST_SKIP(); + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = @@ -1975,6 +2021,14 @@ TEST_P(RadioNetworkTest, setN1ModeEnabled) { * Test IRadioNetwork.isN1ModeEnabled() for the response returned. */ TEST_P(RadioNetworkTest, isN1ModeEnabled) { + int32_t aidl_version; + ndk::ScopedAStatus aidl_status = radio_network->getInterfaceVersion(&aidl_version); + ASSERT_OK(aidl_status); + if (aidl_version < 2) { + ALOGI("Skipped the test since isN1ModeEnabled is not supported on version < 2."); + GTEST_SKIP(); + } + serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = radio_network->isN1ModeEnabled(serial); @@ -1998,6 +2052,15 @@ TEST_P(RadioNetworkTest, isN1ModeEnabled) { * Test IRadioNetwork.setNullCipherAndIntegrityEnabled() for the response returned. */ TEST_P(RadioNetworkTest, setNullCipherAndIntegrityEnabled) { + int32_t aidl_version; + ndk::ScopedAStatus aidl_status = radio_network->getInterfaceVersion(&aidl_version); + ASSERT_OK(aidl_status); + if (aidl_version < 2) { + ALOGI("Skipped the test since" + " setNullCipherAndIntegrityEnabled is not supported on version < 2."); + GTEST_SKIP(); + } + LOG(DEBUG) << "setNullCipherAndIntegrityEnabled"; serial = GetRandomSerialNumber(); @@ -2016,6 +2079,15 @@ TEST_P(RadioNetworkTest, setNullCipherAndIntegrityEnabled) { * Test IRadioNetwork.isNullCipherAndIntegrityEnabled() for the response returned. */ TEST_P(RadioNetworkTest, isNullCipherAndIntegrityEnabled) { + int32_t aidl_version; + ndk::ScopedAStatus aidl_status = radio_network->getInterfaceVersion(&aidl_version); + ASSERT_OK(aidl_status); + if (aidl_version < 2) { + ALOGI("Skipped the test since" + " isNullCipherAndIntegrityEnabled is not supported on version < 2."); + GTEST_SKIP(); + } + LOG(DEBUG) << "isNullCipherAndIntegrityEnabled"; serial = GetRandomSerialNumber(); From 9acf79f7ad00869018566ae9e7023403f71d6bc6 Mon Sep 17 00:00:00 2001 From: Xiao Ma Date: Sat, 25 Mar 2023 11:00:15 +0900 Subject: [PATCH 902/998] Update the setDtimMultiplier aidl API documentation. Update the aidl API documentation to describe how setDtimMultiplier API is supposed to work, i.e. we can call this API to set a maximum DTIM multiplier value to use in driver, any larger value must not be accepted and meanwhile it allows to set a specific multiplier by OEMs. Try to make the description clear and avoid the ambiguity. Bug: 266256943 Test: m Change-Id: Ic7d2284a25e32d1b0752cf2bc832c069f646fcea --- wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl b/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl index 2c81984d40..6d6afafc12 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiStaIface.aidl @@ -534,14 +534,18 @@ interface IWifiStaIface { void stopSendingKeepAlivePackets(in int cmdId); /** - * Set DTIM multiplier used when the system is in the suspended mode. + * Set maximum acceptable DTIM multiplier to hardware driver. + * Any multiplier larger than this maximum value must not be accepted since it will cause + * packet loss higher than what the system can accept, which will cause unexpected behavior + * for apps, and may interrupt the network connection. + * * When STA is in the power saving mode and system is suspended, * the wake up interval will be set to: * 1) multiplier * DTIM period if multiplier > 0. * 2) the driver default value if multiplier <= 0. * Some implementations may apply an additional cap to wake up interval in the case of 1). * - * @param multiplier integer DTIM multiplier value to set. + * @param multiplier integer maximum DTIM multiplier value to set. * @throws ServiceSpecificException with one of the following values: * |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|, * |WifiStatusCode.ERROR_NOT_SUPPORTED|, From 5638a35174ae6f9947736d0e7a780e4598ec8c29 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Mon, 10 Apr 2023 15:28:17 -0700 Subject: [PATCH 903/998] Split BLIND_SPOT_WARNING_STATE into 2 area IDs on emulator Bug: 277359374 Test: atest CtsCarTestCases:CarPropertyManagerTest Change-Id: Ic8ff9757086281c693aee86e4f1c5f8430e02c07 --- .../default_config/config/DefaultProperties.json | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json index ae36290915..84edeeda7c 100644 --- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json +++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json @@ -3705,7 +3705,19 @@ }, "areas": [ { - "areaId": "Constants::MIRROR_DRIVER_LEFT_RIGHT", + "areaId": "VehicleAreaMirror::DRIVER_LEFT", + "supportedEnumValues": [ + "ErrorState::NOT_AVAILABLE_SAFETY", + "ErrorState::NOT_AVAILABLE_POOR_VISIBILITY", + "ErrorState::NOT_AVAILABLE_SPEED_HIGH", + "ErrorState::NOT_AVAILABLE_SPEED_LOW", + "ErrorState::NOT_AVAILABLE_DISABLED", + "BlindSpotWarningState::NO_WARNING", + "BlindSpotWarningState::WARNING" + ] + }, + { + "areaId": "VehicleAreaMirror::DRIVER_RIGHT", "supportedEnumValues": [ "ErrorState::NOT_AVAILABLE_SAFETY", "ErrorState::NOT_AVAILABLE_POOR_VISIBILITY", From eb1c617446f834a062d3f73f0f07baa57676a690 Mon Sep 17 00:00:00 2001 From: Muralidhar Reddy Date: Wed, 12 Apr 2023 12:55:19 +0000 Subject: [PATCH 904/998] Ignore new tests of IRadioSim, IRadioModem V2 in devices with V1 Bug: 270513760 Test: atest VtsHalRadioTargetTest:PerInstance/RadioSimTest, atest VtsHalRadioTargetTest:PerInstance/RadioModemTest Change-Id: Ia981f1f341c6d2ebe3c7ff768505057140c9d718 --- radio/aidl/vts/radio_modem_test.cpp | 7 +++++++ radio/aidl/vts/radio_sim_test.cpp | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/radio/aidl/vts/radio_modem_test.cpp b/radio/aidl/vts/radio_modem_test.cpp index c00b238d8e..3454f33b54 100644 --- a/radio/aidl/vts/radio_modem_test.cpp +++ b/radio/aidl/vts/radio_modem_test.cpp @@ -191,6 +191,13 @@ TEST_P(RadioModemTest, getDeviceIdentity) { * Test IRadioModem.getImei() for the response returned. */ TEST_P(RadioModemTest, getImei) { + int32_t aidl_version; + ndk::ScopedAStatus aidl_status = radio_modem->getInterfaceVersion(&aidl_version); + ASSERT_OK(aidl_status); + if (aidl_version < 2) { + ALOGI("Skipped the test since getImei is not supported on version < 2"); + GTEST_SKIP(); + } LOG(DEBUG) << "getImei"; serial = GetRandomSerialNumber(); diff --git a/radio/aidl/vts/radio_sim_test.cpp b/radio/aidl/vts/radio_sim_test.cpp index 44be258039..f65714229c 100644 --- a/radio/aidl/vts/radio_sim_test.cpp +++ b/radio/aidl/vts/radio_sim_test.cpp @@ -765,6 +765,14 @@ TEST_P(RadioSimTest, iccCloseLogicalChannel) { * Test IRadioSim.iccCloseLogicalChannelWithSessionInfo() for the response returned. */ TEST_P(RadioSimTest, iccCloseLogicalChannelWithSessionInfo) { + int32_t aidl_version; + ndk::ScopedAStatus aidl_status = radio_sim->getInterfaceVersion(&aidl_version); + ASSERT_OK(aidl_status); + if (aidl_version < 2) { + ALOGI("Skipped the test since" + " iccCloseLogicalChannelWithSessionInfo is not supported on version < 2"); + GTEST_SKIP(); + } LOG(DEBUG) << "iccCloseLogicalChannelWithSessionInfo"; serial = GetRandomSerialNumber(); SessionInfo info; From 6cb8689d10900efab12b1fae57427a5c5611327f Mon Sep 17 00:00:00 2001 From: Hao Chen Date: Mon, 10 Apr 2023 15:21:59 -0700 Subject: [PATCH 905/998] AIDL VHAL GRPC Client Bug: 266001013 Test: `atest GRPCVehicleHardwareUnitTest` Change-Id: I89b1c260aa2c34f353e88547a92718bb1cc37e5f --- automotive/vehicle/aidl/impl/grpc/Android.bp | 102 ++++++++ .../aidl/impl/grpc/GRPCVehicleHardware.cpp | 221 ++++++++++++++++++ .../aidl/impl/grpc/GRPCVehicleHardware.h | 100 ++++++++ automotive/vehicle/aidl/impl/grpc/OWNERS | 3 + .../aidl/impl/grpc/proto/VehicleServer.proto | 43 ++++ .../vehicle/aidl/impl/grpc/test/Android.bp | 46 ++++ .../grpc/test/GRPCVehicleHardwareUnitTest.cpp | 94 ++++++++ 7 files changed, 609 insertions(+) create mode 100644 automotive/vehicle/aidl/impl/grpc/Android.bp create mode 100644 automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.cpp create mode 100644 automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.h create mode 100644 automotive/vehicle/aidl/impl/grpc/OWNERS create mode 100644 automotive/vehicle/aidl/impl/grpc/proto/VehicleServer.proto create mode 100644 automotive/vehicle/aidl/impl/grpc/test/Android.bp create mode 100644 automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleHardwareUnitTest.cpp diff --git a/automotive/vehicle/aidl/impl/grpc/Android.bp b/automotive/vehicle/aidl/impl/grpc/Android.bp new file mode 100644 index 0000000000..e8f0970c4d --- /dev/null +++ b/automotive/vehicle/aidl/impl/grpc/Android.bp @@ -0,0 +1,102 @@ +// 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +genrule { + name: "VehicleServerProtoStub_h@default-grpc", + tools: [ + "aprotoc", + "protoc-gen-grpc-cpp-plugin", + ], + cmd: "$(location aprotoc) -I$$(dirname $(in)) -Ihardware/interfaces/automotive/vehicle/aidl/impl/proto -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)", + srcs: [ + "proto/VehicleServer.proto", + ], + out: [ + "VehicleServer.pb.h", + "VehicleServer.grpc.pb.h", + ], + visibility: ["//visibility:private"], +} + +genrule { + name: "VehicleServerProtoStub_cc@default-grpc", + tools: [ + "aprotoc", + "protoc-gen-grpc-cpp-plugin", + ], + cmd: "$(location aprotoc) -I$$(dirname $(in)) -Ihardware/interfaces/automotive/vehicle/aidl/impl/proto -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)", + srcs: [ + "proto/VehicleServer.proto", + ], + out: [ + "VehicleServer.pb.cc", + "VehicleServer.grpc.pb.cc", + ], + visibility: ["//visibility:private"], +} + +cc_library_static { + name: "android.hardware.automotive.vehicle@default-grpc-libgrpc", + vendor: true, + host_supported: true, + include_dirs: [ + "external/protobuf/src", + ], + generated_headers: [ + "VehicleServerProtoStub_h@default-grpc", + ], + export_generated_headers: [ + "VehicleServerProtoStub_h@default-grpc", + ], + generated_sources: [ + "VehicleServerProtoStub_cc@default-grpc", + ], + whole_static_libs: [ + "VehicleHalProtos", + ], + shared_libs: [ + "libgrpc++", + ], + cflags: [ + "-Wno-unused-parameter", + ], +} + +cc_library_static { + name: "android.hardware.automotive.vehicle@default-grpc-hardware-lib", + defaults: ["VehicleHalDefaults"], + vendor: true, + srcs: [ + "GRPCVehicleHardware.cpp", + ], + whole_static_libs: [ + "android.hardware.automotive.vehicle@default-grpc-libgrpc", + "VehicleHalProtoMessageConverter", + ], + header_libs: [ + "IVehicleHardware", + ], + shared_libs: [ + "libgrpc++", + "libprotobuf-cpp-full", + ], + export_include_dirs: ["."], + cflags: [ + "-Wno-unused-parameter", + ], +} diff --git a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.cpp b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.cpp new file mode 100644 index 0000000000..015157d425 --- /dev/null +++ b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.cpp @@ -0,0 +1,221 @@ +/* + * 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. + */ + +#include + +#include "ProtoMessageConverter.h" + +#include +#include + +#include +#include +#include +#include + +namespace android::hardware::automotive::vehicle::virtualization { + +static std::shared_ptr<::grpc::ChannelCredentials> getChannelCredentials() { + // TODO(chenhaosjtuacm): get secured credentials here + return ::grpc::InsecureChannelCredentials(); +} + +GRPCVehicleHardware::GRPCVehicleHardware(std::string service_addr) + : mServiceAddr(std::move(service_addr)), + mGrpcChannel(::grpc::CreateChannel(mServiceAddr, getChannelCredentials())), + mGrpcStub(proto::VehicleServer::NewStub(mGrpcChannel)), + mValuePollingThread([this] { ValuePollingLoop(); }) {} + +GRPCVehicleHardware::~GRPCVehicleHardware() { + { + std::lock_guard lck(mShutdownMutex); + mShuttingDownFlag.store(true); + } + mShutdownCV.notify_all(); + mValuePollingThread.join(); +} + +std::vector GRPCVehicleHardware::getAllPropertyConfigs() const { + std::vector configs; + ::grpc::ClientContext context; + auto config_stream = mGrpcStub->GetAllPropertyConfig(&context, ::google::protobuf::Empty()); + proto::VehiclePropConfig protoConfig; + while (config_stream->Read(&protoConfig)) { + aidlvhal::VehiclePropConfig config; + proto_msg_converter::protoToAidl(protoConfig, &config); + configs.push_back(std::move(config)); + } + auto grpc_status = config_stream->Finish(); + if (!grpc_status.ok()) { + LOG(ERROR) << __func__ + << ": GRPC GetAllPropertyConfig Failed: " << grpc_status.error_message(); + } + return configs; +} + +aidlvhal::StatusCode GRPCVehicleHardware::setValues( + std::shared_ptr callback, + const std::vector& requests) { + ::grpc::ClientContext context; + proto::VehiclePropValueRequests protoRequests; + proto::SetValueResults protoResults; + for (const auto& request : requests) { + auto& protoRequest = *protoRequests.add_requests(); + protoRequest.set_request_id(request.requestId); + proto_msg_converter::aidlToProto(request.value, protoRequest.mutable_value()); + } + // TODO(chenhaosjtuacm): Make it Async. + auto grpc_status = mGrpcStub->SetValues(&context, protoRequests, &protoResults); + if (!grpc_status.ok()) { + LOG(ERROR) << __func__ << ": GRPC SetValues Failed: " << grpc_status.error_message(); + { + std::shared_lock lck(mCallbackMutex); + // TODO(chenhaosjtuacm): call on-set-error callback. + } + return aidlvhal::StatusCode::INTERNAL_ERROR; + } + std::vector results; + for (const auto& protoResult : protoResults.results()) { + auto& result = results.emplace_back(); + result.requestId = protoResult.request_id(); + result.status = static_cast(protoResult.status()); + // TODO(chenhaosjtuacm): call on-set-error callback. + } + (*callback)(std::move(results)); + + return aidlvhal::StatusCode::OK; +} + +aidlvhal::StatusCode GRPCVehicleHardware::getValues( + std::shared_ptr callback, + const std::vector& requests) const { + ::grpc::ClientContext context; + proto::VehiclePropValueRequests protoRequests; + proto::GetValueResults protoResults; + for (const auto& request : requests) { + auto& protoRequest = *protoRequests.add_requests(); + protoRequest.set_request_id(request.requestId); + proto_msg_converter::aidlToProto(request.prop, protoRequest.mutable_value()); + } + // TODO(chenhaosjtuacm): Make it Async. + auto grpc_status = mGrpcStub->GetValues(&context, protoRequests, &protoResults); + if (!grpc_status.ok()) { + LOG(ERROR) << __func__ << ": GRPC GetValues Failed: " << grpc_status.error_message(); + return aidlvhal::StatusCode::INTERNAL_ERROR; + } + std::vector results; + for (const auto& protoResult : protoResults.results()) { + auto& result = results.emplace_back(); + result.requestId = protoResult.request_id(); + result.status = static_cast(protoResult.status()); + if (protoResult.has_value()) { + aidlvhal::VehiclePropValue value; + proto_msg_converter::protoToAidl(protoResult.value(), &value); + result.prop = std::move(value); + } + } + (*callback)(std::move(results)); + + return aidlvhal::StatusCode::OK; +} + +void GRPCVehicleHardware::registerOnPropertyChangeEvent( + std::unique_ptr callback) { + std::lock_guard lck(mCallbackMutex); + if (mOnPropChange) { + LOG(ERROR) << __func__ << " must only be called once."; + return; + } + mOnPropChange = std::move(callback); +} + +void GRPCVehicleHardware::registerOnPropertySetErrorEvent( + std::unique_ptr callback) { + std::lock_guard lck(mCallbackMutex); + if (mOnSetErr) { + LOG(ERROR) << __func__ << " must only be called once."; + return; + } + mOnSetErr = std::move(callback); +} + +DumpResult GRPCVehicleHardware::dump(const std::vector& /* options */) { + // TODO(chenhaosjtuacm): To be implemented. + return {}; +} + +aidlvhal::StatusCode GRPCVehicleHardware::checkHealth() { + // TODO(chenhaosjtuacm): To be implemented. + return aidlvhal::StatusCode::OK; +} + +aidlvhal::StatusCode GRPCVehicleHardware::updateSampleRate(int32_t /* propId */, + int32_t /* areaId */, + float /* sampleRate */) { + // TODO(chenhaosjtuacm): To be implemented. + return aidlvhal::StatusCode::OK; +} + +bool GRPCVehicleHardware::waitForConnected(std::chrono::milliseconds waitTime) { + return mGrpcChannel->WaitForConnected(gpr_time_add( + gpr_now(GPR_CLOCK_MONOTONIC), gpr_time_from_millis(waitTime.count(), GPR_TIMESPAN))); +} + +void GRPCVehicleHardware::ValuePollingLoop() { + while (!mShuttingDownFlag.load()) { + ::grpc::ClientContext context; + + bool rpc_stopped{false}; + std::thread shuttingdown_watcher([this, &rpc_stopped, &context]() { + std::unique_lock lck(mShutdownMutex); + mShutdownCV.wait(lck, [this, &rpc_stopped]() { + return rpc_stopped || mShuttingDownFlag.load(); + }); + context.TryCancel(); + }); + + auto value_stream = + mGrpcStub->StartPropertyValuesStream(&context, ::google::protobuf::Empty()); + LOG(INFO) << __func__ << ": GRPC Value Streaming Started"; + proto::VehiclePropValues protoValues; + while (!mShuttingDownFlag.load() && value_stream->Read(&protoValues)) { + std::vector values; + for (const auto protoValue : protoValues.values()) { + values.push_back(aidlvhal::VehiclePropValue()); + proto_msg_converter::protoToAidl(protoValue, &values.back()); + } + std::shared_lock lck(mCallbackMutex); + if (mOnPropChange) { + (*mOnPropChange)(values); + } + } + + { + std::lock_guard lck(mShutdownMutex); + rpc_stopped = true; + } + mShutdownCV.notify_all(); + shuttingdown_watcher.join(); + + auto grpc_status = value_stream->Finish(); + // never reach here until connection lost + LOG(ERROR) << __func__ << ": GRPC Value Streaming Failed: " << grpc_status.error_message(); + + // try to reconnect + } +} + +} // namespace android::hardware::automotive::vehicle::virtualization diff --git a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.h b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.h new file mode 100644 index 0000000000..90588aa375 --- /dev/null +++ b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.h @@ -0,0 +1,100 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include + +#include "VehicleServer.grpc.pb.h" +#include "VehicleServer.pb.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace android::hardware::automotive::vehicle::virtualization { + +namespace aidlvhal = ::aidl::android::hardware::automotive::vehicle; + +class GRPCVehicleHardware : public IVehicleHardware { + public: + explicit GRPCVehicleHardware(std::string service_addr); + + ~GRPCVehicleHardware(); + + // Get all the property configs. + std::vector getAllPropertyConfigs() const override; + + // Set property values asynchronously. Server could return before the property set requests + // are sent to vehicle bus or before property set confirmation is received. The callback is + // safe to be called after the function returns and is safe to be called in a different thread. + aidlvhal::StatusCode setValues(std::shared_ptr callback, + const std::vector& requests) override; + + // Get property values asynchronously. Server could return before the property values are ready. + // The callback is safe to be called after the function returns and is safe to be called in a + // different thread. + aidlvhal::StatusCode getValues( + std::shared_ptr callback, + const std::vector& requests) const override; + + // Dump debug information in the server. + DumpResult dump(const std::vector& options) override; + + // Check whether the system is healthy, return {@code StatusCode::OK} for healthy. + aidlvhal::StatusCode checkHealth() override; + + // Register a callback that would be called when there is a property change event from vehicle. + void registerOnPropertyChangeEvent( + std::unique_ptr callback) override; + + // Register a callback that would be called when there is a property set error event from + // vehicle. + void registerOnPropertySetErrorEvent( + std::unique_ptr callback) override; + + // Update the sample rate for the [propId, areaId] pair. + aidlvhal::StatusCode updateSampleRate(int32_t propId, int32_t areaId, + float sampleRate) override; + + bool waitForConnected(std::chrono::milliseconds waitTime); + + private: + void ValuePollingLoop(); + + std::string mServiceAddr; + std::shared_ptr<::grpc::Channel> mGrpcChannel; + std::unique_ptr mGrpcStub; + std::thread mValuePollingThread; + + std::shared_mutex mCallbackMutex; + std::unique_ptr mOnPropChange; + std::unique_ptr mOnSetErr; + + std::mutex mShutdownMutex; + std::condition_variable mShutdownCV; + std::atomic mShuttingDownFlag{false}; +}; + +} // namespace android::hardware::automotive::vehicle::virtualization diff --git a/automotive/vehicle/aidl/impl/grpc/OWNERS b/automotive/vehicle/aidl/impl/grpc/OWNERS new file mode 100644 index 0000000000..7a96f236d1 --- /dev/null +++ b/automotive/vehicle/aidl/impl/grpc/OWNERS @@ -0,0 +1,3 @@ +shanyu@google.com +chenhaosjtuacm@google.com +egranata@google.com diff --git a/automotive/vehicle/aidl/impl/grpc/proto/VehicleServer.proto b/automotive/vehicle/aidl/impl/grpc/proto/VehicleServer.proto new file mode 100644 index 0000000000..349019595b --- /dev/null +++ b/automotive/vehicle/aidl/impl/grpc/proto/VehicleServer.proto @@ -0,0 +1,43 @@ +/* + * 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. + */ + +syntax = "proto3"; + +package android.hardware.automotive.vehicle.proto; + +import "android/hardware/automotive/vehicle/StatusCode.proto"; +import "android/hardware/automotive/vehicle/VehiclePropConfig.proto"; +import "android/hardware/automotive/vehicle/VehiclePropValue.proto"; +import "android/hardware/automotive/vehicle/VehiclePropValueRequest.proto"; +import "google/protobuf/empty.proto"; + +message VehicleHalCallStatus { + StatusCode status_code = 1; +} + +message VehiclePropValues { + repeated VehiclePropValue values = 1; +} + +service VehicleServer { + rpc GetAllPropertyConfig(google.protobuf.Empty) returns (stream VehiclePropConfig) {} + + rpc SetValues(VehiclePropValueRequests) returns (SetValueResults) {} + + rpc GetValues(VehiclePropValueRequests) returns (GetValueResults) {} + + rpc StartPropertyValuesStream(google.protobuf.Empty) returns (stream VehiclePropValues) {} +} diff --git a/automotive/vehicle/aidl/impl/grpc/test/Android.bp b/automotive/vehicle/aidl/impl/grpc/test/Android.bp new file mode 100644 index 0000000000..efdf4ca3c1 --- /dev/null +++ b/automotive/vehicle/aidl/impl/grpc/test/Android.bp @@ -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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_test { + name: "GRPCVehicleHardwareUnitTest", + vendor: true, + srcs: ["GRPCVehicleHardwareUnitTest.cpp"], + whole_static_libs: [ + "android.hardware.automotive.vehicle@default-grpc-hardware-lib", + ], + header_libs: [ + "IVehicleHardware", + ], + static_libs: [ + "libgtest", + "libgmock", + ], + shared_libs: [ + "libgrpc++", + "libprotobuf-cpp-full", + ], + // libgrpc++.so is installed as root, require root to access it. + require_root: true, + defaults: [ + "VehicleHalDefaults", + ], + cflags: [ + "-Wno-unused-parameter", + ], + test_suites: ["device-tests"], +} diff --git a/automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleHardwareUnitTest.cpp b/automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleHardwareUnitTest.cpp new file mode 100644 index 0000000000..f578021f1b --- /dev/null +++ b/automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleHardwareUnitTest.cpp @@ -0,0 +1,94 @@ +// 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. + +#include "GRPCVehicleHardware.h" +#include "VehicleServer.grpc.pb.h" +#include "VehicleServer.pb.h" + +#include +#include +#include + +#include +#include +#include + +namespace android::hardware::automotive::vehicle::virtualization { + +const std::string kFakeServerAddr = "0.0.0.0:54321"; + +class FakeVehicleServer : public proto::VehicleServer::Service { + public: + ::grpc::Status StartPropertyValuesStream( + ::grpc::ServerContext* context, const ::google::protobuf::Empty* request, + ::grpc::ServerWriter* stream) override { + stream->Write(proto::VehiclePropValues()); + // A fake disconnection. + return ::grpc::Status(::grpc::StatusCode::ABORTED, "Connection lost."); + } + + // Functions that we do not care. + ::grpc::Status GetAllPropertyConfig( + ::grpc::ServerContext* context, const ::google::protobuf::Empty* request, + ::grpc::ServerWriter* stream) override { + return ::grpc::Status::OK; + } + + ::grpc::Status SetValues(::grpc::ServerContext* context, + const proto::VehiclePropValueRequests* requests, + proto::SetValueResults* results) override { + return ::grpc::Status::OK; + } + + ::grpc::Status GetValues(::grpc::ServerContext* context, + const proto::VehiclePropValueRequests* requests, + proto::GetValueResults* results) override { + return ::grpc::Status::OK; + } +}; + +TEST(GRPCVehicleHardwareUnitTest, Reconnect) { + auto receivedUpdate = std::make_shared>(0); + auto vehicleHardware = std::make_unique(kFakeServerAddr); + vehicleHardware->registerOnPropertyChangeEvent( + std::make_unique( + [receivedUpdate](const auto&) { receivedUpdate->fetch_add(1); })); + + constexpr size_t kServerRestartTimes = 5; + for (size_t serverStart = 0; serverStart < kServerRestartTimes; ++serverStart) { + EXPECT_EQ(receivedUpdate->load(), 0); + auto fakeServer = std::make_unique(); + ::grpc::ServerBuilder builder; + builder.RegisterService(fakeServer.get()); + builder.AddListeningPort(kFakeServerAddr, ::grpc::InsecureServerCredentials()); + auto grpcServer = builder.BuildAndStart(); + + // Wait until the vehicle hardware received the second update (after one fake + // disconnection). + constexpr auto kMaxWaitTime = std::chrono::seconds(5); + auto startTime = std::chrono::steady_clock::now(); + while (receivedUpdate->load() <= 1 && + std::chrono::steady_clock::now() - startTime < kMaxWaitTime) + ; + + grpcServer->Shutdown(); + grpcServer->Wait(); + EXPECT_GT(receivedUpdate->load(), 1); + + // Reset for the next round. + receivedUpdate->store(0); + } +} + +} // namespace android::hardware::automotive::vehicle::virtualization From 282c8312bf7b9d09e3edd6f7c98874f4bdf336e7 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Wed, 12 Apr 2023 21:25:23 +0000 Subject: [PATCH 906/998] Use the default SAP interface name in VtsHalWifiHostapdV1_2TargetTest. Test currently sets up a new interface and uses that interface's name. On Pixel, the new interface is wlan1, which does not seem to support the OpenAccessPointWithoutAcs configuration. However, the default SAP interface wlan0 does support it. The method to get the default interface name is taken from this file before ag/19202002 was merged. Bug: 270509029 Test: atest VtsHalWifiHostapdV1_2TargetTest (on a Bramble device running rvc-qpr3-release) Change-Id: Ic3c516f452dfb54f155246073a9bca20dbecaa0f --- .../1.2/vts/functional/hostapd_hidl_test.cpp | 44 +++++++++++-------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/wifi/hostapd/1.2/vts/functional/hostapd_hidl_test.cpp b/wifi/hostapd/1.2/vts/functional/hostapd_hidl_test.cpp index 5c59819e82..b4840a6942 100644 --- a/wifi/hostapd/1.2/vts/functional/hostapd_hidl_test.cpp +++ b/wifi/hostapd/1.2/vts/functional/hostapd_hidl_test.cpp @@ -69,6 +69,7 @@ class HostapdHidlTest hostapd_instance_name_); hostapd_ = IHostapd::getService(hostapd_instance_name_); ASSERT_NE(hostapd_.get(), nullptr); + setupApIfaceIfNeeded(); isAcsSupport_ = testing::checkSubstringInCommandOutput( "/system/bin/cmd wifi get-softap-supported-features", "wifi_softap_acs_supported"); @@ -86,14 +87,21 @@ class HostapdHidlTest bool isWpa3SaeSupport_ = false; bool isAcsSupport_ = false; - std::string setupApIfaceIfNeededAndGetName() { + void setupApIfaceIfNeeded() { sp wifi_ap_iface; wifi_ap_iface = getWifiApIface_1_4(wifi_instance_name_); EXPECT_NE(nullptr, wifi_ap_iface.get()); const auto& status_and_name = HIDL_INVOKE(wifi_ap_iface, getName); EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_name.first.code); - return status_and_name.second; + } + + std::string getPrimaryWlanIfaceName() { + std::array buffer; + auto res = property_get("ro.vendor.wifi.sap.interface", buffer.data(), nullptr); + if (res > 0) return buffer.data(); + property_get("wifi.interface", buffer.data(), "wlan0"); + return buffer.data(); } IHostapd::IfaceParams getIfaceParamsWithoutAcs(std::string iface_name) { @@ -243,7 +251,7 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithAcs) { if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support"; if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; - std::string ifname = setupApIfaceIfNeededAndGetName(); + std::string ifname = getPrimaryWlanIfaceName(); auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithAcs(ifname), getPskNwParams()); EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code); @@ -257,7 +265,7 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndFreqRange) { if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support"; if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; - std::string ifname = setupApIfaceIfNeededAndGetName(); + std::string ifname = getPrimaryWlanIfaceName(); auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithAcsAndFreqRange(ifname), getPskNwParams()); @@ -272,7 +280,7 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithAcsAndInvalidFreqRange) { if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support"; if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; - std::string ifname = setupApIfaceIfNeededAndGetName(); + std::string ifname = getPrimaryWlanIfaceName(); auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithAcsAndInvalidFreqRange(ifname), getPskNwParams()); @@ -287,7 +295,7 @@ TEST_P(HostapdHidlTest, AddOpenAccessPointWithAcs) { if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support"; if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; - std::string ifname = setupApIfaceIfNeededAndGetName(); + std::string ifname = getPrimaryWlanIfaceName(); auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithAcs(ifname), getOpenNwParams()); EXPECT_EQ(HostapdStatusCode::SUCCESS, status.code); @@ -300,7 +308,7 @@ TEST_P(HostapdHidlTest, AddOpenAccessPointWithAcs) { TEST_P(HostapdHidlTest, AddPskAccessPointWithoutAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; - std::string ifname = setupApIfaceIfNeededAndGetName(); + std::string ifname = getPrimaryWlanIfaceName(); auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), getPskNwParams()); @@ -314,7 +322,7 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithoutAcs) { TEST_P(HostapdHidlTest, AddOpenAccessPointWithoutAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; - std::string ifname = setupApIfaceIfNeededAndGetName(); + std::string ifname = getPrimaryWlanIfaceName(); auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), getOpenNwParams()); @@ -329,7 +337,7 @@ TEST_P(HostapdHidlTest, AddSaeTransitionAccessPointWithoutAcs) { if (!isWpa3SaeSupport_) GTEST_SKIP() << "Missing SAE support"; if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; - std::string ifname = setupApIfaceIfNeededAndGetName(); + std::string ifname = getPrimaryWlanIfaceName(); auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), getSaeTransitionNwParams()); @@ -344,7 +352,7 @@ TEST_P(HostapdHidlTest, AddSAEAccessPointWithoutAcs) { if (!isWpa3SaeSupport_) GTEST_SKIP() << "Missing SAE support"; if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; - std::string ifname = setupApIfaceIfNeededAndGetName(); + std::string ifname = getPrimaryWlanIfaceName(); auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), getSaeNwParams()); @@ -359,7 +367,7 @@ TEST_P(HostapdHidlTest, RemoveAccessPointWithAcs) { if (!isAcsSupport_) GTEST_SKIP() << "Missing ACS support"; if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; - std::string ifname = setupApIfaceIfNeededAndGetName(); + std::string ifname = getPrimaryWlanIfaceName(); auto status_1_2 = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithAcs(ifname), getPskNwParams()); @@ -377,7 +385,7 @@ TEST_P(HostapdHidlTest, RemoveAccessPointWithAcs) { TEST_P(HostapdHidlTest, RemoveAccessPointWithoutAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; - std::string ifname = setupApIfaceIfNeededAndGetName(); + std::string ifname = getPrimaryWlanIfaceName(); auto status_1_2 = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), getPskNwParams()); @@ -395,7 +403,7 @@ TEST_P(HostapdHidlTest, RemoveAccessPointWithoutAcs) { TEST_P(HostapdHidlTest, AddPskAccessPointWithInvalidChannel) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; - std::string ifname = setupApIfaceIfNeededAndGetName(); + std::string ifname = getPrimaryWlanIfaceName(); auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithInvalidChannel(ifname), getPskNwParams()); @@ -409,7 +417,7 @@ TEST_P(HostapdHidlTest, AddPskAccessPointWithInvalidChannel) { TEST_P(HostapdHidlTest, AddInvalidPskAccessPointWithoutAcs) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; - std::string ifname = setupApIfaceIfNeededAndGetName(); + std::string ifname = getPrimaryWlanIfaceName(); auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), getInvalidPskNwParams()); @@ -424,7 +432,7 @@ TEST_P(HostapdHidlTest, AddInvalidSaeTransitionAccessPointWithoutAcs) { if (!isWpa3SaeSupport_) GTEST_SKIP() << "Missing SAE support"; if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; - std::string ifname = setupApIfaceIfNeededAndGetName(); + std::string ifname = getPrimaryWlanIfaceName(); auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), getInvalidSaeTransitionNwParams()); @@ -439,7 +447,7 @@ TEST_P(HostapdHidlTest, AddInvalidSaeAccessPointWithoutAcs) { if (!isWpa3SaeSupport_) GTEST_SKIP() << "Missing SAE support"; if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; - std::string ifname = setupApIfaceIfNeededAndGetName(); + std::string ifname = getPrimaryWlanIfaceName(); auto status = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), getInvalidSaeNwParams()); @@ -451,7 +459,7 @@ TEST_P(HostapdHidlTest, AddInvalidSaeAccessPointWithoutAcs) { * when hotspot interface doesn't init.. */ TEST_P(HostapdHidlTest, DisconnectClientWhenIfaceNotAvailable) { - std::string ifname = setupApIfaceIfNeededAndGetName(); + std::string ifname = getPrimaryWlanIfaceName(); auto status = HIDL_INVOKE(hostapd_, forceClientDisconnect, ifname, kTestZeroMacAddr, kTestDisconnectReasonCode); EXPECT_EQ(HostapdStatusCode::FAILURE_IFACE_UNKNOWN, status.code); @@ -464,7 +472,7 @@ TEST_P(HostapdHidlTest, DisconnectClientWhenIfaceNotAvailable) { TEST_P(HostapdHidlTest, DisconnectClientWhenIfacAvailable) { if (is_1_3(hostapd_)) GTEST_SKIP() << "Ignore addAccessPoint_1_2 on hostapd 1_3"; - std::string ifname = setupApIfaceIfNeededAndGetName(); + std::string ifname = getPrimaryWlanIfaceName(); auto status_1_2 = HIDL_INVOKE(hostapd_, addAccessPoint_1_2, getIfaceParamsWithoutAcs(ifname), getOpenNwParams()); From d1df10178d315032af6914eb9ced3022b29a0afb Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Wed, 12 Apr 2023 14:20:48 -0700 Subject: [PATCH 907/998] Add compatibility matrix for V. Copied from U matrix. Also include the radio.satellite HAL. Test: TH Bug: 266741352 Change-Id: Ic42e51b616782a2763eb80e1cad5ca776cc079d4 --- compatibility_matrices/Android.bp | 12 + compatibility_matrices/Android.mk | 1 + .../compatibility_matrix.9.xml | 729 ++++++++++++++++++ 3 files changed, 742 insertions(+) create mode 100644 compatibility_matrices/compatibility_matrix.9.xml diff --git a/compatibility_matrices/Android.bp b/compatibility_matrices/Android.bp index 93b5380e27..b3ca29309d 100644 --- a/compatibility_matrices/Android.bp +++ b/compatibility_matrices/Android.bp @@ -82,3 +82,15 @@ vintf_compatibility_matrix { "kernel_config_u_6.1", ], } + +vintf_compatibility_matrix { + name: "framework_compatibility_matrix.9.xml", + stem: "compatibility_matrix.9.xml", + srcs: [ + "compatibility_matrix.9.xml", + ], + kernel_configs: [ + "kernel_config_v_5.15", + "kernel_config_v_6.1", + ], +} diff --git a/compatibility_matrices/Android.mk b/compatibility_matrices/Android.mk index 6e4c4193f7..a82a421ff4 100644 --- a/compatibility_matrices/Android.mk +++ b/compatibility_matrices/Android.mk @@ -103,6 +103,7 @@ my_system_matrix_deps := \ framework_compatibility_matrix.6.xml \ framework_compatibility_matrix.7.xml \ framework_compatibility_matrix.8.xml \ + framework_compatibility_matrix.9.xml \ framework_compatibility_matrix.device.xml \ my_framework_matrix_deps += \ diff --git a/compatibility_matrices/compatibility_matrix.9.xml b/compatibility_matrices/compatibility_matrix.9.xml new file mode 100644 index 0000000000..4c24acd766 --- /dev/null +++ b/compatibility_matrices/compatibility_matrix.9.xml @@ -0,0 +1,729 @@ + + + android.hardware.audio + 6.0 + 7.0-1 + + IDevicesFactory + default + + + + android.hardware.audio.effect + 6.0 + 7.0 + + IEffectsFactory + default + + + + android.hardware.audio.core + 1 + + IModule + default + a2dp + bluetooth + hearing_aid + msd + r_submix + stub + usb + + + IConfig + default + + + + android.hardware.audio.effect + 1 + + IFactory + default + + + + android.hardware.audio.sounddose + 1 + + ISoundDoseFactory + default + + + + android.hardware.authsecret + 1 + + IAuthSecret + default + + + + android.hardware.automotive.audiocontrol + 2-3 + + IAudioControl + default + + + + android.hardware.automotive.can + 1 + + ICanController + default + + + + android.hardware.automotive.evs + 1-2 + + IEvsEnumerator + [a-z]+/[0-9]+ + + + + android.hardware.automotive.occupant_awareness + 1 + + IOccupantAwareness + default + + + + android.hardware.automotive.vehicle + 1-2 + + IVehicle + default + + + + android.hardware.automotive.remoteaccess + + IRemoteAccess + default + + + + android.hardware.automotive.ivn + + IIvnAndroidDevice + default + + + + android.hardware.biometrics.face + 3 + + IFace + default + + + + android.hardware.biometrics.fingerprint + 3 + + IFingerprint + default + virtual + + + + android.hardware.bluetooth + 1.0-1 + + IBluetoothHci + default + + + + android.hardware.bluetooth + + IBluetoothHci + default + + + + android.hardware.bluetooth.audio + 3 + + IBluetoothAudioProviderFactory + default + + + + android.hardware.boot + + IBootControl + default + + + + android.hardware.broadcastradio + + IBroadcastRadio + .* + + + + android.hardware.camera.provider + 1-2 + + ICameraProvider + [^/]+/[0-9]+ + + + + android.hardware.cas + + IMediaCasService + default + + + + android.hardware.confirmationui + 1 + + IConfirmationUI + default + + + + android.hardware.contexthub + 2 + + IContextHub + default + + + + android.hardware.drm + 1 + + IDrmFactory + .* + + + + android.hardware.dumpstate + + IDumpstateDevice + default + + + + android.hardware.gatekeeper + 1 + + IGatekeeper + default + + + + android.hardware.gnss + 2-3 + + IGnss + default + + + + android.hardware.gnss.visibility_control + 1 + + IGnssVisibilityControl + default + + + + android.hardware.gnss.measurement_corrections + 1 + + IMeasurementCorrectionsInterface + default + + + + android.hardware.graphics.allocator + 1-2 + + IAllocator + default + + + + android.hardware.graphics.composer3 + 2 + + IComposer + default + + + + + android.hardware.graphics.mapper + + 2.1 + 3.0 + 4.0 + + IMapper + default + + + + android.hardware.health + 1-2 + + IHealth + default + + + + android.hardware.health.storage + 1 + + IStorage + default + + + + android.hardware.identity + 1-5 + + IIdentityCredentialStore + default + + + + android.hardware.net.nlinterceptor + + IInterceptor + default + + + + android.hardware.oemlock + 1 + + IOemLock + default + + + + android.hardware.ir + 1 + + IConsumerIr + default + + + + android.hardware.input.processor + 1 + + IInputProcessor + default + + + + android.hardware.security.keymint + 1-3 + + IKeyMintDevice + default + strongbox + + + + android.hardware.security.keymint + 1-3 + + IRemotelyProvisionedComponent + default + strongbox + + + + android.hardware.light + 2 + + ILights + default + + + + android.hardware.media.c2 + 1.0-2 + + IComponentStore + default[0-9]* + vendor[0-9]*_software + + + + android.hardware.memtrack + 1 + + IMemtrack + default + + + + android.hardware.neuralnetworks + 1-4 + + IDevice + .* + + + + android.hardware.nfc + + INfc + default + + + + android.hardware.power + 4 + + IPower + default + + + + android.hardware.power.stats + 2 + + IPowerStats + default + + + + android.hardware.radio.config + 2 + + IRadioConfig + default + + + + android.hardware.radio.data + 2 + + IRadioData + slot1 + slot2 + slot3 + + + + android.hardware.radio.messaging + 2 + + IRadioMessaging + slot1 + slot2 + slot3 + + + + android.hardware.radio.modem + 2 + + IRadioModem + slot1 + slot2 + slot3 + + + + android.hardware.radio.network + 2 + + IRadioNetwork + slot1 + slot2 + slot3 + + + + android.hardware.radio.sim + 2 + + IRadioSim + slot1 + slot2 + slot3 + + + + android.hardware.radio.sap + 1 + + ISap + slot1 + slot2 + slot3 + + + + android.hardware.radio.voice + 2 + + IRadioVoice + slot1 + slot2 + slot3 + + + + android.hardware.radio.ims + 1 + + IRadioIms + slot1 + slot2 + slot3 + + + + android.hardware.radio.satellite + 1 + + IRadioSatellite + slot1 + slot2 + slot3 + + + + android.hardware.radio.ims.media + 1 + + IImsMedia + default + + + + android.hardware.renderscript + 1.0 + + IDevice + default + + + + android.hardware.rebootescrow + 1 + + IRebootEscrow + default + + + + android.hardware.secure_element + 1 + + ISecureElement + eSE[1-9][0-9]* + SIM[1-9][0-9]* + + + + android.hardware.security.secureclock + 1 + + ISecureClock + default + + + + android.hardware.security.sharedsecret + 1 + + ISharedSecret + default + strongbox + + + + android.hardware.sensors + 2 + + ISensors + default + + + + android.hardware.soundtrigger + 2.3 + + ISoundTriggerHw + default + + + + android.hardware.soundtrigger3 + 1 + + ISoundTriggerHw + default + + + + android.hardware.tetheroffload.config + 1.0 + + IOffloadConfig + default + + + + android.hardware.tetheroffload.control + 1.1 + + IOffloadControl + default + + + + android.hardware.tetheroffload + 1 + + IOffload + default + + + + android.hardware.thermal + 1 + + IThermal + default + + + + android.hardware.tv.hdmi.cec + 1 + + IHdmiCec + default + + + + android.hardware.tv.hdmi.earc + 1 + + IEArc + default + + + + android.hardware.tv.hdmi.connection + 1 + + IHdmiConnection + default + + + + android.hardware.tv.tuner + 1-2 + + ITuner + default + + + + android.hardware.tv.input + 1 + + ITvInput + default + + + + android.hardware.usb + 1-2 + + IUsb + default + + + + android.hardware.usb.gadget + + IUsbGadget + default + + + + android.hardware.vibrator + 1-2 + + IVibrator + default + + + + android.hardware.vibrator + 1-2 + + IVibratorManager + default + + + + android.hardware.weaver + 2 + + IWeaver + default + + + + android.hardware.wifi + 1 + + IWifi + default + + + + android.hardware.uwb + 1 + + IUwb + default + + + + android.hardware.wifi.hostapd + 1 + + IHostapd + default + + + + android.hardware.wifi.supplicant + 2 + + ISupplicant + default + + + + + mapper + 5.0 + + .* + + + From c2340359de15f4c363197a5ac32691c131cba2e3 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Wed, 12 Apr 2023 14:45:26 -0700 Subject: [PATCH 908/998] DO NOT MERGE disable V matrix. Disable 9.xml on the Android 14 branch because it should not know about the new HALs. The 9.xml file itself is kept to avoid future merge conflicts. Bug: 277379745 Test: TH Change-Id: I32263830e69080eece47dcc0880be32be02e2a9c --- compatibility_matrices/Android.bp | 12 ------------ compatibility_matrices/Android.mk | 1 - compatibility_matrices/compatibility_matrix.9.xml | 1 + 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/compatibility_matrices/Android.bp b/compatibility_matrices/Android.bp index b3ca29309d..93b5380e27 100644 --- a/compatibility_matrices/Android.bp +++ b/compatibility_matrices/Android.bp @@ -82,15 +82,3 @@ vintf_compatibility_matrix { "kernel_config_u_6.1", ], } - -vintf_compatibility_matrix { - name: "framework_compatibility_matrix.9.xml", - stem: "compatibility_matrix.9.xml", - srcs: [ - "compatibility_matrix.9.xml", - ], - kernel_configs: [ - "kernel_config_v_5.15", - "kernel_config_v_6.1", - ], -} diff --git a/compatibility_matrices/Android.mk b/compatibility_matrices/Android.mk index a82a421ff4..6e4c4193f7 100644 --- a/compatibility_matrices/Android.mk +++ b/compatibility_matrices/Android.mk @@ -103,7 +103,6 @@ my_system_matrix_deps := \ framework_compatibility_matrix.6.xml \ framework_compatibility_matrix.7.xml \ framework_compatibility_matrix.8.xml \ - framework_compatibility_matrix.9.xml \ framework_compatibility_matrix.device.xml \ my_framework_matrix_deps += \ diff --git a/compatibility_matrices/compatibility_matrix.9.xml b/compatibility_matrices/compatibility_matrix.9.xml index 4c24acd766..188746d79b 100644 --- a/compatibility_matrices/compatibility_matrix.9.xml +++ b/compatibility_matrices/compatibility_matrix.9.xml @@ -1,3 +1,4 @@ + android.hardware.audio From 32d467066a5e8c1880635fbe5224c6b9fb4350b4 Mon Sep 17 00:00:00 2001 From: Hao Chen Date: Mon, 10 Apr 2023 15:59:50 -0700 Subject: [PATCH 909/998] GRPC Vehicle Proxy Server The GRPC proxy server speaks to another IVehicleHardware (no matter if it is real or fake) to serve other GRPC vehicle hardware(s). It can be used as a real GRPC Vehicle Hardware backend when it is running on the machine that have a direct access to the real vehicle bus, or it can also be used as a fake backend for testing. Test: `atest GRPCVehicleProxyServerUnitTest` Bug: 266001013 Change-Id: Ifec6e21223986a68ab089a87a9664c1b52601ea2 --- automotive/vehicle/aidl/impl/grpc/Android.bp | 24 ++ .../aidl/impl/grpc/GRPCVehicleProxyServer.cpp | 269 ++++++++++++++++++ .../aidl/impl/grpc/GRPCVehicleProxyServer.h | 112 ++++++++ .../vehicle/aidl/impl/grpc/test/Android.bp | 28 ++ .../test/GRPCVehicleProxyServerUnitTest.cpp | 147 ++++++++++ 5 files changed, 580 insertions(+) create mode 100644 automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.cpp create mode 100644 automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.h create mode 100644 automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleProxyServerUnitTest.cpp diff --git a/automotive/vehicle/aidl/impl/grpc/Android.bp b/automotive/vehicle/aidl/impl/grpc/Android.bp index e8f0970c4d..06c9600100 100644 --- a/automotive/vehicle/aidl/impl/grpc/Android.bp +++ b/automotive/vehicle/aidl/impl/grpc/Android.bp @@ -100,3 +100,27 @@ cc_library_static { "-Wno-unused-parameter", ], } + +cc_library_static { + name: "android.hardware.automotive.vehicle@default-grpc-server-lib", + defaults: ["VehicleHalDefaults"], + vendor: true, + srcs: [ + "GRPCVehicleProxyServer.cpp", + ], + whole_static_libs: [ + "android.hardware.automotive.vehicle@default-grpc-libgrpc", + "VehicleHalProtoMessageConverter", + ], + header_libs: [ + "IVehicleHardware", + ], + shared_libs: [ + "libgrpc++", + "libprotobuf-cpp-full", + ], + export_include_dirs: ["."], + cflags: [ + "-Wno-unused-parameter", + ], +} diff --git a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.cpp b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.cpp new file mode 100644 index 0000000000..e2fe97b1c7 --- /dev/null +++ b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.cpp @@ -0,0 +1,269 @@ +/* + * 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. + */ + +#include "GRPCVehicleProxyServer.h" + +#include "ProtoMessageConverter.h" + +#include + +#include + +#include +#include +#include +#include +#include +#include + +namespace android::hardware::automotive::vehicle::virtualization { + +std::atomic GrpcVehicleProxyServer::ConnectionDescriptor::connection_id_counter_{0}; + +static std::shared_ptr<::grpc::ServerCredentials> getServerCredentials() { + // TODO(chenhaosjtuacm): get secured credentials here + return ::grpc::InsecureServerCredentials(); +} + +GrpcVehicleProxyServer::GrpcVehicleProxyServer(std::string serverAddr, + std::unique_ptr&& hardware) + : mServiceAddr(std::move(serverAddr)), mHardware(std::move(hardware)) { + mHardware->registerOnPropertyChangeEvent( + std::make_unique( + [this](std::vector values) { + OnVehiclePropChange(values); + })); +} + +::grpc::Status GrpcVehicleProxyServer::GetAllPropertyConfig( + ::grpc::ServerContext* context, const ::google::protobuf::Empty* request, + ::grpc::ServerWriter* stream) { + for (const auto& config : mHardware->getAllPropertyConfigs()) { + proto::VehiclePropConfig protoConfig; + proto_msg_converter::aidlToProto(config, &protoConfig); + if (!stream->Write(protoConfig)) { + return ::grpc::Status(::grpc::StatusCode::ABORTED, "Connection lost."); + } + } + return ::grpc::Status::OK; +} + +::grpc::Status GrpcVehicleProxyServer::SetValues(::grpc::ServerContext* context, + const proto::VehiclePropValueRequests* requests, + proto::SetValueResults* results) { + std::vector aidlRequests; + for (const auto& protoRequest : requests->requests()) { + auto& aidlRequest = aidlRequests.emplace_back(); + aidlRequest.requestId = protoRequest.request_id(); + proto_msg_converter::protoToAidl(protoRequest.value(), &aidlRequest.value); + } + auto waitMtx = std::make_shared(); + auto waitCV = std::make_shared(); + auto complete = std::make_shared(false); + auto tmpResults = std::make_shared(); + auto aidlStatus = mHardware->setValues( + std::make_shared( + [waitMtx, waitCV, complete, + tmpResults](std::vector setValueResults) { + for (const auto& aidlResult : setValueResults) { + auto& protoResult = *tmpResults->add_results(); + protoResult.set_request_id(aidlResult.requestId); + protoResult.set_status( + static_cast(aidlResult.status)); + } + { + std::lock_guard lck(*waitMtx); + *complete = true; + } + waitCV->notify_all(); + }), + aidlRequests); + if (aidlStatus != aidlvhal::StatusCode::OK) { + return ::grpc::Status(::grpc::StatusCode::INTERNAL, + "The underlying hardware fails to set values, VHAL status: " + + toString(aidlStatus)); + } + std::unique_lock lck(*waitMtx); + bool success = waitCV->wait_for(lck, kHardwareOpTimeout, [complete] { return *complete; }); + if (!success) { + return ::grpc::Status(::grpc::StatusCode::INTERNAL, + "The underlying hardware set values timeout."); + } + *results = std::move(*tmpResults); + return ::grpc::Status::OK; +} + +::grpc::Status GrpcVehicleProxyServer::GetValues(::grpc::ServerContext* context, + const proto::VehiclePropValueRequests* requests, + proto::GetValueResults* results) { + std::vector aidlRequests; + for (const auto& protoRequest : requests->requests()) { + auto& aidlRequest = aidlRequests.emplace_back(); + aidlRequest.requestId = protoRequest.request_id(); + proto_msg_converter::protoToAidl(protoRequest.value(), &aidlRequest.prop); + } + auto waitMtx = std::make_shared(); + auto waitCV = std::make_shared(); + auto complete = std::make_shared(false); + auto tmpResults = std::make_shared(); + auto aidlStatus = mHardware->getValues( + std::make_shared( + [waitMtx, waitCV, complete, + tmpResults](std::vector getValueResults) { + for (const auto& aidlResult : getValueResults) { + auto& protoResult = *tmpResults->add_results(); + protoResult.set_request_id(aidlResult.requestId); + protoResult.set_status( + static_cast(aidlResult.status)); + if (aidlResult.prop) { + auto* valuePtr = protoResult.mutable_value(); + proto_msg_converter::aidlToProto(*aidlResult.prop, valuePtr); + } + } + { + std::lock_guard lck(*waitMtx); + *complete = true; + } + waitCV->notify_all(); + }), + aidlRequests); + if (aidlStatus != aidlvhal::StatusCode::OK) { + return ::grpc::Status(::grpc::StatusCode::INTERNAL, + "The underlying hardware fails to get values, VHAL status: " + + toString(aidlStatus)); + } + std::unique_lock lck(*waitMtx); + bool success = waitCV->wait_for(lck, kHardwareOpTimeout, [complete] { return *complete; }); + if (!success) { + return ::grpc::Status(::grpc::StatusCode::INTERNAL, + "The underlying hardware get values timeout."); + } + *results = std::move(*tmpResults); + return ::grpc::Status::OK; +} + +::grpc::Status GrpcVehicleProxyServer::StartPropertyValuesStream( + ::grpc::ServerContext* context, const ::google::protobuf::Empty* request, + ::grpc::ServerWriter* stream) { + auto conn = std::make_shared(stream); + { + std::lock_guard lck(mConnectionMutex); + mValueStreamingConnections.push_back(conn); + } + conn->Wait(); + LOG(ERROR) << __func__ << ": Stream lost, ID : " << conn->ID(); + return ::grpc::Status(::grpc::StatusCode::ABORTED, "Connection lost."); +} + +void GrpcVehicleProxyServer::OnVehiclePropChange( + const std::vector& values) { + std::unordered_set brokenConn; + proto::VehiclePropValues protoValues; + for (const auto& value : values) { + auto* protoValuePtr = protoValues.add_values(); + proto_msg_converter::aidlToProto(value, protoValuePtr); + } + { + std::shared_lock read_lock(mConnectionMutex); + for (auto& connection : mValueStreamingConnections) { + auto writeOK = connection->Write(protoValues); + if (!writeOK) { + LOG(ERROR) << __func__ + << ": Server Write failed, connection lost. ID: " << connection->ID(); + brokenConn.insert(connection->ID()); + } + } + } + if (brokenConn.empty()) { + return; + } + std::unique_lock write_lock(mConnectionMutex); + mValueStreamingConnections.erase( + std::remove_if(mValueStreamingConnections.begin(), mValueStreamingConnections.end(), + [&brokenConn](const auto& conn) { + return brokenConn.find(conn->ID()) != brokenConn.end(); + }), + mValueStreamingConnections.end()); +} + +GrpcVehicleProxyServer& GrpcVehicleProxyServer::Start() { + if (mServer) { + LOG(WARNING) << __func__ << ": GrpcVehicleProxyServer has already started."; + return *this; + } + ::grpc::ServerBuilder builder; + builder.RegisterService(this); + builder.AddListeningPort(mServiceAddr, getServerCredentials()); + mServer = builder.BuildAndStart(); + CHECK(mServer) << __func__ << ": failed to create the GRPC server, " + << "please make sure the configuration and permissions are correct"; + return *this; +} + +GrpcVehicleProxyServer& GrpcVehicleProxyServer::Shutdown() { + std::shared_lock read_lock(mConnectionMutex); + for (auto& conn : mValueStreamingConnections) { + conn->Shutdown(); + } + if (mServer) { + mServer->Shutdown(); + } + return *this; +} + +void GrpcVehicleProxyServer::Wait() { + if (mServer) { + mServer->Wait(); + } + mServer.reset(); +} + +GrpcVehicleProxyServer::ConnectionDescriptor::~ConnectionDescriptor() { + Shutdown(); +} + +bool GrpcVehicleProxyServer::ConnectionDescriptor::Write(const proto::VehiclePropValues& values) { + if (!mStream) { + LOG(ERROR) << __func__ << ": Empty stream. ID: " << ID(); + Shutdown(); + return false; + } + { + std::lock_guard lck(*mMtx); + if (!mShutdownFlag && mStream->Write(values)) { + return true; + } else { + LOG(ERROR) << __func__ << ": Server Write failed, connection lost. ID: " << ID(); + } + } + Shutdown(); + return false; +} + +void GrpcVehicleProxyServer::ConnectionDescriptor::Wait() { + std::unique_lock lck(*mMtx); + mCV->wait(lck, [this] { return mShutdownFlag; }); +} + +void GrpcVehicleProxyServer::ConnectionDescriptor::Shutdown() { + { + std::lock_guard lck(*mMtx); + mShutdownFlag = true; + } + mCV->notify_all(); +} + +} // namespace android::hardware::automotive::vehicle::virtualization diff --git a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.h b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.h new file mode 100644 index 0000000000..01beec3949 --- /dev/null +++ b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.h @@ -0,0 +1,112 @@ +/* + * 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. + */ + +#pragma once + +#include "IVehicleHardware.h" + +#include "VehicleServer.grpc.pb.h" +#include "VehicleServer.pb.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace android::hardware::automotive::vehicle::virtualization { + +namespace aidlvhal = ::aidl::android::hardware::automotive::vehicle; + +// Connect other GRPC vehicle hardware(s) to the underlying vehicle hardware. +class GrpcVehicleProxyServer : public proto::VehicleServer::Service { + public: + GrpcVehicleProxyServer(std::string serverAddr, std::unique_ptr&& hardware); + + ::grpc::Status GetAllPropertyConfig( + ::grpc::ServerContext* context, const ::google::protobuf::Empty* request, + ::grpc::ServerWriter* stream) override; + + ::grpc::Status SetValues(::grpc::ServerContext* context, + const proto::VehiclePropValueRequests* requests, + proto::SetValueResults* results) override; + + ::grpc::Status GetValues(::grpc::ServerContext* context, + const proto::VehiclePropValueRequests* requests, + proto::GetValueResults* results) override; + + ::grpc::Status StartPropertyValuesStream( + ::grpc::ServerContext* context, const ::google::protobuf::Empty* request, + ::grpc::ServerWriter* stream) override; + + GrpcVehicleProxyServer& Start(); + + GrpcVehicleProxyServer& Shutdown(); + + void Wait(); + + private: + void OnVehiclePropChange(const std::vector& values); + + // We keep long-lasting connection for streaming the prop values. + struct ConnectionDescriptor { + explicit ConnectionDescriptor(::grpc::ServerWriter* stream) + : mStream(stream), + mConnectionID(connection_id_counter_.fetch_add(1) + 1), + mMtx(std::make_unique()), + mCV(std::make_unique()) {} + + ConnectionDescriptor(const ConnectionDescriptor&) = delete; + ConnectionDescriptor(ConnectionDescriptor&& cd) = default; + ConnectionDescriptor& operator=(const ConnectionDescriptor&) = delete; + ConnectionDescriptor& operator=(ConnectionDescriptor&& cd) = default; + + ~ConnectionDescriptor(); + + uint64_t ID() const { return mConnectionID; } + + bool Write(const proto::VehiclePropValues& values); + + void Wait(); + + void Shutdown(); + + private: + ::grpc::ServerWriter* mStream; + uint64_t mConnectionID{0}; + std::unique_ptr mMtx; + std::unique_ptr mCV; + bool mShutdownFlag{false}; + + static std::atomic connection_id_counter_; + }; + + std::string mServiceAddr; + std::unique_ptr<::grpc::Server> mServer{nullptr}; + std::unique_ptr mHardware; + + std::shared_mutex mConnectionMutex; + std::vector> mValueStreamingConnections; + + static constexpr auto kHardwareOpTimeout = std::chrono::seconds(1); +}; + +} // namespace android::hardware::automotive::vehicle::virtualization diff --git a/automotive/vehicle/aidl/impl/grpc/test/Android.bp b/automotive/vehicle/aidl/impl/grpc/test/Android.bp index efdf4ca3c1..e53826f7f3 100644 --- a/automotive/vehicle/aidl/impl/grpc/test/Android.bp +++ b/automotive/vehicle/aidl/impl/grpc/test/Android.bp @@ -44,3 +44,31 @@ cc_test { ], test_suites: ["device-tests"], } + +cc_test { + name: "GRPCVehicleProxyServerUnitTest", + vendor: true, + srcs: ["GRPCVehicleProxyServerUnitTest.cpp"], + header_libs: [ + "IVehicleHardware", + ], + static_libs: [ + "android.hardware.automotive.vehicle@default-grpc-hardware-lib", + "android.hardware.automotive.vehicle@default-grpc-server-lib", + "libgtest", + "libgmock", + ], + shared_libs: [ + "libgrpc++", + "libprotobuf-cpp-full", + ], + // libgrpc++.so is installed as root, require root to access it. + require_root: true, + defaults: [ + "VehicleHalDefaults", + ], + cflags: [ + "-Wno-unused-parameter", + ], + test_suites: ["device-tests"], +} diff --git a/automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleProxyServerUnitTest.cpp b/automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleProxyServerUnitTest.cpp new file mode 100644 index 0000000000..49e6fc9d21 --- /dev/null +++ b/automotive/vehicle/aidl/impl/grpc/test/GRPCVehicleProxyServerUnitTest.cpp @@ -0,0 +1,147 @@ +// 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. + +#include "GRPCVehicleHardware.h" +#include "GRPCVehicleProxyServer.h" +#include "IVehicleHardware.h" +#include "VehicleServer.grpc.pb.h" +#include "VehicleServer.pb.h" + +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace android::hardware::automotive::vehicle::virtualization { + +const std::string kFakeServerAddr = "0.0.0.0:54321"; + +class VehicleHardwareForTest : public IVehicleHardware { + public: + void registerOnPropertyChangeEvent( + std::unique_ptr callback) override { + mOnProp = std::move(callback); + } + + void onPropertyEvent( + std::vector values) { + if (mOnProp) { + (*mOnProp)(std::move(values)); + } + } + + // Functions that we do not care. + std::vector + getAllPropertyConfigs() const override { + return {}; + } + + aidl::android::hardware::automotive::vehicle::StatusCode setValues( + std::shared_ptr callback, + const std::vector& + requests) override { + return aidl::android::hardware::automotive::vehicle::StatusCode::OK; + } + + aidl::android::hardware::automotive::vehicle::StatusCode getValues( + std::shared_ptr callback, + const std::vector& + requests) const override { + return aidl::android::hardware::automotive::vehicle::StatusCode::OK; + } + + DumpResult dump(const std::vector& options) override { return {}; } + + aidl::android::hardware::automotive::vehicle::StatusCode checkHealth() override { + return aidl::android::hardware::automotive::vehicle::StatusCode::OK; + } + + void registerOnPropertySetErrorEvent( + std::unique_ptr callback) override {} + + private: + std::unique_ptr mOnProp; +}; + +TEST(GRPCVehicleProxyServerUnitTest, ClientConnectDisconnect) { + auto testHardware = std::make_unique(); + // HACK: manipulate the underlying hardware via raw pointer for testing. + auto* testHardwareRaw = testHardware.get(); + auto vehicleServer = + std::make_unique(kFakeServerAddr, std::move(testHardware)); + vehicleServer->Start(); + + constexpr auto kWaitForConnectionMaxTime = std::chrono::seconds(5); + constexpr auto kWaitForStreamStartTime = std::chrono::seconds(1); + constexpr auto kWaitForUpdateDeliveryTime = std::chrono::milliseconds(100); + + auto updateReceived1 = std::make_shared(false); + auto vehicleHardware1 = std::make_unique(kFakeServerAddr); + vehicleHardware1->registerOnPropertyChangeEvent( + std::make_unique( + [updateReceived1](const auto&) { *updateReceived1 = true; })); + EXPECT_TRUE(vehicleHardware1->waitForConnected(kWaitForConnectionMaxTime)); + std::this_thread::sleep_for(kWaitForStreamStartTime); + + // Client hardware 1 received update from the server. + EXPECT_FALSE(*updateReceived1); + testHardwareRaw->onPropertyEvent({}); + // Wait for the update delivery. + std::this_thread::sleep_for(kWaitForUpdateDeliveryTime); + EXPECT_TRUE(*updateReceived1); + + // Reset. + *updateReceived1 = false; + + auto updateReceived2 = std::make_shared(false); + auto vehicleHardware2 = std::make_unique(kFakeServerAddr); + vehicleHardware2->registerOnPropertyChangeEvent( + std::make_unique( + [updateReceived2](const auto&) { *updateReceived2 = true; })); + EXPECT_TRUE(vehicleHardware2->waitForConnected(kWaitForConnectionMaxTime)); + std::this_thread::sleep_for(kWaitForStreamStartTime); + + // Both client hardware 1 and 2 received update from the server. + EXPECT_FALSE(*updateReceived1); + EXPECT_FALSE(*updateReceived2); + testHardwareRaw->onPropertyEvent({}); + // Wait for the update delivery. + std::this_thread::sleep_for(kWaitForUpdateDeliveryTime); + EXPECT_TRUE(*updateReceived1); + EXPECT_TRUE(*updateReceived2); + + // Reset. + *updateReceived1 = false; + *updateReceived2 = false; + + vehicleHardware1.reset(); + + // Client 1 exited, only client hardware 2 received update from the server. + EXPECT_FALSE(*updateReceived1); + EXPECT_FALSE(*updateReceived2); + testHardwareRaw->onPropertyEvent({}); + // Wait for the update delivery. + std::this_thread::sleep_for(kWaitForUpdateDeliveryTime); + EXPECT_FALSE(*updateReceived1); + EXPECT_TRUE(*updateReceived2); + + vehicleServer->Shutdown().Wait(); +} + +} // namespace android::hardware::automotive::vehicle::virtualization From a810fb25836706ba36af68cad30281f490b88b84 Mon Sep 17 00:00:00 2001 From: Hao Chen Date: Tue, 11 Apr 2023 15:27:44 -0700 Subject: [PATCH 910/998] Complete VHAL GRPC Interfaces Add missing operations from IVehicleHardware.h Bug: 266001013 Test: `atest GRPCVehicleHardwareUnitTest GRPCVehicleProxyServerUnitTest` Change-Id: Ida3533dedce49c49c4762b2f9a43997317f5d2c4 --- .../aidl/impl/grpc/GRPCVehicleHardware.cpp | 48 +++++++++++++++---- .../aidl/impl/grpc/GRPCVehicleProxyServer.cpp | 27 +++++++++++ .../aidl/impl/grpc/GRPCVehicleProxyServer.h | 10 ++++ .../aidl/impl/grpc/proto/VehicleServer.proto | 16 +++---- automotive/vehicle/aidl/impl/proto/Android.bp | 2 + .../automotive/vehicle/DumpOptions.proto | 23 +++++++++ .../automotive/vehicle/StatusCode.proto | 4 ++ .../automotive/vehicle/VehiclePropValue.proto | 4 ++ .../vehicle/VehiclePropValueRequest.proto | 11 +++++ 9 files changed, 127 insertions(+), 18 deletions(-) create mode 100644 automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/DumpOptions.proto diff --git a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.cpp b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.cpp index 015157d425..07422835d2 100644 --- a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleHardware.cpp @@ -152,21 +152,49 @@ void GRPCVehicleHardware::registerOnPropertySetErrorEvent( mOnSetErr = std::move(callback); } -DumpResult GRPCVehicleHardware::dump(const std::vector& /* options */) { - // TODO(chenhaosjtuacm): To be implemented. - return {}; +DumpResult GRPCVehicleHardware::dump(const std::vector& options) { + ::grpc::ClientContext context; + proto::DumpOptions protoDumpOptions; + proto::DumpResult protoDumpResult; + for (const auto& option : options) { + protoDumpOptions.add_options(option); + } + auto grpc_status = mGrpcStub->Dump(&context, protoDumpOptions, &protoDumpResult); + if (!grpc_status.ok()) { + LOG(ERROR) << __func__ << ": GRPC Dump Failed: " << grpc_status.error_message(); + return {}; + } + return { + .callerShouldDumpState = protoDumpResult.caller_should_dump_state(), + .buffer = protoDumpResult.buffer(), + }; } aidlvhal::StatusCode GRPCVehicleHardware::checkHealth() { - // TODO(chenhaosjtuacm): To be implemented. - return aidlvhal::StatusCode::OK; + ::grpc::ClientContext context; + proto::VehicleHalCallStatus protoStatus; + auto grpc_status = mGrpcStub->CheckHealth(&context, ::google::protobuf::Empty(), &protoStatus); + if (!grpc_status.ok()) { + LOG(ERROR) << __func__ << ": GRPC CheckHealth Failed: " << grpc_status.error_message(); + return aidlvhal::StatusCode::INTERNAL_ERROR; + } + return static_cast(protoStatus.status_code()); } -aidlvhal::StatusCode GRPCVehicleHardware::updateSampleRate(int32_t /* propId */, - int32_t /* areaId */, - float /* sampleRate */) { - // TODO(chenhaosjtuacm): To be implemented. - return aidlvhal::StatusCode::OK; +aidlvhal::StatusCode GRPCVehicleHardware::updateSampleRate(int32_t propId, int32_t areaId, + float sampleRate) { + ::grpc::ClientContext context; + proto::UpdateSampleRateRequest request; + proto::VehicleHalCallStatus protoStatus; + request.set_prop(propId); + request.set_area_id(areaId); + request.set_sample_rate(sampleRate); + auto grpc_status = mGrpcStub->UpdateSampleRate(&context, request, &protoStatus); + if (!grpc_status.ok()) { + LOG(ERROR) << __func__ << ": GRPC UpdateSampleRate Failed: " << grpc_status.error_message(); + return aidlvhal::StatusCode::INTERNAL_ERROR; + } + return static_cast(protoStatus.status_code()); } bool GRPCVehicleHardware::waitForConnected(std::chrono::milliseconds waitTime) { diff --git a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.cpp b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.cpp index e2fe97b1c7..af3dd595a1 100644 --- a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.cpp +++ b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.cpp @@ -155,6 +155,33 @@ GrpcVehicleProxyServer::GrpcVehicleProxyServer(std::string serverAddr, return ::grpc::Status::OK; } +::grpc::Status GrpcVehicleProxyServer::UpdateSampleRate( + ::grpc::ServerContext* context, const proto::UpdateSampleRateRequest* request, + proto::VehicleHalCallStatus* status) { + const auto status_code = mHardware->updateSampleRate(request->prop(), request->area_id(), + request->sample_rate()); + status->set_status_code(static_cast(status_code)); + return ::grpc::Status::OK; +} + +::grpc::Status GrpcVehicleProxyServer::CheckHealth(::grpc::ServerContext* context, + const ::google::protobuf::Empty*, + proto::VehicleHalCallStatus* status) { + status->set_status_code(static_cast(mHardware->checkHealth())); + return ::grpc::Status::OK; +} + +::grpc::Status GrpcVehicleProxyServer::Dump(::grpc::ServerContext* context, + const proto::DumpOptions* options, + proto::DumpResult* result) { + std::vector dumpOptionStrings(options->options().begin(), + options->options().end()); + auto dumpResult = mHardware->dump(dumpOptionStrings); + result->set_caller_should_dump_state(dumpResult.callerShouldDumpState); + result->set_buffer(dumpResult.buffer); + return ::grpc::Status::OK; +} + ::grpc::Status GrpcVehicleProxyServer::StartPropertyValuesStream( ::grpc::ServerContext* context, const ::google::protobuf::Empty* request, ::grpc::ServerWriter* stream) { diff --git a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.h b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.h index 01beec3949..3596354539 100644 --- a/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.h +++ b/automotive/vehicle/aidl/impl/grpc/GRPCVehicleProxyServer.h @@ -53,6 +53,16 @@ class GrpcVehicleProxyServer : public proto::VehicleServer::Service { const proto::VehiclePropValueRequests* requests, proto::GetValueResults* results) override; + ::grpc::Status UpdateSampleRate(::grpc::ServerContext* context, + const proto::UpdateSampleRateRequest* request, + proto::VehicleHalCallStatus* status) override; + + ::grpc::Status CheckHealth(::grpc::ServerContext* context, const ::google::protobuf::Empty*, + proto::VehicleHalCallStatus* status) override; + + ::grpc::Status Dump(::grpc::ServerContext* context, const proto::DumpOptions* options, + proto::DumpResult* result) override; + ::grpc::Status StartPropertyValuesStream( ::grpc::ServerContext* context, const ::google::protobuf::Empty* request, ::grpc::ServerWriter* stream) override; diff --git a/automotive/vehicle/aidl/impl/grpc/proto/VehicleServer.proto b/automotive/vehicle/aidl/impl/grpc/proto/VehicleServer.proto index 349019595b..22b11d8c87 100644 --- a/automotive/vehicle/aidl/impl/grpc/proto/VehicleServer.proto +++ b/automotive/vehicle/aidl/impl/grpc/proto/VehicleServer.proto @@ -18,20 +18,14 @@ syntax = "proto3"; package android.hardware.automotive.vehicle.proto; +import "android/hardware/automotive/vehicle/DumpOptions.proto"; +import "android/hardware/automotive/vehicle/DumpResult.proto"; import "android/hardware/automotive/vehicle/StatusCode.proto"; import "android/hardware/automotive/vehicle/VehiclePropConfig.proto"; import "android/hardware/automotive/vehicle/VehiclePropValue.proto"; import "android/hardware/automotive/vehicle/VehiclePropValueRequest.proto"; import "google/protobuf/empty.proto"; -message VehicleHalCallStatus { - StatusCode status_code = 1; -} - -message VehiclePropValues { - repeated VehiclePropValue values = 1; -} - service VehicleServer { rpc GetAllPropertyConfig(google.protobuf.Empty) returns (stream VehiclePropConfig) {} @@ -39,5 +33,11 @@ service VehicleServer { rpc GetValues(VehiclePropValueRequests) returns (GetValueResults) {} + rpc UpdateSampleRate(UpdateSampleRateRequest) returns (VehicleHalCallStatus) {} + + rpc CheckHealth(google.protobuf.Empty) returns (VehicleHalCallStatus) {} + + rpc Dump(DumpOptions) returns (DumpResult) {} + rpc StartPropertyValuesStream(google.protobuf.Empty) returns (stream VehiclePropValues) {} } diff --git a/automotive/vehicle/aidl/impl/proto/Android.bp b/automotive/vehicle/aidl/impl/proto/Android.bp index 709307d3e1..56fad7ed91 100644 --- a/automotive/vehicle/aidl/impl/proto/Android.bp +++ b/automotive/vehicle/aidl/impl/proto/Android.bp @@ -40,6 +40,7 @@ genrule { ":VehicleHalProtoFiles", ], out: [ + "android/hardware/automotive/vehicle/DumpOptions.pb.h", "android/hardware/automotive/vehicle/DumpResult.pb.h", "android/hardware/automotive/vehicle/StatusCode.pb.h", "android/hardware/automotive/vehicle/VehicleAreaConfig.pb.h", @@ -63,6 +64,7 @@ genrule { ":VehicleHalProtoFiles", ], out: [ + "android/hardware/automotive/vehicle/DumpOptions.pb.cc", "android/hardware/automotive/vehicle/DumpResult.pb.cc", "android/hardware/automotive/vehicle/StatusCode.pb.cc", "android/hardware/automotive/vehicle/VehicleAreaConfig.pb.cc", diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/DumpOptions.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/DumpOptions.proto new file mode 100644 index 0000000000..4bed927288 --- /dev/null +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/DumpOptions.proto @@ -0,0 +1,23 @@ +/* + * 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. + */ + +syntax = "proto3"; + +package android.hardware.automotive.vehicle.proto; + +message DumpOptions { + repeated string options = 1; +} diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/StatusCode.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/StatusCode.proto index 97cb0f88b2..63d7933e7d 100644 --- a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/StatusCode.proto +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/StatusCode.proto @@ -39,3 +39,7 @@ enum StatusCode { /* Something unexpected has happened in Vehicle HAL */ INTERNAL_ERROR = 5; }; + +message VehicleHalCallStatus { + StatusCode status_code = 1; +} diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValue.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValue.proto index 80c73cbb77..dda9ff5119 100644 --- a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValue.proto +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValue.proto @@ -52,3 +52,7 @@ message VehiclePropValue { /* This is used for properties of type VehiclePropertyType#STRING */ string string_value = 9; }; + +message VehiclePropValues { + repeated VehiclePropValue values = 1; +} diff --git a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValueRequest.proto b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValueRequest.proto index 749ad6adc8..c347a800c3 100644 --- a/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValueRequest.proto +++ b/automotive/vehicle/aidl/impl/proto/android/hardware/automotive/vehicle/VehiclePropValueRequest.proto @@ -26,6 +26,17 @@ message VehiclePropValueRequest { VehiclePropValue value = 2; }; +message UpdateSampleRateRequest { + /* Property identifier */ + int32 prop = 1; + + /* Area type(s) for non-global property it must be one of the value from + * VehicleArea* enums or 0 for global properties. */ + int32 area_id = 2; + + float sample_rate = 3; +}; + message SetValueResult { int64 request_id = 1; StatusCode status = 2; From dc90e2265fb6d710d50ea2ddce3705cc9bdf141b Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Mon, 10 Apr 2023 15:35:11 -0700 Subject: [PATCH 911/998] Print out content of VehiclePropValue when test fails Currently when a test fails, it prints out a byte representation of the object which is not helpful. Bug: 277359330 Bug: 277359630 Bug: 277359374 Bug: 277359394 Bug: 277359419 Bug: 277359421 Bug: 277359396 Bug: 277359260 Test: atest FakeVehicleHardwareTest Change-Id: I26c4260b2dbf5a71fbfe94e11c111b482337e6f5 --- .../hardware/test/FakeVehicleHardwareTest.cpp | 134 ++++++++++-------- 1 file changed, 72 insertions(+), 62 deletions(-) diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp index a50b4ad58e..65585d938e 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp @@ -37,6 +37,22 @@ #include #include +namespace aidl { +namespace android { +namespace hardware { +namespace automotive { +namespace vehicle { + +void PrintTo(const VehiclePropValue& value, std::ostream* os) { + *os << "\n( " << value.toString() << " )\n"; +} + +} // namespace vehicle +} // namespace automotive +} // namespace hardware +} // namespace android +} // namespace aidl + namespace android { namespace hardware { namespace automotive { @@ -1079,11 +1095,12 @@ TEST_F(FakeVehicleHardwareTest, testSetWaitForVhalAfterCarServiceCrash) { ASSERT_EQ(events.size(), 1u); // Erase the timestamp for comparison. events[0].timestamp = 0; - ASSERT_EQ(events[0], (VehiclePropValue{ - .prop = toInt(VehicleProperty::AP_POWER_STATE_REQ), - .status = VehiclePropertyStatus::AVAILABLE, - .value.int32Values = {toInt(VehicleApPowerStateReq::ON), 0}, - })); + auto expectedValue = VehiclePropValue{ + .prop = toInt(VehicleProperty::AP_POWER_STATE_REQ), + .status = VehiclePropertyStatus::AVAILABLE, + .value.int32Values = {toInt(VehicleApPowerStateReq::ON), 0}, + }; + ASSERT_EQ(events[0], expectedValue); } TEST_F(FakeVehicleHardwareTest, testGetObd2FreezeFrame) { @@ -1340,19 +1357,20 @@ TEST_F(FakeVehicleHardwareTest, testSwitchUser) { events = getChangedProperties(); ASSERT_EQ(events.size(), static_cast(1)); events[0].timestamp = 0; - ASSERT_EQ(events[0], (VehiclePropValue{ - .areaId = 0, - .prop = toInt(VehicleProperty::SWITCH_USER), - .value.int32Values = - { - // Request ID - 666, - // VEHICLE_RESPONSE - 3, - // SUCCESS - 1, - }, - })); + auto expectedValue = VehiclePropValue{ + .areaId = 0, + .prop = toInt(VehicleProperty::SWITCH_USER), + .value.int32Values = + { + // Request ID + 666, + // VEHICLE_RESPONSE + 3, + // SUCCESS + 1, + }, + }; + ASSERT_EQ(events[0], expectedValue); } TEST_F(FakeVehicleHardwareTest, testCreateUser) { @@ -1396,17 +1414,18 @@ TEST_F(FakeVehicleHardwareTest, testCreateUser) { events = getChangedProperties(); ASSERT_EQ(events.size(), static_cast(1)); events[0].timestamp = 0; - ASSERT_EQ(events[0], (VehiclePropValue{ - .areaId = 0, - .prop = toInt(VehicleProperty::CREATE_USER), - .value.int32Values = - { - // Request ID - 666, - // SUCCESS - 1, - }, - })); + auto expectedValue = VehiclePropValue{ + .areaId = 0, + .prop = toInt(VehicleProperty::CREATE_USER), + .value.int32Values = + { + // Request ID + 666, + // SUCCESS + 1, + }, + }; + ASSERT_EQ(events[0], expectedValue); } TEST_F(FakeVehicleHardwareTest, testInitialUserInfo) { @@ -1438,11 +1457,12 @@ TEST_F(FakeVehicleHardwareTest, testInitialUserInfo) { auto events = getChangedProperties(); ASSERT_EQ(events.size(), static_cast(1)); events[0].timestamp = 0; - EXPECT_EQ(events[0], (VehiclePropValue{ - .areaId = 0, - .prop = toInt(VehicleProperty::INITIAL_USER_INFO), - .value.int32Values = {3, 1, 11}, - })); + auto expectedValue = VehiclePropValue{ + .areaId = 0, + .prop = toInt(VehicleProperty::INITIAL_USER_INFO), + .value.int32Values = {3, 1, 11}, + }; + EXPECT_EQ(events[0], expectedValue); // Try to get create_user again, should return default value. clearChangedProperties(); @@ -1452,22 +1472,23 @@ TEST_F(FakeVehicleHardwareTest, testInitialUserInfo) { events = getChangedProperties(); ASSERT_EQ(events.size(), static_cast(1)); events[0].timestamp = 0; - EXPECT_EQ(events[0], (VehiclePropValue{ - .areaId = 0, - .prop = toInt(VehicleProperty::INITIAL_USER_INFO), - .value.int32Values = - { - // Request ID - 3, - // ACTION: DEFAULT - 0, - // User id: 0 - 0, - // Flags: 0 - 0, - }, - .value.stringValue = "||", - })); + expectedValue = VehiclePropValue{ + .areaId = 0, + .prop = toInt(VehicleProperty::INITIAL_USER_INFO), + .value.int32Values = + { + // Request ID + 3, + // ACTION: DEFAULT + 0, + // User id: 0 + 0, + // Flags: 0 + 0, + }, + .value.stringValue = "||", + }; + EXPECT_EQ(events[0], expectedValue); } TEST_F(FakeVehicleHardwareTest, testDumpAllProperties) { @@ -2580,18 +2601,7 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacTemperatureValueSuggestion) { EXPECT_EQ(events.size(), static_cast(1)); events[0].timestamp = 0; - EXPECT_EQ(events[0], (tc.expectedValuesToGet[0])) - << "Failed Test: " << tc.name << "\n" - << "Received - prop: " << events[0].prop << ", areaId: " << events[0].areaId - << ", floatValues: {" << events[0].value.floatValues[0] << ", " - << events[0].value.floatValues[1] << ", " << events[0].value.floatValues[2] << ", " - << events[0].value.floatValues[3] << "}\n" - << "Expected - prop: " << tc.expectedValuesToGet[0].prop - << ", areaId: " << tc.expectedValuesToGet[0].areaId << ", floatValues: {" - << tc.expectedValuesToGet[0].value.floatValues[0] << ", " - << tc.expectedValuesToGet[0].value.floatValues[1] << ", " - << tc.expectedValuesToGet[0].value.floatValues[2] << ", " - << tc.expectedValuesToGet[0].value.floatValues[3] << "}\n"; + EXPECT_EQ(events[0], tc.expectedValuesToGet[0]); clearChangedProperties(); } } From 5df458d2c054b675e09f3cb4d3e2bccc47e82910 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Mon, 10 Apr 2023 15:44:05 -0700 Subject: [PATCH 912/998] HVAC dependent properties should return NOT_AVAILABLE_DISABLED To be consistent with the new API in Android U, NOT_AVAILABLE_DISABLED is the more appropiate StatusCode. Bug: 255430764 Test: atest CtsCarTestCases:CarPropertyManagerTest Test: atest FakeVehicleHardwareTest Change-Id: I4c49f255817f1f9bc2888c99177c6dc666213ab6 --- .../aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp | 4 ++-- .../impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index 4544389143..096a6cda3f 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -471,7 +471,7 @@ FakeVehicleHardware::ValueResultType FakeVehicleHardware::maybeGetSpecialValue( if (isHvacPropAndHvacNotAvailable(propId, value.areaId)) { *isSpecialValue = true; - return StatusError(StatusCode::NOT_AVAILABLE) << "hvac not available"; + return StatusError(StatusCode::NOT_AVAILABLE_DISABLED) << "hvac not available"; } switch (propId) { @@ -562,7 +562,7 @@ VhalResult FakeVehicleHardware::maybeSetSpecialValue(const VehiclePropValu if (isHvacPropAndHvacNotAvailable(propId, value.areaId)) { *isSpecialValue = true; - return StatusError(StatusCode::NOT_AVAILABLE) << "hvac not available"; + return StatusError(StatusCode::NOT_AVAILABLE_DISABLED) << "hvac not available"; } switch (propId) { diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp index 65585d938e..254d30f9a2 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp @@ -1183,7 +1183,7 @@ TEST_F(FakeVehicleHardwareTest, testGetHvacPropNotAvailable) { if (areaId == powerDependentAreaId) { EXPECT_FALSE(getValueResult.ok()); - EXPECT_EQ(getValueResult.error(), StatusCode::NOT_AVAILABLE); + EXPECT_EQ(getValueResult.error(), StatusCode::NOT_AVAILABLE_DISABLED); } else { EXPECT_TRUE(getValueResult.ok()); } @@ -1216,7 +1216,7 @@ TEST_F(FakeVehicleHardwareTest, testSetHvacPropNotAvailable) { .value.int32Values = {1}}); if (areaId == powerDependentAreaId) { - EXPECT_EQ(status, StatusCode::NOT_AVAILABLE); + EXPECT_EQ(status, StatusCode::NOT_AVAILABLE_DISABLED); } else { EXPECT_EQ(status, StatusCode::OK); } From 76dbff1e9ca9395932fbaeb612e58472aaaef211 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Wed, 12 Apr 2023 11:48:14 -0700 Subject: [PATCH 913/998] Use IsSubsetOf matcher for comparing changed vs updated properties The previous implementation did not work as intended because it was comparing using equality. This means that if there is a mismatch in the number of elements in each list it would fail. Bug: 277359330 Bug: 277359630 Bug: 277359374 Bug: 277359394 Bug: 277359419 Bug: 277359421 Bug: 277359396 Bug: 277359260 Test: atest FakeVehicleHardwareTest Change-Id: If624ee39271725c6158c004181104ca6b30d4598 --- .../impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp index 254d30f9a2..b399bdfc65 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp @@ -83,6 +83,7 @@ using ::testing::ContainerEq; using ::testing::ContainsRegex; using ::testing::Eq; using ::testing::HasSubstr; +using ::testing::IsSubsetOf; using ::testing::WhenSortedBy; using std::chrono::milliseconds; @@ -1066,7 +1067,7 @@ TEST_P(FakeVehicleHardwareSpecialValuesTest, testSetSpecialProperties) { // Some of the updated properties might be the same as default config, thus not causing // a property change event. So the changed properties should be a subset of all the updated // properties. - ASSERT_THAT(getChangedProperties(), WhenSortedBy(mPropValueCmp, Eq(gotValues))); + ASSERT_THAT(getChangedProperties(), IsSubsetOf(gotValues)); } INSTANTIATE_TEST_SUITE_P( From f5b38af6dffc6bebc5261ae68f4b03a5142db439 Mon Sep 17 00:00:00 2001 From: Patty Huang Date: Thu, 23 Mar 2023 23:19:00 +0800 Subject: [PATCH 914/998] Always use audio_configuration_changed_cb_ to notify the config update There is a new API `isStreamActive` can indicate the stream handle state. We don't need to use soft_audio_configuration_change_cb to update the connection map and audio location Bug: 249614160 Bug: 277857154 Test: LE audio offload disappear and later join with downmix enable Change-Id: I02357ebe09425525e356ba0f793a3f081953d866 --- .../aidl_session/BluetoothAudioSession.cpp | 66 +------------------ .../aidl_session/BluetoothAudioSession.h | 16 ----- .../BluetoothAudioSessionControl.h | 19 ------ 3 files changed, 2 insertions(+), 99 deletions(-) diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp index 2b0caadeae..ee5527e62d 100644 --- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp +++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp @@ -60,14 +60,12 @@ void BluetoothAudioSession::OnSessionStarted( LOG(ERROR) << __func__ << " - SessionType=" << toString(session_type_) << " MqDescriptor Invalid"; audio_config_ = nullptr; - leaudio_connection_map_ = nullptr; } else { stack_iface_ = stack_iface; latency_modes_ = latency_modes; LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_) << ", AudioConfiguration=" << audio_config.toString(); ReportSessionStatus(); - is_streaming_ = false; } } @@ -76,13 +74,11 @@ void BluetoothAudioSession::OnSessionEnded() { bool toggled = IsSessionReady(); LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_); audio_config_ = nullptr; - leaudio_connection_map_ = nullptr; stack_iface_ = nullptr; UpdateDataPath(nullptr); if (toggled) { ReportSessionStatus(); } - is_streaming_ = false; } /*** @@ -110,14 +106,6 @@ const AudioConfiguration BluetoothAudioSession::GetAudioConfig() { return *audio_config_; } -const AudioConfiguration BluetoothAudioSession::GetLeAudioConnectionMap() { - std::lock_guard guard(mutex_); - if (!IsSessionReady()) { - return AudioConfiguration(LeAudioConfiguration{}); - } - return *leaudio_connection_map_; -} - void BluetoothAudioSession::ReportAudioConfigChanged( const AudioConfiguration& audio_config) { if (session_type_ != @@ -134,47 +122,7 @@ void BluetoothAudioSession::ReportAudioConfigChanged( return; } - if (is_streaming_) { - if (audio_config_ == nullptr) { - LOG(ERROR) << __func__ << " for SessionType=" << toString(session_type_) - << " audio_config_ is nullptr during streaming. It shouldn't " - "be happened"; - return; - } - - auto new_leaudio_config = - audio_config.get(); - auto current_leaudio_config = - (*audio_config_).get(); - if (new_leaudio_config.codecType != current_leaudio_config.codecType) { - LOG(ERROR) - << __func__ << " for SessionType=" << toString(session_type_) - << " codec type changed during streaming. It shouldn't be happened "; - } - auto new_lc3_config = new_leaudio_config.leAudioCodecConfig - .get(); - auto current_lc3_config = current_leaudio_config.leAudioCodecConfig - .get(); - if ((new_lc3_config.pcmBitDepth != current_lc3_config.pcmBitDepth) || - (new_lc3_config.samplingFrequencyHz != - current_lc3_config.samplingFrequencyHz) || - (new_lc3_config.frameDurationUs != - current_lc3_config.frameDurationUs) || - (new_lc3_config.octetsPerFrame != current_lc3_config.octetsPerFrame) || - (new_lc3_config.blocksPerSdu != current_lc3_config.blocksPerSdu)) { - LOG(ERROR) - << __func__ << " for SessionType=" << toString(session_type_) - << " lc3 config changed during streaming. It shouldn't be happened"; - return; - } - - leaudio_connection_map_ = - std::make_unique(audio_config); - } else { - audio_config_ = std::make_unique(audio_config); - leaudio_connection_map_ = - std::make_unique(audio_config); - } + audio_config_ = std::make_unique(audio_config); if (observers_.empty()) { LOG(WARNING) << __func__ << " - SessionType=" << toString(session_type_) @@ -187,11 +135,7 @@ void BluetoothAudioSession::ReportAudioConfigChanged( LOG(INFO) << __func__ << " for SessionType=" << toString(session_type_) << ", bluetooth_audio=0x" << ::android::base::StringPrintf("%04x", cookie); - if (is_streaming_) { - if (cb->soft_audio_configuration_changed_cb_ != nullptr) { - cb->soft_audio_configuration_changed_cb_(cookie); - } - } else if (cb->audio_configuration_changed_cb_ != nullptr) { + if (cb->audio_configuration_changed_cb_ != nullptr) { cb->audio_configuration_changed_cb_(cookie); } } @@ -481,12 +425,6 @@ void BluetoothAudioSession::ReportControlStatus(bool start_resp, << " has NO port state observer"; return; } - if (start_resp && status == BluetoothAudioStatus::SUCCESS) { - is_streaming_ = true; - } else if (!start_resp && (status == BluetoothAudioStatus::SUCCESS || - status == BluetoothAudioStatus::RECONFIGURATION)) { - is_streaming_ = false; - } for (auto& observer : observers_) { uint16_t cookie = observer.first; std::shared_ptr callback = observer.second; diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h index faf4ffbabe..5bf17bd3d2 100644 --- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h +++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.h @@ -102,13 +102,6 @@ struct PortStatusCallbacks { ***/ std::function low_latency_mode_allowed_cb_; - /*** - * soft_audio_configuration_changed_cb_ - when the Bluetooth stack change - * the streamMap during the streaming, the BluetoothAudioProvider will invoke - * this callback to report to the bluetooth_audio module. - * @param: cookie - indicates which bluetooth_audio output should handle - ***/ - std::function soft_audio_configuration_changed_cb_; }; class BluetoothAudioSession { @@ -165,12 +158,6 @@ class BluetoothAudioSession { ***/ const AudioConfiguration GetAudioConfig(); - /*** - * The control function is for the bluetooth_audio module to get the current - * LE audio connection map - ***/ - const AudioConfiguration GetLeAudioConnectionMap(); - /*** * The report function is used to report that the Bluetooth stack has notified * the audio configuration changed, and will invoke @@ -219,11 +206,8 @@ class BluetoothAudioSession { std::unique_ptr data_mq_; // audio data configuration for both software and offloading std::unique_ptr audio_config_; - std::unique_ptr leaudio_connection_map_; std::vector latency_modes_; bool low_latency_allowed_ = true; - // saving those steaming state based on the session_type - bool is_streaming_ = false; // saving those registered bluetooth_audio's callbacks std::unordered_map> diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionControl.h b/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionControl.h index 881c6c10b2..0782c824e1 100644 --- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionControl.h +++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSessionControl.h @@ -94,25 +94,6 @@ class BluetoothAudioSessionControl { } } - /*** - * The control API for the bluetooth_audio module to get current - * LE audio connection map - ***/ - static const AudioConfiguration GetLeAudioConnectionMap( - const SessionType& session_type) { - std::shared_ptr session_ptr = - BluetoothAudioSessionInstance::GetSessionInstance(session_type); - if ((session_type == - SessionType::LE_AUDIO_HARDWARE_OFFLOAD_ENCODING_DATAPATH || - session_type == - SessionType::LE_AUDIO_HARDWARE_OFFLOAD_DECODING_DATAPATH) && - session_ptr != nullptr) { - return session_ptr->GetLeAudioConnectionMap(); - } - - return AudioConfiguration(LeAudioConfiguration{}); - } - /*** * Those control APIs for the bluetooth_audio module to start / suspend / stop From 94220b8613bb3c101fbbcc7d59e3fda5d349ebfc Mon Sep 17 00:00:00 2001 From: Maxim Pleshivenkov Date: Thu, 13 Apr 2023 00:12:07 -0400 Subject: [PATCH 915/998] Update makefile. Migrate to use andoid.frameworks.automotive.powerpolicy-V2-ndk. Bug: 277954369 Test: manual build Change-Id: I5331284b329b9aad731d86a1d1a26cc0b042387a --- automotive/audiocontrol/aidl/default/Android.bp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automotive/audiocontrol/aidl/default/Android.bp b/automotive/audiocontrol/aidl/default/Android.bp index dde05c3582..435c2d63de 100644 --- a/automotive/audiocontrol/aidl/default/Android.bp +++ b/automotive/audiocontrol/aidl/default/Android.bp @@ -30,7 +30,7 @@ cc_binary { shared_libs: [ "android.hardware.audio.common@7.0-enums", "android.hardware.audio.common-V1-ndk", - "android.frameworks.automotive.powerpolicy-V1-ndk", + "android.frameworks.automotive.powerpolicy-V2-ndk", "android.hardware.automotive.audiocontrol-V3-ndk", "libbase", "libbinder_ndk", From b37f9a8a835aaded4ac740c679cf8d2b07297103 Mon Sep 17 00:00:00 2001 From: Yuyang Huang Date: Fri, 14 Apr 2023 12:26:32 +0900 Subject: [PATCH 916/998] Add @VsrTest annotation to Apf test Bug: 259309511 Test: atest VtsHalWifiStaIfaceTargetTest Change-Id: I860e7bff6a31ae7871a6041ab76c2c685b7c8c38 --- wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp index adc9b73ed1..288f20acf4 100644 --- a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp +++ b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp @@ -96,6 +96,7 @@ TEST_P(WifiStaIfaceAidlTest, GetFeatureSet) { * Ensures the APF packet filter is fully supported as required in VSR 14: * https://docs.partner.android.com/gms/policies/vsr/vsr-14 */ +// @VsrTest = 5.3.12 TEST_P(WifiStaIfaceAidlTest, CheckApfIsSupported) { // It is not required to check the vendor API level is at least U here // because the Wi-Fi AIDL interface is launched with Android U(VSR-14). From 6cfe1f86e9a78ef93ad3edea2b278e267000ee74 Mon Sep 17 00:00:00 2001 From: Hao Chen Date: Fri, 14 Apr 2023 15:44:22 -0700 Subject: [PATCH 917/998] VTS: Skip the Check if getDisplayStateById is not Supported Test: atest VtsHalEvsTargetTest Bug: 276974949 Change-Id: I44d41b937611e06823fe8d2c8ef9d1da783bd17a --- .../evs/aidl/vts/VtsHalEvsTargetTest.cpp | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp b/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp index a6d99adae5..3419b3c98d 100644 --- a/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp +++ b/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp @@ -2291,11 +2291,12 @@ TEST_P(EvsAidlTest, DisplayStates) { } for (const auto displayIdToQuery : displayIds) { DisplayState state; - if (displayIdToQuery == displayId) { - EXPECT_TRUE(mEnumerator->getDisplayStateById(displayIdToQuery, &state).isOk()); + bool get_state_ok = + mEnumerator->getDisplayStateById(displayIdToQuery, &state).isOk(); + if (displayIdToQuery != displayId) { + EXPECT_FALSE(get_state_ok); + } else if (get_state_ok) { EXPECT_EQ(state, DisplayState::NOT_VISIBLE); - } else { - EXPECT_FALSE(mEnumerator->getDisplayStateById(displayIdToQuery, &state).isOk()); } } @@ -2313,11 +2314,12 @@ TEST_P(EvsAidlTest, DisplayStates) { } for (const auto displayIdToQuery : displayIds) { DisplayState state; - if (displayIdToQuery == displayId) { - EXPECT_TRUE(mEnumerator->getDisplayStateById(displayIdToQuery, &state).isOk()); + bool get_state_ok = + mEnumerator->getDisplayStateById(displayIdToQuery, &state).isOk(); + if (displayIdToQuery != displayId) { + EXPECT_FALSE(get_state_ok); + } else if (get_state_ok) { EXPECT_EQ(state, DisplayState::VISIBLE_ON_NEXT_FRAME); - } else { - EXPECT_FALSE(mEnumerator->getDisplayStateById(displayIdToQuery, &state).isOk()); } } @@ -2343,11 +2345,12 @@ TEST_P(EvsAidlTest, DisplayStates) { } for (const auto displayIdToQuery : displayIds) { DisplayState state; - if (displayIdToQuery == displayId) { - EXPECT_TRUE(mEnumerator->getDisplayStateById(displayIdToQuery, &state).isOk()); + bool get_state_ok = + mEnumerator->getDisplayStateById(displayIdToQuery, &state).isOk(); + if (displayIdToQuery != displayId) { + EXPECT_FALSE(get_state_ok); + } else if (get_state_ok) { EXPECT_EQ(state, DisplayState::VISIBLE); - } else { - EXPECT_FALSE(mEnumerator->getDisplayStateById(displayIdToQuery, &state).isOk()); } } @@ -2366,11 +2369,12 @@ TEST_P(EvsAidlTest, DisplayStates) { } for (const auto displayIdToQuery : displayIds) { DisplayState state; - if (displayIdToQuery == displayId) { - EXPECT_TRUE(mEnumerator->getDisplayStateById(displayIdToQuery, &state).isOk()); + bool get_state_ok = + mEnumerator->getDisplayStateById(displayIdToQuery, &state).isOk(); + if (displayIdToQuery != displayId) { + EXPECT_FALSE(get_state_ok); + } else if (get_state_ok) { EXPECT_EQ(state, DisplayState::NOT_VISIBLE); - } else { - EXPECT_FALSE(mEnumerator->getDisplayStateById(displayIdToQuery, &state).isOk()); } } From 974a74d896af3615ca05de5ea1311329610ce0e6 Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Sat, 15 Apr 2023 01:01:44 +0000 Subject: [PATCH 918/998] wifi: Skip SetStrictConversativePeerMode VTS test SetStrictConversativePeerMode HAL API is added in AIDL version 2. So if the HAL interface version is less than 2, skip the test. Bug: 278169264 Bug: 277318919 Test: atest VtsHalWifiSupplicantStaNetworkTargetTest Change-Id: I7f8ace88b0f37679ecaedd5370b47e220c437d50 --- .../aidl/vts/functional/supplicant_sta_network_aidl_test.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp index 0e2b72c285..973b56a98d 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp +++ b/wifi/supplicant/aidl/vts/functional/supplicant_sta_network_aidl_test.cpp @@ -654,6 +654,11 @@ TEST_P(SupplicantStaNetworkAidlTest, SetEapEncryptedImsiIdentity) { * SetStrictConservativePeerMode */ TEST_P(SupplicantStaNetworkAidlTest, SetStrictConversativePeerMode) { + int32_t version = 0; + sta_network_->getInterfaceVersion(&version); + if (version < 2) { + GTEST_SKIP() << "Skipping test since it is not supported on this interface version"; + } EXPECT_TRUE(sta_network_->setStrictConservativePeerMode(true).isOk()); EXPECT_TRUE(sta_network_->setStrictConservativePeerMode(false).isOk()); } From 899b03c945a4688086547e72aab1d538e1af3e6b Mon Sep 17 00:00:00 2001 From: Sarah Chin Date: Mon, 17 Apr 2023 16:52:59 -0700 Subject: [PATCH 919/998] Require SIM card for all VTS tests We check SIM card status is PRESENT before running any VTS tests, so ensure that it's enforced in the configs as well. Test: atest VtsHalRadioTargetTest Bug: 237504027 Change-Id: I1b2c317e21db118e4b957804feb76f266d887b20 --- radio/1.0/vts/functional/vts_hal_radio_target_test.xml | 1 + radio/1.1/vts/functional/AndroidTest.xml | 1 + radio/1.2/vts/functional/AndroidTest.xml | 1 + radio/1.3/vts/functional/AndroidTest.xml | 1 + radio/1.4/vts/functional/AndroidTest.xml | 1 + radio/aidl/vts/AndroidTest.xml | 3 ++- 6 files changed, 7 insertions(+), 1 deletion(-) diff --git a/radio/1.0/vts/functional/vts_hal_radio_target_test.xml b/radio/1.0/vts/functional/vts_hal_radio_target_test.xml index 82af2ee388..7aaadff8db 100644 --- a/radio/1.0/vts/functional/vts_hal_radio_target_test.xml +++ b/radio/1.0/vts/functional/vts_hal_radio_target_test.xml @@ -16,6 +16,7 @@ - - android.hardware.radio.satellite - 1 - - IRadioSatellite - slot1 - slot2 - slot3 - - android.hardware.radio.ims.media 1 From 210a66568be826953528f65d9d3605cc23b27261 Mon Sep 17 00:00:00 2001 From: Aaqib Ismail Date: Mon, 24 Apr 2023 12:28:07 -0700 Subject: [PATCH 931/998] Mention that ErrorState and StatusCode must match Bug: 277972734 Test: presubmit Change-Id: If9da64ff1a163dce2b5f913187c18ba032a16016 --- .../automotive/vehicle/VehicleProperty.aidl | 36 +++++++++++++++---- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index ce3a840683..6dca41f9f1 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -4629,9 +4629,7 @@ enum VehicleProperty { /** * Lane Centering Assist (LCA) commands. * - * Commands to activate and suspend LCA. They are only valid when LANE_CENTERING_ASSIST_ENABLED - * = true. Otherwise, these commands must return StatusCode#NOT_AVAILABLE or - * StatusCode#NOT_AVAILABLE_DISABLED. + * Commands to activate and suspend LCA. * * When the command ACTIVATE from LaneCenteringAssistCommmand is sent, * LANE_CENTERING_ASSIST_STATE must be set to LaneCenteringAssistState#ACTIVATION_REQUESTED. @@ -4643,6 +4641,14 @@ enum VehicleProperty { * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues must be defined unless * all enum values of LaneCenteringAssistCommand are supported. * + * When this property is not available because LCA is disabled (i.e. + * LANE_CENTERING_ASSIST_ENABLED is false), this property must return + * StatusCode#NOT_AVAILABLE_DISABLED. If LANE_CENTERING_ASSIST_STATE is implemented and the + * state is set to an ErrorState value, then this property must return a StatusCode that aligns + * with the ErrorState value. For example, if LANE_CENTERING_ASSIST_STATE is set to + * ErrorState#NOT_AVAILABLE_SPEED_LOW, then this property must return + * StatusCode#NOT_AVAILABLE_SPEED_LOW. + * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.WRITE * @data_enum LaneCenteringAssistCommmand @@ -4794,7 +4800,11 @@ enum VehicleProperty { * this property must return StatusCode#INVALID_ARG. * * When this property is not available because CC is disabled (i.e. CRUISE_CONTROL_ENABLED is - * false), this property must return StatusCode#NOT_AVAILABLE_DISABLED. + * false), this property must return StatusCode#NOT_AVAILABLE_DISABLED. If CRUISE_CONTROL_STATE + * is implemented and the state is set to an ErrorState value, then this property must return a + * StatusCode that aligns with the ErrorState value. For example, if CRUISE_CONTROL_STATE is set + * to ErrorState#NOT_AVAILABLE_SPEED_LOW, then this property must return + * StatusCode#NOT_AVAILABLE_SPEED_LOW. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.WRITE @@ -4813,7 +4823,11 @@ enum VehicleProperty { * The minFloatValue represents the lower bound of the target speed. * * When this property is not available because CC is disabled (i.e. CRUISE_CONTROL_ENABLED is - * false), this property must return StatusCode#NOT_AVAILABLE_DISABLED. + * false), this property must return StatusCode#NOT_AVAILABLE_DISABLED. If CRUISE_CONTROL_STATE + * is implemented and the state is set to an ErrorState value, then this property must return a + * StatusCode that aligns with the ErrorState value. For example, if CRUISE_CONTROL_STATE is set + * to ErrorState#NOT_AVAILABLE_SPEED_LOW, then this property must return + * StatusCode#NOT_AVAILABLE_SPEED_LOW. * * @change_mode VehiclePropertyChangeMode.ON_CHANGE * @access VehiclePropertyAccess.READ @@ -4836,7 +4850,11 @@ enum VehicleProperty { * writable. * * When this property is not available because CC is disabled (i.e. CRUISE_CONTROL_ENABLED is - * false), this property must return StatusCode#NOT_AVAILABLE_DISABLED. + * false), this property must return StatusCode#NOT_AVAILABLE_DISABLED. If CRUISE_CONTROL_STATE + * is implemented and the state is set to an ErrorState value, then this property must return a + * StatusCode that aligns with the ErrorState value. For example, if CRUISE_CONTROL_STATE is set + * to ErrorState#NOT_AVAILABLE_SPEED_LOW, then this property must return + * StatusCode#NOT_AVAILABLE_SPEED_LOW. * * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to * implement it as VehiclePropertyAccess.READ only. @@ -4865,7 +4883,11 @@ enum VehicleProperty { * StatusCode.NOT_AVAILABLE. * * When this property is not available because CC is disabled (i.e. CRUISE_CONTROL_ENABLED is - * false), this property must return StatusCode#NOT_AVAILABLE_DISABLED. + * false), this property must return StatusCode#NOT_AVAILABLE_DISABLED. If CRUISE_CONTROL_STATE + * is implemented and the state is set to an ErrorState value, then this property must return a + * StatusCode that aligns with the ErrorState value. For example, if CRUISE_CONTROL_STATE is set + * to ErrorState#NOT_AVAILABLE_SPEED_LOW, then this property must return + * StatusCode#NOT_AVAILABLE_SPEED_LOW. * * @change_mode VehiclePropertyChangeMode.CONTINUOUS * @access VehiclePropertyAccess.READ From 18a1915f049e8f114ccebe217fffef677bfb30a7 Mon Sep 17 00:00:00 2001 From: Andrew Scull Date: Mon, 24 Apr 2023 19:09:09 +0000 Subject: [PATCH 932/998] Strictly deprecate IRPC test mode key generation It's already documented that IRPC v3 doesn't make use of test mode keys however VTS still required support for their generation. Fix this and simplify implementation of the v3 HAL by expecting an error in all cases that the deprecated test mode keys are seen. IRPC v3 also fully deprecated the EEK meaning a v3 implementation must unconditionally report CURVE_NONE for supportedEekCurve. The VTS tests are enhanced with contextual version constants rather than reusing constants with seemingly unrelated names. Bug: 278013975 Test: atest VtsHalRemotelyProvisionedComponentTargetTest (cherry picked from https://android-review.googlesource.com/q/commit:f2ae193680d6f02a2394423f805aadd13a7d152b) Merged-In: I5709a0b1cd77eb28e677f64bb781fad58d91570a Change-Id: I5709a0b1cd77eb28e677f64bb781fad58d91570a --- .../IRemotelyProvisionedComponent.aidl | 4 ++ .../VtsRemotelyProvisionedComponentTests.cpp | 59 ++++++++++--------- 2 files changed, 35 insertions(+), 28 deletions(-) diff --git a/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl b/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl index 461357d4e3..2a4cba1f0e 100644 --- a/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl +++ b/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl @@ -134,6 +134,10 @@ interface IRemotelyProvisionedComponent { * are marked (see the definition of PublicKey in the MacedPublicKey structure) to * prevent them from being confused with production keys. * + * This parameter has been deprecated since version 3 of the HAL and will always be + * false. From v3, if this parameter is true, the method must raise a + * ServiceSpecificException with an error of code of STATUS_REMOVED. + * * @param out MacedPublicKey macedPublicKey contains the public key of the generated key pair, * MACed so that generateCertificateRequest can easily verify, without the * privateKeyHandle, that the contained public key is for remote certification. diff --git a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp index 94bfbb48de..8906543e7f 100644 --- a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp +++ b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp @@ -47,7 +47,11 @@ using ::std::vector; namespace { constexpr int32_t VERSION_WITH_UNIQUE_ID_SUPPORT = 2; + +constexpr int32_t VERSION_WITHOUT_EEK = 3; constexpr int32_t VERSION_WITHOUT_TEST_MODE = 3; +constexpr int32_t VERSION_WITH_CERTIFICATE_REQUEST_V2 = 3; +constexpr int32_t VERSION_WITH_SUPPORTED_NUM_KEYS_IN_CSR = 3; constexpr uint8_t MIN_CHALLENGE_SIZE = 0; constexpr uint8_t MAX_CHALLENGE_SIZE = 64; @@ -226,21 +230,13 @@ TEST_P(GetHardwareInfoTests, supportsValidCurve) { RpcHardwareInfo hwInfo; ASSERT_TRUE(provisionable_->getHardwareInfo(&hwInfo).isOk()); - const std::set validCurves = {RpcHardwareInfo::CURVE_P256, RpcHardwareInfo::CURVE_25519}; - // First check for the implementations that supports only IRPC V3+. - if (rpcHardwareInfo.versionNumber >= VERSION_WITHOUT_TEST_MODE) { - bytevec keysToSignMac; - DeviceInfo deviceInfo; - ProtectedData protectedData; - auto status = provisionable_->generateCertificateRequest(false, {}, {}, {}, &deviceInfo, - &protectedData, &keysToSignMac); - if (!status.isOk() && - (status.getServiceSpecificError() == BnRemotelyProvisionedComponent::STATUS_REMOVED)) { - ASSERT_EQ(hwInfo.supportedEekCurve, RpcHardwareInfo::CURVE_NONE) - << "Invalid curve: " << hwInfo.supportedEekCurve; - return; - } + if (rpcHardwareInfo.versionNumber >= VERSION_WITHOUT_EEK) { + ASSERT_EQ(hwInfo.supportedEekCurve, RpcHardwareInfo::CURVE_NONE) + << "Invalid curve: " << hwInfo.supportedEekCurve; + return; } + + const std::set validCurves = {RpcHardwareInfo::CURVE_P256, RpcHardwareInfo::CURVE_25519}; ASSERT_EQ(validCurves.count(hwInfo.supportedEekCurve), 1) << "Invalid curve: " << hwInfo.supportedEekCurve; } @@ -264,7 +260,7 @@ TEST_P(GetHardwareInfoTests, uniqueId) { * Verify implementation supports at least MIN_SUPPORTED_NUM_KEYS_IN_CSR keys in a CSR. */ TEST_P(GetHardwareInfoTests, supportedNumKeysInCsr) { - if (rpcHardwareInfo.versionNumber < VERSION_WITHOUT_TEST_MODE) { + if (rpcHardwareInfo.versionNumber < VERSION_WITH_SUPPORTED_NUM_KEYS_IN_CSR) { return; } @@ -365,6 +361,13 @@ TEST_P(GenerateKeyTests, generateEcdsaP256Key_testMode) { bytevec privateKeyBlob; bool testMode = true; auto status = provisionable_->generateEcdsaP256KeyPair(testMode, &macedPubKey, &privateKeyBlob); + + if (rpcHardwareInfo.versionNumber >= VERSION_WITHOUT_TEST_MODE) { + ASSERT_FALSE(status.isOk()); + EXPECT_EQ(status.getServiceSpecificError(), BnRemotelyProvisionedComponent::STATUS_REMOVED); + return; + } + ASSERT_TRUE(status.isOk()); check_maced_pubkey(macedPubKey, testMode, nullptr); } @@ -410,7 +413,7 @@ class CertificateRequestTest : public CertificateRequestTestBase { CertificateRequestTestBase::SetUp(); ASSERT_FALSE(HasFatalFailure()); - if (rpcHardwareInfo.versionNumber >= VERSION_WITHOUT_TEST_MODE) { + if (rpcHardwareInfo.versionNumber >= VERSION_WITH_CERTIFICATE_REQUEST_V2) { GTEST_SKIP() << "This test case only applies to RKP v1 and v2. " << "RKP version discovered: " << rpcHardwareInfo.versionNumber; } @@ -688,7 +691,7 @@ class CertificateRequestV2Test : public CertificateRequestTestBase { CertificateRequestTestBase::SetUp(); ASSERT_FALSE(HasFatalFailure()); - if (rpcHardwareInfo.versionNumber < VERSION_WITHOUT_TEST_MODE) { + if (rpcHardwareInfo.versionNumber < VERSION_WITH_CERTIFICATE_REQUEST_V2) { GTEST_SKIP() << "This test case only applies to RKP v3 and above. " << "RKP version discovered: " << rpcHardwareInfo.versionNumber; } @@ -802,23 +805,23 @@ TEST_P(CertificateRequestV2Test, NonEmptyRequestCorruptMac) { } /** - * Generate a non-empty certificate request in prod mode, with test keys. Must fail with - * STATUS_TEST_KEY_IN_PRODUCTION_REQUEST. + * Call generateCertificateRequest(). Make sure it's removed. */ -TEST_P(CertificateRequestV2Test, NonEmptyRequest_testKeyInProdCert) { - generateKeys(true /* testMode */, 1 /* numKeys */); - - bytevec csr; - auto status = provisionable_->generateCertificateRequestV2(keysToSign_, challenge_, &csr); +TEST_P(CertificateRequestV2Test, CertificateRequestV1Removed_prodMode) { + bytevec keysToSignMac; + DeviceInfo deviceInfo; + ProtectedData protectedData; + auto status = provisionable_->generateCertificateRequest( + false /* testMode */, {} /* keysToSign */, {} /* EEK chain */, challenge_, &deviceInfo, + &protectedData, &keysToSignMac); ASSERT_FALSE(status.isOk()) << status.getMessage(); - ASSERT_EQ(status.getServiceSpecificError(), - BnRemotelyProvisionedComponent::STATUS_TEST_KEY_IN_PRODUCTION_REQUEST); + EXPECT_EQ(status.getServiceSpecificError(), BnRemotelyProvisionedComponent::STATUS_REMOVED); } /** - * Call generateCertificateRequest(). Make sure it's removed. + * Call generateCertificateRequest() in test mode. Make sure it's removed. */ -TEST_P(CertificateRequestV2Test, CertificateRequestV1Removed) { +TEST_P(CertificateRequestV2Test, CertificateRequestV1Removed_testMode) { bytevec keysToSignMac; DeviceInfo deviceInfo; ProtectedData protectedData; From e6b1f319c0807c2dfe4190ce2b3e13c44f6e9262 Mon Sep 17 00:00:00 2001 From: Lei Ju Date: Fri, 21 Apr 2023 11:32:55 -0700 Subject: [PATCH 933/998] Update CHRE HAL VTS test Remove the tests related to null callbacks and the restriction of nonempty preloaded nanoapps. Bug: 279220092 Test: VTS test and manual test Change-Id: Iaa8918f398e71ba25d47c64bd36e73746bf09b84 --- contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp index f544d833d9..89a9e23a77 100644 --- a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp +++ b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp @@ -133,10 +133,6 @@ TEST_P(ContextHubAidl, TestRegisterCallback) { ASSERT_TRUE(contextHub->registerCallback(getHubId(), cb).isOk()); } -TEST_P(ContextHubAidl, TestRegisterNullCallback) { - ASSERT_TRUE(contextHub->registerCallback(getHubId(), nullptr).isOk()); -} - // Helper callback that puts the async appInfo callback data into a promise class QueryAppsCallback : public android::hardware::contexthub::BnContextHubCallback { public: @@ -195,7 +191,6 @@ TEST_P(ContextHubAidl, TestGetPreloadedNanoappIds) { GTEST_SKIP() << "Not supported -> old API; or not implemented"; } else { ASSERT_TRUE(status.isOk()); - ASSERT_FALSE(preloadedNanoappIds.empty()); } } @@ -323,8 +318,6 @@ void ContextHubAidl::testSettingChanged(Setting setting) { ASSERT_TRUE(contextHub->onSettingChanged(setting, true /* enabled */).isOk()); ASSERT_TRUE(contextHub->onSettingChanged(setting, false /* enabled */).isOk()); - - ASSERT_TRUE(contextHub->registerCallback(getHubId(), nullptr).isOk()); } TEST_P(ContextHubAidl, TestOnLocationSettingChanged) { From bc279868ec916031d0cb064bd1d2da0d4d5cd5ec Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Tue, 25 Apr 2023 16:43:17 +0000 Subject: [PATCH 934/998] Freeze android.hardware.tetheroffload Removed the "owner" field in the aidl_interface module so it is frozen with the rest of the interfaces in the future. Test: m android.hardware.tetheroffload-freeze-api Bug: 279471180 Change-Id: I15bbeb74a58211cc7037ba60c1a38c02bd742984 --- tetheroffload/aidl/Android.bp | 9 +++- .../android.hardware.tetheroffload/1/.hash | 1 + .../tetheroffload/ForwardedStats.aidl | 39 ++++++++++++++++ .../hardware/tetheroffload/IOffload.aidl | 46 +++++++++++++++++++ .../tetheroffload/IPv4AddrPortPair.aidl | 39 ++++++++++++++++ .../ITetheringOffloadCallback.aidl | 39 ++++++++++++++++ .../tetheroffload/NatTimeoutUpdate.aidl | 40 ++++++++++++++++ .../tetheroffload/NetworkProtocol.aidl | 39 ++++++++++++++++ .../tetheroffload/OffloadCallbackEvent.aidl | 43 +++++++++++++++++ 9 files changed, 294 insertions(+), 1 deletion(-) create mode 100644 tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/.hash create mode 100644 tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/ForwardedStats.aidl create mode 100644 tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/IOffload.aidl create mode 100644 tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/IPv4AddrPortPair.aidl create mode 100644 tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/ITetheringOffloadCallback.aidl create mode 100644 tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/NatTimeoutUpdate.aidl create mode 100644 tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/NetworkProtocol.aidl create mode 100644 tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/OffloadCallbackEvent.aidl diff --git a/tetheroffload/aidl/Android.bp b/tetheroffload/aidl/Android.bp index b3b6ebf091..6de27c3462 100644 --- a/tetheroffload/aidl/Android.bp +++ b/tetheroffload/aidl/Android.bp @@ -4,7 +4,6 @@ package { aidl_interface { name: "android.hardware.tetheroffload", - owner: "google", vendor_available: true, srcs: ["android/hardware/tetheroffload/*.aidl"], stability: "vintf", @@ -24,4 +23,12 @@ aidl_interface { apps_enabled: false, }, }, + versions_with_info: [ + { + version: "1", + imports: [], + }, + ], + frozen: true, + } diff --git a/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/.hash b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/.hash new file mode 100644 index 0000000000..e7b452e355 --- /dev/null +++ b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/.hash @@ -0,0 +1 @@ +ba3f0342e13af942628a6c00e920d55ce8ad1ea3 diff --git a/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/ForwardedStats.aidl b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/ForwardedStats.aidl new file mode 100644 index 0000000000..493a69868f --- /dev/null +++ b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/ForwardedStats.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tetheroffload; +@VintfStability +parcelable ForwardedStats { + long rxBytes; + long txBytes; +} diff --git a/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/IOffload.aidl b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/IOffload.aidl new file mode 100644 index 0000000000..9a58b1fbba --- /dev/null +++ b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/IOffload.aidl @@ -0,0 +1,46 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tetheroffload; +@VintfStability +interface IOffload { + void initOffload(in ParcelFileDescriptor fd1, in ParcelFileDescriptor fd2, in android.hardware.tetheroffload.ITetheringOffloadCallback cb); + void stopOffload(); + void setLocalPrefixes(in String[] prefixes); + android.hardware.tetheroffload.ForwardedStats getForwardedStats(in String upstream); + void setDataWarningAndLimit(in String upstream, in long warningBytes, in long limitBytes); + void setUpstreamParameters(in String iface, in String v4Addr, in String v4Gw, in String[] v6Gws); + void addDownstream(in String iface, in String prefix); + void removeDownstream(in String iface, in String prefix); + const int ERROR_CODE_UNUSED = 0; +} diff --git a/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/IPv4AddrPortPair.aidl b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/IPv4AddrPortPair.aidl new file mode 100644 index 0000000000..2b42f0c056 --- /dev/null +++ b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/IPv4AddrPortPair.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tetheroffload; +@VintfStability +parcelable IPv4AddrPortPair { + String addr; + int port; +} diff --git a/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/ITetheringOffloadCallback.aidl b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/ITetheringOffloadCallback.aidl new file mode 100644 index 0000000000..4eb7d04d00 --- /dev/null +++ b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/ITetheringOffloadCallback.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tetheroffload; +@VintfStability +interface ITetheringOffloadCallback { + oneway void onEvent(in android.hardware.tetheroffload.OffloadCallbackEvent event); + oneway void updateTimeout(in android.hardware.tetheroffload.NatTimeoutUpdate params); +} diff --git a/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/NatTimeoutUpdate.aidl b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/NatTimeoutUpdate.aidl new file mode 100644 index 0000000000..9eddaa205f --- /dev/null +++ b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/NatTimeoutUpdate.aidl @@ -0,0 +1,40 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tetheroffload; +@VintfStability +parcelable NatTimeoutUpdate { + android.hardware.tetheroffload.IPv4AddrPortPair src; + android.hardware.tetheroffload.IPv4AddrPortPair dst; + android.hardware.tetheroffload.NetworkProtocol proto; +} diff --git a/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/NetworkProtocol.aidl b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/NetworkProtocol.aidl new file mode 100644 index 0000000000..52bd2a6c50 --- /dev/null +++ b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/NetworkProtocol.aidl @@ -0,0 +1,39 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tetheroffload; +@Backing(type="int") @VintfStability +enum NetworkProtocol { + TCP = 6, + UDP = 17, +} diff --git a/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/OffloadCallbackEvent.aidl b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/OffloadCallbackEvent.aidl new file mode 100644 index 0000000000..026e18ed1d --- /dev/null +++ b/tetheroffload/aidl/aidl_api/android.hardware.tetheroffload/1/android/hardware/tetheroffload/OffloadCallbackEvent.aidl @@ -0,0 +1,43 @@ +/* + * 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. + */ +/////////////////////////////////////////////////////////////////////////////// +// 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 -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.hardware.tetheroffload; +@Backing(type="int") @VintfStability +enum OffloadCallbackEvent { + OFFLOAD_STARTED = 1, + OFFLOAD_STOPPED_ERROR = 2, + OFFLOAD_STOPPED_UNSUPPORTED = 3, + OFFLOAD_SUPPORT_AVAILABLE = 4, + OFFLOAD_STOPPED_LIMIT_REACHED = 5, + OFFLOAD_WARNING_REACHED = 6, +} From 38bff8b0c7e656af1c7e35d5966f97df635faa5c Mon Sep 17 00:00:00 2001 From: "zhengyu.zhan" Date: Mon, 24 Apr 2023 15:03:53 +0800 Subject: [PATCH 935/998] Fix VtsHalWifiSupplicantP2pIfaceTargetTest failed issue supplicant_test_utils::initializeService() only stop Supplicant, don't start it. refer Android T code, It should start Supplicant when initializeService(). Bug: 279572212 Test: VtsHalWifiSupplicantP2pIfaceTargetTest pass Change-Id: I9f4b3e21ee0865eb95d71f7f832b2eb405de9607 --- wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h b/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h index 7eeab6870d..f2cb3f665c 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h +++ b/wifi/supplicant/aidl/vts/functional/supplicant_test_utils.h @@ -64,9 +64,9 @@ void stopSupplicantService() { void initializeService() { if (SupplicantAidlTestUtils::useAidlService()) { - SupplicantAidlTestUtils::stopSupplicantService(); + SupplicantAidlTestUtils::initializeService(); } else { - SupplicantLegacyTestUtils::stopSupplicantService(); + SupplicantLegacyTestUtils::initializeService(); } } From a45f94d60d688e02bc9fa5ed416e944dbe8f0979 Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Mon, 10 Apr 2023 12:05:57 -0700 Subject: [PATCH 936/998] Add reference ivn HAL impl. Add reference ivn HAL impl. The reference implementation reads a JSON config file and provides static information. Test: atest IvnAndroidDeviceServiceUnitTest Bug: 274139217 Change-Id: Idc55d3ac8573bd1eeff096c4f12d8bfd935fb859 --- .../impl/default/Android.bp | 58 ++++++ .../impl/default/config/Android.bp | 32 +++ .../impl/default/config/DefaultConfig.json | 61 ++++++ .../default/include/IvnAndroidDeviceService.h | 72 +++++++ .../impl/default/ivn-default-service.rc | 4 + .../impl/default/ivn-default-service.xml | 7 + .../impl/default/src/IvnAndroidDeviceImpl.cpp | 58 ++++++ .../default/src/IvnAndroidDeviceService.cpp | 196 ++++++++++++++++++ .../impl/default/test/Android.bp | 42 ++++ .../test/IvnAndroidDeviceServiceUnittest.cpp | 110 ++++++++++ 10 files changed, 640 insertions(+) create mode 100644 automotive/ivn_android_device/impl/default/Android.bp create mode 100644 automotive/ivn_android_device/impl/default/config/Android.bp create mode 100644 automotive/ivn_android_device/impl/default/config/DefaultConfig.json create mode 100644 automotive/ivn_android_device/impl/default/include/IvnAndroidDeviceService.h create mode 100644 automotive/ivn_android_device/impl/default/ivn-default-service.rc create mode 100644 automotive/ivn_android_device/impl/default/ivn-default-service.xml create mode 100644 automotive/ivn_android_device/impl/default/src/IvnAndroidDeviceImpl.cpp create mode 100644 automotive/ivn_android_device/impl/default/src/IvnAndroidDeviceService.cpp create mode 100644 automotive/ivn_android_device/impl/default/test/Android.bp create mode 100644 automotive/ivn_android_device/impl/default/test/IvnAndroidDeviceServiceUnittest.cpp diff --git a/automotive/ivn_android_device/impl/default/Android.bp b/automotive/ivn_android_device/impl/default/Android.bp new file mode 100644 index 0000000000..98c1f58ee5 --- /dev/null +++ b/automotive/ivn_android_device/impl/default/Android.bp @@ -0,0 +1,58 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_library { + name: "IvnAndroidDeviceService", + vendor_available: true, + local_include_dirs: ["include"], + export_include_dirs: ["include"], + srcs: [ + "src/IvnAndroidDeviceService.cpp", + ], + whole_static_libs: [ + "android.hardware.automotive.ivn-V1-ndk", + ], + shared_libs: [ + "libbase", + "libbinder_ndk", + "libjsoncpp", + "liblog", + "libutils", + ], +} + +cc_binary { + name: "android.hardware.automotive.ivn@V1-default-service", + vendor: true, + relative_install_path: "hw", + local_include_dirs: ["include"], + srcs: ["src/IvnAndroidDeviceImpl.cpp"], + whole_static_libs: ["IvnAndroidDeviceService"], + shared_libs: [ + "libbase", + "libbinder_ndk", + "libjsoncpp", + "liblog", + "libutils", + ], + required: ["Prebuilt_IvnAndroidDeviceServiceDefaultConfig_JSON"], + vintf_fragments: ["ivn-default-service.xml"], + init_rc: ["ivn-default-service.rc"], +} diff --git a/automotive/ivn_android_device/impl/default/config/Android.bp b/automotive/ivn_android_device/impl/default/config/Android.bp new file mode 100644 index 0000000000..03c4d1b215 --- /dev/null +++ b/automotive/ivn_android_device/impl/default/config/Android.bp @@ -0,0 +1,32 @@ +/* + * 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 { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +filegroup { + name: "IvnAndroidDeviceServiceDefaultConfig_Json", + srcs: ["DefaultConfig.json"], +} + +prebuilt_etc { + name: "Prebuilt_IvnAndroidDeviceServiceDefaultConfig_JSON", + filename_from_src: true, + src: "DefaultConfig.json", + sub_dir: "automotive/IvnConfig/", + vendor: true, +} diff --git a/automotive/ivn_android_device/impl/default/config/DefaultConfig.json b/automotive/ivn_android_device/impl/default/config/DefaultConfig.json new file mode 100644 index 0000000000..45663e2645 --- /dev/null +++ b/automotive/ivn_android_device/impl/default/config/DefaultConfig.json @@ -0,0 +1,61 @@ +{ + "MyDeviceId": 0, + "Devices": [ + { + "DeviceId": 0, + "OccupantZones": [ + { + "ZoneId": 0, + "OccupantType": "DRIVER", + "Seat": 1, + "Comments": "Occupant zone for driver and FRONT_LEFT seat" + }, + { + "ZoneId": 1, + "OccupantType": "FRONT_PASSENGER", + "Seat": 4, + "Comments": "Occupant zone for FRONT_RIGHT passenger" + } + ], + "EndpointInfo": { + "IpAddress": "10.10.10.1", + "PortNumber": 1234, + "BrandName": "MyBrand", + "DeviceName": "MyDevice", + "ProductName": "MyProduct", + "ManufacturerName": "MyCompany", + "ModelName": "MyModel", + "SerialNumber": "Serial1234" + }, + "Comments": "Device for front row" + }, + { + "DeviceId": 1, + "OccupantZones": [ + { + "ZoneId": 2, + "OccupantType": "REAR_PASSENGER", + "Seat": 16 + }, + { + "ZoneId": 3, + "OccupantType": "REAR_PASSENGER", + "Seat": 64 + } + ], + "EndpointInfo": { + "IpAddress": "10.10.10.2", + "PortNumber": 2345, + "BrandName": "MyBrand", + "DeviceName": "MyDevice", + "ProductName": "MyProduct", + "ManufacturerName": "MyCompany", + "ModelName": "MyModel", + "SerialNumber": "Serial2345" + }, + "Comments": "Device for back row" + } + ], + "Comment": + "This simulates a vehicle with two Android devices, one for front row, one for back row" +} diff --git a/automotive/ivn_android_device/impl/default/include/IvnAndroidDeviceService.h b/automotive/ivn_android_device/impl/default/include/IvnAndroidDeviceService.h new file mode 100644 index 0000000000..c0cc9fea2d --- /dev/null +++ b/automotive/ivn_android_device/impl/default/include/IvnAndroidDeviceService.h @@ -0,0 +1,72 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include +#include +#include + +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace ivn { + +struct DeviceInfo { + std::vector occupantZones; + aidl::android::hardware::automotive::ivn::EndpointInfo endpointInfo; +}; + +class IvnAndroidDeviceService + : public aidl::android::hardware::automotive::ivn::BnIvnAndroidDevice { + public: + explicit IvnAndroidDeviceService(std::string_view configPath); + + // Initialize the service, returns true on success. + bool init(); + + ndk::ScopedAStatus getMyDeviceId(int* deviceId) override; + + ndk::ScopedAStatus getOtherDeviceIds(std::vector* deviceIds) override; + + ndk::ScopedAStatus getDeviceIdForOccupantZone(int zoneId, int* deviceId) override; + + ndk::ScopedAStatus getOccupantZonesForDevice( + int androidDeviceId, + std::vector* occupantZones) + override; + + ndk::ScopedAStatus getMyEndpointInfo( + aidl::android::hardware::automotive::ivn::EndpointInfo* endpointInfo) override; + + ndk::ScopedAStatus getEndpointInfoForDevice( + int androidDeviceId, + aidl::android::hardware::automotive::ivn::EndpointInfo* endpointInfo) override; + + private: + int mMyDeviceId; + std::unordered_map mDeviceInfoById; + std::string_view mConfigPath; +}; + +} // namespace ivn +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/ivn_android_device/impl/default/ivn-default-service.rc b/automotive/ivn_android_device/impl/default/ivn-default-service.rc new file mode 100644 index 0000000000..070b2591be --- /dev/null +++ b/automotive/ivn_android_device/impl/default/ivn-default-service.rc @@ -0,0 +1,4 @@ +service vendor.ivn-default /vendor/bin/hw/android.hardware.automotive.ivn@V1-default-service + class hal + user vehicle_network + group system inet diff --git a/automotive/ivn_android_device/impl/default/ivn-default-service.xml b/automotive/ivn_android_device/impl/default/ivn-default-service.xml new file mode 100644 index 0000000000..481bc0a08f --- /dev/null +++ b/automotive/ivn_android_device/impl/default/ivn-default-service.xml @@ -0,0 +1,7 @@ + + + android.hardware.automotive.ivn + 1 + IIvnAndroidDevice/default + + diff --git a/automotive/ivn_android_device/impl/default/src/IvnAndroidDeviceImpl.cpp b/automotive/ivn_android_device/impl/default/src/IvnAndroidDeviceImpl.cpp new file mode 100644 index 0000000000..fdf677661a --- /dev/null +++ b/automotive/ivn_android_device/impl/default/src/IvnAndroidDeviceImpl.cpp @@ -0,0 +1,58 @@ +/* + * 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. + */ + +#define LOG_TAG "IvnAndroidDeviceImpl" + +#include "IvnAndroidDeviceService.h" + +#include +#include +#include +#include + +constexpr char SERVICE_NAME[] = "android.hardware.automotive.ivn.IIvnAndroidDevice/default"; +constexpr char DEFAULT_CONFIG_DIR[] = "/vendor/etc/automotive/IvnConfig/DefaultConfig.json"; + +int main(int /* argc */, char* /* argv */[]) { + LOG(INFO) << "Registering IvnAndroidDeviceService as service..."; + auto service = + ndk::SharedRefBase::make( + DEFAULT_CONFIG_DIR); + if (!service->init()) { + LOG(ERROR) << "Failed to init IvnAndroidDeviceService"; + exit(1); + } + + binder_exception_t err = AServiceManager_addService(service->asBinder().get(), SERVICE_NAME); + if (err != EX_NONE) { + LOG(ERROR) << "Failed to register IvnAndroidDeviceService service, exception: " << err; + exit(1); + } + + if (!ABinderProcess_setThreadPoolMaxThreadCount(1)) { + LOG(ERROR) << "Failed to set thread pool max thread count"; + exit(1); + } + ABinderProcess_startThreadPool(); + + LOG(INFO) << "IvnAndroidDeviceService Ready"; + + ABinderProcess_joinThreadPool(); + + LOG(ERROR) << "IvnAndroidDeviceService init failed! Should not reach here"; + + return 0; +} diff --git a/automotive/ivn_android_device/impl/default/src/IvnAndroidDeviceService.cpp b/automotive/ivn_android_device/impl/default/src/IvnAndroidDeviceService.cpp new file mode 100644 index 0000000000..71454d5d40 --- /dev/null +++ b/automotive/ivn_android_device/impl/default/src/IvnAndroidDeviceService.cpp @@ -0,0 +1,196 @@ +/* + * 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. + */ + +#include "IvnAndroidDeviceService.h" + +#include +#include +#include +#include +#include +#include + +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace ivn { + +namespace { + +using ::aidl::android::hardware::automotive::ivn::ConnectProtocol; +using ::aidl::android::hardware::automotive::ivn::EndpointInfo; +using ::aidl::android::hardware::automotive::ivn::HardwareIdentifiers; +using ::aidl::android::hardware::automotive::ivn::OccupantType; +using ::aidl::android::hardware::automotive::ivn::OccupantZoneInfo; +using ::ndk::ScopedAStatus; + +constexpr int IVN_ERROR_GENERIC = -1; + +} // namespace + +IvnAndroidDeviceService::IvnAndroidDeviceService(std::string_view configPath) { + mConfigPath = configPath; +} + +bool IvnAndroidDeviceService::init() { + std::ifstream configStream(mConfigPath); + if (!configStream) { + LOG(ERROR) << "couldn't open " << mConfigPath << " for parsing."; + return false; + } + Json::CharReaderBuilder builder; + Json::Value root; + std::string errs; + if (!Json::parseFromStream(builder, configStream, &root, &errs)) { + LOG(ERROR) << "Failed to parse config JSON stream, error: " << errs; + return false; + } + if (!root.isObject()) { + LOG(ERROR) << "Root must be an object"; + return false; + } + if (!root.isMember("MyDeviceId")) { + LOG(ERROR) << "Must contain 'MyDeviceId' field"; + return false; + } + mMyDeviceId = root["MyDeviceId"].asInt(); + if (!root.isMember("Devices") || !root["Devices"].isArray()) { + LOG(ERROR) << "Must contain 'Devices' field as array"; + return false; + } + Json::Value& devices = root["Devices"]; + for (unsigned int i = 0; i < devices.size(); i++) { + Json::Value& device = devices[i]; + int deviceId = device["DeviceId"].asInt(); + DeviceInfo deviceInfo = {}; + Json::Value& occupantZones = device["OccupantZones"]; + for (unsigned int j = 0; j < occupantZones.size(); j++) { + Json::Value& occupantZone = occupantZones[j]; + int zoneId = occupantZone["ZoneId"].asInt(); + std::string occupantTypeStr = occupantZone["OccupantType"].asString(); + int seat = occupantZone["Seat"].asInt(); + OccupantType occupantType; + if (occupantTypeStr == "DRIVER") { + occupantType = OccupantType::DRIVER; + } else if (occupantTypeStr == "FRONT_PASSENGER") { + occupantType = OccupantType::FRONT_PASSENGER; + } else if (occupantTypeStr == "REAR_PASSENGER") { + occupantType = OccupantType::REAR_PASSENGER; + } else { + LOG(ERROR) << "Unknown occupant type: " << occupantTypeStr; + return false; + } + OccupantZoneInfo occupantZoneInfo = { + .zoneId = zoneId, .occupantType = occupantType, .seat = seat}; + deviceInfo.occupantZones.push_back(std::move(occupantZoneInfo)); + } + Json::Value& ep = device["EndpointInfo"]; + EndpointInfo endpointInfo = {}; + endpointInfo.connectProtocol = ConnectProtocol::TCP_IP; + endpointInfo.ipAddress = ep["IpAddress"].asString(); + endpointInfo.portNumber = ep["PortNumber"].asInt(); + HardwareIdentifiers hardwareId = {}; + if (ep.isMember("BrandName")) { + hardwareId.brandName = ep["BrandName"].asString(); + } + if (ep.isMember("DeviceName")) { + hardwareId.deviceName = ep["DeviceName"].asString(); + } + if (ep.isMember("ProductName")) { + hardwareId.productName = ep["ProductName"].asString(); + } + if (ep.isMember("ManufacturerName")) { + hardwareId.manufacturerName = ep["ManufacturerName"].asString(); + } + if (ep.isMember("ModelName")) { + hardwareId.modelName = ep["ModelName"].asString(); + } + if (ep.isMember("SerialNumber")) { + hardwareId.serialNumber = ep["SerialNumber"].asString(); + } + endpointInfo.hardwareId = hardwareId; + deviceInfo.endpointInfo = endpointInfo; + mDeviceInfoById[deviceId] = deviceInfo; + } + if (mDeviceInfoById.find(mMyDeviceId) == mDeviceInfoById.end()) { + LOG(ERROR) << "My device ID is not in the device info list"; + return false; + } + return true; +} + +ScopedAStatus IvnAndroidDeviceService::getMyDeviceId(int* deviceId) { + *deviceId = mMyDeviceId; + return ScopedAStatus::ok(); +} + +ScopedAStatus IvnAndroidDeviceService::getOtherDeviceIds(std::vector* deviceIds) { + deviceIds->clear(); + for (const auto& [deviceId, _] : mDeviceInfoById) { + if (deviceId == mMyDeviceId) { + continue; + } + deviceIds->push_back(deviceId); + } + return ScopedAStatus::ok(); +} + +ScopedAStatus IvnAndroidDeviceService::getDeviceIdForOccupantZone(int zoneId, int* outDeviceId) { + for (const auto& [deviceId, deviceInfo] : mDeviceInfoById) { + for (const auto& occupantZoneInfo : deviceInfo.occupantZones) { + if (occupantZoneInfo.zoneId == zoneId) { + *outDeviceId = deviceId; + return ScopedAStatus::ok(); + } + } + } + return ScopedAStatus::fromServiceSpecificErrorWithMessage(IVN_ERROR_GENERIC, + "Occupant zone not found"); +} + +ScopedAStatus IvnAndroidDeviceService::getOccupantZonesForDevice( + int androidDeviceId, std::vector* occupantZones) { + if (mDeviceInfoById.find(androidDeviceId) == mDeviceInfoById.end()) { + return ScopedAStatus::fromServiceSpecificErrorWithMessage(IVN_ERROR_GENERIC, + "Android device ID not found"); + } + for (const auto& occupantZoneInfo : mDeviceInfoById[androidDeviceId].occupantZones) { + occupantZones->push_back(occupantZoneInfo); + } + return ScopedAStatus::ok(); +} + +ScopedAStatus IvnAndroidDeviceService::getMyEndpointInfo(EndpointInfo* endpointInfo) { + *endpointInfo = mDeviceInfoById[mMyDeviceId].endpointInfo; + return ScopedAStatus::ok(); +} + +ScopedAStatus IvnAndroidDeviceService::getEndpointInfoForDevice(int androidDeviceId, + EndpointInfo* endpointInfo) { + if (mDeviceInfoById.find(androidDeviceId) == mDeviceInfoById.end()) { + return ScopedAStatus::fromServiceSpecificErrorWithMessage(IVN_ERROR_GENERIC, + "Android device ID not found"); + } + *endpointInfo = mDeviceInfoById[androidDeviceId].endpointInfo; + return ScopedAStatus::ok(); +} + +} // namespace ivn +} // namespace automotive +} // namespace hardware +} // namespace android diff --git a/automotive/ivn_android_device/impl/default/test/Android.bp b/automotive/ivn_android_device/impl/default/test/Android.bp new file mode 100644 index 0000000000..a100575de3 --- /dev/null +++ b/automotive/ivn_android_device/impl/default/test/Android.bp @@ -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. + */ + +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_test { + name: "IvnAndroidDeviceServiceUnitTest", + vendor: true, + srcs: ["*.cpp"], + whole_static_libs: [ + "IvnAndroidDeviceService", + ], + shared_libs: [ + "libbase", + "libbinder_ndk", + "libjsoncpp", + "liblog", + "libutils", + ], + static_libs: [ + "libgtest", + ], + data: [ + ":IvnAndroidDeviceServiceDefaultConfig_Json", + ], + test_suites: ["device-tests"], +} diff --git a/automotive/ivn_android_device/impl/default/test/IvnAndroidDeviceServiceUnittest.cpp b/automotive/ivn_android_device/impl/default/test/IvnAndroidDeviceServiceUnittest.cpp new file mode 100644 index 0000000000..bc8e69fd8f --- /dev/null +++ b/automotive/ivn_android_device/impl/default/test/IvnAndroidDeviceServiceUnittest.cpp @@ -0,0 +1,110 @@ +/* + * 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. + */ + +#include "IvnAndroidDeviceService.h" + +#include +#include +#include +#include + +namespace android { +namespace hardware { +namespace automotive { +namespace ivn { + +using ::aidl::android::hardware::automotive::ivn::OccupantType; +using ::aidl::android::hardware::automotive::ivn::OccupantZoneInfo; +using ::ndk::ScopedAStatus; + +class IvnAndroidDeviceServiceUnitTest : public ::testing::Test { + public: + virtual void SetUp() override { + mService = ndk::SharedRefBase::make( + android::base::GetExecutableDirectory() + "/DefaultConfig.json"); + mService->init(); + } + + std::shared_ptr mService; +}; + +TEST_F(IvnAndroidDeviceServiceUnitTest, TestGetMyDeviceId) { + int deviceId = -1; + + ScopedAStatus status = mService->getMyDeviceId(&deviceId); + + ASSERT_TRUE(status.isOk()); + ASSERT_EQ(deviceId, 0); +} + +TEST_F(IvnAndroidDeviceServiceUnitTest, TestGetOtherDeviceIds) { + std::vector deviceIds; + + ScopedAStatus status = mService->getOtherDeviceIds(&deviceIds); + + ASSERT_TRUE(status.isOk()); + ASSERT_EQ(deviceIds, std::vector({1})); +} + +TEST_F(IvnAndroidDeviceServiceUnitTest, TestGetDeviceIdForOccupantZone) { + int deviceId = -1; + + ScopedAStatus status = mService->getDeviceIdForOccupantZone(/*zoneId=*/0, &deviceId); + + ASSERT_TRUE(status.isOk()); + EXPECT_EQ(deviceId, 0); + + status = mService->getDeviceIdForOccupantZone(/*zoneId=*/1, &deviceId); + + ASSERT_TRUE(status.isOk()); + EXPECT_EQ(deviceId, 0); + + status = mService->getDeviceIdForOccupantZone(/*zoneId=*/2, &deviceId); + + ASSERT_TRUE(status.isOk()); + EXPECT_EQ(deviceId, 1); + + status = mService->getDeviceIdForOccupantZone(/*zoneId=*/3, &deviceId); + + ASSERT_TRUE(status.isOk()); + EXPECT_EQ(deviceId, 1); + + status = mService->getDeviceIdForOccupantZone(/*zoneId=*/4, &deviceId); + + ASSERT_FALSE(status.isOk()); +} + +TEST_F(IvnAndroidDeviceServiceUnitTest, TestGetOccupantZonesForDevice) { + std::vector occupantZones; + + ScopedAStatus status = + mService->getOccupantZonesForDevice(/*androidDeviceId=*/0, &occupantZones); + ASSERT_TRUE(status.isOk()); + EXPECT_EQ(occupantZones.size(), 2); + if (occupantZones.size() == 2) { + EXPECT_EQ(occupantZones[0].zoneId, 0); + EXPECT_EQ(occupantZones[0].occupantType, OccupantType::DRIVER); + EXPECT_EQ(occupantZones[0].seat, 1); + EXPECT_EQ(occupantZones[1].zoneId, 1); + EXPECT_EQ(occupantZones[1].occupantType, OccupantType::FRONT_PASSENGER); + EXPECT_EQ(occupantZones[1].seat, 4); + } +} + +} // namespace ivn +} // namespace automotive +} // namespace hardware +} // namespace android From 57f771d49df45c5766b02bdac09f60d0d67d303c Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Wed, 26 Apr 2023 18:49:51 +0000 Subject: [PATCH 937/998] Fix Visualizer and Volume type UUID Bug: b/279432911 Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit Change-Id: I3e7d145aa37fb67d78cf05c06da22f74c0ea07ad --- audio/aidl/aidl_api/android.hardware.audio.effect/1/.hash | 2 +- .../1/android/hardware/audio/effect/Descriptor.aidl | 4 ++-- .../current/android/hardware/audio/effect/Descriptor.aidl | 4 ++-- audio/aidl/android/hardware/audio/effect/Descriptor.aidl | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/.hash b/audio/aidl/aidl_api/android.hardware.audio.effect/1/.hash index 9914460874..b71ab296ef 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.effect/1/.hash +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/.hash @@ -1 +1 @@ -504db4349f884424a8acc3f2fc0f6bb74dbfcdf0 +34b618a587cb9977ee0cd13b173e699d2dcdb320 diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Descriptor.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Descriptor.aidl index 82dae97d24..115da1db57 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Descriptor.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/1/android/hardware/audio/effect/Descriptor.aidl @@ -50,8 +50,8 @@ parcelable Descriptor { const String EFFECT_TYPE_UUID_PRESET_REVERB = "47382d60-ddd8-11db-bf3a-0002a5d5c51b"; const String EFFECT_TYPE_UUID_SPATIALIZER = "ccd4cf09-a79d-46c2-9aae-06a1698d6c8f"; const String EFFECT_TYPE_UUID_VIRTUALIZER = "37cc2c00-dddd-11db-8577-0002a5d5c51b"; - const String EFFECT_TYPE_UUID_VISUALIZER = "d069d9e0-8329-11df-9168-0002a5d5c51b"; - const String EFFECT_TYPE_UUID_VOLUME = "fa81a2b8-588b-11ed-9b6a-0242ac120002"; + const String EFFECT_TYPE_UUID_VISUALIZER = "e46b26a0-dddd-11db-8afd-0002a5d5c51b"; + const String EFFECT_TYPE_UUID_VOLUME = "09e8ede0-ddde-11db-b4f6-0002a5d5c51b"; @VintfStability parcelable Identity { android.media.audio.common.AudioUuid type; diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl index 82dae97d24..115da1db57 100644 --- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl +++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Descriptor.aidl @@ -50,8 +50,8 @@ parcelable Descriptor { const String EFFECT_TYPE_UUID_PRESET_REVERB = "47382d60-ddd8-11db-bf3a-0002a5d5c51b"; const String EFFECT_TYPE_UUID_SPATIALIZER = "ccd4cf09-a79d-46c2-9aae-06a1698d6c8f"; const String EFFECT_TYPE_UUID_VIRTUALIZER = "37cc2c00-dddd-11db-8577-0002a5d5c51b"; - const String EFFECT_TYPE_UUID_VISUALIZER = "d069d9e0-8329-11df-9168-0002a5d5c51b"; - const String EFFECT_TYPE_UUID_VOLUME = "fa81a2b8-588b-11ed-9b6a-0242ac120002"; + const String EFFECT_TYPE_UUID_VISUALIZER = "e46b26a0-dddd-11db-8afd-0002a5d5c51b"; + const String EFFECT_TYPE_UUID_VOLUME = "09e8ede0-ddde-11db-b4f6-0002a5d5c51b"; @VintfStability parcelable Identity { android.media.audio.common.AudioUuid type; diff --git a/audio/aidl/android/hardware/audio/effect/Descriptor.aidl b/audio/aidl/android/hardware/audio/effect/Descriptor.aidl index 2fbc401f0f..b152f76d74 100644 --- a/audio/aidl/android/hardware/audio/effect/Descriptor.aidl +++ b/audio/aidl/android/hardware/audio/effect/Descriptor.aidl @@ -96,11 +96,11 @@ parcelable Descriptor { /** * UUID for visualizer effect type. */ - const String EFFECT_TYPE_UUID_VISUALIZER = "d069d9e0-8329-11df-9168-0002a5d5c51b"; + const String EFFECT_TYPE_UUID_VISUALIZER = "e46b26a0-dddd-11db-8afd-0002a5d5c51b"; /** * UUID for Volume effect type. */ - const String EFFECT_TYPE_UUID_VOLUME = "fa81a2b8-588b-11ed-9b6a-0242ac120002"; + const String EFFECT_TYPE_UUID_VOLUME = "09e8ede0-ddde-11db-b4f6-0002a5d5c51b"; /** * This structure completely identifies an effect implementation. From e2d763f25d58303d32fa67dcd3abff29330edd28 Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Wed, 26 Apr 2023 21:24:08 +0000 Subject: [PATCH 938/998] Fix Result enum doc in AIDL broadcast radio HAL Bug: 279789152 Test: atest VtsHalBroadcastradioAidlTargetTest Change-Id: I204f6c8836534e1bf6ff6309ca0172a2cbcc64a6 --- .../aidl/android/hardware/broadcastradio/Result.aidl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl index 9f7263a1f1..f775bd04ee 100644 --- a/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl +++ b/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl @@ -39,7 +39,7 @@ enum Result { INVALID_ARGUMENTS, /** - * Error used when the service is of invalid state (i.e. callback + * Error used when the service is on invalid state (i.e. callback * is not registered for IBroadcastRadio). */ INVALID_STATE, @@ -50,13 +50,13 @@ enum Result { NOT_SUPPORTED, /** - * Error used when a tune, seek, step or operation is not completed - * within {@link IBroadcastRadio#LIST_COMPLETE_TIMEOUT_MS}. + * Error used when a tune, seek, or step operation is not completed + * within {@link IBroadcastRadio#TUNER_TIMEOUT_MS}. */ TIMEOUT, /** - * Error used when a tune, seek, step or operation is canceled before + * Error used when a tune, seek, or step operation is canceled before * being processed. */ CANCELED, From b742cdf2a0510661bdb07b121d67a0239d59c0d8 Mon Sep 17 00:00:00 2001 From: Vlad Popa Date: Wed, 26 Apr 2023 17:08:07 +0200 Subject: [PATCH 939/998] CSD: Load the ISoundDoseFactory dynamically Also removed the default implementation of the ISoundDoseFactory which only provides a dummy SoundDose object. It is better to fall back to the framework MEL. Test: manual, logs Bug: 272260521 Change-Id: I3b49c9ae4af7c4eafaef46de3fc90aa05bd819c4 --- audio/aidl/sounddose/default/Android.bp | 46 ----------------- .../sounddose/default/SoundDoseFactory.cpp | 49 ------------------- .../default/include/SoundDoseFactory.h | 38 -------------- .../all-versions/default/service/Android.bp | 3 -- .../android.hardware.audio.sounddose-aidl.xml | 7 --- .../all-versions/default/service/service.cpp | 18 ++----- 6 files changed, 4 insertions(+), 157 deletions(-) delete mode 100644 audio/aidl/sounddose/default/Android.bp delete mode 100644 audio/aidl/sounddose/default/SoundDoseFactory.cpp delete mode 100644 audio/aidl/sounddose/default/include/SoundDoseFactory.h delete mode 100644 audio/common/all-versions/default/service/android.hardware.audio.sounddose-aidl.xml diff --git a/audio/aidl/sounddose/default/Android.bp b/audio/aidl/sounddose/default/Android.bp deleted file mode 100644 index bd770fa5b5..0000000000 --- a/audio/aidl/sounddose/default/Android.bp +++ /dev/null @@ -1,46 +0,0 @@ -package { - // See: http://go/android-license-faq - // A large-scale-change added 'default_applicable_licenses' to import - // all of the 'license_kinds' from "hardware_interfaces_license" - // to get the below license kinds: - // SPDX-license-identifier-Apache-2.0 - default_applicable_licenses: ["hardware_interfaces_license"], -} - -cc_defaults { - name: "aidlsounddoseservice_defaults", - vendor: true, - header_libs: [ - "libsounddoseaidl_headers", - ], -} - -cc_library { - name: "libsounddoseserviceexampleimpl", - defaults: [ - "aidlsounddoseservice_defaults", - "latest_android_media_audio_common_types_ndk_shared", - "latest_android_hardware_audio_core_sounddose_ndk_shared", - "latest_android_hardware_audio_sounddose_ndk_shared", - ], - export_include_dirs: ["include"], - srcs: [ - "SoundDoseFactory.cpp", - ], - shared_libs: [ - "libaudioservicesounddoseimpl", - "libbase", - "libbinder_ndk", - ], - - visibility: [ - "//hardware/interfaces/audio/common/all-versions/default/service", - ], -} - -cc_library_headers { - name: "libsounddoseaidl_headers", - export_include_dirs: ["include"], - vendor_available: true, - host_supported: true, -} diff --git a/audio/aidl/sounddose/default/SoundDoseFactory.cpp b/audio/aidl/sounddose/default/SoundDoseFactory.cpp deleted file mode 100644 index 83a592b54e..0000000000 --- a/audio/aidl/sounddose/default/SoundDoseFactory.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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. - */ - -#define LOG_TAG "AHAL_SoundDoseFactory" - -#include "SoundDoseFactory.h" - -#include -#include - -namespace aidl::android::hardware::audio::sounddose { - -using ::aidl::android::hardware::audio::core::sounddose::SoundDose; - -ndk::ScopedAStatus SoundDoseFactory::getSoundDose(const std::string& in_module, - std::shared_ptr* _aidl_return) { - auto soundDoseIt = mSoundDoseBinderMap.find(in_module); - if (soundDoseIt != mSoundDoseBinderMap.end()) { - *_aidl_return = ISoundDose::fromBinder(soundDoseIt->second); - - LOG(DEBUG) << __func__ - << ": returning cached instance of ISoundDose: " << _aidl_return->get() - << " for module " << in_module; - return ndk::ScopedAStatus::ok(); - } - - auto soundDose = ndk::SharedRefBase::make(); - mSoundDoseBinderMap[in_module] = soundDose->asBinder(); - *_aidl_return = soundDose; - - LOG(DEBUG) << __func__ << ": returning new instance of ISoundDose: " << _aidl_return->get() - << " for module " << in_module; - return ndk::ScopedAStatus::ok(); -} - -} // namespace aidl::android::hardware::audio::sounddose diff --git a/audio/aidl/sounddose/default/include/SoundDoseFactory.h b/audio/aidl/sounddose/default/include/SoundDoseFactory.h deleted file mode 100644 index ced4291411..0000000000 --- a/audio/aidl/sounddose/default/include/SoundDoseFactory.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include -#include -#include - -#include - -namespace aidl::android::hardware::audio::sounddose { - -using ::aidl::android::hardware::audio::core::sounddose::ISoundDose; - -class SoundDoseFactory : public BnSoundDoseFactory { - public: - ndk::ScopedAStatus getSoundDose(const std::string& module, - std::shared_ptr* _aidl_return) override; - - private: - std::unordered_map mSoundDoseBinderMap; -}; - -} // namespace aidl::android::hardware::audio::sounddose diff --git a/audio/common/all-versions/default/service/Android.bp b/audio/common/all-versions/default/service/Android.bp index 2fcfb235e7..d513062c25 100644 --- a/audio/common/all-versions/default/service/Android.bp +++ b/audio/common/all-versions/default/service/Android.bp @@ -38,13 +38,11 @@ cc_binary { name: "android.hardware.audio.service", init_rc: ["android.hardware.audio.service.rc"], - vintf_fragments: ["android.hardware.audio.sounddose-aidl.xml"], relative_install_path: "hw", vendor: true, defaults: [ "android_hardware_audio_config_defaults", - "latest_android_hardware_audio_sounddose_ndk_shared", ], srcs: ["service.cpp"], @@ -56,7 +54,6 @@ cc_binary { ], shared_libs: [ - "//hardware/interfaces/audio/aidl/sounddose/default:libsounddoseserviceexampleimpl", "libcutils", "libbinder", "libbinder_ndk", diff --git a/audio/common/all-versions/default/service/android.hardware.audio.sounddose-aidl.xml b/audio/common/all-versions/default/service/android.hardware.audio.sounddose-aidl.xml deleted file mode 100644 index a297bfbbe5..0000000000 --- a/audio/common/all-versions/default/service/android.hardware.audio.sounddose-aidl.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - android.hardware.audio.sounddose - 1 - ISoundDoseFactory/default - - diff --git a/audio/common/all-versions/default/service/service.cpp b/audio/common/all-versions/default/service/service.cpp index 7b5a932ff6..1557a9505d 100644 --- a/audio/common/all-versions/default/service/service.cpp +++ b/audio/common/all-versions/default/service/service.cpp @@ -20,10 +20,6 @@ #include #include -#include -#include -#include -#include #include #include #include @@ -37,8 +33,6 @@ using android::OK; using InterfacesList = std::vector; -using aidl::android::hardware::audio::sounddose::SoundDoseFactory; - /** Try to register the provided factories in the provided order. * If any registers successfully, do not register any other and return true. * If all fail, return false. @@ -144,6 +138,10 @@ int main(int /* argc */, char* /* argv */ []) { "android.hardware.bluetooth.audio-impl", "createIBluetoothAudioProviderFactory", }, + { + "android.hardware.audio.sounddose-vendor-impl", + "createISoundDoseFactory", + }, }; // clang-format on @@ -171,13 +169,5 @@ int main(int /* argc */, char* /* argv */ []) { } } - // Register ISoundDoseFactory interface as a workaround for using the audio AIDL HAL - auto soundDoseDefault = ndk::SharedRefBase::make(); - const std::string soundDoseDefaultName = - std::string() + SoundDoseFactory::descriptor + "/default"; - binder_status_t status = AServiceManager_addService(soundDoseDefault->asBinder().get(), - soundDoseDefaultName.c_str()); - CHECK_EQ(STATUS_OK, status); - joinRpcThreadpool(); } From 33e2d0113c1e8da1a13cd532ee5e903865e4e6c5 Mon Sep 17 00:00:00 2001 From: Seth Moore Date: Thu, 27 Apr 2023 21:00:48 +0000 Subject: [PATCH 940/998] Add VSR annotations for RKP DICE Bug: 277965670 Test: n/a (comment changes only) (cherry picked from https://android-review.googlesource.com/q/commit:ac1639f227f7edb1ce284adc2a4f48f88d347da1) Merged-In: I64e34c1f9865811f0967148cad914f7ef77f9448 Change-Id: I64e34c1f9865811f0967148cad914f7ef77f9448 --- .../vts/functional/VtsRemotelyProvisionedComponentTests.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp index 8906543e7f..62463ebc7b 100644 --- a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp +++ b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp @@ -702,6 +702,7 @@ class CertificateRequestV2Test : public CertificateRequestTestBase { * Generate an empty certificate request with all possible length of challenge, and decrypt and * verify the structure and content. */ +// @VsrTest = 3.10-015 TEST_P(CertificateRequestV2Test, EmptyRequest) { bytevec csr; @@ -721,6 +722,7 @@ TEST_P(CertificateRequestV2Test, EmptyRequest) { * Generate a non-empty certificate request with all possible length of challenge. Decrypt, parse * and validate the contents. */ +// @VsrTest = 3.10-015 TEST_P(CertificateRequestV2Test, NonEmptyRequest) { generateKeys(false /* testMode */, 1 /* numKeys */); @@ -753,6 +755,7 @@ TEST_P(CertificateRequestV2Test, EmptyRequestWithInvalidChallengeFail) { * Generate a non-empty certificate request. Make sure contents are reproducible but allow for the * signature to be different since algorithms including ECDSA P-256 can include a random value. */ +// @VsrTest = 3.10-015 TEST_P(CertificateRequestV2Test, NonEmptyRequestReproducible) { generateKeys(false /* testMode */, 1 /* numKeys */); @@ -776,6 +779,7 @@ TEST_P(CertificateRequestV2Test, NonEmptyRequestReproducible) { /** * Generate a non-empty certificate request with multiple keys. */ +// @VsrTest = 3.10-015 TEST_P(CertificateRequestV2Test, NonEmptyRequestMultipleKeys) { generateKeys(false /* testMode */, rpcHardwareInfo.supportedNumKeysInCsr /* numKeys */); @@ -849,6 +853,7 @@ void parse_root_of_trust(const vector& attestation_cert, /** * Generate a CSR and verify DeviceInfo against IDs attested by KeyMint. */ +// @VsrTest = 3.10-015 TEST_P(CertificateRequestV2Test, DeviceInfo) { // See if there is a matching IKeyMintDevice for this IRemotelyProvisionedComponent. std::shared_ptr keyMint; From b811015579e2c228a35f8e756a87f494f366c11e Mon Sep 17 00:00:00 2001 From: Jiabin Huang Date: Thu, 27 Apr 2023 23:06:04 +0000 Subject: [PATCH 941/998] AHAL: add more comment for IModule.disconnectExternalDevice Bug: 277955540 Test: TH (cherry picked from https://android-review.googlesource.com/q/commit:cf210c83b2d29882aa0144a8e52af0d460628b6e) Merged-In: I0d6a73884ab4bcfec62da45124024e8680155144 Change-Id: I0d6a73884ab4bcfec62da45124024e8680155144 --- audio/aidl/android/hardware/audio/core/IModule.aidl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/audio/aidl/android/hardware/audio/core/IModule.aidl b/audio/aidl/android/hardware/audio/core/IModule.aidl index 7622d9a16c..e736c32e98 100644 --- a/audio/aidl/android/hardware/audio/core/IModule.aidl +++ b/audio/aidl/android/hardware/audio/core/IModule.aidl @@ -234,6 +234,12 @@ interface IModule { * instance previously instantiated using the 'connectExternalDevice' * method. * + * The framework will call this method before closing streams and resetting + * patches. This call can be used by the HAL module to prepare itself to + * device disconnection. If the HAL module indicates an error after the first + * call, the framework will call this method once again after closing associated + * streams and patches. + * * @throws EX_ILLEGAL_ARGUMENT In the following cases: * - If the port can not be found by the ID. * - If this is not a connected device port. From fc35c0797e7fd060f0c7b9667a832cfaed3332c7 Mon Sep 17 00:00:00 2001 From: Sarah Chin Date: Thu, 27 Apr 2023 14:01:34 -0700 Subject: [PATCH 942/998] Backport VTS fixes to previous test versions Network scan check periodicity only if scan type is PERIODIC. Fix MCC/MNC checks to handle null strings. Test: atest VTS Bug: 259674407 Change-Id: I77e0706f413ce9defb174f00ee145dcc01f5d780 --- .../vts/functional/radio_hidl_hal_data.cpp | 15 ++++++++---- .../1.2/vts/functional/radio_hidl_hal_api.cpp | 23 +++++++++++++------ .../1.4/vts/functional/radio_hidl_hal_api.cpp | 4 ++-- .../1.5/vts/functional/radio_hidl_hal_api.cpp | 4 ++-- radio/aidl/vts/radio_network_test.cpp | 19 +++++++++++---- 5 files changed, 45 insertions(+), 20 deletions(-) diff --git a/radio/1.0/vts/functional/radio_hidl_hal_data.cpp b/radio/1.0/vts/functional/radio_hidl_hal_data.cpp index 655b869333..38cb33b07e 100644 --- a/radio/1.0/vts/functional/radio_hidl_hal_data.cpp +++ b/radio/1.0/vts/functional/radio_hidl_hal_data.cpp @@ -87,12 +87,19 @@ TEST_P(RadioHidlTest, getDataRegistrationState) { cellIdentities.cellIdentityTdscdma.size()); if (checkMccMnc) { - // 32 bit system gets result: "\xff\xff\xff..." from RIL, which is not testable. Only - // test for 64 bit here. TODO: remove this limit after b/113181277 being fixed. - if (hidl_mcc.size() < 4 && hidl_mnc.size() < 4) { + // 32 bit system gets result: "\xff\xff\xff..." from RIL, which is not testable. + // Only test for 64 bit here. TODO: remove this limit after b/113181277 being fixed. + int mccSize = hidl_mcc.size(); + EXPECT_TRUE(mccSize == 0 || mccSize == 3); + if (mccSize > 0) { int mcc = stoi(hidl_mcc); - int mnc = stoi(hidl_mnc); EXPECT_TRUE(mcc >= 0 && mcc <= 999); + } + + int mncSize = hidl_mnc.size(); + EXPECT_TRUE(mncSize == 0 || mncSize == 2 || mncSize == 3); + if (mncSize > 0) { + int mnc = stoi(hidl_mnc); EXPECT_TRUE(mnc >= 0 && mnc <= 999); } } diff --git a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp index 2400bde9ae..2bce2f957b 100644 --- a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp +++ b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp @@ -120,7 +120,7 @@ TEST_P(RadioHidlTest_v1_2, startNetworkScan_InvalidInterval1) { serial = GetRandomSerialNumber(); ::android::hardware::radio::V1_2::NetworkScanRequest request = { - .type = ScanType::ONE_SHOT, + .type = ScanType::PERIODIC, .interval = 4, .specifiers = {::GERAN_SPECIFIER_P900, ::GERAN_SPECIFIER_850}, .maxSearchTime = 60, @@ -155,7 +155,7 @@ TEST_P(RadioHidlTest_v1_2, startNetworkScan_InvalidInterval2) { serial = GetRandomSerialNumber(); ::android::hardware::radio::V1_2::NetworkScanRequest request = { - .type = ScanType::ONE_SHOT, + .type = ScanType::PERIODIC, .interval = 301, .specifiers = {::GERAN_SPECIFIER_P900, ::GERAN_SPECIFIER_850}, .maxSearchTime = 60, @@ -821,11 +821,20 @@ TEST_P(RadioHidlTest_v1_2, getDataRegistrationState) { cellIdentities.cellIdentityTdscdma.size()); // 32 bit system might return invalid mcc and mnc hidl string "\xff\xff..." - if (checkMccMnc && hidl_mcc.size() < 4 && hidl_mnc.size() < 4) { - int mcc = stoi(hidl_mcc); - int mnc = stoi(hidl_mnc); - EXPECT_TRUE(mcc >= 0 && mcc <= 999); - EXPECT_TRUE(mnc >= 0 && mnc <= 999); + if (checkMccMnc) { + int mccSize = hidl_mcc.size(); + EXPECT_TRUE(mccSize == 0 || mccSize == 3); + if (mccSize > 0) { + int mcc = stoi(hidl_mcc); + EXPECT_TRUE(mcc >= 0 && mcc <= 999); + } + + int mncSize = hidl_mnc.size(); + EXPECT_TRUE(mncSize == 0 || mncSize == 2 || mncSize == 3); + if (mncSize > 0) { + int mnc = stoi(hidl_mnc); + EXPECT_TRUE(mnc >= 0 && mnc <= 999); + } } } diff --git a/radio/1.4/vts/functional/radio_hidl_hal_api.cpp b/radio/1.4/vts/functional/radio_hidl_hal_api.cpp index 8f357a0f5c..744af7546a 100644 --- a/radio/1.4/vts/functional/radio_hidl_hal_api.cpp +++ b/radio/1.4/vts/functional/radio_hidl_hal_api.cpp @@ -335,7 +335,7 @@ TEST_P(RadioHidlTest_v1_4, startNetworkScan_InvalidInterval1) { serial = GetRandomSerialNumber(); ::android::hardware::radio::V1_2::NetworkScanRequest request = { - .type = ScanType::ONE_SHOT, + .type = ScanType::PERIODIC, .interval = 4, .specifiers = {::GERAN_SPECIFIER_P900, ::GERAN_SPECIFIER_850}, .maxSearchTime = 60, @@ -368,7 +368,7 @@ TEST_P(RadioHidlTest_v1_4, startNetworkScan_InvalidInterval2) { serial = GetRandomSerialNumber(); ::android::hardware::radio::V1_2::NetworkScanRequest request = { - .type = ScanType::ONE_SHOT, + .type = ScanType::PERIODIC, .interval = 301, .specifiers = {::GERAN_SPECIFIER_P900, ::GERAN_SPECIFIER_850}, .maxSearchTime = 60, diff --git a/radio/1.5/vts/functional/radio_hidl_hal_api.cpp b/radio/1.5/vts/functional/radio_hidl_hal_api.cpp index 316c308115..fd44e9309e 100644 --- a/radio/1.5/vts/functional/radio_hidl_hal_api.cpp +++ b/radio/1.5/vts/functional/radio_hidl_hal_api.cpp @@ -661,7 +661,7 @@ TEST_P(RadioHidlTest_v1_5, startNetworkScan_InvalidInterval1) { .channels = {128, 129}}; ::android::hardware::radio::V1_5::NetworkScanRequest request = { - .type = ScanType::ONE_SHOT, + .type = ScanType::PERIODIC, .interval = 4, .specifiers = {specifierP900, specifier850}, .maxSearchTime = 60, @@ -705,7 +705,7 @@ TEST_P(RadioHidlTest_v1_5, startNetworkScan_InvalidInterval2) { .channels = {128, 129}}; ::android::hardware::radio::V1_5::NetworkScanRequest request = { - .type = ScanType::ONE_SHOT, + .type = ScanType::PERIODIC, .interval = 301, .specifiers = {specifierP900, specifier850}, .maxSearchTime = 60, diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index 0b7c16ebd4..0344dd6acc 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -1524,11 +1524,20 @@ TEST_P(RadioNetworkTest, getDataRegistrationState) { } // 32 bit system might return invalid mcc and mnc string "\xff\xff..." - if (checkMccMnc && mcc.size() == 3 && (mnc.size() == 2 || mnc.size() == 3)) { - int mcc_int = stoi(mcc); - int mnc_int = stoi(mnc); - EXPECT_TRUE(mcc_int >= 0 && mcc_int <= 999); - EXPECT_TRUE(mnc_int >= 0 && mnc_int <= 999); + if (checkMccMnc) { + int mccSize = mcc.size(); + EXPECT_TRUE(mccSize == 0 || mccSize == 3); + if (mccSize > 0) { + int mcc_int = stoi(mcc); + EXPECT_TRUE(mcc_int >= 0 && mcc_int <= 999); + } + + int mncSize = mnc.size(); + EXPECT_TRUE(mncSize == 0 || mncSize == 2 || mncSize == 3); + if (mncSize > 0) { + int mnc_int = stoi(mnc); + EXPECT_TRUE(mnc_int >= 0 && mnc_int <= 999); + } } // Check for access technology specific info From d1abb34b44faa4ff0c56b3ff770067afb5ce8e25 Mon Sep 17 00:00:00 2001 From: "yanggang.yang" Date: Fri, 21 Apr 2023 11:05:42 +0800 Subject: [PATCH 943/998] Bluetooth AIDL: SetTerminalRaw on fd Call SetTerminalRaw on the fd that was opened, since mFD has not been set. If SetTerminalRaw fails, log it but continue, since some platforms do not need this call. Bug: 279870989 Test: start Bluetooth on a device that doesn't need SetTerminalRaw (cherry picked from https://android-review.googlesource.com/q/commit:eb744bc14c0d1e64c4291b3f869d6055db36b0f3) Merged-In: I97c92c407b7c80442a0ba0812a630525219670a0 Change-Id: I97c92c407b7c80442a0ba0812a630525219670a0 --- bluetooth/aidl/default/BluetoothHci.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bluetooth/aidl/default/BluetoothHci.cpp b/bluetooth/aidl/default/BluetoothHci.cpp index d4e4b34c6e..ac2eabc86d 100644 --- a/bluetooth/aidl/default/BluetoothHci.cpp +++ b/bluetooth/aidl/default/BluetoothHci.cpp @@ -117,11 +117,9 @@ int BluetoothHci::getFdFromDevPath() { strerror(errno)); return fd; } - if (int ret = SetTerminalRaw(mFd) < 0) { - ALOGE("Could not make %s a raw terminal %d(%s)", mDevPath.c_str(), ret, + if (int ret = SetTerminalRaw(fd) < 0) { + ALOGI("Could not make %s a raw terminal %d(%s)", mDevPath.c_str(), ret, strerror(errno)); - ::close(fd); - return -1; } return fd; } From e908adfde306a4b9767fe6ab8aa390af37ce43d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Kosi=C5=84ski?= Date: Sat, 29 Apr 2023 12:50:09 +0000 Subject: [PATCH 944/998] Refactor BindToDeviceSocketMutator. Only expose a factory function in the header. This limits the internal gRPC dependency to the .cpp file and simplifies the implementation. Bug: 280043032 Test: local build Change-Id: Ic7ea8dac9935231ceb05bec22c2a5902c50ea8db --- .../bind_to_device_socket_mutator/Android.bp | 2 +- .../include/BindToDeviceSocketMutator.h | 15 ++---- .../src/BindToDeviceSocketMutator.cpp | 48 +++++++++++-------- .../hal/default/src/RemoteAccessImpl.cpp | 2 +- 4 files changed, 34 insertions(+), 33 deletions(-) diff --git a/automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp b/automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp index 113b14e63f..58df21ac52 100644 --- a/automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp +++ b/automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp @@ -37,7 +37,7 @@ cc_defaults { cc_library { name: "BindToDeviceSocketMutatorLib", vendor_available: true, - srcs: ["src/*"], + srcs: ["src/BindToDeviceSocketMutator.cpp"], export_include_dirs: ["include"], defaults: ["BindToDeviceSocketMutatorDefaults"], } diff --git a/automotive/remoteaccess/bind_to_device_socket_mutator/include/BindToDeviceSocketMutator.h b/automotive/remoteaccess/bind_to_device_socket_mutator/include/BindToDeviceSocketMutator.h index bafcc654c4..5974c4b366 100644 --- a/automotive/remoteaccess/bind_to_device_socket_mutator/include/BindToDeviceSocketMutator.h +++ b/automotive/remoteaccess/bind_to_device_socket_mutator/include/BindToDeviceSocketMutator.h @@ -16,20 +16,11 @@ #pragma once -#include -#include -#include +#include +#include namespace android::hardware::automotive::remoteaccess { -class BindToDeviceSocketMutator final : public grpc_socket_mutator { - public: - BindToDeviceSocketMutator(const std::string_view& interface_name); - - bool mutateFd(int fd); - - private: - std::string mIfname; -}; +grpc_socket_mutator* MakeBindToDeviceSocketMutator(std::string_view interface_name); } // namespace android::hardware::automotive::remoteaccess diff --git a/automotive/remoteaccess/bind_to_device_socket_mutator/src/BindToDeviceSocketMutator.cpp b/automotive/remoteaccess/bind_to_device_socket_mutator/src/BindToDeviceSocketMutator.cpp index c6a96deb88..04a4c5bde9 100644 --- a/automotive/remoteaccess/bind_to_device_socket_mutator/src/BindToDeviceSocketMutator.cpp +++ b/automotive/remoteaccess/bind_to_device_socket_mutator/src/BindToDeviceSocketMutator.cpp @@ -18,40 +18,50 @@ #include #include +#include #include -namespace android::hardware::automotive::remoteaccess { +#include -bool BindToDeviceSocketMutator::mutateFd(int fd) { - int ret = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, mIfname.c_str(), mIfname.size()); +namespace android::hardware::automotive::remoteaccess { +namespace { + +struct BindToDeviceMutator : grpc_socket_mutator { + std::string ifname; +}; + +bool MutateFd(int fd, grpc_socket_mutator* mutator) { + auto* bdm = static_cast(mutator); + int ret = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, bdm->ifname.c_str(), bdm->ifname.size()); if (ret != 0) { - PLOG(ERROR) << "Can't bind socket to interface " << mIfname; + PLOG(ERROR) << "Can't bind socket to interface " << bdm->ifname; return false; } return true; } -bool bind_to_device_mutator_mutate_fd(int fd, grpc_socket_mutator* mutator) { - BindToDeviceSocketMutator* bsm = (BindToDeviceSocketMutator*)mutator; - return bsm->mutateFd(fd); -} - -int bind_to_device_mutator_compare(grpc_socket_mutator* a, grpc_socket_mutator* b) { +int Compare(grpc_socket_mutator* a, grpc_socket_mutator* b) { return ((a) < (b) ? -1 : ((a) > (b) ? 1 : 0)); } -void bind_to_device_mutator_destroy(grpc_socket_mutator* mutator) { - BindToDeviceSocketMutator* bsm = (BindToDeviceSocketMutator*)mutator; - delete bsm; +void Destroy(grpc_socket_mutator* mutator) { + auto* bdm = static_cast(mutator); + delete bdm; } -grpc_socket_mutator_vtable bind_to_device_mutator_vtable = {bind_to_device_mutator_mutate_fd, - bind_to_device_mutator_compare, - bind_to_device_mutator_destroy}; +constexpr grpc_socket_mutator_vtable kMutatorVtable = { + .mutate_fd = MutateFd, + .compare = Compare, + .destroy = Destroy, +}; -BindToDeviceSocketMutator::BindToDeviceSocketMutator(const std::string_view& interface_name) { - mIfname = interface_name; - grpc_socket_mutator_init(this, &bind_to_device_mutator_vtable); +} // namespace + +grpc_socket_mutator* MakeBindToDeviceSocketMutator(std::string_view interface_name) { + auto* bdm = new BindToDeviceMutator; + grpc_socket_mutator_init(bdm, &kMutatorVtable); + bdm->ifname = interface_name; + return bdm; } } // namespace android::hardware::automotive::remoteaccess diff --git a/automotive/remoteaccess/hal/default/src/RemoteAccessImpl.cpp b/automotive/remoteaccess/hal/default/src/RemoteAccessImpl.cpp index d5251410bb..b091162000 100644 --- a/automotive/remoteaccess/hal/default/src/RemoteAccessImpl.cpp +++ b/automotive/remoteaccess/hal/default/src/RemoteAccessImpl.cpp @@ -40,7 +40,7 @@ int main(int /* argc */, char* /* argv */[]) { #ifdef GRPC_SERVICE_IFNAME grpcargs.SetSocketMutator( - new android::hardware::automotive::remoteaccess::BindToDeviceSocketMutator( + android::hardware::automotive::remoteaccess::MakeBindToDeviceSocketMutator( GRPC_SERVICE_IFNAME)); LOG(DEBUG) << "GRPC_SERVICE_IFNAME specified as: " << GRPC_SERVICE_IFNAME; LOG(INFO) << "Waiting for interface: " << GRPC_SERVICE_IFNAME; From 5bc39cc1398f44b447fbeb41a91e3c7e0349679d Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Mon, 10 Apr 2023 15:54:54 -0700 Subject: [PATCH 945/998] Support dump and add more unit tests. Support dump in reference ivn HAL and add more unit tests. Test: atest IvnAndroidDeviceServiceUnitTest Bug: 274139217 Change-Id: I3d882dcf84f8ae89104e06deb65fbad148fad54c --- .../default/include/IvnAndroidDeviceService.h | 4 ++ .../default/src/IvnAndroidDeviceService.cpp | 20 ++++++---- .../test/IvnAndroidDeviceServiceUnittest.cpp | 39 +++++++++++++++++++ 3 files changed, 56 insertions(+), 7 deletions(-) diff --git a/automotive/ivn_android_device/impl/default/include/IvnAndroidDeviceService.h b/automotive/ivn_android_device/impl/default/include/IvnAndroidDeviceService.h index c0cc9fea2d..0cff8fe19a 100644 --- a/automotive/ivn_android_device/impl/default/include/IvnAndroidDeviceService.h +++ b/automotive/ivn_android_device/impl/default/include/IvnAndroidDeviceService.h @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -60,7 +61,10 @@ class IvnAndroidDeviceService int androidDeviceId, aidl::android::hardware::automotive::ivn::EndpointInfo* endpointInfo) override; + binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; + private: + Json::Value mConfigRootNode; int mMyDeviceId; std::unordered_map mDeviceInfoById; std::string_view mConfigPath; diff --git a/automotive/ivn_android_device/impl/default/src/IvnAndroidDeviceService.cpp b/automotive/ivn_android_device/impl/default/src/IvnAndroidDeviceService.cpp index 71454d5d40..81f18b2267 100644 --- a/automotive/ivn_android_device/impl/default/src/IvnAndroidDeviceService.cpp +++ b/automotive/ivn_android_device/impl/default/src/IvnAndroidDeviceService.cpp @@ -54,26 +54,25 @@ bool IvnAndroidDeviceService::init() { return false; } Json::CharReaderBuilder builder; - Json::Value root; std::string errs; - if (!Json::parseFromStream(builder, configStream, &root, &errs)) { + if (!Json::parseFromStream(builder, configStream, &mConfigRootNode, &errs)) { LOG(ERROR) << "Failed to parse config JSON stream, error: " << errs; return false; } - if (!root.isObject()) { + if (!mConfigRootNode.isObject()) { LOG(ERROR) << "Root must be an object"; return false; } - if (!root.isMember("MyDeviceId")) { + if (!mConfigRootNode.isMember("MyDeviceId")) { LOG(ERROR) << "Must contain 'MyDeviceId' field"; return false; } - mMyDeviceId = root["MyDeviceId"].asInt(); - if (!root.isMember("Devices") || !root["Devices"].isArray()) { + mMyDeviceId = mConfigRootNode["MyDeviceId"].asInt(); + if (!mConfigRootNode.isMember("Devices") || !mConfigRootNode["Devices"].isArray()) { LOG(ERROR) << "Must contain 'Devices' field as array"; return false; } - Json::Value& devices = root["Devices"]; + Json::Value& devices = mConfigRootNode["Devices"]; for (unsigned int i = 0; i < devices.size(); i++) { Json::Value& device = devices[i]; int deviceId = device["DeviceId"].asInt(); @@ -190,6 +189,13 @@ ScopedAStatus IvnAndroidDeviceService::getEndpointInfoForDevice(int androidDevic return ScopedAStatus::ok(); } +binder_status_t IvnAndroidDeviceService::dump(int fd, [[maybe_unused]] const char** args, + [[maybe_unused]] uint32_t numArgs) { + dprintf(fd, "IVN Android Device debug interface, Config: \n%s\n", + mConfigRootNode.toStyledString().c_str()); + return STATUS_OK; +} + } // namespace ivn } // namespace automotive } // namespace hardware diff --git a/automotive/ivn_android_device/impl/default/test/IvnAndroidDeviceServiceUnittest.cpp b/automotive/ivn_android_device/impl/default/test/IvnAndroidDeviceServiceUnittest.cpp index bc8e69fd8f..6a4d26d8c3 100644 --- a/automotive/ivn_android_device/impl/default/test/IvnAndroidDeviceServiceUnittest.cpp +++ b/automotive/ivn_android_device/impl/default/test/IvnAndroidDeviceServiceUnittest.cpp @@ -16,6 +16,7 @@ #include "IvnAndroidDeviceService.h" +#include #include #include #include @@ -26,6 +27,8 @@ namespace hardware { namespace automotive { namespace ivn { +using ::aidl::android::hardware::automotive::ivn::ConnectProtocol; +using ::aidl::android::hardware::automotive::ivn::EndpointInfo; using ::aidl::android::hardware::automotive::ivn::OccupantType; using ::aidl::android::hardware::automotive::ivn::OccupantZoneInfo; using ::ndk::ScopedAStatus; @@ -92,6 +95,7 @@ TEST_F(IvnAndroidDeviceServiceUnitTest, TestGetOccupantZonesForDevice) { ScopedAStatus status = mService->getOccupantZonesForDevice(/*androidDeviceId=*/0, &occupantZones); + ASSERT_TRUE(status.isOk()); EXPECT_EQ(occupantZones.size(), 2); if (occupantZones.size() == 2) { @@ -104,6 +108,41 @@ TEST_F(IvnAndroidDeviceServiceUnitTest, TestGetOccupantZonesForDevice) { } } +TEST_F(IvnAndroidDeviceServiceUnitTest, TestGetMyEndpointInfo) { + EndpointInfo endpointInfo; + + ScopedAStatus status = mService->getMyEndpointInfo(&endpointInfo); + + ASSERT_TRUE(status.isOk()); + EXPECT_EQ(endpointInfo.connectProtocol, ConnectProtocol::TCP_IP); + EXPECT_EQ(endpointInfo.ipAddress, "10.10.10.1"); + EXPECT_EQ(endpointInfo.portNumber, 1234); + EXPECT_EQ(endpointInfo.hardwareId.brandName, "MyBrand"); + EXPECT_EQ(endpointInfo.hardwareId.deviceName, "MyDevice"); + EXPECT_EQ(endpointInfo.hardwareId.productName, "MyProduct"); + EXPECT_EQ(endpointInfo.hardwareId.manufacturerName, "MyCompany"); + EXPECT_EQ(endpointInfo.hardwareId.modelName, "MyModel"); + EXPECT_EQ(endpointInfo.hardwareId.serialNumber, "Serial1234"); +} + +TEST_F(IvnAndroidDeviceServiceUnitTest, TestGetEndpointInfoForDevice) { + EndpointInfo endpointInfo; + + ScopedAStatus status = mService->getEndpointInfoForDevice(/*androidDeviceId=*/0, &endpointInfo); + + ASSERT_TRUE(status.isOk()); + EXPECT_EQ(endpointInfo.connectProtocol, ConnectProtocol::TCP_IP); + EXPECT_EQ(endpointInfo.ipAddress, "10.10.10.1"); + EXPECT_EQ(endpointInfo.portNumber, 1234); + + status = mService->getEndpointInfoForDevice(/*androidDeviceId=*/1, &endpointInfo); + + ASSERT_TRUE(status.isOk()); + EXPECT_EQ(endpointInfo.connectProtocol, ConnectProtocol::TCP_IP); + EXPECT_EQ(endpointInfo.ipAddress, "10.10.10.2"); + EXPECT_EQ(endpointInfo.portNumber, 2345); +} + } // namespace ivn } // namespace automotive } // namespace hardware From db026a8ca091e8d14cba2a80ad562e7c47ee6816 Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Mon, 1 May 2023 18:04:36 +0000 Subject: [PATCH 946/998] Remove Descriptor proxy field from individual effect This field should be filled by IFactory implementation Bug: 271500140 Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit Change-Id: I96203b8cd037fd81b0b1d88fc5ca9915df02a919 --- audio/aidl/default/bassboost/BassBoostSw.cpp | 3 +-- audio/aidl/default/equalizer/EqualizerSw.cpp | 18 ++++++++---------- .../aidl/default/virtualizer/VirtualizerSw.cpp | 4 ++-- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/audio/aidl/default/bassboost/BassBoostSw.cpp b/audio/aidl/default/bassboost/BassBoostSw.cpp index dbf2e15c7d..6072d896d9 100644 --- a/audio/aidl/default/bassboost/BassBoostSw.cpp +++ b/audio/aidl/default/bassboost/BassBoostSw.cpp @@ -68,8 +68,7 @@ const std::vector BassBoostSw::kRanges = { const Capability BassBoostSw::kCapability = {.range = {BassBoostSw::kRanges}}; const Descriptor BassBoostSw::kDescriptor = { .common = {.id = {.type = getEffectTypeUuidBassBoost(), - .uuid = getEffectImplUuidBassBoostSw(), - .proxy = getEffectImplUuidBassBoostProxy()}, + .uuid = getEffectImplUuidBassBoostSw()}, .flags = {.type = Flags::Type::INSERT, .insert = Flags::Insert::FIRST, .volume = Flags::Volume::CTRL}, diff --git a/audio/aidl/default/equalizer/EqualizerSw.cpp b/audio/aidl/default/equalizer/EqualizerSw.cpp index 97699249fc..b2add3113c 100644 --- a/audio/aidl/default/equalizer/EqualizerSw.cpp +++ b/audio/aidl/default/equalizer/EqualizerSw.cpp @@ -88,16 +88,14 @@ const std::vector EqualizerSw::kRanges = { MAKE_RANGE(Equalizer, centerFreqMh, std::vector({1}), std::vector({0}))}; const Capability EqualizerSw::kEqCap = {.range = EqualizerSw::kRanges}; -const Descriptor EqualizerSw::kDesc = { - .common = {.id = {.type = getEffectTypeUuidEqualizer(), - .uuid = getEffectImplUuidEqualizerSw(), - .proxy = getEffectImplUuidEqualizerProxy()}, - .flags = {.type = Flags::Type::INSERT, - .insert = Flags::Insert::FIRST, - .volume = Flags::Volume::CTRL}, - .name = EqualizerSw::kEffectName, - .implementor = "The Android Open Source Project"}, - .capability = EqualizerSw::kEqCap}; +const Descriptor EqualizerSw::kDesc = {.common = {.id = {.type = getEffectTypeUuidEqualizer(), + .uuid = getEffectImplUuidEqualizerSw()}, + .flags = {.type = Flags::Type::INSERT, + .insert = Flags::Insert::FIRST, + .volume = Flags::Volume::CTRL}, + .name = EqualizerSw::kEffectName, + .implementor = "The Android Open Source Project"}, + .capability = EqualizerSw::kEqCap}; ndk::ScopedAStatus EqualizerSw::getDescriptor(Descriptor* _aidl_return) { LOG(DEBUG) << __func__ << kDesc.toString(); diff --git a/audio/aidl/default/virtualizer/VirtualizerSw.cpp b/audio/aidl/default/virtualizer/VirtualizerSw.cpp index e34464f460..0e8435ef82 100644 --- a/audio/aidl/default/virtualizer/VirtualizerSw.cpp +++ b/audio/aidl/default/virtualizer/VirtualizerSw.cpp @@ -16,6 +16,7 @@ #include #include +#include #define LOG_TAG "AHAL_VirtualizerSw" #include @@ -76,8 +77,7 @@ const Capability VirtualizerSw::kCapability = { const Descriptor VirtualizerSw::kDescriptor = { .common = {.id = {.type = getEffectTypeUuidVirtualizer(), - .uuid = getEffectImplUuidVirtualizerSw(), - .proxy = getEffectImplUuidVirtualizerProxy()}, + .uuid = getEffectImplUuidVirtualizerSw()}, .flags = {.type = Flags::Type::INSERT, .insert = Flags::Insert::FIRST, .volume = Flags::Volume::CTRL}, From c413c484ee6a5ce672a0a22aa9aefb19e7cab0ff Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Fri, 14 Apr 2023 16:45:50 -0700 Subject: [PATCH 947/998] Add VTS for IVN HAL. Test: atest VtsHalIvnTargetTest Bug: 274139217 Change-Id: I76f90d5aa1cec2821bb3345e8315743bc8f51b03 --- automotive/ivn_android_device/vts/Android.bp | 47 +++++ automotive/ivn_android_device/vts/OWNERS | 2 + .../vts/src/VtsHalIvnTargetTest.cpp | 167 ++++++++++++++++++ 3 files changed, 216 insertions(+) create mode 100644 automotive/ivn_android_device/vts/Android.bp create mode 100644 automotive/ivn_android_device/vts/OWNERS create mode 100644 automotive/ivn_android_device/vts/src/VtsHalIvnTargetTest.cpp diff --git a/automotive/ivn_android_device/vts/Android.bp b/automotive/ivn_android_device/vts/Android.bp new file mode 100644 index 0000000000..e4b9d641ae --- /dev/null +++ b/automotive/ivn_android_device/vts/Android.bp @@ -0,0 +1,47 @@ +/* + * 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 { + // See: http://go/android-license-faq + // A large-scale-change added 'default_applicable_licenses' to import + // all of the 'license_kinds' from "hardware_interfaces_license" + // to get the below license kinds: + // SPDX-license-identifier-Apache-2.0 + default_applicable_licenses: ["hardware_interfaces_license"], +} + +cc_test { + name: "VtsHalIvnTargetTest", + srcs: [ + "src/*.cpp", + ], + defaults: ["use_libaidlvintf_gtest_helper_static"], + static_libs: [ + "libgmock", + "libgtest", + "android.hardware.automotive.ivn-V1-ndk", + ], + shared_libs: [ + "libbinder_ndk", + ], + test_suites: [ + "general-tests", + "vts", + "automotive-tests", + "automotive-general-tests", + ], + require_root: true, +} diff --git a/automotive/ivn_android_device/vts/OWNERS b/automotive/ivn_android_device/vts/OWNERS new file mode 100644 index 0000000000..d6969e5eb5 --- /dev/null +++ b/automotive/ivn_android_device/vts/OWNERS @@ -0,0 +1,2 @@ +ericjeong@google.com +shanyu@google.com diff --git a/automotive/ivn_android_device/vts/src/VtsHalIvnTargetTest.cpp b/automotive/ivn_android_device/vts/src/VtsHalIvnTargetTest.cpp new file mode 100644 index 0000000000..73b9a5e708 --- /dev/null +++ b/automotive/ivn_android_device/vts/src/VtsHalIvnTargetTest.cpp @@ -0,0 +1,167 @@ +/* + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace aidl::android::hardware::automotive::ivn { + +using ::ndk::ScopedAStatus; +using ::ndk::SpAIBinder; + +using ::testing::Contains; +using ::testing::Not; + +class VtsHalIvnTargetTest : public ::testing::TestWithParam { + public: + void SetUp() override { + std::string descriptor = GetParam(); + AIBinder* binder = AServiceManager_checkService(descriptor.c_str()); + ASSERT_NE(binder, nullptr) << "Failed to connect to IVN HAL"; + mIvnHal = IIvnAndroidDevice::fromBinder(SpAIBinder(binder)); + } + + std::shared_ptr getHal() { return mIvnHal; } + + private: + std::shared_ptr mIvnHal; + + protected: + ScopedAStatus getAllDeviceIds(std::unordered_set* deviceIds); +}; + +TEST_P(VtsHalIvnTargetTest, testDeviceIdIsUnique) { + std::unordered_set foundDeviceIds; + int myDeviceId = 0; + + ScopedAStatus status = getHal()->getMyDeviceId(&myDeviceId); + + ASSERT_TRUE(status.isOk()) << "Failed to call getMyDeviceId, status: " << status; + foundDeviceIds.insert(myDeviceId); + + std::vector otherDeviceIds; + + status = getHal()->getOtherDeviceIds(&otherDeviceIds); + + ASSERT_TRUE(status.isOk()) << "Failed to call getOtherDeviceIds, status: " << status; + + for (int deviceId : otherDeviceIds) { + EXPECT_THAT(foundDeviceIds, Not(Contains(deviceId))) << "Duplicate device ID: " << deviceId; + foundDeviceIds.insert(deviceId); + } +} + +ScopedAStatus VtsHalIvnTargetTest::getAllDeviceIds(std::unordered_set* deviceIds) { + int myDeviceId = 0; + ScopedAStatus status = getHal()->getMyDeviceId(&myDeviceId); + + if (!status.isOk()) { + return status; + } + deviceIds->insert(myDeviceId); + std::vector otherDeviceIds; + status = getHal()->getOtherDeviceIds(&otherDeviceIds); + if (!status.isOk()) { + return status; + } + for (int otherDeviceId : otherDeviceIds) { + deviceIds->insert(otherDeviceId); + } + return ScopedAStatus::ok(); +} + +TEST_P(VtsHalIvnTargetTest, testDeviceIdOccupantZoneMapping) { + std::unordered_set allDeviceIds; + + ScopedAStatus status = getAllDeviceIds(&allDeviceIds); + + ASSERT_FALSE(allDeviceIds.empty()); + ASSERT_TRUE(status.isOk()) << "Failed to get all device IDs, status: " << status; + + std::unordered_set foundOccupantZoneIds; + + for (int deviceId : allDeviceIds) { + std::vector occupantZones; + status = getHal()->getOccupantZonesForDevice(deviceId, &occupantZones); + + ASSERT_TRUE(status.isOk()) + << "Failed to call getOccupantZonesForDevice, status: " << status; + ASSERT_FALSE(occupantZones.empty()) << "No occupant zones for device: " << deviceId; + + for (const OccupantZoneInfo& occupantZone : occupantZones) { + int zoneId = occupantZone.zoneId; + + EXPECT_THAT(foundOccupantZoneIds, Not(Contains(zoneId))) + << "Duplicate zone ID: " << zoneId; + + foundOccupantZoneIds.insert(zoneId); + + int gotDeviceId = 0; + status = getHal()->getDeviceIdForOccupantZone(zoneId, &gotDeviceId); + + ASSERT_TRUE(status.isOk()) + << "Failed to call getDeviceIdForOccupantZone, status: " << status; + EXPECT_EQ(deviceId, gotDeviceId); + } + } +} + +TEST_P(VtsHalIvnTargetTest, testGetEndpointInfo) { + EndpointInfo endpointInfo; + std::vector foundEndpointInfo; + + ScopedAStatus status = getHal()->getMyEndpointInfo(&endpointInfo); + + foundEndpointInfo.push_back(endpointInfo); + + ASSERT_TRUE(status.isOk()) << "Failed to call getMyEndpointInfo, status: " << status; + EXPECT_EQ(endpointInfo.connectProtocol, ConnectProtocol::TCP_IP); + + std::vector otherDeviceIds; + status = getHal()->getOtherDeviceIds(&otherDeviceIds); + + ASSERT_TRUE(status.isOk()) << "Failed to call getOtherDeviceIds, status: " << status; + + for (int deviceId : otherDeviceIds) { + status = getHal()->getEndpointInfoForDevice(deviceId, &endpointInfo); + + ASSERT_TRUE(status.isOk()) << "Failed to call getEndpointInfoForDevice, status: " << status; + EXPECT_EQ(endpointInfo.connectProtocol, ConnectProtocol::TCP_IP); + + for (EndpointInfo foundInfo : foundEndpointInfo) { + ASSERT_NE(foundInfo, endpointInfo) + << "Found duplicate endpoint info" << endpointInfo.toString(); + } + + foundEndpointInfo.push_back(endpointInfo); + } +} + +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(VtsHalIvnTargetTest); + +INSTANTIATE_TEST_SUITE_P( + PerInstance, VtsHalIvnTargetTest, + testing::ValuesIn(::android::getAidlHalInstanceNames(IIvnAndroidDevice::descriptor)), + ::android::PrintInstanceNameToString); + +} // namespace aidl::android::hardware::automotive::ivn From 85da71a9b59c0fe12078df88769f0fe5c044f9b3 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Fri, 28 Apr 2023 17:24:36 -0700 Subject: [PATCH 948/998] audio VTS: Update PolicyConfig after AudioPolicyConfig Make necessary changes to use updated AudioPolicyConfig class. Bug: 205884982 Test: m VtsHalAudioV6_0TargetTest Test: atest HalAudioV6_0GeneratorTest (cherry picked from https://android-review.googlesource.com/q/commit:33a35b5ffbbcbcf8a41d70a8af807d6c16f332c9) Merged-In: Iced9d665d018853c4b2a50f4471a545af7bf60bb Change-Id: Iced9d665d018853c4b2a50f4471a545af7bf60bb --- .../vts/functional/6.0/Generators.cpp | 2 + .../vts/functional/AudioPrimaryHidlHalTest.h | 2 +- .../vts/functional/PolicyConfig.h | 97 ++++++++----------- 3 files changed, 44 insertions(+), 57 deletions(-) diff --git a/audio/core/all-versions/vts/functional/6.0/Generators.cpp b/audio/core/all-versions/vts/functional/6.0/Generators.cpp index dafd32697b..705932d4c9 100644 --- a/audio/core/all-versions/vts/functional/6.0/Generators.cpp +++ b/audio/core/all-versions/vts/functional/6.0/Generators.cpp @@ -16,6 +16,8 @@ #include +#include + #include "6.0/Generators.h" #include "ConfigHelper.h" #include "PolicyConfig.h" diff --git a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h index 478482d412..fabe2d29a2 100644 --- a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h +++ b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h @@ -195,7 +195,7 @@ static constexpr char kConfigFileName[] = "audio_policy_configuration.xml"; // Cached policy config after parsing for faster test startup const PolicyConfig& getCachedPolicyConfig() { static std::unique_ptr policyConfig = [] { - auto config = std::make_unique(kConfigFileName); + auto config = std::make_unique("", kConfigFileName); return config; }(); return *policyConfig; diff --git a/audio/core/all-versions/vts/functional/PolicyConfig.h b/audio/core/all-versions/vts/functional/PolicyConfig.h index 171d03f42a..b08e8084a0 100644 --- a/audio/core/all-versions/vts/functional/PolicyConfig.h +++ b/audio/core/all-versions/vts/functional/PolicyConfig.h @@ -19,9 +19,9 @@ #include #include +#include #include #include -#include #include #include @@ -30,47 +30,35 @@ using ::android::sp; using ::android::status_t; -struct PolicyConfigData { - android::HwModuleCollection hwModules; - android::DeviceVector availableOutputDevices; - android::DeviceVector availableInputDevices; - sp defaultOutputDevice; -}; - -class PolicyConfig : private PolicyConfigData, public android::AudioPolicyConfig { +class PolicyConfig { public: - explicit PolicyConfig(const std::string& configFileName) - : android::AudioPolicyConfig(hwModules, availableOutputDevices, availableInputDevices, - defaultOutputDevice), - mConfigFileName{configFileName} { - for (const auto& location : android::audio_get_configuration_paths()) { - std::string path = location + '/' + mConfigFileName; - if (access(path.c_str(), F_OK) == 0) { - mFilePath = path; - break; - } - } - init(); - } PolicyConfig(const std::string& configPath, const std::string& configFileName) - : android::AudioPolicyConfig(hwModules, availableOutputDevices, availableInputDevices, - defaultOutputDevice), - mConfigFileName{configFileName}, - mFilePath{configPath + "/" + mConfigFileName} { - init(); + : mInitialFilePath(configPath.empty() ? configFileName + : configPath + "/" + configFileName) { + auto result = android::AudioPolicyConfig::loadFromCustomXmlConfigForVtsTests( + configPath, configFileName); + if (result.ok()) { + mStatus = ::android::OK; + mConfig = result.value(); + init(); + } else { + mStatus = result.error(); + } } status_t getStatus() const { return mStatus; } std::string getError() const { - if (mFilePath.empty()) { - return std::string{"Could not find "} + mConfigFileName + + if (mConfig == nullptr) { + return std::string{"Could not find "} + mInitialFilePath + " file in: " + testing::PrintToString(android::audio_get_configuration_paths()); } else { - return "Invalid config file: " + mFilePath; + return "Invalid config file: " + mConfig->getSource(); } } - const std::string& getFilePath() const { return mFilePath; } + const std::string& getFilePath() const { + return mConfig != nullptr ? mConfig->getSource() : mInitialFilePath; + } sp getModuleFromName(const std::string& name) const { - return getHwModules().getModuleFromName(name.c_str()); + return mConfig->getHwModules().getModuleFromName(name.c_str()); } sp getPrimaryModule() const { return mPrimaryModule; } const std::set& getModulesWithDevicesNames() const { @@ -86,6 +74,8 @@ class PolicyConfig : private PolicyConfigData, public android::AudioPolicyConfig return findAttachedDevice(getAttachedDevices(moduleName), getSourceDevicesForMixPort(moduleName, mixPortName)); } + const android::DeviceVector& getInputDevices() const { return mConfig->getInputDevices(); } + const android::DeviceVector& getOutputDevices() const { return mConfig->getOutputDevices(); } bool haveInputProfilesInModule(const std::string& name) const { auto module = getModuleFromName(name); return module && !module->getInputProfiles().empty(); @@ -93,29 +83,24 @@ class PolicyConfig : private PolicyConfigData, public android::AudioPolicyConfig private: void init() { - mStatus = android::deserializeAudioPolicyFileForVts(mFilePath.c_str(), this); - if (mStatus == android::OK) { - mPrimaryModule = getModuleFromName(DeviceManager::kPrimaryDevice); - // Available devices are not 'attached' to modules at this moment. - // Need to go over available devices and find their module. - for (const auto& device : availableOutputDevices) { - for (const auto& module : hwModules) { - if (module->getDeclaredDevices().indexOf(device) >= 0) { - mModulesWithDevicesNames.insert(module->getName()); - mAttachedDevicesPerModule[module->getName()].push_back( - device->getTagName()); - break; - } + mPrimaryModule = getModuleFromName(DeviceManager::kPrimaryDevice); + // Available devices are not 'attached' to modules at this moment. + // Need to go over available devices and find their module. + for (const auto& device : mConfig->getOutputDevices()) { + for (const auto& module : mConfig->getHwModules()) { + if (module->getDeclaredDevices().indexOf(device) >= 0) { + mModulesWithDevicesNames.insert(module->getName()); + mAttachedDevicesPerModule[module->getName()].push_back(device->getTagName()); + break; } } - for (const auto& device : availableInputDevices) { - for (const auto& module : hwModules) { - if (module->getDeclaredDevices().indexOf(device) >= 0) { - mModulesWithDevicesNames.insert(module->getName()); - mAttachedDevicesPerModule[module->getName()].push_back( - device->getTagName()); - break; - } + } + for (const auto& device : mConfig->getInputDevices()) { + for (const auto& module : mConfig->getHwModules()) { + if (module->getDeclaredDevices().indexOf(device) >= 0) { + mModulesWithDevicesNames.insert(module->getName()); + mAttachedDevicesPerModule[module->getName()].push_back(device->getTagName()); + break; } } } @@ -166,10 +151,10 @@ class PolicyConfig : private PolicyConfigData, public android::AudioPolicyConfig return result; } - const std::string mConfigFileName; + const std::string mInitialFilePath; status_t mStatus = android::NO_INIT; - std::string mFilePath; - sp mPrimaryModule = nullptr; + sp mConfig; + sp mPrimaryModule; std::set mModulesWithDevicesNames; std::map> mAttachedDevicesPerModule; }; From 1837983a6fab5c50de1e93dc464b8e7d1ccfb9f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Kosi=C5=84ski?= Date: Wed, 3 May 2023 03:15:25 +0000 Subject: [PATCH 949/998] Use internal gRPC headers in BindToDeviceSocketMutatorLib. Bug: 280043032 Test: presubmit Change-Id: I53c413ab3dbbfb056f3b7f22c1db336aa68ba611 --- automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp | 1 + 1 file changed, 1 insertion(+) diff --git a/automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp b/automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp index 58df21ac52..cde021938f 100644 --- a/automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp +++ b/automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp @@ -40,4 +40,5 @@ cc_library { srcs: ["src/BindToDeviceSocketMutator.cpp"], export_include_dirs: ["include"], defaults: ["BindToDeviceSocketMutatorDefaults"], + header_libs: ["libgrpc++_internal_headers"], } From 6d41484860fd1a45850d8e7edf9dc837ee61ef34 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Wed, 3 May 2023 22:11:51 +0000 Subject: [PATCH 950/998] Skip RTT responder VTS tests if the capabilities do not indicate responder support. Bug: 280550766 Test: atest WifiRttControllerAidlTest Change-Id: I343dc3f2729274db5628f54501b89a470a512206 --- .../wifi_rtt_controller_aidl_test.cpp | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/wifi/aidl/vts/functional/wifi_rtt_controller_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_rtt_controller_aidl_test.cpp index d763fe64a5..4aedc0ef6f 100644 --- a/wifi/aidl/vts/functional/wifi_rtt_controller_aidl_test.cpp +++ b/wifi/aidl/vts/functional/wifi_rtt_controller_aidl_test.cpp @@ -75,6 +75,12 @@ class WifiRttControllerAidlTest : public testing::TestWithParam { return rtt_controller; } + RttCapabilities getCapabilities() { + RttCapabilities caps = {}; + EXPECT_TRUE(wifi_rtt_controller_->getCapabilities(&caps).isOk()); + return caps; + } + std::shared_ptr wifi_rtt_controller_; private: @@ -117,6 +123,11 @@ TEST_P(WifiRttControllerAidlTest, GetCapabilities) { * GetResponderInfo */ TEST_P(WifiRttControllerAidlTest, GetResponderInfo) { + RttCapabilities caps = getCapabilities(); + if (!caps.responderSupported) { + GTEST_SKIP() << "Skipping because responder is not supported"; + } + RttResponder responder = {}; EXPECT_TRUE(wifi_rtt_controller_->getResponderInfo(&responder).isOk()); } @@ -125,6 +136,11 @@ TEST_P(WifiRttControllerAidlTest, GetResponderInfo) { * EnableResponder */ TEST_P(WifiRttControllerAidlTest, EnableResponder) { + RttCapabilities caps = getCapabilities(); + if (!caps.responderSupported) { + GTEST_SKIP() << "Skipping because responder is not supported"; + } + int cmdId = 55; WifiChannelInfo channelInfo; channelInfo.width = WifiChannelWidthInMhz::WIDTH_80; @@ -142,8 +158,7 @@ TEST_P(WifiRttControllerAidlTest, EnableResponder) { * Tests the two sided ranging - 802.11mc FTM protocol. */ TEST_P(WifiRttControllerAidlTest, Request2SidedRangeMeasurement) { - RttCapabilities caps = {}; - EXPECT_TRUE(wifi_rtt_controller_->getCapabilities(&caps).isOk()); + RttCapabilities caps = getCapabilities(); if (!caps.rttFtmSupported) { GTEST_SKIP() << "Skipping two sided RTT since driver/fw does not support"; } @@ -179,8 +194,7 @@ TEST_P(WifiRttControllerAidlTest, Request2SidedRangeMeasurement) { * RangeRequest */ TEST_P(WifiRttControllerAidlTest, RangeRequest) { - RttCapabilities caps = {}; - EXPECT_TRUE(wifi_rtt_controller_->getCapabilities(&caps).isOk()); + RttCapabilities caps = getCapabilities(); if (!caps.rttOneSidedSupported) { GTEST_SKIP() << "Skipping one sided RTT since driver/fw does not support"; } From 6078da87cadf5866e26f3cc45b93c7839035ad97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Kosi=C5=84ski?= Date: Wed, 3 May 2023 03:15:25 +0000 Subject: [PATCH 951/998] Use internal gRPC headers in BindToDeviceSocketMutatorLib. Bug: 280043032 Test: presubmit Change-Id: I53c413ab3dbbfb056f3b7f22c1db336aa68ba611 Merged-In: I53c413ab3dbbfb056f3b7f22c1db336aa68ba611 --- automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp | 1 + 1 file changed, 1 insertion(+) diff --git a/automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp b/automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp index 58df21ac52..cde021938f 100644 --- a/automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp +++ b/automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp @@ -40,4 +40,5 @@ cc_library { srcs: ["src/BindToDeviceSocketMutator.cpp"], export_include_dirs: ["include"], defaults: ["BindToDeviceSocketMutatorDefaults"], + header_libs: ["libgrpc++_internal_headers"], } From f3cd073e86ee607adb20b4d3d9cf5041f30892d4 Mon Sep 17 00:00:00 2001 From: terryguan Date: Thu, 30 Mar 2023 09:20:08 -0700 Subject: [PATCH 952/998] Added debug statement and refresh in default vehicle hal Added a debug statement to allow for a debug command to generate a large amount of propConfigs to test large parcelables. DefaultVehicleHal needed to refresh the properties when DefaultVehicleHal's getAllPropConfigs is called Bug: 270740905 Test: atest DefaultVehicleHalTest Test: atest android.car.apitest.CarPropertyManagerTest Test: --rerun-until-failure 3 Test: Manual Change-Id: I95eb98cef64e327894760783ffe9883975359d89 --- .../hardware/include/FakeVehicleHardware.h | 3 ++ .../hardware/src/FakeVehicleHardware.cpp | 38 +++++++++++++++++- .../impl/hardware/include/IVehicleHardware.h | 2 + .../impl/vhal/include/DefaultVehicleHal.h | 4 +- .../aidl/impl/vhal/src/DefaultVehicleHal.cpp | 39 ++++++++++++------- 5 files changed, 70 insertions(+), 16 deletions(-) diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h index 84395a22cf..c3ebd3b3bc 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h @@ -159,6 +159,7 @@ class FakeVehicleHardware : public IVehicleHardware { const std::string mDefaultConfigDir; const std::string mOverrideConfigDir; const bool mForceOverride; + bool mAddExtraTestVendorConfigs; // Only used during initialization. JsonConfigLoader mLoader; @@ -248,6 +249,8 @@ class FakeVehicleHardware : public IVehicleHardware { std::string genFakeDataCommand(const std::vector& options); void sendHvacPropertiesCurrentValues(int32_t areaId); void sendAdasPropertiesState(int32_t propertyId, int32_t state); + void generateVendorConfigs( + std::vector&) const; static aidl::android::hardware::automotive::vehicle::VehiclePropValue createHwInputKeyProp( aidl::android::hardware::automotive::vehicle::VehicleHwKeyInputAction action, diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index 577442e83f..740d3f6831 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -64,6 +64,7 @@ using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq; using ::aidl::android::hardware::automotive::vehicle::VehicleHwKeyInputAction; using ::aidl::android::hardware::automotive::vehicle::VehiclePropConfig; using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; +using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess; using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup; using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyStatus; using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType; @@ -79,6 +80,11 @@ using ::android::base::ScopedLockAssertion; using ::android::base::StartsWith; using ::android::base::StringPrintf; +// In order to test large number of vehicle property configs, we might generate additional fake +// property config start from this ID. Note these fake properties are for getAllPropertyConfigs +// testing only. +constexpr int32_t STARTING_VENDOR_CODE_PROPERTIES_FOR_TEST = 0x5000; +constexpr int32_t NUMBER_OF_TEST_VENDOR_CODES = 0x3000; // The directory for default property configuration file. // For config file format, see impl/default_config/config/README.md. constexpr char DEFAULT_CONFIG_DIR[] = "/vendor/etc/automotive/vhalconfig/"; @@ -291,7 +297,11 @@ void FakeVehicleHardware::init() { } std::vector FakeVehicleHardware::getAllPropertyConfigs() const { - return mServerSidePropStore->getAllConfigs(); + std::vector allConfigs = mServerSidePropStore->getAllConfigs(); + if (mAddExtraTestVendorConfigs) { + generateVendorConfigs(/* outAllConfigs= */ allConfigs); + } + return allConfigs; } VehiclePropValuePool::RecyclableType FakeVehicleHardware::createApPowerStateReq( @@ -953,6 +963,12 @@ DumpResult FakeVehicleHardware::dump(const std::vector& options) { result.buffer = mFakeUserHal->dump(); } else if (EqualsIgnoreCase(option, "--genfakedata")) { result.buffer = genFakeDataCommand(options); + } else if (EqualsIgnoreCase(option, "--genTestVendorConfigs")) { + mAddExtraTestVendorConfigs = true; + result.refreshPropertyConfigs = true; + } else if (EqualsIgnoreCase(option, "--restoreVendorConfigs")) { + mAddExtraTestVendorConfigs = false; + result.refreshPropertyConfigs = true; } else { result.buffer = StringPrintf("Invalid option: %s\n", option.c_str()); } @@ -1003,6 +1019,13 @@ provided, it would iterate indefinitely. [pressure(float)] [size(float)] Generate a motion input event. --pointer option can be specified multiple times. +--genTestVendorConfigs: Generates fake VehiclePropConfig ranging from 0x5000 to 0x8000 all with + vendor property group, global vehicle area, and int32 vehicle property type. This is mainly used + for testing + +--restoreVendorConfigs: Restores to to the default state if genTestVendorConfigs was used. + Otherwise this will do nothing. + )"; } @@ -1012,6 +1035,19 @@ std::string FakeVehicleHardware::parseErrMsg(std::string fieldName, std::string value.c_str(), genFakeDataHelp().c_str()); } +void FakeVehicleHardware::generateVendorConfigs( + std::vector& outAllConfigs) const { + for (int i = STARTING_VENDOR_CODE_PROPERTIES_FOR_TEST; + i < STARTING_VENDOR_CODE_PROPERTIES_FOR_TEST + NUMBER_OF_TEST_VENDOR_CODES; i++) { + VehiclePropConfig config; + config.prop = i | toInt(propertyutils_impl::VehiclePropertyGroup::VENDOR) | + toInt(propertyutils_impl::VehicleArea::GLOBAL) | + toInt(propertyutils_impl::VehiclePropertyType::INT32); + config.access = VehiclePropertyAccess::READ_WRITE; + outAllConfigs.push_back(config); + } +} + std::string FakeVehicleHardware::genFakeDataCommand(const std::vector& options) { if (options.size() < 2) { return "No subcommand specified for genfakedata\n" + genFakeDataHelp(); diff --git a/automotive/vehicle/aidl/impl/hardware/include/IVehicleHardware.h b/automotive/vehicle/aidl/impl/hardware/include/IVehicleHardware.h index d92ccfddab..e53947ee33 100644 --- a/automotive/vehicle/aidl/impl/hardware/include/IVehicleHardware.h +++ b/automotive/vehicle/aidl/impl/hardware/include/IVehicleHardware.h @@ -35,6 +35,8 @@ struct DumpResult { bool callerShouldDumpState; // The dumped information for the caller to print. std::string buffer; + // To pass if DefaultVehicleHal should refresh the property configs + bool refreshPropertyConfigs = false; }; // A structure to represent a set value error event reported from vehicle. diff --git a/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h b/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h index 0439ac6eac..2c2cf1a5bd 100644 --- a/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h +++ b/automotive/vehicle/aidl/impl/vhal/include/DefaultVehicleHal.h @@ -164,6 +164,7 @@ class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehi static constexpr int64_t TIMEOUT_IN_NANO = 30'000'000'000; // heart beat event interval: 3s static constexpr int64_t HEART_BEAT_INTERVAL_IN_NANO = 3'000'000'000; + bool mShouldRefreshPropertyConfigs; std::unique_ptr mVehicleHardware; // mConfigsByPropId and mConfigFile are only modified during initialization, so no need to @@ -212,7 +213,6 @@ class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehi android::base::Result> checkDuplicateRequests( const std::vector& requests); - VhalResult checkSubscribeOptions( const std::vector& options); @@ -236,6 +236,8 @@ class DefaultVehicleHal final : public aidl::android::hardware::automotive::vehi bool checkDumpPermission(); + bool getAllPropConfigsFromHardware(); + // The looping handler function to process all onBinderDied or onBinderUnlinked events in // mBinderEvents. void onBinderDiedUnlinkedHandler(); diff --git a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp index a7ac1b4309..98cfc398af 100644 --- a/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp +++ b/automotive/vehicle/aidl/impl/vhal/src/DefaultVehicleHal.cpp @@ -128,23 +128,10 @@ size_t DefaultVehicleHal::SubscriptionClients::countClients() { DefaultVehicleHal::DefaultVehicleHal(std::unique_ptr vehicleHardware) : mVehicleHardware(std::move(vehicleHardware)), mPendingRequestPool(std::make_shared(TIMEOUT_IN_NANO)) { - auto configs = mVehicleHardware->getAllPropertyConfigs(); - for (auto& config : configs) { - mConfigsByPropId[config.prop] = config; - } - VehiclePropConfigs vehiclePropConfigs; - vehiclePropConfigs.payloads = std::move(configs); - auto result = LargeParcelableBase::parcelableToStableLargeParcelable(vehiclePropConfigs); - if (!result.ok()) { - ALOGE("failed to convert configs to shared memory file, error: %s, code: %d", - result.error().message().c_str(), static_cast(result.error().code())); + if (!getAllPropConfigsFromHardware()) { return; } - if (result.value() != nullptr) { - mConfigFile = std::move(result.value()); - } - mSubscriptionClients = std::make_shared(mPendingRequestPool); auto subscribeIdByClient = std::make_shared(); @@ -304,6 +291,27 @@ void DefaultVehicleHal::setTimeout(int64_t timeoutInNano) { mPendingRequestPool = std::make_unique(timeoutInNano); } +bool DefaultVehicleHal::getAllPropConfigsFromHardware() { + auto configs = mVehicleHardware->getAllPropertyConfigs(); + for (auto& config : configs) { + mConfigsByPropId[config.prop] = config; + } + VehiclePropConfigs vehiclePropConfigs; + vehiclePropConfigs.payloads = std::move(configs); + auto result = LargeParcelableBase::parcelableToStableLargeParcelable(vehiclePropConfigs); + if (!result.ok()) { + ALOGE("failed to convert configs to shared memory file, error: %s, code: %d", + result.error().message().c_str(), static_cast(result.error().code())); + mConfigFile = nullptr; + return false; + } + + if (result.value() != nullptr) { + mConfigFile = std::move(result.value()); + } + return true; +} + ScopedAStatus DefaultVehicleHal::getAllPropConfigs(VehiclePropConfigs* output) { if (mConfigFile != nullptr) { output->payloads.clear(); @@ -798,6 +806,9 @@ binder_status_t DefaultVehicleHal::dump(int fd, const char** args, uint32_t numA options.clear(); } DumpResult result = mVehicleHardware->dump(options); + if (result.refreshPropertyConfigs) { + getAllPropConfigsFromHardware(); + } dprintf(fd, "%s", (result.buffer + "\n").c_str()); if (!result.callerShouldDumpState) { return STATUS_OK; From bb35a4371eb07021ce6f1e9f8f58b771a90c1157 Mon Sep 17 00:00:00 2001 From: Sarah Chin Date: Tue, 2 May 2023 21:11:41 -0700 Subject: [PATCH 953/998] Clean up VtsHalRadioTargetTest Refactor class design so RadioServiceTest extends TestWithParam and each individual radio service test extends RadioServiceTest. Move setup and teardown logic common to all classes to RadioServiceTest. Add logs to print when each test starts/finishes to help debug issues. Remove unused imports and fix some typos. Change unique_lock to lock_guard in notify to prevent MTE errors. Test: atest VtsHalRadioTargetTest on fullmte build Bug: 263940636 Change-Id: I2f6844f07d4518c00d47f98e5e15bea0a809fa84 Merged-In: I2f6844f07d4518c00d47f98e5e15bea0a809fa84 --- radio/aidl/vts/radio_aidl_hal_utils.cpp | 17 ++++++- radio/aidl/vts/radio_aidl_hal_utils.h | 12 +++-- radio/aidl/vts/radio_config_test.cpp | 4 +- radio/aidl/vts/radio_config_utils.h | 5 +- radio/aidl/vts/radio_data_test.cpp | 8 +-- radio/aidl/vts/radio_data_utils.h | 4 +- radio/aidl/vts/radio_ims_test.cpp | 4 +- radio/aidl/vts/radio_ims_utils.h | 4 +- radio/aidl/vts/radio_imsmedia_test.cpp | 5 +- radio/aidl/vts/radio_imsmedia_utils.h | 4 +- radio/aidl/vts/radio_messaging_test.cpp | 46 +---------------- radio/aidl/vts/radio_messaging_utils.h | 4 +- radio/aidl/vts/radio_modem_test.cpp | 28 +--------- radio/aidl/vts/radio_modem_utils.h | 4 +- radio/aidl/vts/radio_network_test.cpp | 53 +++---------------- radio/aidl/vts/radio_network_utils.h | 4 +- radio/aidl/vts/radio_sap_test.cpp | 36 +++++-------- radio/aidl/vts/radio_sim_test.cpp | 50 +----------------- radio/aidl/vts/radio_sim_utils.h | 4 +- radio/aidl/vts/radio_voice_test.cpp | 68 +------------------------ radio/aidl/vts/radio_voice_utils.h | 4 +- 21 files changed, 72 insertions(+), 296 deletions(-) diff --git a/radio/aidl/vts/radio_aidl_hal_utils.cpp b/radio/aidl/vts/radio_aidl_hal_utils.cpp index f18da55c3f..64969dea73 100644 --- a/radio/aidl/vts/radio_aidl_hal_utils.cpp +++ b/radio/aidl/vts/radio_aidl_hal_utils.cpp @@ -16,7 +16,6 @@ #define LOG_TAG "RadioTest" #include "radio_aidl_hal_utils.h" -#include #include "VtsCoreUtil.h" #include "radio_config_utils.h" #include "radio_sim_utils.h" @@ -144,11 +143,25 @@ bool isServiceValidForDeviceConfiguration(std::string& serviceName) { return true; } +void RadioServiceTest::SetUp() { + ALOGD("BEGIN %s#%s", ::testing::UnitTest::GetInstance()->current_test_info()->test_suite_name(), + ::testing::UnitTest::GetInstance()->current_test_info()->name()); + count_ = 0; + serial = -1; +} + +void RadioServiceTest::TearDown() { + count_ = 0; + serial = -1; + ALOGD("END %s#%s", ::testing::UnitTest::GetInstance()->current_test_info()->test_suite_name(), + ::testing::UnitTest::GetInstance()->current_test_info()->name()); +} + /* * Notify that the response message is received. */ void RadioServiceTest::notify(int receivedSerial) { - std::unique_lock lock(mtx_); + std::lock_guard lock(mtx_); if (serial == receivedSerial) { count_++; cv_.notify_one(); diff --git a/radio/aidl/vts/radio_aidl_hal_utils.h b/radio/aidl/vts/radio_aidl_hal_utils.h index d515e1a7c0..09c4f144d8 100644 --- a/radio/aidl/vts/radio_aidl_hal_utils.h +++ b/radio/aidl/vts/radio_aidl_hal_utils.h @@ -25,7 +25,6 @@ #include #include #include -#include using namespace aidl::android::hardware::radio; using aidl::android::hardware::radio::config::SimSlotStatus; @@ -133,14 +132,15 @@ bool isServiceValidForDeviceConfiguration(std::string& serviceName); /** * RadioServiceTest base class */ -class RadioServiceTest { +class RadioServiceTest : public ::testing::TestWithParam { protected: - std::mutex mtx_; - std::condition_variable cv_; std::shared_ptr radio_config; std::shared_ptr radio_sim; public: + void SetUp() override; + void TearDown() override; + /* Used as a mechanism to inform the test about data/event callback */ void notify(int receivedSerial); @@ -155,4 +155,8 @@ class RadioServiceTest { /* Update SIM slot status */ void updateSimSlotStatus(int physicalSlotId); + + private: + std::mutex mtx_; + std::condition_variable cv_; }; diff --git a/radio/aidl/vts/radio_config_test.cpp b/radio/aidl/vts/radio_config_test.cpp index c979d28781..aed3b05b4f 100644 --- a/radio/aidl/vts/radio_config_test.cpp +++ b/radio/aidl/vts/radio_config_test.cpp @@ -14,7 +14,6 @@ * limitations under the License. */ -#include #include #include "radio_config_utils.h" @@ -22,6 +21,7 @@ #define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk()) void RadioConfigTest::SetUp() { + RadioServiceTest::SetUp(); std::string serviceName = GetParam(); radio_config = IRadioConfig::fromBinder( @@ -31,8 +31,6 @@ void RadioConfigTest::SetUp() { radioRsp_config = ndk::SharedRefBase::make(*this); ASSERT_NE(nullptr, radioRsp_config.get()); - count_ = 0; - radioInd_config = ndk::SharedRefBase::make(*this); ASSERT_NE(nullptr, radioInd_config.get()); diff --git a/radio/aidl/vts/radio_config_utils.h b/radio/aidl/vts/radio_config_utils.h index 3db430db5f..f79aedbf9e 100644 --- a/radio/aidl/vts/radio_config_utils.h +++ b/radio/aidl/vts/radio_config_utils.h @@ -74,9 +74,10 @@ class RadioConfigIndication : public BnRadioConfigIndication { }; // The main test class for Radio AIDL Config. -class RadioConfigTest : public ::testing::TestWithParam, public RadioServiceTest { +class RadioConfigTest : public RadioServiceTest { public: - virtual void SetUp() override; + void SetUp() override; + ndk::ScopedAStatus updateSimCardStatus(); /* Override updateSimSlotStatus in RadioServiceTest to not call setResponseFunctions */ void updateSimSlotStatus(); diff --git a/radio/aidl/vts/radio_data_test.cpp b/radio/aidl/vts/radio_data_test.cpp index 3eedc146ff..0fb2fb404f 100644 --- a/radio/aidl/vts/radio_data_test.cpp +++ b/radio/aidl/vts/radio_data_test.cpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include "radio_data_utils.h" @@ -25,6 +24,7 @@ #define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk()) void RadioDataTest::SetUp() { + RadioServiceTest::SetUp(); std::string serviceName = GetParam(); if (!isServiceValidForDeviceConfiguration(serviceName)) { @@ -39,8 +39,6 @@ void RadioDataTest::SetUp() { radioRsp_data = ndk::SharedRefBase::make(*this); ASSERT_NE(nullptr, radioRsp_data.get()); - count_ = 0; - radioInd_data = ndk::SharedRefBase::make(*this); ASSERT_NE(nullptr, radioInd_data.get()); @@ -555,7 +553,6 @@ TEST_P(RadioDataTest, stopKeepalive) { * Test IRadioData.getDataCallList() for the response returned. */ TEST_P(RadioDataTest, getDataCallList) { - LOG(DEBUG) << "getDataCallList"; serial = GetRandomSerialNumber(); radio_data->getDataCallList(serial); @@ -569,14 +566,12 @@ TEST_P(RadioDataTest, getDataCallList) { radioRsp_data->rspInfo.error, {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::SIM_ABSENT})); } - LOG(DEBUG) << "getDataCallList finished"; } /* * Test IRadioData.setDataAllowed() for the response returned. */ TEST_P(RadioDataTest, setDataAllowed) { - LOG(DEBUG) << "setDataAllowed"; serial = GetRandomSerialNumber(); bool allow = true; @@ -589,5 +584,4 @@ TEST_P(RadioDataTest, setDataAllowed) { if (cardStatus.cardState == CardStatus::STATE_ABSENT) { EXPECT_EQ(RadioError::NONE, radioRsp_data->rspInfo.error); } - LOG(DEBUG) << "setDataAllowed finished"; } diff --git a/radio/aidl/vts/radio_data_utils.h b/radio/aidl/vts/radio_data_utils.h index fb91ef61d5..0959207cf6 100644 --- a/radio/aidl/vts/radio_data_utils.h +++ b/radio/aidl/vts/radio_data_utils.h @@ -100,13 +100,13 @@ class RadioDataIndication : public BnRadioDataIndication { }; // The main test class for Radio AIDL Data. -class RadioDataTest : public ::testing::TestWithParam, public RadioServiceTest { +class RadioDataTest : public RadioServiceTest { protected: /* Get current data call list */ ndk::ScopedAStatus getDataCallList(); public: - virtual void SetUp() override; + void SetUp() override; /* radio data service handle */ std::shared_ptr radio_data; diff --git a/radio/aidl/vts/radio_ims_test.cpp b/radio/aidl/vts/radio_ims_test.cpp index 289d3ed54d..1938e0a8b6 100644 --- a/radio/aidl/vts/radio_ims_test.cpp +++ b/radio/aidl/vts/radio_ims_test.cpp @@ -15,7 +15,6 @@ */ #include -#include #include #include "radio_ims_utils.h" @@ -23,6 +22,7 @@ #define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk()) void RadioImsTest::SetUp() { + RadioServiceTest::SetUp(); std::string serviceName = GetParam(); if (!isServiceValidForDeviceConfiguration(serviceName)) { @@ -37,8 +37,6 @@ void RadioImsTest::SetUp() { radioRsp_ims = ndk::SharedRefBase::make(*this); ASSERT_NE(nullptr, radioRsp_ims.get()); - count_ = 0; - radioInd_ims = ndk::SharedRefBase::make(*this); ASSERT_NE(nullptr, radioInd_ims.get()); diff --git a/radio/aidl/vts/radio_ims_utils.h b/radio/aidl/vts/radio_ims_utils.h index 2bf80dc987..208c94b05c 100644 --- a/radio/aidl/vts/radio_ims_utils.h +++ b/radio/aidl/vts/radio_ims_utils.h @@ -76,12 +76,12 @@ class RadioImsIndication : public BnRadioImsIndication { }; // The main test class for Radio AIDL Ims. -class RadioImsTest : public ::testing::TestWithParam, public RadioServiceTest { +class RadioImsTest : public RadioServiceTest { protected: virtual void verifyError(RadioError resp); public: - virtual void SetUp() override; + void SetUp() override; /* radio ims service handle */ std::shared_ptr radio_ims; diff --git a/radio/aidl/vts/radio_imsmedia_test.cpp b/radio/aidl/vts/radio_imsmedia_test.cpp index 2b6f5ef8b7..425f6b4d6a 100644 --- a/radio/aidl/vts/radio_imsmedia_test.cpp +++ b/radio/aidl/vts/radio_imsmedia_test.cpp @@ -15,7 +15,6 @@ */ #include -#include #include #include #include @@ -25,10 +24,9 @@ #define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk()) void RadioImsMediaTest::SetUp() { + RadioServiceTest::SetUp(); std::string serviceName = GetParam(); - ALOGD("Enter RadioImsMediaTest."); - radio_imsmedia = IImsMedia::fromBinder( ndk::SpAIBinder(AServiceManager_waitForService(GetParam().c_str()))); ASSERT_NE(nullptr, radio_imsmedia.get()); @@ -38,7 +36,6 @@ void RadioImsMediaTest::SetUp() { radio_imsmediasessionlistener = ndk::SharedRefBase::make(*this); ASSERT_NE(nullptr, radio_imsmediasessionlistener.get()); - count_ = 0; } TEST_P(RadioImsMediaTest, MOCallSuccess) { diff --git a/radio/aidl/vts/radio_imsmedia_utils.h b/radio/aidl/vts/radio_imsmedia_utils.h index 6143addd03..87f1b00a63 100644 --- a/radio/aidl/vts/radio_imsmedia_utils.h +++ b/radio/aidl/vts/radio_imsmedia_utils.h @@ -79,13 +79,13 @@ class ImsMediaSessionListener : public BnImsMediaSessionListener { }; /* The main test class for Radio AIDL ImsMedia. */ -class RadioImsMediaTest : public ::testing::TestWithParam, public RadioServiceTest { +class RadioImsMediaTest : public RadioServiceTest { protected: virtual void verifyError(RtpError inError); virtual ndk::ScopedAStatus triggerOpenSession(int32_t sessionId); public: - virtual void SetUp() override; + void SetUp() override; /* radio imsmedia service handle */ std::shared_ptr radio_imsmedia; diff --git a/radio/aidl/vts/radio_messaging_test.cpp b/radio/aidl/vts/radio_messaging_test.cpp index 9f1718b1a0..4ab88d2d8a 100644 --- a/radio/aidl/vts/radio_messaging_test.cpp +++ b/radio/aidl/vts/radio_messaging_test.cpp @@ -15,7 +15,6 @@ */ #include -#include #include #include "radio_messaging_utils.h" @@ -23,6 +22,7 @@ #define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk()) void RadioMessagingTest::SetUp() { + RadioServiceTest::SetUp(); std::string serviceName = GetParam(); if (!isServiceValidForDeviceConfiguration(serviceName)) { @@ -37,8 +37,6 @@ void RadioMessagingTest::SetUp() { radioRsp_messaging = ndk::SharedRefBase::make(*this); ASSERT_NE(nullptr, radioRsp_messaging.get()); - count_ = 0; - radioInd_messaging = ndk::SharedRefBase::make(*this); ASSERT_NE(nullptr, radioInd_messaging.get()); @@ -61,7 +59,6 @@ void RadioMessagingTest::SetUp() { * Test IRadioMessaging.sendSms() for the response returned. */ TEST_P(RadioMessagingTest, sendSms) { - LOG(DEBUG) << "sendSms"; serial = GetRandomSerialNumber(); GsmSmsMessage msg; msg.smscPdu = ""; @@ -80,14 +77,12 @@ TEST_P(RadioMessagingTest, sendSms) { CHECK_GENERAL_ERROR)); EXPECT_EQ(0, radioRsp_messaging->sendSmsResult.errorCode); } - LOG(DEBUG) << "sendSms finished"; } /* * Test IRadioMessaging.sendSmsExpectMore() for the response returned. */ TEST_P(RadioMessagingTest, sendSmsExpectMore) { - LOG(DEBUG) << "sendSmsExpectMore"; serial = GetRandomSerialNumber(); GsmSmsMessage msg; msg.smscPdu = ""; @@ -105,14 +100,12 @@ TEST_P(RadioMessagingTest, sendSmsExpectMore) { {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::SIM_ABSENT}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "sendSmsExpectMore finished"; } /* * Test IRadioMessaging.sendCdmaSms() for the response returned. */ TEST_P(RadioMessagingTest, sendCdmaSms) { - LOG(DEBUG) << "sendCdmaSms"; serial = GetRandomSerialNumber(); // Create a CdmaSmsAddress @@ -151,7 +144,6 @@ TEST_P(RadioMessagingTest, sendCdmaSms) { {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::SIM_ABSENT}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "sendCdmaSms finished"; } /* @@ -202,7 +194,6 @@ TEST_P(RadioMessagingTest, sendCdmaSmsExpectMore) { * Test IRadioMessaging.setGsmBroadcastConfig() for the response returned. */ TEST_P(RadioMessagingTest, setGsmBroadcastConfig) { - LOG(DEBUG) << "setGsmBroadcastConfig"; serial = GetRandomSerialNumber(); // Create GsmBroadcastSmsConfigInfo #1 @@ -260,14 +251,12 @@ TEST_P(RadioMessagingTest, setGsmBroadcastConfig) { RadioError::INVALID_MODEM_STATE, RadioError::INVALID_STATE}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "setGsmBroadcastConfig finished"; } /* * Test IRadioMessaging.getGsmBroadcastConfig() for the response returned. */ TEST_P(RadioMessagingTest, getGsmBroadcastConfig) { - LOG(DEBUG) << "getGsmBroadcastConfig"; serial = GetRandomSerialNumber(); radio_messaging->getGsmBroadcastConfig(serial); @@ -282,14 +271,12 @@ TEST_P(RadioMessagingTest, getGsmBroadcastConfig) { {RadioError::NONE, RadioError::INVALID_MODEM_STATE, RadioError::INVALID_STATE}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "getGsmBroadcastConfig finished"; } /* * Test IRadioMessaging.setCdmaBroadcastConfig() for the response returned. */ TEST_P(RadioMessagingTest, setCdmaBroadcastConfig) { - LOG(DEBUG) << "setCdmaBroadcastConfig"; serial = GetRandomSerialNumber(); CdmaBroadcastSmsConfigInfo cbSmsConfig; @@ -310,14 +297,12 @@ TEST_P(RadioMessagingTest, setCdmaBroadcastConfig) { {RadioError::NONE, RadioError::INVALID_MODEM_STATE}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "setCdmaBroadcastConfig finished"; } /* * Test IRadioMessaging.getCdmaBroadcastConfig() for the response returned. */ TEST_P(RadioMessagingTest, getCdmaBroadcastConfig) { - LOG(DEBUG) << "getCdmaBroadcastConfig"; serial = GetRandomSerialNumber(); radio_messaging->getCdmaBroadcastConfig(serial); @@ -330,14 +315,12 @@ TEST_P(RadioMessagingTest, getCdmaBroadcastConfig) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_messaging->rspInfo.error, {RadioError::NONE}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "getCdmaBroadcastConfig finished"; } /* * Test IRadioMessaging.setCdmaBroadcastActivation() for the response returned. */ TEST_P(RadioMessagingTest, setCdmaBroadcastActivation) { - LOG(DEBUG) << "setCdmaBroadcastActivation"; serial = GetRandomSerialNumber(); bool activate = false; @@ -352,14 +335,12 @@ TEST_P(RadioMessagingTest, setCdmaBroadcastActivation) { {RadioError::NONE, RadioError::INVALID_ARGUMENTS}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "setCdmaBroadcastActivation finished"; } /* * Test IRadioMessaging.setGsmBroadcastActivation() for the response returned. */ TEST_P(RadioMessagingTest, setGsmBroadcastActivation) { - LOG(DEBUG) << "setGsmBroadcastActivation"; serial = GetRandomSerialNumber(); bool activate = false; @@ -376,14 +357,12 @@ TEST_P(RadioMessagingTest, setGsmBroadcastActivation) { RadioError::INVALID_STATE, RadioError::OPERATION_NOT_ALLOWED}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "setGsmBroadcastActivation finished"; } /* * Test IRadioMessaging.acknowledgeLastIncomingGsmSms() for the response returned. */ TEST_P(RadioMessagingTest, acknowledgeLastIncomingGsmSms) { - LOG(DEBUG) << "acknowledgeLastIncomingGsmSms"; serial = GetRandomSerialNumber(); bool success = true; @@ -399,14 +378,12 @@ TEST_P(RadioMessagingTest, acknowledgeLastIncomingGsmSms) { {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "acknowledgeLastIncomingGsmSms finished"; } /* * Test IRadioMessaging.acknowledgeIncomingGsmSmsWithPdu() for the response returned. */ TEST_P(RadioMessagingTest, acknowledgeIncomingGsmSmsWithPdu) { - LOG(DEBUG) << "acknowledgeIncomingGsmSmsWithPdu"; serial = GetRandomSerialNumber(); bool success = true; std::string ackPdu = ""; @@ -422,14 +399,12 @@ TEST_P(RadioMessagingTest, acknowledgeIncomingGsmSmsWithPdu) { {RadioError::INVALID_ARGUMENTS, RadioError::NO_SMS_TO_ACK}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "acknowledgeIncomingGsmSmsWithPdu finished"; } /* * Test IRadioMessaging.acknowledgeLastIncomingCdmaSms() for the response returned. */ TEST_P(RadioMessagingTest, acknowledgeLastIncomingCdmaSms) { - LOG(DEBUG) << "acknowledgeLastIncomingCdmaSms"; serial = GetRandomSerialNumber(); // Create a CdmaSmsAck @@ -448,14 +423,12 @@ TEST_P(RadioMessagingTest, acknowledgeLastIncomingCdmaSms) { {RadioError::INVALID_ARGUMENTS, RadioError::NO_SMS_TO_ACK}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "acknowledgeLastIncomingCdmaSms finished"; } /* * Test IRadioMessaging.sendImsSms() for the response returned. */ TEST_P(RadioMessagingTest, sendImsSms) { - LOG(DEBUG) << "sendImsSms"; serial = GetRandomSerialNumber(); // Create a CdmaSmsAddress @@ -482,7 +455,7 @@ TEST_P(RadioMessagingTest, sendImsSms) { cdmaSmsMessage.bearerData = (std::vector){15, 0, 3, 32, 3, 16, 1, 8, 16, 53, 76, 68, 6, 51, 106, 0}; - // Creata an ImsSmsMessage + // Create an ImsSmsMessage ImsSmsMessage msg; msg.tech = RadioTechnologyFamily::THREE_GPP2; msg.retry = false; @@ -500,14 +473,12 @@ TEST_P(RadioMessagingTest, sendImsSms) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_messaging->rspInfo.error, {RadioError::INVALID_ARGUMENTS}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "sendImsSms finished"; } /* * Test IRadioMessaging.getSmscAddress() for the response returned. */ TEST_P(RadioMessagingTest, getSmscAddress) { - LOG(DEBUG) << "getSmscAddress"; serial = GetRandomSerialNumber(); radio_messaging->getSmscAddress(serial); @@ -522,14 +493,12 @@ TEST_P(RadioMessagingTest, getSmscAddress) { RadioError::SIM_ABSENT}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "getSmscAddress finished"; } /* * Test IRadioMessaging.setSmscAddress() for the response returned. */ TEST_P(RadioMessagingTest, setSmscAddress) { - LOG(DEBUG) << "setSmscAddress"; serial = GetRandomSerialNumber(); std::string address = std::string("smscAddress"); @@ -545,14 +514,12 @@ TEST_P(RadioMessagingTest, setSmscAddress) { RadioError::SIM_ABSENT}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "setSmscAddress finished"; } /* * Test IRadioMessaging.writeSmsToSim() for the response returned. */ TEST_P(RadioMessagingTest, writeSmsToSim) { - LOG(DEBUG) << "writeSmsToSim"; serial = GetRandomSerialNumber(); SmsWriteArgs smsWriteArgs; smsWriteArgs.status = SmsWriteArgs::STATUS_REC_UNREAD; @@ -573,14 +540,12 @@ TEST_P(RadioMessagingTest, writeSmsToSim) { RadioError::NETWORK_NOT_READY, RadioError::NO_RESOURCES, RadioError::SIM_ABSENT}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "writeSmsToSim finished"; } /* * Test IRadioMessaging.deleteSmsOnSim() for the response returned. */ TEST_P(RadioMessagingTest, deleteSmsOnSim) { - LOG(DEBUG) << "deleteSmsOnSim"; serial = GetRandomSerialNumber(); int index = 1; @@ -598,14 +563,12 @@ TEST_P(RadioMessagingTest, deleteSmsOnSim) { RadioError::SIM_ABSENT}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "deleteSmsOnSim finished"; } /* * Test IRadioMessaging.writeSmsToRuim() for the response returned. */ TEST_P(RadioMessagingTest, writeSmsToRuim) { - LOG(DEBUG) << "writeSmsToRuim"; serial = GetRandomSerialNumber(); // Create a CdmaSmsAddress @@ -651,14 +614,12 @@ TEST_P(RadioMessagingTest, writeSmsToRuim) { RadioError::NO_SUCH_ENTRY, RadioError::SIM_ABSENT}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "writeSmsToRuim finished"; } /* * Test IRadioMessaging.deleteSmsOnRuim() for the response returned. */ TEST_P(RadioMessagingTest, deleteSmsOnRuim) { - LOG(DEBUG) << "deleteSmsOnRuim"; serial = GetRandomSerialNumber(); int index = 1; @@ -704,14 +665,12 @@ TEST_P(RadioMessagingTest, deleteSmsOnRuim) { RadioError::MODEM_ERR, RadioError::NO_SUCH_ENTRY, RadioError::SIM_ABSENT}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "deleteSmsOnRuim finished"; } /* * Test IRadioMessaging.reportSmsMemoryStatus() for the response returned. */ TEST_P(RadioMessagingTest, reportSmsMemoryStatus) { - LOG(DEBUG) << "reportSmsMemoryStatus"; serial = GetRandomSerialNumber(); bool available = true; @@ -727,5 +686,4 @@ TEST_P(RadioMessagingTest, reportSmsMemoryStatus) { RadioError::MODEM_ERR, RadioError::SIM_ABSENT}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "reportSmsMemoryStatus finished"; } diff --git a/radio/aidl/vts/radio_messaging_utils.h b/radio/aidl/vts/radio_messaging_utils.h index 7b66192679..3bd8346575 100644 --- a/radio/aidl/vts/radio_messaging_utils.h +++ b/radio/aidl/vts/radio_messaging_utils.h @@ -132,9 +132,9 @@ class RadioMessagingIndication : public BnRadioMessagingIndication { }; // The main test class for Radio AIDL Messaging. -class RadioMessagingTest : public ::testing::TestWithParam, public RadioServiceTest { +class RadioMessagingTest : public RadioServiceTest { public: - virtual void SetUp() override; + void SetUp() override; /* radio messaging service handle */ std::shared_ptr radio_messaging; diff --git a/radio/aidl/vts/radio_modem_test.cpp b/radio/aidl/vts/radio_modem_test.cpp index 67747a882f..c48a46104a 100644 --- a/radio/aidl/vts/radio_modem_test.cpp +++ b/radio/aidl/vts/radio_modem_test.cpp @@ -15,7 +15,6 @@ */ #include -#include #include #include "radio_modem_utils.h" @@ -23,6 +22,7 @@ #define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk()) void RadioModemTest::SetUp() { + RadioServiceTest::SetUp(); std::string serviceName = GetParam(); if (!isServiceValidForDeviceConfiguration(serviceName)) { @@ -37,8 +37,6 @@ void RadioModemTest::SetUp() { radioRsp_modem = ndk::SharedRefBase::make(*this); ASSERT_NE(nullptr, radioRsp_modem.get()); - count_ = 0; - radioInd_modem = ndk::SharedRefBase::make(*this); ASSERT_NE(nullptr, radioInd_modem.get()); @@ -154,7 +152,6 @@ TEST_P(RadioModemTest, getModemStackStatus) { * Test IRadioModem.getBasebandVersion() for the response returned. */ TEST_P(RadioModemTest, getBasebandVersion) { - LOG(DEBUG) << "getBasebandVersion"; serial = GetRandomSerialNumber(); radio_modem->getBasebandVersion(serial); @@ -165,14 +162,12 @@ TEST_P(RadioModemTest, getBasebandVersion) { if (cardStatus.cardState == CardStatus::STATE_ABSENT) { EXPECT_EQ(RadioError::NONE, radioRsp_modem->rspInfo.error); } - LOG(DEBUG) << "getBasebandVersion finished"; } /* * Test IRadioModem.getDeviceIdentity() for the response returned. */ TEST_P(RadioModemTest, getDeviceIdentity) { - LOG(DEBUG) << "getDeviceIdentity"; serial = GetRandomSerialNumber(); radio_modem->getDeviceIdentity(serial); @@ -184,7 +179,6 @@ TEST_P(RadioModemTest, getDeviceIdentity) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE, RadioError::EMPTY_RECORD})); } - LOG(DEBUG) << "getDeviceIdentity finished"; } /* @@ -198,7 +192,6 @@ TEST_P(RadioModemTest, getImei) { ALOGI("Skipped the test since getImei is not supported on version < 2"); GTEST_SKIP(); } - LOG(DEBUG) << "getImei"; serial = GetRandomSerialNumber(); radio_modem->getImei(serial); @@ -210,14 +203,12 @@ TEST_P(RadioModemTest, getImei) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE, RadioError::EMPTY_RECORD})); } - LOG(DEBUG) << "getImei finished"; } /* * Test IRadioModem.nvReadItem() for the response returned. */ TEST_P(RadioModemTest, nvReadItem) { - LOG(DEBUG) << "nvReadItem"; serial = GetRandomSerialNumber(); radio_modem->nvReadItem(serial, NvItem::LTE_BAND_ENABLE_25); @@ -229,14 +220,12 @@ TEST_P(RadioModemTest, nvReadItem) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "nvReadItem finished"; } /* * Test IRadioModem.nvWriteItem() for the response returned. */ TEST_P(RadioModemTest, nvWriteItem) { - LOG(DEBUG) << "nvWriteItem"; serial = GetRandomSerialNumber(); NvWriteItem item; memset(&item, 0, sizeof(item)); @@ -251,14 +240,12 @@ TEST_P(RadioModemTest, nvWriteItem) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "nvWriteItem finished"; } /* * Test IRadioModem.nvWriteCdmaPrl() for the response returned. */ TEST_P(RadioModemTest, nvWriteCdmaPrl) { - LOG(DEBUG) << "nvWriteCdmaPrl"; serial = GetRandomSerialNumber(); std::vector prl = {1, 2, 3, 4, 5}; @@ -271,14 +258,12 @@ TEST_P(RadioModemTest, nvWriteCdmaPrl) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "nvWriteCdmaPrl finished"; } /* * Test IRadioModem.nvResetConfig() for the response returned. */ TEST_P(RadioModemTest, nvResetConfig) { - LOG(DEBUG) << "nvResetConfig"; serial = GetRandomSerialNumber(); radio_modem->nvResetConfig(serial, ResetNvType::FACTORY_RESET); @@ -292,14 +277,12 @@ TEST_P(RadioModemTest, nvResetConfig) { } // wait until modem reset finishes sleep(10); - LOG(DEBUG) << "nvResetConfig finished"; } /* * Test IRadioModem.getHardwareConfig() for the response returned. */ TEST_P(RadioModemTest, getHardwareConfig) { - LOG(DEBUG) << "getHardwareConfig"; serial = GetRandomSerialNumber(); radio_modem->getHardwareConfig(serial); @@ -311,7 +294,6 @@ TEST_P(RadioModemTest, getHardwareConfig) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "getHardwareConfig finished"; } /* @@ -337,7 +319,6 @@ TEST_P(RadioModemTest, DISABLED_requestShutdown) { * Test IRadioModem.getRadioCapability() for the response returned. */ TEST_P(RadioModemTest, getRadioCapability) { - LOG(DEBUG) << "getRadioCapability"; serial = GetRandomSerialNumber(); radio_modem->getRadioCapability(serial); @@ -348,14 +329,12 @@ TEST_P(RadioModemTest, getRadioCapability) { if (cardStatus.cardState == CardStatus::STATE_ABSENT) { EXPECT_EQ(RadioError::NONE, radioRsp_modem->rspInfo.error); } - LOG(DEBUG) << "getRadioCapability finished"; } /* * Test IRadioModem.setRadioCapability() for the response returned. */ TEST_P(RadioModemTest, setRadioCapability) { - LOG(DEBUG) << "setRadioCapability"; serial = GetRandomSerialNumber(); RadioCapability rc; memset(&rc, 0, sizeof(rc)); @@ -371,14 +350,12 @@ TEST_P(RadioModemTest, setRadioCapability) { {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "setRadioCapability finished"; } /* * Test IRadioModem.getModemActivityInfo() for the response returned. */ TEST_P(RadioModemTest, getModemActivityInfo) { - LOG(DEBUG) << "getModemActivityInfo"; serial = GetRandomSerialNumber(); radio_modem->getModemActivityInfo(serial); @@ -390,14 +367,12 @@ TEST_P(RadioModemTest, getModemActivityInfo) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); } - LOG(DEBUG) << "getModemActivityInfo finished"; } /* * Test IRadioModem.sendDeviceState() for the response returned. */ TEST_P(RadioModemTest, sendDeviceState) { - LOG(DEBUG) << "sendDeviceState"; serial = GetRandomSerialNumber(); radio_modem->sendDeviceState(serial, DeviceStateType::POWER_SAVE_MODE, true); @@ -411,5 +386,4 @@ TEST_P(RadioModemTest, sendDeviceState) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_modem->rspInfo.error, {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); } - LOG(DEBUG) << "sendDeviceState finished"; } diff --git a/radio/aidl/vts/radio_modem_utils.h b/radio/aidl/vts/radio_modem_utils.h index d2f5a104bc..d47bdeb921 100644 --- a/radio/aidl/vts/radio_modem_utils.h +++ b/radio/aidl/vts/radio_modem_utils.h @@ -112,9 +112,9 @@ class RadioModemIndication : public BnRadioModemIndication { }; // The main test class for Radio AIDL Modem. -class RadioModemTest : public ::testing::TestWithParam, public RadioServiceTest { +class RadioModemTest : public RadioServiceTest { public: - virtual void SetUp() override; + void SetUp() override; /* radio modem service handle */ std::shared_ptr radio_modem; diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp index 0344dd6acc..e5da05032f 100644 --- a/radio/aidl/vts/radio_network_test.cpp +++ b/radio/aidl/vts/radio_network_test.cpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include "radio_network_utils.h" @@ -25,6 +24,7 @@ #define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk()) void RadioNetworkTest::SetUp() { + RadioServiceTest::SetUp(); std::string serviceName = GetParam(); if (!isServiceValidForDeviceConfiguration(serviceName)) { @@ -39,8 +39,6 @@ void RadioNetworkTest::SetUp() { radioRsp_network = ndk::SharedRefBase::make(*this); ASSERT_NE(nullptr, radioRsp_network.get()); - count_ = 0; - radioInd_network = ndk::SharedRefBase::make(*this); ASSERT_NE(nullptr, radioInd_network.get()); @@ -1665,7 +1663,6 @@ TEST_P(RadioNetworkTest, getImsRegistrationState) { * Test IRadioNetwork.getOperator() for the response returned. */ TEST_P(RadioNetworkTest, getOperator) { - LOG(DEBUG) << "getOperator"; serial = GetRandomSerialNumber(); radio_network->getOperator(serial); @@ -1676,14 +1673,12 @@ TEST_P(RadioNetworkTest, getOperator) { if (cardStatus.cardState == CardStatus::STATE_ABSENT) { EXPECT_EQ(RadioError::NONE, radioRsp_network->rspInfo.error); } - LOG(DEBUG) << "getOperator finished"; } /* * Test IRadioNetwork.getNetworkSelectionMode() for the response returned. */ TEST_P(RadioNetworkTest, getNetworkSelectionMode) { - LOG(DEBUG) << "getNetworkSelectionMode"; serial = GetRandomSerialNumber(); radio_network->getNetworkSelectionMode(serial); @@ -1694,14 +1689,12 @@ TEST_P(RadioNetworkTest, getNetworkSelectionMode) { if (cardStatus.cardState == CardStatus::STATE_ABSENT) { EXPECT_EQ(RadioError::NONE, radioRsp_network->rspInfo.error); } - LOG(DEBUG) << "getNetworkSelectionMode finished"; } /* * Test IRadioNetwork.setNetworkSelectionModeAutomatic() for the response returned. */ TEST_P(RadioNetworkTest, setNetworkSelectionModeAutomatic) { - LOG(DEBUG) << "setNetworkSelectionModeAutomatic"; serial = GetRandomSerialNumber(); radio_network->setNetworkSelectionModeAutomatic(serial); @@ -1715,14 +1708,12 @@ TEST_P(RadioNetworkTest, setNetworkSelectionModeAutomatic) { RadioError::OPERATION_NOT_ALLOWED}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "setNetworkSelectionModeAutomatic finished"; } /* * Test IRadioNetwork.getAvailableNetworks() for the response returned. */ TEST_P(RadioNetworkTest, getAvailableNetworks) { - LOG(DEBUG) << "getAvailableNetworks"; serial = GetRandomSerialNumber(); radio_network->getAvailableNetworks(serial); @@ -1738,14 +1729,12 @@ TEST_P(RadioNetworkTest, getAvailableNetworks) { RadioError::MODEM_ERR, RadioError::OPERATION_NOT_ALLOWED}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "getAvailableNetworks finished"; } /* * Test IRadioNetwork.setBandMode() for the response returned. */ TEST_P(RadioNetworkTest, setBandMode) { - LOG(DEBUG) << "setBandMode"; serial = GetRandomSerialNumber(); radio_network->setBandMode(serial, RadioBandMode::BAND_MODE_USA); @@ -1757,14 +1746,12 @@ TEST_P(RadioNetworkTest, setBandMode) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::NONE}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "setBandMode finished"; } /* * Test IRadioNetwork.setLocationUpdates() for the response returned. */ TEST_P(RadioNetworkTest, setLocationUpdates) { - LOG(DEBUG) << "setLocationUpdates"; serial = GetRandomSerialNumber(); radio_network->setLocationUpdates(serial, true); @@ -1776,14 +1763,12 @@ TEST_P(RadioNetworkTest, setLocationUpdates) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::NONE, RadioError::SIM_ABSENT})); } - LOG(DEBUG) << "setLocationUpdates finished"; } /* * Test IRadioNetwork.setCdmaRoamingPreference() for the response returned. */ TEST_P(RadioNetworkTest, setCdmaRoamingPreference) { - LOG(DEBUG) << "setCdmaRoamingPreference"; serial = GetRandomSerialNumber(); radio_network->setCdmaRoamingPreference(serial, CdmaRoamingType::HOME_NETWORK); @@ -1796,14 +1781,12 @@ TEST_P(RadioNetworkTest, setCdmaRoamingPreference) { radioRsp_network->rspInfo.error, {RadioError::NONE, RadioError::SIM_ABSENT, RadioError::REQUEST_NOT_SUPPORTED})); } - LOG(DEBUG) << "setCdmaRoamingPreference finished"; } /* * Test IRadioNetwork.getCdmaRoamingPreference() for the response returned. */ TEST_P(RadioNetworkTest, getCdmaRoamingPreference) { - LOG(DEBUG) << "getCdmaRoamingPreference"; serial = GetRandomSerialNumber(); radio_network->getCdmaRoamingPreference(serial); @@ -1817,14 +1800,12 @@ TEST_P(RadioNetworkTest, getCdmaRoamingPreference) { {RadioError::NONE, RadioError::SIM_ABSENT, RadioError::MODEM_ERR}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "getCdmaRoamingPreference finished"; } /* * Test IRadioNetwork.getVoiceRadioTechnology() for the response returned. */ TEST_P(RadioNetworkTest, getVoiceRadioTechnology) { - LOG(DEBUG) << "getVoiceRadioTechnology"; serial = GetRandomSerialNumber(); radio_network->getVoiceRadioTechnology(serial); @@ -1835,14 +1816,12 @@ TEST_P(RadioNetworkTest, getVoiceRadioTechnology) { if (cardStatus.cardState == CardStatus::STATE_ABSENT) { EXPECT_EQ(RadioError::NONE, radioRsp_network->rspInfo.error); } - LOG(DEBUG) << "getVoiceRadioTechnology finished"; } /* * Test IRadioNetwork.setCellInfoListRate() for the response returned. */ TEST_P(RadioNetworkTest, setCellInfoListRate) { - LOG(DEBUG) << "setCellInfoListRate"; serial = GetRandomSerialNumber(); radio_network->setCellInfoListRate(serial, 10); @@ -1854,14 +1833,12 @@ TEST_P(RadioNetworkTest, setCellInfoListRate) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); } - LOG(DEBUG) << "setCellInfoListRate finished"; } /* * Test IRadioNetwork.supplyNetworkDepersonalization() for the response returned. */ TEST_P(RadioNetworkTest, supplyNetworkDepersonalization) { - LOG(DEBUG) << "supplyNetworkDepersonalization"; serial = GetRandomSerialNumber(); radio_network->supplyNetworkDepersonalization(serial, std::string("test")); @@ -1876,7 +1853,6 @@ TEST_P(RadioNetworkTest, supplyNetworkDepersonalization) { RadioError::INVALID_SIM_STATE, RadioError::MODEM_ERR, RadioError::NO_MEMORY, RadioError::PASSWORD_INCORRECT, RadioError::SIM_ABSENT, RadioError::SYSTEM_ERR})); } - LOG(DEBUG) << "supplyNetworkDepersonalization finished"; } /* @@ -1891,7 +1867,6 @@ TEST_P(RadioNetworkTest, setEmergencyMode) { GTEST_SKIP(); } - LOG(DEBUG) << "setEmergencyMode"; serial = GetRandomSerialNumber(); radio_network->setEmergencyMode(serial, EmergencyMode::EMERGENCY_WWAN); @@ -1907,8 +1882,6 @@ TEST_P(RadioNetworkTest, setEmergencyMode) { // exit emergency mode for other tests serial = GetRandomSerialNumber(); radio_network->exitEmergencyMode(serial); - - LOG(DEBUG) << "setEmergencyMode finished"; } /* @@ -1924,7 +1897,6 @@ TEST_P(RadioNetworkTest, triggerEmergencyNetworkScan) { GTEST_SKIP(); } - LOG(DEBUG) << "triggerEmergencyNetworkScan"; serial = GetRandomSerialNumber(); EmergencyNetworkScanTrigger scanRequest; @@ -1940,7 +1912,6 @@ TEST_P(RadioNetworkTest, triggerEmergencyNetworkScan) { radioRsp_network->rspInfo.error, {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR, RadioError::INVALID_ARGUMENTS})); - LOG(DEBUG) << "triggerEmergencyNetworkScan finished"; } /* @@ -1955,7 +1926,6 @@ TEST_P(RadioNetworkTest, cancelEmergencyNetworkScan) { GTEST_SKIP(); } - LOG(DEBUG) << "cancelEmergencyNetworkScan"; serial = GetRandomSerialNumber(); radio_network->cancelEmergencyNetworkScan(serial, true); @@ -1963,11 +1933,9 @@ TEST_P(RadioNetworkTest, cancelEmergencyNetworkScan) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); - ASSERT_TRUE(CheckAnyOfErrors( - radioRsp_network->rspInfo.error, - {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::RADIO_NOT_AVAILABLE, - RadioError::MODEM_ERR})); - LOG(DEBUG) << "cancelEmergencyNetworkScan finished"; + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, + RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); } /* @@ -1982,7 +1950,6 @@ TEST_P(RadioNetworkTest, exitEmergencyMode) { GTEST_SKIP(); } - LOG(DEBUG) << "exitEmergencyMode"; serial = GetRandomSerialNumber(); radio_network->exitEmergencyMode(serial); @@ -1990,11 +1957,9 @@ TEST_P(RadioNetworkTest, exitEmergencyMode) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type); EXPECT_EQ(serial, radioRsp_network->rspInfo.serial); - ASSERT_TRUE(CheckAnyOfErrors( - radioRsp_network->rspInfo.error, - {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::RADIO_NOT_AVAILABLE, - RadioError::MODEM_ERR})); - LOG(DEBUG) << "exitEmergencyMode finished"; + ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, + {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, + RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); } /* @@ -2073,7 +2038,6 @@ TEST_P(RadioNetworkTest, setNullCipherAndIntegrityEnabled) { GTEST_SKIP(); } - LOG(DEBUG) << "setNullCipherAndIntegrityEnabled"; serial = GetRandomSerialNumber(); radio_network->setNullCipherAndIntegrityEnabled(serial, false); @@ -2084,7 +2048,6 @@ TEST_P(RadioNetworkTest, setNullCipherAndIntegrityEnabled) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR})); - LOG(DEBUG) << "setNullCipherAndIntegrityEnabled finished"; } /** @@ -2100,7 +2063,6 @@ TEST_P(RadioNetworkTest, isNullCipherAndIntegrityEnabled) { GTEST_SKIP(); } - LOG(DEBUG) << "isNullCipherAndIntegrityEnabled"; serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = radio_network->isNullCipherAndIntegrityEnabled(serial); @@ -2113,5 +2075,4 @@ TEST_P(RadioNetworkTest, isNullCipherAndIntegrityEnabled) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::MODEM_ERR, RadioError::REQUEST_NOT_SUPPORTED})); - LOG(DEBUG) << "isNullCipherAndIntegrityEnabled finished"; } diff --git a/radio/aidl/vts/radio_network_utils.h b/radio/aidl/vts/radio_network_utils.h index 601f04435b..8f8f6b070f 100644 --- a/radio/aidl/vts/radio_network_utils.h +++ b/radio/aidl/vts/radio_network_utils.h @@ -229,9 +229,9 @@ class RadioNetworkIndication : public BnRadioNetworkIndication { }; // The main test class for Radio AIDL Network. -class RadioNetworkTest : public ::testing::TestWithParam, public RadioServiceTest { +class RadioNetworkTest : public RadioServiceTest { public: - virtual void SetUp() override; + void SetUp() override; /* radio network service handle */ std::shared_ptr radio_network; diff --git a/radio/aidl/vts/radio_sap_test.cpp b/radio/aidl/vts/radio_sap_test.cpp index c94379c934..9a1c145576 100644 --- a/radio/aidl/vts/radio_sap_test.cpp +++ b/radio/aidl/vts/radio_sap_test.cpp @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include + #include #include "radio_sap_utils.h" @@ -22,9 +22,13 @@ #define TIMEOUT_PERIOD 40 void SapTest::SetUp() { + ALOGD("BEGIN %s#%s", ::testing::UnitTest::GetInstance()->current_test_info()->test_suite_name(), + ::testing::UnitTest::GetInstance()->current_test_info()->name()); + count = 0; + serial = -1; std::string serviceName = GetParam(); if (!isServiceValidForDeviceConfiguration(serviceName)) { - LOG(DEBUG) << "Skipped the test due to device configuration."; + ALOGI("Skipped the test due to device configuration."); GTEST_SKIP(); } sap = ISap::fromBinder(ndk::SpAIBinder(AServiceManager_waitForService(serviceName.c_str()))); @@ -33,13 +37,16 @@ void SapTest::SetUp() { sapCb = ndk::SharedRefBase::make(*this); ASSERT_NE(sapCb.get(), nullptr); - count = 0; - ndk::ScopedAStatus res = sap->setCallback(sapCb); ASSERT_OK(res) << res; } -void SapTest::TearDown() {} +void SapTest::TearDown() { + count_ = 0; + serial = -1; + ALOGD("END %s#%s", ::testing::UnitTest::GetInstance()->current_test_info()->test_suite_name(), + ::testing::UnitTest::GetInstance()->current_test_info()->name()); +} ::testing::AssertionResult SapTest::CheckAnyOfErrors(SapResultCode err, std::vector errors) { @@ -52,9 +59,9 @@ void SapTest::TearDown() {} } void SapTest::notify(int receivedSerial) { - std::unique_lock lock(mtx); - count++; + std::lock_guard lock(mtx); if (serial == receivedSerial) { + count++; cv.notify_one(); } } @@ -78,7 +85,6 @@ std::cv_status SapTest::wait() { * Test ISap.connectReq() for the response returned. */ TEST_P(SapTest, connectReq) { - LOG(DEBUG) << "connectReq"; serial = GetRandomSerialNumber(); int32_t maxMsgSize = 100; @@ -97,7 +103,6 @@ TEST_P(SapTest, connectReq) { * Test ISap.disconnectReq() for the response returned */ TEST_P(SapTest, disconnectReq) { - LOG(DEBUG) << "disconnectReq"; serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = sap->disconnectReq(serial); @@ -105,14 +110,12 @@ TEST_P(SapTest, disconnectReq) { EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(sapCb->sapResponseSerial, serial); - LOG(DEBUG) << "disconnectReq finished"; } /* * Test ISap.apduReq() for the response returned. */ TEST_P(SapTest, apduReq) { - LOG(DEBUG) << "apduReq"; serial = GetRandomSerialNumber(); SapApduType sapApduType = SapApduType::APDU; std::vector command = {}; @@ -128,14 +131,12 @@ TEST_P(SapTest, apduReq) { {SapResultCode::GENERIC_FAILURE, SapResultCode::CARD_ALREADY_POWERED_OFF, SapResultCode::CARD_NOT_ACCESSSIBLE, SapResultCode::CARD_REMOVED, SapResultCode::SUCCESS})); - LOG(DEBUG) << "apduReq finished"; } /* * Test ISap.transferAtrReq() for the response returned. */ TEST_P(SapTest, transferAtrReq) { - LOG(DEBUG) << "transferAtrReq"; serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = sap->transferAtrReq(serial); @@ -148,14 +149,12 @@ TEST_P(SapTest, transferAtrReq) { {SapResultCode::GENERIC_FAILURE, SapResultCode::DATA_NOT_AVAILABLE, SapResultCode::CARD_ALREADY_POWERED_OFF, SapResultCode::CARD_REMOVED, SapResultCode::SUCCESS})); - LOG(DEBUG) << "transferAtrReq finished"; } /* * Test ISap.powerReq() for the response returned. */ TEST_P(SapTest, powerReq) { - LOG(DEBUG) << "powerReq"; serial = GetRandomSerialNumber(); bool state = true; @@ -170,14 +169,12 @@ TEST_P(SapTest, powerReq) { {SapResultCode::GENERIC_FAILURE, SapResultCode::CARD_NOT_ACCESSSIBLE, SapResultCode::CARD_ALREADY_POWERED_OFF, SapResultCode::CARD_REMOVED, SapResultCode::CARD_ALREADY_POWERED_ON, SapResultCode::SUCCESS})); - LOG(DEBUG) << "powerReq finished"; } /* * Test ISap.resetSimReq() for the response returned. */ TEST_P(SapTest, resetSimReq) { - LOG(DEBUG) << "resetSimReq"; serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = sap->resetSimReq(serial); @@ -191,14 +188,12 @@ TEST_P(SapTest, resetSimReq) { {SapResultCode::GENERIC_FAILURE, SapResultCode::CARD_NOT_ACCESSSIBLE, SapResultCode::CARD_ALREADY_POWERED_OFF, SapResultCode::CARD_REMOVED, SapResultCode::SUCCESS})); - LOG(DEBUG) << "resetSimReq finished"; } /* * Test ISap.transferCardReaderStatusReq() for the response returned. */ TEST_P(SapTest, transferCardReaderStatusReq) { - LOG(DEBUG) << "transferCardReaderStatusReq"; serial = GetRandomSerialNumber(); ndk::ScopedAStatus res = sap->transferCardReaderStatusReq(serial); @@ -210,14 +205,12 @@ TEST_P(SapTest, transferCardReaderStatusReq) { ASSERT_TRUE(CheckAnyOfErrors(sapCb->sapResultCode, {SapResultCode::GENERIC_FAILURE, SapResultCode::DATA_NOT_AVAILABLE, SapResultCode::SUCCESS})); - LOG(DEBUG) << "transferCardReaderStatusReq finished"; } /* * Test ISap.setTransferProtocolReq() for the response returned. */ TEST_P(SapTest, setTransferProtocolReq) { - LOG(DEBUG) << "setTransferProtocolReq"; serial = GetRandomSerialNumber(); SapTransferProtocol sapTransferProtocol = SapTransferProtocol::T0; @@ -229,5 +222,4 @@ TEST_P(SapTest, setTransferProtocolReq) { ASSERT_TRUE(CheckAnyOfErrors(sapCb->sapResultCode, {SapResultCode::NOT_SUPPORTED, SapResultCode::SUCCESS})); - LOG(DEBUG) << "setTransferProtocolReq finished"; } diff --git a/radio/aidl/vts/radio_sim_test.cpp b/radio/aidl/vts/radio_sim_test.cpp index f65714229c..d90658893b 100644 --- a/radio/aidl/vts/radio_sim_test.cpp +++ b/radio/aidl/vts/radio_sim_test.cpp @@ -16,7 +16,6 @@ #include #include -#include #include #include "radio_sim_utils.h" @@ -24,6 +23,7 @@ #define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk()) void RadioSimTest::SetUp() { + RadioServiceTest::SetUp(); std::string serviceName = GetParam(); if (!isServiceValidForDeviceConfiguration(serviceName)) { @@ -38,8 +38,6 @@ void RadioSimTest::SetUp() { radioRsp_sim = ndk::SharedRefBase::make(*this); ASSERT_NE(nullptr, radioRsp_sim.get()); - count_ = 0; - radioInd_sim = ndk::SharedRefBase::make(*this); ASSERT_NE(nullptr, radioInd_sim.get()); @@ -481,19 +479,16 @@ TEST_P(RadioSimTest, setAllowedCarriers) { * Test IRadioSim.getIccCardStatus() for the response returned. */ TEST_P(RadioSimTest, getIccCardStatus) { - LOG(DEBUG) << "getIccCardStatus"; EXPECT_LE(cardStatus.applications.size(), RadioConst::CARD_MAX_APPS); EXPECT_LT(cardStatus.gsmUmtsSubscriptionAppIndex, RadioConst::CARD_MAX_APPS); EXPECT_LT(cardStatus.cdmaSubscriptionAppIndex, RadioConst::CARD_MAX_APPS); EXPECT_LT(cardStatus.imsSubscriptionAppIndex, RadioConst::CARD_MAX_APPS); - LOG(DEBUG) << "getIccCardStatus finished"; } /* * Test IRadioSim.supplyIccPinForApp() for the response returned */ TEST_P(RadioSimTest, supplyIccPinForApp) { - LOG(DEBUG) << "supplyIccPinForApp"; serial = GetRandomSerialNumber(); // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and @@ -513,14 +508,12 @@ TEST_P(RadioSimTest, supplyIccPinForApp) { {RadioError::PASSWORD_INCORRECT, RadioError::REQUEST_NOT_SUPPORTED})); } } - LOG(DEBUG) << "supplyIccPinForApp finished"; } /* * Test IRadioSim.supplyIccPukForApp() for the response returned. */ TEST_P(RadioSimTest, supplyIccPukForApp) { - LOG(DEBUG) << "supplyIccPukForApp"; serial = GetRandomSerialNumber(); // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and @@ -540,14 +533,12 @@ TEST_P(RadioSimTest, supplyIccPukForApp) { {RadioError::PASSWORD_INCORRECT, RadioError::INVALID_SIM_STATE})); } } - LOG(DEBUG) << "supplyIccPukForApp finished"; } /* * Test IRadioSim.supplyIccPin2ForApp() for the response returned. */ TEST_P(RadioSimTest, supplyIccPin2ForApp) { - LOG(DEBUG) << "supplyIccPin2ForApp"; serial = GetRandomSerialNumber(); // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and @@ -568,14 +559,12 @@ TEST_P(RadioSimTest, supplyIccPin2ForApp) { RadioError::REQUEST_NOT_SUPPORTED, RadioError::SIM_PUK2})); } } - LOG(DEBUG) << "supplyIccPin2ForApp finished"; } /* * Test IRadioSim.supplyIccPuk2ForApp() for the response returned. */ TEST_P(RadioSimTest, supplyIccPuk2ForApp) { - LOG(DEBUG) << "supplyIccPuk2ForApp"; serial = GetRandomSerialNumber(); // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and @@ -595,14 +584,12 @@ TEST_P(RadioSimTest, supplyIccPuk2ForApp) { {RadioError::PASSWORD_INCORRECT, RadioError::INVALID_SIM_STATE})); } } - LOG(DEBUG) << "supplyIccPuk2ForApp finished"; } /* * Test IRadioSim.changeIccPinForApp() for the response returned. */ TEST_P(RadioSimTest, changeIccPinForApp) { - LOG(DEBUG) << "changeIccPinForApp"; serial = GetRandomSerialNumber(); // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and @@ -622,14 +609,12 @@ TEST_P(RadioSimTest, changeIccPinForApp) { {RadioError::PASSWORD_INCORRECT, RadioError::REQUEST_NOT_SUPPORTED})); } } - LOG(DEBUG) << "changeIccPinForApp finished"; } /* * Test IRadioSim.changeIccPin2ForApp() for the response returned. */ TEST_P(RadioSimTest, changeIccPin2ForApp) { - LOG(DEBUG) << "changeIccPin2ForApp"; serial = GetRandomSerialNumber(); // Pass wrong password and check PASSWORD_INCORRECT returned for 3GPP and @@ -650,14 +635,12 @@ TEST_P(RadioSimTest, changeIccPin2ForApp) { RadioError::REQUEST_NOT_SUPPORTED, RadioError::SIM_PUK2})); } } - LOG(DEBUG) << "changeIccPin2ForApp finished"; } /* * Test IRadioSim.getImsiForApp() for the response returned. */ TEST_P(RadioSimTest, getImsiForApp) { - LOG(DEBUG) << "getImsiForApp"; serial = GetRandomSerialNumber(); // Check success returned while getting imsi for 3GPP and 3GPP2 apps only @@ -681,14 +664,12 @@ TEST_P(RadioSimTest, getImsiForApp) { } } } - LOG(DEBUG) << "getImsiForApp finished"; } /* * Test IRadioSim.iccIoForApp() for the response returned. */ TEST_P(RadioSimTest, iccIoForApp) { - LOG(DEBUG) << "iccIoForApp"; serial = GetRandomSerialNumber(); for (int i = 0; i < (int)cardStatus.applications.size(); i++) { @@ -708,14 +689,12 @@ TEST_P(RadioSimTest, iccIoForApp) { EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type); EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial); } - LOG(DEBUG) << "iccIoForApp finished"; } /* * Test IRadioSim.iccTransmitApduBasicChannel() for the response returned. */ TEST_P(RadioSimTest, iccTransmitApduBasicChannel) { - LOG(DEBUG) << "iccTransmitApduBasicChannel"; serial = GetRandomSerialNumber(); SimApdu msg; memset(&msg, 0, sizeof(msg)); @@ -725,14 +704,12 @@ TEST_P(RadioSimTest, iccTransmitApduBasicChannel) { EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type); EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial); - LOG(DEBUG) << "iccTransmitApduBasicChannel finished"; } /* * Test IRadioSim.iccOpenLogicalChannel() for the response returned. */ TEST_P(RadioSimTest, iccOpenLogicalChannel) { - LOG(DEBUG) << "iccOpenLogicalChannel"; serial = GetRandomSerialNumber(); int p2 = 0x04; // Specified in ISO 7816-4 clause 7.1.1 0x04 means that FCP template is requested. @@ -742,14 +719,12 @@ TEST_P(RadioSimTest, iccOpenLogicalChannel) { EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type); } - LOG(DEBUG) << "iccOpenLogicalChannel finished"; } /* * Test IRadioSim.iccCloseLogicalChannel() for the response returned. */ TEST_P(RadioSimTest, iccCloseLogicalChannel) { - LOG(DEBUG) << "iccCloseLogicalChannel"; serial = GetRandomSerialNumber(); // Try closing invalid channel and check INVALID_ARGUMENTS returned as error radio_sim->iccCloseLogicalChannel(serial, 0); @@ -758,7 +733,6 @@ TEST_P(RadioSimTest, iccCloseLogicalChannel) { EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial); EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp_sim->rspInfo.error); - LOG(DEBUG) << "iccCloseLogicalChannel finished"; } /* @@ -773,7 +747,6 @@ TEST_P(RadioSimTest, iccCloseLogicalChannelWithSessionInfo) { " iccCloseLogicalChannelWithSessionInfo is not supported on version < 2"); GTEST_SKIP(); } - LOG(DEBUG) << "iccCloseLogicalChannelWithSessionInfo"; serial = GetRandomSerialNumber(); SessionInfo info; memset(&info, 0, sizeof(info)); @@ -787,14 +760,12 @@ TEST_P(RadioSimTest, iccCloseLogicalChannelWithSessionInfo) { EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial); EXPECT_EQ(RadioError::INVALID_ARGUMENTS, radioRsp_sim->rspInfo.error); - LOG(DEBUG) << "iccCloseLogicalChannelWithSessionInfo finished"; } /* * Test IRadioSim.iccTransmitApduLogicalChannel() for the response returned. */ TEST_P(RadioSimTest, iccTransmitApduLogicalChannel) { - LOG(DEBUG) << "iccTransmitApduLogicalChannel"; serial = GetRandomSerialNumber(); SimApdu msg; memset(&msg, 0, sizeof(msg)); @@ -804,14 +775,12 @@ TEST_P(RadioSimTest, iccTransmitApduLogicalChannel) { EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_sim->rspInfo.type); EXPECT_EQ(serial, radioRsp_sim->rspInfo.serial); - LOG(DEBUG) << "iccTransmitApduLogicalChannel finished"; } /* * Test IRadioSim.requestIccSimAuthentication() for the response returned. */ TEST_P(RadioSimTest, requestIccSimAuthentication) { - LOG(DEBUG) << "requestIccSimAuthentication"; serial = GetRandomSerialNumber(); // Pass wrong challenge string and check RadioError::INVALID_ARGUMENTS @@ -826,7 +795,6 @@ TEST_P(RadioSimTest, requestIccSimAuthentication) { radioRsp_sim->rspInfo.error, {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED})); } - LOG(DEBUG) << "requestIccSimAuthentication finished"; } /* @@ -880,7 +848,6 @@ TEST_P(RadioSimTest, setFacilityLockForApp) { * Test IRadioSim.getCdmaSubscription() for the response returned. */ TEST_P(RadioSimTest, getCdmaSubscription) { - LOG(DEBUG) << "getCdmaSubscription"; serial = GetRandomSerialNumber(); radio_sim->getCdmaSubscription(serial); @@ -893,14 +860,12 @@ TEST_P(RadioSimTest, getCdmaSubscription) { radioRsp_sim->rspInfo.error, {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::SIM_ABSENT})); } - LOG(DEBUG) << "getCdmaSubscription finished"; } /* * Test IRadioSim.getCdmaSubscriptionSource() for the response returned. */ TEST_P(RadioSimTest, getCdmaSubscriptionSource) { - LOG(DEBUG) << "getCdmaSubscriptionSource"; serial = GetRandomSerialNumber(); radio_sim->getCdmaSubscriptionSource(serial); @@ -913,14 +878,12 @@ TEST_P(RadioSimTest, getCdmaSubscriptionSource) { radioRsp_sim->rspInfo.error, {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::SIM_ABSENT})); } - LOG(DEBUG) << "getCdmaSubscriptionSource finished"; } /* * Test IRadioSim.setCdmaSubscriptionSource() for the response returned. */ TEST_P(RadioSimTest, setCdmaSubscriptionSource) { - LOG(DEBUG) << "setCdmaSubscriptionSource"; serial = GetRandomSerialNumber(); radio_sim->setCdmaSubscriptionSource(serial, CdmaSubscriptionSource::RUIM_SIM); @@ -934,14 +897,12 @@ TEST_P(RadioSimTest, setCdmaSubscriptionSource) { {RadioError::NONE, RadioError::SIM_ABSENT, RadioError::SUBSCRIPTION_NOT_AVAILABLE}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "setCdmaSubscriptionSource finished"; } /* * Test IRadioSim.setUiccSubscription() for the response returned. */ TEST_P(RadioSimTest, setUiccSubscription) { - LOG(DEBUG) << "setUiccSubscription"; serial = GetRandomSerialNumber(); SelectUiccSub item; memset(&item, 0, sizeof(item)); @@ -958,14 +919,12 @@ TEST_P(RadioSimTest, setUiccSubscription) { RadioError::MODEM_ERR, RadioError::SUBSCRIPTION_NOT_SUPPORTED}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "setUiccSubscription finished"; } /* * Test IRadioSim.sendEnvelope() for the response returned. */ TEST_P(RadioSimTest, sendEnvelope) { - LOG(DEBUG) << "sendEnvelope"; serial = GetRandomSerialNumber(); // Test with sending empty string @@ -983,14 +942,12 @@ TEST_P(RadioSimTest, sendEnvelope) { RadioError::MODEM_ERR, RadioError::SIM_ABSENT}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "sendEnvelope finished"; } /* * Test IRadioSim.sendTerminalResponseToSim() for the response returned. */ TEST_P(RadioSimTest, sendTerminalResponseToSim) { - LOG(DEBUG) << "sendTerminalResponseToSim"; serial = GetRandomSerialNumber(); // Test with sending empty string @@ -1008,14 +965,12 @@ TEST_P(RadioSimTest, sendTerminalResponseToSim) { {RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::SIM_ABSENT}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "sendTerminalResponseToSim finished"; } /* * Test IRadioSim.reportStkServiceIsRunning() for the response returned. */ TEST_P(RadioSimTest, reportStkServiceIsRunning) { - LOG(DEBUG) << "reportStkServiceIsRunning"; serial = GetRandomSerialNumber(); radio_sim->reportStkServiceIsRunning(serial); @@ -1028,7 +983,6 @@ TEST_P(RadioSimTest, reportStkServiceIsRunning) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_sim->rspInfo.error, {RadioError::NONE}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "reportStkServiceIsRunning finished"; } /* @@ -1036,7 +990,6 @@ TEST_P(RadioSimTest, reportStkServiceIsRunning) { * string. */ TEST_P(RadioSimTest, sendEnvelopeWithStatus) { - LOG(DEBUG) << "sendEnvelopeWithStatus"; serial = GetRandomSerialNumber(); // Test with sending empty string @@ -1054,5 +1007,4 @@ TEST_P(RadioSimTest, sendEnvelopeWithStatus) { {RadioError::INVALID_ARGUMENTS, RadioError::MODEM_ERR, RadioError::SIM_ABSENT}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "sendEnvelopeWithStatus finished"; } diff --git a/radio/aidl/vts/radio_sim_utils.h b/radio/aidl/vts/radio_sim_utils.h index 71c7eb82c1..7cbcc58fd1 100644 --- a/radio/aidl/vts/radio_sim_utils.h +++ b/radio/aidl/vts/radio_sim_utils.h @@ -194,9 +194,9 @@ class RadioSimIndication : public BnRadioSimIndication { }; // The main test class for Radio AIDL SIM. -class RadioSimTest : public ::testing::TestWithParam, public RadioServiceTest { +class RadioSimTest : public RadioServiceTest { public: - virtual void SetUp() override; + void SetUp() override; /* Override updateSimCardStatus in RadioServiceTest to not call setResponseFunctions */ void updateSimCardStatus(); diff --git a/radio/aidl/vts/radio_voice_test.cpp b/radio/aidl/vts/radio_voice_test.cpp index 249ee63dee..397c417efa 100644 --- a/radio/aidl/vts/radio_voice_test.cpp +++ b/radio/aidl/vts/radio_voice_test.cpp @@ -16,7 +16,6 @@ #include #include -#include #include #include "radio_voice_utils.h" @@ -24,6 +23,7 @@ #define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk()) void RadioVoiceTest::SetUp() { + RadioServiceTest::SetUp(); std::string serviceName = GetParam(); if (!isServiceValidForDeviceConfiguration(serviceName)) { @@ -38,8 +38,6 @@ void RadioVoiceTest::SetUp() { radioRsp_voice = ndk::SharedRefBase::make(*this); ASSERT_NE(nullptr, radioRsp_voice.get()); - count_ = 0; - radioInd_voice = ndk::SharedRefBase::make(*this); ASSERT_NE(nullptr, radioInd_voice.get()); @@ -324,7 +322,6 @@ TEST_P(RadioVoiceTest, getClip) { * Test IRadioVoice.getTtyMode() for the response returned. */ TEST_P(RadioVoiceTest, getTtyMode) { - LOG(DEBUG) << "getTtyMode"; serial = GetRandomSerialNumber(); radio_voice->getTtyMode(serial); @@ -335,14 +332,12 @@ TEST_P(RadioVoiceTest, getTtyMode) { if (cardStatus.cardState == CardStatus::STATE_ABSENT) { EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error); } - LOG(DEBUG) << "getTtyMode finished"; } /* * Test IRadioVoice.setTtyMode() for the response returned. */ TEST_P(RadioVoiceTest, setTtyMode) { - LOG(DEBUG) << "setTtyMode"; serial = GetRandomSerialNumber(); radio_voice->setTtyMode(serial, TtyMode::OFF); @@ -353,14 +348,12 @@ TEST_P(RadioVoiceTest, setTtyMode) { if (cardStatus.cardState == CardStatus::STATE_ABSENT) { EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error); } - LOG(DEBUG) << "setTtyMode finished"; } /* * Test IRadioVoice.setPreferredVoicePrivacy() for the response returned. */ TEST_P(RadioVoiceTest, setPreferredVoicePrivacy) { - LOG(DEBUG) << "setPreferredVoicePrivacy"; serial = GetRandomSerialNumber(); radio_voice->setPreferredVoicePrivacy(serial, true); @@ -372,14 +365,12 @@ TEST_P(RadioVoiceTest, setPreferredVoicePrivacy) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); } - LOG(DEBUG) << "setPreferredVoicePrivacy finished"; } /* * Test IRadioVoice.getPreferredVoicePrivacy() for the response returned. */ TEST_P(RadioVoiceTest, getPreferredVoicePrivacy) { - LOG(DEBUG) << "getPreferredVoicePrivacy"; serial = GetRandomSerialNumber(); radio_voice->getPreferredVoicePrivacy(serial); @@ -391,14 +382,12 @@ TEST_P(RadioVoiceTest, getPreferredVoicePrivacy) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED})); } - LOG(DEBUG) << "getPreferredVoicePrivacy finished"; } /* * Test IRadioVoice.exitEmergencyCallbackMode() for the response returned. */ TEST_P(RadioVoiceTest, exitEmergencyCallbackMode) { - LOG(DEBUG) << "exitEmergencyCallbackMode"; serial = GetRandomSerialNumber(); radio_voice->exitEmergencyCallbackMode(serial); @@ -411,14 +400,12 @@ TEST_P(RadioVoiceTest, exitEmergencyCallbackMode) { radioRsp_voice->rspInfo.error, {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED, RadioError::SIM_ABSENT})); } - LOG(DEBUG) << "exitEmergencyCallbackMode finished"; } /* * Test IRadioVoice.handleStkCallSetupRequestFromSim() for the response returned. */ TEST_P(RadioVoiceTest, handleStkCallSetupRequestFromSim) { - LOG(DEBUG) << "handleStkCallSetupRequestFromSim"; serial = GetRandomSerialNumber(); bool accept = false; @@ -434,14 +421,12 @@ TEST_P(RadioVoiceTest, handleStkCallSetupRequestFromSim) { RadioError::MODEM_ERR, RadioError::SIM_ABSENT}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "handleStkCallSetupRequestFromSim finished"; } /* * Test IRadioVoice.dial() for the response returned. */ TEST_P(RadioVoiceTest, dial) { - LOG(DEBUG) << "dial"; serial = GetRandomSerialNumber(); Dial dialInfo; @@ -463,14 +448,12 @@ TEST_P(RadioVoiceTest, dial) { RadioError::OPERATION_NOT_ALLOWED}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "dial finished"; } /* * Test IRadioVoice.hangup() for the response returned. */ TEST_P(RadioVoiceTest, hangup) { - LOG(DEBUG) << "hangup"; serial = GetRandomSerialNumber(); radio_voice->hangup(serial, 1); @@ -484,14 +467,12 @@ TEST_P(RadioVoiceTest, hangup) { {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "hangup finished"; } /* * Test IRadioVoice.hangupWaitingOrBackground() for the response returned. */ TEST_P(RadioVoiceTest, hangupWaitingOrBackground) { - LOG(DEBUG) << "hangupWaitingOrBackground"; serial = GetRandomSerialNumber(); radio_voice->hangupWaitingOrBackground(serial); @@ -504,14 +485,12 @@ TEST_P(RadioVoiceTest, hangupWaitingOrBackground) { {RadioError::INVALID_STATE, RadioError::MODEM_ERR}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "hangupWaitingOrBackground finished"; } /* * Test IRadioVoice.hangupForegroundResumeBackground() for the response returned. */ TEST_P(RadioVoiceTest, hangupForegroundResumeBackground) { - LOG(DEBUG) << "hangupForegroundResumeBackground"; serial = GetRandomSerialNumber(); radio_voice->hangupForegroundResumeBackground(serial); @@ -524,14 +503,12 @@ TEST_P(RadioVoiceTest, hangupForegroundResumeBackground) { {RadioError::INVALID_STATE, RadioError::MODEM_ERR}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "hangupForegroundResumeBackground finished"; } /* * Test IRadioVoice.switchWaitingOrHoldingAndActive() for the response returned. */ TEST_P(RadioVoiceTest, switchWaitingOrHoldingAndActive) { - LOG(DEBUG) << "switchWaitingOrHoldingAndActive"; serial = GetRandomSerialNumber(); radio_voice->switchWaitingOrHoldingAndActive(serial); @@ -544,14 +521,12 @@ TEST_P(RadioVoiceTest, switchWaitingOrHoldingAndActive) { {RadioError::INVALID_STATE, RadioError::MODEM_ERR}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "switchWaitingOrHoldingAndActive finished"; } /* * Test IRadioVoice.conference() for the response returned. */ TEST_P(RadioVoiceTest, conference) { - LOG(DEBUG) << "conference"; serial = GetRandomSerialNumber(); radio_voice->conference(serial); @@ -564,14 +539,12 @@ TEST_P(RadioVoiceTest, conference) { {RadioError::INVALID_STATE, RadioError::MODEM_ERR}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "conference finished"; } /* * Test IRadioVoice.rejectCall() for the response returned. */ TEST_P(RadioVoiceTest, rejectCall) { - LOG(DEBUG) << "rejectCall"; serial = GetRandomSerialNumber(); radio_voice->rejectCall(serial); @@ -584,14 +557,12 @@ TEST_P(RadioVoiceTest, rejectCall) { {RadioError::INVALID_STATE, RadioError::MODEM_ERR}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "rejectCall finished"; } /* * Test IRadioVoice.getLastCallFailCause() for the response returned. */ TEST_P(RadioVoiceTest, getLastCallFailCause) { - LOG(DEBUG) << "getLastCallFailCause"; serial = GetRandomSerialNumber(); radio_voice->getLastCallFailCause(serial); @@ -603,14 +574,12 @@ TEST_P(RadioVoiceTest, getLastCallFailCause) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, {RadioError::NONE}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "getLastCallFailCause finished"; } /* * Test IRadioVoice.getCallForwardStatus() for the response returned. */ TEST_P(RadioVoiceTest, getCallForwardStatus) { - LOG(DEBUG) << "getCallForwardStatus"; serial = GetRandomSerialNumber(); CallForwardInfo callInfo; memset(&callInfo, 0, sizeof(callInfo)); @@ -627,14 +596,12 @@ TEST_P(RadioVoiceTest, getCallForwardStatus) { {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "getCallForwardStatus finished"; } /* * Test IRadioVoice.setCallForward() for the response returned. */ TEST_P(RadioVoiceTest, setCallForward) { - LOG(DEBUG) << "setCallForward"; serial = GetRandomSerialNumber(); CallForwardInfo callInfo; memset(&callInfo, 0, sizeof(callInfo)); @@ -651,14 +618,12 @@ TEST_P(RadioVoiceTest, setCallForward) { {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "setCallForward finished"; } /* * Test IRadioVoice.getCallWaiting() for the response returned. */ TEST_P(RadioVoiceTest, getCallWaiting) { - LOG(DEBUG) << "getCallWaiting"; serial = GetRandomSerialNumber(); radio_voice->getCallWaiting(serial, 1); @@ -672,14 +637,12 @@ TEST_P(RadioVoiceTest, getCallWaiting) { {RadioError::NONE, RadioError::INVALID_ARGUMENTS, RadioError::MODEM_ERR}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "getCallWaiting finished"; } /* * Test IRadioVoice.setCallWaiting() for the response returned. */ TEST_P(RadioVoiceTest, setCallWaiting) { - LOG(DEBUG) << "setCallWaiting"; serial = GetRandomSerialNumber(); radio_voice->setCallWaiting(serial, true, 1); @@ -693,14 +656,12 @@ TEST_P(RadioVoiceTest, setCallWaiting) { {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "setCallWaiting finished"; } /* * Test IRadioVoice.acceptCall() for the response returned. */ TEST_P(RadioVoiceTest, acceptCall) { - LOG(DEBUG) << "acceptCall"; serial = GetRandomSerialNumber(); radio_voice->acceptCall(serial); @@ -713,14 +674,12 @@ TEST_P(RadioVoiceTest, acceptCall) { {RadioError::INVALID_STATE, RadioError::MODEM_ERR}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "acceptCall finished"; } /* * Test IRadioVoice.separateConnection() for the response returned. */ TEST_P(RadioVoiceTest, separateConnection) { - LOG(DEBUG) << "separateConnection"; serial = GetRandomSerialNumber(); radio_voice->separateConnection(serial, 1); @@ -734,14 +693,12 @@ TEST_P(RadioVoiceTest, separateConnection) { {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "separateConnection finished"; } /* * Test IRadioVoice.explicitCallTransfer() for the response returned. */ TEST_P(RadioVoiceTest, explicitCallTransfer) { - LOG(DEBUG) << "explicitCallTransfer"; serial = GetRandomSerialNumber(); radio_voice->explicitCallTransfer(serial); @@ -754,14 +711,12 @@ TEST_P(RadioVoiceTest, explicitCallTransfer) { {RadioError::INVALID_STATE, RadioError::MODEM_ERR}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "explicitCallTransfer finished"; } /* * Test IRadioVoice.sendCdmaFeatureCode() for the response returned. */ TEST_P(RadioVoiceTest, sendCdmaFeatureCode) { - LOG(DEBUG) << "sendCdmaFeatureCode"; serial = GetRandomSerialNumber(); radio_voice->sendCdmaFeatureCode(serial, std::string()); @@ -776,14 +731,12 @@ TEST_P(RadioVoiceTest, sendCdmaFeatureCode) { RadioError::MODEM_ERR, RadioError::OPERATION_NOT_ALLOWED}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "sendCdmaFeatureCode finished"; } /* * Test IRadioVoice.sendDtmf() for the response returned. */ TEST_P(RadioVoiceTest, sendDtmf) { - LOG(DEBUG) << "sendDtmf"; serial = GetRandomSerialNumber(); radio_voice->sendDtmf(serial, "1"); @@ -798,14 +751,12 @@ TEST_P(RadioVoiceTest, sendDtmf) { RadioError::INVALID_MODEM_STATE, RadioError::MODEM_ERR}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "sendDtmf finished"; } /* * Test IRadioVoice.startDtmf() for the response returned. */ TEST_P(RadioVoiceTest, startDtmf) { - LOG(DEBUG) << "startDtmf"; serial = GetRandomSerialNumber(); radio_voice->startDtmf(serial, "1"); @@ -820,14 +771,12 @@ TEST_P(RadioVoiceTest, startDtmf) { RadioError::INVALID_MODEM_STATE, RadioError::MODEM_ERR}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "startDtmf finished"; } /* * Test IRadioVoice.stopDtmf() for the response returned. */ TEST_P(RadioVoiceTest, stopDtmf) { - LOG(DEBUG) << "stopDtmf"; serial = GetRandomSerialNumber(); radio_voice->stopDtmf(serial); @@ -841,14 +790,12 @@ TEST_P(RadioVoiceTest, stopDtmf) { RadioError::INVALID_MODEM_STATE, RadioError::MODEM_ERR}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "stopDtmf finished"; } /* * Test IRadioVoice.setMute() for the response returned. */ TEST_P(RadioVoiceTest, setMute) { - LOG(DEBUG) << "setMute"; serial = GetRandomSerialNumber(); radio_voice->setMute(serial, true); @@ -861,14 +808,12 @@ TEST_P(RadioVoiceTest, setMute) { {RadioError::NONE, RadioError::INVALID_ARGUMENTS}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "setMute finished"; } /* * Test IRadioVoice.getMute() for the response returned. */ TEST_P(RadioVoiceTest, getMute) { - LOG(DEBUG) << "getMute"; serial = GetRandomSerialNumber(); radio_voice->getMute(serial); @@ -879,14 +824,12 @@ TEST_P(RadioVoiceTest, getMute) { if (cardStatus.cardState == CardStatus::STATE_ABSENT) { EXPECT_EQ(RadioError::NONE, radioRsp_voice->rspInfo.error); } - LOG(DEBUG) << "getMute finished"; } /* * Test IRadioVoice.sendBurstDtmf() for the response returned. */ TEST_P(RadioVoiceTest, sendBurstDtmf) { - LOG(DEBUG) << "sendBurstDtmf"; serial = GetRandomSerialNumber(); radio_voice->sendBurstDtmf(serial, "1", 0, 0); @@ -900,14 +843,12 @@ TEST_P(RadioVoiceTest, sendBurstDtmf) { RadioError::MODEM_ERR, RadioError::OPERATION_NOT_ALLOWED}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "sendBurstDtmf finished"; } /* * Test IRadioVoice.sendUssd() for the response returned. */ TEST_P(RadioVoiceTest, sendUssd) { - LOG(DEBUG) << "sendUssd"; serial = GetRandomSerialNumber(); radio_voice->sendUssd(serial, std::string("test")); EXPECT_EQ(std::cv_status::no_timeout, wait()); @@ -920,14 +861,12 @@ TEST_P(RadioVoiceTest, sendUssd) { {RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::MODEM_ERR}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "sendUssd finished"; } /* * Test IRadioVoice.cancelPendingUssd() for the response returned. */ TEST_P(RadioVoiceTest, cancelPendingUssd) { - LOG(DEBUG) << "cancelPendingUssd"; serial = GetRandomSerialNumber(); radio_voice->cancelPendingUssd(serial); @@ -941,14 +880,12 @@ TEST_P(RadioVoiceTest, cancelPendingUssd) { {RadioError::NONE, RadioError::INVALID_STATE, RadioError::MODEM_ERR}, CHECK_GENERAL_ERROR)); } - LOG(DEBUG) << "cancelPendingUssd finished"; } /* * Test IRadioVoice.isVoNrEnabled() for the response returned. */ TEST_P(RadioVoiceTest, isVoNrEnabled) { - LOG(DEBUG) << "isVoNrEnabled"; serial = GetRandomSerialNumber(); radio_voice->isVoNrEnabled(serial); @@ -958,14 +895,12 @@ TEST_P(RadioVoiceTest, isVoNrEnabled) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, {RadioError::REQUEST_NOT_SUPPORTED, RadioError::NONE})); - LOG(DEBUG) << "isVoNrEnabled finished"; } /* * Test IRadioVoice.setVoNrEnabled() for the response returned. */ TEST_P(RadioVoiceTest, setVoNrEnabled) { - LOG(DEBUG) << "setVoNrEnabled"; serial = GetRandomSerialNumber(); radio_voice->setVoNrEnabled(serial, true); @@ -975,5 +910,4 @@ TEST_P(RadioVoiceTest, setVoNrEnabled) { ASSERT_TRUE(CheckAnyOfErrors(radioRsp_voice->rspInfo.error, {RadioError::REQUEST_NOT_SUPPORTED, RadioError::NONE})); - LOG(DEBUG) << "setVoNrEnabled finished"; } diff --git a/radio/aidl/vts/radio_voice_utils.h b/radio/aidl/vts/radio_voice_utils.h index 0c3df7fbbf..dda6c6572a 100644 --- a/radio/aidl/vts/radio_voice_utils.h +++ b/radio/aidl/vts/radio_voice_utils.h @@ -183,7 +183,7 @@ class RadioVoiceIndication : public BnRadioVoiceIndication { }; // The main test class for Radio AIDL Voice. -class RadioVoiceTest : public ::testing::TestWithParam, public RadioServiceTest { +class RadioVoiceTest : public RadioServiceTest { protected: /* Clear Potential Established Calls */ virtual ndk::ScopedAStatus clearPotentialEstablishedCalls(); @@ -192,7 +192,7 @@ class RadioVoiceTest : public ::testing::TestWithParam, public Radi std::shared_ptr radioInd_network; public: - virtual void SetUp() override; + void SetUp() override; /* radio voice service handle */ std::shared_ptr radio_voice; From 8e9ac0249a10d1cced36bebaa0c5a044658f1f9a Mon Sep 17 00:00:00 2001 From: Austin Borger Date: Thu, 4 May 2023 11:17:26 -0700 Subject: [PATCH 954/998] Camera VTS: Close the session at the end of stream configuration validation Not calling mSession->close means that there will be multiple concurrent sessions open, which may not be supported by the device. Bug: 280559094 Test: Ran on cuttlefish Change-Id: Ie622fabd4d0be2f8442e90d1c781bbf905172270 --- .../aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp index 622b20b094..f8d301f081 100644 --- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp +++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp @@ -3081,7 +3081,11 @@ TEST_P(CameraAidlTest, validateStreamConfigurations) { ASSERT_EQ(blobMinDurations.size(), blobStallDurations.size()); } - // Validate other aspects of stream configuration metadata... + // TODO (b/280887191): Validate other aspects of stream configuration metadata... + + ndk::ScopedAStatus ret = mSession->close(); + mSession = nullptr; + ASSERT_TRUE(ret.isOk()); } } From 87e9f2bebe0efd1821cdf08a1ca3810409eaf9a5 Mon Sep 17 00:00:00 2001 From: Jeff Pu Date: Wed, 3 May 2023 17:59:21 +0000 Subject: [PATCH 955/998] Close the session if Fingerprint servers die by registering the death notification of the associated binder. Bug: 273807765 Test: adb shell stop;adb shell start Change-Id: Ifc60e68fdbf986a355f828a7fc11f2aecee4cbea --- .../fingerprint/aidl/default/Android.bp | 26 ++++ .../fingerprint/aidl/default/Fingerprint.cpp | 2 + .../fingerprint/aidl/default/Session.cpp | 15 +++ .../aidl/default/include/Session.h | 7 + .../aidl/default/tests/SessionTest.cpp | 125 ++++++++++++++++++ 5 files changed, 175 insertions(+) create mode 100644 biometrics/fingerprint/aidl/default/tests/SessionTest.cpp diff --git a/biometrics/fingerprint/aidl/default/Android.bp b/biometrics/fingerprint/aidl/default/Android.bp index fe224c9885..16302eb9af 100644 --- a/biometrics/fingerprint/aidl/default/Android.bp +++ b/biometrics/fingerprint/aidl/default/Android.bp @@ -110,6 +110,32 @@ cc_test { require_root: true, } +cc_test { + name: "android.hardware.biometrics.fingerprint.SessionTest", + local_include_dirs: ["include"], + srcs: [ + "tests/SessionTest.cpp", + "Session.cpp", + "FakeFingerprintEngine.cpp", + "FakeLockoutTracker.cpp", + ], + shared_libs: [ + "libbase", + "libbinder_ndk", + "android.hardware.biometrics.common.thread", + ], + static_libs: [ + "libandroid.hardware.biometrics.fingerprint.VirtualProps", + "android.hardware.biometrics.fingerprint-V3-ndk", + "android.hardware.biometrics.common-V3-ndk", + "android.hardware.keymaster-V4-ndk", + "android.hardware.biometrics.common.util", + ], + vendor: true, + test_suites: ["general-tests"], + require_root: true, +} + sysprop_library { name: "android.hardware.biometrics.fingerprint.VirtualProps", srcs: ["fingerprint.sysprop"], diff --git a/biometrics/fingerprint/aidl/default/Fingerprint.cpp b/biometrics/fingerprint/aidl/default/Fingerprint.cpp index 7808a13d16..f00a49d26e 100644 --- a/biometrics/fingerprint/aidl/default/Fingerprint.cpp +++ b/biometrics/fingerprint/aidl/default/Fingerprint.cpp @@ -103,6 +103,8 @@ ndk::ScopedAStatus Fingerprint::createSession(int32_t sensorId, int32_t userId, mSession = SharedRefBase::make(sensorId, userId, cb, mEngine.get(), &mWorker); *out = mSession; + mSession->linkToDeath(cb->asBinder().get()); + LOG(INFO) << "createSession: sensorId:" << sensorId << " userId:" << userId; return ndk::ScopedAStatus::ok(); } diff --git a/biometrics/fingerprint/aidl/default/Session.cpp b/biometrics/fingerprint/aidl/default/Session.cpp index 38d6a134e2..c06c9317e8 100644 --- a/biometrics/fingerprint/aidl/default/Session.cpp +++ b/biometrics/fingerprint/aidl/default/Session.cpp @@ -25,6 +25,14 @@ namespace aidl::android::hardware::biometrics::fingerprint { +void onClientDeath(void* cookie) { + LOG(INFO) << "FingerprintService has died"; + Session* session = static_cast(cookie); + if (session && !session->isClosed()) { + session->close(); + } +} + Session::Session(int sensorId, int userId, std::shared_ptr cb, FakeFingerprintEngine* engine, WorkerThread* worker) : mSensorId(sensorId), @@ -39,6 +47,12 @@ Session::Session(int sensorId, int userId, std::shared_ptr cb, CHECK(mEngine); CHECK(mWorker); CHECK(mCb); + + mDeathRecipient = AIBinder_DeathRecipient_new(onClientDeath); +} + +binder_status_t Session::linkToDeath(AIBinder* binder) { + return AIBinder_linkToDeath(binder, mDeathRecipient, this); } void Session::scheduleStateOrCrash(SessionState state) { @@ -228,6 +242,7 @@ ndk::ScopedAStatus Session::close() { // Crashing."; mCurrentState = SessionState::CLOSED; mCb->onSessionClosed(); + AIBinder_DeathRecipient_delete(mDeathRecipient); return ndk::ScopedAStatus::ok(); } diff --git a/biometrics/fingerprint/aidl/default/include/Session.h b/biometrics/fingerprint/aidl/default/include/Session.h index b596d9e2a9..526d5797cc 100644 --- a/biometrics/fingerprint/aidl/default/include/Session.h +++ b/biometrics/fingerprint/aidl/default/include/Session.h @@ -42,6 +42,8 @@ enum class SessionState { RESETTING_LOCKOUT, }; +void onClientDeath(void* cookie); + class Session : public BnSession { public: Session(int sensorId, int userId, std::shared_ptr cb, @@ -101,6 +103,8 @@ class Session : public BnSession { ndk::ScopedAStatus setIgnoreDisplayTouches(bool shouldIgnore) override; + binder_status_t linkToDeath(AIBinder* binder); + bool isClosed(); private: @@ -139,6 +143,9 @@ class Session : public BnSession { // modified from both the main and the worker threads. std::atomic mScheduledState; std::atomic mCurrentState; + + // Binder death handler. + AIBinder_DeathRecipient* mDeathRecipient; }; } // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/tests/SessionTest.cpp b/biometrics/fingerprint/aidl/default/tests/SessionTest.cpp new file mode 100644 index 0000000000..3b96d7f099 --- /dev/null +++ b/biometrics/fingerprint/aidl/default/tests/SessionTest.cpp @@ -0,0 +1,125 @@ +/* + * 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. + */ + +#include +#include +#include + +#include + +#include + +#include "Session.h" +#include "thread/WorkerThread.h" +#include "util/Util.h" + +using namespace ::android::fingerprint::virt; +using namespace ::aidl::android::hardware::biometrics::fingerprint; + +namespace aidl::android::hardware::biometrics::fingerprint { + +class TestSessionCallback : public BnSessionCallback { + public: + ndk::ScopedAStatus onChallengeGenerated(int64_t /*challenge*/) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onChallengeRevoked(int64_t /*challenge*/) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onError(fingerprint::Error /*error*/, int32_t /*vendorCode*/) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onEnrollmentProgress(int32_t /*enrollmentId*/, + int32_t /*remaining*/) override { + return ndk::ScopedAStatus::ok(); + }; + + ::ndk::ScopedAStatus onAuthenticationSucceeded(int32_t /*enrollmentId*/, + const keymaster::HardwareAuthToken&) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onAuthenticationFailed() override { return ndk::ScopedAStatus::ok(); }; + ::ndk::ScopedAStatus onInteractionDetected() override { return ndk::ScopedAStatus::ok(); }; + ndk::ScopedAStatus onAcquired(AcquiredInfo /*info*/, int32_t /*vendorCode*/) override { + return ndk::ScopedAStatus::ok(); + } + ::ndk::ScopedAStatus onEnrollmentsEnumerated( + const std::vector& /*enrollmentIds*/) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onEnrollmentsRemoved( + const std::vector& /*enrollmentIds*/) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onAuthenticatorIdRetrieved(int64_t /*authenticatorId*/) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onAuthenticatorIdInvalidated(int64_t /*authenticatorId*/) override { + return ndk::ScopedAStatus::ok(); + }; + ::ndk::ScopedAStatus onLockoutPermanent() override { return ndk::ScopedAStatus::ok(); }; + ndk::ScopedAStatus onLockoutTimed(int64_t /* timeout */) override { + return ndk::ScopedAStatus::ok(); + } + ndk::ScopedAStatus onLockoutCleared() override { return ndk::ScopedAStatus::ok(); } + ndk::ScopedAStatus onSessionClosed() override { + mIsClosed = true; + return ndk::ScopedAStatus::ok(); + } + + bool mIsClosed = false; +}; + +class SessionTest : public ::testing::Test { + public: + SessionTest() : mWorker(2) {} + + protected: + void SetUp() override { + mCb = ndk::SharedRefBase::make(); + mSession = ndk::SharedRefBase::make(1, 2, mCb, &mFakeFingerprintEngine, &mWorker); + ASSERT_TRUE(mSession != nullptr); + mSession->linkToDeath(mCb->asBinder().get()); + } + + void TearDown() override {} + + std::shared_ptr mSession; + std::shared_ptr mCb; + + private: + FakeFingerprintEngine mFakeFingerprintEngine; + WorkerThread mWorker; +}; + +TEST_F(SessionTest, close) { + ASSERT_TRUE(!mSession->isClosed()); + ASSERT_TRUE(!mCb->mIsClosed); + onClientDeath(nullptr); + ASSERT_TRUE(!mSession->isClosed()); + ASSERT_TRUE(!mCb->mIsClosed); + onClientDeath(static_cast(mSession.get())); + ASSERT_TRUE(mSession->isClosed()); + ASSERT_TRUE(mCb->mIsClosed); +} + +} // namespace aidl::android::hardware::biometrics::fingerprint + +int main(int argc, char** argv) { + testing::InitGoogleTest(&argc, argv); + ABinderProcess_startThreadPool(); + return RUN_ALL_TESTS(); +} From 49281ae7a6f40fd0324dc9a70bc4013ff01c82c8 Mon Sep 17 00:00:00 2001 From: Eva Chen Date: Fri, 5 May 2023 15:18:24 -0700 Subject: [PATCH 956/998] Remove note for ADAS properties. Bug: 281133179 Test: Comment only change Change-Id: I6d9c8dfa0fead76195616023442e09887ae74aac --- .../hardware/automotive/vehicle/VehicleProperty.aidl | 6 ------ 1 file changed, 6 deletions(-) diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl index 6dca41f9f1..d9c6de7ef9 100644 --- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl +++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl @@ -4384,12 +4384,6 @@ enum VehicleProperty { /*********************************************************************************************** * Start of ADAS Properties * - * Android is not a safety critical system and is provided as is without any timing guarantees, - * representations or warranties. OEMs implementing these properties, and clients using these - * properties should ensure they complete any necessary safety reviews, in accordance with - * industry standards, to ensure the use of these APIs do not negatively impact driver safety. - * Use of any Google APIs will be at the OEM's sole risk. - * * Allocate IDs in range of 0x1000 (inclusive) to 0x1100 (exclusive) for ADAS properties **********************************************************************************************/ From 79bbec97c4990989bfe9eea78e1b6990cfca0236 Mon Sep 17 00:00:00 2001 From: Kriti Dang Date: Thu, 4 May 2023 17:54:26 +0200 Subject: [PATCH 957/998] Change the HDR conversion VTS test to take into account sink device capabilities Bug: 278467239 Test: atest VtsHalGraphicsComposer3_TargetTest Change-Id: I69c21b6d8b9753500a7b7a1692448b7151009ba3 --- .../aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp index ed4f28cf5f..18d36e4c14 100644 --- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp +++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp @@ -655,8 +655,15 @@ TEST_P(GraphicsComposerAidlTest, SetHdrConversionStrategy_Force) { return; } const auto& [status, conversionCapabilities] = mComposerClient->getHdrConversionCapabilities(); + const auto& [status2, hdrCapabilities] = + mComposerClient->getHdrCapabilities(getPrimaryDisplayId()); + const auto& hdrTypes = hdrCapabilities.types; for (auto conversionCapability : conversionCapabilities) { if (conversionCapability.outputType != common::Hdr::INVALID) { + if (std::find(hdrTypes.begin(), hdrTypes.end(), conversionCapability.outputType) == + hdrTypes.end()) { + continue; + } common::HdrConversionStrategy hdrConversionStrategy; hdrConversionStrategy.set( conversionCapability.outputType); @@ -674,6 +681,11 @@ TEST_P(GraphicsComposerAidlTest, SetHdrConversionStrategy_Auto) { return; } const auto& [status, conversionCapabilities] = mComposerClient->getHdrConversionCapabilities(); + const auto& [status2, hdrCapabilities] = + mComposerClient->getHdrCapabilities(getPrimaryDisplayId()); + if (hdrCapabilities.types.size() <= 0) { + return; + } std::vector autoHdrTypes; for (auto conversionCapability : conversionCapabilities) { if (conversionCapability.outputType != common::Hdr::INVALID) { From a2fa508d3fc93c5be957c4ccbfe62fc12d6e2994 Mon Sep 17 00:00:00 2001 From: terryguan Date: Thu, 4 May 2023 09:25:44 -0700 Subject: [PATCH 958/998] Adding for adding async large parcelalbe callbacks functionality Bug: 270740905 Test: atest com.android.car.CarPropertyManagerTest Test: atest android.car.apitest.CarPropertyManagerTest Test: atest com.android.car.hal.PropertyHalServiceTest Test: manual, verified largeParcelable using shared memeory Change-Id: Ic01402ceb58ea93957777bec4965121c594fa35e --- .../hardware/src/FakeVehicleHardware.cpp | 40 ++++++++++++++----- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp index 740d3f6831..3f5e4c4273 100644 --- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp @@ -81,10 +81,18 @@ using ::android::base::StartsWith; using ::android::base::StringPrintf; // In order to test large number of vehicle property configs, we might generate additional fake -// property config start from this ID. Note these fake properties are for getAllPropertyConfigs -// testing only. -constexpr int32_t STARTING_VENDOR_CODE_PROPERTIES_FOR_TEST = 0x5000; -constexpr int32_t NUMBER_OF_TEST_VENDOR_CODES = 0x3000; +// property config start from this ID. These fake properties are for getPropertyList, +// getPropertiesAsync, and setPropertiesAsync. +// 0x21403000 +constexpr int32_t STARTING_VENDOR_CODE_PROPERTIES_FOR_TEST = + 0x3000 | toInt(testpropertyutils_impl::VehiclePropertyGroup::VENDOR) | + toInt(testpropertyutils_impl::VehicleArea::GLOBAL) | + toInt(testpropertyutils_impl::VehiclePropertyType::INT32); +// 0x21405000 +constexpr int32_t ENDING_VENDOR_CODE_PROPERTIES_FOR_TEST = + 0x5000 | toInt(testpropertyutils_impl::VehiclePropertyGroup::VENDOR) | + toInt(testpropertyutils_impl::VehicleArea::GLOBAL) | + toInt(testpropertyutils_impl::VehiclePropertyType::INT32); // The directory for default property configuration file. // For config file format, see impl/default_config/config/README.md. constexpr char DEFAULT_CONFIG_DIR[] = "/vendor/etc/automotive/vhalconfig/"; @@ -590,6 +598,17 @@ FakeVehicleHardware::ValueResultType FakeVehicleHardware::maybeGetSpecialValue( int32_t propId = value.prop; ValueResultType result; + if (propId >= STARTING_VENDOR_CODE_PROPERTIES_FOR_TEST && + propId < ENDING_VENDOR_CODE_PROPERTIES_FOR_TEST) { + *isSpecialValue = true; + result = mValuePool->obtainInt32(/* value= */ 5); + + result.value()->prop = propId; + result.value()->areaId = 0; + result.value()->timestamp = elapsedRealtimeNano(); + return result; + } + if (mFakeUserHal->isSupported(propId)) { *isSpecialValue = true; return getUserHalProp(value); @@ -706,6 +725,12 @@ VhalResult FakeVehicleHardware::maybeSetSpecialValue(const VehiclePropValu VehiclePropValuePool::RecyclableType updatedValue; int32_t propId = value.prop; + if (propId >= STARTING_VENDOR_CODE_PROPERTIES_FOR_TEST && + propId < ENDING_VENDOR_CODE_PROPERTIES_FOR_TEST) { + *isSpecialValue = true; + return {}; + } + if (mFakeUserHal->isSupported(propId)) { *isSpecialValue = true; return setUserHalProp(value); @@ -829,7 +854,6 @@ VhalResult FakeVehicleHardware::setValue(const VehiclePropValue& value) { // Here we are just updating mValuePool. bool isSpecialValue = false; auto setSpecialValueResult = maybeSetSpecialValue(value, &isSpecialValue); - if (isSpecialValue) { if (!setSpecialValueResult.ok()) { return StatusError(getErrorCode(setSpecialValueResult)) @@ -1038,11 +1062,9 @@ std::string FakeVehicleHardware::parseErrMsg(std::string fieldName, std::string void FakeVehicleHardware::generateVendorConfigs( std::vector& outAllConfigs) const { for (int i = STARTING_VENDOR_CODE_PROPERTIES_FOR_TEST; - i < STARTING_VENDOR_CODE_PROPERTIES_FOR_TEST + NUMBER_OF_TEST_VENDOR_CODES; i++) { + i < ENDING_VENDOR_CODE_PROPERTIES_FOR_TEST; i++) { VehiclePropConfig config; - config.prop = i | toInt(propertyutils_impl::VehiclePropertyGroup::VENDOR) | - toInt(propertyutils_impl::VehicleArea::GLOBAL) | - toInt(propertyutils_impl::VehiclePropertyType::INT32); + config.prop = i; config.access = VehiclePropertyAccess::READ_WRITE; outAllConfigs.push_back(config); } From 6eafc23dcf4fc662acb0f9da21b5a87e0d65d9f6 Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Mon, 8 May 2023 18:28:08 +0000 Subject: [PATCH 959/998] Skip HIDL v1.6 RTT responder VTS tests if the capabilities do not indicate responder support. Bug: 280550766 Test: atest VtsHalWifiRttV1_6TargetTest Change-Id: I4e76a874837c6199b2bef65b3f0c138260972b4a --- .../wifi_rtt_controller_hidl_test.cpp | 40 ++++++++++++------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/wifi/1.6/vts/functional/wifi_rtt_controller_hidl_test.cpp b/wifi/1.6/vts/functional/wifi_rtt_controller_hidl_test.cpp index 5b5e62364a..0572ac61e3 100644 --- a/wifi/1.6/vts/functional/wifi_rtt_controller_hidl_test.cpp +++ b/wifi/1.6/vts/functional/wifi_rtt_controller_hidl_test.cpp @@ -78,6 +78,13 @@ class WifiRttControllerHidlTest : public ::testing::TestWithParam { virtual void TearDown() override { stopWifi(GetInstanceName()); } + RttCapabilities getRttCapabilities() { + std::pair status_and_caps; + status_and_caps = HIDL_INVOKE(wifi_rtt_controller_, getCapabilities_1_6); + EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_caps.first.code); + return status_and_caps.second; + } + // A simple test implementation of WifiRttControllerEventCallback. class WifiRttControllerEventCallback : public ::testing::VtsHalHidlTargetCallbackBase, @@ -151,12 +158,9 @@ TEST_P(WifiRttControllerHidlTest, RegisterEventCallback_1_6) { * This test case tests the two sided ranging - 802.11mc FTM protocol. */ TEST_P(WifiRttControllerHidlTest, Request2SidedRangeMeasurement) { - std::pair status_and_caps; - // Get the Capabilities - status_and_caps = HIDL_INVOKE(wifi_rtt_controller_, getCapabilities_1_6); - EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_caps.first.code); - if (!status_and_caps.second.rttFtmSupported) { + RttCapabilities capabilities = getRttCapabilities(); + if (!capabilities.rttFtmSupported) { GTEST_SKIP() << "Skipping two sided RTT since driver/fw doesn't support"; } std::vector configs; @@ -196,19 +200,16 @@ TEST_P(WifiRttControllerHidlTest, Request2SidedRangeMeasurement) { * rangeRequest_1_6 */ TEST_P(WifiRttControllerHidlTest, RangeRequest_1_6) { - std::pair status_and_caps; - // Get the Capabilities - status_and_caps = HIDL_INVOKE(wifi_rtt_controller_, getCapabilities_1_6); - EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_caps.first.code); - if (!status_and_caps.second.rttOneSidedSupported) { + RttCapabilities capabilities = getRttCapabilities(); + if (!capabilities.rttOneSidedSupported) { GTEST_SKIP() << "Skipping one sided RTT since driver/fw doesn't support"; } // Get the highest support preamble int preamble = 1; - status_and_caps.second.preambleSupport >>= 1; - while (status_and_caps.second.preambleSupport != 0) { - status_and_caps.second.preambleSupport >>= 1; + capabilities.preambleSupport >>= 1; + while (capabilities.preambleSupport != 0) { + capabilities.preambleSupport >>= 1; preamble <<= 1; } std::vector configs; @@ -259,9 +260,14 @@ TEST_P(WifiRttControllerHidlTest, GetCapabilities_1_6) { * getResponderInfo_1_6 */ TEST_P(WifiRttControllerHidlTest, GetResponderInfo_1_6) { - std::pair status_and_info; + // Get the capabilities + RttCapabilities capabilities = getRttCapabilities(); + if (!capabilities.responderSupported) { + GTEST_SKIP() << "Skipping because responder is not supported"; + } // Invoke the call + std::pair status_and_info; status_and_info = HIDL_INVOKE(wifi_rtt_controller_, getResponderInfo_1_6); EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_info.first.code); } @@ -270,6 +276,12 @@ TEST_P(WifiRttControllerHidlTest, GetResponderInfo_1_6) { * enableResponder_1_6 */ TEST_P(WifiRttControllerHidlTest, EnableResponder_1_6) { + // Get the capabilities + RttCapabilities capabilities = getRttCapabilities(); + if (!capabilities.responderSupported) { + GTEST_SKIP() << "Skipping because responder is not supported"; + } + std::pair status_and_info; int cmdId = 55; WifiChannelInfo channelInfo; From 194757d25f06bfaa6aec31f95db453d1b7c0fb3c Mon Sep 17 00:00:00 2001 From: Yu Shan Date: Wed, 19 Apr 2023 11:44:35 -0700 Subject: [PATCH 960/998] Add inject-task-next-reboot debug command. Support a debug command that will inject a fake remote task for testing on next reboot with specified latency. This is used to simulate the situation when a remote task arrives while the device is not booted up and the task will be delivered once the device boots up. Test: Manually test on seahawk. Bug: 275880463 Change-Id: I6eb064893bea0700da80dfa2dcf3079ddb0b59a1 --- .../hal/default/include/RemoteAccessService.h | 4 + .../hal/default/src/RemoteAccessService.cpp | 85 ++++++++++++++++++- 2 files changed, 86 insertions(+), 3 deletions(-) diff --git a/automotive/remoteaccess/hal/default/include/RemoteAccessService.h b/automotive/remoteaccess/hal/default/include/RemoteAccessService.h index 9aabad6573..b18986adac 100644 --- a/automotive/remoteaccess/hal/default/include/RemoteAccessService.h +++ b/automotive/remoteaccess/hal/default/include/RemoteAccessService.h @@ -105,6 +105,8 @@ class RemoteAccessService size_t mRetryWaitInMs = 10'000; std::shared_ptr mDebugCallback; + std::thread mInjectDebugTaskThread; + void runTaskLoop(); void maybeStartTaskLoop(); void maybeStopTaskLoop(); @@ -116,6 +118,8 @@ class RemoteAccessService void printCurrentStatus(int fd); std::string clientIdToTaskCountToStringLocked() REQUIRES(mLock); void debugInjectTask(int fd, std::string_view clientId, std::string_view taskData); + void debugInjectTaskNextReboot(int fd, std::string_view clientId, std::string_view taskData, + const char* latencyInSecStr); void updateGrpcConnected(bool connected); android::base::Result deliverRemoteTaskThroughCallback(const std::string& clientId, std::string_view taskData); diff --git a/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp b/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp index bbda9df759..dbe8150124 100644 --- a/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp +++ b/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp @@ -18,12 +18,16 @@ #include #include +#include #include #include #include #include +#include #include #include +#include +#include #include namespace android { @@ -37,6 +41,7 @@ using ::aidl::android::hardware::automotive::remoteaccess::ApState; using ::aidl::android::hardware::automotive::remoteaccess::IRemoteTaskCallback; using ::aidl::android::hardware::automotive::vehicle::VehicleProperty; using ::android::base::Error; +using ::android::base::ParseInt; using ::android::base::Result; using ::android::base::ScopedLockAssertion; using ::android::base::StringAppendF; @@ -57,8 +62,12 @@ constexpr char COMMAND_STOP_DEBUG_CALLBACK[] = "--stop-debug-callback"; constexpr char COMMAND_SHOW_TASK[] = "--show-task"; constexpr char COMMAND_GET_VEHICLE_ID[] = "--get-vehicle-id"; constexpr char COMMAND_INJECT_TASK[] = "--inject-task"; +constexpr char COMMAND_INJECT_TASK_NEXT_REBOOT[] = "--inject-task-next-reboot"; constexpr char COMMAND_STATUS[] = "--status"; +constexpr char DEBUG_TASK_FOLDER[] = "/data/local/tests"; +constexpr char DEBUG_TASK_FILE[] = "/data/local/tests/debugTask"; + std::vector stringToBytes(std::string_view s) { const char* data = s.data(); return std::vector(data, data + s.size()); @@ -92,10 +101,43 @@ std::string boolToString(bool x) { } // namespace RemoteAccessService::RemoteAccessService(WakeupClient::StubInterface* grpcStub) - : mGrpcStub(grpcStub){}; + : mGrpcStub(grpcStub) { + std::ifstream debugTaskFile; + debugTaskFile.open(DEBUG_TASK_FILE, std::ios::in); + if (!debugTaskFile.is_open()) { + ALOGD("No debug task available"); + return; + } + + char buffer[1024] = {}; + debugTaskFile.getline(buffer, sizeof(buffer)); + std::string clientId = std::string(buffer); + debugTaskFile.getline(buffer, sizeof(buffer)); + std::string taskData = std::string(buffer); + int latencyInSec; + debugTaskFile >> latencyInSec; + debugTaskFile.close(); + + ALOGD("Task for client: %s, data: [%s], latency: %d\n", clientId.c_str(), taskData.c_str(), + latencyInSec); + + mInjectDebugTaskThread = std::thread([this, clientId, taskData, latencyInSec] { + std::this_thread::sleep_for(std::chrono::seconds(latencyInSec)); + if (auto result = deliverRemoteTaskThroughCallback(clientId, taskData); !result.ok()) { + ALOGE("Failed to inject debug task, clientID: %s, taskData: %s, error: %s", + clientId.c_str(), taskData.c_str(), result.error().message().c_str()); + return; + } + ALOGD("Task for client: %s, data: [%s] successfully injected\n", clientId.c_str(), + taskData.c_str()); + }); +} RemoteAccessService::~RemoteAccessService() { maybeStopTaskLoop(); + if (mInjectDebugTaskThread.joinable()) { + mInjectDebugTaskThread.join(); + } } void RemoteAccessService::maybeStartTaskLoop() { @@ -286,9 +328,12 @@ void RemoteAccessService::dumpHelp(int fd) { "%s: Show tasks received by debug callback\n" "%s: Get vehicle id\n" "%s [client_id] [task_data]: Inject a task\n" + "%s [client_id] [task_data] [latencyInSec]: " + "Inject a task on next reboot after latencyInSec seconds\n" "%s: Show status\n", COMMAND_SET_AP_STATE, COMMAND_START_DEBUG_CALLBACK, COMMAND_STOP_DEBUG_CALLBACK, - COMMAND_SHOW_TASK, COMMAND_GET_VEHICLE_ID, COMMAND_INJECT_TASK, COMMAND_STATUS); + COMMAND_SHOW_TASK, COMMAND_GET_VEHICLE_ID, COMMAND_INJECT_TASK, + COMMAND_INJECT_TASK_NEXT_REBOOT, COMMAND_STATUS); } binder_status_t RemoteAccessService::dump(int fd, const char** args, uint32_t numArgs) { @@ -365,6 +410,12 @@ binder_status_t RemoteAccessService::dump(int fd, const char** args, uint32_t nu return STATUS_OK; } debugInjectTask(fd, args[1], args[2]); + } else if (!strcmp(args[0], COMMAND_INJECT_TASK_NEXT_REBOOT)) { + if (numArgs < 4) { + dumpHelp(fd); + return STATUS_OK; + } + debugInjectTaskNextReboot(fd, args[1], args[2], args[3]); } else if (!strcmp(args[0], COMMAND_STATUS)) { printCurrentStatus(fd); } else { @@ -389,13 +440,41 @@ void RemoteAccessService::debugInjectTask(int fd, std::string_view clientId, std::string_view taskData) { std::string clientIdCopy = std::string(clientId); if (auto result = deliverRemoteTaskThroughCallback(clientIdCopy, taskData); !result.ok()) { - dprintf(fd, "Failed to inject task: %s", result.error().message().c_str()); + dprintf(fd, "Failed to inject task: %s\n", result.error().message().c_str()); return; } dprintf(fd, "Task for client: %s, data: [%s] successfully injected\n", clientId.data(), taskData.data()); } +void RemoteAccessService::debugInjectTaskNextReboot(int fd, std::string_view clientId, + std::string_view taskData, + const char* latencyInSecStr) { + int latencyInSec; + if (!ParseInt(latencyInSecStr, &latencyInSec)) { + dprintf(fd, "The input latency in second is not a valid integer"); + return; + } + std::ofstream debugTaskFile; + debugTaskFile.open(DEBUG_TASK_FILE, std::ios::out); + if (!debugTaskFile.is_open()) { + dprintf(fd, + "Failed to open debug task file, please run the command: " + "'adb shell touch %s' first\n", + DEBUG_TASK_FILE); + return; + } + if (taskData.find("\n") != std::string::npos) { + dprintf(fd, "Task data must not contain newline\n"); + return; + } + debugTaskFile << clientId << "\n" << taskData << "\n" << latencyInSec; + debugTaskFile.close(); + dprintf(fd, + "Task with clientId: %s, task data: %s, latency: %d sec scheduled for next reboot\n", + clientId.data(), taskData.data(), latencyInSec); +} + std::string RemoteAccessService::clientIdToTaskCountToStringLocked() { // Print the table header std::string output = "| ClientId | Count |\n"; From ba65d8a94831e33381f75b6d40baee57d55fe9db Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Mon, 8 May 2023 13:14:59 -0700 Subject: [PATCH 961/998] audio VTS: Update 7.0/PolicyConfig The call to instantiate PolicyConfig was updated in Iced9d665d018853c4b2a50f4471a545af7bf60bb, however the version of PolicyConfig class for HIDL HAL 7.x was not updated accordingly Bug: 205884982 Bug: 281450557 Test: atest VtsHalAudioV7_0TargetTest Test: atest HalAudioV7_0GeneratorTest (cherry picked from https://android-review.googlesource.com/q/commit:a273cdde847a627465458f971f88fa9ce07d4731) Merged-In: Ic7ed6b186e1d0f1ff853f84ad962c1e4acf17a68 Change-Id: Ic7ed6b186e1d0f1ff853f84ad962c1e4acf17a68 --- .../core/all-versions/vts/functional/7.0/PolicyConfig.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h b/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h index c1d5669775..f6271ff3fa 100644 --- a/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h +++ b/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h @@ -41,15 +41,10 @@ using Module = Modules::Module; class PolicyConfig { public: - explicit PolicyConfig(const std::string& configFileName) - : mConfigFileName{configFileName}, - mFilePath{findExistingConfigurationFile(mConfigFileName)}, - mConfig{xsd::read(mFilePath.c_str())} { - init(); - } PolicyConfig(const std::string& configPath, const std::string& configFileName) : mConfigFileName{configFileName}, - mFilePath{configPath + "/" + mConfigFileName}, + mFilePath{configPath.empty() ? findExistingConfigurationFile(mConfigFileName) + : configPath + "/" + mConfigFileName}, mConfig{xsd::read(mFilePath.c_str())} { init(); } From b450714667ab71ff23c6cee909fe06a9b468fae5 Mon Sep 17 00:00:00 2001 From: Andrew Scull Date: Tue, 9 May 2023 18:29:23 +0000 Subject: [PATCH 962/998] Document expectations of DICE mode The Open Profile for DICE give possible guidelines on the requirements for the DICE mode but Android needs those to be strictly specified. Fix: 263144485 Test: n/a (cherry picked from https://android-review.googlesource.com/q/commit:ed74a681ebf859f2652a4bbbd669f6000243aee9) Merged-In: Ia5fc937654504199cabf4709f1c15484242e0161 Change-Id: Ia5fc937654504199cabf4709f1c15484242e0161 --- security/rkp/README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/security/rkp/README.md b/security/rkp/README.md index 01c90a8db1..7477f803b3 100644 --- a/security/rkp/README.md +++ b/security/rkp/README.md @@ -291,6 +291,24 @@ available on the device it should appear in the certificate request as the leaf of a DKCertChain in AdditionalDKSignatures (see [CertificateRequest](#certificaterequest)). +#### Mode + +The Open Profile for DICE specifies four possible modes with the most important +mode being `normal`. A certificate must only set the mode to `normal` when all +of the following conditions are met when loading and verifying the software +component that is being described by the certificate: + +* verified boot with anti-rollback protection is enabled +* only the verified boot authorities for production images are enabled +* debug ports, fuses or other debug facilities are disabled +* device booted software from the normal primary source e.g. internal flash + +If any of these conditions are not met then it is recommended to explicitly +acknowledge this fact by using the `debug` mode. The mode should never be `not +configured`. + +#### Configuration descriptor + The Open Profile for DICE allows for an arbitrary configuration descriptor. For BCC entries, this configuration descriptor is a CBOR map with the following optional fields. If no fields are relevant, an empty map should be encoded. From 0ace7e5f914df0af92c885ade23a2708b80b085c Mon Sep 17 00:00:00 2001 From: maheshkkv Date: Wed, 10 May 2023 16:18:32 -0700 Subject: [PATCH 963/998] Add documentation for Aware suspend & resume Bug: 281882132 Test: build Change-Id: Ifea3dd9a0bd635c95e3b80f09427d380b75e0fa9 --- wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl b/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl index 3ce8d0214a..e5bb34ef5e 100644 --- a/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl +++ b/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl @@ -243,7 +243,10 @@ interface IWifiNanIface { void terminateDataPathRequest(in char cmdId, in int ndpInstanceId); /** - * Start the suspension of a discovery service. + * Start the suspension of a discovery service. During the suspend state, the Wi-Fi Aware + * device must not transmit or receive frames for this session including any active NDPs. If + * all discovery sessions are suspended then the Wi-Fi Aware device must not transmit or + * receive any Wi-Fi Aware frames. * Asynchronous response is with |IWifiNanIfaceEventCallback.notifySuspendResponse|. * * @param cmdId Command Id to use for this invocation. @@ -256,7 +259,10 @@ interface IWifiNanIface { void suspendRequest(in char cmdId, in byte sessionId); /** - * Stop the suspension of a discovery service. + * Stop the suspension of a discovery service. Resume cancels an ongoing suspend for this Wi-Fi + * Aware discovery session and automatically resumes the session and any associated NDPs to the + * state before they were suspended. The Wi-Fi Aware resume operation should be faster than + * recreating the corresponding discovery session and NDPs with the same benefit of power. * Asynchronous response is with |IWifiNanIfaceEventCallback.notifyResumeResponse|. * * @param cmdId Command Id to use for this invocation. From 8e9d701b56bd74b2282dc6a249e93ff8c461b12b Mon Sep 17 00:00:00 2001 From: Gabriel Biren Date: Thu, 11 May 2023 01:07:42 +0000 Subject: [PATCH 964/998] Remove unused wifi offload HAL. Bug: 280901687 Test: m Change-Id: Iad9a2c470b27fbe5432fd5a88244162f8f73a71c --- wifi/offload/1.0/Android.bp | 24 -- wifi/offload/1.0/IOffload.hal | 87 ------- wifi/offload/1.0/IOffloadCallback.hal | 32 --- wifi/offload/1.0/types.hal | 226 ------------------ wifi/offload/1.0/vts/functional/Android.bp | 32 --- .../VtsHalWifiOffloadV1_0TargetTest.cpp | 218 ----------------- .../1.0/vts/functional/hidl_call_util.h | 121 ---------- 7 files changed, 740 deletions(-) delete mode 100644 wifi/offload/1.0/Android.bp delete mode 100644 wifi/offload/1.0/IOffload.hal delete mode 100644 wifi/offload/1.0/IOffloadCallback.hal delete mode 100644 wifi/offload/1.0/types.hal delete mode 100644 wifi/offload/1.0/vts/functional/Android.bp delete mode 100644 wifi/offload/1.0/vts/functional/VtsHalWifiOffloadV1_0TargetTest.cpp delete mode 100644 wifi/offload/1.0/vts/functional/hidl_call_util.h diff --git a/wifi/offload/1.0/Android.bp b/wifi/offload/1.0/Android.bp deleted file mode 100644 index 8fd602de1f..0000000000 --- a/wifi/offload/1.0/Android.bp +++ /dev/null @@ -1,24 +0,0 @@ -// This file is autogenerated by hidl-gen -Landroidbp. - -package { - // See: http://go/android-license-faq - // A large-scale-change added 'default_applicable_licenses' to import - // all of the 'license_kinds' from "hardware_interfaces_license" - // to get the below license kinds: - // SPDX-license-identifier-Apache-2.0 - default_applicable_licenses: ["hardware_interfaces_license"], -} - -hidl_interface { - name: "android.hardware.wifi.offload@1.0", - root: "android.hardware", - srcs: [ - "types.hal", - "IOffload.hal", - "IOffloadCallback.hal", - ], - interfaces: [ - "android.hidl.base@1.0", - ], - gen_java: false, -} diff --git a/wifi/offload/1.0/IOffload.hal b/wifi/offload/1.0/IOffload.hal deleted file mode 100644 index 48195195fb..0000000000 --- a/wifi/offload/1.0/IOffload.hal +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2016 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.hardware.wifi.offload@1.0; - -import IOffloadCallback; - -interface IOffload { - /** - * Configure the offload module to perform scans and filter results - * Scans must not be triggered due to configuration of the module. - * - * @param ScanParam paramters for scanning - * @param ScanFilter settings to filter scan result - * @return OffloadStatus indicating status of operation provided by this API - * If OffloadStatusCode::OK is returned, the operation was successful - * If OffloadStatusCode::NO_CONNECTION is returned, connection to the hardware is lost - * If OffloadStatusCode::ERROR is returned, requested operation could not be completed - */ - @entry - @callflow(next={"setEventCallback", "subscribeScanResults"}) - configureScans(ScanParam param, ScanFilter filter) generates (OffloadStatus status); - - /** - * Get scan statistics - * - * @return OffloadStatus indicating status of operation provided by this API - * @return ScanStats statistics of scans performed - * If OffloadStatusCode::OK is returned, the operation was successful - * If OffloadStatusCode::NO_CONNECTION is returned, connection to the hardware is lost - * If OffloadStatusCode::ERROR is returned, requested operation could not be completed - * If OffloadStatusCode::TIMEOUT is returned, time out waiting for the requested data - */ - @exit - @callflow(next={"subscribeScanResults", "unsubscribeScanResults", "getScanStats"}) - getScanStats() generates (OffloadStatus status, ScanStats scanStats); - - /** - * Subscribe to asynchronous scan events sent by offload module. This enables - * offload scans to be performed as per scan parameters, filtering the scan - * results based on configured scan filter and delivering the results after - * at least delayMs milliseconds from this call. If the client is already - * subscribed to the scan results, a call to this API must be a no-op. - * - * @param delayMs an integer expressing the minimum delay in mS after - * subscribing when scan results must be delivered to the client - * @return OffloadStatus indicating status of operation provided by this API - * If OffloadStatusCode::OK is returned, the operation was successful - * If OffloadStatusCode::NO_CONNECTION is returned, connection to the hardware is lost - * If OffloadStatusCode::ERROR is returned, requested operation could not be completed - */ - @callflow(next={"unsubscribeScanResults", "getScanStats"}) - subscribeScanResults(uint32_t delayMs) generates (OffloadStatus status); - - /** - * Unsubscribe to scan events sent by the offload module, hence disabling scans. - * If the client is already unsubscribed, a call to this API will be a no-op. - */ - @exit - @callflow(next={"*"}) - unsubscribeScanResults(); - - /** - * Setup the HIDL interface for reporting asynchronous scan events. A maximum - * of one callback interface is supported. Only one callback must be registered - * at any given time. If two consecutive calls are made with different callback - * interface objects, the latest one must be used to deliver events to client. - * - * @param cb An instance of the |IOffloadCallback| HIDL interface object - */ - @entry - @callflow(next={"subscribeScanStats", "configureScans"}) - setEventCallback(IOffloadCallback cb); -}; diff --git a/wifi/offload/1.0/IOffloadCallback.hal b/wifi/offload/1.0/IOffloadCallback.hal deleted file mode 100644 index 4888125d4e..0000000000 --- a/wifi/offload/1.0/IOffloadCallback.hal +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2016 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.hardware.wifi.offload@1.0; - -interface IOffloadCallback { - /** - * Interface for the Offload HAL to return scan events to the client - * - * @param scanResult a vector of scan result objects - */ - oneway onScanResult(vec scanResult); - /** - * Interface for the Offload HAL to inform the client of error conditions - * see OffloadStatus for the error conditions to be reported - * - * @param status OffloadStatus - */ - oneway onError(OffloadStatus status); -}; diff --git a/wifi/offload/1.0/types.hal b/wifi/offload/1.0/types.hal deleted file mode 100644 index 234f3fc433..0000000000 --- a/wifi/offload/1.0/types.hal +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright 2017 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.hardware.wifi.offload@1.0; - -/** - * Defines a bitmap of security modes - */ -enum SecurityMode : uint8_t { - OPEN = 0x1 << 1, - WEP = 0x1 << 2, - PSK = 0x1 << 3, - EAP = 0x1 << 4, -}; - -/** - * SSID of the Access Point, maximum 32 characters - */ -typedef vec Ssid; - -/** - * Preferred network information - * SSID and associated security mode(s) - */ -struct NetworkInfo { - Ssid ssid; - /* SecurityMode flags that are associated with this SSID - * More than one security mode can be supported, see SecurityMode */ - bitfield flags; -}; - -/** - * This is a bit mask describing the capabilities of a BSS. - * See IEEE Std 802.11: 8.4.1.4 - */ -enum Capability : uint16_t { - ESS = 1 << 0, - IBSS = 1 << 1, - CF_POLLABLE = 1 << 2, - CF_PLL_REQ = 1 << 3, - PRIVACY = 1 << 4, - SHORT_PREAMBLE = 1 << 5, - PBCC = 1 << 6, - CHANNEL_AGILITY = 1 << 7, - SPECTURM_MGMT = 1 << 8, - QOS = 1 << 9, - SHORT_SLOT_TIME = 1 << 10, - APSD = 1 << 11, - RADIO_MEASUREMENT = 1 << 12, - DSSS_OFDM = 1 << 13, - DELAYED_BLOCK_ACK = 1 << 14, - IMMEDIATE_BLOCK_ACK = 1 << 15, -}; - -/** - * Scan Results returned by the offload Hal - */ -struct ScanResult { - /* Information about this BSS - * SSID and security modes supported */ - NetworkInfo networkInfo; - /* BSSID of the BSS */ - uint8_t[6] bssid; - /* Can have multiple bits set, see Capability */ - bitfield capability; - /* Frequency scanned, in mHz */ - uint32_t frequency; - /* Signal strength in dBm */ - int8_t rssi; - /* TSF found in beacon/probe response */ - uint64_t tsf; -}; - - -/** - * Parameters for performing offload scans - */ -struct ScanParam { - /* Specify a list of SSIDs to scan, an empty list implies no preferred - * networks to scan */ - vec ssidList; - /* Frequencies to scan, in mHz, an empty frequency list implies a full scan */ - vec frequencyList; - /* Periodicity of the scans to be performed by the offload module - * A value of zero indicates disable periodic scans. For this revision, - * where offload module is performing scans in disconnected mode, this value - * should not be zero. In future versions, periodic scans can be eliminated */ - uint32_t disconnectedModeScanIntervalMs; -}; - -/** - * Instruction on how to filter the scan result before performing network - * selection and waking up the AP to connect - */ -struct ScanFilter { - /* Preferred network List of SSIDs and their security mode of interest - * The filter will drop the remaining scan results in the scan event. - * An empty list implies no filtering of scan result based on SSID and - * security mode. */ - vec preferredNetworkInfoList; - /* Minimum qualifying RSSI to be considered for network selection (dBm) */ - int8_t rssiThreshold; -}; - -struct ScanRecord { - /* Amount of time spent scanning */ - uint64_t durationMs; - /* Number of channels scanned */ - uint32_t numChannelsScanned; - /* Number of entries aggregated into this record */ - uint32_t numEntriesAggregated; -}; - -/** - * Enumerates the type of log that is recorded - */ -enum RecordName : uint32_t { - CMD_BASE = 0x00001000, - /* Record name corresponding to initialization */ - CMD_INT = CMD_BASE + 0, - /* Record name corresponding to configureScans() API */ - CMD_CONFIG_SCANS = CMD_BASE + 1, - /* Record name corresponding to subscribeScanResults() API */ - CMD_SUBSCRIBE_SCAN_RESULTS = CMD_BASE + 2, - /* Record name corresponding to unsubscribeScanResults() API */ - CMD_UNSUBSCRIBE_SCAN_RESULTS = CMD_BASE + 3, - /* Record name corresponding to getScanStats() API */ - CMD_GET_SCAN_STATS = CMD_BASE + 4, - /* Record name corresponding to a reset*/ - CMD_RESET = CMD_BASE + 5, - /* Add new commands here */ - EVENT_RECVD_BASE = 0x00002000, - /* Record name corresponding to scan monitor event*/ - EVENT_RECVD_SCAN_RESULT_ASYNC = EVENT_RECVD_BASE + 0, - /* Record name corresponding to scan response event */ - EVENT_RECVD_SCAN_RESULT = EVENT_RECVD_BASE + 1, - /* Add new events received here */ - EVENT_SENT_BASE = 0x00003000, - /* Record name corresponding to scan event sent */ - EVENT_SENT_SCAN_RESULT = EVENT_SENT_BASE + 0, - /* Record name corresponding to abort event sent */ - EVENT_SENT_ABORT = EVENT_SENT_BASE + 1, - /* Record name corresponding to error event sent */ - EVENT_SENT_ERROR = EVENT_SENT_BASE + 2, - /* Add new events sent here */ - REQ_BASE = 0x00004000, - /* Record name corresponding to scan request sent*/ - REQ_SCAN = REQ_BASE + 0, - /* Add new requests here */ -}; - -/** - * Defines the structure of each log record - */ -struct LogRecord { - /* Indicates the log recorded */ - RecordName recordName; - /* Platform reference time in milliseconds when the log is recorded */ - uint64_t logTimeMs; -}; - -/** - * Defines the scan statistics to be returned to the framework - */ -struct ScanStats { - /* Incremented everytime a new scan is requested */ - uint32_t numScansRequestedByWifi; - /* Incremented everytime the scan is serviced by performing a scan*/ - uint32_t numScansServicedByWifi; - /* Incremented everytime the scan is serviced by the scan cache */ - uint32_t numScansServicedbyCache; - /* The last (CHRE reference) time this data structure is updated */ - uint64_t lastUpdated; - /* The last (CHRE reference) time this data structure is read */ - uint64_t lastRead; - /* The total time when the Offload module could be performing scans (T2 - T1) - * T1 - time when the framework subscribes for scan result (includes delayMs) - * T2 - min (time when the framework unsubscribes for scan result, - * currentTime) */ - uint64_t subscriptionDurationMs; - /* Histograms of the channels scanned, 802.11 and with an 8 bit - * representation, only 256 channels are available */ - uint8_t[256] histogramChannelsScanned; - /* Scan Record for this subscribe duration */ - vec scanRecord; - /* Vector of the logRecord entries */ - vec logRecord; -}; - -/** - * Defines a list of return codes to indicate status of Offload HAL - */ -enum OffloadStatusCode : uint32_t { - /* No error */ - OK, - /* No Connection to underlying implementation */ - NO_CONNECTION, - /* Operation timeout */ - TIMEOUT, - /* Other errors */ - ERROR -}; - -/** - * Generic structures to return the status of an operation - */ -struct OffloadStatus { - OffloadStatusCode code; - /* Error message */ - string description; -}; - - - diff --git a/wifi/offload/1.0/vts/functional/Android.bp b/wifi/offload/1.0/vts/functional/Android.bp deleted file mode 100644 index a0eb048c66..0000000000 --- a/wifi/offload/1.0/vts/functional/Android.bp +++ /dev/null @@ -1,32 +0,0 @@ -// -// Copyright (C) 2017 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 { - // See: http://go/android-license-faq - // A large-scale-change added 'default_applicable_licenses' to import - // all of the 'license_kinds' from "hardware_interfaces_license" - // to get the below license kinds: - // SPDX-license-identifier-Apache-2.0 - default_applicable_licenses: ["hardware_interfaces_license"], -} - -cc_test { - name: "VtsHalWifiOffloadV1_0TargetTest", - defaults: ["VtsHalTargetTestDefaults"], - srcs: ["VtsHalWifiOffloadV1_0TargetTest.cpp"], - static_libs: ["android.hardware.wifi.offload@1.0"], - test_suites: ["general-tests", "vts"], -} diff --git a/wifi/offload/1.0/vts/functional/VtsHalWifiOffloadV1_0TargetTest.cpp b/wifi/offload/1.0/vts/functional/VtsHalWifiOffloadV1_0TargetTest.cpp deleted file mode 100644 index ffd5149d58..0000000000 --- a/wifi/offload/1.0/vts/functional/VtsHalWifiOffloadV1_0TargetTest.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (C) 2016 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. - */ - -#define LOG_TAG "wifi_offload_hidl_hal_test" - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include "hidl_call_util.h" - -using ::android::hardware::wifi::offload::V1_0::IOffload; -using ::android::hardware::wifi::offload::V1_0::IOffloadCallback; -using ::android::hardware::wifi::offload::V1_0::ScanResult; -using ::android::hardware::wifi::offload::V1_0::ScanParam; -using ::android::hardware::wifi::offload::V1_0::Ssid; -using ::android::hardware::wifi::offload::V1_0::NetworkInfo; -using ::android::hardware::wifi::offload::V1_0::ScanFilter; -using ::android::hardware::wifi::offload::V1_0::ScanStats; -using ::android::hardware::wifi::offload::V1_0::OffloadStatus; -using ::android::hardware::wifi::offload::V1_0::OffloadStatusCode; -using ::android::hardware::Return; -using ::android::hardware::Void; -using ::android::hardware::hidl_vec; -using ::android::sp; - -constexpr char kOffloadCallbackSendScanResult[] = "onScanResult"; -constexpr char kOffloadCallbackSendError[] = "onError"; - -namespace { -const uint8_t kSsid1[] = {'G', 'o', 'o', 'g', 'l', 'e'}; -const uint8_t kSsid2[] = {'X', 'f', 'i', 'n', 'i', 't', 'y'}; -const uint8_t kBssid[6] = {0x12, 0xef, 0xa1, 0x2c, 0x97, 0x8b}; -const int16_t kRssi = -60; -const uint32_t kFrequency = 2412; -const uint8_t kBssidSize = 6; -const uint64_t kTsf = 0; -const uint16_t kCapability = 0; -const uint8_t kNetworkFlags = 0; -const uint32_t kFrequency1 = 2412; -const uint32_t kFrequency2 = 2437; -const uint32_t kDisconnectedModeScanIntervalMs = 5000; -const int16_t kRssiThreshold = -76; -} - -class OffloadCallbackArgs { - public: - hidl_vec scan_results_; - OffloadStatus error_code_; -}; - -// The main test class for WifiOffload HIDL HAL. -class WifiOffloadHidlTest : public ::testing::TestWithParam { - public: - virtual void SetUp() override { - wifi_offload_ = IOffload::getService(GetParam()); - ASSERT_NE(wifi_offload_, nullptr); - - wifi_offload_cb_ = new OffloadCallback(); - ASSERT_NE(wifi_offload_cb_, nullptr); - } - - virtual void TearDown() override {} - - /* Callback class for Offload HAL. */ - class OffloadCallback - : public ::testing::VtsHalHidlTargetCallbackBase, - public IOffloadCallback { - public: - OffloadCallback(){}; - - virtual ~OffloadCallback() = default; - - Return onScanResult( - const hidl_vec& scan_result) override { - OffloadCallbackArgs args; - args.scan_results_ = scan_result; - NotifyFromCallback(kOffloadCallbackSendScanResult, args); - return Void(); - }; - - Return onError(const OffloadStatus& status) override { - OffloadCallbackArgs args; - args.error_code_ = status; - NotifyFromCallback(kOffloadCallbackSendError, args); - return Void(); - } - }; - - sp wifi_offload_; - sp wifi_offload_cb_; -}; - -/* - * Verify that setEventCallback method returns without errors - */ -TEST_P(WifiOffloadHidlTest, setEventCallback) { - auto returnObject = wifi_offload_->setEventCallback(wifi_offload_cb_); - ASSERT_EQ(true, returnObject.isOk()); -} - -/* - * Verify that subscribeScanResults method returns without errors - */ -TEST_P(WifiOffloadHidlTest, subscribeScanResults) { - const auto& result = HIDL_INVOKE(wifi_offload_, subscribeScanResults, 0); - ASSERT_EQ(OffloadStatusCode::OK, result.code); -} - -/* - * Verify that unsubscribeScanResults method returns without errors - */ -TEST_P(WifiOffloadHidlTest, unsubscribeScanResults) { - auto returnObject = wifi_offload_->unsubscribeScanResults(); - ASSERT_EQ(true, returnObject.isOk()); -} - -/* - * Verify that configureScans method returns without errors - */ -TEST_P(WifiOffloadHidlTest, configureScans) { - ScanParam* pScanParam = new ScanParam(); - std::vector frequencyList = {kFrequency1, kFrequency2}; - pScanParam->disconnectedModeScanIntervalMs = - kDisconnectedModeScanIntervalMs; - pScanParam->frequencyList = frequencyList; - std::vector ssidList; - std::vector> ssids{kSsid1, kSsid2}; - for (const auto& ssid : ssids) { - Ssid tmp = ssid; - ssidList.push_back(tmp); - } - pScanParam->ssidList = ssidList; - ScanFilter* pScanFilter = new ScanFilter(); - pScanFilter->rssiThreshold = kRssiThreshold; - std::vector> match_ssids{kSsid1, kSsid2}; - std::vector security_flags{kNetworkFlags, kNetworkFlags}; - std::vector preferredNetworksList; - for (size_t i = 0; i < security_flags.size(); i++) { - NetworkInfo nwInfo; - nwInfo.ssid = match_ssids[i]; - nwInfo.flags = security_flags[i]; - preferredNetworksList.push_back(nwInfo); - } - const auto& result = - HIDL_INVOKE(wifi_offload_, configureScans, *pScanParam, *pScanFilter); - ASSERT_EQ(OffloadStatusCode::OK, result.code); -} - -/* - * Verify that getScanStats returns without any errors - */ -TEST_P(WifiOffloadHidlTest, getScanStats) { - const auto& result = HIDL_INVOKE(wifi_offload_, getScanStats); - OffloadStatus status = result.first; - ASSERT_EQ(OffloadStatusCode::OK, status.code); -} - -/* - * Verify that onScanResult callback is invoked - */ -TEST_P(WifiOffloadHidlTest, getScanResults) { - wifi_offload_->setEventCallback(wifi_offload_cb_); - std::vector scan_results; - std::vector ssid(kSsid1, kSsid1 + sizeof(kSsid1)); - ScanResult scan_result; - scan_result.tsf = kTsf; - scan_result.rssi = kRssi; - scan_result.frequency = kFrequency; - scan_result.capability = kCapability; - memcpy(&scan_result.bssid[0], &kBssid[0], kBssidSize); - scan_result.networkInfo.ssid = ssid; - scan_result.networkInfo.flags = kNetworkFlags; - scan_results.push_back(scan_result); - wifi_offload_cb_->onScanResult(scan_results); - auto res = - wifi_offload_cb_->WaitForCallback(kOffloadCallbackSendScanResult); - ASSERT_EQ(true, res.no_timeout); -} - -/* - * Verify that onError callback is invoked - */ -TEST_P(WifiOffloadHidlTest, getError) { - wifi_offload_->setEventCallback(wifi_offload_cb_); - OffloadStatus status = {OffloadStatusCode::ERROR, ""}; - wifi_offload_cb_->onError(status); - auto res = wifi_offload_cb_->WaitForCallback(kOffloadCallbackSendError); - ASSERT_EQ(true, res.no_timeout); -} - -GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiOffloadHidlTest); -INSTANTIATE_TEST_SUITE_P( - PerInstance, WifiOffloadHidlTest, - testing::ValuesIn( - android::hardware::getAllHalInstanceNames(IOffload::descriptor)), - android::hardware::PrintInstanceNameToString); \ No newline at end of file diff --git a/wifi/offload/1.0/vts/functional/hidl_call_util.h b/wifi/offload/1.0/vts/functional/hidl_call_util.h deleted file mode 100644 index 99868e8b7d..0000000000 --- a/wifi/offload/1.0/vts/functional/hidl_call_util.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (C) 2017 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. - */ - -#pragma once - -#include -#include -#include -#include - -namespace { -namespace detail { -template -struct functionArgSaver; - -// Provides a std::function that takes one argument, and a buffer -// wherein the function will store its argument. The buffer has -// the same type as the argument, but with const and reference -// modifiers removed. -template -struct functionArgSaver> final { - using StorageT = typename std::remove_const< - typename std::remove_reference::type>::type; - - std::function saveArgs = [this](ArgT arg) { - this->saved_values = arg; - }; - - StorageT saved_values; -}; - -// Provides a std::function that takes two arguments, and a buffer -// wherein the function will store its arguments. The buffer is a -// std::pair, whose elements have the same types as the arguments -// (but with const and reference modifiers removed). -template -struct functionArgSaver> final { - using StorageT = - std::pair::type>::type, - typename std::remove_const< - typename std::remove_reference::type>::type>; - - std::function saveArgs = [this](Arg1T arg1, - Arg2T arg2) { - this->saved_values = {arg1, arg2}; - }; - - StorageT saved_values; -}; - -// Provides a std::function that takes three or more arguments, and a -// buffer wherein the function will store its arguments. The buffer is a -// std::tuple whose elements have the same types as the arguments (but -// with const and reference modifiers removed). -template -struct functionArgSaver> final { - using StorageT = std::tuple::type>::type...>; - - std::function saveArgs = [this](ArgT... arg) { - this->saved_values = {arg...}; - }; - - StorageT saved_values; -}; - -// Invokes |method| on |object|, providing |method| a CallbackT as the -// final argument. Returns a copy of the parameters that |method| provided -// to CallbackT. (The parameters are returned by value.) -template -typename functionArgSaver::StorageT invokeMethod( - MethodT method, ObjectT object, ArgT&&... methodArg) { - functionArgSaver result_buffer; - const auto& res = ((*object).*method)(std::forward(methodArg)..., - result_buffer.saveArgs); - EXPECT_TRUE(res.isOk()); - return result_buffer.saved_values; -} -} // namespace detail -} // namespace - -// Invokes |method| on |strong_pointer|, passing provided arguments through to -// |method|. -// -// Returns either: -// - A copy of the result callback parameter (for callbacks with a single -// parameter), OR -// - A pair containing a copy of the result callback parameters (for callbacks -// with two parameters), OR -// - A tuple containing a copy of the result callback paramters (for callbacks -// with three or more parameters). -// -// Example usage: -// EXPECT_EQ(WifiStatusCode::SUCCESS, -// HIDL_INVOKE(strong_pointer, methodReturningWifiStatus).code); -// EXPECT_EQ(WifiStatusCode::SUCCESS, -// HIDL_INVOKE(strong_pointer, methodReturningWifiStatusAndOneMore) -// .first.code); -// EXPECT_EQ(WifiStatusCode::SUCCESS, std::get<0>( -// HIDL_INVOKE(strong_pointer, methodReturningWifiStatusAndTwoMore)) -// .code); -#define HIDL_INVOKE(strong_pointer, method, ...) \ - (detail::invokeMethod< \ - std::remove_reference::type::method##_cb>( \ - &std::remove_reference::type::method, \ - strong_pointer, ##__VA_ARGS__)) From 0e0f60cff1231f8cf7e9299d251f50b3345d0047 Mon Sep 17 00:00:00 2001 From: Subrahmanyaman Date: Thu, 20 Apr 2023 22:48:39 +0000 Subject: [PATCH 965/998] Support for non-factory attestation in Strongbox. Updated the BootLoaderStateTest for strongbox implementations which do not support factory attestation. Bug: 255344624 Test: vts -m VtsAidlKeyMintTarget Change-Id: I8fe176a18fc0b9e2b2d0b012b7b63124d15c9e2f Merged-In: I8fe176a18fc0b9e2b2d0b012b7b63124d15c9e2f --- .../aidl/vts/functional/AttestKeyTest.cpp | 89 +------------------ .../vts/functional/BootloaderStateTest.cpp | 35 ++++---- .../vts/functional/KeyMintAidlTestBase.cpp | 87 +++++++++++++++++- .../aidl/vts/functional/KeyMintAidlTestBase.h | 14 +++ 4 files changed, 118 insertions(+), 107 deletions(-) diff --git a/security/keymint/aidl/vts/functional/AttestKeyTest.cpp b/security/keymint/aidl/vts/functional/AttestKeyTest.cpp index e759123334..c035f1906e 100644 --- a/security/keymint/aidl/vts/functional/AttestKeyTest.cpp +++ b/security/keymint/aidl/vts/functional/AttestKeyTest.cpp @@ -88,96 +88,9 @@ string get_imei(int slot) { class AttestKeyTest : public KeyMintAidlTestBase { public: void SetUp() override { - check_skip_test(); + skipAttestKeyTest(); KeyMintAidlTestBase::SetUp(); } - - protected: - const string FEATURE_KEYSTORE_APP_ATTEST_KEY = "android.hardware.keystore.app_attest_key"; - - const string FEATURE_STRONGBOX_KEYSTORE = "android.hardware.strongbox_keystore"; - - ErrorCode GenerateAttestKey(const AuthorizationSet& key_desc, - const optional& attest_key, - vector* key_blob, - vector* key_characteristics, - vector* cert_chain) { - // The original specification for KeyMint v1 required ATTEST_KEY not be combined - // with any other key purpose, but the original VTS tests incorrectly did exactly that. - // This means that a device that launched prior to Android T (API level 33) may - // accept or even require KeyPurpose::SIGN too. - if (property_get_int32("ro.board.first_api_level", 0) < __ANDROID_API_T__) { - AuthorizationSet key_desc_plus_sign = key_desc; - key_desc_plus_sign.push_back(TAG_PURPOSE, KeyPurpose::SIGN); - - auto result = GenerateKey(key_desc_plus_sign, attest_key, key_blob, key_characteristics, - cert_chain); - if (result == ErrorCode::OK) { - return result; - } - // If the key generation failed, it may be because the device is (correctly) - // rejecting the combination of ATTEST_KEY+SIGN. Fall through to try again with - // just ATTEST_KEY. - } - return GenerateKey(key_desc, attest_key, key_blob, key_characteristics, cert_chain); - } - - // Check if ATTEST_KEY feature is disabled - bool is_attest_key_feature_disabled(void) const { - if (!check_feature(FEATURE_KEYSTORE_APP_ATTEST_KEY)) { - GTEST_LOG_(INFO) << "Feature " + FEATURE_KEYSTORE_APP_ATTEST_KEY + " is disabled"; - return true; - } - - return false; - } - - // Check if StrongBox KeyStore is enabled - bool is_strongbox_enabled(void) const { - if (check_feature(FEATURE_STRONGBOX_KEYSTORE)) { - GTEST_LOG_(INFO) << "Feature " + FEATURE_STRONGBOX_KEYSTORE + " is enabled"; - return true; - } - - return false; - } - - // Check if chipset has received a waiver allowing it to be launched with Android S or T with - // Keymaster 4.0 in StrongBox. - bool is_chipset_allowed_km4_strongbox(void) const { - std::array buffer; - - const int32_t first_api_level = property_get_int32("ro.board.first_api_level", 0); - if (first_api_level <= 0 || first_api_level > __ANDROID_API_T__) return false; - - auto res = property_get("ro.vendor.qti.soc_model", buffer.data(), nullptr); - if (res <= 0) return false; - - const string allowed_soc_models[] = {"SM8450", "SM8475", "SM8550", "SXR2230P"}; - - for (const string model : allowed_soc_models) { - if (model.compare(buffer.data()) == 0) { - GTEST_LOG_(INFO) << "QTI SOC Model " + model + " is allowed SB KM 4.0"; - return true; - } - } - - return false; - } - - // Skip the test if all the following conditions hold: - // 1. ATTEST_KEY feature is disabled - // 2. STRONGBOX is enabled - // 3. The device is running one of the chipsets that have received a waiver - // allowing it to be launched with Android S (or later) with Keymaster 4.0 - // in StrongBox - void check_skip_test(void) const { - // Check the chipset first as that doesn't require a round-trip to Package Manager. - if (is_chipset_allowed_km4_strongbox() && is_strongbox_enabled() && - is_attest_key_feature_disabled()) { - GTEST_SKIP() << "Test is not applicable"; - } - } }; /* diff --git a/security/keymint/aidl/vts/functional/BootloaderStateTest.cpp b/security/keymint/aidl/vts/functional/BootloaderStateTest.cpp index 723edeef3d..dff0498ce5 100644 --- a/security/keymint/aidl/vts/functional/BootloaderStateTest.cpp +++ b/security/keymint/aidl/vts/functional/BootloaderStateTest.cpp @@ -34,20 +34,13 @@ using ::std::vector; // Since this test needs to talk to KeyMint HAL, it can only run as root. Thus, // bootloader can not be locked. -class BootloaderStateTest : public testing::TestWithParam { - public: - virtual void SetUp() override { - ::ndk::SpAIBinder binder(AServiceManager_waitForService(GetParam().c_str())); - keyMint_ = IKeyMintDevice::fromBinder(binder); - ASSERT_TRUE(keyMint_) << "Failed to get KM device"; - } - - std::shared_ptr keyMint_; -}; +class BootloaderStateTest : public KeyMintAidlTestBase {}; // Check that attested bootloader state is set to unlocked. TEST_P(BootloaderStateTest, IsUnlocked) { // Generate a key with attestation. + vector key_blob; + vector key_characteristics; AuthorizationSet keyDesc = AuthorizationSetBuilder() .Authorization(TAG_NO_AUTH_REQUIRED) .EcdsaSigningKey(EcCurve::P_256) @@ -55,15 +48,23 @@ TEST_P(BootloaderStateTest, IsUnlocked) { .AttestationApplicationId("bar") .Digest(Digest::NONE) .SetDefaultValidity(); - KeyCreationResult creationResult; - auto kmStatus = keyMint_->generateKey(keyDesc.vector_data(), std::nullopt, &creationResult); - ASSERT_TRUE(kmStatus.isOk()); - - vector key_cert_chain = std::move(creationResult.certificateChain); + auto result = GenerateKey(keyDesc, &key_blob, &key_characteristics); + // If factory provisioned attestation key is not supported by Strongbox, + // then create a key with self-signed attestation and use it as the + // attestation key instead. + if (SecLevel() == SecurityLevel::STRONGBOX && + result == ErrorCode::ATTESTATION_KEYS_NOT_PROVISIONED) { + result = GenerateKeyWithSelfSignedAttestKey( + AuthorizationSetBuilder() + .EcdsaKey(EcCurve::P_256) + .AttestKey() + .SetDefaultValidity(), /* attest key params */ + keyDesc, &key_blob, &key_characteristics); + } + ASSERT_EQ(ErrorCode::OK, result); // Parse attested AVB values. - const auto& attestation_cert = key_cert_chain[0].encodedCertificate; - X509_Ptr cert(parse_cert_blob(attestation_cert)); + X509_Ptr cert(parse_cert_blob(cert_chain_[0].encodedCertificate)); ASSERT_TRUE(cert.get()); ASN1_OCTET_STRING* attest_rec = get_attestation_record(cert.get()); diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp index 5e27bd0e5b..a8ea407e44 100644 --- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp +++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp @@ -322,12 +322,13 @@ ErrorCode KeyMintAidlTestBase::GenerateKeyWithSelfSignedAttestKey( const AuthorizationSet& attest_key_desc, const AuthorizationSet& key_desc, vector* key_blob, vector* key_characteristics, vector* cert_chain) { + skipAttestKeyTest(); AttestationKey attest_key; vector attest_cert_chain; vector attest_key_characteristics; // Generate a key with self signed attestation. - auto error = GenerateKey(attest_key_desc, std::nullopt, &attest_key.keyBlob, - &attest_key_characteristics, &attest_cert_chain); + auto error = GenerateAttestKey(attest_key_desc, std::nullopt, &attest_key.keyBlob, + &attest_key_characteristics, &attest_cert_chain); if (error != ErrorCode::OK) { return error; } @@ -1548,6 +1549,88 @@ ErrorCode KeyMintAidlTestBase::UseEcdsaKey(const vector& ecdsaKeyBlob) return result; } +ErrorCode KeyMintAidlTestBase::GenerateAttestKey(const AuthorizationSet& key_desc, + const optional& attest_key, + vector* key_blob, + vector* key_characteristics, + vector* cert_chain) { + // The original specification for KeyMint v1 required ATTEST_KEY not be combined + // with any other key purpose, but the original VTS tests incorrectly did exactly that. + // This means that a device that launched prior to Android T (API level 33) may + // accept or even require KeyPurpose::SIGN too. + if (property_get_int32("ro.board.first_api_level", 0) < __ANDROID_API_T__) { + AuthorizationSet key_desc_plus_sign = key_desc; + key_desc_plus_sign.push_back(TAG_PURPOSE, KeyPurpose::SIGN); + + auto result = GenerateKey(key_desc_plus_sign, attest_key, key_blob, key_characteristics, + cert_chain); + if (result == ErrorCode::OK) { + return result; + } + // If the key generation failed, it may be because the device is (correctly) + // rejecting the combination of ATTEST_KEY+SIGN. Fall through to try again with + // just ATTEST_KEY. + } + return GenerateKey(key_desc, attest_key, key_blob, key_characteristics, cert_chain); +} + +// Check if ATTEST_KEY feature is disabled +bool KeyMintAidlTestBase::is_attest_key_feature_disabled(void) const { + if (!check_feature(FEATURE_KEYSTORE_APP_ATTEST_KEY)) { + GTEST_LOG_(INFO) << "Feature " + FEATURE_KEYSTORE_APP_ATTEST_KEY + " is disabled"; + return true; + } + + return false; +} + +// Check if StrongBox KeyStore is enabled +bool KeyMintAidlTestBase::is_strongbox_enabled(void) const { + if (check_feature(FEATURE_STRONGBOX_KEYSTORE)) { + GTEST_LOG_(INFO) << "Feature " + FEATURE_STRONGBOX_KEYSTORE + " is enabled"; + return true; + } + + return false; +} + +// Check if chipset has received a waiver allowing it to be launched with Android S or T with +// Keymaster 4.0 in StrongBox. +bool KeyMintAidlTestBase::is_chipset_allowed_km4_strongbox(void) const { + std::array buffer; + + const int32_t first_api_level = property_get_int32("ro.board.first_api_level", 0); + if (first_api_level <= 0 || first_api_level > __ANDROID_API_T__) return false; + + auto res = property_get("ro.vendor.qti.soc_model", buffer.data(), nullptr); + if (res <= 0) return false; + + const string allowed_soc_models[] = {"SM8450", "SM8475", "SM8550", "SXR2230P"}; + + for (const string model : allowed_soc_models) { + if (model.compare(buffer.data()) == 0) { + GTEST_LOG_(INFO) << "QTI SOC Model " + model + " is allowed SB KM 4.0"; + return true; + } + } + + return false; +} + +// Skip the test if all the following conditions hold: +// 1. ATTEST_KEY feature is disabled +// 2. STRONGBOX is enabled +// 3. The device is running one of the chipsets that have received a waiver +// allowing it to be launched with Android S (or later) with Keymaster 4.0 +// in StrongBox +void KeyMintAidlTestBase::skipAttestKeyTest(void) const { + // Check the chipset first as that doesn't require a round-trip to Package Manager. + if (is_chipset_allowed_km4_strongbox() && is_strongbox_enabled() && + is_attest_key_feature_disabled()) { + GTEST_SKIP() << "Test is not applicable"; + } +} + void verify_serial(X509* cert, const uint64_t expected_serial) { BIGNUM_Ptr ser(BN_new()); EXPECT_TRUE(ASN1_INTEGER_to_BN(X509_get_serialNumber(cert), ser.get())); diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h index 3245ca98f2..30ac452bab 100644 --- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h +++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h @@ -54,6 +54,9 @@ using ::std::vector; constexpr uint64_t kOpHandleSentinel = 0xFFFFFFFFFFFFFFFF; +const string FEATURE_KEYSTORE_APP_ATTEST_KEY = "android.hardware.keystore.app_attest_key"; +const string FEATURE_STRONGBOX_KEYSTORE = "android.hardware.strongbox_keystore"; + class KeyMintAidlTestBase : public ::testing::TestWithParam { public: struct KeyData { @@ -347,6 +350,17 @@ class KeyMintAidlTestBase : public ::testing::TestWithParam { ErrorCode UseRsaKey(const vector& rsaKeyBlob); ErrorCode UseEcdsaKey(const vector& ecdsaKeyBlob); + ErrorCode GenerateAttestKey(const AuthorizationSet& key_desc, + const optional& attest_key, + vector* key_blob, + vector* key_characteristics, + vector* cert_chain); + + bool is_attest_key_feature_disabled(void) const; + bool is_strongbox_enabled(void) const; + bool is_chipset_allowed_km4_strongbox(void) const; + void skipAttestKeyTest(void) const; + protected: std::shared_ptr keymint_; uint32_t os_version_; From dbb1c89347158dd6d3b573e4c157f1a260e43be7 Mon Sep 17 00:00:00 2001 From: Tri Vo Date: Tue, 2 May 2023 14:36:31 -0700 Subject: [PATCH 966/998] Test cases for attested Root-of-Trust Add tests for verfied boot state and VBMeta digest. Bug: 255344624 Test: VtsKeyMintAidlTargetTest Change-Id: I4f0697e1a7cb83ca87150b6683cac3084a593864 Merged-In: I4f0697e1a7cb83ca87150b6683cac3084a593864 --- .../keymint/aidl/vts/functional/Android.bp | 3 + .../vts/functional/BootloaderStateTest.cpp | 148 +++++++++++++----- 2 files changed, 113 insertions(+), 38 deletions(-) diff --git a/security/keymint/aidl/vts/functional/Android.bp b/security/keymint/aidl/vts/functional/Android.bp index 7a4359d31a..41b161d11d 100644 --- a/security/keymint/aidl/vts/functional/Android.bp +++ b/security/keymint/aidl/vts/functional/Android.bp @@ -43,8 +43,11 @@ cc_defaults { "android.hardware.gatekeeper-V1-ndk", "android.hardware.security.rkp-V3-ndk", "android.hardware.security.secureclock-V1-ndk", + "libavb_user", + "libavb", "libcppbor_external", "libcppcose_rkp", + "libfs_mgr", "libjsoncpp", "libkeymint", "libkeymint_remote_prov_support", diff --git a/security/keymint/aidl/vts/functional/BootloaderStateTest.cpp b/security/keymint/aidl/vts/functional/BootloaderStateTest.cpp index dff0498ce5..54f187c611 100644 --- a/security/keymint/aidl/vts/functional/BootloaderStateTest.cpp +++ b/security/keymint/aidl/vts/functional/BootloaderStateTest.cpp @@ -21,7 +21,11 @@ #include #include +#include #include +#include +#include +#include #include #include "KeyMintAidlTestBase.h" @@ -34,50 +38,118 @@ using ::std::vector; // Since this test needs to talk to KeyMint HAL, it can only run as root. Thus, // bootloader can not be locked. -class BootloaderStateTest : public KeyMintAidlTestBase {}; +class BootloaderStateTest : public KeyMintAidlTestBase { + public: + virtual void SetUp() override { + KeyMintAidlTestBase::SetUp(); + + // Generate a key with attestation. + vector key_blob; + vector key_characteristics; + AuthorizationSet keyDesc = AuthorizationSetBuilder() + .Authorization(TAG_NO_AUTH_REQUIRED) + .EcdsaSigningKey(EcCurve::P_256) + .AttestationChallenge("foo") + .AttestationApplicationId("bar") + .Digest(Digest::NONE) + .SetDefaultValidity(); + auto result = GenerateKey(keyDesc, &key_blob, &key_characteristics); + // If factory provisioned attestation key is not supported by Strongbox, + // then create a key with self-signed attestation and use it as the + // attestation key instead. + if (SecLevel() == SecurityLevel::STRONGBOX && + result == ErrorCode::ATTESTATION_KEYS_NOT_PROVISIONED) { + result = GenerateKeyWithSelfSignedAttestKey( + AuthorizationSetBuilder() + .EcdsaKey(EcCurve::P_256) + .AttestKey() + .SetDefaultValidity(), /* attest key params */ + keyDesc, &key_blob, &key_characteristics); + } + ASSERT_EQ(ErrorCode::OK, result); + + // Parse attested AVB values. + X509_Ptr cert(parse_cert_blob(cert_chain_[0].encodedCertificate)); + ASSERT_TRUE(cert.get()); + + ASN1_OCTET_STRING* attest_rec = get_attestation_record(cert.get()); + ASSERT_TRUE(attest_rec); + + auto error = parse_root_of_trust(attest_rec->data, attest_rec->length, &attestedVbKey_, + &attestedVbState_, &attestedBootloaderState_, + &attestedVbmetaDigest_); + ASSERT_EQ(error, ErrorCode::OK); + } + + vector attestedVbKey_; + VerifiedBoot attestedVbState_; + bool attestedBootloaderState_; + vector attestedVbmetaDigest_; +}; // Check that attested bootloader state is set to unlocked. -TEST_P(BootloaderStateTest, IsUnlocked) { - // Generate a key with attestation. - vector key_blob; - vector key_characteristics; - AuthorizationSet keyDesc = AuthorizationSetBuilder() - .Authorization(TAG_NO_AUTH_REQUIRED) - .EcdsaSigningKey(EcCurve::P_256) - .AttestationChallenge("foo") - .AttestationApplicationId("bar") - .Digest(Digest::NONE) - .SetDefaultValidity(); - auto result = GenerateKey(keyDesc, &key_blob, &key_characteristics); - // If factory provisioned attestation key is not supported by Strongbox, - // then create a key with self-signed attestation and use it as the - // attestation key instead. - if (SecLevel() == SecurityLevel::STRONGBOX && - result == ErrorCode::ATTESTATION_KEYS_NOT_PROVISIONED) { - result = GenerateKeyWithSelfSignedAttestKey( - AuthorizationSetBuilder() - .EcdsaKey(EcCurve::P_256) - .AttestKey() - .SetDefaultValidity(), /* attest key params */ - keyDesc, &key_blob, &key_characteristics); +TEST_P(BootloaderStateTest, BootloaderIsUnlocked) { + ASSERT_FALSE(attestedBootloaderState_) + << "This test runs as root. Bootloader must be unlocked."; +} + +// Check that verified boot state is set to "unverified", i.e. "orange". +TEST_P(BootloaderStateTest, VbStateIsUnverified) { + // Unlocked bootloader implies that verified boot state must be "unverified". + ASSERT_EQ(attestedVbState_, VerifiedBoot::UNVERIFIED) + << "Verified boot state must be \"UNVERIFIED\" aka \"orange\"."; + + // AVB spec stipulates that bootloader must set "androidboot.verifiedbootstate" parameter + // on the kernel command-line. This parameter is exposed to userspace as + // "ro.boot.verifiedbootstate" property. + auto vbStateProp = ::android::base::GetProperty("ro.boot.verifiedbootstate", ""); + ASSERT_EQ(vbStateProp, "orange") + << "Verified boot state must be \"UNVERIFIED\" aka \"orange\"."; +} + +// Following error codes from avb_slot_data() mean that slot data was loaded +// (even if verification failed). +static inline bool avb_slot_data_loaded(AvbSlotVerifyResult result) { + switch (result) { + case AVB_SLOT_VERIFY_RESULT_OK: + case AVB_SLOT_VERIFY_RESULT_ERROR_VERIFICATION: + case AVB_SLOT_VERIFY_RESULT_ERROR_ROLLBACK_INDEX: + case AVB_SLOT_VERIFY_RESULT_ERROR_PUBLIC_KEY_REJECTED: + return true; + default: + return false; } - ASSERT_EQ(ErrorCode::OK, result); +} - // Parse attested AVB values. - X509_Ptr cert(parse_cert_blob(cert_chain_[0].encodedCertificate)); - ASSERT_TRUE(cert.get()); +// Check that attested vbmeta digest is correct. +TEST_P(BootloaderStateTest, VbmetaDigest) { + AvbSlotVerifyData* avbSlotData; + auto suffix = fs_mgr_get_slot_suffix(); + const char* partitions[] = {nullptr}; + auto avbOps = avb_ops_user_new(); - ASN1_OCTET_STRING* attest_rec = get_attestation_record(cert.get()); - ASSERT_TRUE(attest_rec); + // For VTS, devices run with vendor_boot-debug.img, which is not release key + // signed. Use AVB_SLOT_VERIFY_FLAGS_ALLOW_VERIFICATION_ERROR to bypass avb + // verification errors. This is OK since we only care about the digest for + // this test case. + auto result = avb_slot_verify(avbOps, partitions, suffix.c_str(), + AVB_SLOT_VERIFY_FLAGS_ALLOW_VERIFICATION_ERROR, + AVB_HASHTREE_ERROR_MODE_EIO, &avbSlotData); + ASSERT_TRUE(avb_slot_data_loaded(result)) << "Failed to load avb slot data"; - vector key; - VerifiedBoot attestedVbState; - bool attestedBootloaderState; - vector attestedVbmetaDigest; - auto error = parse_root_of_trust(attest_rec->data, attest_rec->length, &key, &attestedVbState, - &attestedBootloaderState, &attestedVbmetaDigest); - ASSERT_EQ(error, ErrorCode::OK); - ASSERT_FALSE(attestedBootloaderState) << "This test runs as root. Bootloader must be unlocked."; + // Unfortunately, bootloader is not required to report the algorithm used + // to calculate the digest. There are only two supported options though, + // SHA256 and SHA512. Attested VBMeta digest must match one of these. + vector digest256(AVB_SHA256_DIGEST_SIZE); + vector digest512(AVB_SHA512_DIGEST_SIZE); + + avb_slot_verify_data_calculate_vbmeta_digest(avbSlotData, AVB_DIGEST_TYPE_SHA256, + digest256.data()); + avb_slot_verify_data_calculate_vbmeta_digest(avbSlotData, AVB_DIGEST_TYPE_SHA512, + digest512.data()); + + ASSERT_TRUE((attestedVbmetaDigest_ == digest256) || (attestedVbmetaDigest_ == digest512)) + << "Attested digest does not match computed digest."; } INSTANTIATE_KEYMINT_AIDL_TEST(BootloaderStateTest); From f3ce0a9de03bc2474aa31d722619c725c7208dd5 Mon Sep 17 00:00:00 2001 From: Tri Vo Date: Mon, 8 May 2023 13:23:08 -0400 Subject: [PATCH 967/998] KM 4 tests for Root-of-Trust Add tests for device locked state, verfied boot state and VBMeta digest. Bug: 255344624 Test: VtsHalKeymasterV4_0TargetTest against default impl of KM 4 Change-Id: I46e62ab9031d3745f99bd214f9e579e80edc9128 Merged-In: I46e62ab9031d3745f99bd214f9e579e80edc9128 --- keymaster/4.0/vts/functional/Android.bp | 5 + .../vts/functional/BootloaderStateTest.cpp | 146 ++++++++++++++++++ .../4.0/vts/functional/KeymasterHidlTest.cpp | 24 +++ .../4.0/vts/functional/KeymasterHidlTest.h | 7 + .../functional/keymaster_hidl_hal_test.cpp | 26 ---- 5 files changed, 182 insertions(+), 26 deletions(-) create mode 100644 keymaster/4.0/vts/functional/BootloaderStateTest.cpp diff --git a/keymaster/4.0/vts/functional/Android.bp b/keymaster/4.0/vts/functional/Android.bp index f9a02baa56..e1dfcfc3d1 100644 --- a/keymaster/4.0/vts/functional/Android.bp +++ b/keymaster/4.0/vts/functional/Android.bp @@ -30,13 +30,17 @@ cc_test { "keymaster_hidl_hal_test.cpp", ], srcs: [ + "BootloaderStateTest.cpp", "HmacKeySharingTest.cpp", "VerificationTokenTest.cpp", "keymaster_hidl_hal_test.cpp", ], static_libs: [ "android.hardware.keymaster@4.0", + "libavb_user", + "libavb", "libcrypto_static", + "libfs_mgr", "libkeymaster4support", "libkeymaster4vtstest", ], @@ -64,6 +68,7 @@ cc_test_library { ], static_libs: [ "android.hardware.keymaster@4.0", + "libcrypto_static", "libkeymaster4support", ], } diff --git a/keymaster/4.0/vts/functional/BootloaderStateTest.cpp b/keymaster/4.0/vts/functional/BootloaderStateTest.cpp new file mode 100644 index 0000000000..6b5e8bf856 --- /dev/null +++ b/keymaster/4.0/vts/functional/BootloaderStateTest.cpp @@ -0,0 +1,146 @@ +/* + * 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. + */ + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "KeymasterHidlTest.h" + +namespace android::hardware::keymaster::V4_0::test { + +using ::std::string; +using ::std::vector; + +// Since this test needs to talk to Keymaster HAL, it can only run as root. Thus, +// bootloader can not be locked. +class BootloaderStateTest : public KeymasterHidlTest { + public: + virtual void SetUp() override { + KeymasterHidlTest::SetUp(); + + // Generate a key. + auto ec = GenerateKey(AuthorizationSetBuilder() + .Authorization(TAG_NO_AUTH_REQUIRED) + .EcdsaSigningKey(EcCurve::P_256) + .Digest(Digest::SHA_2_256)); + ASSERT_EQ(ec, ErrorCode::OK) << "Failed to generate key."; + + // Generate attestation. + hidl_vec> cert_chain; + ec = AttestKey(AuthorizationSetBuilder() + .Authorization(TAG_ATTESTATION_CHALLENGE, HidlBuf("challenge")) + .Authorization(TAG_ATTESTATION_APPLICATION_ID, HidlBuf("foo")), + &cert_chain); + ASSERT_EQ(ec, ErrorCode::OK) << "Failed to generate attestation."; + + X509_Ptr cert(parse_cert_blob(cert_chain[0])); + ASSERT_TRUE(cert.get()) << "Failed to parse certificate blob."; + + ASN1_OCTET_STRING* attest_rec = get_attestation_record(cert.get()); + ASSERT_TRUE(attest_rec) << "Failed to get attestation record."; + + // Parse root of trust. + HidlBuf verified_boot_key; + keymaster_verified_boot_t verified_boot_state; + bool device_locked; + HidlBuf verified_boot_hash; + auto result = + parse_root_of_trust(attest_rec->data, attest_rec->length, &verified_boot_key, + &verified_boot_state, &device_locked, &verified_boot_hash); + ASSERT_EQ(result, ErrorCode::OK) << "Failed to parse root of trust."; + } + + hidl_vec attestedVbKey_; + keymaster_verified_boot_t attestedVbState_; + bool attestedBootloaderState_; + hidl_vec attestedVbmetaDigest_; +}; + +// Check that attested bootloader state is set to unlocked. +TEST_P(BootloaderStateTest, BootloaderIsUnlocked) { + ASSERT_FALSE(attestedBootloaderState_) + << "This test runs as root. Bootloader must be unlocked."; +} + +// Check that verified boot state is set to "unverified", i.e. "orange". +TEST_P(BootloaderStateTest, VbStateIsUnverified) { + // Unlocked bootloader implies that verified boot state must be "unverified". + ASSERT_EQ(attestedVbState_, KM_VERIFIED_BOOT_UNVERIFIED) + << "Verified boot state must be \"UNVERIFIED\" aka \"orange\"."; + + // AVB spec stipulates that bootloader must set "androidboot.verifiedbootstate" parameter + // on the kernel command-line. This parameter is exposed to userspace as + // "ro.boot.verifiedbootstate" property. + auto vbStateProp = ::android::base::GetProperty("ro.boot.verifiedbootstate", ""); + ASSERT_EQ(vbStateProp, "orange") + << "Verified boot state must be \"UNVERIFIED\" aka \"orange\"."; +} + +// Following error codes from avb_slot_data() mean that slot data was loaded +// (even if verification failed). +static inline bool avb_slot_data_loaded(AvbSlotVerifyResult result) { + switch (result) { + case AVB_SLOT_VERIFY_RESULT_OK: + case AVB_SLOT_VERIFY_RESULT_ERROR_VERIFICATION: + case AVB_SLOT_VERIFY_RESULT_ERROR_ROLLBACK_INDEX: + case AVB_SLOT_VERIFY_RESULT_ERROR_PUBLIC_KEY_REJECTED: + return true; + default: + return false; + } +} + +// Check that attested vbmeta digest is correct. +TEST_P(BootloaderStateTest, VbmetaDigest) { + AvbSlotVerifyData* avbSlotData; + auto suffix = fs_mgr_get_slot_suffix(); + const char* partitions[] = {nullptr}; + auto avbOps = avb_ops_user_new(); + + // For VTS, devices run with vendor_boot-debug.img, which is not release key + // signed. Use AVB_SLOT_VERIFY_FLAGS_ALLOW_VERIFICATION_ERROR to bypass avb + // verification errors. This is OK since we only care about the digest for + // this test case. + auto result = avb_slot_verify(avbOps, partitions, suffix.c_str(), + AVB_SLOT_VERIFY_FLAGS_ALLOW_VERIFICATION_ERROR, + AVB_HASHTREE_ERROR_MODE_EIO, &avbSlotData); + ASSERT_TRUE(avb_slot_data_loaded(result)) << "Failed to load avb slot data"; + + // Unfortunately, bootloader is not required to report the algorithm used + // to calculate the digest. There are only two supported options though, + // SHA256 and SHA512. Attested VBMeta digest must match one of these. + vector digest256(AVB_SHA256_DIGEST_SIZE); + vector digest512(AVB_SHA512_DIGEST_SIZE); + + avb_slot_verify_data_calculate_vbmeta_digest(avbSlotData, AVB_DIGEST_TYPE_SHA256, + digest256.data()); + avb_slot_verify_data_calculate_vbmeta_digest(avbSlotData, AVB_DIGEST_TYPE_SHA512, + digest512.data()); + + ASSERT_TRUE((attestedVbmetaDigest_ == digest256) || (attestedVbmetaDigest_ == digest512)) + << "Attested digest does not match computed digest."; +} + +INSTANTIATE_KEYMASTER_HIDL_TEST(BootloaderStateTest); + +} // namespace android::hardware::keymaster::V4_0::test diff --git a/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp b/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp index 315a4bd08a..e2ad0ef2c5 100644 --- a/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp +++ b/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp @@ -841,6 +841,30 @@ std::vector KeymasterHidlTest::InvalidDigests() { return {}; } +X509* parse_cert_blob(const hidl_vec& blob) { + const uint8_t* p = blob.data(); + return d2i_X509(nullptr, &p, blob.size()); +} + +ASN1_OCTET_STRING* get_attestation_record(X509* certificate) { + ASN1_OBJECT_Ptr oid(OBJ_txt2obj(kAttestionRecordOid, 1 /* dotted string format */)); + EXPECT_TRUE(!!oid.get()); + if (!oid.get()) return nullptr; + + int location = X509_get_ext_by_OBJ(certificate, oid.get(), -1 /* search from beginning */); + EXPECT_NE(-1, location) << "Attestation extension not found in certificate"; + if (location == -1) return nullptr; + + X509_EXTENSION* attest_rec_ext = X509_get_ext(certificate, location); + EXPECT_TRUE(!!attest_rec_ext) + << "Found attestation extension but couldn't retrieve it? Probably a BoringSSL bug."; + if (!attest_rec_ext) return nullptr; + + ASN1_OCTET_STRING* attest_rec = X509_EXTENSION_get_data(attest_rec_ext); + EXPECT_TRUE(!!attest_rec) << "Attestation extension contained no data"; + return attest_rec; +} + } // namespace test } // namespace V4_0 } // namespace keymaster diff --git a/keymaster/4.0/vts/functional/KeymasterHidlTest.h b/keymaster/4.0/vts/functional/KeymasterHidlTest.h index ad30aa7792..67829ec93a 100644 --- a/keymaster/4.0/vts/functional/KeymasterHidlTest.h +++ b/keymaster/4.0/vts/functional/KeymasterHidlTest.h @@ -22,7 +22,9 @@ #include #include +#include #include +#include namespace android { namespace hardware { @@ -241,6 +243,11 @@ class KeymasterHidlTest : public ::testing::TestWithParam { testing::ValuesIn(KeymasterHidlTest::build_params()), \ android::hardware::PrintInstanceNameToString) +X509* parse_cert_blob(const hidl_vec& blob); +// Extract attestation record from cert. Returned object is still part of cert; don't free it +// separately. +ASN1_OCTET_STRING* get_attestation_record(X509* certificate); + } // namespace test } // namespace V4_0 } // namespace keymaster diff --git a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp index 728cc91f41..b7099047fe 100644 --- a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp +++ b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp @@ -263,11 +263,6 @@ struct RSA_Delete { void operator()(RSA* p) { RSA_free(p); } }; -X509* parse_cert_blob(const hidl_vec& blob) { - const uint8_t* p = blob.data(); - return d2i_X509(nullptr, &p, blob.size()); -} - bool verify_chain(const hidl_vec>& chain, const std::string& msg, const std::string& signature) { { @@ -337,27 +332,6 @@ bool verify_chain(const hidl_vec>& chain, const std::string& m return true; } -// Extract attestation record from cert. Returned object is still part of cert; don't free it -// separately. -ASN1_OCTET_STRING* get_attestation_record(X509* certificate) { - ASN1_OBJECT_Ptr oid(OBJ_txt2obj(kAttestionRecordOid, 1 /* dotted string format */)); - EXPECT_TRUE(!!oid.get()); - if (!oid.get()) return nullptr; - - int location = X509_get_ext_by_OBJ(certificate, oid.get(), -1 /* search from beginning */); - EXPECT_NE(-1, location) << "Attestation extension not found in certificate"; - if (location == -1) return nullptr; - - X509_EXTENSION* attest_rec_ext = X509_get_ext(certificate, location); - EXPECT_TRUE(!!attest_rec_ext) - << "Found attestation extension but couldn't retrieve it? Probably a BoringSSL bug."; - if (!attest_rec_ext) return nullptr; - - ASN1_OCTET_STRING* attest_rec = X509_EXTENSION_get_data(attest_rec_ext); - EXPECT_TRUE(!!attest_rec) << "Attestation extension contained no data"; - return attest_rec; -} - bool tag_in_list(const KeyParameter& entry) { // Attestations don't contain everything in key authorization lists, so we need to filter // the key lists to produce the lists that we expect to match the attestations. From 4b518cc3e7259c72c3ae868b3fdb6ac7c379726e Mon Sep 17 00:00:00 2001 From: Treehugger Robot Date: Fri, 12 May 2023 02:44:22 +0000 Subject: [PATCH 968/998] VTS: Reduce TV's advertising set requirement to 10 Bug: 281798597 Test: atest VtsHalBluetoothVTargetTest Change-Id: Ia3be5a1c7a7acc5270baef74b295291c32851987 --- .../aidl/vts/VtsHalBluetoothTargetTest.cpp | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp b/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp index 529e092dc7..7acd7ebd3b 100644 --- a/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp +++ b/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp @@ -14,12 +14,14 @@ * limitations under the License. */ +#include #include #include #include #include #include #include +#include #include #include #include @@ -67,6 +69,7 @@ using ::bluetooth::hci::ReadLocalVersionInformationBuilder; using ::bluetooth::hci::ReadLocalVersionInformationCompleteView; static constexpr uint8_t kMinLeAdvSetForBt5 = 16; +static constexpr uint8_t kMinLeAdvSetForBt5FoTv = 10; static constexpr uint8_t kMinLeResolvingListForBt5 = 8; static constexpr size_t kNumHciCommandsBandwidth = 100; @@ -81,6 +84,40 @@ static constexpr std::chrono::milliseconds kInterfaceCloseDelayMs(200); // To discard Qualcomm ACL debugging static constexpr uint16_t kAclHandleQcaDebugMessage = 0xedc; +static int get_vsr_api_level() { + int vendor_api_level = + ::android::base::GetIntProperty("ro.vendor.api_level", -1); + if (vendor_api_level != -1) { + return vendor_api_level; + } + + // Android S and older devices do not define ro.vendor.api_level + vendor_api_level = ::android::base::GetIntProperty("ro.board.api_level", -1); + if (vendor_api_level == -1) { + vendor_api_level = + ::android::base::GetIntProperty("ro.board.first_api_level", -1); + } + + int product_api_level = + ::android::base::GetIntProperty("ro.product.first_api_level", -1); + if (product_api_level == -1) { + product_api_level = + ::android::base::GetIntProperty("ro.build.version.sdk", -1); + EXPECT_NE(product_api_level, -1) << "Could not find ro.build.version.sdk"; + } + + // VSR API level is the minimum of vendor_api_level and product_api_level. + if (vendor_api_level == -1 || vendor_api_level > product_api_level) { + return product_api_level; + } + return vendor_api_level; +} + +static bool isTv() { + return testing::deviceSupportsFeature("android.software.leanback") || + testing::deviceSupportsFeature("android.hardware.type.television"); +} + class ThroughputLogger { public: explicit ThroughputLogger(std::string task) @@ -959,7 +996,12 @@ TEST_P(BluetoothAidlTest, Cdd_C_12_1_Bluetooth5Requirements) { ASSERT_TRUE(num_adv_set_view.IsValid()); ASSERT_EQ(::bluetooth::hci::ErrorCode::SUCCESS, num_adv_set_view.GetStatus()); auto num_adv_set = num_adv_set_view.GetNumberSupportedAdvertisingSets(); - ASSERT_GE(num_adv_set, kMinLeAdvSetForBt5); + + if (isTv() && get_vsr_api_level() == __ANDROID_API_U__) { + ASSERT_GE(num_adv_set, kMinLeAdvSetForBt5FoTv); + } else { + ASSERT_GE(num_adv_set, kMinLeAdvSetForBt5); + } std::vector num_resolving_list_event; send_and_wait_for_cmd_complete(LeReadResolvingListSizeBuilder::Create(), From 89ec63ed09f2e87fab1a4b585f5e6a2418f1fab3 Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Mon, 8 May 2023 21:16:13 +0000 Subject: [PATCH 969/998] Implement AIDL effect IFacotry::queryProcessing Bug: 281572768 Test: atest --test-mapping hardware/interfaces/audio/aidl/vts:presubmit Change-Id: I0166786d531437ef52690b92067766879b043a1d --- audio/aidl/default/EffectConfig.cpp | 100 +++++++++++++++--- audio/aidl/default/EffectFactory.cpp | 49 +++++++-- audio/aidl/default/audio_effects_config.xml | 9 ++ .../include/effectFactory-impl/EffectConfig.h | 24 +++-- .../effectFactory-impl/EffectFactory.h | 4 + .../VtsHalAudioEffectFactoryTargetTest.cpp | 8 ++ 6 files changed, 155 insertions(+), 39 deletions(-) diff --git a/audio/aidl/default/EffectConfig.cpp b/audio/aidl/default/EffectConfig.cpp index 5a83fef99a..71d111bd06 100644 --- a/audio/aidl/default/EffectConfig.cpp +++ b/audio/aidl/default/EffectConfig.cpp @@ -14,12 +14,17 @@ * limitations under the License. */ +#include +#include #define LOG_TAG "AHAL_EffectConfig" #include +#include #include #include "effectFactory-impl/EffectConfig.h" +using aidl::android::media::audio::common::AudioSource; +using aidl::android::media::audio::common::AudioStreamType; using aidl::android::media::audio::common::AudioUuid; namespace aidl::android::hardware::audio::effect { @@ -55,14 +60,16 @@ EffectConfig::EffectConfig(const std::string& file) { // Parse pre processing chains for (auto& xmlPreprocess : getChildren(xmlConfig, "preprocess")) { for (auto& xmlStream : getChildren(xmlPreprocess, "stream")) { - registerFailure(parseStream(xmlStream)); + // AudioSource + registerFailure(parseProcessing(Processing::Type::source, xmlStream)); } } // Parse post processing chains for (auto& xmlPostprocess : getChildren(xmlConfig, "postprocess")) { for (auto& xmlStream : getChildren(xmlPostprocess, "stream")) { - registerFailure(parseStream(xmlStream)); + // AudioStreamType + registerFailure(parseProcessing(Processing::Type::streamType, xmlStream)); } } } @@ -140,21 +147,6 @@ bool EffectConfig::parseEffect(const tinyxml2::XMLElement& xml) { return true; } -bool EffectConfig::parseStream(const tinyxml2::XMLElement& xml) { - LOG(DEBUG) << __func__ << dump(xml); - const char* type = xml.Attribute("type"); - RETURN_VALUE_IF(!type, false, "noTypeInProcess"); - RETURN_VALUE_IF(0 != mProcessingMap.count(type), false, "duplicateType"); - - for (auto& apply : getChildren(xml, "apply")) { - const char* name = apply.get().Attribute("effect"); - RETURN_VALUE_IF(!name, false, "noEffectAttribute"); - mProcessingMap[type].push_back(name); - LOG(DEBUG) << __func__ << " " << type << " : " << name; - } - return true; -} - bool EffectConfig::parseLibraryUuid(const tinyxml2::XMLElement& xml, struct LibraryUuid& libraryUuid, bool isProxy) { // Retrieve library name only if not effectProxy element @@ -174,6 +166,80 @@ bool EffectConfig::parseLibraryUuid(const tinyxml2::XMLElement& xml, return true; } +std::optional EffectConfig::stringToProcessingType(Processing::Type::Tag typeTag, + const std::string& type) { + // see list of audio stream types in audio_stream_type_t: + // system/media/audio/include/system/audio_effects/audio_effects_conf.h + // AUDIO_STREAM_DEFAULT_TAG is not listed here because according to SYS_RESERVED_DEFAULT in + // AudioStreamType.aidl: "Value reserved for system use only. HALs must never return this value + // to the system or accept it from the system". + static const std::map sAudioStreamTypeTable = { + {AUDIO_STREAM_VOICE_CALL_TAG, AudioStreamType::VOICE_CALL}, + {AUDIO_STREAM_SYSTEM_TAG, AudioStreamType::SYSTEM}, + {AUDIO_STREAM_RING_TAG, AudioStreamType::RING}, + {AUDIO_STREAM_MUSIC_TAG, AudioStreamType::MUSIC}, + {AUDIO_STREAM_ALARM_TAG, AudioStreamType::ALARM}, + {AUDIO_STREAM_NOTIFICATION_TAG, AudioStreamType::NOTIFICATION}, + {AUDIO_STREAM_BLUETOOTH_SCO_TAG, AudioStreamType::BLUETOOTH_SCO}, + {AUDIO_STREAM_ENFORCED_AUDIBLE_TAG, AudioStreamType::ENFORCED_AUDIBLE}, + {AUDIO_STREAM_DTMF_TAG, AudioStreamType::DTMF}, + {AUDIO_STREAM_TTS_TAG, AudioStreamType::TTS}, + {AUDIO_STREAM_ASSISTANT_TAG, AudioStreamType::ASSISTANT}}; + + // see list of audio sources in audio_source_t: + // system/media/audio/include/system/audio_effects/audio_effects_conf.h + static const std::map sAudioSourceTable = { + {MIC_SRC_TAG, AudioSource::VOICE_CALL}, + {VOICE_UL_SRC_TAG, AudioSource::VOICE_CALL}, + {VOICE_DL_SRC_TAG, AudioSource::VOICE_CALL}, + {VOICE_CALL_SRC_TAG, AudioSource::VOICE_CALL}, + {CAMCORDER_SRC_TAG, AudioSource::VOICE_CALL}, + {VOICE_REC_SRC_TAG, AudioSource::VOICE_CALL}, + {VOICE_COMM_SRC_TAG, AudioSource::VOICE_CALL}, + {REMOTE_SUBMIX_SRC_TAG, AudioSource::VOICE_CALL}, + {UNPROCESSED_SRC_TAG, AudioSource::VOICE_CALL}, + {VOICE_PERFORMANCE_SRC_TAG, AudioSource::VOICE_CALL}}; + + if (typeTag == Processing::Type::streamType) { + auto typeIter = sAudioStreamTypeTable.find(type); + if (typeIter != sAudioStreamTypeTable.end()) { + return typeIter->second; + } + } else if (typeTag == Processing::Type::source) { + auto typeIter = sAudioSourceTable.find(type); + if (typeIter != sAudioSourceTable.end()) { + return typeIter->second; + } + } + + return std::nullopt; +} + +bool EffectConfig::parseProcessing(Processing::Type::Tag typeTag, const tinyxml2::XMLElement& xml) { + LOG(DEBUG) << __func__ << dump(xml); + const char* typeStr = xml.Attribute("type"); + auto aidlType = stringToProcessingType(typeTag, typeStr); + RETURN_VALUE_IF(!aidlType.has_value(), false, "illegalStreamType"); + RETURN_VALUE_IF(0 != mProcessingMap.count(aidlType.value()), false, "duplicateStreamType"); + + for (auto& apply : getChildren(xml, "apply")) { + const char* name = apply.get().Attribute("effect"); + if (mEffectsMap.find(name) == mEffectsMap.end()) { + LOG(ERROR) << __func__ << " effect " << name << " doesn't exist, skipping"; + continue; + } + RETURN_VALUE_IF(!name, false, "noEffectAttribute"); + mProcessingMap[aidlType.value()].emplace_back(mEffectsMap[name]); + LOG(WARNING) << __func__ << " " << typeStr << " : " << name; + } + return true; +} + +const std::map>& +EffectConfig::getProcessingMap() const { + return mProcessingMap; +} + bool EffectConfig::findUuid(const std::string& xmlEffectName, AudioUuid* uuid) { // Difference from EFFECT_TYPE_LIST_DEF, there could be multiple name mapping to same Effect Type #define EFFECT_XML_TYPE_LIST_DEF(V) \ diff --git a/audio/aidl/default/EffectFactory.cpp b/audio/aidl/default/EffectFactory.cpp index f0687cc80f..7073a10c96 100644 --- a/audio/aidl/default/EffectFactory.cpp +++ b/audio/aidl/default/EffectFactory.cpp @@ -15,8 +15,10 @@ */ #include +#include #include #include +#include #include #include #define LOG_TAG "AHAL_EffectFactory" @@ -52,6 +54,22 @@ Factory::~Factory() { } } +ndk::ScopedAStatus Factory::getDescriptorWithUuid(const AudioUuid& uuid, Descriptor* desc) { + RETURN_IF(!desc, EX_NULL_POINTER, "nullDescriptor"); + + if (mEffectLibMap.count(uuid)) { + auto& entry = mEffectLibMap[uuid]; + getDlSyms(entry); + auto& libInterface = std::get(entry); + RETURN_IF(!libInterface || !libInterface->queryEffectFunc, EX_NULL_POINTER, + "dlNullQueryEffectFunc"); + RETURN_IF_BINDER_EXCEPTION(libInterface->queryEffectFunc(&uuid, desc)); + return ndk::ScopedAStatus::ok(); + } + + return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT); +} + ndk::ScopedAStatus Factory::queryEffects(const std::optional& in_type_uuid, const std::optional& in_impl_uuid, const std::optional& in_proxy_uuid, @@ -69,12 +87,7 @@ ndk::ScopedAStatus Factory::queryEffects(const std::optional& in_type for (const auto& id : idList) { if (mEffectLibMap.count(id.uuid)) { Descriptor desc; - auto& entry = mEffectLibMap[id.uuid]; - getDlSyms(entry); - auto& libInterface = std::get(entry); - RETURN_IF(!libInterface || !libInterface->queryEffectFunc, EX_NULL_POINTER, - "dlNullQueryEffectFunc"); - RETURN_IF_BINDER_EXCEPTION(libInterface->queryEffectFunc(&id.uuid, &desc)); + RETURN_IF_ASTATUS_NOT_OK(getDescriptorWithUuid(id.uuid, &desc), "getDescriptorFailed"); // update proxy UUID with information from config xml desc.common.id.proxy = id.proxy; _aidl_return->emplace_back(std::move(desc)); @@ -85,12 +98,26 @@ ndk::ScopedAStatus Factory::queryEffects(const std::optional& in_type ndk::ScopedAStatus Factory::queryProcessing(const std::optional& in_type, std::vector* _aidl_return) { - // TODO: implement this with audio_effect.xml. - if (in_type.has_value()) { - // return all matching process filter - LOG(DEBUG) << __func__ << " process type: " << in_type.value().toString(); + const auto& processings = mConfig.getProcessingMap(); + // Processing stream type + for (const auto& procIter : processings) { + if (!in_type.has_value() || in_type.value() == procIter.first) { + Processing process = {.type = procIter.first /* Processing::Type */}; + for (const auto& libs : procIter.second /* std::vector */) { + for (const auto& lib : libs.libraries /* std::vector */) { + Descriptor desc; + if (libs.proxyLibrary.has_value()) { + desc.common.id.proxy = libs.proxyLibrary.value().uuid; + } + RETURN_IF_ASTATUS_NOT_OK(getDescriptorWithUuid(lib.uuid, &desc), + "getDescriptorFailed"); + process.ids.emplace_back(desc); + } + } + _aidl_return->emplace_back(process); + } } - LOG(DEBUG) << __func__ << " return " << _aidl_return->size(); + return ndk::ScopedAStatus::ok(); } diff --git a/audio/aidl/default/audio_effects_config.xml b/audio/aidl/default/audio_effects_config.xml index c06742d966..6627ae7533 100644 --- a/audio/aidl/default/audio_effects_config.xml +++ b/audio/aidl/default/audio_effects_config.xml @@ -95,8 +95,17 @@ + + + + + + + + +